Flash applications are mostly just assembly programs in a particular format that are run directly from Flash. However, they also need to be cryptographically signed and because they live in Flash you can't generally install them programattically on the calculator.
So it's not hard to build a Flash app, but you can't do so with Mimas
Hooks, then: the OS has a few points where it supports them- when it executes some code that supports a hook, it checks whether one is installed and if one is then it calls the specified code with inputs and outputs that vary depending on which hook it is.
Hooks are installed by writing the address (and Flash page) of some code to a particular address in RAM, which the OS them reads and jumps to. As verification that a hook is actually installed, the first instruction in the hook's code must be ld a,e
(the byte 0x83)- this isn't executed, it's just a marker that the given address is actually supposed to be a hook. There's documentation on each individual hook on WikiTI
It is possible to include a hook in a RAM-based assembly program, but this is generally discouraged because it requires you to find a block of RAM in which to stash the hook's code (basically a form of TSR
). If that gets overwritten by something you're likely to see unexpected behavior (crashes..).
There's general documentation on hooks that's somewhat more detailed than my comments here, also on WikiTI: http://wikiti.brandonw.net/index.php?title=83Plus:OS:Hooks