From WikiTI
Jump to: navigation, search


Name: Token Hook

Hook Pointer Block Address: 9BC8

Hook Enable BCALL: 4F99

Hook Disable BCALL: 4F9C

Hook Call BCALL: (none known)

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

This hook allows you to change the strings displayed for TIOS tokens.

Using the Hook

  • DE = token number * 2
    • 1-byte: 0000 to 01FE
    • Matrix: 0200 to 0212
    • List: 0214 to 021E
    • Equation: 0220 to 025C
    • Picture: 025E to 0270
    • GDB: 0272 to 0284
    • String: 0286 to 0298
    • Output Var: 029A to 0312
    • System Var: 0314 to 0382
    • Format: 0384 to 03A8
    • BB: 03AA to 0546 (or higher, depending on OS)
  • HL = default string
    • Change HL to display a different string, which you must copy to RAM


In OS 1.15 this hook was modified to prevent apps from defining new tokens. There are two checks in the token getting routine of OS 1.15: one which treats all undefined tokens as a question mark, and one which prevents the token hook from being run if the token is not in the standard OS 1.12 token set.

This was somewhat meta-fixed in OS 1.16 to the point that all of the original extended tokens can be used. However, it still doesn't allow new tokens to be defined.

To summarize:

  • On OS 1.14 and prior OS's - all BB tokens are reported as 03AA+2T, including hacked tokens. This caused localizers to crash when they encountered the extended Symbolic tokens.
  • On OS 1.15 - BB tokens after GarbageCollect are not passed to the token hook at all. They are always displayed as a question mark.
  • On OS 1.16, and future OS's - BC is the unmodified value as reported by 1.14 for all tokens up to the last actual token supported; DE is set to a value representing a question-mark.
  • On OS 2.20, and future OS's - For the BB tokens after tGarbageCollect BC contains the unmodified value and DE=$0012. All EF tokens are put after these as if EF XX was BB 1XX.