;------------------------------------------------------------------------------------ ; Test - ;-Description: ; The purpose of this test is to verify the correct data is returned from the status ; register for the FIFO state bits and DMA busy flag during and around DMA copy ; operation execution. ;------------------------------------------------------------------------------------ TestDMABusyFlagDMACopyText: dc.b 'DMA Busy Flag DMA Copy ' TestDMABusyFlagDMACopyTextEnd: TestDMABusyFlagDMACopyExpectedResult: dc.w $0200, $4E00, $0202, $4E02, $0202, $4E02, $0200, $4E00, $0000, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB TestDMABusyFlagDMACopy: ;Initialize the text result block move.w #(TestDMABusyFlagDMACopyTextEnd-TestDMABusyFlagDMACopyText),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 TestDMABusyFlagDMACopyText,A1 sub.w #1,D7 TestDMABusyFlagDMACopyWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMABusyFlagDMACopyWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMABusyFlagDMACopyExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMABusyFlagDMACopyWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMABusyFlagDMACopyWriteExpectedResultData ;Clear data in VRAM at 0x8000 move.l #$40000002,$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 ;Load data in VRAM at 0x9000 move.l #$50000002,$C00004 move.w #$0123,$C00000 move.w #$4567,$C00000 move.w #$89AB,$C00000 move.w #$CDEF,$C00000 move.w #$0123,$C00000 move.w #$4567,$C00000 move.w #$89AB,$C00000 move.w #$CDEF,$C00000 move.w #$0123,$C00000 move.w #$4567,$C00000 move.w #$89AB,$C00000 move.w #$CDEF,$C00000 move.w #$0123,$C00000 move.w #$4567,$C00000 move.w #$89AB,$C00000 move.w #$CDEF,$C00000 ;Wait a few cycles, to ensure the FIFO is empty before we proceed. nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop ;Test status register move.w $C00004,D5 and.w #$FF02,D5 move.w D5,(A0)+ move.w $C00004,D5 nop and.w #$FF02,D5 move.w D5,(A0)+ ;Do a DMA copy operation from VRAM address 0x9000 to 0x8002 move.w #$0100,D1 move.w #$8F01,$C00004 move.w #$8154,$C00004 move.w #$9300, D2 move.b D1,D2 move.w D2,$C00004 move.w #$9400, D2 lsr.l #8,D1 move.b D1,D2 move.w D2,$C00004 move.w #$9500,$C00004 move.w #$9690,$C00004 move.w #$97C0,$C00004 move.l #$000200C2,(A0) ;DMA copy to VRAM address 0x8002 move.l (A0),$C00004 ;Test status register move.w $C00004,D5 and.w #$FF02,D5 move.w D5,(A0)+ move.w $C00004,D5 nop and.w #$FF02,D5 move.w D5,(A0)+ move.w $C00004,D5 and.w #$FF02,D5 move.w D5,(A0)+ move.w $C00004,D5 nop and.w #$FF02,D5 move.w D5,(A0)+ ;Wait a long time to give the DMA operation sufficient time to complete move.w #$7FFF,D6 TestDMABusyFlagDMACopyDMAWaitLoop2: dbf D6,TestDMABusyFlagDMACopyDMAWaitLoop2 ;Test status register move.w $C00004,D5 and.w #$FF02,D5 move.w D5,(A0)+ move.w $C00004,D5 nop and.w #$FF02,D5 move.w D5,(A0)+ ;Disable DMA, and restore the increment data. move.w #$8144,$C00004 move.w #$8F02,$C00004 ;Test target memory move.l #$00000002,$C00004 ;Read from VRAM at 0x8000 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 ;Clear data in VRAM at 0x8000-0xA000 move.l #$40000002,$C00004 move.w #$1000,D7 TestDMABusyFlagDMACopyClearVRAMLoop: move.w #$0000,$C00000 dbf D7,TestDMABusyFlagDMACopyClearVRAMLoop rts