;------------------------------------------------------------------------------------ ;Test 12 - DMA Fill to CRAM V2 ;-In: ; D3.b = Increment data ; D4.b = Text display number ; D5.b = DMA mode ;------------------------------------------------------------------------------------ TestDMAFillToCRAMV2Text: dc.b 'DMA Fill to CRAM inc=0 ' dc.b 'DMA Fill to CRAM inc=1 ' dc.b 'DMA Fill to CRAM inc=2 ' dc.b 'DMA Fill to CRAM inc=4 ' dc.b 'DMA Fill to CRAM CD4=1 inc=0 ' dc.b 'DMA Fill to CRAM CD4=1 inc=1 ' dc.b 'DMA Fill to CRAM CD4=1 inc=2 ' dc.b 'DMA Fill to CRAM CD4=1 inc=4 ' TestDMAFillToCRAMV2ExpectedResult: dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $08AC, $0C04, $0CA8, $0C04, $02A4, $0C04, $06A0, $0C04, $0A8C, $0C04, $0E88, $0C04, $0484, $0C04, $0880 dc.w $0C04, $0C6C, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $08AC, $0C04, $0CA8, $0C04, $02A4, $0C04, $06A0, $0C04, $0A8C, $0C04, $0E88, $0C04, $0484, $0C04, $0880 dc.w $0C04, $0C6C, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $08AC, $0C04, $0CA8, $0C04, $02A4, $0C04, $06A0, $0C04, $0A8C, $0C04, $0E88, $0C04, $0484, $0C04, $0880 dc.w $0C04, $0C6C, $0C04, $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 dc.w $02EE, $04EC, $06EA, $08E8, $0AE6, $0CE4, $0EE2, $02E0, $04CE, $06CC, $08CA, $0AC8, $0CC6, $0EC4, $02C2, $04C0 dc.w $08AC, $08AC, $0C04, $0CA8, $0C04, $02A4, $0C04, $06A0, $0C04, $0A8C, $0C04, $0E88, $0C04, $0484, $0C04, $0880 dc.w $0C04, $0C6C, $0C04, $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 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $28AC, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $28AC, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $28AC, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $28AC, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $28AC, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 dc.w $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222, $2222 TestDMAFillToCRAMV2: ;Initialize the text result block move.w #36,D7 move.w #9,(A0)+ ;Set the number of display lines move.w D7,(A0)+ ;Set the text length move.w #$0100,D6 ;Set the data length move.w D6,(A0)+ lea TestDMAFillToCRAMV2Text,A1 move.w D4,D1 mulu.w D7,D1 add.l D1,A1 sub.w #1,D7 TestDMAFillToCRAMV2WriteText: move.b (A1)+,(A0)+ dbf D7,TestDMAFillToCRAMV2WriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestDMAFillToCRAMV2ExpectedResult,A1 ;Write the expected result data to the buffer move.w D4,D1 mulu.w D6,D1 add.l D1,A1 sub.w #1,D6 TestDMAFillToCRAMV2WriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestDMAFillToCRAMV2WriteExpectedResultData ;Initialize CRAM move.l #$C0000000,$C00004 move.w #$3F,D0 lea TestDMAFillToCRAMV2TestData,A1 TestDMAFillToCRAMV2CRAMLoop: ; move.w #$2222,$C00000 move.w (A1)+,$C00000 dbf D0,TestDMAFillToCRAMV2CRAMLoop ;Do a DMA fill operation to CRAM address 0x20 move.w #$0009,D1 move.w #$8F00, D2 move.b D3,D2 move.w D2,$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 ;Set the DMA source register to 0x0000, just in case it is used in some way. move.w #$9600,$C00004 move.w #$9700, D2 move.b D5,D2 move.w D2,$C00004 move.l #$C0200080,(A0) ;DMA fill at CRAM address 0x20 cmp.b #$3,D4 ble TestDMAFillToCRAMV2DMASettingSelect1 move.l #$C02000C0,(A0) ;DMA fill at CRAM address 0x20 with CD5-CD4=11 TestDMAFillToCRAMV2DMASettingSelect1: nop ;If we uncomment this block, we get corrupted write data at the start of the nop ;fill. If we don't have any wait cycles between the control port write and the nop ;data port write, the written data is usually correct, with the exception that nop ;the byte order of the first write is reversed. If we do insert wait states nop ;between the control port write and the data port write, without any wait states nop ;before the control port write, the fill starts with a fill data of 0x00, and at nop ;some point during the fill operation, usually 4 or 5 bytes in, the data port nop ;write then occurs, and the fill operation from then on picks up the correct fill nop ;data from that data port write. In other words, if we don't insert a wait state nop ;between when we set all our registers for a fill above, and when we actually nop ;perform the control port write to setup for the fill operation, the fill can nop ;inadvertantly trigger immediately when the control port write is made, without nop ;waiting for the data port write to occur. We have found from testing that at nop ;least 20 NOP cycles are required in order to get reliable results, when the nop ;control port write occurs as a long word write from RAM. nop nop nop nop nop move.l (A0),$C00004 move.w #$0080,D7 ;Add a small delay loop before writing to the data port, just in case we actually kicked off a DMA copy operation. TestDMAFillToCRAMV2DelayLoop1: dbf D7,TestDMAFillToCRAMV2DelayLoop1 ;##DEBUG## ; move.w #$3FFF,D0 ; TestDMAFillToCRAMV2DummyLoop1: ; dbf D0,TestDMAFillToCRAMV2DummyLoop1 ;; move.w #$7F,D0 ; move.w #$3F,D0 ; cmp.b #$3,D4 ; bge TestDMAFillToCRAMV2DummyLoop move.w #$68AC,$C00000 ;Start DMA fill with 0x68AC ;##DEBUG## ; TestDMAFillToCRAMV2DummyLoop: ; move.w #$0000,(A0)+ ; dbf D0,TestDMAFillToCRAMV2DummyLoop ; move.w #$3FFF,D0 ; TestDMAFillToCRAMV2DummyLoop2: ; dbf D0,TestDMAFillToCRAMV2DummyLoop2 ;; TestDMAFillToCRAMV2DMADummyLoop: ;; move.w $C00004,D7 ;; btst #1,D7 ;; bne TestDMAFillToCRAMV2DMADummyLoop ; move.w #$8144,$C00004 ; move.w #$8F02,$C00004 ;; rts TestDMAFillToCRAMV2DMAWaitLoop1: move.w $C00004,D7 btst #1,D7 bne TestDMAFillToCRAMV2DMAWaitLoop1 move.w #$8144,$C00004 move.w #$8F02,$C00004 ;Dump CRAM move.l #$00000020,$C00004 move.w #$3F,D0 TestDMAFillToCRAMV2CRAMLoop2: move.w $C00000,(A0)+ dbf D0,TestDMAFillToCRAMV2CRAMLoop2 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 ;##DEBUG## ; rts ;Initialize CRAM move.l #$C0000000,$C00004 move.w #$3F,D0 lea TestDMAFillToCRAMV2TestData,A1 TestDMAFillToCRAMV2CRAMLoop3: ; move.w #$2222,$C00000 move.w (A1)+,$C00000 dbf D0,TestDMAFillToCRAMV2CRAMLoop3 ;Do a DMA fill operation to CRAM address 0x21 move.w #$0009,D1 move.w #$8F00, D2 move.b D3,D2 move.w D2,$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 ;Set the DMA source register to 0x0000, just in case it is used in some way. move.w #$9600,$C00004 move.w #$9700, D2 move.b D5,D2 move.w D2,$C00004 move.l #$C0210080,(A0) ;DMA fill at CRAM address 0x21 cmp.b #$4,D4 ble TestDMAFillToCRAMV2DMASettingSelect2 move.l #$C02100C0,(A0) ;DMA fill at CRAM address 0x21 with CD5-CD4=11 TestDMAFillToCRAMV2DMASettingSelect2: nop ;If we uncomment this block, we get corrupted write data at the start of the nop ;fill. If we don't have any wait cycles between the control port write and the nop ;data port write, the written data is usually correct, with the exception that nop ;the byte order of the first write is reversed. If we do insert wait states nop ;between the control port write and the data port write, without any wait states nop ;before the control port write, the fill starts with a fill data of 0x00, and at nop ;some point during the fill operation, usually 4 or 5 bytes in, the data port nop ;write then occurs, and the fill operation from then on picks up the correct fill nop ;data from that data port write. In other words, if we don't insert a wait state nop ;between when we set all our registers for a fill above, and when we actually nop ;perform the control port write to setup for the fill operation, the fill can nop ;inadvertantly trigger immediately when the control port write is made, without nop ;waiting for the data port write to occur. We have found from testing that at nop ;least 20 NOP cycles are required in order to get reliable results, when the nop ;control port write occurs as a long word write from RAM. nop nop nop nop nop move.l (A0),$C00004 move.w #$0080,D7 ;Add a small delay loop before writing to the data port, just in case we actually kicked off a DMA copy operation. TestDMAFillToCRAMV2DelayLoop2: dbf D7,TestDMAFillToCRAMV2DelayLoop2 move.w #$68AC,$C00000 ;Start DMA fill with 0x68AC TestDMAFillToCRAMV2DMAWaitLoop2: move.w $C00004,D7 btst #1,D7 bne TestDMAFillToCRAMV2DMAWaitLoop2 move.w #$8144,$C00004 move.w #$8F02,$C00004 ;Dump CRAM move.l #$00000020,$C00004 move.w #$3F,D0 TestDMAFillToCRAMV2CRAMLoop4: move.w $C00000,(A0)+ dbf D0,TestDMAFillToCRAMV2CRAMLoop4 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 ;Initialize CRAM move.l #$C0000000,$C00004 move.w #$3F,D0 TestDMAFillToCRAMV2CRAMLoop5: move.w #$0000,$C00000 dbf D0,TestDMAFillToCRAMV2CRAMLoop5 rts TestDMAFillToCRAMV2TestData: 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