UNPKG

@nataliapc/mcp-openmsx

Version:

Model context protocol server for openMSX automation and control

847 lines (641 loc) 149 kB
# 4. ROM BIOS The design of the MSX ROM is of importance if machine code programs are to be developed efficiently and Operate reliably. Almost every program, including the BASIC Interpreter itself, will require a certain set of primitive functions to operate. These include screen and printer drivers, a keyboard decoder and other hardware related functions. By separating these routines from the BASIC Interpreter they can be made available to any application program. The section of ROM from 0000H to 268BH is largely devoted to such routines and is called the ROM BIOS (Basic Input Output System). This chapter gives a functional description of every recognizably separate routine in the ROM BIOS. Special attention is given to the "standard" routines. These are documented by Microsoft and guaranteed to remain consistent through possible hardware and software changes. The first few hundred bytes of the ROM consists of Z80 JP instructions which provide fixed position entry points to these routines. For maximum compatibility with future software an application program should restrict its dependence on the ROM to these locations only. The description of the ROM begins with this list of entry points to the standard routines. A brief comment is placed with each entry point, the full description is given with the routine itself. <a name="data_areas"></a> ## Data Areas It is expected that most users will wish to disassemble the ROM to some extent (the full listing runs to nearly four hundred pages). In order to ease this process the data areas, which do not contain executable Z80 code, are shown below: ``` 0004H-0007H 185DH-1863H 4B3AH-4B4CH 73E4H-73E4H 002BH-002FH 1B97H-1BAAH 4C2FH-4C3FH 752EH-7585H 0508H-050DH 1BBFH-23BEH 555AH-5569H 7754H-7757H 092FH-097FH 2439H-2459H 5D83H-5DB0H 7BA3H-7BCAH 0DA5H-0EC4H 2CF1H-2E70H 6F76H-6F8EH 7ED8H-7F26H 1033H-105AH 3030H-3039H 70FFH-710CH 7F41H-7FB6H 1061H-10C1H 3710H-3719H 7182H-7195H 7FBEH-7FFFH 1233H-1252H 392EH-3FE1H 71A2H-71B5H 13A9H-1448H 43B5H-43C3H 71C7H-71DAH 160BH-1612H 46E6H-46E7H 72A6H-72B9H ``` Note that these data areas are for the UK ROM, there are slight differences in the Japanese ROM relating to the keyboard decoder and the video character set. Disparities between the ROMs are restricted to these regions with the bulk of the code being identical in both cases. <a name="terminology"></a> ## Terminology Reference is frequently made in this chapter to the standard routines and to Workspace Area variables. Whenever this is done the Microsoft-recommended name is used in upper case letters, for example "the [FILVRM](#filvrm) standard routine" and "[SCRMOD](#scrmod) is set". Subroutines which are not named are referred to by a parenthesized address, "the screen is cleared ([0777H](#0777h))" for example. When reference is made to the Z80 status flags assembly language conventions are used, for example "Flag C" would mean that the carry flag is set while "Flag NZ" means that the zero flag is reset. The terms "EI" and "DI" mean enabled interrupts and disabled interrupts respectively. |ADDRESS |NAME |TO |FUNCTION |:---------:|:-----------------:|:-----------------:|-------------------------------------- |0000H |[CHKRAM](#chkram) |[02D7H](#02d7h) |Power-up, check RAM |0004H |...... |..... |Two bytes, address of ROM character set |0006H |...... |..... |One byte, VDP [Data Port](#data_port) number |0007H |...... |..... |One byte, VDP [Data Port](#data_port) number |0008H |[SYNCHR](#synchr) |[2683H](#2683h) |Check BASIC program character |000BH |...... |..... |NOP |000CH |[RDSLT](#rdslt) |[01B6H](#01b6h) |Read RAM in any slot |000FH |...... |..... |NOP |0010H |[CHRGTR](#chrgtr) |[2686H](#2686h) |Get next BASIC program character |0013H |...... |..... |NOP |0014H |[WRSLT](#wrslt) |[01D1H](#01d1h) |Write to RAM in any slot |0017H |...... |..... |NOP |0018H |[OUTDO](#outdo) |[1B45H](#1b45h) |Output to current device |001BH |...... |..... |NOP |001CH |[CALSLT](#calslt) |[0217H](#0217h) |Call routine in any slot |001FH |...... |..... |NOP |0020H |[DCOMPR](#dcompr) |[146AH](#146ah) |Compare register pairs HL and DE |0023H |...... |..... |NOP |0024H |[ENASLT](#enaslt) |[025EH](#025eh) |Enable any slot permanently |0027H |...... |..... |NOP |0028H |[GETYPR](#getypr) |[2689H](#2689h) |Get BASIC operand type |002BH |...... |..... |Five bytes Version Number |0030H |[CALLF](#callf) |[0205H](#0205h) |Call routine in any slot |0033H |...... |..... |Five NOPs |0038H |[KEYINT](#keyint) |[0C3CH](#0c3ch) |Interrupt handler, keyboard scan |003BH |[INITIO](#initio) |[049DH](#049dh) |Initialize I/O devices |003EH |[INIFNK](#inifnk) |[139DH](#139dh) |Initialize function key strings |0041H |[DISSCR](#disscr) |[0577H](#0577h) |Disable screen |0044H |[ENASCR](#enascr) |[0570H](#0570h) |Enable screen |0047H |[WRTVDP](#wrtvdp) |[057FH](#057fh) |Write to any VDP register |004AH |[RDVRM](#rdvrm) |[07D7H](#07d7h) |Read byte from VRAM |004DH |[WRTVRM](#wrtvrm) |[07CDH](#07cdh) |Write byte to VRAM |0050H |[SETRD](#setrd) |[07ECH](#07ech) |Set up VDP for read |0053H |[SETWRT](#setwrt) |[07DFH](#07dfh) |Set up VDP for write |0056H |[FILVRM](#filvrm) |[0815H](#0815h) |Fill block of VRAM with data byte |0059H |[LDIRMV](#ldirmv) |[070FH](#070fh) |Copy block to memory from VRAM |005CH |[LDIRVM](#ldirvm) |[0744H](#0744h) |Copy block to VRAM, from memory |005FH |[CHGMOD](#chgmod) |[084FH](#084fh) |Change VDP mode |0062H |[CHGCLR](#chgclr) |[07F7H](#07f7h) |Change VDP colours |0065H |...... |..... |NOP |0066H |[NMI](#nmi) |[1398H](#1398h) |Non Maskable Interrupt handler |0069H |[CLRSPR](#clrspr) |[06A8H](#06a8h) |Clear all sprites |006CH |[INITXT](#initxt) |[050EH](#050eh) |Initialize VDP to [40x24 Text Mode](#40x24_text_mode) |006FH |[INIT32](#init32) |[0538H](#0538h) |Initialize VDP to [32x24 Text Mode](#32x24_text_mode) |0072H |[INIGRP](#inigrp) |[05D2H](#05d2h) |Initialize VDP to [Graphics Mode](#graphics_mode) |0075H |[INIMLT](#inimlt) |[061FH](#061fh) |Initialize VDP to [Multicolour Mode](#multicolor_mode) |0078H |[SETTXT](#settxt) |[0594H](#0594h) |Set VDP to [40x24 Text Mode](#40x24_text_mode) |007BH |[SETT32](#sett32) |[05B4H](#05b4h) |Set VDP to [32x24 Text Mode](#32x24_text_mode) |007EH |[SETGRP](#setgrp) |[0602H](#0602h) |Set VDP to [Graphics Mode](#graphics_mode) |0081H |[SETMLT](#setmlt) |[0659H](#0659h) |Set VDP to [Multicolour Mode](#multicolour_mode) |0084H |[CALPAT](#calpat) |[06E4H](#06e4h) |Calculate address of sprite pattern |0087H |[CALATR](#calatr) |[06F9H](#06f9h) |Calculate address of sprite attribute |008AH |[GSPSIZ](#gspsiz) |[0704H](#0704h) |Get sprite size |008DH |[GRPPRT](#grpprt) |[1510H](#1510h) |Print character on graphic screen |0090H |[GICINI](#gicini) |[04BDH](#04bdh) |Initialize PSG (GI Chip) |0093H |[WRTPSG](#wrtpsg) |[1102H](#1102h) |Write to any PSG register |0096H |[RDPSG](#rdpsg) |[110EH](#110eh) |Read from any PSG register |0099H |[STRTMS](#strtms) |[11C4H](#11c4h) |Start music dequeueing |009CH |[CHSNS](#chsns) |[0D6AH](#0d6ah) |Sense keyboard buffer for character |009FH |[CHGET](#chget) |[10CBH](#10cbh) |Get character from keyboard buffer (wait) |00A2H |[CHPUT](#chput) |[08BCH](#08bch) |Screen character output |00A5H |[LPTOUT](#lptout) |[085DH](#085dh) |Line printer character output |00A8H |[LPTSTT](#lptstt) |[0884H](#0884h) |Line printer status test |00ABH |[CNVCHR](#cnvchr) |[089DH](#089dh) |Convert character with graphic header |00AEH |[PINLIN](#pinlin) |[23BFH](#23bfh) |Get line from console (editor) |00B1H |[INLIN](#inlin) |[23D5H](#23d5h) |Get line from console (editor) |00B4H |[QINLIN](#qinlin) |[23CCH](#23cch) |Display "`?`", get line from console (editor) |00B7H |[BREAKX](#breakx) |[046FH](#046fh) |Check CTRL-STOP key directly |00BAH |[ISCNTC](#iscntc) |[03FBH](#03fbh) |Check CRTL-STOP key |00BDH |[CKCNTC](#ckcntc) |[10F9H](#10f9h) |Check CTRL-STOP key |00C0H |[BEEP](#beep) |[1113H](#1113h) |Go beep |00C3H |[CLS](#cls) |[0848H](#0848h) |Clear screen |00C6H |[POSIT](#posit) |[088EH](#088eh) |Set cursor position |00C9H |[FNKSB](#fnksb) |[0B26H](#0b26h) |Check if function key display on |00CCH |[ERAFNK](#erafnk) |[0B15H](#0b15h) |Erase function key display |00CFH |[DSPFNK](#dspfnk) |[0B2BH](#0b2bh) |Display function keys |00D2H |[TOTEXT](#totext) |[083BH](#083bh) |Return VDP to text mode |00D5H |[GTSTCK](#gtstck) |[11EEH](#11eeh) |Get joystick status |00D8H |[GTTRIG](#gttrig) |[1253H](#1253h) |Get trigger status |00DBH |[GTPAD](#gtpad) |[12ACH](#12ach) |Get touch pad status |00DEH |[GTPDL](#gtpdl) |[1273H](#1273h) |Get paddle status |00E1H |[TAPION](#tapion) |[1A63H](#1a63h) |Tape input ON |00E4H |[TAPIN](#tapin) |[1ABCH](#1abch) |Tape input |00E7H |[TAPIOF](#tapiof) |[19E9H](#19e9h) |Tape input OFF |00EAH |[TAPOON](#tapoon) |[19F1H](#19f1h) |Tape output ON |00EDH |[TAPOUT](#tapout) |[1A19H](#1a19h) |Tape output |00F0H |[TAPOOF](#tapoof) |[19DDH](#19ddh) |Tape output OFF |00F3H |[STMOTR](#stmotr) |[1384H](#1384h) |Turn motor ON/OFF |00F6H |[LFTQ](#lftq) |[14EBH](#14ebh) |Space left in music queue |00F9H |[PUTQ](#putq) |[1492H](#1492h) |Put byte in music queue |00FCH |[RIGHTC](#rightc) |[16C5H](#16c5h) |Move current pixel physical address right |00FFH |[LEFTC](#leftc) |[16EEH](#16eeh) |Move current pixel physical address left |0102H |[UPC](#upc) |[175DH](#175dh) |Move current pixel physical address up |0105H |[TUPC](#tupc) |[173CH](#173ch) |Test then [UPC](#upc) if legal |0108H |[DOWNC](#downc) |[172AH](#172ah) |Move current pixel physical address down |010BH |[TDOWNC](#tdownc) |[170AH](#170ah) |Test then [DOWNC](#downc) if legal |010EH |[SCALXY](#scalxy) |[1599H](#1599h) |Scale graphics coordinates |0111H |[MAPXYC](#mapxyc) |[15DFH](#15dfh) |Map graphic coordinates to physical address |0114H |[FETCHC](#fetchc) |[1639H](#1639h) |Fetch current pixel physical address |0117H |[STOREC](#storec) |[1640H](#1640h) |Store current pixel physical address |011AH |[SETATR](#setatr) |[1676H](#1676h) |Set attribute byte |011DH |[READC](#readc) |[1647H](#1647h) |Read attribute of current pixel |0120H |[SETC](#setc) |[167EH](#167eh) |Set attribute of current pixel |0123H |[NSETCX](#nsetcx) |[1809H](#1809h) |Set attribute of number of pixels |0126H |[GTASPC](#gtaspc) |[18C7H](#18c7h) |Get aspect ratio |0129H |[PNTINI](#pntini) |[18CFH](#18cfh) |Paint initialize |012CH |[SCANR](#scanr) |[18E4H](#18e4h) |Scan pixels to right |012FH |[SCANL](#scanl) |[197AH](#197ah) |Scan pixels to left |0132H |[CHGCAP](#chgcap) |[0F3DH](#0f3dh) |Change Caps Lock LED |0135H |[CHGSND](#chgsnd) |[0F7AH](#0f7ah) |Change Key Click sound output |0138H |[RSLREG](#rslreg) |[144CH](#144ch) |Read Primary Slot Register |013BH |[WSLREG](#wslreg) |[144FH](#144fh) |Write to Primary Slot Register |013EH |[RDVDP](#rdvdp) |[1449H](#1449h) |Read VDP Status Register |0141H |[SNSMAT](#snsmat) |[1452H](#1452h) |Read row of keyboard matrix |0144H |[PHYDIO](#phydio) |[148AH](#148ah) |Disk, no action |0147H |[FORMAT](#format) |[148EH](#148eh) |Disk, no action |014AH |[ISFLIO](#isflio) |[145FH](#145fh) |Check for file I/O |014DH |[OUTDLP](#outdlp) |[1B63H](#1b63h) |Formatted output to line printer |0150H |[GETVCP](#getvcp) |[1470H](#1470h) |Get music voice pointer |0153H |[GETVC2](#getvc2) |[1474H](#1474h) |Get music voice pointer |0156H |[KILBUF](#kilbuf) |[0468H](#0468h) |Clear keyboard buffer |0159H |[CALBAS](#calbas) |[01FFH](#01ffh) |Call to BASIC from any slot |015CH |...... |..... |NOPs to 01B5H for expansion <a name="01b6h"></a><a name="rdslt"></a> ``` Address... 01B6H Name...... RDSLT Entry..... A=Slot ID, HL=Address Exit...... A=Byte read Modifies.. AF, BC, DE, DI ``` Standard routine to read a single byte from memory in any slot. The Slot Identifier is composed of a Primary Slot number a Secondary Slot number and a flag: <a name="figure34"></a>![][CH04F34] **Figure 34:** Slot ID The flag is normally 0 but must be 1 if a Secondary Slot number is included in the Slot ID. The memory address and Slot ID are first processed ([027EH](#027eh)) to yield a set of bit masks to apply to the relevant slot register. If a Secondary Slot number is specified then the Secondary Slot Register is first modified to select the relevant page from that Secondary Slot ([02A3H](#02a3h)). The Primary Slot is then switched in to the Z80 address space, the byte read and the Primary Slot restored to its original setting via the [RDPRIM](#rdprim) routine in the Workspace Area. Finally, if a Secondary Slot number is included in the Slot ID, the original Secondary Slot Register setting is restored (01ECH). Note that, unless it is the slot containing the Workspace Area, any attempt to access page 3 (C000H to FFFFH) will cause the system to crash as [RDPRIM](#rdprim) will switch itself out. Note also that interrupts are left disabled by all the memory switching routines. <a name="01d1h"></a><a name="wrslt"></a> ``` Address... 01D1H Name...... WRSLT Entry..... A=Slot ID, HL=Address, E=Byte to write Exit...... None Modifies.. AF, BC, D, DI ``` Standard routine to write a single byte to memory in any slot. Its operation is fundamentally the same as that of the [RDSLT](#rdslt) standard routine except that the Workspace Area routine [WRPRIM](#wrprim) is used rather than [RDPRIM](#rdprim). <a name="01ffh"></a><a name="calbas"></a> ``` Address... 01FFH Name...... CALBAS Entry..... IX=Address Exit...... None Modifies.. AF', BC', DE', HL', IY, DI ``` Standard routine to call an address in the BASIC Interpreter from any slot. Usually this will be from a machine code program running in an extension ROM in page 1 (4000H to 7FFFH). The high byte of register pair IY is loaded with the MSX ROM Slot ID (00H) and control transfers to the [CALSLT](#calslt) standard routine. <a name="0205h"></a><a name="callf"></a> ``` Address... 0205H Name...... CALLF Entry..... None Exit...... None Modifies.. AF', BC', DE', HL', IX, IY, DI ``` Standard routine to call an address in any slot. The Slot ID and address are supplied as inline parameters rather than in registers to fit inside a hook ([Chapter 6](chapter_6)), for example: ``` RST 30H DEFB Slot ID DEFW Address RET ``` The Slot ID is first collected and placed in the high byte of register pair IY. The address is then placed in register pair IX and control drops into the [CALSLT](#calslt) standard routine. <a name="0217h"></a><a name="calslt"></a> ``` Address... 0217H Name...... CALSLT Entry..... IY(High byte)=Slot ID, IX=Address Exit...... None Modifies.. AF', BC', DE', HL', DI ``` Standard routine to call an address in any slot. Its operation is fundamentally the same as that of the [RDSLT](#rdslt) standard routine except that the Workspace Area routine [CLPRIM](#clprim) is used rather than [RDPRIM](#rdprim). Note that [CALBAS](#calbas) and [CALLF](#callf) are just specialized entry points to this standard routine which offer a reduction in the amount of code required. <a name="025eh"></a><a name="enaslt"></a> ``` Address... 025EH Name...... ENASLT Entry..... A=Slot ID, HL=Address Exit...... None Modifies.. AF, BC, DE, DI ``` Standard routine to switch in a page permanently from any slot. Unlike the [RDSLT](#rdslt), [WRSLT](#wrslt) and [CALSLT](#calslt) standard routines the Primary Slot switching is performed directly and not by a Workspace Area routine. Consequently addresses in page 0 (0000H to 3FFFH) will cause an immediate system crash. <a name="027eh"></a> Address... 027EH This routine is used by the memory switching standard routines to turn an address, in register pair HL, and a Slot ID, in register A, into a set of bit masks. As an example a Slot ID of FxxxSSPP and an address in Page 1 (4000H to 7FFFH) would return the following: ``` Register B=00 00 PP 00 (OR mask) Register C=11 11 00 11 (AND mask) Register D=PP PP PP PP (Replicated) Register E=00 00 11 00 (Page mask) ``` Registers B and C are derived from the Primary Slot number and the page mask. They are later used to mix the new Primary Slot number into the existing contents of the Primary Slot Register. Register D contains the Primary Slot number replicated four times and register E the page mask. This is produced by examining the two most significant bits of the address, to determine the page number, and then shifting the mask along to the relevant position. These registers are later used during Secondary Slot switching. As the routine terminates bit 7 of the Slot ID is tested, to determine whether a Secondary Slot has been specified, and Flag M returned if this is so. <a name="02a3h"></a> Address... 02A3H This routine is used by the memory switching standard routines to modify a Secondary Slot Register. The Slot ID is supplied in register A while registers D and E contain the bit masks shown in the previous routine. Bits 6 and 7 of register D are first copied into the Primary Slot register. This switches in page 3 from the Primary Slot specified by the Slot ID and makes the required Secondary Slot Register available. This is then read from memory location FFFFH and the page mask, inverted, used to clear the required two bits. The Secondary Slot number is shifted to the relevant position and mixed in. Finally the new setting is placed in the Secondary Slot Register and the Primary Slot Register restored to its original setting. <a name="02d7h"></a><a name="chkram"></a> ``` Address... 02D7H Name...... CHKRAM Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, SP ``` Standard routine to perform memory initialization at power- up. It non-destructively tests for RAM in pages 2 and 3 in all sixteen possible slots then sets the Primary and Secondary Slot registers to switch in the largest area found. The entire Workspace Area (F380H to FFC9H) is zeroed and [EXPTBL](#exptbl) and [SLTTBL](#slttbl) filled in to map any expansion interfaces in existence Interrupt Mode 1 is set and control transfers to the remainder of the power-up initialization routine ([7C76H](#7c76h)). <a name="03fbh"></a><a name="iscntc"></a> ``` Address... 03FBH Name...... ISCNTC Entry..... None Exit...... None Modifies.. AF, EI ``` Standard routine to check whether the CTRL-STOP or STOP keys have been pressed. It is used by the BASIC Interpreter at the end of each statement to check for program termination. [BASROM](#basrom) is first examined to see if it contains a non-zero value, if so the routine terminates immediately. This is to prevent users breaking into any extension ROM containing a BASIC program. [INTFLG](#intflg) is then checked to determine whether the interrupt handler has placed the CTRL-STOP or STOP key codes (03H or 04H) there. If STOP has been detected then the cursor is turned on ([09DAH](#09dah)) and [INTFLG](#intflg) continually checked until one of the two key codes reappears. The cursor is then turned off ([0A27H](#0a27h)) and, if the key is STOP, the routine terminates. If CTRL-STOP has been detected then the keyboard buffer is first cleared via the [KILBUF](#kilbuf) standard routine and [TRPTBL](#trptbl) is checked to see whether an "`ON STOP GOSUB`" statement is active. If so the relevant entry in [TRPTBL](#trptbl) is updated ([0EF1H](#0ef1h)) and the routine terminates as the event will be handled by the Interpreter Runloop. Otherwise the [ENASLT](#enaslt) standard routine is used to switch in page 1 from the MSX ROM, in case an extension ROM is using the routine, and control transfers to the "`STOP`" statement handler (63E6H). <a name="0468h"></a><a name="kilbuf"></a> ``` Address... 0468H Name...... KILBUF Entry..... None Exit...... None Modifies.. HL ``` Standard Routine to clear the forty character type-ahead keyboard buffer [KEYBUF](#keybuf). There are two pointers into this buffer, [PUTPNT](#putpnt) where the interrupt handler places characters, and [GETPNT](#getpnt) where application programs fetch them from. As the number of characters in the buffer is indicated by the difference between these two pointers [KEYBUF](#keybuf) is emptied simply by making them both equal. <a name="046fh"></a><a name="breakx"></a> ``` Address... 046FH Name...... BREAKX Entry..... None Exit...... Flag C if CTRL-STOP key pressed Modifies.. AF ``` Standard routine which directly tests rows 6 and 7 of the keyboard to determine whether the CTRL and STOP keys are both pressed. If they are then [KEYBUF](#keybuf) is cleared and row 7 of [OLDKEY](#oldkey) modified to prevent the interrupt handler picking the keys up as well. This routine may often be more suitable for use by an application program, in preference to [ISCNTC](#iscntc), as it will work when interrupts are disabled, during cassette I/O for example, and does not exit to the Interpreter. <a name="049dh"></a><a name="initio"></a> ``` Address... 049DH Name...... INITIO Entry..... None Exit...... None Modifies.. AF, E, EI ``` Standard routine to initialize the PSG and the Centronics Status Port. [PSG Register 7](#register_7) is first set to 80H making PSG Port B=Output and PSG Port A=Input. [PSG Register 15](#register_15) is set to CFH to initialize the Joystick connector control hardware. [PSG Register 14](#register_14) is then read and the Keyboard Mode bit placed in [KANAMD](#kanamd), this has no relevance for UK machines. Finally a value of FFH is output to the Centronics Status Port (I/O port 90H) to set the [STROBE](#strobe) signal high. Control then drops into the [GICINI](#gicini) standard routine to complete initialization. <a name="04bdh"></a><a name="gicini"></a> ``` Address... 04BDH Name...... GICINI Entry..... None Exit...... None Modifies.. EI ``` Standard routine to initialize the PSG and the Workspace Area variables associated with the "`PLAY`" statement. [QUETAB](#quetab), [VCBA](#vcba), [VCBB](#vcbb) and [VCBC](#vcbc) are first initialized with the values shown in Chapter 6. PSG Registers [8](#register_8), [9](#register_9) and [10](#register_10) are then set to zero amplitude and [PSG Register 7](#register_7) to B8H. This enables the Tone Generator and disables the Noise Generator on each channel. <a name="0508h"></a> Address... 0508H This six byte table contains the "`PLAY`" statement parameters initially placed in [VCBA](#vcba), [VCBB](#vcbb) and [VCBC](#vcbc) by the [GICINI](#gicini) standard routine: Octave=4, Length=4, Tempo=120, Volume=88H, Envelope=00FFH. <a name="050eh"></a><a name="initxt"></a> ``` Address... 050EH Name...... INITXT Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to initialize the VDP to [40x24 Text Mode](#40x24_text_mode). The screen is temporarily disabled via the [DISSCR](#disscr) standard routine and [SCRMOD](#scrmod) and [OLDSCR](#oldscr) set to 00H. The parameters required by the [CHPUT](#chput) standard routine are set up by copying [LINL40](#linl40) to [LINLEN](#linlen), [TXTNAM](#txtnam) to [NAMBAS](#nambas) and [TXTCGP](#txtcgp) to [CGPBAS](#cgpbas). The VDP colours are then set by the [CHGCLR](#chgclr) standard routine and the screen is cleared (077EH). The current character set is copied into the VRAM Character Pattern Table ([071EH](#071eh)). Finally the VDP mode and base addresses are set via the [SETTXT](#settxt) standard routine and the screen is enabled. <a name="0538h"></a><a name="init32"></a> ``` Address... 0538H Name...... INIT32 Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to initialize the VDP to [32x24 Text Mode](#32x24_text_mode). The screen is temporarily disabled via the [DISSCR](#disscr) standard routine and [SCRMOD](#scrmod) and [OLDSCR](#oldscr) set to 01H. The parameters required by the [CHPUT](#chput) standard routine are set up by copying [LINL32](#linl32) to [LINLEN](#linlen), [T32NAM](#t32nam) to [NAMBAS](#nambas), [T32CGP](#t32cgp) to [CGPBAS](#cgpbas), [T32PAT](#t32pat) to [PATBAS](#patbas) and [T32ATR](#t32atr) to [ATRBAS](#atrbas). The VDP colours are then set via the [CHGCLR](#chgclr) standard routine and the screen is cleared (077EH). The current character set is copied into the VRAM Character Pattern Table ([071EH](#071eh)) and all sprites cleared (06BBH). Finally the VDP mode and base addresses are set via the [SETT32](#sett32) standard routine and the screen is enabled. <a name="0570h"></a><a name="enascr"></a> ``` Address... 0570H Name...... ENASCR Entry..... None Exit...... None Modifies.. AF, BC, EI ``` Standard routine to enable the screen. This simply involves setting bit 6 of VDP [Mode Register 1](#mode_register_1). <a name="0577h"></a><a name="disscr"></a> ``` Address... 0577H Name...... DISSCR Entry..... None Exit...... None Modifies.. AF, BC, EI ``` Standard routine to disable the screen. This simply involves resetting bit 6 of VDP [Mode Register 1](#mode_register_1). <a name="057fh"></a><a name="wrtvdp"></a> ``` Address... 057FH Name...... WRTVDP Entry..... B=Data byte, C=VDP Mode Register number Exit...... None Modifies.. AF, B, EI ``` Standard routine to write a data byte to any VDP [Mode Register](#vdp_mode_registers). The register selection byte is first written to the VDP [Command Port](#commandpport), followed by the data byte. This is then copied to the relevant register image, [RG0SAV](#rg0sav) to [RG7SAV](#rg7sav), in the Workspace Area <a name="0594h"></a><a name="settxt"></a> ``` Address... 0594H Name...... SETTXT Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to partially set the VDP to [40x24 Text Mode](#40x24_text_mode). The mode bits M1, M2 and M3 are first set in VDP Mode Registers [0](#mode_register_0) and [1](#mode_register_1). The five VRAM table base addresses, beginning with [TXTNAM](#txtnam), are then copied from the Workspace Area into VDP Mode Registers [2](#mode_register_2), [3](#mode_register_3), [4](#mode_register_4), [5](#mode_register_5) and [6](#mode_register_6) ([0677H](#0677h)). <a name="05b4h"></a><a name="sett32"></a> ``` Address... 05B4H Name...... SETT32 Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to partially set the VDP to [32x24 Text Mode](#32x24_text_mode). The mode bits M1, M2 and M3 are first set in VDP Mode Registers [0](#mode_register_0) and [1](#mode_register_1). The five VRAM table base addresses, beginning with [T32NAM](#t32nam), are then copied from the Workspace Area into VDP Mode Registers [2](#mode_register_2), [3](#mode_register_3), [4](#mode_register_4), [5](#mode_register_5) and [6](#mode_register_6) ([0677H](#0677h)). <a name="05d2h"></a><a name="inigrp"></a> ``` Address... 05D2H Name...... INIGRP Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to initialize the VDP to [Graphics Mode](#graphics_mode). The screen is temporarily disabled via the [DISSCR](#disscr) standard routine and [SCRMOD](#scrmod) set to 02H. The parameters required by the [GRPPRT](#grpprt) standard routine are set up by copying [GRPPAT](#grppat) to [PATBAS](#patbas) and [GRPATR](#grpatr) to [ATRBAS](#atrbas). The character code driver pattern is then copied into the VDP Name Table, the screen cleared (07A1H) and all sprites cleared (06BBH). Finally the VDP mode and base addresses are set via the [SETGRP](#setgrp) standard routine and the screen is enabled. <a name="0602h"></a><a name="setgrp"></a> ``` Address... 0602H Name...... SETGRP Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to partially set the VDP to [Graphics Mode](#graphics_mode). The mode bits M1, M2 and M3 are first set in VDP Mode Registers [0](#mode_register_0) and [1](#mode_register_1). The five VRAM table base addresses, beginning with [GRPNAM](#grpnam), are then copied from the Workspace Area into VDP Mode Registers [2](#mode_register_2), [3](#mode_register_3), [4](#mode_register_4), [5](#mode_register_5) and [6](#mode_register_6) ([0677H](#0677h)). <a name="061fh"></a><a name="inimlt"></a> ``` Address... 061FH Name...... INIMLT Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to initialize the VDP to [Multicolour Mode](#multicolour_mode). The screen is temporarily disabled via the [DISSCR](#disscr) standard routine and [SCRMOD](#scrmod) set to 03H. The parameters required by the [GRPPRT](#grpprt) standard routine are set up by copying [MLTPAT](#mltpat) to [PATBAS](#patbas) and [MLTATR](#mltatr) to [ATRBAS](#atrbas). The character code driver pattern is then copied into the VDP Name Table, the screen cleared (07B9H) and all sprites cleared (06BBH). Finally the VDP mode and base addresses are set via the [SETMLT](#setmlt) standard routine and the screen is enabled. <a name="0659h"></a><a name="setmlt"></a> ``` Address... 0659H Name...... SETMLT Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to partially set the VDP to [Multicolour Mode](#multicolour_mode). The mode bits M1, M2 and M3 are first set in VDP Mode Registers [0](#mode_register_0) and [1](#mode_register_1). The five VRAM table base addresses, beginning with [MLTNAM](#mltnam), are then copied from the Workspace Area to VDP Mode Registers [2](#mode_register_2), [3](#mode_register_3), [4](#mode_register_4), [5](#mode_register_5) and [6](#mode_register_6). <a name="0677h"></a> Address... 0677H This routine is used by the [SETTXT](#settxt), [SETT32](#sett32), [SETGRP](#setgrp) and [SETMLT](#setmlt) standard routines to copy a block of five table base addresses from the Workspace Area into VDP Mode Registers [2](#mode_register_2), [3](#mode_register_3), [4](#mode_register_4), [5](#mode_register_5) and [6](#mode_register_6). On entry register pair HL points to the relevant group of addresses. Each base address is collected in turn shifted the required number of places and then written to the relevant Mode Register via the [WRTVDP](#wrtvdp) standard routine. <a name="06a8h"></a><a name="clrspr"></a> ``` Address... 06A8H Name...... CLRSPR Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to clear all sprites. The entire 2 KB Sprite Pattern Table is first filled with zeros via the [FILVRM](#filvrm) standard routine. The vertical coordinate of each of the thirty-two sprite attribute blocks is then set to -47 (D1H) to place the sprite above the top of the screen, the horizontal coordinate is left unchanged. The pattern numbers in the Sprite Attribute Table are initialized with the series 0, 1, 2, 3, 4,... 31 for 8x8 sprites or the series 0, 4, 8, 12, 16,... 124 for 16x16 sprites. The series to be generated is determined by the Size bit in VDP [Mode Register 1](#mode_register_1). Finally the colour byte of each sprite attribute block is filled in with the colour code contained in [FORCLR](#forclr), this is initially white. Note that the Size and Mag bits in VDP [Mode Register 1](#mode_register_1) are not affected by this routine. Note also that the [INIT32](#init32), [INIGRP](#inigrp) and [INIMLT](#inimlt) standard routines use this routine with an entry point at 06BBH, leaving the Sprite Pattern Table undisturbed. <a name="06e4h"></a><a name="calpat"></a> ``` Address... 06E4H Name...... CALPAT Entry..... A=Sprite pattern number Exit...... HL=Sprite pattern address Modifies.. AF, DE, HL ``` Standard routine to calculate the address of a sprite pattern. The pattern number is first multiplied by eight then, if 16x16 sprites are selected, multiplied by a further factor of four. This is then added to the Sprite Pattern Table base address, taken from [PATBAS](#patbas), to produce the final address. This numbering system is in line with the BASIC Interpreter's usage of pattern numbers rather than the VDP's when 16x16 sprites are selected. As an example while the Interpreter calls the second pattern number one, it is actually VDP pattern number four. This usage means that the maximum pattern number this routine should allow, when 16x16 sprites are selected, is sixty-three. There is no actual check on this limit so large pattern numbers will produce addresses greater than 3FFFH. Such addresses, when passed to the other VDP routines, will wrap around past zero and corrupt the Character Pattern Table in VRAM. <a name="06f9h"></a><a name="calatr"></a> ``` Address... 06F9H Name...... CALATR Entry..... A=Sprite number Exit...... HL=Sprite attribute address Modifies.. AF, DE, HL ``` Standard routine to calculate the address of a sprite attribute block. The sprite number, from zero to thirty-one, is multiplied by four and added to the Sprite Attribute Table base address taken from [ATRBAS](#atrbas). <a name="0704h"></a><a name="gspsiz"></a> ``` Address... 0704H Name...... GSPSIZ Entry..... None Exit...... A=Bytes in sprite pattern (8 or 32) Modifies.. AF ``` Standard routine to return the number of bytes occupied by each sprite pattern in the Sprite Pattern Table. The result is determined simply by examining the Size bit in VDP [Mode Register 1](#mode_register_1). <a name="070fh"></a><a name="ldirmv"></a> ``` Address... 070FH Name...... LDIRMV Entry..... BC=Length, DE=RAM address, HL=VRAM address Exit...... None Modifies.. AF, BC, DE, EI ``` Standard routine to copy a block into main memory from the VDP VRAM. The VRAM starting address is set via the [SETRD](#setrd) standard routine and then sequential bytes read from the VDP [Data Port](#data_port) and placed in main memory. <a name="071eh"></a> Address... 071EH This routine is used to copy a 2 KB character set into the VDP Character Pattern Table in any mode. The base address of the Character Pattern Table in VRAM is taken from [CGPBAS](#cgpbas). The starting address of the character set is taken from [CGPNT](#cgpnt). The [RDSLT](#rdslt) standard routine is used to read the character data so this may be situated in an extension ROM. At power-up [CGPNT](#cgpnt) is initialized with the address contained at ROM location 0004H, which is [1BBFH](#1bbfh). [CGPNT](#cgpnt) is easily altered to produce some interesting results, `POKE &HF920,&HC7:SCREEN 0` provides a thoroughly confusing example. <a name="0744h"></a><a name="ldirvm"></a> ``` Address... 0744H Name...... LDIRVM Entry..... BC=Length, DE=VRAM address, HL=RAM address Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to copy a block to VRAM from main memory. The VRAM starting address is set via the [SETWRT](#setwrt) standard routine and then sequential bytes taken from main memory and written to the VDP [Data Port](#data_port). <a name="0777h"></a> Address... 0777H This routine will clear the screen in any VDP mode. In [40x24 Text Mode](#40x24_text_mode) and [32x24 Text Mode](#32x24_text_mode) the Name Table, whose base address is taken from [NAMBAS](#nambas), is first filled with ASCII spaces. The cursor is then set to the home position ([0A7FH](#0a7fh)) and [LINTTB](#linttb), the line termination table, re-initialized. Finally the function key display is restored, if it is enabled, via the [FNKSB](#fnksb) standard routine. In [Graphics Mode](#graphics_mode) the border colour is first set via VDP [Mode Register 7](#mode_register_7) (0832H). The Colour Table is then filled with the background colour code, taken from [BAKCLR](#bakclr), for both 0 and 1 pixels. Finally the Character Pattern Table is filled with zeroes. In [Multicolour Mode](#multicolour_mode) the border colour is first set via VDP [Mode Register 7](#mode_register_7) (0832H). The Character Pattern Table is then filled with the background colour taken from [BAKCLR](#bakclr). <a name="07cdh"></a><a name="wrtvrm"></a> ``` Address... 07CDH Name...... WRTVRM Entry..... A=Data byte, HL=VRAM address Exit...... None Modifies.. EI ``` Standard routine to write a single byte to the VDP VRAM. The VRAM address is first set up via the [SETWRT](#setwrt) standard routine and then the data byte written to the VDP [Data Port](#data_port). Note that the two seemingly spurious `EX(SP),HL` instructions in this routine, and several others, are required to meet the VDP's timing constraints. <a name="07d7h"></a><a name="rdvrm"></a> ``` Address... 07D7H Name...... RDVRM Entry..... HL=VRAM address Exit...... A=Byte read Modifies.. AF, EI ``` Standard routine to read a single byte from the VDP VRAM. The VRAM address is first set up via the [SETRD](#setrd) standard routine and then the byte read from the VDP [Data Port](#data_port). <a name="07dfh"></a><a name="setwrt"></a> ``` Address... 07DFH Name...... SETWRT Entry..... HL=VRAM address Exit...... None Modifies.. AF, EI ``` Standard routine to set up the VDP for subsequent writes to VRAM via the [Data Port](#data_port). The address contained in register pair HL is written to the VDP [Command Port](#command_port) LSB first, MSB second as shown in [Figure 7](#figure7). Addresses greater than 3FFFH will wrap around past zero as the two most significant bits of the address are ignored. <a name="07ech"></a><a name="setrd"></a> ``` Address... 07ECH Name...... SETRD Entry..... HL=VRAM address Exit...... None Modifies.. AF, EI ``` Standard routine to set up the VDP for subsequent reads from VRAM via the [Data Port](#data_port). The address contained in register pair HL is written to the VDP [Command Port](#command_port) LSB first, MSB second as shown in [Figure 7](#figure7). Addresses greater than 3FFFH will wrap around past zero as the two most significant bits of the address are ignored. <a name="07f7h"></a><a name="chgclr"></a> ``` Address... 07F7H Name...... CHGCLR Entry..... None Exit...... None Modifies.. AF, BC, HL, EI ``` Standard routine to set the VDP colours. [SCRMOD](#scrmod) is first examined to determine the appropriate course of action. In [40x24 Text Mode](#40x24_text_mode) the contents of [BAKCLR](#bakclr) and [FORCLR](#forclr) are written to VDP [Mode Register 7](#mode_register_7) to set the colour of the 0 and 1 pixels, these are initially blue and white. Note that in this mode there is no way of specifying the border colour, this will be the same as the 0 pixel colour. In [32x24 Text Mode](#32x24_text_mode), [Graphics Mode](#graphics_mode) or [Multicolour Mode](#multicolour_mode) the contents of [BDRCLR](#bdrclr) are written to VDP [Mode Register 7](#mode_register_7) to set the colour of the border, this is initially blue. Also in [32x24 Text Mode](#32x24_text_mode) the contents of [BAKCLR](#bakclr) and [FORCLR](#forclr) are copied to the whole of the Colour Table to determine the 0 and 1 pixel colours. <a name="0815h"></a><a name="filvrm"></a> ``` Address... 0815H Name...... FILVRM Entry..... A=Data byte, BC=Length, HL=VRAM address Exit...... None Modifies.. AF, BC, EI ``` Standard routine to fill a block of the VDP VRAM with a single data byte. The VRAM starting address, contained in register pair HL, is first set up via the [SETWRT](#setwrt) standard routine. The data byte is then repeatedly written to the VDP [Data Port](#data_port) to fill successive VRAM locations. <a name="083bh"></a><a name="totext"></a> ``` Address... 083BH Name...... TOTEXT Entry..... None Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to return the VDP to either [40x24 Text Mode](#40x24_text_mode) or [32x24 Text Mode](#32x24_text_mode) if it is currently in [Graphics Mode](#graphics_mode) or [Multicolour Mode](#multicolour_mode). It is used by the BASIC Interpreter Mainloop and by the "[INPUT](#input)" statement handler. Whenever the [INITXT](#initxt) or [INIT32](#init32) standard routines are used the mode byte, 00H or 01H, is copied into [OLDSCR](#oldscr). If the mode is subsequently changed to [Graphics Mode](#graphics_mode) or [Multicolour Mode](#multicolour_mode), and then has to be returned to one of the two text modes for keyboard input, this routine ensures that it returns to the same one. [SCRMOD](#scrmod) is first examined and, if the screen is already in either text mode, the routine simply terminates with no action. Otherwise the previous text mode is taken from [OLDSCR](#oldscr) and passed to the [CHGMOD](#chgmod) standard routine. <a name="0848h"></a><a name="cls"></a> ``` Address... 0848H Name...... CLS Entry..... Flag Z Exit...... None Modifies.. AF, BC, DE, EI ``` Standard routine to clear the screen in any mode, it does nothing but call the routine at 0777H. This is actually the "`CLS`" statement handler and, because this indicates that there is illegal text after the statement, it will simply return if entered with Flag NZ. <a name="084fh"></a><a name="chgmod"></a> ``` Address... 084FH Name...... CHGMOD Entry..... A=Screen mode required (0, 1, 2, 3) Exit...... None Modifies.. AF, BC, DE, HL, EI ``` Standard routine to set a new screen mode. Register A, containing the required screen mode, is tested and control transferred to [INITXT](#initxt), [INIT32](#init32), [INIGRP](#inigrp) or [INIMLT](#inimlt). <a name="085dh"></a><a name="lptout"></a> ``` Address... 085DH Name...... LPTOUT Entry..... A=Character to print Exit...... Flag C if CTRL-STOP termination Modifies.. AF ``` Standard routine to output a character to the line printer via the Centronics Port. The printer status is continually tested, via the [LPTSTT](#lptstt) standard routine, until the printer becomes free. The character is then written to the Centronics Data Port (I/O port 91H) and the [STROBE](#strobe) signal of the Centronics Status Port (I/O port 90H) briefly pulsed low. Note that the [BREAKX](#breakx) standard routine is used to test for the CTRL-STOP key if the printer is busy. If CTRL-STOP is detected a CR code is written to the Centronics Data Port, to flush the printer's line buffer, and the routine terminates with Flag C. <a name="0884h"></a><a name="lptstt"></a> ``` Address... 0884H Name...... LPTSTT Entry..... None Exit...... A=0 and Flag Z if printer busy Modifies.. AF ``` Standard routine to test the Centronics Status Port BUSY signal. This just involves reading I/O port 90H and examining the state of bit 1: 0=Ready, 1=Busy. <a name="088eh"></a><a name="posit"></a> ``` Address... 088EH Name...... POSIT Entry..... H=Column, L=Row Exit...... None Modifies.. AF, EI ``` Standard routine to set the cursor coordinates. The row and column coordinates are sent to the [OUTDO](#outdo) standard routine as the parameters in an ESC,"Y",Row+1FH, Column+1FH sequence. Note that the BIOS home position has coordinates of 1,1 rather than the 0,0 used by the BASIC Interpreter. <a name="089dh"></a><a name="cnvchr"></a> ``` Address... 089DH Name...... CNVCHR Entry..... A=Character Exit...... Flag Z,NC=Header; Flag NZ,C=Graphic; Flag Z,C=Normal Modifies.. AF ``` Standard routine to test for, and convert if necessary, characters with graphic headers. Characters less than 20H are normally interpreted by the output device drivers as control characters. A character code in this range can be treated as a displayable character by preceding it with a graphic header control code (01H) and adding 40H to its value. For example to directly display character code 0DH, rather than have it interpreted as a carriage return, it is necessary to output the two bytes 01H,4DH. This routine is used by the output device drivers, such as the [CHPUT](#chput) standard routine, to check for such sequences. If the character is a graphic header [GRPHED](#grphed) is set to 01H and the routine terminates, otherwise [GRPHED](#grphed) is zeroed. If the character is outside the range 40H to 5FH it is left unchanged. If it is inside this range, and [GRPHED](#grphed) contains 01H indicating a previous graphic header, it is converted by subtracting 40H. <a name="08bch"></a><a name="chput"></a> ``` Address... 08BCH Name...... CHPUT Entry..... A=Character Exit...... None Modifies.. EI ``` Standard routine to output a character to the screen in [40x24 Text Mode](#40x24_text_mode) or [32x24 Text Mode](#32x24_text_mode). [SCRMOD](#scrmod) is first checked and, if the VDP is in either [Graphics Mode](#graphics_mode) or [Multicolour Mode](#multicolour_mode), the routine terminates with no action. Otherwise the cursor is removed ([0A2EH](#0a2eh)), the character decoded ([08DFH](#08dfh)) and then the cursor replaced ([09E1H](#09e1h)). Finally the cursor column position is placed in [TTYPOS](#ttypos), for use by the "`PRINT`" statement, and the routine terminates. <a name="08dfh"></a> Address... 08DFH This routine is used by the [CHPUT](#chput) standard routine to decode a character and take the appropriate action. The [CNVCHR](#cnvchr) standard routine is first used to check for a graphic character, if the character is a header code (01H) then the routine terminates with no action. If the character is a converted graphic one then the control code decoding section is skipped. Otherwise [ESCCNT](#esccnt) is checked to see if a previous ESC character (1BH) has been received, if so control transfers to the ESC sequence processor ([098FH](#098fh)). Otherwise the character is checked to see if it is smaller than 20H, if so control transfers to the control code processor ([0914H](#0914h)). The character is then checked to see if it is DEL (7FH), if so control transfers to the delete routine (0AE3H). Assuming the character is displayable the cursor coordinates are taken from [CSRY](#csry) and [CSRX](#csrx) and placed in register pair HL, H=Column, L=Row. These are then converted to a physical address in the VDP Name Table and the character placed there ([0BE6H](#0be6h)). The cursor column position is then incremented ([0A44H](#0a44h)) and, assuming the rightmost column has not been exceeded, the routine terminates. Otherwise the row's entry in [LINTTB](#linttb), the line termination table, is zeroed to indicate an extended logical line, the column number is set to 01H and a LF is performed. <a name="0908h"></a> Address... 0908H This routine performs the LF operation for the [CHPUT](#chput) standard routine control code processor. The cursor row is incremented ([0A61H](#0a61h)) and, assuming the lowest row has not been exceeded, the routine terminates. Otherwise the screen is scrolled upwards and the lowest row erased (0A88H). <a name="0914h"></a> Address... 0914H This is the control code processor for the [CHPUT](#chput) standard routine. The table at [092FH](#092fh) is searched for a match with the code and control transferred to the associated address. <a name="092fh"></a> Address... 092FH This table contains the control codes, each with an associated address, recognized by the [CHPUT](#chput) standard routine: |CODE |TO |FUNCTION |:---:|:-----:|-------------------------------- |07H |1113H |BELL, go beep |08H |0A4CH |BS, cursor left |09H |0A71H |TAB, cursor to next tab position |0AH |0908H |LF, cursor down a row |0BH |0A7FH |HOME, cursor to home |0CH |077EH |FORMFEED, clear screen and home |0DH |0A81H |CR, cursor to leftmost column |1BH |0989H |ESC, enter escape sequence |1CH |0A5BH |RIGHT, cursor right |1DH |0A4CH |LEFT, cursor left |1EH |0A57H |UP, cursor up |1FH |0A61H |DOWN, cursor down. </a> <a name="0953h"></a> Address... 0953H This table contains the ESC control codes, each with an associated address, recognized by the [CHPUT](#chput) standard routine: |CODE |TO |FUNCTION |:---:|:-----:|------------------------------- |6AH |077EH |ESC,"j", clear screen and home |45H |077EH |ESC,"E", clear screen and home |4BH |0AEEH |ESC,"K", clear to end of line |4AH |0B05H |ESC,"J", clear to end of screen |6CH |0AECH |ESC,"l", clear line |4CH |0AB4H |ESC,"L", insert line |4DH |0A85H |ESC,"M", delete line |59H |0986H |ESC,"Y", set cursor coordinates |41H |0A57H |ESC,"A", cursor up |42H |0A61H |ESC,"B", cursor down |43H |0A44H |ESC,"C", cursor right |44H |0A55H |ESC,"D", cursor left |48H |0A7FH |ESC,"H", cursor home |78H |0980H |ESC,"x", change cursor |79H |0983H |ESC,"y", change cursor </a> <a name="0980h"></a> Address... 0980H This routine performs the ESC,"x" operation for the [CHPUT](#chput) standard routine control code processor. [ESCCNT](#esccnt) is set to 01H to indicate that the next character received is a parameter. <a name="0983h"></a> Address... 0983H This routine performs the ESC,"y" operation for the [CHPUT](#chput) standard routine control code decoder. [ESCCNT](#esccnt) is set to 02H to indicate that the next character received is a parameter. <a name="0986h"></a> Address... 0986H This routine performs the ESC",Y" operation for the [CHPUT](