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:
Expanded Slot Register=FFFFH ---+-----------------------+ | Workspace Area | HIMEM=F380H-------| | +-----------------------+ ---+ | I/O Buffer 1 | | +-----------------------+ | | FCB 1 | | +-----------------------+ | | I/O Buffer 0 | | NULBUF=F177H------| | | +-----------------------+ +--- Disk Work Area | FCB 0 | | +-----------------------+ | | F277H (FCB 1) | | +-----------------------+ | FILTAB=F16AH------| F16EH (FCB 0) | | +-----------------------+ | | 00H | | +-----------------------+ ---+ MEMSIZ=F168H---+--| | | FRETOP=F168H---+ | String Storage Area | | | | | STKTOP=F0A0H------| | | +-----------------------+ | | Z80 Stack | | | | | +-----------------------+ | . . | STREND=8003H------. . | +-----------------------+ +--- User Work Area | Array Storage Area | | ARYTAB=8003H------| | | +-----------------------+ | | Variable Storage Area | | VARTAB=8003H------| | | +-----------------------+ | | Program Text Area | | | | | TXTTAB=8001H------+-----------------------+ | | 00H | | BOTTOM=8000H------+-----------------------+ ---+
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:
STKTOP-------| | +-----+ | 00H | Mainloop SP-------| 00H | +-----+ | 46H | Statement SP-------| 01H | +-----+
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:
0 1 2 3 4 5 6 7 8 +-----+-----+-----+-----+-----+-----+-----+-----+-----+ | Mod | 00H | 00H | 00H | DEV | 00H | POS | 00H | PPS | +-----+-----+-----+-----+-----+-----+-----+-----+-----+
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:
F380H RDPRIM: OUT (0A8H),A ; Set new Primary Slot F382H LD E,(HL) ; Read memory F383H JR WRPRM1 ; Restore old Primary Slot
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.
F385H WRPRIM: OUT (0A8H),A ; Set new Primary Slot F387H LD (HL),E ; Write to memory F388H WRPRM1: LD A,D ; Get old setting F389H OUT (0A8H),A ; Restore old Primary Slot F38BH RET
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.
F38CH CLPRIM: OUT (0A8H),A ; Set new Primary Slot F38EH EX AF,AF' ; Swap to AF for call F38FH CALL CLPRM1 ; Do it F392H EX AF,AF' ; Swap to AF F393H POP AF ; Get old setting F394H OUT (0A8H),A ; Restore old Primary Slot F396H EX AF,AF' ; Swap to AF F397H RET F398H CLPRM1: JP (IX)
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.
F39AH USRTAB: DEFW 475AH ; USR 0 F39CH DEFW 475AH ; USR 1 F39EH DEFW 475AH ; USR 2 F3A0H DEFW 475AH ; USR 3 F3A2H DEFW 475AH ; USR 4 F3A4H DEFW 475AH ; USR 5 F3A6H DEFW 475AH ; USR 6 F3A8H DEFW 475AH ; USR 7 F3AAH DEFW 475AH ; USR 8 F3ACH DEFW 475AH ; USR 9
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.
F3B3H TXTNAM: DEFW 0000H ; Text Name Table Base F3B5H TXTCOL: DEFW 0000H ; Text Colour Table Base F3B7H TXTCGP: DEFW 0800H ; Text Character Generator Pattern Base F3B9H TXTATR: DEFW 0000H ; Text Sprite Attribute Base F3BBH TXTPAT: DEFW 0000H ; Text Sprite Pattern Base
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.
F3BDH T32NAM: DEFW 1800H ; Text 32 Name Table Base F3BFH T32COL: DEFW 2000H ; Text 32 Colour Table Base F3C1H T32CGP: DEFW 0000H ; Text 32 Character Generator Pattern Base F3C3H T32ATR: DEFW 1B00H ; Text 32 Sprite Attribute Base F3C5H T32PAT: DEFW 3800H ; Text 32 Sprite Pattern Base
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
F3C7H GRPNAM: DEFW 1800H ; Graphic Name Table Base F3C9H GRPCOL: DEFW 2000H ; Graphic Colour Table Base F3CBH GRPCGP: DEFW 0000H ; Graphic Character Generator Pattern Base F3CDH GRPATR: DEFW 1B00H ; Graphic Sprite Attribute Base F3CFH GRPPAT: DEFW 3800H ; Graphic Sprite Pattern Base
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.
F3D1H MLTNAM: DEFW 0800H ; Multicolour Name Table Base F3D3H MLTCOL: DEFW 0000H ; Multicolour Colour Table Base F3D5H MLTCGP: DEFW 0000H ; Multicolour Character Generator Pattern Base F3D7H MLTATR: DEFW 1B00H ; Multicolour Sprite Attribute Base F3D9H MLTPAT: DEFW 3800H ; Multicolour Sprite Pattern Base
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.
F3DFH RG0SAV: DEFB 00H F3E0H RG1SAV: DEFB F0H F3E1H RG2SAV: DEFB 00H F3E2H RG3SAV: DEFB 00H F3E3H RG4SAV: DEFB 01H F3E4H RG5SAV: DEFB 00H F3E5H RG6SAV: DEFB 00H F3E6H RG7SAV: DEFB F4H
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.
F3FCH CS1200: DEFB 53H ; LO cycle 1st half F3FDH DEFB 5CH ; LO cycle 2nd half F3FEH DEFB 26H ; HI cycle 1st half F3FFH DEFB 2DH ; HI cycle 2nd half F400H DEFB 0FH ; Header cycle count
These five variables contain the 1200 baud cassette parameters. Their values are set at power-up and thereafter unaltered.
F401H CS2400: DEFB 25H ; LO cycle 1st half F402H DEFB 2DH ; LO cycle 2nd half F403H DEFB 0EH ; HI cycle 1st half F404H DEFB 16H ; HI cycle 2nd half F405H DEFB 1FH ; Header cycle count
These five variables contain the 2400 baud cassette parameters. Their values are set at power-up and thereafter unaltered. - 214 - 6. MEMORY MAP
F406H LOW : DEFB 53H ; LO cycle 1st half F407H DEFB 5CH ; LO cycle 2nd half F408H HIGH : DEFB 26H ; HI cycle 1st half F409H DEFB 2DH ; HI cycle 2nd half F40AH HEADER: DEFB 0FH ; Header cycle count
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.
F40FH ENDPRG: DEFB ":" F410H DEFB 00H F411H DEFB 00H FE12H DEFB 00H F413H DEFB 00H
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
F6CAH DEFTBL: DEFB 08H ; A F6CBH DEFB 08H ; B F6CCH DEFB 08H ; C F6CDH DEFB 08H ; D F6CEH DEFB 08H ; E F6CFH DEFB 08H ; F F6D0H DEFB 08H ; G F6D1H DEFB 08H ; H F6D2H DEFB 08H ; I F6D3H DEFB 08H ; J F6D4H DEFB 08H ; K F6D5H DEFB 08H ; L F6D6H DEFB 08H ; M F6D7H DEFB 08H ; N F6D8H DEFB 08H ; O F6D9H DEFB 08H ; P F6DAH DEFB 08H ; Q F6DBH DEFB 08H ; R F6DCH DEFB 08H ; S F6DDH DEFB 08H ; T F6DEH DEFB 08H ; U F6DFH DEFB 08H ; V F6E0H DEFB 08H ; W F6E1H DEFB 08H ; X F6E2H DEFB 08H ; Y F6E3H DEFB 08H ; Z
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".
F959H QUETAB: DEFB 00H ; AQ Put position F95AH DEFB 00H ; AQ Get position F95BH DEFB 00H ; AQ Putback flag F95CH DEFB 7FH ; AQ Size F95DH DEFW F975H ; AQ Address F95FH DEFB 00H ; BQ Put position F960H DEFB 00H ; BQ Get position F961H DEFB 00H ; BQ Putback flag F962H DEFB 7FH ; BQ Size F963H DEFW F9F5H ; BQ Address F965H DEFB 00H ; CQ Put position F966H DEFB 00H ; CQ Get position F967H DEFB 00H ; CQ Putback flag F968H DEFB 7FH ; CQ Size F969H DEFW FA75H ; CQ Address F96BH DEFB 00H ; RQ Put position F96CH DEFB 00H ; RQ Get position F96DH DEFB 00H ; RQ Putback flag F96EH DEFB 00H ; RQ Size F96FH DEFW 0000H ; RQ Address
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.
F971H QUEBAK: DEFB 00H ; AQ Putback character F972H DEFB 00H ; BQ Putback character F973H DEFB 00H ; CQ Putback character F974H DEFB 00H ; RQ Putback character
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.
F975H VOICAQ: DEFS 128 ; Voice A queue F9F5H VOICBQ: DEFS 128 ; Voice B queue FA75H VOICCQ: DEFS 128 ; Voice C queue FAF5H RS2IQ : DEFS 64 ; RS232 queue
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.
FC4CH TRPTBL: DEFS 3 ; KEY 1 FC4FH DEFS 3 ; KEY 2 FC52H DEFS 3 ; KEY 3 FC55H DEFS 3 ; KEY 4 FC58H DEFS 3 ; KEY 5 FC5BH DEFS 3 ; KEY 6 FC5EH DEFS 3 ; KEY 7 FC61H DEFS 3 ; KEY 8 FC64H DEFS 3 ; KEY 9 FC67H DEFS 3 ; KEY 10 FC6AH DEFS 3 ; STOP FC6DH DEFS 3 ; SPRITE FC70H DEFS 3 ; STRIG 0 FC73H DEFS 3 ; STRIG 1 FC76H DEFS 3 ; STRIG 2 FC79H DEFS 3 ; STRIG 3 FC7CH DEFS 3 ; STRIG 4 FC7FH DEFS 3 ; INTERVAL FC82H DEFS 3 ; Unused FC85H DEFS 3 ; Unused FC88H DEFS 3 ; Unused FC8BH DEFS 3 ; Unused FC8EH DEFS 3 ; Unused FC91H DEFS 3 ; Unused FC94H DEFS 3 ; Unused FC97H DEFS 3 ; Unused
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:
Bit 7 set=BASIC program Bit 6 set=Device handler Bit 5 set=Statement handler
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.
RST 30H
DEFB Slot ID
DEFW Address
RET
The hooks are listed on the following pages together with the address they are called from and a brief note as to their function.
FD9AH HKEYI : DEFS 5 ; 0C4AH Interrupt handler FD9FH HTIMI : DEFS 5 ; 0C53H Interrupt handler FDA4H HCHPU : DEFS 5 ; 08C0H CHPUT standard routine FDA9H HDSPC : DEFS 5 ; 09E6H Display cursor FDAEH HERAC : DEFS 5 ; 0A33H Erase cursor FDB3H HDSPF : DEFS 5 ; 0B2BH DSPFNK standard routine FDB8H HERAF : DEFS 5 ; 0B15H ERAFNK standard routine FDBDH HTOTE : DEFS 5 ; 0842H TOTEXT standard routine FDC2H HCHGE : DEFS 5 ; 10CEH CHGET standard routine FDC7H HINIP : DEFS 5 ; 071EH Copy character set to VDP FDCCH HKEYC : DEFS 5 ; 1025H Keyboard decoder FDD1H HKYEA : DEFS 5 ; 0F10H Keyboard decoder FDD6H HNMI : DEFS 5 ; 1398H NMI standard routine FDDBH HPINL : DEFS 5 ; 23BFH PINLIN standard routine FDE0H HQINL : DEFS 5 ; 23CCH QINLIN standard routine FDE5H HINLI : DEFS 5 ; 23D5H INLIN standard routine FDEAH HONGO : DEFS 5 ; 7810H "ON DEVICE GOSUB" FDEFH HDSKO : DEFS 5 ; 7C16H "DSKO$" FDF4H HSETS : DEFS 5 ; 7C1BH "SET" FDF9H HNAME : DEFS 5 ; 7C20H "NAME" FDFEH HKILL : DEFS 5 ; 7C25H "KILL" FE03H HIPL : DEFS 5 ; 7C2AH "IPL" FE08H HCOPY : DEFS 5 ; 7C2FH "COPY" FE0DH HCMD : DEFS 5 ; 7C34H "CMD" FE12H HDSKF : DEFS 5 ; 7C39H "DSKF" FE17H HDSKI : DEFS 5 ; 7C3EH "DSKI$" FE1CH HATTR : DEFS 5 ; 7C43H "ATTR$" FE21H HLSET : DEFS 5 ; 7C48H "LSET" FE26H HRSET : DEFS 5 ; 7C4DH "RSET" FE2BH HFIEL : DEFS 5 ; 7C52H "FIELD" FE30H HMKI$ : DEFS 5 ; 7C57H "MKI$" FE35H HMKS$ : DEFS 5 ; 7C5CH "MKS$" FE3AH HMKD$ : DEFS 5 ; 7C61H "MKD$" FE3FH HCVI : DEFS 5 ; 7C66H "CVI" FE44H HCVS : DEFS 5 ; 7C6BH "CVS" FE49H HCVD : DEFS 5 ; 7C70H "CVD" FE4EH HGETP : DEFS 5 ; 6A93H Locate FCB FE53H HSETF : DEFS 5 ; 6AB3H Locate FCB FE58H HNOFO : DEFS 5 ; 6AF6H "OPEN" FE5DH HNULO : DEFS 5 ; 6B0FH "OPEN" FE62H HNTFL : DEFS 5 ; 6B3BH Close I/O buffer 0 FE67H HMERG : DEFS 5 ; 6B63H "MERGE/LOAD" FE6CH HSAVE : DEFS 5 ; 6BA6H "SAVE" FE71H HBINS : DEFS 5 ; 6BCEH "SAVE" FE76H HBINL : DEFS 5 ; 6BD4H "MERGE/LOAD" FE7BH HFILE : DEFS 5 ; 6C2FH "FILES" FE80H HDGET : DEFS 5 ; 6C3BH "GET/PUT" FE85H HFILO : DEFS 5 ; 6C51H Sequential output FE8AH HINDS : DEFS 5 ; 6C79H Sequential input FE8FH HRSLF : DEFS 5 ; 6CD8H "INPUT$" FE94H HSAVD : DEFS 5 ; 6D03H "LOC", 6D14H "LOF", ; 6D25H "EOF", 6D39H "FPOS" FE99H HLOC : DEFS 5 ; 6D0FH "LOC" FE9EH HLOF : DEFS 5 ; 6D20H "LOF" FEA3H HEOF : DEFS 5 ; 6D33H "EOF" FEA8H HFPOS : DEFS 5 ; 6D43H "FPOS" FEADH HBAKU : DEFS 5 ; 6E36H "LINE INPUT#" FEB2H HPARD : DEFS 5 ; 6F15H Parse device name FEB7H HNODE : DEFS 5 ; 6F33H Parse device name FEBCH HPOSD : DEFS 5 ; 6F37H Parse device name FEC1H HDEVN : DEFS 5 ; This hook is not used. FEC6H HGEND : DEFS 5 ; 6F8FH I/O function dispatcher FECBH HRUNC : DEFS 5 ; 629AH Run-clear FED0H HCLEA : DEFS 5 ; 62A1H Run-clear FED5H HLOPD : DEFS 5 ; 62AFH Run-clear FEDAH HSTKE : DEFS 5 ; 62F0H Reset stack FEDFH HISFL : DEFS 5 ; 145FH ISFLIO standard routine FEE4H HOUTD : DEFS 5 ; 1B46H OUTDO standard routine FEE9H HCRDO : DEFS 5 ; 7328H CR,LF to OUTDO FEEEH HDSKC : DEFS 5 ; 7374H Mainloop line input FEF3H HDOGR : DEFS 5 ; 593CH Line draw FEF8H HPRGE : DEFS 5 ; 4039H Program end FEFDH HERRP : DEFS 5 ; 40DCH Error handler FF02H HERRF : DEFS 5 ; 40FDH Error handler FF07H HREAD : DEFS 5 ; 4128H Mainloop "OK" FF0CH HMAIN : DEFS 5 ; 4134H Mainloop FF11H HDIRD : DEFS 5 ; 41A8H Mainloop direct statement FF16H HFINI : DEFS 5 ; 4237H Mainloop finished FF1BH HFINE : DEFS 5 ; 4247H Mainloop finished FF20H HCRUN : DEFS 5 ; 42B9H Tokenize FF25H HCRUS : DEFS 5 ; 4353H Tokenize FF2AH HISRE : DEFS 5 ; 437CH Tokenize FF2FH HNTFN : DEFS 5 ; 43A4H Tokenize FF34H HNOTR : DEFS 5 ; 44EBH Tokenize FF39H HSNGF : DEFS 5 ; 45D1H "FOR" FF3EH HNEWS : DEFS 5 ; 4601H NEWSTT, Runloop new statement FF43H HGONE : DEFS 5 ; 4646H Runloop execute FF48H HCHRG : DEFS 5 ; 4666H CHRGTR standard routine FF4DH HRETU : DEFS 5 ; 4821H "RETURN" FF52H HPRTF : DEFS 5 ; 4A5EH "PRINT" FF57H HCOMP : DEFS 5 ; 4A54H "PRINT" FF5CH HFINP : DEFS 5 ; 4AFFH "PRINT" FF61H HTRMN : DEFS 5 ; 4B4DH "READ/INPUT" error FF66H HFRME : DEFS 5 ; 4C6DH Expression Evaluator FF6BH HNTPL : DEFS 5 ; 4CA6H Expression Evaluator FF70H HEVAL : DEFS 5 ; 4DD9H Factor Evaluator FF75H HOKNO : DEFS 5 ; 4F2CH Factor Evaluator FF7AH HFING : DEFS 5 ; 4F3EH Factor Evaluator FF7FH HISMI : DEFS 5 ; 51C3H Runloop execute FF84H HWIDT : DEFS 5 ; 51CCH "WIDTH" FF89H HLIST : DEFS 5 ; 522EH "LIST" FF8EH HBUFL : DEFS 5 ; 532DH Detokenize FF93H HFRQI : DEFS 5 ; 543FH Convert to integer FF98H HSCNE : DEFS 5 ; 5514H Line number to pointer FF9DH HFRET : DEFS 5 ; 67EEH Free descriptor FFA2H HPTRG : DEFS 5 ; 5EA9H Variable search FFA7H HPHYD : DEFS 5 ; 148AH PHYDIO standard routine FFACH HFORM : DEFS 5 ; 148EH FORMAT standard routine FFB1H HERRO : DEFS 5 ; 406FH Error handler FFB6H HLPTO : DEFS 5 ; 085DH LPTOUT standard routine FFBBH HLPTS : DEFS 5 ; 0884H LPTSTT standard routine FFC0H HSCRE : DEFS 5 ; 79CCH "SCREEN" FFC5H HPLAY : DEFS 5 ; 73E5H "PLAY" statement
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).
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:
A0. This presentation .......................... 240 A1. MSX2 and MSX2+ VDP ......................... ??? A2. MSX BIOS Complement Data ................... ??? A3. MSX2, MSX2+ and turbo R BIOS ............... ??? A4. MSX2, MSX2+ and turbo R Sub-BIOS ........... ??? A5. MSX2, MSX2+ and turbo R Word Area .......... ??? A6. MSX2, MSX2+ and turbo R I/O Port Map ....... ???
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:
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:
7 6 5 4 3 2 1 0 +----+----+----+----+----+---------+----+ |Kata|D2SJ|RGB |Clip|Mask|VRAM Size|Conv| +----+----+----+----+----+---------+----+
Conv : 0 = don't convert "romaji", 1 = convert. VRAM Size: 00 = 16 KBytes, 01 = 64 KBytes, 10 = 128 KBytes. Mask : 0 = don't mask, 1 = mask (VRAM address of SCREEN 0 to 3). Clip : 0 = clipping active, 1 = don't clip. RGB : 0 = SCREEN 10, 1 = SCREEN 11 (RGB flag of MSX2+). D2SJ : Dai 2 Suijyun Kanji ROM, 0 = not available, 1 = available. Kata : 0 = "hiragana" ("romaji" conversion), 1 = "katakana".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:
XSAVE F E D C B A 9 8 7 6 5 4 3 2 1 0 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |I|O|O|O|O|O|O|O|X|X|X|X|X|X|X|X| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ YSAVE F E D C B A 9 8 7 6 5 4 3 2 1 0 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |x|O|O|O|O|O|O|O|Y|Y|Y|Y|Y|Y|Y|Y| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ I: 1 = light-pen interruption. O: offset. X: X coordinate. Y: Y coordinate. x: anything.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.
FB03 RSTMP : DEFS 50 ; RS-232C and MSX-Disk Temporary work area. FB03 TOCNT : DEFS 1 ; Used by RS-232C access routines. FB04 RSFCB : DEFS 1 ; RS-232C low address. DEFS 1 ; RS-232C high address. FB06 RSIQLN: DEFS 1 ; Used by RS-232C access routines. FB07 MEXBIH: RST 30H DEFS 1 ; Byte datum. DEFS 1 ; (Low). DEFS 1 ; (High). RET FB0C OLDSTT: RST 30H DEFS 1 ; Byte datum. DEFS 1 ; (Low). DEFS 1 ; (High). RET FB11 OLDINT: RST 30H DEFS 1 ; Byte datum. DEFS 1 ; (Low). DEFS 1 ; (High). RET FB16 DEVNUM: DEFS 1 ; Used by RS-232C access routines. FB17 DATCNT: DEFS 1 ; Data Counter (byte datum). DEFS 1 ; Byte pointer. DEFS 1 ; Byte pointer. FB1A ERRORS: DEFS 1 FB1B FLAGS : DEFS 1 FB1C ESTBLS: DEFS 1 FB1D COMMSK: DEFS 1 FB1E LSTCOM: DEFS 1 FB1F LSTMOD: DEFS 1
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.
FFCAH FCALL : DEFS 5 ; Used by BIOS extensions. FFCFH DISINT: DEFS 5 ; Used by DOS. FFD4H ENAINT: DEFS 5 ; Used by DOS. FFE7H RG8SAV: DEFS 1 ; VDP Register 8 Save copy. FFE8H RG9SAV: DEFS 1 ; VDP Register 9 Save copy. FFE9H RG10SA: DEFS 1 ; VDP Register 10 Save copy. FFEAH RG11SA: DEFS 1 ; VDP Register 11 Save copy. FFEBH RG12SA: DEFS 1 ; VDP Register 12 Save copy. FFECH RG13SA: DEFS 1 ; VDP Register 13 Save copy. FFEDH RG14SA: DEFS 1 ; VDP Register 14 Save copy. FFEEH RG15SA: DEFS 1 ; VDP Register 15 Save copy. FFEFH RG16SA: DEFS 1 ; VDP Register 16 Save copy. FFF0H RG17SA: DEFS 1 ; VDP Register 17 Save copy. FFF1H RG18SA: DEFS 1 ; VDP Register 18 Save copy. FFF2H RG19SA: DEFS 1 ; VDP Register 19 Save copy. FFF3H RG20SA: DEFS 1 ; VDP Register 20 Save copy. FFF4H RG21SA: DEFS 1 ; VDP Register 21 Save copy. FFF5H RG22SA: DEFS 1 ; VDP Register 22 Save copy. FFF6H RG23SA: DEFS 1 ; VDP Register 23 Save copy. FFF7H DEFS 3 ; Reserved for the system. FFFAH RG25SA: DEFS 1 ; VDP Register 25 Save copy. FFFBH RG26SA: DEFS 1 ; VDP Register 26 Save copy. FFFCH RG27SA: DEFS 1 ; VDP Register 27 Save copy. FFFDH DEFS 2 ; Reserved for the system.
Port Range Device and Optional Description 00H-3FH User Definition ***. 40H-4FH Expansion I/O Ports ****. 50H-6FH Reserved for the system *. 70H-73H MIDI Saurus (BIT2). 74H-7BH Reserved for the system *. 7CH-7DH MSX-Music. 7EH-7FH Reserved for the system *. 80H-87H RS-232C. 80H 8251 Data. 81H 8251 Status - Command. 82H Status Lead - Interrupt Mask. 83H Unused. 84H 8253. 85H 8253. 86H 8253. 87H 8253. 88H-8BH For the MSX2 VDP (V9938) Adapter I/O ports **. 8CH-8DH MSX Modem. 8EH-8FH Reserved for the system *. 90H-91H Printer ports. 90H Bit 0 on writing: /STROBE, 0=sending datum. Bit 1 on reading: 0=Ready, 1=Busy. 91H Data port. 92H-97H Reserved for the system *. 98H-9BH VDP (V9938) of MSX2. Also most MSX and all MSX2+ and turbo R. 98H VRAM access. 99H Command register access. 9AH Palette register access (write only). 9BH Register indirect assignment (write only). 9CH-9FH Reserved for the system *. A0H-A3H PSG (AY-3-8910) access ports. A0H Address latch. A1H Data Write. A2H Data Read. A4H-A7H Reserved for the system *. A8H-ABH Parallel port (PPI, 8255). A8H Port A. A9H Port B. AAH Port C. ABH Mode Set. ACH-AFH MSX Engine (One-Chip-MSX I/O Ports). B0H-B3H Memory Expansion (Sony method, using 8255). B0H Port A, address (A0-A7). B1H Port B, address (A8-A10, A13-A15), control, Read/Write. B2H Port C, address (A11-A12), datum (D0-D7). B3H Mode Set. B4H-B5H Clock-IC (RP-5C01). B4H Address latch. B5H Datum. B6H-B7H Reserved for the system *. B8H-BBH Light-pen control (Sanyo method). B8H Read/Write. B9H Read/Write. BAH Read/Write. BBH Write only. BCH-BFH VHD control (JVC, 8255). BCH Port A. BDH Port B. BEH Port C. BFH Mode Set. C0H-C1H MSX-Audio. C2H-C7H Reserved for the system *. C8H-CFH MSX Interface (Asynchronous Serial Communication Interface). D0H-D7H Floppy Disk Controller (FDC). According to the Datapack, the use of these ports to access disks will limit its access time. Translator notes: because the I/O ports have a fix transfer rate to keep compatibility, newer and faster data storage devices won't be able to work properly using this access. Standard FDC use memory registers, which can also be accessed faster than by I/O ports. The use of these ports also brings some access conflict problems. Only some brazilian interfaces are known to use them. D8H-D9H Kanji ROM (Toshiba method) Dai Itchi Suijyun (Level 1). D8H b5-b0 lower address (Write Only). D9H b5-b0 upper address (Write). b7-b0 datum (Read). DAH-DBH Kanji ROM Dai Ni Suijyun (Level 2). DCH-F2H Reserved for the system *. F3H VDP Display Mode (MSX2+). b0 M3 b1 M4 b2 M5 b3 M2 b4 M1 b5 TP b6 YUV b7 YAE F4H MSB Hardware Reset (MSX2+). F5H System Control (Write Only). Bit=1 means device available. b0 Kanji ROM Dai Itchi Suijyun. b1 Kanji ROM Dai Ni Suijyun. b2 MSX-Audio. b3 Superimposer. b4 MSX Interface. b5 RS-232C. b6 Light-pen. b7 Clock-IC (only in MSX2, MSX2+). F6H Colour Bus I/O. F7H A/V Control. b0 Audio R Mixing On (Write) b1 Audio L Mixing Off (Write) b2 Video Input Selection 21 Pin RGB (Write) b3 Video Input Detection No Input (Read) b4 AV Control TV (Write) b5 Ym Control TV (Write) b6 VDP Register 9, Bit 4 Shift (Write) b7 VDP Register 9, Bit 5 Shift (Write) F8H-FBH Reserved for the system *. FCH-FFH Memory Mapper (Write Only). Translator note: FCH Page 3 Segment Select Register. FDH Page 2 Segment Select Register. FEH Page 1 Segment Select Register. FFH Page 0 Segment Select Register.
Notes:
** The new VDP is connected to different ports of MSX, avoiding conflict with the current built-in VDP. one may have it connected to alternative ones.
* Reserved for the system: this basically means that a hardware maker should consult the standard definer (Japan ASCII Co.) for permission to use some port. Of course, most hardware makers today simply ignores the simple existance of any standard definer and goes on filling up the not many left unused ports with not very much reliable devices. Anyway, it is a good idea to check twice the possibilities of memory access registers instead of I/O ports.
** VDP (V9938) Adapter I/O Ports: when MSX2 had just been released, the number of MSX already in use was large, so a special cartridge had been released with the MSX2 VDP IC inside, the V9938. That cartridge could be simply inserted in an MSX slot and it would become an MSX2. Those expansion cartridges contain a V9938 and the MSX2 BIOS. The video access ports, of course, couldn't be shared by both internal MSX's and external MSX2's VDP, so new ports were defined to the second. Thus, a program shouldn't assume VDP as being at fixed ports. The addresses 0006H and 0007H of the Main BIOS contain the read and write port numbers of the VDP, as already explained in the VDP chapter, and they should be used.
*** User Definition: these ports are for home-made devices, for personal use only, that is, hardware that won't be commercialized or distributed in any way. This is to avoid the proliferation of hardware with unauthorized usage of ports, but still allowing simple home-made hardware to be easily done.
**** Expansion I/O Ports: if you must or want anyway to use I/O ports in your project, Japan ASCII has defined the Expansion I/O Ports, from 40H to 4FH. A special selector must be connected to these ports in the new device. The selector only allows access to the device if the correct signature is sent to it.
The schematic circuitry diagram is presented here, not specifying componets, just logical elements and functions:
CPU Device --------+ +-------- | | A0~A15 |=====+==============================================>| A0~A15 | | | | | | | | +--------+ | | | | Data | | D0~D7 |<====|===========+==============>| Bus |<========>| D0~D7 | | | | Buffer | ^ | | V | +--------+ | +-------- | +------+ V ^ ^ | | |xx40H?| +---+ | | | | +------+ |ID?| Enable F/F | | | | | +---+ | |e +--------+ | | +---+ | +---+ | |n | | | | | | | | | | |a | Buffer |..... | +-->| | ++---->|D Q|-------+ |b | | . | | | | | | enable |l +--------+ . IORQ |O--+-|--O|AND|--------->|T | |e ^ . | | | | | write | R | | | . WR |O--|-|--O| | +---+ | | complement | | | | | O | | of ID | | | +---+ | +---------+ | | | | | | Access | | | | | +---+ | | Control | | | | | | | | +---------+ | | | +-->| | | | | | | | read | | | +----O|AND|----------------------------------+ | | | | RD |O-------O| | | | | | | | +---+ | | | RESET |O-------------------------+ | --------+
This circuitry has the following effects:
It keeps the device and the MSX Bus disconnected until it receives a valid ID code through port 40H, so a program that wants to use the device must enable it first, writing the proper ID byte to the I/O port 40H. The ID byte may range from 128 to 254 for a specific type of device or from 1 to 127 to define a specific hardware maker. The 0 and 255 values are reserved because most systems returns one of those two when an empty or disconnected port is accessed.
If an ID byte different from the expected is received, connection between bus and device is instantly broken. Any and all access are ignored until another matching ID value is received from port 40H.
If port 40H is read, the accessing program will receive the ID byte of the currently active device.
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):
1 = アスキー (Japan ASCII) 2 = キャノン (Canon) 3 = カシオ計算機 (Casio Keisanki = Casio Calculators) 4 = 富士通 (Fujitsu) 5 = 富士通ゼネラル (Fujitsu General) 6 = 日立製作所 (Hitatchi Seisakushyo = Hitachi Industrial Plant) 7 = 京セラ (Kyosera) 8 = 松下電器産業 (Matsushita Denkisangyou = Electric Industrial [this includes all Matsushita enterprises, Panasonic, National, Technics and Quasar]) 9 = 三菱電機 (Mitsubishi Denki = Electrical Machines) 10 = 日本電気 (Nihon Denki = Japan Electric) 11 = ヤマハ (Yamaha) 12 = 日本ビクター (Nihon Victor = Japan Victor Company [JVC]) 13 = フィリップス (Philips) 14 = パイオニア (Pioneer) 15 = 三洋電機 (Sanyo Denki = Electric Machines) 16 = シャープ (Sharp) 17 = ソニー (Sony) 18 = スペクトラビデオ (Spectravideo) 19 = 東芝 (Toshiba) 20 = ミツミ電機 (Mitsumi Denki = Electrical Machines) 21 = テレマティカ (Telematica) 22 = グラディエンテ (Gradiente) 23 = シャープドブラジル (Sharp do Brasil = Brazilian Sharp) 24 = Goldstar (now known as "LG") 25 = Daewoo 26 = Samsung 27 \ ... > Reserved 127 / 128 \ ... > Device numbers 255 /
The Disk Operating System has a BIOS, from 0000H till 003AH, and one entry point at F37DH:
0000H Warm Bootstrap routine. 0005H BDOS (same as F37DH, but available only from MSX-DOS). 000CH RDSLT (same as MSX-BIOS RDSLT). 0014H WRSLT (same as MSX-BIOS WRSLT). 001CH CALSLT (same as MSX-BIOS CALSLT). 0024H ENASLT (same as MSX-BIOS ENASLT). 0030H CALLF (same as MSX-BIOS CALLF). 0038H INTRPT (same as MSX-BIOS INTRPT). F37DH BDOS (same as 0005H, but available from both MSX-DOS and MSX-Disk BASIC).
The MSX-DOS memory is mapped as follows:
0000H-003BH Disk-BIOS 005CH-00FFH System Scratch Area 0080H Parameter string length 0081H-00FFH Command line parameter string 0100H Transient Program Area (TPA) COMMAND.COM MSXDOS.SYS MSX-DOS Work Area F37DH BDOS alternative entry FFFFH MSX Work Area
The Disk-DOS and System Scratch Area are mapped as follows:
0000H |
| |||||||||||||||||
0010H |
| |||||||||||||||||
0020H |
| |||||||||||||||||
0030H |
| |||||||||||||||||
0040H | ||||||||||||||||||
0050H | ||||||||||||||||||
0060H | ||||||||||||||||||
0070H | ||||||||||||||||||
0080H |
| |||||||||||||||||
00F0H | ||||||||||||||||||
0100H |
| |||||||||||||||||
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:
00H System Reset 01H Get Character from Console 02H send one character to console 03H get one character from auxiliary device 04H send one character to auxiliary device 05H send one character to printer 06H get one character from console (no input wait, no echo back, no control code check)/ one character output 07H get one character from console (input wait, no echo back, no control code check) 08H get one character from console (input wait, no echo back, control code check) 09H send string 0AH get string 0BH check input from console 0CH get version number 0DH disk reset 0EH select default drive 0FH Open File 10H Close File 11H Find First 12H Find Next 13H delete file 14H read sequential file 15H write sequential file 16H create file 17H rename file 18H get login vector 19H get default drive name 1AH set DMA address 1BH get disk information 1CH-20H no function 21H write random file 22H read random file 23H get file size 24H set random record field 25H no function 26H write random block 27H read random block 28H write random file (00H is set to unused portion) 29H no function 2AH get date 2BH set date 2CH get time 2DH set time 2EH set verify flag 2FH read logical sector 30H write logical sector
* 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.
- 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 -