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

From WikiTI
Jump to: navigation, search
 
Line 1: Line 1:
'''Note:''' Do not take the information on this template page as actual documentation!
 
 
The Hooks are named by their hook pointer block address (the four bytes consisting of page, address, and an extra byte), in hexadecimal. An example is [[83Plus:Hooks:9B84]].
 
 
----
 
 
 
== Synopsis ==
 
== Synopsis ==
'''Name:''' ImAHook
+
'''Name:''' Font Hook
  
'''Hook Pointer Block Address:''' [[83Plus:RAM:8562|8562]]
+
'''Hook Pointer Block Address:''' [[83Plus:RAM:9B9C|9B9C]]
  
'''Hook Enable BCALL:''' [[83Plus:BCALLs:1234|1234]]
+
'''Hook Enable BCALL:''' [[83Plus:BCALLs:4FE4|4FE4]]
  
'''Hook Disable BCALL:''' [[83Plus:BCALLs:5678|5678]]
+
'''Hook Disable BCALL:''' [[83Plus:BCALLs:4FE7|4FE7]]
  
'''Hook Call BCALL:''' [[83Plus:BCALLs:9012|9012]]
+
'''Hook Call BCALL:''' [[83Plus:BCALLs:4003|4003]]
  
'''Hook Active Flag:''' 6, (iy + 23h)
+
'''Hook Active Flag:''' [[83Plus:BCALLs:35#Bit_5|5, (iy + 35h)]]
  
This hook allows you to change the values that [[83Plus:BCALLs:4972|GetKey]] returns.
+
This hook allows you to change the font bitmaps; for example, it is used for [http://www.detachedsolutions.com/omnicalc/ Omnicalc]'s custom fonts.
  
 
== Using the Hook ==
 
== Using the Hook ==
These different values, passed in a, determines what the hook should do.
+
* A = 0 for small font, 1 for large font
* 1: The calculator just turned on. There seem to be no other values passed to the hook.
+
* B = character
* 2: The calculator is computing 1+1.
+
* NZ to use the default bitmaps (or rather, the bitmaps provided by the [[83Plus:Hooks:9BCC|localize hook]])
** b: 1
+
* Otherwise, set HL pointing to the font data, which must be in RAM:
** c: 1
+
** In small font:
** Change b and/or c to affect the output of the problem (which will still look like 1+1 to the user).
+
*** (HL) = width of character
* 3: Preparing to turn off due to 2nd+OFF.
+
*** (HL+1) = first (accent) row, right aligned (with the last pixel usually clear)
** Zero flag: Clear to abort the power off.
+
*** (HL+2) = second row
 +
*** ...
 +
*** (HL+6) = sixth row
 +
*** (HL+7) = seventh row (only displayed with bit [[83Plus:Flags:5#Bit_1|textEraseBelow, (iy+textFlags)]] set)
 +
** In large font:
 +
*** (HL) = first row, right aligned
 +
*** ...
 +
*** (HL+6) = seventh row
  
 
== Comments ==
 
== Comments ==
This hook doesn't exist. This is a demonstration only.
+
This hook is one of the four "official" hooks defined in ti83plus.inc.
 +
 
 +
== Example ==
 +
The following code displays the letter A in boldface:
  
== Credits and Contributions ==
+
<nowiki>FontHook:
* '''/dev/hda1:''' My favorite hard drive partition.
+
        .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</nowiki>

Revision as of 22:40, 27 March 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

  • A = 0 for small font, 1 for large font
  • B = character
  • NZ to use the default bitmaps (or rather, the bitmaps provided by the localize hook)
  • 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 (with 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

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