4E01
IM 1
Set the INTERRUPT MODE to 1
4E03
LD SP,41FCH
Set the Stack Pointer to 41FCH
4E06
LD HL,5200H
Set HL to point to the utility load addrress of 5200H
4E09
LD (4047H),HL
Store the 5200H Utility Load Address into (4047H)
4E0C
LD HL,0FFFFH
Set the start address for the memory test into HL
4E0F
LD A,(HL)
Fetch the memory contents of (HL) into Register A
4E10
LD B,A
Save a copy of the memory contents into Register B
4E11
CPL
Complement Register A
4E12
LD (HL),A
Put the complemented memory contents back into (HL)
4E13
CP (HL)
Check to see if the complemented memory contents are actually in (HL), setting the flags accordingly
4E14
LD (HL),B
Put the actual memory contents back into (HL)
4E15
If the complemented memory read back OK then the memory address must exist, so JUMP to down to 4E1DH
4E17
LD A,H
If we are here, then we didn't get a match, so put the MSB of the failed memory address into Register A
4E18
SUB A,04H
Reduce the MSB of the failed memory address by 04H, which drops it 1024 bytes
4E1A
LD H,A
Put the reduced MSB back into Register H
4E1B
LOOP back to 4E0FH to test (HL)
4E1D
LD (4049H),HL
If we are here, then HL points to the highest memory address, so put that into (4049H) which stores such things
4E20
JUMP to 4F20H to change the keyboard driver address
4E23
LD (43B8H),HL
Save the new keyboard driver address into 43B8H ...
4E26
LD (43C2H),HL
... and 43C2H (the driver address table)
4E29
LD HL,(401BH)
Fetch the address of the keyboard buffer
4E2C
LD (43C0H),HL
Put the address of the keyboard buffer into 43C0H (the device table)
4E2F
LD HL,(401EH)
Fetch the address of the video driver
4E32
LD (43BAH),HL
Put the address of the video driver into 43BAH (the driver table) ...
4E35
LD (43C6H),HL
... and 43C6H (the driver address table)
4E38
LD HL,(4023H)
Fetch the address of the video buffer
4E3B
LD (43C4H),HL
Put the address of the video buffer into 43C4H (the device table)
4E3E
LD HL,(4026H)
Fetch the address of the printer driver
4E41
LD (43BCH),HL
Put the address of the printer driver into 43BCH (the driver table) ...
4E44
LD (43CAH),HL
... and 43CAH (the driver address table)
4E47
LD HL,(402BH)
Fetch the address of the printer buffer
4E4A
LD (43C8H),HL
Put the address of the printer buffer into 43C8H (the device table)
4E4D
LD HL,43CCH
Put the END ADDRESS of the device table into Register HL
4E50
LD (HL),00H
Put a 00H at the end of the device table to signify a terminator
4E52
INC L
Bump the LSB by 1
4E53
If the NZ flag is set, JUMP to the next instruction (= meaningless instruction)
4E55
LD A,03H
Set Register A to 03H
4E57
LD HL,4015H
Setting up for a LDIR. Set HL to point to the address of the keyboard DCB
4E5A
LD DE,4358H
Set DE to point to the address of the alternate DCB area
4E5D
PUSH AF
Save Register Pair AF to the stack
4E5E
LD BC,0008H
Set BC to a counter of 8 bytes to move
4E61
LDIR
Move the 8 bytes of the keyboard DCB into the alternative DCB
4E63
XOR A,A
Zero out Register A and clear all flags
4E64
LD B,08H
Setting up for a DJNZ. Set B to move 8 bytes
4E66
LD (DE),A
Put a ZERO into the bytes right after the alternate DCB area
4E68
LOOP to fill all 8 bytes
4E6A
LD A,0FFH
Put FF (a data storage pattern) into Register A
4E6C
LD B,10H
Setting up for DJNZ. Set the counter to 16 bytes
4E6E
LD (DE),A
Fill (DE) with a FF. This fills 4368-4377 with FF
4E70
LOOP back to 4E6EH until all 16 bytes are filled with FF
4E72
POP AF
Restore Register pair AF (pushed in 4E5D)
4E73
DEC A
Reduce Register A by 1 (=meaningless instruction, Register A is filled in 2 instructions)
4E74
If Register A has still not hit ZERO, JUMP to the next instruction (=meaningless instruction)
4E76
LD A,(37ECH)
Get the controller status from (37ECH) and put it into Register A for testing/processing
4E79
XOR A
Clear A and all flags. This will be the NOP OPCODE since its being put into program memory
4E7A
LD (4315H),A
Store a NOP at the DEBUG switch memory location
4E7D
LD HL,404CH
Put the address of the interrupt mask byte into Register HL
4E80
LD (HL),A
Put a 0 into the interrupt mask byte. This will set to IGNORE ALL INTERRUPTS
4E81
LD A,0C3H
Put the OPCODE for a JP command into Register A
4E83
LD DE,4518H
Put 4518H, which is the address of the interrupt routine, into DE
4E86
LD (4013H),DE
Put the address of the interrupt routine into 4013H as the destination for a JUMP instruction for a call to 4012H
4E8A
LD (4012H),A
Put a JUMP instruction into 4012H
4E8D
LD DE,4560H
Put 4560H, the address of the of clock interrupt, into DE (actually, the Address of interrupt service routine for interrupt bit 7)
4E90
LD (405BH),DE
Put the clock interrupt into the Interrupt Task List
4E94
SET 7,(HL)
Set the mask bit for clock interrupt to ON
4E96
LD DE,4669H
Put 4669H, the address of the disk interrupt routine, into DE (actually, the address of interrupt service routine for interrupt bit 6)
4E99
LD (4059H),DE
Put the disk interrupt routine into the Interrupt Task List
4E9D
SET 6,(HL)
Set the mask bit for disk interrupt to ON
4E9F
LD A,01H
Set A to be 01H
4EA1
LD (430FH),A
Send 01H to the DEBUG LOAD FLAG (held at 430FH)
4EA4
LD DE,45AFH
Put 45AFH, which is the routine to maintain the clock, into Register DE
4EA7
LD A,07H
Put an 07H Into Register A to indicate which index into the Interrupt Task List is desired
4EA9
GOSUB to 4410H to add the clock maintenance routine to the interrupt task list
4EAC
LD HL,4EEDH
Point HL to the TRSDOS SYSTEM message
4EAF
LD A,(HL)
Fetch a character from that message
4EB2
GOSUB to 0033H in the ROM to send the character held in Register A to the current device
4EB5
INC HL
BUMP HL to point to the next character in the message
4EB6
CP 0DH
Check to see if the CURRENT character is a CARRIAGE RETURN/MESSAGE TERMINATOR
4EB8
If that character is NOT a CARRIAGE RETURN/MESSAGE TERMINATOR JUMP back to 4EAF to keep displaying the message
4EBA
GOSUB to 002BH in the ROM to fetch a character from the keyboard
4EBD
CP 0DH
Test to see if that keyboard character was a CARRIAGE RETURN
4EBF
If it was a carriage return, then JUMP to 4400H to SKIP the AUTO routine
4EC2
LD C,00H
If we are here, then we need to run the AUTO. First, put a 00 into Register C as the GAT sector pointer
4EC4
LD D,11H
Put an 11H into Register D to set the track for the directory
4EC6
LD E,00H
Put a 00H into Register E to set the sector number for the directory
4EC8
LD HL,4200H
Set up HL to point to a buffer address
4ECB
Read the sector held in Register E of the track held in D on the drive held in C into the buffer pointed to by HL
4ECE
If NZ is set, there was an error reading the GAT Sector, so JUMP back to 4409H to deal with the error
4ED1
LD A,(42E0H)
If we are here, then the GAT was properly read, so Fetch the first byte of the AUTO command from 42E0H into Register A
4ED4
CP 0DH
Is that first character a blank? If so, then there is no AUTO command
4ED6
If so, then there is no AUTO command so JUMP to 4400H to SKIP the AUTO routine
4ED9
LD HL,42E0H
If we are here, we need to deal with AUTO, so set up for a LDIR. First set HL to point to the AUTO file specification
4EDC
LD DE,4318H
Set DE to point to the command line buffer
4EDF
LD BC,0020H
Set BC to 32, which is the maximum length of the AUTO command
4EE2
LDIR
Move the auto command from the GAT sector into the command line buffer
4EE4
LD HL,4318H
Point HL to the command line buffer
4EE7
GOSUB to 4467H to display the AUTO message
4EEA
JUMP to 4405H to load up SYS1/SYS and run the AUTO command