8. MEMORY USAGE MAP



    A maximum of 32 KB of RAM is available to the BASIC Interpreter to hold the program text, the BASIC Variables, the Z80 stack, the I/O buffers and the internal workspace. A memory map of these areas in the power-up state is shown below:

Figure 50: Memory Usage Map 8000H to FFFFH.

    The Program Text Area is composed of tokenized program lines stored in line number order and terminated by a zero end link, when in the "NEW" state only the end link is present. The zero byte at 8000H is a dummy end of line character needed to synchronize the Runloop at the start of a program. - 208 - 6. MEMORY MAP

    The Variable and Array Storage Areas are composed of string or numeric Variables and Arrays stored in the order in which they are found in the program text. Execution speed improves marginally if Variables are declared before Arrays in a program as this reduces the amount of memory to be moved upwards.

    The Z80 stack is positioned immediately below the String Storage Area, the structure of the stack top is shown below:

Figure 51: Z80 Stack Top.

    Whenever the position of the stack is altered, as a result of a "CLEAR" or "MAXFILES" statement, two zero bytes are first pushed to function as a terminator during "FOR" or "GOSUB" parameter block searches. Assuming no parameter blocks are present the Z80 SP will therefore be at STKTOP-2 within the Interpreter Mainloop and at STKTOP-4 when control transfers from the Runloop to a statement handler.

    The String Storage Area is composed of the string bodies assigned to Variables or Arrays. During expression evaluation a number of intermediate string results may also be temporarily present under the permanent string heap. The zero byte following the String Storage Area is a temporary delimiter for the "VAL" function.

    The region between the String Storage Area and HIMEM is used for I/O buffer storage. I/O buffer 0, the "SAVE" and "LOAD" buffer, is always present but the number of user buffers is determined by the "MAXFILES" statement. Each I/O buffer consists of a 9 byte FCB, whose address is contained in the table under FCB 0, followed by a 256 byte data buffer. The FCB contains the status of the I/O buffer as below:

Figure 52 : File Control Block.

    The MOD byte holds the buffer mode, the DEV byte the device code, the POS byte the current position in the buffer (0 to 255) and the PPS byte the "PRINT" position. The remainder of the FCB is unused on a standard MSX machine. - 209 - 6. MEMORY MAP Workspace Area

    The section of the Workspace Area from F380H to FD99H holds the BIOS/Interpreter variables. These are listed on the following pages in standard assembly language form:

    This routine is used by the RDSLT standard routine to switch Primary Slots and read a byte from memory. The new Primary Slot Register setting is supplied in register A, the old setting in register D and the byte read returned in register E.

    This routine is used by the WRSLT standard routine to switch Primary Slots and write a byte to memory. The new Primary Slot Register setting is supplied in register A, the old setting in register D and the byte to write in register E.

    This routine is used by the CALSLT standard routine to switch Primary Slots and call an address. The new Primary Slot Register setting is supplied in register A, the old setting on the Z80 stack and the address to call in register pair IX.

    These ten variables contain the "USR" function addresses. Their values are set to the Interpreter "Illegal function call" error generator at power-up and thereafter only altered by the "DEFUSR" statement. F3AEH LINL40: DEFB 39 ; 39 in Japanese MSX, 37 in European.

    This variable contains the 40x24 Text Mode screen width. Its value is set at power-up and thereafter only altered by the "WIDTH" statement. F3AFH LINL32: DEFB 29

    This variable contains the 32x24 Text Mode screen width. Its value is set at power-up and thereafter only altered by the "WIDTH" statement. F3B0H LINLEN: DEFB 39 ; 39 in Japanese MSX, 37 in European.

    This variable contains the current text mode screen width. Its value is set from LINL40 or LINL32 whenever the VDP is initialized to a text mode via the INITXT or INIT32 standard routines. F3B1H CRTCNT: DEFB 24

    This variable contains the number of rows on the screen. Its value is set at power-up and thereafter unaltered. F3B2H CLMLST: DEFB 14

    This variable contains the minimum number of columns that must still be available on a line for a data item to be "PRINT"ed, if less space is available a CR,LF is issued first. Its value is set at power-up and thereafter only altered by the "WIDTH" and "SCREEN" statements.

    These five variables contain the 40x24 Text Mode VDP base addresses. Their values are set at power-up and thereafter only altered by the "BASE" statement.

    These five variables contain the 32x24 Text Mode VDP base addresses. Their values are set at power-up and thereafter only altered by the "BASE" statement. - 211 - 6. MEMORY MAP

    These five variables contain the Graphics Mode VDP base addresses. Their values are set at power-up and thereafter only altered by the "BASE" statement.

    These five variables contain the Multicolour Mode VDP base addresses. Their values are set at power-up and thereafter only altered by the "BASE" statement. F3DBH CLIKSW: DEFB 01H

    This variable controls the interrupt handler key click: 00H=Off, NZ=On. Its value is set at power-up and thereafter only altered by the "SCREEN" statement. F3DCH CSRY : DEFB 01H

    This variable contains the row coordinate (from 1 to CTRCNT) of the text mode cursor. F3DDH CSRX : DEFB 01H

    This variable contains the column coordinate (from 1 to LINLEN) of the text mode cursor. Note that the BIOS cursor coordinates for the home position are 1,1 whatever the screen width. F3DEH CNSDFG: DEFB FFH

    This variable contains the current state of the function key display: 00H=Off, NZ=On.

    These eight variables mimic the state of the eight write-only MSX VDP Mode Registers. The values shown are for 40x24 Text Mode. - 212 - 6. MEMORY MAP F3E7H STATFL: DEFB CAH

    This variable is continuously updated by the interrupt handler with the contents of the VDP Status Register. F3E8H TRGFLG: DEFB F1H

    This variable is continuously updated by the interrupt handler with the state of the four joystick trigger inputs and the space key. F3E9H FORCLR: DEFB 0FH ; White

    This variable contains the current foreground colour. Its value is set at power-up and thereafter only altered by the "COLOR" statement. The foreground colour is used by the CLRSPR standard routine to set the sprite colour and by the CHGCLR standard routine to set the 1 pixel colour in the text modes. It also functions as the graphics ink colour as it is copied to ATRBYT by the GRPPRT standard routine and used throughout the Interpreter as the default value for any optional colour operand. * Note: the default value may change with version. F3EAH BAKCLR: DEFB 04H ; Dark blue

    This variable contains the current background colour. Its value is set at power-up and thereafter only altered by the "COLOR" statement. The background colour is used by the CLS standard routine to clear the screen in the graphics modes and by the CHGCLR standard routine to set the 0 pixel colour in the text modes. * Note: the default value may change with version. F3EBH BDRCLR: DEFB 04H ; Dark blue

    This variable contains the current border colour. Its value is set at power-up and thereafter only altered by the "COLOR" statement. The border colour is used by the CHGCLR standard routine in 32x24 Text Mode, Graphics Mode and Multicolour Mode to set the border colour. * Note: the default value may change with version. F3ECH MAXUPD: DEFB C3H F3EDH DEFW 0000H

    These two bytes are filled in by the "LINE" statement handler to form a Z80 JP to the RIGHTC, LEFTC, UPC or DOWNC standard routines. F3EFH MINUPD: DEFB C3H F3F0H DEFW 0000H

    These two bytes are filled in by the "LINE" statement handler to form a Z80 JP to the RIGHTC, LEFTC, UPC or DOWNC standard routines. - 213 - 6. MEMORY MAP F3F2H ATRBYT: DEFB 0FH

    This variable contains the graphics ink colour used by the SETC and NSETCX standard routines. F3F3H QUEUES: DEFW F959H

    This variable contains the address of the control blocks for the three music queues. Its value is set at power-up and thereafter unaltered. F3F5H FRCNEW: DEFB FFH

    This variable contains a flag to distinguish the two statements in the "CLOAD/CLOAD?" statement handler: 00H=CLOAD, FFH=CLOAD?. F3F6H SCNCNT: DEFB 01H

    This variable is used as a counter by the interrupt handler to control the rate at which keyboard scans are performed. F3F7H REPCNT: DEFB 01H

    This variable is used as a counter by the interrupt handler to control the key repeat rate. F3F8H PUTPNT: DEFW FBF0H

    This variable contains the address of the put position in KEYBUF. F3FAH GETPNT: DEFW FBF0H

    This variable contains the address of the get position in KEYBUF.

    These five variables contain the 1200 baud cassette parameters. Their values are set at power-up and thereafter unaltered.

    These five variables contain the 2400 baud cassette parameters. Their values are set at power-up and thereafter unaltered. - 214 - 6. MEMORY MAP

    These five variables contain the current cassette parameters. Their values are set to 1200 baud at power-up and thereafter only altered by the "CSAVE" and "SCREEN" statements. F40BH ASPCT1: DEFW 0100H

    This variable contains the reciprocal of the default "CIRCLE" aspect ratio multiplied by 256. Its value is set at power-up and thereafter unaltered. F40DH ASPCT2: DEFW 01C0H

    This variable contains the default "CIRCLE" aspect ratio multiplied by 256. Its value is set at power-up and thereafter unaltered. The aspect ratio is present in two forms so that the "CIRCLE" statement handler can select the appropriate one immediately rather than needing to examine and possibly reciprocate it as is the case with an operand in the program text.

    These five bytes form a dummy program line. Their values are set at power-up and thereafter unaltered. The line exists in case an error occurs in the Interpreter Mainloop before any tokenized text is available in KBUF. If an "ON ERROR GOTO" is active at this time then it provides some text for the "RESUME" statement to terminate on. F414H ERRFLG: DEFB 00H

    This variable is used by the Interpreter error handler to save the error number. F415H LPTPOS: DEFB 00H

    This variable is used by the "LPRINT" statement handler to hold the current position of the printer head. F416H PRTFLG: DEFB 00H

    This variable determines whether the OUTDO standard routine directs its output to the screen or to the printer: 00H=Screen, 01H=Printer. - 215 - 6. MEMORY MAP F417H NTMSXP: DEFB 00H

    This variable determines whether the OUTDO standard routine will replace headered graphics characters directed to the printer with spaces: 00H=Graphics, NZ=Spaces. Its value is set at power-up and thereafter only altered by the "SCREEN" statement. F418H RAWPRT: DEFB 00H

    This variable determines whether the OUTDO standard routine will modify control and headered graphics characters directed to the printer: 00H=Modify, NZ=Raw. Its value is set at power- up and thereafter unaltered. F419H VLZADR: DEFW 0000H F41BH VLZDAT: DEFB 00H

    These variables contain the address and value of any character temporarily removed by the "VAL" function. F41CH CURLIN: DEFW FFFFH

    This variable contains the current Interpreter line number. A value of FFFFH denotes direct mode. F41EH KBFMIN: DEFB ":"

    This byte provides a dummy prefix to the tokenized text contained in KBUF. Its function is similar to that of ENDPRG but is used for the situation where an error occurs within a direct statement. F41FH KBUF : DEFS 318

    This buffer contains the tokenized form of the input line collected by the Interpreter Mainloop. When a direct statement is executed the contents of this buffer form the program text. F55DH BUFMIN: DEFB ","

    This byte provides a dummy prefix to the text contained in BUF. It is used to synchronize the "INPUT" statement handler as it starts to analyze the input text. F55EH BUF : DEFS 259

    This buffer contains the text collected from the console by the INLIN standard routine. F661H TTYPOS: DEFB 00H

    This variable is used by the "PRINT" statement handler to hold the current screen position (Teletype!). - 216 - 6. MEMORY MAP F662H DIMFLG: DEFB 00H

    This variable is normally zero but is set by the "DIM" statement handler to control the operation of the variable search routine. F663H VALTYP: DEFB 02H

    This variable contains the type code of the operand currently contained in DAC: 2=integer, 3=String, 4=Single Precision, 8=Double Precision. F664H DORES : DEFB 00H

    This variable is normally zero but is set to prevent the tokenization of unquoted keywords following a "DATA" token. F665H DONUM : DEFB 00H

    This variable is normally zero but is set when a numeric constant follows one of the keywords GOTO, GOSUB, THEN, etc., and must be tokenized to the special line number operand form. F666H CONTXT: DEFW 0000H

    This variable is used by the CHRGTR standard routine to save the address of the character following a numeric constant in the program text. F668H CONSAV: DEFB 00H

    This variable is used by the CHRGTR standard routine to save the token of a numeric constant found in the program text. F669H CONTYP: DEFB 00H

    This variable is used by the CHRGTR standard routine to save the type of a numeric constant found in the program text. F66AH CONLO : DEFS 8

    This buffer is used by the CHRGTR standard routine to save the value of a numeric constant found in the program text. F672H MEMSIZ: DEFW F168H

    This variable contains the address of the top of the String Storage Area. Its value is set at power-up and thereafter only altered by the "CLEAR" and "MAXFILES" statements. F674H STKTOP: DEFW F0A0H

    This variable contains the address of the top of the Z80 stack. Its value is set at power-up to MEMSIZ-200 and thereafter only altered by the "CLEAR" and "MAXFILES" statements. F676H TXTTAB: DEFW 8001H

    This variable contains the address of the first byte of the Program Text Area. Its value is set at power-up and thereafter unaltered. F678H TEMPPT: DEFW F67AH

    This variable contains the address of the next free location in TEMPST. F67AH TEMPST: DEFS 30

    This buffer is used to store string descriptors. It functions as a stack with string producers pushing their results and string consumers popping them. F698H DSCTMP: DEFS 3

    This buffer is used by the string functions to hold a result descriptor while it is being constructed. F69BH FRETOP: DEFW F168H

    This variable contains the address of the next free location in the String Storage Area. When the area is empty FRETOP is equal to MEMSIZ. F69DH TEMP3 : DEFW 0000H

    This variable is used for temporary storage by various parts of the Interpreter. F69FH TEMP8 : DEFW 0000H

    This variable is used for temporary storage by various parts of the Interpreter. F6A1H ENDFOR: DEFW 0000H

    This variable is used by the "FOR" statement handler to hold the end of statement address during construction of a parameter block. F6A3H DATLIN: DEFW 0000H

    This variable contains the line number of the current "DATA" item in the program text. F6A5H SUBFLG: DEFB 00H

    This variable is normally zero but is set by the "ERASE", "FOR", "FN" and "DEF FN" handlers to control the processing of subscripts by the variable search routine. F6A6H FLGINP: DEFB 00H

    This variable contains a flag to distinguish the two statements in the "READ/INPUT" statement handler: 00H=INPUT, NZ=READ. F6A7H TEMP : DEFW 0000H

    This variable is used for temporary storage by various parts of the Interpreter. F6A9H PTRFLG: DEFB 00H

    This variable is normally zero but is set if any line number operands in the Program Text Area have been converted to pointers. F6AAH AUTFLG: DEFB 00H

    This variable is normally zero but is set when "AUTO" mode is turned on. F6ABH AUTLIN: DEFW 0000H

    This variable contains the current "AUTO" line number. F6ADH AUTINC: DEFW 0000H

    This variable contains the current "AUTO" line number increment. F6AFH SAVTXT: DEFW 0000H

    This variable is updated by the Runloop at the start of every statement with the current location in the program text. It is used during error recovery to set ERRTXT for the "RESUME" statement handler and OLDTXT for the "CONT" statement handler. F6B1H SAVSTK: DEFW F09EH

    This variable is updated by the Runloop at the start of every statement with the current Z80 SP for error recovery purposes. F6B3H ERRLIN: DEFW 0000H

    This variable is used by the error handler to hold the line number of the program line generating an error. F6B5H DOT : DEFW 0000H

    This variable is updated by the Mainloop and the error handler with the current line number for use with the "." parameter. - 219 - 6. MEMORY MAP F6B7H ERRTXT: DEFW 0000H

    This variable is updated from SAVTXT by the error handler for use by the "RESUME" statement handler. F6B9H ONELIN: DEFW 0000H

    This variable is set by the "ON ERROR GOTO" statement handler with the address of the program line to execute when an error occurs. F6BBH ONEFLG: DEFB 00H

    This variable is normally zero but is set by the error handler when control transfers to an "ON ERROR GOTO" statement. This is to prevent a loop developing if an error occurs inside the error recovery statements. F6BCH TEMP2 : DEFW 0000H

    This variable is used for temporary storage by various parts of the Interpreter. F6BEH OLDLIN: DEFW 0000H

    This variable contains the line number of the terminating program line. It is set by the "END" and "STOP" statement handlers for use with the "CONT" statement. F6C0H OLDTXT: DEFW 0000H

    This variable contains the address of the terminating program statement. F6C2H VARTAB: DEFW 8003H

    This variable contains the address of the first byte of the Variable Storage Area. F6C4H ARYTAB: DEFW 8003H

    This variable contains the address of the first byte of the Array Storage Area. F6C6H STREND: DEFW 8003H

    This variable contains the address of the byte following the Array Storage Area. F6C8H DATPTR: DEFW 8000H

    This variable contains the address of the current "DATA" item in the program text. - 220 - 6. MEMORY MAP

    These twenty-six variables contain the default type for each group of BASIC Variables. Their values are set to double precision at power-up, "NEW" and "CLEAR" and thereafter altered only by the "DEF" group of statements. F6E4H PRMSTK: DEFW 0000H

    This variable contains the base address of the previous "FN" parameter block on the Z80 stack. It is used during string garbage collection to travel from block to block on the stack. F6E6H PRMLEN: DEFW 0000H

    This variable contains the length of the current "FN" parameter block in PARM1. F6E8H PARM1 : DEFS 100

    This buffer contains the local Variables belonging to the "FN" function currently being evaluated. F74CH PRMPRV: DEFW F6E4H

    This variable contains the address of the previous "FN" parameter block. It is actually a constant used to ensure that string garbage collection commences with the current parameter block before proceeding to those on the stack. - 221 - 6. MEMORY MAP F74EH PRMLN2: DEFW 0000H

    This variable contains the length of the "FN" parameter block being constructed in PARM2 F750H PARM2 : DEFS 100

    This buffer is used to construct the local Variables owned by the current "FN" function. F7B4H PRMFLG: DEFB 00H

    This variable is used during a Variable search to indicate whether local or global Variables are being examined. F7B5H ARYTA2: DEFW 0000H

    This variable is used during a Variable search to hold the termination address of the storage area being examined. F7B7H NOFUNS: DEFB 00H

    This variable is normally zero but is set by the "FN" function handler to indicate to the variable search routine that local Variables are present. F7B8H TEMP9 : DEFW 0000H

    This variable is used for temporary storage by various parts of the Interpreter. F7BAH FUNACT: DEFW 0000H

    This variable contains the number of currently active "FN functions. F7BCH SWPTMP: DEFS 8

    This buffer is used to hold the first operand in a "SWAP" statement. F7C4H TRCFLG: DEFB 00H

    This variable is normally zero but is set by the "TRON" statement handler to turn on the trace facility. F7C5H FBUFFR: DEFS 43

    This buffer is used to hold the text produced during numeric output conversion. F7F0H DECTMP: DEFW 0000H

    This variable is used for temporary storage by the double precision division routine. F7F2H DECTM2: DEFW 0000H

    This variable is used for temporary storage by the double precision division routine. F7F4H DECCNT: DEFB 00H

    This variable is used by the double precision division routine to hold the number of non-zero bytes in the mantissa of the second operand. F7F6H DAC : DEFS 16 ; Decimal Accumulator

    This buffer functions as the Interpreter's primary accumulator during expression evaluation. F806H HOLD8 : DEFS 65

    This buffer is used by the double precision multiplication routine to hold the multiples of the first operand. F847H ARG : DEFS 16

    This buffer functions as the Interpreter's secondary accumulator during expression evaluation. F857H RNDX : DEFS 8

    This buffer contains the current double precision random number. F85FH MAXFIL: DEFB 01H

    This variable contains the number of currently allocated user I/O buffers. Its value is set to 1 at power-up and thereafter only altered by the "MAXFILES" statement. F860H FILTAB: DEFW F16AH

    This variable contains the address of the pointer table for the I/O buffer FCBs. F862H NULBUF: DEFW F177H

    This variable contains the address of the first byte of the data buffer belonging to I/O buffer 0. F864H PTRFIL: DEFW 0000H

    This variable contains the address of the currently active I/O buffer FCB. - 223 - 6. MEMORY MAP F866H FILNAM: DEFS 11

    This buffer holds a user-specified filename. It is eleven characters long to allow for disc file specs such as "FILENAME.BAS". F871H FILNM2: DEFS 11

    This buffer holds a filename read from an I/O device for comparison with the contents of FILNAM. F87CH NLONLY: DEFB 00H

    This variable is normally zero but is set during a program "LOAD". Bit 0 is used to prevent I/O buffer 0 being closed during loading and bit 7 to prevent the user I/O buffers being closed if auto-run is required. F87DH SAVEND: DEFW 0000H

    This variable is used by the "BSAVE" statement handler to hold the end address of the memory block to be saved. F87FH FNKSTR: DEFS 160

    This buffer contains the ten sixteen-character function key strings. Their values are set at power-up and thereafter only altered by the "KEY" statement. F91FH CGPNT : DEFB 00H ; Slot ID F920H DEFW 1BBFH ; Address

    These variables contain the location of the character set copied to the VDP by the INITXT and INIT32 standard routines. Their values are set to the MSX ROM character set at power-up and thereafter unaltered. F922H NAMBAS: DEFW 0000H

    This variable contains the current text mode VDP Name Table base address. Its value is set from TXTNAM or T32NAM whenever the VDP is initialized to a text mode via the INITXT or INIT32 standard routines. F924H CGPBAS: DEFW 0800H

    This variable contains the current text mode VDP Character Pattern Table base address. Its value is set from TXTCGP or T32CGP whenever the VDP is initialized to a text mode via the INITXT or INIT32 standard routines. F926H PATBAS: DEFW 3800H

    This variable contains the current VDP Sprite Pattern Table base address. Its value is set from T32PAT, GRPPAT or MLTPAT whenever the VDP is initialized via the INIT32, INIGRP or INIMLT standard routines. F928H ATRBAS: DEFW 1B00H

    This variable contains the current VDP Sprite Attribute Table base address. Its value is set from T32ATR, GRPATR or MLTATR whenever the VDP is initialized via the INIT32, INIGRP or INIMLT standard routines. F92AH CLOC : DEFW 0000H ; Pixel location F92CH CMASK : DEFB 80H ; Pixel Mask

    These variables contain the current pixel physical address used by the RIGHTC, LEFTC, UPC, TUPC, DOWNC, TDOWNC, FETCHC, STOREC, READC, SETC, NSETCX, SCANR and SCANL standard routines. CLOC holds the address of the byte containing the current pixel and CMASK defines the pixel within that byte. F92DH MINDEL: DEFW 0000H

    This variable is used by the "LINE" statement handler to hold the minimum difference between the end points of the line. F92FH MAXDEL: DEFW 0000H

    This variable is used by the "LINE" statement handler to hold the maximum difference between the end points of the line. F931H ASPECT: DEFW 0000H

    This variable is used by the "CIRCLE" statement handler to hold the current aspect ratio. This is stored as a single byte binary fraction so an aspect ratio of 0.75 would become 00C0H. The MSB is only required if the aspect ratio is exactly 1.00, that is 0100H. F933H CENCNT: DEFW 0000H

    This variable is used by the "CIRCLE" statement handler to hold the point count of the end angle. F935H CLINEF: DEFB 00H

    This variable is used by the "CIRCLE" statement handler to hold the two line flags. Bit 0 is set if a line is required from the start angle to the centre and bit 7 set if one is required from the end angle. F936H CNPNTS: DEFW 0000H

    This variable is used by the "CIRCLE" statement handler to hold the number of points within a forty-five degree segment. - 225 - 6. MEMORY MAP F938H CPLOTF: DEFB 00H

    This variable is normally zero but is set by the "CIRCLE" statement handler if the end angle is smaller than the start angle. It is used to determine whether the pixels should be set "inside" the angles or "outside" them. F939H CPCNT : DEFW 0000H

    This variable is used by the "CIRCLE" statement handler to hold the point count within the current forty-five degree segment, this is in fact the Y coordinate. F93BH CPCNT8: DEFW 0000H

    This variable is used by the "CIRCLE" statement handler to hold the total point count of the present position. F93DH CRCSUM: DEFW 0000H

    This variable is used by the "CIRCLE" statement handler as the point computation counter. F93FH CSTCNT: DEFW 0000H

    This variable is used by the "CIRCLE" statement handler to hold the point count of the start angle. F941H CSCLXY: DEFB 00H

    This variable is used by the "CIRCLE" statement handler as a flag to determine in which direction the elliptic squash is to be applied: 00H=Y, 01H=X. F942H CSAVEA: DEFW 0000H

    This variable is used for temporary storage by the SCANR standard routine. F944H CSAVEM: DEFB 00H

    This variable is used for temporary storage by the SCANR standard routine. F945H CXOFF : DEFW 0000H

    This variable is used for temporary storage by the "CIRCLE" statement handler. F947H CYOFF : DEFW 0000H

    This variable is used for temporary storage by the "CIRCLE" statement handler. - 226 - 6. MEMORY MAP F949H LOHMSK: DEFB 00H

    This variable is used by the "PAINT" statement handler to hold the leftmost position of a LH excursion. F94AH LOHDIR: DEFB 00H

    This variable is used by the "PAINT" statement handler to hold the new paint direction required by a LH excursion. F94BH LOHADR: DEFW 0000H

    This variable is used by the "PAINT" statement handler to hold the leftmost position of a LH excursion. F94DH LOHCNT: DEFW 0000H

    This variable is used by the "PAINT" statement handler to hold the size of a LH excursion. F94FH SKPCNT: DEFW 0000H

    This variable is used by the "PAINT" statement handler to hold the skip count returned by the SCANR standard routine. F951H MOVCNT: DEFW 0000H

    This variable is used by the "PAINT" statement handler to hold the movement count returned by the SCANR standard routine. F953H PDIREC: DEFB 00H

    This variable is used by the "PAINT" statement handler to hold the current paint direction: 40H=Down, C0H=Up, 00H=Terminate. F954H LFPROG: DEFB 00H

    This variable is normally zero but is set by the "PAINT" statement handler if there has been any leftwards progress. F955H RTPROG: DEFB 00H

    This variable is normally zero but is set by the "PAINT" statement handler if there has been any rightwards progress. F956H MCLTAB: DEFW 0000H

    This variable contains the address of the command table to be used by the macro language parser. The "DRAW" table is at 5D83H and the "PLAY" table at 752EH. F958H MCLFLG: DEFB 00H

    This variable is zero if the macro language parser is being used by the "DRAW", statement handler and non-zero if it is being used by "PLAY".

    These twenty-four variables form the control blocks for the three music queues (VOICAQ, VOICBQ and VOICCQ) and the RS232 queue. The three music control blocks are initialized by the GICINI standard routine and thereafter maintained by the interrupt handler and the PUTQ standard routine. The RS232 control block is unused in the current MSX ROM.

    These four variables are used to hold any unwanted character returned to the associated queue. Although the putback facility is implemented in the MSX ROM it is currently unused.

    These four buffers contain the three music queues and the RS232 queue, the latter is unused in MSX and has been redefined in MSX2. FB35H PRSCNT: DEFB 00H

    This variable is used by the "PLAY" statement handler to count the number of completed operand strings. Bit 7 is also set after each of the three operands has been parsed to prevent repeated activation of the STRTMS standard routine. FB36H SAVSP : DEFW 0000H

    This variable is used by the "PLAY" statement handler to save the Z80 SP before control transfers to the macro language parser. Its value is compared with the SP on return to determine whether any data has been left on the stack because of a queue-full termination by the parser. FB38H VOICEN: DEFB 00H

    This variable contains the current voice number being processed by the "PLAY" statement handler. The values 0, 1 and 2 correspond to PSG channels A, B and C. FB39H SAVVOL: DEFW 0000H

    This variable is used by the "PLAY" statement "R" command handler to save the current volume setting while a zero- amplitude rest is generated. FB3BH MCLLEN: DEFB 00H

    This variable is used by the macro language parser to hold the length of the string operand being parsed. FB3CH MCLPTR: DEFW 0000H

    This variable is used by the macro language parser to hold the address of the string operand being parsed. FB3EH QUEUEN: DEFB 00H

    This variable is used by the interrupt handler to hold the number of the music queue currently being processed. The values 0, 1 and 2 correspond to PSG channels A, B and C. FB3FH MUSICF: DEFB 00H

    This variable contains three bit flags set by the STRTMS standard routine to initiate processing of a music queue by the interrupt handler. Bits 0, 1 and 2 correspond to VOICAQ, VOICBQ and VOICCQ. FB40H PLYCNT: DEFB 00H

    This variable is used by the STRTMS standard routine to hold the number of "PLAY" statement sequences currently held in the music queues. It is examined when all three end of queue marks have been found for one sequence to determine whether dequeueing should be restarted. - 229 - 6. MEMORY MAP FB41H VCBA : DEFW 0000H ; Duration counter FB43H DEFB 00H ; String length FB44H DEFW 0000H ; String address FB46H DEFW 0000H ; Stack data address FB48H DEFB 00H ; Music packet length FB49H DEFS 7 ; Music packet FB50H DEFB 04H ; Octave FB51H DEFB 04H ; Length FB52H DEFB 78H ; Tempo FB53H DEFB 88H ; Volume FB54H DEFW 00FFH ; Envelope period FB56H DEFS 16 ; Space for stack data

    This thirty-seven byte buffer is used by the "PLAY" statement handler to hold the current parameters for voice A. FB66H VCBB : DEFS 37

    This buffer is used by the "PLAY" statement handler to hold the current parameters for voice B, its structure is the same as VCBA. FB8BH VCBC : DEFS 37

    This buffer is used by the "PLAY" statement handler to hold the current parameters for voice C, its structure is the same as VCBA. FBB0H ENSTOP: DEFB 00H

    This variable determines whether the interrupt handler will execute a warm start to the Interpreter upon detecting the keys CODE, GRAPH, CTRL and SHIFT depressed together: 00H=Disable, NZ=Enable. FBB1H BASROM: DEFB 00H

    This variable determines whether the ISCNTC and INLIN standard routines will respond to the CTRL-STOP key: 00H=Enable, NZ=Disable. It is used to prevent termination of a BASIC ROM located during the power-up ROM search. FBB2H LINTTB: DEFS 24

    Each of these twenty-four variables is normally non-zero but is zeroed if the contents of the corresponding screen row have overflowed onto the next row. They are maintained by the BIOS but only actually used by the INLIN standard routine (the screen editor) to discriminate between logical and physical lines. FBCAH FSTPOS: DEFW 0000H

    This variable is used to hold the cursor coordinates upon entry to the INLIN standard routine. Its function is to restrict the extent of backtracking performed when the text is collected from the screen at termination. FBCCH CURSAV: DEFB 00H

    This variable is used to hold the screen character replaced by the text cursor. FBCDH FNKSWI: DEFB 00H

    This variable is used by the CHSNS standard routine to determine whether the shifted or unshifted function keys are currently displayed: 00H=Shifted, 01H=Unshifted. FBCEH FNKFLG: DEFS 10

    Each of these ten variables is normally zero but is set to 01H if the associated function key has been turned on by a "KEY(n) ON" statement. They are used by the interrupt handler to determine whether, in program mode only, it should return a character string or update the associated entry in TRPTBL. FBD8H ONGSBF: DEFB 00H

    This variable is normally zero but is incremented by the interrupt handler whenever a device has achieved the conditions necessary to generate a program interrupt. It is used by the Runloop to determine whether any program interrupts are pending without having to search TRPTBL. FBD9H CLIKFL: DEFB 00H

    This variable is used internally by the interrupt handler to prevent spurious key clicks when returning multiple characters from a single key depression such as a function key. FBDAH OLDKEY: DEFS 11

    This buffer is used by the interrupt handler to hold the previous state of the keyboard matrix, each byte contains one row of keys starting with row 0. FBE5H NEWKEY: DEFS 11

    This buffer is used by the interrupt handler to hold the current state of the keyboard matrix. Key transitions are detected by comparison with the contents of OLDKEY after which OLDKEY is updated with the current state. FBF0H KEYBUF: DEFS 40

    This buffer contains the decoded keyboard characters produced by the interrupt handler. Note that the buffer is organized as a circular queue driven by GETPNT and PUTPNT and consequently has no fixed starting point. FC18H LINWRK: DEFS 40

    This buffer is used by the BIOS to hold a complete line of screen characters. FC40H PATWRK: DEFS 8

    This buffer is used by the BIOS to hold an 8x8 pixel pattern. FC48H BOTTOM: DEFW 8000H

    This variable contains the address of the lowest RAM location used by the Interpreter. Its value is set at power-up and thereafter unaltered. FC4AH HIMEM : DEFW F380H

    This variable contains the address of the byte following the highest RAM location used by the Interpreter. Its value is set at power-up and thereafter only altered by the "CLEAR" statement.

    These twenty-six three byte variables hold the current state of the interrupt generating devices. The first byte of each entry contains the device status (bit 0=On, bit 1=Stop, bit 2=Event active) and is updated by the interrupt handler, the Runloop interrupt processor and the "DEVICE 0=ON/OFF/STOP" and "RETURN" statement handlers. The remaining two bytes of each entry are set by the "ON DEVICE GOSUB" statement handler and contain the address of the program line to execute upon a program interrupt. FC9AH RTYCNT: DEFB 00H

    This variable is unused by the current MSX ROM. FC9BH INTFLG: DEFB 00H

    This variable is normally zero but is set to 03H or 04H if the CTRL-STOP or STOP keys are detected by the interrupt handler. FC9CH PADY : DEFB 00H

    This variable contains the Y coordinate of the last point detected by a touchpad. FC9DH PADX : DEFB 00H

    This variable contains the X coordinate of the last point detected by a touchpad. FC9EH JIFFY : DEFW 0000H

    This variable is continually incremented by the interrupt handler. Its value may be set or read by the "TIME" statement or function. FCA0H INTVAL: DEFW 0000H

    This variable holds the interval duration set by the "ON INTERVAL" statement handler. FCA2H INTCNT: DEFW 0000H

    This variable is continually decremented by the interrupt handler. When zero is reached its value is reset from INTVAL and, if applicable, a program interrupt generated. Note that this variable always counts irrespective of whether an "INTERVAL ON" statement is active. FCA4H LOWLIM: DEFB 31H

    This variable is used to hold the minimum allowable start bit duration as determined by the TAPION standard routine. FCA5H WINWID: DEFB 22H

    This variable is used to hold the LO/HI cycle discrimination duration as determined by the TAPION standard routine. - 233 - 6. MEMORY MAP FCA6H GRPHED: DEFB 00H

    This variable is normally zero but is set to 01H by the CNVCHR standard routine upon detection of a graphic header code. FCA7H ESCCNT: DEFB 00H

    This variable is used by the CHPUT standard routine ESC sequence processor to count escape parameters. FCA8H INSFLG: DEFB 00H

    This variable is normally zero but is set to FFH by the INLIN standard routine when insert mode is on. FCA9H CSRSW : DEFB 00H

    If this variable is zero the cursor is only displayed while the CHGET standard routine is waiting for a keyboard character. If it is non-zero the cursor is permanently displayed via the CHPUT standard routine. FCAAH CSTYLE: DEFB 00H

    This variable determines the cursor style: 00H=Block, NZ=Underline. FCABH CAPST : DEFB 00H

    This variable is used by the interrupt handler to hold the current caps lock status: 00H=Off, NZ=On. FCACH KANAST: DEFB 00H

    This variable is used to hold the keyboard Kana lock status on Japanese machines and the DEAD key status on European machines. FCADH KANAMD: DEFB 00H

    This variable holds a keyboard mode on Japanese machines only. FCAEH FLBMEM: DEFB 00H

    This variable is set by the file I/O error generators but is otherwise unused. FCAFH SCRMOD: DEFB 00H

    This variable contains the current screen mode: 0=40x24 Text Mode, 1=32x24 Text Mode, 2=Graphics Mode, 3=Multicolour Mode. FCB0H OLDSCR: DEFB 00H

    This variable holds the screen mode of the last text mode set. - 234 - 6. MEMORY MAP FCB1H CASPRV: DEFB 00H

    This variable is used to hold any character returned to an I/O buffer by the cassette putback function. FCB2H BDRATR: DEFB 00H

    This variable contains the boundary colour for the "PAINT" statement handler. Its value is set by the PNTINI standard routine and used by the SCANR and SCANL standard routines. FCB3H GXPOS : DEFW 0000H

    This variable is used for temporary storage of a graphics X coordinate. FCB5H GYPOS : DEFW 0000H

    This variable is used for temporary storage of a graphics Y coordinate. FCB7H GRPACX: DEFW 0000H

    This variable contains the current graphics X coordinate for the GRPPRT standard routine. FCB9H GRPACY: DEFW 0000H

    This variable contains the current graphics Y coordinate for the GRPPRT standard routine. FCBBH DRWFLG: DEFB 00H

    Bits 6 and 7 of this variable are set by the "DRAW" statement "N" and "B" command handlers to turn the associated mode on. FCBCH DRWSCL: DEFB 00H

    This variable is used by the "DRAW" statement "S" command handler to hold the current scale factor. FCBDH DRWANG: DEFB 00H

    This variable is used by the "DRAW" statement "A" command handler to hold the current angle. FCBEH RUNBNF: DEFB 00H

    This variable is normally zero but is set by the "BLOAD" statement handler when an auto-run "R" parameter is specified. FCBFH SAVENT: DEFW 0000H

    This variable contains the "BSAVE" and "BLOAD" entry address. - 235 - 6. MEMORY MAP FCC1H EXPTBL: DEFB 00H ; Primary Slot 0 FCC2H DEFB 00H ; Primary Slot 1 FCC3H DEFB 00H ; Primary Slot 2 FCC4H DEFB 00H ; Primary Slot 3

    Each of these four variables is normally zero but is set to 80H during the power-up RAM search if the associated Primary Slot is found to be expanded. FCC5H SLTTBL: DEFB 00H ; Primary Slot 0 FCC6H DEFB 00H ; Primary Slot 1 FCC7H DEFB 00H ; Primary Slot 2 FCC8H DEFB 00H ; Primary Slot 3

    These four variables duplicate the contents of the four possible Secondary Slot Registers. The contents of each variable should only be regarded as valid if EXPTBL shows the associated Primary Slot to be expanded. FCC9H SLTATR: DEFS 4 ; PS0, SS0 FCCDH DEFS 4 ; PS0, SS1 FCD1H DEFS 4 ; PS0, SS2 FCD5H DEFS 4 ; PS0, SS3 FCD9H DEFS 4 ; PS1, SS0 FCDDH DEFS 4 ; PS1, SS1 FCE1H DEFS 4 ; PS1, SS2 FCE5H DEFS 4 ; PS1, SS3 FCE9H DEFS 4 ; PS2, SS0 FCEDH DEFS 4 ; PS2, SS1 FCF1H DEFS 4 ; PS2, SS2 FCF5H DEFS 4 ; PS2, SS3 FCF9H DEFS 4 ; PS3, SS0 FCFDH DEFS 4 ; PS3, SS1 FD01H DEFS 4 ; PS3, SS2 FD05H DEFS 4 ; PS3, SS3

    These sixty-four variables contain the attributes of any extension ROMs found during the power-up ROM search. The characteristics of each 16 KB ROM are encoded into a single byte so four bytes are required for each possible slot. The encoding is:

    Note that the entries for page 0 (0000H to 3FFFH) and page 3 (C000H to FFFFH) will always be zero as only page 1 (4000H to 7FFFH) and page 2 (8000H to BFFFH) are actually examined. The MSX convention is that machine code extension ROMs are placed in page 1 and BASIC program ROMs in page 2. FD09H SLTWRK: DEFS 128

    This buffer provides two bytes of local workspace for each of the sixty-four possible extension ROMs. FD89H PROCNM: DEFS 16

    This buffer is used to hold a device or statement name for examination by an extension ROM. FD99H DEVICE: DEFB 00H

    This variable is used to pass a device code, from 0 to 3, to an extension ROM.

The Hooks


The section of the Workspace Area from FD9AH to FFC9H contains one hundred and twelve hooks, each of which is filled with five Z80 RET opcodes at power-up. These are called from strategic locations within the BIOS/Interpreter so that the ROM can be extended, particularly so that it can be upgraded to Disk BASIC. Each hook has sufficient room to hold a far call to any slot:

    The hooks are listed on the following pages together with the address they are called from and a brief note as to their function.

    The Workspace Area from FFCAH to FFFEH is unused in MSX, but in MSX2, MSX2+ and turbo R. Here forth are texts containing data not presented in the original version of this book. FFFFH ScSltR: DEFB 00H ; Secondary Slot Register

    This address is directly controled by slot expansion devices, if any is active, otherwise it has no function. For more information, see Section 1 (Programmable Peripheral Interface).



10. APPENDICES




A0. INTRODUCTION


    The following appendix texts are a compilation from several sources, including "MSX Datapack" by Japan ASCII Co.'s and "Japan MSX Magazine". The contents of each appendix are:



A1. MSX2 and MSX2+ VDP


@@@ awaiting data input


A2. MSX BIOS Complementary Data


    This section presents several data that has been simply ignored by the original version of this book. Many of them have already been included in the original text, mainly label names and entry and exit data, but it was impossible to include everything without changing all the page numbers.

    The topics covered by this section are:


- ??? -

7.A4. MSX2, MSX2+ and turbo R Sub-BIOS


@@@ awaiting data input


7.A5. Work Area


    The Work Area of MSX2, MSX2+ and turbo R are very similar of MSX's one. The only differences are in the RS2IQ area (from FAF5H to FB34H), which has been divided in two, from FAF5H to FB02 for new MSX features and from FB03 to FB34H for RS-232C and some system variables, and the last bytes of the RAM, after the hooks (from FFCAH to FFFEH).

    The MSX-Disk work area has the following entries: F323 DISKVE: DEFS 2 F325 BREAKV: DEFS 2 F341 RAMAD0: DEFS 1 F342 RAMAD1: DEFS 1 F343 RAMAD2: DEFS 1 F344 RAMAD3: DEFS 1 F348 MASTERS: DEFS 1 F37D BDOS: DEFS 2 ; MSX-Disk BIOS Function Call. F24F HPROMPT: DEFS 5 FAF5 DPPAGE: DEFB 0 ; Current Display Page.

    The number of the VDP page currently displayed (MSX2, MSX2+, turbo R). FAF6 ACPAGE: DEFB 0 ; Active Access Page.

    The number of the VDP page actually accessed (MSX2, MSX2+, turbo R). FAF7 AVCSAV: DEFS 1 ; AV Control Board Save state.

    Used by MSX AV Control boards (MSX, MSX2, MSX2+, turbo R). FAF8 EXBRSA: DEFS 1 ; Extended BIOS Sub-ROM slot Id. Save.

    Slot identification of the extended BIOS Sub-ROM (MSX2, MSX2+, turbo R). FAF9 CHRCNT: DEFS 1 ; Character Counter.

    "Romaji" to "kana" character conversion counter. May range from 0 to 2. MSX2, MSX2+ and turbo R. FAFA ROMA : DEFS 2 ; "Romaji" to "kana" character buffer.

    This buffer contains the characters to a "romaji" to "kana" conversion. MSX2, MSX2+ and turbo R. FAFC MODE : DEFS 1 ; "Romaji" to "kana" conversion Mode.

    MSX2, MSX2+ and turbo R. Each bit has a special meaning:

FAFD NORUSE: DEFS 1 ; Used by the "Kanji driver".

    MSX2, MSX2+ and turbo R. FAFE XSAVE : DEFS 2 ; Light-Pen X Save. FB00 YSAVE : DEFS 2 ; Light-Pen Y Save.

    MSX2, MSX2+ and turbo R. This variables have the light-pen coordinates:

FB02 LOGOPR: DEFS 1 ; VDP Logical Operation Code.

    This variable contains the logical operation to be used by VDP (MSX2, MSX2+, turbo R) in commands like COPY and LINE.

    The following are the RS-232C work area.

    These variables are used by the RS-232C access routines.

    The following are some new system variables. FB20 HOKVLD: DEFS 1 ; Used by the Extended BIOS ROM. FB21 DRVTBL: DEFS 8 ; Drive Table.

    This variable contains the MSX-Disk ROM slot identification.



A6. MSX2, MSX2+ and turbo R I/O Port Map


    Notes:

    The schematic circuitry diagram is presented here, not specifying componets, just logical elements and functions:

    This circuitry has the following effects:


MSX Maker List


    MSX standard has not defined any device that uses the expansion I/O ports, so no table of devices exist, but each hardware maker has its ID byte (most names are written in EUC [Enhanced Unix Code] Japanese characters, but don't worry if you cannot view them or simply cannot understand them, the reading and translation follows):


Disk Operating System BIOS

    The Disk Operating System has a BIOS, from 0000H till 003AH, and one entry point at F37DH:

    The MSX-DOS memory is mapped as follows:

    The Disk-DOS and System Scratch Area are mapped as follows:

    The BDOS entry contains several functions, which are selected by the value given in register C. Other input parameters required by the specific functions must be loaded on the other registers. DOS-BIOS functions may change any registers and return results in specific ones.

    The following functions are available on DOS-BIOS:


* Console input

Function:	01H
Setup:		none
Return value:	A register <-- one character from console

When there is no input (no key pressed and input buffer empty), an input is
wait for. Input characters are echoed back to the console. The following
control character input is allowed: Ctrl-C causes program execution to be
halted and a return to the MSX-DOS command level; Ctrl-P causes any sucessive
input to also echoed to the printer until Ctrl-N is accepted; Ctrl-S causes
the display to stop until any key is pressed.

	Ctrl-C ........ system reset
	Ctrl-P ........ printer echo
	Ctrl-N ........ halt printer echo
	Ctrl-S ........ pause display


* Console output

Function:	02H
Setup:		E register <-- character code to be sent out
Return value:	none

This system call displays the character specified by the E register on the
screen. It also checks the four control characters, listed above.


* External input

Function:	03H
Setup:		none
Return value:	A register <-- one character from AUX device

This system call checks four control characters.


* External output

Function:	04H
Setup:		E register <-- character code to send to AUX device
Return value:	none

This system call checks four control characters.


* Printer output

Function:	05H
Setup:		A register <-- one character from console

This system call does not echo back. It treats control characters in the same
way as function 01H.


* Direct console input/output

Function:	06H
Setup:		E register <-- character code to be send to the console
		When 0FFH is specified, the character will be input
		from the console.
Return value:	When the E register is set to 0FFH (input), the result of
		input is in the A register. The value set in the A register
		is the character code of the key, if it was pressed;
		otherwise, the value is 00H. When the E register is set to
		a value other than 0FFH (output), there is no return value.

This system call does not support control characters and does not echo back
input. This system call checks four control characters.


* Direct console input - 1

Function:	07H
Setup:		none
Return value:	A register <-- one character from console

This system call does not support control characters, nor echo back.


* Direct console input - 2

Function:	08H
Setup:		none
Return value:	A register <-- one character from console

This system call does not echo back. It treats control characters in the same
way as function 01H.


* String output

Function:	09H
Setup:		DE register <-- starting address of string, prepared on
				memory, to be sent to the console.
Return value:	none

24H ("$") is appended to the end of the string as the end symbol. This system
call checks and performs four control character functions, as listed
previously.


* String input

Function:	0AH
Setup:		The address of memory where the maximum number of input
		characters (1 to 0FFH) is set should be set in the DE
		register.
Return value:	Number of characters actually sent from console is set in the
		address, one added to the address indicated by the DE
		register; string sent from console is set in the area from
		the address, two added to the address indicated by the DE
		register.

Return key input is considered as the end of console input. However, when the
number of input characters exceeds the specified number of characters
(contents indicated by DE register, 1 to 255), characters within the
specified number of characters will be treated as an input string and set in
memory, and the operation ends. The rest of characters including the return
key are ignored. Editing with the template is available to string input using
this system call. This system call checks and performs four control character
function, as listed previously.


* Console status check

Function:	0BH
Setup:		none
Return value:	0FFH is set in the A register when the keyboard is being
		pressed; otherwise, 00H is set.

This system call checks and performs four control character function, as
listed previously.


4.2 Environment Setting and Readout

The following system calls set the MSX system environment; for example,
changing the default drive, or setting various default values of the system


* System reset

Function:	00H
Setup:		none
Return value:	none

When this is called in MSX-DOS, the system is reset by jumping to 0000H. When
MSX DISK-BASIC call this, it is "warm started". That is, it returns to BASIC
command level without destroying programs currently loaded.


* Version number acquisition

Function:	0CH
Setup:		none
Return value:	HL register <-- 0022H

This system call is for acquiring various CP/M version numbers, on MSX-DOS,
however, 0022H is always returned.


* Disk reset

Function:	0DH
Setup:		none
Return value:	none

If there is a sector which has been changed but not written to the disk, this
system call writes it to the disk, then it sets the default drive to drive A
and sets DMA to 0080H.


* Default drive setting

Funtion:	0EH
Setup:		E register <-- default drive number (A = 00H, B = 01H, ...)
Return value:	none

Disk access by the system calls are made to the drive indicated by the
default drive number, unless otherwise specified. Note that, when the drive
number, which is set in the FCB specified upon calling the system call, is
other than 00H, the default drive setting made by this system call is
ignored.


* Login vector acquisition

Function:	18H
Setup:		none
Return value:	HL register <-- online drive information

The online drive is the drive connected to MSX normally when the disk system
is booted up. Executing this system call causes each drive to be examined
whether it is online, and the result is returned in the HL register as shown
in Figure 3.22. When the bit is "1", the corresponding drive is online;
otherwise it is not.


   Figure 3.22	Login vector

------------------------------------------------------------------------
| register name  |	      H 	    |		 L	       |
|----------------+--------------------------+--------------------------|
|   bit number	 |  7  6  5  4	3  2  1  0  |  7  6  5	4  3  2  1  0  |
|----------------+--------------------------+--------------------------|
|   drive name	 |  meaningless on MSX-DOS  |  H: G: F: E: D: C: B: A: |
|----------------+-----------------------------------------------------|
| online/offline |  1 is set for online and 0 for offline in each bit  |
------------------------------------------------------------------------


* Default drive acquisition

Function:	19H
Setup:		none
Return value:	A register <-- defaut drive number (A = 00H, B = 01H, ...)


* Setting of address to be transferred to

Function:	1AH
Setup:		DE register <-- address setting to be transferred to
				(DMA address)
Return value:	none

Though DMA address is initialized to 0080H at system reset, it can be reset
to any address by using this system call.


* Disk information acquisition

Function:	1BH
Setup:		E register <-- number of the objective drive
			       (default drive = 00H, A = 01H, B = 02H, ...)
Return value:	A register <-- number of logical sectors per one cluster
			       (FFH if E register is set inappropriate)
		BC register <-- logical sector size
		DE register <-- amount of clusters
		IX register <-- DPB starting address
		IY register <-- FAT starting address on memory

This system call gets the information about the disk in the specified drive.
Specifying 00H for the drive number specifies the default drive. For other
than that, specify 01H for drive A, 02H for drive B, and so on.

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Date acquisition

Function:	2AH
Setup:		none
Return value:	HL register <-- year
		D register <-- month
		E register <-- day of month
		A register <-- day of week

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Date setting

Function:	2BH
Setup:		HL register <-- year
		D register <-- month
		E register <-- day of month
Return value:	A indicates whether the system call has done succesfully. If
		successful, the A register is set to 00H; otherwise, 0FFH.

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Time acquisition

Function:	2CH
Setup:		none
Return value:	H register <-- hour
		L register <-- minute
		D register <-- second
		E register <-- 1/100 second

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Time setting

Function:	2DH
Setup:		H register <-- hour
		L register <-- minute
		D register <-- second
		E register <-- 1/100 second
Return value:	If successful, the A register is set to 00H; otherwise, 0FFH

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Verify flag setting

Function:	2EH
Setup:		E register <-- 00H, when resetting verify flag
		E register <-- value other than 00H, when setting
			       the verify flag
Return value:	none

Setting the verify flag causes successive writing to the disk to be done in
mode "verify on". That is, by reading the contents written on the disk, the
check is made to compare them with the contents to be written.

This system call has been created for MSX-DOS and is not compatible with
CP/M.


4.3 Absolute READ/WRITE (direct access to sectors)

MSX manages the disk with the "logical sector" as a minimum unit. The logical
sector is defined independent of the physical secotrs of the disk, and is
numbered from 0 to the maximum logical sector (maximum number depends on the
kind of the disks).

Logical sectors enable users of MSX-DOS or MSX DISK-BASIC to access the disk
without being concerned about the number of physical sectors per track, where
that number depends on the media type of the disk. In fact, by utilizing
system calls which use FCB (file control block), the file can be easily
handled in detail even without considering logical sectors, so the user does
not even need to use logical sectors. But for some purposes, access using
logical sectors is desirable, so MSX-DOS ans MSX DISK-BASIC offer system
calls which can access logical sectors.

This section describes the system calls which access the disk by use of
logical sectors.


* Reading from the disk using logical sectors

Function:	2FH
Setup:		The logical sector number to be read from (for more than
		one logical sector, the starting logical sector number)
		should be set in the DE register. The number of logical
		sectors to be read should be set in the H register, and
		the drive number (00H for drive A, 01H for drive B, and
		so on. The same follows for function 30H below) to be used
		to read should be set in the L register.
Return value:	The contents read are set in the DMA buffer.

This system call reads out a specified number of continuous logical sectors
from the specified logical sector of the specified drive and stores the
contents in memory after DMA. It then stores the contents of what it has read
in memory after DMA. Function 1AH (which specifies the address it is to be
transferred to) assures that there is enough available space in memory.

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Writing to the disk using logocal sectors

Function:	30H
Setup:		Contents to be written should be set in memory area after
		the address indicated by DMA. The logical sector number from
		where the writing begins should be set in the DE register.
		The number of logical sectors to be written should be set
		in the H register. The drive number to be written to should
		be set in the L register.
Return value:	none

This system call has been created for MSX-DOS and is not compatible with
CP/M.



4.4 File Access Using FCB

Since accessing a file is difficult when using the system calls described in
the previous section (which read and write logical sectors directly), system
calls using FCB are needed to easier access the disk by specifying files.

There are three categories of system calls using FCB. First is sequential
file access and second is random file access, both are offered to maintain
CP/M compatibility. The third is what gives MSX-DOS its power: random block
access. This method is not available in CP/M. Random block access has the
following features:

	* Any record size can be specified
	* Random access can be made to multiple records
	* File size can be controlled in bytes

This section describes system calls for file access using FCB, including
random block access. Note that the following three functions do not work
correctly when FCB is in the address range 4000H to 7FFFH:

	1. Function call 11H
	2. Function call 12H
	3. Input/output for devices (CON, PRN, NUL, AUX)


* Opening files

Function:	0FH
Setup:		DE register <-- starting address of FCB which is not opened
Return value:	00H is set in the A register when a file is opened
		succeessfully; otherwise 0FFH is set. When a file is opened
		successfully, each field of the FCB is set.

When 00H is specified for a drive number, the default drive set by function
0EH (default drive setting) is used. To open a file on another drive, specify
01H for drive A, 02H for drive B and so on.

When a file is opened by this system call, all FCB fields except record size,
current block, current record, and random record are set using information
from the directory area on the disk. Fields which are not set should be set
by the user after executing this system call, if needed. The state that each
field of FCB is set is "the state that file is opened" when using system
calls using FCB, and, in this case, system calls which access the file using
FCB, described below, can be used.


* Closing files

Function:	10H
Setup:		DE register <-- starting address of opened FCB
Return value:	00H is set in the A register when file is closed
		scuccessfully; otherwise, 0FFH is set.

By writing the current contents of FCB in memory to the corresponding
directory area on the disk, file information can be kept current. When the
file is only read, it does not need to be closed by using this system call.


* File search - 1

Function:	11H
Setup:		DE register <-- starting address of FCB which is not opened
Return value:	00H is set in the A register when the file is found;
		otherwise 0FFH is set. When the file is found, the directory
		entry (32 bytes) of the file on the disk is set in the area
		indicated by DMA, and FCB drive number is set (thus, 33 bytes
		are used).

Wildcard characters can be used in the name of the file. For example, a
specification "????????.c" causes any file name with an extension of "c" to
be searched for, and the directory information of the file first found is
written in after DMA. To find all matching files or to see whether there is
only one matching file, use function 12H described below.


* File search - 2

Function:	12H
Setup:		none
Return value:	00H is set in the A register when the file is found;
		otherwise 0FFH is set. When the file is found, the directory
		entry (32 bytes) of the file on the disk is set in the area
		indicated by DMA, and the FCB drive number is set
		(thus, 33 bytes are used).

This system call should be used to search for multiple files meeting the file
name specification by wildcard characters in function 11H. So this function
should not be used by itself.

This system call allows the directory information of files meeting the
specifications in function 11H to be listed in order, one by one.


* Deleting files

Function:	13H
Setup:		DE register <-- starting address of FCB which is not opened
Return value:	00H is set in the A register when file is successfully
		deleted., otherwise 0FFH is set.

Using wildcard characters for the file name may cause more than one file to
be deleted. Exercise caution when using wildcards to delete files.


* Sequential readout

Function:	14H
Setup:		DE register <-- starting address of opened FCB
		FCB current block <-- starting block for readout
		FCB current record <-- starting record for readout
Return value:	00H is set in the A register when readout is successful;
		otherwise 01H is set. When successful, one record which has
		been read is set in the area indicated by DMA.

The FCB current block and record will be updated automatically after the
readout. That is, in successive readouts, the current block and record do not
need to be set. The record size for readout is fixed at 128 bytes.


* Sequential writing to the disk

Function:	15H
Setup:		DE register <-- starting address of opened FCB
		FCB current block <-- starting block for writing
		FCB current record <-- starting record for writing
		128 bytes starting from DMA <-- data to be written
Return value:	00H is set in the A register when writing is successful;
		otherwise 01H is set.

The FCB current block and record will be updated automatically after the
readout.


* Creating files

Function:	16H
Setup:		DE register <-- starting address of FCB which is not opened
Retu4rn value:	00H is set in the A register when the file is created
		successfully; otherwise 0FFH is set.

The record size, current block and record, and the random record of the FCB
should be set after executing this system call.


* Renaming files

Function:	17H
Setup:		New file name should be set within 11 bytes after the
		18th byte of the FCB (2nd byte of file size field
		of FCB = 16 bytes after old file name) corresponding to
		old file name (that is, it should be set in 18th to 28th
		byte), the FCB address should be set in the DE register.
Return value:	00H is set in the A register when the file name is renamed
		successfully; otherwise 0FFH is set.

Wildcard characters can be used for both the new and old file names. For
example, specifying "????????.o" for the old file name and "????????.obj" for
the new file name causes the extension of all files having ".o" to be changed
to ".obj".


* Random reading from the disk

Function:	21H
Setup:		DE register <-- starting address of opened FCB
		random record in FCB <-- record for readout
Return value:	00H is set in the A register when readout is successful;
		otherwise 01H is set. When successful, the contents of one
		record which has been read are set in the area indicated
		by DMA.

The lenght of the record is fixed to 128 bytes.


* Random writing to the disk

Function:	22H
Setup:		DE register <-- starting address of opened FCB
		random record in FCB <-- record to be written to
		128 bytes starting from DMA <-- data to be written
Return value:	00H is set in the A register when writing is successful;
		otherwise 01H is set.

The lenght of the record is fixed to 128 bytes.


* File size acquisition

Function:	23H
Setup:		DE register <-- starting address of FCB which is not opened
Return value:	00H is set in the A register when the function is successful;
		otherwise 00H is set. When successful, the size of the
		specified file is set in increments of 128 bytes, in the
		first three bytes of the random record field.

The file size is calculated in increments of 128 bytes. That is, 2 would be
set for files ranging in size from 129 bytes to 256 bytes. Thus a file with
257 bytes would return a value of 3.


* Random record field setting

Function:	24H
Setup:		DE register <-- starting address of opened FCB
		FCB current block <-- objective block
		FCB current record <-- objective record
Return value:	Current record position, calculated from the current block
		and record fields of specified FCB, is set in the random
		record field.


* Random writing to the disk - 2 (random block access)

Function:	26H
Setup:		DE register <-- the starting address from the FCB
		FCB record size <-- size of record to be written
		FCB random record <-- the record ID number
		HL register <-- the number of records to be written
		DMA memory buffer <-- the data to be written
Return value:	00H is set in the A register when writing is successful;
		otherwise 01H is set.

After writing to the disk, the value of the random record field is
automatically updated and points to the next record. The size of one record
can be set to any value from 1 byte to 65535 bytes by setting the desired
value in the FCB record size field. When 0 records are to be written, the
file lenght is calculated at the record size multiplied by the record number.
The rest is discarded.

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Random readout - 2 (random block access)

Function:	27H
Setup:		DE register <-- starting address of opened FCB
		FCB record size <-- record size to be read
		FCB random record <-- record to start reading
		HL register <-- number of records to be read
Return value:	00H is set in the A register when data is read successfully;
		otherwise 01H is read. The number of records actually read
		is set back in the HL register. When this number is almost
		one, the data which has been read is set in the area
		indicated by DMA.

After readout, the random record field is automatically updated. After
executing this system call, the total number of records actually read is set
in the HL register. That is, if the end of file is reached before the
specified number of records have been read, the actual number of records read
will be returned in the HL register.

This system call has been created for MSX-DOS and is not compatible with
CP/M.


* Random writing - 3

Function:	28H
Setup:		DE register <-- starting address of opened FCB
		FCB random record <-- record to be written
		128 bytes in DMA buffer <-- data to be written
Return value:	00H is set in the A register when writing is successful;
		otherwise, 01H is set.

The lenght of records is fixed at 128 bytes.

This system call is the same as 22H except for one point. When the file
becomes large, 00H is written to the added records coming before the
specified record.


INDEX

- A -                                "CLEAR" 163                          .
                                     CLIKFL 57, 231                       .
"ABS" 97                             CLIKSW 57, 197, 212                  .
Angles 152                           CLINEF 152, 225                      .
ARG 90, 223                          Clipping 70                          .
Array storage 155, 162, 208          CLMLST 126, 211                      .
ARYTAB 137, 208, 220                 "CLOAD" 180                          .
"ASC" 168                            CLOC 70, 225                         .
ASPCT1 77, 215                       "CLOSE" 173                          .
ASPEC2 77, 215                       CLPRIM 31, 210                       .
ASPECT 150, 225                      "CLS" 41                             .
"ATN" 93                             CMASK 70, 225                        .
ATRBAS 34, 225                       "CMD" 202                            .
ATRBYT 69, 72, 76, 144, 214          CNPNTS 150, 225                      .
"ATTR$" 203                          CNSDFG 49, 212                       .
AUTFLG 116, 219                      Coincidence 9, 52                    .
AUTINC 116, 219                      "COLOR" 197                          .
AUTLIN 116, 219                      Colours 12, 39, 40, 77               .
"AUTO" 125                           CONLO 121, 217                       .
                                     Control codes 44                     .
- B -                                CONSAV 121, 217                      .
                                     "CONT" 162                           .
BAKCLR 39, 213                       CONTXT 121, 217                      .
"BASE" 200, 201                      CONTYP 121, 217                      .
BASROM 32, 86, 230                   Coordinates, graphic 70, 143         .
Baud rate 79, 197                    Coordinates, text 42, 47, 51         .
BDRATR 77, 235                       "COPY" 202                           .
BDRCLR 40, 213                       "COS" 92                             .
"BEEP" 60                            CPCNT8 152, 226                      .
"BIN$" 165                           CPLOTF 150, 226                      .
"BLOAD" 177                          Crash 30                             .
BOTTOM 204, 232                      CRCSUM 151, 226                      .
Boundary inflections 148             CRTCNT 47, 51, 211                   .
"BSAVE" 177                          CS1200 197, 214                      .
BUF 85, 127, 176, 216                CS2400 197, 214                      .
                                     "CSAVE" 179                          .
- C -                                CSAVEA 78, 149, 226                  .
                                     CSAVEM 78, 149, 226                  .
"CALL" 140                           CSCLXY 150, 226                      .
Caps LED 6, 57                       "CSNG" 100                           .
CAPST 57, 234                        "CSRLIN" 196                         .
CASPRV 184, 235                      CSRSW 45, 234                        .
Cassette input 24, 81                CSRX 43, 212                         .
Cassette motor 6, 65, 78             CSRY 43, 212                         .
Cassette output 6, 79                CSTCNT 150, 226                      .
"CDBL" 100                           CSTYLE 45, 85, 234                   .
CENCNT 150, 225                      CTRL-STOP 32, 33, 42, 57, 59         .
CGPBAS 34, 224                       CURLIN 56, 115, 116, 216             .
CGPNT 38, 204, 224, 256              CURSAV 46, 231                       .
Character set 38, 84, 256            Cursor 13, 32, 42, 43, 46            .
"CHR$" 168                           "CVD" 204                            .
"CINT" 99                            "CVI" 203                            .
"CIRCLE" 150                         "CVS" 204                            .
                                                                          .
                                                                          .
                                                                          .
- i1 -                                                                    .
                                                                          .
                                                                          .
INDEX                                                                     .
                                                                          .
                                                                          .
                                                                          .
CXOFF 152, 226                       Expander 4                           .
CYOFF 152, 226                       Extension ROM 30, 140, 178, 205      .
                                     Expression Evaluator 128             .
- D -                                EXPTBL 5, 32, 236                    .
                                                                          .
DAC 90, 223                          - F -                                .
"DATA" 123                                                                .
Data areas 26                        Factor Evaluator 129                 .
DATLIN 115, 128, 218                 FBUFFR 106, 137, 222                 .
DATPTR 161, 220                      "FIELD" 203                          .
Dead key 56, 58                      File Control Block 66, 209           .
"DEFDBL" 121                         "FILES" 173                          .
"DEFFN" 134                          Filespec 171                         .
"DEFINT" 121                         FILNAM 171, 180, 224                 .
"DEFSNG" 121                         FILNM2 181, 224                      .
"DEFSTR" 12I                         FILTAB 208, 223                      .
DEFTBL 121, 221                      "FIX" 101                            .
"DEFUSR" 134                         FLGINP 127, 219                      .
"DELETE" 137                         "FN" 134                             .
Dequeueing 60                        FNKFLG 56, 231                       .
DEVICE 142, 237                      FNKSTR 65, 224                       .
Device 140, 171, 178                 "FOR" 119                            .
"DIM" 155                            FORCLR 40, 213                       .
DIMFLG 155, 217                      "FPOS" 175                           .
DOT 115, 219                         "FRE" 171                            .
"DRAW" 153                           FRETOP 159, 208, 218                 .
DRWANG 154, 235                      FSTPOS 84, 88, 230                   .
DRWFLG 154, 235                      FUNACT 159, 222                      .
DRWSCL 154, 235                      Function addresses 110, 130          .
"DSKF" 202                           Function key display 49, 53          .
"DSKI$" 203                          Function keys 56, 58, 65             .
"DSKO$" 202                                                               .
                                     - G -                                .
- E -                                                                     .
                                     "GET" 193                            .
Editor 84                            GETPNT 33, 59, 214                   .
Edit keys 85                         "GOSUB" 122                          .
"ELSE" 123, 125                      "GOTO" 123                           .
"END" 161                            Graphic characters 42                .
ENDFOR 119, 218                      Graphic output 69                    .
ENSTOP 53, 230                       GRPACX 69, 143, 235                  .
"EOF" 175                            GRPACY 69, 143, 235                  .
"ERASE" 162                          GRPATR 36, 212                       .
"ERL" 130                            GRPHED 42, 234                       .
"ERR" 130                            GRPNAM 36, 212                       .
ERRFLG 115, 130, 215                 GRPPAT 36, 212                       .
ERRLIN 115, 125, 130, 219            GXPOS 144, 235                       .
"ERROR" 125                          GYPOS 144, 235                       .
Error generators 115, 176                                                 .
Error handler 115                    - H -                                .
Error messages 113                                                        .
ERRTXT 115, 125, 220                 HEADER 79, 215                       .
ESCCNT 43, 234                       "HEX$" 165                           .
"EXP" 94                             HIMEM 163, 204, 206, 232             .
                                                                          .
                                                                          .
                                                                          .
- i2 -                                                                    .
                                                                          .
                                                                          .
INDEX                                                                     .
                                                                          .
                                                                          .
                                                                          .
Hooks 30, 204, 237                   Links 117                            .
                                     LINL32 34, 211                       .
- I -                                LINL40 34, 211                       .
                                     LINLEN 34, 211                       .
ID Bytes A0                          LINTTB 39, 84, 230                   .
"IF" 125                             LINWRK 46, 232                       .
"INKEY$" 187                         "LIST" 137                           .
"INP" 114                            "LLIST" 136                          .
"INPUT" 127                          "LOAD" 172                           .
"INPUT$" 174                         "LOC" 174                            .
Input, keyboard 53, 59               "LOCATE" 193                         .
INSFLG 85, 234                       "LOF" 174                            .
"INSTR" 170                          "LOG" 93                             .
"INT" 101                            LOWLIM 81, 233                       .
INTCNT 52, 233                       "LPOS" 132                           .
Interrupt mode 32                    "LPRINT" 125                         .
Interrupts 9, 52, 56, 161            LPTPOS 83, 125, 132, 215             .
"INTERVAL" 194                       "LSET" 203                           .
INTFLG 32, 57, 233                                                        .
INTVAL 52, 233                       - M -                                .
I/O Buffer 66, 125, 130, 171                                              .
I/O Dispatcher 178                   Macro parser 142                     .
"IPL" 202                            Mainloop 116                         .
                                     Math constants 97                    .
- J -                                Math operators 112                   .
                                     MAXDEL 147, 225                      .
Japanese 4, 13, 25, 26, 58, 88,      MAXFIL 171, 223                      .
  211, 234                           "MAXFILES" 206                       .
JIFFY 52, 196, 233                   MAXUPD 147, 213                      .
Joystick 24, 52, 63                  MCLFLG 142, 188, 227                 .
                                     MCLLEN 142, 188, 229                 .
- K -                                MCLPTR 142, 188, 229                 .
                                     MCLTAB 142, 188, 227                 .
KANAMD 33, 234                       MEMSIZ 159, 163, 208, 217            .
KANAST 58, 234                       "MERGE" 172                          .
Kansas City 79                       "MID$" 169, 170                      .
KBUF 116, 118, 216                   MINDEL 147, 225                      .
"KEY" 195                            MINUPD 147, 213                      .
Keyboard 5, 53, 55, 66               "MKD$" 203                           .
KEYBUF 33, 231                       "MKI$" 203                           .
Key click 6, 57, 58                  "MKS$" 203                           .
Key numbers 54                       MLTATR 36, 212                       .
Keywords, BASIC 110                  MLTNAM 36, 212                       .
"KILL" 202                           MLTPAT 36, 212                       .
                                     "MOTOR" 187                          .
- L -                                MOVCNT 149, 227                      .
                                     MSX2 228, 239, 240                   .
"LEFT$" 169                          MSX2+ 239, 240                       .
"LEN" 168                            MUSICF 52, 62, 229                   .
"LET" 123                            Music packet 61, 193                 .
"LFILES" 173                                                              .
"LINE" 145                           - N -                                .
"LINE INPUT" 126                                                          .
Line numbers 117, 118, 119, 122      NAMBAS 34, 224                       .
                                                                          .
                                                                          .
                                                                          .
- i3 -                                                                    .
                                                                          .
                                                                          .
INDEX                                                                     .
                                                                          .
                                                                          .
                                                                          .
"NAME" 202                           Printer 33, 41, 83                   .
"NEW" 159                            PRMLEN 159, 221                      .
NEWKEY 53, 231                       PRMLN2 159, 222                      .
Newton-Raphson 93                    PRMSTK 159, 221                      .
"NEXT" 164                           PROCNM 140, 237                      .
NLONLY 159, 224                      Program storage 117, 208             .
NOFUNS 135, 156, 222                 PRSCNT 188 228                       .
NTMSXP 83, 197, 216                  PRTFLG 83, i25, 215                  .
NULBUF 208, 223                      "PSET" 144                           .
Numeric output 106                   PSG 21, 33, 34, 60, 190              .
Numeric types 104                    PTRFIL 66, 125, 223                  .
                                     "PUT" 193                            .
- O -                                PUTPNT 33, 59, 214                   .
                                                                          .
"OCT$" 164                           - Q -                                .
OLDKEY 33, 53, 231                                                        .
OLDLIN 115, 162, 220                 QUEBAK 68, 228                       .
OLDSCR 34, 136, 234                  QUETAB 34, 67, 228                   .
OLDTXT 60, 115, 159, 162, 220        Queue 60, 67, 68, 189                .
"ON" 124                             QUEUEN 62, 229                       .
ONEFLG 124, 159, 220                 QUEUES 68, 214                       .
ONELIN 115, 124, 159, 220                                                 .
ONGSBF 56, 160, 231                  - R -                                .
"OPEN" 172                                                                .
"OUT" 114                            R800 244                             .
Output, Interpreter 82               RDPRIM 30 210                        .
Output, screen 43, 69                "READ" 104, 115, 127, 128, 175, 219  .
                                     "REM" 123                            .
- P -                                "RENUM" 138                          .
                                     REPCNT 53, 214                       .
"PAD" 197                            "RESTORE" 161                        .
Paddle 25, 64                        "RESUME" 124                         .
PADX 65, 233                         "RETURN" 123                         .
PADY 65, 233                         RG0SAV (till RG7SAV) 35, 212         .
Page 3                               RG8SAV (till RG27SAV) ?              .
"PAINT" 148                          "RIGHT$" 169                         .
PARM1 135 156, 221                   "RND" 94                             .
PARM2 135 222                        RNDX 94, 159, 223                    .
PATBAS 34, 224                       RS2IQ 228                            .
PATWRK 69, 232                       "RSET" 203                           .
"PDL" 196                            "RUN" 122                            .
"PEEK" 138                           RUNBNF 177, 235                      .
"PLAY" 188, 196                      Runloop 120                          .
PLYCNT 62, 189, 229                                                       .
"POINT" 144                          - S -                                .
Pointers 118, 139                                                         .
"POKE" 138                           "SAVE" 172                           .
Polynomial 95                        SAVENT 179, 235                      .
"POS" 132                            SAVSTK 115, 120, 159, 219            .
Power-up 32, 204                     SAVTXT 120, 219                      .
Precedence 112, 129                  SCNCNT 52, 214                       .
"PRESET" 144                         "SCREEN" 197                         .
Primary Slot 3, 30, 32, 66           SCRMOD 34, 136, 234                  .
"PRINT" 125                          Secondary Slot 4, 30, 32, 239        .
                                                                          .
                                                                          .
                                                                          .
- i4 -                                                                    .
                                                                          .
                                                                          .
INDEX                                                                     .
                                                                          .
                                                                          .
                                                                          .
"SET" 202                            - U -                                .
"SGN" 98                                                                  .
"SIN" 92                             "USR" 133                            .
SKPCNT 149, 227                      USRTAB 133, 210                      .
Slot ID 29, 140, 205                                                      .
SLTATR 140, 205, 236                 - V -                                .
SLTTBL 32, 236                                                            .
"SOUND" 188                          "VAL" 169                            .
"SPACE$" 169                         VALTYP 104, 217                      .
"SPRITE" 194, 197, 198               Variable storage 135, 155, 208       .
Sprites 9, 18, 37, 199               "VARPTR" 130                         .
"SQR" 93                             VARTAB 137, 208, 220                 .
Stack space 159                      VCBA 34, 61, 67, 230                 .
Standard routines 26                 "VDP" 199, 200                       .
Statement addresses 109, 136         VDP Address Register 8, 40           .
STATFL 52, 213                       VDP Mode Registers 9, 35             .
"STICK" 196                          VDP Modes 10, 13, 34, 41             .
STKTOP 159, 163, 209, 217            VDP Status Register 9, 52, 65        .
"STOP" 161, 194                      VDP Timing 39                        .
"STR$" 165                           "VPEEK" 201                          .
STREND 137, 208, 220                 "VPOKE" 201                          .
"STRIG" 194, 196                     VLZADR 115, 216                      .
"STRING$" 168                        VLZDAT 115, 216                      .
String storage 133, 163, 166, 168                                         .
SUBFLG 155, 218                      - W -                                .
"SWAP" 162                                                                .
SWPTMP 162, 222                      "WAIT" 114                           .
                                     Wait state 81                        .
- T -                                Warm start 53                        .
                                     "WIDTH" 136                          .
T32ATR 34, 211                       WINWID 81, 233                       .
T32CGP 34, 211                       Workspace Area 32, 208               .
T32NAM 34, 211                       WRPRIM 30, 210                       .
T32PAT 34, 211                                                            .
"TAN" 93                             - Z -                                .
TEMPPT 159, 218                                                           .
TEMPST 124, 218                      Z80 Clock 81                         .
"TIME" 196                                                                .
Tokens 111, 117, 118, 121, 137                                            .
Touchpad 25, 64                                                           .
TRCFLG 120, 222                                                           .
TRGFLG 52, 213                                                            .
"TROFF" 162                                                               .
"TRON" 162                                                                .
TRPTBL 32, 56, 160, 194, 232                                              .
TTYPOS 43, 125, 132, 216                                                  .
turbo R 65, 239, 240                                                      .
TXTCGP 34, 211                                                            .
TXTNAM 34 211                                                             .
TXTTAB 117, 204, 208, 218                                                 .
Types 140                                                                 .
                                                                          .
                                                                          .
                                                                          .
                                                                          .
                                                                          .
                                                                          .
- i5 -