MZ is back!

This commit is contained in:
Mark Zbikowski 2024-04-25 21:24:10 +01:00 committed by Microsoft Open Source
parent 8ee9712c74
commit 2d04cacc53
1339 changed files with 527719 additions and 3 deletions

View File

@ -1,10 +1,11 @@
<img width="150" height="150" align="left" style="float: left; margin: 0 10px 0 0;" alt="MS-DOS logo" src="https://github.com/Microsoft/MS-DOS/blob/main/.readmes/msdos-logo.png">
# MS-DOS v1.25 and v2.0 Source Code
# MS-DOS v1.25, v2.0, v4.0 Source Code
This repo contains the original source-code and compiled binaries for MS-DOS v1.25 and MS-DOS v2.0.
This repo contains the original source-code and compiled binaries for MS-DOS v1.25 and MS-DOS v2.0, plus the source-code for MS-DOS v4.00 jointly developed by IBM and
Microsoft.
These are the same files [originally shared at the Computer History Museum on March 25th, 2014]( http://www.computerhistory.org/atchm/microsoft-ms-dos-early-source-code/) and are being (re)published in this repo to make them easier to find, reference-to in external writing and works, and to allow exploration and experimentation for those interested in early PC Operating Systems.
The MS-DOS v1.25 and v2.0 files [were originally shared at the Computer History Museum on March 25th, 2014]( http://www.computerhistory.org/atchm/microsoft-ms-dos-early-source-code/) and are being (re)published in this repo to make them easier to find, reference-to in external writing and works, and to allow exploration and experimentation for those interested in early PC Operating Systems.
# License

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
date
time
prompt $p$g
path a:\bin;a:\


Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
cd bin
pound 290 a:bbset.exe a:sm.exe


View File

@ -0,0 +1,4 @@
c:
cd \bin
pound 800 bbset.exe sm.exe


View File

@ -0,0 +1,7 @@
c:
cd \bin
cd a:\bin
detach pound 800 bbset.exe sm.exe
detach pound 290 a:bbset.exe a:sm.exe
basica a:prime


Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,199 @@
Multi-Tasking MS-DOS
Beta Test Release 1.00
Command Guide
ARENA.EXE - Prints out arena assignments
arena
The system's memory arena is printed out. The
number listed under the owner field is the PID of
the process which owns the memory.
BBSET.EXE - Set and report on behavior bits
bbset [-o] [ {+|-}bitname ... ] fname ...
BBSET sets or clears behavior bits in an .EXE file
header. Multi-Tasking MS-DOS uses the behavior
bits to determine the level of special
compatibility support needed to run the
application.
BBSET will set (if +bitname) or clear (if -
bitname) the named behavior bit(s) from the
specified files. If the -o switch is specified,
BBSET writes a report on the current setting of
all the defined behavior bits to stdout after
making the requested changes.
For a list of behavior bits that BBSET knows
about, type BBSET without any arguments.
COUNTDOW.EXE - Count down a CPU loop
countdown number
Its argument is a number; it counts the number
down to 0, at about a 1hz rate. It prints out
the countdown. Another CPU loop program like
TEXT, but this one terminates when the count
reaches 0
DETACH.EXE - Detaches a child process
detach command [argument ...]
The command given is run as a background process.
Detach prints out the Command Subgroup ID (CSID)
which may be used as an argument to KILL to
terminate the process.
Multi-Tasking MS-DOS Command Guide - Page: 2
HE_DAEM.EXE - Hard error catcher
detach he_daem
Intercepts hard errors, reports them and requests
user action. This should always be run in the
background for now. Put the above command line in
your AUTOEXEC.BAT file if you're not going to use
the Session Manager (SM).
KILL.EXE - send a signal to a process
kill [-nn] [sig=nn] [disp=mm] pid ...
Sends signal nn with disposition mm to processes
mentioned in pid. Defaults to SIGTERM and process
tree disposition.
POUND.EXE - Exercise disk I/O system
pound [t]count filea fileb
Pound reads sequencially through filea and fileb,
reading 512 bytes at a time alternating between
the files on each read. When the end of file is
read the following read for that file begins at
the beginning of the file. If a count is
specified without the preceeding "t" then pound
reads 512 bytes, count number of times from each
file before the program terminates. If "t"
preceeds the count value then the files are read
for count number of seconds before the program
terminates.
SLEEP.EXE - Sleep for a while
sleep sec[.millisec]
Sleep will execute a sleep system call for the
number of seconds and milliseconds specified.
This might be useful in batch files to pause for
an interval as opposed to waiting for a user
response.
SM.EXE - Session manager
sm
Manages multiple processes running on different
screens. Uses initialization file SM.INI. This
Multi-Tasking MS-DOS Command Guide - Page: 3
program includes the hard error catcher, so don't
run HE_DAEM if you're going to use this. See the
file SM.DOC for more information.
TEXT.EXE - Loop and print text
text argument
CPU loops and prints its argument every 2 CPU
seconds or so

View File

@ -0,0 +1,3 @@
buffers = 40
files = 20
break=on

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,67 @@
Multi-Taking MS-DOS
Beta Test Release 1.00
Release Notes
Enclosed you will find Microsoft's first beta release
of Multi-tasking MS-DOS. This version is based upon MS-DOS
Version 2 sources, we will be reimplementing the multi-
tasking enhancements on top of Version 3 sources shortly.
Although we have distributed a bootable disk for the
IBM PC, this package can be adapted to any MS-DOS machine.
Those manufacturers who are designing IBM compatible ROMs,
would be wise to keep multi-tasking in mind. Specifically,
this IBM PC implementation has had to hook out the entire
disk (both floppy and hard disk) ROM code because after he
IBM code set's up the DMA transfer it simply loops in ROM
waiting for the interrupt to occur (routine WAIT_INT).
Problems you may wish to avoid within future ROMs are:
1) loading ES with the physical video RAM location
(label M3)
2) Looping in ROM on Cntrl-NumLock (label K40)
3) No way to add special detecting special key
strokes which a jump out into RAM after reading
the keystroke at KB_INT would avoid
4) Not being able to hook the loading of DS to point
to DATA (EQU 40H) in numerous routines.
Other than these deficiencies the ROM code developed should
be very usable.
By implementing the above suggestions, the size of your
BIOS can be reduced since it will not be necessary to
duplicate functionality in RAM.
More detailed specifications of the device driver
formats will be forth coming. For the time being you will
have to make use of the sample source code for the IBM PC.
If you have further questions please contact Microsoft OEM
customer support through Technical Assist Requests (TAR).
* * * WARNING * * * WARNING * * * WARNING * * *
Each copy of this software distribution has been
individually serialized to facilitate tracing of
unauthorized duplication.
* * * WARNING * * * WARNING * * * WARNING * * *

199
v4.0-ozzie/bin/DISK1/SM.DOC Normal file
View File

@ -0,0 +1,199 @@
Multi-Tasking MS-DOS
Beta Test Release 1.00
Session Manager
User's Guide
Introduction
The Session Manager(SM) for Multi-Tasking MS-DOS
allows you to run up to six programs at one time and switch
between them with a couple of keystrokes. Each program's
screen is preserved so that it can be restored when you
switch back to it. SM also contains the system-wide, Int24
Handler.
Initialization
The first thing SM does when it is started is look for
any program initialization information you may have. SM
looks for the initialization information in a file named
SM.INI in the current directory. Although recommended, no
initialization information is needed.
There are two types of initialization lines:
1) define <program key> <program name> [program args]
<working directory>
2) start <program key>
"program key" - a printable ascii character, a control
character (^A thru ^^), or a function key (F1
- F10).
"working directory" - a well formed path; i.e., begins
with drive letter (d:\).
Each define line will associate a key with a program.
If there is more than one define line using the same key,
only the information in the last one is used.
A start line is optional. If one exists, the program
associated with the key on the start line is run as soon as
SM finishes initializing. If more than one start line is
given, the last one is used.
This is what a sample initialization file might look like:
define f1 a:\command.com c:\bin\src
define ^z z.exe foo.c a:\foo\bar
start f1
Running the Session Manager
To run Session Manager, just type SM. It does not
require any arguments. If there was a start line in the
Session Manager User's Guide - Page: 2
initialization file, the program associated with the start
key will be run. Otherwise, the SM screen will be displayed
and you will be prompted for input.
The SM screen contains a chart that describes each
defined program's key, status, arguments, and working
directory. There are 3 types of program status:
1) New - the program has never been run.
2) Active - the program has been started.
3) Dead - the program has terminated.
The input choices at this point are to either type a
program key or hit the <ESC> button to enter command mode.
If you hit a program key, the screen associated with that
program will be displayed and the program will
start/continue executing. If this is the first time the
program has been run, a chdir to the program's working
directory is made before it is started. If SM cannot start
the program you desired, the SM screen will reappear.
If the program you chose to run has died, its screen
will still be displayed so that you can check its output.
That is all you can do while in a dead programs screen
except switch back to SM.
To switch back to SM, hit Alt-F10. Alt-F10 is
currently the program key for SM and will be recognized no
matter what other programs are running. This is the only
program key that works this way. All of the others will
only be recognized if SM is running and the SM screen is
being displayed.
Whenever any of SM's children die, their status is
changed to dead. You will see the status change the next
time the SM screen is displayed. If the program using the
current screen dies, you will go back into SM.
Command Mode
When you enter SM's command mode the prompt "SM command or
HELP>" is displayed. The valid SM commands are:
1) INIT <program key>
Initialize the program associated with key so that
it can be run again. The program's status is
changed to "New" and its screen memory is freed.
If the program is active, it is killed before it
is initialized.
2) DEFINE <program key> <program name> [program args]
<working directory>
Define and run a new program using the supplied
information. If the key was previously defined,
redefine it.
Session Manager User's Guide - Page: 3
3) RUN <program key>
Run the program associated with key.
4) RESTART <program key>
Restart the program associated with key. This
like issuing an INIT and a RUN command.
5) KILL <program key>
Kill the program associated with key. Its status
is changed to dead.
6) HELP
Display a help screen.
7) EXIT
Kill all of SM's children and exit SM.
In all of the above commands, "key" is the printable
ascii representation of a programs key. If a command fails,
you will either be asked to enter a new command or placed in
SM's top level.
Session Manager's Int24 Handler
Whenever an Int24 occurs, SM's Int24 handler is called.
No matter what program is using the screen and no matter
which program caused the error, SM's Int24 screen is always
displayed. This screen will contain information on the type
of Int24 that happened, and the name and pid of the program
that caused the error. You will then be prompted for one of
the valid actions for this type of error. After the action
typed in has been taken, you are returned to the screen you
were using before the Int24.

View File

@ -0,0 +1,2 @@
define F7 a:\command.com a:\
define F8 a:\command.com c:\

View File

@ -0,0 +1,573 @@
; Termcap description of capabilities:
;ibmans4:mtcon:IBM PC with V4.0 ANSI driver:\
; :al=\E[L:am:bs:ce=\E[K:cl=\E[2J\E[H:cm=\E[%;%H:co#80:\
; :dl=\E[M:do=\E[B:ho=\E[H:li#24:mi:nd=\E[C:\
; :ms:pt:se=\E[m:so=\E[1;36m:up=\E[A:\
; :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:kh=\E[H:kn#8:\
; :k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:\
; :k6=\EP:k7=\EQ:k8=\ER:
CMDTABL DB 'A'
DW CUU ;CUrsor Up
DB 'B'
DW CUD ;CUrsor Down
DB 'C'
DW CUF ;CUrsor Forward
DB 'D'
DW CUB ;CUrsor Back
DB 'H'
DW CUP ;CUrsor Position
DB 'J'
DW ED ;Erase in Display
DB 'K'
DW EL ;Erase in Line
DB 'L'
DW IL ;Insert Line
DB 'M'
DW xDL ;Delete Line
;; DB 'R'
;; DW CPR ;Cursor Postion Report
DB 'f'
DW HVP ;Horizontal and Vertical Position
DB 'h'
DW SM ;Set Mode
DB 'l'
DW RM ;Reset Mode
DB 'm'
DW SGR ;Select Graphics Rendition
;; DB 'n'
;; DW DSR ;Device Status Report
DB 's'
DW SCP ;Save Cursor Position
DB 'u'
DW RCP ;Restore Cursor Position
DB 00
; Graphic Rendition modes: parameter, mask, set
GRMODE DB 00,00000000B,00000111B ; all off
DB 01,11111111B,00001000B ; bold (increased intensity)
DB 04,11111000B,00000001B ; underscore
DB 05,11111111B,10000000B ; blink
DB 07,11111000B,01110000B ; reverse video
DB 08,10001000B,00000000B ; concealed
DB 30,11111000B,00000000B ; foreground colors ...
DB 31,11111000B,00000100B
DB 32,11111000B,00000010B
DB 33,11111000B,00000110B
DB 34,11111000B,00000001B
DB 35,11111000B,00000101B
DB 36,11111000B,00000011B
DB 37,11111000B,00000111B
DB 40,10001111B,00000000B ; background colors ...
DB 41,10001111B,01000000B
DB 42,10001111B,00100000B
DB 43,10001111B,01100000B
DB 44,10001111B,00010000B
DB 45,10001111B,01010000B
DB 46,10001111B,00110000B
DB 47,10001111B,01110000B
DB 0FFH
; Set/Reset Modes: indexed by (SelChar-'<'*8) + (PARAM0 AND 7)
SRMODE DW 0,0,0,0,0,0,0,0 ; SelChar '<'
DW 1,1,1,1,1,1,1,WRAP ; SelChar '='
DW 0,EnaL25,0,0,0,0,0,0 ; SelChar '>'
DW 0,0,0,0,0,0,0,WRAP ; SelChar '?'
PAGE
; The following are duplicates of the same variables from the ROM
;
;* WARNING - the following two variables are accessed as a word
MODE DB 3
MAXCOL DB 79
IF LINE25 ; special treatment of line 25?
maxrow equ 24
ELSE
maxrow equ 25
ENDIF
;* WARNING - the following two variables are accessed as a word
COL DB 0 ; current column
ROW DB 0 ; current row
AnsiState LABEL BYTE ; the following must be saved on a screen swap
WRAP DB 1 ; 0 = NO WRAP, 1 = WRAP
EnaL25 DB 0 ; 0 = 25th line disabled, 1 = enabled
STATE DW S1
SAVCR DW 0 ; saved cursor position
;* WARNING - the following two variables are accessed as a word
SelChar DB 0 ; <,=,> or ? private use indicators
PRMCNT LABEL BYTE ; number of parameters for command
PRMCNTW DW 0
NUMPARAM equ 5 ; max. number of parameters
PARAM DB NUMPARAM DUP (?) ; buffer for command parameters
;* WARNING - the following two variables are accessed as a word
attrw LABEL WORD
ATTR DB 00000111B ;CHARACTER ATTRIBUTE
BPAGE DB 0 ;BASE PAGE
AnsiSize equ ($-AnsiState)
IF (AnsiSize GT TermSize)
.RADIX 0 ; ERROR - Terminal state not big enough
ENDIF
;-------------------------------------------------------------
;
; CHROUT - WRITE OUT CHAR IN AL USING CURRENT ATTRIBUTE
;
base dw 0b800h
screen_seg dw 00000h
chrout: cmp al,13 ; carriage return?
ja outchr
jnz trylf
mov [col],0
;; jmp short setit
jmp setit
trylf: cmp al,10 ; line feed?
jz lf
cmp al,7 ; bell?
jnz trytab
torom:
mov bx,[attrw]
and bl,7
mov ah,14
int 10h
ret5: ret
trytab:
cmp al,9 ; tab?
jnz tryback
mov al,[col]
add al,8
mov ah,al
and ah,7
sub al,ah
cmp al,[maxcol]
jb tunder
mov al,[maxcol]
tunder:
mov [col],al
jmp short setit
tryback:
cmp al,8 ; backspace?
jnz outchr
cmp [col],0
jz ret5
dec [col]
jmp short setit
outchr:
mov bx,[attrw]
mov cx,1
mov ah,9
int 10h
inc [col]
mov al,[col]
cmp al,[maxcol]
jbe setit
cmp [wrap],1
jz outchr1
dec [col]
ret
outchr1:
mov [col],0
lf: cmp [row],(maxrow-1)
ja setit ; on line 25, don't move
jz lf1 ; on 24th line, scroll
inc [row]
jmp short setit
lf1: call scroll
setit: mov dx,word ptr col
mov bh,[bpage]
mov ah,2
int 10h
ret
scroll: mov al,mode
cmp al,2
jz myscroll
cmp al,3
jz myscroll
IF LINE25
xor cx,cx ; from 0,0
mov dh,(maxrow-1) ; to maxrow-1,maxcol
mov dl,maxcol
mov bh,attr
mov ax,0601h ; scroll up one line
int 10h
ret
ELSE
mov al,10
jmp torom
ENDIF
myscroll:
mov bh,[attr]
mov bl,' '
mov bp,80
mov ax,[base]
add ax,[screen_seg]
mov es,ax
mov ds,ax
xor di,di
mov si,160
mov cx,(maxrow-1)*80
cld
; This code will never get executed since we get here when
; mode = 2 or 3 only.
;; cmp cs:[base],0b800h
;; jz colorcard
;; rep movsw
;; mov ax,bx
;; mov cx,bp
;; rep stosw
;; jmp short sret
;;colorcard:
mov dx,3dah
wait2: in al,dx
test al,8
jz wait2
mov al,25h
mov dx,3d8h
out dx,al ;turn off video
rep movsw
mov ax,bx
mov cx,bp
rep stosw
mov al,29h
mov dx,3d8h
out dx,al ;turn on video
sret: push cs
pop ds
ret
CharOut: PUSH AX ; Main entry point
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH DI
PUSH ES
PUSH BP
MOV [base],0B800H
XCHG AX,SI ; SAVE CHARACTER TO STUFF
MOV AX,40H ; POINT TO ROS BIOS
MOV DS,AX
MOV AX,DS:[49H] ; AL=MODE, AH=MAX COL
DEC AH ; ANSI NEEDS 0-79 OR 0-39
MOV WORD PTR CS:[MODE],AX ; SAVE MODE AND MAX COL
CMP AL,7
JNZ NOT_BW
MOV WORD PTR CS:[base],0B000H
NOT_BW: MOV AL,DS:[62H] ; GET ACTIVE PAGE
MOV CS:[BPAGE],AL
CBW
ADD AX,AX
MOV BX,AX
MOV AX,DS:[BX+50H] ; AL=COL, AH=ROW
MOV WORD PTR CS:[COL],AX ; SAVE ROW AND COLUMN
MOV AX,DS:[4EH] ; GET START OF SCREEN SEG
MOV CL,4
SHR AX,CL ; CONVERT TO A SEGMENT
PUSH CS
POP DS
MOV [screen_seg],AX
XCHG AX,SI ; GET BACK CHARACTER IN AL
CALL VIDEO
POP BP
POP ES
POP DI
POP SI
POP DX
POP CX
POP BX
POP AX
RET
;----------------------------------------------------------
;
; OUTPUT SINGLE CHAR IN AL TO VIDEO DEVICE
;
VIDEO: MOV SI,OFFSET STATE
JMP [SI]
S2: CMP AL,'['
JZ S22
JMP S1
S22: MOV WORD PTR [SI],OFFSET S30
XOR BX,BX
MOV WORD PTR SelChar,BX
MOV WORD PTR PARAM,BX
JMP SHORT S3B
S30: CMP AL,'?' ; experimental use selector (SM/RM)?
JA S7
mov SelChar,al
MOV WORD PTR [SI],OFFSET S3
cmp al,'<'
jae S3B
S3: CMP AL,';'
JNZ S3C
S3A: INC PRMCNT
S3B: CALL GETPTR
XOR AX,AX
MOV WORD PTR [BX],AX ;DEFAULT VALUE IS ZERO
RET
S3C: CMP AL,'0'
JB S3D
CMP AL,'9'
JA S7
CALL GETPTR
SUB AL,'0'
XCHG AL,BYTE PTR [BX]
MOV AH,10
MUL AH ;*10
ADD BYTE PTR [BX],AL ;MOVE IN DIGIT
RET
S3D:
;; CMP AL,'"' ;BEGIN QUOTED STRING
;; JZ S3E
;; CMP AL,"'"
JNZ S7
;;S3E: MOV WORD PTR [SI],OFFSET S4
;; MOV [INQ],AL
S3RET: RET
;
; ENTER QUOTED STRINGS
;
;;S4: CMP AL,[INQ] ;CHECK FOR STRING TERMINATOR
;; JNZ S4A
;; DEC PRMCNT ;TERMINATE STRING
;; MOV WORD PTR [SI],OFFSET S3
;; RET
;;S4A: CALL GETPTR
;; MOV BYTE PTR [BX],AL
;; MOV WORD PTR [SI],OFFSET S4
;; JMP S3A
;
; LOOK FOR ANSI COMMAND SPECIFIED IN AL
;
S7: MOV BX,OFFSET CMDTABL-3
;
S7A: ADD BX,3
CMP BYTE PTR [BX],0
JZ S1B
CMP BYTE PTR [BX],AL
JNZ S7A
;
S7B: MOV AX,WORD PTR [BX+1] ;AX = JUMP ADDRESS
MOV BX,OFFSET PARAM
MOV DL,BYTE PTR [BX]
XOR DH,DH ;DX = FIRST PARAMETER
MOV CX,DX
OR CX,CX
JNZ S7C
INC CX ; if DX=0, CX=1 else CX = DX
S7C: JMP AX ;AL = COMMAND
S1: CMP AL,1Bh ;ESCAPE SEQUENCE?
JNZ S1B
MOV WORD PTR [SI],OFFSET S2
RET
S1B: CALL CHROUT
S1A: MOV WORD PTR [STATE],OFFSET S1
RET
MOVCUR: CMP BYTE PTR [BX],AH
JZ SETCUR
ADD BYTE PTR [BX],AL
LOOP MOVCUR
SETCUR: MOV DX,WORD PTR COL
XOR BX,BX
MOV AH,2
int 10h ; call ROM
JMP S1A
HVP:
CUP:
IF LINE25
CMP CL,(maxrow+1)
jb cup3 ; new row is 24 or less
JA SETCUR ; error - 26 or greater
cmp EnaL25,0 ; else 25, is it allowed?
jz SETCUR
cup3:
ELSE
CMP CL,maxrow
JA SETCUR
ENDIF
MOV AL,MAXCOL
MOV CH,BYTE PTR [BX+1]
OR CH,CH
JZ CUP1
DEC CH
CUP1: CMP AL,CH
JA CUP2
MOV CH,AL
CUP2: XCHG CL,CH
DEC CH
MOV WORD PTR COL,CX
JMP SETCUR
CUF: MOV AH,MAXCOL
MOV AL,1
CUF1: MOV BX,OFFSET COL
JMP MOVCUR
CUB: MOV AX,00FFH
JMP CUF1
CUU: MOV AX,00FFH
CUU1: MOV BX,OFFSET ROW
JMP MOVCUR
CUD: MOV AX,(maxrow-1)*256+1
IF LINE25
cmp ah,[row] ; at bottom of screen?
ja SETCUR
ENDIF
JMP CUU1
SCP: MOV AX,WORD PTR COL
MOV SAVCR,AX
JMP SETCUR
RCP: MOV AX,SAVCR
IF LINE25
cmp ch,maxrow
jb rcp1
cmp EnaL25,0
jz rcp2
ENDIF
rcp1: MOV WORD PTR COL,AX
rcp2: JMP SETCUR
SGR: XOR CX,CX
XCHG CL,PRMCNT
CALL GETPTR
INC CX
SGR1: MOV AL,BYTE PTR [BX]
PUSH BX
MOV BX,OFFSET GRMODE
SGR2: MOV AH,BYTE PTR [BX]
ADD BX,3
CMP AH,0FFH
JZ SGR3
CMP AH,AL
JNZ SGR2
MOV AX,WORD PTR [BX-2]
AND ATTR,AL
OR ATTR,AH
SGR3: POP BX
INC BX
LOOP SGR1
JMP SETCUR
ED:
IF LINE25
cmp row,maxrow ; on 25th line?
je EL ; yes, treat like Erase in Line
ENDIF
xor cx,cx
mov dl,maxcol
mov dh,(maxrow-1)
cmp param,1 ; which subcommand?
ja el2 ; all
jb ed1
mov dh,row ; to beginning
dec dh
jle EL
jmp short ed2
ed1: mov ch,row ; to end
inc ch
cmp ch,dh
jae EL
ed2: mov bh,attr
MOV AX,0600H
int 10h ; call ROM
EL: MOV CX,WORD PTR COL
MOV dx,cx
mov al,param
inc al ; 0,1,2 => 1,2,3
test al,1 ; to end?
je el1
mov dl,maxcol
el1: test al,2 ; to beginning?
je el2
mov cl,0
el2: mov bh,attr
mov ax,0600H
int 10h
S1A_j: jmp S1A
IL: mov ah,7 ; scroll down
jmp short dl1
xDL: mov ah,6 ; scroll up
dl1: mov al,cl ; number of lines
mov ch,row
xor cl,cl
mov dh,(maxrow-1)
mov dl,maxcol
mov bh,attr
int 10h
jmp S1A_j
RM: XOR CL,CL
JMP SHORT SM1
SM: MOV CL,1
SM1: mov bl,SelChar ; get selection character
sub bl,'<' ; adjust
jb S1A_j ; less than '<'
cmp bl,4
jae S1A_j ; greater than '?'
xor bh,bh
shl bx,1
shl bx,1
shl bx,1
MOV AL,DL
CMP AL,7
JA S1A_j
or bl,al
shl bx,1
mov bx,SRMODE[bx] ; get function indicator
cmp bx,1 ; no or special function?
jb S1A_j
jz SM2 ; sets screen mode
MOV [bx],CL
JMP S1A_j
SM2: MOV AH,0
int 10h ; call ROM
JMP S1A_j
; GetPtr - get a pointer to the current parameter
GETPTR: MOV BX,PRMCNTW
CMP BX,NUMPARAM
JB GET1
DEC PRMCNT
JMP GETPTR
GET1: ADD BX,OFFSET PARAM
RET

View File

@ -0,0 +1,20 @@
ibmbio.obj: ibmbio.asm defdbug.inc bugcode.inc
masm ibmbio;
ibmmtcon.obj: ibmmtcon.asm ansi.inc defdbug.inc
masm ibmmtcon;
ibmdsk.obj: ibmdsk.asm defdbug.inc
masm ibmdsk;
sysini.obj: sysini.asm dossym.inc devsym.inc syscalls.inc
masm sysini;
sysimes.obj: sysimes.asm
masm sysimes;
ibmbio.exe: ibmbio.obj ibmmtcon.obj ibmdsk.obj sysini.obj sysimes.obj
link ibmbio ibmmtcon ibmdsk sysini sysimes,ibmbio,ibmbio/map;
ibmbio.com: ibmbio.exe
exe2bin ibmbio ibmbio.com

Binary file not shown.

View File

@ -0,0 +1,553 @@
;*** Bugcode.inc - Debug code for including into sysini.asm and ibmbio.asm
;
; Can't link in via buglib due to memory and relocation games played
; by these modules. Each gets a private, local-only copy of these
; modules.
IFDEF DEBUGFLG
;** DPRINTF _ Debug Printf
;
; Dprintf is a kernel debug print formatting package. It is intended
; to produce conviently formatted output.
;
; Dprintf is called, indirectly, by a macro:
;
; DEBUG n,m,"string",<a1,...,an>
;
; string = format string
; a1 = first argument
; an = last argument
;
; The format string is an ASCIZ string which can contain 2 types of
; specifications: data-format specifications and literal characters.
; Data format specifications always begin with a '$' character; all
; characters not part of a data format specification are treated as
; literal characters.
;
; Literal characters
; - any character not part of a format specification. Special
; non-printing characters are:
; \n - CRLF
; \t - tab
; \b - bell
; \\ - \
; \$ - $
;
; Format Specifications
;
; A format specification takes the form:
; $ [@] <char>
;
; where <char> =
;
; x - print argument as a hex word
; d - print argument as decimal word
; c - print argument as ascii character
; b - print argument as hex byte
; For each of the above formats, the supplied argument
; is a 16-bit word - the value to be printed. The optional @
; (described below) allows a segmented address to be supplied,
; instead.
;
; s[nn] - print argument as asciz string; if optional decimal
; argument follows the format character this specifys
; a maximum string length. Non printing characters are
; printed in the form \nnn where "nnn" is the octal byte
; value.
; Note that this format character cannot be directly
; followed by a digit unless that digit is to be taken
; as the start of a length argument.
;
; Bnn - print argument as hex bytes. The required following
; decimal argument is the number of bytes to print.
;
; Both of these formats take a long address as their argument.
; The '@' character is thus invalid for these formats.
;
; WARNINGS
; As befitting a debug routine, DPRINTF does not have a whole lot
; of "failsafe" code in it. Supplying screwed up formats can
; muck things up. Specifically:
; The @ argument must NOT be specified with the 's' or 'B'
; format
; A string/byte-length argument of 0 is taken as 65536
; The string "%% BAD FMT %%" appears in the output when
; 1) an illegal format specifier is given, or
; 2) the B format is given a 0 or missing length
;
; ENTRY (sp+n ) = address of format string (offset from return cs value)
; (sp+n-2) = first argument word
; (sp+n-4) = second argument word
; .
; (sp+4 ) = last argument word
; (sp+2 ) = seg of return address
; (sp ) = offset of return address
; (bp) = offset of format string on the stack
; EXIT none
; USES flags
PUBLIC DPRINTF
DPRINTF PROC near
push ds
push es
push bp
push di
push si
push dx
push cx
push bx
push ax ; save registers
cld
mov si,[bp] ; get address of format string
sub bp,2
mov bx,sp
mov ds,ss:20[bx] ; (ds:si) = address of format string
push cs
pop ds
; Scan format string for next character
;
; (ds:si) = address of format string
; (ss:bp) = address of next argument
dpf1: lodsb ; (al) = format string byte
and al,al
je dpf3 ; all done
cmp al,'$'
je dpf4 ; is data escape
cmp al,'\'
jnz dpf2 ; got the character
; it's an "\" escape code - crack the argument character
lodsb
and al,al
je dpf3 ; all done, ignore hanging \
xchg ah,al
mov al,0Ch
cmp ah,'n'
jne dpf1$5 ; not \n
mov al,0dH
call putchar
mov al,0aH
jmp SHORT dpf2 ; print LF
dpf1$5: cmp ah,'t'
mov al,9
je dpf2 ; is \t
cmp ah,'b'
mov al,7
je dpf2 ; is \b
xchg ah,al
dpf2: call putchar
jmp dpf1
; have the end of the format string - exit
dpf3: pop ax
pop bx
pop cx
pop dx
pop si
pop di
pop bp
pop es
pop ds
ret
;* Have a '$' character - is data format escape
;
; Get address of data into es:di
;
; (bp) = address of data value
dpf4: mov di,bp
push ss
pop es ; (es:di) = address of data value
sub bp,2 ; point to next argument
lodsb ; (al) = format specifier
cmp al,'@'
jne dpf5 ; not an indirect flag
les di,[bp]
sub bp,2 ; have an extra 2 for @
lodsb
dpf5: cmp al,'x'
jne dpfd1 ; not 'x'
; is 'x' format - print hex word
mov ax,es:[di]
call THW ; type hex word
jmp dpf1
dpfd1: cmp al,'d'
jnz dpfc1 ; not 'd'
; is 'd' format - print decimal word
mov ax,es:[di]
call TDW ; type decimal word
jmp dpf1
dpfc1: cmp al,'c'
jne dpfb1
; is 'c' format - print character
mov al,es:[di]
call putchar
jmp dpf1
dpfb1: cmp al,'b'
jne dpfs1
; is 'b' format - print hex byte
mov al,es:[di]
call THB ; type hex byte
jmp dpf1
dpfs1: cmp al,'s'
jne dpfbb1
; is 's' format - print ASCIZ string. First, check for
; optional decimal limit
public SSB
SSB: sub cx,cx ; set 65536 limit
les di,[bp] ; (es:DI) = fwa of string
sub bp,2 ; argument to 's' was two words
mov al,[si]
cmp al,'0'
jb dpfs2 ; not decimal
cmp al,'9'
ja dpfs2 ; not decimal
call atod ; (ax) = decimal value, (ds:si) updated
xchg cx,ax
; print asciz string at es:di, max of (cx) characters
; (cx) = 0 means max of 65536
;
; Other sections of code in dpf jump here to print strings
dpfs2: mov al,es:[di]
inc di
and al,al
je dpfs3
call putchar
loop dpfs2 ; continue if not at limit
dpfs3: jmp dpf1
dpfbb1: cmp al,'B'
je dpfbb2 ; is 'B' format
; error in format code - print message
dpferr: push cs
pop es
mov di,OFFSET dpfa ; (es:di) = error message
sub cx,cx
jmp dpfs2
dpfa: DB '%% BAD FMT %%',0
; have B format
dpfbb2: call atod ; (ax) = length specifier
jc dpferr ; number not there - error
xchg cx,ax
jcxz dpferr ; number is 0 - error
les di,[bp] ; (es:DI) = fwa of string
sub bp,2 ; argument to 's' was two words
dpfbb3: mov al,es:[di]
call THB ; type hex byte
mov al,' '
call putchar ; space em out
inc di
loop dpfbb3 ; do em all
jmp dpf1
DPRINTF ENDP
;** THB - Type Hex Byte
;
; THB types a hex byte (via "putchar")
;
; ENTRY (AL) = byte
; EXIT none
; USES ax, flags
THBA DB '0123456789abcdef'
PUBLIC THB
THB PROC near
push ax
shr al,1
shr al,1
shr al,1
shr al,1
and ax,0fH
xchg bx,ax
mov bl,CS:THBA[bx]
xchg ax,bx
call putchar ; put first character
pop ax
and ax,0fH
xchg bx,ax
mov bl,CS:THBA[bx]
xchg ax,bx
call putchar
ret
THB ENDP
;** THW - Type Hex Word
;
; THW types a word in hex (via "putchar")
;
; ENTRY (AX) = word
; EXIT none
; USES AX, flags
PUBLIC THW
THW PROC near
push ax
xchg ah,al
call THB
pop ax
call THB
ret
THW ENDP
;** TDW - Type Decimal Word
;
; TDW types (via "putchar") the unsigned decimal representation
; of a 16-bit unsigned integer. Only significant digits are
; printed; if the number is 0 a "0" is printed.
;
; ENTRY (AX) = number
; EXIT none
; USES AX, flags
PUBLIC TDW
TDW PROC near
push cx ; preserve registers
push dx
mov cx,10
call tdw$ ; recurse cracking digits
pop dx
pop cx
ret
TDW ENDP
;* tdw$ - crack number recursively
;
; tdw$ cracks the least significant decimal digit. If there
; are no higher-significant digits, print and return.
; else, recurse for higher digits
;
; (AX) = value
; (CX) = 10
tdw$ PROC NEAR
sub dx,dx
div cx ; (ax) = quotient, (dx) = remainder
and ax,ax
jz tdw$1 ; this is highest-order, do it
push dx
call tdw$
pop dx
tdw$1: xchg ax,dx
add al,'0'
call putchar
ret
TDW$ ENDP
;** ATOD - Convert ASCII string to decimal number
;
; ATOD is called to convert an ascii string of digits to a
; decimal number. Digits are converted until we run out of them.
;
; ENTRY (DS:SI) = address of first digit
; EXIT 'C' clear if OK
; (AX) = value
; (SI) updated to first non-digit
; 'C' set if error - no digits, or result >65535
; (DS:SI) points to error character
; USES AX, SI, FLAGS
PUBLIC ATOD
ATOD PROC near
push dx
push cx ; save registers
mov al,[si]
sub al,'0'
jc atod9 ; error - no digits
cmp al,10
cmc
jc atod9 ; error - no digits
sub ax,ax ; clear accumulator
mov cx,10 ; base 10
; crack next digit
;
; (AX) = number accumulated so near
; (CX) = 10
; (DS:SI) = next character
atod1: xchg dx,ax ; keep accum in dx for a while
lodsb ; (al) = character
sub al,'0'
jc atod7 ; not digit - all done
cmp al,9
ja atod7 ; not digit - all done
sub ah,ah ; (ax) = digit value (0 - 9)
push ax
xchg ax,dx
mul cx ; (ax) = 10*accum
pop dx ; (dx) = digit to add
jo atod8 ; overflow
add ax,dx
jmp atod1 ; go back for more
; Done with number, all OK
;
; (dx) = number
; (ds:si) = address+1 of first unused character
atod7: clc
; Done with number, error
; 'C' set
atod8: dec si ; backup over non-decimal (or error) char
atod9: pop cx
xchg ax,dx ; (ax) = number iff no error
pop dx ; restore registers
ret ; exit
ATOD ENDP
;** putchar - put a character on the console
;
; ENTRY (al) = character
; EXIT none
; USES ax,flags
UR_DAT = 02f8H ; COM1 = 03f8H, COM2 = 02f8H
UR_IEN = UR_DAT+1 ; Interrupt enable
UR_IER = UR_DAT+2 ; interrupt ID
UR_LCR = UR_DAT+3 ; line control registers
UR_MCR = UR_DAT+4 ; modem control register
UR_LSR = UR_DAT+5 ; line status register
UR_MSR = UR_DAT+6 ; modem status regiser
UR_DLL = UR_DAT ; divisor latch least sig
UR_DLM = UR_DAT+1 ; divisor latch most sig
iflag DB 0 ; != 0 when initialized 8250
;* inchr - input character
;
; EXIT 'z' set if no character
; 'z' clear if char
; (al) = char
inchr: mov dx,UR_LSR
in al,dx
and al,1
jz inchr1
mov dx,UR_DAT
in al,dx
and al,07fh
inchr1: ret
PUBLIC putchar
putchar PROC NEAR
pushf
cli
push dx
push cx
push bx
push ax ; (al) = character
test iflag,255
jnz putc1 ; is initialized
inc iflag
; program the usart
mov dx,UR_LCR
mov al,80h
out dx,al ; command it
sub al,al
mov dx,UR_DLM
out dx,al
mov dx,UR_DLL
mov al,12 ; 9600 baud = 12, 19.2 Kbaud = 6
out dx,al
mov al,3
mov dx,UR_LCR
out dx,al ; command normal mode
; see if CTL-Q or CTL-S
putc1: pushf
cli
call inchr
jz putc3 ; no characters incomming
cmp al,19 ; ctl-S?
jnz putc3 ; no, ignore
; have ctl-s. wait till we see ctl-Q
putc2: call inchr
jz putc2
cmp al,17
jnz putc2
putc3: popf
mov dx,UR_LSR
putc4: in al,dx
test al,020h
jz putc4
; ready. crank it out!
mov dx,UR_DAT
pop ax
out dx,al
pop bx
pop cx
pop dx
popf
ret
putchar ENDP
ENDIF

View File

@ -0,0 +1,122 @@
;** DEFDBUG.ASM - Debugging Macro Definitions
;
;
; DEBUG n,m,<format string>, <arg list>
;
;
.sall
DEBUG MACRO N,M,string,args
local b,c
IFDEF DEBUGFLG
pushf
DEBUGTST N,M
jz b
push ax
push bp
call c ;; push address of string
DB '&string',0
c: mov bp,sp
; IFNB <args>
IRP Y,<args>
IFIDN <Y>,<ax>
push 4[bp]
ELSE
IFIDN <Y>,<AX>
push 4[bp]
ELSE
IFIDN <Y>,<bp>
push 2[bp]
ELSE
IFIDN <Y>,<BP>
push 2[bp]
ELSE
mov ax,Y
push ax
ENDIF
ENDIF
ENDIF
ENDIF
ENDM
; ENDIF
call DPRINTF
mov sp,bp
pop ax ;; discard format string offset
pop bp
pop ax
b: popf
ENDIF
ENDM
;** ERRNZ - generate assembly error if arg != 0
;
ERRNZ MACRO EXPR
IF1
IFE expr
ELSE
RADIX 0 ; CONDITION NOT MET - ERROR
ENDIF
ENDIF
ENDM
;** DBBEG - Start debugging range
;
DBBEG MACRO N,M
LOCAL lab
IFDEF DEBUGFLG
pushf
DEBUGTST N,M
jnz lab ;; am to do it
DBJMP %DBCNT
lab:
ENDM
DBJMP MACRO N
jmp DBLAB&N
ENDM
;** DEBUGTST - Test Debug Flags
;
; DEBUGTST n,m
;
; Where N and M are bit masks.
;
; If one or more of the bits in N is set in the high byte
; of BUGBITS, and one or more of the bits in M is set in
; the low byte of BUGBITS then clear the Z flag.
;
; In other words:
;
; If both masks show a "hit" clear 'Z' else set 'Z'
;
; USES FLAGS
DEBUGTST MACRO N,M
LOCAL A
test BYTE PTR BUGBITS,n
jz A
test BYTE PTR BUGBITS+1,m
A:
ENDM
DBEND MACRO
DBLAB %DBCNT
DBCNT = DBCNT+1
popf
ENDM
DBLAB MACRO N
DBLAB&N:
ENDM
DBCNT = 1

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,25 @@
29 May 1984
The object files given here are sufficient to create the BIOS
for the IBM system. Some sources are given as examples for
OEM supplied device drivers. These sources do not necessarily
implement all the features described in the device driver
documentation. They have evolved in parallel with the
documentation, so some features described in the documentation
may not yet be present in the drivers. Below is a summary of
the files supplied:
read_me This file.
ibmbio.asm Main body of the BIOS.
ibmdsk.asm Floppy and Hard disk drivers.
ibmmtcon.asm Multi-screen console driver.
ansi.inc ANSI X3.64 terminal emulation.
bugcode.inc Module which implements debugging
prints. The routine PUTC must be
modified for other devices. See
also the file DEFDBUG.INC.
sys*.obj The SYSINIT program. No source supplied.
biosobj.mak Contains instructions for building the
IBM BIOS.
bootpach.exe Modifies a V2.0 boot sector (on A:) for
the IBM to accomodate the larger BIOS.

Binary file not shown.

Binary file not shown.

BIN
v4.0-ozzie/bin/DRDOS1.IMD Normal file

Binary file not shown.

Binary file not shown.

BIN
v4.0-ozzie/bin/DRDOS2.IMD Normal file

Binary file not shown.

Binary file not shown.

21
v4.0/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) IBM and Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

103
v4.0/src/BIOS/BIOSTRUC.INC Normal file
View File

@ -0,0 +1,103 @@
%OUT BIOSTRUC.INC...
; SCCSID = @(#)BIOSTRUC.INC 1.0 86/09/30
; ROM BIOS CALL PACKET STRUCTURES
;*******************************
;System Service call ( Int 15h )
;*******************************
;Function AH = 0C0h, Return system configuration
;For PC and PCJR on return:
; (AH) = 80h
; (CY) = 1
;For PCXT, PC PORTABLE and PCAT on return:
; (AH) = 86h
; (CY) = 1
;For all others:
; (AH) = 0
; (CY) = 0
; (ES:BX) = pointer to system descriptor vector in ROS
; System descriptor :
; DW xxxx length of descriptor in bytes,
; minimum length = 8
; DB xx model byte
; 0FFh = PC
; 0FEh = PC/XT, Portable
; 0FDh = PC/JR
; 0FCh = PC/AT, 6Mhz PC/AT,
; 6Mhz PC/AT running coprocessor(?),
; PS/2 Model 50, 50 z
; 0FAh = PS/2 Model 25, 30
; 0F9h = PC Convertible
; 0F8h = PS/2 Model 80
; 0F7h = Nova
; 0E0 thru 0EFh = reserved
;
; DB xx secondary model byte
; 000h = PC1
; 000h = PC/XT, Portable
; 000h = PC/JR
; 000h = PC/AT
; 001h = 6Mhz PC/AT
; 003h = 6Mhz PC/AT running coprocessor(?)
; 004h = PS/2 Model 50, 50z
; 001h = PS/2 Model 25
; 000h = PC Convertible
; 000h = PS/2 Model 80
; 000h = Nova
;
; DB xx bios revision level
; 00 for first release, subsequent release
; of code with same model byte and
; secondary model byte require revison level
; to increase by one.
;
; DB xx feature information byte 1
; X0000000 = 1, bios use DMA channel 3
; = 0, DMA channel 3 not used
;
; 0X000000 = 1, 2nd Interrupt chip present
; = 0, 2nd Interrupt chip not present
;
; 00X00000 = 1, Real Time Clock present
; = 0, Real Time Clock not present
;
; 000X0000 = 1, Keyboard escape sequence(INT15h)
; called in keyboard interrupt
; (Int 09h).
; = 0, Keyboard escape sequence not
; called.
; 0000XXXX reserved
;
; DB xx feature information byte 2 - reserved
;
; DB xx feature information byte 2 - reserved
;
; DB xx feature information byte 2 - reserved
;
; DB xx feature information byte 2 - reserved
;
BIOS_SYSTEM_DESCRIPTOR struc
bios_SD_leng dw ?
bios_SD_modelbyte db ?
bios_SD_scnd_modelbyte db ?
db ?
bios_SD_featurebyte1 db ?
db 4 dup (?)
BIOS_SYSTEM_DESCRIPTOR ends
;FeatureByte1 bit map equates
DMAchannel3 equ 10000000b
ScndIntController equ 01000000b
RealTimeClock equ 00100000b
KeyEscapeSeq equ 00010000b
;
;Model Byte
MDL_PC1 EQU 0FFH
MDL_XT EQU 0FEH
MDL_JR EQU 0FDH
MDL_AT EQU 0FCH
MDL_CONVERT EQU 0F9H
mdl_ps2_30 equ 0fah
mdl_ps2_80 equ 0f8h

View File

@ -0,0 +1,78 @@
;
; date_verify loosely checks bcd date values to be in range in bin_date_time
;
date_verify: ;
assume ds:code,es:nothing
cmp byte ptr bin_date_time+0,20h ; century check
ja date_error ; jmp error
jz century_20 ; jmp in 20th century
cmp byte ptr bin_date_time+0,19h ; century check
jb date_error ; jmp error
cmp byte ptr bin_date_time+1,80h ; year check
jb date_error ; jmp error
century_20: ;
cmp byte ptr bin_date_time+1,99h ; year check
ja date_error ; jmp error
cmp byte ptr bin_date_time+2,12h ; month check
ja date_error ; jmp error
cmp byte ptr bin_date_time+2,00h ; month check
jbe date_error ; jmp error
cmp byte ptr bin_date_time+3,31h ; day check
ja date_error ; jmp error
cmp byte ptr bin_date_time+3,00h ; day check
jbe date_error ; jmp error
clc ; set success flag
ret ;
date_error: ;
stc ; set error flag
ret ;
;
; time_verify very loosely checks bcd date values to be in range in bin_date_time
;
time_verify:
assume ds:code,es:nothing
cmp byte ptr bin_date_time+0,24H
ja time_error
cmp byte ptr bin_date_time+1,59H
ja time_error
cmp byte ptr bin_date_time+2,59H
ja time_error
clc
ret
time_error:
stc
ret
;
; bcd_verify checks values in bin_date_time to be valid
; bcd numerals. carry set if any nibble out of range
;
bcd_verify: ;
assume ds:code,es:nothing
mov cx,4 ; 4 bytes to check
mov bx,offset bin_date_time ;
bv_loop: ;
mov al,[bx] ; get a bcd number (0..99)
mov ah,al ;
and ax,0f00fh ; 10's place in high ah, 1's in al
cmp al,10 ; is 1's place in range?
ja bv_error ; jmp out of range
shr ah,1 ; swap nibbles
shr ah,1 ; ...
shr ah,1 ; ...
shr ah,1 ; ...
and ah,0fh ; get rid of any erroneous bits
cmp ah,10 ; is 10's place in range
ja bv_error ; jmp out of range
inc bx ; next byte
dec cx ;
jnz bv_loop ;
clc ; set success flag
ret ;
bv_error: ;
stc ; set error flag
ret ;
;
; Dos 3.30 - The real time clock structures were moved to msbio2.asm
;

50
v4.0/src/BIOS/CMOSEQU.INC Normal file
View File

@ -0,0 +1,50 @@
;;Rev 3.30 Modification
;Equates for CMOS.
;----------------------------------------
; CMOS EQUATES FOR THIS SYSTEM :
;-------------------------------------------------------------------------------
CMOS_PORT EQU 070H ; I/O ADDRESS OF CMOS ADDRESS PORT
CMOS_DATA EQU 071H ; I/O ADDRESS OF CMOS DATA PORT
NMI EQU 10000000B ; DISABLE NMI INTERRUPTS MASK -
; HIGH BIT OF CMOS LOCATION ADDRESS
;---------- CMOS TABLE LOCATION ADDRESS'S ## -----------------------------------
CMOS_SECONDS EQU 000H ; SECONDS
CMOS_SEC_ALARM EQU 001H ; SECONDS ALARM ## NOTE: ALL LOCATIONS
CMOS_MINUTES EQU 002H ; MINUTES | IN THE CMOS AREA
CMOS_MIN_ALARM EQU 003H ; MINUTES ALARM | ARE IBM USE ONLY
CMOS_HOURS EQU 004H ; HOURS | AND SUBJECT TO
CMOS_HR_ALARM EQU 005H ; HOURS ALARM | CHANGE. ONLY THE
CMOS_DAY_WEEK EQU 006H ; DAY OF THE WEEK | POST & BIOS CODE
CMOS_DAY_MONTH EQU 007H ; DAY OF THE MONTH | SHOULD DIRECTLY
CMOS_MONTH EQU 008H ; MONTH | ACCESS LOCATIONS
CMOS_YEAR EQU 009H ; YEAR (TWO DIGITS) | IN CMOS STORAGE.
CMOS_REG_A EQU 00AH ; STATUS REGISTER A '-----------------
CMOS_REG_B EQU 00BH ; STATUS REGISTER B ALARM
CMOS_REG_C EQU 00CH ; STATUS REGISTER C FLAGS
CMOS_REG_D EQU 00DH ; STATUS REGISTER D BATTERY
CMOS_DIAG EQU 00EH ; POST DIAGNOSTIC STATUS RESULTS BYTE
CMOS_SHUT_DOWN EQU 00FH ; SHUTDOWN STATUS COMMAND BYTE
CMOS_DISKETTE EQU 010H ; DISKETTE DRIVE TYPE BYTE ;
; EQU 011H ; - RESERVED ;C
CMOS_DISK EQU 012H ; FIXED DISK TYPE BYTE ;H
; EQU 013H ; - RESERVED ;E
CMOS_EQUIP EQU 014H ; EQUIPMENT WORD LOW BYTE ;C
CMOS_B_M_S_LO EQU 015H ; BASE MEMORY SIZE - LOW BYTE (X1024) ;K
CMOS_B_M_S_HI EQU 016H ; BASE MEMORY SIZE - HIGH BYTE ;S
CMOS_E_M_S_LO EQU 017H ; EXPANSION MEMORY SIZE - LOW BYTE ;U
CMOS_E_M_S_HI EQU 018H ; EXPANSION MEMORY SIZE - HIGH BYTE ;M
CMOS_DISK_1 EQU 019H ; FIXED DISK TYPE - DRIVE C EXTENSION ;E
CMOS_DISK_2 EQU 01AH ; FIXED DISK TYPE - DRIVE D EXTENSION ;D
; EQU 01BH ; - 1BH THROUGH 2DH - RESERVED ;
CMOS_CKSUM_HI EQU 02EH ; CMOS CHECKSUM - HIGH BYTE ;*
CMOS_CKSUM_LO EQU 02FH ; CMOS CHECKSUM - LOW BYTE ;*
CMOS_U_M_S_LO EQU 030H ; USABLE MEMORY ABOVE 1 MEG - LOW BYTE
CMOS_U_M_S_HI EQU 031H ; USABLE MEMORY ABOVE 1 MEG - HIGH BYTE
CMOS_CENTURY EQU 032H ; DATE CENTURY BYTE (BCD)
CMOS_INFO128 EQU 033H ; 128KB INFORMATION STATUS FLAG BYTE
; EQU 034H ; - 34H THROUGH 3FH - RESERVED
;
;;End of Modification


33
v4.0/src/BIOS/DEFEMS.INC Normal file
View File

@ -0,0 +1,33 @@
;J.K. This is a temporary version of EMS function definitions needed for
;IBMBIO SYSINIT.
EMS_INT equ 67h ;interrupt vector designated for EMS.
EMS_STATUS equ 40h ;status of memery manager
EQ_PAGES equ 42h ;get number of unallocated & total pages
E_GET_HANDLE equ 43h ;allocate pages
EMAP_L_TO_P equ 44h ;Map logical to physical page
EMAP_STATE equ 4Fh ;Mapping status
GET_MAP_STATE equ 00h
GET_MAP_SIZE equ 02h
SET_MAP_STATE equ 01h
EDE_ALLOCATE equ 45h ;deallocate pages
EMS_VERSION equ 46h ;Get EMM version number
GET_PAGE_FRAME equ 58h ;Get page frame address
GET_PAGEFRAME_TAB equ 00H
GET_NUM_PAGEFRAME equ 01H
EMS_HANDLE_NAME equ 53h
SET_HANDLE_NAME equ 01h
IBM_PAGE_ID equ 255 ;Physical page id that will be used by
;IBMBIO and IBMDOS for buffer manipulation.
;MAX_NUM_PAGEFRAME equ 12 ;maximum number of page frames IBMBIO can
;handle
MAX_NUM_PAGEFRAME equ 64 ;maximum number of page frames MSBIO can
;handle
EMSVERSION equ 40h ;4.0


23
v4.0/src/BIOS/DEVMARK.INC Normal file
View File

@ -0,0 +1,23 @@
;Structure, Equtes for DEVMARK for MEM command.
DEVMARK struc
DEVMARK_ID db 0
DEVMARK_SEG dw 0
DEVMARK_SIZE dw 0
DEVMARK_DUM db 3 dup (?)
DEVMARK_FILENAME db 8 dup (' ')
DEVMARK ends
DEVMARK_STK equ 'S'
DEVMARK_DEVICE equ 'D'
DEVMARK_IFS equ 'I'
DEVMARK_BUF equ 'B'
DEVMARK_CDS equ 'L' ;lastdrive
DEVMARK_FILES equ 'F'
DEVMARK_FCBS equ 'X'
DEVMARK_INST equ 'T' ;used for SYSINIT BASE for INSTALL= command.
DEVMARK_EMS_STUB equ 'E'
SETBRKDONE equ 00000001b
FOR_DEVMARK equ 00000010b
NOT_FOR_DEVMARK equ 11111101b

31
v4.0/src/BIOS/JUMPMAC.INC Normal file
View File

@ -0,0 +1,31 @@
;;Rev 3.30 Modification
;
; given a label <lbl> either 2 byte jump to another label <lbl>_J
; if it is near enough or 3 byte jump to <lbl>
;
jump macro lbl
local a
.xcref
ifndef lbl&_j ;; is this the first invocation
a:
JMP lbl
ELSE
IF (lbl&_J GE $) OR ($-lbl&_J GT 126)
a:
JMP lbl ;; is the jump too far away?
ELSE
a:
JMP lbl&_J ;; do the short one...
ENDIF
ENDIF
lbl&_j = a
.cref
endm
.xcref jump
;REDEFINE THE ABOVE MACRO TO ALWAYS TRY A 3 BYTE NEAR JUMP
JUMP MACRO LBL
JMP LBL
ENDM ;;End of Modification


1
v4.0/src/BIOS/LOCSCR Normal file
View File

@ -0,0 +1 @@
70

167
v4.0/src/BIOS/MAKEFILE Normal file
View File

@ -0,0 +1,167 @@
#************************** makefile for bios ***************************
dest =io
msg =..\messages
dos =..\dos
inc =..\inc
hinc =..\h
#
####################### dependencies begin here. #########################
#
all: $(dest).sys
msbio.cl1: msbio.skl \
$(msg)\$(COUNTRY).msg
msload.obj: msload.asm \
makefile \
msbio.cl1 \
$(inc)\bootform.inc \
$(inc)\versiona.inc \
msload.inc
msload.com: msload.obj
link msload.obj,msload,,;
exe2bin msload.exe msload.com
msbio1.obj: msbio1.asm \
makefile \
msbdata.inc \
msgroup.inc \
jumpmac.inc \
pushpop.inc \
$(inc)\devsym.inc \
msdskpr.inc \
msmacro.inc
mscon.obj: mscon.asm \
makefile \
msgroup.inc \
jumpmac.inc \
msmacro.inc
msaux.obj: msaux.asm \
makefile \
msgroup.inc \
jumpmac.inc \
msmacro.inc
mslpt.obj: mslpt.asm \
makefile \
msgroup.inc \
msequ.inc \
$(inc)\msbds.inc \
msmacro.inc \
$(inc)\devsym.inc \
$(inc)\ioctl.inc $(inc)\bpb.inc
msclock.obj: msclock.asm \
makefile \
msgroup.inc \
msmacro.inc
msdisk.obj: msdisk.asm \
makefile \
msgroup.inc \
msequ.inc \
$(inc)\msbds.inc \
pushpop.inc \
msmacro.inc \
$(inc)\devsym.inc \
msdskpr.inc \
msioctl.inc $(inc)\ioctl.inc $(inc)\bpb.inc
msinit.obj: msinit.asm \
makefile \
msgroup.inc \
msdskpr.inc \
msequ.inc $(inc)\msbds.inc \
$(inc)\cputype.inc \
msmacro.inc \
readcloc.inc \
clocksub.inc \
msextrn.inc
sysinit1.obj: sysinit1.asm \
makefile \
msstack.inc \
msbio.cl4 \
msbio.cl5 \
stkinit.inc \
devmark.inc \
$(inc)\smifssym.inc \
$(inc)\devsym.inc \
$(inc)\ioctl.inc \
$(inc)\cputype.inc \
$(inc)\smdossym.inc $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\buffer.inc \
$(inc)\sysvar.inc $(inc)\vector.inc $(inc)\dirent.inc \
$(inc)\dpb.inc $(inc)\curdir.inc \
$(inc)\pdb.inc $(inc)\exe.inc $(inc)\sf.inc $(inc)\arena.inc \
$(inc)\intnat.inc $(inc)\mi.inc \
$(inc)\syscall.inc
sysconf.obj: sysconf.asm \
makefile \
psoption.inc \
devmark.inc \
$(inc)\psdata.inc \
$(inc)\parse.asm \
$(inc)\smifssym.inc \
$(inc)\devsym.inc \
$(inc)\ioctl.inc \
$(inc)\smdossym.inc $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\buffer.inc \
$(inc)\sysvar.inc $(inc)\vector.inc $(inc)\dirent.inc \
$(inc)\dpb.inc $(inc)\curdir.inc \
$(inc)\pdb.inc $(inc)\exe.inc $(inc)\sf.inc $(inc)\arena.inc \
$(inc)\intnat.inc $(inc)\mi.inc \
$(inc)\syscall.inc
sysinit2.obj: sysinit2.asm \
makefile \
devmark.inc \
$(inc)\copyrigh.inc \
$(inc)\smifssym.inc \
$(inc)\devsym.inc \
$(inc)\ioctl.inc \
$(inc)\smdossym.inc $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\buffer.inc \
$(inc)\sysvar.inc $(inc)\vector.inc $(inc)\dirent.inc \
$(inc)\dpb.inc $(inc)\curdir.inc \
$(inc)\pdb.inc $(inc)\exe.inc $(inc)\sf.inc $(inc)\arena.inc \
$(inc)\intnat.inc $(inc)\mi.inc \
$(inc)\syscall.inc
sysimes.obj: sysimes.asm \
makefile \
msmacro.inc \
msbio.cl3 \
msequ.inc $(inc)\msbds.inc
msbio2.obj: msbio2.asm \
makefile \
msgroup.inc \
msequ.inc \
$(inc)\msbds.inc \
$(inc)\devsym.inc \
pushpop.inc \
msmacro.inc \
msbio.cl2 \
ms96tpi.inc msvolid.inc
mshard.obj: mshard.asm $(inc)\postequ.inc $(inc)\dseg.inc
$(dest).sys: msbio.cl1 msbio1.obj mscon.obj msaux.obj \
mslpt.obj msclock.obj msdisk.obj msbio2.obj \
msinit.obj mshard.obj sysinit1.obj sysconf.obj \
sysinit2.obj sysimes.obj \
msload.com \
makefile
link @msbio.lnk
exe2bin msbio.exe msbio.bin <locscr
copy /b msload.com+msbio.bin $(dest).sys
del msbio.bin
del msbio.exe

536
v4.0/src/BIOS/MS96TPI.INC Normal file
View File

@ -0,0 +1,536 @@
%OUT MS96TPI.INC...
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.00 - J.K.
;AC000 - Changed for DOS Version 4.00 - J.K.
;AN00x - PTM number for DOS Version 4.00 - J.K.
;==============================================================================
;AN001 - p2781 Changeline error behavior incompatibile with DOS 3.3 1/06/88 J.K.
;==============================================================================
;
; DISK OPEN/CLOSE ROUTINES ARR 2.41
;
DSK$OPEN: ;ARR 2.41
PUBLIC DSK$OPEN
MESSAGE FTESTDISK,<"DISK OPEN ">
MNUM FTESTDISK,AX
MESSAGE FTESTDISK,<CR,LF>
; AL IS LOGICAL DRIVE
CALL SETDRIVE ;GET BDS FOR DRIVE
INC WORD PTR DS:[DI].OPCNT
JMP EXIT ;ARR 2.41
DSK$CLOSE: ;ARR 2.41
PUBLIC DSK$CLOSE
MESSAGE FTESTDISK,<"DISK CLOSE ">
MNUM FTESTDISK,AX
MESSAGE FTESTDISK,<CR,LF>
; AL IS LOGICAL DRIVE
CALL SETDRIVE ;GET BDS FOR DRIVE
CMP WORD PTR DS:[DI].OPCNT,0
JZ EXITJX ; WATCH OUT FOR WRAP ARR 2.41
DEC WORD PTR DS:[DI].OPCNT
EXITJX:
JMP EXIT
; INPUT : DS:DI POINTS TO CURRENT BDS FOR DRIVE.
; RETURN : ZERO SET IF NO OPEN FILES
; ZERO RESET IF OPEN FILES
CHKOPCNT:
MESSAGE FTEST96,<"CHECK OPEN COUNT ">
MNUM FTEST96,AX
MESSAGE FTEST96,<CR,LF>
CMP WORD PTR DS:[DI].OPCNT,0
RET
;
; AT MEDIA CHECK TIME, WE NEED TO REALLY GET DOWN AND CHECK WHAT THE CHANGE IS.
; THIS IS GUARANTEED TO BE EXPENSIVE.
;
PUBLIC MEDIACHECK
MEDIACHECK:
CALL CHECKSINGLE ; MAKE SURE CORRECT DISK IS IN PLACE
XOR SI,SI
CALL HASCHANGE
JZ MEDIARET
CALL CHECKROMCHANGE
JNZ MEDIADOVOLID
PUSH AX
PUSH DX
;SB33001****************************************************************
mov DL, DS:[DI.drivenum] ;SB ; set logical drive number ;3.30*
mov AH, 16h ;SB ; get changeline status ;3.30*
int 13h ;SB ; call rom diskette routine ;3.30*
;SB33001****************************************************************
POP DX
POP AX
JC MEDIADOVOLID
MOV SI,1 ; SIGNAL NO CHANGE
; THERE ARE SOME DRIVES WITH CHANGELINE THAT "LOSE" THE CHANGELINE INDICATION
; IF A DIFFERENT DRIVE IS ACCESSED AFTER THE CURRENT ONE. IN ORDER TO AVOID
; MISSING A MEDIA CHANGE, WE RETURN AN "I DON'T KNOW" TO DOS IF THE CHANGELINE
; IS NOT ACTIVE AND WE ARE ACCESSING A DIFFERENT DRIVE FROM THE LAST ONE.
; IF WE ARE ACCESSING THE SAME DRIVE, THEN WE CAN SAFELY RELY ON THE CHANGELINE
; STATUS.
PUBLIC LOSECHNG
LOSECHNG:
MOV BL,CS:[TIM_DRV] ; GET LAST DRIVE ACCESSED
CMP BYTE PTR [DI].DRIVENUM,BL
JZ MEDIARET
; DO THE 2 SECOND TWIDDLE. IF TIME >= 2 SECONDS, DO A VOLID CHECK.
; OTHERWISE RETURN "I DON'T KNOW" (STRICTLY SPEAKING, WE SHOULD RETURN A
; "NOT CHANGED" HERE SINCE THE 2 SECOND TEST SAID NO CHANGE.) - RS.
SAVEREG <AX,CX,DX>
CALL CHECK_TIME_OF_ACCESS
RESTOREREG <DX,CX,AX>
OR SI,SI
JZ MEDIADOVOLID ; CHECK_TIME SAYS ">= 2 SECS PASSED"
XOR SI,SI ; RETURN "I DON'T KNOW"
PUBLIC MEDIARET
MEDIARET:
RET
;
; SOMEHOW THE MEDIA WAS CHANGED. LOOK AT VID TO SEE. WE DO NOT LOOK AT FAT
; BECAUSE THIS MAY BE DIFFERENT SINCE WE ONLY SET MEDBYT WHEN DOING A READ
; OR WRITE.
;
MEDIADOVOLID:
CALL GETBP ; BUILD A NEW BPB IN CURRENT BDS
JC MEDIARET
CALL CHECK_VID
JNC MEDIARET
CALL MAPERROR ; FIX UP AL FOR RETURN TO DOS
RET
;
; SIMPLE, QUICK CHECK OF LATCHED CHANGE. IF NO INDICATION, THEN RETURN
; OTHERWISE DO EXPENSIVE CHECK. IF THE EXPENSIVE TEST FAILS, POP OFF THE
; RETURN AND SET AL = 15 (FOR INVALID MEDIA CHANGE) WHICH WILL BE RETURNED TO
; DOS.
;J.K. 9/16/86 For DOS 3.3, this will work only for the drive that has
;J.K. 9/16/86 changeline.
PUBLIC CHECKLATCHIO
CHECKLATCHIO:
; IF RETURNING FAKE BPB THEN ASSUME THE DISK HAS NOT CHANGED
; TEST WORD PTR DS:[DI].FLAGS, RETURN_FAKE_BPB
; JNZ CHECKRET
;J.K. 9/16/86
; call HasChange ;change line supported?
; jz CheckRet ;No. Just return
CALL CHKOPCNT
JNZ CHECKROM
CHECKRET:
RET
;
; CHECK FOR PAST ROM INDICATIONS. IF NO ROM CHANGE INDICATED, THEN RETURN OK.
;
PUBLIC CHECKROM
CHECKROM:
CALL CHECKROMCHANGE
JZ CHECKRET ; NO CHANGE
;
; WE NOW SEE THAT A CHANGE LINE HAS BEEN SEEN IN THE PAST. LET'S DO THE
; EXPENSIVE VERIFICATION.
;
MESSAGE FTEST96,<"CHECKROMCHANGE SAYS YES...",CR,LF>
CALL GETBP ; BUILD BPB IN CURRENT BDS
JC RET_NO_ERROR_MAP ; GETBP HAS ALREADY CALLED MAPERROR
CALL CHECK_VID
JC CHECKLATCHRET ; DISK ERROR TRYING TO READ IN.
OR SI,SI ; IS CHANGED FOR SURE?
JNS CHECKRET
CALL RETURNVID
CHECKLATCHRET:
CALL MAPERROR ; FIX UP AL FOR RETURN TO DOS
RET_NO_ERROR_MAP:
STC
POP SI ; POP OFF RETURN ADDRESS
RET
;
; CHECK THE FAT AND THE VID. RETURN IN DI -1 OR 0. RETURN WITH CARRY SET
; ONLY IF THERE WAS A DISK ERROR. RETURN THAT ERROR CODE IN AX.
;
PUBLIC CHECKFATVID
CHECKFATVID:
MESSAGE FTEST96,<"CHECK FAT",CR,LF>
CALL FAT_CHECK
OR SI,SI
JS CHANGED_DRV
;
; THE FAT WAS THE SAME. HOW ABOUT THE VOLUME ID?
;
CHECK_VID:
;J.K. Now with the extended BOOT record, the logic should be enhanced.
;If it is the extended BOOT record, then we check the volume serial
;number instead of volume id. If it is different, then set SI to -1.
;If it is same, then SI= 1 (No change).
;If it is not the extended BOOT record, then just follows the old
;logic. DOS 4.00 will check if the # of FAT in the boot record BPB
;is not 0. If it is 0 then it must be Non_FAT based system and
;should have already covered by extended boot structure checking.
;So, we will return "I don't know" by setting SI to 0.
;This routine assume the newest valid boot record is in CS:[DISKSECTOR].
;(This will be gauranteed by a successful GETBP call right before this
;routine.)
MESSAGE FTEST96,<"CHECK VID",CR,LF>
;SB34MS96TPI001*********************************************************
;SB check the EXT_Boot_Sig variable for the Extended boot signature
;SB if it is set then go to do the extended ID check otherwise continue
;SB with code below
;SB 2 LOCS
cmp cs:[Ext_Boot_Sig],Ext_Boot_Signature
jz Do_Ext_Check_Id
;SB34MS96TPI001*********************************************************
call HasChange ;AN000;
jz CheckRet ;AN000;
xor si,si ;AN000; assume I don't know.
cmp byte ptr cs:[SECPERCLUSINSECTOR]+3,0 ;AN000; Don't read vol id from
je CHECKFATRET ;AN000; the directory if not FAT system
CALL READ_VOLUME_ID
JC CHECKFATRET
CALL CHECK_VOLUME_ID
OR SI,SI
JNZ CHANGED_DRV
MESSAGE FTEST96,<"VID NOT CHANGED",CR,LF>
VID_NO_Changed:
CALL RESETCHANGED
clc ;AN000;
CHECKFATRET:
RET
CHANGED_DRV:
MOV CS:[TIM_DRV],-1 ; ENSURE THAT WE ASK ROM FOR MEDIA
RET ; CHECK NEXT TIME ROUND
;
; extended ID check
;
Do_Ext_Check_ID: ;AN000;
push ax ;AN000;
;SB34MS96TPI002**************************************************************
;SB The code to check extended ID is basically a check to see if the
;Sb volume serial number is still the same. The volume serial number
;SB previously read is in cs:[Boot_Serial_H] and cs:[Boot_Serial_L]
;SB high and low words respectively. DS:DI points to the BDS of the
;SB drive under consideration. The BDS has fields containing the
;SB high and low words of the volume serial number of the media in the
;SB drive. Compare these fields to the fields mentioned above. If these
;SB fields do not match the media has changed and so we should jump
;SB to the code starting at Ext_Changed else return "I don't know" status
;SB in the register used for the changeline status and continue executing
;SB the code given below. For temporary storage use the register which
;SB has been saved and restored around this block.
;SB 7 LOCS
;SB BDS fields in inc\msbds.inc
mov ax,cs:[Boot_Serial_L]
cmp ax,word ptr ds:[di+VOL_SERIAL]
jnz Ext_Changed
mov ax,cs:[Boot_Serial_H]
cmp ax,word ptr ds:[di+VOL_SERIAL+2]
jnz Ext_Changed
xor si,si ; don't know
;SB34MS96TPI002**************************************************************
pop ax ;AN000;
; jmp CheckFatRet ;AN000;
jmp VID_NO_Changed ;AN001;Reset the flag
Ext_Changed: ;AN000; Serial number is different!
pop ax ;AN000;
mov si, -1 ;AN000; disk changed!
clc ;AN000; clear carry. Only SI is meaningful here.
jmp Changed_Drv ;AN000;
;
; AT I/O TIME, WE DETECTED THE ERROR. NOW WE NEED TO DETERMINE WHETHER THE
; MEDIA WAS TRULY CHANGED OR NOT. WE RETURN NORMALLY IF MEDIA CHANGE UNKNOWN.
; AND WE POP OFF THE CALL AND JMP TO HARDERR IF WE SEE AN ERROR.
;
PUBLIC CHECKIO
CHECKIO:
CMP AH,06
JNZ CHECKFATRET
CALL CHKOPCNT
JZ CHECKFATRET ; NO OPEN FILES
; IF RETURNING FAKE BPB THEN IGNORE DISK CHANGES
; TEST WORD PTR DS:[DI].FLAGS, RETURN_FAKE_BPB
; JNZ IGNORECHANGE
CALL GETBP ; BUILD UP A NEW BPB IN CURRENT BDS
JC NO_ERROR_MAP ; GETBP HAS ALREADY CALLED MAPERROR
CALL CHECKFATVID
JC CHECKIORET ; DISK ERROR TRYING TO READ IN.
OR SI,SI ; IS CHANGED FOR SURE?
JS CHECKIOERR ; YES CHANGED
IGNORECHANGE:
INC BP ; ALLOW A RETRY
RET
CHECKIOERR:
CALL RETURNVID
CHECKIORET:
; POP SI ; POP OFF RETURN
STC ; MAKE SURE CARRY GETS PASSED THROUGH
JMP HARDERR
NO_ERROR_MAP:
JMP HARDERR2
;
; RETURN VID SETS UP THE VID FOR A RETURN TO DOS.
;
PUBLIC RETURNVID
RETURNVID:
MESSAGE FTEST96,<"RETURN VID",CR,LF>
PUSH DS ; SAVE POINTER TO CURRENT BDS
PUSH DI
PUSH CX
CALL INIT_VID_LOOP ; SETS ES:DI -> VID
LDS BX,CS:[PTRSAV]
MOV [BX.EXTRA],DI
MOV [BX.EXTRA+2],ES
POP CX
POP DI ; RESTORE CURRENT BDS
POP DS
MOV AH,6 ; INVALID MEDIA CHANGE
STC
RET
;
; MUNGE THE TIME OF LAST SUCCESSFUL ACCESS FOR TWEEKED DRIVES
;
; DON'T NEED ANY MORE
; TWEEKCHECK:
; PUSH AX
; MOV AX,WORD PTR DS:[DI].FLAGS
; TEST AL,FCHANGED_BY_FORMAT
; JZ TWEEKDONE
; MOV CS:[TIM_DRV],-1
; TWEEKDONE:
; POP AX
; RET
;
; DRIVE IS THE LOGICAL DRIVE TO USE
;
; FORMAT_MEDIA_CHECK: ;ARR 2.42
; PUSH AX
; MOV AX,WORD PTR DS:[DI].FLAGS
; TEST AL,FCHANGED_BY_FORMAT
; JZ RETF1 ; MEDIA NOT CHANGED VIA FORMAT
; AND AL,NOT FCHANGED_BY_FORMAT
; MOV WORD PTR [DI].FLAGS,AX ; RESET CHANGED_BY_FORMAT BIT
; MOV SI,-1 ; MEDIA CHANGED VIA FORMAT
; RETF1:
; POP AX
; RET
;
; MOVES THE POINTER TO THE VOLID FOR THE DRIVE INTO THE ORIGINAL REQUEST PACKET
; ON ENTRY, DS:BX POINTS TO THE ORIGINAL PACKET.
; NO ATTEMPT IS MADE TO PRESERVE REGISTERS.
;
MEDIA_SET_VID: ; ARR 2.42
PUBLIC MEDIA_SET_VID
CALL INIT_VID_LOOP ; SETS ES:DI -> VID
LDS BX,CS:[PTRSAV] ; GET POINTER TO PACKET
MOV WORD PTR [BX.TRANS+1],DI
MOV WORD PTR [BX.TRANS+3],ES
RET
;
; HIDENSITY - EXAMINE A DRIVE/MEDIA DESCRIPTOR TO SET THE MEDIA TYPE. IF
; THE MEDIA DESCRIPTOR IS NOT F9 (NOT 96TPI OR 3 1/2), WE RETURN AND LET THE
; CALLER DO THE REST. OTHERWISE, WE POP OFF THE RETURN AND JUMP TO THE TAIL
; OF GETBP. FOR 3.5" MEDIA, WE JUST RETURN.
;
; INPUTS: DS:DI POINT TO CORRECT BDS FOR THIS DRIVE
; AH HAS MEDIA BYTE
;
; OUTPUTS: CARRY CLEAR
; NO REGISTERS MODIFIED
; CARRY SET
; AL = SECTORS/FAT
; BH = NUMBER OF ROOT DIRECTORY ENTRIES
; BL = SECTORS PER TRACK
; CX = NUMBER OF SECTORS
; DH = SECTORS PER ALLOCATION UNIT
; DL = NUMBER OF HEADS
;
HIDENSITY:
PUBLIC HIDENSITY
;
; CHECK FOR CORRECT DRIVE
;
TEST WORD PTR DS:[DI].FLAGS,FCHANGELINE ; IS IT SPECIAL?
JZ DOFLOPPY ; NO, DO NORMAL FLOPPY TEST
;
; WE HAVE A MEDIA BYTE THAT IS PRETTY COMPLEX. EXAMINE DRIVE INFORMATION
; TABLE TO SEE WHAT KIND IT IS.
;
CMP BYTE PTR DS:[DI].FORMFACTOR,FFSMALL; IS IT SINGLE-MEDIA?
JZ DOFLOPPY ; YES, USE FATID...
;
; 96 TPI DRIVE
;
CMP AH,0F9H
JNZ DOFLOPPY
MOV AL,7 ; SEVEN SECTORS / FAT
MOV BX,224*256+0FH ; 224 ROOT DIR ENTRIES & 0F SECTOR MAX
MOV CX,80*15*2 ; 80 TRACKS, 15 SECTORS/TRACK, 2 SIDES
MOV DX,01*256+2 ; SECTORS/ALLOCATION UNIT & HEAD MAX
POPR:
ADD SP,2 ; POP OFF RETURN ADDRESS
JMP HAS1 ; RETURN TO TAIL OF GETBP
DOFLOPPY:
RET
PATHSTART 001,TPI96
;
; CERTAIN BOGUS PROGRAMS AVOID DOS ALTOGETHER AND USE INT 13 DIRECTLY. THESE
; PROGRAMS EVEN RETRY OPERATIONS AND, THUS, WILL IGNORE THE DISK CHANGE LOGIC.
;
; WE HOOK INT 13 AND NOTE ALL ERRORS.
;
ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
PUBLIC REAL13
REAL13 DD ?
OLDINT DD ?
DMY DW ?
PATHEND 001,TPI96
PUBLIC INT13
INT13 PROC FAR
POP WORD PTR OLDINT
POP WORD PTR OLDINT+2
POP DMY
MESSAGE FTEST13,<"*">
PUSHF
CALL REAL13 ; SIMULATE ANOTHER INT 13
JC ERR13 ; DID AN ERROR OCCUR?
JMP OLDINT ; NO, RETURN AND POP OFF FLAGS
ERR13:
MESSAGE FTEST13,<"INT 13 ERROR ">
MNUM FTEST13,AX
MESSAGE FTEST13,<CR,LF>
PUSHF ; SAVE STATE
CMP AH,06H ; DID I SEE A CHANGE EVENT?
JZ GOTERR ; YES
B: POPF ; NO, SOME OTHER ERROR, IGNORE IT
JMP OLDINT ; RETURN AND POP OFF FLAGS
GOTERR: OR DL,DL ; IS THIS FOR THE HARD DISK?
JS B ; YES, IGNORE
MOV WORD PTR CS:[FLAGBITS],FCHANGED
CALL SET_CHANGED_DL
JMP B
INT13 ENDP
;
; SET_CHANGED_DL - SETS FLAG BITS ACCORDING TO BITS SET IN [FLAGBITS].
; ESSENTIALLY USED TO INDICATE CHANGELINE, OR FORMAT.
;
; INPUTS: DL CONTAINS PHYSICAL DRIVE NUMBER
; [FLAGBITS] CONTAINS BITS TO SET IN THE FLAG FIELD IN THE BDSS
; OUTPUTS: NONE
; REGISTERS MODIFIED: FLAGS
;
SET_CHANGED_DL:
PUBLIC SET_CHANGED_DL
MESSAGE FTEST96,<"SET CHANGED",CR,LF>
PUSH BX
PUSH DX
MOV BL,DL
ALL_SET:
MOV DX,CS:[FLAGBITS] ; GET BITS TO SET IN FLAG FIELD
XOR BH,BH
;
; IN THE VIRTUAL DRIVE SYSTEM WE *MUST* FLAG THE OTHER DRIVES AS BEING CHANGED
;
; ASSUME FIRST BDS IS IN THIS SEGMENT
PUSH AX
PUSH DS ; SAVE CURRENT BDS
PUSH DI
LDS DI,DWORD PTR CS:[START_BDS]
SCAN_BDS:
CMP DI,-1
JZ SKIPSET
CMP BYTE PTR [DI].DRIVENUM,BL
JNZ GET_NEXT_BDS
;
; SOMEONE MAY COMPLAIN, BUT THIS *ALWAYS* MUST BE DONE WHEN A DISK CHANGE IS
; NOTED. THERE ARE *NO* OTHER COMPROMISING CIRCUMSTANCES.
;
SETCHANGED:
OR WORD PTR DS:[DI].FLAGS,DX ; SIGNAL CHANGE ON OTHER DRIVE
GET_NEXT_BDS:
MOV AX,WORD PTR [DI].LINK+2 ; GO TO NEXT BDS
MOV DI,WORD PTR [DI].LINK
MOV DS,AX
JMP SHORT SCAN_BDS
SKIPSET:
POP DI ; RESTORE CURRENT BDS
POP DS
POP AX
POP DX
POP BX
RET
;
; CHECKROMCHANGE - SEE IF EXTERNAL PROGRAM HAS DIDDLED ROM CHANGE LINE.
;
; INPUTS: DS:DI POINTS TO CURRENT BDS.
; OUTPUTS: ZERO SET - NO CHANGE
; ZERO RESET - CHANGE
; REGISTERS MODIFIED: NONE
CHECKROMCHANGE:
MESSAGE FTEST13,<"CHECKROM ">
MNUM FTEST13
MESSAGE FTEST13,<CR,LF>
TEST WORD PTR [DI].FLAGS,FCHANGED
RET
;
; RESETCHANGED - RESTORE VALUE OF CHANGE LINE
;
; INPUTS: DS:DI POINTS TO CURRENT BDS
; OUTPUTS: NONE
; REGISTERS MODIFIED: NONE
public ResetChanged
RESETCHANGED:
MESSAGE FTEST13,<"RESETCHANGED ">
MNUM FTEST13
MESSAGE FTEST13,<CR,LF>
AND WORD PTR DS:[DI].FLAGS,NOT FCHANGED
RET
;
; HASCHANGE - SEE IF DRIVE CAN SUPPLY CHANGE LINE
;
; INPUTS: DS:DI POINTS TO CURRENT BDS
; OUTPUTS: ZERO SET - NO CHANGE LINE AVAILABLE
; ZERO RESET - CHANGE LINE AVAILABLE
; REGISTERS MODIFIED: NONE
PUBLIC HASCHANGE
HASCHANGE:
MESSAGE FTEST13,<"HASCHANGE ">
MNUM FTEST13
MESSAGE FTEST13,<CR,LF>
TEST WORD PTR [DI].FLAGS,FCHANGELINE
RET
ASSUME DS:CODE
INCLUDE MSVOLID.INC
PUBLIC END96TPI
END96TPI LABEL BYTE

281
v4.0/src/BIOS/MSAUX.ASM Normal file
View File

@ -0,0 +1,281 @@
TITLE MSAUX - DOS 3.3
;----------------------------------------------------------------
; :
; A U X - AUXILARY DEVICE DRIVER :
; :
; :
; This file contains the Auxilary Device Driver. The :
; auxilary driver handles calls to and from the RS-232 port. :
; Three devices uses this code: AUX, COM1, and COM2. AUX and :
; COM1 talk to the zero RS-232 card and COM2 talks to the :
; 'one' RS-232 card. The beginning of the interrupt entry :
; point for these devices sets the variable AUXNUM in the :
; msbio.asm module. If the value is 0 the routines in this :
; file will talk to the the 'zero' card. If the value in :
; AUXNUM is 1 the routines will talk to the 'one' card. :
; The procedure GETDX is called to put the value 0 or 1 in :
; the DX register depending on the value in AUXBUF. :
; :
; The routines in this files are: :
; :
; routine function :
; ------- -------- :
; AUX$READ Read characters from the :
; specified device. :
; AUX$RDND Non-desrucrtive read with :
; no waiting. :
; AUX$FLSH Flush specified device input :
; buffer. :
; AUX$WRIT Write characters to the :
; specified device. :
; AUX$WRST Get status of specified :
; device :
; :
; These routines are not called directly. Call are made via :
; the strategy and interrupt entry point (see Device Header). :
; :
; Data structure: :
; The Aux Device has a two byte buffer called AUXBUF. The :
; first byte is for the zero card, the second byte is for the :
; one card. A zero value in the byte indicates the buffer is :
; empty. The routines use GETBX to get the address of the :
; buffer. :
; :
;----------------------------------------------------------------
;;Ver 3.30 modification ---------------------------
itest=0
INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT
INCLUDE JUMPMAC.INC
INCLUDE MSMACRO.INC
EXTRN ERR$CNT:NEAR ;MSBIO1
EXTRN GETDX:NEAR ;MSBIO1
EXTRN RDEXIT:NEAR ;MSCON
EXTRN EXIT:NEAR ;MSBIO1
EXTRN BUS$EXIT:NEAR ;MSBIO1
;DATA
EXTRN AUXBUF:BYTE ;MSDATA
; VALUES IN AH, REQUESTING FUNCTION OF INT 14H IN ROM BIOS
AUXFUNC_SEND EQU 1 ;TRANSMIT
AUXFUNC_RECEIVE EQU 2 ;READ
AUXFUNC_STATUS EQU 3 ;REQUEST STATUS
; ERROR FLAGS, REPORTED BY INT 14H
; THESE FLAGS REPORTED IN AH:
FLAG_DATA_READY EQU 01H ;DATA READY
FLAG_OVERRUN EQU 02H ;OVERRUN ERROR
FLAG_PARITY EQU 04H ;PARITY ERROR
FLAG_FRAME EQU 08H ;FRAMING ERROR
FLAG_BREAK EQU 10H ;BREAK DETECT
FLAG_TRANHOL_EMP EQU 20H ;TRANSMIT HOLDING REGISTER EMPTY
FLAG_TRANSHF_EMP EQU 40H ;TRANSMIT SHIFT REGISTER EMPTY
FLAG_TIMEOUT EQU 80H ;TIMEOUT
; THESE FLAGS REPORTED IN AL:
FLAG_DELTA_CTS EQU 01H ;DELTA CLEAR TO SEND
FLAG_DELTA_DSR EQU 02H ;DELTA DATA SET READY
FLAG_TRAIL_RING EQU 04H ;TRAILING EDGE RING INDICATOR
FLAG_DELTA_SIG EQU 08H ;DELTA RECEIVE LINE SIGNAL DETECT
FLAG_CTS EQU 10H ;CLEAR TO SEND
FLAG_DSR EQU 20H ;DATA SET READY
FLAG_RING EQU 40H ;RING INDICATOR
FLAG_REC_SIG EQU 80H ;RECEIVE LINE SIGNAL DETECT
;;End of modification ------------------
;----------------------------------------------------------------
; :
; Read zero or more characters from Auxilary Device :
; :
; input:es:[di] points to area to receive aux data :
; cx has number of bytes to be read :
; "auxnum" first byte has number of aux device (rel 0):
; :
;----------------------------------------------------------------
PUBLIC AUX$READ
AUX$READ PROC NEAR
ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE
jcxz EXVEC2 ; if no characters, get out
call GETBX ; put address of AUXBUF in BX
xor AX,AX ; clear AX register
xchg AL,[BX] ; Get character , if any, from
; buffer and clear buffer
or AL,AL ; if AL is nonzero there was a
; character in the buffer
jnz AUX2 ; if so skip AUXIN call
AUX1: ;
call AUXIN ; get character from port
AUX2: ;
stosb ; store character
loop AUX1 ; if more character, go around again
EXVEC2: ;
Jump EXIT ; all done, successful exit
AUX$READ ENDP
;
; AUXIN: make a call on ROM BIOS to read character from
; the auxilary device, then do some error checking.
; If an error occurs then AUXIN jumps to ERR$CNT and
; does NOT return to where it was called from.
;
AUXIN PROC NEAR
mov ah,AUXFUNC_RECEIVE
call AUXOP
;check for Frame, Parity, or Overrun errors
;WARNING: these error bits are unpredictable
; if timeout (bit 7) is set
test ah,FLAG_FRAME or FLAG_PARITY or FLAG_OVERRUN
jz AROK ;No error if all bits are clear
;Error getting character
add sp,+2 ;Remove rtn address (near call)
xor al,al
or al,FLAG_REC_SIG or FLAG_DSR or FLAG_CTS
JUMP ERR$CNT
AROK:
RET ;CHAR JUST READ IS IN AL, STATUS IS IN AH
AUXIN ENDP
;----------------------------------------------------------------
; :
; Aux non-destructive read with no waiting :
; :
; input: es:[di] points to area to receive aux data :
; :
;----------------------------------------------------------------
;
PUBLIC AUX$RDND
AUX$RDND PROC NEAR
ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE
call GETBX ; have BX point to AUXBUF
mov AL,[BX] ; copy contents of buffer to AL
or AL,AL ; if AL is non-zero (char in buffer)
jnz AUXRDX ; then return character
call AUXSTAT ; if not, get status of AUX device
TEST AH,FLAG_DATA_READY ;TEST DATA READY
jz AUXBUS ; then device is busy (not ready)
TEST AL,FLAG_DSR ;TEST DATA SET READY
jz AUXBUS ; then device is busy (not ready)
call AUXIN ; else aux is ready, get character
call GETBX ; have bx point to AUXBUF
mov [BX],AL ; save character in buffer
AUXRDX: ;
Jump RDEXIT ; return character
AUXBUS: ;
Jump BUS$EXIT ; jump to device busy exit
AUX$RDND ENDP
;----------------------------------------------------------------
; :
; Aux Output Status :
; :
;----------------------------------------------------------------
PUBLIC AUX$WRST
AUX$WRST PROC NEAR
ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE
call AUXSTAT ; get status of AUX in AX
; now test to see if device is busy
; if this bit is not set,
;;Ver 3.30 modification -----------------------
TEST AL,FLAG_DSR ;TEST DATA SET READY
jz AUXBUS ; then device is busy (not ready)
TEST AH,FLAG_TRANHOL_EMP ;TEST TRANSMIT HOLD REG EMPTY
;;End of modification -------------------------
jz AUXBUS ; then device is busy (not ready)
Jump Exit
AUX$WRST ENDP
;
; AUXSTAT makes a call on the ROM-BIOS to determine the status
; of the auxilary device
; Outputs:
; AX is filled with status of port.
; DX is changes to specify which card - either 0, 1 (, 2, 3) ;ba
; NO other registers are modified
;
AUXSTAT proc near
mov ah,AUXFUNC_STATUS
call AUXOP
ret
AUXSTAT endp
AUXOP PROC NEAR
;AH=FUNCTION CODE
;0=INIT, 1=SEND, 2=RECEIVE, 3=STATUS
call GETDX ; have DX point to proper card
int 14h ; call rom-bios for status
ret
AUXOP ENDP
;----------------------------------------------------------------
; :
; Flush AUX Input buffer - set contents of AUXBUF to zero :
; :
;----------------------------------------------------------------
PUBLIC AUX$FLSH
AUX$FLSH PROC NEAR
ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE
call GETBX ; get BX to point to AUXBUF
mov BYTE PTR [BX],0 ; zero out buffer
Jump Exit ; all done, successful return
AUX$FLSH ENDP
;----------------------------------------------------------------
; :
; Write to Auxilary Device :
; :
;----------------------------------------------------------------
PUBLIC AUX$WRIT
AUX$WRIT PROC NEAR
ASSUME DS:CODE ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE
jcxz EXVEC2 ; if CX is zero, no characters
; to be written, jump to exit
AUX$LOOP:
mov AL,ES:[DI] ; get character to be written
inc DI ; move DI pointer to next character
;;Ver 3.30 modification ---------------------------
MOV AH,AUXFUNC_SEND ;VALUE=1, INDICATES A WRITE
CALL AUXOP ;SEND CHARACTER OVER AUX PORT
TEST AH,FLAG_TIMEOUT ;CHECK FOR ERROR
;;End of modification ---------------------------
jz AWOK ; then no error
mov AL,10 ; else indicate write fault
Jump ERR$CNT ; call error routines
; if CX is non-zero, still more
AWOK:
loop AUX$LOOP ; more characrter to print
Jump Exit ; all done, successful return
AUX$WRIT ENDP
;
; GETBX puts the address of AUXBUF (the Auxilary Device buffer)
; in BX. After calling GETBX, a routine can get to AUXBUF
; with [BX].
;
; NOTE: The getdx routine is in msbio1 and looks like:
; mov dx,word ptr cs:[auxnum]
;
GETBX PROC NEAR
call GETDX
mov BX,DX
add BX,OFFSET AUXBUF
ret
GETBX ENDP
CODE ENDS
END

722
v4.0/src/BIOS/MSBDATA.INC Normal file
View File

@ -0,0 +1,722 @@
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 3.4 - J.K.
;AC000 - Changed for DOS Version 3.4 - J.K.
;ANxxx - PTR, DCRs
;==============================================================================
;AN001 - d9 Double word MOV instruction for 80386 based machine. 7/1/87 J.K.
;AN002 - d25 Change DASD ERP to that recommended by Storage Systems. 7/29/87 J.K.
;AN003; d304 Boot record structure change for OS2 11/9/87 J.K.
;==============================================================================
EXTRN INIT:NEAR
PUBLIC START$
START$:
JMP INIT ;START$ PATCH BY INIT TO POINT TO
;HDRIVE BPB
; PUBLIC FORMAT_PATCH
;FORMAT_PATCH: ;ARR 2.42
; JMP FMTSET ;MJB001 DISPATCH FOR CALL FROM FORMAT UTILITY
PATHSTART 001,BIO
; DB 20 DUP (0) ;IBM WANTS SOME ZEROED AREA (DELETED)
;HEADER DB "Ver 2.45"
;--------------------------------------------------------------
;
; COMMAND JUMP TABLES
;
; BEWARE - THESE TABLES OVERLAP SOMEWHAT! -C.P.
;
ODD
DSKTBL LABEL BYTE
DB 24 ; THIS IS THE SIZE OF THE TABLE YUK!!!!
DW DSK$INIT
DW MEDIA$CHK
DW GET$BPB
DW CMDERR ;RS
DW DSK$READ
DW BUS$EXIT
DW EXIT
DW EXIT
DW DSK$WRIT
DW DSK$WRITV
DW EXIT ;ARR 2.41
DW EXIT ;ARR 2.41
DW CMDERR ;RS
PUBLIC TABLE_PATCH
TABLE_PATCH LABEL WORD ;ARR 2.42
DW DSK$OPEN ;ARR 2.41
DW DSK$CLOSE ;ARR 2.41
DW DSK$REM ;ARR 2.41
DW EXIT
DW EXIT
DW EXIT
DW GENERIC$IOCTL ; KGS 3.20
DW EXIT
DW EXIT
DW EXIT
DW IOCTL$GETOWN ; RS 3.20
DW IOCTL$SETOWN ; RE 3.20
ODD
CONTBL LABEL BYTE
DB 10
DW EXIT
DW EXIT
DW EXIT
DW CMDERR
DW CON$READ
DW CON$RDND
DW EXIT
DW CON$FLSH
DW CON$WRIT
DW CON$WRIT
DW EXIT ;ARR 2.41
; DW CMDERR ;J.K. 4/29/86 for CON$GENIOCTL support
; DW CMDERR ;J.K. 4/29/86
; DW CMDERR ;J.K. 4/29/86
; DW CMDERR ;J.K. 4/29/86
; DW CMDERR ;J.K. 4/29/86
; DW CMDERR ;J.K. 4/29/86
; DW CMDERR ;J.K. 4/29/86
; DW CMDERR ;J.K. 4/29/86
; DW CON$GENIOCTL ;J.K. 4/29/86
ODD
AUXTBL LABEL BYTE
DB 10
DW EXIT
DW EXIT
DW EXIT
DW CMDERR
DW AUX$READ
DW AUX$RDND
DW EXIT
DW AUX$FLSH
DW AUX$WRIT
DW AUX$WRIT
DW AUX$WRST
ODD
TIMTBL LABEL BYTE
DB 9
DW EXIT
DW EXIT
DW EXIT
DW CMDERR
DW TIM$READ
DW BUS$EXIT
DW EXIT
DW EXIT
DW TIM$WRIT
DW TIM$WRIT
ODD
PRNTBL LABEL BYTE
DB 24
DW EXIT ;INIT
DW EXIT
DW EXIT
DW CMDERR
DW EXIT$ZER ;INDICATE ZERO CHARS READ
DW BUS$EXIT
DW EXIT
DW EXIT
DW PRN$WRIT
DW PRN$WRIT
DW PRN$STAT
DW EXIT
DW EXIT ;ARR 2.41
DW EXIT ;ARR 2.41
DW EXIT ;ARR 2.41
DW EXIT ;ARR 2.41
DW PRN$TILBUSY
DW EXIT ;RS 3.20
DW EXIT ;RS 3.20
DW PRN$GENIOCTL ;RS 3.20
DW EXIT ;RS 3.20
DW EXIT ;RS 3.20
DW EXIT ;RS 3.20
DW CMDERR ;RS 3.20
DW CMDERR ;RS 3.20
EVENB
PUBLIC OLD13 ;(MOVED HERE FROM IBMBIO2)
OLD13 label DWORD
db '5986' ;J.K. 11/7/86 Secrete Code for DOS 3.30 IBMBIO.
PUBLIC ORIG13
ORIG13 label DWORD
db '21',0,0 ;J.K. 11/8/86 This is my employee serial # !!!
EVENB
PUBLIC PTRSAV
PTRSAV DD 0
PUBLIC AUXBUF
AUXBUF DB 0,0,0,0 ;SET OF 1 BYTE BUFFERS FOR COM 1,2,3, AND 4
EVENB
PUBLIC PREVOPER,NUMBER_OF_SEC
PREVOPER DW ? ; HOLDS INT 13 REQUEST (I.E. REGISTER AX).
NUMBER_OF_SEC DB ? ; HOLDS NUMBER OF SECTORS TO READ ON AN ECC ERROR
IF ($-CODE) GT 100H
%OUT VDISK BUFFER NOT CORRECTLY LOCATED
ELSE
ORG 100H
ENDIF
PUBLIC VDISK_AREA
VDISK_AREA DB 108 DUP(0) ;FOR USE BY VDISK
EVENB
; WARNING!!! THESE ARE ADDRESSED TOGETHER IN GETDX
AUXNUM DB 0 ;WHICH AUX DEVICE WAS REQUESTED
DB 0
EVENB
PUBLIC CONHEADER
CONHEADER LABEL WORD ;HEADER FOR DEVICE "CON"
DD AUXDEV2
DW 1000000000010011B ;CON IN AND CON OUT + SPECIAL
DW STRATEGY
DW CON$IN
DB 'CON '
EVENB
PUBLIC AUXDEV2
AUXDEV2 LABEL WORD ;HEADER FOR DEVICE "AUX"
DD PRNDEV2
DW 1000000000000000B
DW STRATEGY
DW AUX0$IN
DB 'AUX '
EVENB
PUBLIC PRNDEV2
PRNDEV2 LABEL WORD ;HEADER FOR DEVICE "PRN"
DD TIMDEV
DW CHARDEV + OUTTILBUSY + DEV320
DW STRATEGY
DW PRN0$IN
DB 'PRN '
EVENB
PUBLIC TIMDEV
TIMDEV LABEL WORD
DD DSKDEV
DW 1000000000001000B
DW STRATEGY
DW TIM$IN
DB 'CLOCK$ '
EVENB
PUBLIC DSKDEV
DSKDEV LABEL WORD
DD COM1DEV
DW 0000100001000010B ;J.K.I1. 32 bit sector calculation
DW STRATEGY
DW DSK$IN
DRVMAX DB 4
PUBLIC DRVMAX
PUBLIC STEP_DRV
STEP_DRV DB -2 ; ARR 2.20 LAST DRIVE ACCESSED
PUBLIC PHYS_DRV
PHYS_DRV DB 0 ; USED BY SETDRIVE FOR GETTING BDS FOR
; LOGICAL DRIVE, OR PHYSICAL DRIVE.
PUBLIC FHAVE96
FHAVE96 DB 0 ; FLAG TO INDICATE PRESENCE OF
; 96TPI SUPPORT
PUBLIC SINGLE
SINGLE DB 0 ; USED TO DETECT SINGLE DRIVE SYSTEMS
PUBLIC FHAVEK09
FHAVEK09 DB 0 ;INDICATES IF THIS IS A K09 OR NOT
; USED BY CONSOLE DRIVER.
PUBLIC NEW_ROM
NEW_ROM DB 0 ;SET TO 1 IF WE HAVE A ROM THAT CAN
; HANDLE STRANGE MEDIA LAYOUTS.
PUBLIC FSETOWNER
FSETOWNER DB ? ;=1 IF WE ARE SETTING THE OWNER OF A
;DRIVE. (EXAMINED BY CHECKSINGLE).
public Secrete_Code
Secrete_Code dw 'jk' ;J.K. 11/7/86 Secrete code for DOS 3.30 IBMBIO.
EVENB
PUBLIC COM1DEV
COM1DEV LABEL WORD
DD LPT1DEV
DW 1000000000000000B
DW STRATEGY
DW AUX0$IN
DB 'COM1 '
EVENB
PUBLIC LPT1DEV
LPT1DEV LABEL WORD
DD LPT2DEV
DW CHARDEV + OUTTILBUSY + DEV320
DW STRATEGY
DW PRN1$IN
DB 'LPT1 '
EVENB
PUBLIC LPT2DEV
LPT2DEV LABEL WORD
DD LPT3DEV
DW CHARDEV + OUTTILBUSY + DEV320
DW STRATEGY
DW PRN2$IN
DB 'LPT2 '
EVENB
PUBLIC LPT3DEV
LPT3DEV LABEL WORD
DD COM2DEV
DW CHARDEV + OUTTILBUSY + DEV320
DW STRATEGY
DW PRN3$IN
DB 'LPT3 '
EVENB
PUBLIC COM2DEV
COM2DEV LABEL WORD
DD COM3DEV
DW 1000000000000000B
DW STRATEGY
DW AUX1$IN
DB 'COM2 '
EVENB
PUBLIC COM3DEV
COM3DEV LABEL WORD ;EDK
DD COM4DEV
DW 1000000000000000B
DW STRATEGY
DW AUX2$IN
DB 'COM3 '
EVENB
PUBLIC COM4DEV
COM4DEV LABEL WORD ;EDK
DW -1,CODE
DW 1000000000000000B
DW STRATEGY
DW AUX3$IN
DB 'COM4 '
; HARD-WIRE THE LINK TO THE NEXT INT2F HANDLER.
EVENB
PUBLIC NEXT2F_13
NEXT2F_13 LABEL WORD
EXTRN INT2F_DISK:FAR ;IBMBIO2
DD INT2F_DISK
EVENB
PUBLIC START_BDS
START_BDS LABEL WORD
DD BDS1 ;START OF BDS LINKED LIST.
PUBLIC ACCESSCOUNT
ACCESSCOUNT DB 0 ; NUMBER OF TIMES MEDIA CHECK CALLED
PUBLIC TIM_DRV
TIM_DRV DB -1 ; TIME WHEN LAST DISK I/O PERFORMED
PUBLIC FLAGBITS
FLAGBITS DW 0 ; BITS TO SET IN FLAG FIELD WHEN DOING
; A SET_CHANGED_DL
PUBLIC MEDBYT
MEDBYT DB ?
EVENB
PUBLIC WRTVERIFY
WRTVERIFY LABEL WORD
PUBLIC RFLAG
RFLAG DB ROMREAD ;2 FOR READ, 3 FOR WRITE
VERIFY DB 0 ;1 IF VERIFY AFTER WRITE
PUBLIC SECCNT
SECCNT DW 0
PUBLIC HARDNUM
HARDNUM DB 99 ;LOGICAL DRIVE NUMBER OF FIRST HARDFILE
PUBLIC MOTORSTARTUP,SETTLECURRENT,SETTLESLOW
MOTORSTARTUP DB ? ; VALUE FROM TABLE
SETTLECURRENT DB ? ; VALUE FROM TABLE
SETTLESLOW DB ? ; SLOW SETTLE VALUE
NEXTSPEED DB ? ; VALUE OF SPEED TO BE USED
public save_head_sttl
Save_head_sttl db ? ;used by READ_SECTOR routine
PUBLIC EOT
EOT DB 9
EVENB
PUBLIC DPT
DPT DD ?
;KEEP THE NEXT TWO ITEMS CONTIGUOUS - SEE IOCTL_BLOCK FOR REASON
PUBLIC CURSEC,CURHD,CURTRK,SPSAV
CURSEC DB 0 ;CURRENT SECTOR
CURHD DB 0 ;CURRENT HEAD
CURTRK DW 0 ;CURRENT TRACK
SPSAV DW 0 ;SAVE THE STACK POINTER
; THE FOLLOWING ARE USED FOR IOCTL FUNCTION CALLS
PUBLIC FORMT_EOT,HDNUM,TRKNUM,GAP_PATCH
FORMT_EOT DB 8 ; EOT USED FOR FORMAT
HDNUM DB 0 ; HEAD NUMBER
TRKNUM DW 0 ; TRACK BEING MANIPULATED
GAP_PATCH DB 50H ; FORMAT GAP PATCHED INTO DPT
;DISK ERRORS RETURNED FROM THE IBM ROM
PUBLIC ERRIN
ERRIN LABEL BYTE
db 0cch ;AN002; Write Fault error
DB 80H ;NO RESPONSE
DB 40H ;SEEK FAILURE
DB 10H ;BAD CRC
DB 8 ;DMA OVERRUN
DB 6 ; MEDIA CHANGE
DB 4 ;SECTOR NOT FOUND
DB 3 ;WRITE ATTEMPT TO WRITE-PROTECT DISK
PUBLIC LSTERR
LSTERR DB 0 ;ALL OTHER ERRORS
;RETURNED ERROR CODES CORRESPONDING TO ABOVE
PUBLIC ERROUT
ERROUT LABEL BYTE
db 10 ;AN002; Write Fault error
DB 2 ;NO RESPONSE
DB 6 ;SEEK FAILURE
DB 4 ;BAD CRC
DB 4 ;DMA OVERRUN
DB 15 ; INVALID MEDIA CHANGE
DB 8 ;SECTOR NOT FOUND
DB 0 ;WRITE ATTEMPT ON WRITE-PROTECT DISK
DB 12 ;GENERAL ERROR
PUBLIC NUMERR
NUMERR = ERROUT-ERRIN
;-------------------------------------------------------------
; READ IN BOOT SECTOR HERE, READ DONE IN READBOOT.
; ALSO READ SECTOR FOR DMA CHECK FOR HARD DISK.
;J.K. The buffer for a disk sector is going to be at a double word boundary
; for 80386 machine.
IF ($-CODE) Mod 4 ;AN001;
Org ($-CODE)+4-(($-CODE) Mod 4) ;AN001;
ENDIF ;AN001;
PUBLIC DISKSECTOR
DiskSector DB 11 DUP(?) ; TAKE CARE OF 3 JUMP BYTES PLUS OEM NAME.
PUBLIC BPB_IN_SECTOR
Bpb_In_Sector DW ?
PUBLIC SECPERCLUSINSECTOR
SecPerClusInSector DB ?
DW ?
public NumberOfFats
NumberOfFats DB ?
DW ?
DW ?
PUBLIC MEDIABYTE
MediaByte DB ?
DW ?
DW ?
DW ?
DW ?
DW ? ;AN000; Extended Hidden sector (high)
DW ? ;AN000; Extended Total sector (low)
DW ? ;AN000; Extended Total sector (high)
db ? ;AN003; PHYDRV in boot record.
db ? ;AN003; CURRENT HEAD in boot record.
public Ext_Boot_Sig
Ext_Boot_Sig DB ? ;AN000; Extended Boot record sig. (=90h)
public Boot_Serial_L
Boot_Serial_L DW ? ;AN000; Boot volume serial number (Low)
public Boot_Serial_H
Boot_Serial_H DW ? ;AN000; Boot volume serial number (High)
public Boot_Volume_Label
Boot_Volume_Label DB 11 dup (' ') ;AN000; Volume label
public Boot_System_ID
Boot_System_ID DB 8 dup (' ') ;AN000; File system Id.
DB 512-($-DISKSECTOR) DUP (?)
;*********************************************************************
; "BDS" CONTAINS INFORMATION FOR EACH DRIVE IN THE SYSTEM.
; VARIOUS VALUES ARE PATCHED WHENEVER ACTIONS ARE PERFORMED.
; SECTORS/ALLOC. UNIT IN BPB INITIALLY SET TO -1 TO SIGNIFY THAT
; THE BPB HAS NOT BEEN FILLED. LINK ALSO SET TO -1 TO SIGNIFY END
; OF LIST. # OF CYLINDERS IN MAXPARMS INITIALIZED TO -1 TO INDICATE
; THAT THE PARAMETERS HAVE NOT BEEN SET.
;
EVENB
BDS1 LABEL WORD
DD BDS2 ;LINK TO NEXT STRUCTURE
DB 0 ;INT 13 DRIVE NUMBER
DB 0 ;LOGICAL DRIVE LETTER
PUBLIC FDRIVE1
FDRIVE1 DW 512 ;PHYSICAL SECTOR SIZE IN BYTES
DB -1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 64 ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 00000000B ;MEDIA DESCRIPTOR, INITIALLY 00H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 1 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT (low word)
dw 0 ;J.K. Hidden sector (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 0 ; TRUE => LARGE FATS
OPCNT1 DW 0 ;OPEN REF. COUNT
DB 3 ;FORM FACTOR
FLAGS1 DW 0020H ;VARIOUS FLAGS
; DB 9 DUP (0) ;RESERVED FOR FUTURE USE
DW 40 ; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB1 DW 512 ;BYTES PER SECTOR
DB 1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 0E0H ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 0F0H ;MEDIA DESCRIPTOR, INITIALLY F0H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 2 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT(low)
dw 0 ;J.K. Hidden sector count (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 6 DUP (?)
TRACK1 DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO1 DW -1 ;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI1 DW -1
VOLID1 DB "NO NAME ",0 ;VOLUME ID FOR THIS DISK
VOLSER1 dd 0 ;Current volume serial number from Boot record
SYSID1 db "FAT12 ",0 ;Current file system id from Boot record
EVENB
BDS2 LABEL WORD
DD BDS3 ;LINK TO NEXT STRUCTURE
DB 0 ;INT 13 DRIVE NUMBER
DB 0 ;LOGICAL DRIVE LETTER
PUBLIC FDRIVE2
FDRIVE2 DW 512 ;PHYSICAL SECTOR SIZE IN BYTES
DB -1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 64 ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 00000000B ;MEDIA DESCRIPTOR, INITIALLY 00H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 1 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT (low word)
dw 0 ;J.K. Hidden sector (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 0 ; TRUE => LARGE FATS
OPCNT2 DW 0 ;OPEN REF. COUNT
DB 3 ;FORM FACTOR
FLAGS2 DW 0020H ;VARIOUS FLAGS
; DB 9 DUP (0) ;RESERVED FOR FUTURE USE
DW 40 ; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB2 DW 512 ;BYTES PER SECTOR
DB 1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 0E0H ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 0F0H ;MEDIA DESCRIPTOR, INITIALLY F0H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 2 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT(low)
dw 0 ;J.K. Hidden sector count (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 6 DUP (?)
TRACK2 DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO2 DW -1 ;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI2 DW -1
VOLID2 DB "NO NAME ",0 ;VOLUME ID FOR THIS DISK
VOLSER2 dd 0 ;Current volume serial number from Boot record
SYSID2 db "FAT12 ",0 ;Current file system id from Boot record
EVENB
BDS3 LABEL WORD
DD BDS4 ;LINK TO NEXT STRUCTURE
DB 0 ;INT 13 DRIVE NUMBER
DB 0 ;LOGICAL DRIVE LETTER
PUBLIC FDRIVE3
FDRIVE3 DW 512 ;PHYSICAL SECTOR SIZE IN BYTES
DB -1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 64 ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 00000000B ;MEDIA DESCRIPTOR, INITIALLY 00H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 1 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT (low word)
dw 0 ;J.K. Hidden sector (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 0 ; TRUE => LARGE FATS
OPCNT3 DW 0 ;OPEN REF. COUNT
DB 3 ;FORM FACTOR
FLAGS3 DW 0020H ;VARIOUS FLAGS
; DB 9 DUP (0) ;RESERVED FOR FUTURE USE
DW 40 ; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB3 DW 512 ;BYTES PER SECTOR
DB 1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 0E0H ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 0F0H ;MEDIA DESCRIPTOR, INITIALLY F0H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 2 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT(low)
dw 0 ;J.K. Hidden sector count (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 6 DUP (?)
TRACK3 DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO3 DW -1 ;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI3 DW -1
VOLID3 DB "NO NAME ",0 ;VOLUME ID FOR THIS DISK
VOLSER3 dd 0 ;Current volume serial number from Boot record
SYSID3 db "FAT12 ",0 ;Current file system id from Boot record
EVENB
BDS4 LABEL WORD
DW -1 ;LINK TO NEXT STRUCTURE
DW CODE
DB 0 ;INT 13 DRIVE NUMBER
DB 0 ;LOGICAL DRIVE LETTER
PUBLIC FDRIVE4
FDRIVE4 DW 512 ;PHYSICAL SECTOR SIZE IN BYTES
DB -1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 64 ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 00000000B ;MEDIA DESCRIPTOR, INITIALLY 00H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 1 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT (low word)
dw 0 ;J.K. Hidden sector (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 0 ; TRUE => LARGE FATS
OPCNT4 DW 0 ;OPEN REF. COUNT
DB 3 ;FORM FACTOR
FLAGS4 DW 0020H ;VARIOUS FLAGS
; DB 9 DUP (0) ;RESERVED FOR FUTURE USE
DW 40 ; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB4 DW 512 ;BYTES PER SECTOR
DB 1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. ALLOCATION TABLES
DW 0E0H ;NUMBER DIRECTORY ENTRIES
DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.)
DB 0F0H ;MEDIA DESCRIPTOR, INITIALLY F0H.
DW 2 ;NUMBER OF FAT SECTORS
DW 9 ;SECTOR LIMIT
DW 2 ;HEAD LIMIT
DW 0 ;HIDDEN SECTOR COUNT(low)
dw 0 ;J.K. Hidden sector count (high)
dw 0 ;J.K. Number sectors (low)
dw 0 ;J.K. Number sectors (high)
DB 6 DUP (?)
TRACK4 DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO4 DW -1 ;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI4 DW -1
VOLID4 DB "NO NAME ",0 ;VOLUME ID FOR THIS DISK
VOLSER4 dd 0 ;Current volume serial number from Boot record
SYSID4 db "FAT12 ",0 ;Current file system id from Boot record
BPBTYPE STRUC
SPF DB ?
SPT DB ?
CDIRE DB ?
CSEC DW ?
SPA DB ?
CHEAD DB ?
BPBTYPE ENDS
PUBLIC SM92
SM92 BPBTYPE <3,9,70H,2*9*80,2,2>
;-----------------------------------------------
;
; C O N - CONSOLE DEVICE DRIVER
;
PUBLIC ALTAH
ALTAH DB 0 ;SPECIAL KEY HANDLING
public KEYRD_Func
KEYRD_Func DB 0 ;AN000; Default is conventional keyboard read
public KEYSTS_Func
KEYSTS_Func DB 1 ;AN000; Defualt if conventional keyboard status check.
; PUBLIC SAV_SC_INFO ;J.K. 4/29/86 FOR CON$GENIOCTL
; PUBLIC SAV_SC_MODE
; PUBLIC SAV_SC_COLORS
; PUBLIC SAV_SC_WIDTH
; PUBLIC SAV_SC_LENGTH
;SAV_SC_INFO LABEL BYTE
;SAV_SC_MODE DB 0
;SAV_SC_COLORS DW 0
;SAV_SC_WIDTH DW 0
;SAV_SC_LENGTH DW 0 ;J.K. 4/29/86 FOR CON$GENIOCTL
;-------------------------------------------------------------
;
; P R N - PRINTER DEVICE
;
PUBLIC PRINTDEV
PRINTDEV DB 0 ; INDEX INTO ABOVE ARRAY
; THE FOLLOWING VARIABLE CAN BE MODIFIED VIA IOCTL SUB-FUNCTION 16. IN THIS
; WAY, THE WAIT CAN BE SET TO SUIT THE SPEED OF THE PARTICULAR PRINTER BEING
; USED. ONE FOR EACH PRINTER DEVICE.
EVENB
PUBLIC WAIT_COUNT
WAIT_COUNT DW 4 DUP (50H) ; ARRAY OF RETRY COUNTS FOR PRINTER
EVENB
PUBLIC DAYCNT
DAYCNT DW 0
IF iTEST ;Testing Mode for IBMBIO.
PUBLIC NUMBUF
NUMBUF DB 5 DUP (?)
PUBLIC DIGITS
DIGITS DB "0123456789ABCDEF"
PUBLIC FTESTBITS
;FTESTBITS DW FTESTDISK+FTESTINIT
FTESTBITS DW fTestDISK
;ftestbits dw ftestclock
ENDIF
PATHEND 001,BIO


14
v4.0/src/BIOS/MSBIO.LNK Normal file
View File

@ -0,0 +1,14 @@
msbio1+
msCON+
msAUX+
msLPT+
msCLOCK+
msDISK+
msBIO2+
mshard+
msinit+
sysinit1+
sysconf+
sysinit2+
sysimes,msbio,msBIO/M;


139
v4.0/src/BIOS/MSBIO.SKL Normal file
View File

@ -0,0 +1,139 @@
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.0 - J.K.
;AC000 - Changed for DOS Version 4.0 - J.K.
;AN00x - PTM number for DOS Version 4.0 - J.K.
;==============================================================================
;==============================================================================
;AN001 D246, P976 Show "Bad command or parameters - ..." msg 9/22/87 J.K.
;AN002 D274 Take "file" out from "Incorrect order..." msg 10/07/87 J.K.
;AN003 D486 Share installation for large media 02/24/88 J.K.
;==============================================================================
;===================
:class 1
;===================
; MESSAGES FOR THE IBM BOOT SECTOR. NUL Terminated.
; This is used by IBMBOOT and IBMLOAD program and it stays in IBMBOOT directory.
;For IBMLOAD program
;SYSMSG DB 13,10,"Non-System disk or disk error",13,10
; DB "Replace and strike any key when ready",13,10,0
:use 001 BOOT SYSMSG
;===================
:class 2
;===================
; SCCSID = @(#)biomes.asm 1.2 85/07/25
; SINGLE DRIVE MESSAGE FOR IBMBIO.COM. NUL TERMINATED.
;IFNDEF PATHSTART
;PATHSTART MACRO INDEX,ABBR
; IFDEF PATHGEN
; PUBLIC ABBR&INDEX&S,ABBR&INDEX&E
; ABBR&INDEX&S LABEL BYTE
; ENDIF
; ENDM
;ENDIF
;
;IFNDEF PATHEND
;PATHEND MACRO INDEX,ABBR
; IFDEF PATHGEN
; ABBR&INDEX&E LABEL BYTE
; ENDIF
; ENDM
;ENDIF
; PATHSTART 001,BIOMS
:def 20 SNGMSG DB 13,10,"Insert diskette for drive "
:def 21 DRVLET DB "A: and strike",13,10,"any key when ready",13,10,10,0
; PATHEND 001,BIOMS
;==================
:class 3
;==================
; PRINTED when there is a bad command in CONFIG.SYS. '$' TERMINATED, note
; that this message includes crlfm!
;PATHSTART 001,SYSMES
:def 03 BADOPM DB 13,10,"Unrecognized command in CONFIG.SYS"
;BADSIZ_POST LABEL BYTE
;BADLD_POST LABEL BYTE
:def 04 CRLFM DB 13,10,'$'
:def 22 BadParm db 13,10,"Bad command or parameters - $" ;AN001;
;PRINTED when installed device specifies too large a sector size.'$' terminated.
; FORM: <BADSIZ_PRE>device name<BADSIZ_POST>
:def 05 BADSIZ_PRE DB 13,10,"Sector size too large in file $"
;PRINTED when installed device cannot be found. '$' terminated.
; FORM: <BADLD_PRE>device name<BADLD_POST>
:def 06 BADLD_PRE DB 13,10,"Bad or missing $"
;PRINTED when command interpreter is not found. NUL terminated.
; FORM: <BADLD_PRE><BADCOM><BADLD_POST>
:def 07 BADCOM DB "Command Interpreter",0
;PRINTED when country code, code page combination was not found in country.sys file. '$' terminated.
; FORM: <BADCOUNTRY>
:def 08 BADCOUNTRY DB 13,10,"Invalid country code or code page",13,10,"$"
;PRINTED when code page id is missing or wrong syntax. - J.K.
; FORM: <BADCOUNTRYCOM>
:def 09 BADCOUNTRYCOM DB 13,10,"Error in COUNTRY command",13,10,"$"
;PRINTED when the memory left is not sufficient to handle COUTRY.SYS file
; FORM: <INSUFMEMORY>
:def 10 INSUFMEMORY DB 13,10, "Insufficient memory for COUNTRY.SYS file",13,10,"$"
; PRINTED when there is insufficient memory. '$' TERMINATED, note
; that this message includes crlfm!
:def 11 BADMEM DB 13,10,"Configuration too large for memory",13,10,"$"
; PRINTED when the attempt is made to install a block device which would
; have a drive letter > 'Z'
:def 12 BADBLOCK DB 13,10,"Too many Block Devices",13,10,"$"
; PRINTED when the attempt is made to install a stack with invalid
; combinations of # of stacks, stack size. - J.K. 5/23/86
:def 13 BADSTACK DB 13,10,"Invalid STACK parameters",13,10,"$"
;AN000; - PRINTED when encountering a command that is not "install=" after
; we had a "Install=" command. - J.K.I1.
; Translation::: Please leave the last blank space at the end of the line
; as it is.
:def 14 BADORDER DB 13,10,"Incorrect order in CONFIG.SYS line ","$"
;AN000; - PRINTED when the command failed.
; Translation::: Please leave the last blank space at the end of the line
; as it is.
:def 15 ERRORCMD DB "Error in CONFIG.SYS line ","$"
;AN003; - PRINTED when SHARE.EXE is not loaded and has a large media > 32 MB.
:def 23 SHAREWARNMSG db "WARNING! SHARE should be loaded for large media",13,10,"$"
;==================
:class 4
;==================
;IBMBIO SYSINIT
;Message for SYSINIT_BASE program.
:def 16 Mem_alloc_err db 13,10,"Memory allocation error","$"
;==================
:class 5
;==================
; %OUT STKMES.INC...
; SCCSID = @(#)stkmes.inc 1.0 86/10/21
; PUBLIC FATAL_MSG
:def 17 FATAL_MSG DB 0DH,0AH,7,0DH,0AH
DB "Internal stack overflow",0DH,0AH
DB "System halted",0DH,0AH,"$"
;
:END

645
v4.0/src/BIOS/MSBIO1.ASM Normal file
View File

@ -0,0 +1,645 @@
PAGE ,132 ;
TITLE MSBIO1.asm - BIOS
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.00 - J.K.
;AC000 - Changed for DOS Version 4.00 - J.K.
;AN00x - PTM number for DOS Version 4.00 - J.K.
;==============================================================================
COMMENT *
THE LINK STEP IS PERFORMED BY USING THE FOLLOWING "NEW.ARF" FILE:
msbio1+
msSTACK+
MsCON+
msAUX+
msLPT+
msCLOCK+
msdISK+
msBIO2+
C:\BIO2\OLDOBJ\disk+
C:\BIO2\OLDOBJ\msinit+
C:\BIO2\OLDOBJ\sysinit1+
C:\BIO2\OLDOBJ\sysinit2+
C:\BIO2\OLDOBJ\sysimes,msbio,/M;
THE FOLLOWING IS A BATCH FILE THAT CAN BE USED TO CREATE THE IBMBIO.COM
WHERE "LOCSCR" IS A FILE THAT JUST HAS THE NUMBER, 70:
link @NEW.ARF
exe2bin ibmbio ibmbio.com <C:\BIO2\Locscr
del ibmbio.exe
(END OF COMMENT)*
;***For testing purposes, set the TEST flag to 1. Otherwise reset it.
iTEST=0
PATHGEN = 1
.SALL
%OUT ...MSBIO1.ASM
; THIS IS A DOSMAC MACRO WHICH IS USED IN DEVSYM WHICH IS INCLUDED LATER
BREAK MACRO SUBTITLE
SUBTTL SUBTITLE
PAGE
ENDM
POPFF MACRO
JMP $+3
IRET
PUSH CS
CALL $-2
ENDM
INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT
SYSINITSEG SEGMENT PUBLIC 'SYSTEM_INIT'
SYSINITSEG ENDS
INCLUDE JUMPMAC.INC
PATHSTART MACRO INDEX,ABBR
IFDEF PATHGEN
PUBLIC ABBR&INDEX&S,ABBR&INDEX&E
ABBR&INDEX&S LABEL BYTE
ENDIF
ENDM
PATHEND MACRO INDEX,ABBR
IFDEF PATHGEN
ABBR&INDEX&E LABEL BYTE
ENDIF
ENDM
INCLUDE PUSHPOP.INC
INCLUDE DEVSYM.INC ;MJB001
; REV 2.1 5/1/83 ARR ADDED TIMER INT HANDLER AND CHANGED ORDER OF AUX
; PRN INIT FOR HAL0
;
; REV 2.15 7/13/83 ARR BECAUSE IBM IS FUNDAMENTALY BRAIN DAMAGED, AND
; BASCOM IS RUDE ABOUT THE 1CH TIMER INTERRUPT, THE TIMER
; HANDLER HAS TO GO BACK OUT!!!!! IBM SEEMS UNWILLING TO
; BELIEVE THE PROBLEM IS WITH THE BASCOM RUNTIME, NOT THE
; DOS. THEY HAVE EVEN BEEN GIVEN A PATCH FOR BASCOM!!!!!
; THE CORRECT CODE IS COMMENTED OUT AND HAS AN ARR 2.15
; ANNOTATION. THIS MEANS THE BIOS WILL GO BACK TO THE
; MULTIPLE ROLL OVER BUG.
; REV 2.20 8/5/83 ARR IBM MAKES HARDWARE CHANGE. NOW WANTS TO USE HALF
; HIGHT DRIVES FOR HAL0, AND BACK FIT FOR PC/PC XT. PROBLEM
; WITH HEAD SETTLE TIME. PREVIOUS DRIVES GOT BY ON A 0
; SETTLE TIME, 1/2 HIGHT DRIVES NEED 15 HEAD SETTLE WHEN
; DOING WRITES (0 OK ON READ) IF THE HEAD IS BEING STEPPED.
; THIS REQUIRES A LAST TRACK VALUE TO BE KEPT SO THAT BIOS
; KNOWS WHEN HEAD IS BEING MOVED. TO HELP OUT STUPID
; PROGRAMS THAT ISSUE INT 13H DIRECTLY, THE HEAD SETTLE WILL
; NORMALLY BE SET TO 15. IT WILL BE CHANGED TO 0 ON READS,
; OR ON WRITES WHICH DO NOT REQUIRE HEAD STEP.
; REV 2.21 8/11/83 MZ IBM WANTS WRITE WITH VERIFY TO USE HEAD SETTLE 0.
; USE SAME TRICK AS ABOVE.
; REV 2.25 6/20/83 MJB001 ADDED SUPPORT FOR 96TPI AND SALMON
; REV 2.30 6/27/83 MJB002 ADDED REAL-TIME CLOCK
; REV 2.40 7/8/83 MJB003 ADDED VOLUME-ID CHECKING AND INT 2F MACRO
; DEFINITIONS PUSH* AND POP*
; REV 2.41 7/12/83 ARR MORE 2.X ENHANCEMENTS. OPEN/CLOSE MEDIA CHANGE
; REV 2.42 11/3/83 ARR MORE 2.X ENHANCEMENTS. DISK OPEN/CLOSE, FORMAT
; CODE AND OTHER MISC HOOKED OUT TO SHRINK BIOS. CODE FOR
; DISK OPEN/CLOSE, FORMAT INCLUDED ONLY WITH 96TPI DISKS.
; REV 2.43 12/6/83 MZ EXAMINE BOOT SECTORS ON HARD DISKS FOR 16-BIT FAT
; CHECK. EXAMINE LARGE FAT BIT IN BPB FOR WALK OF MEDIA FOR
; DOS
; REV 2.44 12/9/83 ARR CHANGE TO ERROR REPORTING ON INT 17H
; REV 2.45 12/22/83 MZ MAKE HEAD SETTLE CHANGE ONLY WHEN DISK PARM IS 0.
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
; IBM ADDRESSES FOR I/O
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
INCLUDE MSDSKPR.INC
LF = 10 ;LINE FEED
CR = 13 ;CARRIAGE RETURN
BACKSP = 8 ;BACKSPACE
BRKADR = 1BH * 4 ;006C 1BH BREAK VECTOR ADDRESS
TIMADR = 1CH * 4 ;0070 1CH TIMER INTERRUPT
DSKADR = 1EH * 4 ;ADDRESS OF PTR TO DISK PARAMETERS
SEC9 = 522H ;ADDRESS OF DISK PARAMETERS
HEADSETTLE = SEC9+9 ; ARR 2.20 ADDRESS OF HEAD SETTLE TIME
NORMSETTLE = 15 ; ARR 2.20 NORMAL HEAD SETTLE
SPEEDSETTLE = 0 ; ARR 2.20 SPEED UP SETTLE TIME
INITSPOT = 534H ; ARR IBM WANTS 4 ZEROS HERE
AKPORT = 20H
EOI = 20H
ASSUME CS:CODE,DS:NOTHING,ES:NOTHING
EXTRN MEDIA$CHK:NEAR
EXTRN GET$BPB:NEAR
EXTRN DSK$INIT:NEAR
EXTRN DSK$READ:NEAR
EXTRN DSK$WRIT:NEAR
EXTRN DSK$WRITV:NEAR
EXTRN DSK$OPEN:NEAR
EXTRN DSK$CLOSE:NEAR
EXTRN DSK$REM:NEAR
EXTRN GENERIC$IOCTL:NEAR
EXTRN IOCTL$GETOWN:NEAR
EXTRN IOCTL$SETOWN:NEAR
EXTRN CON$READ:NEAR
EXTRN CON$RDND:NEAR
EXTRN CON$FLSH:NEAR
EXTRN CON$WRIT:NEAR
; EXTRN CON$GENIOCTL:NEAR ;J.K. 4/29/86
EXTRN AUX$READ:NEAR
EXTRN AUX$WRIT:NEAR
EXTRN AUX$FLSH:NEAR
EXTRN AUX$RDND:NEAR
EXTRN AUX$WRST:NEAR
EXTRN TIM$READ:NEAR
EXTRN TIM$WRIT:NEAR
EXTRN PRN$WRIT:NEAR
EXTRN PRN$STAT:NEAR
EXTRN PRN$TILBUSY:NEAR
EXTRN PRN$GENIOCTL:NEAR
EXTRN WRMSG:NEAR
;DATA AREAS
extrn Start_Sec_H:word ;AN000; Starting sector high word for
;disk I/O request. IBMDISK.ASM
INCLUDE MSBDATA.INC
IF iTEST
PUBLIC MSGNUM
MSGNUM:
PUSHF
TEST FTESTBITS,AX
JZ MRET
PUSH SI
PUSH BX
PUSH CX
PUSH ES
PUSH DI
MOV DI,OFFSET NUMBUF
PUSH CS
POP ES
MOV CX,4
NUMLOOP:
PUSH CX
MOV CL,4
ROL BX,CL
POP CX
PUSH BX
AND BX,0FH
MOV AL,DIGITS[BX]
STOSB
POP BX
LOOP NUMLOOP
POP DI
POP ES
POP CX
POP BX
MOV SI,OFFSET NUMBUF
CALL MSGOUT
POP SI
POPF
RET
PUBLIC MSGOUT
MSGOUT:
PUSHF
TEST FTESTBITS,AX
JZ MRET
PUSH DS
PUSH AX
PUSH BX
PUSH CS
POP DS
CALL WRMSG
POP BX
POP AX
POP DS
MRET:
POPF
RET
PUBLIC DUMPBYTES ;J.K. 4/9/86
;Dumpbytes will dump the bytes in memory in hex. Space will be put in between
;the bytes and CR, LF will be put at the end. - J.K.
;Input: DS:SI -> buffer to dump in Hex.
; CX -> # of bytes (Length of the buffer)
;
DUMPBYTES proc near
pushf
push ax
dumploops:
lodsb
mov ah, al
shr ah, 1
shr ah, 1
shr ah, 1
shr ah, 1
call hex_to_ascii
push ax
mov al, ah
call outchar
pop ax
call outchar
mov al, ' '
call outchar
loop dumploops
mov al, 0dh
call outchar
mov al, 0ah
call outchar
pop ax
popf
ret
DUMPBYTES endp
PUBLIC Hex_to_ascii
Hex_to_ascii proc near ;J.K. - 4/9/86
and ax, 0f0fh
add ah, 30h
cmp ah, 3ah
jb hta_$1
add ah, 7
hta_$1:
add al, 30h
cmp al, 3ah
jb hta_$2
add al, 7
hta_$2:
ret
Hex_to_ascii endp
PUBLIC outchar
Outchar proc near
PUSH AX
PUSH SI
PUSH DI
PUSH BP
PUSH BX
;SB33002*******************************************************
MOV AH, 0Eh ;SET COMMAND TO WRITE A CHAR ;SB;3.30*
MOV BX, 7 ;SET FOREGROUND COLOR ;SB;3.30*
INT 10h ;CALL ROM-BIOS ;SB;3.30*
;SB33002*******************************************************
POP BX
POP BP
POP DI
POP SI
POP AX
RET
Outchar endp
ENDIF
INCLUDE MSMACRO.INC
;---------------------------------------------------
;
; DEVICE ENTRY POINT
;
CMDLEN = 0 ;LENGTH OF THIS COMMAND
UNIT = 1 ;SUB UNIT SPECIFIER
CMD = 2 ;COMMAND CODE
STATUS = 3 ;STATUS
MEDIA = 13 ;MEDIA DESCRIPTOR
TRANS = 14 ;TRANSFER ADDRESS
COUNT = 18 ;COUNT OF BLOCKS OR CHARACTERS
START = 20 ;FIRST BLOCK TO TRANSFER
EXTRA = 22 ;USUALLY A POINTER TO VOL ID FOR ERROR 15
START_L = 26 ;AN000; Extended start sector (Low)
START_H = 28 ;AN000; Extended start sector (High)
PUBLIC STRATEGY
STRATEGY PROC FAR
MOV WORD PTR CS:[PTRSAV],BX
MOV WORD PTR CS:[PTRSAV+2],ES
RET
STRATEGY ENDP
PUBLIC CON$IN
CON$IN PROC FAR
PUSH SI
MOV SI,OFFSET CONTBL
JMP SHORT ENTRY
CON$IN ENDP
PUBLIC AUX0$IN
AUX0$IN PROC FAR
PUSH SI
PUSH AX
XOR AL,AL
JMP SHORT AUXENT
AUX0$IN ENDP
PUBLIC AUX1$IN
AUX1$IN PROC FAR
PUSH SI
PUSH AX
MOV AL,1
JMP short AUXENT ;J.K. 4/15/86
AUX1$IN ENDP
;SB33102****************************************************************
;SB Add code to handle two more COM Ports
;boban
PUBLIC AUX2$IN
AUX2$IN proc far
push si
push ax
mov al,2
jmp short AUXENT
AUX2$IN endp
PUBLIC AUX3$IN
AUX3$IN proc far
push si
push ax
mov al,3
jmp short AUXENT
;SB33102****************************************************************
AUXENT:
MOV SI,OFFSET AUXTBL
JMP SHORT ENTRY1
AUX3$IN ENDP
PRN0$IN PROC FAR
PUBLIC PRN0$IN
PUSH SI
PUSH AX
XOR AX,AX
JMP SHORT PRNENT
PRN0$IN ENDP
PUBLIC PRN1$IN
PRN1$IN PROC FAR
PUSH SI
PUSH AX
XOR AL,AL
MOV AH,1
JMP SHORT PRNENT
PRN1$IN ENDP
PUBLIC PRN2$IN
PRN2$IN PROC FAR
PUSH SI
PUSH AX
MOV AL,1
MOV AH,2
JMP SHORT PRNENT
PRN2$IN ENDP
PUBLIC PRN3$IN
PRN3$IN PROC FAR
PUSH SI
PUSH AX
MOV AL,2
MOV AH,3
PRNENT:
MOV SI,OFFSET PRNTBL
MOV CS:[PRINTDEV],AH ;SAVE INDEX INTO ARRAY OF RETRY COUNTS
JMP SHORT ENTRY1
PRN3$IN ENDP
PUBLIC TIM$IN
TIM$IN PROC FAR
PUSH SI
MOV SI,OFFSET TIMTBL
JMP SHORT ENTRY
TIM$IN ENDP
PUBLIC DSK$IN
DSK$IN PROC FAR
PUSH SI
MOV SI,OFFSET DSKTBL
ENTRY:
PUSH AX
ENTRY1:
PUSH CX
PUSH DX
PUSH DI
PUSH BP
PUSH DS
PUSH ES
PUSH BX
MOV CS:[AUXNUM],AL ;SAVE CHOICE OF AUX/PRN DEVICE
LDS BX,CS:[PTRSAV] ;GET POINTER TO I/O PACKET
ASSUME DS:NOTHING
MOV AL,BYTE PTR DS:[BX].UNIT ;AL = UNIT CODE
MOV AH,BYTE PTR DS:[BX].MEDIA ;AH = MEDIA DESCRIP
MOV CX,WORD PTR DS:[BX].COUNT ;CX = COUNT
MOV DX,WORD PTR DS:[BX].START ;DX = START SECTOR
;SB34MSB100*********************************************************************
;SB
;SB The disk device driver can now handle 32 bit start sector number.
;SB So we should check to see if a 32 bit sector number has been specified
;SB and if so get it. Whether a 32 bit sector has been specified or not
;SB the disk driver expects a 32 bit sector number with the high word
;SB in cs:Start_Sec_H and the low word in dx.
;SB
;SB Algorithm:
;SB 1. Check to see if the request is for the disk driver by
;SB checking to see if SI points to DSKTBL.
;SB
;SB 2. If request not for the disk nothing special needs to be done.
;SB
;SB 3. If request for the disk then check to see if a 32 bit
;SB sector number has been specified by seeing whether the
;SB the conventional sector number specified is -1. If so
;SB we need to pick the 32 bit sector number from the new
;SB fields in the request packet. See the request header
;SB struc for the fields you need. If the conventional
;SB sector field is not -1 then a 16 bit sector number
;SB has been specified and we just need to initalise the
;SB high word in cs:Start_Sec_H to 0
;SB
;SB NOTE: START_L and START_H are the offsets withing the IO_REQUEST packet
;SB which contain the low and hi words of the 32 bit start sector if
;SB it has been used.
;SB
;SB NOTE:Remember not to destroy the registers which have been set up before
CMP SI,OFFSET DSKTBL
JNZ DSK_REQ_CONT ; Not Disk Req
CMP DX,-1
JNZ DSK_REQ_16
MOV DX,DS:[BX].START_H ; 32 bits DSK REQ
MOV CS:START_SEC_H,DX ; CS:Start_sec_H = Packet.Start_H
MOV DX,DS:[BX].START_L ; DX = Packet.Start_L
JMP SHORT DSK_REQ_CONT
DSK_REQ_16:
MOV CS:START_SEC_H,0
DSK_REQ_CONT:
;SB34MSB100*********************************************************************
XCHG DI,AX
MOV AL,BYTE PTR DS:[BX].CMD
CMP AL,CS:[SI] ;ARR 2.41
JA CMDERR
CBW ; NOTE THAT AL <= 15 MEANS OK
SHL AX,1
ADD SI,AX
XCHG AX,DI
LES DI,DWORD PTR DS:[BX].TRANS
PUSH CS
POP DS
ASSUME DS:CODE
CLD
JMP WORD PTR [SI+1] ;GO DO COMMAND
DSK$IN ENDP
PAGE
;=====================================================
;=
;= SUBROUTINES SHARED BY MULTIPLE DEVICES
;=
;=====================================================
;----------------------------------------------------------
;
; EXIT - ALL ROUTINES RETURN THROUGH THIS PATH
;
PUBLIC BUS$EXIT
BUS$EXIT PROC FAR
ASSUME DS:NOTHING
MOV AH,00000011B
JMP SHORT ERR1
PUBLIC CMDERR
CMDERR:
MOV AL,3 ;UNKNOWN COMMAND ERROR
PUBLIC ERR$CNT
ERR$CNT:
LDS BX,CS:[PTRSAV]
ASSUME DS:NOTHING
SUB WORD PTR [BX].COUNT,CX ;# OF SUCCESSFUL I/O'S
PUBLIC ERR$EXIT
ERR$EXIT:
MOV AH,10000001B ;MARK ERROR RETURN
JMP SHORT ERR1
BUS$EXIT ENDP
EXITP PROC FAR
ASSUME DS:CODE ; WE ARE NOT SURE THIS IS CORRECT 3/18/86
EXIT$ZER:
LDS BX,[PTRSAV]
ASSUME DS:NOTHING
XOR AX,AX
MOV WORD PTR [BX].COUNT,AX ;INDICATE NO CHARS READ
PUBLIC EXIT
EXIT:
ASSUME DS:NOTHING
MOV AH,00000001B
ERR1:
ASSUME DS:NOTHING
LDS BX,CS:[PTRSAV]
MOV WORD PTR [BX].STATUS,AX ;MARK OPERATION COMPLETE
POP BX
POP ES
POP DS
POP BP
POP DI
POP DX
POP CX
POP AX
POP SI
RET ;RESTORE REGS AND RETURN
EXITP ENDP
;-------------------------------------------------------------
;
; CHROUT - WRITE OUT CHAR IN AL USING CURRENT ATTRIBUTE
;
; CALLED VIA INT 29H
;
PUBLIC CHROUT
CHROUT = 29H
PUBLIC OUTCHR
OUTCHR PROC FAR
PUSH AX
PUSH SI
PUSH DI
PUSH BP
;SB33002a*******************************************************
push bx ; ;SB ;3.30
mov AH, 0Eh ; set command to write a character;SB;3.30
mov BX, 7 ; set foreground color ;SB ;3.30
int 10h ; call rom-bios ;SB ;3.30
pop bx ; ;SB ;3.30
;SB33002a*******************************************************
POP BP
POP DI
POP SI
POP AX
IRET
OUTCHR ENDP
;----------------------------------------------
;
; SET DX TO AUXNUM
;
PUBLIC GETDX
GETDX PROC NEAR
MOV DX,WORD PTR CS:[AUXNUM]
RET
GETDX ENDP
PAGE
;************************************************** ARR 2.15
;-----------------------------------------------
;
; TIMER INTERRUPT HANDLER
;
;TIMER_LOW DW 0
;TIMER_HIGH DW 0
;
;TIMER:
; STI
; PUSH AX
; PUSH CX
; PUSH DX
; PUSH DS
; PUSH CS
; POP DS
; XOR AX,AX
; INT 1AH ; GET ROM TIME AND ZAP ROLL OVER
; MOV [TIMER_HIGH],CX
; MOV [TIMER_LOW],DX
; OR AL,AL
; JZ T5
; INC WORD PTR [DAYCNT] ; ONE DAY GONE BY
;T5:
; POP DS
; POP DX
; POP CX
; POP AX
; IRET
;************************************************** ARR 2.15
CODE ENDS
END

572
v4.0/src/BIOS/MSBIO2.ASM Normal file
View File

@ -0,0 +1,572 @@
PAGE ,132 ;
TITLE MSBIO2 - BIOS
%OUT ...MSBIO2.ASM
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.00 - J.K.
;AC000 - Changed for DOS Version 4.00 - J.K.
;AN00x - PTM number for DOS Version 4.00 - J.K.
;==============================================================================
;AN001; - P1820 New Message SKL file 10/20/87 J.K.
;AN002; - P5045 New INT 2fh for Get BDS table vector for EMS 06/06/88 J.K.
;==============================================================================
ROMSEGMENT EQU 0F000H
MODELBYTE EQU DS:BYTE PTR [0FFFEH]
MODELPCJR EQU 0FDH
itest=0
INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT
INCLUDE MSEQU.INC
INCLUDE DEVSYM.INC
INCLUDE PUSHPOP.INC
INCLUDE MSMACRO.INC
ASSUME DS:NOTHING,ES:NOTHING
EXTRN DSK$IN:NEAR
EXTRN SETPTRSAV:NEAR
EXTRN OUTCHR:NEAR
EXTRN SETDRIVE:NEAR
EXTRN FLUSH:NEAR
EXTRN HARDERR:NEAR
EXTRN HARDERR2:NEAR
EXTRN MAPERROR:NEAR
EXTRN GETBP:NEAR
EXTRN CHECKSINGLE:NEAR
EXTRN CHECK_TIME_OF_ACCESS:NEAR
EXTRN EXIT:NEAR
EXTRN HAS1:NEAR
EXTRN READ_SECTOR:NEAR
EXTRN INT_2F_13:FAR
EXTRN OLD13:DWORD
;DATA
EXTRN PTRSAV:DWORD ;IBMBIO1
EXTRN START_BDS:WORD
EXTRN FDRIVE1:WORD
EXTRN FDRIVE2:WORD
EXTRN FDRIVE3:WORD
EXTRN FDRIVE4:WORD
EXTRN FLAGBITS:WORD
EXTRN TIM_DRV:BYTE
EXTRN MEDBYT:BYTE
EXTRN DRVMAX:BYTE
extrn Ext_Boot_Sig:byte ;AN000; ibmbdata
extrn SecPerClusInSector:byte ;AN000; ibmbdata
extrn Boot_Serial_L:word ;AN000; ibmbdata
extrn Boot_Serial_H:word ;AN000; ibmbdata
PATHSTART 005,DISK
EVENB
public Model_Byte
MODEL_BYTE DB 0FFH ; MODEL BYTE. SET UP AT INIT TIME.
; FF - PC1
; FE - XT (64/256K PLANAR)
; FD - PC-JR
; FC - PC/AT
public Secondary_Model_Byte
Secondary_Model_Byte db 0
PUBLIC ORIG19
ORIG19 DD ?
PUBLIC INT19SEM
INT19SEM DB 0 ; INDICATE THAT ALL INT 19
; INITIALIZATION IS COMPLETE
IRP AA,<02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77>
public Int19OLD&AA
Int19OLD&AA dd -1 ;Orignal hardware int. vectors for INT 19h.
ENDM
EVENB
PUBLIC DSKDRVS
DSKDRVS DW FDRIVE1
DW FDRIVE2
DW FDRIVE3
DW FDRIVE4
PUBLIC HDSKTAB
HDSKTAB DW HDRIVE
DW DRIVEX
;* Next area is reseved for mini disk BPB pointers *** J.K. 4/7/86
;* Don't change this position. Should be addressible from DskDrvs *** J.K. 4/7/86
MINI_DISK_BPB_PTRS DB 40 dup (?) ;J.K. 4/7/86 - memory reserved for Mini disk.
EVENB
PUBLIC INT_2F_NEXT
INT_2F_NEXT DD ?
RET_ADDR DD ?
PATHEND 005,DISK
; = = = = = = = = = = = = = = = = = = = =
; INT19
;
; WE "HOOK" THE INT 19 VECTOR, BECAUSE CONTRARY TO IBM DOCUMENTATION,
; IT DOES NOT "BOOTSTRAP" THE MACHINE. IT LEAVES MEMORY ALMOST UNTOUCHED.
; SINCE THE BIOS_INIT CODE ASSUMES THAT CERTAIN INTERRUPT VECTORS POINT TO
; THE ROM_BIOS WE MUST "UNHOOK" THEM BEFORE ISSUING THE ACTUAL INT_19.
; CURRENTLY THE ONLY VECTORS THAT NEED TO BE UNHOOKED ARE INT_19, INT_13,
; AND THE HARDWARE INTERRUPTS.
;
PUBLIC INT19
INT19 PROC FAR
XOR AX,AX
MOV DS,AX
assume ds:nothing
assume es:nothing
LES DI,OLD13
MOV DS:[13H*4],DI
MOV DS:[13H*4+2],ES
CMP BYTE PTR INT19SEM, 0
JNZ INT19VECS
JMP DOINT19
; ON THE PCJR, DON'T REPLACE ANY VECTORS
; MODEL BYTE DEFINITIONS FROM IBMSTACK.ASM
MOV AX,ROMSEGMENT
MOV DS,AX
MOV AL,MODELPCJR
CMP AL,MODELBYTE
JNE INT19VECS
JMP DOINT19
;Stacks code has changed these hardware interrupt vectors
;STKINIT in SYSINIT1 will initialzie Int19hOLDxx values.
INT19VECS:
XOR AX,AX
MOV DS,AX
IRP AA,<02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77>
LES DI,Int19OLD&AA
;SB33103******************************************************************
mov ax,es ;
cmp ax,-1 ;OPT 0ffffh is unlikely segment
je skip_int&AA ;OPT no need to check selector too
cmp di,-1 ;OPT 0ffffh is unlikely offset
je skip_int&AA
;SB33103******************************************************************
MOV DS:[AA&H*4],DI
MOV DS:[AA&H*4+2],ES
skip_int&AA:
ENDM
DOINT19:
LES DI,ORIG19
MOV DS:[19H*4],DI
MOV DS:[19H*4+2],ES
INT 19H
INT19 ENDP
ASSUME DS:CODE
PUBLIC DSK$INIT
DSK$INIT PROC NEAR
PUSH CS
POP DS
MOV AH,BYTE PTR DRVMAX
MOV DI,OFFSET DSKDRVS
JMP SETPTRSAV
DSK$INIT ENDP
;
; INT 2F HANDLER FOR EXTERNAL BLOCK DRIVERS TO COMMUNICATE WITH THE INTERNAL
; BLOCK DRIVER IN IBMDISK. THE MULTIPLEX NUMBER CHOSEN IS 8. THE HANDLER
; SETS UP THE POINTER TO THE REQUEST PACKET IN [PTRSAV] AND THEN JUMPS TO
; DSK$IN, THE ENTRY POINT FOR ALL DISK REQUESTS.
; ON EXIT FROM THIS DRIVER (AT EXIT), WE WILL RETURN TO THE EXTERNAL DRIVER
; THAT ISSUED THIS INT 2F, AND CAN THEN REMOVE THE FLAGS FROM THE STACK.
; THIS SCHEME ALLOWS US TO HAVE A SMALL EXTERNAL DEVICE DRIVER, AND MAKES
; THE MAINTAINANCE OF THE VARIOUS DRIVERS (DRIVER AND IBMBIO) MUCH EASIER,
; SINCE WE ONLY NEED TO MAKE CHANGES IN ONE PLACE (MOST OF THE TIME).
;
; 06/03/88 J.K. When AL=3, return DS:DI -> Start of BDS table.
; (EMS device driver hooks INT 13h to handle 16KB DMA overrun
; problem. BDS table is going to be used to get head/sector
; informations without calling Generic IOCTL Get Device Parm call.)
;
; AL CONTAINS THE INT2F FUNCTION:
; 0 - CHECK FOR INSTALLED HANDLER - RESERVED
; 1 - INSTALL THE BDS INTO THE LINKED LIST
; 2 - DOS REQUEST
; 3 - Get BDS vector ;06/03/88 J.K.
; Return BDS table starting pointer in DS:DI
MYNUM EQU 8
PUBLIC INT2F_DISK
INT2F_DISK PROC FAR
CMP AH,MYNUM
JE MINE
JMP CS:[INT_2F_NEXT] ; CHAIN TO NEXT INT 2F HANDLER
MINE:
CMP AL,0F8H ; IRET ON RESERVED FUNCTIONS
JB DO_FUNC
IRET
DO_FUNC:
OR AL,AL ; A GET INSTALLED STATE REQUEST?
JNE DISP_FUNC
MOV AL,0FFH
IRET
DISP_FUNC:
MESSAGE FTESTINIT,<"INT2F_DISK",CR,LF>
CMP AL,1 ; REQUEST FOR INSTALLING BDS?
JNE DO_DOS_REQ
CALL INSTALL_BDS
IRET
DO_DOS_REQ:
; SET UP POINTER TO REQUEST PACKET
cmp al, 3 ;AN002; Get BDS vector?
je DO_Get_BDS_Vector ;AN002;
MOV WORD PTR CS:[PTRSAV],BX ;othrwise DOS function.
MOV WORD PTR CS:[PTRSAV+2],ES
JMP DSK$IN
DO_Get_BDS_Vector: ;AN002; AL=3
push cs ;AN002;
pop ds ;AN002;
mov di, Start_BDS ;AN002;
IRET ;AN002;
INT2F_DISK ENDP
;
; INSTALL_BDS INSTALLS A BDS A LOCATION DS:DI INTO THE CURRENT LINKED LIST OF
; BDS MAINTAINED BY THIS DEVICE DRIVER. IT PLACES THE BDS AT THE END OF THE
; LIST.
PUBLIC INSTALL_BDS
INSTALL_BDS PROC NEAR
MESSAGE FTESTINIT,<"INSTALL BDS",CR,LF>
; DS:DI POINT TO BDS TO BE INSTALLED
LES SI,DWORD PTR CS:[START_BDS] ; START AT BEGINNING OF LIST
PUSH ES ; SAVE POINTER TO CURRENT BDS
PUSH SI
; ES:SI NOW POINT TO BDS IN LINKED LIST
LOOP_NEXT_BDS:
CMP SI,-1 ; GOT TO END OF LINKED LIST?
JZ INSTALL_RET
; IF WE HAVE SEVERAL LOGICAL DRIVES USING THE SAME PHYSICAL DRIVE, WE MUST
; SET THE I_AM_MULT FLAG IN EACH OF THE APPROPRIATE BDSS.
MOV AL,BYTE PTR DS:[DI].DRIVENUM
CMP BYTE PTR ES:[SI].DRIVENUM,AL
JNZ NEXT_BDS
MESSAGE FTESTINIT,<"LOGICAL DRIVES",CR,LF>
XOR BX,BX
MOV BL,FI_AM_MULT
OR WORD PTR DS:[DI].FLAGS,BX ; SET FLAGS IN BOTH BDSS CONCERNED
OR WORD PTR ES:[SI].FLAGS,BX
MOV BL,FI_OWN_PHYSICAL
XOR BX,-1
AND WORD PTR DS:[DI].FLAGS,BX ; RESET THAT FLAG FOR 'NEW' BDS
; WE MUST ALSO SET THE FCHANGELINE BIT CORRECTLY.
MOV BX,WORD PTR ES:[SI].FLAGS ; DETERMINE IF CHANGELINE AVAILABLE
AND BL,FCHANGELINE
XOR BH,BH
OR WORD PTR DS:[DI].FLAGS,BX
NEXT_BDS:
; BEFORE MOVING TO NEXT BDS, PRESERVE POINTER TO CURRENT ONE. THIS IS NEEDED AT
; THE END WHEN THE NEW BDS IS LINKED INTO THE LIST.
POP BX ; DISCARD PREVIOUS POINTER TO BDS
POP BX
PUSH ES
PUSH SI
MOV BX,WORD PTR ES:[SI].LINK + 2
MOV SI,WORD PTR ES:[SI].LINK
MOV ES,BX
JMP SHORT LOOP_NEXT_BDS
INSTALL_RET:
POP SI ; RETRIEVE POINTER TO LAST BDS
POP ES ; IN LINKED LIST.
MOV AX,DS
MOV WORD PTR ES:[SI].LINK+2,AX ; INSTALL BDS
MOV WORD PTR ES:[SI].LINK,DI
MOV WORD PTR DS:[DI].LINK,-1 ; SET NEXT POINTER TO NULL
RET
INSTALL_BDS ENDP
;
; RE_INIT INSTALLS THE INT 2F VECTOR THAT WILL HANDLE COMMUNICATION BETWEEN
; EXTERNAL BLOCK DRIVERS AND THE INTERNAL DRIVER. IT ALSO INSTALLS THE
; RESET_INT_13 INTERFACE. IT IS CALLED BY SYSYINIT
;
PUBLIC RE_INIT
RE_INIT PROC FAR
MESSAGE FTESTINIT,<"REINIT",CR,LF>
PUSH AX
PUSH DS
PUSH DI
XOR DI,DI
MOV DS,DI
MOV DI,2FH*4 ; POINT IT TO INT 2F VECTOR
MOV AX,WORD PTR DS:[DI]
MOV WORD PTR CS:[INT_2F_NEXT],AX
MOV AX,WORD PTR DS:[DI+2] ; PRESERVE OLD INT 2F VECTOR
MOV WORD PTR CS:[INT_2F_NEXT+2],AX
; INSTALL THE RESET_INT_13
; INTERFACE
;
; THE FOLLOWING TWO LINES ARE NOT NEEDED ANYMORE BECAUSE THE LINK HAS BEEN
; HARD-WIRED INTO THE CODE AT NEXT2F_13. - RAJEN.
;------------------------------------------------------------------------------
; MOV WORD PTR CS:[NEXT2F_13],OFFSET INT2F_DISK ; PRESERVE INT2F_DISK POINTER
; MOV WORD PTR CS:[NEXT2F_13+2],CS
;------------------------------------------------------------------------------
CLI
MOV WORD PTR DS:[DI],OFFSET INT_2F_13 ; INSTALL NEW VECTORS
MOV WORD PTR DS:[DI+2],CS
STI
POP DI
POP DS
POP AX
RET
RE_INIT ENDP
;-------------------------------------------------
;
; ASK TO SWAP THE DISK IN DRIVE A:
;
PUBLIC SWPDSK
SWPDSK PROC NEAR
MOV AL,BYTE PTR DS:[DI].DRIVELET ; GET THE DRIVE LETTER
;USING A DIFFERENT DRIVE IN A ONE DRIVE SYSTEM SO REQUEST THE USER CHANGE DISKS
ADD AL,"A"
MOV CS:DRVLET,AL
PUSH DS ; PRESERVE SEGMENT REGISTER
PUSH CS
POP DS
MOV SI,OFFSET SNGMSG ; DS:SI -> MESSAGE
PUSH BX
CALL WRMSG ;PRINT DISK CHANGE MESSAGE
CALL FLUSH
;SB33003***************************************************************
xor AH, AH ; set command to read character;SB
int 16h ; call rom-bios ;SB
;SB33003***************************************************************
POP BX
POP DS ; RESTORE SEGMENT REGISTER
WRMRET:
RET
SWPDSK ENDP
;----------------------------------------------
;
; WRITE OUT MESSAGE POINTED TO BY [SI]
;
PUBLIC WRMSG
WRMSG PROC NEAR
LODSB ;GET THE NEXT CHARACTER OF THE MESSAGE
OR AL,AL ;SEE IF END OF MESSAGE
JZ WRMRET
; INT CHROUT
PUSHF
PUSH CS
CALL OUTCHR
JMP SHORT WRMSG
WRMSG ENDP
; INCLUDE BIOMES.INC
include MSBIO.CL2
;
; END OF SUPPORT FOR MULTIPLE FLOPPIES WITH NO LOGICAL DRIVES
; THIS IS NOT 'SPECIAL' ANY MORE BECAUSE WE NOW HAVE THE CAPABILITY OF
; DEFINING LOGICAL DRIVES IN CONFIG.SYS. WE THEREFORE KEEP THE CODE FOR
; SWAPPING RESIDENT ALL THE TIME.
;
;J.K. 10/1/86 *******************************************************
;Variables for Dynamic Relocatable modules
;These should be stay resident.
public INT6C_RET_ADDR
INT6C_RET_ADDR DD ? ; return address from INT 6C for P12 machine
PATHSTART 001,CLK
;
; DATA STRUCTURES FOR REAL-TIME DATE AND TIME
;
public BIN_DATE_TIME
public MONTH_TABLE
public DAYCNT2
public FEB29
BIN_DATE_TIME:
DB 0 ; CENTURY (19 OR 20) OR HOURS (0-23)
DB 0 ; YEAR IN CENTURY (0...99) OR MINUTES (0-59)
DB 0 ; MONTH IN YEAR (1...12) OR SECONDS (0-59)
DB 0 ; DAY IN MONTH (1...31)
MONTH_TABLE: ;
DW 0 ;MJB002 JANUARY
DW 31 ;MJB002 FEBRUARY
DW 59 ;MJB002
DW 90 ;MJB002
DW 120 ;MJB002
DW 151 ;MJB002
DW 181 ;MJB002
DW 212 ;MJB002
DW 243 ;MJB002
DW 273 ;MJB002
DW 304 ;MJB002
DW 334 ;MJB002 DECEMBER
DAYCNT2 DW 0000 ;MJB002 TEMP FOR COUNT OF DAYS SINCE 1-1-80
FEB29 DB 0 ;MJB002 FEBRUARY 29 IN A LEAP YEAR FLAG
PATHEND 001,CLK
;********************************************************************
;
PUBLIC ENDFLOPPY
ENDFLOPPY LABEL BYTE
;
; END OF CODE FOR VIRTUAL FLOPPY DRIVES
;
PUBLIC ENDSWAP
ENDSWAP LABEL BYTE
PATHSTART 004,BIO
PUBLIC HNUM
HNUM DB 0 ;NUMBER OF HARDFILES
PUBLIC HARDDRV
HARDDRV DB 80H ;PHYSICAL DRIVE NUMBER OF FIRST HARDFILE
;**********************************************************************
; "HDRIVE" IS A HARD DISK WITH 512 BYTE SECTORS
;*********************************************************************
EVENB
PUBLIC BDSH
BDSH DW -1 ;LINK TO NEXT STRUCTURE
DW CODE
DB 80 ;INT 13 DRIVE NUMBER
DB "C" ;LOGICAL DRIVE LETTER
PUBLIC HDRIVE
HDRIVE:
DW 512
DB 1 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. OF ALLOCATION TABLES
DW 16 ;NUMBER OF DIRECTORY ENTRIES
DW 0000 ;NUMBER OF SECTORS (AT 512 BYTES EACH)
DB 11111000B ;MEDIA DESCRIPTOR
DW 1 ;NUMBER OF FAT SECTORS
DW 00 ;SECTOR LIMIT
DW 00 ;HEAD LIMIT
DW 00 ;HIDDEN SECTOR COUNT(low)
dw 00 ;AN000; Hidden Sector (high)
dw 00 ;AN000; Number of Sectors (low)
dw 00 ;AN000; Number of Sectors (high)
DB 0 ; TRUE => BIGFAT
OPCNTH DW 0 ;OPEN REF. COUNT
DB 3 ;FORM FACTOR
FLAGSH DW 0020H ;VARIOUS FLAGS
; DB 9 DUP (0) ;RESERVED FOR FUTURE USE
DW 40 ; NUMBER OF CYLINDERS
RECBPBH DB 31 DUP (?) ; RECOMMENDED BPB FOR DRIVE
TRACKH DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LOH DW -1 ;KEEP THESE TWO CONTIGUOUS (?)
TIM_HIH DW -1
VOLIDH DB "NO NAME ",0 ;AN000; VOLUME ID FOR THIS DISK
VolSerH dd 0 ;AN000; Current volume serial number from Boot record
SysIDH db "FAT12 " ,0 ;AN000; Current file system id from Boot record
;
; END OF SINGLE HARD DISK SECTION
;
PUBLIC ENDONEHARD
ENDONEHARD LABEL BYTE
;**********************************************************************
; "DRIVEX " IS AN EXTRA TYPE OF DRIVE USUALLY RESERVED FOR AN
; ADDITIONAL HARD FILE
;*********************************************************************
EVENB
PUBLIC BDSX
BDSX DW -1 ;LINK TO NEXT STRUCTURE
DW CODE
DB 81 ;INT 13 DRIVE NUMBER
DB "D" ;LOGICAL DRIVE LETTER
PUBLIC DRIVEX
DRIVEX:
DW 512
DB 00 ;SECTORS/ALLOCATION UNIT
DW 1 ;RESERVED SECTORS FOR DOS
DB 2 ;NO. OF ALLOCATION TABLES
DW 0000 ;NUMBER OF DIRECTORY ENTRIES
DW 0000 ;NUMBER OF SECTORS (AT 512 BYTES EACH)
DB 11111000B ;MEDIA DESCRIPTOR
DW 0000 ;NUMBER OF FAT SECTORS
DW 00 ;SECTOR LIMIT
DW 00 ;HEAD LIMIT
DW 00 ;HIDDEN SECTOR COUNT (low)
dw 00 ;AN000; Hidden Sector (high)
dw 00 ;AN000; Number of Sectors (low)
dw 00 ;AN000; Number of Sectors (high)
DB 0 ; TRUE => BIGFAT
OPCNTD DW 0 ;OPEN REF. COUNT
DB 3 ;FORM FACTOR
FLAGSD DW 0020H ;VARIOUS FLAGS
; DB 9 DUP (0) ;RESERVED FOR FUTURE USE
DW 40 ; NUMBER OF CYLINDERS
RECBPBD DB 31 DUP (?) ; RECOMMENDED BPB FOR DRIVE
TRACKD DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LOD DW -1 ;KEEP THESE TWO CONTIGUOUS (?)
TIM_HID DW -1
VOLIDD DB "NO NAME ",0 ;AN000; VOLUME ID FOR THIS DISK
VolSerD dd 0 ;AN000; Current volume serial number from Boot record
SysIDD db "FAT12 " ,0 ;AN000; Current file system id from Boot record
;
; END OF SECTION FOR TWO HARD DISKS
PUBLIC ENDTWOHARD
ENDTWOHARD LABEL BYTE
PATHEND 004,BIO
PUBLIC TWOHARD
TWOHARD LABEL BYTE
PAGE
INCLUDE MS96TPI.INC
;*********************************************************************
;Memory allocation for BDSM table. - J.K. 2/21/86
;*********************************************************************
PUBLIC BDSMs
BDSMs BDSM_type Max_mini_dsk_num dup (<>) ;currently max. 23
;** End_of_BDSM defined in IBMINIT.ASM will be used to set the appropriate
;** ending address of BDSM table.
;
;;3.3 BUG FIX -SP ------------------------------
;;Migrated into 4.00 -MRW
;Paragraph buffer between the BDSMs and MSHARD
;
;The relocation code for MSHARD needs this. this cannot be used for
;anything. nothing can come before this or after this.....IMPORTANT!!!!
;don't get too smart and using this buffer for anything!!!!!!
;
db 16 dup(0)
;
;end of bug fix buffer
;;
;;3.3 BUG FIX -SP------------------------------
CODE ENDS
END

296
v4.0/src/BIOS/MSCLOCK.ASM Normal file
View File

@ -0,0 +1,296 @@
TITLE MSCLOCK - DOS 3.3
;----------------------------------------------------------------
; :
; CLOCK DEVICE DRIVER :
; :
; :
; This file contains the Clock Device Driver. :
; :
; The routines in this files are: :
; :
; routine function :
; ------- -------- :
; TIM$WRIT Set the current time :
; TIM$READ Read the current time :
; Time_To_Ticks Convert time to corresponding :
; number of clock ticks :
; :
; The clock ticks at the rate of: :
; :
; 1193180/65536 ticks/second (about 18.2 ticks per second):
; See each routine for information on the use. :
; :
;----------------------------------------------------------------
itest=0
INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT
INCLUDE MSMACRO.INC
EXTRN EXIT:NEAR
;
; DAYCNT is the number of days since 1-1-80.
; Each time the clock is read it is necessary to check if another day has
; passed. The ROM only returns the day rollover once so if it is missed
; the time will be off by a day.
;
EXTRN DAYCNT:WORD ;MSDATA
;;Rev 3.30 Modification ------------------------------------------------
; variables for real time clock setting
public HaveCMOSClock
HaveCMOSClock db 0 ;set by MSINIT.
public base_century
base_century db 19
public base_year
base_year db 80
public month_tab
month_tab db 31,28,31,30,31,30,31,31,30,31,30,31
; The following are indirect intra-segment call addresses. The
;procedures are defined in MSINIT for relocation. MSINIT will set these
;address when the relocation is done.
public BinToBCD
BinToBCD dw 0 ;should point to Bin_To_BCD proc in MSINIT
public DaycntToDay
DaycntToDay dw 0 ;should point to Daycnt_to_day in MSINIT
;********************************************************************
; Indirect call address of TIME_TO_TICKS procedure.
;This will be used by the relocatable portable suspend/resume code.
public TimeToTicks
TimeToTicks dw Time_To_Ticks
;;End of Modification ------------------------------------------------
;--------------------------------------------------------------------
;
; Settime sets the current time
;
; On entry ES:[DI] has the current time:
;
; number of days since 1-1-80 (WORD)
; minutes (0-59) (BYTE)
; hours (0-23) (BYTE)
; hundredths of seconds (0-99) (BYTE)
; seconds (0-59) (BYTE)
;
; Each number has been checked for the correct range.
;
PUBLIC TIM$WRIT
TIM$WRIT PROC NEAR
ASSUME DS:CODE
mov AX,WORD PTR ES:[DI]
push AX ;DAYCNT. We need to set this at the very
; end to avoid tick windows.
;;Rev 3.30 Modification
cmp HaveCMOSClock, 0
je No_CMOS_1
mov al,es:[di+3] ;get binary hours
call BinToBCD ;convert to BCD
mov ch,al ;CH = BCD hours
mov al,es:[di+2] ;get binary minutes
call BinToBCD ;convert to BCD
mov cl,al ;CL = BCD minutes
mov al,es:[di+5] ;get binary seconds
call BinToBCD ;convert to BCD
mov dh,al ;DH = BCD seconds
mov dl,0 ;DL = 0 (ST) or 1 (DST)
cli ;turn off timer
mov ah,03h ;set RTC time
int 1Ah ;call rom bios clock routine
sti
;;End of Modification
No_CMOS_1:
mov CX,WORD PTR ES:[DI+2]
mov DX,WORD PTR ES:[DI+4]
;;Rev 3.30 Modification
call time_to_ticks ; convert time to ticks
;CX:DX now has time in ticks
cli ; Turn off timer
mov AH, 1 ; command is set time in clock
int 1Ah ; call rom-bios clock routines
pop [DAYCNT]
sti
;CMOS clock -------------------------------------
cmp HaveCMOSClock, 0
je No_CMOS_2
call DaycntToDay ; convert to BCD format
cli ; Turn off timer
mov AH,05h ; set RTC date
int 1Ah ; call rom-bios clock routines
sti
;------------------------------------------------
No_CMOS_2:
jmp EXIT
TIM$WRIT ENDP
;;End of Modification
;
; convert time to ticks
; input : time in CX and DX
; ticks returned in CX:DX
;
public time_to_ticks
TIME_TO_TICKS PROC NEAR
; first convert from Hour,min,sec,hund. to
; total number of 100th of seconds
mov AL,60
mul CH ;Hours to minutes
mov CH,0
add AX,CX ;Total minutes
mov CX,6000 ;60*100
mov BX,DX ;Get out of the way of the multiply
mul CX ;Convert to 1/100 sec
mov CX,AX
mov AL,100
mul BH ;Convert seconds to 1/100 sec
add CX,AX ;Combine seconds with hours and min.
adc DX,0 ;Ripple carry
mov BH,0
add CX,BX ;Combine 1/100 sec
adc DX,0
;;Rev 3.30 Modification
;DX:CX IS TIME IN 1/100 SEC
XCHG AX,DX
XCHG AX,CX ;NOW TIME IS IN CX:AX
MOV BX,59659
MUL BX ;MULTIPLY LOW HALF
XCHG DX,CX
XCHG AX,DX ;CX->AX, AX->DX, DX->CX
MUL BX ;MULTIPLY HIGH HALF
ADD AX,CX ;COMBINE OVERLAPPING PRODUCTS
ADC DX,0
XCHG AX,DX ;AX:DX=TIME*59659
MOV BX,5
DIV BL ;DIVIDE HIGH HALF BY 5
MOV CL,AL
MOV CH,0
MOV AL,AH ;REMAINDER OF DIVIDE-BY-5
CBW
XCHG AX,DX ;USE IT TO EXTEND LOW HALF
DIV BX ;DIVDE LOW HALF BY 5
MOV DX,AX
; CX:DX is now number of ticks in time
ret
TIME_TO_TICKS ENDP
;;End of Modification
;
; Gettime reads date and time
; and returns the following information:
;
; ES:[DI] =count of days since 1-1-80
; ES:[DI+2]=hours
; ES:[DI+3]=minutes
; ES:[DI+4]=seconds
; ES:[DI+5]=hundredths of seconds
;
PUBLIC TIM$READ
TIM$READ PROC NEAR
; read the clock
xor AH, AH ; set command to read clock
int 1Ah ; call rom-bios to get time
or al,al ; check for a new day
jz noroll1 ; if al=0 then don't reset day count
INC [DAYCNT] ; CATCH ROLLOVE
noroll1:
MOV SI,[DAYCNT]
;
; we now need to convert the time in tick to the time in 100th of
; seconds. The relation between tick and seconds is:
;
; 65536 seconds
; ----------------
; 1,193,180 tick
;
; To get to 100th of second we need to multiply by 100. The equation is:
;
; Ticks from clock * 65536 * 100
; --------------------------------- = time in 100th of seconds
; 1,193,180
;
; Fortunately this fromula simplifies to:
;
; Ticks from clock * 5 * 65,536
; --------------------------------- = time in 100th of seconds
; 59,659
;
; The calculation is done by first multipling tick by 5. Next we divide by
; 59,659. In this division we multiply by 65,536 by shifting the dividend
; my 16 bits to the left.
;
; start with ticks in CX:DX
; multiply by 5
MOV AX,CX
MOV BX,DX
SHL DX,1
RCL CX,1 ;TIMES 2
SHL DX,1
RCL CX,1 ;TIMES 4
ADD DX,BX
ADC AX,CX ;TIMES 5
XCHG AX,DX
; now have ticks * 5 in DX:AX
; we now need to multiply by 65,536 and divide by 59659 d.
mov CX,59659 ; get divisor
div CX
; DX now has remainder
; AX has high word of final quotient
mov BX,AX ; put high work if safe place
xor AX,AX ; this is the multiply by 65536
div CX ; BX:AX now has time in 100th of seconds
;
;Rounding based on the remainder may be added here
;The result in BX:AX is time in 1/100 second.
mov DX,BX
mov CX,200 ;Extract 1/100's
;Division by 200 is necessary to ensure no overflow--max result
;is number of seconds in a day/2 = 43200.
div CX
cmp DL,100 ;Remainder over 100?
jb NOADJ
sub DL,100 ;Keep 1/100's less than 100
NOADJ:
cmc ;If we subtracted 100, carry is now set
mov BL,DL ;Save 1/100's
;To compensate for dividing by 200 instead of 100, we now multiply
;by two, shifting a one in if the remainder had exceeded 100.
rcl AX,1
mov DL,0
rcl DX,1
mov CX,60 ;Divide out seconds
div CX
mov BH,DL ;Save the seconds
div CL ;Break into hours and minutes
xchg AL,AH
;Time is now in AX:BX (hours, minutes, seconds, 1/100 sec)
push AX
MOV AX,SI ; DAYCNT
stosw
pop AX
stosw
mov AX,BX
stosw
jmp EXIT
TIM$READ ENDP
CODE ENDS
END


328
v4.0/src/BIOS/MSCON.ASM Normal file
View File

@ -0,0 +1,328 @@
PAGE ,132 ;
TITLE MSCON - BIOS
%OUT ...MSCON.ASM
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.00 - J.K.
;AC000 - Changed for DOS Version 4.00 - J.K.
;AN00x - PTM number for DOS Version 4.00 - J.K.
;==============================================================================
itest=0
INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT
INCLUDE JUMPMAC.INC
INCLUDE MSEQU.INC
INCLUDE MSMACRO.INC
;*** DOS 3.3 will not support more than 25 rows
; INCLUDE DEVSYM.INC ;J.K. 4/29/86 for CON$GENIOCTL support
; INCLUDE IOCTL.INC ;J.K. 4/29/86 for CON$GENIOCTL support
EXTRN EXIT:NEAR ;MSBIO1
EXTRN BUS$EXIT:NEAR ;MSBIO1
; EXTRN CMDERR:NEAR ;MSBIO1 J.K. 4/29/86
;DATA
EXTRN PTRSAV:DWORD ;MSBIO1
EXTRN FHAVEK09:BYTE ;MSDISK
EXTRN ALTAH:BYTE ;MSBDATA
EXTRN KEYRD_Func:Byte ;MSBDATA
EXTRN KEYSTS_Func:Byte ;MSBDATA
; EXTRN SAV_SC_INFO:BYTE ;MSBDATA J.K. 4/29/86
; EXTRN SAV_SC_MODE:BYTE ;MSBDATA J.K. 4/29/86
;------------------------------------------------------
;
; CONSOLE READ ROUTINE
;
ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT
PUBLIC CON$READ
CON$READ PROC NEAR
JCXZ CON$EXIT
CON$LOOP:
CALL CHRIN ;GET CHAR IN AL
STOSB ;STORE CHAR AT ES:DI
LOOP CON$LOOP
CON$EXIT:
JUMP EXIT
CON$READ ENDP
;---------------------------------------------------------
;
; INPUT SINGLE CHAR INTO AL
;
;J.K.5/12/87 We are going to issue extended keyboard function, if supported.
;The returning value of the extended key stroke of the extended key board
;function uses 0E0h in AL instead of 00 as in the conventional key board
;function. This creates a conflict when the user entered real Greek Alpha
;charater (= 0E0h) to distinguish the extended key stroke and the Greek Alpha.
;This case will be handled in the following manner;
; AH = 16h
; INT 16h
; If AL == 0, then extended code (in AH)
; else If AL == 0E0h, then
; IF AH <> 0, then extended code (in AH)
; else Greek_Alpha character.
;Also, for compatibility reason, if an extended code is detected, then we
;are going to change the value in AL from 0E0h to 00h.
CHRIN PROC NEAR
;AN000;
; XOR AX,AX
mov ah,KEYRD_Func ;AN000; Set by MSINIT. 0 or 10h
xor al,al ;AN000;
XCHG AL,ALTAH ;GET CHARACTER & ZERO ALTAH
OR AL,AL
JNZ KEYRET
;SB34CON000**************************************************************
;SB Keyboard I/O interrupt
;SB AH already contains the keyboard read function number
;SB 1 LOC
int 16h
;SB34CON000**************************************************************
ALT10:
OR AX,AX ;CHECK FOR NON-KEY AFTER BREAK
JZ CHRIN
CMP AX,7200H ;CHECK FOR CTRL-PRTSC
JNZ ALT_Ext_Chk ;AN000;
MOV AL,16
jmp KeyRet ;AN000;
ALT_Ext_Chk:
;SB34CON001**************************************************************
;SB IF operation was extended function (i.e. KEYRD_Func != 0) THEN
;SB IF character read was 0E0h THEN
;SB IF extended byte was zero (i.e. AH == 0) THEN
;SB goto keyret
;SB ELSE
;SB set AL to zero
;SB goto ALT_SAVE
;SB ENDIF
;SB ENDIF
;SB ENDIF
;SB 9 LOCS
cmp BYTE PTR KEYRD_Func,0
jz NOT_EXT
cmp al,0E0h
jnz NOT_EXT
or ah,ah
jz KEYRET
xor al,al
jmp short ALT_SAVE
NOT_EXT:
;SB34CON001**************************************************************
OR AL,AL ;SPECIAL CASE?
JNZ KEYRET
ALT_SAVE:
MOV ALTAH,AH ;STORE SPECIAL KEY
KEYRET:
RET
CHRIN ENDP
;--------------------------------------------------------------
;
; KEYBOARD NON DESTRUCTIVE READ, NO WAIT
;
; PC-CONVERTIBLE-TYPE MACHINE: IF BIT 10 IS SET BY THE DOS IN THE STATUS WORD
; OF THE REQUEST PACKET, AND THERE IS NO CHARACTER IN THE INPUT BUFFER, THE
; DRIVER ISSUES A SYSTEM WAIT REQUEST TO THE ROM. ON RETURN FROM THE ROM, IT
; RETURNS A 'CHAR-NOT-FOUND' TO THE DOS.
;
CONBUSJ:
ASSUME DS:NOTHING
JMP CONBUS
ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT
PUBLIC CON$RDND
CON$RDND:
MOV AL,[ALTAH]
OR AL,AL
JZ RD1
JMP RDEXIT
RD1:
;SB34CON002**************************************************************
;SB Keyboard I/O interrupt
;SB Get keystroke status (KEYSTS_Func)
;SB 2 LOCS
mov ah,KEYSTS_Func
int 16h
;SB34CON002**************************************************************
JZ NOCHR
JMP GOTCHR
NOCHR:
CMP FHAVEK09,0
JZ CONBUSJ
LDS BX,[PTRSAV]
ASSUME DS:NOTHING
TEST [BX].STATUS,0400H ; SYSTEM WAIT ENABLED?
JZ CONBUSJ
;********************************
; NEED TO WAIT FOR IBM RESPONSE TO REQUEST FOR CODE ON HOW TO USE THE SYSTEM
; WAIT CALL.
;********************************
MESSAGE FTESTCON,<"SYSTEM WAIT STAGE",CR,LF>
MOV AX,4100H ; WAIT ON AN EXTERNAL EVENT
; MOV BX,0300H ; NO TIMEOUT
; MOV DX,60H ; LOOK AT I/O PORT 60H
INT 15H ; CALL ROM FOR SYSTEM WAIT
MESSAGE FTESTCON,<"OUT OF WAIT. AX IS ">
MNUM FTESTCON,AX
MESSAGE FTESTCON,<CR,LF>
JMP CONBUS
ASSUME DS:CODE
GOTCHR:
OR AX,AX
JNZ NOTBRK ;CHECK FOR NULL AFTER BREAK
;SB34CON004**************************************************************
;SB Keyboard I/O interrupt
;SB Keyboard read function (KEYRD_Func)
;SB 2 LOCS
mov ah,KEYRD_Func
int 16h
;SB34CON004**************************************************************
JUMP CON$RDND ;AND GET A REAL STATUS
NOTBRK:
CMP AX,7200H ;CHECK FOR CTRL-PRTSC
JNZ RD_Ext_Chk ;AN000;
MOV AL,16
jmp RDEXIT ;AN000;
RD_Ext_Chk: ;AN000;
cmp KEYRD_Func, 0 ;AN000; Extended Keyboard function?
jz RDEXIT ;AN000; No. Normal exit.
cmp al,0E0h ;AN000; Extended key value or Greek Alpha?
jne RDEXIT ;AN000;
cmp ah, 0 ;AN000; Scan code exist?
jz RDEXIT ;AN000; Yes. Greek Alpha char.
mov al, 0 ;AN000; No. Extended key stroke. Change it for compatibility
PUBLIC RDEXIT
RDEXIT:
LDS BX,[PTRSAV]
ASSUME DS:NOTHING
MOV [BX].MEDIA,AL
EXVEC:
JUMP EXIT
CONBUS:
ASSUME DS:NOTHING
JUMP BUS$EXIT
;--------------------------------------------------------------
;
; KEYBOARD FLUSH ROUTINE
;
ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT
PUBLIC CON$FLSH
CON$FLSH:
CALL FLUSH
JUMP EXIT
PUBLIC FLUSH
FLUSH:
MOV [ALTAH],0 ;CLEAR OUT HOLDING BUFFER
FLLOOP:
;SB33012****************************************************************
;SB ; Is there a char there?
mov AH, 1 ;SB ; command code for check status
int 16h ;SB ; call rom-bios keyboard routine
;SB33012****************************************************************
JZ FLDONE
;SB33013****************************************************************
xor AH, AH ;SB ; if zf is nof set, get character
int 16h ;SB ; call rom-bios to get character
;SB33013****************************************************************
JMP FLLOOP
FLDONE:
RET
;----------------------------------------------------------
;
; CONSOLE WRITE ROUTINE
;
ASSUME DS:CODE ; THIS WAS SET BY THE CON DD ENTRY POINT
PUBLIC CON$WRIT
CON$WRIT:
JCXZ EXVEC
CON$LP:
MOV AL,ES:[DI] ;GET CHAR
INC DI
INT CHROUT ;OUTPUT CHAR
LOOP CON$LP ;REPEAT UNTIL ALL THROUGH
JUMP EXIT
;-----------------------------------------------
;
; BREAK KEY HANDLING
;
PUBLIC CBREAK
CBREAK:
MOV CS:ALTAH,3 ;INDICATE BREAK KEY SET
PUBLIC INTRET
INTRET:
IRET
;------------------------------------------------------------------------------
;J.K. 4/29/86 - CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3.
;CON$GENIOCTL supports Get mode information, Set mode information functions.
;It will only save the value from "Set mode information" and will return
;the value through "Get mode information". It is supposed to be set by
;the MODE.COM and other application program can retrieve information
;through "Get mode information" call.
;Initially, there is no valuable informaton until set by MODE command, so
;any attemp to "Get mode information" at that points will fail. (unknown
;command with carry set.)
;At entry: CS = DS = code
; CS:[PTRSAV] has seg, address of the Request Header saved in
; in Strategy routine.
;
; PUBLIC CON$GENIOCTL
; ASSUME DS:CODE
;CON$GENIOCTL:
; les di, CS:[PTRSAV] ;get the request header
; cmp es:[di].MajorFunction, IOC_SC
; je Major_SC_OK
;SC_CMDERR:
; stc
; jmp cmderr ;carry is set, exit to cmderr
;Major_SC_OK:
; mov al, es:[di].MinorFunction ;save minor function
; les di, es:[di].GenericIOCTL_Packet ;pointer of SC_MODE_INFO structure
; mov cx, es:[di].SC_INFO_LENGTH ;save length
; inc di
; inc di ;ES:DI -> SC_MODE in Info. Packet
; cmp cx, SC_INFO_PACKET_LENGTH ;currently 9.
; jne SC_CMDERR ;cannot accept the different packet
; cmp al, GET_SC_MODE ;minor function = 60h ?
; jne SC_SET_MODE_FUNC ;no, check if it is "Set mode function"
; cmp SAV_SC_MODE, 0 ;information set before?
; je SC_CMDERR ;no, cannot get the info.
;;SC_GET_MODE_FUNC: ;es:di -> SC_MODE in info. packet
; ;cx - length
; mov si, offset SAV_SC_INFO
; rep movsb ;ds:si -> sav_sc_info, es:di -> sc_mode
; jmp exit
;
;SC_SET_MODE_FUNC: ;es:di -> SC_MODE
; cmp al, SET_SC_MODE ;minor function = 40h ?
; jne SC_CMDERR
; mov si, offset SAV_SC_INFO
; xchg di, si
; push es
; push ds
; pop es
; pop ds
; rep movsb ;ds:si -> sc_mode, es:di -> sav_sc_info
; jmp exit
;
;J.K. 4/29/86 - End of CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3.
CODE ENDS
END

2443
v4.0/src/BIOS/MSDISK.ASM Normal file

File diff suppressed because it is too large Load Diff

22
v4.0/src/BIOS/MSDSKPR.INC Normal file
View File

@ -0,0 +1,22 @@
; The following structure defines the disk parameter table
; pointed to by Interrupt vector 1EH (location 0:78H)
DISK_PARMS STRUC
DISK_SPECIFY_1 DB ?
DISK_SPECIFY_2 DB ?
DISK_MOTOR_WAIT DB ? ; Wait till motor off
DISK_SECTOR_SIZ DB ? ; Bytes/Sector (2 = 512)
DISK_EOT DB ? ; Sectors per track (MAX)
DISK_RW_GAP DB ? ; Read Write Gap
DISK_DTL DB ?
DISK_FORMT_GAP DB ? ; Format Gap Length
DISK_FILL DB ? ; Format Fill Byte
DISK_HEAD_STTL DB ? ; Head Settle Time (MSec)
DISK_MOTOR_STRT DB ? ; Motor start delay
DISK_PARMS ENDS
ROMStatus equ 1
ROMRead equ 2
ROMWrite equ 3
ROMVerify equ 4
ROMFormat equ 5

76
v4.0/src/BIOS/MSEQU.INC Normal file
View File

@ -0,0 +1,76 @@
%OUT MSEQU.INC...
;==============================================================================
FTOOBIG EQU 80H
FBIG EQU 40H
ROMSTATUS EQU 1
ROMREAD EQU 2
ROMWRITE EQU 3
ROMVERIFY EQU 4
ROMFORMAT EQU 5
VID_SIZE EQU 12
INCLUDE MSBDS.INC ; VARIOUS EQUATES FOR BDS
;AN000; Extended BPB structure.
BPB_TYPE STRUC
SECSIZE DW ?
SECALL DB ?
RESNUM DW ?
FATNUM DB ?
DIRNUM DW ?
SECNUM DW ?
FATID DB ?
FATSIZE DW ?
SLIM DW ?
HLIM DW ?
HIDDEN_L DW ?
HIDDEN_H dw 0 ;J.K.
SECNUM_L dw 0 ;J.K.
SECNUM_H dw 0 ;J.K.
BPB_TYPE ENDS
;;;;;;;;;;;
BOOT_SERIAL_SIZE equ 4 ;J.K.
BOOT_VOLUME_LABEL_SIZE equ 11 ;J.K.
BOOT_SYSTEM_ID_SIZE equ 8 ;J.K.
EXT_BOOT_SIGNATURE equ 41 ;J.K.
RSINIT=0A3H ;RS232 INITIALIZATION
;9600 BAUD:NO PARITY:1 STOP:8 BIT WORD
LF=10 ;LINE FEED
CR=13 ;CARRIAGE RETURN
BACKSP=8 ;BACKSPACE
BRKADR=1BH * 4 ;006C 1BH BREAK VECTOR ADDRESS
TIMADR=1CH * 4 ;0070 1CH TIMER INTERRUPT
DSKADR=1EH * 4 ;ADDRESS OF PTR TO DISK PARAMETERS
SEC9=522H ;ADDRESS OF DISK PARAMETERS
HEADSETTLE=SEC9+9 ; ARR 2.20 ADDRESS OF HEAD SETTLE TIME
NORMSETTLE=15 ; ARR 2.20 NORMAL HEAD SETTLE
SPEEDSETTLE=0 ; ARR 2.20 SPEED UP SETTLE TIME
INITSPOT=534H ; ARR IBM WANTS 4 ZEROS HERE
AKPORT=20H
EOI=20H
CMDLEN = 0 ;LENGTH OF THIS COMMAND
UNIT = 1 ;SUB UNIT SPECIFIER
CMD = 2 ;COMMAND CODE
STATUS = 3 ;STATUS
MEDIA = 13 ;MEDIA DESCRIPTOR
TRANS = 14 ;TRANSFER ADDRESS
COUNT = 18 ;COUNT OF BLOCKS OR CHARACTERS
START = 20 ;FIRST BLOCK TO TRANSFER
EXTRA = 22 ;USUALLY A POINTER TO VOL ID FOR ERROR 15
CHROUT = 29H
MAXERR = 5
LSTDRV = 504H
BOOTBIAS = 200H
NOTBUSYSTATUS = 10000000B ; NOT BUSY
ACKSTATUS = 01000000B ; ACKNOWLEDGE (FOR WHAT?)
NOPAPERSTATUS = 00100000B ; NO MORE PAPER
SELECTEDSTATUS = 00010000B ; THE PRINTER SAID IT WAS SELECTED
IOERRSTATUS = 00001000B ; SOME KINDA ERROR
RESERVED = 00000110B ; NOPS
TIMEOUTSTATUS = 00000001B ; TIME OUT.
ERROR_UNKNOWN_MEDIA = 7 ; FOR USE IN BUILD BPB CALL
PATHGEN = 1

97
v4.0/src/BIOS/MSEXTRN.INC Normal file
View File

@ -0,0 +1,97 @@
; SCCSID = @(#)IBMEXTRN.ASM 1.11 85/11/18
;This is for IBMINIT module.
;=======================================================
;REVISION HISTORY:
;AN000; - NEW Version 4.00. J.K.
;AC000; - Modified Line 4.00. J.K.
;ANxxx; - PTMyyy
;==============================================================================
;AN001; D486 SHARE installation for large media 2/23/88 J.K.
;==============================================================================
EXTRN ORIG13:DWORD,ORIG19:DWORD
EXTRN COM2DEV:WORD,COM1DEV:WORD
EXTRN COM4DEV:WORD,COM3DEV:WORD
EXTRN LPT3DEV:WORD,LPT2DEV:WORD,LPT1DEV:WORD
EXTRN HARDDRV:BYTE,HARDNUM:BYTE,DRVMAX:BYTE,HDSKTAB:WORD
EXTRN DSKDRVS:WORD,HNUM:BYTE,EOT:BYTE,FHAVE96:BYTE
EXTRN REAL13:DWORD,DAYCNT:WORD,CONHEADER:WORD
EXTRN TWOHARD:BYTE,INT_2F_NEXT:DWORD
EXTRN BDSH:WORD,BDSX:WORD,START_BDS:DWORD
EXTRN FHAVEK09:BYTE, NEW_ROM:BYTE
EXTRN SINGLE:BYTE
EXTRN BDSMs:BYTE ;for Mini Disk -J.K. 4/7/86
EXTRN HaveCMOSClock:byte ;set by IBMINIT. Used by IBMCLOCK.ASM
EXTRN BinToBCD:word ;set by IBMINIT. Used by IBMCLOCK.ASM
EXTRN DaycntToDay:word ;set by IBMINIT. Used by IBMCLOCK.ASM
EXTRN OLD13:DWORD
extrn Temp_H:word ;J.K. For 32 bit calculation. IBMDISK
extrn Start_Sec_H:word ;J.K. IBMDISK.
extrn KEYRD_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA.
extrn KEYSTS_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA.
extrn DiskSector:byte ;J.K. IBMBDATA
extrn Bpb_In_Sector:word ;J.K. IBMBDATA
extrn SecPerCLusInSector:Byte ;J.K. IBMBDATA
extrn NumberOfFats:byte ;J.K. IBMBDATA
extrn MediaByte:byte ;J.K. IBMBDATA
extrn Ext_Boot_Sig:Byte ;J.K. IBMBDATA
extrn Boot_Serial_L:Word ;J.K. IBMBDATA
extrn Boot_Serial_H:Word ;J.K. IBMBDATA
extrn Boot_Volume_Label:Byte ;J.K. IBMBDATA
extrn Boot_System_ID:Byte ;J.K. IBMBDATA
extrn Fat_12_ID:Byte ;J.K. IBMDISK
extrn Fat_16_ID:Byte ;J.K. IBMDISK
extrn Vol_No_Name:Byte ;J.K. IBMDISK
extrn MotorStartup:Byte ;J.K. IBMBDATA
extrn DoubleWordMov:Byte ;J.K. IBMDISK
extrn Model_Byte:Byte ;J.K. IBMBIO2
extrn Secondary_Model_Byte:Byte ;J.K. IBMBIO2
IF iTEST
IFNDEF NUMBUF
EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD
ENDIF
ENDIF
EXTRN START$:NEAR,ERROUT:NEAR,BLOCK13:FAR,INT19:FAR
EXTRN INTRET:NEAR,HDRIVE:NEAR,DRIVEX:NEAR,INT13:FAR,CBREAK:NEAR,OUTCHR:NEAR
EXTRN DISKRD:NEAR,MEDIA_PATCH:NEAR,GETBP1_PATCH:NEAR
EXTRN SET_PATCH:NEAR,DISKIO_PATCH:NEAR,DSKERR:NEAR,INIT_PATCH:NEAR
EXTRN TABLE_PATCH:NEAR,EXIT:NEAR,CHANGED_PATCH:NEAR
EXTRN ERRIN:NEAR,GETBP:NEAR,SWPDSK:NEAR
EXTRN OUTCHR:NEAR,WRMSG:NEAR,TIME_TO_TICKS:NEAR
EXTRN INT2F_DISK:NEAR,INSTALL_BDS:NEAR,SETDRIVE:NEAR
extrn Mov_Media_IDs:Near ;J.K.
extrn Clear_IDs:Near ;J.K.
IF iTEST
IFNDEF NUMBUF
EXTRN MSGNUM:NEAR,MSGOUT:NEAR,dumpbytes:near,hex_to_ascii:near
EXTRN outchar:near
ENDIF
ENDIF
SYSINITSEG SEGMENT PUBLIC 'SYSTEM_INIT'
ASSUME CS:SYSINITSEG
EXTRN CURRENT_DOS_LOCATION:WORD
EXTRN FINAL_DOS_LOCATION:WORD
EXTRN DEVICE_LIST:DWORD
EXTRN MEMORY_SIZE:WORD
EXTRN DEFAULT_DRIVE:BYTE
EXTRN BUFFERS:WORD
EXTRN SYSINIT:FAR
extrn Big_Media_Flag:Byte ;AN001;
SYSINITSEG ENDS
ASSUME CS:CODE
; END OF DISK MODULES FOR CONFIGURATION
EXTRN END96TPI:BYTE
EXTRN ENDTWOHARD:BYTE
EXTRN ENDONEHARD:BYTE
EXTRN ENDSWAP:BYTE
EXTRN ENDFLOPPY:BYTE
; IBM FIXED UP AT ROM
EXTRN IBM_DISK_IO:FAR

46
v4.0/src/BIOS/MSGROUP.INC Normal file
View File

@ -0,0 +1,46 @@
EVBOUND = 1 ;THIS VALUE BEING 0 DOES NO BOUNDARY ALLIGNMENT, VALUE 1 ;3.30
; ALIGNS TO EVEN ;3.30
; : : : : : : : : : : : : : : ;3.30
IF EVBOUND ;;IF EVEN (WORD) ALLIGNMENT IS REQUESTED, ;3.30
; : : : : : : : : : : : : : : ;3.30
EVENB MACRO ;3.30
EVEN ;;ADJUST TO EVEN BOUNDARY ;3.30
ENDM ;3.30
;3.30
ODD MACRO ;3.30
;;GENERATE BOUNDARY PADDING TO FORCE ODD OFFSET ;3.30
IF (($-CODE) MOD 2) EQ 0 ;3.30
DB ? ;3.30
ENDIF ;3.30
ENDM ;3.30
;3.30
CODE_SEGMENT MACRO ;3.30
;;ALLIGN THE SEGMENT ON WORD BOUNDARY TO ALLOW FOR EVEN ALLIGNMENT OF DATA;3.30
CODE SEGMENT WORD PUBLIC 'CODE' ;3.30 ;3.30
ENDM ;3.30
;3.30
; : : : : : : : : : : : : : : ;3.30
ELSE ;;SINCE EVEN ALLIGNMENT IS NOT DESIRED, JUST USE BYTE ALLI;3.30 GNMENT
; : : : : : : : : : : : : : : ;3.30
;3.30
EVENB MACRO ;3.30
;;REQUEST FOR WORD ALLIGNMENT DOES NOTHING ;3.30
ENDM ;3.30
;3.30
ODD MACRO ;3.30
;;REQUEST FOR ODD ALLIGNMENT DOES NOTHING ;3.30
ENDM ;3.30
;3.30
CODE_SEGMENT MACRO ;3.30
;;SEGMENT IS ALLIGNED ON BYTE BOUNDARY FOR MINIMUM SIZE OF GENERATION ;3.30
CODE SEGMENT BYTE PUBLIC 'CODE' ;3.30
ENDM ;3.30
;3.30
; : : : : : : : : : : : : : : ;3.30
ENDIF ;3.30
; : : : : : : : : : : : : : : ;3.30
;3.30
CODE_SEGMENT ;3.30
ASSUME CS:CODE ;3.30
;3.30


427
v4.0/src/BIOS/MSHARD.ASM Normal file
View File

@ -0,0 +1,427 @@
;***
; Title: Disk
; C: (C) Copyright 1988 by Microsoft corp.
; Date: 1/11/85
;
; There is a bug in some versions of IBM's AT ROM BIOS.
; Interrupts are not disabled during read operations.
;
; Use: This program should be chained in line with the disk
; interupt 13h, it intercepts read calls to the hard disk
; and handles them appropriately. For other functions it
; passes controll to OLD13, which should contain the
; address of the AT ROM disk routine. The entry point for
; this program is IBM_DISK_IO.
;
.286c ;Use 80286 non-protected mode
BIOSEG = 040h ;Segment for ROM BIOS Data
ROMSEG = 0F000h ;Segment of ROM
BAD_DISK = 01
HF_PORT = 01F0h
HF_REG_PORT = 03F6h
;* Offsets into Fixed disk parameter table
FDP_PRECOMP = 5
FDP_CONTROL = 8
DATA SEGMENT AT BIOSEG ;ROM BIOS data segment
ORG 42h
CMD_BLOCK DB 6 DUP (?)
;* Offsets into CMD_BLOCK for registers
PRE_COMP = 0 ;Write Pre-compensation
SEC_CNT = 1 ;Sector count
SEC_NUM = 2 ;Sector number
CYL_LOW = 3 ;Cylinder number, low part
CYL_HIGH = 4 ;Cylinder number, high part
DRV_HEAD = 5 ;Drive/Head (Bit 7 = ECC mode, Bit 5 = 512 byte sectors,
; Bit 4 = drive number, Bits 3-0 have head number)
CMD_REG = 6 ;Command register
ORG 074h
DISK_STATUS1 DB ?
HF_NUM DB ?
CONTROL_BYTE DB ?
DATA ENDS
;*** Define where the ROM routines are actually located
ROM SEGMENT AT ROMSEG
ORG 02E1Eh
ROMCOMMAND PROC FAR
ROMCOMMAND ENDP
ORG 02E7Fh
ROMWAIT PROC FAR
ROMWAIT ENDP
ORG 02EE2h
ROMWAIT_DRQ PROC FAR
ROMWAIT_DRQ ENDP
ORG 02EF8h
ROMCHECK_STATUS PROC FAR
ROMCHECK_STATUS ENDP
ORG 02F69h
ROMCHECK_DMA PROC FAR
ROMCHECK_DMA ENDP
ORG 02F8Eh
ROMGET_VEC PROC FAR
ROMGET_VEC ENDP
ORG 0FF65h
ROMFRET PROC FAR ;Far return at F000:FF65 in AT ROM.
ROMFRET ENDP
ROM ENDS
CODE SEGMENT BYTE PUBLIC 'code'
EXTRN OLD13:DWORD ;Link to AT bios int 13h
PUBLIC IBM_DISK_IO
ASSUME CS:CODE
ASSUME DS:DATA
;*** IBM_DISK_IO - main routine, fixes AT ROM bug
;
; ENTRY: (AH) = function, 02 or 0A for read.
; (DL) = drive number (80h or 81h).
; (DH) = head number.
; (CH) = cylinder number.
; (CL) = Sector number (high 2 bits has cylinder number).
; (AL) = number of sectors.
; (ES:BX) = address of read buffer.
; For more on register contents see ROM BIOS listing.
; Stack set up for return by an IRET.
;
; EXIT: (AH) = status of current operation.
; (CY) = 1 IF failed, 0 if successful.
; For other register contents see ROM BIOS listing.
;
; USES:
;
;
; WARNING: Uses OLD13 vector for non-read calls.
; Does direct calls to the AT ROM.
; Does segment arithmatic.
;
; EFFECTS: Performs DISK I/O operation.
;
IBM_DISK_IO PROC FAR
CMP DL, 80h
JB ATD1 ;Pass through floppy disk calls.
CMP AH, 02
JE ATD2 ;Intercept call 02 (read sectors).
CMP AH, 0Ah
JE ATD2 ;and call 0Ah (read long).
ATD1:
JMP OLD13 ;Use ROM INT 13h handler.
ATD2:
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
PUSH ES
PUSH AX
MOV AX,BIOSEG ;Establish BIOS segment addressing.
MOV DS,AX
MOV DISK_STATUS1, 0 ;Initially no error code.
AND DL, 07fh ;Mask to hard disk number
CMP DL, HF_NUM
JB ATD3 ;Disk number in range
MOV DISK_STATUS1, BAD_DISK
JMP SHORT ATD4 ;Disk number out of range error, return
ATD3:
PUSH BX
MOV AX, ES ;Make ES:BX to Seg:000x form.
SHR BX, 4
ADD AX, BX
MOV ES, AX
POP BX
AND BX,000Fh
PUSH CS
CALL CHECK_DMA
JC ATD4 ;Abort if DMA across segment boundary
POP AX ;Restore AX register for SETCMD
PUSH AX
CALL SETCMD ;Set up command block for disk op
MOV DX, HF_REG_PORT
OUT DX, AL ;Write out command modifier
CALL DOCMD ;Carry out command
ATD4:
;; Old code - Carry cleared after set by logical or opearation
;; POP AX
;; MOV AH,DISK_STATUS1 ;On return AH has error code
;; STC
;; OR AH,AH
;; JNZ ATD5 ;Carry set if error
;; CLC
;;---------------------------------------------------
;; New Code - Let Logical or clear carry and then set carry if ah!=0
;; And save a couple bytes while were at it.
POP AX
MOV AH,DISK_STATUS1 ;On return AH has error code
OR AH,AH
JZ ATD5 ;Carry set if error
STC
ATD5:
POP ES
POP DS
POP DI
POP DX
POP CX
POP BX
RET 2 ;Far return, dropping flags
IBM_DISK_IO ENDP
;*** SETCMD - Set up CMD_BLOCK for the disk operation
;
; ENTRY: (DS) = BIOS Data segment.
; (ES:BX) in seg:000x form.
; Other registers as in INT 13h call
;
; EXIT: CMD_BLOCK set up for disk read call.
; CONTROL_BYTE set up for disk operation.
; (AL) = Control byte modifier
;
;
; Sets the fields of CMD_BLOCK using the register contents
; and the contents of the disk parameter block for the given drive.
;
; WARNING: (AX) destroyed.
; Does direct calls to the AT ROM.
;
SETCMD PROC NEAR
MOV CMD_BLOCK[SEC_CNT], AL
MOV CMD_BLOCK[CMD_REG], 020h ;Assume function 02
CMP AH, 2
JE SETC1 ;CMD_REG = 20h if function 02 (read)
MOV CMD_BLOCK[CMD_REG], 022h ;CMD_REG = 22h if function 0A (" long)
SETC1: ;No longer need value in AX
MOV AL, CL
AND AL, 03fh ;Mask to sector number
MOV CMD_BLOCK[SEC_NUM], AL
MOV CMD_BLOCK[CYL_LOW], CH
MOV AL, CL
SHR AL, 6 ;Get two high bits of cylender number
MOV CMD_BLOCK[CYL_HIGH], AL
MOV AX, DX
SHL AL, 4 ;Drive number
AND AH, 0Fh
OR AL, AH ;Head number
OR AL, 0A0h ;Set ECC and 512 bytes per sector
MOV CMD_BLOCK[DRV_HEAD], AL
PUSH ES ;GET_VEC destroys ES:BX
PUSH BX
PUSH CS
CALL GET_VEC
MOV AX, ES:FDP_PRECOMP[BX] ;Write pre-comp from disk parameters
SHR AX, 2
MOV CMD_BLOCK[PRE_COMP],AL ;Only use low part
MOV AL, ES:FDP_CONTROL[BX] ;Control byte modifier
POP BX
POP ES
MOV AH, CONTROL_BYTE
AND AH, 0C0h ;Keep disable retry bits
OR AH, AL
MOV CONTROL_BYTE, AH
RET
SETCMD ENDP
;*** DOCMD - Carry out READ operation to AT hard disk
;
; ENTRY: (ES:BX) = address for read in data.
; CMD_BLOCK set up for disk read.
;
; EXIT: Buffer at (ES:BX) contains data read.
; DISK_STATUS1 set to error code (0 if success).
;
;
;
; WARNING: (AX), (BL), (CX), (DX), (DI) destroyed.
; No check is made for DMA boundary overrun.
;
; EFFECTS: Programs disk controller.
; Performs disk input.
;
DOCMD PROC NEAR
MOV DI, BX ;(ES:DI) = data buffer addr.
PUSH CS
CALL COMMAND
JNZ DOC3
DOC1:
PUSH CS
CALL WAITT ;Wait for controller to complete read
JNZ DOC3
MOV CX, 100h ;256 words per sector
MOV DX, HF_PORT
CLD ;String op goes up
CLI ;Disable interrupts (BUG WAS FORGETTING THIS)
REPZ INSW ;Read in sector
STI
TEST CMD_BLOCK[CMD_REG], 02
JZ DOC2 ;No ECC bytes to read.
PUSH CS
CALL WAIT_DRQ
JC DOC3
MOV CX, 4 ;4 bytes of ECC
MOV DX, HF_PORT
CLI
REPZ INSB ;Read in ECC
STI
DOC2:
PUSH CS
CALL CHECK_STATUS
JNZ DOC3 ;Operation failed
DEC CMD_BLOCK[SEC_CNT]
JNZ DOC1 ;Loop while more sectors to read
DOC3:
RET
DOCMD ENDP
;*** GET_VEC - Get pointer to hard disk parameters.
;
; ENTRY: (DL) = Low bit has hard disk number (0 or 1).
;
; EXIT: (ES:BX) = address of disk parameters table.
;
; USES: AX for segment computation.
;
; Loads ES:BX from interrupt table in low memory, vector 46h (disk 0)
; or 70h (disk 1).
;
; WARNING: (AX) destroyed.
; This does a direct call to the AT ROM.
;
GET_VEC PROC NEAR
PUSH OFFSET ROMFRET
JMP ROMGET_VEC
GET_VEC ENDP
;*** COMMAND - Send contents of CMD_BLOCK to disk controller.
;
; ENTRY: Control_byte
; CMD_BLOCK - set up with values for hard disk controller.
;
; EXIT: DISK_STATUS1 = Error code.
; NZ if error, ZR for no error.
;
;
; WARNING: (AX), (CX), (DX) destroyed.
; Does a direct call to the AT ROM.
;
; EFFECTS: Programs disk controller.
;
COMMAND PROC NEAR
PUSH OFFSET ROMFRET
JMP ROMCOMMAND
COMMAND ENDP
;*** WAITT - Wait for disk interrupt
;
; ENTRY: Nothing.
;
; EXIT: DISK_STATUS1 = Error code.
; NZ if error, ZR if no error.
;
;
; WARNING: (AX), (BL), (CX) destroyed.
; Does a direct call to the AT ROM.
;
; EFFECTS: Calls int 15h, function 9000h.
;
WAITT PROC NEAR
PUSH OFFSET ROMFRET
JMP ROMWAIT
WAITT ENDP
;*** WAIT_DRQ - Wait for data request.
;
; ENTRY: Nothing.
;
; EXIT: DISK_STATUS1 = Error code.
; CY if error, NC if no error.
;
;
; WARNING: (AL), (CX), (DX) destroyed.
; Does a direct call to the AT ROM.
;
WAIT_DRQ PROC NEAR
PUSH OFFSET ROMFRET
JMP ROMWAIT_DRQ
WAIT_DRQ ENDP
;*** CHECK_STATUS - Check hard disk status.
;
; ENTRY: Nothing.
;
; EXIT: DISK_STATUS1 = Error code.
; NZ if error, ZR if no error.
;
;
; WARNING: (AX), (CX), (DX) destroyed.
; Does a direct call to the AT ROM.
;
CHECK_STATUS PROC NEAR
PUSH OFFSET ROMFRET
JMP ROMCHECK_STATUS
CHECK_STATUS ENDP
;*** CHECK_DMA - check for DMA overrun 64k segment.
;
; ENTRY: (ES:BX) = addr. of memory buffer in seg:000x form.
; CMD_BLOCK set up for operation.
;
; EXIT: DISK_STATUS1 - Error code.
; CY if error, NC if no error.
;
;
; WARNING: Does a direct call to the AT ROM.
;
CHECK_DMA PROC NEAR
PUSH OFFSET ROMFRET
JMP ROMCHECK_DMA
CHECK_DMA ENDP
CODE ENDS
END

2819
v4.0/src/BIOS/MSINIT.ASM Normal file

File diff suppressed because it is too large Load Diff

1362
v4.0/src/BIOS/MSIOCTL.INC Normal file

File diff suppressed because it is too large Load Diff

1090
v4.0/src/BIOS/MSLOAD.ASM Normal file

File diff suppressed because it is too large Load Diff

7
v4.0/src/BIOS/MSLOAD.INC Normal file
View File

@ -0,0 +1,7 @@
;MSLOAD.INC
End_Of_File equ 0FFh
FAT12_Bit equ 01h
FAT16_Bit equ 04h
ROM_TELETYPE equ 14 ;INT 10h, Teletype function
NUM_DIR_PER_SECTOR equ 16 ; number of directory entries per sector

270
v4.0/src/BIOS/MSLPT.ASM Normal file
View File

@ -0,0 +1,270 @@
PAGE ,132 ;
TITLE MSLPT - BIOS
%OUT ...MSLPT.ASM
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.00 - J.K.
;AC000 - Changed for DOS Version 4.00 - J.K.
;AN00x - PTM number for DOS Version 4.00 - J.K.
;==============================================================================
;AN001 - P156 KBMLPT device driver's retry logic. 8/18/87 J.K.
;==============================================================================
itest=0
INCLUDE MSGROUP.INC ;DEFINE CODE SEGMENT
INCLUDE MSEQU.INC
INCLUDE MSMACRO.INC
INCLUDE DEVSYM.INC
INCLUDE IOCTL.INC
EXTRN BUS$EXIT:NEAR ;MSBIO1
EXTRN ERR$CNT:NEAR ;MSBIO1
EXTRN CMDERR:NEAR ;MSBIO1
EXTRN GETDX:NEAR ;MSBIO1
EXTRN EXIT:NEAR ;MSBIO1
EXTRN ERR$EXIT:NEAR ;MSBIO1
;DATA
EXTRN PTRSAV:DWORD ;MSBIO1
EXTRN TIMDEV:WORD ;MSCLOCK
EXTRN LPT2DEV:WORD ;MSBIO2
EXTRN WAIT_COUNT:WORD ;MSDATA
EXTRN PRINTDEV:BYTE ;MSDATA
; IBM ROM STATUS BITS (I DON'T TRUST THEM, NEITHER SHOULD YOU)
NOTBUSYSTATUS = 10000000B ; NOT BUSY
ACKSTATUS = 01000000B ; ACKNOWLEDGE (FOR WHAT?)
NOPAPERSTATUS = 00100000B ; NO MORE PAPER
SELECTEDSTATUS = 00010000B ; THE PRINTER SAID IT WAS SELECTED
IOERRSTATUS = 00001000B ; SOME KINDA ERROR
RESERVED = 00000110B ; NOPS
TIMEOUTSTATUS = 00000001B ; TIME OUT.
; WARNING!!! THE IBM ROM DOES NOT RETURN JUST ONE BIT. IT RETURNS A
; WHOLE SLEW OF BITS, ONLY ONE OF WHICH IS CORRECT.
;----------------------------------------------------------
;J.K. AN001; PRN$WRIT will retry only if error code is TIMEOUT.
; WRITE TO PRINTER DEVICE
; CX HAS COUNT OF BYTES
; ES:DI POINT TO DESTINATION
; AUXNUM HAS PRINTER NUMBER
PUBLIC PRN$WRIT
PRN$WRIT PROC NEAR
ASSUME DS:CODE ; SET BY PRINTER DEVICE DRIVER ENTRY
jcxz Prn$Done ;No char to output
Prn$Loop:
mov bx, 2 ;Initialize retry count
Prn$Out:
;SB34LPT000****************************************************************
;SB Print the character at ES:[DI]
;SB Call the function PrnOP to do this
;SB The character to be printed goes in AL and the function code
;SB for 'Output character' goes in AH
;SB Check for error in printing.
;SB If there is no error go to print the next character.
;SB If there is an error indicated see if it is due to TIMEOUT. If the
;SB error is not TIMEOUT then we can do nothing about it. Just go to
;SB print the next character. If it is due to timeout we can execute
;SB the code to retry the print which follows this piece of code
;SB LOCS: 6
mov al,es:[di] ; assume AX disposible since enter
xor ah,ah ; via int 21h
call PrnOp ; print to printer
jz Prn$Con ; no error - continue
test ah,TIMEOUTSTATUS
jz Prn$Con ; NOT time out - continue
;SB34LPT000****************************************************************
dec bx ;Retry until count is exhausted.
jnz Prn$Out ;Retry it.
jmp short Pmessg ;Return with error.
;
; next character
;
Prn$Con:
inc di ;point to next char and continue
loop Prn$Loop
Prn$Done:
jmp Exit
Pmessg:
jmp Err$Cnt
PRN$WRIT endp
; JCXZ EXVEC3 ; NO CHARS TO OUTPUT..
;PRN$LOOP:
; MOV BX,2 ; INITIALIZE RETRY FLAG
;PRN$OUT:
; MOV AL,ES:[DI] ; GET CHAR INTO AL
; INC DI ; POINT TO NEXT CHAR
; XOR AH,AH ; AH=0 => OUTPUT CHAR IN DL
; CALL PRNOP ; TO INDICATE PRINT CHAR IN AL
; JNZ PRRETRY
; LOOP PRN$LOOP
;EXVEC3:
; JMP EXIT
;PRRETRY:
; DEC DI ; UNDO THE INC ABOVE...
; DEC BX
; JNZ PRN$OUT
;PMESSG:
; JMP ERR$CNT ;RETURN WITH THE ERROR
;PRN$WRIT ENDP
;--------------------------------------------------------
; PRINTER STATUS ROUTINE
PUBLIC PRN$STAT
PRN$STAT PROC NEAR
ASSUME DS:CODE ; SET BY PRINTER DEVICE DRIVER ENTRY
CALL PRNSTAT ;DEVICE IN DX
JNZ PMESSG ; OTHER ERRORS WERE FOUND
;J.K. The next three lines are commented out, since it is a dead code.
; MOV AL,9 ; AGAIN, ASSUME OUT OF PAPER...
; TEST AH,NOPAPERSTATUS
; JNZ PMESSG
TEST AH,NOTBUSYSTATUS
jnz Prn$Done ;No error. Exit
JMP BUS$EXIT
PRN$STAT ENDP
; TAKE THE APPROPRIATE PRINTER AND DO THE OPERATION. TRIAGE THE STATUS
; RETURNED IN AH INTO SOME MEANINGFUL ERROR.
PRNSTAT PROC NEAR
;SB33037**********************************************************************
mov AH, 2 ; set command for get status ;SB ;3.30*
PRNOP: ;SB ;3.30*
call GETDX ; determine which printer ;SB ;3.30*
int 17h ; call ROM-BIOS printer routine ;SB;3.30*
;SB33037**********************************************************************
; EXAMINE THE STATUS BITS TO SEE IF AN ERROR OCCURRED. UNFORTUNATELY, SEVERAL
; OF THE BITS ARE SET SO WE HAVE TO PICK AND CHOOSE. WE MUST BE EXTREMELY
; CAREFUL ABOUT BREAKING BASIC.
TEST AH,IOERRSTATUS ; I/O ERROR?
JZ CHECKNOTREADY ; NO, TRY NOT READY
; AT THIS POINT, WE KNOW WE HAVE AN ERROR. THE CONVERSE IS NOT TRUE.
MOV AL,9 ; FIRST, ASSUME OUT OF PAPER
TEST AH,NOPAPERSTATUS ; OUT OF PAPER SET?
JNZ RET1 ; YES, ERROR IS SET
INC AL ; INDICATE I/O ERROR
RET1:
; WE HAVE TRIAGED NOW FOR OUT OF PAPER AND IO ERR (IGNORING TIME-OUT)
RET ; RETURN WITH ERROR
; THE BITS SAID NO ERROR. UNFORTUNATELY, THERE MAY BE OTHER THINGS AT WORK
; HERE.
CHECKNOTREADY:
MOV AL,2 ; ASSUME NOT-READY
TEST AH,TIMEOUTSTATUS ; IS TIME-OUT SET?
; IF NZ THEN ERROR, ELSE OK???
PRNOP2:
RET
PRNSTAT ENDP
; OUTPUT UNTIL BUSY. THIS ENTRY POINT IS USED EXCLUSIVELY BY THE PRINT
; SPOOLERS. UNDER NO CURCUMSTANCES SHOULD THE DEVICE DRIVER BLOCK WAITING FOR
; THE DEVICE TO BECOME READY.
; INPUTS: CX HAS COUNT OF BYTES TO OUTPUT.
; ES:DI POINTS TO SOURCE BUFFER
; OUTPUTS: SET THE NUMBER OF BYTES TRANSFERRED APPROPRIATELY
PUBLIC PRN$TILBUSY
PRN$TILBUSY PROC NEAR
ASSUME DS:CODE ; SET BY PRINTER DEVICE DRIVER ENTRY
PUSH DS
PUSH ES
POP DS ; NOW ES AND DS BOTH POINT TO SOURCE BUFFER
ASSUME DS:NOTHING
MOV SI,DI ; EVERYTHING IS SET FOR LODSB
PRN$TILBLOOP:
PUSH CX
PUSH BX
XOR BX,BX
MOV BL,CS:[PRINTDEV]
SHL BX,1
MOV CX,CS:WAIT_COUNT[BX] ; WAIT COUNT TIMES TO COME READY
POP BX
PRN$GETSTAT:
CALL PRNSTAT ; GET STATUS
JNZ PRN$BPERR ; ERROR
TEST AH,10000000B ; READY YET?
LOOPZ PRN$GETSTAT ; NO, GO FOR MORE
POP CX ; GET ORIGINAL COUNT
JZ PRN$BERR ; STILL NOT READY => DONE
LODSB
XOR AH,AH
CALL PRNOP
JNZ PRN$BERR ; ERROR
LOOP PRN$TILBLOOP ; GO FOR MORE
PRN$B:
POP DS
LDS BX,CS:[PTRSAV]
ASSUME DS:NOTHING
SUB WORD PTR [BX].COUNT,CX ;# OF SUCCESSFUL I/O'S
JMP EXIT
PRN$TILBUSY ENDP
PRN$BPERR PROC NEAR
ASSUME DS:CODE
POP CX
PRN$BERR:
POP DS
LDS BX,CS:[PTRSAV]
ASSUME DS:NOTHING
SUB WORD PTR [BX].COUNT,CX ;# OF SUCCESSFUL I/O'S
JMP ERR$EXIT
PRN$BPERR ENDP
;
; MANIPULATES THE VALUE IN WAIT_COUNT DEPENDING ON THE VALUE PASSED IN THE
; GENERIC IOCTL PACKET.
; IT EITHER SETS OR RETURNS THE CURRENT VALUE FOR THE RETRY COUNT FOR THE
; DEVICE.
;
PUBLIC PRN$GENIOCTL
PRN$GENIOCTL PROC NEAR
ASSUME DS:CODE ; SET BY PRINTER DEVICE DRIVER ENTRY
LES DI,[PTRSAV]
CMP ES:[DI].MAJORFUNCTION,IOC_PC
JE PRNFUNC_OK
PRNFUNCERR:
JMP CMDERR
PRNFUNC_OK:
MOV AL,ES:[DI].MINORFUNCTION
LES DI,ES:[DI].GENERICIOCTL_PACKET
XOR BX,BX
MOV BL,[PRINTDEV] ; GET INDEX INTO RETRY COUNTS
SHL BX,1
MOV CX,WAIT_COUNT[BX] ; PULL OUT RETRY COUNT FOR DEVICE
CMP AL,GET_RETRY_COUNT
JZ PRNGETCOUNT
CMP AL,SET_RETRY_COUNT
JNZ PRNFUNCERR
MOV CX,ES:[DI].RC_COUNT
PRNGETCOUNT:
MOV WAIT_COUNT[BX],CX ; PLACE "NEW" RETRY COUNT
MOV ES:[DI].RC_COUNT,CX ; RETURN CURRENT RETRY COUNT
JMP EXIT
PRN$GENIOCTL ENDP
CODE ENDS
END

192
v4.0/src/BIOS/MSMACRO.INC Normal file
View File

@ -0,0 +1,192 @@
;
; This file contains three macros used in debugging the system. If the
; variable "itest" (in msbio.asm) is nonzero code is included in the
; modules to print debugging messages. The level of debugging is controlled
; by the value of the variable fTestBits in msbio.asm. Specific bits in
; the variable determine which messages to print. The equ's below tell
; which bits control which funcitons. For example the fifth bit
; cooresponds to disk activity (see fTestDisk equ below).
;
; The macros in the file are:
;
; message Prints an ascii string on the screen.
; Example usage:
;
; message fTestDisk, <"Start Disk Write", CR, LF>
; message fTestINIT, <"Begin BDS initialization">
;
;
; MNUM Print the value in a register or memory location on
; the screen. Value is displayed in hex.
; Usage:
; MNUM bitpattern, valueLocation
;
; valueLocation is typically a regester:
;
; mnum fTestCom, AX
; mnum fTestDisk, DX
;
; ValueLocation can also be a memory location:
;
; mnum fTestINIT, Final_Dos_Location
;
; If no valueLocation is given the macro defaults to
; the BX register.
;
; ZWAIT Stops the program until any key is pressed.
;
;
; The three macros preserve all register values. If "test" is zero
; defined during assembly then the marco produce no code.
;
IF iTEST ;3.30
IFNDEF MSGOUT ;3.30
EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30
ENDIF ;3.30
IFNDEF NUMBUF ;3.30
EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30
ENDIF ;3.30
IFNDEF DUMPBYTES ;3.30
EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30
ENDIF ;3.30
fTestALL equ 1111111111111111b ; watch everything
fTestHARD equ 0000000000000001b ; watch hard disk initialization
fTest96 equ 0000000000000010b ; watch 96 tpi activity
FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30
FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30
FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30
FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30
FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE
FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30
;
; message macro -- see above for description
;
MESSAGE MACRO Bits,msg
LOCAL A,B ;3.30
jmp SHORT b
a: db msg,0
b: push SI
push AX
mov AX,Bits
mov SI,OFFSET a
call MSGOUT
pop AX
pop SI
endm
;
; mnum macro -- see above for description
;
MNum MACRO Bits,num
push AX
ifb <num>
mov AX,Bits
call MSGNUM
else
push BX
mov BX,num
mov AX,Bits
call MSGNUM
pop BX
endif
pop AX
endm
;
; zwait macro -- see above for description
;
ZWAIT MACRO
Message fTestALL,<"? ">
CALL ZWAITrtn
ENDM
ZWAITrtn:
pushf ; save the flags
push AX ; preserve AX
xor AH, AH ; set command to get character ;3.30*
int 16h ; call rom keyboard routine ;3.30*
pop AX ; restore AX
popf ; restore the flags
ret
;Dump_byte dumps the memory contents in hex. ;3.30
;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30
DUMP_BYTE MACRO DUMPSEG, DUMPOFFLABEL, BYTELENGTH ;3.30
push es ;3.30
PUSH DS ;3.30
PUSH SI ;3.30
PUSH CX ;3.30
;3.30
MOV CX, DUMPSEG ;3.30
MOV DS, CX ;3.30
MOV SI, OFFSET DUMPOFFLABEL ;3.30
MOV CX, BYTELENGTH ;3.30
call dumpbytes ;3.30
;3.30
POP CX ;3.30
POP SI ;3.30
POP DS ;3.30
pop es ;3.30
ENDM ;3.30
;3.30
;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30
;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30
DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30
push es ;3.30
PUSH DS ;3.30
PUSH SI ;3.30
PUSH CX ;3.30
;3.30
MOV CX, DUMPSEG ;3.30
MOV DS, CX ;3.30
MOV SI, DUMPOFFREG ;3.30
MOV CX, BYTELENGTH ;3.30
call dumpbytes ;3.30
;3.30
POP CX ;3.30
POP SI ;3.30
POP DS ;3.30
pop es ;3.30
ENDM ;3.30
else
; if test is not defined then make macro into null statements
Message macro
ENDM
MNUM macro
ENDM
ZWAIT macro
ENDM
DUMP_BYTE MACRO ;3.30
ENDM ;3.30
DUMP_BYTE_REG MACRO ;3.30
ENDM ;3.30
ENDIF ;3.30
;3.30
PATHSTART MACRO INDEX,ABBR ;3.30
IFDEF PATHGEN ;3.30
PUBLIC ABBR&INDEX&S,ABBR&INDEX&E ;3.30
ABBR&INDEX&S LABEL BYTE ;3.30
ENDIF ;3.30
ENDM ;3.30
;3.30
PATHEND MACRO INDEX,ABBR ;3.30
IFDEF PATHGEN ;3.30
ABBR&INDEX&E LABEL BYTE ;3.30
ENDIF ;3.30
ENDM ;3.30

306
v4.0/src/BIOS/MSSTACK.INC Normal file
View File

@ -0,0 +1,306 @@
; MSStack.inc
;
; Interrupt level 2, 3, 4, 5, 6, 7,(10, 11, 12, 14, 15 - AT level)
; should follow the standard Interrupt Sharing Scheme which has
; a standard header structure.
; Fyi, the following shows the relations between
; the interrupt vector and interrupt level.
; VEC(Hex) 2 8 9 A B C D E 70 72 73 74 76 77
; LVL(Deci) 9 0 1 2 3 4 5 6 8 10 11 12 14 15
; MSSTACK module modifies the following interrupt vectors
; to meet the standard Interrupt Sharing standard;
; A, B, C, D, E, 72, 73, 74, 76, 77.
; Also, for interrupt level 7 and 15, the FirstFlag in a standard header
; should be initialized to indicat whether this interrupt handler is
; the first (= 80h) or not. The FirstFlag entry of INT77h's
; program header is initialized in STKINIT.INC module.
; FirstFlag is only meaningful for interrupt level 7 and 15.
;
; User specifies the number of stack elements - default = 9
; minimum = 8
; maximum = 64
;
; Intercepts Asynchronous Hardware Interrupts only
;
; Picks a stack from pool of stacks and switches to it
;
; Calls the previously saved interrupt vector after pushing flags
;
; On return, returns the stack to the stack pool
;
; This is a modification of STACKS:
; 1. To fix a bug which was causing the program to take up too much space.
; 2. To dispense stack space from hi-mem first rather than low-mem first.
; . Clobbers the stack that got too big instead of innocent stack
; . Allows system to work if the only stack that got too big was the most
; deeply nested one
; 3. Disables NMI interrupts while setting the NMI vector.
; 4. Does not intercept any interupts on a PCjr.
; 5. Double checks that a nested interrupt didn't get the same stack.
; 6. Intercepts Ints 70, 72-77 for PC-ATs and other future products
;The following variables are for MSSTACK.inc
EVEN
dw 0 ; SPARE FIELD BUT LEAVE THESE IN ORDER
StackCount dw 0
StackAt dw 0
StackSize dw 0
Stacks dw 0
dw 0
FirstEntry dw Stacks
LastEntry dw Stacks+(DefaultCount*EntrySize)-EntrySize
NextEntry dw Stacks+(DefaultCount*EntrySize)-EntrySize
;End of variables defined for MSSTACK.
;*******************************************************************
;Macro Interrupt handler for the ordinary interrupt vectors and
;the shared interrupt vectors.
;*****************************
Stack_Main MACRO AA
ASSUME DS:NOTHING
ASSUME ES:NOTHING
ASSUME SS:NOTHING
PUBLIC Int&AA
PUBLIC Old&AA
;-----------------------------
ife IntSharingFlag ;if not IntSharingFlag
;-----------------------------
Old&AA DD 0
Int&AA PROC FAR
;-----------------------------
else ;for shared interrupt. A Header exists.
PUBLIC FirstFlag&AA
Int&AA PROC FAR
jmp short Entry_Int&AA&_Stk
Old&AA dd 0 ;Forward pointer
dw 424Bh ;compatible signature for Int. Sharing
FirstFlag&AA db 0 ;the firstly hooked.
jmp short Intret_&AA ;Reset routine. We don't care this.
db 7 dup (0) ;Reserved for future.
Entry_Int&AA&_Stk:
;-----------------------------
endif
;-----------------------------
;
; Keyboard interrupt must have a three byte jump, a NOP and a zero byte
; as its first instruction for compatibility reasons
ifidn <&aa>,<09>
jmp Keyboard_lbl
nop
db 0
Keyboard_lbl label near
endif
; This patches INTERRUPT 75h to be "unhooked". We do this Wierdness,
; rather than never hooking INT 75h, to maintain maximum compat. with IBMs
; post production patch.
push ax
ifidn <&aa>,<02>
; *********************************************************************
;
; This is special support for the PC Convertible / NMI handler
;
; On the PC Convertible, there is a situation where an NMI can be
; caused by using the "OUT" instructions to certain ports. When this
; occurs, the PC Convertible hardware *GUARANTEES* that **NOTHING**
; can stop the NMI or interfere with getting to the NMI handler. This
; includes other type of interrupts (hardware and software), and
; also includes other type of NMI's. When any NMI has occured,
; no other interrtupt (hardware, software or NMI) can occur until
; the software takes specific steps to allow further interrupting.
;
; For PC Convertible, the situation where the NMI is generated by the
; "OUT" to a control port requires "fixing-up" and re-attempting. In
; otherwords, it is actually a "restartable exception". In this
; case, the software handler must be able to get to the stack in
; order to figure out what instruction caused the problem, where
; it was "OUT"ing to and what value it was "OUT"ing. Therefore,
; we will not switch stacks in this situation. This situation is
; detected by interrogating port 62h, and checking for a bit value
; of 80h. If set, *****DO NOT SWITCH STACKS*****.
;
; *********************************************************************
push es
mov ax,0f000h
mov es,ax
cmp byte ptr es:[0fffeh],mdl_convert ;check if convertible
pop es
jne Normal&aa
in al,62h
test al,80h
jz Normal&aa
Special&aa:
pop ax
jmp dword ptr Old&aa
Normal&aa:
; *********************************************************************
endif
push bp
push es
mov es, cs:[STACKS+2] ; Get segment of stacks
mov bp,NextEntry ; get most likely candidate
mov al,Allocated
xchg AllocByte,al ; grab the entry
cmp al,Free ; still avail?
jne NotFree&aa
sub NextEntry,EntrySize ; set for next interrupt
Found&aa:
mov SavedSP,sp ; save sp value
mov SavedSS,ss ; save ss also
; mov IntLevel,aa&h ; save the int level
mov ax,bp ; temp save of table offset
mov bp,NewSP ; get new SP value
cmp es:[bp],ax ; check for offset into table
jne FoundBad&aa
mov ax,es ; point ss,sp to the new stack
mov ss,ax
mov sp,bp
pushf ; go execute the real interrupt handler
call dword ptr old&aa ; which will iret back to here
mov bp,sp ; retrieve the table offset for us
mov bp,es:[bp] ; but leave it on the stack
mov ss,SavedSS ; get old stack back
mov sp,SavedSP
; cmp AllocByte,Allocated ; If an error occured,
; jne NewError&aa ; do not free us
mov AllocByte,Free ; free the entry
mov NextEntry,bp ; setup to use next time
NewError&aa:
pop es
pop bp ; saved on entry
pop ax ; saved on entry
INTRET_&AA: ;3.30
iret ; done with this interrupt
NotFree&aa:
cmp al,Allocated ; error flag
je findnext&aa ; no, continue
xchg AllocByte,al ; yes, restore error value
FindNext&aa:
call LongPath
jmp Found&aa
FoundBad&aa:
cmp bp,FirstEntry
jc findnext&aa
mov bp,ax ; flag this entry
mov AllocByte,Clobbered
; add bp,EntrySize ; and previous entry
; mov AllocByte,Overflowed
; sub bp,EntrySize
jmp findnext&aa ; keep looking
int&aa endp
endm
;***************************** ;3.30
;End of Macro definition ;3.30
;******************************************************************** ;3.30
; THESE ARE THE INDIVIDUAL INTERRUPT HANDLERS ;3.30
;3.30
IRP A,<02,08,09,70> ;3.30
IntSharingFlag=0 ;3.30
Stack_Main &A ;3.30
ENDM ;3.30
;3.30
IRP A,<0A,0B,0C,0D,0E,72,73,74,76,77> ;3.30
IntSharingFlag=1 ;3.30
Stack_Main &A ;3.30
ENDM ;3.30
;3.30
;******************************************************************** ;3.30
;Common routines ;3.30
longpath:
mov bp,LastEntry ; start with last entry in table
LPLOOPP: ;3.30
cmp AllocByte,Free ; is entry free?
jne inuse ; no, try next one
mov al,Allocated
xchg AllocByte,al ; allocate entry
cmp al,Free ; is it still free?
je found ; yes, go use it
cmp al,Allocated ; is it other than Allocated or Free?
je inuse ; no, check the next one
mov AllocByte,al ; yes, put back the error state
inuse:
cmp bp,FirstEntry
je Fatal
sub bp,EntrySize
JMP LPLOOPP ;3.30
found:
ret
page
fatal proc near
push ds ;3.30
mov ax, 0f000h ;loook at the model byte ;3.30
mov ds, ax ;3.30
cmp ds:byte ptr [0fffeh], mdl_convert ;convertible? ;3.30
pop ds ;3.30
jne Skip_NMIS ;3.30
;3.30
mov al,07h ; disable PC Convertible NMIs
out 72h,al
Skip_NMIS: ;3.30
cli ; disable and mask
mov al,0ffh ; all other ints
out 021h,al
out 0a1h,al
mov si,cs
mov ds,si
mov si,offset fatal_msg
fatal_loop:
lodsb
cmp al,'$'
je fatal_done
mov bl,7 ;3.30*
mov ah,14 ;3.30*
int 010h ; whoops, this enables ints ;3.30*
jmp fatal_loop
fatal_done:
jmp fatal_done
fatal endp

297
v4.0/src/BIOS/MSVOLID.INC Normal file
View File

@ -0,0 +1,297 @@
;-------------------------------------------------------------------------
;
; File: msvolid.asm
; This file contains the volume_id subroutines and data structures.
;
; Routines in this file are:
; Set_Volume_ID - main routine, calls other routines.
; read_volume_id - read the volume ID and tells if it has
; been changed.
; Transfer_volume_id - copy the volume ID from TMP to special
; drive.
; Check_Volume_ID - compare volume ID in TMP area with one
; expected for drive.
; Fat_Check - see of the fatID has changed in the
; specified drive.
; Init_Vid_loop - set up for VID scan or move
;
;
;-------------------------------------------------------------------------
;
; length of the volume id
;
vid_size equ 12
PATHSTART 001,VOLID ;3.30
;
; null volume id
;
nul_vid db "NO NAME ",0
;
; data scratch area used to hold volume ids
;
tmp_vid db "NO NAME ",0
PATHEND 001,VOLID ;3.30
;
; Set_Volume_ID
; If drive has changeline support, read in and set the volume_ID
; and the last FAT_ID byte. If no change line support then do nothing.
;
; On entry:
; DS:DI points to the BDS for this disk.
; AH contains media byte
;
; On Exit:
; Carry clear:
; Successful call
; Carry set
; Error and AX has error code
;
Set_Volume_ID:
PUBLIC SET_VOLUME_ID ;3.30
push dx ; save registers
push ax
CALL HasChange ; does drive have changeline support?
jz setvret ; no, get out
push di
call read_volume_ID ; read the volume ID
pop di
jc SetErr ; if error go to error routine
call transfer_volume_ID ; copy the volume id to special drive
call ResetChanged ; restore value of change line
setvret: ; SET Volume RETurn
clc ; no error, clear carry flag
pop ax ; restore registers
pop dx
ret
SetErr:
pop dx ; pop stack but don't overwrite AX
pop dx ; restore DX
ret
root_sec DW ? ;Root sector #
;
; read_volume_id read the volume ID and tells if it has been changed.
;
; On entry:
; DS:DI points to current BDS for drive.
; On Exit:
; Carry Clear
; SI = 1 No change
; SI = 0 ?
; SI = -1 Change
;
; Carry Set:
; Error and AX has error code.
;
read_volume_id:
push ES ; preserve registers
push DX
push CX
push BX
push AX
push DS ; Preserve Current BDS
push DI
push cs ; get ES segment correct
pop es
push cs ; get DS segment correct
pop ds
mov di,offset tmp_vid
mov si,offset nul_vid
mov cx,vid_size
rep movsb ; initialize tmp_vid to null vi_id
pop DI ; Restore Current BDS
pop DS
mov al,byte ptr ds:[di].cFAT ; # of fats
mov cx,word ptr ds:[di].csecfat ; sectors / fat
mul cl ; size taken by fats
add ax,word ptr ds:[di].ressec ; add on reserved sectors
; AX is now sector # (0 based)
mov cs:[root_sec],ax ; set initial value
mov ax,[di].cDir ; # root dir entries
mov cl,4 ; 16 entries/sector
shr ax,cl ; divide by 16
mov cx,ax ; cx is # of sectors to scan
next_sec:
push cx ; save outer loop counter
mov ax,cs:[root_sec] ; get sector #
mov cx,word ptr ds:[di].seclim ; sectors / track
xor DX,DX
div cx
; set up registers for call to read_sector
inc DX ; dx= sectors into track, ax= track count from 0
mov cl,dl ; sector to read
xor DX,DX
div word ptr ds:[di].hdlim ; # heads on this disc
mov dh,dl ; Head number
mov ch,al ; Track #
call read_sector ; get first sector of the root directory,
; ES:BX -> BOOT
jc ReadVIDErr ; error on read
mov cx,16 ; # of dir entries in a block of root
mov al,08h ; volume label bit
fvid_loop:
cmp byte ptr es:[bx],0 ; End of dir?
jz no_vid ; yes, no vol id
cmp byte ptr es:[bx],0E5h ; empty entry?
jz ent_loop ; yes, skip
test es:[bx+11],al ; is volume label bit set in fcb?
jnz found_vid ; jmp yes
ent_loop:
ADD BX,32 ;MJB003 ADD LENGTH OF DIRECTORY ENTRY ;3.30
loop fvid_loop
pop cx ; outer loop
inc cs:[root_sec] ; next sector
loop next_sec ; continue
NotFound:
XOR SI,SI
jmp short fvid_ret
found_vid:
pop cx ; clean stack of outer loop counter
mov si,bx ; point to volume_id
push ds ; preserve currnet BDS
push di
push es ; es:si points to volume id.
pop ds ; source segment
push cs
pop es ; destination segment
mov di,offset tmp_vid ; dest of volume_id
mov cx,vid_size -1 ; length of string minus NUL
rep movsb ; mov volume label to tmp_vid
xor al,al
stosb ; Null terminate
XOR SI,SI
pop DI ; restore current BDS
pop DS
fvid_ret:
pop ax
clc
RVIDRet:
pop BX ; restore register
pop CX
pop DX
pop ES
ret
no_vid:
pop cx ; clean stack of outer loop counter
jmp NotFound ; not found
ReadVIDErr:
pop SI
pop SI
jmp RVIDRet
;
; Transfer_volume_id - copy the volume ID from TMP to special drive
;
; Inputs: DS:DI nas current BDS
; Outputs: BDS for drive has volume ID from TMP
;
transfer_volume_ID:
push DS ; preserve current BDS
push DI
push ES
push SI
push CX
call init_vid_loop
cld
rep MOVSB ; transfer
pop CX
pop SI
pop ES
pop DI ; restore current BDS
pop DS
ret
;
; Check_Volume_ID - compare volume ID in TMP area with one expected for
; drive
;
; Inputs: DS:DI has current BDS for drive
; Outputs: SI = 0 if compare succeeds
; SI = -1 if compare fails.
check_volume_id:
push DS ; preserve current BDS for drive
push DI
push ES
push CX
call init_vid_loop
cld
repz cmpsb ; are the 2 volume_ids the same?
mov si,0 ; assume unknown
jz check_vid_ret ; carry clear if jump taken
mov si,-1 ; failure
check_vid_ret:
pop CX
pop ES
pop DI ; restore current BDS
pop DS
ret
;
; Fat_Check - see of the fatID has changed in the specified drive.
; - uses the FAT ID obtained from the boot sector.
;
; Inputs: MedByt is expected FAT ID
; DS:DI points to current BDS
; Output: Carry Clear
; SI = -1 if fat ID different,
; SI = 0 otherwise
; No other registers changed.
FAT_CHECK:
push AX
xor SI, SI ; say FAT ID's are same.
mov AL, cs:MedByt
cmp AL, byte ptr [DI].Mediad ; compare it with the BDS medbyte
jz OKRET1 ; carry clear
dec SI
OkRet1: clc
pop AX
ret
;
; Init_Vid_loop - set up for VID scan or move
;
; Inputs: DS:DI pionts to BDS for the drive
; Outputs: DS:SI points to tmp_vid
; ES:DI points to vid for drive
; CX has size for VID compare
;
init_vid_loop:
push ax
push ds
pop es
push cs
pop ds
mov si,offset tmp_vid ; source
add di,volid
mov cx,vid_size
pop ax
ret

View File

@ -0,0 +1,63 @@
;*******************************************************************
; Parser Options set for IBMBIO SYSCONF module
;*******************************************************************
;
;**** Default assemble swiches definition **************************
IFNDEF FarSW
FarSW equ 0 ; Near call expected
ENDIF
IFNDEF DateSW
DateSW equ 0 ; Check date format
ENDIF
IFNDEF TimeSW
TimeSW equ 0 ; Check time format
ENDIF
IFNDEF FileSW
FileSW equ 1 ; Check file specification
ENDIF
IFNDEF CAPSW
CAPSW equ 0 ; Perform CAPS if specified
ENDIF
IFNDEF CmpxSW
CmpxSW equ 0 ; Check complex list
ENDIF
IFNDEF NumSW
NumSW equ 1 ; Check numeric value
ENDIF
IFNDEF KeySW
KeySW equ 0 ; Support keywords
ENDIF
IFNDEF SwSW
SwSW equ 1 ; Support switches
ENDIF
IFNDEF Val1SW
Val1SW equ 1 ; Support value definition 1
ENDIF
IFNDEF Val2SW
Val2SW equ 0 ; Support value definition 2
ENDIF
IFNDEF Val3SW
Val3SW equ 1 ; Support value definition 3
ENDIF
IFNDEF DrvSW
DrvSW equ 1 ; Support drive only format
ENDIF
IFNDEF QusSW
QusSW equ 0 ; Support quoted string format
ENDIF


20
v4.0/src/BIOS/PUSHPOP.INC Normal file
View File

@ -0,0 +1,20 @@
IF1 ;3.30
SaveReg MACRO reglist ;; push those registers
IRP reg,<reglist>
?stackdepth = ?stackdepth + 1
PUSH reg
ENDM
ENDM
.xcref SaveReg
RestoreReg MACRO reglist ;; pop those registers
IRP reg,<reglist>
?stackdepth = ?stackdepth - 1
POP reg
ENDM
ENDM
.xcref RestoreReg
ENDIF ;3.30

165
v4.0/src/BIOS/READCLOC.INC Normal file
View File

@ -0,0 +1,165 @@
; SCCSID = @(#)readclock.asm 1.2 85/07/25
;************************************************************************
;
; read_real_date reads real-time clock for date and returns the number
; of days elapsed since 1-1-80 in si
;
read_real_date: ;mjb002
assume ds:code,es:nothing
PUSH AX
PUSH CX
PUSH DX
XOR AH,AH ; throw away clock roll over ;3.30*
INT 1AH ;3.30*
POP DX
POP CX
POP AX
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV CS:DAYCNT2,1 ;MJB002 REAL TIME CLOCK ERROR FLAG (+1 DA;3.30Y)
mov ah,4 ;mjb002 read date function code ;3.30*
int 1ah ;mjb002 read real-time clock ;3.30*
jnc read_ok ;mjb002 jmp success
jmp r_d_ret ;mjb002 jmp error
read_ok: ;mjb002 ******* get bcd values in binary *****
mov byte ptr bin_date_time+0,ch ;mjb002 store as hex value
mov byte ptr bin_date_time+1,cl ;mjb002 ...
mov byte ptr bin_date_time+2,dh ;mjb002 ...
mov byte ptr bin_date_time+3,dl ;mjb002 ...
MOV CS:DAYCNT2,2 ;MJB002 READ OF R-T CLOCK SUCCESSFUL ;3.30
call bcd_verify ;mjb002 verify bcd values in range
jc r_d_ret ;mjb002 jmp some value out of range
MOV CS:DAYCNT2,3 ;MJB002 READ OF R-T CLOCK SUCCESSFUL ;3.30
call date_verify ;mjb002 verify date values in range
jc r_d_ret ;mjb002 jmp some value out of range
MOV CS:DAYCNT2,0 ;MJB002 VERIFY SUCCESSFUL ;3.30;3.30
call in_bin ;mjb002 convert date to binary
;mjb002 ******* years since 1-1-80 *********
mov al,byte ptr bin_date_time+1 ;mjb002 get years into century
cbw ;mjb002
cmp byte ptr bin_date_time+0,20 ;mjb002 20th century?
jnz century_19 ;mjb002 jmp no
add ax,100 ;mjb002 add in a century
century_19: ;mjb002
sub ax,80 ;mjb002 subtract off 1-1-80
mov cl,4 ;mjb002 leap year every 4
div cl ;mjb002 al= # leap year blocks, ah= remainder
mov bl,ah ;mjb002 save odd years
cbw ;mjb002 zero ah
mov cx,366+3*365 ;mjb002 # of days in leap year blocks
mul cx ;mjb002 dx:ax is result
MOV CS:DAYCNT2,AX ;MJB002 SAVE COUNT OF DAYS ;3.30
mov al,bl ;mjb002 get odd years count
cbw ;mjb002
or ax,ax ;mjb002 is ax= 0?
jz leap_year ;mjb002 jmp if none
mov cx,365 ;mjb002 days in year
mul cx ;mjb002 dx:ax is result
ADD CS:DAYCNT2,AX ;MJB002 ADD ON DAYS IN ODD YEARS ;3.30
jmp short leap_adjustment ;mjb002 account for leap year
leap_year: ;mjb002 possibly account for a leap day
cmp byte ptr bin_date_time+2,2 ;mjb002 is month february
jbe no_leap_adjustment ;mjb002 jan or feb. no leap day yet.
leap_adjustment: ;mjb002 account for leap day
INC CS:DAYCNT2 ;MJB002 ... ;3.30
no_leap_adjustment: ;mjb002 ******* get days of month *******
mov cl,byte ptr bin_date_time+3 ;mjb002 ...
xor ch,ch ;mjb002
dec cx ;mjb002 because of offset from day 1, not day 0
ADD CS:DAYCNT2,CX ;MJB002 ******* GET DAYS IN MONTHS PRECEE;3.30DING *****
mov cl,byte ptr bin_date_time+2 ;mjb002 get month
xor ch,ch ;mjb002
dec cx ;mjb002 january starts at offset 0
shl cx,1 ;mjb002 word offset
mov si,offset month_table ;mjb002 beginning of month_table
add si,cx ;mjb002 point into month table
mov ax,word ptr [si];mjb002 get # days in previous months
ADD CS:DAYCNT2,AX ;MJB002 ... ;3.30
r_d_ret: ;mjb002
MOV SI,CS:DAYCNT2 ;MJB002 RESULT IN SI ;3.30
POP DX
POP CX
POP BX
POP AX
ret ;mjb002
r_t_retj:
xor cx,cx
xor dx,dx
jmp r_t_ret
;
; Read_Real_Time reads the time from the RTC. on exit, it has the number of
; ticks (at 18.2 ticks per sec.) in CX:DX.
;
Read_Real_Time:
mov ah,2 ;3.30*
int 1AH ;3.30*
jc r_t_retj
oktime:
mov byte ptr bin_date_time,ch ; hours
mov byte ptr bin_date_time+1,cl ; minutes
mov byte ptr bin_date_time+2,dh ; seconds
mov byte ptr bin_date_time+3,0 ; unused for time
call bcd_verify
jc r_t_retj
call time_verify
jc r_t_retj
call in_bin
MOV ch,byte ptr bin_date_time
MOV cl,byte ptr bin_date_time+1
MOV dh,byte PTR bin_date_time+2
MOV dl,byte PTR bin_date_time+3
message ftestinit,<"Read Time ">
mnum ftestinit,cx
message ftestinit,<" ">
mnum ftestinit,dx
message ftestinit,<cr,lf>
; get time in ticks in CX:DX
CALL word ptr cs:TimeToTicks ;3.30
message ftestinit,<"Conv Time ">
mnum ftestinit,cx
message ftestinit,<" ">
mnum ftestinit,dx
message ftestinit,<cr,lf>
r_t_ret:
ret
;
; in_bin converts bin_date_time values from bcd to bin
;
in_bin: ;mjb002
assume ds:code,es:nothing
mov al,byte ptr bin_date_time+0 ; century or hours
call bcd_to_bin ; ...
mov byte ptr bin_date_time+0,al ;
mov al,byte ptr bin_date_time+1 ; years or minutes
call bcd_to_bin ; ...
mov byte ptr bin_date_time+1,al ;
mov al,byte ptr bin_date_time+2 ; months or seconds
call bcd_to_bin ; ...
mov byte ptr bin_date_time+2,al ;
mov al,byte ptr bin_date_time+3 ; days (not used for time)
call bcd_to_bin ; ...
mov byte ptr bin_date_time+3,al ;
ret ;
;
; bcd_to_bin converts two bcd nibbles in al (value <= 99.) to
; a binary representation in al
; ah is destroyed
;
bcd_to_bin: ;mjb002
assume ds:nothing,es:nothing
mov ah,al ;mjb002 copy bcd number to ah
and ax,0f00fh ;mjb002 clear unwanted nibbles
mov bl,al ;mjb002 save units place
xchg ah,al ;mjb002 10's place to al
xor ah,ah ;mjb002 ah not wanted
mov cl,4 ;mjb002 shift count
shr ax,cl ;mjb004 swap nibbles
mov cl,10 ;mjb002 convert al to ...
mul cl ;mjb002 ... its binary value
add al,bl ;mjb002 add in units
ret ;mjb002

271
v4.0/src/BIOS/STKINIT.INC Normal file
View File

@ -0,0 +1,271 @@
;
; To follow the standard interrupt sharing scheme, MSSTACK.ASM ;3.30
; has been modified. This initialization routine also has to ;3.30
; be modified because for the interrupt level 7 and 15, FirstFlag ;3.30
; should be set to signal that this interrupt handler is the ;3.30
; first handler hooked to this interrupt vector. ;3.30
; We determine this by looking at the instruction pointed by ;3.30
; this vector. If it is IRET, then this handler should be the ;3.30
; first one. In our case, only the interrupt vector 77h is the ;3.30
; interrupt level 15. (We don't hook interrupt level 7.) ;3.30
; 9/10/1986 ;3.30
; The followings are mainly due to M.R.T; PTM fix of P886 12/3/86;3.30
; Some design changes are needed to the above interrupt sharing ;3.30
; method. The above sharing scheme assumes that 1). Interrupt ;3.30
; sharing is NEVER done on levels that have BIOS support. 2). "Phantom" ;3.30
; interrupts would only be generated on levels 7 and 15. ;3.30
; These assumptions are not true any more. We have to use the FirstFlag ;3.30
; for EVERY level of interrupt. We will set the firstFlag on the following;3.30
; conditions: ;3.30
; a. if the CS portion of the vector is 0000, then "first" ;3.30
; b. else if CS:IP points to valid shared header, then NOT "first" ;3.30
; c. else if CS:IP points to an IRET, then "first" ;3.30
; d. else if CS:IP points to DUMMY, then "first" ;3.30
; where DUMMY is - the CS portion must be F000, and the IP portion must ;3.30
; be equal to the value at F000:FF01. This location is the initial value ;3.30
; from VECTOR_TABLE for interrupt 7, one of the preserved addresses in all;3.30
; the BIOSes for all of the machines. ;3.30
; ;3.30
; System design group requests BIOS to handle the phantom interrupts. ;3.30
; ;3.30
; The "Phantom" interrupt is an illegal interrupt such as an interrupt ;3.30
; produced by the bogus adapter card even without interrupt request is ;3.30
; set. More specifically, 1). The 8259 has a feature when running in ;3.30
; edge triggered mode to latch a pulse and present the interrupt when ;3.30
; the processor indicates interrupt acknowledge (INTA). The interrupt ;3.30
; pulse was exist at the time of INTA to get a "phantom" interrupt. ;3.30
; 2). or, this is caused by adapter cards placing a glitch on the ;3.30
; interrupt line. ;3.30
; ;3.30
; To handle those "phantom" interrupts, the main stack code will check ;3.30
; the own FirstFlag, and if it is not "first" (which means the forward ;3.30
; pointer points to the legal shared interrupt handler), then pass the ;3.30
; control. If it is the first, then the following action should be ;3.30
; taken. We don't have to implement skack logic in this case. ;3.30
; ;3.30
; To implement this logic, we rather choose a simple method. ;3.30
; If ont of the above "FirstFlag" conditions is met, we are not ;3.30
; going to hook this interrupt vector. The reason is if the original ;3.30
; vector points to "IRET" and do nothing, we don't need ;3.30
; to implement the stack logic for it. This will simplify implementation;3.30
; while maintaining compatibility with the old version of DOS. ;3.30
; This implies that in the main stack code, there might be a stack code ;3.30
; that will never be used, a dead code. ;3.30
; ;3.30
; 12/3/86 ;3.30
;3.30
;In - CS, DS -> sysinitseg, ES -> relocated stack code & data. ;3.30
;3.30
PAGE ;3.30
assume ds:sysinitseg ; sunilp SB340
StackInit proc near ;3.30
;3.30
PUSH AX ;SAVE ALL ;3.30
PUSH DS ;3.30
PUSH ES ;3.30
PUSH BX ;3.30
PUSH CX ;3.30
PUSH DX ;3.30
PUSH DI ;3.30
PUSH SI ;3.30
PUSH BP ;3.30
;3.30
;Currently ES -> stack code area ;3.30
MOV AX, cs:[STACK_COUNT] ;defined in CS ;3.30
MOV es:[STACKCOUNT], AX ;defined in STACK CODE AREA ;3.30
MOV AX, [STACK_SIZE] ;in CS ;3.30
MOV es:[STACKSIZE], AX ; ;3.30
MOV AX, WORD PTR cs:[STACK_ADDR] ; OFFSET ;3.30
MOV WORD PTR es:[STACKS], AX ;3.30
MOV AX, WORD PTR cs:[STACK_ADDR+WORD] ; SEGMENT ;3.30
MOV WORD PTR es:[STACKS+WORD], AX ;3.30
;3.30
; INITIALIZE THE DATA FIELDS WITH THE PARAMETERS ;3.30
;3.30
; "FIRSTENTRY" WILL ALWAYS BE AT STACKS ;3.30
;3.30
MOV BP, word ptr es:STACKS ; GET OFFSET OF STACK ;3.30
MOV es:FIRSTENTRY,BP ;3.30
;3.30
; THE STACKS WILL ALWAYS IMMEDIATELY FOLLOW THE TABLE ENTRIES ;3.30
;3.30
MOV AX,ENTRYSIZE ;3.30
MOV CX,es:STACKCOUNT ;3.30
MUL CX ;3.30
ADD AX,BP ;3.30
MOV es:STACKAT,AX ;3.30
MOV BX,AX ;3.30
SUB BX,2 ;3.30
;3.30
; ZERO THE ENTIRE STACK AREA TO START WITH ;3.30
;3.30
MOV DI,es:STACKAT ;3.30
MOV AX,es:STACKSIZE ;3.30
MUL CX ;3.30
MOV CX,AX ;3.30
xor ax,ax ;3.30
push es ;3.30
pop ds ;ds = Relocated stack code seg.;3.30
assume ds:nothing ;3.30
;Now, DS -> stack code area ;3.30
MOV ES, word ptr ds:[STACKS+2] ; GET SEGMENT OF STACK AREA.;3.30
CLD ;3.30
REP STOSB ;3.30
;3.30
MOV CX, ds:STACKCOUNT ;3.30
;3.30
; LOOP FOR "COUNT" TIMES, BUILDING A TABLE ENTRY ;3.30
; cs = sysinitseg, ds = Relocated stack code seg , es = segment of stack space;3.30
; CX = NUMBER OF ENTRIES ;3.30
; ES:BP => BASE OF STACKS - 2 ;3.30
; ES:BX => FIRST TABLE ENTRY ;3.30
;3.30
BUILDLOOP: ;3.30
MOV ALLOCBYTE,FREE ;3.30
MOV INTLEVEL,AL ;AX = 0 ;3.30
MOV SAVEDSP,AX ;3.30
MOV SAVEDSS,AX ;3.30
ADD BX,ds:STACKSIZE ;3.30
MOV NEWSP,BX ;3.30
MOV ES:[BX],BP ;3.30
ADD BP,ENTRYSIZE ;3.30
;3.30
LOOP BUILDLOOP ;3.30
;3.30
SUB BP,ENTRYSIZE ;3.30
MOV ds:LASTENTRY,BP ;3.30
MOV ds:NEXTENTRY,BP ;3.30
;3.30
push ds ;3.30
mov ax, 0f000h ;loook at the model byte ;3.30
mov ds, ax ;3.30
cmp ds:byte ptr [0fffeh], mdl_convert ;convertible? ;3.30
pop ds ;3.30
jne Skip_disableNMIS ;3.30
;3.30
MOV AL,07H ; DISABLE Convertible NMIS ;3.30
OUT 72H,AL ;3.30
;3.30
Skip_disableNMIS: ;3.30
XOR AX,AX ;3.30
MOV es,AX ;es - SEGID OF VECTOR TABLE AT 0;3.30
ASSUME es:NOTHING ;ds - Relocated Stack code segment;3.30
;3.30
CLI ;3.30
;3.30
IRP AA,<02,08,09,70> ;3.30
;3.30
MOV SI,AA&H*4 ;PASS WHERE VECTOR IS TO BE ADJUSTED ;3.30
mov di, offset Int19OLD&AA ;we have to set OLD&AA for Int19 handler too.;3.30
MOV BX,OFFSET OLD&AA ;PASS WHERE TO SAVE ORIGINAL OWNER POINTER;3.30
MOV DX,OFFSET INT&AA ;PASS WHERE NEW HANDLER IS ;3.30
CALL NEW_INIT_LOOP ;ADJUST THE VECTOR TO NEW HANDLER, ;3.30
; SAVING POINTER TO ORIGINAL OWNER ;3.30
ENDM ;3.30
;3.30
IRP AA,<0A,0B,0C,0D,0E,72,73,74,76,77> ;shared interrupts ;3.30
;3.30
MOV SI,AA&H*4 ;PASS WHERE VECTOR IS TO BE ADJUSTED ;3.30
push ds ;save relocated stack code segment ;3.30
lds bx, es:[si] ;ds:bx -> original interrupt handler ;3.30
push ds ;3.30
pop dx ;dx = segment value ;3.30
cmp dx,0
jz int&AA&_first
cmp byte ptr ds:[bx],0cfh ;Does vector point to an IRET?
jz int&AA&_first
cmp word ptr ds:[bx.6],424Bh ;Magic offset (see INT&AA, msstack.inc)
jz int&AA&_Not_first
cmp dx,0f000h ;ROM BIOS segment
jnz int&AA&_Not_first
push es
push dx
mov dx,0f000h
mov es,dx
cmp bx,word ptr es:0ff01h
pop dx
pop es
jz int&AA&_first
int&AA&_Not_first: ;Not the first. We are going to hook vector.;3.30
pop ds ;3.30
mov di, offset Int19OLD&AA ;we have to set OLD&AA for Int19 handler too.;3.30
mov BX, OFFSET OLD&AA ;PASS WHERE TO SAVE ORIGINAL OWNER POINTER;3.30
MOV DX, OFFSET INT&AA ;PASS WHERE NEW HANDLER IS ;3.30
CALL NEW_INIT_LOOP ;ADJUST THE VECTOR TO NEW HANDLER, SAVING;3.30
;POINTER TO ORIGINAL OWNER. ;3.30
jmp short int&AA&_end ;3.30
int&AA&_first: ;the first. Don't have to hook stack code.;3.30
pop ds ;3.30
int&AA&_end: ;3.30
;3.30
ENDM ;3.30
;3.30
push ds ;3.30
mov ax, 0f000h ;loook at the model byte ;3.30
mov ds, ax ;3.30
cmp ds:byte ptr [0fffeh], mdl_convert ;PC convertible? ;3.30
pop ds ;3.30
jne Skip_EnableNMIS ;3.30
;3.30
MOV AL,27H ; ENABLE Convertible NMIS ;3.30
OUT 72H,AL ;3.30
;3.30
Skip_EnableNMIS: ;3.30
STI ;3.30
MOV AX,code ;3.30
MOV DS,AX ;3.30
ASSUME DS:CODE ;3.30
;3.30
; MOV SI,OFFSET STKMSG1 ;3.30
; CALL WRMSG ;3.30
;3.30
mov [INT19SEM],1 ; INDICATE THAT INT 19 ;3.30
; INITIALIZATION IS COMPLETE ;3.30
;3.30
POP BP ; RESTORE ALL ;3.30
POP SI ;3.30
POP DI ;3.30
POP DX ;3.30
POP CX ;3.30
POP BX ;3.30
;3.30
POP ES ;3.30
POP DS ;3.30
assume ds:sysinitseg ;3.30
POP AX ;3.30
RET ;3.30
STACKINIT ENDP ;3.30
; ;3.30
;3.30
NEW_INIT_LOOP PROC NEAR ;3.30
;INPUT: SI=OFSET INTO VECTOR TABLE OF THE PARTICULAR INT VECTOR BEING ADJUSTED ;3.30
; BX=ds:OFFSET OF OLDxx, WHERE WILL BE SAVED THE POINTER TO ORIGINAL OWNER;3.30
; DX=ds:OFFSET OF INTxx, THE NEW INTERRUPT HANDLER ;3.30
; di=offset value of Int19OLD&AA variable in BIOS. ;3.30
; es=ZERO, SEGID OF VECTOR TABLE ;3.30
; ds=Relocated Stack code segment ;3.30
;3.30
MOV AX,es:[SI+0] ;REMEMBER OFFSET IN VECTOR ;3.30
MOV WORD PTR ds:[BX],AX ; TO ORIGINAL OWNER in DS ;3.30
MOV AX,es:[SI+2] ;REMEMBER SEGID IN VECTOR ;3.30
MOV WORD PTR ds:[BX]+2,AX ; TO ORIGINAL OWNER in DS ;3.30
push ds ;3.30
mov ax, code ;3.30
mov ds, ax ;Set Int19OLDxx value in BIOS for ;3.30
mov ax,es:[si+0] ;Int 19 handler ;3.30
mov word ptr ds:[di],ax ;3.30
mov ax,es:[si+2] ;3.30
mov word ptr ds:[di]+2,ax ;3.30
pop ds ;3.30
;3.30
MOV WORD PTR es:[SI+0],DX ;SET VECTOR TO POINT TO NEW INT HANDLER ;3.30
MOV es:[SI+2],ds ;3.30
RET ;3.30
NEW_INIT_LOOP ENDP ;3.30
;3.30

3392
v4.0/src/BIOS/SYSCONF.ASM Normal file

File diff suppressed because it is too large Load Diff

38
v4.0/src/BIOS/SYSIMES.ASM Normal file
View File

@ -0,0 +1,38 @@
;SCCSID = @(#)sysimes.asm 1.2 85/07/25
%OUT ...SYSIMES
;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 4.00 - J.K.
;AC000 - Changed for DOS Version 4.00 - J.K.
;AN00x - PTM number for DOS Version 4.00 - J.K.
;==============================================================================
;AN001 D246, P976 Show "Bad command or parameters - ..." msg 9/22/87 J.K.
;AN002 P1820 New Message SKL file 10/20/87 J.K.
;AN003 D486 Share installation for large media 02/24/88 J.K.
;==============================================================================
iTEST = 0
include MSequ.INC
include MSmacro.INC
SYSINITSEG SEGMENT PUBLIC BYTE 'SYSTEM_INIT'
PUBLIC BADOPM,CRLFM,BADSIZ_PRE,BADLD_PRE,BADCOM,SYSSIZE,BADCOUNTRY
; PUBLIC BADLD_POST,BADSIZ_POST,BADMEM,BADBLOCK,BADSTACK
PUBLIC BADMEM,BADBLOCK,BADSTACK
PUBLIC INSUFMEMORY,BADCOUNTRYCOM
public BadOrder,Errorcmd ;AN000;
public BadParm ;AN001;
public SHAREWARNMSG ;AN003;
;include sysimes.inc
include MSbio.cl3 ;AN002;
SYSSIZE LABEL BYTE
PATHEND 001,SYSMES
SYSINITSEG ENDS
END

2668
v4.0/src/BIOS/SYSINIT1.ASM Normal file

File diff suppressed because it is too large Load Diff

1624
v4.0/src/BIOS/SYSINIT2.ASM Normal file

File diff suppressed because it is too large Load Diff

8
v4.0/src/BOOT/BOOT.SKL Normal file
View File

@ -0,0 +1,8 @@
:class 1
; MESSAGES FOR THE IBM BOOT SECTOR. NUL Terminated.
; At this time, for DOS 4.00, we only have maximum 11 bytes left
; for translation.!!!!!!!!!!!!!!!!!!!!!
:use 001 BOOT SYSMSG
:end

25
v4.0/src/BOOT/MAKEFILE Normal file
View File

@ -0,0 +1,25 @@
#******************** makefile for boot *****************************
msg =..\messages
dos =..\dos
inc =..\inc
hinc =..\h
#
#################### dependencies begin here ############################
#
all: msboot.bin
boot.cl1: boot.skl \
$(msg)\$(COUNTRY).MSG \
makefile
msboot.obj: msboot.asm boot.cl1
msboot.bin: msboot.obj
link msboot;
exe2bin msboot.exe msboot.bin
dbof msboot.bin boot.inc 7c00 200
copy boot.inc $(inc)
del boot.inc

Some files were not shown because too many files have changed in this diff Show More