Assembly Disc Access Primer, a TatungBytes course: DISKMON reading the hidden sector IDs of the course's own practice disc, on a rainbow sunburst
← Back to Modules
module
21

Life with No BDOS

Introduction

Booted, DISKMON's T would CALL 5 - and there is nothing at 0005h to call. The machine would stop in the MOS's register display. DISKMON needs to know whether it has a DOS, and to refuse politely when it has not.

Is There a DOS?

Under XtalDOS, 0005h holds C3: the JP to the BDOS. Booted with no DOS, the MOS leaves FFh there. So START looks at 0005h once and keeps the answer in HASDOS. NEEDDOS - which every BDOS command has called since S7 - now checks it and says NEEDS THE DOS instead of calling 5.

Q changes too: with a DOS, it returns to 0:; with none, there is nothing to return to, so it says STOPPED and waits there until you reset the machine.

The Memory That Is Yours

Under XtalDOSBooted
Your program and data0100h up to E0FFh (EBFFh if you end with JP 0)0100h up to FAFFh
The system'sE100h up: the DOS; FB00h up: the MOSFB00h up: the MOS's scratch-pad and stack

Booted, nearly all of memory is yours. DISKMON's buffers at 8000h are fine either way.

The Code

After the last line of START (CALL PRINT), add:

        XOR A                   ; is there a DOS? 0005h holds JP (C3h) if so
        LD (HASDOS),A
        LD A,(0005H)
        CP 0C3H
        JR NZ,NODOS
        LD A,1
        LD (HASDOS),A
        JR MAIN
NODOS:  LD HL,NODOSM
        CALL PRINT

After the line QUIT:, add:

        LD A,(HASDOS)
        OR A
        JR NZ,QUIT1
        LD HL,STOPM             ; no DOS to go back to
        CALL PRINT
STOP:   JR STOP
QUIT1:

After the line NEEDDOS:, add:

        LD A,(HASDOS)
        OR A
        RET NZ
        LD HL,NEEDM
        JP DONE

After the line BOOTM: DEFB ' SECTORS WRITTEN TO TRACK 0',13,10,0, add:

HASDOS: DEFB 0
NODOSM: DEFB 'NO DOS: SECTORS ONLY',13,10,0
NEEDM:  DEFB 'NEEDS THE DOS',13,10,0
STOPM:  DEFB 'STOPPED',13,10,0

Run it: as in S20, B to work.mfi, then boot it in drive 0.

T 0:POEM.TXT
S 0 0 0
Q

What you should see

> T 0:POEM.TXT
NEEDS THE DOS
> S 0 0 0
0000 F9 00 DA 09 00 01 00 ED ........
0008 73 71 08 31 00 90 21 57 sq.1..!W
0010 08 CD 57 07 AF 32 A8 09 ..W..2..
0018 3A 05 00 FE C3 20 07 3E :.... .>
0020 01 32 A8 09 18 06 21 A9 .2....!.
0028 09 CD 57 07 31 00 90 21 ..W.1..!
0030 61 08 CD 57 07 CD 8F 06 a..W....
0038 CD 69 07 CD B7 06 B7 28 .i.....(
0040 EB 23 22 73 08 FE 51 CA .#"s..Q.
0048 A2 01 FE 46 CA B5 01 FE ...F....
0050 4F CA CA 01 FE 54 CA 02 O....T..
0058 02 FE 52 CA 5C 02 FE 57 ..R.\..W
0060 CA AC 02 FE 45 CA 14 03 ....E...
0068 FE 4E CA 36 03 FE 50 CA .N.6..P.
0070 70 03 FE 53 CA B0 03 FE p..S....
0078 2B CA FD 03 FE 44 CA 30 +....D.0
  (KEY)

NO DOS: SECTORS ONLY at the start; T refused; and track 0 sector 0 - DISKMON's own header, F9 00 (start), the end address, 00 01 (jump) - followed by DISKMON itself.

Change One Thing

  • Run this DISKMON under XtalDOS instead. What does START find at 0005h, and does T work?
  • Booted, what is the highest address DISKMON's buffers could safely reach?

Summary

One byte at 0005h tells a program whether it has a DOS. Without one it has the MOS, and almost all of memory.

Next

S22: keeping data on disc and reading it as needed, with no DOS - Blackwater Hall's pattern, by hand.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.