TRS-80 - Level 1 ROM Disassembled
System Variable Storage Chart - All offset from 4000H
Floating Point Number Storage
Disassembly
0008H - RST 08H Routine - This routine requires TWO parameters ... a value as the next bit and a byte offset. DE is advanced to the next non-space and tests it against the value. If there is no match, jumps to the return value PLUS the offset. If there is match, jumps to the byte after the offset.
- If Register A equals the value held in Register (HL), the Z FLAG is set.
- If A < (HL), the CARRY FLAG will be set.
- if A >= (HL), the NO CARRY FLAG will be set.
000EH - Display a CARRIAGE RETURN.
0010H - RST 10H Routine - This routine will send a character to the screen or to the cassette.
0018H - RST 18H Routine - This routine will parse an expression.
0020H - RST 20H Routine - This routine will compare HL and DE. NZ means no match, Z means match.
0020H - RST 20H Routine - This routine will compare HL and DE. NZ means no match, Z means match.
- If Register A equals the value held in Register D, the Z FLAG is set.
- If A < D, the CARRY FLAG will be set.
- If A >= D, the NO CARRY FLAG will be set.
- If Register A equals the value held in Register E, the Z FLAG is set.
- If A < E, the CARRY FLAG will be set.
- If A >= E, the NO CARRY FLAG will be set.
0028H - RST 28H Routine
This routine will skip forward from DE until the first non-space character, with Register A holding that character.
0030H - RST 30H Routine
This routine will continue execution.
0038H - RST 38H Routine.
This routine will check a variable to make sure it exists. If it doesn't, CARRY will be set. If it does, HL will point to the variable and NC will be set. Note that only variables A-Z and A(n) are valid in Level 1.
- If Register A equals 26, the Z FLAG is set.
- If A < 26, the CARRY FLAG will be set.
- If A >= 26, the NO CARRY FLAG will be set.
0066H - Non-Maskable Interrupt Routine.
This would be triggered on hitting the RESET BUTTON.
0076H - Continuation point for the RST 38H routine.
At this point, HL has the current pointer to the line being examined is at the top of the stack, DE has the pointer to the variable, Z/NZ is set based on whether the location of the array variable is in or out of bounds, and if Register A is greater than Register E, the CARRY FLAG is set.
0081H - Continuation point for the RST 38H routine"
Jumped to if the variable is "A" and no "(" was found after it. This routine will set HL to point to the RAM address which holds the variables "A" - "Z"
0082H - Continuation point for the RST 38H routine".
Register A will contain 0-25, representing variables "A"-"Z".
0085H
RLA
0089H - Jump to the routine to Display the "WHAT" error.
008CH - Subroutine to check to see if the character pointed to by Register Pair DE is, or is not, a digit (i.e., 0-9).
If a digit is found, will return with Register A containing the digit and NC set, or the CARRY FLAG set otherwise.
- If Register A equals 0, the Z FLAG is set.
- If A < 0, the CARRY FLAG will be set.
- If A >= 0, the NO CARRY FLAG will be set.
- 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.
010AH - Continuation of the FLOATING POINT CONSTANT routine at 00A6H.
Jumped here if we have a non-digit that isn't a ".", "E", or +, or -.
011CH - Continuation of the FLOATING POINT CONSTANT routine at 00A6H.
Jumped here if we have a non-digit that isn't a "." or an "E".
0120H - Continuation of the FLOATING POINT CONSTANT routine at 00A6H.
Jumped here if we have started processing an exponent and then hit a non-digit.
0146H - Continuation of the FLOATING POINT CONSTANT routine at 00A6H; jumped here if to process a POSITIVE exponent.
014EH - Continuation of the FLOATING POINT ROUTINE at 00A6H; exit the floating point routine.
0151H - Exit routine with HOW error.
0155H - Routine to clear parse flags and prepare for next parsing.
0155H - Continuation of the FLOATING POINT CONSTANT routine at 00A6H.
Clear out H', L', C', and Bit 6 of Register B' in anticipation of starting to parse.
015EH - Continuation of the FLOATING POINT CONSTANT routine at 00A6H.
This basically multiplies the 24 bit digit represented by C'H'L' by 10 and then adds in A' with overflow going to B' thus leaving a 32 bit result of B'C'H'L'.. Specifically it accumulates the digit by multiplying the accumulator by 10 and then adding in A to the newly vacant one's spot. Routine will return a NZ SET if an overflow occurs from the accumulation. On entry, the REGULAR REGISTER SET is active.
0161H
LD E,L
So at this point HL, C, and B have all been multiplied by 2.
So at this point HL, C, and B have all been multiplied by 4 total.
So at this point HL, C, and B have all been multiplied by 5 total.
So at this point HL, C, and B have all been multiplied by 10 total.
The rest of the routine adds Register A to Register Pairs HL and BC.
018EH - Determine How Much RAM is in the System by fetching, complementing, storing, and testing each byte from FFFFH downwards. HL = 00FFH on entry.
018EH - Determine How Much RAM is in the System by fetching, complementing, storing, and testing each byte from FFFFH downwards. HL = 00FFH on entry.
01A2H - Display the "HOW?" error.
01A9H - MESSAGE STORAGE AREA.
01C9H - BASIC's READY Entry Point. If JUMPed here, the BASIC RUN STATE is cleared.
01CFH - BASIC's READY Alternate Entry Point. If JUMPed here, the BASIC RUN STATE is not affected.
01D8H - Process a line of code in a READY loop
NOTE: 40ACH is the storage location for buffer for command input AND the print output to cassette.
OR L
The line number has been found, so we will overwrite/delete the old line.
LD L,C
If we are here we will add a new line to the program UNLESS it was just a line number, in which case we delete the line.
If we are here then we did not hit the EOL delimiter. The next bunch of calls and math is first designed to make sure there is enough RAM to store the whole line, so HL is set up to be the highest RAM location needed to store the line.