;------------------------------------------------------------------------------------ ; Test - ;-Description: ;------------------------------------------------------------------------------------ TestDMATransferToVSRAMWrappingText: dc.b 'DMA Transfer to VSRAM Wrapping ' TestDMATransferToVSRAMWrappingTextEnd: TestDMATransferToVSRAMWrappingExpectedResult: dc.w $0777, $0666, $0555, $0444, $0123, $0123, $03EA, $04E8, $0111, $0777, $0666, $0555, $072E, $012C, $022A, $0328 TestDMATransferToVSRAMWrapping: ;Initialize the text result block move.w #(TestDMATransferToVSRAMWrappingTextEnd-TestDMATransferToVSRAMWrappingText),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 TestDMATransferToVSRAMWrappingText,A1 sub.w #1,D7 TestDMATransferToVSRAMWrappingWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferToVSRAMWrappingWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferToVSRAMWrappingExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMATransferToVSRAMWrappingWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferToVSRAMWrappingWriteExpectedResultData ;Initialize VSRAM move.l #$40000010,$C00004 move.w #$3F,D7 TestDMATransferToVSRAMWrappingVSRAMLoop: move.w #$2222,$C00000 dbf D7,TestDMATransferToVSRAMWrappingVSRAMLoop ;Clear data in VRAM at 0x8000, just to make sure the FIFO is initialized. 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 ;Do a DMA transfer operation from the source data block to VSRAM address 0x0000 for 0x80 bytes move.l #TestDMATransferToVSRAMWrappingVSRAMTestData,D0 move.w #$0040,D1 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9300, D2 move.b D1,D2 move.w D2,$C00004 move.w #$9400, D2 lsr.l #8,D1 move.b D1,D2 move.w D2,$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 #$40000090,(A0) ;DMA transfer to VSRAM address 0x0000 move.l (A0),$C00004 ;Test target memory move.l #$00000010,$C00004 ;Read from VSRAM at 0x0000 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 ;Do a DMA transfer operation from the source data block to VSRAM address 0x0000 for 0x100 bytes move.l #TestDMATransferToVSRAMWrappingVSRAMTestData,D0 move.w #$0080,D1 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9300, D2 move.b D1,D2 move.w D2,$C00004 move.w #$9400, D2 lsr.l #8,D1 move.b D1,D2 move.w D2,$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 #$40000090,(A0) ;DMA transfer to VSRAM address 0x0000 move.l (A0),$C00004 ;Test target memory move.l #$00000010,$C00004 ;Read from VSRAM at 0x0000 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 ;Do a DMA transfer operation from the source data block to VSRAM address 0x40A0 for 0x80 bytes move.l #TestDMATransferToVSRAMWrappingVSRAMTestData,D0 move.w #$0040,D1 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9300, D2 move.b D1,D2 move.w D2,$C00004 move.w #$9400, D2 lsr.l #8,D1 move.b D1,D2 move.w D2,$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 #$40A00091,(A0) ;DMA transfer to VSRAM address 0x40A0 move.l (A0),$C00004 ;Test target memory move.l #$00000010,$C00004 ;Read from VSRAM at 0x0000 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 ;Do a DMA transfer operation from the source data block to VSRAM address 0x40A0 for 0x100 bytes move.l #TestDMATransferToVSRAMWrappingVSRAMTestData,D0 move.w #$0080,D1 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9300, D2 move.b D1,D2 move.w D2,$C00004 move.w #$9400, D2 lsr.l #8,D1 move.b D1,D2 move.w D2,$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 #$40A00091,(A0) ;DMA transfer to VSRAM address 0x40A0 move.l (A0),$C00004 ;Test target memory move.l #$00000010,$C00004 ;Read from VSRAM at 0x0000 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 TestDMATransferToVSRAMWrappingVSRAMTestData: dc.w $0777, $0666, $0555, $0444, $0333, $0222, $0111, $0777, $0666, $0555, $0444, $0333, $0222, $0111, $0777, $0666 dc.w $0555, $0444, $0333, $0222, $0111, $0777, $0666, $0555, $0444, $0333, $0222, $0111, $0777, $0666, $0555, $0444 dc.w $0333, $0222, $0111, $0777, $0666, $0555, $0444, $0333, $0222, $0111, $0777, $0666, $0555, $0444, $0333, $0222 dc.w $0111, $0777, $0666, $0555, $0444, $0333, $0222, $0111, $0777, $0666, $0555, $0444, $0333, $0222, $0111, $0777 dc.w $0123, $0123, $03EA, $04E8, $05E6, $06E4, $07E2, $01E0, $02CE, $03CC, $04CA, $05C8, $06C6, $07C4, $01C2, $02C0 dc.w $03AE, $04AC, $05AA, $06A8, $07A6, $01A4, $02A2, $03A0, $048E, $058C, $068A, $0788, $0186, $0284, $0382, $0480 dc.w $056E, $066C, $076A, $0168, $0266, $0364, $0462, $0560, $064E, $074C, $014A, $0248, $0346, $0444, $0542, $0640 dc.w $072E, $012C, $022A, $0328, $0426, $0524, $0622, $0720, $010E, $020C, $030A, $0408, $0506, $0604, $0702, $0100