;----------------------------------------------------------------------------------------- ; Test - Separate FIFO Read/Write Buffer ;-Description: ; This is a very basic test which is designed to fill the FIFO buffer with 0xFFFF in all ; entries, and then do repeated reads from CRAM and VSRAM. It is intended to demonstrate ; that although a read from CRAM or VSRAM sets the unused bits from these memory buffers ; based on the contents of the next available entry in the FIFO buffer, the read operation ; itself doesn't modify the FIFO buffer contents. This is shown by the fact that the ; unused bit masks differ between CRAM and VSRAM, and yet, the results when reading from ; CRAM or VSRAM are unaffected by the order they occur in. ;###NOTE## We have now seen a case where this does not behave as expected on the real ;hardware either. We saw a return value of 0xFF11 instead of 0xF111. This is interesting, ;as only CRAM and VSRAM read targets are involved here. ;-Expected result: ; F800 F800 F111 F111 F800 F800 F111 F111 F800 F800 F111 F111 F800 F800 F111 F111 ;----------------------------------------------------------------------------------------- TestSeparateFIFOReadWriteBufferText: dc.b 'Separate FIFO Read/Write Buffer ' TestSeparateFIFOReadWriteBufferTextEnd: TestSeparateFIFOReadWriteBufferExpectedResult: dc.w $F800, $F800, $F111, $F111, $F800, $F800, $F111, $F111, $F800, $F800, $F111, $F111, $F800, $F800, $F111, $F111 TestSeparateFIFOReadWriteBuffer: ;Initialize the text result block move.w #(TestSeparateFIFOReadWriteBufferTextEnd-TestSeparateFIFOReadWriteBufferText),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 TestSeparateFIFOReadWriteBufferText,A1 sub.w #1,D7 TestSeparateFIFOReadWriteBufferWriteText: move.b (A1)+,(A0)+ dbf D7,TestSeparateFIFOReadWriteBufferWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestSeparateFIFOReadWriteBufferExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestSeparateFIFOReadWriteBufferWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestSeparateFIFOReadWriteBufferWriteExpectedResultData ;Initialize CRAM move.l #$C0000000,$C00004 move.w #$3F,D0 TestSeparateFIFOReadWriteBufferCRAMLoop: move.w #$0000,$C00000 dbf D0,TestSeparateFIFOReadWriteBufferCRAMLoop ;Fill the FIFO buffer with 0xFFFF by doing some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 ;Read our data from VSRAM and CRAM through the FIFO into RAM move.l #$00000010,$C00004 ;Read from VSRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000020,$C00004 ;Read from CRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000010,$C00004 ;Read from VSRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000020,$C00004 ;Read from CRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000010,$C00004 ;Read from VSRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000020,$C00004 ;Read from CRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000010,$C00004 ;Read from VSRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 move.l #$00000020,$C00004 ;Read from CRAM nop ;Wait for a few cycles before reading from the data port, to avoid intermittent nop ;read errors. Without this delay, the real hardware may return incomplete data, nop ;with only the lower byte of the result set, and the upper byte retaining the nop ;previous contents. This occurs even for VSRAM read targets. nop nop nop nop 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 rts