Main-ROM BIOS
This page was last modified 10:59, 17 October 2018 by Gdx. Based on work by ARTRAG.

Contents

Main BIOS (Basic Input/Output System)

The main BIOS is a set of routines designed to allow the programmer to access to the hardware without it being always the same. The Bios is composed of routines in ROM which mainly allow to access in the same way to more or less different devices.

0000h (STARTUP) (called CHKRAM at first)

Function: Initializes the MSX. (Search for memory, initialization of system variables, etc.)
Entry: None
Output: None
Modify: All Registers
Notes: This routine is the first to be executed when the MSX is switched on. Here is a summary of what the routine does.

MSX1:

  • The Main-ROM is placed on the memory banks 0000h~3FFFh and 4000h~7FFFh.
  • The routine looks for the RAM in the Primary Slots from 0 to 3 on the memory banks 8000h~BFFF and C000h~FFFFh. If a Primary Slot is expanded, it looks in Secondary Slots from 0 to 3 before moving on to the next Primary Slot. Thus the routine selects the first RAM that it finds on each bank without taking into account the Memory Mapper.
  • Initializes the work area, variables and Hooks.
  • Look for a possible Rom in the primary Slots from 0 to 3 on the memory banks 4000h~7FFF and 8000h~BFFFh to execute it. (When a Rom is found on the bank 4000h~7FFFh, the 8000h~BFFFh bank will contain main RAM if the MSX has 32kB or higher. When a Rom is found on the bank 8000h~BFFFh, the bank 4000h~7FFFh will contain the Main-ROM).
  • Replace the Main-ROM on the bank 4000h~7FFFh and start the Basic.

MSX2:

  • Proceed in the same way as the MSX1 except that the Memory Mapper registers are initialized as described in the page on the Memory Mapper.

MSX2+:

  • Same as MSX2 except that the routine takes into account whether it is about starting the computer or rebooting. In the second case, the MSX logo will not be displayed. (Bit 5 of I/O port F4h is used for this.)

MSX Turbo R:

  • Same as MSX2+ except that the internal RAM will be automatically selected as main Ram in R800 mode because the internal RAM is clocked at 7.159 MHz instead of 3.5795 for the extensions.

Slots and Basic interpreter

0008h (SYNCHR)

Function: Compares whether the character pointed by HL with thespecified character behind RST 8. If same, it executs theroutine CHRGTR (4666h, not 0010h), otherwise it executs theroutine of error treatment of Basic interpreter.
Entry: HL = Address of character to compareComparison character must be behind RST 8 instruction.

Example:

	ld	hl,LETTER
	rst	08h
	db	"A"
	rst	08h
	db	"B"
	ret
LETTER: db	"AB"
Output: HL is increased by one and A receives [HL]. When the testedcharacter is numerical, the CY flag is set; the end of thestatement 00H or 3Ah) causes the Z flag to be set.
Modify: AF, HL

000Ch (RDSLT)

Function: Reads one byte from memory of the slot specified.
Entry: A = Slot ID to read (F000EEPP format)
HL = Address of byte to read (from 0000h to BFFFh)
Output: A = Byte read
Modify: AF, BC, DE
Note: This routine disables the interrupts.

0010h (CHRGTR)

Function: Gets a character (or a token) from BASIC text
Entry: HL = Address of the character to be read (pointer)
Output: HL = HL incremented by one
A = New character pointed by HL
F = When the character is numerical, the CY flag is set; The instruction end (00h or ":") sets the Z flag.
Modify: AF, HL
Notes:
  • This routine skips the spacing codes (020h).
  • Call the hook H.CHRG (0FF48h).

0014h (WRSLT)

Function: Writes one byte to memory of the slot specified.
Entry: A = Slot ID
E = Byte to write
HL = Writing address (from 0000h to BFFFh)
Output: None
Modify: AF, BC, D
Notes:
  • This routine disables the interrupts.
  • Call the hook H.OUTD (0FEE4h).

0018h (OUTDO)

Function: Sends one character to current device.
Entry: A = Character to sent.
PRTFLG (0F416h) = Must be different from zero to sends output to the printer or disk.
PTRFIL (0F864h) = Address of data file to sends the character. If 0000h, the character is sent to printer.
Output: None
Modify: None
Note: Call the Hook H.OUTD (0FEE4h).

001Ch (CALSLT)

Function: Calls the routine in another slot (inter-slot call)
Entry: IX = Address to call
IY = Slot ID
Output: Depends on the calling routine.
Modify: AF, IX, IY, auxiliary registers, and other registers depending on thecalling routine
Notes:
  • Interrupts are disabled by the routine.
  • Can not call another extended slot of the same primary slot where the Bios is located.
  • This routine also exists under MSX-DOS.

0020h (DCOMPR)

Function: Compares the contents of HL and DE
Entry: HL, DE
Output: F = Sets the Z flag if HL = DE; CY flag if HL < DE
Modify: AF

0024h (ENASLT)

Function: Selects the specified slot.
Entry: HL = Bank to select the slot
A = Slot ID to select
Output: None
Modify: All Registers
Notes:
  • Unlike the RDSLT, WRSLT and CALSLT routines, the Primary Slot switching is performed directly in page 0, thus, addresses in page 0 (0000H to 3FFFh) will cause system crash.
  • This routine also exists under MSX-DOS, where it will work also for page 0, with the sole limit that it cannot call another extended slot of the same primary slot where the Bios is located.
  • This routine disables the interrupts.
Example:
; Back to Basic from MSX-DOS 

MNROM	equ	0FCC1h
ENASLT 	equ	00024h
RETURN	equ	0409Bh

	org	0D000h
DEBUT:
	ld	a,(MNROM)
	ld	hl,0
	call	ENASLT	; Select main Rom on bank 0
	ld	a,(MNROM)
	ld	hl,04000h
	call	ENASLT	; Select main Rom on bank 1
	jp	RETURN	; 

0028h (GETYPR)

Function: Returns the type of DAC (decimal accumulator).
Entry: None.
Output: F = S, Z, P/V flags are changed depending on the type of DAC:
integer type			single precision real type
   C = 1				C = 1
   S = 1 *				S = 0
   Z = 0				Z = 0
   P/V = 1				P/V = 0 *
   
string type			double precision real type
   C = 1				C = 0 *
   S = 0				S = 0
   Z = 1 *				Z = 0
   P/V = 1				P/V = 1
Types can be recognised by the flag marked by "*".
Modify: AF
Note: The Main-Rom must be selected in the bank 4000h~7FFFh to call this routine.

0030h (CALLF)

Function: Calls the routine in another slot.
Entry: Calling sequence:
	RST	30H
	DB	n	;n is the slot number (same as RDSLT)
	DW	nn	;nn is the called address
Output: Depends on the calling routine
Modify: AF, IX, IY, auxiliary registers, and other registers depending on thecalling routine
Notes:
  • Interrupts are disabled by the routine.
  • Can not call another extended slot of the same primary slot where the Bios is located.
  • This routine also exists under MSX-DOS.

0038h (KEYINT)

Function: Interrupt process routine.
Entry: None
Output: None
Notes:
  • This routine is called at each interruption.
  • Calls Hooks H.KEYI (0FD9Ah) and H.TIMI (0FD9Fh).
  • Sub-ROM call for Roma-Kana conversions on Japanese MSX2 or later.

003Bh (INITIO)

Function: Initialises the devices.
Entry: None
Output: None
Modify: All Registers

VDP

003Eh (INIFNK)

Function: Initialises the contents of function keys
Entry: None
Output: None
Modify: All Registers
Note: VDP access.

0041h (DISSCR)

Function: Inhibits the screen display
Entry: None
Output: None
Modify: AF, BC

0044h (ENASCR)

Function: Displays the screen
Entry: None
Output: None
Modify: AF, BC

0047h (WRTVDP)

Function: Writes data in the VDP register
Entry: C = Register number (0~7 on MSX1; 0~23, 32~46 on MSX2; 0~25, 32~46 on MSX2+/Turbo R)
B = value to write
Output: None
Modify: AF, B
Note: Call Sub-ROM on MSX2 or later if the bit EV of VDP register 0 is changed or if register number is greater than 7.

004Ah (RDVRM)

Function: Reads the contents of VRAM.
Entry: HL = VRAM address to read (00000h~03FFFh)
Output: A = Value read at VRAM address
Modify: AF
Note: Routine for MSX1, so only the 14 low order bits of the VRAM address are valid. To use all bits, call NRDVRM (00174h).

004Dh (WRTVRM)

Function: Writes a data in VRAM.
Entry: HL = VRAM address to write data (00000h~03FFFh)
A = Data
Output: None
Modify: None
Note: Routine for MSX1, so only the 14 low order bits of the VRAM address are valid. To use all bits, call NWRVRM (00177h).

0050h (SETRD)

Function: Sets VRAM address to read a byte or more. This isused to read data from the sequential VRAM area by using the address auto-increment function of VDP. This enables faster readout than using RDVRM in a loop.
Entry: HL = VRAM address (00000h~03FFFh)
Output: None
Modify: AF
Note: Routine for MSX1, so only the 14 low order bits of the VRAM address are valid. To use all bits, call NSETRD (0016Eh).
Example:
;Read 4 bytes from VRAM

VDP.DR	equ	0006h

	ld	hl,0		;VRAM address
	call	SETWRT

	ld	hl,DATA
	ld	b,7		;Text length
	ld	a,(VDP.DR)	;Data read port
	ld	c,a
LOOP:
	ini			;You can replace this two
	jr	nz,LOOP		;lines with inir on MSX2/2+/turbo R
	ret
DATA:
	db	0,0,0,0		;Data read from VRAM are stored here

0053h (SETWRT)

Function: Sets VRAM address to write or more. The purpose is the same as SETRD.
Entry: HL for VRAM address (00000h~03FFFh)
Output: None
Modify: AF
Note: Routine for MSX1, so only the 14 low order bits of the VRAM address are valid. To use all bits, call NSTWRT (00171h).
Example:
;Print "Hello!" at the top left of the screen (SCREEN1)

VDP.DW	equ	0007h

	ld	hl,(T32NAM)	;Characters table address in SCREEN1
	call	SETWRT

	ld	hl,TXT
	ld	b,7		;Text length
	ld	a,(VDP.DW)	;Data write port
	ld	c,a
HELLO:
	outi			;You can replace this two
	jr	nz,HELLO	;lines with otir on MSX2/2+/turbo R
	ret
TXT:
	db	"Hello!"

0056h (FILVRM)

Function: fills the specified VRAM area with the same data.
Entry: HL = VRAM address to begin writing
BC = The length of the area to be written
A = Data
Output: None
Modify: AF, BC
Note: Routine for MSX1, so only the 14 low order bits of the VRAM address are valid. To use all bits, call BIGFIL (0016Bh).

0059h (LDIRMV)

Function: block transfer from VRAM to memory
Entry: HL = Source address in VRAM (00000h~03FFFh ou 0FFFFh)
DE = Destination address in main Ram (00000h~0FFFFh)
BC = Length (00000h~0FFFFh).
Output: None
Modify: All Registers
Note: In screen modes other than MSX1. The variable ACPAGE (0FAF6h) indicates the page from which the transfer must take place.

005Ch (LDIRVM)

Function: block transfer from memory to VRAM
Entry: HL = Source address in Ram (00000h~0FFFFh)
DE = Destination address in VRAM (00000h~03FFFh ou 0FFFFh)
BC = Length (00000h~0FFFFh)
Output: None
Modify: All Registers
Note: In screen modes other than MSX1. The variable ACPAGE (0FAF6h) indicates the page from which the transfer must take place.

005Fh (CHGMOD)

Function: Changes the screen mode. The palette is not initialised. Toinitialise it, see CHGMDP in SUB-ROM.
Entry: A = Screen mode (0~3, 0~8 or 0~8/12, 9 Korean MSX2 only)
Output: None
Modify: All Registers
Note: Colors palette is not initialized by this routine, call the routine CHGMDP (001B5h in Sub-ROM) if you need to initialize the palette.

0062h (CHGCLR)

Function: Changes the colours of screen
Entry: A = Screen mode
FORCLR (F3E9h) = foreground color
BAKCLR (F3EAh) = background color
BDRCLR (F3EBh) = border colour
Output: None
Modify: All Registers
Note: Same function as CHGCLR (00111h in Sub-ROM)

0066h (NMI)

Function: NMI (Non-Maskable Interrupt) handling routine
Entry: None
Output: None
Modify: ?
Note: This routine is used at start on MSX turbo R only.

0069h (CLRSPR)

Function: Initialises all sprites. The sprite patterns are cleared to null, the sprite number to the sprite plane number, the sprites colour define with FORCLR (0F3E9h). The vertical ordinate of sprites are set to 209 (screen mode 0 to 3) or 217 (mode 4 to 8).
Entry: None
Output: None
Modify: All Registers

006Ch (INITXT)

Function: Initialises the screen to TEXT1 mode (40 x 24). In thisRoutine, the palette is not initialised. To initialise thepalette, call INIPLT in SUB-ROM after this call.
Entry: TXTNAM (F3B3h) = Address of pattern name table
TXTCGP (F3B7h) = Address of pattern generator table
LINL40 (F3AEh) = Character per line
FORCLR (0F3E9h) = Text color
BAKCLR (0F3EAh) = Background color
BDRCLR (F3EBh) = Border colour
Output: None
Modify: All Registers
Note: The palette is not initialized by this routine. If you want to initialize the palette, call the routine INIPLT (00141h) in Sub-ROM just after this one.

006Fh (INIT32)

Function: Initialises the screen to GRAPHIC1 mode (32x24). In thisRoutine, the palette is not initialised.
Entry: T32NAM (F3BDh) = Address of pattern name table
T32COL (F3BFh) = Address of colors table
T32CGP (F3C1h) = Address of pattern generator table
T32ATR (F3C3h) = Address of sprite attribute table
T32PAT (F3C5h) = Address of sprite generator table
FORCLR (0F3E9h) = Text color
BAKCLR (0F3EAh) = Background color
BDRCLR (0F3EBh) = Border color
Output: None
Modify: All Registers
Note: The palette is not initialized by this routine. If you want to initialize the palette, call the routine INIPLT (00141h) in Sub-ROM just after this one.

0072h (INIGRP)

Function: Initialises the screen to the high-resolution graphics mode.In this routine, the palette is not initialised.
Entry: GRPNAM (F3C7h) = Address of pattern name table
GRPCOL (F3C9h) = Address of colors table
GRPCGP (F3CBh) = Address of pattern generator table
GRPATR (F3CDh) = Address of sprite attribute table
GRPPAT (F3CFh) = Address of sprite generator table
FORCLR (0F3E9h) = Text color
BAKCLR (0F3EAh) = Background color
BDRCLR (0F3EBh) = Border color
Output: None
Modify: All Registers
Note: The palette is not initialized by this routine. If you want to initialize the palette, call the routine INIPLT (00141h) in Sub-ROM just after this one.

0075h (INIMLT)

Function: Initialises the screen to MULTI colour mode. In this routine,the palette is not initialised.
Entry: MLTNAM (F3D1h) = Address of pattern name table
MLTCOL (F3D3h) = Address of colors table
MLTCGP (F3D5h) = Address of pattern generator table
MLTATR (F3D7h) = Address of sprite attribute table
MLTPAT (F3D9h) = Address of sprite generator table
FORCLR (0F3E9h) = Text color
BAKCLR (0F3EAh) = Background color
BDRCLR (0F3EBh) = Border color
Output: None
Modify: All Registers
Note: The palette is not initialized by this routine. If you want to initialize the palette, call the routine INIPLT (00141h) in Sub-ROM just after this one.

0078h (SETTXT)

Function: Set only VDP in TEXT1 mode (40x24, SCREEN0) without initializing the tables.
Entry: TXTNAM (0F3B3h) = Address of pattern table
TXTCGP (0F3B7h) = Address of the shape table.
Output: None
Modify: All Registers
Note: same as INITXT

007Bh (SETT32)

Function: Set only VDP in GRAPHIC1 mode (32x24, SCREEN1) without initializing the tables.
Entry: T32NAM (F3BDh) = Address of pattern name table
T32COL (F3BFh) = Address of colors table
T32CGP (F3C1h) = Address of pattern generator table
T32ATR (F3C3h) = Address of sprite attribute table
T32PAT (F3C5h) = Address of sprite generator table
Entry: same as INIT32
Output: None
Modify: All Registers

007Eh (SETGRP)

Function: Set only VDP in GRAPHIC2 mode (SCREEN2) without initializing the tables.
Entry: GRPNAM (F3C7h) = Address of pattern name table
GRPCOL (F3C9h) = Address of colors table
GRPCGP (F3CBh) = Address of pattern generator table
GRPATR (F3CDh) = Address of sprite attribute table
GRPPAT (F3CFh) = Address of sprite generator table
Output: None
Modify: All Registers

0081h (SETMLT)

Function: Set only VDP in MULTI colour mode (SCREEN3) without initializing the tables.
Entry: MLTNAM (F3D1h) = Address of pattern name table
MLTCOL (F3D3h) = Address of colors table
MLTCGP (F3D5h) = Address of pattern generator table
MLTATR (F3D7h) = Address of sprite attribute table
MLTPAT (F3D9h) = Address of sprite generator table
Output: None
Modify: All Registers

0084h (CALPAT)

Funtion: Returns the address of sprite generator table.
Entry: A = Sprite number
Output: HL = Address
Modify: AF, DE, HL

0087h (CALATR)

Function: Returns the address of sprite attribute table.
Entry: A = Sprite number
Output: HL = Address
Modify: AF, DE, HL

008Ah (GSPSIZ)

Function: Returns the current sprite size.
Entry: None
Output: A = Sprite size (8 when 16 x 16, 8 when 8 x 8)
F = CY flag is set when the size is 16 x 16, otherwise reset.
Modify: AF

008Dh (GRPPRT)

Function: Displays a character on the graphic screen.
Entry: A = Character code to display.
CLOC (0F92Ah) = In SCREEN 2 to 4 and 10 to 12, address where is the graphical cursor in VRAM. In SCREEN 5 to 8, the current abscissa of the graphical cursor.
CMASK (0F92Ch) = In SCREEN 2 to 4 and 10 to 12, mask to apply. In SCREEN 5 to 8, current ordinate of the graphical cursor.
LOGOPR (FB02h) = Logical operation code (for graphic modes of SCREEN 5 to 12).
Output: None
Modify: None
Note: Call to the sub-ROM if the screen mode is higher than SCREEN 4.

PSG

0090h (GICINI)

Function: Initialises PSG and sets the initial value for the PLAY instruction.
Entry: None
Output: None
Modify: All Registers
Notes:
  • Interrupts must be disabled to call this routine.
  • After initialization, the registers will have the following values.
R#0 = 01010101	R#1 = 00000000	 R#2 = 00000000
R#3 = 00000000	R#4 = 00000000	 R#5 = 00000000
R#6 = 00000000	R#7 = 10111000	 R#8 = 00000000
R#9 = 00000000	R#10 = 00000000	 R#11 = 00001011
R#12 = 00000000	R#13 = 00000000

0093h (WRTPSG)

Function: Writes data in the PSG register
Entry: A = PSG register number (0~15)
E = Parameter
Output: None
Modify: None
Notes:
  • See page on PSG for more details on the registers.
  • The interrupts are disabled then enabled again by the routine.

0096h (RDPSG)

Function: Reads the PSG register value
Entry: A = PSG register number
Output: A = Value read
Modify: None
Notes:
  • See page on PSG for more details on the registers.
  • The interrupts are not disabled by the routine.

0099h (STRTMS)

Function: Plays the MML for the instruction PLAY in background.
Entry: None
Output: None
Modify: All Registers
Note: Do not play if a MML is already playing.

Keyboard, CRT, printer input-output

009Ch (CHSNS)

Function: Update the function key display then tests the status of the keyboard buffer.
Entry: None
Output: F = Z flag is set when the buffer is empty, otherwise Z is reset.
Modify: AF

009Fh (CHGET)

Function: Wait one character input
Entry: None
Output: A = Code of the input character
Modify: AF
Notes:
  • Calls the hook H.CHGE (0FDC2h).
  • The variables SCNCNT (0F3F7h) and REPCNT (0F3F7h) are used to set the scanning intervals of the keyboard.

00A2h (CHPUT)

Function: Displays a character
Entry: A = Character code to display
Output: None
Modify: None
Note: Calls the hook H.CHPU (0FDA4h).

00A5h (LPTOUT)

Function: Sends one character to the printer
Entry: A = Character code to send
Output: F = CY flag is set if the routine was interrupted by a CTRL+STOP
Modify: F
Notes:
  • Calls the hook H.LPTO (0FFB6h).
  • CTRL+STOP allows you to exit the routine if there is a problem with the printer.

00A8h (LPTSTT)

Function: Tests the printer status.
Entry: None
Output: A = 255 and the Z flag is reset when the printer is ready. A = 0 and the Z flag is set when not ready.
Modify: AF

00ABh (CNVCHR)

Function: Allows to manage the characters obtained with routine CHGET (0009Fh) for a possible conversion of the extended graphic characters.
Entry: A = Code of a character or 1 to announce an extended graphic character
Output: GRPHED (0FCA6h) is set when the entered code is 1
F = CY flag is reset if graphic header, the CY flag and the Z flag are set when the code is an extended graphic character, the CY flag is set and the Z flag is reset when code is set in A is an ordinary character.
Modify: AF
Notes:
  • GRPHED (0FCA6h) is taken into account to indicate whether it is an extended graphic character (between 65 and 95) or not.
  • See MSX font for detail on extended graphic characters.

00AEh (PINLIN)

Function: Stores in the buffer BUF (0F55Eh) the character codes input until the RETURN key or STOP is pressed then place the cursor on the next line.
Entry: None
Output: HL = 0F55Eh
F = CY flag is set only when it ends with the STOP key
BUF (0F55Eh) contains the characters entered on the keyboard
LINTTB (0FBB2h) is updated.
Notes:
  • End of line is indicated by the code 00h
  • Calls to Hook H.PINL (0FDDBh).
  • If AUTFLG (0F6AAh) is set, calls the routine INLIN (000B1h) instead.
Modify: All Registers

00B1h (INLIN)

Function: Stores in the buffer BUF (0F55Eh) the character codes input until the RETURN key or STOP is pressed.
Entry: None
Output: HL = 0F55Eh
F = CY flag is set only when it ends with the STOP key
BUF (0F55Eh) contains the characters entered on the keyboard
LINTTB (0FBB2h) is updated.
Modify: All Registers
Notes:
  • Calls to Hook H.INLI (0FDE5h).
  • Compared to PINLIN, this routine takes into account that the characters placed behind cursor. The prompt is usable.

00B4h (QINLIN)

Function: Executes INLIN with displaying "?" and one space
Entry: None
Output: HL = Starting address of the buffer minus 1, the CYflag is set only when it ends with the STOP key.
Modify: All Registers

00B7h (BREAKX)

Function: Tests Ctrl-STOP key. In this routine, interrupts areinhibited.
Entry: None
Output: F = CY flag is set when pressed
Modify: AF

00C0h (BEEP)

Function: Generates a beep sound
Entry: None
Output: None
Modify: All Registers

00C3h (CLS)

Function: Clears the screen
Entry: F = Z flag must be set
Output: None
Modify: AF, BC, DE

00C6h (POSIT)

Function: Moves the cursor
Entry: H = X-coordinate of the cursor, L for the Y-coordinate
Output: None
Modify: AF

00C9h (FNKSB)

Function: Tests whether the function key display is active (FNKFLG). If so, displays them, otherwise erases them.
Entry: FNKFLG (FBCEh)
Output: None
Modify: All Registers

00CCh (ERAFNK)

Function: Erases the function key display
Entry: None
Output: None
Modify: All Registers

00CFh (DSPFNK)

Function: Displays the function keys
Entry: None
Output: None
Modify: All Registers

00D2h (TOTEXT)

Function: Forces the screen to be in the text mode
Entry: None
Output: None
Modify: All Registers

Game controllers, Mouse, Touch pad I/O access

00D5h (GTSTCK)

Function: Returns the joystick status
Entry: A for the joystick number to be tested
Output: A for the joystick direction
Modify: All Registers

(00D8H GTTRIG)

Function: Returns the trigger button status
Entry: A = Trigger button to test
Output: A = 0 if the trigger button is not pressed, FFH when pressed.
Modify: AF

00DBh (GTPAD)

Function: Returns the touch pad status
Entry: A = Touch pad number to test
Output: A for the value
Modify: All Registers

00DEh (GTPDL)

Function: Returns the paddle value
Entry: A = Paddle number
Output: A = Paddle value
Modify: All Registers

Cassette input-output routine

00E1h (TAPION)

Function: Reads the header block after turning the cassette motor ON.
Entry: None
Output: F = CY flag is set if failed
Modify: All Registers

00E4h (TAPIN)

Function: Reads data from the tape
Entry: None
Output: A = Read data.
F = CY flag is set if failed.
Modify: All Registers

00E7h (TAPIOF)

Function: Stops reading the tape
Entry: None
Output: None
Modify: None

00EAh (TAPOON)

Function: Writes the header block after turning the cassette motor ON
Entry: A = 0 for short header, otherwise long header
Output: F = CY flag is set if failed
Modify: All Registers

00EDh (TAPOUT)

Function: Writes data on the tape
Entry: A = Written data
Output: F = CY flag is set if failed
Modify: All Registers

00F0h (TAPOOF)

Function: Stops writing to the tape
Entry: A for data
Output: F = CY flag is set if failed
Modify: All Registers

00F3h (STMOTR)

Function: Sets the cassette motor action
Entry: A = 0 for stop, 1 for start and 0FFH for reverse the current action
Output: None
Modify: AF

Miscellaneous

0132h (CHGCAP)

Function: Alternates the CAP LED status
Entry: A = 0 for LED off, otherwise LED goes on
Output: None
Modify: AF

0135h (CHGSND)

Function: Alternates the 1-bit sound port status
Entry: A = 0 for OFF, otherwise ON
Output: None
Modify: AF

0138h (RSLREG)

Function: Reads the contents of current output to the basic slot register
Entry: None
Output: A = Value read
Modify: A

013Bh (WSLREG)

Function: Writes to the primary slot register
Entry: A = value to write
Output: None
Modify: None

013Eh (RDVDP)

Function: Reads VDP status register
Entry: None
Output: A = Value read
Modify: A

0141h (SNSMAT)

Function: Reads the value of the specified line from the keyboard matrix
Entry: A = specified line
Output: A for data (the bit corresponding to the pressed key willbe 0)
Modify: AF, C

0144h (PHYDIO)

Function: Physical input/output for disk devices
Entry: A = drive number 0 = A:, 1 = B:,...)
B = number of sector to be read from or written to
C = media ID
DE = first sector number to be read rom or written to
HL = starting address of the RAM buffer to be read from or written to specified sectors
F = CY set/reset for sector writing/reading
Output: F = CY set if failed
B = Number of sectors actually read or written
A = Error code (only if CY set):
0 = Write protected
2 = Not ready
4 = Data error
6 = Seek error
8 = Record not found
10 = Write error
12 = Bad parameter
14 = Out of memory
16 = Other error
Modify: All Registers

014Ah (ISFLIO)

Function: Tests whether the device is active
Entry: None
Output: A = 0 for active, otherwise inactive
Modify: AF

014Dh (OUTDLP)

Function: printer output.Different from LPTOUT in the following points:
1. TAB is expanded to spaces
2. For non-MSX printers, hiragana is transformed to katakana and graphic characters are transformed to 1-byte characters.
3. If failed, device I/O error occurs.
Entry: A for data
Output: None
Modify: F

0156h (KILBUF)

Function: Clears the keyboard buffer
Entry: None
Output: None
Modify: HL

0159h (CALBAS)

Function: Executes inter-slot call to the routine in BASIC interpreter
Entry: IX for the calling address
Output: Depends on the called routine
Modify: Depends on the called routine

Entries appended since MSX2

SUB-ROM

015Ch (SUBROM)

Function: Executes inter-slot call to SUB-ROM
Entry: IX for the calling address and, at the same time, pushes IXon the stack
Output: Depends on the called routine
Modify: Background registers and IY are reserved

015Fh (EXTROM)

Function: Executes inter-slot call to SUB-ROM
Entry: IX for the calling address
Output: Depends on the called routine
Modify: Background registers and IY are reserved

VDP

0168h (EOL)

Function: Deletes to the end of the line
Entry: H for X-coordinate of the cursor, L for Y-coordinate
Output: None
Modify: All Registers

016Bh (BIGFIL)

Function: Same function as FILVRM. Differences are as follows: In FILVRM, it is tested whether the screen mode is 0 to 3. If so, it treats VDP as the one which has only 16K bytes VRAM (for the compatibility with MSX1). In BIGFIL, the mode is not tested and actions are carried out by the given parameters.
Entry: same as FILVRM
Output: same as FILVRM
Modify: same as FILVRM

016Eh (NSETRD)

Function: Enables VRAM to be read by setting the address
Entry: HL for VRAM address
Output: None
Modify: AF

0171h (NSTWRT)

Function: Enables VRAM to be written by setting the address
Entry: HL for VRAM address
Output: None
Modify: AF

0174h (NRDVRM)

Function: Reads the contents of VRAM
Entry: HL for VRAM address to be read
Output: A for the value which was read
Modify: F

0177h (NWRVRM)

Function: Writes data in VRAM
Entry: HL for VRAM address, A for data
Output: None
Modify: AF

Entries appended since MSX2+

Reset

017Ah (RDRES)

Function: Read the status of system initialization
Entry: None
Output: A = Parameters
x 0 x 0 0 0 0 0
|   |
|   1 if the system has already initialized. (MSX turbo R)
|
This bit is reset when a hard reset is performed then set
during the hard reset.    
Modify: AF
Note: Must be used by the system only.

017Dh (WRRES)

Function: Modify the flags that indicates the status of system initialization
Entry: A = Parameters
x 0 x 0 0 0 0 0
|   |
|   Remains set until a hard reset. (MSX turbo R)
|
This bit is reset when a hard reset is performed then set
during the hard reset. Must not be changed by the user.
Output: None
Modify: AF
Note: Must be used by the system only.

Entries appended since MSX turbo R

CPU

0180h (CHGCPU)

Function: Changes CPU mode
Entry: A = CPU mode and LED control.
 LED 0 0 0 0 0 x x
  |            0 0 = Z80 mode (with ROM)
  |            0 1 = R800 mode with ROM
  +----------- 1 0 = R800 mode with RAM
Output: None
Modify: None
Notes:
  • LED indicates whether the Turbo LED is switched with the CPU.
  • The system Roms (Main-ROM, Sub-ROM and Kanji Driver ROM) are replaced by their copy in RAM keeping the same slots in R800 mode with RAM write-protected. This mode speeds up the execution of programs, but it loses the last four pages of the Memory Mapper to the user.
  • The CPU can be switched at any time from Z80A to R800 mode with ROM and vice versa. However, the switch to R800 mode with RAM must be done preferably at the start of the MSX only.
  • Using the R800 under MSX-DOS1 can damage the files being manipulated.

0183h (GETCPU)

Function: Returns current CPU mode
Entry: None
Output: A = 0 for Z80 mode, 1 for R800 mode with ROM, and 2 for R800 mode with RAM
Modify: AF

PCM

0186h (PCMPLY)

Function: Plays specified memory area through the PCM chip
Entry: A = Parameters
 v 0 0 0 0 0 x x
 |           | |
 |           +-+-- Quality parameter (00 = 15,75kHz ;
 |                 01 =7,875kHz ; 10 = 5,25kHz et 11 = 3,9375kHz)
 +---------------- VRAM usage flag

BC = Length of area to play
E = Most signifiant 3 bits of the address when using VRAM
HL= Start address in RAM or VRAM

Output: A = 1 if the sampling frequency is wrong, 2 when aborted with CTRL-STOP
F = CY flag is set if the reading went off normally
E = Most signifiant 3 bits of VRAM address when aborted with CTRL-STOP
HL = Address when aborted with CTRL-STOP.
Modify: All registers
Notes:
  • This routine always uses the R800. If the Z80A is used when calling this routine, the R800 mode with ROM will be used and will then replace the Z80A before give bak hand.
  • Interruptions are disabled while this routine is running.

0189h (PCMREC)

Function: Records audio using the PCM chip into the specified memory area
Entry: A = PCM parameters
 v t t t t c x x
 | | | | | | | |
 | | | | | | +-+-- Quality parameter (00 = 15,75kHz ;
 | | | | | |       01 =7,875kHz ; 10 = 5,25kHz et 11 = 3,9375kHz)
 | | | | | +------ Zero-data compression
 | +-+-+-+-------- Treshold
 +---------------- VRAM usage flag
 

BC = Length of area to play
D = Bit 0 = Bit 17 of area length when using VRAM
E = Bit 0 = Bit 17 os start address when using VRAM
HL = Start address in RAM or VRAM

Output: A = 1 if the sampling frequency is wrong, 2 when aborted with CTRL-STOP
F = CY flag is set if the recording went off normally
E = Most signifiant 3 bits of the address when aborted with CTRL-STOP. (VRAM)
HL = Address when aborted with CTRL-STOP.
Modify: All registers
Notes:
  • This routine always uses the R800. If the Z80A is used when calling this routine, the R800 mode with ROM will be used and will then replace the Z80A before give bak hand.
  • Interruptions are disabled while this routine is running.
  • Recording at 15.75kHz in R800 mode with ROM causes an error (CY is reset).
  • Press the STOP key to interrupt a recording.

Links