Monday, November 28, 2011, 11:03
Introduction
The MSX standard provides minimal requirements for a machine to be MSX compatible and therefore bare the MSX logo. For the MSX2 the amount of Video memory (VRAM) is 128 kB in most cases. The standard requires a minimum of 64 kB VRAM. A few MSX2 computers do have this amount of VRAM: Canon V-25, Hitachi MB-H3, Talent TPP-311, Talent TPS-312 and Toshiba HX-23.
64 kB VRAM in MSX-BASIC
With 64 kB VRAM MSX-BASIC has a few limitations. As expected SCREEN 5 and SCREEN 6 will have 2 display pages in stead of 4. This can be verified with the SET PAGE statement. Setting a page above 1 will result in an "Illegal function call" error. However, because of the way the VRAM is accessed, SCREEN 7 and SCREEN 8 are completely absent. Trying to display any of these screens will also result in an "Illegal function call" error.
In SCREEN 7 and SCREEN 8 the VDP accesses the VRAM in a different way. This means that reading from even addresses reads from different physical RAM chips than reading from odd addresses. This way the screen display can be updated much faster. For the Z80 nothing changes. Addressing VRAM is still the same. The VDP does all conversions internally.
Detecting if the MSX2 has 64 kB VRAM
When the MSX logo is displayed a byte will be written to the upper 64 kB VRAM. If reading it returns the same value, the MSX2 has 128 kB VRAM, otherwise it has 64 kB VRAM. This result is reflected in the system RAM. The name of the variable is MODE and the address is $FAFC. Bits 1 and 2 represents the number of available pages for SCREEN 5 and SCREEN 6:
A=PEEK(&HFAFC) AND 6
This value is also used to determine whether or not SCREEN 7 and SCREEN 8 are valid. Some games also use this value to determine the machine is MSX2 or higher, to enable extra features. One game using this is R-Type.
Emulation of 64 kB VRAM
Before 8 March 2011 openMSX couldn't detect the 64 kB VRAM. This is because the VRAM was automatically mirrored in both lower and upper 64 kB VRAM area, so writing to the upper 64 kB would always return the correct value when read.
BlueMSX still has the VRAM mirrored during 64 kB VRAM emulation. Developer Daniel Vik claimed to have noticed this after testing on a real MSX. Strange enough the MSX logo still detects 128 kB VRAM even when 64 kB is selected for the machine.
The mirrored 64 kB VRAM does give funny results when displaying SCREEN 7 or SCREEN 8.
10 COLOR ,0,0:SCREEN 8:COLOR 255
20 OPEN "GRP:" AS #1
30 DRAW "bm8,8":PRINT #1,"Hello world!"
40 GOTO 40
Recorded proof
SapphiRe has recorded a few videos showing a Hitachi MB-H3 with 64 kB VRAM. The first video shows the result of trying to set a few SCREEN modes. The second video shows the result of displaying a page that has no RAM chips:
Test with displaying certain SCREEN modes.
Test with displaying page 2 contents.
Final words
I hope this article clarifies the 64 kB VRAM feature in some MSX2 computers and its limitations in MSX-BASIC. By directly changing VDP registers it's still possible to display the screen modes and pages that are disabled by MSX-BASIC. It's not recommended to change the value at the MODE system variable (address &HFAFC). It contains more than just the number of available pages in SCREEN 5 and SCREEN 6.
add comment
(24090 views)
| permalink