MSX2 with 64 kB VRAM 
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 (23887 views)   |  permalink
Detection of FM sound chips 
Tuesday, August 9, 2011, 11:47

Introduction


MSX has some sound chips based on FM synthesis. In this article only the detection of MSX-AUDIO, MSX-MUSIC and MoonSound will be described. These are most used and are based on the same type of FM synthesis, which means they all can be used to produce the same sound with the same data up to a point.

MSX-AUDIO


MSX-AUDIO is built around the Y8950 chip. It's an OPL1 chip with ADPCM record and play capabilities. It's used in the Philips NMS-1205 Music Module, Toshiba HX-MU900 Synthesizer Unit and Panasonic FS-CA1 MSX-AUDIO Module.

On MSX the Y8950 chip can be accessed through one of 2 port ranges: $C0-$C1 or $C2-$C3. The Philips and Toshiba ones can only be accessed through port range $C0-$C1. The Panasonic one can be accessed through either port range. This is because it's capable of selecting the range it should use. If it hasn't detected an MSX-AUDIO yet, it'll set itself up on port range $C0-$C1. Otherwise it'll set itself up on port range $C2-$C3. This way up to 2 MSX-AUDIOs can be used and only if there's at least 1 Panasonic used. It's possible for the Philips and Toshiba ones to be adapted to run on port range $C2-$C3.

Detecting the availability of MSX-AUDIO, read I/O port $C0. If it returns $06, it's MSX-AUDIO. If it returns $00, it's actually MoonSound with port range $C0-$C3 enabled. For information about MoonSound continue reading this article.

MSX-MUSIC


MSX-MUSIC is built around the YM2413 chip. It's an OPLL (a simplified OPL2) chip. Several external variants appeared: FM-PAK (released in Korea and by some Dutch MSX clubs), FM-Stereo-PAK (released by Checkmark, splitting up the MSX-MUSIC melody and rhythm outputs and mixing the latter optionally with the PSG using a seperate input) and the Panasonic SW-M004 FM-PAC (FM Pana Amusement Cartridge). Many MSX2+ and all MSXturboR machines have MSX-MUSIC internally.

On MSX the YM2413 chip can be accessed through port range $7C-$7D. Apart from the FM-PAC it's immediately accessible. When using the FM-PAC, it should be set up first.

Detecting the availability of MSX-MUSIC an identification string should be found. Internal MSX-MUSIC have the string "APRLOPLL" from $4018. External MSX-MUSIC may have different identification strings. However, from $401C the string "OPLL" is required for correct detection. As external MSX-MUSIC may require setting up first (like FM-PAC) a detection method is required.

To successfully detect and set up MSX-MUSIC, parse through all available slots: first check for the "APRLOPLL" string. If this is found, MSX-MUSIC is available and nothing special is required and exit the detection system. Then check for the "OPLL" string. If this is found, set bit 0 of address $7FF6 of the detected slot and exit the detection system.

Emulated MSX-MUSIC


Something that may become more and more of an issue, is MSX-MUSIC emulated by MSX-AUDIO expansions using recent ROM updates. There are 3 identification strings, all from $4018: "AUD1OPLL" for MSX-AUDIO implementation, "AUD3OPLL" for OPL3 cartridge implementation (Brazilian prototype) and "AUD4OPLL" for MoonSound implementation.

These implementations require the FM-BIOS calls to be used to have the sound played through them, which additionally requires knowledge of that system and unnecessary overhead due to interslot calling. If you only want to have real MSX-MUSIC play (simply by using the MSX-MUSIC I/O ports) you'll need to do specific tests for those identification strings. If you don't add them, MSX-MUSIC will be falsely detected and data will be sent to the MSX-MUSIC I/O ports regardless of the chip itself is actually available to produce the sound.

MoonSound


MoonSound is built around the YMF278B chip. It's an OPL4 chip. It's 100% compatible with OPL1, OPL2 and OPL3. It's designed by Henrik Gilvad and released under this name by Stichting Sunrise.

On MSX the YMF278B can be accessed through port range $C4-$C7. On MoonSound v2 it's also possible to have it emulating MSX-AUDIO without the ADPCM, by adjusting JP1 on the MoonSound PCB.

Detecting the availability of MoonSound, read I/O port $C4. If it returns $00 it's MoonSound, regardless the state of JP1.

Final words


Of course it's highly advisable to set a bit or byte for each of the detected sound chips so the program can determine which chip to use. This way it's possible to have a preferred order of use for the program.
add comment (6878 views)   |  permalink
MoonBlaster v1.4 BASIC driver 
Sunday, April 3, 2011, 16:49
Today I've released an update of the MoonBlaster v1.4 BASIC driver. It contains fixes and a few requests. There is no need to use MAP.COM or MAP.BIN anymore.

Changes in this version:
  • adapted error to use BASIC errors
  • added Hertz equalizer, controllable with _MBEQUAL
  • added DOS2 mapper support, controllable with _MBBANK, _MBALLOC and _MBFREE
  • added DOS2 directory support
  • fixed incorrect writes to PSG R#7 bug
  • fixed MSX-MUSIC detection
  • fixed a few other typical internal bugs

Recently Paragon released an updated BASIC driver to fix incorrect writes to PSG R#7. Investigation has turned out this 'fix' can cause unstability when using PSG drums.

The driver can be downloaded from my Home Page or MSX Banzai!.

(April 8, 2011: official assembly source updates are available, fixing the incorrect writes to PSG R#7 bug and MSX-MUSIC detection)
(August 18, 2011: important bug fixed regarding loading files under DOS2. Also a few small fixes in the MBLOADER.SRC file)
4 comments (15330 views)   |  permalink   |  related link
YouTubed 
Sunday, February 20, 2011, 08:55
Yesterday I decided to create a YouTube account. I'm not 100% certain with what kind of videos I will populate it, but I'm sure there will be very interesting ones among them.

Video's uploaded right now (first of all more or less to test, but still interesting nevertheless):

add comment (2468 views)   |  permalink   |  related link
ROMLOAD v1.99v 
Friday, December 24, 2010, 14:29
Today I released a new version of ROMLOAD. New in this version are:
  • Improved /0 implementation
  • Minor tweak in support for MSX-DOS 2 Kernel in a Sound Cartridge
  • Removed /C for Konami without SCC specification. Konami without SCC detection attempt when no conversion switches were given
  • Fixed bug in command line switches parser, some switches could be lower case only
  • Use low speed mode (Z80, 3.58 MHz) for compatibility, unless forced otherwise
  • Fixed small bug in ASCII8 mapper init
  • Added 50Hz/60Hz init /S[:<Hz>]

add comment (4032 views)   |  permalink   |  related link

<<First <Back | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Next> Last>>