Syscall: PrintXY(int x, int y, char* string, int display_mode, int text_color)
Displays a line of homescreen-style text on the screen.
Draws a line of homescrene-style text in VRAM.
- int x - The "homescreen" column of the first character of the string, 1 to 20
- int y - The "homescreen" row, 0 to 7
- char* string - The string to display (see note 1 below)
- int display_mode - Bitmask (note 2 below)
- int text_color - The color of the characters (see note 3 below)
Text displayed to the screen
PrintXY(1, 1, "XXHello World!", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK); PrintXY(1, 2, "Hello World!"-2, TEXT_MODE_INVERT, TEXT_COLOR_YELLOW); char buffer = "XXHello World!"; PrintXY(1, 4, buffer, TEXT_MODE_INVERT, TEXT_COLOR_RED); char buf = "Hello World!"; PrintXY(1, 5, buf-2, TEXT_MODE_NORMAL, TEXT_COLOR_BLUE);
Note 1: The string must start with two junk letters such as XX that will not be displayed. For example, "XXHello, World" would display 'Hello, World', but the string "Hello, World" would only display 'llo, World'. Instead of using junk letters, you can use for example "Hello"-2 as the third parameter, it won't block even this two characters are NULL.
Note 2: Display mode 0 is normal, overwrite mode. The rectangle containing each character is cleared. Setting bit 5 (0x20) makes the background not be erased. Setting bit 0 (0x01) makes the text be written in inverse mode. If you want both, bitwise OR the modes together.
You may also use the following, defined in color.h:
- TEXT_MODE_NORMAL (0)
- TEXT_MODE_INVERT (1)
When using 0x21 (0x20 | 0x01), the effect isn't the expected where the inverted text is drawn on top of the screen. Instead, it acts like an AND operation where the printed text is used to mask what is currently on the screen (color doesn't matter), printing white elsewhere.
Note 3: Valid colors are defined in color.h and are listed below:
- TEXT_COLOR_BLACK (0) - Black
- TEXT_COLOR_BLUE (1) - Blue
- TEXT_COLOR_GREEN (2) - Green
- TEXT_COLOR_CYAN (3) - Cyan
- TEXT_COLOR_RED (4) - Red
- TEXT_COLOR_PURPLE (5) - Purple
- TEXT_COLOR_YELLOW (6) - Yellow
- TEXT_COLOR_WHITE (7) - White
Note 4: Row 0:
A valid input to PrintXY's y parameter is 0, but this is usually not rendered because row 0 is located under the status bar the top of the screen.