Getting H.TIMI Interrupt

Pagina 2/2
1 |

Van fpracek

Rookie (25)

afbeelding van fpracek

20-08-2022, 11:06

….

Van fpracek

Rookie (25)

afbeelding van fpracek

20-08-2022, 10:22

Sorry for the delay, but I was in holidays.
Ducasp, I'm trying to do a resident code. Thanks for your considerations and there are important for me.
But I don't understand because before "ldir" statement I have this LH and DE registries states:


https://www.msx.pics/image/y3thF
and after I see this:


https://www.msx.pics/image/y3sW0

I'd expect the same five bites and not all C9 in five DE bytes...

ldir doesn't copy bc times values from (HL) to (DE)?

Thanks

Van ro

Scribe (4817)

afbeelding van ro

20-08-2022, 13:11

Hey, LDIR indeed copies (HL) to (DE), BC times. Default the h.timi hook might be (depending on machine) just 5 0xC9 instructions (meaning RET). So, your code seems legit. What do you expect as outcome?

Van Arjan

Paladin (775)

afbeelding van Arjan

20-08-2022, 14:34

Why did you mark $FD9A-$FD9E in that image? H.TIMI starts at $FD9F. H.KEYI starts at $FD9A.

The contents of the memory in your images looks strange to me. When I start DOS1, H.KEYI is filled with $C9, H.TIMI does an interslot call (CALLF) and the hooks after that are filled with $C9 again.

Keep in mind that when overwriting hooks the interrupts must be disabled because an interrupt can even occur during an LDIR instruction (LDIR is basically LDI but after each step the PC is set to the address of this instruction again).

In DOS you shouldn't use HIMEM to determine the highest free address, but the address found at location $06-$07 (is there an official name for this variable? DOSTPA?). This is actually the address where a call to BDOS at $05 jumps to. If you want to play nice and allow other resident programs to be installed you'll have to update this address to an make sure the original BDOS function still can be called. Also, the stackpointer should be updated because otherwise it'll point to a location in your resident program.

Van ro

Scribe (4817)

afbeelding van ro

20-08-2022, 16:37

Arjan's right,
this
H_TIMI equ #FD9A
indeed is the line interrupt hook, not the vblank hook.
it's like this:

H_KEYI equ #FD9A ;Line Int hook
H_TIMI equ #FD9F ;Vblank int hook

Still, it doesn't change the fact that your code does exactly what you expect Smile

Van fpracek

Rookie (25)

afbeelding van fpracek

23-08-2022, 15:38

Thanks to all for the help!!!!!
I updated my code and now it seems works!

Pagina 2/2
1 |