the code below can be used to test if the trick used in SMS games to avoid the second out on vdp (see: http://www.smspower.org/Development/VDPProgrammingTechniques) work also on msx / 1 / 2 / 2+ / TR .
ASM is below, and basic code is following the ASM. Basically it pass to the USR a integer where the low byte is a 8 bit addr and high is the value to poke. The USR then perform a VPOKE LO(ARG),HI(ARG)>>8
THE BASIC CODE CALLS 255 times the routine. Result:
A stripe of 0x41 bytes written on the second 16K VRAM Bank of VDP at addresses beginning From 1. Please note: 1 not 0! as specified. That is because the ASM code does not out the second byte so the VDP cannot know that it is a write access and does a prefetch skipping 1 byte forward.
That's is the behavior on openMSX. And it is perfecly fine and logical.
However, if this behavior is correct, why the tecnique shown on smspower works? the example should not write at given offset instead at given offset+1.
So my question is:
1) Does the SMSPower example not correct and working only for vram read? (this is my guess also)
2) If the SMSPower work on SMS should it work even on MSX?
3) If on real MSX does work in write is there a emulation bug on openMSX?
Can anyone that have the physical hw available give some light ?
LD E,5 LD A,(0xF663) CP 2 JP NZ,0x406F LD HL,(0xF7F8) LD A,L DI OUT (0x99),A LD A,H NOP NOP NOP OUT (0x98),A EI RET
5 SCREEN 5: VPOKE 0,VPEEK(0): VDP(15)=1 10 DEFINT A-Z 20 GOSUB 20000 30 FORT=0TO255 40 DUMMY=USR(&H4100ORT) 50 NEXT 60 T$=INPUT$(1) 10000 END 20000 CODE$="1E 05 3A 63 F6 FE 02 C2 6F 40 2A F8 F7 7D F3 D3 99 7C 00 00 00 D3 98 FB C9 $$" 20010 AD=&HC000: CNT=0: T=1 20020 V$=MID$(CODE$,T,2) 20030 IF V$="$$" THEN 20060 20040 POKEAD+CNT,VAL("&H"+V$):CNT=CNT+1: T=T+3 20050 GOTO 20020 20060 DEFUSR=AD 20070 RETURN