Skip to Content
The Alchemy Project

src/system/system_debug_text.c

Number text, the debug text screen and the window graphics. More…

Included by system.c.

Macros

NameDescription
#defineDEBUG_TEXT_SCREEN BG_SCREEN_BLOCK(4)The screen block BG0 shows the debug text from, and its 32 by 20 entries' bytes.
#defineDEBUG_TEXT_SCREEN_BYTES (BG_SCREEN_WIDTH * DISPLAY_TILE_HEIGHT * 2)
#defineHEX_DIGITS 8The number buffer's hexadecimal: eight digits.
#defineDECIMAL_DIGITS_MAX 10The number buffer's decimal: a sign place and up to ten digits.
#defineDEBUG_TEXT_MAX_LENGTH 32The most characters syPrint writes of a string.
#defineBASIC_SPRITE_COLORS (14 * PALETTE_COLORS)The colours of the basic sprite palettes, 0 to 13.

Functions

NameDescription
voidsyStringFormatHex (Uint32 value)Writes value as HEX_DIGITS hexadecimal digits to the number buffer.
voidsyStringFormatDecimal (Sint32 number)Writes number to the number buffer as DECIMAL_DIGITS_MAX + 1 characters: spaces, a sign (a space or '-') and its decimal digits, right-aligned.
voidsyPrintBlanks (Uint32 count)Writes count blank characters (WINDOW_TILE_BLANK) at the debug text cursor and moves it on.
void *memcpy (void *destination, const void *source, unsigned long size)Copies size bytes from source to destination, for the modern build.
voidsyPrint (const Uint8 *text)Prints the string text (at most DEBUG_TEXT_MAX_LENGTH characters) at the debug text cursor, wrapping from the end of the screen to its start, when debug text is on; the cursor moves past it.
voidsyPrintHex (Uint32 value, Sint32 digits)Prints the last digits hexadecimal digits of value (1 to HEX_DIGITS; anything else prints all of them).
voidsyPrintDecimal (Sint32 value, Sint32 digits)Prints the last digits characters of value in signed decimal (1 to DECIMAL_DIGITS_MAX; anything else prints DECIMAL_DIGITS_MAX).
voidsyPrintClear (void)Blanks the debug text screen, homes the cursor and points BG0 at it.
voidsyWindowLoadGraphics (void)Loads the window font and border tiles into BG character block 0, the window palette into WINDOW_PALETTE with its gradient colours, and the basic sprite palettes.
voidsyPaletteLoadBasicSpriteColors (void)Loads the basic sprite palettes (palettes 0 to 13).

Description

Number text, the debug text screen and the window graphics. Part of system.c.

Macros in detail

DEBUG_TEXT_SCREEN

#define DEBUG_TEXT_SCREEN BG_SCREEN_BLOCK(4)

The screen block BG0 shows the debug text from, and its 32 by 20 entries' bytes.

Referenced by syPrint() and syPrintClear().

Definition at line 8 of file system_debug_text.c.

DEBUG_TEXT_SCREEN_BYTES

#define DEBUG_TEXT_SCREEN_BYTES (BG_SCREEN_WIDTH * DISPLAY_TILE_HEIGHT * 2)

Referenced by syPrint() and syPrintClear().

Definition at line 9 of file system_debug_text.c.

HEX_DIGITS

#define HEX_DIGITS 8

The number buffer's hexadecimal: eight digits.

Referenced by syPrintHex() and syStringFormatHex().

Definition at line 12 of file system_debug_text.c.

DECIMAL_DIGITS_MAX

#define DECIMAL_DIGITS_MAX 10

The number buffer's decimal: a sign place and up to ten digits.

Referenced by syPrintDecimal() and syStringFormatDecimal().

Definition at line 14 of file system_debug_text.c.

DEBUG_TEXT_MAX_LENGTH

#define DEBUG_TEXT_MAX_LENGTH 32

The most characters syPrint writes of a string.

Referenced by syPrint().

Definition at line 16 of file system_debug_text.c.

BASIC_SPRITE_COLORS

#define BASIC_SPRITE_COLORS (14 * PALETTE_COLORS)

The colours of the basic sprite palettes, 0 to 13.

Referenced by fdSpritePictureCacheLoad(), syPaletteLoadBasicSpriteColors() and syWindowLoadGraphics().

Definition at line 18 of file system_debug_text.c.

Functions in detail

syStringFormatHex

void syStringFormatHex(Uint32 value)

Writes value as HEX_DIGITS hexadecimal digits to the number buffer.

References NumberBuffer, Sint32 and StringHexDigits.

Referenced by syPrintHex().

Definition at line 21 of file system_debug_text.c.

syStringFormatDecimal

void syStringFormatDecimal(Sint32 number)

Writes number to the number buffer as DECIMAL_DIGITS_MAX + 1 characters: spaces, a sign (a space or '-') and its decimal digits, right-aligned.

References NumberBuffer, Sint32 and StringPowersOfTen.

Referenced by mnStringFormatNumberToHalfwords() and syPrintDecimal().

Definition at line 35 of file system_debug_text.c.

syPrintBlanks

void syPrintBlanks(Uint32 count)

Writes count blank characters (WINDOW_TILE_BLANK) at the debug text cursor and moves it on.

References DebugTextCursor.

Definition at line 81 of file system_debug_text.c.

memcpy

void *memcpy(void *destination, const void *source, unsigned long size)

Copies size bytes from source to destination, for the modern build.

Referenced by fdActorLookup(), fdActorReleaseAtIndex(), fdActorReleaseById(), fdScreenTransitionUpdateScanlineTable(), fdSpriteCreate() and sySortEvents().

Definition at line 93 of file system_debug_text.c.

syPrint

void syPrint(const Uint8 *text)

Prints the string text (at most DEBUG_TEXT_MAX_LENGTH characters) at the debug text cursor, wrapping from the end of the screen to its start, when debug text is on; the cursor moves past it.

References DebugTextCursor and DebugTextEnabled.

Referenced by syPrintDecimal() and syPrintHex().

Definition at line 107 of file system_debug_text.c.

syPrintHex

void syPrintHex(Uint32 value, Sint32 digits)

Prints the last digits hexadecimal digits of value (1 to HEX_DIGITS; anything else prints all of them). Reached through the stub table.

References NumberBufferHexEnd, Sint32, syPrint() and syStringFormatHex().

Definition at line 138 of file system_debug_text.c.

syPrintDecimal

void syPrintDecimal(Sint32 value, Sint32 digits)

Prints the last digits characters of value in signed decimal (1 to DECIMAL_DIGITS_MAX; anything else prints DECIMAL_DIGITS_MAX).

References NumberBufferDecimalEnd, Sint32, syPrint() and syStringFormatDecimal().

Definition at line 148 of file system_debug_text.c.

syPrintClear

void syPrintClear(void)

Blanks the debug text screen, homes the cursor and points BG0 at it.

References DebugTextCursor.

Referenced by btDebugBattleRunMenu(), fdPaletteEditorRun(), gmMainRoutineRun(), mnCreditsRun(), mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo(), mnTitleShowTitleScreen() and syInit().

Definition at line 157 of file system_debug_text.c.

syWindowLoadGraphics

void syWindowLoadGraphics(void)

Loads the window font and border tiles into BG character block 0, the window palette into WINDOW_PALETTE with its gradient colours, and the basic sprite palettes.

References BasicSpritePalettes, syDMAXCopy(), syResourceGetTableEntry() and WindowPalette.

Referenced by btDebugBattleRunMenu(), fdPaletteEditorRun(), mnCreditsRun(), mnNameEntryEditMemberName(), mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo(), mnTitleShowTitleScreen(), scInit() and syInit().

Definition at line 169 of file system_debug_text.c.

syPaletteLoadBasicSpriteColors

void syPaletteLoadBasicSpriteColors(void)

Loads the basic sprite palettes (palettes 0 to 13).

References BasicSpritePalettes and syDMAXCopy().

Referenced by fdActorSystemConfigure().

Definition at line 203 of file system_debug_text.c.