The 'F' command saves memory to cassette tape. The command format is: F filename:SSSS EEEE XXXX where SSSS=start address (hex), EEEE=end address (hex), XXXX=execution address (hex). All addresses are entered as 4 hex digits.
522C
GOSUB to 535EH to skip any whitespace and point HL to the first non-space character (the filename).
522F
LD (5269H),HL 226952
Store the filename pointer (HL) into memory location 5269H. This saves the start of the filename for later use when writing the cassette header.
Now scan forward through the filename until we find the ':' delimiter.
5232
LD A,(HL) 7E
[SCAN LOOP] Fetch the character at the current position pointed to by HL.
5233
INC HL 23
INCrement Register Pair HL to point to the next character.
5234
CP 3AH FE3A
Compare the value held in Register A against 3AH (ASCII: :). If we found the colon delimiter, the Z FLAG will be set.
5236
If the NZ FLAG (Not Zero) has been set (not a colon), LOOP BACK to 5232H to continue scanning for the ':' delimiter.
Found the ':' - now parse the START address (4 hex digits = 2 bytes, high byte first).
5238
GOSUB to 535EH to skip any whitespace after the colon.
523B
GOSUB to 5376H to parse two hex digits and convert them to a binary byte in Register A. This gets the HIGH byte of the start address.
523E
LD (5278H),A 327852
Store the start address HIGH byte into memory location 5278H. NOTE: This is self-modifying code - it becomes the operand of an instruction later.
5241
INC HL 23
INCrement Register Pair HL to point past the two hex digits just parsed.
5242
GOSUB to 5376H to parse the next two hex digits. This gets the LOW byte of the start address.
5245
LD (5277H),A 327752
Store the start address LOW byte into memory location 5277H.
Now parse the END address (4 hex digits = 2 bytes, high byte first).
5248
GOSUB to 535EH to skip any whitespace before the end address.
524B
GOSUB to 5376H to parse two hex digits for the HIGH byte of the end address.
524E
LD (527BH),A 327B52
Store the end address HIGH byte into memory location 527BH.
5251
INC HL 23
INCrement Register Pair HL to point past the two hex digits just parsed.
5252
GOSUB to 5376H to parse the LOW byte of the end address.
5255
LD (527AH),A 327A52
Store the end address LOW byte into memory location 527AH.
Now parse the EXECUTION address (4 hex digits = 2 bytes, high byte first).
5258
GOSUB to 535EH to skip any whitespace before the execution address.
525B
GOSUB to 5376H to parse two hex digits for the HIGH byte of the execution address.
525E
LD (53F3H),A 32F353
Store the execution address HIGH byte into memory location 53F3H for inclusion in the cassette file trailer.
5261
INC HL 23
INCrement Register Pair HL to point past the two hex digits just parsed.
5262
GOSUB to 5376H to parse the LOW byte of the execution address.
5265
LD (53F2H),A 32F253
Store the execution address LOW byte into memory location 53F2H.