;------------------------------------------------------------------------------------ ; Test - ;-Description: ;------------------------------------------------------------------------------------ TestDMATransferToCRAMWrappingText: dc.b 'DMA Transfer to CRAM Wrapping ' TestDMATransferToCRAMWrappingTextEnd: TestDMATransferToCRAMWrappingExpectedResult: dc.w $0EEE, $0CCC, $0AAA, $0888, $02EE, $04EC, $06EA, $08E8, $0222, $0EEE, $0CCC, $0AAA, $0E2E, $022C, $042A, $0628 TestDMATransferToCRAMWrapping: ;Initialize the text result block move.w #(TestDMATransferToCRAMWrappingTextEnd-TestDMATransferToCRAMWrappingText),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 TestDMATransferToCRAMWrappingText,A1 sub.w #1,D7 TestDMATransferToCRAMWrappingWriteText: move.b (A1)+,(A0)+ dbf D7,TestDMATransferToCRAMWrappingWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMATransferToCRAMWrappingExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestDMATransferToCRAMWrappingWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMATransferToCRAMWrappingWriteExpectedResultData ;Initialize CRAM move.l #$C0000000,$C00004 move.w #$3F,D7 TestDMATransferToCRAMWrappingCRAMLoop: move.w #$2222,$C00000 dbf D7,TestDMATransferToCRAMWrappingCRAMLoop ;Clear data in VRAM at 0x8000, just to make sure the FIFO is initialized. 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 ;Do a DMA transfer operation from the source data block to CRAM address 0x0000 for 0x80 bytes move.l #TestDMATransferToCRAMWrappingCRAMTestData,D0 move.w #$0040,D1 move.w #$8154,$C00004 move.w #$8F02,$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, 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 #$C0000080,(A0) ;DMA transfer to CRAM address 0x0000 move.l (A0),$C00004 ;Test target memory move.l #$00000020,$C00004 ;Read from CRAM at 0x0000 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 ;Do a DMA transfer operation from the source data block to CRAM address 0x0000 for 0x100 bytes move.l #TestDMATransferToCRAMWrappingCRAMTestData,D0 move.w #$0080,D1 move.w #$8154,$C00004 move.w #$8F02,$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, 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 #$C0000080,(A0) ;DMA transfer to CRAM address 0x0000 move.l (A0),$C00004 ;Test target memory move.l #$00000020,$C00004 ;Read from CRAM at 0x0000 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 ;Do a DMA transfer operation from the source data block to CRAM address 0x40A0 for 0x80 bytes move.l #TestDMATransferToCRAMWrappingCRAMTestData,D0 move.w #$0040,D1 move.w #$8154,$C00004 move.w #$8F02,$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, 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 #$C0A00081,(A0) ;DMA transfer to CRAM address 0x40A0 move.l (A0),$C00004 ;Test target memory move.l #$00000020,$C00004 ;Read from CRAM at 0x0000 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 ;Do a DMA transfer operation from the source data block to CRAM address 0x40A0 for 0x100 bytes move.l #TestDMATransferToCRAMWrappingCRAMTestData,D0 move.w #$0080,D1 move.w #$8154,$C00004 move.w #$8F02,$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, 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 #$C0A00081,(A0) ;DMA transfer to CRAM address 0xA020 move.l (A0),$C00004 ;Test target memory move.l #$00000020,$C00004 ;Read from CRAM at 0x0000 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 rts TestDMATransferToCRAMWrappingCRAMTestData: dc.w $0EEE, $0CCC, $0AAA, $0888, $0666, $0444, $0222, $0EEE, $0CCC, $0AAA, $0888, $0666, $0444, $0222, $0EEE, $0CCC dc.w $0AAA, $0888, $0666, $0444, $0222, $0EEE, $0CCC, $0AAA, $0888, $0666, $0444, $0222, $0EEE, $0CCC, $0AAA, $0888 dc.w $0666, $0444, $0222, $0EEE, $0CCC, $0AAA, $0888, $0666, $0444, $0222, $0EEE, $0CCC, $0AAA, $0888, $0666, $0444 dc.w $0222, $0EEE, $0CCC, $0AAA, $0888, $0666, $0444, $0222, $0EEE, $0CCC, $0AAA, $0888, $0666, $0444, $0222, $0EEE dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $06AE, $08AC, $0AAA, $0CA8, $0EA6, $02A4, $04A2, $06A0, $088E, $0A8C, $0C8A, $0E88, $0286, $0484, $0682, $0880 dc.w $0A6E, $0C6C, $0E6A, $0268, $0466, $0664, $0862, $0A60, $0C4E, $0E4C, $024A, $0448, $0646, $0844, $0A42, $0C40 dc.w $0E2E, $022C, $042A, $0628, $0826, $0A24, $0C22, $0E20, $020E, $040C, $060A, $0808, $0A06, $0C04, $0E02, $0200