;------------------------------------------------------------------------------------ ; Test - ;-Description: ;------------------------------------------------------------------------------------ TestDMATransferLengthRegUpdateText: dc.b 'DMA Transfer Length Reg Update ' TestDMATransferLengthRegUpdateTextEnd: TestDMATransferLengthRegUpdateExpectedResult: dc.w $89AB, $CDEF, $0123, $0000, $0123, $4567, $0000, $0000, $89AB, $CDEF, $0123, $0000, $89AB, $CDEF, $0000, $0000 TestDMATransferLengthRegUpdate: ;Initialize the text result block move.w #(TestDMATransferLengthRegUpdateTextEnd-TestDMATransferLengthRegUpdateText),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 TestDMATransferLengthRegUpdateText,A1 sub.w #1,D7 TestDMATransferLengthRegUpdateWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferLengthRegUpdateWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferLengthRegUpdateExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMATransferLengthRegUpdateWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferLengthRegUpdateWriteExpectedResultData ;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 ;Clear data in VRAM at 0x81FC move.l #$41FC0002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Do a DMA transfer operation from the source data block to VRAM address 0x8000 for 0x0202 bytes move.l #TestDMATransferLengthRegUpdateSampleData,D0 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9301,$C00004 move.w #$9401,$C00004 move.w #$9500, D2 lsr.l #1,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9600, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9700, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$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 ;Test target memory move.l #$01FC0002,$C00004 ;Read from VRAM at 0x81FC 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 move.l #$40000002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Clear data in VRAM at 0x81FC move.l #$41FC0002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Do a DMA transfer operation from the source data block to VRAM address 0x8000, only ;updating the lower DMA transfer count register to 0x02. move.l #TestDMATransferLengthRegUpdateSampleData,D0 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9302,$C00004 move.w #$9500, D2 lsr.l #1,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9600, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9700, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$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 ;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)+ 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 move.l #$40000002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Clear data in VRAM at 0x81FC move.l #$41FC0002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Do a DMA transfer operation from the source data block to VRAM address 0x8000 for 0x0101 bytes move.l #TestDMATransferLengthRegUpdateSampleData,D0 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9301,$C00004 move.w #$9401,$C00004 move.w #$9500, D2 lsr.l #1,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9600, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9700, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$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 ;Test target memory move.l #$01FC0002,$C00004 ;Read from VRAM at 0x81FC 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 move.l #$40000002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Clear data in VRAM at 0x81FC move.l #$41FC0002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Do a DMA transfer operation from the source data block to VRAM address 0x8000, only ;updating the upper DMA transfer count register to 0x01. move.l #TestDMATransferLengthRegUpdateSampleData,D0 move.w #$8154,$C00004 move.w #$8F02,$C00004 move.w #$9401,$C00004 move.w #$9500, D2 lsr.l #1,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9600, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$C00004 move.w #$9700, D2 lsr.l #8,D0 move.b D0,D2 move.w D2,$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 ;Test target memory move.l #$01FC0002,$C00004 ;Read from VRAM at 0x81FC 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 move.l #$40000002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 ;Clear data in VRAM at 0x81FC move.l #$41FC0002,$C00004 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 move.w #$0000,$C00000 rts TestDMATransferLengthRegUpdateSampleData: dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF dc.w $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF, $0123, $4567, $89AB, $CDEF