run: moveq #0,d0 ; set all to zero mouse: move.w #150,d1 bsr waitraster : wait for raster line in d1 move.w #$0FF,$DFF180 ; change bg color btst #6,$BFE001 ; is lmb prssed bne mouse ; 0 = pressed end: rts waitVBI: move.l $DFF004,d0 ; get vpos lsr.l #8,d0 ; shift 8 to left and.l #$1FF,d0 ; mask out the 9bits of vpos cmp.l #$138,d0 ; are we at VBI bne waitVBI ; no -> wait rts waitraster: ; expects line to wait for in d1.w move.l $DFF004,d0 ; get vpos lsr.l #8,d0 ; shift 8 to left and.l #$1FF,d0 ; mask out the 9bits of vpos cmp.l d1,d0 ; are we at the wanted line bne waitraster ; no -> wait rts