WonderWitch/FreyaBIOS/Text

From WSdev Wiki
Revision as of 15:25, 16 October 2024 by Asie (talk | contribs) (Fix typo)
Jump to navigationJump to search

The Text interrupt provides a text output display using one of the WonderSwan's screens.

Interrupts

INT $13/AH=$00 - text_screen_init

  • AH = $00

Initializes a text window (see INT $13/AH=$01) with the following default settings:

  • X, Y = 0, 0
  • width, height = 28, 18
  • starting tile = 512 - font tile count (in ASCII mode)
  • starting tile = 512 - (width x height) (in Shift-JIS and mixed modes)

INT $13/AH=$01 - text_window_init

  • AH = $01
  • BL = X position on screen, in tiles
  • BH = Y position on screen, in tiles
  • CL = width, in tiles
  • CH = height, in tiles
  • DX = starting tile

Initializes a text window starting at (BL, BH) with a size of CL x CH tiles on the configured screen.

This requires the following number of tiles, starting at DX:

  • font tile count (in ASCII mode)
  • width x height (in Shift-JIS and mixed modes)

INT $13/AH=$02 - text_set_mode

  • AH = $02
  • BX = Text mode

Available modes:

  • 0 = ASCII mode
  • 1 = mixed (ASCII and Shift-JIS) mode
  • 2 = Shift-JIS mode

INT $13/AH=$03 - text_get_mode

  • AH = $03

Return:

  • BX = Text mode

INT $13/AH=$04 - text_put_char

  • AH = $04
  • BL = X position in text window
  • BH = Y position in text window
  • CX = Character code

INT $13/AH=$05 - text_put_string

  • AH = $05
  • BL = X position in text window
  • BH = Y position in text window
  • DS:DX = String to print

INT $13/AH=$06 - text_put_substring

  • AH = $06
  • BL = X position in text window
  • BH = Y position in text window
  • CX = Maximum length of string to print
  • DS:DX = String to print

INT $13/AH=$07 - text_put_numeric

  • AH = $07
  • BL = X position in text window
  • BH = Y position in text window
  • CL = Width of area to write number in
  • CH = Flags
  • DX = Number
  • DS:SI = Output buffer (optional, see flags)

Numeric output flags:

7  bit  0
---- ----
o... slzx
|    ||||
|    |||+- 0 = output in decimal
|    |||   1 = output in hexadecimal
|    ||+---- 0 = pad with spaces
|    ||      1 = pad with zeroes
|    |+------- 0 = align to right
|    |         1 = align to left
|    +---------- 0 = number is unsigned
|                1 = number is signed
+----------------- 0 = output to text window (at BL, BH)
                   1 = output to buffer (DS:SI)

INT $13/AH=$08 - text_fill_char

  • AH = $08
  • BL = X position in text window
  • BH = Y position in text window
  • CX = Length
  • DX = Character code

Repeat the specified character code CX times.

INT $13/AH=$09 - text_set_palette

  • AH = $09
  • BX = Palette color (0-15).

Set the palette used by printed text.

INT $13/AH=$0A - text_get_palette

  • AH = $0A

Return:

  • AX = Palette color (0-15).

Retrieve the palette used by printed text.

INT $13/AH=$0B - text_set_ank_font

  • AH = $0B
  • BL = Starting character code.
  • BH = Bit depth; 0 = 1bpp, 1 = 2bpp.
  • CX = Number of tiles.
  • DS:DX = Input buffer containing font data.

INT $13/AH=$0C - text_set_sjis_font

TODO

INT $13/AH=$0D - text_get_fontdata

  • AH = $0D
  • CX = Character code.
  • DS:DX = Output buffer for the character's tile data.

INT $13/AH=$0E - text_set_screen

  • AH = $0E
  • AL = Screen ID (0, 1).

INT $13/AH=$0F - text_get_screen

  • AH = $0F

Return:

  • AL = Screen ID (0, 1).

INT $13/AH=$10 - cursor_display

  • AH = $10
  • AL = Cursor status (0 = disabled, 1 = enabled).

Controls the visibility of a blinking cursor on the text screen.

INT $13/AH=$11 - cursor_status

  • AH = $11

Return:

  • AX = Cursor status.
7  bit  0
---- ----
.... ..ve
       ||
       |+- 0 = disabled, 1 = enabled
       +-- 0 = currently not visible, 1 = visible

INT $13/AH=$12 - cursor_set_location

  • AH = $12
  • BL = X position
  • BH = Y position
  • CL = Width, in tiles
  • CH = Height, in tiles

INT $13/AH=$13 - cursor_get_location

  • AH = $13

Return:

  • AL = X position
  • AH = Y position
  • DL = Width, in tiles
  • DH = Height, in tiles

INT $13/AH=$14 - cursor_set_type

  • AH = $14
  • BL = Palette (0-15) used by cursor area when visible
  • CL = Blinking rate, in frames (0 = always visible)

The defaults are as follows:

  • Palette = 1
  • Blinking rate = 30

INT $13/AH=$15 - cursor_get_type

  • AH = $15

Return:

  • AL = Palette (0-15) used by cursor area when visible
  • AH = Blinking rate, in frames (0 = always visible)