run: move.w #$7FFF,$DFF096 ; disable all DMA mouse: move.w #$64,d1 bsr waitraster : wait for raster line 100 move.w #$F00,$DFF180 ; change bg color move.w #$64+$0A,d1 bsr waitraster : wait for raster line in 100+10 move.w #$000,$DFF180 ; change bg color btst #6,$BFE001 ; is lmb prssed bne mouse ; 0 = pressed end: move.w #$FFFF,$DFF096 ; enable all DMA before back to os 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