VRAM access timing
From MSX Game Library
As MSXGL intends to offer the best possible performance to MSX game creators, special attention has been paid to ensure the highest possible speed when accessing the VRAM. But, MSX hardware is so made that it is sometimes possible (depending on the context) to write or read too quickly in the VDP memory and thus to create data corruptions. To create the VDP module we based our VRAM access times on the information available on the net and in particular on the MSX Assembly Page (from MRC user Grauw) and its articles which are references in this field:
The last article gives a table of possible access times for each screen mode for each VDP generation. Thus, the VDP module of MSXgl automatically adjusts its access times to the screen modes chosen in the library configuration (msxgl_config.h) to allow the best possible access times while ensuring the proper functioning of the application.
The problem is that in some situations, we could observe data corruption in a context where the given access times were respected. A tool was then created to verify these theoretical access times with concrete test cases: VATT (for VRAM Access Timing Tester).
The results of these tests showed that the reference data had some limitations. Notably a wrong access time for Screen Mode 3 on MSX1 (TMS9918) or an unexpected effect with screen disabling for non-bitmap modes on MSX2 (V9938/58). These results have yet to be confirmed with other tests, but they have highlighted worst-case scenarios that we need to consider.
The VATT tool highlighted that access times depend on:
- The generation of the VDP,
- The selected screen mode,
- The activation of the screen display,
- The activation of the sprite display (V9938/58),
- The execution of VDP commands in parallel (V9938/58).
Result
Annexe
Reference
Result founded with VATT have been validated on those machines:
- Panasonic FS-A1 (MSX2, Yamaha V9938?, NTSC)
- Philips NMS8250 (MSX2, Yamaha V9938?, PAL)
- Casio PV-7 (MSX1, TMS9918?, NTSC)
- Sony HB-75P (MSX1, Texas Instruments TMS9929, PAL)
- Victor HC-30 (MSX1, Yamaha YM2220, NTSC)
- Yamaha CX5MII (MSX1, Yamaha V9938, PAL)