;---------------------------------------------------------------------------------------- ; Test - DMA using FIFO ;-Description: ; This test demonstrates that a DMA transfer operation moves its data through the FIFO. ;##NOTE## We have now seen this test return 0xFF00 instead of 0xF800 for the first read ;---------------------------------------------------------------------------------------- TestDMATransferUsingFIFODataBlock: dc.w $AAAA, $BBBB, $CCCC, $DDDD, $EEEE, $FFFF TestDMATransferUsingFIFOText: dc.b 'DMA Transfer using FIFO ' TestDMATransferUsingFIFOTextEnd: TestDMATransferUsingFIFOExpectedResult: dc.w $C800, $C800, $C000, $C000, $D800, $D800, $D111, $D111, $E800, $E800, $E000, $E000, $F800, $F800, $F111, $F111 TestDMATransferUsingFIFO: ;Initialize the text result block move.w #(TestDMATransferUsingFIFOTextEnd-TestDMATransferUsingFIFOText),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 TestDMATransferUsingFIFOText,A1 sub.w #1,D7 TestDMATransferUsingFIFOWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferUsingFIFOWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferUsingFIFOExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMATransferUsingFIFOWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferUsingFIFOWriteExpectedResultData ;Initialize CRAM move.l #$C0000000,$C00004 move.w #$3F,D0 TestDMATransferUsingFIFOCRAMLoop: move.w #$0000,$C00000 dbf D0,TestDMATransferUsingFIFOCRAMLoop ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$1000,$C00000 move.w #$2000,$C00000 move.w #$3000,$C00000 move.w #$4000,$C00000 move.w #$5000,$C00000 move.w #$6000,$C00000 ;Use DMA to fill the FIFO buffer move.l #TestDMATransferUsingFIFODataBlock,D0 move.w #$0006,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 move.w #$8144,$C00004 ;Read our data from VSRAM and CRAM through the FIFO into RAM move.l #$00000010,$C00004 ;Read from VSRAM 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 move.l #$00000020,$C00004 ;Read from CRAM 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 move.l #$C0200000,$C00004 ;Advance the FIFO buffer move.w #$FFFF,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM 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 move.l #$00000020,$C00004 ;Read from CRAM 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 move.l #$C0200000,$C00004 ;Advance the FIFO buffer move.w #$FFFF,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM 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 move.l #$00000020,$C00004 ;Read from CRAM 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 move.l #$C0200000,$C00004 ;Advance the FIFO buffer move.w #$FFFF,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM 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 move.l #$00000020,$C00004 ;Read from CRAM 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