MSX DIAGNOSTICS - API Reference
Technical Documentation for Developers (Open Source)
FUNCTION_MAIN
Main entry point after boot. Initializes the engine, system, displays the welcome screen, and launches the main menu.
FUNCTION_EXIT
Emergency exit routine. Clears the screen, shows a reboot message, and executes a software reset (CHKRAM).
FUNCTION_SYSTEM_START
Boot orchestrator. Executes POST, detects memory configuration, VDP, initializes keyboard and state variables.
FUNCTION_SYSTEM_POST
Visual and audible Power On Self Test. Blinks the CAPS LED and beeps to confirm CPU activity.
FUNCTION_SYSTEM_RESET_KEYBOARD_MATRIX
Clears the logical keyboard state variables (SYSKEY_*).
FUNCTION_SYSTEM_SET_KEY_NAMES_TABLE
Detects the MSX region (BIOS $002C) and selects the appropriate key name table.
FUNCTION_SYSTEM_HID_READ
Reads Keyboard and Joysticks, unifying the input into abstract logical variables.
FUNCTION_SYSTEM_SCREEN0_CHARSET
Loads a custom character set for SCREEN 0 mode into VRAM.
FUNCTION_WELCOME
Displays the title/logo screen, waits for a timer or key press to continue.
FUNCTION_MEMORY_GET_CONFIG
Master function. Sequentially calls Slot detection and then RAM detection.
FUNCTION_MEMORY_GET_SLOT_LAYOUT
Iterates through the 4 primary slots to detect expansion (reading $FCC1).
FUNCTION_MEMORY_GET_MEMORY_LAYOUT
Iterates Slots (0-3) and Subslots (0-3) calling RAM detection for each combination.
FUNCION_MEMORY_GET_SLOT_RAM
Searches RAM in the current slot. Checks pages 0-2 (no mapper) and page 3. If 64KB found, looks for Mapper.
FUNCION_MEMORY_GET_RAM_IN_MAPPER
Detects Memory Mapper by writing to port $FC and verifying segment isolation.
FUNCTION_MEMORY_COUNTER_ADD_4KB
Adds 4KB to the global and local detected RAM counters.
FUNCTION_VDP_INDENTIFY_VDP_TYPE
Identifies the VDP model (TMS9918, V9938, V9958) and frequency (50/60Hz) via register manipulation and cycle counting.
SFX_FUNCTION_PLAY_PING
Emits a high-pitched sound (Ping) by directly manipulating the PSG.
SFX_FUNCTION_PLAY_PONG
Emits a low-pitched sound (Pong) by directly manipulating the PSG.
SFX_FUNCTION_UPDATE
Controls the fade-out of the current sound on channel A.
SFX_FUNCTION_CLOSE
Immediately silences PSG channel A.
FUNCTION_MEMORY_REPORTS_PRINT_RAM_REPORT
Generates and displays the detailed detected RAM report on screen.
FUNCTION_MEMORY_REPORTS_PRINT_RAM_LAYOUT
Iterates over memory data structures to draw the Slot/Subslot grid on screen.
FUNCTION_SCREEN[0-3]_TEST_MENU
Shows the instruction menu before each video test.
FUNCTION_SCREEN[0-3]_TEST_RUN
Executes the corresponding visual test. Fills screen with chars/patterns and allows color/border changes.
FUNCTION_SCREEN2_TEST_LOAD_IMAGE
Loads one of the predefined RLE background images based on the provided index.
FUNCTION_SCREEN3_TEST_CHANGE_PATTERN
Changes the tile pattern in the multicolor mode (Screen 3).
FUNCTION_SPRITES_TEST_RUN
Main sprite test loop. Manages movement modes and bouncing.
FUNCTION_SPRITES_TEST_CREATE
Initializes 32 sprites in grid positions with incremental colors.
FUNCTION_SPRITES_TEST_MOVE
Calculates movement physics and bounce for all 32 sprites.
FUNCTION_KEYBOARD_TEST_RUN
Displays the key matrix and highlights key presses in real-time.
FUNCTION_JOYSTICK_TEST_RUN
Displays the status of both joystick ports using sprites.
FUNCTION_PSG_TEST_RUN
Interface to manually manipulate PSG channels, frequency, volume, and noise.
FUNCTION_MIXED_MODE_TEST_RUN
Configures the VDP to show the undocumented "Mixed Mode", blending attributes from different graphics modes.
FUNCTION_MONITOR_COLOR_TEST_RUN
Displays solid colors (RGB/BW) and an automatic color cycle for monitor calibration.
FUNCTION_SYSTEM_INFO
System summary screen: MSX Model, VRAM, VDP, Slots, and RTC Clock (if present).
NGN_START
Global initialization routine for the N'gine library.
NGN_WAIT_FOR_START_UP_INTERRUPTS
Pauses execution for a few seconds at startup to allow hardware stabilization.
NGN_SYSTEM_FD9A_PATCH_ON
Installs a hook at $FD9A to filter non-V-Blank interrupts.
NGN_SYSTEM_RANDOM_NUMBER
Simple pseudo-random number generator.
NGN_SCREEN_SET_MODE_[0-3]
Configures the VDP to the specified mode, clears VRAM, and sets colors.
UPDATE_SCREEN_VDP
Applies base configurations to VDP registers 0 and 1.
NGN_SPRITE_MODE_[8x8/16x16]
Changes global sprite size and magnification in VDP register 1.
NGN_SPRITE_RESET
Clears all sprites from the screen and resets Shadow RAM.
NGN_SPRITE_CREATE
Defines a sprite in Shadow RAM.
NGN_SPRITE_UPDATE
Dumps sprite attributes from RAM (NGN_SPRITE_XX) to VRAM.
NGN_SPRITE_POSITION
Moves an existing sprite.
NGN_SPRITE_COLOR
Changes the color of an existing sprite.
NGN_BACKGROUND_CREATE
Loads a full uncompressed image (Tiles+Color+Names) to VRAM.
NGN_BACKGROUND_CREATE_RLE
Loads a full image decompressing RLE on the fly.
NGN_TEXT_PRINT
Prints a 0-terminated ASCII string.
NGN_TEXT_PRINT_BCD
Prints a 3-byte BCD number (0-99999).
NGN_TEXT_PRINT_INTEGER
Prints a 16-bit integer (hex) as decimal.
NGN_TEXT_POSITION
Moves the text cursor (POSIT wrapper).
NGN_TEXT_CLS
Clears the screen.
NGN_TEXT_COLOR
Sets text and background color.
NGN_KEYBOARD_READ
Scans the full keyboard matrix via PPI. Updates the NGN_KEY_x array.
NGN_PSG_COMMAND
Writes a command to a specific PSG register.
NGN_PSG_INIT
Resets the PSG to default values (Silence).
NGN_PSG_READ_JOY[1-2]
Reads the Joystick status connected to port 1 or 2.
NGN_BCD_ADD
Adds two 3-byte BCD numbers.
NGN_BCD_SUB
Subtracts two 3-byte BCD numbers.
NGN_RLE_DECOMPRESS
Decompresses RLE data from a source address to a destination buffer.