     1                                  ;	PAGE ,132 ;
     2                                  ;	TITLE MSCON - BIOS
     3                                  	%warning out: ...MSCON.ASM
     3          ******************       warning: out: ...MSCON.ASM [-w+user]
     4                                  ;==============================================================================
     5                                  ;REVISION HISTORY:
     6                                  ;AN000 - New for DOS Version 4.00 - J.K.
     7                                  ;AC000 - Changed for DOS Version 4.00 - J.K.
     8                                  ;AN00x - PTM number for DOS Version 4.00 - J.K.
     9                                  ;==============================================================================
    10                                  
    11                                  	itest equ 0
    12                                  	%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
    13                                  	%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
    14                                  	%include "jumpmac.mac"
     1                              <1> 						  ;;Rev 3.30 Modification
     2                              <1> ;
     3                              <1> ; given a label <lbl> either 2 byte jump to another label <lbl>_J
     4                              <1> ; if it is near enough or 3 byte jump to <lbl>
     5                              <1> ;
     6                              <1> 
     7                              <1> ; NASM original macros
     8                              <1> 
     9                              <1> %if 0
    10                              <1> %imacro jump 1.nolist
    11                              <1> ;.xcref
    12                              <1> 
    13                              <1>     %ifndef %1_J                       ;; is this the first invocation
    14                              <1> %%a:      JMP %1
    15                              <1>     %ELSE
    16                              <1> 	%IF (%1_J >= $) || ($-%1_J > 126)
    17                              <1> %%a:      JMP %1                         ;; is the jump too far away?
    18                              <1> 	%ELSE
    19                              <1> %%a:      JMP %1_J                      ;; do the short one...
    20                              <1> 	%ENDIF
    21                              <1>     %ENDIF
    22                              <1>     %ixdefine %1_j %%a
    23                              <1> ;.cref
    24                              <1> %endmacro
    25                              <1> ;.xcref  jump
    26                              <1> %else
    27                              <1> %imacro jump 1.nolist
    28                              <1> ;REDEFINE THE ABOVE MACRO TO ALWAYS TRY A 3 BYTE NEAR JUMP		 
    29                              <1> 		jmp %1
    30                              <1> %endmacro					;;End of Modification
    31                              <1> %endif
    32                              <1> 
    33                              <1> 
    15                                  	%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
    16                                  	%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
    17                                  	%include "entrysw.mac"
     1                              <1> 
     2                              <1> %ifndef __ENTRYSW_MAC__
     3                              <1>  %assign __ENTRYSW_MAC__ 1
     4                              <1> 
     5                              <1> %assign _DOSCODEHMA		1
     6                              <1> %assign _RELOCATEDOSCODE	1
     7                              <1> 
     8                              <1> 		; Write a label "%1" (only if DOSCODE isn't relocated) and
     9                              <1> 		; "relocated%1" (always).
    10                              <1> 	%imacro relocated 1-2.nolist
    11                              <1> %ifnidni %2, device
    12                              <1>  %ifnidni %2, amis
    13                              <1>   %ifn _RELOCATEDOSCODE
    14                              <1> %1:
    15                              <1> 	global %1
    16                              <1>   %endif
    17                              <1>  %endif
    18                              <1> %endif
    19                              <1> relocated%1:				; always used for local labels
    20                              <1> 	global relocated%1
    21                              <1> 	%endmacro
    22                              <1> 
    23                              <1> %if _RELOCATEDOSCODE
    24                              <1> DOSENTRYADJUSTSEGMENT equ 60h - 26h
    25                              <1> %else
    26                              <1> DOSENTRYADJUSTSEGMENT equ 0
    27                              <1> %endif
    28                              <1> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16
    29                              <1> 
    30                              <1> DOSENTRYDEVICEBASE equ 10h
    31                              <1> 
    32                              <1> %endif
    18                                  
    19                                  ;*** DOS 3.3 will not support more than 25 rows
    20                                  ;	INCLUDE DEVSYM.INC	;J.K. 4/29/86 for CON$GENIOCTL support
    21                                  ;	INCLUDE IOCTL.INC	;J.K. 4/29/86 for CON$GENIOCTL support
    22                                  
    23                                  	EXTRN EXIT:NEAR 	;MSBIO1
    24                                  	EXTRN BUS$EXIT:NEAR	;MSBIO1
    25                                  
    26                                  ;	EXTRN CMDERR:NEAR	;MSBIO1	J.K. 4/29/86
    27                                  
    28                                  ;DATA
    29                                  	EXTRN PTRSAV:DWORD	;MSBIO1
    30                                  	EXTRN FHAVEK09:BYTE	;MSDISK
    31                                  	EXTRN ALTAH:BYTE	;MSBDATA
    32                                  	EXTRN KEYRD_Func:Byte	;MSBDATA
    33                                  	EXTRN KEYSTS_Func:Byte	;MSBDATA
    34                                  	extern altah_indirect
    35                                  
    36                                  ;	EXTRN SAV_SC_INFO:BYTE	;MSBDATA J.K. 4/29/86
    37                                  ;	EXTRN SAV_SC_MODE:BYTE	;MSBDATA J.K. 4/29/86
    38                                  ;------------------------------------------------------
    39                                  ;
    40                                  ;	CONSOLE READ ROUTINE
    41                                  ;
    42                                  	PUBLIC	CON$READ
    43                                  CON$READ PROC	NEAR
    44                                   assume ds:DOSGROUP, es:nothing, ss:nothing
    45                                  					; THIS WAS SET BY THE CON DD ENTRY POINT
    46 00000000 E306                    	JCXZ	CON$EXIT
    47                                  CON$LOOP:
    48 00000002 E81000                  	CALL	CHRIN			;GET CHAR IN AL
    49 00000005 AA                      	STOSB				;STORE CHAR AT ES:DI
    50 00000006 E2FA                    	LOOP	CON$LOOP
    51                                  CON$EXIT:
    52 00000008 E9(0000)                	JUMP	EXIT
    53                                  CON$READ ENDP
    54                                  ;---------------------------------------------------------
    55                                  ;
    56                                  ;	INPUT SINGLE CHAR INTO AL
    57                                  ;
    58                                  ;J.K.5/12/87 We are going to issue extended keyboard function, if supported.
    59                                  ;The returning value of the extended key stroke of the extended key board
    60                                  ;function uses 0E0h in AL instead of 00 as in the conventional key board
    61                                  ;function.  This creates a conflict when the user entered real Greek Alpha
    62                                  ;charater (= 0E0h) to  distinguish the extended key stroke and the Greek Alpha.
    63                                  ;This case will be handled in the following manner;
    64                                  ;	AH = 16h
    65                                  ;	INT 16h
    66                                  ;	If AL == 0, then extended code (in AH)
    67                                  ;  else If AL == 0E0h, then
    68                                  ;	     IF AH <> 0, then extended code (in AH)
    69                                  ;	else Greek_Alpha character.
    70                                  ;Also, for compatibility reason, if an extended code is detected, then we
    71                                  ;are going to change the value in AL from 0E0h to 00h.
    72                                  
    73                                  get_dsbx_altah:
    74 0000000B E8(0000)                	call biocode_get_ds_dosbiodata
    75                                   assume ds:DOSGROUP
    76 0000000E 8B1E[0000]              	mov bx, word [altah_indirect]
    77 00000012 E9(0000)                	jmp biocode_get_ds_dosentry
    78                                  
    79                                  
    80                                  CHRIN	PROC	NEAR
    81 00000015 E8(0000)                	call biocode_get_ds_dosbiodata
    82                                   assume ds:DOSGROUP
    83                                  ;AN000;
    84                                  ;	 XOR	 AX,AX
    85 00000018 8A26[0000]              	mov	ah,[KEYRD_Func]		;AN000; Set by MSINIT. 0 or 10h
    86 0000001C 30C0                    	xor	al,al			;AN000;
    87 0000001E E8EAFF                  	call get_dsbx_altah
    88                                   assume ds:DOSENTRYGROUP
    89 00000021 8607                    	XCHG	AL,[bx]			;GET CHARACTER & ZERO ALTAH
    90                                  
    91 00000023 08C0                    	OR	AL,AL
    92 00000025 752F                    	JNZ	KEYRET
    93                                  ;SB34CON000**************************************************************
    94                                  ;SB  Keyboard I/O interrupt
    95                                  ;SB	AH already contains the keyboard read function number
    96                                  ;SB		1 LOC
    97                                  
    98 00000027 CD16                    	int	16h
    99                                  ;SB34CON000**************************************************************
   100                                  ALT10:
   101 00000029 09C0                    	OR	AX,AX			;CHECK FOR NON-KEY AFTER BREAK
   102 0000002B 74E8                    	JZ	CHRIN
   103 0000002D 3D0072                  	CMP	AX,7200H		;CHECK FOR CTRL-PRTSC
   104 00000030 7505                    	JNZ	ALT_Ext_Chk		;AN000;
   105 00000032 B010                    	MOV	AL,16
   106                                  KeyRet equ KEYRET	; NASM port label
   107 00000034 EB20                    	jmp	KeyRet			;AN000;
   108 00000036 90                      	nop	; identicalise
   109                                  ALT_Ext_Chk:
   110                                  ;SB34CON001**************************************************************
   111                                  ;SB  IF operation was extended function (i.e. KEYRD_Func != 0) THEN
   112                                  ;SB    IF character read was 0E0h THEN
   113                                  ;SB      IF extended byte was zero (i.e. AH == 0) THEN
   114                                  ;SB        goto keyret
   115                                  ;SB      ELSE
   116                                  ;SB        set AL to zero
   117                                  ;SB        goto ALT_SAVE
   118                                  ;SB      ENDIF
   119                                  ;SB    ENDIF
   120                                  ;SB  ENDIF
   121                                  ;SB		9 LOCS
   122                                  
   123 00000037 E8(0000)                	call biocode_get_ds_dosbiodata
   124                                   assume ds:DOSGROUP
   125 0000003A 803E[0000]00            	cmp	BYTE [KEYRD_Func],0
   126 0000003F 740C                    	jz	NOT_EXT
   127 00000041 3CE0                    	cmp	al,0E0h
   128 00000043 7508                    	jnz	NOT_EXT
   129 00000045 08E4                    	or	ah,ah
   130 00000047 740D                    	jz	KEYRET
   131 00000049 30C0                    	xor	al,al
   132 0000004B EB04                    	jmp	short ALT_SAVE
   133                                  NOT_EXT:
   134                                  
   135                                  ;SB34CON001**************************************************************
   136 0000004D 08C0                    	OR	AL,AL			;SPECIAL CASE?
   137 0000004F 7505                    	JNZ	KEYRET
   138                                  ALT_SAVE:
   139 00000051 E8B7FF                  	call get_dsbx_altah
   140                                   assume ds:DOSENTRYGROUP
   141 00000054 8827                    	MOV	[bx],AH			;STORE SPECIAL KEY
   142                                  KEYRET:
   143 00000056 C3                      	RET
   144                                  CHRIN	ENDP
   145                                  
   146                                  ;--------------------------------------------------------------
   147                                  ;
   148                                  ;	KEYBOARD NON DESTRUCTIVE READ, NO WAIT
   149                                  ;
   150                                  ; PC-CONVERTIBLE-TYPE MACHINE: IF BIT 10 IS SET BY THE DOS IN THE STATUS WORD 
   151                                  ; OF THE REQUEST PACKET, AND THERE IS NO CHARACTER IN THE INPUT BUFFER, THE 
   152                                  ; DRIVER ISSUES A SYSTEM WAIT REQUEST TO THE ROM. ON RETURN FROM THE ROM, IT
   153                                  ; RETURNS A 'CHAR-NOT-FOUND' TO THE DOS.
   154                                  ;
   155                                  CONBUSJ:
   156                                   assume ds:nothing, es:nothing, ss:nothing
   157 00000057 EB75                    	JMP	CONBUS
   158 00000059 90                      	nop	; identicalise
   159                                  
   160                                  	PUBLIC	CON$RDND
   161                                  CON$RDND:
   162                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   163                                  				     ; THIS WAS SET BY THE CON DD ENTRY POINT
   164 0000005A E8AEFF                  	call get_dsbx_altah
   165                                   assume ds:DOSENTRYGROUP
   166 0000005D 8A07                    	MOV	AL,[bx]
   167 0000005F 08C0                    	OR	AL,AL
   168 00000061 7403                    	JZ	RD1
   169 00000063 EB5C                    	JMP	RDEXIT
   170 00000065 90                      	nop	; identicalise
   171                                  
   172                                  RD1:
   173                                  ;SB34CON002**************************************************************
   174                                  ;SB  Keyboard I/O interrupt
   175                                  ;SB	Get keystroke status (KEYSTS_Func)
   176                                  ;SB	 2 LOCS
   177                                  
   178 00000066 E8(0000)                	call biocode_get_ds_dosbiodata
   179                                   assume ds:DOSGROUP
   180 00000069 8A26[0000]              	mov	ah,[KEYSTS_Func]
   181 0000006D CD16                    	int	16h
   182                                  ;SB34CON002**************************************************************
   183 0000006F 7403                    	JZ	NOCHR
   184 00000071 EB20                    	JMP	GOTCHR
   185 00000073 90                      	nop	; identicalise
   186                                  NOCHR:
   187 00000074 803E[0000]00            	CMP	byte [FHAVEK09],0
   188 00000079 74DC                    	JZ	CONBUSJ
   189 0000007B E8(0000)                	call biocode_get_ds_dosentry
   190                                   assume ds:DOSENTRYGROUP
   191 0000007E C51E[0000]              	LDS	BX,[PTRSAV]
   192                                   ASSUME DS:NOTHING
   193 00000082 F747030004              	TEST	word [BX + STATUS],0400H	; SYSTEM WAIT ENABLED?
   194 00000087 74CE                    	JZ	CONBUSJ
   195                                  
   196                                  ;********************************
   197                                  ; NEED TO WAIT FOR IBM RESPONSE TO REQUEST FOR CODE ON HOW TO USE THE SYSTEM
   198                                  ; WAIT CALL.
   199                                  ;********************************
   200                                  	MESSAGE FTESTCON,<"SYSTEM WAIT STAGE",CR,LF>
   201 00000089 B80041                  	MOV	AX,4100H		; WAIT ON AN EXTERNAL EVENT
   202 0000008C 30DB                    	xor bl, bl			; no timeout (pick from MS-DOS v5.00)
   203                                  ;	MOV	BX,0300H		; NO TIMEOUT
   204                                  ;	MOV	DX,60H			; LOOK AT I/O PORT 60H
   205 0000008E CD15                    	INT	15H			; CALL ROM FOR SYSTEM WAIT
   206                                  	MESSAGE FTESTCON,<"OUT OF WAIT. AX IS ">
   207                                  	MNUM	FTESTCON,AX
   208                                  	MESSAGE FTESTCON,<CR,LF>
   209 00000090 EB3C                    	JMP	CONBUS
   210 00000092 90                      	nop	; identicalise
   211                                  
   212                                  GOTCHR:
   213                                   assume ds:DOSGROUP
   214 00000093 09C0                    	OR	AX,AX
   215 00000095 750B                    	JNZ	NOTBRK			;CHECK FOR NULL AFTER BREAK
   216                                  ;SB34CON004**************************************************************
   217                                  ;SB  Keyboard I/O interrupt
   218                                  ;SB	Keyboard read function (KEYRD_Func)
   219                                  ;SB		2 LOCS
   220                                  
   221 00000097 E8(0000)                	call biocode_get_ds_dosbiodata
   222                                   assume ds:DOSGROUP
   223 0000009A 8A26[0000]              	mov	ah,[KEYRD_Func]
   224 0000009E CD16                    	int	16h
   225                                  ;SB34CON004**************************************************************
   226 000000A0 EBB8                    	JUMP	CON$RDND		;AND GET A REAL STATUS
   227                                  NOTBRK:
   228 000000A2 3D0072                  	CMP	AX,7200H		;CHECK FOR CTRL-PRTSC
   229 000000A5 7505                    	JNZ	RD_Ext_Chk		;AN000;
   230 000000A7 B010                    	MOV	AL,16
   231 000000A9 EB16                    	jmp	RDEXIT			;AN000;
   232 000000AB 90                      	nop	; identicalise
   233                                  RD_Ext_Chk:				;AN000;
   234 000000AC E8(0000)                	call biocode_get_ds_dosbiodata
   235                                   assume ds:DOSGROUP
   236 000000AF 803E[0000]00            	cmp	byte [KEYRD_Func], 0	;AN000; Extended Keyboard function?
   237 000000B4 740B                    	jz	RDEXIT			;AN000; No. Normal exit.
   238 000000B6 3CE0                    	cmp	al,0E0h 		;AN000; Extended key value or Greek Alpha?
   239 000000B8 7507                    	jne	RDEXIT			;AN000;
   240 000000BA 80FC00                  	cmp	ah, 0			;AN000; Scan code exist?
   241 000000BD 7402                    	jz	RDEXIT			;AN000; Yes. Greek Alpha char.
   242 000000BF B000                    	mov	al, 0			;AN000; No. Extended key stroke. Change it for compatibility
   243                                  	PUBLIC	RDEXIT
   244                                  RDEXIT:
   245 000000C1 E8(0000)                	call biocode_get_ds_dosentry
   246                                   assume ds:DOSENTRYGROUP
   247 000000C4 C51E[0000]              	LDS	BX,[PTRSAV]
   248                                   ASSUME DS:NOTHING
   249 000000C8 88470D                  	MOV	[BX + MEDIA],AL
   250                                  EXVEC:
   251 000000CB E9(0000)                	JUMP	EXIT
   252                                  
   253                                  CONBUS:
   254                                   ASSUME DS:NOTHING
   255 000000CE E9(0000)                	JUMP	BUS$EXIT
   256                                  ;--------------------------------------------------------------
   257                                  ;
   258                                  ;	KEYBOARD FLUSH ROUTINE
   259                                  ;
   260                                  	PUBLIC	CON$FLSH
   261                                  CON$FLSH:
   262                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   263                                  					; THIS WAS SET BY THE CON DD ENTRY POINT
   264 000000D1 E80300                  	CALL	FLUSH
   265 000000D4 E9(0000)                	JUMP	EXIT
   266                                  
   267                                  	PUBLIC	FLUSH
   268                                  FLUSH:
   269 000000D7 E831FF                  	call get_dsbx_altah
   270                                   assume ds:DOSENTRYGROUP
   271 000000DA C60700                  	MOV	byte [bx],0		;CLEAR OUT HOLDING BUFFER
   272                                  
   273                                  FLLOOP:
   274                                  ;SB33012****************************************************************
   275                                  			 ;SB	; Is there a char there?
   276 000000DD B401                    	mov	AH, 1	 ;SB	; command code for check status
   277 000000DF CD16                    	int	16h	 ;SB	; call rom-bios keyboard routine
   278                                  ;SB33012****************************************************************
   279 000000E1 7406                    	JZ	FLDONE
   280                                  ;SB33013****************************************************************
   281 000000E3 30E4                    	xor	AH, AH	 ;SB	; if zf is nof set, get character
   282 000000E5 CD16                    	int	16h	 ;SB	; call rom-bios to get character
   283                                  ;SB33013****************************************************************
   284 000000E7 EBF4                    	JMP	FLLOOP
   285                                  FLDONE:
   286                                  
   287 000000E9 C3                      	RET
   288                                  ;----------------------------------------------------------
   289                                  ;
   290                                  ;	CONSOLE WRITE ROUTINE
   291                                  ;
   292                                  	PUBLIC	CON$WRIT
   293                                  CON$WRIT:
   294                                   assume ds:DOSGROUP, es:nothing, ss:nothing
   295                                  					; THIS WAS SET BY THE CON DD ENTRY POINT
   296 000000EA E3DF                    	JCXZ	EXVEC
   297                                  CON$LP:
   298 000000EC 268A05                  	MOV	AL,[ES:DI]		;GET CHAR
   299 000000EF 47                      	INC	DI
   300 000000F0 CD29                    	INT	CHROUT			;OUTPUT CHAR
   301 000000F2 E2F8                    	LOOP	CON$LP			;REPEAT UNTIL ALL THROUGH
   302 000000F4 E9(0000)                	JUMP	EXIT
   303                                  ;-----------------------------------------------
   304                                  ;
   305                                  ;	BREAK KEY HANDLING
   306                                  ;
   307                                  relocated i1B
   308                                  CBREAK:
   309                                  	PUBLIC CBREAK
   310                                   assume ds:nothing, es:nothing, ss:nothing
   311 000000F7 1E                      	push ds
   312 000000F8 53                      	push bx
   313 000000F9 E80FFF                  	call get_dsbx_altah
   314                                   assume ds:DOSENTRYGROUP
   315 000000FC C60703                  	mov byte [bx], 3		; INDICATE BREAK KEY SET
   316 000000FF 5B                      	pop bx
   317 00000100 1F                      	pop ds
   318                                   assume ds:nothing
   319 00000101 CF                      	IRET
   320                                  
   321                                  ;------------------------------------------------------------------------------
   322                                  ;J.K. 4/29/86 - CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3.
   323                                  ;CON$GENIOCTL supports Get mode information, Set mode information functions.
   324                                  ;It will only save the value from "Set mode information" and will return
   325                                  ;the value through "Get mode information".  It is supposed to be set by
   326                                  ;the MODE.COM and other application program can retrieve information
   327                                  ;through "Get mode information" call.
   328                                  ;Initially, there is no valuable informaton until set by MODE command, so
   329                                  ;any attemp to "Get mode information" at that points will fail. (unknown
   330                                  ;command with carry set.)
   331                                  ;At entry:  CS = DS = code
   332                                  ;	    [CS:PTRSAV] has seg, address of the Request Header saved in
   333                                  ;	    in Strategy routine.
   334                                  ;
   335                                  ;	PUBLIC	CON$GENIOCTL
   336                                  ;	ASSUME	DS:CODE
   337                                  ;CON$GENIOCTL:
   338                                  ;	 les	 di, [CS:PTRSAV]		 ;get the request header
   339                                  ;	 cmp	 [es:di].MajorFunction, IOC_SC
   340                                  ;	 je	 Major_SC_OK
   341                                  ;SC_CMDERR:
   342                                  ;	 stc
   343                                  ;	 jmp	 cmderr 			 ;carry is set, exit to cmderr
   344                                  ;Major_SC_OK:
   345                                  ;	 mov	 al, [es:di].MinorFunction	 ;save minor function
   346                                  ;	 les	 di, [es:di].GenericIOCTL_Packet ;pointer of SC_MODE_INFO structure
   347                                  ;	 mov	 cx, [es:di].SC_INFO_LENGTH	 ;save length
   348                                  ;	 inc	 di
   349                                  ;	 inc	 di				 ;ES:DI -> SC_MODE in Info. Packet
   350                                  ;	 cmp	 cx, SC_INFO_PACKET_LENGTH	 ;currently 9.
   351                                  ;	 jne	 SC_CMDERR			 ;cannot accept the different packet
   352                                  ;	 cmp	 al, GET_SC_MODE		 ;minor function = 60h ?
   353                                  ;	 jne	 SC_SET_MODE_FUNC		 ;no, check if it is "Set mode function"
   354                                  ;	 cmp	 SAV_SC_MODE, 0 		 ;information set before?
   355                                  ;	 je	 SC_CMDERR			 ;no, cannot get the info.
   356                                  ;;SC_GET_MODE_FUNC:				 ;es:di -> SC_MODE in info. packet
   357                                  ;						 ;cx - length
   358                                  ;	 mov	 si, offset SAV_SC_INFO
   359                                  ;	 rep	 movsb		 ;ds:si -> sav_sc_info, es:di -> sc_mode
   360                                  ;	 jmp	 exit
   361                                  ;
   362                                  ;SC_SET_MODE_FUNC:				 ;es:di -> SC_MODE
   363                                  ;	 cmp	 al, SET_SC_MODE		 ;minor function = 40h ?
   364                                  ;	 jne	 SC_CMDERR
   365                                  ;	 mov	 si, offset SAV_SC_INFO
   366                                  ;	 xchg	 di, si
   367                                  ;	 push	 es
   368                                  ;	 push	 ds
   369                                  ;	 pop	 es
   370                                  ;	 pop	 ds
   371                                  ;	 rep	 movsb		 ;ds:si -> sc_mode, es:di -> sav_sc_info
   372                                  ;	 jmp	 exit
   373                                  ;
   374                                  ;J.K. 4/29/86 - End of CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3.
   375                                  
   376                                  ; (no prior section) ; CODE	ENDS
   377                                  	END
