Simulating a keypress in Euphoric debugger

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Simulating a keypress in Euphoric debugger

Post by Symoon »

Ok, here's the story.
I want to upgrade my old disk transfer tool (Cloaddsk), that reads a disk on real Oric, saves it to PC using the tape save (a simple CSAVE of the read data), then building a disk image (DSK file) from it.
This works perfectly fine with Sedoric disks, I'd like to make it work with any kind of disk.

To do so, I need a routine reading a whole track, including the gaps. Nibble 2.4 does this, so I tried to disassemble it and find the routine, but after several evenings (since 2004), I'm getting nowhere. I'm lost in so much machine code.

So I thought I could locate this routine by using Euphoric's debugger (the routine crashed Oricutron 0.9). But to do so and follow the step by step execution, I have to simulate the keys that trigger the command (CTRL P, that is). Simply typing on keyboard is impossible: time to switch to the debugger, I'd miss the routine start.

So I use the debugger again, and write $9D in $0208, and $A2 in 0209, which are the values I found when I press CTRL P on the keyboard.
But nothing happens.

So my questions are:
- does anyone know how to simulate the CTRL P key combination by "poking" in RAM?
- alternatively, does anyone know where the "load track" routine starts in Nibble 2.4?
- alternatively again, does anyone have a routine (ideally in machine code, not C or ASM) that reads a whole track, with parameters Track / Side / Drive
:?:

All this to try and transfer a special protected disk ;) (18 sectors per track and protection byte in the gaps, not Jasmin, not Sedoric, which readdsk doesn't read).
Upgrading Cloaddsk this way would be the ultimate transfer tool, reading on a real Oric any disk format.

Thanks!
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: Simulating a keypress in Euphoric debugger

Post by Symoon »

Found it.
To simulate CTRL P (in Nibble, at least), here are the values you have to set:
$0208 $9D (don't understand, but I saw this - guess it's something like a keyboard matrix value)
$0209 $A2 (for CTRL key if I'm not mistaken)
...
$02DF $D0 (which is $50, hex value for ASCII code of "P", with bit 7 set).

Back to the emulator, it behaves as if I pressed CTRL P.

I hope now I will be able to follow step by step what happens next, thus find the entry point to the loading track routine. Pfew!

EDIT: oh well, it worked, and now it's not working anymore. I'm fet up, giving up.
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: Simulating a keypress in Euphoric debugger

Post by Symoon »

One year later ;)
To simulate CRTL + Key, just put $40 + ASCII code of the key into memory $02DF.

For instance, L is $4C; so put $8C into $02DF and the screen will be blanked as with CTRL L.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Simulating a keypress in Euphoric debugger

Post by Dbug »

Cool, that can be useful indeed, thanks for sharing :)
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: Simulating a keypress in Euphoric debugger

Post by Symoon »

What's strange is that if I do it in machine code (LDA $8C STA$02DF RTS), it has no effect when I call the routine.
But if I execute the routine step by step with the Euphoric debugger, it works, the screen clears.
:?:
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Simulating a keypress in Euphoric debugger

Post by Dbug »

Symoon wrote:What's strange is that if I do it in machine code (LDA $8C STA$02DF RTS), it has no effect when I call the routine.
But if I execute the routine step by step with the Euphoric debugger, it works, the screen clears.
:?:
You meant LDA #$8C

When you write LDA $8C it means "load A with whatever is present at the memory address $008C"
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: Simulating a keypress in Euphoric debugger

Post by Symoon »

Dbug wrote:
Symoon wrote:What's strange is that if I do it in machine code (LDA $8C STA$02DF RTS), it has no effect when I call the routine.
But if I execute the routine step by step with the Euphoric debugger, it works, the screen clears.
:?:
You meant LDA #$8C

When you write LDA $8C it means "load A with whatever is present at the memory address $008C"
Yes you're right - sorry I never use assembler actually, I write directly the op codes on paper and on a file. So I'm not quite good with the syntax - but I used $A9 opcode indeed ;)
Post Reply