;##NOTE## When we didn't have wait states after VSRAM reads in this test, we saw VDP ;lockups, but not such that a reset didn't work, and we saw the case of the palette select ;bit apparently being cleared in register 0. Note that further testing indicates the lockup ;wasn't VDP related, but was caused by a bug in our code. ;##NOTE## First tests don't work, seems like disabling the display doesn't stop VSRAM ;reads by render process. Line 3 works correctly, with tests in line 4 working most of the ;time, but some start values failing sometimes. ;##NOTE## The "Genesis 3" behaves differently. It appears to have an 0x80 byte VSRAM, with ;reads and writes to otherwise invalid addresses in VSRAM correctly returning the written ;data. We also saw the "Genesis 3" get a different result for the 8-bit VRAM read target ;test. ;----------------------------------------------------------------------------------------- TestVSRAMDataCacheText: dc.b 'VSRAM Data Cache ' TestVSRAMDataCacheTextEnd: TestVSRAMDataCacheExpectedResult: ;Tests 2,3,4,7,8,11,12 dont give expected results. Tests 13 and 14 still lock up. ;Tests 2, 3, and 4 change between 0321 and 0765 ;Tests 11 and 12 both exhibit alternations between 0x0444, 0x0456, and 0x0765. Test 12 was observed with pattern 0x0456, 0x0444, 0x0456, 0x0444. ;Running tests 13 and 14, the last value is never read, and we do get unexpected read values. ; dc.w $0000, $0111, $0222, $0333, $0444, $0555, $0666, $0777, $0000, $0111, $0222, $0333, $0321, $0765, $0765, $0765 ; dc.w $0000, $0111, $0222, $0333, $0321, $0765, $0765, $0765, $0000, $0111, $0222, $0333, $0321, $0765, $0765, $0765 ; dc.w $0000, $0111, $0222, $0333, $0765, $0765, $0765, $0765, $0000, $0111, $0222, $0333, $0765, $0765, $0765, $0765 ; dc.w $0000, $0111, $0222, $0333, $0321, $0321, $0321, $0765, $0000, $0111, $0222, $0333, $0321, $0321, $0321, $0321 ; dc.w $0000, $0111, $0222, $0333, $0456, $0456, $0456, $0456, $0000, $0111, $0222, $0333, $0456, $0456, $0456, $0456 ; dc.w $0000, $0111, $0222, $0333, $0456, $0765, $0465, $0765, $0000, $0111, $0222, $0333, $0444, $0765, $0456, $0444 ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $0480, $0000, $0000, $0000 ; dc.w $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $056E, $076A, $0266, $0560 ; dc.w $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $0000, $0111, $0222, $0333, $0444, $0555, $0666, $0777, $0000, $0111, $0222, $0333, $0333, $0333, $0333, $0333 dc.w $0000, $0111, $0222, $0333, $0456, $0456, $0456, $0456, $0000, $0111, $0222, $0333, $0456, $0456, $0456, $0456 dc.w $0000, $0111, $0222, $0333, $0765, $0765, $0765, $0765, $0000, $0111, $0222, $0333, $0765, $0765, $0765, $0765 dc.w $0000, $0111, $0222, $0333, $0333, $0333, $0333, $0333, $0000, $0111, $0222, $0333, $0333, $0333, $0333, $0333 dc.w $0000, $0111, $0222, $0333, $0456, $0456, $0456, $0456, $0000, $0111, $0222, $0333, $0456, $0456, $0456, $0456 dc.w $0000, $0111, $0222, $0333, $0765, $0765, $0765, $0765, $0000, $0111, $0222, $0333, $0765, $0765, $0765, $0765 dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $0480, $0000, $0000, $0000 dc.w $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $056E, $076A, $0266, $0560 dc.w $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 TestVSRAMDataCache: ;Initialize the text result block move.w #(TestVSRAMDataCacheTextEnd-TestVSRAMDataCacheText),D7 move.w #11,(A0)+ ;Set the number of display lines ; move.w #7,(A0)+ ;Set the number of display lines move.w D7,(A0)+ ;Set the text length move.w #$0140,D6 ;Set the data length ; move.w #$00C0,D6 ;Set the data length move.w D6,(A0)+ lea TestVSRAMDataCacheText,A1 sub.w #1,D7 TestVSRAMDataCacheWriteText: move.b (A1)+,(A0)+ dbf D7,TestVSRAMDataCacheWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestVSRAMDataCacheExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestVSRAMDataCacheWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestVSRAMDataCacheWriteExpectedResultData ;Test 1 - Normal VSRAM reads and writes move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0321,$C00000 move.w #$0765,$C00000 move.l #$40400010,$C00004 ;Perform some writes to VSRAM at 0x40 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 move.l #$00400010,$C00004 ;Read from VSRAM at 0x40 move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ 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 ;Test 2 - VSRAM reads off end of VSRAM using last read value move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0321,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear2: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear2 TestVSRAMDataCacheWaitVBlankSet2: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet2 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop2: dbf D7,TestVSRAMDataCacheDelayLoop2 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ 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 ;Test 3 - Writes to valid VSRAM addresses overwrite VSRAM read cache move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0321,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear3: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear3 TestVSRAMDataCacheWaitVBlankSet3: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet3 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop3: dbf D7,TestVSRAMDataCacheDelayLoop3 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0123,$C00000 move.w #$0456,$C00000 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 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 ;Test 4 - Writes to invalid VSRAM addresses overwrite VSRAM read cache move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0321,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear4: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear4 TestVSRAMDataCacheWaitVBlankSet4: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet4 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop4: dbf D7,TestVSRAMDataCacheDelayLoop4 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 move.l #$40500010,$C00004 ;Perform some writes to VSRAM at 0x50 move.w #$0123,$C00000 move.w #$0456,$C00000 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 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 ;Test 5 - Disable display register doesn't prevent VSRAM reads during rendering move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0765,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 ;Wait for the beginning of active scan ;##FIX## Regen and Kega both behave as if VBLANK is asserted forever when the disable ;display register is set, which would make sense. Perform hardware tests to verify if ;this is the case. I don't think we emulate this currently. TestVSRAMDataCacheWaitVBlankSet5: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet5 TestVSRAMDataCacheWaitVBlankClear5: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear5 move.w #$8104,$C00004 ;Disable display ;Perform a small delay, to make sure we're a few lines into the render process. move.w #$0020,D7 TestVSRAMDataCacheDelayLoop5: dbf D7,TestVSRAMDataCacheDelayLoop5 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 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 move.w #$8144,$C00004 ;Enable display ;Test 6 - Undocumented Reg 1 Bit 0 set doesn't prevent VSRAM reads during rendering move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0765,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 ;Wait for the beginning of active scan TestVSRAMDataCacheWaitVBlankSet6: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet6 TestVSRAMDataCacheWaitVBlankClear6: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear6 move.w #$8005,$C00004 ;Disable display ;Perform a small delay, to make sure we're a few lines into the render process. move.w #$0020,D7 TestVSRAMDataCacheDelayLoop6: dbf D7,TestVSRAMDataCacheDelayLoop6 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 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 move.w #$8004,$C00004 ;Enable display ;Test 7 - VSRAM data cache not modified by rendering outside active scan move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0321,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear7: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear7 TestVSRAMDataCacheWaitVBlankSet7: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet7 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop7: dbf D7,TestVSRAMDataCacheDelayLoop7 move.l #$40500010,$C00004 ;Perform some writes to VSRAM at 0x50 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ 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 ;Initialize VSRAM move.l #$40400010,$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 ;Test 8 - Same as the above, except test with render VSRAM reads happening after our writes move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0321,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear8: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear8 TestVSRAMDataCacheWaitVBlankSet8: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet8 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop8: dbf D7,TestVSRAMDataCacheDelayLoop8 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ move.w $C00000,(A0)+ 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 ;Initialize VSRAM move.l #$40400010,$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 ;Test 9 - VSRAM data cache actively modified by rendering during active scan - Overall H32 move.w #$8B00,$C00004 ;Set VScroll mode to overall move.w #$8C00,$C00004 ;Enable H32 mode move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0456,$C00000 move.w #$0456,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 ;Wait for the beginning of active scan TestVSRAMDataCacheWaitVBlankSet9: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet9 TestVSRAMDataCacheWaitVBlankClear9: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear9 ;Perform a small delay, to make sure we're a few lines into the render process. move.w #$0020,D7 TestVSRAMDataCacheDelayLoop9: dbf D7,TestVSRAMDataCacheDelayLoop9 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 move.w #$0020,D7 ;Perform a small delay, to ensure that the render TestVSRAMDataCacheDelayLoop91: ;process has a chance to update the VSRAM cache. dbf D7,TestVSRAMDataCacheDelayLoop91 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 (Invalidate read cache) 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 ;Test 10 - VSRAM data cache actively modified by rendering during active scan - Overall H40 move.w #$8B00,$C00004 ;Set VScroll mode to overall move.w #$8C81,$C00004 ;Enable H40 mode move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0456,$C00000 move.w #$0456,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 ;Wait for the beginning of active scan TestVSRAMDataCacheWaitVBlankSet10: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet10 TestVSRAMDataCacheWaitVBlankClear10: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear10 ;Perform a small delay, to make sure we're a few lines into the render process. move.w #$0020,D7 TestVSRAMDataCacheDelayLoop10: dbf D7,TestVSRAMDataCacheDelayLoop10 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 move.w #$0020,D7 ;Perform a small delay, to ensure that the render TestVSRAMDataCacheDelayLoop101: ;process has a chance to update the VSRAM cache. dbf D7,TestVSRAMDataCacheDelayLoop101 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 (Invalidate read cache) 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 ;Test 11 - Final VSRAM data cache value during vblank - H32 move.w #$8B00,$C00004 ;Set VScroll mode to overall move.w #$8C00,$C00004 ;Enable H32 mode move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0456,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear11: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear11 TestVSRAMDataCacheWaitVBlankSet11: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet11 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop11: dbf D7,TestVSRAMDataCacheDelayLoop11 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 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 ;Test 12 - Final VSRAM data cache value during vblank - H40 move.w #$8B00,$C00004 ;Set VScroll mode to overall move.w #$8C81,$C00004 ;Enable H40 mode move.l #$40000010,$C00004 ;Perform some writes to VSRAM at 0x00 move.w #$0456,$C00000 move.w #$0765,$C00000 move.l #$40480010,$C00004 ;Perform some writes to VSRAM at 0x48 move.w #$0000,$C00000 move.w #$0111,$C00000 move.w #$0222,$C00000 move.w #$0333,$C00000 move.w #$0444,$C00000 move.w #$0555,$C00000 move.w #$0666,$C00000 move.w #$0777,$C00000 move.l #$00480010,$C00004 ;Read from VSRAM at 0x48 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 ;Wait for the end of active scan TestVSRAMDataCacheWaitVBlankClear12: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear12 TestVSRAMDataCacheWaitVBlankSet12: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet12 ;Add a small delay loop move.w #$0008,D7 TestVSRAMDataCacheDelayLoop12: dbf D7,TestVSRAMDataCacheDelayLoop12 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 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 ;##DEBUG## ;Restore register settings ; move.w #$8B00,$C00004 ;Set VScroll mode set to overall scrolling ; move.w #$8C81,$C00004 ;Enable H40 mode ; ;Initialize VSRAM ; move.l #$40000010,$C00004 ; move.w #$3F,D0 ; TestVSRAMDataCacheInitializeVSRAMLoopFinish: ; move.w #$0000,$C00000 ; dbf D0,TestVSRAMDataCacheInitializeVSRAMLoopFinish ; rts ;Test 13 - VSRAM data cache actively modified by rendering during active scan - 2-cell scroll H32 move.w #$8B04,$C00004 ;Set VScroll mode set to 2-cell column move.w #$8C00,$C00004 ;Enable H32 mode ;Initialize the RAM region were we're loading our sample data move.l A0,A1 add.l #$100,A1 move.w #$0800,D7 TestVSRAMDataCacheReadLoopInitializeRAM13: move.w #$0000,(A1)+ dbf D7,TestVSRAMDataCacheReadLoopInitializeRAM13 ;Initialize VSRAM move.l #$40000010,$C00004 move.w #$3F,D0 lea TestVSRAMDataCacheTestData,A1 TestVSRAMDataCacheInitializeVSRAMLoop13: move.w (A1)+,$C00000 dbf D0,TestVSRAMDataCacheInitializeVSRAMLoop13 ;Wait for the start of active scan TestVSRAMDataCacheWaitVBlankSet13: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet13 TestVSRAMDataCacheWaitVBlankClear13: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear13 ;Wait for another full frame to pass, to make sure a transition between H32/H40 mode ;hasn't left a value in the VSRAM read cache which hasn't been overwritten yet. TestVSRAMDataCacheWaitVBlankSet132: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet132 TestVSRAMDataCacheWaitVBlankClear132: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear132 ;Read from VSRAM until all possible values are found, or we exceed the timeout. move.l A0,A1 ;Set the sample data output location add.l #$100,A1 move.w #$0400,D6 ;Number of frames to loop for TestVSRAMDataCacheReadLoop13: ;Read sample data from VSRAM until the end of this frame TestVSRAMDataCacheReadLoopInner13: move.w #$8F00,$C00004 ;Set increment data to 0 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 ; move.w D7,(A1,D7.w) move.w $C00008,(A1,D7.w) 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 ;##NOTE## For some unknown reason, we got consistent lockups on the hardware when ;we tried to read from the status register after reading from VSRAM above without ;performing a control port write first. move.w #$8F02,$C00004 ;Set increment data to 2 move.w $C00004,D7 ;Loop until end of active scan btst #3,D7 beq TestVSRAMDataCacheReadLoopInner13 ;Check if all the known correct read values were found ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $0480 tst.w ($01EE,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($03EA,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($05E6,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($02CE,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($04CA,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($06C6,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($03AE,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($05AA,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($07A6,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($048E,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($068A,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($0186,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 tst.w ($0480,A1) beq TestVSRAMDataCacheAllSamplesNotFound13 bra TestVSRAMDataCacheAllSamplesFound13 TestVSRAMDataCacheAllSamplesNotFound13: ;##NOTE## For some unknown reason, we got consistent lockups on the hardware when ;we tried to read from the status register here without this control port write. move.w #$8F02,$C00004 ;Set increment data to 2 TestVSRAMDataCacheWaitVBlankClear133: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear133 dbf D6,TestVSRAMDataCacheReadLoop13 ;If we've finished the search for samples, output the found sample data ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $0480 TestVSRAMDataCacheAllSamplesFound13: 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 ($01EE,A1),(A0)+ move.w ($03EA,A1),(A0)+ move.w ($05E6,A1),(A0)+ move.w ($02CE,A1),(A0)+ move.w ($04CA,A1),(A0)+ move.w ($06C6,A1),(A0)+ move.w ($03AE,A1),(A0)+ move.w ($05AA,A1),(A0)+ move.w ($07A6,A1),(A0)+ move.w ($048E,A1),(A0)+ move.w ($068A,A1),(A0)+ move.w ($0186,A1),(A0)+ move.w ($0480,A1),(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ move.w #$0000,(A0)+ ;Clear the source locations for the valid samples move.w #$0000,($01EE,A1) move.w #$0000,($03EA,A1) move.w #$0000,($05E6,A1) move.w #$0000,($02CE,A1) move.w #$0000,($04CA,A1) move.w #$0000,($06C6,A1) move.w #$0000,($03AE,A1) move.w #$0000,($05AA,A1) move.w #$0000,($07A6,A1) move.w #$0000,($048E,A1) move.w #$0000,($068A,A1) move.w #$0000,($0186,A1) move.w #$0000,($0480,A1) ;Check if we found any other samples other than what we should have encountered, ;and output the first 16 available ones if we did, padding the buffer with 0's. ; 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)+ ; move.w #$0000,(A0)+ ; move.w #$0000,(A0)+ ; move.w #$0000,(A0)+ move.w #$0010,D1 move.w #$0800,D7 TestVSRAMDataCacheReadLoopFindBadSamplesLoop13: move.w (A1)+,D0 beq TestVSRAMDataCacheReadLoopFindBadSamplesLoopSampleEmpty13 move.w D0,(A0)+ ;Decrement the count of samples to find subq.w #1,D1 beq TestVSRAMDataCacheReadLoopFindBadSamplesBufferFull13 TestVSRAMDataCacheReadLoopFindBadSamplesLoopSampleEmpty13: dbf D7,TestVSRAMDataCacheReadLoopFindBadSamplesLoop13 subq.w #1,D1 TestVSRAMDataCacheReadLoopFindBadSamplesFillBuffer13: move.w #$0000,(A0)+ ;Pad the output sample buffer dbf D1,TestVSRAMDataCacheReadLoopFindBadSamplesFillBuffer13 TestVSRAMDataCacheReadLoopFindBadSamplesBufferFull13: ;Test 14 - VSRAM data cache actively modified by rendering during active scan - 2-cell scroll H40 move.w #$8B04,$C00004 ;Set VScroll mode set to 2-cell column move.w #$8C81,$C00004 ;Enable H40 mode ;Initialize the RAM region were we're loading our sample data move.l A0,A1 add.l #$100,A1 move.w #$0800,D7 TestVSRAMDataCacheReadLoopInitializeRAM14: move.w #$0000,(A1)+ dbf D7,TestVSRAMDataCacheReadLoopInitializeRAM14 ;Initialize VSRAM move.l #$40000010,$C00004 move.w #$3F,D0 lea TestVSRAMDataCacheTestData,A1 TestVSRAMDataCacheInitializeVSRAMLoop14: move.w (A1)+,$C00000 dbf D0,TestVSRAMDataCacheInitializeVSRAMLoop14 ;Wait for the start of active scan TestVSRAMDataCacheWaitVBlankSet14: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet14 TestVSRAMDataCacheWaitVBlankClear14: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear14 ;Wait for another full frame to pass, to make sure a transition between H32/H40 mode ;hasn't left a value in the VSRAM read cache which hasn't been overwritten yet. TestVSRAMDataCacheWaitVBlankSet142: move.w $C00004,D7 btst #3,D7 beq TestVSRAMDataCacheWaitVBlankSet142 TestVSRAMDataCacheWaitVBlankClear142: move.w $C00004,D7 btst #3,D7 bne TestVSRAMDataCacheWaitVBlankClear142 ;Read from VSRAM until all possible values are found, or we exceed the timeout. move.w #$8F00,$C00004 ;Set increment data to 0 move.l #$00500010,$C00004 ;Read from VSRAM at 0x50 move.l A0,A1 ;Set the sample data output location add.l #$100,A1 move.w #$0400,D6 ;Number of frames to loop for TestVSRAMDataCacheReadLoop14: ;Read sample data from VSRAM until the end of this frame TestVSRAMDataCacheReadLoopInner14: move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) move.w $C00000,D7 andi.w #$07FF,D7 move.w D7,(A1,D7.w) 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 $C00004,D7 ;Loop until end of active scan ; btst #3,D7 ; beq TestVSRAMDataCacheReadLoopInner14 ;Check if all the known correct read values were found ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $056E, $076A, $0266, $0560 tst.w ($01EE,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($03EA,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($05E6,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($02CE,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($04CA,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($06C6,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($03AE,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($05AA,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($07A6,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($048E,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($068A,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($0186,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($056E,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($076A,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($0266,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 tst.w ($0560,A1) beq TestVSRAMDataCacheAllSamplesNotFound14 bra TestVSRAMDataCacheAllSamplesFound14 TestVSRAMDataCacheAllSamplesNotFound14: dbf D6,TestVSRAMDataCacheReadLoop14 ;If we've finished the search for samples, output the found sample data ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $056E, $076A, $0266, $0560 TestVSRAMDataCacheAllSamplesFound14: 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 #$8F02,$C00004 ;Set increment data to 2 move.w ($01EE,A1),(A0)+ move.w ($03EA,A1),(A0)+ move.w ($05E6,A1),(A0)+ move.w ($02CE,A1),(A0)+ move.w ($04CA,A1),(A0)+ move.w ($06C6,A1),(A0)+ move.w ($03AE,A1),(A0)+ move.w ($05AA,A1),(A0)+ move.w ($07A6,A1),(A0)+ move.w ($048E,A1),(A0)+ move.w ($068A,A1),(A0)+ move.w ($0186,A1),(A0)+ move.w ($056E,A1),(A0)+ move.w ($076A,A1),(A0)+ move.w ($0266,A1),(A0)+ move.w ($0560,A1),(A0)+ ;Clear the source locations for the valid samples move.w #$0000,($01EE,A1) move.w #$0000,($03EA,A1) move.w #$0000,($05E6,A1) move.w #$0000,($02CE,A1) move.w #$0000,($04CA,A1) move.w #$0000,($06C6,A1) move.w #$0000,($03AE,A1) move.w #$0000,($05AA,A1) move.w #$0000,($07A6,A1) move.w #$0000,($048E,A1) move.w #$0000,($068A,A1) move.w #$0000,($0186,A1) move.w #$0000,($056E,A1) move.w #$0000,($076A,A1) move.w #$0000,($0266,A1) move.w #$0000,($0560,A1) ;Check if we found any other samples other than what we should have encountered, ;and output the first 16 available ones if we did, padding the buffer with 0's. ; 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)+ ; move.w #$0000,(A0)+ ; move.w #$0000,(A0)+ ; move.w #$0000,(A0)+ move.w #$0010,D1 move.w #$0800,D7 TestVSRAMDataCacheReadLoopFindBadSamplesLoop14: move.w (A1)+,D0 beq TestVSRAMDataCacheReadLoopFindBadSamplesLoopSampleEmpty14 move.w D0,(A0)+ ;Decrement the count of samples to find subq.w #1,D1 beq TestVSRAMDataCacheReadLoopFindBadSamplesBufferFull14 TestVSRAMDataCacheReadLoopFindBadSamplesLoopSampleEmpty14: dbf D7,TestVSRAMDataCacheReadLoopFindBadSamplesLoop14 subq.w #1,D1 TestVSRAMDataCacheReadLoopFindBadSamplesFillBuffer14: move.w #$0000,(A0)+ ;Pad the output sample buffer dbf D1,TestVSRAMDataCacheReadLoopFindBadSamplesFillBuffer14 TestVSRAMDataCacheReadLoopFindBadSamplesBufferFull14: ;Restore register settings move.w #$8B00,$C00004 ;Set VScroll mode set to overall scrolling move.w #$8C81,$C00004 ;Enable H40 mode ;Initialize VSRAM move.l #$40000010,$C00004 move.w #$3F,D0 TestVSRAMDataCacheInitializeVSRAMLoopFinish99: move.w #$0000,$C00000 dbf D0,TestVSRAMDataCacheInitializeVSRAMLoopFinish99 rts TestVSRAMDataCacheTestData: dc.w $01EE, $02EC, $03EA, $04E8, $05E6, $06E4, $07E2, $01E0, $02CE, $03CC, $04CA, $05C8, $06C6, $07C4, $01C2, $02C0 dc.w $03AE, $04AC, $05AA, $06A8, $07A6, $01A4, $02A2, $03A0, $048E, $058C, $068A, $0788, $0186, $0284, $0382, $0480 dc.w $056E, $066C, $076A, $0168, $0266, $0364, $0462, $0560, $064E, $074C, $014A, $0248, $0346, $0444, $0542, $0640 dc.w $072E, $012C, $022A, $0328, $0426, $0524, $0622, $0720, $010E, $020C, $030A, $0408, $0506, $0604, $0702, $0100 ; H32: ; dc.w $01EE, $XXXX, $03EA, $XXXX, $05E6, $XXXX, $XXXX, $XXXX, $02CE, $XXXX, $04CA, $XXXX, $06C6, $XXXX, $XXXX, $XXXX ; dc.w $03AE, $XXXX, $05AA, $XXXX, $07A6, $XXXX, $XXXX, $XXXX, $048E, $XXXX, $068A, $XXXX, $0186, $XXXX, $XXXX, $0480 ; Trimmed: ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $0480 ; H40: ; dc.w $01EE, $XXXX, $03EA, $XXXX, $05E6, $XXXX, $XXXX, $XXXX, $02CE, $XXXX, $04CA, $XXXX, $06C6, $XXXX, $XXXX, $XXXX ; dc.w $03AE, $XXXX, $05AA, $XXXX, $07A6, $XXXX, $XXXX, $XXXX, $048E, $XXXX, $068A, $XXXX, $0186, $XXXX, $XXXX, $XXXX ; dc.w $056E, $XXXX, $076A, $XXXX, $0266, $XXXX, $XXXX, $0560 ; Trimmed: ; dc.w $01EE, $03EA, $05E6, $02CE, $04CA, $06C6, $03AE, $05AA, $07A6, $048E, $068A, $0186, $056E, $076A, $0266, $0560