0 Members and 1 Guest are viewing this topic.
di ld a,$99 ;setting up interrupt ld i,a ld hl,Interrupt ld ($993F),hl ld ($997F),hl ld ($99BF),hl ld ($99FF),hl im 2 ld e,$FF ei Loop: ;Infinite loop o' ram clears jr Loop Interrupt: ld a,26 ;setting column out ($10),a call WasteTime ;my equivalent of _LCD_BUSY_QUICK ld a,$96 ;setting row out ($10),a call WasteTime ld a,e ;displaying e as row of pixels out ($11),a dec e retiWasteTime: ld l,10WasteLoop: nop ;344 T-states, just to be safe nop nop nop dec l jr nz,WasteLoop ret
dec ereti
; disable interrupts and set interrupt mode 2diim 2; set the upper byte of the jumptable to $80 ld a,$80ld i,a; create the vector table (do this every time before you enable interrupts, be sure to disable interrupts before archiving / unarchiving stuff)ld hl, $8000ld de, $8001ld (hl), $85ld bc,256ldir; setting up the jump handler at $8585ld hl,$8585ld (hl),$c3 ; this is the jp instructionld de,InterruptHandler ; replace this with whatever label you are jumping to, where you have your interrupt handlerinc hlld (hl),einc hlld (hl),d; time to enable interruptsei
#define basepage $8584Run: ; disable interrupts and set interrupt mode 2 di im 2 ; save whichever page we are on so that we know where to go in a,(6) ld (basepage),a ; set the upper byte of the jumptable to $80 ld a,$80 ld i,a ; now we copy our interrupt loader to ram, we only have to do this once ld hl,LoadInterrupt ld de,keyToStr ld bc,LoadInterruptSize ldir ; create the vector table (do this every time before you enable interrupts, be sure to disable interrupts before archiving / unarchiving stuff) ld hl, $8000 ld de, $8001 ld (hl), $85 ld bc,256 ldir ; setting up the jump handler at $8585 ld hl,$8585 ld (hl),$c3 ; this is the jp instruction ld de,InterruptHandler ; replace this with whatever label you are jumping to, where you have your interrupt handler inc hl ld (hl),e inc hl ld (hl),d ; time to enable interrupts ei; we will copy this to ram, it'll swap us the correct page in and swap back whichever page we had beforeLoadInterrupt: push af in a,(6) push af ld a,(basepage) out (6),a call Interrupt pop af out (6),a pop af ei retLoadInterruptSize = $ - LoadInterrupt; now we have our actual interrupt handlerInterrupt: ; we can do whatever here, since LoadInterrupt already does ei we don't have to do it in here ret
.db $76,$98 ; reverse order due to little endian-ness.db $76,$98.db $76,$98.db $76,$98.db $76,$98etc.
Thank you Sorunome, but I'm afraid that's not the problem. I got the interrupt setup method I used from http://tutorials.eeems.ca/ASMin28Days/lesson/day23.html, which explains that the lowest 6 bits of the data bus are always set when calling a mode 2 interrupt. There may be a catch to this, but the fact that the pixels were displayed as intended in my original program shows that the interrupt was called correctly.