The CPCEMU Amstrad CPC Firmware Guide Originally by Bob Taylor and Thomas Defoe, 1992 Electronic version scanned and formatted by David Cantrell, 1994 Introduction Computer programming is one of the most satisfying hobbies as it is a rare opportunity to invent, develop, and test your own ideas and see them come to fruition. Competent programming is a skill which is not easy to master, but once learnt, it will give hours of pleasure - there are many people who spend hours inventing new coding tricks, solving complex problems, or just trying out an idea. Fortunately, when Amstrad developed the CPC and PLUS computers, they let the user access many of the computer's routines and use the Firmware in their own programs. Experienced programmers will no doubt write faster routines which are more efficient, or have some special feature, yet these extra facilities can easily be patched in using the Firmware Jumpblock. For many years, Amstrad produced the definitive guide to the insides of the CPC but sale of this was stopped almost 3 years ago. [Note - 3 yrs ago means 1989 here]. Since then the Firmware Manual has been regarded as an antique by those who are fortunate enough to own a copy. Nevertheless, the original guide had some omissions, notably the abscence of information on the system variables and the Z80 microprocessor inside every CPC or Plus. 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 This Conversion ... In August 1994, I phoned the original authors, asking whether I could distribute an electronic version of their firmware guide, to complement the Amstrad emulator CPCEMU, which has been written by Marco Vieth for IBM compatible PCs. They replied that I could, and so I am making this available to everyone who wants it. Of course, Bob Taylor and Thomas Defoe still own the copyright. They are no longer distributing the paper version, so won't lose out by the existence of an electronic version. To get the text into a computer, I used a Hewlett-Packard Scanjet flatbed scanner, and Omnipage Professional OCR software. (or was it Deskscan? - I forget now). Of course, the OCR software fucked up the formatting. Additionally, it couldn't recognize ampersands (&), converted 'm's to 'rn', lots of 'rn's to 'm', IX to I~Y, and all sorts of other silliness. It's taken me 5 months to get it sorted out, doing a few pages a week. It's VERY boring! I used PROTEXT version 6 to reformat it, as it's the only word-processor with powerful enough search-replace and ruler setting facilities, yet is still easy to use. Mind you, I suppose I think that because I'm used to it! It was particularly useful for the list of Z80 instructions towards the end of this file. (This section was 3 roughly instructions per line, with a single space between each field after being scanned. The original was arranged with all instructions alphabetically in to columns. This one has all instructions arranged in one column, alphabetically. Protext did most of the reformatting/sorting automagically) I've tried to reproduce the layout of the original book as closely as possible, but there are a few changes: In the plain ASCII version of this, I can't put in bold and italic text, different fonts, and point sizes. With a limit of 70 characters per line for most of the document, I've put in more line-wraps than the original. I've indented some parts of the document differently. In the original, things were made clearer by using boldface, but I can't so have had to change the layout slightly. This document is available in two forms - FIRMWARE.TXT contains the plain ASCII version. FIRMWARE.PTX contains the PROTEXT version. This includes the ruler lines, soft spaces and returns, etc... If you want to format it yourself (you want to do what?!?!?), write to me at the snail-mail address given in the CPCEMU documentation. Of course, to do this, you'll need PROTEXT 6 yourself. Of course, I disclaim any responsibility for any errors in this document. I have NOT checked every single letter in it, including the memory addresses and values given in various places, although I have corrected a few of the scanners HUGE errors. When using the original paper-based version of the Firmware Guide, I had no problems, but the scanner has probably put in a few errors. David Cantrell, December 1994 *** ADVERT FOR ARNOR *** ADVERT FOR ARNOR *** ADVERT FOR ARNOR *** Protext version 6 is available for PCs running MSDOS, from: Arnor Ltd, 611 Lincoln Road Peterborough PE1 3HA England Phone +44 1733 68909 *** END OF ADVERT *** END OF ADVERT *** END OF ADVERT *** 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: <> means 'not the value or bit which follows' * means 'this applies to all machine with a disk drive fitted' b0 means bit 0 b1 means bit 1 ... b15 means bit 15 HB means 'most significant byte, hi-byte' LB means '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. However, a Conversion Chart specifically for the 464 is printed in Appendix C. The System Variables 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &0000 ³ &0000 ³ &40 ³ Restart block: &0000 ³ &0000 ³ ³ RST0: complete machine reset &0008 ³ &0008 ³ ³ RST 1: LOWJUMP: in-line two byte address: ³ ³ ³ b0 to b13=address; b14=Low ROM disabled; ³ ³ ³ b15=Upper ROM disabled &000B ³ &000B ³ ³ LOW PCHL: HL has address as RST 1 &000E ³ &000E ³ ³ 'JMP BC': BC has address to jump to &0010 ³ &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 ³ &0013 ³ ³ SIDE PCHL: HL has address as RST 2 &0016 ³ &0016 ³ ³ 'JMP DE': DE has address to jump to &0018 ³ &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 ³ &001B ³ ³ FAR PCHL: as RST 3, but HL has address; ³ ³ ³ C has ROM select &001E ³ &001E ³ ³ 'JMP HL': HL has address to jump to &0020 ³ &0020 ³ ³ RST 4: RAM LAM: LD A,(HL) from RAM with ³ ³ ³ ROMs disabled &0023 ³ &0023 ³ ³ FAR CALL: as RST 3, but HL has address of ³ ³ ³ three byte address block &0028 ³ &0028 ³ ³ RST 5: FIRM JUMP: inline two byte address ³ ³ ³ to jump to &0030 ³ &0030 ³ ³ RST 6: User restart; default to RST 0 &0038 ³ &0038 ³ ³ RST 7: Interrupt entry (KB/Time etc) &003B ³ &003B ³ ³ External interrupt (default to RET) &0040 ³ &0040 ³ &130 ³ ROM lower foreground area: BASIC input ³ ³ ³ area (tokenised) &016F ³ &016F ³ ³ end of BASIC input &0170 ³ &0170 ³ ³ BASIC working area for program, variables, ³ ³ ³ etc... &0170 ³ &0170 ³ ³ Program 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 ³ ³ n*8 ³ User defined graphics area ³ ³ ³ end of UDG area ³ ³ ³ ROM Upper reserved area, expandible during ³ ³ ³ KL ROM WALK, including: ³ ³ r*4 ³ ROM chaining blocks (arranged as follows): &A6FC ³ &A6FC ³ 4 ³ AMSDOS chain,ing block: &A6FC ³ &A6FC ³ 2 ³ address of next ROM block in chain (or ³ ³ ³ &0000 if the last in chain) &A6FE ³ &A6FE ³ 1 ³ ROM Select address &A6FF ³ &A6FF ³ 1 ³ &00 ÄÄÄÄÄÄĮÄÄÄÄÄÄÄĮÄÄÄÄÄÄĮÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A700 ³ &A700 ³ &500 ³ AMSDOS reserved area ³ ³ ³ This area is moved down if any ROMs have ³ ³ ³ numbers greater than eight (6128 only) &A700 ³ &A700 ³ 1 ³ Current drive number (0=A; 1=B) &A701 ³ &A701 ³ 1 ³ Current USER number &A702 ³ &A702 ³ 1 ³ flag? &A703 ³ &A703 ³ 2 ³ address? &A705 ³ &A705 ³ 1 ³ flag? &A706 ³ &A706 ³ 2 ³ address? ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A708 ³ &A708 ³ 1 ³ OPENIN flag (&FF=closed; <>&FF=opened) &A709 ³ &A709 ³ &20 ³ Copy of current or last Disc Directory ³ ³ ³ entry for OPENIN/LOAD: &A709 ³ &A709 ³ 1 ³ USER number &A70A ³ &A70A ³ 8 ³ filename (padded with spaces) &A712 ³ &A712 ³ 3 ³ file extension (BAS, BIN, BAK, etc) ³ ³ ³ including: &A712 ³ &A712 ³ 1 ³ b7 set = Read Only &A713 ³ &A713 ³ 1 ³ b7 set = System (ie not listed by CAT or ³ ³ ³ DIR) &A715 ³ &A715 ³ 1 ³ 16K block sequence nurnber for this ³ ³ ³ directory entry (0 for first block; if ³ ³ ³ <>0 part of a larger file) &A716 ³ &A716 ³ 2 ³ unused &A718 ³ &A718 ³ 1 ³ length of this block in 128 byte records &A719 ³ &A719 ³ 16 ³ sequence of Disc Block nurnbers containing ³ ³ ³ file - &00 as end marker &A729 ³ &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 ³ &A72A ³ 1 ³ &A72B ³ &A72B ³ 1 ³ ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A72C ³ &A72C ³ 1 ³ OPENOUT flag (&FF=closed; <>&FF=opened) &A72D ³ &A72D ³ &20 ³ Copy of current or last Disc Directory ³ ³ ³ entry for OPENOUT/SAVE: &A72D ³ &A72D ³ 1 ³ USER number &A72E ³ &A72E ³ 8 ³ filename (padded with spaces) &A736 ³ &A736 ³ 3 ³ file extension ($$$ while open; correct ³ ³ ³ extension when finished) &A739 ³ &A739 ³ 1 ³ flag (&00=open; &FF=closed, ie finished) &A73A ³ &A73A ³ 1 ³ &A73B ³ &A73B ³ 1 ³ flag (&00=open; &FF=closed) &A73C ³ &A73C ³ 1 ³ number of 128 byte records saved so far &A73D ³ &A73D ³ 16 ³ sequence of Disc Block numbers containing ³ ³ ³ file - &00 as end marker &A74D ³ &A74D ³ 1 ³ number of 128 byte records saved so far &A74E ³ &A74E ³ 1 ³ &A74F ³ &A74F ³ 1 ³ ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A750 ³ &A750 ³ 1 ³ flag (&00=OPENIN; &01=In Char; ³ ³ ³ &02=In Direct (whole file)) &A751 ³ &A751 ³ 2 ³ address of 2K buffer for ASCII, or of ³ ³ ³ start of current/last block if BIN or ³ ³ ³ BAS file &A753 ³ &A753 ³ 2 ³ address of next byte to read for ASCII, or ³ ³ ³ of 2K buffer for BAS or BIN file 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A755 ³ &A755 ³ &45 ³ first &45 bytes of BAS/BIN file (extended ³ ³ ³ header) or of extended header made for ³ ³ ³ ASCII file &A755 ³ &A755 ³ 1 ³ USER number &A756 ³ &A756 ³ 8 ³ filename (padded) &A75E ³ &A75E ³ 3 ³ extension &A761 ³ &A761 ³ 6 ³ unused &A767 ³ &A767 ³ 1 ³ file type (&00=BASIC; &01=protected BASIC; ³ ³ ³ &02=Binary; &16=ASCII) &A768 ³ &A768 ³ 2 ³ unused &A76A ³ &A76A ³ 2 ³ address to load file into (=actual ³ ³ ³ destination), or buffer for an ASCII ³ ³ ³ file &A76C ³ &A76C ³ 1 ³ unused for disc &A76D ³ &A76D ³ 2 ³ length of file in bytes (&0000 for ASCII ³ ³ ³ files) &A76F ³ &A76F ³ 2 ³ execution address fora BIN file &A770 ³ &A770 ³ &25 ³ unused &A795 ³ &A795 ³ 3 ³ length of actual file in bytes (as &A76D) ³ ³ ³ -BAS and BIN only &A798 ³ &A798 ³ 2 ³ simple checksum of first 67 bytes of ³ ³ ³ header (LB first) - BAS and BIN only ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A79A ³ &A79A ³ 1 ³ flag (&00=OPENOUT; &01=Out Char; ³ ³ ³ &02=Out Direct(whole file)) &A79B ³ &A79B ³ 2 ³ address of 2K block if an ASCII file, or ³ ³ ³ of current/last block saved if a BAS ³ ³ ³ or BIN file &A79D ³ &A79D ³ 2 ³ address of next byte to write for ASCII ³ ³ ³ files, or of 2K buffer for BAS and BIN ³ ³ ³ files ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A79F ³ &A79F ³ &45 ³ first &45 bytes of BAS/BIN file (ie ³ ³ ³ extended header) &A79F ³ &A79F ³ 1 ³ USER number &A7A0 ³ &A7A0 ³ 8 ³ filename (padded) &A7A8 ³ &A7A8 ³ 3 ³ extension &A7AB ³ &A7AB ³ 1 ³ flag (&00=Open) &A7AC ³ &A7AC ³ 1 ³ &A7AD ³ &A7AD ³ 1 ³ flag (&00=Open) &A7AE ³ &A7AE ³ 3 ³ unused &A7B1 ³ &A7Bl ³ 1 ³ file type (&00=BASIC; &01=protected BASIC; ³ ³ ³ &02=Binary; &16=ASCII) &A7B2 ³ &A7B2 ³ 2 ³ unused &A7B4 ³ &A7B4 ³ 2 ³ address to save file from (for BAS or BIN ³ ³ ³ files), or of buffer for ASCII files &A7B6 ³ &A7B6 ³ 1 ³ unused for disc &A7B7 ³ &A7B7 ³ 2 ³ length of file in bytes &A7B9 ³ &A7B9 ³ 2 ³ execution address for BIN files &A7BB ³ &A7BB ³ &25 ³ unused &A7DF ³ &A7DF ³ 3 ³ length of actual file in bytes (as at ³ ³ ³ &A7B7) - BAS and BIN only &A7E2 ³ &A7E2 ³ 2 ³ simple checksum of first 67 bytes of ³ ³ ³ header (LB first) - BAS and BIN only &A7E4 ³ &A7E4 ³ &80 ³ buffer area for records sent to or loaded ³ ³ ³ from Disc, or used in forming filename ³ ³ ³ and extension &A864 ³ &A864 ³ 14*3 ³ Tape Jumpblock is stored here by AMSDOS ³ ³ ³ - is moved to &BC77 etc after |TAPE &A88B ³ &A88B ³ 3 ³ far address used by AMSDOS RST 3s at &BC77 ³ ³ ³ etc (&CD30,&07) ÄÄÄÄÄÄĮÄÄÄÄÄÄÄĮÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A890 ³ &A890 ³ &19 ³ Drive A Extended Disc Parameter Block ³ ³ ³ (XDPB): &A890 ³ &A890 ³ 2 ³ number of 128 byte records per track &A892 ³ &A892 ³ 1 ³ log2(Block size)-7 (&03=1024 bytes; ³ ³ ³ &04=2048 bytes) &A893 ³ &A893 ³ 1 ³ (Block size)/128-1 (&07=1024 bytes; ³ ³ ³ &0F=2048 bytes) &A894 ³ &A894 ³ 1 ³ (Block size)/1024 (if total of blocks ³ ³ ³ <256, else /2048)-1 &A895 ³ &A895 ³ 2 ³ number of blocks per disc side (excluding ³ ³ ³ reserved tracks) &A897 ³ &A897 ³ 2 ³ number of (directory entries)-1 &A899 ³ &A899 ³ 2 ³ bit signiflcant value of number of blocks ³ ³ ³ for directory (&0080=1; &00C0=2) &A89B ³ &A89B ³ 2 ³ number of bits in checksum ³ ³ ³ =((&A894)+ 1)/4 &A89D ³ &A89D ³ 2 ³ number of reserved tracks (&00=Data; ³ ³ ³ &01=IBM; &02=System) &A89F ³ &A89F ³ 1 ³ number of first sector (&01=IBM; ³ ³ ³ &41=System; &C1=Data) &A8A0 ³ &A8A0 ³ 1 ³ number of sectors per track (Data=9; ³ ³ ³ System=9; IBM=8) &A8A1 ³ &A8Al ³ 1 ³ gap length (Read/Write) &A8A2 ³ &A8A2 ³ 1 ³ gap length (Format) &A8A3 ³ &A8A3 ³ 1 ³ format filler byte (&E5) &A8A4 ³ &A8A4 ³ 1 ³ log2(sector size)-7 (&02=512; &03=1024) &A8A5 ³ &A8A5 ³ 1 ³ records per sector &A8A6 ³ &A8A6 ³ 1 ³ current track (not for use) &A8A7 ³ &A8A7 ³ 1 ³ 0=not aligned (not for use) &A8A8 ³ &A8A8 ³ 1 ³ Auto select flag (&00=Auto select; ³ ³ ³ &FF= don't alter) ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A8A9 ³ &A8A9 ³ ³ &A8B9 ³ &A8B9 ³ ³ &A8D0 ³ &A8D0 ³ &19 ³ Drive B Extended Disc Parameter Block ³ ³ ³ (arranged as at &A890) &A8E9 ³ &A8E9 ³ ³ (&17 bytes of &FF) &A8F9 ³ &A8F9 ³ ³ &A900 ³ &A900 ³ ³ (&12 bytes of &00) &A910 ³ &A910 ³ ³ ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &A918 ³ &A918 ³ 2 ³ address of area for reading directory ³ ³ ³ entries for Drive A &A91A ³ &A91A ³ 2 ³ address of Drive A XDPB &A91C ³ &A91C ³ 2 ³ address of the byte after the end of ³ ³ ³ Drive A XDPB &A91E ³ &A91E ³ 2 ³ &A920 ³ &A920 ³ ³ (8bytes of &00) &A928 ³ &A928 ³ 2 ³ address of area for reading directory ³ ³ ³ entries for Drive B &A92A ³ &A92A ³ 2 ³ address of Drive B XDPB &A92C ³ &A92C ³ 2 ³ address of the byte after the end of ³ ³ ³ Drive B XDPB &A92E ³ &A92E ³ 2 ³ &A930 ³ &A930 ³ &80 ³ block of directory entries, including last ³ ³ ³ file loaded &A9B0 ³ &A9B0 ³ &200 ³ buffer for loading; usually contains last ³ ³ ³ sector loaded &ABB0 ³ &ABB0 ³ ³ (&50 bytes of &00) 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AC00 ³ &AC00 ³ ³ Start of BASIC Operating System reserved ³ ³ ³ area: &AC00 ³ &AC00 ³ 1 ³ program line redundant spaces flag ³ ³ ³ (0=keep extra spaces; <>0=remove) ³ &AC01 ³ 9*3 ³ groups of 3 RET bytes (&C9) called by the ³ ³ ³ Upper ROM &AC01 ³ &AC1C ³ 1 ³ AUTO flag (0=off; <>0=on) &AC02 ³ &AC1D ³ 2 ³ number of the next line (6128) or of the ³ ³ ³ current line (464) for AUTO &AC04 ³ &AC1F ³ 2 ³ step distance for AUTO &AC06 ³ &AC21 ³ 1 ³ &AC07 ³ &AC22 ³ 1 ³ &AC08 ³ ³ 1 ³ ³ &AC23 ³ 1 ³ &AC09 ³ &AC24 ³ 1 ³ WIDTH (&84=132) &AC0A ³ &AC25 ³ ³ &AC0B ³ ³ ³ &AC0C ³ &AC26 ³ 1 ³ FOR/NEXT flag (0=NEXT not yet used; ³ ³ ³ <>0=used) &ACOD ³ &AC27 ³ 5 ³ FOR start value (real). Only 2 bytes are ³ ³ ³ used if % or DEFINT variable &AC12 ³ &AC2C ³ 2 ³ address of ': ' or of the end of program ³ ³ ³ line byte after a NEXT command &AC14 ³ &AC2E ³ 2 ³ address of LB of the line number ³ ³ ³ containing WEND &AC16 ³ &AC30 ³ 1 ³ WHILE/WEND flag (&41=WEND not yet used; ³ ³ ³ &04=used) &AC17 ³ &AC31 ³ ³ &AC18 ³ &AC32 ³ 2 ³ &AClA ³ &AC34 ³ 2 ³ &AC1C ³ &AC36 ³ 2 ³ address of location holding ROM routine ³ ³ ³ address for KB event block ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AC1E ³ &AC38 ³ &0C ³ Event Block for ON SQ(l): &AC1E ³ &AC38 ³ 2 ³ chain address to next event block; &0000 ³ ³ ³ if last in chain, but &FFFF if unused &AC20 ³ &AC3A ³ 1 ³ count &AC21 ³ &AC3B ³ 1 ³ class: Far address, highest (ON SQ) ³ ³ ³ priority, Normal & Synchronous event &AC22 ³ &AC3C ³ 2 ³ routine address (in BASIC ROM) &AC24 ³ &AC3E ³ 1 ³ ROM Select number (&FD ie ROM 0 enabled, ³ ³ ³ Lower ROM disabled) &AC25 ³ &AC3F ³ 1 ³ (first byte of user field) &AC26 ³ &AC40 ³ 2 ³ address of the end of program line byte or ³ ³ ³ ':' after 'ON SQ(x) GOSUB line number' ³ ³ ³ statement &AC28 ³ &AC42 ³ 2 ³ address of the end of program line byte of ³ ³ ³ the line before the GOSUB routine &AC2A ³ &AC44 ³ &0C ³ Event block for ON SQ(2), arranged as ³ ³ ³ &AC1E onwards - second ON SQ priority &AC36 ³ &AC50 ³ &0C ³ Event block for ON SQ(4), arranged as ³ ³ ³ &AC1E onwards - lowest ON SQ priority 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AC42 ³ &AC5C ³ &12 ³ Ticker and Event Block for AFTER/EVERY ³ ³ ³ Timer 0 &AC42 ³ &AC5C ³ 2 ³ chain address to next event block (usually ³ ³ ³ to another timer or &00FF) &AC44 ³ &AC5E ³ 2 ³ 'count down' count &AC46 ³ &AC60 ³ 2 ³ recharge count (for EVERY only - &0000 if ³ ³ ³ AFTER) &AC48 ³ &AC62 ³ 2 ³ chain address to next ticker block &AC4A ³ &AC64 ³ 1 ³ count &AC4B ³ &AC65 ³ 1 ³ class: Far address, lowest (timer) ³ ³ ³ priority, Normal and Synchronous event &AC4C ³ &AC66 ³ 2 ³ Routine address (in BASIC ROM) &AC4E ³ &AC68 ³ 1 ³ ROM Select No (&FD ie ROM 0 enabled, Lower ³ ³ ³ ROM disabled) &AC4F ³ &AC69 ³ 1 ³ (first byte of user field) &AC50 ³ &AC6A ³ 2 ³ address of the end of prograrn line byte ³ ³ ³ or ':' after statement in use when the ³ ³ ³ timer 'timed-out' &AC52 ³ &AC6C ³ 2 ³ address of tbe end of prograrn line byte ³ ³ ³ of tbe line before the GOSUB routine &AC54 ³ &AC6E ³ &12 ³ Ticker and Event Block for AFTER/EVERY ³ ³ ³ Timer 1 (3rd Timer priority) arranged as ³ ³ ³ at &AC42 &AC66 ³ &AC80 ³ &12 ³ Ticker and Event Block for AFTER/EVERY ³ ³ ³ Timer 2 (2nd Timer priority) arranged as ³ ³ ³ at &AC42 &AC78 ³ &AC92 ³ &12 ³ Ticker and Event Block for AFTER/EVERY ³ ³ ³ Timer 3 (highest priority) arranged as ³ ³ ³ at &AC42 ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AC8A ³ &ACA4 ³ &100 ³ BASIC input area for lines (as typed in ³ ³ ³ and not tokenised) or for INPUT &AD8C ³ &ADA6 ³ 2 ³ address of line number LB in line ³ ³ ³ containing error &AD8E ³ &ADA8 ³ 2 ³ address of byte before statement ³ ³ ³ containing error - ie of ':' or of ³ ³ ³ HB of Line No &AD90 ³ &ADAA ³ 1 ³ ERR (Error No) &AD91 ³ ³ 1 ³ DERR (Disc Error No) &AD92 ³ &ADAB ³ 2 ³ as &AD8E if error is in a program (ie not ³ ³ ³ if in Direct Command Mode) &AD94 ³ &ADAD ³ 2 ³ as &AD8C if error is in a program (ie not ³ ³ ³ if in Direct Command Mode) &AD96 ³ &ADAF ³ 2 ³ address of the length LB of line specified ³ ³ ³ by the 'ON ERROR GOTO' command &AD98 ³ &ADB1 ³ 1 ³ 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AD99 ³ &ADB2 ³ &09 ³ Current SOUND parameter block (see ³ ³ ³ Firmware Jump &BCAA) &AD99 ³ &ADB2 ³ 1 ³ channel andrendezvous status &AD9A ³ &ADB3 ³ 1 ³ amplitude envelope (ENV) number &AD9B ³ &ADB4 ³ 1 ³ tone envelope (ENT) number &AD9C ³ &ADB5 ³ 2 ³ tone period &AD9E ³ &ADB7 ³ 1 ³ noise period &AD9F ³ &ADB8 ³ 1 ³ initial amplitude &ADA0 ³ &ADB9 ³ 2 ³ duration, or envelope repeat count &ADA2 ³ &ADBB ³ &10 ³ Current Amplitude or Tone Envelope ³ ³ ³ parameter bloc (see &BCBC or &BCBF) &ADA2 ³ &ADBB ³ 1 ³ number of sections (+&80 for a negative ³ ³ ³ ENT number, ie the envelope is run until ³ ³ ³ end of sound &ADA3 ³ &ADBC ³ 3 ³ first section of the envelope: &ADA3 ³ &ADBC ³ 1 ³ step count (if <&80) otherwise envelope ³ ³ ³ shape (not tone envelope) &ADA4 ³ &ADBD ³ 1 ³ step size (if step count<&80) otherwise ³ ³ ³ envelope period (not tone envelope) &ADA5 ³ &ADBE ³ 1 ³ pause time (if step count<&80) otherwise ³ ³ ³ envelope period (not tone envelope) &ADA6 ³ &ADBF ³ 3 ³ second section of the envelope, as &ADA3 &ADA9 ³ &ADC2 ³ 3 ³ third section of the envelope, as &ADA3 &ADAC ³ &ADC5 ³ 3 ³ fourth section of the envelope, as &ADA3 &ADAF ³ &ADC8 ³ 3 ³ fifth section of the envelope, as &ADA3 &ADB2 ³ &ADCB ³ 5 ³ &ADB7 ³ &ADD0 ³ &36 ³ &ADEB ³ &AE04 ³ 2 ³ &ADED ³ &AE06 ³ 6 ³ ³ ³ ³ &ADF3 ³ &AE0C ³ 26*1 ³ table of DEFINT (&02), DEFSTR (&03) or ³ ³ ³ DEFREAL default (&05), for variables 'a' ³ ³ ³ to 'z' &AE0D ³ &AE26 ³ ³ &AE0E ³ &AE27 ³ 2 ³ &AE10 ³ &AE29 ³ 2 ³ &AE12 ³ &AE2B ³ 2 ³ &AE14 ³ &AE2D ³ 1 ³ &AE15 ³ &AE2E ³ 2 ³ address of line number LB of last BASIC ³ ³ ³ line (or &FFFF) &AE17 ³ &AE30 ³ 2 ³ address of byte before next DATA item (eg ³ ³ ³ comma or space) &AE19 ³ &AE32 ³ 2 ³ address of next space on GOSUB etc stack, ³ ³ ³ (see also &B06F) &AE1B ³ &AE34 ³ 2 ³ address of byte before current statement ³ ³ ³ (&003F if in Direct Command mode) &AE1D ³ &AE36 ³ 2 ³ address of line nurnber LB of line of ³ ³ ³ current statement (&0000 if in Direct ³ ³ ³ Command mode) &AE1F ³ &AE38 ³ 1 ³ trace flag (0=TROFF; <>0=TRON) &AE20 ³ &AE39 ³ 1 ³ flag used with Trace (&00 if in Direct ³ ³ ³ Command mode; &01 if in a program) 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AE21 ³ &AE3A ³ ³ &AE22 ³ &AE3B ³ 2 ³ &AE24 ³ &AE3D ³ 2 ³ &AE26 ³ &AE3F ³ 2 ³ address to load cassette file to &AE28 ³ &AE41 ³ ³ &AE29 ³ &AE42 ³ 1 ³ file type from cassette header &AE2A ³ &AE43 ³ 2 ³ file length from cassette header &AE2C ³ &AE45 ³ 1 ³ program protection flag (<>0 hides program ³ ³ ³ as if protected) &AE2D ³ &AE46 ³ 17 ³ buffer used to form binary or hexadecimal ³ ³ ³ numbers before printing etc &AE3A ³ &AE53 ³ 5 ³ start of buffer used to form hexadecimal ³ ³ ³ numbers before printing etc &AE3A ³ &AE53 ³ 1 ³ Key Number used with INKEY (providing the ³ ³ ³ Key Number is written as a decimal) &AE3E ³ &AE57 ³ 1 ³ last byte (usually &00 or &20) of the ³ ³ ³ formed binary or hexadecimal number &AE43 ³ &AE5D ³ 13 ³ buffer used to form decimal numbers before ³ ³ ³ printing etc &AE4E ³ &AE68 ³ 1 ³ last byte (usually &00 or &20) of the ³ ³ ³ formed decimal number ³ &AE6B ³ 3 ³ &AE51 ³ ³ 1 ³ &AE52 ³ &AE6E ³ 2 ³ &AE54 ³ ³ 1 ³ ³ &AE70 ³ 2 ³ temporary store for address after ³ ³ ³ using (&AE68) ³ ³ ³ &AE55 ³ &AE72 ³ 2 ³ address of last used ROM or RSX JUMP ³ ³ ³ instruction in its Jump Block &AE57 ³ &AE74 ³ 1 ³ ROM Select number if address above is in ³ ³ ³ ROM &AE58 ³ &AE75 ³ 2 ³ BASIC Parser position, moved on to ': ', ³ ³ ³ or the end of program line byte after a ³ ³ ³ CALL or an RSX &AE5A ³ &AE77 ³ 2 ³ the resetting address for machine Stack ³ ³ ³ Pointer after a CALL or an RSX &AE5C ³ &AE79 ³ 2 ³ ZONE value &AE5D ³ ³ 1 ³ ³ &AE7A ³ 1 ³ ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AE5E ³ &AE7B ³ 2 ³ HIMEM (set by MEMORY) ³ &AE7D ³ 2 ³ address 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 &AE60 ³ 2 ³ ³ address of highest byte of free RAM (ie ³ ³ ³ last byte of UDG area) &AE62 ³ &AE7F ³ 2 ³ address of start of ROM lower reserved ³ ³ ³ area (used for tokenised lines) &AE64 ³ &AE81 ³ 2 ³ address of end of ROM lower reserved area ³ ³ ³ (byte before Program area) &AE66 ³ &AE83 ³ 2 ³ as &AE68 &AE68 ³ &AE85 ³ 2 ³ address of start of Variables and DEF FNs ³ ³ ³ area &AE6A ³ &AE87 ³ 2 ³ address of start of Arrays area (where ³ ³ ³ next Variable or DEF FN entry is placed) &AE6C ³ &AE89 ³ 2 ³ address of start of free space (where ³ ³ ³ next Array entry is placed) &AE6E ³ ³ 1 ³ 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &AE70 ³ &AE8C ³ &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 ³ &B08B ³ 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 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B071 ³ &B08D ³ 2 ³ address of end of free space (the byte ³ ³ ³ before the Strings area) &B073 ³ &B08F ³ 2 ³ address of end of Strings area (=HIMEM) &B075 ³ ³ 1 ³ ³ &B091 ³ 1 ³ ³ &B092 ³ 2 ³ &B076 ³ &B094 ³ 2 ³ &B078 ³ &B096 ³ 2 ³ address of the highest byte of free RAM ³ ³ ³ disregarding UDGs (usually &A6FB) &B07A ³ &B098 ³ 2 ³ &B07C ³ &B09A ³ 2 ³ address for the next entry in the String ³ ³ ³ Concatenation area &B07E ³ &B09C ³ 10*3 ³ concatenation area holding descriptors of ³ ³ ³ strings being used &B09C ³ &B0BA ³ 1 ³ length of last String used &B09D ³ &B0BB ³ 2 ³ address of last String used ³ &B0BD ³ 2 ³ ³ &BOBF ³ 2 ³ &B09F ³ &BOC1 ³ 1 ³ type byte used with the Virtual ³ ³ ³ Accumulator (&02=Integer; &03=String; ³ ³ ³ &05=Real) &B0A0 ³ &B0C2 ³ 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 ³ &B0C2 ³ 2 ³ &B0A2 ³ &B0C4 ³ 1 ³ &B0A3 ³ &B0C5 ³ 2 ³ &B0A5 ³ &B0C7 ³ &5B ³ (&39 bytes on 464) bytes of &FF &B100 ³ &B8E4 ³ 2 ³ &07, &C6 &B102 ³ &B8E6 ³ 2 ³ &65, &89 &B104 ³ &B8E8 ³ 5 ³ &B109 ³ &B8ED ³ 5 ³ &B10E ³ &B8F2 ³ 5 ³ &B113 ³ &B8F7 ³ 1 ³ DEG/RAD flag (&00=RAD; &FF=DEG) &B114 ³ &B8DC ³ 1 ³ &B115 ³ &B8DD ³ 1 ³ &B116 ³ &B8DE ³ 1 ³ &B117 ³ &B8DF ³ 1 ³ ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B118 ³ &B800 ³ &D2 ³ Area used for Cassette handling: &B118 ³ &B800 ³ 1 ³ cassette handling messages flag ³ ³ ³ (0=enabled; <>O=disabled) &B119 ³ &B801 ³ 1 ³ &B11A ³ &B802 ³ 1 ³ file IN flag (&00=closed; &02=IN file; ³ ³ ³ &03=opened; &05=IN char) &B11B ³ &B803 ³ 2 ³ address of 2K buffer for directories &B11D ³ &B805 ³ 2 ³ address of 2K buffer for loading blocks of ³ ³ ³ files - often as &B11B 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B11F ³ &B807 ³ &40 ³ IN Channel header &B11F ³ &B807 ³ &10 ³ filename (padded with NULs) &B12F ³ &B817 ³ 1 ³ number of block being loaded, or next to ³ ³ ³ be loaded &B130 ³ &B818 ³ 1 ³ last block flag (&FF=last block; &00=not) &B131 ³ &B819 ³ 1 ³ file type (&00=BASIC; &01=Protected BASIC; ³ ³ ³ &02=Binary; &08=Screen; &16=ASCII) &B132 ³ &B81A ³ 2 ³ length of this block &B134 ³ &B81C ³ 2 ³ address to load this or the next block ³ ³ ³ at,or the address of the byte after last ³ ³ ³ one loaded &B136 ³ &B81E ³ 1 ³ first block flag (&FF=first block; ³ ³ ³ &00=not) &B137 ³ &B81F ³ 2 ³ total length of file (all blocks) &B139 ³ &B821 ³ 2 ³ execution address for BIN files (&0000 if ³ ³ ³ not saved as such) &B13B ³ &B823 ³ &24 ³ not allocated ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B15F ³ &B847 ³ 1 ³ file OUT flag (&00=closed; &02=IN file; ³ ³ ³ &03=opened; &05=IN char) &B160 ³ &B848 ³ 2 ³ address to start the next block save from, ³ ³ ³ or the address of the buffer if it is ³ ³ ³ OPENOUT &B162 ³ &B84A ³ 2 ³ address of start of the last block saved, ³ ³ ³ or the address of the buffer if it is ³ ³ ³ OPENOUT ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B164 ³ &B84C ³ &40 ³ OUT Channel Header (details as IN Channel ³ ³ ³ Header): &B164 ³ &B84C ³ &10 ³ filename &B174 ³ &B85C ³ 1 ³ number of the block being saved, or next ³ ³ ³ to be saved &B175 ³ &B85D ³ 1 ³ last block flag (&FF=last block; &00=not) &B176 ³ &B85E ³ 1 ³ file type (as at &B131 &B177 ³ &B85F ³ 2 ³ length saved so far &B179 ³ &B861 ³ 2 ³ address of start of area to save, or ³ ³ ³ address of buffer if it is an OPENOUT ³ ³ ³ instruction &B17B ³ &B863 ³ 1 ³ first block flag (&FF=first block; ³ ³ ³ &00=not) &B17C ³ &B864 ³ 2 ³ total length of file to be saved &B17E ³ &B866 ³ 2 ³ execution address for BIN files (&0000 if ³ ³ ³ parameter not supplied) &B180 ³ &B868 ³ &24 ³ not allocated &B1A4 ³ &B88C ³ &40 ³ used to construct IN Channel header: &B1B5 ³ &B89D ³ 1 ³ &B1B7 ³ &B89F ³ 2 ³ &B1B8 ³ &B8A3 ³ 1 ³ &B1BE ³ &B8A6 ³ 1 ³ ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B1B9 ³ &B51D ³ ³ base address for calculating relevant ³ ³ ³ Sound Channel block &B1BC ³ &B520 ³ ³ base address for calculating relevant ³ ³ ³ Sound Channel ? &B1BE ³ &B522 ³ ³ base address for calculating relevant ³ ³ ³ Sound Channel ? &B1D5 ³ &B539 ³ ³ base address for calculating relevant ³ ³ ³ Sound Channel ? &B1E4 ³ &B8CC ³ 1 ³ 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B1E5 ³ &B8CD ³ 1 ³ synchronisation byte &B1E6 ³ &B8CE ³ 2 ³ &55, &62 &B1E8 ³ &B8D0 ³ 1 ³ &B1E9 ³ &B8D1 ³ 1 ³ cassette precompensation (default &06; ³ ³ ³ SPEED WRITE 1 &0C @4ęs) &B1EA ³ &B8D2 ³ 1 ³ cassette 'Half a Zero' duration (default ³ ³ ³ &53; SPEED WRITE 1 &29 @ 4ęS) &B1EB ³ &B8D3 ³ 2 ³ ³ &B550 ³ 1 ³ used by sound routines ³ &B551 ³ 1 ³ used by sound routines &B1ED ³ ³ 1 ³ used by sound routines &B1EE ³ &B552 ³ 1 ³ used by sound routines &B1F0 ³ &BB54 ³ 1 ³ used by sound routines ³ &BB55 ³ 7 ³ used by sound and cassette routines ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B1F8 ³ &B55C ³ &3F ³ Sound Channel A (1) data: &B212 ³ &B576 ³ 1 ³ number of sounds still queuing &B213 ³ &B577 ³ 1 ³ number of sounds originally queuing &B217 ³ &B57B ³ 8 ³ first or fifth sound in Channel 1 (A) ³ ³ ³ queue: &B217 ³ &B57B ³ 1 ³ status: b0 to b2 = rendezvous with channel ³ ³ ³ 1, 2 or 4; b3 = Hold; b4 = Flush &B218 ³ &B57C ³ 1 ³ b0 to b3 = tone envelope number; ³ ³ ³ b4 to b7 = volume envelope number (ie ³ ³ ³ ENV nurnber*16) &B219 ³ &B57D ³ 2 ³ pitch &B21B ³ &B57F ³ 1 ³ noise &B21C ³ &B580 ³ 1 ³ volume &B21D ³ &B581 ³ 2 ³ duration (in 0.01 seconds) &B21F ³ &B583 ³ 8 ³ second sound in Channel 1 queue (as &B217) &B227 ³ &B58B ³ 8 ³ third sound in Channel 1 queue (as &B217) &B22F ³ &B593 ³ 8 ³ fourth sound in Channel 1 queue (as &B217) ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B237 ³ &B59B ³ &3F ³ Sound Channel B (2) data - as described at ³ ³ ³ &B1F8 &B256 ³ &B5BA ³ 8 ³ first or fifth sound in Channel 2 queue ³ ³ ³ (as &B217) &B25E ³ &B5C2 ³ 8 ³ second sound in Channel 2 queue (as &B217) &B266 ³ &B5CA ³ 8 ³ third sound in Channel 2 queue (as &B217) &B26E ³ &B5D2 ³ 8 ³ fourth sound in Channel 2 queue (as &B217) ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B276 ³ &B5DA ³ &3F ³ Sound Channel C (4) data - as described at ³ ³ ³ &B1F8 &B295 ³ &B5F9 ³ 8 ³ first or fifth sound in Channel 4 queue ³ ³ ³ (as &B217) &B29D ³ &B601 ³ 8 ³ 2nd sound in Channel 4 queue (as &B217) &B2A5 ³ &B609 ³ 8 ³ 3rd sound in Channel 4 queue (as &B217) &B2AD ³ &B611 ³ 8 ³ 4th sound in Channel 4 queue (as &B217) 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B2A6 ³ &B60A ³ ³ base address for calculating relevant ENV ³ ³ ³ parameter block &B2B6 ³ &B61A ³ 15*16³ ENV parameter block area (each arranged as ³ ³ ³ &ADA2): &B2B6 ³ &B61A ³ &10 ³ ENV 1 &B2C6 ³ &B62A ³ &10 ³ ENV 2 &B2D6 ³ &B63A ³ &10 ³ ENV 3 &B2E6 ³ &B64A ³ &10 ³ ENV 4 &B2F6 ³ &B65A ³ &10 ³ ENV 5 &B306 ³ &B66A ³ &10 ³ ENV 6 &B316 ³ &B67A ³ &10 ³ ENV 7 &B326 ³ &B68A ³ &10 ³ ENV 8 &B336 ³ &B69A ³ &10 ³ ENV 9 &B346 ³ &B6AA ³ &10 ³ ENV 10 &B356 ³ &B6BA ³ &10 ³ ENV 11 &B366 ³ &B6CA ³ &10 ³ ENV 12 &B376 ³ &B6DA ³ &10 ³ ENV 13 &B386 ³ &B6EA ³ &10 ³ ENV 14 &B396 ³ &B6FA ³ &10 ³ ENV 15 ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B396 ³ &B6FA ³ ³ base address for calculating relevant ENT ³ ³ ³ parameter block &B3A6 ³ &B70A ³ 15*16³ ENT parameter block area (each arranged as ³ ³ ³ &ADA2): &B3A6 ³ &B70A ³ &10 ³ ENT 1 &B3B6 ³ &B71A ³ &10 ³ ENT 2 &B3C6 ³ &B72A ³ &10 ³ ENT 3 &B3D6 ³ &B73A ³ &10 ³ ENT 4 &B3E6 ³ &B74A ³ &10 ³ ENT 5 &B3F6 ³ &B75A ³ &10 ³ ENT 6 &B406 ³ &B76A ³ &10 ³ ENT 7 &B416 ³ &B77A ³ &10 ³ ENT 8 &B426 ³ &B78A ³ &10 ³ ENT 9 &B436 ³ &B79A ³ &10 ³ ENT 10 &B446 ³ &B7AA ³ &10 ³ ENT 11 &B456 ³ &B7BA ³ &10 ³ ENT 12 &B466 ³ &B7CA ³ &10 ³ ENT 13 &B476 ³ &B7DA ³ &10 ³ ENT 14 &B486 ³ &B7EA ³ &10 ³ ENT 15 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B496 ³ &B34C ³ &50 ³ Normal Key Table: ³ ³ ³ Cur U Cur R Cur D f9 f6 f3 Enter f. ³ ³ ³ Cur L 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 ³ &B39C ³ &50 ³ Shifted Key Table: ³ ³ ³ Cur U Cur R Cur D f9 f6 f3 Enter f. ³ ³ ³ Cur L 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 ³ &B3EC ³ &50 ³ Control Key Table: ³ ³ ³ Cur U Cur R Cur D f9 f6 f3 Enter f. ³ ³ ³ Cur L 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 (SOH) S-lck (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) 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &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 U Cur R Cur D f9 f6 f3 Enter f. &B636 ³ &B4EC ³ 1 ³ Cur L Copy f7 f8 f5 f1 f2 f0 &B637 ³ &B4ED ³ 1 ³ Clr [ Ret ] f4 Shift \ Ctrl &B638 ³ &B4EE ³ 1 ³ ^ - @ p ; : / . &B639 ³ &B4EF ³ 1 ³ 0 9 o i l k m j &B63A ³ &B4F0 ³ 1 ³ 8 7 u y h j n Space &B63B ³ &B4F1 ³ 1 ³ Down Up Left Right Fire2 Fire1 (Joystick 1) &B63B ³ &B4F1 ³ 1 ³ 6 5 r t g f b v &B63C ³ &B4F2 ³ 1 ³ 4 3 e w s d c x &B63D ³ &B4F3 ³ 1 ³ 1 2 Esc q Tab a Caps z &B63E ³ &B4F4 ³ 1 ³ Down Up Left Right Fire2 Fire1 (Joystick 2) &B63E ³ &B4F4 ³ 1 ³ Del ³ ³ ³ &B63F ³ &B4F5 ³ 1 ³ complement of &B635 &B640 ³ &B4F6 ³ 1 ³ complement of &B636 &B641 ³ &B4F7 ³ 1 ³ complement of &B637 &B642 ³ &B4F8 ³ 1 ³ complement of &B638 &B643 ³ &B4F9 ³ 1 ³ complement of &B639 &B644 ³ &B4FA ³ 1 ³ complement of &B63A &B645 ³ &B4FB ³ 1 ³ complement of &B63B &B646 ³ &B4FC ³ 1 ³ complement of &B63C &B647 ³ &B4FD ³ 1 ³ complement of &B63D &B648 ³ &B4FE ³ 1 ³ complement of &B63E ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B64B ³ &B501 ³ ³ &B653 ³ &B509 ³ 1 ³ &B654 ³ &B5OA ³ 1 ³ &B655 ³ &B50B ³ 1 ³ &B656 ³ &B50C ³ 1 ³ &B657 ³ &B50D ³ 7 ³ event block for Keyboard handling, ³ ³ ³ comprises: &B657 ³ &B50D ³ 2 ³ chain address &B659 ³ &B50F ³ 1 ³ count &B65A ³ &B510 ³ 1 ³ class: express event &B65B ³ &B511 ³ 2 ³ ROM routine address: &C492 &B65D ³ &B513 ³ 1 ³ ROM select number: &FD &B65E ³ &B514 ³ 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' column ³ ³ ³ number - see &B496 etc &B67F ³ &B67F ³ 2 ³ vestige from the 464? &B686 ³ &B53C ³ 1 ³ &B687 ³ &B53D ³ 1 ³ accumulated count of the number of keys ³ ³ ³ pressed (MOD 20) &B688 ³ &B53E ³ 1 ³ number of keys left in key buffer &B689 ³ &B53F ³ 1 ³ accumulated count of the number of keys ³ ³ ³ removed from the buffer (MOD 20) &B68A ³ &B540 ³ 1 ³ &B68B ³ &B541 ³ 2 ³ address of the normal key table &B68D ³ &B543 ³ 2 ³ address of the shifted key table &B68F ³ &B545 ³ 2 ³ address of the control key table &B691 ³ &B547 ³ 2 ³ address of the KB repeats table 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B692 ³ ³ 1 ³ &B693 ³ &B328 ³ 2 ³ ORIGIN x &B695 ³ &B32A ³ 2 ³ ORIGIN y &B697 ³ &B32C ³ 2 ³ graphics text x position (pixel) &B699 ³ &B32E ³ 2 ³ graphics text y position(pixel) &B69B ³ &B330 ³ 2 ³ graphics window x of one edge (pixel) &B69D ³ &B332 ³ 2 ³ graphics window x of other edge (pixel) &B69F ³ &B334 ³ 2 ³ graphics window y of one side (pixel) &B6A1 ³ &B336 ³ 2 ³ graphics window y of other side (pixel) &B6A3 ³ &B338 ³ 1 ³ GRAPHICS PEN &B6A4 ³ &B339 ³ 1 ³ GRAPHICS PAPER ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B6A5 ³ &B33A ³ 8/14 ³ (This area is 14 bytes on the 464) Used by ³ ³ ³ line drawing (and other) routines, as ³ ³ ³ follows: &B6A7 ³ &B33A ³ 2 ³ x+1() &B6A9 ³ &B33C ³ 2 ³ y/2+1() &B6AB ³ &B33E ³ 2 ³ y/2-x() &B6AD ³ &B340 ³ 2 ³ ³ &B342 ³ 2 ³ &B6AF ³ &B344 ³ 1 ³ &B6B0 ³ &B345 ³ 1 ³ &B6B1 ³ &B346 ³ 1 ³ &B6B2 ³ ³ 1 ³ first point on drawn line flag (<>0=to be ³ ³ ³ plotted; 0=don't plot) &B6B3 ³ ³ 1 ³ line MASK &B6B4 ³ ³ 1 ³ ³ &B207 ³ 2 ³ &B6B5 ³ &B20C ³ 1 ³ current stream number ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B6B6 ³ &B20D ³ 14/15³ (These areas are 15 bytes on the 464) ³ ³ ³ Stream (window) 0 parameter block. ³ ³ ³ These areas are arranged as &B726 &B6C4 ³ &B21C ³ 14/15³ stream (window) 1 parameter block &B6D2 ³ &B22B ³ 14/15³ stream (window) 2 parameter block &B6E0 ³ &B23A ³ 14/15³ stream (window) 3 parameter block &B6EE ³ &B249 ³ 14/15³ stream (window) 4 parameter block &B6FC ³ &B258 ³ 14/15³ stream (window) 5 parameter block &B70A ³ &B267 ³ 14/15³ stream (window) 6 parameter block &B718 ³ &B276 ³ 14/15³ stream (window) 7 parameter block 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B726 ³ &B285 ³ 14/15³ Current Stream (Window) parameter block: &B726 ³ &B285 ³ 1 ³ cursor y position (line) with respect to ³ ³ ³ the whole screen (starting from 0) &B727 ³ &B286 ³ 1 ³ cursor x position (column) with respect to ³ ³ ³ the whole screen (starting from 0) &B728 ³ &B287 ³ ³ &B729 ³ &B288 ³ 1 ³ window top line (y) with respect to the ³ ³ ³ whole screen (starting from 0) &B72A ³ &B289 ³ 1 ³ window left column (x) with respect to the ³ ³ ³ whole screen (starting from 0) &B72B ³ &B28A ³ 1 ³ window bottom line (y) with respect to the ³ ³ ³ whole screen (starting from 0) &B72C ³ &B28B ³ 1 ³ window right colwnn (x) with respect to ³ ³ ³ the whole screen (starting from 0) &B72D ³ &B28C ³ 1 ³ scroll count &B72E ³ &B28D ³ 1 ³ cursor flag (&01=disable; &02=off; &FD=on; ³ ³ ³ &FE=enable) ³ &B28E ³ 1 ³ &B72F ³ &B28F ³ 1 ³ current PEN number (encoded, not its INK ³ ³ ³ number) &B730 ³ &B290 ³ 1 ³ current PAPER number (encoded, not its INK ³ ³ ³ number) &B731 ³ &B291 ³ 2 ³ address of text background routine: ³ ³ ³ opaque=&1392; transparent=&13A0 &B733 ³ &B293 ³ 1 ³ graphics character writing flag (0=off; ³ ³ ³ <>0=on) &B734 ³ &B294 ³ 1 ³ ASCII number of the first character in ³ ³ ³ User Defined Graphic (UDG) matrix table &B735 ³ &B295 ³ 1 ³ UDG matrix table flag (&00=non-existent; ³ ³ ³ &FF=present) &B736 ³ &B296 ³ 2 ³ address of UDG matrix table &B738 ³ &B298 ³ 2 ³ &B758 ³ &B2B8 ³ 1 ³ &B759 ³ &B2B9 ³ 1 ³ 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B763 ³ &B2C3 ³ 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 ³ &B2C3 ³ 3 ³ ASC 0: &80,&1513: NUL &B766 ³ &B2C6 ³ 3 ³ ASC 1: &81,&1335: Print control code ³ ³ ³ chararacter [,char] &B769 ³ &B2C9 ³ 3 ³ ASC 2: &80,&1297: Disable cursor &B76C ³ &B2CC ³ 3 ³ ASC 3: &80,&1286: Enable cursor &B76F ³ &B2CF ³ 3 ³ ASC 4: &81,&0AE9: Set mode [,mode] &B772 ³ &B2D2 ³ 3 ³ ASC 5: &81,&1940: Print character using ³ ³ ³ graphics mode [,char] &B775 ³ &B2D5 ³ 3 ³ ASC 6: &00,&1459: Enable VDU &B778 ³ &B2D8 ³ 3 ³ ASC 7: &80,&14E1: Beep &B77B ³ &B2DB ³ 3 ³ ASC 8: &80,&1519: Back-space &B77E ³ &B2DE ³ 3 ³ ASC 9: &80,&151E: Step-right &B781 ³ &B2E1 ³ 3 ³ ASC 10: &80,&1523: Linefeed &B784 ³ &B2E4 ³ 3 ³ ASC 11: &80,&1528: Previous line &B787 ³ &B2E7 ³ 3 ³ ASC 12: &80,&154F: Clear window and locate ³ ³ ³ the cursor at position 1,1 &B78A ³ &B2EA ³ 3 ³ ASC 13: &80,&153F: RETURN &B78D ³ &B2ED ³ 3 ³ ASC 14: &81,&12AB: Set paper [,pen] &B790 ³ &B2F0 ³ 3 ³ ASC 15: &81,&12A6: Set pen [,pen] &B793 ³ &B2F3 ³ 3 ³ ASC 16: &80,&155E: Delete the character at ³ ³ ³ the cursor position &B796 ³ &B2F6 ³ 3 ³ ASC 17: &80,&1599: Clear the line up to ³ ³ ³ the current cursor position &B799 ³ &B2F9 ³ 3 ³ ASC 18: &80,&158F: Clear from the cursor ³ ³ ³ position to the end of the line &B79C ³ &B2FC ³ 3 ³ ASC 19: &80,&1578: Clear from start of the ³ ³ ³ window to the cursor position &B79F ³ &B2FF ³ 3 ³ ASC 20: &80,&1565: Clear from the cursor ³ ³ ³ position to the end of a window &B7A2 ³ &B302 ³ 3 ³ ASC 21: &80,&1452: Disable VDU &B7A5 ³ &B305 ³ 3 ³ ASC 22: &81,&14EC: Set text write mode ³ ³ ³ [,mode] &B7A8 ³ &B308 ³ 3 ³ ASC 23: &81,&0C55: Set graphics draw mode ³ ³ ³ [,mode] &B7AB ³ &B30B ³ 3 ³ ASC 24: &80,&12C6: Exchange pen and paper &B7AE ³ &B30E ³ 3 ³ ASC 25: &89,&150D: Define user defined ³ ³ ³ character [,char,8 rows of char] &B7B1 ³ &B311 ³ 3 ³ ASC 26: &84,&1501: Define window ³ ³ ³ [,left,right,top,bottom] &B7B4 ³ &B314 ³ 3 ³ ASC 27: &00,&14EB: ESC (=user) &B7B7 ³ &B317 ³ 3 ³ ASC 28: &83,&14F1: Set the pen inks ³ ³ ³ [,pen,ink 1,ink 2] &B7BA ³ &B31A ³ 3 ³ ASC 29: &82,&14FA: Set border colours ³ ³ ³ [,ink,ink2] &B7BD ³ &B31D ³ 3 ³ ASC 30: &80,&1539: Locate the text cursor ³ ³ ³ at position 1,1 &B7C0 ³ &B320 ³ 3 ³ ASC 31: &82,&1547: Locate the text cursor ³ ³ ³ at [,column,line] 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B7C3 ³ &B1C8 ³ 1 ³ MODE number &B7C4 ³ &B1C9 ³ 2 ³ screen offset &B7C6 ³ &B1CB ³ 1 ³ screen base HB (LB taken as &00) &B7C7 ³ &B1CC ³ 3 ³ graphics VDU write mode indirection - ³ ³ ³ JP &0C74 ³ &B1CF ³ 8 ³ list of bytes having only one bit set, ³ ³ ³ from b7 down to b0 &B7D2 ³ &B1D7 ³ 1 ³ first flash period (SPEED INK - default ³ ³ ³ &0A @ 0.02 seconds) &B7D3 ³ &B1D8 ³ 1 ³ second flash period (SPEED INK - default ³ ³ ³ &0A @ 0.02 seconds) ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B7D4 ³ &B1D9 ³ 1+16 ³ Border and Pens' First Inks (as hardware ³ ³ ³ numbers): &B7D4 ³ &B1D9 ³ 1 ³ hw &04 = sw 1 (blue) border &B7D5 ³ &B1DA ³ 1 ³ hw &04 = sw 1 (blue) pen 0 &B7D6 ³ &B1DB ³ 1 ³ hw &0A = sw 24 (bright yellow) pen 1 &B7D7 ³ &B1DC ³ 1 ³ hw &13 = sw 20 (bright cyan) pen 2 &B7D8 ³ &B1DD ³ 1 ³ hw &0C = sw 6 (bright red) pen 3 &B7D9 ³ &B1DE ³ 1 ³ hw &0B = sw 26 (bright white) pen 4 &B7DA ³ &B1DF ³ 1 ³ hw &14 = sw 0 (black) pen 5 &B7DB ³ &B1E0 ³ 1 ³ hw &15 = sw 2 (bright blue) pen 6 &B7DC ³ &B1E1 ³ 1 ³ hw &0D = sw 8 (bright magenta) pen 7 &B7DD ³ &B1E2 ³ 1 ³ hw &06 = sw 10 (cyan) pen 8 &B7DE ³ &B1E3 ³ 1 ³ hw &1E = sw 12 (yellow) pen 9 &B7DF ³ &B1E4 ³ 1 ³ hw &1F = sw 14 (pale blue) pen 10 &B7E0 ³ &B1E5 ³ 1 ³ hw &07 = sw 16 (pink) pen 11 &B7E1 ³ &B1E6 ³ 1 ³ hw &12 = sw 18 (bright green) pen 12 &B7E2 ³ &B1E7 ³ 1 ³ hw &19 = sw 22 (pale green) pen 13 &B7E3 ³ &B1E8 ³ 1 ³ hw &04 = sw 1 (blue) pen 14 &B7E4 ³ &B1E9 ³ 1 ³ hw &17 = sw 11 (sky blue) pen 15 ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B7E5 ³ &B1EA ³ 1+16 ³ Border and Pens' Second Inks (as hardware ³ ³ ³ numbers): &B7E5 ³ &B1EA ³ 1 ³ hw &04 = sw 1 (blue) border &B7E6 ³ &B1EB ³ 1 ³ hw &04 = sw 1 (blue) pen 0 &B7E7 ³ &B1EC ³ 1 ³ hw &0A = sw 24 (bright yellow) pen 1 &B7E8 ³ &B1ED ³ 1 ³ hw &13 = sw 20 (bright cyan) pen 2 &B7E9 ³ &B1EE ³ 1 ³ hw &0C = sw 6 (bright red) pen 3 &B7EA ³ &B1FF ³ 1 ³ hw &0B = sw 26 (bright white) pen 4 &B7EB ³ &B1F0 ³ 1 ³ hw &14 = sw 0 (black) pen 5 &B7EC ³ &B1F1 ³ 1 ³ hw &15 = sw 2 (bright blue) pen 6 &B7ED ³ &B1F2 ³ 1 ³ hw &0D = sw 8 (bright magenta) pen 7 &B7EE ³ &B1F3 ³ 1 ³ hw &06 = sw 10 (cyan) pen 8 &B7EF ³ &B1F4 ³ 1 ³ hw &1E = sw 12 (yellow) pen 9 &B7F0 ³ &B1F5 ³ 1 ³ hw &1F = sw 14 (pale blue) pen 10 &B7F1 ³ &B1F6 ³ 1 ³ hw &07 = sw 16 (pink) pen 11 &B7F2 ³ &B1F7 ³ 1 ³ hw &12 = sw 18 (bright green) pen 12 &B7F3 ³ &B1F8 ³ 1 ³ hw &19 = sw 22 (pale green) pen 13 &B7F4 ³ &B1F9 ³ 1 ³ hw &04 = sw 1 (bright yellow) pen 14 &B7F5 ³ &B1FA ³ 1 ³ hw &17 = sw 11 (pink) pen 15 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B7F6 ³ &B1FB ³ 1 ³ &B7F7 ³ &B1FC ³ 1 ³ &B7F8 ³ &B1FD ³ 1 ³ &B7F9 ³ &BlFE ³ 2 ³ &B7FB ³ &B200 ³ 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: pnnter 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 ³ &B100 ³ 1 ³ &B82E ³ &B101 ³ 1 ³ &B82F ³ &B102 ³ 2 ³ &B831 ³ &B104 ³ 1 ³ &B832 ³ &B105 ³ 2 ³ temporary store for stack pointer (SP) ³ ³ ³ during interrupt handling &B834 ³ &B107 ³ &70 ³ temporary machine stack (from &B8B3 ³ ³ ³ downwards) during interrupt handling &B8B4 ³ &B187 ³ 4 ³ TIME (stored with the LB first - four ³ ³ ³ bytes give >166 days; three bytes give ³ ³ ³ >15 hours) &B8B8 ³ &B18B ³ 1 ³ &B8B9 ³ &B18C ³ 2 ³ &B8BB ³ &B18E ³ 2 ³ &B8BD ³ &B190 ³ 2 ³ address of the first ticker block in chain ³ ³ ³ (if any) &B8BF ³ &B192 ³ 1 ³ Keyboard scan flag (&00=scan not needed; ³ ³ ³ &01=scan needed) &B8C0 ³ &B193 ³ 2 ³ address of the first event block in chain ³ ³ ³ (if any) &B8C2 ³ &B195 ³ 1 ³ &B8C3 ³ &B196 ³ &10 ³ buffer for last RSX or RSX command name ³ ³ ³ (last character has bit 7 set) &B8D3 ³ &B1A6 ³ 2 ³ address of first ROM or RSX chaining block ³ ³ ³ in chain &B8D5 ³ ³ 1 ³ RAM bank number &B8D6 ³ &B1A8 ³ 1 ³ Upper ROM status (eg select number) &B8D7 ³ &B1A9 ³ 2 ³ entry point of foreground ROM in use (eg ³ ³ ³ &C006 for BASIC ROM) &B8D9 ³ &B1AB ³ 1 ³ foreground ROM select address (0 for the ³ ³ ³ BASIC ROM) 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B8DA ³ ³ 16*2 ³ ROM entry IY value (ie the address table) ³ ³ ³ - the 6128 has ROMs numbered from 0 to ³ ³ ³ 15: ³ &B1AC ³ 7*2 ³ ROM entry IY value (ie the address table) ³ ³ ³ -the 464 has ROMs 1 to 7 only: &B8DA ³ ³ 2 ³ ROM 0 IY (not for the 464) &B8DC ³ &B1AC ³ 2 ³ ROM 1 IY &B8DE ³ &B1AE ³ 2 ³ ROM 2 IY &B8E0 ³ &B1B0 ³ 2 ³ ROM 3 IY &B8E2 ³ &B1B2 ³ 2 ³ ROM 4 IY &B8E4 ³ &B1B4 ³ 2 ³ ROM 5 IY &B8E6 ³ &B1B6 ³ 2 ³ ROM 6 IY &B8E8 ³ &B1B8 ³ 2 ³ ROM 7 IY (usually &A700 for AMSDOS/CPM ³ ³ ³ ROM) &B8EA ³ ³ 2 ³ ROM 8 IY (not 464) &B8EC ³ ³ 2 ³ ROM 9 IY (not 464) &B8EE ³ ³ 2 ³ ROM 10 IY (not 464) &B8F0 ³ ³ 2 ³ ROM 11 IY (not 464) &B8F2 ³ ³ 2 ³ ROM 12 IY (not 464) &B8F4 ³ ³ 2 ³ ROM 13 IY (not 464) &B8F6 ³ ³ 2 ³ ROM 14 IY (not 464) &B8F8 ³ ³ 2 ³ ROM 15 IY (not 464) &B8FA ³ ³ 6 ³ 6 bytes of &FF ³ &B1BA ³ 14 ³ 14 bytes of &00 ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &B900 ³ &B900 ³ 12*3 ³ High Kernel Jumpblock (on the 464 this ³ ³ ³ block is 11*3 bytes in size) &B924 ³ &B921 ³ &1C0 ³ routines used by the High Kernel ³ ³ ³ Jumpblock (on the 464 this is &1C8 bytes ³ ³ ³ in size) &BAE4 ³ &BAE9 ³ ³ bytes of &FF (&1C bytes on 6128, &17 bytes ³ ³ ³ on 464) &BB00 ³ &BB00 ³ 26*3 ³ Key Manager Jumpblock &BB4E ³ &BB4E ³ 36*3 ³ Text VDU Jumpblock &BBBA ³ &BBBA ³ 23*3 ³ Graphics VDU Jumpblock &BBFF ³ &BBFF ³ 34*3 ³ Screen Pack Jumpblock &BC65 ³ &BC65 ³ 22*3 ³ Cassette (and Disc if fitted) Manager ³ ³ ³ Jumpblock &BCA7 ³ &BCA7 ³ 11*3 ³ Sound Manager Jumpblock &BCC8 ³ &BCC8 ³ 25*3 ³ Kernel Jumpblock &BD13 ³ &BD13 ³ 26*3 ³ Machine Pack Jumpblock (on the 464 this ³ ³ ³ block is 14*3 bytes in size) &BD61 ³ &BD3D ³ 32*3 ³ Maths Jumpblock (on the 464 this block is ³ ³ ³ 48*3 bytes in size) &BDCD ³ &BDCD ³ 14*3 ³ Firmware Indirections (on the 464 this ³ ³ ³ block is 13*3 bytes in size &BDF7 ³ &BDF4 ³ ³ bytes of &00 (&09 bytes on 6128, &0C bytes ³ ³ ³ on the 464) the lower limit of Machine ³ ³ ³ Stack if no Disc Drive &BE00 ³ &BE00 ³ &40 ³ &40 bytes of &FF 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &BE40 ³ &BE40 ³ &4x ³ used by the AMSDOS ROM if a disc drive is ³ ³ ³ fitted (otherwise &4x bytes of &FF) &BE40 ³ &BE40 ³ 2 ³ (address &A910) &BE42 ³ &BE42 ³ 2 ³ address of drive A XDPB &BE44 ³ &BE44 ³ 9 ³ Disc Set Up timing block: &BE44 ³ &BE44 ³ 2 ³ motor on period (default &0032; fastest ³ ³ ³ &0023 @ 20mS) &BE46 ³ &BE46 ³ 2 ³ motor off period (default &00FA; fastest ³ ³ ³ &00C8 @ 20mS) &BE48 ³ &BE48 ³ 1 ³ write current off period (default &AF ³ ³ ³ @ 10ęS) &BE49 ³ &BE49 ³ 1 ³ head settle time (default &0F @ 1mS) &BE4A ³ &BE4A ³ 1 ³ step rate period (default &0C; fastest &0A ³ ³ ³ @ 1mS) &BE4B ³ &BE4B ³ 1 ³ head unload delay (default &01) &BE4C ³ &BE4C ³ 1 ³ b0=non DMA mode; b1 to b7=head load delay ³ ³ ³ (default &03) &BE4D ³ &BE4D ³ 2 ³ &BE4F ³ &BE4F ³ 1 ³ Drive Header Information Block: &BE4F ³ &BE4F ³ 1 ³ last track used &BE50 ³ &BE50 ³ 1 ³ head number (&00) &BE51 ³ &BE51 ³ 1 ³ last sector used &BE52 ³ &BE52 ³ 1 ³ log2(sector size)-7 &BE53 ³ &BE53 ³ 1 ³ &BE54 ³ &BE54 ³ 1 ³ &BE55 ³ &BE55 ³ 1 ³ &BE56 ³ &BE56 ³ 1 ³ &BE58 ³ &BE58 ³ 1 ³ &BE59 ³ &BE59 ³ 1 ³ &BE5D ³ &BE5D ³ 1 ³ &BE5E ³ &BE5E ³ 1 ³ &BE5F ³ &BE5F ³ 1 ³ disc motor flag (&00=off;&01=on ³ ³ ³ - strangely reversed) &BE60 ³ &BE60 ³ 2 ³ address of buffer for directory entries ³ ³ ³ block (&A930) &BE62 ³ &BE62 ³ 2 ³ as &BE76 (ie&A9B0) &BE64 ³ &BE64 ³ 2 ³ &BE66 ³ &BE66 ³ 1 ³ disc retries (default &10) 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &BE67 ³ &BE67 ³ &11 ³ AMSDOS Ticker and Event Block: &BE67 ³ &BE67 ³ 2 ³ ticker chaining address &BE69 ³ &BE69 ³ 2 ³ tick count &BE6B ³ &BE6B ³ 2 ³ recharge count &BE6D ³ &BE6D ³ 2 ³ event chaining address &BE6F ³ &BE6F ³ 1 ³ count &BE70 ³ &BE70 ³ 1 ³ class (asynchronous event) &BE71 ³ &BE71 ³ 2 ³ ROM routine address (&C9D6) &BE73 ³ &BE73 ³ 1 ³ ROM select number (&07 ie the AMSDOS/CPM ³ ³ ³ ROM) &BE74 ³ &BE74 ³ 1 ³ last sector number used &BE75 ³ &BE75 ³ 1 ³ &BE76 ³ &BE76 ³ 2 ³ address of «K buffer, or of header info ³ ³ ³ block (for WRlTE SECTOR etc) &BE78 ³ &BE78 ³ 1 ³ disc error message flag (&00=on; &FF=off ³ ³ ³ - reversed again) &BE7D ³ &BE7D ³ 2 ³ address of AMSDOS reserved area (&A700) &BE7F ³ &BE7F ³ x ³ area used by AMSDOS to copy routines into ³ ³ ³ RAM for running &BE80 ³ &BE80 ³ &80 ³ &80 bytes of &FF (limit of machine stack ³ ³ ³ if disc drive fitted) &BF00 ³ &BF00 ³ xy ³ &xy bytes of &00) &BFxy ³ ³ ³ machine stack (in theory this stack could ³ ³ ³ extend down much further) &BFFF ³ &BFFF ³ ³ upper limit of machine stack The area from &C000 to &FFFF is taken up by the screen memory - the layout of which is illustrated on the next page. 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) (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 41east signifcant bits hold bit 0 of the pen value. 6128 ³ 464 ³ Size ³ Comments on the memory locations ÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &C000 &C000 &4000 normal (upper) screen area. The alternative (lower) screen area is from &4000 to &7FFF. The addresses of the starts of lines and rows in the normal screen area after a MODE instruction are: LINE R0W0 R0W1 R0W2 R0W3 R0W4 R0W5 R0W6 R0W7 1 C000 C800 D000 D800 E000 E800 F000 F800 2 C050 C850 D050 D850 E050 E850 F050 F850 3 C0A0 C8A0 D0A0 D8A0 E0A0 E8A0 F0A0 F8A0 4 C0F0 C8F0 D0F0 D8F0 E0F0 E8F0 F0F0 F8F0 5 C140 C940 D140 D940 E140 E940 F140 F940 6 C190 C990 D190 D990 E190 E990 F190 F990 7 C1E0 C9E0 D1E0 D9E0 E1E0 E9E0 F1E0 F9E0 8 C230 CA30 D230 DA30 E230 EA30 F230 FA30 9 C280 CA80 D280 DA80 E280 EA80 F280 FA80 10 C2D0 CAD0 D2D0 DAD0 E2D0 EAD0 F2D0 FAD0 11 C320 CB20 D320 DB20 E320 EB20 F320 FB20 12 C370 CB70 D370 DB70 E370 EB70 F370 FB70 13 C3C0 CBC0 D3C0 DBC0 E3C0 EBC0 F3C0 FBC0 14 C410 CC10 D410 DC10 E410 EC10 F410 FC10 15 C460 CC60 D460 DC60 E460 EC60 F460 FC60 16 C4B0 CCB0 D4B0 DCB0 E4B0 ECB0 F4B0 FCB0 17 C500 CD00 D500 DD00 E500 ED00 F500 FD00 18 C550 CD50 D550 DD50 E550 ED50 F550 FD50 19 C5A0 CDA0 D5A0 DDA0 E5A0 EDA0 F5A0 FDA0 20 C5F0 CDF0 D5F0 DDF0 E5F0 ED50 F550 FD50 21 C640 CE40 D640 DE40 E640 EE40 F640 FE40 22 C690 CE90 D690 DE90 E690 EE90 F690 FE90 23 C6E0 CEE0 D6E0 DEE0 E6E0 EEE0 F6E0 FEE0 24 C730 CF30 D730 DF30 E730 EF30 F730 FF30 25 C780 CF80 D780 DF80 E780 EF80 F780 FF80 spare start C7D0 CFD0 D7D0 DFD0 E7D0 EFD0 F7D0 FFD0 spare end C7FF CFFF D7FF DFFF E7FF EFFF F7FF FFFF Once the whole screen has been scrolled in any direction, the above 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 1 or 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. FIRMWARE SUMMARY The Firmware Jumpblock 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 jumpblock is that the routines in the lower ROM are located at different positions on the different machines. The entries in the jumpblock, however, are all in the same place - the instructions in the jumpblock redirect the computer to the correct place in the lower ROM. Thus, providing a program uses the jumpblock, it should work on any CPC computer. By altering the firmware jumpblock 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 jumpblock'. It is worth noting that because BASIC uses the firmware jumpblock 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 jumpblock entry for SCR SET MODE is now patched so that it reroutes all calls to &BC0E away from the lower ROM and to our custom routine at &4000. This is done by changing the bytes at &BC0E, &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 jumpblock contains a small number of routines which are called by the rest of the firmware. By altering this jumpblock, 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 jumpblock. There are two jumpblocks which are to do with the Kemel (ie the high and low Kernel jumpblocks). The high jumpblock allows ROM states and interrupts to be altered, and also controls the introduction of RSXs. The low jumpblock contains general routines and restart instructions which are used by the computer for its own purposes. THE FIRMWARE IN DETAIL Low Kernel Jumpblock 000 &0000 RESET ENTRY (RST 0) Action: Resets the computer as if it has just been switched on Entry: No entry conditions Exit: This routine is never returned from Notes: After initialisation of the hardware and firmware, control is handed over to ROM 0 (usually BASIC) 001 &0008 LOW JUMP (RST 1) Action: Jumps to a routine in either the lower ROM or low RAM Entry: No entry conditions - all the registers are passed to the destination routine unchanged Exit: The registers are as set by the routine in the lower ROM or RAM or are returned unaltered Notes: The RST 1 instruction is followed by a two byte low address, which is defmed as follows: if bit 15 is set, then the upper ROM is disabled if bit 14 is set, then the lower ROM is disabled bits 13 to 0 contain the address of the routine to jump to This command is used by the majority of entries in the main firmware jumpblock 002 &000B KL LOW PCHL Action: Jumps to a routine in either the lower ROM or low RAM Entry: HL contains the low address - all the registers are passed to the destination routine unchanged Exit: The registers are as set by the routine in the lower ROM or RAM or are returned unaltered Notes: The two byte low address in the HL register pair is defined as follows: if bit 15 is set, then the upper ROM is disabled if bit 14 is set, then the lower ROM is disabled bits 13 to 0 contain the address of the routine to jump to 003 &000E PCBC INSTRUCTION Action: Jumps to the specified address Entry: BC contains the address to jump to - all the registers are passed to the destination routine unaltered Exit: The registers are as set by the destination routine or are returned unchanged 004 &0010 SIDE CALL (RST 2) Action: Calls a routine in ROM, in a group of up to four foreground ROMs Entry: No entry conditions - all the registers apart from IY are passed to the destination routine unaltered Exit: IY is corrupt, and the other registers are as set by the destination routine or are returned unchanged Notes: The RST 2 instruction is followed by a two byte side address, which is defined as follows: bits 14 and 15 give a number between 0 and 3, which is added to the main foreground ROM select address - this is then used as the ROM select address bits 0 to 13 contain the address to which is added &C000 - this gives the address of the routine to be called 005 &0013 KL SIDE PCHL Action: Calls a routine in another ROM Entry: HL contains the side address - all the registers apart from IY are passed to the destination routine unaltered Exit: IY is corrupt, and the other registers are as set by the destination routine or are returned unchanged Notes: The two byte side address is defined as follows: bits 14 and 15 give a number between 0 and 3, which is added to the main foreground ROM select address - this is then used as the ROM select address bits 0 to 13 contain the address to which is added &C000 - this gives the address of the routine to be called 006 &0016 PCDE INSTRUCTION Action: Jumps to the specified address Entry: DE contains the address to jump to - all the registers are passed to the destination routine unaltered Exit: The registers are as set by the destination routine or are returned unchanged 007 &0018 FAR CALL (RST 3) Action: Calls a routine anywhere in 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 Notes: The RST 3 instruction is followed by a two byte in-line address. At this address, there is a three byte far address, which is defined as follows: bytes 0 and 1 give the address of the routine to be called byte 2 is the ROM select byte which has values as follows: &00 to &FB-- select the given upper ROM, enable the upper ROM and disable the lower ROM &FC - no change to the ROM selection, enable the upper and lower ROMs &FD - no change to the ROM selection, enable the upper ROM and disable the lower ROM &FE - no change to the ROM selection, disable the upper ROM and enable the lower ROM &FF - no change to the ROM selection, disable the upper and lower ROMs When it is retumed from, the ROM selection and state are restored to their settings before the RST 3 command 008 &001B KL FAR PCHL Action: Calls a routine, given by the far address in HL & C, anywhere in RAM or ROM Entry: HL holds the address of the routine to be called, and C holds the ROM select byte - all the registers apart from IY are passed to the destination routine unaltered Exit: IY is preserved, and the other registers are as set by the destination routine or are returned unchanged Notes: See FAR CALL (RST 3) above for more details on the ROM select byte 009 &001E PCHL INSTRUCTION Action: Jumps to the specified address Entry: HL contains the address to jump to - all the registers are passed to the destination routine unaltered Exit: The registers are as set by the destination routine or are returned unchanged 010 &0020 RAM LAM Action: Puts the contents of a RAM memory location into the A register Entry: HL contains the address of the memory location Exit: A holds the contents of the memory location, and all other registers are preserved Notes: This routine always reads from RAM, even if the upper or lower ROM is enabled 011 &0023 KL FAR CALL Action: Calls a routine anywhere in RAM or ROM Entry: HL holds the address of the three byte far address that is to be used - all the registers apart from IY are passed to the destination routine unaltered Exit: IY is preserved, and the other registers are as set by the destination routine or are returned unchanged Notes: See FAR CALL above for more details on the three byte far address 012 &0028 FIRM JUMP (RST 5) Action: Jumps to a routine in either the lower ROM or the central 32K of RAM Entry: No entry conditions - all the registers are passed to the destination routine unchanged Exit: The registers are as set by the routine in the lower ROM or RAM or are returned unaltered Notes: The RST 5 instruction is followed by a two byte address, which is the address to jump to; before the jump is made, the lower ROM is enabled, and is disabled when the destination routine is returned from 013 &0030 USER RESTART (RST 6) Action: This is an RST instruction that may be set aside by the user for any purpose Entry: Defined by the user Exit: Defined by the user Notes: The bytes from &0030 to &0037 are available for the user to put their own code in if they wish 014 &0038 INTERRUPT ENTRY (RST 7) Action: Deals with normal interrupts Entry: No entry conditions Exit: All registers are preserved Notes: The RST 7 instruction must not be used by the user; any external interrupts that are generated by hardware on the expansion port will be dealt with by the EXT INTERRUPT routine (see Low Kernel Jumpblock, routine 015) 015 &003B EXT INTERRUPT Action: This area is set aside for dealing with external interrupts that are generated by any extra hardware Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: If any external hardware is going to generate interr- upts, then the user must patch the area from &003B to &003F so that the computer can deal with the external interrupt; when an external interrupt occurs, the lower ROM is disabled and the code at &003B is called; the default external interrupt routine at &003B simply returns, and this will cause the computer to hang because the interrupt will continue to exist High Kernel Jumpblock 000 &B900 KL U ROM ENABLE Action: Enables the current upper ROM Entry: No entry conditions Exit: A contains the previous state of the ROM, the flags are corrupt, and all other registers are preserved Notes: After this routine has been called, all reading from addresses between &C000 and &FFFF refers to the upper ROM, and not the top 16K of RAM which is usually the screen memory; any writing to these addresses still affects the RAM as, by its nature, ROM cannot be written to 001 &B903 KL U ROM DISABLE Action: Disables the upper ROM Entry: No entry conditions Exit: A contains the previous state of the ROM, the flags are corrupt, and all other registers are preserved Notes: After this routine has been called, all reading from addresses between &C000 and ~F~FF refers to the top 16K of RAM which is usually the screen memory 002 &B906 KL L ROM ENABLE Action: Enables the lower ROM Entry: No entry conditions Exit: A contains the previous state of the ROM, the flags are corrupt, and all other registers are preserved Notes: After this routine has been called, all reading from addresses between &0000 and &4000 refers to the lower ROM, and not the bottom 16K of RAM; any writing to these addresses still affects the RAM as a ROM cannot be written to; the lower ROM is automatically enabled when a firmware routine is called, and is then disabled when the routine returns 003 &B909 KL L ROM DISABLE Action: Disables the lower ROM Entry: No entry conditions Exit: A contains the previous state of the ROM, the flags are corrupt, and all other registers are preserved Notes: After this routine has been called, all reading from addresses between &0000 and &4000 refers to the bottom 16K of RAM; the lower ROM is automatically enabled when a firmware routine is called, and is then disabled when the routine returns 004 &B90C KL ROM RESTORE Action: Restores the ROM to its previous state Entry: A contains the previous state of the ROM Exit: AF is corrupt, and all other registers are preserved Notes: The previous four routines all return values in the A register which are suitable for use by KL ROM RESTORE 005 &B90F KL ROM SELECT Action: Selects an upper ROM and also enables it Entry: C contains the ROM select address of the required ROM Exit: C contains the ROM select address of the previous ROM, and B contains the state of the previous ROM 006 &B912 KL CURR SELECTION Action: Gets the ROM select address of the current ROM Entry: No entry conditions Exit: A contains the ROM select address of the current ROM, and all other registers are preserved 007 &B915 KL PROBE ROM Action: Gets the class and version of a specified ROM Entry: C contains the ROM select address of the required ROM Exit: A contains the class of the ROM, H holds the version number, L holds me mark number, B and the flags are corrupt, and all other registers are preserved Notes: The ROM class may be one of ine following: &00 - a foregroumd ROM &01 - a background ROM &02 - an extension foreground ROM &80 - the built in ROM (ie the BASIC ROM) 008 &B918 KL ROM DESELECT Action: Selects the previous upper ROM and sets its state Entry: C contains me ROM select address of the ROM to be reselected, and B contains the state of the required ROM Exit: C contains the ROM select address of me current ROM, B is corrupt, and all others are preserved Notes: This routine reverses the acoon of KL ROM SELECT, and uses the values that it returns in B and C 009 &B91B KL LDIR Action: Switches off the upper and lower ROMs, and moves a block of memory Entry: As for a standard LDIR instruction (ie DE holds the destination location, HL points to the first byte to be moved, and BC holds the length of the block to be moved) Exit: F, BC, DE amd HL are set as for a normal LDIR instruction, and all other registers are preserved 010 &B91E KL LDDR Action: Switches off the upper and lower ROMs, amd moves a block of memory Entry: As for a standard LDDR instruction (ie DE holds the first desination location, HL points to the highest byte lit in memory to be moved, amd BC holds the number of bytes to be moved) Exit: F, BC, DE amd HL, are set as for a nommal LDDR instruction, and all other registers are preserved 011 &B921 KL POLL SYNCHRONOUS Action: Tests whether an event with a higher priority than the current event is waiting to be dealt with Entry: No entry conditions Exit: If there is a higher priority event, then Carry is false; if there is no higher priority event, then Carry is true; in either case, A and the other flags are corrupt, and all other registers are preserved 014 &B92A KL SCAN NEEDED Action: Ensures that the keyboard is scanned when the next ticker interrupt occurs Entry: No entry conditions Exit: AF amd HL are corrupt, amd all other registers are preserved Notes: This routine is useful for scanning the keyboard when interrupts are disabled and normal key scanning is not occuring The Key Manager 000 &BB00 KM INITIALISE Action: Initialises the Key Manager and sets up everything as it is when the computer is first switched on; the key buffer is emptied, Shift and Caps lock are tumed off amd all the expansion and translation tables are reset to normal; also see the routine KM RESET below Entry: No entry conditions Exit: AF, BC, DE and HL corrupt, and all other registers are preserved 001 &BB03 KM RESET Action: Resets the Key Manager; the key buffer is emptied and all current keys/characters are ignored Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt and all other registers are preserved Notes: See also KM INITIALISE above: on the 664 or 6128, the key buffer can also be cleared separately by calling the KM FLUSH routine 002 &BB06 KM WAIT CHAR Action: Waits for the next character from the keyboard buffer Entry: No entry conditions Exit: Carry is true, A holds the character value, the other flags are corrupt, and all other registers are preserved 003 &BB09 KM READ CHAR Action: Tests to see if a character is available from the keyboard buffer, but doesn't wait for one to become available Entry: No entry conditions Exit: If a character was available, then Carry is true, and A contains the character; otherwise Carry is false, and A is corrupt; in both cases, the other registers are preserved 004 &BB0C KM CHAR RETURN Action: Saves a character for the next use of KM WAIT CHAR or KM READ CHAR Entry: A contains the ASCII code of the character to be put back Exit: All registers are preserved 005 &BB0F KM SET EXPAND Action: Assigns a string to a key code Entry: B holds the key code; C holds the length of the string; HL contains the address of the string (must be in RAM) Exit: If it is OK, then Carry is true; otherwise Carry is false; in either case, A, BC, DE and HL are corrupt, and all other registers rlre preserved 006 &BB12 KM GET EXPAND Action: Reads a character from an expanded string of characters Entry: A holds an expansion token (ie a key code) and L holds the character position number (starts from 0) Exit: If it is OK, then Carry is true, and A holds the character; otherwise Carry is false, and A is corrupt; in either case, DE and flags are corrupt, and the other registers are preserved 007 &BB15 KM EXP BUFFER Action: Sets aside a buffer area for character expansion strings Entry: DE holds the address of the buffer and HL holds the length of the buffer Exit: If it is OK, then Carry is true; otherwise Carry is false; in either case, A, BC, DE and HL are corrupt Notes: The buffer must be in the central 32K of RAM and must be at least 49 bytes long 008 &BB18 KM WAIT KEY Action: Waits for a key to be pressed - this routine does not expand any expansion tokens Entry: No entry conditions Exit: Carry is true, A holds the character or expansion token, and all other registers are preserved 009 &BB1B KM READ KEY Action: Tests whether a key is available from the keyboard Entry: No entry conditions Exit: If a key is available, then Carry is true, and A contains the character; otherwise Carry is false, and A is corrupt; in either case, the other registers are preserved Notes: Any expansion tokens are not expanded 010 &BB1E KM TEST KEY Action: Tests if a particular key (or joystick direction or button) is pressed Entry: A contains the key/joystick nurnber Exit: If the requested key is pressed, then Zero is false; otherwise Zero is true for both, Carry is false A and HL are corrupt. C holds the Sbift and Control status and others are preserved Notes: After calling this, C will hold the state of shift and control - if bit 7 is set then Control was pressed, and if bit 5 is set then Shift was pressed 011 &BB21 KM GET STATE Action: Gets the state of the Shift and Caps locks Entry: No entry conditions Exit: If L holds &FF then the shift lock is on, but if L holds &00 then the Shift lock is off; if H holds &FF then the caps lock is on, and if H holds &00 then the Caps lock is off; whatever the outcome, all the other registers are preserved 012 &BB24 KM GET JOYSTICK Action: Reads the present state of any joysticks attached Entry: No entry conditions Exit: H and A contains the state of joystick 0, L holds that state of joystick 1, and all others are preserved Notes: The joystick states are bit significant and are as follows: Bit 0 - Up Bit 1 - Down Bit 2 - Left Bit 3 - Right Bit 4 - Fire2 Bit 5 - Fire1 Bit 6 - Spare Bit 7 - Always zero The bits are set when the corresponding buttons or directions are operated 013 &BB27 KM SET TRANSLATE Action: Sets the token or character that is assigned to a key when neither Shift nor Control are pressed Entry: A contains the key number and B contains the new token or character Exit: AF and HL are corrupt, and all other registers are preserved Notes: Special values for B are as follows: &80 to &9F - these values correspond to the expansion tokens &FD - this causes the caps lock to toggle on and off &FE - this causes the shift lock to toggle on and off &FF - causes this key to be ignored 014 &BB2A KM GET TRANSLATE Action: Finds out what token or character will be assigned to a key when neither Shift nor Control are pressed Entry: A contains the key number Exit: A contains the token/character that is assigned, HL and flags are corrupt, and all others are preserved Notes: See KM SET TRANSLATE for special values that can be returned 015 &BB2D KM SET SHIFT Action: Sets the token or character that will be assigned to a key when Shift is pressed as well Entry: A contains the key number and B contains the new token or character Exit: AF and HL are corrupt, and all others are preserved Notes: See KM SET TRANSLATE for special values that can be set 016 &BB30 KM GET SHIFT Action: Finds out what token/character will be assigned to a key when Shift is pressed as well Entry: A contains the key number Exit: A contains the token/character that is assigned, HL and flags are corrupt, and all others are preserved Notes: See KM SET TRANSLATE for special values that can be returned 017 &BB33 KM SET CONTROL Action: Sets the token or character that will be assigned to a key when Control is pressed as well Entry: A contains the key number and B contains the new token/character Exit: AF and HL are corrupt, and all others are preserved Notes: See KM SET TRANSLATE for special values that can be set 018 &BB36 KM GET CONTROL Action: Finds out what token or character will be assigned to a key when Control is pressed as well Entry: A contains the key number Exit: A contains the token/character that is assigned, HL and flags are corrupt and all others are preserved Notes: See KM SET TRANSLATE for special values that can be set 019 &BB39 KM SET REPEAT Action: Sets whether a key may repeat or not Entry: A contains the key number B contains &00 if there is no repeat and &FF is it is to repeat Exit: AF, BC and HL are corrupt, and all others are preserved 020 &BB3C KM GET REPEAT Action: Finds out whether a key is set to repeat or not Entry: A contains a key number Exit: If the key repeats, then Zero is false; if the key does not repeat, then Zero is true; in either case, A, HL and flags are corrupt, Carry is false, and all other registers are preserved 021 &BB3F KM SET DELAY Action: Sets the time that elapses before the first repeat, and also set the repeat speed Entry: H contains the time before the first repeat, and L holds the time between repeats (repeat speed) Exit: AF is corrupt, and all others are preserved Notes: The values for the times are given in 1/5Oth seconds, and a value of 0 counts as 256 022 &BB42 KM GET DELAY Action: Finds out the time that elapses before the first repeat and also the repeat speed Entry: No entry conditions Exit: H contains the time before the first repeat, and L holds the time between repeats, and all others are preserved 023 &BB45 KM ARM BREAK Action: Arms the Break mechanism Entry: DE holds the address of the Break handling routine, C holds the ROM select address for this routine Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved 024 &BB48 KM DISARM BREAK Action: Disables the Break mechanism Entry: No entry conditions Exit: AF and HL are corrupt, and all the other registers are preserved 025 &BB4B KM BREAK EVENT Action: Generates a Break interrupt if a Break routine has been specified by KM ARM BREAK Entry: No entry conditions Exit: AF and HL are corrupt, and all other registers are preserved The Text VDU 026 &BB4E TXT INITIALISE Action: Initialise the text VDU to its settings when the computer is switched on, includes resetting all the text VDU indirections, selecting Stream 0, resetting the text paper to pen 0 and the text pen to pen 1, moving the cursor to the top left corner of the screen and setting the writing mode to be opaque Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved 027 &BB51 TXT RESET Action: Resets the text VDU indirections and the control code table Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved 028 &BB54 TXT VDU ENABLE Action: Allows characters to be printed on the screen in the current stream Entry: No entry conditions Exit: AF is corrupt, and all other registers are preserved 029 &BB57 TXT VDU DISABLE Action: Prevents characters from being printed to the current stream Entry: No entry conditions Exit: AF is corrupt, and al1 the other registers are preserved 030 &BB5A TXT OUTPUT Action: Output a character or control code (&00 to &1F) to the screen Entry: A contains the character to output Exit: All registers are preserved Notes: Any control codes are obeyed and nothing is printed if the VDU is disabled; characters are printed using the TXT OUT ACTION routine; if using graphics printing mode, then control codes are printed and not obeyed 031 &BB5D TXT WR CHAR Action: Print a character at the current cursor position - control codes are printed and not obeyed Entry: A contains the character to be printed Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: This routine uses the TXT WRITE CHAR indirection to put the character on the screen 032 &BB60 TXT RD CHAR Action: Read a character from the screen at the current cursor position Entry: No entry conditions Exit: If it was successful then A contains the character that was read from the screen and Carry is true; otherwise Carry is false, and A holds 0; in either case, the other flags are corrupt, and all registers are preserved Notes: This routine uses the TXT UNWRITE indirection 033 &BB63 TXT SET GRAPHIC Action: Enables or disables graphics print character mode Entry: To switch graphics printing mode on, A must be non- zero; to turn it off, A must contain zero Exit: AF corrupt, and all other registers are preserved Notes: When turned on, control codes are printed and not obeyed; characters are printed by GRA WR CHAR 034 &BB66 TXT WIN ENABLE Action: Sets the boundaries of the current text window - uses physical coordinates Entry: H hoIds the column number of one edge, D holds the column number of the other edge, L holds the line number of one edge, and E holds the line number of the other edge Exit: AF, BC, DE and HL are corrupt Notes: The window is not cleared but the cursor is moved to the top left corner of the window 035 &BB69 TXT GET WINDOW Action: Returns the size of the current window - returns physical coordinates Entry: No entry conditions Exit: H holds the column number of the left edge, D holds the column number of the right edge, L holds the line number of the top edge, E holds the line number of the bottom edge, A is corrupt, Carry is false if the window covers the entire screen, and the other registers are always preserved 036 &BB6C TXT CLEAR WINDOW Action: Clears the window (of the current stream) and moves the cursor to the top left corner of the window Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and alI others are preserved 037 &BB6F TXT SET COLUMN Action: Sets the cursor's horizontal position Entry: A contains the logical column number to move the cursor to Exit: AF and HL are corrupt, and all the other registers are preserved Notes: See also TXT SET CURSOR 038 &BB72 TXT SET ROW Action: Sets the cursor's vertical position Entry: A contains the logical line number to move the cursor to Exit: AF and HL are corrupt, and all others are preserved Notes: See also TXT SET CURSOR 039 &BB75 TXT SET CURSOR Action: Sets the cursor's vertical and horizontal position Entry: H contains the logical column number and L contains the logical line number Exit: AF and HL are corrupt, and all the others are preserved Notes: See also TXT SET COLUMN and TXT SET ROW 040 &BB78 TXT GET CURSOR Action: Gets the cursor's current position Entry: No entry conditions Exit: H holds the logical column number, L holds the logical line number, and A contains the roll count, the flags are corrupt, and all the other registers are preserved Notes: The roll count is increased when the screen is scrolled down, and is decreased when it is scrolled up 041 &BB7B TXT CUR ENABLE Action: Allows the text cursor to be displayed (if it is allowed by TXT CUR ON) - intended for use by the user Entry: No entry conditions Exit: AF is corrupt, and all other registers are preserved 042 &BB7E TXT CUR DISABLE Action: Prevents the text cursor from being displayed -intended for use by the user Entry: No entry conditions Exit: AF is corrupt, and all others are preserved 043 &BB81 TXT CUR ON Action: Allows the text cursor to be displayed - intended for use by the operating system Entry: No entry conditions Exit: All registers and flags are preserved 044 &BB84 TXT CUR OFF Action: Prevents the text cursor from being displayed -intended for use by the operating system Entry: No entry conditions Exit: All registers and flags are preserved 045 &BB87 TXT VALIDATE Action: Checks whether a cursor position is within the current window Entry: H contains the logical column number to check, and L holds the logical line number Exit: H holds the logical column number where the next character will be printed, L holds the logical line number; if printing at this position would make the window scroll up, then Carry is false and B holds &FF; if printing at this position would make the window scroll down, then Carry is false and B contains &00; if printing at the specified cursor position would not scroll the window, then Carry is true and B is corrupt; always, A and the other flags are corrupt, and all others are preserved 046 &BB8A TXT PLACE CURSOR Action: Puts a 'cursor blob' on the screen at the current cursor position Entry: No entry conditions Exit: AF is corrupt, and all other registers are preserved Notes: It is possible to have more than one cursor in a window (see also TXT DRAW CURSOR); do not use this routine twice without using TXT REMOVE CURSOR between 047 &BB8D TXT REMOVE CURSOR Action: Removes a 'cursor blob' from the current cursor position Entry: No entry conditions Exit: AF is corrupt, and all the others are preserved Notes: This should be used only to remove cursors created by TXT PLACE CURSOR, but see also TXT UNDRAW CURSOR 048 &BB90 TXT SET PEN Action: Sets the foreground PEN for the current stream Entry: A contams the PEN number to use Exit: AF and HL are corrupt, and all other registers are preserved 049 &BB93 TXT GET PEN Action: Gets the foreground PEN for the current stream Entry: No entry conditions Exit: A contains the PEN number, the flags are corrupt, and all other registers are preserved 050 &BB96 TXT SET PAPER Action: Sets the background PAPER for the current stream Entry: A contains the PEN number to use Exit: AF and HL are corrupt, and all other registers are preserved 051 &BB99 TXT GET PAPER Action: Gets the background PAPER for the current stream Entry: No entry conditions Exit: A contains the PEN number, the flags are corrupt, and all other registers are preserved 052 &BB9C TXT INVERSE Action: Swaps the current PEN and PAPER colours over for the current stream Entry: No entry conditions Exit: AF and HL are corrupt, and all others are preserved 053 &BB9F TXT SET BACK Action: Sets the character write mode to either opaque or transparent Entry: For transparent mode, A must be non-zero; for opaque mode, A has to hold zero Exit: AF and HL are corrupt, and all other registers are preserved Notes: Setting the character write mode has no effects on the graphics VDU 054 &BBA2 TXT GET BACK Action: Gets the character write mode for the current stream Entry: No entry conditions Exit: If in transparent mode, A is non-zero; in opaque mode, A is zero; in either case DE, HL and flags are corrupt, and the other registers are preserved 055 &BBA5 TXT GET MATRIX Action: Gets the address of a character matrix Entry: A contains the character whose matrix is to be found Exit: If it is a user-defined matrix, then Carry is true; if it is in the lower ROM then Carry is false; in either event, HL contains the address of the matrix, A and other flags are corrupt, and others are preserved Notes: The character matrix is stored in 8 bytes; the first byte is for the top row of the character, and the last byte refers to the bottom row of the character; bit 7 of a byte refers to the leftmost pixel of a line, and bit 0 refers to the rightmost pixel in Mode 2. 056 &BBA8 TXT SET MATRIX Action: Installs a matrix for a user-defined character Entry: A contains the character which is being defined and HL contains the address of the matrix to be used Exit: If the character is user-definable then Carry is true; otherwise Carry is false, and no action is taken; in both cases AF, BC, DE and HL are corrupt, and all other registers are preserved 057 &BBAB TXT SET M TABLE Action: Sets the address of a user-defined matrix table Entry: DE is the first character in the table and HL is the table's address (in the central 32K of RAM) Exit: If there are no existing tables then Carry is false, and A and HL are both corrupt; otherwise Carry is true, A is the first character and HL is the table's address; in both cases BC, DE and the other flags are corrupt 058 &BBAE TXT GET M TABLE Action: Gets the address of a user-defined matrix table Entry: No entry conditions Exit: See TXT SET M TABLE above for details of the values that can be returned 059 &BBB1 TXT GET CONTROLS Action: Gets the address of the control code table Entry: No entry conditions Exit: HL contains the address of the table, and all others are preserved Notes: The table has 32 entries, and each entry has three bytes: byte 1 is the number of parameters needed by the control code, bytes 2 and 3 are the address of the routine, in the Lower ROM, to execute the control code 060 &BBB4 TXT STR SELECT Action: Selects a new VDU text stream Entry: A contains the value of the stream to change to Exit: A contains the previously selected stream, HL and the flags are corrupt, and all others are preserved 061 &BBB7 TXT SWAP STREAMS Action: Swaps the states of two stream attribute tables Entry: B contains a stream number, and C contains the other stream number Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: The foreground pen and paper, the window size, the cursor position, the character write mode and graphic character mode are all exchanged between the two streams The Graphics VDU 062 &BBBA GRA INITIALISE Action: Initialises the graphics VDU to its default set-up (ie its set-up when the computer is switched on) Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: Sets the graphics indirections to their defaults, sets the graphic paper to text pen 0 and the graphic pen to text pen 1, reset the graphics origin and move the graphics cursor to the bottom left of the screen, reset the graphics window and write mode to their defaults 063 &BBBD GRA RESET Action: Resets the graphics VDU Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: Resets the graphics indirections and the graphics write mode to their defaults 064 &BBC0 GRA MOVE ABSOLUTE Action: Moves the graphics cursor to an absolute screen position Entry: DE contains the user X-coordinate and HL holds the user Y-coordinate Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 065 &BBC3 GRA MOVE RELATIVE Action: Moves the graphics cursor to a point relative to its present screen position Entry: DE contains the X-distance to move and HL holds the Y- distance Exit: AF, BC, DE and HL are corrupt, and all others are preserved 066 &BBC6 GRA ASK CURSOR Action: Gets the graphics cursor's current position Entry: No entry conditions Exit: DE holds the user X-coordirlate, HL holds the user Y- coordinate, AF is corrupt, and all others nre preserved 067 &BBC9 GRA SET ORIGIN Action: Sets the graphics user origin's screen position Entry: DE contains the standard X-coordinate and HL holds the standard Y-coordinate Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 068 &BBCC GRA GET ORIGIN Action: Gets the graphics user origin's screen position Entry: No entry conditions Exit: DE contains the standard X-coordinate and HL holds the standard Y-coordinate, and all others are preserved 069 &BBCF GRA WIN WIDTH Action: Sets the left and right edges of the graphics window Ently: DE contains the standard X-coordinate of one edge and HL holds the standard X-coordinate of the other side Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved Notes: The default window covers the entire screen and is restored to its default when the mode is changed; used in conjunction with GRA WIN HEIGHT 070 &BBD2 GRA WIN HEIGHT Action: Sets the top and bottom edges of the graphics window Entry: DE contains the standard Y-coordinate of one side and HL holds the standard Y-coordinate of the other side Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: See GRA WIN WIDTH for further details 071 &BBD5 GRA GET W WIDTH Action: Gets the left and right edges of the graphics window Entry: No entry conditions Exit: DE contains the standard X-coordinate of the left edge and HL contains the standard Y-coordinate of the right edge, AF is corrupt, and all other registers are preserved 072 &BBD8 GRA GET W HEIGHT Action: Gets the top and bottom edges of the graphics window Entry: No entry conditions Exit: DE contains the standard Y-coordinate of the top edge and HL contains the standard Y-coordinate of the bottom edge, AF is corrupt, and all other registers are preserved 073 &BBDB GRA CLEAR WINDOW Action: Clears the graphics window to the graphics paper colour and moves the cursor back to the user origin Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 074 &BBDE GRA SET PEN Action: Sets the graphics PEN Entry: A contains the required text PEN number Exit: AF is corrupt, and all other registers are preserved 075 &BBE1 GRA GET PEN Action: Gets the graphics PEN Entry: No entry conditions Exit: A contains the text PEN number, the flags are corrupt, and all other registers are preserved 076 &BBE4 GRA SET PAPER Action: Sets the graphics PAPER Entry: A contains the required text PEN number Exit: AF corrupt, and all others are preserved 077 &BBE7 GRA GET PAPER Action: Gets the graphics PAPER Entry: No entry conditions Exit: A contains the text PEN number, the flags are corrupt, and all others are preserved 078 &BBEA GRA PLOT ABSOLUTE Action: Plots a point at an absolute user coordinate, using the GRA PLOT indirection Entry: DE contains the user X-coordinate and HL holds the user Y-coordinate Exit: AF, BC, DE and HL are corrupt, and all others are preserved 079 &BBED GRA PLOT RELATIVE Action: Plots a point at a position relative to the current graphics cursor, using the GRA PLOT indirection Entry: DE contains the relative X-coordinate and HL contains the relative Y-coordinate Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 080 &BBF0 GRA TEST ABSOLUTE Action: Moves to an absolute position, and tests the point there using the GRA TEST indirection Entry: DE contains the user X-coordinate and HL holds the user Y-coordinate for the point you wish to test Exit: A contains the pen at the point, and BC, DE, HL and flags are corrupt, and all others are preserved 081 &BBF3 GRA TEST RELATIVE Action: Moves to a position relative to the current position, and tests the point there using the GRA TEST indirection Entry: DE contains the relative X-coordinate and HL contains the relative Y-coordinate Exit: A contains the pen at the point, and BC, DE, HL and flags are corrupt, and all others are preserved 082 &BBF6 GRA LlNE ABSOLUTE Action: Draws a line from the current graphics position to an absolute position, using GRA LINE Entry: DE contains the user X-coordinate and HL holds the user Y-coordinate of the end point Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: The line will be plotted in the current graphics pen colour (may be masked to produce a dotted line on a 6128) 083 &BBF9 GRA LINE RELATIVE Action: Draws a line from the current graphics position to a relative screen position, using GRA LINE Entry: DE contains the relative X-coordinate and HL contains the relative Y-coordinate Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: See GRA LINE ABSOLUTE above for details of how the line is plotted 084 &BBFC GRA WR CHAR Action: Writes a character onto the screen at the current graphics position Entry: A contains the character to be put onto the screen Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved Notes: As in BASIC, all characters including control codes are printed; the character is printed with its top left comer at the current graphics position; the graphics position is moved one character width to the right so that it is ready for another character to be printed The Screen Pack 085 &BBFF SCR INITIALISE Action: Initialises the Screen Pack to the default values used when the computer is first switched on Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: All screen indirections are restored to their default settings, as are inks and flashing speeds; the mode is switched to MODE 1 and the screen is cleared with PEN 0; the screen address is moved to &C000 and the screen offset is set to zero 086 &BC02 SCR RESET Action: Resets the Screen Pack's indirections, flashing speeds and inks to their default values Entry: No entry conditions Exit: AF, BC, DE r1nd HL are corrupt, and all other registers are preserved 087 &BC05 SCR SET OFFSET Action: Sets the screen offset to the specified values - this can cause the screen to scroll Entry: HL contains the required offset, which should be even Exit: AF and HL are corrupt, and alI others are preserved Notes: The screen offset is reset to 0 whenever its mode is set, or it is cleared by SCR CLEAR (but not BASIC's CLS) 088 &BC08 SCR SET BASE Action: Sets the location in memory of the screen - effectively can only be &C000 or &4000 Entry: A contains the most significant byte of the screen address required Exit: AF and HL are corrupt, and all other registers are preserved Notes: The screen memory can only be set at 16K intervals (ie &0000, &4000, &8000, &C000) and when the computer is first switched on the 16K of screen memory is located at &C000) 089 &BC0B SCR GET LOCATION Action: Gets the location of the screen memory and also the screen offset Entry: No entry conditions Exit: A holds the most significant byte of the screen address, HL holds the current offset, and all others are preserved 090 &BC0E SCR SET MODE Action: Sets the screen mode Entry: A contains the mode number - it has the same value and characteristics as in BASIC Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: The windows are set to cover the whole screen and the graphics origin is set to the bottom left corner of the screen; in addition, the current stream is set to zero, and the screen offset is zeroed 091 &BC11 SCR GET MODE Action: Gets the current screen mode Ently: No entry conditions Exit: If the mode is 0, then Carry is true, Zero is false, and A contains 0; if the mode is 1, then Carry is false, Zero is true, and A contains 1; if the mode is 2, then Carry is false, Zero is false, and A contains 2; in all cases the other flags are corrupt and all the other registers are preserved 092 &BC14 SCR CLEAR Action: Clears the whole of the screen Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved 093 &BC17 SCR CHAR LIMITS Action: Gets the size of the whole screen in terms of the numbers of characters that can be displayed Entry: No entry conditions Exit: B contains the number of characters across the screen, C contains the number of characters down the screen, AF is corrupt, and all other registers are preserved 094 &BC1A SCR CHAR POSITION Action: Gets the memory address of the top left corner of a specified character position Entry: H contains the character physical column and L contains the character physical row Exit: HL contains the memory address of the top left comer of the character, B holds the width in bytes of a character in the present mode, AF is corrupt, and all other registers are preserved 095 &BC1D SCR DOT POSITION Action: Gets the memory address of a pixel at a specified screen position Entry: DE contains the base X-coordinate of the pixel, and HL contains the base Y-coordinate Exit: HL contains the memory address of the pixel, C contains the bit mask for this pixel, B contains the number of pixels stored in a byte minus 1, AF and DE are corrupt, and all others are preserved 096 &BC20 SCR NEXT BYTE Action: Calculates the screen address of the byte to the right of the specified screen address (may be on the next line) Entry: HL contains the screen address Exit: HL holds the screen address of the byte to the right of the original screen address, AF is corrupt, all others are preserved 097 &BC23 SCR PREV BYTE Action: Calculates the screen address of the byte to the left of the specified screen address (this address may actually be on the previous line) Entry: HL contains the screen address Exit: HL holds the screen address of the byte to the left of the original address, AF is corrupt, all others are preserved 098 &BC26 SCR NEXT LINE Action: Calculates the screen address of the byte below the specified screen address Ently: HL contains the screen address Exit: HL contains the screen address of the byte below the original screen address, AF is corrupt, and all the other registers are preserved 099 &BC29 SCR PREV LINE Action: Calculates the screen address of the byte above the specified screen address Entry: HL contains the screen address Exit: HL holds the screen address of the byte above the original address, AF is corrupt, and all others are preserved 100 &BC2C SCR INK ENCODE Action: Converts a PEN to provide a mask which, if applied to a screen byte, will convert all of the pixels in the byte to the appropriate PEN Entry: A contains a PEN number Exit: A contains the encoded value of the PEN, the flags are corrupt, and all other registers are preserved Notes: The mask returned is different in each of the screen modes 101 &BC2F SCR INK DECODE Action: Converts a PEN mask into the PEN number (see SCR INK ENCODE for the re~ erse process) Entry: A contains the encoded value of the PEN Exit: A contains the PEN number, the flags are corrupt, and all others are preserved 102 &BC32 SCR SET INK Action: Sets the colours of a PEN - if the two values supplied are different then the colours will alternate (flash) Entry: contains the PEN number, B contains the first colour, and C holds the second colour Exit: AF, BC, DE and HL are corrupt, and all others are preserved 103 &BC35 SCR GET INK Action: Gets the colours of a PEN Entry: A contains the PEN nurnber Exit: B contains the first colour, C holds the second colour, and AF, DE and HL are corrupt, and all others are preserved 104 &BC38 SCR SET BORDER Action: Sets the colours of the border - again if two different values are supplied, the border will flash Entry: B contains the first colour, and C contains the second colour Exit: AF, BC, DE and HL are corrupt, and all others are preserved 105 &BC3B SCR GET BORDER Action: Gets the colours of the border Entry: No entry conditions Exit: B contains the first colour, C holds the second colour, and AF, DE and HL are corrupt, and all others are preserved 106 &BC3E SCR SET FLASHING Action: Sets the speed with which the border's and PENs' colours flash Entry: H holds the time that the first colour is displayed, L holds the time the second colour is displayed for Exit: AF and HL are corrupt, and all other registers are preserved Notes: The length of time that each colour is shown is measured in 1/5Oths of a second, and a value of 0 is taken to mean 256 * 1/50 seconds - the default value is 10 * 1/50 seconds 107 &BC41 SCR GET FLASHING Action: Gets the periods with which the colours of the border and PENs flash Entry: No entry conditions Exit: H holds the duration of the first colour, L holds the duration of the second colour, AF is corrupt, and all other registers are preserved - see SCR SET FLASHING for the units of time used 108 &BC44 SCR FILL BOX Action: Fills an area of the screen with an ink - this only works for 'character-sized' blocks of screen Entry: A contains the mask for the ink that is to be used, H contains the left hand colurnn of the area to fill, D contains the right hand column, L holds the top line, and E holds the bottom line of the area (using physical coordinates) Exit: AF, BC, DE and HL are corrupt, and all others are preserved 109 &BC17 SCR FLOOD BOX Action: Fills an area of the screen with an ink - this only works for 'byte-sized' blocks of screen Entry: C contains the encoded PEN that is to be used, HL contains the screen address of the top left hand corner of the area to fill, D contains the width of the area to be filled in bytes, and E contains the height of the area to be filled in screen lines Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: The whole of the area to be filled must lie on the screen otherwise unpredictable results may occur 110 &BC4A SCR CHAR INVERT Action: Inverts a character's colours; all pixels in one PEN's colour are printed in another PEN's colour, and vice versa Entry: B contains one encoded PEN, C contains the other encoded PEN, H contains the physical column number, and L contains the physical line number of the character that is to be inverted Exit: AF, BC, DE and HL are corrupt, and alI the other registers are preserved 111 &BC4D SCR HW ROLL Action: Scrolls the entire screen up or down by eight pixel rows (ie one character line) Entry: B holds the direction that the screen will roll, A holds the encoded PAPER which the new line will appear in Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: This alters the screen offset; to roll down, B must hold zero, and to roll upwards B must be non-zero 112 &BCS0 SCR SW ROLL Action: Scrolls part of the screen up or down by eight pixel lines - only for 'character-sized' blocks of the screen Entry: B holds the direction to roll the screen, A holds the encoded PAPER which the new line will appear in, H holds the left column of the area to scroll, D holds the right colurnn, L holds the top line, E holds the bottom line Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: The area of the screen is moved by copying it; to roll down, B must hold zero, and to roll upwards B must be non-zero; this routine uses physical roordinates 113 &BC53 SCR UNPACK Action: Changes a character matrix from its eight byte standard form into a set of pixel masks which are suitable for the current mode - four *8 bytes are needed in mode 0, two *8 bytes in mode l, and 8 bytes in mode 2 Entry: HL contains the address of the matrix, and DE contains the address where the masks are to be stored Exit: AF. BC, DE and HL are corrupt, and all other registers are preserved 114 &BC56 SCR REPACK Action: Changes a set of pixel masks (for the current mode) into a standard eight byte character matrix Entry: A contains the encoded foreground PEN to be matched against (ie the PEN that is to be regarded as being set in the character), H holds the physical column of the character to be `repacked', L holds the physical line of the character, and DE contains the address of the area where the character matrix will be built Exit: AF, BC, DE amd HL are corrupt, and all the others are preserved 115 &BC59 SCR ACCESS Action: Sets the screen write mode for graphics Entry: A contains the write mode (0=Fill, 1=XOR, 2=AND, 3=OR) Exit: AF. BC, DE and HL are corrupt, amd all other registers are preserved Notes: The fill mode means that the ink that plotting was requested in is the ink that appears on the screen; in XOR mode, the specified ink is XORed with ink that is at that point on the screen already before plotting; a simiIar situation occurs with the AND and OR modes 116 &BC5C SCR PIXELS Action: Puts a pixel or pixels on the screen regardless of the write mode specified by SCR ACCESS above Entry: B contains the mask of the PEN to be drawn with, C contains the pixel mask, and HL holds the screen address of the pixel Exit: AF is corrupt, amd all others are preserved 117 &BC5F SCR HORIZONTAL Action: Draws a honzontal line on the screen using the current graphics write mode Entry: A contains the encoded PEN to be drawn with, DE contains the base X-coordinate of the start of the line, BC contains the end base X-coordinate, and HL contains the base Y-coordinate Exit: AF, BC, DE and HL are conupt, and all other registers are preserved Notes: The start X-coordinate must be less than the end X- coordmate 118 &BC62 SCR VERTICAL Action: Draws a vertical line on the screen using the current graphics write mode Entry: A contains the encoded PEN to be drawn with, DE contains the base X-coordinate of the line, HL holds the start base Y-coordinate, and BC contains the end base Y-coordinate - the start coordinate must be less than the end coordinate Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved The Cassette/AMSDOS Manager NOTE: Some of these routines are only applicable to the cassette manager; where a disc version exists it is indicated by an asterisk (*) next to the command name. These disc version jumpblocks are automatically installed by the Operating System on switch on. 119 &BC65 CAS INITIALISE Action: Initialises the cassette manager Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved Notes: Both read and write streams are closed; tape messages are switched on; the default speed is reselected 120 &BC68 CAS SET SPEED Action: Sets the speed at which the cassette manager saves programs Entry: HL holds the length of 'half a zero' bit, and A contains the amount of precompensation Exit: AF and HL are corrupt Notes: The value in HL is the length of time that half a zero bit is written as; a one bit is twice the length of a zero bit; the default values (ie SPEED WRITE 0) are 333 microseconds (HL) and 25 microseconds (A) for SPEED WRITE 1, the values are given as 107 microseconds and 50 microseconds respectiveIy 121 &BC6B CAS NOISY Action: Enables or disables the display of cassette handling messages Entry: To enable the messages then A must be 0, otherwise the messages are disabled Exit: AF is corrupt, and all other registers are preserved 122 &BC6E CAS START MOTOR Action: Switches on the tape motor Entry: No entry conditions Exit: If the motor operates properly then Carry is true; if ESC was pressed then Carry is false; in either case, A contains the motor's previous state, tbe flags are corrupt, and all others are preserved 123 &BC71 CAS STOP MOTOR Action: Switches off the tape motor Entry: No entry conditions Exit: If the motor turns off then Carry is true; if ESC was pressed then Carry is false; in both cases, A holds tbe motor's previous state, the other flags are corrupt, all others are preserved 124 &BC74 CAS RESTORE MOTOR Action: Resets the tape motor to its previous state Entry: A contains the previous state of the motor (eg from CAS START MOTOR or CAS STOP MOTOR) Exit: If the motor operates properly then Carry is true; if ESC was pressed then Carry is false; in all cases, A and the other flags are corrupt and all others are preserved 125 &BC77 *CAS IN OPEN Action: Opens an input buffer and reads the first block of the file Entry: B contains the length of the filename, HL contains the filename's address, and DE contains the address of the 2K buffer to use for reading the file Exit: If the file was opened successfully, then Carry is true, Zero is false, HL holds the address of a buffer contauling the file header data, DE holds the address of the destination for the file, BC holds the file length, and A holds the file type; if the read stream is already open then Carry and Zero are false, A contains an error nurnber (664/6128 only) and BC, DE and HL are corrupt; if ESC was pressed by the user, then Carry is false, Zero is true, A holds an error number (664/6128 only) and BC, DE and HL are corrupt; in all cases, IX and the other flags are corrupt, and the others are preserved Notes:A filename of zero length means 'read the neXt file on the tape'; the stream remains open until it is closed by either CAS IN CLOSE or CAS IN ABANDON Disc: Similar to tape except that if there is no header on the file, then a fake header is put into memory by this routine 126 &BC7A *CAS IN CLOSE Action: Closes an input file Entry: No entry conditions Exit: If the file was closed successfully, then Carry is true and A is corrupt; if the read stream was not open, then Carry is false, and A holds an error code (664/6128 only); in both cases, BC, DE, HL and the other flags are all corrupt Disc: All the above applies, but also if the file failed to close for any other reason, then Carry is false, Zero is true and A contains an error number; in all cases the drive motor is turned off immediately 127 &BC7D *CAS IN ABANDON Action: Abandons an input file Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved Disc: All the above applies for the disc routine 128 &BC80 *CAS IN CHAR Action: Reads in a single byte from a file Entry: No entry conditions Exit: If a byte was read, then Carry is true, Zero is false, and A contains the byte read from the file; if the end of file was reached, then Carry and Zero are false, A contains an error number (664/6128 only) or is corrupt (for the 464); if ESC was pressed, then Carry is false, Zero is true, and A holds an error number (664/6128 only) or is corrupt (for the 464); in all cases, IX and the other flags are corrupt, and all others are preserved Disc: All the above applies for the disc routine 129 &BC83 *CAS IN DIRECT Action: Reads an entire file directly into memory Entry: HL contains the address where the file is to be placed in RAM Exit: If the operation was successful, then Carry is true, Zero is false, HL contains the entry address and A is corrupt; if it was not open, then Carry and Zero are both false, HL is corrupt, and A holds an error code (664/6128) or is corrupt (464); if ESC was pressed, Carry is false, Zero is true, HL is corrupt, and A holds an error code (664/6128 only); in all cases, BC, DE and IX and the other flags are corrupt, and the others are preserved Notes: This routine cannot be used once CAS IN CHAR has been used Disc: All the above applies to the disc routine 130 &BC86 *CAS RETURN Action: Puts the last byte read back into the input buffer so that it can be read again at a later time Entry: No entry conditions Exit: All registers are preserved Notes: The routine can only return the last byte read and at least one byte must have been read Disc: All the above applies to the disc routine 131 &BC89 *CAS TEST EOF Action: Tests whether the end of file has been encountered Entry: No entry conditions Exit: If the end of file has been reached, then Carry and Zero are false, and A is corrupt; if the end of file has not been encountered, then Carry is true, Zero is false, and A is corrupt; if ESC was pressed then Carry is false, Zero is true and A contains an error number (664/6128 only); in all cases, IX and the other flags are corrupt, and all others are preserved Disc: All the above applies to the disc routine 132 &BC8C *CAS OUT OPEN Action: Opens an output file Entry: B contains the length of the filename, HL contains the address of the filename, and DE holds the address of the 2K buffer to be used Exit: If the file was opened correctly, then Carry is true, Zero is false, HL holds the address of the buffer containing the file header data that will be written to each block, and A is corrupt; if the write stream is already open, then Carry and Zero are false, A holds an error nurnber (66~/6128) and HL is corrupt; if ESC was pressed then Carry is false, Zero is true, A holds an error number (664/6128) and HL is corrupt; in all cases, BC, DE, IX and the other flags are corrupt, and the others are preserved Notes: The buffer is used to store the contents of a file block before it is actually written to tape Disc: The same as for tape except that the filename must be present in its usual AMSDOS format 133 &BC8F *CAS OUT CLOSE Action: Closes an output file Entry: No entry conditions Exit: If the file was closed successfully, then Carry is true, Zero is false, and A is corrupt; if the write stream was not open, then Carry and Zero are false and A holds an error code (664/6128 only); if ESC was pressed then Carry is false, Zero is true, and A contains an error code (664/6128 only); in all cases, BC, DE, HL, IX and the other flags are all corrupt Notes: The last block of a file is written only when this routine is called; if writing the file is to be abandoned, then CAS OUT ABANDON should be used instead Disc: All the above applies to the disc routine 134 &BC92 *CAS OUT ABANDON Action: Abandons an output file Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: When using this routine, the current last block of the file is not written to the tape Disc: Similar to the tape routine; if more than 16K of a file has been written to the disc, then the first 16K of the file will exist on the disc with a file extension of .$$$ because each 16K section of the file requires a separate directory entry 135 &BC95 *CAS OUT CHAR Action: Writes a single byte to a file Entry: A contains the byte to be written to the file output buffer Exit: If a byte was written to the buffer, then Carry is true, Zero is false, and A is corrupt; if the file was not open, then Carry and Zero are false, and A contains an error number (664/6128 only) or is corrupt (on the 464); if ESC was pressed, then Carry is false, Zero is true, and A contains an error number (664/6128 only) or it is corrupt (on the 464); in all cases, IX and the other flags are corrupt, and all others are preserved Notes: If the 2K buffer is full of data then it is written to the tape before the new character is placed in the buffer; it is important to call CAS OUT CLOSE when all the data has been sent to the file so that the last block is written to the tape Disc: All the above applies to the disc routine 136 &BC98 *CAS OUT DIRECT Action: Writes an entire file directly to tape Entry: HL contains the address of the data which is to be written to tape, DE contains the length of this data, BC contains the e~ecution address, and A contains the file type Exit: If the operation was successful, then Carry is true, Zero is false, and A is corrupt; if the file was not open, Carry and Zero are false, A holds an error number (664/6128) or is corrupt (464); if ESC was pressed, then Carry is false, Zero is true, and A holds an error code (664/6128 only); in all cases BC, DE, HL, IX and the other flags are corrupt, and the others are preserved Notes: This routine cannot be used once CAS OUT CHAR has been used Disc: All the above applies to the disc routine 137 &BC9B *CAS CATALOG Action: Creates a catalogue of all the files on the tape Entry: DE contains the address of the 2K buffer to be used to store the information Exit: If the operation was successful, then Carry is true, Zero is false, and A is corrupt; if the read stream is already being used, then Carry and Zero are false, and A holds an error code (664/6128 or is corrupt (for the 464); in all cases, BC, DE, HL, IX and the other flags are corrupt and all others are preserved Notes: This routine is only left when the ESC key is pressed (cassette only) and is identical to BASIC's CAT command Disc: All tbe above applies, except that a sorted list of files is displayed; system files are not listed by this routine 138 &BC9E CAS WRITE Action: Writes data to the tape in one long file (ie not in 2K blocks) Entry: HL contains the address of the data to be written to tape, DE contains the length of the data to be written, and A contains the sync character Exit: If the operation was successful, then Carry is true and A is corrupt; if an error occurred then Carry is false and A contains an error code; in both cases, BC, DE, HL and lX are corrupt, and all other registers are preserved Notes: For header records the sync character is &2C, and for data it is &16; this routine starts and stops the cassette motor and also tums off interrupts whilst writing data 139 &BCA1 CAS READ Action: Reads data from the tape in one long file (ie as originally written by CAS WRITE only) Entry: HL holds the address to place the file, DE holds the length of the data, and A holds the expected sync character Exit: If the operation was successful, then Carry is true and A is corrupt; if an error occurred then Carry is false and A contains an error code; in both cases, BC, DE, HL and IX are corrupt, and all other registers are preserved Notes: For header records the sync character is &2C, and for data it is &16; this routine starts and stops the cassette motor and turns off interrupts whilst reading data 140 &BCA4 CAS CHECK Action: Compares the contents of memory with a file record (ie header or data) on tape Entry: HL contains the address of the data to check, DE contains the length of the data and A holds the sync character that was used when the file was originally written to the tape Exit: If the two are identical, then Carry is true and A is corrupt; if an error occurred then Carry is false and A holds an error code; in all cases, BC, DE, HL, IX and other flags are corrupt, and all other registers are preserved Notes: For header records the sync character is &2C, and for data it is &16; this routine starts and stops the cassette motor and turns off interrupts whilst reading data; does not have to read the whole of a record, but must start at the beginning The Sound Manager 141 &BCA7 SOUND RESET Action: Resets the sound manager by clearing the sound queues and abandoning any current sounds Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved 142 &BCAA SOUND QUEUE Action: Adds a sound to the sound queue of a channel Entry: HL contains the address of a series of bytes which define the sound and are stored in the central 32K of RAM Exit: If the sound was successfully added to the queue, then Carry is true and HL is corrupt; if one of the sound queues was full, then Carry is false and HL is preserved; in either case, A, BC, DE, IX and the other flags are corrupt, and all others are preserved Notes: The bytes required to define the sound are as follows: byte 0 - channel status byte byte 1 - volume envelope to use byte 2 - tone envelope to use bytes 3&4 - tone period byte 5 - noise period byte 6 - start volume bytes 7&8 - duration of the sound, or envelope repeat count 143 &BCAD SOUND CHECK Action: Gets the status of a sound channel Entry: A contains the channel to test - for channel A, bit 0 set; for channel B, bit 1 set; for channel C, bit 2 set Exit: A contains the channel status, BC, DE, HL and flags are corrupt, and all others are preserved Notes: The channel status returned is bit significant, as follows: bits 0 to 2 - the number of free spaces in the sound queue bit 3 - trying to rendezvous with channel A bit 4 - trying to rendezvous with channel B bit 5 - trying to rendezvous with channel C bit 6 - holding the channel bit 7 - producing a sound 144 &BCB0 SOUND ARM EVENT Action: Sets up an event which will be activated when a space occurs in a sound queue Entry: A contains the channel to set the event up for (see SOUND CHECK for the bit values this can take), and HL holds the address of the event block Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: The event block must be initialised by KL INIT EVENT and is disarmed when the event itself is run 145 &BCB3 SOUND RELEASE Action: Allows the playing of sounds on specific channels that had been stopped by SOUND HOLD Entry: A contains the sound channels to be released (see SOUND CHECK for the bit values this can take) Exit: AF, BC, DE, HL and IX are corrupt, and all others are preserved 146 &BCB6 SOUND HOLD Action: Immediately stops all sound output (on all channels) Entry: No entry conditions Exit: If a sound was being made, then Carry is true; if no sound was being made, then Carry is false; in all cases, A, BC, HL and other flags are corrupt, and all others are preserved Notes: When the sounds are restarted, they will begin from exactly the same place that they were stopped 147 &BCB9 SOUND CONTINUE Action: Restarts all sound output (on all channels) Entry: No entry conditions Exit: AF, BC, DE and IX are corrupt, and all others are preserved 148 &BCBC SOUND AMPL ENVELOPE Action: Sets up avolume envelope Entry: A holds an envelope number (from 1 to 15), HL holds the address of a block of data for the envelope Exit: If it was set up properly, Carry is true, HL holds the data block address + 16, A and BC are corrupt; if the envelope number is invalid, then Carry is false, and A, B and HL are preserved; in either case, DE and the other flags are corrupt, and all other registers are preserved Notes: All the rules of enevelopes in BASIC also apply; the block of the data for the envelope is set up as follows: byte 0 - number of sections in the envelope bytes 1 to 3 - first section of the envelope bytes 4 to 6 - second section of the envelope bytes 7 to 9 - third section of the envelope bytes 10 to 12 - fourth section of the envelope bytes 13 to 15 - fifth section of the envelope Each section of the envelope has three bytes set out as follows: byte 0 - step count (with bit 7 set) byte 1 - step size byte 2 - pause time or if it is a hardware envelope, then each section takes the following form: byte 0 - envelope shape (with bit 7 not set) bytes 1 and 2 - envelope period See also SOUND TONE ENVELOPE below 149 &BCBF SOUND TONE ENVELOPE Action: Sets up a tone envelope Entry: A holds an envelope number (from 1 to 15), HL holds the address of a block of data for the envelope Exit: If it was set up properly, Carry is true, HL holds the data block address + 16, A and BC are corrupt; ” if the envelope number is invalid, then Carry is false, and A, B and HL are preserved; in either case, DE and the other flags are corrupt, and all other registers are preserved Notes: All the rules of envelopes in BASIC also apply; the block of the data for the envelope is set up as follows: byte 0 - number of sections in the envelope bytes 1 to 3 - first section of the envelope bytes 4 to 6 - second section of the envelope bytes 7 to 9 - third section of the envelope bytes 10 to 12 - fourth section of the envelope bytes 13 to 15 - fifth section of the envelope Each section of the envelope has three bytes set out as follows: byte 0 - step count byte 1 - step size byte 2 - pause time See also SOUND AMPL ENVELOPE above 150 &BCC2 SOUND A ADDRESS Action: Gets the address of the data block associated with a volume envelope Entry: A contains an envelope number (from 1 to 15) Exit: If it was found, then Carry is true, HL holds the data block's address, and BC holds its length; if the envelope number is invalid, then Carry is false, HL is corrupt and BC is preserved; in both cases, A and the other flags are corrupt, and all others are preserved 151 &BCC5 SOUND T ADDRESS Action: Gets the address of the data block associated with a tone envelope Entry: A contains an envelope number (from 1 to 15) Exit: If it was found, then Carry is true, HL holds the data block's address, and BC holds its length; if the envelope number is invalid, then Carry is false, HL is corrupt and BC is preserved; in both cases, A and the other flags are corrupt, and all others are preserved The Kernel 152 &BCC8 KL CHOKE OFF Action: Clears all event queues and timer lists, with the exception of keyboard scanning and sound routines Entry: No entry conditions Exit: B contains the foreground ROM select address (if any), DE contains the ROM entry address, C holds the ROM select address for a RAM foreground program, AF and HL are corrupt, and all others are preserved 153 &BCCB KL ROM WALK Action: Finds and initialises all background ROMs Entry: DE holds the address of the first usable byte of memory, HL holds the address of the last usable byte Exit: DE holds the address of the new first usable byte of memory, HL holds the address of the new last usable byte, AF and BC are corrupt, and all other registers are preserved Notes: This routine looks at the ROM select addresses from 0 to l5 (1 to 7 for the 464) and calls the initialisation routine of any ROMs present; these routines may reserve memory by adjusting DE and HL before returning control to KL ROM WALK, and the ROM is then added to the list of command handling routines 154 &BCCE KL INIT BACK Action: Finds and initialises a specific background ROM Entry: C contains the ROM select address of the ROM, DE holds the address of the first usable byte of memorv, HL holds the address of the last usable byte of memory Exit: DE holds the address of the new first usaUe byte of memory, HL holds the address of the new last usable byte. AF and B are corrupt, and all other registers are preserved Notes: The ROM select address must be in the range of 0 to 15 (or 1 to 7 for the 464) although address 7 is tor the AMSDOS/CPM ROM if present. The ROM's initialisation routine is then called and some memory may be reserved for the ROM by adjusting the values of DE and HL before returning control to KL INlT BACK 155 &BCD1 KL LOG EXT Action: Logs on a new RSX to the firmware Entry: BC contains the address of the RSX's command table, HL contains the address of four bytes exclusively for use by the firmware Exit: DE is corrupt, and all other registers are preserved 156 &BCD4 KL FIND COMMAND Action: Searches an RSX, background ROM or foreground ROM, to find a command in its table Entry: HL contains the address of the command name (in RAM only) which is being searched for Exit: If the narne was found in a RSX or background ROM then Carry is true, C contains the ROM select address, and HL contains the address of the routine; if the command was not found, then Carry is false, C and HL are corrupt; in either case, A, B and DE are corrupt, and all others are preserved Notes: The command names should be in upper case and the last character should have &80 added to it; the sequence of searching is RSXs, then ROMs with lower numbers before ROMs with higher numbers 157 &BCD7 KL NEW FRAME FLY Action: Sets up a frame flyback event block which will be acted on whenever a frame flyback occurs Entry: HL contains the address of the event block in the central 32K of RAM, B contains the event class. C contains the ROM select address (if any), and DE contains the address if the event routine Exit: AF, DE and HL are corrupt, and all other registers are preserved 158 &BCDA KL ADD FRAME FLY Action: Adds an existing but deleted frame flyback event block to the list of routines run when a frame flyback occurs Entry: HL contains the address of the event block (in the central 32K of RAM) Exit: AF, DE and HL are corrupt, and all others are preserved 159 &BCDD KL DEL FRAME FLY Action: Removes a frame flyback event block from the list of routines which are mn when a frame flyback occurs Entry: HL contains the address of the event block Exit: AF, DE and HL are corrupt, and all others are preserved 160 &BCE0 KL NEW FAST TICKER Action: Sets up a fast ticker event block which will be run whenever the l/300th second ticker interrupt occurs Entry: HL contains the address of the event block (in the central 32K of RAM), B contains the event class, C contains the ROM select address (if any), and DE contains the address of the event routine Exit: AF, DE and HL are corrupt, and all other registers are preserved 161 &BCE3 KL ADD FAST TICKER Action: Adds an existing but deleted fast ticker event block to the list of routines which are run when the l/300th sec ticker interrupt occurs Entry: HL contains the address of the event block Exit: AF, DE and HL are corrupt, and all the other registers are preserved 162 &BCE6 KL DEL FAST TICKER Action: Removes a fast ticker event block from the list of routines run when the l/300th sec ticker interrupt occurs Entry: HL contains the address of the event block Exit: AF, DE and HL are corrupt, and all others are preserved 163 &BCE9 KL ADD TICKER Action: Sets up a ticker event block which will be run whenever a 1/50th second ticker interrupt occurs Entry: HL contains the address of the event block (in the central 32K of RAM), DE contains the initial value for the counter, and BC holds the value that the counter will be given whenever it reaches zero Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved Notes: Every 1/50th of a second all the tick blocks are looked at and their counter is decreased by 1; when the counter reaches zero, the event is 'kicked' and the counter is loaded with the value in BC; any tick block with a counter of 0 is ignored, and therefore if the value in BC is 0, the event will be kicked only once and ignored after that 164 &BCEC KL DEL TICKER Action: Removes a ticker event block from the list of routines that are run when a l/50th sec ticker interrupt occurs Entry: HL contains the address of the event block Exit: If the event block was found, then Carry is true, and DE holds the value remaining of the counter; if the event block was not found, then Carry is false, and DE is corrupt; in both cases, A, HL and the other flags are corrupt, and all other registers are preserved 165 &BCEF KL INIT EVENT Action: Initialises an event block Entry: HL contains the address of the event block (in the central 32K of RAM), B contains the class of event, and C contains the ROM select address, and DE holds the address of the event routine Exit: HL holds the address of the event block+7, and all other registers are preserved Notes: The event class is derived as follows: bit 0 -indicates a near address bits 1 to 4 - hold the synchronous event priority bit 5 - always zero bit 6 - if bit 6 is set, then it is an express event bit 7 - if bit 7 is set, then it is an asynchronous event. Asynchronous events do not have priorities; if it is an express asynchronous event, then its event routine is called from the interrupt path; if it is a normal asynchronous event, then its event routine is called just before returning from the interrupt; if it is an express synchronous event, then it has a higher priority than normal synchronous events, and it may not be disabled through use of KL EVENT DISABLE; if the near address bit is set, then the routine is located in the central 32K of RAM and is called directly, so saving time; no event may have a priority of zero 166 &BCF2 KL EVENT Action: Kicks an event block Ently: HL contains the address of the event block Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 167 &BCF5 KL SYNC RESET Action: Clears the synchronous event queue Entry: No entry conditions Exit: AF and HL are corrupt, and all other registers are preserved Notes: When using this routine, all events that are waiting to be dealt with are simply discarded 168 &BCF8 KL DEL SYNCHRONOUS Action: Removes a synchronous event from the event queue Entry: HL contains the address of the event block Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 169 &BCFB KL NEXT SYNC Action: Finds out if there is a synchronous event with a higher priority Entry: No entry conditions Exit: If there is an event to be processed, then Carry is true, HL contains the address of the event block, and A contains the priority of the previous event; if there is no event to be processed, then Carry is false, and A and HL are corrupt; in either case, DE is corrupt, and all other registers are preserved 170 &BCFE KL DO SYNC Action: Runs a synchronous event routine Entry: HL contains the address of the event block Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: See KL DONE SYNC below 171 &BD01 KL DONE SYNC Action: Finishes running a synchronous event routine Entry: A contains the priority of the previous event, and HL contains the address of the event block Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: When an event that is waiting to be processed has been found by KL NEXT SYNC, the event routine should be run by KL DO SYNC; after this KL DONE SYNC should be called so that the event counter can be decreased - if the counter is greater than zero then the event is placed back on the synchronous event queue 172 &BD04 KL EVENT DISABLE Action: Disables norrnal synchronous events Entry: No entry conditions Exit: HL is corrupt, and all other registers are preserved 173 &BD07 KL EVENT ENABLE Action: Enables normal synchronous events Entry: No entry conditions Exit: HL is corrupt, and all other registers are preserved 174 &BD0A KL DISARM EVENT Action: Disarrns a specific event and stops it from occurring Entry: HL contains the address of the event block Exit: AF is corrupt, and all other registers are preserved Notes: This routine should be used to disarm only asynchronous events; see also KL DEL SYNCHRONOUS 175 &BD0D KL TIME PLEASE Action: Returns the time that has elapsed since the computer was switched on or reset (in 1/300ths of a second) Entry: No entry conditions Exit: DEHL contains the four byte count of the time elapsed, and all other registers are preserved Notes: D holds the most signifilcant byte of the time elapsed, and L holds the least significant; the four byte count overflows after approximately l66 days have elapsed. 176 &BD10 KL TIME SET Action: Sets the elapsed time (in l”300ths of a second) Entry: DEHL contains the four byte count of the time to set Exit: AF is corrupt, and all other registers are preserved The Machine Pack 177 &BD13 MC BOOT PROGRAM Action: Loads a program into RAM and then executes it Entry: HL contains the address of the routine which is used to load the program Exit: Control is handed over to the program and so the routine is not returned from Notes: All events, sounds and interrupts are turned off, the fiImware indirections are returned to their default settings, and the stack is reset; the routine to run the program should be in the central block of memory, and should obey the following exit conditions: if the program was loaded successfully, then Carry is true, and HL contains the prograrn entry point; if the program failed to load, then Carry is false, and HL is corrupt; in either case, A, BC, DE, IX, IY and the other flags are all corrupt Should the program fail to load, control is returned to the previous foreground program 178 &BD16 MC START PROGRAM Action: Runs a foreground program Entry: HL contains the entry point for the program, and C contains the ROM selection number Exit: Control is handed over to the prograrn and so the routine is not returned from 179 &BD19 MC WAIT FLYBACK Action: Waits until a frame flyback occurs Entry: No entry conditions Exit: All registers are preserved Notes: When the frame flyback occurs the screen is not being written to and so the screen c~n be manipulated during this period without any flickering or ghosting on the screen 180 &BD1C MC SET MODE Action: Sets the screen mode Entry: A contains the required mode Exit: AF is corrupt, and all other registers are preserved Notes: Although this routine changes the screen mode it does not inform the routines which write to the screen that the mode has been changed; therefore these routines will write to the screen as if the mode had not been changed; however as the hardware is now interpreting these signals differently, unusual effects may occur 181 &BD1F MC SCREEN OFFSET Action: Sets the screen offset Entry: A contains the screen base, and HL contains the screen offset Exit: AF is corrupt, and all other registers are preserved Notes: As with MC SET MODE, this routine changes the hardware setting without telling the routines that write to the screen; therefore these routines may cause unpredict- able effects if called; the default screen base is &C0 182 &BD22 MC CLEAR INKS Action: Sets all the PENs and the border to one colour, so making it seem as if the screen has been cleared Entry: DE contains the address of the ink vector Exit: AF is corrupt, and all other registers are preserved Notes: The ink vector takes the following form: byte 0 - holds the colour for the border byte 1 - holds the colour for all of the PENs The values for the colours are all given as hardware values 183 &BD25 MC SET INKS Action: Sets the colours of all the PENs and the border Entry: DE contains the address of the ink vector Exit: AF is corrupt, and all other registers are preserved Notes: The ink vector takes the following form: byte 0 - holds the colour for the border byte 1 - holds the colour for PEN 0... ... byte 16 - holds the colour for PEN 15 The values for the colours are all given as hardware values; the routine sets all sixteen PEN's 184 &BD28 MC RESET PRINTER Action: Sets the MC WAIT PRINTER indirection to its original routine Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all others are preserved 185 &BD2B MC PRINT CHAR Action: Sends a character to the printer and detects if it is busy for too long (more than 0.4 seconds) Entry: A contains the character to be printed - only charac- ters upto ASCII 127 can be printed Exit: If the character was sent properly, then Carry is true; if the printer was busy, then Carry is false; in either case, A and the other flags are corrupt, and all other registers are preserved Notes: This routine uses the MC WAIT PRINTER indirection 186 &BD2E MC BUSY PRINTER Action: Tests to see if the printer is busy Entry: No entry conditions Exit: If the printer is busy, then Carry is true; if the printer is not busy, then Carry is false; in both cases, the other flags are corrupt, and all other registers are preserved 187 &BD31 MC SEND PRINTER Action: Sends a character to the printer, which must not be busy Entry: A contains tlle character to be printed - only charac- ters up to ASCII 127 can be printed Exit: Carry is true, A and the other flags are corrupt, and all other registers are preserved 188 &BD34 MC SOUND REGISTER Action: Sends data to a sound chip register Entry: A contains the register nurnber, and C contains the data to be sent Exit: AF and BC are corrupt, and all other registers are preserved 189 &BD37 JUMP RESTORE Action: Restores the jumpblock to its default state Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: This routine does not affect the indirections jump- block, but restores all entries in the main jumpblock 664 and 6128 only 190 &BD3A KM SET LOCKS Action: Turns the shift and caps locks on and off Entry: H contains the caps lock state, and L contains the shift lock state Exit: AF is corrupt, and all others are preserved Notes: In this routine, &00 means turned off, and &FF means turned on 191 &BD3D KM FLUSH Action: Empties the key buffer Entry: No entry conditions Exit: AF is corrupt, and all other registers are preserved Notes: This routine also discards any current expansion string 192 &BD40 TXT ASK STATE Action: Gets the VDU and cursor state Entry: No entry conditions Exit: A contains the VDU and cursor state, the flags are corrupt, and all others are preserved Notes: The value in the A register is bit significant, as follows: if bit 0 is set, then the cursor is disabled, otherwise it is enabled if bit 1 is set, then the cursor is turned off, otherwise it is on if bit 7 is set, then the VDU is enabled, otherwise it is disabled 193 &BD43 GRA DEFAULT Action: Sets the graphics VDU to its default mode Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: Sets the background to opaque, the first point of line is plotted, lines aren't dotted, and the write mode is force 194 &BD46 GRA SET BACK Action: Sets the graphics background mode to either opaque or transparent Entry: A holds zero if opaque mode is wanted, or holds &FF to select transparent mode Exit: All registers are preserved 195 &BD49 GRA SET FIRST Action: Sets whether the first point of a line is plotted or not Entry: A holds zero if the first point is not to be plotted, or holds &FF if it is to be plotted Exit: All registers are preserved 196 &BD4C GRA SET LINE MASK Action: Sets how the points in a line are plotted - ie defines whether a line is dotted or not Entry: A contains the line mask that will be used when drawing lines Exit: All registers are preserved Notes: The first point in the line corresponds to bit 7 of the line mask and after bit 0 the mask repeats; if a bit is set then that point will be plotted; the mask is always applied from left to right, or from bottom to top 197 &BD4F GRA FROM USER Action: Converts user coordinates into base coordinates Entry: DE contains the user X coordinate, and HL contains the user Y coordinate Exit: DE holds the base X coordinate, and HL holds the base Y coordinate, AF is corrupt, and all others are preserved 198 &BD52 GRA FILL Action: Fills an area of the screen starting from the current graphics position and extending until it reaches either the edge of the window or a pixel set to the PEN Entry: A holds a PEN to fill with, HL holds the address of the buffer, and DE holds the length of the buffer Exit: If the area was filled properly, then Carry is true; if the area was not filled, then Carry is false; in either case, A, BC, DE, HL and the other flags are corrupt, and all others are preserved Notes: The buffer is used to store complex areas to fill, which are remembered and filled when the basic shape has been done; each entry in the buffer uses seven bytes and so the more complex the shape the larger the buffer; if it runs out of space to store these complex areas, it will fill what it can and then return with Carry false 199 &BD55 SCR SET POSITION Action: Sets the screen base and offset without telling the hardware Entry: A contains the screen base, and HL contains the screen offset Exit: A contains the masked screen base, and HL contains the masked screen offset, the flags are corrupt, and all other registers are preserved 200 &BD58 MC PRINT TRANSLATION Action: Sets how ASCII characters will be translated before being sent to the printer Entry: HL contains the address of the table Exit: If the table is too long, then Carry is false (ie more than 20 entries); if the table is correctly set out, then Carry is true; in either case, A, BC, DE, HL and the other flags are corrupt, and all others are preserved Notes: The first byte in the table is the number of entries; each entry requires two bytes, as follows: byte 0 - the character to be translated byte 1 - the character that is to be sent to the printer If the character to be sent to the printer is &FF, then the character is ignored and nothing is sent 201 &BD5B KL BANK SWITCH (6128 only) Action: Sets which RAM banks are being accessed by the Z80 Entry: A contains the organisation that is to be used Exit: A contains the previous organisation, the flags are corrupt, and all other registers are preserved The Firmware Indirections 000 &BDCD TXT DRAW CURSOR Action: Places the cursor on the screen, if the cursor is enabled Entry: No entry conditions Exit: AF is corrupt, and all other registers are preserved Notes: The cursor is an inverse blob which appears at the current text position 001 &BDD0 TXT UNDRAW CURSOR Action: Removes the cursor from the screen, if the cursor is enabled Entry: No entry conditions Exit: AF is corrupt, and all the other registers are preserved 002 &BDD3 TXT WRITE CHAR Action: Writes a character onto the screen Entry: A holds the character to be wntten, H holds the physical column number, and L holds the physical line number Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved 003 &BDD6 TXT UNWRITE Action: Reads a character from the screen Entry: H contains the physical column number, and L contains the physical line number to read from Exit: If a character was found, then Carry is true, and A contains the character; if no character was found, then Carry is false, and A contains zero; in either case, BC, DE, HL and the other nags are corrupt, and all other registers are preserved Notes: This routine works by comparing the image on the screen with the character matrices; therefore if the character matrices have been altered the routine may not find a readable a character 004 &BDD9 TXT OUT ACTION Action: Writes a character to the screen or obeys a control code (&00 to &1F) Entry: A contains the character or code Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: Control codes may take a maximum of nine parameters; when a control code is found, the required number of parameters is read into the control code buffer, and then the control code is acted upon; if the graphics character wnte mode is enabled, then characters and codes are printed using the graphics VDU; when using the graphics VDU control codes are printed and not obeyed 005 &BDDC GRA PLOT Action: Plots a point in the current graphics PEN Entry: DE contains the user X coordinate, and HL contains the user Y coordinate of the point Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: This routine uses the SCR WRITE indirection to write the point to the screen 006 &BDDF GRA TEST Action: Tests a point and finds out what PEN it is set to Entry: DE contains the user X coordinate, and HL contains the user Y coordinate of the point Exit: A contains the PEN that the point is written in, BC, DE and HL are corrupt, and all others are preserved Notes: This routine uses the SCR READ indirection to test a point on the screen 007 &BDE2 GRA LINE Action: Draws a line in the current graphics PEN, from the current graphics position to the specified point Entry: DE contains the user X coordinate, and HL contains the user Y coordinate for the endpoint Exit: AF, BC, DE and HL are corrupt, and all others are preserved Notes: This routine uses the SCR WRITE indirection to write the points of the line on the screen 008 &BDE5 SCR READ Action: Reads a pixel from the screen and returns its decode a PEN Entry: HL contains the screen address of the pixel, and C contains the mask for the pixel Exit: A contains the decoded PEN of the pixel, the flags are corrupt, and all others are preserved Notes: The mask should be for a single pixel, and is dependent on the screen mode 009 &BDE8 SCR WRITE Action: Writes one or more pixels to the screen Entry: HL contains the screen address of the pixel, C contains the mask, and B contains the encoded PEN Exit: AF is corrupt, and all other registers are preserved Notes: The mask should determine which pixels in the screen byte are to be plotted 010 &BDEB SCR MODE CLEAR Action: Fills the entire screen memory with &00, which clears the screen to PEN 0 Entry: No entry conditions Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved 011 &BDEE KM TEST BREAK Action: Tests if the ESC key has been pressed, and acts accordingly Entry: C contains the Shift and Control key states, and interrupts must be disabled Exit: AF and HL are corrupt, and all other registers are preserved Notes: If bit 7 of C is set, then the Control key is pressed; if bit 5 of C is set, then the Shift key is pressed; if ESC, Shift and Control are pressed at the sarne time, then it initiates a system reset; otherwise it reports a break event 012 &BDF1 MC WAIT PRINTER Action: Sends a character to the printer if it is not busy Entry: A contains the character to be sent to the printer Exit: If the character was printed successfully, then Carry is true; if the printer was busy for too long (more than 0.4 seconds), then Carry is false; in either case, A and BC are corrupt, and all other registers are preserved 013 &BDF4 KM SCAN KEYS Action: Scans the keyboard every 1/50th of a second, and updates the status of all keys Entry: All interrupts must be disabled Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved The Maths Firmware 000 &BDC1 MOVE REAL (&BD3D for the 464) Action: Copies the five bytes that are pointed to by DE to the location held in HL Entry: DE points to the source real value, and HL points to the destination Exit: HL points to the real value in the destination, Carry is true if the move went properly, F is corrupt, and all other registers are preserved Notes: For the 464 only, A holds the exponent byte of the real value when the routine is exited 001 &BD64 INTEGER TO REAL (&BD40 for the 464) Action: Converts an integer value into a real value Entry: HL holds the integer value, DE points to the desti- nation for the real value, bit 7 of A holds the sign of the integer value - it is taken to be negative if bit 7 is set Exit: HL points to the real value in the destination, AF and DE are corrupt, and all others are preserved 002 &BD67 BINARY TO REAL (&BD43 for the 464) Action: Converts a four byte binary value into a real value at the same location Entry: HL points to the binary value, bit 7 of A holds the sign of the binary value - negative if it is set Exit: HL points to the real value in lieu of the four byte binary value, AF is corrupt, and all others are preserved Notes: A four byte binary value is an unsigned integer up to &FFFFFFFF and is stored with the least significant byte first, and with the most significant byte last 003 &BD6A REAL TO INTEGER (&BD46 for the 464) Action: Converts a real value, rounding it into an unsigned integer value held in HL Entry: HL points to the real value Exit: HL holds the integer value, Carry is true if the conversion worked successfully, the Sign flag holds the sign of the integer (negative if it is set). A, IX and the other flags are corrupt, and all other registers are preserved Notes: This rounds the decimal part down if it is less than 0.5, but rounds up if it is greater than, or equal to 0.5 004 &BD6D REAL TO BINARY (&BD49 for the 464) Action: Converts a real value, rounding it into a four byte binary value at the same location Entry: HL points to the real value Exit: HL points to the binary value in lieu of the real value, bit 7 of B holds the sign for the binary value (it is negative if bit 7 is set), AF, B and IX are corrupt, and all other registers are preserved Notes: See REAL TO INTEGER for details of how the values are rounded up or down 005 &BD70 REAL FIX (&BD4C for the 464) Action: Performs an equivalent of BASIC's FIX function on a real value, leaving the result as a four byte binary value at the same location Entry: HL points to the real value Exit: HL points to the binary value in lieu of the real value, bit 7 of B has the sign of the binary value (it is negative if bit 7 is set), AF, B and IX are corrupt, and all others are preserved Notes: FIX removes any decimal part of the value, rounding down whether positive or negative - see the BASIC handbook for more details on the FIX command 006 &BD73 REAL INT (&BD4F for the 464) Action: Performs an equivalent of BASIC's INT function on a real value, leaving the result as a four byte binary value at the same location Entry: HL points to the real value Exit: HL points to the binary value in lieu of the real value, bit 7 of B has the sign of the binary value (it is negative if bit 7 is set), AF, B and IX are corrupt, and all others are preserved Notes: INT removes any decimal part of the value, rounding down if the nurnber is positive, but rounding up if it is negative 007 &BD76 INTERNAL SUBROUTINE - not useful (&BD52 for the 464) 008 &BD79 REAL *10^A (&BD55 for the 464) Action: Multiplies a real value by 10 to the power of the value in the A register, leaving the result at the same location Entry: HL points to the real value, and A holds the power of 10 Exit: HL points to the result, AF, BC, DE, IX and IY are corrupt 009 &BD7C REAL ADDITION (&BD58 for the 464) Action: Adds two real values, and leaves the result in lieu of the first real number Entry: HL points to the first real value, and DE points to the second real value Exit: HL points to the result, AF, BC, DE, IX and IY are corrupt 010 &BD82 REAL REVERSE SUBTRACTION (&BD5E for the 464) Action: Subtracts the first real value from the second real value, and leaves the result in lieu of the first number Entry: HL points to the first real value, and DE points to the second real value Exit: HL points to the result in place of the first real value, AF, BC, DE, IX and IY are corrupt 011 &BD85 REAL MULTIPLICATION (&BD61 for the 464) Action: Multiplies two real values together, and leaves the result in lieu of the first number Entry: HL points to the first real value, and DE points to the second real value Exit: HL points to the result in place of the first real value, AF, BC, DE, IX and IY are corrupt 012 &BD88 REAL DIVISION (&BD64 for the 464) Action: Divides the first real value by the second real value, and leaves the result in lieu of the first number Entry: HL points to the first real value, and DE points to the second real value Exit: HL points to the result in place of the first real value, AF, BC, DE, IX and IY are corrupt 013 &BD8E REAL COMPARISON (&BD6A for the 464) Action: Compares two real values Entry: HL points to the first real value, and DE points to the second real value Exit: A holds the result of the comparison process, IX, IY, and the other flags are corrupt, and all others are preserved Notes: After this routine has been called, the value in A depends on the result of the comparison as follows: if the first real number is greater than the second real number, then A holds &01 if the first real number is the same as the second real number, then A holds &00 if the second real number is greater than the first real number, then A holds &FF 014 &BD91 REAL UNARY MINUS (&BD6D for the 464) Action: Reverses the sign of a real value Entry: HL points to the real value Exit: HL points to the new value of the real number (which is stored in place of the original number), bit 7 of A holds the sign of the result (it is negative if bit 7 is set), AF and IX are corrupt, and all other registers are preserved 015 &BD94 REAL SIGNUM/SGN (&BD70 for the 464) Action: Tests a real value, and compares it with zero Entry: HL points to the real value Exit: A holds the result of this comparison process, IX and the other ”lags are corrupt, and all others are preserved Notes: After this routine has been called, the value in A depends on the result of the comparison as follows: if the real number is greater than 0, then A holds &01, Carry is false, and Zero is false if the real number is the same as 0, then A holds &00, Carry is false, and Zero is true if the real number is smaller than 0, then A holds &FF, Carry is true, and Zero is false 016 &BD97 SET ANGLE MODE (&BD73 for the 464) Action: Sets the angular calculation mode to either degrees (DEG) or radians (RAD) Entry: A holds the mode setting - 0 for RAD, and any other value for DEG Exit: All registers are preserved 017 &BD9A REAL PI (&BD76 for the 464) Action: Places the real value of pi at a given memory location Entry: HL holds the address at which the value of pi is to be placed Exit: AF and DE are corrupt, and all other registers are preserved 018 &BD9D REAL SQR (&BD79 for the 464) Action: Calculates the square root of a real value, leaving the result in lieu of the real value Entry: HL points to the real value Exit: HL points to the result of the calculation, AF, BC, DE, IX and IY are corrupt 019 &BDA0 REAL POWER (&BD7C for the 464) Action: Raises the first real value to the power of the second real value, leaving the result in lieu of the ”irst real value Entry: HL points to the first real value, and DE points to the second real value Exit: HL points to the result of the calculation, AF, BC, DE, IX and IY are corrupt 020 &BDA3 REAL LOG (&BD7F for the 464) Action: Returns the naperian logarithm (to base e) of a real value, leaving the result in lieu of the real value Entry: HL points to the real value Exit: HL points to the logarithrn that has been calculated, AF, BC, DE, LY and IY are corrupt 021 &BDA6 REAL LOG 10 (&BD82 for the 464) Action: Returns the logarithm (to base 10) of a real value, leaving the result in lieu of the real value Entry: HL points to the real value Exit: HL points to the logarithrn that has been calculated, AF, BC, DE, IX and IY are corrupt 022 &BDA9 REAL EXP (&BD85 for the 464) Action: Returns the antilogarithm (base e) of a real value, leaving the result in lieu of the real value Entry: HL points to the real value Exit: HL points to the antilogarithm that has been cal- culated, AF, BC, DE, IX and IY are corrupt Notes: See the BASIC handbook for details of EXP 023 &BDAC REAL SINE (&BD88 for the 464) Action: Returns the sine of a real value, leaving the result in lieu of the real value Entry: HL points to the real value (ie all angle) Exit: HL points to the sine value that has been calculated, AF, BC, DE, IX and IY are corrupt 024 &BDAF REAL COSINE (&BD8B for the 464) Action: Returns the cosine of a real value, leaving a the result in lieu of the real value Entry: HL points to the real value (ie an angle) Exit: HL points to the cosine value that has been calculated, AF, BC, DE, IX and IY are corrupt 025 &BDB2 REAL TANGENT (&BD8E for the 464) Action: Returns the tangent of a real value, leaving the result in lieu of the real value Entry: HL points to the real value (ie an angle) Exit: HL points to the tangent value that has been cal- culated, AF, BC, DE, IX and IY are corrupt 026 &BDB5 REAL ARCTANGENT (&BD91 for the 464) Action: Returns the arctangent of a real value, leaving the result in lieu of the real value Entry: HL points to the real value (ie an angle) Exit: HL points to the arctangent value that has been calculated, AF, BC, DE, IX and IY are corrupt All of the above routines to calculate sine, cosine, tangent and arctangent are slightly inaccuarate 027 &BDB8 INTERNAL SUBROUTINE - not useful (&BD94 for the 464) 028 &BDBB INTERNAL SUBROUTINE - not useful (&BD97 for the 464) 029 &BDBE INTERNAL SUBROUTINE - not useful (&BD9A for the 464) Maths Routines 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 he 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 othenvise, 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 Exit: 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 Exit: 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 sarne 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 &BDBB INTEGER DIVISION 2 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: DE 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 &BDBE 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 Notes: After this routine has been called, the value in A depends on the result of the comparison as follows: if the first real number is greater than the second real number, then A holds &01 if the first real number is the sarne 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 Notes: After this routine has been called, the value in A depends on the result of the comparison as follows: if the integer number is greater than 0 and is less than &8000, then A holds &01 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 Entry: HL points to the start of the buffer - a NUL character must be placed after any characters already present, or at the start of the buffer if there is no text Exit: A has the last key pressed, HL points to the start of the buffer, the flags are corrupt, and all others are preserved Notes: This routine prints any existing contents of the buffer (upto the NUL character) and then echoes any keys used; it allows full line editing with the cursor keys and DEL, etc; it is exited only by use of ENTER or ESC &BD7F REAL RND Action: Creates a new RND real value at a location pointed to by HL Entry: HL points to the destination for the result Exit: HL points to the RND value, AF, BC, DE and IX registers are corrupt; and all others are preserved &BD8B REAL RND(0) Action: Returns the last RND value created, and puts it in a location pointed to by HL Entry: HL points to the place where the value is to be returned to Exit: HL points to the value created, AF, DE and IX are corrupt, and all other registers are preserved Notes: See the BASIC handbook for more details on RND(0) AMSDOS and BIOS Firmware A &C033 BIOS SET MESSAGE Action: Enables or disables disc error messages Entry: To enable messages, A holds &00; to disable messages, A holds &FF Exit: A holds the previous state, HL and the flags are corrupt, and all others are preserved Notes: Enabling and disabling the messages can also be achieved by poking &BE78 with &00 or &FF B &C036 BIOS SETUP DISC Action: Sets the parameters which effect the disc speed Entry: HL holds the address of the nine bytes which make up the parameter block Exit: AF, BC, DE and HL are corrupt, and all other registers are preserved Notes: The parameter block is arranged as follows: bytes 0&1 - the motor on time in 20ms units; the default is &0032; the fastest is &0023 bytes 2&3 - the motor off time in 20ms units; the default is &00FA; the fastest is &00C8 byte 4 - the write off time in l0ęs units; the default is &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 C &C039 BIOS SELECT FORMAT Action: Sets a format for a disc Entry: A holds the type of format that is to be selected Exit: AF, BC, DE and HL are corrupt, and all the other registers are preserved Notes: To select one of the normal disc formats, the following values should be put into the A register: Data format - &C1 System format - &41 - Used by CP/M IBM format - &01 - compatible with CP/M-86 This routine sets the extended disc parameter block (XDPB) at &A890 to &A8A8 - to set other formats, the XDPB must be altered directly D &C03C BIOS READ SECTOR Action: Reads a sector from a disc into memory Entry: HL holds the address in memory where the sector will be read to, E holds the drive number (&00 for drive A, and &01 for drive B), D holds the track number, and C holds the sector number Exit: If the sector was read properly, then Carry is true, A holds 0, and HL is preserved; if the read failed, then Carry is false, A holds an error number, and HL is corrupt; in either case, the other flags are corrupt, and all other registers are preserved E &C03F BIOS WRITE SECTOR Action: Writes a sector from memory onto disc Entry: HL holds the address of memory which will be written to the disc, E holds the drive number (&00 for drive A, and &01 for drive B), D holds the track number, and C holds the sector number Exit: If the sector was written properly, then Carry is true, A holds 0, and HL is preserved; if the write failed, then Carry is false, A holds an error number, and HL is corrupt; in either case, the other flags are corrupt, and all other registers are preserved F &C042 BIOS FORMAT TRACK Action: Formats a complete track, inserts sectors, and fills the track with bytes of &E5 Entry: HL contains the address of the header information buffer which holds the header information blocks, E contains the drive number (&00 for drive A, and &01 for drive B), and D holds the track number Exit: if the formatting process was successful, then Carry is true, A holds 0, and HL is preserved; if the formatting process failed, then Carry is false, A holds an error number, and HL is corrupt; in either case, the other flags are corrupt, and all the other registers are preserved Notes: The header information block is laid out as follows: byte 0 - holds the track number byte 1 - holds the head number (set to zero) byte 2 - holds the sector number byte 3 - holds log2(sector size) -7 (usually either &02=512 bytes, or &03=1024 bytes). Header information blocks must be set up contiguously for every sector on the track, and in the same sequence that they are to be laid down (eg &C1, &C6, &C2, &C7, &C3, &C8, &C4, &C9, &C5) G &C045 BIOS MOVE TRACK Action: Moves the disc drive head to the specified track Entry: E holds the drive number (&00 for drive A, and &01 for drive B), and D holds the track number Exit: If the head was moved successfully, then Carry is true, A holds 0, and HL is preserved; if the move failed, then Carry is false, A holds an error number, and HL is corrupt; in both cases, the other flags are corrupt, and all other registers are preserved Notes: There is normally no need to call this routine as READ SECTOR, WRITE SECTOR and FORMAT TRACK automatically move the head to the correct position H &C048 BIOS GET STATUS Action: Returns the status of the specified drive Entry: A holds the drive number (&00 for drive A, and &01 for drive B) Exit: If Carry is true, then A holds the status byte, and HL is preserved; if Carry is false, then A is corrupt, and HL holds the address of the byte before the status byte; in either case, the other flags are preserved, and all other registers are preserved Notes: The status byte indicates the drive's status as follows: if bit 6 is set, then either the write protect is set or the disc is missing if bit 5 is set, then the drive is ready and the disc is fitted (whether the disc is formatted or not) if bit 4 is set, then the head is at track 0 I &C04B BIOS SET RETRY COUNT Action: Sets the number of times the operation is retried in the event of disc error Entry: A holds the number of retries required Exit: A holds the previous number of retries, HL and the flags are corrupt, and all others are preserved Notes: The default setting is &10, and the minimum setting is &01; the number of retries can also be altered by poking &BE66 with the required value J &C56C GET SECTOR DATA Action: Gets the data of a sector on the current track Entry: E holds the drive number Exit: If a formatted disc is present, then Carry is true, and HL is preserved; if an unforrnatted disc is present or the disc is missing, then Carry is false, and HL holds the address of the byte before the status byte; in either case, A and the other flags are corrupt, and all other registers are preserved Notes: The track number is held at &BE4F, the head number is held at &BE50, the sector number is held at &BE51, and the log2(sector size)-7 is held at &BE52; disc para- meters do not need to be set to the format of the disc; this routine is best used with the disc error messages turned off Instruction Set for the Z80 Microprocessor The following list contains all the normal machine code instruc- tions for the microprocessor, plus a number of undocumented ones. The latter comprise those which operate on the high or low bytes of the Index registets (IX and lY) 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 instructions, a number of abbreviations are used: d ...... displacement (a value from -128 (&80) to +127 (&7F)) n ...... a single byte value (from 0 (&00) to 255 (&FF)) hilo ... a double byte value (from -32769 (&8000) via 0 to 65535 (&FFFF)) addr ... an address value (from 0 (&0000) to 65535 (&FFFF)) (in the sequence of opcode bytes, 'addr' and 'hilo' are entered low byte first) The next two colurnns 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 distinguised 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 requrred when B<>0' The Flag Register The last columns give the effect on the flag bits which each instruction causes: ? ...... means the setting of the bit is unpredicatable - ...... 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 concemed contains an even number of set bits v ...... if an overflow has occured in Two's Complement arithrnetic BC ..... if BC is not zero A80 .... if the A register was &80 before this instruction was perforrned i ...... to the contents of the rnicroprocessor'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 tbe A register was &00 before this instruction was performed Z80 OPCODES Instruction ³ Opcode ³ B ³ Ticks ³ S ³ Z ³ P ³ C ÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÅÄÄÄÄÄÅÄÄ ADC A,(HL) ³ 8E ³ 1 ³ 7 ³ 7 ³ z ³ v ³ c ADC A,(IX+d) ³ DD 8E d ³ 3 ³ 19 ³ 7 ³ z ³ v ³ c ADC A,(IY+d) ³ FD 8E d ³ 3 ³ 19 ³ 7 ³ z ³ v ³ c ADC A,A ³ 8F ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,B ³ 88 ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,C ³ 89 ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,D ³ 8A ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,E ³ 8B ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,H ³ 8C ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,HIX ³ DD 8C ³ 2 ³ 8 ³ 7 ³ z ³ v ³ c ADC A,HIY ³ FD 8C ³ 2 ³ 8 ³ 7 ³ z ³ v ³ c ADC A,L ³ 8D ³ 1 ³ 4 ³ 7 ³ z ³ v ³ c ADC A,LIX ³ DD 8D ³ 2 ³ 8 ³ 7 ³ z ³ v ³ c ADC A,LIY ³ FD 8D ³ 2 ³ 8 ³ 7 ³ z ³ v ³ c ADC A,n ³ CE n ³ 2 ³ 7 ³ 7 ³ z ³ v ³ c ADC HL,BC ³ ED 4A ³ 2 ³ 15 ³ 15 ³ z ³ v ³ c ADC HL,DE ³ ED 5A ³ 2 ³ 15 ³ 15 ³ z ³ v ³ c ADC HL,HL ³ ED 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B 7E ³ 2 ³ 12 ³ ? ³ <>b ? ³ - BIT 7,(IX+d) ³ CB DD 7E d ³ 4 ³ 20 ³ ? ³ <>b ? ³ - BIT 7,(IY+d) ³ CB FD 7E d ³ 4 ³ 20 ³ ? ³ <>b ? ³ - BIT 7,A ³ CB 7F ³ 2 ³ 8 ³ ? ³ <>b ? ³ - BIT 7,B ³ CB 78 ³ 2 ³ 8 ³ ? ³ <>b ? ³ - BIT 7,C ³ CB 79 ³ 2 ³ 8 ³ ? ³ <>b ? ³ - BIT 7,D ³ CB 7A ³ 2 ³ 8 ³ ? ³ <>b ? ³ - BIT 7,E ³ CB 7B ³ 2 ³ 8 ³ ? ³ <>b ? ³ - BIT 7,H ³ CB 7C ³ 2 ³ 8 ³ ? ³ <>b ? ³ - BIT 7,L ³ CB 7D ³ 2 ³ 8 ³ ? ³ <>b ? ³ - CALL addr ³ CD dr ad ³ 3 ³ 17 ³ - ³ - ³ - ³ - CALL c,addr ³ DC dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL m,addr ³ FC dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL nc,addr ³ D4 dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL nz,addr ³ C4 dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL p,addr ³ F4 dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL p<>,addr³ E4 dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL pe,addr ³ EC dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CALL z,addr ³ CC dr ad ³ 3 ³ t17f10³ - ³ - ³ - ³ - CCF ³ 3F ³ 1 ³ 4 ³ - ³ - ³ - ³ x CP (HL) ³ BE ³ 1 ³ 7 ³ =7 ³ = ³ v ³ < CP (IX+d) ³ DD BE d ³ 3 ³ 19 ³ =7 ³ = ³ v ³ < CP (IY+d) ³ FD BE d ³ 3 ³ 19 ³ =7 ³ = ³ v ³ < CP A ³ B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³ 4 ³ 7 ³ z ³ v ³ - DEC DE ³ 1B ³ I ³ 6 ³ - ³ - ³ - ³ - DEC E ³ 1D ³ 1 ³ 4 ³ 7 ³ z ³ v ³ - DEC H ³ 25 ³ 1 ³ 4 ³ 7 ³ z ³ v ³ - DEC HIX ³ DD 25 ³ 2 ³ 8 ³ 7 ³ z ³ v ³ - DEC HIY ³ FD 25 ³ 2 ³ 8 ³ 7 ³ z ³ v ³ - DEC HL ³ 2B ³ 1 ³ 6 ³ - ³ - ³ - ³ - DEC IX ³ DD 2B ³ 2 ³ 10 ³ - ³ - ³ - ³ - DEC IY ³ FD 2B ³ 2 ³ 10 ³ - ³ - ³ - ³ - DEC L ³ 2D ³ 1 ³ 4 ³ 7 ³ z ³ v ³ - DEC LIX ³ DD 2D ³ 2 ³ 8 ³ 7 ³ z ³ v ³ - DEC LIY ³ FD 2D ³ 2 ³ 8 ³ 7 ³ z ³ v ³ - DEC SP ³ 3B ³ 1 ³ 6 ³ - ³ - ³ - ³ - DI ³ F3 ³ 1 ³ 4 ³ - ³ - ³ - ³ - DJNZ d ³ 10 d ³ 2 ³ t13f8 ³ - ³ - ³ - ³ - EI ³ FB ³ 1 ³ 4 ³ - ³ - ³ - ³ - EX (SP),HL ³ E3 ³ 1 ³ 19 ³ - ³ - ³ - ³ - EX (SP),IX ³ DD E3 ³ 2 ³ 23 ³ - ³ - ³ - ³ - EX (SP),IY ³ FD E3 ³ 2 ³ 23 ³ - ³ - ³ - ³ - EX AF,AF' ³ 08 ³ 1 ³ 4 ³ s' ³ z'³ p' ³ c' EX DE,HL ³ EB ³ 1 ³ 4 ³ - ³ - ³ - ³ - EXX ³ D9 ³ 1 ³ 4 ³ - ³ - ³ - ³ - HALT ³ 76 ³ 1 ³ min 4 ³ - ³ - ³ - ³ - IM 0 ³ ED 46 ³ 2 ³ 8 ³ - ³ - ³ - ³ - IM 1 ³ ED 56 ³ 2 ³ 8 ³ - ³ - ³ - ³ - IM 2 ³ ED 5E ³ 2 ³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³ - ³ - ³ - ³ - INC L ³ 2C ³ 1 ³ 4 ³ 7 ³ z ³ v ³ - INC LIX ³ DD 2C ³ 2 ³ 8 ³ 7 ³ z ³ v ³ - INC LIY ³ FD 2C ³ 2 ³ 8 ³ 7 ³ z ³ v ³ - INC SP ³ 33 ³ 1 ³ 6 ³ - ³ - ³ - ³ - IND ³ ED AA ³ 2 ³ 16 ³ ? ³ <>B ? ³ - INDR ³ ED BA ³ 2 ³ z16nz21 ? ³ 1 ³ ? ³ - INI ³ ED A2 ³ 2 ³ 16 ³ ? ³ <>B ? ³ - INIR ³ ED B2 ³ 2 ³ z16nz21 ? ³ 1 ³ ? ³ - JP (HL) ³ E9 ³ 1 ³ 4 ³ - ³ - ³ - ³ - JP (IX) ³ DD E9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - JP (IY) ³ FD E9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - JP addr ³ C3 dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP c,addr ³ DA dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP m,addr ³ FA dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP nc,addr ³ D2 dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP nz,addr ³ C2 dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP p,addr ³ F2 dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP p<>,addr ³ E2 dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP pe,addr ³ EA dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JP z,addr ³ CA dr ad ³ 3 ³ 10 ³ - ³ - ³ - ³ - JR c,d ³ 38 d ³ 2 ³ t12f7 ³ - ³ - ³ - ³ - JR d ³ 18 d ³ 2 ³ 12 ³ - ³ - ³ - ³ - JR nc,d ³ 30 d ³ 2 ³ t12f7 ³ - ³ - ³ - ³ - JR nz,d ³ 20 d ³ 2 ³ t12f7 ³ - ³ - ³ - ³ - JR z,d ³ 28 d ³ 2 ³ t12f7 ³ - ³ - ³ - ³ - LD (addr),A ³ 32 dr ad ³ 3 ³ 13 ³ - ³ - ³ - ³ - LD (addr),BC ³ ED 43 dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD (addr),DE ³ ED 53 dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD (addr),HL ³ 22 dr ad ³ 3 ³ 16 ³ - ³ - ³ - ³ - LD (addr),HL ³ ED 63 dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD (addr),IX ³ DD 22 dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD (addr),IY ³ FD 22 dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD (addr),SP ³ ED 73 dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD (BC),A ³ 02 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (DE),A ³ 12 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),A ³ 77 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),A ³ 77 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),B ³ 70 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),C ³ 71 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),D ³ 72 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),E ³ 73 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),H ³ 74 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),L ³ 75 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD (HL),n ³ 36 n ³ 2 ³ 10 ³ - ³ - ³ - ³ - LD (IX+d),A ³ DD 77 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),B ³ DD 70 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),C ³ DD 71 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),D ³ DD 72 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),E ³ DD 73 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),H ³ DD 71 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),L ³ DD 75 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IX+d),n ³ DD 36 d n ³ 4 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),A ³ FD 77 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),B ³ FD 70 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),C ³ FD 71 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),D ³ FD 72 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),E ³ FD 73 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),H ³ FD 74 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),L ³ FD 75 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD (IY+d),n ³ FD 36 d n ³ 4 ³ 19 ³ - ³ - ³ - ³ - LD A,(addr) ³ 3A dr ad ³ 3 ³ 13 ³ - ³ - ³ - ³ - LD A,(BC) ³ 0A ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD A,(DE) ³ 1A ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD A,(HL) ³ 7E ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD A,(HL) ³ 7E ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD A,(IX+d) ³ DD 7E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD A,(IY+d) ³ FD 7E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD A,A ³ 7F ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,B ³ 78 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,C ³ 79 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,D ³ 7A ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,E ³ 7B ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,H ³ 7C ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,HIX ³ DD 7C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD A,HIY ³ FD 7C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD A,I ³ ED 57 ³ 2 ³ 9 ³ 7 ³ z ³ i ³ 0 LD A,L ³ 7D ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD A,LIX ³ DD 7D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD A,LIY ³ FD 7D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD A,n ³ 3E n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD A,R ³ ED 5F ³ 2 ³ 9 ³ 7 ³ z ³ i ³ 0 LD B,(HL) ³ 46 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD B,(IX+d) ³ DD 46 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD B,(IY+d) ³ FD 46 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD B,A ³ 47 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,B ³ 40 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,C ³ 41 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,D ³ 42 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,E ³ 43 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,H ³ 44 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,HIX ³ DD 44 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD B,HIY ³ FD 44 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD B,L ³ 45 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD B,LIX ³ DD 45 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD B,LIY ³ FD 45 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD B,n ³ 06 n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD BC,(addr) ³ ED 4B dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD BC,hilo ³ 01 lo hi ³ 3 ³ 10 ³ - ³ - ³ - ³ - LD C,(HL) ³ 4E ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD C,(IX+d) ³ DD 4E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD C,(IY+d) ³ DD 4E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD C,A ³ 4F ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD C,B ³ 48 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD C,C ³ 49 ³ 1 ³ 1 ³ - ³ - ³ - ³ - LD C,D ³ 4A ³ 1 ³ 1 ³ - ³ - ³ - ³ - LD C,E ³ 4B ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD C,H ³ 4C ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD C,HIX ³ DD 4C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD C,HIY ³ FD 4C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD C,L ³ 4D ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD C,LIX ³ DD 4D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD C,LIY ³ FD 4D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD C,n ³ 0E n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD D,(HL) ³ 56 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD D,(IX+d) ³ DD 56 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD D,(IY+d) ³ FD 56 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD D,A ³ 57 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,B ³ 50 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,C ³ 51 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,D ³ 52 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,E ³ 53 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,H ³ 54 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,HIX ³ DD 54 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD D,HIY ³ FD 54 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD D,L ³ 55 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD D,LIX ³ DD 55 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD D,LIY ³ FD 55 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD D,n ³ 16 n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD DE,(addr) ³ ED 5B dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD DE,hilo ³ 11 lo hi ³ 3 ³ 10 ³ - ³ - ³ - ³ - LD E,(HL) ³ 5E ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD E,(IX+d) ³ DD 5E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD E,(IY+d) ³ FD 5E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD E,A ³ 5F ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,B ³ 58 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,C ³ 59 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,D ³ 5A ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,E ³ 5B ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,H ³ 5C ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,HIX ³ DD 5C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD E,HIY ³ FD 5C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD E,L ³ 5D ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD E,LIX ³ DD 5D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD E,LIY ³ FD 5D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD E,n ³ 1E n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD H,(HL) ³ 66 ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD H,(IX+d) ³ DD 66 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD H,(IY+d) ³ FD 66 d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD H,A ³ 67 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,B ³ 60 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,C ³ 61 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,D ³ 62 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,E ³ 63 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,H ³ 64 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,L ³ 65 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD H,n ³ 26 n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD HIX,A ³ DD 67 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,B ³ DD 60 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,C ³ DD 61 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,D ³ DD 62 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,E ³ DD 63 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,HIX ³ DD 64 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,LIX ³ DD 65 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIX,n ³ DD 26 n ³ 3 ³ 11 ³ - ³ - ³ - ³ - LD HIY,A ³ FD 67 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,B ³ FD 60 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,C ³ FD 61 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,D ³ FD 62 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,E ³ FD 63 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,HIY ³ FD 64 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,LIY ³ FD 65 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD HIY,n ³ FD 26 n ³ 3 ³ 11 ³ - ³ - ³ - ³ - LD HL,(addr) ³ 2A dr ad ³ 3 ³ 16 ³ - ³ - ³ - ³ - LD HL,(addr) ³ ED 6B dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD HL,hilo ³ 21 lo hi ³ 3 ³ 10 ³ - ³ - ³ - ³ - LD I,A ³ ED 47 ³ 2 ³ 9 ³ - ³ - ³ - ³ - LD IX,(addr) ³ DD 2A dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD IX,hilo ³ DD 2A lo hi³ 4 ³ 14 ³ - ³ - ³ - ³ - LD IY,(addr) ³ FD 2A dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD IY,hilo ³ FD 21 lo hi³ 4 ³ 14 ³ - ³ - ³ - ³ - LD L,(HL) ³ 6E ³ 1 ³ 7 ³ - ³ - ³ - ³ - LD L,(IX+d) ³ DD 6E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD L,(IY+d) ³ FD 6E d ³ 3 ³ 19 ³ - ³ - ³ - ³ - LD L,A ³ 6F ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,B ³ 68 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,C ³ 69 ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,D ³ 6A ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,E ³ 6B ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,H ³ 6C ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,L ³ 6D ³ 1 ³ 4 ³ - ³ - ³ - ³ - LD L,n ³ 2E n ³ 2 ³ 7 ³ - ³ - ³ - ³ - LD LIX,A ³ DD 6F ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,B ³ DD 68 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,C ³ DD 69 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,D ³ DD 6A ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,E ³ DD 6B ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,HIX ³ DD 6C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,LIX ³ DD 6D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIX,n ³ DD 2E n ³ 3 ³ 11 ³ - ³ - ³ - ³ - LD LIY,A ³ FD 6F ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,B ³ FD 68 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,C ³ FD 69 ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,D ³ FD 6A ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,E ³ FD 6B ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,HIY ³ FD 6C ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,LIY ³ FD 6D ³ 2 ³ 8 ³ - ³ - ³ - ³ - LD LIY,n ³ FD 2E n ³ 3 ³ 11 ³ - ³ - ³ - ³ - LD R,A ³ ED 4F ³ 2 ³ 9 ³ - ³ - ³ - ³ - LD SP,(addr) ³ ED 7B dr ad³ 4 ³ 20 ³ - ³ - ³ - ³ - LD SP,hilo ³ 31 lo hi ³ 3 ³ 10 ³ - ³ - ³ - ³ - LD SP,HL ³ F9 ³ 1 ³ 6 ³ - ³ - ³ - ³ - LD SP,IX ³ DD F9 ³ 2 ³ 10 ³ - ³ - ³ - ³ - LD SP,IY ³ FD F9 ³ 2 ³ 10 ³ - ³ - ³ - ³ - LDD ³ ED A8 ³ 2 ³ 16 ³ - ³ - ³ BC ³ - LDDR ³ ED B8 ³ 2 ³ z16nz21 - ³ - ³ 0 ³ - LDI ³ ED A0 ³ 2 ³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51 ³ 2 ³ 12 ³ - ³ - ³ - ³ - OUT (C),E ³ ED 59 ³ 2 ³ 12 ³ - ³ - ³ - ³ - OUT (C),H ³ ED 61 ³ 2 ³ 12 ³ - ³ - ³ - ³ - OUT (C),L ³ ED 69 ³ 2 ³ 12 ³ - ³ - ³ - ³ - OUT (n),A ³ D3 n ³ 2 ³ 11 ³ - ³ - ³ - ³ - OUTD ³ ED AB ³ 2 ³ 16 ³ ? ³ <>B ? ³ - OUTI ³ ED A3 ³ 2 ³ 16 ³ ? ³ <>B ? ³ - POP AF ³ F1 ³ 1 ³ 10 ³ [POP flags] ³ POP BC ³ C1 ³ 1 ³ 10 ³ - ³ - ³ - ³ - POP DE ³ D1 ³ 1 ³ 10 ³ - ³ - ³ - ³ - POP HL ³ E1 ³ 1 ³ 10 ³ - ³ - ³ - ³ - POP IX ³ DD E1 ³ 2 ³ 14 ³ - ³ - ³ - ³ - POP IY ³ FD E1 ³ 2 ³ 14 ³ - ³ - ³ - ³ - PUSH AF ³ F5 ³ 1 ³ 11 ³ - ³ - ³ - ³ - PUSH BC ³ C5 ³ 1 ³ 11 ³ - ³ - ³ - ³ - PUSH DE ³ D5 ³ 1 ³ 11 ³ - ³ - ³ - ³ - PUSH HL ³ E5 ³ 1 ³ 11 ³ - ³ - ³ - ³ - PUSH IX ³ DD E5 ³ 2 ³ 15 ³ - ³ - ³ - ³ - PUSH IY ³ FD E5 ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 0,(HL) ³ CB 86 ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 0,(IX+d) ³ DD CB d 86 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 0,(IY+d) ³ FD CB d 86 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 0,A ³ CB 87 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 0,B ³ CB 80 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 0,C ³ CB 81 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 0,D ³ CB 82 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 0,E ³ CB 83 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 0,H ³ CB 81 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 0,L ³ CB 85 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,(HL) ³ CB 8E ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 1,(IX+d) ³ DD CB d 8E ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 1,(IY+d) ³ FD CB d 8E ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 1,A ³ CB 8F ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,B ³ CB 88 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,C ³ CB 89 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,D ³ CB 8A ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,E ³ CB 8B ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,H ³ CB 8C ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 1,L ³ CB 8D ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,(HL) ³ CB 96 ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 2,(IX+d) ³ DD CB d 96 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 2,(IY+d) ³ FD CB d 96 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 2,A ³ CB 97 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,B ³ CB 90 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,C ³ CB 91 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,D ³ CB 92 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,E ³ CB 93 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,H ³ CB 94 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 2,L ³ CB 95 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,(HL) ³ CB 9E ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 3,(IX+d) ³ DD CB d 9E ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 3,(IY+d) ³ FD CB d 9E ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 3,A ³ CB 9F ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,B ³ CB 98 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,C ³ CB 99 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,D ³ CB 9A ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,E ³ CB 9B ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,H ³ CB 9C ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 3,L ³ CB 9D ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,(HL) ³ CB A6 ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 4,(IX+d) ³ DD CB d A6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 4,(IY+d) ³ FD CB d A6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 4,A ³ CB A7 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,B ³ CB A0 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,C ³ CB A1 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,D ³ CB A2 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,E ³ CB A3 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,H ³ CB A4 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 4,L ³ CB A5 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,(HL) ³ CB AE ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 5,(IX+d) ³ DD CB d AE ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 5,(IY+d) ³ FD CB d AE ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 5,A ³ CB AF ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,B ³ CB A8 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,C ³ CB A9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,D ³ CB AA ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,E ³ CB AB ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,H ³ CB AC ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 5,L ³ CB AD ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,(HL) ³ CB B6 ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 6,(IX+d) ³ DD CB d B6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 6,(IY+d) ³ FD CB d B6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 6,A ³ CB B7 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,B ³ CB B0 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,C ³ CB B1 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,D ³ CB B2 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,E ³ CB B3 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,H ³ CB B4 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 6,L ³ CB B5 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,(HL) ³ CB BE ³ 2 ³ 15 ³ - ³ - ³ - ³ - RES 7,(IX+d) ³ DD CB d BE ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 7,(IY+d) ³ FD CB d BE ³ 4 ³ 23 ³ - ³ - ³ - ³ - RES 7,A ³ CB BF ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,B ³ CB B8 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,C ³ CB B9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,D ³ CB BA ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,E ³ CB BB ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,H ³ CB BC ³ 2 ³ 8 ³ - ³ - ³ - ³ - RES 7,L ³ CB BD ³ 2 ³ 8 ³ - ³ - ³ - ³ - RET ³ C9 ³ 1 ³ 10 ³ - ³ - ³ - ³ - RET C ³ D8 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET M ³ F8 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET NC ³ D0 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET NZ ³ C0 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET P ³ F0 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET PE ³ E8 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET PO ³ E0 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RET Z ³ C8 ³ 1 ³ t11f8 ³ - ³ - ³ - ³ - RETI ³ ED 4D ³ 2 ³ 14 ³ - ³ - ³ - ³ - RETN ³ ED 45 ³ 2 ³ 14 ³ - ³ - ³ - ³ - RL (HL) ³ CB 16 ³ 2 ³ 15 ³ 7 ³ z ³ p ³ r7 RL (IX+d) ³ DD CB d 16 ³ 4 ³ 23 ³ 7 ³ z ³ p ³ r7 RL (IY+d) ³ FD CB d 16 ³ 4 ³ 23 ³ 7 ³ z ³ p ³ r7 RL A ³ CB 17 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r7 RL B ³ CB 10 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r7 RL C ³ CB 11 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r7 RL D ³ CB 12 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r7 RL E ³ CB 13 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r7 RL H ³ CB 14 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r7 RL L ³ CB 15 ³ 2 ³ 8 ³ 7 ³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 ³ z ³ p ³ r0 RRA ³ 1F ³ 1 ³ 4 ³ - ³ - ³ - ³ r0 RRC (HL) ³ CB 0E ³ 2 ³ 15 ³ 7 ³ z ³ p ³ r0 RRC (IX+d) ³ DD CB d 0E ³ 4 ³ 23 ³ 7 ³ z ³ p ³ r0 RRC (IY+d) ³ FD CB d 0E ³ 4 ³ 23 ³ 7 ³ z ³ p ³ r0 RRC A ³ CB 0F ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRC B ³ CB 08 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRC C ³ CB 09 ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRC D ³ CB 0A ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRC E ³ CB 0B ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRC H ³ CB 0C ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRC L ³ CB 0D ³ 2 ³ 8 ³ 7 ³ z ³ p ³ r0 RRCA ³ 0F ³ 1 ³ 4 ³ - ³ - ³ - ³ r0 RRD ³ ED 67 ³ 2 ³ 18 ³ 7 ³ z ³ p ³ - RST 0 ³ C7 ³ 1 ³ 11 ³ - ³ - ³ - ³ - RST 1,addr ³ CF dr ad ³ 3 ³ (11) ³ - ³ - ³ - ³ - RST 2,addr ³ D7 dr ad ³ 3 ³ (11) ³ - ³ - ³ - ³ - RST 3,addr ³ DF dr ad ³ 3 ³ (11) ³ - ³ - ³ - ³ - RST 4 ³ E7 ³ 1 ³ 11 ³ - ³ - ³ - ³ - RST 5,addr ³ EF dr ad ³ 3 ³ (11) ³ - ³ - ³ - ³ - RST 6 ³ F7 ³ 1 ³ 11 ³ - ³ - ³ - ³ - RST 7 ³ FF ³ 1 ³ 11 ³ - ³ - ³ - ³ - SBC A,(HL) ³ 9E ³ 1 ³ 7 ³ 7 ³ z ³ v ³ b SBC A,(IX+d) ³ DD 9E d ³ 3 ³ 19 ³ 7 ³ z ³ v ³ b SBC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C ³ CB C1 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 0,D ³ CB C2 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 0,E ³ CB C3 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 0,H ³ CB C4 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 0,L ³ CB C5 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,(HL) ³ CB CE ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 1,(IX+d) ³ DD CB d CE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 1,(IY+d) ³ FD CB d CE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 1,A ³ CB CF ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,B ³ CB C8 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,C ³ CB C9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,D ³ CB CA ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,E ³ CB CB ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,H ³ CB CC ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 1,L ³ CB CD ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,(HL) ³ CB D6 ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 2,(IX+d) ³ DD CB d D6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 2,(IY+d) ³ FD CB d D6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 2,A ³ CB D7 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,B ³ CB D0 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,C ³ CB D1 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,D ³ CB D2 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,E ³ CB D3 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,H ³ CB D4 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 2,L ³ CB D5 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,(HL) ³ CB DE ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 3,(IX+d) ³ DD CB d DE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 3,(IY+d) ³ FD CB d DE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 3,A ³ CB DF ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,B ³ CB D8 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,C ³ CB D9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,D ³ CB DA ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,E ³ CB DB ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,H ³ CB DC ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 3,L ³ CB DD ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,(HL) ³ CB E6 ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 4,(IX+d) ³ DD CB d E6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 4,(IY+d) ³ FD CB d E6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 4,A ³ CB E7 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,B ³ CB E0 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,C ³ CB E1 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,D ³ CB E2 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,E ³ CB E3 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,H ³ CB E4 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 4,L ³ CB E5 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,(HL) ³ CB EE ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 5,(IX+d) ³ DD CB d EE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 5,(IY+d) ³ FD CB d EE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 5,A ³ CB EF ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,B ³ CB E8 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,C ³ CB E9 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,D ³ CB EA ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,E ³ CB EB ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,H ³ CB EC ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 5,L ³ CB ED ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,(HL) ³ CB F6 ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 6,(IX+d) ³ DD CB d F6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 6,(IY+d) ³ FD CB d F6 ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 6,A ³ CB F7 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,B ³ CB F0 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,C ³ CB F1 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,D ³ CB F2 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,E ³ CB F3 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,H ³ CB F4 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 6,L ³ CB F5 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 7,(HL) ³ CB FE ³ 2 ³ 15 ³ - ³ - ³ - ³ - SET 7,(IX+d) ³ DD CB d FE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 7,(IY+d) ³ FD CB d FE ³ 4 ³ 23 ³ - ³ - ³ - ³ - SET 7,A ³ CB FF ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 7,B ³ CB F8 ³ 2 ³ 8 ³ - ³ - ³ - ³ - SET 7,C ³ CB F9 ³ 2 ³ 8 ³ - ³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³ 0 XOR HIY ³ FD AD ³ 2 ³ 8 ³ 7 ³ z ³ p ³ 0 XOR L ³ AD ³ 1 ³ 4 ³ 7 ³ z ³ p ³ 0 XOR LIX ³ DD AC ³ 2 ³ 8 ³ 7 ³ z ³ p ³ 0 XOR LIY ³ FD AD ³ 2 ³ 8 ³ 7 ³ z ³ p ³ 0 XOR n ³ EE n ³ 2 ³ 7 ³ 7 ³ z ³ p ³ 0 * - the opcode given for XOR (HL) in the paper version of the guide is AC, the same as that given for XOR H. The code for XOR (HL) should be AE, according to Rodnay Zaks' book "PROGRAMMING THE Z80", (pub Sydex, ISBN 0-89588-069-5) The flag register is bit significant, and is defined as follows: bit 7 - Sign 6 - Zero 5 - unused 4 - Half Carry (cannot test) 3 - unused 2 - Parity/Overflow 1 - Add/Subtract (cannot test) 0 - Carry Snippets To unerase files - Poke &A701 with &E5, CAT the disc, and try to load the file you want. Save it back to USER 0 if it loads correctly. If it fails to load, it is probably that it has already been written over by another file. To disable ESC - Poke &BDEE with &C9. To restore ESC, poke the same address with &C3 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 Reg ³ Function ³ Default value ÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄ R0 ³ Horizontal Total ³ 63 R1 ³ Horizontal Displayed ³ 40 R2 ³ Horizontal Sync Pos. ³ 46 R3 ³ Sync Width ³ 112 R4 ³ Vertical Total ³ 38 R5 ³ Vertical Total Adjust ³ 0 R6 ³ Vertical Displayed ³ 25 R7 ³ Vertical Sync Position ³ 30 R8 ³ Interlace and Skew ³ 0 R9 ³ Maximum Raster Addr ³ 7 R10 ³ Cursor Start Raster ³ 0 R11 ³ Cursor End Raster ³ 0 R12 ³ Start Address (H) ³ 48 R13 ³ Start Address (L) ³ 0 R14 ³ Cursor Register (H) ³ 192 R15 ³ Cursor Register (L) ³ 07