.include "jaguar.inc" ;; packtest - A small program testing the GPU pack and unpack instructions ;; ;; Success is indicated by a yellow screen. ;; Failure results in a red screen. ;; ;; Building: ;; ;; rmac -fb packtest.s ;; rln -e -a 4000 x x -o packtest.cof packtest.o ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Program Entry Point Follows... .text move.l #$70007,G_END ; big-endian mode move.l #$70007,D_END move.w #$FFFF,VI ; disable video interrupts move.l #INITSTACK,a7 ; Setup a stack move.l #testPack,G_PC ; Set GPU PC move.l #RISCGO,G_CTRL ; Go! waitforgpu: move.l G_CTRL,d0 ; Wait for write. andi.l #$1,d0 bne waitforgpu ; Configure Video move.w #(PWIDTH4|BGEN|CSYNC|CRY16|VIDEN),VMODE infinite: bsr.s infinite ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Procedure: testPack ; Unpack and re-pack a pixel of CRY data on the GPU and set it as the ; background color. ; ; Inputs: packedVal - Variable containing the value to unpack then pack ; ; NOTE!!!: This code can run in DRAM only because it contains no JUMP's or ; JR's. It will generate a warning with current versions of MADMAC ; because it doesn't '.ORG'. ; .long .gpu testPack: movei #packedVal,r0 ; Read value to pack load (r0),r1 movei #BG,r0 ; Store it unpack r1 pack r1 storew r1,(r0) moveq #0,r0 ; Stop GPU movei #G_CTRL,r1 store r0,(r1) nop ; Two "feet" on the brake pedal nop .68000 .data .long packedVal: .dc.l ($f<<12)|($f<<8)|$ff ; CRY Yellow ;^red ^cyan ^intensity .text ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Procedure: InitVideo (same as in vidinit.s) ; Build values for hdb, hde, vdb, and vde and store them. ; InitVideo: movem.l d0-d6,-(sp) move.w CONFIG,d0 ; Also is joystick register andi.w #VIDTYPE,d0 ; 0 = PAL, 1 = NTSC beq palvals move.w #NTSC_HMID,d2 move.w #NTSC_WIDTH,d0 move.w #NTSC_VMID,d6 move.w #NTSC_HEIGHT,d4 bra calc_vals palvals: move.w #PAL_HMID,d2 move.w #PAL_WIDTH,d0 move.w #PAL_VMID,d6 move.w #PAL_HEIGHT,d4 calc_vals: move.w d0,width move.w d4,height move.w d0,d1 asr #1,d1 ; Width/2 sub.w d1,d2 ; Mid - Width/2 add.w #4,d2 ; (Mid - Width/2)+4 sub.w #1,d1 ; Width/2 - 1 ori.w #$400,d1 ; (Width/2 - 1)|$400 move.w d1,a_hde move.w d1,HDE move.w d2,a_hdb move.w d2,HDB1 move.w d2,HDB2 move.w d6,d5 sub.w d4,d5 move.w d5,a_vdb add.w d4,d6 move.w d6,a_vde move.w a_vdb,VDB move.w #$FFFF,VDE move.l #0,BORD1 ; Black border move.w #0,BG ; Init line buffer to black movem.l (sp)+,d0-d6 rts .bss .long a_hdb: .ds.w 1 a_hde: .ds.w 1 a_vdb: .ds.w 1 a_vde: .ds.w 1 width: .ds.w 1 height: .ds.w 1 .end