CpcAlive is a
programming
environment
Amstrad CPC
compatible
for graphics
 animations
creation.






256 colors with the CpcAlive emulator

Cpc Online

Cpc basic key words
( English - Español - Français)

The memory

The system memory map

Diskettes management

Cpc basic error messages

Z80 processor opcodes and
operation

CpcAlive installer for
Windows and DosBox

CpcAlive Documentation

SmallAsm is a Z80 assembler
for Dos



Last review: (DosBox version)
V1.17 - 07/01/2024 - New screen mode 1024*768*256colors(MODE 3)
V1.16 - 16/12/2014 - Z80 assembler correction
V1.15 - 30/11/2014 - corrections
V1.14 - 20/11/2014 - display ASM sources in Z80 debugger
V1.13 - 20/9/2014 - BASIC command TRON(BASIC debugger) improvement and corrections

The Amstrad Cpc system vectors


 Low Kernel Jumpblock

000   &0000   RESET ENTRY (RST 0)
      Action: Resets the computer as if it has just been switched on
      Entry:  No entry conditions
      Exit:   This routine is never returned from
      Notes:  After initialisation  of  the  hardware  and  firmware,
               control is handed over to ROM 0 (usually BASIC)

001   &0008   LOW JUMP (RST 1)
      Action: Jumps to a routine in either the lower ROM or low RAM
      Entry:  No entry conditions - all  the  registers are passed to
              the destination routine unchanged
      Exit:   The registers are as set  by  the  routine in the lower
              ROM or RAM or are returned unaltered
      Notes:  The RST 1 instruction  is  followed  by  a two byte low
              address, which is defmed as follows:
                if bit 15 is set, then the upper ROM is disabled
                if bit 14 is set, then the lower ROM is disabled
                bits 13 to 0 contain the address of the routine to
                  jump to
              This command is used by the  majority of entries in the
              main firmware jumpblock

002   &000B   KL LOW PCHL
      Action: Jumps to a routine in either the lower ROM or low RAM
      Entry:  HL contains the low  address  -  all  the registers are
              passed to the destination routine unchanged
      Exit:   The registers are as set  by  the  routine in the lower
              ROM or RAM or are returned unaltered
      Notes:  The two byte low  address  in  the  HL register pair is
              defined as follows:
                if bit 15 is set, then the upper ROM is disabled
                if bit 14 is set, then the lower ROM is disabled
                bits 13 to 0 contain the address of the routine to
                  jump to

003   &000E   PCBC INSTRUCTION
      Action: Jumps to the specified address
      Entry:  BC contains the address to jump  to - all the registers
              are passed to the destination routine unaltered
      Exit:   The registers are as set  by the destination routine or
              are returned unchanged

004   &0010   SIDE CALL (RST 2)
      Action: Calls a routine  in  ROM,  in  a  group  of  up to four
              foreground ROMs
      Entry:  No entry conditions - all  the  registers apart from IY
              are passed to the destination routine unaltered
      Exit:   IY is corrupt, and the  other  registers  are as set by
              the destination routine or are returned unchanged
      Notes:  The RST 2 instruction is  followed  by  a two byte side
              address, which is defined as follows:
                bits 14 and 15 give a number between 0 and 3, which
                  is added to the main foreground ROM select address
                  - this is then used as the ROM select address
                bits 0 to 13 contain the address to which is added
                  &C000 - this gives the address of the routine to be
                  called

005   &0013   KL SIDE PCHL
      Action: Calls a routine in another ROM
      Entry:  HL contains the side address  - all the registers apart
              from IY are passed to the destination routine unaltered
      Exit:   IY is corrupt, and the  other  registers  are as set by
              the destination routine or are returned unchanged
      Notes:  The two byte side address is defined as follows:
                bits 14 and 15 give a number between 0 and 3, which
                  is added to the main foreground ROM select address
                  - this is then used as the ROM select address
                bits 0 to 13 contain the address to which is added
                  &C000 - this gives the address of the routine to be
                  called

006   &0016   PCDE INSTRUCTION
      Action: Jumps to the specified address
      Entry:  DE contains the address to jump  to - all the registers
              are passed to the destination routine unaltered
      Exit:   The registers are as set  by the destination routine or
              are returned unchanged

007   &0018   FAR CALL (RST 3)
      Action: Calls a routine anywhere in RAM or ROM
      Entry:  No entry conditions - all  the  registers apart from IY
              are passed to the destination routine unaltered
      Exit:   IY is preserved, and the other  registers are as set by
              the destination routine or are returned unchanged
      Notes:  The RST 3 instruction is followed by a two byte in-line
              address.  At this address,  there  is  a three byte far
              address, which is defined as follows:
                bytes 0 and 1 give the address of the routine to be
                  called
                byte 2 is the ROM select byte which has values as
                  follows:
                  &00 to &FB-- select the given upper ROM, enable the
                  upper ROM and disable the lower ROM
                  &FC - no change to the ROM selection, enable the
                  upper and lower ROMs
                  &FD - no change to the ROM selection, enable the
                  upper ROM and disable the lower ROM
                  &FE - no change to the ROM selection, disable the
                  upper ROM and enable the lower ROM
                  &FF - no change to the ROM selection, disable the
                  upper and lower ROMs
              When it is retumed  from,  the  ROM selection and state
              are restored to their settings before the RST 3 command

008   &001B   KL FAR PCHL
      Action: Calls a routine, given by  the  far  address in HL & C,
              anywhere in RAM or ROM
      Entry:  HL holds the address of the routine to be called, and C
              holds the ROM select  byte  -  all  the registers apart
              from IY are passed to the destination routine unaltered
      Exit:   IY is preserved, and the other  registers are as set by
              the destination routine or are returned unchanged
      Notes:  See FAR CALL (RST 3) above  for more details on the ROM
              select byte

009   &001E   PCHL INSTRUCTION
      Action: Jumps to the specified address
      Entry:  HL contains the address to jump  to - all the registers
              are passed to the destination routine unaltered
      Exit:   The registers are as set  by the destination routine or
              are returned unchanged

010   &0020   RAM LAM
      Action: Puts the contents of a  RAM  memory location into the A
              register
      Entry:  HL contains the address of the memory location
      Exit:   A holds the contents  of  the  memory location, and all
              other registers are preserved
      Notes:  This routine always reads from  RAM,  even if the upper
              or lower ROM is enabled

011   &0023   KL FAR CALL
      Action: Calls a routine anywhere in RAM or ROM

      Entry:  HL holds the address of the three byte far address that
              is to be used -  all  the  registers  apart from IY are
              passed to the destination routine unaltered
      Exit:   IY is preserved, and the other  registers are as set by
              the destination routine or are returned unchanged
      Notes:  See FAR CALL above for  more  details on the three byte
              far address

012   &0028   FIRM JUMP (RST 5)
      Action: Jumps to a  routine  in  either  the  lower  ROM or the
              central 32K of RAM
      Entry:  No entry conditions - all  the  registers are passed to
              the destination routine unchanged
      Exit:   The registers are as set  by  the  routine in the lower
              ROM or RAM or are returned unaltered
      Notes:  The RST  5  instruction  is  followed  by  a  two  byte
              address, which is the  address  to  jump to; before the
              jump is made, the lower ROM is enabled, and is disabled
              when the destination routine is returned from

013   &0030   USER RESTART (RST 6)
      Action: This is an RST instruction that may be set aside by the
              user for any purpose
      Entry:  Defined by the user
      Exit:   Defined by the user
      Notes:  The bytes from &0030  to  &0037  are  available for the
              user to put their own code in if they wish

014   &0038   INTERRUPT ENTRY (RST 7)
      Action: Deals with normal interrupts
      Entry:  No entry conditions
      Exit:   All registers are preserved
      Notes:  The RST 7 instruction must not be used by the user; any
              external interrupts that are  generated  by hardware on
              the expansion  port  will  be  dealt  with  by  the EXT
              INTERRUPT routine (see  Low  Kernel  Jumpblock, routine
              015)

015   &003B   EXT INTERRUPT
      Action: This area  is  set  aside  for  dealing  with  external
              interrupts that are generated by any extra hardware
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  If any external hardware  is  going to generate interr-
              upts, then the user must  patch  the area from &003B to
              &003F so that the computer  can  deal with the external
              interrupt; when an external interrupt occurs, the lower
              ROM is disabled and the  code  at  &003B is called; the
              default external  interrupt  routine  at  &003B  simply
              returns, and  this  will  cause  the  computer  to hang
              because the interrupt will continue to exist

High Kernel Jumpblock

000   &B900   KL U ROM ENABLE
      Action: Enables the current upper ROM
      Entry:  No entry conditions
      Exit:   A contains the previous state of the ROM, the flags are
              corrupt, and all other registers are preserved
      Notes:  After this routine has  been  called,  all reading from
              addresses between &C000 and  &FFFF  refers to the upper
              ROM, and not the top  16K  of  RAM which is usually the
              screen memory; any  writing  to  these  addresses still
              affects the  RAM  as,  by  its  nature,  ROM  cannot be
              written to

001   &B903   KL U ROM DISABLE
      Action: Disables the upper ROM
      Entry:  No entry conditions
      Exit:   A contains the previous state of the ROM, the flags are
              corrupt, and all other registers are preserved
      Notes:  After this routine has  been  called,  all reading from
              addresses between &C000 and ~F~FF refers to the top 16K
              of RAM which is usually the screen memory

002   &B906   KL L ROM ENABLE
      Action: Enables the lower ROM
      Entry:  No entry conditions
      Exit:   A contains the previous state of the ROM, the flags are
              corrupt, and all other registers are preserved
      Notes:  After this routine has  been  called,  all reading from
              addresses between &0000 and  &4000  refers to the lower
              ROM, and not the  bottom  16K  of  RAM;  any writing to
              these addresses still affects the  RAM  as a ROM cannot
              be written to; the  lower  ROM is automatically enabled
              when a firmware routine is called, and is then disabled
              when the routine returns

003   &B909   KL L ROM DISABLE
      Action: Disables the lower ROM
      Entry:  No entry conditions
      Exit:   A contains the previous state of the ROM, the flags are
              corrupt, and all other registers are preserved
      Notes:  After this routine has  been  called,  all reading from
              addresses between &0000 and &4000  refers to the bottom
              16K of RAM; the lower ROM is automatically enabled when
              a firmware routine is called, and is then disabled when
              the routine returns

004   &B90C   KL ROM RESTORE
      Action: Restores the ROM to its previous state
      Entry:  A contains the previous state of the ROM
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  The previous four routines all  return  values in the A
              register which are suitable for use by KL ROM RESTORE

005   &B90F   KL ROM SELECT
      Action: Selects an upper ROM and also enables it
      Entry:  C contains the ROM select address of the required ROM
      Exit:   C contains the ROM select  address of the previous ROM,
              and B contains the state of the previous ROM

006   &B912   KL CURR SELECTION
      Action: Gets the ROM select address of the current ROM
      Entry:  No entry conditions
      Exit:   A contains the ROM select  address  of the current ROM,
              and all other registers are preserved

007   &B915   KL PROBE ROM
      Action: Gets the class and version of a specified ROM
      Entry:  C contains the ROM select address of the required ROM
      Exit:   A contains the class of  the  ROM,  H holds the version
              number, L holds me  mark  number,  B  and the flags are
              corrupt, and all other registers are preserved
      Notes:  The ROM class may be one of ine following:
                 &00 - a foregroumd ROM
                 &01 - a background ROM
                 &02 - an extension foreground ROM
                 &80 - the built in ROM (ie the BASIC ROM)

008   &B918   KL ROM DESELECT
      Action: Selects the previous upper ROM and sets its state
      Entry:  C contains me  ROM  select  address  of  the  ROM to be
              reselected, and B contains  the  state  of the required
              ROM
      Exit:   C contains the ROM select address  of me current ROM, B
              is corrupt, and all others are preserved
      Notes:  This routine reverses the acoon  of  KL ROM SELECT, and
              uses the values that it returns in B and C

009   &B91B   KL LDIR
      Action: Switches off the  upper  and  lower  ROMs,  and moves a
              block of memory
      Entry:  As for a standard  LDIR  instruction  (ie  DE holds the
              destination location, HL points to the first byte to be
              moved, and BC  holds  the  length  of  the  block to be
              moved)
      Exit:   F, BC,  DE  amd  HL  are  set  as  for  a  normal  LDIR
              instruction, and all other registers are preserved

010   &B91E   KL LDDR
      Action: Switches off the  upper  and  lower  ROMs,  amd moves a
              block of memory
      Entry:  As for a standard  LDDR  instruction  (ie  DE holds the
              first desination location,  HL  points  to  the highest
              byte lit in memory to be moved, amd BC holds the number
              of bytes to be moved)
      Exit:   F, BC,  DE  amd  HL,  are  set  as  for  a  nommal LDDR
              instruction, and all other registers are preserved

011   &B921   KL POLL SYNCHRONOUS
      Action: Tests whether an event with  a higher priority than the
              current event is waiting to be dealt with
      Entry:  No entry conditions
      Exit:   If there is  a  higher  priority  event,  then Carry is
              false; if there is no higher priority event, then Carry
              is true; in either  case,  A  and  the  other flags are
              corrupt, and all other registers are preserved

014   &B92A   KL SCAN NEEDED
      Action: Ensures that the  keyboard  is  scanned  when  the next
              ticker interrupt occurs
      Entry:  No entry conditions
      Exit:   AF amd HL  are  corrupt,  amd  all  other registers are
              preserved
      Notes:  This routine is useful  for  scanning the keyboard when
              interrupts are disabled and normal  key scanning is not
              occuring

The Key Manager

000   &BB00   KM INITIALISE
      Action: Initialises the Key Manager  and  sets up everything as
              it is when the computer  is  first switched on; the key
              buffer is emptied, Shift  and  Caps  lock are tumed off
              amd all the expansion and  translation tables are reset
              to normal; also see the routine KM RESET below
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL corrupt,  and all other registers are
              preserved

001   &BB03   KM RESET
      Action: Resets the Key Manager; the  key  buffer is emptied and
              all current keys/characters are ignored
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL  are  corrupt and all other registers
              are preserved
      Notes:  See also KM INITIALISE above:  on  the 664 or 6128, the
              key buffer can also  be  cleared  separately by calling
              the KM FLUSH routine

002   &BB06   KM WAIT CHAR
      Action: Waits for the next character from the keyboard buffer
      Entry:  No entry conditions
      Exit:   Carry is true, A holds  the  character value, the other
              flags  are  corrupt,  and   all   other  registers  are
              preserved

003   &BB09   KM READ CHAR
      Action: Tests to see  if  a  character  is  available  from the
              keyboard buffer, but  doesn't  wait  for  one to become
              available
      Entry:  No entry conditions
      Exit:   If a character was available, then Carry is true, and A
              contains the character; otherwise Carry is false, and A
              is corrupt; in  both  cases,  the  other  registers are
              preserved

004   &BB0C   KM CHAR RETURN
      Action: Saves a character for the next  use  of KM WAIT CHAR or
              KM READ CHAR
      Entry:  A contains the ASCII code  of  the  character to be put
              back
      Exit:   All registers are preserved

005   &BB0F   KM SET EXPAND
      Action: Assigns a string to a key code
      Entry:  B holds the key code; C holds the length of the string;
              HL contains the address of the string (must be in RAM)
      Exit:   If it is OK,  then  Carry  is  true; otherwise Carry is
              false; in either case, A,  BC,  DE  and HL are corrupt,
              and all other registers rlre preserved

006   &BB12   KM GET EXPAND
      Action: Reads a character from an expanded string of characters
      Entry:  A holds an expansion token (ie  a key code) and L holds
              the character position number (starts from 0)
      Exit: If it is  OK,  then  Carry  is  true,  and  A  holds  the
              character; otherwise Carry is false,  and A is corrupt;
              in either case, DE and flags are corrupt, and the other
              registers are preserved

007   &BB15   KM EXP BUFFER
      Action: Sets  aside  a  buffer  area  for  character  expansion
              strings
      Entry:  DE holds the address  of  the  buffer  and HL holds the
              length of the buffer
      Exit:   If it is OK,  then  Carry  is  true; otherwise Carry is
              false; in either case, A, BC, DE and HL are corrupt
      Notes:  The buffer must be in the  central  32K of RAM and must
              be at least 49 bytes long

008   &BB18   KM WAIT KEY
      Action: Waits for a key to be  pressed  - this routine does not
              expand any expansion tokens
      Entry:  No entry conditions
      Exit:   Carry is  true,  A  holds  the  character  or expansion
              token, and all other registers are preserved

009   &BB1B   KM READ KEY
      Action: Tests whether a key is available from the keyboard
      Entry:  No entry conditions
      Exit:   If a key  is  available,  then  Carry  is  true,  and A
              contains the character; otherwise Carry is false, and A
              is corrupt; in  either  case,  the  other registers are
              preserved
      Notes:  Any expansion tokens are not expanded

010   &BB1E   KM TEST KEY
      Action: Tests if a  particular  key  (or  joystick direction or
              button) is pressed
      Entry:  A contains the key/joystick nurnber
      Exit:   If the requested key  is  pressed,  then Zero is false;
              otherwise Zero is true for  both,  Carry is false A and
              HL are corrupt.  C holds  the  Sbift and Control status
              and others are preserved
      Notes:  After calling this, C will hold  the state of shift and
              control - if bit 7 is set then Control was pressed, and
              if bit 5 is set then Shift was pressed

011   &BB21   KM GET STATE
      Action: Gets the state of the Shift and Caps locks
      Entry:  No entry conditions
      Exit:   If L holds &FF then  the  shift  lock  is  on, but if L
              holds &00 then the Shift  lock  is  off; if H holds &FF
              then the caps lock is on,  and  if H holds &00 then the
              Caps lock is off; whatever  the  outcome, all the other
              registers are preserved

012   &BB24   KM GET JOYSTICK
      Action: Reads the present state of any joysticks attached
      Entry:  No entry conditions
      Exit:   H and A contains the state  of joystick 0, L holds that
              state of joystick 1, and all others are preserved
      Notes:  The joystick states  are  bit  significant  and  are as
              follows: Bit 0 - Up Bit
                           1 - Down Bit
                           2 - Left Bit
                           3 - Right Bit
                           4 - Fire2 Bit
                           5 - Fire1 Bit
                           6 - Spare Bit
                           7 - Always zero
              The bits are  set  when  the  corresponding  buttons or
              directions are operated

013   &BB27   KM SET TRANSLATE
      Action: Sets the token or character  that  is assigned to a key
              when neither Shift nor Control are pressed
      Entry:  A contains the key number and  B contains the new token
              or character
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved
      Notes:  Special values for B are as follows:
                 &80  to  &9F  -  these   values  correspond  to  the
              expansion tokens
                 &FD - this causes the caps lock to toggle on and off
                 &FE - this causes the  shift  lock  to toggle on and
              off
                 &FF - causes this key to be ignored

014   &BB2A   KM GET TRANSLATE
      Action: Finds out what token or character will be assigned to a
              key when neither Shift nor Control are pressed
      Entry:  A contains the key number
      Exit:   A contains the token/character that is assigned, HL and
              flags are corrupt, and all others are preserved
      Notes:  See KM SET TRANSLATE  for  special  values  that can be
              returned

015   &BB2D   KM SET SHIFT
      Action: Sets the token or character that  will be assigned to a
              key when Shift is pressed as well
      Entry:  A contains the key number and  B contains the new token
              or character
      Exit:   AF and HL are corrupt, and all others are preserved
      Notes:  See KM SET TRANSLATE for special values that can be set

016   &BB30   KM GET SHIFT
      Action: Finds out what token/character  will  be  assigned to a
              key when Shift is pressed as well
      Entry:  A contains the key number
      Exit:   A contains the token/character that is assigned, HL and
              flags are corrupt, and all others are preserved
      Notes:  See KM SET TRANSLATE  for  special  values  that can be
              returned

017   &BB33   KM SET CONTROL

      Action: Sets the token or character that  will be assigned to a
              key when Control is pressed as well
      Entry:  A contains  the  key  number  and  B  contains  the new
              token/character
      Exit:   AF and HL are corrupt, and all others are preserved
      Notes:  See KM SET TRANSLATE for special values that can be set

018   &BB36   KM GET CONTROL
      Action: Finds out what token or character will be assigned to a
              key when Control is pressed as well
      Entry:  A contains the key number
      Exit:   A contains the token/character that is assigned, HL and
              flags are corrupt and all others are preserved
      Notes:  See KM SET TRANSLATE for special values that can be set

019   &BB39   KM SET REPEAT
      Action: Sets whether a key may repeat or not
      Entry:  A contains the key number B contains &00 if there is no
              repeat and &FF is it is to repeat
      Exit:   AF, BC and HL are corrupt, and all others are preserved

020   &BB3C   KM GET REPEAT
      Action: Finds out whether a key is set to repeat or not
      Entry:  A contains a key number
      Exit:   If the key repeats, then Zero is false; if the key does
              not repeat, then Zero is  true;  in  either case, A, HL
              and flags are corrupt,  Carry  is  false, and all other
              registers are preserved

021   &BB3F   KM SET DELAY
      Action: Sets the time that elapses before the first repeat, and
              also set the repeat speed
      Entry:  H contains the  time  before  the  first  repeat, and L
              holds the time between repeats (repeat speed)
      Exit:   AF is corrupt, and all others are preserved
      Notes:  The values for the times  are  given in 1/5Oth seconds,
              and a value of 0 counts as 256

022   &BB42   KM GET DELAY
      Action: Finds out the time that elapses before the first repeat
              and also the repeat speed
      Entry:  No entry conditions
      Exit:   H contains the  time  before  the  first  repeat, and L
              holds the time  between  repeats,  and  all  others are
              preserved

023   &BB45   KM ARM BREAK
      Action: Arms the Break mechanism
      Entry:  DE holds the address of  the  Break handling routine, C
              holds the ROM select address for this routine
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved

024   &BB48   KM DISARM BREAK
      Action: Disables the Break mechanism
      Entry:  No entry conditions
      Exit:   AF and HL are corrupt, and  all the other registers are
              preserved

025   &BB4B   KM BREAK EVENT
      Action: Generates a Break interrupt if a Break routine has been
              specified by KM ARM BREAK
      Entry:  No entry conditions
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved

The Text VDU

026   &BB4E   TXT INITIALISE

      Action: Initialise the  text  VDU  to  its  settings  when  the
              computer is switched  on,  includes  resetting  all the
              text VDU indirections,  selecting  Stream  0, resetting
              the text paper to pen  0  and  the  text  pen to pen 1,
              moving the cursor to the top  left corner of the screen
              and setting the writing mode to be opaque
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

027   &BB51   TXT RESET
      Action: Resets the text VDU  indirections  and the control code
              table
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved

028   &BB54   TXT VDU ENABLE
      Action: Allows characters to be  printed  on  the screen in the
              current stream
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all other registers are preserved

029   &BB57   TXT VDU DISABLE
      Action: Prevents characters from being  printed  to the current
              stream
      Entry:  No entry conditions
      Exit:   AF  is  corrupt,  and  al1   the  other  registers  are
              preserved

030   &BB5A   TXT OUTPUT
      Action: Output a character or control code  (&00 to &1F) to the
              screen
      Entry:  A contains the character to output
      Exit:   All registers are preserved
      Notes:  Any control codes are obeyed  and nothing is printed if
              the VDU is disabled;  characters  are printed using the
              TXT OUT  ACTION  routine;  if  using  graphics printing
              mode, then control codes are printed and not obeyed

031   &BB5D   TXT WR CHAR
      Action: Print a character  at  the  current  cursor  position -
              control codes are printed and not obeyed
      Entry:  A contains the character to be printed
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  This routine uses the TXT WRITE CHAR indirection to put
              the character on the screen

032   &BB60   TXT RD CHAR
      Action: Read a character from the  screen at the current cursor
              position
      Entry:  No entry conditions
      Exit:   If it was successful then A contains the character that
              was read from the screen  and  Carry is true; otherwise
              Carry is false, and  A  holds  0;  in  either case, the
              other  flags  are  corrupt,   and   all  registers  are
              preserved
      Notes:  This routine uses the TXT UNWRITE indirection

033   &BB63   TXT SET GRAPHIC
      Action: Enables or disables graphics print character mode
      Entry:  To switch graphics printing  mode  on,  A  must be non-
              zero; to turn it off, A must contain zero
      Exit:   AF corrupt, and all other registers are preserved
      Notes:  When turned  on,  control  codes  are  printed  and not
              obeyed; characters are printed by GRA WR CHAR

034   &BB66   TXT WIN ENABLE
      Action: Sets the boundaries of the  current  text window - uses
              physical coordinates
      Entry:  H hoIds the column  number  of  one  edge,  D holds the
              column number of  the  other  edge,  L  holds  the line
              number of one edge, and E  holds the line number of the
              other edge Exit: AF, BC, DE and HL are corrupt
      Notes:  The window is not cleared  but  the  cursor is moved to
              the top left corner of the window

035   &BB69   TXT GET WINDOW
      Action: Returns the  size  of  the  current  window  -  returns
              physical coordinates
      Entry:  No entry conditions
      Exit:   H holds the column number of the left edge, D holds the
              column number of  the  right  edge,  L  holds  the line
              number of the top edge, E  holds the line number of the
              bottom edge, A is corrupt, Carry is false if the window
              covers the entire screen,  and  the other registers are
              always preserved

036   &BB6C   TXT CLEAR WINDOW
      Action: Clears the window (of the current stream) and moves the
              cursor to the top left corner of the window
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  alI others are
              preserved

037   &BB6F   TXT SET COLUMN
      Action: Sets the cursor's horizontal position
      Entry:  A contains the logical column number to move the cursor
              to
      Exit:   AF and HL are corrupt, and  all the other registers are
              preserved
      Notes:  See also TXT SET CURSOR

038   &BB72   TXT SET ROW
      Action: Sets the cursor's vertical position
      Entry:  A contains the logical line  number  to move the cursor
              to
      Exit:   AF and HL are corrupt, and all others are preserved
      Notes:  See also TXT SET CURSOR

039   &BB75   TXT SET CURSOR
      Action: Sets the cursor's vertical and horizontal position
      Entry:  H contains the logical column number and L contains the
              logical line number
      Exit:   AF and HL are corrupt, and all the others are preserved
      Notes:  See also TXT SET COLUMN and TXT SET ROW

040   &BB78   TXT GET CURSOR
      Action: Gets the cursor's current position
      Entry:  No entry conditions
      Exit:   H holds the logical column  number, L holds the logical
              line number, and A contains  the  roll count, the flags
              are corrupt, and all the other registers are preserved
      Notes:  The roll count is increased when the screen is scrolled
              down, and is decreased when it is scrolled up

041   &BB7B   TXT CUR ENABLE
      Action: Allows the  text  cursor  to  be  displayed  (if  it is
              allowed by TXT CUR ON) - intended for use by the user
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all other registers are preserved

042   &BB7E   TXT CUR DISABLE
      Action: Prevents the text cursor from being displayed -intended
              for use by the user
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all others are preserved

043   &BB81   TXT CUR ON
      Action: Allows the text cursor to  be  displayed - intended for
              use by the operating system
      Entry:  No entry conditions
      Exit:   All registers and flags are preserved

044   &BB84   TXT CUR OFF
      Action: Prevents the text cursor from being displayed -intended
              for use by the operating system
      Entry:  No entry conditions
      Exit:   All registers and flags are preserved

045   &BB87   TXT VALIDATE
      Action: Checks whether a cursor position  is within the current
              window
      Entry:  H contains the logical  column  number  to check, and L
              holds the logical line number
      Exit:   H holds  the  logical  column  number  where  the  next
              character will be  printed,  L  holds  the logical line
              number; if printing  at  this  position  would make the
              window scroll up, then Carry is  false and B holds &FF;
              if printing at  this  position  would  make  the window
              scroll down, then Carry is false and B contains &00; if
              printing at the  specified  cursor  position  would not
              scroll the window, then Carry is true and B is corrupt;
              always, A and  the  other  flags  are  corrupt, and all
              others are preserved

046   &BB8A   TXT PLACE CURSOR
      Action: Puts a 'cursor  blob'  on  the  screen  at  the current
              cursor position
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  It is possible to have more than one cursor in a window
              (see also TXT DRAW  CURSOR);  do  not use this  routine
              twice without using TXT REMOVE CURSOR between

047   &BB8D   TXT REMOVE CURSOR
      Action: Removes  a  'cursor  blob'   from  the  current  cursor
              position
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all the others are preserved
      Notes:  This should be used only  to  remove cursors created by
              TXT PLACE CURSOR, but see also TXT UNDRAW CURSOR

048   &BB90   TXT SET PEN
      Action: Sets the foreground PEN for the current stream
      Entry:  A contams the PEN number to use
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved

049   &BB93   TXT GET PEN
      Action: Gets the foreground PEN for the current stream
      Entry:  No entry conditions
      Exit:   A contains the PEN number,  the  flags are corrupt, and
              all other registers are preserved

050   &BB96   TXT SET PAPER
      Action: Sets the background PAPER for the current stream
      Entry:  A contains the PEN number to use
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved

051   &BB99   TXT GET PAPER
      Action: Gets the background PAPER for the current stream
      Entry:  No entry conditions
      Exit:   A contains the PEN number,  the  flags are corrupt, and
              all other registers are preserved

052   &BB9C   TXT INVERSE
      Action: Swaps the current PEN  and  PAPER  colours over for the
              current stream
      Entry:  No entry conditions
      Exit:   AF and HL are corrupt, and all others are preserved

053   &BB9F   TXT SET BACK
      Action: Sets the  character  write  mode  to  either  opaque or
              transparent
      Entry:  For transparent mode, A  must  be  non-zero; for opaque
              mode, A has to hold zero
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved
      Notes:  Setting the character write mode  has no effects on the
              graphics VDU

054   &BBA2   TXT GET BACK
      Action: Gets the character write mode for the current stream
      Entry:  No entry conditions
      Exit:   If in transparent mode, A  is non-zero; in opaque mode,
              A is zero; in either case DE, HL and flags are corrupt,
              and the other registers are preserved

055   &BBA5   TXT GET MATRIX
      Action: Gets the address of a character matrix
      Entry:  A contains the character whose matrix is to be found
      Exit:   If it is a user-defined matrix,  then Carry is true; if
              it is in the lower ROM  then  Carry is false; in either
              event, HL contains the  address  of  the  matrix, A and
              other flags are corrupt, and others are preserved
      Notes:  The character matrix is  stored  in  8 bytes; the first
              byte is for the top row  of the character, and the last
              byte refers to the bottom  row  of the character; bit 7
              of a byte refers to the  leftmost  pixel of a line, and
              bit 0 refers to the rightmost pixel in Mode 2.

056   &BBA8   TXT SET MATRIX
      Action: Installs a matrix for a user-defined character
      Entry:  A contains the character which  is being defined and HL
              contains the address of the matrix to be used
      Exit:   If the character is user-definable  then Carry is true;
              otherwise Carry is false,  and  no  action is taken; in
              both cases AF, BC, DE and HL are corrupt, and all other
              registers are preserved

057   &BBAB   TXT SET M TABLE
      Action: Sets the address of a user-defined matrix table
      Entry:  DE is the first character  in  the  table and HL is the
              table's address (in the central 32K of RAM)
      Exit:   If there are no  existing  tables  then Carry is false,
              and A and HL are both corrupt; otherwise Carry is true,
              A is the first character and HL is the table's address;
              in both cases BC, DE and the other flags are corrupt

058   &BBAE   TXT GET M TABLE
      Action: Gets the address of a user-defined matrix table
      Entry:  No entry conditions
      Exit:   See TXT SET M  TABLE  above  for  details of the values
              that can be returned

059   &BBB1   TXT GET CONTROLS
      Action: Gets the address of the control code table
      Entry:  No entry conditions
      Exit:   HL contains the address  of  the  table, and all others
              are preserved
      Notes:  The table has  32  entries,  and  each  entry has three
              bytes: byte 1 is the number of parameters needed by the
              control code, bytes 2  and  3  are  the  address of the
              routine, in the Lower ROM, to execute the control code

060   &BBB4   TXT STR SELECT
      Action: Selects a new VDU text stream
      Entry:  A contains the value of the stream to change to
      Exit:   A contains the previously  selected  stream, HL and the
              flags are corrupt, and all others are preserved

061   &BBB7   TXT SWAP STREAMS
      Action: Swaps the states of two stream attribute tables
      Entry:  B contains a stream  number,  and  C contains the other
              stream number
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  The foreground pen  and  paper,  the  window  size, the
              cursor position, the character  write  mode and graphic
              character  mode  are  all  exchanged  between  the  two
              streams

The Graphics VDU

062   &BBBA   GRA INITIALISE
      Action: Initialises the graphics VDU to  its default set-up (ie
              its set-up when the computer is switched on)
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  Sets the graphics indirections  to their defaults, sets
              the graphic paper to text pen  0 and the graphic pen to
              text pen 1,  reset  the  graphics  origin  and move the
              graphics cursor to the bottom left of the screen, reset
              the graphics window and write mode to their defaults

063   &BBBD   GRA RESET
      Action: Resets the graphics VDU
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  Resets the graphics indirections and the graphics write
              mode to their defaults

064   &BBC0   GRA MOVE ABSOLUTE
      Action: Moves  the  graphics  cursor   to  an  absolute  screen
              position
      Entry:  DE contains the user X-coordinate and HL holds the user
              Y-coordinate
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

065   &BBC3   GRA MOVE RELATIVE
      Action: Moves the graphics cursor  to  a  point relative to its
              present screen position
      Entry:  DE contains the X-distance to move  and HL holds the Y-
              distance
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

066   &BBC6   GRA ASK CURSOR
      Action: Gets the graphics cursor's current position
      Entry:  No entry conditions
      Exit:   DE holds the user X-coordinate,  HL  holds the user Y-
              coordinate, AF is corrupt, and all others nre preserved

067   &BBC9   GRA SET ORIGIN
      Action: Sets the graphics user origin's screen position
      Entry:  DE contains the standard X-coordinate  and HL holds the
              standard Y-coordinate
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

068   &BBCC   GRA GET ORIGIN
      Action: Gets the graphics user origin's screen position
      Entry:  No entry conditions
      Exit:   DE contains the standard X-coordinate  and HL holds the
              standard Y-coordinate, and all others are preserved

069   &BBCF   GRA WIN WIDTH
      Action: Sets the left and right edges of the graphics window
      Ently:  DE contains the standard  X-coordinate  of one edge and
              HL holds the standard X-coordinate of the other side
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved
      Notes:  The default window  covers  the  entire  screen  and is
              restored to its default when  the mode is changed; used
              in conjunction with GRA WIN HEIGHT

070   &BBD2   GRA WIN HEIGHT
      Action: Sets the top and bottom edges of the graphics window
      Entry:  DE contains the standard  Y-coordinate  of one side and
              HL holds the standard Y-coordinate of the other side
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  See GRA WIN WIDTH for further details

071   &BBD5   GRA GET W WIDTH
      Action: Gets the left and right edges of the graphics window
      Entry:  No entry conditions
      Exit:   DE contains the standard X-coordinate  of the left edge
              and HL contains the standard  Y-coordinate of the right
              edge, AF  is  corrupt,  and  all  other  registers  are
              preserved

072   &BBD8   GRA GET W HEIGHT
      Action: Gets the top and bottom edges of the graphics window
      Entry:  No entry conditions
      Exit:   DE contains the standard  Y-coordinate  of the top edge
              and HL contains the standard Y-coordinate of the bottom
              edge, AF  is  corrupt,  and  all  other  registers  are
              preserved

073   &BBDB   GRA CLEAR WINDOW
      Action: Clears the graphics window to the graphics paper colour
              and moves the cursor back to the user origin
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

074   &BBDE   GRA SET PEN
      Action: Sets the graphics PEN
      Entry:  A contains the required text PEN number
      Exit:   AF is corrupt, and all other registers are preserved

075   &BBE1   GRA GET PEN
      Action: Gets the graphics PEN
      Entry:  No entry conditions
      Exit:   A contains the text PEN  number, the flags are corrupt,
              and all other registers are preserved

076   &BBE4   GRA SET PAPER
      Action: Sets the graphics PAPER
      Entry:  A contains the required text PEN number
      Exit:   AF corrupt, and all others are preserved

077   &BBE7   GRA GET PAPER
      Action: Gets the graphics PAPER
      Entry:  No entry conditions
      Exit:   A contains the text PEN  number, the flags are corrupt,
              and all others are preserved

078   &BBEA   GRA PLOT ABSOLUTE
      Action: Plots a point at an absolute user coordinate, using the
              GRA PLOT indirection

      Entry:  DE contains the user X-coordinate and HL holds the user
              Y-coordinate
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

079   &BBED   GRA PLOT RELATIVE
      Action: Plots a point at  a  position  relative  to the current
              graphics cursor, using the GRA PLOT indirection
      Entry:  DE contains the relative  X-coordinate  and HL contains
              the relative Y-coordinate
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

080   &BBF0   GRA TEST ABSOLUTE
      Action: Moves to an  absolute  position,  and  tests  the point
              there using the GRA TEST indirection
      Entry:  DE contains the user X-coordinate and HL holds the user
              Y-coordinate for the point you wish to test
      Exit:   A contains the pen at  the  point,  and  BC, DE, HL and
              flags are corrupt, and all others are preserved

081   &BBF3   GRA TEST RELATIVE
      Action: Moves to a position  relative  to the current position,
              and  tests  the  point   there   using   the  GRA  TEST
              indirection
      Entry:  DE contains the relative  X-coordinate  and HL contains
              the relative Y-coordinate
      Exit:   A contains the pen at  the  point,  and  BC, DE, HL and
              flags are corrupt, and all others are preserved

082   &BBF6   GRA LlNE ABSOLUTE
      Action: Draws a line from the  current  graphics position to an
              absolute position, using GRA LINE
      Entry:  DE contains the user X-coordinate and HL holds the user
              Y-coordinate of the end point
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  The line will be  plotted  in  the current graphics pen
              colour (may be masked  to  produce  a  dotted line on a
              6128)

083   &BBF9   GRA LINE RELATIVE
      Action: Draws a line from  the  current  graphics position to a
              relative screen position, using GRA LINE
      Entry:  DE contains the relative  X-coordinate  and HL contains
              the relative Y-coordinate
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  See GRA LINE ABSOLUTE above for details of how the line
              is plotted

084   &BBFC   GRA WR CHAR
      Action: Writes a  character  onto  the  screen  at  the current
              graphics position
      Entry:  A contains the character to be put onto the screen
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved
      Notes:  As in BASIC, all characters including control codes are
              printed; the character  is  printed  with  its top left
              comer at the  current  graphics  position; the graphics
              position is moved one character  width  to the right so
              that it is ready for another character to be printed

The Screen Pack

085   &BBFF   SCR INITIALISE
      Action: Initialises the Screen Pack to  the default values used
              when the computer is first switched on
      Entry:  No entry conditions

      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  All screen indirections are  restored  to their default
              settings, as are inks and  flashing speeds; the mode is
              switched to MODE 1 and  the  screen is cleared with PEN
              0; the screen address is moved  to &C000 and the screen
              offset is set to zero

086   &BC02   SCR RESET
      Action: Resets the Screen Pack's  indirections, flashing speeds
              and inks to their default values
      Entry:  No entry conditions
      Exit:   AF, BC, DE r1nd HL are corrupt, and all other registers
              are preserved

087   &BC05   SCR SET OFFSET
      Action: Sets the screen offset to  the  specified values - this
              can cause the screen to scroll
      Entry:  HL contains the required offset, which should be even
      Exit:   AF and HL are corrupt, and alI others are preserved
      Notes:  The screen offset is reset  to  0  whenever its mode is
              set, or it is  cleared  by  SCR  CLEAR (but not BASIC's
              CLS)

088   &BC08   SCR SET BASE
      Action: Sets the location in memory of the screen - effectively
              can only be &C000 or &4000
      Entry:  A contains the  most  significant  byte  of  the screen
              address required
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved
      Notes:  The screen memory can only be  set at 16K intervals (ie
              &0000, &4000, &8000, &C000)  and  when  the computer is
              first switched on the 16K  of  screen memory is located
              at &C000)

089   &BC0B   SCR GET LOCATION
      Action: Gets the location of  the  screen  memory  and also the
              screen offset
      Entry:  No entry conditions
      Exit:   A  holds  the  most  significant  byte  of  the  screen
              address, HL holds the  current  offset,  and all others
              are preserved

090   &BC0E   SCR SET MODE
      Action: Sets the screen mode
      Entry:  A contains the mode number -  it has the same value and
              characteristics as in BASIC
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  The windows are set to  cover  the whole screen and the
              graphics origin is set to the bottom left corner of the
              screen; in addition, the current stream is set to zero,
              and the screen offset is zeroed

091   &BC11   SCR GET MODE
      Action: Gets the current screen mode
      Ently:  No entry conditions
      Exit:   If the mode is 0,  then  Carry  is true, Zero is false,
              and A contains 0;  if  the  mode  is  1,  then Carry is
              false, Zero is true, and A  contains  1; if the mode is
              2, then Carry is false,  Zero  is false, and A contains
              2; in all cases the other flags are corrupt and all the
              other registers are preserved

092   &BC14   SCR CLEAR
      Action: Clears the whole of the screen
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

093   &BC17   SCR CHAR LIMITS
      Action: Gets the size  of  the  whole  screen  in  terms of the
              numbers of characters that can be displayed
      Entry:  No entry conditions
      Exit:   B contains the number of  characters across the screen,
              C contains the number of characters down the screen, AF
              is corrupt, and all other registers are preserved

094   &BC1A   SCR CHAR POSITION
      Action: Gets the memory address  of  the  top  left corner of a
              specified character position
      Entry:  H contains the character physical column and L contains
              the character physical row
      Exit:   HL contains the memory address of the top left comer of
              the  character,  B  holds  the  width  in  bytes  of  a
              character in the present mode,  AF  is corrupt, and all
              other registers are preserved

095   &BC1D   SCR DOT POSITION
      Action: Gets the memory  address  of  a  pixel  at  a specified
              screen position
      Entry:  DE contains the base X-coordinate  of the pixel, and HL
              contains the base Y-coordinate
      Exit:   HL contains the memory address of the pixel, C contains
              the bit mask for this  pixel,  B contains the number of
              pixels stored in a byte minus 1, AF and DE are corrupt,
              and all others are preserved

096   &BC20   SCR NEXT BYTE
      Action: Calculates the screen address of  the byte to the right
              of the specified screen  address  (may  be  on the next
              line)
      Entry:  HL contains the screen address
      Exit:   HL holds the screen address of the byte to the right of
              the original screen address, AF  is corrupt, all others
              are preserved

097   &BC23   SCR PREV BYTE
      Action: Calculates the screen address of  the  byte to the left
              of the  specified  screen  address  (this  address  may
              actually be on the previous line)
      Entry:  HL contains the screen address
      Exit:   HL holds the screen address of  the byte to the left of
              the original address,  AF  is  corrupt,  all others are
              preserved

098   &BC26   SCR NEXT LINE
      Action: Calculates the screen  address  of  the  byte below the
              specified screen address Ently:  HL contains the screen
              address
      Exit:   HL contains the screen  address  of  the byte below the
              original screen address,  AF  is  corrupt,  and all the
              other registers are preserved

099   &BC29   SCR PREV LINE
      Action: Calculates the screen  address  of  the  byte above the
              specified screen address
      Entry:  HL contains the screen address
      Exit:   HL holds the  screen  address  of  the  byte  above the
              original address, AF  is  corrupt,  and  all others are
              preserved

100   &BC2C   SCR INK ENCODE
      Action: Converts a PEN to provide a mask which, if applied to a
              screen byte, will convert all of the pixels in the byte
              to the appropriate PEN
      Entry:  A contains a PEN number
      Exit:   A contains the encoded value of  the PEN, the flags are
              corrupt, and all other registers are preserved
      Notes:  The mask returned is  different  in  each of the screen
              modes

101   &BC2F   SCR INK DECODE
      Action: Converts a PEN mask into  the  PEN  number (see SCR INK
              ENCODE for the re~ erse process)
      Entry:  A contains the encoded value of the PEN
      Exit:   A contains the PEN number,  the  flags are corrupt, and
              all others are preserved

102   &BC32   SCR SET INK
      Action: Sets the colours of a PEN  - if the two values supplied
              are different then the colours will alternate (flash)
      Entry: A contains the PEN number,  B  contains the first colour,
              and C holds the second colour
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

103   &BC35   SCR GET INK
      Action: Gets the colours of a PEN
      Entry:  A contains the PEN nurnber
      Exit:   B contains the first colour, C holds the second colour,
              and AF, DE  and  HL  are  corrupt,  and  all others are
              preserved

104   &BC38   SCR SET BORDER
      Action: Sets the colours of the border - again if two different
              values are supplied, the border will flash
      Entry:  B contains the first colour,  and C contains the second
              colour
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

105   &BC3B   SCR GET BORDER
      Action: Gets the colours of the border
      Entry:  No entry conditions
      Exit:   B contains the first colour, C holds the second colour,
              and AF, DE  and  HL  are  corrupt,  and  all others are
              preserved

106   &BC3E   SCR SET FLASHING
      Action: Sets the  speed  with  which  the  border's  and  PENs'
              colours flash
      Entry:  H holds the time that the  first colour is displayed, L
              holds the time the second colour is displayed for
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved
      Notes:  The length  of  time  that  each  colour  is  shown  is
              measured in 1/5Oths of a  second,  and  a value of 0 is
              taken to mean 256 * 1/50 seconds - the default value is
              10 * 1/50 seconds

107   &BC41   SCR GET FLASHING
      Action: Gets the periods with which  the  colours of the border
              and PENs flash
      Entry:  No entry conditions
      Exit:   H holds the duration of  the  first colour, L holds the
              duration of the second colour,  AF  is corrupt, and all
              other registers are preserved  -  see  SCR SET FLASHING
              for the units of time used

108   &BC44   SCR FILL BOX
      Action: Fills an area of the  screen  with  an  ink - this only
              works for 'character-sized' blocks of screen
      Entry:  A contains the mask for the  ink  that is to be used, H
              contains the left hand colurnn  of  the area to fill, D
              contains the right hand column,  L  holds the top line,
              and E holds the bottom line of the area (using physical
              coordinates)

      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

109   &BC17   SCR FLOOD BOX
      Action: Fills an area of the  screen  with  an  ink - this only
              works for 'byte-sized' blocks of screen
      Entry:  C contains the  encoded  PEN  that  is  to  be used, HL
              contains the screen address of the top left hand corner
              of the area to fill, D  contains  the width of the area
              to be filled in bytes, and E contains the height of the
              area to be filled in screen lines
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  The whole of the  area  to  be  filled  must lie on the
              screen otherwise unpredictable results may occur

110   &BC4A   SCR CHAR INVERT
      Action: Inverts a character's colours; all  pixels in one PEN's
              colour are printed in  another  PEN's  colour, and vice
              versa
      Entry:  B contains  one  encoded  PEN,  C  contains  the  other
              encoded PEN, H contains the physical column number, and
              L contains the physical  line  number  of the character
              that is to be inverted
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  alI  the other
              registers are preserved

111   &BC4D   SCR HW ROLL
      Action: Scrolls the entire screen  up  or  down  by eight pixel
              rows (ie one character line)
      Entry:  B holds the  direction  that  the  screen  will roll, A
              holds the encoded PAPER which  the new line will appear
              in
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  This alters the screen  offset;  to  roll  down, B must
              hold zero, and to roll upwards B must be non-zero

112   &BCS0   SCR SW ROLL
      Action: Scrolls part of the screen  up  or  down by eight pixel
              lines - only for 'character-sized' blocks of the screen
      Entry:  B holds the direction to  roll  the screen, A holds the
              encoded PAPER which  the  new  line  will  appear in, H
              holds the left column of  the  area  to scroll, D holds
              the right colurnn, L holds  the  top  line, E holds the
              bottom line
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  The area of the screen is  moved by copying it; to roll
              down, B must hold zero, and  to  roll upwards B must be
              non-zero; this routine uses physical roordinates

113   &BC53   SCR UNPACK
      Action: Changes a character matrix from its eight byte standard
              form into a set of  pixel  masks which are suitable for
              the current mode - four *8  bytes are needed in mode 0,
              two *8 bytes in mode l, and 8 bytes in mode 2
      Entry:  HL contains the address of  the matrix, and DE contains
              the address where the masks are to be stored
      Exit:   AF. BC, DE and HL are  corrupt, and all other registers
              are preserved

114   &BC56   SCR REPACK
      Action: Changes a set of  pixel  masks  (for  the current mode)
              into a standard eight byte character matrix
      Entry:  A contains the  encoded  foreground  PEN  to be matched
              against (ie the PEN that is to be regarded as being set
              in the character), H holds  the  physical column of the
              character to be `repacked',  L  holds the physical line

              of the character, and  DE  contains  the address of the
              area where the character matrix will be built
      Exit:   AF, BC, DE amd HL are  corrupt,  and all the others are
              preserved

115   &BC59   SCR ACCESS
      Action: Sets the screen write mode for graphics
      Entry:  A contains the write mode (0=Fill, 1=XOR, 2=AND, 3=OR)
      Exit:   AF. BC, DE and HL are  corrupt, amd all other registers
              are preserved
      Notes:  The fill mode  means  that  the  ink  that plotting was
              requested in is the ink that  appears on the screen; in
              XOR mode, the specified ink  is  XORed with ink that is
              at that point on the  screen already before plotting; a
              simiIar situation occurs with the AND and OR modes

116   &BC5C   SCR PIXELS
      Action: Puts a pixel or pixels on  the screen regardless of the
              write mode specified by SCR ACCESS above
      Entry:  B contains the mask  of  the  PEN  to  be drawn with, C
              contains the  pixel  mask,  and  HL  holds  the  screen
              address of the pixel
      Exit:   AF is corrupt, amd all others are preserved

117   &BC5F   SCR HORIZONTAL
      Action: Draws a honzontal line on  the screen using the current
              graphics write mode
      Entry:  A contains  the  encoded  PEN  to  be  drawn  with,  DE
              contains the base  X-coordinate  of  the  start  of the
              line, BC contains  the  end  base  X-coordinate, and HL
              contains the base Y-coordinate
      Exit:   AF, BC, DE and HL  are  conupt, and all other registers
              are preserved
      Notes:  The start X-coordinate must  be  less  than  the end X-
              coordmate

118   &BC62   SCR VERTICAL
      Action: Draws a vertical line on  the  screen using the current
              graphics write mode
      Entry:  A contains  the  encoded  PEN  to  be  drawn  with,  DE
              contains the base X-coordinate  of  the  line, HL holds
              the start base Y-coordinate,  and  BC  contains the end
              base Y-coordinate - the  start  coordinate must be less
              than the end coordinate
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved

The Cassette/AMSDOS Manager

NOTE: Some of  these  routines  are  only  applicable  to the cassette
manager; where a disc version  exists  it  is indicated by an asterisk
(*) next to  the  command  name.   These  disc  version jumpblocks are
automatically installed by the Operating System on switch on.

119   &BC65   CAS INITIALISE
      Action: Initialises the cassette manager
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved
      Notes:  Both read and write  streams  are closed; tape messages
              are switched on; the default speed is reselected

120   &BC68   CAS SET SPEED
      Action: Sets the speed  at  which  the  cassette  manager saves
              programs
      Entry:  HL holds  the  length  of  'half  a  zero'  bit,  and A
              contains the amount of precompensation
      Exit:   AF and HL are corrupt
      Notes:  The value in HL is the length  of time that half a zero
              bit is written as; a one  bit  is twice the length of a
              zero bit; the default values (ie SPEED WRITE 0) are 333
              microseconds (HL) and  25  microseconds  (A)  for SPEED
              WRITE 1, the values are  given  as 107 microseconds and
              50 microseconds respectiveIy

121   &BC6B   CAS NOISY
      Action: Enables or disables  the  display  of cassette handling
              messages
      Entry:  To enable the messages then A  must be 0, otherwise the
              messages are disabled
      Exit:   AF is corrupt, and all other registers are preserved

122   &BC6E   CAS START MOTOR
      Action: Switches on the tape motor
      Entry:  No entry conditions
      Exit:   If the motor operates properly  then  Carry is true; if
              ESC was pressed then Carry is  false; in either case, A
              contains the  motor's  previous  state,  tbe  flags are
              corrupt, and all others are preserved

123   &BC71   CAS STOP MOTOR
      Action: Switches off the tape motor
      Entry:  No entry conditions
      Exit:   If the motor turns off then  Carry  is true; if ESC was
              pressed then Carry is false; in both cases, A holds tbe
              motor's previous state,  the  other  flags are corrupt,
              all others are preserved

124   &BC74   CAS RESTORE MOTOR
      Action: Resets the tape motor to its previous state
      Entry:  A contains the previous state of the motor (eg from CAS
              START MOTOR or CAS STOP MOTOR)
      Exit:   If the motor operates properly  then  Carry is true; if
              ESC was pressed then Carry  is  false;  in all cases, A
              and the other  flags  are  corrupt  and  all others are
              preserved

125   &BC77   *CAS IN OPEN
      Action: Opens an input buffer and reads  the first block of the
              file
      Entry:  B contains the length of  the filename, HL contains the
              filename's address, and DE contains  the address of the
              2K buffer to use for reading the file
      Exit:   If the file  was  opened  successfully,  then  Carry is
              true, Zero is false, HL  holds  the address of a buffer
              contauling the file header  data,  DE holds the address
              of the destination  for  the  file,  BC  holds the file
              length, and A holds the  file  type; if the read stream
              is already  open  then  Carry  and  Zero  are  false, A
              contains an error nurnber  (664/6128  only)  and BC, DE
              and HL are corrupt;  if  ESC  was  pressed by the user,
              then Carry is false,  Zero  is  true,  A holds an error
              number (664/6128 only) and BC,  DE  and HL are corrupt;
              in all cases, IX and  the  other flags are corrupt, and
              the others are preserved
      Notes:A filename of zero length  means  'read  the neXt file on
              the tape'; the stream remains  open  until it is closed
              by either CAS IN CLOSE or CAS IN ABANDON
      Disc:   Similar to tape except that  if  there  is no header on
              the file, then a fake header is put into memory by this
              routine

126   &BC7A   *CAS IN CLOSE
      Action: Closes an input file
      Entry:  No entry conditions
      Exit:   If the file was closed successfully, then Carry is true
              and A is corrupt; if the read stream was not open, then
              Carry is false, and  A  holds  an  error code (664/6128
              only); in both cases, BC,  DE,  HL  and the other flags
              are all corrupt
      Disc:   All the above applies, but  also  if the file failed to
              close for any other reason,  then  Carry is false, Zero
              is true and A contains  an  error  number; in all cases
              the drive motor is turned off immediately

127   &BC7D   *CAS IN ABANDON
      Action: Abandons an input file
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Disc:   All the above applies for the disc routine

128   &BC80   *CAS IN CHAR
      Action: Reads in a single byte from a file
      Entry:  No entry conditions
      Exit:   If a byte was read, then  Carry is true, Zero is false,
              and A contains the byte read  from the file; if the end
              of file was reached, then  Carry  and Zero are false, A
              contains an error number (664/6128  only) or is corrupt
              (for the 464); if ESC was pressed, then Carry is false,
              Zero is true, and  A  holds  an  error number (664/6128
              only) or is corrupt (for the 464); in all cases, IX and
              the  other  flags  are  corrupt,  and  all  others  are
              preserved
      Disc:   All the above applies for the disc routine

129   &BC83   *CAS IN DIRECT
      Action: Reads an entire file directly into memory
      Entry:  HL contains the address where the file is to be  placed
              in RAM
      Exit:   If the operation was  successful,  then  Carry is true,
              Zero is false, HL contains  the  entry address and A is
              corrupt; if it was not  open,  then  Carry and Zero are
              both false, HL is corrupt,  and  A  holds an error code
              (664/6128) or is  corrupt  (464);  if  ESC was pressed,
              Carry is false, Zero  is  true,  HL  is  corrupt, and A
              holds an error code (664/6128  only); in all cases, BC,
              DE and IX and  the  other  flags  are  corrupt, and the
              others are preserved
      Notes:  This routine cannot be used  once  CAS IN CHAR has been
              used
      Disc:   All the above applies to the disc routine

130   &BC86   *CAS RETURN
      Action: Puts the last byte read  back  into the input buffer so
              that it can be read again at a later time
      Entry:  No entry conditions
      Exit:   All registers are preserved
      Notes:  The routine can only return  the  last byte read and at
              least one byte must have been read
      Disc:   All the above applies to the disc routine

131   &BC89   *CAS TEST EOF
      Action: Tests whether the end of file has been encountered
      Entry:  No entry conditions
      Exit:   If the end of  file  has  been  reached, then Carry and
              Zero are false, and A  is  corrupt;  if the end of file
              has not been encountered, then  Carry  is true, Zero is
              false, and A is corrupt; if  ESC was pressed then Carry
              is false, Zero is true  and  A contains an error number
              (664/6128 only); in all cases,  IX  and the other flags
              are corrupt, and all others are preserved
      Disc:   All the above applies to the disc routine

132   &BC8C   *CAS OUT OPEN
      Action: Opens an output file
      Entry:  B contains the length of  the filename, HL contains the
              address of the filename,  and  DE  holds the address of
              the 2K buffer to be used

      Exit:   If the file was opened  correctly,  then Carry is true,
              Zero is false,  HL  holds  the  address  of  the buffer
              containing the file header data that will be written to
              each block, and A is  corrupt;  if  the write stream is
              already open, then Carry and Zero are false, A holds an
              error nurnber (66~/6128) and HL  is corrupt; if ESC was
              pressed then Carry is false,  Zero  is true, A holds an
              error number  (664/6128)  and  HL  is  corrupt;  in all
              cases, BC, DE, IX and the  other flags are corrupt, and
              the others are preserved
      Notes:  The buffer is used  to  store  the  contents  of a file
              block before it is actually written to tape
      Disc:   The same as for tape  except  that the filename must be
              present in its usual AMSDOS format

133   &BC8F   *CAS OUT CLOSE
      Action: Closes an output file
      Entry:  No entry conditions
      Exit:   If the file  was  closed  successfully,  then  Carry is
              true, Zero is false,  and  A  is  corrupt; if the write
              stream was not open, then Carry  and Zero are false and
              A holds an  error  code  (664/6128  only);  if  ESC was
              pressed then  Carry  is  false,  Zero  is  true,  and A
              contains an error code  (664/6128  only); in all cases,
              BC, DE, HL, IX and the other flags are all corrupt
      Notes:  The last block of  a  file  is  written  only when this
              routine is  called;  if  writing  the  file  is  to  be
              abandoned, then CAS OUT ABANDON should be used instead
      Disc:   All the above applies to the disc routine

134   &BC92   *CAS OUT ABANDON
      Action: Abandons an output file
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  When using this routine, the  current last block of the
              file is not written to the tape
      Disc:   Similar to the tape routine; if more than 16K of a file
              has been written to the disc, then the first 16K of the
              file will exist on the  disc  with  a file extension of
              .$$$ because each 16K  section  of  the file requires a
              separate directory entry

135   &BC95   *CAS OUT CHAR
      Action: Writes a single byte to a file
      Entry:  A contains the byte to  be  written  to the file output
              buffer
      Exit:   If a byte was  written  to  the  buffer,  then Carry is
              true, Zero is false, and A  is corrupt; if the file was
              not open, then Carry and Zero are false, and A contains
              an error number (664/6128 only)  or  is corrupt (on the
              464); if ESC was pressed, then  Carry is false, Zero is
              true, and A contains an error number (664/6128 only) or
              it is corrupt (on the  464);  in  all cases, IX and the
              other flags are corrupt, and all others are preserved
      Notes:  If the 2K buffer is full of  data then it is written to
              the tape before  the  new  character  is  placed in the
              buffer; it is important to call  CAS OUT CLOSE when all
              the data has been sent  to  the  file  so that the last
              block is written to the tape
      Disc:   All the above applies to the disc routine

136   &BC98   *CAS OUT DIRECT
      Action: Writes an entire file directly to tape
      Entry:  HL contains the address  of  the  data  which  is to be
              written to tape, DE contains  the  length of this data,
              BC contains the e~ecution  address,  and A contains the
              file type
      Exit:   If the operation was  successful,  then  Carry is true,
              Zero is false, and A  is  corrupt;  if the file was not
              open, Carry and Zero are false, A holds an error number
              (664/6128) or is  corrupt  (464);  if  ESC was pressed,
              then Carry is false, Zero is true, and A holds an error
              code (664/6128 only); in all  cases  BC, DE, HL, IX and
              the  other  flags  are  corrupt,  and  the  others  are
              preserved
      Notes:  This routine cannot be used once  CAS OUT CHAR has been
              used
      Disc:   All the above applies to the disc routine

137   &BC9B   *CAS CATALOG
      Action: Creates a catalogue of all the files on the tape
      Entry:  DE contains the address of the  2K buffer to be used to
              store the information
      Exit:   If the operation was  successful,  then  Carry is true,
              Zero is false, and A is  corrupt; if the read stream is
              already being used, then Carry  and Zero are false, and
              A holds an error code (664/6128  or is corrupt (for the
              464); in all cases, BC, DE,  HL, IX and the other flags
              are corrupt and all others are preserved
      Notes:  This routine is only left  when  the ESC key is pressed
              (cassette only) and is identical to BASIC's CAT command
      Disc:   All tbe above applies,  except  that  a  sorted list of
              files is displayed; system files are not listed by this
              routine

138   &BC9E   CAS WRITE
      Action: Writes data to the tape in one  long file (ie not in 2K
              blocks)
      Entry:  HL contains the address of  the  data  to be written to
              tape, DE contains the length of the data to be written,
              and A contains the sync character
      Exit:   If the operation was successful, then Carry is true and
              A is corrupt; if an error  occurred then Carry is false
              and A contains an error code; in both cases, BC, DE, HL
              and  lX  are  corrupt,  and  all  other  registers  are
              preserved
      Notes:  For header records the sync  character  is &2C, and for
              data it is  &16;  this  routine  starts  and  stops the
              cassette motor  and  also  tums  off  interrupts whilst
              writing data

139   &BCA1   CAS READ
      Action: Reads data from  the  tape  in  one  long  file  (ie as
              originally written by CAS WRITE only)
      Entry:  HL holds the address to  place  the  file, DE holds the
              length of the  data,  and  A  holds  the  expected sync
              character
      Exit:   If the operation was successful, then Carry is true and
              A is corrupt; if an error  occurred then Carry is false
              and A contains an error code; in both cases, BC, DE, HL
              and  IX  are  corrupt,  and  all  other  registers  are
              preserved
      Notes:  For header records the sync  character  is &2C, and for
              data it is  &16;  this  routine  starts  and  stops the
              cassette motor and turns  off interrupts whilst reading
              data

140   &BCA4   CAS CHECK
      Action: Compares the contents of memory  with a file record (ie
              header or data) on tape
      Entry:  HL contains  the  address  of  the  data  to  check, DE
              contains the length of the  data  and  A holds the sync
              character that was used  when  the  file was originally
              written to the tape
      Exit:   If the two are identical, then  Carry  is true and A is
              corrupt; if an error occurred then Carry is false and A
              holds an error code; in all  cases,  BC, DE, HL, IX and
              other flags are corrupt,  and  all  other registers are
              preserved
      Notes:  For header records the sync  character  is &2C, and for
              data it is  &16;  this  routine  starts  and  stops the
              cassette motor and turns  off interrupts whilst reading
              data; does not have to read  the whole of a record, but
              must start at the beginning

The Sound Manager

141   &BCA7   SOUND RESET
      Action: Resets the sound manager  by  clearing the sound queues
              and abandoning any current sounds
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

142   &BCAA   SOUND QUEUE
      Action: Adds a sound to the sound queue of a channel
      Entry:  HL contains the  address  of  a  series  of bytes which
              define the sound and are  stored  in the central 32K of
              RAM
      Exit:   If the sound was successfully  added to the queue, then
              Carry is true and HL  is  corrupt;  if one of the sound
              queues  was  full,  then  Carry  is  false  and  HL  is
              preserved; in either case, A, BC,  DE, IX and the other
              flags are corrupt, and all others are preserved
      Notes:  The bytes required to define  the sound are as follows:
              byte 0 - channel status byte
              byte 1 - volume envelope to use
              byte 2 - tone envelope to use
              bytes 3&4 - tone period
              byte 5 - noise period
              byte 6 - start volume
              bytes 7&8 - duration of  the  sound, or envelope repeat
              count

143   &BCAD   SOUND CHECK
      Action: Gets the status of a sound channel
      Entry:  A contains the channel to test  -  for channel A, bit 0
              set; for channel B, bit 1 set; for channel C, bit 2 set
      Exit:   A contains the channel status, BC, DE, HL and flags are
              corrupt, and all others are preserved
      Notes:  The channel  status  returned  is  bit  significant, as
              follows:
              bits 0 to 2  - the  number  of free spaces in the sound
              queue
              bit 3 - trying to rendezvous with channel A
              bit 4 - trying to rendezvous with channel B
              bit 5 - trying to rendezvous with channel C
              bit 6 - holding the channel
              bit 7 - producing a sound

144   &BCB0   SOUND ARM EVENT
      Action: Sets up an event which  will  be activated when a space
              occurs in a sound queue
      Entry:  A contains the channel  to  set  the  event up for (see
              SOUND CHECK for the bit  values  this can take), and HL
              holds the address of the event block
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  The event block must  be  initialised  by KL INIT EVENT
              and is disarmed when the event itself is run

145   &BCB3   SOUND RELEASE
      Action: Allows the playing of sounds  on specific channels that
              had been stopped by SOUND HOLD
      Entry:  A contains the sound channels to be released (see SOUND
              CHECK for the bit values this can take)
      Exit:   AF, BC, DE, HL and IX  are  corrupt, and all others are
              preserved

146   &BCB6   SOUND HOLD
      Action: Immediately stops all sound output (on all channels)
      Entry:  No entry conditions
      Exit:   If a sound was being  made,  then  Carry is true; if no
              sound was being  made,  then  Carry  is  false;  in all
              cases, A, BC, HL and  other  flags are corrupt, and all
              others are preserved
      Notes:  When the sounds  are  restarted,  they  will begin from
              exactly the same place that they were stopped

147   &BCB9   SOUND CONTINUE
      Action: Restarts all sound output (on all channels)
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  IX  are  corrupt,  and  all others are
              preserved

148   &BCBC   SOUND AMPL ENVELOPE
      Action: Sets up avolume envelope
      Entry:  A holds an envelope number (from 1 to 15), HL holds the
              address of a block of data for the envelope
      Exit:   If it was set up properly,  Carry is true, HL holds the
              data block address + 16, A  and  BC are corrupt; if the
              envelope number is invalid, then Carry is false, and A,
              B and HL are  preserved;  in  either  case,  DE and the
              other flags are corrupt,  and  all  other registers are
              preserved
      Notes:  All the rules of  enevelopes  in  BASIC also apply; the
              block of  the  data  for  the  envelope  is  set  up as
              follows:
              byte 0 - number of sections in the envelope
              bytes 1 to 3 - first section of the envelope
              bytes 4 to 6 - second section of the envelope
              bytes 7 to 9 - third section of the envelope
              bytes 10 to 12 - fourth section of the envelope
              bytes 13 to 15 - fifth section of the envelope
              Each section of the envelope has three bytes set out as
              follows:
              byte 0 - step count (with bit 7 set)
              byte 1 - step size
              byte 2 - pause time
              or if it  is  a  hardware  envelope,  then each section
              takes the following form:
              byte 0 - envelope shape (with bit 7 not set)
              bytes 1 and 2 - envelope period
              See also SOUND TONE ENVELOPE below

149   &BCBF   SOUND TONE ENVELOPE
      Action: Sets up a tone envelope
      Entry:  A holds an envelope number (from 1 to 15), HL holds the
              address of a block of data for the envelope
      Exit:   If it was set up properly,  Carry is true, HL holds the
              data block address + 16, A and BC are corrupt; ¡ if the
              envelope number is invalid, then Carry is false, and A,
              B and HL are  preserved;  in  either  case,  DE and the
              other flags are corrupt,  and  all  other registers are
              preserved
      Notes:  All the rules of  envelopes  in  BASIC  also apply; the
              block of  the  data  for  the  envelope  is  set  up as
              follows:
              byte 0 - number of sections in the envelope
              bytes 1 to 3 - first section of the envelope
              bytes 4 to 6 - second section of the envelope
              bytes 7 to 9 - third section of the envelope
              bytes 10 to 12 - fourth section of the envelope
              bytes 13 to 15 - fifth section of the envelope
              Each section of the envelope has three bytes set out as
              follows:
              byte 0 - step count
              byte 1 - step size
              byte 2 - pause time
              See also SOUND AMPL ENVELOPE above

150   &BCC2   SOUND A ADDRESS
      Action: Gets the address of  the  data  block associated with a
              volume envelope
      Entry:  A contains an envelope number (from 1 to 15)
      Exit:   If it was found, then Carry  is true, HL holds the data
              block's address,  and  BC  holds  its  length;  if  the
              envelope number is invalid, then  Carry is false, HL is
              corrupt and BC is preserved;  in  both cases, A and the
              other flags are corrupt, and all others are preserved

151   &BCC5   SOUND T ADDRESS
      Action: Gets the address of  the  data  block associated with a
              tone envelope
      Entry:  A contains an envelope number (from 1 to 15)
      Exit:   If it was found, then Carry  is true, HL holds the data
              block's address,  and  BC  holds  its  length;  if  the
              envelope number is invalid, then  Carry is false, HL is
              corrupt and BC is preserved;  in  both cases, A and the
              other flags are corrupt, and all others are preserved

The Kernel

152   &BCC8   KL CHOKE OFF
      Action: Clears all  event  queues  and  timer  lists,  with the
              exception of keyboard scanning and sound routines
      Entry:  No entry conditions
      Exit:   B contains the foreground ROM  select address (if any),
              DE contains the  ROM  entry  address,  C  holds the ROM
              select address for a RAM  foreground program, AF and HL
              are corrupt, and all others are preserved

153   &BCCB   KL ROM WALK
      Action: Finds and initialises all background ROMs
      Entry:  DE holds  the  address  of  the  first  usable  byte of
              memory, HL holds the address of the last usable byte
      Exit:   DE holds the address of  the  new  first usable byte of
              memory, HL holds the  address  of  the  new last usable
              byte, AF and BC  are  corrupt,  and all other registers
              are preserved
      Notes:  This routine looks at the  ROM  select addresses from 0
              to l5 (1 to 7 for the 464) and calls the initialisation
              routine of any ROMs present; these routines may reserve
              memory by adjusting DE and  HL before returning control
              to KL ROM WALK, and the  ROM  is then added to the list
              of command handling routines

154   &BCCE   KL INIT BACK
      Action: Finds and initialises a specific background ROM
      Entry:  C contains the ROM select address  of the ROM, DE holds
              the address of  the  first  usable  byte  of memorv, HL
              holds the address of the last usable byte of memory
      Exit:   DE holds the address  of  the  new  first usaUe byte of
              memory, HL holds the  address  of  the  new last usable
              byte.  AF and B  are  corrupt,  and all other registers
              are preserved
      Notes:  The ROM select address must be in  the range of 0 to 15
              (or 1 to 7 for the  464)  although address 7 is tor the
              AMSDOS/CPM ROM if  present.   The  ROM's initialisation
              routine is then called and  some memory may be reserved
              for the ROM by adjusting the values of DE and HL before
              returning control to KL INlT BACK

155   &BCD1   KL LOG EXT
      Action: Logs on a new RSX to the firmware
      Entry:  BC contains the address of  the RSX's command table, HL
              contains the address of four  bytes exclusively for use
              by the firmware
      Exit:   DE is corrupt, and all other registers are preserved

156   &BCD4   KL FIND COMMAND
      Action: Searches an RSX, background  ROM  or foreground ROM, to
              find a command in its table
      Entry:  HL contains the address  of  the  command  name (in RAM
              only) which is being searched for
      Exit:   If the narne was found in  a RSX or background ROM then
              Carry is true, C contains  the  ROM select address, and
              HL contains the address of  the routine; if the command
              was not found,  then  Carry  is  false,  C  and  HL are
              corrupt; in either case, A,  B  and DE are corrupt, and
              all others are preserved
      Notes:  The command names should be in  upper case and the last
              character should have &80 added  to it; the sequence of
              searching is RSXs, then ROMs  with lower numbers before
              ROMs with higher numbers

157   &BCD7   KL NEW FRAME FLY
      Action: Sets up a frame flyback event block which will be acted
              on whenever a frame flyback occurs
      Entry:  HL contains the  address  of  the  event  block  in the
              central 32K of  RAM,  B  contains  the  event class.  C
              contains the  ROM  select  address  (if  any),  and  DE
              contains the address if the event routine
      Exit:   AF, DE and HL are corrupt,  and all other registers are
              preserved

158   &BCDA   KL ADD FRAME FLY
      Action: Adds an existing but deleted  frame flyback event block
              to the list of routines run when a frame flyback occurs
      Entry:  HL contains the  address  of  the  event  block (in the
              central 32K of RAM)
      Exit:   AF, DE and HL are corrupt, and all others are preserved

159   &BCDD   KL DEL FRAME FLY
      Action: Removes a frame flyback  event  block  from the list of
              routines which are mn when a frame flyback occurs
      Entry:  HL contains the address of the event block
      Exit:   AF, DE and HL are corrupt, and all others are preserved

160   &BCE0   KL NEW FAST TICKER
      Action: Sets up a fast  ticker  event  block  which will be run
              whenever the l/300th second ticker interrupt occurs
      Entry:  HL contains the  address  of  the  event  block (in the
              central 32K of  RAM),  B  contains  the  event class, C
              contains the  ROM  select  address  (if  any),  and  DE
              contains the address of the event routine
      Exit:   AF, DE and HL are corrupt,  and all other registers are
              preserved

161   &BCE3   KL ADD FAST TICKER
      Action: Adds an existing but deleted fast ticker event block to
              the list of routines which are run when the l/300th sec
              ticker interrupt occurs
      Entry:  HL contains the address of the event block
      Exit:   AF, DE and HL are corrupt,  and all the other registers
              are preserved

162   &BCE6   KL DEL FAST TICKER
      Action: Removes a fast  ticker  event  block  from  the list of
              routines run  when  the  l/300th  sec  ticker interrupt
              occurs
      Entry:  HL contains the address of the event block
      Exit:   AF, DE and HL are corrupt, and all others are preserved

163   &BCE9   KL ADD TICKER
      Action: Sets up a ticker event block which will be run whenever
              a 1/50th second ticker interrupt occurs
      Entry:  HL contains the  address  of  the  event  block (in the
              central 32K of RAM), DE  contains the initial value for
              the counter, and BC  holds  the  value that the counter
              will be given whenever it reaches zero
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved
      Notes:  Every 1/50th of a second all the tick blocks are looked
              at and  their  counter  is  decreased  by  1;  when the
              counter reaches zero,  the  event  is  'kicked' and the
              counter is loaded with the value  in BC; any tick block
              with a counter of 0  is  ignored,  and therefore if the
              value in BC is 0,  the  event  will be kicked only once
              and ignored after that

164   &BCEC   KL DEL TICKER
      Action: Removes a ticker event block  from the list of routines
              that are run when a l/50th sec ticker interrupt occurs
      Entry:  HL contains the address of the event block
      Exit:   If the event block was  found,  then Carry is true, and
              DE holds the value  remaining  of  the  counter; if the
              event block was not found, then  Carry is false, and DE
              is corrupt; in both cases,  A,  HL  and the other flags
              are corrupt, and all other registers are preserved

165   &BCEF   KL INIT EVENT
      Action: Initialises an event block
      Entry:  HL contains the  address  of  the  event  block (in the
              central 32K of RAM), B contains the class of event, and
              C contains the ROM  select  address,  and  DE holds the
              address of the event routine
      Exit:   HL holds the  address  of  the  event  block+7, and all
              other registers are preserved
      Notes:  The event class is derived as follows:
              bit 0 -indicates a near address
              bits 1 to 4 - hold the synchronous event priority
              bit 5 - always zero
              bit 6 - if bit 6 is set, then it is an express event
              bit 7 - if bit  7  is  set,  then it is an asynchronous
              event.  Asynchronous events do  not have priorities; if
              it is an  express  asynchronous  event,  then its event
              routine is called from the  interrupt  path; if it is a
              normal asynchronous event,  then  its  event routine is
              called just before returning from  the interrupt; if it
              is an express synchronous event,  then  it has a higher
              priority than normal synchronous events, and it may not
              be disabled through use  of  KL  EVENT  DISABLE; if the
              near address bit is set, then the routine is located in
              the central 32K  of  RAM  and  is  called  directly, so
              saving time; no event may have a priority of zero

166   &BCF2   KL EVENT
      Action: Kicks an event block
      Ently:  HL contains the address of the event block
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

167   &BCF5   KL SYNC RESET
      Action: Clears the synchronous event queue
      Entry:  No entry conditions
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved
      Notes:  When using this routine, all events that are waiting to
              be dealt with are simply discarded

168   &BCF8   KL DEL SYNCHRONOUS
      Action: Removes a synchronous event from the event queue
      Entry:  HL contains the address of the event block
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

169   &BCFB   KL NEXT SYNC

      Action: Finds out if there is a synchronous event with a higher
              priority
      Entry:  No entry conditions
      Exit:   If there is an  event  to  be  processed, then Carry is
              true, HL contains the address of the event block, and A
              contains the priority of  the  previous event; if there
              is no event to be processed, then Carry is false, and A
              and HL are corrupt; in either  case, DE is corrupt, and
              all other registers are preserved

170   &BCFE   KL DO SYNC
      Action: Runs a synchronous event routine
      Entry:  HL contains the address of the event block
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  See KL DONE SYNC below

171   &BD01   KL DONE SYNC
      Action: Finishes running a synchronous event routine
      Entry:  A contains the priority of  the  previous event, and HL
              contains the address of the event block
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  When an event that is waiting  to be processed has been
              found by KL NEXT SYNC, the  event routine should be run
              by KL DO SYNC; after this KL DONE SYNC should be called
              so that the event  counter  can  be  decreased - if the
              counter is greater than zero  then  the event is placed
              back on the synchronous event queue

172   &BD04   KL EVENT DISABLE
      Action: Disables norrnal synchronous events
      Entry:  No entry conditions
      Exit:   HL is corrupt, and all other registers are preserved

173   &BD07   KL EVENT ENABLE
      Action: Enables normal synchronous events
      Entry:  No entry conditions
      Exit:   HL is corrupt, and all other registers are preserved

174   &BD0A   KL DISARM EVENT
      Action: Disarrns a specific event and stops it from occurring
      Entry:  HL contains the address of the event block
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  This routine should be used to disarm only asynchronous
              events; see also KL DEL SYNCHRONOUS

175   &BD0D   KL TIME PLEASE
      Action: Returns the time that  has  elapsed  since the computer
              was switched on or reset (in 1/300ths of a second)
      Entry:  No entry conditions
      Exit:   DEHL contains the four byte  count of the time elapsed,
              and all other registers are preserved
      Notes:  D holds the most signifilcant byte of the time elapsed,
              and L holds the least  significant; the four byte count
              overflows after approximately l66 days have elapsed.

176   &BD10   KL TIME SET
      Action: Sets the elapsed time (in l¡300ths of a second)
      Entry:  DEHL contains the four byte count of the time to set
      Exit:   AF is corrupt, and all other registers are preserved

The Machine Pack

177   &BD13   MC BOOT PROGRAM
      Action: Loads a program into RAM and then executes it
      Entry:  HL contains the address of the routine which is used to
              load the program
      Exit:   Control is  handed  over  to  the  program  and  so the
              routine is not returned from
      Notes:  All events, sounds and  interrupts  are turned off, the
              fiImware indirections  are  returned  to  their default
              settings, and the stack  is  reset;  the routine to run
              the program should be in  the  central block of memory,
              and should obey the  following  exit conditions: if the
              program was loaded  successfully,  then  Carry is true,
              and HL  contains  the  prograrn  entry  point;  if  the
              program failed to load, then Carry  is false, and HL is
              corrupt; in either case,  A,  BC,  DE,  IX,  IY and the
              other flags are all corrupt  Should the program fail to
              load, control is  returned  to  the previous foreground
              program

178   &BD16   MC START PROGRAM
      Action: Runs a foreground program
      Entry:  HL contains the  entry  point  for  the  program, and C
              contains the ROM selection number
      Exit:   Control is handed  over  to  the  prograrn  and  so the
              routine is not returned from

179   &BD19   MC WAIT FLYBACK
      Action: Waits until a frame flyback occurs
      Entry:  No entry conditions
      Exit:   All registers are preserved
      Notes:  When the frame flyback occurs  the  screen is not being
              written to and so the  screen c~n be manipulated during
              this period without any  flickering  or ghosting on the
              screen

180   &BD1C   MC SET MODE
      Action: Sets the screen mode
      Entry:  A contains the required mode
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  Although this routine changes  the  screen mode it does
              not inform the routines which  write to the screen that
              the mode has  been  changed;  therefore  these routines
              will write to the screen  as  if  the mode had not been
              changed; however as  the  hardware  is now interpreting
              these signals differently, unusual effects may occur

181   &BD1F   MC SCREEN OFFSET
      Action: Sets the screen offset
      Entry:  A contains the screen base,  and HL contains the screen
              offset
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  As with MC SET MODE,  this routine changes the hardware
              setting without telling the routines  that write to the
              screen; therefore these  routines  may cause unpredict-
              able effects if called; the default screen base is &C0

182   &BD22   MC CLEAR INKS
      Action: Sets all the PENs  and  the  border  to  one colour, so
              making it seem as if the screen has been cleared
      Entry:  DE contains the address of the ink vector
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  The ink vector takes the following form:
              byte 0 - holds the colour for the border
              byte 1 - holds  the  colour  for  all  of  the PENs The
              values for the colours are all given as hardware values

183   &BD25   MC SET INKS
      Action: Sets the colours of all the PENs and the border
      Entry:  DE contains the address of the ink vector
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  The ink vector takes the following form:
              byte 0 - holds the colour for the border
              byte 1 - holds the colour for PEN 0...
              ... byte 16 - holds the colour for PEN 15
              The values for the  colours  are  all given as hardware
              values; the routine sets all sixteen PEN's

184   &BD28   MC RESET PRINTER
      Action: Sets the MC WAIT  PRINTER  indirection  to its original
              routine
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved

185   &BD2B   MC PRINT CHAR
      Action: Sends a character to the  printer  and detects if it is
              busy for too long (more than 0.4 seconds)
      Entry:  A contains the character to  be  printed - only charac-
              ters upto ASCII 127 can be printed
      Exit:   If the character was sent properly, then Carry is true;
              if the printer was busy, then Carry is false; in either
              case, A and the other flags  are corrupt, and all other
              registers are preserved
      Notes:  This routine uses the MC WAIT PRINTER indirection

186   &BD2E   MC BUSY PRINTER
      Action: Tests to see if the printer is busy
      Entry:  No entry conditions
      Exit:   If the printer is  busy,  then  Carry  is  true; if the
              printer is not  busy,  then  Carry  is  false;  in both
              cases, the  other  flags  are  corrupt,  and  all other
              registers are preserved

187   &BD31   MC SEND PRINTER
      Action: Sends a character to  the  printer,  which  must not be
              busy
      Entry:  A contains tlle character to  be printed - only charac-
              ters up to ASCII 127 can be printed
      Exit:   Carry is true, A and  the  other flags are corrupt, and
              all other registers are preserved

188   &BD34   MC SOUND REGISTER
      Action: Sends data to a sound chip register
      Entry:  A contains the  register  nurnber,  and  C contains the
              data to be sent
      Exit:   AF and BC  are  corrupt,  and  all  other registers are
              preserved

189   &BD37   JUMP RESTORE
      Action: Restores the jumpblock to its default state
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  This routine does  not  affect  the  indirections jump-
              block, but restores all entries in the main jumpblock


190   &BD3A   KM SET LOCKS
      Action: Turns the shift and caps locks on and off
      Entry:  H contains the  caps  lock  state,  and  L contains the
              shift lock state
      Exit:   AF is corrupt, and all others are preserved
      Notes:  In this routine, &00  means  turned  off, and &FF means
              turned on

191   &BD3D   KM FLUSH
      Action: Empties the key buffer
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  This routine also discards any current expansion string

192   &BD40   TXT ASK STATE
      Action: Gets the VDU and cursor state
      Entry:  No entry conditions

      Exit:   A contains the  VDU  and  cursor  state,  the flags are
              corrupt, and all others are preserved
      Notes:  The value in  the  A  register  is  bit significant, as
              follows:
              if bit 0 is set, then the cursor is disabled, otherwise
              it is enabled
              if bit  1  is  set,  then  the  cursor  is  turned off,
              otherwise it is on
              if bit 7 is set, then  the VDU is enabled, otherwise it
              is disabled

193   &BD43   GRA DEFAULT
      Action: Sets the graphics VDU to its default mode
      Entry:  No entry conditions
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  Sets the background to opaque,  the first point of line
              is plotted, lines aren't dotted,  and the write mode is
              force

194   &BD46   GRA SET BACK
      Action: Sets the graphics background  mode  to either opaque or
              transparent
      Entry:  A holds zero if opaque mode  is wanted, or holds &FF to
              select transparent mode
      Exit:   All registers are preserved

195   &BD49   GRA SET FIRST
      Action: Sets whether the first point  of  a  line is plotted or
              not
      Entry:  A holds zero if the first  point  is not to be plotted,
              or holds &FF if it is to be plotted
      Exit:   All registers are preserved

196   &BD4C   GRA SET LINE MASK
      Action: Sets how the points in a  line are plotted - ie defines
              whether a line is dotted or not
      Entry:  A contains the line mask that will be used when drawing
              lines
      Exit:   All registers are preserved
      Notes:  The first point in the line corresponds to bit 7 of the
              line mask and after bit 0 the mask repeats; if a bit is
              set then that point will be plotted; the mask is always
              applied from left to right, or from bottom to top

197   &BD4F   GRA FROM USER
      Action: Converts user coordinates into base coordinates
      Entry:  DE contains the user X  coordinate, and HL contains the
              user Y coordinate
      Exit:   DE holds the base X coordinate, and HL holds the base Y
              coordinate, AF is corrupt, and all others are preserved

198   &BD52   GRA FILL
      Action: Fills an area of the  screen  starting from the current
              graphics position and extending until it reaches either
              the edge of the window or a pixel set to the PEN
      Entry:  A holds a PEN to fill with, HL holds the address of the
              buffer, and DE holds the length of the buffer
      Exit:   If the area was filled properly, then Carry is true; if
              the area was not filled, then Carry is false; in either
              case, A, BC, DE, HL  and  the  other flags are corrupt,
              and all others are preserved
      Notes:  The buffer is  used  to  store  complex  areas to fill,
              which are remembered and  filled  when  the basic shape
              has been done;  each  entry  in  the  buffer uses seven
              bytes and so the more complex  the shape the larger the
              buffer; if it runs out of  space to store these complex
              areas, it will fill what  it  can  and then return with
              Carry false

199   &BD55   SCR SET POSITION
      Action: Sets the screen  base  and  offset  without telling the
              hardware
      Entry:  A contains the screen base,  and HL contains the screen
              offset
      Exit:   A contains the masked screen  base, and HL contains the
              masked screen offset, the  flags  are  corrupt, and all
              other registers are preserved

200   &BD58   MC PRINT TRANSLATION
      Action: Sets how ASCII  characters  will  be  translated before
              being sent to the printer
      Entry:  HL contains the address of the table
      Exit:   If the table is too long,  then Carry is false (ie more
              than 20 entries); if  the  table  is correctly set out,
              then Carry is true; in either  case,  A, BC, DE, HL and
              the  other  flags  are  corrupt,  and  all  others  are
              preserved
      Notes:  The first byte in the  table  is the number of entries;
              each entry requires two bytes, as follows:
              byte 0 - the character to be translated
              byte 1 -  the  character  that  is  to  be  sent to the
              printer If the character to  be  sent to the printer is
              &FF, then the character is ignored and nothing is sent

201   &BD5B   KL BANK SWITCH (6128 only)
      Action: Sets which RAM banks are being accessed by the Z80
      Entry:  A contains the organisation that is to be used
      Exit:   A contains the  previous  organisation,  the  flags are
              corrupt, and all other registers are preserved

The Firmware Indirections

000   &BDCD   TXT DRAW CURSOR
      Action: Places the cursor  on  the  screen,  if  the  cursor is
              enabled
      Entry:  No entry conditions
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  The cursor is  an  inverse  blob  which  appears at the
              current text position

001   &BDD0   TXT UNDRAW CURSOR
      Action: Removes the cursor from  the  screen,  if the cursor is
              enabled
      Entry:  No entry conditions
      Exit:   AF  is  corrupt,  and  all   the  other  registers  are
              preserved

002   &BDD3   TXT WRITE CHAR
      Action: Writes a character onto the screen
      Entry:  A holds  the  character  to  be  wntten,  H  holds  the
              physical column number, and  L  holds the physical line
              number
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

003   &BDD6   TXT UNWRITE
      Action: Reads a character from the screen
      Entry:  H contains the physical  column  number, and L contains
              the physical line number to read from
      Exit:   If a character was  found,  then  Carry  is true, and A
              contains the character; if no character was found, then
              Carry is false, and  A  contains  zero; in either case,
              BC, DE, HL and  the  other  nags  are  corrupt, and all
              other registers are preserved Notes: This routine works
              by comparing the image on the screen with the character
              matrices; therefore if the character matrices have been
              altered the routine may not find a readable a character

004   &BDD9   TXT OUT ACTION
      Action: Writes a character to  the  screen  or  obeys a control
              code (&00 to &1F)
      Entry:  A contains the character or code
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  Control codes may take  a  maximum  of nine parameters;
              when a control code  is  found,  the required number of
              parameters is read into  the  control  code buffer, and
              then the control code  is  acted  upon; if the graphics
              character wnte mode  is  enabled,  then  characters and
              codes are printed using  the  graphics  VDU; when using
              the graphics VDU  control  codes  are  printed  and not
              obeyed

005   &BDDC   GRA PLOT
      Action: Plots a point in the current graphics PEN
      Entry:  DE contains the user X  coordinate, and HL contains the
              user Y coordinate of the point
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  This routine uses the  SCR  WRITE  indirection to write
              the point to the screen

006   &BDDF   GRA TEST
      Action: Tests a point and finds out what PEN it is set to
      Entry:  DE contains the user X  coordinate, and HL contains the
              user Y coordinate of the point
      Exit:   A contains the PEN that the point is written in, BC, DE
              and HL are corrupt, and all others are preserved
      Notes:  This routine uses the  SCR  READ  indirection to test a
              point on the screen

007   &BDE2   GRA LINE
      Action: Draws a line  in  the  current  graphics  PEN, from the
              current graphics position to the specified point
      Entry:  DE contains the user X  coordinate, and HL contains the
              user Y coordinate for the endpoint
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all others are
              preserved
      Notes:  This routine uses the  SCR  WRITE  indirection to write
              the points of the line on the screen

008   &BDE5   SCR READ
      Action: Reads a pixel from the screen  and returns its decode a
              PEN
      Entry:  HL contains the  screen  address  of  the  pixel, and C
              contains the mask for the pixel
      Exit:   A contains the decoded PEN of  the pixel, the flags are
              corrupt, and all others are preserved
      Notes:  The mask should be for a single pixel, and is dependent
              on the screen mode

009   &BDE8   SCR WRITE
      Action: Writes one or more pixels to the screen
      Entry:  HL contains the screen address of the pixel, C contains
              the mask, and B contains the encoded PEN
      Exit:   AF is corrupt, and all other registers are preserved
      Notes:  The mask should determine  which  pixels  in the screen
              byte are to be plotted

010   &BDEB   SCR MODE CLEAR
      Action: Fills the entire screen  memory  with &00, which clears
              the screen to PEN 0
      Entry:  No entry conditions
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved

011   &BDEE   KM TEST BREAK
      Action: Tests if  the  ESC  key  has  been  pressed,  and  acts
              accordingly
      Entry:  C contains  the  Shift  and  Control  key  states,  and
              interrupts must be disabled
      Exit:   AF and HL  are  corrupt,  and  all  other registers are
              preserved
      Notes:  If bit 7 of C is set,  then the Control key is pressed;
              if bit 5 of C is set, then the Shift key is pressed; if
              ESC, Shift and Control are  pressed  at the sarne time,
              then it initiates a system  reset; otherwise it reports
              a break event

012   &BDF1   MC WAIT PRINTER
      Action: Sends a character to the printer if it is not busy
      Entry:  A contains the character to be sent to the printer
      Exit:   If the character was  printed  successfully, then Carry
              is true; if the  printer  was  busy  for too long (more
              than 0.4 seconds), then Carry is false; in either case,
              A and BC  are  corrupt,  and  all  other  registers are
              preserved

013   &BDF4   KM SCAN KEYS
      Action: Scans the  keyboard  every  1/50th  of  a  second,  and
              updates the status of all keys
      Entry:  All interrupts must be disabled
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved

The Maths Firmware

000   &BDC1   MOVE REAL (&BD3D for the 464)
      Action: Copies the five bytes that are  pointed to by DE to the
              location held in HL
      Entry:  DE points to the source  real  value,  and HL points to
              the destination
      Exit:   HL points to the real  value  in the destination, Carry
              is true if the move  went  properly,  F is corrupt, and
              all other registers are preserved
      Notes:  For the 464 only, A holds the exponent byte of the real
              value when the routine is exited

001   &BD64   INTEGER TO REAL (&BD40 for the 464)
      Action: Converts an integer value into a real value
      Entry:  HL holds the integer  value,  DE  points  to the desti-
              nation for the real value, bit 7 of A holds the sign of
              the integer value - it is taken to be negative if bit 7
              is set
      Exit:   HL points to the real value  in the destination, AF and
              DE are corrupt, and all others are preserved

002   &BD67   BINARY TO REAL (&BD43 for the 464)
      Action: Converts a four byte binary value  into a real value at
              the same location
      Entry:  HL points to the binary  value,  bit  7  of A holds the
              sign of the binary value - negative if it is set
      Exit:   HL points to the real  value  in  lieu of the four byte
              binary  value,  AF  is  corrupt,  and  all  others  are
              preserved
      Notes:  A four byte binary value  is  an unsigned integer up to
              &FFFFFFFF and is stored with the least significant byte
              first, and with the most significant byte last

003   &BD6A   REAL TO INTEGER (&BD46 for the 464)
      Action: Converts a real  value,  rounding  it  into an unsigned
              integer value held in HL
      Entry:  HL points to the real value
      Exit:   HL holds  the  integer  value,  Carry  is  true  if the
              conversion worked successfully, the Sign flag holds the
              sign of the integer (negative if it is set).  A, IX and
              the other flags are  corrupt,  and  all other registers
              are preserved

      Notes:  This rounds the decimal part  down  if  it is less than
              0.5, but rounds up if it  is  greater than, or equal to
              0.5

004   &BD6D   REAL TO BINARY (&BD49 for the 464)
      Action: Converts a real value,  rounding  it  into  a four byte
              binary value at the same location
      Entry:  HL points to the real value
      Exit:   HL points to  the  binary  value  in  lieu  of the real
              value, bit 7 of B holds  the  sign for the binary value
              (it is negative if bit  7  is  set),  AF,  B and IX are
              corrupt, and all other registers are preserved
      Notes:  See REAL TO INTEGER for  details  of how the values are
              rounded up or down

005   &BD70   REAL FIX (&BD4C for the 464)
      Action: Performs an equivalent  of  BASIC's  FIX  function on a
              real value, leaving the  result  as  a four byte binary
              value at the same location
      Entry:  HL points to the real value
      Exit:   HL points to  the  binary  value  in  lieu  of the real
              value, bit 7 of B has the  sign of the binary value (it
              is negative if bit 7 is set), AF, B and IX are corrupt,
              and all others are preserved
      Notes:  FIX removes any  decimal  part  of  the value, rounding
              down whether  positive  or  negative  -  see  the BASIC
              handbook for more details on the FIX command

006   &BD73   REAL INT (&BD4F for the 464)
      Action: Performs an equivalent  of  BASIC's  INT  function on a
              real value, leaving the  result  as  a four byte binary
              value at the same location
      Entry:  HL points to the real value
      Exit:   HL points to  the  binary  value  in  lieu  of the real
              value, bit 7 of B has the  sign of the binary value (it
              is negative if bit 7 is set), AF, B and IX are corrupt,
              and all others are preserved
      Notes:  INT removes any  decimal  part  of  the value, rounding
              down if the nurnber is positive,  but rounding up if it
              is negative

007   &BD76   INTERNAL SUBROUTINE - not useful (&BD52 for the 464)

008   &BD79   REAL *10^A (&BD55 for the 464)
      Action: Multiplies a real value by 10 to the power of the value
              in the A  register,  leaving  the  result  at  the same
              location
      Entry:  HL points to the real value,  and  A holds the power of
              10
      Exit:   HL points to the  result,  AF,  BC,  DE,  IX and IY are
              corrupt

009   &BD7C   REAL ADDITION (&BD58 for the 464)
      Action: Adds two real values, and leaves  the result in lieu of
              the first real number
      Entry:  HL points to the first real value, and DE points to the
              second real value
      Exit:   HL points to the  result,  AF,  BC,  DE,  IX and IY are
              corrupt

010   &BD82   REAL REVERSE SUBTRACTION (&BD5E for the 464)
      Action: Subtracts the first  real  value  from  the second real
              value, and leaves  the  result  in  lieu  of  the first
              number
      Entry:  HL points to the first real value, and DE points to the
              second real value
      Exit:   HL points to the  result  in  place  of  the first real
              value, AF, BC, DE, IX and IY are corrupt

011   &BD85   REAL MULTIPLICATION (&BD61 for the 464)
      Action: Multiplies two real  values  together,  and  leaves the
              result in lieu of the first number
      Entry:  HL points to the first real value, and DE points to the
              second real value
      Exit:   HL points to the  result  in  place  of  the first real
              value, AF, BC, DE, IX and IY are corrupt

012   &BD88   REAL DIVISION (&BD64 for the 464)
      Action: Divides the first real value  by the second real value,
              and leaves the result in lieu of the first number
      Entry:  HL points to the first real value, and DE points to the
              second real value
      Exit:   HL points to the  result  in  place  of  the first real
              value, AF, BC, DE, IX and IY are corrupt

013   &BD8E   REAL COMPARISON (&BD6A for the 464)
      Action: Compares two real values
      Entry:  HL points to the first real value, and DE points to the
              second real value
      Exit:   A holds the result of  the  comparison process, IX, IY,
              and the other flags  are  corrupt,  and  all others are
              preserved
      Notes:  After this routine  has  been  called,  the  value in A
              depends on the result of the comparison as follows:
              if the first real  number  is  greater  than the second
              real number, then A holds &01
              if the first real number is the same as the second real
              number, then A holds &00  if  the second real number is
              greater than the first real number, then A holds &FF

014   &BD91   REAL UNARY MINUS (&BD6D for the 464)
      Action: Reverses the sign of a real value
      Entry:  HL points to the real value
      Exit:   HL points to the new value of the real number (which is
              stored in place of  the  original  number),  bit 7 of A
              holds the sign of the result  (it  is negative if bit 7
              is set), AF and IX are corrupt, and all other registers
              are preserved

015   &BD94   REAL SIGNUM/SGN (&BD70 for the 464)
      Action: Tests a real value, and compares it with zero
      Entry:  HL points to the real value
      Exit:   A holds the result of  this  comparison process, IX and
              the  other  ¡lags  are  corrupt,  and  all  others  are
              preserved
      Notes:  After this routine  has  been  called,  the  value in A
              depends on the result of the comparison as follows:
              if the real number is greater than 0, then A holds &01,
              Carry is false, and Zero is false
              if the real number is the same  as 0, then A holds &00,
              Carry is false, and Zero is true
              if the real number is smaller than 0, then A holds &FF,
              Carry is true, and Zero is false

016   &BD97   SET ANGLE MODE (&BD73 for the 464)
      Action: Sets the angular  calculation  mode  to  either degrees
              (DEG) or radians (RAD)
      Entry:  A holds the mode setting  -  0  for  RAD, and any other
              value for DEG
      Exit:   All registers are preserved

017   &BD9A   REAL PI (&BD76 for the 464)
      Action: Places the real value of pi at a given memory location
      Entry:  HL holds the address at which the  value of pi is to be
              placed
      Exit:   AF and DE  are  corrupt,  and  all  other registers are
              preserved

018   &BD9D   REAL SQR (&BD79 for the 464)

      Action: Calculates the square root of a real value, leaving the
              result in lieu of the real value
      Entry:  HL points to the real value
      Exit:   HL points to the result of the calculation, AF, BC, DE,
              IX and IY are corrupt

019   &BDA0   REAL POWER (&BD7C for the 464)
      Action: Raises the first real value to  the power of the second
              real value, leaving the  result  in  lieu  of the ¡irst
              real value
      Entry:  HL points to the first real value, and DE points to the
              second real value
      Exit:   HL points to the result of the calculation, AF, BC, DE,
              IX and IY are corrupt

020   &BDA3   REAL LOG (&BD7F for the 464)
      Action: Returns the naperian logarithm  (to  base  e) of a real
              value, leaving the result in lieu of the real value
      Entry:  HL points to the real value
      Exit:   HL points to the  logarithrn  that has been calculated,
              AF, BC, DE, LY and IY are corrupt

021   &BDA6   REAL LOG 10 (&BD82 for the 464)
      Action: Returns the logarithm (to  base  10)  of  a real value,
              leaving the result in lieu of the real value
      Entry:  HL points to the real value
      Exit:   HL points to the  logarithrn  that has been calculated,
              AF, BC, DE, IX and IY are corrupt

022   &BDA9   REAL EXP (&BD85 for the 464)
      Action: Returns the antilogarithm  (base  e)  of  a real value,
              leaving the result in lieu of the real value
      Entry:  HL points to the real value
      Exit:   HL points  to  the  antilogarithm  that  has  been cal-
              culated, AF, BC, DE, IX and IY are corrupt
      Notes:  See the BASIC handbook for details of EXP

023   &BDAC   REAL SINE (&BD88 for the 464)
      Action: Returns the sine of a real value, leaving the result in
              lieu of the real value
      Entry:  HL points to the real value (ie all angle)
      Exit:   HL points to the sine  value  that has been calculated,
              AF, BC, DE, IX and IY are corrupt

024   &BDAF   REAL COSINE (&BD8B for the 464)
      Action: Returns the cosine  of  a  real  value,  leaving  a the
              result in lieu of the real value
      Entry:  HL points to the real value (ie an angle)
      Exit:   HL points to the cosine value that has been calculated,
              AF, BC, DE, IX and IY are corrupt

025   &BDB2   REAL TANGENT (&BD8E for the 464)
      Action: Returns the tangent of a real value, leaving the result
              in lieu of the real value
      Entry:  HL points to the real value (ie an angle)
      Exit:   HL points to  the  tangent  value  that  has  been cal-
              culated, AF, BC, DE, IX and IY are corrupt

026   &BDB5   REAL ARCTANGENT (&BD91 for the 464)
      Action: Returns the arctangent  of  a  real  value, leaving the
              result in lieu of the real value
      Entry:  HL points to the real value (ie an angle)
      Exit:   HL  points  to  the  arctangent  value  that  has  been
              calculated, AF, BC, DE, IX and IY are corrupt

         All of the above routines to calculate sine, cosine, tangent
              and
                        arctangent are slightly inaccuarate

027   &BDB8   INTERNAL SUBROUTINE - not useful (&BD94 for the 464)

028   &BDBB   INTERNAL SUBROUTINE - not useful (&BD97 for the 464)

029   &BDBE   INTERNAL SUBROUTINE - not useful (&BD9A for the 464)



Maths Subroutines for the 664 and 6128 only

      &BD5E   TEXT INPUT
      Action: Allows  upto  255  characters  to  be  input  from  the
              keyboard into a buffer
      Entry:  HL points to the start of  the buffer - a NUL character
              must be placed after any characters already present, or
              at the start of the buffer if there is no text
      Exit:   A has the last key pressed,  HL  points to the start of
              the buffer, the flags are  corrupt,  and all others are
              preserved
      Notes:  This routine prints any existing contents of the buffer
              (upto the NUL character) and then echoes any keys used;
              it allows full line  editing  with  the cursor keys and
              DEL, etc; it is exited only by use of ENTER or ESC

      &BD7F   REAL RND
      Action: Creates a new RND real  value  at a location pointed to
              by HL
      Entry:  HL points to the destination for the result
      Exit:   HL points to the RND value, AF, BC, DE and IX registers
              are corrupt; and all others are preserved

      &BD8B   REAL RND(0)
      Action: Returns the last RND value  created,  and  puts it in a
              location pointed to by HL
      Entry:  HL points  to  the  place  where  the  value  is  to be
              returned to
      Exit:   HL points to  the  value  created,  AF,  DE  and IX are
              corrupt, and all other registers are preserved
      Notes:  See the BASIC handbook for more details on RND(0)

AMSDOS and BIOS Firmware

A     &C033   BIOS SET MESSAGE
      Action: Enables or disables disc error messages
      Entry:  To enable messages, A holds &00; to disable messages, A
              holds &FF
      Exit:   A holds  the  previous  state,  HL  and  the  flags are
              corrupt, and all others are preserved
      Notes:  Enabling  and  disabling  the   messages  can  also  be
              achieved by poking &BE78 with &00 or &FF

B     &C036   BIOS SETUP DISC
      Action: Sets the parameters which effect the disc speed
      Entry:  HL holds the address of  the  nine  bytes which make up
              the parameter block
      Exit:   AF, BC, DE and HL are  corrupt, and all other registers
              are preserved
      Notes:  The parameter block is arranged as follows:
              bytes 0&1 -  the  motor  on  time  in  20ms  units; the
              default is &0032; the fastest is &0023
              bytes 2&3 -  the  motor  off  time  in  20ms units; the
              default is &00FA; the fastest is &00C8
              byte 4 - the write off  time in l0æs units; the default
              is ⁡ should not be changed
              byte 5 - the head settle time in 1ms units; the default
              is &0F; should not be changed
              byte 6 - the step rate  time  in 1ms units; the default
              is &0C; the fastest is &0A
              byte 7 - the  head  unload  delay;  the default is &01;
              should not be changed
              byte 8  -  a  byte  of  &03  and  this  should  be left
              unaltered

C     &C039   BIOS SELECT FORMAT
      Action: Sets a format for a disc
      Entry:  A holds the type of format that is to be selected
      Exit:   AF, BC, DE  and  HL  are  corrupt,  and  all  the other
              registers are preserved
      Notes:  To select one of the normal disc formats, the following
              values should be put into the A register:
              Data format - &C1
              System format - &41 - Used by CP/M
              IBM format - &01 - compatible with CP/M-86
              This routine sets  the  extended  disc  parameter block
              (XDPB) at &A890 to &A8A8  -  to  set other formats, the
              XDPB must be altered directly

D     &C03C   BIOS READ SECTOR
      Action: Reads a sector from a disc into memory
      Entry:  HL holds the address in memory where the sector will be
              read to, E holds the drive number (&00 for drive A, and
              &01 for drive B), D holds the track number, and C holds
              the sector number
      Exit:   If the sector was read properly,  then Carry is true, A
              holds 0, and HL is preserved;  if the read failed, then
              Carry is false, A  holds  an  error  number,  and HL is
              corrupt; in either case,  the  other flags are corrupt,
              and all other registers are preserved

E     &C03F   BIOS WRITE SECTOR
      Action: Writes a sector from memory onto disc
      Entry:  HL holds the address of memory which will be written to
              the disc, E holds the  drive  number  (&00 for drive A,
              and &01 for drive B), D  holds  the track number, and C
              holds the sector number
      Exit:   If the sector was written properly, then Carry is true,
              A holds 0, and HL  is  preserved;  if the write failed,
              then Carry is false, A holds an error number, and HL is
              corrupt; in either case,  the  other flags are corrupt,
              and all other registers are preserved

F     &C042   BIOS FORMAT TRACK
      Action: Formats a complete  track,  inserts  sectors, and fills
              the track with bytes of &E5
      Entry:  HL contains  the  address  of  the  header  information
              buffer which holds  the  header  information  blocks, E
              contains the drive number (&00 for drive A, and &01 for
              drive B), and D holds the track number
      Exit:   if the formatting process was successful, then Carry is
              true, A holds 0, and HL is preserved; if the formatting
              process failed, then Carry is  false,  A holds an error
              number, and HL is  corrupt;  in  either case, the other
              flags are corrupt,  and  all  the  other  registers are
              preserved
      Notes:  The header information block is laid out as follows:
              byte 0 - holds the track number
              byte 1 - holds the head number (set to zero)
              byte 2 - holds the sector number
              byte 3 - holds  log2(sector  size) -7  (usually  either
              &02=512 bytes, or &03=1024  bytes).  Header information
              blocks must be set up  contiguously for every sector on
              the track, and in the same sequence that they are to be
              laid down (eg &C1, &C6,  &C2,  &C7, &C3, &C8, &C4, &C9,
              &C5)

G     &C045   BIOS MOVE TRACK
      Action: Moves the disc drive head to the specified track
      Entry:  E holds the drive number (&00  for drive A, and &01 for
              drive B), and D holds the track number
      Exit:   If the head was moved successfully, then Carry is true,
              A holds 0, and  HL  is  preserved;  if the move failed,
              then Carry is false, A holds an error number, and HL is
              corrupt; in both cases,  the  other  flags are corrupt,
              and all other registers are preserved

      Notes:  There is normally no need to  call this routine as READ
              SECTOR, WRITE  SECTOR  and  FORMAT  TRACK automatically
              move the head to the correct position

H     &C048   BIOS GET STATUS
      Action: Returns the status of the specified drive
      Entry:  A holds the drive number (&00  for drive A, and &01 for
              drive B)
      Exit:   If Carry is true, then A  holds the status byte, and HL
              is preserved; if Carry is false, then A is corrupt, and
              HL holds the  address  of  the  byte  before the status
              byte; in either case,  the  other  flags are preserved,
              and all other registers are preserved
      Notes:  The  status  byte  indicates   the  drive's  status  as
              follows:
              if bit 6 is set, then  either  the write protect is set
              or the disc is missing
              if bit 5 is set, then  the  drive is ready and the disc
              is fitted (whether the disc is formatted or not)
              if bit 4 is set, then the head is at track 0

I     &C04B   BIOS SET RETRY COUNT
      Action: Sets the number of  times  the  operation is retried in
              the event of disc error
      Entry:  A holds the number of retries required
      Exit:   A holds the  previous  number  of  retries,  HL and the
              flags are corrupt, and all others are preserved
      Notes:  The default setting is &10,  and the minimum setting is
              &01; the number  of  retries  can  also  be  altered by
              poking &BE66 with the required value

J     &C56C   GET SECTOR DATA
      Action: Gets the data of a sector on the current track
      Entry:  E holds the drive number
      Exit:   If a formatted disc is present, then Carry is true, and
              HL is preserved; if an  unforrnatted disc is present or
              the disc is missing, then Carry  is false, and HL holds
              the address of  the  byte  before  the  status byte; in
              either case, A and the other flags are corrupt, and all
              other registers are preserved
      Notes:  The track number is held  at  &BE4F, the head number is
              held at &BE50, the sector number  is held at &BE51, and
              the log2(sector size)-7 is  held  at  &BE52; disc para-
              meters do not need to be set to the format of the disc;
              this routine is best used  with the disc error messages
              turned off
LOW KERNEL JUMPBLOCK

HIGH KERNEL JUMPBLOCK


The Key Manager


The Text VDU


The Graphics VDU


The Screen Pack


The Cassette/AmsDOS Manager


The Sound Manager


The Kernel


The Machine Pack


The Firmware Indirections


The Maths Firmware


AMSDOS and BIOS Firmware



LOW KERNEL JUMPBLOCK

RESET_ENTRY
LOW_JUMP
KL_LOW_PCHL
PCBC
SIDE_CALL
KL_SIDE_PCHL
PCDE
FAR_CALL
KL_FAR_PCHL
PCHL
RAM_LAM
KL_FAR_CALL
FIRM_JUMP
USER_RESTART
INTERRUPT_ENTRY
EXT_INTERRUPT

 HIGH KERNEL JUMPBLOCK

KL_U_ROM_ENABLE
KL_U_ROM_DISABLE
KL_L_ROM_ENABLE
KL_L_ROM_DISABLE
KL_ROM_RESTORE
KL_ROM_SELECT
KL_CURR_SELECTION
KL_PROBE_ROM
KL_ROM_DESELECT
KL_LDIR
KL_LDDR
KL_POLL_SYNCHRONOUS
KL_SCAN_NEEDED

 The Key Manager

KM_INITIALISE
KM_RESET
KM_WAIT_CHAR
KM_READ_CHAR
KM_CHAR_RETURN
KM_SET_EXPAND
KM_GET_EXPAND
KM_EXP_BUFFER
KM_WAIT_KEY
KM_READ_KEY
KM_TEST_KEY
KM_GET_STATE
KM_GET_JOYSTICK
KM_SET_TRANSLATE
KM_GET_TRANSLATE
KM_SET_SHIFT
KM_GET_SHIFT
KM_SET_CONTROL
KM_GET_CONTROL
KM_SET_REPEAT
KM_GET_REPEAT
KM_SET_DELAY
KM_GET_DELAY
KM_ARM_BREAKS
KM_DISARM_BREAK
KM_BREAK_EVENT

 The Text VDU

TXT_INITIALISE
TXT_RESET
TXT_VDU_ENABLE
TXT_VDU_DISABLE
TXT_OUTPUT
TXT_WR_CHAR
TXT_RD_CHAR
TXT_SET_GRAPHIC
TXT_WIN_ENABLE
TXT_GET_WINDOW
TXT_CLEAR_WINDOW
TXT_SET_COLUMN
TXT_SET_ROW
TXT_SET_CURSOR
TXT_GET_CURSOR
TXT_CUR_ENABLE
TXT_CUR_DISABLE
TXT_CUR_ON
TXT_CUR_OFF
TXT_VALIDATE
TXT_PLACE_CURSOR
TXT_REMOVE_CURSOR
TXT_SET_PEN
TXT_GET_PEN
TXT_SET_PAPER
TXT_GET_PAPER
TXT_INVERSE
TXT_SET_BACK
TXT_GET_BACK
TXT_GET_MATRIX
TXT_SET_MATRIX
TXT_SET_M_TABLE
TXT_GET_M_TABLE
TXT_GET_CONTROLS
TXT_STR_SELECT
TXT_SWAP_STREAMS

 The Graphics VDU

GRA_INITIALISE
GRA_RESET
GRA_MOVE_ABSOLUTE
GRA_MOVE_RELATIVE
GRA_ASK_CURSOR
GRA_SET_ORIGIN
GRA_GET_ORIGIN
GRA_WIN_WIDTH
GRA_WIN_HEIGHT
GRA_GET_W_WIDTH
GRA_GET_W_HEIGHT
GRA_CLEAR_WINDOW
GRA_SET_PEN
GRA_GET_PEN
GRA_SET_PAPER
GRA_GET_PAPER
GRA_PLOT_ABSOLUTE
GRA_PLOT_RELATIVE
GRA_TEST_ABSOLUTE
GRA_TEST_RELATIVE
GRA_LINE_ABSOLUTE
GRA_LINE_RELATIVE
GRA_WR_CHAR

 The Screen Pack

SCR_INITIALISE
SCR_RESET
SCR_SET_OFFSET
SCR_SET_BASE
SCR_GET_LOCATION
SCR_SET_MODE
SCR_GET_MODE
SCR_CLEAR
SCR_CHAR_LIMITS
SCR_CHAR_POSITION
SCR_DOT_POSITION
SCR_NEXT_BYTE
SCR_PREV_BYTE
SCR_NEXT_LINE
SCR_PREV_LINE
SCR_INK_ENCODE
SCR_INK_DECODE
SCR_SET_INK
SCR_GET_INK
SCR_SET_BORDER
SCR_GET_BORDER
SCR_SET_FLASHING
SCR_GET_FLASHING
SCR_FILL_BOX
SCR_FLOOD_BOX
SCR_CHAR_INVERT
SCR_HW_ROLL
SCR_SW_ROLL
SCR_UNPACK
SCR_REPACK
SCR_ACCESS
SCR_PIXELS
SCR_HORIZONTAL
SCR_VERTICAL

 The Cassette/AmsDOS Manager

CAS_INITIALISE
CAS_SET_SPEED
CAS_NOISY
CAS_START_MOTOR
CAS_STOP_MOTOR
CAS_RESTORE_MOTOR
CAS_IN_OPEN
CAS_IN_CLOSE
CAS_IN_ABANDON
CAS_IN_CHAR
CAS_IN_DIRECT
CAS_RETURN
CAS_TEST_EOF
CAS_OUT_OPEN
CAS_OUT_CLOSE
CAS_OUT_ABANDON
CAS_OUT_CHAR
CAS_OUT_DIRECT
CAS_CATALOG
CAS_WRITE
CAS_READ
CAS_CHECK

 The Sound Manager

SOUND_RESET
SOUND_QUEUE
SOUND_CHECK
SOUND_ARM_EVENT
SOUND_RELEASE
SOUND_HOLD
SOUND_CONTINUE
SOUND_AMPL_ENVELOPE
SOUND_TONE_ENVELOPE
SOUND_A_ADDRESS
SOUND_T_ADDRESS

 The Kernel

KL_CHOKE_OFF
KL_ROM_WALK
KL_INIT_BACK
KL_LOG_EXT
KL_FIND_COMMAND
KL_NEW_FRAME_FLY
KL_ADD_FRAME_FLY
KL_DEL_FRAME_FLY
KL_NEW_FAST_TICKER
KL_ADD_FAST_TICKER
KL_DEL_FAST_TICKER
KL_ADD_TICKER
KL_DEL_TICKER
KL_INIT_EVENT
KL_EVENT
KL_SYNC_RESET
KL_DEL_SYNCHRONOUS
KL_NEXT_SYNCH
KL_DO_SYNCH
KL_DONE_SYNCH
KL_EVENT_DISABLE
KL_EVENT_ENABLE
KL_DISARM_EVENT
KL_TIME_PLEASE
KL_TIME_SET

 The Machine Pack

MC_BOOT_PROGRAM
MC_START_PROGRAM
MC_WAIT_FLYBACK
MC_SET_MODE
MC_SCREEN_OFFSET
MC_CLEAR_INKS
MC_SET_INKS
MC_RESET_PRINTER
MC_PRINT_CHAR
MC_PRINTER_BUSY
MC_SEND_PRINTER
MC_SOUND_REGISTER
JUMP_RESTORE
KM_SET_LOCKS
TXT_ASK_STATE
GRA_DEFAULT
GRA_SET_BACK
GRA_SET_FIRST
GRA_SET_LINE_MASK
GRA_FROM_USER
GRA_FILL
SCR_SET_POSITION
MC_PRINT_TRANSLATION
KL_BANK_SWITCH

 The Firmware Indirections

TXT_DRAW_CURSOR
TXT_UNDRAW_CURSOR
TXT_WRITE_CHAR
TXT_UNWRITE
TXT_OUT_ACTION
GRA_PLOT
GRA_TEST
GRA_LINE
SCR_READ
SCR_WRITE
SCR_MODE_CLEAR
KM_TEST_BREAK
MC_WAIT_PRINTER
KM_SCAN_KEYS

 The Maths Firmware

MOVE_REAL
INTEGER_TO_REAL
BINARY_TO_REAL
REAL_TO_INTEGER
REAL_TO_BINARY
REAL_FIX
REAL_INT
REAL_10A
REAL_ADDITION
REAL_REVERSE_SUBTRACTION
REAL_MULTIPLICATION
REAL_DIVISION
REAL_COMPARISON
REAL_UNARY_MINUS
REAL_SIGNUM_SGN
SET_ANGLE_MODE
REAL_PI
REAL_SQR
REAL_POWER
REAL_LOG
REAL_LOG_10
REAL_EXP
REAL_SINE
REAL_COSINE
REAL_TANGENT
REAL_ARCTANGENT

 AMSDOS and BIOS Firmware

BIOS_SET_MESSAGE
BIOS_SETUP_DISC
BIOS_SELECT_FORMAT
BIOS_READ_SECTOR
BIOS_WRITE_SECTOR
BIOS_FORMAT_TRACK
BIOS_MOVE_TRACK
BIOS_GET_STATUS
BIOS_SET_RETRY_COUNT
GET_SECTOR_DATA