     1                                  ;	PAGE	,132			;
     2                                  ;	TITLE	MSBIO1.asm - BIOS
     3                                  ;==============================================================================
     4                                  ;REVISION HISTORY:
     5                                  ;AN000 - New for DOS Version 4.00 - J.K.
     6                                  ;AC000 - Changed for DOS Version 4.00 - J.K.
     7                                  ;AN00x - PTM number for DOS Version 4.00 - J.K.
     8                                  ;==============================================================================
     9                                  %if 0 ; COMMENT *
    10                                  THE LINK STEP IS PERFORMED BY USING THE FOLLOWING "NEW.ARF" FILE:
    11                                  msbio1+
    12                                  msSTACK+
    13                                  MsCON+
    14                                  msAUX+
    15                                  msLPT+
    16                                  msCLOCK+
    17                                  msdISK+
    18                                  msBIO2+
    19                                  C:\BIO2\OLDOBJ\disk+
    20                                  C:\BIO2\OLDOBJ\msinit+
    21                                  C:\BIO2\OLDOBJ\sysinit1+
    22                                  C:\BIO2\OLDOBJ\sysinit2+
    23                                  C:\BIO2\OLDOBJ\sysimes,msbio,/M;
    24                                  
    25                                  THE FOLLOWING IS A BATCH FILE THAT CAN BE USED TO CREATE THE IBMBIO.COM
    26                                  WHERE "LOCSCR" IS A FILE THAT JUST HAS THE NUMBER, 70:
    27                                  
    28                                  link @NEW.ARF
    29                                  exe2bin ibmbio ibmbio.com <C:\BIO2\Locscr
    30                                  del ibmbio.exe
    31                                  (END OF COMMENT)*
    32                                  %endif ; COMMENT end
    33                                  
    34                                  ;***For testing purposes, set the TEST flag to 1. Otherwise reset it.
    35                                  
    36                                  itest equ 0
    37                                  
    38                                  PATHGEN equ	1
    39                                  
    40                                  ;.SALL
    41                                  	%warning out: ...MSBIO1.ASM
    41          ******************       warning: out: ...MSBIO1.ASM [-w+user]
    42                                  
    43                                  ; THIS IS A DOSMAC MACRO WHICH IS USED IN DEVSYM WHICH IS INCLUDED LATER
    44                                  %imacro BREAK 0-1+.nolist
    45                                  	;SUBTTL  subtitle
    46                                  	;PAGE
    47                                  %endmacro
    48                                  
    49                                  %imacro POPFF 0
    50                                  	jmp %%skip
    51                                  %%iret:	iret
    52                                  %%skip:	push cs
    53                                  	call %%iret
    54                                  %endmacro
    55                                  
    56                                  	%include "lmacros3.mac"
     1                              <1> [list -]
     1          ******************  <1>  warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi]
    14                              <2> [list -]
    14                              <1> [list -]
    57                                  	%include "sysinisw.mac"
     1                              <1> 
     2                              <1> SYSINITSTACK equ 256+128
    58                                  	%include "entryseg.nas"
     1                              <1> 
     2                              <1> %ifndef ENTRYSEGNAS
     3                              <1> %define ENTRYSEGNAS 1
     4                              <1> 
     5                              <1> %include "lmacros3.mac"
     1                              <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
    59                                  	%include "lstruct.mac"
     1                              <1> [list -]
    13                              <1> [list -]
    60                                  
    61                                   extern afterdosdatalabel
    62                                  addsection DOSDATAMCB, PUBLIC class=DOSDATAMCB align=16
    63                                  istruc MCB
    64 00000000 4D                      at mcbSignature,db 'M'
    65 00000001 0800                    at mcbOwner,	dw 8
    66                                   %if _RELOCATEDOSCODE
    67                                  at mcbSize,	dw afterdosdatalabel + DOSCODE_HMA_OFFSET - 16 wrt DOSSTART
    68                                   %else
    69 00000003 [0000]                  at mcbSize,	dw afterdosdatalabel wrt DOSSTART
    70                                   %endif
    71 00000005 00<rep 3h>53            at mcbName,	db "S"
    72 00000009 0003                    at smcbType,	db S_DOSDATA
    73 0000000B 00<rep 5h>              iend
    74                                  
    75                                  	%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
    76                                  
    77                                  addsection AFTERDOSDATA, align=16 class=AFTERDOSDATA
    78                                  
    79                                  	%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
    80                                  	%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
    81                                  
    82                                  addsection DOSCODETABLE		; actually added in dosseg.nas
    83                                  addsection DOSCODECODE		; actually added in dosseg.nas
    84                                  
    85                                  %ifn _RELOCATEDOSCODE
    86                                   [list -]
    93                                  %endif
    94                                  
    95                                  addsection SYSINITMCB, PUBLIC class=SYSINITMCB align=16
    96                                  istruc MCB
    97 00000000 5A                      at mcbSignature,db 'Z'
    98 00000001 0800                    at mcbOwner,	dw 8
    99 00000003 [8001]                  at mcbSize,	dw fromparas(paras(SYSINITSTACK)) + SYSSIZE wrt SYSINITSEG
   100 00000005 00<rep 3h>53            at mcbName,	db "S"
   101 00000009 001F                    at smcbType,	db S_INIT
   102 0000000B 00<rep 5h>              iend
   103                                  
   104                                  addsection SYSINITSEG, PUBLIC class=INIT
   105                                  addsection SYSINITTRAIL, PUBLIC class=INIT align=2
   106                                  addsection SYSINITLAST, PUBLIC class=INIT align=2
   107                                  
   108                                  group SYSINITGROUP SYSINITSEG SYSINITTRAIL SYSINITLAST
   109                                  
   110                                  addsection AFTERSYSINIT, PUBLIC class=AFTERSYSINIT align=16
   111                                  	global SYSSIZE
   112                                  SYSSIZE LABEL	BYTE
   113                                  
   114                                  addsection BIOCODE		; actually added before
   115                                  usesection DOSENTRY
   116                                  
   117                                  	%include "jumpmac.mac"
     1                              <1> 						  ;;Rev 3.30 Modification
     2                              <1> ;
     3                              <1> ; given a label <lbl> either 2 byte jump to another label <lbl>_J
     4                              <1> ; if it is near enough or 3 byte jump to <lbl>
     5                              <1> ;
     6                              <1> 
     7                              <1> ; NASM original macros
     8                              <1> 
     9                              <1> %if 0
    10                              <1> %imacro jump 1.nolist
    11                              <1> ;.xcref
    12                              <1> 
    13                              <1>     %ifndef %1_J                       ;; is this the first invocation
    14                              <1> %%a:      JMP %1
    15                              <1>     %ELSE
    16                              <1> 	%IF (%1_J >= $) || ($-%1_J > 126)
    17                              <1> %%a:      JMP %1                         ;; is the jump too far away?
    18                              <1> 	%ELSE
    19                              <1> %%a:      JMP %1_J                      ;; do the short one...
    20                              <1> 	%ENDIF
    21                              <1>     %ENDIF
    22                              <1>     %ixdefine %1_j %%a
    23                              <1> ;.cref
    24                              <1> %endmacro
    25                              <1> ;.xcref  jump
    26                              <1> %else
    27                              <1> %imacro jump 1.nolist
    28                              <1> ;REDEFINE THE ABOVE MACRO TO ALWAYS TRY A 3 BYTE NEAR JUMP		 
    29                              <1> 		jmp %1
    30                              <1> %endmacro					;;End of Modification
    31                              <1> %endif
    32                              <1> 
    33                              <1> 
   118                                  %unimacro PATHSTART 2
   119                                  %unimacro PATHEND 2
   120                                  
   121                                  %imacro PATHSTART 2
   122                                  	%IF	PATHGEN							  ;3.30
   123                                  	    PUBLIC  %2%1S,%2%1E						  ;3.30
   124                                  	    %2%1S LABEL	 BYTE						  ;3.30
   125                                  	%ENDIF								  ;3.30
   126                                  %endmacro								  ;3.30
   127                                  									  ;3.30
   128                                  %imacro PATHEND 2
   129                                  	%IF	PATHGEN							  ;3.30
   130                                  	    %2%1E LABEL	 BYTE						  ;3.30
   131                                  	%ENDIF								  ;3.30
   132                                  %endmacro								  ;3.30
   133                                  
   134                                  	%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
   135                                  	%include "devsym.mac"		;MJB001
     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
   136                                  	%include "msbds.mac"
     1                              <1> 
     2                              <1> %warning out: MSBDS.INC...
     2          ******************  <1>  warning: out: MSBDS.INC... [-w+user]
     3                              <1> ;	SCCSID = @(#)IBMBDS.ASM 1.9 85/09/16
     4                              <1> ;==============================================================================
     5                              <1> ;REVISION HISTORY:
     6                              <1> ;AN000 - New for DOS Version 4.00 - J.K.
     7                              <1> ;AC000 - Changed for DOS Version 4.00 - J.K.
     8                              <1> ;AN00x - PTM number for DOS Version 4.00 - J.K.
     9                              <1> ;==============================================================================
    10                              <1> ;AN001; D113 Disable I/O access to unformatted media		    9/03/87 J.K.
    11                              <1> ;==============================================================================
    12                              <1> 
    13                              <1> ; VALUES FOR VARIOUS FLAGS IN BDS.FLAGS.
    14                              <1> 
    15                              <1> FNON_REMOVABLE	    EQU     01H 	;FOR NON-REMOVABLE MEDIA
    16                              <1> FCHANGELINE	    EQU     02H 	;IF CHANGELINE SUPPORTED ON DRIVE
    17                              <1> RETURN_FAKE_BPB     EQU     04H 	; WHEN SET, DON'T DO A BUILD BPB
    18                              <1> 					; JUST RETURN THE FAKE ONE
    19                              <1> GOOD_TRACKLAYOUT    EQU     08H 	; THE TRACK LAYOUT HAS NO FUNNY SECTORS
    20                              <1> ; FCHANGED_BY_FORMAT  EQU	    08H
    21                              <1> FI_AM_MULT	    EQU     10H 	;IF MORE THAN ONE LOGICAL FOR THIS PHYSICAL
    22                              <1> FI_OWN_PHYSICAL     EQU     20H 	;SIGNIFY LOGICAL OWNER OF THIS PHYSICAL
    23                              <1> FCHANGED	    EQU     40H 	;INDICATES MEDIA CHANGED
    24                              <1> SET_DASD_TRUE	    EQU     80H 	; SET DASD BEFORE NEXT FORMAT
    25                              <1> FCHANGED_BY_FORMAT  EQU    100H 	;MEDIA CHANGED BY FORMAT
    26                              <1> UNFORMATTED_MEDIA   EQU    200H 	;AN001; Fixed disk only
    27                              <1> F_LBA		equ	400h		; LBA supported
    28                              <1> 
    29                              <1> LBAPACKETSTRUC struc
    30 00000000 ????                <1> lpSize		dw ?
    31 00000002 ????                <1> lpCount		dw ?
    32 00000004 ????????            <1> lpBuffer	dd ?
    33 00000008 ????????????????    <1> lpSector	dd ?,?
    34                              <1> LBAPACKETSTRUC ends
    35                              <1> 
    36                              <1> ;
    37                              <1> ; VARIOUS FORM FACTORS TO DESCRIBE MEDIA
    38                              <1> ;
    39                              <1> FF48TPI 	    EQU     0
    40                              <1> FF96TPI 	    EQU     1
    41                              <1> FFSMALL 	    EQU     2
    42                              <1> FFHARDFILE	    EQU     5
    43                              <1> FFOTHER 	    EQU     7
    44                              <1> 
    45                              <1> BDS_TYPE	STRUC
    46 00000000 ????????            <1> LINK		DD		?	; LINK TO NEXT BDS
    47 00000004 ??                  <1> DRIVENUM	DB		?	; INT 13 DRIVE NUMBER
    48 00000005 ??                  <1> DRIVELET	DB		?	; DOS DRIVE NUMBER
    49 00000006 ????                <1> BYTEPERSEC	DW		?	; NUMBER OF BYTES/SEC
    50 00000008 ??                  <1> SECPERCLUS	DB		?	; SEC PER ALLOCATION UNIT
    51 00000009 ????                <1> RESSEC		DW		?	; NUMBER OF RESERVED SECTORS
    52 0000000B ??                  <1> CFAT		DB		?	; NUMBER OF FATS
    53 0000000C ????                <1> CDIR		DW		?	; NUMBER OF DIRECTORY ENTRIES
    54 0000000E ????                <1> DRVLIM		DW		?	; NUMBER OF SECTORS ON MEDIUM
    55 00000010 ??                  <1> MEDIAD		DB		?	; MEDIA DESCRIPTOR BYTE
    56 00000011 ????                <1> CSECFAT 	DW		?	; NUMBER OF SECTORS/FAT
    57 00000013 ????                <1> SECLIM		DW		?	; SECTORS PER TRACK
    58 00000015 ????                <1> HDLIM		DW		?	; MAX NUMBER OF HEADS
    59 00000017 ????                <1> HIDSEC_L	DW		?	; NUMBER OF HIDDEN SECTORS
    60 00000019 ????                <1> HIDSEC_H	dw		? ;0	;J.K.87
    61 0000001B ????                <1> DRVLIM_L	dw		? ;0	;J.K.87
    62 0000001D ????                <1> DRVLIM_H	dw		? ;0	;J.K.87
    63 0000001F ??                  <1> FATSIZ		DB		?	; FLAGS...
    64 00000020 ????                <1> OPCNT		DW		?	; OPEN REF. COUNT
    65 00000022 ??                  <1> FORMFACTOR	DB		?	; FORM FACTOR INDEX
    66 00000023 ????                <1> FLAGS		DW		?	; VARIOUS FLAGS
    67 00000025 ????                <1> CCYLN		DW		?	; MAX NUMBER OF CYLINDERS
    68 00000027 ????                <1> RBYTEPERSEC	DW		?	; RECOMMENDED BPB
    69 00000029 ??                  <1> RSECPERCLUS	DB		?
    70 0000002A ????                <1> RRESSEC 	DW		?
    71 0000002C ??                  <1> RCFAT		DB		?
    72 0000002D ????                <1> RCDIR		DW		?
    73 0000002F ????                <1> RDRVLIM 	DW		?
    74 00000031 ??                  <1> RMEDIAD 	DB		?
    75 00000032 ????                <1> RCSECFAT	DW		?
    76 00000034 ????                <1> RSECLIM 	DW		?
    77 00000036 ????                <1> RHDLIM		DW		?
    78 00000038 ????                <1> RHIDSEC_L	DW		?
    79 0000003A ????                <1> RHIDSEC_H	DW		? ;0	;J.K.87
    80 0000003C ????                <1> RDRVLIM_L	dw		? ;0	;J.K.87
    81 0000003E ????                <1> RDRVLIM_H	dw		? ;0	;J.K.87
    82 00000040 ????????????        <1> RESERVE 	DB		6 DUP (?)	; RESERVED FOR FUTURE
    83 00000046 ??                  <1> TRACK		DB		?	; LAST TRACK ACCESSED ON DRIVE
    84 00000047 ????                <1> TIM_LO		DW		?	; TIME OF LAST ACCESS. KEEP
    85 00000049 ????                <1> TIM_HI		DW		?	; THESE CONTIGUOUS.
    86 0000004B <res Ch>            <1> VOLID		DB		12 DUP (?)	; VOLUME ID OF MEDIUM
    87 00000057 ????????            <1> VOL_SERIAL	dd	? ;0	  ;J.K.87 Current volume serial number from Boot record
    88 0000005B <res 9h>            <1> FILESYS_Id	db	9 dup (?) ;(0) ;J.K.87 Current file system id from Boot record
    89                              <1> BDS_TYPE	ENDS
    90                              <1> 
    91                              <1> BPBSIZE     equ	TRACK - RBYTEPERSEC ; SIZE IN BYTES OF RECBPB AREA IN THE BDS
    92                              <1> 
    93                              <1> 
    94                              <1> ;*********************************************************************
    95                              <1> ;	BDS structure for mini disk - J.K. 4/7/86
    96                              <1> ;*********************************************************************
    97                              <1> 
    98                              <1> BDSM_type	struc
    99 00000000 ????                <1> mlink		DW	? ;-1			;Link to next structure
   100 00000002 ????                <1> 		DW	?
   101 00000004 ??                  <1> mdriveNum	DB	? ;80			;Int 13 Drive Number
   102 00000005 ??                  <1> mdriveLet	DB	? ;3			;Logical Drive Number
   103 00000006 ????                <1> mBytePerSec	DW	? ;512
   104 00000008 ??                  <1> mSecPerClus	DB	? ;1			;Sectors/allocation unit
   105 00000009 ????                <1> mRESSEC 	DW	? ;1			;Reserved sectors for DOS
   106 0000000B ??                  <1> mcFAT		DB	? ;2			;No. of allocation tables
   107 0000000C ????                <1> mcDIR		DW	? ;16			;Number of directory entries
   108 0000000E ????                <1> mDRVLIM 	DW	? ;0			;Number of sectors (at 512 bytes each)
   109 00000010 ??                  <1> mMediad 	DB	? ;11111000B		;Media descriptor
   110 00000011 ????                <1> mcSecFat	DW	? ;1			;Number of FAT sectors
   111 00000013 ????                <1> mSECLIM 	DW	? ;0			;Sector limit
   112 00000015 ????                <1> mHDLIM		DW	? ;0			;Head limit
   113 00000017 ????                <1> mHIDSEC_L	DW	? ;0			;Hidden sector count
   114 00000019 ????                <1> mHidsec_H	dw	? ;0			;J.K.87
   115 0000001B ????                <1> mDrvlim_L	dw	? ;0			;J.K.87
   116 0000001D ????                <1> mDrvlim_H	dw	? ;0			;J.K.87
   117 0000001F ??                  <1> mFatSiz 	DB	? ;0			;TRUE => bigfat
   118 00000020 ????                <1> mOPCNT		DW	? ;0			;Open Ref. Count
   119 00000022 ??                  <1> mFormFactor	DB	? ;3			;Form Factor
   120 00000023 ????                <1> mFLAGS		DW	? ;0020H		;Various Flags
   121 00000025 ????                <1> mcCyln		dw	? ;40			;max number of cylinders
   122 00000027 <res 1Fh>           <1> mRecBPB 	db	31 dup (?) ;(0)		;Recommended BPB for drive
   123 00000046 ??                  <1> mTrack		db	? ;-1
   124 00000047 ????                <1> IsMini		dw	? ;1			;Overlapping TIM_LOH
   125 00000049 ????                <1> Hidden_Trks	dw	? ;0			;Overlapping TIM_HIH
   126 0000004B <res Bh>            <1> mVOLID		DB	11 dup (?) ;"NO NAME    "           ;Volume ID for this disk
   127 00000056 ??                  <1> 		DB	? ;0			;ASCIZII for "NO NAME    "
   128 00000057 ????????            <1> mVol_Serial	dd	? ;0	   ;Current volume serial number from Boot record
   129 0000005B ????????????????    <1> mFileSys_Id	db	8 dup (?) ;"FAT12   " ;Current file system id from Boot record
   130 00000063 ??                  <1> 		db	? ;0
   131                              <1> 
   132                              <1> BDSM_type	ENDS
   133                              <1> ;******************************************************************************
   134                              <1> Max_mini_dsk_num equ 23	      ;J.K. 4/7/86 - max # of mini disk ibmbio can support
   135                              <1> ;
   136                              <1> 
   137                                  
   138                                  ;   REV 2.1	5/1/83 ARR ADDED TIMER INT HANDLER AND CHANGED ORDER OF AUX
   139                                  ;		    PRN INIT FOR HAL0
   140                                  ;
   141                                  ;   REV 2.15	7/13/83 ARR BECAUSE IBM IS FUNDAMENTALY BRAIN DAMAGED, AND
   142                                  ;		    BASCOM IS RUDE ABOUT THE 1CH TIMER INTERRUPT, THE TIMER
   143                                  ;		    HANDLER HAS TO GO BACK OUT!!!!!  IBM SEEMS UNWILLING TO
   144                                  ;		    BELIEVE THE PROBLEM IS WITH THE BASCOM RUNTIME, NOT THE
   145                                  ;		    DOS.  THEY HAVE EVEN BEEN GIVEN A PATCH FOR BASCOM!!!!!
   146                                  ;		    THE CORRECT CODE IS COMMENTED OUT AND HAS AN ARR 2.15
   147                                  ;		    ANNOTATION.  THIS MEANS THE BIOS WILL GO BACK TO THE
   148                                  ;		    MULTIPLE ROLL OVER BUG.
   149                                  ;   REV 2.20	8/5/83 ARR IBM MAKES HARDWARE CHANGE.  NOW WANTS TO USE HALF
   150                                  ;		    HIGHT DRIVES FOR HAL0, AND BACK FIT FOR PC/PC XT.  PROBLEM
   151                                  ;		    WITH HEAD SETTLE TIME.  PREVIOUS DRIVES GOT BY ON A 0
   152                                  ;		    SETTLE TIME, 1/2 HIGHT DRIVES NEED 15 HEAD SETTLE WHEN
   153                                  ;		    DOING WRITES (0 OK ON READ) IF THE HEAD IS BEING STEPPED.
   154                                  ;		    THIS REQUIRES A LAST TRACK VALUE TO BE KEPT SO THAT BIOS
   155                                  ;		    KNOWS WHEN HEAD IS BEING MOVED.  TO HELP OUT STUPID
   156                                  ;		    PROGRAMS THAT ISSUE INT 13H DIRECTLY, THE HEAD SETTLE WILL
   157                                  ;		    NORMALLY BE SET TO 15.  IT WILL BE CHANGED TO 0 ON READS,
   158                                  ;		    OR ON WRITES WHICH DO NOT REQUIRE HEAD STEP.
   159                                  ;   REV 2.21	8/11/83 MZ IBM WANTS WRITE WITH VERIFY TO USE HEAD SETTLE 0.
   160                                  ;		    USE SAME TRICK AS ABOVE.
   161                                  ;   REV 2.25	6/20/83 MJB001 ADDED SUPPORT FOR 96TPI AND SALMON
   162                                  ;   REV 2.30	6/27/83 MJB002 ADDED REAL-TIME CLOCK
   163                                  ;   REV 2.40	7/8/83 MJB003 ADDED VOLUME-ID CHECKING AND INT 2F MACRO
   164                                  ;		    DEFINITIONS PUSH* AND POP*
   165                                  ;   REV 2.41	7/12/83 ARR MORE 2.X ENHANCEMENTS.  OPEN/CLOSE MEDIA CHANGE
   166                                  ;   REV 2.42	11/3/83 ARR MORE 2.X ENHANCEMENTS.  DISK OPEN/CLOSE, FORMAT
   167                                  ;		    CODE AND OTHER MISC HOOKED OUT TO SHRINK BIOS.  CODE FOR
   168                                  ;		    DISK OPEN/CLOSE, FORMAT INCLUDED ONLY WITH 96TPI DISKS.
   169                                  ;   REV   2.43	12/6/83 MZ EXAMINE BOOT SECTORS ON HARD DISKS FOR 16-BIT FAT
   170                                  ;		    CHECK.  EXAMINE LARGE FAT BIT IN BPB FOR WALK OF MEDIA FOR
   171                                  ;		    DOS
   172                                  ;   REV   2.44	12/9/83 ARR CHANGE TO ERROR REPORTING ON INT 17H
   173                                  ;   REV   2.45	12/22/83 MZ MAKE HEAD SETTLE CHANGE ONLY WHEN DISK PARM IS 0.
   174                                  
   175                                  ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   176                                  ;
   177                                  ;	IBM ADDRESSES FOR I/O
   178                                  ;
   179                                  ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   180                                  
   181                                  	%include "msdskpr.mac"
     1                              <1> ; The following structure defines the disk parameter table
     2                              <1> ; pointed to by Interrupt vector 1EH (location 0:78H)
     3                              <1> 
     4                              <1> DISK_PARMS	STRUC
     5 00000000 ??                  <1> DISK_SPECIFY_1	DB	?
     6 00000001 ??                  <1> DISK_SPECIFY_2	DB	?
     7 00000002 ??                  <1> DISK_MOTOR_WAIT DB	?	; Wait till motor off
     8 00000003 ??                  <1> DISK_SECTOR_SIZ DB	?	; Bytes/Sector (2 = 512)
     9 00000004 ??                  <1> DISK_EOT	DB	?	; Sectors per track (MAX)
    10 00000005 ??                  <1> DISK_RW_GAP	DB	?	; Read Write Gap
    11 00000006 ??                  <1> DISK_DTL	DB	?
    12 00000007 ??                  <1> DISK_FORMT_GAP	DB	?	; Format Gap Length
    13 00000008 ??                  <1> DISK_FILL	DB	?	; Format Fill Byte
    14 00000009 ??                  <1> DISK_HEAD_STTL	DB	?	; Head Settle Time (MSec)
    15 0000000A ??                  <1> DISK_MOTOR_STRT DB	?	; Motor start delay
    16                              <1> DISK_PARMS	ENDS
    17                              <1> 
    18                              <1> ROMStatus	equ	1
    19                              <1> ROMRead 	equ	2
    20                              <1> ROMWrite	equ	3
    21                              <1> ROMVerify	equ	4
    22                              <1> ROMFormat	equ	5
   182                                  
   183                                  LF	equ	10			;LINE FEED
   184                                  CR	equ	13			;CARRIAGE RETURN
   185                                  BACKSP	equ	8			;BACKSPACE
   186                                  BRKADR	equ	1BH * 4 		;006C  1BH BREAK VECTOR ADDRESS
   187                                  TIMADR	equ	1CH * 4 		;0070  1CH TIMER INTERRUPT
   188                                  DSKADR	equ	1EH * 4 		;ADDRESS OF PTR TO DISK PARAMETERS
   189                                  SEC9	equ	522H			;ADDRESS OF DISK PARAMETERS
   190                                  HEADSETTLE equ	SEC9+9			; ARR 2.20 ADDRESS OF HEAD SETTLE TIME
   191                                  NORMSETTLE equ	15			; ARR 2.20 NORMAL HEAD SETTLE
   192                                  SPEEDSETTLE equ	0			; ARR 2.20 SPEED UP SETTLE TIME
   193                                  INITSPOT equ	534H			; ARR IBM WANTS 4 ZEROS HERE
   194                                  AKPORT	equ	20H
   195                                  EOI	equ	20H
   196                                  
   197                                   assume ds:nothing, es:nothing, ss:nothing
   198                                  
   199                                  	EXTRN	MEDIA$CHK:NEAR
   200                                  	EXTRN	GET$BPB:NEAR
   201                                  	EXTRN	DSK$INIT:NEAR
   202                                  	EXTRN	DSK$READ:NEAR
   203                                  	EXTRN	DSK$WRIT:NEAR
   204                                  	EXTRN	DSK$WRITV:NEAR
   205                                  	EXTRN	DSK$OPEN:NEAR
   206                                  	EXTRN	DSK$CLOSE:NEAR
   207                                  	EXTRN	DSK$REM:NEAR
   208                                  	EXTRN	GENERIC$IOCTL:NEAR
   209                                  	EXTRN	IOCTL$GETOWN:NEAR
   210                                  	EXTRN	IOCTL$SETOWN:NEAR
   211                                  	EXTRN	CON$READ:NEAR
   212                                  	EXTRN	CON$RDND:NEAR
   213                                  	EXTRN	CON$FLSH:NEAR
   214                                  	EXTRN	CON$WRIT:NEAR
   215                                  ;	EXTRN	CON$GENIOCTL:NEAR		;J.K. 4/29/86
   216                                  	EXTRN	AUX$READ:NEAR
   217                                  	EXTRN	AUX$WRIT:NEAR
   218                                  	EXTRN	AUX$FLSH:NEAR
   219                                  	EXTRN	AUX$RDND:NEAR
   220                                  	EXTRN	AUX$WRST:NEAR
   221                                  	EXTRN	TIM$READ:NEAR
   222                                  	EXTRN	TIM$WRIT:NEAR
   223                                  	EXTRN	PRN$WRIT:NEAR
   224                                  	EXTRN	PRN$STAT:NEAR
   225                                  	EXTRN	PRN$TILBUSY:NEAR
   226                                  	EXTRN	PRN$GENIOCTL:NEAR
   227                                  	EXTRN	WRMSG:NEAR
   228                                  
   229                                  
   230                                  ;=== Push trace listing source: msbdata.nas
   231                                  	%include "msbdata.nas" ; NASM included file
     1                              <1> 
     2                              <1> %include "nasmorg.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> NASM macros to replace JWasm org directive
     5                              <2>  2024 by E. C. Masloch, Public Domain
     6                              <2> 
     7                              <2> %endif
     8                              <2> 
     9                              <2> 	%imacro org 1-2.nolist db 0
    10                              <2> times (%1) - ($ - $$) %2
    11                              <2> 	%endmacro
     3                              <1> %include "amis.mac"
     1                              <2> [list -]
     4                              <1> 
     5                              <1> BASE700h equ 256	; DOSENTRY:this value should -> 00700h
     6                              <1> 
     7                              <1> section DOSENTRY
     8                              <1> ;==============================================================================
     9                              <1> ;REVISION HISTORY:
    10                              <1> ;AN000 - New for DOS Version 3.4 - J.K.
    11                              <1> ;AC000 - Changed for DOS Version 3.4 - J.K.
    12                              <1> ;ANxxx - PTR, DCRs
    13                              <1> ;==============================================================================
    14                              <1> ;AN001 - d9  Double word MOV instruction for 80386 based machine.    7/1/87 J.K.
    15                              <1> ;AN002 - d25 Change DASD ERP to that recommended by Storage Systems. 7/29/87 J.K.
    16                              <1> ;AN003; d304 Boot record structure change for OS2		     11/9/87 J.K.
    17                              <1> ;==============================================================================
    18                              <1> 	EXTRN	INIT:NEAR
    19                              <1> 
    20                              <1> 	PUBLIC	START$
    21                              <1> START$:
    22                              <1>  assume ds:nothing, es:nothing, ss:nothing
    23 00000000 E9(0000)            <1> 	JMP	INIT			;START$ PATCH BY INIT TO POINT TO
    24                              <1> 					;HDRIVE BPB
    25 00000003 26<rep Dh>          <1> 	align 16, db 26h
    26                              <1> ;	PUBLIC	FORMAT_PATCH
    27                              <1> ;FORMAT_PATCH:				 ;ARR 2.42
    28                              <1> ;	JMP	FMTSET			;MJB001 DISPATCH FOR CALL FROM FORMAT UTILITY
    29                              <1> 
    30                              <1> 
    31                              <1> 	PATHSTART 001,BIO
   122                              <2>  %IF PATHGEN
   123                              <2>  PUBLIC %2%1S,%2%1E
   124                              <2>  %2%1S LABEL BYTE
   125                              <2>  %ENDIF
    32                              <1> 
    33                              <1> ;	DB	20 DUP (0)		;IBM WANTS SOME ZEROED AREA (DELETED)
    34                              <1> 
    35                              <1> 
    36                              <1> ;HEADER  DB	 "Ver 2.45"
    37                              <1> 
    38                              <1> global dosentry_xmsentry
    39                              <1> %include "codesw.mac"
     1                              <2> DOSCODE_HMA_SEGMENT equ 0FFFEh
     2                              <2> 	; address DOSCODE at this segment when in HMA
     3                              <2> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h
     4                              <2> 	; offset from DOSCODE offset 0 to address 10_0000h
     5                              <2> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h
     6                              <2> 	; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB
    40                              <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
    41                              <1> %include "entry.asm"		; new in lDOS
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDOS DOSENTRY handling
     5                              <2>  by E. C. Masloch, 2018--2025
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %if 0
    16                              <2> 
    17                              <2> (lMS-DOS: Comments not current)
    18                              <2> 
    19                              <2> The DOSENTRY section is always located at segment 60h. It includes some data
    20                              <2> structures found in MS-DOS (most notably the Int19 interrupt restoration table
    21                              <2> at 70h:100h), the device headers for all default devices (except NUL) and all
    22                              <2> code entries into the DOS code. If the DOS code is not relocateable, DOSENTRY
    23                              <2> and DOSCODE are merged into one section.
    24                              <2> 
    25                              <2> Relocated entries which are in DOSENTRY for relocation:
    26                              <2> Interrupt 00h		Division error exception
    27                              <2> Interrupt 06h		Invalid opcode exception
    28                              <2> Interrupt 13h		BIOS disk services
    29                              <2> Interrupt 19h		Reboot
    30                              <2> Interrupt 1Bh		Ctrl-Break notification
    31                              <2> Interrupt 20h		Terminate program
    32                              <2> Interrupt 21h		DOS services
    33                              <2> Interrupt 25h		Absolute disk read
    34                              <2> Interrupt 26h		Absolute disk write
    35                              <2> Interrupt 27h		Terminate and stay resident
    36                              <2> Interrupt 28h		Idle
    37                              <2> Interrupt 29h		Display character
    38                              <2> Interrupt 2Fh		Multiplex, DOS services
    39                              <2> CALL 5			CP/M compatibility services (subset of interrupt 21h)
    40                              <2> Device strategy		All device functions
    41                              <2> Case map function	Maps language-specific characters >=80h to uppercase
    42                              <2> Redirector mapper	Maps unhandled redirector calls to MS-DOS interface
    43                              <2> 
    44                              <2> If DOSCODE is not the same section as DOSENTRY (if DOSCODE is relocateable),
    45                              <2> each of the relocated entries calls relocatedentry with a parameter behind the
    46                              <2> near call opcode. The near call opcode and the byte sized parameter for each
    47                              <2> entry need 4 byte. relocatedentry insures that DOSCODE is available (switches
    48                              <2> the A20 line on if DOSCODE is in the HMA) and jumps to the DOSCODE function
    49                              <2> relocated_relocatedentry. The latter uses the in-code parameter (behind the
    50                              <2> function call within DOSENTRY) as a displacement into doscode_entrypoint_list,
    51                              <2> where we store the target near address in DOSCODE.
    52                              <2> 
    53                              <2> If the target DOSCODE near address is equal to DEVStrategy, then the entry in
    54                              <2> doscode_entrypoint_list contains another word (after the DEVStrategy address)
    55                              <2> which points at a device strategy function dispatch table, stored in DOSCODE.
    56                              <2> Some of the device strategies also include another byte after the table offset,
    57                              <2> which gives the device unit to use (only used for PRN/LPTx and AUX/COMx).
    58                              <2> 
    59                              <2> It is insured that an entry of doscode_entrypoint_list with displacement
    60                              <2> equal to 0CCh is not used, so that relocated_relocatedentry can reliably
    61                              <2> detect breakpoints set after the call jumps. Such a breakpoint hides the true
    62                              <2> displacement value and thus must be detected and circumvented.
    63                              <2> 
    64                              <2> Entries which are in DOSENTRY but don't execute code in DOSCODE:
    65                              <2> Interrupt 23h		Always terminates application
    66                              <2> Interrupt 24h		Always fails call
    67                              <2> Interrupt 2Eh		Always reports error
    68                              <2> Device interrupt	MS-DOS device compatibility (does nothing)
    69                              <2> Dummy file sharer	Always returns error 0001h (Invalid function)
    70                              <2> Dummy redirector	Always returns error 0001h (Invalid function)
    71                              <2> Other hooked interrupts	Do nothing
    72                              <2> 
    73                              <2> %endif
    74                              <2> 
    75                              <2> usesection DOSENTRY
    76                              <2> 
    77                              <2> %assign _FATFS			0
    78                              <2> %assign _MAPPER			0
    79                              <2> %assign _INT28			0
    80                              <2> %assign _CALL5			1
    81                              <2> 
    82                              <2> 
    83                              <2> %define ENTRYPOINT_LIST .none,dw "",dw "",db "",db ""
    84                              <2> 
    85                              <2> 	%imacro _relocate 1-4.nolist "","",""
    86                              <2> 	call relocatedentry
    87                              <2> 	retf			; help debugging. handler will reflect back
    88                              <2> 				;  to the stub here with the modified stack.
    89                              <2> add_to_entrypoint_list %%label,dw %1,dw %2,db %3,db %4,ENTRYPOINT_LIST
    90                              <2> 	extern %1
    91                              <2> 
    92                              <2> 	db %%label - doscode_entrypoint_list
    93                              <2> 	%endmacro
    94                              <2> %if _RELOCATEDOSCODE
    95                              <2>  %idefine relocate _relocate
    96                              <2> %endif
    97                              <2> %idefine devicerelocate _relocate
    98                              <2> 
    99                              <2> 	%imacro add_to_entrypoint_list 5-*.nolist
   100                              <2> %if %0 % 5
   101                              <2>  %fatal Expected a number of arguments that is a multiple of five
   102                              <2> %endif
   103                              <2> %push
   104                              <2> %define %$label	%1
   105                              <2> %define %$two	%2
   106                              <2> %define %$three	%3
   107                              <2> %define %$four	%4
   108                              <2> %define %$five	%5
   109                              <2> %assign %$found	0
   110                              <2> %rotate 5
   111                              <2> %rep (%0 - 5) / 5
   112                              <2>  %ifn %$found
   113                              <2>   %ifidn	%$two,	%2
   114                              <2>    %ifidn	%$three,%3
   115                              <2>     %ifidn	%$four,	%4
   116                              <2>      %ifidn	%$five,	%5
   117                              <2> %$label: equ %1
   118                              <2>       %assign %$found 1
   119                              <2>      %endif
   120                              <2>     %endif
   121                              <2>    %endif
   122                              <2>   %endif
   123                              <2>  %endif
   124                              <2>  %rotate 5
   125                              <2> %endrep
   126                              <2> %ifn %$found
   127                              <2>  %xdefine ENTRYPOINT_LIST ENTRYPOINT_LIST,%$label,%$two,%$three,%$four,%$five
   128                              <2> %endif
   129                              <2> %pop
   130                              <2> 	%endmacro
   131                              <2> 
   132                              <2> 	%imacro write_entrypoint_list 0-*.nolist
   133                              <2> 	align 2
   134                              <2> doscode_entrypoint_list:
   135                              <2> %if %0 % 5
   136                              <2>  %fatal Expected a number of arguments that is a multiple of five
   137                              <2> %endif
   138                              <2> %rep %0 / 5
   139                              <2> 	align 2
   140                              <2> ; %if ($ - doscode_entrypoint_list) == 0CCh
   141                              <2> ;  %warning added word to doscode_entrypoint_list to find bp after call jump
   142                              <2> ;	dw 9090h
   143                              <2> ; %endif
   144                              <2> %1:		; label (used as displacement from doscode_entrypoint_list)
   145                              <2> 	%2	; entrypoint (word)
   146                              <2> 	%3	; device function table, if any (word)
   147                              <2> 	%4	; device unit number, if any (byte)
   148                              <2> 	%5	; second device unit number, if any (byte)
   149                              <2> %rotate 5
   150                              <2> %endrep
   151                              <2> doscode_entrypoint_list.end:
   152                              <2> 	%endmacro
   153                              <2> 
   154                              <2> 
   155                              <2> 	align 2
   156                              <2>  assume cs:nothing, ds:nothing, es:nothing, ss:nothing
   157                              <2> %if _RELOCATEDOSCODE
   158                              <2>  %if _DOSCODEHMA
   159                              <2> 	nop
   160                              <2> 	nop	; insure ri00o != 0
   161                              <2>  %endif
   162                              <2> i00:	db __TEST_IMM8		; skip stc, NC
   163                              <2> i19:	stc
   164                              <2> 	relocate relocated_i00_i19
   165                              <2> ; i06:	relocate relocatedi06
   166                              <2> msdisk_i13:	relocate relocatedmsdisk_i13
   167                              <2> ms96tpi_i13:	relocate relocatedms96tpi_i13
   168                              <2> i1B:	relocate relocatedi1B
   169                              <2> i20:	xor ax, ax
   170                              <2> i21:	relocate relocatedi21
   171                              <2> i25:	db __TEST_IMM8		; skip stc, NC
   172                              <2> i26:	stc
   173                              <2> 	relocate relocated_i25_i26
   174                              <2> i27:	relocate relocatedi27
   175                              <2>  %if _INT28
   176                              <2> i28:	relocate relocatedi28
   177                              <2>  %endif
   178                              <2> i29:	relocate relocatedi29
   179                              <2> i2F:	relocate relocatedhead_i2F
   180                              <2> call5:	relocate relocatedcall5
   181                              <2> i31:	db __TEST_IMM8		; skip stc, NC
   182                              <2> i6C:	stc
   183                              <2> 	relocate relocated_i31_i6C
   184                              <2>  %if _FATFS
   185                              <2> fatfs:	jmp short .jump
   186                              <2> .next:	jmp FIXDOSENTRY:mapper
   187                              <2> .jump:	relocate relocatedfatfs
   188                              <2> fatfs2:	jmp short .jump
   189                              <2> .next:	jmp FIXDOSENTRY:NotHooked
   190                              <2> .jump:	relocate relocatedfatfs2
   191                              <2>  %endif
   192                              <2>  %if _MAPPER
   193                              <2> mapper:	relocate relocatedmapper
   194                              <2>  %endif
   195                              <2> casemap:relocate relocatedcasemap
   196                              <2> fastentry: relocate relocatedfastentry
   197                              <2> ifsentry: relocate relocatedifsentry
   198                              <2> okcallentry: relocate relocatedokcallentry
   199                              <2> badcallentry: relocate relocatedbadcallentry
   200                              <2> %endif
   201                              <2> 
   202                              <2> 
   203                              <2> i23:
   204 00000010 F9                  <2> 	stc
   205                              <2> entry_retf:
   206 00000011 CB                  <2> 	retf
   207                              <2> 
   208                              <2> i24:
   209 00000012 B003                <2> 	mov al, 03h
   210                              <2> entry_iret:
   211 00000014 CF                  <2> 	iret
   212                              <2> 
   213                              <2> a20off_entry:
   214                              <2>  %if _RELOCATEDOSCODE && _DOSCODEHMA
   215                              <2> 	mov ah, 06h		; Local Disable A20 (04h would be Global)
   216                              <2> 	 push cs
   217                              <2> 	call transfer_xmsentry
   218                              <2> 				; ignore errors
   219                              <2> 	mov ah, 04h		; Global Disable A20
   220                              <2> 	 push cs
   221                              <2> 	call transfer_xmsentry
   222                              <2> 				; ignore errors
   223                              <2>  %endif
   224 00000015 5B                  <2> 	pop bx			; get bx and ax from stack
   225 00000016 58                  <2> 	pop ax
   226 00000017 CF                  <2> 	iret			; pop ip, cs, fl
   227                              <2> 
   228                              <2>  global run_int21_shell
   229                              <2> run_int21_shell:
   230                              <2>  assume ds:nothing, es:nothing, ss:nothing
   231 00000018 CD21                <2> 	int 21h
   232                              <2>  %if _RELOCATEDOSCODE
   233                              <2> 	relocate relocatedshellreturned
   234                              <2>  %else
   235 0000001A E9(1F01)            <2> 	jmp shellreturned
   236                              <2>  %endif
   237                              <2> 
   238                              <2>  %if _RELOCATEDOSCODE && _DOSCODEHMA
   239                              <2>     times ((((2) - (($-$$) % (2))) % (2))) ^ 1 nop	; anti align
   240                              <2> transfer_xmsentry:		; far jumps to XMS entrypoint
   241                              <2>     	jmp DOSENTRY:entry_retf
   242                              <2> dosentry_xmsentry: equ $ - 4	; patched to hold XMS entrypoint address
   243                              <2>  %endif
   244                              <2> 
   245                              <2>  %if _RELOCATEDOSCODE
   246                              <2> global i20, i21, i25, i26, i27, i2F, call5
   247                              <2> global fastentry, ifsentry, okcallentry, badcallentry, i00, casemap, i31
   248                              <2> global i19, msdisk_i13, ms96tpi_i13
   249                              <2> global i29, i1B
   250                              <2> global i6C
   251                              <2>  %endif
   252                              <2> global i23, i24, entry_iret
   253                              <2> global a20off_entry
   254                              <2> global entry_iret
   255                              <2> global conentry, prnentry, auxentry
   256                              <2> global com1entry, com2entry, com3entry, com4entry
   257                              <2> global lpt1entry, lpt2entry, lpt3entry, clockentry, blockentry
   258                              <2> 
   259                              <2> %if 0
   260                              <2> 	%imacro irtentry 1.nolist
   261                              <2> db %1
   262                              <2> dd 0
   263                              <2> 	%endmacro
   264                              <2> 
   265                              <2> 
   266                              <2> %assign num 256-($-$$)
   267                              <2> %warning num bytes in front of IRT
   268                              <2> 
   269                              <2> 	_fill 256, 0, dosentry_start
   270                              <2> InterruptRestorationTable:
   271                              <2> 	irtentry 10h
   272                              <2> 	irtentry 13h
   273                              <2> 	irtentry 15h
   274                              <2> 	irtentry 19h
   275                              <2> 	irtentry 1Bh
   276                              <2> 		; Above interrupts are in the order MS-DOS 6.x saves them
   277                              <2> 		;  (FDEMM386?/Jemm expects Int19 within the first five entries)
   278                              <2> 
   279                              <2> 	irtentry 00h
   280                              <2> 	irtentry 01h
   281                              <2> 	irtentry 03h
   282                              <2> 	irtentry 04h
   283                              <2> 	irtentry 06h
   284                              <2> 	irtentry 08h
   285                              <2> 	irtentry 16h
   286                              <2> 	irtentry 1Ch
   287                              <2> 	irtentry 1Eh
   288                              <2> 	irtentry 21h
   289                              <2> 	irtentry 23h
   290                              <2> 	irtentry 24h
   291                              <2> 	irtentry 29h
   292                              <2> 	irtentry 2Fh
   293                              <2> 	irtentry 33h
   294                              <2> 	db -1
   295                              <2> %endif
   296                              <2> 
   297                              <2> 
   298                              <2>  %if _RELOCATEDOSCODE
   299                              <2> extern dosdata_to_doscode_segment
   300                              <2>  %endif
   301                              <2> 
   302                              <2> ; %if _INT19_IN_DOSENTRY
   303                              <2> ;  %if _RELOCATEDOSCODE
   304                              <2> ; i19:
   305                              <2> ;  %endif
   306                              <2> ; %include "int19.asm"
   307                              <2> ; %endif
   308                              <2> 
   309                              <2> %if _RELOCATEDOSCODE && _DOSCODEHMA
   310                              <2> 		; CHG:	ds, si, ax
   311                              <2> 		; OUT:	NZ if A20 line is switched on
   312                              <2> 		;	ZR if A20 line is switched off
   313                              <2> 		;	may return with IF=0
   314                              <2> 		;	UP
   315                              <2> dosentry_check_a20:
   316                              <2>  assume cs:DOSENTRYGROUP, ds:nothing, es:nothing, ss:nothing
   317                              <2> 	cld
   318                              <2> 	push es
   319                              <2> 	push di
   320                              <2> 	push cx
   321                              <2> 	xor di, di
   322                              <2> 	mov es, di		; es = 0000h
   323                              <2>  assume es:IVT
   324                              <2> 	dec di
   325                              <2> 	mov ds, di		; ds = FFFFh
   326                              <2>  assume ds:nothing
   327                              <2> 	inc di			; es:di = 0000h:0000h =  00000h
   328                              <2> 	mov si, 0010h		; ds:si = FFFFh:0010h = 100000h
   329                              <2> 				;  (same address if bit 20 off)
   330                              <2> 	mov cx, si		; 32 byte (16 = 10h word)
   331                              <2> 	push si
   332                              <2> 	repe cmpsw		; compare, A20 line switched on if differing
   333                              <2> 	pop si			; -> FFFFh:0010h = 10_0000h
   334                              <2> 				;  (in the HMA, part of the VDISK header)
   335                              <2> 	jne .ret		; differing -->
   336                              <2> 	xor di, di		; -> 0000h:0000h = 00_0000h
   337                              <2> 				;  (in the LMA, offset word of int 00h handler)
   338                              <2> 	cli			; try not to run interrupt handlers during this
   339                              <2> 	push word [si]		; save value
   340                              <2> 	dec word [si]		; change value (in HMA, or wrapped around LMA)
   341                              <2> 	cmpsw			; compare values, NZ if A20 is switched on
   342                              <2> 	pop word [si - 2]	; restore value
   343                              <2> 		; This can still report a false negative (A20 detected off
   344                              <2> 		;  when actually it is on), but we don't care about that.
   345                              <2> .ret:
   346                              <2> 	pop cx
   347                              <2> 	pop di
   348                              <2> 	pop es
   349                              <2>  assume es:nothing
   350                              <2> 	retn
   351                              <2> 
   352                              <2> 
   353                              <2> @@:
   354                              <2>  assume ds:nothing, es:nothing, ss:nothing
   355                              <2> 	push bx
   356                              <2> 	push bp
   357                              <2> 	mov ah, 0Eh
   358                              <2> 	mov bx, 7
   359                              <2> 	int 10h
   360                              <2> 	pop bp
   361                              <2> 	pop bx
   362                              <2> 
   363                              <2> dosentry_disp_msg_cs:
   364                              <2>  assume ds:nothing, es:nothing, ss:nothing
   365                              <2> 	cs lodsb
   366                              <2> 	test al, al
   367                              <2> 	jnz @B
   368                              <2> 	retn
   369                              <2> 
   370                              <2> 
   371                              <2> dosentry_msg:
   372                              <2> .a20_error_common:	asciz "DOSENTRY A20 error: XMS call "
   373                              <2> .a20_error_xms:		asciz "failed"
   374                              <2> .a20_error_actual:	asciz "reported success but A20 is still off"
   375                              <2> .a20_error_after:	asciz ".",13,10,"System halted. "
   376                              <2> %endif
   377                              <2> 
   378                              <2> 
   379                              <2> 		; INP:	byte [cs:ip + 1] = displacement in doscode_entrypoint_list
   380                              <2> 		;	word [DOSCODE:(displaced)]
   381                              <2> 		;	 = relocated entry address
   382                              <2> 		;	word [DOSCODE:(displaced + 2)]
   383                              <2> 		;	 = optional pointer to device function table
   384                              <2> 		;	byte [DOSCODE:(displaced + 4)]
   385                              <2> 		;	 = optional device unit
   386                              <2> 		; OUT:	Jumps to DOSCODE:(relocated entry address)
   387                              <2> 		;	If the relocated entry address is DEVStrategy,
   388                              <2> 		;	 ss:sp-> device unit or garbage (word),
   389                              <2> 		;		 pointer to device function table (word)
   390                              <2> 		; CHG:	- (not even flags!)
   391                              <2> 		; STT:	-
   392                              <2> %ifn _RELOCATEDOSCODE && _DOSCODEHMA
   393 0000001D 26<rep E3h>         <2>  times DOSENTRYDEVICEBASE * 16 - ($ - $$) db 26h
   394                              <2> %endif
   395                              <2> 
   396                              <2> %if ($ - $$) < DOSENTRYDEVICEBASE * 16
   397                              <2>  %error Entrypoint must be above or equal device base
   398                              <2> %endif
   399                              <2> 
   400                              <2> relocatedentry:
   401                              <2>  assume cs:nothing, ds:nothing, es:nothing, ss:nothing
   402 00000100 0E                  <2> 	push cs
   403 00000101 EA[0601][ssss]      <2> 	jmp DOSENTRY:.fixsegment				; insure cs = 70h
   404                              <2> .fixsegment:
   405                              <2>  assume cs:DOSENTRYGROUP
   406                              <2> 
   407 00000106 50                  <2> 	push ax
   408 00000107 1E                  <2> 	push ds
   409                              <2> 
   410                              <2> %if _RELOCATEDOSCODE
   411                              <2>  %if _DOSCODEHMA
   412                              <2>  global ..@dosentry_patch_hma
   413                              <2> ..@dosentry_patch_hma:
   414                              <2> 	jmp strict short .not_in_hma	; patch to a 2-byte NOP if in HMA
   415                              <2> 
   416                              <2> 		; DOSCODE is in HMA: check A20 and try to enable if disabled
   417                              <2> 		; INP:	-
   418                              <2> 		; CHG:	ds
   419                              <2> 
   420                              <2> 	pushf
   421                              <2> 	push si
   422                              <2> 		; INP:	-
   423                              <2> 		; OUT:	A20 enabled
   424                              <2> 		; CHG:	ax, si, fl, ds
   425                              <2> 	call dosentry_check_a20
   426                              <2> 	jne .hma_available	; not equal, A20 line is switched on -->
   427                              <2> 
   428                              <2> 	mov ah, 05h		; Local Enable A20 (03h would be Global ?)
   429                              <2> 	push bx
   430                              <2> 	 push cs
   431                              <2> 	call transfer_xmsentry	; request local enable A20
   432                              <2> 	pop bx			; may return an error code in bl
   433                              <2> 	dec ax			; 0001h if successful
   434                              <2> 	mov ax, dosentry_msg.a20_error_xms	; access with cs
   435                              <2> 	jnz .error		; was not 0001h -->
   436                              <2> 
   437                              <2> 	call dosentry_check_a20	; check again
   438                              <2> 	jne .hma_available	; not equal, A20 line is now switched on -->
   439                              <2> 
   440                              <2> 	mov ax, dosentry_msg.a20_error_actual	; access with cs
   441                              <2> .error:
   442                              <2> 	push ax
   443                              <2> 	mov si, dosentry_msg.a20_error_common	; access with cs
   444                              <2> 	call dosentry_disp_msg_cs
   445                              <2> 	pop si
   446                              <2> 	call dosentry_disp_msg_cs
   447                              <2> 	mov si, dosentry_msg.a20_error_after	; access with cs
   448                              <2> 	call dosentry_disp_msg_cs
   449                              <2> .loop:
   450                              <2> 	int3
   451                              <2> 	xor ax, ax
   452                              <2> 	int 16h
   453                              <2> 	jmp .loop
   454                              <2> 
   455                              <2> 
   456                              <2> .hma_available:
   457                              <2> 	pop si
   458                              <2> 	popf
   459                              <2> .not_in_hma:
   460                              <2>  %endif
   461                              <2> 
   462                              <2> %if 1
   463                              <2> 	mov ax, 0			; patched to point to DOSCODE
   464                              <2>  global ..@dosentry_doscode_segment
   465                              <2> ..@dosentry_doscode_segment equ $ - 2
   466                              <2> %else
   467                              <2> %if 0
   468                              <2> 	mov ds, word [cs:dosentry_to_dosdata_segment]	; => DOSDATA
   469                              <2>  assume ds:DOSGROUP
   470                              <2> %else
   471                              <2> 	mov ax, 0					; ! preserve fl
   472                              <2> 	mov ds, ax
   473                              <2>  assume ds:IVT
   474                              <2> 	mov ds, word [31h * 4 + 2]			; => DOSDATA
   475                              <2>  assume ds:DOSGROUP
   476                              <2> %endif
   477                              <2> 	mov ax, word [dosdata_to_doscode_segment]	; => DOSCODE
   478                              <2> %endif
   479                              <2> %else
   480 00000108 8CC8                <2> 	mov ax, cs
   481                              <2> %endif
   482                              <2> 
   483                              <2>  assume ds:nothing
   484                              <2> 		; ax => DOSCODE segment
   485                              <2> 
   486                              <2> 		; have ss:sp ->           (bp), ds, ax, cs, ip, original
   487                              <2> 		; want ss:sp -> tip, tcs, cip, ccs, ax, cs, ip, original
   488                              <2> 	lframe 0
   489                              <2> 	; above this original stack
   490                              <2> 	lpar word, in_tip		; transfer stub ip
   491                              <2> 	lpar word, in_tcs		; transfer stub cs
   492                              <2> 	lpar word, in_ax		; original ax, passed to relocated_
   493                              <2> 	lpar word, in_ds_out_ccs	; original ds, gets DOSCODE cs
   494 0000010A 5589E5              <2> 	lenter
   495                              <2> 	lequ ?frame_bp, in_bp_out_cip	; original bp, gets DOSCODE ip
   496 0000010D FF7606              <2> 	 push word [bp + ?in_tcs]
   497 00000110 FF7608              <2> 	 push word [bp + ?in_tip]
   498                              <2> 	lvar dword, out_tcsip		; transfer cs:ip (help debugging)
   499 00000113 874602              <2> 	xchg ax, word [bp + ?in_ds_out_ccs]
   500                              <2> 					; => DOSCODE
   501 00000116 8ED8                <2> 	mov ds, ax			; restore ds
   502                              <2>  assume ds:nothing
   503 00000118 B8[4A00]            <2> 	mov ax, relocated_relocatedentry
   504 0000011B 874600              <2> 	xchg ax, word [bp + ?in_bp_out_cip]
   505                              <2> 					; ax = original bp, ?out_cip -> entrypoint
   506                              <2> 	lleave ctx
   507                              <2> 
   508                              <2> 		; INP:	ss:(sp + 6) -> arbitrary stack of entrypoint
   509                              <2> 		;	word [ss:sp + 4] = entrypoint's ip,
   510                              <2> 		;	word [ss:sp + 2] = entrypoint's cs,
   511                              <2> 		;	word [ss:sp + 0] = original ax value
   512 0000011E CB                  <2> 	retf				; control flow goes back to transfer stub
   513                              <2> 					;  which has a retf to go to DOSCODE
    42                              <1> 
    43                              <1> 
    44                              <1> usesection DOSENTRY
    45                              <1> 
    46                              <1> extern conentry, prnentry, auxentry
    47                              <1> extern com1entry, com2entry, com3entry, com4entry
    48                              <1> extern lpt1entry, lpt2entry, lpt3entry, clockentry, blockentry
    49                              <1> 
    50 0000011F 00                  <1> 	even
    51                              <1>  global amis_sign
    52                              <1> amis_sign:
    53 00000120 65636D20<rep 5h>    <1> .ven:		fill 8, 32, db "ecm"
    54 00000128 6C444F5320<rep 4h>  <1> .prod:		fill 8, 32, db "lDOS"
    55 00000130 00                  <1> 		asciz
    56                              <1> 
    57                              <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16
    58                              <1>  %error Header must be above or equal device base
    59                              <1> %endif
    60 00000131 00                  <1> 	EVENB
    61                              <1> 	PUBLIC	CONHEADER
    62                              <1> CONHEADER LABEL   WORD			  ;HEADER FOR DEVICE "CON"
    63 00000132 [4400][ssss]        <1> 	dw	AUXDEV2 - DOSENTRYDEVICEBASE * 16, seg AUXDEV2 + DOSENTRYDEVICEBASE
    64 00000136 1380                <1> 	DW	10000000_00010011B ;CON IN AND CON OUT + SPECIAL
    65 00000138 [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
    66 0000013A [BC00]              <1> 	DW	conentry - DOSENTRYDEVICEBASE * 16
    67 0000013C 434F4E2020202020    <1> 	DB	'CON     '
    68                              <1> 
    69                              <1> 	EVENB
    70                              <1> 	PUBLIC	AUXDEV2
    71                              <1> AUXDEV2  LABEL	 WORD			 ;HEADER FOR DEVICE "AUX"
    72 00000144 [2001][ssss]        <1> 	dw	PRNDEV2 - DOSENTRYDEVICEBASE * 16, seg PRNDEV2 + DOSENTRYDEVICEBASE
    73 00000148 0080                <1> 	DW	10000000_00000000B
    74 0000014A [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
    75 0000014C [C600]              <1> 	DW	auxentry - DOSENTRYDEVICEBASE * 16
    76 0000014E 4155582020202020    <1> 	DB	'AUX     '
    77                              <1> 
    78                              <1> %assign num BASE700h + 0B0h - ($-$$)
    79                              <1> %warning num bytes in front of prior old13
    79          ******************  <1>  warning: 90 bytes in front of prior old13 [-w+user]
    80 00000156 00<rep 5Ah>         <1> 	org BASE700h + 0B0h
    81                              <1> 	EVENB
    82 000001B0 FFFFFFFF            <1> 	dd -1				; prior OLD13
    83                              <1> 
    84                              <1> %assign num BASE700h + 0B4h - ($-$$)
    85                              <1> %warning num bytes in front of orig13
    85          ******************  <1>  warning: 0 bytes in front of orig13 [-w+user]
    86                              <1> 	org BASE700h + 0B4h	; noted in EDR-DOS sources as being used by some applications
    87                              <1> 	  PUBLIC ORIG13
    88                              <1> ORIG13	label	DWORD
    89 000001B4 32310000            <1> 	db	'21',0,0                ;J.K. 11/8/86 This is my employee serial # !!!
    90                              <1> 
    91                              <1> 	EVENB
    92                              <1> 	PUBLIC	PTRSAV
    93 000001B8 00000000            <1> PTRSAV	DD	0
    94                              <1> 
    95                              <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16
    96                              <1>  %error Entrypoint must be above or equal device base
    97                              <1> %endif
    98 000001BC E841FFCB00          <1> conentry:	devicerelocate relocateddeventry, CONTBL
    99 000001C1 E83CFFCB04          <1> prnentry:	devicerelocate relocateddevprnentry, PRNTBL, 0, 0
   100 000001C6 E837FFCB0A          <1> auxentry:	devicerelocate relocateddeventry, AUXTBL, 0
   101 000001CB E832FFCB0A          <1> com1entry:	devicerelocate relocateddeventry, AUXTBL, 0
   102 000001D0 E82DFFCB10          <1> com2entry:	devicerelocate relocateddeventry, AUXTBL, 1
   103 000001D5 E828FFCB16          <1> com3entry:	devicerelocate relocateddeventry, AUXTBL, 2
   104 000001DA E823FFCB1C          <1> com4entry:	devicerelocate relocateddeventry, AUXTBL, 3
   105 000001DF E81EFFCB22          <1> lpt1entry:	devicerelocate relocateddevprnentry, PRNTBL, 0, 1
   106 000001E4 E819FFCB28          <1> lpt2entry:	devicerelocate relocateddevprnentry, PRNTBL, 1, 2
   107 000001E9 E814FFCB2E          <1> lpt3entry:	devicerelocate relocateddevprnentry, PRNTBL, 2, 3
   108 000001EE E80FFFCB34          <1> clockentry:	devicerelocate relocateddeventry, TIMTBL
   109 000001F3 E80AFFCB38          <1> blockentry:	devicerelocate relocateddeventry, DSKTBL
   110 000001F8 E805FFCB3C          <1> strategyentry:	devicerelocate relocatedstrategyentry
   111                              <1> 
   112                              <1> ;--------------------------------------------------------------
   113                              <1> ;
   114                              <1> ;	COMMAND JUMP TABLES
   115                              <1> ;
   116                              <1> ;	BEWARE - THESE TABLES OVERLAP SOMEWHAT! -C.P.
   117                              <1> ;
   118                              <1> 
   119                              <1> usesection BIOCODE
   120                              <1> 
   121 00000000 ??                  <1> 	ODD
   122                              <1> DSKTBL	LABEL	BYTE
   123 00000001 19                  <1> 	DB	(.last - .) / 2		; THIS IS THE SIZE OF THE TABLE YUK!!!!
   124 00000002 [0000]              <1> .:	DW	DSK$INIT
   125 00000004 [0000]              <1> 	DW	MEDIA$CHK
   126 00000006 [0000]              <1> 	DW	GET$BPB
   127 00000008 [4101]              <1> 	DW	CMDERR			;RS
   128 0000000A [0000]              <1> 	DW	DSK$READ
   129 0000000C [3A01]              <1> 	DW	BUS$EXIT
   130 0000000E [5D01]              <1> 	DW	EXIT
   131 00000010 [5D01]              <1> 	DW	EXIT
   132 00000012 [0000]              <1> 	DW	DSK$WRIT
   133 00000014 [0000]              <1> 	DW	DSK$WRITV
   134 00000016 [5D01]              <1> 	DW	EXIT			;ARR 2.41
   135 00000018 [5D01]              <1> 	DW	EXIT			;ARR 2.41
   136 0000001A [4101]              <1> 	DW	CMDERR			;RS
   137                              <1> 	; PUBLIC TABLE_PATCH
   138                              <1> ; TABLE_PATCH: equ $			   ;ARR 2.42
   139 0000001C [0000]              <1> 	DW	DSK$OPEN		;ARR 2.41
   140 0000001E [0000]              <1> 	DW	DSK$CLOSE		;ARR 2.41
   141 00000020 [0000]              <1> 	DW	DSK$REM 		;ARR 2.41
   142 00000022 [5D01]              <1> 	DW	EXIT
   143 00000024 [5D01]              <1> 	DW	EXIT
   144 00000026 [5D01]              <1> 	DW	EXIT
   145 00000028 [0000]              <1> 	DW	GENERIC$IOCTL		; KGS	3.20
   146 0000002A [5D01]              <1> 	DW	EXIT
   147 0000002C [5D01]              <1> 	DW	EXIT
   148 0000002E [5D01]              <1> 	DW	EXIT
   149 00000030 [0000]              <1> 	DW	IOCTL$GETOWN		; RS 3.20
   150 00000032 [0000]              <1> 	DW	IOCTL$SETOWN		; RE 3.20
   151                              <1>  extern msbio_check_gen_ioctl
   152 00000034 [0000]              <1> .last:	dw msbio_check_gen_ioctl
   153                              <1> 
   154 00000036 ??                  <1> 	ODD
   155                              <1> CONTBL	LABEL	BYTE
   156 00000037 0A                  <1> 	DB	(.last - .) / 2
   157 00000038 [5D01]              <1> .:	DW	EXIT			;INIT
   158 0000003A [5D01]              <1> 	DW	EXIT
   159 0000003C [5D01]              <1> 	DW	EXIT
   160 0000003E [4101]              <1> 	DW	CMDERR
   161 00000040 [0000]              <1> 	DW	CON$READ
   162 00000042 [0000]              <1> 	DW	CON$RDND
   163 00000044 [5D01]              <1> 	DW	EXIT
   164 00000046 [0000]              <1> 	DW	CON$FLSH
   165 00000048 [0000]              <1> 	DW	CON$WRIT
   166 0000004A [0000]              <1> 	DW	CON$WRIT
   167 0000004C [5D01]              <1> .last:	DW	EXIT			;ARR 2.41
   168                              <1> 
   169                              <1> ;	DW	CMDERR			;J.K. 4/29/86 for CON$GENIOCTL support
   170                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   171                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   172                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   173                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   174                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   175                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   176                              <1> ;	DW	CMDERR			;J.K. 4/29/86
   177                              <1> ;	DW	CON$GENIOCTL		;J.K. 4/29/86
   178                              <1> 
   179 0000004E ??                  <1> 	ODD
   180                              <1> AUXTBL	LABEL	BYTE
   181 0000004F 0A                  <1> 	DB	(.last - .) / 2
   182 00000050 [5D01]              <1> .:	DW	EXIT			;INIT
   183 00000052 [5D01]              <1> 	DW	EXIT
   184 00000054 [5D01]              <1> 	DW	EXIT
   185 00000056 [4101]              <1> 	DW	CMDERR
   186 00000058 [0000]              <1> 	DW	AUX$READ
   187 0000005A [0000]              <1> 	DW	AUX$RDND
   188 0000005C [5D01]              <1> 	DW	EXIT
   189 0000005E [0000]              <1> 	DW	AUX$FLSH
   190 00000060 [0000]              <1> 	DW	AUX$WRIT
   191 00000062 [0000]              <1> 	DW	AUX$WRIT
   192 00000064 [0000]              <1> .last:	DW	AUX$WRST
   193                              <1> 
   194 00000066 ??                  <1> 	ODD
   195                              <1> TIMTBL	LABEL	BYTE
   196 00000067 09                  <1> 	DB	(.last - .) / 2
   197 00000068 [5D01]              <1> .:	DW	EXIT			;INIT
   198 0000006A [5D01]              <1> 	DW	EXIT
   199 0000006C [5D01]              <1> 	DW	EXIT
   200 0000006E [4101]              <1> 	DW	CMDERR
   201 00000070 [0000]              <1> 	DW	TIM$READ
   202 00000072 [3A01]              <1> 	DW	BUS$EXIT
   203 00000074 [5D01]              <1> 	DW	EXIT
   204 00000076 [5D01]              <1> 	DW	EXIT
   205 00000078 [0000]              <1> 	DW	TIM$WRIT
   206 0000007A [0000]              <1> .last:	DW	TIM$WRIT
   207                              <1> 
   208 0000007C ??                  <1> 	ODD
   209                              <1> PRNTBL	LABEL	BYTE
   210 0000007D 19                  <1> 	DB	(.last - .) / 2
   211 0000007E [5D01]              <1> .:	DW	EXIT			;INIT
   212 00000080 [5D01]              <1> 	DW	EXIT
   213 00000082 [5D01]              <1> 	DW	EXIT
   214 00000084 [4101]              <1> 	DW	CMDERR
   215 00000086 [5101]              <1> 	DW	EXIT$ZER		;INDICATE ZERO CHARS READ
   216 00000088 [3A01]              <1> 	DW	BUS$EXIT
   217 0000008A [5D01]              <1> 	DW	EXIT
   218 0000008C [5D01]              <1> 	DW	EXIT
   219 0000008E [0000]              <1> 	DW	PRN$WRIT
   220 00000090 [0000]              <1> 	DW	PRN$WRIT
   221 00000092 [0000]              <1> 	DW	PRN$STAT
   222 00000094 [5D01]              <1> 	DW	EXIT
   223 00000096 [5D01]              <1> 	DW	EXIT			;ARR 2.41
   224 00000098 [5D01]              <1> 	DW	EXIT			;ARR 2.41
   225 0000009A [5D01]              <1> 	DW	EXIT			;ARR 2.41
   226 0000009C [5D01]              <1> 	DW	EXIT			;ARR 2.41
   227 0000009E [0000]              <1> 	DW	PRN$TILBUSY
   228 000000A0 [5D01]              <1> 	DW	EXIT			;RS 3.20
   229 000000A2 [5D01]              <1> 	DW	EXIT			;RS 3.20
   230 000000A4 [0000]              <1> 	DW	PRN$GENIOCTL		;RS 3.20
   231 000000A6 [5D01]              <1> 	DW	EXIT			;RS 3.20
   232 000000A8 [5D01]              <1> 	DW	EXIT			;RS 3.20
   233 000000AA [5D01]              <1> 	DW	EXIT			;RS 3.20
   234 000000AC [5D01]              <1> 	DW	EXIT			;RS 3.20
   235 000000AE [5D01]              <1> 	DW	EXIT			;RS 3.20
   236                              <1>  extern prn_check_gen_ioctl
   237 000000B0 [0000]              <1> .last:	dw	prn_check_gen_ioctl
   238                              <1> 
   239                              <1> 
   240                              <1> usesection DOSBIODATA
   241                              <1> 
   242                              <1> 	PUBLIC STEP_DRV
   243 00000000 FE                  <1> STEP_DRV	DB     -2		; ARR 2.20 LAST DRIVE ACCESSED
   244                              <1> 
   245                              <1> 	PUBLIC PHYS_DRV
   246 00000001 00                  <1> PHYS_DRV	DB	0		; USED BY SETDRIVE FOR GETTING BDS FOR
   247                              <1> 					; LOGICAL DRIVE, OR PHYSICAL DRIVE.
   248                              <1> 	PUBLIC FHAVE96
   249 00000002 00                  <1> FHAVE96 	DB	0		; FLAG TO INDICATE PRESENCE OF
   250                              <1> 					;   96TPI SUPPORT
   251                              <1> 	PUBLIC SINGLE
   252 00000003 00                  <1> SINGLE		DB	0		; USED TO DETECT SINGLE DRIVE SYSTEMS
   253                              <1> 
   254                              <1> 	PUBLIC FHAVEK09
   255 00000004 00                  <1> FHAVEK09	DB	0		;INDICATES IF THIS IS A K09 OR NOT
   256                              <1> 					; USED BY CONSOLE DRIVER.
   257                              <1> 	PUBLIC NEW_ROM
   258 00000005 00                  <1> NEW_ROM 	DB	0		;SET TO 1 IF WE HAVE A ROM THAT CAN
   259                              <1> 					; HANDLE STRANGE MEDIA LAYOUTS.
   260                              <1> 	PUBLIC FSETOWNER
   261 00000006 ??                  <1> FSETOWNER	DB	?		;=1 IF WE ARE SETTING THE OWNER OF A
   262                              <1> 					;DRIVE. (EXAMINED BY CHECKSINGLE).
   263                              <1> 
   264                              <1> 
   265                              <1> usesection DOSENTRY
   266                              <1> 
   267                              <1> 	public	Secrete_Code
   268 000001FD 6B6A                <1> Secrete_Code	dw	'kj'            ;J.K. 11/7/86 Secrete code for DOS 3.30 IBMBIO.
   269                              <1> 
   270                              <1> usesection DOSBIODATA
   271                              <1> 
   272                              <1> 	PUBLIC	AUXBUF
   273 00000007 00000000            <1> AUXBUF	DB	0,0,0,0   ;SET OF 1 BYTE BUFFERS FOR COM 1,2,3, AND 4
   274                              <1> 
   275 0000000B 00                  <1> 	EVENB
   276                              <1> 	PUBLIC PREVOPER,NUMBER_OF_SEC
   277 0000000C ????                <1> PREVOPER	DW	?	; HOLDS INT 13 REQUEST (I.E. REGISTER AX).
   278 0000000E ??                  <1> NUMBER_OF_SEC	DB	?	; HOLDS NUMBER OF SECTORS TO READ ON AN ECC ERROR
   279                              <1> 
   280                              <1> 
   281                              <1> usesection DOSENTRY
   282                              <1> 
   283                              <1> 	%imacro irtentry 1-2.nolist
   284                              <1> db %1
   285                              <1> %2 dd 0
   286                              <1> 	%endmacro
   287                              <1> 
   288                              <1> 
   289                              <1> %assign num BASE700h + 256-($-$$)
   290                              <1> %warning num bytes in front of IRT
   290          ******************  <1>  warning: 1 bytes in front of IRT [-w+user]
   291                              <1> 
   292 000001FF 00                  <1> 	_fill BASE700h + 256, 0, START$	; fixed address: 60h:200h == 70h:100h
   293                              <1> InterruptRestorationTable:
   294                              <1>  global InterruptRestorationTable
   295 00000200 1000000000          <1> 	irtentry 10h
   296 00000205 1300000000          <1> 	irtentry 13h, OLD13:
   297                              <1>  PUBLIC OLD13
   298 0000020A 1500000000          <1> 	irtentry 15h
   299 0000020F 1900000000          <1> 	irtentry 19h, ORIG19:
   300                              <1>  PUBLIC	ORIG19
   301 00000214 1B00000000          <1> 	irtentry 1Bh
   302                              <1> 		; Above interrupts are in the order MS-DOS 6.x saves them
   303                              <1> 		;  (FDEMM386?/Jemm expects Int19 within the first five entries)
   304 00000219 0000000000          <1> 	irtentry 00h
   305 0000021E FF                  <1> 	db -1
   306                              <1> 
   307                              <1> 
   308                              <1> usesection DOSENTRY
   309                              <1> 
   310                              <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16
   311                              <1>  %error Header must be above or equal device base
   312                              <1> %endif
   313 0000021F 00                  <1> 	EVENB
   314                              <1> 	PUBLIC	PRNDEV2
   315                              <1> PRNDEV2  LABEL	 WORD			 ;HEADER FOR DEVICE "PRN"
   316 00000220 [3201][ssss]        <1> 	dw	TIMDEV - DOSENTRYDEVICEBASE * 16, seg TIMDEV + DOSENTRYDEVICEBASE
   317 00000224 40A0                <1> 	DW	CHARDEV + OUTTILBUSY + DEV320
   318 00000226 [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   319 00000228 [C100]              <1> 	DW	prnentry - DOSENTRYDEVICEBASE * 16
   320 0000022A 50524E2020202020    <1> 	DB	'PRN     '
   321                              <1> 
   322                              <1> 	EVENB
   323                              <1> 	PUBLIC TIMDEV
   324                              <1> TIMDEV	LABEL	WORD
   325 00000232 [4401][ssss]        <1> 	dw	DSKDEV - DOSENTRYDEVICEBASE * 16, seg DSKDEV + DOSENTRYDEVICEBASE
   326 00000236 0880                <1> 	DW	10000000_00001000B
   327 00000238 [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   328 0000023A [EE00]              <1> 	DW	clockentry - DOSENTRYDEVICEBASE * 16
   329 0000023C 434C4F434B242020    <1> 	DB	'CLOCK$  '
   330                              <1> 
   331                              <1> 	EVENB
   332                              <1> 	PUBLIC	DSKDEV
   333                              <1> DSKDEV	LABEL	WORD
   334 00000244 [5401][ssss]        <1> 	dw	COM1DEV - DOSENTRYDEVICEBASE * 16, seg COM1DEV + DOSENTRYDEVICEBASE
   335 00000248 4208                <1> 	DW	00001000_01000010B	;J.K.I1. 32 bit sector calculation
   336 0000024A [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   337 0000024C [F300]              <1> 	DW	blockentry - DOSENTRYDEVICEBASE * 16
   338 0000024E 04                  <1> DRVMAX	DB	4
   339                              <1> 	PUBLIC DRVMAX
   340                              <1> 
   341                              <1> 
   342                              <1> usesection SYSINITTRAIL
   343                              <1> 
   344                              <1> 	  PUBLIC HARDNUM
   345 00000000 63                  <1> HARDNUM 	DB	99			;LOGICAL DRIVE NUMBER OF FIRST HARDFILE
   346                              <1> 
   347                              <1> 
   348                              <1> usesection DOSBIODATA
   349                              <1> 
   350 0000000F 00                  <1> 		EVENB
   351                              <1> 	PUBLIC WRTVERIFY
   352                              <1> WRTVERIFY LABEL WORD
   353                              <1> 	PUBLIC RFLAG
   354                              <1> ROMREAD equ ROMRead	; NASM port equate
   355 00000010 02                  <1> RFLAG		DB	ROMREAD 		;2 FOR READ, 3 FOR WRITE
   356 00000011 00                  <1> VERIFY		DB	0			;1 IF VERIFY AFTER WRITE
   357                              <1> 	PUBLIC SECCNT
   358 00000012 0000                <1> SECCNT		DW	0
   359                              <1> 	PUBLIC MOTORSTARTUP,SETTLECURRENT,SETTLESLOW
   360 00000014 ??                  <1> MOTORSTARTUP	DB  ?			; VALUE FROM TABLE
   361 00000015 ??                  <1> SETTLECURRENT	DB  ?			; VALUE FROM TABLE
   362 00000016 ??                  <1> SETTLESLOW	DB  ?			; SLOW SETTLE VALUE
   363                              <1> 
   364 00000017 ??                  <1> NEXTSPEED	DB  ?			; VALUE OF SPEED TO BE USED
   365                              <1> save_head_sttl equ Save_head_sttl	; NASM port label
   366                              <1> 	public	save_head_sttl
   367 00000018 ??                  <1> Save_head_sttl	db  ?		;used by READ_SECTOR routine
   368                              <1> 
   369                              <1> 	    PUBLIC EOT
   370 00000019 09                  <1> EOT		DB  9
   371                              <1> 
   372                              <1> 		EVENB
   373                              <1> 	PUBLIC DPT
   374 0000001A ????????            <1> DPT		DD  ?
   375                              <1> 
   376                              <1> ;KEEP THE NEXT TWO ITEMS CONTIGUOUS - SEE IOCTL_BLOCK FOR REASON
   377                              <1> 	PUBLIC CURSEC,CURHD,CURTRK,SPSAV
   378 0000001E 00                  <1> CURSEC	DB	0			;CURRENT SECTOR
   379 0000001F 00                  <1> CURHD	DB	0			;CURRENT HEAD
   380 00000020 0000                <1> CURTRK	DW	0			;CURRENT TRACK
   381 00000022 0000                <1> SPSAV	DW	0			;SAVE THE STACK POINTER
   382                              <1> 
   383                              <1> ; THE FOLLOWING ARE USED FOR IOCTL FUNCTION CALLS
   384                              <1> 	PUBLIC FORMT_EOT,HDNUM,TRKNUM,GAP_PATCH
   385 00000024 08                  <1> FORMT_EOT	DB	8		    ; EOT USED FOR FORMAT
   386 00000025 00                  <1> HDNUM		DB	0		    ; HEAD NUMBER
   387 00000026 0000                <1> TRKNUM		DW	0		    ; TRACK BEING MANIPULATED
   388 00000028 50                  <1> GAP_PATCH	DB	50H		    ; FORMAT GAP PATCHED INTO DPT
   389                              <1> 
   390                              <1> ;DISK ERRORS RETURNED FROM THE IBM ROM
   391                              <1> 	PUBLIC ERRIN
   392                              <1> ERRIN	LABEL	BYTE
   393 00000029 CC                  <1> 	db	0cch			;AN002; Write Fault error
   394 0000002A 80                  <1> 	DB	80H			;NO RESPONSE
   395 0000002B 40                  <1> 	DB	40H			;SEEK FAILURE
   396 0000002C 10                  <1> 	DB	10H			;BAD CRC
   397 0000002D 08                  <1> 	DB	8			;DMA OVERRUN
   398 0000002E 06                  <1> 	DB	6			; MEDIA CHANGE
   399 0000002F 04                  <1> 	DB	4			;SECTOR NOT FOUND
   400 00000030 03                  <1> 	DB	3			;WRITE ATTEMPT TO WRITE-PROTECT DISK
   401                              <1> 	PUBLIC LSTERR
   402 00000031 00                  <1> LSTERR	DB	0			;ALL OTHER ERRORS
   403                              <1> 
   404                              <1> ;RETURNED ERROR CODES CORRESPONDING TO ABOVE
   405                              <1> 	PUBLIC ERROUT
   406                              <1> ERROUT	LABEL	BYTE
   407 00000032 0A                  <1> 	db	10			;AN002; Write Fault error
   408 00000033 02                  <1> 	DB	2			;NO RESPONSE
   409 00000034 06                  <1> 	DB	6			;SEEK FAILURE
   410 00000035 04                  <1> 	DB	4			;BAD CRC
   411 00000036 04                  <1> 	DB	4			;DMA OVERRUN
   412 00000037 0F                  <1> 	DB	15			; INVALID MEDIA CHANGE
   413 00000038 08                  <1> 	DB	8			;SECTOR NOT FOUND
   414 00000039 00                  <1> 	DB	0			;WRITE ATTEMPT ON WRITE-PROTECT DISK
   415 0000003A 0C                  <1> 	DB	12			;GENERAL ERROR
   416                              <1> 	PUBLIC NUMERR
   417                              <1> NUMERR	equ	ERROUT-ERRIN
   418                              <1> 
   419                              <1> 
   420                              <1> ;*********************************************************************
   421                              <1> ;	"BDS" CONTAINS INFORMATION FOR EACH DRIVE IN THE SYSTEM.
   422                              <1> ;	VARIOUS VALUES ARE PATCHED WHENEVER ACTIONS ARE PERFORMED.
   423                              <1> ;	SECTORS/ALLOC. UNIT IN BPB INITIALLY SET TO -1 TO SIGNIFY THAT
   424                              <1> ;	THE BPB HAS NOT BEEN FILLED. LINK ALSO SET TO -1 TO SIGNIFY END
   425                              <1> ;	OF LIST. # OF CYLINDERS IN MAXPARMS INITIALIZED TO -1 TO INDICATE
   426                              <1> ;	THAT THE PARAMETERS HAVE NOT BEEN SET.
   427                              <1> ;
   428                              <1> 
   429                              <1> BPBTYPE STRUC
   430 00000000 ??                  <1> SPF	DB	?
   431 00000001 ??                  <1> SPT	DB	?
   432 00000002 ??                  <1> CDIRE	DB	?
   433 00000003 ????                <1> CSEC	DW	?
   434 00000005 ??                  <1> SPA	DB	?
   435 00000006 ??                  <1> CHEAD	DB	?
   436                              <1> BPBTYPE ENDS
   437                              <1> 	PUBLIC SM92
   438                              <1> SM92:
   439                              <1> BPBTYPE_size equ BPBTYPE_struc_size	; NASM port equate
   440                              <1> istruc BPBTYPE
   441                              <1> at SPF
   442 0000003B 03                  <1> 	db 3
   443                              <1> at SPT
   444 0000003C 09                  <1> 	db 9
   445                              <1> at CDIRE
   446 0000003D 70                  <1> 	db 70H
   447                              <1> at CSEC
   448 0000003E A005                <1> 	dw 2*9*80
   449                              <1> at SPA
   450 00000040 02                  <1> 	db 2
   451                              <1> at CHEAD
   452 00000041 02                  <1> 	db 2
   453                              <1> iend
   454                              <1> 
   455                              <1> 
   456                              <1> 	usesection DOSENTRY
   457                              <1> 
   458                              <1> transfer_orig13:
   459                              <1>  assume ds:nothing, es:nothing, ss:nothing
   460 0000024F 2EFF2E[B401]        <1> 	jmp far [cs:ORIG13]		; cs reference in DOSENTRY
   461                              <1> 
   462                              <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16
   463                              <1>  %error Header must be above or equal device base
   464                              <1> %endif
   465                              <1> 	EVENB
   466                              <1> 	PUBLIC COM1DEV
   467                              <1> COM1DEV LABEL	WORD
   468 00000254 [6E01][ssss]        <1> 	dw	LPT1DEV - DOSENTRYDEVICEBASE * 16, seg LPT1DEV + DOSENTRYDEVICEBASE
   469 00000258 0080                <1> 	DW	10000000_00000000B
   470 0000025A [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   471 0000025C [CB00]              <1> 	DW	com1entry - DOSENTRYDEVICEBASE * 16
   472 0000025E 434F4D3120202020    <1> 	DB	'COM1    '
   473                              <1> 
   474 00000266 ??                  <1> 	odd
   475                              <1>  global transfer_real13
   476                              <1> transfer_real13:
   477                              <1>  assume ds:nothing, es:nothing, ss:nothing
   478 00000267 EA                  <1> 	db 0EAh
   479                              <1> 	PUBLIC REAL13
   480 00000268 ????????            <1> REAL13	DD  ?
   481                              <1> 
   482                              <1> %assign num BASE700h + 16Ch - ($-$$)
   483                              <1> %warning num bytes in front of AUXNUM
   483          ******************  <1>  warning: 0 bytes in front of AUXNUM [-w+user]
   484                              <1> 	org BASE700h + 16Ch	; noted in EDR-DOS sources as a fixed offset
   485                              <1> 	EVENB
   486                              <1> ; WARNING!!!  THESE ARE ADDRESSED TOGETHER IN GETDX
   487 0000026C 00                  <1> AUXNUM	DB	0			;WHICH AUX DEVICE WAS REQUESTED
   488 0000026D 00                  <1> 	DB	0
   489                              <1> 
   490                              <1> 
   491                              <1> usesection DOSBIODATA
   492                              <1> 
   493                              <1> 		EVENB
   494                              <1> 	PUBLIC DAYCNT
   495 00000042 0000                <1> DAYCNT	DW	0
   496                              <1> 
   497                              <1> 
   498                              <1> usesection DOSENTRY
   499                              <1> 
   500                              <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16
   501                              <1>  %error Header must be above or equal device base
   502                              <1> %endif
   503                              <1> 	EVENB
   504                              <1> 	PUBLIC LPT1DEV
   505                              <1> LPT1DEV LABEL	WORD
   506 0000026E [8001][ssss]        <1> 	dw	LPT2DEV - DOSENTRYDEVICEBASE * 16, seg LPT2DEV + DOSENTRYDEVICEBASE
   507 00000272 40A0                <1> 	DW	CHARDEV + OUTTILBUSY + DEV320
   508 00000274 [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   509 00000276 [DF00]              <1> 	DW	lpt1entry - DOSENTRYDEVICEBASE * 16
   510 00000278 4C50543120202020    <1> 	DB	'LPT1    '
   511                              <1> 
   512                              <1> 	EVENB
   513                              <1> 	PUBLIC	LPT2DEV
   514                              <1> LPT2DEV LABEL	WORD
   515 00000280 [9201][ssss]        <1> 	dw	LPT3DEV - DOSENTRYDEVICEBASE * 16, seg LPT3DEV + DOSENTRYDEVICEBASE
   516 00000284 40A0                <1> 	DW	CHARDEV + OUTTILBUSY + DEV320
   517 00000286 [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   518 00000288 [E400]              <1> 	DW	lpt2entry - DOSENTRYDEVICEBASE * 16
   519 0000028A 4C50543220202020    <1> 	DB	'LPT2    '
   520                              <1> 
   521                              <1> 	EVENB
   522                              <1> 	PUBLIC	LPT3DEV
   523                              <1> LPT3DEV LABEL	WORD
   524 00000292 [A401][ssss]        <1> 	dw	COM2DEV - DOSENTRYDEVICEBASE * 16, seg COM2DEV + DOSENTRYDEVICEBASE
   525 00000296 40A0                <1> 	DW	CHARDEV + OUTTILBUSY + DEV320
   526 00000298 [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   527 0000029A [E900]              <1> 	DW	lpt3entry - DOSENTRYDEVICEBASE * 16
   528 0000029C 4C50543320202020    <1> 	DB	'LPT3    '
   529                              <1> 
   530                              <1> 
   531                              <1> 	EVENB
   532                              <1> 	PUBLIC	COM2DEV
   533                              <1> COM2DEV LABEL	WORD
   534 000002A4 [B601][ssss]        <1> 	dw	COM3DEV - DOSENTRYDEVICEBASE * 16, seg COM3DEV + DOSENTRYDEVICEBASE
   535 000002A8 0080                <1> 	DW	10000000_00000000B
   536 000002AA [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   537 000002AC [D000]              <1> 	DW	com2entry - DOSENTRYDEVICEBASE * 16
   538 000002AE 434F4D3220202020    <1> 	DB	'COM2    '
   539                              <1> 
   540                              <1> 	EVENB
   541                              <1> 	PUBLIC	COM3DEV
   542                              <1> COM3DEV LABEL	WORD			;EDK
   543 000002B6 [C801][ssss]        <1> 	dw	COM4DEV - DOSENTRYDEVICEBASE * 16, seg COM4DEV + DOSENTRYDEVICEBASE
   544 000002BA 0080                <1> 	DW	10000000_00000000B
   545 000002BC [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   546 000002BE [D500]              <1> 	DW	com3entry - DOSENTRYDEVICEBASE * 16
   547 000002C0 434F4D3320202020    <1> 	DB	'COM3    '
   548                              <1> 
   549                              <1> 	EVENB
   550                              <1> 	PUBLIC	COM4DEV
   551                              <1> COM4DEV LABEL	WORD			;EDK
   552 000002C8 FFFF[ssss]          <1> 	DW	-1,DOSENTRY + DOSENTRYDEVICEBASE
   553 000002CC 0080                <1> 	DW	10000000_00000000B
   554 000002CE [F800]              <1> 	DW	strategyentry - DOSENTRYDEVICEBASE * 16
   555 000002D0 [DA00]              <1> 	DW	com4entry - DOSENTRYDEVICEBASE * 16
   556 000002D2 434F4D3420202020    <1> 	DB	'COM4    '
   557                              <1> 
   558                              <1> 
   559                              <1> usesection DOSBIODATA
   560                              <1> 
   561                              <1> 	EVENB
   562                              <1> 	PUBLIC START_BDS
   563                              <1> START_BDS LABEL WORD
   564 00000044 FFFFFFFF            <1>        dw      -1,-1			; START OF BDS LINKED LIST.
   565                              <1> 
   566                              <1> 	PUBLIC ACCESSCOUNT
   567 00000048 00                  <1> ACCESSCOUNT	DB	0		; NUMBER OF TIMES MEDIA CHECK CALLED
   568                              <1> 	PUBLIC TIM_DRV
   569 00000049 FF                  <1> TIM_DRV 	DB	-1		; TIME WHEN LAST DISK I/O PERFORMED
   570                              <1> 	PUBLIC	MEDBYT
   571 0000004A ??                  <1> MEDBYT		DB	?
   572                              <1> 
   573                              <1> 		; end of data that must be after 16Ch.
   574                              <1> 
   575                              <1> ;-------------------------------------------------------------
   576                              <1> 
   577                              <1> 
   578                              <1> usesection DOSENTRY
   579                              <1> 
   580                              <1>  global i2D, i2D.amisnumber, amis_intlist
   581                              <1> 				; used with DOSENTRY adjust
   582 000002DA EB10[1400][ssss]4B- <1> iispentry i2D, 0, i2D, 1,   entry_iret + DOSENTRYADJUSTOFFSET, DOSENTRY - DOSENTRYADJUSTSEGMENT
   582 000002E1 4200EB1400<rep 7h>  <1>
   584 000002EC 80FC00              <1> 	cmp ah, 0
   585                              <1> .amisnumber: equ $ - 1		; imm8 data of cmp instruction
   586 000002EF 7405                <1> 	je .ours
   587 000002F1 2EFF2E[DC02]        <1> 	jmp far [cs:.next + DOSENTRYADJUSTOFFSET]
   588                              <1> .ours:
   589                              <1>  %if _RELOCATEDOSCODE
   590                              <1> 	relocate relocatedi2D
   591                              <1> .hwreset equ $ - 2		; ! use the trampoline retf for hwreset
   592                              <1>  %else
   593                              <1>  extern relocatedi2D
   594 000002F6 E9(0000)            <1> 	jmp relocatedi2D
   595                              <1> .hwreset:
   596 000002F9 CB                  <1> 	retf
   597                              <1>  %endif
   598                              <1> amis_intlist:
   599 000002FA 2D                  <1> 	db 2Dh
   600 000002FB [DA02]              <1> 	dw i2D + DOSENTRYADJUSTOFFSET
   601                              <1> 
   602                              <1> 
   603                              <1> 	PUBLIC	incompatible_ALTAH
   604 000002FD 00                  <1> incompatible_ALTAH	DB	0	;SPECIAL KEY HANDLING
   605                              <1> 
   606                              <1> 
   607                              <1> ;   READ IN BOOT SECTOR HERE,  READ DONE IN READBOOT.
   608                              <1> ;   ALSO READ SECTOR FOR DMA CHECK FOR HARD DISK.
   609                              <1> 
   610                              <1> ;J.K. The buffer for a disk sector is going to be at a double word boundary
   611                              <1> ;     for 80386 machine.
   612                              <1> 
   613 000002FE 00<rep 2h>          <1> 	align 16, db 0		; ! paragraph alignment needed for msinit.nas
   614                              <1> DISKSECTOR equ DiskSector	; NASM port label
   615                              <1>        PUBLIC DISKSECTOR
   616 00000300 <res Bh>            <1> DiskSector		DB	11 DUP(?) ; TAKE CARE OF 3 JUMP BYTES PLUS OEM NAME.
   617                              <1> BPB_IN_SECTOR equ Bpb_In_Sector	; NASM port label
   618                              <1> 	PUBLIC BPB_IN_SECTOR
   619 0000030B ????                <1> Bpb_In_Sector		DW	?
   620                              <1> SECPERCLUSINSECTOR equ SecPerClusInSector	; NASM port label
   621                              <1> 	PUBLIC SECPERCLUSINSECTOR
   622 0000030D ??                  <1> SecPerClusInSector	DB	?
   623 0000030E ????                <1> 			DW	?
   624                              <1> 	public NumberOfFats
   625 00000310 ??                  <1> NumberOfFats		DB	?
   626 00000311 ????                <1> 			DW	?
   627 00000313 ????                <1> 			DW	?
   628                              <1> MEDIABYTE equ MediaByte	; NASM port label
   629                              <1> 	PUBLIC MEDIABYTE
   630 00000315 ??                  <1> MediaByte		DB	?
   631 00000316 ????                <1> 			DW	?
   632 00000318 ????                <1> 			DW	?
   633 0000031A ????                <1> 			DW	?
   634 0000031C ????                <1> 			DW	?
   635 0000031E ????                <1> 			DW	?	;AN000; Extended Hidden sector (high)
   636 00000320 ????                <1> 			DW	?	;AN000; Extended Total sector (low)
   637 00000322 ????                <1> 			DW	?	;AN000; Extended Total sector (high)
   638 00000324 ??                  <1> 			db	?	;AN003; PHYDRV in boot record.
   639 00000325 ??                  <1> 			db	?	;AN003; CURRENT HEAD in boot record.
   640                              <1> 	public Ext_Boot_Sig
   641 00000326 ??                  <1> Ext_Boot_Sig		DB	?	;AN000; Extended Boot record sig. (=90h)
   642                              <1> 	public Boot_Serial_L
   643 00000327 ????                <1> Boot_Serial_L		DW	?	;AN000; Boot volume serial number (Low)
   644                              <1> 	public Boot_Serial_H
   645 00000329 ????                <1> Boot_Serial_H		DW	?	;AN000; Boot volume serial number (High)
   646                              <1> 	public Boot_Volume_Label
   647 0000032B 202020202020202020- <1> Boot_Volume_Label	DB	11 dup (' ') ;AN000; Volume label
   647 00000334 2020                <1>
   648                              <1> 	public Boot_System_ID
   649 00000336 2020202020202020    <1> Boot_System_ID		DB	8  dup (' ') ;AN000; File system Id.
   650 0000033E 00<rep 1C2h>        <1> 		times	512-($-DiskSector) db 0
   651                              <1> 
   652                              <1> 
   653                              <1> 	usesection DOSBIODATA
   654                              <1> 
   655                              <1> ;;Rev 3.30 Modification ------------------------------------------------
   656                              <1> ; variables for real time clock setting
   657                              <1> 	public	HaveCMOSClock
   658 0000004B 00                  <1> HaveCMOSClock	db	0	;set by MSINIT.
   659                              <1> 	public	base_century
   660 0000004C 13                  <1> base_century	db	19
   661                              <1> 	public	base_year
   662 0000004D 50                  <1> base_year	db	80
   663                              <1> 	public	month_tab
   664 0000004E 1F1C1F1E1F1E1F1F1E- <1> month_tab	db	31,28,31,30,31,30,31,31,30,31,30,31
   664 00000057 1F1E1F              <1>
   665                              <1> 
   666                              <1> ;;End of Modification ------------------------------------------------
   667                              <1> 
   668                              <1> 
   669                              <1> 	usesection DOSBIODATA
   670                              <1> 
   671 0000005A 00                  <1> Set_ID_Flag	db	0	;AN000; If 1, GETBP routine will set the
   672                              <1> 				;Vol_Serial and FileSys_ID in BDS table
   673                              <1> 				;from the media Boot record, if it is > DOS 4.00
   674                              <1> 				;formatted one. Then Set_ID_flag will be set to 2
   675                              <1> 				;to signal that volume_label is set from the extended
   676                              <1> 				;boot record and do not set it from the root
   677                              <1> 				;directory as done in SET_VOLUME_ID routine.
   678                              <1> 				;For the old version, Vol_Serial
   679                              <1> 				;will be set to -1, and FileSys_ID will be set
   680                              <1> 				;to "FAT12   " if it is a floppy.
   681                              <1> 
   682 0000005B 00                  <1> 	evenb
   683                              <1> 	public lbapacket
   684                              <1> lbapacket:
   685                              <1> LBAPACKETSTRUC_size equ LBAPACKETSTRUC_struc_size	; NASM port equate
   686                              <1> istruc LBAPACKETSTRUC
   687                              <1> at lpSize
   688 0000005C 1000                <1> 	dw 16
   689 0000005E 00<rep Eh>          <1> iend
   690                              <1> 
   691                              <1> 	public	Temp_H
   692 0000006C 0000                <1> Temp_H		dw	0		;AN000; Temporary for 32 bit calculation.
   693                              <1> 
   694                              <1> 	public	Start_Sec_H
   695 0000006E 0000                <1> Start_Sec_H	dw	0		;AN000; Starting sector number high word.
   696                              <1> 					;Used as an input to DISKIO subroutine.
   697 00000070 0000                <1> Saved_Word	dw	0		;AN000;  Tempory saving place for a word.
   698                              <1> 
   699                              <1> ;---------------------------------------
   700                              <1> ;J.K. 6/29/87 For Multi-track
   701                              <1> 	public	MulTrk_Flag
   702 00000072 0000                <1> MulTrk_Flag	dw	0		;AN001;
   703                              <1> ;J.K. 6/29/87 End of Multi-track definition.
   704                              <1> ;---------------------------------------------------------------------
   705                              <1> 	public EC35_Flag
   706 00000074 00                  <1> EC35_Flag	db	0		; flags for electrically compatible 3.5 inch disk drives (mrw 4/88)
   707                              <1> ;---------------------------------------------------------------------
   708 00000075 00                  <1> 	evenb
   709 00000076 0000                <1> VRetry_Cnt	dw	0		;AN003;
   710 00000078 0000                <1> Soft_ECC_Cnt	dw	0		;AN003;
   711                              <1> 
   712                              <1> ;---------------------------------------------------------------------
   713 0000007A 00                  <1> MultiTrk_Format_Flag	db	0	;AN007;Testing. If 1, then Multi track format request
   714                              <1> ;---------------------------------------------------------------------
   715                              <1> ;
   716                              <1> ; IF ID IS F9, HAVE A 96TPI DISK ELSE
   717                              <1> ; IF BIT 2 IS 0 THEN MEDIA IS NOT REMOVABLE AND COULD NOT HAVE CHANGED
   718                              <1> ;  OTHERWISE IF WITHIN 2 SECS OF LAST DISK OPERATION MEDIA COULD NOT
   719                              <1> ;    HAVE CHANGED, OTHERWISE DONT KNOW IF MEDIA HAS CHANGED
   720                              <1> ;
   721                              <1> 
   722                              <1> 
   723                              <1> 	usesection DOSBIODATA
   724                              <1> 
   725 0000007B 00                  <1> 	align 2, db 0
   726 0000007C ????                <1> Prev_DX			DW ?
   727                              <1> 
   728                              <1> 
   729                              <1> 	global Set_ID_Flag, Saved_Word
   730                              <1> 	global VRetry_Cnt, Soft_ECC_Cnt, MultiTrk_Format_Flag
   731                              <1> 	global Prev_DX, dosbiodata_temp_ds
   732                              <1> 	global transfer_orig13
   733                              <1> 	global transfer_next2F_13
   734                              <1> 
   735                              <1> 
   736                              <1> 	usesection DOSBIODATA
   737                              <1> 
   738                              <1> 	PATHSTART 005,DISK
   122                              <2>  %IF PATHGEN
   123                              <2>  PUBLIC %2%1S,%2%1E
   124                              <2>  %2%1S LABEL BYTE
   125                              <2>  %ENDIF
   739                              <1> 	EVENB
   740                              <1> Model_Byte equ MODEL_BYTE	; NASM port label
   741                              <1> 	public	Model_Byte
   742 0000007E FF                  <1> MODEL_BYTE DB	0FFH			; MODEL BYTE. SET UP AT INIT TIME.
   743                              <1> 					; FF - PC1
   744                              <1> 					; FE - XT (64/256K PLANAR)
   745                              <1> 					; FD - PC-JR
   746                              <1> 					; FC - PC/AT
   747                              <1> 	public	Secondary_Model_Byte
   748 0000007F 00                  <1> Secondary_Model_Byte db 0
   749                              <1> 
   750                              <1> 	PUBLIC	INT19SEM
   751 00000080 00                  <1> INT19SEM DB	0			; INDICATE THAT ALL INT 19
   752                              <1> 					; INITIALIZATION IS COMPLETE
   753                              <1> 
   754                              <1> 
   755                              <1> %macro int19old 1-*
   756                              <1>  %rep %0
   757                              <1> 	public	Int19OLD%1
   758                              <1> Int19OLD%1	dd	-1		;Orignal hardware int. vectors for INT 19h.
   759                              <1>   %rotate 1
   760                              <1>  %endrep
   761                              <1> %endmacro
   762                              <1> 
   763 00000081 00                  <1> 	align 2, db 0
   764                              <1> 	int19old 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77
   756                              <2>  %rep %0
   757                              <2>  public Int19OLD%1
   758                              <2> Int19OLD%1 dd -1
   759                              <2>  %rotate 1
   760                              <2>  %endrep
   757                              <3>  public Int19OLD%1
   758 00000082 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 00000086 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 0000008A FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 0000008E FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 00000092 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 00000096 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 0000009A FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 0000009E FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 000000A2 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 000000A6 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 000000AA FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 000000AE FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 000000B2 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   757                              <3>  public Int19OLD%1
   758 000000B6 FFFFFFFF            <3> Int19OLD%1 dd -1
   759                              <3>  %rotate 1
   765                              <1> 
   766                              <1> 
   767                              <1> 	PATHEND 005,DISK
   129                              <2>  %IF PATHGEN
   130                              <2>  %2%1E LABEL BYTE
   131                              <2>  %ENDIF
   768                              <1> ; = = = = = = = = = = = = = = = = = = = =
   769                              <1> 
   770                              <1> 	global SNGMSG
   771                              <1> 	global DRVLET
   772                              <1> 
   773                              <1> ;	 INCLUDE BIOMES.INC
   774                              <1> ;=== Push trace listing source: msbio.cl2
   775                              <1>          %include "msbio.cl2" ; NASM included file
     1                              <2> ; msbio.cl2 
     2                              <2> 
     3                              <2> 
     4                              <2> ;_______________________
     5                              <2> 
     6 000000BA 0D0A496E7365727420- <2> SNGMSG DB    13,10,"Insert diskette for drive "
     6 000000C3 6469736B6574746520- <2>
     6 000000CC 666F72206472697665- <2>
     6 000000D5 20                  <2>
     7                              <2> 
     8                              <2> ;_______________________
     9                              <2> 
    10 000000D6 413A20616E64207072- <2> DRVLET DB    "A: and press any key when ready",13,10,10,0
    10 000000DF 65737320616E79206B- <2>
    10 000000E8 6579207768656E2072- <2>
    10 000000F1 656164790D0A0A00    <2>
   776                              <1> ;=== Pop trace listing source
   777                              <1> 
   778                              <1> 
   779                              <1> 	usesection DOSENTRY
   780                              <1> 
   781                              <1> ;-----------------------------------------------
   782                              <1> ;
   783                              <1> ;	C O N - CONSOLE DEVICE DRIVER
   784                              <1> ;
   785                              <1> 
   786                              <1> %if 0
   787                              <1> %assign num BASE700h + 61Bh - ($-$$)
   788                              <1> %warning num bytes in front of ALTAH
   789                              <1> 
   790                              <1> 	org BASE700h + 61Bh	; noted in EDR-DOS sources as a fixed offset
   791                              <1> %endif
   792                              <1> 
   793                              <1> 	usesection DOSBIODATA
   794                              <1> 
   795 000000F9 00                  <1> 	align 2, db 0
   796                              <1> 	global altah_indirect
   797 000000FA [FD02]              <1> altah_indirect:		dw incompatible_ALTAH
   798                              <1> 
   799                              <1> 	public	KEYRD_Func
   800 000000FC 00                  <1> KEYRD_Func DB	0			;AN000; Default is conventional keyboard read
   801                              <1> 	public	KEYSTS_Func
   802 000000FD 01                  <1> KEYSTS_Func DB	1			;AN000; Defualt if conventional keyboard status check.
   803                              <1> 
   804                              <1> %if KEYRD_Func + 1 != KEYSTS_Func
   805                              <1>  %error msinit.nas assumes KEYSTS_Func directly after KEYRD_Func
   806                              <1> %endif
   807                              <1> 
   808                              <1> ;	 PUBLIC  SAV_SC_INFO		 ;J.K. 4/29/86 FOR CON$GENIOCTL
   809                              <1> ;	 PUBLIC  SAV_SC_MODE
   810                              <1> ;	 PUBLIC  SAV_SC_COLORS
   811                              <1> ;	 PUBLIC  SAV_SC_WIDTH
   812                              <1> ;	 PUBLIC  SAV_SC_LENGTH
   813                              <1> ;SAV_SC_INFO	 LABEL	 BYTE
   814                              <1> ;SAV_SC_MODE	 DB	 0
   815                              <1> ;SAV_SC_COLORS	 DW	 0
   816                              <1> ;SAV_SC_WIDTH	 DW	 0
   817                              <1> ;SAV_SC_LENGTH	 DW	 0		 ;J.K. 4/29/86 FOR CON$GENIOCTL
   818                              <1> 
   819                              <1> ;-------------------------------------------------------------
   820                              <1> ;
   821                              <1> ;	P R N - PRINTER DEVICE
   822                              <1> ;
   823                              <1> 	PUBLIC PRINTDEV
   824 000000FE 00                  <1> PRINTDEV	DB	0		; INDEX INTO ABOVE ARRAY
   825                              <1> 
   826                              <1> ; THE FOLLOWING VARIABLE CAN BE MODIFIED VIA IOCTL SUB-FUNCTION 16. IN THIS
   827                              <1> ; WAY, THE WAIT CAN BE SET TO SUIT THE SPEED OF THE PARTICULAR PRINTER BEING
   828                              <1> ; USED. ONE FOR EACH PRINTER DEVICE.
   829                              <1> 
   830 000000FF 00                  <1> 		EVENB
   831                              <1> 	PUBLIC WAIT_COUNT
   832 00000100 5000500050005000    <1> WAIT_COUNT	DW	4 DUP (50H)	; ARRAY OF RETRY COUNTS FOR PRINTER
   833                              <1> 
   834 00000108 0000                <1> dosbiodata_temp_ds:	dw 0
   835                              <1> 
   836                              <1> 
   837                              <1> 	usesection DOSBIODATA
   838                              <1> 
   839                              <1> 	EVENB
   840                              <1> 	global dskdrvs_indirect
   841                              <1> dskdrvs_indirect:
   842 0000010A 00000000            <1> 	dd 0
   843                              <1> 
   844                              <1> 
   845                              <1> 	%IF	itest		 ;Testing Mode for IBMBIO.
   846                              <1> 	    PUBLIC  NUMBUF
   847                              <1> NUMBUF	    DB	    5 DUP (?)
   848                              <1> 	    PUBLIC  DIGITS
   849                              <1> DIGITS	    DB	    "0123456789ABCDEF"
   850                              <1> 	    PUBLIC  FTESTBITS
   851                              <1> ;FTESTBITS   DW      FTESTDISK+FTESTINIT
   852                              <1> fTestDISK equ FTESTDISK	; NASM port equate
   853                              <1> FTESTBITS   DW	    fTestDISK
   854                              <1> ;ftestbits dw ftestclock
   855                              <1> 	%ENDIF
   856                              <1> 
   857                              <1> 
   858                              <1> %include "code.asm"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDOS DOSCODE entrypoint handling
     5                              <2>  by E. C. Masloch, 2018--2025
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> usesection DOSCODETABLE
    16                              <2>  %if _RELOCATEDOSCODE
    17                              <2> global doscode_start
    18                              <2> doscode_start:					; must be start of segment
    19                              <2> 
    20                              <2> 	times DOSCODE_HMA_OFFSET - 16 db 38	; prefix that is unused,
    21                              <2> 						;  and not relocated
    22                              <2>  extern afterdoscodelabel
    23                              <2>  global doscode_mcb
    24                              <2> doscode_mcb:
    25                              <2> 	istruc MCB
    26                              <2> at mcbSignature,db 'M'
    27                              <2> at mcbOwner,	dw 8
    28                              <2> at mcbSize,	dw afterdoscodelabel - DOSCODE_HMA_OFFSET wrt DOSCODEGROUP
    29                              <2> at mcbName,	db "S"
    30                              <2> at smcbType,	db S_DOSCODE
    31                              <2> 	iend
    32                              <2>  %endif
    33                              <2> 
    34                              <2> 		; The following table and function is used by devicerelocate
    35                              <2> 		;  even if DOSCODE is merged into DOSENTRY (!_RELOCATEDOSCODE).
    36                              <2> 
    37 00000000 [4700][3700][3E00]- <2> 	write_entrypoint_list ENTRYPOINT_LIST
    37 00000006 [7D00]0000[4700]-   <2>
    37 0000000C [4F00]0090[4700]-   <2>
    37 00000012 [4F00]0190[4700]-   <2>
    37 00000018 [4F00]0290[4700]-   <2>
    37 0000001E [4F00]0390[3E00]-   <2>
    37 00000024 [7D00]0001[3E00]-   <2>
    37 0000002A [7D00]0102[3E00]-   <2>
    37 00000030 [7D00]0203[4700]-   <2>
    37 00000036 [6700][4700][0100]- <2>
    37 0000003C [D000]              <2>
    38                              <2> 
    39                              <2> relocated devprnentry, device
    40                              <2>  assume ds:nothing
    41 0000003E 1E                  <2> 	push ds
    42 0000003F E8(B200)            <2> 	call biocode_get_ds_dosbiodata
    43                              <2>  assume ds:DOSGROUP
    44                              <2>  extern PRINTDEV
    45 00000042 8826[FE00]          <2> 	MOV	[PRINTDEV],AH		;SAVE INDEX INTO ARRAY OF RETRY COUNTS
    46 00000046 1F                  <2> 	pop ds
    47                              <2>  assume ds:nothing
    48                              <2> 
    49                              <2> relocated deventry, device
    50                              <2>  assume ds:nothing
    51 00000047 E9(E300)            <2> 	jmp common_dev_entrypoint
    52                              <2> 
    53                              <2> 		; ! all dev entries must be before this point,
    54                              <2> 		;  and there must be no non-dev entries.
    55                              <2> 		; This is required by the dev entry check in
    56                              <2> 		;  relocated_relocatedentry in this file.
    57                              <2> 
    58                              <2> %if _RELOCATEDOSCODE && _DOSCODEHMA
    59                              <2> 	_fill 0C0h + DOSCODE_HMA_start_at, 90h, doscode_start
    60                              <2> hma_call5:
    61                              <2>  assume ds:nothing, es:nothing, ss:nothing
    62                              <2> 	jmp DOSENTRY:call5
    63                              <2> %endif
    64                              <2> 
    65                              <2> 
    66                              <2> 	numdef DOSCODE_ENTRY_TRAMPOLINE, 1
    67                              <2> 
    68                              <2> 		; INP:	byte [cs:ip] = displacement in doscode_entrypoint_list
    69                              <2> 		;	word [DOSCODE:(displaced)]
    70                              <2> 		;	 = relocated entry address
    71                              <2> 		;	word [DOSCODE:(displaced + 2)]
    72                              <2> 		;	 = optional pointer to device function table
    73                              <2> 		;	byte [DOSCODE:(displaced + 4)]
    74                              <2> 		;	 = optional device unit
    75                              <2> 		;	ss:(sp + 6) -> arbitrary stack of entrypoint
    76                              <2> 		;	word [ss:sp + 4] = entrypoint's ip,
    77                              <2> 		;	word [ss:sp + 2] = entrypoint's cs,
    78                              <2> 		;	word [ss:sp + 0] = original ax value
    79                              <2> 		;	ax = original bp value
    80                              <2> 		; OUT:	For non-device entrypoint,
    81                              <2> 		;	 ss:sp -> arbitrary stack
    82                              <2> 		;	For device entrypoint,
    83                              <2> 		;	 ss:sp -> ax, si, arbitrary stack
    84                              <2> 		;	 al = unit if any
    85                              <2> 		;	 si -> device table
    86                              <2> relocated_relocatedentry:
    87                              <2>  assume ds:nothing, es:nothing, ss:nothing
    88                              <2> %if _DOSCODE_ENTRY_TRAMPOLINE
    89 0000004A E80100              <2> 	call .handle
    90 0000004D C3                  <2> 	retn
    91                              <2> 
    92                              <2> .handle:
    93                              <2> %endif
    94 0000004E 95                  <2> 	xchg ax, bp			; restore bp, clobber ax
    95 0000004F 9C                  <2> 	 pushf
    96                              <2> 	lframe 0
    97                              <2> 	lpar word, entrypoint_ip
    98                              <2> 	lpar word, entrypoint_cs
    99                              <2> 	lpar word, orig_ax
   100                              <2> %if _DOSCODE_ENTRY_TRAMPOLINE
   101                              <2> 	lpar word, trampoline_ip
   102                              <2> %endif
   103                              <2> 	lpar word, orig_fl
   104 00000050 5589E5              <2> 	lenter
   105                              <2> 	 lequ ?entrypoint_ip, out_nondev_ip
   106                              <2> 	 lequ ?entrypoint_ip, out_dev_si
   107                              <2> 	 lequ ?entrypoint_cs, out_dev_ax
   108                              <2> 	 lequ ?orig_ax, out_dev_ip
   109                              <2> 	 lequ ?orig_ax, out_nontrampoline_ip
   110 00000053 1E                  <2> 	push ds
   111 00000054 56                  <2> 	push si
   112 00000055 FF7606              <2> 	push word [bp + ?orig_ax]
   113                              <2> 
   114 00000058 B400                <2> 	mov ah, 0
   115 0000005A 8E5E08              <2> 	mov ds, word [bp + ?entrypoint_cs]
   116                              <2>  assume ds:nothing
   117 0000005D 8B760A              <2> 	mov si, word [bp + ?entrypoint_ip]
   118                              <2> %if 0
   119                              <2> 	cld
   120                              <2> 	inc si
   121                              <2> 	lodsb
   122                              <2> 	cmp al, 0CCh	; overwritten by debugger ?
   123                              <2> 	jne @F		; no -->
   124                              <2> 	int3		; break to make it remove the breakpoint
   125                              <2> 	dec si
   126                              <2> 	lodsb		; reload the byte
   127                              <2> 	cmp al, 0CCh
   128                              <2> 	je .error
   129                              <2> %else
   130 00000060 8A4401              <2> 	mov al, [si + 1]
   131                              <2> %endif
   132                              <2> 
   133                              <2> @@:
   134 00000063 0E                  <2> 	push cs
   135 00000064 1F                  <2> 	pop ds
   136                              <2>  assume ds:DOSCODEGROUP
   137                              <2> 
   138 00000065 05[0000]            <2> 	add ax, doscode_entrypoint_list
   139 00000068 3D[3E00]            <2> 	cmp ax, doscode_entrypoint_list.end
   140 0000006B 7325                <2> 	jae .error
   141 0000006D 8F4608              <2> 	pop word [bp + ?out_dev_ax]
   142 00000070 8F460A              <2> 	pop word [bp + ?out_dev_si]
   143 00000073 96                  <2> 	xchg ax, si
   144                              <2> 
   145 00000074 AD                  <2> 	lodsw		; get relocated entry address
   146 00000075 3D[4700]            <2> 	cmp ax, relocateddeventry
   147 00000078 760D                <2> 	jbe .dev	; ! depends on deventry and devprnentry early
   148                              <2> .nondev:
   149                              <2> %if _DOSCODE_ENTRY_TRAMPOLINE
   150 0000007A 8B7608              <2> 	mov si, word [bp + ?out_dev_ax]
   151 0000007D 96                  <2> 	xchg si, ax			; ax from ?out_dev_ax, si -> destination
   152 0000007E 87760A              <2> 	xchg si, word [bp + ?out_nondev_ip]
   153                              <2> 					; ?out_nondev_ip -> ip, si = original si
   154                              <2> %else
   155                              <2> 	mov si, word [bp + ?out_nondev_ip]
   156                              <2> 	xchg ax, word [bp + ?out_nontrampoline_ip]
   157                              <2> %endif
   158 00000081 1F                  <2> 	pop ds
   159                              <2>  assume ds:nothing
   160 00000082 5D                  <2> 	lleave code
   161 00000083 9D                  <2> 	popf
   162 00000084 C20400              <2> 	retn 4
   163                              <2> 
   164                              <2> .dev:
   165                              <2> %if _DOSCODE_ENTRY_TRAMPOLINE
   166 00000087 894606              <2> 	mov word [bp + ?out_dev_ip], ax
   167                              <2> %else
   168                              <2> 	mov word [bp + ?out_nontrampoline_ip], ax
   169                              <2> %endif
   170 0000008A AD                  <2> 	lodsw
   171 0000008B 50                  <2> 	 push ax			; -> table
   172 0000008C AD                  <2> 	lodsw				; ax = unit things if any
   173 0000008D 5E                  <2> 	 pop si				; si -> table
   174 0000008E 1F                  <2> 	pop ds
   175                              <2>  assume ds:nothing
   176 0000008F 5D                  <2> 	lleave code
   177 00000090 9D                  <2> 	popf
   178 00000091 C3                  <2> 	retn
   179                              <2> 
   180                              <2> 	lleave ctx
   181                              <2> 
   182                              <2> .error:
   183 00000092 FC                  <2> 	cld
   184 00000093 BE[7001]            <2> 	mov si, doscode_msg.error_common	; access with cs
   185 00000096 E84300              <2> 	call doscode_disp_msg_cs
   186 00000099 BE[8101]            <2> 	mov si, doscode_msg.error_table		; access with cs
   187 0000009C 31C0                <2> 	xor ax, ax				; always halt
   188                              <2> @@:
   189 0000009E E80500              <2> 	call doscode_halt_query
   190 000000A1 BE[6E02]            <2> 	mov si, doscode_msg.crlf
   191 000000A4 EBF8                <2> 	jmp @B
   192                              <2> 
   193                              <2> doscode_halt_query:
   194 000000A6 1E                  <2> 	push ds
   195 000000A7 50                  <2> 	push ax
   196 000000A8 E8(0000)            <2> 	call doscode_getdosdata
   197 000000AB 8ED8                <2> 	mov ds, ax				; => DOSDATA
   198                              <2>  assume ds:DOSGROUP
   199                              <2>  extern haltflags
   200 000000AD 58                  <2> 	pop ax
   201 000000AE 8506[0000]          <2> 	test word [haltflags], ax		; check halt flags
   202 000000B2 1F                  <2> 	pop ds
   203 000000B3 7414                <2> 	jz .halt
   204 000000B5 E82400              <2> 	call doscode_disp_msg_cs
   205 000000B8 BE[6E02]            <2> 	mov si, doscode_msg.crlf
   206 000000BB E81E00              <2> 	call doscode_disp_msg_cs
   207 000000BE CC                  <2> 	int3
   208 000000BF 87DB                <2> 	xchg bx, bx				; debugging hint
   209 000000C1 C3                  <2> 	retn
   210                              <2> 
   211                              <2> .return:
   212 000000C2 BE[6E02]            <2> 	mov si, doscode_msg.crlf
   213 000000C5 E81400              <2> 	call doscode_disp_msg_cs
   214 000000C8 C3                  <2> 	retn
   215                              <2> 
   216                              <2> .halt:
   217 000000C9 E81000              <2> 	call doscode_disp_msg_cs
   218 000000CC BE[1D02]            <2> 	mov si, doscode_msg.error_after		; access with cs
   219 000000CF E80A00              <2> 	call doscode_disp_msg_cs
   220                              <2> .loop:
   221 000000D2 F8                  <2> 	clc
   222 000000D3 CC                  <2> 	int3					; invoke debugger
   223 000000D4 72EC                <2> 	jc .return
   224 000000D6 31C0                <2> 	xor ax, ax
   225 000000D8 CD16                <2> 	int 16h
   226 000000DA EBF6                <2> 	jmp .loop
   227                              <2> 
   228                              <2> 
   229                              <2> 
   230                              <2> doscode_disp_msg_cs:
   231                              <2>  assume ds:nothing, es:nothing, ss:nothing
   232 000000DC 50                  <2> 	push ax
   233                              <2> @@:
   234 000000DD 2EAC                <2> 	cs lodsb
   235 000000DF 84C0                <2> 	test al, al
   236 000000E1 7413                <2> 	jz @F
   237 000000E3 E80400              <2> 	call doscode_disp_al
   238 000000E6 EBF5                <2> 	jmp short @B
   239                              <2> 
   240                              <2> 
   241                              <2> doscode_disp_blank:
   242 000000E8 B020                <2> 	mov al, 32
   243                              <2> doscode_disp_al:
   244                              <2>  assume ds:nothing, es:nothing, ss:nothing
   245 000000EA 50                  <2> 	push ax
   246 000000EB 53                  <2> 	push bx
   247 000000EC 55                  <2> 	push bp
   248 000000ED B40E                <2> 	mov ah, 0Eh
   249 000000EF BB0700              <2> 	mov bx, 7
   250 000000F2 CD10                <2> 	int 10h
   251 000000F4 5D                  <2> 	pop bp
   252 000000F5 5B                  <2> 	pop bx
   253                              <2> @@:
   254 000000F6 58                  <2> 	pop ax
   255 000000F7 C3                  <2> 	retn
   256                              <2> 
   257                              <2> 
   258                              <2> doscode_disp_dxax_hex:	; dx:ax
   259                              <2>  assume ds:nothing, es:nothing, ss:nothing
   260 000000F8 92                  <2> 		xchg ax, dx
   261 000000F9 E80100              <2> 		call doscode_disp_ax_hex
   262 000000FC 92                  <2> 		xchg ax, dx
   263                              <2> doscode_disp_ax_hex:	; ax
   264                              <2>  assume ds:nothing, es:nothing, ss:nothing
   265 000000FD 86C4                <2> 		xchg al, ah
   266 000000FF E80200              <2> 		call doscode_disp_al_hex
   267                              <2> 				; display former ah
   268 00000102 86C4                <2> 		xchg al, ah	;  and fall trough for al
   269                              <2> doscode_disp_al_hex:	; al
   270                              <2>  assume ds:nothing, es:nothing, ss:nothing
   271 00000104 51                  <2> 		push cx
   272 00000105 B104                <2> 		mov cl, 4
   273 00000107 D2C8                <2> 		ror al, cl
   274 00000109 E80300              <2> 		call doscode_disp_al_lownibble_hex
   275                              <2> 				; display former high-nibble
   276 0000010C D2C0                <2> 		rol al, cl
   277 0000010E 59                  <2> 		pop cx
   278                              <2> 				;  and fall trough for low-nibble
   279                              <2> doscode_disp_al_lownibble_hex:
   280                              <2>  assume ds:nothing, es:nothing, ss:nothing
   281 0000010F 50                  <2> 		push ax		; save ax for call return
   282 00000110 240F                <2> 		and al, 00001111b
   283                              <2> 				; high nibble must be zero
   284 00000112 0430                <2> 		add al, '0'	; if number is 0-9, now it's the correct character
   285 00000114 3C39                <2> 		cmp al, '9'
   286 00000116 7602                <2> 		jna .decimalnum	; if we get decimal number with this, ok -->
   287 00000118 0407                <2> 		add al, 7	;  otherwise, add 7 and we are inside our alphabet
   288                              <2>  .decimalnum:
   289 0000011A E8CDFF              <2> 		call doscode_disp_al
   290 0000011D 58                  <2> 		pop ax
   291 0000011E C3                  <2> 		retn
   292                              <2> 
   293                              <2> 
   294                              <2> relocated shellreturned
   295                              <2>  assume ds:nothing, es:nothing, ss:nothing
   296 0000011F FB                  <2> 	sti
   297 00000120 FC                  <2> 	cld
   298 00000121 730E                <2> 	jnc .returned
   299 00000123 BE[AC01]            <2> 	mov si, doscode_msg.error_shell_failed.1	; access with cs
   300 00000126 E8B3FF              <2> 	call doscode_disp_msg_cs
   301 00000129 E8D1FF              <2> 	call doscode_disp_ax_hex
   302 0000012C BE[DB01]            <2> 	mov si, doscode_msg.error_shell_failed.2	; access with cs
   303 0000012F EB05                <2> 	jmp @F
   304                              <2> .returned:
   305 00000131 31C0                <2> 	xor ax, ax
   306 00000133 BE[DE01]            <2> 	mov si, doscode_msg.error_shell_returned	; access with cs
   307                              <2> @@:
   308                              <2>  extern doscode_getdosdata
   309                              <2>  extern shell_return_has_been_freed
   310                              <2>  extern shell_return_address
   311 00000136 50                  <2> 	push ax
   312 00000137 E8(0000)            <2> 	call doscode_getdosdata
   313 0000013A 8ED8                <2> 	mov ds, ax
   314                              <2>  assume ds:DOSGROUP
   315 0000013C 58                  <2> 	pop ax
   316 0000013D D006[0000]          <2> 	rol byte [shell_return_has_been_freed], 1
   317 00000141 7207                <2> 	jc .halt
   318 00000143 E896FF              <2> 	call doscode_disp_msg_cs
   319                              <2> 		; INP:	ax = return error value (0 = no error)
   320                              <2> 		;	ds => DOSDATA
   321                              <2> 		; STT:	ss => init stack block
   322 00000146 FF2E[0000]          <2> 	jmp far [shell_return_address]
   323                              <2> 
   324                              <2> .halt:
   325 0000014A 50                  <2> 	push ax
   326 0000014B 31C0                <2> 	xor ax, ax				; always halt
   327                              <2> @@:
   328 0000014D E856FF              <2> 	call doscode_halt_query
   329 00000150 BE[6E02]            <2> 	mov si, doscode_msg.crlf
   330 00000153 EBF8                <2> 	jmp @B
   331                              <2> 
   332                              <2> 
   333                              <2> TAGCRASHDOS:
   334                              <2>  assume ds:nothing, es:nothing, ss:nothing
   335                              <2>  global TAGCRASHDOS
   336                              <2>  extern tagcrash_query_flag
   337 00000155 50                  <2> 	push ax
   338 00000156 56                  <2> 	push si
   339 00000157 BE[7001]            <2> 	mov si, doscode_msg.error_common	; access with cs
   340 0000015A E87FFF              <2> 	call doscode_disp_msg_cs
   341 0000015D BE[FF01]            <2> 	mov si, doscode_msg.error_tag		; access with cs
   342                              <2>  extern flag_no_halt_tagcrash
   343 00000160 B8[0000]            <2> 	mov ax, flag_no_halt_tagcrash
   344 00000163 E840FF              <2> 	call doscode_halt_query
   345 00000166 5E                  <2> 	pop si
   346 00000167 58                  <2> 	pop ax
   347                              <2>  extern FETCHI_TAG
   348 00000168 36C706[0000]7258    <2> 	mov word [ss:FETCHI_TAG], 22642
   349 0000016F C3                  <2> 	retn
   350                              <2> 
   351                              <2> 
   352                              <2> doscode_msg:
   353 00000170 07444F53434F444520- <2> .error_common:	asciz 7,"DOSCODE error: "
   353 00000179 6572726F723A2000    <2>
   354 00000181 496E76616C69642064- <2> .error_table:	asciz "Invalid doscode_entrypoint_list reference."
   354 0000018A 6F73636F64655F656E- <2>
   354 00000193 747279706F696E745F- <2>
   354 0000019C 6C6973742072656665- <2>
   354 000001A5 72656E63652E00      <2>
   355 000001AC 07496E697469616C20- <2> .error_shell_failed.1:	asciz 7,"Initial shell process execution failed! Code="
   355 000001B5 7368656C6C2070726F- <2>
   355 000001BE 636573732065786563- <2>
   355 000001C7 7574696F6E20666169- <2>
   355 000001D0 6C65642120436F6465- <2>
   355 000001D9 3D00                <2>
   356 000001DB 682E00              <2> .error_shell_failed.2:	asciz "h."
   357 000001DE 07496E697469616C20- <2> .error_shell_returned:	asciz 7,"Initial shell process returned!"
   357 000001E7 7368656C6C2070726F- <2>
   357 000001F0 636573732072657475- <2>
   357 000001F9 726E65642100        <2>
   358 000001FF 496E7465726E616C20- <2> .error_tag:	asciz "Internal error, tag mismatch!"
   358 00000208 6572726F722C207461- <2>
   358 00000211 67206D69736D617463- <2>
   358 0000021A 682100              <2>
   359 0000021D 0D0A53797374656D20- <2> .error_after:	asciz 13,10,"System halted. "
   359 00000226 68616C7465642E2000  <2>
   360 0000022F 436F72727570746564- <2> .mcb.1:		asciz "Corrupted MCB chain, err="
   360 00000238 204D43422063686169- <2>
   360 00000241 6E2C206572723D00    <2>
   361 00000249 680D0A5072696F723A- <2> .mcb.2:		asciz "h",13,10,"Prior: "
   361 00000252 2000                <2>
   362 00000254 0D0A4E6578743A2020- <2> .mcb.3:		asciz 13,10,"Next:  "
   362 0000025D 00                  <2>
   363 0000025E 2046697273742F6E6F- <2> .mcb.first:	asciz " First/no MCB"
   363 00000267 204D434200          <2>
   364                              <2> .hmcb.4:
   365 0000026C 22                  <2> .mcb.4:		db '"'
   366 0000026D 00                  <2> .empty:		asciz
   367                              <2> %if _RELOCATEDOSCODE && _DOSCODEHMA
   368                              <2> .hmcb.1:	asciz "Corrupted HMCB chain",13,10,"cx: "
   369                              <2> .hmcb.7:
   370                              <2> .hmcb.3:	asciz 13,10,"di: "
   371                              <2> .hmcb.5:	asciz "Corrupted HMCB chain",13,10,"bx: "
   372                              <2> .hmcb.first:	asciz " First/no HMCB"
   373                              <2> %endif
   374 0000026E 0D0A00              <2> .crlf:		asciz 13,10
   375                              <2> 
   376                              <2> ;segm sn ownr size 11 22 33 11 22 33 44 55 66 77 88 "name"
   377                              <2> 
   378                              <2>  global doscode_halt_query
   379                              <2>  global doscode_disp_msg_cs
   380                              <2>  global doscode_disp_al
   381                              <2>  global doscode_disp_al_hex
   382                              <2>  global doscode_disp_ax_hex
   383                              <2>  global doscode_disp_blank
   384                              <2>  global doscode_msg.mcb.1
   385                              <2>  global doscode_msg.mcb.2
   386                              <2>  global doscode_msg.mcb.3
   387                              <2>  global doscode_msg.mcb.4
   388                              <2>  global doscode_msg.mcb.first
   389                              <2>  global doscode_msg.empty
   390                              <2>  global doscode_msg.hmcb.1
   391                              <2>  global doscode_msg.hmcb.3
   392                              <2>  global doscode_msg.hmcb.4
   393                              <2>  global doscode_msg.hmcb.5
   394                              <2>  global doscode_msg.hmcb.7
   395                              <2>  global doscode_msg.hmcb.first
   396                              <2>  global doscode_msg.error_common
   397                              <2>  global doscode_msg.crlf
   859                              <1> 
   860                              <1> 	PATHEND 001,BIO
   129                              <2>  %IF PATHGEN
   130                              <2>  %2%1E LABEL BYTE
   131                              <2>  %ENDIF
   861                              <1> 
   862                              <1> 
   232                                  ;=== Pop trace listing source
   233                                  
   234                                  
   235                                  usesection BIOCODE
   236                                  
   237                                  	%IF	itest
   238                                  	    PUBLIC  MSGNUM
   239                                  MSGNUM:
   240                                  	    PUSHF
   241                                  	    TEST    [cs:FTESTBITS],AX
   242                                  	    JZ	    MRET
   243                                  	    PUSH    SI
   244                                  	    PUSH    BX
   245                                  	    PUSH    CX
   246                                  	    PUSH    ES
   247                                  	    PUSH    DI
   248                                  	    MOV     DI,OFFSET NUMBUF
   249                                  	    PUSH    CS
   250                                  	    POP     ES
   251                                  	    MOV     CX,4
   252                                  NUMLOOP:
   253                                  	    PUSH    CX
   254                                  	    MOV     CL,4
   255                                  	    ROL     BX,CL
   256                                  	    POP     CX
   257                                  	    PUSH    BX
   258                                  	    AND     BX,0FH
   259                                  	    MOV     AL,[cs:DIGITS + BX]
   260                                  	    STOSB
   261                                  	    POP     BX
   262                                  	    LOOP    NUMLOOP
   263                                  	    POP     DI
   264                                  	    POP     ES
   265                                  	    POP     CX
   266                                  	    POP     BX
   267                                  	    MOV     SI,OFFSET NUMBUF
   268                                  	    CALL    MSGOUT
   269                                  	    POP     SI
   270                                  	    POPF
   271                                  	    RET
   272                                  
   273                                  	    PUBLIC  MSGOUT
   274                                  MSGOUT:
   275                                  	    PUSHF
   276                                  	    TEST    [cs:FTESTBITS],AX
   277                                  	    JZ	    MRET
   278                                  	    PUSH    DS
   279                                  	    PUSH    AX
   280                                  	    PUSH    BX
   281                                  	    PUSH    CS
   282                                  	    POP     DS
   283                                  	    CALL    WRMSG
   284                                  	    POP     BX
   285                                  	    POP     AX
   286                                  	    POP     DS
   287                                  MRET:
   288                                  	    POPF
   289                                  	    RET
   290                                  
   291                                  	    PUBLIC DUMPBYTES		;J.K. 4/9/86
   292                                  ;Dumpbytes will dump the bytes in memory in hex.  Space will be put in between
   293                                  ;the bytes and CR, LF will be put at the end. - J.K.
   294                                  ;Input: DS:SI -> buffer to dump in Hex.
   295                                  ;	CX -> # of bytes (Length of the buffer)
   296                                  ;
   297                                  DUMPBYTES proc near
   298                                  	pushf
   299                                  	push	ax
   300                                  dumploops:
   301                                  	lodsb
   302                                  	mov	ah, al
   303                                  	shr	ah, 1
   304                                  	shr	ah, 1
   305                                  	shr	ah, 1
   306                                  	shr	ah, 1
   307                                  	call	hex_to_ascii
   308                                  	push	ax
   309                                  	mov	al, ah
   310                                  	call	outchar
   311                                  	pop	ax
   312                                  	call	outchar
   313                                  	mov	al, ' '
   314                                  	call	outchar
   315                                  	loop	dumploops
   316                                  
   317                                  	mov	al, 0dh
   318                                  	call	outchar
   319                                  	mov	al, 0ah
   320                                  	call	outchar
   321                                  
   322                                  	pop	ax
   323                                  	popf
   324                                  	ret
   325                                  DUMPBYTES	endp
   326                                  
   327                                  	PUBLIC	Hex_to_ascii
   328                                  Hex_to_ascii	proc	near		;J.K. - 4/9/86
   329                                  	and	ax, 0f0fh
   330                                  	add	ah, 30h
   331                                  	cmp	ah, 3ah
   332                                  	jb	hta_$1
   333                                  	add	ah, 7
   334                                  hta_$1:
   335                                  	add	al, 30h
   336                                  	cmp	al, 3ah
   337                                  	jb	hta_$2
   338                                  	add	al, 7
   339                                  hta_$2:
   340                                  	ret
   341                                  Hex_to_ascii	endp
   342                                  
   343                                  	PUBLIC	outchar
   344                                  Outchar proc	near
   345                                  	PUSH	AX
   346                                  	PUSH	SI
   347                                  	PUSH	DI
   348                                  	PUSH	BP
   349                                  	PUSH	BX
   350                                  ;SB33002*******************************************************
   351                                  	MOV	AH, 0Eh 		;SET COMMAND TO WRITE A CHAR   ;SB;3.30*
   352                                  	MOV	BX, 7			;SET FOREGROUND COLOR	       ;SB;3.30*
   353                                  	INT	10h			;CALL ROM-BIOS		       ;SB;3.30*
   354                                  ;SB33002*******************************************************
   355                                  	POP	BX
   356                                  	POP	BP
   357                                  	POP	DI
   358                                  	POP	SI
   359                                  	POP	AX
   360                                  	RET
   361                                  Outchar endp
   362                                  
   363                                  	%ENDIF
   364                                  	%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
   365                                  
   366                                  ;---------------------------------------------------
   367                                  ;
   368                                  ;	DEVICE ENTRY POINT
   369                                  ;
   370                                  CMDLEN	equ	0			;LENGTH OF THIS COMMAND
   371                                  UNIT	equ	1			;SUB UNIT SPECIFIER
   372                                  CMD	equ	2			;COMMAND CODE
   373                                  STATUS	equ	3			;STATUS
   374                                  MEDIA	equ	13			;MEDIA DESCRIPTOR
   375                                  TRANS	equ	14			;TRANSFER ADDRESS
   376                                  COUNT	equ	18			;COUNT OF BLOCKS OR CHARACTERS
   377                                  _START	equ	20			;FIRST BLOCK TO TRANSFER
   378                                  EXTRA	equ	22			;USUALLY A POINTER TO VOL ID FOR ERROR 15
   379                                  START_L equ	26			;AN000; Extended start sector (Low)
   380                                  START_H equ	28			;AN000; Extended start sector (High)
   381                                  
   382                                  
   383                                  	section BIOCODE
   384                                   extern doscode_getdosdata
   385                                  
   386                                  dosbiocode_get_ds_dosbiodata:
   387                                  biocode_get_ds_dosbiodata:
   388                                   assume ds:nothing, es:nothing, ss:nothing
   389 000000B2 50                      	push ax
   390 000000B3 E8(0000)                	call doscode_getdosdata
   391 000000B6 8ED8                    	mov ds, ax
   392                                   assume ds:DOSGROUP
   393 000000B8 58                      	pop ax
   394 000000B9 C3                      	retn
   395                                  
   396                                  dosbiocode_get_ds_dosentry:
   397                                  biocode_get_ds_dosentry:
   398                                   assume ds:nothing, es:nothing, ss:nothing
   399 000000BA 2E8E1E[C000]            	mov ds, word [cs:.segment]
   400                                   assume ds:DOSENTRYGROUP
   401 000000BF C3                      	retn
   402                                  
   403                                  	align 2, db 0
   404 000000C0 [ssss]                  .segment:	dw DOSENTRY
   405                                  
   406                                  dosbiocode_get_es_dosbiodata:
   407                                  biocode_get_es_dosbiodata:
   408                                   assume ds:nothing, es:nothing, ss:nothing
   409 000000C2 50                      	push ax
   410 000000C3 E8(0000)                	call doscode_getdosdata
   411 000000C6 8EC0                    	mov es, ax
   412                                   assume es:DOSGROUP
   413 000000C8 58                      	pop ax
   414 000000C9 C3                      	retn
   415                                  
   416                                  dosbiocode_get_es_dosentry:
   417                                  biocode_get_es_dosentry:
   418                                   assume ds:nothing, es:nothing, ss:nothing
   419 000000CA 2E8E06[C000]            	mov es, word [cs:biocode_get_ds_dosentry.segment]
   420                                   assume es:DOSENTRYGROUP
   421 000000CF C3                      	retn
   422                                  
   423                                  	global biocode_get_es_dosentry, biocode_get_ds_dosentry
   424                                  	global dosbiocode_get_es_dosentry, dosbiocode_get_ds_dosentry
   425                                  	global biocode_get_es_dosbiodata, biocode_get_ds_dosbiodata
   426                                  	global dosbiocode_get_es_dosbiodata, dosbiocode_get_ds_dosbiodata
   427                                  
   428                                  
   429                                  	section BIOCODE
   430                                  
   431                                  
   432                                  relocated strategyentry, device
   433                                  	PUBLIC	STRATEGY
   434                                  STRATEGY PROC	FAR
   435                                   assume ds:nothing, es:nothing, ss:nothing
   436 000000D0 1E                      	push ds
   437 000000D1 E8E6FF                  	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   438                                   assume ds:DOSENTRYGROUP
   439 000000D4 891E[B801]              	MOV	WORD PTR [PTRSAV],BX
   440 000000D8 8C06[BA01]              	MOV	WORD PTR [PTRSAV+2],ES
   441 000000DC 1F                      	pop ds
   442                                   assume ds:nothing
   443 000000DD CB                      	RET
   444                                  STRATEGY ENDP
   445                                  
   446                                  
   447                                   global DSK$IN
   448                                  DSK$IN:					; legacy entry used by disk_i2F
   449 000000DE 56                      	push si
   450 000000DF 50                      	push ax
   451 000000E0 BE[0100]                	mov si, DSKTBL
   452                                  
   453                                   global common_dev_entrypoint
   454                                  common_dev_entrypoint:
   455                                   assume ds:nothing, es:nothing, ss:nothing
   456 000000E3 51                      	PUSH	CX
   457 000000E4 52                      	PUSH	DX
   458 000000E5 57                      	PUSH	DI
   459 000000E6 55                      	PUSH	BP
   460 000000E7 1E                      	PUSH	DS
   461 000000E8 06                      	PUSH	ES
   462 000000E9 53                      	PUSH	BX
   463                                  
   464 000000EA E8DDFF                  	call biocode_get_es_dosentry	; AUXNUM and PTRSAV in DOSENTRY
   465                                   assume es:DOSENTRYGROUP
   466 000000ED 26A2[6C02]              	MOV	[es:AUXNUM],AL		;SAVE CHOICE OF AUX/PRN DEVICE
   467                                  
   468 000000F1 26C51E[B801]            	lds bx, [es:PTRSAV]		;GET POINTER TO I/O PACKET
   469                                  	ASSUME	DS:NOTHING
   470                                  
   471 000000F6 8A4701                  	MOV	AL,BYTE PTR [BX + UNIT] ;AL = UNIT CODE
   472 000000F9 8A670D                  	MOV	AH,BYTE PTR [BX + MEDIA] ;AH = MEDIA DESCRIP
   473 000000FC 8B4F12                  	MOV	CX,WORD PTR [BX + COUNT] ;CX = COUNT
   474 000000FF 8B5714                  	MOV	DX,WORD PTR [BX + _START] ;DX = START SECTOR
   475                                  
   476                                  ;SB34MSB100*********************************************************************
   477                                  ;SB
   478                                  ;SB	The disk device driver can now handle 32 bit start sector number.
   479                                  ;SB	So we should check to see if a 32 bit sector number has been specified
   480                                  ;SB	and if so get it. Whether a 32 bit sector has been specified or not
   481                                  ;SB	the disk driver expects a 32 bit sector number with the high word
   482                                  ;SB	in DOSENTRY:Start_Sec_H and the low word in dx.
   483                                  ;SB
   484                                  ;SB	Algorithm:
   485                                  ;SB		1. Check to see if the request is for the disk driver by 
   486                                  ;SB		   checking to see if SI points to DSKTBL.
   487                                  ;SB
   488                                  ;SB		2. If request not for the disk nothing special needs to be done.
   489                                  ;SB	
   490                                  ;SB		3. If request for the disk then check to see if a 32 bit 
   491                                  ;SB		   sector number has been specified by seeing whether the
   492                                  ;SB		   the conventional sector number specified is -1.  If so
   493                                  ;SB		   we need to pick the 32 bit sector number from the new
   494                                  ;SB		   fields in the request packet.  See the request header
   495                                  ;SB		   struc for the fields you need.  If the conventional
   496                                  ;SB		   sector field is not -1 then a 16 bit sector number
   497                                  ;SB		   has been specified and we just need to initalise the
   498                                  ;SB		   high word in DOSENTRY:Start_Sec_H to 0
   499                                  ;SB	
   500                                  ;SB NOTE: START_L and START_H are the offsets withing the IO_REQUEST packet
   501                                  ;SB	  which contain the low and hi words of the 32 bit start sector if
   502                                  ;SB	  it has been used.
   503                                  ;SB	
   504                                  ;SB NOTE:Remember not to destroy the registers which have been set up before
   505                                  
   506                                  %ifnidni %[DOSBIODATA], %[DOSENTRY]
   507 00000102 E8BDFF                  	call biocode_get_es_dosbiodata
   508                                   assume es:DOSGROUP
   509                                  %endif
   510 00000105 81FE[0100]              	CMP	SI,OFFSET DSKTBL
   511 00000109 7516                    	JNZ	DSK_REQ_CONT		; Not Disk Req
   512 0000010B 268326[6E00]00          	and	word [es:START_SEC_H], 0; prepare for zx 16-bit sector number
   513 00000111 83FAFF                  	CMP	DX,-1
   514 00000114 750B                    	JNZ	DSK_REQ_16		; is a 16-bit sector number -->
   515 00000116 8B571C                  	MOV	DX,[BX + START_H]	; 32 bits DSK REQ
   516                                  START_SEC_H equ Start_Sec_H	; NASM port label
   517 00000119 268916[6E00]            	MOV	[es:START_SEC_H],DX	; es:Start_sec_H = Packet.Start_H
   518 0000011E 8B571A                  	MOV	DX,[BX + START_L]	; DX             = Packet.Start_L
   519                                  DSK_REQ_16:
   520                                  DSK_REQ_CONT:
   521                                  
   522                                  ;SB34MSB100*********************************************************************
   523                                  
   524 00000121 97                      	XCHG	DI,AX
   525 00000122 8A4702                  	MOV	AL,BYTE PTR [BX + CMD]
   526 00000125 2E3A04                  	CMP	AL,[CS:SI]		;ARR 2.41
   527 00000128 7717                    	JA	CMDERR
   528                                  
   529 0000012A 98                      	CBW				; NOTE THAT AL <= 15 MEANS OK
   530 0000012B D1E0                    	SHL	AX,1
   531                                  
   532 0000012D 01C6                    	ADD	SI,AX
   533 0000012F 97                      	XCHG	AX,DI
   534                                  
   535 00000130 06                      	push es
   536 00000131 C47F0E                  	LES	DI,[BX + TRANS]
   537                                   assume es:nothing
   538 00000134 1F                      	pop ds
   539                                   assume ds:DOSGROUP
   540                                  
   541 00000135 FC                      	CLD
   542 00000136 2EFF6401                	JMP	WORD PTR [cs:SI+1]	;GO DO COMMAND
   543                                  DSK$IN	ENDP
   544                                  ;	PAGE
   545                                  ;=====================================================
   546                                  ;=
   547                                  ;=	SUBROUTINES SHARED BY MULTIPLE DEVICES
   548                                  ;=
   549                                  ;=====================================================
   550                                  ;----------------------------------------------------------
   551                                  ;
   552                                  ;	EXIT - ALL ROUTINES RETURN THROUGH THIS PATH
   553                                  ;
   554                                  	PUBLIC	BUS$EXIT
   555                                  BUS$EXIT PROC	FAR
   556                                   assume ds:nothing, es:nothing, ss:nothing
   557 0000013A B403                    	MOV	AH,00000011B
   558 0000013C EB21                    	JMP	SHORT ERR1
   559                                  
   560                                   global DSK$UNKNOWN
   561                                  DSK$UNKNOWN:
   562                                   assume ds:nothing, es:nothing, ss:nothing
   563 0000013E B001                    	mov al, 1			; unknown unit error
   564 00000140 A9                      	db __TEST_IMM16			; skip mov al
   565                                  
   566                                  	PUBLIC	CMDERR
   567                                  CMDERR:
   568                                   assume ds:nothing, es:nothing, ss:nothing
   569 00000141 B003                    	MOV	AL,3			;UNKNOWN COMMAND ERROR
   570                                  
   571                                  	PUBLIC	ERR$CNT
   572                                  ERR$CNT:
   573                                   assume ds:nothing, es:nothing, ss:nothing
   574 00000143 E874FF                  	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   575                                   assume ds:DOSENTRYGROUP
   576 00000146 C51E[B801]              	lds bx, [PTRSAV]
   577                                   ASSUME DS:NOTHING
   578 0000014A 294F12                  	SUB	WORD PTR [BX + COUNT],CX	;# OF SUCCESSFUL I/O'S
   579                                  
   580                                  	PUBLIC	ERR$EXIT
   581                                  ERR$EXIT:
   582                                   assume ds:nothing, es:nothing, ss:nothing
   583 0000014D B481                    	MOV	AH,10000001B		;MARK ERROR RETURN
   584 0000014F EB0E                    	JMP	SHORT ERR1
   585                                  BUS$EXIT ENDP
   586                                  
   587                                  EXITP	PROC	FAR
   588                                   assume ds:nothing, es:nothing, ss:nothing
   589                                  EXIT$ZER:
   590 00000151 E866FF                  	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   591                                   assume ds:DOSENTRYGROUP
   592 00000154 C51E[B801]              	lds bx, [PTRSAV]
   593                                   ASSUME DS:NOTHING
   594 00000158 31C0                    	XOR	AX,AX
   595 0000015A 894712                  	MOV	WORD PTR [BX + COUNT],AX	;INDICATE NO CHARS READ
   596                                  
   597                                  	PUBLIC	EXIT
   598                                  EXIT:
   599                                   assume ds:nothing, es:nothing, ss:nothing
   600 0000015D B401                    	MOV	AH,00000001B
   601                                  ERR1:
   602                                   assume ds:nothing, es:nothing, ss:nothing
   603 0000015F E858FF                  	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   604                                   assume ds:DOSENTRYGROUP
   605 00000162 C51E[B801]              	lds bx, [PTRSAV]
   606                                   assume ds:nothing
   607 00000166 894703                  	MOV	WORD PTR [BX + STATUS],AX ;MARK OPERATION COMPLETE
   608                                  
   609 00000169 5B                      	POP	BX
   610 0000016A 07                      	POP	ES
   611                                   assume es:nothing
   612 0000016B 1F                      	POP	DS
   613                                   assume ds:nothing
   614 0000016C 5D                      	POP	BP
   615 0000016D 5F                      	POP	DI
   616 0000016E 5A                      	POP	DX
   617 0000016F 59                      	POP	CX
   618 00000170 58                      	POP	AX
   619 00000171 5E                      	POP	SI
   620                                  global biocode_retf
   621                                  biocode_retf:
   622 00000172 CB                      	RET				;RESTORE REGS AND RETURN
   623                                  EXITP	ENDP
   624                                  
   625                                  ;-------------------------------------------------------------
   626                                  ;
   627                                  ;	CHROUT - WRITE OUT CHAR IN AL USING CURRENT ATTRIBUTE
   628                                  ;
   629                                  ;	CALLED VIA INT 29H
   630                                  ;
   631                                  	PUBLIC	CHROUT
   632                                  CHROUT	equ	29H
   633                                  
   634                                  relocated i29
   635                                  	PUBLIC	OUTCHR
   636                                  OUTCHR	PROC	FAR
   637                                   assume ds:nothing, es:nothing, ss:nothing
   638 00000173 50                      	PUSH	AX
   639 00000174 56                      	PUSH	SI
   640 00000175 57                      	PUSH	DI
   641 00000176 55                      	PUSH	BP
   642                                  ;SB33002a*******************************************************
   643 00000177 53                      	push	bx			;			      ;SB ;3.30
   644 00000178 B40E                    	mov	AH, 0Eh 		; set command to write a character;SB;3.30
   645 0000017A BB0700                  	mov	BX, 7			; set foreground color	      ;SB ;3.30
   646 0000017D CD10                    	int	10h			; call rom-bios 	      ;SB ;3.30
   647 0000017F 5B                      	pop	bx			;			      ;SB ;3.30
   648                                  ;SB33002a*******************************************************
   649 00000180 5D                      	POP	BP
   650 00000181 5F                      	POP	DI
   651 00000182 5E                      	POP	SI
   652 00000183 58                      	POP	AX
   653 00000184 CF                      	IRET
   654                                  OUTCHR	ENDP
   655                                  ;----------------------------------------------
   656                                  ;
   657                                  ;	SET DX TO AUXNUM
   658                                  ;
   659                                  	PUBLIC GETDX
   660                                  GETDX	PROC	NEAR
   661                                   assume ds:nothing, es:nothing, ss:nothing
   662 00000185 1E                      	push ds
   663 00000186 E831FF                  	call biocode_get_ds_dosentry
   664                                   assume ds:DOSENTRYGROUP
   665 00000189 8B16[6C02]              	MOV	DX,WORD PTR [AUXNUM]
   666 0000018D 1F                      	pop ds
   667                                   assume ds:nothing
   668 0000018E C3                      	RET
   669                                  GETDX	ENDP
   670                                  ;	PAGE
   671                                  ;************************************************** ARR 2.15
   672                                  
   673                                  ;-----------------------------------------------
   674                                  ;
   675                                  ;	TIMER INTERRUPT HANDLER
   676                                  ;
   677                                  ;TIMER_LOW	 DW	 0
   678                                  ;TIMER_HIGH	 DW	 0
   679                                  ;
   680                                  ;TIMER:
   681                                  ;	 STI
   682                                  ;	 PUSH	 AX
   683                                  ;	 PUSH	 CX
   684                                  ;	 PUSH	 DX
   685                                  ;	 PUSH	 DS
   686                                  ;	 PUSH	 CS
   687                                  ;	 POP	 DS
   688                                  ;	 XOR	 AX,AX
   689                                  ;	 INT	 1AH			 ; GET ROM TIME AND ZAP ROLL OVER
   690                                  ;	 MOV	 [TIMER_HIGH],CX
   691                                  ;	 MOV	 [TIMER_LOW],DX
   692                                  ;	 OR	 AL,AL
   693                                  ;	 JZ	 T5
   694                                  ;	 INC	 WORD PTR [DAYCNT]		  ; ONE DAY GONE BY
   695                                  ;T5:
   696                                  ;	 POP	 DS
   697                                  ;	 POP	 DX
   698                                  ;	 POP	 CX
   699                                  ;	 POP	 AX
   700                                  ;	 IRET
   701                                  ;************************************************** ARR 2.15
   702                                  ; (no prior section) ; CODE	ENDS
   703                                  	END
