INCLUDE "include/PhotonsMiniWrapper.s" ********** Demo ********** ;Demo-specific non-startup code below. w =320 ;screen width, height, depth h =256 ;180 for 16:9 friendly bpls =3 bpl =w/16*2 ;byte-width of 1 bitplane line bwid =bpls*bpl ;byte-width of 1 pixel line (all bpls) ;modulo operator ;d0 dividend ;d1 divisor ;d2 remainder modulo: clr.l d2 move.w d0, d2 divu d1, d2 swap d2 rts Demo: ;a4=VBR, a6=Custom Registers Base addr *--- init ---* move.l #VBint,$6c(a4) ;Set our new VERTB vector, move.w #$c020,$9a(a6) ;and enable the interrupt. move.w #$87c0,$96(a6) ;Enable Blitter, Bitplane, Copper DMA lea Screen,a0 ;pointer start addr moveq #bpl,d0 ;pointer addr increment lea BplPtrs+2,a1 ;start position to poke in copper moveq #bpls-1,d1 ;pointer count-1 bsr.s PokePtrs ;poke bitplane ptrs into copper list. move.l #Copper,$80(a6) ;Now set our initalized copper. *--- main loop ---* MainLoop: ;framecounter move.l frame,d1 addq.l #1,d1 move.l d1,frame lea Screen,a1 ;Then, the screen bsr.s ClearScreen ;clear, Yoda pls. bsr.s WaitBlitter ;Wait out blit: we plot to same area lea Screen,a1 ;and to the destination screen move.l xpos, d0 movem.l d0,-(sp) ;push to stack move.l #319, d7 ;loop iterations .loop1: move.w xpos, d1 move.w #10, d2 move.w #2, d3 bsr.s PutPixel move.w xpos,d0 addq.w #1,d0 move.w d0,xpos subq.w #1,d7 bne .loop1 movem.l (sp)+,d0 ;pop from stack move.l d0, xpos move.w #$111,$180(a6) ;(Optional: shows rastertime left) move.w #$12c,d0 ;No buffering, so wait until raster bsr.w WaitRaster ;is below the Display Window. btst #6,$bfe001 ;Left mouse button not pressed? bne.s MainLoop ;then loop *--- exit ---* rts ;else exit demo ********** Demo Routines ********** PokePtrs: ;Generic, poke ptrs into copper list .bpll: move.l a0,d2 swap d2 move.w d2,(a1) ;high word of address move.w a0,4(a1) ;low word of address addq.w #8,a1 ;skip two copper instructions add.l d0,a0 ;next ptr dbf d1,.bpll rts ClearScreen: ;a1=screen destination address to clear bsr.w WaitBlitter clr.w $66(a6) ;destination modulo move.l #$01000000,$40(a6) ;set operation type in BLTCON0/1 move.l a1,$54(a6) ;destination address move.w #h*bpls*64+bpl/2,$58(a6) ;blitter operation size: 768x20 words rts ;d1=x, d2=y, d3=color, a1=screen PutPixel: movem.l d1-d5/a1,-(sp) muls #bwid,d2 ;Address offset for line move.w d1,d4 ;left-to-right x position, not.w d4 ;to bit 7-0 (other bits unused by bset) asr.w #3,d1 ;Byte offset for x position ext.l d1 ;(big offsets for large screens?) add.l d1,d2 ;added to final address offset. moveq #bpls-1,d5 ;Loop through bitplanes: .l: ror.b #1,d3 ;color bit for bitplane set? bpl.s .noset bset d4,(a1,d2.l) ;then set bit. .noset: lea bpl(a1),a1 ;go to next bitplane dbf d5,.l movem.l (sp)+,d1-d5/a1 rts VBint: ;Blank template VERTB interrupt movem.l d0/a6,-(sp) ;Save used registers, could have been lea $dff000,a6 ;modified, so set custom base again. btst #5,$1f(a6) ;My level 3 interrupt? beq.s .notvb ;if not, skip *--- do stuff here ---* moveq #$20,d0 ;VB interrupt bit move.w d0,$9c(a6) ;clear, Yoda pls. move.w d0,$9c(a6) ;twice, Yoda pls. (A4000 fix) .notvb: movem.l (sp)+,d0/a6 rte ******************************************************************************* SECTION ChipData,DATA_C ;declared data that must be in chipmem ******************************************************************************* Copper: dc.w $1fc,0 ;Slow fetch mode, remove if AGA demo. dc.w $8e,$2c81 ;Standard display window top, left dc.w $90,$2cc1 ;and bottom, right. dc.w $92,$38 ;Standard bitplane dma fetch start dc.w $94,$d0 ;and stop for standard screen. dc.w $108,bwid-bpl ;modulos dc.w $10a,bwid-bpl dc.w $102,0 ;Scroll register (and playfield pri) Palette: ;Palette from COLOR00 to COLOR07 dc.w $180,$000 ;black (red,green,blue=0,0,0) dc.w $182,$00f ;blue dc.w $184,$0f0 ;green dc.w $186,$0ff ;cyan (=green+blue) dc.w $188,$f00 ;red dc.w $18a,$f0f ;magenta (=red+blue) dc.w $18c,$ff0 ;yellow (=red+green) dc.w $18e,$fff ;white (red,green,blue=15,15,15) BplPtrs: dc.w $e0,0 ;set high dc.w $e2,0 ;and low word of bitplane ptr 1 dc.w $e4,0 ;same for bitplane 2 dc.w $e6,0 dc.w $e8,0 ;and bitplane 3 dc.w $ea,0 dc.w $100,bpls*$1000+$200 ;enable bitplanes dc.w $ffdf,$fffe ;allow VPOS>$ff dc.w $ffff,$fffe ;magic value, signals end of copperlist ;sine table sin32_15: dc.b 8,9,10,12,13,14,14,15,15,15,14,14,13,12,10,9,8,6,5,3,2,1,1,0,0,0,1,1,2,3,5,6 frame: dc.l 0 xpos: dc.l 0 ypos: dc.l 0 ******************************************************************************* SECTION ChipBuffers,BSS_C ;BSS doesn't count toward exe size ******************************************************************************* Screen: ds.b h*bwid ;Define storage to reserve for screen
Comments
0 B
|👍
/👎
0 B
|0 👍
/0 👎
0 B
|0 👍
/0 👎
0 B
|0 👍
/0 👎
0 B
|👍
/👎