;----------------------------------------------------------------------------------------- ;-Description: ; This test checks how CRAM responds to reads and writes to and from odd addresses. ;----------------------------------------------------------------------------------------- TestCRAMByteswappingText: dc.b 'CRAM Byteswapping ' TestCRAMByteswappingTextEnd: TestCRAMByteswappingExpectedResult: dc.w $5122, $5344, $5000, $5000, $5122, $5344, $5000, $5000, $5122, $5344, $5000, $5000, $5122, $5344, $5000, $5000 TestCRAMByteswapping: ;Initialize the text result block move.w #(TestCRAMByteswappingTextEnd-TestCRAMByteswappingText),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 TestCRAMByteswappingText,A1 sub.w #1,D7 TestCRAMByteswappingWriteText: move.b (A1)+,(A0)+ dbf D7,TestCRAMByteswappingWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestCRAMByteswappingExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestCRAMByteswappingWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestCRAMByteswappingWriteExpectedResultData ;Fill the FIFO buffer with some writes to CRAM at 0x20 move.l #$C0200000,$C00004 move.w #$1122,$C00000 move.w #$3344,$C00000 move.w #$5566,$C00000 move.w #$7788,$C00000 move.w #$99AA,$C00000 move.w #$BBCC,$C00000 move.l #$00200020,$C00004 ;Read from CRAM at 0x20 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 #$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 #$00210020,$C00004 ;Read from CRAM at 0x21 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 #$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 ;Fill the FIFO buffer with some writes to CRAM at 0x21 move.l #$C0210000,$C00004 move.w #$1122,$C00000 move.w #$3344,$C00000 move.w #$5566,$C00000 move.w #$7788,$C00000 move.w #$99AA,$C00000 move.w #$BBCC,$C00000 move.l #$00200020,$C00004 ;Read from CRAM at 0x20 move.w $C00000,(A0)+ ;##NOTE## Has been seen as 0x5BCC! move.w $C00000,(A0)+ ;##NOTE## Has been seen as 0x5122! 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 #$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 #$00210020,$C00004 ;Read from CRAM at 0x21 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 #$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 rts