
Part four takes the DOS away. To run with no DOS, DISKMON must be what the Einstein starts when you switch it on - so first, what does it do when you switch it on?
If there is a disc in drive 0, the MOS reads track 0, sector 0 and looks at its first seven bytes:
| Bytes | Holds |
|---|---|
| 0-1 | Start: where in memory to load, low byte first |
| 2-3 | End: the last address to fill |
| 4-5 | Jump: where to start running |
| 6 | The side flag: 0 |
It then reads whole sectors - track 0 sector 0, sector 1, sector 2 and on, in order of their IDs - into memory from the start address until it has covered the end address, and jumps to the jump address. The header itself is loaded too: it is the first seven bytes at the start address.
That is all the Einstein does by itself. If what it loads is a DOS, you get XtalDOS's 0: prompt. If it is anything else, you get that.
U d reads track 0 sector 0 of a drive and shows its header.
After the line JP Z,CMDM, add:
CP 'U'
JP Z,CMDU
After the last line of CMDM (JP DONE), add:
; U d: read drive d's track 0 sector 0 and show its boot header.
CMDU: CALL GETNUM
JP C,WHAT
LD (SDRV),A
XOR A
LD (STRK),A
LD (SSEC),A
CALL READSEC
JP NZ,DISCERR
LD IX,SECBUF
LD HL,STARTM
CALL PRINT
LD L,(IX+0)
LD H,(IX+1)
CALL PHEXW
LD HL,ENDM
CALL PRINT
LD L,(IX+2)
LD H,(IX+3)
CALL PHEXW
LD HL,JUMPM
CALL PRINT
LD L,(IX+4)
LD H,(IX+5)
CALL PHEXW
LD HL,SIDEM
CALL PRINT
LD A,(IX+6)
CALL PHEX
JP CRMAIN
After the line RLEFT: DEFB 0, add:
STARTM: DEFB 'START ',0
ENDM: DEFB ' END ',0
JUMPM: DEFB ' JUMP ',0
SIDEM: DEFB ' SIDE ',0
Run it on a copy of PRIMER.DSK, with the system disc in drive 0 as always:
U 0
U 1
What you should see
> U 0
START E100 END FB00 JUMP FA00 SIDE 00
> U 1
START E5E5 END E5E5 JUMP E5E5 SIDE E5
>
The system disc loads from E100h to FB00h and starts at FA00h: that is XtalDOS putting itself where S5 found it - its command processor at E100h, the BDOS above, and at FA00h the part that 0000h's JP FA03H leads to. PRIMER.DSK was made by edisc.py, which leaves tracks 0 and 1 blank: there is no header, only E5h.
At power-on the MOS loads what track 0 sector 0's header says and jumps to it. XtalDOS is just the code a system disc's header points at.
S20 writes a header of DISKMON's own, so that a disc starts DISKMON instead.
This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.