ElEctric_EyE wrote:
Right now 4 Routines in the Kernal are of interest to me:
$FEC2: Power-On Reset Routine. From here, the chase begins.
$F69B: Update clock, 60x/sec from interrupt. Obviously part of the main loop.
$EA87: Read the keyboard device at $DC00. Reads the keycode being pressed and put it in $CB. Also sets the shift/control flag. Looks like a good place to intercept with my code.
$E716: Output to the screen. Takes an ASCII character number from the Accumulator and outputs it to the screen.
You should definitely have a look at the kernel jump table below $ffff in the kernel! For example instead of $e716 you should use "$ffd2", which outputs a character to the current output file (normally the screen), but this can be redirected to any file - e.g. to print to a file or a printer.
Besides that, the could would be more portable. I have written programs that were actually portable between C64 and PETs by just using the jump table (i.e. those parts that are identical).
The interrupt routine is routed through an interrupt vector. You can route this around to patch into the interrupt routine without even changing the ROM.
Also $Ea87 should be replaced with $ffe1 (or $ffe4, don't remember at the moment), which works as a "GET", i.e. returns even if no key is pressed, and returns the PETSCII code directly, no need for shift/ctrl key handling. Or you can use $ffcf, which is the counterpart to $ffd2. It waits until a character is available and returns it then. On interactive mode on the screen it actually enables the full screen editor, when you press return, it reads the line where the cursor is into a buffer, converts it and allows you to read the character with further calls to $ffcf.
The kernel jump table is one of the really great things in the kernel, please use it if you don't have any compelling reason.
André