Difference between revisions of "83Plus:Hooks:9B9C"

From WikiTI
Jump to: navigation, search
m
(All the bullets scared me.)
Line 16: Line 16:
  
 
== Using the Hook ==
 
== Using the Hook ==
* A = 0 for small font, 1 for large font
+
This hook is called when a character is about to be displayed. A = 0 for small font, 1 for large font. B contains the character. If you want to use the default characters (or rather, the bitmaps provided by the [[83Plus:Hooks:9BCC|localize hook]]), return with zero reset. If you do this, HL '''must''' be left intact. Otherwise, set HL pointing to the font data, which must be in RAM:
* B = character
+
 
* NZ to use the default bitmaps (or rather, the bitmaps provided by the [[83Plus:Hooks:9BCC|localize hook]])
+
* In small font:
* Otherwise, set HL pointing to the font data, which must be in RAM:
+
<nowiki>(HL) = width of character
** In small font:
+
(HL+1) = first (accent) row, right aligned (the last pixel usually clear)
*** (HL) = width of character
+
(HL+2) = second row
*** (HL+1) = first (accent) row, right aligned (with the last pixel usually clear)
+
...
*** (HL+2) = second row
+
(HL+6) = sixth row</nowiki>
*** ...
+
(HL+7) = seventh row (only displayed with bit [[83Plus:Flags:5#Bit_1|textEraseBelow, (iy+textFlags)]] set)
*** (HL+6) = sixth row
+
* In large font:
*** (HL+7) = seventh row (only displayed with bit [[83Plus:Flags:5#Bit_1|textEraseBelow, (iy+textFlags)]] set)
+
<nowiki>(HL) = first row, right aligned
** In large font:
+
...
*** (HL) = first row, right aligned
+
(HL+6) = seventh row</nowiki>
*** ...
+
 
*** (HL+6) = seventh row
+
See the example code for actual formatted data.
  
 
== Comments ==
 
== Comments ==

Revision as of 19:16, 1 April 2005

Synopsis

Name: Font Hook

Hook Pointer Block Address: 9B9C

Hook Enable BCALL: 4FE4

Hook Disable BCALL: 4FE7

Hook Call BCALL: 4003

Hook Active Flag: 5, (iy + 35h)

This hook allows you to change the font bitmaps; for example, it is used for Omnicalc's custom fonts.

Using the Hook

This hook is called when a character is about to be displayed. A = 0 for small font, 1 for large font. B contains the character. If you want to use the default characters (or rather, the bitmaps provided by the localize hook), return with zero reset. If you do this, HL must be left intact. Otherwise, set HL pointing to the font data, which must be in RAM:

  • In small font:
(HL) = width of character
(HL+1) = first (accent) row, right aligned (the last pixel usually clear)
(HL+2) = second row
...
(HL+6) = sixth row
(HL+7) = seventh row (only displayed with bit  textEraseBelow, (iy+textFlags) set)
  • In large font:
(HL) = first row, right aligned
...
(HL+6) = seventh row

See the example code for actual formatted data.

Comments

This hook is one of the four "official" hooks defined in ti83plus.inc.

Example

The following code displays the letter A in boldface:

FontHook:
        .db 83h             ; Required for all hooks
        or a                ; is it small or large font?
        jr z,SmallFont
        ld a,b              ; what character is to be displayed?
        cp 'A'
        ret nz
        ld hl,BigA          ; get our replacement bitmap
        ld de,lFont_record
        ld bc,7             ; copy it into RAM
        ldir
        ld hl,lFont_record
        cp a
        ret
SmallFont:
        ld a,b              ; what character is to be displayed?
        cp 'A'
        ret nz
        ld hl,SmallA        ; get our replacement bitmap
        ld de,sFont_record
        ld bc,8             ; copy it into RAM
        ldir
        ld hl,sFont_record
        cp a
        ret
BigA:
        .db 00001110b
        .db 00010011b
        .db 00010011b
        .db 00011111b
        .db 00010011b
        .db 00010011b
        .db 00010011b
SmallA:
        .db 5
        .db 00000000b
        .db 00001100b
        .db 00010110b
        .db 00011110b
        .db 00010110b
        .db 00010110b
        .db 00000000b