Skip to content

mvac7/SDCC_VDP_TMS9918A_Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VDP TMS9918A MSX SDCC Library (fR3eL Project)

Author: mvac7 [mvac7303b@gmail.com]
Architecture: MSX
Format: C Object (SDCC .rel)
Programming language: C and Z80 assembler

Description

Open Source library with basic functions to work with the TMS9918A/28A/29A video processor.

It does not use the MSX BIOS, so it can be used to develop ROM applications such as MSX-DOS.

Use them for developing MSX applications using Small Device C Compiler (SDCC) cross compiler.

In the source code (\examples), you can find applications for testing and learning purposes.

This library is part of the MSX fR3eL Project.

Enjoy it!

History of versions

  • v1.4 (16 August 2022) Bug#2 (init VRAM addr in V9938) and code optimization
  • v1.3 (23 July 2019) COLOR function improvements
  • v1.2 ( 4 May 2019)
  • v1.1 (25 April 2019)
  • v1.0 (14 February 2014) Initial version

Requirements

Functions

  • void SCREEN(char mode) - Sets the display mode of the screen.
  • void SetSpritesSize(char size) - Set size type for the sprites. (0=8x8; 1=16x16)
  • void SetSpritesZoom(char zoom) - Set zoom type for the sprites. (0=x1; 1=x2)
  • void CLS() - Clear Screen. Fill in 0, all Name Table.
  • void ClearSprites() - Initialises the sprite attribute table.
  • void COLOR(char ink, char BG, char border) - Put the ink, background and foreground colors.
  • void VPOKE(unsigned int VRAMaddr, char value) - Writes a byte to the video RAM.
  • char VPEEK(unsigned int VRAMaddr) - Reads data from the video RAM.
  • void FillVRAM(unsigned int VRAMaddr, unsigned int size, char value) - Fill a large area of the VRAM of the same byte.
  • void CopyToVRAM(unsigned int RAMaddr, unsigned int VRAMaddr, unsigned int size) - Block transfer from memory to VRAM.
  • void CopyFromVRAM(unsigned int VRAMaddr, unsigned int RAMaddr, unsigned int size) - Block transfer from VRAM to memory.
  • void SetVDP(char register, char value) - Writes a value in VDP registers.

Notes about operation

It is important to know that the SCREEN function does not behave exactly like the functions of the BIOS with the same purpose (CHGMOD, INITXT, INIGRP, etc.). SCREEN does not clean the entire VRAM and does not set the patterns from the MSX font in text modes. This function changes to the indicated screen mode, writes to the registers of the VDP the same configuration of the different tables used in the MSX and fill the Name Table and the Sprite attribute table with the value 0 and the Y position for hiding (209).

It is also necessary to know that in the case of graphic mode 2 (screen 2), the table of names will not be initialized, with consecutive values (normally used to display a graphic without the use of repeated tiles).

Due to the fact that the VDP registers can not be consulted, the writing of the values of these has been included in the system variables used by the MSX. In the case of wanting to adapt this library to another computer, they would have to be deleted or placed in the memory area that is available.

The colors of ink and background of the COLOR function are only useful in text mode, since the BIOS uses these values to initialize the color table in the screen startup routines and this library does not. In all other modes it is useful to adjust the border color of the screen.

Documentation

  • Texas Instruments TMS9918A application manual (PDF)
  • Texas Instruments VDP Programmer’s Guide (PDF)
  • Texas Instruments TMS9918A VDP by Sean Young (TXT)
  • 9938 Technical Data Book (PDF) (TXT)
  • 9958 Technical Data Book (PDF)
  • Portar Doc Video Display Processor (WEB)

About

Functions to work with the TMS9918A

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published