5203H – Message Storage Area – Error Messages – “ERRTAB”
↳ ERRTAB
This is the beginning of the DISK ERROR MESSAGES. When error numbers are tested, NTDER2 will process these.
54C3H – CVI Command Jump Vector.
54C6H – Process the FN Command.
54C9H – CVS Command Jump Vector.
54CCH – DEF Command Jump Vector.
54CFH – CVD Command Jump Vector.
54D2H – EOF Command Jump Vector.
54D5H – LOC Command Jump Vector.
54D8H – LOF Command Jump Vector.
54DBH – MKI$ Command Jump Vector.
54DEH – MKS$ Command Jump Vector.
54E1H – MKD$ Command Jump Vector.
54E4H – CMD Command Jump Vector.
54E7H – TIME$ Command Jump Vector.
54EAH – OPEN Command Jump Vector.
54EDH – FIELD Command Jump Vector.
54F0H – GET Command Jump Vector.
54F3H – PUT Command Jump Vector.
54F6H – CLOSE Command Jump Vector.
54F9H – LOAD Command Jump Vector.
54FCH – MERGE Command Jump Vector.
54FFH – NAME Command Jump Vector.
5502H – KILL Command Jump Vector.
5505H – & Command Jump Vector.
5508H – LSET Command Jump Vector.
550BH – RSET Command Jump Vector.
550EH – INSTR Command Jump Vector.
5511H – SAVE Command Jump Vector.
5514H – LINE Command Jump Vector.
5517H – Process BASIC errors routine.
551AH – JUMP to a routine to determine what (n) was in a USR(n) call, and fetch the appropriate jump points and address of the variable in RAM
551DH – Vector to the routine to zero PTRFIL and close the open disk file
5520H – Vector to the routine which sees if an input request is to be from a disk file
5523H – Vector to the routine which dispatches a direct statement
5526H – Vector to the routine which prepares for insertion of a line
5529H – Routine when about to insert a line but after RUNC has executed
552CH – Vector to the routine to close ALL files
552FH – Zeroes out PTRFIL and RETurn
5532H – Vector to the routine which outputs a character to a disk file
5535H – Vector to the routine which processes LINE INPUT from disk
5538H – – “LRUN”
553BH – Vector to see if a command was CASSETTE I/O or DISK I/O
553EH – Vector to see if the command is to DISK or PRINTER for purposes of CRLF
5541H – Vector to an unknown routine
5544H – Vector to the routine which processes DISK I/O
5547H – Vector to the routine which checks to see if INPUT means “INPUT#n” command
554AH – Vector to the routine which proceses a MID$()=”xxxx” command
554DH – Vector to the routine which sets to read a sequential item
5550H – Vector to Check if a Disk Basic command is looking for DISK I/O
5553H – Vector to the routine which processes a Normal System Code to Return
5556H – Handler for user defined functions (DEF FN) – “PUSVAL”
Jumped to from 55BFH. On entry HL will point to the memory address for the variable in question
The next few instructions set up the condition codes without affecting carry. 0=String and the PARITY FLAG will be set.
If the S FLAG was not set, we are going to move to the next variable space.
If the PO FLAG was not set, we are going to move to the next variable space.
If we’re here, then the variable is double precision, so we need to adjust HL to point to the DFACLO for that content
At this point, (HL) is pointing to the variable, so we are going to push the 4 lowest order bytes of that variable to the stack.
Otherwise pass through to the following which will get a pointer to an existing function name.
558EH – Part of the FN Command – “FNDOER”
On Entry DE should be pointing to the address of the variable provided and HL to the next character in the BASIC instruction being processed
↳ FNDOER
55AEH – Continue processing the FN Command – “MORPUS”
↳ MORPUS
55C2H – Continue processing the FN Command, for a STRING – “PUSSTR”
↳ PUSSTR
55F0H – Continue processing the FN Command – “FINASG”
JUMPED here from 55E7H if a ) was found to be the next character in the command line being processed
↳ FINASG
At this point the DEF FN has been vetted and the syntax confirmed. We now need the original values of the parameters to be POPped off and restored
NOTE: The RST 20H routine determines the type of the current value in ACCumulator and returns a combination of STATUS flags and unique numeric values in the A Register according to the data mode flag (40AFH).
The results are returned as follows:
- Integer = NZ/C/M/E and A is -1
- String = Z/C/P/E and A is 0
- Single Precision = NZ/C/P/O and A is 1
- and Double Precision is NZ/NC/P/E and A is 5.
The function was not a string, so we continue here
5625H – Continue processing the FN Command; more string stuff – “DONRVL”
↳ DONRVL
NOTE: The RST 20H routine determines the type of the current value in ACCumulator and returns a combination of STATUS flags and unique numeric values in the A Register according to the data mode flag (40AFH).
The results are returned as follows:
- Integer = NZ/C/M/E and A is -1
- String = Z/C/P/E and A is 0
- Single Precision = NZ/C/P/O and A is 1
- and Double Precision is NZ/NC/P/E and A is 5.
NOTE: 40D3H is the storage location for the length of the current string
5632H – Continue processing the FN Command; more string stuff – “STRREL”
Store the last temporary value into DSCTMP and check to see if the next available location in the string area is the same address as is stored in the ACCUMULATOR. If yes, JUMP to 5641H, otherwise 5603H
↳ STRREL
5641H – Continue processing the FN Command; more string stuff – “STRRL2”
If the the next available location in the string area is the same address as the temporary variable we are using we wind up here
↳ STRRL2
5655H – Process the DEF Command – “DEF”
↳ DEF
If we are here, then there are arguments to process.
5679H – Part of the USR(n) routine – “USROUT” and “USRFN”
JUMPed to routine to determine what (n) was in a USR(n) call, and fetch the appropriate jump points and address of the variable in RAM
↳ USROUT
5699H – SUBROUTINE of the DEF USR routine – “SCNUSR”
– This subroutine will determine what n is in a DEF USR n call, and set DE to the appropriate location in the USR jump table which is based at 5B77H
↳ SCNUSR
56ABH – Process a DEF USR – “DEFUSR”
↳ DEFUSR
56BAH – Process an “UNDEFINED FUNCTION” error – “UFERR”
↳ UFERR
NOTE: 19A2H is the Model I ROM Routine to display the error message applicable to the error code held in Register E
56BFH – Check to see if the command was CASSETTE I/O or DISK I/O – “FILGTO”
↳ FILGTO
56CBH – Process the CMD Command – “CMD”
↳ CMD
5706H – Process a CMD”R” and CMD”T” command – “NTSETT”
CMD”R” enters at 5706H, CMD”T” at 5709H. CMD”R” enables interrupts (start real-time clock)
↳ NTSETT
5711H – Process a CMD”I” command. Return a command to TRSDOS – “CMDUUO”
↳ CMDUUO
5736H – Process a CMD”E” Command – “DERGO”
Get an error message from DOS
↳ DERGO
5740H – Process a CMD”D” Command – Enable and load the real-time debugging program – “DEBGO”
↳ DEBGO
5745H – Process the TIME$ Command – “TIME”
↳ TIME
NOTE: 40D4H is the storage location for the current string, and this is where the TIME$ will be built
5776H – SUBROUTINE in the TIME$ Command Processor – “TWODIG”
Processes the number held at (DE) into ASCII numbers at HL and HL+1, and DECrement DE by 1
↳ TWODIG
5786H – Process the LINE (i.e., LINE INPUT) Command – “LINE”
↳ LINE
NOTE: 2828H is the Model I ROM Routine to save a code string address
NOTE: 1DBEH is in the END routine in the Model I ROM and is commonly jumped to if a command was from the command prompt instead of in a program
57B0H – Vector from 552FH – “FINDRT”
This routines zeroes out PTRFIL and then RETurns. No registers or flags are affected. On entry A = 0
↳ FINDRT
57B8H – Vector from 5547H for an INPUT command – “FILSTI”
This routine tries to trap an INPUT#n command, but not a INPUT#-n command. On entry HL is pointing to the current letter of the command line being interpreted, which letter is in Register A.
↳ FILSTI
If we are here, then we have a INPUT#. We next test to see if this is an INPUT#n or an INPUT#-n command.
If we are here, are are re-setting HL and A to where they were when we entered this routine. HL will be POPped from the stack and will point to the character on the instruction line being interpreted right after the INPUT token, and Register A will hold that character.
If we are here, we have an INPUT#n command!
NOTE: 21EBH is the middle of the Model I ROM Routine for INPUT. It puts a COMMA into (HL) and then looks for a variable storage space in RAM
57D0H – Part of the LIST command – “EXCHDS”
We need to check to see if we are dealing with a disk file or not
↳ EXCHDS
57D5H
OR L
If we are here, then we are dealing with a disk file, so we need to actually start processing that. First we need to see which routine called this one.
NOTE: 2B4AH is the middle of the Model I ROM Routine for LIST, to list a specific line pointed to by HL
NOTE: 2282H is the Model I ROM Routine. It will POP HL, turn off the cassette recorder, and return to the BASIC interpreter
57E6H – Process BASIC Error Messages – “EXDSKR”
This routine is a link to executive control
↳ EXDSKR
If we are here, then the error code cannot be printed.
In BASIC, error codes are really “error / 2 + 1”. So that’s what we are about to do!
NOTE: 40A2H is the storage location for the Current Line Number in a BASIC Program in 2 Bytes (LSB/MSB) or FFFFH if in direct mode
5818H – Process a CMD”#”# Command – This will display a copyright message – “MICPRT”
↳ MICPRT
582CH – Message Storage Location – “MESMIC”
588BH – Process the INSTR Command – “INSTR”
According to original source,this is the INSTR function, which takes one of two forms: instr(X% , Y$, Z$) or instr(Y$,Z$). In the first form the string Y$ is searched for the character Z$ starting at character position x%. The second form is identical, except that the search starts at position 1 . INSTR turns the character position of the first occurance of Z$ in Y$. if Y$ is null, 0 is returned, if Z$ is null, then x% is returned , unless x% .gt. len(Y$) in which case 0 is returned.
↳ INSTR
NOTE: The RST 20H routine determines the type of the current value in ACCumulator and returns a combination of STATUS flags and unique numeric values in the A Register according to the data mode flag (40AFH).
The results are returned as follows:
- Integer = NZ/C/M/E and A is -1
- String = Z/C/P/E and A is 0
- Single Precision = NZ/C/P/O and A is 1
- and Double Precision is NZ/NC/P/E and A is 5.
NOTE: 2B1FH is the Model I ROM Routine to evaluate the expression at the location of the current BASIC program pointer in HL and return with the integer result in DE
NOTE: 1E4AH is the Model I ROM Routine to display a ?FC ERROR
NOTE: 0AF4H is the Model I ROM Routine to check the NUMBER TYPE FLAG via a RST 20H call. Returns if VALTYPE=3 (string) else if VALTYPE is not 3 then it generates a TM ERROR. BC, DE, and HL are saved
- If Register A equals the value held in Register HL, the Z FLAG is set.
- If A < HL/10232/, the CARRY FLAG will be set.
- if A >= HL/10232/, the NO CARRY FLAG will be set.
5901H – Part of the INSTR(X%,Y$,Z$) routine – Jumped if we did get a matc – “GOTSTR”
↳ GOTSTR
590AH – Part of the INSTR(X%,Y$,Z$) routine – Jumped if we did NOT get a match – “HOWEKK”
↳ OHWELL
5913H – Process the & Command – “OCTCNS”
↳ OCTCNS
“LOPHEX”
- If Register A equals :, the Z FLAG is set.
- If A < :, the CARRY FLAG will be set.
- if A >= :, the NO CARRY FLAG will be set.
5933H – Continuation of the & Command. Jumped here to check for A-F – “ALPTST”
↳ ALPTST
This is a jump point if Register A is 0-9, or a pass through if Register A is 10-15.
ADD HL,HL
ADD HL,HL
ADD HL,HL
NOTE: 07B2H is the Model I ROM Routine to output an OV ERROR message
5946H – Continuation of the & command – “LOPOC2”
Jumped to 5946H if there was a & but not a &H or &O. Jump to 5946H if there was a &O.
↳ LOPOC2
5964H – JUMPed to routine to copy HL to the Accumulator, set the number type to INTEGER, swap DE and HL, and RETurn to the caller of the original routine – “OCTFIN”
↳ OCTFIN
5969H – Process the MID$() command – “DLHSMD”
↳ DLHSMD
NOTE: 40A0H is the storage location for the String Storage Area: 2 Bytes point to the lowest address available for string storage. This is ALSO the top of free memory. Start of string storage area, set to 50 less than top of memory pointer (at 40BlH) at power-up to provide 50 bytes of string storage area. Changed by use of CLEAR n command (with argument)
NOTE: 2843H is the middle of the Model I ROM Routine for STR$(). On entry, HL should be pointing to the VARPTR of a string
NOTE: 09D3H is the Model I ROM Routine to move the number of bytes specified in the type flag (40AFH) from the address in DE to the address in HL. Uses A, DE and HL
NCPMID
NOTE: 2B1CH is the Model I ROM Routine to evaluate the n portion of the STRING$ function
NOTE: 29D7H is the Model I ROM Routine to check to see if there is enough memory for the string
↳ BIGLEN
If we are here we now have to set up for an assignment. (HL) points to the left hand side, (DE) points to the right hand side, C is the length of the right hand side, and B is the length of the left hand side.
↳ MIDLP
59DCH – Part of the MID$(x,y,z)=”nnnnnn” routine – “MIDRST”
↳ MIDRST
↳ MID2
59EAH – Routine to determine if the input is from a disk file – “INLINE”
↳ INLINE
59EEH
OR L
59F2H – Vectors out from ROM Handling Disk I/O – “ISFILE”
This routine is entered when calling the keyboard LINE INPUT routine but the input is from a disk file and not the keyboard.
↳ ISFILE
If we are here, then we need to deal with a “LINE FEED”, which is to be ignored.
↳ INOTLF
↳ FINLIN
5A21H – Output a character to a disk file – “EXOUTC”
↳ EXOUTC
5A25H
OR L
5A30H – Part of the LINE INPUT from Disk Routine – “EXINC”
↳ EXINC
5A42H
OR L
NOTE: 035BH is the Model I ROM Routine to simulate the INKEY$ function without losing the contents of Register Pair DE
NOTE: 26E7H is the Model I ROM. It just POPs HL and RETurns
NOTE: 1B5DH is the Model I ROM Routine to execute a RUN command
NOTE: 28A7H is the Model I ROM Routine to display a message pointed to by Register Pair HL
5A71H – This fixes a bug in the Cassette routines – “FIXCAS”
↳ FIXCAS
NOTE: 40A9H is the storage location of the INPUT command routine, and contains zero byte if (and only if) input is from cassette. A bug in the first release of the Model I Level II BASIC ROM required that this location be POKEd with a non-zero value prior to reading program DATA statements. This bug was corrected soon after Level II BASIC was released, so that this POKE is required only for older TRS-80 Model I machines.
NOTE: 40A9H is the storage location for the input flag – 0 = Cassette , else non-zero
NOTE: 035BH is the Model I ROM Routine to simulate the INKEY$ function without losing the contents of Register Pair DE
5A77H – Variable Storage Area – “USRTAB”
↳ DIRTMP
“MAXTRK”
“DSKERR”
“PTRFIL”
5B8FH – File Block Pointer Table – “FILPTR”
-5B90H
↳ FILPTR
-5B92H
-5B94H
-5B96H
-5B98H
-5B9AH
-5B9CH
-5B9EH
-5BA0H
-5BA2H
-5BA4H
-5BA6H
-5BA8H
-5BAAH
-5BACH
5BB3H – Normal System Code to Return – SYSOUT
↳ SYSOUT
5BB4H – Process CMD”S” and CMD”A” RETURN TO DOS commands – “SYSGO”
On entry, Register A will hold the “S” or the “A” parameter, and the CARRY FLAG will be set if it was an “A”. CMD”S” is the normal return to TRSDOS (jump to EXIT routine)
↳ SYSGO
5BC7H – Part of DISK I/O – “EXDPOS”
↳ EXDPOS
5BCAH
OR L
NOTE: 2130H is the Model I ROM Routine to check to see if there are at least 16 spaces left on the display line and fill that with blanks
NOTE: 2156H is the Model I ROM Routine for TAB. It sends a certain number of spaces to the display
5BDFH – Routine when about to insert a line – “EXFIND”
↳ EXFIND
NOTE: 5B8FH is the storage location for the vector associated with file I/O into file number 1 (i.e., GET 1,x)
5BEEH – Routine when about to insert a line but after RUNC has executed – “EXFIN2”
↳ EXFIN2
NOTE: 5B8FH is the storage location for the vector associated with file I/O into file number 1 (i.e., GET 1,x)
“EXDSCR”
5BFBH – Vector from 5541H.
5BFCH – See if LINE POSITION is important or not – “EXDSKL”
↳ EXDSKL
5BFFH
OR L
NOTE: 20E9H is the middle of the Model I ROM Routine for PRINT@. It sends a string to the output device, followed by a space, until it gets an end of statement code
5C06H – Start of the BASIC program (Jumped to at the ORG) – “INIT”
↳ INIT
NOTE: 40A4H is the storage location for the BASIC Program Beginning Pointer in 2 bytes (LSB/MSB)
NOTE: 408EH is the storage location for the answer to the FILES? question asked at the entry of BASIC
NOTE: 40A0H is the storage location for the string storage area: 2 Bytes point to the lowest address available for string storage. This is ALSO the top of free memory
In SYS0/SYS there is a JUMP to a vector at 4312H which is supposed to return with the Z FLAG set, but it has two different jump locations – one without BASIC being loaded and one with. That JUMP LOCATION is at 4313H. Since BASIC is loaded now, we need to reset that as part of the INIT.
The next 4 instructions handle the moving of the 39 byte single precision division routine from 18F7-191DH to 4080H-40A5H to enable resetting the cassette/printer BREAK code.
NOTE: 408EH is the storage location for where TRSDOS 2.3 stores the answer to the FILES? Question
NOTE: 4049H is the storage location for the top of memory LSB
NOTE: 40A0H is the storage location for the String Storage Area: 2 Bytes point to the lowest address available for string storage. This is ALSO the top of free memory. Start of string storage area, set to 50 less than top of memory pointer (at 40BlH) at power-up to provide 50 bytes of string storage area. Changed by use of CLEAR n command (with argument).
NOTE: 40A0H is the storage location for the string area lower boundary
Note: 4152H-41A3H holds Disk Basic links
5C6FH – Part of the INIT routine; handles a mismatch between the BASIC version and the DOS version – “REPMES”
5C78H – Part of the INIT routine; jumped here to continue initializing since the DOS and BASIC version match – “FILQ”
↳ FILQ
If we are here, then we re-entered BASIC and need to restart with all the old parameters.
5C98H – RAM Storage Locations for parameters to be preserved in case of RE-entry into BASIC
↳ PTCMD
5C9FH – Process the “FILES?” Question – “FILQS1”
↳ FILQS1
NOTE:
- The routine at 28A7 displays the message pointed to by HL on current system output device (usually video).
- The string to be displayed must be terminated by a byte of machine zeros or a carriage return code 0D.
- If terminated with a carriage return, control is returned to the caller after taking the DOS exit at 41D0H (JP 5B99H).
NOTE: 40A4H is the storage location for the BASIC Program Beginning Pointer in 2 bytes (LSB/MSB)
NOTE:
- The routine at 28A7 displays the message pointed to by HL on current system output device (usually video).
- The string to be displayed must be terminated by a byte of machine zeros or a carriage return code 0D.
- If terminated with a carriage return, control is returned to the caller after taking the DOS exit at 41D0H (JP 5B99H).
NOTE: 4049H is the storage location for the top of memory LSB
5D1AH – Continue processing the response to MEMORY SIZE? – “TYPMEM”
↳ TYPMEM
NOTE: 4049H is the storage location for the top of memory LSB.
NOTE: 4049H is the storage location for the DOS MEMORY SIZE. Highest available memory location (On a Model III it is stored at 4411H)
NOTE: 4049H is the storage location for the Contains Memory Size as shown in the HIMEM value
NOTE: 40A4H is the storage location for the BASIC Program Beginning Pointer in 2 bytes (LSB/MSB)
Note: 40A0H-40A1H holds the start of string space pointer
NOTE:
- The routine at 28A7 displays the message pointed to by HL on current system output device (usually video).
- The string to be displayed must be terminated by a byte of machine zeros or a carriage return code 0D.
- If terminated with a carriage return, control is returned to the caller after taking the DOS exit at 41D0H (JP 5B99H).
5D4DH – Replacement Routine for the SYS0/SYS Vector for RETURN on Z or JP to nnnn
↳ NXTFCN
NOTE: nnnn is set at 5C1FH with the value which was stored in 4313H on entry into DISK BASIC
5D53H – STORAGE LOCATIONS
5EC3H – Called from 57C5H once we know we have a INPUT#n command to process to validate the n, set up the file buffers, make sure that we then get a comma after the n, and store a modified BC into 5ED5H. On entry HL should point to the character on the instruction line being interpreted right after the INPUT token, Register A will hold that character, and BC will point to the ROM location in the middle of the INPUT routine – “FILINP”
↳ FILINP
If we are here, then we have a INPUT# so far.
5ED5H
LD L,C
5EDBH – This is a common subroutine used to process the #n part of a GET#n, PUT#n, FIELD#n, INPUT#n, etc. It will validate the n, and load/set the file vectors – “FILSCN”
↳ FILSCN
At this entry point, the ACCumulator has the file number already stored in it.
At this point it is assumed the file number is in A, the file number is returned is in E, D is set to 0, HL is saved, BC is set to point at the file data block for file E, A has the mode of the file and Z FLAG is set if the file is mode 0 (which is NOT OPEN)
At this point we have a token#n and n is in the A Register. Next we need to make sure that whatever that n is, it is less than the number of FILES reserved on entry into BASIC.
5EFFH – Process the MKI$, MKS$ and MKD$ Commands, based on the entry location – “MKI”
↳ MKI
NOTE: 2857H is the Model I ROM Routine for making room for a new string variable
NOTE: 40D4H is the storage location for the address of the current String
NOTE: 09FFH is the Model I ROM Routine to move a number of bytes (the number depending on the value stored in the VALTYPE) from the ACC into the ARG. ((ARG)=(ACCumulator))
NOTE: 2A2BH is the Model I ROM Routine to cleans the stack and then jumps to 2884H in the string routine
5F18H – Process the CVI, CVS, and CVD commands, based on the entry location – “CVI”
CVI(n$) routine converts a two character string to integer. If less than two characters are present in the passed string, an ILLEGAL FUNCTION CALL will result. If more than two characters as present in n$, only the first two characters are used.
↳ CVI
CVS(n$) entry point. CVS routine converts a four character string to a single precision number. If less than four characters are present in the passed string, an ILLEGAL FUNCTION CALL will result. If more than four characters as present in n$, only the first four characters are used.
CVD(n$) entry point. CVD routine converts an eight character string to a single precision number. If less than eight characters are present in the passed string, an ILLEGAL FUNCTION CALL will result. If more than eight characters as present in n$, only the first eight characters are used.
At this point A will be 01H if the CVI function was called, 03H if the CVS function was called, and 07H if the CVD function was called. These are one less than the ROM code for the associated variable type (i.e., 2 = Integer, 4 = Single, etc)
NOTE: 1E4AH is the Model I ROM Routine to display a ?FC ERROR
5F35H – Set up to read a sequential item – “FILIND”
↳ FILIND
5F39H
OR L
NOTE: The RST 20H routine determines the type of the current value in ACCumulator and returns a combination of STATUS flags and unique numeric values in the A Register according to the data mode flag (40AFH).
The results are returned as follows:
- Integer = NZ/C/M/E and A is -1
- String = Z/C/P/E and A is 0
- Single Precision = NZ/C/P/O and A is 1
- and Double Precision is NZ/NC/P/E and A is 5.
5F4CH – LINE INPUT Routine to READ CODE FOR ITEM FETCHING FROM SEQUENTIAL INPUT FILES – “DLINE”
NOTE: 260DH is the Model I ROM Routine to searche the Variable List Table for a variable name which matches the name in the string pointed to in HL, and return the address of that variable in DE (and if there is no variable, it creates it, zeroes it, and returns THAT location)
NOTE: 0AF4H is the Model I ROM Routine to check a number via a RST 20H call. Returns if VALTYPE=3 (string) else if VALTYPE is not 3 then it generates a TM ERROR. BC, DE, and HL are saved
6001H – LINE INPUT Routine to Move Forward a Certain Number of Characters – “BAKUPT”
↳ BAKUPT
600EH – LINE INPUT Routine to Back up a Character – “BAKCHR”
↳ BAKCHR
Next, turn on bit 5 of the prior character and write it back out.
Next, move 9 bytes forward, get the vector into BC, reduce the vector by 1, and write it back out.
6027H – LINE INPUT Routine. Jumped here if we back up one character and it isn’t a 00H
603CH – LINE INPUT Routine Subroutine. – “NOSKCR”
↳ NOSKCR
6050H – LINE INPUT Routine Subroutine. – “NUMIMK”
↳ NUMIMK
6056H – This routine will store a character into (HL) – – “STRCHR”
This routine will set the FLAGS, store a non-Zero character into the buffer at (HL) bumping HL after and DECrementing Register B, RETurning if B isn’t ZERO and POPping BC if it is, before JUMPING to 603DH.
6060H – Prepare for Sequential Input by finding a file and setting up for the INDSKC Routine – “PRGFLI”
↳ PRGFLI
6066H – Run the Program – “LRUN”
↳ LRUN
NOTE: 408EH is the storage location for the TRSDOS 2.3 stores the answer to the FILES? Question
NOTE: 1997H is the Model I ROM Routine to display a SYNTAX ERROR error message
NOTE: 408EH is the storage location where TRSDOS 2.3 stores the answer to the FILES? Question
We need to process a straight LOAD, without any RUN.
At this point we need to do a binary load. After the load, the file is linged toegther. LSTFRE is used as a flag as to whether to run or not once completed.
NOTE: 1AF8H is the Model I ROM Routine to fix the line pointers in a BASIC program, most commonly used in renumbering. Registers A, HL and DE are used
NOTE: 40F9H is the storage location for the simple variables & End Basic Program
60EFH – Zero PTRFIL and close the open disk file – “PRGFIN”
↳ PRGFIN
6103H – Routine to clear any program in RAM and error out with an OUT OF MEMORY error – “OUTLOD”
↳ OUTLOD
NOTE: 197AH is the Model I ROM Routine to display an OUT OF MEMORY error message
6109H – Process the MERGE Command – “MERGE”
↳ MERGE
6118H – Part of the MERGE Command – Jumped Here After SYNTAX Check – “OKGETM”
↳ OKGETM
6133H – This is the dispatch for a direct statement
– “DIRDO”
↳ DIRDO
6139H
OR L
6148H – Process the SAVE Command – ASCII or Binary – “SAVE”
↳ SAVE
6159H – SAVE Command Routine – Handle a BINARY (i.e., not ASCII) Save – “BINSAV”
↳ BINSAV
NOTE: 40F9H is the storage location for the address of simple variables & End Basic Program
NOTE: 40A4H is the storage location for the BASIC Program Beginning Pointer in 2 bytes (LSB/MSB)
6173H – Process the CLOSE Command – “CLOSE”
↳ CLOSE
6185H – Routine to clean up the stack and prepare for processing more file numbers – “RETALL”
↳ RETALL
618DH – Routine to clean up the stack and prepare for processing more arguments – “RETRTS”
↳ RETRTS
61A5H – Close ALL Files – “CLSALL”
↳ CLSALL
61AFH – Process the FIELD Command – “FIELD”
↳ FIELD
620AH – Process the LSET and RSET Commands – “LSET” and “RSET”
The format of the LSET and RST command is LSET STRINGVARiable = STRINGEXPression.
If STRINGVAR points to an I/O buffer, use the string size to justify the string. If, instead, STRINGVAR is a literal, we will need to make a new variable with the length that matches the literal. If, instead, STRINGVAR points to string space, use it.
If the length of the variable is zero, return the null string
If a copy must be created, and STRINGEXP is a temporary string storage location, then use this space over unless length STRINGVAR greater than STRINGEXP.
↳ RSET
F6H 37H
37H
We are not going to need to see if STRINGExpression is a variable or a literal.
If we are here, then we are dealing with a literal string being put into the STRINGVariable, so we need to make new string. If STRINGEXP was a temporary, it has been freed. If the length of STRINGEXP is greater than or equal to the length if STRINGVAR, then GETSPA can be called and no garbage collection can occur so TEMP can be reused. If STRINGVAR is greater, must get a TEMP to point to STRINGEXP. If it was a TEMP, then call GETSPA which in this case can garbage collect.
628CH – Part of the LSET/RSET Routine – This is when we are done with everything except LSET – “RETCUR”
↳ RETCUR
6296H – Part of the LSET/RSET Routine – This routine will fill in the leading or trailing characters, as needed – “BLKFIL”
↳ BLKFIL
62A0H – – Part of the LSET/RSET Routine – “MAKDSC”
If STRINGEXP was a temporary, create a new temporary to point to STRINGEXP since old one was freed. This must be done since GETSPA will be called and garbage collection might occur. If STRINGEXP is not a temporary, return.
↳ MAKDSC
62B8H – Process the EOF Command – “EOF”
↳ EOF
62DDH – Close a file – “CLSFIL”
This routine is called by PRGFIN and as the EXIT VECTOR in CLOSE
The file number must be in Register A. If the file “sequential output” then the final sector of data will also be sent.
↳ CLSFIL
62ECH
LD D,B
62FEH – Process the LOC Command and LOF Command – “LOC”
↳ LOC
630FH – Process the LOF Command – “LOF”
↳ LOF
631BH – Put a Character into the OUTPUT BUFFER and Output (if needed) – “FILOUT”
Call at FILOUT with (HL) to be saved on the stack and the character in the high order byte below the (HL) on the stack.
The current data is output if there are DATPSC chars stuffed into the data area.
FILOUT is normally called from OUTDO (OUTCHR)
↳ FILOUT
634AH – Part of the OUTPUT A CHARACTER ROUTINE; check the result of the PUT routine to see if an error was returned – “ERRCHK”
↳ ERRCHK
6354H – Process the PUT and GET Command – “GET” and “PUT”
↳ PUT
If we are here, then we have now gotten a GET #n,y or PUT #n,y command.
6380H
LD C,E
6383H
INC DE
63A7H – Part of the GET/PUT routine – Jumped here when we have POSITIONED to the desired record – “SEEKOK”
↳ SEEKOK
63B6H – Part of the GET/PUT routine – Jumped here for a GET if we positioned correctly but there’s nothing there – “ZERBUF”
↳ ZERBUF
63C4H – Read a Character from Disk – “INDSKC”
This routine will get a character from the SEQUENTIAL FILE pointed to by PTRFIL. Only DE is unchanged.
↳ INDSKC
63CCH
INC DE
63E7H – Part of the Read a Character from Disk Routine; jumped to when we want to toss the character – “WC”
↳ WC
63EDH – Scan a Filename and NAME Command. Used by OPEN and KILL – “NAMFIL”
Fetch the filename of the file pointed to by BC into FILNAM and the disk number into LSTDSK
↳ NAMFIL
641FH
LD C,E
6426H
INC DE
6434H – Process the OPEN Command – “OPEN”
This routine will handle the OPEN statement as well as all directory handling.
↳ OPEN
Next we want to check the mode character. BC will point to it, A will fetch it, and then we will test for O, I, E, and R
If we are here, then we have a valid file mode and it is held in DE.
D5H
The next bunch of instructions do an offset
64B0H
INC DE
64CDH – OPEN a File for INPUT – “INOPN”
↳ INOPN
NOTE: 430FH is the storage location used by TRSDOS 2.3 to track certain system conditions.
- If Bit 4 is set, then SYS6/SYS is loaded in RAM (and can be called by RST 28H).
- If Bit 5 is set, then CHAINING is in effect.
- If Bit 7 is set, then DEBUG was set to active.
The next instructions convert the XMODE flag into a PROTFL flag.
64F2H – Part of the OPEN statement and ALL Directory handling. – “TSTPRT”
This routine will test and deal with protection.
↳ TSTPRT
If we are here, then we need to process “PROTECTION HAS CLEARED MEMORY”.
NOTE: 40A4H is the storage location for the BASIC Program Beginning Pointer in 2 bytes (LSB/MSB)
6508H
OR C
NOTE: 28A7H is the Model I ROM Routine to display a message pointed to by Register Pair HL (i.e., 0DH + “PROTECTION HAS CLEARED MEMORY”)
651CH – Part of the TSTPRT protection routine; this is an exit – “POPSRT”
↳ POPSRT
651EH – Memory Storage Locations
↳ FLRL
6521H – Process the KILL command – “KILL”
Actually, this is the KILL, LOAD, and MERGE code
↳ KILL
We are going to call the OPEN routine which requires B, DE, and HL to be set, so let’s set them up.
6544H – Process the NAME Command – “NAME”
↳ NAME
6547H – This is subroutine sets error codes based on the JUMP point – “DERBFM”
↳ DERBFM
011E68
NOTE: 19A2H is the Model I ROM Routine to display the error message applicable to the error code held in Register E
6561H – ERROR PROCESSING ROUTINE – “ERRTRP”
This routine will process an error held in Register A on entry, based on the lookup table at 6575H, and exits with a ROM call to process an error. Routine also loads the value in the selected table entry into 5B8CH.
↳ ERRTRP
6575H – Data Storage Table of 38 Bytes for the value to put into 5B8CH based on the error code offsetE – “DERTAB”
↳ DERTAB