;---------------------------------------------------------------------------------------- ; Test - ;-Description: ;-In: ; D1 = Increment data ; D2 = Copy count ; D3 = Text display number ;---------------------------------------------------------------------------------------- TestDMATransferToCRAMDataBlock: dc.w $2244, $4422, $6688, $8866, $AACC, $CCAA, $EEEE TestDMATransferToCRAMText: dc.b 'DMA Transfer to CRAM inc=0 ' dc.b 'DMA Transfer to CRAM inc=1 ' dc.b 'DMA Transfer to CRAM inc=2 ' dc.b 'DMA Transfer to CRAM inc=3 ' dc.b 'DMA Transfer to CRAM inc=4 ' dc.b 'DMA Transfer to CRAM CD4=1 inc=0 ' dc.b 'DMA Transfer to CRAM CD4=1 inc=1 ' dc.b 'DMA Transfer to CRAM CD4=1 inc=2 ' dc.b 'DMA Transfer to CRAM CD4=1 inc=3 ' dc.b 'DMA Transfer to CRAM CD4=1 inc=4 ' TestDMATransferToCRAMTextEnd: TestDMATransferToCRAMExpectedResult: dc.w $0000, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0422, $0866, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0244, $0422, $0688, $0866, $0ACC, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0244, $0422, $0000, $0688, $0866, $0000, $0ACC, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0244, $0000, $0422, $0000, $0688, $0000, $0866, $0000, $0ACC, $0000, $0CAA, $0000, $0000, $0000, $0000 dc.w $0000, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0422, $0866, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0244, $0422, $0688, $0866, $0ACC, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0244, $0422, $0000, $0688, $0866, $0000, $0ACC, $0CAA, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0244, $0000, $0422, $0000, $0688, $0000, $0866, $0000, $0ACC, $0000, $0CAA, $0000, $0000, $0000, $0000 TestDMATransferToCRAM: ;Initialize the text result block move.w #36,D7 move.w #2,(A0)+ ;Set the number of display lines move.w D7,(A0)+ ;Set the text length move.w #$0020,D6 ;Set the data length move.w D6,(A0)+ lea TestDMATransferToCRAMText,A1 ;Write the text to the buffer move.w D3,D5 mulu.w D7,D5 add.l D5,A1 sub.w #1,D7 TestDMATransferToCRAMWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferToCRAMWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferToCRAMExpectedResult,A1 ;Write the expected result data to the buffer move.w D3,D5 mulu.w D6,D5 add.l D5,A1 sub.w #1,D6 TestDMATransferToCRAMWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferToCRAMWriteExpectedResultData ;Initialize data in CRAM at 0x00 move.l #$C0000000,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Do a DMA transfer to the target move.l #TestDMATransferToCRAMDataBlock,D0 move.w #$8154,$C00004 move.w #$8F00, D7 move.b D1,D7 move.w D7,$C00004 move.w #$9300, D7 move.w D2,D6 move.b D6,D7 move.w D7,$C00004 move.w #$9400, D7 lsr.l #8,D6 move.b D6,D7 move.w D7,$C00004 move.w #$9500, D2 lsr.l #1,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9600, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9700, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$C00004 ;We do the transfer to initiate the DMA operation using RAM here, otherwise we almost ;always get a lockup on the real hardware. move.l #$C0020080,(A0) ;DMA transfer to CRAM address 0x02 cmp.b #$4,D4 ble TestDMATransferToCRAMDMASettingSelect1 move.l #$C00200C0,(A0) ;DMA transfer to CRAM address 0x02 with CD4=1 TestDMATransferToCRAMDMASettingSelect1: move.l (A0),$C00004 move.w #$8F02,$C00004 move.w #$8144,$C00004 ;Do some writes to VRAM at 0x9000 to clear the FIFO move.l #$50000002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.l #$00000020,$C00004 ;Read from CRAM at 0x00 move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ nop ;Wait for a few cycles after a read before modifying any VDP settings. On the nop ;real hardware, if a control port write occurs immediately after a data port nop ;read, the VDP can lock up. Most likely, this occurs due to the read target nop ;being modified to an invalid target before a read pre-cache is complete. nop nop nop nop nop nop rts