;------------------------------------------------------------------------------------ ; Test - ;-Description: ;------------------------------------------------------------------------------------ TestDMABusyFlagDMADisabledCopyText: dc.b 'DMA Busy Flag DMA Disabled Copy ' TestDMABusyFlagDMADisabledCopyTextEnd: TestDMABusyFlagDMADisabledCopyExpectedResult: dc.w $0200, $4E00, $0200, $4E00, $0200, $4E00, $0200, $4E00, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 TestDMABusyFlagDMADisabledCopy: ;Initialize the text result block move.w #(TestDMABusyFlagDMADisabledCopyTextEnd-TestDMABusyFlagDMADisabledCopyText),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 TestDMABusyFlagDMADisabledCopyText,A1 sub.w #1,D7 TestDMABusyFlagDMADisabledCopyWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMABusyFlagDMADisabledCopyWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMABusyFlagDMADisabledCopyExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMABusyFlagDMADisabledCopyWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMABusyFlagDMADisabledCopyWriteExpectedResultData ;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 ;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 ;Do a DMA copy operation from VRAM address 0x9000 to 0x8002 with the DMA enable bit disabled 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 TestDMABusyFlagDMADisabledCopyDMAWaitLoop1: dbf D6,TestDMABusyFlagDMADisabledCopyDMAWaitLoop1 ;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)+ ;Restore the increment data 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 TestDMABusyFlagDMADisabledCopyClearVRAMLoop: move.w #$0000,$C00000 dbf D7,TestDMABusyFlagDMADisabledCopyClearVRAMLoop rts