;------------------------------------------------------------------------------------ ; Test - ;-Description: ;------------------------------------------------------------------------------------ TestDMATransferToVRAMWrappingText: dc.b 'DMA Transfer to VRAM Wrapping ' TestDMATransferToVRAMWrappingTextEnd: TestDMATransferToVRAMWrappingExpectedResult: dc.w $FFFF, $EEEE, $DDDD, $CCCC, $0123, $4567, $89AB, $CDEF, $BBBB, $AAAA, $9999, $8888, $0123, $4567, $89AB, $CDEF TestDMATransferToVRAMWrapping: ;Initialize the text result block move.w #(TestDMATransferToVRAMWrappingTextEnd-TestDMATransferToVRAMWrappingText),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 TestDMATransferToVRAMWrappingText,A1 sub.w #1,D7 TestDMATransferToVRAMWrappingWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferToVRAMWrappingWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferToVRAMWrappingExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMATransferToVRAMWrappingWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferToVRAMWrappingWriteExpectedResultData ;Initialize VRAM move.l #$40000000,$C00004 move.w #$7FFF,D7 TestDMATransferToVRAMWrappingCRAMLoop: move.w #$2222,$C00000 dbf D7,TestDMATransferToVRAMWrappingCRAMLoop ;Clear data in VSRAM at 0x0000, just to make sure the FIFO is initialized. move.l #$40000010,$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 VRAM address 0x0000 for 0x10000 bytes move.l #VRAMTestDataBlockAligned,D0 move.w #$8000,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 #$40000080,(A0) ;DMA transfer to VRAM address 0x0000 move.l (A0),$C00004 ;Test target memory move.l #$00000000,$C00004 ;Read from VRAM 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 VRAM address 0x0000 for 0x20000 bytes move.l #VRAMTestDataBlockAligned,D0 move.w #$0000,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 #$40000080,(A0) ;DMA transfer to VRAM address 0x0000 move.l (A0),$C00004 ;Test target memory move.l #$00000000,$C00004 ;Read from VRAM 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 CRAM address 0x8000 for 0x10000 bytes move.l #VRAMTestDataBlockAligned,D0 move.w #$8000,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 #$00000000,$C00004 ;Read from VRAM 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 VRAM address 0x8000 for 0x20000 bytes move.l #VRAMTestDataBlockAligned,D0 move.w #$0000,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 #$00000000,$C00004 ;Read from VRAM 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