0 Members and 2 Guests are viewing this topic.
interrupt: push af push bc push de push hl ld hl,(progPtr) push hl .db 21hIprogPtr: .dw 0 ld a,h \ or l ld (progPtr),hl call nz,ParserNextEndExec: pop hl ld (progPtr),hl pop hl pop de pop bc pop af retinterrupt_end:
Xor aout (3),ald a,%00001011 ; this set interupts to go on with hardware timer 1 the on key and the link portout (3),a
Along with Geekboy's suggestion. You also need to reenable interrupts. When the interrupt fires, there is an automatic DI that gets run, so you need to undo it.
di ld hl,interrupt ld de,8A8Ah ld bc,interrupt_end - interrupt ldir ld hl,8000h ld de,8001h ld bc,256 ld (hl),8Ah ldir ld a,80h ld i,a im 2
di ld hl,interrupt ld de,8A8Ah ld bc,interrupt_end - interrupt ldir ld hl,8000h ld de,8001h ld bc,257 ld (hl),8Ah ldir ld a,%00001011 out (3),a ld a,80h ld i,a im 2
interrupt:; or a \ ret nc push af push bc push de push hl ld hl,(progPtr) push hl .db 21hIprogPtr: .dw 0 ld a,h \ or l jr z,EndExec jr nz,$ ld (progPtr),hl ld (IprogPtr2),hl sbc hl,hl \ ld (IprogPtr),hl call ParserNext .db 21hIprogPtr2: .dw 0 ld (IprogPtr),hlEndExec: sub a out (3),a ld a,%00001011 out (3),a pop hl ld (progPtr),hl pop hl pop de pop bc pop af ei retinterrupt_end:
After the call to ParserNext, IprogPtr is never updated. I'm not sure if ParserNext is supposed to advance any pointers, but it certainly won't here. Also, for those of us who don't have the Z80 opcode table memorized, you should add a comment for .db 21h that says ; ld hl, imm16The only other thing that comes to mind is that you need to make ensure that ParseNext completes quickly or else the main code won't run. Also, make sure that the routine never EIs. Check to make sure the interrupt vector table is correct. And don't even think of running that from flash.