Changes

BIOS Kernel Functions

32 bytes added, 21:50, 24 January 2010
== Low Jump (to BIOS Bank) ==
RST 08h is used in vectors at [BB00h and up] (official BIOS functions).
0008 KL_LO_JUMP (RST1) ;in: [[SP]]=dest,out: SP=SP+2;\jump dest AND 3FFFh 000B KL_LO_CALL_HL ;in: HL=dest ;/with ROM cfg = MSBs
RST 28h is used in vectors at [BDxxh] (BASIC sub-functions; EDIT/FLO/INT).
0028 KL_FIRM_JUMP (RST5) ;in: [[SP]]=addr,out:SP=SP+2 ;LO=ON,call addr,LO=OFF
RST 08h and RST 28h act as "JUMPS", ie. they discard the retadr on stack, and return to the function that has called the RST opcode (rather than returning to a location after the RST opcode).
Although they aren't identical, RST 08h and RST 28h have exactly the same purpose, the main difference is that RST 28h is faster.
== Far Call (to Any Bank) ==
0018 KL_FAR_CALL_SP (RST3) ;in: [[[SP]]]=addr/cfg, out:PC=[SP]+2 ;\useful 001B KL_FAR_CALL_C_HL ;in: HL=addr, C=cfg ; for RSX 0023 KL_FAR_CALL_HL ;in: [HL]=addr/cfg ;/commandsThe triple-indirect [[[SP]]] means: [SP]=retadr, [retadr]=ptr16bit, [ptr16bit]=ptr24bit (lsb,msb,bank). Using the 16bit pointer (instead of directly storing the 24bit pointer after the RST opcode), has two reasons: One can store the KL_FIND_COMMAND result in DATA region (rather than needing to patch the CODE region), and one can put RST 18h in the 3-byte BIOS vector region (eg. done by AMSDOS to patch the CAS_functions; where the AMSDOS functions do manually remove retadr from stack, so that the FAR_CALL works like a FAR_JUMP in that case).
== Side Call (to another BASIC bank) ==
0010 KL_SIDE_CALL_SP (RST2);in: [[SP]]=dest,out:PC=[SP]+2;\jump dest OR C000h 0013 KL_SIDE_CALL_HL ;in: HL=dest ;/bank=base+DEST/C000h
Rarely useful. Probably intended for future, where BASIC ROM might grow from 16K to up to 64K (=four ROM banks).
6,388
edits