Skip to content

mvac7/SDCC_TEXTMODE_MSXROM_Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TEXTMODE MSX ROM Library (fR3eL Project)

Architecture: MSX
Format: C Object (SDCC .rel)
Programming language: C and Z80 assembler


Description

This project is a library of functions for developing text-mode applications.

Supports the following display modes:

  • Text 1 (screen 0, 40 columns)
  • Text 2 (screen 0, 80 columns) Requires MSX with V9938 and BIOS that supports this mode.
  • Graphic 1 (screen 1, 32 columns)

This library uses the functions of the MSX BIOS, so it is designed to create applications in ROM format or binaries on MSX BASIC.

It is designed to develop MSX applications using Small Device C Compiler (SDCC), although it is an opensource project. Feel free to use part or all of it to adapt it to other systems or development environments.

You can access the documentation here with How to use the library.

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

I have adapted a routine for converting a 16 Bits value to ASCII for printing numbers, extracted from the Baze collection (WEB).

This library is part of the MSX fR3eL Project.

Enjoy it!



History of versions:

  • v1.5 (24/02/2024) bchput recovery, add GetColumns, GetCursorRow and GetCursorColumn.
  • v1.4 (24/11/2023) Update to SDCC (4.1.12) Z80 calling conventions, add PrintLN function, remove bchput, and more improvements.
  • v1.3 (05/09/2019) Integer printing functions improved (PrintNumber & PrintFNumber). num2Dec16 becomes PrintFNumber.
  • v1.2 (03/04/2018)
  • v1.1 (27/02/2017)


Requirements



Functions

Function Description
WIDTH(columns) Specifies the number of characters per line in text mode
COLOR(ink, background, border) Specifies the colors of the foreground, background, and border area
SCREEN0() Initialice TEXT 1 (40 columns) or TEXT 2 (80 columns) screen mode
SCREEN1() Initialice GRAPHIC 1 screen mode (32 columns x 24 lines)
CLS() Clear Screen. Fill Pattern Name Table with 0x20 character
LOCATE(column, line) Moves the cursor to the specified location
PRINT(text) Displays a text string at the current cursor position
PrintLN(text) Displays a text string at the current cursor position and adds a new line
PrintNumber(number) Displays an unsigned integer at the current cursor position
PrintFNumber(number, emptyChar, length) Displays an unsigned integer with formatting parameters, at the current cursor position
bchput(character) Displays one character
GetColumns() Provides the columns from current screen
GetCursorRow() Provides the current row-position of the cursor
GetCursorColumn() Provides the current column-position of the cursor


Code Example

In the git project examples/, you can find the source code of applications for testing and learning purposes.


ExampleROM

Simple example of the use of the library (used in the documentation).

examples/forDoc

Example screenshot


TestLib

Test the library functions in Text 1 (Screen 0 with 40 columns) and GRAPHIC 1 (Screen 1) modes of the TMS9918A.

examples/testLib

Example screenshot


Test80c

Test the library functions in Text 2 mode (Screen 0 with 80 columns) of V9938 or higher.

examples/test80c

Example screenshot

About

Functions for starting and printing in text modes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published