;------------------------------------------------------------------------------------ ;Test - FIFO Wait States ;------------------------------------------------------------------------------------ TestFIFOWaitStatesText: dc.b 'FIFO Wait States ' TestFIFOWaitStatesTextEnd: TestFIFOWaitStatesExpectedResult: dc.w $0100, $0100, $0000, $0200, $0100, $0100, $0000, $0200, $0100, $0100, $0000, $0200, $0100, $0100, $0000, $0200 dc.w $0100, $0100, $0000, $0200, $0100, $0100, $0000, $0200, $0100, $FFFF, $FFFF, $0200, $0100, $0100, $0000, $0200 dc.w $0200, $0100, $0000, $0200, $0000, $0100, $0000, $0200 TestFIFOWaitStates: ;Initialize the text result block move.w #(TestFIFOWaitStatesTextEnd-TestFIFOWaitStatesText),D7 move.w #4,(A0)+ ;Set the number of display lines move.w D7,(A0)+ ;Set the text length move.w #$0050,D6 ;Set the data length move.w D6,(A0)+ lea TestFIFOWaitStatesText,A1 sub.w #1,D7 TestFIFOWaitStatesWriteText: move.b (A1)+,(A0)+ dbf D7,TestFIFOWaitStatesWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestFIFOWaitStatesExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestFIFOWaitStatesWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestFIFOWaitStatesWriteExpectedResultData ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest1Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do nothing, just sample the FIFO. ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest1Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest1Result1Found bset #0,D7 TestFIFOWaitStatesTest1Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest1ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest1ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest1ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest1ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest1ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest1ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest1ResultLoop10 bra TestFIFOWaitStatesTest1ResultLoopError TestFIFOWaitStatesTest1ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest1ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest1ResultLoopTestComplete TestFIFOWaitStatesTest1ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest1ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest1ResultLoopTestComplete TestFIFOWaitStatesTest1ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest1ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest1ResultLoopTestComplete TestFIFOWaitStatesTest1ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest1ResultLoopTestComplete TestFIFOWaitStatesTest1ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest1ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest1ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest1Loop TestFIFOWaitStatesTest1ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest2Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a partial control port write move.w #$C000,$C00004 ;Write to CRAM at 0x8000 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest2Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest2Result1Found bset #0,D7 TestFIFOWaitStatesTest2Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest2ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest2ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest2ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest2ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest2ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest2ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest2ResultLoop10 bra TestFIFOWaitStatesTest2ResultLoopError TestFIFOWaitStatesTest2ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest2ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest2ResultLoopTestComplete TestFIFOWaitStatesTest2ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest2ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest2ResultLoopTestComplete TestFIFOWaitStatesTest2ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest2ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest2ResultLoopTestComplete TestFIFOWaitStatesTest2ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest2ResultLoopTestComplete TestFIFOWaitStatesTest2ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest2ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest2ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest2Loop TestFIFOWaitStatesTest2ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest3Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a full control port write move.l #$40000012,$C00004 ;Write to VSRAM at 0x8000 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest3Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest3Result1Found bset #0,D7 TestFIFOWaitStatesTest3Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest3ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest3ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest3ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest3ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest3ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest3ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest3ResultLoop10 bra TestFIFOWaitStatesTest3ResultLoopError TestFIFOWaitStatesTest3ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest3ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest3ResultLoopTestComplete TestFIFOWaitStatesTest3ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest3ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest3ResultLoopTestComplete TestFIFOWaitStatesTest3ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest3ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest3ResultLoopTestComplete TestFIFOWaitStatesTest3ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest3ResultLoopTestComplete TestFIFOWaitStatesTest3ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest3ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest3ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest3Loop TestFIFOWaitStatesTest3ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest4Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a full control port write and some data writes move.l #$40000012,$C00004 ;Write to VSRAM at 0x8000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest4Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest4Result1Found bset #0,D7 TestFIFOWaitStatesTest4Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest4ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest4ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest4ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest4ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest4ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest4ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest4ResultLoop10 bra TestFIFOWaitStatesTest4ResultLoopError TestFIFOWaitStatesTest4ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest4ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest4ResultLoopTestComplete TestFIFOWaitStatesTest4ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest4ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest4ResultLoopTestComplete TestFIFOWaitStatesTest4ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest4ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest4ResultLoopTestComplete TestFIFOWaitStatesTest4ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest4ResultLoopTestComplete TestFIFOWaitStatesTest4ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest4ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest4ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest4Loop TestFIFOWaitStatesTest4ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest5Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a partial control port write move.w #$0000,$C00004 ;Read from VRAM at 0x8000 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest5Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest5Result1Found bset #0,D7 TestFIFOWaitStatesTest5Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest5ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest5ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest5ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest5ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest5ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest5ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest5ResultLoop10 bra TestFIFOWaitStatesTest5ResultLoopError TestFIFOWaitStatesTest5ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest5ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest5ResultLoopTestComplete TestFIFOWaitStatesTest5ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest5ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest5ResultLoopTestComplete TestFIFOWaitStatesTest5ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest5ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest5ResultLoopTestComplete TestFIFOWaitStatesTest5ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest5ResultLoopTestComplete TestFIFOWaitStatesTest5ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest5ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest5ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest5Loop TestFIFOWaitStatesTest5ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest6Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a full control port write move.l #$00000002,$C00004 ;Read from VRAM at 0x8000 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest6Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest6Result1Found bset #0,D7 TestFIFOWaitStatesTest6Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest6ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest6ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest6ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest6ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest6ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest6ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest6ResultLoop10 bra TestFIFOWaitStatesTest6ResultLoopError TestFIFOWaitStatesTest6ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest6ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest6ResultLoopTestComplete TestFIFOWaitStatesTest6ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest6ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest6ResultLoopTestComplete TestFIFOWaitStatesTest6ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest6ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest6ResultLoopTestComplete TestFIFOWaitStatesTest6ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest6ResultLoopTestComplete TestFIFOWaitStatesTest6ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest6ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest6ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest6Loop TestFIFOWaitStatesTest6ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest7Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a full control port write and a read move.l #$00000002,$C00004 ;Read from VRAM at 0x8000 move.w $C00000,D4 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest7Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest7Result1Found bset #0,D7 TestFIFOWaitStatesTest7Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest7ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest7ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest7ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest7ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest7ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest7ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest7ResultLoop10 bra TestFIFOWaitStatesTest7ResultLoopError TestFIFOWaitStatesTest7ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest7ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest7ResultLoopTestComplete TestFIFOWaitStatesTest7ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest7ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest7ResultLoopTestComplete TestFIFOWaitStatesTest7ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest7ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest7ResultLoopTestComplete TestFIFOWaitStatesTest7ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest7ResultLoopTestComplete TestFIFOWaitStatesTest7ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest7ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest7ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest7Loop TestFIFOWaitStatesTest7ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest8Loop: ;Set our sample position pointer move.l A0,A1 ;Fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 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 the initial FIFO state move.w $C00004,D5 ;Do a data register write move.l #$8F01,$C00004 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest8Result1Found move.w D5,D0 btst #8,D5 beq TestFIFOWaitStatesTest8Result1Found bset #0,D7 TestFIFOWaitStatesTest8Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest8ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest8ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest8ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest8ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest8ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest8ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest8ResultLoop10 bra TestFIFOWaitStatesTest8ResultLoopError TestFIFOWaitStatesTest8ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest8ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest8ResultLoopTestComplete TestFIFOWaitStatesTest8ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest8ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest8ResultLoopTestComplete TestFIFOWaitStatesTest8ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest8ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest8ResultLoopTestComplete TestFIFOWaitStatesTest8ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest8ResultLoopTestComplete TestFIFOWaitStatesTest8ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest8ResultLoop ;Restore the increment data move.l #$8F02,$C00004 ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest8ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest8Loop TestFIFOWaitStatesTest8ExitLoop: ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Set the initial DMA register settings move.w #$8154,$C00004 move.w #$9400,$C00004 move.w #$9600,$C00004 move.w #$9700,$C00004 ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest9Loop: ;Set our sample position pointer move.l A0,A1 ;Read the initial FIFO state move.w $C00004,D5 ;Perform a DMA transfer move.w #$9308,$C00004 move.w #$9500,$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 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest9Result1Found move.w D5,D0 btst #9,D5 beq TestFIFOWaitStatesTest9Result1Found bset #0,D7 TestFIFOWaitStatesTest9Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest9ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest9ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest9ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest9ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest9ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest9ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest9ResultLoop10 bra TestFIFOWaitStatesTest9ResultLoopError TestFIFOWaitStatesTest9ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest9ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest9ResultLoopTestComplete TestFIFOWaitStatesTest9ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest9ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest9ResultLoopTestComplete TestFIFOWaitStatesTest9ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest9ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest9ResultLoopTestComplete TestFIFOWaitStatesTest9ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest9ResultLoopTestComplete TestFIFOWaitStatesTest9ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest9ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest9ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest9Loop TestFIFOWaitStatesTest9ExitLoop: ;Disable DMA move.w #$8144,$C00004 ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ ;Initialize our result registers move.w #$0000,D7 move.w #$FFFF,D0 move.w #$FFFF,D1 move.w #$FFFF,D2 move.w #$FFFF,D3 move.w #$0800,D6 TestFIFOWaitStatesTest10WaitFIFOEmpty: move.w $C00004,D4 btst #1,D4 bne TestFIFOWaitStatesTest10WaitFIFOEmpty ;##TODO## This locks up on the hardware. Find out why. Note that a lockup doesn't ;occur if we set the DMA mode to 0x80 for a DMA fill. I believe a DMA operation is ;inadvertently being triggered by setting reg 0x17, but note that we still get a ;lockup even if DMA is disabled, the FIFO is empty, and a DMA transfer was not the ;last operation to be performed. Strange. ; move.w #$9700,$C00004 ; move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 TestFIFOWaitStatesTest10Loop: ;Set our sample position pointer move.l A0,A1 ;Disable DMA move.w #$8144,$C00004 ;Almost fill the FIFO with writes move.l #$40000002,$C00004 ;Write to VRAM at 0x8000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 ;Enable DMA move.w #$8154,$C00004 ;Read the initial FIFO state move.w $C00004,D5 ;Perform a DMA transfer move.w #$9303,$C00004 move.w #$9500,$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 ;Sample the FIFO several times move.w $C00004,D4 move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w $C00004,(A1)+ move.w D4,(A1)+ ;Reset our sample pointer position move.l A0,A1 ;Read the initial FIFO state sample, and latch it if it is the desired result. and.w #$0302,D5 btst #0,D7 bne TestFIFOWaitStatesTest10Result1Found move.w D5,D0 btst #9,D5 bne TestFIFOWaitStatesTest10Result1Found bset #0,D7 TestFIFOWaitStatesTest10Result1Found: ;Read the resulting FIFO state samples, and latch each state we identify. move.w #$000F,D4 TestFIFOWaitStatesTest10ResultLoop: move.w (A1)+,D5 and.w #$0302,D5 cmp.w #$0000,D5 beq TestFIFOWaitStatesTest10ResultLoop00 cmp.w #$0002,D5 beq TestFIFOWaitStatesTest10ResultLoop00 cmp.w #$0100,D5 beq TestFIFOWaitStatesTest10ResultLoop01 cmp.w #$0102,D5 beq TestFIFOWaitStatesTest10ResultLoop01 cmp.w #$0200,D5 beq TestFIFOWaitStatesTest10ResultLoop10 cmp.w #$0202,D5 beq TestFIFOWaitStatesTest10ResultLoop10 bra TestFIFOWaitStatesTest10ResultLoopError TestFIFOWaitStatesTest10ResultLoop00: btst #2,D7 bne TestFIFOWaitStatesTest10ResultLoopTestComplete move.w D5,D2 bset #2,D7 bra TestFIFOWaitStatesTest10ResultLoopTestComplete TestFIFOWaitStatesTest10ResultLoop01: btst #1,D7 bne TestFIFOWaitStatesTest10ResultLoopTestComplete move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest10ResultLoopTestComplete TestFIFOWaitStatesTest10ResultLoop10: btst #3,D7 bne TestFIFOWaitStatesTest10ResultLoopTestComplete move.w D5,D3 bset #3,D7 bra TestFIFOWaitStatesTest10ResultLoopTestComplete TestFIFOWaitStatesTest10ResultLoopError: move.w D5,D1 bset #1,D7 bra TestFIFOWaitStatesTest10ResultLoopTestComplete TestFIFOWaitStatesTest10ResultLoopTestComplete: dbf D4,TestFIFOWaitStatesTest10ResultLoop ;Exit the loop if we sampled all possible FIFO states cmp.w #$000F,D7 beq TestFIFOWaitStatesTest10ExitLoop ;Run the test again, trying to capture more FIFO states. dbf D6,TestFIFOWaitStatesTest10Loop TestFIFOWaitStatesTest10ExitLoop: ;Disable DMA move.w #$8144,$C00004 ;Write the test results move.w D0,(A0)+ move.w D1,(A0)+ move.w D2,(A0)+ move.w D3,(A0)+ rts TestFIFOWaitStatesTestVRAMDataBlock: dc.w $AAAA, $BBBB, $CCCC, $DDDD, $EEEE, $FFFF, $1111