0 Members and 3 Guests are viewing this topic.
Interrupt Mode 0When an interrupt is requested, the Z80 reads a byte from the data bus and executes it. This can be a single-byte instruction or the start of a multi-byte instruction; for speed reasons commonly RST $nn is used to start processing an interrupt handler due to it's compact encoding.If no external device is driving the bus, the Z80 will read a garbage value. In systems with pull-up or pull-down resistors on the bus, the value read will be $FF (RST $38) or $00 (NOP) respectively.
:AsmPrgm:F33E20D310:AFD330D333D336:210080118181:0600732310FC:368221ED9D0E03:EDB0:11818221F09D:0E07EDB0:3E80ED47ED5EFB:ED5EFB:1C7BD311:DB04E60820F3: ED56 FB76C9:41414152474821:00:E1ED56FB76:21D99DEF0A45:C9:C3E19D:08AFD30208FBC9Assembly! .org blah .db blah, blah blahStart: di ; F3 ld a, 20h ; 3E20 out (10h), a ; D310 xor a ; AF out (30h), a ; D330 out (33h), a ; D333 out (36h), a ; D336 ld hl, 8000h ; 210080 ld de, 8181h ; 118181 ld b, 0 ; 0600_: ld (hl), e ; 73 inc hl ; 23 djnz -_ ; 10FC ld (hl), 82h ; 3682 ld hl, ISR ; 21ED9D ld c, ISR2-ISR ; 0E03 ldir ; EDB0 ld de, 8281h ; 118182 ld hl, ISR2 ; 21F09D ld c, ISR_end-ISR2 ; 0E07 ldir ; EDB0 ld a, 80h ; 3E80 ld i, a ; ED47 im 2 ; ED5E ei ; FBloop: im 2 ; ED5E ei ; FB inc e ; 1C ld a, e ; 7B out (11h), a ; D311 in a, (4) ; DB04 and 8 ; E608 jr nz, loop ; 20F3quit: im 1 ; ED56 ei ; FB halt ; 76 ret ; C9strARGH: .db "AAARGH!", 0 ; 4141415247482100ARGH: pop hl ; E1 im 1 ; ED56 ei ; FB halt ; 76 ld hl, strARGH ; 21D99D b_call(_PutS) ; EF0A45 ret ; C9ISR: jp ARGH ; C3E19DISR2: ex af, af' ; 08 ; During the six hours it took me to come up with this, I discovered the right way to acknowledge interrupts: xor a ; AF out (2), a ; D302 ex af, af' ; 08 ei ; FB ret ; C9isr_end: