A86: User interrupt


[Prev][Next][Index][Thread]

A86: User interrupt




I was experimenting with Matt Johnson's Interrupt
examples and i thought that it was nifty to have
a sprite display your initials or something in the 
upper-right corner of the screen. What i didn't want 
though was to have it appear while playing an asm 
game. This is what i came up with:

(this is not the whole prog)

            ld        hl,0
            add    hl,sp
            ld        b,10
stack_search:
            ld        (instr+2),hl            ; self changing code (ld de,(hl)
instr:    ld        de,($0000) 
            call     cp_n_de     
            ret      c
            inc      hl
            inc      hl
            djnz    stack_search
;--------------------------------------------------------------
cp_n_de:
            ld       a,$D7
            cp      d
            ret     nz
            ld       a,$48
            cp      e
            ret

It's probably not perfect but it works, it searches through
the stack to find out if any asm program was running 
when the interrupt occured.

Has this been done before ?

Any comments ?

/Thomas Bladh