;---------------------------------------------------------------------------------------- ; Test - ;-Description: ;-In: ; D1 = Increment data ; D2 = Copy count ; D3 = Text display number ;---------------------------------------------------------------------------------------- TestDMATransferToVRAMDataBlock: dc.w $1122, $3344, $5566, $7788, $99AA, $BBCC, $DDEE TestDMATransferToVRAMText: dc.b 'DMA Transfer to VRAM inc=0 ' dc.b 'DMA Transfer to VRAM inc=1 ' dc.b 'DMA Transfer to VRAM inc=2 ' dc.b 'DMA Transfer to VRAM inc=3 ' dc.b 'DMA Transfer to VRAM inc=4 ' dc.b 'DMA Transfer to VRAM CD4=1 inc=0 ' dc.b 'DMA Transfer to VRAM CD4=1 inc=1 ' dc.b 'DMA Transfer to VRAM CD4=1 inc=2 ' dc.b 'DMA Transfer to VRAM CD4=1 inc=3 ' dc.b 'DMA Transfer to VRAM CD4=1 inc=4 ' TestDMATransferToVRAMTextEnd: TestDMATransferToVRAMExpectedResult: dc.w $0000, $BBCC, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $4433, $8877, $CCBB, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $1122, $3344, $5566, $7788, $99AA, $BBCC, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $1122, $4433, $0000, $5566, $8877, $0000, $99AA, $CCBB, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $1122, $0000, $3344, $0000, $5566, $0000, $7788, $0000, $99AA, $0000, $BBCC, $0000, $0000, $0000, $0000 dc.w $0000, $BBCC, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $4433, $8877, $CCBB, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $1122, $3344, $5566, $7788, $99AA, $BBCC, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $1122, $4433, $0000, $5566, $8877, $0000, $99AA, $CCBB, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $1122, $0000, $3344, $0000, $5566, $0000, $7788, $0000, $99AA, $0000, $BBCC, $0000, $0000, $0000, $0000 TestDMATransferToVRAM: ;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 TestDMATransferToVRAMText,A1 ;Write the text to the buffer move.w D3,D5 mulu.w D7,D5 add.l D5,A1 sub.w #1,D7 TestDMATransferToVRAMWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferToVRAMWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferToVRAMExpectedResult,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 TestDMATransferToVRAMWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferToVRAMWriteExpectedResultData ;Initialize data in VRAM at 0x8000 move.l #$40000002,$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 #TestDMATransferToVRAMDataBlock,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 #$40020082,(A0) ;DMA transfer to VRAM address 0x8002 cmp.b #$4,D4 ble TestDMATransferToVRAMDMASettingSelect1 move.l #$400200C2,(A0) ;DMA transfer to VRAM address 0x8002 with CD4=1 TestDMATransferToVRAMDMASettingSelect1: 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 #$00000002,$C00004 ;Read from VRAM at 0x8000 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