Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Interrupt Mode 2
#2
Thinking about it some more. If we assume the programmer is smart enough to NOT use the last three pages of memory, we can probably use them for IM2 purposes.

The program below is far from stable. It crashes eventually, depending what you try to do. It's probably because it tries to go back to basic, which we probably don't want to generally. That or I forgot some registers or something.

It's interesting to see it print in the middle of the screen and refuse to move it though!

Code:
sub im2Initialize()
DIM addr as uInteger

FOR addr=$FD00 TO $FE00
poke addr,$FE
NEXT addr

POKE $FEFE,243 '; di
POKE $FEFF,205 '; CALL
POKE Uinteger $FF00,@isr
POKE $FF02,251 '; ei
POKE $FF03,$ED
POKE $FF04,77 '; ED4D reti

asm
LD A,$FD
LD I,A
IM 2
end asm

return

isr:
asm
;This is the interrupt Service Rotuine
; First thing, save those registers.
PUSH AF
PUSH BC
PUSH DE
PUSH HL
PUSH IX
EXX
PUSH AF
PUSH BC
PUSH DE
PUSH HL
end asm

Print at 10,10;"Ha!"

asm
POP HL
POP DE
POP BC
POP AF
EXX
POP IX
POP HL
POP DE
POP BC
POP AF

; This jumps to the ROM ISR.
call $0038
ret
end asm
end sub

PRINT "Hello world"
im2Initialize()
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)