INCDIR Include: INCLUDE hardware/dmabits.i INCLUDE hardware/custom.i INCDIR ASM:Source/Own/KampSpil/ INCLUDE gfx.i Section gfx_code, code displaybuf: ; a0 : ptr to screenbuffer movem.l A0-A6/D0-D7, -(SP) LEA.l cop_planes, A1 move.l #4, D1 db_l1: move.l A0, D0 move.w D0, 6(a1) swap D0 move.w d0, 2(a1) add.l #8, A1 add.l #10240, A0 dbra D1, db_l1 movem.l (SP)+, A0-A6/D0-D7 rts display_visual: move.l A0, -(SP) move.l visual, A0 jsr displaybuf move.l (SP)+, A0 rts clearmem: ; a0 : ptr to mem ; D0 : size in bytes movem.l A0-A6/D0-D7, -(SP) lsr.l #2, D0 sub.l #1, D0 cm_l1: move.l #0, (A0)+ dbra D0, cm_l1 movem.l (SP)+, A0-A6/D0-D7 rts copymem: ; a0 : ptr to source ; a1 : ptr to dest ; D0 : size in bytes movem.l A0-A6/D0-D7, -(SP) lsr.l #2, D0 ; d0 = d0/4 sub.l #1, D0 cm2_l1: move.l (A0)+, (A1)+ dbra D0, cm2_l1 movem.l (SP)+, A0-A6/D0-D7 rts putobj: ; a0 : ptr to object ; a1 : ptr to screenbuffer ; a2 : ptr to objectmask ; d0 : width of obj in pixels ; d1 : height of obj in pixels ; d2 : xpos to put obj at ; d3 : ypos to put obj at jsr waitblit movem.l A0-A6/D0-D7, -(SP) ; ;a0=sourceA, a1=sourceB, a2=mask, a3=dest ;calculate shift move.w D2, D5 and.w #%0000000000001111, D5 ror.w #4, D5 ; move x and y lsr.l #3, d2 ; d2=d2/16 add.l D2, A1 mulu.w #40, D3 add.l D3, A1 move.l A1, A3 move.w #($200!$100!$800!$400!%11100010),D4 ;function etc. or.w D5, D4 ; shift move.w #4,D7 ;5 bitplanes putobj_l1: bsr waitblit move.l custom,A4 move.l A0,bltApt(A4) move.l A2,bltBpt(a4) move.l A1,bltCpt(A4) move.l A3,bltDpt(a4) ;destpic1 move.w #0,BLTaMOD(A4) move.w #0,BLTbMOD(A4) move.w #(320-80)/8,BLTcMOD(A4) move.w #(320-80)/8,BLTdMOD(A4) move.w d4,BltCon0(a4) move.w d5,bltcon1(a4) move.w #%0010000000000101,BLTSIZE(A4) ;128 lines 5 words add.l #1280,A0 add.l #10240,A1 add.l #10240,A3 dbra d7,putobj_l1 movem.l (SP)+, A0-A6/D0-D7 rts waitblit: movem.l A0,-(SP) move.l custom,A0 btst.b #DMAB_BLTDONE-8,DMACONR(A0) waitblit2: btst.b #DMAB_BLTDONE-8,DMACONR(A0) bne waitblit2 movem.l (SP)+,A0 rts wait_for_rast: cmp.b #$ff,$DFF006 ;Wait for rasterbeam bne wait_for_rast rts swapscreens: move.l A0, -(SP) move.l active, A0 move.l visual, active move.l A0, visual jsr wait_for_rast jsr display_visual move.l (SP)+, A0 rts custom:dc.l $DFF000 active: dc.l 0 ; active and visual screenbuffer (ptr to) visual: dc.l 0 .