[net.micro.cpm] BDOS secrets

ACB.TYM%office-2@sri-unix.UUCP (07/29/83)

Can anyone direct me to where I might find out 

   1.  What is in the first 6 bytes of the BDOS (before the entry point).

   2.  What significance is attached to the 4 addresses after the BDOS entry 
   point (after the initial jump).  What services are performed by the 
   subroutines pointed to by these addresses.

If this discussion has gone on before, I am sorry, just point me at the archive 
files are I will try to catch up.  If there is a document available with with 
the answers, just point me.

I got started on these questions after watching a popular directory lister (XD 
or SD) go south for the winter with a spooler overlay in place, and found it 
using these secret addresses.  Thanks  Bomberger@office-3.

rconn@brl@sri-unix.UUCP (07/29/83)

From:      Rick Conn <rconn@brl>

Hi --

1.  The first six bytes of the BDOS (before the entry point) contain the
serial number.  In CP/M systems, the serial number is contained within
the CCP and the BDOS.

2.  The four byte-pairs after the entry point are addresses of subroutines
to be executed when certain BDOS errors occur.  Specifically, these four
byte pairs have the following meanings:

	1st Pair:  Address of Permanent Disk Error routine; this
			routine is executed when bad block is encountered
	2nd Pair:  Address of Select Error routine; this routine
			is executed when a select to an invalid disk
			(such as E when the BIOS allows for up to D)
			is made
	3rd Pair:  Address of Disk R/O Error routine; this routine
			is executed when a write to a R/O disk is attempted
	4th Pair:  Address of File R/O Error routine; this routine
			is executed when a write to a R/O file is attempted

As a rule, these routines usually print an error message and then do a
warm boot.  Utilities may use these to trap out errors they cause and
perform other functions besides warm boot.

To summarize, the picture looks like this:

Base of BDOS:	DS	6	;Serial Number
		JMP	BDOSE	;Enter the BDOS at the command processor
		DW	PERSUB	;Permanent Disk Error
		DW	SELSUB	;Select Disk Error
		DW	ROSUB	;R/O Disk Error
		DW	RONSUB	;R/O File Error
BDOSE:		...		;BDOS command processing


	Rick

RGF%mit-mc@sri-unix.UUCP (07/31/83)

From:  Ronald G. Fowler <RGF@mit-mc>


Date: 30 July 1983 18:50 EDT
From: Ronald G. Fowler <RGF>
To:   ACB.TYM at OFFICE-2
cc:   RGF
Re:   BDOS secrets

1) Those six bytes at the beginning are the CP/M serial number; they 
   have little significance to anything other than the MOVCPM program
   (which disables interrupts and halts if these numbers do not match 
   MOVCPM's internal serial number).  I'm also told that some rather
   rude implementations of CP/M come with utilities that take it upon
   themselves to do this serial number check also.

2) The four vectors are pointers to the following routines (in order):

	a. Permanent error subroutine (ie, BDOS ERROR ON X: BAD
	   SECTOR)
	b. Select error
	c. Disk read/only error
	d. File read/only error

   The BDOS uses these addresses to find the corresponding error-
   handling subroutine; in theory, a transient program could overlay
   this table with pointers to its own routines, and thereby circum-
   vent the unfriendly BDOS error handlers, replacing the routines
   with more human-oriented messages.  In practice, few programs do
   this; it's a risky practice, and not quite as clear-cut as it
   sounds.			--Ron Fowler

reece%nadc@sri-unix.UUCP (07/31/83)

The first three bytes are the CP/M serial number; the next three is a jump
around the four addresses you mentioned. The four addresses are:
	BADSEC - BAD READ/WRITE HANDLER
	BADSEL - NON-EXISTENT DRIVE HANDLER
	DISKRO - DISK READ-ONLY
	FILERO - FILE READ-ONLY

reece%nadc@sri-unix.UUCP (08/01/83)

I have been corrected--the first SIX bytes of the BDOS are the serial number,
not three as I stated earlier.

CCVAX.ty%nosc@sri-unix.UUCP (08/01/83)

From:  Ty Wernet <CCVAX.ty@nosc>

The first 6 bytes in the BDOS is the serial number.
The 4 address  you referred to follow:
	Permanent error subroutine  "Bad Sector"
	Select error subroutine	    "Select Error"
	Read-only Subroutine	    "R/O Bdos error on "
	Read-only error subroutine  "File R/O Bdos error on "

goldfarb.ucf-cs%rand-relay@sri-unix.UUCP (08/07/83)

Have you ever noticed that when MOVCPM halts with a serial number
disparity, it prints:

            SYNCRONIZATION [sic] ERROR

This goes back as far as I can remember (version 1.?).  Maybe they 
were looking for one byte to save in MOVCPM and dumped the 'H'? :-)
				Ben

RGF@mit-mc@sri-unix.UUCP (08/07/83)

From:  Ronald G. Fowler <RGF@mit-mc>


Date: 1 August 1983 02:52 EDT
From: Ronald G. Fowler <RGF>
To:   goldfarb.ucf-cs at RAND-RELAY
cc:   RGF
Re:   [RGF: BDOS secrets]

Naw, I have the source, and there is no reason to need to save a byte;
it's just a case of nott being abel to spel corecttly.	--Ronn