CpcAlive is a
programming
environment
Amstrad CPC

compatible
for graphics
 animations
creation.







Cpc Online

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

Cpc basic error messages

The memory

The Cpc system vectors

Diskettes management

Z80 processor opcodes and
operation

CpcAlive installer for
Windows and DosBox

CpcAlive Documentation

SmallAsm is a Z80 assembler
for Dos



Last review:
V1.16 - 16/12/2014 - Z80 assembler correction
V1.15 - 30/11/2014 - corrections
V1.14 - 20/11/2014 - display ASM sources in Z80 debugger
V1.13 - 20/9/2014 - BASIC command TRON(BASIC debugger) improvement and corrections

The Cpc 6128 system memory map


Adresses Size Comments on the memory locations
&0000 &40 Restart block:
&0000 RST0: complete machine reset
&0008 RST 1: LOWJUMP: in-line two byte address:
b0 to b13=address; b14=Low ROM disabled; b15=Upper ROM disabled
&000B LOW PCHL: HL has address as RST 1
&000E 'JMP BC': BC has address to jump to
&0010 RST 2: SIDE CALL: inline two byte address: b0 to b13=address-&C000;
bl4 to b15=offset to required ROM (used between sequenced Foreground ROMs)
&0013 SIDE PCHL: HL has address as RST 2
&0016 'JMP DE': DE has address to jump to
&0018 RST 3: FAR CALL: inline three byte address
block: bytes 1 and 2 hold the address; byte 3 holds the ROM select address
&001B FAR PCHL: as RST 3, but HL has address;  C has ROM select
&001E 'JMP HL': HL has address to jump to
&0020 RST 4: RAM LAM: LD A,(HL) from RAM with  ROMs disabled
&0023 FAR CALL: as RST 3, but HL has address of  three byte address block
&0028 RST 5: FIRM JUMP: inline two byte address to jump to
&0030 RST 6: User restart; default to RST 0
&0038 RST 7: Interrupt entry (KB/Time etc)
&003B External interrupt (default to RET)

 
Adresses Size Comments on the memory locations
&0040 &130 ROM lower foreground area: BASIC input area (tokenised)
&016F end of BASIC input
&0170 BASIC working area for program, variables, etc...
&0170 Program area

   
Adresses Size Comments on the memory locations
&A6FC 4 AMSDOS chaining block:
&A6FC 2 address of next ROM block in chain (or &0000 if the last in chain)
&A6FE 1 ROM Select address
&A6FF 1 &00
&A700 &500 AMSDOS reserved area
This area is moved down if any ROMs have numbers greater than eight
&A700 1 Current drive number (0=A; 1=B)
&A701 1 Current USER number
&A702 1 flag?
&A703 2 address?
&A705 1 flag?
&A706 2 address?
&A708 1 OPENIN flag (&FF=closed; <>&FF=opened)
&A709 &20 Copy of current or last Disc Directory entry for OPENIN/LOAD:
&A709 1 USER number
&A70A 8 filename (padded with spaces)
&A712 3 file extension (BAS, BIN, BAK, etc) including:
&A712 1 b7 set = Read Only
&A713 1 b7 set = System (ie not listed by CAT or DIR)
&A715 1 16K block sequence number for this directory entry (0 for first block; if <>0 part of a larger file)
&A716 2 unused
&A718 1 length of this block in 128 byte records
&A719 16 sequence of Disc Block numbers containing file - &00 as end marker
&A729 1 number 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 1
&A72B 1
&A72C 1 OPENOUT flag (&FF=closed; <>&FF=opened)
&A72D &20 Copy of current or last Disc Directory entry for OPENOUT/SAVE:
&A72D 1 USER number
&A72E 8 filename (padded with spaces)
&A736 3 file extension ($$$ while open; correct extension when finished)
&A739 1 flag (&00=open; &FF=closed, ie finished)
&A73A 1
&A73B 1 flag (&00=open; &FF=closed)
&A73C 1 number of 128 byte records saved so far
&A73D 16 sequence of Disc Block numbers containing file - &00 as end marker
&A74D 1 number of 128 byte records saved so far
&A74E 1
&A74F 1
&A750 1 flag (&00=OPENIN; &01=In Char; &02=In Direct (whole file))
&A751 2 address of 2K buffer for ASCII, or of start of current/last block if BIN or BAS file
&A753 2 address of next byte to read for ASCII, or of 2K buffer for BAS or BIN file
&A755 &45 first &45 bytes of BAS/BIN file (extended header) or of extended header made for ASCII file
&A755 1 USER number
&A756 8 filename (padded)
&A75E 3 extension
&A761 6 unused
&A767 1 file type (&00=BASIC; &01=protected BASIC; &02=Binary; &16=ASCII)
&A768 2 unused
&A76A 2 address to load file into (=actual destination), or buffer for an ASCII file
&A76C 1 unused for disc
&A76D 2 length of file in bytes (&0000 for ASCII files)
&A76F 2 execution address for a BIN file
&A770 &25 unused
&A795 3 length of actual file in bytes (as &A76D) - BAS and BIN only
&A798 2 simple checksum of first 67 bytes of header (LB first) - BAS and BIN only
&A79A 1 flag (&00=OPENOUT; &01=Out Char; &02=Out Direct(whole file))
&A79B 2 address of 2K block if an ASCII file, or of current/last block saved if a BAS or BIN file
&A79D 2 address of next byte to write for ASCII files, or of 2K buffer for BAS and BIN files
&A79F &45 first &45 bytes of BAS/BIN file (ie extended header)
&A79F 1 USER number
&A7A0 8 filename (padded)
&A7A8 3 extension
&A7AB 1 flag (&00=Open)
&A7AC 1
&A7AD 1 flag (&00=Open)
&A7AE 3 unused
&A7B1 1 file type (&00=BASIC; &01=protected BASIC; &02=Binary; &16=ASCII)
&A7B2 2 unused
&A7B4 2 address to save file from (for BAS or BIN files), or of buffer for ASCII files
&A7B6 1 unused for disc
&A7B7 2 length of file in bytes
&A7B9 2 execution address for BIN files
&A7BB &25 unused
&A7DF 3 length of actual file in bytes (as at &A7B7) - BAS and BIN only
&A7E2 2 simple checksum of first 67 bytes of header (LB first) - BAS and BIN only
&A7E4 &80 buffer area for records sent to or loaded from Disc, or used in forming filename and extension
&A864 14*3 Tape Jumpblock is stored here by AMSDOS - is moved to &BC77 etc after |TAPE
&A88B 3 far address used by AMSDOS RST 3s at &BC77 etc (&CD30,&07)
&A890 &19 Drive A Extended Disc Parameter Block (XDPB):
&A890 2 number of 128 byte records per track
&A892 1 log2(Block size)-7 (&03=1024 bytes; &04=2048 bytes)
&A893 1 (Block size)/128-1 (&07=1024 bytes; &0F=2048 bytes)
&A894 1 (Block size)/1024 (if total of blocks <256, else /2048)-1
&A895 2 number of blocks per disc side (excluding reserved tracks)
&A897 2 number of (directory entries)-1
&A899 2 bit significant value of number of blocks for directory (&0080=1; &00C0=2)
&A89B 2 number of bits in checksum=((&A894)+ 1)/4
&A89D 2 number of reserved tracks (&00=Data; &01=IBM; &02=System)
&A89F 1 number of first sector (&01=IBM; &41=System; &C1=Data)
&A8A0 1 number of sectors per track (Data=9; System=9; IBM=8)
&A8A1 1 gap length (Read/Write)
&A8A2 1 gap length (Format)
&A8A3 1 format filler byte (&E5)
&A8A4 1 log2(sector size)-7 (&02=512; &03=1024)
&A8A5 1 records per sector
&A8A6 1 current track (not for use)
&A8A7 1 0=not aligned (not for use)
&A8A8 1 Auto select flag (&00=Auto select; &FF= don't alter)
&A8A9
&A8B9
&A8D0 &19 Drive B Extended Disc Parameter Block (arranged as at &A890)
&A8E9 (&17 bytes of &FF)
&A8F9
&A900 (&12 bytes of &00)
&A910
&A918 2 address of area for reading directory entries for Drive A
&A91A 2 address of Drive A XDPB
&A91C 2 address of the byte after the end of Drive A XDPB
&A91E 2
&A920 (8bytes of &00)
&A928 2 address of area for reading directory entries for Drive B
&A92A 2 address of Drive B XDPB
&A92C 2 address of the byte after the end of Drive B XDPB
&A92E 2
&A930 &80 block of directory entries, including last file loaded
&A9B0 &200 buffer for loading; usually contains last sector loaded
&ABB0 (&50 bytes of &00)


Adresses Size Comments on the memory locations
&AC00 Start of BASIC Operating System reserved area:
&AC00 1 program line redundant spaces flag (0=keep extra spaces; <>0=remove)
&AC01 1 AUTO flag (0=off; <>0=on)
&AC02 2 number of the next line for AUTO
&AC04 2 step distance for AUTO
&AC06 1
&AC07 1
&AC08 1
&AC09 1 WIDTH (&84=132)
&AC0A
&AC0B
&AC0C 1 FOR/NEXT flag (0=NEXT not yet used; <>0=used)
&ACOD 5 FOR start value (real). Only 2 bytes are used if % or DEFINT variable
&AC12 2 address of ': ' or of the end of program line byte after a NEXT command
&AC14 2 address of LB of the line number containing WEND
&AC16 1 WHILE/WEND flag (&41=WEND not yet used; &04=used)
&AC17
&AC18 2
&AClA 2
&AC1C 2 address of location holding ROM routine address for KB event block
&AC1E &0C Event Block for ON SQ(l):
&AC1E 2 chain address to next event block; &0000 if last in chain, but &FFFF if unused
&AC20 1 count
&AC21 1 class: Far address, highest (ON SQ) priority, Normal & Synchronous event
&AC22 2 routine address (in BASIC ROM)
&AC24 1 ROM Select number (&FD ie ROM 0 enabled, Lower ROM disabled)
&AC25 1 (first byte of user field)
&AC26 2 address of the end of program line byte or ':' after 'ON SQ(x) GOSUB line number' statement
&AC28 2 address of the end of program line byte of the line before the GOSUB routine
&AC2A &0C Event block for ON SQ(2), arranged as &AC1E onwards - second ON SQ priority
&AC36 &0C Event block for ON SQ(4), arranged as &AC1E onwards - lowest ON SQ priority
&AC42 &12 Ticker and Event Block for AFTER/EVERY Timer 0
&AC42 2 chain address to next event block (usually to another timer or &00FF)
&AC44 2 'count down' count
&AC46 2 recharge count (for EVERY only - &0000 if AFTER)
&AC48 2 chain address to next ticker block
&AC4A 1 count
&AC4B 1 class: Far address, lowest (timer) priority, Normal and Synchronous event
&AC4C 2 Routine address (in BASIC ROM)
&AC4E 1 ROM Select No (&FD ie ROM 0 enabled, Lower ROM disabled)
&AC4F 1 (first byte of user field)
&AC50 2 address of the end of program line byte or ':' after statement in use when the timer 'timed-out'
&AC52 2 address of the end of program line byte of the line before the GOSUB routine
&AC54 &12 Ticker and Event Block for AFTER/EVERY Timer 1 (3rd Timer priority) arranged as at &AC42
&AC66 &12 Ticker and Event Block for AFTER/EVERY Timer 2 (2nd Timer priority) arranged as at &AC42
&AC78 &12 Ticker and Event Block for AFTER/EVERY Timer 3 (highest priority) arranged as at &AC42
&AC8A &100 BASIC input area for lines (as typed in and not tokenised) or for INPUT
&AD8C 2 address of line number LB in line containing error
&AD8E 2 address of byte before statement containing error - ie of ':' or of HB of Line No
&AD90 1 ERR (Error No)
&AD91 1 DERR (Disc Error No)
&AD92 2 as &AD8E if error is in a program (ie not if in Direct Command Mode)
&AD94 2 as &AD8C if error is in a program (ie not if in Direct Command Mode)
&AD96 2 address of the length LB of line specified by the 'ON ERROR GOTO' command
&AD98 1
&AD99 &09 Current SOUND parameter block (see Firmware Jump &BCAA)
&AD99 1 channel andrendezvous status
&AD9A 1 amplitude envelope (ENV) number
&AD9B 1 tone envelope (ENT) number
&AD9C 2 tone period
&AD9E 1 noise period
&AD9F 1 initial amplitude
&ADA0 2 duration, or envelope repeat count
&ADA2 &10 Current Amplitude or Tone Envelope parameter bloc (see &BCBC or &BCBF)
&ADA2 1 number of sections (+&80 for a negative ENT number, ie the envelope is run until end of sound
&ADA3 3 first section of the envelope:
&ADA3 1 step count (if <&80) otherwise envelope shape (not tone envelope)
&ADA4 1 step size (if step count<&80) otherwise envelope period (not tone envelope)
&ADA5 1 pause time (if step count<&80) otherwise envelope period (not tone envelope)
&ADA6 3 second section of the envelope, as &ADA3
&ADA9 3 third section of the envelope, as &ADA3
&ADAC 3 fourth section of the envelope, as &ADA3
&ADAF 3 fifth section of the envelope, as &ADA3
&ADB2 5
&ADB7 &36
&ADEB 2
&ADED 6
&ADF3 26*1 table of DEFINT (&02), DEFSTR (&03) or DEFREAL default (&05), for variables 'a' to 'z'
&AE0D
&AE0E 2
&AE10 2
&AE12 2
&AE14 1
&AE15 2 address of line number LB of last BASIC line (or &FFFF)
&AE17 2 address of byte before next DATA item (eg comma or space)
&AE19 2 address of next space on GOSUB etc stack, (see also &B06F)
&AE1B 2 address of byte before current statement (&003F if in Direct Command mode)
&AE1D 2 address of line number LB of line of current statement (&0000 if in Direct Command mode)
&AE1F 1 trace flag (0=TROFF; <>0=TRON)
&AE20 1 flag used with Trace (&00 if in Direct Command mode; &01 if in a program)
&AE21
&AE22 2
&AE24 2
&AE26 2 address to load cassette file to
&AE28
&AE29 1 file type from cassette header
&AE2A 2 file length from cassette header
&AE2C 1 program protection flag (<>0 hides program as if protected)
&AE2D 17 buffer used to form binary or hexadecimal numbers before printing etc
&AE3A 5 start of buffer used to form hexadecimal numbers before printing etc
&AE3A 1 Key Number used with INKEY (providing the Key Number is written as a decimal)
&AE3E 1 last byte (usually &00 or &20) of the formed binary or hexadecimal number
&AE43 13 buffer used to form decimal numbers before printing etc
&AE4E 1 last byte (usually &00 or &20) of the formed decimal number
&AE51 1
&AE52 2
&AE54 1
&AE55 2 address of last used ROM or RSX JUMP instruction in its Jump Block
&AE57 1 ROM Select number if address above is in ROM
&AE58 2 BASIC Parser position, moved on to ': ', or the end of program line byte after a CALL or an RSX
&AE5A 2 the resetting address for machine Stack Pointer after a CALL or an RSX
&AE5C 2 ZONE value
&AE5D 1
&AE5E 2 HIMEM (set by MEMORY)
&AE60 address of highest byte of free RAM (ie last byte of UDG area)
&AE62 2 address of start of ROM lower reserved area (used for tokenised lines)
&AE64 2 address of end of ROM lower reserved area (byte before Program area)
&AE66 2 as &AE68
&AE68 2 address of start of Variables and DEF FNs area
&AE6A 2 address of start of Arrays area (where next Variable or DEF FN entry is placed)
&AE6C 2 address of start of free space (where next Array entry is placed)
&AE6E 1
&AE70 &1FF GOSUB, 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 overwitten by the next new entry:
GOSUB (84 max capacity):
1 (byte of &00)
2 address of end of program line byte or ':' after GOSUB statement (the point to RETURN to)
2 address of line number HB of line containing GOSUB
1 byte of &06, ie the length of the GOSUB entry
FOR (21 max for Real FORs,31 max for Integer FORs):
2 address of current value of control variable (in Variables area)
5 value of limit (ie the TO value) - there are two bytes only for Integer FORs
5 value of STEP - two bytes for Integer FORs
1 sign byte (&00 for positive; &01 for negative)
2 address of the end of program line byte, or ':' after the FOR statement (ie the address for the NEXT loop to restart at)
2 address of line number LB of line containing FOR
2 address of byte after NEXT statement (ie the address to continue at when the limit is exceeded)
2 address of byte after NEXT statement again
1 length byte (&16 for Real FORs; &10 for Integer FORs)
WHILE (66 max capacity):
2 address of line number LB of line containing WHILE
2 address of the end of program line byte or ':' after WEND statement (ie the address
to continue at when the condition is false)
2 address of condition after the WHILE command
1 length byte of &07 - end of WHILE entry proper but:
+5 value of condition (0 or -1 as a floating point value) only while the WHILE entry is the last on the stack
&B06F 2 address of the next space on the GOSUB etc
stack (see also &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

Adresses Size Comments on the memory locations
&B071 2 address of end of free space (the byte before the Strings area)
&B073 2 address of end of Strings area (=HIMEM)
&B075 1
&B076 2
&B078 2 address of the highest byte of free RAM disregarding UDGs (usually &A6FB)
&B07A 2
&B07C 2 address for the next entry in the String Concatenation area
&B07E 10*3 concatenation area holding descriptors of strings being used
&B09C 1 length of last String used
&B09D 2 address of last String used
&B09F 1 type byte used with the Virtual Accumulator (&02=Integer; &03=String; &05=Real)
&B0A0 5 Virtual Accurnulator used by the maths routines (two bytes for an Integer
value; three bytes for a String Descriptor; five bytes for a Real value)
&B0A0 2
&B0A2 1
&B0A3 2
&B0A5 &5B (&39 bytes on 464) bytes of &FF
&B100 2 &07, &C6
&B102 2 &65, &89
&B104 5
&B109 5
&B10E 5
&B113 1 DEG/RAD flag (&00=RAD; &FF=DEG)
&B114 1
&B115 1
&B116 1
&B117 1
&B118 &D2 Area used for Cassette handling:
&B118 1 cassette handling messages flag (0=enabled; <>O=disabled)
&B119 1
&B11A 1 file IN flag (&00=closed; &02=IN file; &03=opened; &05=IN char)
&B11B 2 address of 2K buffer for directories
&B11D 2 address of 2K buffer for loading blocks of files - often as &B11B
&B11F &40 IN Channel header
&B11F &10 filename (padded with NULs)
&B12F 1 number of block being loaded, or next to be loaded
&B130 1 last block flag (&FF=last block; &00=not)
&B131 1 file type (&00=BASIC; &01=Protected BASIC; &02=Binary; &08=Screen; &16=ASCII)
&B132 2 length of this block
&B134 2 address to load this or the next block at,or the address of the byte after last one loaded
&B136 1 first block flag (&FF=first block; &00=not)
&B137 2 total length of file (all blocks)
&B139 2 execution address for BIN files (&0000 if not saved as such)
&B13B &24 not allocated
&B15F 1 file OUT flag (&00=closed; &02=IN file; &03=opened; &05=IN char)
&B160 2 address to start the next block save from, or the address of the buffer if it is OPENOUT
&B162 2 address of start of the last block saved, or the address of the buffer if it is OPENOUT
&B164 &40 OUT Channel Header (details as IN Channel Header):
&B164 &10 filename
&B174 1 number of the block being saved, or next to be saved
&B175 1 last block flag (&FF=last block; &00=not)
&B176 1 file type (as at &B131
&B177 2 length saved so far
&B179 2 address of start of area to save, or address of buffer if it is an OPENOUT instruction
&B17B 1 first block flag (&FF=first block; &00=not)
&B17C 2 total length of file to be saved
&B17E 2 execution address for BIN files (&0000 if parameter not supplied)
&B180 &24 not allocated
&B1A4 &40 used to construct IN Channel header:
&B1B5 1
&B1B7 2
&B1B8 1
&B1BE 1
&B1B9 base address for calculating relevant Sound Channel block
&B1BC base address for calculating relevant Sound Channel ?
&B1BE base address for calculating relevant Sound Channel ?
&B1D5 base address for calculating relevant Sound Channel ?
&B1E4 1
&B1E5 1 synchronisation byte
&B1E6 2 &55, &62
&B1E8 1
&B1E9 1 cassette precompensation (default &06; SPEED WRITE 1 &0C @4æs)
&B1EA 1 cassette 'Half a Zero' duration (default &53; SPEED WRITE 1 &29 @ 4æS)
&B1EB 2
&B1ED 1 used by sound routines
&B1EE 1 used by sound routines
&B1F0 1 used by sound routines
7 used by sound and cassette routines
&B1F8 &3F Sound Channel A (1) data:
&B212 1 number of sounds still queuing
&B213 1 number of sounds originally queuing
&B217 8 first or fifth sound in Channel 1 (A) queue:
&B217 1 status: b0 to b2 = rendezvous with channel 1, 2 or 4; b3 = Hold; b4 = Flush
&B218 1 b0 to b3 = tone envelope number; b4 to b7 = volume envelope number (ie ENV number*16)
&B219 2 pitch
&B21B 1 noise
&B21C 1 volume
&B21D 2 duration (in 0.01 seconds)
&B21F 8 second sound in Channel 1 queue (as &B217)
&B227 8 third sound in Channel 1 queue (as &B217)
&B22F 8 fourth sound in Channel 1 queue (as &B217)
&B237 &3F Sound Channel B (2) data - as described at &B1F8
&B256 8 first or fifth sound in Channel 2 queue (as &B217)
&B25E 8 second sound in Channel 2 queue (as &B217)
&B266 8 third sound in Channel 2 queue (as &B217)
&B26E 8 fourth sound in Channel 2 queue (as &B217)
&B276 &3F Sound Channel C (4) data - as described at &B1F8
&B295 8 first or fifth sound in Channel 4 queue (as &B217)
&B29D 8 2nd sound in Channel 4 queue (as &B217)
&B2A5 8 3rd sound in Channel 4 queue (as &B217)
&B2AD 8 4th sound in Channel 4 queue (as &B217)
&B2A6 base address for calculating relevant ENV parameter block
&B2B6 15*16 ENV parameter block area (each arranged as &ADA2):
&B2B6 &10 ENV 1
&B2C6 &10 ENV 2
&B2D6 &10 ENV 3
&B2E6 &10 ENV 4
&B2F6 &10 ENV 5
&B306 &10 ENV 6
&B316 &10 ENV 7
&B326 &10 ENV 8
&B336 &10 ENV 9
&B346 &10 ENV 10
&B356 &10 ENV 11
&B366 &10 ENV 12
&B376 &10 ENV 13
&B386 &10 ENV 14
&B396 &10 ENV 15
&B396 base address for calculating relevant ENT parameter block
&B3A6 15*16 ENT parameter block area (each arranged as &ADA2):
&B3A6 &10 ENT 1
&B3B6 &10 ENT 2
&B3C6 &10 ENT 3
&B3D6 &10 ENT 4
&B3E6 &10 ENT 5
&B3F6 &10 ENT 6
&B406 &10 ENT 7
&B416 &10 ENT 8
&B426 &10 ENT 9
&B436 &10 ENT 10
&B446 &10 ENT 11
&B456 &10 ENT 12
&B466 &10 ENT 13
&B476 &10 ENT 14
&B486 &10 ENT 15


Adresses Size Comments on the memory locations
&B496 &50 Normal Key Table:
CurU CurR CurD f9 f6 f3 Enter f.
CurL Copy f7 f8 f5 f1 f2 f0
Clr [ Ret ] f4 \
^ - @ p ; : / .
0 9 o i l k m j
8 7 u y h j n Space
6 5 r t g f b v
4 3 e w s d c x
1 2 Esc q Tab a Caps z
[VT] [LF] [BS] [TAB] Fire2 Fire1 Del
&B4E6 &50 Shifted Key Table:
CurU CurR CurD f9 f6 f3 Enter f.
CurL Copy f7 f8 f5 f1 f2 f0
Clr { Ret } f4 `
£ = | P + * ? >
_ ) O I L K M <
( ' U Y H J N Space
& % R T G F B V
$ # E W S D C X
! " Esc Q -> A Caps Z
[VT] [LF] [BS] [TAB] Fire2 Fire1 Del
&B536 &50 Control Key Table:
CurU CurR CurD f9 f6 f3 Enter f.
CurL Copy f7 f8 f5 f1 f2 f0
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-lck (SUB)
Del
&B586 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 &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 1 Byte after end of DEF KEY area
&B629 1
&B62A 1
&B62B 2 address of DEF KEY area
&B62D 2 address of byte after end of DEF KEY area
&B62F 1
&B630 1
&B631 1 Shift lock flag (&00=off; &FF=on)
&B632 1 Caps lock flag (&00=off; &FF=on)
&B633 1 KB repeat period (SPEED KEY - default &02 @ 0.02 seconds)
&B634 1 KB delay period (SPEED KEY - default &1E @ 0.02 seconds)
&B635 2*10 Tables used for key scanning; bits 0 to 7 give the table columns (from left to right):
&B635 1
CurU CurR CurD f9 f6 f3 Enter f.
&B636 1
CurL Copy f7 f8 f5 f1 f2 f0
&B637 1
Clr [ Ret ] f4 Shift \ Ctrl
&B638 1
^ - @ p ; : / .
&B639 1
0 9 o i l k m j
&B63A 1
8 7 u y h j n Space
&B63B 1
Down Up Left Right Fire2 Fire1 (Joystick 1)
6 5 r t g f b      |     v
&B63C 1
4 3 e w s d c x
&B63D 1
1 2 Esc q Tab a Caps z
&B63E 1
Down Up Left Right Fire2 Fire1 (Joystick 2)
            Del
&B63F 1 complement of &B635
&B640 1 complement of &B636
&B641 1 complement of &B637
&B642 1 complement of &B638
&B643 1 complement of &B639
&B644 1 complement of &B63A
&B645 1 complement of &B63B
&B646 1 complement of &B63C
&B647 1 complement of &B63D
&B648 1 complement of &B63E
&B64B
&B653 1
&B654 1
&B655 1
&B656 1
&B657 7 event block for Keyboard handling, comprises:
&B657 2 chain address
&B659 1 count
&B65A 1 class: express event
&B65B 2 ROM routine address: &C492
&B65D 1 ROM select number: &FD
&B65E 20*2 store for last keys pressed and each entry is as follows:
byte 1: +0 to +10=key tables' line number; if bit 5 is set then Shift is pressed;
bit 7=Control is pressed
byte 2: b0 to b7=key tables' colum nnumber - see &B496 etc
&B67F 2 vestige from the 464?
&B686 1 number of free spaces in keyboard buffer
&B687 1 accumulated count of the number of keys pressed (MOD 20)
&B688 1 number of keys left in key buffer
&B689 1 accumulated count of the number of keys removed from the buffer (MOD 20)
&B68A 1
&B68B 2 address of the normal key table
&B68D 2 address of the shifted key table
&B68F 2 address of the control key table
&B691 2 address of the KB repeats table


Adresses Size Comments on the memory locations
&B692 1
&B693 2 ORIGIN x
&B695 2 ORIGIN y
&B697 2 graphics text x position (pixel)
&B699 2 graphics text y position(pixel)
&B69B 2 graphics window x of one edge (pixel)
&B69D 2 graphics window x of other edge (pixel)
&B69F 2 graphics window y of one side (pixel)
&B6A1 2 graphics window y of other side (pixel)
&B6A3 1 GRAPHICS PEN
&B6A4 1 GRAPHICS PAPER
&B6A5 8/14 (This area is 14 bytes on the 464) Used by line drawing (and other) routines, as follows:
&B6A7 2 x+1()
&B6A9 2 y/2+1()
&B6AB 2 y/2-x()
&B6AD 2
&B6AF 1
&B6B0 1
&B6B1 1
&B6B2 1 first point on drawn line flag (<>0=to be plotted; 0=don't plot)
&B6B3 1 line MASK
&B6B4 1
&B6B5 1 current stream number
&B6B6 14 Stream (window) 0 parameter block.These areas are arranged as &B726
&B6C4 14 stream (window) 1 parameter block
&B6D2 14 stream (window) 2 parameter block
&B6E0 14 stream (window) 3 parameter block
&B6EE 14 stream (window) 4 parameter block
&B6FC 14 stream (window) 5 parameter block
&B70A 14 stream (window) 6 parameter block
&B718 14 stream (window) 7 parameter block
&B726 14 Current Stream (Window) parameter block:
&B726 1 cursor y position (line) with respect to the whole screen (starting from 0)
&B727 1 cursor x position (column) with respect to the whole screen (starting from 0)
&B728
&B729 1 window top line (y) with respect to the whole screen (starting from 0)
&B72A 1 window left column (x) with respect to the whole screen (starting from 0)
&B72B 1 window bottom line (y) with respect to the whole screen (starting from 0)
&B72C 1 window right colwnn (x) with respect to the whole screen (starting from 0)
&B72D 1 scroll count
&B72E 1 cursor flag (&01=disable; &02=off; &FD=on; &FE=enable)
&B72F 1 current PEN number (encoded, not its INK number)
&B730 1 current PAPER number (encoded, not its INK number)
&B731 2 address of text background routine: opaque=&1392; transparent=&13A0
&B733 1 graphics character writing flag (0=off; <>0=on)
&B734 1 ASCII number of the first character in User Defined Graphic (UDG) matrix table
&B735 1 UDG matrix table flag (&00=non-existent; &FF=present)
&B736 2 address of UDG matrix table
&B738 2
&B758 1
&B759 1
&B763 32*3 Control Code handling routine table - each code's entry comprises:
byte 1: +0 to +9=number of parameters;
+&80=re-run routine at a System Reset
bytes 2 and 3: address of the control code's handling routine
&B763 3 ASC 0: &80,&1513: NUL
&B766 3 ASC 1: &81,&1335: Print control code chararacter [,char]
&B769 3 ASC 2: &80,&1297: Disable cursor
&B76C 3 ASC 3: &80,&1286: Enable cursor
&B76F 3 ASC 4: &81,&0AE9: Set mode [,mode]
&B772 3 ASC 5: &81,&1940: Print character using graphics mode [,char]
&B775 3 ASC 6: &00,&1459: Enable VDU
&B778 3 ASC 7: &80,&14E1: Beep
&B77B 3 ASC 8: &80,&1519: Back-space
&B77E 3 ASC 9: &80,&151E: Step-right
&B781 3 ASC 10: &80,&1523: Linefeed
&B784 3 ASC 11: &80,&1528: Previous line
&B787 3 ASC 12: &80,&154F: Clear window and locate the cursor at position 1,1
&B78A 3 ASC 13: &80,&153F: RETURN
&B78D 3 ASC 14: &81,&12AB: Set paper [,pen]
&B790 3 ASC 15: &81,&12A6: Set pen [,pen]
&B793 3 ASC 16: &80,&155E: Delete the character at the cursor position
&B796 3 ASC 17: &80,&1599: Clear the line up to the current cursor position
&B799 3 ASC 18: &80,&158F: Clear from the cursor position to the end of the line
&B79C 3 ASC 19: &80,&1578: Clear from start of the window to the cursor position
&B79F 3 ASC 20: &80,&1565: Clear from the cursor position to the end of a window
&B7A2 3 ASC 21: &80,&1452: Disable VDU
&B7A5 3 ASC 22: &81,&14EC: Set text write mode [,mode]
&B7A8 3 ASC 23: &81,&0C55: Set graphics draw mode [,mode]
&B7AB 3 ASC 24: &80,&12C6: Exchange pen and paper
&B7AE 3 ASC 25: &89,&150D: Define user defined character [,char,8 rows of char]
&B7B1 3 ASC 26: &84,&1501: Define window [,left,right,top,bottom]
&B7B4 3 ASC 27: &00,&14EB: ESC (=user)
&B7B7 3 ASC 28: &83,&14F1: Set the pen inks [,pen,ink 1,ink 2]
&B7BA 3 ASC 29: &82,&14FA: Set border colours [,ink,ink2]
&B7BD 3 ASC 30: &80,&1539: Locate the text cursor at position 1,1
&B7C0 3 ASC 31: &82,&1547: Locate the text cursor at [,column,line]


Adresses Size Comments on the memory locations
&B7C3 1 MODE number
&B7C4 2 screen offset
&B7C6 1 screen base HB (LB taken as &00)
&B7C7 3 graphics VDU write mode indirection - JP &0C74
&B7D2 1 first flash period (SPEED INK - default &0A @ 0.02 seconds)
&B7D3 1 second flash period (SPEED INK - default &0A @ 0.02 seconds)
&B7D4 1+16 Border and Pens' First Inks (as hardware numbers):
&B7D4 1 hw &04 = sw 1 (blue) border
&B7D5 1 hw &04 = sw 1 (blue) pen 0
&B7D6 1 hw &0A = sw 24 (bright yellow) pen 1
&B7D7 1 hw &13 = sw 20 (bright cyan) pen 2
&B7D8 1 hw &0C = sw 6 (bright red) pen 3
&B7D9 1 hw &0B = sw 26 (bright white) pen 4
&B7DA 1 hw &14 = sw 0 (black) pen 5
&B7DB 1 hw &15 = sw 2 (bright blue) pen 6
&B7DC 1 hw &0D = sw 8 (bright magenta) pen 7
&B7DD 1 hw &06 = sw 10 (cyan) pen 8
&B7DE 1 hw &1E = sw 12 (yellow) pen 9
&B7DF 1 hw &1F = sw 14 (pale blue) pen 10
&B7E0 1 hw &07 = sw 16 (pink) pen 11
&B7E1 1 hw &12 = sw 18 (bright green) pen 12
&B7E2 1 hw &19 = sw 22 (pale green) pen 13
&B7E3 1 hw &04 = sw 1 (blue) pen 14
&B7E4 1 hw &17 = sw 11 (sky blue) pen 15
&B7E5 1+16 Border and Pens' Second Inks (as hardware numbers):
&B7E5 1 hw &04 = sw 1 (blue) border
&B7E6 1 hw &04 = sw 1 (blue) pen 0
&B7E7 1 hw &0A = sw 24 (bright yellow) pen 1
&B7E8 1 hw &13 = sw 20 (bright cyan) pen 2
&B7E9 1 hw &0C = sw 6 (bright red) pen 3
&B7EA 1 hw &0B = sw 26 (bright white) pen 4
&B7EB 1 hw &14 = sw 0 (black) pen 5
&B7EC 1 hw &15 = sw 2 (bright blue) pen 6
&B7ED 1 hw &0D = sw 8 (bright magenta) pen 7
&B7EE 1 hw &06 = sw 10 (cyan) pen 8
&B7EF 1 hw &1E = sw 12 (yellow) pen 9
&B7F0 1 hw &1F = sw 14 (pale blue) pen 10
&B7F1 1 hw &07 = sw 16 (pink) pen 11
&B7F2 1 hw &12 = sw 18 (bright green) pen 12
&B7F3 1 hw &19 = sw 22 (pale green) pen 13
&B7F4 1 hw &04 = sw 1 (bright yellow) pen 14
&B7F5 1 hw &17 = sw 11 (pink) pen 15


Adresses Size Comments on the memory locations
&B7F6 1
&B7F7 1
&B7F8 1
&B7F9 2
&B7FB 2
&B7FD
&B802 1+1
&B804 1 number of entries in the Printer Translation Table (normally 10)
&B805 20*2 Printer Translation Table; each entry comprises:
byte 1: screen code
byte 2: printer code
&B805 2 screen &A0 printer &5E (acute accent)
&B807 2 screen &A1 printer &5C (\)
&B809 2 screen &A2 printer &7B ({)
&B80B 2 screen &A3 printer &23 (#)
&B80D 2 screen &A6 printer &40 (@)
&B80F 2 screen &AB printer &7C (|)
&B811 2 screen &AC printer &7D (})
&B813 2 screen &AD printer &7E (~)
&B815 2 screen &AE printer &5D (])
&B817 2 screen &AF printer &SE ([)
&B819 20 room for ten more translations
&B82D 1
&B82E 1
&B82F 2
&B831 1
&B832 2 temporary store for stack pointer (SP) during interrupt handling
&B834 &70 temporary machine stack (from &B8B3 downwards) during interrupt handling
&B8B4 4 TIME (stored with the LB first - four bytes give >166 days; three bytes give >15 hours)
&B8B8 1
&B8B9 2
&B8BB 2
&B8BD 2 address of the first ticker block in chain (if any)
&B8BF 1 Keyboard scan flag (&00=scan not needed; &01=scan needed)
&B8C0 2 address of the first event block in chain (if any)
&B8C2 1
&B8C3 &10 buffer for last RSX or RSX command name (last character has bit 7 set)
&B8D3 2 address of first ROM or RSX chaining block in chain
&B8D5 1 RAM bank number
&B8D6 1 Upper ROM status (eg select number)
&B8D7 2 entry point of foreground ROM in use (eg &C006 for BASIC ROM)
&B8D9 1 foreground ROM select address (0 for the BASIC ROM)
&B8DA 16*2 ROM entry IY value (ie the address table) - the 6128 has ROMs numbered from 0 to 15:
&B8DA 2 ROM 0 IY (not for the 464)
&B8DC 2 ROM 1 IY
&B8DE 2 ROM 2 IY
&B8E0 2 ROM 3 IY
&B8E2 2 ROM 4 IY
&B8E4 2 ROM 5 IY
&B8E6 2 ROM 6 IY
&B8E8 2 ROM 7 IY (usually &A700 for AMSDOS/CPM ROM)
&B8EA 2 ROM 8 IY
&B8EC 2 ROM 9 IY
&B8EE 2 ROM 10 IY
&B8F0 2 ROM 11 IY
&B8F2 2 ROM 12 IY
&B8F4 2 ROM 13 IY
&B8F6 2 ROM 14 IY
&B8F8 2 ROM 15 IY
&B8FA 6 6 bytes of &FF


Adresses Size Comments on the memory locations
&B900 12*3 High Kernel Jumpblock (on the 464 this block is 11*3 bytes in size)
&B924 &1C0 routines used by the High Kernel Jumpblock (on the 464 this is &1C8 bytes in size)
&BAE4 &1C bytes of &FF
&BB00 26*3 Key Manager Jumpblock
&BB4E 36*3 Text VDU Jumpblock
&BBBA 23*3 Graphics VDU Jumpblock
&BBFF 34*3 Screen Pack Jumpblock
&BC65 22*3 Cassette (and Disc if fitted) Manager Jumpblock
&BCA7 11*3 Sound Manager Jumpblock
&BCC8 25*3 Kernel Jumpblock
&BD13 26*3 Machine Pack Jumpblock
&BD61 32*3 Maths Jumpblock
&BDCD 14*3 Firmware Indirections
&BDF7 &09 bytes of &00 the lower limit of Machine Stack if no Disc Drive
&BE00 &40 &40 bytes of &FF
&BE40 &4x used by the AMSDOS ROM if a disc drive is fitted (otherwise &4x bytes of &FF)
&BE40 2 (address &A910)
&BE42 2 address of drive A XDPB
&BE44 9 Disc Set Up timing block:
&BE44 2 motor on period (default &0032; fastest &0023 @ 20mS)
&BE46 2 motor off period (default &00FA; fastest &00C8 @ 20mS)
&BE48 1 write current off period (default &AF @ 10æS)
&BE49 1 head settle time (default &0F @ 1mS)
&BE4A 1 step rate period (default &0C; fastest &0A @ 1mS)
&BE4B 1 head unload delay (default &01)
&BE4C 1 b0=non DMA mode; b1 to b7=head load delay (default &03)
&BE4D 2
&BE4F 1 Drive Header Information Block:
&BE4F 1 last track used
&BE50 1 head number (&00)
&BE51 1 last sector used
&BE52 1 log2(sector size)-7
&BE53 1
&BE54 1
&BE55 1
&BE56 1
&BE58 1
&BE59 1
&BE5D 1
&BE5E 1
&BE5F 1 disc motor flag (&00=off;&01=on - strangely reversed)
&BE60 2 address of buffer for directory entries block (&A930)
&BE62 2 as &BE76 (ie&A9B0)
&BE64 2
&BE66 1 disc retries (default &10)
&BE67 &11 AMSDOS Ticker and Event Block:
&BE67 2 ticker chaining address
&BE69 2 tick count
&BE6B 2 recharge count
&BE6D 2 event chaining address
&BE6F 1 count
&BE70 1 class (asynchronous event)
&BE71 2 ROM routine address (&C9D6)
&BE73 1 ROM select number (&07 ie the AMSDOS/CPM ROM)
&BE74 1 last sector number used
&BE75 1
&BE76 2 address of «K buffer, or of header info block (for WRlTE SECTOR etc)
&BE78 1 disc error message flag (&00=on; &FF=off - reversed again)
&BE7D 2 address of AMSDOS reserved area (&A700)
&BE7F x area used by AMSDOS to copy routines into RAM for running
&BE80 &80 &80 bytes of &FF (limit of machine stack if disc drive fitted)
&BF00 xy &xy bytes of &00)
&BFxy machine stack (in theory this stack could extend down much further)
&BFFF upper limit of machine stack