     1                                  ;	PAGE ,132 ;
     2                                  ;	TITLE MSLPT - BIOS
     3                                  	%warning out: ...MSLPT.ASM
     3          ******************       warning: out: ...MSLPT.ASM [-w+user]
     4                                  
     5                                  ;==============================================================================
     6                                  ;REVISION HISTORY:
     7                                  ;AN000 - New for DOS Version 4.00 - J.K.
     8                                  ;AC000 - Changed for DOS Version 4.00 - J.K.
     9                                  ;AN00x - PTM number for DOS Version 4.00 - J.K.
    10                                  ;==============================================================================
    11                                  ;AN001 - P156 KBMLPT device driver's retry logic.                  8/18/87 J.K.
    12                                  ;==============================================================================
    13                                  	itest equ 0
    14                                  	%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
    15                                  	%include "msextrn.mac"
     1                              <1> 
     2                              <1> section BIOCODE
     3                              <1>  assume cs:BIOCODE
     4                              <1> ;	SCCSID = @(#)IBMEXTRN.ASM	1.11 85/11/18
     5                              <1> ;This is for IBMINIT module.
     6                              <1> ;=======================================================
     7                              <1> ;REVISION HISTORY:
     8                              <1> ;AN000; - NEW Version 4.00. J.K.
     9                              <1> ;AC000; - Modified Line 4.00. J.K.
    10                              <1> ;ANxxx; - PTMyyy
    11                              <1> ;==============================================================================
    12                              <1> ;AN001; D486 SHARE installation for large media 		   2/23/88 J.K.
    13                              <1> ;==============================================================================
    14                              <1> 
    15                              <1> 	extern biocode_get_ds_dosentry, biocode_get_es_dosentry
    16                              <1> 	extern dosbiocode_get_ds_dosentry, dosbiocode_get_es_dosentry
    17                              <1> 	extern biocode_get_ds_dosbiodata, biocode_get_es_dosbiodata
    18                              <1> 	EXTRN	ORIG13:DWORD,ORIG19:DWORD
    19                              <1> 	EXTRN	COM2DEV:WORD,COM1DEV:WORD
    20                              <1> 	EXTRN	COM4DEV:WORD,COM3DEV:WORD
    21                              <1> 	EXTRN	LPT3DEV:WORD,LPT2DEV:WORD,LPT1DEV:WORD
    22                              <1> 	EXTRN	HARDDRV:BYTE,HARDNUM:BYTE,DRVMAX:BYTE,HDSKTAB:WORD
    23                              <1> 	EXTRN	DSKDRVS:WORD,HNUM:BYTE,EOT:BYTE,FHAVE96:BYTE
    24                              <1> 	EXTRN	REAL13:DWORD,DAYCNT:WORD,CONHEADER:WORD
    25                              <1> 	EXTRN	TWOHARD:BYTE,INT_2F_NEXT:DWORD
    26                              <1> 	EXTRN	BDSH:WORD,BDSX:WORD,START_BDS:WORD
    27                              <1> 	EXTRN	FHAVEK09:BYTE, NEW_ROM:BYTE
    28                              <1> 	EXTRN	SINGLE:BYTE
    29                              <1> 	EXTRN	BDSMs:BYTE		;for Mini Disk -J.K. 4/7/86
    30                              <1> 	EXTRN	HaveCMOSClock:byte	;set by IBMINIT. Used by IBMCLOCK.ASM
    31                              <1> 	EXTRN	BinToBCD:word		;set by IBMINIT. Used by IBMCLOCK.ASM
    32                              <1> 	EXTRN	DaycntToDay:word	;set by IBMINIT. Used by IBMCLOCK.ASM
    33                              <1> 	EXTRN	OLD13:DWORD
    34                              <1> 	extrn	Temp_H:word		;J.K. For 32 bit calculation. IBMDISK
    35                              <1> 	extrn	Start_Sec_H:word	;J.K.  IBMDISK.
    36                              <1> 	extrn	KEYRD_Func:byte 	;J.K. For IBMCON. Defined in IBMBDATA.
    37                              <1> 	extrn	KEYSTS_Func:byte	;J.K. For IBMCON. Defined in IBMBDATA.
    38                              <1> 	extrn	DiskSector:byte 	;J.K. IBMBDATA
    39                              <1> 	extrn	Bpb_In_Sector:word	;J.K. IBMBDATA
    40                              <1> 	extrn	SecPerClusInSector:Byte ;J.K. IBMBDATA
    41                              <1> 	extrn	NumberOfFats:byte	;J.K. IBMBDATA
    42                              <1> 	extrn	MediaByte:byte		;J.K. IBMBDATA
    43                              <1> 	extrn	Ext_Boot_Sig:Byte	;J.K. IBMBDATA
    44                              <1> 	extrn	Boot_Serial_L:Word	;J.K. IBMBDATA
    45                              <1> 	extrn	Boot_Serial_H:Word	;J.K. IBMBDATA
    46                              <1> 	extrn	Boot_Volume_Label:Byte	;J.K. IBMBDATA
    47                              <1> 	extrn	Boot_System_ID:Byte	;J.K. IBMBDATA
    48                              <1> 	extrn	Fat_12_ID:Byte		;J.K. IBMDISK
    49                              <1> 	extrn	Fat_16_ID:Byte		;J.K. IBMDISK
    50                              <1> 	extrn	lbapacket:byte
    51                              <1> 	extrn	Vol_No_Name:Byte	;J.K. IBMDISK
    52                              <1> 	extrn	MOTORSTARTUP:Byte	;J.K. IBMBDATA
    53                              <1> 	extrn	DoubleWordMov:Byte	;J.K. IBMDISK
    54                              <1> 	extrn	Model_Byte:Byte 	;J.K. IBMBIO2
    55                              <1> 	extrn	Secondary_Model_Byte:Byte ;J.K. IBMBIO2
    56                              <1> 
    57                              <1> 	%IF     itest
    58                              <1> 	    EXTRN   NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD
    59                              <1> 	%ENDIF
    60                              <1> 
    61                              <1> 	EXTRN	START$:NEAR,ERROUT:NEAR,BLOCK13:FAR,INT19:FAR
    62                              <1> 	EXTRN	INTRET:NEAR,HDRIVE:NEAR,DRIVEX:NEAR,INT13:FAR,CBREAK:NEAR,OUTCHR:NEAR
    63                              <1> 	EXTRN	DISKRD:NEAR,MEDIA_PATCH:NEAR,GETBP1_PATCH:NEAR
    64                              <1> 	EXTRN	SET_PATCH:NEAR,DISKIO_PATCH:NEAR,DSKERR:NEAR,INIT_PATCH:NEAR
    65                              <1> 	extern DSKERR_PATCH
    66                              <1> 	EXTRN	TABLE_PATCH:NEAR,EXIT:NEAR,CHANGED_PATCH:NEAR
    67                              <1> 	EXTRN	ERRIN:NEAR,GETBP:NEAR,SWPDSK:NEAR
    68                              <1> 	EXTRN	OUTCHR:NEAR,WRMSG:NEAR,TIME_TO_TICKS:NEAR
    69                              <1> 	EXTRN	INT2F_DISK:NEAR,INSTALL_BDS:NEAR,SETDRIVE:NEAR
    70                              <1> 	extrn	Mov_Media_IDs:Near			;J.K.
    71                              <1> 	extrn	Clear_IDs:Near				;J.K.
    72                              <1> 	%IF     itest
    73                              <1> 	    EXTRN   MSGNUM:NEAR,MSGOUT:NEAR,dumpbytes:near,hex_to_ascii:near
    74                              <1> 	    EXTRN   outchar:near
    75                              <1> 	%ENDIF
    76                              <1> 	extrn	lbatochs:near, chstotuple:near
    77                              <1> 	extrn	lba_packet_setup:near
    78                              <1> 
    79                              <1> 	EXTRN	behind_dosentry_segment:WORD
    80                              <1> 	EXTRN	DEVICE_LIST:DWORD
    81                              <1> 	EXTRN	MEMORY_SIZE:WORD
    82                              <1> 	EXTRN	DEFAULT_DRIVE:BYTE
    83                              <1> 	EXTRN	BUFFERS:WORD
    84                              <1> 	EXTRN	SYSINIT:FAR
    85                              <1> 	extrn	Big_Media_Flag:Byte		;AN001;
    86                              <1> 
    87                              <1> ; END OF DISK MODULES FOR CONFIGURATION
    88                              <1> 
    89                              <1> 	EXTRN	END96TPI:BYTE
    90                              <1> 	EXTRN	ENDTWOHARD:BYTE
    91                              <1> 	EXTRN	ENDONEHARD:BYTE
    92                              <1> 	EXTRN	ENDSWAP:BYTE
    93                              <1> 	EXTRN	ENDFLOPPY:BYTE
    94                              <1> 
    95                              <1> ; IBM FIXED UP AT ROM
    96                              <1> 
    97                              <1> 	EXTRN	IBM_DISK_IO:FAR
    16                                  	%include "msequ.mac"
     1                              <1> %warning out: MSEQU.INC...
     1          ******************  <1>  warning: out: MSEQU.INC... [-w+user]
     2                              <1> ;==============================================================================
     3                              <1> 
     4                              <1> FTOOBIG 	EQU	80H
     5                              <1> FBIG		EQU	40H
     6                              <1> ROMSTATUS	EQU	1
     7                              <1> ROMREAD 	EQU	2
     8                              <1> ROMWRITE	EQU	3
     9                              <1> ROMVERIFY	EQU	4
    10                              <1> ROMFORMAT	EQU	5
    11                              <1> VID_SIZE	EQU 12
    12                              <1> 
    13                              <1> %include "msbds.mac"    ; VARIOUS EQUATES FOR BDS
     1                              <2> 
     2                              <2> %warning out: MSBDS.INC...
     2          ******************  <2>  warning: out: MSBDS.INC... [-w+user]
     3                              <2> ;	SCCSID = @(#)IBMBDS.ASM 1.9 85/09/16
     4                              <2> ;==============================================================================
     5                              <2> ;REVISION HISTORY:
     6                              <2> ;AN000 - New for DOS Version 4.00 - J.K.
     7                              <2> ;AC000 - Changed for DOS Version 4.00 - J.K.
     8                              <2> ;AN00x - PTM number for DOS Version 4.00 - J.K.
     9                              <2> ;==============================================================================
    10                              <2> ;AN001; D113 Disable I/O access to unformatted media		    9/03/87 J.K.
    11                              <2> ;==============================================================================
    12                              <2> 
    13                              <2> ; VALUES FOR VARIOUS FLAGS IN BDS.FLAGS.
    14                              <2> 
    15                              <2> FNON_REMOVABLE	    EQU     01H 	;FOR NON-REMOVABLE MEDIA
    16                              <2> FCHANGELINE	    EQU     02H 	;IF CHANGELINE SUPPORTED ON DRIVE
    17                              <2> RETURN_FAKE_BPB     EQU     04H 	; WHEN SET, DON'T DO A BUILD BPB
    18                              <2> 					; JUST RETURN THE FAKE ONE
    19                              <2> GOOD_TRACKLAYOUT    EQU     08H 	; THE TRACK LAYOUT HAS NO FUNNY SECTORS
    20                              <2> ; FCHANGED_BY_FORMAT  EQU	    08H
    21                              <2> FI_AM_MULT	    EQU     10H 	;IF MORE THAN ONE LOGICAL FOR THIS PHYSICAL
    22                              <2> FI_OWN_PHYSICAL     EQU     20H 	;SIGNIFY LOGICAL OWNER OF THIS PHYSICAL
    23                              <2> FCHANGED	    EQU     40H 	;INDICATES MEDIA CHANGED
    24                              <2> SET_DASD_TRUE	    EQU     80H 	; SET DASD BEFORE NEXT FORMAT
    25                              <2> FCHANGED_BY_FORMAT  EQU    100H 	;MEDIA CHANGED BY FORMAT
    26                              <2> UNFORMATTED_MEDIA   EQU    200H 	;AN001; Fixed disk only
    27                              <2> F_LBA		equ	400h		; LBA supported
    28                              <2> 
    29                              <2> LBAPACKETSTRUC struc
    30 00000000 ????                <2> lpSize		dw ?
    31 00000002 ????                <2> lpCount		dw ?
    32 00000004 ????????            <2> lpBuffer	dd ?
    33 00000008 ????????????????    <2> lpSector	dd ?,?
    34                              <2> LBAPACKETSTRUC ends
    35                              <2> 
    36                              <2> ;
    37                              <2> ; VARIOUS FORM FACTORS TO DESCRIBE MEDIA
    38                              <2> ;
    39                              <2> FF48TPI 	    EQU     0
    40                              <2> FF96TPI 	    EQU     1
    41                              <2> FFSMALL 	    EQU     2
    42                              <2> FFHARDFILE	    EQU     5
    43                              <2> FFOTHER 	    EQU     7
    44                              <2> 
    45                              <2> BDS_TYPE	STRUC
    46 00000000 ????????            <2> LINK		DD		?	; LINK TO NEXT BDS
    47 00000004 ??                  <2> DRIVENUM	DB		?	; INT 13 DRIVE NUMBER
    48 00000005 ??                  <2> DRIVELET	DB		?	; DOS DRIVE NUMBER
    49 00000006 ????                <2> BYTEPERSEC	DW		?	; NUMBER OF BYTES/SEC
    50 00000008 ??                  <2> SECPERCLUS	DB		?	; SEC PER ALLOCATION UNIT
    51 00000009 ????                <2> RESSEC		DW		?	; NUMBER OF RESERVED SECTORS
    52 0000000B ??                  <2> CFAT		DB		?	; NUMBER OF FATS
    53 0000000C ????                <2> CDIR		DW		?	; NUMBER OF DIRECTORY ENTRIES
    54 0000000E ????                <2> DRVLIM		DW		?	; NUMBER OF SECTORS ON MEDIUM
    55 00000010 ??                  <2> MEDIAD		DB		?	; MEDIA DESCRIPTOR BYTE
    56 00000011 ????                <2> CSECFAT 	DW		?	; NUMBER OF SECTORS/FAT
    57 00000013 ????                <2> SECLIM		DW		?	; SECTORS PER TRACK
    58 00000015 ????                <2> HDLIM		DW		?	; MAX NUMBER OF HEADS
    59 00000017 ????                <2> HIDSEC_L	DW		?	; NUMBER OF HIDDEN SECTORS
    60 00000019 ????                <2> HIDSEC_H	dw		? ;0	;J.K.87
    61 0000001B ????                <2> DRVLIM_L	dw		? ;0	;J.K.87
    62 0000001D ????                <2> DRVLIM_H	dw		? ;0	;J.K.87
    63 0000001F ??                  <2> FATSIZ		DB		?	; FLAGS...
    64 00000020 ????                <2> OPCNT		DW		?	; OPEN REF. COUNT
    65 00000022 ??                  <2> FORMFACTOR	DB		?	; FORM FACTOR INDEX
    66 00000023 ????                <2> FLAGS		DW		?	; VARIOUS FLAGS
    67 00000025 ????                <2> CCYLN		DW		?	; MAX NUMBER OF CYLINDERS
    68 00000027 ????                <2> RBYTEPERSEC	DW		?	; RECOMMENDED BPB
    69 00000029 ??                  <2> RSECPERCLUS	DB		?
    70 0000002A ????                <2> RRESSEC 	DW		?
    71 0000002C ??                  <2> RCFAT		DB		?
    72 0000002D ????                <2> RCDIR		DW		?
    73 0000002F ????                <2> RDRVLIM 	DW		?
    74 00000031 ??                  <2> RMEDIAD 	DB		?
    75 00000032 ????                <2> RCSECFAT	DW		?
    76 00000034 ????                <2> RSECLIM 	DW		?
    77 00000036 ????                <2> RHDLIM		DW		?
    78 00000038 ????                <2> RHIDSEC_L	DW		?
    79 0000003A ????                <2> RHIDSEC_H	DW		? ;0	;J.K.87
    80 0000003C ????                <2> RDRVLIM_L	dw		? ;0	;J.K.87
    81 0000003E ????                <2> RDRVLIM_H	dw		? ;0	;J.K.87
    82 00000040 ????????????        <2> RESERVE 	DB		6 DUP (?)	; RESERVED FOR FUTURE
    83 00000046 ??                  <2> TRACK		DB		?	; LAST TRACK ACCESSED ON DRIVE
    84 00000047 ????                <2> TIM_LO		DW		?	; TIME OF LAST ACCESS. KEEP
    85 00000049 ????                <2> TIM_HI		DW		?	; THESE CONTIGUOUS.
    86 0000004B <res Ch>            <2> VOLID		DB		12 DUP (?)	; VOLUME ID OF MEDIUM
    87 00000057 ????????            <2> VOL_SERIAL	dd	? ;0	  ;J.K.87 Current volume serial number from Boot record
    88 0000005B <res 9h>            <2> FILESYS_Id	db	9 dup (?) ;(0) ;J.K.87 Current file system id from Boot record
    89                              <2> BDS_TYPE	ENDS
    90                              <2> 
    91                              <2> BPBSIZE     equ	TRACK - RBYTEPERSEC ; SIZE IN BYTES OF RECBPB AREA IN THE BDS
    92                              <2> 
    93                              <2> 
    94                              <2> ;*********************************************************************
    95                              <2> ;	BDS structure for mini disk - J.K. 4/7/86
    96                              <2> ;*********************************************************************
    97                              <2> 
    98                              <2> BDSM_type	struc
    99 00000000 ????                <2> mlink		DW	? ;-1			;Link to next structure
   100 00000002 ????                <2> 		DW	?
   101 00000004 ??                  <2> mdriveNum	DB	? ;80			;Int 13 Drive Number
   102 00000005 ??                  <2> mdriveLet	DB	? ;3			;Logical Drive Number
   103 00000006 ????                <2> mBytePerSec	DW	? ;512
   104 00000008 ??                  <2> mSecPerClus	DB	? ;1			;Sectors/allocation unit
   105 00000009 ????                <2> mRESSEC 	DW	? ;1			;Reserved sectors for DOS
   106 0000000B ??                  <2> mcFAT		DB	? ;2			;No. of allocation tables
   107 0000000C ????                <2> mcDIR		DW	? ;16			;Number of directory entries
   108 0000000E ????                <2> mDRVLIM 	DW	? ;0			;Number of sectors (at 512 bytes each)
   109 00000010 ??                  <2> mMediad 	DB	? ;11111000B		;Media descriptor
   110 00000011 ????                <2> mcSecFat	DW	? ;1			;Number of FAT sectors
   111 00000013 ????                <2> mSECLIM 	DW	? ;0			;Sector limit
   112 00000015 ????                <2> mHDLIM		DW	? ;0			;Head limit
   113 00000017 ????                <2> mHIDSEC_L	DW	? ;0			;Hidden sector count
   114 00000019 ????                <2> mHidsec_H	dw	? ;0			;J.K.87
   115 0000001B ????                <2> mDrvlim_L	dw	? ;0			;J.K.87
   116 0000001D ????                <2> mDrvlim_H	dw	? ;0			;J.K.87
   117 0000001F ??                  <2> mFatSiz 	DB	? ;0			;TRUE => bigfat
   118 00000020 ????                <2> mOPCNT		DW	? ;0			;Open Ref. Count
   119 00000022 ??                  <2> mFormFactor	DB	? ;3			;Form Factor
   120 00000023 ????                <2> mFLAGS		DW	? ;0020H		;Various Flags
   121 00000025 ????                <2> mcCyln		dw	? ;40			;max number of cylinders
   122 00000027 <res 1Fh>           <2> mRecBPB 	db	31 dup (?) ;(0)		;Recommended BPB for drive
   123 00000046 ??                  <2> mTrack		db	? ;-1
   124 00000047 ????                <2> IsMini		dw	? ;1			;Overlapping TIM_LOH
   125 00000049 ????                <2> Hidden_Trks	dw	? ;0			;Overlapping TIM_HIH
   126 0000004B <res Bh>            <2> mVOLID		DB	11 dup (?) ;"NO NAME    "           ;Volume ID for this disk
   127 00000056 ??                  <2> 		DB	? ;0			;ASCIZII for "NO NAME    "
   128 00000057 ????????            <2> mVol_Serial	dd	? ;0	   ;Current volume serial number from Boot record
   129 0000005B ????????????????    <2> mFileSys_Id	db	8 dup (?) ;"FAT12   " ;Current file system id from Boot record
   130 00000063 ??                  <2> 		db	? ;0
   131                              <2> 
   132                              <2> BDSM_type	ENDS
   133                              <2> ;******************************************************************************
   134                              <2> Max_mini_dsk_num equ 23	      ;J.K. 4/7/86 - max # of mini disk ibmbio can support
   135                              <2> ;
   136                              <2> 
    14                              <1> 
    15                              <1> ;AN000; Extended BPB structure.
    16                              <1> BPB_TYPE STRUC
    17 00000000 ????                <1> SECSIZE DW	?
    18 00000002 ??                  <1> SECALL	DB	?
    19 00000003 ????                <1> RESNUM	DW	?
    20 00000005 ??                  <1> FATNUM	DB	?
    21 00000006 ????                <1> DIRNUM	DW	?
    22 00000008 ????                <1> SECNUM	DW	?
    23 0000000A ??                  <1> FATID	DB	?
    24 0000000B ????                <1> FATSIZE DW	?
    25 0000000D ????                <1> SLIM	DW	?
    26 0000000F ????                <1> HLIM	DW	?
    27 00000011 ????                <1> HIDDEN_L  DW	  ?
    28 00000013 ????                <1> HIDDEN_H  dw	  ? ;0			;J.K.
    29 00000015 ????                <1> SECNUM_L  dw	  ? ;0			;J.K.
    30 00000017 ????                <1> SECNUM_H  dw	  ? ;0			;J.K.
    31                              <1> BPB_TYPE ENDS
    32                              <1> 
    33                              <1> ;;;;;;;;;;;
    34                              <1> BOOT_SERIAL_SIZE	equ	4	;J.K.
    35                              <1> BOOT_VOLUME_LABEL_SIZE	equ	11	;J.K.
    36                              <1> BOOT_SYSTEM_ID_SIZE	equ	8	;J.K.
    37                              <1> EXT_BOOT_SIGNATURE	equ	41	;J.K.
    38                              <1> RSINIT equ 0A3H		      ;RS232 INITIALIZATION
    39                              <1> 			      ;9600 BAUD:NO PARITY:1 STOP:8 BIT WORD
    40                              <1> LF equ 10			      ;LINE FEED
    41                              <1> CR equ 13			      ;CARRIAGE RETURN
    42                              <1> BACKSP equ 8		      ;BACKSPACE
    43                              <1> BRKADR equ 1BH * 4		      ;006C  1BH BREAK VECTOR ADDRESS
    44                              <1> TIMADR equ 1CH * 4		      ;0070  1CH TIMER INTERRUPT
    45                              <1> DSKADR equ 1EH * 4		      ;ADDRESS OF PTR TO DISK PARAMETERS
    46                              <1> SEC9 equ 522H		      ;ADDRESS OF DISK PARAMETERS
    47                              <1> HEADSETTLE equ SEC9+9	      ; ARR 2.20 ADDRESS OF HEAD SETTLE TIME
    48                              <1> NORMSETTLE equ 15		      ; ARR 2.20 NORMAL HEAD SETTLE
    49                              <1> SPEEDSETTLE equ 0		      ; ARR 2.20 SPEED UP SETTLE TIME
    50                              <1> INITSPOT equ 534H		      ; ARR IBM WANTS 4 ZEROS HERE
    51                              <1> AKPORT equ 20H
    52                              <1> EOI equ 20H
    53                              <1> CMDLEN	equ	    0			    ;LENGTH OF THIS COMMAND
    54                              <1> UNIT	equ	    1			    ;SUB UNIT SPECIFIER
    55                              <1> CMD	equ	    2			    ;COMMAND CODE
    56                              <1> STATUS	equ	    3			    ;STATUS
    57                              <1> MEDIA	equ	    13			    ;MEDIA DESCRIPTOR
    58                              <1> TRANS	equ	    14			    ;TRANSFER ADDRESS
    59                              <1> COUNT	equ	    18			    ;COUNT OF BLOCKS OR CHARACTERS
    60                              <1> START	equ	    20			    ;FIRST BLOCK TO TRANSFER
    61                              <1> EXTRA	equ	    22			    ;USUALLY A POINTER TO VOL ID FOR ERROR 15
    62                              <1> CHROUT	equ	    29H
    63                              <1> MAXERR	equ	     5
    64                              <1> LSTDRV	equ	     504H
    65                              <1> 
    66                              <1> NOTBUSYSTATUS	equ	10000000B	    ; NOT BUSY
    67                              <1> ACKSTATUS	equ	01000000B	    ; ACKNOWLEDGE (FOR WHAT?)
    68                              <1> NOPAPERSTATUS	equ	00100000B	    ; NO MORE PAPER
    69                              <1> SELECTEDSTATUS	equ	00010000B	    ; THE PRINTER SAID IT WAS SELECTED
    70                              <1> IOERRSTATUS	equ	00001000B	    ; SOME KINDA ERROR
    71                              <1> RESERVED	equ	00000110B	    ; NOPS
    72                              <1> TIMEOUTSTATUS	equ	00000001B	    ; TIME OUT.
    73                              <1> ERROR_UNKNOWN_MEDIA   equ 7		    ; FOR USE IN BUILD BPB CALL
    74                              <1> 
    75                              <1> PATHGEN 	equ	1
    17                                  	%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
    18                                  	%include "devsym.mac"
     1                              <1> 	%warning out: DEVSYM.INC...
     1          ******************  <1>  warning: out: DEVSYM.INC... [-w+user]
     2                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     3                              <1> ;	SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04
     4                              <1> 
     5                              <1> ; THE DEVICE TABLE LIST HAS THE FORM:
     6                              <1> SYSDEV	       STRUC
     7 00000000 ????????            <1> SDEVNEXT       DD    ?		    ;POINTER TO NEXT DEVICE HEADER
     8 00000004 ????                <1> SDEVATT        DW    ?		    ;ATTRIBUTES OF THE DEVICE
     9 00000006 ????                <1> SDEVSTRAT      DW    ?		    ;STRATEGY ENTRY POINT
    10 00000008 ????                <1> SDEVINT        DW    ?		    ;INTERRUPT ENTRY POINT
    11 0000000A ????????????????    <1> SDEVNAME       DB    8 DUP (?)	    ;NAME OF DEVICE (ONLY FIRST BYTE USED FOR BLOCK)
    12                              <1> SYSDEV	       ENDS
    13                              <1> 
    14                              <1> ;
    15                              <1> ; ATTRIBUTE BIT MASKS
    16                              <1> ;
    17                              <1> ; CHARACTER DEVICES:
    18                              <1> ;
    19                              <1> ; BIT 15 -> MUST BE 1
    20                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    21                              <1> ;     13 -> 1 IF THE DEVICE SUPPORTS OUTPUT-UNTIL-BUSY
    22                              <1> ;     12 -> UNUSED
    23                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE
    24                              <1> ;     10 -> MUST BE 0
    25                              <1> ;      9 -> MUST BE 0
    26                              <1> ;      8 -> UNUSED
    27                              <1> ;      7 -> UNUSED
    28                              <1> ;      6 -> UNUSED
    29                              <1> ;      5 -> UNUSED
    30                              <1> ;      4 -> 1 IF DEVICE IS RECIPIENT OF INT 29H
    31                              <1> ;      3 -> 1 IF DEVICE IS CLOCK DEVICE
    32                              <1> ;      2 -> 1 IF DEVICE IS NULL DEVICE
    33                              <1> ;      1 -> 1 IF DEVICE IS CONSOLE OUTPUT
    34                              <1> ;      0 -> 1 IF DEVICE IS CONSOLE INPUT
    35                              <1> ;
    36                              <1> ; BLOCK DEVICES:
    37                              <1> ;
    38                              <1> ; BIT 15 -> MUST BE 0
    39                              <1> ;     14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS
    40                              <1> ;     13 -> 1 IF THE DEVICE DETERMINES MEDIA BY EXAMINING THE FAT ID BYTE.
    41                              <1> ;	    THIS REQUIRES THE FIRST SECTOR OF THE FAT TO *ALWAYS* RESIDE IN
    42                              <1> ;	    THE SAME PLACE.
    43                              <1> ;     12 -> UNUSED
    44                              <1> ;     11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE/REMOVABLE MEDIA
    45                              <1> ;     10 -> MUST BE 0
    46                              <1> ;      9 -> MUST BE 0
    47                              <1> ;      8 -> UNUSED
    48                              <1> ;      7 -> UNUSED
    49                              <1> ;      6 -> IF DEVICE HAS SUPPORT FOR GETMAP/SETMAP OF LOGICAL DRIVES.
    50                              <1> ;	    IF THE DEVICE UNDERSTANDS GENERIC IOCTL FUNCTION CALLS.
    51                              <1> ;      5 -> UNUSED
    52                              <1> ;      4 -> UNUSED
    53                              <1> ;      3 -> UNUSED
    54                              <1> ;      2 -> UNUSED
    55                              <1> ;      1 -> UNUSED
    56                              <1> ;      0 -> UNUSED
    57                              <1> ;
    58                              <1> 
    59                              <1> DEVTYP	       EQU   8000H	    ; BIT 15 - 1  IF CHAR, 0 IF BLOCK
    60                              <1> CHARDEV        EQU   8000H
    61                              <1> DEVIOCTL       EQU   4000H	    ; BIT 14 - CONTROL MODE BIT
    62                              <1> ISFATBYDEV     EQU   2000H	    ; BIT 13 - DEVICE USES FAT ID BYTES,
    63                              <1> 				    ;  COMP MEDIA.
    64                              <1> OUTTILBUSY     EQU   2000H	    ; OUTPUT UNTIL BUSY IS ENABLED
    65                              <1> ISNET	       EQU   1000H	    ; BIT 12 - 1 IF A NET DEVICE, 0 IF
    66                              <1> 				    ;  NOT.  CURRENTLY BLOCK ONLY.
    67                              <1> DEVOPCL        EQU   0800H	    ; BIT 11 - 1 IF THIS DEVICE HAS
    68                              <1> 				    ;  OPEN,CLOSE AND REMOVABLE MEDIA
    69                              <1> 				    ;  ENTRY POINTS, 0 IF NOT
    70                              <1> 
    71                              <1> EXTENTBIT      EQU   0400H	    ; BIT 10 - CURRENTLY 0 ON ALL DEVS
    72                              <1> 				    ;  THIS BIT IS RESERVED FOR FUTURE USE
    73                              <1> 				    ;  TO EXTEND THE DEVICE HEADER BEYOND
    74                              <1> 				    ;  ITS CURRENT FORM.
    75                              <1> 
    76                              <1> ; NOTE BIT 9 IS CURRENTLY USED ON IBM SYSTEMS TO INDICATE "DRIVE IS SHARED".
    77                              <1> ;    SEE IOCTL FUNCTION 9. THIS USE IS NOT DOCUMENTED, IT IS USED BY SOME
    78                              <1> ;    OF THE UTILITIES WHICH ARE SUPPOSED TO FAIL ON SHARED DRIVES ON SERVER
    79                              <1> ;    MACHINES (FORMAT,CHKDSK,RECOVER,..).
    80                              <1> 
    81                              <1> DEV320	       EQU   0040H	    ;BIT 6 - FOR BLOCK DEVICES, THIS
    82                              <1> 				    ;DEVICE SUPPORTS SET/GET MAP OF
    83                              <1> 				    ;LOGICAL DRIVES, AND SUPPORTS
    84                              <1> 				    ;GENERIC IOCTL CALLS.
    85                              <1> 				    ;FOR CHARACTER DEVICES, THIS
    86                              <1> 				    ;DEVICE SUPPORTS GENERIC IOCTL.
    87                              <1> 				    ;THIS IS A DOS 3.2 DEVICE DRIVER.
    88                              <1> ISSPEC	       EQU   0010H	    ;BIT 4 - THIS DEVICE IS SPECIAL
    89                              <1> ISCLOCK        EQU   0008H	    ;BIT 3 - THIS DEVICE IS THE CLOCK DEVICE.
    90                              <1> ISNULL	       EQU   0004H	    ;BIT 2 - THIS DEVICE IS THE NULL DEVICE.
    91                              <1> ISCOUT	       EQU   0002H	    ;BIT 1 - THIS DEVICE IS THE CONSOLE OUTPUT.
    92                              <1> ISCIN	       EQU   0001H	    ;BIT 0 - THIS DEVICE IS THE CONSOLE INPUT.
    93                              <1> EXTDRVR        EQU   0002H	    ;BIT 1 - BLOCK DEVICE EXTNDED DRIVER
    94                              <1> 
    95                              <1> ;STATIC REQUEST HEADER
    96                              <1> SRHEAD	       STRUC
    97 00000000 ??                  <1> REQLEN	       DB    ?		    ;LENGTH IN BYTES OF REQUEST BLOCK
    98 00000001 ??                  <1> REQUNIT        DB    ?		    ;DEVICE UNIT NUMBER
    99 00000002 ??                  <1> REQFUNC        DB    ?		    ;TYPE OF REQUEST
   100 00000003 ????                <1> REQSTAT        DW    ?		    ;STATUS WORD
   101 00000005 ????????????????    <1> 	       DB    8 DUP(?)	    ;RESERVED FOR QUEUE LINKS
   102                              <1> SRHEAD	       ENDS
   103                              <1> 
   104                              <1> ;STATUS WORD MASKS
   105                              <1> STERR	       EQU   8000H	    ;BIT 15 - ERROR
   106                              <1> STBUI	       EQU   0200H	    ;BIT 9 - BUISY
   107                              <1> STDON	       EQU   0100H	    ;BIT 8 - DONE
   108                              <1> STECODE        EQU   00FFH	    ;ERROR CODE
   109                              <1> ;						  2/12/KK
   110                              <1> ; Interim  character identifier 		  2/12/KK
   111                              <1> Ddkey		EQU	0000010000000000B	; 2/12/KK
   112                              <1> 
   113                              <1> ;FUNCTION CODES
   114                              <1> DEVINIT        EQU   0		    ;INITIALIZATION
   115                              <1> DINITHL        EQU   26 	    ;SIZE OF INIT HEADER
   116                              <1> DEVMDCH        EQU   1		    ;MEDIA CHECK
   117                              <1> DMEDHL	       EQU   15 	    ;SIZE OF MEDIA CHECK HEADER
   118                              <1> DEVBPB	       EQU   2		    ;GET BPB
   119                              <1> DEVRDIOCTL     EQU   3		    ;IOCTL READ
   120                              <1> DBPBHL	       EQU   22 	    ;SIZE OF GET BPB HEADER
   121                              <1> DEVRD	       EQU   4		    ;READ
   122                              <1> DRDWRHL        EQU   22 	    ;SIZE OF RD/WR HEADER
   123                              <1> DEVRDND        EQU   5		    ;NON DESTRUCTIVE READ NO WAIT (CHARACTER DEVS)
   124                              <1> DRDNDHL        EQU   14 	    ;SIZE OF NON DESTRUCTIVE READ HEADER
   125                              <1> DEVIST	       EQU   6		    ;INPUT STATUS
   126                              <1> DSTATHL        EQU   13 	    ;SIZE OF STATUS HEADER
   127                              <1> DEVIFL	       EQU   7		    ;INPUT FLUSH
   128                              <1> DFLSHL	       EQU   15 	    ;SIZE OF FLUSH HEADER
   129                              <1> DEVWRT	       EQU   8		    ;WRITE
   130                              <1> DEVWRTV        EQU   9		    ;WRITE WITH VERIFY
   131                              <1> DEVOST	       EQU   10 	    ;OUTPUT STATUS
   132                              <1> DEVOFL	       EQU   11 	    ;OUTPUT FLUSH
   133                              <1> DEVWRIOCTL     EQU   12 	    ;IOCTL WRITE
   134                              <1> DEVOPN	       EQU   13 	    ;DEVICE OPEN
   135                              <1> DEVCLS	       EQU   14 	    ;DEVICE CLOSE
   136                              <1> DOPCLHL        EQU   13 	    ;SIZE OF OPEN/CLOSE HEADER
   137                              <1> DEVRMD	       EQU   15 	    ;REMOVABLE MEDIA
   138                              <1> REMHL	       EQU   13 	    ;SIZE OF REMOVABLE MEDIA HEADER
   139                              <1> GENIOCTL       EQU   19
   140                              <1> ; THE NEXT THREE ARE USED IN DOS 4.0
   141                              <1> ;		     20
   142                              <1> ;		     21
   143                              <1> ;		     22
   144                              <1> DEVGETOWN      EQU   23 	    ;GET DEVICE OWNER
   145                              <1> DEVSETOWN      EQU   24 	    ;SET DEVICE OWNER
   146                              <1> QUERYGENIOCTL equ 25		; query generic IOCTL support (MS-DOS v5+)
   147                              <1> OWNHL	       EQU   13 	    ;SIZE OF DEVICE OWNER HEADER
   148                              <1> 
   149                              <1> DEVOUT	       EQU   16 	    ; OUTPUT UNTIL BUSY.
   150                              <1> DEVOUTL        EQU   DEVWRT	    ; LENGTH OF OUTPUT UNTIL BUSY
   151                              <1> 
   152                              <1> ; GENERIC IOCTL REQUEST STRUCTURE
   153                              <1> ;	SEE THE DOS 4.0 DEVICE DRIVER SPEC FOR FURTHER ELABORATION.
   154                              <1> ;
   155                              <1> IOCTL_REQ      STRUC
   156 00000000 <res Dh>            <1> 	       DB    (SRHEAD_struc_size) DUP(?)
   157                              <1> 				    ; GENERIC IOCTL ADDITION.
   158 0000000D ??                  <1> MAJORFUNCTION  DB    ?		    ;FUNCTION CODE
   159 0000000E ??                  <1> MINORFUNCTION  DB    ?		    ;FUNCTION CATEGORY
   160 0000000F ????                <1> REG_SI	       DW    ?
   161 00000011 ????                <1> REG_DI	       DW    ?
   162 00000013 ????????            <1> GENERICIOCTL_PACKET DD ?	    ; POINTER TO DATA BUFFER
   163                              <1> IOCTL_REQ      ENDS
   164                              <1> 
   165                              <1> ;	DEFINITIONS FOR IOCTL_REQ.MINORFUNCTION
   166                              <1> GEN_IOCTL_WRT_TRK   EQU   40H
   167                              <1> GEN_IOCTL_RD_TRK    EQU   60H
   168                              <1> GEN_IOCTL_FN_TST    EQU   20H	    ; USED TO DIFF. BET READS AND WRTS
   169                              <1> 
   170                              <1> ;; 32-bit absolute read/write input list structure
   171                              <1> 
   172                              <1> ABS_32RW	 STRUC
   173 00000000 ????????            <1> SECTOR_RBA	 DD	 ?	    ; relative block address
   174 00000004 ????                <1> ABS_RW_COUNT	 DW	 ?	    ; number of sectors to be transferred
   175 00000006 ????????            <1> BUFFER_ADDR	 DD	 ?	    ; data addrress
   176                              <1> ABS_32RW	 ENDS
   177                              <1> 
   178                              <1> ;; media ID info
   179                              <1> 
   180                              <1> MEDIA_ID_INFO	 STRUC
   181 00000000 ????                <1> MEDIA_level	 DW	 ?	    ; info level
   182 00000002 ????????            <1> MEDIA_Serial	 DD	 ?	    ; serial #
   183 00000006 <res Bh>            <1> MEDIA_Label	 DB	 11 dup (?) ;volume label
   184 00000011 ????????????????    <1> MEDIA_System	 DB	 8  dup (?) ;system type
   185                              <1> MEDIA_ID_INFO	 ENDS
   186                              <1> 
   187                              <1> ;; equates for DOS34_FLAG
   188                              <1> 
   189                              <1> IFS_ABSRW	      EQU   00001H	   ;IFS absolute read/write
   190                              <1> NO_IFS_ABSRW	      EQU   0FFFEH	   ;no IFS absolute read/write
   191                              <1> IFS_DRIVE_RESET       EQU   00002H	   ;IFS drvive reset
   192                              <1> NO_IFS_DRIVE_RESET    EQU   0FFFDH	   ;no IFS drive reset
   193                              <1> FROM_DISK_RESET       EQU   00004H	   ;from disk reset
   194                              <1> NO_FROM_DISK_RESET    EQU   0FFFBH	   ;not from disk reset
   195                              <1> From_String_Output    EQU   00008H	   ;from con string output
   196                              <1> NO_From_String_Output EQU   0FFF7H	   ;not from con string output
   197                              <1> From_DOS_WRITE	      EQU   00010H	   ;from dos_write
   198                              <1> NO_From_DOS_WRITE     EQU   0FFEFH	   ;not from dos_write
   199                              <1> Force_I24_Fail	      EQU   00020H	   ;form IFS CALL BACK
   200                              <1> NO_Force_I24_Fail     EQU   0FFDFH	   ;not form IFS CALL BACK
   201                              <1> Disable_EOF_I24       EQU   00040H	   ;disable EOF int24 for input status
   202                              <1> NO_Disable_EOF_I24    EQU   0FFBFH	   ;disable EOF int24 for input status
   203                              <1> DBCS_VOLID	      EQU   00080H	   ;indicate from volume id
   204                              <1> DBCS_VOLID2	      EQU   00100H	   ;indicate 8th char is DBCS
   205                              <1> CTRL_BREAK_FLAG       EQU   00200H	   ;indicate control break is input
   206                              <1> NO_CTRL_BREAK_FLAG    EQU   0FDFFH	   ;reset control break
   207                              <1> SEARCH_FASTOPEN       EQU   00400H	   ;set fastopen flag for search
   208                              <1> X25_special	      EQU   00800H	   ;flag for X25 driver
    19                                  	%include "ioctl.mac"
     1                              <1> 
     2                              <1> %warning out: IOCTL.INC...
     2          ******************  <1>  warning: out: IOCTL.INC... [-w+user]
     3                              <1> ; THESE ARE ALL THE IMPORTANT STRUCTURES AND EQUATES FOR IOCTL
     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; D241 Provide support of Multi-track Format/Verify	   9/23/87 J.K.
    11                              <1> ;AN002; P1535 Unformatted hard file problem			  10/15/87 J.K.
    12                              <1> ;AN003; D490 IOCTL subfunction 63h,43h,64h,44h conflicts with OS2  2/26/88 J.K.
    13                              <1> ;==============================================================================
    14                              <1> 
    15                              <1> ;*** J.K.
    16                              <1> ;General Guide -
    17                              <1> ;Category Code:
    18                              <1> ; 0... .... DOS Defined
    19                              <1> ; 1... .... User defined
    20                              <1> ; .xxx xxxx Code
    21                              <1> 
    22                              <1> ;Function Code:
    23                              <1> ; 0... .... Return error if unsupported
    24                              <1> ; 1... .... Ignore if unsupported
    25                              <1> ; .0.. .... Intercepted by DOS
    26                              <1> ; .1.. .... Passed to driver
    27                              <1> ; ..0. .... Sends data/commands to device
    28                              <1> ; ..1. .... Quries data/info from device
    29                              <1> ; ...x .... Subfunction
    30                              <1> ;
    31                              <1> ; Note that "Sends/queries" data bit is intended only to regularize the
    32                              <1> ; function set.  It plays no critical role; some functions may contain both
    33                              <1> ; command and query elements. The convention is that such commands are
    34                              <1> ; defined as "sends data".
    35                              <1> 
    36                              <1> ;*****************************;*
    37                              <1> ; BLOCK DRIVERS 	      ;*
    38                              <1> ;*****************************;*
    39                              <1> 
    40                              <1> ; IOCTL SUB-FUNCTIONS
    41                              <1> IOCTL_GET_DEVICE_INFO	EQU	0
    42                              <1> IOCTL_SET_DEVICE_INFO	EQU	1
    43                              <1> IOCTL_READ_HANDLE	EQU	2
    44                              <1> IOCTL_WRITE_HANDLE	EQU	3
    45                              <1> IOCTL_READ_DRIVE	EQU	4
    46                              <1> IOCTL_WRITE_DRIVE	EQU	5
    47                              <1> IOCTL_GET_INPUT_STATUS	EQU	6
    48                              <1> IOCTL_GET_OUTPUT_STATUS EQU	7
    49                              <1> IOCTL_CHANGEABLE?	EQU	8
    50                              <1> IOCTL_DeviceLocOrRem?	EQU	9
    51                              <1> IOCTL_HandleLocOrRem?	EQU	0Ah   ;10
    52                              <1> IOCTL_SHARING_RETRY	EQU	0Bh   ;11
    53                              <1> GENERIC_IOCTL_HANDLE	EQU	0Ch   ;12
    54                              <1> GENERIC_IOCTL		EQU	0Dh   ;13
    55                              <1> 
    56                              <1> ; GENERIC IOCTL CATEGORY CODES
    57                              <1> IOC_OTHER		EQU	0	; Other device control J.K. 4/29/86
    58                              <1> IOC_SE			EQU	1	; SERIAL DEVICE CONTROL
    59                              <1> IOC_TC			EQU	2	; TERMINAL CONTROL
    60                              <1> IOC_SC			EQU	3	; SCREEN CONTROL
    61                              <1> IOC_KC			EQU	4	; KEYBOARD CONTROL
    62                              <1> IOC_PC			EQU	5	; PRINTER CONTROL
    63                              <1> IOC_DC			EQU	8	; DISK CONTROL (SAME AS RAWIO)
    64                              <1> 
    65                              <1> ; GENERIC IOCTL SUB-FUNCTIONS
    66                              <1> RAWIO			EQU	8
    67                              <1> 
    68                              <1> ; RAWIO SUB-FUNCTIONS
    69                              <1> GET_DEVICE_PARAMETERS	EQU	60H
    70                              <1> SET_DEVICE_PARAMETERS	EQU	40H
    71                              <1> READ_TRACK		EQU	61H
    72                              <1> WRITE_TRACK		EQU	41H
    73                              <1> VERIFY_TRACK		EQU	62H
    74                              <1> FORMAT_TRACK		EQU	42H
    75                              <1> GET_MEDIA_ID		EQU	66h		;AN000;AN003;changed from 63h
    76                              <1> SET_MEDIA_ID		EQU	46h		;AN000;AN003;changed from 43h
    77                              <1> GET_ACCESS_FLAG 	EQU	67h		;AN002;AN003;Unpublished function.Changed from 64h
    78                              <1> SET_ACCESS_FLAG 	EQU	47h		;AN002;AN003;Unpublished function.Changed from 44h
    79                              <1> 
    80                              <1> ; SPECIAL FUNCTION FOR GET DEVICE PARAMETERS
    81                              <1> BUILD_DEVICE_BPB	EQU	000000001B
    82                              <1> 
    83                              <1> ; SPECIAL FUNCTIONS FOR SET DEVICE PARAMETERS
    84                              <1> INSTALL_FAKE_BPB	EQU	000000001B
    85                              <1> ONLY_SET_TRACKLAYOUT	EQU	000000010B
    86                              <1> TRACKLAYOUT_IS_GOOD	EQU	000000100B
    87                              <1> 
    88                              <1> ; SPECIAL FUNCTION FOR FORMAT TRACK
    89                              <1> STATUS_FOR_FORMAT		EQU	000000001B
    90                              <1> DO_FAST_FORMAT			equ	000000010B	;AN001;
    91                              <1> ; CODES RETURNED FROM FORMAT STATUS CALL
    92                              <1> FORMAT_NO_ROM_SUPPORT		EQU	000000001B
    93                              <1> FORMAT_COMB_NOT_SUPPORTED	EQU	000000010B
    94                              <1> 
    95                              <1> ; DEVICETYPE VALUES
    96                              <1> MAX_SECTORS_IN_TRACK	EQU	63	; MAXIMUM SECTORS ON A DISK.(Was 40 in DOS 3.2)
    97                              <1> DEV_5INCH		EQU	0
    98                              <1> DEV_5INCH96TPI		EQU	1
    99                              <1> DEV_3INCH720KB		EQU	2
   100                              <1> DEV_8INCHSS		EQU	3
   101                              <1> DEV_8INCHDS		EQU	4
   102                              <1> DEV_HARDDISK		EQU	5
   103                              <1> DEV_OTHER		EQU	7
   104                              <1> 
   105                              <1> MAX_DEV_TYPE		EQU	7	; MAXIMUM DEVICE TYPE THAT WE
   106                              <1> 					; CURRENTLY SUPPORT.
   107                              <1> 
   108                              <1> %include "bpb.mac"
     1                              <2> 	%warning out: BPB.INC...
     1          ******************  <2>  warning: out: BPB.INC... [-w+user]
     2                              <2> ;	SCCSID = @(#)BPB.ASM	1.1 85/04/29
     3                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
     4                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
     5                              <2> ;									   ;
     6                              <2> 
     7                              <2> ; BIOS PARAMETER BLOCK DEFINITION
     8                              <2> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB
     9                              <2> 
    10                              <2> BPBLOCK STRUC
    11 00000000 ????                <2> BPSECSZ DW	?			; SIZE IN BYTES OF PHYSICAL SECTOR
    12 00000002 ??                  <2> BPCLUS	DB	?			; SECTORS/ALLOC UNIT
    13 00000003 ????                <2> BPRES	DW	?			; NUMBER OF RESERVED SECTORS
    14 00000005 ??                  <2> BPFTCNT DB	?			; NUMBER OF FATS
    15 00000006 ????                <2> BPDRCNT DW	?			; NUMBER OF DIRECTORY ENTRIES
    16 00000008 ????                <2> BPSCCNT DW	?			; TOTAL NUMBER OF SECTORS
    17 0000000A ??                  <2> BPMEDIA DB	?			; MEDIA DESCRIPTOR BYTE
    18 0000000B ????                <2> BPFTSEC DW	?			; NUMBER OF SECTORS TAKEN UP BY ONE FAT
    19                              <2> BPBLOCK ENDS
    20                              <2> 
    21                              <2> A_BPB			STRUC
    22 00000000 ????                <2> BPB_BYTESPERSECTOR	DW	?
    23 00000002 ??                  <2> BPB_SECTORSPERCLUSTER	DB	?
    24 00000003 ????                <2> BPB_RESERVEDSECTORS	DW	?
    25 00000005 ??                  <2> BPB_NUMBEROFFATS	DB	?
    26 00000006 ????                <2> BPB_ROOTENTRIES 	DW	?
    27 00000008 ????                <2> BPB_TOTALSECTORS	DW	?
    28 0000000A ??                  <2> BPB_MEDIADESCRIPTOR	DB	?
    29 0000000B ????                <2> BPB_SECTORSPERFAT	DW	?
    30 0000000D ????                <2> BPB_SECTORSPERTRACK	DW	?
    31 0000000F ????                <2> BPB_HEADS		DW	?
    32 00000011 ????                <2> BPB_HIDDENSECTORS	DW	?
    33 00000013 ????                <2> 			DW	?
    34 00000015 ????                <2> BPB_BIGTOTALSECTORS	DW	?
    35 00000017 ????                <2> 			DW	?
    36 00000019 ????????????        <2> 			DB	6 DUP(?)
    37                              <2> A_BPB			ENDS
    38                              <2> ;									   ;
    39                              <2> ;	     C	A  V  E  A  T	  P  R	O  G  R  A  M  M  E  R		   ;
    40                              <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
   109                              <1> 
   110                              <1> A_SECTORTABLE	    STRUC
   111 00000000 ????                <1> ST_SECTORNUMBER 	DW	?
   112 00000002 ????                <1> ST_SECTORSIZE		DW	?
   113                              <1> A_SECTORTABLE	    ENDS
   114                              <1> 
   115                              <1> A_DEVICEPARAMETERS  STRUC
   116 00000000 ??                  <1> DP_SPECIALFUNCTIONS	DB	?
   117 00000001 ??                  <1> DP_DEVICETYPE		DB	?
   118 00000002 ????                <1> DP_DEVICEATTRIBUTES	DW	?
   119 00000004 ????                <1> DP_CYLINDERS		DW	?
   120 00000006 ??                  <1> DP_MEDIATYPE		DB	?
   121 00000007 <res 1Fh>           <1> DP_BPB			DB	A_BPB_struc_size DUP (?)
   122 00000026 ????                <1> DP_TRACKTABLEENTRIES	DW	?
   123 00000028 <res FCh>           <1> DP_SECTORTABLE		DB MAX_SECTORS_IN_TRACK * A_SECTORTABLE_struc_size DUP (?)
   124                              <1> A_DEVICEPARAMETERS  ENDS
   125                              <1> 
   126                              <1> A_TRACKREADWRITEPACKET STRUC
   127 00000000 ??                  <1> TRWP_SPECIALFUNCTIONS	DB	?
   128 00000001 ????                <1> TRWP_HEAD		DW	?
   129 00000003 ????                <1> TRWP_CYLINDER		DW	?
   130 00000005 ????                <1> TRWP_FIRSTSECTOR	DW	?
   131 00000007 ????                <1> TRWP_SECTORSTOREADWRITE DW	?
   132 00000009 ????????            <1> TRWP_TRANSFERADDRESS	DD	?
   133                              <1> A_TRACKREADWRITEPACKET ENDS
   134                              <1> 
   135                              <1> ;AN001; - FP_TRACKCOUNT is only meaningful when FP_SPECIALFUNCTIONS bit 1 = 1.
   136                              <1> A_FORMATPACKET	    STRUC
   137 00000000 ??                  <1> FP_SPECIALFUNCTIONS	DB	?
   138 00000001 ????                <1> FP_HEAD 		DW	?
   139 00000003 ????                <1> FP_CYLINDER		DW	?
   140 00000005 ????                <1> FP_TRACKCOUNT		DW	? ;1
   141                              <1> A_FORMATPACKET	    ENDS
   142                              <1> 
   143                              <1> A_VERIFYPACKET	    STRUC
   144 00000000 ??                  <1> VP_SPECIALFUNCTIONS	DB	?
   145 00000001 ????                <1> VP_HEAD 		DW	?
   146 00000003 ????                <1> VP_CYLINDER		DW	?
   147                              <1> A_VERIFYPACKET	    ENDS
   148                              <1> 
   149                              <1> A_MEDIA_ID_INFO     STRUC
   150 00000000 ????                <1> MI_LEVEL		DW	? ;0		;J.K. 87 Info. level
   151 00000002 ????????            <1> MI_SERIAL		DD	?		;J.K. 87 Serial #
   152 00000006 <res Bh>            <1> MI_LABEL		DB     11 DUP (?) ;(' ')     ;J.K. 87 volume label
   153 00000011 ????????????????    <1> MI_SYSTEM		DB	8 DUP (?) ;(' ')     ;J.K. 87 File system type
   154                              <1> A_MEDIA_ID_INFO     ENDS
   155                              <1> 
   156                              <1> A_DISKACCESS_CONTROL	STRUC			;AN002; Unpublished function. Only for Hard file.
   157 00000000 ??                  <1> DAC_SPECIALFUNCTIONS	DB	? ;0		;AN002; Always 0
   158 00000001 ??                  <1> DAC_ACCESS_FLAG 	DB	? ;0		;AN002; Non Zero - allow disk I/O to unformatted hard file
   159                              <1> A_DISKACCESS_CONTROL	ENDS			;AN002; 0 - Disallow disk I/O to unformatted hard file
   160                              <1> 
   161                              <1> ;********************************;*
   162                              <1> ; CHARACTER DEVICES (PRINTERS)	 ;*
   163                              <1> ;********************************;*
   164                              <1> 
   165                              <1> ;RAWIO SUB-FUNCTIONS
   166                              <1> GET_RETRY_COUNT 	EQU	65H
   167                              <1> SET_RETRY_COUNT 	EQU	45H
   168                              <1> 
   169                              <1> A_RETRYCOUNT	    STRUC
   170 00000000 ????                <1> RC_COUNT		DW	?
   171                              <1> A_RETRYCOUNT	    ENDS
   172                              <1> 
   173                              <1> ;********************************;*		;J.K. 4/29/86
   174                              <1> ; CHARACTER DEVICES (SCREEN)	 ;*
   175                              <1> ;********************************;*		;J.K. 4/29/86
   176                              <1> ;
   177                              <1> ;SC_MODE_INFO	 struc
   178                              <1> ;SC_INFO_LENGTH 	 DW	 9
   179                              <1> ;SC_MODE		 DB	 0
   180                              <1> ;SC_COLORS		 DW	 0
   181                              <1> ;SC_WIDTH		 DW	 0
   182                              <1> ;SC_LENGTH		 DW	 0
   183                              <1> ;SC_MODE_INFO	 ends
   184                              <1> ;
   185                              <1> ;SC_INFO_PACKET_LENGTH	 EQU	 9		 ;LENGTH OF THE INFO PACKET.
   186                              <1> 
   187                              <1> ;SUBFUNCTIONS FOR CON$GENIOCTL
   188                              <1> ;GET_SC_MODE		 EQU	 60h
   189                              <1> ;SET_SC_MODE		 EQU	 40h
   190                              <1> ;The following subfunctions are reserved for installable CODE PAGE switch
   191                              <1> ;console devices. - J.K. 4/29/86
   192                              <1> ;Get_active_codepage	 equ	 6Ah
   193                              <1> ;Invoke_active_codepage  equ	 4Ah
   194                              <1> ;Start_designate_codepage equ	 4Ch
   195                              <1> ;End_designate_codepage  equ	 4Dh
   196                              <1> ;Get_list_of_designated_codepage equ 6Bh
   197                              <1> ;J.K. 4/29/86 *** End of Con$genioctl equates & structures
    20                                  
    21                                  	EXTRN BUS$EXIT:NEAR		;MSBIO1
    22                                  	EXTRN ERR$CNT:NEAR		;MSBIO1
    23                                  	EXTRN CMDERR:NEAR		;MSBIO1
    24                                  	EXTRN GETDX:NEAR		;MSBIO1
    25                                  	EXTRN EXIT:NEAR 		;MSBIO1
    26                                  	EXTRN ERR$EXIT:NEAR		;MSBIO1
    27                                  ;DATA
    28                                  	EXTRN PTRSAV:DWORD		;MSBIO1
    29                                  	EXTRN TIMDEV:WORD		;MSCLOCK
    30                                  	EXTRN LPT2DEV:WORD		;MSBIO2
    31                                  	EXTRN WAIT_COUNT:WORD		;MSDATA
    32                                  	EXTRN PRINTDEV:BYTE		;MSDATA
    33                                  ; IBM ROM STATUS BITS (I DON'T TRUST THEM, NEITHER SHOULD YOU)
    34                                  
    35                                  NOTBUSYSTATUS	equ   10000000B		; NOT BUSY
    36                                  ACKSTATUS	equ   01000000B		; ACKNOWLEDGE (FOR WHAT?)
    37                                  NOPAPERSTATUS	equ   00100000B		; NO MORE PAPER
    38                                  SELECTEDSTATUS	equ   00010000B		; THE PRINTER SAID IT WAS SELECTED
    39                                  IOERRSTATUS	equ   00001000B		; SOME KINDA ERROR
    40                                  RESERVED	equ   00000110B		; NOPS
    41                                  TIMEOUTSTATUS	equ   00000001B		; TIME OUT.
    42                                  
    43                                  
    44                                  ; WARNING!!!  THE IBM ROM DOES NOT RETURN JUST ONE BIT.  IT RETURNS A
    45                                  ; WHOLE SLEW OF BITS, ONLY ONE OF WHICH IS CORRECT.
    46                                  
    47                                  ;----------------------------------------------------------
    48                                  ;J.K. AN001; PRN$WRIT will retry only if error code is TIMEOUT.
    49                                  
    50                                  ;	WRITE TO PRINTER DEVICE
    51                                  
    52                                  ;   CX HAS COUNT OF BYTES
    53                                  ;   ES:DI POINT TO DESTINATION
    54                                  ;   AUXNUM HAS PRINTER NUMBER
    55                                  
    56                                  	PUBLIC PRN$WRIT
    57                                  PRN$WRIT PROC	NEAR
    58                                   assume ds:DOSGROUP, es:nothing, ss:nothing
    59                                  					; SET BY PRINTER DEVICE DRIVER ENTRY
    60 00000000 E31A                    	jcxz	Prn$Done		;No char to output
    61                                  Prn$Loop:
    62 00000002 BB0200                  	mov	bx, 2			;Initialize retry count
    63                                  Prn$Out:
    64                                  ;SB34LPT000****************************************************************
    65                                  ;SB  Print the character at [ES:DI]
    66                                  ;SB	Call the function PrnOP to do this
    67                                  ;SB	The character to be printed goes in AL and the function code
    68                                  ;SB	for 'Output character' goes in AH
    69                                  ;SB	Check for error in printing.  
    70                                  ;SB	If there is no error go to print the next character.
    71                                  ;SB	If there is an error indicated see if it is due to TIMEOUT.  If the
    72                                  ;SB	error is not TIMEOUT then we can do nothing about it.  Just go to
    73                                  ;SB	print the next character.  If it is due to timeout we can execute
    74                                  ;SB     the code to retry the print which follows this piece of code
    75                                  ;SB		LOCS: 6
    76                                  
    77 00000005 268A05                  	mov	al,[es:di]	; assume AX disposible since enter
    78 00000008 30E4                    	xor	ah,ah		; via int 21h
    79                                  PrnOp equ PRNOP	; NASM port label
    80 0000000A E82400                  	call	PrnOp		; print to printer
    81 0000000D 740A                    	jz	Prn$Con		; no error - continue
    82 0000000F F6C401                  	test	ah,TIMEOUTSTATUS
    83 00000012 7405                    	jz	Prn$Con		; NOT time out - continue
    84                                  
    85                                  ;SB34LPT000****************************************************************
    86 00000014 4B                      	dec	bx			;Retry until count is exhausted.
    87 00000015 75EE                    	jnz	Prn$Out 		;Retry it.
    88 00000017 EB06                    	jmp short Pmessg		;Return with error.
    89                                     ;
    90                                     ; next character
    91                                     ;
    92                                  Prn$Con:
    93 00000019 47                      	inc	di			;point to next char and continue
    94 0000001A E2E6                    	loop	Prn$Loop
    95                                  Prn$Done:
    96                                  Exit equ EXIT	; NASM port label
    97 0000001C E9(0000)                	jmp	Exit
    98                                  Pmessg:
    99                                  Err$Cnt equ ERR$CNT	; NASM port label
   100 0000001F E9(0000)                	jmp	Err$Cnt
   101                                  PRN$WRIT	endp
   102                                  
   103                                  ;	 JCXZ	 EXVEC3 		 ; NO CHARS TO OUTPUT..
   104                                  ;PRN$LOOP:
   105                                  ;	 MOV	 BX,2			 ; INITIALIZE RETRY FLAG
   106                                  ;PRN$OUT:
   107                                  ;	 MOV	 AL,[ES:DI]		 ; GET CHAR INTO AL
   108                                  ;	 INC	 DI			 ; POINT TO NEXT CHAR
   109                                  ;	 XOR	 AH,AH			 ; AH=0 => OUTPUT CHAR IN DL
   110                                  ;	 CALL	 PRNOP			 ; TO INDICATE PRINT CHAR IN AL
   111                                  ;	 JNZ	 PRRETRY
   112                                  ;	 LOOP	 PRN$LOOP
   113                                  ;EXVEC3:
   114                                  ;	 JMP	 EXIT
   115                                  ;PRRETRY:
   116                                  ;	 DEC	 DI			 ; UNDO THE INC ABOVE...
   117                                  ;	 DEC	 BX
   118                                  ;	 JNZ	 PRN$OUT
   119                                  ;PMESSG:
   120                                  ;	 JMP	 ERR$CNT		 ;RETURN WITH THE ERROR
   121                                  ;PRN$WRIT ENDP
   122                                  
   123                                  ;--------------------------------------------------------
   124                                  
   125                                  ;	PRINTER STATUS ROUTINE
   126                                  
   127                                  	PUBLIC PRN$STAT
   128                                  PRN$STAT PROC	NEAR
   129                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   130                                  					; SET BY PRINTER DEVICE DRIVER ENTRY
   131 00000022 E80A00                  	CALL	PRNSTAT			;DEVICE IN DX
   132                                  PMESSG equ Pmessg	; NASM port label
   133 00000025 75F8                    	JNZ	PMESSG			; OTHER ERRORS WERE FOUND
   134                                  ;J.K. The next three lines are commented out, since it is a dead code.
   135                                  ;	 MOV	 AL,9			 ; AGAIN, ASSUME OUT OF PAPER...
   136                                  ;	 TEST	 AH,NOPAPERSTATUS
   137                                  ;	 JNZ	 PMESSG
   138 00000027 F6C480                  	TEST	AH,NOTBUSYSTATUS
   139 0000002A 75F0                    	jnz	Prn$Done		;No error. Exit
   140 0000002C E9(0000)                	JMP	BUS$EXIT
   141                                  PRN$STAT ENDP
   142                                  
   143                                  ; TAKE THE APPROPRIATE PRINTER AND DO THE OPERATION.  TRIAGE THE STATUS
   144                                  ; RETURNED IN AH INTO SOME MEANINGFUL ERROR.
   145                                  
   146                                  PRNSTAT PROC	NEAR
   147                                  ;SB33037**********************************************************************
   148 0000002F B402                    	mov	AH, 2			; set command for get status  ;SB ;3.30*
   149                                  PRNOP:								      ;SB ;3.30*
   150 00000031 E8(0000)                	call	GETDX			; determine which printer     ;SB ;3.30*
   151 00000034 CD17                    	int	17h			; call ROM-BIOS printer routine ;SB;3.30*
   152                                  
   153                                  ;SB33037**********************************************************************
   154                                  
   155                                  ; EXAMINE THE STATUS BITS TO SEE IF AN ERROR OCCURRED.	UNFORTUNATELY, SEVERAL
   156                                  ; OF THE BITS ARE SET SO WE HAVE TO PICK AND CHOOSE.  WE MUST BE EXTREMELY
   157                                  ; CAREFUL ABOUT BREAKING BASIC.
   158                                  
   159 00000036 F6C408                  	TEST	AH,IOERRSTATUS		; I/O ERROR?
   160 00000039 740A                    	JZ	CHECKNOTREADY		; NO, TRY NOT READY
   161                                  
   162                                  ; AT THIS POINT, WE KNOW WE HAVE AN ERROR.  THE CONVERSE IS NOT TRUE.
   163                                  
   164 0000003B B009                    	MOV	AL,9			; FIRST, ASSUME OUT OF PAPER
   165 0000003D F6C420                  	TEST	AH,NOPAPERSTATUS	; OUT OF PAPER SET?
   166 00000040 7502                    	JNZ	.RET1			; YES, ERROR IS SET
   167 00000042 FEC0                    	INC	AL			; INDICATE I/O ERROR
   168                                  .RET1:
   169                                  
   170                                  ; WE HAVE TRIAGED NOW FOR OUT OF PAPER AND IO ERR (IGNORING TIME-OUT)
   171                                  
   172 00000044 C3                      	RET				; RETURN WITH ERROR
   173                                  
   174                                  ; THE BITS SAID NO ERROR.  UNFORTUNATELY, THERE MAY BE OTHER THINGS AT WORK
   175                                  ; HERE.
   176                                  
   177                                  CHECKNOTREADY:
   178 00000045 B002                    	MOV	AL,2			; ASSUME NOT-READY
   179 00000047 F6C401                  	TEST	AH,TIMEOUTSTATUS	; IS TIME-OUT SET?
   180                                  					; IF NZ THEN ERROR, ELSE OK???
   181                                  PRNOP2:
   182 0000004A C3                      	RET
   183                                  PRNSTAT ENDP
   184                                  
   185                                  ; OUTPUT UNTIL BUSY.  THIS ENTRY POINT IS USED EXCLUSIVELY BY THE PRINT
   186                                  ; SPOOLERS.  UNDER NO CURCUMSTANCES SHOULD THE DEVICE DRIVER BLOCK WAITING FOR
   187                                  ; THE DEVICE TO BECOME READY.
   188                                  
   189                                  ;   INPUTS:	CX HAS COUNT OF BYTES TO OUTPUT.
   190                                  ;		ES:DI POINTS TO SOURCE BUFFER
   191                                  ;   OUTPUTS:	SET THE NUMBER OF BYTES TRANSFERRED APPROPRIATELY
   192                                  	PUBLIC	PRN$TILBUSY
   193                                  PRN$TILBUSY PROC NEAR
   194                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   195                                  					; SET BY PRINTER DEVICE DRIVER ENTRY
   196 0000004B 1E                      	PUSH	DS
   197 0000004C 06                      	PUSH	ES
   198 0000004D 1F                      	POP	DS			; NOW ES AND DS BOTH POINT TO SOURCE BUFFER
   199                                   ASSUME DS:NOTHING
   200                                  
   201 0000004E 89FE                    	MOV	SI,DI			; EVERYTHING IS SET FOR LODSB
   202                                  PRN$TILBLOOP:
   203 00000050 51                      	PUSH	CX
   204 00000051 53                      	PUSH	BX
   205 00000052 31DB                    	XOR	BX,BX
   206 00000054 1E                      	push ds
   207 00000055 E8(0000)                	call biocode_get_ds_dosbiodata
   208                                   assume ds:DOSGROUP
   209 00000058 8A1E[0000]              	MOV	BL,[PRINTDEV]
   210 0000005C D1E3                    	SHL	BX,1
   211 0000005E 8B8F[0000]              	MOV	CX,[WAIT_COUNT + BX]	; WAIT COUNT TIMES TO COME READY
   212 00000062 1F                      	pop ds
   213                                   assume ds:nothing
   214 00000063 5B                      	POP	BX
   215                                  PRN$GETSTAT:
   216 00000064 E8C8FF                  	CALL	PRNSTAT 		; GET STATUS
   217 00000067 7520                    	JNZ	PRN$BPERR		; ERROR
   218 00000069 F6C480                  	TEST	AH,10000000B		; READY YET?
   219 0000006C E1F6                    	LOOPZ	PRN$GETSTAT		; NO, GO FOR MORE
   220 0000006E 59                      	POP	CX			; GET ORIGINAL COUNT
   221 0000006F 7419                    	JZ	PRN$BERR		; STILL NOT READY => DONE
   222 00000071 AC                      	LODSB
   223 00000072 30E4                    	XOR	AH,AH
   224 00000074 E8BAFF                  	CALL	PRNOP
   225 00000077 7511                    	JNZ	PRN$BERR		; ERROR
   226 00000079 E2D5                    	LOOP	PRN$TILBLOOP		; GO FOR MORE
   227                                  PRN$B:
   228 0000007B 1F                      	POP	DS
   229                                   assume ds:DOSGROUP
   230 0000007C E8(0000)                	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   231                                   assume ds:DOSENTRYGROUP
   232 0000007F C51E[0000]              	lds bx, [PTRSAV]
   233                                   ASSUME DS:NOTHING
   234 00000083 294F12                  	SUB	WORD PTR [BX + COUNT],CX	;# OF SUCCESSFUL I/O'S
   235 00000086 E9(0000)                	JMP	EXIT
   236                                  PRN$TILBUSY ENDP
   237                                  
   238                                  PRN$BPERR PROC	NEAR
   239                                   assume ds:nothing
   240 00000089 59                      	POP	CX
   241                                  PRN$BERR:
   242 0000008A 1F                      	POP	DS
   243                                   assume ds:DOSGROUP
   244 0000008B E8(0000)                	call biocode_get_ds_dosentry	; PTRSAV in DOSENTRY
   245                                   assume ds:DOSENTRYGROUP
   246 0000008E C51E[0000]              	lds bx, [PTRSAV]
   247                                   ASSUME DS:NOTHING
   248                                  
   249 00000092 294F12                  	SUB	WORD PTR [BX + COUNT],CX	;# OF SUCCESSFUL I/O'S
   250 00000095 E9(0000)                	JMP	ERR$EXIT
   251                                  PRN$BPERR ENDP
   252                                  ;
   253                                  ; MANIPULATES THE VALUE IN WAIT_COUNT DEPENDING ON THE VALUE PASSED IN THE
   254                                  ; GENERIC IOCTL PACKET.
   255                                  ; IT EITHER SETS OR RETURNS THE CURRENT VALUE FOR THE RETRY COUNT FOR THE
   256                                  ; DEVICE.
   257                                  ;
   258                                  	PUBLIC PRN$GENIOCTL
   259                                  PRN$GENIOCTL PROC NEAR
   260                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   261                                  					; SET BY PRINTER DEVICE DRIVER ENTRY
   262 00000098 E8(0000)                	call biocode_get_ds_dosentry
   263                                   assume ds:DOSENTRYGROUP
   264 0000009B C43E[0000]              	LES	DI,[PTRSAV]
   265                                   assume es:nothing
   266 0000009F 26807D0D05              	CMP	byte [ES:DI + MAJORFUNCTION],IOC_PC
   267 000000A4 7403                    	JE	PRNFUNC_OK
   268                                  PRNFUNCERR:
   269 000000A6 E9(0000)                	JMP	CMDERR
   270                                  
   271                                  PRNFUNC_OK:
   272 000000A9 268A450E                	MOV	AL,[ES:DI + MINORFUNCTION]
   273 000000AD 26C47D13                	LES	DI,[ES:DI + GENERICIOCTL_PACKET]
   274                                   assume es:nothing
   275 000000B1 E8(0000)                	call biocode_get_ds_dosbiodata
   276                                   assume ds:DOSGROUP
   277 000000B4 31DB                    	XOR	BX,BX
   278 000000B6 8A1E[0000]              	MOV	BL,[PRINTDEV]		; GET INDEX INTO RETRY COUNTS
   279 000000BA D1E3                    	SHL	BX,1
   280 000000BC 8B8F[0000]              	MOV	CX,[WAIT_COUNT + BX]	; PULL OUT RETRY COUNT FOR DEVICE
   281 000000C0 3C65                    	CMP	AL,GET_RETRY_COUNT
   282 000000C2 7407                    	JZ	PRNGETCOUNT
   283 000000C4 3C45                    	CMP	AL,SET_RETRY_COUNT
   284 000000C6 75DE                    	JNZ	PRNFUNCERR
   285 000000C8 268B0D                  	MOV	CX,[ES:DI + RC_COUNT]
   286                                  PRNGETCOUNT:
   287 000000CB 898F[0000]              	MOV	[WAIT_COUNT + BX],CX	; PLACE "NEW" RETRY COUNT
   288 000000CF 26890D                  	MOV	[ES:DI + RC_COUNT],CX	; RETURN CURRENT RETRY COUNT
   289                                  prn_exit:
   290 000000D2 E9(0000)                	JMP	EXIT
   291                                  PRN$GENIOCTL ENDP
   292                                  
   293                                   global prn_check_gen_ioctl
   294                                  prn_check_gen_ioctl:
   295                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   296 000000D5 E8(0000)                	call biocode_get_ds_dosentry
   297                                   assume ds:DOSENTRYGROUP
   298 000000D8 C53E[0000]              	lds di, [PTRSAV]
   299                                   assume ds:nothing
   300 000000DC 807D0D05                	CMP byte [di + MAJORFUNCTION],IOC_PC
   301 000000E0 75C4                    	jne PRNFUNCERR
   302 000000E2 8A450E                  	mov al, [di + MINORFUNCTION]
   303 000000E5 3C65                    	cmp al, GET_RETRY_COUNT
   304 000000E7 74E9                    	je prn_exit
   305 000000E9 3C45                    	cmp al, SET_RETRY_COUNT
   306 000000EB 74E5                    	je prn_exit
   307 000000ED EBB7                    	jmp PRNFUNCERR
   308                                  
   309                                  ; (no prior section) ; CODE	ENDS
   310                                  	END
