;---------------------------------------------------------------------------------------- ; Test - Mode4RegisterMask ;-Description: ;---------------------------------------------------------------------------------------- TestMode4RegisterMaskText: dc.b 'Register Write Mode4 Mask ' TestMode4RegisterMaskTextEnd: TestMode4RegisterMaskExpectedResult: dc.w $1234, $5678, $9ABC, $FFFF, $FFFF, $FFFF, $FFFF, $FFFF, $1234, $5678, $9ABC, $FFFF, $FFFF, $FFFF, $FFFF, $FFFF TestMode4RegisterMask: ;Initialize the text result block move.w #(TestMode4RegisterMaskTextEnd-TestMode4RegisterMaskText),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 TestMode4RegisterMaskText,A1 sub.w #1,D7 TestMode4RegisterMaskWriteText: move.b (A1)+,(A0)+ dbf D7,TestMode4RegisterMaskWriteText move.w #1,(A0)+ ;Set the expected result data present flag lea TestMode4RegisterMaskExpectedResult,A1 ;Write the expected result data to the buffer sub.w #1,D6 TestMode4RegisterMaskWriteExpectedResultData: move.b (A1)+,(A0)+ dbf D6,TestMode4RegisterMaskWriteExpectedResultData ;Initialize VRAM data at 0x8000 move.l #$40000002,$C00004 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 ;Perform some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$1234,$C00000 move.w #$5678,$C00000 move.w #$9ABC,$C00000 ;Read from VRAM at 0x8000 move.l #$00000002,$C00004 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 ;Initialize VRAM data at 0x8000 move.l #$40000002,$C00004 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 move.w #$FFFF,$C00000 ;Enable mode 4 move.w #$8140,$C00004 ;Try and set the address increment to 4 with mode 4 enabled. This will fail, as ;registers above 0x0A are masked when mode 4 is enabled, and cannot be modified. move.w #$8F04,$C00004 ;Enable mode 5 move.w #$8144,$C00004 ;Perform some writes to VRAM at 0x8000 move.l #$40000002,$C00004 move.w #$1234,$C00000 move.w #$5678,$C00000 move.w #$9ABC,$C00000 ;Restore the address increment move.w #$8F02,$C00004 ;Read from VRAM at 0x8000 move.l #$00000002,$C00004 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 rts