;------------------------------------------------------------------------------------ ; Test - ;-Description: ;------------------------------------------------------------------------------------ TestDMATransferSourceAddressWrappingText: dc.b 'DMA Transfer Source Wrapping ' TestDMATransferSourceAddressWrappingTextEnd: TestDMATransferSourceAddressWrappingExpectedResult: dc.w $89AB, $CDEF, $FFFF, $EEEE, $89AB, $8DEF, $8FEF, $8FEF, $89AB, $8DEF, $8FFF, $8EEE TestDMATransferSourceAddressWrapping: ;Initialize the text result block move.w #(TestDMATransferSourceAddressWrappingTextEnd-TestDMATransferSourceAddressWrappingText),D7 move.w #2,(A0)+ ;Set the number of display lines move.w D7,(A0)+ ;Set the text length move.w #$0018,D6 ;Set the data length move.w D6,(A0)+ lea TestDMATransferSourceAddressWrappingText,A1 sub.w #1,D7 TestDMATransferSourceAddressWrappingWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferSourceAddressWrappingWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferSourceAddressWrappingExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMATransferSourceAddressWrappingWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferSourceAddressWrappingWriteExpectedResultData ;Clear 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 ;Clear data in VSRAM at 0x0000 move.l #$40000010,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Clear data in CRAM at 0x0000 move.l #$C0000000,$C00004 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 VRAM address 0x8000 move.l #(VRAMTestDataBlockOverflowRegion-4),D0 move.w #$0004,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 #$40000082,(A0) ;DMA transfer to VRAM address 0x8000 move.l (A0),$C00004 ;Test target memory 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)+ 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 CRAM address 0x0020 move.l #(VRAMTestDataBlockOverflowRegion-4),D0 move.w #$0004,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 #$C0200080,(A0) ;DMA transfer to CRAM address 0x0020 move.l (A0),$C00004 ;Test target memory move.l #$00200020,$C00004 ;Read from CRAM at 0x0020 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 0x0020 move.l #(VRAMTestDataBlockOverflowRegion-4),D0 move.w #$0004,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 #$40200092,(A0) ;DMA transfer to VSRAM address 0x0020 move.l (A0),$C00004 ;Test target memory move.l #$00200010,$C00004 ;Read from VSRAM at 0x0020 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 ;Clear 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 ;Clear data in VSRAM at 0x0000 move.l #$40000010,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Clear data in CRAM at 0x0000 move.l #$C0000000,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 rts