From fc44a155487129800d17c4fad2a549ba06863c08 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Fri, 4 Mar 2016 21:16:51 +1100 Subject: [PATCH] Moved update code into vblank isr --- 009.anim_blit/anim_blit.s | 44 ++++++++++++++++++++------------ 009.anim_blit/bin/anim_blit.adf | Bin 901120 -> 901120 bytes 009.anim_blit/blit.s | 7 +++-- 009.anim_blit/init.s | 7 +++-- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/009.anim_blit/anim_blit.s b/009.anim_blit/anim_blit.s index bcd247b..1e6c7f3 100644 --- a/009.anim_blit/anim_blit.s +++ b/009.anim_blit/anim_blit.s @@ -8,31 +8,41 @@ entry: lea CUSTOM,a6 bsr init - moveq #0,d0 ; starting x position for the blitter object - moveq #0,d1 ; starting y position for the blitter object lea bitplanes(pc),a0 lea emoji,a1 lea emojiMask,a2 .mainLoop: - bsr.s waitvbl - addq #1,d0 ; move the blitter object one pixel to the left - addq #1,d1 ; move the blitter object one pixel down - bsr.s blitObject64 ; blit 64 pixel object (x=d0,y=d1,background=a0,object=a1,mask=a2) - cmp.l #SCREEN_WIDTH-BLIT_BOB_WIDTH64+16,d0 ; check if we need to wrap the x - bne.s .skip - moveq #0,d0 ; wrap x back to zero -.skip: - - cmp.l #SCREEN_HEIGHT-BLIT_BOB_HEIGHT64,d1 ; check if we need to wrap the y - bne.s .skip2 - moveq #0,d1 ; wrap y back to the top -.skip2: bra.s .mainLoop - include "utils.s" include "blit.s" include "init.s" - + +level3InterruptHandler: + movem.l d0-a6,-(sp) + move.w #INTF_VERTB,INTREQ(a6) ; clear interrupt bit + +.moveBlitterObject: + lea xpos(pc),a3 + lea ypos(pc),a4 + add.l #1,xpos ; move the blitter object one pixel to the left + add.l #1,ypos ; move the blitter object one pixel down + bsr.s blitObject64 ; blit 64 pixel object (x=d0,y=d1,background=a0,object=a1,mask=a2) + cmp.l #SCREEN_WIDTH-BLIT_BOB_WIDTH64+16,xpos ; check if we need to wrap the x + bne.s .skip + move.l #0,xpos ; wrap x back to 0 +.skip: + cmp.l #SCREEN_HEIGHT-BLIT_BOB_HEIGHT64,ypos ; check if we need to wrap the y + bne.s .done + move.l #0,ypos ; wrap y back to 0 +.done: + + +.interruptComplete: + movem.l (sp)+,d0-a6 + rte + +xpos: dc.l 0 +ypos: dc.l 0 copper: ;; bitplane pointers must be first else poking addresses will be incorrect diff --git a/009.anim_blit/bin/anim_blit.adf b/009.anim_blit/bin/anim_blit.adf index aaf85b3f1d380bb759df9f1e1fe4b8f6e1225165..ceaa834783b003c183d4789bd5bc01f76e984021 100644 GIT binary patch delta 253 zcmZo@FmGru-@wVDJgH)#Pt`$l*u}5()AU(9t;fzdJG-5HO&VYrrFjU zP+*wlbHDyS#01+K1_g#W?!Op3Jb^f9Cj&cE3z+OkWcYiFXD0&#BLhe*jZ66t0|)@w zAW?<`KvoBmXb0HLVz3$z@d$_?FfeS+V#~SP^rYXpa9#G%K)#=w;J z!><&iHt~%LgBruLZVhHNh8Nv0yQefi^m^%K>%;(rll@rYHg92ZWMs{7{l#E0`4_9S zw2ZC?LxX`HLx*im^8towwlxnJ7-m5X-`vAia(7~YR@0NVCyZ@RnA)B&w>@ELd&1iG agstrfd)pI^wkMozPq^Bia4&npa|Zy