     1                                  ;	PAGE ,132 ;
     2                                  ;	TITLE MSBIO2 - BIOS
     3                                  
     4                                  	%warning out: ...MSBIO2.ASM
     4          ******************       warning: out: ...MSBIO2.ASM [-w+user]
     5                                  
     6                                  ;==============================================================================
     7                                  ;REVISION HISTORY:
     8                                  ;AN000 - New for DOS Version 4.00 - J.K.
     9                                  ;AC000 - Changed for DOS Version 4.00 - J.K.
    10                                  ;AN00x - PTM number for DOS Version 4.00 - J.K.
    11                                  ;==============================================================================
    12                                  ;AN001; - P1820 New Message SKL file				  10/20/87 J.K.
    13                                  ;AN002; - P5045 New INT 2fh for Get BDS table vector for EMS	  06/06/88 J.K.
    14                                  ;==============================================================================
    15                                  
    16                                  ROMSEGMENT	EQU	0F000H
    17                                  labelsize MODELBYTE, byte, 0FFFEH
    18                                  MODELPCJR	EQU	0FDH
    19                                  
    20                                  	itest equ 0
    21                                  
    22                                  	%include "entryseg.nas"
     1                              <1> 
     2                              <1> %ifndef ENTRYSEGNAS
     3                              <1> %define ENTRYSEGNAS 1
     4                              <1> 
     5                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
     1          ******************  <2>  warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi]
    14                              <3> [list -]
    14                              <2> [list -]
     6                              <1> %include "entrysw.mac"
     1                              <2> 
     2                              <2> %ifndef __ENTRYSW_MAC__
     3                              <2>  %assign __ENTRYSW_MAC__ 1
     4                              <2> 
     5                              <2> %assign _DOSCODEHMA		1
     6                              <2> %assign _RELOCATEDOSCODE	0
     7                              <2> 
     8                              <2> 		; Write a label "%1" (only if DOSCODE isn't relocated) and
     9                              <2> 		; "relocated%1" (always).
    10                              <2> 	%imacro relocated 1-2.nolist
    11                              <2> %ifnidni %2, device
    12                              <2>  %ifnidni %2, amis
    13                              <2>   %ifn _RELOCATEDOSCODE
    14                              <2> %1:
    15                              <2> 	global %1
    16                              <2>   %endif
    17                              <2>  %endif
    18                              <2> %endif
    19                              <2> relocated%1:				; always used for local labels
    20                              <2> 	global relocated%1
    21                              <2> 	%endmacro
    22                              <2> 
    23                              <2> %if _RELOCATEDOSCODE
    24                              <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h
    25                              <2> %else
    26                              <2> DOSENTRYADJUSTSEGMENT equ 0
    27                              <2> %endif
    28                              <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16
    29                              <2> 
    30                              <2> DOSENTRYDEVICEBASE equ 10h
    31                              <2> 
    32                              <2> %endif
     7                              <1> [list -]
    23                              <1>  %define DOSENTRYGROUP DOSCODEGROUP
    24                              <1>  [list -]
    39                              <1> usesection DOSENTRY
    40                              <1> 
    41                              <1> %endif
    23                                  	%include "lmacros3.mac"
     1                              <1> [list -]
    24                                  	%include "entrysw.mac"
     1                              <1> 
     2                              <1> %ifndef __ENTRYSW_MAC__
     3                              <1>  %assign __ENTRYSW_MAC__ 1
     4                              <1> 
     5                              <1> %assign _DOSCODEHMA		1
     6                              <1> %assign _RELOCATEDOSCODE	0
     7                              <1> 
     8                              <1> 		; Write a label "%1" (only if DOSCODE isn't relocated) and
     9                              <1> 		; "relocated%1" (always).
    10                              <1> 	%imacro relocated 1-2.nolist
    11                              <1> %ifnidni %2, device
    12                              <1>  %ifnidni %2, amis
    13                              <1>   %ifn _RELOCATEDOSCODE
    14                              <1> %1:
    15                              <1> 	global %1
    16                              <1>   %endif
    17                              <1>  %endif
    18                              <1> %endif
    19                              <1> relocated%1:				; always used for local labels
    20                              <1> 	global relocated%1
    21                              <1> 	%endmacro
    22                              <1> 
    23                              <1> %if _RELOCATEDOSCODE
    24                              <1> DOSENTRYADJUSTSEGMENT equ 60h - 26h
    25                              <1> %else
    26                              <1> DOSENTRYADJUSTSEGMENT equ 0
    27                              <1> %endif
    28                              <1> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16
    29                              <1> 
    30                              <1> DOSENTRYDEVICEBASE equ 10h
    31                              <1> 
    32                              <1> %endif
    25                                  	%include "msgroup.mac"	;DEFINE CODE SEGMENT
     1                              <1> EVBOUND equ 1  ;THIS VALUE BEING 0 DOES NO BOUNDARY ALLIGNMENT, VALUE 1	  ;3.30
     2                              <1> 	     ; ALIGNS TO EVEN						  ;3.30
     3                              <1> 
     4                              <1> ; NASM original macros
     5                              <1> 
     6                              <1> %include "dcodeseg.nas"
     1                              <2> 
     2                              <2> %ifndef DCODESEGNAS
     3                              <2> %assign DCODESEGNAS 1
     4                              <2> 
     5                              <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE
     6                              <2> ; (no prior section) ; DOSCODETABLE		ENDS
     7                              <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE
     8                              <2> ; (no prior section) ; DOSCODECODE		ENDS
     9                              <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE
    10                              <2> section BIOCODE	align=2 PUBLIC class=DOSCODE
    11                              <2> 
    12                              <2> %ifnidni DOSENTRYGROUP, DOSCODEGROUP
    13                              <2>  group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE
    14                              <2> %endif
    15                              <2> 
    16                              <2> %endif
     7                              <1> 
     8                              <1> 	%if EVBOUND	;;IF EVEN (WORD) ALLIGNMENT IS REQUESTED,	  ;3.30
     9                              <1> 
    10                              <1> %imacro EVENB 0.nolist
    11                              <1> 	EVEN	;;ADJUST TO EVEN BOUNDARY
    12                              <1> %endmacro
    13                              <1> 
    14                              <1> %imacro ODD 0.nolist
    15                              <1> %if (($ - $$) % 2) == 0
    16                              <1> 	db ?
    17                              <1> %endif
    18                              <1> %endmacro
    19                              <1> 
    20                              <1> 	%else	;;SINCE EVEN ALLIGNMENT IS NOT DESIRED, JUST USE BYTE ALLI;3.30 GNMENT
    21                              <1> 
    22                              <1> %imacro EVENB 0.nolist
    23                              <1> ;;REQUEST FOR WORD ALLIGNMENT DOES NOTHING				  ;3.30
    24                              <1> %endmacro
    25                              <1> 
    26                              <1> %imacro ODD 0.nolist
    27                              <1> ;;REQUEST FOR ODD ALLIGNMENT DOES NOTHING				  ;3.30
    28                              <1> %endmacro
    29                              <1> 
    30                              <1> 	%endif								  ;3.30
    31                              <1> 
    32                              <1> %imacro CODE_SEGMENT 0.nolist
    33                              <1> 	section BIOCODE
    34                              <1> %endmacro
    35                              <1> 
    36                              <1> ; end of NASM original macros
    37                              <1> 
    38                              <1> 	CODE_SEGMENT							  ;3.30
    39                              <1> 	ASSUME	CS:BIOCODE 						  ;3.30
    40                              <1> 									  ;3.30
    26                                  	%include "msequ.mac"
     1                              <1> %warning out: MSEQU.INC...
     1          ******************  <1>  warning: out: MSEQU.INC... [-w+user]
     2                              <1> ;==============================================================================
     3                              <1> 
     4                              <1> FTOOBIG 	EQU	80H
     5                              <1> FBIG		EQU	40H
     6                              <1> ROMSTATUS	EQU	1
     7                              <1> ROMREAD 	EQU	2
     8                              <1> ROMWRITE	EQU	3
     9                              <1> ROMVERIFY	EQU	4
    10                              <1> ROMFORMAT	EQU	5
    11                              <1> VID_SIZE	EQU 12
    12                              <1> 
    13                              <1> %include "msbds.mac"    ; VARIOUS EQUATES FOR BDS
     1                              <2> 
     2                              <2> %warning out: MSBDS.INC...
     2          ******************  <2>  warning: out: MSBDS.INC... [-w+user]
     3                              <2> ;	SCCSID = @(#)IBMBDS.ASM 1.9 85/09/16
     4                              <2> ;==============================================================================
     5                              <2> ;REVISION HISTORY:
     6                              <2> ;AN000 - New for DOS Version 4.00 - J.K.
     7                              <2> ;AC000 - Changed for DOS Version 4.00 - J.K.
     8                              <2> ;AN00x - PTM number for DOS Version 4.00 - J.K.
     9                              <2> ;==============================================================================
    10                              <2> ;AN001; D113 Disable I/O access to unformatted media		    9/03/87 J.K.
    11                              <2> ;==============================================================================
    12                              <2> 
    13                              <2> ; VALUES FOR VARIOUS FLAGS IN BDS.FLAGS.
    14                              <2> 
    15                              <2> FNON_REMOVABLE	    EQU     01H 	;FOR NON-REMOVABLE MEDIA
    16                              <2> FCHANGELINE	    EQU     02H 	;IF CHANGELINE SUPPORTED ON DRIVE
    17                              <2> RETURN_FAKE_BPB     EQU     04H 	; WHEN SET, DON'T DO A BUILD BPB
    18                              <2> 					; JUST RETURN THE FAKE ONE
    19                              <2> GOOD_TRACKLAYOUT    EQU     08H 	; THE TRACK LAYOUT HAS NO FUNNY SECTORS
    20                              <2> ; FCHANGED_BY_FORMAT  EQU	    08H
    21                              <2> FI_AM_MULT	    EQU     10H 	;IF MORE THAN ONE LOGICAL FOR THIS PHYSICAL
    22                              <2> FI_OWN_PHYSICAL     EQU     20H 	;SIGNIFY LOGICAL OWNER OF THIS PHYSICAL
    23                              <2> FCHANGED	    EQU     40H 	;INDICATES MEDIA CHANGED
    24                              <2> SET_DASD_TRUE	    EQU     80H 	; SET DASD BEFORE NEXT FORMAT
    25                              <2> FCHANGED_BY_FORMAT  EQU    100H 	;MEDIA CHANGED BY FORMAT
    26                              <2> UNFORMATTED_MEDIA   EQU    200H 	;AN001; Fixed disk only
    27                              <2> F_LBA		equ	400h		; LBA supported
    28                              <2> 
    29                              <2> LBAPACKETSTRUC struc
    30 00000000 ????                <2> lpSize		dw ?
    31 00000002 ????                <2> lpCount		dw ?
    32 00000004 ????????            <2> lpBuffer	dd ?
    33 00000008 ????????????????    <2> lpSector	dd ?,?
    34                              <2> LBAPACKETSTRUC ends
    35                              <2> 
    36                              <2> ;
    37                              <2> ; VARIOUS FORM FACTORS TO DESCRIBE MEDIA
    38                              <2> ;
    39                              <2> FF48TPI 	    EQU     0
    40                              <2> FF96TPI 	    EQU     1
    41                              <2> FFSMALL 	    EQU     2
    42                              <2> FFHARDFILE	    EQU     5
    43                              <2> FFOTHER 	    EQU     7
    44                              <2> 
    45                              <2> BDS_TYPE	STRUC
    46 00000000 ????????            <2> LINK		DD		?	; LINK TO NEXT BDS
    47 00000004 ??                  <2> DRIVENUM	DB		?	; INT 13 DRIVE NUMBER
    48 00000005 ??                  <2> DRIVELET	DB		?	; DOS DRIVE NUMBER
    49 00000006 ????                <2> BYTEPERSEC	DW		?	; NUMBER OF BYTES/SEC
    50 00000008 ??                  <2> SECPERCLUS	DB		?	; SEC PER ALLOCATION UNIT
    51 00000009 ????                <2> RESSEC		DW		?	; NUMBER OF RESERVED SECTORS
    52 0000000B ??                  <2> CFAT		DB		?	; NUMBER OF FATS
    53 0000000C ????                <2> CDIR		DW		?	; NUMBER OF DIRECTORY ENTRIES
    54 0000000E ????                <2> DRVLIM		DW		?	; NUMBER OF SECTORS ON MEDIUM
    55 00000010 ??                  <2> MEDIAD		DB		?	; MEDIA DESCRIPTOR BYTE
    56 00000011 ????                <2> CSECFAT 	DW		?	; NUMBER OF SECTORS/FAT
    57 00000013 ????                <2> SECLIM		DW		?	; SECTORS PER TRACK
    58 00000015 ????                <2> HDLIM		DW		?	; MAX NUMBER OF HEADS
    59 00000017 ????                <2> HIDSEC_L	DW		?	; NUMBER OF HIDDEN SECTORS
    60 00000019 ????                <2> HIDSEC_H	dw		? ;0	;J.K.87
    61 0000001B ????                <2> DRVLIM_L	dw		? ;0	;J.K.87
    62 0000001D ????                <2> DRVLIM_H	dw		? ;0	;J.K.87
    63 0000001F ??                  <2> FATSIZ		DB		?	; FLAGS...
    64 00000020 ????                <2> OPCNT		DW		?	; OPEN REF. COUNT
    65 00000022 ??                  <2> FORMFACTOR	DB		?	; FORM FACTOR INDEX
    66 00000023 ????                <2> FLAGS		DW		?	; VARIOUS FLAGS
    67 00000025 ????                <2> CCYLN		DW		?	; MAX NUMBER OF CYLINDERS
    68 00000027 ????                <2> RBYTEPERSEC	DW		?	; RECOMMENDED BPB
    69 00000029 ??                  <2> RSECPERCLUS	DB		?
    70 0000002A ????                <2> RRESSEC 	DW		?
    71 0000002C ??                  <2> RCFAT		DB		?
    72 0000002D ????                <2> RCDIR		DW		?
    73 0000002F ????                <2> RDRVLIM 	DW		?
    74 00000031 ??                  <2> RMEDIAD 	DB		?
    75 00000032 ????                <2> RCSECFAT	DW		?
    76 00000034 ????                <2> RSECLIM 	DW		?
    77 00000036 ????                <2> RHDLIM		DW		?
    78 00000038 ????                <2> RHIDSEC_L	DW		?
    79 0000003A ????                <2> RHIDSEC_H	DW		? ;0	;J.K.87
    80 0000003C ????                <2> RDRVLIM_L	dw		? ;0	;J.K.87
    81 0000003E ????                <2> RDRVLIM_H	dw		? ;0	;J.K.87
    82 00000040 ????????????        <2> RESERVE 	DB		6 DUP (?)	; RESERVED FOR FUTURE
    83 00000046 ??                  <2> TRACK		DB		?	; LAST TRACK ACCESSED ON DRIVE
    84 00000047 ????                <2> TIM_LO		DW		?	; TIME OF LAST ACCESS. KEEP
    85 00000049 ????                <2> TIM_HI		DW		?	; THESE CONTIGUOUS.
    86 0000004B <res Ch>            <2> VOLID		DB		12 DUP (?)	; VOLUME ID OF MEDIUM
    87 00000057 ????????            <2> VOL_SERIAL	dd	? ;0	  ;J.K.87 Current volume serial number from Boot record
    88 0000005B <res 9h>            <2> FILESYS_Id	db	9 dup (?) ;(0) ;J.K.87 Current file system id from Boot record
    89                              <2> BDS_TYPE	ENDS
    90                              <2> 
    91                              <2> BPBSIZE     equ	TRACK - RBYTEPERSEC ; SIZE IN BYTES OF RECBPB AREA IN THE BDS
    92                              <2> 
    93                              <2> 
    94                              <2> ;*********************************************************************
    95                              <2> ;	BDS structure for mini disk - J.K. 4/7/86
    96                              <2> ;*********************************************************************
    97                              <2> 
    98                              <2> BDSM_type	struc
    99 00000000 ????                <2> mlink		DW	? ;-1			;Link to next structure
   100 00000002 ????                <2> 		DW	?
   101 00000004 ??                  <2> mdriveNum	DB	? ;80			;Int 13 Drive Number
   102 00000005 ??                  <2> mdriveLet	DB	? ;3			;Logical Drive Number
   103 00000006 ????                <2> mBytePerSec	DW	? ;512
   104 00000008 ??                  <2> mSecPerClus	DB	? ;1			;Sectors/allocation unit
   105 00000009 ????                <2> mRESSEC 	DW	? ;1			;Reserved sectors for DOS
   106 0000000B ??                  <2> mcFAT		DB	? ;2			;No. of allocation tables
   107 0000000C ????                <2> mcDIR		DW	? ;16			;Number of directory entries
   108 0000000E ????                <2> mDRVLIM 	DW	? ;0			;Number of sectors (at 512 bytes each)
   109 00000010 ??                  <2> mMediad 	DB	? ;11111000B		;Media descriptor
   110 00000011 ????                <2> mcSecFat	DW	? ;1			;Number of FAT sectors
   111 00000013 ????                <2> mSECLIM 	DW	? ;0			;Sector limit
   112 00000015 ????                <2> mHDLIM		DW	? ;0			;Head limit
   113 00000017 ????                <2> mHIDSEC_L	DW	? ;0			;Hidden sector count
   114 00000019 ????                <2> mHidsec_H	dw	? ;0			;J.K.87
   115 0000001B ????                <2> mDrvlim_L	dw	? ;0			;J.K.87
   116 0000001D ????                <2> mDrvlim_H	dw	? ;0			;J.K.87
   117 0000001F ??                  <2> mFatSiz 	DB	? ;0			;TRUE => bigfat
   118 00000020 ????                <2> mOPCNT		DW	? ;0			;Open Ref. Count
   119 00000022 ??                  <2> mFormFactor	DB	? ;3			;Form Factor
   120 00000023 ????                <2> mFLAGS		DW	? ;0020H		;Various Flags
   121 00000025 ????                <2> mcCyln		dw	? ;40			;max number of cylinders
   122 00000027 <res 1Fh>           <2> mRecBPB 	db	31 dup (?) ;(0)		;Recommended BPB for drive
   123 00000046 ??                  <2> mTrack		db	? ;-1
   124 00000047 ????                <2> IsMini		dw	? ;1			;Overlapping TIM_LOH
   125 00000049 ????                <2> Hidden_Trks	dw	? ;0			;Overlapping TIM_HIH
   126 0000004B <res Bh>            <2> mVOLID		DB	11 dup (?) ;"NO NAME    "           ;Volume ID for this disk
   127 00000056 ??                  <2> 		DB	? ;0			;ASCIZII for "NO NAME    "
   128 00000057 ????????            <2> mVol_Serial	dd	? ;0	   ;Current volume serial number from Boot record
   129 0000005B ????????????????    <2> mFileSys_Id	db	8 dup (?) ;"FAT12   " ;Current file system id from Boot record
   130 00000063 ??                  <2> 		db	? ;0
   131                              <2> 
   132                              <2> BDSM_type	ENDS
   133                              <2> ;******************************************************************************
   134                              <2> Max_mini_dsk_num equ 23	      ;J.K. 4/7/86 - max # of mini disk ibmbio can support
   135                              <2> ;
   136                              <2> 
    14                              <1> 
    15                              <1> ;AN000; Extended BPB structure.
    16                              <1> BPB_TYPE STRUC
    17 00000000 ????                <1> SECSIZE DW	?
    18 00000002 ??                  <1> SECALL	DB	?
    19 00000003 ????                <1> RESNUM	DW	?
    20 00000005 ??                  <1> FATNUM	DB	?
    21 00000006 ????                <1> DIRNUM	DW	?
    22 00000008 ????                <1> SECNUM	DW	?
    23 0000000A ??                  <1> FATID	DB	?
    24 0000000B ????                <1> FATSIZE DW	?
    25 0000000D ????                <1> SLIM	DW	?
    26 0000000F ????                <1> HLIM	DW	?
    27 00000011 ????                <1> HIDDEN_L  DW	  ?
    28 00000013 ????                <1> HIDDEN_H  dw	  ? ;0			;J.K.
    29 00000015 ????                <1> SECNUM_L  dw	  ? ;0			;J.K.
    30 00000017 ????                <1> SECNUM_H  dw	  ? ;0			;J.K.
    31                              <1> BPB_TYPE ENDS
    32                              <1> 
    33                              <1> ;;;;;;;;;;;
    34                              <1> BOOT_SERIAL_SIZE	equ	4	;J.K.
    35                              <1> BOOT_VOLUME_LABEL_SIZE	equ	11	;J.K.
    36                              <1> BOOT_SYSTEM_ID_SIZE	equ	8	;J.K.
    37                              <1> EXT_BOOT_SIGNATURE	equ	41	;J.K.
    38                              <1> RSINIT equ 0A3H		      ;RS232 INITIALIZATION
    39                              <1> 			      ;9600 BAUD:NO PARITY:1 STOP:8 BIT WORD
    40                              <1> LF equ 10			      ;LINE FEED
    41                              <1> CR equ 13			      ;CARRIAGE RETURN
    42                              <1> BACKSP equ 8		      ;BACKSPACE
    43                              <1> BRKADR equ 1BH * 4		      ;006C  1BH BREAK VECTOR ADDRESS
    44                              <1> TIMADR equ 1CH * 4		      ;0070  1CH TIMER INTERRUPT
    45                              <1> DSKADR equ 1EH * 4		      ;ADDRESS OF PTR TO DISK PARAMETERS
    46                              <1> SEC9 equ 522H		      ;ADDRESS OF DISK PARAMETERS
    47                              <1> HEADSETTLE equ SEC9+9	      ; ARR 2.20 ADDRESS OF HEAD SETTLE TIME
    48                              <1> NORMSETTLE equ 15		      ; ARR 2.20 NORMAL HEAD SETTLE
    49                              <1> SPEEDSETTLE equ 0		      ; ARR 2.20 SPEED UP SETTLE TIME
    50                              <1> INITSPOT equ 534H		      ; ARR IBM WANTS 4 ZEROS HERE
    51                              <1> AKPORT equ 20H
    52                              <1> EOI equ 20H
    53                              <1> CMDLEN	equ	    0			    ;LENGTH OF THIS COMMAND
    54                              <1> UNIT	equ	    1			    ;SUB UNIT SPECIFIER
    55                              <1> CMD	equ	    2			    ;COMMAND CODE
    56                              <1> STATUS	equ	    3			    ;STATUS
    57                              <1> MEDIA	equ	    13			    ;MEDIA DESCRIPTOR
    58                              <1> TRANS	equ	    14			    ;TRANSFER ADDRESS
    59                              <1> COUNT	equ	    18			    ;COUNT OF BLOCKS OR CHARACTERS
    60                              <1> START	equ	    20			    ;FIRST BLOCK TO TRANSFER
    61                              <1> EXTRA	equ	    22			    ;USUALLY A POINTER TO VOL ID FOR ERROR 15
    62                              <1> CHROUT	equ	    29H
    63                              <1> MAXERR	equ	     5
    64                              <1> LSTDRV	equ	     504H
    65                              <1> 
    66                              <1> NOTBUSYSTATUS	equ	10000000B	    ; NOT BUSY
    67                              <1> ACKSTATUS	equ	01000000B	    ; ACKNOWLEDGE (FOR WHAT?)
    68                              <1> NOPAPERSTATUS	equ	00100000B	    ; NO MORE PAPER
    69                              <1> SELECTEDSTATUS	equ	00010000B	    ; THE PRINTER SAID IT WAS SELECTED
    70                              <1> IOERRSTATUS	equ	00001000B	    ; SOME KINDA ERROR
    71                              <1> RESERVED	equ	00000110B	    ; NOPS
    72                              <1> TIMEOUTSTATUS	equ	00000001B	    ; TIME OUT.
    73                              <1> ERROR_UNKNOWN_MEDIA   equ 7		    ; FOR USE IN BUILD BPB CALL
    74                              <1> 
    75                              <1> PATHGEN 	equ	1
    27                                  	%include "devsym.mac"
     1                              <1> 	%warning out: DEVSYM.INC...
     1          ******************  <1>  warning: out: DEVSYM.INC... [-w+user]
     2                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     3                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     4                              <1> 
     5                              <1> ; THE DEVICE TABLE LIST HAS THE FORM:
     6                              <1> SYSDEV	       STRUC
     7 00000000 ????????            <1> SDEVNEXT       DD    ?		    ;POINTER TO NEXT DEVICE HEADER
     8 00000004 ????                <1> SDEVATT        DW    ?		    ;ATTRIBUTES OF THE DEVICE
     9 00000006 ????                <1> SDEVSTRAT      DW    ?		    ;STRATEGY ENTRY POINT
    10 00000008 ????                <1> SDEVINT        DW    ?		    ;INTERRUPT ENTRY POINT
    11 0000000A ????????????????    <1> SDEVNAME       DB    8 DUP (?)	    ;NAME OF DEVICE (ONLY FIRST BYTE USED FOR BLOCK)
    12                              <1> SYSDEV	       ENDS
    13                              <1> 
    14                              <1> ;
    15                              <1> ; ATTRIBUTE BIT MASKS
    16                              <1> ;
    17                              <1> ; CHARACTER DEVICES:
    18                              <1> ;
    19                              <1> ; BIT 15 -> MUST BE 1
    20                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    21                              <1> ;     13 -> 1 IF THE DEVICE SUPPORTS OUTPUT-UNTIL-BUSY
    22                              <1> ;     12 -> UNUSED
    23                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE
    24                              <1> ;     10 -> MUST BE 0
    25                              <1> ;      9 -> MUST BE 0
    26                              <1> ;      8 -> UNUSED
    27                              <1> ;      7 -> UNUSED
    28                              <1> ;      6 -> UNUSED
    29                              <1> ;      5 -> UNUSED
    30                              <1> ;      4 -> 1 IF DEVICE IS RECIPIENT OF INT 29H
    31                              <1> ;      3 -> 1 IF DEVICE IS CLOCK DEVICE
    32                              <1> ;      2 -> 1 IF DEVICE IS NULL DEVICE
    33                              <1> ;      1 -> 1 IF DEVICE IS CONSOLE OUTPUT
    34                              <1> ;      0 -> 1 IF DEVICE IS CONSOLE INPUT
    35                              <1> ;
    36                              <1> ; BLOCK DEVICES:
    37                              <1> ;
    38                              <1> ; BIT 15 -> MUST BE 0
    39                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    40                              <1> ;     13 -> 1 IF THE DEVICE DETERMINES MEDIA BY EXAMINING THE FAT ID BYTE.
    41                              <1> ;	    THIS REQUIRES THE FIRST SECTOR OF THE FAT TO *ALWAYS* RESIDE IN
    42                              <1> ;	    THE SAME PLACE.
    43                              <1> ;     12 -> UNUSED
    44                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE/REMOVABLE MEDIA
    45                              <1> ;     10 -> MUST BE 0
    46                              <1> ;      9 -> MUST BE 0
    47                              <1> ;      8 -> UNUSED
    48                              <1> ;      7 -> UNUSED
    49                              <1> ;      6 -> IF DEVICE HAS SUPPORT FOR GETMAP/SETMAP OF LOGICAL DRIVES.
    50                              <1> ;	    IF THE DEVICE UNDERSTANDS GENERIC IOCTL FUNCTION CALLS.
    51                              <1> ;      5 -> UNUSED
    52                              <1> ;      4 -> UNUSED
    53                              <1> ;      3 -> UNUSED
    54                              <1> ;      2 -> UNUSED
    55                              <1> ;      1 -> UNUSED
    56                              <1> ;      0 -> UNUSED
    57                              <1> ;
    58                              <1> 
    59                              <1> DEVTYP	       EQU   8000H	    ; BIT 15 - 1  IF CHAR, 0 IF BLOCK
    60                              <1> CHARDEV        EQU   8000H
    61                              <1> DEVIOCTL       EQU   4000H	    ; BIT 14 - CONTROL MODE BIT
    62                              <1> ISFATBYDEV     EQU   2000H	    ; BIT 13 - DEVICE USES FAT ID BYTES,
    63                              <1> 				    ;  COMP MEDIA.
    64                              <1> OUTTILBUSY     EQU   2000H	    ; OUTPUT UNTIL BUSY IS ENABLED
    65                              <1> ISNET	       EQU   1000H	    ; BIT 12 - 1 IF A NET DEVICE, 0 IF
    66                              <1> 				    ;  NOT.  CURRENTLY BLOCK ONLY.
    67                              <1> DEVOPCL        EQU   0800H	    ; BIT 11 - 1 IF THIS DEVICE HAS
    68                              <1> 				    ;  OPEN,CLOSE AND REMOVABLE MEDIA
    69                              <1> 				    ;  ENTRY POINTS, 0 IF NOT
    70                              <1> 
    71                              <1> EXTENTBIT      EQU   0400H	    ; BIT 10 - CURRENTLY 0 ON ALL DEVS
    72                              <1> 				    ;  THIS BIT IS RESERVED FOR FUTURE USE
    73                              <1> 				    ;  TO EXTEND THE DEVICE HEADER BEYOND
    74                              <1> 				    ;  ITS CURRENT FORM.
    75                              <1> 
    76                              <1> ; NOTE BIT 9 IS CURRENTLY USED ON IBM SYSTEMS TO INDICATE "DRIVE IS SHARED".
    77                              <1> ;    SEE IOCTL FUNCTION 9. THIS USE IS NOT DOCUMENTED, IT IS USED BY SOME
    78                              <1> ;    OF THE UTILITIES WHICH ARE SUPPOSED TO FAIL ON SHARED DRIVES ON SERVER
    79                              <1> ;    MACHINES (FORMAT,CHKDSK,RECOVER,..).
    80                              <1> 
    81                              <1> DEV320	       EQU   0040H	    ;BIT 6 - FOR BLOCK DEVICES, THIS
    82                              <1> 				    ;DEVICE SUPPORTS SET/GET MAP OF
    83                              <1> 				    ;LOGICAL DRIVES, AND SUPPORTS
    84                              <1> 				    ;GENERIC IOCTL CALLS.
    85                              <1> 				    ;FOR CHARACTER DEVICES, THIS
    86                              <1> 				    ;DEVICE SUPPORTS GENERIC IOCTL.
    87                              <1> 				    ;THIS IS A DOS 3.2 DEVICE DRIVER.
    88                              <1> ISSPEC	       EQU   0010H	    ;BIT 4 - THIS DEVICE IS SPECIAL
    89                              <1> ISCLOCK        EQU   0008H	    ;BIT 3 - THIS DEVICE IS THE CLOCK DEVICE.
    90                              <1> ISNULL	       EQU   0004H	    ;BIT 2 - THIS DEVICE IS THE NULL DEVICE.
    91                              <1> ISCOUT	       EQU   0002H	    ;BIT 1 - THIS DEVICE IS THE CONSOLE OUTPUT.
    92                              <1> ISCIN	       EQU   0001H	    ;BIT 0 - THIS DEVICE IS THE CONSOLE INPUT.
    93                              <1> EXTDRVR        EQU   0002H	    ;BIT 1 - BLOCK DEVICE EXTNDED DRIVER
    94                              <1> 
    95                              <1> ;STATIC REQUEST HEADER
    96                              <1> SRHEAD	       STRUC
    97 00000000 ??                  <1> REQLEN	       DB    ?		    ;LENGTH IN BYTES OF REQUEST BLOCK
    98 00000001 ??                  <1> REQUNIT        DB    ?		    ;DEVICE UNIT NUMBER
    99 00000002 ??                  <1> REQFUNC        DB    ?		    ;TYPE OF REQUEST
   100 00000003 ????                <1> REQSTAT        DW    ?		    ;STATUS WORD
   101 00000005 ????????????????    <1> 	       DB    8 DUP(?)	    ;RESERVED FOR QUEUE LINKS
   102                              <1> SRHEAD	       ENDS
   103                              <1> 
   104                              <1> ;STATUS WORD MASKS
   105                              <1> STERR	       EQU   8000H	    ;BIT 15 - ERROR
   106                              <1> STBUI	       EQU   0200H	    ;BIT 9 - BUISY
   107                              <1> STDON	       EQU   0100H	    ;BIT 8 - DONE
   108                              <1> STECODE        EQU   00FFH	    ;ERROR CODE
   109                              <1> ;						  2/12/KK
   110                              <1> ; Interim  character identifier 		  2/12/KK
   111                              <1> Ddkey		EQU	0000010000000000B	; 2/12/KK
   112                              <1> 
   113                              <1> ;FUNCTION CODES
   114                              <1> DEVINIT        EQU   0		    ;INITIALIZATION
   115                              <1> DINITHL        EQU   26 	    ;SIZE OF INIT HEADER
   116                              <1> DEVMDCH        EQU   1		    ;MEDIA CHECK
   117                              <1> DMEDHL	       EQU   15 	    ;SIZE OF MEDIA CHECK HEADER
   118                              <1> DEVBPB	       EQU   2		    ;GET BPB
   119                              <1> DEVRDIOCTL     EQU   3		    ;IOCTL READ
   120                              <1> DBPBHL	       EQU   22 	    ;SIZE OF GET BPB HEADER
   121                              <1> DEVRD	       EQU   4		    ;READ
   122                              <1> DRDWRHL        EQU   22 	    ;SIZE OF RD/WR HEADER
   123                              <1> DEVRDND        EQU   5		    ;NON DESTRUCTIVE READ NO WAIT (CHARACTER DEVS)
   124                              <1> DRDNDHL        EQU   14 	    ;SIZE OF NON DESTRUCTIVE READ HEADER
   125                              <1> DEVIST	       EQU   6		    ;INPUT STATUS
   126                              <1> DSTATHL        EQU   13 	    ;SIZE OF STATUS HEADER
   127                              <1> DEVIFL	       EQU   7		    ;INPUT FLUSH
   128                              <1> DFLSHL	       EQU   15 	    ;SIZE OF FLUSH HEADER
   129                              <1> DEVWRT	       EQU   8		    ;WRITE
   130                              <1> DEVWRTV        EQU   9		    ;WRITE WITH VERIFY
   131                              <1> DEVOST	       EQU   10 	    ;OUTPUT STATUS
   132                              <1> DEVOFL	       EQU   11 	    ;OUTPUT FLUSH
   133                              <1> DEVWRIOCTL     EQU   12 	    ;IOCTL WRITE
   134                              <1> DEVOPN	       EQU   13 	    ;DEVICE OPEN
   135                              <1> DEVCLS	       EQU   14 	    ;DEVICE CLOSE
   136                              <1> DOPCLHL        EQU   13 	    ;SIZE OF OPEN/CLOSE HEADER
   137                              <1> DEVRMD	       EQU   15 	    ;REMOVABLE MEDIA
   138                              <1> REMHL	       EQU   13 	    ;SIZE OF REMOVABLE MEDIA HEADER
   139                              <1> GENIOCTL       EQU   19
   140                              <1> ; THE NEXT THREE ARE USED IN DOS 4.0
   141                              <1> ;		     20
   142                              <1> ;		     21
   143                              <1> ;		     22
   144                              <1> DEVGETOWN      EQU   23 	    ;GET DEVICE OWNER
   145                              <1> DEVSETOWN      EQU   24 	    ;SET DEVICE OWNER
   146                              <1> QUERYGENIOCTL equ 25		; query generic IOCTL support (MS-DOS v5+)
   147                              <1> OWNHL	       EQU   13 	    ;SIZE OF DEVICE OWNER HEADER
   148                              <1> 
   149                              <1> DEVOUT	       EQU   16 	    ; OUTPUT UNTIL BUSY.
   150                              <1> DEVOUTL        EQU   DEVWRT	    ; LENGTH OF OUTPUT UNTIL BUSY
   151                              <1> 
   152                              <1> ; GENERIC IOCTL REQUEST STRUCTURE
   153                              <1> ;	SEE THE DOS 4.0 DEVICE DRIVER SPEC FOR FURTHER ELABORATION.
   154                              <1> ;
   155                              <1> IOCTL_REQ      STRUC
   156 00000000 <res Dh>            <1> 	       DB    (SRHEAD_struc_size) DUP(?)
   157                              <1> 				    ; GENERIC IOCTL ADDITION.
   158 0000000D ??                  <1> MAJORFUNCTION  DB    ?		    ;FUNCTION CODE
   159 0000000E ??                  <1> MINORFUNCTION  DB    ?		    ;FUNCTION CATEGORY
   160 0000000F ????                <1> REG_SI	       DW    ?
   161 00000011 ????                <1> REG_DI	       DW    ?
   162 00000013 ????????            <1> GENERICIOCTL_PACKET DD ?	    ; POINTER TO DATA BUFFER
   163                              <1> IOCTL_REQ      ENDS
   164                              <1> 
   165                              <1> ;	DEFINITIONS FOR IOCTL_REQ.MINORFUNCTION
   166                              <1> GEN_IOCTL_WRT_TRK   EQU   40H
   167                              <1> GEN_IOCTL_RD_TRK    EQU   60H
   168                              <1> GEN_IOCTL_FN_TST    EQU   20H	    ; USED TO DIFF. BET READS AND WRTS
   169                              <1> 
   170                              <1> ;; 32-bit absolute read/write input list structure
   171                              <1> 
   172                              <1> ABS_32RW	 STRUC
   173 00000000 ????????            <1> SECTOR_RBA	 DD	 ?	    ; relative block address
   174 00000004 ????                <1> ABS_RW_COUNT	 DW	 ?	    ; number of sectors to be transferred
   175 00000006 ????????            <1> BUFFER_ADDR	 DD	 ?	    ; data addrress
   176                              <1> ABS_32RW	 ENDS
   177                              <1> 
   178                              <1> ;; media ID info
   179                              <1> 
   180                              <1> MEDIA_ID_INFO	 STRUC
   181 00000000 ????                <1> MEDIA_level	 DW	 ?	    ; info level
   182 00000002 ????????            <1> MEDIA_Serial	 DD	 ?	    ; serial #
   183 00000006 <res Bh>            <1> MEDIA_Label	 DB	 11 dup (?) ;volume label
   184 00000011 ????????????????    <1> MEDIA_System	 DB	 8  dup (?) ;system type
   185                              <1> MEDIA_ID_INFO	 ENDS
   186                              <1> 
   187                              <1> ;; equates for DOS34_FLAG
   188                              <1> 
   189                              <1> IFS_ABSRW	      EQU   00001H	   ;IFS absolute read/write
   190                              <1> NO_IFS_ABSRW	      EQU   0FFFEH	   ;no IFS absolute read/write
   191                              <1> IFS_DRIVE_RESET       EQU   00002H	   ;IFS drvive reset
   192                              <1> NO_IFS_DRIVE_RESET    EQU   0FFFDH	   ;no IFS drive reset
   193                              <1> FROM_DISK_RESET       EQU   00004H	   ;from disk reset
   194                              <1> NO_FROM_DISK_RESET    EQU   0FFFBH	   ;not from disk reset
   195                              <1> From_String_Output    EQU   00008H	   ;from con string output
   196                              <1> NO_From_String_Output EQU   0FFF7H	   ;not from con string output
   197                              <1> From_DOS_WRITE	      EQU   00010H	   ;from dos_write
   198                              <1> NO_From_DOS_WRITE     EQU   0FFEFH	   ;not from dos_write
   199                              <1> Force_I24_Fail	      EQU   00020H	   ;form IFS CALL BACK
   200                              <1> NO_Force_I24_Fail     EQU   0FFDFH	   ;not form IFS CALL BACK
   201                              <1> Disable_EOF_I24       EQU   00040H	   ;disable EOF int24 for input status
   202                              <1> NO_Disable_EOF_I24    EQU   0FFBFH	   ;disable EOF int24 for input status
   203                              <1> DBCS_VOLID	      EQU   00080H	   ;indicate from volume id
   204                              <1> DBCS_VOLID2	      EQU   00100H	   ;indicate 8th char is DBCS
   205                              <1> CTRL_BREAK_FLAG       EQU   00200H	   ;indicate control break is input
   206                              <1> NO_CTRL_BREAK_FLAG    EQU   0FDFFH	   ;reset control break
   207                              <1> SEARCH_FASTOPEN       EQU   00400H	   ;set fastopen flag for search
   208                              <1> X25_special	      EQU   00800H	   ;flag for X25 driver
    28                                  	%include "pushpop.mac"
     1                              <1> ; NASM original macros
     2                              <1> 
     3                              <1> %unimacro stripangles 2.nolist
     4                              <1> %assign ?stackdepth 0
     5                              <1> 
     6                              <1> %imacro stripangles 2.nolist
     7                              <1> %defstr %%param %2
     8                              <1> %rep 16
     9                              <1>  %substr %%opening %%param 1
    10                              <1>  %ifidn %%opening, '<'
    11                              <1>   %substr %%param %%param 2,-1
    12                              <1>  %endif
    13                              <1> %endrep
    14                              <1> %rep 16
    15                              <1>  %strlen %%length %%param
    16                              <1>  %substr %%closing %%param %%length
    17                              <1>  %ifidn %%closing, '>'
    18                              <1>   %substr %%param %%param 1,-2
    19                              <1>  %endif
    20                              <1> %endrep
    21                              <1> %deftok %%token %%param
    22                              <1> %1 %%token
    23                              <1> %endmacro
    24                              <1> 
    25                              <1> ;BREAK <SaveReg - save a set of registers>
    26                              <1> 
    27                              <1> %imacro SaveReg 0-*.nolist                 ;; push those registers
    28                              <1>  %rep %0
    29                              <1> 	%assign ?stackdepth ?stackdepth + 1
    30                              <1> 	stripangles push, %1
    31                              <1> 	%rotate 1
    32                              <1>  %endrep
    33                              <1> %endmacro
    34                              <1> ;.xcref  SaveReg
    35                              <1> 
    36                              <1> ;BREAK <RestoreReg - unsave some registers>
    37                              <1> 
    38                              <1> %imacro RestoreReg 0-*.nolist             ;; pop those registers
    39                              <1>  %rep %0
    40                              <1> 	%assign ?stackdepth ?stackdepth - 1
    41                              <1> 	stripangles pop, %1
    42                              <1> 	%rotate 1
    43                              <1>  %endrep
    44                              <1> %endmacro
    45                              <1> ;.xcref  RestoreReg
    29                                  	%include "msmacro.mac"
     1                              <1> 
     2                              <1> %include "dcodeseg.nas"
     1                              <2> 
     2                              <2> %ifndef DCODESEGNAS
     3                              <2> %assign DCODESEGNAS 1
     4                              <2> 
     5                              <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE
     6                              <2> ; (no prior section) ; DOSCODETABLE		ENDS
     7                              <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE
     8                              <2> ; (no prior section) ; DOSCODECODE		ENDS
     9                              <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE
    10                              <2> section BIOCODE	align=2 PUBLIC class=DOSCODE
    11                              <2> 
    12                              <2> %ifnidni DOSENTRYGROUP, DOSCODEGROUP
    13                              <2>  group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE
    14                              <2> %endif
    15                              <2> 
    16                              <2> %endif
     3                              <1> section BIOCODE
     4                              <1> 
     5                              <1> ;
     6                              <1> ; This file contains three macros used in debugging the system.  If the
     7                              <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the
     8                              <1> ; modules to print debugging messages.	The level of debugging is controlled
     9                              <1> ; by the value of the variable fTestBits in msbio.asm.	Specific bits in
    10                              <1> ; the variable determine which messages to print.  The equ's below tell
    11                              <1> ; which bits control which funcitons.  For example the fifth bit
    12                              <1> ; cooresponds to disk activity (see fTestDisk equ below).
    13                              <1> ;
    14                              <1> ;   The macros in the file are:
    15                              <1> ;
    16                              <1> ;	message    Prints an ascii string on the screen.
    17                              <1> ;		   Example usage:
    18                              <1> ;
    19                              <1> ;		      message fTestDisk, <"Start Disk Write", CR, LF>
    20                              <1> ;		      message fTestINIT, <"Begin BDS initialization">
    21                              <1> ;
    22                              <1> ;
    23                              <1> ;	MNUM	   Print the value in a register or memory location on
    24                              <1> ;		   the screen. Value is displayed in hex.
    25                              <1> ;		   Usage:
    26                              <1> ;		      MNUM  bitpattern, valueLocation
    27                              <1> ;
    28                              <1> ;		   valueLocation is typically a regester:
    29                              <1> ;
    30                              <1> ;		      mnum  fTestCom, AX
    31                              <1> ;		      mnum  fTestDisk, DX
    32                              <1> ;
    33                              <1> ;		   ValueLocation can also be a memory location:
    34                              <1> ;
    35                              <1> ;		      mnum  fTestINIT, Final_Dos_Location
    36                              <1> ;
    37                              <1> ;		   If no valueLocation is given the macro defaults to
    38                              <1> ;		   the BX register.
    39                              <1> ;
    40                              <1> ;	ZWAIT	    Stops the program until any key is pressed.
    41                              <1> ;
    42                              <1> ;
    43                              <1> ;	The three macros preserve all register values.	If "test" is zero
    44                              <1> ;	defined during assembly then the  marco produce no code.
    45                              <1> ;
    46                              <1> 
    47                              <1> 	%IF	itest							  ;3.30
    48                              <1> 		EXTRN	MSGOUT:NEAR,MSGNUM:NEAR 			  ;3.30
    49                              <1> 	    EXTRN   NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD		  ;3.30
    50                              <1> 		EXTRN	DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR	  ;3.30
    51                              <1> 
    52                              <1> 
    53                              <1> fTestALL    equ     1111111111111111b	; watch everything
    54                              <1> fTestHARD   equ     0000000000000001b	; watch hard disk initialization
    55                              <1> fTest96     equ     0000000000000010b	; watch 96 tpi activity
    56                              <1> FTEST13     EQU     0000000000000100B	; WATCH INT 13 ACTIVITY 	  ;3.30
    57                              <1> FTESTCOM    EQU     0000000000001000B	; WATCH PACKET ACTIVITY 	  ;3.30
    58                              <1> FTESTINIT   EQU     0000000000010000B	; WATCH INITIALIZATION MESSAGES   ;3.30
    59                              <1> FTESTDISK   EQU     0000000000100000B	; WATCH DISK DEVICE DRIVER CALLS  ;3.30
    60                              <1> FTESTCON    EQU     0000000001000000B	; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE
    61                              <1> FtestClock  equ     0000000010000000b	; wathc clock device  5/2/86  ;3.30
    62                              <1> 
    63                              <1> ; NASM original macros
    64                              <1> 
    65                              <1> ;
    66                              <1> ; message macro -- see above for description
    67                              <1> ;
    68                              <1> 
    69                              <1> %unimacro stripangles 2+.nolist
    70                              <1> 
    71                              <1> %imacro stripangles 2+.nolist
    72                              <1> %defstr %%param %2
    73                              <1> %rep 16
    74                              <1>  %substr %%opening %%param 1
    75                              <1>  %ifidn %%opening, '<'
    76                              <1>   %substr %%param %%param 2,-1
    77                              <1>  %endif
    78                              <1> %endrep
    79                              <1> %rep 16
    80                              <1>  %strlen %%length %%param
    81                              <1>  %substr %%closing %%param %%length
    82                              <1>  %ifidn %%closing, '>'
    83                              <1>   %substr %%param %%param 1,-2
    84                              <1>  %endif
    85                              <1> %endrep
    86                              <1> %deftok %%token %%param
    87                              <1> %1 %%token
    88                              <1> %endmacro
    89                              <1> 
    90                              <1> %imacro MESSAGE 2+
    91                              <1> 	jmp short %%b
    92                              <1> %%a:
    93                              <1> 	stripangles db, %2
    94                              <1> 	db 0
    95                              <1> %%b:	push	SI
    96                              <1> 	push	AX
    97                              <1> 	mov	AX, %1
    98                              <1> 	mov	SI, OFFSET %%a
    99                              <1> 	call	MSGOUT
   100                              <1> 	pop	AX
   101                              <1> 	pop	SI
   102                              <1> %endmacro
   103                              <1> 
   104                              <1> 
   105                              <1> ;
   106                              <1> ; mnum macro -- see above for description
   107                              <1> ;
   108                              <1> 
   109                              <1> %imacro MNum 1-2
   110                              <1> 	push	AX
   111                              <1> %ifempty %2
   112                              <1> 	mov	AX,%1
   113                              <1> 	call	MSGNUM
   114                              <1> %else
   115                              <1> 	push	BX
   116                              <1> 	mov	BX,%2
   117                              <1> 	mov	AX,%1
   118                              <1> 	call	MSGNUM
   119                              <1> 	pop	BX
   120                              <1> %endif
   121                              <1> 	pop	AX
   122                              <1> %endmacro
   123                              <1> 
   124                              <1> 
   125                              <1> ;
   126                              <1> ; zwait macro -- see above for description
   127                              <1> ;
   128                              <1> 
   129                              <1> %imacro ZWAIT 0
   130                              <1> 	Message fTestALL,<"? ">
   131                              <1> 	CALL	ZWAITrtn
   132                              <1> %endmacro
   133                              <1> 
   134                              <1> ZWAITrtn:
   135                              <1> 	pushf				; save the flags
   136                              <1> 	push	AX			; preserve AX
   137                              <1> 	xor	AH, AH			; set command to get character ;3.30*
   138                              <1> 	int	16h			; call rom keyboard routine    ;3.30*
   139                              <1> 	pop	AX			; restore AX
   140                              <1> 	popf				; restore the flags
   141                              <1> 	ret
   142                              <1> 
   143                              <1> ;Dump_byte dumps the memory contents in hex. 				  ;3.30
   144                              <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG.	  ;3.30
   145                              <1> %imacro DUMP_BYTE 3
   146                              <1> 	push	es							  ;3.30
   147                              <1> 	PUSH	DS							  ;3.30
   148                              <1> 	PUSH	SI							  ;3.30
   149                              <1> 	PUSH	CX							  ;3.30
   150                              <1> 									  ;3.30
   151                              <1> 	MOV	CX, %1							  ;3.30
   152                              <1> 	MOV	DS, CX							  ;3.30
   153                              <1> 	MOV	SI, OFFSET %2						  ;3.30
   154                              <1> 	MOV	CX, %3							  ;3.30
   155                              <1> 	call	dumpbytes						  ;3.30
   156                              <1> 									  ;3.30
   157                              <1> 	POP	CX							  ;3.30
   158                              <1> 	POP	SI							  ;3.30
   159                              <1> 	POP	DS							  ;3.30
   160                              <1> 	pop	es							  ;3.30
   161                              <1> %endmacro								  ;3.30
   162                              <1> 									  ;3.30
   163                              <1> ;Dump_Byte_Reg dumps the memory contents in hex. -  4/9/86		  ;3.30
   164                              <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG.	  ;3.30
   165                              <1> %imacro DUMP_BYTE_REG 3
   166                              <1> DUMP_BYTE_REG	MACRO	DUMPSEG, DUMPOFFREG, BYTELENGTH 		  ;3.30
   167                              <1> 	push	es							  ;3.30
   168                              <1> 	PUSH	DS							  ;3.30
   169                              <1> 	PUSH	SI							  ;3.30
   170                              <1> 	PUSH	CX							  ;3.30
   171                              <1> 									  ;3.30
   172                              <1> 	MOV	CX, %1							  ;3.30
   173                              <1> 	MOV	DS, CX							  ;3.30
   174                              <1> 	MOV	SI, %2							  ;3.30
   175                              <1> 	MOV	CX, %3							  ;3.30
   176                              <1> 	call	dumpbytes						  ;3.30
   177                              <1> 									  ;3.30
   178                              <1> 	POP	CX							  ;3.30
   179                              <1> 	POP	SI							  ;3.30
   180                              <1> 	POP	DS							  ;3.30
   181                              <1> 	pop	es							  ;3.30
   182                              <1> %endmacro								  ;3.30
   183                              <1> 
   184                              <1> %else
   185                              <1> 		; if test is not defined then make macro into null statements
   186                              <1> %imacro Message 0-1+.nolist
   187                              <1> %endmacro
   188                              <1> 
   189                              <1> %imacro MNUM 0-1+.nolist
   190                              <1> %endmacro
   191                              <1> 
   192                              <1> %imacro ZWAIT 0-1+.nolist
   193                              <1> %endmacro
   194                              <1> 
   195                              <1> %imacro DUMP_BYTE 0-1+.nolist
   196                              <1> %endmacro
   197                              <1> 
   198                              <1> %imacro DUMP_BYTE_REG 0-1+.nolist
   199                              <1> %endmacro
   200                              <1> 
   201                              <1> %endif
   202                              <1> 
   203                              <1> %unimacro PATHSTART 2
   204                              <1> %unimacro PATHEND 2
   205                              <1> 
   206                              <1> %imacro PATHSTART 2
   207                              <1> 	%IF	PATHGEN							  ;3.30
   208                              <1> 	    PUBLIC  %2%1S,%2%1E						  ;3.30
   209                              <1> 	    %2%1S LABEL	 BYTE						  ;3.30
   210                              <1> 	%ENDIF								  ;3.30
   211                              <1> %endmacro								  ;3.30
   212                              <1> 									  ;3.30
   213                              <1> %imacro PATHEND 2
   214                              <1> 	%IF	PATHGEN							  ;3.30
   215                              <1> 	    %2%1E LABEL	 BYTE						  ;3.30
   216                              <1> 	%ENDIF								  ;3.30
   217                              <1> %endmacro								  ;3.30
    30                                  	%include "ddataseg.nas"
     1                              <1> 
     2                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
     3                              <1> 
     4                              <1> addsection DOSSTART, align=16 PUBLIC class=DOSSTART
     5                              <1> ; (no prior section) ; DOSSTART		ENDS
     6                              <1> 
     7                              <1> addsection DOSSTARTJUMP, align=1 PUBLIC class=START
     8                              <1> ; (no prior section) ; DOSSTARTJUMP		ENDS
     9                              <1> 
    10                              <1> addsection CONSTANTS, align=2 PUBLIC class=CONST
    11                              <1> ; (no prior section) ; CONSTANTS	ENDS
    12                              <1> 
    13                              <1> addsection DATA, align=2 PUBLIC class=DATA
    14                              <1> ; (no prior section) ; DATA		ENDS
    15                              <1> 
    16                              <1> addsection TABLE, align=2 PUBLIC class=TABLE
    17                              <1> ; (no prior section) ; TABLE		ENDS
    18                              <1> 
    19                              <1> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE
    20                              <1> ; (no prior section) ; DOSDATATABLE		ENDS
    21                              <1> 
    22                              <1> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE
    23                              <1> ; (no prior section) ; DOSDATACODE		ENDS
    24                              <1> 
    25                              <1> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA
    26                              <1> 
    27                              <1> addsection LAST, align=16 PUBLIC class=LAST
    28                              <1> ; (no prior section) ; LAST		ENDS
    29                              <1> 
    30                              <1> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST
    31                                  	%include "dcodeseg.nas"
     1                              <1> 
     2                              <1> %ifndef DCODESEGNAS
     3                              <1> %assign DCODESEGNAS 1
     4                              <1> 
     5                              <1> section DOSCODETABLE align=2 PUBLIC class=DOSCODE
     6                              <1> ; (no prior section) ; DOSCODETABLE		ENDS
     7                              <1> section DOSCODECODE align=1 PUBLIC class=DOSCODE
     8                              <1> ; (no prior section) ; DOSCODECODE		ENDS
     9                              <1> section DOSBIOCODE align=2 PUBLIC class=DOSCODE
    10                              <1> section BIOCODE	align=2 PUBLIC class=DOSCODE
    11                              <1> 
    12                              <1> %ifnidni DOSENTRYGROUP, DOSCODEGROUP
    13                              <1>  group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE
    14                              <1> %endif
    15                              <1> 
    16                              <1> %endif
    32                                  	%include "codesw.mac"
     1                              <1> DOSCODE_HMA_SEGMENT equ 0FFFEh
     2                              <1> 	; address DOSCODE at this segment when in HMA
     3                              <1> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h
     4                              <1> 	; offset from DOSCODE offset 0 to address 10_0000h
     5                              <1> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h
     6                              <1> 	; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB
    33                                  
    34                                  addsection BIOCODE
    35                                  
    36                                  addsection SYSINITSEG, PUBLIC class=INIT
    37                                  addsection SYSINITTRAIL, PUBLIC class=INIT
    38                                  
    39                                  group SYSINITGROUP SYSINITSEG SYSINITTRAIL
    40                                  
    41                                  usesection BIOCODE
    42                                  
    43                                   assume ds:nothing, es:nothing, ss:nothing
    44                                  
    45                                  	extern biocode_get_ds_dosentry, biocode_get_es_dosentry
    46                                  	extern dosbiocode_get_ds_dosentry, dosbiocode_get_es_dosentry
    47                                  	extern biocode_get_ds_dosbiodata
    48                                  	extern biocode_get_es_dosbiodata
    49                                  	extern dosbiocode_get_ds_dosbiodata
    50                                  	extern dosbiocode_get_es_dosbiodata
    51                                  
    52                                  	EXTRN	DSK$IN:NEAR
    53                                  	EXTRN	SETPTRSAV:NEAR
    54                                  	EXTRN	OUTCHR:NEAR
    55                                  	EXTRN	SETDRIVE:NEAR
    56                                  	EXTRN	FLUSH:NEAR
    57                                  	EXTRN	HARDERR:NEAR
    58                                  	EXTRN	HARDERR2:NEAR
    59                                  	EXTRN	MAPERROR:NEAR
    60                                  	EXTRN	GETBP:NEAR
    61                                  	EXTRN	CHECKSINGLE:NEAR
    62                                  	EXTRN	CHECK_TIME_OF_ACCESS:NEAR
    63                                  	EXTRN	EXIT:NEAR
    64                                  	EXTRN	HAS1:NEAR
    65                                  	EXTRN	READ_SECTOR:NEAR
    66                                  
    67                                  	EXTRN	OLD13:DWORD
    68                                  
    69                                  ;DATA
    70                                  	EXTRN	PTRSAV:DWORD		;IBMBIO1
    71                                  	EXTRN	START_BDS:WORD
    72                                  	EXTRN	FDRIVE1:WORD
    73                                  	EXTRN	FDRIVE2:WORD
    74                                  	EXTRN	FDRIVE3:WORD
    75                                  	EXTRN	FDRIVE4:WORD
    76                                  	EXTRN	FLAGBITS:WORD
    77                                  	EXTRN	TIM_DRV:BYTE
    78                                  	EXTRN	MEDBYT:BYTE
    79                                  	EXTRN	DRVMAX:BYTE
    80                                  	extrn	Ext_Boot_Sig:byte		;AN000; ibmbdata
    81                                  	extrn	SecPerClusInSector:byte 	;AN000; ibmbdata
    82                                  	extrn	Boot_Serial_L:word		;AN000; ibmbdata
    83                                  	extrn	Boot_Serial_H:word		;AN000; ibmbdata
    84                                  
    85                                  
    86                                  	usesection DOSBIODATA
    87                                  
    88                                  	extern	MODEL_BYTE
    89                                  	extern	Secondary_Model_Byte
    90                                  	extern	INT19SEM
    91                                  %macro int19oldextern 1-*
    92                                   %rep %0
    93                                  	extern	Int19OLD%1
    94                                    %rotate 1
    95                                   %endrep
    96                                  %endmacro
    97                                  	int19oldextern 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77
    92                              <1>  %rep %0
    93                              <1>  extern Int19OLD%1
    94                              <1>  %rotate 1
    95                              <1>  %endrep
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    93                              <2>  extern Int19OLD%1
    94                              <2>  %rotate 1
    98                                  	extern dskdrvs_indirect
    99                                  
   100                                  
   101                                  	addsection DOSBIOCODE
   102                                  
   103                                  ;  INT19
   104                                  ;
   105                                  ;	WE "HOOK" THE INT 19 VECTOR, BECAUSE CONTRARY TO IBM DOCUMENTATION,
   106                                  ;  IT DOES NOT "BOOTSTRAP" THE MACHINE.  IT LEAVES MEMORY ALMOST UNTOUCHED.
   107                                  ;  SINCE THE BIOS_INIT CODE ASSUMES THAT CERTAIN INTERRUPT VECTORS POINT TO
   108                                  ;  THE ROM_BIOS  WE MUST "UNHOOK" THEM BEFORE ISSUING THE ACTUAL INT_19.
   109                                  ;  CURRENTLY THE ONLY VECTORS THAT NEED TO BE UNHOOKED ARE INT_19, INT_13,
   110                                  ;  AND THE HARDWARE INTERRUPTS.
   111                                  ;
   112                                  relocated i19
   113                                  INT19	PROC	FAR
   114                                   assume ds:nothing, es:nothing, ss:nothing
   115                                  
   116                                   extern InterruptRestorationTable
   117 00000000 FC                      	cld
   118 00000001 E8(0000)                	call dosbiocode_get_ds_dosentry	; IRT in DOSENTRY
   119                                   assume ds:DOSENTRYGROUP	; ds => DOSENTRY
   120 00000004 BE[0000]                	mov si, InterruptRestorationTable
   121                                  .loop:
   122 00000007 31C0                    	xor ax, ax
   123 00000009 8EC0                    	mov es, ax		; es => IVT
   124                                   assume es:IVT
   125 0000000B AC                      	lodsb
   126 0000000C 3CFF                    	cmp al, -1
   127 0000000E 7409                    	je .done
   128 00000010 97                      	xchg di, ax		; di = interrupt number
   129 00000011 01FF                    	add di, di
   130 00000013 01FF                    	add di, di		; es:di -> interrupt vector
   131 00000015 A5                      	movsw
   132 00000016 A5                      	movsw			; restore from IRT
   133 00000017 EBEE                    	jmp .loop
   134                                  .done:
   135                                  
   136                                  %ifnidni %[DOSBIODATA], %[DOSENTRY]
   137 00000019 06                      	push es
   138 0000001A 1F                      	pop ds			; => IVT
   139 0000001B E8(0000)                	call biocode_get_es_dosbiodata
   140                                   assume ds:IVT, es:DOSGROUP
   141                                  %else
   142                                  	push es
   143                                  	push ds
   144                                  	pop es
   145                                  	pop ds			; swap, es => DOSENTRY, ds => IVT
   146                                  %endif
   147                                  
   148 0000001E 26803E[0000]00          	CMP	BYTE [es:INT19SEM], 0
   149 00000024 7503                    	JNZ	INT19VECS
   150 00000026 E98C01                  	JMP	DOINT19
   151                                  
   152                                  %if 0	; dead code
   153                                  ;	ON THE PCJR, DON'T REPLACE ANY VECTORS
   154                                  ;	MODEL BYTE DEFINITIONS FROM IBMSTACK.ASM
   155                                  	MOV	AX,ROMSEGMENT
   156                                  	MOV	DS,AX
   157                                  	MOV	AL,MODELPCJR
   158                                  
   159                                  	CMP	AL,[MODELBYTE]
   160                                  	JNE	INT19VECS
   161                                  	JMP	DOINT19
   162                                  %endif
   163                                  
   164                                  ;Stacks code has changed these hardware interrupt vectors
   165                                  ;STKINIT in SYSINIT1 will initialzie Int19hOLDxx values.
   166                                  INT19VECS:
   167 00000029 31C0                    	XOR	AX,AX
   168 0000002B 8ED8                    	MOV	DS,AX
   169                                   assume ds:IVT
   170                                  
   171                                  
   172                                  %macro int19restore 1-*
   173                                   %rep %0
   174                                  	call dosbiocode_get_es_dosbiodata
   175                                   assume es:DOSGROUP
   176                                  	LES	DI,[es:Int19OLD%1]
   177                                   assume es:nothing
   178                                  ;SB33103******************************************************************
   179                                  
   180                                  	mov	ax,es		;
   181                                  	cmp	ax,-1		;OPT 0ffffh is unlikely segment
   182                                  	je	skip_int%1	;OPT no need to check selector too 
   183                                  	cmp	di,-1		;OPT 0ffffh is unlikely offset
   184                                  	je	skip_int%1
   185                                  
   186                                  ;SB33103******************************************************************
   187                                  	MOV	[%1H*4],DI
   188                                  	MOV	[%1H*4+2],ES
   189                                  skip_int%1:
   190                                    %rotate 1
   191                                   %endrep
   192                                  %endmacro
   193                                  
   194                                  	int19restore 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77
   173                              <1>  %rep %0
   174                              <1>  call dosbiocode_get_es_dosbiodata
   175                              <1>  assume es:DOSGROUP
   176                              <1>  LES DI,[es:Int19OLD%1]
   177                              <1>  assume es:nothing
   178                              <1> 
   179                              <1> 
   180                              <1>  mov ax,es
   181                              <1>  cmp ax,-1
   182                              <1>  je skip_int%1
   183                              <1>  cmp di,-1
   184                              <1>  je skip_int%1
   185                              <1> 
   186                              <1> 
   187                              <1>  MOV [%1H*4],DI
   188                              <1>  MOV [%1H*4+2],ES
   189                              <1> skip_int%1:
   190                              <1>  %rotate 1
   191                              <1>  %endrep
   174 0000002D E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000030 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000035 8CC0                <2>  mov ax,es
   181 00000037 83F8FF              <2>  cmp ax,-1
   182 0000003A 740D                <2>  je skip_int%1
   183 0000003C 83FFFF              <2>  cmp di,-1
   184 0000003F 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000041 893E0800            <2>  MOV [%1H*4],DI
   188 00000045 8C060A00            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000049 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 0000004C 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000051 8CC0                <2>  mov ax,es
   181 00000053 83F8FF              <2>  cmp ax,-1
   182 00000056 740D                <2>  je skip_int%1
   183 00000058 83FFFF              <2>  cmp di,-1
   184 0000005B 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 0000005D 893E2000            <2>  MOV [%1H*4],DI
   188 00000061 8C062200            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000065 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000068 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 0000006D 8CC0                <2>  mov ax,es
   181 0000006F 83F8FF              <2>  cmp ax,-1
   182 00000072 740D                <2>  je skip_int%1
   183 00000074 83FFFF              <2>  cmp di,-1
   184 00000077 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000079 893E2400            <2>  MOV [%1H*4],DI
   188 0000007D 8C062600            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000081 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000084 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000089 8CC0                <2>  mov ax,es
   181 0000008B 83F8FF              <2>  cmp ax,-1
   182 0000008E 740D                <2>  je skip_int%1
   183 00000090 83FFFF              <2>  cmp di,-1
   184 00000093 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000095 893E2800            <2>  MOV [%1H*4],DI
   188 00000099 8C062A00            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 0000009D E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 000000A0 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 000000A5 8CC0                <2>  mov ax,es
   181 000000A7 83F8FF              <2>  cmp ax,-1
   182 000000AA 740D                <2>  je skip_int%1
   183 000000AC 83FFFF              <2>  cmp di,-1
   184 000000AF 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 000000B1 893E2C00            <2>  MOV [%1H*4],DI
   188 000000B5 8C062E00            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 000000B9 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 000000BC 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 000000C1 8CC0                <2>  mov ax,es
   181 000000C3 83F8FF              <2>  cmp ax,-1
   182 000000C6 740D                <2>  je skip_int%1
   183 000000C8 83FFFF              <2>  cmp di,-1
   184 000000CB 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 000000CD 893E3000            <2>  MOV [%1H*4],DI
   188 000000D1 8C063200            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 000000D5 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 000000D8 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 000000DD 8CC0                <2>  mov ax,es
   181 000000DF 83F8FF              <2>  cmp ax,-1
   182 000000E2 740D                <2>  je skip_int%1
   183 000000E4 83FFFF              <2>  cmp di,-1
   184 000000E7 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 000000E9 893E3400            <2>  MOV [%1H*4],DI
   188 000000ED 8C063600            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 000000F1 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 000000F4 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 000000F9 8CC0                <2>  mov ax,es
   181 000000FB 83F8FF              <2>  cmp ax,-1
   182 000000FE 740D                <2>  je skip_int%1
   183 00000100 83FFFF              <2>  cmp di,-1
   184 00000103 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000105 893E3800            <2>  MOV [%1H*4],DI
   188 00000109 8C063A00            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 0000010D E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000110 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000115 8CC0                <2>  mov ax,es
   181 00000117 83F8FF              <2>  cmp ax,-1
   182 0000011A 740D                <2>  je skip_int%1
   183 0000011C 83FFFF              <2>  cmp di,-1
   184 0000011F 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000121 893EC001            <2>  MOV [%1H*4],DI
   188 00000125 8C06C201            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000129 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 0000012C 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000131 8CC0                <2>  mov ax,es
   181 00000133 83F8FF              <2>  cmp ax,-1
   182 00000136 740D                <2>  je skip_int%1
   183 00000138 83FFFF              <2>  cmp di,-1
   184 0000013B 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 0000013D 893EC801            <2>  MOV [%1H*4],DI
   188 00000141 8C06CA01            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000145 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000148 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 0000014D 8CC0                <2>  mov ax,es
   181 0000014F 83F8FF              <2>  cmp ax,-1
   182 00000152 740D                <2>  je skip_int%1
   183 00000154 83FFFF              <2>  cmp di,-1
   184 00000157 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000159 893ECC01            <2>  MOV [%1H*4],DI
   188 0000015D 8C06CE01            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000161 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000164 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000169 8CC0                <2>  mov ax,es
   181 0000016B 83F8FF              <2>  cmp ax,-1
   182 0000016E 740D                <2>  je skip_int%1
   183 00000170 83FFFF              <2>  cmp di,-1
   184 00000173 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000175 893ED001            <2>  MOV [%1H*4],DI
   188 00000179 8C06D201            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 0000017D E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 00000180 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 00000185 8CC0                <2>  mov ax,es
   181 00000187 83F8FF              <2>  cmp ax,-1
   182 0000018A 740D                <2>  je skip_int%1
   183 0000018C 83FFFF              <2>  cmp di,-1
   184 0000018F 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 00000191 893ED801            <2>  MOV [%1H*4],DI
   188 00000195 8C06DA01            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   174 00000199 E8(0000)            <2>  call dosbiocode_get_es_dosbiodata
   175                              <2>  assume es:DOSGROUP
   176 0000019C 26C43E[0000]        <2>  LES DI,[es:Int19OLD%1]
   177                              <2>  assume es:nothing
   178                              <2> 
   179                              <2> 
   180 000001A1 8CC0                <2>  mov ax,es
   181 000001A3 83F8FF              <2>  cmp ax,-1
   182 000001A6 740D                <2>  je skip_int%1
   183 000001A8 83FFFF              <2>  cmp di,-1
   184 000001AB 7408                <2>  je skip_int%1
   185                              <2> 
   186                              <2> 
   187 000001AD 893EDC01            <2>  MOV [%1H*4],DI
   188 000001B1 8C06DE01            <2>  MOV [%1H*4+2],ES
   189                              <2> skip_int%1:
   190                              <2>  %rotate 1
   195                                  
   196                                  
   197                                  DOINT19:
   198 000001B5 8CC8                    	mov ax, cs
   199 000001B7 83F8FE                  	cmp ax, DOSCODE_HMA_SEGMENT
   200 000001BA 720D                    	jb .done
   201                                  
   202                                  		; clear the VDISK header in HMA
   203 000001BC B8FFFF                  	mov ax, -1		; => HMA
   204 000001BF 8EC0                    	mov es, ax
   205                                   assume es:nothing
   206 000001C1 BF1000                  	mov di, 10h		; -> start of HMA
   207 000001C4 89F9                    	mov cx, di		; 10h words = 20h bytes
   208 000001C6 40                      	inc ax			; = 0
   209 000001C7 F3AB                    	rep stosw		; re-initialise
   210                                  .done:
   211 000001C9 CD19                    	INT	19H
   212                                  INT19	ENDP
   213                                  
   214                                  
   215                                  section BIOCODE
   216                                  
   217                                  	PUBLIC	DSK$INIT
   218                                  DSK$INIT PROC	NEAR
   219                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   220                                  		; ds => DOSBIODATA from ENTRY in msbio1.nas
   221                                  %ifnidni %[DOSBIODATA], %[DOSENTRY]
   222 00000000 E8(0000)                	call biocode_get_es_dosentry	; DRVMAX in DOSENTRY
   223                                   assume es:DOSENTRYGROUP
   224 00000003 26                      	es
   225                                  %endif
   226 00000004 8A26[0000]              	MOV	AH,BYTE PTR [DRVMAX]
   227 00000008 C53E[0000]              	lds di, [dskdrvs_indirect]
   228                                   assume ds:UPB
   229 0000000C E9(0000)                	JMP	SETPTRSAV
   230                                  DSK$INIT ENDP
   231                                  
   232                                  ;
   233                                  ; INT 2F HANDLER FOR EXTERNAL BLOCK DRIVERS TO COMMUNICATE WITH THE INTERNAL
   234                                  ; BLOCK DRIVER IN IBMDISK. THE MULTIPLEX NUMBER CHOSEN IS 8. THE HANDLER
   235                                  ; SETS UP THE POINTER TO THE REQUEST PACKET IN [PTRSAV] AND THEN JUMPS TO
   236                                  ; DSK$IN, THE ENTRY POINT FOR ALL DISK REQUESTS.
   237                                  ; ON EXIT FROM THIS DRIVER (AT EXIT), WE WILL RETURN TO THE EXTERNAL DRIVER
   238                                  ; THAT ISSUED THIS INT 2F, AND CAN THEN REMOVE THE FLAGS FROM THE STACK.
   239                                  ; THIS SCHEME ALLOWS US TO HAVE A SMALL EXTERNAL DEVICE DRIVER, AND MAKES
   240                                  ; THE MAINTAINANCE OF THE VARIOUS DRIVERS (DRIVER AND IBMBIO) MUCH EASIER,
   241                                  ; SINCE WE ONLY NEED TO MAKE CHANGES IN ONE PLACE (MOST OF THE TIME).
   242                                  ;
   243                                  ; 06/03/88 J.K. When AL=3, return DS:DI -> Start of BDS table.
   244                                  ;	   (EMS device driver hooks INT 13h to handle 16KB DMA overrun
   245                                  ;	    problem.  BDS table is going to be used to get head/sector
   246                                  ;	    informations without calling Generic IOCTL Get Device Parm call.)
   247                                  ;
   248                                  ; AL CONTAINS THE INT2F FUNCTION:
   249                                  ;   0 - CHECK FOR INSTALLED HANDLER - RESERVED
   250                                  ;   1 - INSTALL THE BDS INTO THE LINKED LIST
   251                                  ;   2 - DOS REQUEST
   252                                  ;   3 - Get BDS vector				;06/03/88 J.K.
   253                                  ;	Return BDS table starting pointer in DS:DI
   254                                  
   255                                  MYNUM	EQU	8
   256                                  
   257                                  relocated disk_i2F
   258                                   assume ds:nothing, es:nothing, ss:nothing
   259 0000000F 80FC08                  	CMP	AH,MYNUM
   260                                   extern relocatedmsdos_i2F
   261 00000012 7403E9(0000)            	jne relocatedmsdos_i2F		; CHAIN TO NEXT INT 2F HANDLER
   262 00000017 3CF8                    	CMP	AL,0F8H			; IRET ON RESERVED FUNCTIONS
   263 00000019 7308                    	jae .iret			; if >= 0F8h -->
   264 0000001B 3C01                    	cmp al, 1			; what subfunction ?
   265 0000001D 7705                    	ja @F				; if > 1 -->
   266 0000001F 741F                    	je INSTALL_BDS			; if == 1 -->
   267                                  					; if < 1
   268 00000021 B0FF                    	MOV	AL,0FFH			; installation check
   269                                  .iret:
   270 00000023 CF                      	IRET
   271                                  
   272                                  @@:
   273 00000024 3C03                    	cmp	al, 3			; Get BDS vector?
   274 00000026 7410                    	je	DO_Get_BDS_Vector	; yes -->
   275                                  					; 2 or 4..0F7h: call block device
   276                                  ; SET UP POINTER TO REQUEST PACKET
   277 00000028 1E                      	push ds
   278 00000029 E8(0000)                	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   279                                   assume ds:DOSENTRYGROUP
   280 0000002C 891E[0000]              	MOV	WORD PTR [PTRSAV], BX	; otherwise DOS block device function
   281 00000030 8C06[0200]              	MOV	WORD PTR [PTRSAV+2], ES
   282 00000034 1F                      	pop ds
   283                                   assume ds:nothing
   284 00000035 E9(0000)                	JMP	DSK$IN
   285                                  
   286                                  DO_Get_BDS_Vector:			;AN002; AL=3
   287 00000038 E8(0000)                	call biocode_get_ds_dosbiodata
   288                                   assume ds:DOSGROUP
   289                                  Start_BDS equ START_BDS	; NASM port label
   290 0000003B C53E[0000]              	lds	di, [Start_BDS]		;AN002;
   291                                   assume ds:UPB
   292 0000003F CF                      	IRET				;AN002;
   293                                  
   294                                  
   295                                  ; INSTALL_BDS INSTALLS A BDS A LOCATION DS:DI INTO THE CURRENT LINKED LIST OF
   296                                  ; BDS MAINTAINED BY THIS DEVICE DRIVER. IT PLACES THE BDS AT THE END OF THE
   297                                  ; LIST.
   298                                  
   299                                  INSTALL_BDS:
   300                                   assume ds:nothing, es:nothing, ss:nothing
   301                                  	MESSAGE FTESTINIT,<"INSTALL BDS",CR,LF>
   302                                  ; DS:DI POINT TO BDS TO BE INSTALLED
   303 00000040 E8(0000)                	call biocode_get_es_dosbiodata
   304                                   assume es:DOSGROUP
   305 00000043 26C436[0000]            	LES	SI,[es:START_BDS]	; START AT BEGINNING OF LIST
   306                                   assume es:UPB
   307 00000048 06                      	PUSH	ES			; SAVE POINTER TO CURRENT BDS
   308 00000049 56                      	PUSH	SI
   309                                  ; ES:SI NOW POINT TO BDS IN LINKED LIST
   310                                  LOOP_NEXT_BDS:
   311 0000004A 46                      	inc si				; GOT TO END OF LINKED LIST? (-1)
   312 0000004B 742C                    	JZ	INSTALL_RET		; yes --> (will overwrite si)
   313 0000004D 4E                      	dec si				; undo inc
   314                                  
   315                                  ; IF WE HAVE SEVERAL LOGICAL DRIVES USING THE SAME PHYSICAL DRIVE, WE MUST
   316                                  ; SET THE I_AM_MULT FLAG IN EACH OF THE APPROPRIATE BDSS.
   317 0000004E 8A4504                  	MOV	AL,BYTE PTR [DI + DRIVENUM]
   318 00000051 26384404                	CMP	BYTE PTR [ES:SI + DRIVENUM],AL
   319 00000055 7517                    	JNZ	.NEXT_BDS
   320                                  	MESSAGE FTESTINIT,<"LOGICAL DRIVES",CR,LF>
   321 00000057 B310                    	MOV	bl, FI_AM_MULT
   322 00000059 085D23                  	OR	[DI + FLAGS], bl	; SET FLAGS IN BOTH BDSS CONCERNED
   323 0000005C 26085C23                	OR	[ES:SI + FLAGS], bl
   324 00000060 806523DF                	AND	byte [DI + FLAGS], ~ FI_OWN_PHYSICAL
   325                                  					; RESET THAT FLAG FOR 'NEW' BDS
   326                                  ; WE MUST ALSO SET THE FCHANGELINE BIT CORRECTLY.
   327 00000064 268A5C23                	MOV	bl, [ES:SI + FLAGS]	; DETERMINE IF CHANGELINE AVAILABLE
   328 00000068 80E302                  	AND	BL,FCHANGELINE
   329 0000006B 085D23                  	OR	[DI + FLAGS], bl
   330                                  
   331                                  .NEXT_BDS:
   332                                  ; BEFORE MOVING TO NEXT BDS, PRESERVE POINTER TO CURRENT ONE. THIS IS NEEDED AT
   333                                  ; THE END WHEN THE NEW BDS IS LINKED INTO THE LIST.
   334 0000006E 5B                      	POP	BX			; DISCARD PREVIOUS POINTER TO BDS
   335 0000006F 5B                      	POP	BX
   336 00000070 06                      	PUSH	ES
   337 00000071 56                      	PUSH	SI
   338 00000072 26C434                  	les si, [es:si + LINK]
   339 00000075 8CC3                    	mov bx, es			; returned bx
   340 00000077 EBD1                    	JMP	SHORT LOOP_NEXT_BDS
   341                                  
   342                                  INSTALL_RET:
   343 00000079 5E                      	POP	SI			; RETRIEVE POINTER TO LAST BDS
   344 0000007A 07                      	POP	ES			; IN LINKED LIST.
   345                                   assume es:UPB
   346 0000007B 8CD8                    	MOV	AX,DS			; returned ax
   347 0000007D 26894402                	MOV	WORD PTR [ES:SI + LINK + 2],AX ; INSTALL BDS
   348 00000081 26893C                  	MOV	WORD PTR [ES:SI + LINK],DI
   349 00000084 830DFF                  	or	WORD PTR [DI + LINK],-1 ; SET NEXT POINTER TO NULL
   350 00000087 CF                      	iret
   351                                  
   352                                  
   353                                  usesection SYSINITTRAIL		; fix to not run in unrelocated DOSCODE
   354                                  
   355                                  ; lDOS: This used to install the msbio int 2Fh handler. No longer used.
   356                                  	PUBLIC	RE_INIT
   357                                  RE_INIT PROC	near
   358                                   assume ds:nothing, es:nothing, ss:nothing
   359                                  	MESSAGE FTESTINIT,<"REINIT",CR,LF>
   360 00000000 C3                      	retn
   361                                  
   362                                  RE_INIT ENDP
   363                                  
   364                                  
   365                                  usesection BIOCODE
   366                                  
   367                                  ;-------------------------------------------------
   368                                  ;
   369                                  ;  ASK TO SWAP THE DISK IN DRIVE A:
   370                                  ;
   371                                  		; INP:	ah = prior drive letter
   372                                  		;	ds:di -> UPB for target drive, already active
   373                                  		; CHG:	ax
   374                                  	PUBLIC	SWPDSK
   375                                  SWPDSK	PROC	NEAR
   376                                   assume ds:UPB, es:nothing, ss:nothing
   377 00000088 51                      	push cx
   378 00000089 52                      	push dx
   379 0000008A 8A4505                  	MOV	AL,BYTE PTR [DI + DRIVELET] ; GET THE DRIVE LETTER
   380                                  ;USING A DIFFERENT DRIVE IN A ONE DRIVE SYSTEM SO REQUEST THE USER CHANGE DISKS
   381 0000008D 92                      	xchg dx, ax			; dh = prior, dl = new
   382 0000008E 06                      	push es
   383 0000008F 1E                      	 push ds
   384 00000090 07                      	 pop es				; (super undocumented? es:di -> target UPB)
   385                                   assume es:UPB
   386 00000091 31C9                    	xor cx, cx
   387 00000093 B8004A                  	mov ax, 4A00h
   388 00000096 CD2F                    	int 2Fh				; MS-DOS v5+ drive change notification
   389 00000098 41                      	inc cx				; was FFFFh ?
   390 00000099 741A                    	jz .skip			; yes, someone handled it -->
   391 0000009B 92                      	xchg ax, dx			; get new drive back to al
   392 0000009C 0441                    	ADD	AL,"A"			; make into a letter
   393 0000009E 1E                      	PUSH	DS			; PRESERVE SEGMENT REGISTER
   394 0000009F E8(0000)                	call biocode_get_ds_dosbiodata
   395                                   assume ds:DOSGROUP
   396 000000A2 A2[0000]                	MOV	[DRVLET],AL
   397 000000A5 BE[0000]                	MOV	SI,OFFSET SNGMSG	; DS:SI -> MESSAGE
   398 000000A8 53                      	PUSH	BX
   399 000000A9 E80D00                  	CALL	WRMSG			;PRINT DISK CHANGE MESSAGE
   400 000000AC E8(0000)                	CALL	FLUSH
   401                                  ;SB33003***************************************************************
   402 000000AF 30E4                    	xor	AH, AH			; set command to read character;SB
   403 000000B1 CD16                    	int	16h			; call rom-bios		       ;SB
   404                                  ;SB33003***************************************************************
   405 000000B3 5B                      	POP	BX
   406 000000B4 1F                      	POP	DS			; RESTORE SEGMENT REGISTER
   407                                   assume ds:UPB
   408                                  .skip:
   409 000000B5 07                      	pop es
   410                                   assume es:nothing
   411 000000B6 5A                      	pop dx
   412 000000B7 59                      	pop cx
   413                                  WRMRET:
   414 000000B8 C3                      	RET
   415                                  SWPDSK	ENDP
   416                                  
   417                                  ;----------------------------------------------
   418                                  ;
   419                                  ;	WRITE OUT MESSAGE POINTED TO BY [SI]
   420                                  ;
   421                                  	PUBLIC	WRMSG
   422                                  WRMSG	PROC	NEAR
   423                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   424 000000B9 AC                      	LODSB				;GET THE NEXT CHARACTER OF THE MESSAGE
   425 000000BA 84C0                    	test	AL,AL			;SEE IF END OF MESSAGE
   426 000000BC 74FA                    	JZ	WRMRET
   427                                  ;	INT	CHROUT
   428 000000BE 9C                      	PUSHF
   429 000000BF 0E                      	PUSH	CS
   430 000000C0 E8(0000)                	CALL	OUTCHR
   431 000000C3 EBF4                    	JMP	SHORT WRMSG
   432                                  WRMSG	ENDP
   433                                  
   434                                  
   435                                  usesection DOSBIODATA
   436                                  	extern SNGMSG
   437                                  	extern DRVLET
   438                                  
   439                                  
   440                                  usesection BIOCODE
   441                                  
   442                                  ;
   443                                  ; END OF SUPPORT FOR MULTIPLE FLOPPIES WITH NO LOGICAL DRIVES
   444                                  ; THIS IS NOT 'SPECIAL' ANY MORE BECAUSE WE NOW HAVE THE CAPABILITY OF
   445                                  ; DEFINING LOGICAL DRIVES IN CONFIG.SYS. WE THEREFORE KEEP THE CODE FOR
   446                                  ; SWAPPING RESIDENT ALL THE TIME.
   447                                  ;
   448                                  
   449                                  ;J.K. 10/1/86 *******************************************************
   450                                  ;Variables for Dynamic Relocatable modules
   451                                  ;These should be stay resident.
   452                                  
   453                                  usesection DOSBIODATA
   454                                  
   455                                  	align 2, db 0
   456                                  
   457                                  	PATHSTART 001,CLK
   207                              <1>  %IF PATHGEN
   208                              <1>  PUBLIC %2%1S,%2%1E
   209                              <1>  %2%1S LABEL BYTE
   210                              <1>  %ENDIF
   458                                  ;
   459                                  ;   DATA STRUCTURES FOR REAL-TIME DATE AND TIME
   460                                  ;
   461                                  	public	BIN_DATE_TIME
   462                                  	public	MONTH_TABLE
   463                                  	public	DAYCNT2
   464                                  	public	FEB29
   465                                  BIN_DATE_TIME:
   466 00000000 00                      	DB	0		; CENTURY (19 OR 20) OR HOURS (0-23)
   467 00000001 00                      	DB	0		; YEAR IN CENTURY (0...99) OR MINUTES (0-59)
   468 00000002 00                      	DB	0		; MONTH IN YEAR (1...12) OR SECONDS (0-59)
   469 00000003 00                      	DB	0		; DAY IN MONTH (1...31)
   470                                  MONTH_TABLE:			;
   471 00000004 0000                    	DW	0		;MJB002 JANUARY
   472 00000006 1F00                    	DW	31		;MJB002 FEBRUARY
   473 00000008 3B00                    	DW	59		;MJB002
   474 0000000A 5A00                    	DW	90		;MJB002
   475 0000000C 7800                    	DW	120		;MJB002
   476 0000000E 9700                    	DW	151		;MJB002
   477 00000010 B500                    	DW	181		;MJB002
   478 00000012 D400                    	DW	212		;MJB002
   479 00000014 F300                    	DW	243		;MJB002
   480 00000016 1101                    	DW	273		;MJB002
   481 00000018 3001                    	DW	304		;MJB002
   482 0000001A 4E01                    	DW	334		;MJB002 DECEMBER
   483 0000001C 0000                    DAYCNT2 DW	0000		;MJB002 TEMP FOR COUNT OF DAYS SINCE 1-1-80
   484 0000001E 00                      FEB29	DB	0		;MJB002 FEBRUARY 29 IN A LEAP YEAR FLAG
   485                                  	PATHEND 001,CLK
   214                              <1>  %IF PATHGEN
   215                              <1>  %2%1E LABEL BYTE
   216                              <1>  %ENDIF
   486                                  
   487                                  ;********************************************************************
   488                                  ;
   489                                  
   490                                  usesection DOSENTRY
   491                                  
   492                                  	PUBLIC	ENDFLOPPY
   493                                  ENDFLOPPY LABEL BYTE
   494                                  
   495                                  	PATHSTART 004,BIO
   207                              <1>  %IF PATHGEN
   208                              <1>  PUBLIC %2%1S,%2%1E
   209                              <1>  %2%1S LABEL BYTE
   210                              <1>  %ENDIF
   496                                  
   497                                  
   498                                  usesection SYSINITTRAIL
   499                                  
   500                                  	global partition_table, partition_table.end
   501 00000001 00<rep 3h>              	align 4, db 0		; ! this needs WarpLink ecm release 3
   502                                  				; (r1 and r2 had new bugs, so we want r3 now)
   503                                  partition_table:
   504 00000004 00<rep 40h>             	times 64 db 0
   505                                  .end:
   506                                  
   507                                  	global load_mode, load_scan_flags, load_partition_cycle
   508                                  	global load_current_partition, load_unit, load_amount_units
   509                                  	global next_block_device_unit
   510                                  	align 2, db 0
   511                                  load_mode:
   512 00000044 0000                    	dw 0
   513                                  load_scan_flags:
   514 00000046 0000                    	dw 0
   515                                  load_partition_cycle:
   516 00000048 0000                    	dw 0
   517                                  load_current_partition:
   518 0000004A 00                      	db 0
   519                                  load_unit:
   520 0000004B 00                      	db 0
   521                                  load_amount_units:
   522 0000004C 00                      	db 0
   523                                  next_block_device_unit:
   524 0000004D 00                      	db 0
   525                                  
   526                                  
   527                                  	PUBLIC	HNUM
   528 0000004E 00                      HNUM	DB	0			;NUMBER OF HARDFILES
   529                                  	PUBLIC	HARDDRV
   530 0000004F 80                      HARDDRV DB	80H			;PHYSICAL DRIVE NUMBER OF FIRST HARDFILE
   531                                  
   532                                  ;**********************************************************************
   533                                  ;	"HDRIVE" IS A HARD DISK WITH 512 BYTE SECTORS
   534                                  ;*********************************************************************
   535                                  	EVENB
   536                                  
   537                                  BDSM_type_size equ BDSM_type_struc_size		; NASM port equate
   538                                  	public BDS_harddisk_template
   539                                  BDS_harddisk_template:
   540                                  istruc BDSM_type
   541                                  at mlink
   542 00000050 FFFF                    	dw -1
   543 00000052 FFFF                    	dw -1			; LINK TO NEXT STRUCTURE
   544                                  at mdriveNum
   545 00000054 80                      	db 80h			; INT 13 DRIVE NUMBER
   546                                  at mdriveLet
   547 00000055 03                      	db 3			; LOGICAL DRIVE LETTER
   548                                  at mBytePerSec
   549 00000056 0002                    	dw 512
   550                                  at mSecPerClus
   551 00000058 01                      	db 1			; SECTORS/ALLOCATION UNIT
   552                                  at mRESSEC
   553 00000059 0100                    	dw 1			; RESERVED SECTORS FOR DOS
   554                                  at mcFAT
   555 0000005B 02                      	db 2			; NO. OF ALLOCATION TABLES
   556                                  at mcDIR
   557 0000005C 1000                    	dw 16			; NUMBER OF DIRECTORY ENTRIES
   558                                  at mDRVLIM
   559 0000005E 0000                    	dw 0			; NUMBER OF SECTORS (AT 512 BYTES EACH)
   560                                  at mMediad
   561 00000060 F8                      	db 1111_1000b		; MEDIA DESCRIPTOR
   562                                  at mcSecFat
   563 00000061 0100                    	dw 1			; NUMBER OF FAT SECTORS
   564                                  at mSECLIM
   565 00000063 0000                    	dw 0			; SECTOR LIMIT
   566                                  at mHDLIM
   567 00000065 0000                    	dw 0			; HEAD LIMIT
   568                                  at mHIDSEC_L
   569 00000067 0000                    	dw 0			; HIDDEN SECTOR COUNT(low)
   570                                  at mHidsec_H
   571 00000069 0000                    	dw 0			; Hidden Sector (high)
   572                                  at mDrvlim_L
   573 0000006B 0000                    	dw 0			; Number of Sectors (low)
   574                                  at mDrvlim_H
   575 0000006D 0000                    	dw 0			; Number of Sectors (high)
   576                                  at mFatSiz
   577 0000006F 00                      	db 0			; TRUE => BIGFAT
   578                                  at mOPCNT
   579 00000070 0000                    	dw 0			; OPEN REF. COUNT
   580                                  at mFormFactor
   581 00000072 03                      	db 3			; FORM FACTOR
   582                                  at mFLAGS
   583 00000073 2000                    	dw 20h			; VARIOUS FLAGS
   584                                  at mcCyln
   585 00000075 2800                    	dw 40			; NUMBER OF CYLINDERS
   586                                  at mRecBPB
   587 00000077 00                      	db 0			; RECOMMENDED BPB FOR DRIVE
   588 00000078 00<rep 1Eh>             at mTrack
   589 00000096 FF                      	db -1			; LAST TRACK ACCESSED ON THIS DRIVE
   590                                  at IsMini
   591 00000097 0100                    	dw 1
   592                                  at Hidden_Trks
   593 00000099 0000                    	dw 0
   594                                  at mVOLID
   595 0000009B 4E4F204E414D452020-     	db "NO NAME    "
   595 000000A4 2020               
   596 000000A6 00                      	db 0			; VOLUME ID FOR THIS DISK
   597                                  at mVol_Serial
   598 000000A7 00000000                	dd 0			; Current volume serial number from Boot record
   599                                  at mFileSys_Id
   600 000000AB 4641543132202020        	db "FAT12   "
   601 000000B3 00                      	db 0			; Current file system id from Boot record
   602                                  iend
   603                                  
   604                                  usesection BIOCODE
   605                                  
   606                                  ;
   607                                  ; END OF SECTION FOR TWO HARD DISKS
   608                                  
   609                                  	PATHEND 004,BIO
   214                              <1>  %IF PATHGEN
   215                              <1>  %2%1E LABEL BYTE
   216                              <1>  %ENDIF
   610                                  
   611                                  ;	PAGE
   612                                  ;=== Push trace listing source: ms96tpi.nas
   613                                  	%include "ms96tpi.nas" ; NASM included file
     1                              <1> %warning out: MS96TPI.INC...
     1          ******************  <1>  warning: out: MS96TPI.INC... [-w+user]
     2                              <1> ;==============================================================================
     3                              <1> ;REVISION HISTORY:
     4                              <1> ;AN000 - New for DOS Version 4.00 - J.K.
     5                              <1> ;AC000 - Changed for DOS Version 4.00 - J.K.
     6                              <1> ;AN00x - PTM number for DOS Version 4.00 - J.K.
     7                              <1> ;==============================================================================
     8                              <1> ;AN001 - p2781 Changeline error behavior incompatibile with DOS 3.3 1/06/88 J.K.
     9                              <1> ;==============================================================================
    10                              <1> ;
    11                              <1> ;		DISK OPEN/CLOSE ROUTINES ARR 2.41
    12                              <1> ;
    13                              <1> 
    14                              <1> section BIOCODE
    15                              <1> 
    16                              <1> 	extern ispatched
    17                              <1>  extern DSK$UNKNOWN
    18                              <1> 
    19                              <1> DSK$OPEN:				;ARR 2.41
    20                              <1>  assume ds:DOSGROUP, es:nothing, ss:nothing
    21                              <1> 	PUBLIC	DSK$OPEN
    22 000000C5 E8(0000)            <1> 	call ispatched
    23 000000C8 720B                <1> 	jc @F
    24                              <1> 	MESSAGE FTESTDISK,<"DISK OPEN ">
    25                              <1> 	MNUM	FTESTDISK,AX
    26                              <1> 	MESSAGE FTESTDISK,<CR,LF>
    27                              <1> ; AL IS LOGICAL DRIVE
    28 000000CA E8(0000)            <1> 	CALL	SETDRIVE		;GET BDS FOR DRIVE
    29                              <1>  assume ds:UPB
    30 000000CD 7303E9(0000)        <1> 	jc DSK$UNKNOWN
    31 000000D2 FF4520              <1> 	INC	WORD PTR [DI + OPCNT]
    32                              <1> @@:
    33 000000D5 E9(0000)            <1> 	JMP	EXIT			;ARR 2.41
    34                              <1> 
    35                              <1> DSK$CLOSE:				;ARR 2.41
    36                              <1>  assume ds:DOSGROUP, es:nothing, ss:nothing
    37                              <1> 	PUBLIC	DSK$CLOSE
    38 000000D8 E8(0000)            <1> 	call ispatched
    39 000000DB 7211                <1> 	jc @F
    40                              <1> 	MESSAGE FTESTDISK,<"DISK CLOSE ">
    41                              <1> 	MNUM	FTESTDISK,AX
    42                              <1> 	MESSAGE FTESTDISK,<CR,LF>
    43                              <1> ; AL IS LOGICAL DRIVE
    44 000000DD E8(0000)            <1> 	CALL	SETDRIVE		;GET BDS FOR DRIVE
    45                              <1>  assume ds:UPB
    46 000000E0 7303E9(0000)        <1> 	jc DSK$UNKNOWN
    47 000000E5 837D2000            <1> 	CMP	WORD PTR [DI + OPCNT],0
    48 000000E9 7403                <1> 	JZ	EXITJX			; WATCH OUT FOR WRAP  ARR 2.41
    49 000000EB FF4D20              <1> 	DEC	WORD PTR [DI + OPCNT]
    50                              <1> EXITJX:
    51                              <1> @@:
    52 000000EE E9(0000)            <1> 	JMP	EXIT
    53                              <1> 
    54                              <1> ; INPUT : DS:DI POINTS TO CURRENT BDS FOR DRIVE.
    55                              <1> ; RETURN : ZERO SET IF NO OPEN FILES
    56                              <1> ;	   ZERO RESET IF OPEN FILES
    57                              <1> CHKOPCNT:
    58                              <1>  assume ds:UPB, es:nothing, ss:nothing
    59                              <1> 	MESSAGE FTEST96,<"CHECK OPEN COUNT ">
    60                              <1> 	MNUM	FTEST96,AX
    61                              <1> 	MESSAGE FTEST96,<CR,LF>
    62 000000F1 837D2000            <1> 	CMP	WORD PTR [DI + OPCNT],0
    63 000000F5 C3                  <1> 	RET
    64                              <1> 
    65                              <1> ;
    66                              <1> ; AT MEDIA CHECK TIME, WE NEED TO REALLY GET DOWN AND CHECK WHAT THE CHANGE IS.
    67                              <1> ; THIS IS GUARANTEED TO BE EXPENSIVE.
    68                              <1> ;
    69                              <1> 	PUBLIC MEDIACHECK
    70                              <1> MEDIACHECK:
    71                              <1>  assume ds:UPB, es:nothing, ss:nothing
    72 000000F6 E8(0000)            <1> 	CALL	CHECKSINGLE		; MAKE SURE CORRECT DISK IS IN PLACE
    73 000000F9 31F6                <1> 	XOR	SI,SI
    74 000000FB E88B01              <1> 	CALL	HASCHANGE
    75 000000FE 7432                <1> 	JZ	MEDIARET
    76 00000100 E87B01              <1> 	CALL	CHECKROMCHANGE
    77 00000103 752E                <1> 	JNZ	MEDIADOVOLID
    78 00000105 50                  <1> 	PUSH	AX
    79 00000106 52                  <1> 	PUSH	DX
    80                              <1> ;SB33001****************************************************************
    81                              <1> drivenum equ DRIVENUM	; NASM port equate
    82 00000107 8A5504              <1> 	mov	DL, [DI + drivenum] ;SB   ; set logical drive number	  ;3.30*
    83 0000010A B416                <1> 	mov	AH, 16h 	 ;SB	   ; get changeline status	  ;3.30*
    84 0000010C CD13                <1> 	int	13h		 ;SB	   ; call rom diskette routine	  ;3.30*
    85                              <1> ;SB33001****************************************************************
    86 0000010E 5A                  <1> 	POP	DX
    87 0000010F 58                  <1> 	POP	AX
    88 00000110 7221                <1> 	JC	MEDIADOVOLID
    89 00000112 BE0100              <1> 	MOV	SI,1			; SIGNAL NO CHANGE
    90                              <1> ; THERE ARE SOME DRIVES WITH CHANGELINE THAT "LOSE" THE CHANGELINE INDICATION
    91                              <1> ; IF A DIFFERENT DRIVE IS ACCESSED AFTER THE CURRENT ONE. IN ORDER TO AVOID
    92                              <1> ; MISSING A MEDIA CHANGE, WE RETURN AN "I DON'T KNOW" TO DOS IF THE CHANGELINE
    93                              <1> ; IS NOT ACTIVE AND WE ARE ACCESSING A DIFFERENT DRIVE FROM THE LAST ONE.
    94                              <1> ; IF WE ARE ACCESSING THE SAME DRIVE, THEN WE CAN SAFELY RELY ON THE CHANGELINE
    95                              <1> ; STATUS.
    96                              <1> 	PUBLIC LOSECHNG
    97                              <1> LOSECHNG:
    98 00000115 1E                  <1> 	push ds
    99 00000116 E8(0000)            <1> 	call biocode_get_ds_dosbiodata
   100                              <1>  assume ds:DOSGROUP
   101 00000119 8A1E[0000]          <1> 	MOV	BL,[TIM_DRV]		; GET LAST DRIVE ACCESSED
   102 0000011D 1F                  <1> 	pop ds
   103                              <1>  assume ds:UPB
   104 0000011E 385D04              <1> 	CMP	BYTE PTR [DI + DRIVENUM],BL
   105 00000121 740F                <1> 	JZ	MEDIARET
   106                              <1> ; DO THE 2 SECOND TWIDDLE. IF TIME >= 2 SECONDS, DO A VOLID CHECK.
   107                              <1> ; OTHERWISE RETURN "I DON'T KNOW" (STRICTLY SPEAKING, WE SHOULD RETURN A
   108                              <1> ; "NOT CHANGED" HERE SINCE THE 2 SECOND TEST SAID NO CHANGE.) - RS.
   109 00000123 505152              <1> 	SAVEREG <AX,CX,DX>
   110 00000126 E8(0000)            <1> 	CALL	CHECK_TIME_OF_ACCESS
   111 00000129 5A5958              <1> 	RESTOREREG <DX,CX,AX>
   112 0000012C 09F6                <1> 	OR	SI,SI
   113 0000012E 7403                <1> 	JZ	MEDIADOVOLID		; CHECK_TIME SAYS ">= 2 SECS PASSED"
   114 00000130 31F6                <1> 	XOR	SI,SI			; RETURN "I DON'T KNOW"
   115                              <1> 	PUBLIC MEDIARET
   116                              <1> MEDIARET:
   117 00000132 C3                  <1> 	RET
   118                              <1> ;
   119                              <1> ; SOMEHOW THE MEDIA WAS CHANGED.  LOOK AT VID TO SEE. WE DO NOT LOOK AT FAT
   120                              <1> ; BECAUSE THIS MAY BE DIFFERENT SINCE WE ONLY SET MEDBYT WHEN DOING A READ
   121                              <1> ; OR WRITE.
   122                              <1> ;
   123                              <1> MEDIADOVOLID:
   124 00000133 E8(0000)            <1> 	CALL	GETBP		       ; BUILD A NEW BPB IN CURRENT BDS
   125 00000136 72FA                <1> 	JC	MEDIARET
   126 00000138 E83400              <1> 	CALL	CHECK_VID
   127 0000013B 73F5                <1> 	JNC	MEDIARET
   128 0000013D E8(0000)            <1> 	CALL	MAPERROR		; FIX UP AL FOR RETURN TO DOS
   129 00000140 C3                  <1> 	RET
   130                              <1> ;
   131                              <1> ; SIMPLE, QUICK CHECK OF LATCHED CHANGE.  IF NO INDICATION, THEN RETURN
   132                              <1> ; OTHERWISE DO EXPENSIVE CHECK.  IF THE EXPENSIVE TEST FAILS, POP OFF THE
   133                              <1> ; RETURN AND SET AL = 15 (FOR INVALID MEDIA CHANGE) WHICH WILL BE RETURNED TO
   134                              <1> ; DOS.
   135                              <1> ;J.K. 9/16/86 For DOS 3.3, this will work only for the drive that has
   136                              <1> ;J.K. 9/16/86 changeline.
   137                              <1> 	PUBLIC CHECKLATCHIO
   138                              <1> CHECKLATCHIO:
   139                              <1>  assume ds:UPB, es:nothing, ss:nothing
   140                              <1> ; IF RETURNING FAKE BPB THEN ASSUME THE DISK HAS NOT CHANGED
   141                              <1> ;	TEST	WORD PTR [DS:DI].FLAGS, RETURN_FAKE_BPB
   142                              <1> ;	JNZ	CHECKRET
   143                              <1> ;J.K. 9/16/86
   144                              <1> ;	call	HasChange		;change line supported?
   145                              <1> ;	jz	CheckRet		;No. Just return
   146 00000141 E8ADFF              <1> 	CALL	CHKOPCNT
   147 00000144 7501                <1> 	JNZ	CHECKROM
   148                              <1> CHECKRET:
   149 00000146 C3                  <1> 	RET
   150                              <1> ;
   151                              <1> ; CHECK FOR PAST ROM INDICATIONS.  IF NO ROM CHANGE INDICATED, THEN RETURN OK.
   152                              <1> ;
   153                              <1> 	PUBLIC CHECKROM
   154                              <1> CHECKROM:
   155 00000147 E83401              <1> 	CALL	CHECKROMCHANGE
   156 0000014A 74FA                <1> 	JZ	CHECKRET		; NO CHANGE
   157                              <1> ;
   158                              <1> ; WE NOW SEE THAT A CHANGE LINE HAS BEEN SEEN IN THE PAST.  LET'S DO THE
   159                              <1> ; EXPENSIVE VERIFICATION.
   160                              <1> ;
   161                              <1> 	MESSAGE FTEST96,<"CHECKROMCHANGE SAYS YES...",CR,LF>
   162 0000014C E8(0000)            <1> 	CALL	GETBP			; BUILD BPB IN CURRENT BDS
   163 0000014F 720F                <1> 	JC	RET_NO_ERROR_MAP	; GETBP HAS ALREADY CALLED MAPERROR
   164 00000151 E81B00              <1> 	CALL	CHECK_VID
   165 00000154 7207                <1> 	JC	CHECKLATCHRET		; DISK ERROR TRYING TO READ IN.
   166 00000156 09F6                <1> 	OR	SI,SI			; IS CHANGED FOR SURE?
   167 00000158 79EC                <1> 	JNS	CHECKRET
   168 0000015A E88D00              <1> 	CALL	RETURNVID
   169                              <1> CHECKLATCHRET:
   170 0000015D E8(0000)            <1> 	CALL	MAPERROR		; FIX UP AL FOR RETURN TO DOS
   171                              <1> RET_NO_ERROR_MAP:
   172 00000160 F9                  <1> 	STC
   173 00000161 5E                  <1> 	POP	SI			; POP OFF RETURN ADDRESS
   174 00000162 C3                  <1> 	RET
   175                              <1> 
   176                              <1> ;
   177                              <1> ; CHECK THE FAT AND THE VID.  RETURN IN DI -1 OR 0.  RETURN WITH CARRY SET
   178                              <1> ; ONLY IF THERE WAS A DISK ERROR.  RETURN THAT ERROR CODE IN AX.
   179                              <1> ;
   180                              <1> 	PUBLIC CHECKFATVID
   181                              <1> CHECKFATVID:
   182                              <1>  assume es:nothing
   183 00000163 06                  <1> 	push es
   184 00000164 E8(0000)            <1> 	call biocode_get_es_dosentry	; DISKSECTOR in DOSENTRY
   185                              <1>  assume es:DOSENTRYGROUP
   186                              <1> 
   187                              <1> 	MESSAGE FTEST96,<"CHECK FAT",CR,LF>
   188 00000167 E80F02              <1> 	CALL	FAT_CHECK
   189 0000016A 09F6                <1> 	OR	SI,SI
   190 0000016C 782E                <1> 	JS	CHANGED_DRV
   191                              <1> ;
   192                              <1> ; THE FAT WAS THE SAME.  HOW ABOUT THE VOLUME ID?
   193                              <1> ;
   194                              <1> 
   195 0000016E A8                  <1> 	db __TEST_IMM8			; skip push
   196                              <1> CHECK_VID:
   197                              <1>  assume nocheck, es:nothing
   198 0000016F 06                  <1> 	push es
   199 00000170 E8(0000)            <1> 	call biocode_get_es_dosentry	; DISKSECTOR in DOSENTRY
   200                              <1>  assume es:DOSENTRYGROUP
   201                              <1> 
   202                              <1> ;J.K. Now with the extended BOOT record, the logic should be enhanced.
   203                              <1> ;If it is the extended BOOT record, then we check the volume serial
   204                              <1> ;number instead of volume id. If it is different, then set SI to -1.
   205                              <1> ;If it is same, then SI= 1 (No change).
   206                              <1> ;If it is not the extended BOOT record, then just follows the old
   207                              <1> ;logic. DOS 4.00 will check if the # of FAT in the boot record BPB
   208                              <1> ;is not 0.  If it is 0 then it must be Non_FAT based system and
   209                              <1> ;should have already covered by extended boot structure checking.
   210                              <1> ;So, we will return "I don't know" by setting SI to 0.
   211                              <1> ;This routine assume the newest valid boot record is in [es:DISKSECTOR].
   212                              <1> ;(This will be gauranteed by a successful GETBP call right before this
   213                              <1> ;routine.)
   214                              <1> 	MESSAGE FTEST96,<"CHECK VID",CR,LF>
   215                              <1> ;SB34MS96TPI001*********************************************************
   216                              <1> ;SB	check the EXT_Boot_Sig variable for the Extended boot signature
   217                              <1> ;SB	if it is set then go to do the extended ID check otherwise continue
   218                              <1> ;SB	with code below
   219                              <1> ;SB		2 LOCS
   220                              <1> 
   221                              <1> Ext_Boot_Signature equ EXT_BOOT_SIGNATURE	; NASM port equate
   222 00000173 26803E[0000]29      <1> 	cmp	byte [es:Ext_Boot_Sig],Ext_Boot_Signature
   223                              <1> Do_Ext_Check_Id equ Do_Ext_Check_ID	; NASM port label
   224 00000179 742C                <1> 	jz	Do_Ext_Check_Id
   225                              <1> ;SB34MS96TPI001*********************************************************
   226 0000017B E80B01              <1> 	call	HasChange			;AN000;
   227                              <1> CheckRet equ CHECKRET	; NASM port label
   228 0000017E 74C6                <1> 	jz	CheckRet			;AN000;
   229                              <1> 
   230 00000180 31F6                <1> 	xor	si,si				;AN000; assume I don't know.
   231                              <1> SECPERCLUSINSECTOR equ SecPerClusInSector	; NASM port label
   232 00000182 26803E[0300]00      <1> 	cmp	byte ptr [es:SECPERCLUSINSECTOR + 3],0 ;AN000; Don't read vol id from
   233 00000188 7410                <1> 	je	CHECKFATRET			;AN000; the directory if not FAT system
   234                              <1> READ_VOLUME_ID equ read_volume_id	; NASM port label
   235 0000018A E81D01              <1> 	CALL	READ_VOLUME_ID
   236 0000018D 720B                <1> 	JC	CHECKFATRET
   237                              <1> CHECK_VOLUME_ID equ check_volume_id	; NASM port label
   238 0000018F E8D001              <1> 	CALL	CHECK_VOLUME_ID
   239 00000192 09F6                <1> 	OR	SI,SI
   240 00000194 7506                <1> 	JNZ	CHANGED_DRV
   241                              <1> 	MESSAGE FTEST96,<"VID NOT CHANGED",CR,LF>
   242                              <1> 
   243                              <1> VID_NO_Changed:
   244 00000196 E8EB00              <1> 	CALL	RESETCHANGED
   245 00000199 F8                  <1> 	clc					;AN000;
   246                              <1> CHECKFATRET:
   247 0000019A 07                  <1> 	pop es
   248                              <1>  assume es:nothing
   249 0000019B C3                  <1> 	RET
   250                              <1> CHANGED_DRV:
   251 0000019C E8(0000)            <1> 	call biocode_get_es_dosbiodata
   252                              <1>  assume es:DOSGROUP
   253 0000019F 26C606[0000]FF      <1> 	MOV	byte [es:TIM_DRV],-1 		; ENSURE THAT WE ASK ROM FOR MEDIA
   254 000001A5 07                  <1> 	pop es
   255                              <1>  assume es:nothing
   256 000001A6 C3                  <1> 	RET					; CHECK NEXT TIME ROUND
   257                              <1>    ;
   258                              <1>    ; extended ID check
   259                              <1>    ;
   260                              <1> Do_Ext_Check_ID:				;AN000;
   261                              <1>  assume es:DOSENTRYGROUP
   262 000001A7 50                  <1> 	push	ax				;AN000;
   263                              <1> ;SB34MS96TPI002**************************************************************
   264                              <1> ;SB	The code to check extended ID is basically a check to see if the
   265                              <1> ;Sb	volume serial number is still the same.  The volume serial number
   266                              <1> ;SB	previously read is in [es:Boot_Serial_H] and [es:Boot_Serial_L]
   267                              <1> ;SB	high and low words respectively.  DS:DI points to the BDS of the
   268                              <1> ;SB	drive under consideration.  The BDS has fields containing the 
   269                              <1> ;SB	high and low words of the volume serial number of the media in the
   270                              <1> ;SB	drive.  Compare these fields to the fields mentioned above.  If these
   271                              <1> ;SB	fields do not match the media has changed and so we should jump
   272                              <1> ;SB	to the code starting at Ext_Changed else return "I don't know" status
   273                              <1> ;SB	in the register used for the changeline status and continue executing
   274                              <1> ;SB     the code given below.  For temporary storage use the register which
   275                              <1> ;SB	has been saved and restored around this block.
   276                              <1> ;SB		7 LOCS
   277                              <1> ;SB	BDS fields in inc\msbds.inc
   278                              <1> 
   279 000001A8 26A1[0000]          <1> 	mov	ax,[es:Boot_Serial_L]
   280 000001AC 3B4557              <1> 	cmp	ax,word ptr [di+VOL_SERIAL]
   281 000001AF 750E                <1> 	jnz	Ext_Changed
   282 000001B1 26A1[0000]          <1> 	mov	ax,[es:Boot_Serial_H]
   283 000001B5 3B4559              <1> 	cmp	ax,word ptr [di+VOL_SERIAL+2]
   284 000001B8 7505                <1> 	jnz	Ext_Changed
   285 000001BA 31F6                <1> 	xor	si,si			; don't know
   286                              <1> 
   287                              <1> ;SB34MS96TPI002**************************************************************
   288 000001BC 58                  <1> 	pop	ax				;AN000;
   289                              <1> ;	 jmp	 CheckFatRet			 ;AN000;
   290 000001BD EBD7                <1> 	jmp	VID_NO_Changed			;AN001;Reset the flag
   291                              <1> Ext_Changed:					;AN000; Serial number is different!
   292 000001BF 58                  <1> 	pop	ax				;AN000;
   293 000001C0 BEFFFF              <1> 	mov	si, -1				;AN000; disk changed!
   294 000001C3 F8                  <1> 	clc					;AN000; clear carry. Only SI is meaningful here.
   295                              <1> Changed_Drv equ CHANGED_DRV	; NASM port label
   296 000001C4 EBD6                <1> 	jmp	Changed_Drv			;AN000;
   297                              <1> 
   298                              <1> ;
   299                              <1> ; AT I/O TIME, WE DETECTED THE ERROR.  NOW WE NEED TO DETERMINE WHETHER THE
   300                              <1> ; MEDIA WAS TRULY CHANGED OR NOT.  WE RETURN NORMALLY IF MEDIA CHANGE UNKNOWN.
   301                              <1> ; AND WE POP OFF THE CALL AND JMP TO HARDERR IF WE SEE AN ERROR.
   302                              <1> ;
   303                              <1> 	PUBLIC CHECKIO
   304                              <1> CHECKIO:
   305 000001C6 80FC06              <1> 	CMP	AH,06
   306 000001C9 7514                <1> 	JNZ	@F
   307 000001CB E823FF              <1> 	CALL	CHKOPCNT
   308 000001CE 740F                <1> 	JZ	@F			; NO OPEN FILES
   309                              <1> ; IF RETURNING FAKE BPB THEN IGNORE DISK CHANGES
   310                              <1> ;	TEST	WORD PTR [DS:DI].FLAGS, RETURN_FAKE_BPB
   311                              <1> ;	JNZ	IGNORECHANGE
   312 000001D0 E8(0000)            <1> 	CALL	GETBP			; BUILD UP A NEW BPB IN CURRENT BDS
   313 000001D3 7212                <1> 	JC	NO_ERROR_MAP		; GETBP HAS ALREADY CALLED MAPERROR
   314 000001D5 E88BFF              <1> 	CALL	CHECKFATVID
   315 000001D8 7209                <1> 	JC	CHECKIORET		; DISK ERROR TRYING TO READ IN.
   316 000001DA 09F6                <1> 	OR	SI,SI			; IS CHANGED FOR SURE?
   317 000001DC 7802                <1> 	JS	CHECKIOERR		; YES CHANGED
   318                              <1> IGNORECHANGE:
   319 000001DE 45                  <1> 	INC	BP			; ALLOW A RETRY
   320                              <1> @@:
   321 000001DF C3                  <1> 	RET
   322                              <1> CHECKIOERR:
   323 000001E0 E80700              <1> 	CALL	RETURNVID
   324                              <1> CHECKIORET:
   325                              <1> ;	POP	SI			; POP OFF RETURN
   326 000001E3 F9                  <1> 	STC				; MAKE SURE CARRY GETS PASSED THROUGH
   327 000001E4 E9(0000)            <1> 	JMP	HARDERR
   328                              <1> 
   329                              <1> NO_ERROR_MAP:
   330 000001E7 E9(0000)            <1> 	JMP	HARDERR2
   331                              <1> ;
   332                              <1> ; RETURN VID SETS UP THE VID FOR A RETURN TO DOS.
   333                              <1> ;
   334                              <1> 	PUBLIC RETURNVID
   335                              <1> RETURNVID:
   336                              <1>  assume ds:UPB, es:nothing, ss:nothing
   337                              <1> 	MESSAGE FTEST96,<"RETURN VID",CR,LF>
   338 000001EA 1E                  <1> 	PUSH	DS			; SAVE POINTER TO CURRENT BDS
   339 000001EB 57                  <1> 	PUSH	DI
   340 000001EC 51                  <1> 	PUSH	CX
   341                              <1> INIT_VID_LOOP equ init_vid_loop	; NASM port label
   342 000001ED E89E01              <1> 	CALL	INIT_VID_LOOP		; SETS ES:DI -> VID
   343 000001F0 E8(0000)            <1> 	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   344                              <1>  assume ds:DOSENTRYGROUP
   345 000001F3 C51E[0000]          <1> 	lds bx, [PTRSAV]
   346                              <1>  assume ds:nothing
   347 000001F7 897F16              <1> 	MOV	[BX + EXTRA],DI
   348 000001FA 8C4718              <1> 	MOV	[BX + EXTRA+2],ES
   349 000001FD 59                  <1> 	POP	CX
   350 000001FE 5F                  <1> 	POP	DI			; RESTORE CURRENT BDS
   351 000001FF 1F                  <1> 	POP	DS
   352                              <1>  assume ds:UPB
   353 00000200 B406                <1> 	MOV	AH,6			; INVALID MEDIA CHANGE
   354 00000202 F9                  <1> 	STC
   355 00000203 C3                  <1> 	RET
   356                              <1> 
   357                              <1> ;
   358                              <1> ; MUNGE THE TIME OF LAST SUCCESSFUL ACCESS FOR TWEEKED DRIVES
   359                              <1> ;
   360                              <1> ; DON'T NEED ANY MORE
   361                              <1> ; TWEEKCHECK:
   362                              <1> ;	  PUSH	  AX
   363                              <1> ;	  MOV	  AX,WORD PTR [DS:DI].FLAGS
   364                              <1> ;	  TEST	  AL,FCHANGED_BY_FORMAT
   365                              <1> ;	  JZ	  TWEEKDONE
   366                              <1> ;	  MOV	  [CS:TIM_DRV],-1
   367                              <1> ; TWEEKDONE:
   368                              <1> ;	  POP	  AX
   369                              <1> ;	  RET
   370                              <1> 
   371                              <1> ;
   372                              <1> ; DRIVE IS THE LOGICAL DRIVE TO USE
   373                              <1> ;
   374                              <1> ; FORMAT_MEDIA_CHECK:			  ;ARR 2.42
   375                              <1> ;	  PUSH	  AX
   376                              <1> ;	  MOV	  AX,WORD PTR [DS:DI].FLAGS
   377                              <1> ;	  TEST	  AL,FCHANGED_BY_FORMAT
   378                              <1> ;	  JZ	  RETF1 		  ; MEDIA NOT CHANGED VIA FORMAT
   379                              <1> ;	  AND	  AL,NOT FCHANGED_BY_FORMAT
   380                              <1> ;	  MOV	  WORD PTR [DI].FLAGS,AX  ; RESET CHANGED_BY_FORMAT BIT
   381                              <1> ;	  MOV	  SI,-1 		  ; MEDIA CHANGED VIA FORMAT
   382                              <1> ; RETF1:
   383                              <1> ;	  POP	  AX
   384                              <1> ;	  RET
   385                              <1> 
   386                              <1> ;
   387                              <1> ; MOVES THE POINTER TO THE VOLID FOR THE DRIVE INTO THE ORIGINAL REQUEST PACKET
   388                              <1> ; ON ENTRY, DS:BX POINTS TO THE ORIGINAL PACKET.
   389                              <1> ; NO ATTEMPT IS MADE TO PRESERVE REGISTERS.
   390                              <1> ;
   391                              <1> MEDIA_SET_VID:				; ARR 2.42
   392                              <1>  assume ds:UPB, es:nothing, ss:nothing
   393                              <1> 	PUBLIC MEDIA_SET_VID
   394                              <1> 
   395 00000204 E88701              <1> 	CALL	INIT_VID_LOOP		; SETS ES:DI -> VID
   396 00000207 E8(0000)            <1> 	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   397                              <1>  assume ds:DOSENTRYGROUP
   398 0000020A C51E[0000]          <1> 	lds bx, [PTRSAV]		; GET POINTER TO PACKET
   399                              <1>  assume ds:nothing
   400 0000020E 897F0F              <1> 	MOV	WORD PTR [BX + TRANS+1],DI
   401 00000211 8C4711              <1> 	MOV	WORD PTR [BX + TRANS+3],ES
   402 00000214 C3                  <1> 	RET
   403                              <1> 
   404                              <1> 
   405                              <1> ;
   406                              <1> ;   HIDENSITY - EXAMINE A DRIVE/MEDIA DESCRIPTOR TO SET THE MEDIA TYPE.  IF
   407                              <1> ;   THE MEDIA DESCRIPTOR IS NOT F9 (NOT 96TPI OR 3 1/2), WE RETURN AND LET THE
   408                              <1> ;   CALLER DO THE REST.  OTHERWISE, WE POP OFF THE RETURN AND JUMP TO THE TAIL
   409                              <1> ;   OF GETBP. FOR 3.5" MEDIA, WE JUST RETURN.
   410                              <1> ;
   411                              <1> ;   INPUTS:	DS:DI POINT TO CORRECT BDS FOR THIS DRIVE
   412                              <1> ;		AH HAS MEDIA BYTE
   413                              <1> ;
   414                              <1> ;   OUTPUTS:	CARRY CLEAR
   415                              <1> ;		    NO REGISTERS MODIFIED
   416                              <1> ;		CARRY SET
   417                              <1> ;		    AL = SECTORS/FAT
   418                              <1> ;		    BH = NUMBER OF ROOT DIRECTORY ENTRIES
   419                              <1> ;		    BL = SECTORS PER TRACK
   420                              <1> ;		    CX = NUMBER OF SECTORS
   421                              <1> ;		    DH = SECTORS PER ALLOCATION UNIT
   422                              <1> ;		    DL = NUMBER OF HEADS
   423                              <1> ;
   424                              <1> HIDENSITY:
   425                              <1>  assume ds:UPB, es:nothing, ss:nothing
   426                              <1> 	PUBLIC HIDENSITY
   427                              <1> ;
   428                              <1> ; CHECK FOR CORRECT DRIVE
   429                              <1> ;
   430 00000215 F745230200          <1> 	TEST	WORD PTR [DI + FLAGS],FCHANGELINE	; IS IT SPECIAL?
   431 0000021A 741C                <1> 	JZ	DOFLOPPY		; NO, DO NORMAL FLOPPY TEST
   432                              <1> ;
   433                              <1> ; WE HAVE A MEDIA BYTE THAT IS PRETTY COMPLEX.	EXAMINE DRIVE INFORMATION
   434                              <1> ; TABLE TO SEE WHAT KIND IT IS.
   435                              <1> ;
   436 0000021C 807D2202            <1> 	CMP	BYTE PTR [DI + FORMFACTOR],FFSMALL;  IS IT SINGLE-MEDIA?
   437 00000220 7416                <1> 	JZ	DOFLOPPY		; YES, USE FATID...
   438                              <1> ;
   439                              <1> ; 96 TPI DRIVE
   440                              <1> ;
   441 00000222 80FCF9              <1> 	CMP	AH,0F9H
   442 00000225 7511                <1> 	JNZ	DOFLOPPY
   443 00000227 B007                <1> 	MOV	AL,7			; SEVEN SECTORS / FAT
   444 00000229 BB0FE0              <1> 	MOV	BX,224*256+0FH		; 224 ROOT DIR ENTRIES & 0F SECTOR MAX
   445 0000022C B96009              <1> 	MOV	CX,80*15*2		; 80 TRACKS, 15 SECTORS/TRACK, 2 SIDES
   446 0000022F BA0201              <1> 	MOV	DX,01*256+2		; SECTORS/ALLOCATION UNIT & HEAD MAX
   447                              <1> POPR:
   448 00000232 83C402              <1> 	ADD	SP,2			; POP OFF RETURN ADDRESS
   449 00000235 E9(0000)            <1> 	JMP	HAS1			; RETURN TO TAIL OF GETBP
   450                              <1> 
   451                              <1> DOFLOPPY:
   452 00000238 C3                  <1> 	RET
   453                              <1> 
   454                              <1> 	PATHSTART 001,TPI96
   207                              <2>  %IF PATHGEN
   208                              <2>  PUBLIC %2%1S,%2%1E
   209                              <2>  %2%1S LABEL BYTE
   210                              <2>  %ENDIF
   455                              <1> 
   456                              <1> ;
   457                              <1> ; CERTAIN BOGUS PROGRAMS AVOID DOS ALTOGETHER AND USE INT 13 DIRECTLY.	THESE
   458                              <1> ; PROGRAMS EVEN RETRY OPERATIONS AND, THUS, WILL IGNORE THE DISK CHANGE LOGIC.
   459                              <1> ;
   460                              <1> ; WE HOOK INT 13 AND NOTE ALL ERRORS.
   461                              <1> ;
   462                              <1> 	ASSUME	DS:NOTHING,ES:NOTHING,SS:NOTHING
   463                              <1> section  DOSENTRY	; in DOSENTRY
   464                              <1> 
   465                              <1>  extern transfer_real13
   466                              <1> 
   467                              <1> 	PATHEND 001,TPI96
   214                              <2>  %IF PATHGEN
   215                              <2>  %2%1E LABEL BYTE
   216                              <2>  %ENDIF
   468                              <1> 
   469                              <1> section BIOCODE
   470                              <1> 
   471                              <1> relocated ms96tpi_i13
   472                              <1> 	PUBLIC INT13
   473                              <1> INT13	PROC	FAR
   474                              <1>  assume ds:nothing, es:nothing, ss:nothing
   475                              <1> 	MESSAGE FTEST13,<"*">
   476 00000239 9C                  <1> 	pushf
   477 0000023A 9A[0000][ssss]      <1> 	call DOSENTRY:transfer_real13
   478 0000023F 7307                <1> 	jnc transfer_Leave13
   479                              <1> 
   480                              <1> ERR13:
   481                              <1> 	MESSAGE FTEST13,<"INT 13 ERROR ">
   482                              <1> 	MNUM	FTEST13,AX
   483                              <1> 	MESSAGE FTEST13,<CR,LF>
   484 00000241 9C                  <1> 	PUSHF				; SAVE STATE
   485 00000242 80FC06              <1> 	CMP	AH,06H			; DID I SEE A CHANGE EVENT?
   486 00000245 7404                <1> 	JZ	.GOTERR			; YES
   487 00000247 9D                  <1> @@:	POPF				; NO, SOME OTHER ERROR, IGNORE IT
   488                              <1> transfer_Leave13: equ $
   489 00000248 E9(0000)            <1> 	jmp Leave13
   490                              <1> 
   491                              <1> .GOTERR:
   492 0000024B 84D2                <1> 	test	DL,DL			; IS THIS FOR THE HARD DISK?
   493 0000024D 78F8                <1> 	JS	@B			; YES, IGNORE
   494 0000024F 53                  <1> 	push bx
   495 00000250 BB4000              <1> 	MOV	bx, FCHANGED
   496 00000253 E80300              <1> 	CALL	SET_CHANGED_DL
   497 00000256 5B                  <1> 	pop bx
   498 00000257 EBEE                <1> 	JMP	@B
   499                              <1> INT13	ENDP
   500                              <1> 
   501                              <1> 	extern Leave13
   502                              <1> 
   503                              <1> ;
   504                              <1> ; SET_CHANGED_DL - SETS FLAG BITS ACCORDING TO BITS SET IN [FLAGBITS].
   505                              <1> ;		   ESSENTIALLY USED TO INDICATE CHANGELINE, OR FORMAT.
   506                              <1> ;
   507                              <1> ;   INPUTS:	DL CONTAINS PHYSICAL DRIVE NUMBER
   508                              <1> ;		bx CONTAINS BITS TO SET IN THE FLAG FIELD IN THE BDSS
   509                              <1> ;   OUTPUTS:	NONE
   510                              <1> ;   REGISTERS MODIFIED: FLAGS, bx
   511                              <1> ;
   512                              <1> SET_CHANGED_DL:
   513                              <1>  assume ds:nothing, es:nothing, ss:nothing
   514                              <1> 	PUBLIC SET_CHANGED_DL
   515                              <1> 
   516                              <1> 	MESSAGE FTEST96,<"SET CHANGED",CR,LF>
   517 00000259 52                  <1> 	PUSH	DX
   518 0000025A 87DA                <1> 	xchg bx, dx			; bl = int 13h unit, dx = mask
   519                              <1> ALL_SET:
   520 0000025C 30FF                <1> 	XOR	BH,BH
   521                              <1> ;
   522                              <1> ; IN THE VIRTUAL DRIVE SYSTEM WE *MUST* FLAG THE OTHER DRIVES AS BEING CHANGED
   523                              <1> ;
   524                              <1> ; ASSUME FIRST BDS IS IN THIS SEGMENT
   525 0000025E 50                  <1> 	PUSH	AX
   526 0000025F 1E                  <1> 	PUSH	DS		    ; SAVE CURRENT BDS
   527 00000260 57                  <1> 	PUSH	DI
   528 00000261 E8(0000)            <1> 	call biocode_get_ds_dosbiodata
   529                              <1>  assume ds:DOSGROUP
   530 00000264 C53E[0000]          <1> 	lds di, [START_BDS]
   531                              <1>  assume ds:UPB
   532                              <1> SCAN_BDS:
   533 00000268 83FFFF              <1> 	CMP	DI,-1
   534 0000026B 740C                <1> 	je SKIPSET
   535 0000026D 385D04              <1> 	CMP	BYTE PTR [DI + DRIVENUM],BL
   536 00000270 7503                <1> 	JNZ	GET_NEXT_BDS
   537                              <1> ;
   538                              <1> ; SOMEONE MAY COMPLAIN, BUT THIS *ALWAYS* MUST BE DONE WHEN A DISK CHANGE IS
   539                              <1> ; NOTED.  THERE ARE *NO* OTHER COMPROMISING CIRCUMSTANCES.
   540                              <1> ;
   541                              <1> SETCHANGED:
   542 00000272 095523              <1> 	OR	WORD PTR [DI + FLAGS],DX	; SIGNAL CHANGE ON OTHER DRIVE
   543                              <1> GET_NEXT_BDS:
   544 00000275 C53D                <1> 	lds di, [di + LINK]
   545 00000277 EBEF                <1> 	JMP	SHORT SCAN_BDS
   546                              <1> SKIPSET:
   547 00000279 5F                  <1> 	POP	DI		    ; RESTORE CURRENT BDS
   548 0000027A 1F                  <1> 	POP	DS
   549                              <1>  assume ds:nothing
   550 0000027B 58                  <1> 	POP	AX
   551 0000027C 5A                  <1> 	POP	DX
   552 0000027D C3                  <1> 	RET
   553                              <1> 
   554                              <1> ;
   555                              <1> ; CHECKROMCHANGE - SEE IF EXTERNAL PROGRAM HAS DIDDLED ROM CHANGE LINE.
   556                              <1> ;
   557                              <1> ;   INPUTS:	DS:DI POINTS TO CURRENT BDS.
   558                              <1> ;   OUTPUTS:	ZERO SET - NO CHANGE
   559                              <1> ;		ZERO RESET - CHANGE
   560                              <1> ;   REGISTERS MODIFIED: NONE
   561                              <1> 
   562                              <1> CHECKROMCHANGE:
   563                              <1>  assume ds:UPB, es:nothing, ss:nothing
   564                              <1> 	MESSAGE FTEST13,<"CHECKROM ">
   565                              <1> 	MNUM	FTEST13
   566                              <1> 	MESSAGE FTEST13,<CR,LF>
   567 0000027E F745234000          <1> 	TEST	WORD PTR [DI + FLAGS],FCHANGED
   568 00000283 C3                  <1> 	RET
   569                              <1> 
   570                              <1> ;
   571                              <1> ; RESETCHANGED - RESTORE VALUE OF CHANGE LINE
   572                              <1> ;
   573                              <1> ;   INPUTS:	DS:DI POINTS TO CURRENT BDS
   574                              <1> ;   OUTPUTS:	NONE
   575                              <1> ;   REGISTERS MODIFIED: NONE
   576                              <1> 
   577                              <1> 	public	ResetChanged
   578                              <1> RESETCHANGED:
   579                              <1>  assume ds:UPB, es:nothing, ss:nothing
   580                              <1> 	MESSAGE FTEST13,<"RESETCHANGED ">
   581                              <1> 	MNUM	FTEST13
   582                              <1> 	MESSAGE FTEST13,<CR,LF>
   583 00000284 836523BF            <1> 	AND	WORD PTR [DI + FLAGS],~ FCHANGED
   584 00000288 C3                  <1> 	RET
   585                              <1> 
   586                              <1> ;
   587                              <1> ; HASCHANGE - SEE IF DRIVE CAN SUPPLY CHANGE LINE
   588                              <1> ;
   589                              <1> ;   INPUTS:	DS:DI POINTS TO CURRENT BDS
   590                              <1> ;   OUTPUTS:	ZERO SET - NO CHANGE LINE AVAILABLE
   591                              <1> ;		ZERO RESET - CHANGE LINE AVAILABLE
   592                              <1> ;   REGISTERS MODIFIED: NONE
   593                              <1> 
   594                              <1> 	PUBLIC	HASCHANGE
   595                              <1> HASCHANGE:
   596                              <1>  assume ds:UPB, es:nothing, ss:nothing
   597                              <1> 	MESSAGE FTEST13,<"HASCHANGE ">
   598                              <1> 	MNUM	FTEST13
   599                              <1> 	MESSAGE FTEST13,<CR,LF>
   600 00000289 F745230200          <1> 	TEST	WORD PTR [DI + FLAGS],FCHANGELINE
   601 0000028E C3                  <1> 	RET
   602                              <1> 
   603                              <1> ;=== Push trace listing source: msvolid.nas
   604                              <1> 	%include "msvolid.nas" ; NASM included file
     1                              <2> ;-------------------------------------------------------------------------
     2                              <2> ;
     3                              <2> ;  File: msvolid.asm
     4                              <2> ;	This file contains the volume_id subroutines and data structures.
     5                              <2> ;
     6                              <2> ;	Routines in this file are:
     7                              <2> ;	   Set_Volume_ID       -	main routine, calls other routines.
     8                              <2> ;	   read_volume_id      -	read the volume ID and tells if it has
     9                              <2> ;					   been changed.
    10                              <2> ;	   Transfer_volume_id  -	copy the volume ID from TMP to special
    11                              <2> ;					   drive.
    12                              <2> ;	   Check_Volume_ID     -	compare volume ID in TMP area with one
    13                              <2> ;					   expected for drive.
    14                              <2> ;	   Fat_Check	       -	see of the fatID has changed in the
    15                              <2> ;					   specified drive.
    16                              <2> ;	   Init_Vid_loop       -	set up for VID scan or move
    17                              <2> ;
    18                              <2> ;
    19                              <2> ;-------------------------------------------------------------------------
    20                              <2> 
    21                              <2> usesection DOSBIODATA
    22                              <2> 
    23                              <2> ;
    24                              <2> ; length of the volume id
    25                              <2> ;
    26                              <2> 
    27                              <2> vid_size    equ 12
    28                              <2> 
    29                              <2> 	    PATHSTART 001,VOLID 					  ;3.30
   207                              <3>  %IF PATHGEN
   208                              <3>  PUBLIC %2%1S,%2%1E
   209                              <3>  %2%1S LABEL BYTE
   210                              <3>  %ENDIF
    30                              <2> 
    31                              <2> ;
    32                              <2> ; null volume id
    33                              <2> ;
    34                              <2> 
    35 0000001F 4E4F204E414D452020- <2> nul_vid db  "NO NAME    ",0
    35 00000028 202000              <2>
    36                              <2> 
    37                              <2> ;
    38                              <2> ; data scratch area used to hold volume ids
    39                              <2> ;
    40                              <2> 
    41 0000002B 4E4F204E414D452020- <2> tmp_vid db  "NO NAME    ",0
    41 00000034 202000              <2>
    42                              <2> 
    43                              <2> 	    PATHEND 001,VOLID						  ;3.30
   214                              <3>  %IF PATHGEN
   215                              <3>  %2%1E LABEL BYTE
   216                              <3>  %ENDIF
    44                              <2> 
    45                              <2> ;
    46                              <2> ; Set_Volume_ID
    47                              <2> ;   If drive has changeline support, read in and set the volume_ID
    48                              <2> ; and the last FAT_ID byte.  If no change line support then do nothing.
    49                              <2> ;
    50                              <2> ;   On entry:
    51                              <2> ;	DS:DI points to the BDS for this disk.
    52                              <2> ;	AH contains media byte
    53                              <2> ;
    54                              <2> ;   On Exit:
    55                              <2> ;	Carry clear:
    56                              <2> ;	   Successful call
    57                              <2> ;	Carry set
    58                              <2> ;	   Error and AX has error code
    59                              <2> ;
    60                              <2> 
    61                              <2> section BIOCODE
    62                              <2> 
    63                              <2> Set_Volume_ID:
    64                              <2>  assume ds:UPB, es:nothing, ss:nothing
    65                              <2> SET_VOLUME_ID equ Set_Volume_ID	; NASM port label
    66                              <2> 	PUBLIC SET_VOLUME_ID						  ;3.30
    67 0000028F 52                  <2> 	push	dx			; save registers
    68 00000290 50                  <2> 	push	ax
    69                              <2> HasChange equ HASCHANGE	; NASM port label
    70 00000291 E8F5FF              <2> 	CALL	HasChange		; does drive have changeline support?
    71 00000294 740D                <2> 	jz	setvret 		; no, get out
    72 00000296 57                  <2> 	push	di
    73                              <2> read_volume_ID equ read_volume_id	; NASM port label
    74 00000297 E81000              <2> 	call	read_volume_ID		; read the volume ID
    75 0000029A 5F                  <2> 	pop	di
    76 0000029B 720A                <2> 	jc	SetErr			; if error go to error routine
    77 0000029D E8B100              <2> 	call	transfer_volume_ID	; copy the volume id to special drive
    78                              <2> ResetChanged equ RESETCHANGED	; NASM port label
    79 000002A0 E8E1FF              <2> 	call	ResetChanged		; restore value of change line
    80                              <2> 
    81                              <2> setvret:				; SET Volume RETurn
    82 000002A3 F8                  <2> 	clc				; no error, clear carry flag
    83 000002A4 58                  <2> 	pop	ax			; restore registers
    84 000002A5 5A                  <2> 	pop	dx
    85 000002A6 C3                  <2> 	ret
    86                              <2> SetErr:
    87 000002A7 5A                  <2> 	pop	dx			; pop stack but don't overwrite AX
    88 000002A8 5A                  <2> 	pop	dx			; restore DX
    89 000002A9 C3                  <2> 	ret
    90                              <2> 
    91                              <2> 
    92                              <2> usesection DOSBIODATA
    93                              <2> 
    94 00000037 ????                <2> root_sec	DW	?	;Root sector #
    95                              <2> 
    96                              <2> 
    97                              <2> section BIOCODE
    98                              <2> 
    99                              <2> ;
   100                              <2> ; read_volume_id read the volume ID and tells if it has been changed.
   101                              <2> ;
   102                              <2> ;   On entry:
   103                              <2> ;	DS:DI points to current BDS for drive.
   104                              <2> ;   On Exit:
   105                              <2> ;	Carry Clear
   106                              <2> ;	    SI = 1  No change
   107                              <2> ;	    SI = 0  ?
   108                              <2> ;	    SI = -1 Change
   109                              <2> ;
   110                              <2> ;	Carry Set:
   111                              <2> ;	    Error and AX has error code.
   112                              <2> ;
   113                              <2> 
   114                              <2> read_volume_id:
   115                              <2>  assume ds:UPB, es:nothing, ss:nothing
   116 000002AA 06                  <2> 	push	ES			; preserve registers
   117 000002AB 52                  <2> 	push	DX
   118 000002AC 51                  <2> 	push	CX
   119 000002AD 53                  <2> 	push	BX
   120 000002AE 50                  <2> 	push	AX
   121 000002AF 1E                  <2> 	push	DS			; Preserve Current BDS
   122 000002B0 57                  <2> 	push	DI
   123 000002B1 E8(0000)            <2> 	call biocode_get_es_dosbiodata
   124                              <2>  assume es:DOSGROUP
   125 000002B4 06                  <2> 	push es
   126 000002B5 1F                  <2> 	pop ds
   127                              <2>  assume ds:DOSGROUP
   128 000002B6 BF[2B00]            <2> 	mov	di,offset tmp_vid	; access with es
   129 000002B9 BE[1F00]            <2> 	mov	si,offset nul_vid	; access with ds
   130 000002BC B90C00              <2> 	mov	cx,vid_size
   131 000002BF F3A4                <2> 	rep	movsb			; initialize tmp_vid to null vi_id
   132                              <2> 
   133 000002C1 5F                  <2> 	pop	DI			; Restore Current BDS
   134 000002C2 1F                  <2> 	pop	DS
   135                              <2>  assume ds:UPB
   136                              <2> cFAT equ CFAT	; NASM port equate
   137 000002C3 8A450B              <2> 	mov	al,byte ptr [di + cFAT]    ; # of fats
   138                              <2> csecfat equ CSECFAT	; NASM port equate
   139 000002C6 8B4D11              <2> 	mov	cx,word ptr [di + csecfat] ; sectors / fat
   140 000002C9 F6E1                <2> 	mul	cl			    ; size taken by fats
   141                              <2> ressec equ RESSEC	; NASM port equate
   142 000002CB 034509              <2> 	add	ax,word ptr [di + ressec]  ; add on reserved sectors
   143                              <2> 					; AX is now sector # (0 based)
   144 000002CE 26A3[3700]          <2> 	mov	[es:root_sec],ax	; set initial value
   145                              <2> cDir equ CDIR	; NASM port equate
   146 000002D2 8B450C              <2> 	mov	ax,[di + cDir]		; # root dir entries
   147 000002D5 B104                <2> 	mov	cl,4			; 16 entries/sector
   148 000002D7 D3E8                <2> 	shr	ax,cl			; divide by 16
   149 000002D9 89C1                <2> 	mov	cx,ax			; cx is # of sectors to scan
   150                              <2> next_sec:
   151 000002DB 51                  <2> 	push	cx			; save outer loop counter
   152 000002DC 26A1[3700]          <2> 	mov	ax,[es:root_sec]	; get sector #
   153                              <2> seclim equ SECLIM	; NASM port equate
   154 000002E0 8B4D13              <2> 	mov	cx,word ptr [di + seclim]    ; sectors / track
   155 000002E3 31D2                <2> 	xor	DX,DX
   156 000002E5 F7F1                <2> 	div	cx
   157                              <2> 			; set up registers for call to read_sector
   158 000002E7 42                  <2> 	inc	DX		; dx= sectors into track, ax= track count from 0
   159 000002E8 88D1                <2> 	mov	cl,dl		; sector to read
   160 000002EA 31D2                <2> 	xor	DX,DX
   161                              <2> hdlim equ HDLIM	; NASM port equate
   162 000002EC F77515              <2> 	div	word ptr [di + hdlim] ; # heads on this disc
   163 000002EF 88D6                <2> 	mov	dh,dl		; Head number
   164 000002F1 88C5                <2> 	mov	ch,al		; Track #
   165                              <2> read_sector equ READ_SECTOR	; NASM port label
   166 000002F3 E8(0000)            <2> 	call	read_sector	; get first sector of the root directory,
   167                              <2>  assume es:DOSENTRYGROUP	; ES:BX -> BOOT
   168                              <2> 		; read_sector resets es => DOSENTRY
   169 000002F6 7255                <2> 	jc	ReadVIDErr	; error on read
   170 000002F8 B91000              <2> 	mov	cx,16		; # of dir entries in a block of root
   171 000002FB B008                <2> 	mov	al,08h		; volume label bit
   172                              <2> fvid_loop:
   173 000002FD 26803F00            <2> 	cmp	byte ptr [es:bx],0	; End of dir?
   174 00000301 7447                <2> 	jz	no_vid			; yes, no vol id
   175 00000303 26803FE5            <2> 	cmp	byte ptr [es:bx],0E5h	; empty entry?
   176 00000307 740D                <2> 	jz	ent_loop		; yes, skip
   177 00000309 26F6470BD7          <2> 	test byte [es:bx + 11], ~ 28h	; any bit other than label or archive ?
   178 0000030E 7506                <2> 	jnz ent_loop			; yes, may be an LFN, skip it -->
   179 00000310 2684470B            <2> 	test	[es:bx+11],al		; is volume label bit set in fcb?
   180 00000314 7514                <2> 	jnz	found_vid		; jmp yes
   181                              <2> ent_loop:
   182 00000316 83C320              <2> 	ADD	BX,32		;MJB003 ADD LENGTH OF DIRECTORY ENTRY	  ;3.30
   183 00000319 E2E2                <2> 	loop	fvid_loop
   184 0000031B 59                  <2> 	pop	cx			; outer loop
   185 0000031C E8(0000)            <2> 	call biocode_get_es_dosbiodata
   186                              <2>  assume es:DOSGROUP
   187 0000031F 26FF06[3700]        <2> 	inc	word [es:root_sec]		; next sector
   188 00000324 E2B5                <2> 	loop	next_sec		; continue
   189                              <2> vid_NotFound:
   190 00000326 31F6                <2> 	XOR	SI,SI
   191 00000328 EB19                <2> 	jmp	short fvid_ret
   192                              <2> 
   193                              <2> found_vid:
   194                              <2>  assume es:DOSENTRYGROUP
   195 0000032A 59                  <2> 	pop	cx			; clean stack of outer loop counter
   196 0000032B 89DE                <2> 	mov	si,bx			; point to volume_id
   197 0000032D 1E                  <2> 	push	ds			; preserve currnet BDS
   198 0000032E 57                  <2> 	push	di
   199 0000032F 06                  <2> 	push	es			; es:si points to volume id.
   200 00000330 1F                  <2> 	pop	ds			; source segment
   201                              <2>   assume ds:DOSENTRYGROUP
   202 00000331 E8(0000)            <2> 	call biocode_get_es_dosbiodata
   203                              <2>   assume es:DOSGROUP
   204 00000334 BF[2B00]            <2> 	mov	di,offset tmp_vid	; dest of volume_id ; access with es
   205 00000337 B90B00              <2> 	mov	cx,vid_size -1		; length of string minus NUL
   206 0000033A F3A4                <2> 	rep	movsb			; mov volume label to tmp_vid
   207 0000033C 30C0                <2> 	xor	al,al
   208 0000033E AA                  <2> 	stosb				; Null terminate
   209 0000033F 31F6                <2> 	XOR	SI,SI
   210 00000341 5F                  <2> 	pop	DI			; restore current BDS
   211 00000342 1F                  <2> 	pop	DS
   212                              <2>   assume ds:UPB
   213                              <2> fvid_ret:
   214 00000343 58                  <2> 	pop	ax
   215 00000344 F8                  <2> 	clc
   216                              <2> RVIDRet:
   217 00000345 5B                  <2> 	pop	BX			; restore register
   218 00000346 59                  <2> 	pop	CX
   219 00000347 5A                  <2> 	pop	DX
   220 00000348 07                  <2> 	pop	ES
   221                              <2>  assume es:nothing
   222 00000349 C3                  <2> 	ret
   223                              <2> no_vid:
   224 0000034A 59                  <2> 	pop	cx			; clean stack of outer loop counter
   225 0000034B EBD9                <2> 	jmp	vid_NotFound		; not found
   226                              <2> ReadVIDErr:
   227 0000034D 5E                  <2> 	pop	SI
   228 0000034E 5E                  <2> 	pop	SI
   229 0000034F EBF4                <2> 	jmp	RVIDRet
   230                              <2> 
   231                              <2> 
   232                              <2> 
   233                              <2> ;
   234                              <2> ;   Transfer_volume_id - copy the volume ID from TMP to special drive
   235                              <2> ;
   236                              <2> ;   Inputs:	DS:DI nas current BDS
   237                              <2> ;   Outputs:	BDS for drive has volume ID from TMP
   238                              <2> ;
   239                              <2> 
   240                              <2> transfer_volume_ID:
   241                              <2>  assume ds:UPB, es:nothing, ss:nothing
   242 00000351 1E                  <2> 	push	DS		; preserve current BDS
   243 00000352 57                  <2> 	push	DI
   244 00000353 06                  <2> 	push	ES
   245 00000354 56                  <2> 	push	SI
   246 00000355 51                  <2> 	push	CX
   247 00000356 E83500              <2> 	call	init_vid_loop
   248 00000359 FC                  <2> 	cld
   249 0000035A F3A4                <2> 	rep	MOVSB		; transfer
   250 0000035C 59                  <2> 	pop	CX
   251 0000035D 5E                  <2> 	pop	SI
   252 0000035E 07                  <2> 	pop	ES
   253                              <2>  assume es:nothing
   254 0000035F 5F                  <2> 	pop	DI		; restore current BDS
   255 00000360 1F                  <2> 	pop	DS
   256                              <2>  assume ds:UPB
   257 00000361 C3                  <2> 	ret
   258                              <2> 
   259                              <2> 
   260                              <2> ;
   261                              <2> ;   Check_Volume_ID - compare volume ID in TMP area with one expected for
   262                              <2> ;	drive
   263                              <2> ;
   264                              <2> ;   Inputs:	DS:DI has current BDS for drive
   265                              <2> ;   Outputs:	SI = 0 if compare succeeds
   266                              <2> ;		SI = -1 if compare fails.
   267                              <2> 
   268                              <2> check_volume_id:
   269                              <2>  assume ds:UPB, es:nothing, ss:nothing
   270 00000362 1E                  <2> 	push	DS			; preserve current BDS for drive
   271 00000363 57                  <2> 	push	DI
   272 00000364 06                  <2> 	push	ES
   273 00000365 51                  <2> 	push	CX
   274 00000366 E82500              <2> 	call	init_vid_loop
   275 00000369 FC                  <2> 	cld
   276 0000036A F3A6                <2> 	repz	cmpsb			; are the 2 volume_ids the same?
   277 0000036C BE0000              <2> 	mov	si,0			; assume unknown
   278 0000036F 7403                <2> 	jz	check_vid_ret		; carry clear if jump taken
   279 00000371 BEFFFF              <2> 	mov	si,-1			; failure
   280                              <2> check_vid_ret:
   281 00000374 59                  <2> 	pop	CX
   282 00000375 07                  <2> 	pop	ES
   283                              <2>  assume es:nothing
   284 00000376 5F                  <2> 	pop	DI			; restore current BDS
   285 00000377 1F                  <2> 	pop	DS
   286                              <2>  assume ds:UPB
   287 00000378 C3                  <2> 	ret
   288                              <2> 
   289                              <2> ;
   290                              <2> ;   Fat_Check - see of the fatID has changed in the specified drive.
   291                              <2> ;	      - uses the FAT ID obtained from the boot sector.
   292                              <2> ;
   293                              <2> ;   Inputs:	MedByt is expected FAT ID
   294                              <2> ;		DS:DI points to current BDS
   295                              <2> ;   Output:	Carry Clear
   296                              <2> ;		    SI = -1 if fat ID different,
   297                              <2> ;		    SI = 0 otherwise
   298                              <2> ;   No other registers changed.
   299                              <2> 
   300                              <2> FAT_CHECK:
   301                              <2>  assume ds:UPB, es:nothing, ss:nothing
   302 00000379 50                  <2> 	push	AX
   303 0000037A 31F6                <2> 	xor	SI, SI			 ; say FAT ID's are same.
   304 0000037C 06                  <2> 	push es
   305 0000037D E8(0000)            <2> 	call biocode_get_es_dosbiodata
   306                              <2>  assume es:DOSGROUP
   307                              <2> MedByt equ MEDBYT	; NASM port label
   308 00000380 26A0[0000]          <2> 	mov	AL, [es:MedByt]
   309                              <2> Mediad equ MEDIAD	; NASM port equate
   310 00000384 3A4510              <2> 	cmp	AL, byte ptr [DI + Mediad] ; compare it with the BDS medbyte
   311                              <2> OKRET1 equ OkRet1	; NASM port label
   312 00000387 7401                <2> 	jz	OKRET1			 ; carry clear
   313 00000389 4E                  <2> 	dec	SI
   314 0000038A F8                  <2> OkRet1: clc
   315 0000038B 07                  <2> 	pop es
   316                              <2>  assume es:nothing
   317 0000038C 58                  <2> 	pop	AX
   318 0000038D C3                  <2> 	ret
   319                              <2> 
   320                              <2> 
   321                              <2> ;
   322                              <2> ;   Init_Vid_loop - set up for VID scan or move
   323                              <2> ;
   324                              <2> ;   Inputs:	DS:DI pionts to BDS for the drive
   325                              <2> ;   Outputs:	DS:SI points to tmp_vid
   326                              <2> ;		ES:DI points to vid for drive
   327                              <2> ;		CX has size for VID compare
   328                              <2> ;
   329                              <2> 
   330                              <2> init_vid_loop:
   331                              <2>  assume ds:UPB, es:nothing, ss:nothing
   332 0000038E 50                  <2> 	push	ax
   333 0000038F 1E                  <2> 	push	ds
   334 00000390 07                  <2> 	pop	es
   335                              <2>  assume es:UPB
   336 00000391 E8(0000)            <2> 	call biocode_get_ds_dosbiodata
   337                              <2>  assume ds:DOSGROUP
   338 00000394 BE[2B00]            <2> 	mov	si,offset tmp_vid   ; source ; access with ds
   339                              <2> volid equ VOLID	; NASM port equate
   340 00000397 83C74B              <2> 	add	di,volid
   341 0000039A B90C00              <2> 	mov	cx,vid_size
   342 0000039D 58                  <2> 	pop	ax
   343 0000039E C3                  <2> 	ret
   605                              <1> ;=== Pop trace listing source
   606                              <1> 
   607                              <1> section DOSENTRY
   608                              <1> 
   609                              <1> 	PUBLIC END96TPI
   610                              <1> END96TPI LABEL BYTE
   614                                  ;=== Pop trace listing source
   615                                  
   616                                  ;*********************************************************************
   617                                  ;Memory allocation for BDSM table. - J.K. 2/21/86
   618                                  ;*********************************************************************
   619                                  
   620                                  %if 0
   621                                  mlink		DW	? ;-1			;Link to next structure
   622                                  		DW	?
   623                                  mdriveNum	DB	? ;80			;Int 13 Drive Number
   624                                  mdriveLet	DB	? ;3			;Logical Drive Number
   625                                  mBytePerSec	DW	? ;512
   626                                  mSecPerClus	DB	? ;1			;Sectors/allocation unit
   627                                  mRESSEC 	DW	? ;1			;Reserved sectors for DOS
   628                                  mcFAT		DB	? ;2			;No. of allocation tables
   629                                  mcDIR		DW	? ;16			;Number of directory entries
   630                                  mDRVLIM 	DW	? ;0			;Number of sectors (at 512 bytes each)
   631                                  mMediad 	DB	? ;11111000B		;Media descriptor
   632                                  mcSecFat	DW	? ;1			;Number of FAT sectors
   633                                  mSECLIM 	DW	? ;0			;Sector limit
   634                                  mHDLIM		DW	? ;0			;Head limit
   635                                  mHIDSEC_L	DW	? ;0			;Hidden sector count
   636                                  mHidsec_H	dw	? ;0			;J.K.87
   637                                  mDrvlim_L	dw	? ;0			;J.K.87
   638                                  mDrvlim_H	dw	? ;0			;J.K.87
   639                                  mFatSiz 	DB	? ;0			;TRUE => bigfat
   640                                  mOPCNT		DW	? ;0			;Open Ref. Count
   641                                  mFormFactor	DB	? ;3			;Form Factor
   642                                  mFLAGS		DW	? ;0020H		;Various Flags
   643                                  mcCyln		dw	? ;40			;max number of cylinders
   644                                  mRecBPB 	db	31 dup (?) ;(0)		;Recommended BPB for drive
   645                                  mTrack		db	? ;-1
   646                                  IsMini		dw	? ;1			;Overlapping TIM_LOH
   647                                  Hidden_Trks	dw	? ;0			;Overlapping TIM_HIH
   648                                  mVOLID		DB	11 dup (?) ;"NO NAME    "           ;Volume ID for this disk
   649                                  		DB	? ;0			;ASCIZII for "NO NAME    "
   650                                  mVol_Serial	dd	? ;0	   ;Current volume serial number from Boot record
   651                                  mFileSys_Id	db	8 dup (?) ;"FAT12   " ;Current file system id from Boot record
   652                                  		db	? ;0
   653                                  %endif
   654                                  
   655                                  ;
   656                                  ;;3.3 BUG FIX -SP ------------------------------
   657                                  ;;Migrated into 4.00 -MRW
   658                                  ;Paragraph buffer between the BDSMs and MSHARD
   659                                  ;
   660                                  ;The relocation code for MSHARD needs this. this cannot be used for 
   661                                  ;anything. nothing can come before this or after this.....IMPORTANT!!!!
   662                                  ;don't get too smart and using this buffer for anything!!!!!!
   663                                  
   664                                  	align 16, db 0CCh
   665                                  
   666                                  ;
   667                                  ;end of bug fix buffer
   668                                  ;;
   669                                  ;;3.3 BUG FIX -SP------------------------------
   670                                  	END
