;------------------------------------------------------------------------------------ ;Test 10 - Read/Write Order ;Try and detect the behaviour of an invalid write followed by a read causing the ;write to be combined with the read rather than the existing data in the FIFO. ;------------------------------------------------------------------------------------ TestReadWriteOrderText: dc.b 'Read/Write Order ' TestReadWriteOrderTextEnd: TestReadWriteOrderExpectedResult: dc.w $3000, $3000, $F800, $4000, $E800, $5000, $D800, $6000, $C800, $F800, $B800, $E800, $A800, $D800, $9800, $C800 TestReadWriteOrder: ;Initialize the text result block move.w #(TestReadWriteOrderTextEnd-TestReadWriteOrderText),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 TestReadWriteOrderText,A1 sub.w #1,D7 TestReadWriteOrderWriteText: move.b (A1)+,(A0)+ dbf D7,TestReadWriteOrderWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestReadWriteOrderExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestReadWriteOrderWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestReadWriteOrderWriteExpectedResultData ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$3333,$C00000 move.w #$3333,$C00000 move.w #$3333,$C00000 move.w #$3333,$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.w #$0100,D1 Test10Loop1: ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$4444,$C00000 move.w #$4444,$C00000 move.w #$4444,$C00000 move.w #$4444,$C00000 move.w #$4444,$C00000 move.w #$4444,$C00000 move.w #$4444,$C00000 move.w #$4444,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM ; move.w #$FFFF,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$F800,D0 beq Test10Loop1Exit dbf D1,Test10Loop1 Test10Loop1Exit: move.w D0,(A0)+ ; move.w $C00000,(A0)+ ;Read from VSRAM ; 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 ;##DEBUG## move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ rts move.w #$0100,D1 Test10Loop2: ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$5555,$C00000 move.w #$5555,$C00000 move.w #$5555,$C00000 move.w #$5555,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM move.w #$EEEE,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$E800,D0 beq Test10Loop2Exit dbf D1,Test10Loop2 Test10Loop2Exit: move.w D0,(A0)+ move.w $C00000,(A0)+ ;Read from VSRAM 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.w #$0100,D1 Test10Loop3: ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$6666,$C00000 move.w #$6666,$C00000 move.w #$6666,$C00000 move.w #$6666,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM move.w #$DDDD,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$D800,D0 beq Test10Loop3Exit dbf D1,Test10Loop3 Test10Loop3Exit: move.w D0,(A0)+ move.w $C00000,(A0)+ ;Read from VSRAM 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.w #$0100,D1 Test10Loop4: ;Fill the FIFO buffer with 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.l #$00000010,$C00004 ;Read from VSRAM move.w #$CCCC,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$C800,D0 beq Test10Loop4Exit dbf D1,Test10Loop4 Test10Loop4Exit: move.w D0,(A0)+ move.w $C00000,(A0)+ ;Read from VSRAM 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.w #$0100,D1 Test10Loop5: ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$EEEE,$C00000 move.w #$EEEE,$C00000 move.w #$EEEE,$C00000 move.w #$EEEE,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM move.w #$BBBB,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$B800,D0 beq Test10Loop5Exit dbf D1,Test10Loop5 Test10Loop5Exit: move.w D0,(A0)+ move.w $C00000,(A0)+ ;Read from VSRAM 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.w #$0100,D1 Test10Loop6: ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$DDDD,$C00000 move.w #$DDDD,$C00000 move.w #$DDDD,$C00000 move.w #$DDDD,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM move.w #$AAAA,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$A800,D0 beq Test10Loop6Exit dbf D1,Test10Loop6 Test10Loop6Exit: move.w D0,(A0)+ move.w $C00000,(A0)+ ;Read from VSRAM 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.w #$0100,D1 Test10Loop7: ;Fill the FIFO buffer with some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$CCCC,$C00000 move.w #$CCCC,$C00000 move.w #$CCCC,$C00000 move.w #$CCCC,$C00000 move.l #$00000010,$C00004 ;Read from VSRAM move.w #$9999,$C00000 ;Write to an invalid target move.w $C00000,D0 ;Read from VSRAM 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 cmp.w #$9800,D0 beq Test10Loop7Exit dbf D1,Test10Loop7 Test10Loop7Exit: move.w D0,(A0)+ move.w $C00000,(A0)+ ;Read from VSRAM 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