WonderWitch/FreyaBIOS/Text: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 87: Line 87:
*** BH = Y position in text window
*** BH = Y position in text window
** if flag bit 7 set:
** if flag bit 7 set:
*** DS:BX = Output buffer to write to
*** DS:BX = Output buffer to write to (at least [max(CL, length of number in characters) + 1] bytes)
* CL = Width of area to write number in
* CL = Width of area to write number in
* CH = Flags
* CH = Flags
Line 108: Line 108:
|    ||      1 = pad with zeroes
|    ||      1 = pad with zeroes
|    |+------- 0 = align to right
|    |+------- 0 = align to right
|    |        1 = align to left (ignores padding)
|    |        1 = no align to right
|    +---------- 0 = number is unsigned
|    +---------- 0 = number is unsigned
|                1 = number is signed
|                1 = number is signed
Line 117: Line 117:
Errata:
Errata:


- When padding a signed number with zeroes, the minus sign will be output after the zeroes; for example, calling text_put_numeric for the number <tt>-1234</tt> with a length of 8 and those flags will print <tt>000-1234</tt>, not <tt>-0001234</tt>.
* When padding a signed number with zeroes, the minus sign will be output after the zeroes; for example, calling text_put_numeric for the number <tt>-1234</tt> with a length of 8 and those flags will print <tt>000-1234</tt>, not <tt>-0001234</tt>.
* When writing to a buffer, the code always appends a NUL character (0) at the end; as such, the buffer should always be one byte larger than the maximum width.


=== INT $13/AH=$08 - text_fill_char ===
=== INT $13/AH=$08 - text_fill_char ===

Latest revision as of 13:49, 29 December 2024

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

Return:

  • AX = Number of characters displayed

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

Return:

  • AX = Number of characters displayed

INT $13/AH=$07 - text_put_numeric

  • AH = $07
  • BX =
    • if flag bit 7 clear:
      • BL = X position in text window
      • BH = Y position in text window
    • if flag bit 7 set:
      • DS:BX = Output buffer to write to (at least [max(CL, length of number in characters) + 1] bytes)
  • CL = Width of area to write number in
  • CH = Flags
  • DX = Number

Return:

  • AX = Number of characters displayed

Numeric output flags:

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

Errata:

  • When padding a signed number with zeroes, the minus sign will be output after the zeroes; for example, calling text_put_numeric for the number -1234 with a length of 8 and those flags will print 000-1234, not -0001234.
  • When writing to a buffer, the code always appends a NUL character (0) at the end; as such, the buffer should always be one byte larger than the maximum width.

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)