4D00H - Quick Return Entry Point
This is a quick-return entry point that cleans up the stack and returns. It's used when GET/PUT operations complete successfully without needing to process further. The two INC SP instructions discard a return address from the stack.
4D00
INC SP 33
INCrement Stack Pointer by 1. This discards the low byte of a return address that was pushed onto the stack.
4D01
INC SP 33
INCrement Stack Pointer by 1 again. Together with the previous instruction, this discards a complete 16-bit return address from the stack.
4D02
RET C9
RETurn to the caller (skipping the discarded return address). Execution resumes at whatever address is now on top of the stack.
4D03H - Main GET/PUT Entry Point
This is the main entry point called from BASIC/CMD at 6125H (PUT) and 6126H (GET). When called, the Z flag indicates GET (Z set) or PUT (Z clear), and IX points to the FCB work area at 5700H. This routine enables position updates, retrieves the file status, sets the appropriate mode bit (bit 4 for PUT), and begins processing the record operation.
Entry: Z flag = GET operation, NZ flag = PUT operation. IX points to FCB work area at 5700H. The FCB has already been set up by BASIC/CMD routine 62BCH.
4D03
LD A,01H 3E 01
Load Register A with 01H. This is a flag value to enable position updates during the GET/PUT operation.
4D05
Store 01H into the position update enable flag at 624DH in BASIC/CMD. This self-modifying location controls whether file position is updated after operations.
4D08
POP AF F1
POP AF from the stack. This restores the flags that were set before SYS10 was called - the Z flag indicates GET (Z) or PUT (NZ).
4D09
Load DE with the 16-bit value at 5700H. This fetches the file status word from the FCB work area. E contains byte +00H (status flags), D contains byte +01H (additional flags).
4D0D
RES 4,E CB A3
RESet bit 4 of Register E (the status byte). Bit 4 is the PUT flag - clearing it assumes GET mode initially.
4D0F
If the Z FLAG is set (this is a GET operation), JUMP forward to 4D13H, leaving bit 4 clear.
4D11
SET 4,E CB E3
SET bit 4 of Register E. This marks the operation as PUT (write to file) rather than GET (read from file).
4D13
LD (IX+00H),E DD 73 00
Store E into FCB offset +00H (via IX). This updates the file status byte with the GET/PUT mode flag.
4D16
GOSUB to BASIC/CMD routine at 638FH to check for end of statement. Returns Z if at statement end, otherwise A contains the next character.
4D19
If the Z FLAG is set (at end of statement - no record number specified), JUMP forward to 4D1FH to use the current position.
4D1B
CP 2CH FE 2C
Compare Register A against 2CH (ASCII ,). A comma would precede an optional record number.
4D1D
If the NZ FLAG is set (not a comma - unexpected character), JUMP to 4D5AH to check for special modifiers (!, #, $, %, &).
No record number specified, or comma found - use current file position. Get position information from FCB.
4D1F
PUSH HL E5
Save HL onto the stack. HL points to the current position in the BASIC program text.
4D20
GOSUB to BASIC/CMD routine at 61D3H to get current position from FCB +12H and 5717H. Returns position in registers.
4D23
BIT 6,D CB 72
Test bit 6 of Register D. This is the alternate position valid flag from FCB byte +01H.
4D25
If the Z FLAG is set (bit 6 clear - no valid alternate position), JUMP forward to 4D36H to continue with standard processing.
4D27
GOSUB to BASIC/CMD routine at 6149H to get primary position from FCB +04H and 5705H.
4D2A
BIT 3,E CB 5B
Test bit 3 of Register E. This is the buffer flag in the file status byte.
4D2C
If the Z FLAG is set (bit 3 clear - buffer not active), JUMP forward to 4D36H.
4D2E
BIT 2,E CB 53
Test bit 2 of Register E. This is the random access mode flag.
4D30
If the Z FLAG is set (bit 2 clear - NOT random mode), JUMP to 4E48H for sequential file handling.
4D33
GOSUB to BASIC/CMD routine at 6065H for random access buffer handling.
4D36
GOSUB to BASIC/CMD routine at 6173H to validate and set position for the file operation.
4D39
GOSUB to BASIC/CMD routine at 613EH to update alternate position and set bit 6 of FCB +01H (valid flag).
4D3C
BIT 4,E CB 63
Test bit 4 of Register E. This is the PUT mode flag that was set earlier.
4D3E
If NZ (this is a PUT operation), GOSUB to BASIC/CMD routine at 6185H to prepare for write.
4D41
Load Register A with the byte at 5700H - the file status byte from the FCB work area.
4D44
AND 0FHAND 00001111 E6 0F
AND Register A with 0FH. This masks to the lower 4 bits, isolating the file type/mode field.
4D46
CP 09H FE 09
Compare Register A against 09H. File type 09H indicates a special fixed-length record mode.
4D48
If the Z FLAG is set (file type is 09H), JUMP to 4E9AH for special record mode handling.
4D4B
Store HL into 570BH in the FCB work area. This saves the current buffer position.
4D4E
LD (IX+0AH),C DD 71 0A
Store Register C into FCB offset +0AH. This updates the current record number low byte.
4D51
GOSUB to BASIC/CMD routine at 6137H to finalize position setup.
4D54
GOSUB to BASIC/CMD routine at 61CDH to calculate buffer position for the record.
4D57
JUMP to 4EBEH to continue with the actual GET/PUT data transfer operation.
4D5AH - Parse Optional Modifiers
This section handles optional modifier characters that can appear after GET/PUT. Valid modifiers include: CFH (TO token), #, $, %, &, and !. Each modifier changes how the record operation is performed.
4D5A
INC HL 23
INCrement HL to skip past the current character and point to the next token.
4D5B
PUSH HL E5
Save HL onto the stack (current position in BASIC text).
4D5C
CP CFH FE CF
Compare Register A against CFH. CFH is the BASIC token for TO. GET/PUT #n TO... syntax.
4D5E
If the NZ FLAG is set (not the TO token), JUMP forward to 4D75H to check other modifiers.
Found "TO" keyword - check conditions for TO operation.
4D60
BIT 3,E CB 5B
Test bit 3 of Register E (buffer flag in status byte).
4D62
If the Z FLAG is set (buffer not active), JUMP back to 4D20H to get current position.
4D64
BIT 6,D CB 72
Test bit 6 of Register D (alternate position valid flag).
4D66
If the Z FLAG is set (no valid alternate position), JUMP back to 4D20H.
4D68
Load Register A with the file status byte from FCB work area.
4D6B
AND 03H E6 03
AND Register A with 03H. This isolates the read/write mode bits (bits 0-1).
4D6D
If the Z FLAG is set (file not open for read or write), JUMP to 4E06H which triggers a "Bad File Mode" error.
4D70
GOSUB to BASIC/CMD routine at 6149H to get primary position.
4D73
JUMP forward to 4D8EH to continue processing with the position.
Check for # modifier (alternate position reference).
4D75
CP 23H FE 23
Compare Register A against 23H (ASCII #). The # symbol references an alternate position.
4D77
If the NZ FLAG is set (not #), JUMP forward to 4D81H to check for $ modifier.
4D79
GOSUB to BASIC/CMD routine at 6150H to get alternate position from FCB +07H and 5708H.
4D7C
GOSUB to BASIC/CMD routine at 6173H to validate and set position.
4D7F
JUMP back to 4D41H to continue with the GET/PUT operation.
Check for $ modifier (string/special mode).
4D81
CP 24H FE 24
Compare Register A against 24H (ASCII $). The $ symbol indicates string mode.
4D83
If the NZ FLAG is set (not $), JUMP forward to 4D93H to check for % modifier.
4D85
LD C,(IX+0AH) DD 4E 0A
Load Register C with FCB offset +0AH (current record number low byte).
4D88
Load HL with the saved buffer position from 570BH.
4D8B
GOSUB to BASIC/CMD routine at 6156H for string mode position handling.
4D8E
GOSUB to BASIC/CMD routine at 6173H to validate and set position.
4D91
JUMP back to 4D4BH to continue with buffer position storage.
Check for % modifier (end-of-file marker).
4D93
CP 25H FE 25
Compare Register A against 25H (ASCII %). The % symbol marks end-of-file handling.
4D95
If the NZ FLAG is set (not %), JUMP forward to 4DA1H to check for & modifier.
4D97
LD (IX+00H),00H DD 36 00 A2
Store 00H into FCB offset +00H. This clears the file status byte (note: opcode shows A2 but instruction is LD (IX+00H),00H).
4D9B
SET 5,(IX+2DH) DD CB 2D EE
SET bit 5 of FCB offset +2DH. This sets the EOF flag in the buffer flags byte.
4D9F
JUMP back to 4D57H to continue with the GET/PUT transfer.
Check for & modifier and ! modifier.
4DA1
POP HL E1
Restore HL from the stack (BASIC text pointer).
4DA2
CP 26H FE 26
Compare Register A against 26H (ASCII &). The & symbol indicates direct buffer access.
4DA4
If the NZ FLAG is set (not &), JUMP forward to 4DBCH to check for ! modifier.
4DA6
BIT 4,(IX+0EH) DD CB 0E 66
Test bit 4 of FCB offset +0EH. This checks a special mode flag.
4DAA
If NZ (flag set), GOSUB to BASIC/CMD routine at 625EH for buffer flush operation.
4DAD
LD A,(HL) 7E
Load Register A with the byte at HL (next character in BASIC text).
4DAE
CP 26H FE 26
Compare Register A against 26H (checking for double &&).
4DB0
If the NZ FLAG is set (not double &), JUMP to 51BEH for single & handling.
4DB3
LD DE,4451H 11 51 44
Load DE with 4451H. This is a callback address in the SYS0 area.
4DB6
GOSUB to BASIC/CMD routine at 6245H for double-ampersand buffer operation.
4DB9
JUMP to 51BFH to complete the operation and return.
4DBCH - Exclamation Point Modifier Handler
This section handles the ! modifier which provides direct variable access for GET/PUT operations. It parses variable type suffixes ($, #, %) and performs type-specific data transfers between the file buffer and BASIC variables.
4DBC
CP 21H FE 21
Compare Register A against 21H (ASCII !). The ! symbol enables direct variable transfer mode.
4DBE
If the NZ FLAG is set (not !), JUMP to 4E5FH to handle as a numeric record number.
4DC1
LD B,00H 06 00
Load Register B with 00H. B will serve as a type code counter (0=integer, 1=string, 2=double).
4DC3
LD A,(HL) 7E
Load Register A with the byte at HL (the character after !).
4DC4
CP 25H FE 25
Compare Register A against 25H (ASCII %). % suffix indicates integer variable.
4DC6
If the Z FLAG is set (% found), JUMP to 4E37H to handle integer variable transfer.
4DC8
CP 24H FE 24
Compare Register A against 24H (ASCII $). $ suffix indicates string variable.
4DCA
If the NZ FLAG is set (not $), JUMP forward to 4DD5H to check for #.
4DCC
INC B 04
INCrement Register B to 1, marking this as a string type.
4DCD
INC HL 23
INCrement HL to skip past the $ character.
4DCE
LD A,(HL) 7E
Load Register A with the next character.
4DCF
CP 25H FE 25
Compare against % (checking for $% combination).
4DD1
If the Z FLAG is set (found $%), JUMP to 4E37H for special handling.
4DD3
JUMP forward to 4DE0H to continue processing.
4DD5
CP 23H FE 23
Compare Register A against 23H (ASCII #). # suffix indicates double-precision.
4DD7
If the NZ FLAG is set (not #), JUMP forward to 4DE0H.
4DD9
BIT 6,E CB 73
Test bit 6 of Register E (alternate position valid flag).
4DDB
If the Z FLAG is set (no valid alternate), JUMP to 4E06H for error.
4DDD
INC HL 23
INCrement HL to skip past #.
4DDE
INC B 04
INCrement B to 2.
4DDF
INC B 04
INCrement B to 2, marking as double-precision type.
Parse the variable expression and prepare for data transfer.
4DE0
PUSH BC C5
Save BC onto the stack (B = type code).
4DE1
GOSUB to BASIC/CMD routine at 61B7H to parse numeric expression. Returns Z if result is zero.
4DE4
If the Z FLAG is set (result is zero), JUMP to 4E06H for error.
4DE6
LD BC,(4121H) ED 4B 21 41
Load BC with the value at 4121H. This is the BASIC numeric work area - contains result of expression evaluation.
4DEA
LD DE,(4123H) ED 5B 23 41
Load DE with the value at 4123H. This is the high word of the numeric result.
4DEE
LD A,D 7A
Load Register A with the high byte of DE.
4DEF
LD L,B 68
Load Register L with the value from B.
4DF0
LD H,00H 26 00
Load Register H with 00H. HL now contains a 16-bit value.
4DF2
If the M FLAG (Sign) is set (negative value), JUMP to 4E12H.
4DF5
OR A B7
OR Register A with itself to set flags based on high byte.
4DF6
If the NZ FLAG is set (high byte non-zero), JUMP forward to 4DFCH.
4DF8
LD C,A 4F
Load Register C with A (which is 0).
4DF9
LD L,A 6F
Load Register L with A (which is 0).
4DFA
JUMP forward to 4E27H to continue with zero value.
4DFC
LD H,E 63
Load Register H with E.
4DFD
LD B,E 43
Load Register B with E.
4DFE
SET 7,H CB FC
SET bit 7 of H. This sets the sign bit for floating point.
4E00
SUB 98H D6 98
SUBtract 98H from A. 98H is the floating point exponent bias for single precision.
4E02
If the Z FLAG is set (exponent exactly 98H), JUMP to 4E12H.
4E04
If the CARRY FLAG is set (exponent < 98H), JUMP to 4E09H for right shift loop.
4E06
JUMP to BASIC/CMD routine at 5E03H to trigger a "Bad File Mode" or similar error.
[LOOP] Shift right to normalize the floating point value.
4E09
SRL H CB 3C
Shift Right Logical: shift H right one bit, clearing bit 7 and moving bit 0 to Carry.
4E0B
RR L CB 1D
Rotate Right through carry: shift L right, Carry goes to bit 7, bit 0 goes to Carry.
4E0D
RR C CB 19
Rotate Right through carry: shift C right similarly.
4E0F
INC A 3C
INCrement A (the exponent counter).
4E10
If the NZ FLAG is set (not done shifting), LOOP BACK to 4E09H. [LOOP]
4E12
BIT 7,B CB 78
Test bit 7 of Register B (sign bit of mantissa).
4E14
If the NZ FLAG is set (negative after conversion), JUMP to 4E06H for error.
4E16
PUSH HL E5
Save HL onto the stack.
4E17
PUSH BC C5
Save BC onto the stack.
4E18
BIT 2,(IX+00H) DD CB 00 56
Test bit 2 of FCB +00H (random access mode flag).
4E1C
If the Z FLAG is set (not random mode), JUMP to 4E25H.
4E1E
GOSUB to BASIC/CMD routine at 5F10H for random mode validation.
4E21
LD A,H 7C
Load Register A with H.
4E22
OR L B5
OR A with L. Z flag set if HL is zero.
4E23
If the NZ FLAG is set (HL not zero - validation failed), JUMP to 4E06H for error.
4E25
POP BC C1
Restore BC from the stack.
4E26
POP HL E1
Restore HL from the stack.
4E27
POP DE D1
Restore DE from the stack.
4E28
POP AF F1
Restore AF from the stack (contains type code in A).
4E29
PUSH DE D5
Save DE again.
4E2A
LD B,A 47
Load Register B with A (type code).
4E2B
DECrement B and Jump if Not Zero to 4E40H. B=0 means integer type, continue here.
4E2D
GOSUB to BASIC/CMD routine at 61CDH to calculate buffer position.
4E30
RES 6,(IX+01H) DD CB 01 B6
RESet bit 6 of FCB +01H. This clears the alternate position valid flag.
4E34
JUMP to 51BDH to complete the operation.
4E48H - Sequential File Handler
This routine handles GET/PUT operations on sequential (non-random) files. It validates the file mode and synchronizes buffer positions before performing the data transfer.
4E48
BIT 4,E CB 63
Test bit 4 of Register E. This is the PUT mode flag.
4E4A
If the NZ FLAG is set (PUT operation on sequential file), JUMP to 4E97H for special handling.
4E4C
GOSUB to BASIC/CMD routine at 6173H to validate and set position.
4E4F
GOSUB to BASIC/CMD routine at 61CDH to calculate buffer position.
[LOOP] Read sequential records until buffer is synchronized.
4E52
GOSUB to BASIC/CMD routine at 61D3H to get current position.
4E55
GOSUB to BASIC/CMD routine at 627FH to compare positions and check if synchronized.
4E58
If the NZ FLAG is set (not synchronized yet), LOOP BACK to 4E52H. [LOOP]
4E5A
GOSUB to BASIC/CMD routine at 613EH to update alternate position.
4E5D
JUMP forward to 4EA9H to continue with the operation.
4E5FH - Numeric Record Number Parser
This routine parses a numeric record number from the BASIC statement. It evaluates the expression, validates the result is within valid record number range, and converts it to a file position for the GET/PUT operation.
4E5F
DEC HL 2B
DECrement HL to back up one position in BASIC text.
4E60
GOSUB to BASIC/CMD routine at 61B7H to parse numeric expression.
4E63
If the Z FLAG is set (result is zero), JUMP back to 4E06H for error.
4E65
GOSUB to ROM routine at 0A7FH to convert floating point to integer in DE.
4E68
EX DE,HL EB
EXchange DE and HL. The record number is now in HL.
4E69
LD A,D 7A
Load Register A with D (high byte of original HL, now record number high byte).
4E6A
OR A B7
OR A with itself to test if negative.
4E6B
If the M FLAG (Sign) is set (negative record number), JUMP to 5DD9H for "Bad Record Number" error.
4E6E
OR E B3
OR A with E. Z flag set if record number is zero.
4E6F
If the Z FLAG is set (record number is zero), JUMP to 5DD9H for "Bad Record Number" error.
4E72
DEC DE 1B
DECrement DE. Convert from 1-based record number to 0-based offset.
4E73
BIT 2,(IX+00H) DD CB 00 56
Test bit 2 of FCB +00H. This is the random access mode flag.
4E77
If the Z FLAG is set (NOT random mode), JUMP to 5DD0H for "Bad File Number" error.
Calculate file position from record number: position = (record-1) × record_length
4E7A
Load BC with the value at 5702H. This is the record length from the FCB work area.
4E7E
LD A,B 78
Load Register A with B (high byte of record length).
4E7F
LD HL,0000H 21 00 00
Load HL with 0000H. HL will accumulate the multiplication result.
4E82
LD B,11H 06 11
Load Register B with 11H (17 decimal). This is the loop counter for 16-bit multiplication.
[LOOP] 16-bit multiplication: HL = DE × (A:C) where A:C is record length.
4E84
SRL H CB 3C
Shift Right Logical H. Bit 0 goes to Carry, bit 7 becomes 0.
4E86
RR L CB 1D
Rotate Right L through Carry.
4E88
RRA 1F
Rotate Right A through Carry.
4E89
RR C CB 19
Rotate Right C through Carry.
4E8B
If the NO CARRY flag is set (bit was 0), skip the addition.
4E8D
ADD HL,DE 19
ADD DE (record number) to HL (partial product).
4E8E
DECrement B and Jump if Not Zero to 4E84H. [LOOP]
4E90
INC H 24
INCrement H (checking for overflow).
4E91
DEC H 25
DECrement H back. This sets flags based on H's value.
4E92
If the NZ FLAG is set (H was non-zero - overflow), JUMP to 5DD9H for "Bad Record Number" error.
4E95
LD H,L 65
Load H with L. Move middle byte to high byte.
4E96
LD L,A 6F
Load L with A. Move low byte to middle position. HL now has the 16-bit file position.
4E97
JUMP back to 4D36H to continue with the position setup.
4E9AH - Special Record Mode Handler (Type 09H)
This section handles files opened with special mode 09H. It performs buffer position calculation and validates the operation before proceeding with the data transfer.
4E9A
GOSUB to BASIC/CMD routine at 61CDH to calculate buffer position.
4E9D
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of FCB +00H. This is the PUT mode flag.
4EA1
If the NZ FLAG is set (PUT operation), JUMP forward to 4EAFH.
4EA3
GOSUB to BASIC/CMD routine at 6293H to read sector into buffer.
4EA6
If the NO CARRY flag is set (read error or EOF), JUMP to 5DC4H for "FIELD Overflow" error.
4EA9
GOSUB to BASIC/CMD routine at 61D3H to get current position.
4EAC
JUMP back to 4D4BH to continue with buffer storage.
PUT operation in special mode - check buffer dirty flag.
4EAF
BIT 4,(IX+2DH) DD CB 2D 66
Test bit 4 of FCB +2DH. This is the buffer dirty flag.
4EB3
If the Z FLAG is set (buffer not dirty), JUMP back to 4EA3H to read sector first.
4EB5
LD A,70H 3E 70
Load Register A with 70H. This is a buffer operation code.
4EB7
LD B,00H 06 00
Load Register B with 00H (no offset).
4EB9
GOSUB to BASIC/CMD routine at 6206H for buffer position update.
4EBC
JUMP back to 4EA9H to continue.
4EBEH - Main GET/PUT Data Transfer
This is the main data transfer section for GET/PUT operations. It determines the file mode (sequential vs random, read vs write) and performs the appropriate data transfer between the file buffer and BASIC's data areas.
4EBE
Load Register A with the file status byte from FCB work area.
4EC1
AND 03H E6 03
AND A with 03H. Isolate the read/write mode bits.
4EC3
If the NZ FLAG is set (file is open for read or write), JUMP to 4F18H for standard processing.
4EC5
GOSUB to BASIC/CMD routine at 6058H to check buffer status.
4EC8
If the CARRY FLAG is set (buffer needs attention), JUMP forward to 4EF0H.
4ECA
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of FCB +00H (PUT mode flag).
4ECE
If the NZ FLAG is set (PUT operation), JUMP forward to 4EE9H.
GET operation - read data from buffer.
4ED0
Load Register A with the low byte of record length from 5702H.
4ED3
ADD A,C 81
ADD C to A. C contains buffer offset.
4ED4
LD C,A 4F
Load C with the result.
4ED5
Load Register A with the high byte of record length from 5703H.
4ED8
ADC A,L 8D
Add L to A with Carry.
4ED9
LD L,A 6F
Load L with the result.
4EDA
If NO CARRY, skip the increment.
4EDC
INC H 24
INCrement H (carry propagation).
4EDD
GOSUB to BASIC/CMD routine at 61CDH to calculate buffer position.
4EE0
GOSUB to 4F0EH to check buffer boundaries.
4EE3
LD B,A 47
Load B with A (buffer status).
4EE4
GOSUB to BASIC/CMD routine at 6389H for buffer data transfer.
4EE7
JUMP forward to 4F0BH to complete.
PUT operation - check EOF flag first.
4EE9
BIT 7,(IX+01H) DD CB 01 7E
Test bit 7 of FCB +01H. This is the EOF flag.
4EED
If the Z FLAG is set (at EOF for PUT - cannot write), JUMP to 5DE8H for "Bad File Name" error.
4EF0
GOSUB to 4F0EH to check buffer boundaries.
4EF3
If the Z FLAG is set (at boundary), JUMP forward to 4F01H.
4EF5
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of FCB +00H (PUT mode flag).
4EF9
If Z (GET operation), GOSUB to BASIC/CMD routine at 623BH for read buffer fill.
4EFC
If NZ (PUT operation), GOSUB to BASIC/CMD routine at 6236H for write buffer setup.
4EFF
JUMP forward to 4F0BH to complete.
4F01
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of FCB +00H (PUT mode flag).
4F05
If Z (GET at boundary), GOSUB to BASIC/CMD routine at 6259H.
4F08
If NZ (PUT at boundary), GOSUB to BASIC/CMD routine at 625EH for buffer flush.
4F0B
JUMP to 51B1H to finish the operation and return to BASIC.
4F0EH - Buffer Boundary Check
This short routine checks if the current buffer position is at a sector boundary. It loads the buffer pointer and tests against the record length to determine if a new sector needs to be read or written.
4F0E
Load HL with the value at 5710H. This is the buffer pointer in the FCB work area.
4F11
Load Register A with the low byte of record length.
4F14
OR A B7
OR A with itself to set flags. Z flag set if record length low byte is 0.
4F15
RET Z C8
If the Z FLAG is set (at sector boundary), RETurn with Z flag set.
4F16
DEC H 25
DECrement H. Adjust buffer pointer high byte.
4F17
RET C9
RETurn to caller with adjusted pointer and flags.
4F18H - Standard Read/Write Mode Processing
This section handles GET/PUT for files opened with explicit read or write mode (bits 0-1 set in status). It sets up field variables, parses variable lists, and manages the data transfer between the buffer and BASIC variables.
4F18
GOSUB to BASIC/CMD routine at 6358H to initialize field processing.
4F1B
LD (4F8CH),HL 22 8C 4F
Store HL into 4F8CH. This saves the field base address for later use. [SELF-MODIFYING]
4F1E
POP HL E1
POP HL from the stack. Restore the BASIC text pointer.
4F1F
GOSUB to BASIC/CMD routine at 638FH to check for end of statement.
4F22
If the Z FLAG is set (at end of statement), JUMP to 51B0H to finish without variable list.
4F25
DEC HL 2B
DECrement HL to back up in BASIC text.
4F26
RST 10H D7
RST 10H (CHRGET) - Advance to next non-space character, load into A.
4F27
If the Z FLAG is set (unexpected end), JUMP to 5DF4H for syntax error.
4F2A
CP 2CH FE 2C
Compare Register A against 2CH (ASCII ,).
4F2C
If the Z FLAG is set (comma found), JUMP forward to 4F3DH to process variable list.
4F2E
SET 1,(IX+2DH) DD CB 2D CE
SET bit 1 of FCB +2DH. This marks variable list processing mode.
4F32
GOSUB to ROM routine at 1E5AH to find a variable in BASIC's variable table.
4F35
PUSH HL E5
Save HL onto the stack (BASIC text pointer after variable name).
4F36
GOSUB to ROM routine at 1EC5H to get variable value address.
4F39
LD BC,0004H 01 04 00
Load BC with 0004H. This is an offset to skip past the variable header.
4F3C
ADD HL,BC 09
ADD BC to HL. HL now points to the actual variable data area.
4F3D
LD C,(IX+00H) DD 4E 00
Load Register C with FCB +00H (file status byte).
4F40
BIT 4,C CB 61
Test bit 4 of C. This is the PUT mode flag.
4F42
If the Z FLAG is set (GET operation), JUMP forward to 4F87H for GET processing.
4F44
BIT 4,(IX+2DH) DD CB 2D 66
Test bit 4 of FCB +2DH. This is the buffer dirty flag.
4F48
If the NZ FLAG is set (buffer already dirty), JUMP to 4F87H.
4F4A
BIT 0,C CB 41
Test bit 0 of C. This is the read mode flag.
4F4C
If the Z FLAG is set (not open for read), JUMP to 4F7BH.
4F4E
BIT 3,C CB 59
Test bit 3 of C. This is the buffer active flag.
4F50
If the Z FLAG is set (buffer not active), JUMP to 5DD0H for "Bad File Number" error.
4F53
BIT 2,C CB 51
Test bit 2 of C. This is the random access flag.
4F55
If the NZ FLAG is set (random access mode), JUMP to 4F7BH.
4F57
PUSH HL E5
Save HL onto the stack.
4F58
GOSUB to BASIC/CMD routine at 6058H to check buffer status.
4F5B
If the CARRY FLAG is set (buffer needs attention), JUMP to 4F69H.
4F5D
SET 3,(IX+2DH) DD CB 2D DE
SET bit 3 of FCB +2DH. Mark sequential write pending.
4F61
BIT 7,(IX+01H) DD CB 01 7E
Test bit 7 of FCB +01H. This is the EOF flag.
4F65
If the NZ FLAG is set (at EOF), JUMP to 4F7AH.
4F67
JUMP forward to 4F6EH to continue processing.
[LOOP] Synchronize buffer position for sequential access.
4F69
GOSUB to BASIC/CMD routine at 627FH to compare positions.
4F6C
If the NZ FLAG is set (not synchronized), LOOP BACK to 4F58H. [LOOP]
4F6E
LD H,L 65
Load H with L. Adjust position registers.
4F6F
LD L,C 69
Load L with C.
4F70
Load DE with the value at 5704H (position bytes from FCB work area).
4F74
OR A B7
OR A with itself to clear Carry flag.
4F75
SBC HL,DE ED 52
SuBtract with Carry: HL = HL - DE. Calculate offset difference.
4F77
LD (4F8CH),HL 22 8C 4F
Store HL into the self-modifying location at 4F8CH. [SELF-MODIFYING]
4F7A
POP HL E1
Restore HL from the stack.
4F7B
PUSH HL E5
Save HL onto the stack.
4F7C
SET 2,(IX+2DH) DD CB 2D D6
SET bit 2 of FCB +2DH. Mark write operation in progress.
4F80
GOSUB to 4F8BH to load field base address from self-modifying storage.
4F83
GOSUB to BASIC/CMD routine at 61CAH for position calculation.
4F86
POP HL E1
Restore HL from the stack.
4F87
RES 2,(IX+2DH) DD CB 2D 96
RESet bit 2 of FCB +2DH. Clear write operation in progress flag.
4F8BH - Field Base Address Loader
This routine loads the field base address into DE from a self-modifying storage location. It also stores the position bounds for range checking during data transfers.
[SELF-MODIFYING CODE] The LD DE instruction at 4F8BH has its operand modified at 4F1BH and 4F77H.
4F8B
LD DE,0000H 11 00 00
Load DE with 0000H. This is self-modifying code - the actual value is stored here by code at 4F1BH and 4F77H. Contains the field base offset.
4F8E
Store DE into the position bounds at 61F1H in BASIC/CMD. This is also a self-modifying location used for range validation.
4F92
LD DE,0001H 11 01 00
Load DE with 0001H. This is the minimum field count.
4F95
Store DE (0001H) into 5D5FH. This sets the field counter initial value.
4F99
GOSUB to 4FC1H to get next character and check statement continuation.
4F9C
CP 2CH FE 2C
Compare Register A against 2CH (ASCII ,).
4F9E
If the Z FLAG is set (comma found), JUMP forward to 4FAAH to process next field.
4FA0
CP 3BH FE 3B
Compare Register A against 3BH (ASCII ;). Semicolon is alternate separator.
4FA2
If the NZ FLAG is set (not semicolon - end of list), JUMP forward to 4FDFH.
4FA4
DEC DE 1B
DECrement DE (field counter).
4FA5
LD A,D 7A
Load A with D (high byte of counter).
4FA6
OR E B3
OR A with E. Z flag set if counter reached zero.
4FA7
If the Z FLAG is set (counter zero), JUMP to 51A2H for completion.
4FAA
LD A,(IX+00H) DD 7E 00
Load Register A with FCB +00H (file status byte).
4FAD
AND 12H E6 12
AND A with 12H. Isolate bits 1 and 4 (write mode and PUT flag).
4FAF
If the NZ FLAG is set (conflicting modes), JUMP to 5DF7H for error.
4FB2
PUSH HL E5
Save HL onto the stack.
4FB3
GOSUB to BASIC/CMD routine at 6293H to read sector into buffer.
4FB6
If the CARRY FLAG is set (read error), JUMP to 5DE5H for "EOF" error.
4FB9
If the Z FLAG is set (need more data), LOOP BACK to 4FB3H. [LOOP]
4FBB
GOSUB to BASIC/CMD routine at 626CH to add bytes to position.
4FBE
JUMP to 518EH to continue processing.
4FC1H - Statement Continuation Parser
This routine parses the BASIC statement to find continuation tokens, handling line continuation across multiple lines and checking for end of statement conditions.
4FC1
RST 10H D7
RST 10H (CHRGET) - Advance to next non-space character in BASIC text, load into A.
4FC2
If the NZ FLAG is set (character found), JUMP forward to 4FCDH to check token.
4FC4
OR A B7
OR A with itself to set flags.
4FC5
If the Z FLAG is set (end of line), JUMP forward to 4FD4H to check for continuation.
4FC7
RST 10H D7
RST 10H (CHRGET) - Get next character.
4FC8
CP 93H FE 93
Compare A against 93H. This is the BASIC token for ELSE.
4FCA
If the NZ FLAG is set (not ELSE - unexpected), JUMP to 5DF4H for syntax error.
4FCD
CP 93H FE 93
Compare A against 93H (ELSE token).
4FCF
RET NZ C0
If the NZ FLAG is set (not ELSE), RETurn to caller with character in A.
4FD0
RST 10H D7
RST 10H (CHRGET) - Skip past ELSE token.
4FD1
OR A B7
OR A with itself to check if at end.
4FD2
If the NZ FLAG is set (more content), LOOP BACK to 4FD0H to skip. [LOOP]
At end of current line - check for program continuation.
4FD4
INC HL 23
INCrement HL to point to next line link pointer.
4FD5
LD A,(HL) 7E
Load A with low byte of next line address.
4FD6
INC HL 23
INCrement HL.
4FD7
OR (HL) B6
OR A with high byte of next line address. Z set if 0000H (end of program).
4FD8
If the Z FLAG is set (end of program - no more lines), JUMP to 5DF4H for error.
4FDB
INC HL 23
INCrement HL past line number high byte.
4FDC
INC HL 23
INCrement HL past line number low byte. HL now at start of line content.
4FDD
JUMP back to 4FC1H to continue parsing from the next line.
4FDFH - Variable Expression Parser
This section parses variable expressions for GET/PUT variable lists. It handles different data types (string, integer, single, double) and manages data transfer between the file buffer and variable storage.
4FDF
PUSH HL E5
Save HL onto the stack (BASIC text pointer).
4FE0
RES 6,(IX+2DH) DD CB 2D B6
RESet bit 6 of FCB +2DH. Clear special expression flag.
4FE4
CP 28H FE 28
Compare A against 28H (ASCII (). Opening parenthesis indicates array or function.
4FE6
If the NZ FLAG is set (not parenthesis), JUMP forward to 500AH.
4FE8
GOSUB to BASIC/CMD routine at 61B7H to parse numeric expression.
4FEB
POP HL E1
Restore HL from the stack.
4FEC
If the Z FLAG is set (result is zero), JUMP to 500AH.
4FEE
DEC HL 2B
DECrement HL.
4FEF
RST 10H D7
RST 10H (CHRGET) - Get next character.
4FF0
If the Z FLAG is set (end of expression), JUMP to 500AH.
4FF2
CP 2CH FE 2C
Compare A against 2CH (ASCII ,).
4FF4
If the Z FLAG is set (comma), JUMP to 500AH.
4FF6
CP 3BH FE 3B
Compare A against 3BH (ASCII ;).
4FF8
If the Z FLAG is set (semicolon), JUMP to 500AH.
4FFA
SET 6,(IX+2DH) DD CB 2D F6
SET bit 6 of FCB +2DH. Mark special expression active.
4FFE
EX (SP),HL E3
EXchange HL with top of stack. Swap current and saved pointers.
4FFF
GOSUB to ROM routine at 0A7FH to convert floating point to integer in DE.
5002
LD A,H 7C
Load A with H.
5003
OR A B7
OR A with itself.
5004
LD A,L 7D
Load A with L.
5005
If the Z FLAG is set (H was zero), JUMP to 500CH.
5007
JUMP to 5DFAH for buffer position error.
500A
LD A,FFH 3E FF
Load A with FFH. This is the default field width (255 = variable length).
500C
LD (5094H),A 32 94 50
Store A into 5094H. This is the field width storage. [SELF-MODIFYING]
500F
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of FCB +00H (PUT mode flag).
5013
If the NZ FLAG is set (PUT operation), JUMP to 50F6H for PUT variable handling.
GET operation - read data from buffer into variable.
5016
POP HL E1
Restore HL from the stack.
5017
GOSUB to BASIC/CMD routine at 62FFH to check variable type and get info.
501A
If the Z FLAG is set (special type), JUMP to 506AH.
501C
PUSH DE D5
Save DE onto the stack.
501D
BIT 5,(IX+2DH) DD CB 2D 6E
Test bit 5 of FCB +2DH (EOF flag).
5021
If the Z FLAG is set (not at EOF), JUMP to 5056H for normal processing.
5023
OR A B7
OR A with itself.
5024
If the NZ FLAG is set, JUMP to 5053H.
5026
RST 20H E7
RST 20H (GETYPR) - Get expression type. Returns type flags.
5027
If the NZ FLAG is set (not string type), JUMP to 5053H.
String variable at EOF - special handling.
5029
GOSUB to BASIC/CMD routine at 5CC3H to get string descriptor.
502C
LD B,A 47
Load B with A (string length).
502D
LD A,C 79
Load A with C (field width).
502E
SUB B 90
SUBtract B from A. Calculate padding needed.
502F
If NO CARRY (field >= string), JUMP to 5034H.
5031
XOR A AF
XOR A with itself, setting A to 0.
5032
LD (HL),C 71
Store C (field width) into string length at (HL).
5033
LD B,C 41
Load B with C.
5034
LD C,A 4F
Load C with A (padding count).
5035
PUSH HL E5
Save HL onto the stack.
5036
Load HL with FRETOP (40D6H) - top of free string space.
5039
RST 18H DF
RST 18H (CPDEHL) - Compare DE with HL.
503A
POP HL E1
Restore HL from the stack.
503B
If NO CARRY, JUMP to 5041H.
503D
LD A,C 79
Load A with C.
503E
OR A B7
OR A with itself.
503F
If the Z FLAG is set, JUMP to 5053H.
5041
PUSH BC C5
Save BC onto the stack.
5042
PUSH DE D5
Save DE onto the stack.
5043
LD A,B 78
Load A with B.
5044
ADD A,C 81
ADD C to A.
5045
GOSUB to BASIC/CMD routine at 5CD3H for string space allocation.
5048
EX DE,HL EB
EXchange DE and HL.
5049
POP DE D1
Restore DE from the stack.
504A
POP BC C1
Restore BC from the stack.
504B
LD A,B 78
Load A with B.
504C
OR A B7
OR A with itself.
504D
If NZ, GOSUB to ROM routine at 09D6H to copy string data.
5050
GOSUB to BASIC/CMD routine at 5CE3H for string finalization.
5053
JUMP to 518EH to continue with next variable or finish.
Normal GET processing (not at EOF).
5056
OR A B7
OR A with itself.
5057
If the Z FLAG is set (type 0), JUMP to 5062H.
5059
LD A,C 79
Load A with C (field width).
505A
GOSUB to BASIC/CMD routine at 626DH to add bytes to buffer position.
505D
GOSUB to BASIC/CMD routine at 636DH for buffer data transfer.
5060
JUMP back to 5053H to finish.
5062
PUSH HL E5
Save HL onto the stack.
5063
RST 20H E7
RST 20H (GETYPR) - Get expression type.
5064
PUSH AF F5
Save AF (type flags) onto the stack.
5065
If the NZ FLAG is set (not string), JUMP to 50BFH for numeric handling.
5067
LD A,C 79
Load A with C (field width).
5068
JUMP to 5098H for string processing.
506AH - Special Type Handler (# Prefix)
This section handles variables with # prefix notation, which indicates alternate field access or special numeric formatting.
506A
LD A,(HL) 7E
Load A with the byte at HL (current character).
506B
CP 23H FE 23
Compare A against 23H (ASCII #).
506D
If the NZ FLAG is set (not #), JUMP to 5076H.
506F
INC HL 23
INCrement HL past the # character.
5070
GOSUB to BASIC/CMD routine at 62F7H for # prefix handling.
5073
JUMP back to 4FAAH to continue field processing.
5076
GOSUB to ROM routine at 260DH to evaluate expression.
5079
PUSH HL E5
Save HL onto the stack.
507A
PUSH DE D5
Save DE onto the stack.
507B
RST 20H E7
RST 20H (GETYPR) - Get expression type.
507C
PUSH AF F5
Save AF (type flags) onto the stack.
[LOOP] Read sectors until buffer has required data.
507D
GOSUB to BASIC/CMD routine at 6293H to read sector into buffer.
5080
If CARRY (read error), JUMP to 5DE5H for EOF error.
5083
If Z (need more data), LOOP BACK to 507DH. [LOOP]
5085
LD C,B 48
Load C with B (byte count).
5086
LD (40AFH),A 32 AF 40
Store A into 40AFH (current type flag in BASIC system area).
5089
RST 20H E7
RST 20H (GETYPR) - Get type again.
508A
If NZ (numeric type), JUMP to 50BFH.
508C
POP AF F1
Restore AF from the stack.
508D
POP HL E1
Restore HL from the stack.
508E
PUSH HL E5
Save HL again.
508F
PUSH AF F5
Save AF again.
5090
If NZ, JUMP to ROM routine at 0AF6H for type mismatch error.
[SELF-MODIFYING] The following instruction has its operand set at 500CH.
5093
LD A,00H 3E 00
Load A with 00H. [SELF-MODIFYING] - actual value set by code at 500CH. Contains field width.
5095
CP B B8
Compare A (field width) against B (current width).
5096
If NC (field >= width), JUMP to 5099H.
5098
LD B,A 47
Load B with A (use field width as limit).
5099
PUSH BC C5
Save BC onto the stack.
509A
GOSUB to BASIC/CMD routine at 5CC3H to get string descriptor.
509D
LD B,D 42
Load B with D.
509E
LD C,E 4B
Load C with E. BC now has string address.
509F
LD D,H 54
Load D with H.
50A0
LD E,L 5D
Load E with L. DE now has descriptor address.
50A1
XOR A AF
XOR A with itself, setting A to 0.
50A2
GOSUB to ROM routine at 29E3H for string allocation.
50A5
PUSH HL E5
Save HL onto the stack.
50A6
Load HL with FRETOP (40D6H).
50A9
RST 18H DF
RST 18H (CPDEHL) - Compare DE with HL.
50AA
POP HL E1
Restore HL from the stack.
50AB
If CARRY, JUMP to 50AFH.
50AD
LD (HL),00H 36 00
Store 00H at (HL) - null terminate string.
50AF
POP BC C1
Restore BC from the stack.
50B0
LD A,(HL) 7E
Load A with byte at (HL).
50B1
CP B B8
Compare A against B.
50B2
PUSH BC C5
Save BC onto the stack.
50B3
LD (HL),B 70
Store B into (HL).
50B4
LD A,B 78
Load A with B.
50B5
If CARRY, GOSUB to 5CD3H for string allocation.
50B8
GOSUB to 5CC3H to get string descriptor.
50BB
EX DE,HL EB
EXchange DE and HL.
50BC
POP BC C1
Restore BC from the stack.
50BD
JUMP to 50DCH to continue.
50BFH - Numeric Type Handler
This section handles numeric variable types (integer, single, double precision) for GET/PUT operations, setting up the appropriate buffer sizes and calling the data transfer routines.
50BF
LD HL,4121H 21 21 41
Load HL with 4121H. This is the BASIC numeric work area.
50C2
LD B,02H 06 02
Load B with 02H. Default size is 2 bytes (integer).
50C4
If M (Sign flag - double precision), JUMP to 50D0H.
50C7
LD B,04H 06 04
Load B with 04H. Single precision is 4 bytes.
50C9
If CARRY (single precision), JUMP to 50D0H.
50CB
LD HL,411DH 21 1D 41
Load HL with 411DH. Alternate work area for double precision.
50CE
LD B,08H 06 08
Load B with 08H. Double precision is 8 bytes.
50D0
LD C,B 48
Load C with B (byte count).
50D1
LD (40DFH),HL 22 DF 40
Store HL into 40DFH (numeric work area pointer).
50D4
POP AF F1
Restore AF from the stack.
50D5
If Z (type mismatch), JUMP to ROM 0AF6H for error.
50D8
PUSH AF F5
Save AF onto the stack.
50D9
GOSUB to BASIC/CMD routine at 62EEH for buffer data transfer setup.
50DC
LD A,B 78
Load A with B (byte count).
50DD
OR A B7
OR A with itself to set flags.
50DE
If NZ (bytes to transfer), GOSUB to 623BH for read buffer fill.
50E1
LD A,C 79
Load A with C.
50E2
SUB B 90
SUBtract B from A.
50E3
If NZ, GOSUB to 626DH to add bytes to position.
50E6
GOSUB to 636DH for buffer data transfer.
50E9
POP AF F1
Restore AF from the stack.
50EA
POP HL E1
Restore HL from the stack.
50EB
If Z (done), JUMP to 518EH.
50EE
LD DE,518EH 11 8E 51
Load DE with 518EH (return address).
50F1
PUSH DE D5
Push return address onto stack.
50F2
PUSH DE D5
Push again (double return for nested call).
50F3
JUMP to ROM routine at 1F33H for variable assignment.
50F6H - PUT Variable Handler
This section handles PUT operations for writing variable data to the file buffer. It determines the variable type, extracts the data, and writes it to the appropriate buffer position.
50F6
POP HL E1
POP HL from the stack. Restore the BASIC text pointer.
50F7
GOSUB to BASIC/CMD routine at 62FFH to check variable type and get info.
50FA
If the Z FLAG is set (special type), JUMP to 5144H.
50FC
PUSH DE D5
Save DE onto the stack.
50FD
OR A B7
OR A with itself to test type.
50FE
If the Z FLAG is set (string type), JUMP to 511EH.
5100
CP 23H FE 23
Compare A against 23H (# prefix).
5102
If the Z FLAG is set, JUMP to 5111H.
5104
LD A,(IX+2DH) DD 7E 2D
Load A with FCB +2DH (buffer flags).
5107
BIT 2,A CB 57
Test bit 2 (write operation flag).
5109
If NZ, JUMP to 518EH.
510C
BIT 4,A CB 67
Test bit 4 (buffer dirty flag).
510E
If Z (not dirty), JUMP to 5059H.
5111
INC C 0C
INCrement C (byte counter).
5114
XOR A AF
Set A to 00H.
5115
LD B,A 47
Load B with 0.
5116
GOSUB to 61EFH for position bounds check.
511A
If NZ, LOOP to 5114H. [LOOP]
511E
RST 20H E7
RST 20H (GETYPR) - Get type.
511F
If NZ (not string), JUMP to 516CH.
5121
LD A,C 79
Load A with C (field width).
5122
GOSUB to 61C3H for string length.
5125
LD C,B 48
Load C with B.
5126
LD B,A 47
Load B with A.
5127
LD A,C 79
Load A with C.
5128
SUB B 90
SUBtract B from A.
5129
If NC, JUMP to 517EH.
512C
LD A,C 79
Load A with C.
512D
OR A B7
OR A with itself.
5130
LD A,(HL) 7E
Load A with byte at (HL).
5131
LD B,C 41
Load B with C.
5132
INC HL 23
INCrement HL.
5138
LD B,00H 06 00
Load B with 00H.
513A
LD A,20H 3E 20
Load A with 20H (ASCII space for padding).
513C
GOSUB to 61EFH for position check.
513F
INC H 24
INCrement H (padding counter).
5140
If NZ, LOOP to 513AH. [LOOP]
5144H - Special PUT Type Handler
Handles PUT operations for special variable types including # prefix notation and direct field writes.
5144
LD A,(HL) 7E
Load A with byte at (HL).
5145
CP 23H FE 23
Compare against 23H (#).
5147
If NZ, JUMP to 515AH.
514D
LD B,FFH 06 FF
Load B with FFH.
5152
LD C,B 48
Load C with B.
5153
LD B,00H 06 00
Load B with 00H.
515A
GOSUB to 61B7H to parse expression.
515D
If NZ, JUMP to 5164H.
5164
LD HL,4121H 21 21 41
Load HL with 4121H (numeric work area).
5167
If CARRY, JUMP to 516CH.
5169
LD HL,411DH 21 1D 41
Load HL with 411DH (double work area).
516C
LD A,72H 3E 72
Load A with 72H.
516E
LD B,02H 06 02
Load B with 02H (integer = 2 bytes).
5170
If M (double), JUMP to 517BH.
5174
LD B,04H 06 04
Load B with 04H (single = 4 bytes).
5176
If CARRY, JUMP to 517BH.
5179
LD B,08H 06 08
Load B with 08H (double = 8 bytes).
517B
GOSUB to 62EEH for buffer setup.
517E
BIT 1,(IX+00H) DD CB 00 4E
Test bit 1 of FCB +00H (write mode flag).
5182
If Z (not write mode), JUMP to 518BH.
5184
LD A,B 78
Load A with B.
5185
OR A B7
OR A with itself.
5186
If Z (no bytes), JUMP to 518EH.
5188
LD A,(HL) 7E
Load A with byte at (HL).
518A
INC HL 23
INCrement HL.
518EH - Continue Processing / Return Handler
This section handles the completion of each variable in a GET/PUT list and determines whether to continue with more variables or finish the statement.
518E
POP HL E1
Restore HL from the stack (BASIC text pointer).
518F
DEC HL 2B
DECrement HL to back up one character.
5190
GOSUB to 4FC1H to get next character and check continuation.
5193
Load DE with the field counter from 5D5FH.
5197
INC DE 13
INCrement DE (next field).
5198
CP 2CH FE 2C
Compare A against 2CH (,).
519A
If Z (comma), JUMP to 4F95H to process next variable.
519D
CP 3BH FE 3B
Compare A against 3BH (;).
519F
If NZ (not semicolon - end of statement), JUMP to 51CBH to finish.
51A2
GOSUB to 51C9H to get next character.
51A5
LD A,(IX+2DH) DD 7E 2D
Load A with FCB +2DH (buffer flags).
51A8
BIT 2,A CB 57
Test bit 2 (write operation flag).
51AA
RET NZ C0
If NZ (write completed), RETurn.
51AB
BIT 1,A CB 4F
Test bit 1.
51AF
POP HL E1
POP HL (discard return address).
51B1
BIT 5,(IX+2DH) DD CB 2D 6E
Test bit 5 of FCB +2DH (EOF flag).
51B5
If NZ (at EOF), JUMP to 51C3H.
51BA
GOSUB to 6326H for buffer flush.
51BE
DEC HL 2B
DECrement HL.
51BF
RST 10H D7
RST 10H (CHRGET) - Get next character.
51C0
JUMP to BASIC/CMD routine at 6445H to complete statement and return to BASIC interpreter.
51C3
GOSUB to 6381H for EOF handling.
51C7
RET C9
RETurn to BASIC interpreter.
51C8
DEC HL 2B
DECrement HL.
51C9
RST 10H D7
RST 10H (CHRGET) - Get next character.
51CA
RET Z C8
If Z (end of line), RETurn.
51CB
JUMP to 5DF7H for syntax error handling.
51CEH - Reserved/NOP Area
This area contains NOP bytes (00H) serving as padding or reserved space at the end of the SYS10 module.
51CE-51E7H
00 00 00 ... (26 bytes) data
Reserved NOP area. 26 bytes of zeros (51CEH-51E7H) provide padding at the end of the SYS10 module.