cpc firmware guide

The Amstrad CPC Firmware Guide

By Bob Taylor and Thomas Defoe, 1992

Electronic version by David Cantrell, 1994 HTML Version, 1996/97 http://www.cantrell.org.uk/david/tech/cpc/

Transferred to Acrobat PDF format By John Kavanagh, 2002

PDF version in association with CPC Oxygen http://www.cpcoxygen.pro.ie

PDF Version 1.0 (2002)


The Amstrad CPC Firmware Guide


Introduction

Fortunately, when Amstrad developed the CPC and CPC+ computers, they let the user access many of the computer’s internal routines (the firmware) and use them in their own programs. Experienced coders will no doubt write faster or more versatile code, yet these can easily be patched in using the Firmware Jumplock.

For many years, Amstrad produced the definitive guide to the insides of the CPC but sale of this was stopped in 1989. Since then the Firmware Manual has been a much sought- after item by programmers. Nevertheless, the original guide had some omissions, notably the abscence of information on the system variables and the Z80 microprocessor inside every CPC and CPC+.

This guide is not intended to explain how to program in machine code, but we hope that it will supply the information needed to make the most of the Amstrad’s capabilities when writing your own programs.

Bob Taylor and Thomas Defoe, 1992


The Amstrad CPC Firmware Guide


Contents

Use of Memory by the Operating System 7

Overview of the CPC 7 System Variables 8

Firmwire Guide 33

Kernel 35 Low Jumplock 38 High Jumplock 40 The Key Manager 43 The Text VDU 47 The Graphics VDU 53 The Screen Pack 57 Cassette / AMSDOS 63 AMSDOS / BIOS 66 The Sound Manager 69 The Machine Pack 71 664 / 6128 only 73 The Firmware Indirections 75 The Maths Firmware 77 Maths Subroutines for the 464 only 80 Maths Subroutines for the 664 and 6128 only 81

The Z80 Instruction Set 83

The Opcodes and T States 83 The Flag Register 83

The CRTC Registers 105


The Amstrad CPC Firmware Guide


Use of memory by the Operating System

The following list of memory addresses and their uses has been compiled over a number of years, mainly from personal investigation. It does not claim to be definitive, since no accurate source seems to be available to the average computer user, and so may be inaccurate or deficient at certain points; also, some of the areas described have uses additional to those listed. We have tried to make it as accurate as possible, to enable others to use to the full those facilities which present themselves via this information.

  • Addresses and values are present in memory with the low byte first. The Z80 processor represents all 16- bit values in the order lo- byte hi- byte.
  • The term ‘above’ means higher in memory.
  • Areas with numbers of bytes of either &00 or &FF given in brackets, may be safe to use for machine code routines etc, as may the tape area, and the Sound ENT and ENT areas if these are unused.
  • The first column given is the address (for the 6128) of the memory being considered, while the second column gives the equivalent 464 address - unfortunately the 464 differs from the 6128 for most addresses, so if one address is omitted, the system variable is not available for that machine.
  • The next column gives the size allocated in bytes. Addresses on the right hand side enclosed in brackets are of System Variables which hold the address of the bytes being explained. With addresses or values anywhere in the text, the value shown is for the 6128; a value in italics is for the 464 only.

Overview of the CPC’s memory

In the following tables, the following symbols are used:

<> - not the value or bit which follows \* - this applies to all machine with a disk drive fitted b0 - bit 0 b1 - bit 1 … b15 - bit 15 HB - most significant byte, hi- byte LB - least significant byte, lo- byte

When addresses are given in the comments, they apply to the 6128. When the 464’s address is different, it is given in brackets, such as at the comment for &B763.

Please note that this section of the guide has been set out with all the addresses in the leftmost column in the correct order for the 6128.


The System Variables

6128464SizeComments on the memory locations
&lt;0000&lt;0000&lt;40Restart block:
&lt;0000&lt;0000RST 0: complete machine reset
&lt;0008&lt;0008RST 1: LOWJUMP: in-line two byte address: b0 to b13=address;
b14=Low ROM disabled;
b15=Upper ROM disabled
&lt;000B&lt;000BLOW PCHL: HL has address as RST 1
&lt;000E&lt;000E`JMP BC': BC has address to jump to
&lt;0010&lt;0010RST 2: SIDE CALL: inline two byte address: b0 to b13=address-&lt;0000;
b14 to b15=offset to required ROM (used between sequenced Foreground ROMs)
&lt;0013&lt;0013SIDE PCHL: HL has address as RST 2
&lt;0016&lt;0016`JMP DE': DE has address to jump to
&lt;0018&lt;0018RST 3: FAR CALL: inline three byte address block: bytes 1 and 2 hold the address;
byte 3 holds the ROM select address
&lt;001B&lt;001BFAR PCHL: as RST 3, but HL has address;
C has ROM select
&lt;001E&lt;001E`JMP HL': HL has address to jump to
&lt;0020&lt;0020RST 4: RAM LAM: LD A,(HL) from RAM with ROMs disabled
&lt;0023&lt;0023FAR CALL: as RST 3, but HL has address of three byte address block
&lt;0028&lt;0028RST 5: FIRM JUMP: inline two byte address to jump to
&lt;0030&lt;0030RST 6: User restart;
default to RST 0
&lt;0038&lt;0038RST 7: Interrupt entry (KB/Time etc)
&lt;003B&lt;003BExternal interrupt (default to RET)
&lt;0040&lt;0040&lt;130ROM lower foreground area: BASIC input area (tokenised)
&lt;016F&lt;016Fend of BASIC input area.
&lt;0170&lt;0170BASIC working area for program, variables, etc...
&lt;0170&lt;0170Program area;
Variables and DEF FNs area;
Arrays area;
Free space;
end of free space;
Strings area;
end of Strings area (=HIMEM);
Space for user machine code routines;
end of user space, byte before user;
defined graphics area;
User defined graphics area;
end of UDG area;
ROM Upper reserved area, expandible during;
KL ROM WALK, including:
r*4ROM chaining blocks (arranged as follows):

6128464SizeComments on the memory locations
&A6FC&A6FC4AMSDOS chain,ing block:
&A6FC&A6FC2address of next ROM block in chain (or &0000 if the last in chain)
&A6FE&A6FE1ROM Select address
&A6FF&A6FF1&00
&A700&A700&500AMSDOS reserved area. This area is moved down if any ROMs have numbers greater than eight (6128 only)
&A700&A7001Current drive number (0=A; 1=B)
&A701&A7011Current USER number
&A702&A7021flag?
&A703&A7032address?
&A705&A7051flag?
&A706&A7062address?
&A708&A7081OPENIN flag (&FF=closed; &gt;&FF=opened)
&A709&A709&20Copy of current or last Disc Directory entry for OPENIN/LOAD:
&A709&A7091USER number
&A70A&A70A8filename (padded with spaces)
&A712&A7123file extension (BAS, BIN, BAK, etc) including:
&A712&A7121b7 set = Read Only
&A713&A7131b7 set = System (ie not listed by CAT or DIR)
&A715&A715116K block sequence number for this directory entry (0 for first block; if &lt;0 part of a larger file)
&A716&A7162unused
&A718&A7181length of this block in 128 byte records
&A719&A71916sequence of Disc Block numbers containing file - &00 as end marker
&A729&A7291number of 128 byte records loaded so far; before loading proper: &00 for ASCII (ie nothing loaded yet); &01 for BIN or BAS files (ie header record loaded)
&A72A&A72A1
&A72B&A72B1
&A72C&A72C1OPENOUT flag (&FF=closed; &gt;&FF=opened)<br/>
&A72D&A72D&20Copy of current or last Disc Directory entry for OPENOUT/SAVE:
&A72D&A72D1USER number
&A72E&A72E8filename (padded with spaces)
&A736&A7363file extension ($$$$ while open; correct extension when finished)
&A739&A7391flag (&00=open; &FF=closed, ie finished)
&A73A&A73A1
&A73B&A73B1flag (&00=open; &FF=closed)
&A73C&A73C1number of 128 byte records saved so far
&A73D&A73D16sequence of Disc Block numbers containing file - &00 as end mark

6128464SizeComments on the memory locations
&A74D&A74D1number of 128 byte records saved so far
&A74E&A74E1
&A74F&A74F1
&A750&A7501flag (&lt;00=OPENIN; &lt;01=In Char; &lt;02=In Direct (whole file))
&A751&A7512address of 2K buffer for ASCII, or of start of current/last block if BIN or BAS file
&A753&A7532address of next byte to read for ASCII, or of 2K buffer for BAS or BIN file
&A755&A755&lt;45first &lt;45 bytes of BAS/BIN file (extended header) or of extended header made for ASCII file
&A755&A7551USER number
&A756&A7568filename (padded)
&A75E&A75E3extension
&A761&A7616unused
&A767&A7671file type (&lt;00=BASIC; &lt;01=protected BASIC; &lt;02=Binary; &lt;16=ASCII)
&A768&A7682unused
&A76A&A76A2address to load file into (=actual destination), or buffer for an ASCII file
&A76C&A76C1unused for disc
&A76D&A76D2length of file in bytes (&lt;0000 for ASCII files)
&A76F&A76F2execution address fora BIN file
&A770&A770&lt;25unused
&A795&A7953length of actual file in bytes (as &lt;A76D)-BAS and BIN only
&A798&A7982simple checksum of first 67 bytes of header (LB first) - BAS and BIN only
&A79A&A79A1flag (&lt;00=OPENOUT; &lt;01=Out Char; &lt;02=Out Direct(whole file))
&A79B&A79B2address of 2K block if an ASCII file, or of current/last block saved if a BAS or BIN file
&A79D&A79D2address of next byte to write for ASCII files, or of 2K buffer for BAS and BIN files
&A79F&A79F&lt;45first &lt;45 bytes of BAS/BIIN file (ie extended header)
&A79F&A79F1USER number
&A7A0&A7A08filename (padded)
&A7A8&A7A83extension
&A7AB&A7AB1flag (&lt;00=Open)
&A7AC&A7AC1
&A7AD&A7AD1flag (&lt;00=Open)
&A7AE3unused
&A7B1&A7B11file type (&lt;00=BASIC; &amp;01=protected BASIC; &amp;02=Binary; &amp;16=ASCII)
&A7B2&A7B22unused
&A7B4&A7B42address to save file from (for BAS or BIN files), or of buffer for ASCII files

6128464SizeComments on the memory locations
&A7B6&A7B61unused for disc
&A7B7&A7B72length of file in bytes
&A7B9&A7B92execution address for BIN files
&A7BB&A7BB&25unused
&A7DF&A7DF3length of actual file in bytes (as at &amp;A7B7) - BAS and BIN only
&A7E2&A7E22simple checksum of first 67 bytes of header (LB first) - BAS and BIN only
&A7E4&A7E4&80buffer area for records sent to or loaded from Disc, or used in forming filename and extension
&A864&A86414*3Tape Jumpblock is stored here by AMSDOS - is moved to &amp;BC77 etc after |TAPE
&A88B&A88B3far address used by AMSDOS RST 3s at &amp;BC77 etc (&amp;CD30,&amp;07)
&A890&A890&19Drive A Extended Disc Parameter Block (XDPB):
&A890&A8902number of 128 byte records per track
&A892&A8921log2(Block size)-7 (&amp;03=1024 bytes; &amp;04=2048 bytes)
&A893&A8931(Block size)/128-1 (&amp;07=1024 bytes;
&A894&A8941(Block size)/1024 (if total of blocks &lt;256, else /2048)-1
&A895&A8952number of blocks per disc side (excluding reserved tracks)
&A897&A8972number of (directory entries)-1
&A899&A8992bit significant value of number of blocks for directory (&amp;0080=1; &amp;00C0=2)
&A89B&A89B2number of bits in checksum =((&amp;A894)+1)/4
&A89D&A89D2number of reserved tracks (&amp;00=Data; &amp;01=IBM; &amp;02=System)
&A89F&A89F1number of first sector (&amp;01=IBM; &amp;41=System; &amp;C1=Data)
&A8A0&A8A01number of sectors per track (Data=9; System=9; IBM=8)
&A8A1&A8A11gap length (Read/Write)
&A8A2&A8A21gap length (Format)
&A8A3&A8A31format filler byte (&amp;E5)
&A8A4&A8A41log2( sector size)-7 (&amp;02=512; &amp;03=1024)
&A8A5&A8A51records per sector
&A8A6&A8A61current track (not for use)
&A8A7&A8A710=not aligned (not for use)
&A8A8&A8A81Auto select flag (&amp;00=Auto select; &amp;FF=don't alter)
&A8A9&A8A9
&A8B9&A8B9
&A8D0&A8D0&19Drive B Extended Disc Parameter Block (arranged as at &amp;A890)
&A8E9&A8E9(&amp;17 bytes of &amp;FF)
&A8F9&A8F9
&A900&A900(&amp;12 bytes of &amp;00)
&A910&A910
&A918&A9182address of area for reading directory entries for Drive A

6128464SizeComments on the memory locations
&amp;A91A&amp;A91A2address of Drive A XDPB
&amp;A91C&amp;A91C2address of the byte after the end of Drive A XDPB
&amp;A91E&amp;A91E2
&amp;A920&amp;A920(8bytes of &amp;00)
&amp;A928&amp;A9282address of area for reading directory entries for Drive B
&amp;A92A&amp;A92A2address of Drive B XDPB
&amp;A92C&amp;A92C2address of the byte after the end of Drive B XDPB
&amp;A92E&amp;A92E2
&amp;A930&amp;A930&amp;80block of directory entries, including last file loaded
&amp;A9B0&amp;A9B0&amp;200buffer for loading; usually contains last sector loaded
&amp;ABB0&amp;ABB0(&amp;50 bytes of &amp;00)
&amp;AC00&amp;AC00Start of BASIC Operating System reserved area:
&amp;AC00&amp;AC001program line redundant spaces flag (0=keep extra spaces; &lt;&gt;0=remove)
&amp;AC019*3groups of 3 RET bytes (&amp;C9) called by the Upper ROM
&amp;AC01&amp;AC1C1AUTO flag (0=off; &lt;&gt;0=on)
&amp;AC02&amp;AC1D2number of the next line (6128) or of the current line (464) for AUTO
&amp;AC04&amp;AC1F2step distance for AUTO
&amp;AC06&amp;AC211
&amp;AC07&amp;AC221
&amp;AC081
&amp;AC231
&amp;AC09&amp;AC241WIDTH (&amp;84=132)
&amp;AC0A&amp;AC25
&amp;AC0B
&amp;AC0C&amp;AC261FOR/NEXT flag (0=NEXT not yet used; &lt;&gt;0=used)
&amp;AC0D&amp;AC275FOR start value (real). Only 2 bytes are used if % or DEFINIT variable
&amp;AC12&amp;AC2C2address of : ' or of the end of program line byte after a NEXT command
&amp;AC14&amp;AC2E2address of LB of the line number containing WEND
&amp;AC16&amp;AC301WHILE/WEND flag (&amp;41=WEND not yet used; &amp;04=used)
&amp;AC17&amp;AC31
&amp;AC18&amp;AC322
&amp;ACIA&amp;AC342
&amp;AC1C&amp;AC362address of location holding ROM routine address for KB event block
&amp;AC1E&amp;AC38&amp;0CEvent Block for ON SQ(I):
&amp;AC1E&amp;AC382chain address to next event block; &amp;0000 if last in chain, but &amp;FFFF if unused
&amp;AC20&amp;AC3A1count
&amp;AC21&amp;AC3B1class: Far address, highest (ON SQ) priority, Normal &amp; Synchronous event

6128464SizeComments on the memory locations
&amp;AC22&amp;AC3C2routine address (in BASIC ROM)
&amp;AC24&amp;AC3E1ROM Select number (&amp;FD ie ROM 0 enabled, Lower ROM disabled)
&amp;AC25&amp;AC3F1(first byte of user field)
&amp;AC26&amp;AC402address of the end of program line byte or ':' after 'ON
SQ(x) GOSUB line number' statement
&amp;AC28&amp;AC422address of the end of program line byte of the line before the GOSUB routine
&amp;AC2A&amp;AC44&amp;OCEvent block for ON SQ(2), arranged as &amp;AC1E onwards - second ON SQ priority
&amp;AC36&amp;AC50&amp;OCEvent block for ON SQ(4), arranged as &amp;AC1E onwards - lowest ON SQ priority
&amp;AC42&amp;AC5C&amp;12Ticker and Event Block for AFTER/EVERY Timer 0
&amp;AC42&amp;AC5C2chain address to next event block (usually to another timer or &amp;00FF)
&amp;AC44&amp;AC5E2'count down' count
&amp;AC46&amp;AC602recharge count (for EVERY only - &amp;0000 if AFTER)
&amp;AC48&amp;AC622chain address to next ticker block
&amp;AC4A&amp;AC641count
&amp;AC4B&amp;AC651class: Far address, lowest (timer) priority, Normal and Synchronous event
&amp;AC4C&amp;AC662Routine address (in BASIC ROM)
&amp;AC4E&amp;AC681ROM Select No (&amp;FD ie ROM 0 enabled, Lower ROM disabled)
<fcel><fcel><fcel><nl>
<fcel><fcel><lcel>
<fcel><fcel>-<fcel><nl>
<fcel><fcel><a>
<fcel><fcel><fcel><fcel><nl><nl>
<fcel><fcl><fcel><nl>

6128464SizeComments on the memory locations
&amp;AD99&amp;ADB2&amp;09Current SOUND parameter block (see Firmware Jump &amp;BCAA)
&amp;AD99&amp;ADB21channel andrendezvous status
&amp;AD9A&amp;ADB31amplitude envelope (ENV) number
&amp;AD9B&amp;ADB41tone envelope (ENT) number
&amp;AD9C&amp;ADB52tone period
&amp;AD9E&amp;ADB71noise period
&amp;AD9F&amp;ADB81initial amplitude
&amp;ADA0&amp;ADB92duration, or envelope repeat count
&amp;ADA2&amp;ADBB&amp;10Current Amplitude or Tone Envelope parameter bloc (see &amp;BCBC or &amp;BCBF)
&amp;ADA2&amp;ADBB1number of sections (+&amp;80 for a negative ENT number, ie the envelope is run until end of sound
&amp;ADA3&amp;ADBC3first section of the envelope:
&amp;ADA3&amp;ADBC1step count (if &lt;&amp;80) otherwise envelope shape (not tone envelope)
&amp;ADA4&amp;ADBD1step size (if step count&lt;&amp;80) otherwise envelope period (not tone envelope)
&amp;ADA5&amp;ADBE1pause time (if step count&lt;&amp;80) otherwise envelope period (nottone envelope)
&amp;ADA6&amp;ADBF3second section of the envelope, as &amp;ADA3
&amp;ADA9&amp;ADC23third section of the envelope, as &amp;ADA3
&amp;ADAC&amp;ADC53fourth section of the envelope, as &amp;ADA3
&amp;AADAF&amp;ADC83fifth section of the envelope, as &amp;ADA3
&amp;ABD2&amp;ADCB5
&amp;ADB7&amp;ADD0&amp;36
&amp;ADEB&amp;AE042
&amp;ADED&amp;AE066
&amp;ADF3&amp;AE0C26*1table of DEFINT (&amp;02), DEFSTR (&amp;03) or DEFREAL default (&amp;05), for variables 'a' to 'z'
&amp;AE0D&amp;AE26
&amp;AE0E&amp;AE272
&amp;AE10&amp;AE292
&amp;AE12&amp;AE2B2
&amp;AE14&amp;AE2D1
&amp;AE15&amp;AE2E2address of line number LB of last BASIC line (or &amp;FFFF)
&amp;AE17&amp;AE302address of byte before next DATA item (eg comma or space)
&amp;AE19&amp;AE322address of next space on GOSUB etc stack, (see also &amp;B06F)
&amp;AE1B&amp;AE342address of byte before current statement (&amp;003F if in Direct Command mode)
&amp;AE1D&amp;AE362address of line number LB of line of current statement (&amp;0000 if in Direct Command mode)
&amp;AE1F&amp;AE381trace flag (0=TROFF; &lt;0=TRON)

6128464SizeComments on the memory locations
&amp;AE20&amp;AE391flag used with Trace (&amp;00 if in Direct Command mode; &amp;01 if in a program)
&amp;AE21&amp;AE3A
&amp;AE22&amp;AE3B2
&amp;AE24&amp;AE3D2
&amp;AE26&amp;AE3F2address to load cassette file to
&amp;AE28&amp;AE41
&amp;AE29&amp;AE421file type from cassette header
&amp;AE2A&amp;AE432file length from cassette header
&amp;AE2C&amp;AE451program protection flag (&lt;=&gt;0 hides program as if protected)
&amp;AE2D&amp;AE4617buffer used to form binary or hexadecimal numbers before printing etc
&amp;AE3A&amp;AE535start of buffer used to form hexadecimal numbers before printing etc
&amp;AE3A&amp&amp;AE531Key Number used with INKEY (providing the Key Number is written as a decimal)
&amp;AE3E&amp;AE571last byte (usually &amp;00 or &amp;20) of the formed binary or hexadecimal number
&amp;AE43&amp;AE5D13buffer used to form decimal numbers before printing etc
&amp;AE4E&amp;AE681last byte (usually &amp;00 or &amp;00) of the formed decimal number
&amp;AE6B3
&amp;AE511
&amp;AE52&amp;AE6E2
&amp;AE541
&amp;AE702temporary store for address after using (&amp;AE68)
&amp;AE55&amp;AE722address of last used ROM or RSX JUMP instruction in its Jump Block
&amp;AE57&amp;AE741ROM Select number if address above is in ROM
&amp;AE58&amp;AE752BASIC Parser position, moved on to : : , or the end of program line byte after a CALL or an RSX
&amp;AE5A&amp;AE772the resetting address for machine Stack Pointer after a CALL or an RSX
&amp;AE5C&amp;AE792ZONE value
&amp;AE5D1
&amp;AE7A1
&amp;AE5E&amp;AE7B2HIMEM (set by MEMORY)
&amp;AE7D2address of the byte before the UDG area (the end of the user M/C routine area or the Strings area) if the UDG area is still present, otherwise the highest byte of Program etc area
&amp;AE602address of highest byte of free RAM (ie last byte of UDG area)
&amp;AE62&amp;AE7F2address of start of ROM lower reserved area (used for tokenised lines)
&amp;AE64&amp;AE812address of end of ROM lower reserved area (byte before Program area)
&amp;AE66&amp;AE832as &amp;AE68

The Amstrad CPC Firmware Guide


6128464SizeComments on the memory locations
&AE68&AE852address of start of Variables and DEF FNs area
&AE6A&AE872address of start of Arrays area (where next Variable or DEF FN entry is placed)
&AE6C&AE892address of start of free space (where next Array entry is placed)
&AE6E1
&AE70&AE8C&1FFGOSUB, FOR and WHILE stack. Entries are added above any existing ones in use (mixed as encountered) at address given by &B06F and must be used up in the opposite order. Completed entries are not deleted, just overwritten by the next new entry:
1(byte of &amp;00)
2address of end of program line byte or :: after GOSUB statement (the point to RETURN to)
2address of line number HB of line containing GOSUB
1byte of &amp;06, ie the length of the GOSUB entry
2address of current value of control variable (in Variables area)
5value of limit (ie the TO value) - there are two bytes only for Integer FORs
5value of STEP - two bytes for Integer FORs
1sign byte (&amp;00 for positive; &amp;01 for negative)
2address of the end of program line byte, or :: after the FOR statement (ie the address for the NEXT loop to restart at)
2address of line number LB of line containing FOR
2address of byte after NEXT statement (ie the address to continue at when the limit is exceeded)
2address of byte after NEXT statement again
1length byte (&amp;16 for Real FORs; &amp;10 for Integer FORs)
WHILE
(66 max
capacity):
2address of line number LB of line containing WHILE
2address of the end of program line byte or :: after WEND statement (ie the address to continue at when the condition is false)
2address of condition after the WHILE command
1length byte of &amp;07 - end of WHILE entry proper but:
+5value of condition (0 or -1 as a floating point value) only while the WHILE entry is the last on the stack
&B06F&B08B2address of the next space on the GOSUB etc stack (see also &amp;AE19)
NB: The free space on the stack is also used as a workspace by various routines for values and addresses and for Variable names
&B071&B08D2address of end of free space (the byte before the Strings area)
&B073&B08F2address of end of Strings area (=HIMEM)
&B0751
&B0911

6128464SizeComments on the memory locations
&B0922
&B076&B0942
&B078&B0962address of the highest byte of free RAM disregarding UDGs (usually A6FB)
&B07A&B0982
&B07C&B09A2address for the next entry in the String Concatenation area
&B07E&B09C10*3concatenation area holding descriptors of strings being used
&B09C&B0BA1length of last String used
&B09D&B0BB2address of last String used
&B0BD2
&B0BF2
&B09F&BOC11type byte used with the Virtual Accumulator (&amp;02=Integer; &amp;03=String; &amp;05=Real)
&B0A0&B0C25Virtual Accumulator used by the maths routines (two bytes for an Integer value; three bytes for a String Descriptor; five bytes for a Real value)
&B0A0&B0C22
&B0A2&B0C41
&B0A3&B0C52
&B0A5&B0C7&amp;5B(&amp;39 bytes on 464) bytes of &amp;FF
&B100&B8E42&amp;07, &amp;C6
&B102&B8E62&amp;65, &amp;89
&B104&B8E85
&B109&B8ED5
&B10E&B8F25
&B113&B8F71DEG/RAD flag (&amp;00=RAD; &amp;FF=DEG)
&B114&B8DC1
&B115&B8DD1
&B116&B8DE1
&B117&B8DF1
&B118&B800&amp;D2Area used for Cassette handling:
&B118&B8001cassette handling messages flag (0=enabled; &lt;0=disabled)
&B119&B8011
&B11A&B8021file IN flag (&amp;00=closed; &amp;02=IN file; &amp;03=opened; &amp;05=IN char)
&B11B&B8032address of 2K buffer for directories
&B11D&B8052address of 2K buffer for loading blocks of files - often as &amp;B11B
&B11F&B807&amp;40IN Channel header
&B11F&B807&amp;10filename (padded with NULs)
&B12F&B8171number of block being loaded, or next to be loaded
&B130&B8181last block flag (&amp;FF=last block; &amp;00=not)

6128464SizeComments on the memory locations
&B131&B8191file type (&lt;00=BASIC; &lt;01=Protected BASIC; &lt;02=Binary; &lt;08=Screen; &lt;16=ASCII)
&B132&B81A2length of this block
&B134&B81C2address to load this or the next block at, or the address of the byte after last one loaded
&B136&B81E1first block flag (&lt;FF=first block; &lt;00=not)
&B137&B81F2total length of file (all blocks)
&B139&B8212execution address for BIN files (&lt;0000 if not saved as such)
&B13B&B823&lt;24not allocated
&B15F&B8471file OUT flag (&lt;00=closed; &lt;02=IN file; &lt;03=opened; &lt;05=IN char)
&B160&B8482address to start the next block save from, or the address of the buffer if it is OPENOUT
&B162&B84A2address of start of the last block saved, or the address of the buffer if it is OPENOUT
&B164&B84C&lt;40OUT Channel Header (details as IN Channel Header):
&B164&B84C&lt;10filename
&B174&B85C1number of the block being saved, or next to be saved
&B175&B85D1last block flag (&lt;FF=last block; &lt;00=not)
&B176&B85E1file type (as at &lt;B131
&B177&B85F2length saved so far
&B179&B8612address of start of area to save, or address of buffer if it is an OPENOUT instruction
&B17B&B8631first block flag (&lt;FF=first block; <00=not)
&B17C&B8642total length of file to be saved
&B17E&B8662execution address for BIN files (&lt;0000if parameter not supplied)
&B180&B868&lt;24not allocated
&B1A4&B88C&lt;40used to construct IN Channel header:
&B1B5&B89D1
&B1B7&B89F2
&B1B8&B8A31
&B1BE&B8A61
&B1B9&B51Dbase address for calculating relevant Sound Channel block
&B1BC&B520base address for calculating relevant Sound Channel ?
&B1BE&B522base address for calculating relevant Sound Channel ?
&B1D5&B539base address for calculating relevant Sound Channel ?
&B1E4&B8CC1
&B1E5&B8CD1synchronisation byte
&B1E6&B8CE2&lt;55, &62
&B1E8&B8D01
&B1E9&B8D11cassette precompensation (default &lt;06; SPEED WRITE 1 &lt;0C @4microseconds)
&B1EA&B8D21cassette 'Half a Zero' duration (default &lt;53; SPEED WRITE 1 &lt;29 @ 4microseconds)

6128464SizeComments on the memory locations
&B1EB&B8D32
&B5501 used by sound routines
&B5511 used by sound routines
&B1ED1used by sound routines
&B11EE&B5521used by sound routines
used by sound routines
&B1F0&BB541used by sound routines
&B55C&3FSound Channel A (1) data:
number of sounds still queuing
&B212&B5761number of sounds originally queuing

6128464SizeComments on the memory locations
&B336&B69A&10ENV 9
&B346&B6AA&10ENV 10
&B356&B6BA&10ENV 11
&B366&B6CA&10ENV 12
&B376&B6DA&10ENV 13
&B386&B6EA&10ENV 14
&B396&B6FA&10ENV 15
&B396&B6FAbase address for calculating relevant ENT parameter block
&B3A6&B70A15*16ENT parameter block area (each arranged as &ADA2):
&B3A6&B70A10ENT 1
&B3B6&B71A&10ENT 2
&B3C6&B72A&10ENT 3
&B3D6&B73A&10ENT 4
&B3E6&B74A&10ENT 5
&B3F6&B75A&10ENT 6
&B406&B76A&10ENT 7
&B416&B77A&10ENT 8
&B426&B78A&10ENT 9
&B436&B79A&10ENT 10
&B446&B7AA&10ENT 11
&B456&B7BA&10ENT 12
&B466&B7CA&10ENT 13
&B476&B7DA&10ENT 14
&B486&B7EA&10ENT 15
&B496&B34C&50Normal Key Table:
Cur UCur RCur Df9f6f3Enterf.
Cur LCopyf7f8f5f1f2f0
Clr[Ret]f4\
^-@p;:/.
09oilkmj
87uyhjnSpace
65rtgfbv
43ewsdcx
12EscqTabaCapsz
[VT][LF][BS][TAB]Fire2Fire1Del
Cur UCur RCur Df9f6f3Enterf.
Cur LCopyf7f8f5f1f2f0
Clr[Ret]f4.
£=lP+*?>
_)OlLKM<
('UYHJNSpace
&%RTGFBV
$#EWSDCX
Cur UCur R
Copy
Cur Df9f6f3Enter
f1
f.
Cur LCopyf7f8f5f2f0
Clr[Ret]f4.
£=lP+
*
?>
_)OlKM<
('UYHNSpace
&%RTG
$#EWSCX

The Amstrad CPC Firmware Guide


1"EscQ->ACapsZ
[VT][LF][BS][TA]Fire2Fire1

&B536 &B3EC &50 Control Key Table:

Cur UCur RCur Df9f6f3Enterf.
Cur LCopyf7f8f5f1f2f0
Clr(ESC)Ret(GS)f4(FS)
(RS)(NUL)(DLE)
(US)(SI)(HT)(FF)(VT)(CR)
(NAK)(EM)(BS)(LF)(SO)
(DC2)(DC4)(BEL)(ACK)(STX)(SYN)
(ENQ)(ETB)(DC3)(EOT)(ETX)(CAN)
~Esc(DC1)Ins/Ovrt(SOH)S-Ick(SUB)
Del

&B586 &B43C 10 KB repeats table (each byte/bit applies to all three key tables): 1 byte is used per line of the tables; b0 to b7 give the columns (left to right), repeat if set

&B590 &B446 &98 DEF KEY’s definition area (for Keys &80 to &9F in sequence): each definition has either a single byte of &00 if it is unused/unaltered, or: byte 1: length of definition bytes 2 to x: definition, either a single key or a string of keys

&B628 &B4DE 1 Byte after end of DEF KEY area

&B629 &B4DF 1

&B62A &B4E0 1

&B62B &B4E1 2 address of DEF KEY area

&B62D &B4E3 2 address of byte after end of DEF KEY area

&B62F &B4E5 1

&B630 &B4E6 1

&B631 &B4E7 1 Shift lock flag (&00=off; &FF=on)

&B632 &B4E8 1 Caps lock flag (&00=off; &FF=on)

&B633 &B4E9 1 KB repeat period (SPEED KEY - default &02 @ 0.02 seconds)

&B634 &B4EA 1 KB delay period (SPEED KEY - default &1E @ 0.02 seconds)

&B635 &B4EB 2*10 Tables used for key scanning; bits 0 to 7 give the table columns (from left to right):

&B635 &B4EB 1

Cur UCur RCur D f9 f6 f3Enterf.
Cur LCopy f7 f8 f5 f1 f2f0
Cir[Ret] f4 Shift \ Ctrl
A·@p:::
090ikmj
87uhjnSpace

&B636 &B4EC 1

&B637 &B4ED 1

&B638 &B4EE 1

&B639 &B4EF 1

&B63A &B4F0 1


</table> ---
6128464SizeComments on the memory locations
&B63B&B4F11DownUpLeftRightFire2Fire1(Joystick 1)
65rtgfbv
&B63C&B4F2143ewsdcx
&B63D&B4F3112EscqTabaCapsz
&B63E&B4F41DownUpLeftRightFire2 Fire1(Joystick 2)
Del
&B63F&B4F51complement of &B635
&B640&B4F61complement of &B636
6128464SizeComments on the memory locations
&B691&B5472address of the KB repeats table
&B6921
&B693&B3282ORIGIN x
&B695&B32A2ORIGIN y
&B697&B32C2graphics text x position (pixel)
&B699&B32E2graphics text y position(pixel)
&B69B&B3302graphics window x of one edge (pixel)
&B69D&B3322graphics window x of other edge (pixel)
&B69F&B3342graphics window y of one side (pixel)
&B6A1&B3362graphics window y of other side (pixel)
&B6A3&B3381GRAPHICS PEN
&B6A4&B3391GRAPHICS PAPER
&B6A5&B33A8/14(This area is 14 bytes on the 464) Used by line drawing (and other) routines, as follows:
&B6A7&B33A2x+1()
&B6A9&B33C2y/2+1()
&B6AB&B33E2y/2-x()
&B6AD&B3402
&B3422
&B6AF&B3441
&B6B0&B3451
&B6B1&B3461
&B6B21first point on drawn line flag (&lt;=&gt;0=to be plotted; 0=don't plot)
&B6B31line MASK
&B6B41
&B2072
&B6B5&B20C1current stream number
&B6B6&B20D14/15(These areas are 15 bytes on the 464) Stream (window) 0 parameter block. These areas are arranged as &8B726
&B6C4&B21C14/15stream (window) 1 parameter block
&B6D2&B22B14/15stream (window) 2 parameter block
&B6E0&B23A14/15stream (window) 3 parameter block
&B6EE&B24914/15stream (window) 4 parameter block
&B6FC&B25814/15stream (window) 5 parameter block
&B70A&B26714/15stream (window) 6 parameter block
&B718&B27614/15stream (window) 7 parameter block
&B726&B28514/15Current Stream (Window) parameter block:
&B726&B2851cursor y position (line) with respect to the whole screen (starting from 0)
&B727&B2861cursor x position (column) with respect to the whole screen (starting from 0)
&B728&B287
---
6128464SizeComments on the memory locations
&B729&B2881window top line (y) with respect to the whole screen (starting from 0)
&B72A&B2891window left column (x) with respect to the whole screen (starting from 0)
&B72B&B28A1window bottom line (y) with respect to the whole screen (starting from 0)
&B72C&B28B1window right column (x) with respect to the whole screen (starting from 0)
&B72D&B28C1scroll count
&B72E&B28D1cursor flag (&amp;01=disable; &amp;02=off; &amp;FD=on; &amp;FE=enable)
&B72F&B28F1current PEN number (encoded, not its INK number)
&B730&B2901current PAPER number (encoded, not its INK number)
&B731&B2912address of text background routine: opaque=&amp;1392; transparent=&amp;13A0
&B733&B2931graphics character writing flag (0=off; &lt;&gt;0=on)
&B734&B2941ASCII number of the first character in User Defined Graphic (UDG) matrix table
&B735&B2951UDG matrix table flag (&amp;00=non-existent; &amp;FF=present)
&B736&B2962address of UDG matrix table
&B738&B2982
&B758&B2B81
&B759&B2B91
&B763&B2C332*3Control Code handling routine table - each code's entry comprises: byte 1: +0 to +9=number of parameters; +&amp;80=re-run routine at a System Reset bytes 2 and 3: address of the control code's handling routine
&B763&B2C33ASC 0: &amp;80,&amp;1513: NUL
&B766&B2C63ASC 1: &amp;81,&amp;1335: Print control code chararacter [,char]
&B769&B2C93ASC 2: &amp;80,&amp;1297: Disable cursor
&B76C&B2CC3ASC 3: &amp;80,&amp;1286: Enable cursor
&B76F&B2CF3ASC 4: &amp;81,&amp;0AE9: Set mode [,mode]
&B772&B2D23ASC 5: &amp;81,&amp;1940: Print character using graphics mode [,char]
&B775&B2D53ASC 6: &amp;00,&amp;1459: Enable VDU
&B778&B2D83ASC 7: &amp;80,&amp;14E1: Beep
&B77B&B2DB3ASC 8: &amp;80,&amp;1519: Back-space
&B77E&B2DE3ASC 9: &amp;80,&amp;151E: Step-right
&B781&B2E13ASC 10: &amp;80,&amp;1523: Linefeed
&B784&B2E43ASC 11: &amp;80,&amp;1528: Previous line
&B787&B2E73ASC 12: &amp;80,&amp;154F: Clear window and locate the cursor at position 1,1
&B78A&B2EA3ASC 13: &amp;80,&amp;153F: RETURN
&B78D&B2ED3ASC 14: &amp;81,&amp;12AB: Set paper [,pen]
&B790&B2F03ASC 15: &amp;81,&amp;12A6: Set pen [,pen]
---
6128464SizeComments on the memory locations
&B793&B2F33ASC 16: &amp;80, &amp;155E: Delete the character at the cursor position
&B796&B2F63ASC 17: &amp;80, &amp;1599: Clear the line up to the current cursor position
&B799&B2F93ASC 18: &amp;80, &amp;158F: Clear from the cursor position to the end of the line
&B79C&B2FC3ASC 19: &amp;80, &amp;1578: Clear from start of the window to the cursor position
&B79F&B2FF3ASC 20: &amp;80, &amp;1565: Clear from the cursor position to the end of a window
&B7A2&B3023ASC 21: &amp;80, &amp;1452: Disable VDU
&B7A5&B3053ASC 22: &amp;81, &amp;14EC: Set text write mode [,mode]
&B7A8&B3083ASC 23: &amp;81, &amp;0C55: Set graphics draw mode [,mode]
&B7AB&B30B3ASC 24: &amp;80, &amp;12C6: Exchange pen and paper
&B7AE&B30E3ASC 25: &amp;89, &amp;150D: Define user defined character [,char,8 rows of char]
&B7B1&B3113ASC 26: &amp;84, &amp;1501: Define window [,left,right,top,bottom]
&B7B4&B3143ASC 27: &amp;00, &amp;14EB: ESC (=user)
&B7B7&B3173ASC 28: &amp;83, &amp;14F1: Set the pen inks [,pen,ink 1,ink 2]
&B7BA&B31A3ASC 29: &amp;82, &amp;14FA: Set border colours [,ink,ink2]
&B7BD&B31D3ASC 30: &amp;80, &amp;1539: Locate the text cursor at position 1,1
&B7C0&B3203ASC 31: &amp;82, &amp;1547: Locate the text cursor at [,column,line]
&B7C3&B1C81MODE number
&B7C4&B1C92screen offset
&B7C6&B1CB1screen base HB (LB taken as &amp;00)
&B7C7&B1CC3graphics VDU write mode indirection - JP &amp;0C74
&B1CF8list of bytes having only one bit set, from b7 down to b0
&B7D2&B1D71first flash period (SPEED INK - default &amp;0A @ 0.02 seconds)
&B7D3&B1D81second flash period (SPEED INK - default &amp;0A @ 0,02 seconds)
&B7D4&B1D91+16Border and Pens' First Inks (as hardware numbers):
&B7D4&B1D91hw &amp;04 = sw 1 (blue) border
&B7D5&B1DA1hw &amp;04 = sw 1 (blue) pen 0
&B7D6&B1DB1hw &amp;0A = sw 24 (bright yellow) pen 1
&B7D7&B1DC1hw &amp;13 = sw 20 (bright cyan) pen 2
&B7D8&B1DD1hw &amp;0C = sw 6 (bright red) pen 3
&B7D9&B1DE1hw &amp;0B = sw 26 (bright white) pen 4
&B7DA&B1DF1hw &amp;14 = sw 0 (black) pen 5
&B7DB&B1E01hw &amp;15 = sw 2 (bright blue) pen 6
&B7DC&B1E11hw &amp;0D = sw 8 (bright magenta) pen 7
&B7DD&B1E21hw &amp;06 = sw 10 (cyan) pen 8
&B7DE&B1E31hw &amp;1E = sw 12 (yellow) pen 9
&B7DF&B1E41hw &amp;1F = sw 14 (pale blue) pen 10
---
6128464SizeComments on the memory locations
&B7E0&B1E51hw &amp;07 = sw 16 (pink) pen 11
&B7E1&B1E61hw &amp;12 = sw 18 (bright green) pen 12
&B7E2&B1E71hw &amp;19 = sw 22 (pale green) pen 13
&B7E3&B1E81hw &amp;04 = sw 1 (blue) pen 14
&B7E4&B1E91hw &amp;17 = sw 11 (sky blue) pen 15
&B7E5&B1EA1+16Border and Pens' Second Inks (as hardware numbers):
&B7E5&B1EA1hw &amp;04 = sw 1 (blue) border
&B7E6&B1EB1hw &amp;04 = sw 1 (blue) pen O
&B7E7&B1EC1hw &amp;0A = sw 24 (bright yellow) pen 1
&B7E8&B1ED1hw &amp;13 = sw 20 (bright cyan) pen 2
&B7E9&B1EE1hw &amp;0C = sw 6 (bright red) pen 3
&B7EA&B1FF1hw &amp;0B = sw 26 (bright white) pen 4
&B7EB&B1F01hw &amp;14 = sw 0 (black) pen 5
&B7EC&B1F11hw &amp;15 = sw 2 (bright blue) pen 6
&B7ED&B1F21hw &amp;0D = sw 8 (bright magenta) pen 7
&B7EE&B1F31hw &amp;06 = sw 10 (cyan) pen 8
&B7EF&B1F41hw &amp;1E = sw 12 (yellow) pen 9
&B7F0&B1F51hw &amp;1F = sw 14 (pale blue) pen 10
&B7F1&B1F61hw &amp;07 = sw 16 (pink)pen 11
&B7F2&B1F71hw &amp;12 = sw 18 (bright green)pen 12
&B7F3&B1F81hw &amp;19 = sw 22 (pale green ) pen 13
&B7F4&B1F91hw &amp;04 = sw 1 (bright yellow) pen 14
&B7F5&B1FA1hw &amp;17 = sw 11 (pink) pen 15
&B7F6&B1FB1
&B7F7&B1FC1
&B7F8&B1FD1
&B7F9&B1FE2
&B7FB&B2002
&B7FD
&B8021+1
&B8041number of entries in the Printer Translation Table (normally 10)
&B80520*2Printer Translation Table; each entry comprises: byte 1:
screen code byte 2: printer code
&B8052screen &amp;A0 printer &amp;5E (acute accent)
&B8072screen &amp;A1 printer &amp;5C (\)
&B8092screen &amp;A2 printer &amp;7B (\)
&B80B2screen &amp;A3 printer &amp;23 (#)
&B80D2screen &amp;A6 printer &amp;40 (@)
&B80F2screen &amp;AB printer &amp;7C (\)
&B8112screen &amp;AC printer &amp;7D (\)
&B8132screen &amp;AD printer &amp;7E (~)
---
6128464SizeComments on the memory locations
&B8152screen &amp;AE printer &amp;5D (I)
&B8172screen &amp;AF printer &amp;SE (I)
&B81920room for ten more translations
&B82D&B1001
&B82E&B1011
&B82F&B1022
&B831&B1041
&B832&B1052temporary store for stack pointer (SP) during interrupt handling
&B834&B107&amp;70temporary machine stack (from &amp;B8B3 downwards) during interrupt handling
&B8B4&B1874TIME (stored with the LB first - four bytes give &gt;166 days; three bytes give &gt;15 hours)
&B8B8&B18B1
&B8B9&B18C2
&B8BB&B18E2
&B8BD&B1902address of the first ticker block in chain (if any)
&B8BF&B1921Keyboard scan flag (&amp;00=scan not needed; &amp;01=scan needed)
&B8C0&B1932address of the first event block in chain (if any)
&B8C2&B1951
&B8C3&B196&amp;10buffer for last RSX or RSX command name (last character has bit 7 set)
&B8D3&B1A62address of first ROM or RSX chaining block in chain
&B8D51RAM bank number
&B8D6&B1A81Upper ROM status (eg select number)
&B8D7&B1A92entry point of foreground ROM in use (eg &amp;C006 for BASIC ROM)
&B8D9&B1AB1foreground ROM select address (0 for the BASIC ROM)
&B8DA16*2ROM entry IY value (ie the address table) - the 6128 has ROMs numbered from 0 to 15:
&B1AC7*2ROM entry IY value (ie the address table)
&B8DA2ROM 0 IY (not for the 464)
&B8DC&B1AC2ROM 1 IY
&B8DE&B1AE2ROM 2 IY
&B8E0&B1B02ROM 3 IY
&B8E2&B1B22ROM 4 IY
&B8E4&B1B42ROM 5 IY
&B8E6&B1B62ROM 6 IY
&B8E8&B1B82ROM 7 IY (usually &amp;A700 for AMSDOS/CPM ROM)
&B8EA2ROM 8 IY (not 464)
&B8EC2ROM 9 IY (not 464)
&B8EE2ROM 10 IY (not 464)
&B8F02ROM 11 IY (not 464)
---
6128464SizeComments on the memory locations
&B8F22ROM 12 IY (not 464)
&B8F42ROM 13 IY (not 464)
&B8F62ROM 14 IY (not 464)
&B8F82ROM 15 IY (not 464)
&B8FA66 bytes of &amp;FF
&B1BA14 14 bytes of &amp;00
&B900&B90012*3 High Kernel Jumplock (on the 464 this block is 11*3 bytes in size)
&B924&B921&amp;1C0 routines used by the High Kernel Jumplock (on the 464 this is &amp;1C8 bytes in size)
&B4EA&B4E9bytes of &amp;FF (&amp;1C bytes on 6128, &amp;17 bytes on 464)
&B800&B80026*3 Key Manager Jumplock
&B4E&B4E36*3 Text VDU Jumplock
&B8BA&B8BA23*3 Graphics VDU Jumplock
&B8FF&B8FF34*3 Screen Pack Jumplock
&BC65&BC6522*3 Cassette (and Disc if fitted) Manager Jumplock
&BCA7&BCA711*3 Sound Manager Jumplock
&BCC8&BCC825*3 Kernel Jumplock
&BD13&BD1326*3 Machine Pack Jumplock (on the 464 this block is 14*3 bytes in size)
&BD61&BD3D32*3 Maths Jumplock (on the 464 this block is 48*3 bytes in size)
&BDDD&BDDD14*3 Firmware Indirections (on the 464 this block is 13*3 bytes in size
&BDF7&BDF4bytes of &amp;00 (&amp;09 bytes on 6128, &amp;0C bytes on the 464) the lower limit of Machine Stack if no Disc Drive
&BEO0&BEO0&amp;40 &amp;40 bytes of &amp;FF
&BEA0&BEA0&amp;4x used by the AMSDOS ROM if a disc drive is fitted (otherwise &amp;4x bytes of &amp;FF)
&BEA0&BEA02 (address A910)
&BEA2&BEA22 address of drive A XDPB
&BEA4&BEA49 Disc Set Up timing block:
&BEA4&BEA42 motor on period (default &amp;0032; fastest &amp;0023 @ 20mS)
&BEA6&BEA62 motor off period (default &amp;00FA; fastest &amp;00C8 @ 20mS)
&BEA8&BEA81 write current off period (default &amp;AF @ 10aS)
&BEA9&BEA91 head settle time (default &amp;0F @ 1mS)
&BEA4&BEA41 step rate period (default &amp;0C; fastest &amp;0A @ 1mS)
&BEA8&BEA8B head unload delay (default &amp;01)
&BEA4C&BEA4C1 b0=non DMA mode; b1 to b7=head load delay (default &amp;03)
&BEA4D&BEA4D2
&BEA4F&BEA4F1 Drive Header Information Block:
&BEA4F&BEA4F1 last track used
&BEA50&BEA501 head number (&amp;00)
&BEA51&BEA511 last sector used
---
6128464SizeComments on the memory locations
&BE52&BE521log2( sector size)-7
&BE53&BE531
&BE54&BE541
&BE55&BE551
&BE56&BE561
&BE58&BE581
&BE59&BE591
&BE5D&BE5D1
&BE5E&BE5E1
&BE5F&BE5F1disc motor flag (&amp;00=off;&amp;01=on - strangely reversed)
&BE60&BE602address of buffer for directory entries block (&amp;A930)
&BE62&BE622as &amp;BE76 (ie&amp;A9B0)
&BE64&BE642
&BE66&BE661disc retries (default &amp;10)
&BE67&BE67&amp;11AMSDOS Ticker and Event Block:
&BE67&BE672ticker chaining address
&BE69&BE692tick count
&BE6B&BE6B2recharge count
&BE6D&BE6D2event chaining address
&BE6F&BE6F1count
&BE70&BE701class (asynchronous event)
&BE71&BE712ROM routine address (&amp;C9D6)
&BE73&BE731ROM select number (&amp;07 ie the AMSDOS/CPM ROM)
&BE74&BE741last sector number used
&BE75&BE751
&BE76&BE762address of &amp;K buffer, or of header info block (for WRITE SECTOR etc)
&BE78&BE781disc error message flag (&amp;00=on; &amp;FF=off - reversed again)
&BE7D&BE7D2address of AMSDOS reserved area (&amp;A700)
&BE7F&BE7Fxarea used by AMSDOS to copy routines into RAM for running
&BE80&BE80&amp;80&amp;80 bytes of &amp;FF (limit of machine stack if disc drive fitted)
&BF00&BF00xy&amp;xy bytes of &amp;00)
&BFxymachine stack (in theory this stack could extend down much further)
&BFFF&BFFFupper limit of machine stack
--- The area from &C000 to &FFFF is taken up by the screen memory - the layout of which is illustrated below. Printed below are diagrams which show how the CPC uses the bytes of screen memory in the different MODEs. For each byte: in MODE 2 (where there are two colours only, each pixel needs only one bit - either on or off) bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 p0 p1 p2 p3 p4 p5 p6 p7 (the pixels are arranged with p0 being the leftmost one, etc) in MODE 1 (where four colours are available and so two bits are needed for each pixel - 1 byte represents 4 pixels) bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 p0(1) p1(1) p2(1) p3(1) p0(0) p1(0) p2(0) p3(0) p0(1) p1(1) p2(1) p3(1) (each pixel is twice as wide as in MODE 2) in MODE 0 (where sixteen colours are possible and four bits are needed for each pixel - 1 byte represents 2 pixels) bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 p0(0) p1(0) p0(2) p1(2) p0(1) p1(1) p0(3) p1(3) (each pixel is four times as wide as in MODE 2) NB: The numbers in brackets show which bit of the pixel's pen number the screen byte bit refers to. For example in MODE 1, the 4 most significant bits of the byte hold bit 1 of the pixel's pen value and the least significant bits hold bit 0 of the pen value.
LINEROW0ROW1ROW2ROW3ROW4ROW5ROW6ROW7
1C000C800D000D800E000E800F000F800
2C050C850D050D850E050E850F050F850
3C0A0C8A0D0A0D8A0E0A0E8A0F0A0F8A0
4C0F0C8F0D0F0D8F0E0F0E8F0F0F0F8F0
5C140C940D140D940E140E940F140F940
6C190C990D190D990E190E990F190F990
7C1E0C9E0D1E0D9E0E1E0E9E0F1E0F9E0
8C230CA30D230DA30E230EA30F230FA30
9C280CA80D280DA80E280EA80F280FA80
10C2D0CAD0D2D0DAD0E2D0EAD0F2D0FAD0
11C320CB20D320DB20E320EB20F320FB20
12C370CB70D370DB70E370EB70F370FB70
13C3C0CBC0D3C0DBC0E3C0EBC0F3C0FBC0
14C410CC10D410DC10E410EC10F410FC10
15C460CC60D460DC60E460EC60F460FC60
---
16C4B0CCB0D4B0DCB0E4B0ECB0F4B0FCB0
17C500CD00D500DD00E500ED00F500FD00
18C550CD50D550DD50E550ED50F550FD50
19C5A0CDA0D5A0DDA0E5A0EDA0F5A0FDA0
20C5F0CDF0D5F0DDF0E5F0ED50F550FD50
21C640CE40D640DE40E640EE40F640FE40
22C690CE90D690DE90E690EE90F690FE90
23C6E0CEE0D6E0DEE0E6E0EEE0F6E0FEE0
24C730CF30D730DF30E730EF30F730FF30
25C780CF80D780DF80E780EF80F780FF80
spare startC7D0CFD0D7D0DFD0E7D0EFD0F7D0FFD0
spare endC7FFCFFFD7FFDFFFE7FFEFFFF7FFFFFF
Once the whole screen has been scrolled in any direction, the table will become incorrect. On scrolling, all the above addresses will have an offset (MOD &800) added, derived as follows: +&02 per scroll to the left (2, 1 or ½ character in MODE 2, MODE 1 or MODE 0 respectively) - &02 per scroll to the right (2, 1 or ½ character in MODE 2, MODE 1or MODE 0 respectively) +&50 per scroll up one line - &50 per scroll down one line If scrolled far enough, a screen row may sit across the boundaries of the screen memory area, whose bottom end will then wrap around to join up with the top (ie byte &FFFF will be followed by byte &C000 assuming the normal screen area). If before scrolling however, a window had been set up smaller than the whole screen then the table will remain accurate despite any scrolling. The 'spare' areas of screen memory are filled with bytes of the relevant PAPER value each time there is a full screen CLS, and are not really available for other uses. After scrolling the spare areas may be used as screen with other bytes becoming spare. --- The Amstrad CPC Firmware Guide --- ## The Firmware Guide - Summary The Firmware Jumplock is the recommended method of communicating with the routines in the lower ROM - it is used by BASIC, and it should also be used by other programs. The reason for using the jumplock is that the routines in the lower ROM are located at different positions on the different machines. The entries in the jumplock, however, are all in the same place - the instructions in the jumplock redirect the computer to the correct place in the lower ROM. Thus, providing a program uses the jumplock, it should work on any CPC computer. By altering the firmware jumplock it is possible to make the computer run a different routine from normal. This could either be a different routine in the lower or upper ROM, or a routine written by the user - this is known as 'patching the jumplock'. It is worth noting that because BASIC uses the firmware jumplock quite heavily, it is possible to alter the effect of BASIC commands. The following example will change the effect of calling SCR SET MODE (&BCOE) - instead of changing the mode, any calls to this location will print the letter 'A'. The first thing to do is to assemble the piece of code that will be used to print the letter - this is printed below and starts at &4000. ORG &4000 LD A,65 ;65 is ASCII FOR 'A' CALL &BB5A ;TXT OUTPUT RET ; return from subroutine The jumplock entry for SCR SET MODE is now patched so that it reroutes all calls to &BCOE away from the lower ROM and to our custom routine at &4000. This is done by changing the bytes at &BCOE, &BC0F and &BC10 to &C3, &00, &40 respectively (ie JP &4000). Any calls to &BC0E or MODE commands will now print the letter A instead of changing mode. The indirections jumplock contains a small number of routines which are called by the rest of the firmware. By altering this jumplock, it is possible to alter the way in which the firmware operates on a large scale - thus it is not always necessary to patch large numbers of entries in the firmware jumplock. There are two jumplocks which are to do with the Kemel (ie the high and low Kernel jumplocks). The high jumplock allows ROM states and interrupts to be altered, and also controls the introduction of RSXs. The low jumplock contains general routines and restart instructions which are used by the computer for its own purposes. --- The Amstrad CPC Firmware Guide --- ## The Kernel ## &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 B contains the foreground ROM select address (if any), DE contains the ROM entry address, C holds Exit the ROM select address for a RAM foreground program, AF and HL are corrupt, and all others are preserved ## &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 This routine looks at the ROM select addresses from 0 to 15 (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 ## &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 memory, HL holds the address of the last useable byte of memory Exit DE holds the address of the new first useable byte of memory, HL holds the address of the new last usable byte. AF and B are corrupt, and all other registers are preserved The ROM select address must be in the range of 0 to 15 (or 1 to 7 for the 464) although address 7 is for 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 INIT BACK ## &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 ## &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 If the name was found in a RSX or background ROM then Carry is true, C contains the ROM select Exit 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 ## &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 ## &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 ## &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 &BCE0 KL NEW FAST TICKER Action Sets up a fast ticker event block which will be run whenever the I/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 ## &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 I/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 ## &BCE6 KL DEL FAST TICKER Action Removes a fast ticker event block from the list of routines run when the I/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 # &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 32Kof 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 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 ## &BCEC KL DEL TICKER Action Removes a ticker event block from the list of routines that are run when a I/50th sec ticker interrupt occurs Entry HL contains the address of the event block 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 ## &BCEF KL INIT EVENT Action Initialises an event block Entry HL contains the address of the event block (in the central 32Kf 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 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 Notes 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 ## &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 ## &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 ## &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 ## &BCFB KL NEXT SYNC Action Finds out if there is a synchronous event with a higher priority Entry No entry conditions If there is an event to be processed, then Carry is true, HL contains the address of the event block, and Exit 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 ## &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 ## &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 prevented 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 ## &BD04 KL EVENT DISABLE Action Disables normal synchronous events Entry No entry conditions Exit HL is corrupt, and all other registers are preserved ## &BD07 KL EVENT ENABLE Action Enables normal synchronous events Entry No entry conditions Exit HL is corrupt, and all other registers are preserved Action Disarms 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 ## &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 significant byte of the time elapsed, and L holds the least significant; the four byte count overflows after approximately l66 days have elapsed. ## &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 ## Low Kernel Jumplock ## &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) ## &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 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 jumplock ## &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 orare returned unaltered The two byte low address in the HL register pair is defined as follows Notes 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 ## &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 ## &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 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 ## &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 route or are returned unchanged 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 addres bits 0 to 13 contain the address to which is added &C000 - this gives th address of the routine to be called ## &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 ## &0018 FAR CALL (RST 3) Action Calls a routine anywhere in ROM 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 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 Notes &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 returned from, the ROM selection and state are restored to their settings before the RST 3 command ## &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 returmed unchanged Notes See FAR CALL (RST 3) above for more details on the ROM select byte ## &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 &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 ## &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 ## &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 ## &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 ## &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 Jumplock) ## &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 interrupts, 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 Jumplock ## &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 ## &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 al other registers are preserved Notes After this routine has been called, all reading from addresses between &C000and &FFFF refers to the top 16K of RAM which is usually the screen memory --- ## &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 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 ## &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 al other registers are preserved After this routine has been called, all reading from addresses between &0000 and 4000 refers to the Notes bottom 16K of RAM; the lower ROM is automatically enabled when a firmware routine is called, and is then disabled when ## &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 ## &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 ## &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 ## &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 The ROM class may be one of the following: Notes &01 - a background ROM &02 - an extension foreground ROM &80 - the built in ROM (ie the BASIC ROM) ## &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 ## &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 ## &B91E KL DDR 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 destination 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 normal LDDR instruction, and all other registers are preserved ## &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 ## &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 ## &BB00 KM INITIALISE Initialises the Key Manager and sets up everything as it is when the computer is first switched on; the Action key buffer is emptied, Shift and Caps lock are turned 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 ## &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 ## &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 ## &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 ## &BBOC 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 ## &BBOF 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 ## &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 ## &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 --- ## &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 ## &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 ## &BB1E KM TEST KEY Action Tests if a particular key (or joystick direction or button) is pressed Entry A contains the key/joystick number 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 Shift 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 ## &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 ## &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 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 ## &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 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 ## &BB2A KM GET TRANSLATE Action Finds out what token or character will be assigned to a key when neither Shift nor Control are pressed <|det|>[[68, D 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 14 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0 0 0 17 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 19 0 0 0 0 0 0 0 0 20 0 0 0 0 0 0 0 0 21 0 0 0 0 0 0 0 0 22 0 0 0 0 0 0 0 0 23 0 0 0 0 0 0 0 0 24 0 0 0 0 0 0 0 0 25 0 0 0 0 0 0 0 0 26 0 0 0 0 0 0 0 0 27 0 0 0 0 0 0 0 0 28 0 0 0 0 0 0 0 0 29 0 0 0 0 0 0 0 0 30 0 0 0 0 0 0 0 0 31 0 0 0 0 0 0 0 0 32 0 0 0 0 0 0 0 0 33 0 0 0 0 0 0 0 0 34 0 0 0 0 0 0 0 0 35 0 0 0 0 0 0 0 0 36 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 0 38 0 0 0 0 0 0 0 0 39 0 0 0 0 0 0 0 0 40 0 0 0 0 0 0 0 0 41 0 0 0 0 0 0 0 0 42 0 0 0 0 0 0 0 0 43 0 0 0 0 0 0 0 0 44 0 0 0 0 0 0 0 0 45 0 0 0 0 0 0 0 0 46 0 0 0 0 0 0 0 0 47 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 49 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 51 0 0 0 0 0 0 0 0 52 0 0 0 0 0 0 0 0 53 0 0 0 0 0 0 0 0 54 0 0 0 0 0 0 0 0 55 0 0 0 0 0 0 0 0 56 0 0 0 0 0 0 0 0 57 0 0 0 0 0 0 0 0 58 0 0 0 0 0 0 0 0 59 0 0 0 0 0 0 0 0 60 0 0 0 0 0 0 0 0 61 0 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 0 63 0 0 0 0 0 0 0 0 64 0 0 0 0 0 0 0 0 65 0 0 0 0 0 0 0 0 66 0 0 0 0 0 0 0 0 67 0 0 0 0 0 0 0 0 68 0 0 0 0 0 0 0 0 69 0 0 0 0 0 0 0 0 70 0 0 0 0 0 0 0 0 71 0 0 0 0 0 0 0 0 72 0 0 0 0 0 0 0 0 73 0 0 0 0 0 0 0 0 74 0 0 0 0 0 0 0 0 75 0 0 0 0 0 0 0 0 76 0 0 0 0 0 0 0 0 77 0 0 0 0 0 0 0 0 78 0 0 0 0 0 0 0 0 79 0 0 0 0 0 0 0 0 80 0 0 0 0 0 0 0 0 81 0 0 0 0 0 0 0 0 82 0 0 0 0 0 0 0 0 83 0 0 0 0 0 0 0 0 84 0 0 0 0 0 0 0 0 85 0 0 0 0 0 0 0 0 86 0 0 0 0 0 0 0 0 87 0 0 0 0 0 0 0 0 88 0 0 0 0 0 0 0 0 89 0 0 0 0 0 0 0 0 90 0 0 0 0 0 0 0 0 91 0 0 0 0 0 0 0 0 92 0 0 0 0 0 0 0 0 93 0 0 0 0 0 0 0 0 94 0 0 0 0 0 0 0 0 95 0 0 0 0 0 0 0 0 96 0 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 98 0 0 0 0 0 0 0 0 99 0 0 0 0 0 0 0 0 100 0 0 0 0 0 0 0 0 101 0 0 0 0 0 0 0 0 102 0 0 0 0 0 0 0 0 103 0 0 0 0 0 0 0 0 104 0 0 0 0 0 0 0 0 105 0 0 0 0 0 0 0 0 106 0 0 0 0 0 0 0 0 107 0 0 0 0 0 0 0 0 108 0 0 0 0 0 0 0 0 109 0 0 0 0 0 0 0 0 110 0 0 0 0 0 0 0 0 111 0 0 0 0 0 0 0 0 112 0 0 0 0 0 0 0 0 113 0 0 0 0 0 0 0 0 114 0 0 0 0 0 0 0 0 115 0 0 0 0 0 0 0 0 116 0 0 0 0 0 0 0 0 117 0 0 0 0 0 0 0 0 118 0 0 0 0 0 0 0 0 119 0 0 0 0 0 0 0 0 120 0 0 0 0 0 0 0 0 121 0 0 0 0 0 0 0 0 122 0 0 0 0 0 0 0 0 123 0 0 0 0 0 0 0 0 124 0 0 0 0 0 0 0 0 125 0 0 0 0 0 0 0 0 126 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 128 0 0 0 0 0 0 0 0 129 0 0 0 0 0 0 0 0 130 0 0 0 0 0 0 0 0 131 0 0 0 0 0 0 0 0 132 0 0 0 0 0 0 0 0 133 0 0 0 0 0 0 0 0 134 0 0 0 0 0 0 0 0 135 0 0 0 0 0 0 0 0 136 0 0 0 0 0 0 0 0 137 0 0 0 0 0 0 0 0 138 0 0 0 0 0 0 0 0 139 0 0 0 0 0 0 0 0 140 0 0 0 0 0 0 0 0 141 0 0 0 0 0 0 0 0 142 0 0 0 0 0 0 0 0 143 0 0 0 0 0 0 0 0 144 0 0 0 0 0 0 0 0 145 0 0 0 0 0 0 0 0 146 0 0 0 0 0 0 0 0 147 0 0 0 0 0 0 0 0 148 0 0 0 0 0 0 0 0 149 0 0 0 0 0 0 0 0 150 0 0 0 0 0 0 0 0 151 0 0 0 0 0 0 0 0 152 0 0 0 0 0 0 0 0 153 0 0 0 0 0 0 0 0 154 0 0 0 0 0 0 0 0 155 0 0 0 0 0 0 0 0 156 0 0 0 0 0 0 0 0 157 0 0 0 0 0 0 0 0 158 0 0 0 0 0 0 0 0 159 0 0 0 0 0 0 0 0 160 0 0 0 0 0 0 0 0 161 0 0 0 0 0 0 0 0 162 0 0 0 0 0 0 0 0 163 0 0 0 0 0 0 0 0 164 0 0 0 0 0 0 0 0 165 0 0 0 0 0 0 0 0 166 0 0 0 0 0 0 0 0 167 0 0 0 0 0 0 0 0 168 0 0 0 0 0 0 0 0 169 0 0 0 0 0 0 0 0 170 0 0 0 0 0 0 0 0 171 0 0 0 0 0 0 0 0 172 0 0 0 0 0 0 0 0 173 0 0 0 0 0 0 0 0 174 0 0 0 0 0 0 0 0 175 0 0 0 0 0 0 0 0 176 0 0 0 0 0 0 0 0 177 0 0 0 0 0 0 0 0 178 0 0 0 0 0 0 0 0 179 0 0 0 0 0 0 0 0 180 0 0 0 0 0 0 0 0 181 0 0 0 0 0 0 0 0 182 0 0 0 0 0 0 0 0 183 0 0 0 0 0 0 0 0 184 0 0 0 0 0 0 0 0 185 0 0 0 0 0 0 0 0 186 0 0 0 0 0 0 0 0 187 0 0 0 0 0 0 0 0 188 0 0 0 0 0 0 0 0 189 0 0 0 0 0 0 0 0 190 0 0 0 0 0 0 0 0 191 0 0 0 0 0 0 0 0 192 0 0 0 0 0 0 0 0 193 0 0 0 0 0 0 0 0 194 0 0 0 0 0 0 0 0 195 0 0 0 0 0 0 0 0 196 0 0 0 0 0 0 0 0 197 0 0 0 0 0 0 0 0 198 0 0 0 0 0 0 0 0 199 0 0 0 0 0 0 0 0 200 0 0 0 0 0 0 0 0 201 0 0 0 0 0 0 0 0 202 0 0 0 0 0 0 0 0 203 0 0 0 0 0 0 0 0 204 0 0 0 0 0 0 0 0 205 0 0 0 0 0 0 0 0 206 0 0 0 0 0 0 0 0 207 0 0 0 0 0 0 0 0 208 0 0 0 0 0 0 0 0 209 0 0 0 0 0 0 0 0 210 0 0 0 0 0 0 0 0 211 0 0 0 0 0 0 0 0 212 0 0 0 0 0 0 0 0 213 0 0 0 0 0 0 0 0 214 0 0 0 0 0 0 0 0 215 0 0 0 0 0 0 0 0 216 0 0 0 0 0 0 0 0 217 0 0 0 0 0 0 0 0 218 0 0 0 0 0 0 0 0 219 0 0 0 0 0 0 0 0 220 0 0 0 0 0 0 0 0 221 0 0 0 0 0 0 0 0 222 0 0 0 0 0 0 0 0 223 0 0 0 0 0 0 0 0 224 0 0 0 0 0 0 0 0 225 0 0 0 0 0 0 0 0 226 0 0 0 0 0 0 0 0 227 0 0 0 0 0 0 0 0 228 0 0 0 0 0 0 0 0 229 0 0 0 0 0 0 0 0 230 0 0 0 0 0 0 0 0 231 0 0 0 0 0 0 0 0 232 0 0 0 0 0 0 0 0 233 0 0 0 0 0 0 0 0 234 0 0 0 0 0 0 0 0 235 0 0 0 0 0 0 0 0 236 0 0 0 0 0 0 0 0 237 0 0 0 0 0 0 0 0 238 0 0 0 0 0 0 0 0 239 0 0 0 0 0 0 0 0 240 0 0 0 0 0 0 0 0 241 0 0 0 0 0 0 0 0 242 0 0 0 0 0 0 0 0 243 0 0 0 0 0 0 0 0 244 0 0 0 0 0 0 0 0 245 0 0 0 0 0 0 0 0 246 0 0 0 0 0 0 0 0 247 0 0 0 0 0 0 0 0 248 0 0 0 0 0 0 0 0 249 0 0 0 0 0 0 0 0 250 0 0 0 0 0 0 0 0 251 0 0 0 0 0 0 0 0 252 0 0 0 0 0 0 0 0 253 0 0 0 0 0 0 0 0 254 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 256 0 0 0 0 0 0 0 0 257 0 0 0 0 0 0 0 0 258 0 0 0 0 0 0 0 0 259 0 0 0 0 0 0 0 0 260 0 0 0 0 0 0 0 0 261 0 0 0 0 0 0 0 0 262 0 0 0 0 0 0 0 0 263 0 0 0 0 0 0 0 0 264 0 0 0 0 0 0 0 0 265 0 0 0 0 0 0 0 0 266 0 0 0 0 0 0 0 0 267 0 0 0 0 0 0 0 0 268 0 0 0 0 0 0 0 0 269 0 0 0 0 0 0 0 0 270 0 0 0 0 0 0 0 0 271 0 0 0 0 0 0 0 0 272 0 0 0 0 0 0 0 0 273 0 0 0 0 0 0 0 0 274 0 0 0 0 0 0 0 0 275 0 0 0 0 0 0 0 0 276 0 0 0 0 0 0 0 0 277 0 0 0 0 0 0 0 0 278 0 0 0 0 0 0 0 0 279 0 0 0 0 0 0 0 0 280 0 0 0 0 0 0 0 0 281 0 0 0 0 0 0 0 0 282 0 0 0 0 0 0 0 0 283 0 0 0 0 0 0 0 0 284 0 0 0 0 0 0 0 0 285 0 0 0 0 0 0 0 0 286 0 0 0 0 0 0 0 0 287 0 0 0 0 0 0 0 0 288 0 0 0 0 0 0 0 0 289 0 0 0 0 0 0 0 0 290 0 0 0 0 0 0 0 0 291 0 0 0 0 0 0 0 0 292 0 0 0 0 0 0 0 0 293 0 0 0 0 0 0 0 0 294 0 0 0 0 0 0 0 0 295 0 0 0 0 0 0 0 0 296 0 0 0 0 0 0 0 0 297 0 0 0 0 0 0 0 0 298 0 0 0 0 0 0 0 0 299 0 0 0 0 0 0 0 0 300 0 0 0 0 0 0 0 0 301 0 0 0 0 0 0 0 0 302 0 0 0 0 0 0 0 0 303 0 0 0 0 0 0 0 0 304 0 0 0 0 0 0 0 0 305 0 0 0 0 0 0 0 0 306 0 0 0 0 0 0 0 0 307 0 0 0 0 0 0 0 0 308 0 0 0 0 0 0 0 0 309 0 0 0 0 0 0 0 0 310 0 0 0 0 0 0 0 0 311 0 0 0 0 0 0 0 0 312 0 0 0 0 0 0 0 0 313 0 0 0 0 0 0 0 0 314 0 0 0 0 0 0 0 0 315 0 0 0 0 0 0 0 0 316 0 0 0 0 0 0 0 0 317 0 0 0 0 0 0 0 0 318 0 0 0 0 0 0 0 0 319 0 0 0 0 0 0 0 0 320 0 0 0 0 0 0 0 0 321 0 0 0 0 0 0 0 0 322 0 0 0 0 0 0 0 0 323 0 0 0 0 0 0 0 0 324 0 0 0 0 0 0 0 0 325 0 0 0 0 0 0 0 0 326 0 0 0 0 0 0 0 0 327 0 0 0 0 0 0 0 0 328 0 0 0 0 0 0 0 0 329 0 0 0 0 0 0 0 0 330 0 0 0 0 0 0 0 0 331 0 0 0 0 0 0 0 0 332 0 0 0 0 0 0 0 0 333 0 0 0 0 0 0 0 0 334 0 0 0 0 0 0 0 0 335 0 0 0 0 0 0 0 0 336 0 0 0 0 0 0 0 0 337 0 0 0 0 0 0 0 0 338 0 0 0 0 0 0 0 0 339 0 0 0 0 0 0 0 0 340 0 0 0 0 0 0 0 0 341 0 0 0 0 0 0 0 0 342 0 0 0 0 0 0 0 0 343 0 0 0 0 0 0 0 0 344 0 0 0 0 0 0 0 0 345 0 0 0 0 0 0 0 0 346 0 0 0 0 0 0 0 0 347 0 0 0 0 0 0 0 0 348 0 0 0 0 0 0 0 0 349 0 0 0 0 0 0 0 0 350 0 0 0 0 0 0 0 0 351 0 0 0 0 0 0 0 0 352 0 0 0 0 0 0 0 0 353 0 0 0 0 0 0 0 0 354 0 0 0 0 0 0 0 0 355 0 0 0 0 0 0 0 0 356 0 0 0 0 0 0 0 0 357 0 0 0 0 0 0 0 0 358 0 0 0 0 0 0 0 0 359 0 0 0 0 0 0 0 0 360 0 0 0 0 0 0 0 0 361 0 0 0 0 0 0 0 0 362 0 0 0 0 0 0 0 0 363 0 0 0 0 0 0 0 0 364 0 0 0 0 0 0 0 0 365 0 0 0 0 0 0 0 0 366 0 0 0 0 0 0 0 0 0 367 0 0 0 0 0 0 0 0 0 368 0 0 0 0 0 0 0 0 0 369 0 0 0 0 0 0 0 0 0 370 0 0 0 0 0 0 0 0 0 371 0 0 0 0 0 0 0 0 0 372 0 0 0 0 0 0 0 0 0 373 0 0 0 0 0 0 0 0 0 374 0 0 0 0 0 0 0 0 0 375 0 0 0 0 0 0 0 0 0 376 0 0 0 0 0 0 0 0 0 377 0 0 0 0 0 0 0 0 0 378 0 0 0 0 0 0 0 0 0 379 0 0 0 0 0 0 0 0 0 380 0 0 0 0 0 0 0 0 0 381 0 0 0 0 0 0 0 0 0 382 0 0 0 0 0 0 0 0 0 383 0 0 0 0 0 0 0 0 0 384 0 0 0 0 0 0 0 0 0 385 0 0 0 0 --- Notes See KM SET TRANSLATE for special values that can be returned ## &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 ## &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 cannot be returned ## &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 ## &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 signed, HL and flags are corrupt and all others are preserved Notes See KM SET TRANSLATE for special values that can be set. ## &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 ## &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 ## &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/50th seconds, and a value of 0 counts as 256 ## &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 ## &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 ## &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 ## &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 ## &BB4E TXT INITIALISE Initialise the text VDU to its settings when the computer is switched on, includes resetting all the text Action VDU indications, 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 ## &BB51 TXT RESET Action Resets the text VDU indications and the control code table Entry No entry conditions Exit AF, BC, DE and HL are corrupt, and all the other registers are preserved ## &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 ## &BB57 TXT VDU DISABLE Action Prevents characters from being printed to the current stream Entry No entry conditions Exit AF is corrupt, and all the other registers are preserved ## &BB5A TXT OUTPUT Action Output a character or control code (800 to &1F) to the screen Entry A contains the character to output Exit All registers are preserved Any control codes are obeyed and nothing is printed if the VDU is disabled; characters are printed using Notes the TXT OUT ACTION routine; if using graphics printing mode, then control codes are printed and not obeyed ## &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 ## &BB60 TXT RD CHAR Action Read a character from the screen at the current cursor position Entry No entry conditions If it was successful then A contains the character that was read from the screen and Carry is true; Exit 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 ## &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 --- ## &BB66 TXT WIN ENABLE Action Sets the boundaries of the current text window - uses physical coordinatesH holds 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 edgeExit AF, BC, DE and HL are corruptNotes The window is not cleared but the cursor is moved to the top left corner of the window ## &BB69 TXT GET WINDOW Action Returns the size of the current window - returns physical coordinates Entry No entry conditions Entry No entry conditionsH 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 ## &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 all others are preserved ## &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 ## &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 ## &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 ## &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 ## &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 ## &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 ## &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 ## &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 reserved ## &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 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 Exit &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 ## &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 &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 &BB90 TXT SET PEN Action Sets the foreground PEN for the current stream Entry A contains the PEN number to use Exit AF and HL are corrupt, and all other registers are preserved ## &BB90 TXT SET PEN Action Sets the foreground PEN for the current stream Entry A contains the PEN number to use Exit AF and Hl are corrupt, and all other registers are preserved &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 &BB96 TXT SET PAPER ## &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, ## &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 ## &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 ## &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 ## &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 ## &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 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. ## &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 ## &BBA8 TXT SET MATRIX 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 ## &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 ## &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 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 ## &BBB4 TXT STR SELECT --- Action Selects a new VDU text streamEntry A contains the value of the stream to change toExit A contains the previously selected stream, HL and the flags are corrupt, and all others are preserved ## &BBB7 TXT SWAP STREAMS Action Swaps the states of two stream attribute tablesEntry B contains a stream number, and C contains the other stream numberExit AF, BC, DE and HL are corrupt, and all other registers are preservedNotes 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 Amstrad CPC Firmware Guide --- ## The Graphics VDU ## &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 Sets the graphics indirections to their defaults, sets the graphic paper to text pen O and the graphic pen Notes 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 ## &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 ## &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 reserved ## &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. ## &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 are preserved ## &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 prevented ## &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 ## &BBCF GRA WIN WIDTH Action Sets the left and right edges of the graphics window Entry 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 ## &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 # &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 # &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 # &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 # &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 # &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 # &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 # &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 # &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 --- 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 ## &BBF3 GRA TEST RELATIVE Action Moves to a position relative to the current position, and tests the point there using the GRA TEST indirection Exit A contains the pen at the point, and BC, DE, HL and flag are corrupt, and all others are preserved ## &BBF6 GRA LINE 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) ## &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 Notes See GRA LINE ABSOLUTE above for details of how the line is plotted ## &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 As in BASIC, all characters including control codes are printed; the character is printed with its top left Notes corner 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 Amstrad CPC Firmware Guide --- ## The Screen Pack ## &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 ## &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 ## &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 all 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) ## &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) ## &BCOB 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 ## &BCOE 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 ## &BC11 SCR GET MODE Action Gets the current screen mode Entry No entry conditions 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 ## &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 ## &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 ## &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 corner 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 ## &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 ## &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 ## &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 &BC26 SCR NEXT LINE Action Calculates the screen address of the byte below the specified screen address Entry 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 ## &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 ## &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 ## &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 ## &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 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 ## &BC35 SCR GET INK Action Gets the colours of a PEN Entry A contains the PEN number B contains the first colour, C holds the second colour, and AF, DE and HL are corrupt, and all others are preserved ## &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. ## &BC38 SCR GET BORDER Action Gets the colours of the border Entry No entry conditions B contains the first colour, C holds the second colour, and AF, DE and HL are corrput, and all others are preserved ## &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/50ths of a second, and a value of 0 is taken to mean \(256*1 / 50\) seconds - the default value is \(10*1 / 50\) seconds ## &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 ## &BC44 SCR FILL BOX Action Fills an area of the screen with an ink - this only works for 'character-sized' blocks of screen A contains the mask for the ink that is to be used, H contains the left hand column of the area to fill, D Entry 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 ## &BC17 SCR FLOOD BOX Action Fills an area of the screen with an ink - this only works for byte- sized' blocks of screen C contains the encoded PEN that is to be used, HL contains the screen address of the top left hand Entry 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 ## &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 all the other registers are preserved ## &BC4D SCR HWL 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 ## &BC50 SCR SW ROLL Action Scrolls part of the screen up or down by eight pixel lines - only for 'character- sized' blocks of the screen B holds the direction to roll the screen, A holds the encoded PAPER which the new line will appear in, H Entry holds the left column of the area to scroll, D holds the right column, 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 roundrates ## &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 1, 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 reserved ## &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 and HL are corrupt, and all the others are preserved ## &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, and all other registers are prepared 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 similar situation occurs with the AND and OR modes ## &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, and all others are preserved ## &BC5F SCR HORIZONTAL Action Draws a horizontal 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 corrupt, and all other registers are served Notes The start X- coordinate must be less than the end X- coordinate --- ## &BC62 SCR VERTICAL Action Draws a vertical line on the screen using the current graphics write mode 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 Amstrad CPC Firmware Guide --- ## 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 jumplocks are automatically installed by the Operating System on switch on. ## &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 ## &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 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 Notes 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 respectively ## &BC68 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 ## &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, the flags are corrupt, and all others are preserved ## &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 the motor's previous state, the other flags are corrupt, all others are preserved ## &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 ## &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 If the file was opened successfully, then Carry is true, Zero is false, HL holds the address of a buffer containing 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 number (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 ## &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 ## &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 ## &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 ## &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 ## &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 ## &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 ## &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 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 number (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 ## &BC8F \\*CAS OUT CLOSE Action Closes an output file Entry No entry conditions 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 ## &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 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. \(\) 3\(because each 16K section of the file requires a separate directory entry ## &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 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 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 ## &BC98 \\*CAS OUT DIRECT Action Writes an entire file directly to tape 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- e- e- e- e- e- e- e- e- e- e e- e- e- e- e- e- e- e- e- e If the operation was successful, then Carry is true, Zero is false, and A is corrupt; if the file was nte 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 ## &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 the above applies, except that a sorted list of files is displayed; system files are not listed by this routine ## &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 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 also turns off interrupts whilst writing data ## &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 i &16; this routine starts and stops the cassette motor and turns off interrupts whilst reading data ## &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 iti &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 ## AMSDOS and BIOS Firmware ## &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 ## &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 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 10es units; the default is &AF; 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 &039 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 To select one of the normal disc formats, the following values should be put into the A register Data format - &C1 Notes 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 ## &03C 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 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 ## &03F 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 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 ether case, the other flags are corrupt, and all other registers are preserved Exit 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 ## &042 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 if the formatting process was successful, then Carry is true, A holds 0, and HL is preserved; if the Exit formatting process failed, then Carry is false, A holds an error number, and HL is corrupt; in other case, the other flags are corrupt, and all the other registers are preserved The header information block is laid out as follows byte 0 - holds the track number byte 1 - holds the head number (set to zero) Notes 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) ## &045 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 th 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 ## &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) 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 The status byte indicates the drive's status as follows Notes 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 ## &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 ## &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 unformatted 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 parameters do not need to be set to the format of the disc; this routine is best used with the disc error messages turned off --- ## The Sound Manager ## &BCA7 SOUND RESET Action Resets the sound manager by clearing the sound queues and abandoning any current soundsEntry No entry conditionsExit AF, BC, DE and HL are corrupt, and all others are preserved ## &BCAA SOUND QUEUE Action Adds a sound to the sound queue of a channelEntry HL contains the address of a series of bytes which define the sound and are stored in the central 32K of RAMIf the sound was successfully added to the queue, then Carry is true and HL is corrupt; if one of the Exit 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 preservedThe bytes required to define the sound are as followsbyte 0 - channel status bytebyte 1 - volume envelope to usebyte 2 - tone envelope to useNotes bytes 3&4 - tone periodbyte 5 - noise periodbyte 6 - start volumebytes 7&8 - duration of the sound, or envelope repeat count ## &BCAD SOUND CHECK Action Gets the status of a sound channelEntry A contains the channel to test - for channel A, bit 0 set; for channel B, bit 1 set; for channel C, bit 2 setExit A contains the channel status, BC, DE, HL and flags are corrupt, and all others are preservedThe channel status returned is bit significant, as followsbits 0 to 2 - the number of free spaces in the sound queuebit 3 - trying to rendezvous with channel ANotes bit 4 - trying to rendezvous with channel Bbit 5 - trying to rendezvous with channel Cbit 6 - holding the channelbit 7 - producing a sound ## &BCBO SOUND ARM EVENT Action Sets up an event which will be activated when a space occurs in a sound queueEntry 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 blockExit AF, BC, DE and HL are corrupt, and all other registers are preservedNotes The event block must be initialised by KL INIT EVENT and is disarmed when the event itself is run Action Allows the playing of sounds on specific channels that had been stopped by SOUND HOLDEntry 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 ## &BCB6 SOUND HOLD Action Immediately stops all sound output (on all channels)Entry No entry conditionsExit 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 preservedNotes When the sounds are restarted, they will begin from exactly the same place that they were stopped ## &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 ## &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 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 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 Notes 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 ## &BCBF SOUND TONE ENVELOPE Action Sets up a tone envelope Entry A holds an envelope number (from 1 to 15), HL holds If it was set up properly, Carry is true, HL holds the data block addresses + 16, A and BC are corrupt; if the envelope number is invalid, then Carry All the rules of envelopes in BASIC also apply; the block of the data for ## &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) 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 ## &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)
ExitIf 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 Machine Pack ## &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 All events, sounds and interrupts are turned off, the firmware 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: Notes if the program was loaded successfully, then Carry is true, and HL contains the program 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 ## &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 program and so the routine is not returned from ## &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 ## &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 ## &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 As with MC SET MODE, this routine changes the hardware setting without telling the routines that write Notes to the screen; therefore these routines may cause unpredictable effects if called; the default screen base is &CO ## &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 The ink vector takes the following form: Notes 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 ## &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 The ink vector takes the following form: Notes 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 ## &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 ## &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 characters 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 ## &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 ## &BD31 MC SEND PRINTER Action Sends a character to the printer, which must not be busy Entry A contains tile character to be printed - only characters up to ASCII 127 can be printed Exit Carry is true, A and the other flags are corrupt, and all other registers are preserved ## &BD34 MC SOUND REGISTER Action Sends data to a sound chip register Entry A contains the register number, and C contains the data to be sent Exit AF and BC are corrupt, and all other registers are preserved ## &BD37 JUMP RESTORE Action Restores the jumplock 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 jumplock, but restores all entries in the main jumplock --- ## 664 and 6128 only ## &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 ## &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 ## &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 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 Notes 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 ## &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 ## &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 ## &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 ## &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 ## &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 ## &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 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 ## &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 ## &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, 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 ## &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 ## &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 ## &BDD0 TXT UNDRAW CURSOR Action Removes the cursor from the screen, if the cursor is enabled Entry No entry conditions Exit AF is corrupt, ## &BDD3 TXT WRITE CHAR Action Writes a character onto the screen Entry A holds the character to be written, 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 ## &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 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 ## &BDD9 TXT OUT ACTION Action Writes a character to the screen or obeys a control code (800 to &1F) Entry A contains the character or code Exit AF, BC, DE and HL are corrupt, and all other registers are preserved 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 write 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 ## &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 ## &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 ## &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 ## &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 ## &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 ## &BDE8 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 ## &BDE8 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 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 Notes ESC, Shift and Control are pressed at the same time, then it initiates a system reset; otherwise it reports a break event ## &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 ## &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 # &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 # &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 # &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 &FFFFFFF and is stored with the least significant byte first, and with the most significant byte last # &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 # &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 # &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 9 of B has the sign of the binary value (it is negative if bit 7 is set), AF, B and IX is 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 # &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 8 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 INT removes any decimal part of the value, rounding down if the number is positive, but rounding up if it is negative &BD76 INTERNAL SUBROUTINE - not useful (&BD52 for the 464) &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 &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 &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 Exit HL points to the result in place of the first real value, AF, BC, DE, IX and IY are corrupt &BD85 REAL MULTIPLICATION (&BD61 for the 464) Action Multiplies two real values together, and leaves the result in lieu of the first number Exit HL points to the result in place of the first real value, AF,BC,DE,IX and IY are corrupt &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. Exit HL points to the result in place of the first real value, AF, Bc, DE, IX and IY are corrupt &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 val Exit A holds the result of the comparison process, IX, IY, and the other flags are corrupt, and all others are preserved 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 &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 &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 jags 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 ## &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 ## &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 ## &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 ## &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 jirst 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 ## &BDA3 REAL LOG (&BD7F for the 464) Action Returns the naporian 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 logarithm that has been calculated, AF, BC, DE, LY and IY are corrupt ## &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 logarithm that has been calculated, AF, BC, DE IX and IY are corrupt ## &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 ## &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 ## &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 # &BDB2 REAL TANGENT (&BD8E for the 464) Action Returns the tangent of a real value, leaving the result in lieu of the real value <|det|>【 --- Exit HL points to the tangent value that has been cal- culated, AF, BC, DE, IX and IY are corrupt # &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 inaccurate &BDB8 INTERNAL SUBROUTINE - not useful (&BD94 for the 464) &BDB8 INTERNAL SUBROUTINE - not useful (&BD97 for the 464) &BDBE INTERNAL SUBROUTINE - not useful (&BD9A for the 464) ## Maths Subroutines for the 464 only # &BD5B REAL SUBTRACTION Action Subtracts the second real value from the first 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 # &BD67 REAL EXPONENT ADDITION Action Adds the value of the A register to the exponent byte of a real number Entry HL points to the real value, and A holds the value to be added Exit HL points to the result in place of the first real value, AF and IX are corrupt, and all others are preserved # &BD9D INTERNAL SUBROUTINE - not useful &BDA0 INTERNAL SUBROUTINE - not useful &BDA3 INTERNAL SUBROUTINE - not useful &BDA6 INTERNAL SUBROUTINE - not useful &BDA9 INTERNAL SUBROUTINE - not useful # &BDAC INTEGER ADDITION Action Adds two signed integer values Entry HL holds the first integer value, and DE holds the second integer value Exit HL holds the result of the addition, A holds &FF if there is an overflow but is preserved otherwise, the flags Z are corrupt, and all other registers are preserved # &BDAF INTEGER SUBTRACTION Action Subtracts the second signed integer value from the first signed integer value Entry HL holds the first integer value, and DE holds the second integer value Exit HL holds the result of the subtraction, A holds &FF if there is an overflow but is preserved otherwise, the flags are corrupt, and all the other registers are preserved # &BDB2 INTEGER REVERSE SUBTRACTION Action Subtracts the first signed integer value from the second signed integer value Entry HL holds the first integer value, and DE holds the second integer value Exi HL holds the result of the subtraction, AF and DE are corrupt, and all others are preserved # &BDB5 INTEGER MULTIPLICATION Action Multiplies two signed integer values together, and leaves the result in lieu of the first number Entry HL holds the first integer value, and DE holds the second integer value Entry HL holds the result of the multiplication, A holds &FF if there is an overflow but is corrupted otherwise, --- the flags, BC and DE are corrupt, and the other registers are preserved Notes Multiplication of signed integers does not produce the same result as with unsigned integers ## &BDB8 INTEGER DIVISION Action Divides the first signed integer value by the second signed integer value Entry HL holds the first integer value, and DE holds the second integer value Exit HL holds the result of the division, DE holds the remainder, AF and BC are corrupt, and all others are preserved Notes Division of signed integers does not produce the same result as with unsigned integers Action Divides the first signed integer value by the second signed integer value # Entry HL holds the first integer value, and DE holds the second integer value Entry HL holds the first integer value, and DE holds the second integer valueDE holds the result of the division, HL holds the remainder, AF and BC are corrupt, and all others are preserved Notes Division of signed integers does not produce the same result as with unsigned integers # &BDC8 INTERNAL SUBROUTINE - not useful &BDC1 INTERNAL SUBROUTINE - not useful &BDC4 INTEGER COMPARISON Action Compares two signed integer values Entry HL holds the first integer value, and DE holds the second integer value Exit A holds the result of the comparison process, the flags are corrupt, and all others are preserved 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 Notes 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 With signed integers, the range of values runs from &8000 (- 32768) via zero to &7FFF (+32767) and so any value which is greater than &8000 is considered as being less than a value of &7FFF or less ## &BDC7 INTEGER UNARY MINUS Action Reverses the sign of an integer value (by subtracting it from &10000) Entry HL holds the integer value Exit HL holds the new value of the integer number, AF is corrupt, cmd all other registers are preserved ## &BDCA INTEGER SIGNUM/SGN Action Tests a signed integer value Entry HL holds the integer value Exit A holds the result of this comparison process, the flags are corrupt, and all others are preserved After this routine has been called, the value in A depends on the result of this comparison as follows if the integer number is greater than 0 and is less than &8000, then A holds &01 Notes if the integer number is the same as 0, then A holds &00 if the integer number is greater than &7FFF and less than or equal to &FFFF, then A holds &FF See INTEGER COMPARISON for more details on the way that signed integers are laid out ## 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 (hmmm ... not really a maths routine ...) 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) --- ## The Z80 Instruction Set The Z80 Instruction SetThe lists contains all the normal machine code instructions for the microprocessor, plus a number of undocumented ones. The latter comprise those which operate on the high or low bytes of the Index registers (IX and IY) which are notated here as HIX, LIX, HIY and LIY - some assemblers may use the form IXH, etc - and a set of rotation instructions complementary to SRL, which are designated SLL. ## The Opcodes and T states Within the tables of instructions, a number of abbreviations are used:
ddisplacement (a value from -128 (&amp;80) to +127 (&amp;7F))
na single byte value (from 0 (&amp;00) to 255 (&amp;FF))
hiloa double byte value (from -32768 (&amp;8000) via 0 to 32767 (&amp;7FFF))
addran address value (from 0 (&amp;0000) to 65535 (&amp;FFFF))
(in the sequence of opcode bytes, 'addr' and 'hilo' are entered low byte first) The next two columns detail the number of bytes applicable to each instruction, and the number of T states (clock pulses) that each requires - some have two figures which are distinguished as follows: f means 'the number of T states required when the condition is false' t means 'the number of T states needed when the condition is true' = means 'the number of T states needed when either BC=0 and/or A matches the contents of HL' # means 'the number of T states required when both the above conditions are false' z means 'the number of T states needed when B=0' nz means 'the number of T states required when B<>0' ## The Flag Register The flag registerThe last columns give the effect on the flag bits which each instruction causes: ? means the setting of the bit is unpredictable means the setting of the bit is unchanged 0 means that the flag bit is reset to zero 1 means that the flag bit is set to one. In addition, the Sign flag (bit 7) is also set: 7 if bit 7 of the A register is set 15 if bit 15 of the HL register pair (ie bit 7 of the H register) is set \(= 7\) if bit 7 of the A register would be set by subtraction in lieu of CP The Zero flag (bi6 6) is also set: z if the A register or the HL register pair equals zero \(=\) if the A register matches the compared register or value \(= A\) if the A register matches the contents of the address pointed to by HL --- <>B if the B register holds zero <>b if the bit tested is zero ## The Parity/Overflow flag (bit 2) is also set: p if the register concerned contains an even number of set bits v if an overflow has occured in Two's Complement arithmetic BC if BC is not zero A80 if the A register was &80 before this instruction was performed i to the contents of the microprocessor's internal interrupt register ## The Carry flag (bit 0) is also set: c if an addition resulted in a carry out of bit 7 (for a register) or bit 15 (for a register pair) b if a subtraction required a borrow from bit 7 (for a register) or bit 15 (for a register pair) < if the A register is less than the value or register that is being compared r0 by the bit rotated in from bit 0 of the register concerned r7 by the bit rotated in from bit 7 of the register concerned x if the Carry was reset (ie zero) before this instruction was performed A0 if the A register was &00 before this instruction was performed The flag register is bit significant, and the bits are defined as follows: 7 - Sign 6 - Zero 5 - unused 4 - Half Carry (cannot test) 3 - unused 2 - Parity/Overflow 1 - Add/Subtract (cannot test) 0 - Carry </table> ---
InstructionOpcodeBTsSZPC
BIT 0,(HL)CB 46212?&lt;b?-
BIT 0,(IX+d)CB DD 46 d420?&lt;b?-
BIT 0,(IY+d)CB FD 46 d420?&lt;b?-
BIT 0,ACB 4728?&lt;b?-
BIT 0,BCB 4028?&lt;b?<fcel--
BIT 0,CCB 4128?&lt;b?
-
-
BIT 0,DCB 4228?&lt;b? --
BIT 0,ECB 4328?&lt;b?
-
-
BIT 0,HCB 4428?&lt;b? <fcel--
<< tr>< tr></tr><><
-<br/>-<br/>-<-<++&lt+&lt-
InstructionOpcodeBTsSZPC
BIT 0,LCB 4528?<b>?-
BIT 1,(HL)CB 4E212?<b>?-
BIT 1,(IX+d)CB DD 4E d420?<b>?-
BIT 1,(IY+d)CB FD 4E d420?<b><b>?-
BIT 1,ACB 1F28?<b>?
BIT 1,BCB 4828?<b>?<b>?
BIT 1,CCB 4928?<b>?
-
BIT 1,DCB 4A28?<b>?>
BIT 1,ECB 4B28?<b>??
BIT 1,HCB 4C28?<b>??-
BIT 1,LCB 4D28?<b>?+
BIT 2,(HL)CB 56212?<b>?<b>?-
BIT 2,(IY+d)CB FD 56 d420?<b>?
BIT 2,(LY+d)CB DD 56 d420?<b>?--
BIT 2,ACB 5728?<b>?.
BIT 2,BCB 5028?<b>?.-
BIT 2,CCB 5128?<b>?*
BIT 2,DCB 5228?<b>?**
BIT 2,ECB 5328?<b>?***
BIT 2,HCB 5428?<b>?****
BIT 2,LCB 5528?<b>?††††††††††††††††††††
BIT 3,(HL)CB 5E212?<b>?
BIT 3,(IX+d)CB DD 5E d420?<b>?-
BIT 3,(IY+d)CB FD 5E d420?<b>--
BIT 3,ACB 5F28?<b>?
BIT 3,BCB 5828?<b>?
BIT 3,CCB 5928?<b>?
BIT 3,DCB 5A28?<b>?BIT 3,ECB 5B28?<b>?
BIT 3,HCB 5C28?<b>?
BIT 3,LCB 5D28?<b>?
BIT 4,(HL)CB 66212?<b>?††††††
BIT 4,(IY+d)CB FD 66 d420?<b>?
BIT 4,(LY+d)CB DD 66 d420?<b>?-
BIT 4,ACB 6728?<b>?
BIT 4,BCB 6028?<b>?
BIT 4,CCB 6128?<b>?
BIT 4,DCB 6228?<b>?
--- <<<</tr>
InstructionOpcodeBTsSZPC
BIT 4,ECB 6328?<b>?-
BIT 4,HCB 6428?<b>?
BIT 4,LCB 6528?<b>?
BIT 5,(HL)CB 6E212?<b>?-
BIT 5,(IX+d)CB DD 6E d420?<b>?-
BIT 5,(IY+d)CB FD 6E d420?<b><?-
BIT 5,ACB 6F28?<b>?<b>?
BIT 5,BCB 6828?<b>?>
BIT 5,CCB 6928?<b>?=
BIT 5,DCB 6A28?<b>?.
BIT 5,ECB 6B28?<b>?+
BIT 5,HCB 6C28?<b>?,
BIT 5,LCB 6D28?<b>?..
BIT 6,(HL)CB 76212?<b>?.
BIT 6,(IX+d)CB DD 76 d420?<b>?
BIT 6,(IY+d)CB FD 76 d420?<b>-
BIT 6,ACB 7728?<b>?*
BIT 6,BCB 7028?<b>?**
BIT 6,CCB 7128?<b>?***
BIT 6,DCB 7228?<b>?****
BIT 6,ECB 7328?<b>?<b>
BIT 6,HCB 7428?<b>?`
BIT 6,LCB 7528?<b>?~
BIT 7,(HL)CB 7E212?<b>?
BIT 7,(IX+d)CB DD 7E d420?<b>?
BIT 7,(IY+d)CB FD 7E d420?<b></b>
BIT 7,ACB 7F28?<b>?
BIT 7,BCB 7828?<b>?^
BIT 7,CCB 7928?<b>?_
BIT 7,DCB 7A28?<b>?
BIT 7,ECB 7B28?<b>?
BIT 7,HCB 7C28?<b>?
BIT 7,LCB 7D28?<b>?
--- ></td>
InstructionOpcodeBTsSZPC
CALL p,addrF4 dr ad3t17f10----
CALL po,addrE4 dr ad3t17f10--
CALL pe,addrEC dr ad3t17f10---
CALL z,addrCC dr ad3t17f10--x
CCF3F14---x
CP (HL)BE17=7=v<
CP (IX+d)DD BE d319=7=v<
CP(IY+d)FD BE d319=7=v
CPABF14=7=v<
CPBB814=7=v<>
CPCB914=7=v&lt ;
CPDBA14=7=v&lt >
CPEBB14=7=v&lt
CPHBC14=7=v&lt
CP HIXDD BC28=7=v<
CP HIYFD BC28=7=v
CPLBD14=7=vc
CP LIXDD BD28=7=v
CP LIYFD BD28=7=v&lt ;
CP nFE n27=7=v
CPDED A9216?= ABC-
CPDRED B92=16#21?= ABC-
CPIED A1216?= ABC-
CPIRED B22=16#21?= ABC-
CPL2F14----
DAA27147zpc
DEC (HL)351117zv-
DEC (IX+d)DD 35 d3237zv-
DEC (IY+d)FD 35 d3237zv
DEC A3D147zv-
DEC B05147zv-
DEC BC0B16----
DEC C0D147zv-
DEC D15147zv-
DEC DE1B16----
DEC E1D147zv->
DEC H25147zv-
DEC HIXDD 25287zv-
--- ---+</td>< tr>--</table> ---
InstructionOpcodeBTsSZPC
DEC HIYFD 25287zv-
DEC HL2B16----
DEC IXDD 2B210----
DEC IYFD 2B210---
DEC L2D147zv-
DEC LIXDD 2D287zv-
DEC LIYFD 2D287zv
DEC SP3B16----
DIF314----
DJNZ d10 d2t13f8----
EIFB14----
EX (SP),HLE3119----
EX(SP),IXDD E3223----
EX SP),IYFD E3223---
EX AF,AF'0814s'z'p'c'
EX DE,HLEB14----
EXXD914----
HALT761min 4----
IM 0ED 4628----
IM 1ED 5628----
IM 2ED 5E28----
IN A,(C)ED 782127zp0
IN A,(n)DB n211----
IN B,(C)ED 402127zp0
IN C,(C)ED 482127zp0
IN D,(C)ED 502127zp0
IN E,(C)ED 582127zp0
IN H,(C)ED 602127zp0
IN L,(C)ED 682127zp0INC (HL)341117zv-
INC (IX+d)DD 34 d3237zv-
INC (IY+d)FD 34 d3237zv
INC A3C147zv-
INC B04147zv-
INC BC0316----
INC C0C147zv-
INC D14147zv-
INC DE1316----
-
InstructionOpcodeBTsSZPC
INC E1C147zv-
INC H24147zv-
INC HIXDD 24287zv-
INC HIYFD 24287zv
INC HL2316----
INC IXDD 23210----
INC IYFD 23210---
INC L2C147zv-
INC LIXDD 2C287zv-
INC LIYFD 2C287zv
INC SP3316----
INDED AA216?<>B?-
INDRED BA2z16nz21?1?-
INIED A2216?<>B?
INIRED B22z16nz21?1?-
JP (HL)E914----
JP (IX)DD E928----
JP (IY)FD E928---
JP addrC3 dr ad310----
JP c,addrDA dr ad310---
JP m,addrFA dr ad310---(
JP nc,addrD2 dr ad310---(-
JP nz,addrC2 dr ad310---
JP p,addrF2 dr ad310---
JP po,addrE2 dr ad310---
JP pe,addrEA dr ad310---
--- -++ - . LD (IY+d),Cld (IY+d),D LD (IY+d),H LD (IY+d),L
LD (IY+d),n>< hr>LD A,(IY+d)</table> ---
InstructionOpcodeBTsSZPC
LD (addr),IYFD 22 dr ad420----
LD (addr),SPED 73 dr ad420---
LD (BC),A0217----
LD (DE),A1217----
LD (HL),A7717----
LD (HL),A7717-----
LD (HL),B7017----
LD (HL),C7117----
LD (HL),D7217----
LD (HL),E7317----
LD (HL),H7417----
LD (HL),L7517----
LD (HL),n36 n210----
LD (IX+d),ADD 77 d319----
LD (IX+),BDD 70 d319-----
LD (IX+d),CDD 71 d319---- -
LD (IX+d),DDD 72 d319---- +
LD (IX+d),EDD 73 d319----
LD (IX+d),HDD 71 d319--
LD (IX+d),LDD 75 d319----
-
LD (IX+d),nDD 36 d n419----
-
-
LD (IY+d),AFD 77 d319---
LD (IY+d),BFD 70 d319---
FD 71 d319---
FD 72 d319---
LD (IY+d),EFD 73 d319---
FD 74 d319---
FD 75 d319---
FD 36 d n419----
LD A,(addr)3A dr ad313----
LD A,(BC)0A17----
LD A,(DE)1A17----
-
LD A,(HL)7E17----
LD A,(HL)7E17
LD A,(IX+d)DD 7E d319----
-
FD 7E d319----
LDA,A7F14----
LD A,B7814----
->-</td>trsutdrtpqrt</tr></tr></tr></tr></table> ---
InstructionOpcodeBTsSZPC
LD A,C7914----
LD A,D7A14----
LD A,E7B14----
LD A,H7C14----
LD A,HIXDD 7C28----
LD A,HIYFD 7C28---
LD A,IED 57297zi0
LD A,L7D14----
LD A,LIXDD 7D28----
LD A,LIYFD 7D28---
LDA,n3E n27----
LD A,RED 5F297zi0
LD B,(HL)4617----
LDB,(IX+d)DD 46 d319----
LD B,(IY+d)FD 46 d319---
LD B,A4714----
LD B,B4014----
LD B,C4114----
LD B,D4214----
LD B,E4314----
LD B,H4414----
LD B,HIXDD 4428----
LD B,HIYFD 4428---
LD B,L4514----
LD B,LIXDD 4528----
LD B,LIYFD 4528---
LD B,n06 n27----
-
LD BC,(addr)ED 4B dr ad420----
LD BC,hilo01 lo hi310----
LD C,(HL)4E17----
LD C,(IX+d)DD 4E d319----
-
LD C,(IY+d)DD 4E d319-
LD C,A4F14----
LD C,B4814----
LD C,C4911----
LD C,D4A11----
LD C,E4B14----
-
LD C,H4C14-----
->< tr></td>-tttrsudipLD E,LLD ELIY</tr></table> ---
InstructionOpcodeBTsSZPC
LD C,HIXDD 4C28----
LD C,HIYFD 4C28---
LD C,L4D14----
LD C,LIXDD 4D28----
LD C,LIYFD 4D28---
LDC,n0E n27----
LD D,(HL)5617----
LDD,(IX+d)DD 56 d319----
LDD,(IY+d)FD 56 d319---
LD D,A5714----
LD D,B5014----
LD D,C5114----
LD D,D5214----
LD D,E5314----LD D,H5414----
LD D,HIXDD 5428----
LD D,HIYFD 5428---
LD D,L5514----
LD D,LIXDD 5528----
LD D,LIYFD 5528---
LD D,n16 n27-----
LD DE,(addr)ED 5B dr ad420----
LD DE,hilo11 lo hi310----
LD E,(HL)5E17----
LD E,(IX+d)DD 5E d319-----
LD E,(IY+d)FD 5E d319----
LD E,A5F14----
LD E,B5814----
LD E,C5914----
LD E,D5A14----
LD E,E5B14----
LD E,H5C14----
LD E,HIXDD 5C28-----
LDE,HIYFD 5C28---
5D14-----
LD E,LIXDD 5D28---
FD 5D28----
LD E,n1E n27---
-</td>tr-trs</tr>
InstructionOpcodeBTsSZPC
LD H1(HL)6617----
LD H1(IX+d)DD 66 d319----
LD H1(IY+d)FD 66 d319---
LD H2A6714----
LD H2B6014----
LD H3C6114----
LD H4D6214----
LD H5E6314----
LD H6H6414----
LD H7L6514----
LD H8n26 n27----
LDIHX,ADD 6728----
LD HIX,BDD 6028----
LD HIX,CDD 6128----
LD HIX,DDD 6228----
LD HIX,EDD 6328----
LD HIX,HIXDD 6428----
LDHIX,LIXDD 6528----
LD HIX,nDD 26 n311----
LD HIY,AFD 6728---
LD HIY,BFD 6028---
LD HIY,CFD 6128---
LD HIY,DFD 6228---
--- -</td>t-t</tr></td></tr></table> ---
InstructionOpcodeBTsSZPC
LD L,A6F14----
LD L,B6814----
LD L,C6914----
LD L,D6A14----
LD L,E6B14----
LD L,H6C14----
LD L,L6D14----
LD L,n2E n27----
LD LIX,ADD 6F28----
LD LIX,BDD 6828----
LD LIX,CDD 6928----
LD LIX,DDD 6A28----
LD LX,EDD 6B28----
LD LIX,HIXDD 6C28----
LD LIX,LIXDD 6D28----
LD LIX,nDD 2E n311----
LD LIX, AFD 6F28---
LD LIX,BFD 6828---
LD LIX,CFD 6928---
LD LIX,DFD 6A28---
LDLIX,EFD 6B28---
DL LIX, HIXFD 6C28---
DD 6E28----
DD 6F28---
DD 6G28---
DD 6H28---
</td>< tr></table> ---
InstructionOpcodeBTsSZPC
OR (IY+d)FD B6 d3197zp0
ORAB7147zp0
OR BB0147zp0
OR CB1147zp0
ORDB2147zp0
OREB3147zp0OR HB4147zp0
-</td>>< -
- -+ < +<<trsuxzy<fcel></td><fcel><fcel></td><fcel>;</td><fcel>;</td><fcel>;</td><fcel<fcel>;</td><fcel>;</td></table> ---
InstructionOpcodeBTsSZPC
RES 0,(I×+d)DD CB d 86423----
RES 0,(IY+d)FD CB d 86423----
RES 0,ACB 8728----
RES 0,BCB 8028-----
RES 0,CCB 8128----
RES 0,DCB 8228----
RES 0,ECB 8328----
RES 0,HCB 8128---
RES 0,LCB 8528----
RES 1,(HL)CB 8E215----
RES 1,(I×+d)DD CB d 8E423-----
FD CB d 8E423----
RES 1,(IY+d)CB 8F28-----
RES 1,ACB 8F28--
RES 1,BCB 8828----
RES 1,CCB 8928----
RES 1,DCB 8A28----
RES 1,ECB 8B28----
RES 1,HCB 8C28----
RES 1,LCB 8D28----
RES 2,(HL)CB 96215----
RES 2,(I×+d)DD CB d 96423----
RES2,(IY+d)FD CB d 96423----
RES 2,ACB 9728----
RES 2,BCB 9028----
RES 2,CCB 9128----
RES 2,DCB 9228----
RES 2,ECB 9328----
RES 2,HCB 9428----
RES 2,LCB 9528----
RES 3,(HL)CB 9E215---->
RES 3,(I×+d)DD CB d 9E423---->
FD CB d 9E423---
RES 3,ACB 9F28---->
<fcel><fcel><fcel><ecel>
<fcel><fcel><fcel><fCEL>
<fcel><fcel><fcel><fcel><fcel><fcel<fcel>
<fcel>;<fcel>;<fcel>;<fcel>;
<fcel><fcel<fcel>;<fcel>;
<fcel><fcel<fcel>;
->trtt</tr></tr></tr>< tr></td>
-</table> ---
InstructionOpcodeBTsSZPC
RES 3,LCB 9D28----
RES 4,(HL)CB A6215----
RES 4, (IX+d)DD CB d A6423----
RES 4,IY+d)FD CB d A6423----
RES 4,ACB A728----
RES 4,BCB A028----
RES 4,CCB A128----
RES 4,DCB A228----
RES 4,ECB A328----
RES 4,HCB A428----
RES 4,LCB A528----
RES 5,(HL)CB AE215----
RES 5,(IX+d)DD CB d AE423----
RES 6,(HL)CB B6215----
RES 6,(IX+d)DD CB d B6423----
RES 7,(HL)CB BE215----
RES7,(IX+d)DD CB d BE423----
RES8,(HL)CB B728----
RES8,BCB B028-----
RES8,CCB B128----+
RES8,DCB B228----++
RES8,ECB B328----+-
RES8,HCB B428------
RES8,LCB B528-------
RES8,(HL)CB BE215-----
RES8,(IX+d)DD CB d BE423-----
RES8,(IY+d)FD CB d BE423---
RES8,ACB BF28----RES8,BCB B828----
RES8,CCB B928----
RES8,DCB BA28----
</table> ---
InstructionOpcodeBTsSZPC
RES 7,ECB BB28----
RES 7,HCB BC28----
RES 7,LCB BD28----
RETC9110----
RET CD81t11f8----
RET MF81t11f8----
RET NCD01t11f8---
RET NZC01t11f8---
RET PF01t11f8---
RET PEE81t11f8--- </tr>
RET POE01t11f8--- -
RET ZC81t11f8--- -
RETIED 4D214----
RETNED 45214----
RL (HL)CB 162157zpr7
RL (IX+d)DD CB d 164237zpr7
RL (IY+d)FD CB d 164237zpr7
RL ACB 17287zpr7
RL BCB 10287zpr7
RL CCB 11287zpr7 -
RL DCB 12287zpr7-
RL ECB 13287zpr7 +
RL HCB 14287zpr7 &
RL LCB 15287zpr7.
RLA1714---r7
RLC (HL)CB 062157zpr7.
RLC (IX+d)DD CB d 064237zpr7.
Rlc (IY+d)FD CB d 064237zpr7
RLC ACB 07287zpr7 .
RLC BCB 00287zpr7..
RLC CCB 01287zpr7 ..
RLC DCB 02287zpr7...
RLC ECB 03287zpr7 ...
RLC HCB 04287zpr7 r
RLC LCB 05287zpr7 t
RLCA0714---r7 .
RLDED 6F2187zp-
RR (HL)CB 1E2157zpr0
</td>-
InstructionOpcodeBTsSZPC
RR (IX+d)DD CB d 1E4237zpr0
RR (IY+d)FD CB d 1E4237zPr0
RR ACB 1F287zpr0
RR BCB 18287zpr0
r0
RR CCB 19287zpr0 r0
RR DCB 1A287zpr0 0
RR ECB 1B287zpr0r0
RR HCB 1C287zpr0.0
RR LCB 1D287zpr0 .0
RRA1F14---r0
RRC (HL)CB 0E2157zpr0 .0
RRC (IX+d)DD CB d 0E4237zpr1
RRC (IY+d)FD CB d 0E4237zPr1
RRC ACB 0F287zpr1 .0
RRC BCB 08287zpr1.0
RRC CCB 09287zpr1 0
RRC DCB 0A287zpr1 r0
RRC ECB 0B287zpr1r0
RRC HCB 0C287zpr1
RRC LCB 0D287zpr1,0
RRCA0F14---r1
RRDED 672187zp-
RST 0C7111----
RST 1,addrCF dr ad3(11)----
RST 2,addrD7 dr ad3(11)----
RST 3,addrDF dr ad3(11)--- -
RST 4E7111---- -
RST5,addrEF dr ad3(11)--- --
RST 6F7111---- -
RST 7FF111---- - -
SBC A,(HL)9E177zvb
SBC A,(IX+d)DD 9E d3197zvb
SBC A, (IY+d)FD 9E d3197zvb
SBC A,A9F147zvb
SBC A,B98147zvb
SBC A,C99147zvb
SBC A,D9A147zvb
SBC A,E9B147zvb
--- -</td>><trsuxz</tr></tr></tr></tr></tr></tr></tr></table> ---
InstructionOpcodeBTsSZPC
SBC A,H9C147zvb
SBC A,HIXDD 9C287zvb
SBC A,HIYFD 9C287zv
SBC A,L9D147zvb
SBC A,LIXDD 9D287zvb
SCC A,LIYFD 9D287zv
SBCH,LBCDE n277zvb
SBCH,LD,DEED 4221515zvb
SBCH,HL,LDED 5221515zvb
SBCH,HL,SPED 7221515zvb
SCF3714---1
SET 0,(HL)CB C6215----
SET 0,(IX+d)DD CB d C6423----
SET 0, (IY+d)FD CB d C6423----
SET 0,ACB C728----
SET 0,BCB C028----
SET 0,CCB C128----
SET 0,DCB C228----
SET 0,ECB C328----
SET 0,HCB C428----
SET 0,LCB C528----
SET 1,(HL)CB CE215----
SET1,(IX+d)DD CB d CE423----
SET1,(IY+d)FD CB d CE423---
SET 1,ACB CF28----
SET 1,BCB C828----
SET 1,CCB C928----
SET 1,DCB CA28----
SET 1,ECB CB28----
SET 1,HCB CC28----
SET 1,LCB CD28----
SET 2,(HL)CB D6215----
SET 2,(IX+d)DD CB d D6423----
SET 1,(IY+d)FD CB d D6423----
SET 2,ACB D728----
SET 3,BCB D028-----
SET 2,CCB D128----
->< tr></td>trsttruxyzp</table> ---
InstructionOpcodeBTsSZPC
SET 2,DCB D228----
SET 2,ECB D328----
SET 2,HCB D428----
SET 2,LCB D528----
SET 3,(HL)CB DE215----
SET 3,(IX+d)DD CB d DE423----
SET 3, (IY+d)FD CB d DE423---
SET 3,ACB DF28----
SET 3,BCB D828----
SET 3,CCB D928----SET 3,DCB DA28----
SET 3,ECB DB28----
SET 3,HCB DC28----
SET 3,LCB DD28----
SET 4,(HL)CB E6215----
SET 4,(IX+d)DD CB d E6423----
SET 5,(HL)CB EE215----
SET 5,DCB EA28----
SET 5,ECB EB28----
SET 5,HCB EC28----
SET 5,LCB ED28----
SET 6,(HL)CB F6215----
-
SET 6,(IX+d)DD CB d F6423----
-
SET 6,(IY+d)FD CB d F6423----
-
SET 6,ACB F728----
-++ - + t r s </table> ---
InstructionOpcodeBTsSZPC
SET 6,BCB F028----
SET 6,CCB F128----
SET 6,DCB F228----
SET 6,ECB F328----
SET 6,HCB F428----
SET 6,LCB F528----
SET 7,(HL)CB FE215----
SET 7,(IX+d)DD CB d FE423----
SET 7, (IY+d)FD CB d FE423---
SET 7,ACB FF28----
SET 7,BCB F828----
SET 7,CCB F928----
SET 7,DCB FA28----
SET 7,ECB FB28----
SET 7,HCB FC28----
SET 7,LCB FD28----
SLA (HL)CB 262157zpr7
SLA (IX+d)DD CB d 264237zpr7
SLA(IY+d)FD CB d 264237zpr7
SLA ACB 27287zpr7
SLA BCB 20287zpr7
SLA CCB 21287zpr7
r7
SLA DCB 22287zpr7r7
SLA ECB 23287zpr7t
SLA HCB 24287zpr7s
SLA LCB 25287zpr7u
SLL (HL)CB 362157zpr7v
SLL (IX+d)DD CB d 364237zpr7w
SLL (IY+d)FD CB d 364237zpr7x
SLL ACB 37287zpr7y
SLL BCB 30287zpr7z
SLL CCB 31287zpr7a
SLL DCB 32287zpr7b
SLL ECB 33287zpr7c
SLL HCB 34287zpr7d
SLL LCB 35287zpr7e
SRA (HL)CB 2E2157zpr0
SRA (IX+d)DD CB d 2E4237zpr0
</td>r0t0bt0
InstructionOpcodeBTsSZPC
SRA (IY+d)FD CB d 2E4237zpr0
SRA ACB 2F287zpr0
SRA BCB 28287zpr0
r0
SRA CCB 29287zpr0 r0
SRA DCB 2A287zpr0r0
SRA ECB 2B287zpr0 0
SRA HCB 2C287zpr0.0
SRA LCB 2D287zpr0 .0
SRL (HL)CB 3E2157zpr0 .0
SRL (IX+d)DD CB d 3E4237zpr1
SRL (IY+d)FD CB d 3E4237zPr0
SRL ACB 3F287zpr1 .0
SRL BCB 38287zpr1.0
SRL CCB 39287zpr1 0
SRL DCB 3A287zpr1
SRL ECB 3B287zpr1 r0
SRL HCB 3C287zpr1r0
SRL LCB 3D287zpr1
r0
SUB (HL)96177zvb
SUB (IX+d)DD 96 d3197zvb
SUB (IY+d)FD 96 d3197zv
SUB A97147zvb
SUB B90147zvb
SUB C91147zvb
SUB D92147zvb
SUB E93147zvb
SUB H94147zvb
SUB HIXDD AC287zvb
SUB HIYFD AC287zvb
b
SUB L95147zvb
SUB LIXDD AD287zvb
SUB LIYFD AD287zvb

b
SUB nD6 n277zvb
XOR (HL)AE177zp0
XOR (IX+d)DD AC d3197zp0
XOR (IY+d)FD AC d3197zpr0
XOR AAF147zpr0
XOR BA8147zpr0.0
--- </td>< tr></table> --- ## The CRTC Registers To change the value of these registers, the register number should be output on address &BCxx and then the data output on &BDxx
InstructionOpcodeBTsSZPC
XOR CA9147zp0
XOR DAA147zp0
XOR EAB147zp0
XOR HAC147zp0
XOR HIXDD AC287zp0
XOR HIYFD AD287zp0
Xor LAD147zp0XOR LIXDD AC287zP0
XOR LIYFD AD287zP0
XOR nEE n277zp0
RegFunctionDefault ValueRegFunctionDefault Value
R0Horizontal Total63R1Horizontal Displayed40
R2Horizontal Sync Pos.46R3Sync Width112
R4Vertical Total38R5Vertical Total Adjust0
R6Vertical Displayed25R7Vertical Sync Position30
R8Interface and Skew0R9Maximum Raster Addr7
R10Cursor Start Raster0R11Cursor End Raster0
R12Start Address (H)48R13Start Address (L)0
R14Cursor Register (H)192R15Cursor Register (L)07