=== Trace listing source: msbio1.lst 1 ; PAGE ,132 ; 2 ; TITLE MSBIO1.asm - BIOS 3 ;============================================================================== 4 ;REVISION HISTORY: 5 ;AN000 - New for DOS Version 4.00 - J.K. 6 ;AC000 - Changed for DOS Version 4.00 - J.K. 7 ;AN00x - PTM number for DOS Version 4.00 - J.K. 8 ;============================================================================== 9 %if 0 ; COMMENT * 10 THE LINK STEP IS PERFORMED BY USING THE FOLLOWING "NEW.ARF" FILE: 11 msbio1+ 12 msSTACK+ 13 MsCON+ 14 msAUX+ 15 msLPT+ 16 msCLOCK+ 17 msdISK+ 18 msBIO2+ 19 C:\BIO2\OLDOBJ\disk+ 20 C:\BIO2\OLDOBJ\msinit+ 21 C:\BIO2\OLDOBJ\sysinit1+ 22 C:\BIO2\OLDOBJ\sysinit2+ 23 C:\BIO2\OLDOBJ\sysimes,msbio,/M; 24 25 THE FOLLOWING IS A BATCH FILE THAT CAN BE USED TO CREATE THE IBMBIO.COM 26 WHERE "LOCSCR" IS A FILE THAT JUST HAS THE NUMBER, 70: 27 28 link @NEW.ARF 29 exe2bin ibmbio ibmbio.com [list -] 1 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <2> [list -] 14 <1> [list -] 57 %include "sysinisw.mac" 1 <1> 2 <1> SYSINITSTACK equ 256+128 58 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 1 <2> [list -] 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 59 %include "lstruct.mac" 1 <1> [list -] 13 <1> [list -] 60 61 extern afterdosdatalabel === Switch to base=000E00h -> "DOSDATAMCB" 62 addsection DOSDATAMCB, PUBLIC class=DOSDATAMCB align=16 63 istruc MCB 0 00000000 4D at mcbSignature,db 'M' 0 00000001 0800 at mcbOwner, dw 8 0 00000003 [4000] at mcbSize, dw afterdosdatalabel + DOSCODE_HMA_OFFSET - 16 wrt DOSSTART 0 00000005 0053 at mcbName, db "S" 0 00000009 0003 at smcbType, db S_DOSDATA 0 0000000B 00 iend 70 71 %include "ddataseg.nas" 1 <1> 2 <1> %include "lmacros3.mac" 1 <2> [list -] 3 <1> === Switch to base=000E10h -> "DOSSTART" 4 <1> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <1> ; (no prior section) ; DOSSTART ENDS 6 <1> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <1> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <1> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <1> === Switch to base=000E10h -> "CONSTANTS" 10 <1> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <1> ; (no prior section) ; CONSTANTS ENDS 12 <1> === Switch to base=000E10h -> "DATA" 13 <1> addsection DATA, align=2 PUBLIC class=DATA 14 <1> ; (no prior section) ; DATA ENDS 15 <1> === Switch to base=000E10h -> "TABLE" 16 <1> addsection TABLE, align=2 PUBLIC class=TABLE 17 <1> ; (no prior section) ; TABLE ENDS 18 <1> === Switch to base=000E10h -> "DOSDATATABLE" 19 <1> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <1> ; (no prior section) ; DOSDATATABLE ENDS 21 <1> === Switch to base=000E10h -> "DOSDATACODE" 22 <1> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <1> ; (no prior section) ; DOSDATACODE ENDS 24 <1> === Switch to base=000E10h -> "DOSBIODATA" 25 <1> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <1> === Switch to base=000E10h -> "LAST" 27 <1> addsection LAST, align=16 PUBLIC class=LAST 28 <1> ; (no prior section) ; LAST ENDS 29 <1> 30 <1> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <1> 32 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 72 === Switch to base=002450h -> "AFTERDOSDATA" 73 addsection AFTERDOSDATA, align=16 class=AFTERDOSDATA 74 75 %include "dcodeseg.nas" 1 <1> 2 <1> %ifndef DCODESEGNAS 3 <1> %assign DCODESEGNAS 1 4 <1> === Switch to base=002450h -> "DOSCODETABLE" 5 <1> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <1> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <1> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <1> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <1> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <1> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <1> 12 <1> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <1> 14 <1> %endif 76 %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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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 77 === Switch to base=002450h -> "DOSCODETABLE" 78 addsection DOSCODETABLE ; actually added in dosseg.nas === Switch to base=002450h -> "DOSCODECODE" 79 addsection DOSCODECODE ; actually added in dosseg.nas 80 === Switch to base=00C3F0h -> "AFTERDOSCODE" 81 addsection AFTERDOSCODE, align=16 PUBLIC class=AFTERDOSCODE 82 === Switch to base=00C3F0h -> "SYSINITMCB" 83 addsection SYSINITMCB, PUBLIC class=SYSINITMCB align=16 84 istruc MCB 0 00000000 5A at mcbSignature,db 'Z' 0 00000001 0800 at mcbOwner, dw 8 0 00000003 [8001] at mcbSize, dw fromparas(paras(SYSINITSTACK)) + SYSSIZE wrt SYSINITSEG 0 00000005 0053 at mcbName, db "S" 0 00000009 001F at smcbType, db S_INIT 0 0000000B 00 iend 91 === Switch to base=00C400h -> "SYSINITSEG" 92 addsection SYSINITSEG, PUBLIC class=INIT === Switch to base=00C400h -> "SYSINITTRAIL" 93 addsection SYSINITTRAIL, PUBLIC class=INIT align=2 === Switch to base=00C400h -> "SYSINITLAST" 94 addsection SYSINITLAST, PUBLIC class=INIT align=2 95 96 group SYSINITGROUP SYSINITSEG SYSINITTRAIL SYSINITLAST 97 === Switch to base=0138D0h -> "AFTERSYSINIT" 98 addsection AFTERSYSINIT, PUBLIC class=AFTERSYSINIT align=16 99 global SYSSIZE 100 SYSSIZE LABEL BYTE 101 === Switch to base=002450h -> "BIOCODE" 102 addsection BIOCODE ; actually added before === Switch to base=000000h -> "DOSENTRY" 103 usesection DOSENTRY 104 105 %include "jumpmac.mac" 1 <1> ;;Rev 3.30 Modification 2 <1> ; 3 <1> ; given a label either 2 byte jump to another label _J 4 <1> ; if it is near enough or 3 byte jump to 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> 106 %unimacro PATHSTART 2 107 %unimacro PATHEND 2 108 109 %imacro PATHSTART 2 110 %IF PATHGEN ;3.30 111 PUBLIC %2%1S,%2%1E ;3.30 112 %2%1S LABEL BYTE ;3.30 113 %ENDIF ;3.30 114 %endmacro ;3.30 115 ;3.30 116 %imacro PATHEND 2 117 %IF PATHGEN ;3.30 118 %2%1E LABEL BYTE ;3.30 119 %ENDIF ;3.30 120 %endmacro ;3.30 121 122 %include "pushpop.mac" 1 <1> ; NASM original macros 2 <1> 3 <1> %unimacro stripangles 2.nolist 4 <1> %assign ?stackdepth 0 5 <1> 6 <1> %imacro stripangles 2.nolist 7 <1> %defstr %%param %2 8 <1> %rep 16 9 <1> %substr %%opening %%param 1 10 <1> %ifidn %%opening, '<' 11 <1> %substr %%param %%param 2,-1 12 <1> %endif 13 <1> %endrep 14 <1> %rep 16 15 <1> %strlen %%length %%param 16 <1> %substr %%closing %%param %%length 17 <1> %ifidn %%closing, '>' 18 <1> %substr %%param %%param 1,-2 19 <1> %endif 20 <1> %endrep 21 <1> %deftok %%token %%param 22 <1> %1 %%token 23 <1> %endmacro 24 <1> 25 <1> ;BREAK 26 <1> 27 <1> %imacro SaveReg 0-*.nolist ;; push those registers 28 <1> %rep %0 29 <1> %assign ?stackdepth ?stackdepth + 1 30 <1> stripangles push, %1 31 <1> %rotate 1 32 <1> %endrep 33 <1> %endmacro 34 <1> ;.xcref SaveReg 35 <1> 36 <1> ;BREAK 37 <1> 38 <1> %imacro RestoreReg 0-*.nolist ;; pop those registers 39 <1> %rep %0 40 <1> %assign ?stackdepth ?stackdepth - 1 41 <1> stripangles pop, %1 42 <1> %rotate 1 43 <1> %endrep 44 <1> %endmacro 45 <1> ;.xcref RestoreReg 123 %include "devsym.mac" ;MJB001 1 <1> %warning out: DEVSYM.INC... 1 ****************** <1> warning: out: DEVSYM.INC... [-w+user] 2 <1> ; SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04 3 <1> ; SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04 4 <1> 5 <1> ; THE DEVICE TABLE LIST HAS THE FORM: 6 <1> SYSDEV STRUC 0 00000000 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 00000004 ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 00000006 ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 00000008 ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 0000000A ???????????????? 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 0 00000000 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00000001 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00000002 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00000003 ???? REQSTAT DW ? ;STATUS WORD 0 00000005 ???????????????? 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 <1> DB (SRHEAD_struc_size) DUP(?) 157 <1> ; GENERIC IOCTL ADDITION. 0 0000000D ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 0000000E ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 0000000F ???? REG_SI DW ? 0 00000011 ???? REG_DI DW ? 0 00000013 ???????? 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 0 00000000 ???????? SECTOR_RBA DD ? ; relative block address 0 00000004 ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 00000006 ???????? 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 0 00000000 ???? MEDIA_level DW ? ; info level 0 00000002 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <1> MEDIA_Label DB 11 dup (?) ;volume label 0 00000011 ???????????????? 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 124 %include "msbds.mac" 1 <1> 2 <1> %warning out: MSBDS.INC... 2 ****************** <1> warning: out: MSBDS.INC... [-w+user] 3 <1> ; SCCSID = @(#)IBMBDS.ASM 1.9 85/09/16 4 <1> ;============================================================================== 5 <1> ;REVISION HISTORY: 6 <1> ;AN000 - New for DOS Version 4.00 - J.K. 7 <1> ;AC000 - Changed for DOS Version 4.00 - J.K. 8 <1> ;AN00x - PTM number for DOS Version 4.00 - J.K. 9 <1> ;============================================================================== 10 <1> ;AN001; D113 Disable I/O access to unformatted media 9/03/87 J.K. 11 <1> ;============================================================================== 12 <1> 13 <1> ; VALUES FOR VARIOUS FLAGS IN BDS.FLAGS. 14 <1> 15 <1> FNON_REMOVABLE EQU 01H ;FOR NON-REMOVABLE MEDIA 16 <1> FCHANGELINE EQU 02H ;IF CHANGELINE SUPPORTED ON DRIVE 17 <1> RETURN_FAKE_BPB EQU 04H ; WHEN SET, DON'T DO A BUILD BPB 18 <1> ; JUST RETURN THE FAKE ONE 19 <1> GOOD_TRACKLAYOUT EQU 08H ; THE TRACK LAYOUT HAS NO FUNNY SECTORS 20 <1> ; FCHANGED_BY_FORMAT EQU 08H 21 <1> FI_AM_MULT EQU 10H ;IF MORE THAN ONE LOGICAL FOR THIS PHYSICAL 22 <1> FI_OWN_PHYSICAL EQU 20H ;SIGNIFY LOGICAL OWNER OF THIS PHYSICAL 23 <1> FCHANGED EQU 40H ;INDICATES MEDIA CHANGED 24 <1> SET_DASD_TRUE EQU 80H ; SET DASD BEFORE NEXT FORMAT 25 <1> FCHANGED_BY_FORMAT EQU 100H ;MEDIA CHANGED BY FORMAT 26 <1> UNFORMATTED_MEDIA EQU 200H ;AN001; Fixed disk only 27 <1> F_LBA equ 400h ; LBA supported 28 <1> 29 <1> LBAPACKETSTRUC struc 0 00000000 ???? lpSize dw ? 0 00000002 ???? lpCount dw ? 0 00000004 ???????? lpBuffer dd ? 0 00000008 ???????????????? lpSector dd ?,? 34 <1> LBAPACKETSTRUC ends 35 <1> 36 <1> ; 37 <1> ; VARIOUS FORM FACTORS TO DESCRIBE MEDIA 38 <1> ; 39 <1> FF48TPI EQU 0 40 <1> FF96TPI EQU 1 41 <1> FFSMALL EQU 2 42 <1> FFHARDFILE EQU 5 43 <1> FFOTHER EQU 7 44 <1> 45 <1> BDS_TYPE STRUC 0 00000000 ???????? LINK DD ? ; LINK TO NEXT BDS 0 00000004 ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 00000005 ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 00000006 ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 00000008 ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 00000009 ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 0000000B ?? CFAT DB ? ; NUMBER OF FATS 0 0000000C ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 0000000E ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 00000010 ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 00000011 ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 00000013 ???? SECLIM DW ? ; SECTORS PER TRACK 0 00000015 ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 00000017 ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 00000019 ???? HIDSEC_H dw ? ;0 ;J.K.87 0 0000001B ???? DRVLIM_L dw ? ;0 ;J.K.87 0 0000001D ???? DRVLIM_H dw ? ;0 ;J.K.87 0 0000001F ?? FATSIZ DB ? ; FLAGS... 0 00000020 ???? OPCNT DW ? ; OPEN REF. COUNT 0 00000022 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 00000023 ???? FLAGS DW ? ; VARIOUS FLAGS 0 00000025 ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 00000027 ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 00000029 ?? RSECPERCLUS DB ? 0 0000002A ???? RRESSEC DW ? 0 0000002C ?? RCFAT DB ? 0 0000002D ???? RCDIR DW ? 0 0000002F ???? RDRVLIM DW ? 0 00000031 ?? RMEDIAD DB ? 0 00000032 ???? RCSECFAT DW ? 0 00000034 ???? RSECLIM DW ? 0 00000036 ???? RHDLIM DW ? 0 00000038 ???? RHIDSEC_L DW ? 0 0000003A ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 0000003C ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 0000003E ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 00000040 ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 00000046 ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 00000047 ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 00000049 ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <1> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 00000057 ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <1> FILESYS_Id db 9 dup (?) ;(0) ;J.K.87 Current file system id from Boot record 89 <1> BDS_TYPE ENDS 90 <1> 91 <1> BPBSIZE equ TRACK - RBYTEPERSEC ; SIZE IN BYTES OF RECBPB AREA IN THE BDS 92 <1> 93 <1> 94 <1> ;********************************************************************* 95 <1> ; BDS structure for mini disk - J.K. 4/7/86 96 <1> ;********************************************************************* 97 <1> 98 <1> BDSM_type struc 0 00000000 ???? mlink DW ? ;-1 ;Link to next structure 0 00000002 ???? DW ? 0 00000004 ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 00000005 ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 00000006 ???? mBytePerSec DW ? ;512 0 00000008 ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 00000009 ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 0000000B ?? mcFAT DB ? ;2 ;No. of allocation tables 0 0000000C ???? mcDIR DW ? ;16 ;Number of directory entries 0 0000000E ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 00000010 ?? mMediad DB ? ;11111000B ;Media descriptor 0 00000011 ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 00000013 ???? mSECLIM DW ? ;0 ;Sector limit 0 00000015 ???? mHDLIM DW ? ;0 ;Head limit 0 00000017 ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 00000019 ???? mHidsec_H dw ? ;0 ;J.K.87 0 0000001B ???? mDrvlim_L dw ? ;0 ;J.K.87 0 0000001D ???? mDrvlim_H dw ? ;0 ;J.K.87 0 0000001F ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 00000020 ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 00000022 ?? mFormFactor DB ? ;3 ;Form Factor 0 00000023 ???? mFLAGS DW ? ;0020H ;Various Flags 0 00000025 ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <1> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 00000046 ?? mTrack db ? ;-1 0 00000047 ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 00000049 ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <1> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 00000056 ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 00000057 ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 0000005B ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 00000063 ?? db ? ;0 131 <1> 132 <1> BDSM_type ENDS 133 <1> ;****************************************************************************** 134 <1> Max_mini_dsk_num equ 23 ;J.K. 4/7/86 - max # of mini disk ibmbio can support 135 <1> ; 136 <1> 125 126 ; REV 2.1 5/1/83 ARR ADDED TIMER INT HANDLER AND CHANGED ORDER OF AUX 127 ; PRN INIT FOR HAL0 128 ; 129 ; REV 2.15 7/13/83 ARR BECAUSE IBM IS FUNDAMENTALY BRAIN DAMAGED, AND 130 ; BASCOM IS RUDE ABOUT THE 1CH TIMER INTERRUPT, THE TIMER 131 ; HANDLER HAS TO GO BACK OUT!!!!! IBM SEEMS UNWILLING TO 132 ; BELIEVE THE PROBLEM IS WITH THE BASCOM RUNTIME, NOT THE 133 ; DOS. THEY HAVE EVEN BEEN GIVEN A PATCH FOR BASCOM!!!!! 134 ; THE CORRECT CODE IS COMMENTED OUT AND HAS AN ARR 2.15 135 ; ANNOTATION. THIS MEANS THE BIOS WILL GO BACK TO THE 136 ; MULTIPLE ROLL OVER BUG. 137 ; REV 2.20 8/5/83 ARR IBM MAKES HARDWARE CHANGE. NOW WANTS TO USE HALF 138 ; HIGHT DRIVES FOR HAL0, AND BACK FIT FOR PC/PC XT. PROBLEM 139 ; WITH HEAD SETTLE TIME. PREVIOUS DRIVES GOT BY ON A 0 140 ; SETTLE TIME, 1/2 HIGHT DRIVES NEED 15 HEAD SETTLE WHEN 141 ; DOING WRITES (0 OK ON READ) IF THE HEAD IS BEING STEPPED. 142 ; THIS REQUIRES A LAST TRACK VALUE TO BE KEPT SO THAT BIOS 143 ; KNOWS WHEN HEAD IS BEING MOVED. TO HELP OUT STUPID 144 ; PROGRAMS THAT ISSUE INT 13H DIRECTLY, THE HEAD SETTLE WILL 145 ; NORMALLY BE SET TO 15. IT WILL BE CHANGED TO 0 ON READS, 146 ; OR ON WRITES WHICH DO NOT REQUIRE HEAD STEP. 147 ; REV 2.21 8/11/83 MZ IBM WANTS WRITE WITH VERIFY TO USE HEAD SETTLE 0. 148 ; USE SAME TRICK AS ABOVE. 149 ; REV 2.25 6/20/83 MJB001 ADDED SUPPORT FOR 96TPI AND SALMON 150 ; REV 2.30 6/27/83 MJB002 ADDED REAL-TIME CLOCK 151 ; REV 2.40 7/8/83 MJB003 ADDED VOLUME-ID CHECKING AND INT 2F MACRO 152 ; DEFINITIONS PUSH* AND POP* 153 ; REV 2.41 7/12/83 ARR MORE 2.X ENHANCEMENTS. OPEN/CLOSE MEDIA CHANGE 154 ; REV 2.42 11/3/83 ARR MORE 2.X ENHANCEMENTS. DISK OPEN/CLOSE, FORMAT 155 ; CODE AND OTHER MISC HOOKED OUT TO SHRINK BIOS. CODE FOR 156 ; DISK OPEN/CLOSE, FORMAT INCLUDED ONLY WITH 96TPI DISKS. 157 ; REV 2.43 12/6/83 MZ EXAMINE BOOT SECTORS ON HARD DISKS FOR 16-BIT FAT 158 ; CHECK. EXAMINE LARGE FAT BIT IN BPB FOR WALK OF MEDIA FOR 159 ; DOS 160 ; REV 2.44 12/9/83 ARR CHANGE TO ERROR REPORTING ON INT 17H 161 ; REV 2.45 12/22/83 MZ MAKE HEAD SETTLE CHANGE ONLY WHEN DISK PARM IS 0. 162 163 ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 164 ; 165 ; IBM ADDRESSES FOR I/O 166 ; 167 ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 168 169 %include "msdskpr.mac" 1 <1> ; The following structure defines the disk parameter table 2 <1> ; pointed to by Interrupt vector 1EH (location 0:78H) 3 <1> 4 <1> DISK_PARMS STRUC 0 00000000 ?? DISK_SPECIFY_1 DB ? 0 00000001 ?? DISK_SPECIFY_2 DB ? 0 00000002 ?? DISK_MOTOR_WAIT DB ? ; Wait till motor off 0 00000003 ?? DISK_SECTOR_SIZ DB ? ; Bytes/Sector (2 = 512) 0 00000004 ?? DISK_EOT DB ? ; Sectors per track (MAX) 0 00000005 ?? DISK_RW_GAP DB ? ; Read Write Gap 0 00000006 ?? DISK_DTL DB ? 0 00000007 ?? DISK_FORMT_GAP DB ? ; Format Gap Length 0 00000008 ?? DISK_FILL DB ? ; Format Fill Byte 0 00000009 ?? DISK_HEAD_STTL DB ? ; Head Settle Time (MSec) 0 0000000A ?? DISK_MOTOR_STRT DB ? ; Motor start delay 16 <1> DISK_PARMS ENDS 17 <1> 18 <1> ROMStatus equ 1 19 <1> ROMRead equ 2 20 <1> ROMWrite equ 3 21 <1> ROMVerify equ 4 22 <1> ROMFormat equ 5 170 171 LF equ 10 ;LINE FEED 172 CR equ 13 ;CARRIAGE RETURN 173 BACKSP equ 8 ;BACKSPACE 174 BRKADR equ 1BH * 4 ;006C 1BH BREAK VECTOR ADDRESS 175 TIMADR equ 1CH * 4 ;0070 1CH TIMER INTERRUPT 176 DSKADR equ 1EH * 4 ;ADDRESS OF PTR TO DISK PARAMETERS 177 SEC9 equ 522H ;ADDRESS OF DISK PARAMETERS 178 HEADSETTLE equ SEC9+9 ; ARR 2.20 ADDRESS OF HEAD SETTLE TIME 179 NORMSETTLE equ 15 ; ARR 2.20 NORMAL HEAD SETTLE 180 SPEEDSETTLE equ 0 ; ARR 2.20 SPEED UP SETTLE TIME 181 INITSPOT equ 534H ; ARR IBM WANTS 4 ZEROS HERE 182 AKPORT equ 20H 183 EOI equ 20H 184 185 assume ds:nothing, es:nothing, ss:nothing 186 187 EXTRN MEDIA$CHK:NEAR 188 EXTRN GET$BPB:NEAR 189 EXTRN DSK$INIT:NEAR 190 EXTRN DSK$READ:NEAR 191 EXTRN DSK$WRIT:NEAR 192 EXTRN DSK$WRITV:NEAR 193 EXTRN DSK$OPEN:NEAR 194 EXTRN DSK$CLOSE:NEAR 195 EXTRN DSK$REM:NEAR 196 EXTRN GENERIC$IOCTL:NEAR 197 EXTRN IOCTL$GETOWN:NEAR 198 EXTRN IOCTL$SETOWN:NEAR 199 EXTRN CON$READ:NEAR 200 EXTRN CON$RDND:NEAR 201 EXTRN CON$FLSH:NEAR 202 EXTRN CON$WRIT:NEAR 203 ; EXTRN CON$GENIOCTL:NEAR ;J.K. 4/29/86 204 EXTRN AUX$READ:NEAR 205 EXTRN AUX$WRIT:NEAR 206 EXTRN AUX$FLSH:NEAR 207 EXTRN AUX$RDND:NEAR 208 EXTRN AUX$WRST:NEAR 209 EXTRN TIM$READ:NEAR 210 EXTRN TIM$WRIT:NEAR 211 EXTRN PRN$WRIT:NEAR 212 EXTRN PRN$STAT:NEAR 213 EXTRN PRN$TILBUSY:NEAR 214 EXTRN PRN$GENIOCTL:NEAR 215 EXTRN WRMSG:NEAR 216 217 218 ;=== Push trace listing source: msbdata.nas 219 %include "msbdata.nas" ; NASM included file 1 <1> 2 <1> %include "nasmorg.mac" 1 <2> 2 <2> %if 0 3 <2> 4 <2> NASM macros to replace JWasm org directive 5 <2> 2024 by E. C. Masloch, Public Domain 6 <2> 7 <2> %endif 8 <2> 9 <2> %imacro org 1-2.nolist db 0 10 <2> times (%1) - ($ - $$) %2 11 <2> %endmacro 3 <1> %include "amis.mac" 1 <2> [list -] 4 <1> 5 <1> BASE700h equ 256 ; DOSENTRY:this value should -> 00700h 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> section DOSENTRY 8 <1> ;============================================================================== 9 <1> ;REVISION HISTORY: 10 <1> ;AN000 - New for DOS Version 3.4 - J.K. 11 <1> ;AC000 - Changed for DOS Version 3.4 - J.K. 12 <1> ;ANxxx - PTR, DCRs 13 <1> ;============================================================================== 14 <1> ;AN001 - d9 Double word MOV instruction for 80386 based machine. 7/1/87 J.K. 15 <1> ;AN002 - d25 Change DASD ERP to that recommended by Storage Systems. 7/29/87 J.K. 16 <1> ;AN003; d304 Boot record structure change for OS2 11/9/87 J.K. 17 <1> ;============================================================================== 18 <1> EXTRN INIT:NEAR 19 <1> 20 <1> PUBLIC START$ 21 <1> START$: 22 <1> assume ds:nothing, es:nothing, ss:nothing 0 00000000 E9[0000] JMP INIT ;START$ PATCH BY INIT TO POINT TO 24 <1> ;HDRIVE BPB 0 00000003 26 align 16, db 26h 26 <1> ; PUBLIC FORMAT_PATCH 27 <1> ;FORMAT_PATCH: ;ARR 2.42 28 <1> ; JMP FMTSET ;MJB001 DISPATCH FOR CALL FROM FORMAT UTILITY 29 <1> 30 <1> 31 <1> PATHSTART 001,BIO 110 <2> %IF PATHGEN 111 <2> PUBLIC %2%1S,%2%1E 112 <2> %2%1S LABEL BYTE 113 <2> %ENDIF 32 <1> 33 <1> ; DB 20 DUP (0) ;IBM WANTS SOME ZEROED AREA (DELETED) 34 <1> 35 <1> 36 <1> ;HEADER DB "Ver 2.45" 37 <1> 38 <1> global dosentry_xmsentry 39 <1> %include "codesw.mac" 1 <2> DOSCODE_HMA_SEGMENT equ 0FFFEh 2 <2> ; address DOSCODE at this segment when in HMA 3 <2> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h 4 <2> ; offset from DOSCODE offset 0 to address 10_0000h 5 <2> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h 6 <2> ; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB 40 <1> %include "entrysw.mac" 1 <2> 2 <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h 3 <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16 4 <2> 5 <2> DOSENTRYDEVICEBASE equ 10h 41 <1> %include "entry.asm" ; new in lDOS 1 <2> 2 <2> %if 0 3 <2> 4 <2> lDOS DOSENTRY handling 5 <2> by E. C. Masloch, 2018--2025 6 <2> 7 <2> Usage of the works is permitted provided that this 8 <2> instrument is retained with the works, so that any entity 9 <2> that uses the works is notified of this instrument. 10 <2> 11 <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <2> 13 <2> %endif 14 <2> 15 <2> %if 0 16 <2> 17 <2> (lMS-DOS: Comments not current) 18 <2> 19 <2> The DOSENTRY section is always located at segment 70h. It includes some data 20 <2> structures found in MS-DOS (most notably the Int19 interrupt restoration table 21 <2> at 70h:100h), the device headers for all default devices (except NUL) and all 22 <2> code entries into the DOS code. If the DOS code is not relocateable, DOSENTRY 23 <2> and DOSCODE are merged into one section. 24 <2> 25 <2> Relocated entries which are in DOSENTRY for relocation: 26 <2> Interrupt 00h Division error exception 27 <2> Interrupt 06h Invalid opcode exception 28 <2> Interrupt 13h BIOS disk services 29 <2> Interrupt 19h Reboot 30 <2> Interrupt 1Bh Ctrl-Break notification 31 <2> Interrupt 20h Terminate program 32 <2> Interrupt 21h DOS services 33 <2> Interrupt 25h Absolute disk read 34 <2> Interrupt 26h Absolute disk write 35 <2> Interrupt 27h Terminate and stay resident 36 <2> Interrupt 28h Idle 37 <2> Interrupt 29h Display character 38 <2> Interrupt 2Fh Multiplex, DOS services 39 <2> CALL 5 CP/M compatibility services (subset of interrupt 21h) 40 <2> Device strategy All device functions 41 <2> Case map function Maps language-specific characters >=80h to uppercase 42 <2> Redirector mapper Maps unhandled redirector calls to MS-DOS interface 43 <2> 44 <2> If DOSCODE is not the same section as DOSENTRY (if DOSCODE is relocateable), 45 <2> each of the relocated entries calls relocatedentry with a parameter behind the 46 <2> near call opcode. The near call opcode and the byte sized parameter for each 47 <2> entry need 4 byte. relocatedentry insures that DOSCODE is available (switches 48 <2> the A20 line on if DOSCODE is in the HMA) and jumps to the DOSCODE function 49 <2> relocated_relocatedentry. The latter uses the in-code parameter (behind the 50 <2> function call within DOSENTRY) as a displacement into doscode_entrypoint_list, 51 <2> where we store the target near address in DOSCODE. 52 <2> 53 <2> If the target DOSCODE near address is equal to DEVStrategy, then the entry in 54 <2> doscode_entrypoint_list contains another word (after the DEVStrategy address) 55 <2> which points at a device strategy function dispatch table, stored in DOSCODE. 56 <2> Some of the device strategies also include another byte after the table offset, 57 <2> which gives the device unit to use (only used for PRN/LPTx and AUX/COMx). 58 <2> 59 <2> It is insured that an entry of doscode_entrypoint_list with displacement 60 <2> equal to 0CCh is not used, so that relocated_relocatedentry can reliably 61 <2> detect breakpoints set after the call jumps. Such a breakpoint hides the true 62 <2> displacement value and thus must be detected and circumvented. 63 <2> 64 <2> Entries which are in DOSENTRY but don't execute code in DOSCODE: 65 <2> Interrupt 23h Always terminates application 66 <2> Interrupt 24h Always fails call 67 <2> Interrupt 2Eh Always reports error 68 <2> Device interrupt MS-DOS device compatibility (does nothing) 69 <2> Dummy file sharer Always returns error 0001h (Invalid function) 70 <2> Dummy redirector Always returns error 0001h (Invalid function) 71 <2> Other hooked interrupts Do nothing 72 <2> 73 <2> %endif 74 <2> === Switch to base=000000h -> "DOSENTRY" 75 <2> usesection DOSENTRY 76 <2> 77 <2> %assign _DOSCODEHMA 1 78 <2> %assign _RELOCATEDOSCODE 1 79 <2> 80 <2> %assign _FATFS 0 81 <2> %assign _MAPPER 0 82 <2> %assign _INT28 0 83 <2> %assign _CALL5 1 84 <2> 85 <2> 86 <2> %define ENTRYPOINT_LIST .none,dw "",dw "",db "",db "" 87 <2> 88 <2> %imacro _relocate 1-4.nolist "","","" 89 <2> call relocatedentry 90 <2> retf ; help debugging. handler will reflect back 91 <2> ; to the stub here with the modified stack. 92 <2> add_to_entrypoint_list %%label,dw %1,dw %2,db %3,db %4,ENTRYPOINT_LIST 93 <2> extern %1 94 <2> 95 <2> db %%label - doscode_entrypoint_list 96 <2> %endmacro 97 <2> %if _RELOCATEDOSCODE 98 <2> %idefine relocate _relocate 99 <2> %endif 100 <2> %idefine devicerelocate _relocate 101 <2> 102 <2> %imacro add_to_entrypoint_list 5-*.nolist 103 <2> %if %0 % 5 104 <2> %fatal Expected a number of arguments that is a multiple of five 105 <2> %endif 106 <2> %push 107 <2> %define %$label %1 108 <2> %define %$two %2 109 <2> %define %$three %3 110 <2> %define %$four %4 111 <2> %define %$five %5 112 <2> %assign %$found 0 113 <2> %rotate 5 114 <2> %rep (%0 - 5) / 5 115 <2> %ifn %$found 116 <2> %ifidn %$two, %2 117 <2> %ifidn %$three,%3 118 <2> %ifidn %$four, %4 119 <2> %ifidn %$five, %5 120 <2> %$label: equ %1 121 <2> %assign %$found 1 122 <2> %endif 123 <2> %endif 124 <2> %endif 125 <2> %endif 126 <2> %endif 127 <2> %rotate 5 128 <2> %endrep 129 <2> %ifn %$found 130 <2> %xdefine ENTRYPOINT_LIST ENTRYPOINT_LIST,%$label,%$two,%$three,%$four,%$five 131 <2> %endif 132 <2> %pop 133 <2> %endmacro 134 <2> 135 <2> %imacro write_entrypoint_list 0-*.nolist 136 <2> align 2 137 <2> doscode_entrypoint_list: 138 <2> %if %0 % 5 139 <2> %fatal Expected a number of arguments that is a multiple of five 140 <2> %endif 141 <2> %rep %0 / 5 142 <2> align 2 143 <2> ; %if ($ - doscode_entrypoint_list) == 0CCh 144 <2> ; %warning added word to doscode_entrypoint_list to find bp after call jump 145 <2> ; dw 9090h 146 <2> ; %endif 147 <2> %1: ; label (used as displacement from doscode_entrypoint_list) 148 <2> %2 ; entrypoint (word) 149 <2> %3 ; device function table, if any (word) 150 <2> %4 ; device unit number, if any (byte) 151 <2> %5 ; second device unit number, if any (byte) 152 <2> %rotate 5 153 <2> %endrep 154 <2> doscode_entrypoint_list.end: 155 <2> %endmacro 156 <2> 157 <2> 158 <2> align 2 159 <2> assume cs:nothing, ds:nothing, es:nothing, ss:nothing 160 <2> %if _RELOCATEDOSCODE 161 <2> %if _DOSCODEHMA 0 00000010 90 nop 0 00000011 90 nop ; insure ri00o != 0 164 <2> %endif 0 00000012 A8 i00: db __TEST_IMM8 ; skip stc, NC 0 00000013 F9 i19: stc 0 00000014 E80901CB00 relocate relocated_i00_i19 168 <2> ; i06: relocate relocatedi06 0 00000019 E80401CB02 msdisk_i13: relocate relocatedmsdisk_i13 0 0000001E E8FF00CB04 ms96tpi_i13: relocate relocatedms96tpi_i13 0 00000023 E8FA00CB06 i1B: relocate relocatedi1B 0 00000028 31C0 i20: xor ax, ax 0 0000002A E8F300CB08 i21: relocate relocatedi21 0 0000002F A8 i25: db __TEST_IMM8 ; skip stc, NC 0 00000030 F9 i26: stc 0 00000031 E8EC00CB0A relocate relocated_i25_i26 0 00000036 E8E700CB0C i27: relocate relocatedi27 178 <2> %if _INT28 179 <2> i28: relocate relocatedi28 180 <2> %endif 0 0000003B E8E200CB0E i29: relocate relocatedi29 0 00000040 E8DD00CB10 i2F: relocate relocatedhead_i2F 0 00000045 E8D800CB12 call5: relocate relocatedcall5 0 0000004A A8 i31: db __TEST_IMM8 ; skip stc, NC 0 0000004B F9 i6C: stc 0 0000004C E8D100CB14 relocate relocated_i31_i6C 187 <2> %if _FATFS 188 <2> fatfs: jmp short .jump 189 <2> .next: jmp FIXDOSENTRY:mapper 190 <2> .jump: relocate relocatedfatfs 191 <2> fatfs2: jmp short .jump 192 <2> .next: jmp FIXDOSENTRY:NotHooked 193 <2> .jump: relocate relocatedfatfs2 194 <2> %endif 195 <2> %if _MAPPER 196 <2> mapper: relocate relocatedmapper 197 <2> %endif 0 00000051 E8CC00CB16 casemap:relocate relocatedcasemap 0 00000056 E8C700CB18 fastentry: relocate relocatedfastentry 0 0000005B E8C200CB1A ifsentry: relocate relocatedifsentry 0 00000060 E8BD00CB1C okcallentry: relocate relocatedokcallentry 0 00000065 E8B800CB1E badcallentry: relocate relocatedbadcallentry 203 <2> %endif 204 <2> 205 <2> 206 <2> i23: 0 0000006A F9 stc 208 <2> entry_retf: 0 0000006B CB retf 210 <2> 211 <2> i24: 0 0000006C B003 mov al, 03h 213 <2> entry_iret: 0 0000006E CF iret 215 <2> 216 <2> a20off_entry: 0 0000006F B406 mov ah, 06h ; Local Disable A20 (04h would be Global) 0 00000071 0E push cs 0 00000072 E81000 call transfer_xmsentry 220 <2> ; ignore errors 0 00000075 B404 mov ah, 04h ; Global Disable A20 0 00000077 0E push cs 0 00000078 E80A00 call transfer_xmsentry 224 <2> ; ignore errors 0 0000007B 5B pop bx ; get bx and ax from stack 0 0000007C 58 pop ax 0 0000007D CF iret ; pop ip, cs, fl 228 <2> 229 <2> global run_int21_shell 230 <2> run_int21_shell: 231 <2> assume ds:nothing, es:nothing, ss:nothing 0 0000007E CD21 int 21h 0 00000080 E89D00CB20 relocate relocatedshellreturned 234 <2> 235 <2> times ((((2) - (($-$$) % (2))) % (2))) ^ 1 nop ; anti align 236 <2> transfer_xmsentry: ; far jumps to XMS entrypoint 0 00000085 EA[6B00][0000] jmp DOSENTRY:entry_retf 238 <2> dosentry_xmsentry: equ $ - 4 ; patched to hold XMS entrypoint address 239 <2> 240 <2> 241 <2> global i20, i21, i25, i26, i27, i2F, call5, i23, i24, entry_iret 242 <2> global fastentry, ifsentry, okcallentry, badcallentry, i00, casemap, i31 243 <2> global a20off_entry, i19, msdisk_i13, ms96tpi_i13 244 <2> global i29, entry_iret, i1B 245 <2> global conentry, prnentry, auxentry 246 <2> global com1entry, com2entry, com3entry, com4entry 247 <2> global lpt1entry, lpt2entry, lpt3entry, clockentry, blockentry 248 <2> global i6C 249 <2> 250 <2> %if 0 251 <2> %imacro irtentry 1.nolist 252 <2> db %1 253 <2> dd 0 254 <2> %endmacro 255 <2> 256 <2> 257 <2> %assign num 256-($-$$) 258 <2> %warning num bytes in front of IRT 259 <2> 260 <2> _fill 256, 0, dosentry_start 261 <2> InterruptRestorationTable: 262 <2> irtentry 10h 263 <2> irtentry 13h 264 <2> irtentry 15h 265 <2> irtentry 19h 266 <2> irtentry 1Bh 267 <2> ; Above interrupts are in the order MS-DOS 6.x saves them 268 <2> ; (FDEMM386?/Jemm expects Int19 within the first five entries) 269 <2> 270 <2> irtentry 00h 271 <2> irtentry 01h 272 <2> irtentry 03h 273 <2> irtentry 04h 274 <2> irtentry 06h 275 <2> irtentry 08h 276 <2> irtentry 16h 277 <2> irtentry 1Ch 278 <2> irtentry 1Eh 279 <2> irtentry 21h 280 <2> irtentry 23h 281 <2> irtentry 24h 282 <2> irtentry 29h 283 <2> irtentry 2Fh 284 <2> irtentry 33h 285 <2> db -1 286 <2> %endif 287 <2> 288 <2> 289 <2> extern dosdata_to_doscode_segment 290 <2> 291 <2> ; %if _INT19_IN_DOSENTRY 292 <2> ; %if _RELOCATEDOSCODE 293 <2> ; i19: 294 <2> ; %endif 295 <2> ; %include "int19.asm" 296 <2> ; %endif 297 <2> 298 <2> %if _RELOCATEDOSCODE && _DOSCODEHMA 299 <2> ; CHG: ds, si, ax 300 <2> ; OUT: NZ if A20 line is switched on 301 <2> ; ZR if A20 line is switched off 302 <2> ; may return with IF=0 303 <2> ; UP 304 <2> dosentry_check_a20: 305 <2> assume cs:DOSENTRYGROUP, ds:nothing, es:nothing, ss:nothing 0 0000008A FC cld 0 0000008B 06 push es 0 0000008C 57 push di 0 0000008D 51 push cx 0 0000008E 31FF xor di, di 0 00000090 8EC7 mov es, di ; es = 0000h 312 <2> assume es:IVT 0 00000092 4F dec di 0 00000093 8EDF mov ds, di ; ds = FFFFh 315 <2> assume ds:nothing 0 00000095 47 inc di ; es:di = 0000h:0000h = 00000h 0 00000096 BE1000 mov si, 0010h ; ds:si = FFFFh:0010h = 100000h 318 <2> ; (same address if bit 20 off) 0 00000099 89F1 mov cx, si ; 32 byte (16 = 10h word) 0 0000009B 56 push si 0 0000009C F3A7 repe cmpsw ; compare, A20 line switched on if differing 0 0000009E 5E pop si ; -> FFFFh:0010h = 10_0000h 323 <2> ; (in the HMA, part of the VDISK header) 0 0000009F 750B jne .ret ; differing --> 0 000000A1 31FF xor di, di ; -> 0000h:0000h = 00_0000h 326 <2> ; (in the LMA, offset word of int 00h handler) 0 000000A3 FA cli ; try not to run interrupt handlers during this 0 000000A4 FF34 push word [si] ; save value 0 000000A6 FF0C dec word [si] ; change value (in HMA, or wrapped around LMA) 0 000000A8 A7 cmpsw ; compare values, NZ if A20 is switched on 0 000000A9 8F44FE pop word [si - 2] ; restore value 332 <2> ; This can still report a false negative (A20 detected off 333 <2> ; when actually it is on), but we don't care about that. 334 <2> .ret: 0 000000AC 59 pop cx 0 000000AD 5F pop di 0 000000AE 07 pop es 338 <2> assume es:nothing 0 000000AF C3 retn 340 <2> 341 <2> 342 <2> @@: 343 <2> assume ds:nothing, es:nothing, ss:nothing 0 000000B0 53 push bx 0 000000B1 55 push bp 0 000000B2 B40E mov ah, 0Eh 0 000000B4 BB0700 mov bx, 7 0 000000B7 CD10 int 10h 0 000000B9 5D pop bp 0 000000BA 5B pop bx 351 <2> 352 <2> dosentry_disp_msg_cs: 353 <2> assume ds:nothing, es:nothing, ss:nothing 0 000000BB 2EAC cs lodsb 0 000000BD 84C0 test al, al 0 000000BF 75EF jnz @B 0 000000C1 C3 retn 358 <2> 359 <2> 360 <2> dosentry_msg: 0 000000C2 444F53454E54525920 .a20_error_common: asciz "DOSENTRY A20 error: XMS call " 0 000000CB 413230206572726F72 0 000000D4 3A20584D532063616C 0 000000DD 6C2000 0 000000E0 6661696C656400 .a20_error_xms: asciz "failed" 0 000000E7 7265706F7274656420 .a20_error_actual: asciz "reported success but A20 is still off" 0 000000F0 737563636573732062 0 000000F9 757420413230206973 0 00000102 207374696C6C206F66 0 0000010B 6600 0 0000010D 2E0D0A53797374656D .a20_error_after: asciz ".",13,10,"System halted. " 0 00000116 2068616C7465642E20 0 0000011F 00 365 <2> %endif 366 <2> 367 <2> 368 <2> ; INP: byte [cs:ip + 1] = displacement in doscode_entrypoint_list 369 <2> ; word [DOSCODE:(displaced)] 370 <2> ; = relocated entry address 371 <2> ; word [DOSCODE:(displaced + 2)] 372 <2> ; = optional pointer to device function table 373 <2> ; byte [DOSCODE:(displaced + 4)] 374 <2> ; = optional device unit 375 <2> ; OUT: Jumps to DOSCODE:(relocated entry address) 376 <2> ; If the relocated entry address is DEVStrategy, 377 <2> ; ss:sp-> device unit or garbage (word), 378 <2> ; pointer to device function table (word) 379 <2> ; CHG: - (not even flags!) 380 <2> ; STT: - 381 <2> %if ($ - $$) < DOSENTRYDEVICEBASE * 16 382 <2> %error Entrypoint must be above or equal device base 383 <2> %endif 384 <2> 385 <2> relocatedentry: 386 <2> assume cs:nothing, ds:nothing, es:nothing, ss:nothing 0 00000120 0E push cs 0 00000121 EA[2601][0000] jmp DOSENTRY:.fixsegment ; insure cs = 70h 389 <2> .fixsegment: 390 <2> assume cs:DOSENTRYGROUP 391 <2> 0 00000126 50 push ax 393 <2> %if _RELOCATEDOSCODE 0 00000127 1E push ds 395 <2> 396 <2> %if _DOSCODEHMA 397 <2> global ..@dosentry_patch_hma 398 <2> ..@dosentry_patch_hma: 0 00000128 EB37 jmp strict short .not_in_hma ; patch to a 2-byte NOP if in HMA 400 <2> 401 <2> ; DOSCODE is in HMA: check A20 and try to enable if disabled 402 <2> ; INP: - 403 <2> ; CHG: ds 404 <2> 0 0000012A 9C pushf 0 0000012B 56 push si 407 <2> ; INP: - 408 <2> ; OUT: A20 enabled 409 <2> ; CHG: ax, si, fl, ds 0 0000012C E85BFF call dosentry_check_a20 0 0000012F 752E jne .hma_available ; not equal, A20 line is switched on --> 412 <2> 0 00000131 B405 mov ah, 05h ; Local Enable A20 (03h would be Global ?) 0 00000133 53 push bx 0 00000134 0E push cs 0 00000135 E84DFF call transfer_xmsentry ; request local enable A20 0 00000138 5B pop bx ; may return an error code in bl 0 00000139 48 dec ax ; 0001h if successful 0 0000013A B8[E000] mov ax, dosentry_msg.a20_error_xms ; access with cs 0 0000013D 7508 jnz .error ; was not 0001h --> 421 <2> 0 0000013F E848FF call dosentry_check_a20 ; check again 0 00000142 751B jne .hma_available ; not equal, A20 line is now switched on --> 424 <2> 0 00000144 B8[E700] mov ax, dosentry_msg.a20_error_actual ; access with cs 426 <2> .error: 0 00000147 50 push ax 0 00000148 BE[C200] mov si, dosentry_msg.a20_error_common ; access with cs 0 0000014B E86DFF call dosentry_disp_msg_cs 0 0000014E 5E pop si 0 0000014F E869FF call dosentry_disp_msg_cs 0 00000152 BE[0D01] mov si, dosentry_msg.a20_error_after ; access with cs 0 00000155 E863FF call dosentry_disp_msg_cs 434 <2> .loop: 0 00000158 CC int3 0 00000159 31C0 xor ax, ax 0 0000015B CD16 int 16h 0 0000015D EBF9 jmp .loop 439 <2> 440 <2> 441 <2> .hma_available: 0 0000015F 5E pop si 0 00000160 9D popf 444 <2> .not_in_hma: 445 <2> %endif 446 <2> 447 <2> %if 1 0 00000161 B80000 mov ax, 0 ; patched to point to DOSCODE 449 <2> global ..@dosentry_doscode_segment 450 <2> ..@dosentry_doscode_segment equ $ - 2 451 <2> %else 452 <2> %if 0 453 <2> mov ds, word [cs:dosentry_to_dosdata_segment] ; => DOSDATA 454 <2> assume ds:DOSGROUP 455 <2> %else 456 <2> mov ax, 0 ; ! preserve fl 457 <2> mov ds, ax 458 <2> assume ds:IVT 459 <2> mov ds, word [31h * 4 + 2] ; => DOSDATA 460 <2> assume ds:DOSGROUP 461 <2> %endif 462 <2> mov ax, word [dosdata_to_doscode_segment] ; => DOSCODE 463 <2> %endif 464 <2> assume ds:nothing 465 <2> ; ax => DOSCODE segment 466 <2> 467 <2> ; have ss:sp -> (bp), ds, ax, cs, ip, original 468 <2> ; want ss:sp -> tip, tcs, cip, ccs, ax, cs, ip, original 469 <2> lframe 0 470 <2> ; above this original stack 471 <2> lpar word, in_tip ; transfer stub ip 472 <2> lpar word, in_tcs ; transfer stub cs 473 <2> lpar word, in_ax ; original ax, passed to relocated_ 474 <2> lpar word, in_ds_out_ccs ; original ds, gets DOSCODE cs 0 00000164 5589E5 lenter 476 <2> lequ ?frame_bp, in_bp_out_cip ; original bp, gets DOSCODE ip 0 00000167 FF7606 push word [bp + ?in_tcs] 0 0000016A FF7608 push word [bp + ?in_tip] 479 <2> lvar dword, out_tcsip ; transfer cs:ip (help debugging) 0 0000016D 874602 xchg ax, word [bp + ?in_ds_out_ccs] 481 <2> ; => DOSCODE 0 00000170 8ED8 mov ds, ax ; restore ds 483 <2> assume ds:nothing 0 00000172 B8[E500] mov ax, relocated_relocatedentry 0 00000175 874600 xchg ax, word [bp + ?in_bp_out_cip] 486 <2> ; ax = original bp, ?out_cip -> entrypoint 487 <2> lleave ctx 488 <2> 489 <2> ; INP: ss:(sp + 6) -> arbitrary stack of entrypoint 490 <2> ; word [ss:sp + 4] = entrypoint's ip, 491 <2> ; word [ss:sp + 2] = entrypoint's cs, 492 <2> ; word [ss:sp + 0] = original ax value 0 00000178 CB retf ; control flow goes back to transfer stub 494 <2> ; which has a retf to go to DOSCODE 495 <2> %else 496 <2> ; This stub is used by devicerelocate! 497 <2> jmp relocated_relocatedentry 498 <2> %endif 42 <1> 43 <1> === Switch to base=000000h -> "DOSENTRY" 44 <1> usesection DOSENTRY 45 <1> 46 <1> extern conentry, prnentry, auxentry 47 <1> extern com1entry, com2entry, com3entry, com4entry 48 <1> extern lpt1entry, lpt2entry, lpt3entry, clockentry, blockentry 49 <1> 50 <1> global amis_sign 51 <1> amis_sign: 0 00000179 65636D20 .ven: fill 8, 32, db "ecm" 0 00000181 6C444F5320 .prod: fill 8, 32, db "lDOS" 0 00000189 00 asciz 55 <1> 56 <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16 57 <1> %error Header must be above or equal device base 58 <1> %endif 59 <1> EVENB 60 <1> PUBLIC CONHEADER 61 <1> CONHEADER LABEL WORD ;HEADER FOR DEVICE "CON" 0 0000018A [9C00][0000] dw AUXDEV2 - DOSENTRYDEVICEBASE * 16, seg AUXDEV2 + DOSENTRYDEVICEBASE 0 0000018E 1380 DW 10000000_00010011B ;CON IN AND CON OUT + SPECIAL 0 00000190 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 00000192 [BC00] DW conentry - DOSENTRYDEVICEBASE * 16 0 00000194 434F4E2020202020 DB 'CON ' 67 <1> 68 <1> EVENB 69 <1> PUBLIC AUXDEV2 70 <1> AUXDEV2 LABEL WORD ;HEADER FOR DEVICE "AUX" 0 0000019C [2001][0000] dw PRNDEV2 - DOSENTRYDEVICEBASE * 16, seg PRNDEV2 + DOSENTRYDEVICEBASE 0 000001A0 0080 DW 10000000_00000000B 0 000001A2 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 000001A4 [C600] DW auxentry - DOSENTRYDEVICEBASE * 16 0 000001A6 4155582020202020 DB 'AUX ' 76 <1> 77 <1> %assign num BASE700h + 0B0h - ($-$$) 78 <1> %warning num bytes in front of prior old13 78 ****************** <1> warning: 2 bytes in front of prior old13 [-w+user] 0 000001AE 00 org BASE700h + 0B0h 80 <1> EVENB 0 000001B0 FFFFFFFF dd -1 ; prior OLD13 82 <1> 83 <1> %assign num BASE700h + 0B4h - ($-$$) 84 <1> %warning num bytes in front of orig13 84 ****************** <1> warning: 0 bytes in front of orig13 [-w+user] 85 <1> org BASE700h + 0B4h ; noted in EDR-DOS sources as being used by some applications 86 <1> PUBLIC ORIG13 87 <1> ORIG13 label DWORD 0 000001B4 32310000 db '21',0,0 ;J.K. 11/8/86 This is my employee serial # !!! 89 <1> 90 <1> EVENB 91 <1> PUBLIC PTRSAV 0 000001B8 00000000 PTRSAV DD 0 93 <1> 94 <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16 95 <1> %error Entrypoint must be above or equal device base 96 <1> %endif 0 000001BC E861FFCB22 conentry: relocate relocateddeventry, CONTBL 0 000001C1 E85CFFCB26 prnentry: relocate relocateddevprnentry, PRNTBL, 0, 0 0 000001C6 E857FFCB2C auxentry: relocate relocateddeventry, AUXTBL, 0 0 000001CB E852FFCB2C com1entry: relocate relocateddeventry, AUXTBL, 0 0 000001D0 E84DFFCB32 com2entry: relocate relocateddeventry, AUXTBL, 1 0 000001D5 E848FFCB38 com3entry: relocate relocateddeventry, AUXTBL, 2 0 000001DA E843FFCB3E com4entry: relocate relocateddeventry, AUXTBL, 3 0 000001DF E83EFFCB44 lpt1entry: relocate relocateddevprnentry, PRNTBL, 0, 1 0 000001E4 E839FFCB4A lpt2entry: relocate relocateddevprnentry, PRNTBL, 1, 2 0 000001E9 E834FFCB50 lpt3entry: relocate relocateddevprnentry, PRNTBL, 2, 3 0 000001EE E82FFFCB56 clockentry: relocate relocateddeventry, TIMTBL 0 000001F3 E82AFFCB5A blockentry: relocate relocateddeventry, DSKTBL 0 000001F8 E825FFCB5E strategyentry: relocate relocatedstrategyentry 110 <1> 111 <1> ;-------------------------------------------------------------- 112 <1> ; 113 <1> ; COMMAND JUMP TABLES 114 <1> ; 115 <1> ; BEWARE - THESE TABLES OVERLAP SOMEWHAT! -C.P. 116 <1> ; 117 <1> === Switch to base=002450h -> "BIOCODE" 118 <1> usesection BIOCODE 119 <1> 0 00007EEE ?? ODD 121 <1> DSKTBL LABEL BYTE 0 00007EEF 19 DB (.last - .) / 2 ; THIS IS THE SIZE OF THE TABLE YUK!!!! 0 00007EF0 [0000] .: DW DSK$INIT 0 00007EF2 [0000] DW MEDIA$CHK 0 00007EF4 [0000] DW GET$BPB 0 00007EF6 [4101] DW CMDERR ;RS 0 00007EF8 [0000] DW DSK$READ 0 00007EFA [3A01] DW BUS$EXIT 0 00007EFC [5D01] DW EXIT 0 00007EFE [5D01] DW EXIT 0 00007F00 [0000] DW DSK$WRIT 0 00007F02 [0000] DW DSK$WRITV 0 00007F04 [5D01] DW EXIT ;ARR 2.41 0 00007F06 [5D01] DW EXIT ;ARR 2.41 0 00007F08 [4101] DW CMDERR ;RS 136 <1> ; PUBLIC TABLE_PATCH 137 <1> ; TABLE_PATCH: equ $ ;ARR 2.42 0 00007F0A [0000] DW DSK$OPEN ;ARR 2.41 0 00007F0C [0000] DW DSK$CLOSE ;ARR 2.41 0 00007F0E [0000] DW DSK$REM ;ARR 2.41 0 00007F10 [5D01] DW EXIT 0 00007F12 [5D01] DW EXIT 0 00007F14 [5D01] DW EXIT 0 00007F16 [0000] DW GENERIC$IOCTL ; KGS 3.20 0 00007F18 [5D01] DW EXIT 0 00007F1A [5D01] DW EXIT 0 00007F1C [5D01] DW EXIT 0 00007F1E [0000] DW IOCTL$GETOWN ; RS 3.20 0 00007F20 [0000] DW IOCTL$SETOWN ; RE 3.20 150 <1> extern msbio_check_gen_ioctl 0 00007F22 [0000] .last: dw msbio_check_gen_ioctl 152 <1> 0 00007F24 ?? ODD 154 <1> CONTBL LABEL BYTE 0 00007F25 0A DB (.last - .) / 2 0 00007F26 [5D01] .: DW EXIT ;INIT 0 00007F28 [5D01] DW EXIT 0 00007F2A [5D01] DW EXIT 0 00007F2C [4101] DW CMDERR 0 00007F2E [0000] DW CON$READ 0 00007F30 [0000] DW CON$RDND 0 00007F32 [5D01] DW EXIT 0 00007F34 [0000] DW CON$FLSH 0 00007F36 [0000] DW CON$WRIT 0 00007F38 [0000] DW CON$WRIT 0 00007F3A [5D01] .last: DW EXIT ;ARR 2.41 167 <1> 168 <1> ; DW CMDERR ;J.K. 4/29/86 for CON$GENIOCTL support 169 <1> ; DW CMDERR ;J.K. 4/29/86 170 <1> ; DW CMDERR ;J.K. 4/29/86 171 <1> ; DW CMDERR ;J.K. 4/29/86 172 <1> ; DW CMDERR ;J.K. 4/29/86 173 <1> ; DW CMDERR ;J.K. 4/29/86 174 <1> ; DW CMDERR ;J.K. 4/29/86 175 <1> ; DW CMDERR ;J.K. 4/29/86 176 <1> ; DW CON$GENIOCTL ;J.K. 4/29/86 177 <1> 0 00007F3C ?? ODD 179 <1> AUXTBL LABEL BYTE 0 00007F3D 0A DB (.last - .) / 2 0 00007F3E [5D01] .: DW EXIT ;INIT 0 00007F40 [5D01] DW EXIT 0 00007F42 [5D01] DW EXIT 0 00007F44 [4101] DW CMDERR 0 00007F46 [0000] DW AUX$READ 0 00007F48 [0000] DW AUX$RDND 0 00007F4A [5D01] DW EXIT 0 00007F4C [0000] DW AUX$FLSH 0 00007F4E [0000] DW AUX$WRIT 0 00007F50 [0000] DW AUX$WRIT 0 00007F52 [0000] .last: DW AUX$WRST 192 <1> 0 00007F54 ?? ODD 194 <1> TIMTBL LABEL BYTE 0 00007F55 09 DB (.last - .) / 2 0 00007F56 [5D01] .: DW EXIT ;INIT 0 00007F58 [5D01] DW EXIT 0 00007F5A [5D01] DW EXIT 0 00007F5C [4101] DW CMDERR 0 00007F5E [0000] DW TIM$READ 0 00007F60 [3A01] DW BUS$EXIT 0 00007F62 [5D01] DW EXIT 0 00007F64 [5D01] DW EXIT 0 00007F66 [0000] DW TIM$WRIT 0 00007F68 [0000] .last: DW TIM$WRIT 206 <1> 0 00007F6A ?? ODD 208 <1> PRNTBL LABEL BYTE 0 00007F6B 19 DB (.last - .) / 2 0 00007F6C [5D01] .: DW EXIT ;INIT 0 00007F6E [5D01] DW EXIT 0 00007F70 [5D01] DW EXIT 0 00007F72 [4101] DW CMDERR 0 00007F74 [5101] DW EXIT$ZER ;INDICATE ZERO CHARS READ 0 00007F76 [3A01] DW BUS$EXIT 0 00007F78 [5D01] DW EXIT 0 00007F7A [5D01] DW EXIT 0 00007F7C [0000] DW PRN$WRIT 0 00007F7E [0000] DW PRN$WRIT 0 00007F80 [0000] DW PRN$STAT 0 00007F82 [5D01] DW EXIT 0 00007F84 [5D01] DW EXIT ;ARR 2.41 0 00007F86 [5D01] DW EXIT ;ARR 2.41 0 00007F88 [5D01] DW EXIT ;ARR 2.41 0 00007F8A [5D01] DW EXIT ;ARR 2.41 0 00007F8C [0000] DW PRN$TILBUSY 0 00007F8E [5D01] DW EXIT ;RS 3.20 0 00007F90 [5D01] DW EXIT ;RS 3.20 0 00007F92 [0000] DW PRN$GENIOCTL ;RS 3.20 0 00007F94 [5D01] DW EXIT ;RS 3.20 0 00007F96 [5D01] DW EXIT ;RS 3.20 0 00007F98 [5D01] DW EXIT ;RS 3.20 0 00007F9A [5D01] DW EXIT ;RS 3.20 0 00007F9C [5D01] DW EXIT ;RS 3.20 235 <1> extern prn_check_gen_ioctl 0 00007F9E [0000] .last: dw prn_check_gen_ioctl 237 <1> 238 <1> === Switch to base=000E10h -> "DOSBIODATA" 239 <1> usesection DOSBIODATA 240 <1> 241 <1> PUBLIC STEP_DRV 0 00001324 FE STEP_DRV DB -2 ; ARR 2.20 LAST DRIVE ACCESSED 243 <1> 244 <1> PUBLIC PHYS_DRV 0 00001325 00 PHYS_DRV DB 0 ; USED BY SETDRIVE FOR GETTING BDS FOR 246 <1> ; LOGICAL DRIVE, OR PHYSICAL DRIVE. 247 <1> PUBLIC FHAVE96 0 00001326 00 FHAVE96 DB 0 ; FLAG TO INDICATE PRESENCE OF 249 <1> ; 96TPI SUPPORT 250 <1> PUBLIC SINGLE 0 00001327 00 SINGLE DB 0 ; USED TO DETECT SINGLE DRIVE SYSTEMS 252 <1> 253 <1> PUBLIC FHAVEK09 0 00001328 00 FHAVEK09 DB 0 ;INDICATES IF THIS IS A K09 OR NOT 255 <1> ; USED BY CONSOLE DRIVER. 256 <1> PUBLIC NEW_ROM 0 00001329 00 NEW_ROM DB 0 ;SET TO 1 IF WE HAVE A ROM THAT CAN 258 <1> ; HANDLE STRANGE MEDIA LAYOUTS. 259 <1> PUBLIC FSETOWNER 0 0000132A ?? FSETOWNER DB ? ;=1 IF WE ARE SETTING THE OWNER OF A 261 <1> ;DRIVE. (EXAMINED BY CHECKSINGLE). 262 <1> 263 <1> === Switch to base=000000h -> "DOSENTRY" 264 <1> usesection DOSENTRY 265 <1> 266 <1> public Secrete_Code 0 000001FD 6B6A Secrete_Code dw 'kj' ;J.K. 11/7/86 Secrete code for DOS 3.30 IBMBIO. 268 <1> === Switch to base=000E10h -> "DOSBIODATA" 269 <1> usesection DOSBIODATA 270 <1> 271 <1> PUBLIC AUXBUF 0 0000132B 00000000 AUXBUF DB 0,0,0,0 ;SET OF 1 BYTE BUFFERS FOR COM 1,2,3, AND 4 273 <1> 0 0000132F 00 EVENB 275 <1> PUBLIC PREVOPER,NUMBER_OF_SEC 0 00001330 ???? PREVOPER DW ? ; HOLDS INT 13 REQUEST (I.E. REGISTER AX). 0 00001332 ?? NUMBER_OF_SEC DB ? ; HOLDS NUMBER OF SECTORS TO READ ON AN ECC ERROR 278 <1> 279 <1> === Switch to base=000000h -> "DOSENTRY" 280 <1> usesection DOSENTRY 281 <1> 282 <1> %imacro irtentry 1-2.nolist 283 <1> db %1 284 <1> %2 dd 0 285 <1> %endmacro 286 <1> 287 <1> 288 <1> %assign num BASE700h + 256-($-$$) 289 <1> %warning num bytes in front of IRT 289 ****************** <1> warning: 1 bytes in front of IRT [-w+user] 290 <1> 0 000001FF 00 _fill BASE700h + 256, 0, START$ ; fixed address: 60h:200h == 70h:100h 292 <1> InterruptRestorationTable: 293 <1> global InterruptRestorationTable 0 00000200 1000000000 irtentry 10h 0 00000205 1300000000 irtentry 13h, OLD13: 296 <1> PUBLIC OLD13 0 0000020A 1500000000 irtentry 15h 0 0000020F 1900000000 irtentry 19h, ORIG19: 299 <1> PUBLIC ORIG19 0 00000214 1B00000000 irtentry 1Bh 301 <1> ; Above interrupts are in the order MS-DOS 6.x saves them 302 <1> ; (FDEMM386?/Jemm expects Int19 within the first five entries) 0 00000219 0000000000 irtentry 00h 0 0000021E FF db -1 305 <1> 306 <1> === Switch to base=000000h -> "DOSENTRY" 307 <1> usesection DOSENTRY 308 <1> 309 <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16 310 <1> %error Header must be above or equal device base 311 <1> %endif 0 0000021F 00 EVENB 313 <1> PUBLIC PRNDEV2 314 <1> PRNDEV2 LABEL WORD ;HEADER FOR DEVICE "PRN" 0 00000220 [3201][0000] dw TIMDEV - DOSENTRYDEVICEBASE * 16, seg TIMDEV + DOSENTRYDEVICEBASE 0 00000224 40A0 DW CHARDEV + OUTTILBUSY + DEV320 0 00000226 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 00000228 [C100] DW prnentry - DOSENTRYDEVICEBASE * 16 0 0000022A 50524E2020202020 DB 'PRN ' 320 <1> 321 <1> EVENB 322 <1> PUBLIC TIMDEV 323 <1> TIMDEV LABEL WORD 0 00000232 [4401][0000] dw DSKDEV - DOSENTRYDEVICEBASE * 16, seg DSKDEV + DOSENTRYDEVICEBASE 0 00000236 0880 DW 10000000_00001000B 0 00000238 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 0000023A [EE00] DW clockentry - DOSENTRYDEVICEBASE * 16 0 0000023C 434C4F434B242020 DB 'CLOCK$ ' 329 <1> 330 <1> EVENB 331 <1> PUBLIC DSKDEV 332 <1> DSKDEV LABEL WORD 0 00000244 [5401][0000] dw COM1DEV - DOSENTRYDEVICEBASE * 16, seg COM1DEV + DOSENTRYDEVICEBASE 0 00000248 4208 DW 00001000_01000010B ;J.K.I1. 32 bit sector calculation 0 0000024A [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 0000024C [F300] DW blockentry - DOSENTRYDEVICEBASE * 16 0 0000024E 04 DRVMAX DB 4 338 <1> PUBLIC DRVMAX 339 <1> 340 <1> === Switch to base=00C400h -> "SYSINITTRAIL" 341 <1> usesection SYSINITTRAIL 342 <1> 343 <1> PUBLIC HARDNUM 0 00003830 63 HARDNUM DB 99 ;LOGICAL DRIVE NUMBER OF FIRST HARDFILE 345 <1> 346 <1> === Switch to base=000E10h -> "DOSBIODATA" 347 <1> usesection DOSBIODATA 348 <1> 0 00001333 00 EVENB 350 <1> PUBLIC WRTVERIFY 351 <1> WRTVERIFY LABEL WORD 352 <1> PUBLIC RFLAG 353 <1> ROMREAD equ ROMRead ; NASM port equate 0 00001334 02 RFLAG DB ROMREAD ;2 FOR READ, 3 FOR WRITE 0 00001335 00 VERIFY DB 0 ;1 IF VERIFY AFTER WRITE 356 <1> PUBLIC SECCNT 0 00001336 0000 SECCNT DW 0 358 <1> PUBLIC MOTORSTARTUP,SETTLECURRENT,SETTLESLOW 0 00001338 ?? MOTORSTARTUP DB ? ; VALUE FROM TABLE 0 00001339 ?? SETTLECURRENT DB ? ; VALUE FROM TABLE 0 0000133A ?? SETTLESLOW DB ? ; SLOW SETTLE VALUE 362 <1> 0 0000133B ?? NEXTSPEED DB ? ; VALUE OF SPEED TO BE USED 364 <1> save_head_sttl equ Save_head_sttl ; NASM port label 365 <1> public save_head_sttl 0 0000133C ?? Save_head_sttl db ? ;used by READ_SECTOR routine 367 <1> 368 <1> PUBLIC EOT 0 0000133D 09 EOT DB 9 370 <1> 371 <1> EVENB 372 <1> PUBLIC DPT 0 0000133E ???????? DPT DD ? 374 <1> 375 <1> ;KEEP THE NEXT TWO ITEMS CONTIGUOUS - SEE IOCTL_BLOCK FOR REASON 376 <1> PUBLIC CURSEC,CURHD,CURTRK,SPSAV 0 00001342 00 CURSEC DB 0 ;CURRENT SECTOR 0 00001343 00 CURHD DB 0 ;CURRENT HEAD 0 00001344 0000 CURTRK DW 0 ;CURRENT TRACK 0 00001346 0000 SPSAV DW 0 ;SAVE THE STACK POINTER 381 <1> 382 <1> ; THE FOLLOWING ARE USED FOR IOCTL FUNCTION CALLS 383 <1> PUBLIC FORMT_EOT,HDNUM,TRKNUM,GAP_PATCH 0 00001348 08 FORMT_EOT DB 8 ; EOT USED FOR FORMAT 0 00001349 00 HDNUM DB 0 ; HEAD NUMBER 0 0000134A 0000 TRKNUM DW 0 ; TRACK BEING MANIPULATED 0 0000134C 50 GAP_PATCH DB 50H ; FORMAT GAP PATCHED INTO DPT 388 <1> 389 <1> ;DISK ERRORS RETURNED FROM THE IBM ROM 390 <1> PUBLIC ERRIN 391 <1> ERRIN LABEL BYTE 0 0000134D CC db 0cch ;AN002; Write Fault error 0 0000134E 80 DB 80H ;NO RESPONSE 0 0000134F 40 DB 40H ;SEEK FAILURE 0 00001350 10 DB 10H ;BAD CRC 0 00001351 08 DB 8 ;DMA OVERRUN 0 00001352 06 DB 6 ; MEDIA CHANGE 0 00001353 04 DB 4 ;SECTOR NOT FOUND 0 00001354 03 DB 3 ;WRITE ATTEMPT TO WRITE-PROTECT DISK 400 <1> PUBLIC LSTERR 0 00001355 00 LSTERR DB 0 ;ALL OTHER ERRORS 402 <1> 403 <1> ;RETURNED ERROR CODES CORRESPONDING TO ABOVE 404 <1> PUBLIC ERROUT 405 <1> ERROUT LABEL BYTE 0 00001356 0A db 10 ;AN002; Write Fault error 0 00001357 02 DB 2 ;NO RESPONSE 0 00001358 06 DB 6 ;SEEK FAILURE 0 00001359 04 DB 4 ;BAD CRC 0 0000135A 04 DB 4 ;DMA OVERRUN 0 0000135B 0F DB 15 ; INVALID MEDIA CHANGE 0 0000135C 08 DB 8 ;SECTOR NOT FOUND 0 0000135D 00 DB 0 ;WRITE ATTEMPT ON WRITE-PROTECT DISK 0 0000135E 0C DB 12 ;GENERAL ERROR 415 <1> PUBLIC NUMERR 416 <1> NUMERR equ ERROUT-ERRIN 417 <1> 418 <1> 419 <1> ;********************************************************************* 420 <1> ; "BDS" CONTAINS INFORMATION FOR EACH DRIVE IN THE SYSTEM. 421 <1> ; VARIOUS VALUES ARE PATCHED WHENEVER ACTIONS ARE PERFORMED. 422 <1> ; SECTORS/ALLOC. UNIT IN BPB INITIALLY SET TO -1 TO SIGNIFY THAT 423 <1> ; THE BPB HAS NOT BEEN FILLED. LINK ALSO SET TO -1 TO SIGNIFY END 424 <1> ; OF LIST. # OF CYLINDERS IN MAXPARMS INITIALIZED TO -1 TO INDICATE 425 <1> ; THAT THE PARAMETERS HAVE NOT BEEN SET. 426 <1> ; 427 <1> 428 <1> BPBTYPE STRUC 0 00001324 ?? SPF DB ? 0 00001325 ?? SPT DB ? 0 00001326 ?? CDIRE DB ? 0 00001327 ???? CSEC DW ? 0 00001329 ?? SPA DB ? 0 0000132A ?? CHEAD DB ? 435 <1> BPBTYPE ENDS 436 <1> PUBLIC SM92 437 <1> SM92: 438 <1> BPBTYPE_size equ BPBTYPE_struc_size ; NASM port equate 439 <1> istruc BPBTYPE 440 <1> at SPF 0 0000135F 03 db 3 442 <1> at SPT 0 00001360 09 db 9 444 <1> at CDIRE 0 00001361 70 db 70H 446 <1> at CSEC 0 00001362 A005 dw 2*9*80 448 <1> at SPA 0 00001364 02 db 2 450 <1> at CHEAD 0 00001365 02 db 2 452 <1> iend 453 <1> 454 <1> === Switch to base=000000h -> "DOSENTRY" 455 <1> usesection DOSENTRY 456 <1> 457 <1> transfer_orig13: 458 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000024F 2EFF2E[B401] jmp far [cs:ORIG13] ; cs reference in DOSENTRY 460 <1> 461 <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16 462 <1> %error Header must be above or equal device base 463 <1> %endif 464 <1> EVENB 465 <1> PUBLIC COM1DEV 466 <1> COM1DEV LABEL WORD 0 00000254 [6E01][0000] dw LPT1DEV - DOSENTRYDEVICEBASE * 16, seg LPT1DEV + DOSENTRYDEVICEBASE 0 00000258 0080 DW 10000000_00000000B 0 0000025A [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 0000025C [CB00] DW com1entry - DOSENTRYDEVICEBASE * 16 0 0000025E 434F4D3120202020 DB 'COM1 ' 472 <1> 0 00000266 ?? odd 474 <1> global transfer_real13 475 <1> transfer_real13: 476 <1> assume ds:nothing, es:nothing, ss:nothing 0 00000267 EA db 0EAh 478 <1> PUBLIC REAL13 0 00000268 ???????? REAL13 DD ? 480 <1> 481 <1> %assign num BASE700h + 16Ch - ($-$$) 482 <1> %warning num bytes in front of AUXNUM 482 ****************** <1> warning: 0 bytes in front of AUXNUM [-w+user] 483 <1> org BASE700h + 16Ch ; noted in EDR-DOS sources as a fixed offset 484 <1> EVENB 485 <1> ; WARNING!!! THESE ARE ADDRESSED TOGETHER IN GETDX 0 0000026C 00 AUXNUM DB 0 ;WHICH AUX DEVICE WAS REQUESTED 0 0000026D 00 DB 0 488 <1> 489 <1> === Switch to base=000E10h -> "DOSBIODATA" 490 <1> usesection DOSBIODATA 491 <1> 492 <1> EVENB 493 <1> PUBLIC DAYCNT 0 00001366 0000 DAYCNT DW 0 495 <1> 496 <1> === Switch to base=000000h -> "DOSENTRY" 497 <1> usesection DOSENTRY 498 <1> 499 <1> %if ($ - $$) < DOSENTRYDEVICEBASE * 16 500 <1> %error Header must be above or equal device base 501 <1> %endif 502 <1> EVENB 503 <1> PUBLIC LPT1DEV 504 <1> LPT1DEV LABEL WORD 0 0000026E [8001][0000] dw LPT2DEV - DOSENTRYDEVICEBASE * 16, seg LPT2DEV + DOSENTRYDEVICEBASE 0 00000272 40A0 DW CHARDEV + OUTTILBUSY + DEV320 0 00000274 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 00000276 [DF00] DW lpt1entry - DOSENTRYDEVICEBASE * 16 0 00000278 4C50543120202020 DB 'LPT1 ' 510 <1> 511 <1> EVENB 512 <1> PUBLIC LPT2DEV 513 <1> LPT2DEV LABEL WORD 0 00000280 [9201][0000] dw LPT3DEV - DOSENTRYDEVICEBASE * 16, seg LPT3DEV + DOSENTRYDEVICEBASE 0 00000284 40A0 DW CHARDEV + OUTTILBUSY + DEV320 0 00000286 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 00000288 [E400] DW lpt2entry - DOSENTRYDEVICEBASE * 16 0 0000028A 4C50543220202020 DB 'LPT2 ' 519 <1> 520 <1> EVENB 521 <1> PUBLIC LPT3DEV 522 <1> LPT3DEV LABEL WORD 0 00000292 [A401][0000] dw COM2DEV - DOSENTRYDEVICEBASE * 16, seg COM2DEV + DOSENTRYDEVICEBASE 0 00000296 40A0 DW CHARDEV + OUTTILBUSY + DEV320 0 00000298 [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 0000029A [E900] DW lpt3entry - DOSENTRYDEVICEBASE * 16 0 0000029C 4C50543320202020 DB 'LPT3 ' 528 <1> 529 <1> 530 <1> EVENB 531 <1> PUBLIC COM2DEV 532 <1> COM2DEV LABEL WORD 0 000002A4 [B601][0000] dw COM3DEV - DOSENTRYDEVICEBASE * 16, seg COM3DEV + DOSENTRYDEVICEBASE 0 000002A8 0080 DW 10000000_00000000B 0 000002AA [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 000002AC [D000] DW com2entry - DOSENTRYDEVICEBASE * 16 0 000002AE 434F4D3220202020 DB 'COM2 ' 538 <1> 539 <1> EVENB 540 <1> PUBLIC COM3DEV 541 <1> COM3DEV LABEL WORD ;EDK 0 000002B6 [C801][0000] dw COM4DEV - DOSENTRYDEVICEBASE * 16, seg COM4DEV + DOSENTRYDEVICEBASE 0 000002BA 0080 DW 10000000_00000000B 0 000002BC [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 000002BE [D500] DW com3entry - DOSENTRYDEVICEBASE * 16 0 000002C0 434F4D3320202020 DB 'COM3 ' 547 <1> 548 <1> EVENB 549 <1> PUBLIC COM4DEV 550 <1> COM4DEV LABEL WORD ;EDK 0 000002C8 FFFF[0000] DW -1,DOSENTRY + DOSENTRYDEVICEBASE 0 000002CC 0080 DW 10000000_00000000B 0 000002CE [F800] DW strategyentry - DOSENTRYDEVICEBASE * 16 0 000002D0 [DA00] DW com4entry - DOSENTRYDEVICEBASE * 16 0 000002D2 434F4D3420202020 DB 'COM4 ' 556 <1> 557 <1> === Switch to base=000E10h -> "DOSBIODATA" 558 <1> usesection DOSBIODATA 559 <1> 560 <1> EVENB 561 <1> PUBLIC START_BDS 562 <1> START_BDS LABEL WORD 0 00001368 FFFFFFFF dw -1,-1 ; START OF BDS LINKED LIST. 564 <1> 565 <1> PUBLIC ACCESSCOUNT 0 0000136C 00 ACCESSCOUNT DB 0 ; NUMBER OF TIMES MEDIA CHECK CALLED 567 <1> PUBLIC TIM_DRV 0 0000136D FF TIM_DRV DB -1 ; TIME WHEN LAST DISK I/O PERFORMED 569 <1> PUBLIC MEDBYT 0 0000136E ?? MEDBYT DB ? 571 <1> 572 <1> ; end of data that must be after 16Ch. 573 <1> 574 <1> ;------------------------------------------------------------- 575 <1> 576 <1> === Switch to base=000000h -> "DOSENTRY" 577 <1> usesection DOSENTRY 578 <1> 579 <1> global i2D, i2D.amisnumber, amis_intlist 580 <1> ; used with DOSENTRY adjust 0 000002DA EB10[0E04][0000]4B iispentry i2D, 0, i2D, 1, entry_iret + DOSENTRYADJUSTOFFSET, DOSENTRY - DOSENTRYADJUSTSEGMENT 581 000002E1 4200EB1400 <1> 0 000002EC 80FC00 cmp ah, 0 584 <1> .amisnumber: equ $ - 1 ; imm8 data of cmp instruction 0 000002EF 7405 je .ours 0 000002F1 2EFF2E[7C06] jmp far [cs:.next + DOSENTRYADJUSTOFFSET] 587 <1> .ours: 0 000002F6 E827FECB60 relocate relocatedi2D 589 <1> .hwreset equ $ - 2 ; ! use the trampoline retf for hwreset 590 <1> 591 <1> amis_intlist: 0 000002FB 2D db 2Dh 0 000002FC [7A06] dw i2D + DOSENTRYADJUSTOFFSET 594 <1> 595 <1> 596 <1> PUBLIC incompatible_ALTAH 0 000002FE 00 incompatible_ALTAH DB 0 ;SPECIAL KEY HANDLING 598 <1> 599 <1> 600 <1> ; READ IN BOOT SECTOR HERE, READ DONE IN READBOOT. 601 <1> ; ALSO READ SECTOR FOR DMA CHECK FOR HARD DISK. 602 <1> 603 <1> ;J.K. The buffer for a disk sector is going to be at a double word boundary 604 <1> ; for 80386 machine. 605 <1> 0 000002FF 00 align 16, db 0 ; ! paragraph alignment needed for msinit.nas 607 <1> DISKSECTOR equ DiskSector ; NASM port label 608 <1> PUBLIC DISKSECTOR 609 00000300 <1> DiskSector DB 11 DUP(?) ; TAKE CARE OF 3 JUMP BYTES PLUS OEM NAME. 610 <1> BPB_IN_SECTOR equ Bpb_In_Sector ; NASM port label 611 <1> PUBLIC BPB_IN_SECTOR 0 0000030B ???? Bpb_In_Sector DW ? 613 <1> SECPERCLUSINSECTOR equ SecPerClusInSector ; NASM port label 614 <1> PUBLIC SECPERCLUSINSECTOR 0 0000030D ?? SecPerClusInSector DB ? 0 0000030E ???? DW ? 617 <1> public NumberOfFats 0 00000310 ?? NumberOfFats DB ? 0 00000311 ???? DW ? 0 00000313 ???? DW ? 621 <1> MEDIABYTE equ MediaByte ; NASM port label 622 <1> PUBLIC MEDIABYTE 0 00000315 ?? MediaByte DB ? 0 00000316 ???? DW ? 0 00000318 ???? DW ? 0 0000031A ???? DW ? 0 0000031C ???? DW ? 0 0000031E ???? DW ? ;AN000; Extended Hidden sector (high) 0 00000320 ???? DW ? ;AN000; Extended Total sector (low) 0 00000322 ???? DW ? ;AN000; Extended Total sector (high) 0 00000324 ?? db ? ;AN003; PHYDRV in boot record. 0 00000325 ?? db ? ;AN003; CURRENT HEAD in boot record. 633 <1> public Ext_Boot_Sig 0 00000326 ?? Ext_Boot_Sig DB ? ;AN000; Extended Boot record sig. (=90h) 635 <1> public Boot_Serial_L 0 00000327 ???? Boot_Serial_L DW ? ;AN000; Boot volume serial number (Low) 637 <1> public Boot_Serial_H 0 00000329 ???? Boot_Serial_H DW ? ;AN000; Boot volume serial number (High) 639 <1> public Boot_Volume_Label 0 0000032B 202020202020202020 Boot_Volume_Label DB 11 dup (' ') ;AN000; Volume label 0 00000334 2020 641 <1> public Boot_System_ID 0 00000336 2020202020202020 Boot_System_ID DB 8 dup (' ') ;AN000; File system Id. 0 0000033E 00 times 512-($-DiskSector) db 0 644 <1> 645 <1> === Switch to base=000E10h -> "DOSBIODATA" 646 <1> usesection DOSBIODATA 647 <1> 648 <1> ;;Rev 3.30 Modification ------------------------------------------------ 649 <1> ; variables for real time clock setting 650 <1> public HaveCMOSClock 0 0000136F 00 HaveCMOSClock db 0 ;set by MSINIT. 652 <1> public base_century 0 00001370 13 base_century db 19 654 <1> public base_year 0 00001371 50 base_year db 80 656 <1> public month_tab 0 00001372 1F1C1F1E1F1E1F1F1E month_tab db 31,28,31,30,31,30,31,31,30,31,30,31 0 0000137B 1F1E1F 658 <1> 659 <1> ;;End of Modification ------------------------------------------------ 660 <1> 661 <1> === Switch to base=000E10h -> "DOSBIODATA" 662 <1> usesection DOSBIODATA 663 <1> 0 0000137E 00 Set_ID_Flag db 0 ;AN000; If 1, GETBP routine will set the 665 <1> ;Vol_Serial and FileSys_ID in BDS table 666 <1> ;from the media Boot record, if it is > DOS 4.00 667 <1> ;formatted one. Then Set_ID_flag will be set to 2 668 <1> ;to signal that volume_label is set from the extended 669 <1> ;boot record and do not set it from the root 670 <1> ;directory as done in SET_VOLUME_ID routine. 671 <1> ;For the old version, Vol_Serial 672 <1> ;will be set to -1, and FileSys_ID will be set 673 <1> ;to "FAT12 " if it is a floppy. 674 <1> 0 0000137F 00 evenb 676 <1> public lbapacket 677 <1> lbapacket: 678 <1> LBAPACKETSTRUC_size equ LBAPACKETSTRUC_struc_size ; NASM port equate 679 <1> istruc LBAPACKETSTRUC 680 <1> at lpSize 0 00001380 1000 dw 16 0 00001382 00 iend 683 <1> 684 <1> public Temp_H 0 00001390 0000 Temp_H dw 0 ;AN000; Temporary for 32 bit calculation. 686 <1> 687 <1> public Start_Sec_H 0 00001392 0000 Start_Sec_H dw 0 ;AN000; Starting sector number high word. 689 <1> ;Used as an input to DISKIO subroutine. 0 00001394 0000 Saved_Word dw 0 ;AN000; Tempory saving place for a word. 691 <1> 692 <1> ;--------------------------------------- 693 <1> ;J.K. 6/29/87 For Multi-track 694 <1> public MulTrk_Flag 0 00001396 0000 MulTrk_Flag dw 0 ;AN001; 696 <1> ;J.K. 6/29/87 End of Multi-track definition. 697 <1> ;--------------------------------------------------------------------- 698 <1> public EC35_Flag 0 00001398 00 EC35_Flag db 0 ; flags for electrically compatible 3.5 inch disk drives (mrw 4/88) 700 <1> ;--------------------------------------------------------------------- 0 00001399 00 evenb 0 0000139A 0000 VRetry_Cnt dw 0 ;AN003; 0 0000139C 0000 Soft_ECC_Cnt dw 0 ;AN003; 704 <1> 705 <1> ;--------------------------------------------------------------------- 0 0000139E 00 MultiTrk_Format_Flag db 0 ;AN007;Testing. If 1, then Multi track format request 707 <1> ;--------------------------------------------------------------------- 708 <1> ; 709 <1> ; IF ID IS F9, HAVE A 96TPI DISK ELSE 710 <1> ; IF BIT 2 IS 0 THEN MEDIA IS NOT REMOVABLE AND COULD NOT HAVE CHANGED 711 <1> ; OTHERWISE IF WITHIN 2 SECS OF LAST DISK OPERATION MEDIA COULD NOT 712 <1> ; HAVE CHANGED, OTHERWISE DONT KNOW IF MEDIA HAS CHANGED 713 <1> ; 714 <1> 715 <1> === Switch to base=000E10h -> "DOSBIODATA" 716 <1> usesection DOSBIODATA 717 <1> 0 0000139F 00 align 2, db 0 0 000013A0 ???? Prev_DX DW ? 720 <1> 721 <1> 722 <1> global Set_ID_Flag, Saved_Word 723 <1> global VRetry_Cnt, Soft_ECC_Cnt, MultiTrk_Format_Flag 724 <1> global Prev_DX, dosbiodata_temp_ds 725 <1> global transfer_orig13 726 <1> global transfer_next2F_13 727 <1> 728 <1> === Switch to base=000E10h -> "DOSBIODATA" 729 <1> usesection DOSBIODATA 730 <1> 731 <1> PATHSTART 005,DISK 110 <2> %IF PATHGEN 111 <2> PUBLIC %2%1S,%2%1E 112 <2> %2%1S LABEL BYTE 113 <2> %ENDIF 732 <1> EVENB 733 <1> Model_Byte equ MODEL_BYTE ; NASM port label 734 <1> public Model_Byte 0 000013A2 FF MODEL_BYTE DB 0FFH ; MODEL BYTE. SET UP AT INIT TIME. 736 <1> ; FF - PC1 737 <1> ; FE - XT (64/256K PLANAR) 738 <1> ; FD - PC-JR 739 <1> ; FC - PC/AT 740 <1> public Secondary_Model_Byte 0 000013A3 00 Secondary_Model_Byte db 0 742 <1> 743 <1> PUBLIC INT19SEM 0 000013A4 00 INT19SEM DB 0 ; INDICATE THAT ALL INT 19 745 <1> ; INITIALIZATION IS COMPLETE 746 <1> 747 <1> 748 <1> %macro int19old 1-* 749 <1> %rep %0 750 <1> public Int19OLD%1 751 <1> Int19OLD%1 dd -1 ;Orignal hardware int. vectors for INT 19h. 752 <1> %rotate 1 753 <1> %endrep 754 <1> %endmacro 755 <1> 0 000013A5 00 align 2, db 0 757 <1> int19old 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77 749 <2> %rep %0 750 <2> public Int19OLD%1 751 <2> Int19OLD%1 dd -1 752 <2> %rotate 1 753 <2> %endrep 750 <3> public Int19OLD%1 0 000013A6 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013AA FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013AE FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013B2 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013B6 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013BA FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013BE FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013C2 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013C6 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013CA FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013CE FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013D2 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013D6 FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 750 <3> public Int19OLD%1 0 000013DA FFFFFFFF Int19OLD%1 dd -1 752 <3> %rotate 1 758 <1> 759 <1> 760 <1> PATHEND 005,DISK 117 <2> %IF PATHGEN 118 <2> %2%1E LABEL BYTE 119 <2> %ENDIF 761 <1> ; = = = = = = = = = = = = = = = = = = = = 762 <1> 763 <1> global SNGMSG 764 <1> global DRVLET 765 <1> 766 <1> ; INCLUDE BIOMES.INC 767 <1> ;=== Push trace listing source: msbio.cl2 768 <1> %include "msbio.cl2" ; NASM included file 1 <2> ; msbio.cl2 2 <2> 3 <2> 4 <2> ;_______________________ 5 <2> 0 000013DE 0D0A496E7365727420 SNGMSG DB 13,10,"Insert diskette for drive " 0 000013E7 6469736B6574746520 0 000013F0 666F72206472697665 0 000013F9 20 7 <2> 8 <2> ;_______________________ 9 <2> 0 000013FA 413A20616E64207072 DRVLET DB "A: and press any key when ready",13,10,10,0 0 00001403 65737320616E79206B 0 0000140C 6579207768656E2072 0 00001415 656164790D0A0A00 769 <1> ;=== Pop trace listing source 770 <1> 771 <1> === Switch to base=000000h -> "DOSENTRY" 772 <1> usesection DOSENTRY 773 <1> 774 <1> ;----------------------------------------------- 775 <1> ; 776 <1> ; C O N - CONSOLE DEVICE DRIVER 777 <1> ; 778 <1> 779 <1> %if 0 780 <1> %assign num BASE700h + 61Bh - ($-$$) 781 <1> %warning num bytes in front of ALTAH 782 <1> 783 <1> org BASE700h + 61Bh ; noted in EDR-DOS sources as a fixed offset 784 <1> %endif 785 <1> === Switch to base=000E10h -> "DOSBIODATA" 786 <1> usesection DOSBIODATA 787 <1> 0 0000141D 00 align 2, db 0 789 <1> global altah_indirect 0 0000141E [FE02] altah_indirect: dw incompatible_ALTAH 791 <1> 792 <1> public KEYRD_Func 0 00001420 00 KEYRD_Func DB 0 ;AN000; Default is conventional keyboard read 794 <1> public KEYSTS_Func 0 00001421 01 KEYSTS_Func DB 1 ;AN000; Defualt if conventional keyboard status check. 796 <1> 797 <1> %if KEYRD_Func + 1 != KEYSTS_Func 798 <1> %error msinit.nas assumes KEYSTS_Func directly after KEYRD_Func 799 <1> %endif 800 <1> 801 <1> ; PUBLIC SAV_SC_INFO ;J.K. 4/29/86 FOR CON$GENIOCTL 802 <1> ; PUBLIC SAV_SC_MODE 803 <1> ; PUBLIC SAV_SC_COLORS 804 <1> ; PUBLIC SAV_SC_WIDTH 805 <1> ; PUBLIC SAV_SC_LENGTH 806 <1> ;SAV_SC_INFO LABEL BYTE 807 <1> ;SAV_SC_MODE DB 0 808 <1> ;SAV_SC_COLORS DW 0 809 <1> ;SAV_SC_WIDTH DW 0 810 <1> ;SAV_SC_LENGTH DW 0 ;J.K. 4/29/86 FOR CON$GENIOCTL 811 <1> 812 <1> ;------------------------------------------------------------- 813 <1> ; 814 <1> ; P R N - PRINTER DEVICE 815 <1> ; 816 <1> PUBLIC PRINTDEV 0 00001422 00 PRINTDEV DB 0 ; INDEX INTO ABOVE ARRAY 818 <1> 819 <1> ; THE FOLLOWING VARIABLE CAN BE MODIFIED VIA IOCTL SUB-FUNCTION 16. IN THIS 820 <1> ; WAY, THE WAIT CAN BE SET TO SUIT THE SPEED OF THE PARTICULAR PRINTER BEING 821 <1> ; USED. ONE FOR EACH PRINTER DEVICE. 822 <1> 0 00001423 00 EVENB 824 <1> PUBLIC WAIT_COUNT 0 00001424 5000500050005000 WAIT_COUNT DW 4 DUP (50H) ; ARRAY OF RETRY COUNTS FOR PRINTER 826 <1> 0 0000142C 0000 dosbiodata_temp_ds: dw 0 828 <1> 829 <1> === Switch to base=000E10h -> "DOSBIODATA" 830 <1> usesection DOSBIODATA 831 <1> 832 <1> EVENB 833 <1> global dskdrvs_indirect 834 <1> dskdrvs_indirect: 0 0000142E 00000000 dd 0 836 <1> 837 <1> 838 <1> %IF itest ;Testing Mode for IBMBIO. 839 <1> PUBLIC NUMBUF 840 <1> NUMBUF DB 5 DUP (?) 841 <1> PUBLIC DIGITS 842 <1> DIGITS DB "0123456789ABCDEF" 843 <1> PUBLIC FTESTBITS 844 <1> ;FTESTBITS DW FTESTDISK+FTESTINIT 845 <1> fTestDISK equ FTESTDISK ; NASM port equate 846 <1> FTESTBITS DW fTestDISK 847 <1> ;ftestbits dw ftestclock 848 <1> %ENDIF 849 <1> 850 <1> 851 <1> %include "code.asm" 1 <2> 2 <2> %if 0 3 <2> 4 <2> lDOS DOSCODE entrypoint handling 5 <2> by E. C. Masloch, 2018--2025 6 <2> 7 <2> Usage of the works is permitted provided that this 8 <2> instrument is retained with the works, so that any entity 9 <2> that uses the works is notified of this instrument. 10 <2> 11 <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <2> 13 <2> %endif 14 <2> === Switch to base=002450h -> "DOSCODETABLE" 15 <2> usesection DOSCODETABLE 16 <2> global doscode_start 17 <2> doscode_start: ; must be start of segment 18 <2> 0 00000000 26 times DOSCODE_HMA_OFFSET - 16 db 38 ; prefix that is unused, 20 <2> ; and not relocated 21 <2> extern afterdoscodelabel 22 <2> global doscode_mcb 23 <2> doscode_mcb: 24 <2> istruc MCB 0 00000040 4D at mcbSignature,db 'M' 0 00000041 0800 at mcbOwner, dw 8 0 00000043 [B0FF] at mcbSize, dw afterdoscodelabel - DOSCODE_HMA_OFFSET wrt DOSCODEGROUP 0 00000045 0053 at mcbName, db "S" 0 00000049 0002 at smcbType, db S_DOSCODE 0 0000004B 00 iend 31 <2> 32 <2> ; (lMS-DOS: Comment not applicable) 33 <2> ; The following table and function is used by devicerelocate 34 <2> ; even if DOSCODE is merged into DOSENTRY (!_RELOCATEDOSCODE). 35 <2> 0 00000050 [0000][0000][0000] write_entrypoint_list ENTRYPOINT_LIST 0 00000056 [0000][0000][0000] 0 0000005C [0000][7301][0000] 0 00000062 [0000][0000][0000] 0 00000068 [0000][0000][0000] 0 0000006E [0000][8801][BB00] 0 00000074 [3700][B200][7D00] 0 0000007A 0000[BB00][4F00]00 0 00000081 90[BB00][4F00]0190 0 00000088 [BB00][4F00]0290 0 0000008E [BB00][4F00]0390 0 00000094 [B200][7D00]0001 0 0000009A [B200][7D00]0102 0 000000A0 [B200][7D00]0203 0 000000A6 [BB00][6700][BB00] 0 000000AC [0100][D000][0000] 37 <2> 38 <2> relocated devprnentry 39 <2> assume ds:nothing 0 000000B2 1E push ds 0 000000B3 E8[B200] call biocode_get_ds_dosbiodata 42 <2> assume ds:DOSGROUP 43 <2> extern PRINTDEV 0 000000B6 8826[FE00] MOV [PRINTDEV],AH ;SAVE INDEX INTO ARRAY OF RETRY COUNTS 0 000000BA 1F pop ds 46 <2> assume ds:nothing 47 <2> 48 <2> relocated deventry 49 <2> assume ds:nothing 0 000000BB E9[E300] jmp common_dev_entrypoint 51 <2> 52 <2> ; ! all dev entries must be before this point, 53 <2> ; and there must be no non-dev entries. 54 <2> ; This is required by the dev entry check in 55 <2> ; relocated_relocatedentry in this file. 56 <2> 57 <2> %if _RELOCATEDOSCODE && _DOSCODEHMA 0 000000BE 90 _fill 0C0h + DOSCODE_HMA_start_at, 90h, doscode_start 59 <2> hma_call5: 60 <2> assume ds:nothing, es:nothing, ss:nothing 0 000000E0 EA[4500][0000] jmp DOSENTRY:call5 62 <2> %endif 63 <2> 64 <2> 65 <2> numdef DOSCODE_ENTRY_TRAMPOLINE, 1 66 <2> 67 <2> ; INP: byte [cs:ip] = displacement in doscode_entrypoint_list 68 <2> ; word [DOSCODE:(displaced)] 69 <2> ; = relocated entry address 70 <2> ; word [DOSCODE:(displaced + 2)] 71 <2> ; = optional pointer to device function table 72 <2> ; byte [DOSCODE:(displaced + 4)] 73 <2> ; = optional device unit 74 <2> ; ss:(sp + 6) -> arbitrary stack of entrypoint 75 <2> ; word [ss:sp + 4] = entrypoint's ip, 76 <2> ; word [ss:sp + 2] = entrypoint's cs, 77 <2> ; word [ss:sp + 0] = original ax value 78 <2> ; ax = original bp value 79 <2> ; OUT: For non-device entrypoint, 80 <2> ; ss:sp -> arbitrary stack 81 <2> ; For device entrypoint, 82 <2> ; ss:sp -> ax, si, arbitrary stack 83 <2> ; al = unit if any 84 <2> ; si -> device table 85 <2> relocated_relocatedentry: 86 <2> assume ds:nothing, es:nothing, ss:nothing 87 <2> %if _DOSCODE_ENTRY_TRAMPOLINE 0 000000E5 E80100 call .handle 0 000000E8 C3 retn 90 <2> 91 <2> .handle: 92 <2> %endif 0 000000E9 95 xchg ax, bp ; restore bp, clobber ax 0 000000EA 9C pushf 95 <2> lframe 0 96 <2> lpar word, entrypoint_ip 97 <2> lpar word, entrypoint_cs 98 <2> lpar word, orig_ax 99 <2> %if _DOSCODE_ENTRY_TRAMPOLINE 100 <2> lpar word, trampoline_ip 101 <2> %endif 102 <2> lpar word, orig_fl 0 000000EB 5589E5 lenter 104 <2> lequ ?entrypoint_ip, out_nondev_ip 105 <2> lequ ?entrypoint_ip, out_dev_si 106 <2> lequ ?entrypoint_cs, out_dev_ax 107 <2> lequ ?orig_ax, out_dev_ip 108 <2> lequ ?orig_ax, out_nontrampoline_ip 0 000000EE 1E push ds 0 000000EF 56 push si 0 000000F0 FF7606 push word [bp + ?orig_ax] 112 <2> 0 000000F3 B400 mov ah, 0 0 000000F5 8E5E08 mov ds, word [bp + ?entrypoint_cs] 115 <2> assume ds:nothing 0 000000F8 8B760A mov si, word [bp + ?entrypoint_ip] 117 <2> %if 0 118 <2> cld 119 <2> inc si 120 <2> lodsb 121 <2> cmp al, 0CCh ; overwritten by debugger ? 122 <2> jne @F ; no --> 123 <2> int3 ; break to make it remove the breakpoint 124 <2> dec si 125 <2> lodsb ; reload the byte 126 <2> cmp al, 0CCh 127 <2> je .error 128 <2> %else 0 000000FB 8A4401 mov al, [si + 1] 130 <2> %endif 131 <2> 132 <2> @@: 0 000000FE 0E push cs 0 000000FF 1F pop ds 135 <2> assume ds:DOSCODEGROUP 136 <2> 0 00000100 05[5000] add ax, doscode_entrypoint_list 0 00000103 3D[B200] cmp ax, doscode_entrypoint_list.end 0 00000106 7325 jae .error 0 00000108 8F4608 pop word [bp + ?out_dev_ax] 0 0000010B 8F460A pop word [bp + ?out_dev_si] 0 0000010E 96 xchg ax, si 143 <2> 0 0000010F AD lodsw ; get relocated entry address 0 00000110 3D[BB00] cmp ax, relocateddeventry 0 00000113 760D jbe .dev ; ! depends on deventry and devprnentry early 147 <2> .nondev: 148 <2> %if _DOSCODE_ENTRY_TRAMPOLINE 0 00000115 8B7608 mov si, word [bp + ?out_dev_ax] 0 00000118 96 xchg si, ax ; ax from ?out_dev_ax, si -> destination 0 00000119 87760A xchg si, word [bp + ?out_nondev_ip] 152 <2> ; ?out_nondev_ip -> ip, si = original si 153 <2> %else 154 <2> mov si, word [bp + ?out_nondev_ip] 155 <2> xchg ax, word [bp + ?out_nontrampoline_ip] 156 <2> %endif 0 0000011C 1F pop ds 158 <2> assume ds:nothing 0 0000011D 5D lleave code 0 0000011E 9D popf 0 0000011F C20400 retn 4 162 <2> 163 <2> .dev: 164 <2> %if _DOSCODE_ENTRY_TRAMPOLINE 0 00000122 894606 mov word [bp + ?out_dev_ip], ax 166 <2> %else 167 <2> mov word [bp + ?out_nontrampoline_ip], ax 168 <2> %endif 0 00000125 AD lodsw 0 00000126 50 push ax ; -> table 0 00000127 AD lodsw ; ax = unit things if any 0 00000128 5E pop si ; si -> table 0 00000129 1F pop ds 174 <2> assume ds:nothing 0 0000012A 5D lleave code 0 0000012B 9D popf 0 0000012C C3 retn 178 <2> 179 <2> lleave ctx 180 <2> 181 <2> .error: 0 0000012D FC cld 0 0000012E BE[C001] mov si, doscode_msg.error_common ; access with cs 0 00000131 E81300 call doscode_disp_msg_cs 0 00000134 BE[D001] mov si, doscode_msg.error_table ; access with cs 186 <2> ..@halt: 0 00000137 E80D00 call doscode_disp_msg_cs 0 0000013A BE[6A02] mov si, doscode_msg.error_after ; access with cs 0 0000013D E80700 call doscode_disp_msg_cs 190 <2> .loop: 0 00000140 CC int3 0 00000141 31C0 xor ax, ax 0 00000143 CD16 int 16h 0 00000145 EBF9 jmp .loop 195 <2> 196 <2> 197 <2> doscode_disp_msg_cs: 198 <2> assume ds:nothing, es:nothing, ss:nothing 0 00000147 50 push ax 200 <2> @@: 0 00000148 2EAC cs lodsb 0 0000014A 84C0 test al, al 0 0000014C 7411 jz @F 0 0000014E E80200 call doscode_disp_al 0 00000151 EBF5 jmp short @B 206 <2> 207 <2> 208 <2> doscode_disp_al: 209 <2> assume ds:nothing, es:nothing, ss:nothing 0 00000153 50 push ax 0 00000154 53 push bx 0 00000155 55 push bp 0 00000156 B40E mov ah, 0Eh 0 00000158 BB0700 mov bx, 7 0 0000015B CD10 int 10h 0 0000015D 5D pop bp 0 0000015E 5B pop bx 218 <2> @@: 0 0000015F 58 pop ax 0 00000160 C3 retn 221 <2> 222 <2> 223 <2> doscode_disp_dxax_hex: ; dx:ax 224 <2> assume ds:nothing, es:nothing, ss:nothing 0 00000161 92 xchg ax, dx 0 00000162 E80100 call doscode_disp_ax_hex 0 00000165 92 xchg ax, dx 228 <2> doscode_disp_ax_hex: ; ax 229 <2> assume ds:nothing, es:nothing, ss:nothing 0 00000166 86C4 xchg al, ah 0 00000168 E80200 call doscode_disp_al_hex 232 <2> ; display former ah 0 0000016B 86C4 xchg al, ah ; and fall trough for al 234 <2> doscode_disp_al_hex: ; al 235 <2> assume ds:nothing, es:nothing, ss:nothing 0 0000016D 51 push cx 0 0000016E B104 mov cl, 4 0 00000170 D2C8 ror al, cl 0 00000172 E80300 call doscode_disp_al_lownibble_hex 240 <2> ; display former high-nibble 0 00000175 D2C0 rol al, cl 0 00000177 59 pop cx 243 <2> ; and fall trough for low-nibble 244 <2> doscode_disp_al_lownibble_hex: 245 <2> assume ds:nothing, es:nothing, ss:nothing 0 00000178 50 push ax ; save ax for call return 0 00000179 240F and al, 00001111b 248 <2> ; high nibble must be zero 0 0000017B 0430 add al, '0' ; if number is 0-9, now it's the correct character 0 0000017D 3C39 cmp al, '9' 0 0000017F 7602 jna .decimalnum ; if we get decimal number with this, ok --> 0 00000181 0407 add al, 7 ; otherwise, add 7 and we are inside our alphabet 253 <2> .decimalnum: 0 00000183 E8CDFF call doscode_disp_al 0 00000186 58 pop ax 0 00000187 C3 retn 257 <2> 258 <2> 259 <2> relocated shellreturned 260 <2> assume ds:nothing, es:nothing, ss:nothing 0 00000188 FB sti 0 00000189 FC cld 0 0000018A 730E jnc .returned 0 0000018C BE[FB01] mov si, doscode_msg.error_shell_failed.1 ; access with cs 0 0000018F E8B5FF call doscode_disp_msg_cs 0 00000192 E8D1FF call doscode_disp_ax_hex 0 00000195 BE[2902] mov si, doscode_msg.error_shell_failed.2 ; access with cs 0 00000198 EB05 jmp @F 269 <2> .returned: 0 0000019A 31C0 xor ax, ax 0 0000019C BE[2C02] mov si, doscode_msg.error_shell_returned ; access with cs 272 <2> @@: 273 <2> extern doscode_getdosdata 274 <2> extern shell_return_has_been_freed 275 <2> extern shell_return_address 0 0000019F 50 push ax 0 000001A0 E8[0000] call doscode_getdosdata 0 000001A3 8ED8 mov ds, ax 279 <2> assume ds:DOSGROUP 0 000001A5 58 pop ax 0 000001A6 D006[0000] rol byte [shell_return_has_been_freed], 1 0 000001AA 728B jc ..@halt 0 000001AC E898FF call doscode_disp_msg_cs 284 <2> ; INP: ax = return error value (0 = no error) 285 <2> ; ds => DOSDATA 286 <2> ; STT: ss => init stack block 0 000001AF FF2E[0000] jmp far [shell_return_address] 288 <2> 289 <2> 290 <2> TAGCRASHDOS: 291 <2> assume ds:nothing, es:nothing, ss:nothing 292 <2> global TAGCRASHDOS 0 000001B3 50 push ax 0 000001B4 56 push si 0 000001B5 BE[C001] mov si, doscode_msg.error_common ; access with cs 0 000001B8 E88CFF call doscode_disp_msg_cs 0 000001BB BE[4C02] mov si, doscode_msg.error_tag ; access with cs 0 000001BE EBDF jmp @B 299 <2> 300 <2> 301 <2> doscode_msg: 0 000001C0 444F53434F44452065 .error_common: asciz "DOSCODE error: " 0 000001C9 72726F723A2000 0 000001D0 496E76616C69642064 .error_table: asciz "Invalid doscode_entrypoint_list reference." 0 000001D9 6F73636F64655F656E 0 000001E2 747279706F696E745F 0 000001EB 6C6973742072656665 0 000001F4 72656E63652E00 0 000001FB 496E697469616C2073 .error_shell_failed.1: asciz "Initial shell process execution failed! Code=" 0 00000204 68656C6C2070726F63 0 0000020D 657373206578656375 0 00000216 74696F6E206661696C 0 0000021F 65642120436F64653D 0 00000228 00 0 00000229 682E00 .error_shell_failed.2: asciz "h." 0 0000022C 496E697469616C2073 .error_shell_returned: asciz "Initial shell process returned!" 0 00000235 68656C6C2070726F63 0 0000023E 657373207265747572 0 00000247 6E65642100 0 0000024C 496E7465726E616C20 .error_tag: asciz "Internal error, tag mismatch!" 0 00000255 6572726F722C207461 0 0000025E 67206D69736D617463 0 00000267 682100 0 0000026A 0D0A53797374656D20 .error_after: asciz 13,10,"System halted. " 0 00000273 68616C7465642E2000 852 <1> 853 <1> PATHEND 001,BIO 117 <2> %IF PATHGEN 118 <2> %2%1E LABEL BYTE 119 <2> %ENDIF 854 <1> 855 <1> 220 ;=== Pop trace listing source 221 222 === Switch to base=002450h -> "BIOCODE" 223 usesection BIOCODE 224 225 %IF itest 226 PUBLIC MSGNUM 227 MSGNUM: 228 PUSHF 229 TEST [cs:FTESTBITS],AX 230 JZ MRET 231 PUSH SI 232 PUSH BX 233 PUSH CX 234 PUSH ES 235 PUSH DI 236 MOV DI,OFFSET NUMBUF 237 PUSH CS 238 POP ES 239 MOV CX,4 240 NUMLOOP: 241 PUSH CX 242 MOV CL,4 243 ROL BX,CL 244 POP CX 245 PUSH BX 246 AND BX,0FH 247 MOV AL,[cs:DIGITS + BX] 248 STOSB 249 POP BX 250 LOOP NUMLOOP 251 POP DI 252 POP ES 253 POP CX 254 POP BX 255 MOV SI,OFFSET NUMBUF 256 CALL MSGOUT 257 POP SI 258 POPF 259 RET 260 261 PUBLIC MSGOUT 262 MSGOUT: 263 PUSHF 264 TEST [cs:FTESTBITS],AX 265 JZ MRET 266 PUSH DS 267 PUSH AX 268 PUSH BX 269 PUSH CS 270 POP DS 271 CALL WRMSG 272 POP BX 273 POP AX 274 POP DS 275 MRET: 276 POPF 277 RET 278 279 PUBLIC DUMPBYTES ;J.K. 4/9/86 280 ;Dumpbytes will dump the bytes in memory in hex. Space will be put in between 281 ;the bytes and CR, LF will be put at the end. - J.K. 282 ;Input: DS:SI -> buffer to dump in Hex. 283 ; CX -> # of bytes (Length of the buffer) 284 ; 285 DUMPBYTES proc near 286 pushf 287 push ax 288 dumploops: 289 lodsb 290 mov ah, al 291 shr ah, 1 292 shr ah, 1 293 shr ah, 1 294 shr ah, 1 295 call hex_to_ascii 296 push ax 297 mov al, ah 298 call outchar 299 pop ax 300 call outchar 301 mov al, ' ' 302 call outchar 303 loop dumploops 304 305 mov al, 0dh 306 call outchar 307 mov al, 0ah 308 call outchar 309 310 pop ax 311 popf 312 ret 313 DUMPBYTES endp 314 315 PUBLIC Hex_to_ascii 316 Hex_to_ascii proc near ;J.K. - 4/9/86 317 and ax, 0f0fh 318 add ah, 30h 319 cmp ah, 3ah 320 jb hta_$1 321 add ah, 7 322 hta_$1: 323 add al, 30h 324 cmp al, 3ah 325 jb hta_$2 326 add al, 7 327 hta_$2: 328 ret 329 Hex_to_ascii endp 330 331 PUBLIC outchar 332 Outchar proc near 333 PUSH AX 334 PUSH SI 335 PUSH DI 336 PUSH BP 337 PUSH BX 338 ;SB33002******************************************************* 339 MOV AH, 0Eh ;SET COMMAND TO WRITE A CHAR ;SB;3.30* 340 MOV BX, 7 ;SET FOREGROUND COLOR ;SB;3.30* 341 INT 10h ;CALL ROM-BIOS ;SB;3.30* 342 ;SB33002******************************************************* 343 POP BX 344 POP BP 345 POP DI 346 POP SI 347 POP AX 348 RET 349 Outchar endp 350 351 %ENDIF 352 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 353 354 ;--------------------------------------------------- 355 ; 356 ; DEVICE ENTRY POINT 357 ; 358 CMDLEN equ 0 ;LENGTH OF THIS COMMAND 359 UNIT equ 1 ;SUB UNIT SPECIFIER 360 CMD equ 2 ;COMMAND CODE 361 STATUS equ 3 ;STATUS 362 MEDIA equ 13 ;MEDIA DESCRIPTOR 363 TRANS equ 14 ;TRANSFER ADDRESS 364 COUNT equ 18 ;COUNT OF BLOCKS OR CHARACTERS 365 _START equ 20 ;FIRST BLOCK TO TRANSFER 366 EXTRA equ 22 ;USUALLY A POINTER TO VOL ID FOR ERROR 15 367 START_L equ 26 ;AN000; Extended start sector (Low) 368 START_H equ 28 ;AN000; Extended start sector (High) 369 370 === Switch to base=002450h -> "BIOCODE" 371 section BIOCODE 372 extern doscode_getdosdata 373 374 dosbiocode_get_ds_dosbiodata: 375 biocode_get_ds_dosbiodata: 376 assume ds:nothing, es:nothing, ss:nothing 0 00007FA0 50 push ax 0 00007FA1 E8[0000] call doscode_getdosdata 0 00007FA4 8ED8 mov ds, ax 380 assume ds:DOSGROUP 0 00007FA6 58 pop ax 0 00007FA7 C3 retn 383 384 dosbiocode_get_ds_dosentry: 385 biocode_get_ds_dosentry: 386 assume ds:nothing, es:nothing, ss:nothing 0 00007FA8 2E8E1E[C000] mov ds, word [cs:.segment] 388 assume ds:DOSENTRYGROUP 0 00007FAD C3 retn 390 391 align 2, db 0 0 00007FAE [0000] .segment: dw DOSENTRY 393 394 dosbiocode_get_es_dosbiodata: 395 biocode_get_es_dosbiodata: 396 assume ds:nothing, es:nothing, ss:nothing 0 00007FB0 50 push ax 0 00007FB1 E8[0000] call doscode_getdosdata 0 00007FB4 8EC0 mov es, ax 400 assume es:DOSGROUP 0 00007FB6 58 pop ax 0 00007FB7 C3 retn 403 404 dosbiocode_get_es_dosentry: 405 biocode_get_es_dosentry: 406 assume ds:nothing, es:nothing, ss:nothing 0 00007FB8 2E8E06[C000] mov es, word [cs:biocode_get_ds_dosentry.segment] 408 assume es:DOSENTRYGROUP 0 00007FBD C3 retn 410 411 global biocode_get_es_dosentry, biocode_get_ds_dosentry 412 global dosbiocode_get_es_dosentry, dosbiocode_get_ds_dosentry 413 global biocode_get_es_dosbiodata, biocode_get_ds_dosbiodata 414 global dosbiocode_get_es_dosbiodata, dosbiocode_get_ds_dosbiodata 415 416 === Switch to base=002450h -> "BIOCODE" 417 section BIOCODE 418 419 420 relocated strategyentry 421 PUBLIC STRATEGY 422 STRATEGY PROC FAR 423 assume ds:nothing, es:nothing, ss:nothing 0 00007FBE 1E push ds 0 00007FBF E8E6FF call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 426 assume ds:DOSENTRYGROUP 0 00007FC2 891E[B801] MOV WORD PTR [PTRSAV],BX 0 00007FC6 8C06[BA01] MOV WORD PTR [PTRSAV+2],ES 0 00007FCA 1F pop ds 430 assume ds:nothing 0 00007FCB CB RET 432 STRATEGY ENDP 433 434 435 global DSK$IN 436 DSK$IN: ; legacy entry used by disk_i2F 0 00007FCC 56 push si 0 00007FCD 50 push ax 0 00007FCE BE[0100] mov si, DSKTBL 440 441 global common_dev_entrypoint 442 common_dev_entrypoint: 443 assume ds:nothing, es:nothing, ss:nothing 0 00007FD1 51 PUSH CX 0 00007FD2 52 PUSH DX 0 00007FD3 57 PUSH DI 0 00007FD4 55 PUSH BP 0 00007FD5 1E PUSH DS 0 00007FD6 06 PUSH ES 0 00007FD7 53 PUSH BX 451 0 00007FD8 E8DDFF call biocode_get_es_dosentry ; AUXNUM and PTRSAV in DOSENTRY 453 assume es:DOSENTRYGROUP 0 00007FDB 26A2[6C02] MOV [es:AUXNUM],AL ;SAVE CHOICE OF AUX/PRN DEVICE 455 0 00007FDF 26C51E[B801] lds bx, [es:PTRSAV] ;GET POINTER TO I/O PACKET 457 ASSUME DS:NOTHING 458 0 00007FE4 8A4701 MOV AL,BYTE PTR [BX + UNIT] ;AL = UNIT CODE 0 00007FE7 8A670D MOV AH,BYTE PTR [BX + MEDIA] ;AH = MEDIA DESCRIP 0 00007FEA 8B4F12 MOV CX,WORD PTR [BX + COUNT] ;CX = COUNT 0 00007FED 8B5714 MOV DX,WORD PTR [BX + _START] ;DX = START SECTOR 463 464 ;SB34MSB100********************************************************************* 465 ;SB 466 ;SB The disk device driver can now handle 32 bit start sector number. 467 ;SB So we should check to see if a 32 bit sector number has been specified 468 ;SB and if so get it. Whether a 32 bit sector has been specified or not 469 ;SB the disk driver expects a 32 bit sector number with the high word 470 ;SB in DOSENTRY:Start_Sec_H and the low word in dx. 471 ;SB 472 ;SB Algorithm: 473 ;SB 1. Check to see if the request is for the disk driver by 474 ;SB checking to see if SI points to DSKTBL. 475 ;SB 476 ;SB 2. If request not for the disk nothing special needs to be done. 477 ;SB 478 ;SB 3. If request for the disk then check to see if a 32 bit 479 ;SB sector number has been specified by seeing whether the 480 ;SB the conventional sector number specified is -1. If so 481 ;SB we need to pick the 32 bit sector number from the new 482 ;SB fields in the request packet. See the request header 483 ;SB struc for the fields you need. If the conventional 484 ;SB sector field is not -1 then a 16 bit sector number 485 ;SB has been specified and we just need to initalise the 486 ;SB high word in DOSENTRY:Start_Sec_H to 0 487 ;SB 488 ;SB NOTE: START_L and START_H are the offsets withing the IO_REQUEST packet 489 ;SB which contain the low and hi words of the 32 bit start sector if 490 ;SB it has been used. 491 ;SB 492 ;SB NOTE:Remember not to destroy the registers which have been set up before 493 494 %ifnidni %[DOSBIODATA], %[DOSENTRY] 0 00007FF0 E8BDFF call biocode_get_es_dosbiodata 496 assume es:DOSGROUP 497 %endif 0 00007FF3 81FE[0100] CMP SI,OFFSET DSKTBL 0 00007FF7 7516 JNZ DSK_REQ_CONT ; Not Disk Req 0 00007FF9 268326[6E00]00 and word [es:START_SEC_H], 0; prepare for zx 16-bit sector number 0 00007FFF 83FAFF CMP DX,-1 0 00008002 750B JNZ DSK_REQ_16 ; is a 16-bit sector number --> 0 00008004 8B571C MOV DX,[BX + START_H] ; 32 bits DSK REQ 504 START_SEC_H equ Start_Sec_H ; NASM port label 0 00008007 268916[6E00] MOV [es:START_SEC_H],DX ; es:Start_sec_H = Packet.Start_H 0 0000800C 8B571A MOV DX,[BX + START_L] ; DX = Packet.Start_L 507 DSK_REQ_16: 508 DSK_REQ_CONT: 509 510 ;SB34MSB100********************************************************************* 511 0 0000800F 97 XCHG DI,AX 0 00008010 8A4702 MOV AL,BYTE PTR [BX + CMD] 0 00008013 2E3A04 CMP AL,[CS:SI] ;ARR 2.41 0 00008016 7717 JA CMDERR 516 0 00008018 98 CBW ; NOTE THAT AL <= 15 MEANS OK 0 00008019 D1E0 SHL AX,1 519 0 0000801B 01C6 ADD SI,AX 0 0000801D 97 XCHG AX,DI 522 0 0000801E 06 push es 0 0000801F C47F0E LES DI,[BX + TRANS] 525 assume es:nothing 0 00008022 1F pop ds 527 assume ds:DOSGROUP 528 0 00008023 FC CLD 0 00008024 2EFF6401 JMP WORD PTR [cs:SI+1] ;GO DO COMMAND 531 DSK$IN ENDP 532 ; PAGE 533 ;===================================================== 534 ;= 535 ;= SUBROUTINES SHARED BY MULTIPLE DEVICES 536 ;= 537 ;===================================================== 538 ;---------------------------------------------------------- 539 ; 540 ; EXIT - ALL ROUTINES RETURN THROUGH THIS PATH 541 ; 542 PUBLIC BUS$EXIT 543 BUS$EXIT PROC FAR 544 assume ds:nothing, es:nothing, ss:nothing 0 00008028 B403 MOV AH,00000011B 0 0000802A EB21 JMP SHORT ERR1 547 548 global DSK$UNKNOWN 549 DSK$UNKNOWN: 550 assume ds:nothing, es:nothing, ss:nothing 0 0000802C B001 mov al, 1 ; unknown unit error 0 0000802E A9 db __TEST_IMM16 ; skip mov al 553 554 PUBLIC CMDERR 555 CMDERR: 556 assume ds:nothing, es:nothing, ss:nothing 0 0000802F B003 MOV AL,3 ;UNKNOWN COMMAND ERROR 558 559 PUBLIC ERR$CNT 560 ERR$CNT: 561 assume ds:nothing, es:nothing, ss:nothing 0 00008031 E874FF call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 563 assume ds:DOSENTRYGROUP 0 00008034 C51E[B801] lds bx, [PTRSAV] 565 ASSUME DS:NOTHING 0 00008038 294F12 SUB WORD PTR [BX + COUNT],CX ;# OF SUCCESSFUL I/O'S 567 568 PUBLIC ERR$EXIT 569 ERR$EXIT: 570 assume ds:nothing, es:nothing, ss:nothing 0 0000803B B481 MOV AH,10000001B ;MARK ERROR RETURN 0 0000803D EB0E JMP SHORT ERR1 573 BUS$EXIT ENDP 574 575 EXITP PROC FAR 576 assume ds:nothing, es:nothing, ss:nothing 577 EXIT$ZER: 0 0000803F E866FF call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 579 assume ds:DOSENTRYGROUP 0 00008042 C51E[B801] lds bx, [PTRSAV] 581 ASSUME DS:NOTHING 0 00008046 31C0 XOR AX,AX 0 00008048 894712 MOV WORD PTR [BX + COUNT],AX ;INDICATE NO CHARS READ 584 585 PUBLIC EXIT 586 EXIT: 587 assume ds:nothing, es:nothing, ss:nothing 0 0000804B B401 MOV AH,00000001B 589 ERR1: 590 assume ds:nothing, es:nothing, ss:nothing 0 0000804D E858FF call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 592 assume ds:DOSENTRYGROUP 0 00008050 C51E[B801] lds bx, [PTRSAV] 594 assume ds:nothing 0 00008054 894703 MOV WORD PTR [BX + STATUS],AX ;MARK OPERATION COMPLETE 596 0 00008057 5B POP BX 0 00008058 07 POP ES 599 assume es:nothing 0 00008059 1F POP DS 601 assume ds:nothing 0 0000805A 5D POP BP 0 0000805B 5F POP DI 0 0000805C 5A POP DX 0 0000805D 59 POP CX 0 0000805E 58 POP AX 0 0000805F 5E POP SI 608 global biocode_retf 609 biocode_retf: 0 00008060 CB RET ;RESTORE REGS AND RETURN 611 EXITP ENDP 612 613 ;------------------------------------------------------------- 614 ; 615 ; CHROUT - WRITE OUT CHAR IN AL USING CURRENT ATTRIBUTE 616 ; 617 ; CALLED VIA INT 29H 618 ; 619 PUBLIC CHROUT 620 CHROUT equ 29H 621 622 relocated i29 623 PUBLIC OUTCHR 624 OUTCHR PROC FAR 625 assume ds:nothing, es:nothing, ss:nothing 0 00008061 50 PUSH AX 0 00008062 56 PUSH SI 0 00008063 57 PUSH DI 0 00008064 55 PUSH BP 630 ;SB33002a******************************************************* 0 00008065 53 push bx ; ;SB ;3.30 0 00008066 B40E mov AH, 0Eh ; set command to write a character;SB;3.30 0 00008068 BB0700 mov BX, 7 ; set foreground color ;SB ;3.30 0 0000806B CD10 int 10h ; call rom-bios ;SB ;3.30 0 0000806D 5B pop bx ; ;SB ;3.30 636 ;SB33002a******************************************************* 0 0000806E 5D POP BP 0 0000806F 5F POP DI 0 00008070 5E POP SI 0 00008071 58 POP AX 0 00008072 CF IRET 642 OUTCHR ENDP 643 ;---------------------------------------------- 644 ; 645 ; SET DX TO AUXNUM 646 ; 647 PUBLIC GETDX 648 GETDX PROC NEAR 649 assume ds:nothing, es:nothing, ss:nothing 0 00008073 1E push ds 0 00008074 E831FF call biocode_get_ds_dosentry 652 assume ds:DOSENTRYGROUP 0 00008077 8B16[6C02] MOV DX,WORD PTR [AUXNUM] 0 0000807B 1F pop ds 655 assume ds:nothing 0 0000807C C3 RET 657 GETDX ENDP 658 ; PAGE 659 ;************************************************** ARR 2.15 660 661 ;----------------------------------------------- 662 ; 663 ; TIMER INTERRUPT HANDLER 664 ; 665 ;TIMER_LOW DW 0 666 ;TIMER_HIGH DW 0 667 ; 668 ;TIMER: 669 ; STI 670 ; PUSH AX 671 ; PUSH CX 672 ; PUSH DX 673 ; PUSH DS 674 ; PUSH CS 675 ; POP DS 676 ; XOR AX,AX 677 ; INT 1AH ; GET ROM TIME AND ZAP ROLL OVER 678 ; MOV [TIMER_HIGH],CX 679 ; MOV [TIMER_LOW],DX 680 ; OR AL,AL 681 ; JZ T5 682 ; INC WORD PTR [DAYCNT] ; ONE DAY GONE BY 683 ;T5: 684 ; POP DS 685 ; POP DX 686 ; POP CX 687 ; POP AX 688 ; IRET 689 ;************************************************** ARR 2.15 690 ; (no prior section) ; CODE ENDS 691 END === Trace listing source: mscon.lst 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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; SCCSID = @(#)IBMEXTRN.ASM 1.11 85/11/18 4 <1> ;This is for IBMINIT module. 5 <1> ;======================================================= 6 <1> ;REVISION HISTORY: 7 <1> ;AN000; - NEW Version 4.00. J.K. 8 <1> ;AC000; - Modified Line 4.00. J.K. 9 <1> ;ANxxx; - PTMyyy 10 <1> ;============================================================================== 11 <1> ;AN001; D486 SHARE installation for large media 2/23/88 J.K. 12 <1> ;============================================================================== 13 <1> 14 <1> extern biocode_get_ds_dosentry, biocode_get_es_dosentry 15 <1> extern dosbiocode_get_ds_dosentry, dosbiocode_get_es_dosentry 16 <1> extern biocode_get_ds_dosbiodata, biocode_get_es_dosbiodata 17 <1> EXTRN ORIG13:DWORD,ORIG19:DWORD 18 <1> EXTRN COM2DEV:WORD,COM1DEV:WORD 19 <1> EXTRN COM4DEV:WORD,COM3DEV:WORD 20 <1> EXTRN LPT3DEV:WORD,LPT2DEV:WORD,LPT1DEV:WORD 21 <1> EXTRN HARDDRV:BYTE,HARDNUM:BYTE,DRVMAX:BYTE,HDSKTAB:WORD 22 <1> EXTRN DSKDRVS:WORD,HNUM:BYTE,EOT:BYTE,FHAVE96:BYTE 23 <1> EXTRN REAL13:DWORD,DAYCNT:WORD,CONHEADER:WORD 24 <1> EXTRN TWOHARD:BYTE,INT_2F_NEXT:DWORD 25 <1> EXTRN BDSH:WORD,BDSX:WORD,START_BDS:WORD 26 <1> EXTRN FHAVEK09:BYTE, NEW_ROM:BYTE 27 <1> EXTRN SINGLE:BYTE 28 <1> EXTRN BDSMs:BYTE ;for Mini Disk -J.K. 4/7/86 29 <1> EXTRN HaveCMOSClock:byte ;set by IBMINIT. Used by IBMCLOCK.ASM 30 <1> EXTRN BinToBCD:word ;set by IBMINIT. Used by IBMCLOCK.ASM 31 <1> EXTRN DaycntToDay:word ;set by IBMINIT. Used by IBMCLOCK.ASM 32 <1> EXTRN OLD13:DWORD 33 <1> extrn Temp_H:word ;J.K. For 32 bit calculation. IBMDISK 34 <1> extrn Start_Sec_H:word ;J.K. IBMDISK. 35 <1> extrn KEYRD_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA. 36 <1> extrn KEYSTS_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA. 37 <1> extrn DiskSector:byte ;J.K. IBMBDATA 38 <1> extrn Bpb_In_Sector:word ;J.K. IBMBDATA 39 <1> extrn SecPerClusInSector:Byte ;J.K. IBMBDATA 40 <1> extrn NumberOfFats:byte ;J.K. IBMBDATA 41 <1> extrn MediaByte:byte ;J.K. IBMBDATA 42 <1> extrn Ext_Boot_Sig:Byte ;J.K. IBMBDATA 43 <1> extrn Boot_Serial_L:Word ;J.K. IBMBDATA 44 <1> extrn Boot_Serial_H:Word ;J.K. IBMBDATA 45 <1> extrn Boot_Volume_Label:Byte ;J.K. IBMBDATA 46 <1> extrn Boot_System_ID:Byte ;J.K. IBMBDATA 47 <1> extrn Fat_12_ID:Byte ;J.K. IBMDISK 48 <1> extrn Fat_16_ID:Byte ;J.K. IBMDISK 49 <1> extrn lbapacket:byte 50 <1> extrn Vol_No_Name:Byte ;J.K. IBMDISK 51 <1> extrn MOTORSTARTUP:Byte ;J.K. IBMBDATA 52 <1> extrn DoubleWordMov:Byte ;J.K. IBMDISK 53 <1> extrn Model_Byte:Byte ;J.K. IBMBIO2 54 <1> extrn Secondary_Model_Byte:Byte ;J.K. IBMBIO2 55 <1> 56 <1> %IF itest 57 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD 58 <1> %ENDIF 59 <1> 60 <1> EXTRN START$:NEAR,ERROUT:NEAR,BLOCK13:FAR,INT19:FAR 61 <1> EXTRN INTRET:NEAR,HDRIVE:NEAR,DRIVEX:NEAR,INT13:FAR,CBREAK:NEAR,OUTCHR:NEAR 62 <1> EXTRN DISKRD:NEAR,MEDIA_PATCH:NEAR,GETBP1_PATCH:NEAR 63 <1> EXTRN SET_PATCH:NEAR,DISKIO_PATCH:NEAR,DSKERR:NEAR,INIT_PATCH:NEAR 64 <1> extern DSKERR_PATCH 65 <1> EXTRN TABLE_PATCH:NEAR,EXIT:NEAR,CHANGED_PATCH:NEAR 66 <1> EXTRN ERRIN:NEAR,GETBP:NEAR,SWPDSK:NEAR 67 <1> EXTRN OUTCHR:NEAR,WRMSG:NEAR,TIME_TO_TICKS:NEAR 68 <1> EXTRN INT2F_DISK:NEAR,INSTALL_BDS:NEAR,SETDRIVE:NEAR 69 <1> extrn Mov_Media_IDs:Near ;J.K. 70 <1> extrn Clear_IDs:Near ;J.K. 71 <1> %IF itest 72 <1> EXTRN MSGNUM:NEAR,MSGOUT:NEAR,dumpbytes:near,hex_to_ascii:near 73 <1> EXTRN outchar:near 74 <1> %ENDIF 75 <1> extrn lbatochs:near, chstotuple:near 76 <1> extrn lba_packet_setup:near 77 <1> === Switch to base=00C400h -> "SYSINITSEG" 78 <1> section SYSINITSEG PUBLIC class=INIT 79 <1> ASSUME CS:SYSINITSEG 80 <1> EXTRN behind_dosentry_segment:WORD 81 <1> EXTRN DEVICE_LIST:DWORD 82 <1> EXTRN MEMORY_SIZE:WORD 83 <1> EXTRN DEFAULT_DRIVE:BYTE 84 <1> EXTRN BUFFERS:WORD 85 <1> EXTRN SYSINIT:FAR 86 <1> extrn Big_Media_Flag:Byte ;AN001; 87 <1> ; (no prior section) ; SYSINITSEG ENDS === Switch to base=002450h -> "BIOCODE" 88 <1> section BIOCODE 89 <1> 90 <1> ASSUME CS:BIOCODE 91 <1> 92 <1> ; END OF DISK MODULES FOR CONFIGURATION 93 <1> 94 <1> EXTRN END96TPI:BYTE 95 <1> EXTRN ENDTWOHARD:BYTE 96 <1> EXTRN ENDONEHARD:BYTE 97 <1> EXTRN ENDSWAP:BYTE 98 <1> EXTRN ENDFLOPPY:BYTE 99 <1> 100 <1> ; IBM FIXED UP AT ROM 101 <1> 102 <1> EXTRN IBM_DISK_IO:FAR 14 %include "jumpmac.mac" 1 <1> ;;Rev 3.30 Modification 2 <1> ; 3 <1> ; given a label either 2 byte jump to another label _J 4 <1> ; if it is near enough or 3 byte jump to 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 0 0000807E ???? lpSize dw ? 0 00008080 ???? lpCount dw ? 0 00008082 ???????? lpBuffer dd ? 0 00008086 ???????????????? 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 0 0000807E ???????? LINK DD ? ; LINK TO NEXT BDS 0 00008082 ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 00008083 ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 00008084 ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 00008086 ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 00008087 ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 00008089 ?? CFAT DB ? ; NUMBER OF FATS 0 0000808A ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 0000808C ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 0000808E ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 0000808F ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 00008091 ???? SECLIM DW ? ; SECTORS PER TRACK 0 00008093 ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 00008095 ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 00008097 ???? HIDSEC_H dw ? ;0 ;J.K.87 0 00008099 ???? DRVLIM_L dw ? ;0 ;J.K.87 0 0000809B ???? DRVLIM_H dw ? ;0 ;J.K.87 0 0000809D ?? FATSIZ DB ? ; FLAGS... 0 0000809E ???? OPCNT DW ? ; OPEN REF. COUNT 0 000080A0 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 000080A1 ???? FLAGS DW ? ; VARIOUS FLAGS 0 000080A3 ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 000080A5 ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 000080A7 ?? RSECPERCLUS DB ? 0 000080A8 ???? RRESSEC DW ? 0 000080AA ?? RCFAT DB ? 0 000080AB ???? RCDIR DW ? 0 000080AD ???? RDRVLIM DW ? 0 000080AF ?? RMEDIAD DB ? 0 000080B0 ???? RCSECFAT DW ? 0 000080B2 ???? RSECLIM DW ? 0 000080B4 ???? RHDLIM DW ? 0 000080B6 ???? RHIDSEC_L DW ? 0 000080B8 ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 000080BA ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 000080BC ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 000080BE ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 000080C4 ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 000080C5 ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 000080C7 ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 000080D5 ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <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 0 0000807E ???? mlink DW ? ;-1 ;Link to next structure 0 00008080 ???? DW ? 0 00008082 ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 00008083 ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 00008084 ???? mBytePerSec DW ? ;512 0 00008086 ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 00008087 ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 00008089 ?? mcFAT DB ? ;2 ;No. of allocation tables 0 0000808A ???? mcDIR DW ? ;16 ;Number of directory entries 0 0000808C ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 0000808E ?? mMediad DB ? ;11111000B ;Media descriptor 0 0000808F ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 00008091 ???? mSECLIM DW ? ;0 ;Sector limit 0 00008093 ???? mHDLIM DW ? ;0 ;Head limit 0 00008095 ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 00008097 ???? mHidsec_H dw ? ;0 ;J.K.87 0 00008099 ???? mDrvlim_L dw ? ;0 ;J.K.87 0 0000809B ???? mDrvlim_H dw ? ;0 ;J.K.87 0 0000809D ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 0000809E ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 000080A0 ?? mFormFactor DB ? ;3 ;Form Factor 0 000080A1 ???? mFLAGS DW ? ;0020H ;Various Flags 0 000080A3 ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 000080C4 ?? mTrack db ? ;-1 0 000080C5 ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 000080C7 ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 000080D4 ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 000080D5 ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 000080D9 ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 000080E1 ?? 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 0 0000807E ???? SECSIZE DW ? 0 00008080 ?? SECALL DB ? 0 00008081 ???? RESNUM DW ? 0 00008083 ?? FATNUM DB ? 0 00008084 ???? DIRNUM DW ? 0 00008086 ???? SECNUM DW ? 0 00008088 ?? FATID DB ? 0 00008089 ???? FATSIZE DW ? 0 0000808B ???? SLIM DW ? 0 0000808D ???? HLIM DW ? 0 0000808F ???? HIDDEN_L DW ? 0 00008091 ???? HIDDEN_H dw ? ;0 ;J.K. 0 00008093 ???? SECNUM_L dw ? ;0 ;J.K. 0 00008095 ???? 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> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 17 18 ;*** DOS 3.3 will not support more than 25 rows 19 ; INCLUDE DEVSYM.INC ;J.K. 4/29/86 for CON$GENIOCTL support 20 ; INCLUDE IOCTL.INC ;J.K. 4/29/86 for CON$GENIOCTL support 21 22 EXTRN EXIT:NEAR ;MSBIO1 23 EXTRN BUS$EXIT:NEAR ;MSBIO1 24 25 ; EXTRN CMDERR:NEAR ;MSBIO1 J.K. 4/29/86 26 27 ;DATA 28 EXTRN PTRSAV:DWORD ;MSBIO1 29 EXTRN FHAVEK09:BYTE ;MSDISK 30 EXTRN ALTAH:BYTE ;MSBDATA 31 EXTRN KEYRD_Func:Byte ;MSBDATA 32 EXTRN KEYSTS_Func:Byte ;MSBDATA 33 extern altah_indirect 34 35 ; EXTRN SAV_SC_INFO:BYTE ;MSBDATA J.K. 4/29/86 36 ; EXTRN SAV_SC_MODE:BYTE ;MSBDATA J.K. 4/29/86 37 ;------------------------------------------------------ 38 ; 39 ; CONSOLE READ ROUTINE 40 ; 41 PUBLIC CON$READ 42 CON$READ PROC NEAR 43 assume ds:DOSGROUP, es:nothing, ss:nothing 44 ; THIS WAS SET BY THE CON DD ENTRY POINT 0 0000807E E306 JCXZ CON$EXIT 46 CON$LOOP: 0 00008080 E81000 CALL CHRIN ;GET CHAR IN AL 0 00008083 AA STOSB ;STORE CHAR AT ES:DI 0 00008084 E2FA LOOP CON$LOOP 50 CON$EXIT: 0 00008086 E9[0000] JUMP EXIT 52 CON$READ ENDP 53 ;--------------------------------------------------------- 54 ; 55 ; INPUT SINGLE CHAR INTO AL 56 ; 57 ;J.K.5/12/87 We are going to issue extended keyboard function, if supported. 58 ;The returning value of the extended key stroke of the extended key board 59 ;function uses 0E0h in AL instead of 00 as in the conventional key board 60 ;function. This creates a conflict when the user entered real Greek Alpha 61 ;charater (= 0E0h) to distinguish the extended key stroke and the Greek Alpha. 62 ;This case will be handled in the following manner; 63 ; AH = 16h 64 ; INT 16h 65 ; If AL == 0, then extended code (in AH) 66 ; else If AL == 0E0h, then 67 ; IF AH <> 0, then extended code (in AH) 68 ; else Greek_Alpha character. 69 ;Also, for compatibility reason, if an extended code is detected, then we 70 ;are going to change the value in AL from 0E0h to 00h. 71 72 get_dsbx_altah: 0 00008089 E8[0000] call biocode_get_ds_dosbiodata 74 assume ds:DOSGROUP 0 0000808C 8B1E[0000] mov bx, word [altah_indirect] 0 00008090 E9[0000] jmp biocode_get_ds_dosentry 77 78 79 CHRIN PROC NEAR 0 00008093 E8[0000] call biocode_get_ds_dosbiodata 81 assume ds:DOSGROUP 82 ;AN000; 83 ; XOR AX,AX 0 00008096 8A26[0000] mov ah,[KEYRD_Func] ;AN000; Set by MSINIT. 0 or 10h 0 0000809A 30C0 xor al,al ;AN000; 0 0000809C E8EAFF call get_dsbx_altah 87 assume ds:DOSENTRYGROUP 0 0000809F 8607 XCHG AL,[bx] ;GET CHARACTER & ZERO ALTAH 89 0 000080A1 08C0 OR AL,AL 0 000080A3 752F JNZ KEYRET 92 ;SB34CON000************************************************************** 93 ;SB Keyboard I/O interrupt 94 ;SB AH already contains the keyboard read function number 95 ;SB 1 LOC 96 0 000080A5 CD16 int 16h 98 ;SB34CON000************************************************************** 99 ALT10: 0 000080A7 09C0 OR AX,AX ;CHECK FOR NON-KEY AFTER BREAK 0 000080A9 74E8 JZ CHRIN 0 000080AB 3D0072 CMP AX,7200H ;CHECK FOR CTRL-PRTSC 0 000080AE 7505 JNZ ALT_Ext_Chk ;AN000; 0 000080B0 B010 MOV AL,16 105 KeyRet equ KEYRET ; NASM port label 0 000080B2 EB20 jmp KeyRet ;AN000; 0 000080B4 90 nop ; identicalise 108 ALT_Ext_Chk: 109 ;SB34CON001************************************************************** 110 ;SB IF operation was extended function (i.e. KEYRD_Func != 0) THEN 111 ;SB IF character read was 0E0h THEN 112 ;SB IF extended byte was zero (i.e. AH == 0) THEN 113 ;SB goto keyret 114 ;SB ELSE 115 ;SB set AL to zero 116 ;SB goto ALT_SAVE 117 ;SB ENDIF 118 ;SB ENDIF 119 ;SB ENDIF 120 ;SB 9 LOCS 121 0 000080B5 E8[0000] call biocode_get_ds_dosbiodata 123 assume ds:DOSGROUP 0 000080B8 803E[0000]00 cmp BYTE [KEYRD_Func],0 0 000080BD 740C jz NOT_EXT 0 000080BF 3CE0 cmp al,0E0h 0 000080C1 7508 jnz NOT_EXT 0 000080C3 08E4 or ah,ah 0 000080C5 740D jz KEYRET 0 000080C7 30C0 xor al,al 0 000080C9 EB04 jmp short ALT_SAVE 132 NOT_EXT: 133 134 ;SB34CON001************************************************************** 0 000080CB 08C0 OR AL,AL ;SPECIAL CASE? 0 000080CD 7505 JNZ KEYRET 137 ALT_SAVE: 0 000080CF E8B7FF call get_dsbx_altah 139 assume ds:DOSENTRYGROUP 0 000080D2 8827 MOV [bx],AH ;STORE SPECIAL KEY 141 KEYRET: 0 000080D4 C3 RET 143 CHRIN ENDP 144 145 ;-------------------------------------------------------------- 146 ; 147 ; KEYBOARD NON DESTRUCTIVE READ, NO WAIT 148 ; 149 ; PC-CONVERTIBLE-TYPE MACHINE: IF BIT 10 IS SET BY THE DOS IN THE STATUS WORD 150 ; OF THE REQUEST PACKET, AND THERE IS NO CHARACTER IN THE INPUT BUFFER, THE 151 ; DRIVER ISSUES A SYSTEM WAIT REQUEST TO THE ROM. ON RETURN FROM THE ROM, IT 152 ; RETURNS A 'CHAR-NOT-FOUND' TO THE DOS. 153 ; 154 CONBUSJ: 155 assume ds:nothing, es:nothing, ss:nothing 0 000080D5 EB73 JMP CONBUS 0 000080D7 90 nop ; identicalise 158 159 PUBLIC CON$RDND 160 CON$RDND: 161 assume ds:DOSGROUP, es:nothing, ss:nothing 162 ; THIS WAS SET BY THE CON DD ENTRY POINT 0 000080D8 E8AEFF call get_dsbx_altah 164 assume ds:DOSENTRYGROUP 0 000080DB 8A07 MOV AL,[bx] 0 000080DD 08C0 OR AL,AL 0 000080DF 7403 JZ RD1 0 000080E1 EB5A JMP RDEXIT 0 000080E3 90 nop ; identicalise 170 171 RD1: 172 ;SB34CON002************************************************************** 173 ;SB Keyboard I/O interrupt 174 ;SB Get keystroke status (KEYSTS_Func) 175 ;SB 2 LOCS 176 0 000080E4 E8[0000] call biocode_get_ds_dosbiodata 178 assume ds:DOSGROUP 0 000080E7 8A26[0000] mov ah,[KEYSTS_Func] 0 000080EB CD16 int 16h 181 ;SB34CON002************************************************************** 0 000080ED 7403 JZ NOCHR 0 000080EF EB1E JMP GOTCHR 0 000080F1 90 nop ; identicalise 185 NOCHR: 0 000080F2 803E[0000]00 CMP byte [FHAVEK09],0 0 000080F7 74DC JZ CONBUSJ 0 000080F9 E8[0000] call biocode_get_ds_dosentry 189 assume ds:DOSENTRYGROUP 0 000080FC C51E[0000] LDS BX,[PTRSAV] 191 ASSUME DS:NOTHING 0 00008100 F747030004 TEST word [BX + STATUS],0400H ; SYSTEM WAIT ENABLED? 0 00008105 74CE JZ CONBUSJ 194 195 ;******************************** 196 ; NEED TO WAIT FOR IBM RESPONSE TO REQUEST FOR CODE ON HOW TO USE THE SYSTEM 197 ; WAIT CALL. 198 ;******************************** 199 MESSAGE FTESTCON,<"SYSTEM WAIT STAGE",CR,LF> 0 00008107 B80041 MOV AX,4100H ; WAIT ON AN EXTERNAL EVENT 201 ; MOV BX,0300H ; NO TIMEOUT 202 ; MOV DX,60H ; LOOK AT I/O PORT 60H 0 0000810A CD15 INT 15H ; CALL ROM FOR SYSTEM WAIT 204 MESSAGE FTESTCON,<"OUT OF WAIT. AX IS "> 205 MNUM FTESTCON,AX 206 MESSAGE FTESTCON, 0 0000810C EB3C JMP CONBUS 0 0000810E 90 nop ; identicalise 209 210 GOTCHR: 211 assume ds:DOSGROUP 0 0000810F 09C0 OR AX,AX 0 00008111 750B JNZ NOTBRK ;CHECK FOR NULL AFTER BREAK 214 ;SB34CON004************************************************************** 215 ;SB Keyboard I/O interrupt 216 ;SB Keyboard read function (KEYRD_Func) 217 ;SB 2 LOCS 218 0 00008113 E8[0000] call biocode_get_ds_dosbiodata 220 assume ds:DOSGROUP 0 00008116 8A26[0000] mov ah,[KEYRD_Func] 0 0000811A CD16 int 16h 223 ;SB34CON004************************************************************** 0 0000811C EBBA JUMP CON$RDND ;AND GET A REAL STATUS 225 NOTBRK: 0 0000811E 3D0072 CMP AX,7200H ;CHECK FOR CTRL-PRTSC 0 00008121 7505 JNZ RD_Ext_Chk ;AN000; 0 00008123 B010 MOV AL,16 0 00008125 EB16 jmp RDEXIT ;AN000; 0 00008127 90 nop ; identicalise 231 RD_Ext_Chk: ;AN000; 0 00008128 E8[0000] call biocode_get_ds_dosbiodata 233 assume ds:DOSGROUP 0 0000812B 803E[0000]00 cmp byte [KEYRD_Func], 0 ;AN000; Extended Keyboard function? 0 00008130 740B jz RDEXIT ;AN000; No. Normal exit. 0 00008132 3CE0 cmp al,0E0h ;AN000; Extended key value or Greek Alpha? 0 00008134 7507 jne RDEXIT ;AN000; 0 00008136 80FC00 cmp ah, 0 ;AN000; Scan code exist? 0 00008139 7402 jz RDEXIT ;AN000; Yes. Greek Alpha char. 0 0000813B B000 mov al, 0 ;AN000; No. Extended key stroke. Change it for compatibility 241 PUBLIC RDEXIT 242 RDEXIT: 0 0000813D E8[0000] call biocode_get_ds_dosentry 244 assume ds:DOSENTRYGROUP 0 00008140 C51E[0000] LDS BX,[PTRSAV] 246 ASSUME DS:NOTHING 0 00008144 88470D MOV [BX + MEDIA],AL 248 EXVEC: 0 00008147 E9[0000] JUMP EXIT 250 251 CONBUS: 252 ASSUME DS:NOTHING 0 0000814A E9[0000] JUMP BUS$EXIT 254 ;-------------------------------------------------------------- 255 ; 256 ; KEYBOARD FLUSH ROUTINE 257 ; 258 PUBLIC CON$FLSH 259 CON$FLSH: 260 assume ds:DOSGROUP, es:nothing, ss:nothing 261 ; THIS WAS SET BY THE CON DD ENTRY POINT 0 0000814D E80300 CALL FLUSH 0 00008150 E9[0000] JUMP EXIT 264 265 PUBLIC FLUSH 266 FLUSH: 0 00008153 E833FF call get_dsbx_altah 268 assume ds:DOSENTRYGROUP 0 00008156 C60700 MOV byte [bx],0 ;CLEAR OUT HOLDING BUFFER 270 271 FLLOOP: 272 ;SB33012**************************************************************** 273 ;SB ; Is there a char there? 0 00008159 B401 mov AH, 1 ;SB ; command code for check status 0 0000815B CD16 int 16h ;SB ; call rom-bios keyboard routine 276 ;SB33012**************************************************************** 0 0000815D 7406 JZ FLDONE 278 ;SB33013**************************************************************** 0 0000815F 30E4 xor AH, AH ;SB ; if zf is nof set, get character 0 00008161 CD16 int 16h ;SB ; call rom-bios to get character 281 ;SB33013**************************************************************** 0 00008163 EBF4 JMP FLLOOP 283 FLDONE: 284 0 00008165 C3 RET 286 ;---------------------------------------------------------- 287 ; 288 ; CONSOLE WRITE ROUTINE 289 ; 290 PUBLIC CON$WRIT 291 CON$WRIT: 292 assume ds:DOSGROUP, es:nothing, ss:nothing 293 ; THIS WAS SET BY THE CON DD ENTRY POINT 0 00008166 E3DF JCXZ EXVEC 295 CON$LP: 0 00008168 268A05 MOV AL,[ES:DI] ;GET CHAR 0 0000816B 47 INC DI 0 0000816C CD29 INT CHROUT ;OUTPUT CHAR 0 0000816E E2F8 LOOP CON$LP ;REPEAT UNTIL ALL THROUGH 0 00008170 E9[0000] JUMP EXIT 301 ;----------------------------------------------- 302 ; 303 ; BREAK KEY HANDLING 304 ; 305 relocated i1B 306 CBREAK: 307 PUBLIC CBREAK 308 assume ds:nothing, es:nothing, ss:nothing 0 00008173 1E push ds 0 00008174 53 push bx 0 00008175 E811FF call get_dsbx_altah 312 assume ds:DOSENTRYGROUP 0 00008178 C60703 mov byte [bx], 3 ; INDICATE BREAK KEY SET 0 0000817B 5B pop bx 0 0000817C 1F pop ds 316 assume ds:nothing 0 0000817D CF IRET 318 319 ;------------------------------------------------------------------------------ 320 ;J.K. 4/29/86 - CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3. 321 ;CON$GENIOCTL supports Get mode information, Set mode information functions. 322 ;It will only save the value from "Set mode information" and will return 323 ;the value through "Get mode information". It is supposed to be set by 324 ;the MODE.COM and other application program can retrieve information 325 ;through "Get mode information" call. 326 ;Initially, there is no valuable informaton until set by MODE command, so 327 ;any attemp to "Get mode information" at that points will fail. (unknown 328 ;command with carry set.) 329 ;At entry: CS = DS = code 330 ; [CS:PTRSAV] has seg, address of the Request Header saved in 331 ; in Strategy routine. 332 ; 333 ; PUBLIC CON$GENIOCTL 334 ; ASSUME DS:CODE 335 ;CON$GENIOCTL: 336 ; les di, [CS:PTRSAV] ;get the request header 337 ; cmp [es:di].MajorFunction, IOC_SC 338 ; je Major_SC_OK 339 ;SC_CMDERR: 340 ; stc 341 ; jmp cmderr ;carry is set, exit to cmderr 342 ;Major_SC_OK: 343 ; mov al, [es:di].MinorFunction ;save minor function 344 ; les di, [es:di].GenericIOCTL_Packet ;pointer of SC_MODE_INFO structure 345 ; mov cx, [es:di].SC_INFO_LENGTH ;save length 346 ; inc di 347 ; inc di ;ES:DI -> SC_MODE in Info. Packet 348 ; cmp cx, SC_INFO_PACKET_LENGTH ;currently 9. 349 ; jne SC_CMDERR ;cannot accept the different packet 350 ; cmp al, GET_SC_MODE ;minor function = 60h ? 351 ; jne SC_SET_MODE_FUNC ;no, check if it is "Set mode function" 352 ; cmp SAV_SC_MODE, 0 ;information set before? 353 ; je SC_CMDERR ;no, cannot get the info. 354 ;;SC_GET_MODE_FUNC: ;es:di -> SC_MODE in info. packet 355 ; ;cx - length 356 ; mov si, offset SAV_SC_INFO 357 ; rep movsb ;ds:si -> sav_sc_info, es:di -> sc_mode 358 ; jmp exit 359 ; 360 ;SC_SET_MODE_FUNC: ;es:di -> SC_MODE 361 ; cmp al, SET_SC_MODE ;minor function = 40h ? 362 ; jne SC_CMDERR 363 ; mov si, offset SAV_SC_INFO 364 ; xchg di, si 365 ; push es 366 ; push ds 367 ; pop es 368 ; pop ds 369 ; rep movsb ;ds:si -> sc_mode, es:di -> sav_sc_info 370 ; jmp exit 371 ; 372 ;J.K. 4/29/86 - End of CONSOLE GENERIC IOCTL SUPPORT FOR DOS 3.3. 373 374 ; (no prior section) ; CODE ENDS 375 END === Trace listing source: msaux.lst 1 ; TITLE MSAUX - DOS 3.3 2 ;---------------------------------------------------------------- 3 ; : 4 ; A U X - AUXILARY DEVICE DRIVER : 5 ; : 6 ; : 7 ; This file contains the Auxilary Device Driver. The : 8 ; auxilary driver handles calls to and from the RS-232 port. : 9 ; Three devices uses this code: AUX, COM1, and COM2. AUX and : 10 ; COM1 talk to the zero RS-232 card and COM2 talks to the : 11 ; 'one' RS-232 card. The beginning of the interrupt entry : 12 ; point for these devices sets the variable AUXNUM in the : 13 ; msbio.asm module. If the value is 0 the routines in this : 14 ; file will talk to the the 'zero' card. If the value in : 15 ; AUXNUM is 1 the routines will talk to the 'one' card. : 16 ; The procedure GETDX is called to put the value 0 or 1 in : 17 ; the DX register depending on the value in AUXBUF. : 18 ; : 19 ; The routines in this files are: : 20 ; : 21 ; routine function : 22 ; ------- -------- : 23 ; AUX$READ Read characters from the : 24 ; specified device. : 25 ; AUX$RDND Non-desrucrtive read with : 26 ; no waiting. : 27 ; AUX$FLSH Flush specified device input : 28 ; buffer. : 29 ; AUX$WRIT Write characters to the : 30 ; specified device. : 31 ; AUX$WRST Get status of specified : 32 ; device : 33 ; : 34 ; These routines are not called directly. Call are made via : 35 ; the strategy and interrupt entry point (see Device Header). : 36 ; : 37 ; Data structure: : 38 ; The Aux Device has a two byte buffer called AUXBUF. The : 39 ; first byte is for the zero card, the second byte is for the : 40 ; one card. A zero value in the byte indicates the buffer is : 41 ; empty. The routines use GETBX to get the address of the : 42 ; buffer. : 43 ; : 44 ;---------------------------------------------------------------- 45 46 ;;Ver 3.30 modification --------------------------- 47 itest equ 0 48 %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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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 49 %include "jumpmac.mac" 1 <1> ;;Rev 3.30 Modification 2 <1> ; 3 <1> ; given a label either 2 byte jump to another label _J 4 <1> ; if it is near enough or 3 byte jump to 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> 50 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 51 52 EXTRN ERR$CNT:NEAR ;MSBIO1 53 EXTRN GETDX:NEAR ;MSBIO1 54 EXTRN RDEXIT:NEAR ;MSCON 55 EXTRN EXIT:NEAR ;MSBIO1 56 EXTRN BUS$EXIT:NEAR ;MSBIO1 57 ;DATA 58 EXTRN AUXBUF:BYTE ;MSDATA 59 60 ; VALUES IN AH, REQUESTING FUNCTION OF INT 14H IN ROM BIOS 61 AUXFUNC_SEND EQU 1 ;TRANSMIT 62 AUXFUNC_RECEIVE EQU 2 ;READ 63 AUXFUNC_STATUS EQU 3 ;REQUEST STATUS 64 65 ; ERROR FLAGS, REPORTED BY INT 14H 66 67 ; THESE FLAGS REPORTED IN AH: 68 FLAG_DATA_READY EQU 01H ;DATA READY 69 FLAG_OVERRUN EQU 02H ;OVERRUN ERROR 70 FLAG_PARITY EQU 04H ;PARITY ERROR 71 FLAG_FRAME EQU 08H ;FRAMING ERROR 72 FLAG_BREAK EQU 10H ;BREAK DETECT 73 FLAG_TRANHOL_EMP EQU 20H ;TRANSMIT HOLDING REGISTER EMPTY 74 FLAG_TRANSHF_EMP EQU 40H ;TRANSMIT SHIFT REGISTER EMPTY 75 FLAG_TIMEOUT EQU 80H ;TIMEOUT 76 77 ; THESE FLAGS REPORTED IN AL: 78 FLAG_DELTA_CTS EQU 01H ;DELTA CLEAR TO SEND 79 FLAG_DELTA_DSR EQU 02H ;DELTA DATA SET READY 80 FLAG_TRAIL_RING EQU 04H ;TRAILING EDGE RING INDICATOR 81 FLAG_DELTA_SIG EQU 08H ;DELTA RECEIVE LINE SIGNAL DETECT 82 FLAG_CTS EQU 10H ;CLEAR TO SEND 83 FLAG_DSR EQU 20H ;DATA SET READY 84 FLAG_RING EQU 40H ;RING INDICATOR 85 FLAG_REC_SIG EQU 80H ;RECEIVE LINE SIGNAL DETECT 86 ;;End of modification ------------------ 87 88 89 ;---------------------------------------------------------------- 90 ; : 91 ; Read zero or more characters from Auxilary Device : 92 ; : 93 ; input:[es:di] points to area to receive aux data : 94 ; cx has number of bytes to be read : 95 ; "auxnum" first byte has number of aux device (rel 0): 96 ; : 97 ;---------------------------------------------------------------- 98 PUBLIC AUX$READ 99 AUX$READ PROC NEAR 100 assume ds:DOSGROUP, es:nothing, ss:nothing 101 ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE 0 0000817E E311 jcxz EXVEC2 ; if no characters, get out 0 00008180 E88700 call GETBX ; put address of AUXBUF in BX 0 00008183 31C0 xor AX,AX ; clear AX register 0 00008185 8607 xchg AL,[BX] ; Get character , if any, from 106 ; buffer and clear buffer 0 00008187 08C0 or AL,AL ; if AL is nonzero there was a 108 ; character in the buffer 0 00008189 7503 jnz AUX2 ; if so skip AUXIN call 110 AUX1: ; 0 0000818B E80600 call AUXIN ; get character from port 112 AUX2: ; 0 0000818E AA stosb ; store character 0 0000818F E2FA loop AUX1 ; if more character, go around again 115 EXVEC2: ; 0 00008191 E9[0000] Jump EXIT ; all done, successful exit 117 AUX$READ ENDP 118 119 ; 120 ; AUXIN: make a call on ROM BIOS to read character from 121 ; the auxilary device, then do some error checking. 122 ; If an error occurs then AUXIN jumps to ERR$CNT and 123 ; does NOT return to where it was called from. 124 ; 125 126 AUXIN PROC NEAR 127 0 00008194 B402 mov ah,AUXFUNC_RECEIVE 0 00008196 E84800 call AUXOP 130 ;check for Frame, Parity, or Overrun errors 131 ;WARNING: these error bits are unpredictable 132 ; if timeout (bit 7) is set 0 00008199 F6C40E test ah,FLAG_FRAME | FLAG_PARITY | FLAG_OVERRUN 0 0000819C 740A jz AROK ;No error if all bits are clear 135 136 ;Error getting character 0 0000819E 83C402 add sp,+2 ;Remove rtn address (near call) 0 000081A1 30C0 xor al,al 0 000081A3 0CB0 or al,FLAG_REC_SIG | FLAG_DSR | FLAG_CTS 140 0 000081A5 E9[0000] JUMP ERR$CNT 142 AROK: 0 000081A8 C3 RET ;CHAR JUST READ IS IN AL, STATUS IS IN AH 144 AUXIN ENDP 145 146 ;---------------------------------------------------------------- 147 ; : 148 ; Aux non-destructive read with no waiting : 149 ; : 150 ; input: [es:di] points to area to receive aux data : 151 ; : 152 ;---------------------------------------------------------------- 153 ; 154 PUBLIC AUX$RDND 155 AUX$RDND PROC NEAR 156 assume ds:DOSGROUP, es:nothing, ss:nothing 157 ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE 0 000081A9 E85E00 call GETBX ; have BX point to AUXBUF 0 000081AC 8A07 mov AL,[BX] ; copy contents of buffer to AL 0 000081AE 08C0 or AL,AL ; if AL is non-zero (char in buffer) 0 000081B0 7514 jnz AUXRDX ; then return character 0 000081B2 E82600 call AUXSTAT ; if not, get status of AUX device 0 000081B5 F6C401 TEST AH,FLAG_DATA_READY ;TEST DATA READY 0 000081B8 740F jz AUXBUS ; then device is busy (not ready) 165 0 000081BA A820 TEST AL,FLAG_DSR ;TEST DATA SET READY 0 000081BC 740B jz AUXBUS ; then device is busy (not ready) 0 000081BE E8D3FF call AUXIN ; else aux is ready, get character 0 000081C1 E84600 call GETBX ; have bx point to AUXBUF 0 000081C4 8807 mov [BX],AL ; save character in buffer 171 AUXRDX: ; 0 000081C6 E9[0000] Jump RDEXIT ; return character 173 174 AUXBUS: ; 0 000081C9 E9[0000] Jump BUS$EXIT ; jump to device busy exit 176 AUX$RDND ENDP 177 178 ;---------------------------------------------------------------- 179 ; : 180 ; Aux Output Status : 181 ; : 182 ;---------------------------------------------------------------- 183 PUBLIC AUX$WRST 184 AUX$WRST PROC NEAR 185 assume ds:DOSGROUP, es:nothing, ss:nothing 186 ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE 0 000081CC E80C00 call AUXSTAT ; get status of AUX in AX 188 ; now test to see if device is busy 189 ; if this bit is not set, 190 ;;Ver 3.30 modification ----------------------- 0 000081CF A820 TEST AL,FLAG_DSR ;TEST DATA SET READY 0 000081D1 74F6 jz AUXBUS ; then device is busy (not ready) 0 000081D3 F6C420 TEST AH,FLAG_TRANHOL_EMP ;TEST TRANSMIT HOLD REG EMPTY 194 ;;End of modification ------------------------- 0 000081D6 74F1 jz AUXBUS ; then device is busy (not ready) 196 Exit equ EXIT ; NASM port label 0 000081D8 E9[0000] Jump Exit 198 199 AUX$WRST ENDP 200 201 ; 202 ; AUXSTAT makes a call on the ROM-BIOS to determine the status 203 ; of the auxilary device 204 ; Outputs: 205 ; AX is filled with status of port. 206 ; DX is changes to specify which card - either 0, 1 (, 2, 3) ;ba 207 ; NO other registers are modified 208 ; 209 210 AUXSTAT proc near 0 000081DB B403 mov ah,AUXFUNC_STATUS 0 000081DD E80100 call AUXOP 0 000081E0 C3 ret 214 AUXSTAT endp 215 216 AUXOP PROC NEAR 217 ;AH=FUNCTION CODE 218 ;0=INIT, 1=SEND, 2=RECEIVE, 3=STATUS 0 000081E1 E8[0000] call GETDX ; have DX point to proper card 0 000081E4 CD14 int 14h ; call rom-bios for status 0 000081E6 C3 ret 222 AUXOP ENDP 223 224 ;---------------------------------------------------------------- 225 ; : 226 ; Flush AUX Input buffer - set contents of AUXBUF to zero : 227 ; : 228 ;---------------------------------------------------------------- 229 PUBLIC AUX$FLSH 230 AUX$FLSH PROC NEAR 231 assume ds:DOSGROUP, es:nothing, ss:nothing 232 ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE 0 000081E7 E82000 call GETBX ; get BX to point to AUXBUF 0 000081EA C60700 mov BYTE PTR [BX],0 ; zero out buffer 0 000081ED E9[0000] Jump Exit ; all done, successful return 236 AUX$FLSH ENDP 237 238 239 240 ;---------------------------------------------------------------- 241 ; : 242 ; Write to Auxilary Device : 243 ; : 244 ;---------------------------------------------------------------- 245 PUBLIC AUX$WRIT 246 AUX$WRIT PROC NEAR 247 assume ds:DOSGROUP, es:nothing, ss:nothing 248 ; SET BY AUX DEVICE DRIVER ENTRY ROUTINE 0 000081F0 E39F jcxz EXVEC2 ; if CX is zero, no characters 250 ; to be written, jump to exit 251 AUX$LOOP: 0 000081F2 268A05 mov AL,[ES:DI] ; get character to be written 0 000081F5 47 inc DI ; move DI pointer to next character 254 ;;Ver 3.30 modification --------------------------- 0 000081F6 B401 MOV AH,AUXFUNC_SEND ;VALUE=1, INDICATES A WRITE 0 000081F8 E8E6FF CALL AUXOP ;SEND CHARACTER OVER AUX PORT 257 0 000081FB F6C480 TEST AH,FLAG_TIMEOUT ;CHECK FOR ERROR 259 ;;End of modification --------------------------- 0 000081FE 7405 jz AWOK ; then no error 0 00008200 B00A mov AL,10 ; else indicate write fault 0 00008202 E9[0000] Jump ERR$CNT ; call error routines 263 264 ; if CX is non-zero, still more 265 AWOK: 0 00008205 E2EB loop AUX$LOOP ; more characrter to print 0 00008207 E9[0000] Jump Exit ; all done, successful return 268 AUX$WRIT ENDP 269 270 271 ; 272 ; GETBX puts the address of AUXBUF (the Auxilary Device buffer) 273 ; in BX. After calling GETBX, a routine can get to AUXBUF 274 ; with [BX]. 275 ; 276 ; NOTE: The getdx routine is in msbio1 and looks like: 277 ; mov dx,word ptr [cs:auxnum] 278 ; 279 GETBX PROC NEAR 280 assume ds:DOSGROUP, es:nothing, ss:nothing 0 0000820A E8[0000] call GETDX 0 0000820D 89D3 mov BX,DX 0 0000820F 81C3[0000] add BX,OFFSET AUXBUF ; access with ds 0 00008213 C3 ret 285 GETBX ENDP 286 287 ; (no prior section) ; CODE ENDS 288 END === Trace listing source: mslpt.lst 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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; SCCSID = @(#)IBMEXTRN.ASM 1.11 85/11/18 4 <1> ;This is for IBMINIT module. 5 <1> ;======================================================= 6 <1> ;REVISION HISTORY: 7 <1> ;AN000; - NEW Version 4.00. J.K. 8 <1> ;AC000; - Modified Line 4.00. J.K. 9 <1> ;ANxxx; - PTMyyy 10 <1> ;============================================================================== 11 <1> ;AN001; D486 SHARE installation for large media 2/23/88 J.K. 12 <1> ;============================================================================== 13 <1> 14 <1> extern biocode_get_ds_dosentry, biocode_get_es_dosentry 15 <1> extern dosbiocode_get_ds_dosentry, dosbiocode_get_es_dosentry 16 <1> extern biocode_get_ds_dosbiodata, biocode_get_es_dosbiodata 17 <1> EXTRN ORIG13:DWORD,ORIG19:DWORD 18 <1> EXTRN COM2DEV:WORD,COM1DEV:WORD 19 <1> EXTRN COM4DEV:WORD,COM3DEV:WORD 20 <1> EXTRN LPT3DEV:WORD,LPT2DEV:WORD,LPT1DEV:WORD 21 <1> EXTRN HARDDRV:BYTE,HARDNUM:BYTE,DRVMAX:BYTE,HDSKTAB:WORD 22 <1> EXTRN DSKDRVS:WORD,HNUM:BYTE,EOT:BYTE,FHAVE96:BYTE 23 <1> EXTRN REAL13:DWORD,DAYCNT:WORD,CONHEADER:WORD 24 <1> EXTRN TWOHARD:BYTE,INT_2F_NEXT:DWORD 25 <1> EXTRN BDSH:WORD,BDSX:WORD,START_BDS:WORD 26 <1> EXTRN FHAVEK09:BYTE, NEW_ROM:BYTE 27 <1> EXTRN SINGLE:BYTE 28 <1> EXTRN BDSMs:BYTE ;for Mini Disk -J.K. 4/7/86 29 <1> EXTRN HaveCMOSClock:byte ;set by IBMINIT. Used by IBMCLOCK.ASM 30 <1> EXTRN BinToBCD:word ;set by IBMINIT. Used by IBMCLOCK.ASM 31 <1> EXTRN DaycntToDay:word ;set by IBMINIT. Used by IBMCLOCK.ASM 32 <1> EXTRN OLD13:DWORD 33 <1> extrn Temp_H:word ;J.K. For 32 bit calculation. IBMDISK 34 <1> extrn Start_Sec_H:word ;J.K. IBMDISK. 35 <1> extrn KEYRD_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA. 36 <1> extrn KEYSTS_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA. 37 <1> extrn DiskSector:byte ;J.K. IBMBDATA 38 <1> extrn Bpb_In_Sector:word ;J.K. IBMBDATA 39 <1> extrn SecPerClusInSector:Byte ;J.K. IBMBDATA 40 <1> extrn NumberOfFats:byte ;J.K. IBMBDATA 41 <1> extrn MediaByte:byte ;J.K. IBMBDATA 42 <1> extrn Ext_Boot_Sig:Byte ;J.K. IBMBDATA 43 <1> extrn Boot_Serial_L:Word ;J.K. IBMBDATA 44 <1> extrn Boot_Serial_H:Word ;J.K. IBMBDATA 45 <1> extrn Boot_Volume_Label:Byte ;J.K. IBMBDATA 46 <1> extrn Boot_System_ID:Byte ;J.K. IBMBDATA 47 <1> extrn Fat_12_ID:Byte ;J.K. IBMDISK 48 <1> extrn Fat_16_ID:Byte ;J.K. IBMDISK 49 <1> extrn lbapacket:byte 50 <1> extrn Vol_No_Name:Byte ;J.K. IBMDISK 51 <1> extrn MOTORSTARTUP:Byte ;J.K. IBMBDATA 52 <1> extrn DoubleWordMov:Byte ;J.K. IBMDISK 53 <1> extrn Model_Byte:Byte ;J.K. IBMBIO2 54 <1> extrn Secondary_Model_Byte:Byte ;J.K. IBMBIO2 55 <1> 56 <1> %IF itest 57 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD 58 <1> %ENDIF 59 <1> 60 <1> EXTRN START$:NEAR,ERROUT:NEAR,BLOCK13:FAR,INT19:FAR 61 <1> EXTRN INTRET:NEAR,HDRIVE:NEAR,DRIVEX:NEAR,INT13:FAR,CBREAK:NEAR,OUTCHR:NEAR 62 <1> EXTRN DISKRD:NEAR,MEDIA_PATCH:NEAR,GETBP1_PATCH:NEAR 63 <1> EXTRN SET_PATCH:NEAR,DISKIO_PATCH:NEAR,DSKERR:NEAR,INIT_PATCH:NEAR 64 <1> extern DSKERR_PATCH 65 <1> EXTRN TABLE_PATCH:NEAR,EXIT:NEAR,CHANGED_PATCH:NEAR 66 <1> EXTRN ERRIN:NEAR,GETBP:NEAR,SWPDSK:NEAR 67 <1> EXTRN OUTCHR:NEAR,WRMSG:NEAR,TIME_TO_TICKS:NEAR 68 <1> EXTRN INT2F_DISK:NEAR,INSTALL_BDS:NEAR,SETDRIVE:NEAR 69 <1> extrn Mov_Media_IDs:Near ;J.K. 70 <1> extrn Clear_IDs:Near ;J.K. 71 <1> %IF itest 72 <1> EXTRN MSGNUM:NEAR,MSGOUT:NEAR,dumpbytes:near,hex_to_ascii:near 73 <1> EXTRN outchar:near 74 <1> %ENDIF 75 <1> extrn lbatochs:near, chstotuple:near 76 <1> extrn lba_packet_setup:near 77 <1> === Switch to base=00C400h -> "SYSINITSEG" 78 <1> section SYSINITSEG PUBLIC class=INIT 79 <1> ASSUME CS:SYSINITSEG 80 <1> EXTRN behind_dosentry_segment:WORD 81 <1> EXTRN DEVICE_LIST:DWORD 82 <1> EXTRN MEMORY_SIZE:WORD 83 <1> EXTRN DEFAULT_DRIVE:BYTE 84 <1> EXTRN BUFFERS:WORD 85 <1> EXTRN SYSINIT:FAR 86 <1> extrn Big_Media_Flag:Byte ;AN001; 87 <1> ; (no prior section) ; SYSINITSEG ENDS === Switch to base=002450h -> "BIOCODE" 88 <1> section BIOCODE 89 <1> 90 <1> ASSUME CS:BIOCODE 91 <1> 92 <1> ; END OF DISK MODULES FOR CONFIGURATION 93 <1> 94 <1> EXTRN END96TPI:BYTE 95 <1> EXTRN ENDTWOHARD:BYTE 96 <1> EXTRN ENDONEHARD:BYTE 97 <1> EXTRN ENDSWAP:BYTE 98 <1> EXTRN ENDFLOPPY:BYTE 99 <1> 100 <1> ; IBM FIXED UP AT ROM 101 <1> 102 <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 0 00008214 ???? lpSize dw ? 0 00008216 ???? lpCount dw ? 0 00008218 ???????? lpBuffer dd ? 0 0000821C ???????????????? 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 0 00008214 ???????? LINK DD ? ; LINK TO NEXT BDS 0 00008218 ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 00008219 ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 0000821A ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 0000821C ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 0000821D ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 0000821F ?? CFAT DB ? ; NUMBER OF FATS 0 00008220 ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00008222 ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 00008224 ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 00008225 ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 00008227 ???? SECLIM DW ? ; SECTORS PER TRACK 0 00008229 ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 0000822B ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 0000822D ???? HIDSEC_H dw ? ;0 ;J.K.87 0 0000822F ???? DRVLIM_L dw ? ;0 ;J.K.87 0 00008231 ???? DRVLIM_H dw ? ;0 ;J.K.87 0 00008233 ?? FATSIZ DB ? ; FLAGS... 0 00008234 ???? OPCNT DW ? ; OPEN REF. COUNT 0 00008236 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 00008237 ???? FLAGS DW ? ; VARIOUS FLAGS 0 00008239 ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 0000823B ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 0000823D ?? RSECPERCLUS DB ? 0 0000823E ???? RRESSEC DW ? 0 00008240 ?? RCFAT DB ? 0 00008241 ???? RCDIR DW ? 0 00008243 ???? RDRVLIM DW ? 0 00008245 ?? RMEDIAD DB ? 0 00008246 ???? RCSECFAT DW ? 0 00008248 ???? RSECLIM DW ? 0 0000824A ???? RHDLIM DW ? 0 0000824C ???? RHIDSEC_L DW ? 0 0000824E ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 00008250 ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 00008252 ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 00008254 ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 0000825A ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 0000825B ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 0000825D ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 0000826B ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <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 0 00008214 ???? mlink DW ? ;-1 ;Link to next structure 0 00008216 ???? DW ? 0 00008218 ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 00008219 ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 0000821A ???? mBytePerSec DW ? ;512 0 0000821C ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 0000821D ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 0000821F ?? mcFAT DB ? ;2 ;No. of allocation tables 0 00008220 ???? mcDIR DW ? ;16 ;Number of directory entries 0 00008222 ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 00008224 ?? mMediad DB ? ;11111000B ;Media descriptor 0 00008225 ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 00008227 ???? mSECLIM DW ? ;0 ;Sector limit 0 00008229 ???? mHDLIM DW ? ;0 ;Head limit 0 0000822B ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 0000822D ???? mHidsec_H dw ? ;0 ;J.K.87 0 0000822F ???? mDrvlim_L dw ? ;0 ;J.K.87 0 00008231 ???? mDrvlim_H dw ? ;0 ;J.K.87 0 00008233 ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 00008234 ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 00008236 ?? mFormFactor DB ? ;3 ;Form Factor 0 00008237 ???? mFLAGS DW ? ;0020H ;Various Flags 0 00008239 ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 0000825A ?? mTrack db ? ;-1 0 0000825B ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 0000825D ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 0000826A ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 0000826B ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 0000826F ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 00008277 ?? 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 0 00008214 ???? SECSIZE DW ? 0 00008216 ?? SECALL DB ? 0 00008217 ???? RESNUM DW ? 0 00008219 ?? FATNUM DB ? 0 0000821A ???? DIRNUM DW ? 0 0000821C ???? SECNUM DW ? 0 0000821E ?? FATID DB ? 0 0000821F ???? FATSIZE DW ? 0 00008221 ???? SLIM DW ? 0 00008223 ???? HLIM DW ? 0 00008225 ???? HIDDEN_L DW ? 0 00008227 ???? HIDDEN_H dw ? ;0 ;J.K. 0 00008229 ???? SECNUM_L dw ? ;0 ;J.K. 0 0000822B ???? 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> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <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 0 00008214 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 00008218 ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 0000821A ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 0000821C ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 0000821E ???????????????? 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 0 00008214 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00008215 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00008216 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00008217 ???? REQSTAT DW ? ;STATUS WORD 0 00008219 ???????????????? 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 <1> DB (SRHEAD_struc_size) DUP(?) 157 <1> ; GENERIC IOCTL ADDITION. 0 00008221 ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00008222 ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00008223 ???? REG_SI DW ? 0 00008225 ???? REG_DI DW ? 0 00008227 ???????? 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 0 00008214 ???????? SECTOR_RBA DD ? ; relative block address 0 00008218 ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 0000821A ???????? 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 0 00008214 ???? MEDIA_level DW ? ; info level 0 00008216 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <1> MEDIA_Label DB 11 dup (?) ;volume label 0 00008225 ???????????????? 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 0 00008214 ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 00008216 ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 00008217 ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 00008219 ?? BPFTCNT DB ? ; NUMBER OF FATS 0 0000821A ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 0000821C ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 0000821E ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 0000821F ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <2> BPBLOCK ENDS 20 <2> 21 <2> A_BPB STRUC 0 00008214 ???? BPB_BYTESPERSECTOR DW ? 0 00008216 ?? BPB_SECTORSPERCLUSTER DB ? 0 00008217 ???? BPB_RESERVEDSECTORS DW ? 0 00008219 ?? BPB_NUMBEROFFATS DB ? 0 0000821A ???? BPB_ROOTENTRIES DW ? 0 0000821C ???? BPB_TOTALSECTORS DW ? 0 0000821E ?? BPB_MEDIADESCRIPTOR DB ? 0 0000821F ???? BPB_SECTORSPERFAT DW ? 0 00008221 ???? BPB_SECTORSPERTRACK DW ? 0 00008223 ???? BPB_HEADS DW ? 0 00008225 ???? BPB_HIDDENSECTORS DW ? 0 00008227 ???? DW ? 0 00008229 ???? BPB_BIGTOTALSECTORS DW ? 0 0000822B ???? DW ? 0 0000822D ???????????? 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 0 00008214 ???? ST_SECTORNUMBER DW ? 0 00008216 ???? ST_SECTORSIZE DW ? 113 <1> A_SECTORTABLE ENDS 114 <1> 115 <1> A_DEVICEPARAMETERS STRUC 0 00008214 ?? DP_SPECIALFUNCTIONS DB ? 0 00008215 ?? DP_DEVICETYPE DB ? 0 00008216 ???? DP_DEVICEATTRIBUTES DW ? 0 00008218 ???? DP_CYLINDERS DW ? 0 0000821A ?? DP_MEDIATYPE DB ? 121 00000007 <1> DP_BPB DB A_BPB_struc_size DUP (?) 0 0000823A ???? DP_TRACKTABLEENTRIES DW ? 123 00000028 <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 0 00008214 ?? TRWP_SPECIALFUNCTIONS DB ? 0 00008215 ???? TRWP_HEAD DW ? 0 00008217 ???? TRWP_CYLINDER DW ? 0 00008219 ???? TRWP_FIRSTSECTOR DW ? 0 0000821B ???? TRWP_SECTORSTOREADWRITE DW ? 0 0000821D ???????? 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 0 00008214 ?? FP_SPECIALFUNCTIONS DB ? 0 00008215 ???? FP_HEAD DW ? 0 00008217 ???? FP_CYLINDER DW ? 0 00008219 ???? FP_TRACKCOUNT DW ? ;1 141 <1> A_FORMATPACKET ENDS 142 <1> 143 <1> A_VERIFYPACKET STRUC 0 00008214 ?? VP_SPECIALFUNCTIONS DB ? 0 00008215 ???? VP_HEAD DW ? 0 00008217 ???? VP_CYLINDER DW ? 147 <1> A_VERIFYPACKET ENDS 148 <1> 149 <1> A_MEDIA_ID_INFO STRUC 0 00008214 ???? MI_LEVEL DW ? ;0 ;J.K. 87 Info. level 0 00008216 ???????? MI_SERIAL DD ? ;J.K. 87 Serial # 152 00000006 <1> MI_LABEL DB 11 DUP (?) ;(' ') ;J.K. 87 volume label 0 00008225 ???????????????? 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. 0 00008214 ?? DAC_SPECIALFUNCTIONS DB ? ;0 ;AN002; Always 0 0 00008215 ?? 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 0 00008214 ???? 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 0 00008214 E31A jcxz Prn$Done ;No char to output 61 Prn$Loop: 0 00008216 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 0 00008219 268A05 mov al,[es:di] ; assume AX disposible since enter 0 0000821C 30E4 xor ah,ah ; via int 21h 79 PrnOp equ PRNOP ; NASM port label 0 0000821E E82400 call PrnOp ; print to printer 0 00008221 740A jz Prn$Con ; no error - continue 0 00008223 F6C401 test ah,TIMEOUTSTATUS 0 00008226 7405 jz Prn$Con ; NOT time out - continue 84 85 ;SB34LPT000**************************************************************** 0 00008228 4B dec bx ;Retry until count is exhausted. 0 00008229 75EE jnz Prn$Out ;Retry it. 0 0000822B EB06 jmp short Pmessg ;Return with error. 89 ; 90 ; next character 91 ; 92 Prn$Con: 0 0000822D 47 inc di ;point to next char and continue 0 0000822E E2E6 loop Prn$Loop 95 Prn$Done: 96 Exit equ EXIT ; NASM port label 0 00008230 E9[0000] jmp Exit 98 Pmessg: 99 Err$Cnt equ ERR$CNT ; NASM port label 0 00008233 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 0 00008236 E80A00 CALL PRNSTAT ;DEVICE IN DX 132 PMESSG equ Pmessg ; NASM port label 0 00008239 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 0 0000823B F6C480 TEST AH,NOTBUSYSTATUS 0 0000823E 75F0 jnz Prn$Done ;No error. Exit 0 00008240 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********************************************************************** 0 00008243 B402 mov AH, 2 ; set command for get status ;SB ;3.30* 149 PRNOP: ;SB ;3.30* 0 00008245 E8[0000] call GETDX ; determine which printer ;SB ;3.30* 0 00008248 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 0 0000824A F6C408 TEST AH,IOERRSTATUS ; I/O ERROR? 0 0000824D 740A JZ CHECKNOTREADY ; NO, TRY NOT READY 161 162 ; AT THIS POINT, WE KNOW WE HAVE AN ERROR. THE CONVERSE IS NOT TRUE. 163 0 0000824F B009 MOV AL,9 ; FIRST, ASSUME OUT OF PAPER 0 00008251 F6C420 TEST AH,NOPAPERSTATUS ; OUT OF PAPER SET? 0 00008254 7502 JNZ .RET1 ; YES, ERROR IS SET 0 00008256 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 0 00008258 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: 0 00008259 B002 MOV AL,2 ; ASSUME NOT-READY 0 0000825B F6C401 TEST AH,TIMEOUTSTATUS ; IS TIME-OUT SET? 180 ; IF NZ THEN ERROR, ELSE OK??? 181 PRNOP2: 0 0000825E 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 0 0000825F 1E PUSH DS 0 00008260 06 PUSH ES 0 00008261 1F POP DS ; NOW ES AND DS BOTH POINT TO SOURCE BUFFER 199 ASSUME DS:NOTHING 200 0 00008262 89FE MOV SI,DI ; EVERYTHING IS SET FOR LODSB 202 PRN$TILBLOOP: 0 00008264 51 PUSH CX 0 00008265 53 PUSH BX 0 00008266 31DB XOR BX,BX 0 00008268 1E push ds 0 00008269 E8[0000] call biocode_get_ds_dosbiodata 208 assume ds:DOSGROUP 0 0000826C 8A1E[0000] MOV BL,[PRINTDEV] 0 00008270 D1E3 SHL BX,1 0 00008272 8B8F[0000] MOV CX,[WAIT_COUNT + BX] ; WAIT COUNT TIMES TO COME READY 0 00008276 1F pop ds 213 assume ds:nothing 0 00008277 5B POP BX 215 PRN$GETSTAT: 0 00008278 E8C8FF CALL PRNSTAT ; GET STATUS 0 0000827B 7520 JNZ PRN$BPERR ; ERROR 0 0000827D F6C480 TEST AH,10000000B ; READY YET? 0 00008280 E1F6 LOOPZ PRN$GETSTAT ; NO, GO FOR MORE 0 00008282 59 POP CX ; GET ORIGINAL COUNT 0 00008283 7419 JZ PRN$BERR ; STILL NOT READY => DONE 0 00008285 AC LODSB 0 00008286 30E4 XOR AH,AH 0 00008288 E8BAFF CALL PRNOP 0 0000828B 7511 JNZ PRN$BERR ; ERROR 0 0000828D E2D5 LOOP PRN$TILBLOOP ; GO FOR MORE 227 PRN$B: 0 0000828F 1F POP DS 229 assume ds:DOSGROUP 0 00008290 E8[0000] call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 231 assume ds:DOSENTRYGROUP 0 00008293 C51E[0000] lds bx, [PTRSAV] 233 ASSUME DS:NOTHING 0 00008297 294F12 SUB WORD PTR [BX + COUNT],CX ;# OF SUCCESSFUL I/O'S 0 0000829A E9[0000] JMP EXIT 236 PRN$TILBUSY ENDP 237 238 PRN$BPERR PROC NEAR 239 assume ds:nothing 0 0000829D 59 POP CX 241 PRN$BERR: 0 0000829E 1F POP DS 243 assume ds:DOSGROUP 0 0000829F E8[0000] call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 245 assume ds:DOSENTRYGROUP 0 000082A2 C51E[0000] lds bx, [PTRSAV] 247 ASSUME DS:NOTHING 248 0 000082A6 294F12 SUB WORD PTR [BX + COUNT],CX ;# OF SUCCESSFUL I/O'S 0 000082A9 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 0 000082AC E8[0000] call biocode_get_ds_dosentry 263 assume ds:DOSENTRYGROUP 0 000082AF C43E[0000] LES DI,[PTRSAV] 265 assume es:nothing 0 000082B3 26807D0D05 CMP byte [ES:DI + MAJORFUNCTION],IOC_PC 0 000082B8 7403 JE PRNFUNC_OK 268 PRNFUNCERR: 0 000082BA E9[0000] JMP CMDERR 270 271 PRNFUNC_OK: 0 000082BD 268A450E MOV AL,[ES:DI + MINORFUNCTION] 0 000082C1 26C47D13 LES DI,[ES:DI + GENERICIOCTL_PACKET] 274 assume es:nothing 0 000082C5 E8[0000] call biocode_get_ds_dosbiodata 276 assume ds:DOSGROUP 0 000082C8 31DB XOR BX,BX 0 000082CA 8A1E[0000] MOV BL,[PRINTDEV] ; GET INDEX INTO RETRY COUNTS 0 000082CE D1E3 SHL BX,1 0 000082D0 8B8F[0000] MOV CX,[WAIT_COUNT + BX] ; PULL OUT RETRY COUNT FOR DEVICE 0 000082D4 3C65 CMP AL,GET_RETRY_COUNT 0 000082D6 7407 JZ PRNGETCOUNT 0 000082D8 3C45 CMP AL,SET_RETRY_COUNT 0 000082DA 75DE JNZ PRNFUNCERR 0 000082DC 268B0D MOV CX,[ES:DI + RC_COUNT] 286 PRNGETCOUNT: 0 000082DF 898F[0000] MOV [WAIT_COUNT + BX],CX ; PLACE "NEW" RETRY COUNT 0 000082E3 26890D MOV [ES:DI + RC_COUNT],CX ; RETURN CURRENT RETRY COUNT 289 prn_exit: 0 000082E6 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 0 000082E9 E8[0000] call biocode_get_ds_dosentry 297 assume ds:DOSENTRYGROUP 0 000082EC C53E[0000] lds di, [PTRSAV] 299 assume ds:nothing 0 000082F0 807D0D05 CMP byte [di + MAJORFUNCTION],IOC_PC 0 000082F4 75C4 jne PRNFUNCERR 0 000082F6 8A450E mov al, [di + MINORFUNCTION] 0 000082F9 3C65 cmp al, GET_RETRY_COUNT 0 000082FB 74E9 je prn_exit 0 000082FD 3C45 cmp al, SET_RETRY_COUNT 0 000082FF 74E5 je prn_exit 0 00008301 EBB7 jmp PRNFUNCERR 308 309 ; (no prior section) ; CODE ENDS 310 END === Trace listing source: msclock.lst 1 ; TITLE MSCLOCK - DOS 3.3 2 ;---------------------------------------------------------------- 3 ; : 4 ; CLOCK DEVICE DRIVER : 5 ; : 6 ; : 7 ; This file contains the Clock Device Driver. : 8 ; : 9 ; The routines in this files are: : 10 ; : 11 ; routine function : 12 ; ------- -------- : 13 ; TIM$WRIT Set the current time : 14 ; TIM$READ Read the current time : 15 ; Time_To_Ticks Convert time to corresponding : 16 ; number of clock ticks : 17 ; : 18 ; The clock ticks at the rate of: : 19 ; : 20 ; 1193180/65536 ticks/second (about 18.2 ticks per second): 21 ; See each routine for information on the use. : 22 ; : 23 ;---------------------------------------------------------------- 24 25 26 itest equ 0 27 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 1 <2> [list -] 1 ****************** <2> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <3> [list -] 14 <2> [list -] 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 28 %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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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 29 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 30 %include "ddataseg.nas" 1 <1> 2 <1> %include "lmacros3.mac" 1 <2> [list -] 3 <1> === Switch to base=000E10h -> "DOSSTART" 4 <1> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <1> ; (no prior section) ; DOSSTART ENDS 6 <1> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <1> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <1> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <1> === Switch to base=000E10h -> "CONSTANTS" 10 <1> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <1> ; (no prior section) ; CONSTANTS ENDS 12 <1> === Switch to base=000E10h -> "DATA" 13 <1> addsection DATA, align=2 PUBLIC class=DATA 14 <1> ; (no prior section) ; DATA ENDS 15 <1> === Switch to base=000E10h -> "TABLE" 16 <1> addsection TABLE, align=2 PUBLIC class=TABLE 17 <1> ; (no prior section) ; TABLE ENDS 18 <1> === Switch to base=000E10h -> "DOSDATATABLE" 19 <1> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <1> ; (no prior section) ; DOSDATATABLE ENDS 21 <1> === Switch to base=000E10h -> "DOSDATACODE" 22 <1> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <1> ; (no prior section) ; DOSDATACODE ENDS 24 <1> === Switch to base=000E10h -> "DOSBIODATA" 25 <1> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <1> === Switch to base=000E10h -> "LAST" 27 <1> addsection LAST, align=16 PUBLIC class=LAST 28 <1> ; (no prior section) ; LAST ENDS 29 <1> 30 <1> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <1> 32 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 31 === Switch to base=000E10h -> "DOSBIODATA" 32 usesection DOSBIODATA 33 34 EXTRN EXIT:NEAR 35 ; 36 ; DAYCNT is the number of days since 1-1-80. 37 ; Each time the clock is read it is necessary to check if another day has 38 ; passed. The ROM only returns the day rollover once so if it is missed 39 ; the time will be off by a day. 40 ; 41 EXTRN DAYCNT:WORD ;MSDATA 42 43 extern HaveCMOSClock 44 extern base_century 45 extern base_year 46 extern month_tab 47 48 === Switch to base=002450h -> "BIOCODE" 49 addsection BIOCODE 50 51 extern near_bin_to_bcd 52 extern near_daycnt_to_day 53 extern near_time_to_ticks 54 55 ;-------------------------------------------------------------------- 56 ; 57 ; Settime sets the current time 58 ; 59 ; On entry [ES:DI] has the current time: 60 ; 61 ; number of days since 1-1-80 (WORD) 62 ; minutes (0-59) (BYTE) 63 ; hours (0-23) (BYTE) 64 ; hundredths of seconds (0-99) (BYTE) 65 ; seconds (0-59) (BYTE) 66 ; 67 ; Each number has been checked for the correct range. 68 ; 69 PUBLIC TIM$WRIT 70 TIM$WRIT PROC NEAR 71 assume ds:DOSGROUP, es:nothing, ss:nothing 0 00008304 268B05 mov AX,WORD PTR [ES:DI] 0 00008307 50 push AX ;DAYCNT. We need to set this at the very 74 ; end to avoid tick windows. 75 ;;Rev 3.30 Modification 0 00008308 803E[0000]00 cmp byte [HaveCMOSClock], 0 0 0000830D 7423 je No_CMOS_1 0 0000830F 268A4503 mov al,[es:di+3] ;get binary hours 0 00008313 E8[0000] call near_bin_to_bcd ;convert to BCD 0 00008316 88C5 mov ch,al ;CH = BCD hours 0 00008318 268A4502 mov al,[es:di+2] ;get binary minutes 0 0000831C E8[0000] call near_bin_to_bcd ;convert to BCD 0 0000831F 88C1 mov cl,al ;CL = BCD minutes 0 00008321 268A4505 mov al,[es:di+5] ;get binary seconds 0 00008325 E8[0000] call near_bin_to_bcd ;convert to BCD 0 00008328 88C6 mov dh,al ;DH = BCD seconds 0 0000832A B200 mov dl,0 ;DL = 0 (ST) or 1 (DST) 0 0000832C FA cli ;turn off timer 0 0000832D B403 mov ah,03h ;set RTC time 0 0000832F CD1A int 1Ah ;call rom bios clock routine 0 00008331 FB sti 92 93 ;;End of Modification 94 No_CMOS_1: 0 00008332 268B4D02 mov CX,WORD PTR [ES:DI+2] 0 00008336 268B5504 mov DX,WORD PTR [ES:DI+4] 97 ;;Rev 3.30 Modification 0 0000833A E81D00 call near_time_to_ticks ; convert time to ticks 99 ;CX:DX now has time in ticks 0 0000833D FA cli ; Turn off timer 0 0000833E B401 mov AH, 1 ; command is set time in clock 0 00008340 CD1A int 1Ah ; call rom-bios clock routines 0 00008342 8F06[0000] pop word [DAYCNT] 0 00008346 FB sti 105 ;CMOS clock ------------------------------------- 0 00008347 803E[0000]00 cmp byte [HaveCMOSClock], 0 0 0000834C 7409 je No_CMOS_2 0 0000834E E8[0000] call near_daycnt_to_day 0 00008351 FA cli ; Turn off timer 0 00008352 B405 mov AH,05h ; set RTC date 0 00008354 CD1A int 1Ah ; call rom-bios clock routines 0 00008356 FB sti 113 ;------------------------------------------------ 114 115 No_CMOS_2: 0 00008357 E9[0000] jmp EXIT 117 TIM$WRIT ENDP 118 ;;End of Modification 119 120 121 ; 122 ; convert time to ticks 123 ; input : time in CX and DX 124 ; ticks returned in CX:DX 125 ; 126 near_time_to_ticks PROC near 127 128 ; first convert from Hour,min,sec,hund. to 129 ; total number of 100th of seconds 0 0000835A B03C mov AL,60 0 0000835C F6E5 mul CH ;Hours to minutes 0 0000835E B500 mov CH,0 0 00008360 01C8 add AX,CX ;Total minutes 0 00008362 B97017 mov CX,6000 ;60*100 0 00008365 89D3 mov BX,DX ;Get out of the way of the multiply 0 00008367 F7E1 mul CX ;Convert to 1/100 sec 0 00008369 89C1 mov CX,AX 0 0000836B B064 mov AL,100 0 0000836D F6E7 mul BH ;Convert seconds to 1/100 sec 0 0000836F 01C1 add CX,AX ;Combine seconds with hours and min. 0 00008371 83D200 adc DX,0 ;Ripple carry 0 00008374 B700 mov BH,0 0 00008376 01D9 add CX,BX ;Combine 1/100 sec 0 00008378 83D200 adc DX,0 145 146 ;;Rev 3.30 Modification 147 ;DX:CX IS TIME IN 1/100 SEC 0 0000837B 92 XCHG AX,DX 0 0000837C 91 XCHG AX,CX ;NOW TIME IS IN CX:AX 0 0000837D BB0BE9 MOV BX,59659 0 00008380 F7E3 MUL BX ;MULTIPLY LOW HALF 0 00008382 87D1 XCHG DX,CX 0 00008384 92 XCHG AX,DX ;CX->AX, AX->DX, DX->CX 0 00008385 F7E3 MUL BX ;MULTIPLY HIGH HALF 0 00008387 01C8 ADD AX,CX ;COMBINE OVERLAPPING PRODUCTS 0 00008389 83D200 ADC DX,0 0 0000838C 92 XCHG AX,DX ;AX:DX=TIME*59659 0 0000838D BB0500 MOV BX,5 0 00008390 F6F3 DIV BL ;DIVIDE HIGH HALF BY 5 0 00008392 88C1 MOV CL,AL 0 00008394 B500 MOV CH,0 0 00008396 88E0 MOV AL,AH ;REMAINDER OF DIVIDE-BY-5 0 00008398 98 CBW 0 00008399 92 XCHG AX,DX ;USE IT TO EXTEND LOW HALF 0 0000839A F7F3 DIV BX ;DIVDE LOW HALF BY 5 0 0000839C 89C2 MOV DX,AX 167 ; CX:DX is now number of ticks in time 0 0000839E C3 ret 169 near_time_to_ticks ENDP 170 ;;End of Modification 171 172 173 ; 174 ; Gettime reads date and time 175 ; and returns the following information: 176 ; 177 ; [ES:DI] =count of days since 1-1-80 178 ; [ES:DI+2]=hours 179 ; [ES:DI+3]=minutes 180 ; [ES:DI+4]=seconds 181 ; [ES:DI+5]=hundredths of seconds 182 ; 183 PUBLIC TIM$READ 184 TIM$READ PROC NEAR 185 assume ds:DOSGROUP, es:nothing, ss:nothing 186 ; read the clock 0 0000839F 30E4 xor AH, AH ; set command to read clock 0 000083A1 CD1A int 1Ah ; call rom-bios to get time 189 0 000083A3 08C0 or al,al ; check for a new day 0 000083A5 7404 jz noroll1 ; if al=0 then don't reset day count 0 000083A7 FF06[0000] INC word [DAYCNT] ; CATCH ROLLOVE 193 noroll1: 0 000083AB 8B36[0000] MOV SI,[DAYCNT] 195 196 ; 197 ; we now need to convert the time in tick to the time in 100th of 198 ; seconds. The relation between tick and seconds is: 199 ; 200 ; 65536 seconds 201 ; ---------------- 202 ; 1,193,180 tick 203 ; 204 ; To get to 100th of second we need to multiply by 100. The equation is: 205 ; 206 ; Ticks from clock * 65536 * 100 207 ; --------------------------------- = time in 100th of seconds 208 ; 1,193,180 209 ; 210 ; Fortunately this fromula simplifies to: 211 ; 212 ; Ticks from clock * 5 * 65,536 213 ; --------------------------------- = time in 100th of seconds 214 ; 59,659 215 ; 216 ; The calculation is done by first multipling tick by 5. Next we divide by 217 ; 59,659. In this division we multiply by 65,536 by shifting the dividend 218 ; my 16 bits to the left. 219 ; 220 ; start with ticks in CX:DX 221 ; multiply by 5 0 000083AF 89C8 MOV AX,CX 0 000083B1 89D3 MOV BX,DX 0 000083B3 D1E2 SHL DX,1 0 000083B5 D1D1 RCL CX,1 ;TIMES 2 0 000083B7 D1E2 SHL DX,1 0 000083B9 D1D1 RCL CX,1 ;TIMES 4 0 000083BB 01DA ADD DX,BX 0 000083BD 11C8 ADC AX,CX ;TIMES 5 0 000083BF 92 XCHG AX,DX 231 232 233 ; now have ticks * 5 in DX:AX 234 ; we now need to multiply by 65,536 and divide by 59659 d. 235 0 000083C0 B90BE9 mov CX,59659 ; get divisor 0 000083C3 F7F1 div CX 238 ; DX now has remainder 239 ; AX has high word of final quotient 0 000083C5 89C3 mov BX,AX ; put high work if safe place 0 000083C7 31C0 xor AX,AX ; this is the multiply by 65536 0 000083C9 F7F1 div CX ; BX:AX now has time in 100th of seconds 243 244 ; 245 ;Rounding based on the remainder may be added here 246 ;The result in BX:AX is time in 1/100 second. 0 000083CB 89DA mov DX,BX 0 000083CD B9C800 mov CX,200 ;Extract 1/100's 249 ;Division by 200 is necessary to ensure no overflow--max result 250 ;is number of seconds in a day/2 = 43200. 0 000083D0 F7F1 div CX 0 000083D2 80FA64 cmp DL,100 ;Remainder over 100? 0 000083D5 7203 jb NOADJ 0 000083D7 80EA64 sub DL,100 ;Keep 1/100's less than 100 255 NOADJ: 0 000083DA F5 cmc ;If we subtracted 100, carry is now set 0 000083DB 88D3 mov BL,DL ;Save 1/100's 258 ;To compensate for dividing by 200 instead of 100, we now multiply 259 ;by two, shifting a one in if the remainder had exceeded 100. 0 000083DD D1D0 rcl AX,1 0 000083DF B200 mov DL,0 0 000083E1 D1D2 rcl DX,1 0 000083E3 B93C00 mov CX,60 ;Divide out seconds 0 000083E6 F7F1 div CX 0 000083E8 88D7 mov BH,DL ;Save the seconds 0 000083EA F6F1 div CL ;Break into hours and minutes 0 000083EC 86C4 xchg AL,AH 268 269 ;Time is now in AX:BX (hours, minutes, seconds, 1/100 sec) 270 0 000083EE 50 push AX 0 000083EF 89F0 MOV AX,SI ; DAYCNT 0 000083F1 AB stosw 0 000083F2 58 pop AX 0 000083F3 AB stosw 0 000083F4 89D8 mov AX,BX 0 000083F6 AB stosw 0 000083F7 E9[0000] jmp EXIT 279 280 TIM$READ ENDP 281 ; (no prior section) ; CODE ENDS 282 END 283 284 === Trace listing source: msdisk.lst 1 ; PAGE ,132 ; 2 ; TITLE MSDISK - BIOS 3 %warning out: ...MSDISK.ASM 3 ****************** warning: out: ...MSDISK.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; d24 Multi Track enable/disable command in CONFIG.SYS 6/27/87 J.K. 12 ;AN002; d9 Double word MOV instruction 7/1/87 J.K. 13 ;AN003: d25 Change DASD ERP to that recommended by Storage systems 7/28/87 J.K. 14 ;AN004; D113 Disable I/O access to unformatted media 9/03/87 J.K. 15 ;AN005; P985 Allow I/O access to unformatted media 9/14/87 J.K. 16 ;AN006; P1535 Disallow I/O access to unformatted media. 10/15/87 J.K. 17 ; (Give the user to control this - Generic IOCTL subfunction 64h/44h 18 ;AN007; p2828 Do not retry for multi-track format request 12/08/87 J.K. 19 ;AC008; p3197 Should reset change line after BPB set in BDS table 01/21/88 J.K. 20 ;AN009; p3349 Should retry at hard file timeout error 02/03/88 J.K. 21 ;AN010; p4696 ECC error handler should cover PC ATs for CMC disks 05/04/88 J.K. 22 ;AN011; p5034 Possible virgin hard file problem with direct INT 13 06/03/88 J.K. 23 ;AN012; P5049 Attempt to write at DISK BASE table in ROM BIOS 06/06/88 J.K. 24 ;AN013; P5055 Diskcopy fails (Regression of P5049) 06/09/88 J.K. 25 ;============================================================================== 26 27 ;for testing, set itest to 1. So as MSBIO1.ASM. 28 itest equ 0 29 EXTRN NUMERR:ABS ;MSDATA 30 31 %include "ddataseg.nas" 1 <1> 2 <1> %include "lmacros3.mac" 1 <2> [list -] 1 ****************** <2> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <3> [list -] 14 <2> [list -] 3 <1> === Switch to base=000E10h -> "DOSSTART" 4 <1> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <1> ; (no prior section) ; DOSSTART ENDS 6 <1> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <1> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <1> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <1> === Switch to base=000E10h -> "CONSTANTS" 10 <1> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <1> ; (no prior section) ; CONSTANTS ENDS 12 <1> === Switch to base=000E10h -> "DATA" 13 <1> addsection DATA, align=2 PUBLIC class=DATA 14 <1> ; (no prior section) ; DATA ENDS 15 <1> === Switch to base=000E10h -> "TABLE" 16 <1> addsection TABLE, align=2 PUBLIC class=TABLE 17 <1> ; (no prior section) ; TABLE ENDS 18 <1> === Switch to base=000E10h -> "DOSDATATABLE" 19 <1> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <1> ; (no prior section) ; DOSDATATABLE ENDS 21 <1> === Switch to base=000E10h -> "DOSDATACODE" 22 <1> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <1> ; (no prior section) ; DOSDATACODE ENDS 24 <1> === Switch to base=000E10h -> "DOSBIODATA" 25 <1> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <1> === Switch to base=000E10h -> "LAST" 27 <1> addsection LAST, align=16 PUBLIC class=LAST 28 <1> ; (no prior section) ; LAST ENDS 29 <1> 30 <1> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <1> 32 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 1 <3> [list -] 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 32 %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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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 33 %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 0 000083FA ???? lpSize dw ? 0 000083FC ???? lpCount dw ? 0 000083FE ???????? lpBuffer dd ? 0 00008402 ???????????????? 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 0 000083FA ???????? LINK DD ? ; LINK TO NEXT BDS 0 000083FE ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 000083FF ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 00008400 ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 00008402 ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 00008403 ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 00008405 ?? CFAT DB ? ; NUMBER OF FATS 0 00008406 ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00008408 ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 0000840A ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 0000840B ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 0000840D ???? SECLIM DW ? ; SECTORS PER TRACK 0 0000840F ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 00008411 ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 00008413 ???? HIDSEC_H dw ? ;0 ;J.K.87 0 00008415 ???? DRVLIM_L dw ? ;0 ;J.K.87 0 00008417 ???? DRVLIM_H dw ? ;0 ;J.K.87 0 00008419 ?? FATSIZ DB ? ; FLAGS... 0 0000841A ???? OPCNT DW ? ; OPEN REF. COUNT 0 0000841C ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 0000841D ???? FLAGS DW ? ; VARIOUS FLAGS 0 0000841F ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 00008421 ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 00008423 ?? RSECPERCLUS DB ? 0 00008424 ???? RRESSEC DW ? 0 00008426 ?? RCFAT DB ? 0 00008427 ???? RCDIR DW ? 0 00008429 ???? RDRVLIM DW ? 0 0000842B ?? RMEDIAD DB ? 0 0000842C ???? RCSECFAT DW ? 0 0000842E ???? RSECLIM DW ? 0 00008430 ???? RHDLIM DW ? 0 00008432 ???? RHIDSEC_L DW ? 0 00008434 ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 00008436 ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 00008438 ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 0000843A ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 00008440 ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 00008441 ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 00008443 ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 00008451 ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <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 0 000083FA ???? mlink DW ? ;-1 ;Link to next structure 0 000083FC ???? DW ? 0 000083FE ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 000083FF ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 00008400 ???? mBytePerSec DW ? ;512 0 00008402 ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 00008403 ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 00008405 ?? mcFAT DB ? ;2 ;No. of allocation tables 0 00008406 ???? mcDIR DW ? ;16 ;Number of directory entries 0 00008408 ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 0000840A ?? mMediad DB ? ;11111000B ;Media descriptor 0 0000840B ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 0000840D ???? mSECLIM DW ? ;0 ;Sector limit 0 0000840F ???? mHDLIM DW ? ;0 ;Head limit 0 00008411 ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 00008413 ???? mHidsec_H dw ? ;0 ;J.K.87 0 00008415 ???? mDrvlim_L dw ? ;0 ;J.K.87 0 00008417 ???? mDrvlim_H dw ? ;0 ;J.K.87 0 00008419 ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 0000841A ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 0000841C ?? mFormFactor DB ? ;3 ;Form Factor 0 0000841D ???? mFLAGS DW ? ;0020H ;Various Flags 0 0000841F ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 00008440 ?? mTrack db ? ;-1 0 00008441 ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 00008443 ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 00008450 ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 00008451 ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 00008455 ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 0000845D ?? 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 0 000083FA ???? SECSIZE DW ? 0 000083FC ?? SECALL DB ? 0 000083FD ???? RESNUM DW ? 0 000083FF ?? FATNUM DB ? 0 00008400 ???? DIRNUM DW ? 0 00008402 ???? SECNUM DW ? 0 00008404 ?? FATID DB ? 0 00008405 ???? FATSIZE DW ? 0 00008407 ???? SLIM DW ? 0 00008409 ???? HLIM DW ? 0 0000840B ???? HIDDEN_L DW ? 0 0000840D ???? HIDDEN_H dw ? ;0 ;J.K. 0 0000840F ???? SECNUM_L dw ? ;0 ;J.K. 0 00008411 ???? 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 34 %include "pushpop.mac" 1 <1> ; NASM original macros 2 <1> 3 <1> %unimacro stripangles 2.nolist 4 <1> %assign ?stackdepth 0 5 <1> 6 <1> %imacro stripangles 2.nolist 7 <1> %defstr %%param %2 8 <1> %rep 16 9 <1> %substr %%opening %%param 1 10 <1> %ifidn %%opening, '<' 11 <1> %substr %%param %%param 2,-1 12 <1> %endif 13 <1> %endrep 14 <1> %rep 16 15 <1> %strlen %%length %%param 16 <1> %substr %%closing %%param %%length 17 <1> %ifidn %%closing, '>' 18 <1> %substr %%param %%param 1,-2 19 <1> %endif 20 <1> %endrep 21 <1> %deftok %%token %%param 22 <1> %1 %%token 23 <1> %endmacro 24 <1> 25 <1> ;BREAK 26 <1> 27 <1> %imacro SaveReg 0-*.nolist ;; push those registers 28 <1> %rep %0 29 <1> %assign ?stackdepth ?stackdepth + 1 30 <1> stripangles push, %1 31 <1> %rotate 1 32 <1> %endrep 33 <1> %endmacro 34 <1> ;.xcref SaveReg 35 <1> 36 <1> ;BREAK 37 <1> 38 <1> %imacro RestoreReg 0-*.nolist ;; pop those registers 39 <1> %rep %0 40 <1> %assign ?stackdepth ?stackdepth - 1 41 <1> stripangles pop, %1 42 <1> %rotate 1 43 <1> %endrep 44 <1> %endmacro 45 <1> ;.xcref RestoreReg 35 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 36 %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 0 000083FA ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 000083FE ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 00008400 ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 00008402 ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 00008404 ???????????????? 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 0 000083FA ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 000083FB ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 000083FC ?? REQFUNC DB ? ;TYPE OF REQUEST 0 000083FD ???? REQSTAT DW ? ;STATUS WORD 0 000083FF ???????????????? 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 <1> DB (SRHEAD_struc_size) DUP(?) 157 <1> ; GENERIC IOCTL ADDITION. 0 00008407 ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00008408 ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00008409 ???? REG_SI DW ? 0 0000840B ???? REG_DI DW ? 0 0000840D ???????? 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 0 000083FA ???????? SECTOR_RBA DD ? ; relative block address 0 000083FE ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 00008400 ???????? 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 0 000083FA ???? MEDIA_level DW ? ; info level 0 000083FC ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <1> MEDIA_Label DB 11 dup (?) ;volume label 0 0000840B ???????????????? 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 37 %include "msdskpr.mac" 1 <1> ; The following structure defines the disk parameter table 2 <1> ; pointed to by Interrupt vector 1EH (location 0:78H) 3 <1> 4 <1> DISK_PARMS STRUC 0 000083FA ?? DISK_SPECIFY_1 DB ? 0 000083FB ?? DISK_SPECIFY_2 DB ? 0 000083FC ?? DISK_MOTOR_WAIT DB ? ; Wait till motor off 0 000083FD ?? DISK_SECTOR_SIZ DB ? ; Bytes/Sector (2 = 512) 0 000083FE ?? DISK_EOT DB ? ; Sectors per track (MAX) 0 000083FF ?? DISK_RW_GAP DB ? ; Read Write Gap 0 00008400 ?? DISK_DTL DB ? 0 00008401 ?? DISK_FORMT_GAP DB ? ; Format Gap Length 0 00008402 ?? DISK_FILL DB ? ; Format Fill Byte 0 00008403 ?? DISK_HEAD_STTL DB ? ; Head Settle Time (MSec) 0 00008404 ?? DISK_MOTOR_STRT DB ? ; Motor start delay 16 <1> DISK_PARMS ENDS 17 <1> 18 <1> ROMStatus equ 1 19 <1> ROMRead equ 2 20 <1> ROMWrite equ 3 21 <1> ROMVerify equ 4 22 <1> ROMFormat equ 5 38 %include "biostruc.mac" 1 <1> %warning out: BIOSTRUC.INC... 1 ****************** <1> warning: out: BIOSTRUC.INC... [-w+user] 2 <1> ; SCCSID = @(#)BIOSTRUC.INC 1.0 86/09/30 3 <1> ; ROM BIOS CALL PACKET STRUCTURES 4 <1> 5 <1> ;******************************* 6 <1> ;System Service call ( Int 15h ) 7 <1> ;******************************* 8 <1> ;Function AH = 0C0h, Return system configuration 9 <1> ;For PC and PCJR on return: 10 <1> ; (AH) = 80h 11 <1> ; (CY) = 1 12 <1> ;For PCXT, PC PORTABLE and PCAT on return: 13 <1> ; (AH) = 86h 14 <1> ; (CY) = 1 15 <1> ;For all others: 16 <1> ; (AH) = 0 17 <1> ; (CY) = 0 18 <1> ; (ES:BX) = pointer to system descriptor vector in ROS 19 <1> ; System descriptor : 20 <1> ; DW xxxx length of descriptor in bytes, 21 <1> ; minimum length = 8 22 <1> ; DB xx model byte 23 <1> ; 0FFh = PC 24 <1> ; 0FEh = PC/XT, Portable 25 <1> ; 0FDh = PC/JR 26 <1> ; 0FCh = PC/AT, 6Mhz PC/AT, 27 <1> ; 6Mhz PC/AT running coprocessor(?), 28 <1> ; PS/2 Model 50, 50 z 29 <1> ; 0FAh = PS/2 Model 25, 30 30 <1> ; 0F9h = PC Convertible 31 <1> ; 0F8h = PS/2 Model 80 32 <1> ; 0F7h = Nova 33 <1> ; 0E0 thru 0EFh = reserved 34 <1> ; 35 <1> ; DB xx secondary model byte 36 <1> ; 000h = PC1 37 <1> ; 000h = PC/XT, Portable 38 <1> ; 000h = PC/JR 39 <1> ; 000h = PC/AT 40 <1> ; 001h = 6Mhz PC/AT 41 <1> ; 003h = 6Mhz PC/AT running coprocessor(?) 42 <1> ; 004h = PS/2 Model 50, 50z 43 <1> ; 001h = PS/2 Model 25 44 <1> ; 000h = PC Convertible 45 <1> ; 000h = PS/2 Model 80 46 <1> ; 000h = Nova 47 <1> ; 48 <1> ; DB xx bios revision level 49 <1> ; 00 for first release, subsequent release 50 <1> ; of code with same model byte and 51 <1> ; secondary model byte require revison level 52 <1> ; to increase by one. 53 <1> ; 54 <1> ; DB xx feature information byte 1 55 <1> ; X0000000 = 1, bios use DMA channel 3 56 <1> ; = 0, DMA channel 3 not used 57 <1> ; 58 <1> ; 0X000000 = 1, 2nd Interrupt chip present 59 <1> ; = 0, 2nd Interrupt chip not present 60 <1> ; 61 <1> ; 00X00000 = 1, Real Time Clock present 62 <1> ; = 0, Real Time Clock not present 63 <1> ; 64 <1> ; 000X0000 = 1, Keyboard escape sequence(INT15h) 65 <1> ; called in keyboard interrupt 66 <1> ; (Int 09h). 67 <1> ; = 0, Keyboard escape sequence not 68 <1> ; called. 69 <1> ; 0000XXXX reserved 70 <1> ; 71 <1> ; DB xx feature information byte 2 - reserved 72 <1> ; 73 <1> ; DB xx feature information byte 2 - reserved 74 <1> ; 75 <1> ; DB xx feature information byte 2 - reserved 76 <1> ; 77 <1> ; DB xx feature information byte 2 - reserved 78 <1> ; 79 <1> 80 <1> BIOS_SYSTEM_DESCRIPTOR struc 0 000083FA ???? bios_SD_leng dw ? 0 000083FC ?? bios_SD_modelbyte db ? 0 000083FD ?? bios_SD_scnd_modelbyte db ? 0 000083FE ?? db ? 0 000083FF ?? bios_SD_featurebyte1 db ? 0 00008400 ???????? db 4 dup (?) 87 <1> BIOS_SYSTEM_DESCRIPTOR ends 88 <1> 89 <1> ;FeatureByte1 bit map equates 90 <1> DMAchannel3 equ 10000000b 91 <1> ScndIntController equ 01000000b 92 <1> RealTimeClock equ 00100000b 93 <1> KeyEscapeSeq equ 00010000b 94 <1> ; 95 <1> ;Model Byte 96 <1> MDL_PC1 EQU 0FFH 97 <1> MDL_XT EQU 0FEH 98 <1> MDL_JR EQU 0FDH 99 <1> MDL_AT EQU 0FCH 100 <1> MDL_CONVERT EQU 0F9H 101 <1> 102 <1> mdl_ps2_30 equ 0fah 103 <1> mdl_ps2_80 equ 0f8h 39 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 40 %include "lmacros2.mac" 1 <1> [list -] 41 42 extern biocode_get_ds_dosentry, biocode_get_es_dosentry 43 extern biocode_get_ds_dosbiodata 44 extern biocode_get_es_dosbiodata 45 46 EXTRN INT2F_DISK:FAR ;MSBIO2 47 EXTRN MEDIACHECK:NEAR ;96TPI 48 EXTRN HASCHANGE:NEAR ;96TPI 49 EXTRN MEDIA_SET_VID:NEAR ;96TPI 50 EXTRN HIDENSITY:NEAR ;96TPI 51 EXTRN CHECKLATCHIO:NEAR ;96TPI 52 EXTRN CHECKIO:NEAR ;96TPI 53 EXTRN SET_CHANGED_DL:NEAR ;96TPI 54 EXTRN SET_VOLUME_ID:NEAR ;MSVOLID 55 EXTRN SWPDSK:NEAR ;MSBIO2 56 EXTRN CMDERR:NEAR ;MSBIO1 57 EXTRN STRATEGY:NEAR ;MSBIO1 58 EXTRN ERR$CNT:NEAR ;MSBIO1 59 EXTRN DSK$IN:NEAR ;MSBIO1 60 EXTRN EXIT:NEAR ;MSBIO1 61 EXTRN BUS$EXIT:NEAR ;MSBIO1 62 EXTRN ERR$EXIT:NEAR ;MSBIO1 63 extrn ResetChanged:near ;AN000; MS96TPI 64 65 ;DATA 66 EXTRN OLD13:DWORD ;MSBIO2 67 EXTRN PTRSAV:DWORD ;MSBIO1 68 EXTRN COM1DEV:WORD ;MSAUX 69 EXTRN DAYCNT:WORD ;MSCLOCK 70 EXTRN TIM_DRV:BYTE ;MSDATA 71 EXTRN ACCESSCOUNT:BYTE ;MSDATA 72 EXTRN SM92:BYTE ;MSDATA 73 EXTRN DISKSECTOR:BYTE ;MSDATA 74 EXTRN MEDIABYTE:BYTE ;MSDATA 75 EXTRN SECPERCLUSINSECTOR:BYTE ;MSDATA 76 EXTRN BPB_IN_SECTOR:WORD ;MSDATA 77 EXTRN DISKSECTOR:BYTE ;MSDATA 78 EXTRN STEP_DRV:BYTE ;MSDATA 79 EXTRN START_BDS:WORD ;MSDATA 80 EXTRN PHYS_DRV:BYTE ;MSDATA 81 EXTRN WRTVERIFY:WORD ;MSDATA 82 EXTRN FSETOWNER:BYTE ;MSDATA 83 EXTRN SINGLE:BYTE ;MSDATA 84 EXTRN RFLAG:BYTE ;MSDATA 85 EXTRN MEDBYT:BYTE ;MSDATA 86 EXTRN SPSAV:WORD ;MSDATA 87 EXTRN SECCNT:WORD ;MSDATA 88 EXTRN DPT:DWORD ;MSDATA 89 EXTRN CURSEC:BYTE,CURHD:BYTE ;MSDATA 90 EXTRN CURTRK:WORD ;MSDATA 91 EXTRN EOT:BYTE ;MSDATA 92 EXTRN MOTORSTARTUP:BYTE,SETTLECURRENT:BYTE,SETTLESLOW:BYTE ;MSDATA 93 EXTRN CURHD:BYTE ;MSDATA 94 EXTRN LSTERR:BYTE ;MSDATA 95 EXTRN ERRIN:BYTE,ERROUT:BYTE ;MSDATA 96 EXTRN PREVOPER:WORD ;MSDATA 97 EXTRN ORIG13:DWORD ;MSDATA 98 EXTRN FLAGBITS:WORD ;MSDATA 99 EXTRN NUMBER_OF_SEC:BYTE ;MSDATA 100 EXTRN FHAVE96:BYTE ;MSDATA 101 EXTRN NEW_ROM:BYTE ;MSDATA 102 EXTRN FORMT_EOT:BYTE,HDNUM:BYTE,TRKNUM:WORD,GAP_PATCH:BYTE ;MSDATA 103 EXTRN NEXT2F_13:WORD ;MSDATA 104 extrn Save_head_sttl:byte ;msbdata 105 extrn Secrete_Code:word ;msbdata J.K. 11/7/86 Secrete code for DOS 3.3 MSBIO 106 extrn Ext_Boot_Sig:byte ;AN000; msbdata 107 extrn Boot_Serial_L:word ;AN000; msbdata 108 extrn Boot_Serial_H:word ;AN000; msbdata 109 extrn Boot_Volume_Label:byte ;AN000; msbdata 110 extrn Boot_System_ID:byte ;AN000; msbdata 111 extrn Model_Byte:Byte ;MSBIO2 112 extrn Secondary_Model_Byte:Byte ;MSBIO2 113 114 ;----------------------------------------------------------------- 115 ; 116 ; DISK INTERFACE ROUTINES 117 ; 118 ; DEVICE ATTRIBUTE BITS: 119 ; BIT 6 - GET/SET MAP FOR LOGICAL DRIVES AND GENERIC IOCTL. 120 ; 121 122 MAXERR equ 5 123 LSTDRV equ 504H 124 125 ; SOME FLOPPIES DO NOT HAVE CHANGELINE. AS A RESULT, MEDIA-CHECK WOULD 126 ; NORMALLY RETURN I-DON'T-KNOW, THE DOS WOULD CONTINUALLY REREAD THE FAT, AND 127 ; DISCARD CACHED DATA. WE OPTIMIZE THIS BY IMPLEMENTING A LOGICAL DOOR- 128 ; LATCH: IT IS PHYSICALLY IMPOSSIBLE TO CHANGE A DISK IN UNDER 2 SECONDS. WE 129 ; RETAIN THE TIME OF THE LAST SUCCESSFUL DISK OPERATION AND COMPARE IT WITH 130 ; THE CURRENT TIME DURING MEDIA-CHECK. IF < 2 SECONDS AND AT LEAST 1 TIMER 131 ; TICK HAS PASSED, THE WE SAY NO CHANGE. IF > 2 SECONDS THEN WE SAY I- 132 ; DON'T-KNOW. FINALLY, SINCE WE CANNOT TRUST THE TIMER TO BE ALWAYS 133 ; AVAILABLE, WE RECORD THE NUMBER OF MEDIA CHECKS THAT HAVE OCCURRED WHEN NO 134 ; APPARENT TIME HAS ELAPSED. WHILE THIS NUMBER IS < A GIVEN THRESHOLD, WE SAY 135 ; NO CHANGE. WHEN IT EXCEEDS THAT THRESHOLD, WE SAY I-DON'T-KNOW AND RESET 136 ; THE COUNTER TO 0. WHEN WE STORE THE TIME OF LAST SUCCESSFUL ACCESS, IF WE 137 ; SEE THAT TIME HAS PASSED TOO, WE RESET THE COUNTER. 138 ; 139 ACCESSMAX equ 5 140 ; 141 ; DUE TO VARIOUS BOGOSITIES, WE NEED TO CONTINUALLY ADJUST WHAT THE HEAD 142 ; SETTLE TIME IS. THE FOLLOWING ALGORITHM IS USED: 143 ; 144 ; GET THE CURRENT HEAD SETTLE VALUE. 145 ; IF IT IS 0, THEN 146 ; SET SLOW = 15 147 ; ELSE 148 ; SET SLOW = VALUE 149 ; ... 150 ;********************************************* 151 ;************ OLD ALGORITHM ****************** 152 ;* IF WE ARE SEEKING AND WRITING THEN 153 ;* USE SLOW 154 ;* ELSE 155 ;* USE FAST 156 ;********************************************* 157 ;*********** IBM'S REQUESTED LOGIC *********** 158 ; IF WE ARE SEEKING AND WRITING AND NOT ON AN AT THEN 159 ; USE SLOW 160 ; ELSE 161 ; USE FAST 162 ; ... 163 ; RESTORE CURRENT HEAD SETTLE VALUE 164 ; 165 166 === Switch to base=002450h -> "BIOCODE" 167 section BIOCODE 168 169 public Fat_12_ID 0 000083FA 464154313220202000 Fat_12_ID DB "FAT12 ",0 ;AN000; Default System ID for floppy. 171 public Fat_16_ID 0 00008403 464154313620202000 Fat_16_ID DB "FAT16 ",0 ;AN000; 173 public Vol_No_Name 0 0000840C 4E4F204E414D452020 Vol_No_Name db "NO NAME ",0 ;AN000; 0 00008415 202000 175 176 === Switch to base=000000h -> "DOSENTRY" 177 section DOSENTRY 178 179 MULTRK_ON EQU 10000000B ;User spcified Mutitrack=on, or System turns 180 ; it on after handling CONFIG.SYS file as a 181 ; default value, if MulTrk_flag = MULTRK_OFF1. 182 MULTRK_OFF1 EQU 00000000B ;initial value. No "Multitrack=" command entered. 183 MULTRK_OFF2 EQU 00000001B ;User specified Multitrack=off. 184 185 extern Set_ID_Flag, Saved_Word 186 extern VRetry_Cnt, Soft_ECC_Cnt, MultiTrk_Format_Flag 187 188 extern lbapacket 189 extern Temp_H 190 extern Start_Sec_H 191 extern MulTrk_Flag 192 extern EC35_Flag 193 194 === Switch to base=002450h -> "BIOCODE" 195 section BIOCODE 196 197 PUBLIC MEDIA$CHK 198 MEDIA$CHK PROC NEAR 199 assume ds:nothing, es:nothing, ss:nothing 200 MESSAGE FTESTDISK,<"DISK MEDIA CHECK "> 201 MNUM FTESTDISK,AX 202 MESSAGE FTESTDISK, 0 00008418 E8E803 CALL SETDRIVE 204 assume ds:UPB 0 0000841B 7303E9[0000] jc DSK$UNKNOWN 206 0 00008420 1E push ds 0 00008421 E8[0000] call biocode_get_ds_dosentry ; Secrete_Code in DOSENTRY 209 assume ds:DOSENTRYGROUP 0 00008424 813E[0000]6B6A cmp word [Secrete_Code], 'kj' ;J.K.11/7/86 Secrete code for DOS 3.3 IBMBIO. ; NASM port swapped text literals 0 0000842A 1F pop ds 212 assume ds:UPB 213 media$done equ MEDIA$DONE ; NASM port label 0 0000842B 7553 jne media$done ;J.K.11/7/86 215 216 ; FOR NON-REMOVABLE DISKS ONLY RETURN CHANGED IF CHANGED BY FORMAT, OTHERWISE 217 ; RETURN 'NOT CHANGED'. 0 0000842D BE0100 MOV SI,1 ; ASSUME NO CHANGE 0 00008430 F745230001 TEST WORD PTR [DI + FLAGS],FCHANGED_BY_FORMAT 0 00008435 741B JZ WEARENOTFAKINGIT 0 00008437 816523FFFE AND WORD PTR [DI + FLAGS],~ FCHANGED_BY_FORMAT ; RESET FLAG 222 ; IF MEDIA HAS BEEN CHANGED BY FORMAT, WE MUST ASK THE ROM. CANNOT RELY ON THE 223 ; 2 SECOND TIME CHECK. 0 0000843C 1E push ds 0 0000843D E8[0000] call biocode_get_ds_dosbiodata 226 assume ds:DOSGROUP 0 00008440 C606[0000]FF MOV byte [TIM_DRV],-1 ; ENSURE THAT WE ASK THE ROM IF MEDIA 228 ; HAS CHANGED 0 00008445 1F pop ds 230 assume ds:UPB 0 00008446 F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 0000844B 740C JZ WEHAVEAFLOPPY 0 0000844D BEFFFF MOV SI,-1 ; INDICATE MEDIA CHANGED 0 00008450 EB2E JMP SHORT MEDIA$DONE 235 ; 236 ; WE NEED TO RETURN 'NOT CHANGED' IF WE HAVE A HARD FILE. 237 ; 238 WEARENOTFAKINGIT: 239 assume ds:UPB, es:nothing, ss:nothing 0 00008452 F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 00008457 7527 JNZ MEDIA$DONE 242 WEHAVEAFLOPPY: 0 00008459 31F6 XOR SI,SI ; PRESUME "I DON'T KNOW" 244 ; 245 ; IF WE HAVE A FLOPPY WITH CHANGELINE SUPPORT, WE ASK THE ROM TO DETERMINE IF 246 ; MEDIA HAS CHANGED. WE DO NOT PERFORM THE 2 SECOND CHECK FOR THESE DRIVES. 247 ;----------------------------------------| 248 ; WARNING: DO NOT CHANGE THE FOLLOWING. ;| 249 ; IT GETS PATCHED IN MSINIT ;| 0 0000845B E80D15 call ispatched 0 0000845E 720A jc @F 252 PUBLIC MEDIA_PATCH ;| 253 MEDIA_PATCH: ;| 0 00008460 E8[0000] CALL MEDIACHECK ;| 0 00008463 7241 JC ERR$EXITJ ;| 0 00008465 E8[0000] CALL HASCHANGE ;| 0 00008468 7516 JNZ MEDIA$DONE ;| 258 @@: 259 ;----------------------------------------| 260 ; IF WE COME HERE, WE HAVE A FLOPPY WITH NO CHANGELINE SUPPORT 0 0000846A BE0100 MOV SI,1 ; PRESUME NO CHANGE 0 0000846D 1E push ds 0 0000846E E8[0000] call biocode_get_ds_dosbiodata 264 assume ds:DOSGROUP 0 00008471 A0[0000] MOV AL,[TIM_DRV] ; LAST DRIVE ACCESSED 0 00008474 1F pop ds 267 assume ds:UPB 0 00008475 3A4504 CMP AL,BYTE PTR [DI + DRIVENUM] ;IS DRIVE OF LAST ACCESS THE SAME? 0 00008478 7505 JNZ MEDIA$UNK ; NO, THEN "I DON'T KNOW" 270 ; 271 ; CHECK TO SEE IF THIS DRIVE HAS BEEN ACCESSED IN THE LAST 2 SECONDS. 0 0000847A E82F00 CALL CHECK_TIME_OF_ACCESS ; SETS SI CORRECTLY 0 0000847D EB01 JMP SHORT MEDIA$DONE 274 275 MEDIA$UNK: 0 0000847F 4E DEC SI ; RETURN "I DON'T KNOW" 277 ; 278 ; SI NOW CONTAINS THE CORRECT VALUE FOR MEDIA CHANGE. CLEAN UP THE LEFT OVERS 279 ; 280 MEDIA$DONE: 0 00008480 E8[0000] call biocode_get_es_dosentry ; PTRSAV in DOSENTRY 282 assume es:DOSENTRYGROUP 0 00008483 26C41E[0000] LES BX,[es:PTRSAV] ; GET ORIGINAL PACKET 284 assume es:nothing 0 00008488 2689770E MOV WORD PTR [ES:BX + TRANS],SI 0 0000848C 85F6 test SI,SI 0 0000848E 7803 JS INIT_PATCH_before 0 00008490 E9[0000] JMP EXIT 289 MEDIA$CHK ENDP 290 ;----------------------------------------| 291 ; WARNING: DO NOT CHANGE THE FOLLOWING. ;| 292 ; IT GETS PATCHED IN MSINIT ;| 293 INIT_PATCH_before: 0 00008493 E8D514 call ispatched 0 00008496 7203 jc @F 296 PUBLIC INIT_PATCH ;| 297 INIT_PATCH PROC NEAR ;| 0 00008498 E8[0000] CALL MEDIA_SET_VID ;| 299 @@: 300 ;----------------------------------------| 0 0000849B E8[0000] call biocode_get_ds_dosbiodata 302 assume ds:DOSGROUP 0 0000849E C606[0000]FF MOV byte [TIM_DRV], -1 ; MAKE SURE WE ASK ROM FOR MEDIA CHECK 304 VOLIDOK: 0 000084A3 E9[0000] JMP EXIT 306 INIT_PATCH ENDP 307 308 ERR$EXITJ PROC NEAR 309 assume ds:nothing, es:nothing, ss:nothing 310 311 MESSAGE FTESTCOM,<"ERR$EXITJ: "> 312 MNUM FTESTCOM,AX 313 MESSAGE FTESTCOM,<" == "> 0 000084A6 E8FE09 CALL MAPERROR 315 MNUM FTESTCOM,AX 316 MESSAGE FTESTCOM, 0 000084A9 E9[0000] JMP ERR$EXIT 318 ERR$EXITJ ENDP 319 320 ; 321 ; PERFORM A CHECK ON THE TIME PASSED SINCE THE LAST ACCESS FOR THIS PHYSICEL 322 ; DRIVE. 323 ; WE ARE ACCESSING THE SAME DRIVE. IF THE TIME OF LAST SUCCESSFUL ACCESS WAS 324 ; LESS THAN 2 SECONDS AGO, THEN WE MAY PRESUME THAT THE DISK WAS NOT CHANGED. 325 ; RETURNS IN SI: 326 ; 0 - IF TIME OF LAST ACCESS WAS >= 2 SECONDS 327 ; 1 - IF TIME WAS < 2 SECONDS (I.E NO MEDIA CHANGE ASSUMED) 328 ; REGISTERS AFFECTED AX,CX,DX, FLAGS. 329 ; 330 CHECK_TIME_OF_ACCESS PROC NEAR 331 PUBLIC CHECK_TIME_OF_ACCESS 332 assume ds:UPB 333 0 000084AC BE0100 MOV SI,1 ; PRESUME NO CHANGE. 335 ;SB33014************************************************************* 0 000084AF 30E4 xor AH,AH ; set command to read time 0 000084B1 CD1A int 1Ah ; call rom-bios clock routine 338 ;SB33014************************************************************* 339 ; 340 ; NOW THAT WE ARE READING THE TIME, WE MUST MAKE SURE THAT WE DO NOT LOSE A 341 ; DATE WRAP. THE ROM WILL RETURN THE VALUE ONLY ONCE, SO WE NEED TO NOTE THIS 342 ; FACT. 343 ; 0 000084B3 06 push es 0 000084B4 E8[0000] call biocode_get_es_dosbiodata 346 assume es:DOSGROUP 0 000084B7 D0E8 SHR AL,1 0 000084B9 268316[0000]00 ADC word [es:DAYCNT],0 ; ADD IT IN TO OUR REMEMBERED DAY COUNT 349 ; 350 ; COMPUTE ELAPSED TIME 351 ; 0 000084BF 8B4547 MOV AX,WORD PTR [DI + TIM_LO] ; GET STORED TIME 0 000084C2 29C2 SUB DX,AX 0 000084C4 8B4549 MOV AX,WORD PTR [DI + TIM_HI] 0 000084C7 19C1 SBB CX,AX 356 ; 357 ; CX:DX IS THE ELAPSED TIME 358 ; 0 000084C9 751D JNZ TIMECHECK_UNK ; CX <> 0 => > 1 HOUR 0 000084CB 85D2 test DX,DX ; TIME MUST PASS 0 000084CD 7514 JNZ TIMEPASSED ; YES, EXAMINE MAX VALUE 362 ; 363 ; NO NOTICEABLE TIME HAS PASSED. WE CANNOT TRUST THE COUNTER TO BE ALWAYS 364 ; AVAILABLE AS THERE ARE BOGUS PROGRAMS THAT GO AND REPROGRAM THE THING. WE 365 ; KEEP A COUNT OF THE NUMBER OF MEDIA CHECKS THAT WE'VE SEEN THAT DO NOT HAVE 366 ; ANY TIME PASSING. IF WE EXCEED A GIVE THRESHOLD, WE GIVE UP ON THE TIMER. 367 ; 0 000084CF 26FE06[0000] INC BYTE [es:ACCESSCOUNT] 0 000084D4 26803E[0000]05 CMP BYTE [es:ACCESSCOUNT],ACCESSMAX 0 000084DA 720D JB TIMECHECK_RET ; IF COUNT IS LESS THAN THRESHOLD, OK 0 000084DC 26FE0E[0000] DEC BYTE [es:ACCESSCOUNT] ; DON'T LET THE COUNT WRAP 0 000084E1 EB05 JMP SHORT TIMECHECK_UNK ; "I DON'T KNOW" IF MEDIA CHANGED 373 ; 374 ; 18.2 TICS PER SECOND. 375 ; 376 TIMEPASSED: 0 000084E3 83FA24 CMP DX,18 * 2 ; MIN ELAPSED TIME? 0 000084E6 7601 JBE TIMECHECK_RET ; YES, PRESUME NO CHANGE 379 ; 380 ; EVERYTHING INDICATES THAT WE DO NOT KNOW WHAT HAS HAPPENED. 381 ; 382 TIMECHECK_UNK: 0 000084E8 4E DEC SI ; PRESUME I DON'T KNOW 384 TIMECHECK_RET: 0 000084E9 07 pop es 386 assume es:nothing 0 000084EA C3 RET 388 CHECK_TIME_OF_ACCESS ENDP 389 0 000084EB EBB9 ERR$EXITJ2: JMP ERR$EXITJ 391 ; 392 ; BUILD A VALID BPB FOR THE DISK IN THE DRIVE. 393 ; 394 PUBLIC GET$BPB 395 GET$BPB PROC NEAR 396 assume ds:DOSGROUP, es:nothing, ss:nothing 397 MESSAGE FTESTDISK,<"DISK BUILD BPB "> 398 MNUM FTESTDISK,AX 399 MESSAGE FTESTDISK, 0 000084ED 268A25 MOV AH,BYTE PTR [ES:DI] ;GET FAT ID BYTE READ BY DOS 0 000084F0 E81003 CALL SETDRIVE ; GET THE CORRECT BDS FOR THE DRIVE 402 assume ds:UPB 0 000084F3 7303E9[0000] jc DSK$UNKNOWN 0 000084F8 F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 000084FD 752B JNZ ALREADY_GOTBPB ; NO NEED TO BUILD FOR FIXED DISKS 406 ;J.K. Let's set the default value for VOLID,Vol_Serial,FileSys_ID in BDS table 0 000084FF E84200 call Clear_IDs ;AN000; 0 00008502 1E push ds 0 00008503 E8[0000] call biocode_get_ds_dosbiodata 410 assume ds:DOSGROUP 0 00008506 C606[0000]01 mov byte [Set_ID_Flag],1 ;AN000; Indicate to set system id in BDS 0 0000850B 1F pop ds 413 assume ds:UPB 0 0000850C E86E00 CALL GETBP ;BUILD A BPB IF NECESSARY. 0 0000850F 72DA JC ERR$EXITJ2 ;AN000; If error, Set_ID_flag is set to 0 already. 0 00008511 1E push ds 0 00008512 E8[0000] call biocode_get_ds_dosbiodata 418 assume ds:DOSGROUP 0 00008515 803E[0000]02 cmp byte [Set_ID_Flag],2 ;AN000; Already, volume_Label set from Boot record 0 0000851A C606[0000]00 mov byte [Set_ID_Flag],0 ;AN000; to BDS table? 0 0000851F 1F pop ds 422 assume ds:UPB 423 Already_GotBPB equ ALREADY_GOTBPB ; NASM port label 0 00008520 7408 je Already_GotBPB ;AN000; Then do not set it again from Root directory. 425 ;AN000; Otherwise, conventional Boot record. 426 GET$BPB ENDP 427 ;----------------------------------------| 428 ; WARNING: DO NOT CHANGE THE FOLLOWING. ;| 429 ; IT GETS PATCHED IN MSINIT ;| 0 00008522 E84614 call ispatched 0 00008525 7203 jc @F 432 PUBLIC SET_PATCH ;| 433 SET_PATCH PROC NEAR ;| 0 00008527 E8[0000] CALL SET_VOLUME_ID ;| 435 @@: 436 ;----------------------------------------| 437 MESSAGE FTESTDISK,<"SET VOLUME ID"> 438 MNUM FTESTDISK,DI 439 MESSAGE FTESTDISK,<" "> 440 MNUM FTESTDISK,DS 441 MESSAGE FTESTDISK, 442 443 ALREADY_GOTBPB: 0 0000852A 83C706 ADD DI,BYTEPERSEC ; RETURN THE BPB THAT IS IN THE CURRENT BDS 445 446 PUBLIC SETPTRSAV 447 SETPTRSAV: ; RETURN POINT FOR DSK$INIT 448 assume ds:nothing, es:nothing, ss:nothing 0 0000852D E8[0000] call biocode_get_es_dosentry ; PTRSAV in DOSENTRY 450 assume es:DOSENTRYGROUP 0 00008530 26C41E[0000] LES BX,[es:PTRSAV] 452 assume es:nothing 0 00008535 2688670D MOV [ES:BX + MEDIA],AH 0 00008539 26897F12 MOV [ES:BX + COUNT],DI 0 0000853D 268C5F14 MOV [ES:BX + COUNT + 2],DS 0 00008541 E9[0000] JMP EXIT 457 SET_PATCH ENDP 458 459 ;J.K. Clear IDs in BDS table. Only applied for Floppies. 460 ;Input: DS:DI -> BDS table 461 ;Output: VOLID set to "NO NAME " 462 ; VOL_SERIAL set to 0. 463 ; FileSys_ID set to "FAT12 " or "FAT16 " 464 ; depending on the flag FATSIZE in BDS. 465 ;All registers saved. 466 public Clear_IDs 467 Clear_IDs proc near ;AN000; 468 assume ds:UPB, es:nothing, ss:nothing 0 00008544 1E push ds ;AN000; 0 00008545 57 push di ;AN000; 0 00008546 06 push es ;AN000; 0 00008547 56 push si ;AN000; 0 00008548 51 push cx ;AN000; 474 0 00008549 31C9 xor cx, cx ;AN000; no serial number 0 0000854B 894D57 mov word ptr [di + VOL_SERIAL],cx ;AN000; 0 0000854E 894D59 mov word ptr [di + VOL_SERIAL + 2],cx ;AN000; 478 0 00008551 1E push ds ;AN000; 0 00008552 07 pop es ;AN000; es -> bds 481 assume es:UPB 0 00008553 0E push cs ;AN000; get => DOSCODE 0 00008554 1F pop ds ;AN000; ds = cs => BIOCODE / DOSCODE 484 assume ds:DOSCODEGROUP 485 0 00008555 B10B mov cl, BOOT_VOLUME_LABEL_SIZE ;AN000; =11 487 VOL_NO_NAME equ Vol_No_Name ; NASM port label 0 00008557 BE[1200] mov si, offset VOL_NO_NAME ;AN000; 0 0000855A 57 push di ;AN000; save BDS pointer 0 0000855B 83C74B add di, VOLID ;AN000; points to VOLID field 0 0000855E F3A4 rep movsb ;AN000; 0 00008560 5F pop di ;AN000; restore BDS pointer 0 00008561 26F6451F40 test byte [es:di + FATSIZ], FBIG ;AN000; 0 00008566 7505 jnz CI_BigFat ;AN000; small fat 495 FAT_12_ID equ Fat_12_ID ; NASM port label 0 00008568 BE[0000] mov si, offset FAT_12_ID ;AN000; 0 0000856B EB03 jmp CI_Filesys ;AN000; 498 499 CI_BigFat: ;AN000; 500 FAT_16_ID equ Fat_16_ID ; NASM port label 0 0000856D BE[0900] mov si, offset FAT_16_ID ;AN000; big fat 502 CI_Filesys: ;AN000; 0 00008570 B108 mov cl, BOOT_SYSTEM_ID_SIZE ;AN000; =8 504 FILESYS_ID equ FILESYS_Id ; NASM port equate 0 00008572 83C75B add di, FILESYS_ID ;AN000; points to FILESYS_ID field 0 00008575 F3A4 rep movsb ;AN000; 507 0 00008577 59 pop cx ;AN000; 0 00008578 5E pop si ;AN000; 0 00008579 07 pop es ;AN000; 511 assume es:nothing 0 0000857A 5F pop di ;AN000; 0 0000857B 1F pop ds ;AN000; 514 assume ds:UPB 0 0000857C C3 ret ;AN000; 516 Clear_IDs endp ;AN000; 517 518 519 ; GETBP - RETURN BPB FROM THE DRIVE SPECIFIED BY THE BDS. 520 ; IF THE RETURN_FAKE_BPB FLAG IS SET, THEN IT DOES NOTHING. 521 ; NOTE THAT WE NEVER COME HERE FOR FIXED DISKS. 522 ; FOR ALL OTHER CASES, 523 ; - IT READS BOOT SECTOR TO PULL OUT THE BPB 524 ; - IF NO VALID BPB IS FOUND, IT THEN READS THE FAT SECTOR, 525 ; TO GET THE FAT ID BYTE TO BUILD THE BPB FROM THERE. 526 ; 527 ; INPUTS: DS:DI POINT TO CORRECT BDS. 528 ; 529 ; OUTPUTS: FILLS IN BPB IN CURRENT BDS IF VALID BPB OR FAT ID ON DISK. 530 ; CARRY SET, AND AL=7 IF INVALID DISK. 531 ; CARRY SET AND ERROR CODE IN AL IF OTHER ERROR. 532 ; If failed to recognize the Boot Record, then will set the 533 ; Set_ID_Flag to 0. 534 ; J.K. This routine will only work for a floppy diskette. 535 ; For a fixed disk, it will just return. 536 537 PUBLIC GETBP 538 GETBP PROC NEAR 539 assume ds:UPB, es:nothing, ss:nothing 540 ; IF RETURNING FAKE BPB THEN RETURN BPB AS IS. 0 0000857D F745230500 TEST WORD PTR [DI + FLAGS],RETURN_FAKE_BPB | FNON_REMOVABLE 0 00008582 7403 JZ GETBP1 0 00008584 E9F700 JMP GETRET_EXIT 544 545 GETBP1: 546 MESSAGE FTESTDISK,<"BUILDING BPB FROM SCRATCH",CR,LF> 0 00008587 51520653 SAVEREG 548 ; 549 ; ATTEMPT TO READ IN BOOT SECTOR AND DETERMINE BPB. 550 ; WE ASSUME THAT THE 2.X AND GREATER DOS DISKS ALL HAVE A VALID BOOT SECTOR. 551 ; 552 RDBOOT: 0 0000858B E80F01 CALL READBOOTSEC 554 assume es:DOSENTRYGROUP 555 GETBP_ERR_RET_brdg equ Getbp_err_ret_brdg ; NASM port label 0 0000858E 7264 JC GETBP_ERR_RET_brdg ; CARRY SET IF THERE WAS ERROR. 0 00008590 83FB00 CMP BX,0 ; BX IS 0 IF BOOT SECTOR IS VALID. 0 00008593 7562 JNZ DOFATBPB 559 560 ; MOVES THE BPB READ FROM THE BOOT SECTOR INTO REGISTERS FOR USE BY 561 ; GETBP ROUTINE AT HAS1 562 ;J.K.- 563 ; If the Set_ID_Flag is 1, and if an extended Boot Record, then set Volume 564 ; Serial Number, Volume Label, File System ID in BDS according to 565 ; the BOOT reocrd. After that, this routine will set the Set_ID_Flag to 2 566 ; to signal that VOLUME Label is set already from the Extended BOOT record 567 ; (so, don't set it again by calling "SET_VOLUME_ID" routine which uses 568 ; the volume label in the root directory. 569 570 ; CALL MOVBPB ; MOVE BPB INTO REGISTERS. 571 ;MOVBPB PROC NEAR 0 00008595 26A1[0600] mov ax, word [es:BPB_IN_SECTOR + DIRNUM] 0 00008599 89450C mov word [di + CDIR], ax 0 0000859C 26A1[0B00] mov ax, word [es:BPB_IN_SECTOR + FATSIZE] 0 000085A0 894511 mov word [di + CSECFAT], ax 0 000085A3 26A1[0300] mov ax, word [es:BPB_IN_SECTOR + RESNUM] 0 000085A7 894509 mov word [di + RESSEC], ax 0 000085AA 26A0[0500] mov al, byte [es:BPB_IN_SECTOR + FATNUM] 0 000085AE 88450B mov byte [di + CFAT], al 580 0 000085B1 1E57 SAVEREG 0 000085B3 06 PUSH es 0 000085B4 1F POP DS 584 assume ds:DOSENTRYGROUP 0 000085B5 BF[0000] MOV DI,OFFSET BPB_IN_SECTOR ; access with ds 0 000085B8 8A7502 MOV DH,BYTE PTR [DI + SECALL] ;SECTORS PER UNIT 0 000085BB 8A7D06 MOV BH,BYTE PTR [DI + DIRNUM] ;NUMBER OF DIRECTORY ENTRIES 0 000085BE 8B4D08 MOV CX,WORD PTR [DI + SECNUM] ;SIZE OF DRIVE 0 000085C1 8A650A MOV AH,BYTE PTR [DI + FATID] ;MEDIA DESCRIPTOR 0 000085C4 8A450B MOV AL,BYTE PTR [DI + FATSIZE] ;NUMBER OF FAT SECTORS 0 000085C7 8A5D0D MOV BL,BYTE PTR [DI + SLIM] ;SECTORS PER TRACK 0 000085CA 8A550F MOV DL,BYTE PTR [DI + HLIM] ;NUMBER OF HEADS 0 000085CD 5F1F RESTOREREG 594 assume ds:UPB 0 000085CF E8[0000] call biocode_get_es_dosbiodata 596 assume es:DOSGROUP 0 000085D2 26803E[0000]01 cmp byte [es:Set_ID_Flag], 1 ;AC008 called by GET$BPB? 0 000085D8 7516 jne MovBPB_Ret ;AC008 0 000085DA E83401 call Mov_Media_IDs ;AC008 0 000085DD 7206 jc MovBPB_Conv ;AC008 Conventional boot record? 0 000085DF 26C606[0000]02 mov byte [es:Set_ID_Flag],2 ;AC008 signals that Volume ID is set. 602 MovBPB_Conv: ;AC008 603 fHave96 equ FHAVE96 ; NASM port label 0 000085E5 26803E[0000]01 cmp byte [es:fHave96], 1 ;AC008 0 000085EB 7503 jne MovBPB_Ret ;AC008 0 000085ED E8[0000] call ResetChanged ;AC008 Reset Flags in BDS to NOT fCHANGED. 607 MovBPB_Ret: ;AC008 0 000085F0 F8 clc ;AC008 609 ;MOVBPB ENDP ;AC008 0 000085F1 EB61 JMP HAS1 0 000085F3 90 nop ; identicalise 612 613 Getbp_err_ret equ GETBP_ERR_RET ; NASM port label 0 000085F4 E98800 Getbp_err_ret_brdg: jmp Getbp_err_ret 615 ; 616 ; WE HAVE A 1.X DISKETTE. 617 ; IN THIS CASE READ IN THE FAT ID BYTE AND FILL IN BPB FROM THERE. 618 ; 619 DOFATBPB: 620 assume ds:UPB 0 000085F7 E85D01 CALL READFAT ; PUTS MEDIA DESCRIPTOR BYTE IN AH 622 assume es:DOSENTRYGROUP 623 GETBP_ERR_RET_Brdg equ Getbp_err_ret_brdg ; NASM port label 0 000085FA 72F8 JC GETBP_ERR_RET_Brdg 625 ;----------------------------------------| 626 ; WARNING: DO NOT CHANGE THE FOLLOWING. ;| 627 ; IT GETS PATCHED IN MSINIT ;| 0 000085FC E86C13 call ispatched 0 000085FF 7203 jc @F 630 PUBLIC GETBP1_PATCH ;| 631 GETBP1_PATCH: ;| 0 00008601 E8[0000] CALL HIDENSITY ;| 633 @@: 634 ;----------------------------------------| 635 ;TEST FOR A VALID 3.5" MEDIUM 0 00008604 807D2202 CMP byte [DI + FORMFACTOR],FFSMALL 0 00008608 751C JNZ IS_FLOPPY 0 0000860A 80FCF9 CMP AH,0F9H ; IS IT A VALID FAT ID BYTE FOR 3.5" ? 0 0000860D 757F jnz short GOT_UNKNOWN_MEDIUM 0 0000860F BB[0000] MOV BX,OFFSET SM92 ; POINTER TO CORRECT BPB 0 00008612 E8[0000] call biocode_get_es_dosbiodata 642 assume es:DOSGROUP 643 644 ;J.K. DS points to segment of BDS. The following should be modified 645 ;J.K. to get spf,csec,spa,spt correctly. It had been wrong if DRIVER.SYS 646 ;J.K. is loaded since the BDS is inside the driver.sys. 0 00008615 268A07 MOV AL,[es:BX + SPF] 0 00008618 268B4F03 MOV CX,[es:BX + CSEC] 0 0000861C 268B5705 MOV DX,WORD PTR [es:BX + SPA] 0 00008620 268B5F01 MOV BX,WORD PTR [es:BX + SPT] 0 00008624 EB2E JMP SHORT HAS1 652 ; MUST BE A 5.25" FLOPPY IF WE COME HERE 653 IS_FLOPPY: 654 assume es:DOSENTRYGROUP 0 00008626 88E1 MOV CL,AH ;SAVE MEDIA 0 00008628 80E1F8 AND CL,0F8H ;NORMALIZE 0 0000862B 80F9F8 CMP CL,0F8H ;COMPARE WITH GOOD MEDIA BYTE 0 0000862E 755E JNZ GOT_UNKNOWN_MEDIUM 659 660 GOODID: 0 00008630 B001 MOV AL,1 ;SET NUMBER OF FAT SECTORS 0 00008632 BB0840 MOV BX,64*256+8 ;SET DIR ENTRIES AND SECTOR MAX 0 00008635 B94001 MOV CX,40*8 ;SET SIZE OF DRIVE 0 00008638 BA0101 MOV DX,01*256+1 ;SET HEAD LIMIT AND SEC/ALL UNIT 0 0000863B F6C402 TEST AH,00000010B ;TEST FOR 8 OR 9 SECTOR 0 0000863E 7507 JNZ HAS8 ;NZ = HAS 8 SECTORS 0 00008640 FEC0 INC AL ;INC NUMBER OF FAT SECTORS 0 00008642 FEC3 INC BL ;INC SECTOR MAX 0 00008644 83C128 ADD CX,40 ;INCREASE SIZE 670 HAS8: 0 00008647 F6C401 TEST AH,00000001B ;TEST FOR 1 OR 2 HEADS 0 0000864A 7408 JZ HAS1 ;Z = 1 HEAD 0 0000864C 01C9 ADD CX,CX ;DOUBLE SIZE OF DISK 0 0000864E B770 MOV BH,112 ;INCREASE NUMBER OF DIRECTORY ENTRIES 0 00008650 FEC6 INC DH ;INC SEC/ALL UNIT 0 00008652 FEC2 INC DL ;INC HEAD LIMIT 677 678 HAS1: 679 PUBLIC HAS1 680 assume es:nothing 681 0 00008654 887508 MOV BYTE PTR [DI + SECPERCLUS],DH 0 00008657 887D0C MOV BYTE PTR [DI + CDIR],BH 0 0000865A 894D0E MOV WORD PTR [DI + DRVLIM],CX 0 0000865D 886510 MOV BYTE PTR [DI + MEDIAD],AH 0 00008660 884511 MOV BYTE PTR [DI + CSECFAT],AL 0 00008663 885D13 MOV BYTE PTR [DI + SECLIM],BL 0 00008666 B600 mov dh, 0 0 00008668 895515 MOV word PTR [DI + HDLIM], dx 690 ;SB34DISK001******************************************************************* 691 ;SB the HIDSEC_H field and HIDSEC_L field and the 692 ;SB DRVLIM_H fields need to be set to 0 since this code here is for floppies 693 ;SB 3 LOCS 694 0 0000866B C745190000 mov word ptr [di + HIDSEC_H],0 0 00008670 C745170000 mov word ptr [di + HIDSEC_L],0 0 00008675 C7451D0000 mov word ptr [di + DRVLIM_H],0 698 699 ;SB34DISK001******************************************************************* 700 GETRET: 0 0000867A 5B POP BX 0 0000867B 075A59 RESTOREREG 703 ASSUME ES:NOTHING 704 705 GETRET_EXIT: 0 0000867E C3 RET 707 708 GETBP_ERR_RET: 709 ;J.K. Before doing anything else, set Set_ID_Flag to 0. 0 0000867F 1E push ds 0 00008680 E8[0000] call biocode_get_ds_dosbiodata 712 assume ds:DOSGROUP 0 00008683 C606[0000]00 mov byte [Set_ID_Flag], 0 ;AN000; 0 00008688 1F pop ds 715 assume ds:nothing 0 00008689 E81B08 CALL MAPERROR 0 0000868C EBEC JMP SHORT GETRET 718 ; 719 ; WE HAVE A 3.5" DISKETTE FOR WHICH WE CANNOT BUILD A BPB. WE DO NOT ASSUME ANY 720 ; TYPE OF BPB FOR THIS MEDIUM. 721 ; 722 GOT_UNKNOWN_MEDIUM: 0 0000868E 1E push ds 0 0000868F E8[0000] call biocode_get_ds_dosbiodata 725 assume ds:DOSGROUP 0 00008692 C606[0000]00 mov byte [Set_ID_Flag], 0 ;AN000; 0 00008697 1F pop ds 728 assume ds:nothing 0 00008698 B007 MOV AL,ERROR_UNKNOWN_MEDIA 0 0000869A F9 STC 0 0000869B EBDD JMP SHORT GETRET 732 GETBP ENDP 733 734 BPBTYPE STRUC 0 000083FA ?? SPF DB ? 0 000083FB ?? SPT DB ? 0 000083FC ?? CDIRE DB ? 0 000083FD ???? CSEC DW ? 0 000083FF ?? SPA DB ? 0 00008400 ?? CHEAD DB ? 741 BPBTYPE ENDS 742 743 ; 744 ; READ IN THE BOOT SECTOR. SET CARRY IF ERROR IN READING SECTOR. 745 ; BX IS SET TO 1 IF THE BOOT SECTOR IS INVALID, OTHERWISE IT IS 0. 746 ; 747 READBOOTSEC PROC NEAR 0 0000869D B600 MOV DH,0 ;HEAD 0 0 0000869F B90100 MOV CX,0001 ;CYLINDER 0, SECTOR 1 0 000086A2 E8C400 CALL READ_SECTOR 751 assume es:DOSENTRYGROUP 0 000086A5 7269 JC ERR_RET 0 000086A7 31DB XOR BX,BX ; ASSUME VALID BOOT SECTOR. 754 755 ;******************************************************************************* 756 ; PUT A SANITY CHECK FOR THE BOOT SECTOR IN HERE TO DETECT BOOT SECTORS THAT 757 ; DO NOT HAVE VALID BPBS. 758 ; WE EXAMINE THE FIRST TWO BYTES - THEY MUST CONTAIN A LONG JUMP (69H) OR A 759 ; SHORT JUMP (EBH) FOLLOWED BY A NOP (90H), OR A SHORT JUMP (E9H). 760 ; IF THIS TEST IS PASSED, WE FURTHER CHECK BY EXAMINING THE SIGNATURE AT 761 ; THE END OF THE BOOT SECTOR FOR THE WORD AA55H. 762 ; IF THE SIGNATURE IS NOT PRESENT, WE EXAMINE THE MEDIA DESCRIPTOR BYTE TO 763 ; SEE IF IT IS VALID. 764 ;J.K. 10/15/86 DCR00012. For DOS 3.3, this logic is modified a little bit. 765 ; We are not going to check Signature. Instead we are going to sanity 766 ; check the media byte in BPB regardless of the validity of signature. 767 ; This is to save the already developed commercial products that have 768 ; good jump instruction and signature but with the false BPB informations 769 ; that will crash the diskette drive operation. (For example, Symphony diskette). 770 ;****************************************************************************** 0 000086A9 26803E[0000]69 CMP BYTE PTR [es:DISKSECTOR],069H ; IS IT A DIRECT JUMP? 0 000086AF 7418 JE Check_bpb_MediaByte ; DON'T NEED TO FIND A NOP 0 000086B1 26803E[0000]E9 CMP BYTE PTR [es:DISKSECTOR],0E9H ; DOS 2.0 JUMP? 0 000086B7 7410 JE Check_bpb_MediaByte ; NO NEED FOR NOP 0 000086B9 26803E[0000]EB CMP BYTE PTR [es:DISKSECTOR],0EBH ; HOW ABOUT A SHORT JUMP. 0 000086BF 754C JNE INVALIDBOOTSEC 0 000086C1 26803E[0200]90 CMP BYTE PTR [es:DISKSECTOR + 2],090H ; IS NEXT ONE A NOP? 0 000086C7 7544 JNE INVALIDBOOTSEC 779 780 781 ;J.K. 10/15/86 Don't have to perform the following signature check since 782 ; we need to check the media byte even with the good signatured diskette. 783 ;CHECK_SIGNATURE: 784 ; CMP WORD PTR [es:DISKSECTOR+1FEH],0AA55H ; SEE IF NON-IBM DISK OR 1.X 785 ; ; MEDIA. 786 ; JZ CHECKSINGLESIDED ; GO SEE IF SINGLE SIDED MEDIUM. MAY 787 ; ; NEED SOME SPECIAL HANDLING 788 ; 789 ; CHECK FOR NON-IBM DISKS WHICH DO NOT HAVE THE SIGNATURE AA55 AT THE 790 ; END OF THE BOOT SECTOR, BUT STILL HAVE A VALID BOOT SECTOR. THIS IS DONE 791 ; BY EXAMINING THE MEDIA DESCRIPTOR IN THE BOOT SECTOR. 792 ; 793 794 Check_bpb_MediaByte: 795 0 000086C9 26A0[0000] MOV AL,BYTE PTR [es:MEDIABYTE] 0 000086CD 24F0 AND AL,0F0H 0 000086CF 3CF0 CMP AL,0F0H ; ALLOW FOR STRANGE MEDIA 0 000086D1 753A JNZ INVALIDBOOTSEC 800 ; 801 ; THERE WERE SOME (APPARENTLY A LOT OF THEM) DISKETTES THAT HAD BEEN FORMATTED 802 ; UNDER DOS 3.1 AND EARLIER VERSIONS WHICH HAVE INVALID BPBS IN THEIR BOOT 803 ; SECTORS. THESE ARE SPECIFICALLY DISKETTES THAT WERE FORMATTED IN DRIVES 804 ; WITH ONE HEAD, OR WHOSE SIDE 0 WAS BAD. THESE CONTAIN BPBS IN THE BOOT 805 ; SECTOR THAT HAVE THE SEC/CLUS FIELD SET TO 2 INSTEAD OF 1, AS IS STANDARD 806 ; IN DOS. IN ORDER TO SUPPORT THEM, WE HAVE TO INTRODUCE A "HACK" THAT WILL 807 ; HELP OUR BUILD BPB ROUTINE TO RECOGNISE THESE SPECIFIC CASES, AND TO 808 ; SET UP OUT COPY OF THE BPB ACCORDINGLY. 809 ; WE DO THIS BY CHECKING TO SEE IF THE BOOT SECTOR IS OFF A DISKETTE THAT 810 ; IS SINGLE-SIDED AND IS A PRE-DOS 3.20 DISKETTE. IF IT IS, WE SET THE 811 ; SEC/CLUS FIELD TO 1. IF NOT, WE CARRY ON AS NORMAL. 812 CHECKSINGLESIDED: 0 000086D3 26A0[0000] MOV AL,BYTE PTR [es:MEDIABYTE] 0 000086D7 A801 TEST AL,0001H ; IS LOW BIT SET? - INDICATES DOUBLE SIDED 0 000086D9 7533 JNZ GOODDSK 0 000086DB 26803E[0000]02 cmp BYTE PTR [es:SECPERCLUSINSECTOR], 2 0 000086E1 752B jne GOODDSK 0 000086E3 26813E[0800]322E CMP WORD PTR [es:DISKSECTOR+8],("." << 8) + "2" 0 000086EA 7419 je MUSTBEEARLIER 0 000086EC 26813E[0800]332E CMP WORD PTR [es:DISKSECTOR+8],("." << 8) + "3" 0 000086F3 7519 jne GOODDSK 0 000086F5 26803E[0A00]30 CMP BYTE PTR [es:DISKSECTOR+10],"0" 0 000086FB 7211 jb GOODDSK 0 000086FD 26803E[0A00]32 CMP BYTE PTR [es:DISKSECTOR+10],"2" 0 00008703 7309 JAE GOODDSK 826 827 ; WE MUST HAVE A PRE-3.20 DISKETTE. SET THE SEC/CLUS FIELD TO 1 828 MUSTBEEARLIER: 0 00008705 26C606[0000]01 MOV BYTE PTR [es:SECPERCLUSINSECTOR],1 0 0000870B EB01 JMP SHORT GOODDSK 831 ;****************************************************************************** 832 833 INVALIDBOOTSEC: 0 0000870D 43 INC BX ; INDICATE THAT BOOT SECTOR INVALID 835 GOODDSK: ; CARRY ALREADY RESET 0 0000870E F8 CLC 0 0000870F C3 RET 838 839 ERR_RET: ; CARRY IS ALREADY SET ON ENTRY HERE 840 MESSAGE FTESTDISK,<"ERROR IN READBOOT",CR,LF> 0 00008710 C3 RET 842 READBOOTSEC ENDP 843 844 ; 845 public Mov_Media_IDs 846 Mov_Media_IDs Proc near ;AN000; 847 assume ds:UPB, es:nothing, ss:nothing 848 ;copy the boot_serial number, Volume id, and Filesystem id from the 849 ;***Extended Boot record*** in DOSENTRY:DiskSector to the BDS table pointed 850 ;by DS:DI. 851 ;In.) DS:DI -> BDS 852 ; DOSENTRY:DiskSector = Valid extended boot record. 853 ;Out.) Vol_Serial, Volid and System_Id in BDS are set according to 854 ; the boot record information. 855 ; Carry flag set if not an extended BPB. 856 ; All registers saved except the flag. 857 0 00008711 06 push es ;AN000; 0 00008712 E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 860 assume es:DOSENTRYGROUP 0 00008715 26803E[0000]29 cmp byte [es:Ext_Boot_Sig], EXT_BOOT_SIGNATURE ;AN000; = 41 0 0000871B 7537 jne MMI_Not_Ext ;AN000; 0 0000871D 51 push cx ;AN000; 0 0000871E 268B0E[0000] mov cx, [es:Boot_Serial_L] ;AN000; 0 00008723 894D57 mov word ptr [di + VOL_SERIAL],cx ;AN000; 0 00008726 268B0E[0000] mov cx, [es:Boot_Serial_H] ;AN000; 0 0000872B 894D59 mov word ptr [di + VOL_SERIAL+2],cx ;AN000; 0 0000872E 1E push ds ;AN000; Save regs. 0 0000872F 57 push di ;AN000; 0 00008730 56 push si ;AN000; 871 0 00008731 06 push es 0 00008732 1E push ds ; swap es, ds 0 00008733 07 pop es ; es => UPB 0 00008734 1F pop ds ; ds => DOSENTRY 876 assume ds:DOSENTRYGROUP, es:UPB 877 0 00008735 B90B00 mov cx, BOOT_VOLUME_LABEL_SIZE ;AN000; 0 00008738 BE[0000] mov si, offset Boot_Volume_Label;AN000; access with ds 0 0000873B 57 push di 0 0000873C 83C74B add di, VOLID ;AN000; 0 0000873F F3A4 rep movsb ;AN000; 0 00008741 5F pop di 0 00008742 B90800 mov cx, BOOT_SYSTEM_ID_SIZE ;AN000; =8 0 00008745 BE[0000] mov si, offset Boot_System_ID ;AN000; accexd with ds 0 00008748 83C75B add di, FILESYS_ID ;AN000; 0 0000874B F3A4 rep movsb ;AN000; 888 0 0000874D 5E pop si ;AN000; 0 0000874E 5F pop di ;AN000; 0 0000874F 1F pop ds ;AN000; 892 assume ds:UPB 0 00008750 59 pop cx ;AN000; 0 00008751 F8 clc ;AN000; 895 MMI_Ret: ;AN000; 0 00008752 07 pop es ;AN000; 897 assume es:nothing 0 00008753 C3 ret ;AN000; 899 MMI_Not_Ext: ;AN000; 0 00008754 07 pop es ;AN000; 901 assume es:nothing 0 00008755 F9 stc ;AN000; 0 00008756 C3 ret ;AN000; 904 Mov_Media_IDs endp ;AN000; 905 906 907 ; READ IN THE FAT SECTOR AND GET THE MEDIA BYTE FROM IT. 908 ; INPUT : AL CONTAINS LOGICAL DRIVE. 909 ; OUTPUT: 910 ; CARRY SET IF AN ERROR OCCURS, AX CONTAINS ERROR CODE. 911 ; OTHERWISE, AH CONTAINS MEDIA BYTE ON EXIT. AL IS PRESERVED. 912 913 READFAT PROC NEAR 914 assume ds:nothing, es:nothing, ss:nothing 0 00008757 50 PUSH AX ; PRESERVE LOGICAL DRIVE IN AL 0 00008758 B600 MOV DH,0 ; HEAD 0 0 0000875A B90200 MOV CX,0002 ; CYLINDER 0, SECTOR 2 0 0000875D E80900 CALL READ_SECTOR ; es:BX POINTS TO FAT SECTOR 919 assume es:DOSENTRYGROUP 0 00008760 7205 JC BAD_FAT_RET 0 00008762 58 POP AX ; RESET LOGICAL DRIVE 0 00008763 268A27 MOV AH,BYTE PTR [es:BX] ; MEDIA BYTE 0 00008766 C3 RET 924 925 BAD_FAT_RET: ; CARRY SET ON ENTRY 926 MESSAGE FTESTDISK,<"ERROR IN FAT READ",CR,LF> 0 00008767 59 POP CX ; CLEAR STACK 0 00008768 C3 RET 929 READFAT ENDP 930 931 ; READ A SINGLE SECTOR INTO THE TEMP BUFFER. 932 ; PERFORM THREE RETRIES IN CASE OF ERROR. 933 ; INPUTS: DRIVE HAS PHYSICAL DRIVE TO USE 934 ; CX HAS SECTOR AND CYLINDER 935 ; DH HAS HEAD 936 ; OUTPUTS: CARRY CLEAR 937 ; es:BX POINT TO SECTOR 938 ; CARRY SET 939 ; AX HAS ROM ERROR CODE 940 ; REGISTERS ES AND BP ARE PRESERVED. 941 ; OUT: es => DOSENTRY 942 943 READ_SECTOR PROC NEAR 944 PUBLIC READ_SECTOR 945 assume ds:UPB, es:nothing 946 0 00008769 55 PUSH BP 0 0000876A BD0300 MOV BP,3 ; MAKE 3 ATTEMPTS 949 ;SB33015***************************************************************** 950 DriveNum equ DRIVENUM ; NASM port equate 0 0000876D 8A5504 mov DL, byte ptr [di + DriveNum] ;SB;3.30* 952 DiskSector equ DISKSECTOR ; NASM port label 0 00008770 BB[0000] mov BX, offset DiskSector ; Get ES:BX to point to buffer ;SB;3.30* 0 00008773 E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 955 ; now ES:BX is correct ;SB;3.30* 956 assume es:DOSENTRYGROUP 957 ;SB33015***************************************************************** 958 RD_RET: 959 ;SB33016***************************************************************** 0 00008776 B80102 mov AX, 0201h ; number of sectors to 1 (AL=1);SB;3.30* 0 00008779 CD13 int 13h ; call rom-bios disk routines ;SB;3.30* 962 963 ;SB33016***************************************************************** 0 0000877B 7358 JNC OKRET2 965 Rd_rty: 0 0000877D E8D90E CALL AGAIN ; RESET DISK, DECREMENT BP, PRESERVE AX 967 Err_RD_RET equ ERR_RD_RET ; NASM port label 0 00008780 7450 jz Err_RD_RET 969 flags equ FLAGS ; NASM port equate 970 fNon_Removable equ FNON_REMOVABLE ; NASM port equate 0 00008782 F745230100 test word ptr [di + flags],fNon_Removable 0 00008787 75ED JNZ RD_RET 0 00008789 06 push es 0 0000878A E8[0000] call biocode_get_es_dosbiodata 975 assume es:DOSGROUP 976 Media_Set_For_Format equ MEDIA_SET_FOR_FORMAT ; NASM port label 0 0000878D 26803E[FF00]00 cmp byte [es:Media_Set_For_Format], 0 ;AN012; 0 00008793 7514 jne Rd_Skip1_DPT ;AN012; 0 00008795 1E push ds ;J.K. 11/7/86 For retry, set the head settle time 0 00008796 50 push ax ;to 0Fh. PTM845. 0 00008797 26C536[0000] lds si,[es:DPT] 982 assume ds:nothing 983 disk_head_sttl equ DISK_HEAD_STTL ; NASM port equate 0 0000879C 8A4409 mov al, [si + disk_head_sttl] 985 save_head_sttl equ Save_head_sttl ; NASM port label 0 0000879F 26A2[0000] mov [es:save_head_sttl],al 987 NormSettle equ NORMSETTLE ; NASM port equate 0 000087A3 C644090F mov byte ptr [si + disk_head_sttl], NormSettle 0 000087A7 58 pop ax 0 000087A8 1F pop ds 991 assume ds:UPB 992 Rd_Skip1_DPT: ;AN012; 0 000087A9 07 pop es 994 assume es:DOSENTRYGROUP 995 ;SB33017***************************************************************** 996 ; SET CMD TO READ (AH=2) AND ;SB ;3.30 0 000087AA B80102 MOV AX, 0201h ; NUM OF SECTORS TO 1 (AL=1) ;SB ;3.30 0 000087AD CD13 INT 13h ; CALL ROM-BIOS DISK ROUTINES ;SB ;3.30 999 ;SB33017***************************************************************** 0 000087AF 06 push es 0 000087B0 E8[0000] call biocode_get_es_dosbiodata 1002 assume es:DOSGROUP 0 000087B3 9C pushf ;AN012; 0 000087B4 26803E[FF00]00 cmp byte [es:Media_Set_For_Format], 0 ;AN012; 0 000087BA 7510 jne Rd_Skip2_DPT ;AN012; 0 000087BC 1E push ds 0 000087BD 50 push ax 0 000087BE 26C536[0000] lds si,[es:DPT] 1009 assume ds:nothing 0 000087C3 26A0[0000] mov al, [es:save_head_sttl] 0 000087C7 884409 mov byte ptr [si + disk_head_sttl], al 0 000087CA 58 pop ax 0 000087CB 1F pop ds 1014 assume ds:UPB 1015 Rd_Skip2_DPT: ;AN012; 0 000087CC 9D popf ;AN012; 0 000087CD 07 pop es 1018 assume es:DOSENTRYGROUP 0 000087CE 7305 jnc OKRET2 0 000087D0 EBAB jmp Rd_rty 1021 ERR_RD_RET: 0 000087D2 B2FF MOV DL,-1 ; MAKE SURE WE ASK ROM IF MEDIA HAS CHANGED 0 000087D4 F9 STC ; RETURN ERROR 1024 ; UPDATE INFORMATION PERTAINING TO LAST DRIVE ACCESSED, TIME OF ACCESS, LAST 1025 ; TRACK ACCESSED IN THAT DRIVE. 1026 OKRET2: 0 000087D5 06 push es 0 000087D6 E8[0000] call biocode_get_es_dosbiodata 1029 assume es:DOSGROUP 0 000087D9 268816[0000] MOV [es:STEP_DRV],DL ; SET UP FOR HEAD SETTLE LOGIC IN DISK. 0 000087DE 268816[0000] MOV [es:TIM_DRV],DL ;SAVE DRIVE LAST ACCESSED 0 000087E3 886D46 MOV BYTE PTR [DI + TRACK],CH ; SAVE LAST TRACK ACCESSED ON THIS DRIVE 0 000087E6 9C PUSHF ; PRESERVE FLAGS IN CASE ERROR OCCURRED 0 000087E7 E8D706 CALL SET_TIM 0 000087EA 9D POPF ; RESTORE FLAGS 0 000087EB 07 pop es 1037 assume es:DOSENTRYGROUP 0 000087EC 5D POP BP 0 000087ED C3 RET 1040 READ_SECTOR ENDP 1041 1042 ;----------------------------------------------------------- 1043 ; 1044 ; DISK REMOVABLE ROUTINE ARR 2.41 1045 ; 1046 1047 DSK$REM PROC NEAR ;ARR 2.41 1048 PUBLIC DSK$REM 1049 assume ds:DOSGROUP, es:nothing, ss:nothing 1050 1051 MESSAGE FTESTDISK,<"DISK REMOVABLE "> 1052 MNUM FTESTDISK,AX 1053 MESSAGE FTESTDISK, 1054 ; AL IS UNIT # 0 000087EE E81200 CALL SETDRIVE ; GET BDS FOR THIS DRIVE 1056 assume ds:UPB 0 000087F1 7303E9[0000] jc DSK$UNKNOWN 0 000087F6 F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 000087FB 7503 JNZ NON_REM 0 000087FD E9[0000] JMP EXIT 1061 1062 NON_REM: 0 00008800 E9[0000] JMP BUS$EXIT ;ARR 2.41 1064 DSK$REM ENDP 1065 1066 ; SETDRIVE SCANS THROUGH THE DATA STRUCTURE OF BDSS, AND RETURNS A POINTER TO 1067 ; THE ONE THAT BELONGS TO THE DRIVE SPECIFIED. CARRY IS SET IF NONE EXISTS FOR 1068 ; THE DRIVE. 1069 ; IF THE BYTE [PHYS_DRV] IS 0 THEN 1070 ; ON ENTRY, AL CONTAINS THE LOGICAL DRIVE NUMBER. 1071 ; ON EXIT, DS:DI POINTS TO CORRECT BDS FOR THE DRIVE IF CARRY CLEAR. 1072 1073 ; ELSE IF THE BYTE [PHYS_DRV] IS 1 THEN (ONLY USED FOR FIXED DISKS WHEN AN ECC 1074 ; ERROR OCCURS) 1075 ; ON ENTRY, DL CONTAINS THE PYHSICAL DRIVE NUMBER. 1076 ; ON EXIT, DS:DI POINTS TO CORRECT BDS FOR THE DRIVE IF CARRY CLEAR. 1077 1078 PUBLIC SETDRIVE 1079 SETDRIVE PROC NEAR 1080 assume ds:nothing, es:nothing, ss:nothing 1081 MESSAGE FTESTDISK,<"SETDRIVE",CR,LF> 0 00008803 53 PUSH BX 0 00008804 E8[0000] call biocode_get_ds_dosbiodata 1084 assume ds:DOSGROUP 0 00008807 C53E[0000] lds di, [START_BDS] 1086 assume ds:UPB 1087 SCAN_LOOP: 0 0000880B 83FFFF CMP DI,-1 0 0000880E 741C je SCAN_NONE 0 00008810 1E push ds 0 00008811 E8[0000] call biocode_get_ds_dosbiodata 1092 assume ds:DOSGROUP 0 00008814 803E[0000]01 CMP BYTE PTR [PHYS_DRV], 1 ; DOES AL HAVE PHYSICAL DRIVE? 0 00008819 1F pop ds 1095 assume ds:UPB 0 0000881A 7207 JB USE_LOGICAL_DRV 0 0000881C 384504 CMP BYTE PTR [DI + DRIVENUM],AL 0 0000881F 740C JE SETDRV 0 00008821 EB05 JMP SHORT GET_NXT_BDS 1100 USE_LOGICAL_DRV: 0 00008823 384505 CMP BYTE PTR [DI + DRIVELET],AL 0 00008826 7405 JE SETDRV 1103 GET_NXT_BDS: 0 00008828 C53D lds di, [DI + LINK] ; GO TO NEXT BDS 0 0000882A EBDF jmp SCAN_LOOP 1106 1107 SCAN_NONE: 0 0000882C F9 STC 1109 SETDRV: 0 0000882D 5B POP BX 0 0000882E C3 RET 1112 SETDRIVE ENDP 1113 1114 ;----------------------------------------------------------- 1115 ; 1116 ; DISK I/O ROUTINES 1117 ; 1118 1119 DSK$WRITV PROC NEAR 1120 PUBLIC DSK$WRITV 1121 assume ds:nothing, es:nothing, ss:nothing 1122 1123 MESSAGE FTESTDISK,<"DISK WRITE WITH VERIFY "> 1124 MNUM FTESTDISK,AX 1125 MESSAGE FTESTDISK,<" "> 1126 MNUM FTESTDISK,DX 1127 MESSAGE FTESTDISK,<" FOR "> 1128 MNUM FTESTDISK,CX 1129 MESSAGE FTESTDISK, 0 0000882F E8[0000] call biocode_get_ds_dosbiodata 1131 assume ds:DOSGROUP 0 00008832 C706[0000]0301 MOV word [WRTVERIFY],103H 1133 ; needn't preserve ds, DISKIO overwrites its INP:ds 0 00008838 EB09 JMP SHORT DSK$CL 1135 1136 DSK$WRIT: 1137 PUBLIC DSK$WRIT 1138 assume ds:nothing, es:nothing, ss:nothing 1139 MESSAGE FTESTDISK,<"DISK WRITE "> 1140 MNUM FTESTDISK,AX 1141 MESSAGE FTESTDISK,<" "> 1142 MNUM FTESTDISK,DX 1143 MESSAGE FTESTDISK,<" FOR "> 1144 MNUM FTESTDISK,CX 1145 MESSAGE FTESTDISK, 0 0000883A E8[0000] call biocode_get_ds_dosbiodata 1147 assume ds:DOSGROUP 0 0000883D C706[0000]0300 MOV word [WRTVERIFY],ROMWRITE 1149 ; needn't preserve ds, DISKIO overwrites its INP:ds 1150 DSK$CL: 0 00008843 E89300 CALL DISKIO 1152 DSK$IO: 0 00008846 7203 JC DSKBAD 0 00008848 E9[0000] JMP EXIT 1155 DSKBAD: 0 0000884B E9[0000] JMP ERR$CNT 1157 DSK$WRITV ENDP 1158 1159 DSK$READ PROC NEAR 1160 PUBLIC DSK$READ 1161 assume ds:nothing, es:nothing, ss:nothing 1162 MESSAGE FTESTDISK,<"DISK READ "> 1163 MNUM FTESTDISK,AX 1164 MESSAGE FTESTDISK,<" "> 1165 MNUM FTESTDISK,DX 1166 MESSAGE FTESTDISK,<" FOR "> 1167 MNUM FTESTDISK,CX 1168 MESSAGE FTESTDISK, 0 0000884E E88000 CALL DISKRD 0 00008851 EBF3 JMP DSK$IO 1171 DSK$READ ENDP 1172 1173 ; MISCELLANEOUS ODD JUMP ROUTINES. MOVED OUT OF MAINLINE FOR SPEED. 1174 1175 1176 ; IF WE HAVE A SYSTEM WHERE WE HAVE VIRTUAL DRIVES, WE NEED TO PROMPT THE 1177 ; USER TO PLACE THE CORRECT DISK IN THE DRIVE. 1178 1179 CHECKSINGLE PROC NEAR 1180 PUBLIC CHECKSINGLE 1181 assume ds:UPB, es:nothing, ss:nothing 1182 0 00008853 50 PUSH AX 0 00008854 8B4523 MOV ax,WORD PTR [DI + FLAGS] 1185 ; IF HARD DRIVE, CANNOT CHANGE DISK. 1186 ; IF CURRENT OWNER OF PHYSICAL DRIVE, NO NEED TO CHANGE DISKETTE. 0 00008857 A821 TEST al,FNON_REMOVABLE | FI_OWN_PHYSICAL 0 00008859 7560 JNZ SINGLERET 0 0000885B A810 TEST al,FI_AM_MULT ; IS THERE A DRIVE SHARING THIS 1190 ; PHYSICAL DRIVE? 0 0000885D 745C JZ SINGLERET 1192 ; LOOK FOR THE PREVIOUS OWNER OF THIS PHYSICAL DRIVE AND RESET ITS OWNERSHIP 1193 ; FLAG. 0 0000885F 8A4504 MOV AL,[DI + DRIVENUM] ; GET PHYSICAL DRIVE NUMBER 0 00008862 1E PUSH DS ; PRESERVE POINTER TO CURRENT BDS 0 00008863 57 PUSH DI 0 00008864 E8[0000] call biocode_get_ds_dosbiodata 1198 assume ds:DOSGROUP 0 00008867 BF[0000] MOV DI,OFFSET START_BDS 1200 SCAN_LIST: 0 0000886A C53D lds di, [di + LINK] ; GO TO NEXT BDS 1202 assume ds:UPB 0 0000886C 83FFFF CMP DI,-1 ; END OF LIST? 0 0000886F 744C je SINGLE_ERR_RET ; MUST BE ERROR 0 00008871 384504 CMP BYTE PTR [DI + DRIVENUM],AL 0 00008874 75F4 jne SCAN_LIST 1207 1208 CHECK_OWN: 0 00008876 F6452320 test byte [DI + FLAGS], FI_OWN_PHYSICAL 0 0000887A 74EE JZ SCAN_LIST 1211 1212 ; MS-DOS v5 flips these flags before the 2F.4A00 callout 0 0000887C 806523DF and byte [DI + FLAGS], ~ FI_OWN_PHYSICAL; RESET OWNERSHIP FLAG 0 00008880 8A6505 MOV ah, [DI + DRIVELET] ; ah = wanted DOS drive letter 0 00008883 5F POP DI ; RESTORE POINTER TO CURRENT BDS 0 00008884 1F POP DS 1217 assume ds:UPB 0 00008885 804D2320 or byte [DI + FLAGS], FI_OWN_PHYSICAL ; ESTABLISH CURRENT BDS AS OWNER 1219 1220 ; 1221 ; WE EXAMINE THE FSETOWNER FLAG. IF IT IS SET, THEN WE ARE USING THE CODE IN 1222 ; CHECKSINGLE TO JUST SET THE OWNER OF A DRIVE. WE MUST NOT ISSUE THE PROMPT 1223 ; IN THIS CASE. 1224 ; 0 00008889 1E push ds 0 0000888A E8[0000] call biocode_get_ds_dosbiodata 1227 assume ds:DOSGROUP 0 0000888D 803E[0000]01 CMP BYTE PTR [FSETOWNER],1 0 00008892 1F pop ds 1230 assume ds:UPB 0 00008893 7426 JZ SINGLERET 1232 ; TO SUPPORT "BACKWARD" COMPATIBILITY WITH IBM'S "SINGLE DRIVE STATUS BYTE" 1233 ; WE NOW CHECK TO SEE IF WE ARE IN A SINGLE DRIVE SYSTEM AND THE APPLICATION 1234 ; HAS "CLEVERLY" DIDDLED THE SDSB 0 00008895 1E push ds 0 00008896 E8[0000] call biocode_get_ds_dosbiodata 1237 assume ds:DOSGROUP 0 00008899 803E[0000]02 CMP byte [SINGLE],2 ; IF (SINGLE_DRIVE_SYSTEM) 0 0000889E 1F pop ds 1240 assume ds:UPB 0 0000889F 7517 JNE SHORT IGNORE_SDSB 0 000088A1 1E5750 SAVEREG ; THEN 0 000088A4 8A4505 MOV AL,[DI + DRIVELET] ; IF (CURR_DRV == REQ_DRV) 0 000088A7 88C4 MOV AH,AL 0 000088A9 31FF XOR DI,DI 0 000088AB 8EDF MOV DS,DI ; => 0 1247 assume ds:IVT 0 000088AD 86060405 XCHG AL,BYTE PTR [LSTDRV] ; THEN SWAP(CURR_DRV,REQ_DRV) 0 000088B1 38C4 CMP AH,AL ; ELSE 0 000088B3 585F1F RESTOREREG ; SWAP(CURR_DRV,REQ_DRV) 1251 assume ds:UPB 0 000088B6 7403 JE SINGLERET ; ISSUE SWAP_DSK_MSG 1253 1254 IGNORE_SDSB: 0 000088B8 E8[0000] CALL SWPDSK ; ASK USER FOR CORRECT DISK 1256 SINGLERET: 0 000088BB 58 POP AX 0 000088BC C3 RET 1259 1260 SINGLE_ERR_RET: 0 000088BD F9 STC 0 000088BE 5F POP DI ; RESTORE CURRENT BDS 0 000088BF 1F POP DS 1264 assume ds:UPB 0 000088C0 EBF9 JMP SHORT SINGLERET 1266 1267 DISKIO_unknown: 0 000088C2 B001 mov al, 1 ; unknown unit 0 000088C4 A9 db __TEST_IMM16 ; skip mov al 1270 BADDRIVE: 0 000088C5 B008 MOV AL,8 ;Sector not found 0 000088C7 A9 db __TEST_IMM16 ; skip mov al 1273 UnformattedDrive: ;AN004;AN005;AN006; 0 000088C8 B007 mov al,7 ;AN004;Unknown media;AN005;AN006; 1275 BadDrive_Ret: 0 000088CA F9 STC 0 000088CB C3 IORET: RET 1278 1279 1280 BOGUSSETTLE: 0 000088CC B00F MOV AL,NORMSETTLE ; SOMEONE HAS DIDDLED THE SETTLE 0 000088CE E9E002 JMP GOTSLOWSETTLE 1283 CHECKSINGLE ENDP 1284 ;------------------------------------------------------------ 1285 ; 1286 ; DISK I/O HANDLER 1287 ; 1288 ; AL = DRIVE NUMBER (0-6) 1289 ; AH = MEDIA DESCRIPTOR 1290 ; CX = SECTOR COUNT 1291 ; DX = FIRST SECTOR (low) 1292 ; [Start_Sec_H] = FIRST SECTOR (high) ;J.K. 32 bit calculation. 1293 ; ES:DI = TRANSFER ADDRESS 1294 ; [RFLAG]=OPERATION (2=READ, 3=WRITE) 1295 ; [VERIFY]=1 FOR VERIFY AFTER WRITE 1296 ; 1297 ; IF SUCCESSFUL CARRY FLAG = 0 1298 ; ELSE CF=1 AND AL CONTAINS ERROR CODE 1299 ; 1300 PUBLIC DISKRD 1301 DISKRD PROC NEAR 0 000088D1 E8[0000] call biocode_get_ds_dosbiodata 1303 assume ds:DOSGROUP 0 000088D4 C606[0000]02 MOV byte [RFLAG],ROMREAD 1305 ; SETDRIVE overwrites ds, so no need to restore 1306 1307 DISKIO: 0 000088D9 89FB MOV BX,DI ; ES:BX = TRANSFER ADDRESS 0 000088DB E825FF CALL SETDRIVE ; MAP LOGICAL AND PHYSICAL 1310 assume ds:UPB 0 000088DE 72E2 jc DISKIO_unknown 0 000088E0 8A4510 MOV AL,BYTE PTR [DI + MEDIAD] 0 000088E3 1E push ds 0 000088E4 E8[0000] call biocode_get_ds_dosbiodata 1315 assume ds:DOSGROUP 0 000088E7 A2[0000] MOV [MEDBYT],AL ; PRESERVE MEDIA BYTE FOR DRIVE FOR USE 1317 ; IN DETERMINING MEDIA CHANGE. 0 000088EA 1F pop ds 1319 assume ds:UPB 0 000088EB E3DE JCXZ IORET 1321 ;SB34DISK006****************************************************************** 1322 ;SB See if the Media is formatted or not by checking the flags field in 1323 ;SB in the BDS. If it is unformatted we cannot allow I/O, so we should 1324 ;SB go to the error exit at label UnformattedDrive. 2LOCS 1325 0 000088ED F745230002 test word ptr [di + FLAGS], UNFORMATTED_MEDIA 0 000088F2 75D4 jnz UnformattedDrive 1328 ;SB34DISK006****************************************************************** 0 000088F4 1E push ds 0 000088F5 E8[0000] call biocode_get_ds_dosbiodata 1331 assume ds:DOSGROUP 0 000088F8 890E[0000] mov [SECCNT],CX ;save sector count 0 000088FC 8926[0000] MOV [SPSAV],SP ; SAVE SP 0 00008900 8306[0000]02 add word [SPSAV], 2 ; discard ds off the stack 0 00008905 1F pop ds 1336 assume ds:UPB 1337 1338 ; ENSURE THAT WE ARE TRYING TO ACCESS VALID SECTORS ON THE DRIVE 1339 ; 1340 0 00008906 89D0 mov ax,dx ;AN000; save DX to AX 0 00008908 31F6 xor si,si ;AN000; 0 0000890A 01CA add dx,cx ;AN000; 0 0000890C 83D600 adc si,0 ;AN000; 1345 DrvLim equ DRVLIM ; NASM port equate 0 0000890F 837D0E00 cmp word [di + DrvLim], 0 ;AN000; Is this drive > 32 bit sector ? 0 00008913 740C je Sanity32 ;AN000; 0 00008915 83FE00 cmp si,0 ;AN000; 0 00008918 75AB jne BADDRIVE ;AN000; 0 0000891A 3B550E cmp dx, [di + DrvLim] ;AN000; 0 0000891D 77A6 ja BADDRIVE ;AN000; 0 0000891F EB15 jmp short SanityOK ;AN000; 1353 Sanity32: ;AN000; 0 00008921 1E push ds 0 00008922 E8[0000] call biocode_get_ds_dosbiodata 1356 assume ds:DOSGROUP 0 00008925 0336[0000] add si, [Start_Sec_H] ;AN000; 0 00008929 1F pop ds 1359 assume ds:UPB 1360 DrvLim_H equ DRVLIM_H ; NASM port equate 0 0000892A 3B751D cmp si, [di + DrvLim_H] ;AN000; 0 0000892D 7207 jb SanityOK ;AN000; 0 0000892F 7794 ja BADDRIVE ;AN000; 1364 DrvLim_L equ DRVLIM_L ; NASM port equate 0 00008931 3B551B cmp dx, [di + DrvLim_L] ;AN000; 0 00008934 778F ja BADDRIVE ;AN000; 1367 SanityOK: ;AN000; 0 00008936 1E push ds 0 00008937 E8[0000] call biocode_get_ds_dosbiodata 1370 assume ds:DOSGROUP 0 0000893A 8B16[0000] mov dx,[Start_Sec_H] ;AN000; 0 0000893E 1F pop ds 1373 assume ds:UPB 0 0000893F 034517 add ax,word ptr [di + HIDSEC_L] ;AN000; 1375 Hidsec_H equ HIDSEC_H ; NASM port equate 0 00008942 135519 adc dx,word ptr [di + Hidsec_H] ;AN000; 1377 ;J.K. Now DX;AX have the physical first sector. 1378 ;Since the following procedures is going to destroy AX, let's 1379 ;save it temporarily to SAVED_WORD. 0 00008945 1E push ds 0 00008946 E8[0000] call biocode_get_ds_dosbiodata 1382 assume ds:DOSGROUP 0 00008949 A3[0000] mov [Saved_Word], ax ;AN000; Save the sector number (low) 1384 1385 ; MOV SI,DX 1386 ; ADD SI,CX 1387 ; ADD DX,WORD PTR [DI].HIDSEC ; ADD IN THE HIDDEN SECTORS 1388 ; CMP SI,WORD PTR [DI].DRVLIM ; COMPARE AGAINST DRIVE MAX 1389 ; JA BADDRIVE 1390 1391 ; SET UP POINTER TO DISK BASE TABLE IN [DPT]. WE CANNOT ASSUME THAT IOSETUP 1392 ; WILL DO IT BECAUSE WE WILL SKIP THE SET UP STUFF WITH HARD DISKS. 0 0000894C 31C0 XOR AX,AX 0 0000894E 8ED8 MOV DS,AX 1395 assume ds:IVT 0 00008950 FF367A00 push word [DSKADR + 2] 0 00008954 8B367800 mov SI, [DSKADR] ; CURRENT DISK PARM TABLE 0 00008958 E8[0000] call biocode_get_ds_dosbiodata 1399 assume ds:DOSGROUP 0 0000895B 8936[0000] MOV WORD PTR [DPT],SI 0 0000895F 8F06[0200] pop WORD PTR [DPT+2] 0 00008963 1F POP DS 1403 assume ds:UPB 0 00008964 F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 00008969 750E JNZ SKIP_SETUP 0 0000896B E8E5FE CALL CHECKSINGLE 1407 ; 1408 ; CHECK TO SEE IF WE HAVE PREVIOUSLY NOTED A CHANGE LINE. THE ROUTINE 1409 ; RETURNS IF EVERYTHING IS OK. OTHERWISE, IT POPS OFF THE STACK AND RETURNS 1410 ; THE PROPER ERROR CODE. 1411 ; 1412 ;----------------------------------------| 1413 ; WARNING: DO NOT CHANGE THE FOLLOWING. ;| 1414 ; IT GETS PATCHED IN MSINIT ;| 0 0000896E E8FA0F call ispatched 0 00008971 7203 jc @F 1417 PUBLIC DISKIO_PATCH ;| 1418 DISKIO_PATCH: ;| 0 00008973 E8[0000] CALL CHECKLATCHIO ;| 1420 @@: 1421 ;----------------------------------------| 1422 ; 1423 ; SET UP TABLES AND VARIABLES FOR I/O 0 00008976 E8F301 CALL IOSETUP 1425 ; 1426 ; NOW THE SETTLE VALUES ARE CORRECT FOR THE FOLLOWING CODE 1427 ; 1428 SKIP_SETUP: 1429 ;J.K. 32 bit sector calculation. 1430 ; DX;[Saved_Word] = starting sector number. 1431 0 00008979 F745230100 test word ptr [di + FLAGS], fNon_Removable ;Fixed disk? - J.K. 4/7/86 0 0000897E 741C jz DISK_NOT_MINI ;no, skip this. - J.K. 4/7/86 0 00008980 837D4701 cmp word [di + IsMini], 1 ;Is this a mini disk? - J.K. 4/7/86 0 00008984 7516 jnz DISK_NOT_MINI ;No. continue to next.- J.K. 4/7/86 0 00008986 89D1 mov cx, dx ; cx = high word sector number 0 00008988 8B4513 mov ax, [di + SECLIM] ; ax = number of CHS sectors 0 0000898B F76515 mul word ptr [di + HDLIM] ; ax = sectors per cylinder (dx == zero) 0 0000898E F76549 mul word ptr [di + Hidden_Trks] ; dx:ax = how many hidden sectors to add 0 00008991 1E push ds 0 00008992 E8[0000] call biocode_get_ds_dosbiodata 1442 assume ds:DOSGROUP 0 00008995 0106[0000] add word ptr [Saved_Word], ax 0 00008999 1F pop ds 1445 assume ds:UPB 0 0000899A 11CA adc dx, cx ; add hidden sectors amount matching cyls 1447 DISK_NOT_MINI: 0 0000899C F745230004 test word ptr [di + FLAGS], F_LBA 0 000089A1 7517 jnz diskio_lba ; --> (NC) 0 000089A3 E86501 call lbatochs_saved_word 0 000089A6 720F jc BADDRIVE_Brdg 1452 ; 1453 ; WE ARE NOW SET UP FOR THE I/O. NORMALLY, WE CONSIDER THE DMA BOUNDARY 1454 ; VIOLATIONS HERE. NOT TRUE. WE PERFORM THE OPERATION AS IF EVERYTHING IS 1455 ; SYMMETRIC; LET THE INT 13 HANDLER WORRY ABOUT THE DMA VIOLATIONS. 1456 ; 0 000089A8 1E push ds 0 000089A9 E8[0000] call biocode_get_ds_dosbiodata 1459 assume ds:DOSGROUP 0 000089AC A1[0000] MOV AX, [SECCNT] 0 000089AF 1F pop ds 1462 assume ds:UPB 0 000089B0 E89802 CALL BLOCK 1464 diskio_done: 0 000089B3 E80302 CALL msbiodisk_DONE 0 000089B6 C3 RET 1467 1468 ; 1469 Baddrive equ BADDRIVE ; NASM port label 0 000089B7 E90BFF BADDRIVE_Brdg:jmp Baddrive 1471 ; 1472 1473 diskio_lba: 0 000089BA 1E push ds 0 000089BB E8[0000] call biocode_get_ds_dosbiodata 1476 assume ds:DOSGROUP 0 000089BE A1[0000] mov ax, word ptr [Saved_Word] 0 000089C1 8B0E[0000] mov cx, word ptr [SECCNT] 0 000089C5 1F pop ds 1480 assume ds:UPB 1481 diskio_lba_loop: 0 000089C6 E3EB jcxz diskio_done 0 000089C8 E82A02 call ishma_lba 0 000089CB 7368 jnc .nothma 0 000089CD 06 push es 0 000089CE 53 push bx 0 000089CF 51 push cx 1488 0 000089D0 1E push ds 0 000089D1 E8[0000] call biocode_get_ds_dosbiodata 1491 assume ds:DOSGROUP 0 000089D4 803E[0000]02 cmp byte [RFLAG], ROMREAD 0 000089D9 7413 je .hma_read 0 000089DB 06 push es 0 000089DC 57 push di 0 000089DD 56 push si 0 000089DE 06 push es 0 000089DF 1F pop ds 1499 assume ds:nothing 0 000089E0 89DE mov si, bx 0 000089E2 E8[0000] call biocode_get_es_dosentry 1502 assume es:DOSENTRYGROUP 0 000089E5 BF[0000] mov di, DISKSECTOR 0 000089E8 E8500F call MOVE 0 000089EB 5E pop si 0 000089EC 5F pop di 0 000089ED 07 pop es 1508 assume es:nothing 1509 .hma_read: 0 000089EE 1F pop ds 1511 assume ds:UPB 0 000089EF E8[0000] call biocode_get_es_dosentry 1513 assume es:DOSENTRYGROUP 0 000089F2 BB[0000] mov bx, DISKSECTOR 0 000089F5 B90100 mov cx, 1 0 000089F8 E86D00 call diskio_lba_simple 0 000089FB 59 pop cx 0 000089FC 5B pop bx 0 000089FD 07 pop es 1520 assume es:nothing 1521 0 000089FE 1E push ds 0 000089FF E8[0000] call biocode_get_ds_dosbiodata 1524 assume ds:DOSGROUP 0 00008A02 803E[0000]02 cmp byte [RFLAG], ROMREAD 0 00008A07 1F pop ds 1527 assume ds:UPB 0 00008A08 7511 jne .hma_write 0 00008A0A 1E push ds 0 00008A0B 56 push si 0 00008A0C 57 push di 0 00008A0D 89DF mov di, bx 0 00008A0F E8[0000] call biocode_get_ds_dosentry 1534 assume ds:DOSENTRYGROUP 0 00008A12 BE[0000] mov si, DISKSECTOR 0 00008A15 E8230F call MOVE 0 00008A18 5F pop di 0 00008A19 5E pop si 0 00008A1A 1F pop ds 1540 assume ds:UPB 1541 .hma_write: 0 00008A1B 83E901 sub cx, 1 0 00008A1E 80C702 add bh, 512 / 256 0 00008A21 1E push ds 0 00008A22 E8[0000] call biocode_get_ds_dosbiodata 1546 assume ds:DOSGROUP 0 00008A25 A1[0800] mov ax, word ptr [lbapacket + lpSector] 0 00008A28 8B16[0A00] mov dx, word ptr [lbapacket + lpSector + 2] 0 00008A2C 1F pop ds 1550 assume ds:UPB 0 00008A2D 83C001 add ax, 1 0 00008A30 83D200 adc dx, 0 0 00008A33 EB91 jmp diskio_lba_loop 1554 1555 .nothma: 0 00008A35 81F98000 cmp cx, 128 0 00008A39 7227 jb diskio_lba_call_simple 0 00008A3B 51 push cx 0 00008A3C B97F00 mov cx, 127 0 00008A3F E82600 call diskio_lba_simple 0 00008A42 59 pop cx 0 00008A43 8CC0 mov ax, es 0 00008A45 05E00F add ax, 127 * 512 / 16 0 00008A48 8EC0 mov es, ax 1565 assume es:nothing 0 00008A4A 83E97F sub cx, 127 0 00008A4D 1E push ds 0 00008A4E E8[0000] call biocode_get_ds_dosbiodata 1569 assume ds:DOSGROUP 0 00008A51 A1[0800] mov ax, word ptr [lbapacket + lpSector] 0 00008A54 8B16[0A00] mov dx, word ptr [lbapacket + lpSector + 2] 0 00008A58 1F pop ds 1573 assume ds:UPB 0 00008A59 83C07F add ax, 127 0 00008A5C 83D200 adc dx, 0 0 00008A5F E964FF jmp diskio_lba_loop 1577 1578 diskio_lba_call_simple: 0 00008A62 E80300 call diskio_lba_simple 0 00008A65 E94BFF jmp diskio_done 1581 1582 diskio_lba_simple: 0 00008A68 8A6D04 mov ch, byte ptr [di + DRIVENUM] 0 00008A6B 1E push ds 0 00008A6C 56 push si 0 00008A6D E8E400 call lba_packet_setup 1587 assume ds:DOSGROUP 0 00008A70 BD0500 MOV BP,MAXERR ; SET UP RETRY COUNT 0 00008A73 892E[0000] mov [VRetry_Cnt], BP ;AN003;Verify op. retry cnt for Write-Verify. 0 00008A77 892E[0000] mov [Soft_ECC_Cnt], BP ;AN003;Soft ECC error retry count. 1591 diskio_lba_retry: 0 00008A7B B80040 mov ax, 4000h ; ah will be 42h, 43h, 44h 0 00008A7E 0A26[0000] or ah, [RFLAG] ; GET READ/WRITE INDICATOR 0 00008A82 FF7402 push word ptr [si + lpCount] 0 00008A85 88EA mov dl, ch 0 00008A87 CD13 int 13h 0 00008A89 8F4402 pop word ptr [si + lpCount] 0 00008A8C 7209 jc lba_noverify 0 00008A8E 813E[0000]0301 cmp word [WRTVERIFY], 103h ; CHECK FOR WRITE AND VERIFY 0 00008A94 7444 je lba_doverify 0 00008A96 F8 clc 1602 lba_noverify: 0 00008A97 5E pop si 0 00008A98 1F pop ds 1605 assume ds:UPB 0 00008A99 7201 jc diskio_lba_error 0 00008A9B C3 retn 1608 1609 diskio_lba_error: 0 00008A9C E8CC0E call ispatched 0 00008A9F 7203 jc @F 1612 PUBLIC DSKERR_LBA_PATCH 1613 DSKERR_LBA_PATCH: 0 00008AA1 E8[0000] CALL CHECKIO 1615 @@: 0 00008AA4 E8B20B CALL AGAIN 1617 lba_DskErr0: ;AN003; 0 00008AA7 742E JZ lba_HARDERR 0 00008AA9 F745230100 test word ptr [di + FLAGS], fNon_Removable ;AN009; 0 00008AAE 7505 jnz lba_Skip_TimeOut_Chk ;AN009; 0 00008AB0 80FC80 CMP AH,80H ;TIMEOUT? 0 00008AB3 7422 JZ lba_HARDERR ;*** 1623 lba_Skip_TimeOut_Chk: ;AN009; 0 00008AB5 1E push ds 0 00008AB6 E8[0000] call biocode_get_ds_dosbiodata 1626 assume ds:DOSGROUP 0 00008AB9 80FCCC cmp ah, 0cch ;AN003;Write Fault error? 0 00008ABC 7414 jz lba_Write_Fault_Err ;AN003; Then, don't retry. 0 00008ABE C706[0000]0500 mov word [Soft_ECC_Cnt], MAXERR ;AN003;Set Soft_ECC_Cnt back to MAXERR 1630 lba_DSKERR1: 0 00008AC4 1F pop ds 1632 assume ds:UPB 0 00008AC5 8A6D04 mov ch, byte ptr [di + DRIVENUM] 0 00008AC8 1E push ds 0 00008AC9 56 push si 0 00008ACA E8[0000] call biocode_get_ds_dosbiodata 1637 assume ds:DOSGROUP 0 00008ACD BE[0000] mov si, offset lbapacket ; access with ds 0 00008AD0 EBA9 JMP diskio_lba_retry 1640 1641 lba_Write_Fault_Err: ;AN003; 0 00008AD2 BD0100 mov bp, 1 ;AN003;Just retry only once for Write Fault error. 1643 lba_DskErr1 equ lba_DSKERR1 ; NASM port label 0 00008AD5 EBED jmp lba_DskErr1 ;AN003; 1645 1646 lba_HARDERR: 0 00008AD7 E96D03 jmp HARDERR 1648 1649 lba_doverify: 1650 assume ds:DOSGROUP 0 00008ADA B444 mov ah, 44h 0 00008ADC FF7402 push word ptr [si + lpCount] 0 00008ADF CD13 int 13h 0 00008AE1 8F4402 pop word ptr [si + lpCount] 0 00008AE4 73B1 jnc lba_noverify 1656 0 00008AE6 80FC11 cmp ah,11h ; SOFT ECC error ? 0 00008AE9 750C jnz .Not_SoftECC_Err 1659 ; here NC 0 00008AEB FF0E[0000] dec word [SOFT_ECC_CNT] 0 00008AEF 74A6 jz lba_noverify ; no more retry --> (NC) 0 00008AF1 E86A0B call ResetDisk ; reset disk 0 00008AF4 5E pop si 0 00008AF5 EBCD jmp lba_DskErr1 ; retry 1665 1666 .Not_SoftECC_Err: ;AN003;Other error. 0 00008AF7 E8640B call ResetDisk 0 00008AFA FF0E[0000] dec word [VRetry_Cnt] 0 00008AFE 5E pop si 0 00008AFF 1F pop ds 1671 assume ds:UPB 0 00008B00 EBA5 jmp lba_DskErr0 1673 1674 DISKRD ENDP 1675 1676 1677 ; INP: dx:ax = LBA 1678 ; ds:di -> UPB 1679 ; OUT: word [DOSDATA:CURTRK] = cylinder 1680 ; byte [DOSDATA:CURHD] = head 1681 ; byte [DOSDATA:CURSEC] = sector (1-based) 1682 ; CY if overflow 1683 ; CHG: dx, ax, cx 1684 public lbatochs 1685 lbatochs: 1686 assume ds:UPB, es:nothing, ss:nothing 0 00008B02 06 push es 0 00008B03 E8[0000] call biocode_get_es_dosbiodata 1689 assume es:DOSGROUP 0 00008B06 26A3[0000] mov word ptr [es:Saved_Word], ax 0 00008B0A A8 db __TEST_IMM8 ; skip push 1692 lbatochs_saved_word: 0 00008B0B 06 push es 1694 assume ds:UPB, es:nothing, ss:nothing 0 00008B0C E8[0000] call biocode_get_es_dosbiodata 1696 assume es:DOSGROUP 0 00008B0F 92 xchg ax, dx ; ax = high word, dx clobbered 0 00008B10 31D2 xor dx,dx ;AN000; 0 00008B12 F77513 DIV WORD PTR [DI + SECLIM] ;DIVIDE BY SEC PER TRACK 0 00008B15 26A3[0000] mov [es:Temp_H],ax ;AN000; 0 00008B19 26A1[0000] mov ax, [es:Saved_Word] ;AN000; Restore the lower word 1702 SecLim equ SECLIM ; NASM port equate 0 00008B1D F77513 div word ptr [di + SecLim] ;AN000; 1704 ;Now, [Temp_H],AX = track #, DX = sector 0 00008B20 FEC2 INC DL ;Sector number is 1 based. 0 00008B22 268816[0000] MOV [es:CURSEC],DL ;SAVE CURRENT SECTOR 0 00008B27 8B4D15 MOV CX,WORD PTR [DI + HDLIM] ;GET NUMBER OF HEADS 1708 0 00008B2A 50 push ax ;AN000; 0 00008B2B 31D2 XOR DX,DX ;DIVIDE TRACKS BY HEADS PER CYLINDER 0 00008B2D 26A1[0000] mov ax, [es:Temp_H] ;AN000; 0 00008B31 F7F1 DIV CX 0 00008B33 26A3[0000] mov [es:Temp_H],ax ;AN000; 0 00008B37 58 pop ax ;AN000; 0 00008B38 F7F1 div cx ;AN000; 1716 ;Now, [Temp_H],AX = cyliner #, DX = head 0 00008B3A 26833E[0000]00 cmp word [es:Temp_H],0 ;AN000; 0 00008B40 770F ja lbatochs_cy ;AN000; 0 00008B42 3D0004 cmp AX, 1024 ;AN000; 2**10 currently maxium for track #. 0 00008B45 730A jae lbatochs_cy ;AN000; 0 00008B47 268816[0000] MOV [es:CURHD],DL ;SAVE CURRENT HEAD 0 00008B4C 26A3[0000] MOV [es:CURTRK],AX ;SAVE CURRENT TRACK 0 00008B50 A8 db 0A8h ; test al, imm8 - skip stc and NC 1724 1725 lbatochs_cy: 0 00008B51 F9 stc 0 00008B52 07 pop es 1728 assume es:nothing 0 00008B53 C3 ret 1730 1731 1732 ; INP: es:bx -> transfer address 1733 ; cl = count 1734 ; dx:ax = sector number 1735 ; OUT: ds:si -> LBA packet 1736 ; ah = 42h 1737 public lba_packet_setup 1738 lba_packet_setup: 1739 assume ds:nothing, es:nothing, ss:nothing 0 00008B54 E8[0000] call biocode_get_ds_dosbiodata 1741 assume ds:DOSGROUP 0 00008B57 BE[0000] mov si, offset lbapacket ; access with ds 0 00008B5A 884C02 mov byte ptr [si + lpCount], cl 0 00008B5D 895C04 mov word ptr [si + lpBuffer], bx 0 00008B60 8C4406 mov word ptr [si + lpBuffer + 2], es 0 00008B63 894408 mov word ptr [si + lpSector + 0], ax 0 00008B66 89540A mov word ptr [si + lpSector + 2], dx 0 00008B69 B442 mov ah, 42h 0 00008B6B C3 retn 1750 1751 1752 ; SET THE DRIVE-LAST-ACCESSED FLAG FOR DISKETTE ONLY. WE KNOW THAT THE HARD 1753 ; DISK WILL NOT BE REMOVED. 1754 ; DS:DI -> CURRENT BDS. 1755 ; AX,CX,SI ARE DESTROYED. 1756 ; 1757 PUBLIC IOSETUP 1758 IOSETUP PROC NEAR 1759 assume ds:UPB, es:nothing, ss:nothing 0 00008B6C 8A4504 MOV AL,[DI + DRIVENUM] 0 00008B6F 06 push es 0 00008B70 E8[0000] call biocode_get_es_dosbiodata 1763 assume es:DOSGROUP 0 00008B73 26A2[0000] MOV [es:TIM_DRV],AL ; SAVE DRIVE LETTER 1765 ; 1766 ; DETERMINE PROPER HEAD SETTLE VALUES 1767 ; 0 00008B77 26803E[FF00]00 cmp byte [es:Media_Set_For_Format], 0 ;AN012; 0 00008B7D 7538 jne Skip_DPT_Setting ;AN012; 0 00008B7F 8CD9 MOV CX,DS 0 00008B81 26C536[0000] LDS SI,[es:DPT] ; GET POINTER TO DISK BASE TABLE 1772 assume ds:nothing 0 00008B86 26A0[0000] MOV AL,[es:EOT] 0 00008B8A 884404 MOV [SI + DISK_EOT],AL ; BUMP FOR US 0 00008B8D 8A440A MOV AL,[SI + DISK_MOTOR_STRT] ; PRESERVE OLD MOTOR START TIME 0 00008B90 26A2[0000] MOV [es:MOTORSTARTUP],AL 1777 ; 1778 ; FOR 3.5" DRIVES, BOTH EXTERNAL AS WELL AS ON THE K09, WE NEED TO SET THE 1779 ; MOTOR START TIME TO 4. THIS CHECKING FOR EVERY I/O IS GOING TO AFFECT 1780 ; PERFORMANCE ACROSS THE BOARD, BUT IS NECESSARY!! - RS 1781 ; 0 00008B94 06 PUSH ES 0 00008B95 8EC1 MOV ES,CX ; ES:DI -> TO CURRENT BDS 1784 assume es:UPB 0 00008B97 26807D2202 CMP BYTE PTR [ES:DI + FORMFACTOR],FFSMALL 0 00008B9C 7505 JNZ MOTOR_START_OK 0 00008B9E B004 MOV AL,4 0 00008BA0 86440A XCHG AL,[SI + DISK_MOTOR_STRT] 1789 MOTOR_START_OK: 0 00008BA3 07 POP ES 1791 assume es:DOSGROUP 1792 ; 1793 ; DS:SI NOW POINTS TO DISK PARAMETER TABLE. GET CURRENT SETTLE AND SET FAST 1794 ; SETTLE 1795 ; 0 00008BA4 30C0 XOR AL,AL 0 00008BA6 FEC0 INC AL ; IBM WANTS FAST SETTLE TO BE 1 - RS. 0 00008BA8 864409 XCHG AL,[SI + DISK_HEAD_STTL] ; GET SETTLE AND SET UP FOR FAST 0 00008BAB 26A2[0000] MOV [es:SETTLECURRENT],AL 0 00008BAF B00F MOV AL,NORMSETTLE ; SOMEONE HAS DIDDLED THE SETTLE 1801 GOTSLOWSETTLE: 0 00008BB1 8ED9 MOV DS,CX 1803 assume ds:UPB 0 00008BB3 26A2[0000] MOV [es:SETTLESLOW],AL 1805 Skip_DPT_Setting: ;AN012; 0 00008BB7 07 pop es 1807 assume es:nothing 0 00008BB8 C3 RET 1809 ; 1810 ; SET TIME OF LAST ACCESS, AND RESET DEFAULT VALUES IN THE DPT. 1811 ; 1812 msbiodisk_DONE: 0 00008BB9 F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 00008BBE 7534 JNZ RETZ ; DO NOT SET FOR NON-REMOVABLE MEDIA 0 00008BC0 E8FE02 CALL SET_TIM ; SET TIME OF LAST ACCESS FOR DRIVE 1816 ; 1817 ; RESTORE HEAD SETTLE AND EOT VALUES 1818 ; 1819 DIDDLEBACK: 1820 assume ds:nothing, es:nothing, ss:nothing 0 00008BC3 9C pushf ;AN013;Save flag 0 00008BC4 06 push es 0 00008BC5 E8[0000] call biocode_get_es_dosbiodata 1824 assume es:DOSGROUP 0 00008BC8 26803E[FF00]00 cmp byte [es:Media_Set_For_Format], 0 ;AN012; 0 00008BCE 7522 jne NoDiddleBack ;AN012; 0 00008BD0 50 PUSH AX 0 00008BD1 8CDA MOV DX,DS 0 00008BD3 26A0[0000] MOV AL,[es:SETTLECURRENT] 0 00008BD7 268A26[0000] MOV AH,[es:MOTORSTARTUP] 0 00008BDC 26C536[0000] LDS SI,[es:DPT] 1832 assume ds:nothing 1833 ; MOV [SI].DISK_EOT,9 ;J.K. 4/25/86. Should not change the EOT value 1834 ;of diskbase to 9. This cause a problem 1835 ;with 1.44M diskette in Polaris when the user 1836 ;issue INT 13 with the default system 1837 ;diskbase. 0 00008BE1 C6440409 mov byte [si + DISK_EOT],9 ;J.K. 11/5/86. For compatibility reason, return 1839 ;back to set it to 9 ( PTM826 ). 0 00008BE5 884409 MOV [SI + DISK_HEAD_STTL],AL 0 00008BE8 C6440302 MOV byte [SI + DISK_SECTOR_SIZ],2 0 00008BEC 88640A MOV [SI + DISK_MOTOR_STRT],AH 0 00008BEF 8EDA MOV DS,DX 1844 assume ds:nothing 0 00008BF1 58 POP AX 1846 NoDiddleBack: ;AN013; 0 00008BF2 07 pop es 1848 assume es:nothing 0 00008BF3 9D popf ;AN013;Restore flag 1850 RETZ: 0 00008BF4 C3 RET 1852 1853 ishma_lba: 1854 assume ds:nothing, es:nothing, ss:nothing 0 00008BF5 50 push ax 0 00008BF6 51 push cx 0 00008BF7 53 push bx 0 00008BF8 1E push ds 0 00008BF9 E8[0000] call biocode_get_ds_dosbiodata 1860 assume ds:DOSGROUP 0 00008BFC D006[0D01] rol byte [config_bounce_any_lba], 1 0 00008C00 7228 jc ishma_chs.ret ; always bounce --> 0 00008C02 D006[0B01] rol byte [config_bounce_uma_lba], 1 0 00008C06 7227 jc ishma_chs.uma 0 00008C08 D006[0901] rol byte [config_bounce_hma_lba], 1 0 00008C0C EB17 jmp ishma_chs.none_or_hma 1867 1868 ishma_chs: 1869 assume ds:nothing, es:nothing, ss:nothing 0 00008C0E 50 push ax 0 00008C0F 51 push cx 0 00008C10 53 push bx 0 00008C11 1E push ds 0 00008C12 E8[0000] call biocode_get_ds_dosbiodata 1875 assume ds:DOSGROUP 0 00008C15 D006[0C01] rol byte [config_bounce_any_chs], 1 0 00008C19 720F jc .ret ; always bounce --> 0 00008C1B D006[0A01] rol byte [config_bounce_uma_chs], 1 0 00008C1F 720E jc .uma 0 00008C21 D006[0801] rol byte [config_bounce_hma_chs], 1 1881 .none_or_hma: 0 00008C25 7303 jnc .ret 1883 .hma: 0 00008C27 E81300 call .getax 1885 .ret: 0 00008C2A 1F pop ds 1887 assume ds:nothing 0 00008C2B 5B pop bx 0 00008C2C 59 pop cx 0 00008C2D 58 pop ax 0 00008C2E C3 retn 1892 1893 .uma: 1894 assume ds:DOSGROUP 0 00008C2F E80B00 call .getax 0 00008C32 7209 jc @F ; if in HMA, treat as UMA bounce too --> 1897 extern ENDMEM 0 00008C34 3B06[0000] cmp ax, [ENDMEM] ; CY if end < UMA, NC if end >= UMA start 0 00008C38 74F0 jz .ret ; if end == UMA start --> (NC) 0 00008C3A F5 cmc ; CY if end > UMA start 0 00008C3B EBED jmp .ret 1902 @@: 1903 1904 .getax: 0 00008C3D 8CC0 mov ax, es 0 00008C3F B104 mov cl, 4 0 00008C41 D3EB shr bx, cl 0 00008C43 01D8 add ax, bx 0 00008C45 7203 jc @F 0 00008C47 83C020 add ax, paras(512) 1911 @@: 0 00008C4A C3 retn 1913 1914 ;READ THE NUMBER OF SECTORS SPECIFIED IN AX, HANDLING TRACK BOUNDARIES 1915 ;DS:DI -> BDS FOR THIS DRIVE 1916 BLOCK: 1917 assume ds:UPB, es:nothing, ss:nothing 0 00008C4B 85C0 test AX,AX ;SEE IF ANY SECTORS TO READ 0 00008C4D 74A5 JZ RETZ ; fixme 0 00008C4F E8BCFF call ishma_chs 0 00008C52 730C jnc .nothma 0 00008C54 1E push ds 0 00008C55 E8[0000] call biocode_get_ds_dosbiodata 1924 assume ds:DOSGROUP 0 00008C58 C606[0701]FF mov byte [hma_operation], 0FFh 0 00008C5D 1F pop ds 1927 assume ds:UPB 0 00008C5E EB1A jmp BLOCK_FLOPPY 1929 .nothma: 1930 ;Fixed disk will not be restricted to the track-by-track basis. -J.K.4/10/86 1931 Flags equ FLAGS ; NASM port equate 0 00008C60 F745230100 test word ptr [di + Flags], fNon_Removable ;J.K. Fixed disk? 0 00008C65 7413 jz BLOCK_FLOPPY ;J.K. 1934 ;SB34DISK002***************************************************************** 1935 ;SB Check to see if multi track operation is allowed. If not 1936 ;SB we have to go to the block_floppy below to break up the operation. 1937 ;SB 2 LOCS 0 00008C67 1E push ds 0 00008C68 E8[0000] call biocode_get_ds_dosbiodata 1940 assume ds:DOSGROUP 1941 MulTrk_ON equ MULTRK_ON ; NASM port equate 0 00008C6B F706[0000]8000 test word [MulTrk_Flag], MulTrk_ON 0 00008C71 1F pop ds 1944 assume ds:UPB 0 00008C72 7406 jz BLOCK_FLOPPY 1946 ;SB34DISK002***************************************************************** 0 00008C74 E8A600 call DISK ;J.K. 0 00008C77 31C0 xor ax,ax 0 00008C79 C3 RET ;J.K. 1950 BLOCK_FLOPPY: ;J.K.4/10/86 1951 ; 1952 ; READ AT MOST 1 TRACK WORTH. PERFORM MINIMIZATION AT SECTOR / TRACK 1953 ; 0 00008C7A 8A4D13 MOV CL,BYTE PTR [DI + SECLIM] 0 00008C7D FEC1 INC CL 0 00008C7F 1E push ds 0 00008C80 E8[0000] call biocode_get_ds_dosbiodata 1958 assume ds:DOSGROUP 0 00008C83 2A0E[0000] SUB CL,[CURSEC] ; LEEAC 3.20 ADD SEGMENT OVERRIDE 0 00008C87 D006[0701] rol byte [hma_operation], 1 0 00008C8B 731D jnc .nohma 0 00008C8D 803E[0000]02 cmp byte [RFLAG], ROMREAD 0 00008C92 7413 je .hma_read 0 00008C94 06 push es 0 00008C95 57 push di 0 00008C96 56 push si 0 00008C97 06 push es 0 00008C98 1F pop ds 1969 assume ds:nothing 0 00008C99 89DE mov si, bx 0 00008C9B E8[0000] call biocode_get_es_dosentry 1972 assume es:DOSENTRYGROUP 0 00008C9E BF[0000] mov di, DISKSECTOR ; access with es 0 00008CA1 E8970C call MOVE 0 00008CA4 5E pop si 0 00008CA5 5F pop di 0 00008CA6 07 pop es 1978 assume es:nothing 1979 .hma_read: 0 00008CA7 F9 stc 0 00008CA8 B101 mov cl, 1 1982 .nohma: 0 00008CAA 1F pop ds 1984 assume ds:UPB 0 00008CAB 7308 jnc @F 0 00008CAD 06 push es 0 00008CAE 53 push bx 0 00008CAF E8[0000] call biocode_get_es_dosentry 1989 assume es:DOSENTRYGROUP 0 00008CB2 BB[0000] mov bx, DISKSECTOR ; access with es 1991 @@: 1992 assume es:nothing 0 00008CB5 30ED XOR CH,CH 0 00008CB7 39C8 CMP AX,CX 0 00008CB9 7302 JAE GOTMIN 0 00008CBB 89C1 MOV CX,AX 1997 GOTMIN: 1998 ; 1999 ; AX IS THE REQUESTED NUMBER OF SECTORS TO READ 2000 ; CX IS THE NUMBER THAT WE CAN DO ON THIS TRACK 2001 ; 0 00008CBD 50 PUSH AX 0 00008CBE 51 PUSH CX 0 00008CBF 89C8 MOV AX,CX ; AL IS NUMBER OF SECTORS TO READ 0 00008CC1 E85900 CALL DISK 0 00008CC4 59 POP CX 0 00008CC5 58 POP AX 2008 0 00008CC6 1E push ds 0 00008CC7 E8[0000] call biocode_get_ds_dosbiodata 2011 assume ds:DOSGROUP 0 00008CCA D006[0701] rol byte [hma_operation], 1 0 00008CCE 7325 jnc .nohma 0 00008CD0 F616[0701] not byte [hma_operation] 0 00008CD4 803E[0000]02 cmp byte [RFLAG], ROMREAD 0 00008CD9 7516 jne .hma_write 0 00008CDB 1F pop ds 2018 assume ds:UPB 0 00008CDC 5B pop bx 0 00008CDD 07 pop es 2021 assume es:nothing 0 00008CDE 1E push ds 0 00008CDF 56 push si 0 00008CE0 57 push di 0 00008CE1 89DF mov di, bx 0 00008CE3 E8[0000] call biocode_get_ds_dosentry 2027 assume ds:DOSENTRYGROUP 0 00008CE6 BE[0000] mov si, DISKSECTOR ; access with ds 0 00008CE9 E84F0C call MOVE 0 00008CEC 5F pop di 0 00008CED 5E pop si 0 00008CEE 1F pop ds 2033 assume ds:UPB 0 00008CEF EB05 jmp @F 2035 .hma_write: 0 00008CF1 1F pop ds 2037 assume ds:UPB 0 00008CF2 5B pop bx 0 00008CF3 07 pop es 2040 assume es:nothing 0 00008CF4 A8 db __TEST_IMM8 ; skip pop 2042 .nohma: 0 00008CF5 1F pop ds 2044 assume ds:UPB 2045 @@: 2046 2047 ; 2048 ; CX IS THE NUMBER OF SECTORS JUST TRANSFERRED 2049 ; 0 00008CF6 29C8 SUB AX,CX ; REDUCE SECTORS-REMAINING BY LAST I/O 0 00008CF8 D0E1 SHL CL,1 0 00008CFA 00CF ADD BH,CL ; ADJUST TRANSFER ADDRESS 0 00008CFC E94CFF JMP BLOCK 2054 IOSETUP ENDP 2055 2056 DskErr equ DSKERR ; NASM port label 0 00008CFF E9FF00 DskErr_Brdg: jmp DskErr ;AN003; 2058 2059 2060 ; INP: variables from lbatochs 2061 ; ds:di -> UPB 2062 ; OUT: cx:dx = tuple value 2063 public chstotuple 2064 chstotuple: 2065 assume ds:UPB, es:nothing, ss:nothing 0 00008D02 1E push ds 0 00008D03 E8[0000] call biocode_get_ds_dosbiodata 2068 assume ds:DOSGROUP 0 00008D06 8B0E[0000] MOV cx, [CURTRK] ;LOAD CURRENT CYLINDER 0 00008D0A D0CD ROR ch, 1 0 00008D0C D0CD ROR ch, 1 2072 0 00008D0E 0A2E[0000] OR ch, [CURSEC] 0 00008D12 86E9 XCHG CH,CL ; CL = SECTOR, CH = CYLINDER 0 00008D14 8A36[0000] MOV DH,BYTE PTR [CURHD] ; LOAD CURRENT HEAD NUMBER AND 0 00008D18 1F pop ds 2077 assume ds:UPB 0 00008D19 8A5504 MOV DL,BYTE PTR [DI + DRIVENUM] ; PHYSICAL DRIVE NUMBER 0 00008D1C C3 ret 2080 2081 ; 2082 ;PERFORM DISK I/O WITH RETRIES 2083 ; AL = NUMBER OF SECTORS (1-8, ALL ON ONE TRACK) 2084 ; DI POINT TO DRIVE PARAMETERS 2085 ; ES:BX = TRANSFER ADDRESS (MUST NOT CROSS A 64K PHYSICAL BOUNDARY) 2086 ; [RFLAG] = 2 IF READ, 3 IF WRITE 2087 ; [VERIFY] = 0 FOR NORMAL, 1 FOR VERIFY AFTER WRITE 2088 2089 PUBLIC DISK 2090 DISK PROC NEAR 2091 assume ds:UPB, es:nothing, ss:nothing 0 00008D1D BD0500 MOV BP,MAXERR ; SET UP RETRY COUNT 0 00008D20 1E push ds 0 00008D21 E8[0000] call biocode_get_ds_dosbiodata 2095 assume ds:DOSGROUP 0 00008D24 892E[0000] mov [VRetry_Cnt], BP ;AN003;Verify op. retry cnt for Write-Verify. 0 00008D28 892E[0000] mov [Soft_ECC_Cnt], BP ;AN003;Soft ECC error retry count. 0 00008D2C 8A26[0000] MOV AH,[RFLAG] ;GET READ/WRITE INDICATOR 0 00008D30 1F pop ds 2100 assume ds:UPB 2101 2102 RETRY: 2103 assume ds:UPB 0 00008D31 50 PUSH AX 2105 0 00008D32 E8CDFF call chstotuple 0 00008D35 807D2205 CMP BYTE PTR [DI + FORMFACTOR],FFHARDFILE 0 00008D39 7419 JZ DO_FAST ; HARD FILES USE FAST SPEED 2109 ; IF WE HAVE [STEP_DRV] SET TO -1, WE USE THE SLOW SETTLE TIME. 2110 ; THIS HELPS WHEN WE HAVE JUST DONE A RESED DISK OPERATION AND THE HEAD HAS 2111 ; BEEN MOVED TO ANOTHER CYLINDER - THE PROBLEM CROPS UP WITH 3.5" DRIVES. 0 00008D3B 1E push ds 0 00008D3C E8[0000] call biocode_get_ds_dosbiodata 2114 assume ds:DOSGROUP 0 00008D3F 803E[0000]FF CMP byte [STEP_DRV],-1 0 00008D44 1F pop ds 2117 assume ds:UPB 0 00008D45 740A JZ DO_WRITEJ 0 00008D47 80FC02 CMP AH,ROMREAD ; ARR 2.20 0 00008D4A 7408 JE DO_FAST 0 00008D4C 80FC04 CMP AH, ROMVERIFY 0 00008D4F 7403 JE DO_FAST 2123 DO_WRITEJ: 2124 ; READS ALWAYS FAST, UNLESS WE HAVE JUST DONE A DISK RESET OPERATION 0 00008D51 EB6B JMP DO_WRITE ; ARR 2.20 READS ALWAYS FAST 0 00008D53 90 nop ; identicalise 2127 DO_FAST: ; ARR 2.20 0 00008D54 E84201 CALL FASTSPEED ; MZ 2.21 CHANGE SETTLE MODE 2129 TESTERR: ; MZ 2.21 2130 DSKERR_brdg equ DskErr_Brdg ; NASM port label 0 00008D57 72A6 JC DSKERR_brdg 2132 ; SET DRIVE AND TRACK OF LAST ACCESS 0 00008D59 886D46 MOV BYTE PTR [DI + TRACK],CH ; ARR 2.20 SAVE TRACK 0 00008D5C 1E push ds 0 00008D5D E8[0000] call biocode_get_ds_dosbiodata 2136 assume ds:DOSGROUP 0 00008D60 8816[0000] MOV [STEP_DRV],DL ; ARR 2.20 SET DRIVE 0 00008D64 813E[0000]0301 CMP word [WRTVERIFY],103H ; CHECK FOR WRITE AND VERIFY 0 00008D6A 1F pop ds 2140 assume ds:UPB 0 00008D6B 7466 JZ DOVERIFY 2142 NOVERIFY: 0 00008D6D 58 POP AX 2144 2145 ;SB34DISK003***************************************************************** 2146 ;SB Check the flags word in the BDS to see if the drive is non removable 2147 ;SB If not we needn't do anything special 2148 ;SB If it is a hard disk then check to see if multi-track operation 2149 ;SB is specified. If specified we don't have to calculate for the next 2150 ;SB track since we are already done. So we can go to the exit of this 2151 ;SB routine. 5 LOCS 2152 2153 fNON_REMOVABLE equ FNON_REMOVABLE ; NASM port equate 0 00008D6E F745230100 test word ptr [di + FLAGS], fNON_REMOVABLE 0 00008D73 1E push ds 0 00008D74 E8[0000] call biocode_get_ds_dosbiodata 2157 assume ds:DOSGROUP 0 00008D77 7408 jz ITS_REMOVABLE 0 00008D79 F706[0000]8000 test word [MulTrk_Flag], MulTrk_ON 0 00008D7F 753A jnz DISK_RET 2161 ITS_REMOVABLE: 2162 ;SB34DISK003***************************************************************** 0 00008D81 80E13F AND CL,03FH ; ELIMINATE CYLINDER BITS FROM SECTOR 0 00008D84 30E4 XOR AH,AH 0 00008D86 2906[0000] SUB [SECCNT],AX ; REDUCE COUNT OF SECTORS TO GO 0 00008D8A 00C1 ADD CL,AL ; NEXT SECTOR 0 00008D8C 880E[0000] MOV [CURSEC],CL 0 00008D90 1F pop ds 2169 assume ds:UPB 0 00008D91 1E push ds 0 00008D92 3A4D13 CMP CL,BYTE PTR [DI + SECLIM] ; SEE IF SECTOR/TRACK LIMIT REACHED 0 00008D95 E8[0000] call biocode_get_ds_dosbiodata 2173 assume ds:DOSGROUP 0 00008D98 7621 JBE DISK_RET 2175 NEXTTRACK: 0 00008D9A C606[0000]01 MOV byte [CURSEC],1 ; START WITH FIRST SECTOR OF NEXT TRACK 0 00008D9F 8A36[0000] MOV DH,[CURHD] 0 00008DA3 FEC6 INC DH 0 00008DA5 740A jz nexttrack_xor 0 00008DA7 1F pop ds 2181 assume ds:UPB 0 00008DA8 1E push ds 0 00008DA9 3A7515 CMP DH,BYTE PTR [DI + HDLIM] 0 00008DAC E8[0000] call biocode_get_ds_dosbiodata 2185 assume ds:DOSGROUP 0 00008DAF 7206 JB NOXOR 2187 nexttrack_xor: 0 00008DB1 30F6 XOR DH,DH 0 00008DB3 FF06[0000] INC word [CURTRK] ;NEXT TRACK 2190 NOXOR: 0 00008DB7 8836[0000] MOV [CURHD],DH 2192 DISK_RET: 0 00008DBB 1F pop ds 2194 assume ds:UPB 0 00008DBC F8 CLC ; LEEAC 0 00008DBD C3 RET 2197 DISK ENDP 2198 2199 2200 ; THE REQUEST IS FOR WRITE. DETERMINE IF WE ARE TALKING ABOUT THE SAME 2201 ; TRACK AND DRIVE. IF SO, USE THE FAST SPEED. 2202 2203 DO_WRITE PROC NEAR 0 00008DBE 1E push ds 0 00008DBF E8[0000] call biocode_get_ds_dosbiodata 2206 assume ds:DOSGROUP 0 00008DC2 3A16[0000] CMP DL,[STEP_DRV] ; ARR 2.20 0 00008DC6 1F pop ds 2209 assume ds:UPB 0 00008DC7 7505 JNZ DO_NORM ; WE HAVE CHANGED DRIVES 2211 0 00008DC9 3A6D46 CMP CH,BYTE PTR [DI + TRACK] ; ARR 2.20 0 00008DCC 7486 JZ DO_FAST ; WE ARE STILL ON THE SAME TRACK 2214 2215 DO_NORM: 0 00008DCE E89600 CALL NORMSPEED 0 00008DD1 EB84 JMP SHORT TESTERR ; MZ 2.21 TEST FOR ERROR 2218 DO_WRITE ENDP 2219 ; 2220 ; WE HAVE A VERIFY REQUEST ALSO. GET STATE INFO AND GO VERIFY 2221 ; 2222 2223 DOVERIFY PROC NEAR 0 00008DD3 58 POP AX ; RESTORE SECTOR COUNT 0 00008DD4 50 PUSH AX 0 00008DD5 B404 MOV AH,ROMVERIFY ; REQUEST VERIFY 0 00008DD7 E8BF00 CALL FASTSPEED ; MZ 2.21 CHANGE SETTLE MODE 0 00008DDA 7391 JNC NOVERIFY 2229 2230 ;SB34DISK004************************************************************** 2231 ;SB check the error returned in AH to see if it is a SOFT ECC error. 2232 ;SB If it is not we needn't do anything special. If it is a SOFT 2233 ;SB ECC error then decrement the SOFT_ECC_CNT error retry count. If 2234 ;SB this retry count becomes 0 then we just ignore the error and go to 2235 ;SB No_verify but if we can still try then we call the routine to reset 2236 ;SB the disk and go to DSKerr1 to retry the operation. 6 LOCS 2237 0 00008DDC 80FC11 cmp ah,11h ;SOFT ECC error ? 0 00008DDF 7511 jnz Not_SoftECC_Err 2240 SOFT_ECC_CNT equ Soft_ECC_Cnt ; NASM port label 0 00008DE1 1E push ds 0 00008DE2 E8[0000] call biocode_get_ds_dosbiodata 2243 assume ds:DOSGROUP 0 00008DE5 FF0E[0000] dec word [SOFT_ECC_CNT] 0 00008DE9 1F pop ds 2246 assume ds:UPB 2247 NoVerify equ NOVERIFY ; NASM port label 0 00008DEA 7481 jz NoVerify ;no more retry 2249 ResetDisk equ RESETDISK ; NASM port label 0 00008DEC E86F08 call ResetDisk ;reset disk 2251 DskErr1 equ DSKERR1 ; NASM port label 0 00008DEF EB4D jmp DskErr1 ;retry 0 00008DF1 90 nop ; identicalise 2254 2255 ;SB34DISK004************************************************************** 2256 2257 Not_SoftECC_Err: ;AN003;Other error. 0 00008DF2 E86908 call ResetDisk ;AN003; 0 00008DF5 1E push ds 0 00008DF6 E8[0000] call biocode_get_ds_dosbiodata 2261 assume ds:DOSGROUP 0 00008DF9 FF0E[0000] dec word [VRetry_Cnt] ;AN003; 0 00008DFD 1F pop ds 2264 assume ds:UPB 0 00008DFE EB20 jmp DskErr0 ;AN003; 0 00008E00 90 nop ; identicalise 2267 DOVERIFY ENDP 2268 ; 2269 ; NEED TO SPECIAL CASE THE CHANGE-LINE ERROR AH=06H. IF WE GET THIS, WE 2270 ; NEED TO RETURN IT. 2271 ; 2272 ;----------------------------------------| 2273 ; WARNING: DO NOT CHANGE THE FOLLOWING. ;| 2274 ; IT GETS PATCHED IN MSINIT ;| 2275 PUBLIC DSKERR ;| 2276 DSKERR PROC NEAR ;| 0 00008E01 E8670B call ispatched 0 00008E04 7203 jc @F 2279 PUBLIC DSKERR_PATCH 2280 DSKERR_PATCH: 0 00008E06 E8[0000] CALL CHECKIO ;| 2282 @@: 2283 ;---------------------------------------;| 2284 0 00008E09 1E push ds 0 00008E0A E8[0000] call biocode_get_ds_dosbiodata 2287 assume ds:DOSGROUP 0 00008E0D 803E[0000]01 cmp byte [MultiTrk_Format_Flag], 1 ;AN007;Multi trk format request? 0 00008E12 7508 jne DoChkAgain ;AN007; 0 00008E14 BD0100 mov bp, 1 ;AN007;No more retry. 0 00008E17 C606[0000]00 mov byte [MultiTrk_Format_Flag], 0 ;AN007;Clear the flag. 2292 DoChkAgain: ;AN007; 0 00008E1C 1F pop ds 2294 assume ds:UPB 0 00008E1D E83908 CALL AGAIN 2296 DskErr0: ;AN003; 0 00008E20 7425 JZ HARDERR 0 00008E22 F745230100 test word ptr [di + FLAGS], fNon_Removable ;AN009; 0 00008E27 7505 jnz Skip_TimeOut_Chk ;AN009; 0 00008E29 80FC80 CMP AH,80H ;TIMEOUT? 0 00008E2C 7419 JZ HARDERR ;*** 2302 Skip_TimeOut_Chk: ;AN009; 0 00008E2E 80FCCC cmp ah, 0cch ;AN003;Write Fault error? 0 00008E31 740F jz Write_Fault_Err ;AN003; Then, don't retry. 0 00008E33 1E push ds 0 00008E34 E8[0000] call biocode_get_ds_dosbiodata 2307 assume ds:DOSGROUP 0 00008E37 C706[0000]0500 mov word [Soft_ECC_Cnt], MAXERR ;AN003;Set Soft_ECC_Cnt back to MAXERR 0 00008E3D 1F pop ds 2310 assume ds:UPB 2311 DSKERR1: 0 00008E3E 58 POP AX ;RESTORE SECTOR COUNT 0 00008E3F E9EFFE JMP RETRY 2314 2315 Write_Fault_Err: ;AN003; 0 00008E42 BD0100 mov bp, 1 ;AN003;Just retry only once for Write Fault error. 0 00008E45 EBF7 jmp DskErr1 ;AN003; 2318 2319 HARDERR: 2320 PUBLIC HARDERR 2321 0 00008E47 E85D00 CALL MAPERROR 2323 2324 HARDERR2: ; FOR ROUTINES THAT CALL MAPERROR THEMSELVES 2325 PUBLIC HARDERR2 2326 0 00008E4A 1E push ds 0 00008E4B E8[0000] call biocode_get_ds_dosbiodata 2329 assume ds:DOSGROUP 0 00008E4E 8F06[0000] pop word [dosbiodata_temp_ds] 0 00008E52 C606[0000]FF MOV byte [TIM_DRV],-1 ;FORCE A MEDIA CHECK THROUGH ROM 0 00008E57 8B0E[0000] MOV CX,[SECCNT] ;GET COUNT OF SECTORS TO GO 0 00008E5B 8B26[0000] MOV SP,[SPSAV] ;RECOVER ENTRY STACK POINTER 0 00008E5F 8E1E[0000] mov ds, word [dosbiodata_temp_ds] 2335 assume ds:UPB 2336 ; 2337 ; SINCE WE ARE PERFORMING A NON-LOCAL GOTO, RESTORE THE DISK PARAMETERS 2338 ; 2339 MEDBYT_OK: 0 00008E63 E85DFD CALL DIDDLEBACK 0 00008E66 C3 RET ;AND RETURN 2342 DSKERR ENDP 2343 2344 ; 2345 ; CHANGE SETTLE VALUE FROM SETTLECURRENT TO WHATEVER IS APPROPRIATE 2346 ; NOTE THAT THIS ROUTINE IS NEVER CALLED FOR A FIXED DISK. 2347 ; 2348 NORMSPEED PROC NEAR 0 00008E67 06 push es 0 00008E68 E8[0000] call biocode_get_es_dosbiodata 2351 assume es:DOSGROUP 0 00008E6B 26803E[FF00]00 cmp byte [es:Media_Set_For_Format], 0 ;AN012; 0 00008E71 7525 jne FASTSPEED_es ;AN012; 0 00008E73 1E PUSH DS 0 00008E74 50 PUSH AX 0 00008E75 26A0[0000] MOV AL,[es:SETTLESLOW] 0 00008E79 26C536[0000] LDS SI,[es:DPT] ; CURRENT DISK PARM TABLE 2358 assume ds:nothing 0 00008E7E 884409 MOV [SI + DISK_HEAD_STTL],AL 0 00008E81 58 POP AX 0 00008E82 1F POP DS 2362 assume ds:UPB 0 00008E83 07 pop es 2364 assume es:nothing 0 00008E84 E81200 CALL FASTSPEED 0 00008E87 06 push es 0 00008E88 E8[0000] call biocode_get_es_dosbiodata 2368 assume es:DOSGROUP 0 00008E8B 1E PUSH DS 0 00008E8C 26C536[0000] LDS SI,[es:DPT] 2371 assume ds:nothing 0 00008E91 C6440901 MOV byte [SI + DISK_HEAD_STTL],1 ; 1 IS FAST SETTLE VALUE 0 00008E95 1F POP DS 2374 assume ds:UPB 0 00008E96 07 pop es 2376 assume es:nothing 0 00008E97 C3 RET 2378 NORMSPEED ENDP 2379 2380 FASTSPEED_es: 0 00008E98 07 pop es 2382 assume es:nothing 2383 FASTSPEED PROC NEAR 2384 assume ds:UPB, es:nothing, ss:nothing 2385 ; 2386 ; IF THE DRIVE HAS BEEN MARKED AS TOO BIG (I.E. STARTING SECTOR OF THE 2387 ; PARTITION IS > 16 BITS, THEN ALWAYS RETURN DRIVE NOT READY. 2388 ; 0 00008E99 F6451F80 TEST BYTE PTR [DI + FATSIZ],FTOOBIG 2390 %IF itest 2391 JZ READY 2392 JMP NOTREADY 2393 READY: 2394 %ELSE 0 00008E9D 7503 JNZ NOTREADY 2396 %ENDIF 2397 2398 MESSAGE FTESTINIT,<"<"> 2399 MNUM FTESTINIT,AX 2400 MESSAGE FTESTINIT,<","> 2401 MNUM FTESTINIT,ES 2402 MESSAGE FTESTINIT,<":"> 2403 MNUM FTESTINIT 2404 MESSAGE FTESTINIT,<","> 2405 MNUM FTESTINIT,CX 2406 MESSAGE FTESTINIT,<","> 2407 MNUM FTESTINIT,DX 2408 MESSAGE FTESTINIT,<">"> 0 00008E9F CD13 INT 13H 2410 DEATH: 0 00008EA1 C3 RET 2412 NOTREADY: 0 00008EA2 F9 STC 0 00008EA3 B480 MOV AH,80H 0 00008EA5 EBFA JMP DEATH 2416 FASTSPEED ENDP 2417 2418 ; MAP ERROR RETURNED BY ROM IN AH INTO CORRESPONDING CODE TO BE RETURNED TO 2419 ; DOS IN AL. 2420 ; 2421 MAPERROR PROC NEAR 2422 PUBLIC MAPERROR 2423 0 00008EA7 51 PUSH CX ; SAVE CX 0 00008EA8 E8[0000] call biocode_get_es_dosbiodata 2426 assume es:DOSGROUP 2427 ;MAKE ES THE LOCAL SEGMENT 0 00008EAB 88E0 MOV AL,AH ;PUT ERROR CODE IN AL 0 00008EAD 26A2[0000] MOV [es:LSTERR],AL ;TERMINATE LIST WITH ERROR CODE 0 00008EB1 B9[0000] MOV CX,NUMERR ;NUMBER OF POSSIBLE ERROR CONDITIONS 0 00008EB4 BF[0000] MOV DI,OFFSET ERRIN ;POINT TO ERROR CONDITIONS ; access with es 0 00008EB7 F2AE REPNE SCASB 0 00008EB9 268A85[FFFF] MOV AL,[es:DI + NUMERR - 1] ;GET TRANSLATION 0 00008EBE 59 POP CX ; RESTORE CX 0 00008EBF F9 STC ;FLAG ERROR CONDITION 0 00008EC0 C3 RET 2437 MAPERROR ENDP 2438 2439 ; SET THE TIME OF LAST ACCESS FOR THIS DRIVE. THIS IS DONE ONLY FOR REMOVABLE 2440 ; MEDIA. 2441 2442 PUBLIC SET_TIM 2443 SET_TIM PROC NEAR 2444 assume ds:UPB, es:nothing, ss:nothing 0 00008EC1 50 PUSH AX 2446 ;SB33018****************************************************************** 0 00008EC2 30E4 xor AH, AH ; set command to get time ;SB;3.30* 0 00008EC4 CD1A int 1Ah ; call rom-bios timer function ;SB;3.30* 2449 ;SB33018****************************************************************** 0 00008EC6 08C0 OR AL,AL 0 00008EC8 7409 JZ NOROLL3 0 00008ECA 1E push ds 0 00008ECB E8[0000] call biocode_get_ds_dosbiodata 2454 assume ds:DOSGROUP 0 00008ECE FF06[0000] INC word [DAYCNT] ; CATCH ROLLOVER 0 00008ED2 1F pop ds 2457 assume ds:UPB 2458 NOROLL3: 2459 ; WE HAVE THE NEW TIME. IF WE SEE THAT THE TIME HAS PASSED, THEN WE RESET 2460 ; THE THRESHOLD COUNTER... 0 00008ED3 3B5547 CMP DX,WORD PTR [DI + TIM_LO] 0 00008ED6 7505 JNZ SETACCESS 0 00008ED8 3B4D49 CMP CX,WORD PTR [DI + TIM_HI] 0 00008EDB 7410 JZ DONE_SET 2465 SETACCESS: 0 00008EDD 1E push ds 0 00008EDE E8[0000] call biocode_get_ds_dosbiodata 2468 assume ds:DOSGROUP 0 00008EE1 C606[0000]00 MOV BYTE PTR [ACCESSCOUNT],0 0 00008EE6 1F pop ds 2471 assume ds:UPB 0 00008EE7 895547 MOV WORD PTR [DI + TIM_LO],DX ;SAVE IT 0 00008EEA 894D49 MOV WORD PTR [DI + TIM_HI],CX 2474 DONE_SET: 0 00008EED F8 CLC 0 00008EEE 58 POP AX 0 00008EEF C3 RET 2478 SET_TIM ENDP 2479 2480 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 2481 2482 ; 2483 ; THIS IS THE TRUE INT 13 HANDLER. WE PARSE THE REQUEST TO SEE IF THERE IS 2484 ; A DMA VIOLATION. IF SO, DEPENDING ON THE FUNCTION, WE: 2485 ; READ/WRITE BREAK THE REQUEST INTO THREE PIECES AND MOVE THE MIDDLE ONE 2486 ; INTO OUR INTERNAL BUFFER. 2487 ; FORMAT COPY THE FORMAT TABLE INTO THE BUFFER 2488 ; VERIFY POINT THE TRANSFER ADDRESS INTO THE BUFFER 2489 ; 2490 ; THIS IS THE BIGGEST BOGOSITY OF ALL. THE IBM CONTROLLER DOES NOT HANDLE 2491 ; OPERATIONS THAT CROSS PHYSICAL 64K BOUNDARIES. IN THESE CASES, WE COPY 2492 ; THE OFFENDING SECTOR INTO THE BUFFER BELOW AND DO THE I/O FROM THERE. 2493 ; 2494 2495 2496 INT13FRAME STRUC 0 000083FA ???? OLDBP DW ? 0 000083FC ???? OLDAX DW ? 0 000083FE ???? OLDBX DW ? 0 00008400 ???? OLDCX DW ? 0 00008402 ???? OLDDX DW ? 0 00008404 ???????? OLDDD DD ? 0 00008408 ???? OLDF DW ? 2504 INT13FRAME ENDS 2505 === Switch to base=000000h -> "DOSENTRY" 2506 section DOSENTRY 2507 2508 extern Prev_DX, dosbiodata_temp_ds 2509 2510 === Switch to base=002450h -> "BIOCODE" 2511 section BIOCODE 2512 2513 ; ENTRY CONDITIONS: 2514 ; AH = FUNCTION 2515 ; AL = NUMBER OF SECTORS 2516 ; ES:BX = DMA ADDRESS 2517 ; CX = PACKED TRACK AND SECTOR 2518 ; DX = HEAD AND DRIVE 2519 ; OUTPUT CONDITIONS: 2520 ; NO DMA VIOLATION. 2521 ; 2522 relocated msdisk_i13 2523 PUBLIC BLOCK13 2524 BLOCK13 PROC FAR 2525 ; 2526 ; LET THE OPPERATION PROCEED. IF THERE IS A DMA VIOLATION, THEN WE DO THINGS. 2527 ; 0 00008EF0 1E push ds 0 00008EF1 E8[0000] call biocode_get_ds_dosbiodata 2530 assume ds:DOSGROUP 0 00008EF4 A3[0000] MOV [PREVOPER],AX ; SAVE REQUEST 0 00008EF7 1F pop ds 2533 assume ds:nothing 0 00008EF8 9C PUSHF 0 00008EF9 80FC05 CMP AH,ROMFORMAT 0 00008EFC 750D JNZ NOT_FORMAT 2537 ; SET CHANGED BY FORMAT BIT FOR ALL LOGICAL DRIVES USING THIS PHYSICAL DRIVE 2538 ;---------------------------------------------------------| 2539 ; WARNING: DO NOT CHANGE THE FOLLOWING. 2540 ; IT GETS PATCHED IN AT INIT TIME | 0 00008EFE 53 push bx 0 00008EFF BB4001 MOV bx,FCHANGED_BY_FORMAT+FCHANGED 0 00008F02 E8660A call ispatched 0 00008F05 7203 jc @F 2545 PUBLIC CHANGED_PATCH 2546 CHANGED_PATCH: 0 00008F07 E8[0000] CALL SET_CHANGED_DL ; INDICATE THAT MEDIA CHANGED BY FORMAT 2548 @@: 0 00008F0A 5B pop bx 2550 ; | 2551 ;---------------------------------------------------------| 2552 NOT_FORMAT: 0 00008F0B 1E push ds 0 00008F0C E8[0000] call biocode_get_ds_dosbiodata 2555 assume ds:DOSGROUP 0 00008F0F F6C280 test dl, 80h ; floppy or hard disk? 0 00008F12 7529 jnz not_floppy ; if hard, skip this nonsense 0 00008F14 803E[0000]00 cmp byte [EC35_Flag], 0 ; any electrically compat. drives? 0 00008F19 7422 jz not_floppy ; no; proceed unhindered 0 00008F1B 505351 SAVEREG 0 00008F1E 88D1 mov cl, dl ; turn drive number into bit map: 0 00008F20 B001 mov al, 1 ; assume drive 0 0 00008F22 D2E0 shl al, cl ; shift over correct number of times 0 00008F24 8406[0000] test al, [EC35_Flag] ; is THIS drive an electrically compatible 3.5 incher? 0 00008F28 7410 jz .not_EC35 ; no; don't change anything 0 00008F2A 88D3 mov bl, dl ; which drive was it? 0 00008F2C 30FF xor bh, bh ; need only one byte of index 0 00008F2E B84000 mov ax, 40h ; the machine state byte is in the... 0 00008F31 1E push ds 0 00008F32 8ED8 mov ds, ax ; ...segment at 40h 2571 assume ds:BDA 0 00008F34 C687900093 mov byte ptr [90h+bx], 93H ; establish drive type as: (360k disk in 360k drive, no double-stepping, 250 kbs transfer rate) 0 00008F39 1F pop ds 2574 assume ds:DOSGROUP 2575 .not_EC35: 0 00008F3A 595B58 RESTOREREG 2577 not_floppy: 2578 model_byte equ Model_Byte ; NASM port label 0 00008F3D 803E[0000]FA cmp byte [model_byte], mdl_ps2_30 ; is this a ps2/30? 0 00008F42 750A jne not_ps2_30 ; if not, just do normal call 0 00008F44 80FC08 cmp ah, 8 ;J.K. 1/30/87 Read Driver Parm ? 0 00008F47 7412 je ps2_30_Problem ;J.K. 1/30/87 0 00008F49 80FC15 cmp ah, 15h 0 00008F4C 740D je ps2_30_Problem 2585 not_ps2_30: 0 00008F4E 1F pop ds 2587 assume ds:nothing 0 00008F4F 9A[0000][0000] call DOSENTRY:transfer_orig13 ; SIMULATE INT 13 0 00008F54 7203 JC GOTERR13_br ; ERROR? 0 00008F56 E9[0000] jmp Leave13 ; NO, RETURN AND CLEAR FLAGS 2591 2592 Goterr13 equ GOTERR13 ; NASM port label 0 00008F59 EB32 GOTERR13_br: jmp Goterr13 2594 === Switch to base=000000h -> "DOSENTRY" 2595 section DOSENTRY 2596 2597 extern transfer_orig13 2598 2599 === Switch to base=002450h -> "BIOCODE" 2600 section BIOCODE 2601 2602 extern Leave13 2603 2604 2605 ;J.K.1/30/87 ps2_30 machine has some problem with AH=8h(Read Drive Parm), Int 13h. 2606 ;This function does not reset the common buses after the execution. 2607 ;To solve this problem, when we detect AH=8h, then we will save the result and 2608 ;will issue AH=1 (Read Status) call to reset the buses. 2609 2610 ps2_30_Problem: ;J.K. 1/30/87; ps2_30 = PS2 Model 30. 2611 assume ds:DOSGROUP 0 00008F5B 8916[0000] mov [Prev_DX], DX ;save orignal drive number 0 00008F5F 1F pop ds 2614 assume ds:nothing 2615 Orig13 equ ORIG13 ; NASM port label 0 00008F60 9A[0000][0000] call DOSENTRY:transfer_orig13 ;Do "Read drive parm" 2617 0 00008F65 50 push ax 0 00008F66 53 push bx 0 00008F67 51 push cx 0 00008F68 52 push dx 0 00008F69 57 push di 0 00008F6A 56 push si 0 00008F6B 55 push bp 0 00008F6C 1E push ds 0 00008F6D 06 push es 0 00008F6E 9C pushf 0 00008F6F E8[0000] call biocode_get_ds_dosbiodata 2629 assume ds:DOSGROUP 0 00008F72 8B16[0000] mov dx, [Prev_DX] ;restore orignal drive 0 00008F76 B401 mov ah, 1 ;Read Status. 0 00008F78 9C pushf 0 00008F79 9A[0000][0000] call DOSENTRY:transfer_orig13 ;Reset the bus as a side effect of this call. 2634 0 00008F7E 9D popf 0 00008F7F 07 pop es 2637 assume es:nothing 0 00008F80 1F pop ds 2639 assume ds:nothing 0 00008F81 5D pop bp 0 00008F82 5E pop si 0 00008F83 5F pop di 0 00008F84 5A pop dx 0 00008F85 59 pop cx 0 00008F86 5B pop bx 0 00008F87 58 pop ax 2647 GotErr13 equ GOTERR13 ; NASM port label 0 00008F88 7203 jc GotErr13 ;AH=8 had been an error? 0 00008F8A E9[0000] jmp Leave13 2650 2651 ; 2652 ; SOME KIND OF ERROR OCCURRED. SEE IF IT IS DMA VIOLATION 2653 ; 2654 GOTERR13: 0 00008F8D 9C PUSHF 0 00008F8E 80FC09 cmp ah, 09h ;AN011; DMA error? 0 00008F91 7408 je Chk_ValidMedia_ERR13 ;AN011; 0 00008F93 80FC11 cmp ah, 11h ;AN011; ECC error? 0 00008F96 7403 je Chk_ValidMedia_ERR13 ;AN011; 0 00008F98 EB53 jmp Skip_Ecc_Check ;AN011; Other error. Just return back. 0 00008F9A 90 nop ; identicalise 2662 2663 Chk_ValidMedia_ERR13: ;AN011;If SetDrive fails, then just 0 00008F9B 1E push ds ;AN011; return back to INT 13h caller, 0 00008F9C 57 push di ;AN011; without performing ECC, DMA 0 00008F9D 50 push ax ;AN011; error handling. 0 00008F9E E8[0000] call biocode_get_ds_dosbiodata 2668 assume ds:DOSGROUP 2669 Phys_Drv equ PHYS_DRV ; NASM port label 0 00008FA1 C606[0000]01 mov byte ptr [Phys_Drv], 1 ;AN011; 0 00008FA6 88D0 mov al, dl ;AN011; 2672 SetDrive equ SETDRIVE ; NASM port label 0 00008FA8 E858F8 call SetDrive ;AN011; 2674 assume ds:UPB 0 00008FAB E8[0000] call biocode_get_ds_dosbiodata 2676 assume ds:DOSGROUP 0 00008FAE C606[0000]00 mov byte ptr [Phys_Drv], 0 ;AN011; 0 00008FB3 58 pop ax ;AN011; 0 00008FB4 5F pop di ;AN011; 0 00008FB5 1F pop ds ;AN011; 2681 assume ds:nothing 0 00008FB6 7235 jc Skip_Ecc_Check ;AN011; 2683 2684 ; TEST OF BIT PATTERN 08H LET OTHER ERRORS BE PASSED AS DMA ERRORS - PTR 32D0519 2685 ; TEST AH,08H ; DMA BIT 0 00008FB8 80FC09 CMP AH, 09H ; DMA ERROR CODE 0 00008FBB 7503 JNZ CHECK_ECC 0 00008FBD E98F00 JMP GOTDMAERR 2689 CHECK_ECC: 2690 ;J.K. AN003; Soft ECC bug is only applied to PC1 and PC-XT. So, we will enforce 2691 ;this ECC error handler for them. Also, since CMC hardfiles in PC AT also 2692 ;generate a lot of unnecessary ECC errors, we will still cover PC ATs as 2693 ;it is done in the earlier version of MSBIO. 2694 ;During Format/Verify operation, we are going to consider any Soft Ecc as a 2695 ;hard error. 2696 2697 ;SB34DISK005***************************************************************** 2698 ;SB See if the machine we are operating on is a PC, XT or AT by checking 2699 ;SB the model byte. The soft ECC bug is only on these machines and if 2700 ;SB the machine we are operating on is not one of these three then we 2701 ;SB needn't do anything special. If we are operating one these however 2702 ;SB we check to see if the error occured during format by checking 2703 ;SB media_set_for_format. If it did occur during format we cannot do 2704 ;SB anything but if not during format then check to see if the error 2705 ;SB returned in AH is the SOFT_ECC error and if so go to OK11 since 2706 ;SB the error can be ignored. 6 LOCS 2707 0 00008FC0 1E push ds 0 00008FC1 E8[0000] call biocode_get_ds_dosbiodata 2710 assume ds:DOSGROUP 0 00008FC4 803E[FF00]01 cmp byte [Media_Set_For_Format], 1 ; formatting? 0 00008FC9 7421 je Skip_Ecc_Check_pop 0 00008FCB 803E[0000]FE cmp byte [Model_Byte], 0FEh ; PC or XT? 0 00008FD0 7315 jae Go_Chk_Ecc 0 00008FD2 803E[0000]FB cmp byte [Model_Byte], 0FBh ; XT? 0 00008FD7 740E je Go_Chk_Ecc 0 00008FD9 803E[0000]FC cmp byte [Model_Byte], 0FCh 0 00008FDE 750D jne Skip_Ecc_Check 0 00008FE0 803E[0000]02 cmp byte [Secondary_Model_Byte], 2 ; AT? 0 00008FE5 7706 ja Skip_Ecc_Check 2721 Go_Chk_Ecc: ; for PC, XT, AT 0 00008FE7 80FC11 CMP AH,11H 0 00008FEA 7405 JZ OK11 2724 Skip_Ecc_Check_pop: 0 00008FEC 1F pop ds 2726 assume ds:nothing 2727 Skip_Ecc_Check: ;AN003; Just return back to INT 13h caller. 2728 2729 ;SB34DISK005***************************************************************** 2730 0 00008FED 9D POPF 0 00008FEE E9[0000] jmp Leave13 2733 ; 2734 ; WE HAVE AN ERROR STATUS 11H. THIS INDICATES AN ECC-CORRECTED ERROR. NOTE 2735 ; THAT THIS INDICATES THAT THE DATA IS PROBABLY CORRECT BUT NOT CERTAINLY 2736 ; CORRECT. THE ROMS ON PC-1S AND PC_XTS HAVE A 'BUG' IN THAT IF AN ECC ERROR 2737 ; OCCURS FOR A MULTI-SECTOR READ, ONLY THE SECTORS UP TO THE ONE WHERE THE 2738 ; ERROR OCCURRED ARE READ IN. WE HAVE NO WAY OF KNOWING HOW MANY WERE READ IN 2739 ; THIS CASE, SO WE REDO THE OPERATION, READING ONE SECTOR AT A TIME. IF WE 2740 ; GET AN ECC ERROR ON READING ONE SECTOR, WE IGNORE THE ERROR BECAUSE THE 2741 ; SECTOR HAS BEEN READ IN. 2742 ; 2743 PUBLIC OK11 2744 OK11: 0 00008FF1 1F pop ds 2746 assume ds:nothing 2747 ; POPF 2748 ;J.K. 8/29/86 Here, it is better reset the system. So, we are going to 2749 ;call Orig13 again 2750 0 00008FF2 30E4 xor ah, ah 0 00008FF4 9A[0000][0000] call DOSENTRY:transfer_orig13 ;reset. Don't care about the result 2753 0 00008FF9 1E push ds 0 00008FFA E8[0000] call biocode_get_ds_dosbiodata 2756 assume ds:DOSGROUP 0 00008FFD A1[0000] MOV AX,[PREVOPER] ; RETRIEVE REQUEST 2758 ; 2759 ; THIS WILL PROVIDE A TERMINATION POINT. 2760 ; 0 00009000 3C01 CMP AL,1 ; IF REQUEST FOR ONE SECTOR, ASSUME OK 0 00009002 7506 JNZ ECC_ERR_HANDLE 0 00009004 1F pop ds 2764 assume ds:nothing 0 00009005 30E4 XOR AH,AH ; CLEAR CARRY TOO! 0 00009007 E9[0000] jmp Leave13 2767 2768 PUBLIC ECC_ERR_HANDLE 2769 ECC_ERR_HANDLE: 2770 assume ds:DOSGROUP 0 0000900A 1F pop ds 2772 assume ds:nothing 0 0000900B 535152 SAVEREG 0 0000900E 1E push ds 0 0000900F E8[0000] call biocode_get_ds_dosbiodata 2776 assume ds:DOSGROUP 0 00009012 A2[0000] MOV [NUMBER_OF_SEC],AL 2778 LOOP_ECC: 0 00009015 A1[0000] MOV AX,[PREVOPER] 0 00009018 B001 MOV AL,1 ; REQUEST FOR ONE SECTOR ONLY 2781 ; 2782 ; WE DO READS ONE SECTOR AT A TIME. THIS ENSURES THAT WE WILL EVENTUALLY 2783 ; FINISH THE REQUEST SINCE ECC ERRORS ON ONE SECTOR DO READ IN THAT SECTOR. 2784 ; 2785 ; WE NEED TO PUT IN SOME "INTELLIGENCE" INTO THE ECC HANDLER TO HANDLE READS 2786 ; THAT ATTEMPT TO READ MORE SECTORS THAN ARE AVAILABLE ON A PARTICULAR 2787 ; TRACK. 2788 ; WE CALL CHECK_WRAP TO SET UP THE SECTOR #, HEAD # AND CYLINDER # FOR 2789 ; THIS REQUEST. 2790 ; AT THIS POINT, ALL REGISTERS ARE SET UP FOR THE CALL TO ORIG13, EXCEPT 2791 ; THAT THERE MAY BE A STARTING SECTOR NUMBER THAT IS BIGGER THAN THE NUMBER 2792 ; OF SECTORS ON A TRACK. 2793 ; 0 0000901A E86308 CALL CHECK_WRAP ; GET CORRECT PARAMETERS FOR INT 13 0 0000901D 1F pop ds 2796 assume ds:nothing 0 0000901E 9C PUSHF 0 0000901F 9A[0000][0000] call DOSENTRY:transfer_orig13 0 00009024 7310 JNC OK11_OP 0 00009026 80FC11 CMP AH,11H ; ONLY ALLOW ECC ERRORS 0 00009029 F9 stc ;J.K. 8/28/86 Set carry bit again. 0 0000902A 751D JNZ OK11_EXIT_err ;J.K. 8/26/86 Other error? --> (CY) 0 0000902C B400 mov ah, 0 ;J.K. ECC error. Reset the system again. 0 0000902E 9C pushf 0 0000902F 9A[0000][0000] call DOSENTRY:transfer_orig13 0 00009034 31C0 xor ax, ax ; clear the error code so that if this 2807 ; was the last sector, no error code 2808 ; will be returned for the corrected 2809 ; read. (clear carry too.) 2810 OK11_OP: 0 00009036 1E push ds 0 00009037 E8[0000] call biocode_get_ds_dosbiodata 2813 assume ds:DOSGROUP 0 0000903A FE0E[0000] DEC byte [NUMBER_OF_SEC] 0 0000903E 7408 JZ OK11_EXIT ; ALL DONE? 0 00009040 FEC1 INC CL ; ADVANCE SECTOR NUMBER 0 00009042 FEC7 INC BH ; ADD 200H TO ADDRESS 0 00009044 FEC7 INC BH 0 00009046 EBCD JMP SHORT LOOP_ECC 2820 OK11_EXIT: 0 00009048 1F pop ds 2822 assume ds:nothing 2823 OK11_EXIT_err: 0 00009049 5A595B RESTOREREG 0 0000904C E9[0000] jmp Leave13 2826 ; 2827 ; WE TRULY HAVE A DMA VIOLATION. RESTORE REGISTER AX AND RETRY THE 2828 ; OPERATION AS BEST WE CAN. 2829 ; 2830 GOTDMAERR: 0 0000904F 58 POP AX ; CLEAN UP STACK 0 00009050 1E push ds 0 00009051 E8[0000] call biocode_get_ds_dosbiodata 2834 assume ds:DOSGROUP 0 00009054 A1[0000] MOV AX,[PREVOPER] 0 00009057 1F pop ds 2837 assume ds:nothing 0 00009058 FB STI 0 00009059 80FC02 CMP AH,ROMREAD ; SAVE USER FLAGS 0 0000905C 7268 JB INTDONE 0 0000905E 80FC04 CMP AH,ROMVERIFY 0 00009061 7439 JZ INTVERIFY 0 00009063 80FC05 CMP AH,ROMFORMAT 0 00009066 7447 JZ INTFORMAT 0 00009068 775C JA INTDONE 2846 ; 2847 ; WE ARE DOING A READ/WRITE CALL. CHECK FOR DMA PROBLEMS 2848 ; 0 0000906A 52515350 SAVEREG 0 0000906E 55 PUSH BP 0 0000906F 89E5 MOV BP,SP 0 00009071 8CC2 MOV DX,ES ; CHECK FOR 64K BOUNDARY ERROR 2853 0 00009073 D1E2 SHL DX,1 0 00009075 D1E2 SHL DX,1 0 00009077 D1E2 SHL DX,1 0 00009079 D1E2 SHL DX,1 ; SEGMENT CONVERTED TO ABSOLUTE ADDRESS 2858 0 0000907B 01DA ADD DX,BX ; COMBINE WITH OFFSET 0 0000907D 81C2FF01 ADD DX,511 ; SIMULATE A TRANSFER 2861 ; 2862 ; IF CARRY IS SET, THEN WE ARE WITHIN 512 BYTES OF THE END OF THE SEGMENT. 2863 ; WE SKIP THE FIRST TRANSFER AND PERFORM THE REMAINING BUFFERING AND TRANSFER 2864 ; 0 00009081 7306 JNC NO_SKIP_FIRST 0 00009083 8A7609 MOV DH,BYTE PTR [BP + OLDDX+1] ; SET UP HEAD NUMBER 0 00009086 E9A500 JMP BUFFER ;J.K. 4/10/86 2868 ; JMP SHORT BUFFER 2869 ; 2870 ; DX IS THE PHYSICAL 16 BITS OF START OF TRANSFER. COMPUTE REMAINING 2871 ; SECTORS IN SEGMENT. 2872 ; 2873 NO_SKIP_FIRST: 0 00009089 D0EE SHR DH,1 ; DH = NUMBER OF SECTORS BEFORE ADDRESS 0 0000908B B480 MOV AH,128 ; AH = MAX NUMBER OF SECTORS IN SEGMENT 0 0000908D 28F4 SUB AH,DH 2877 ; 2878 ; AH IS NOW THE NUMBER OF SECTORS THAT WE CAN SUCCESSFULLY WRITE IN THIS 2879 ; SEGMENT. IF THIS NUMBER IS ABOVE OR EQUAL TO THE REQUESTED NUMBER, THEN WE 2880 ; CONTINUE THE OPERATION AS NORMAL. OTHERWISE, WE BREAK IT INTO PIECES. 2881 ; 0 0000908F 38C4 CMP AH,AL ; CAN WE FIT IT IN? 2883 DOBLOCK equ DoBlock ; NASM port label 0 00009091 7238 JB DOBLOCK ; NO, PERFORM BLOCKING. 2885 ; 2886 ; YES, THE REQUEST FITS. LET IT HAPPEN 2887 ; 0 00009093 8A7609 MOV DH,BYTE PTR [BP + OLDDX+1] ; SET UP HEAD NUMBER 0 00009096 E8B908 CALL DOINT 0 00009099 E9FF00 JMP BAD13 2891 ; 2892 ; VERIFY THE GIVEN SECTORS. PLACE THE BUFFER POINTER INTO OUR SPACE. 2893 ; 2894 INTVERIFY: 0 0000909C 0653 SAVEREG 0 0000909E E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 2897 assume es:DOSENTRYGROUP 2898 DOSIMPLE: 0 000090A1 BB[0000] MOV BX,OFFSET DISKSECTOR ; access with es 0 000090A4 9C PUSHF 0 000090A5 9A[0000][0000] call DOSENTRY:transfer_orig13 0 000090AA 5B07 RESTOREREG 2903 assume es:nothing 0 000090AC E9[0000] jmp Leave13 2905 2906 ; 2907 ; FORMAT OPERATION. COPY THE PARAMETER TABLE INTO MEMORY 2908 ; 2909 INTFORMAT: 0 000090AF 0653 SAVEREG 0 000090B1 56571E SAVEREG 0 000090B4 06 PUSH ES 0 000090B5 E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 2914 assume es:DOSENTRYGROUP 0 000090B8 1F POP DS 2916 assume ds:nothing 0 000090B9 89DE MOV SI,BX 0 000090BB BF[0000] MOV DI,OFFSET DISKSECTOR ; access with es 0 000090BE E87A08 CALL MOVE 0 000090C1 1F5F5E RESTOREREG 2921 assume ds:nothing 0 000090C4 EBDB JMP DOSIMPLE 2923 ; 2924 ; INLINE CONTINUATION OF OPERATION 2925 ; 2926 INTDONE: 2927 assume ds:nothing, es:nothing 0 000090C6 EA[0000][0000] jmp DOSENTRY:transfer_orig13 2929 2930 ; 2931 ; We can't fit the request into the entire block. Perform the operation on 2932 ; the first block. 2933 ; 2934 ; DoBlock is modified to correctly handle multi-sector disk I/O. -J.K. 4/10/86 2935 ; Old DoBlock had added the number of sectors I/Oed (Ah in Old DoBlock) after 2936 ; the DoInt call to CL. Observing only the lower 6 bits of CL(=max. 64) can 2937 ; represent a starting sector, if AH was big, then CL would be clobbered. 2938 ; By the way, we still are going to use CL for this purpose since Checkwrap 2939 ; routine will use it as an input. To prevent CL from being clobbered, a 2940 ; safe number of sectors should be calculated like "63 - # of sectors/track". 2941 ; DoBlock will handle the first block of requested sectors within the 2942 ; boundary of this safe value. - J.K. 2/28/86 2943 2944 DoBlock: 2945 assume ds:nothing, es:nothing 2946 ;Try to get the # of sectors/track from BDS via Rom drive number. 2947 ;For any mini disks installed, here we have to pray that they have the 2948 ;same # of sector/track as the main DOS partition disk drive. 2949 2950 Message ftestDisk,<"!!!DMA DoBlock!!!"> 2951 2952 olddx equ OLDDX ; NASM port equate 0 000090CB 8B5608 mov dx, word ptr [bp + olddx] ;set head # 0 000090CE 57 push di 0 000090CF 1E push ds 0 000090D0 50 push ax ;AH - # of sectors before DMA boundary 2957 ;AL - User requeseted # of sectors for I/O. 2958 phys_drv equ PHYS_DRV ; NASM port label 0 000090D1 E8[0000] call biocode_get_ds_dosbiodata 2960 assume ds:DOSGROUP 0 000090D4 C606[0000]01 mov byte ptr [phys_drv],1 0 000090D9 88D0 mov al, dl 0 000090DB E825F7 call SetDrive ;get BDS pointer for this DISK. 2964 assume ds:UPB 2965 ; fixme: what if not found ? 2966 ; see next jc (questionable) 0 000090DE 58 pop ax 0 000090DF 1E push ds 0 000090E0 E8[0000] call biocode_get_ds_dosbiodata 2970 assume ds:DOSGROUP 0 000090E3 C606[0000]00 mov byte ptr [phys_drv],0 0 000090E8 1F pop ds 2973 assume ds:UPB 0 000090E9 7207 jc @F 0 000090EB F745230100 test word ptr [DI + Flags], fNon_Removable ;don't have to worry 0 000090F0 7504 jnz DoBlockHard ;about floppies. They are track by track operation. 2977 @@: 0 000090F2 88E0 mov al, ah ;set al = ah for floppies 0 000090F4 EB0D jmp short DoBlockCont 2980 DoBlockHard: 0 000090F6 51 push cx 0 000090F7 8B4D13 mov cx, [DI + SecLim] ;# of sectors/track 0 000090FA B53F mov ch, 63 0 000090FC 28CD sub ch, cl 0 000090FE 88E8 mov al, ch 0 00009100 86E0 xchg ah, al ;now ah - safe # of sectors 2987 ;al - # of sectors before DMA boundary 0 00009102 59 pop cx 2989 DoBlockCont: 0 00009103 1F pop ds 2991 assume ds:nothing 0 00009104 5F pop di 2993 DoBlockContinue: 2994 Message ftestDisk,<"%%DMA DoBlock Loop%%"> 0 00009105 38C4 cmp ah, al ;if safe_# >= #_of_sectors_to_go_before DMA, 0 00009107 7305 jae DoBlocklast ;then #_of_sectors_to_go as it is for DoInt. 0 00009109 50 push ax ;save AH, AL 0 0000910A 88E0 mov al, ah ;Otherwise, set al to ah to operate. 0 0000910C EB03 jmp short DoBlockDoInt ;DoInt will set AH to a proper function in [BP.Oldax] 3000 DoBlocklast: 0 0000910E 88C4 mov ah, al 0 00009110 50 push ax ;save AH 3003 DoBlockDoInt: ;let AH = AL = # of sectors for this shot 3004 DoInt equ DOINT ; NASM port label 0 00009111 E83E08 CALL DoInt 0 00009114 7303E98200 JC BAD13 ;something happened, bye! 0 00009119 58 pop ax 3008 oldax equ OLDAX ; NASM port equate 0 0000911A 286602 SUB BYTE PTR [BP + oldax], AH ;decrement by the successful operation 0 0000911D 00E1 ADD CL,AH ;advance sector number. Safety gauranteed. 0 0000911F 00E7 ADD BH,AH ;advance DMA address 0 00009121 00E7 ADD BH,AH ;twice for 512 byte sectors. 0 00009123 38C4 cmp ah, al ;check the previous value 3014 Buffer equ BUFFER ; NASM port label 0 00009125 7407 je Buffer ;if #_of_sectors_to_go < safe_#, then we are done already. 0 00009127 28E0 sub al, ah ;otherwise, #_sector_to_go = #_of_sector_to_go - safe_# 3017 Check_Wrap equ CHECK_WRAP ; NASM port label 0 00009129 E85407 call Check_Wrap ;get new CX, DH for the next operation. 0 0000912C EBD7 jmp short DoBlockContinue ;handles next sectors left. 3020 ;End of modificaion of DoBlock - J.K. 2/28/86 3021 ;The following is the original one. 3022 ; PUSH AX 3023 ; MOV AL,AH ; get max to operate on 3024 ; MOV AH,BYTE PTR [BP.oldax+1]; get function 3025 ; mov dh,byte ptr [BP.olddx+1] ; set up head number 3026 ; CALL DoInt 3027 ; JC Bad13 ; something happened, bye! 3028 ; POP AX 3029 ; SUB BYTE PTR [BP.oldax],AH ; decrement by the successful operation 3030 ; ADD CL,AH ; advance sector number 3031 ; ADD BH,AH ; advance DMA address 3032 ; ADD BH,AH ; twice for 512 byte sectors. 3033 3034 ; 3035 ; THE NEXT REQUEST WILL WRAP THE 64K BOUNDARY. IF WE ARE WRITING, THEN COPY 3036 ; THE OFFENDING SECTOR INTO OUR SPACE. 3037 ; 3038 ; ES:BX POINTS TO THE SECTOR 3039 ; CX,DX CONTAIN THE CORRECT TRACK/SECTOR/HEAD/DRIVE INFO 3040 ; [BP.OLDAX] HAS CORRECT FUNCTION CODE 3041 ; 3042 BUFFER: 0 0000912E 53 PUSH BX 0 0000912F 8A6603 MOV AH,BYTE PTR [BP + OLDAX+1] 0 00009132 80FC03 CMP AH,ROMWRITE 0 00009135 7526 JNZ .DOREAD 3047 ; 3048 ; COPY THE OFFENDING SECTOR INTO LOCAL BUFFER 3049 ; 0 00009137 1E065657 SAVEREG 0 0000913B 06 PUSH ES 0 0000913C 1F POP DS ; ds => user buffer 3053 assume ds:nothing 0 0000913D E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY ; es => DOSENTRY 3055 assume es:DOSENTRYGROUP 0 00009140 BF[0000] MOV DI,OFFSET DISKSECTOR ; WHERE TO MOVE ; access with es 0 00009143 57 PUSH DI ; SAVE IT 0 00009144 89DE MOV SI,BX ; SOURCE 0 00009146 E8F207 CALL MOVE 0 00009149 5B POP BX ; NEW TRANSFER ADDRESS 0 0000914A 5F5E RESTOREREG 0 0000914C B001 MOV AL,1 3063 ; SEE IF WE ARE WRAPPING AROUND A TRACK OR HEAD 0 0000914E 8A5608 MOV DL,BYTE PTR [BP + OLDDX] ; GET DRIVE NUMBER 0 00009151 E82C07 CALL CHECK_WRAP ; SETS UP REGISTERS IF WRAP-AROUND 3066 ; 3067 ; AH IS FUNCTION 3068 ; AL IS 1 FOR SINGLE SECTOR TRANSFER 3069 ; ES:BX IS LOCAL TRANSFER ADDRES 3070 ; CX IS TRACK/SECTOR NUMBER 3071 ; DX IS HEAD/DRIVE NUMBER 3072 ; SI,DI UNCHANGED 3073 ; 0 00009154 E8FB07 CALL DOINT 0 00009157 071F RESTOREREG 3076 assume es:nothing, ds:nothing 0 00009159 7240 JC BAD13 ; GO CLEAN UP 0 0000915B EB28 JMP SHORT DOTAIL 3079 ; 3080 ; READING A SECTOR. DO INT FIRST, THEN MOVE THINGS AROUND 3081 ; 3082 .DOREAD: 3083 assume es:nothing 0 0000915D 0653 SAVEREG 0 0000915F E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 3086 assume es:DOSENTRYGROUP 0 00009162 BB[0000] MOV BX,OFFSET DISKSECTOR ; access with es 0 00009165 B001 MOV AL,1 3089 ; SEE IF OUR REQUEST WILL WRAP A TRACK OR HEAD BOUNDARY 0 00009167 8A5608 MOV DL,BYTE PTR [BP + OLDDX] ; GET DRIVE NUMBER 0 0000916A E81307 CALL CHECK_WRAP ; SETS UP REGISTERS IF WRAP-AROUND 3092 ; 3093 ; AH = FUNCTION 3094 ; AL = 1 FOR SINGLE SECTOR 3095 ; ES:BX POINTS TO LOCAL BUFFER 3096 ; CX, DX ARE TRACK/SECTOR, HEAD/DRIVE 3097 ; 0 0000916D E8E207 CALL DOINT 0 00009170 5B07 RESTOREREG 3100 assume es:nothing 0 00009172 7227 JC BAD13 ; ERROR => CLEAN UP 0 00009174 1E5657 SAVEREG 0 00009177 E8[0000] call biocode_get_ds_dosentry ; DISKSECTOR in DOSENTRY ! 3104 assume ds:DOSENTRYGROUP 0 0000917A 89DF MOV DI,BX 0 0000917C BE[0000] MOV SI,OFFSET DISKSECTOR ; access with ds 0 0000917F E8B907 CALL MOVE 0 00009182 5F5E1F RESTOREREG 3109 assume ds:nothing 3110 ; 3111 ; NOTE THE FACT THAT WE'VE DONE 1 MORE SECTOR 3112 ; 3113 DOTAIL: 0 00009185 5B POP BX ; RETRIEVE NEW DMA AREA 0 00009186 80C702 ADD BH,2 ; ADVANCE OVER SECTOR 0 00009189 41 INC CX 0 0000918A 8A4602 MOV AL,BYTE PTR [BP + OLDAX] 0 0000918D F8 CLC 0 0000918E FEC8 DEC AL 0 00009190 7409 JZ BAD13 ; NO MORE I/O 3121 ; SEE IF WE WRAP AROUND A TRACK OR HEAD BOUNDARY WITH STARTING SECTOR 3122 ; WE ALREADY HAVE THE CORRECT HEAD NUMBER TO PASS TO CHECK_WRAP 0 00009192 8A5608 MOV DL,BYTE PTR [BP + OLDDX] ; GET DRIVE NUMBER 0 00009195 E8E806 CALL CHECK_WRAP ; SETS UP REGISTERS IF WRAP-AROUND 0 00009198 E8B707 CALL DOINT 3126 ; 3127 ; WE ARE DONE. AX HAS THE FINAL CODE; WE THROW AWAY WHAT WE GOT BEFORE 3128 ; 3129 BAD13: 0 0000919B 89EC MOV SP,BP 0 0000919D 5D5B5B595A RESTOREREG 0 000091A2 E9[0000] jmp Leave13 3133 BLOCK13 ENDP 3134 ; PAGE 3135 ;=== Push trace listing source: msioctl.nas 3136 %include "msioctl.nas" ; NASM included file 1 <1> %warning out: MSIOCTL.SIL... 1 ****************** <1> warning: out: MSIOCTL.SIL... [-w+user] 2 <1> %include "ioctl.mac" 1 <2> 2 <2> %warning out: IOCTL.INC... 2 ****************** <2> warning: out: IOCTL.INC... [-w+user] 3 <2> ; THESE ARE ALL THE IMPORTANT STRUCTURES AND EQUATES FOR IOCTL 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; D241 Provide support of Multi-track Format/Verify 9/23/87 J.K. 11 <2> ;AN002; P1535 Unformatted hard file problem 10/15/87 J.K. 12 <2> ;AN003; D490 IOCTL subfunction 63h,43h,64h,44h conflicts with OS2 2/26/88 J.K. 13 <2> ;============================================================================== 14 <2> 15 <2> ;*** J.K. 16 <2> ;General Guide - 17 <2> ;Category Code: 18 <2> ; 0... .... DOS Defined 19 <2> ; 1... .... User defined 20 <2> ; .xxx xxxx Code 21 <2> 22 <2> ;Function Code: 23 <2> ; 0... .... Return error if unsupported 24 <2> ; 1... .... Ignore if unsupported 25 <2> ; .0.. .... Intercepted by DOS 26 <2> ; .1.. .... Passed to driver 27 <2> ; ..0. .... Sends data/commands to device 28 <2> ; ..1. .... Quries data/info from device 29 <2> ; ...x .... Subfunction 30 <2> ; 31 <2> ; Note that "Sends/queries" data bit is intended only to regularize the 32 <2> ; function set. It plays no critical role; some functions may contain both 33 <2> ; command and query elements. The convention is that such commands are 34 <2> ; defined as "sends data". 35 <2> 36 <2> ;*****************************;* 37 <2> ; BLOCK DRIVERS ;* 38 <2> ;*****************************;* 39 <2> 40 <2> ; IOCTL SUB-FUNCTIONS 41 <2> IOCTL_GET_DEVICE_INFO EQU 0 42 <2> IOCTL_SET_DEVICE_INFO EQU 1 43 <2> IOCTL_READ_HANDLE EQU 2 44 <2> IOCTL_WRITE_HANDLE EQU 3 45 <2> IOCTL_READ_DRIVE EQU 4 46 <2> IOCTL_WRITE_DRIVE EQU 5 47 <2> IOCTL_GET_INPUT_STATUS EQU 6 48 <2> IOCTL_GET_OUTPUT_STATUS EQU 7 49 <2> IOCTL_CHANGEABLE? EQU 8 50 <2> IOCTL_DeviceLocOrRem? EQU 9 51 <2> IOCTL_HandleLocOrRem? EQU 0Ah ;10 52 <2> IOCTL_SHARING_RETRY EQU 0Bh ;11 53 <2> GENERIC_IOCTL_HANDLE EQU 0Ch ;12 54 <2> GENERIC_IOCTL EQU 0Dh ;13 55 <2> 56 <2> ; GENERIC IOCTL CATEGORY CODES 57 <2> IOC_OTHER EQU 0 ; Other device control J.K. 4/29/86 58 <2> IOC_SE EQU 1 ; SERIAL DEVICE CONTROL 59 <2> IOC_TC EQU 2 ; TERMINAL CONTROL 60 <2> IOC_SC EQU 3 ; SCREEN CONTROL 61 <2> IOC_KC EQU 4 ; KEYBOARD CONTROL 62 <2> IOC_PC EQU 5 ; PRINTER CONTROL 63 <2> IOC_DC EQU 8 ; DISK CONTROL (SAME AS RAWIO) 64 <2> 65 <2> ; GENERIC IOCTL SUB-FUNCTIONS 66 <2> RAWIO EQU 8 67 <2> 68 <2> ; RAWIO SUB-FUNCTIONS 69 <2> GET_DEVICE_PARAMETERS EQU 60H 70 <2> SET_DEVICE_PARAMETERS EQU 40H 71 <2> READ_TRACK EQU 61H 72 <2> WRITE_TRACK EQU 41H 73 <2> VERIFY_TRACK EQU 62H 74 <2> FORMAT_TRACK EQU 42H 75 <2> GET_MEDIA_ID EQU 66h ;AN000;AN003;changed from 63h 76 <2> SET_MEDIA_ID EQU 46h ;AN000;AN003;changed from 43h 77 <2> GET_ACCESS_FLAG EQU 67h ;AN002;AN003;Unpublished function.Changed from 64h 78 <2> SET_ACCESS_FLAG EQU 47h ;AN002;AN003;Unpublished function.Changed from 44h 79 <2> 80 <2> ; SPECIAL FUNCTION FOR GET DEVICE PARAMETERS 81 <2> BUILD_DEVICE_BPB EQU 000000001B 82 <2> 83 <2> ; SPECIAL FUNCTIONS FOR SET DEVICE PARAMETERS 84 <2> INSTALL_FAKE_BPB EQU 000000001B 85 <2> ONLY_SET_TRACKLAYOUT EQU 000000010B 86 <2> TRACKLAYOUT_IS_GOOD EQU 000000100B 87 <2> 88 <2> ; SPECIAL FUNCTION FOR FORMAT TRACK 89 <2> STATUS_FOR_FORMAT EQU 000000001B 90 <2> DO_FAST_FORMAT equ 000000010B ;AN001; 91 <2> ; CODES RETURNED FROM FORMAT STATUS CALL 92 <2> FORMAT_NO_ROM_SUPPORT EQU 000000001B 93 <2> FORMAT_COMB_NOT_SUPPORTED EQU 000000010B 94 <2> 95 <2> ; DEVICETYPE VALUES 96 <2> MAX_SECTORS_IN_TRACK EQU 63 ; MAXIMUM SECTORS ON A DISK.(Was 40 in DOS 3.2) 97 <2> DEV_5INCH EQU 0 98 <2> DEV_5INCH96TPI EQU 1 99 <2> DEV_3INCH720KB EQU 2 100 <2> DEV_8INCHSS EQU 3 101 <2> DEV_8INCHDS EQU 4 102 <2> DEV_HARDDISK EQU 5 103 <2> DEV_OTHER EQU 7 104 <2> 105 <2> MAX_DEV_TYPE EQU 7 ; MAXIMUM DEVICE TYPE THAT WE 106 <2> ; CURRENTLY SUPPORT. 107 <2> 108 <2> %include "bpb.mac" 1 <3> %warning out: BPB.INC... 1 ****************** <3> warning: out: BPB.INC... [-w+user] 2 <3> ; SCCSID = @(#)BPB.ASM 1.1 85/04/29 3 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 4 <3> ; C A V E A T P R O G R A M M E R ; 5 <3> ; ; 6 <3> 7 <3> ; BIOS PARAMETER BLOCK DEFINITION 8 <3> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB 9 <3> 10 <3> BPBLOCK STRUC 0 000083FA ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 000083FC ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 000083FD ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 000083FF ?? BPFTCNT DB ? ; NUMBER OF FATS 0 00008400 ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00008402 ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 00008404 ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 00008405 ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <3> BPBLOCK ENDS 20 <3> 21 <3> A_BPB STRUC 0 000083FA ???? BPB_BYTESPERSECTOR DW ? 0 000083FC ?? BPB_SECTORSPERCLUSTER DB ? 0 000083FD ???? BPB_RESERVEDSECTORS DW ? 0 000083FF ?? BPB_NUMBEROFFATS DB ? 0 00008400 ???? BPB_ROOTENTRIES DW ? 0 00008402 ???? BPB_TOTALSECTORS DW ? 0 00008404 ?? BPB_MEDIADESCRIPTOR DB ? 0 00008405 ???? BPB_SECTORSPERFAT DW ? 0 00008407 ???? BPB_SECTORSPERTRACK DW ? 0 00008409 ???? BPB_HEADS DW ? 0 0000840B ???? BPB_HIDDENSECTORS DW ? 0 0000840D ???? DW ? 0 0000840F ???? BPB_BIGTOTALSECTORS DW ? 0 00008411 ???? DW ? 0 00008413 ???????????? DB 6 DUP(?) 37 <3> A_BPB ENDS 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 109 <2> 110 <2> A_SECTORTABLE STRUC 0 000083FA ???? ST_SECTORNUMBER DW ? 0 000083FC ???? ST_SECTORSIZE DW ? 113 <2> A_SECTORTABLE ENDS 114 <2> 115 <2> A_DEVICEPARAMETERS STRUC 0 000083FA ?? DP_SPECIALFUNCTIONS DB ? 0 000083FB ?? DP_DEVICETYPE DB ? 0 000083FC ???? DP_DEVICEATTRIBUTES DW ? 0 000083FE ???? DP_CYLINDERS DW ? 0 00008400 ?? DP_MEDIATYPE DB ? 121 00000007 <2> DP_BPB DB A_BPB_struc_size DUP (?) 0 00008420 ???? DP_TRACKTABLEENTRIES DW ? 123 00000028 <2> DP_SECTORTABLE DB MAX_SECTORS_IN_TRACK * A_SECTORTABLE_struc_size DUP (?) 124 <2> A_DEVICEPARAMETERS ENDS 125 <2> 126 <2> A_TRACKREADWRITEPACKET STRUC 0 000083FA ?? TRWP_SPECIALFUNCTIONS DB ? 0 000083FB ???? TRWP_HEAD DW ? 0 000083FD ???? TRWP_CYLINDER DW ? 0 000083FF ???? TRWP_FIRSTSECTOR DW ? 0 00008401 ???? TRWP_SECTORSTOREADWRITE DW ? 0 00008403 ???????? TRWP_TRANSFERADDRESS DD ? 133 <2> A_TRACKREADWRITEPACKET ENDS 134 <2> 135 <2> ;AN001; - FP_TRACKCOUNT is only meaningful when FP_SPECIALFUNCTIONS bit 1 = 1. 136 <2> A_FORMATPACKET STRUC 0 000083FA ?? FP_SPECIALFUNCTIONS DB ? 0 000083FB ???? FP_HEAD DW ? 0 000083FD ???? FP_CYLINDER DW ? 0 000083FF ???? FP_TRACKCOUNT DW ? ;1 141 <2> A_FORMATPACKET ENDS 142 <2> 143 <2> A_VERIFYPACKET STRUC 0 000083FA ?? VP_SPECIALFUNCTIONS DB ? 0 000083FB ???? VP_HEAD DW ? 0 000083FD ???? VP_CYLINDER DW ? 147 <2> A_VERIFYPACKET ENDS 148 <2> 149 <2> A_MEDIA_ID_INFO STRUC 0 000083FA ???? MI_LEVEL DW ? ;0 ;J.K. 87 Info. level 0 000083FC ???????? MI_SERIAL DD ? ;J.K. 87 Serial # 152 00000006 <2> MI_LABEL DB 11 DUP (?) ;(' ') ;J.K. 87 volume label 0 0000840B ???????????????? MI_SYSTEM DB 8 DUP (?) ;(' ') ;J.K. 87 File system type 154 <2> A_MEDIA_ID_INFO ENDS 155 <2> 156 <2> A_DISKACCESS_CONTROL STRUC ;AN002; Unpublished function. Only for Hard file. 0 000083FA ?? DAC_SPECIALFUNCTIONS DB ? ;0 ;AN002; Always 0 0 000083FB ?? DAC_ACCESS_FLAG DB ? ;0 ;AN002; Non Zero - allow disk I/O to unformatted hard file 159 <2> A_DISKACCESS_CONTROL ENDS ;AN002; 0 - Disallow disk I/O to unformatted hard file 160 <2> 161 <2> ;********************************;* 162 <2> ; CHARACTER DEVICES (PRINTERS) ;* 163 <2> ;********************************;* 164 <2> 165 <2> ;RAWIO SUB-FUNCTIONS 166 <2> GET_RETRY_COUNT EQU 65H 167 <2> SET_RETRY_COUNT EQU 45H 168 <2> 169 <2> A_RETRYCOUNT STRUC 0 000083FA ???? RC_COUNT DW ? 171 <2> A_RETRYCOUNT ENDS 172 <2> 173 <2> ;********************************;* ;J.K. 4/29/86 174 <2> ; CHARACTER DEVICES (SCREEN) ;* 175 <2> ;********************************;* ;J.K. 4/29/86 176 <2> ; 177 <2> ;SC_MODE_INFO struc 178 <2> ;SC_INFO_LENGTH DW 9 179 <2> ;SC_MODE DB 0 180 <2> ;SC_COLORS DW 0 181 <2> ;SC_WIDTH DW 0 182 <2> ;SC_LENGTH DW 0 183 <2> ;SC_MODE_INFO ends 184 <2> ; 185 <2> ;SC_INFO_PACKET_LENGTH EQU 9 ;LENGTH OF THE INFO PACKET. 186 <2> 187 <2> ;SUBFUNCTIONS FOR CON$GENIOCTL 188 <2> ;GET_SC_MODE EQU 60h 189 <2> ;SET_SC_MODE EQU 40h 190 <2> ;The following subfunctions are reserved for installable CODE PAGE switch 191 <2> ;console devices. - J.K. 4/29/86 192 <2> ;Get_active_codepage equ 6Ah 193 <2> ;Invoke_active_codepage equ 4Ah 194 <2> ;Start_designate_codepage equ 4Ch 195 <2> ;End_designate_codepage equ 4Dh 196 <2> ;Get_list_of_designated_codepage equ 6Bh 197 <2> ;J.K. 4/29/86 *** End of Con$genioctl equates & structures 3 <1> ; $SALUT $ioctl$ 4 <1> 5 <1> ;============================================================================== 6 <1> ;REVISION HISTORY: 7 <1> ;AN000 - New for DOS Version 4.00 - J.K. 8 <1> ;AC000 - Changed for DOS Version 4.00 - J.K. 9 <1> ;AN00x - PTM number for DOS Version 4.00 - J.K. 10 <1> ;============================================================================== 11 <1> ;AN001 - P58 Diskcopy format fails when error occurs during format op.6/26/87 J.K. 12 <1> ;AN002; - d24 MultiTrack= command added. 6/29/87 J.K. 13 <1> ;AN003; - p155 Format intermittant failre due to haed settle time 8/18/87 J.K. 14 <1> ;AN004; D113 Disable I/O access to unformatted media 9/03/87 J.K. 15 <1> ;AN005; P985 Allow I/O access to unformtted media 9/14/87 J.K. 16 <1> ;AN006; D241 Provide support of Multi-track Format/Verify 9/23/87 J.K. 17 <1> ;AN007; P1535 Unformatted hard file problem 10/15/87 J.K. 18 <1> ;AN008; P2590 Change the recommended BPB info. after AFS format 11/20/87 J.K. 19 <1> ;AN009; P2828 Do not retry for multi-track format request 12/08/87 J.K. 20 <1> ;AN010; P2781 Changeline error behavior incompatibile with DOS 3.3. 1/06/88 J.K. 21 <1> ;AN011; P3178 Set Media ID should update media info in BDS table. 1/21/88 J.K. 22 <1> ;AN012; D490 IOCTL subfunction 63h,43h,64h,44h conflicts with OS2 2/26/88 J.K. 23 <1> ;============================================================================== 24 <1> 25 <1> ;J.K. 10/15/87 26 <1> ;NOTE: GetAccessFlag/SetAccessFlag is unpublished function. 27 <1> ; This function is intended to give the user to control the 28 <1> ; BDS table FLAGS of UNFORMATTED_MEDIA bit. 29 <1> ; GetAccessFlag will show the status - 30 <1> ; A_DISKACCESS_CONTROL.DAC_ACCESS_FLAG = 0 DISK I/O not allowed 31 <1> ; 1 DISK I/O allowed 32 <1> ; SetAccessFlag will Set/Reset the UNFORMATTED_MEDIA bit in FLAGS - 33 <1> ; A_DISKACCESS_CONTROL.DAC_ACCESS_FLAG = 0 Allow disk I/O 34 <1> ; 1 Disallow disk I/O 35 <1> ;------------------------------------------------------------------------------ 36 <1> === Switch to base=002450h -> "BIOCODE" 37 <1> section BIOCODE 38 <1> 39 <1> 0 000091A5 00 align 2, db 0 0 000091A6 00 db 0 42 <1> ; GENERIC IOCTL DISPATCH TABLES 43 <1> ; 0 000091A7 07 IOREADJUMPTABLE DB 7 ;AN012;maximum number (0 based) 0 000091A8 [270E] DW OFFSET GETDEVICEPARAMETERS ;60h 0 000091AA [F210] DW OFFSET READTRACK ;61h 0 000091AC [9110] DW OFFSET VERIFYTRACK ;62h 0 000091AE [210E] dw Cmd_Err_Proc ;AN012;Overlapped with OS2 subfunction 0 000091B0 [210E] dw Cmd_Err_Proc ;AN012; 0 000091B2 [210E] dw Cmd_Err_Proc ;AN012; 0 000091B4 [7913] dw GetMediaID ;AN000;AN012;66h 0 000091B6 [5E14] dw GetAccessFlag ;AN007;AN012;67h Unpublished function 53 <1> 0 000091B8 00 db 0 0 000091B9 07 IOWRITEJUMPTABLE DB 7 ;AN012; 0 000091BA [630E] DW OFFSET SETDEVICEPARAMETERS ;40h 0 000091BC [FE10] DW OFFSET WRITETRACK ;41h 0 000091BE [D70F] DW OFFSET FORMATTRACK ;42h 0 000091C0 [210E] dw Cmd_Err_Proc ;AN012; 0 000091C2 [210E] dw Cmd_Err_Proc ;AN012; 0 000091C4 [210E] dw Cmd_Err_Proc ;AN012; 0 000091C6 [B713] dw SetMediaID ;AN000;AN012;46h 0 000091C8 [7214] dw SetAccessFlag ;AN007;AN012;47h Unpublished function 64 <1> 65 <1> === Switch to base=000E10h -> "DOSBIODATA" 66 <1> section DOSBIODATA 67 <1> 68 <1> ; 69 <1> ; TRACKTABLE CONTAINS A 4-TUPLES (C,H,R,N) FOR EACH SECTOR IN A TRACK 70 <1> ; C = CYLINDER NUMBER, H = HEAD NUMBER, R = SECTOR ID, N = BYTES PER SECTOR 71 <1> ; N BYTES PER SECTOR 72 <1> ; --- ---------------- 73 <1> ; 0 128 74 <1> ; 1 256 75 <1> ; 2 512 76 <1> ; 3 1024 77 <1> ; 78 <1> MAX_SECTORS_CURR_SUP EQU 63 ; CURRENT MAXIMUM SEC/TRK THAT 79 <1> ; WE SUPPORT (Was 40 in DOS 3.2) 80 <1> 81 <1> align 2, db 0 0 00001432 2400 SECTORSPERTRACK DW 36 0 00001434 00000102 TRACKTABLE DB 0,0,1,2 0 00001438 00000202 DB 0,0,2,2 0 0000143C 00000302 DB 0,0,3,2 0 00001440 00000402 DB 0,0,4,2 0 00001444 00000502 DB 0,0,5,2 0 00001448 00000602 DB 0,0,6,2 0 0000144C 00000702 DB 0,0,7,2 0 00001450 00000802 DB 0,0,8,2 0 00001454 00000902 DB 0,0,9,2 0 00001458 00000A02 DB 0,0,10,2 0 0000145C 00000B02 DB 0,0,11,2 0 00001460 00000C02 DB 0,0,12,2 0 00001464 00000D02 DB 0,0,13,2 0 00001468 00000E02 DB 0,0,14,2 0 0000146C 00000F02 DB 0,0,15,2 0 00001470 00001002 db 0,0,16,2 0 00001474 00001102 db 0,0,17,2 0 00001478 00001202 db 0,0,18,2 0 0000147C 00001302 db 0,0,19,2 0 00001480 00001402 db 0,0,20,2 0 00001484 00001502 db 0,0,21,2 0 00001488 00001602 db 0,0,22,2 0 0000148C 00001702 db 0,0,23,2 0 00001490 00001802 db 0,0,24,2 0 00001494 00001902 db 0,0,25,2 0 00001498 00001A02 db 0,0,26,2 0 0000149C 00001B02 db 0,0,27,2 0 000014A0 00001C02 db 0,0,28,2 0 000014A4 00001D02 db 0,0,29,2 0 000014A8 00001E02 db 0,0,30,2 0 000014AC 00001F02 db 0,0,31,2 0 000014B0 00002002 db 0,0,32,2 0 000014B4 00002102 db 0,0,33,2 0 000014B8 00002202 db 0,0,34,2 0 000014BC 00002302 db 0,0,35,2 0 000014C0 00002402 db 0,0,36,2 0 000014C4 000000000000000000 DB 4*MAX_SECTORS_CURR_SUP - ($ - TRACKTABLE) DUP (0) 0 000014CD 000000000000000000 0 000014D6 000000000000000000 0 000014DF 000000000000000000 0 000014E8 000000000000000000 0 000014F1 000000000000000000 0 000014FA 000000000000000000 0 00001503 000000000000000000 0 0000150C 000000000000000000 0 00001515 000000000000000000 0 0000151E 000000000000000000 0 00001527 000000000000000000 120 <1> 121 <1> 122 <1> ; THIS IS A REAL UGLY PLACE TO PUT THIS 123 <1> ; IT SHOULD REALLY GO IN THE BDS 0 00001530 00 MEDIATYPE DB 0 125 <1> 0 00001531 00 MEDIA_SET_FOR_FORMAT DB 0 ; 1 IF WE HAVE DONE AN INT 13 SET MEDIA 127 <1> ; TYPE FOR FORMAT CALL 0 00001532 00 Had_Format_Error db 0 ; 1 if the previous format operation 129 <1> ; failed. - J.K. 7/8/86 130 <1> Dsk_time_out_Err equ 80h ; Time out error (No media present). 131 <1> Dsk_change_line_Err equ 6h ; Change line error 132 <1> Dsk_illegal_combination equ 0Ch ; Return code of ah=18h function. 133 <1> 0 00001533 00 align 2, db 0 135 <1> ; TEMP DISK BASE TABLE. IT HOLDS THE THE CURRENT DPT WHICH IS THEN REPLACED BY 136 <1> ; THE ONE PASSED BY "NEW ROMS" BEFORE WE PERFORM A FORMAT OPERATION. THE OLD 137 <1> ; DPT IS RESTORED IN RESTOREOLDDPT. THE FIRST ENTRY (DISK_SPECIFY_1) IS -1 IF 138 <1> ; THIS TABLE DOES NOT CONTAIN THE PREVIOUSLY SAVED DPT. 0 00001534 FFFFFFFF TEMPDPT DD -1 140 <1> 141 <1> === Switch to base=002450h -> "BIOCODE" 142 <1> section BIOCODE 143 <1> 144 <1> extern DSK$UNKNOWN 145 <1> 146 <1> ; 147 <1> ; GENERIC$IOCTL: 148 <1> ; PERFORM GENERIC IOCTL REQUEST 149 <1> ; INPUT: 150 <1> ; AL - UNIT NUMBER 151 <1> ; OUTPUT: 152 <1> ; IF CARRY SET THEN AL CONTAINS ERROR CODE 153 <1> ; 154 <1> global msbio_check_gen_ioctl 155 <1> msbio_check_gen_ioctl: 156 <1> PUBLIC GENERIC$IOCTL 157 <1> GENERIC$IOCTL: 158 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 159 <1> MESSAGE FTESTDISK,<"GENERIC IOCTL",CR,LF> 0 000091CA E8[0000] call biocode_get_es_dosentry ; PTRSAV in DOSENTRY 161 <1> assume es:DOSENTRYGROUP 0 000091CD 26C41E[0000] LES BX,[es:PTRSAV] ; ES:BX POINTS TO REQUEST HEADER. 163 <1> assume es:nothing 0 000091D2 E82EF6 CALL SETDRIVE ; DS:DI POINTS TO BDS FOR DRIVE. 165 <1> assume ds:UPB 0 000091D5 7303E9[0000] jc DSK$UNKNOWN 167 <1> ; 168 <1> ; AT THIS POINT: 169 <1> ; ES:BX - POINTS TO THE REQUEST HEADER 170 <1> ; DS:DI POINTS TO THE BDS FOR THE DRIVE 171 <1> ; 0 000091DA 26807F0D08 CMP byte [ES:BX + MAJORFUNCTION], RAWIO 0 000091DF 7537 JNE IOCTL_FUNC_ERR 0 000091E1 268A470E MOV AL, [ES:BX + MINORFUNCTION] 0 000091E5 BE[AD0D] MOV SI, OFFSET IOREADJUMPTABLE ; access with cs 0 000091E8 A820 TEST AL, GEN_IOCTL_FN_TST ; TEST OF REQ. FUNCTION 0 000091EA 7503 JNZ NOTGENERICIOCTLWRITE ; FUNCTION IS A READ. 0 000091EC BE[BF0D] MOV SI, OFFSET IOWRITEJUMPTABLE ; access with cs 179 <1> NOTGENERICIOCTLWRITE: 0 000091EF 24DF and al, ~ GEN_IOCTL_FN_TST ; 6xh to 4xh 0 000091F1 2C40 sub al, 40h ; get 0-based 0 000091F3 2E3A04 CMP AL, [CS:SI] 0 000091F6 7720 JA IOCTL_FUNC_ERR 0 000091F8 98 CBW 0 000091F9 D1E0 SHL AX, 1 0 000091FB 46 INC SI 0 000091FC 01C6 ADD SI,AX 0 000091FE 26807F0219 cmp byte [es:bx + CMD], 19h 0 00009203 740C je .check 0 00009205 26C45F13 LES BX, [ES:BX + GENERICIOCTL_PACKET] 191 <1> assume es:nothing 0 00009209 2EFF14 CALL [CS:SI] 0 0000920C 7210 JC FAILGENERIC$IOCTL 194 <1> .exit: 0 0000920E E9[0000] JMP EXIT 196 <1> 197 <1> .check: 0 00009211 2E813C[210E] cmp word [cs:si], Cmd_Err_Proc 0 00009216 75F6 jne .exit 200 <1> 201 <1> IOCTL_FUNC_ERR: 202 <1> assume ds:nothing, es:nothing, ss:nothing 0 00009218 E9[0000] JMP CMDERR 204 <1> Cmd_Err_Proc: ;AN012; 0 0000921B 5A pop dx ;AN012;clear up stack 0 0000921C EBFA jmp IOCTL_FUNC_ERR ;AN012;Cmd error 207 <1> 208 <1> FAILGENERIC$IOCTL: 209 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000921E E9[0000] JMP ERR$EXIT 211 <1> 212 <1> ; 213 <1> ; GETDEVICEPARAMETERS: 214 <1> ; 215 <1> ; INPUT: DS:DI POINTS TO BDS FOR DRIVE 216 <1> ; ES:BX POINTS TO DEVICE PARAMETER PACKET 217 <1> ; 218 <1> PUBLIC GETDEVICEPARAMETERS 219 <1> GETDEVICEPARAMETERS PROC NEAR 220 <1> assume ds:UPB, es:nothing, ss:nothing 221 <1> ; COPY INFO FROM BDS TO THE DEVICE PARAMETERS PACKET 0 00009221 8A4522 MOV AL, BYTE PTR [DI + FORMFACTOR] 0 00009224 26884701 MOV BYTE PTR [ES:BX + DP_DEVICETYPE], AL 0 00009228 8B4523 MOV AX, WORD PTR [DI + FLAGS] 0 0000922B 83E003 AND AX,FNON_REMOVABLE+FCHANGELINE ; MASK OFF OTHER BITS 0 0000922E 26894702 MOV WORD PTR [ES:BX + DP_DEVICEATTRIBUTES], AX 0 00009232 8B4525 MOV AX, WORD PTR [DI + CCYLN] 0 00009235 26894704 MOV WORD PTR [ES:BX + DP_CYLINDERS], AX 229 <1> 230 <1> ; SET MEDIA TYPE TO DEFAULT 0 00009239 30C0 XOR AL, AL 0 0000923B 26884706 MOV BYTE PTR [ES:BX + DP_MEDIATYPE], AL 233 <1> 234 <1> ; COPY RECOMMENDED BPB 0 0000923F 8D7527 LEA SI, [DI + RBYTEPERSEC] 0 00009242 26F60701 TEST BYTE PTR [ES:BX + DP_SPECIALFUNCTIONS], BUILD_DEVICE_BPB 0 00009246 740B JZ USE_BPB_PRESENT 238 <1> ; GET THE CORRECT DISK IN THE DRIVE 0 00009248 E808F6 CALL CHECKSINGLE 240 <1> ; BUILD THE BPB FROM SCRATCH 0 0000924B E82FF3 CALL GETBP 0 0000924E 720C JC GET_PARM_RET 0 00009250 8D7506 LEA SI,[DI + BYTEPERSEC] 244 <1> USE_BPB_PRESENT: 0 00009253 8D7F07 LEA DI, [BX + DP_BPB] 0 00009256 B91900 MOV CX, BPB_TYPE_struc_size ; FOR NOW USE 'SMALL' BPB 0 00009259 F3A4 REP MOVSB 0 0000925B F8 CLC 249 <1> GET_PARM_RET: 0 0000925C C3 RET 251 <1> GETDEVICEPARAMETERS ENDP 252 <1> 253 <1> ; 254 <1> ; SETDEVICEPARAMETERS: 255 <1> ; 256 <1> ; INPUT: DS:DI POINTS TO BDS FOR DRIVE 257 <1> ; ES:BX POINTS TO DEVICE PARAMETER PACKET 258 <1> ; 259 <1> PUBLIC SETDEVICEPARAMETERS 260 <1> SETDEVICEPARAMETERS PROC NEAR 261 <1> assume ds:UPB, es:nothing, ss:nothing 262 <1> ; MAKE SURE THE FCHANGED_BY_FORMAT FLAG GETS SET TO KICK DOS INTO LOOKING AT 263 <1> ; THE BPB 0 0000925D 814D234001 OR WORD PTR [DI + FLAGS], FCHANGED_BY_FORMAT | FCHANGED 0 00009262 26F60702 TEST BYTE PTR [ES:BX + DP_SPECIALFUNCTIONS], ONLY_SET_TRACKLAYOUT 0 00009266 7403 JZ SHORT SETDEVPARM_1 0 00009268 EB79 JMP SETTRACKTABLE ; ORIGINALLY TRACKLAYOUT 0 0000926A 90 nop ; identicalise 269 <1> 270 <1> SETDEVPARM_1: 271 <1> ; COPY INFO FROM THE DEVICE PARAMETERS PACKET TO BDS 0 0000926B 268A4701 MOV AL, BYTE PTR [ES:BX + DP_DEVICETYPE] 0 0000926F 884522 MOV BYTE PTR [DI + FORMFACTOR], AL 274 <1> 0 00009272 268B4704 MOV AX, WORD PTR [ES:BX + DP_CYLINDERS] 0 00009276 894525 MOV WORD PTR [DI + CCYLN], AX 277 <1> 278 <1> ; IF CHANGE LINE IS NOT LOADED THEN IGNORE CHANGELING FLAG 0 00009279 268B4702 MOV AX, WORD PTR [ES:BX + DP_DEVICEATTRIBUTES] 0 0000927D 1E push ds 0 0000927E E8[0000] call biocode_get_ds_dosbiodata 282 <1> assume ds:DOSGROUP 0 00009281 803E[0000]00 CMP byte [FHAVE96],0 0 00009286 1F pop ds 285 <1> assume ds:UPB 0 00009287 7503 JNZ HAVE_CHANGE 0 00009289 83E0FD AND AX,~ FCHANGELINE 288 <1> HAVE_CHANGE: 289 <1> ; IGNORE ALL BITS EXCEPT NON_REMOVABLE AND CHANGELINE 0 0000928C 83E003 AND AX,FNON_REMOVABLE | FCHANGELINE 0 0000928F 8B4D23 MOV CX, WORD PTR [DI + FLAGS] 292 <1> ; AND CX, NOT (FNON_REMOVABLE OR FCHANGELINE OR GOOD_TRACKLAYOUT) 0 00009292 81E1F4FD AND CX, ~ (FNON_REMOVABLE | FCHANGELINE | GOOD_TRACKLAYOUT | UNFORMATTED_MEDIA) ;AN004;AN005;AN007; 0 00009296 09C8 OR AX, CX 0 00009298 894523 MOV WORD PTR [DI + FLAGS], AX 296 <1> 297 <1> ; SET MEDIA TYPE 0 0000929B 268A4706 MOV AL, BYTE PTR [ES:BX + DP_MEDIATYPE] 0 0000929F 1E push ds 0 000092A0 E8[0000] call biocode_get_ds_dosbiodata 301 <1> assume ds:DOSGROUP 0 000092A3 A2[FE00] MOV [MEDIATYPE], AL 0 000092A6 1F pop ds 304 <1> assume ds:UPB 305 <1> ; THE MEDIA CHANGED (MAYBE) SO WE WILL HAVE TO DO A SETDASD THE NEXT TIME 306 <1> ; WE FORMAT A TRACK 0 000092A7 814D238000 OR WORD PTR [DI + FLAGS], SET_DASD_TRUE 308 <1> 0 000092AC 1E570653 SAVEREG 310 <1> ; FIGURE OUT WHAT WE ARE SUPPOSED TO DO WITH THE BPB 311 <1> 312 <1> ; WERE WE ASKED TO INSTALL A FAKE BPB? 0 000092B0 26F60701 TEST BYTE PTR [ES:BX + DP_SPECIALFUNCTIONS], INSTALL_FAKE_BPB 0 000092B4 7513 JNZ SHORT INSTALLFAKEBPB 315 <1> 316 <1> ; WERE WE RETURNING A FAKE BPB WHEN ASKED TO BUILD A BPB? 0 000092B6 F745230400 TEST WORD PTR [DI + FLAGS], RETURN_FAKE_BPB 0 000092BB 7404 JZ SHORT INSTALLRECOMMENDEDBPB 319 <1> 320 <1> ; WE WERE RETURNING A FAKE BPB BUT WE CAN STOP NOW 0 000092BD 836523FB AND WORD PTR [DI + FLAGS], ~ RETURN_FAKE_BPB 322 <1> ; JMP DONEWITHBPBSTUFF ;AN008; Comment out this instruction. 323 <1> 324 <1> INSTALLRECOMMENDEDBPB: 0 000092C1 B91F00 MOV CX, A_BPB_struc_size 0 000092C4 8D7D27 LEA DI, [DI + RBYTEPERSEC] 0 000092C7 EB0A JMP SHORT COPYTHEBPB 328 <1> 329 <1> INSTALLFAKEBPB: 330 <1> return_fake_bpb equ RETURN_FAKE_BPB ; NASM port equate 0 000092C9 834D2304 or word ptr [di + flags], return_fake_bpb ;AN000; Problem 332 <1> ;reported by WHS. 0 000092CD B91900 MOV CX, BPB_TYPE_struc_size ; MOVE 'SMALLER' BPB 0 000092D0 8D7D06 LEA DI, [DI + BYTEPERSEC] 335 <1> COPYTHEBPB: 0 000092D3 8D7707 LEA SI, [BX + DP_BPB] 337 <1> ; EXCHANGE ES AND DS 0 000092D6 06 PUSH ES 0 000092D7 1E PUSH DS 0 000092D8 07 POP ES 0 000092D9 1F POP DS 342 <1> assume ds:nothing, es:UPB 343 <1> 0 000092DA F3A4 REP MOVSB 345 <1> 346 <1> DONEWITHBPBSTUFF: 0 000092DC E86804 CALL RESTOREOLDDPT ; RESTORE THE OLD DPT FROM TEMPDPT 0 000092DF 5B075F1F RESTOREREG 349 <1> assume ds:UPB, es:nothing 350 <1> 351 <1> ; SET UP TRACK TABLE (IF NECCESSARY) 352 <1> SETTRACKTABLE: 0 000092E3 268B4F26 MOV CX, WORD PTR [ES:BX + DP_TRACKTABLEENTRIES] 0 000092E7 1E push ds 0 000092E8 E8[0000] call biocode_get_ds_dosbiodata 356 <1> assume ds:DOSGROUP 0 000092EB 890E[0000] MOV [SECTORSPERTRACK], CX 0 000092EF 1F pop ds 359 <1> assume ds:UPB 0 000092F0 836523F7 AND WORD PTR [DI + FLAGS], ~ GOOD_TRACKLAYOUT 0 000092F4 26F60704 TEST BYTE PTR [ES:BX + DP_SPECIALFUNCTIONS], TRACKLAYOUT_IS_GOOD 0 000092F8 7404 JZ UGLYTRACKLAYOUT 0 000092FA 834D2308 OR WORD PTR [DI + FLAGS], GOOD_TRACKLAYOUT 364 <1> 365 <1> UGLYTRACKLAYOUT: 0 000092FE 83F93F CMP CX, MAX_SECTORS_IN_TRACK 0 00009301 771C JA TOOMANYSECTORSPERTRACK 0 00009303 E318 JCXZ SECTORINFOSAVED 0 00009305 BF[0200] MOV DI, OFFSET TRACKTABLE 0 00009308 8D7728 LEA SI, [BX + DP_SECTORTABLE] 0 0000930B 06 PUSH ES 0 0000930C 1F POP DS 373 <1> assume ds:nothing 0 0000930D E8[0000] call biocode_get_es_dosbiodata 375 <1> assume es:DOSGROUP 376 <1> STORESECTORINFO: 0 00009310 AF scasw ; di += 2 378 <1> ;INC DI ; SKIP OVER CYLINDER 379 <1> ;INC DI ; SKIP OVER HEAD 0 00009311 AD LODSW ; GET SECTOR ID 0 00009312 50 PUSH AX ; SAVE IT 0 00009313 AD LODSW ; GET SECTOR SIZE 0 00009314 E8BD02 CALL SECTORSIZETOSECTORINDEX 0 00009317 5A POP DX ; GET SECTOR ID BACK 0 00009318 88D0 MOV AL, DL ; AH = SECTOR SIZE INDEX 386 <1> ; AL = SECTOR ID 0 0000931A AB STOSW 0 0000931B E2F3 LOOP STORESECTORINFO 389 <1> 390 <1> SECTORINFOSAVED: 0 0000931D F8 CLC 0 0000931E C3 RET 393 <1> 394 <1> TOOMANYSECTORSPERTRACK: 0 0000931F B00C MOV AL, 0CH 0 00009321 F9 STC 0 00009322 C3 RET 398 <1> 399 <1> SETDEVICEPARAMETERS ENDP 400 <1> 401 <1> ; 402 <1> ; SET MEDIA TYPE FOR FORMAT 403 <1> ; PERFORMS THE INT 13 WITH AH = 18H TO SEE IF THE MEDIUM DESCRIBED IN THE 404 <1> ; BPB AREA IN THE BDS CAN BE HANDLED BY THE ROM. 405 <1> ; ON INPUT, DS:DI -> CURRENT BDS. 406 <1> ; THE STATUS OF THE OPERATION IS RETURNED IN AL 407 <1> ; - 0 - IF THE SUPPORT IS AVAILABLE, AND THE COMBINATION IS VALID. 408 <1> ; - 1 - NO ROM SUPPORT 409 <1> ; - 2 - ILLEGAL COMBINATION 410 <1> ; - 3 - No media present (ROM support exists but cannot determine now) 411 <1> ; FLAGS ALSO MAY BE ALTERED. ALL OTHER REGISTERS PRESERVED. 412 <1> ; IF THE CALL TO ROM RETURNS NO ERROR, THEN THE CURRENT DPT IS "REPLACED" BY 413 <1> ; THE ONE RETURNED BY THE ROM. THIS IS DONE BY CHANGING THE POINTER IN [DPT] 414 <1> ; TO THE ONE RETURNED. THE ORIGINAL POINTER TO THE DISK BASE TABLE IS STORED 415 <1> ; IN TEMPDPT, UNTIL IT IS RESTORED. 416 <1> ; 417 <1> PUBLIC SET_MEDIA_FOR_FORMAT 418 <1> SET_MEDIA_FOR_FORMAT PROC NEAR 419 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009323 5152 SAVEREG 0 00009325 31C0 XOR AX,AX 0 00009327 1E push ds 0 00009328 E8[0000] call biocode_get_ds_dosbiodata 424 <1> assume ds:DOSGROUP 0 0000932B 803E[0001]01 cmp byte [Had_Format_Error],1 ;Did we have a format error before? 0 00009330 7503 jne No_Form_Err ;AN001; 0 00009332 E82903 call ResetDisk 428 <1> No_Form_Err: ;AN001; 0 00009335 803E[FF00]01 CMP BYTE PTR [MEDIA_SET_FOR_FORMAT],1 0 0000933A 1F pop ds 431 <1> assume ds:UPB 0 0000933B 7503 jne Do_Set_Media_for_Format 0 0000933D E98E00 jmp SET_MED_RET ; MEDIA ALREADY SET 434 <1> Do_Set_Media_for_Format: 0 00009340 1E56 SAVEREG 0 00009342 8ED8 MOV DS,AX 437 <1> assume ds:IVT 0 00009344 C5367800 LDS SI,[DSKADR] ; GET POINTER TO DISK BASE TABLE 439 <1> assume ds:nothing 440 <1> ;SB34IOCTL000****************************************************************** 441 <1> ;SB Initialise the head settle time to 0fh. See the offsets given in 442 <1> ;SB DSKPRM.INC. 1 LOC. 443 <1> 0 00009348 C644090F mov byte [si + DISK_HEAD_STTL], 0Fh 445 <1> ;SB34IOCTL000****************************************************************** 0 0000934C 1E push ds 0 0000934D E8[0000] call biocode_get_ds_dosbiodata 448 <1> assume ds:DOSGROUP 0 00009350 8936[0000] MOV WORD PTR [DPT],SI 0 00009354 8F06[0200] pop WORD PTR [DPT+2], ; SAVE POINTER TO TABLE 0 00009358 C606[0000]01 mov byte [New_Rom], 1 ;assume a new ROM. 0 0000935D 5E1F RESTOREREG 453 <1> assume ds:UPB 454 <1> New_Rom equ NEW_ROM ; NASM port label 0 0000935F 30C0 XOR AL,AL 456 <1> ;SB33031**************************************************************** 457 <1> ccyln equ CCYLN ; NASM port equate 0 00009361 8B4D25 mov cx,[di + ccyln] ;get number of cylinders ;SB ;3.30* 0 00009364 49 dec cx ;cylinder must be zero based ;SB ;3.30* 0 00009365 80E503 and ch,03h ; blank out unnecessary bits 0 00009368 D0CD ror ch,1 ;put in int form ;SB ;3.30* 0 0000936A D0CD ror ch,1 ; ;SB ;3.30* 0 0000936C 86E9 xchg ch,cl ; ;SB ;3.30* 464 <1> seclim equ SECLIM ; NASM port equate 0 0000936E 0A4D13 or cl,byte ptr [di + seclim] ;get number of sectors ;SB ;3.30* 466 <1> drivenum equ DRIVENUM ; NASM port equate 0 00009371 8A5504 mov dl,[di + drivenum] ;get drive number ;SB ;3.30* 0 00009374 B418 mov ah,18h ;set media for format ;SB ;3.30* 0 00009376 061E5657 SAVEREG 0 0000937A CD13 int 13h ;call rom bios ;SB ;3.30* 471 <1> assume es:nothing 472 <1> ;SB33031**************************************************************** 0 0000937C 7230 JC FORMAT_STAT_ERR 474 <1> ; ES:DI POINTS TO A DISK BASE TABLE FOR THIS COMBINATION FOR THIS DRIVE. 0 0000937E 31C9 XOR CX,CX 0 00009380 8ED9 MOV DS,CX ; HAVE DS -> SEGMENT 0 477 <1> assume ds:IVT 0 00009382 8B367800 mov SI,[DSKADR] ; GET CURRENT DISK BASE TABLE 0 00009386 FF367A00 push word [DSKADR + 2] ; get segment 0 0000938A 893E7800 MOV WORD PTR [DSKADR],DI 0 0000938E 8C067A00 MOV WORD PTR [DSKADR+2],ES ; REPLACE WITH ONE RETURNED BY ROM 0 00009392 1F pop ds ; pop segment 483 <1> assume ds:nothing 0 00009393 E8[0000] call biocode_get_es_dosbiodata 485 <1> assume es:DOSGROUP 0 00009396 268936[0201] MOV WORD PTR [es:TEMPDPT],SI 0 0000939B 268C1E[0401] MOV WORD PTR [es:TEMPDPT+2],DS ; SAVE IT 0 000093A0 26C606[FF00]01 MOV BYTE PTR [es:MEDIA_SET_FOR_FORMAT],1 0 000093A6 30C0 XOR AL,AL ; LEGAL COMBINATION + ROM SUPPORT CODE 0 000093A8 26A2[0001] mov [es:Had_Format_Error],al ;reset the flag 0 000093AC EB1C JMP SHORT POP_STAT_RET 492 <1> 493 <1> FORMAT_STAT_ERR: 0 000093AE 80FC0C cmp ah, Dsk_illegal_combination ;J.K. illegal combination = 0ch 0 000093B1 7411 je Format_stat_illegal_comb 496 <1> Dsk_Time_Out_Err equ Dsk_time_out_Err ; NASM port equate 0 000093B3 80FC80 cmp ah, Dsk_Time_Out_Err ;J.K. = 80h 0 000093B6 7410 je Format_stat_Time_out 0 000093B8 B001 mov al, 1 ;Function not supported. 0 000093BA E8[0000] call biocode_get_ds_dosbiodata 501 <1> assume ds:DOSGROUP 0 000093BD C606[0000]00 mov byte [New_Rom], 0 ;So, it is an old rom. 503 <1> Pop_stat_ret equ POP_STAT_RET ; NASM port label 0 000093C2 EB06 jmp short Pop_stat_ret 505 <1> Format_stat_illegal_comb: ;J.K. Function supported, but 0 000093C4 B002 MOV AL,2 ;J.K. illegal sect/trk, trk combination. 0 000093C6 EB02 jmp short Pop_stat_ret 508 <1> Format_stat_Time_out: ;J.K. Function supported, but 0 000093C8 B003 mov al, 3 ;J.K. media not present. 510 <1> POP_STAT_RET: 0 000093CA 5F5E1F07 RESTOREREG 512 <1> assume ds:UPB, es:nothing 513 <1> SET_MED_RET: 0 000093CE 5A59 RESTOREREG 0 000093D0 C3 RET 516 <1> 517 <1> SET_MEDIA_FOR_FORMAT ENDP 518 <1> 519 <1> ; 520 <1> ; FORMATTRACK: 521 <1> ; IF SPECIALFUNCTION BYTE IS 1, THEN THIS IS A STATUS CALL TO SEE IF THERE IS 522 <1> ; ROM SUPPORT FOR THE COMBINATION OF SEC/TRK AND # OF CYLN, AND IF THE 523 <1> ; COMBINATION IS LEGAL. IF SPECIALFUNCTION BYTE IS 0, THEN FORMAT THE TRACK. 524 <1> ; 525 <1> ; INPUT: DS:DI POINTS TO BDS FOR DRIVE 526 <1> ; ES:BX POINTS TO FORMAT PACKET 527 <1> ; 528 <1> ; OUTPUT: 529 <1> ; FOR STATUS CALL: 530 <1> ; SPECIALFUNCTION BYTE SET TO: 531 <1> ; 0 - ROM SUPPORT + LEGAL COMBINATION 532 <1> ; 1 - NO ROM SUPPORT 533 <1> ; 2 - ILLEGAL COMBINATION 534 <1> ; 3 - no media present ;J.K. 7/8/86 535 <1> ; CARRY CLEARED. 536 <1> ; 537 <1> ; FOR FORMAT TRACK: 538 <1> ; CARRY SET IF ERROR 539 <1> ; 540 <1> PUBLIC FORMATTRACK 541 <1> FORMATTRACK PROC NEAR 542 <1> assume ds:UPB, es:nothing, ss:nothing 0 000093D1 26F60701 TEST BYTE PTR [ES:BX + DP_SPECIALFUNCTIONS],STATUS_FOR_FORMAT 0 000093D5 7408 JZ DO_FORMAT_TRACK 0 000093D7 E849FF CALL SET_MEDIA_FOR_FORMAT ; ALSO MOVES CURRENT DPT TO TEMPDPT 546 <1> STAT_RET: 0 000093DA 268807 MOV BYTE PTR [ES:BX + DP_SPECIALFUNCTIONS],AL 0 000093DD F8 CLC 0 000093DE C3 RET 550 <1> 551 <1> DO_FORMAT_TRACK: 0 000093DF 807D2205 CMP BYTE PTR [DI + FORMFACTOR], DEV_HARDDISK 0 000093E3 7503 jne Do_Format_Diskette 554 <1> DoVerifyTrack equ DOVERIFYTRACK ; NASM port label 0 000093E5 E99800 jmp DoVerifyTrack 556 <1> Do_Format_Diskette: 0 000093E8 1E570653 SAVEREG 558 <1> ;SB34IOCTL001************************************************************* 559 <1> ;SB check the special functions word to see if DO_FAST_FORMAT has been 560 <1> ;SB specified. If so it is an error and we need to finish this operation 561 <1> ;SB by indicating the error value 1 in register ah and going to the 562 <1> ;SB the code at DO_MAP_IT to map the error. This is because we cannot 563 <1> ;SB allow multitrack format on floppies - 5 LOCS 564 <1> 0 000093EC 26F60702 test byte ptr [es:bx + FP_SPECIALFUNCTIONS],DO_FAST_FORMAT 0 000093F0 7405 jz NO_FAST_FORMAT 0 000093F2 B401 mov ah, 1 568 <1> DO_MAP_IT equ Do_Map_it ; NASM port label 0 000093F4 EB78 jmp DO_MAP_IT 0 000093F6 90 nop ; identicalise 571 <1> NO_FAST_FORMAT: 572 <1> ;SB34IOCTL001************************************************************* 0 000093F7 E829FF CALL SET_MEDIA_FOR_FORMAT ; ALSO MOVES CURRENT DPT TO TEMPDPT 0 000093FA 3C01 CMP AL,1 ; DO WE HAVE ROM SUPPORT FOR sector/trk, # trks combination? 0 000093FC 7407 JZ Need_Set_DASD ;Old ROM. 0 000093FE 3C03 cmp al,3 ;time out error? 577 <1> No_Set_DASD equ NO_SET_DASD ; NASM port label 0 00009400 7506 jnz No_Set_DASD ;No, fine.(At this point, don't care about the illegal combination.) 0 00009402 EB5D jmp Format_Failed 0 00009404 90 nop ; identicalise 581 <1> Need_Set_DASD: 0 00009405 E8DF01 CALL SETDASD ;AH=17h, INT 13h 583 <1> ; 584 <1> ; STORE CYLINDER,HEAD IN TRACK TABLE 585 <1> ; ***** ASSUMPTION ******* 586 <1> ; SINCE FORMAT REQUESTS ON FIXED MEDIA ARE CONVERTED TO VERIFIES, WE 587 <1> ; ASSUME THAT WE ARE FORMATTING A FLOPPY AND HENCE HAVE 255 OR LESS 588 <1> ; TRACKS AND HEADS. WE THEREFORE MUST CHANGE THE CYLINDER, HEAD DATA 589 <1> ; FROM THE REQUEST PACKET SIZE TO THAT OF THE TRACKTABLE (SEE INT 13 590 <1> ; INTERFACE IN IBM'S TECH REF.). 591 <1> 592 <1> NO_SET_DASD: 593 <1> ; CHECK TO ENSURE CORRECT DISK IS IN DRIVE 0 00009408 E848F4 CALL CHECKSINGLE 595 <1> 0 0000940B 268B4703 MOV AX, WORD PTR [ES:BX + FP_CYLINDER] 0 0000940F 268B4F01 MOV CX, WORD PTR [ES:BX + FP_HEAD] 0 00009413 E8[0000] call biocode_get_es_dosbiodata 599 <1> assume es:DOSGROUP 0 00009416 26A3[0000] MOV WORD PTR [es:TRKNUM],AX 0 0000941A 26880E[0000] MOV BYTE PTR [es:HDNUM],CL 0 0000941F 88CC MOV AH,CL 603 <1> 0 00009421 57 PUSH DI ; SAVE PTR TO BDS 0 00009422 BF[0200] MOV DI, OFFSET TRACKTABLE ; access with es 0 00009425 268B0E[0000] MOV CX, [es:SECTORSPERTRACK] 607 <1> STORECYLINDERHEAD: 0 0000942A AB STOSW 0 0000942B 47 INC DI ; SKIP SECTOR ID 0 0000942C 47 INC DI ; SKIP SECTOR SIZE 0 0000942D E2FB LOOP STORECYLINDERHEAD 0 0000942F 5F POP DI ; RESTORE PTR TO BDS 613 <1> 0 00009430 B90500 MOV CX, MAXERR ; SET UP RETRY COUNT 615 <1> FORMATRETRY: 0 00009433 51 PUSH CX 0 00009434 BB[0200] MOV BX, OFFSET TRACKTABLE 0 00009437 E8[0000] call biocode_get_es_dosbiodata 619 <1> assume es:DOSGROUP 0 0000943A 26A1[0000] MOV AX, [es:SECTORSPERTRACK] 0 0000943E B405 MOV AH, ROMFORMAT 0 00009440 E82C02 CALL TO_ROM 0 00009443 59 POP CX 0 00009444 7330 JNC FORMATOK 625 <1> resetdisk equ RESETDISK ; NASM port label 0 00009446 E81502 call resetdisk 0 00009449 26C606[0001]01 mov byte [es:Had_Format_Error],1 0 0000944F 50 push ax 0 00009450 51 push cx 0 00009451 52 push dx 631 <1> Set_Media_For_Format equ SET_MEDIA_FOR_FORMAT ; NASM port label 0 00009452 E8CEFE call Set_Media_For_Format 0 00009455 3C01 cmp al, 1 0 00009457 7503 jnz While_Err 635 <1> SetDASD equ SETDASD ; NASM port label 0 00009459 E88B01 call SetDASD 637 <1> While_Err: 0 0000945C 5A pop dx 0 0000945D 59 pop cx 0 0000945E 58 pop ax 0 0000945F E2D2 LOOP FORMATRETRY 642 <1> ;SB33106******************************************************************* 643 <1> Format_Failed: 0 00009461 26C606[0001]01 mov byte [es:Had_Format_Error], 1 ;set the format error flag. 645 <1> Dsk_Change_Line_Err equ Dsk_change_line_Err ; NASM port equate 0 00009467 80FC06 cmp ah, Dsk_Change_Line_Err ;=06h. Convert change line 0 0000946A 7502 jne Do_Map_it ;error to Time Out error. 0 0000946C B480 mov ah, Dsk_Time_Out_Err ;=80h 649 <1> ;SB33106******************************************************************* 650 <1> Do_Map_it: 0 0000946E E836FA CALL MAPERROR 0 00009471 5B075F1F RESTOREREG 653 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009475 C3 RET 655 <1> 656 <1> FORMATOK: 657 <1> assume ds:nothing, es:DOSGROUP 0 00009476 26C606[0001]00 mov byte [es:Had_Format_Error],0 ; reset the format error flag. 0 0000947C 5B075F1F RESTOREREG 660 <1> assume ds:UPB, es:nothing, ss:nothing 661 <1> 662 <1> DOVERIFYTRACK: 0 00009480 E80800 CALL VERIFYTRACK 0 00009483 C3 RET 665 <1> 666 <1> FORMATTRACK ENDP 667 <1> 668 <1> VerifyTrack_Err: ;AN006; 0 00009484 B401 mov ah, 1 ;AN006; 670 <1> MapError equ MAPERROR ; NASM port label 0 00009486 E81EFA call MapError ;AN006; 0 00009489 1F pop ds 673 <1> assume ds:UPB, es:nothing, ss:nothing 0 0000948A C3 ret ;AN006; 675 <1> 676 <1> ; 677 <1> ; VERIFYTRACK: 678 <1> ; 679 <1> ; INPUT: DS:DI POINTS TO BDS FOR DRIVE 680 <1> ; ES:BX POINTS TO VERIFY PACKET 681 <1> ; 682 <1> PUBLIC VERIFYTRACK 683 <1> VERIFYTRACK PROC NEAR 684 <1> assume ds:UPB, es:nothing, ss:nothing 0 0000948B 1E push ds 0 0000948C E8[0000] call biocode_get_ds_dosbiodata 687 <1> assume ds:DOSGROUP 0 0000948F C606[0000]04 MOV byte [RFLAG], ROMVERIFY 0 00009494 268B4703 MOV AX, WORD PTR [ES:BX + VP_CYLINDER] 0 00009498 A3[0000] MOV [CURTRK], AX 0 0000949B 268B4701 MOV AX, WORD PTR [ES:BX + VP_HEAD] 692 <1> 693 <1> ; ****** ASSUMPTION ****** 694 <1> ; WE ASSUME THAT WE HAVE LESS THAN 256 HEADS, AND THAT THE REQUEST 695 <1> ; HEADER DATA STRUCTURE IS UNNECCESSARILY BIG 0 0000949F A2[0000] MOV [CURHD], AL 0 000094A2 8B0E[0000] MOV CX, [SECTORSPERTRACK] ;CL = sectors/track 698 <1> ;SB34IOCTL005************************************************************* 699 <1> ;SB 700 <1> ;SB Check SPECIALFUNCTIONS to see if DO_FAST_FORMAT has been specified 701 <1> ;SB If not we should go to the normal track verification routine. If 702 <1> ;SB fast format has been specified we should get the number of tracks 703 <1> ;SB to be verified and check it to see if it is > 255. If it is then 704 <1> ;SB it is an error and we should go to VerifyTrack_Err. If not multiply 705 <1> ;SB the number of tracks by the sectors per track to get the total 706 <1> ;SB number of sectors to be verified. This should also be less than 707 <1> ;SB equal to 255 otherwise we go to same error exit. If everything 708 <1> ;SB is okay we initalise cx to the total sectors. use ax as a temporary 709 <1> ;SB register. 9 LOCS 710 <1> 0 000094A6 26F60702 test byte ptr [es:bx + FP_SPECIALFUNCTIONS],DO_FAST_FORMAT 0 000094AA 742B jz Norm_VerifyTrack 0 000094AC 268B4705 mov ax,[es:bx + FP_TRACKCOUNT] ;ax <- tracks to be verify 0 000094B0 3DFF00 cmp ax,0FFh 0 000094B3 77CF ja VerifyTrack_Err ;#tracks > 255 0 000094B5 F6E1 mul cl 0 000094B7 3DFF00 cmp ax,0FFh ;#sectors > 255 0 000094BA 77C8 ja VerifyTrack_Err 0 000094BC 89C1 mov cx,ax ;#sectors to verify 720 <1> ;SB34IOCTL005************************************************************* 721 <1> 0 000094BE 1F pop ds 723 <1> assume ds:UPB 0 000094BF 1E push ds ; -> UPB 725 <1> 726 <1> ;Set the multi track request flag 0 000094C0 F745230100 test word ptr [di + Flags], fNON_REMOVABLE ;AN009;hard disk? 0 000094C5 7410 jz Norm_VerifyTrack ;AN009; 729 <1> Multrk_Flag equ MulTrk_Flag ; NASM port label 0 000094C7 E8[0000] call biocode_get_ds_dosbiodata 731 <1> assume ds:DOSGROUP 0 000094CA F706[0000]8000 test word [Multrk_Flag], MULTRK_ON ;AN009;MultiTrack operation = on? 0 000094D0 7405 jz Norm_VerifyTrack ;AN009; 734 <1> Multitrk_Format_Flag equ MultiTrk_Format_Flag ; NASM port label 0 000094D2 C606[0000]01 mov byte [Multitrk_Format_Flag], 1 ;AN009; then set the flag 736 <1> Norm_VerifyTrack: ;AN006; 0 000094D7 31C0 XOR AX, AX ;1st sector 738 <1> ; USE 0:0 AS THE TRANSFER ADDRESS FOR VERIFY 0 000094D9 31DB XOR BX, BX 0 000094DB 8EC3 MOV ES, BX 741 <1> assume es:IVT 0 000094DD 1F pop ds 743 <1> assume ds:UPB 0 000094DE E84600 CALL TRACKIO 0 000094E1 1E push ds 0 000094E2 E8[0000] call biocode_get_ds_dosbiodata 747 <1> assume ds:DOSGROUP 0 000094E5 C606[0000]00 mov byte [Multitrk_Format_Flag], 0 ;AN009;Reset the flag. 0 000094EA 1F pop ds 750 <1> assume ds:UPB 0 000094EB C3 RET 752 <1> VERIFYTRACK ENDP 753 <1> 754 <1> ; 755 <1> ; READTRACK: 756 <1> ; 757 <1> ; INPUT: DS:DI POINTS TO BDS FOR DRIVE 758 <1> ; ES:BX POINTS TO READ PACKET 759 <1> ; 760 <1> PUBLIC READTRACK 761 <1> READTRACK: 762 <1> assume ds:UPB, es:nothing, ss:nothing 0 000094EC 1E push ds 0 000094ED E8[0000] call biocode_get_ds_dosbiodata 765 <1> assume ds:DOSGROUP 0 000094F0 C606[0000]02 MOV byte [RFLAG], ROMREAD 0 000094F5 1F pop ds 768 <1> assume ds:UPB 0 000094F6 EB0C JMP READWRITETRACK 770 <1> 771 <1> ; 772 <1> ; WRITETRACK: 773 <1> ; 774 <1> ; INPUT: DS:DI POINTS TO BDS FOR DRIVE 775 <1> ; ES:BX POINTS TO WRITE PACKET 776 <1> ; 777 <1> PUBLIC WRITETRACK 778 <1> WRITETRACK: 779 <1> assume ds:UPB, es:nothing, ss:nothing 0 000094F8 1E push ds 0 000094F9 E8[0000] call biocode_get_ds_dosbiodata 782 <1> assume ds:DOSGROUP 0 000094FC C606[0000]03 MOV byte [RFLAG], ROMWRITE 0 00009501 1F pop ds 785 <1> assume ds:UPB 0 00009502 EB00 JMP READWRITETRACK 787 <1> 788 <1> ; 789 <1> ; READWRITETRACK: 790 <1> ; 791 <1> ; INPUT: 792 <1> ; DS:DI POINTS TO BDS FOR DRIVE 793 <1> ; ES:BX POINTS TO WRITE PACKET 794 <1> ; RFLAG - 2 FOR READ, 3 FOR WRITE 795 <1> ; 796 <1> PUBLIC READWRITETRACK 797 <1> READWRITETRACK PROC NEAR 798 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009504 1E push ds 0 00009505 E8[0000] call biocode_get_ds_dosbiodata 801 <1> assume ds:DOSGROUP 0 00009508 268B4703 MOV AX, WORD PTR [ES:BX + TRWP_CYLINDER] 0 0000950C A3[0000] MOV [CURTRK], AX 0 0000950F 268B4701 MOV AX, WORD PTR [ES:BX + TRWP_HEAD] 805 <1> 806 <1> ; ****** ASSUMPTION ****** 807 <1> ; WE ASSUME THAT WE HAVE LESS THAN 256 HEADS, AND THAT THE REQUEST 808 <1> ; HEADER DATA STRUCTURE IS UNNECCESSARILY BIG 0 00009513 A2[0000] MOV [CURHD], AL 0 00009516 268B4705 MOV AX, WORD PTR [ES:BX + TRWP_FIRSTSECTOR] 0 0000951A 268B4F07 MOV CX, WORD PTR [ES:BX + TRWP_SECTORSTOREADWRITE] 0 0000951E 26C45F09 LES BX, [ES:BX + TRWP_TRANSFERADDRESS] 0 00009522 1F pop ds 814 <1> assume ds:UPB 0 00009523 E80100 CALL TRACKIO 0 00009526 C3 RET 817 <1> READWRITETRACK ENDP 818 <1> 819 <1> 820 <1> ; 821 <1> ; TRACKIO: 822 <1> ; PERFORMS TRACK READ/WRITE/VERIFY 823 <1> ; 824 <1> ; INPUT: 825 <1> ; RFLAG - 2 = READ 826 <1> ; 3 = WRITE 827 <1> ; 4 = VERIFY 828 <1> ; AX - INDEX INTO TRACK TABLE OF FIRST SECTOR TO IO 829 <1> ; CX - NUMBER OF SECTORS TO IO 830 <1> ; ES:BX - TRANSFER ADDRESS 831 <1> ; DS:DI - POINTER TO BDS 832 <1> ; CURTRK - CURRENT CYLINDER 833 <1> ; CURHD - CURRENT HEAD 834 <1> ; 835 <1> PUBLIC TRACKIO 836 <1> TRACKIO PROC NEAR 837 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 838 <1> ; PROCEDURE `DISK' WILL POP STACK TO SPSAV AND RETURN IF ERROR 0 00009527 1E push ds 0 00009528 E8[0000] call biocode_get_ds_dosbiodata 841 <1> assume ds:DOSGROUP 0 0000952B 8926[0000] MOV [SPSAV], SP 0 0000952F 8306[0000]02 add word [SPSAV], 2 ; discard ds off the stack 0 00009534 1F pop ds 845 <1> assume ds:UPB 846 <1> ; ENSURE CORRECT DISK IS IN DRIVE 0 00009535 E81BF3 CALL CHECKSINGLE 848 <1> ; SEE IF WE HAVE ALREADY SET THE DISK BASE TABLE 0 00009538 1E push ds 0 00009539 E8[0000] call biocode_get_ds_dosbiodata 851 <1> assume ds:DOSGROUP 0 0000953C 803E[FF00]01 CMP BYTE PTR [MEDIA_SET_FOR_FORMAT],1 0 00009541 1F pop ds 854 <1> assume ds:UPB 0 00009542 7407 JZ DPTALREADYSET 856 <1> ; 857 <1> ; SET UP TABLES AND VARIABLES FOR I/O 858 <1> ; 0 00009544 5051 SAVEREG 0 00009546 E823F6 CALL IOSETUP 0 00009549 5958 RESTOREREG 862 <1> ; 863 <1> ; POINT SI AT THE TABLE ENTRY OF THE FIRST SECTOR TO BE IO'D 864 <1> ; 865 <1> DPTALREADYSET: 0 0000954B BE[0200] MOV SI, OFFSET TRACKTABLE 0 0000954E D1E0 SHL AX, 1 0 00009550 D1E0 SHL AX, 1 0 00009552 01C6 ADD SI, AX 870 <1> ; 871 <1> ; WE WANT: 872 <1> ; CX TO BE THE NUMBER OF TIMES WE HAVE TO LOOP 873 <1> ; DX TO BE THE NUMBER OF SECTORS WE READ ON EACH ITERATION 0 00009554 BA0100 MOV DX, 1 0 00009557 F745230800 TEST WORD PTR [DI + FLAGS], GOOD_TRACKLAYOUT 0 0000955C 7402 JZ IONEXTSECTOR 877 <1> 878 <1> ; HEY! WE CAN READ ALL THE SECTORS IN ONE BLOW 0 0000955E 87D1 XCHG DX, CX 880 <1> 881 <1> IONEXTSECTOR: 0 00009560 51 PUSH CX 0 00009561 52 PUSH DX 0 00009562 1E push ds 0 00009563 E8[0000] call biocode_get_ds_dosbiodata 886 <1> assume ds:DOSGROUP 887 <1> ; SKIP OVER THE CYLINDER AND HEAD IN THE TRACK TABLE 0 00009566 46 INC SI 0 00009567 46 INC SI 890 <1> ; GET SECTOR ID FROM TRACK TABLE 0 00009568 AC LODSb 0 00009569 A2[0000] MOV [CURSEC], AL 893 <1> ;*** For a Fixed disk multi-track disk I/O - J.K. 4/14/86 894 <1> ;Assumptions: 1). In the input CX (# of sectors to go) to TRACKIO, only CL is 895 <1> ;valid. 2). Sector size should be set to 512 bytes. 3). GOODTRACKLAYOUT. 896 <1> ; 0 0000956C 1F pop ds 898 <1> assume ds:UPB 0 0000956D 1E push ds 0 0000956E F745230100 test word ptr [di + Flags], fNon_Removable ;Fixed disk? - J.K. 0 00009573 7419 jz IOREMOVABLE ;no -J.K. 0 00009575 E8[0000] call biocode_get_ds_dosbiodata 903 <1> assume ds:DOSGROUP 0 00009578 F706[0000]8000 test word [MulTrk_Flag], MULTRK_ON ;AN002; Allow multi-track operation? 905 <1> IORemovable equ IOREMOVABLE ; NASM port label 0 0000957E 740E jz IORemovable ;AN002; No, don't do that. 907 <1> seccnt equ SECCNT ; NASM port label 0 00009580 8916[0000] mov [seccnt], dx ;# of sectors to I/O -J.K. 0 00009584 89D0 mov ax, dx ;J.K. 0 00009586 1F pop ds 911 <1> assume ds:UPB 912 <1> disk equ DISK ; NASM port label 0 00009587 E893F7 call disk ;J.K. 0 0000958A 5A pop dx ;J.K. 0 0000958B 59 pop cx ;J.K. 0 0000958C F8 clc ;J.K. 0 0000958D C3 ret ;J.K. 918 <1> IOREMOVABLE: ;J.K. 919 <1> ; GET SECTOR SIZE INDEX FROM TRACK TABLE AND SAVE IT 0 0000958E E8[0000] call biocode_get_ds_dosbiodata 921 <1> assume ds:DOSGROUP 0 00009591 AC LODSb 0 00009592 8F06[0000] pop word [dosbiodata_temp_ds] 0 00009596 50 PUSH AX 925 <1> ; PATCH SECTOR SIZE IN DPT 0 00009597 56 PUSH SI 0 00009598 1E PUSH DS 0 00009599 C536[0000] LDS SI, [DPT] 929 <1> assume ds:nothing 0 0000959D 884403 MOV BYTE PTR [SI + DISK_SECTOR_SIZ],AL 0 000095A0 1E push ds 0 000095A1 E8[0000] call biocode_get_ds_dosbiodata 933 <1> assume ds:DOSGROUP 0 000095A4 A0[0000] MOV AL,[EOT] 0 000095A7 1F pop ds 936 <1> assume ds:nothing 0 000095A8 884404 MOV [SI + DISK_EOT],AL ; SET UP THE MAX NUMBER OF SEC/TRACK 0 000095AB 1F POP DS 939 <1> assume ds:DOSGROUP 0 000095AC 88D0 MOV AL, DL 941 <1> DOTHEIO: 0 000095AE A3[0000] MOV [SECCNT],AX ; SET UP THE COUNT OF SECTORS TO I/O 0 000095B1 8E1E[0000] mov ds, word [dosbiodata_temp_ds] 944 <1> assume ds:UPB 0 000095B5 E865F7 CALL DISK 946 <1> ; ADVANCE BUFFER POINTER BY ADDING SECTOR SIZE 0 000095B8 5E POP SI 0 000095B9 58 POP AX 0 000095BA E82200 CALL SECTORSIZEINDEXTOSECTORSIZE 0 000095BD 01C3 ADD BX, AX 0 000095BF 5A POP DX 0 000095C0 59 POP CX 0 000095C1 E29D LOOP IONEXTSECTOR 0 000095C3 1E push ds 0 000095C4 E8[0000] call biocode_get_ds_dosbiodata 956 <1> assume ds:DOSGROUP 0 000095C7 803E[FF00]01 cmp byte ptr [Media_Set_For_Format], 1 ;AN001; 0 000095CC 1F pop ds 959 <1> assume ds:UPB 0 000095CD 7403 je No_Need_Done ;AN001; 0 000095CF E8E7F5 CALL msbiodisk_DONE ; SET TIME OF LAST ACCESS, AND RESET 962 <1> No_Need_Done: ;AN001; 0 000095D2 F8 CLC ; ENTRIES IN DPT. 0 000095D3 C3 RET 965 <1> 966 <1> TRACKIO ENDP 967 <1> ; 968 <1> ; THE SECTOR SIZE IN BYTES NEEDS TO BE CONVERTED TO AN INDEX VALUE FOR THE IBM 969 <1> ; ROM. (0=>128, 1=>256,2=>512,3=>1024). IT IS ASSUMED THAT ONLY THESE VALUES 970 <1> ; ARE PERMISSIBLE. 971 <1> ; ON INPUT AX CONTAINS SECTOR SIZE IN BYTES 972 <1> ; ON OUTPUT AL CONTAINS INDEX 973 <1> ; 974 <1> PUBLIC SECTORSIZETOSECTORINDEX 975 <1> SECTORSIZETOSECTORINDEX PROC NEAR 0 000095D4 80FC02 CMP AH,2 ; EXAMINE UPPER BYTE ONLY 0 000095D7 7703 JA ONEK 0 000095D9 88E0 MOV AL,AH ; VALUE IN AH IS THE INDEX! 0 000095DB C3 RET 980 <1> ONEK: 0 000095DC B003 MOV AL,3 0 000095DE C3 RET 983 <1> SECTORSIZETOSECTORINDEX ENDP 984 <1> 985 <1> SECTORSIZEINDEXTOSECTORSIZE PROC NEAR 0 000095DF 88C1 MOV CL, AL 0 000095E1 B88000 MOV AX,128 0 000095E4 D3E0 SHL AX, CL 0 000095E6 C3 RET 990 <1> SECTORSIZEINDEXTOSECTORSIZE ENDP 991 <1> 992 <1> ; 993 <1> ; SET UP THE ROM FOR FORMATTING. 994 <1> ; WE HAVE TO TELL THE ROM BIOS WHAT TYPE OF DISK IS IN THE DRIVE. 995 <1> ; ON INPUT - DS:DI - POINTS TO BDS 996 <1> ; 997 <1> PUBLIC SETDASD 998 <1> SETDASD: 999 <1> assume ds:UPB, es:nothing, ss:nothing 1000 <1> ; SEE IF WE HAVE PREVIOUSLY SET DASD TYPE 1001 <1> ;SB33114****************************************************************** 0 000095E7 1E push ds 0 000095E8 E8[0000] call biocode_get_ds_dosbiodata 1004 <1> assume ds:DOSGROUP 0 000095EB 803E[0001]01 cmp byte [Had_Format_Error],1 0 000095F0 1F pop ds 1007 <1> assume ds:UPB 0 000095F1 740C je DoSetDasd 1009 <1> ;SB33114****************************************************************** 0 000095F3 F745238000 TEST WORD PTR [DI + FLAGS], SET_DASD_TRUE 0 000095F8 7452 JZ DASDHASBEENSET 0 000095FA 8165237FFF AND WORD PTR [DI + FLAGS], ~ SET_DASD_TRUE 1013 <1> ;SB33115****************************************************************** 1014 <1> DoSetDasd: 0 000095FF 1E push ds 0 00009600 E8[0000] call biocode_get_ds_dosbiodata 1017 <1> assume ds:DOSGROUP 0 00009603 C606[0001]00 mov byte [Had_Format_Error],0 ;reset it 1019 <1> ;SB33115****************************************************************** 0 00009608 C606[0000]50 MOV byte [GAP_PATCH],50H ; FORMAT GAP FOR 48TPI DISKS 0 0000960D 1F pop ds 1022 <1> assume ds:UPB 0 0000960E B004 MOV AL,4 0 00009610 807D2202 CMP BYTE PTR [DI + FORMFACTOR],DEV_3INCH720KB 0 00009614 741F JZ DO_SET 0 00009616 807D2201 CMP BYTE PTR [DI + FORMFACTOR], DEV_5INCH96TPI 0 0000961A 7404 JZ GOT_BIG 0 0000961C B001 MOV AL,1 ; 160/320K IN A 160/320K DRIVE 0 0000961E EB15 JMP SHORT DO_SET 1030 <1> GOT_BIG: 0 00009620 B002 MOV AL,2 ; 160/320K IN A 1.2 MEG DRIVE 0 00009622 1E push ds 0 00009623 E8[0000] call biocode_get_ds_dosbiodata 1034 <1> assume ds:DOSGROUP 0 00009626 803E[FE00]00 CMP byte [MEDIATYPE], 0 0 0000962B 7507 JNE DO_SET_b 0 0000962D B003 MOV AL,3 ; 1.2MEG IN A 1.2MEG DRIVE 0 0000962F C606[0000]54 MOV byte [GAP_PATCH],54H 1039 <1> DO_SET_b: 0 00009634 1F pop ds 1041 <1> assume ds:UPB 1042 <1> DO_SET: 0 00009635 1E push ds ;AN003; 0 00009636 56 push si ;AN003; 1045 <1> ;SB34IOCTL002**************************************************************** 1046 <1> ;SB Get the disk parameter table address (dword address) from the location 1047 <1> ;SB 0:[DSKADR] and fix the head settle time in this to be 0fh. 4 LOCS 1048 <1> 0 00009637 31F6 xor si, si 0 00009639 8EDE mov ds, si 1051 <1> assume ds:IVT 0 0000963B C5367800 lds si, [DSKADR] 1053 <1> assume ds:nothing 0 0000963F C644090F mov byte [si + DISK_HEAD_STTL], 0Fh 1055 <1> ;SB34IOCTL002**************************************************************** 0 00009643 5E pop si ;AN003; 0 00009644 1F pop ds ;AN003; 1058 <1> assume ds:UPB 1059 <1> ;SB33032****************************************************************** 0 00009645 B417 mov AH, 17h ; set command to Set DASD type;SB ;3.30* 0 00009647 8A5504 mov DL, [di + DriveNum] ; set drive number ;SB ;3.30* 0 0000964A CD13 int 13h ; call rom-bios ;SB ;3.30* 1063 <1> ;SB33032****************************************************************** 1064 <1> DASDHASBEENSET: 0 0000964C 8A6513 MOV AH,BYTE PTR [DI + SECLIM] 0 0000964F 1E push ds 0 00009650 E8[0000] call biocode_get_ds_dosbiodata 1068 <1> assume ds:DOSGROUP 0 00009653 8826[0000] MOV [FORMT_EOT],AH 0 00009657 1F pop ds 1071 <1> assume ds:UPB 0 00009658 C3 RET 1073 <1> 1074 <1> ; 1075 <1> ; THIS ROUTINE IS CALLED IF AN ERROR OCCURS WHILE FORMATTING OR VERIFYING. 1076 <1> ; IT RESETS THE DRIVE, AND DECREMENTS THE RETRY COUNT. 1077 <1> ; ON ENTRY - DS:DI - POINTS TO BDS FOR THE DRIVE 1078 <1> ; BP - CONTAINS RETRY COUNT 1079 <1> ; ON EXIT FLAGS INDICATE RESULT OF DECREMENTING RETRY COUNT 1080 <1> ; 1081 <1> AGAIN: 1082 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009659 E80200 CALL RESETDISK 1084 <1> 1085 <1> ;(deleted section here, as requested by D.L.) 1086 <1> 0 0000965C 4D DEC BP ; DECREMENT RETRY COUNT 0 0000965D C3 RET 1089 <1> 1090 <1> 1091 <1> ; RESET THE DRIVE. 1092 <1> ; WE ALSO SET [STEP_DRV] TO -1 TO FORCE THE MAIN DISK ROUTINE TO USE THE 1093 <1> ; SLOW HEAD SETTLE TIME FOR THE NEXT OPERATION. THIS IS BECAUSE THE RESET 1094 <1> ; OPERATION MOVES THE HEAD TO CYLINDER 0, SO WE NEED TO DO A SEEK THE NEXT 1095 <1> ; TIME AROUND - THERE IS A PROBLEM WITH 3.5" DRIVES IN THAT THE HEAD DOES 1096 <1> ; NOT SETTLE DOWN IN TIME, EVEN FOR READ OPERATIONS!! 1097 <1> ; 1098 <1> PUBLIC RESETDISK 1099 <1> RESETDISK: 1100 <1> assume ds:UPB, es:nothing, ss:nothing 0 0000965E 50 SAVEREG 1102 <1> ;SB33033****************************************************************** 0 0000965F 30E4 xor AH, AH ; set command to reset disk ;SB ;3.30* 0 00009661 CD13 int 13h ; call the rom-bios ;SB ;3.30* 1105 <1> ;SB33033****************************************************************** 0 00009663 1E push ds 0 00009664 E8[0000] call biocode_get_ds_dosbiodata 1108 <1> assume ds:DOSGROUP 0 00009667 C606[0000]FF MOV byte [STEP_DRV],-1 ; ZAP UP THE SPEED 0 0000966C 1F pop ds 1111 <1> assume ds:UPB 0 0000966D 58 RESTOREREG 0 0000966E C3 RET 1114 <1> 1115 <1> ; 1116 <1> ; THIS ROUTINE SETS UP THE DRIVE PARAMETER TABLE WITH THE VALUES NEEDED FOR 1117 <1> ; FORMAT, DOES AN INT 13. VALUES IN DPT ARE RESTORED AFTER A VERIFY IS DONE. 1118 <1> ; 1119 <1> ; ON ENTRY - DS:DI - POINTS TO BDS FOR THE DRIVE 1120 <1> ; ES:BX - POINTS TO TRKBUF 1121 <1> ; AL - NUMBER OF SECTORS 1122 <1> ; AH - INT 13 FUNCTION CODE 1123 <1> ; CL - SECTOR NUMBER FOR VERIFY 1124 <1> ; ON EXIT - DS,DI,ES,BX REMAIN UNCHANGED. 1125 <1> ; AX AND FLAGS ARE THE RESULTS OF THE INT 13 1126 <1> ; 1127 <1> PUBLIC TO_ROM 1128 <1> TO_ROM: 0 0000966F 1E57065356 SAVEREG 0 00009674 1E push ds 0 00009675 E8[0000] call biocode_get_ds_dosbiodata 1132 <1> assume ds:DOSGROUP 0 00009678 F606[0000]01 TEST BYTE PTR [NEW_ROM],1 0 0000967D 1F pop ds 1135 <1> assume ds:UPB 0 0000967E 753D JNZ GOT_VALID_DPT 0 00009680 50 PUSH AX 0 00009681 8CDA MOV DX,DS ; SAVE DS:DI-> BDS 0 00009683 31C0 XOR AX,AX 0 00009685 8ED8 MOV DS,AX 1141 <1> assume ds:IVT 0 00009687 C5367800 LDS SI,[DSKADR] ; GET POINTER TO DISK BASE TABLE 1143 <1> assume ds:nothing 0 0000968B 06 push es 0 0000968C E8[0000] call biocode_get_es_dosbiodata 1146 <1> assume es:DOSGROUP 0 0000968F 268936[0000] MOV WORD PTR [es:DPT],SI 0 00009694 268C1E[0200] MOV WORD PTR [es:DPT+2],DS ; SAVE POINTER TO TABLE 0 00009699 26A0[0000] MOV AL,[es:FORMT_EOT] 0 0000969D 884404 MOV [SI + DISK_EOT],AL 0 000096A0 26A0[0000] MOV AL,[es:GAP_PATCH] 0 000096A4 884407 MOV [SI + DISK_FORMT_GAP],AL ; IMPORTANT FOR FORMAT 0 000096A7 C644090F MOV byte [SI + DISK_HEAD_STTL],15 ; ASSUME WE ARE DOING A SEEK OPERATION 1154 <1> ; SET UP MOTOR START CORRECTLY FOR 3.5" DRIVES. 0 000096AB 8EC2 MOV ES,DX 1156 <1> assume es:UPB 0 000096AD 26807D2202 CMP BYTE PTR [ES:DI + FORMFACTOR],FFSMALL ; IS IT A 3.5" DRIVE? 0 000096B2 7505 JNZ MOTORSTRTOK 0 000096B4 B004 MOV AL,4 0 000096B6 86440A XCHG AL,[SI + DISK_MOTOR_STRT] 1161 <1> MOTORSTRTOK: 0 000096B9 07 POP ES 1163 <1> assume es:nothing 1164 <1> ;---------------------------------------------------------------------------- 1165 <1> ; THE FOLLOWING TWO LINES ARE NO LONGER NECESSARY SINCE THEY ARE ONLY USEFUL 1166 <1> ; FOR A VERIFY OPERATION. 1167 <1> ; MOV AL,[CS:SECTOR_SIZ_IND] 1168 <1> ; MOV [SI].DISK_SECTOR_SIZ,AL ; IMPORTANT FOR VERIFY 1169 <1> ;---------------------------------------------------------------------------- 0 000096BA 8EDA MOV DS,DX ; RESTORE DS:DI-> BDS 1171 <1> assume ds:UPB 0 000096BC 58 POP AX 1173 <1> GOT_VALID_DPT: 1174 <1> ;SB33034******************************************************************* 1175 <1> trknum equ TRKNUM ; NASM port label 0 000096BD 1E push ds 0 000096BE E8[0000] call biocode_get_ds_dosbiodata 1178 <1> assume ds:DOSGROUP 0 000096C1 8B16[0000] mov dx, [trknum] ; set track number ;SB ;3.30* 0 000096C5 88D5 mov ch,dl ; set low 8 bits in ch ;SB ;3.30* 0 000096C7 8A36[0000] mov DH, [HDNUM] ; set head number ;SB ;3.30* 0 000096CB 1F pop ds 1183 <1> assume ds:UPB 0 000096CC 8A5504 mov DL, [di + DriveNum] ; set drive number ;SB ;3.30* 0 000096CF CD13 int 13h ; call the rom-bios routines ;SB ;3.30* 1186 <1> ;SB33034******************************************************************* 0 000096D1 5E5B075F1F RESTOREREG 1188 <1> assume ds:UPB, es:nothing, ss:nothing 0 000096D6 C3 RET 1190 <1> 1191 <1> ; 1192 <1> ; GET THE OWNER OF THE PHYSICAL DRIVE REPRESENTED BY THE LOGICAL DRIVE IN BL. 1193 <1> ; THE ASSUMPTION IS THAT WE **ALWAYS** KEEP TRACK OF THE OWNER OF A DRIVE!! 1194 <1> ; IF THIS IS NOT THE CASE, THE SYSTEM MAY HANG, JUST FOLLOWING THE LINKED LIST. 1195 <1> ; 1196 <1> PUBLIC IOCTL$GETOWN 1197 <1> IOCTL$GETOWN: 0 000096D7 E829F1 CALL SETDRIVE 1199 <1> assume ds:UPB, es:nothing, ss:nothing 0 000096DA 7303E9[0000] jc DSK$UNKNOWN 0 000096DF 8A4504 MOV AL,BYTE PTR [DI + DRIVENUM] ; GET PHYSICAL DRIVE NUMBER 0 000096E2 E8[0000] call biocode_get_ds_dosbiodata 1203 <1> assume ds:DOSGROUP 0 000096E5 C53E[0000] lds di, [START_BDS] 1205 <1> assume ds:UPB 1206 <1> OWN_LOOP: 0 000096E9 83FFFF cmp di, -1 0 000096EC 7503E9[0000] je DSK$UNKNOWN 0 000096F1 384504 CMP BYTE PTR [DI + DRIVENUM],AL 0 000096F4 7507 JNE GETNEXTBDS 0 000096F6 F745232000 TEST WORD PTR [DI + FLAGS],FI_OWN_PHYSICAL 0 000096FB 7504 JNZ DONE_GETOWN 1213 <1> GETNEXTBDS: 0 000096FD C53D lds di, [DI + LINK] 0 000096FF EBE8 JMP SHORT OWN_LOOP 1216 <1> DONE_GETOWN: 0 00009701 EB2A JMP SHORT EXIT_OWN 1218 <1> 1219 <1> ; 1220 <1> ; SET THE OWNERSHIP OF THE PHYSICAL DRIVE REPRESENTED BY THE LOGICAL DRIVE IN 1221 <1> ; BL TO BL. 1222 <1> ; 1223 <1> PUBLIC IOCTL$SETOWN 1224 <1> IOCTL$SETOWN: 0 00009703 E8FDF0 CALL SETDRIVE 1226 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009706 7303E9[0000] jc DSK$UNKNOWN 0 0000970B 1E push ds 0 0000970C E8[0000] call biocode_get_ds_dosbiodata 1230 <1> assume ds:DOSGROUP 0 0000970F C606[0000]01 MOV BYTE PTR [FSETOWNER],1 ; SET FLAG FOR CHECKSINGLE TO 0 00009714 1F pop ds 1233 <1> assume ds:UPB 1234 <1> ; LOOK AT. 0 00009715 E83BF1 CALL CHECKSINGLE ; SET OWNERSHIP OF DRIVE 0 00009718 1E push ds 0 00009719 E8[0000] call biocode_get_ds_dosbiodata 1238 <1> assume ds:DOSGROUP 0 0000971C C606[0000]00 MOV BYTE PTR [FSETOWNER],0 ; RESET FLAG 0 00009721 1F pop ds 1241 <1> assume ds:UPB 0 00009722 31DB XOR BX,BX 0 00009724 8EC3 MOV ES,BX 1244 <1> assume es:IVT 0 00009726 B1FF MOV CL,-1 0 00009728 26880E0405 MOV BYTE PTR [ES:LSTDRV],CL ; SET UP SDSB AS WELL 1247 <1> 1248 <1> EXIT_OWN: 1249 <1> assume ds:UPB, es:nothing, ss:nothing 1250 <1> ; IF THERE IS ONLY ONE LOGICAL DRIVE ASSIGNED TO THIS PHYSICAL DRIVE, RETURN 1251 <1> ; 0 TO USER TO INDICATE THIS. 0 0000972D 30C9 XOR CL,CL 0 0000972F F745231000 TEST WORD PTR [DI + FLAGS],FI_AM_MULT 0 00009734 7404 JZ EXIT_NO_MULT 0 00009736 8A4D05 MOV CL,BYTE PTR [DI + DRIVELET] ; GET LOGICAL DRIVE NUMBER 0 00009739 41 inc cx ; GET IT 1-BASED 1257 <1> EXIT_NO_MULT: 0 0000973A E8[0000] call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 1259 <1> assume ds:DOSENTRYGROUP 0 0000973D C51E[0000] lds bx, [PTRSAV] 1261 <1> assume ds:nothing 0 00009741 884F01 MOV BYTE PTR [BX + UNIT],CL 0 00009744 E9[0000] JMP EXIT 1264 <1> 1265 <1> 1266 <1> ; 1267 <1> ; MOVES THE OLD DPT THAT HAD BEEN SAVED IN TEMPDPT BACK TO DPT. THIS IS DONE 1268 <1> ; ONLY IF THE FIRST BYTE OF TEMPDPT IS NOT -1. 1269 <1> ; ALL REGISTERS (INCLUDING FLAGS) ARE PRESERVED. 1270 <1> ; 1271 <1> PUBLIC RESTOREOLDDPT 1272 <1> RESTOREOLDDPT: 1273 <1> assume ds:nothing, es:nothing, ss:nothing 1274 <1> ; IF WE HAVE ALREADY RESTORED THE DISK BASE TABLE EARLIER, DO NOT DO IT 1275 <1> ; AGAIN. 0 00009747 50 PUSH AX 0 00009748 30C0 XOR AL,AL 1278 <1> ; RESET FLAG AND GET CURRENT FLAG SETTING 0 0000974A 1E push ds 0 0000974B E8[0000] call biocode_get_ds_dosbiodata 1281 <1> assume ds:DOSGROUP 0 0000974E A2[0001] mov [Had_Format_Error],al 0 00009751 8606[FF00] XCHG BYTE PTR [MEDIA_SET_FOR_FORMAT],AL 0 00009755 84C0 test AL,AL 0 00009757 7416 JZ DONTRESTORE 0 00009759 5606 SAVEREG 0 0000975B C536[0201] LDS SI,[TEMPDPT] 1288 <1> assume ds:nothing 0 0000975F 31C0 XOR AX,AX 0 00009761 8EC0 MOV ES,AX ; HAVE ES -> SEGMENT 0 1291 <1> assume es:IVT 0 00009763 2689367800 MOV WORD PTR [ES:DSKADR],SI 0 00009768 268C1E7A00 MOV WORD PTR [ES:DSKADR+2],DS 0 0000976D 075E RESTOREREG 1295 <1> assume es:nothing 1296 <1> DONTRESTORE: 0 0000976F 1F pop ds 1298 <1> assume ds:nothing 0 00009770 58 POP AX 0 00009771 F8 CLC ; CLEAR CARRY 0 00009772 C3 RET 1302 <1> 1303 <1> ;****************************************************************************** 1304 <1> ;AN000; Get Media ID 1305 <1> ;******************************************************************************* 1306 <1> ; * 1307 <1> ; Function: Get the volume label, the system id and the serial number from * 1308 <1> ; the media that has the extended boot record. * 1309 <1> ; For the conventional media, this routine will return "Unknown * 1310 <1> ; media type" error to DOS. * 1311 <1> ; * 1312 <1> ; Input : DS:DI -> BDS table for this drive. * 1313 <1> ; ES:BX -> Request packet (= A_Media_ID_INFO structure) * 1314 <1> ; * 1315 <1> ; Output: The request packet filled with the information, if not carry. * 1316 <1> ; If carry set, then AL contains the device driver error number * 1317 <1> ; that will be returned to DOS. * 1318 <1> ; Register DS,DX,AX,CX,DI,SI destroyed. * 1319 <1> ; Subroutines to be called: * 1320 <1> ; BOOT_IO:NEAR * 1321 <1> ; * 1322 <1> ; Logic: * 1323 <1> ; /*To recognize the extended boot record, this logic will actually */ * 1324 <1> ; /*access the boot sector even if it is a hard disk. */ * 1325 <1> ; /*NOTE:the valid extended bpb is recognized by looking at the mediabyte* 1326 <1> ; /*field of BPB and the extended Boot Signature. * 1327 <1> ; * 1328 <1> ; { * 1329 <1> ; Get logical drive number from BDS table; * 1330 <1> ; RFLAG = Read operation; * 1331 <1> ; BOOT_IO; /*Get the media boot record into the buffer*/ * 1332 <1> ; IF (no error) THEN * 1333 <1> ; IF (extended boot record) THEN * 1334 <1> ; { set Volume Label, Volume Serial number and System id * 1335 <1> ; of the Request packet to those of the boot record; * 1336 <1> ; }; * 1337 <1> ; ELSE /*Not an extended BPB */ * 1338 <1> ; { set Register AL to "Unknown media.." error code; * 1339 <1> ; set Carry bit; * 1340 <1> ; }; * 1341 <1> ; ELSE * 1342 <1> ; Exit; /*Already error code is set in the register AL* 1343 <1> ; * 1344 <1> ; Expected LOC: 40 (New) * 1345 <1> ;******************************************************************************* 1346 <1> 1347 <1> GetMediaID proc near ;AN000; 1348 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009773 E8BB00 call Changeline_Chk ;AN010; 0 00009776 8A4505 mov al, [DI + DRIVELET] ;AN000; logical drive number 1351 <1> RFlag equ RFLAG ; NASM port label 0 00009779 1E push ds 0 0000977A E8[0000] call biocode_get_ds_dosbiodata 1354 <1> assume ds:DOSGROUP 0 0000977D C606[0000]02 mov byte [RFlag], ROMREAD ;AN000; read operation 0 00009782 E88E00 call Boot_IO ;AN000; read boot sector into DOSENTRY:DiskSector 1357 <1> ; $IF NC ;AN000; 0 00009785 7228 JC $IOCTL$IF1_pop_ds 0 00009787 E8[0000] call biocode_get_ds_dosentry ; DISKSECTOR in DOSENTRY 1360 <1> assume ds:DOSENTRYGROUP 1361 <1> MediaByte equ MEDIABYTE ; NASM port label 0 0000978A 8A0E[0000] mov cl, [MediaByte] ;AN000; Mediabyte in BPB 0 0000978E 80E1F0 and cl, 0F0h ;AN000; 0 00009791 80F9F0 cmp cl, 0F0h ;AN000; Is it a valid BPB? 1365 <1> ; $IF E,AND ;AN000; 0 00009794 7516 JNE $IOCTL$IF2 0 00009796 803E[0000]29 cmp byte [Ext_Boot_Sig], EXT_BOOT_SIGNATURE ;AN000; =90h 1368 <1> ; $IF E ;AN000; Extended Boot Record 0 0000979B 750F JNE $IOCTL$IF2 0 0000979D BE[0000] mov si, offset Boot_Serial_L ;AN000; access with ds 0 000097A0 89DF mov di, bx ;AN000; 0 000097A2 83C702 add di, MI_SERIAL ;AN000; 0 000097A5 B91700 mov cx, BOOT_SERIAL_SIZE+BOOT_VOLUME_LABEL_SIZE+BOOT_SYSTEM_ID_SIZE 0 000097A8 F3A4 rep movsb ;AN000; 1375 <1> ; $ELSE ;AN000; 0 000097AA EB03 JMP SHORT $IOCTL$EN2 1377 <1> $IOCTL$IF2: 0 000097AC B007 mov al, ERROR_UNKNOWN_MEDIA ;AN000; =7 0 000097AE F9 stc ;AN000; 1380 <1> ; $ENDIF ;End Extended Boot Record check. 1381 <1> $IOCTL$EN2: 1382 <1> ; $ENDIF ;Read boot sector failed. Hard error. 1383 <1> $IOCTL$IF1_pop_ds: 0 000097AF 1F pop ds 1385 <1> assume ds:UPB 0 000097B0 C3 ret ;AN000; 1387 <1> GetMediaID endp 1388 <1> 1389 <1> ;****************************************************************************** 1390 <1> ;AN000; Set Media ID 1391 <1> ;******************************************************************************* 1392 <1> ; * 1393 <1> ; Function: Set the volume label, the system id and the serial number of * 1394 <1> ; the media that has the extended boot record. * 1395 <1> ; For the conventional media, this routine will return "Unknown * 1396 <1> ; media.." error to DOS. * 1397 <1> ; This routine will also set the corresponding informations in * 1398 <1> ; the BDS table. * 1399 <1> ; * 1400 <1> ; Input : DS:DI -> BDS table for this drive. * 1401 <1> ; ES:BX -> Request packet (= A_Media_ID_INFO structure) * 1402 <1> ; * 1403 <1> ; Output: The extended boot record in the media will be set according to * 1404 <1> ; the Request packet. * 1405 <1> ; If carry set, then AL contains the device driver error number * 1406 <1> ; that will be returned to DOS. * 1407 <1> ; * 1408 <1> ; Subroutines to be called: * 1409 <1> ; BOOT_IO:NEAR * 1410 <1> ; * 1411 <1> ; Logic: * 1412 <1> ; * 1413 <1> ; * 1414 <1> ; { * 1415 <1> ; Get Drive_Number from BDS; * 1416 <1> ; RFLAG = "Read operation"; * 1417 <1> ; BOOT_IO; * 1418 <1> ; IF (no error) THEN * 1419 <1> ; IF (extended boot record) THEN * 1420 <1> ; { set Volume Label, Volume Serial number and System id * 1421 <1> ; of the boot record to those of the Request packet; * 1422 <1> ; RFLAG = "Write operation"; * 1423 <1> ; Get Drive Number from BDS; * 1424 <1> ; BOOT_IO; /*Write it back*/ * 1425 <1> ; }; * 1426 <1> ; ELSE /*Not an extended BPB */ * 1427 <1> ; { set Register AL to "Unknown media.." error code; * 1428 <1> ; set Carry bit; * 1429 <1> ; Exit; /*Return back to caller */ * 1430 <1> ; }; * 1431 <1> ; ELSE * 1432 <1> ; Exit; /*Already error code is set */ * 1433 <1> ; * 1434 <1> ; Expected LOC: 45 (New) * 1435 <1> ;******************************************************************************* 1436 <1> 1437 <1> SetMediaID proc near 1438 <1> assume ds:UPB, es:nothing, ss:nothing 0 000097B1 E87D00 call Changeline_Chk ;AN010; 0 000097B4 8A4505 mov al, [DI + DRIVELET] ;AN000; logical drive number 0 000097B7 88C2 mov dl, al ;AN000; save it for the time being. 0 000097B9 1E push ds 0 000097BA E8[0000] call biocode_get_ds_dosbiodata 1444 <1> assume ds:DOSGROUP 0 000097BD C606[0000]02 mov byte [RFlag], ROMREAD ;AN000; read operation 0 000097C2 52 push dx ;AN000; save drive number 0 000097C3 E84D00 call Boot_IO ;AN000; read boot sector into DOSENTRY:DiskSector 0 000097C6 5A pop dx ;AN000; restore drive number 1449 <1> ; $IF NC ;AN000; 0 000097C7 7248 JC $IOCTL$IF6_pop_ds 0 000097C9 E8[0000] call biocode_get_ds_dosentry ; DISKSECTOR in DOSENTRY 1452 <1> assume ds:DOSENTRYGROUP 0 000097CC 8A0E[0000] mov cl, [MediaByte] ;AN000; Mediabyte in BPB 0 000097D0 80E1F0 and cl, 0F0h ;AN000; 0 000097D3 80F9F0 cmp cl, 0F0h ;AN000; Is it a valid BPB? 1456 <1> ; $IF E,AND ;AN000; 0 000097D6 7536 JNE $IOCTL$IF7 0 000097D8 803E[0000]29 cmp byte [Ext_Boot_Sig], EXT_BOOT_SIGNATURE ;AN000; =41 (=29h) 1459 <1> ; $IF E ;AN000; Extended Boot Record 0 000097DD 752F JNE $IOCTL$IF7 0 000097DF 1F pop ds 1462 <1> assume ds:UPB 0 000097E0 1E push ds ;AN011; save BDS pointer 0 000097E1 57 push di ;AN011; 0 000097E2 06 push es ;AN000; 0 000097E3 1F pop ds ;AN000;Now DS-> Request packet 1467 <1> assume ds:nothing 0 000097E4 E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 1469 <1> assume es:DOSENTRYGROUP ;AN000;Now ES -> Boot Record 0 000097E7 BF[0000] mov di, offset Boot_Serial_L ;AN000; access with es 0 000097EA 89DE mov si, bx ;AN000; 1472 <1> MI_Serial equ MI_SERIAL ; NASM port equate 0 000097EC 83C602 add si, MI_Serial ;AN000; 0 000097EF B91700 mov cx, BOOT_SERIAL_SIZE+BOOT_VOLUME_LABEL_SIZE+BOOT_SYSTEM_ID_SIZE 0 000097F2 F3A4 rep movsb ;AN000; 0 000097F4 5F pop di ;AN011;Restore BDS pointer 0 000097F5 1F pop ds ;AN011; 1478 <1> assume ds:UPB 0 000097F6 E818EF call Mov_Media_IDs ;AN011; Update the BDS media ID info. 0 000097F9 88D0 mov al, dl ;AN000; set drive number for Boot_IO 0 000097FB 1E push ds 0 000097FC E8[0000] call biocode_get_ds_dosbiodata 1483 <1> assume ds:DOSGROUP 0 000097FF C606[0000]03 mov byte [RFlag], ROMWRITE ;AN000; 0 00009804 E80C00 call Boot_IO ;AN000; write it back. 0 00009807 C606[0000]FF mov byte [TIM_DRV], -1 ;AN011; Make sure chk$media check the driver 1487 <1> ; $ELSE ;AN000; 0 0000980C EB03 JMP SHORT $IOCTL$EN7_pop_ds 1489 <1> $IOCTL$IF7: 0 0000980E B007 mov al, ERROR_UNKNOWN_MEDIA ;AN000; =7 0 00009810 F9 stc ;AN000; 1492 <1> ; $ENDIF ;End Extended Boot Record check. 1493 <1> ; $ENDIF ;Read boot sector failed. Hard error. 1494 <1> $IOCTL$EN7_pop_ds: 1495 <1> $IOCTL$IF6_pop_ds: 0 00009811 1F pop ds 1497 <1> assume ds:UPB 0 00009812 C3 ret ;AN000; 1499 <1> SetMediaID endp 1500 <1> 1501 <1> ;****************************************************************************** 1502 <1> ;AN000; Boot_IO 1503 <1> ;******************************************************************************* 1504 <1> ; * 1505 <1> ; Function: Read/Write the boot record into Boot sector. * 1506 <1> ; * 1507 <1> ; Input : * 1508 <1> ; AL=logical drive number * 1509 <1> ; RFLAG = operation (read/write) * 1510 <1> ; * 1511 <1> ; Output: For read operation, the boot record of the drive specified in BDS * 1512 <1> ; be read into the DISKSECTOR buffer. * 1513 <1> ; For write operation, the DISKSECTOR buffer image will be written * 1514 <1> ; to the drive specified in BDS. * 1515 <1> ; If carry set, then AL contains the device driver error number * 1516 <1> ; that will be returned to DOS. * 1517 <1> ; AX,CX,DX register destroyed. * 1518 <1> ; If carry set, then AL will contain the error code from DISKIO. * 1519 <1> ; * 1520 <1> ; Subroutines to be called: * 1521 <1> ; DISKIO:NEAR * 1522 <1> ; * 1523 <1> ; Logic: * 1524 <1> ; * 1525 <1> ; { * 1526 <1> ; First_Sector = 0; /*logical sector 0 is the boot sector */ * 1527 <1> ; SectorCount = 1; /*read 1 sector only */ * 1528 <1> ; Buffer = DISKSECTOR; /*read it into the disksector buffer */ * 1529 <1> ; Call DISKIO (RFLAG, Drive_Number,First_Sector,SectorCount,Buffer); * 1530 <1> ; } * 1531 <1> ; Expected LOC: 6 (New) * 1532 <1> ;******************************************************************************* 1533 <1> Boot_IO proc near ;AN000; 1534 <1> assume ds:nothing, es:nothing, ss:nothing 0 00009813 1E push ds ;AN000; 0 00009814 06 push es ;AN000; 0 00009815 57 push di ;AN000; 0 00009816 53 push bx ;AN000; 1539 <1> ;SB34IOCTL003************************************************************** 1540 <1> ;SB Call DISKIO to read/write the boot sector. The parameters which 1541 <1> ;SB need to be initialised for this subroutine out here are 1542 <1> ;SB - transfer address to DOSENTRY:DiskSector 1543 <1> ;SB - low sector needs to be initalised to 0. This is a reg. param 1544 <1> ;SB - hi sector in [DOSENTRY:Start_Sec_H] needs to be initialised to 0. 1545 <1> ;SB - number of sectors <-- 1 1546 <1> ;SB 7 LOCS 1547 <1> 0 00009817 E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 1549 <1> assume es:DOSENTRYGROUP 1550 <1> %ifidni %[DOSBIODATA], %[DOSENTRY] 1551 <1> push es 1552 <1> pop ds 1553 <1> %endif 0 0000981A BF[0000] mov di, offset DiskSector ;es:di -> transfer address ; access with es 0 0000981D 31D2 xor dx, dx ;first sector (H) -> 0 1556 <1> %ifnidni %[DOSBIODATA], %[DOSENTRY] 0 0000981F E8[0000] call biocode_get_ds_dosbiodata 1558 <1> assume ds:DOSGROUP 1559 <1> %endif 0 00009822 8916[0000] mov [Start_Sec_H], dx ;start sector (H) -> 0 0 00009826 B90100 mov cx, 1 ;one sector 0 00009829 E8ADF0 call DISKIO 1563 <1> ;SB34IOCTL003************************************************************** 0 0000982C 5B pop bx ;AN000; 0 0000982D 5F pop di ;AN000; 0 0000982E 07 pop es ;AN000; 1567 <1> assume es:nothing 0 0000982F 1F pop ds ;AN000; 1569 <1> assume ds:nothing 0 00009830 C3 ret ;AN000; 1571 <1> Boot_IO endp ;AN000; 1572 <1> 1573 <1> ;******************************************************************************* 1574 <1> ;AN010; Changeline_Chk 1575 <1> ;******************************************************************************* 1576 <1> ;When the user calls Get/Set media ID call before DOS establishes the media * 1577 <1> ;by calling "Media$Chk", the change line activity of the drive is going to be * 1578 <1> ;lost. This routine will check the change line activity and will save the * 1579 <1> ;history in the flags. * 1580 <1> ; * 1581 <1> ; Function: Check the change line error activity * 1582 <1> ; * 1583 <1> ; Input : DS:DI -> BDS table. * 1584 <1> ; * 1585 <1> ; Output: FLAG in BDS table will be updated if change line occurs. * 1586 <1> ; * 1587 <1> ; Subroutines to be called: * 1588 <1> ; SET_CHANGED_DL * 1589 <1> ; * 1590 <1> ;******************************************************************************* 1591 <1> Changeline_Chk proc near ;AN010; 1592 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009831 8A5504 mov dl, byte ptr [di + DRIVENUM] ;AN010; 0 00009834 08D2 or dl, dl ;AN010;Fixed disk? 0 00009836 781F js Chln_Chk_Ret ;AN010;Yes, skip it. 0 00009838 1E push ds 0 00009839 E8[0000] call biocode_get_ds_dosbiodata 1598 <1> assume ds:DOSGROUP 0 0000983C 803E[0000]01 cmp byte [fHave96], 1 ;AN011;This ROM support change line? 0 00009841 1F pop ds 1601 <1> assume ds:UPB 0 00009842 7513 jne Chln_Chk_Ret ;AN011; 1603 <1> HasChange equ HASCHANGE ; NASM port label 0 00009844 E8[0000] call HasChange ;AN011;This drive support change line? 0 00009847 740E jz Chln_Chk_Ret ;AN011;do nothing 1606 <1> ;SB34IOCTL004***************************************************************** 1607 <1> ;SB Execute the ROM disk interrupt to check changeline activity. 2 LOCS 1608 <1> 0 00009849 B416 mov ah, 16h 0 0000984B CD13 int 13h 1611 <1> ;SB34IOCTL004***************************************************************** 0 0000984D 7308 jnc Chln_Chk_Ret ;AN010;no change line activity? 0 0000984F 53 push bx 0 00009850 BB4000 mov bx, FCHANGED ;AN010; 0 00009853 E8[0000] call SET_CHANGED_DL ;AN010;Update FLAG in BDS for this physical drive 0 00009856 5B pop bx 1617 <1> Chln_Chk_Ret: ;AN010; 0 00009857 C3 ret ;AN010; 1619 <1> Changeline_Chk endp ;AN010; 1620 <1> 1621 <1> ;****************************************************************************** 1622 <1> ;AN007; GetAccessFlag 1623 <1> ;******************************************************************************* 1624 <1> ; * 1625 <1> ; Function: Get the status of UNFORMATTED_MEDIA bit of FLAGS in BDS table * 1626 <1> ; * 1627 <1> ; Input : * 1628 <1> ; es:bx -> A_DISKACCESS_CONTROL structure * 1629 <1> ; ds:di -> BDS table * 1630 <1> ; * 1631 <1> ; Output: A_DISKACCESS_CONTROL.DAC_ACCESS_FLAG = 0 if disk I/O not allowed. * 1632 <1> ; = 1 if disk I/O allowed. * 1633 <1> ;******************************************************************************* 1634 <1> GetAccessFlag proc ;AN007; 1635 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009858 F745230002 test word ptr [di + FLAGS], UNFORMATTED_MEDIA ;AN007;Is it unformtted media? 0 0000985D 7407 jz GAF_Allowed ;AN007;No, formatted media 0 0000985F 26C6470100 mov byte [es:bx + DAC_ACCESS_FLAG], 0 ;AN007; 0 00009864 EB05 jmp short GAF_Done ;AN007; 1640 <1> GAF_Allowed: ;AN007; 0 00009866 26C6470101 mov byte [es:bx + DAC_ACCESS_FLAG], 1 ;AN007; 1642 <1> GAF_Done: ;AN007; 0 0000986B C3 ret ;AN007; 1644 <1> GetAccessFlag endp ;AN007; 1645 <1> 1646 <1> ;****************************************************************************** 1647 <1> ;AN007; SetAccessFlag 1648 <1> ;******************************************************************************* 1649 <1> ; * 1650 <1> ; Function: Set/Reset the UNFORMATTED_MEDIA bit of FLAGS in BDS table * 1651 <1> ; * 1652 <1> ; Input : * 1653 <1> ; es:bx -> A_DISKACCESS_CONTROL structure * 1654 <1> ; ds:di -> BDS table * 1655 <1> ; * 1656 <1> ; Output: UNFORMTTED_MEDIA bit modified according to the user request * 1657 <1> ;******************************************************************************* 1658 <1> SetAccessFlag proc ;AN007; 1659 <1> assume ds:UPB, es:nothing, ss:nothing 0 0000986C 26807F0100 cmp byte [es:bx + DAC_ACCESS_FLAG], 0 ;AN007; 0 00009871 7507 jne SAF_Allow_Access ;AN007; 0 00009873 814D230002 or word ptr [di + FLAGS], UNFORMATTED_MEDIA ;AN007; 0 00009878 EB05 jmp short SAF_Done ;AN007; 1664 <1> SAF_Allow_Access: ;AN007; 0 0000987A 816523FFFD and word ptr [di + FLAGS], ~ UNFORMATTED_MEDIA ;AN007; 1666 <1> SAF_Done: ;AN007; 0 0000987F C3 ret ;AN007; 1668 <1> SetAccessFlag endp ;AN007; 1669 <1> 1670 <1> 1671 <1> 3137 ;=== Pop trace listing source 3138 ; PAGE 3139 ; CHECK_WRAP IS A ROUTINE THAT ADJUSTS THE STARTING SECTOR, STARTING HEAD 3140 ; AND STARTING CYLINDER FOR AN INT 13 REQUEST THAT REQUESTS I/O OF A LOT 3141 ; OF SECTORS. IT ONLY DOES THIS FOR FIXED DISKS. IT IS USED IN THE SECTIONS 3142 ; OF CODE THAT HANDLE ECC ERRORS AND DMA ERRORS. IT IS NECESSARY, BECAUSE 3143 ; ORDINARILY THE ROM WOULD TAKE CARE OF WRAPS AROUND HEADS AND CYLINDERS, 3144 ; BUT WE BREAK DOWN A REQUEST WHEN WE GET AN ECC OR DMA ERROR INTO SEVERAL 3145 ; I/O OF ONE OR MORE SECTORS. IN THIS CASE, WE MAY ALREADY BE BEYOND THE 3146 ; NUMBER OF SECTORS ON A TRACK ON THE MEDIUM, AND THE REQUEST WOULD FAIL. 3147 ; 3148 ; INPUT CONDITIONS: 3149 ; ALL REGISTERS SET UP FOR AN INT 13 REQUEST. 3150 ; 3151 ; OUTPUT: 3152 ; DH - CONTAINS STARTING HEAD NUMBER FOR REQUEST 3153 ; CX - CONTAINS STARTING SECTOR AND CYLINDER NUMBERS 3154 ; (THE ABOVE MAY OR MAY NOT HAVE BEEN CHANGED, AND ARE 0-BASED) 3155 ; ALL OTHER REGISTERS PRESERVED. 3156 ; 3157 PUBLIC CHECK_WRAP 3158 CHECK_WRAP: 3159 Message ftestDisk,<"Entering Check_Wrap...",cr,lf> 0 00009880 50531E57 SAVEREG 0 00009884 E8[0000] call biocode_get_ds_dosbiodata 3162 assume ds:DOSGROUP 0 00009887 C606[0000]01 MOV BYTE PTR [PHYS_DRV],1 ; USE PHYSICAL DRIVE IN AL TO GET BDS 0 0000988C 88D0 MOV AL,DL ; AL HAS PHYSICAL DRIVE NUMBER 0 0000988E E872EF CALL SETDRIVE ; GET POINTER TO BDS FOR DRIVE 3166 assume ds:UPB 0 00009891 1E push ds 0 00009892 E8[0000] call biocode_get_ds_dosbiodata 3169 assume ds:DOSGROUP 0 00009895 C606[0000]00 MOV BYTE PTR [PHYS_DRV],0 ; RESTORE FLAG TO USE LOGICAL DRIVE 0 0000989A 1F pop ds 3172 assume ds:UPB 0 0000989B 725E JC NO_WRAP ; DO NOTHING IF WRONG PHYSICAL DRIVE 0 0000989D F745230100 TEST WORD PTR [DI + FLAGS],FNON_REMOVABLE 0 000098A2 7457 JZ NO_WRAP ; NO WRAPPING FOR REMOVABLE MEDIA 0 000098A4 8B5D13 MOV BX,[DI + SECLIM] 0 000098A7 89C8 MOV AX,CX 0 000098A9 83E03F AND AX,003FH ; EXTRACT SECTOR NUMBER 0 000098AC 39D8 CMP AX,BX ; ARE WE GOING TO WRAP? 0 000098AE 764B JBE NO_WRAP 0 000098B0 F6F3 DIV BL ; AH=NEW SECTOR #, AL=# OF HEAD WRAPS 3182 ; WE NEED TO BE CAREFUL HERE. IF THE NEW SECTOR # IS 0, THEN WE ARE ON THE 3183 ; LAST SECTOR ON THAT TRACK. 0 000098B2 08E4 OR AH,AH 0 000098B4 7504 JNZ NOT_ON_BOUND 0 000098B6 88DC MOV AH,BL ; SET SECTOR=SECLIM IF ON BOUNDARY 0 000098B8 FEC8 DEC AL ; ALSO DECREMENT # OF HEAD WRAPS 3188 NOT_ON_BOUND: 0 000098BA 80E1C0 AND CL,0C0H ; ZERO OUT SECTOR # 0 000098BD 08E1 OR CL,AH ; OR IN NEW SECTOR # 0 000098BF 30E4 XOR AH,AH ; AX = # OF HEAD WRAPS 0 000098C1 40 INC AX 0 000098C2 00F0 ADD AL,DH ; ADD IN STARTING HEAD # 0 000098C4 80D400 ADC AH,0 ; CATCH ANY CARRY 0 000098C7 3B4515 CMP AX,[DI + HDLIM] ; ARE WE GOING TO WRAP AROUND A HEAD? 0 000098CA 7635 JBE NO_WRAP_HEAD ; DO NOT LOSE NEW HEAD NUMBER!! 0 000098CC 52 PUSH DX ; PRESERVE DRIVE NUMBER AND HEAD NUMBER 0 000098CD 31D2 XOR DX,DX 0 000098CF 8B5D15 MOV BX,[DI + HDLIM] 0 000098D2 F7F3 DIV BX ; DX=NEW HEAD #, AX=# OF CYLINDER WRAPS 3201 ; CAREFUL HERE! IF NEW HEAD # IS 0, THEN WE ARE ON THE LAST HEAD. 0 000098D4 85D2 test DX,DX 0 000098D6 7507 JNZ NO_HEAD_BOUND 0 000098D8 89DA MOV DX,BX ; ON BOUNDARY. SET TO HDLIM 3205 ; IF WE HAD SOME CYLINDER WRAPS, WE NEED TO REDUCE THEM BY ONE!! 0 000098DA 85C0 test AX,AX 0 000098DC 7401 JZ NO_HEAD_BOUND 0 000098DE 48 DEC AX ; REDUCE NUMBER OF CYLINDER WRAPS 3209 NO_HEAD_BOUND: 0 000098DF 88D7 MOV BH,DL ; BH HAS NEW HEAD NUMBER 0 000098E1 5A POP DX ; RESTORE DRIVE NUMBER AND HEAD NUMBER 0 000098E2 FECF DEC BH ; GET IT 0-BASED 0 000098E4 88FE MOV DH,BH ; SET UP NEW HEAD NUMBER IN DH 0 000098E6 88CF MOV BH,CL 0 000098E8 80E73F AND BH,3FH ; PRESERVE SECTOR NUMBER 0 000098EB B306 MOV BL,6 0 000098ED 86CB XCHG CL,BL 0 000098EF D2EB SHR BL,CL ; GET MS CYLINDER BITS TO LS END 0 000098F1 00C5 ADD CH,AL ; ADD IN CYLINDER WRAP 0 000098F3 10E3 ADC BL,AH ; ADD IN HIGH BYTE 0 000098F5 D2E3 SHL BL,CL ; MOVE UP TO MS END 0 000098F7 86D9 XCHG BL,CL ; RESTORE CYLINDER BITS INTO CL 0 000098F9 08F9 OR CL,BH ; OR IN SECTOR NUMBER 3224 3225 NO_WRAP: 0 000098FB F8 CLC ; RESET CARRY 0 000098FC 5F1F5B58 RESTOREREG 3228 assume ds:nothing 0 00009900 C3 RET 3230 3231 NO_WRAP_HEAD: 0 00009901 88C6 MOV DH,AL ; DO NOT LOSE NEW HEAD NUMBER 0 00009903 FECE DEC DH ; GET IT 0-BASED 0 00009905 EBF4 JMP SHORT NO_WRAP 3235 3236 ; 3237 ; INT_2F_13: 3238 ; THIS CODE IS CHAINED INTO THE INT_2F INTERRUPT DURING BIOS 3239 ; INITIALIZATION. IT ALLOWS THE USER TO CHANGE THE ORIG13 INT_13 VECTOR 3240 ; AFTER BOOTING. THIS ALLOWS TESTING AND IMPLEMENTATION OF CUSTOM INT_13 3241 ; HANDLERS, WITHOUT GIVING UP MS-DOS ERROR RECOVERY 3242 ; 3243 ; ENTRY CONDITIONS 3244 ; AH == RESET_INT_13 (13H) 3245 ; DS:DX == ADDRESS OF NEW INT_13 HANDLER 3246 ; ES:BX == ADDRESS OF NEW INT_13 VECTOR USED BY WARM BOOT 3247 ; (INT 19) 3248 ; 3249 ; EXIT CONDITIONS 3250 ; ORIG13 == ADDRESS OF NEW INT_13 HANDLER 3251 ; DS:DX == OLD ORIG13 VALUE 3252 ; ES:BX == OLD OLD13 VALUE 3253 3254 3255 relocated head_i2F ; (destination of the real int 2Fh vector) 3256 relocated set_i13_i2F 3257 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00009907 80FC13 CMP AH,13H ; IF (INTERRUPT_VALUE != RESET_INT_13) 3259 extern relocateddisk_i2F 0 0000990A 7403E9[0000] jne relocateddisk_i2F ; THEN CONTINUE ON INT_2F CHAIN 3261 CHG_ORIG13: ; ELSE 3262 assume ds:nothing, es:nothing, ss:nothing 0 0000990F FA cli 0 00009910 50 push ax 0 00009911 8CD8 mov ax, ds 0 00009913 E8[0000] call biocode_get_ds_dosentry ; OLD13, ORIG13 in DOSENTRY ! 3267 assume ds:DOSENTRYGROUP 0 00009916 FF36[0000] PUSH WORD PTR [ORIG13] ; SAVE OLD VALUE OF OLD13 AND 0 0000991A FF36[0200] PUSH WORD PTR [ORIG13 + 2]; ORIG13 SO THAT WE CAN 3270 0 0000991E FF36[0000] PUSH WORD PTR [OLD13] ; RETURN THEM TO CALLER 0 00009922 FF36[0200] PUSH WORD PTR [OLD13 + 2] 3273 0 00009926 8916[0000] MOV WORD PTR [ORIG13],DX ; ORIG13 := ADDR. OF NEW INT_13 3275 ; VECTOR 0 0000992A A3[0200] MOV WORD PTR [ORIG13+2], ax 3277 0 0000992D 891E[0000] MOV WORD PTR [OLD13],BX ; OLD13 := ADDR. OF NEW 3279 ; BOOT_13 VECTOR 0 00009931 8C06[0200] MOV WORD PTR [OLD13+2],ES 3281 0 00009935 07 POP ES ; ES:BX := OLD OLD13 VECTOR 3283 assume es:nothing 0 00009936 5B POP BX 3285 0 00009937 1F POP DS ; DS:DX := OLD ORIG13 VECTOR 3287 assume ds:nothing 0 00009938 5A POP DX 0 00009939 58 pop ax 3290 0 0000993A CF IRET ; END ELSE 3292 3293 INT_2F_13 ENDP 3294 3295 MOVE PROC NEAR 0 0000993B FC CLD 0 0000993C 51 PUSH CX 0 0000993D B90001 MOV CX,512/2 3299 0 00009940 1E push ds 0 00009941 E8[0000] call biocode_get_ds_dosbiodata 3302 assume ds:DOSGROUP 0 00009944 D006[0601] rol byte [dosbiodata_have_386], 1 0 00009948 1F pop ds 3305 assume ds:nothing 0 00009949 7303 jnc @F 3307 3308 ;J.K. Warning!!! Do not change the position of this label. 3309 ; The following three bytes will be NOPed out by MSINIT if the system 3310 ; does not support the DOUBLE WORD MOV instruction, i.e., (if 3311 ; not 386 base machine.) 3312 ;---------------------------------------------------------------------------- 3313 ; public DoubleWordMov 3314 ; DoubleWordMov: ;AN002; 0 0000994B D1E9 shr cx, 1 ;AN002;Make it a double word. 0 0000994D 66 o32 ;AN002;Machine code for double word mov 3317 ;---------------------------------------------------------------------------- 3318 @@: 0 0000994E F3A5 REP MOVSW 0 00009950 59 POP CX 0 00009951 C3 RET 3322 MOVE ENDP 3323 3324 DOINT PROC NEAR 3325 assume ds:nothing, es:nothing, ss:nothing 0 00009952 8A5608 MOV DL,BYTE PTR [BP + OLDDX] ; GET PHYSICAL DRIVE NUMBER 0 00009955 30E4 XOR AH,AH 0 00009957 84C0 test AL,AL 0 00009959 740F JZ DOINTDONE 0 0000995B 8A6603 MOV AH,BYTE PTR [BP + OLDAX+1] ; GET REQUEST CODE 0 0000995E FF760E PUSH word [BP + OLDF] 0 00009961 9A[0000][0000] call DOSENTRY:transfer_orig13 0 00009966 9C PUSHF 0 00009967 8F460E POP word [BP + OLDF] 3335 DOINTDONE: 0 0000996A C3 RET 3337 DOINT ENDP 3338 3339 3340 global ispatched 3341 ispatched: 3342 assume ds:nothing 0 0000996B 1E push ds 0 0000996C E8[0000] call biocode_get_ds_dosbiodata 3345 assume ds:DOSGROUP 0 0000996F 803E[0000]01 cmp byte [FHAVE96], 1 ; CY if 0 0 00009974 1F pop ds 3348 assume ds:nothing 0 00009975 C3 retn 3350 3351 === Switch to base=000E10h -> "DOSBIODATA" 3352 usesection DOSBIODATA 3353 3354 global dosbiodata_have_386 0 00001538 00 dosbiodata_have_386: db 0 0 00001539 00 hma_operation: db 0 3357 3358 global config_bounce_hma_chs 3359 global config_bounce_hma_lba 0 0000153A 00 config_bounce_hma_chs: db 0 0 0000153B 00 config_bounce_hma_lba: db 0 3362 global config_bounce_uma_chs 3363 global config_bounce_uma_lba 0 0000153C 00 config_bounce_uma_chs: db 0 0 0000153D 00 config_bounce_uma_lba: db 0 3366 global config_bounce_any_chs 3367 global config_bounce_any_lba 0 0000153E 00 config_bounce_any_chs: db 0 0 0000153F 00 config_bounce_any_lba: db 0 === Trace listing source: msbio2.lst 1 ; PAGE ,132 ; 2 ; TITLE MSBIO2 - BIOS 3 4 %warning out: ...MSBIO2.ASM 4 ****************** warning: out: ...MSBIO2.ASM [-w+user] 5 6 ;============================================================================== 7 ;REVISION HISTORY: 8 ;AN000 - New for DOS Version 4.00 - J.K. 9 ;AC000 - Changed for DOS Version 4.00 - J.K. 10 ;AN00x - PTM number for DOS Version 4.00 - J.K. 11 ;============================================================================== 12 ;AN001; - P1820 New Message SKL file 10/20/87 J.K. 13 ;AN002; - P5045 New INT 2fh for Get BDS table vector for EMS 06/06/88 J.K. 14 ;============================================================================== 15 16 ROMSEGMENT EQU 0F000H 17 labelsize MODELBYTE, byte, 0FFFEH 18 MODELPCJR EQU 0FDH 19 20 itest equ 0 21 22 %include "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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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 23 %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 0 00009976 ???? lpSize dw ? 0 00009978 ???? lpCount dw ? 0 0000997A ???????? lpBuffer dd ? 0 0000997E ???????????????? 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 0 00009976 ???????? LINK DD ? ; LINK TO NEXT BDS 0 0000997A ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 0000997B ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 0000997C ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 0000997E ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 0000997F ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 00009981 ?? CFAT DB ? ; NUMBER OF FATS 0 00009982 ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00009984 ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 00009986 ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 00009987 ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 00009989 ???? SECLIM DW ? ; SECTORS PER TRACK 0 0000998B ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 0000998D ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 0000998F ???? HIDSEC_H dw ? ;0 ;J.K.87 0 00009991 ???? DRVLIM_L dw ? ;0 ;J.K.87 0 00009993 ???? DRVLIM_H dw ? ;0 ;J.K.87 0 00009995 ?? FATSIZ DB ? ; FLAGS... 0 00009996 ???? OPCNT DW ? ; OPEN REF. COUNT 0 00009998 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 00009999 ???? FLAGS DW ? ; VARIOUS FLAGS 0 0000999B ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 0000999D ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 0000999F ?? RSECPERCLUS DB ? 0 000099A0 ???? RRESSEC DW ? 0 000099A2 ?? RCFAT DB ? 0 000099A3 ???? RCDIR DW ? 0 000099A5 ???? RDRVLIM DW ? 0 000099A7 ?? RMEDIAD DB ? 0 000099A8 ???? RCSECFAT DW ? 0 000099AA ???? RSECLIM DW ? 0 000099AC ???? RHDLIM DW ? 0 000099AE ???? RHIDSEC_L DW ? 0 000099B0 ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 000099B2 ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 000099B4 ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 000099B6 ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 000099BC ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 000099BD ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 000099BF ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 000099CD ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <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 0 00009976 ???? mlink DW ? ;-1 ;Link to next structure 0 00009978 ???? DW ? 0 0000997A ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 0000997B ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 0000997C ???? mBytePerSec DW ? ;512 0 0000997E ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 0000997F ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 00009981 ?? mcFAT DB ? ;2 ;No. of allocation tables 0 00009982 ???? mcDIR DW ? ;16 ;Number of directory entries 0 00009984 ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 00009986 ?? mMediad DB ? ;11111000B ;Media descriptor 0 00009987 ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 00009989 ???? mSECLIM DW ? ;0 ;Sector limit 0 0000998B ???? mHDLIM DW ? ;0 ;Head limit 0 0000998D ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 0000998F ???? mHidsec_H dw ? ;0 ;J.K.87 0 00009991 ???? mDrvlim_L dw ? ;0 ;J.K.87 0 00009993 ???? mDrvlim_H dw ? ;0 ;J.K.87 0 00009995 ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 00009996 ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 00009998 ?? mFormFactor DB ? ;3 ;Form Factor 0 00009999 ???? mFLAGS DW ? ;0020H ;Various Flags 0 0000999B ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 000099BC ?? mTrack db ? ;-1 0 000099BD ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 000099BF ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 000099CC ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 000099CD ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 000099D1 ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 000099D9 ?? 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 0 00009976 ???? SECSIZE DW ? 0 00009978 ?? SECALL DB ? 0 00009979 ???? RESNUM DW ? 0 0000997B ?? FATNUM DB ? 0 0000997C ???? DIRNUM DW ? 0 0000997E ???? SECNUM DW ? 0 00009980 ?? FATID DB ? 0 00009981 ???? FATSIZE DW ? 0 00009983 ???? SLIM DW ? 0 00009985 ???? HLIM DW ? 0 00009987 ???? HIDDEN_L DW ? 0 00009989 ???? HIDDEN_H dw ? ;0 ;J.K. 0 0000998B ???? SECNUM_L dw ? ;0 ;J.K. 0 0000998D ???? 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 24 %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 0 00009976 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 0000997A ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 0000997C ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 0000997E ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 00009980 ???????????????? 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 0 00009976 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00009977 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00009978 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00009979 ???? REQSTAT DW ? ;STATUS WORD 0 0000997B ???????????????? 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 <1> DB (SRHEAD_struc_size) DUP(?) 157 <1> ; GENERIC IOCTL ADDITION. 0 00009983 ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00009984 ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00009985 ???? REG_SI DW ? 0 00009987 ???? REG_DI DW ? 0 00009989 ???????? 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 0 00009976 ???????? SECTOR_RBA DD ? ; relative block address 0 0000997A ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 0000997C ???????? 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 0 00009976 ???? MEDIA_level DW ? ; info level 0 00009978 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <1> MEDIA_Label DB 11 dup (?) ;volume label 0 00009987 ???????????????? 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 25 %include "pushpop.mac" 1 <1> ; NASM original macros 2 <1> 3 <1> %unimacro stripangles 2.nolist 4 <1> %assign ?stackdepth 0 5 <1> 6 <1> %imacro stripangles 2.nolist 7 <1> %defstr %%param %2 8 <1> %rep 16 9 <1> %substr %%opening %%param 1 10 <1> %ifidn %%opening, '<' 11 <1> %substr %%param %%param 2,-1 12 <1> %endif 13 <1> %endrep 14 <1> %rep 16 15 <1> %strlen %%length %%param 16 <1> %substr %%closing %%param %%length 17 <1> %ifidn %%closing, '>' 18 <1> %substr %%param %%param 1,-2 19 <1> %endif 20 <1> %endrep 21 <1> %deftok %%token %%param 22 <1> %1 %%token 23 <1> %endmacro 24 <1> 25 <1> ;BREAK 26 <1> 27 <1> %imacro SaveReg 0-*.nolist ;; push those registers 28 <1> %rep %0 29 <1> %assign ?stackdepth ?stackdepth + 1 30 <1> stripangles push, %1 31 <1> %rotate 1 32 <1> %endrep 33 <1> %endmacro 34 <1> ;.xcref SaveReg 35 <1> 36 <1> ;BREAK 37 <1> 38 <1> %imacro RestoreReg 0-*.nolist ;; pop those registers 39 <1> %rep %0 40 <1> %assign ?stackdepth ?stackdepth - 1 41 <1> stripangles pop, %1 42 <1> %rotate 1 43 <1> %endrep 44 <1> %endmacro 45 <1> ;.xcref RestoreReg 26 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 27 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 1 <2> [list -] 1 ****************** <2> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <3> [list -] 14 <2> [list -] 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 28 %include "lmacros3.mac" 1 <1> [list -] 29 %include "ddataseg.nas" 1 <1> 2 <1> %include "lmacros3.mac" 1 <2> [list -] 3 <1> === Switch to base=000E10h -> "DOSSTART" 4 <1> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <1> ; (no prior section) ; DOSSTART ENDS 6 <1> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <1> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <1> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <1> === Switch to base=000E10h -> "CONSTANTS" 10 <1> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <1> ; (no prior section) ; CONSTANTS ENDS 12 <1> === Switch to base=000E10h -> "DATA" 13 <1> addsection DATA, align=2 PUBLIC class=DATA 14 <1> ; (no prior section) ; DATA ENDS 15 <1> === Switch to base=000E10h -> "TABLE" 16 <1> addsection TABLE, align=2 PUBLIC class=TABLE 17 <1> ; (no prior section) ; TABLE ENDS 18 <1> === Switch to base=000E10h -> "DOSDATATABLE" 19 <1> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <1> ; (no prior section) ; DOSDATATABLE ENDS 21 <1> === Switch to base=000E10h -> "DOSDATACODE" 22 <1> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <1> ; (no prior section) ; DOSDATACODE ENDS 24 <1> === Switch to base=000E10h -> "DOSBIODATA" 25 <1> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <1> === Switch to base=000E10h -> "LAST" 27 <1> addsection LAST, align=16 PUBLIC class=LAST 28 <1> ; (no prior section) ; LAST ENDS 29 <1> 30 <1> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <1> 32 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 30 %include "dcodeseg.nas" 1 <1> 2 <1> %ifndef DCODESEGNAS 3 <1> %assign DCODESEGNAS 1 4 <1> === Switch to base=002450h -> "DOSCODETABLE" 5 <1> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <1> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <1> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <1> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <1> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <1> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <1> 12 <1> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <1> 14 <1> %endif 31 %include "codesw.mac" 1 <1> DOSCODE_HMA_SEGMENT equ 0FFFEh 2 <1> ; address DOSCODE at this segment when in HMA 3 <1> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h 4 <1> ; offset from DOSCODE offset 0 to address 10_0000h 5 <1> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h 6 <1> ; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB 32 %include "entrysw.mac" 1 <1> 2 <1> DOSENTRYADJUSTSEGMENT equ 60h - 26h 3 <1> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16 4 <1> 5 <1> DOSENTRYDEVICEBASE equ 10h 33 === Switch to base=002450h -> "BIOCODE" 34 addsection BIOCODE 35 === Switch to base=00C400h -> "SYSINITSEG" 36 addsection SYSINITSEG, PUBLIC class=INIT === Switch to base=00C400h -> "SYSINITTRAIL" 37 addsection SYSINITTRAIL, PUBLIC class=INIT 38 39 group SYSINITGROUP SYSINITSEG SYSINITTRAIL 40 === Switch to base=002450h -> "BIOCODE" 41 usesection BIOCODE 42 43 assume ds:nothing, es:nothing, ss:nothing 44 45 extern biocode_get_ds_dosentry, biocode_get_es_dosentry 46 extern dosbiocode_get_ds_dosentry, dosbiocode_get_es_dosentry 47 extern biocode_get_ds_dosbiodata 48 extern biocode_get_es_dosbiodata 49 extern dosbiocode_get_ds_dosbiodata 50 extern dosbiocode_get_es_dosbiodata 51 52 EXTRN DSK$IN:NEAR 53 EXTRN SETPTRSAV:NEAR 54 EXTRN OUTCHR:NEAR 55 EXTRN SETDRIVE:NEAR 56 EXTRN FLUSH:NEAR 57 EXTRN HARDERR:NEAR 58 EXTRN HARDERR2:NEAR 59 EXTRN MAPERROR:NEAR 60 EXTRN GETBP:NEAR 61 EXTRN CHECKSINGLE:NEAR 62 EXTRN CHECK_TIME_OF_ACCESS:NEAR 63 EXTRN EXIT:NEAR 64 EXTRN HAS1:NEAR 65 EXTRN READ_SECTOR:NEAR 66 67 EXTRN OLD13:DWORD 68 69 ;DATA 70 EXTRN PTRSAV:DWORD ;IBMBIO1 71 EXTRN START_BDS:WORD 72 EXTRN FDRIVE1:WORD 73 EXTRN FDRIVE2:WORD 74 EXTRN FDRIVE3:WORD 75 EXTRN FDRIVE4:WORD 76 EXTRN FLAGBITS:WORD 77 EXTRN TIM_DRV:BYTE 78 EXTRN MEDBYT:BYTE 79 EXTRN DRVMAX:BYTE 80 extrn Ext_Boot_Sig:byte ;AN000; ibmbdata 81 extrn SecPerClusInSector:byte ;AN000; ibmbdata 82 extrn Boot_Serial_L:word ;AN000; ibmbdata 83 extrn Boot_Serial_H:word ;AN000; ibmbdata 84 85 === Switch to base=000E10h -> "DOSBIODATA" 86 usesection DOSBIODATA 87 88 extern MODEL_BYTE 89 extern Secondary_Model_Byte 90 extern INT19SEM 91 %macro int19oldextern 1-* 92 %rep %0 93 extern Int19OLD%1 94 %rotate 1 95 %endrep 96 %endmacro 97 int19oldextern 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77 92 <1> %rep %0 93 <1> extern Int19OLD%1 94 <1> %rotate 1 95 <1> %endrep 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 93 <2> extern Int19OLD%1 94 <2> %rotate 1 98 extern dskdrvs_indirect 99 100 === Switch to base=002450h -> "DOSBIOCODE" 101 addsection DOSBIOCODE 102 103 ; INT19 104 ; 105 ; WE "HOOK" THE INT 19 VECTOR, BECAUSE CONTRARY TO IBM DOCUMENTATION, 106 ; IT DOES NOT "BOOTSTRAP" THE MACHINE. IT LEAVES MEMORY ALMOST UNTOUCHED. 107 ; SINCE THE BIOS_INIT CODE ASSUMES THAT CERTAIN INTERRUPT VECTORS POINT TO 108 ; THE ROM_BIOS WE MUST "UNHOOK" THEM BEFORE ISSUING THE ACTUAL INT_19. 109 ; CURRENTLY THE ONLY VECTORS THAT NEED TO BE UNHOOKED ARE INT_19, INT_13, 110 ; AND THE HARDWARE INTERRUPTS. 111 ; 112 relocated i19 113 INT19 PROC FAR 114 assume ds:nothing, es:nothing, ss:nothing 115 116 extern InterruptRestorationTable 0 00007D22 FC cld 0 00007D23 E8[0000] call dosbiocode_get_ds_dosentry ; IRT in DOSENTRY 119 assume ds:DOSENTRYGROUP ; ds => DOSENTRY 0 00007D26 BE[0000] mov si, InterruptRestorationTable 121 .loop: 0 00007D29 31C0 xor ax, ax 0 00007D2B 8EC0 mov es, ax ; es => IVT 124 assume es:IVT 0 00007D2D AC lodsb 0 00007D2E 3CFF cmp al, -1 0 00007D30 7409 je .done 0 00007D32 97 xchg di, ax ; di = interrupt number 0 00007D33 01FF add di, di 0 00007D35 01FF add di, di ; es:di -> interrupt vector 0 00007D37 A5 movsw 0 00007D38 A5 movsw ; restore from IRT 0 00007D39 EBEE jmp .loop 134 .done: 135 136 %ifnidni %[DOSBIODATA], %[DOSENTRY] 0 00007D3B 06 push es 0 00007D3C 1F pop ds ; => IVT 0 00007D3D E8[0000] call biocode_get_es_dosbiodata 140 assume ds:IVT, es:DOSGROUP 141 %else 142 push es 143 push ds 144 pop es 145 pop ds ; swap, es => DOSENTRY, ds => IVT 146 %endif 147 0 00007D40 26803E[0000]00 CMP BYTE [es:INT19SEM], 0 0 00007D46 7503 JNZ INT19VECS 0 00007D48 E98C01 JMP DOINT19 151 152 %if 0 ; dead code 153 ; ON THE PCJR, DON'T REPLACE ANY VECTORS 154 ; MODEL BYTE DEFINITIONS FROM IBMSTACK.ASM 155 MOV AX,ROMSEGMENT 156 MOV DS,AX 157 MOV AL,MODELPCJR 158 159 CMP AL,[MODELBYTE] 160 JNE INT19VECS 161 JMP DOINT19 162 %endif 163 164 ;Stacks code has changed these hardware interrupt vectors 165 ;STKINIT in SYSINIT1 will initialzie Int19hOLDxx values. 166 INT19VECS: 0 00007D4B 31C0 XOR AX,AX 0 00007D4D 8ED8 MOV DS,AX 169 assume ds:IVT 170 171 172 %macro int19restore 1-* 173 %rep %0 174 call dosbiocode_get_es_dosbiodata 175 assume es:DOSGROUP 176 LES DI,[es:Int19OLD%1] 177 assume es:nothing 178 ;SB33103****************************************************************** 179 180 mov ax,es ; 181 cmp ax,-1 ;OPT 0ffffh is unlikely segment 182 je skip_int%1 ;OPT no need to check selector too 183 cmp di,-1 ;OPT 0ffffh is unlikely offset 184 je skip_int%1 185 186 ;SB33103****************************************************************** 187 MOV [%1H*4],DI 188 MOV [%1H*4+2],ES 189 skip_int%1: 190 %rotate 1 191 %endrep 192 %endmacro 193 194 int19restore 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77 173 <1> %rep %0 174 <1> call dosbiocode_get_es_dosbiodata 175 <1> assume es:DOSGROUP 176 <1> LES DI,[es:Int19OLD%1] 177 <1> assume es:nothing 178 <1> 179 <1> 180 <1> mov ax,es 181 <1> cmp ax,-1 182 <1> je skip_int%1 183 <1> cmp di,-1 184 <1> je skip_int%1 185 <1> 186 <1> 187 <1> MOV [%1H*4],DI 188 <1> MOV [%1H*4+2],ES 189 <1> skip_int%1: 190 <1> %rotate 1 191 <1> %endrep 0 00007D4F E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007D52 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007D57 8CC0 mov ax,es 0 00007D59 83F8FF cmp ax,-1 0 00007D5C 740D je skip_int%1 0 00007D5E 83FFFF cmp di,-1 0 00007D61 7408 je skip_int%1 185 <2> 186 <2> 0 00007D63 893E0800 MOV [%1H*4],DI 0 00007D67 8C060A00 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007D6B E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007D6E 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007D73 8CC0 mov ax,es 0 00007D75 83F8FF cmp ax,-1 0 00007D78 740D je skip_int%1 0 00007D7A 83FFFF cmp di,-1 0 00007D7D 7408 je skip_int%1 185 <2> 186 <2> 0 00007D7F 893E2000 MOV [%1H*4],DI 0 00007D83 8C062200 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007D87 E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007D8A 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007D8F 8CC0 mov ax,es 0 00007D91 83F8FF cmp ax,-1 0 00007D94 740D je skip_int%1 0 00007D96 83FFFF cmp di,-1 0 00007D99 7408 je skip_int%1 185 <2> 186 <2> 0 00007D9B 893E2400 MOV [%1H*4],DI 0 00007D9F 8C062600 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007DA3 E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007DA6 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007DAB 8CC0 mov ax,es 0 00007DAD 83F8FF cmp ax,-1 0 00007DB0 740D je skip_int%1 0 00007DB2 83FFFF cmp di,-1 0 00007DB5 7408 je skip_int%1 185 <2> 186 <2> 0 00007DB7 893E2800 MOV [%1H*4],DI 0 00007DBB 8C062A00 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007DBF E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007DC2 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007DC7 8CC0 mov ax,es 0 00007DC9 83F8FF cmp ax,-1 0 00007DCC 740D je skip_int%1 0 00007DCE 83FFFF cmp di,-1 0 00007DD1 7408 je skip_int%1 185 <2> 186 <2> 0 00007DD3 893E2C00 MOV [%1H*4],DI 0 00007DD7 8C062E00 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007DDB E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007DDE 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007DE3 8CC0 mov ax,es 0 00007DE5 83F8FF cmp ax,-1 0 00007DE8 740D je skip_int%1 0 00007DEA 83FFFF cmp di,-1 0 00007DED 7408 je skip_int%1 185 <2> 186 <2> 0 00007DEF 893E3000 MOV [%1H*4],DI 0 00007DF3 8C063200 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007DF7 E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007DFA 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007DFF 8CC0 mov ax,es 0 00007E01 83F8FF cmp ax,-1 0 00007E04 740D je skip_int%1 0 00007E06 83FFFF cmp di,-1 0 00007E09 7408 je skip_int%1 185 <2> 186 <2> 0 00007E0B 893E3400 MOV [%1H*4],DI 0 00007E0F 8C063600 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007E13 E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007E16 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007E1B 8CC0 mov ax,es 0 00007E1D 83F8FF cmp ax,-1 0 00007E20 740D je skip_int%1 0 00007E22 83FFFF cmp di,-1 0 00007E25 7408 je skip_int%1 185 <2> 186 <2> 0 00007E27 893E3800 MOV [%1H*4],DI 0 00007E2B 8C063A00 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007E2F E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007E32 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007E37 8CC0 mov ax,es 0 00007E39 83F8FF cmp ax,-1 0 00007E3C 740D je skip_int%1 0 00007E3E 83FFFF cmp di,-1 0 00007E41 7408 je skip_int%1 185 <2> 186 <2> 0 00007E43 893EC001 MOV [%1H*4],DI 0 00007E47 8C06C201 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007E4B E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007E4E 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007E53 8CC0 mov ax,es 0 00007E55 83F8FF cmp ax,-1 0 00007E58 740D je skip_int%1 0 00007E5A 83FFFF cmp di,-1 0 00007E5D 7408 je skip_int%1 185 <2> 186 <2> 0 00007E5F 893EC801 MOV [%1H*4],DI 0 00007E63 8C06CA01 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007E67 E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007E6A 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007E6F 8CC0 mov ax,es 0 00007E71 83F8FF cmp ax,-1 0 00007E74 740D je skip_int%1 0 00007E76 83FFFF cmp di,-1 0 00007E79 7408 je skip_int%1 185 <2> 186 <2> 0 00007E7B 893ECC01 MOV [%1H*4],DI 0 00007E7F 8C06CE01 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007E83 E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007E86 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007E8B 8CC0 mov ax,es 0 00007E8D 83F8FF cmp ax,-1 0 00007E90 740D je skip_int%1 0 00007E92 83FFFF cmp di,-1 0 00007E95 7408 je skip_int%1 185 <2> 186 <2> 0 00007E97 893ED001 MOV [%1H*4],DI 0 00007E9B 8C06D201 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007E9F E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007EA2 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007EA7 8CC0 mov ax,es 0 00007EA9 83F8FF cmp ax,-1 0 00007EAC 740D je skip_int%1 0 00007EAE 83FFFF cmp di,-1 0 00007EB1 7408 je skip_int%1 185 <2> 186 <2> 0 00007EB3 893ED801 MOV [%1H*4],DI 0 00007EB7 8C06DA01 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 0 00007EBB E8[0000] call dosbiocode_get_es_dosbiodata 175 <2> assume es:DOSGROUP 0 00007EBE 26C43E[0000] LES DI,[es:Int19OLD%1] 177 <2> assume es:nothing 178 <2> 179 <2> 0 00007EC3 8CC0 mov ax,es 0 00007EC5 83F8FF cmp ax,-1 0 00007EC8 740D je skip_int%1 0 00007ECA 83FFFF cmp di,-1 0 00007ECD 7408 je skip_int%1 185 <2> 186 <2> 0 00007ECF 893EDC01 MOV [%1H*4],DI 0 00007ED3 8C06DE01 MOV [%1H*4+2],ES 189 <2> skip_int%1: 190 <2> %rotate 1 195 196 197 DOINT19: 0 00007ED7 8CC8 mov ax, cs 0 00007ED9 83F8FE cmp ax, DOSCODE_HMA_SEGMENT 0 00007EDC 720D jb .done 201 202 ; clear the VDISK header in HMA 0 00007EDE B8FFFF mov ax, -1 ; => HMA 0 00007EE1 8EC0 mov es, ax 205 assume es:nothing 0 00007EE3 BF1000 mov di, 10h ; -> start of HMA 0 00007EE6 89F9 mov cx, di ; 10h words = 20h bytes 0 00007EE8 40 inc ax ; = 0 0 00007EE9 F3AB rep stosw ; re-initialise 210 .done: 0 00007EEB CD19 INT 19H 212 INT19 ENDP 213 214 === Switch to base=002450h -> "BIOCODE" 215 section BIOCODE 216 217 PUBLIC DSK$INIT 218 DSK$INIT PROC NEAR 219 assume ds:DOSGROUP, es:nothing, ss:nothing 220 ; ds => DOSBIODATA from ENTRY in msbio1.nas 221 %ifnidni %[DOSBIODATA], %[DOSENTRY] 0 00009976 E8[0000] call biocode_get_es_dosentry ; DRVMAX in DOSENTRY 223 assume es:DOSENTRYGROUP 0 00009979 26 es 225 %endif 0 0000997A 8A26[0000] MOV AH,BYTE PTR [DRVMAX] 0 0000997E C53E[0000] lds di, [dskdrvs_indirect] 228 assume ds:UPB 0 00009982 E9[0000] JMP SETPTRSAV 230 DSK$INIT ENDP 231 232 ; 233 ; INT 2F HANDLER FOR EXTERNAL BLOCK DRIVERS TO COMMUNICATE WITH THE INTERNAL 234 ; BLOCK DRIVER IN IBMDISK. THE MULTIPLEX NUMBER CHOSEN IS 8. THE HANDLER 235 ; SETS UP THE POINTER TO THE REQUEST PACKET IN [PTRSAV] AND THEN JUMPS TO 236 ; DSK$IN, THE ENTRY POINT FOR ALL DISK REQUESTS. 237 ; ON EXIT FROM THIS DRIVER (AT EXIT), WE WILL RETURN TO THE EXTERNAL DRIVER 238 ; THAT ISSUED THIS INT 2F, AND CAN THEN REMOVE THE FLAGS FROM THE STACK. 239 ; THIS SCHEME ALLOWS US TO HAVE A SMALL EXTERNAL DEVICE DRIVER, AND MAKES 240 ; THE MAINTAINANCE OF THE VARIOUS DRIVERS (DRIVER AND IBMBIO) MUCH EASIER, 241 ; SINCE WE ONLY NEED TO MAKE CHANGES IN ONE PLACE (MOST OF THE TIME). 242 ; 243 ; 06/03/88 J.K. When AL=3, return DS:DI -> Start of BDS table. 244 ; (EMS device driver hooks INT 13h to handle 16KB DMA overrun 245 ; problem. BDS table is going to be used to get head/sector 246 ; informations without calling Generic IOCTL Get Device Parm call.) 247 ; 248 ; AL CONTAINS THE INT2F FUNCTION: 249 ; 0 - CHECK FOR INSTALLED HANDLER - RESERVED 250 ; 1 - INSTALL THE BDS INTO THE LINKED LIST 251 ; 2 - DOS REQUEST 252 ; 3 - Get BDS vector ;06/03/88 J.K. 253 ; Return BDS table starting pointer in DS:DI 254 255 MYNUM EQU 8 256 257 relocated disk_i2F 258 assume ds:nothing, es:nothing, ss:nothing 0 00009985 80FC08 CMP AH,MYNUM 260 extern relocatedmsdos_i2F 0 00009988 7403E9[0000] jne relocatedmsdos_i2F ; CHAIN TO NEXT INT 2F HANDLER 0 0000998D 3CF8 CMP AL,0F8H ; IRET ON RESERVED FUNCTIONS 0 0000998F 7308 jae .iret ; if >= 0F8h --> 0 00009991 3C01 cmp al, 1 ; what subfunction ? 0 00009993 7705 ja @F ; if > 1 --> 0 00009995 741F je INSTALL_BDS ; if == 1 --> 267 ; if < 1 0 00009997 B0FF MOV AL,0FFH ; installation check 269 .iret: 0 00009999 CF IRET 271 272 @@: 0 0000999A 3C03 cmp al, 3 ; Get BDS vector? 0 0000999C 7410 je DO_Get_BDS_Vector ; yes --> 275 ; 2 or 4..0F7h: call block device 276 ; SET UP POINTER TO REQUEST PACKET 0 0000999E 1E push ds 0 0000999F E8[0000] call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 279 assume ds:DOSENTRYGROUP 0 000099A2 891E[0000] MOV WORD PTR [PTRSAV], BX ; otherwise DOS block device function 0 000099A6 8C06[0200] MOV WORD PTR [PTRSAV+2], ES 0 000099AA 1F pop ds 283 assume ds:nothing 0 000099AB E9[0000] JMP DSK$IN 285 286 DO_Get_BDS_Vector: ;AN002; AL=3 0 000099AE E8[0000] call biocode_get_ds_dosbiodata 288 assume ds:DOSGROUP 289 Start_BDS equ START_BDS ; NASM port label 0 000099B1 C53E[0000] lds di, [Start_BDS] ;AN002; 291 assume ds:UPB 0 000099B5 CF IRET ;AN002; 293 294 295 ; INSTALL_BDS INSTALLS A BDS A LOCATION DS:DI INTO THE CURRENT LINKED LIST OF 296 ; BDS MAINTAINED BY THIS DEVICE DRIVER. IT PLACES THE BDS AT THE END OF THE 297 ; LIST. 298 299 INSTALL_BDS: 300 assume ds:nothing, es:nothing, ss:nothing 301 MESSAGE FTESTINIT,<"INSTALL BDS",CR,LF> 302 ; DS:DI POINT TO BDS TO BE INSTALLED 0 000099B6 E8[0000] call biocode_get_es_dosbiodata 304 assume es:DOSGROUP 0 000099B9 26C436[0000] LES SI,[es:START_BDS] ; START AT BEGINNING OF LIST 306 assume es:UPB 0 000099BE 06 PUSH ES ; SAVE POINTER TO CURRENT BDS 0 000099BF 56 PUSH SI 309 ; ES:SI NOW POINT TO BDS IN LINKED LIST 310 LOOP_NEXT_BDS: 0 000099C0 46 inc si ; GOT TO END OF LINKED LIST? (-1) 0 000099C1 742C JZ INSTALL_RET ; yes --> (will overwrite si) 0 000099C3 4E dec si ; undo inc 314 315 ; IF WE HAVE SEVERAL LOGICAL DRIVES USING THE SAME PHYSICAL DRIVE, WE MUST 316 ; SET THE I_AM_MULT FLAG IN EACH OF THE APPROPRIATE BDSS. 0 000099C4 8A4504 MOV AL,BYTE PTR [DI + DRIVENUM] 0 000099C7 26384404 CMP BYTE PTR [ES:SI + DRIVENUM],AL 0 000099CB 7517 JNZ .NEXT_BDS 320 MESSAGE FTESTINIT,<"LOGICAL DRIVES",CR,LF> 0 000099CD B310 MOV bl, FI_AM_MULT 0 000099CF 085D23 OR [DI + FLAGS], bl ; SET FLAGS IN BOTH BDSS CONCERNED 0 000099D2 26085C23 OR [ES:SI + FLAGS], bl 0 000099D6 806523DF AND byte [DI + FLAGS], ~ FI_OWN_PHYSICAL 325 ; RESET THAT FLAG FOR 'NEW' BDS 326 ; WE MUST ALSO SET THE FCHANGELINE BIT CORRECTLY. 0 000099DA 268A5C23 MOV bl, [ES:SI + FLAGS] ; DETERMINE IF CHANGELINE AVAILABLE 0 000099DE 80E302 AND BL,FCHANGELINE 0 000099E1 085D23 OR [DI + FLAGS], bl 330 331 .NEXT_BDS: 332 ; BEFORE MOVING TO NEXT BDS, PRESERVE POINTER TO CURRENT ONE. THIS IS NEEDED AT 333 ; THE END WHEN THE NEW BDS IS LINKED INTO THE LIST. 0 000099E4 5B POP BX ; DISCARD PREVIOUS POINTER TO BDS 0 000099E5 5B POP BX 0 000099E6 06 PUSH ES 0 000099E7 56 PUSH SI 0 000099E8 26C434 les si, [es:si + LINK] 0 000099EB 8CC3 mov bx, es ; returned bx 0 000099ED EBD1 JMP SHORT LOOP_NEXT_BDS 341 342 INSTALL_RET: 0 000099EF 5E POP SI ; RETRIEVE POINTER TO LAST BDS 0 000099F0 07 POP ES ; IN LINKED LIST. 345 assume es:UPB 0 000099F1 8CD8 MOV AX,DS ; returned ax 0 000099F3 26894402 MOV WORD PTR [ES:SI + LINK + 2],AX ; INSTALL BDS 0 000099F7 26893C MOV WORD PTR [ES:SI + LINK],DI 0 000099FA 830DFF or WORD PTR [DI + LINK],-1 ; SET NEXT POINTER TO NULL 0 000099FD CF iret 351 352 === Switch to base=00C400h -> "SYSINITTRAIL" 353 usesection SYSINITTRAIL ; fix to not run in unrelocated DOSCODE 354 355 ; lDOS: This used to install the msbio int 2Fh handler. No longer used. 356 PUBLIC RE_INIT 357 RE_INIT PROC near 358 assume ds:nothing, es:nothing, ss:nothing 359 MESSAGE FTESTINIT,<"REINIT",CR,LF> 0 00003834 C3 retn 361 362 RE_INIT ENDP 363 364 === Switch to base=002450h -> "BIOCODE" 365 usesection BIOCODE 366 367 ;------------------------------------------------- 368 ; 369 ; ASK TO SWAP THE DISK IN DRIVE A: 370 ; 371 ; INP: ah = prior drive letter 372 ; ds:di -> UPB for target drive, already active 373 ; CHG: ax 374 PUBLIC SWPDSK 375 SWPDSK PROC NEAR 376 assume ds:UPB, es:nothing, ss:nothing 0 000099FE 51 push cx 0 000099FF 52 push dx 0 00009A00 8A4505 MOV AL,BYTE PTR [DI + DRIVELET] ; GET THE DRIVE LETTER 380 ;USING A DIFFERENT DRIVE IN A ONE DRIVE SYSTEM SO REQUEST THE USER CHANGE DISKS 0 00009A03 92 xchg dx, ax ; dh = prior, dl = new 0 00009A04 06 push es 0 00009A05 1E push ds 0 00009A06 07 pop es ; (super undocumented? es:di -> target UPB) 385 assume es:UPB 0 00009A07 31C9 xor cx, cx 0 00009A09 B8004A mov ax, 4A00h 0 00009A0C CD2F int 2Fh ; MS-DOS v5+ drive change notification 0 00009A0E 41 inc cx ; was FFFFh ? 0 00009A0F 741A jz .skip ; yes, someone handled it --> 0 00009A11 92 xchg ax, dx ; get new drive back to al 0 00009A12 0441 ADD AL,"A" ; make into a letter 0 00009A14 1E PUSH DS ; PRESERVE SEGMENT REGISTER 0 00009A15 E8[0000] call biocode_get_ds_dosbiodata 395 assume ds:DOSGROUP 0 00009A18 A2[0000] MOV [DRVLET],AL 0 00009A1B BE[0000] MOV SI,OFFSET SNGMSG ; DS:SI -> MESSAGE 0 00009A1E 53 PUSH BX 0 00009A1F E80D00 CALL WRMSG ;PRINT DISK CHANGE MESSAGE 0 00009A22 E8[0000] CALL FLUSH 401 ;SB33003*************************************************************** 0 00009A25 30E4 xor AH, AH ; set command to read character;SB 0 00009A27 CD16 int 16h ; call rom-bios ;SB 404 ;SB33003*************************************************************** 0 00009A29 5B POP BX 0 00009A2A 1F POP DS ; RESTORE SEGMENT REGISTER 407 assume ds:UPB 408 .skip: 0 00009A2B 07 pop es 410 assume es:nothing 0 00009A2C 5A pop dx 0 00009A2D 59 pop cx 413 WRMRET: 0 00009A2E C3 RET 415 SWPDSK ENDP 416 417 ;---------------------------------------------- 418 ; 419 ; WRITE OUT MESSAGE POINTED TO BY [SI] 420 ; 421 PUBLIC WRMSG 422 WRMSG PROC NEAR 423 assume ds:DOSGROUP, es:nothing, ss:nothing 0 00009A2F AC LODSB ;GET THE NEXT CHARACTER OF THE MESSAGE 0 00009A30 84C0 test AL,AL ;SEE IF END OF MESSAGE 0 00009A32 74FA JZ WRMRET 427 ; INT CHROUT 0 00009A34 9C PUSHF 0 00009A35 0E PUSH CS 0 00009A36 E8[0000] CALL OUTCHR 0 00009A39 EBF4 JMP SHORT WRMSG 432 WRMSG ENDP 433 434 === Switch to base=000E10h -> "DOSBIODATA" 435 usesection DOSBIODATA 436 extern SNGMSG 437 extern DRVLET 438 439 === Switch to base=002450h -> "BIOCODE" 440 usesection BIOCODE 441 442 ; 443 ; END OF SUPPORT FOR MULTIPLE FLOPPIES WITH NO LOGICAL DRIVES 444 ; THIS IS NOT 'SPECIAL' ANY MORE BECAUSE WE NOW HAVE THE CAPABILITY OF 445 ; DEFINING LOGICAL DRIVES IN CONFIG.SYS. WE THEREFORE KEEP THE CODE FOR 446 ; SWAPPING RESIDENT ALL THE TIME. 447 ; 448 449 ;J.K. 10/1/86 ******************************************************* 450 ;Variables for Dynamic Relocatable modules 451 ;These should be stay resident. 452 === Switch to base=000E10h -> "DOSBIODATA" 453 usesection DOSBIODATA 454 455 align 2, db 0 456 457 PATHSTART 001,CLK 205 <1> %IF PATHGEN 206 <1> PUBLIC %2%1S,%2%1E 207 <1> %2%1S LABEL BYTE 208 <1> %ENDIF 458 ; 459 ; DATA STRUCTURES FOR REAL-TIME DATE AND TIME 460 ; 461 public BIN_DATE_TIME 462 public MONTH_TABLE 463 public DAYCNT2 464 public FEB29 465 BIN_DATE_TIME: 0 00001540 00 DB 0 ; CENTURY (19 OR 20) OR HOURS (0-23) 0 00001541 00 DB 0 ; YEAR IN CENTURY (0...99) OR MINUTES (0-59) 0 00001542 00 DB 0 ; MONTH IN YEAR (1...12) OR SECONDS (0-59) 0 00001543 00 DB 0 ; DAY IN MONTH (1...31) 470 MONTH_TABLE: ; 0 00001544 0000 DW 0 ;MJB002 JANUARY 0 00001546 1F00 DW 31 ;MJB002 FEBRUARY 0 00001548 3B00 DW 59 ;MJB002 0 0000154A 5A00 DW 90 ;MJB002 0 0000154C 7800 DW 120 ;MJB002 0 0000154E 9700 DW 151 ;MJB002 0 00001550 B500 DW 181 ;MJB002 0 00001552 D400 DW 212 ;MJB002 0 00001554 F300 DW 243 ;MJB002 0 00001556 1101 DW 273 ;MJB002 0 00001558 3001 DW 304 ;MJB002 0 0000155A 4E01 DW 334 ;MJB002 DECEMBER 0 0000155C 0000 DAYCNT2 DW 0000 ;MJB002 TEMP FOR COUNT OF DAYS SINCE 1-1-80 0 0000155E 00 FEB29 DB 0 ;MJB002 FEBRUARY 29 IN A LEAP YEAR FLAG 485 PATHEND 001,CLK 212 <1> %IF PATHGEN 213 <1> %2%1E LABEL BYTE 214 <1> %ENDIF 486 487 ;******************************************************************** 488 ; 489 === Switch to base=000000h -> "DOSENTRY" 490 usesection DOSENTRY 491 492 PUBLIC ENDFLOPPY 493 ENDFLOPPY LABEL BYTE 494 495 PATHSTART 004,BIO 205 <1> %IF PATHGEN 206 <1> PUBLIC %2%1S,%2%1E 207 <1> %2%1S LABEL BYTE 208 <1> %ENDIF 496 497 === Switch to base=00C400h -> "SYSINITTRAIL" 498 usesection SYSINITTRAIL 499 500 global partition_table, partition_table.end 0 00003835 00 align 4, db 0 ; ! this needs WarpLink ecm release 3 502 ; (r1 and r2 had new bugs, so we want r3 now) 503 partition_table: 0 00003838 00 times 64 db 0 505 .end: 506 507 global load_mode, load_scan_flags, load_partition_cycle 508 global load_current_partition, load_unit, load_amount_units 509 global next_block_device_unit 510 align 2, db 0 511 load_mode: 0 00003878 0000 dw 0 513 load_scan_flags: 0 0000387A 0000 dw 0 515 load_partition_cycle: 0 0000387C 0000 dw 0 517 load_current_partition: 0 0000387E 00 db 0 519 load_unit: 0 0000387F 00 db 0 521 load_amount_units: 0 00003880 00 db 0 523 next_block_device_unit: 0 00003881 00 db 0 525 526 527 PUBLIC HNUM 0 00003882 00 HNUM DB 0 ;NUMBER OF HARDFILES 529 PUBLIC HARDDRV 0 00003883 80 HARDDRV DB 80H ;PHYSICAL DRIVE NUMBER OF FIRST HARDFILE 531 532 ;********************************************************************** 533 ; "HDRIVE" IS A HARD DISK WITH 512 BYTE SECTORS 534 ;********************************************************************* 535 EVENB 536 537 BDSM_type_size equ BDSM_type_struc_size ; NASM port equate 538 public BDS_harddisk_template 539 BDS_harddisk_template: 540 istruc BDSM_type 541 at mlink 0 00003884 FFFF dw -1 0 00003886 FFFF dw -1 ; LINK TO NEXT STRUCTURE 544 at mdriveNum 0 00003888 80 db 80h ; INT 13 DRIVE NUMBER 546 at mdriveLet 0 00003889 03 db 3 ; LOGICAL DRIVE LETTER 548 at mBytePerSec 0 0000388A 0002 dw 512 550 at mSecPerClus 0 0000388C 01 db 1 ; SECTORS/ALLOCATION UNIT 552 at mRESSEC 0 0000388D 0100 dw 1 ; RESERVED SECTORS FOR DOS 554 at mcFAT 0 0000388F 02 db 2 ; NO. OF ALLOCATION TABLES 556 at mcDIR 0 00003890 1000 dw 16 ; NUMBER OF DIRECTORY ENTRIES 558 at mDRVLIM 0 00003892 0000 dw 0 ; NUMBER OF SECTORS (AT 512 BYTES EACH) 560 at mMediad 0 00003894 F8 db 1111_1000b ; MEDIA DESCRIPTOR 562 at mcSecFat 0 00003895 0100 dw 1 ; NUMBER OF FAT SECTORS 564 at mSECLIM 0 00003897 0000 dw 0 ; SECTOR LIMIT 566 at mHDLIM 0 00003899 0000 dw 0 ; HEAD LIMIT 568 at mHIDSEC_L 0 0000389B 0000 dw 0 ; HIDDEN SECTOR COUNT(low) 570 at mHidsec_H 0 0000389D 0000 dw 0 ; Hidden Sector (high) 572 at mDrvlim_L 0 0000389F 0000 dw 0 ; Number of Sectors (low) 574 at mDrvlim_H 0 000038A1 0000 dw 0 ; Number of Sectors (high) 576 at mFatSiz 0 000038A3 00 db 0 ; TRUE => BIGFAT 578 at mOPCNT 0 000038A4 0000 dw 0 ; OPEN REF. COUNT 580 at mFormFactor 0 000038A6 03 db 3 ; FORM FACTOR 582 at mFLAGS 0 000038A7 2000 dw 20h ; VARIOUS FLAGS 584 at mcCyln 0 000038A9 2800 dw 40 ; NUMBER OF CYLINDERS 586 at mRecBPB 0 000038AB 00 db 0 ; RECOMMENDED BPB FOR DRIVE 0 000038AC 00 at mTrack 0 000038CA FF db -1 ; LAST TRACK ACCESSED ON THIS DRIVE 590 at IsMini 0 000038CB 0100 dw 1 592 at Hidden_Trks 0 000038CD 0000 dw 0 594 at mVOLID 0 000038CF 4E4F204E414D452020 db "NO NAME " 0 000038D8 2020 0 000038DA 00 db 0 ; VOLUME ID FOR THIS DISK 597 at mVol_Serial 0 000038DB 00000000 dd 0 ; Current volume serial number from Boot record 599 at mFileSys_Id 0 000038DF 4641543132202020 db "FAT12 " 0 000038E7 00 db 0 ; Current file system id from Boot record 602 iend 603 === Switch to base=002450h -> "BIOCODE" 604 usesection BIOCODE 605 606 ; 607 ; END OF SECTION FOR TWO HARD DISKS 608 609 PATHEND 004,BIO 212 <1> %IF PATHGEN 213 <1> %2%1E LABEL BYTE 214 <1> %ENDIF 610 611 ; PAGE 612 ;=== Push trace listing source: ms96tpi.nas 613 %include "ms96tpi.nas" ; NASM included file 1 <1> %warning out: MS96TPI.INC... 1 ****************** <1> warning: out: MS96TPI.INC... [-w+user] 2 <1> ;============================================================================== 3 <1> ;REVISION HISTORY: 4 <1> ;AN000 - New for DOS Version 4.00 - J.K. 5 <1> ;AC000 - Changed for DOS Version 4.00 - J.K. 6 <1> ;AN00x - PTM number for DOS Version 4.00 - J.K. 7 <1> ;============================================================================== 8 <1> ;AN001 - p2781 Changeline error behavior incompatibile with DOS 3.3 1/06/88 J.K. 9 <1> ;============================================================================== 10 <1> ; 11 <1> ; DISK OPEN/CLOSE ROUTINES ARR 2.41 12 <1> ; 13 <1> === Switch to base=002450h -> "BIOCODE" 14 <1> section BIOCODE 15 <1> 16 <1> extern ispatched 17 <1> extern DSK$UNKNOWN 18 <1> 19 <1> DSK$OPEN: ;ARR 2.41 20 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 21 <1> PUBLIC DSK$OPEN 0 00009A3B E8[0000] call ispatched 0 00009A3E 720B jc @F 24 <1> MESSAGE FTESTDISK,<"DISK OPEN "> 25 <1> MNUM FTESTDISK,AX 26 <1> MESSAGE FTESTDISK, 27 <1> ; AL IS LOGICAL DRIVE 0 00009A40 E8[0000] CALL SETDRIVE ;GET BDS FOR DRIVE 29 <1> assume ds:UPB 0 00009A43 7303E9[0000] jc DSK$UNKNOWN 0 00009A48 FF4520 INC WORD PTR [DI + OPCNT] 32 <1> @@: 0 00009A4B E9[0000] JMP EXIT ;ARR 2.41 34 <1> 35 <1> DSK$CLOSE: ;ARR 2.41 36 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 37 <1> PUBLIC DSK$CLOSE 0 00009A4E E8[0000] call ispatched 0 00009A51 7211 jc @F 40 <1> MESSAGE FTESTDISK,<"DISK CLOSE "> 41 <1> MNUM FTESTDISK,AX 42 <1> MESSAGE FTESTDISK, 43 <1> ; AL IS LOGICAL DRIVE 0 00009A53 E8[0000] CALL SETDRIVE ;GET BDS FOR DRIVE 45 <1> assume ds:UPB 0 00009A56 7303E9[0000] jc DSK$UNKNOWN 0 00009A5B 837D2000 CMP WORD PTR [DI + OPCNT],0 0 00009A5F 7403 JZ EXITJX ; WATCH OUT FOR WRAP ARR 2.41 0 00009A61 FF4D20 DEC WORD PTR [DI + OPCNT] 50 <1> EXITJX: 51 <1> @@: 0 00009A64 E9[0000] JMP EXIT 53 <1> 54 <1> ; INPUT : DS:DI POINTS TO CURRENT BDS FOR DRIVE. 55 <1> ; RETURN : ZERO SET IF NO OPEN FILES 56 <1> ; ZERO RESET IF OPEN FILES 57 <1> CHKOPCNT: 58 <1> assume ds:UPB, es:nothing, ss:nothing 59 <1> MESSAGE FTEST96,<"CHECK OPEN COUNT "> 60 <1> MNUM FTEST96,AX 61 <1> MESSAGE FTEST96, 0 00009A67 837D2000 CMP WORD PTR [DI + OPCNT],0 0 00009A6B C3 RET 64 <1> 65 <1> ; 66 <1> ; AT MEDIA CHECK TIME, WE NEED TO REALLY GET DOWN AND CHECK WHAT THE CHANGE IS. 67 <1> ; THIS IS GUARANTEED TO BE EXPENSIVE. 68 <1> ; 69 <1> PUBLIC MEDIACHECK 70 <1> MEDIACHECK: 71 <1> assume ds:UPB, es:nothing, ss:nothing 0 00009A6C E8[0000] CALL CHECKSINGLE ; MAKE SURE CORRECT DISK IS IN PLACE 0 00009A6F 31F6 XOR SI,SI 0 00009A71 E88B01 CALL HASCHANGE 0 00009A74 7432 JZ MEDIARET 0 00009A76 E87B01 CALL CHECKROMCHANGE 0 00009A79 752E JNZ MEDIADOVOLID 0 00009A7B 50 PUSH AX 0 00009A7C 52 PUSH DX 80 <1> ;SB33001**************************************************************** 81 <1> drivenum equ DRIVENUM ; NASM port equate 0 00009A7D 8A5504 mov DL, [DI + drivenum] ;SB ; set logical drive number ;3.30* 0 00009A80 B416 mov AH, 16h ;SB ; get changeline status ;3.30* 0 00009A82 CD13 int 13h ;SB ; call rom diskette routine ;3.30* 85 <1> ;SB33001**************************************************************** 0 00009A84 5A POP DX 0 00009A85 58 POP AX 0 00009A86 7221 JC MEDIADOVOLID 0 00009A88 BE0100 MOV SI,1 ; SIGNAL NO CHANGE 90 <1> ; THERE ARE SOME DRIVES WITH CHANGELINE THAT "LOSE" THE CHANGELINE INDICATION 91 <1> ; IF A DIFFERENT DRIVE IS ACCESSED AFTER THE CURRENT ONE. IN ORDER TO AVOID 92 <1> ; MISSING A MEDIA CHANGE, WE RETURN AN "I DON'T KNOW" TO DOS IF THE CHANGELINE 93 <1> ; IS NOT ACTIVE AND WE ARE ACCESSING A DIFFERENT DRIVE FROM THE LAST ONE. 94 <1> ; IF WE ARE ACCESSING THE SAME DRIVE, THEN WE CAN SAFELY RELY ON THE CHANGELINE 95 <1> ; STATUS. 96 <1> PUBLIC LOSECHNG 97 <1> LOSECHNG: 0 00009A8B 1E push ds 0 00009A8C E8[0000] call biocode_get_ds_dosbiodata 100 <1> assume ds:DOSGROUP 0 00009A8F 8A1E[0000] MOV BL,[TIM_DRV] ; GET LAST DRIVE ACCESSED 0 00009A93 1F pop ds 103 <1> assume ds:UPB 0 00009A94 385D04 CMP BYTE PTR [DI + DRIVENUM],BL 0 00009A97 740F JZ MEDIARET 106 <1> ; DO THE 2 SECOND TWIDDLE. IF TIME >= 2 SECONDS, DO A VOLID CHECK. 107 <1> ; OTHERWISE RETURN "I DON'T KNOW" (STRICTLY SPEAKING, WE SHOULD RETURN A 108 <1> ; "NOT CHANGED" HERE SINCE THE 2 SECOND TEST SAID NO CHANGE.) - RS. 0 00009A99 505152 SAVEREG 0 00009A9C E8[0000] CALL CHECK_TIME_OF_ACCESS 0 00009A9F 5A5958 RESTOREREG 0 00009AA2 09F6 OR SI,SI 0 00009AA4 7403 JZ MEDIADOVOLID ; CHECK_TIME SAYS ">= 2 SECS PASSED" 0 00009AA6 31F6 XOR SI,SI ; RETURN "I DON'T KNOW" 115 <1> PUBLIC MEDIARET 116 <1> MEDIARET: 0 00009AA8 C3 RET 118 <1> ; 119 <1> ; SOMEHOW THE MEDIA WAS CHANGED. LOOK AT VID TO SEE. WE DO NOT LOOK AT FAT 120 <1> ; BECAUSE THIS MAY BE DIFFERENT SINCE WE ONLY SET MEDBYT WHEN DOING A READ 121 <1> ; OR WRITE. 122 <1> ; 123 <1> MEDIADOVOLID: 0 00009AA9 E8[0000] CALL GETBP ; BUILD A NEW BPB IN CURRENT BDS 0 00009AAC 72FA JC MEDIARET 0 00009AAE E83400 CALL CHECK_VID 0 00009AB1 73F5 JNC MEDIARET 0 00009AB3 E8[0000] CALL MAPERROR ; FIX UP AL FOR RETURN TO DOS 0 00009AB6 C3 RET 130 <1> ; 131 <1> ; SIMPLE, QUICK CHECK OF LATCHED CHANGE. IF NO INDICATION, THEN RETURN 132 <1> ; OTHERWISE DO EXPENSIVE CHECK. IF THE EXPENSIVE TEST FAILS, POP OFF THE 133 <1> ; RETURN AND SET AL = 15 (FOR INVALID MEDIA CHANGE) WHICH WILL BE RETURNED TO 134 <1> ; DOS. 135 <1> ;J.K. 9/16/86 For DOS 3.3, this will work only for the drive that has 136 <1> ;J.K. 9/16/86 changeline. 137 <1> PUBLIC CHECKLATCHIO 138 <1> CHECKLATCHIO: 139 <1> assume ds:UPB, es:nothing, ss:nothing 140 <1> ; IF RETURNING FAKE BPB THEN ASSUME THE DISK HAS NOT CHANGED 141 <1> ; TEST WORD PTR [DS:DI].FLAGS, RETURN_FAKE_BPB 142 <1> ; JNZ CHECKRET 143 <1> ;J.K. 9/16/86 144 <1> ; call HasChange ;change line supported? 145 <1> ; jz CheckRet ;No. Just return 0 00009AB7 E8ADFF CALL CHKOPCNT 0 00009ABA 7501 JNZ CHECKROM 148 <1> CHECKRET: 0 00009ABC C3 RET 150 <1> ; 151 <1> ; CHECK FOR PAST ROM INDICATIONS. IF NO ROM CHANGE INDICATED, THEN RETURN OK. 152 <1> ; 153 <1> PUBLIC CHECKROM 154 <1> CHECKROM: 0 00009ABD E83401 CALL CHECKROMCHANGE 0 00009AC0 74FA JZ CHECKRET ; NO CHANGE 157 <1> ; 158 <1> ; WE NOW SEE THAT A CHANGE LINE HAS BEEN SEEN IN THE PAST. LET'S DO THE 159 <1> ; EXPENSIVE VERIFICATION. 160 <1> ; 161 <1> MESSAGE FTEST96,<"CHECKROMCHANGE SAYS YES...",CR,LF> 0 00009AC2 E8[0000] CALL GETBP ; BUILD BPB IN CURRENT BDS 0 00009AC5 720F JC RET_NO_ERROR_MAP ; GETBP HAS ALREADY CALLED MAPERROR 0 00009AC7 E81B00 CALL CHECK_VID 0 00009ACA 7207 JC CHECKLATCHRET ; DISK ERROR TRYING TO READ IN. 0 00009ACC 09F6 OR SI,SI ; IS CHANGED FOR SURE? 0 00009ACE 79EC JNS CHECKRET 0 00009AD0 E88D00 CALL RETURNVID 169 <1> CHECKLATCHRET: 0 00009AD3 E8[0000] CALL MAPERROR ; FIX UP AL FOR RETURN TO DOS 171 <1> RET_NO_ERROR_MAP: 0 00009AD6 F9 STC 0 00009AD7 5E POP SI ; POP OFF RETURN ADDRESS 0 00009AD8 C3 RET 175 <1> 176 <1> ; 177 <1> ; CHECK THE FAT AND THE VID. RETURN IN DI -1 OR 0. RETURN WITH CARRY SET 178 <1> ; ONLY IF THERE WAS A DISK ERROR. RETURN THAT ERROR CODE IN AX. 179 <1> ; 180 <1> PUBLIC CHECKFATVID 181 <1> CHECKFATVID: 182 <1> assume es:nothing 0 00009AD9 06 push es 0 00009ADA E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 185 <1> assume es:DOSENTRYGROUP 186 <1> 187 <1> MESSAGE FTEST96,<"CHECK FAT",CR,LF> 0 00009ADD E80F02 CALL FAT_CHECK 0 00009AE0 09F6 OR SI,SI 0 00009AE2 782E JS CHANGED_DRV 191 <1> ; 192 <1> ; THE FAT WAS THE SAME. HOW ABOUT THE VOLUME ID? 193 <1> ; 194 <1> 0 00009AE4 A8 db __TEST_IMM8 ; skip push 196 <1> CHECK_VID: 197 <1> assume nocheck, es:nothing 0 00009AE5 06 push es 0 00009AE6 E8[0000] call biocode_get_es_dosentry ; DISKSECTOR in DOSENTRY 200 <1> assume es:DOSENTRYGROUP 201 <1> 202 <1> ;J.K. Now with the extended BOOT record, the logic should be enhanced. 203 <1> ;If it is the extended BOOT record, then we check the volume serial 204 <1> ;number instead of volume id. If it is different, then set SI to -1. 205 <1> ;If it is same, then SI= 1 (No change). 206 <1> ;If it is not the extended BOOT record, then just follows the old 207 <1> ;logic. DOS 4.00 will check if the # of FAT in the boot record BPB 208 <1> ;is not 0. If it is 0 then it must be Non_FAT based system and 209 <1> ;should have already covered by extended boot structure checking. 210 <1> ;So, we will return "I don't know" by setting SI to 0. 211 <1> ;This routine assume the newest valid boot record is in [es:DISKSECTOR]. 212 <1> ;(This will be gauranteed by a successful GETBP call right before this 213 <1> ;routine.) 214 <1> MESSAGE FTEST96,<"CHECK VID",CR,LF> 215 <1> ;SB34MS96TPI001********************************************************* 216 <1> ;SB check the EXT_Boot_Sig variable for the Extended boot signature 217 <1> ;SB if it is set then go to do the extended ID check otherwise continue 218 <1> ;SB with code below 219 <1> ;SB 2 LOCS 220 <1> 221 <1> Ext_Boot_Signature equ EXT_BOOT_SIGNATURE ; NASM port equate 0 00009AE9 26803E[0000]29 cmp byte [es:Ext_Boot_Sig],Ext_Boot_Signature 223 <1> Do_Ext_Check_Id equ Do_Ext_Check_ID ; NASM port label 0 00009AEF 742C jz Do_Ext_Check_Id 225 <1> ;SB34MS96TPI001********************************************************* 0 00009AF1 E80B01 call HasChange ;AN000; 227 <1> CheckRet equ CHECKRET ; NASM port label 0 00009AF4 74C6 jz CheckRet ;AN000; 229 <1> 0 00009AF6 31F6 xor si,si ;AN000; assume I don't know. 231 <1> SECPERCLUSINSECTOR equ SecPerClusInSector ; NASM port label 0 00009AF8 26803E[0300]00 cmp byte ptr [es:SECPERCLUSINSECTOR + 3],0 ;AN000; Don't read vol id from 0 00009AFE 7410 je CHECKFATRET ;AN000; the directory if not FAT system 234 <1> READ_VOLUME_ID equ read_volume_id ; NASM port label 0 00009B00 E81D01 CALL READ_VOLUME_ID 0 00009B03 720B JC CHECKFATRET 237 <1> CHECK_VOLUME_ID equ check_volume_id ; NASM port label 0 00009B05 E8D001 CALL CHECK_VOLUME_ID 0 00009B08 09F6 OR SI,SI 0 00009B0A 7506 JNZ CHANGED_DRV 241 <1> MESSAGE FTEST96,<"VID NOT CHANGED",CR,LF> 242 <1> 243 <1> VID_NO_Changed: 0 00009B0C E8EB00 CALL RESETCHANGED 0 00009B0F F8 clc ;AN000; 246 <1> CHECKFATRET: 0 00009B10 07 pop es 248 <1> assume es:nothing 0 00009B11 C3 RET 250 <1> CHANGED_DRV: 0 00009B12 E8[0000] call biocode_get_es_dosbiodata 252 <1> assume es:DOSGROUP 0 00009B15 26C606[0000]FF MOV byte [es:TIM_DRV],-1 ; ENSURE THAT WE ASK ROM FOR MEDIA 0 00009B1B 07 pop es 255 <1> assume es:nothing 0 00009B1C C3 RET ; CHECK NEXT TIME ROUND 257 <1> ; 258 <1> ; extended ID check 259 <1> ; 260 <1> Do_Ext_Check_ID: ;AN000; 261 <1> assume es:DOSENTRYGROUP 0 00009B1D 50 push ax ;AN000; 263 <1> ;SB34MS96TPI002************************************************************** 264 <1> ;SB The code to check extended ID is basically a check to see if the 265 <1> ;Sb volume serial number is still the same. The volume serial number 266 <1> ;SB previously read is in [es:Boot_Serial_H] and [es:Boot_Serial_L] 267 <1> ;SB high and low words respectively. DS:DI points to the BDS of the 268 <1> ;SB drive under consideration. The BDS has fields containing the 269 <1> ;SB high and low words of the volume serial number of the media in the 270 <1> ;SB drive. Compare these fields to the fields mentioned above. If these 271 <1> ;SB fields do not match the media has changed and so we should jump 272 <1> ;SB to the code starting at Ext_Changed else return "I don't know" status 273 <1> ;SB in the register used for the changeline status and continue executing 274 <1> ;SB the code given below. For temporary storage use the register which 275 <1> ;SB has been saved and restored around this block. 276 <1> ;SB 7 LOCS 277 <1> ;SB BDS fields in inc\msbds.inc 278 <1> 0 00009B1E 26A1[0000] mov ax,[es:Boot_Serial_L] 0 00009B22 3B4557 cmp ax,word ptr [di+VOL_SERIAL] 0 00009B25 750E jnz Ext_Changed 0 00009B27 26A1[0000] mov ax,[es:Boot_Serial_H] 0 00009B2B 3B4559 cmp ax,word ptr [di+VOL_SERIAL+2] 0 00009B2E 7505 jnz Ext_Changed 0 00009B30 31F6 xor si,si ; don't know 286 <1> 287 <1> ;SB34MS96TPI002************************************************************** 0 00009B32 58 pop ax ;AN000; 289 <1> ; jmp CheckFatRet ;AN000; 0 00009B33 EBD7 jmp VID_NO_Changed ;AN001;Reset the flag 291 <1> Ext_Changed: ;AN000; Serial number is different! 0 00009B35 58 pop ax ;AN000; 0 00009B36 BEFFFF mov si, -1 ;AN000; disk changed! 0 00009B39 F8 clc ;AN000; clear carry. Only SI is meaningful here. 295 <1> Changed_Drv equ CHANGED_DRV ; NASM port label 0 00009B3A EBD6 jmp Changed_Drv ;AN000; 297 <1> 298 <1> ; 299 <1> ; AT I/O TIME, WE DETECTED THE ERROR. NOW WE NEED TO DETERMINE WHETHER THE 300 <1> ; MEDIA WAS TRULY CHANGED OR NOT. WE RETURN NORMALLY IF MEDIA CHANGE UNKNOWN. 301 <1> ; AND WE POP OFF THE CALL AND JMP TO HARDERR IF WE SEE AN ERROR. 302 <1> ; 303 <1> PUBLIC CHECKIO 304 <1> CHECKIO: 0 00009B3C 80FC06 CMP AH,06 0 00009B3F 7514 JNZ @F 0 00009B41 E823FF CALL CHKOPCNT 0 00009B44 740F JZ @F ; NO OPEN FILES 309 <1> ; IF RETURNING FAKE BPB THEN IGNORE DISK CHANGES 310 <1> ; TEST WORD PTR [DS:DI].FLAGS, RETURN_FAKE_BPB 311 <1> ; JNZ IGNORECHANGE 0 00009B46 E8[0000] CALL GETBP ; BUILD UP A NEW BPB IN CURRENT BDS 0 00009B49 7212 JC NO_ERROR_MAP ; GETBP HAS ALREADY CALLED MAPERROR 0 00009B4B E88BFF CALL CHECKFATVID 0 00009B4E 7209 JC CHECKIORET ; DISK ERROR TRYING TO READ IN. 0 00009B50 09F6 OR SI,SI ; IS CHANGED FOR SURE? 0 00009B52 7802 JS CHECKIOERR ; YES CHANGED 318 <1> IGNORECHANGE: 0 00009B54 45 INC BP ; ALLOW A RETRY 320 <1> @@: 0 00009B55 C3 RET 322 <1> CHECKIOERR: 0 00009B56 E80700 CALL RETURNVID 324 <1> CHECKIORET: 325 <1> ; POP SI ; POP OFF RETURN 0 00009B59 F9 STC ; MAKE SURE CARRY GETS PASSED THROUGH 0 00009B5A E9[0000] JMP HARDERR 328 <1> 329 <1> NO_ERROR_MAP: 0 00009B5D E9[0000] JMP HARDERR2 331 <1> ; 332 <1> ; RETURN VID SETS UP THE VID FOR A RETURN TO DOS. 333 <1> ; 334 <1> PUBLIC RETURNVID 335 <1> RETURNVID: 336 <1> assume ds:UPB, es:nothing, ss:nothing 337 <1> MESSAGE FTEST96,<"RETURN VID",CR,LF> 0 00009B60 1E PUSH DS ; SAVE POINTER TO CURRENT BDS 0 00009B61 57 PUSH DI 0 00009B62 51 PUSH CX 341 <1> INIT_VID_LOOP equ init_vid_loop ; NASM port label 0 00009B63 E89E01 CALL INIT_VID_LOOP ; SETS ES:DI -> VID 0 00009B66 E8[0000] call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 344 <1> assume ds:DOSENTRYGROUP 0 00009B69 C51E[0000] lds bx, [PTRSAV] 346 <1> assume ds:nothing 0 00009B6D 897F16 MOV [BX + EXTRA],DI 0 00009B70 8C4718 MOV [BX + EXTRA+2],ES 0 00009B73 59 POP CX 0 00009B74 5F POP DI ; RESTORE CURRENT BDS 0 00009B75 1F POP DS 352 <1> assume ds:UPB 0 00009B76 B406 MOV AH,6 ; INVALID MEDIA CHANGE 0 00009B78 F9 STC 0 00009B79 C3 RET 356 <1> 357 <1> ; 358 <1> ; MUNGE THE TIME OF LAST SUCCESSFUL ACCESS FOR TWEEKED DRIVES 359 <1> ; 360 <1> ; DON'T NEED ANY MORE 361 <1> ; TWEEKCHECK: 362 <1> ; PUSH AX 363 <1> ; MOV AX,WORD PTR [DS:DI].FLAGS 364 <1> ; TEST AL,FCHANGED_BY_FORMAT 365 <1> ; JZ TWEEKDONE 366 <1> ; MOV [CS:TIM_DRV],-1 367 <1> ; TWEEKDONE: 368 <1> ; POP AX 369 <1> ; RET 370 <1> 371 <1> ; 372 <1> ; DRIVE IS THE LOGICAL DRIVE TO USE 373 <1> ; 374 <1> ; FORMAT_MEDIA_CHECK: ;ARR 2.42 375 <1> ; PUSH AX 376 <1> ; MOV AX,WORD PTR [DS:DI].FLAGS 377 <1> ; TEST AL,FCHANGED_BY_FORMAT 378 <1> ; JZ RETF1 ; MEDIA NOT CHANGED VIA FORMAT 379 <1> ; AND AL,NOT FCHANGED_BY_FORMAT 380 <1> ; MOV WORD PTR [DI].FLAGS,AX ; RESET CHANGED_BY_FORMAT BIT 381 <1> ; MOV SI,-1 ; MEDIA CHANGED VIA FORMAT 382 <1> ; RETF1: 383 <1> ; POP AX 384 <1> ; RET 385 <1> 386 <1> ; 387 <1> ; MOVES THE POINTER TO THE VOLID FOR THE DRIVE INTO THE ORIGINAL REQUEST PACKET 388 <1> ; ON ENTRY, DS:BX POINTS TO THE ORIGINAL PACKET. 389 <1> ; NO ATTEMPT IS MADE TO PRESERVE REGISTERS. 390 <1> ; 391 <1> MEDIA_SET_VID: ; ARR 2.42 392 <1> assume ds:UPB, es:nothing, ss:nothing 393 <1> PUBLIC MEDIA_SET_VID 394 <1> 0 00009B7A E88701 CALL INIT_VID_LOOP ; SETS ES:DI -> VID 0 00009B7D E8[0000] call biocode_get_ds_dosentry ; PTRSAV in DOSENTRY 397 <1> assume ds:DOSENTRYGROUP 0 00009B80 C51E[0000] lds bx, [PTRSAV] ; GET POINTER TO PACKET 399 <1> assume ds:nothing 0 00009B84 897F0F MOV WORD PTR [BX + TRANS+1],DI 0 00009B87 8C4711 MOV WORD PTR [BX + TRANS+3],ES 0 00009B8A C3 RET 403 <1> 404 <1> 405 <1> ; 406 <1> ; HIDENSITY - EXAMINE A DRIVE/MEDIA DESCRIPTOR TO SET THE MEDIA TYPE. IF 407 <1> ; THE MEDIA DESCRIPTOR IS NOT F9 (NOT 96TPI OR 3 1/2), WE RETURN AND LET THE 408 <1> ; CALLER DO THE REST. OTHERWISE, WE POP OFF THE RETURN AND JUMP TO THE TAIL 409 <1> ; OF GETBP. FOR 3.5" MEDIA, WE JUST RETURN. 410 <1> ; 411 <1> ; INPUTS: DS:DI POINT TO CORRECT BDS FOR THIS DRIVE 412 <1> ; AH HAS MEDIA BYTE 413 <1> ; 414 <1> ; OUTPUTS: CARRY CLEAR 415 <1> ; NO REGISTERS MODIFIED 416 <1> ; CARRY SET 417 <1> ; AL = SECTORS/FAT 418 <1> ; BH = NUMBER OF ROOT DIRECTORY ENTRIES 419 <1> ; BL = SECTORS PER TRACK 420 <1> ; CX = NUMBER OF SECTORS 421 <1> ; DH = SECTORS PER ALLOCATION UNIT 422 <1> ; DL = NUMBER OF HEADS 423 <1> ; 424 <1> HIDENSITY: 425 <1> assume ds:UPB, es:nothing, ss:nothing 426 <1> PUBLIC HIDENSITY 427 <1> ; 428 <1> ; CHECK FOR CORRECT DRIVE 429 <1> ; 0 00009B8B F745230200 TEST WORD PTR [DI + FLAGS],FCHANGELINE ; IS IT SPECIAL? 0 00009B90 741C JZ DOFLOPPY ; NO, DO NORMAL FLOPPY TEST 432 <1> ; 433 <1> ; WE HAVE A MEDIA BYTE THAT IS PRETTY COMPLEX. EXAMINE DRIVE INFORMATION 434 <1> ; TABLE TO SEE WHAT KIND IT IS. 435 <1> ; 0 00009B92 807D2202 CMP BYTE PTR [DI + FORMFACTOR],FFSMALL; IS IT SINGLE-MEDIA? 0 00009B96 7416 JZ DOFLOPPY ; YES, USE FATID... 438 <1> ; 439 <1> ; 96 TPI DRIVE 440 <1> ; 0 00009B98 80FCF9 CMP AH,0F9H 0 00009B9B 7511 JNZ DOFLOPPY 0 00009B9D B007 MOV AL,7 ; SEVEN SECTORS / FAT 0 00009B9F BB0FE0 MOV BX,224*256+0FH ; 224 ROOT DIR ENTRIES & 0F SECTOR MAX 0 00009BA2 B96009 MOV CX,80*15*2 ; 80 TRACKS, 15 SECTORS/TRACK, 2 SIDES 0 00009BA5 BA0201 MOV DX,01*256+2 ; SECTORS/ALLOCATION UNIT & HEAD MAX 447 <1> POPR: 0 00009BA8 83C402 ADD SP,2 ; POP OFF RETURN ADDRESS 0 00009BAB E9[0000] JMP HAS1 ; RETURN TO TAIL OF GETBP 450 <1> 451 <1> DOFLOPPY: 0 00009BAE C3 RET 453 <1> 454 <1> PATHSTART 001,TPI96 205 <2> %IF PATHGEN 206 <2> PUBLIC %2%1S,%2%1E 207 <2> %2%1S LABEL BYTE 208 <2> %ENDIF 455 <1> 456 <1> ; 457 <1> ; CERTAIN BOGUS PROGRAMS AVOID DOS ALTOGETHER AND USE INT 13 DIRECTLY. THESE 458 <1> ; PROGRAMS EVEN RETRY OPERATIONS AND, THUS, WILL IGNORE THE DISK CHANGE LOGIC. 459 <1> ; 460 <1> ; WE HOOK INT 13 AND NOTE ALL ERRORS. 461 <1> ; 462 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING === Switch to base=000000h -> "DOSENTRY" 463 <1> section DOSENTRY ; in DOSENTRY 464 <1> 465 <1> extern transfer_real13 466 <1> 467 <1> PATHEND 001,TPI96 212 <2> %IF PATHGEN 213 <2> %2%1E LABEL BYTE 214 <2> %ENDIF 468 <1> === Switch to base=002450h -> "BIOCODE" 469 <1> section BIOCODE 470 <1> 471 <1> relocated ms96tpi_i13 472 <1> PUBLIC INT13 473 <1> INT13 PROC FAR 474 <1> assume ds:nothing, es:nothing, ss:nothing 475 <1> MESSAGE FTEST13,<"*"> 0 00009BAF 9C pushf 0 00009BB0 9A[0000][0000] call DOSENTRY:transfer_real13 0 00009BB5 7307 jnc transfer_Leave13 479 <1> 480 <1> ERR13: 481 <1> MESSAGE FTEST13,<"INT 13 ERROR "> 482 <1> MNUM FTEST13,AX 483 <1> MESSAGE FTEST13, 0 00009BB7 9C PUSHF ; SAVE STATE 0 00009BB8 80FC06 CMP AH,06H ; DID I SEE A CHANGE EVENT? 0 00009BBB 7404 JZ .GOTERR ; YES 0 00009BBD 9D @@: POPF ; NO, SOME OTHER ERROR, IGNORE IT 488 <1> transfer_Leave13: equ $ 0 00009BBE E9[0000] jmp Leave13 490 <1> 491 <1> .GOTERR: 0 00009BC1 84D2 test DL,DL ; IS THIS FOR THE HARD DISK? 0 00009BC3 78F8 JS @B ; YES, IGNORE 0 00009BC5 53 push bx 0 00009BC6 BB4000 MOV bx, FCHANGED 0 00009BC9 E80300 CALL SET_CHANGED_DL 0 00009BCC 5B pop bx 0 00009BCD EBEE JMP @B 499 <1> INT13 ENDP 500 <1> 501 <1> extern Leave13 502 <1> 503 <1> ; 504 <1> ; SET_CHANGED_DL - SETS FLAG BITS ACCORDING TO BITS SET IN [FLAGBITS]. 505 <1> ; ESSENTIALLY USED TO INDICATE CHANGELINE, OR FORMAT. 506 <1> ; 507 <1> ; INPUTS: DL CONTAINS PHYSICAL DRIVE NUMBER 508 <1> ; bx CONTAINS BITS TO SET IN THE FLAG FIELD IN THE BDSS 509 <1> ; OUTPUTS: NONE 510 <1> ; REGISTERS MODIFIED: FLAGS, bx 511 <1> ; 512 <1> SET_CHANGED_DL: 513 <1> assume ds:nothing, es:nothing, ss:nothing 514 <1> PUBLIC SET_CHANGED_DL 515 <1> 516 <1> MESSAGE FTEST96,<"SET CHANGED",CR,LF> 0 00009BCF 52 PUSH DX 0 00009BD0 87DA xchg bx, dx ; bl = int 13h unit, dx = mask 519 <1> ALL_SET: 0 00009BD2 30FF XOR BH,BH 521 <1> ; 522 <1> ; IN THE VIRTUAL DRIVE SYSTEM WE *MUST* FLAG THE OTHER DRIVES AS BEING CHANGED 523 <1> ; 524 <1> ; ASSUME FIRST BDS IS IN THIS SEGMENT 0 00009BD4 50 PUSH AX 0 00009BD5 1E PUSH DS ; SAVE CURRENT BDS 0 00009BD6 57 PUSH DI 0 00009BD7 E8[0000] call biocode_get_ds_dosbiodata 529 <1> assume ds:DOSGROUP 0 00009BDA C53E[0000] lds di, [START_BDS] 531 <1> assume ds:UPB 532 <1> SCAN_BDS: 0 00009BDE 83FFFF CMP DI,-1 0 00009BE1 740C je SKIPSET 0 00009BE3 385D04 CMP BYTE PTR [DI + DRIVENUM],BL 0 00009BE6 7503 JNZ GET_NEXT_BDS 537 <1> ; 538 <1> ; SOMEONE MAY COMPLAIN, BUT THIS *ALWAYS* MUST BE DONE WHEN A DISK CHANGE IS 539 <1> ; NOTED. THERE ARE *NO* OTHER COMPROMISING CIRCUMSTANCES. 540 <1> ; 541 <1> SETCHANGED: 0 00009BE8 095523 OR WORD PTR [DI + FLAGS],DX ; SIGNAL CHANGE ON OTHER DRIVE 543 <1> GET_NEXT_BDS: 0 00009BEB C53D lds di, [di + LINK] 0 00009BED EBEF JMP SHORT SCAN_BDS 546 <1> SKIPSET: 0 00009BEF 5F POP DI ; RESTORE CURRENT BDS 0 00009BF0 1F POP DS 549 <1> assume ds:nothing 0 00009BF1 58 POP AX 0 00009BF2 5A POP DX 0 00009BF3 C3 RET 553 <1> 554 <1> ; 555 <1> ; CHECKROMCHANGE - SEE IF EXTERNAL PROGRAM HAS DIDDLED ROM CHANGE LINE. 556 <1> ; 557 <1> ; INPUTS: DS:DI POINTS TO CURRENT BDS. 558 <1> ; OUTPUTS: ZERO SET - NO CHANGE 559 <1> ; ZERO RESET - CHANGE 560 <1> ; REGISTERS MODIFIED: NONE 561 <1> 562 <1> CHECKROMCHANGE: 563 <1> assume ds:UPB, es:nothing, ss:nothing 564 <1> MESSAGE FTEST13,<"CHECKROM "> 565 <1> MNUM FTEST13 566 <1> MESSAGE FTEST13, 0 00009BF4 F745234000 TEST WORD PTR [DI + FLAGS],FCHANGED 0 00009BF9 C3 RET 569 <1> 570 <1> ; 571 <1> ; RESETCHANGED - RESTORE VALUE OF CHANGE LINE 572 <1> ; 573 <1> ; INPUTS: DS:DI POINTS TO CURRENT BDS 574 <1> ; OUTPUTS: NONE 575 <1> ; REGISTERS MODIFIED: NONE 576 <1> 577 <1> public ResetChanged 578 <1> RESETCHANGED: 579 <1> assume ds:UPB, es:nothing, ss:nothing 580 <1> MESSAGE FTEST13,<"RESETCHANGED "> 581 <1> MNUM FTEST13 582 <1> MESSAGE FTEST13, 0 00009BFA 836523BF AND WORD PTR [DI + FLAGS],~ FCHANGED 0 00009BFE C3 RET 585 <1> 586 <1> ; 587 <1> ; HASCHANGE - SEE IF DRIVE CAN SUPPLY CHANGE LINE 588 <1> ; 589 <1> ; INPUTS: DS:DI POINTS TO CURRENT BDS 590 <1> ; OUTPUTS: ZERO SET - NO CHANGE LINE AVAILABLE 591 <1> ; ZERO RESET - CHANGE LINE AVAILABLE 592 <1> ; REGISTERS MODIFIED: NONE 593 <1> 594 <1> PUBLIC HASCHANGE 595 <1> HASCHANGE: 596 <1> assume ds:UPB, es:nothing, ss:nothing 597 <1> MESSAGE FTEST13,<"HASCHANGE "> 598 <1> MNUM FTEST13 599 <1> MESSAGE FTEST13, 0 00009BFF F745230200 TEST WORD PTR [DI + FLAGS],FCHANGELINE 0 00009C04 C3 RET 602 <1> 603 <1> ;=== Push trace listing source: msvolid.nas 604 <1> %include "msvolid.nas" ; NASM included file 1 <2> ;------------------------------------------------------------------------- 2 <2> ; 3 <2> ; File: msvolid.asm 4 <2> ; This file contains the volume_id subroutines and data structures. 5 <2> ; 6 <2> ; Routines in this file are: 7 <2> ; Set_Volume_ID - main routine, calls other routines. 8 <2> ; read_volume_id - read the volume ID and tells if it has 9 <2> ; been changed. 10 <2> ; Transfer_volume_id - copy the volume ID from TMP to special 11 <2> ; drive. 12 <2> ; Check_Volume_ID - compare volume ID in TMP area with one 13 <2> ; expected for drive. 14 <2> ; Fat_Check - see of the fatID has changed in the 15 <2> ; specified drive. 16 <2> ; Init_Vid_loop - set up for VID scan or move 17 <2> ; 18 <2> ; 19 <2> ;------------------------------------------------------------------------- 20 <2> === Switch to base=000E10h -> "DOSBIODATA" 21 <2> usesection DOSBIODATA 22 <2> 23 <2> ; 24 <2> ; length of the volume id 25 <2> ; 26 <2> 27 <2> vid_size equ 12 28 <2> 29 <2> PATHSTART 001,VOLID ;3.30 205 <3> %IF PATHGEN 206 <3> PUBLIC %2%1S,%2%1E 207 <3> %2%1S LABEL BYTE 208 <3> %ENDIF 30 <2> 31 <2> ; 32 <2> ; null volume id 33 <2> ; 34 <2> 0 0000155F 4E4F204E414D452020 nul_vid db "NO NAME ",0 0 00001568 202000 36 <2> 37 <2> ; 38 <2> ; data scratch area used to hold volume ids 39 <2> ; 40 <2> 0 0000156B 4E4F204E414D452020 tmp_vid db "NO NAME ",0 0 00001574 202000 42 <2> 43 <2> PATHEND 001,VOLID ;3.30 212 <3> %IF PATHGEN 213 <3> %2%1E LABEL BYTE 214 <3> %ENDIF 44 <2> 45 <2> ; 46 <2> ; Set_Volume_ID 47 <2> ; If drive has changeline support, read in and set the volume_ID 48 <2> ; and the last FAT_ID byte. If no change line support then do nothing. 49 <2> ; 50 <2> ; On entry: 51 <2> ; DS:DI points to the BDS for this disk. 52 <2> ; AH contains media byte 53 <2> ; 54 <2> ; On Exit: 55 <2> ; Carry clear: 56 <2> ; Successful call 57 <2> ; Carry set 58 <2> ; Error and AX has error code 59 <2> ; 60 <2> === Switch to base=002450h -> "BIOCODE" 61 <2> section BIOCODE 62 <2> 63 <2> Set_Volume_ID: 64 <2> assume ds:UPB, es:nothing, ss:nothing 65 <2> SET_VOLUME_ID equ Set_Volume_ID ; NASM port label 66 <2> PUBLIC SET_VOLUME_ID ;3.30 0 00009C05 52 push dx ; save registers 0 00009C06 50 push ax 69 <2> HasChange equ HASCHANGE ; NASM port label 0 00009C07 E8F5FF CALL HasChange ; does drive have changeline support? 0 00009C0A 740D jz setvret ; no, get out 0 00009C0C 57 push di 73 <2> read_volume_ID equ read_volume_id ; NASM port label 0 00009C0D E81000 call read_volume_ID ; read the volume ID 0 00009C10 5F pop di 0 00009C11 720A jc SetErr ; if error go to error routine 0 00009C13 E8B100 call transfer_volume_ID ; copy the volume id to special drive 78 <2> ResetChanged equ RESETCHANGED ; NASM port label 0 00009C16 E8E1FF call ResetChanged ; restore value of change line 80 <2> 81 <2> setvret: ; SET Volume RETurn 0 00009C19 F8 clc ; no error, clear carry flag 0 00009C1A 58 pop ax ; restore registers 0 00009C1B 5A pop dx 0 00009C1C C3 ret 86 <2> SetErr: 0 00009C1D 5A pop dx ; pop stack but don't overwrite AX 0 00009C1E 5A pop dx ; restore DX 0 00009C1F C3 ret 90 <2> 91 <2> === Switch to base=000E10h -> "DOSBIODATA" 92 <2> usesection DOSBIODATA 93 <2> 0 00001577 ???? root_sec DW ? ;Root sector # 95 <2> 96 <2> === Switch to base=002450h -> "BIOCODE" 97 <2> section BIOCODE 98 <2> 99 <2> ; 100 <2> ; read_volume_id read the volume ID and tells if it has been changed. 101 <2> ; 102 <2> ; On entry: 103 <2> ; DS:DI points to current BDS for drive. 104 <2> ; On Exit: 105 <2> ; Carry Clear 106 <2> ; SI = 1 No change 107 <2> ; SI = 0 ? 108 <2> ; SI = -1 Change 109 <2> ; 110 <2> ; Carry Set: 111 <2> ; Error and AX has error code. 112 <2> ; 113 <2> 114 <2> read_volume_id: 115 <2> assume ds:UPB, es:nothing, ss:nothing 0 00009C20 06 push ES ; preserve registers 0 00009C21 52 push DX 0 00009C22 51 push CX 0 00009C23 53 push BX 0 00009C24 50 push AX 0 00009C25 1E push DS ; Preserve Current BDS 0 00009C26 57 push DI 0 00009C27 E8[0000] call biocode_get_es_dosbiodata 124 <2> assume es:DOSGROUP 0 00009C2A 06 push es 0 00009C2B 1F pop ds 127 <2> assume ds:DOSGROUP 0 00009C2C BF[2B00] mov di,offset tmp_vid ; access with es 0 00009C2F BE[1F00] mov si,offset nul_vid ; access with ds 0 00009C32 B90C00 mov cx,vid_size 0 00009C35 F3A4 rep movsb ; initialize tmp_vid to null vi_id 132 <2> 0 00009C37 5F pop DI ; Restore Current BDS 0 00009C38 1F pop DS 135 <2> assume ds:UPB 136 <2> cFAT equ CFAT ; NASM port equate 0 00009C39 8A450B mov al,byte ptr [di + cFAT] ; # of fats 138 <2> csecfat equ CSECFAT ; NASM port equate 0 00009C3C 8B4D11 mov cx,word ptr [di + csecfat] ; sectors / fat 0 00009C3F F6E1 mul cl ; size taken by fats 141 <2> ressec equ RESSEC ; NASM port equate 0 00009C41 034509 add ax,word ptr [di + ressec] ; add on reserved sectors 143 <2> ; AX is now sector # (0 based) 0 00009C44 26A3[3700] mov [es:root_sec],ax ; set initial value 145 <2> cDir equ CDIR ; NASM port equate 0 00009C48 8B450C mov ax,[di + cDir] ; # root dir entries 0 00009C4B B104 mov cl,4 ; 16 entries/sector 0 00009C4D D3E8 shr ax,cl ; divide by 16 0 00009C4F 89C1 mov cx,ax ; cx is # of sectors to scan 150 <2> next_sec: 0 00009C51 51 push cx ; save outer loop counter 0 00009C52 26A1[3700] mov ax,[es:root_sec] ; get sector # 153 <2> seclim equ SECLIM ; NASM port equate 0 00009C56 8B4D13 mov cx,word ptr [di + seclim] ; sectors / track 0 00009C59 31D2 xor DX,DX 0 00009C5B F7F1 div cx 157 <2> ; set up registers for call to read_sector 0 00009C5D 42 inc DX ; dx= sectors into track, ax= track count from 0 0 00009C5E 88D1 mov cl,dl ; sector to read 0 00009C60 31D2 xor DX,DX 161 <2> hdlim equ HDLIM ; NASM port equate 0 00009C62 F77515 div word ptr [di + hdlim] ; # heads on this disc 0 00009C65 88D6 mov dh,dl ; Head number 0 00009C67 88C5 mov ch,al ; Track # 165 <2> read_sector equ READ_SECTOR ; NASM port label 0 00009C69 E8[0000] call read_sector ; get first sector of the root directory, 167 <2> assume es:DOSENTRYGROUP ; ES:BX -> BOOT 168 <2> ; read_sector resets es => DOSENTRY 0 00009C6C 7255 jc ReadVIDErr ; error on read 0 00009C6E B91000 mov cx,16 ; # of dir entries in a block of root 0 00009C71 B008 mov al,08h ; volume label bit 172 <2> fvid_loop: 0 00009C73 26803F00 cmp byte ptr [es:bx],0 ; End of dir? 0 00009C77 7447 jz no_vid ; yes, no vol id 0 00009C79 26803FE5 cmp byte ptr [es:bx],0E5h ; empty entry? 0 00009C7D 740D jz ent_loop ; yes, skip 0 00009C7F 26F6470BD7 test byte [es:bx + 11], ~ 28h ; any bit other than label or archive ? 0 00009C84 7506 jnz ent_loop ; yes, may be an LFN, skip it --> 0 00009C86 2684470B test [es:bx+11],al ; is volume label bit set in fcb? 0 00009C8A 7514 jnz found_vid ; jmp yes 181 <2> ent_loop: 0 00009C8C 83C320 ADD BX,32 ;MJB003 ADD LENGTH OF DIRECTORY ENTRY ;3.30 0 00009C8F E2E2 loop fvid_loop 0 00009C91 59 pop cx ; outer loop 0 00009C92 E8[0000] call biocode_get_es_dosbiodata 186 <2> assume es:DOSGROUP 0 00009C95 26FF06[3700] inc word [es:root_sec] ; next sector 0 00009C9A E2B5 loop next_sec ; continue 189 <2> vid_NotFound: 0 00009C9C 31F6 XOR SI,SI 0 00009C9E EB19 jmp short fvid_ret 192 <2> 193 <2> found_vid: 194 <2> assume es:DOSENTRYGROUP 0 00009CA0 59 pop cx ; clean stack of outer loop counter 0 00009CA1 89DE mov si,bx ; point to volume_id 0 00009CA3 1E push ds ; preserve currnet BDS 0 00009CA4 57 push di 0 00009CA5 06 push es ; es:si points to volume id. 0 00009CA6 1F pop ds ; source segment 201 <2> assume ds:DOSENTRYGROUP 0 00009CA7 E8[0000] call biocode_get_es_dosbiodata 203 <2> assume es:DOSGROUP 0 00009CAA BF[2B00] mov di,offset tmp_vid ; dest of volume_id ; access with es 0 00009CAD B90B00 mov cx,vid_size -1 ; length of string minus NUL 0 00009CB0 F3A4 rep movsb ; mov volume label to tmp_vid 0 00009CB2 30C0 xor al,al 0 00009CB4 AA stosb ; Null terminate 0 00009CB5 31F6 XOR SI,SI 0 00009CB7 5F pop DI ; restore current BDS 0 00009CB8 1F pop DS 212 <2> assume ds:UPB 213 <2> fvid_ret: 0 00009CB9 58 pop ax 0 00009CBA F8 clc 216 <2> RVIDRet: 0 00009CBB 5B pop BX ; restore register 0 00009CBC 59 pop CX 0 00009CBD 5A pop DX 0 00009CBE 07 pop ES 221 <2> assume es:nothing 0 00009CBF C3 ret 223 <2> no_vid: 0 00009CC0 59 pop cx ; clean stack of outer loop counter 0 00009CC1 EBD9 jmp vid_NotFound ; not found 226 <2> ReadVIDErr: 0 00009CC3 5E pop SI 0 00009CC4 5E pop SI 0 00009CC5 EBF4 jmp RVIDRet 230 <2> 231 <2> 232 <2> 233 <2> ; 234 <2> ; Transfer_volume_id - copy the volume ID from TMP to special drive 235 <2> ; 236 <2> ; Inputs: DS:DI nas current BDS 237 <2> ; Outputs: BDS for drive has volume ID from TMP 238 <2> ; 239 <2> 240 <2> transfer_volume_ID: 241 <2> assume ds:UPB, es:nothing, ss:nothing 0 00009CC7 1E push DS ; preserve current BDS 0 00009CC8 57 push DI 0 00009CC9 06 push ES 0 00009CCA 56 push SI 0 00009CCB 51 push CX 0 00009CCC E83500 call init_vid_loop 0 00009CCF FC cld 0 00009CD0 F3A4 rep MOVSB ; transfer 0 00009CD2 59 pop CX 0 00009CD3 5E pop SI 0 00009CD4 07 pop ES 253 <2> assume es:nothing 0 00009CD5 5F pop DI ; restore current BDS 0 00009CD6 1F pop DS 256 <2> assume ds:UPB 0 00009CD7 C3 ret 258 <2> 259 <2> 260 <2> ; 261 <2> ; Check_Volume_ID - compare volume ID in TMP area with one expected for 262 <2> ; drive 263 <2> ; 264 <2> ; Inputs: DS:DI has current BDS for drive 265 <2> ; Outputs: SI = 0 if compare succeeds 266 <2> ; SI = -1 if compare fails. 267 <2> 268 <2> check_volume_id: 269 <2> assume ds:UPB, es:nothing, ss:nothing 0 00009CD8 1E push DS ; preserve current BDS for drive 0 00009CD9 57 push DI 0 00009CDA 06 push ES 0 00009CDB 51 push CX 0 00009CDC E82500 call init_vid_loop 0 00009CDF FC cld 0 00009CE0 F3A6 repz cmpsb ; are the 2 volume_ids the same? 0 00009CE2 BE0000 mov si,0 ; assume unknown 0 00009CE5 7403 jz check_vid_ret ; carry clear if jump taken 0 00009CE7 BEFFFF mov si,-1 ; failure 280 <2> check_vid_ret: 0 00009CEA 59 pop CX 0 00009CEB 07 pop ES 283 <2> assume es:nothing 0 00009CEC 5F pop DI ; restore current BDS 0 00009CED 1F pop DS 286 <2> assume ds:UPB 0 00009CEE C3 ret 288 <2> 289 <2> ; 290 <2> ; Fat_Check - see of the fatID has changed in the specified drive. 291 <2> ; - uses the FAT ID obtained from the boot sector. 292 <2> ; 293 <2> ; Inputs: MedByt is expected FAT ID 294 <2> ; DS:DI points to current BDS 295 <2> ; Output: Carry Clear 296 <2> ; SI = -1 if fat ID different, 297 <2> ; SI = 0 otherwise 298 <2> ; No other registers changed. 299 <2> 300 <2> FAT_CHECK: 301 <2> assume ds:UPB, es:nothing, ss:nothing 0 00009CEF 50 push AX 0 00009CF0 31F6 xor SI, SI ; say FAT ID's are same. 0 00009CF2 06 push es 0 00009CF3 E8[0000] call biocode_get_es_dosbiodata 306 <2> assume es:DOSGROUP 307 <2> MedByt equ MEDBYT ; NASM port label 0 00009CF6 26A0[0000] mov AL, [es:MedByt] 309 <2> Mediad equ MEDIAD ; NASM port equate 0 00009CFA 3A4510 cmp AL, byte ptr [DI + Mediad] ; compare it with the BDS medbyte 311 <2> OKRET1 equ OkRet1 ; NASM port label 0 00009CFD 7401 jz OKRET1 ; carry clear 0 00009CFF 4E dec SI 0 00009D00 F8 OkRet1: clc 0 00009D01 07 pop es 316 <2> assume es:nothing 0 00009D02 58 pop AX 0 00009D03 C3 ret 319 <2> 320 <2> 321 <2> ; 322 <2> ; Init_Vid_loop - set up for VID scan or move 323 <2> ; 324 <2> ; Inputs: DS:DI pionts to BDS for the drive 325 <2> ; Outputs: DS:SI points to tmp_vid 326 <2> ; ES:DI points to vid for drive 327 <2> ; CX has size for VID compare 328 <2> ; 329 <2> 330 <2> init_vid_loop: 331 <2> assume ds:UPB, es:nothing, ss:nothing 0 00009D04 50 push ax 0 00009D05 1E push ds 0 00009D06 07 pop es 335 <2> assume es:UPB 0 00009D07 E8[0000] call biocode_get_ds_dosbiodata 337 <2> assume ds:DOSGROUP 0 00009D0A BE[2B00] mov si,offset tmp_vid ; source ; access with ds 339 <2> volid equ VOLID ; NASM port equate 0 00009D0D 83C74B add di,volid 0 00009D10 B90C00 mov cx,vid_size 0 00009D13 58 pop ax 0 00009D14 C3 ret 605 <1> ;=== Pop trace listing source 606 <1> === Switch to base=000000h -> "DOSENTRY" 607 <1> section DOSENTRY 608 <1> 609 <1> PUBLIC END96TPI 610 <1> END96TPI LABEL BYTE 614 ;=== Pop trace listing source 615 616 ;********************************************************************* 617 ;Memory allocation for BDSM table. - J.K. 2/21/86 618 ;********************************************************************* 619 620 %if 0 621 mlink DW ? ;-1 ;Link to next structure 622 DW ? 623 mdriveNum DB ? ;80 ;Int 13 Drive Number 624 mdriveLet DB ? ;3 ;Logical Drive Number 625 mBytePerSec DW ? ;512 626 mSecPerClus DB ? ;1 ;Sectors/allocation unit 627 mRESSEC DW ? ;1 ;Reserved sectors for DOS 628 mcFAT DB ? ;2 ;No. of allocation tables 629 mcDIR DW ? ;16 ;Number of directory entries 630 mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 631 mMediad DB ? ;11111000B ;Media descriptor 632 mcSecFat DW ? ;1 ;Number of FAT sectors 633 mSECLIM DW ? ;0 ;Sector limit 634 mHDLIM DW ? ;0 ;Head limit 635 mHIDSEC_L DW ? ;0 ;Hidden sector count 636 mHidsec_H dw ? ;0 ;J.K.87 637 mDrvlim_L dw ? ;0 ;J.K.87 638 mDrvlim_H dw ? ;0 ;J.K.87 639 mFatSiz DB ? ;0 ;TRUE => bigfat 640 mOPCNT DW ? ;0 ;Open Ref. Count 641 mFormFactor DB ? ;3 ;Form Factor 642 mFLAGS DW ? ;0020H ;Various Flags 643 mcCyln dw ? ;40 ;max number of cylinders 644 mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 645 mTrack db ? ;-1 646 IsMini dw ? ;1 ;Overlapping TIM_LOH 647 Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 648 mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 649 DB ? ;0 ;ASCIZII for "NO NAME " 650 mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 651 mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 652 db ? ;0 653 %endif 654 655 ; 656 ;;3.3 BUG FIX -SP ------------------------------ 657 ;;Migrated into 4.00 -MRW 658 ;Paragraph buffer between the BDSMs and MSHARD 659 ; 660 ;The relocation code for MSHARD needs this. this cannot be used for 661 ;anything. nothing can come before this or after this.....IMPORTANT!!!! 662 ;don't get too smart and using this buffer for anything!!!!!! 663 664 align 16, db 0CCh 665 666 ; 667 ;end of bug fix buffer 668 ;; 669 ;;3.3 BUG FIX -SP------------------------------ 670 END === Trace listing source: mshard.lst 1 ;*** 2 ; Title: Disk 3 ; C: (C) Copyright 1988 by Microsoft corp. 4 ; Date: 1/11/85 5 ; 6 ; There is a bug in some versions of IBM's AT ROM BIOS. 7 ; Interrupts are not disabled during read operations. 8 ; 9 ; Use: This program should be chained in line with the disk 10 ; interupt 13h, it intercepts read calls to the hard disk 11 ; and handles them appropriately. For other functions it 12 ; passes controll to OLD13, which should contain the 13 ; address of the AT ROM disk routine. The entry point for 14 ; this program is IBM_DISK_IO. 15 ; 16 17 18 cpu 286 ;Use 80286 non-protected mode 19 assume nocheck, ds:BIOSDATA 20 21 BIOSEG equ 040h ;Segment for ROM BIOS Data 22 ROMSEG equ 0F000h ;Segment of ROM 23 24 %idefine ORG absolute ; just address things without segment 25 26 ; === alternative section BIOSDATA 27 28 BAD_DISK equ 01 29 30 HF_PORT equ 01F0h 31 HF_REG_PORT equ 03F6h 32 33 ;* Offsets into Fixed disk parameter table 34 FDP_PRECOMP equ 5 35 FDP_CONTROL equ 8 36 37 ;section DATA ;ROM BIOS data segment 38 %if 0 39 section DATA ; NASM port directive for fixmem.pl 40 %endif 41 42 ORG 42h 0 00000042 ???????????? CMD_BLOCK DB 6 DUP (?) 44 45 ;* Offsets into CMD_BLOCK for registers 46 PRE_COMP equ 0 ;Write Pre-compensation 47 SEC_CNT equ 1 ;Sector count 48 SEC_NUM equ 2 ;Sector number 49 CYL_LOW equ 3 ;Cylinder number, low part 50 CYL_HIGH equ 4 ;Cylinder number, high part 51 DRV_HEAD equ 5 ;Drive/Head (Bit 7 = ECC mode, Bit 5 = 512 byte sectors, 52 ; Bit 4 = drive number, Bits 3-0 have head number) 53 CMD_REG equ 6 ;Command register 54 55 56 ORG 074h 57 0 00000074 ?? DISK_STATUS1 DB ? 0 00000075 ?? HF_NUM DB ? 0 00000076 ?? CONTROL_BYTE DB ? 61 62 ; (no prior section) ; DATA ENDS 63 64 ; === no alternative section 65 66 67 ;*** Define where the ROM routines are actually located 68 ;section ROM 69 70 ORG 02E1Eh 71 ROMCOMMAND PROC FAR 72 ROMCOMMAND ENDP 73 74 ORG 02E7Fh 75 ROMWAIT PROC FAR 76 ROMWAIT ENDP 77 78 ORG 02EE2h 79 ROMWAIT_DRQ PROC FAR 80 ROMWAIT_DRQ ENDP 81 82 ORG 02EF8h 83 ROMCHECK_STATUS PROC FAR 84 ROMCHECK_STATUS ENDP 85 86 ORG 02F69h 87 ROMCHECK_DMA PROC FAR 88 ROMCHECK_DMA ENDP 89 90 ORG 02F8Eh 91 ROMGET_VEC PROC FAR 92 ROMGET_VEC ENDP 93 94 ORG 0FF65h 95 ROMFRET PROC FAR ;Far return at F000:FF65 in AT ROM. 96 ROMFRET ENDP 97 98 ; (no prior section) ; ROM ENDS 99 100 === Switch to base=000000h -> "DOSENTRY" 101 section DOSENTRY align=1 PUBLIC class=DOSENTRY 102 103 EXTRN OLD13:DWORD ;Link to AT bios int 13h 104 105 PUBLIC IBM_DISK_IO 106 107 108 ;*** IBM_DISK_IO - main routine, fixes AT ROM bug 109 ; 110 ; ENTRY: (AH) = function, 02 or 0A for read. 111 ; (DL) = drive number (80h or 81h). 112 ; (DH) = head number. 113 ; (CH) = cylinder number. 114 ; (CL) = Sector number (high 2 bits has cylinder number). 115 ; (AL) = number of sectors. 116 ; (ES:BX) = address of read buffer. 117 ; For more on register contents see ROM BIOS listing. 118 ; Stack set up for return by an IRET. 119 ; 120 ; EXIT: (AH) = status of current operation. 121 ; (CY) = 1 IF failed, 0 if successful. 122 ; For other register contents see ROM BIOS listing. 123 ; 124 ; USES: 125 ; 126 ; 127 ; WARNING: Uses OLD13 vector for non-read calls. 128 ; Does direct calls to the AT ROM. 129 ; Does segment arithmatic. 130 ; 131 ; EFFECTS: Performs DISK I/O operation. 132 ; 133 IBM_DISK_IO PROC FAR 0 00000500 80FA80 CMP DL, 80h 0 00000503 720A JB ATD1 ;Pass through floppy disk calls. 0 00000505 80FC02 CMP AH, 02 0 00000508 740A JE ATD2 ;Intercept call 02 (read sectors). 0 0000050A 80FC0A CMP AH, 0Ah 0 0000050D 7405 JE ATD2 ;and call 0Ah (read long). 140 ATD1: 0 0000050F 2EFF2E[0000] JMP far [cs:OLD13] ;Use ROM INT 13h handler. 142 ATD2: 0 00000514 53 PUSH BX 0 00000515 51 PUSH CX 0 00000516 52 PUSH DX 0 00000517 57 PUSH DI 0 00000518 1E PUSH DS 0 00000519 06 PUSH ES 0 0000051A 50 PUSH AX 0 0000051B B84000 MOV AX,BIOSEG ;Establish BIOS segment addressing. 0 0000051E 8ED8 MOV DS,AX 152 assume nocheck, ds:BIOSDATA 0 00000520 C606740000 MOV byte [DISK_STATUS1], 0 ;Initially no error code. 0 00000525 80E27F AND DL, 07fh ;Mask to hard disk number 0 00000528 3A167500 CMP DL, [HF_NUM] 0 0000052C 7207 JB ATD3 ;Disk number in range 0 0000052E C606740001 MOV byte [DISK_STATUS1], BAD_DISK 0 00000533 EB20 JMP SHORT ATD4 ;Disk number out of range error, return 159 160 ATD3: 0 00000535 53 PUSH BX 0 00000536 8CC0 MOV AX, ES ;Make ES:BX to Seg:000x form. 0 00000538 C1EB04 SHR BX, 4 0 0000053B 01D8 ADD AX, BX 0 0000053D 8EC0 MOV ES, AX 166 assume nocheck, es:nothing 0 0000053F 5B POP BX 0 00000540 83E30F AND BX,000Fh 0 00000543 0E PUSH CS 0 00000544 E8DE00 CALL CHECK_DMA 0 00000547 720C JC ATD4 ;Abort if DMA across segment boundary 172 0 00000549 58 POP AX ;Restore AX register for SETCMD 0 0000054A 50 PUSH AX 0 0000054B E81A00 CALL SETCMD ;Set up command block for disk op 0 0000054E BAF603 MOV DX, HF_REG_PORT 0 00000551 EE OUT DX, AL ;Write out command modifier 0 00000552 E86B00 CALL DOCMD ;Carry out command 179 ATD4: 180 ;; Old code - Carry cleared after set by logical or opearation 181 ;; POP AX 182 ;; MOV AH,DISK_STATUS1 ;On return AH has error code 183 ;; STC 184 ;; OR AH,AH 185 ;; JNZ ATD5 ;Carry set if error 186 ;; CLC 187 ;;--------------------------------------------------- 188 ;; New Code - Let Logical or clear carry and then set carry if ah!=0 189 ;; And save a couple bytes while were at it. 0 00000555 58 POP AX 0 00000556 8A267400 MOV AH,[DISK_STATUS1] ;On return AH has error code 0 0000055A 08E4 OR AH,AH 0 0000055C 7401 JZ ATD5 ;Carry set if error 0 0000055E F9 STC 195 196 ATD5: 0 0000055F 07 POP ES 0 00000560 1F POP DS 199 assume nocheck, ds:nothing, es:nothing 0 00000561 5F POP DI 0 00000562 5A POP DX 0 00000563 59 POP CX 0 00000564 5B POP BX 0 00000565 CA0200 RET 2 ;Far return, dropping flags 205 IBM_DISK_IO ENDP 206 207 208 209 ;*** SETCMD - Set up CMD_BLOCK for the disk operation 210 ; 211 ; ENTRY: (DS) = BIOS Data segment. 212 ; (ES:BX) in seg:000x form. 213 ; Other registers as in INT 13h call 214 ; 215 ; EXIT: CMD_BLOCK set up for disk read call. 216 ; CONTROL_BYTE set up for disk operation. 217 ; (AL) = Control byte modifier 218 ; 219 ; 220 ; Sets the fields of CMD_BLOCK using the register contents 221 ; and the contents of the disk parameter block for the given drive. 222 ; 223 ; WARNING: (AX) destroyed. 224 ; Does direct calls to the AT ROM. 225 ; 226 SETCMD PROC NEAR 227 assume nocheck, ds:BIOSDATA 0 00000568 A24300 MOV [CMD_BLOCK + SEC_CNT], AL 0 0000056B C606480020 MOV byte [CMD_BLOCK + CMD_REG], 020h ;Assume function 02 0 00000570 80FC02 CMP AH, 2 0 00000573 7405 JE SETC1 ;CMD_REG = 20h if function 02 (read) 0 00000575 C606480022 MOV byte [CMD_BLOCK + CMD_REG], 022h ;CMD_REG = 22h if function 0A (" long) 233 SETC1: ;No longer need value in AX 0 0000057A 88C8 MOV AL, CL 0 0000057C 243F AND AL, 03fh ;Mask to sector number 0 0000057E A24400 MOV [CMD_BLOCK + SEC_NUM], AL 0 00000581 882E4500 MOV [CMD_BLOCK + CYL_LOW], CH 0 00000585 88C8 MOV AL, CL 0 00000587 C0E806 SHR AL, 6 ;Get two high bits of cylender number 0 0000058A A24600 MOV [CMD_BLOCK + CYL_HIGH], AL 0 0000058D 89D0 MOV AX, DX 0 0000058F C0E004 SHL AL, 4 ;Drive number 0 00000592 80E40F AND AH, 0Fh 0 00000595 08E0 OR AL, AH ;Head number 0 00000597 0CA0 OR AL, 0A0h ;Set ECC and 512 bytes per sector 0 00000599 A24700 MOV [CMD_BLOCK + DRV_HEAD], AL 0 0000059C 06 PUSH ES ;GET_VEC destroys ES:BX 0 0000059D 53 PUSH BX 0 0000059E 0E PUSH CS 0 0000059F E85B00 CALL GET_VEC 0 000005A2 268B4705 MOV AX, [ES:FDP_PRECOMP + BX] ;Write pre-comp from disk parameters 0 000005A6 C1E802 SHR AX, 2 0 000005A9 A24200 MOV [CMD_BLOCK + PRE_COMP],AL ;Only use low part 0 000005AC 268A4708 MOV AL, [ES:FDP_CONTROL + BX] ;Control byte modifier 0 000005B0 5B POP BX 0 000005B1 07 POP ES 257 assume nocheck, es:nothing 0 000005B2 8A267600 MOV AH, [CONTROL_BYTE] 0 000005B6 80E4C0 AND AH, 0C0h ;Keep disable retry bits 0 000005B9 08C4 OR AH, AL 0 000005BB 88267600 MOV [CONTROL_BYTE], AH 0 000005BF C3 RET 263 SETCMD ENDP 264 265 266 267 ;*** DOCMD - Carry out READ operation to AT hard disk 268 ; 269 ; ENTRY: (ES:BX) = address for read in data. 270 ; CMD_BLOCK set up for disk read. 271 ; 272 ; EXIT: Buffer at (ES:BX) contains data read. 273 ; DISK_STATUS1 set to error code (0 if success). 274 ; 275 ; 276 ; 277 ; WARNING: (AX), (BL), (CX), (DX), (DI) destroyed. 278 ; No check is made for DMA boundary overrun. 279 ; 280 ; EFFECTS: Programs disk controller. 281 ; Performs disk input. 282 ; 283 DOCMD PROC NEAR 0 000005C0 89DF MOV DI, BX ;(ES:DI) = data buffer addr. 0 000005C2 0E PUSH CS 0 000005C3 E83F00 CALL mshard_COMMAND 0 000005C6 7534 JNZ DOC3 288 DOC1: 0 000005C8 0E PUSH CS 0 000005C9 E84100 CALL WAITT ;Wait for controller to complete read 0 000005CC 752E JNZ DOC3 0 000005CE B90001 MOV CX, 100h ;256 words per sector 0 000005D1 BAF001 MOV DX, HF_PORT 0 000005D4 FC CLD ;String op goes up 0 000005D5 FA CLI ;Disable interrupts (BUG WAS FORGETTING THIS) 0 000005D6 F36D REPZ INSW ;Read in sector 0 000005D8 FB STI 0 000005D9 F606480002 TEST byte [CMD_BLOCK + CMD_REG], 02 0 000005DE 7410 JZ DOC2 ;No ECC bytes to read. 0 000005E0 0E PUSH CS 0 000005E1 E83100 CALL WAIT_DRQ 0 000005E4 7216 JC DOC3 0 000005E6 B90400 MOV CX, 4 ;4 bytes of ECC 0 000005E9 BAF001 MOV DX, HF_PORT 0 000005EC FA CLI 0 000005ED F36C REPZ INSB ;Read in ECC 0 000005EF FB STI 308 DOC2: 0 000005F0 0E PUSH CS 0 000005F1 E82900 CALL CHECK_STATUS 0 000005F4 7506 JNZ DOC3 ;Operation failed 0 000005F6 FE0E4300 DEC byte [CMD_BLOCK + SEC_CNT] 0 000005FA 75CC JNZ DOC1 ;Loop while more sectors to read 314 DOC3: 0 000005FC C3 RET 316 DOCMD ENDP 317 318 319 320 ;*** GET_VEC - Get pointer to hard disk parameters. 321 ; 322 ; ENTRY: (DL) = Low bit has hard disk number (0 or 1). 323 ; 324 ; EXIT: (ES:BX) = address of disk parameters table. 325 ; 326 ; USES: AX for segment computation. 327 ; 328 ; Loads ES:BX from interrupt table in low memory, vector 46h (disk 0) 329 ; or 70h (disk 1). 330 ; 331 ; WARNING: (AX) destroyed. 332 ; This does a direct call to the AT ROM. 333 ; 334 GET_VEC PROC NEAR 0 000005FD 6865FF PUSH OFFSET ROMFRET 0 00000600 EA8E2F00F0 JMP ROMSEG:ROMGET_VEC 337 GET_VEC ENDP 338 339 340 341 ;*** COMMAND - Send contents of CMD_BLOCK to disk controller. 342 ; 343 ; ENTRY: Control_byte 344 ; CMD_BLOCK - set up with values for hard disk controller. 345 ; 346 ; EXIT: DISK_STATUS1 = Error code. 347 ; NZ if error, ZR for no error. 348 ; 349 ; 350 ; WARNING: (AX), (CX), (DX) destroyed. 351 ; Does a direct call to the AT ROM. 352 ; 353 ; EFFECTS: Programs disk controller. 354 ; 355 mshard_COMMAND PROC NEAR 0 00000605 6865FF PUSH OFFSET ROMFRET 0 00000608 EA1E2E00F0 JMP ROMSEG:ROMCOMMAND 358 mshard_COMMAND ENDP 359 360 361 362 ;*** WAITT - Wait for disk interrupt 363 ; 364 ; ENTRY: Nothing. 365 ; 366 ; EXIT: DISK_STATUS1 = Error code. 367 ; NZ if error, ZR if no error. 368 ; 369 ; 370 ; WARNING: (AX), (BL), (CX) destroyed. 371 ; Does a direct call to the AT ROM. 372 ; 373 ; EFFECTS: Calls int 15h, function 9000h. 374 ; 375 WAITT PROC NEAR 0 0000060D 6865FF PUSH OFFSET ROMFRET 0 00000610 EA7F2E00F0 JMP ROMSEG:ROMWAIT 378 WAITT ENDP 379 380 381 382 ;*** WAIT_DRQ - Wait for data request. 383 ; 384 ; ENTRY: Nothing. 385 ; 386 ; EXIT: DISK_STATUS1 = Error code. 387 ; CY if error, NC if no error. 388 ; 389 ; 390 ; WARNING: (AL), (CX), (DX) destroyed. 391 ; Does a direct call to the AT ROM. 392 ; 393 WAIT_DRQ PROC NEAR 0 00000615 6865FF PUSH OFFSET ROMFRET 0 00000618 EAE22E00F0 JMP ROMSEG:ROMWAIT_DRQ 396 WAIT_DRQ ENDP 397 398 399 400 ;*** CHECK_STATUS - Check hard disk status. 401 ; 402 ; ENTRY: Nothing. 403 ; 404 ; EXIT: DISK_STATUS1 = Error code. 405 ; NZ if error, ZR if no error. 406 ; 407 ; 408 ; WARNING: (AX), (CX), (DX) destroyed. 409 ; Does a direct call to the AT ROM. 410 ; 411 CHECK_STATUS PROC NEAR 0 0000061D 6865FF PUSH OFFSET ROMFRET 0 00000620 EAF82E00F0 JMP ROMSEG:ROMCHECK_STATUS 414 CHECK_STATUS ENDP 415 416 417 418 ;*** CHECK_DMA - check for DMA overrun 64k segment. 419 ; 420 ; ENTRY: (ES:BX) = addr. of memory buffer in seg:000x form. 421 ; CMD_BLOCK set up for operation. 422 ; 423 ; EXIT: DISK_STATUS1 - Error code. 424 ; CY if error, NC if no error. 425 ; 426 ; 427 ; WARNING: Does a direct call to the AT ROM. 428 ; 429 CHECK_DMA PROC NEAR 0 00000625 6865FF PUSH OFFSET ROMFRET 0 00000628 EA692F00F0 JMP ROMSEG:ROMCHECK_DMA 432 CHECK_DMA ENDP 433 434 435 ; (no prior section) ; CODE ENDS 436 END === Trace listing source: msinit.lst 1 ; PAGE ,132 ; 2 %warning out: ...MSINIT.ASM 2 ****************** warning: out: ...MSINIT.ASM [-w+user] 3 ;======================================================= 4 ;REVISION HISTORY: 5 ;AN000; - NEW Version 4.00. J.K. 6 ;AC000; - Modified Line 4.00. J.K. 7 ;ANxxx; - PTMyyy 8 ;============================================================================== 9 ;AN001; P87 Set the value of MOTOR START TIME Variable 6/25/87 J.K. 10 ;AN002; P40 Boot from the system with no floppy diskette drives 6/26/87 J.K. 11 ;AN003; D9 Double Word MOV instruction for 386 based machine 7/1/87 J.K. 12 ;AN004; D64 Extend DOS 3.3 FAT tables to 64 K entries. 7/8/87 J.K. 13 ;AN005; D113 Disable I/O access to unformatted media 9/03/87 J.K. 14 ;AN006; p941 D113 does not implemented properly. 9/11/87 J.K. 15 ;AN007; p969 Should Honor OS2 boot record. 9/11/87 J.K. 16 ;AN008; p985 Allow I/O access to unformtted media 9/14/87 J.K. 17 ;AN009; p1535 Disallow I/O access to unformtted media 10/15/87 J.K. 18 ;AN010; p2349 Cover DOS 3.3 and below FDISK bug 11/10/87 J.K. 19 ;AN011; P2431 OS2 boot record version number is at offset 7 (not 8)11/12/87 J.K. 20 ;AN012; P2900 DOS 4.0 does not recognize 3.0 formatted media 12/18/87 J.K. 21 ;AN013; P3409 Extended keyboard not recognized 02/05/88 J.K. 22 ;AN014; D486 Share installation for big media 02/23/88 J.K. 23 ;AN015; P3929 Boot record buffer overlaps MSBIO code 03/18/88 J.K. 24 ;============================================================================== 25 26 itest equ 0 27 %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> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <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 === Switch to base=002450h -> "BIOCODE" 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 28 %include "lmacros3.mac" 1 <1> [list -] 1 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <2> [list -] 14 <1> [list -] 29 %include "lstruct.mac" 1 <1> [list -] 13 <1> [list -] 30 === Switch to base=000E10h -> "DOSSTART" 31 addsection DOSSTART, align=16 PUBLIC class=DOSSTART 32 ; (no prior section) ; DOSSTART ENDS 33 === Switch to base=002450h -> "AFTERDOSDATA" 34 addsection AFTERDOSDATA, align=16 class=AFTERDOSDATA 35 ; (no prior section) ; AFTERDOSDATA ENDS 36 37 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 1 <2> [list -] 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 38 %include "dcodeseg.nas" 1 <1> 2 <1> %ifndef DCODESEGNAS 3 <1> %assign DCODESEGNAS 1 4 <1> === Switch to base=002450h -> "DOSCODETABLE" 5 <1> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <1> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <1> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <1> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <1> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <1> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <1> 12 <1> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <1> 14 <1> %endif 39 %include "sysinisw.mac" 1 <1> 2 <1> SYSINITSTACK equ 256+128 40 === Switch to base=002450h -> "BIOCODE" 41 addsection BIOCODE === Switch to base=000000h -> "DOSENTRY" 42 usesection DOSENTRY 43 44 %include "msdskpr.mac" 1 <1> ; The following structure defines the disk parameter table 2 <1> ; pointed to by Interrupt vector 1EH (location 0:78H) 3 <1> 4 <1> DISK_PARMS STRUC 0 0000062E ?? DISK_SPECIFY_1 DB ? 0 0000062F ?? DISK_SPECIFY_2 DB ? 0 00000630 ?? DISK_MOTOR_WAIT DB ? ; Wait till motor off 0 00000631 ?? DISK_SECTOR_SIZ DB ? ; Bytes/Sector (2 = 512) 0 00000632 ?? DISK_EOT DB ? ; Sectors per track (MAX) 0 00000633 ?? DISK_RW_GAP DB ? ; Read Write Gap 0 00000634 ?? DISK_DTL DB ? 0 00000635 ?? DISK_FORMT_GAP DB ? ; Format Gap Length 0 00000636 ?? DISK_FILL DB ? ; Format Fill Byte 0 00000637 ?? DISK_HEAD_STTL DB ? ; Head Settle Time (MSec) 0 00000638 ?? DISK_MOTOR_STRT DB ? ; Motor start delay 16 <1> DISK_PARMS ENDS 17 <1> 18 <1> ROMStatus equ 1 19 <1> ROMRead equ 2 20 <1> ROMWrite equ 3 21 <1> ROMVerify equ 4 22 <1> ROMFormat equ 5 45 %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 0 0000062E ???? lpSize dw ? 0 00000630 ???? lpCount dw ? 0 00000632 ???????? lpBuffer dd ? 0 00000636 ???????????????? 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 0 0000062E ???????? LINK DD ? ; LINK TO NEXT BDS 0 00000632 ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 00000633 ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 00000634 ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 00000636 ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 00000637 ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 00000639 ?? CFAT DB ? ; NUMBER OF FATS 0 0000063A ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 0000063C ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 0000063E ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 0000063F ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 00000641 ???? SECLIM DW ? ; SECTORS PER TRACK 0 00000643 ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 00000645 ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 00000647 ???? HIDSEC_H dw ? ;0 ;J.K.87 0 00000649 ???? DRVLIM_L dw ? ;0 ;J.K.87 0 0000064B ???? DRVLIM_H dw ? ;0 ;J.K.87 0 0000064D ?? FATSIZ DB ? ; FLAGS... 0 0000064E ???? OPCNT DW ? ; OPEN REF. COUNT 0 00000650 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 00000651 ???? FLAGS DW ? ; VARIOUS FLAGS 0 00000653 ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 00000655 ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 00000657 ?? RSECPERCLUS DB ? 0 00000658 ???? RRESSEC DW ? 0 0000065A ?? RCFAT DB ? 0 0000065B ???? RCDIR DW ? 0 0000065D ???? RDRVLIM DW ? 0 0000065F ?? RMEDIAD DB ? 0 00000660 ???? RCSECFAT DW ? 0 00000662 ???? RSECLIM DW ? 0 00000664 ???? RHDLIM DW ? 0 00000666 ???? RHIDSEC_L DW ? 0 00000668 ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 0000066A ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 0000066C ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 0000066E ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 00000674 ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 00000675 ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 00000677 ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 00000685 ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <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 0 0000062E ???? mlink DW ? ;-1 ;Link to next structure 0 00000630 ???? DW ? 0 00000632 ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 00000633 ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 00000634 ???? mBytePerSec DW ? ;512 0 00000636 ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 00000637 ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 00000639 ?? mcFAT DB ? ;2 ;No. of allocation tables 0 0000063A ???? mcDIR DW ? ;16 ;Number of directory entries 0 0000063C ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 0000063E ?? mMediad DB ? ;11111000B ;Media descriptor 0 0000063F ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 00000641 ???? mSECLIM DW ? ;0 ;Sector limit 0 00000643 ???? mHDLIM DW ? ;0 ;Head limit 0 00000645 ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 00000647 ???? mHidsec_H dw ? ;0 ;J.K.87 0 00000649 ???? mDrvlim_L dw ? ;0 ;J.K.87 0 0000064B ???? mDrvlim_H dw ? ;0 ;J.K.87 0 0000064D ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 0000064E ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 00000650 ?? mFormFactor DB ? ;3 ;Form Factor 0 00000651 ???? mFLAGS DW ? ;0020H ;Various Flags 0 00000653 ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 00000674 ?? mTrack db ? ;-1 0 00000675 ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 00000677 ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 00000684 ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 00000685 ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 00000689 ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 00000691 ?? 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 0 0000062E ???? SECSIZE DW ? 0 00000630 ?? SECALL DB ? 0 00000631 ???? RESNUM DW ? 0 00000633 ?? FATNUM DB ? 0 00000634 ???? DIRNUM DW ? 0 00000636 ???? SECNUM DW ? 0 00000638 ?? FATID DB ? 0 00000639 ???? FATSIZE DW ? 0 0000063B ???? SLIM DW ? 0 0000063D ???? HLIM DW ? 0 0000063F ???? HIDDEN_L DW ? 0 00000641 ???? HIDDEN_H dw ? ;0 ;J.K. 0 00000643 ???? SECNUM_L dw ? ;0 ;J.K. 0 00000645 ???? 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 46 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 47 %include "msextrn.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; SCCSID = @(#)IBMEXTRN.ASM 1.11 85/11/18 4 <1> ;This is for IBMINIT module. 5 <1> ;======================================================= 6 <1> ;REVISION HISTORY: 7 <1> ;AN000; - NEW Version 4.00. J.K. 8 <1> ;AC000; - Modified Line 4.00. J.K. 9 <1> ;ANxxx; - PTMyyy 10 <1> ;============================================================================== 11 <1> ;AN001; D486 SHARE installation for large media 2/23/88 J.K. 12 <1> ;============================================================================== 13 <1> 14 <1> extern biocode_get_ds_dosentry, biocode_get_es_dosentry 15 <1> extern dosbiocode_get_ds_dosentry, dosbiocode_get_es_dosentry 16 <1> extern biocode_get_ds_dosbiodata, biocode_get_es_dosbiodata 17 <1> EXTRN ORIG13:DWORD,ORIG19:DWORD 18 <1> EXTRN COM2DEV:WORD,COM1DEV:WORD 19 <1> EXTRN COM4DEV:WORD,COM3DEV:WORD 20 <1> EXTRN LPT3DEV:WORD,LPT2DEV:WORD,LPT1DEV:WORD 21 <1> EXTRN HARDDRV:BYTE,HARDNUM:BYTE,DRVMAX:BYTE,HDSKTAB:WORD 22 <1> EXTRN DSKDRVS:WORD,HNUM:BYTE,EOT:BYTE,FHAVE96:BYTE 23 <1> EXTRN REAL13:DWORD,DAYCNT:WORD,CONHEADER:WORD 24 <1> EXTRN TWOHARD:BYTE,INT_2F_NEXT:DWORD 25 <1> EXTRN BDSH:WORD,BDSX:WORD,START_BDS:WORD 26 <1> EXTRN FHAVEK09:BYTE, NEW_ROM:BYTE 27 <1> EXTRN SINGLE:BYTE 28 <1> EXTRN BDSMs:BYTE ;for Mini Disk -J.K. 4/7/86 29 <1> EXTRN HaveCMOSClock:byte ;set by IBMINIT. Used by IBMCLOCK.ASM 30 <1> EXTRN BinToBCD:word ;set by IBMINIT. Used by IBMCLOCK.ASM 31 <1> EXTRN DaycntToDay:word ;set by IBMINIT. Used by IBMCLOCK.ASM 32 <1> EXTRN OLD13:DWORD 33 <1> extrn Temp_H:word ;J.K. For 32 bit calculation. IBMDISK 34 <1> extrn Start_Sec_H:word ;J.K. IBMDISK. 35 <1> extrn KEYRD_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA. 36 <1> extrn KEYSTS_Func:byte ;J.K. For IBMCON. Defined in IBMBDATA. 37 <1> extrn DiskSector:byte ;J.K. IBMBDATA 38 <1> extrn Bpb_In_Sector:word ;J.K. IBMBDATA 39 <1> extrn SecPerClusInSector:Byte ;J.K. IBMBDATA 40 <1> extrn NumberOfFats:byte ;J.K. IBMBDATA 41 <1> extrn MediaByte:byte ;J.K. IBMBDATA 42 <1> extrn Ext_Boot_Sig:Byte ;J.K. IBMBDATA 43 <1> extrn Boot_Serial_L:Word ;J.K. IBMBDATA 44 <1> extrn Boot_Serial_H:Word ;J.K. IBMBDATA 45 <1> extrn Boot_Volume_Label:Byte ;J.K. IBMBDATA 46 <1> extrn Boot_System_ID:Byte ;J.K. IBMBDATA 47 <1> extrn Fat_12_ID:Byte ;J.K. IBMDISK 48 <1> extrn Fat_16_ID:Byte ;J.K. IBMDISK 49 <1> extrn lbapacket:byte 50 <1> extrn Vol_No_Name:Byte ;J.K. IBMDISK 51 <1> extrn MOTORSTARTUP:Byte ;J.K. IBMBDATA 52 <1> extrn DoubleWordMov:Byte ;J.K. IBMDISK 53 <1> extrn Model_Byte:Byte ;J.K. IBMBIO2 54 <1> extrn Secondary_Model_Byte:Byte ;J.K. IBMBIO2 55 <1> 56 <1> %IF itest 57 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD 58 <1> %ENDIF 59 <1> 60 <1> EXTRN START$:NEAR,ERROUT:NEAR,BLOCK13:FAR,INT19:FAR 61 <1> EXTRN INTRET:NEAR,HDRIVE:NEAR,DRIVEX:NEAR,INT13:FAR,CBREAK:NEAR,OUTCHR:NEAR 62 <1> EXTRN DISKRD:NEAR,MEDIA_PATCH:NEAR,GETBP1_PATCH:NEAR 63 <1> EXTRN SET_PATCH:NEAR,DISKIO_PATCH:NEAR,DSKERR:NEAR,INIT_PATCH:NEAR 64 <1> extern DSKERR_PATCH 65 <1> EXTRN TABLE_PATCH:NEAR,EXIT:NEAR,CHANGED_PATCH:NEAR 66 <1> EXTRN ERRIN:NEAR,GETBP:NEAR,SWPDSK:NEAR 67 <1> EXTRN OUTCHR:NEAR,WRMSG:NEAR,TIME_TO_TICKS:NEAR 68 <1> EXTRN INT2F_DISK:NEAR,INSTALL_BDS:NEAR,SETDRIVE:NEAR 69 <1> extrn Mov_Media_IDs:Near ;J.K. 70 <1> extrn Clear_IDs:Near ;J.K. 71 <1> %IF itest 72 <1> EXTRN MSGNUM:NEAR,MSGOUT:NEAR,dumpbytes:near,hex_to_ascii:near 73 <1> EXTRN outchar:near 74 <1> %ENDIF 75 <1> extrn lbatochs:near, chstotuple:near 76 <1> extrn lba_packet_setup:near 77 <1> === Switch to base=00C400h -> "SYSINITSEG" 78 <1> section SYSINITSEG PUBLIC class=INIT 79 <1> ASSUME CS:SYSINITSEG 80 <1> EXTRN behind_dosentry_segment:WORD 81 <1> EXTRN DEVICE_LIST:DWORD 82 <1> EXTRN MEMORY_SIZE:WORD 83 <1> EXTRN DEFAULT_DRIVE:BYTE 84 <1> EXTRN BUFFERS:WORD 85 <1> EXTRN SYSINIT:FAR 86 <1> extrn Big_Media_Flag:Byte ;AN001; 87 <1> ; (no prior section) ; SYSINITSEG ENDS === Switch to base=002450h -> "BIOCODE" 88 <1> section BIOCODE 89 <1> 90 <1> ASSUME CS:BIOCODE 91 <1> 92 <1> ; END OF DISK MODULES FOR CONFIGURATION 93 <1> 94 <1> EXTRN END96TPI:BYTE 95 <1> EXTRN ENDTWOHARD:BYTE 96 <1> EXTRN ENDONEHARD:BYTE 97 <1> EXTRN ENDSWAP:BYTE 98 <1> EXTRN ENDFLOPPY:BYTE 99 <1> 100 <1> ; IBM FIXED UP AT ROM 101 <1> 102 <1> EXTRN IBM_DISK_IO:FAR 48 %include "biostruc.mac" 1 <1> %warning out: BIOSTRUC.INC... 1 ****************** <1> warning: out: BIOSTRUC.INC... [-w+user] 2 <1> ; SCCSID = @(#)BIOSTRUC.INC 1.0 86/09/30 3 <1> ; ROM BIOS CALL PACKET STRUCTURES 4 <1> 5 <1> ;******************************* 6 <1> ;System Service call ( Int 15h ) 7 <1> ;******************************* 8 <1> ;Function AH = 0C0h, Return system configuration 9 <1> ;For PC and PCJR on return: 10 <1> ; (AH) = 80h 11 <1> ; (CY) = 1 12 <1> ;For PCXT, PC PORTABLE and PCAT on return: 13 <1> ; (AH) = 86h 14 <1> ; (CY) = 1 15 <1> ;For all others: 16 <1> ; (AH) = 0 17 <1> ; (CY) = 0 18 <1> ; (ES:BX) = pointer to system descriptor vector in ROS 19 <1> ; System descriptor : 20 <1> ; DW xxxx length of descriptor in bytes, 21 <1> ; minimum length = 8 22 <1> ; DB xx model byte 23 <1> ; 0FFh = PC 24 <1> ; 0FEh = PC/XT, Portable 25 <1> ; 0FDh = PC/JR 26 <1> ; 0FCh = PC/AT, 6Mhz PC/AT, 27 <1> ; 6Mhz PC/AT running coprocessor(?), 28 <1> ; PS/2 Model 50, 50 z 29 <1> ; 0FAh = PS/2 Model 25, 30 30 <1> ; 0F9h = PC Convertible 31 <1> ; 0F8h = PS/2 Model 80 32 <1> ; 0F7h = Nova 33 <1> ; 0E0 thru 0EFh = reserved 34 <1> ; 35 <1> ; DB xx secondary model byte 36 <1> ; 000h = PC1 37 <1> ; 000h = PC/XT, Portable 38 <1> ; 000h = PC/JR 39 <1> ; 000h = PC/AT 40 <1> ; 001h = 6Mhz PC/AT 41 <1> ; 003h = 6Mhz PC/AT running coprocessor(?) 42 <1> ; 004h = PS/2 Model 50, 50z 43 <1> ; 001h = PS/2 Model 25 44 <1> ; 000h = PC Convertible 45 <1> ; 000h = PS/2 Model 80 46 <1> ; 000h = Nova 47 <1> ; 48 <1> ; DB xx bios revision level 49 <1> ; 00 for first release, subsequent release 50 <1> ; of code with same model byte and 51 <1> ; secondary model byte require revison level 52 <1> ; to increase by one. 53 <1> ; 54 <1> ; DB xx feature information byte 1 55 <1> ; X0000000 = 1, bios use DMA channel 3 56 <1> ; = 0, DMA channel 3 not used 57 <1> ; 58 <1> ; 0X000000 = 1, 2nd Interrupt chip present 59 <1> ; = 0, 2nd Interrupt chip not present 60 <1> ; 61 <1> ; 00X00000 = 1, Real Time Clock present 62 <1> ; = 0, Real Time Clock not present 63 <1> ; 64 <1> ; 000X0000 = 1, Keyboard escape sequence(INT15h) 65 <1> ; called in keyboard interrupt 66 <1> ; (Int 09h). 67 <1> ; = 0, Keyboard escape sequence not 68 <1> ; called. 69 <1> ; 0000XXXX reserved 70 <1> ; 71 <1> ; DB xx feature information byte 2 - reserved 72 <1> ; 73 <1> ; DB xx feature information byte 2 - reserved 74 <1> ; 75 <1> ; DB xx feature information byte 2 - reserved 76 <1> ; 77 <1> ; DB xx feature information byte 2 - reserved 78 <1> ; 79 <1> 80 <1> BIOS_SYSTEM_DESCRIPTOR struc 0 00009D16 ???? bios_SD_leng dw ? 0 00009D18 ?? bios_SD_modelbyte db ? 0 00009D19 ?? bios_SD_scnd_modelbyte db ? 0 00009D1A ?? db ? 0 00009D1B ?? bios_SD_featurebyte1 db ? 0 00009D1C ???????? db 4 dup (?) 87 <1> BIOS_SYSTEM_DESCRIPTOR ends 88 <1> 89 <1> ;FeatureByte1 bit map equates 90 <1> DMAchannel3 equ 10000000b 91 <1> ScndIntController equ 01000000b 92 <1> RealTimeClock equ 00100000b 93 <1> KeyEscapeSeq equ 00010000b 94 <1> ; 95 <1> ;Model Byte 96 <1> MDL_PC1 EQU 0FFH 97 <1> MDL_XT EQU 0FEH 98 <1> MDL_JR EQU 0FDH 99 <1> MDL_AT EQU 0FCH 100 <1> MDL_CONVERT EQU 0F9H 101 <1> 102 <1> mdl_ps2_30 equ 0fah 103 <1> mdl_ps2_80 equ 0f8h 49 %include "cmosequ.mac" 1 <1> ;;Rev 3.30 Modification 2 <1> ;Equates for CMOS. 3 <1> 4 <1> ;---------------------------------------- 5 <1> ; CMOS EQUATES FOR THIS SYSTEM : 6 <1> ;------------------------------------------------------------------------------- 7 <1> CMOS_PORT EQU 070H ; I/O ADDRESS OF CMOS ADDRESS PORT 8 <1> CMOS_DATA EQU 071H ; I/O ADDRESS OF CMOS DATA PORT 9 <1> NMI EQU 10000000B ; DISABLE NMI INTERRUPTS MASK - 10 <1> ; HIGH BIT OF CMOS LOCATION ADDRESS 11 <1> 12 <1> ;---------- CMOS TABLE LOCATION ADDRESS'S ## ----------------------------------- 13 <1> CMOS_SECONDS EQU 000H ; SECONDS 14 <1> CMOS_SEC_ALARM EQU 001H ; SECONDS ALARM ## NOTE: ALL LOCATIONS 15 <1> CMOS_MINUTES EQU 002H ; MINUTES | IN THE CMOS AREA 16 <1> CMOS_MIN_ALARM EQU 003H ; MINUTES ALARM | ARE IBM USE ONLY 17 <1> CMOS_HOURS EQU 004H ; HOURS | AND SUBJECT TO 18 <1> CMOS_HR_ALARM EQU 005H ; HOURS ALARM | CHANGE. ONLY THE 19 <1> CMOS_DAY_WEEK EQU 006H ; DAY OF THE WEEK | POST & BIOS CODE 20 <1> CMOS_DAY_MONTH EQU 007H ; DAY OF THE MONTH | SHOULD DIRECTLY 21 <1> CMOS_MONTH EQU 008H ; MONTH | ACCESS LOCATIONS 22 <1> CMOS_YEAR EQU 009H ; YEAR (TWO DIGITS) | IN CMOS STORAGE. 23 <1> CMOS_REG_A EQU 00AH ; STATUS REGISTER A '----------------- 24 <1> CMOS_REG_B EQU 00BH ; STATUS REGISTER B ALARM 25 <1> CMOS_REG_C EQU 00CH ; STATUS REGISTER C FLAGS 26 <1> CMOS_REG_D EQU 00DH ; STATUS REGISTER D BATTERY 27 <1> CMOS_DIAG EQU 00EH ; POST DIAGNOSTIC STATUS RESULTS BYTE 28 <1> CMOS_SHUT_DOWN EQU 00FH ; SHUTDOWN STATUS COMMAND BYTE 29 <1> CMOS_DISKETTE EQU 010H ; DISKETTE DRIVE TYPE BYTE ; 30 <1> ; EQU 011H ; - RESERVED ;C 31 <1> CMOS_DISK EQU 012H ; FIXED DISK TYPE BYTE ;H 32 <1> ; EQU 013H ; - RESERVED ;E 33 <1> CMOS_EQUIP EQU 014H ; EQUIPMENT WORD LOW BYTE ;C 34 <1> CMOS_B_M_S_LO EQU 015H ; BASE MEMORY SIZE - LOW BYTE (X1024) ;K 35 <1> CMOS_B_M_S_HI EQU 016H ; BASE MEMORY SIZE - HIGH BYTE ;S 36 <1> CMOS_E_M_S_LO EQU 017H ; EXPANSION MEMORY SIZE - LOW BYTE ;U 37 <1> CMOS_E_M_S_HI EQU 018H ; EXPANSION MEMORY SIZE - HIGH BYTE ;M 38 <1> CMOS_DISK_1 EQU 019H ; FIXED DISK TYPE - DRIVE C EXTENSION ;E 39 <1> CMOS_DISK_2 EQU 01AH ; FIXED DISK TYPE - DRIVE D EXTENSION ;D 40 <1> ; EQU 01BH ; - 1BH THROUGH 2DH - RESERVED ; 41 <1> CMOS_CKSUM_HI EQU 02EH ; CMOS CHECKSUM - HIGH BYTE ;* 42 <1> CMOS_CKSUM_LO EQU 02FH ; CMOS CHECKSUM - LOW BYTE ;* 43 <1> CMOS_U_M_S_LO EQU 030H ; USABLE MEMORY ABOVE 1 MEG - LOW BYTE 44 <1> CMOS_U_M_S_HI EQU 031H ; USABLE MEMORY ABOVE 1 MEG - HIGH BYTE 45 <1> CMOS_CENTURY EQU 032H ; DATE CENTURY BYTE (BCD) 46 <1> CMOS_INFO128 EQU 033H ; 128KB INFORMATION STATUS FLAG BYTE 47 <1> ; EQU 034H ; - 34H THROUGH 3FH - RESERVED 48 <1> ; 49 <1> ;;End of Modification 50 <1> 50 %include "cputype.mac" 1 <1> ; Note: this must be a macro, and not a subroutine in the BIOS since 2 <1> ; it is called from both CODE and SYSINITSEG. 3 <1> ; 4 <1> ;------GET_CPU_TYPE------------------------------------------------------------May, 88 by MW 5 <1> ; Returns: AX = 0 if 8086 or 8088 6 <1> ; = 1 if 80286 7 <1> ; = 2 if 80386 8 <1> ; 9 <1> %macro Get_CPU_Type 0 10 <1> pushf 11 <1> push bx ; preserve bx 12 <1> xor bx, bx ; init bx to zero 13 <1> 14 <1> xor ax,ax ; 0000 into AX 15 <1> push ax ; put it on the stack... 16 <1> popf ; ...then shove it into the flags 17 <1> pushf ; get it back out of the flags... 18 <1> pop ax ; ...and into ax 19 <1> and ax,0F000h ; mask off high four bits 20 <1> cmp ax,0F000h ; was it all 1's? 21 <1> je %%cpu_8086 ; aye; it's an 8086 or 8088 22 <1> 23 <1> mov ax,0F000h ; now try to set the high four bits.. 24 <1> push ax 25 <1> popf 26 <1> pushf 27 <1> pop ax ; ...and see what happens 28 <1> and ax,0F000h ; any high bits set ? 29 <1> jz %%cpu_286 ; nay; it's an 80286 30 <1> 31 <1> %%cpu_386: ; bx starts as zero 32 <1> inc bx ; inc twice if 386 33 <1> %%cpu_286: ; just inc once if 286 34 <1> inc bx 35 <1> %%cpu_8086: ; don't inc at all if 086 36 <1> mov ax, bx ; put CPU type value in ax 37 <1> pop bx ; restore original bx 38 <1> popf 39 <1> %endmacro 51 %include "arena.mac" 1 <1> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <1> ;BREAK 3 <1> 4 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <1> ; C A V E A T P R O G R A M M E R ; 6 <1> ; ; 7 <1> ; 8 <1> ; arena item 9 <1> ; 10 <1> arena STRUC 0 00009D16 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00009D17 ???? arena_owner DW ? ; owner of arena item 0 00009D19 ???? arena_size DW ? ; size in paragraphs of item 0 00009D1B ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00009D1E ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <1> arena ENDS 17 <1> 18 <1> ; 19 <1> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <1> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <1> ; them and change ALLOC.ASM. 22 <1> 23 <1> arena_owner_system EQU 0 ; free block indication 24 <1> 25 <1> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <1> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <1> ; ; 28 <1> ; C A V E A T P R O G R A M M E R ; 29 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <1> 52 %include "codesw.mac" 1 <1> DOSCODE_HMA_SEGMENT equ 0FFFEh 2 <1> ; address DOSCODE at this segment when in HMA 3 <1> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h 4 <1> ; offset from DOSCODE offset 0 to address 10_0000h 5 <1> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h 6 <1> ; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB 53 === Switch to base=000000h -> "DOSENTRY" 54 usesection DOSENTRY 55 56 ; For lDOS lCFG block 57 LCFG_CheckDebugger equ 20 58 LCFG_ScanMode equ 22 59 LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 60 LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 61 LCFG_DBG_ONLY_VALID equ 4 62 LCFG_DBG_ONLY_IISP equ 8 63 ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 64 ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 65 ; ours here as 8 independent flags that can be set individually. 66 67 ; THE FOLLOWING LABEL DEFINES THE END OF THE AT ROM PATCH. THIS IS USED AT 68 ; CONFIGURATION TIME. 69 ;J.K. 10/2/86 Warning!!! This code will be dynamically relocated by MSINIT. 70 71 PUBLIC ENDATROM ;NOT REFERENCES EXTERNALLY, BUT 72 ; JUST TO CAUSE ENTRY IN LINK MAP 73 ENDATROM LABEL BYTE 74 75 === Switch to base=002450h -> "BIOCODE" 76 usesection BIOCODE 77 78 ;CMOS Clock setting support routines used by MSCLOCK. 79 80 EXTRN base_century:byte 81 EXTRN base_year:byte 82 EXTRN month_tab:byte 83 84 public near_daycnt_to_day ;J.K. 4/30/86 for real time clock support 85 near_daycnt_to_day proc near ;J.K. 4/30/86 for real time clock support 86 ;Entry: [DAYCNT] = number of days since 1-1-80 87 ;Return: CH - centry in BCD, CL - year in BCD, DH - month in BCD, DL - day in BCD 88 89 assume ds:nothing, es:nothing, ss:nothing 0 00009D16 1E push ds 0 00009D17 E8[0000] call biocode_get_ds_dosbiodata 92 assume ds:DOSGROUP 93 94 daycnt equ DAYCNT ; NASM port label 0 00009D1A FF36[0000] push word [daycnt] ;save daycnt 0 00009D1E 813E[0000]891C cmp word [daycnt], (365*20+(20/4)) ;# of days from 1-1-1980 to 1-1-2000 0 00009D24 730C jae century20 0 00009D26 C606[0000]13 mov byte [base_century], 19 0 00009D2B C606[0000]50 mov byte [base_year], 80 0 00009D30 EB10 jmp years 101 century20: ;20th century 0 00009D32 C606[0000]14 mov byte [base_century], 20 0 00009D37 C606[0000]00 mov byte [base_year], 0 0 00009D3C 812E[0000]891C sub word [daycnt], (365*20+(20/4)) ;adjust daycnt 105 years: 0 00009D42 31D2 xor dx, dx 0 00009D44 A1[0000] mov ax, [daycnt] 0 00009D47 BBB505 mov bx, (366+365*3) ;# of days in a Leap year block 0 00009D4A F7F3 div bx ;AX = # of leap block, DX = daycnt 0 00009D4C 8916[0000] mov [daycnt], dx ;save daycnt left 111 ; or ah, ah ;ax should be less than 256 112 ; jz OK1 113 ; jmp Erroroccur 114 ;OK1: 0 00009D50 B304 mov bl,4 0 00009D52 F6E3 mul bl ;AX = # of years. Less than 100 years! 0 00009D54 0006[0000] add [base_year], al ;So, ah = 0. Adjust year accordingly. 0 00009D58 FF06[0000] inc word [daycnt] ;set daycnt to 1 base 0 00009D5C 813E[0000]6E01 cmp word [daycnt], 366 ;the daycnt here is the remainder of the leap year block. 0 00009D62 7621 jbe Leapyear ;So, it should within 366+355+355+355 days. 0 00009D64 FE06[0000] inc byte [base_year] ;First if daycnt <= 366, then leap year 0 00009D68 812E[0000]6E01 sub word [daycnt], 366 ;else daycnt--, base_year++; 123 ;And the next three years are regular years. 0 00009D6E B90300 mov cx, 3 125 Regularyear: 0 00009D71 813E[0000]6D01 cmp word [daycnt], 365 ;for(i=1; i>3 or daycnt <=365;i++) 127 YearDone equ Yeardone ; NASM port label 0 00009D77 7611 jbe YearDone ;{if (daycnt > 365) 0 00009D79 FE06[0000] inc byte [base_year] ; { daycnt -= 365 0 00009D7D 812E[0000]6D01 sub word [daycnt], 365 ; } 131 regularyear equ Regularyear ; NASM port label 0 00009D83 E2EC loop regularyear ;} 133 ; jmp Erroroccur ;cannot come to here 134 Leapyear: 0 00009D85 C606[0100]1D mov byte [month_tab+1],29 ;leap year. change the month table. 136 Yeardone: 0 00009D8A 31DB xor bx,bx 0 00009D8C 31D2 xor dx,dx 0 00009D8E A1[0000] mov ax, [daycnt] 0 00009D91 BE[0000] mov si, offset month_tab 0 00009D94 B90C00 mov cx, 12 142 Months: 0 00009D97 FEC3 inc bl ; 0 00009D99 8A14 mov dl, byte ptr [si] ;compare daycnt for each month until fits 0 00009D9B 39D0 cmp ax, dx ;dh=0. 0 00009D9D 7605 jbe Month_done 0 00009D9F 46 inc si ;next month 0 00009DA0 29D0 sub ax, dx ;adjust daycnt 0 00009DA2 E2F3 loop Months 150 ; jmp Erroroccur 151 Month_done: 0 00009DA4 C606[0100]1C mov byte [month_tab+1], 28 ;restore month table value 0 00009DA9 88DA mov dl, bl 0 00009DAB 8A36[0000] mov dh, [base_year] 0 00009DAF 8A0E[0000] mov cl, [base_century] ;now, al=day, dl=month,dh=year,cl=century 0 00009DB3 E81700 call near_bin_to_bcd ; convert "day" to bcd 0 00009DB6 86D0 xchg dl, al ;dl = bcd day, al = month 0 00009DB8 E81200 call near_bin_to_bcd 0 00009DBB 86F0 xchg dh, al ;dh = bcd month, al = year 0 00009DBD E80D00 call near_bin_to_bcd 0 00009DC0 86C8 xchg cl, al ;cl = bcd year, al = century 0 00009DC2 E80800 call near_bin_to_bcd 0 00009DC5 88C5 mov ch, al ;ch = bcd century 0 00009DC7 8F06[0000] pop word [daycnt] ;restore original value 0 00009DCB 1F pop ds 166 assume ds:nothing 0 00009DCC C3 ret 168 near_daycnt_to_day endp 169 170 public near_bin_to_bcd 171 near_bin_to_bcd proc near ;J.K. 4/30/86 for real time clock support 172 ;Convert a binary input in AL (less than 63h or 99 decimal) 173 ;into a bcd value in AL. AH destroyed. 0 00009DCD 51 push cx 0 00009DCE 30E4 xor ah, ah 0 00009DD0 B10A mov cl, 10 0 00009DD2 F6F1 div cl ;al - high digit for bcd, ah - low digit for bcd 0 00009DD4 B104 mov cl, 4 0 00009DD6 D2E0 shl al, cl ;mov the high digit to high nibble 0 00009DD8 08E0 or al, ah 0 00009DDA 59 pop cx 0 00009DDB C3 ret 183 near_bin_to_bcd endp 184 185 EXTRN BIN_DATE_TIME:BYTE 186 EXTRN MONTH_TABLE:WORD 187 EXTRN DAYCNT2:WORD 188 EXTRN FEB29:BYTE 189 EXTRN TimeToTicks:Word ;indirect intra-segment call address 190 191 ; 192 ; THE K09 REQUIRES THE ROUTINES FOR READING THE CLOCK BECAUSE OF THE SUSPEND/ 193 ; RESUME FACILITY. THE SYSTEM CLOCK NEEDS TO BE RESET AFTER RESUME. 194 ; 195 196 ; THE FOLLOWING ROUTINE IS EXECUTED AT RESUME TIME WHEN THE SYSTEM 197 ; POWERED ON AFTER SUSPENSION. IT READS THE REAL TIME CLOCK AND 198 ; RESETS THE SYSTEM TIME AND DATE, AND THEN IRETS. 199 200 relocated i6C 201 INT6C PROC FAR 202 assume ds:nothing, es:nothing, ss:nothing 0 00009DDC E8[0000] call biocode_get_ds_dosbiodata 204 assume ds:DOSGROUP 205 0 00009DDF E80C00 CALL near_read_real_date ; GET THE DATE FROM THE CLOCK 0 00009DE2 8936[0000] MOV [DAYCNT],SI ; UPDATE DOS COPY OF DATE 0 00009DE6 E8BC00 CALL near_read_real_time ; GET THE TIME FROM THE RTC 209 ;SB33019*************************************************************** 0 00009DE9 B401 MOV AH, 01h ; COMMAND TO SET THE TIME ;SB;3.30 0 00009DEB CD1A INT 1Ah ; CALL ROM-BIOS TIME ROUTINE ;SB;3.30 212 ;SB33019*************************************************************** 0 00009DED CF iret 214 215 INT6C ENDP 216 217 218 ;=== Push trace listing source: readcloc.nas 219 %include "readcloc.nas" ; NASM included file 1 <1> ; SCCSID = @(#)readclock.asm 1.2 85/07/25 2 <1> ;************************************************************************ 3 <1> ; 4 <1> ; read_real_date reads real-time clock for date and returns the number 5 <1> ; of days elapsed since 1-1-80 in si 6 <1> ; 7 <1> ; INP: ds => DOSBIODATA 8 <1> near_read_real_date: ;mjb002 9 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 0 00009DEE 50 PUSH AX 0 00009DEF 51 PUSH CX 0 00009DF0 52 PUSH DX 0 00009DF1 30E4 XOR AH,AH ; throw away clock roll over ;3.30* 0 00009DF3 CD1A INT 1AH ;3.30* 0 00009DF5 5A POP DX 0 00009DF6 59 POP CX 0 00009DF7 58 POP AX 18 <1> 0 00009DF8 50 PUSH AX 0 00009DF9 53 PUSH BX 0 00009DFA 51 PUSH CX 0 00009DFB 52 PUSH DX 0 00009DFC C706[0000]0100 MOV word [DAYCNT2],1 ;MJB002 REAL TIME CLOCK ERROR FLAG (+1 DA;3.30Y) 0 00009E02 B404 mov ah,4 ;mjb002 read date function code ;3.30* 0 00009E04 CD1A int 1ah ;mjb002 read real-time clock ;3.30* 0 00009E06 7303 jnc .read_ok ;mjb002 jmp success 0 00009E08 E98B00 jmp r_d_ret ;mjb002 jmp error 28 <1> .read_ok: ;mjb002 ******* get bcd values in binary ***** 29 <1> bin_date_time equ BIN_DATE_TIME ; NASM port label 0 00009E0B 882E[0000] mov byte ptr [bin_date_time+0],ch ;mjb002 store as hex value 0 00009E0F 880E[0100] mov byte ptr [bin_date_time+1],cl ;mjb002 ... 0 00009E13 8836[0200] mov byte ptr [bin_date_time+2],dh ;mjb002 ... 0 00009E17 8816[0300] mov byte ptr [bin_date_time+3],dl ;mjb002 ... 0 00009E1B C706[0000]0200 MOV word [DAYCNT2],2 ;MJB002 READ OF R-T CLOCK SUCCESSFUL ;3.30 0 00009E21 E84B01 call bcd_verify ;mjb002 verify bcd values in range 0 00009E24 7270 jc r_d_ret ;mjb002 jmp some value out of range 0 00009E26 C706[0000]0300 MOV word [DAYCNT2],3 ;MJB002 READ OF R-T CLOCK SUCCESSFUL ;3.30 0 00009E2C E8E900 call date_verify ;mjb002 verify date values in range 0 00009E2F 7265 jc r_d_ret ;mjb002 jmp some value out of range 0 00009E31 C706[0000]0000 MOV word [DAYCNT2],0 ;MJB002 VERIFY SUCCESSFUL ;3.30;3.30 0 00009E37 E8A300 call in_bin ;mjb002 convert date to binary 42 <1> ;mjb002 ******* years since 1-1-80 ********* 0 00009E3A A0[0100] mov al,byte ptr [bin_date_time+1] ;mjb002 get years into century 0 00009E3D 98 cbw ;mjb002 0 00009E3E 803E[0000]14 cmp byte [bin_date_time+0],20 ;mjb002 20th century? 0 00009E43 7503 jnz century_19 ;mjb002 jmp no 0 00009E45 83C064 add ax,100 ;mjb002 add in a century 48 <1> century_19: ;mjb002 0 00009E48 83E850 sub ax,80 ;mjb002 subtract off 1-1-80 0 00009E4B B104 mov cl,4 ;mjb002 leap year every 4 0 00009E4D F6F1 div cl ;mjb002 al= # leap year blocks, ah= remainder 0 00009E4F 88E3 mov bl,ah ;mjb002 save odd years 0 00009E51 98 cbw ;mjb002 zero ah 0 00009E52 B9B505 mov cx,366+3*365 ;mjb002 # of days in leap year blocks 0 00009E55 F7E1 mul cx ;mjb002 dx:ax is result 0 00009E57 A3[0000] MOV [DAYCNT2],AX ;MJB002 SAVE COUNT OF DAYS ;3.30 0 00009E5A 88D8 mov al,bl ;mjb002 get odd years count 0 00009E5C 98 cbw ;mjb002 0 00009E5D 09C0 or ax,ax ;mjb002 is ax= 0? 0 00009E5F 740B jz leap_year ;mjb002 jmp if none 0 00009E61 B96D01 mov cx,365 ;mjb002 days in year 0 00009E64 F7E1 mul cx ;mjb002 dx:ax is result 0 00009E66 0106[0000] ADD [DAYCNT2],AX ;MJB002 ADD ON DAYS IN ODD YEARS ;3.30 0 00009E6A EB07 jmp short leap_adjustment ;mjb002 account for leap year 65 <1> leap_year: ;mjb002 possibly account for a leap day 0 00009E6C 803E[0200]02 cmp byte [bin_date_time+2],2 ;mjb002 is month february 0 00009E71 7604 jbe no_leap_adjustment ;mjb002 jan or feb. no leap day yet. 68 <1> leap_adjustment: ;mjb002 account for leap day 0 00009E73 FF06[0000] INC word [DAYCNT2] ;MJB002 ... ;3.30 70 <1> no_leap_adjustment: ;mjb002 ******* get days of month ******* 0 00009E77 8A0E[0300] mov cl,byte ptr [bin_date_time+3] ;mjb002 ... 0 00009E7B 30ED xor ch,ch ;mjb002 0 00009E7D 49 dec cx ;mjb002 because of offset from day 1, not day 0 0 00009E7E 010E[0000] ADD [DAYCNT2],CX ;MJB002 ******* GET DAYS IN MONTHS PRECEE;3.30DING ***** 0 00009E82 8A0E[0200] mov cl,byte ptr [bin_date_time+2] ;mjb002 get month 0 00009E86 30ED xor ch,ch ;mjb002 0 00009E88 49 dec cx ;mjb002 january starts at offset 0 0 00009E89 D1E1 shl cx,1 ;mjb002 word offset 79 <1> month_table equ MONTH_TABLE ; NASM port label 0 00009E8B BE[0000] mov si,offset month_table ;mjb002 beginning of month_table 0 00009E8E 01CE add si,cx ;mjb002 point into month table 0 00009E90 8B04 mov ax,word ptr [si];mjb002 get # days in previous months 0 00009E92 0106[0000] ADD [DAYCNT2],AX ;MJB002 ... ;3.30 84 <1> r_d_ret: ;mjb002 0 00009E96 8B36[0000] MOV SI,[DAYCNT2] ;MJB002 RESULT IN SI ;3.30 0 00009E9A 5A POP DX 0 00009E9B 59 POP CX 0 00009E9C 5B POP BX 0 00009E9D 58 POP AX 0 00009E9E C3 ret ;mjb002 91 <1> 92 <1> r_t_retj: 0 00009E9F 31C9 xor cx,cx 0 00009EA1 31D2 xor dx,dx 0 00009EA3 EB37 jmp r_t_ret 96 <1> ; 97 <1> ; Read_Real_Time reads the time from the RTC. on exit, it has the number of 98 <1> ; ticks (at 18.2 ticks per sec.) in CX:DX. 99 <1> ; 100 <1> near_read_real_time: 101 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 0 00009EA5 B402 mov ah,2 ;3.30* 0 00009EA7 CD1A int 1AH ;3.30* 0 00009EA9 72F4 jc r_t_retj 105 <1> oktime: 0 00009EAB 882E[0000] mov byte ptr [bin_date_time],ch ; hours 0 00009EAF 880E[0100] mov byte ptr [bin_date_time+1],cl ; minutes 0 00009EB3 8836[0200] mov byte ptr [bin_date_time+2],dh ; seconds 0 00009EB7 C606[0300]00 mov byte [bin_date_time+3],0 ; unused for time 0 00009EBC E8B000 call bcd_verify 0 00009EBF 72DE jc r_t_retj 0 00009EC1 E89200 call time_verify 0 00009EC4 72D9 jc r_t_retj 0 00009EC6 E81400 call in_bin 0 00009EC9 8A2E[0000] MOV ch,byte ptr [bin_date_time] 0 00009ECD 8A0E[0100] MOV cl,byte ptr [bin_date_time+1] 0 00009ED1 8A36[0200] MOV dh,byte PTR [bin_date_time+2] 0 00009ED5 8A16[0300] MOV dl,byte PTR [bin_date_time+3] 119 <1> message ftestinit,<"Read Time "> 120 <1> mnum ftestinit,cx 121 <1> message ftestinit,<" "> 122 <1> mnum ftestinit,dx 123 <1> message ftestinit, 124 <1> ; get time in ticks in CX:DX 125 <1> extern near_time_to_ticks 0 00009ED9 E8[0000] CALL near_time_to_ticks ;3.30 127 <1> message ftestinit,<"Conv Time "> 128 <1> mnum ftestinit,cx 129 <1> message ftestinit,<" "> 130 <1> mnum ftestinit,dx 131 <1> message ftestinit, 132 <1> r_t_ret: 0 00009EDC C3 ret 134 <1> 135 <1> ; 136 <1> ; in_bin converts bin_date_time values from bcd to bin 137 <1> ; 138 <1> in_bin: ;mjb002 139 <1> assume ds:DOSGROUP, es:nothing, ss:nothing 0 00009EDD A0[0000] mov al,byte ptr [bin_date_time+0] ; century or hours 0 00009EE0 E81F00 call bcd_to_bin ; ... 0 00009EE3 A2[0000] mov byte ptr [bin_date_time+0],al ; 0 00009EE6 A0[0100] mov al,byte ptr [bin_date_time+1] ; years or minutes 0 00009EE9 E81600 call bcd_to_bin ; ... 0 00009EEC A2[0100] mov byte ptr [bin_date_time+1],al ; 0 00009EEF A0[0200] mov al,byte ptr [bin_date_time+2] ; months or seconds 0 00009EF2 E80D00 call bcd_to_bin ; ... 0 00009EF5 A2[0200] mov byte ptr [bin_date_time+2],al ; 0 00009EF8 A0[0300] mov al,byte ptr [bin_date_time+3] ; days (not used for time) 0 00009EFB E80400 call bcd_to_bin ; ... 0 00009EFE A2[0300] mov byte ptr [bin_date_time+3],al ; 0 00009F01 C3 ret ; 153 <1> ; 154 <1> ; bcd_to_bin converts two bcd nibbles in al (value <= 99.) to 155 <1> ; a binary representation in al 156 <1> ; ah is destroyed 157 <1> ; 158 <1> bcd_to_bin: ;mjb002 159 <1> assume ds:nothing, es:nothing, ss:nothing 0 00009F02 88C4 mov ah,al ;mjb002 copy bcd number to ah 0 00009F04 250FF0 and ax,0f00fh ;mjb002 clear unwanted nibbles 0 00009F07 88C3 mov bl,al ;mjb002 save units place 0 00009F09 86E0 xchg ah,al ;mjb002 10's place to al 0 00009F0B 30E4 xor ah,ah ;mjb002 ah not wanted 0 00009F0D B104 mov cl,4 ;mjb002 shift count 0 00009F0F D3E8 shr ax,cl ;mjb004 swap nibbles 0 00009F11 B10A mov cl,10 ;mjb002 convert al to ... 0 00009F13 F6E1 mul cl ;mjb002 ... its binary value 0 00009F15 00D8 add al,bl ;mjb002 add in units 0 00009F17 C3 ret ;mjb002 220 ;=== Pop trace listing source 221 ;=== Push trace listing source: clocksub.nas 222 %include "clocksub.nas" ; NASM included file 1 <1> ; 2 <1> ; date_verify loosely checks bcd date values to be in range in bin_date_time 3 <1> ; 4 <1> date_verify: ; 5 <1> assume ds:DOSGROUP,es:nothing,ss:nothing 0 00009F18 803E[0000]20 cmp byte [bin_date_time+0],20h ; century check 0 00009F1D 7735 ja date_error ; jmp error 0 00009F1F 740E jz century_20 ; jmp in 20th century 0 00009F21 803E[0000]19 cmp byte [bin_date_time+0],19h ; century check 0 00009F26 722C jb date_error ; jmp error 0 00009F28 803E[0100]80 cmp byte [bin_date_time+1],80h ; year check 0 00009F2D 7225 jb date_error ; jmp error 13 <1> century_20: ; 0 00009F2F 803E[0100]99 cmp byte [bin_date_time+1],99h ; year check 0 00009F34 771E ja date_error ; jmp error 0 00009F36 803E[0200]12 cmp byte [bin_date_time+2],12h ; month check 0 00009F3B 7717 ja date_error ; jmp error 0 00009F3D 803E[0200]00 cmp byte [bin_date_time+2],00h ; month check 0 00009F42 7610 jbe date_error ; jmp error 0 00009F44 803E[0300]31 cmp byte [bin_date_time+3],31h ; day check 0 00009F49 7709 ja date_error ; jmp error 0 00009F4B 803E[0300]00 cmp byte [bin_date_time+3],00h ; day check 0 00009F50 7602 jbe date_error ; jmp error 0 00009F52 F8 clc ; set success flag 0 00009F53 C3 ret ; 26 <1> date_error: ; 0 00009F54 F9 stc ; set error flag 0 00009F55 C3 ret ; 29 <1> 30 <1> ; 31 <1> ; time_verify very loosely checks bcd date values to be in range in bin_date_time 32 <1> ; 33 <1> time_verify: 34 <1> assume ds:DOSGROUP,es:nothing,ss:nothing 0 00009F56 803E[0000]24 cmp byte [bin_date_time+0],24H 0 00009F5B 7710 ja time_error 0 00009F5D 803E[0100]59 cmp byte [bin_date_time+1],59H 0 00009F62 7709 ja time_error 0 00009F64 803E[0200]59 cmp byte [bin_date_time+2],59H 0 00009F69 7702 ja time_error 0 00009F6B F8 clc 0 00009F6C C3 ret 43 <1> time_error: 0 00009F6D F9 stc 0 00009F6E C3 ret 46 <1> 47 <1> ; 48 <1> ; bcd_verify checks values in bin_date_time to be valid 49 <1> ; bcd numerals. carry set if any nibble out of range 50 <1> ; 51 <1> bcd_verify: ; 52 <1> assume ds:DOSGROUP,es:nothing,ss:nothing 0 00009F6F B90400 mov cx,4 ; 4 bytes to check 0 00009F72 BB[0000] mov bx,offset bin_date_time ; access with ds 55 <1> bv_loop: ; 0 00009F75 8A07 mov al,[bx] ; get a bcd number (0..99) 0 00009F77 88C4 mov ah,al ; 0 00009F79 250FF0 and ax,0f00fh ; 10's place in high ah, 1's in al 0 00009F7C 3C0A cmp al,10 ; is 1's place in range? 0 00009F7E 7716 ja bv_error ; jmp out of range 0 00009F80 D0EC shr ah,1 ; swap nibbles 0 00009F82 D0EC shr ah,1 ; ... 0 00009F84 D0EC shr ah,1 ; ... 0 00009F86 D0EC shr ah,1 ; ... 0 00009F88 80E40F and ah,0fh ; get rid of any erroneous bits 0 00009F8B 80FC0A cmp ah,10 ; is 10's place in range 0 00009F8E 7706 ja bv_error ; jmp out of range 0 00009F90 43 inc bx ; next byte 0 00009F91 49 dec cx ; 0 00009F92 75E1 jnz bv_loop ; 0 00009F94 F8 clc ; set success flag 0 00009F95 C3 ret ; 73 <1> bv_error: ; 0 00009F96 F9 stc ; set error flag 0 00009F97 C3 ret ; 76 <1> ; 77 <1> ; Dos 3.30 - The real time clock structures were moved to msbio2.asm 78 <1> ; 223 ;=== Pop trace listing source 224 225 === Switch to base=000000h -> "DOSENTRY" 226 usesection DOSENTRY 227 228 ;********************************************************* 229 ; SYSTEM INITIALIZATION 230 ; 231 ; THE ENTRY CONDITIONS ARE ESTABLISHED BY THE BOOTSTRAP 232 ; LOADER AND ARE CONSIDERED UNKNOWN. THE FOLLOWING JOBS 233 ; WILL BE PERFORMED BY THIS MODULE: 234 ; 235 ; 1. ALL DEVICE INITIALIZATION IS PERFORMED 236 ; 2. A LOCAL STACK IS SET UP AND DS:SI ARE SET 237 ; TO POINT TO AN INITIALIZATION TABLE. THEN 238 ; AN INTER-SEGMENT CALL IS MADE TO THE FIRST 239 ; BYTE OF THE DOS 240 ; 3. ONCE THE DOS RETURNS FROM THIS CALL THE DS 241 ; REGISTER HAS BEEN SET UP TO POINT TO THE START 242 ; OF FREE MEMORY. THE INITIALIZATION WILL THEN 243 ; LOAD THE COMMAND PROGRAM INTO THIS AREA 244 ; BEGINNING AT 100 HEX AND TRANSFER CONTROL TO 245 ; THIS PROGRAM. 246 ; 247 ;******************************************************** 248 249 ; FIRST LOCATION OF FREEABLE SPACE (?) 250 ; This is the same offset in DOSENTRY as ENDATROM. 251 EVENB 0 0000062E 00 checkdebugger: db 0 253 === Switch to base=000E00h -> "DOSDATAMCB" 254 addsection DOSDATAMCB, PUBLIC class=DOSDATAMCB align=16 === Switch to base=00C3F0h -> "SYSINITMCB" 255 addsection SYSINITMCB, PUBLIC class=SYSINITMCB align=16 === Switch to base=00C400h -> "SYSINITSEG" 256 addsection SYSINITSEG, PUBLIC class=INIT 256 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] === Switch to base=00C400h -> "SYSINITTRAIL" 257 addsection SYSINITTRAIL, PUBLIC class=INIT align=2 === Switch to base=00C400h -> "SYSINITLAST" 258 addsection SYSINITLAST, PUBLIC class=INIT align=2 259 260 group SYSINITGROUP SYSINITSEG SYSINITTRAIL SYSINITLAST 261 === Switch to base=00C400h -> "SYSINITTRAIL" 262 usesection SYSINITTRAIL 263 264 align 2, db 0 0 000038E8 00000000 nextupb: dd 0 266 auxbuff_segorsel: 0 000038EC ???? Init_BootSeg: dw ? ; seg addr of buffer for reading boot record 0 000038EE 00 FakeFloppyDrv: db 0 ; If 1, then No diskette drives in the system. 0 000038EF 00 FBIGFAT: db 0 ; FLAGS FOR DRIVE 270 271 evenb 272 BDS_diskette_template: 0 000038F0 FFFFFFFF dw -1, -1 ;LINK TO NEXT STRUCTURE 0 000038F4 00 DB 0 ;INT 13 DRIVE NUMBER 0 000038F5 00 DB 0 ;LOGICAL DRIVE LETTER 0 000038F6 0002 DW 512 ;PHYSICAL SECTOR SIZE IN BYTES 0 000038F8 FF DB -1 ;SECTORS/ALLOCATION UNIT 0 000038F9 0100 DW 1 ;RESERVED SECTORS FOR DOS 0 000038FB 02 DB 2 ;NO. ALLOCATION TABLES 0 000038FC 4000 DW 64 ;NUMBER DIRECTORY ENTRIES 0 000038FE 6801 DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.) 0 00003900 00 DB 00000000B ;MEDIA DESCRIPTOR, INITIALLY 00H. 0 00003901 0200 DW 2 ;NUMBER OF FAT SECTORS 0 00003903 0900 DW 9 ;SECTOR LIMIT 0 00003905 0100 DW 1 ;HEAD LIMIT 0 00003907 0000 DW 0 ;HIDDEN SECTOR COUNT (low word) 0 00003909 0000 dw 0 ;J.K. Hidden sector (high) 0 0000390B 0000 dw 0 ;J.K. Number sectors (low) 0 0000390D 0000 dw 0 ;J.K. Number sectors (high) 0 0000390F 00 DB 0 ; TRUE => LARGE FATS 0 00003910 0000 DW 0 ;OPEN REF. COUNT 292 0 00003912 03 DB 3 ;FORM FACTOR 0 00003913 2000 DW 0020H ;VARIOUS FLAGS 295 ; DB 9 DUP (0) ;RESERVED FOR FUTURE USE 0 00003915 2800 DW 40 ; NUMBER OF CYLINDERS 297 ; RECOMMENDED BPB FOR DRIVE. 0 00003917 0002 DW 512 ;BYTES PER SECTOR 0 00003919 01 DB 1 ;SECTORS/ALLOCATION UNIT 0 0000391A 0100 DW 1 ;RESERVED SECTORS FOR DOS 0 0000391C 02 DB 2 ;NO. ALLOCATION TABLES 0 0000391D E000 DW 0E0H ;NUMBER DIRECTORY ENTRIES 0 0000391F 6801 DW 9*40 ;NUMBER SECTORS (AT 512 BYTES EA.) 0 00003921 F0 DB 0F0H ;MEDIA DESCRIPTOR, INITIALLY F0H. 0 00003922 0200 DW 2 ;NUMBER OF FAT SECTORS 0 00003924 0900 DW 9 ;SECTOR LIMIT 0 00003926 0200 DW 2 ;HEAD LIMIT 0 00003928 0000 DW 0 ;HIDDEN SECTOR COUNT(low) 0 0000392A 0000 dw 0 ;J.K. Hidden sector count (high) 0 0000392C 0000 dw 0 ;J.K. Number sectors (low) 0 0000392E 0000 dw 0 ;J.K. Number sectors (high) 0 00003930 ???????????? DB 6 DUP (?) 0 00003936 FF DB -1 ;LAST TRACK ACCESSED ON THIS DRIVE 0 00003937 FFFF DW -1 ;KEEP THESE TWO CONTIGUOUS (?) 0 00003939 FFFF DW -1 0 0000393B 4E4F204E414D452020 DB "NO NAME ",0 ;VOLUME ID FOR THIS DISK 0 00003944 202000 0 00003947 00000000 dd 0 ;Current volume serial number from Boot record 0 0000394B 464154313220202000 db "FAT12 ",0 ;Current file system id from Boot record 319 320 evenb 321 ; THE FOLLOWING TWO BYTES ARE USED TO SAVE THE INFO RETURNED BY INT 13, AH = 8 322 ; CALL TO DETERMINE DRIVE PARAMETERS. 0 00003954 0200 NUM_HEADS dw 2 ; NUMBER OF HEADS RETURNED BY ROM 0 00003956 09 SEC_TRK DB 9 ; SEC/TRK RETURNED BY ROM 0 00003957 28 NUM_CYLN DB 40 ; NUMBER OF CYLINDERS RETURNED BY ROM 326 327 328 EXT_BOOT_SIG_OFF equ 11+BPB_TYPE_struc_size ;AN000; 3 byte jmp+8 byte OEM +extended bpb 329 330 331 EVENB 0 00003958 0002000140000000 DISKTABLE DW 512, 0100H, 64, 0 0 00003960 0008010270000000 DW 2048, 0201H, 112, 0 0 00003968 0020020400010000 DW 8192, 0402H, 256, 0 0 00003970 A87F030800020000 DW 32680, 0803H, 512, 0 ;Warning !!! Old values 336 ; DW 20740, 0803H, 512, 0 ;PTM P892 J.K. 12/3/86 DOS 3.3 will use this. 337 ;J.K.3/16/87 P54 Return back to old value for compatibility.!!! 0 00003978 FFFF041000040000 DW 65535, 1004H, 1024, 0 339 340 ;DISKTABLE2 DW 32680, 0803H, 512, 0 ;Warning !!! Old values ;J.K.3/16/87 P54 Return to old value!!! 341 ;DISKTABLE2 DW 20740, 0803H, 512, 0 ;PTM p892 J.K. 12/3/86 DOS 3.3 will use this. 342 ; DW 65535, 0402H, 512, FBIG 343 ;AN000; 344 ;DISKTABLE2 dw 0, 32680, 0803h, 512, 0 ;table with the assumption of the 345 ; dw 2h, 0000h, 0402h, 512, FBIG ;total fat size <= 64KB. 346 ; dw 4h, 0000h, 0803h, 512, FBIG ;-This will cover upto 134 MB 347 ; dw 8h, 0000h, 1004h, 512, FBIG ;-This will cover upto 268 MB 348 ; dw 10h, 0000h, 2005h, 512, FBIG ;-This will cover upto 536 MB 349 350 ;AN004 Default DiskTable under the assumption of Total FAT size <= 128 KB, and 351 ; the maxium size of FAT entry = 16 Bit. 0 00003980 0000A87F0308000200 DiskTable2 dw 0, 32680, 0803h, 512, 0 ;For compatibility. 0 00003989 00 0 0000398A 040000000204000240 dw 4h, 0000h, 0402h, 512, FBIG ;Covers upto 134 MB media. 0 00003993 00 0 00003994 080000000308000240 dw 8h, 0000h, 0803h, 512, FBIG ; upto 268 MB 0 0000399D 00 0 0000399E 100000000410000240 dw 10h, 0000h, 1004h, 512, FBIG ; upto 536 MB 0 000039A7 00 0 000039A8 200000000520000240 dw 20h, 0000h, 2005h, 512, FBIG ; upto 1072 MB 0 000039B1 00 0 000039B2 400000000640000240 dw 40h, 0000h, 4006h, 512, FBIG ; upto 2144 MB 0 000039BB 00 0 000039BC 800000000780000240 dw 80h, 0000h, 8007h, 512, FBIG ; upto 4288 MB... 0 000039C5 00 359 360 align 2, db 0 0 000039C6 [E000] Mini_BPB_ptr dw DSKDRVS ;temporary variable used to save the 362 ;Mini Disk BPB pointer address in DskDrvs. 0 000039C8 0000 DSKDRVS times 32 dw 0 364 .end: 0 00003A08 0000 dw 0 ; allow overflowing entry 366 367 === Switch to base=000000h -> "DOSENTRY" 368 usesection DOSENTRY 369 0 0000062F 30312F31302F383400 BIOS_DATE DB '01/10/84',0 ;This is used for checking AT ROM BIOS date. 371 372 === Switch to base=00C400h -> "SYSINITTRAIL" 373 usesection SYSINITTRAIL 374 375 ; THE FOLLOWING ARE THE RECOMMENDED BPBS FOR THE MEDIA THAT WE KNOW OF SO 376 ; FAR. 377 378 ; 48 TPI DISKETTES 379 EVENB 0 00003A0A 0002 BPB48T DW 512 0 00003A0C 02 DB 2 0 00003A0D 0100 DW 1 0 00003A0F 02 DB 2 0 00003A10 7000 DW 112 0 00003A12 D002 DW 2*9*40 0 00003A14 FD DB 0FDH 0 00003A15 0200 DW 2 0 00003A17 0900 DW 9 0 00003A19 0200 DW 2 0 00003A1B 0000 DW 0 0 00003A1D 0000 dw 0 ;AN000; hidden sector High 0 00003A1F 00000000 dd 0 ;AN000; extended total sectors 393 394 ; 96TPI DISKETTES 0 00003A23 00 EVENB 0 00003A24 0002 BPB96T DW 512 0 00003A26 01 DB 1 0 00003A27 0100 DW 1 0 00003A29 02 DB 2 0 00003A2A E000 DW 224 0 00003A2C 6009 DW 2*15*80 0 00003A2E F9 DB 0F9H 0 00003A2F 0700 DW 7 0 00003A31 0F00 DW 15 0 00003A33 0200 DW 2 0 00003A35 0000 DW 0 0 00003A37 0000 dw 0 ;AN000; hidden sector High 0 00003A39 00000000 dd 0 ;AN000; extended total sectors 409 410 BPBSIZ equ $-BPB96T 411 412 ; 3 1/2 INCH DISKETTE BPB 413 0 00003A3D 00 EVENB 0 00003A3E 0002 BPB35 DW 512 0 00003A40 02 DB 2 0 00003A41 0100 DW 1 ; DOUBLE SIDED WITH 9 SEC/TRK 0 00003A43 02 DB 2 0 00003A44 7000 DW 70h 0 00003A46 A005 DW 2*9*80 0 00003A48 F9 DB 0F9H 0 00003A49 0300 DW 3 0 00003A4B 0900 DW 9 0 00003A4D 0200 DW 2 0 00003A4F 0000 DW 0 0 00003A51 0000 dw 0 ;AN000; hidden sector High 0 00003A53 00000000 dd 0 ;AN000; extended total sectors 428 0 00003A57 00 EVENB 0 00003A58 [2201] BPBTABLE DW BPB48T ; 48TPI DRIVES 0 00003A5A [3C01] DW BPB96T ; 96TPI DRIVES 0 00003A5C [5601] DW BPB35 ; 3.5" DRIVES 433 ;DW BPB48T ; NOT USED - 8" DRIVES 434 ;DW BPB48T ; NOT USED - 8" DRIVES 435 ;DW BPB48T ; NOT USED - HARD FILES 436 ;DW BPB48T ; NOT USED - TAPE DRIVES 437 ;DW BPB48T ; NOT USED - OTHER 438 === Switch to base=000000h -> "DOSENTRY" 439 usesection DOSENTRY 440 441 %if 0 442 align 2, db 0 443 PATCHTABLE LABEL BYTE 444 DW 10,MEDIA_PATCH 445 DW 3,GETBP1_PATCH 446 DW 3,SET_PATCH 447 DW 3,DISKIO_PATCH 448 DW 3,DSKERR_PATCH 449 DW 3,DSKERR_LBA_PATCH 450 DW 3,CHANGED_PATCH 451 DW 3,INIT_PATCH 452 DW 0 453 %endif 454 455 ASSUME DS:NOTHING,ES:NOTHING 456 457 ; INP: from lkernpl 458 ; cx:di -> lCFG block passed from drkernpl or inicomp 459 ; dl = load unit 460 ; ds:bp = ss:bp -> load partition boot sector with (E)BPB 461 PUBLIC INIT 462 INIT PROC NEAR 463 MESSAGE FTESTINIT,<"IBMBIO",CR,LF> 0 00000638 FA CLI 465 assume ds:nothing, es:nothing, ss:nothing 466 467 ; Get lCFG items to use later. 0 00000639 8EC1 mov es, cx 469 assume es:nothing 0 0000063B 268A4514 mov al, byte [es:di + LCFG_CheckDebugger] 0 0000063F 2EA2[0000] mov byte [cs:checkdebugger], al 0 00000643 26FF7516 push word [es:di + LCFG_ScanMode] 473 474 ; init pointers needed by relocation (i13 etc) 0 00000647 31C0 xor ax, ax 0 00000649 8ED8 mov ds, ax 477 assume ds:IVT 0 0000064B B8[0000] mov ax, DOSSTART 0 0000064E A3C600 mov word [31h * 4 + 2], ax 0 00000651 8ED8 mov ds, ax 481 assume ds:DOSGROUP 0 00000653 C706[0000][0000] mov word [dosdata_to_doscode], DOSCODEGROUP 0 00000659 B8[0000] mov ax, DOSENTRY 0 0000065C 8ED8 mov ds, ax 485 assume ds:DOSENTRYGROUP 486 extern ..@dosentry_doscode_segment 0 0000065E C706[0000][0000] mov word [..@dosentry_doscode_segment], DOSCODEGROUP 488 489 490 extern sysinit_bootdrive_hidden, sysinit_bootdrive_unit 491 492 init_bootdrive: 0 00000664 B8[0000] mov ax, SYSINITSEG 0 00000667 8EC0 mov es, ax ; modified to use ax 495 ; (preserve dl = load unit) 496 assume es:SYSINITGROUP 0 00000669 268F06[0000] pop word [es:load_mode] 498 0 0000066E 8B461E mov ax, word [bp + bsBPB + bpbHiddenSectors + 2] 0 00000671 26A3[0200] mov word [es:sysinit_bootdrive_hidden + 2], ax 0 00000675 8B461C mov ax, word [bp + bsBPB + bpbHiddenSectors] 0 00000678 26A3[0000] mov word [es:sysinit_bootdrive_hidden], ax 0 0000067C 268816[0000] mov byte [es:sysinit_bootdrive_unit], dl 504 505 506 extern kernelcommandline 507 extern kernelcommandline.end 508 extern commandnames 509 510 ; copied from ecm contribution to FreeDOS kernel.asm 511 initialise_command_line_buffer: 0 00000681 89E0 mov ax, sp ; ax = original sp 0 00000683 16 push ss 0 00000684 1F pop ds 515 assume ds:nothing 0 00000685 89EE mov si, bp ; ds:si = original ss:bp 517 518 ; Note that the kernel command line buffer in 519 ; the init data segment is pre-initialised to 520 ; hold 0x00 0xFF in the first two bytes. This 521 ; is used to indicate no command line present, 522 ; as opposed to an empty command line which 523 ; will hold 0x00 0x00. 524 ; If any of the branches to .none are taken then 525 ; the buffer is not modified so it retains the 526 ; 0x00 0xFF contents. 0 00000687 81FE1401 cmp si, - lsvCommandLine.start ; buffer fits below ss:bp ? 0 0000068B 7222 jb .none ; no --> 0 0000068D 817CEC434C cmp word [si + lsvCommandLine.signature], lsvclSignature 530 ; signature passed to us ? 0 00000692 751B jne .none ; no --> 0 00000694 8DB4ECFE lea si, [si + lsvCommandLine.start] 533 ; -> command line buffer 0 00000698 39F0 cmp ax, si ; stack top starts below-or-equal buffer ? 0 0000069A 7713 ja .none ; no --> 0 0000069C BF[0000] mov di, kernelcommandline ; our buffer 0 0000069F B9FF00 mov cx, lsvclBufferLength - 1 0 000006A2 31C0 xor ax, ax 0 000006A4 57 push di 0 000006A5 F3A4 rep movsb ; copy up to 255 bytes 0 000006A7 AA stosb ; truncate 0 000006A8 5F pop di 0 000006A9 B501 mov ch, 1 ; cx = 256 0 000006AB F2AE repne scasb ; scan for terminator 0 000006AD F3AA rep stosb ; clear remainder of buffer 546 ; (make sure we do not have 0x00 0xFF 547 ; even if the command line given is 548 ; actually the empty string) 549 .none: 550 551 552 init_cmdline_terminators: 0 000006AF 06 push es 0 000006B0 1F pop ds 555 assume ds:SYSINITGROUP 556 0 000006B1 BF[0000] mov di, kernelcommandline 0 000006B4 89FE mov si, di 0 000006B6 B90001 mov cx, 256 0 000006B9 31C0 xor ax, ax 0 000006BB F2AE repne scasb 0 000006BD 4F dec di 0 000006BE 893E[0000] mov word [kernelcommandline.end], di 0 000006C2 89F7 mov di, si ; -> start 0 000006C4 56 push si 566 @@: 0 000006C5 3B36[0000] cmp si, word [kernelcommandline.end] 0 000006C9 7314 jae @F 0 000006CB AC lodsb ; get text 0 000006CC AA stosb ; store text 0 000006CD 3C3B cmp al, ';' ; was semicolon ? 0 000006CF 75F4 jne @B ; no, loop --> 0 000006D1 803C3B cmp byte [si], ';' ; escaped ? 0 000006D4 7406 je .escapesemicolon ; yes --> 0 000006D6 C645FF00 mov byte [di - 1], 0 ; no, treat as terminator 0 000006DA EBE9 jmp @B 577 578 .escapesemicolon: 0 000006DC 46 inc si ; -> past next semicolon 0 000006DD EBE6 jmp @B 581 582 @@: 0 000006DF A4 movsb ; copy the NUL 0 000006E0 4F dec di ; -> at the NUL 0 000006E1 893E[0000] mov word [kernelcommandline.end], di 586 ; update the end offset (<= before) 0 000006E5 5E pop si 588 589 parse_config: 590 .loopcommand: 0 000006E6 A8 db __TEST_IMM8 ; skip inc 592 @@: 0 000006E7 46 inc si 0 000006E8 803C20 cmp byte [si], 32 0 000006EB 74FA je @B 0 000006ED 803C09 cmp byte [si], 9 0 000006F0 74F5 je @B 598 0 000006F2 803C00 cmp byte [si], 0 ; empty ? 0 000006F5 7503E9A100 je .donename ; yes --> 601 0 000006FA BF[0000] mov di, commandnames 603 .loopname: 0 000006FD 8B05 mov ax, [di] 0 000006FF 40 inc ax 0 00000700 7435 jz .unknownname 0 00000702 AF scasw ; skip function pointer field 0 00000703 AF scasw ; skip content field 0 00000704 56 push si 0 00000705 50 push ax 0 00000706 57 push di 0 00000707 8B3D mov di, [di] 613 .comparename: 0 00000709 AC lodsb 0 0000070A 3C00 cmp al, 0 0 0000070C 7423 je .next 0 0000070E 3C61 cmp al, 'a' 0 00000710 7206 jb @F 0 00000712 3C7A cmp al, 'z' 0 00000714 7702 ja @F 0 00000716 2C20 sub al, 20h 622 @@: 0 00000718 AE scasb 0 00000719 7516 jne .next 0 0000071B 803D00 cmp byte [di], 0 0 0000071E 75E9 jne .comparename 0 00000720 AC lodsb 0 00000721 3C00 cmp al, 0 0 00000723 7458 je .found 0 00000725 3C20 cmp al, 32 0 00000727 7454 je .found 0 00000729 3C09 cmp al, 9 0 0000072B 7450 je .found 0 0000072D 3C3D cmp al, '=' 0 0000072F 744C je .found 636 .next: 0 00000731 5F pop di 0 00000732 58 pop ax 0 00000733 5E pop si 0 00000734 AF scasw ; skip name field 0 00000735 EBC6 jmp .loopname 642 643 .unknownname: 0 00000737 56 push si 645 646 extern unknown_command 0 00000738 BE[0000] mov si, unknown_command 0 0000073B BB0700 mov bx, 7 0 0000073E A9 db __TEST_IMM16 ; skip int 650 @@: 0 0000073F CD10 int 10h 0 00000741 AC lodsb 0 00000742 B40E mov ah, 0Eh 0 00000744 84C0 test al, al 0 00000746 75F7 jnz @B 0 00000748 5E pop si 0 00000749 56 push si 658 @@: 0 0000074A AC lodsb 0 0000074B 3C09 cmp al, 9 0 0000074D 74FB je @B 0 0000074F 3C20 cmp al, 32 0 00000751 74F7 je @B 0 00000753 4E dec si 0 00000754 A9 db __TEST_IMM16 ; skip int 666 @@: 0 00000755 CD10 int 10h 0 00000757 AC lodsb 0 00000758 B40E mov ah, 0Eh 0 0000075A 84C0 test al, al 0 0000075C 740C jz @F 0 0000075E 3C20 cmp al, 32 0 00000760 7204 jb .ctrl 0 00000762 3C7F cmp al, 127 0 00000764 72EF jb @B 676 .ctrl: 0 00000766 B02E mov al, '.' 0 00000768 EBEB jmp @B 679 @@: 0 0000076A 5E pop si 0 0000076B B8220E mov ax, 0E00h + '"' 0 0000076E CD10 int 10h 0 00000770 B80D0E mov ax, 0E00h + 13 0 00000773 CD10 int 10h 0 00000775 B80A0E mov ax, 0E00h + 10 0 00000778 CD10 int 10h 0 0000077A EB1F jmp .donename 688 689 @@: 0 0000077C AC lodsb 691 .found: 0 0000077D 3C20 cmp al, 32 0 0000077F 74FB je @B 0 00000781 3C09 cmp al, 9 0 00000783 74F7 je @B 0 00000785 3C3D cmp al, '=' 0 00000787 7501 jne @FF 698 @@: 0 00000789 AC lodsb 700 @@: 0 0000078A 3C20 cmp al, 32 0 0000078C 74FB je @BB 0 0000078E 3C09 cmp al, 9 0 00000790 74F7 je @BB 705 0 00000792 4E dec si ; -> content 0 00000793 5F pop di 0 00000794 8975FE mov word [di - 2], si 0 00000797 58 pop ax 710 ; INP: si -> past an optional equals sign and blanks 711 ; di -> -> command name 712 ; CHG: ax, si, di, cx, bx, dx, bp 713 ; STT: ds = es => SYSINIT 714 ; cs => DOSENTRY 0 00000798 FFD0 call ax 0 0000079A 5E pop si 717 .donename: 718 @@: 0 0000079B AC lodsb 0 0000079C 3C00 cmp al, 0 0 0000079E 75FB jne @B 0 000007A0 3B36[0000] cmp si, word [kernelcommandline.end] 0 000007A4 7703E93DFF jbe .loopcommand ; (ZR means an empty command at end) 724 725 726 init_orig13: 0 000007A9 31C0 XOR AX,AX 0 000007AB 8ED8 MOV DS,AX 729 assume ds:IVT 0 000007AD B500 mov ch, 0 731 732 ; 733 ; PRESERVE ORIGINAL INT 13 VECTOR 734 ; WE NEED TO SAVE INT13 IN TWO PLACES IN CASE WE ARE RUNNING ON AN AT. 735 ; ON ATS WE INSTALL THE IBM SUPPLIED ROM_BIOS PATCH DISK.OBJ WHICH HOOKS 736 ; INT13 AHEAD OF ORIG13. SINCE INT19 MUST UNHOOK INT13 TO POINT TO THE 737 ; ROM INT13 ROUTINE, WE MUST HAVE THAT ROM ADDRESS ALSO STORED AWAY. 738 ; 0 000007AF A14C00 MOV AX,[13H*4] 0 000007B2 2EA3[0000] MOV WORD PTR [cs:ORIG13],AX 0 000007B6 A14E00 MOV AX,[13H*4+2] 0 000007B9 2EA3[0200] MOV WORD PTR [cs:ORIG13+2],AX 743 744 init_irt: 745 extern InterruptRestorationTable 0 000007BD 0E push cs 0 000007BE 07 pop es ; => IRT 748 assume es:DOSENTRYGROUP 0 000007BF FC cld 0 000007C0 BE[0000] mov si, InterruptRestorationTable ; access with es 751 .: 0 000007C3 31C0 xor ax, ax 0 000007C5 26AC es lodsb 0 000007C7 3CFF cmp al, -1 0 000007C9 740D je .done 0 000007CB 97 xchg di, ax ; di = interrupt number 0 000007CC 01FF add di, di 0 000007CE 01FF add di, di ; ds:di -> interrupt vector 0 000007D0 87F7 xchg si, di ; es:di -> IRT, ds:si -> vector 0 000007D2 A5 movsw 0 000007D3 A5 movsw 0 000007D4 87F7 xchg si, di 0 000007D6 EBEB jmp . 764 .done: 765 766 ; 767 ; SET UP INT 13 FOR NEW ACTION 768 ; 769 extern msdisk_i13 0 000007D8 C7064C00[0000] MOV WORD PTR [13H*4],OFFSET msdisk_i13 0 000007DE 8C0E4E00 MOV [13H*4+2],CS 772 773 ; 774 ; SET UP INT 19 FOR NEW ACTION 775 ; 776 extern i19 0 000007E2 C7066400[0000] MOV WORD PTR [19H*4],OFFSET i19 0 000007E8 8C0E6600 MOV [19H*4+2],CS 0 000007EC FB STI 0 000007ED CD11 INT 11H ;GET EQUIPMENT STATUS 781 ;J.K.6/24/87 We have to support a system that does not have any diskette 782 ;drives but only hardfiles. This system will IPL from the hardfile. 783 ;If the equipment flag bit 0 is 1, then the system has diskette drive(s). 784 ;Otherwise, the system only have hardfiles. 785 ;Important thing is that still, for compatibility reason, the drive letter 786 ;for the hardfile start from "C". So, we still need to allocate dummy BDS 787 ;drive A and driver B. In SYSINIT time, we are going to set CDS table entry 788 ;of DPB pointer for these drives to 0, so any user attempt to access this 789 ;drives will get "Invalid drive letter ..." message. We are going to 790 ;establish "FAKEFLOPPYDRV" flag. ***SYSINIT module should call INT 11h to check 791 ;if there are any diskette drivers in the system or not.!!!*** 792 793 ;SB34INIT001************************************************************** 794 ;SB check the register returned by the equipment determination interrupt 795 ;SB we have to handle the case of no diskettes in the system by faking 796 ;SB two dummy drives. 797 ;SB if the register indicates that we do have floppy drives we don't need 798 ;SB to do anything special. 799 ;SB if the register indicates that we don't have any floppy drives then 800 ;SB what we need to do is set the FakeFloppyDrv variable, change the 801 ;SB register to say that we do have floppy drives and then go to execute 802 ;SB the code which starts at NOTSINGLE. This is because we can skip the 803 ;SB code given below which tries to find if there are one or two drives 804 ;SB since we already know about this. 6 LOCS 805 0 000007EF A801 test al, 1 0 000007F1 750C jnz DO_FLOPPY 0 000007F3 B8[0000] mov ax, SYSINITSEG 0 000007F6 8ED8 mov ds, ax 810 assume ds:SYSINITGROUP 0 000007F8 B001 mov al, 1 ; set to indicate 2 floppies 0 000007FA A2[0600] mov [FakeFloppyDrv], al ; fake floppy 0 000007FD EB10 jmp short NOTSINGLE 814 815 DO_FLOPPY: 816 817 ;SB34INIT001************************************************************** 818 ; 819 ; Determine if there are one or two diskette drives in system 820 ; 0 000007FF D0C0 ROL AL,1 ;PUT BITS 6 & 7 INTO BITS 0 & 1 0 00000801 D0C0 ROL AL,1 0 00000803 2403 AND al, 3 ;ONLY LOOK AT BITS 0 & 1 0 00000805 7508 JNZ NOTSINGLE ;ZERO MEANS SINGLE DRIVE SYSTEM 0 00000807 40 INC AX ;PRETEND IT'S A TWO DRIVE SYSTEM 0 00000808 E8E804 call dosentry_init_get_ds_dosbiodata 827 assume ds:DOSGROUP 0 0000080B FE06[0000] INC byte [SINGLE] ;REMEMBER THIS 829 NOTSINGLE: 0 0000080F 0E push cs 0 00000810 1F pop ds 832 assume ds:DOSENTRYGROUP 833 0 00000811 40 INC AX ;AX HAS NUMBER OF DRIVES, 2-4 835 ;IS ALSO 0 INDEXED BOOT DRIVE IF WE 836 ; BOOTED OFF HARD FILE 0 00000812 88C1 MOV CL,AL ;CH IS FAT ID, CL # FLOPPIES 0 00000814 F6C280 TEST DL,80H ;BOOT FROM FLOPPY ? 0 00000817 7502 JNZ GOTHRD ;NO. 0 00000819 31C0 XOR AX,AX ;INDICATE BOOT FROM DRIVE A 841 GOTHRD: 842 ; 843 ; AX = 0-BASED DRIVE WE BOOTED FROM 844 ; CL = NUMBER OF FLOPPIES INCLUDING FAKE ONE 845 ; CH = MEDIA BYTE 846 ; 847 MESSAGE FTESTINIT,<"INIT",CR,LF> 0 0000081B 31D2 XOR DX,DX 849 0 0000081D 51 PUSH CX ;SAVE NUMBER OF FLOPPIES AND MEDIA BYTE 0 0000081E 88EC MOV AH,CH ;SAVE FAT ID TO AH 0 00000820 50 PUSH AX ;SAVE BOOT DRIVE NUMBER, AND MEDIA BYTE 853 ;J.K. Let Model_byte, Secondary_Model_Byte be set here!!! 854 ;SB33020****************************************************************** 0 00000821 F9 stc 0 00000822 B4C0 mov ah,0c0h ; return system environment ;SB;3.30 0 00000824 CD15 int 15h ; call ROM-Bios routine ;SB;3.30 858 ;SB33020****************************************************************** 0 00000826 E8CA04 call dosentry_init_get_ds_dosbiodata 860 assume ds:DOSGROUP 0 00000829 7214 jc No_Rom_System_Conf ; just use Model_Byte 0 0000082B 84E4 test ah, ah ; double check 0 0000082D 7510 jnz No_Rom_System_Conf 0 0000082F 268A4702 mov al, [ES:BX + bios_SD_modelbyte] ;get the model byte 0 00000833 A2[0000] mov [Model_Byte], al 0 00000836 268A4703 mov al, [ES:BX + bios_SD_scnd_modelbyte] ;secondary model byte 0 0000083A A2[0000] mov [Secondary_Model_Byte], al 0 0000083D EB0C jmp short Turn_Timer_On 869 No_Rom_System_Conf: 0 0000083F BEFFFF MOV SI,0FFFFH ;MJB001 0 00000842 8EC6 MOV ES,SI ;MJB001 872 assume es:nothing 0 00000844 26A00E00 MOV AL,[ES:0EH] ; GET MODEL BYTE ARR 2.41 874 MODEL_BYTE equ Model_Byte ; NASM port label 0 00000848 A2[0000] MOV [MODEL_BYTE],AL ; SAVE MODEL BYTE ARR 2.41 876 Turn_Timer_On: 0 0000084B B020 MOV AL,EOI 0 0000084D E620 OUT AKPORT,AL ;TURN ON THE TIMER 879 880 ; NOP out the double word MOV instruction in MSDISK, if 881 ; this is not a 386 machine... 882 Get_CPU_Type ; macro to determine cpu type 0 0000084F 9C pushf 0 00000850 53 push bx 0 00000851 31DB xor bx, bx 13 <1> 0 00000853 31C0 xor ax,ax 0 00000855 50 push ax 0 00000856 9D popf 0 00000857 9C pushf 0 00000858 58 pop ax 0 00000859 2500F0 and ax,0F000h 0 0000085C 3D00F0 cmp ax,0F000h 0 0000085F 740E je %%cpu_8086 22 <1> 0 00000861 B800F0 mov ax,0F000h 0 00000864 50 push ax 0 00000865 9D popf 0 00000866 9C pushf 0 00000867 58 pop ax 0 00000868 2500F0 and ax,0F000h 0 0000086B 7401 jz %%cpu_286 30 <1> 31 <1> %%cpu_386: 0 0000086D 43 inc bx 33 <1> %%cpu_286: 0 0000086E 43 inc bx 35 <1> %%cpu_8086: 0 0000086F 89D8 mov ax, bx 0 00000871 5B pop bx 0 00000872 9D popf 0 00000873 3C02 cmp al, 2 ; is it a 386? 0 00000875 7504 jne Skip_Patch_DoubleWordMov; no: skip the patch 885 886 Patch_DoubleWordMov: 887 extern dosbiodata_have_386 0 00000877 F616[0000] not byte [dosbiodata_have_386] ; = 0FFh 889 Skip_Patch_DoubleWordMov: 890 MESSAGE FTESTINIT,<"COM DEVICES",CR,LF> 891 ;SB33IN1********************************************************* 892 0 0000087B BE[0000] mov si,offset COM4DEV 0 0000087E E89E04 call AUX_INIT 0 00000881 BE[0000] mov si,offset COM3DEV 0 00000884 E89804 call AUX_INIT 897 ;SB33IN1********************************************************* 0 00000887 BE[0000] MOV SI,OFFSET COM2DEV 0 0000088A E89204 CALL AUX_INIT ;INIT COM2 0 0000088D BE[0000] MOV SI,OFFSET COM1DEV 0 00000890 E88C04 CALL AUX_INIT ;INIT COM1 902 903 MESSAGE FTESTINIT,<"LPT DEVICES",CR,LF> 0 00000893 BE[0000] MOV SI,OFFSET LPT3DEV 0 00000896 E87E04 CALL PRINT_INIT ;INIT LPT3 0 00000899 BE[0000] MOV SI,OFFSET LPT2DEV 0 0000089C E87804 CALL PRINT_INIT ;INIT LPT2 0 0000089F BE[0000] MOV SI,OFFSET LPT1DEV 0 000008A2 E87204 CALL PRINT_INIT ;INIT LPT1 910 0 000008A5 31D2 XOR DX,DX 0 000008A7 8EDA MOV DS,DX ;TO INITIALIZE PRINT SCREEN VECTOR 0 000008A9 8EC2 MOV ES,DX 914 assume ds:IVT, es:IVT 915 0 000008AB 31C0 XOR AX,AX 0 000008AD BF3405 MOV DI,INITSPOT 0 000008B0 AB STOSW ;INIT FOUR BYTES TO 0 0 000008B1 AB STOSW 920 0 000008B2 8CC8 MOV AX,CS ;FETCH SEGMENT 922 923 extern i1B 0 000008B4 C7066C00[0000] MOV WORD [BRKADR], i1B ;BREAK ENTRY POINT 0 000008BA A36E00 MOV [BRKADR+2],AX ;VECTOR FOR BREAK 926 927 ;*********************************************** ARR 2.15 928 ; SINCE WE'RE FIRST IN SYSTEM, NO NEED TO CHAIN THIS. 929 ; CLI ; ARR 2.15 DON'T GET BLOWN 930 ; MOV DS:WORD PTR TIMADR,OFFSET TIMER ; ARR 2.15 TIMER ENTRY POINT 931 ; MOV DS:TIMADR+2,AX ; ARR 2.15 VECTOR FOR TIMER 932 ; STI 933 ;*********************************************** ARR 2.15 934 935 ; BAS DEBUG 936 extern i29 0 000008BD C706A400[0000] MOV WORD [CHROUT*4], i29 0 000008C3 A3A600 MOV WORD PTR [CHROUT*4+2],AX 939 940 extern entry_iret 941 MESSAGE FTESTINIT,<"INTERRUPT VECTORS",CR,LF> 0 000008C6 BB[0000] MOV BX, entry_iret ;WILL INITIALIZE REST OF INTERRUPTS 943 0 000008C9 BF1000 mov di, 4 * 4 945 0 000008CC 50 push ax ; preserve segment 0 000008CD 53 push bx ; preserve offset 948 debugger_check: 0 000008CE 2EA0[0000] mov al, byte [cs:checkdebugger] 0 000008D2 A804 test al, LCFG_DBG_ONLY_VALID 0 000008D4 740E jz @F 952 ; ds => IVT 0 000008D6 833E0C00FF cmp word [3 * 4], -1 0 000008DB 7420 je .nocheck 0 000008DD 833E0E0000 cmp word [3 * 4 + 2], 0 0 000008E2 7419 je .nocheck 957 @@: 0 000008E4 A808 test al, LCFG_DBG_ONLY_IISP 0 000008E6 7411 jz @F 960 ; ds => IVT 0 000008E8 C41E0C00 les bx, [3 * 4] ; es:bx -> int 3 handler 962 assume es:nothing 0 000008EC 83FBEE cmp bx, -18 ; valid ? (could tear word access ?) 0 000008EF 770C ja .nocheck ; no, cannot be a valid IISP header --> 0 000008F1 26817F064B42 cmp word [es:bx + 6], "KB" ; signature present ? 0 000008F7 7504 jne .nocheck ; no --> 967 @@: 0 000008F9 A801 test al, LCFG_DBG_CHECK 0 000008FB 7508 jnz .check 970 .nocheck: 0 000008FD 2EC606[DE02]90 mov byte [cs:.patch], 90h ; do not check 0 00000903 EB00 jmp @F ; (flush queue for the SMC) 973 @@: 974 .check: 0 00000905 1E push ds 0 00000906 07 pop es 977 assume es:IVT 0 00000907 A802 test al, LCFG_DBG_ASSUME ; (NC) 0 00000909 7401 jz .runint3 ; if to assume off --> (NC) 0 0000090B F9 stc ; assume on (CY) 981 .runint3: 0 0000090C CC .patch: int3 ; SMC: patched to NOP if not to run int3 0 0000090D 7211 jc debugger_detected 984 985 debugger_disabled: 0 0000090F BF0400 mov di, 4 * 1 0 00000912 5B pop bx 0 00000913 58 pop ax ; = segment 989 0 00000914 93 XCHG AX,BX 0 00000915 AB STOSW ;LOCATION 4 0 00000916 93 XCHG AX,BX 0 00000917 AB STOSW ;INT 1 ;LOCATION 6 0 00000918 83C704 ADD DI,4 0 0000091B 93 XCHG AX,BX 0 0000091C AB STOSW ;LOCATION 12 0 0000091D 93 XCHG AX,BX 0 0000091E AB STOSW ;INT 3 ;LOCATION 14 999 0 0000091F A9 db 0A9h ; test ax, imm16 (skip pop, pop) 1001 debugger_detected: 0 00000920 5B pop bx 0 00000921 58 pop ax 0 00000922 93 XCHG AX,BX 0 00000923 AB STOSW ;LOCATION 16 0 00000924 93 XCHG AX,BX 0 00000925 AB STOSW ;INT 4 ;LOCATION 18 1008 0 00000926 89160005 MOV WORD PTR [500H],DX ;SET PRINT SCREEN & BREAK =0 0 0000092A 89160405 MOV WORD PTR [LSTDRV],DX ;CLEAN OUT LAST DRIVE SPEC 1011 1012 MESSAGE FTESTINIT,<"DISK PARAMETER TABLE",CR,LF> 1013 1014 ; lDOS: our sector and initial loader do not relocate 1015 ; the DPT so do it here instead. this code used 1016 ; to be commented out. 0 0000092E C5367800 lds si, [DSKADR] ; DS:SI -> CURRENT TABLE ARR 2.41 1018 assume ds:nothing 0 00000932 BF2205 MOV DI,SEC9 ; ES:DI -> NEW TABLE ARR 2.41 0 00000935 57 push di 0 00000936 B90B00 MOV CX,DISK_PARMS_struc_size; ARR 2.41 0 00000939 F3A4 REP MOVSB ; COPY TABLE ARR 2.41 0 0000093B 06 PUSH ES ; ARR 2.41 0 0000093C 1F POP DS ; DS = 0 ARR 2.41 1025 assume ds:IVT 1026 0 0000093D 8F067800 pop WORD PTR [DSKADR] ; ARR 2.41 0 00000941 8C1E7A00 MOV WORD PTR [DSKADR+2],DS ; POINT DISK PARM VECTOR TO NEW TABLE 1029 ; ARR 2.41 1030 ;SB34INIT002****************************************************************** 1031 ;SB We need to initalise the cs:MotorStartup variable from the disk 1032 ;SB parameter table at SEC9. The offsets in this table are defined in 1033 ;SB the DISK_PARMS struc in MSDSKPRM.INC. 2 LOCS 1034 0 00000945 A02C05 mov al,[SEC9 + DISK_MOTOR_STRT] 0 00000948 E8B003 call dosentry_init_get_es_dosbiodata 1037 assume es:DOSGROUP 1038 MotorStartup equ MOTORSTARTUP ; NASM port label 0 0000094B 26A2[0000] mov [es:MotorStartup],al 1040 ;SB34INIT002****************************************************************** 0 0000094F 26803E[0000]FD CMP byte [es:MODEL_BYTE],0FDH ; IS THIS AN OLD ROM? ARR 2.41 0 00000955 720B JB NO_DIDDLE ; NO ARR 2.41 0 00000957 C7062B050F02 MOV WORD [(SEC9 + DISK_HEAD_STTL)],0200H+NORMSETTLE 1044 ; SET HEAD SETTLE AND MOTOR START 1045 ; ON PC-1 PC-2 PC-XT HAL0 ARR 2.41 0 0000095D C6062205DF MOV byte [(SEC9 + DISK_SPECIFY_1)],0DFH 1047 ; SET 1ST SPECIFY BYTE 1048 ; ON PC-1 PC-2 PC-XT HAL0 ARR 2.41 1049 NO_DIDDLE: ; ARR 2.41 0 00000962 CD12 INT 12H ;GET MEMORY SIZE--1K BLOCKS IN AX 0 00000964 B106 MOV CL,6 0 00000966 D3E0 SHL AX,CL ;CONVERT TO 16-BYTE BLOCKS(SEGMENT NO.) 0 00000968 59 POP CX ; RETREIVE BOOT DRIVE NUMBER, AND FAT ID 1054 ; cl = boot drive, 0 = A: 0 00000969 BA[0000] MOV DX,SYSINITSEG 0 0000096C 8EDA MOV DS,DX 1057 1058 ASSUME DS:SYSINITGROUP 1059 0 0000096E A3[0000] MOV [MEMORY_SIZE],AX 0 00000971 41 INC cx 0 00000972 880E[0000] MOV [DEFAULT_DRIVE],CL ;SAVE DEFAULT DRIVE SPEC 1063 0 00000976 31C9 xor cx,cx 1065 1066 ; IMPORTANT: SOME OLD IBM HARDWARE GENERATES SPURIOUS INT F'S DUE TO BOGUS 1067 ; PRINTER CARDS. WE INITIALIZE THIS VALUE TO POINT TO AN IRET ONLY IF 1068 1069 ; 1) THE ORIGINAL SEGMENT POINTS TO STORAGE INSIDE VALID RAM. 1070 1071 ; 2) THE ORIGINAL SEGMENT IS 0F000:XXXX 1072 1073 ; THESES ARE CAPRICIOUS REQUESTS FROM OUR OEM FOR REASONS BEHIND THEM, READ 1074 ; THE DCR'S FOR THE IBM DOS 3.2 PROJECT. 1075 0 00000978 8EC1 MOV es,cx ; cx := SEGMENT FOR INT 15 1077 assume es:IVT 0 0000097A 26A13E00 MOV AX,WORD PTR [es:(0FH*4+2)] 1079 0 0000097E 3B06[0000] CMP AX,[MEMORY_SIZE] ; CONDITION 1 0 00000982 7605 Jbe RESETINTF 1082 0 00000984 3D00F0 CMP AX,0F000H ; CONDITION 2 0 00000987 750C JNE KEEPINTF 1085 1086 RESETINTF: 0 00000989 26C7063C00[0000] MOV WORD PTR [es:0FH*4], entry_iret 0 00000990 268C0E3E00 MOV WORD PTR [es:0FH*4+2],CS 1089 KEEPINTF: 1090 1091 ; END IMPORTANT 1092 1093 ;SB34INIT003**************************************************************** 1094 ;SB We will check if the system has IBM extended key board by 1095 ;SB looking at a byte at 40:96. If bit 4 is set, then extended key board 1096 ;SB is installed, and we are going to set KEYRD_Func to 10h, KEYSTS_Func to 11h 1097 ;SB for the extended keyboard function. Use cx as the temporary register. 8 LOCS 1098 0 00000995 26F606960410 test byte [es:0496h], 0001_0000b ; get keyboard flag 1100 0 0000099B E85503 call dosentry_init_get_ds_dosbiodata 1102 assume ds:DOSGROUP 0 0000099E 1E PUSH ds 0 0000099F 07 POP ES 1105 assume es:DOSGROUP 1106 0 000009A0 7406 jz ORG_KEY ; orginal keyboard 1108 KEYRD_func equ KEYRD_Func ; NASM port label 1109 KEYSTS_func equ KEYSTS_Func ; NASM port label 0 000009A2 C706[0000]1011 mov word [KEYRD_func], 11_10h ; change for extended keyboard functions 1111 ; KEYSTS_Func is directly behind KEYRD_Func 1112 ORG_KEY: 1113 1114 ;SB34INIT003**************************************************************** 1115 1116 ;************************************************************** 1117 ; WILL INITIALIZE THE NUMBER OF DRIVES 1118 ; AFTER THE EQUIPMENT CALL (INT 11H) BITS 6&7 WILL TELL 1119 ; THE INDICATIONS ARE AS FOLLOWS: 1120 ; 1121 ; BITS 7 6 DRIVES 1122 ; 0 0 1 1123 ; 0 1 2 1124 ; 1 0 3 1125 ; 1 1 4 1126 ;************************************************************** 1127 0 000009A8 E88803 call CMOS_Clock_Read ;Before doing anythig else if CMOS clock exists, 1129 ;then set the system time according to that. 1130 ;Also, reset the cmos clock rate. 1131 1132 MESSAGE FTESTINIT,<"DISK DEVICES",CR,LF> 1133 0 000009AB 58 POP AX ;NUMBER OF FLOPPIES AND FAT ID 0 000009AC 30E4 XOR AH,AH ; CHUCK FAT ID BYTE 0 000009AE 2EA2[0000] MOV [cs:DRVMAX],AL ;AND SET INITIAL NUMBER OF DRIVES 1137 MESSAGE FTESTINIT,<"BEFORE INT 13",CR,LF> 1138 1139 determine_fhave96: 0 000009B2 BA[0000] mov dx, SYSINITSEG 0 000009B5 8EDA mov ds, dx 1142 assume ds:SYSINITGROUP 0 000009B7 31D2 xor dx, dx ; dl = unit 0 0 000009B9 803E[0600]01 cmp byte [FakeFloppyDrv],1 0 000009BE 0E push cs 0 000009BF 1F pop ds 1147 assume ds:DOSENTRYGROUP 0 000009C0 741D je .none 1149 1150 .LOOP_DRIVE: 0 000009C2 3A16[0000] CMP DL,[DRVMAX] 0 000009C6 7317 jae .done 1153 1154 ; CHECK FOR CHANGELINE SUPPORT ON DRIVE 1155 ;SB33023******************************************************************** 0 000009C8 B415 mov AH, 15h ;SB ; set command to get DASD type 0 000009CA F9 stc 0 000009CB CD13 int 13h ;SB ; call ROM-BIOS 1159 ;SB33023******************************************************************** 0 000009CD 7205 JC .NEXTDRIVE 0 000009CF 80FC02 CMP AH,02 ; CHECK FOR PRESENCE OF CHANGELINE 0 000009D2 7403 je .have96 1163 1164 .NEXTDRIVE: 0 000009D4 42 INC dx 0 000009D5 EBEB JMP .LOOP_DRIVE 1167 1168 ; WE HAVE A DRIVE WITH CHANGE LINE SUPPORT. 1169 ; shortcut to the end of the loop, ignoring any additional units 1170 ; that may also have change line support. 1171 .have96: 0 000009D7 E81903 call dosentry_init_get_ds_dosbiodata 1173 assume ds:DOSGROUP 0 000009DA C606[0000]01 mov byte [FHAVE96], 1 ; REMEMBER THAT WE HAVE 96TPI DISKS 1175 1176 .DONE_DRIVES: 1177 .done: 1178 .none: 1179 ; proceeds to STATIC_CONFIGURE 1180 1181 === Switch to base=00C400h -> "SYSINITTRAIL" 1182 usesection SYSINITTRAIL 1183 1184 alloc_upb: 1185 assume ds:nothing, es:nothing, ss:nothing 0 00003A5E 50 push ax 0 00003A5F 53 push bx 0 00003A60 51 push cx 0 00003A61 2EC43E[0000] les di, [cs:nextupb] 0 00003A66 8CC0 mov ax, es 0 00003A68 85C0 test ax, ax 0 00003A6A 741F jz .alloc 0 00003A6C 83C764 add di, BDSM_type_struc_size 0 00003A6F 2E893E[0000] mov word [cs:nextupb], di ; -> next UPB 0 00003A74 B104 mov cl, 4 0 00003A76 8D5D73 lea bx, [di + BDSM_type_struc_size + 15] 1197 ; -> behind next UPB, round up 0 00003A79 2E3B1E[0000] cmp bx, word [cs:nextupb] 0 00003A7E 7208 jb mem_err_j 0 00003A80 D3EB shr bx, cl ; to paragraphs 0 00003A82 B44A mov ah, 4Ah 0 00003A84 CD21 int 21h ; resize 0 00003A86 7312 jnc @F 1204 mem_err_j: equ $ 1205 extern MEM_ERR 0 00003A88 E9[0000] jmp MEM_ERR 1207 1208 .alloc: 0 00003A8B B448 mov ah, 48h 0 00003A8D BB0700 mov bx, paras(BDSM_type_struc_size) 0 00003A90 CD21 int 21h 0 00003A92 72F4 jc mem_err_j 0 00003A94 8EC0 mov es, ax 1214 assume es:nothing 0 00003A96 2EA3[0200] mov word [cs:nextupb + 2], ax 1216 @@: 0 00003A9A 59 pop cx 0 00003A9B 5B pop bx 0 00003A9C 58 pop ax 0 00003A9D C3 retn 1221 1222 1223 global INITUPB 1224 INITUPB: 1225 1226 ;SB33021******************************************************************** 0 00003A9E B280 mov DL, 80h ;SB ; tell rom bios to look at hard drives 0 00003AA0 B408 mov AH, 8h ;SB ; set command to get drive parameter 0 00003AA2 F9 stc 0 00003AA3 CD13 int 13h ;SB ; call ROM-BIOS to get number of drives 1231 1232 assume es:nothing 1233 ;SB33021******************************************************************** 0 00003AA5 7205 JC ENDDRV ;CARRY INDICATES OLD ROM, SO NO HARDFILE 0 00003AA7 2E8816[0000] MOV [cs:HNUM],DL 1236 ENDDRV: 1237 MESSAGE FTESTINIT,<"SETTING UP BDSS",CR,LF> 1238 1239 ; 1240 ; SCAN THE LIST OF DRIVES TO DETERMINE THEIR TYPE. WE HAVE THREE FLAVORS OF 1241 ; DISKETTE DRIVES: 1242 ; 1243 ; 48TPI DRIVES WE DO NOTHING SPECIAL FOR THEM 1244 ; 96TPI DRIVES MARK THE FACT THAT THEY HAVE CHANGELINE SUPPORT. 1245 ; 3 1/4 DRIVES MARK CHANGELINE SUPPORT AND SMALL. 1246 ; 1247 ; THE FOLLOWING CODE USES REGISTERS FOR CERTAIN VALUES: 1248 ; DL - PHYSICAL DRIVE 1249 ; DS:DI - POINTS TO CURRENT BDS 1250 ; CX - FLAG BITS FOR BDS 1251 ; DH - FORM FACTOR FOR THE DRIVE (1 - 48TPI, 2 - 96TPI, 3 - 3.5" MEDIUM) 1252 ; 0 00003AAC 30D2 XOR DL,DL ; START OUT WITH DRIVE 0. 1254 0 00003AAE E8DF07 call sysinit_get_ds_dosbiodata 1256 assume ds:DOSGROUP 0 00003AB1 C606[0000]09 MOV byte [EOT],9 1258 ;J.K.6/24/87 Check if the system has no physical diskette drives. 1259 ;J.K. If it is, then we don't have to set BDS tables. But since we 1260 ;J.K. pretend that we have 2 floppies, we are going to reserve two 1261 ;J.K. BDS tables for the fake drive A, and B. and set the end of link 1262 ;J.K. pointer. 1263 1264 ;SB34INIT004********************************************************* 1265 ;SB Check to see if we are faking floppy drives. If not we don't 1266 ;SB do anything special. If we are faking floppy drives we need 1267 ;SB to set aside two BDSs for the two fake floppy drives. We 1268 ;SB don't need to initalise any fields though. So starting at START_BDS 1269 ;SB use the link field in the BDS structure to go to the second BDS 1270 ;SB in the list and initalise it's link field to -1 to set the end of 1271 ;SB the list. Then jump to the routine at DoHard to allocate/initialise 1272 ;SB the BDS for HardDrives. 1273 0 00003AB6 2E803E[0600]01 cmp byte [cs:FakeFloppyDrv],1 0 00003ABC 7533 jnz LOOP_DRIVE ; system has floppy 1276 link equ LINK ; NASM port equate 0 00003ABE E89DFF call alloc_upb 0 00003AC1 0E push cs 0 00003AC2 1F pop ds 1280 assume ds:SYSINITGROUP 0 00003AC3 BE[0800] mov si, BDS_diskette_template ; access with ds 0 00003AC6 B96400 mov cx, BDS_TYPE_struc_size 0 00003AC9 57 push di 0 00003ACA F3A4 rep movsb 0 00003ACC 06 push es 0 00003ACD 1F pop ds 1287 assume ds:nothing, es:nothing 0 00003ACE 5F pop di 0 00003ACF C6450500 mov byte [di + DRIVELET], 0 0 00003AD3 E85F0C call Install_BDSM_and_set_bpb 1291 0 00003AD6 E885FF call alloc_upb 0 00003AD9 0E push cs 0 00003ADA 1F pop ds 1295 assume ds:SYSINITGROUP 0 00003ADB BE[0800] mov si, BDS_diskette_template ; access with ds 0 00003ADE B96400 mov cx, BDS_TYPE_struc_size 0 00003AE1 57 push di 0 00003AE2 F3A4 rep movsb 0 00003AE4 06 push es 0 00003AE5 1F pop ds 1302 assume ds:nothing, es:nothing 0 00003AE6 5F pop di 0 00003AE7 C6450501 mov byte [di + DRIVELET], 1 0 00003AEB E8470C call Install_BDSM_and_set_bpb 1306 1307 DoHard equ DOHARD ; NASM port label 0 00003AEE E93001 jmp DoHard ; allocate/initialise BDS for HardDrives 1309 ;SB34INIT004********************************************************* 1310 1311 LOOP_DRIVE: 0 00003AF1 E8A407 call sysinit_get_ds_dosentry ; DRVMAX in DOSENTRY 1313 assume ds:DOSENTRYGROUP 0 00003AF4 3A16[0000] CMP DL,[DRVMAX] 0 00003AF8 7203E92401 jae DONE_DRIVES 1316 0 00003AFD E85EFF call alloc_upb 0 00003B00 0E push cs 0 00003B01 1F pop ds 1320 assume ds:SYSINITGROUP 0 00003B02 BE[0800] mov si, BDS_diskette_template ; access with ds 0 00003B05 B96400 mov cx, BDS_TYPE_struc_size 0 00003B08 57 push di 0 00003B09 F3A4 rep movsb 0 00003B0B 5F pop di 1326 ; XOR CX,CX ; ZERO ALL FLAGS (cx already zero) 1327 0 00003B0C B600 MOV DH,FF48TPI ; SET FORM FACTOR TO 48 TPI 0 00003B0E C606[6F00]28 MOV byte [NUM_CYLN],40 ; 40 TRACKS PER SIDE 1330 0 00003B13 1E PUSH DS 0 00003B14 57 PUSH DI 0 00003B15 52 PUSH DX 0 00003B16 51 PUSH CX 1335 1336 ;SB33022******************************************************************** 0 00003B17 B408 MOV AH, 8h ;GET DRIVE PARAMETERS ;SB;3.30 0 00003B19 F9 stc 0 00003B1A CD13 INT 13h ;CALL ROM-BIOS ;SB;3.30 1340 ;SB33022******************************************************************** 0 00003B1C 726F jc NOPARMSFROMROM ; GOT AN OLD ROM 1342 1343 ;J.K. 10/9/86 If CMOS is bad, it gives ES,AX,BX,CX,DH,DI=0. CY=0. 1344 ;In this case, we are going to put bogus informations to BDS table. 1345 ;We are going to set CH=39,CL=9,DH=1 to avoid divide overflow when 1346 ;they are calculated at the later time. This is just for the Diagnostic 1347 ;Diskette which need MSBIO,MSDOS to boot up before it sets CMOS. 1348 ;This should only happen with drive B. 1349 0 00003B1E 80FD00 CMP CH,0 ; if ch=0, then cl,dh=0 too. 0 00003B21 7506 JNE PFR_OK 0 00003B23 B527 MOV CH,39 ; ROM gave wrong info. 0 00003B25 B109 MOV CL,9 ; Let's default to 360K. 0 00003B27 B601 MOV DH,1 1355 PFR_OK: 0 00003B29 FEC5 INC CH ; MAKE NUMBER OF CYLINDERS 1-BASED 0 00003B2B 8836[6C00] MOV byte ptr [NUM_HEADS],DH ; SAVE PARMS RETURNED BY ROM 0 00003B2F FF06[6C00] inc word ptr [NUM_HEADS] ; MAKE NUMBER OF HEADS 1-BASED 0 00003B33 80E13F AND CL,00111111B ; EXTRACT SECTORS/TRACK 0 00003B36 880E[6E00] MOV [SEC_TRK],CL 0 00003B3A 882E[6F00] MOV [NUM_CYLN],CH ; ASSUME LESS THAN 256 CYLINDERS!! 1362 0 00003B3E E84F07 call sysinit_get_ds_dosbiodata 1364 assume ds:DOSGROUP 1365 ; MAKE SURE THAT EOT CONTAINS THE MAX NUMBER OF SEC/TRK IN SYSTEM OF FLOPPIES 0 00003B41 3A0E[0000] CMP CL,[EOT] ; MAY SET CARRY 0 00003B45 7604 JBE EOT_OK 0 00003B47 880E[0000] MOV [EOT],CL 1369 EOT_OK: 0 00003B4B 59 POP CX 0 00003B4C 5A POP DX 0 00003B4D 5F POP DI 0 00003B4E 1F POP DS 1374 assume ds:SYSINITGROUP 1375 1376 ; CHECK FOR CHANGELINE SUPPORT ON DRIVE 1377 ;SB33023******************************************************************** 0 00003B4F B415 mov AH, 15h ;SB ; set command to get DASD type 0 00003B51 F9 stc 0 00003B52 CD13 int 13h ;SB ; call ROM-BIOS 1381 ;SB33023******************************************************************** 0 00003B54 7208 JC CHANGELINE_DONE 0 00003B56 80FC02 CMP AH,02 ; CHECK FOR PRESENCE OF CHANGELINE 0 00003B59 7503 JNE CHANGELINE_DONE 1385 ; 1386 ; WE HAVE A DRIVE WITH CHANGE LINE SUPPORT. 1387 ; 1388 MESSAGE FTESTINIT,<"96TPI DEVICES",CR,LF> 1389 0 00003B5B 80C902 OR CL,FCHANGELINE ; SIGNAL TYPE 1391 ; 1392 ; WE NOW TRY TO SET UP THE FORM FACTOR FOR THE TYPES OF MEDIA THAT WE KNOW 1393 ; AND CAN RECOGNISE. FOR THE REST, WE SET THE FORM FACTOR AS "OTHER". 1394 ; 1395 CHANGELINE_DONE: 0 00003B5E 0E push cs 0 00003B5F 1F pop ds 1398 assume ds:SYSINITGROUP 1399 ; 40 CYLINDERS AND 9 OR LESS SEC/TRK, TREAT AS 48 TPI MEDIUM. 0 00003B60 803E[6F00]28 CMP byte [NUM_CYLN],40 0 00003B65 750B JNZ TRY_80 0 00003B67 803E[6E00]09 CMP byte [SEC_TRK],9 0 00003B6C 761D JBE GOT_FF ; dh = FF48TPI --> 1404 GOTOTHER: 0 00003B6E B607 MOV DH,FFOTHER ; WE HAVE A "STRANGE" MEDIUM 0 00003B70 EB19 JMP SHORT GOT_FF 1407 1408 ; 1409 ; 80 CYLINDERS AND 9 SECTORS/TRACK => 720 KB DEVICE 1410 ; 80 CYLINDERS AND 15 SEC/TRK => 96 TPI MEDIUM 1411 ; 1412 TRY_80: 0 00003B72 B601 MOV DH,FF96TPI ; in case it is 96 TPI 0 00003B74 803E[6F00]50 CMP byte [NUM_CYLN],80 0 00003B79 75F3 JNZ GOTOTHER ; resets dh 0 00003B7B 803E[6E00]0F CMP byte [SEC_TRK],15 0 00003B80 7409 JZ GOT_FF ; (dh = FF96TPI) 0 00003B82 803E[6E00]09 CMP byte [SEC_TRK],9 0 00003B87 75E5 JNZ GOTOTHER ; resets dh 0 00003B89 B602 MOV DH,FFSMALL ; reset dh 1421 GOT_FF: 0 00003B8B EB28 JMP SHORT NEXTDRIVE 1423 1424 ; WE HAVE AN OLD ROM, SO WE EITHER HAVE A 48TPI OR 96TPI DRIVE. IF THE DRIVE 1425 ; HAS CHANGELINE, WE ASSUEM IT IS A 96TPI, OTHERWISE WE TREAT IT AS A 48TPI. 1426 1427 NOPARMSFROMROM: 0 00003B8D 59 POP CX 0 00003B8E 5A POP DX 0 00003B8F 5F POP DI 0 00003B90 1F POP DS 1432 assume ds:SYSINITGROUP 1433 1434 ;SB33024**************************************************************** 0 00003B91 B415 MOV AH, 15h ; SET COMMAND TO GET DASD TYPE ;SB;3.30 0 00003B93 F9 stc 0 00003B94 CD13 INT 13h ; CALL ROM-BIOS ;SB;3.30 1438 ;SB33024**************************************************************** 0 00003B96 721D JC NEXTDRIVE 0 00003B98 80FC02 CMP AH,2 ; IS THERE CHANGELINE? 0 00003B9B 7518 JNZ NEXTDRIVE 0 00003B9D 80C902 OR CL,FCHANGELINE 0 00003BA0 C606[6F00]50 MOV byte [NUM_CYLN],80 0 00003BA5 B601 MOV DH,FF96TPI 0 00003BA7 B00F MOV AL,15 ; SET EOT IF NECESSARY 1446 0 00003BA9 E8E406 call sysinit_get_ds_dosbiodata 1448 assume ds:DOSGROUP 0 00003BAC 3A06[0000] CMP AL, [EOT] 0 00003BB0 7603 JBE EOT_OK2 0 00003BB2 A2[0000] MOV [EOT],AL 1452 EOT_OK2: 1453 1454 NEXTDRIVE: 0 00003BB5 80C920 OR CL,FI_OWN_PHYSICAL ; SET THIS TRUE FOR ALL DRIVES 0 00003BB8 88D7 MOV BH,DL ;SAVE INT13 DRIVE NUMBER 1457 1458 ; WE NEED TO DO SPECIAL THINGS IF WE HAVE A SINGLE DRIVE SYSTEM AND ARE SETTING 1459 ; UP A LOGICAL DRIVE. IT NEEDS TO HAVE THE SAME INT13 DRIVE NUMBER AS ITS 1460 ; COUNTERPART, BUT THE NEXT DRIVE LETTER. ALSO RESET OWNERSHIP FLAG. 1461 ; WE DETECT THE PRESENCE OF THIS SITUATION BY EXAMINING THE FLAG SINGLE FOR THE 1462 ; VALUE 2. 1463 0 00003BBA E8D306 call sysinit_get_ds_dosbiodata 1465 assume ds:DOSGROUP 0 00003BBD 803E[0000]02 CMP byte [SINGLE],2 0 00003BC2 7505 JNZ NOT_SPECIAL 0 00003BC4 FECF DEC BH ; INT13 DRIVE NUMBER SAME FOR LOGICAL DRIVE 0 00003BC6 80F120 XOR CL,FI_OWN_PHYSICAL ; RESET OWNERSHIP FLAG FOR LOGICAL DRIVE 1470 NOT_SPECIAL: 1471 ; THE VALUES THAT WE PUT IN FOR RHDLIM AND RSECLIM WILL ONLY REMAIN IF THE 1472 ; FORM FACTOR IS OF TYPE "FFOTHER". 0 00003BC9 2E8E1E[0200] mov ds, word [cs:nextupb + 2] 1474 assume ds:UPB 0 00003BCE 2EA1[6C00] MOV ax, [cs:NUM_HEADS] 0 00003BD2 894536 MOV WORD PTR [DI + RHDLIM],AX 0 00003BD5 2EA0[6E00] MOV AL,[cs:SEC_TRK] 0 00003BD9 894534 MOV WORD PTR [DI + RSECLIM],AX 0 00003BDC 894D23 MOV WORD PTR [DI + FLAGS],CX 0 00003BDF 887522 MOV BYTE PTR [DI + FORMFACTOR],DH 0 00003BE2 885505 MOV BYTE PTR [DI + DRIVELET],DL 0 00003BE5 887D04 MOV BYTE PTR [DI + DRIVENUM],BH 0 00003BE8 2E8A1E[6F00] MOV BL,BYTE PTR [cs:NUM_CYLN] 0 00003BED 885D25 MOV BYTE PTR [DI + CCYLN],BL ; ONLY THE L.S. BYTE IS SET HERE 0 00003BF0 E8420B call Install_BDSM_and_set_bpb 0 00003BF3 E8AA06 call sysinit_get_es_dosbiodata 1487 assume es:DOSGROUP 0 00003BF6 26803E[0000]01 CMP byte [es:SINGLE],1 ; SPECIAL CASE FOR SINGLE DRIVE SYSTEM 0 00003BFC 751F JNZ NO_SINGLE 1490 MESSAGE FTESTINIT,<"SINGLE DRIVE SYSTEM",CR,LF> 0 00003BFE 26FE06[0000] inc byte [es:SINGLE] ; DON'T LOSE INFO THAT WE HAVE SINGLE SYSTEM 0 00003C03 83C910 OR CX,FI_AM_MULT 0 00003C06 094D23 OR WORD PTR [DI + FLAGS],CX 0 00003C09 42 inc dx 1495 0 00003C0A E851FE call alloc_upb 0 00003C0D 0E push cs 0 00003C0E 1F pop ds 1499 assume ds:SYSINITGROUP, es:UPB 0 00003C0F BE[0800] mov si, BDS_diskette_template ; access with ds 0 00003C12 51 push cx 0 00003C13 B96400 mov cx, BDS_TYPE_struc_size 0 00003C16 57 push di 0 00003C17 F3A4 rep movsb 0 00003C19 5F pop di ; di -> next UPB 0 00003C1A 59 pop cx 0 00003C1B EB98 JMP SHORT NEXTDRIVE ; USE SAME INFO FOR BDS A PREVIOUS 1508 NO_SINGLE: 0 00003C1D 42 inc dx 0 00003C1E E9D0FE JMP LOOP_DRIVE 1511 1512 DONE_DRIVES: 1513 1514 ; SET UP ALL THE HARD DRIVES IN THE SYSTEM 1515 1516 DOHARD: 1517 assume ds:nothing, es:nothing, ss:nothing 1518 1519 extern partition_table, partition_table.end 1520 extern load_mode, load_scan_flags, load_partition_cycle 1521 extern load_current_partition, load_unit, load_amount_units 1522 extern next_block_device_unit 1523 0 00003C21 0E push cs 0 00003C22 1F pop ds 1526 assume ds:SYSINITGROUP 0 00003C23 B8[0000] mov ax, DiskSector ; ! must be aligned to paragraph boundary 0 00003C26 B104 mov cl, 4 0 00003C28 D3E8 shr ax, cl 0 00003C2A 05[0000] add ax, DOSENTRY 0 00003C2D A3[0400] mov word [Init_BootSeg], ax 0 00003C30 A0[0000] mov al, [HARDNUM] 0 00003C33 A2[0000] mov [next_block_device_unit], al 0 00003C36 E82F00 call .init 1535 0 00003C39 F606[0100]80 testopt [load_mode], mode_dlasort_zero 0 00003C3E 7434 jz .once 1538 0 00003C40 BB[0F05] mov bx, scan_priority_primary 0 00003C43 E81400 call .pass 0 00003C46 BB[8D05] mov bx, scan_early_primary 0 00003C49 E80E00 call .pass 0 00003C4C BB[AE03] mov bx, scan_logical_ignore_lba_if 0 00003C4F E80800 call .pass 0 00003C52 BB[0F08] mov bx, scan_subsequent_primary 0 00003C55 E80200 call .pass 0 00003C58 EB39 jmp .done 1548 1549 1550 .pass: 1551 .passloop: 0 00003C5A E87900 call nextunit 0 00003C5D 7209 jc .passdone 1554 0 00003C5F 53 push bx 0 00003C60 B9[FC09] mov cx, .each 0 00003C63 FFD3 call bx 0 00003C65 5B pop bx 0 00003C66 EBF2 jmp .passloop 1560 1561 .passdone: 1562 .init: 0 00003C68 C606[0000]7F mov byte [load_unit], 7Fh 0 00003C6D A0[0000] mov al, byte [HNUM] 0 00003C70 A2[0000] mov byte [load_amount_units], al 0 00003C73 C3 retn 1567 1568 1569 .once: 0 00003C74 E85F00 call nextunit 0 00003C77 721A jc .done 1572 0 00003C79 B9[FC09] mov cx, .each 0 00003C7C E87801 call scan_priority_primary 0 00003C7F B9[FC09] mov cx, .each 0 00003C82 E8F001 call scan_early_primary 0 00003C85 B9[FC09] mov cx, .each 0 00003C88 E80B00 call scan_logical_ignore_lba_if 0 00003C8B B9[FC09] mov cx, .each 0 00003C8E E86604 call scan_subsequent_primary 0 00003C91 EBE1 jmp .once 1582 1583 .each equ handle_each_partition 1584 1585 .done: 0 00003C93 E9BC00 jmp hdd_done 1587 1588 1589 scan_logical_ignore_lba_if: 0 00003C96 F606[2400]04 testopt [BDS_harddisk_template + FLAGS], F_LBA 0 00003C9B 7403E97102 jnz scan_logical 0 00003CA0 FF36[0000] push word [load_mode] 0 00003CA4 8026[0000]F3 clropt [load_mode], mode_first_type_ext15 0 00003CA9 800E[0000]04 setopt [load_mode], mode_ignore_ext15 0 00003CAE E86002 call scan_logical 0 00003CB1 8F06[0000] pop word [load_mode] 0 00003CB5 C3 retn 1598 1599 1600 scanptab_error: 1601 bootcmd: 1602 .fail_read: 0 00003CB6 0E push cs 0 00003CB7 07 pop es 1605 assume es:SYSINITGROUP 0 00003CB8 BF[0E0F] mov di, msg.bootfail_read_errorcode 0 00003CBB 88E0 mov al, ah 1608 extern hexbyte 0 00003CBD E8[0000] call hexbyte 0 00003CC0 BA[E10E] mov dx, msg.bootfail_read 1611 .fail: 0 00003CC3 0E push cs 0 00003CC4 07 pop es 1614 assume es:SYSINITGROUP 0 00003CC5 0E push cs 0 00003CC6 1F pop ds 1617 assume ds:SYSINITGROUP 0 00003CC7 52 push dx 0 00003CC8 BA[D40E] mov dx, msg.bootfail 1620 extern init2_disp_msg_asciz_cs_dx 0 00003CCB E8[0000] call init2_disp_msg_asciz_cs_dx 0 00003CCE 5A pop dx 0 00003CCF E8[0000] call init2_disp_msg_asciz_cs_dx 0 00003CD2 89EC mov sp, bp ; abort pass 0 00003CD4 5D pop bp 0 00003CD5 C3 retn 1627 1628 1629 ; INP: load_amount_units = remaining amount units 1630 ; load_unit = prior unit 1631 ; OUT: CY if units exhausted 1632 ; NC if another unit follows, 1633 ; load_unit = next unit to process 1634 ; ds:di -> UPB template, 1635 ; with CHS geometry and LBA flag setup 1636 ; CHG: ax, cx, dx, di, es 1637 ; STT: ds = cs 1638 nextunit: 1639 .loop: 0 00003CD6 FE06[0000] inc byte [load_unit] 1641 0 00003CDA 31C0 xor ax, ax 0 00003CDC A3[0000] mov word [load_partition_cycle], ax 1644 0 00003CDF 803E[0000]01 cmp byte [load_amount_units], 1 0 00003CE4 720E jb .ret ; CY if branching 0 00003CE6 8A16[0000] mov dl, byte [load_unit] 0 00003CEA E80E00 call query_geometry_upb 0 00003CED FE0E[0000] dec byte [load_amount_units] 0 00003CF1 72E3 jc .loop ; just skip unit if error --> 0 00003CF3 F8 clc ; NC 1652 .ret: 0 00003CF4 C3 retn 1654 1655 1656 upb_reset: 0 00003CF5 C606[0700]00 mov byte [FBIGFAT], 0 ; ASSUME 12 BIT FAT 0 00003CFA C3 retn 1659 1660 1661 ; INP: dl = unit number 1662 ; OUT: CY if error getting geometry 1663 ; NC if success 1664 ; ds:di -> UPB template 1665 ; STT: ds = cs 1666 ; CHG: ax, cx, dx, di, es 1667 query_geometry_upb: 1668 assume ds:SYSINITGROUP, es:nothing, ss:nothing 1669 extern BDS_harddisk_template 0 00003CFB BF[0000] mov di, BDS_harddisk_template 0 00003CFE E8F4FF call upb_reset 0 00003D01 885504 mov byte [di + DRIVENUM], dl 0 00003D04 53 push bx 0 00003D05 C745232100 mov word [di + FLAGS], FI_OWN_PHYSICAL | FNON_REMOVABLE 1675 ; F_LBA clear 0 00003D0A E8FD08 call detectlba 0 00003D0D 7204 jc .no_lba 0 00003D0F 804D2404 setopt [di + FLAGS], F_LBA ; set flag 1679 .no_lba: 0 00003D13 C6452205 mov byte [di + FORMFACTOR], FFHARDFILE 1681 0 00003D17 57 push di 0 00003D18 B408 mov ah, 08h ; set command to get drive parameters 0 00003D1A F9 stc 0 00003D1B CD13 int 13h ; call rom-bios disk routine 0 00003D1D 5F pop di 1687 ; DH IS NUMBER OF HEADS-1 1688 ; DL IS NUMBER OF HARD DISKS ATTACHED 1689 ; LOW 6 BITS OF CL IS SECTORS/TRACK 1690 ; HIGH 2 BITS OF CL WITH CH ARE MAX # OF CYLINDERS 0 00003D1E 86F2 xchg dh, dl ; dl = maximum head 0 00003D20 B600 mov dh, 0 ; dx = maximum head (preserve CF !) 0 00003D22 42 inc dx ; GET NUMBER OF HEADS (preserve CF !) 0 00003D23 895515 mov word [di + HDLIM], dx 0 00003D26 5B pop bx 0 00003D27 7206 jc .ret ; CARRY HERE MEANS NO HARD DISK 0 00003D29 80E13F and cl, 3Fh ; EXTRACT NUMBER OF SECTORS/TRACK 1698 ; (NC) 0 00003D2C 884D13 mov byte [di + SECLIM], cl 1700 .ret: 0 00003D2F C3 retn 1702 1703 1704 ; INP: al = partition type 1705 ; OUT: CY or NZ or both if not a known type 1706 ; NC, ZR if known type we can access 1707 ; STT: ds = cs 1708 load_is_known: 1709 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00003D30 3C01 cmp al, ptFAT12 0 00003D32 741C je .isknown ; ZR if branches 0 00003D34 3C04 cmp al, ptFAT16_16BIT_CHS 0 00003D36 7418 je .isknown ; ZR if branches 0 00003D38 3C06 cmp al, ptFAT16_CHS 0 00003D3A 7414 je .isknown ; ZR if branches 0 00003D3C 3C0E cmp al, ptFAT16 0 00003D3E 7510 jne .notknown ; NZ if branches 1718 .isknown_lba: 0 00003D40 F606[2400]04 testopt [BDS_harddisk_template + FLAGS], F_LBA 0 00003D45 7407 jz .discard 0 00003D47 F606[0100]40 testopt [load_mode], mode_disable_lba 0 00003D4C 7402 jz .isknown ; ZR if branches 1723 .discard: 0 00003D4E F9 stc 0 00003D4F C3 retn 1726 1727 .isknown: 1728 .notknown: 0 00003D50 F8 clc 0 00003D51 C3 retn 1731 1732 1733 hdd_done: 1734 assume ds:SYSINITGROUP, es:nothing 0 00003D52 A0[0000] mov al, byte [next_block_device_unit] 0 00003D55 E84005 call sysinit_get_ds_dosentry ; DRVMAX in DOSENTRY 1737 assume ds:DOSENTRYGROUP 0 00003D58 A2[0000] MOV [DRVMAX],AL 1739 1740 ; END OF DRIVE INITIALIZATION. 1741 0 00003D5B E81009 CALL SETDRVPARMS 1743 1744 write_dskdrvs_upb: 0 00003D5E 0E push cs 0 00003D5F 1F pop ds 1747 assume ds:SYSINITGROUP 0 00003D60 C43E[0000] les di, [nextupb] 1749 assume es:UPB 0 00003D64 8CC0 mov ax, es 0 00003D66 85C0 test ax, ax 0 00003D68 745D jz .done 0 00003D6A 83C765 add di, BDSM_type_struc_size + 1; -> behind last UPB 0 00003D6D 722C jc .mem_err_j 0 00003D6F 83E7FE and di, ~1 ; round to word boundary 0 00003D72 BE[E000] mov si, DSKDRVS 0 00003D75 8B1E[DE00] mov bx, [Mini_BPB_ptr] 0 00003D79 29F3 sub bx, si 0 00003D7B 89D9 mov cx, bx 0 00003D7D 01FB add bx, di 0 00003D7F 721A jc .mem_err_j 0 00003D81 83C30F add bx, 15 ; -> behind wanted list 0 00003D84 7215 jc .mem_err_j 0 00003D86 3B1E[0000] cmp bx, word [nextupb] 0 00003D8A 7303E9F9FC jb mem_err_j 0 00003D8F 51 push cx 0 00003D90 B104 mov cl, 4 0 00003D92 D3EB shr bx, cl ; to paragraphs 0 00003D94 59 pop cx 0 00003D95 B44A mov ah, 4Ah 0 00003D97 CD21 int 21h ; resize 0 00003D99 7303 jnc @F 1773 .mem_err_j: 0 00003D9B E9EAFC jmp mem_err_j 1775 @@: 0 00003D9E D1E9 shr cx, 1 0 00003DA0 57 push di 0 00003DA1 F3A5 rep movsw 0 00003DA3 E8EA04 call sysinit_get_ds_dosbiodata 1780 assume ds:DOSGROUP 1781 extern dskdrvs_indirect 0 00003DA6 8C06[0200] mov word [dskdrvs_indirect + 2], es 0 00003DAA 8F06[0000] pop word [dskdrvs_indirect] 1784 0 00003DAE 8CC0 mov ax, es 0 00003DB0 48 dec ax 0 00003DB1 8EC0 mov es, ax 1788 assume es:MCB 0 00003DB3 26C70601000800 mov word [es:arena_owner], 8 1790 ; init owner 0 00003DBA BF0500 mov di, arena_reserved 0 00003DBD 0E push cs 0 00003DBE 1F pop ds 1794 assume ds:SYSINITGROUP 0 00003DBF BE[E004] mov si, upb_smcb 0 00003DC2 B90B00 mov cx, 3 + 8 0 00003DC5 F3A4 rep movsb ; init name and type 1798 1799 .done: 0 00003DC7 C3 retn 1801 1802 upb_smcb: 0 00003DC8 000000 db 0,0,0 0 00003DCB 5300 db "S",0 ; name "S" 0 00003DCD 09 db 9 ; type S_UPB 0 00003DCE 00 times 5 db 0 1807 1808 1809 ; INP: dx:ax = first sector 1810 ; bx:0 -> buffer 1811 ; OUT: es = input bx 1812 ; dx:ax = incremented 1813 ; bx => after read data 1814 ; CHG: - 1815 ; STT: ds = cs 1816 read_ae_512_bytes: 1817 assume ds:SYSINITGROUP 0 00003DD3 52 push dx 0 00003DD4 50 push ax 0 00003DD5 53 push bx 0 00003DD6 51 push cx 0 00003DD7 8EC3 mov es, bx 1823 assume es:nothing 0 00003DD9 31DB xor bx, bx ; es:bx -> buffer 0 00003DDB B90102 mov cx, 0201h ; cx = function code and count 0 00003DDE 57 push di 0 00003DDF BF[0000] mov di, BDS_harddisk_template 1828 ; ds:di -> template 0 00003DE2 E8F107 call readsector_flag 0 00003DE5 5F pop di 0 00003DE6 7303E9CBFE jc scanptab_error 0 00003DEB 59 pop cx 0 00003DEC 5B pop bx 0 00003DED 58 pop ax 0 00003DEE 5A pop dx 0 00003DEF 83C320 add bx, paras(512) 0 00003DF2 40 inc ax 0 00003DF3 7501 jnz . 0 00003DF5 42 inc dx 1840 .: 0 00003DF6 C3 retn 1842 1843 1844 overridedef DEBUG4, 0 1845 %define _SCANPTAB_PREFIX 1846 %define _SCANPTAB_DEBUG4_PREFIX 1847 %assign _PARTITION_TABLE_IN_CS 1 1848 %define _BASE bp 1849 %assign _SPT_ELD 0 1850 %assign _MODE 1 1851 %assign _SPT_MULTIPASS 1 1852 %include "scanptab.asm" 1 <1> 2 <1> %if 0 3 <1> 4 <1> scanptab - Scan partition table 5 <1> 2019, 2025 by E. C. Masloch 6 <1> 7 <1> Usage of the works is permitted provided that this 8 <1> instrument is retained with the works, so that any entity 9 <1> that uses the works is notified of this instrument. 10 <1> 11 <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <1> 13 <1> %endif 14 <1> 15 <1> ; _SCANPTAB_PREFIX = prefix for our variables and functions 16 <1> ; _SCANPTAB_DEBUG4_PREFIX = prefix for d4 function calls 17 <1> numdef PARTITION_TABLE_IN_CS, 1 18 <1> numdef BOOTCMD_FAIL_ERROR, 1 19 <1> numdef SPT_ELD, 0 20 <1> numdef SPT_MULTIPASS, 0 21 <1> %if _SPT_ELD 22 <1> %define sptrel reloc 23 <1> %define sptinternal internaldatarelocation 24 <1> %define sptexternal linkdatarelocation 25 <1> numdef MODE, 1 26 <1> %else 27 <1> %define sptrel 28 <1> %define sptinternal comment 29 <1> %define sptexternal comment 30 <1> numdef MODE, 0 31 <1> %endif 32 <1> gendef BASE, ss:bx 33 <1> %ifidn _BASE, ss:bx 34 <1> %elifidn _BASE, bp 35 <1> %else 36 <1> %error Invalid base 37 <1> %endif 38 <1> 39 <1> %if _MODE 40 <1> %include "scanptab.mac" 1 <2> 2 <2> %if 0 3 <2> 4 <2> scanptab - Scan partition table (macros) 5 <2> 2019, 2025 by E. C. Masloch 6 <2> 7 <2> Usage of the works is permitted provided that this 8 <2> instrument is retained with the works, so that any entity 9 <2> that uses the works is notified of this instrument. 10 <2> 11 <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <2> 13 <2> %endif 14 <2> 15 <2> mode_all_ext5 equ 00b 16 <2> mode_ignore_ext5 equ 01b 17 <2> mode_first_ext5 equ 10b 18 <2> mode_first_type_ext5 equ 11b 19 <2> 20 <2> mode_all_ext15 equ 00b << 2 21 <2> mode_ignore_ext15 equ 01b << 2 22 <2> mode_first_ext15 equ 10b << 2 23 <2> mode_first_type_ext15 equ 11b << 2 24 <2> 25 <2> mode_all_ext85 equ 00b << 4 26 <2> mode_ignore_ext85 equ 01b << 4 27 <2> mode_first_ext85 equ 10b << 4 28 <2> mode_first_type_ext85 equ 11b << 4 29 <2> 30 <2> mode_ignore_subsequent_nested equ 1_00_00_00b 31 <2> mode_ignore_subsequent_logical equ 10_00_00_00b 32 <2> mode_ignore_subsequent_primary equ 100_00_00_00b 33 <2> mode_traditional_order_logical equ 1000_00_00_00b 34 <2> mode_active_priority equ 1_0000_00_00_00b 35 <2> mode_subsequent_primary_after equ 10_0000_00_00_00b 36 <2> mode_disable_fat32 equ 00_1000_0000_00_00_00b 37 <2> mode_disable_lba equ 01_0000_0000_00_00_00b 38 <2> mode_dlasort_zero equ 10_0000_0000_00_00_00b 41 <1> %endif 42 <1> 43 <1> 44 <1> ; INP: byte [%load_unit] = unit to scan 45 <1> ; cx = function to call for each partition 46 <1> ; OUT: function called for each partition 47 <1> ; CHG: di, si, ax, bx, (cx), dx, es 48 <1> ; STT: ds => data segment (used for %load_* variables, unless bp-based) 49 <1> ; 50 <1> ; Note: Calls %read_partition_table (in this module), 51 <1> ; which calls %read_ae_512_bytes, which calls 52 <1> ; read_sector. The read_sector base must be 53 <1> ; zero and the geometry must be initialised. 54 <1> 55 <1> ; Function in cx is called with: 56 <1> ; INP: es:si -> partition table entry, 57 <1> ; si = %partition_table .. %partition_table+48, 58 <1> ; es = ss (if not _PARTITION_TABLE_IN_CS) 59 <1> ; es = cs (if _PARTITION_TABLE_IN_CS) 60 <1> ; byte [%load_current_partition] = partition number, 61 <1> ; 0 for diskette (unpartitioned), 62 <1> ; 1 to 4 for primary partitions, 63 <1> ; 5+ for logical partitions 64 <1> ; _BASE + di -> above part table metadata, 65 <1> ; dword [_BASE + di - 4] = root (outermost extended position) 66 <1> ; dword [_BASE + di - 8] = base (current table position) 67 <1> ; dword [es:si + piStart] = local partition start 68 <1> ; base + local start = absolute partition start 69 <1> ; _BASE -> bp value (dummy if _BASE is not bp), 70 <1> ; near return address of scan_partitions 71 <1> ; CHG: ax, (cx), dx, bx (unless part of _BASE) 72 <1> ; STT: ds => data segment (used for load_* variables, unless bp-based) 73 <1> ; Note: preserves (cx), si, di, ds, es, (bp), _BASE 74 <1> ; 75 <1> ; Note: If the function returns to scan_partitions, 76 <1> ; cx must be left as the function to call for 77 <1> ; subsequent partitions afterwards. 78 <1> ; Note: May load sp from _BASE then pop bp then return 79 <1> ; near if the scan should stop after the call. 80 <1> %if _SPT_MULTIPASS 81 <1> %[_SCANPTAB_PREFIX]scan_priority_primary: 82 <1> %else 83 <1> %[_SCANPTAB_PREFIX]scan_partitions: 84 <1> %endif 0 00003DF7 8326[0000]00 sptrel and word [ %[_SCANPTAB_PREFIX]load_partition_cycle], 0 86 <1> sptinternal -3 87 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 88 <1> d4 asciz "In scan_partitions",13,10 89 <1> 0 00003DFC 55 push bp 91 <1> %ifidn _BASE, ss:bx 92 <1> mov bx, sp 93 <1> %elifidn _BASE, bp 0 00003DFD 89E5 mov bp, sp 95 <1> %endif 0 00003DFF 31FF xor di, di 0 00003E01 57 push di ; [_BASE+di-2] 0 00003E02 57 push di ; [_BASE+di-4] 0 00003E03 57 push di ; [_BASE+di-6] 0 00003E04 57 push di ; [_BASE+di-8] 101 <1> %if _MODE 0 00003E05 893E[0000] sptrel mov word [ %[_SCANPTAB_PREFIX]load_scan_flags ], di 103 <1> sptinternal 104 <1> %endif 105 <1> 0 00003E09 803E[0000]80 sptrel cmp byte [ %[_SCANPTAB_PREFIX]load_unit], 80h 107 <1> sptinternal -3 0 00003E0E 7326 jae @F 109 <1> 0 00003E10 57 push di 0 00003E11 51 push cx 112 <1> %if _PARTITION_TABLE_IN_CS 0 00003E12 0E push cs 114 <1> %else 115 <1> push ss 116 <1> %endif 0 00003E13 07 pop es 118 <1> assume es:SYSINITGROUP 0 00003E14 BF[0000] sptrel mov di, %[_SCANPTAB_PREFIX]partition_table 120 <1> sptinternal 0 00003E17 31C0 xor ax, ax 0 00003E19 B92000 mov cx, (4 * 16) >> 1 0 00003E1C F3AB rep stosw ; initialise fake partition table 0 00003E1E 59 pop cx 0 00003E1F 5F pop di 0 00003E20 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 127 <1> sptinternal 128 <1> ; -> fake PARTINFO 0 00003E23 26C60480 mov byte [es:si + piBoot], 80h ; fake primary active 0 00003E27 26C64404FF mov byte [es:si + piType], 0FFh ; fake a type 0 00003E2C C606[0000]00 sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], 0 ; special: 0 = diskette 132 <1> sptinternal -3 ; piLength is 0, too 0 00003E31 FFD1 call cx 134 <1> 0 00003E33 E90302 jmp %[_SCANPTAB_PREFIX]scan_logical.end 136 <1> 137 <1> 138 <1> @@: 139 <1> %if _SPT_MULTIPASS 0 00003E36 F606[0100]04 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_active_priority 141 <1> sptinternal -3 ; active primary first ? 0 00003E3B 7434 jz .end 143 <1> %endif 144 <1> 0 00003E3D 31C0 xor ax, ax 0 00003E3F 31D2 xor dx, dx 147 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 148 <1> d4 asciz "In scan_partitions (before first call to read_partition_table)",13,10 0 00003E41 E86503 call %[_SCANPTAB_PREFIX]read_partition_table.first 150 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 151 <1> d4 asciz "In scan_partitions (after first call to read_partition_table)",13,10 0 00003E44 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 153 <1> sptinternal 0 00003E47 8816[0000] sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], dl ; = 0 155 <1> sptinternal 156 <1> %if _SPT_ELD 157 <1> sptrel mov word [ %[_SCANPTAB_PREFIX]load_current_extended_and_is], dx ; = 0 158 <1> sptinternal 159 <1> %endif 160 <1> 161 <1> %if _MODE 162 <1> %ifn _SPT_MULTIPASS 163 <1> sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_active_priority 164 <1> sptinternal -3 ; active primary first ? 165 <1> jz .active_ignored 166 <1> %endif 167 <1> 168 <1> .loop_active_primary: 169 <1> 0 00003E4B FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 171 <1> sptinternal 0 00003E4F 268A4404 mov al, byte [es:si + piType] 0 00003E53 3C00 cmp al, 0 0 00003E55 7411 je .loop_active_primary_skip 0 00003E57 26803C00 cmp byte [es:si + piBoot], 0 0 00003E5B 740B je .loop_active_primary_skip 177 <1> 178 <1> ; INP: al = partition type 179 <1> ; OUT: CY if an LBA or FAT32 type that's disabled 180 <1> ; NC, ZR if known type we can access 181 <1> ; NC, NZ if unknown type 0 00003E5D E8D0FE call %[_SCANPTAB_PREFIX]load_is_known 0 00003E60 7206 jc .loop_active_primary_skip 0 00003E62 7504 jnz .loop_active_primary_skip 185 <1> 0 00003E64 FFD1 call cx ; es:si -> partition table entry 187 <1> ; byte [load_current_partition] = which 0 00003E66 EB09 jmp .active_done 189 <1> 190 <1> .loop_active_primary_skip: 0 00003E68 83C610 add si, 16 0 00003E6B 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 193 <1> sptinternal 0 00003E6F 72DA jb .loop_active_primary 195 <1> 196 <1> .active_done: 197 <1> %if _SPT_MULTIPASS 198 <1> .end: 199 <1> %ifidn _BASE, bp 0 00003E71 89EC mov sp, bp ; restore sp 0 00003E73 5D pop bp 202 <1> %else 203 <1> mov sp, bx ; restore sp 204 <1> pop ax ; (discard dummy bp value) 205 <1> %endif 0 00003E74 C3 retn ; and bye 207 <1> 208 <1> 209 <1> %[_SCANPTAB_PREFIX]scan_early_primary: 0 00003E75 8326[0000]00 sptrel and word [ %[_SCANPTAB_PREFIX]load_partition_cycle], 0 211 <1> sptinternal -3 212 <1> 0 00003E7A 55 push bp 214 <1> %ifidn _BASE, ss:bx 215 <1> mov bx, sp 216 <1> %elifidn _BASE, bp 0 00003E7B 89E5 mov bp, sp 218 <1> %endif 0 00003E7D 31FF xor di, di 0 00003E7F 57 push di ; [_BASE+di-2] 0 00003E80 57 push di ; [_BASE+di-4] 0 00003E81 57 push di ; [_BASE+di-6] 0 00003E82 57 push di ; [_BASE+di-8] 0 00003E83 31C0 xor ax, ax 0 00003E85 31D2 xor dx, dx 226 <1> 227 <1> %if _MODE 0 00003E87 A3[0000] sptrel mov word [ %[_SCANPTAB_PREFIX]load_scan_flags ], ax 229 <1> sptinternal 230 <1> %endif 231 <1> 0 00003E8A E81C03 call %[_SCANPTAB_PREFIX]read_partition_table.first 0 00003E8D 8816[0000] sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], dl ; = 0 234 <1> sptinternal 235 <1> %if _SPT_ELD 236 <1> sptrel mov word [ %[_SCANPTAB_PREFIX]load_current_extended_and_is], dx ; = 0 237 <1> sptinternal 238 <1> %endif 239 <1> %else 240 <1> sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], 0 241 <1> sptinternal -3 242 <1> %endif 0 00003E91 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 244 <1> sptinternal 245 <1> 246 <1> 0 00003E94 F606[0100]04 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_active_priority 248 <1> sptinternal -3 ; active primary first ? 0 00003E99 7437 jz .active_ignored 250 <1> 251 <1> .loop_active_skip: 252 <1> 0 00003E9B FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 254 <1> sptinternal 0 00003E9F 268A4404 mov al, byte [es:si + piType] 0 00003EA3 3C00 cmp al, 0 0 00003EA5 741A je .loop_active_skip_skip 0 00003EA7 26803C00 cmp byte [es:si + piBoot], 0 0 00003EAB 7414 je .loop_active_skip_skip 260 <1> 261 <1> ; INP: al = partition type 262 <1> ; OUT: CY if an LBA or FAT32 type that's disabled 263 <1> ; NC, ZR if known type we can access 264 <1> ; NC, NZ if unknown type 0 00003EAD E880FE call %[_SCANPTAB_PREFIX]load_is_known 0 00003EB0 720F jc .loop_active_skip_skip 0 00003EB2 750D jnz .loop_active_skip_skip 0 00003EB4 A0[0000] sptrel mov al, byte [ %[_SCANPTAB_PREFIX]load_current_partition] 269 <1> sptinternal 0 00003EB7 A2[0100] sptrel mov byte [ %[_SCANPTAB_PREFIX]load_scan_flags + 1], al 271 <1> sptinternal 0 00003EBA 800E[0000]20 sptrel setopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 273 <1> sptinternal -3 ; mark as had a primary partition yet 0 00003EBF EB09 jmp .active_skip_done 275 <1> 276 <1> .loop_active_skip_skip: 0 00003EC1 83C610 add si, 16 0 00003EC4 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 279 <1> sptinternal 0 00003EC8 72D1 jb .loop_active_skip 281 <1> 282 <1> .active_skip_done: 0 00003ECA BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 284 <1> sptinternal 0 00003ECD C606[0000]00 sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], 0 286 <1> sptinternal -3 287 <1> 288 <1> %endif 289 <1> 290 <1> .active_ignored: 291 <1> .loop_primary_parts: 0 00003ED2 FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 293 <1> sptinternal 0 00003ED6 26807C0400 cmp byte [es:si + piType], 0 0 00003EDB 7427 je .loop_primary_skip 296 <1> 297 <1> %if _MODE 0 00003EDD F606[0100]04 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_active_priority 299 <1> sptinternal -3 ; active primary first ? 0 00003EE2 7409 jz @F ; no --> 0 00003EE4 A0[0000] sptrel mov al, byte [ %[_SCANPTAB_PREFIX]load_current_partition] 302 <1> sptinternal 0 00003EE7 3806[0100] sptrel cmp byte [ %[_SCANPTAB_PREFIX]load_scan_flags + 1], al 304 <1> sptinternal 0 00003EEB 7417 je .ignoreprimary 306 <1> @@: 307 <1> 0 00003EED F606[0000]20 sptrel testopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 309 <1> sptinternal -3 ; had a primary partition yet ? 0 00003EF2 740E jz .callprimary ; no, accept it --> 0 00003EF4 F606[0100]01 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_ignore_subsequent_primary 312 <1> sptinternal -3 ; ignore subsequent primary ? 0 00003EF9 7509 jnz .ignoreprimary ; yes, ignore it --> 0 00003EFB F606[0100]08 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_subsequent_primary_after 315 <1> sptinternal -3 ; subsequent after ? 0 00003F00 7502 jnz .ignoreprimary 317 <1> .callprimary: 318 <1> %endif 0 00003F02 FFD1 call cx ; es:si -> partition table entry 320 <1> ; byte [load_current_partition] = which 321 <1> .ignoreprimary: 322 <1> .loop_primary_skip: 0 00003F04 83C610 add si, 16 0 00003F07 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 325 <1> sptinternal 0 00003F0B 72C5 jb .loop_primary_parts 327 <1> 328 <1> %if _SPT_MULTIPASS 329 <1> .end: 330 <1> %ifidn _BASE, bp 0 00003F0D 89EC mov sp, bp ; restore sp 0 00003F0F 5D pop bp 333 <1> %else 334 <1> mov sp, bx ; restore sp 335 <1> pop ax ; (discard dummy bp value) 336 <1> %endif 0 00003F10 C3 retn ; and bye 338 <1> 339 <1> 340 <1> %[_SCANPTAB_PREFIX]scan_logical: 0 00003F11 55 push bp 342 <1> %ifidn _BASE, ss:bx 343 <1> mov bx, sp 344 <1> %elifidn _BASE, bp 0 00003F12 89E5 mov bp, sp 346 <1> %endif 0 00003F14 31FF xor di, di 0 00003F16 57 push di ; [_BASE+di-2] 0 00003F17 57 push di ; [_BASE+di-4] 0 00003F18 57 push di ; [_BASE+di-6] 0 00003F19 57 push di ; [_BASE+di-8] 352 <1> 0 00003F1A 31C0 xor ax, ax 0 00003F1C 31D2 xor dx, dx 355 <1> %if _MODE 0 00003F1E A3[0000] sptrel mov word [ %[_SCANPTAB_PREFIX]load_scan_flags ], ax 357 <1> sptinternal 358 <1> %endif 0 00003F21 A3[0000] sptrel mov word [ %[_SCANPTAB_PREFIX]load_partition_cycle], ax 360 <1> sptinternal 0 00003F24 E88202 call %[_SCANPTAB_PREFIX]read_partition_table.first 0 00003F27 C606[0000]04 sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], 4 363 <1> sptinternal -3 364 <1> %if _SPT_ELD 365 <1> sptrel mov word [ %[_SCANPTAB_PREFIX]load_current_extended_and_is], dx ; = 0 366 <1> sptinternal 367 <1> %endif 368 <1> %else 369 <1> 370 <1> %[_SCANPTAB_PREFIX]scan_logical: 371 <1> %endif 372 <1> .: 373 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 374 <1> d4 asciz "In scan_logical.",13,10 375 <1> 376 <1> %if _MODE 0 00003F2C F606[0100]02 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_traditional_order_logical 378 <1> sptinternal -3 0 00003F31 7451 jz .nottraditional 380 <1> 0 00003F33 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 382 <1> sptinternal 383 <1> .loop_traditional: 0 00003F36 FF06[0000] sptrel inc word [ %[_SCANPTAB_PREFIX]load_partition_cycle] 385 <1> sptinternal 0 00003F3A 7503E9AB01 jz .got_partition_cycle 387 <1> 0 00003F3F 268A4404 mov al, [es:si + piType] 389 <1> 390 <1> %ifidn _BASE, bp 0 00003F43 31DB xor bx, bx 392 <1> %endif 0 00003F45 84C0 test al, al 0 00003F47 742D jz .next_traditional 0 00003F49 3C0F cmp al, 0Fh ; extended partition (LBA aware) ? 0 00003F4B 7429 je .next_traditional ; yes --> 0 00003F4D 247F and al, ~80h ; extended partition Linux (85h) ? 0 00003F4F 3C05 cmp al, 05h ; or extended partition DOS (05h) ? 0 00003F51 7423 je .next_traditional ; yes --> 400 <1> 401 <1> %ifidn _BASE, bp 0 00003F53 395BFE cmp word [_BASE+di-2], bx 0 00003F56 7505 jne .logical_traditional 0 00003F58 395BFC cmp word [_BASE+di-4], bx 405 <1> %else 406 <1> cmp word [_BASE+di-2], 0 407 <1> jne .logical_traditional 408 <1> cmp word [_BASE+di-4], 0 409 <1> %endif 0 00003F5B 7419 je .next_traditional 411 <1> .logical_traditional: 412 <1> 413 <1> %if _MODE 0 00003F5D F606[0000]20 sptrel testopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 415 <1> sptinternal -3 ; had a logical partition yet ? 0 00003F62 7407 jz .calllogicaltrad ; no, accept it --> 0 00003F64 F606[0000]80 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_ignore_subsequent_logical 418 <1> sptinternal -3 ; ignore subsequent logical ? 0 00003F69 750B jnz .ignorelogicaltrad ; yes, ignore it --> 420 <1> .calllogicaltrad: 421 <1> %endif 422 <1> 0 00003F6B FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 424 <1> sptinternal 0 00003F6F 7503E97C01 jz .error_too_many_partitions 0 00003F74 FFD1 call cx ; (sets load_scan_flags & 32 if recognised) 427 <1> ; CHG: ax, (cx), dx, bx if _BASE = bp 428 <1> ; preserve: (cx), si, di, ds, es, bx if _BASE = ss:bx 429 <1> .ignorelogicaltrad: 430 <1> .next_traditional: 0 00003F76 83C610 add si, 16 ; -> next partition table entry 0 00003F79 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 433 <1> sptinternal ; was last? 0 00003F7D 72B7 jb .loop_traditional ; no, loop --> 435 <1> 0 00003F7F 800E[0000]20 sptrel setopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 437 <1> sptinternal -3 ; mark as had logical 438 <1> 439 <1> .nottraditional: 440 <1> %endif 441 <1> 0 00003F84 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 443 <1> sptinternal 444 <1> .loop: 0 00003F87 FF06[0000] sptrel inc word [ %[_SCANPTAB_PREFIX]load_partition_cycle] 446 <1> sptinternal 0 00003F8B 7503E95A01 jz .got_partition_cycle 448 <1> 0 00003F90 268A4404 mov al, [es:si + piType] 450 <1> 451 <1> %ifidn _BASE, bp 0 00003F94 31DB xor bx, bx 453 <1> %endif 0 00003F96 84C0 test al, al 0 00003F98 7503E98C00 jz .next 456 <1> %if _MODE 457 <1> %ifidn _BASE, bp 0 00003F9D 395BFE cmp word [_BASE+di-2], bx 0 00003FA0 754B jne .allextended 0 00003FA2 395BFC cmp word [_BASE+di-4], bx 461 <1> %else 462 <1> cmp word [_BASE+di-2], 0 463 <1> jne .allextended 464 <1> cmp word [_BASE+di-4], 0 465 <1> %endif 0 00003FA5 7546 jne .allextended 467 <1> 0 00003FA7 8A26[0000] sptrel mov ah, [ %[_SCANPTAB_PREFIX]load_mode ] 469 <1> sptinternal 0 00003FAB 3C05 cmp al, 5 0 00003FAD 7410 je .check 0 00003FAF D0EC shr ah, 1 0 00003FB1 D0EC shr ah, 1 0 00003FB3 3C0F cmp al, 15 0 00003FB5 7408 je .check 0 00003FB7 D0EC shr ah, 1 0 00003FB9 D0EC shr ah, 1 0 00003FBB 3C85 cmp al, 85h 0 00003FBD 7546 jne .notextended 480 <1> .check: 0 00003FBF 8026[0000]EF sptrel clropt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 16 482 <1> sptinternal -3 ; new outermost extended 483 <1> 0 00003FC4 F6C403 test ah, 11b 0 00003FC7 7474 jz .push ; if it is 00b = all, always accept --> 0 00003FC9 F6C402 test ah, 10b ; if prior is NZ but this is zero 0 00003FCC 745B jz .ignoreextended ; then we have 01b, always ignore --> 0 00003FCE F6C401 test ah, 01b ; if prior is NZ and this is NZ, 489 <1> ; jnz .firsttype ; then we have 11b, accept first of type 0 00003FD1 B401 mov ah, 1 ; flag 1 for 10b 0 00003FD3 740C jz @F ; if ZR, we have 10b, accept first of all types with 10b 492 <1> .firsttype: 0 00003FD5 B402 mov ah, 2 ; flag 2 for 11b type 5 0 00003FD7 3C0F cmp al, 15 0 00003FD9 7206 jb @F 0 00003FDB B404 mov ah, 4 ; flag 4 for 11b type 15 0 00003FDD 7402 je @F 0 00003FDF B408 mov ah, 8 ; flag 8 for 11b type 85h 499 <1> @@: 0 00003FE1 8426[0000] sptrel test byte [ %[_SCANPTAB_PREFIX]load_scan_flags ], ah 501 <1> sptinternal ; seen one of those before ? 0 00003FE5 7542 jnz .ignoreextended ; yes, ignore --> 0 00003FE7 0826[0000] sptrel or byte [ %[_SCANPTAB_PREFIX]load_scan_flags ], ah 504 <1> sptinternal ; no, note seen it now 0 00003FEB EB50 jmp .push ; and process extended partition --> 506 <1> %endif 507 <1> 508 <1> .allextended: 509 <1> %if _MODE 0 00003FED F606[0000]40 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_ignore_subsequent_nested 511 <1> sptinternal -3 0 00003FF2 7407 jz @F 0 00003FF4 F606[0000]10 sptrel testopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 16 514 <1> sptinternal -3 0 00003FF9 752E jnz .ignoreextended 516 <1> @@: 517 <1> %endif 0 00003FFB 3C0F cmp al, 0Fh ; extended partition (LBA aware) ? 0 00003FFD 743E je .push ; yes --> 0 00003FFF 247F and al, ~80h ; extended partition Linux (85h) ? 0 00004001 3C05 cmp al, 05h ; or extended partition DOS (05h) ? 0 00004003 7438 je .push ; yes --> 523 <1> .notextended: 524 <1> 525 <1> %ifidn _BASE, bp 0 00004005 395BFE cmp word [_BASE+di-2], bx 0 00004008 7505 jne .logical 0 0000400A 395BFC cmp word [_BASE+di-4], bx 529 <1> %else 530 <1> cmp word [_BASE+di-2], 0 531 <1> jne .logical 532 <1> cmp word [_BASE+di-4], 0 533 <1> %endif 0 0000400D 741A je .next 535 <1> .logical: 536 <1> 537 <1> %if _MODE 0 0000400F F606[0000]20 sptrel testopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 539 <1> sptinternal -3 ; had a logical partition yet ? 0 00004014 7408 jz .calllogical ; no, accept it --> 0 00004016 F706[0000]8002 sptrel test word [ %[_SCANPTAB_PREFIX]load_mode ], strict word mode_ignore_subsequent_logical | mode_traditional_order_logical 543 <1> sptinternal -4 ; ignore subsequent logical or post-trad run ? 0 0000401C 750B jnz .ignorelogical ; yes, ignore it --> 545 <1> .calllogical: 546 <1> %endif 547 <1> 0 0000401E FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 549 <1> sptinternal 0 00004022 7503E9C900 jz .error_too_many_partitions 0 00004027 FFD1 call cx ; (sets load_scan_flags & 32 if recognised) 552 <1> ; CHG: ax, (cx), dx, bx if _BASE = bp 553 <1> ; preserve: (cx), si, di, ds, es, bx if _BASE = ss:bx 554 <1> .ignorelogical: 555 <1> .ignoreextended: 556 <1> .next: 0 00004029 83C610 add si, 16 ; -> next partition table entry 0 0000402C 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 559 <1> sptinternal ; was last? 0 00004030 7303E952FF jb .loop ; no, loop --> 0 00004035 85FF test di, di ; still some on stack? 0 00004037 756A jnz .pop ; yes, pop 563 <1> .end: 564 <1> %ifidn _BASE, bp 0 00004039 89EC mov sp, bp ; restore sp 0 0000403B 5D pop bp 567 <1> %else 568 <1> mov sp, bx ; restore sp 569 <1> pop ax ; (discard dummy bp value) 570 <1> %endif 571 <1> %if _MODE && ! _SPT_MULTIPASS 572 <1> jmp scan_subsequent_primary 573 <1> %else 0 0000403C C3 retn ; and bye 575 <1> %endif 576 <1> 577 <1> 578 <1> .push: 579 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 580 <1> d4 asciz "In scan_logical.push",13,10 581 <1> 582 <1> %if _SPT_ELD 583 <1> sptrel rol byte [ %[_SCANPTAB_PREFIX]extended], 1 584 <1> sptinternal 585 <1> jnc @F 586 <1> sptrel not byte [ %[_SCANPTAB_PREFIX]load_is_extended] 587 <1> sptinternal 588 <1> 589 <1> push si 590 <1> sub di, 10 ; address temporary root and base 591 <1> push word [_BASE+di+10-2] 592 <1> push word [_BASE+di+10-4] ; copy root as root 593 <1> push word [_BASE+di+10-2] 594 <1> push word [_BASE+di+10-4] ; copy root as base 595 <1> ; Extended partitions always have LBA start values 596 <1> ; relative to the outermost extended partition. 597 <1> ; Therefore the "root" must be used as base for 598 <1> ; this call to always get the expected address 599 <1> ; from dword [bp - di - 8] + dword [es:si + 8]. 600 <1> 601 <1> call cx 602 <1> 603 <1> add sp, 8 ; discard temporary root and base 604 <1> add di, 10 ; point back to prior root and base 605 <1> pop si ; undo last part of the stack frame 606 <1> 607 <1> sptrel not byte [ %[_SCANPTAB_PREFIX]load_is_extended] 608 <1> sptinternal 609 <1> sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_extended] 610 <1> sptinternal 611 <1> %ifidn _BASE, bp 612 <1> xor bx, bx 613 <1> %endif 614 <1> @@: 615 <1> %endif 616 <1> 0 0000403D 56 push si 618 <1> .push_check_empty_next: 0 0000403E 83C610 add si, 16 ; -> next 0 00004041 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 621 <1> sptinternal ; at end? 0 00004045 7203E98400 jae .replace ; yes, no other partitions found, replace --> 0 0000404A 26807C0400 cmp byte [es:si + piType], 0 ; is this a partition? 0 0000404F 74ED je .push_check_empty_next ; no, check next --> 625 <1> ; found a partition after this, do push 626 <1> ; (possibly logical or another extended) 627 <1> .push_check_is_not_empty: 628 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 629 <1> d4 asciz "In scan_logical.push_check_is_not_empty",13,10 630 <1> 631 <1> %if _MODE 0 00004051 31C0 xor ax, ax ; sentinel 0 = accept more logicals 633 <1> 0 00004053 F606[0100]02 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_traditional_order_logical 635 <1> sptinternal -3 0 00004058 750E jnz .traditionalsentinel 0 0000405A F606[0000]20 sptrel testopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 638 <1> sptinternal -3 ; had a logical partition in this table ? 0 0000405F 7409 jz @F ; no, no need to reset --> 0 00004061 F606[0000]80 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_ignore_subsequent_logical 641 <1> sptinternal -3 ; ignore subsequent logical ? 0 00004066 7402 jz @F ; no --> 643 <1> .traditionalsentinel: 0 00004068 B040 mov al, 64 ; sentinel 64 = no more logicals 645 <1> @@: 0 0000406A 8026[0000]DF sptrel clropt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 647 <1> sptinternal -3 ; accept a logical partition in next table 648 <1> %endif 649 <1> 0 0000406F 5E pop si ; restore -> partition table entry 651 <1> %if _MODE 0 00004070 26FF7408 push word [es:si + piStart] 0 00004074 268B540A mov dx, word [es:si + piStart + 2] ; get extended partition offset 0 00004078 01C6 add si, ax ; now -> behind partition_table if sentinel set 0 0000407A 58 pop ax 656 <1> %endif 0 0000407B 56 push si ; stored at word [_BASE+di-10] 0 0000407C 83EF0A sub di, 10 0 0000407F FF7308 push word [_BASE+di+10-2] 0 00004082 FF7306 push word [_BASE+di+10-4] ; copy root 661 <1> %ifn _MODE 662 <1> mov ax, word [es:si + piStart] 663 <1> mov dx, word [es:si + piStart + 2] ; get extended partition offset 664 <1> %endif 0 00004085 0343FC add ax, word [_BASE+di-4] 0 00004088 1353FE adc dx, word [_BASE+di-2] ; add in root to get absolute sector number 667 <1> 0 0000408B 52 push dx 0 0000408C 50 push ax ; new base 670 <1> 671 <1> .replace_common: 672 <1> %ifidn _BASE, bp 0 0000408D 395BFE cmp word [_BASE+di-2], bx ; have a (nonzero) root? 0 00004090 750B jne .have_root 0 00004092 395BFC cmp word [_BASE+di-4], bx 676 <1> %else 677 <1> cmp word [_BASE+di-2], 0 ; have a (nonzero) root? 678 <1> jne .have_root 679 <1> cmp word [_BASE+di-4], 0 680 <1> %endif 0 00004095 7506 jne .have_root ; yes --> 682 <1> 0 00004097 8953FE mov word [_BASE+di-2], dx 0 0000409A 8943FC mov word [_BASE+di-4], ax ; set root 685 <1> .have_root: 686 <1> 0 0000409D E80901 call %[_SCANPTAB_PREFIX]read_partition_table.first 0 000040A0 E989FE jmp . 689 <1> 690 <1> .pop: 691 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 692 <1> d4 asciz "In scan_logical.pop",13,10 693 <1> 694 <1> %if _MODE 0 000040A3 800E[0000]10 sptrel setopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 16 696 <1> sptinternal -3 ; remember we found a nested extended partition 697 <1> ; so we can ignore others in the same outermost 698 <1> %endif 699 <1> 0 000040A8 83C70A add di, 10 0 000040AB 83C408 add sp, 8 0 000040AE 5E pop si 703 <1> 704 <1> %if _MODE 0 000040AF 8026[0000]DF sptrel clropt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 706 <1> sptinternal -3 ; accept a logical partition in this table 0 000040B4 81FE[4000] sptrel cmp si, 64 + %[_SCANPTAB_PREFIX]partition_table 708 <1> sptinternal ; sentinel set ? 0 000040B8 7208 jb @F ; no --> 0 000040BA 800E[0000]20 sptrel setopt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 711 <1> sptinternal -3 ; do not accept a logical partition in this table 0 000040BF 83EE40 sub si, 64 ; undo sentinel addition 713 <1> @@: 714 <1> %endif 0 000040C2 8B43F8 mov ax, word [_BASE+di-8] 0 000040C5 8B53FA mov dx, word [_BASE+di-6] 0 000040C8 E8DE00 call %[_SCANPTAB_PREFIX]read_partition_table.reload 0 000040CB E95BFF jmp .next 719 <1> 720 <1> .replace: 721 <1> d4 call %[_SCANPTAB_DEBUG4_PREFIX]d4message 722 <1> d4 asciz "In scan_logical.replace",13,10 723 <1> %if _MODE 0 000040CE 8026[0000]DF sptrel clropt [ %[_SCANPTAB_PREFIX]load_scan_flags ], 32 725 <1> sptinternal -3 ; accept a logical partition in next table 726 <1> %endif 727 <1> 0 000040D3 5E pop si ; (discard) 729 <1> .replace_no_pop: 0 000040D4 268B4408 mov ax, word [es:si + piStart] 0 000040D8 268B540A mov dx, word [es:si + piStart + 2] ; get extended partition offset 0 000040DC 0343FC add ax, word [_BASE+di - 4] 0 000040DF 1353FE adc dx, word [_BASE+di - 2] ; add in root 0 000040E2 8943F8 mov word [_BASE+di - 8], ax 0 000040E5 8953FA mov word [_BASE+di - 6], dx ; set base 736 <1> 0 000040E8 EBA3 jmp .replace_common 738 <1> 739 <1> 740 <1> %if _BOOTCMD_FAIL_ERROR 741 <1> .got_partition_cycle: 0 000040EA BA[AF0F] sptrel mov dx, msg.boot_partition_cycle_error 743 <1> sptinternal 0 000040ED E9D3FB jmp bootcmd.fail 745 <1> 746 <1> .error_too_many_partitions: 0 000040F0 BA[8C0F] sptrel mov dx, msg.boot_too_many_partitions_error 748 <1> sptinternal 0 000040F3 E9CDFB jmp bootcmd.fail 750 <1> %endif 751 <1> 752 <1> 753 <1> %if _MODE 754 <1> @@: 0 000040F6 C3 retn 756 <1> 757 <1> scan_subsequent_primary: 0 000040F7 F606[0100]01 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_ignore_subsequent_primary 759 <1> sptinternal -3 ; ignore subsequent primary ? 0 000040FC 75F8 jnz @B ; yes --> 0 000040FE F606[0100]08 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_subsequent_primary_after 762 <1> sptinternal -3 ; subsequent after ? 0 00004103 74F1 jz @B ; no --> 764 <1> 0 00004105 55 push bp 766 <1> %ifidn _BASE, ss:bx 767 <1> mov bx, sp 768 <1> %elifidn _BASE, bp 0 00004106 89E5 mov bp, sp 770 <1> %endif 0 00004108 31FF xor di, di 0 0000410A 57 push di ; [_BASE+di-2] 0 0000410B 57 push di ; [_BASE+di-4] 0 0000410C 57 push di ; [_BASE+di-6] 0 0000410D 57 push di ; [_BASE+di-8] 776 <1> 777 <1> %if ! _SPT_MULTIPASS 778 <1> sptrel mov word [ %[_SCANPTAB_PREFIX]load_scan_flags ], di 779 <1> sptinternal 780 <1> %endif 781 <1> 0 0000410E 31C0 xor ax, ax 0 00004110 31D2 xor dx, dx 784 <1> 785 <1> %if _SPT_MULTIPASS 0 00004112 A3[0000] sptrel mov word [ %[_SCANPTAB_PREFIX]load_scan_flags ], ax 787 <1> sptinternal 788 <1> %endif 789 <1> 0 00004115 E89100 call %[_SCANPTAB_PREFIX]read_partition_table.reload 791 <1> ; (re)read MBR 0 00004118 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 793 <1> sptinternal 0 0000411B 8816[0000] sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], dl ; = 0 795 <1> sptinternal 796 <1> %if _SPT_ELD 797 <1> sptrel mov word [ %[_SCANPTAB_PREFIX]load_current_extended_and_is], dx ; = 0 798 <1> sptinternal 799 <1> %endif 800 <1> 0 0000411F F606[0100]04 sptrel testopt [ %[_SCANPTAB_PREFIX]load_mode ], mode_active_priority 802 <1> sptinternal -3 ; active primary first ? 0 00004124 742A jz .detect_lowest 804 <1> 805 <1> .loop_active_skip: 806 <1> 0 00004126 FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 808 <1> sptinternal 0 0000412A 268A4404 mov al, byte [es:si + piType] 0 0000412E 3C00 cmp al, 0 0 00004130 7415 je .loop_active_skip_skip 0 00004132 26803C00 cmp byte [es:si + piBoot], 0 0 00004136 740F je .loop_active_skip_skip 814 <1> 815 <1> ; INP: al = partition type 816 <1> ; OUT: CY if an LBA or FAT32 type that's disabled 817 <1> ; NC, ZR if known type we can access 818 <1> ; NC, NZ if unknown type 0 00004138 E8F5FB call %[_SCANPTAB_PREFIX]load_is_known 0 0000413B 720A jc .loop_active_skip_skip 0 0000413D 7508 jnz .loop_active_skip_skip 0 0000413F A0[0000] sptrel mov al, byte [ %[_SCANPTAB_PREFIX]load_current_partition] 823 <1> sptinternal 0 00004142 A2[0100] sptrel mov byte [ %[_SCANPTAB_PREFIX]load_scan_flags + 1], al 825 <1> sptinternal 0 00004145 EB37 jmp .active_skip_done 827 <1> 828 <1> .loop_active_skip_skip: 0 00004147 83C610 add si, 16 0 0000414A 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 831 <1> sptinternal 0 0000414E 72D6 jb .loop_active_skip 833 <1> 834 <1> .detect_lowest: 0 00004150 BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 836 <1> sptinternal 0 00004153 C606[0000]00 sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], 0 838 <1> sptinternal -3 839 <1> 840 <1> .loop_lowest: 0 00004158 FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 842 <1> sptinternal 0 0000415C 268A4404 mov al, byte [es:si + piType] 0 00004160 3C00 cmp al, 0 0 00004162 740F je .loop_lowest_skip_skip 846 <1> 847 <1> ; INP: al = partition type 848 <1> ; OUT: CY if an LBA or FAT32 type that's disabled 849 <1> ; NC, ZR if known type we can access 850 <1> ; NC, NZ if unknown type 0 00004164 E8C9FB call %[_SCANPTAB_PREFIX]load_is_known 0 00004167 720A jc .loop_lowest_skip_skip 0 00004169 7508 jnz .loop_lowest_skip_skip 0 0000416B A0[0000] sptrel mov al, byte [ %[_SCANPTAB_PREFIX]load_current_partition] 855 <1> sptinternal 0 0000416E A2[0100] sptrel mov byte [ %[_SCANPTAB_PREFIX]load_scan_flags + 1], al 857 <1> sptinternal 0 00004171 EB0B jmp .lowest_skip_done 859 <1> 860 <1> .loop_lowest_skip_skip: 0 00004173 83C610 add si, 16 0 00004176 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 863 <1> sptinternal 0 0000417A 72DC jb .loop_lowest 0 0000417C EB27 jmp .end ; none found 866 <1> 867 <1> .lowest_skip_done: 868 <1> .active_skip_done: 0 0000417E BE[0000] sptrel mov si, %[_SCANPTAB_PREFIX]partition_table 870 <1> sptinternal 0 00004181 C606[0000]00 sptrel mov byte [ %[_SCANPTAB_PREFIX]load_current_partition], 0 872 <1> sptinternal -3 873 <1> 874 <1> .loop_primary_parts: 0 00004186 FE06[0000] sptrel inc byte [ %[_SCANPTAB_PREFIX]load_current_partition] 876 <1> sptinternal 0 0000418A 26807C0400 cmp byte [es:si + piType], 0 0 0000418F 740B je .loop_primary_skip 879 <1> 880 <1> %if _MODE 0 00004191 A0[0000] sptrel mov al, byte [ %[_SCANPTAB_PREFIX]load_current_partition] 882 <1> sptinternal 0 00004194 3806[0100] sptrel cmp byte [ %[_SCANPTAB_PREFIX]load_scan_flags + 1], al 884 <1> sptinternal 0 00004198 7402 je .ignoreprimary 886 <1> %endif 0 0000419A FFD1 call cx ; es:si -> partition table entry 888 <1> ; byte [load_current_partition] = which 889 <1> .ignoreprimary: 890 <1> .loop_primary_skip: 0 0000419C 83C610 add si, 16 0 0000419F 81FE[0000] sptrel cmp si, strict word %[_SCANPTAB_PREFIX]partition_table.end 893 <1> sptinternal 0 000041A3 72E1 jb .loop_primary_parts 895 <1> 896 <1> .end: 897 <1> %ifidn _BASE, bp 0 000041A5 89EC mov sp, bp ; restore sp 0 000041A7 5D pop bp 900 <1> %else 901 <1> mov sp, bx ; restore sp 902 <1> pop ax ; (discard dummy bp value) 903 <1> %endif 0 000041A8 C3 retn 905 <1> %endif 906 <1> 907 <1> 908 <1> ; if _PARTITION_TABLE_IN_CS: 909 <1> ; INP: dx:ax = partition table sector to read 910 <1> ; CHG: ax, dx 911 <1> ; OUT: es = cs 912 <1> ; 64 bytes [es:partition_table] = partition table 913 <1> ; does not return if error 914 <1> 915 <1> ; else: 916 <1> ; INP: dx:ax = partition table sector to read 917 <1> ; CHG: ax, dx 918 <1> ; OUT: es = ss 919 <1> ; 64 bytes [es:partition_table] = partition table 920 <1> ; does not return if error 921 <1> %[_SCANPTAB_PREFIX]read_partition_table: 922 <1> %if _SPT_ELD 923 <1> .first: 924 <1> db __TEST_IMM8 ; NC, skip stc 925 <1> .reload: 926 <1> stc 927 <1> %else 928 <1> .first: 929 <1> .reload: 930 <1> %endif 931 <1> 0 000041A9 53 push bx 933 <1> %if _SPT_ELD 934 <1> sptrel mov bx, word [buffersegment] 935 <1> sptinternal 936 <1> %elifidn _BASE, bp 0 000041AA 8B1E[0400] mov bx, word [auxbuff_segorsel] ; bx => auxbuff 938 <1> %else 939 <1> mov bx, word [bp + ldSectorSeg] 940 <1> %endif 0 000041AE E822FC call %[_SCANPTAB_PREFIX]read_ae_512_bytes 942 <1> assume es:nothing 0 000041B1 5B pop bx 0 000041B2 26813EFE0155AA cmp word [es:510], 0AA55h 0 000041B9 7518 jne .signature_fail 0 000041BB 1E push ds 0 000041BC 57 push di 0 000041BD 56 push si 0 000041BE 51 push cx 0 000041BF 06 push es 0 000041C0 1F pop ds 952 <1> assume ds:nothing 0 000041C1 BEBE01 mov si, 510 - 4*16 ; ds:si -> partition table in sectorseg 954 <1> %if _PARTITION_TABLE_IN_CS 0 000041C4 0E push cs 956 <1> %else 957 <1> push ss 958 <1> %endif 0 000041C5 07 pop es 960 <1> assume es:SYSINITGROUP 0 000041C6 BF[0000] sptrel mov di, %[_SCANPTAB_PREFIX]partition_table 962 <1> sptinternal ; es:di -> cs:%[_SCANPTAB_PREFIX]partition_table 0 000041C9 B92000 mov cx, 4*16 / 2 0 000041CC F3A5 rep movsw 0 000041CE 59 pop cx 0 000041CF 5E pop si 0 000041D0 5F pop di 0 000041D1 1F pop ds 969 <1> assume ds:SYSINITGROUP 0 000041D2 C3 retn 971 <1> 972 <1> 973 <1> %if _BOOTCMD_FAIL_ERROR 974 <1> .signature_fail: 0 000041D3 BA[580F] sptrel mov dx, msg.bootfail_sig_parttable 976 <1> sptinternal 0 000041D6 E9EAFA jmp bootcmd.fail 978 <1> %endif 1853 resetdef DEBUG4 1854 1855 === Switch to base=000000h -> "DOSENTRY" 1856 usesection DOSENTRY 1857 1858 ;J.K. 9/24/86 We now decide, based on the configurations available so far, what 1859 ;code or data we need to keep as a stay resident code. The following table 1860 ;shows the configurations under consideration. They are listed in the order 1861 ;of their current position memory. 1862 ;Configuration will be done in two ways: 1863 ;First, we are going to set "Static configuration". Static configuration will 1864 ;consider from basic configuration to ENDOF96TPI configuration. The result 1865 ;of static configuration will be the address the Dynamic configuration will 1866 ;use to start with. 1867 ;Secondly, "Dynamic cofiguration" will be performed. Dynamic configuration 1868 ;involves possible relocation of CODE or DATA. Dynamic configuration routine 1869 ;will take care of BDSM tables and AT ROM Fix module thru K09 suspend/resume 1870 ;code individually. After these operation, FINAL_DOS_LOCATION will be set. 1871 ;This will be the place SYSINIT routine will relocate MSDOS module for good. 1872 ; 1873 ; 1. BASIC CONFIGURATION FOR IBMBIO (EndFloppy, EndSwap) 1874 ; 2. ENDONEHARD 1875 ; 3. ENDTWOHARD 1876 ; 4. END96TPI ;a system that supports "Change Line Error" 1877 ; 5. End of BDSM ;BDSM tables for mini disks. 1878 ; 6. ENDATROM ;Some of AT ROM fix module. 1879 ; 7. ENDCMOSCLOCKSET;Supporting program for CMOS clock write. 1880 ; 8. ENDK09 ;K09 CMOS Clock module to handle SUSPEND/RESUME operation. 1881 ; 1882 ; lDOS: Only END96TPI and ENDATROM are still used of all these. 1883 ; END96TPI and ENDFLOPPY are equal now, so only the first one 1884 ; is still used. (END96TPI is in ms96tpi.nas included by 1885 ; msbio2.nas, which aligns to a paragraph boundary before 1886 ; mshard.nas's IBM_DISK_IO. The latter is the start of the 1887 ; "AT ROM fix module" that ends at ENDATROM.) 1888 ; The UPBs (aka BDS tables) are handled later by INITUPB (in 1889 ; SYSINIT segment, source in this file) and are allocated 1890 ; using an S MCB as the DOS is already available then. (The 1891 ; UPBs are relocated into HMA, UMA, or LMA later.) 1892 ; The CMOS and K09 code is now in the DOSCODE segment, except 1893 ; for the i6C entrypoint (in entry.asm). 1894 1895 ;J.K. 9/24/86. 1896 1897 STATIC_CONFIGURE: 1898 assume ds:nothing, es:nothing, ss:nothing 0 000009DF B8[0000] mov ax, offset END96TPI ;let's start with the biggest one. 0 000009E2 E80E03 call dosentry_init_get_ds_dosbiodata 1901 assume ds:DOSGROUP 1902 fHave96 equ FHAVE96 ; NASM port label 0 000009E5 803E[0000]00 cmp byte [fHave96], 0 ;Is change line support there? 1904 Config96 equ CONFIG96 ; NASM port label 0 000009EA 7502 jnz Config96 ;Yes. 1906 1907 Basic_Floppy: 1908 ; mov ax, offset ENDFLOPPY 1909 ; ldos: do leave DOSENTRY data up to END96TPI resident 1910 ; ldos: ENDFLOPPY equals END96TPI now that the code 1911 ; has been moved out of the DOSENTRY section. 1912 Dynamic_Configure equ DYNAMIC_CONFIGURE ; NASM port label 0 000009EC EB24 jmp Dynamic_Configure ;static configuration is done! 1914 1915 ; 1916 ; KEEP THE 96TPI CODE 1917 ; 1918 CONFIG96: 1919 ; 1920 ; SAVE OLD INT 13 VECTOR 1921 ; 0 000009EE 0E push cs 0 000009EF 1F pop ds 1924 assume ds:DOSENTRYGROUP 0 000009F0 1E push ds 0 000009F1 07 pop es 1927 assume ds:DOSENTRYGROUP, es:DOSENTRYGROUP 1928 0 000009F2 50 PUSH AX 0 000009F3 1E PUSH DS 0 000009F4 31C0 XOR AX,AX 0 000009F6 8ED8 MOV DS,AX 1933 assume ds:IVT 1934 0 000009F8 A14C00 MOV AX,[4 * 13H] 0 000009FB 26A3[0000] MOV WORD PTR [es:REAL13],AX 0 000009FF A14E00 MOV AX,[4 * 13H+2] 0 00000A02 26A3[0200] MOV WORD PTR [es:REAL13+2],AX 1939 ; 1940 ; INSERT NEW VECTOR 1941 ; 1942 extern ms96tpi_i13 0 00000A06 C7064C00[0000] MOV WORD PTR [4 * 13H],OFFSET ms96tpi_i13 0 00000A0C 8C064E00 MOV [4 * 13H + 2], es 1945 0 00000A10 1F POP DS 1947 assume ds:DOSENTRYGROUP 0 00000A11 58 POP AX 1949 1950 DYNAMIC_CONFIGURE: 0 00000A12 1E push ds 0 00000A13 07 pop es 1953 assume es:DOSENTRYGROUP 0 00000A14 FC cld ;clear direction 1955 1956 CheckATROM: 0 00000A15 E8EB02 call Get_Para_Offset ;For dynamic allocation, we are 1958 ;going to use offset address that 1959 ;is in paragraph boundary. 1960 1961 0 00000A18 E8D802 call dosentry_init_get_ds_dosbiodata 1963 assume ds:DOSGROUP 0 00000A1B 803E[0000]FC cmp byte [Model_Byte], 0FCh ;AT ? 0 00000A20 753F jnz CheckCMOSClock 1966 0 00000A22 50 push ax 0 00000A23 B280 mov DL, 80h ; tell rom bios to look at hard drives 0 00000A25 B408 mov AH, 8h ; set command to get drive parameter 0 00000A27 F9 stc 0 00000A28 CD13 int 13h ; call ROM-BIOS to get number of drives 0 00000A2A 58 pop ax 0 00000A2B 7234 jc CheckCMOSClock 0 00000A2D 84D2 test dl, dl ; No hard file? 0 00000A2F 7430 jz CheckCMOSClock 1976 0 00000A31 BE00F0 mov si, 0F000h 0 00000A34 8EC6 mov es, si ;ES -> BIOS segment 1979 assume es:nothing ; 0 00000A36 0E push cs 0 00000A37 1F pop ds 1982 assume ds:DOSENTRYGROUP 0 00000A38 BE[0100] mov si, offset BIOS_DATE ; 0 00000A3B BFF5FF mov di, 0FFF5H ;ROM BIOS string is at F000:FFF5 1985 Cmpbyte: ;Only patch ROM for bios dated 01/10/84 0 00000A3E A6 cmpsb ; 0 00000A3F 7520 jnz CheckCMOSClock ; 0 00000A41 807CFF00 cmp byte ptr [si-1],0 ; 0 00000A45 75F7 jnz Cmpbyte ; 1990 SetRomCode: ;Now we have to install ROM fix 1991 ;AX is the address to move. 0 00000A47 1E push ds 0 00000A48 07 pop es 1994 assume es:DOSENTRYGROUP 1995 0 00000A49 A3[0000] mov word ptr [ORIG13], ax 0 00000A4C 8C1E[0200] mov word ptr [ORIG13+2], ds ;set new ROM bios int 13 vector 0 00000A50 B9[0000] mov cx, offset ENDATROM 0 00000A53 BE[0000] mov si, offset IBM_DISK_IO 0 00000A56 29F1 sub cx, si ;size of AT ROM FIX module 0 00000A58 89C7 mov di, ax ;destination 0 00000A5A F3A4 rep movsb ;relocate it 0 00000A5C 89F8 mov ax, di ;new ending address 0 00000A5E E8A202 call Get_Para_Offset ;in AX 2005 2006 CheckCMOSClock: 0 00000A61 0E push cs 0 00000A62 1F pop ds 2009 assume ds:DOSENTRYGROUP 0 00000A63 1E push ds 0 00000A64 07 pop es ;set ES to CODE seg 2012 assume ds:DOSENTRYGROUP, es:DOSENTRYGROUP 2013 2014 CheckK09: 2015 ;SB33025**************************************************************** 0 00000A65 50 push ax ;save ax ;SB ;3.30* 0 00000A66 06 push es 2018 0 00000A67 B4C0 mov ah, 0C0h 0 00000A69 F9 stc 0 00000A6A CD15 int 15h 2022 assume es:nothing 0 00000A6C 7210 jc .no_k09_if_CY 0 00000A6E 26F6470508 test byte [es:bx + 5], 1 << 3 0 00000A73 F9 stc 0 00000A74 7408 jz .no_k09_if_CY 2027 0 00000A76 B80041 mov ax,4100h ;Q: is it a K09 ;SB ;3.30* 0 00000A79 B300 mov bl,0 ; ;SB ;3.30* 0 00000A7B F9 stc 0 00000A7C CD15 int 15h ; ;SB ;3.30* 2032 ;SB33025**************************************************************** 2033 .no_k09_if_CY: 0 00000A7E 07 pop es 2035 assume es:DOSENTRYGROUP 0 00000A7F 58 pop ax 0 00000A80 721A jc CONFIGDONE 2038 0 00000A82 50 push ax 0 00000A83 1E push ds 0 00000A84 E86C02 call dosentry_init_get_ds_dosbiodata 2042 assume ds:DOSGROUP 2043 fHaveK09 equ FHAVEK09 ; NASM port label 0 00000A87 C606[0000]01 mov byte [fHaveK09], 1 ;remember we have a K09 type 0 00000A8C 31C0 xor ax,ax 0 00000A8E 8ED8 mov ds, ax 2047 assume ds:IVT 2048 2049 extern i6C 0 00000A90 C706B001[0000] mov word ptr [4 * 6Ch], i6C ;new INT 6Ch handler 0 00000A96 8C0EB201 mov [4 * 6Ch +2], cs 2052 0 00000A9A 1F pop ds 2054 assume ds:DOSENTRYGROUP 0 00000A9B 58 pop ax ;restore the ending address 2056 2057 ; SET UP CONFIG STUFF FOR SYSINIT 2058 2059 CONFIGDONE: ;AX is final ending address of MSBIO. 0 00000A9C BA[0000] MOV DX,SYSINITSEG 0 00000A9F 8EDA MOV DS,DX 2062 assume ds:SYSINITGROUP 2063 2064 ; SUB AX,OFFSET START$ ; (zero) 0 00000AA1 83C00F ADD AX,15 0 00000AA4 D1D8 RCR AX,1 0 00000AA6 D1E8 SHR AX, 1 0 00000AA8 D1E8 SHR AX, 1 0 00000AAA D1E8 SHR AX, 1 0 00000AAC 05[0000] add ax, DOSENTRY 0 00000AAF A3[0000] MOV [behind_dosentry_segment], AX 0 00000AB2 2EA0[0000] mov al, [cs:DRVMAX] 0 00000AB6 A2[0000] mov [HARDNUM], al ; REMEMBER WHICH DRIVE IS HARD DISK 2074 2075 MESSAGE FTESTINIT,<"FINAL DOS LOCATION IS "> 2076 MNUM FTESTINIT,FINAL_DOS_LOCATION 2077 MESSAGE FTESTINIT, 0 00000AB9 0E PUSH CS 0 00000ABA 1F POP DS 2080 2081 assume ds:DOSENTRYGROUP, es:nothing 2082 2083 %if 0 2084 call_purge_96tpi: 2085 CMP BYTE [FHAVE96],0 2086 JNZ .no 2087 CALL PURGE_96TPI ;MJB001 ELIMINATE CALLS TO 96TPI HOOHAH 2088 .no 2089 %endif 2090 2091 relocate_sysinit_and_early_dos: 2092 MESSAGE FTESTINIT,<"SYSINIT",CR,LF> 2093 ZWAIT 2094 MESSAGE FTESTINIT,<"ON TO SYSINIT...",CR,LF> 2095 2096 extern SYSSIZE, afterdosdatalabel, afterdoscodelabel, doscode_start, doscode_mcb 2097 0 00000ABB BB[0000] mov bx, SYSINITMCB 0 00000ABE 8EDB mov ds, bx 2100 assume ds:nothing 0 00000AC0 B104 mov cl, 4 0 00000AC2 D32E0300 shr word [mcbSize], cl ; make paragraphs 0 00000AC6 BB[0000] mov bx, DOSDATAMCB 0 00000AC9 8EDB mov ds, bx 2105 assume ds:nothing 0 00000ACB D32E0300 shr word [mcbSize], cl ; make paragraphs 0 00000ACF BB[0000] mov bx, DOSCODEGROUP 0 00000AD2 8EDB mov ds, bx 2109 assume ds:DOSCODEGROUP 0 00000AD4 D32E[0300] shr word [doscode_mcb + mcbSize], cl 2111 ; make paragraphs 2112 0 00000AD8 B8[1000] MOV AX, SYSSIZE + 16 wrt SYSINITSEG 0 00000ADB E88B00 call dosentry_init_ParaRound 0 00000ADE 91 xchg cx, ax 0 00000ADF B8[0000] mov ax, afterdoscodelabel wrt DOSCODEGROUP 0 00000AE2 E88400 call dosentry_init_ParaRound 2118 0 00000AE5 BB[0000] mov bx, SYSINITSEG 0 00000AE8 8EDB mov ds, bx 2121 assume ds:SYSINITGROUP 0 00000AEA 8B16[0000] mov dx, [MEMORY_SIZE] 0 00000AEE 29CA sub dx, cx ; => SYSINIT destination 0 00000AF0 7234 jc .oom 0 00000AF2 83EA18 sub dx, paras(SYSINITSTACK) ; leave stack buffer 0 00000AF5 722F jc .oom 0 00000AF7 89D6 mov si, dx 0 00000AF9 83EA01 sub dx, 1 ; leave buffer for first UMCB, 2129 ; => SYSINIT MCB destination 0 00000AFC 7628 jbe .oom 0 00000AFE 29C2 sub dx, ax ; => early DOSCODE destination 0 00000B00 89D7 mov di, dx 0 00000B02 7222 jc .oom 0 00000B04 01C1 add cx, ax 2135 0 00000B06 B8[0000] mov ax, afterdosdatalabel wrt DOSSTART 0 00000B09 E85D00 call dosentry_init_ParaRound 0 00000B0C 29C2 sub dx, ax ; => early DOSDATA destination 0 00000B0E 7216 jc .oom 0 00000B10 52 push dx 0 00000B11 83EA01 sub dx, 1 ; => DOSDATA S MCB 0 00000B14 7210 jc .oom 0 00000B16 01C1 add cx, ax 0 00000B18 41 inc cx 2145 2146 ; Note: This check is only valid if there is no 2147 ; data to still be used between the relocate 2148 ; block and the end of the DOSENTRY section. 2149 ; This is now true with DOSDATA being relocated. 0 00000B19 B8[D305] mov ax, end_of_dosentry_init_late 0 00000B1C E84A00 call dosentry_init_ParaRound 0 00000B1F 05[0000] add ax, DOSENTRY 0 00000B22 39C2 cmp dx, ax 0 00000B24 7316 jae @F 2155 2156 .oom: 2157 dosentry_init_oom: 0 00000B26 BE[D305] mov si, dosentry_init_msg.oom ; access with cs 0 00000B29 B40E mov ah, 0Eh 0 00000B2B BB0700 mov bx, 7 0 00000B2E A9 db __TEST_IMM16 ; skip int 2162 .msgloop: 0 00000B2F CD10 int 10h 0 00000B31 2EAC cs lodsb 0 00000B33 84C0 test al, al 0 00000B35 75F8 jnz .msgloop 2167 .halt: 0 00000B37 CC int3 0 00000B38 FB sti 0 00000B39 F4 hlt 0 00000B3A EBFB jmp .halt 2172 2173 @@: 0 00000B3C 5D pop bp 0 00000B3D FA cli 2176 align 2, nop 2177 .stack: 0 00000B3E 0E push cs 0 00000B3F 17 pop ss 0 00000B40 BC[1005] mov sp, .stack 2181 assume ss:DOSENTRYGROUP 2182 %if (.stack - INIT) < 512 2183 %error Too small DOSENTRY init stack 2184 %endif 0 00000B43 B8[0000] mov ax, DOSDATAMCB 0 00000B46 E82C00 call dosentry_init_movp 2187 0 00000B49 31C0 xor ax, ax 0 00000B4B 8ED8 mov ds, ax 2190 assume ds:IVT 0 00000B4D 95 xchg ax, bp 0 00000B4E A3C600 mov word [31h * 4 + 2], ax ; init => DOSDATA 0 00000B51 8ED8 mov ds, ax 2194 assume ds:DOSGROUP 0 00000B53 893E[0000] mov word [dosdata_to_doscode], di 0 00000B57 B8[0000] mov ax, DOSENTRY 0 00000B5A 8ED8 mov ds, ax 2198 assume ds:DOSENTRYGROUP 2199 extern ..@dosentry_doscode_segment 0 00000B5C 893E[0000] mov word [..@dosentry_doscode_segment], di 0 00000B60 FB sti 2202 2203 extern GOINIT 0 00000B61 89D1 mov cx, dx ; => DOSDATA S MCB 0 00000B63 B8[0000] mov ax, GOINIT 0 00000B66 56 push si 0 00000B67 50 push ax 0 00000B68 CB retf 2209 2210 INIT ENDP 2211 2212 2213 dosentry_init_ParaRound: 2214 assume ds:nothing, es:nothing, ss:nothing 0 00000B69 83C00F ADD AX,15 0 00000B6C D1D8 RCR AX,1 0 00000B6E D1E8 SHR AX,1 0 00000B70 D1E8 SHR AX,1 0 00000B72 D1E8 SHR AX,1 0 00000B74 C3 retn 2221 2222 2223 ; Move paragraphs 2224 ; 2225 ; INP: ax:0-> source 2226 ; dx:0-> destination 2227 ; cx = number of paragraphs 2228 ; CHG: - 2229 ; Note: Doesn't work correctly on HMA; doesn't always wrap to LMA either. 2230 ; Do not provide a wrapped/HMA source or destination! 2231 dosentry_init_movp: 2232 assume ds:nothing, es:nothing, ss:nothing 0 00000B75 51 push cx 0 00000B76 1E push ds 0 00000B77 56 push si 0 00000B78 06 push es 0 00000B79 57 push di 2238 0 00000B7A 39D0 cmp ax, dx ; source above destination ? 0 00000B7C 770A ja .up ; yes, move up (forwards) --> 0 00000B7E 747B je .return ; same, no need to move --> 0 00000B80 50 push ax 0 00000B81 01C8 add ax, cx ; (expected not to carry) 0 00000B83 39D0 cmp ax, dx ; end of source is above destination ? 0 00000B85 58 pop ax 0 00000B86 7730 ja .down ; yes, move from top down --> 2247 ; Here, the end of source is below-or-equal the destination, 2248 ; so they do not overlap. In this case we prefer moving up. 2249 2250 .up: 0 00000B88 50 push ax 0 00000B89 52 push dx 2253 .uploop: 0 00000B8A 8ED8 mov ds, ax 0 00000B8C 8EC2 mov es, dx 2256 assume ds:nothing, es:nothing 0 00000B8E 31FF xor di, di 0 00000B90 31F6 xor si, si ; -> start of segment 0 00000B92 81E90010 sub cx, 1000h ; 64 KiB left ? 0 00000B96 7610 jbe .uplast ; no --> 0 00000B98 51 push cx 0 00000B99 B90080 mov cx, 10000h /2 0 00000B9C F3A5 rep movsw ; move 64 KiB 0 00000B9E 59 pop cx 0 00000B9F 050010 add ax, 1000h 0 00000BA2 81C20010 add dx, 1000h ; -> next segment 0 00000BA6 EBE2 jmp short .uploop ; proceed for more --> 2268 .uplast: 0 00000BA8 81C10010 add cx, 1000h ; restore counter 0 00000BAC D1E1 shl cx, 1 0 00000BAE D1E1 shl cx, 1 0 00000BB0 D1E1 shl cx, 1 ; *8, paragraphs to words 0 00000BB2 F3A5 rep movsw ; move last part 0 00000BB4 5A pop dx 0 00000BB5 58 pop ax 0 00000BB6 EB43 jmp short .return 2277 2278 .down: 0 00000BB8 FD std ; _AMD_ERRATUM_109_WORKAROUND as below 2280 .dnloop: 0 00000BB9 81E90010 sub cx, 1000h ; 64 KiB left ? 0 00000BBD 761A jbe .dnlast ; no --> 0 00000BBF 50 push ax 0 00000BC0 52 push dx 0 00000BC1 01C8 add ax, cx 0 00000BC3 01CA add dx, cx 0 00000BC5 8ED8 mov ds, ax ; -> 64 KiB not yet moved 0 00000BC7 8EC2 mov es, dx 2289 assume ds:nothing, es:nothing 0 00000BC9 5A pop dx 0 00000BCA 58 pop ax 0 00000BCB BFFEFF mov di, -2 0 00000BCE 89FE mov si, di ; moved from last word down 0 00000BD0 51 push cx 0 00000BD1 B90080 mov cx, 10000h /2 0 00000BD4 F3A5 rep movsw ; move 64 KiB 0 00000BD6 59 pop cx 0 00000BD7 EBE0 jmp short .dnloop ; proceed for more --> 2299 .dnlast: 0 00000BD9 81C10010 add cx, 1000h ; restore counter 0 00000BDD D1E1 shl cx, 1 0 00000BDF D1E1 shl cx, 1 0 00000BE1 D1E1 shl cx, 1 ; *8, paragraphs to words 0 00000BE3 89CF mov di, cx 0 00000BE5 4F dec di 0 00000BE6 D1E7 shl di, 1 ; words to offset, -> last word 0 00000BE8 89FE mov si, di 0 00000BEA 8ED8 mov ds, ax 0 00000BEC 8EC2 mov es, dx ; first segment correct 2310 assume ds:nothing, es:nothing 2311 2312 2313 numdef AMD_ERRATUM_109_WORKAROUND, 1 2314 %if 0 2315 2316 Jack R. Ellis pointed out this erratum: 2317 2318 Quoting from https://www.amd.com/system/files/TechDocs/25759.pdf page 69: 2319 2320 109 Certain Reverse REP MOVS May Produce Unpredictable Behavior 2321 2322 Description 2323 2324 In certain situations a REP MOVS instruction may lead to 2325 incorrect results. An incorrect address size, data size 2326 or source operand segment may be used or a succeeding 2327 instruction may be skipped. This may occur under the 2328 following conditions: 2329 2330 * EFLAGS.DF=1 (the string is being moved in the reverse direction). 2331 2332 * The number of items being moved (RCX) is between 1 and 20. 2333 2334 * The REP MOVS instruction is preceded by some microcoded instruction 2335 that has not completely retired by the time the REP MOVS begins 2336 execution. The set of such instructions includes BOUND, CLI, LDS, 2337 LES, LFS, LGS, LSS, IDIV, and most microcoded x87 instructions. 2338 2339 Potential Effect on System 2340 2341 Incorrect results may be produced or the system may hang. 2342 2343 Suggested Workaround 2344 2345 Contact your AMD representative for information on a BIOS update. 2346 2347 %endif 2348 2349 %if _AMD_ERRATUM_109_WORKAROUND 0 00000BEE E308 jcxz @FF 0 00000BF0 83F914 cmp cx, 20 0 00000BF3 7703 ja @FF 2353 @@: 0 00000BF5 A5 movsw 0 00000BF6 E2FD loop @B 2356 @@: 2357 %endif 0 00000BF8 F3A5 rep movsw ; move first part 0 00000BFA FC cld 2360 .return: 0 00000BFB 5F pop di 0 00000BFC 07 pop es 2363 assume es:nothing 0 00000BFD 5E pop si 0 00000BFE 1F pop ds 2366 assume ds:nothing 0 00000BFF 59 pop cx 0 00000C00 C3 retn 2369 2370 end_of_dosentry_init_late: 2371 2372 dosentry_init_msg: 0 00000C01 6C444F53206C6F6164 .oom: asciz "lDOS load error: Out of memory for SYSINIT relocation.",13,10 0 00000C0A 206572726F723A204F 0 00000C13 7574206F66206D656D 0 00000C1C 6F727920666F722053 0 00000C25 5953494E4954207265 0 00000C2E 6C6F636174696F6E2E 0 00000C37 0D0A00 2374 2375 2376 global cmdline_noop, cmdline_checkdebugger, cmdline_scanmode 2377 cmdline_noop: 0 00000C3A C3 retn 2379 2380 2381 cmdline_error: 2382 assume es:SYSINITGROUP, ds:SYSINITGROUP 2383 extern invalid_number 0 00000C3B BE[0000] mov si, invalid_number 0 00000C3E BB0700 mov bx, 7 0 00000C41 A9 db __TEST_IMM16 ; skip int 2387 @@: 0 00000C42 CD10 int 10h 0 00000C44 AC lodsb 0 00000C45 B40E mov ah, 0Eh 0 00000C47 84C0 test al, al 0 00000C49 75F7 jnz @B 0 00000C4B 3E8B7600 mov si, word [ds:bp] ; -> command name 0 00000C4F A9 db __TEST_IMM16 ; skip int 2395 @@: 0 00000C50 CD10 int 10h 0 00000C52 AC lodsb 0 00000C53 B40E mov ah, 0Eh 0 00000C55 84C0 test al, al 0 00000C57 75F7 jnz @B 2401 @@: 0 00000C59 B8220E mov ax, 0E00h + '"' 0 00000C5C CD10 int 10h 0 00000C5E B80D0E mov ax, 0E00h + 13 0 00000C61 CD10 int 10h 0 00000C63 B80A0E mov ax, 0E00h + 10 0 00000C66 CD10 int 10h 0 00000C68 C3 retn 2409 2410 2411 ; INP: ds:si -> after number 2412 ; OUT: ZR if NUL reached 2413 ; NZ if not NUL, 2414 ; ds:si -> first non-blank, non-comma, non-NUL 2415 ; al = byte [ds:si] 2416 cmdline_next: 2417 assume es:SYSINITGROUP, ds:SYSINITGROUP 2418 .: 0 00000C69 AC lodsb 0 00000C6A 3C20 cmp al, 32 0 00000C6C 74FB je . 0 00000C6E 3C09 cmp al, 9 0 00000C70 74F7 je . 0 00000C72 3C2C cmp al, ',' 0 00000C74 74F3 je . 0 00000C76 4E dec si 0 00000C77 84C0 test al, al 0 00000C79 C3 retn 2429 2430 2431 ; INP: si -> past an optional equals sign and blanks 2432 ; di -> -> command name 2433 ; CHG: ax, si, di, cx, bx, dx, bp 2434 ; STT: ds = es => SYSINIT 2435 ; cs => DOSENTRY 2436 cmdline_checkdebugger: 2437 assume es:SYSINITGROUP, ds:SYSINITGROUP 0 00000C7A 89FD mov bp, di 2439 .loop: 0 00000C7C E85500 call parsenumber 0 00000C7F 72BA jc cmdline_error 0 00000C81 84F6 test dh, dh 0 00000C83 75B6 jnz cmdline_error 0 00000C85 80FB01 cmp bl, 1 0 00000C88 7209 jb .or 0 00000C8A 740E je .clr 2447 .replace: 0 00000C8C 2E8816[0000] mov byte [cs:checkdebugger], dl 0 00000C91 EB0E jmp .next 2450 2451 .or: 0 00000C93 2E0816[0000] or byte [cs:checkdebugger], dl 0 00000C98 EB07 jmp .next 2454 2455 .clr: 0 00000C9A F6D2 not dl 0 00000C9C 2E2016[0000] and byte [cs:checkdebugger], dl 2458 .next: 0 00000CA1 E8C5FF call cmdline_next 0 00000CA4 75D6 jnz .loop 0 00000CA6 C3 retn 2462 2463 2464 cmdline_scanmode: 2465 assume es:SYSINITGROUP, ds:SYSINITGROUP 0 00000CA7 89FD mov bp, di 2467 .loop: 2468 extern sysinit_cmdline_scanmode_keyword 0 00000CA9 9A[0000][0000] call far sysinit_cmdline_scanmode_keyword 2470 ; ! call far into unrelocated SYSINIT 0 00000CAE 730C jnc .replace 0 00000CB0 E82100 call parsenumber 0 00000CB3 7286 jc cmdline_error 0 00000CB5 80FB01 cmp bl, 1 0 00000CB8 7208 jb .or 0 00000CBA 740C je .clr 2477 .replace: 0 00000CBC 8916[0000] mov word [load_mode], dx 0 00000CC0 EB0C jmp .next 2480 2481 .or: 0 00000CC2 0916[0000] or word [load_mode], dx 0 00000CC6 EB06 jmp .next 2484 2485 .clr: 0 00000CC8 F7D2 not dx 0 00000CCA 2116[0000] and word [load_mode], dx 2488 .next: 0 00000CCE E898FF call cmdline_next 0 00000CD1 75D6 jnz .loop 0 00000CD3 C3 retn 2492 2493 2494 ; INP: si -> number input text 2495 ; OUT: NC if success, 2496 ; dx = number 2497 ; bl = 0 if +, 1 if -, 2 else 2498 parsenumber: 0 00000CD4 31DB xor bx, bx 0 00000CD6 AC lodsb 0 00000CD7 3C2B cmp al, '+' 0 00000CD9 7407 je @F 0 00000CDB 43 inc bx 0 00000CDC 3C2D cmp al, '-' 0 00000CDE 7402 je @F 0 00000CE0 43 inc bx 0 00000CE1 4E dec si 2508 @@: 2509 extern ldos_getnum_far 0 00000CE2 9A[0000][0000] call far ldos_getnum_far 0 00000CE7 C3 retn 2512 2513 === Switch to base=00C400h -> "SYSINITTRAIL" 2514 usesection SYSINITTRAIL 2515 2516 ; INP: si -> number input text 2517 ; OUT: CY if error 2518 ; NC if success, 2519 ; dx = number 2520 global ldos_getnum 2521 ldos_getnum: 0 000041D9 B90A00 mov cx, 10 2523 .before: 0 000041DC AC lodsb 0 000041DD 3C20 cmp al, 32 0 000041DF 74FB je .before 0 000041E1 3C09 cmp al, 9 0 000041E3 74F7 je .before 0 000041E5 3C3D cmp al, '=' 0 000041E7 74F3 je .before 0 000041E9 3C3A cmp al, ':' 0 000041EB 74EF je .before 0 000041ED 4E dec si 0 000041EE 89F7 mov di, si ; di -> first digit 2535 .preloop: 0 000041F0 AC lodsb 0 000041F1 3C5F cmp al, '_' 0 000041F3 74FB je .preloop 0 000041F5 E88D00 call capitalise 0 000041F8 3C30 cmp al, '0' 0 000041FA 750A jne .not0 0 000041FC 80F90A cmp cl, 10 ; base changed to hex? 0 000041FF 7522 jne .hexit ; then it's a hexit --> 0 00004201 80CD01 or ch, 1 0 00004204 EBEA jmp .preloop 2546 .not0: 0 00004206 3C48 cmp al, 'H' 0 00004208 7404 je .h 0 0000420A 3C58 cmp al, 'X' 0 0000420C 7510 jne .notx 2551 .h: 0 0000420E F6C502 test ch, 2 ; hexits before ? 0 00004211 7502 jnz .gotsome 0 00004213 89F7 mov di, si 2555 .gotsome: 0 00004215 80F90A cmp cl, 10 ; multiple h/x ? 0 00004218 7540 jne .bad ; reject --> 0 0000421A B110 mov cl, 16 0 0000421C EBD2 jmp .preloop 2560 .notx: 0 0000421E E84D00 call ishex 0 00004221 7205 jc .preend 2563 .hexit: 0 00004223 80CD02 or ch, 2 ; note hexit 0 00004226 EBC8 jmp .preloop 2566 2567 .preend: 0 00004228 84ED test ch, ch 0 0000422A 742E jz .bad 0 0000422C 4E dec si 0 0000422D F6C502 test ch, 2 0 00004230 7406 jz .onlyzero 0 00004232 39F7 cmp di, si 0 00004234 7424 je .bad 0 00004236 89FE mov si, di 2576 .onlyzero: 0 00004238 B500 mov ch, 0 0 0000423A 31FF xor di, di 2579 2580 .loop: 0 0000423C AC lodsb 0 0000423D 3C5F cmp al, '_' 0 0000423F 74FB je .loop 0 00004241 E82A00 call ishex 0 00004244 7216 jc .end 0 00004246 38C8 cmp al, cl 0 00004248 7310 jae .bad 0 0000424A 97 xchg di, ax 0 0000424B F7E1 mul cx 0 0000424D 97 xchg di, ax 0 0000424E 85D2 test dx, dx 0 00004250 7508 jnz .bad 0 00004252 B400 mov ah, 0 0 00004254 01C7 add di, ax 0 00004256 7202 jc .bad 0 00004258 EBE2 jmp .loop 2597 2598 .bad: 0 0000425A F9 stc 0 0000425B C3 retn 2601 2602 .end: 0 0000425C 4E dec si 2604 .endloop: 0 0000425D AC lodsb 0 0000425E E82400 call capitalise 0 00004261 3C58 cmp al, 'X' 0 00004263 74F8 je .endloop 0 00004265 3C48 cmp al, 'H' 0 00004267 74F4 je .endloop 0 00004269 4E dec si 0 0000426A 89FA mov dx, di 0 0000426C F8 clc 0 0000426D C3 retn 2615 2616 2617 ishex: 0 0000426E E81400 call capitalise 0 00004271 2C30 sub al, '0' 0 00004273 720F jc .ret 0 00004275 3C0A cmp al, 10 0 00004277 720A jb .ret_cmc 0 00004279 2C07 sub al, 'A' - ('9' + 1) 0 0000427B 7207 jc .ret 0 0000427D 3C0A cmp al, 10 0 0000427F 7203 jb .ret 0 00004281 3C10 cmp al, 16 2628 .ret_cmc: 0 00004283 F5 cmc 2630 .ret: 0 00004284 C3 retn 2632 2633 2634 capitalise: 0 00004285 3C61 cmp al, 'a' 0 00004287 7206 jb .gotcap 0 00004289 3C7A cmp al, 'z' 0 0000428B 7702 ja .gotcap 0 0000428D 3420 xor al, 'A' ^ 'a' 2640 .gotcap: 0 0000428F C3 retn 2642 2643 === Switch to base=000000h -> "DOSENTRY" 2644 usesection DOSENTRY 2645 2646 dosentry_init_getdosdata: 2647 assume ds:nothing, es:nothing, ss:nothing 0 00000CE8 1E push ds 0 00000CE9 B80000 mov ax, 0 0 00000CEC 8ED8 mov ds, ax 2651 assume ds:IVT 0 00000CEE A1C600 mov ax, [31h * 4 + 2] 0 00000CF1 1F pop ds 2654 assume ds:nothing 0 00000CF2 C3 retn 2656 2657 dosentry_init_get_ds_dosdata: 2658 dosentry_init_get_ds_dosbiodata: 2659 assume ds:nothing, es:nothing, ss:nothing 0 00000CF3 50 push ax 0 00000CF4 E8F1FF call dosentry_init_getdosdata 0 00000CF7 8ED8 mov ds, ax 2663 assume ds:DOSGROUP 0 00000CF9 58 pop ax 0 00000CFA C3 retn 2666 2667 dosentry_init_get_es_dosbiodata: 2668 assume ds:nothing, es:nothing, ss:nothing 0 00000CFB 50 push ax 0 00000CFC E8E9FF call dosentry_init_getdosdata 0 00000CFF 8EC0 mov es, ax 2672 assume es:DOSGROUP 0 00000D01 58 pop ax 0 00000D02 C3 retn 2675 2676 2677 ;**************************** 2678 2679 Get_Para_Offset proc near 2680 assume ds:nothing, es:nothing, ss:nothing 2681 ;in: AX - offset value 2682 ;out: AX - offset value adjusted for the next paragraph boundary. 0 00000D03 83C00F add ax, 15 ;make a paragraph 0 00000D06 D1D8 rcr ax, 1 0 00000D08 D1E8 shr ax, 1 0 00000D0A D1E8 shr ax, 1 0 00000D0C D1E8 shr ax, 1 0 00000D0E D1E0 shl ax, 1 ;now, make it back to offset value 0 00000D10 D1E0 shl ax, 1 0 00000D12 D1E0 shl ax, 1 0 00000D14 D1E0 shl ax, 1 0 00000D16 C3 ret 2693 Get_Para_Offset endp 2694 2695 ;AN004; Don't need this procedure. Get_FAT_Sector replace this. 2696 ; READ A FAT SECTOR INTO FAT LOCATION 2697 ;GETFAT PROC NEAR 2698 ; XOR DI,DI ; OFFSET 2699 ; MOV DX,1 ; RELATIVE SECTOR (1ST SECTOR OF FAT) 2700 ; MOV CX,FATLEN ; READ ENTIRE FAT. 2701 ; MOV AX,FATLOC ; 2702 ; MOV ES,AX ; LOCATION TO READ 2703 ; MOV AX,DRVFAT ; AH FAT ID BYTE, AL DRIVE 2704 ; JMP DISKRD 2705 ;GETFAT ENDP 2706 2707 === Switch to base=00C400h -> "SYSINITTRAIL" 2708 usesection SYSINITTRAIL 2709 2710 extern allocate_temporary_block, alloc_init 2711 extern sysinit_getdosdata 2712 2713 global sysinit_get_ds_dosbiodata 2714 global sysinit_get_ds_dosentry 2715 sysinit_get_ds_dosbiodata: 2716 assume ds:nothing, es:nothing, ss:nothing 0 00004290 50 push ax 0 00004291 E8[0000] call sysinit_getdosdata 0 00004294 8ED8 mov ds, ax 2720 assume ds:DOSGROUP 0 00004296 58 pop ax 0 00004297 C3 retn 2723 2724 sysinit_get_ds_dosentry: 2725 assume ds:nothing, es:nothing, ss:nothing 0 00004298 2E8E1E[B609] mov ds, word [cs:.segment] 2727 assume ds:DOSENTRYGROUP 0 0000429D C3 retn 2729 2730 align 2, db 0 0 0000429E [0000] .segment: dw DOSENTRY 2732 2733 global sysinit_get_es_dosbiodata 2734 global sysinit_get_es_dosentry 2735 sysinit_get_es_dosbiodata: 2736 assume ds:nothing, es:nothing, ss:nothing 0 000042A0 50 push ax 0 000042A1 E8[0000] call sysinit_getdosdata 0 000042A4 8EC0 mov es, ax 2740 assume es:DOSGROUP 0 000042A6 58 pop ax 0 000042A7 C3 retn 2743 2744 sysinit_get_es_dosentry: 2745 assume ds:nothing, es:nothing, ss:nothing 0 000042A8 2E8E06[B609] mov es, word [cs:sysinit_get_ds_dosentry.segment] 2747 assume es:DOSENTRYGROUP 0 000042AD C3 retn 2749 2750 extern dosdata_to_doscode 2751 2752 get_ds_biocode: 2753 assume ds:nothing, es:nothing, ss:nothing 0 000042AE 2E8E1E[D409] mov ds, word [cs:.value] 2755 assume ds:IVT 0 000042B3 8E1EC600 mov ds, word [31h * 4 + 2] 2757 assume ds:DOSGROUP 0 000042B7 8E1E[0000] mov ds, word [dosdata_to_doscode] 2759 assume ds:DOSCODEGROUP 0 000042BB C3 retn 2761 2762 align 2, nop 0 000042BC 0000 .value: dw 0 2764 2765 extern biocode_retf 2766 2767 %imacro neartransfer 1.nolist 2768 extern %1 2769 call transfer_sysinitseg_to_biocode 2770 jmp strict short %%skip 2771 dw %1 2772 %%skip: 2773 %endmacro 2774 2775 transfer_sysinitseg_to_biocode: ; near call ip: in_ip_out_cs 2776 assume ds:nothing, es:nothing, ss:nothing 0 000042BE 50 push ax ; in_ax_out_ip 0 000042BF B8[0000] mov ax, biocode_retf 0 000042C2 50 push ax ; out_retf 0 000042C3 50 push ax ; out_destination + 2 0 000042C4 50 push ax ; out_destination + 0 2782 lframe 0 2783 lpar word, in_ip_out_cs 2784 lpar word, in_ax_out_ip 2785 lpar word, out_retf 2786 lpar dword, out_destination 0 000042C5 5589E5 lenter 0 000042C8 1E push ds 0 000042C9 56 push si 0 000042CA 8CCE mov si, cs ; si = cs 0 000042CC 87760A xchg si, word [bp + ?in_ip_out_cs] 2792 ; set cs, get ip 0 000042CF 56 push si ; preserve ip for later 0 000042D0 AD lodsw ; skip jmp short 0 000042D1 2EAD cs lodsw ; get destination 0 000042D3 894602 mov word [bp + ?out_destination + 0], ax 2797 ; set destination 0 000042D6 E8D5FF call get_ds_biocode ; ds => BIOCODE 2799 assume ds:DOSCODEGROUP 0 000042D9 8C5E04 mov word [bp + ?out_destination + 2], ds 2801 ; => BIOCODE 0 000042DC 58 pop ax 0 000042DD 874608 xchg ax, word [bp + ?in_ax_out_ip] 2804 ; ax = original ax, set out ip 0 000042E0 5E pop si 0 000042E1 1F pop ds 2807 assume ds:nothing 0 000042E2 5D lleave 0 000042E3 CB retf 2810 2811 2812 2813 ; INP: es:si -> partition table entry, 2814 ; si = load_partition_table .. load_partition_table+48, 2815 ; es = cs 2816 ; bp + di -> above part table metadata, 2817 ; dwo [bp + di - 4] = root (outermost extended position) 2818 ; dwo [bp + di - 8] = base (current table position) 2819 ; CHG: ax, bx, (cx), dx 2820 handle_each_partition: 2821 assume es:SYSINITGROUP, ds:SYSINITGROUP 0 000042E4 268A4404 mov al, byte [es:si + piType] 0 000042E8 E845FA call load_is_known 0 000042EB 7202 jc .discard 0 000042ED 7401 jz @F 2826 2827 .discard: 0 000042EF C3 retn 2829 2830 @@: 0 000042F0 51 push cx 0 000042F1 57 push di 0 000042F2 55 push bp 0 000042F3 56 push si 0 000042F4 06 push es 2836 0 000042F5 800E[0000]20 setopt [load_scan_flags], 32 ; a logical or primary partition found 2838 ; Hmm. If we reject the partition later, then we 2839 ; still have set this flag here. But, that matches 2840 ; what lMS-DOS did before (invalid partition stops 2841 ; the scan in current MBR/EPBR). So it stays so. 2842 0 000042FA 8B43F8 mov ax, [bp + di - 8] 0 000042FD 8B53FA mov dx, [bp + di - 6] ; base (current table position) 0 00004300 26034408 add ax, [es:si + 8] 0 00004304 2613540A adc dx, [es:si + 8 + 2] ; add offset to logical partition 0 00004308 8A0E[0400] mov cl, [BDS_harddisk_template + DRIVENUM] 2848 0 0000430C E881FF call sysinit_get_ds_dosbiodata 2850 assume ds:DOSGROUP 0 0000430F C53E[0000] lds di, [Start_BDS] 2852 assume ds:nothing 2853 @@: 0 00004313 83FFFF cmp di, -1 0 00004316 743A je .notduplicate 0 00004318 384D04 cmp byte [di + DRIVENUM], cl 0 0000431B 750A jne @F 0 0000431D 394517 cmp word [di + HIDSEC_L], ax 0 00004320 7505 jne @F 0 00004322 395519 cmp word [di + HIDSEC_H], dx 0 00004325 7404 je .duplicate 2862 @@: 0 00004327 C53D lds di, [di + LINK] 2864 assume ds:nothing 0 00004329 EBE8 jmp @BB 2866 2867 .duplicate: 0 0000432B 0E push cs 0 0000432C 1F pop ds 2870 assume ds:SYSINITGROUP 0 0000432D 0E push cs 0 0000432E 07 pop es 2873 assume es:SYSINITGROUP 2874 0 0000432F BF[4F0F] mov di, msg.duplicate_hidden_l 2876 extern hexword 0 00004332 E8[0000] call hexword 0 00004335 92 xchg ax, dx 0 00004336 BF[4A0F] mov di, msg.duplicate_hidden_h 0 00004339 E8[0000] call hexword 0 0000433C 91 xchg ax, cx 0 0000433D BF[3E0F] mov di, msg.duplicate_unit 0 00004340 E8[0000] call hexbyte 2884 0 00004343 BA[D40E] mov dx, msg.bootfail 0 00004346 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00004349 BA[160F] mov dx, msg.duplicate 0 0000434C E8[0000] call init2_disp_msg_asciz_cs_dx 0 0000434F E96D02 jmp partition_reject 2890 2891 2892 .notduplicate: 0 00004352 0E push cs 0 00004353 1F pop ds 2895 assume ds:SYSINITGROUP 0 00004354 BF[0000] mov di, BDS_harddisk_template 2897 ; Hidden sectors (based on EPBR) 0 00004357 894517 mov [di + HIDSEC_L], ax ; BPB->HIDSECCT = P->PARTITIONBEGIN; 0 0000435A 895519 mov [di + HIDSEC_H], dx 0 0000435D A0[0000] mov al, [next_block_device_unit] 0 00004360 884505 mov [di + DRIVELET], al 2902 2903 2904 ; SETHARD - GENERATE BPB FOR A VARIABLE SIZED HARD FILE. IBM HAS A 2905 ; PARTITIONED HARD FILE; WE MUST READ PHYSICAL SECTOR 0 TO DETERMINE WHERE 2906 ; OUR OWN LOGICAL SECTORS START. WE ALSO READ IN OUR BOOT SECTOR TO 2907 ; DETERMINE VERSION NUMBER 2908 2909 ; INPUTS: DL IS ROM DRIVE NUMBER (80 OR 81) 2910 ; DS:DI POINTS TO BDS 2911 ; OUTPUTS: CARRY CLEAR -> BPB IS FILLED IN 2912 ; CARRY SET -> BPB IS LEFT UNINITIALIZED DUE TO ERROR 2913 2914 assume ds:SYSINITGROUP, es:nothing, ss:nothing 2915 ; Note: Partitiontype 6 means either 2916 ;1).the partition has not been formatted yet, or 2917 ;2).(# of sectors before the partition + 2918 ; # of sectors in this partition) > word boundary 2919 ; i.e., needs 32 bit sector calculation, or 2920 ;3).the partition is not a FAT file system. 2921 2922 ;J.K. Until we get the real logical boot record and get the bpb, 2923 ;DRVLIM_H,DRVLIM_L will be used instead of DRVLIM for the convenience of 2924 ;the computation. 2925 ;At the end of this procedure, if a BPB information is gotten from 2926 ;the valid boot record, then we are going to use those BPB information 2927 ;without change. 2928 ;Otherwise, if (hidden sectors + total sectors) <= a word, then 2929 ;we will move DRVLIM_L to DRVLIM and zero out DRVLIM_L entry to make 2930 ;it a conventional BPB format. 2931 0 00004363 268B440C mov ax, word [es:si + piLength] ; # of sectors (Low) 0 00004367 268B540E mov dx, word [es:si + piLength + 2] ;AN000; # of sectors (High) 0 0000436B 89551D mov word ptr [di + DRVLIM_H], dx 0 0000436E 89451B mov word ptr [di + DRVLIM_L], ax ; BPB->MAXSEC = P->PARTITIONLENGTH; 0 00004371 85D2 test dx, dx 0 00004373 7508 jnz OKDrive_Cont 0 00004375 83F840 cmp ax, 64 ; IF (P->PARTITIONLENGTH < 64) 0 00004378 7303E94202 jb partition_reject ; RETURN -1; 2940 2941 OKDrive_Cont: ;AN000; 2942 0 0000437D 034517 add ax, [di + HIDSEC_L] 0 00004380 135519 adc dx, [di + HIDSEC_H] ; dx:ax = sector after partition 2945 Okdrive equ OKDRIVE ; NASM port label 0 00004383 730B jnc Okdrive 0 00004385 89C1 mov cx, ax 0 00004387 09D1 or cx, dx 0 00004389 7405 jz Okdrive 2950 MESSAGE FTESTHARD,<"PARTITION INVALID",CR,LF> 0 0000438B 800E[0700]80 or byte [FBIGFAT], FTOOBIG 2952 OKDRIVE: 2953 0 00004390 F6452404 testopt [di + FLAGS], F_LBA 0 00004394 7512 jnz okdrive_lba 2956 0 00004396 83E801 sub ax, 1 0 00004399 83DA00 sbb dx, 0 ; dx:ax = last sector of partition 0 0000439C E81FFFEB02[0000] neartransfer lbatochs ; convert to CHS 0 000043A3 7303E91702 jc partition_reject ; if CHS overflow --> 2961 2962 okdrive_lba: 2963 0 000043A8 8B5519 mov dx,[di + HIDSEC_H] 0 000043AB 8B4517 mov ax,[di + HIDSEC_L] ; BOOT SECTOR NUMBER 2966 2967 2968 ;J.K. For convenience, we are going to read the logical boot sector 2969 ;into cs:DiskSector area. 2970 2971 ;SB34INIT009************************************************************* 2972 ;SB Read in boot sector using BIOS disk interrupt. The buffer where it 2973 ;SB is to be read in is cs:Disksector. 0 000043AE E8F7FE call sysinit_get_es_dosentry ; DISKSECTOR in DOSENTRY 2975 assume es:DOSENTRYGROUP 0 000043B1 BB[0000] mov bx,offset DiskSector ; access with es 0 000043B4 B90102 mov cx,0201h ; read, one sector 0 000043B7 E81C02 call readsector_flag 0 000043BA 7303E90002 jc partition_reject ;AN000; Exceeds the limit of Int 13h 2980 ;SB34INIT009************************************************************* 2981 0 000043BF E86A03 call have_bpb 0 000043C2 7309 jnc @F 2984 assume ds:SYSINITGROUP 2985 extern BADBLOCK 0 000043C4 BA[0000] MOV DX,OFFSET BADBLOCK 2987 extern PRINT 0 000043C7 E8[0000] call PRINT 0 000043CA E9F201 jmp partition_reject 2990 @@: 2991 0 000043CD 06 push es 2993 ; At this point we're sure to set up the drive. 2994 ; So, copy over the template to the next UPB. 0 000043CE FE06[0000] inc byte [next_block_device_unit] 2996 ; remember which DOS drive is next 0 000043D2 89FE mov si, di 0 000043D4 E887F6 call alloc_upb ; (will halt system on error) 2999 assume es:UPB 0 000043D7 B96400 mov cx, BDS_TYPE_struc_size 0 000043DA 57 push di 0 000043DB F3A4 rep movsb 0 000043DD 5F pop di ; di -> next UPB 0 000043DE 06 push es 0 000043DF 1F pop ds ; ds:di -> UPB 3006 assume ds:UPB 0 000043E0 E85203 call Install_BDSM_and_set_bpb ; INSTALL BDS INTO LINKED LIST 0 000043E3 07 pop es 3009 assume es:DOSENTRYGROUP 3010 3011 3012 ; cs:Disksec contains THE BOOT SECTOR. IN THEORY, (HA HA) THE BPB IN THIS THING 3013 ; IS CORRECT. WE CAN, THEREFORE, SUCK OUT ALL THE RELEVANT STATISTICS ON THE 3014 ; MEDIA IF WE RECOGNIZE THE VERSION NUMBER. 3015 3016 ; look for a signature for msdos... 0 000043E4 26817F034D53 cmp word ptr [es:bx+3], "M" + ("S" << 8) 0 000043EA 750F jne notmssig 0 000043EC 26817F05444F cmp word ptr [es:bx+5], "D" + ("O" << 8) 0 000043F2 7507 jne notmssig 0 000043F4 26807F0753 cmp byte ptr [es:bx+7], "S" 0 000043F9 7420 je sigfound 3023 ; ...or perhaps pcdos... 3024 notmssig: 0 000043FB 26817F034942 CMP WORD PTR [es:bx+3], "I" + ("B" << 8) 0 00004401 7508 jne notibmsig 0 00004403 26817F054D20 CMP WORD PTR [es:bx+5], "M" + (" " << 8) 0 00004409 7410 je sigfound 3029 3030 notibmsig: 0 0000440B 26817F034F53 CMP WORD PTR [es:bx+3], "O" + ("S" << 8) 0 00004411 751D jne acceptbpb 0 00004413 26817F053220 CMP WORD PTR [es:bx+5], "2" + (" " << 8) 0 00004419 7515 jne acceptbpb ; ecm: not MSDOS nor IBM nor OS/2, accept BPB --> 3035 3036 sigfound: ; signature was found, now check version 3037 3038 check3point0: 3039 Cover_Fdisk_Bug equ Cover_FDISK_Bug ; NASM port label 0 0000441B E81302 call Cover_Fdisk_Bug ;AN010; 3041 ; ecm: only reject "MSDOS3.0" or "IBM 3.0" 0 0000441E 26817F08332E CMP WORD PTR [es:bx+8],"3" + ("." << 8) 0 00004424 750A jne acceptbpb 0 00004426 26807F0A30 cmp byte ptr [es:bx+10],"0" ;do not trust 3.0 boot record. But still legal J.K. 4/15/86 0 0000442B 7503 jne acceptbpb ;AN012; if version >= 3.1, then O.K. 0 0000442D E9BB00 jmp unknown3point0 3047 acceptbpb: 3048 COPYBPB: 3049 ; WE HAVE A VALID BOOT SECTOR. USE THE BPB IN IT TO BUILD THE 3050 ; BPB IN BIOS. IT IS ASSUMED THAT ONLY SECPERCLUS, CDIR, AND 3051 ; CSECFAT NEED TO BE SET (ALL OTHER VALUES IN ALREADY). FBIGFAT 3052 ; IS ALSO SET. 3053 3054 ;If it is non FAT based system, then just copy the BPB from the BOOT sector 3055 ;into the BPB in BDS table, and also set the Boot serial number, Volume id, 3056 ;and System ID according to the Boot record. 3057 ;For the non_FAT system, don't need to set the other value. So just 3058 ;do GOODRET.- J.K. 3059 0 00004430 26803E[0000]29 cmp byte [es:Ext_Boot_Sig], EXT_BOOT_SIGNATURE ;AN000; 0 00004436 7528 jne COPYBPB_FAT ;AN000; Conventional Fat system 0 00004438 26803E[0000]00 cmp byte [es:NumberOfFats], 0 ;AN000; If (# of FAT <> 0) then 0 0000443E 7520 jne COPYBPB_FAT ;AN000; a Fat system. 3064 ;J.K. Non Fat based media. 0 00004440 57 push di ;AN000; Sav Reg. 0 00004441 1E push ds ;AN000; 0 00004442 06 push es 3068 0 00004443 1E push ds ;AN000; 0 00004444 07 pop es ;AN000; now es:di -> bds 3071 assume es:UPB 0 00004445 E850FE call sysinit_get_ds_dosentry ; DISKSECTOR in DOSENTRY 3073 assume ds:DOSENTRYGROUP 0 00004448 BE[0000] mov si, offset Bpb_In_Sector ;AN000; ds:si -> BPB in Boot ; access with ds 0 0000444B 83C706 add di, BYTEPERSEC ;AN000; es:di -> BPB in BDS 0 0000444E B91900 mov cx, BPB_TYPE_struc_size ;AN000; 0 00004451 F3A4 rep movsb ;AN000; 3078 0 00004453 07 pop es 3080 assume es:DOSENTRYGROUP 0 00004454 1F pop ds ;AN000; Restore Reg. 3082 assume ds:UPB 0 00004455 5F pop di ;AN000; 0 00004456 E865FEEB02[0000] neartransfer Mov_Media_IDs ;AN000; Set Volume id, SystemId, Serial. 3085 init_GoodRet equ init_GOODRET ; NASM port label 0 0000445D E94201 jmp init_GoodRet 3087 3088 COPYBPB_FAT: ;AN000; Fat system 0 00004460 31D2 xor dx,dx ;AN000; 0 00004462 BE[0000] mov si, offset Bpb_In_Sector ;AN000; es:bx -> bpb in boot ; access with es 0 00004465 268B4408 mov ax, [es:si + SECNUM] ;AN000; total sectors 0 00004469 85C0 test ax, ax ;AN000; double word sector number? 0 0000446B 7508 jnz Fat_Big_Small ;AN000; No. Conventional BPB. 0 0000446D 268B4415 mov ax, word ptr [es:si + SECNUM_L] ;AN000; Use double word 0 00004471 268B5417 mov dx, word ptr [es:si + SECNUM_H] ;AN000; 3096 3097 Fat_Big_Small: ;AN000; Determine Fat entry size. 3098 ;At this moment DX;AX = Total sector number 0 00004475 268B5C03 mov bx, [es:si + RESNUM] 0 00004479 895D09 mov [di + RESSEC], bx 0 0000447C 29D8 sub ax,bx ;AN000; Subtract # reserved 0 0000447E 83DA00 sbb dx,0 ;AN000; 0 00004481 268B5C0B mov bx, [es:si + FATSIZE] ;AN000; BX = Sectors/Fat 0 00004485 895D11 mov [di + CSECFAT],bx ;AN000; Set in BDS BPB 0 00004488 31C9 xor cx, cx 0 0000448A 268A4C05 mov cl, [es:si + FATNUM] 0 0000448E 884D0B mov [di + CFAT], cl 0 00004491 E307 jcxz .none 3109 .loop: 0 00004493 29D8 sub ax,bx ;AN000; Subtract # fat sectors 0 00004495 83DA00 sbb dx,0 ;AN000; 0 00004498 E2F9 loop .loop 3113 .none: 0 0000449A 268B5C06 mov bx, [es:si + DIRNUM] ;AN000; # root entries 3115 cDIR equ CDIR ; NASM port equate 0 0000449E 895D0C mov [di + cDIR],bx ;AN000; Set in BDS BPB 3117 0 000044A1 B104 MOV CL,4 0 000044A3 D3EB shr bx,cl ;AN000; Div by 16 ents/sector 0 000044A5 29D8 sub ax,bx ;AN000; sub # dir sectors 0 000044A7 83DA00 sbb dx,0 ;AN000; 3122 ;AN000; DX;AX now contains the # of data sectors 0 000044AA 268A4C02 MOV CL, [es:si + SECALL] ; SECTORS PER CLUSTER 0 000044AE 49 dec cx 0 000044AF B500 mov ch, 0 0 000044B1 41 inc cx ; translate EDR-DOS 0 to 256 0 000044B2 884D08 MOV [DI + SECPERCLUS],CL ; SET IN BIOS BPB (truncated) 3128 ; XOR DX,DX 3129 ; MOV CH,DH 3130 MNUM FTESTHARD,CX 3131 MESSAGE FTESTHARD,<" SECPERCLUS",CR,LF> 3132 ;J.K. 3/16/87 P54 Returning back to old logic for compatibility reason. 3133 ;So, use the old logic again that once had been commented out!!!!!!!!!!!! 3134 ;Old logic to determine FAT Entry Size J.K. 12/3/86 0 000044B5 E8E8FD call sysinit_get_es_dosbiodata 3136 assume es:DOSGROUP 0 000044B8 50 push ax ;AN000; 0 000044B9 92 xchg ax, dx ; ax = high word, clobber dx 0 000044BA 31D2 xor dx,dx ;AN000; 0 000044BC F7F1 div cx ;AN000; cx = sectors per cluster 0 000044BE 26A3[0000] mov [es:Temp_H],ax ;AN000; 0 000044C2 58 pop ax ;AN000; 0 000044C3 F7F1 DIV CX ;AN000; [Temp_H];AX NOW CONTAINS THE # CLUSTERS. 0 000044C5 26833E[0000]00 cmp word [es:Temp_H],0 ;AN000; 0 000044CB 7715 ja TooBig_Ret ;AN000; Too big cluster number 0 000044CD 3DF60F CMP AX,4096-10 ; IS THIS 16-BIT FAT? 0 000044D0 7206 JB CopyMediaID ; NO, small FAT 0 000044D2 2E800E[0700]40 OR byte [cs:FBIGFAT],FBIG ; 16 BIT FAT 3149 ;End of Old logic 3150 CopyMediaID: 0 000044D8 E8E3FDEB02[0000] neartransfer Mov_Media_IDs ;AN000; Copy Filesys_ID, Volume label, 3152 ;and Volume serial to BDS table, if extended 3153 ;boot record. 0 000044DF E99F00 JMP Massage_bpb ;AN000; Now final check for BPB info. and return. 3155 3156 TooBig_Ret: ;AN000; 0 000044E2 2E800E[0700]80 OR byte [cs:FBIGFAT],FTOOBIG 0 000044E8 E9B700 JMP init_GOODRET ;AN000; Still drive letter is assigned 3159 ;AN000; But useless. To big for 3160 ;AN000; current PC DOS FAT file system 3161 ; UNKNOWN: 3162 ; or [di].FLAGS, UNFORMATTED_MEDIA ;AN005; Set unformatted media flag. 3163 ; preceeding line commented out 10/88 by MRW-- The boot signature 3164 ; may not be recognizable, but we should TRY and read it anyway. 3165 ;AN006; 3166 ;AN008; For the time being, allow it. 3167 ;AN009; Now implemented again 3168 ; Unknown3_0: ;AN012;Skip setting UNFORMATTED_MEDIA bit 3169 unknown3point0: 3170 assume es:DOSENTRYGROUP 3171 MESSAGE FTESTHARD,<"UNKNOWN HARD MEDIA. ASSUMING 3.0.",CR,LF> 0 000044EB 8B551D mov dx, [di + DRVLIM_H] ;AN000; 0 000044EE 8B451B mov ax, [di + DRVLIM_L] ;AN000; 3174 DISKTABLE2 equ DiskTable2 ; NASM port label 0 000044F1 BE[9800] MOV SI,OFFSET DISKTABLE2 ; access with cs 3176 .SCAN: 3177 ; CMP AX,[SI] 3178 ; JBE GOTPARM 3179 ; ADD SI,4 * 2 3180 0 000044F4 2E3B14 cmp dx, word ptr [cs:si] ;AN000; 3182 GotParm equ GOTPARM ; NASM port label 0 000044F7 720D jb GotParm ;AN000; 0 000044F9 7706 ja .Scan_Next ;AN000; 0 000044FB 2E3B4402 cmp ax, word ptr [cs:si+2] ;AN000; 0 000044FF 7605 jbe GotParm ;AN000; 3187 .Scan_Next: ;AN000; 0 00004501 83C60A add si, 5 * 2 ;AN000; 0 00004504 EBEE JMP .SCAN ;AN000; Covers upto 512 MB media 3190 GOTPARM: 3191 ; MOV CL,BYTE PTR [SI+6] 0 00004506 2E8A4C08 mov cl,byte ptr [cs:si+8] ;AN000; Fat size for FBIGFAT flag 0 0000450A 2E080E[0700] OR [cs:FBIGFAT],CL 3194 ; MOV CX,[SI+2] 3195 ; MOV DX,[SI+4] 0 0000450F 2E8B4C04 mov cx, word ptr [cs:SI+4] ;AN000; 0 00004513 2E8B5406 mov dx, word ptr [cs:SI+6] ;AN000; 3198 3199 ; DX = NUMBER OF DIR ENTRIES, 3200 ; CH = NUMBER OF SECTORS PER CLUSTER 3201 ; CL = LOG BASE 2 OF CH 3202 3203 ; NOW CALCULATE SIZE OF FAT TABLE 3204 3205 MNUM FTESTHARD,AX 3206 MESSAGE FTESTHARD,<" SECTORS "> 3207 MNUM FTESTHARD,DX 3208 MESSAGE FTESTHARD,<" DIRECTORY ENTRIES "> 3209 MNUM FTESTHARD,CX 3210 MESSAGE FTESTHARD,<" SECPERCLUS|CLUSSHIFT"> 3211 0 00004517 89550C MOV WORD PTR [CDIR + DI],DX ;SAVE NUMBER OF DIR ENTRIES 3213 3214 ;Now, CX = SecPerClus|Clusshift 3215 ; [DI.CDIR] = number of directory entries. 3216 0 0000451A 8B551D mov dx, [di + DRVLIM_H] ;AN000; 0 0000451D 8B451B mov ax, [di + DRVLIM_L] ;AN000; 0 00004520 886D08 MOV BYTE PTR [SECPERCLUS + DI],CH ;SAVE SECTORS PER CLUSTER 0 00004523 2EF606[0700]40 TEST byte [cs:FBIGFAT],FBIG ; IF (FBIGFAT) 0 00004529 751E JNZ DOBIG ; GOTO DOBIG; 3222 MESSAGE FTESTHARD,<" SMALL FAT",CR,LF> 3223 ;J.K. We don't need to change "small fat" logic since it is gauranteed 3224 ;that double word total sector will not use 12 bit fat (unless 3225 ;it's sectors/cluster >= 16 which will never be in this case.) 3226 ;So in this case we assume DX = 0 !!!. 3227 0 0000452B 31DB XOR BX,BX 0 0000452D 88EB MOV BL,CH 0 0000452F 4B DEC BX 0 00004530 01C3 ADD BX,AX ;AN000; DX=0 0 00004532 D3EB SHR BX,CL ; BX = 1+(BPB->MAXSEC+SECPERCLUS-1)/ 0 00004534 43 INC BX ; SECPERCLUS 0 00004535 80E3FE AND BL,11111110B ; BX &= ~1; (=NUMBER OF CLUSTERS) 0 00004538 89DE MOV SI,BX 0 0000453A D1EB SHR BX,1 0 0000453C 01F3 ADD BX,SI 0 0000453E 81C3FF01 ADD BX,511 ; BX += 511 + BX/2 0 00004542 D0EF SHR BH,1 ; BH >>= 1; (=BX/512) 0 00004544 887D11 MOV BYTE PTR [DI + CSECFAT],BH ;SAVE NUMBER OF FAT SECTORS 3241 Massage_BPB equ Massage_bpb ; NASM port label 0 00004547 EB38 JMP SHORT Massage_BPB 3243 DOBIG: 3244 ;J.K. For BIGFAT we do need to extend this logic to 32 bit sector calculation. 3245 MESSAGE FTESTHARD,<" BIG FAT",CR,LF> 0 00004549 B104 MOV CL,4 ; 16 (2^4) DIRECTORY ENTRIES PER SECTOR 0 0000454B 52 push dx ;AN000; Save total sectors (high) 0 0000454C 8B550C mov dx,[CDIR + DI] ;AN000; 0 0000454F D3EA SHR DX,CL ; CSECDIR = CDIR / 16; 0 00004551 29D0 SUB AX,DX ; DX;AX -= CSECDIR; DX;AX -= CSECRESERVED; 0 00004553 5A pop dx ;AN000; 0 00004554 83DA00 SBB dx,0 ;AN000; 3253 ; DEC AX ; AX = T - R - D 0 00004557 83E801 SUB ax,1 ;AN000; DX;AX = T - R - D 0 0000455A 83DA00 SBB dx,0 ;AN000; 0 0000455D B302 MOV BL,2 0 0000455F 8A7D08 MOV BH,[SECPERCLUS + DI] ; BX = 256 * SECPERCLUS + 2 3258 ; XOR DX,DX 3259 ;J.K. I don't understand why to add BX here!!! 0 00004562 01D8 ADD AX,BX ; AX = T-R-D+256*SPC+2 0 00004564 83D200 ADC DX,0 0 00004567 83E801 SUB AX,1 ; AX = T-R-D+256*SPC+1 0 0000456A 83DA00 SBB DX,0 3264 ;J.K. Assuming DX in the table will never be bigger than BX. 0 0000456D F7F3 DIV BX ; CSECFAT = CEIL((TOTAL-DIR-RES)/ 3266 ; (256*SECPERCLUS+2)); 0 0000456F 894511 MOV WORD PTR [DI + CSECFAT],AX ; NUMBER OF FAT SECTORS 3268 ;J.K. Now, set the default FileSys_ID, Volume label, Serial number 0 00004572 2E8A1E[0700] MOV BL,[cs:FBIGFAT] 0 00004577 885D1F MOV [DI + FATSIZ],BL ; SET SIZE OF FAT ON MEDIA 0 0000457A E841FDEB02[0000] neartransfer Clear_IDs ;AN000; 3272 3273 ;J.K. At this point, in BPB of BDS table, DRVLIM_H,DRVLIM_L which were 3274 ;set according to the partition information. We are going to 3275 ;see if (hidden sectors + total sectors) > a word. If it is true, 3276 ;then no change. Otherwise, DRVLIM_L will be moved to DRVLIM 3277 ;and DRVLIM_L will be set to 0. 3278 ;We don't do this for the bpb information from the boot record. We 3279 ;are not going to change the BPB information from the boot record. 3280 Massage_bpb: ;AN000; 3281 assume es:nothing 0 00004581 8B551D mov dx, [di + DRVLIM_H] ;AN000; 0 00004584 8B451B mov ax, [di + DRVLIM_L] ;AN000; 0 00004587 83FA00 cmp dx,0 ;AN000; Double word total sector? 0 0000458A 7716 ja init_GOODRET ;AN000; don't have to change it. 0 0000458C 837D1900 cmp word [di + HIDSEC_H], 0 ;AN000; 0 00004590 7710 ja init_GOODRET ;AN000; don't have to change it. 0 00004592 034517 add ax, [di + HIDSEC_L] ;AN000; 0 00004595 720B jc init_GOODRET ;AN000; bigger than a word boundary 0 00004597 8B451B mov ax, [di + DRVLIM_L] ;AN000; 0 0000459A 89450E mov [di + DRVLIM], ax ;AN000; 0 0000459D C7451B0000 mov word [di + DRVLIM_L], 0 ;AN000; 3293 init_GOODRET: 0 000045A2 837D1D00 cmp word [di + DRVLIM_H], 0 ;AN014; Big media? 0 000045A6 760F jbe Not_BigMedia ;AN014; No. 0 000045A8 06 push es ;AN014; 0 000045A9 50 push ax ;AN014; 0 000045AA B8[0000] mov ax, SYSINITSEG ;AN014; 0 000045AD 8EC0 mov es, ax ;AN014; 3300 assume es:SYSINITGROUP 0 000045AF 26C606[0000]01 mov byte [es:Big_Media_Flag], 1 ;AN014; Set the flag in SYSINITSEG. 0 000045B5 58 pop ax ;AN014; 0 000045B6 07 pop es ;AN014; 3304 assume es:nothing 3305 Not_BigMedia: ;AN014; 0 000045B7 2E8A1E[0700] MOV BL,[cs:FBIGFAT] 0 000045BC 885D1F MOV [DI + FATSIZ],BL ; SET SIZE OF FAT ON MEDIA 3308 3309 partition_reject: 0 000045BF 0E push cs 0 000045C0 1F pop ds 3312 assume ds:SYSINITGROUP 0 000045C1 E831F7 call upb_reset 0 000045C4 07 pop es 3315 assume es:SYSINITGROUP 0 000045C5 5E pop si 0 000045C6 5D pop bp 0 000045C7 5F pop di 0 000045C8 59 pop cx 0 000045C9 C3 retn 3321 3322 3323 ; INP: es:bx -> transfer address 3324 ; cl = count 3325 ; ch = 02h (function code for read CHS) 3326 ; dx:ax = sector number 3327 ; ds:di -> UPB 3328 ; CHG: ax, cx, dx 3329 ; OUT: CY if error, 3330 ; ah = error code 3331 ; NC if success 3332 readsector_detect: 3333 assume ds:UPB, es:nothing, ss:nothing 0 000045CA 51 push cx 0 000045CB 52 push dx 0 000045CC 8A5504 mov dl, byte ptr [di + DRIVENUM] 0 000045CF E83800 call detectlba 0 000045D2 5A pop dx 0 000045D3 59 pop cx 0 000045D4 EB08 jmp readsector_NC_LBA 3341 3342 readsector_flag: 3343 assume ds:UPB, es:nothing, ss:nothing 0 000045D6 F745230004 test word ptr [di + FLAGS], F_LBA 0 000045DB 7501 jnz readsector_NC_LBA ; --> (NC) 0 000045DD F9 stc 3347 3348 readsector_NC_LBA: 0 000045DE 1E push ds 0 000045DF 56 push si 0 000045E0 720D jc readsector_chs 3352 readsector_lba: 0 000045E2 FF7504 push word ptr [di + DRIVENUM] 0 000045E5 E8D6FCEB02[0000] neartransfer lba_packet_setup 3355 assume ds:DOSGROUP 0 000045EC 5A pop dx ; dl = unit 0 000045ED EB12 jmp readsector_common 3358 3359 readsector_chs: 0 000045EF 51 push cx 0 000045F0 E8CBFCEB02[0000] neartransfer lbatochs 0 000045F7 58 pop ax 0 000045F8 720C jc readsector_ret_ah 0 000045FA E8C1FCEB02[0000] neartransfer chstotuple 3365 3366 readsector_common: 0 00004601 CD13 int 13h 3368 readsector_ret: 0 00004603 5E pop si 0 00004604 1F pop ds 3371 assume ds:UPB 0 00004605 C3 retn 3373 3374 readsector_ret_ah: 0 00004606 B404 mov ah, 04h ; sector not found 0 00004608 EBF9 jmp readsector_ret 3377 3378 3379 ; INP: dl = unit number 3380 ; OUT: CY no LBA 3381 ; NC LBA 3382 ; CHG: cx 3383 detectlba: 3384 assume ds:nothing, es:nothing, ss:nothing 0 0000460A 50 push ax 0 0000460B 53 push bx 0 0000460C 52 push dx 0 0000460D 1E push ds 3389 0 0000460E B84000 mov ax, 40h 0 00004611 8ED8 mov ds, ax 3392 assume ds:nothing 3393 ; Setting ds = 40h is a Book8088 bugfix, refer to 3394 ; http://www.bttr-software.de/forum/forum_entry.php?id=21061 3395 0 00004613 B80041 mov ax, 4100h 0 00004616 BBAA55 mov bx, 55AAh 0 00004619 31C9 xor cx, cx 0 0000461B 30F6 xor dh, dh 0 0000461D F9 stc 0 0000461E CD13 int 13h 0 00004620 1F pop ds 3403 assume ds:nothing 0 00004621 720A jc detectlba_ret ; --> CY 0 00004623 81FB55AA cmp bx, 0AA55h 0 00004627 F9 stc ; CY 0 00004628 7503 jne detectlba_ret 0 0000462A D1E9 shr cx, 1 ; CY if have LBA access functions 0 0000462C F5 cmc ; NC if have 3410 detectlba_ret: 0 0000462D 5A pop dx 0 0000462E 5B pop bx 0 0000462F 58 pop ax 0 00004630 C3 ret 3415 3416 3417 Cover_FDISK_Bug proc ;AN010; 3418 assume ds:UPB, es:DOSENTRYGROUP, ss:nothing 3419 ;FDISK of PC DOS 3.3 and below, OS2 1.0 has a bug. The maximum number of 3420 ;sector that can be handled by PC DOS 3.3 ibmbio should be 0FFFFh. 3421 ;Instead, sometimes FDISK use 10000h to calculate the maximum number. 3422 ;So, we are going to check that if SECNUM + Hidden sector = 10000h 3423 ;then subtrack 1 from SECNUM. 0 00004631 50 push ax ;AN010; 0 00004632 52 push dx ;AN010; 0 00004633 56 push si ;AN010; 0 00004634 26803E[0000]29 cmp byte [es:Ext_Boot_Sig], EXT_BOOT_SIGNATURE ;AN010; 0 0000463A 742E je CFB_Retit ;AN010;if extended BPB, then >= PC DOS 4.00 0 0000463C 26817F073130 cmp word ptr [es:bx+7], ("0" << 8) + "1" ;AN011; OS2 1.0 ? = IBM 10.0 0 00004642 7507 jne CFB_Chk_SECNUM ;AN010; 0 00004644 26807F0A30 cmp byte ptr [es:bx+10], "0" ;AN010; 0 00004649 751F jne CFB_Retit ;AN010; 3433 CFB_Chk_SECNUM: ;AN010; 3434 BPB_In_Sector equ Bpb_In_Sector ; NASM port label 0 0000464B BE[0000] mov si, offset BPB_In_Sector ;AN010; 0 0000464E 26837C0800 cmp word [es:si + SECNUM], 0 ;AN010;Just to make sure. 0 00004653 7415 je CFB_Retit ;AN010; 0 00004655 268B4408 mov ax, [es:si + SECNUM] ;AN010; 0 00004659 26034411 add ax, [es:si + HIDDEN_L] ;AN010; 0 0000465D 730B jnc CFB_Retit ;AN010; 0 0000465F 85C0 test ax, ax ;AN010;if carry set and AX=0? 0 00004661 7507 jnz CFB_Retit ;AN010; 0 00004663 26FF4C08 dec word [es:si + SECNUM] ;AN010; then decrease SECNUM by 1. 0 00004667 FF4D1B dec word [di + DRVLIM_L] ;AN010; 3445 CFB_Retit: ;AN010; 0 0000466A 5E pop si ;AN010; 0 0000466B 5A pop dx ;AN010; 0 0000466C 58 pop ax ;AN010; 0 0000466D C3 ret ;AN010; 3450 Cover_FDISK_Bug endp ;AN010; 3451 3452 3453 ; SETDRVPARMS SETS UP THE RECOMMENDED BPB IN EACH BDS IN THE SYSTEM BASED ON 3454 ; THE FORM FACTOR. IT IS ASSUMED THAT THE BPBS FOR THE VARIOUS FORM FACTORS 3455 ; ARE PRESENT IN THE BPBTABLE. FOR HARD FILES, THE RECOMMENDED BPB IS THE SAME 3456 ; AS THE BPB ON THE DRIVE. 3457 3458 ; NO ATTEMPT IS MADE TO PRESERVE REGISTERS SINCE WE ARE GOING TO JUMP TO 3459 ; SYSINIT STRAIGHT AFTER THIS ROUTINE. 3460 3461 SETDRVPARMS PROC NEAR 3462 assume ds:nothing, es:nothing, ss:nothing 3463 MESSAGE FTESTINIT,<"SETTING DRIVE PARAMETERS",CR,LF> 0 0000466E 31DB XOR BX,BX 0 00004670 E82DFC call sysinit_get_es_dosbiodata 3466 assume es:DOSGROUP 0 00004673 26C43E[0000] LES DI,[es:START_BDS] ; GET FIRST BDS IN LIST 3468 assume es:UPB 3469 NEXT_BDS: 0 00004678 83FFFF CMP DI,-1 0 0000467B 7501 JNZ DO_SETP 3472 DONE_SETPARMS: 0 0000467D C3 RET 3474 3475 DO_SETP: 3476 assume es:UPB 0 0000467E 06 PUSH ES 0 0000467F 57 PUSH DI ; PRESERVE POINTER TO BDS 0 00004680 268A5D22 MOV BL,[ES:DI + FORMFACTOR] 0 00004684 80FB05 CMP BL,FFHARDFILE 0 00004687 7541 JNZ NOTHARDFF 3482 0 00004689 31D2 xor dx,dx ;AN000; 0 0000468B 268B450E MOV AX,[ES:DI + DRVLIM] 0 0000468F 85C0 test ax, ax ;AN000; 0 00004691 7508 jnz GET_cCYL ;AN000; 0 00004693 268B551D mov dx,[es:di + DRVLIM_H] ;AN000; Use Double word sector number 0 00004697 268B451B MOV AX,[ES:DI + DRVLIM_L] ;AN000; 3489 GET_cCYL: 0 0000469B 52 push dx ;AN000; 0 0000469C 50 PUSH AX 0 0000469D 268B4515 MOV AX,WORD PTR [ES:DI + HDLIM] 0 000046A1 26F76513 MUL WORD PTR [ES:DI + SECLIM] ;Assume Sectorsp per cyl. < 64K. 0 000046A5 89C1 MOV CX,AX ; CX HAS # SECTORS PER CYLINDER 0 000046A7 58 POP AX ; 0 000046A8 5A pop dx ;AN000; Restore drvlim. 0 000046A9 50 push ax ;AN000; 0 000046AA 92 xchg ax, dx ; ax = high word, clobber dx 0 000046AB 31D2 xor dx,dx ;AN000; 0 000046AD F7F1 div cx ;AN000; 0 000046AF 1E push ds 0 000046B0 E8DDFB call sysinit_get_ds_dosbiodata 3503 assume ds:DOSGROUP 0 000046B3 A3[0000] mov [Temp_H],ax ;AN000; AX be 0 here. 0 000046B6 1F pop ds 3506 assume ds:nothing 0 000046B7 58 pop ax ;AN000; 0 000046B8 F7F1 DIV CX ; DIV #SEC BY SEC/CYL TO GET # CYL. 0 000046BA 09D2 OR DX,DX 0 000046BC 7401 JZ NO_CYL_RND ; CAME OUT EVEN 0 000046BE 40 INC AX ; ROUND UP 3512 NO_CYL_RND: 0 000046BF 26894525 MOV [ES:DI + CCYLN],AX 3514 MESSAGE FTESTINIT,<"CCYLN "> 3515 MNUM FTESTINIT,AX 3516 MESSAGE FTESTINIT, 0 000046C3 06 PUSH ES 0 000046C4 1F POP DS 3519 assume ds:UPB 0 000046C5 8D7506 LEA SI,[DI + BYTEPERSEC] ; DS:SI -> BPB FOR HARD FILE 0 000046C8 EB3B JMP SHORT SET_RECBPB 3522 3523 NOTHARDFF: 3524 ;J.K. We don't use the extended BPB for a floppy. 3525 ;J.K.6/24/87 3526 3527 ;SB34INIT007****************************************************************** 3528 ;SB If Fake floppy drive variable is set then we don't have to handle this 3529 ;SB BDS. We can just go and deal with the next BDS at label Go_To_Next_BDS. 3530 0 000046CA 2E803E[0600]01 cmp byte [cs:FakeFloppyDrv],1 3532 Go_To_Next_BDS equ GO_TO_NEXT_BDS ; NASM port label 0 000046D0 743B jz Go_To_Next_BDS 3534 ;SB34INIT007****************************************************************** 3535 0 000046D2 80FB07 CMP BL,FFOTHER ; SPECIAL CASE "OTHER" TYPE OF MEDIUM 0 000046D5 7526 JNZ NOT_PROCESS_OTHER 3538 PROCESS_OTHER: 0 000046D7 268B4525 MOV AX,[es:DI + CCYLN] 0 000046DB 26F76536 mul word [es:DI + RHDLIM] 0 000046DF 26F76534 mul word [es:DI + RSECLIM] 0 000046E3 2689452F MOV [es:DI + RDRVLIM],AX ; HAVE THE TOTAL NUMBER OF SECTORS 0 000046E7 48 DEC AX 3544 3545 ;J.K. Old logic was... 3546 ; MOV BX,515 3547 ; DIV BX 3548 ; OR DX,DX 3549 ; JZ NO_ROUND_UP 3550 ; INC AX ; ROUND UP NUMBER OF FAT SECTORS 3551 3552 ;J.K. New logic to get the sectors/fat area. 3553 ;Fat entry is assumed to be 1.5 bytes!!! 0 000046E8 BB0300 mov bx, 3 0 000046EB F7E3 mul bx 0 000046ED 4B dec bx ; = 2 0 000046EE F7F3 div bx 0 000046F0 31D2 xor dx, dx 0 000046F2 86DF xchg bl, bh ; bh = 2, bl = 0, bx = 512 0 000046F4 F7F3 div bx 0 000046F6 40 inc ax 3562 3563 NO_ROUND_UP: 0 000046F7 26894532 MOV [es:DI + RCSECFAT],AX 0 000046FB EB10 JMP SHORT GO_TO_NEXT_BDS 3566 NOT_PROCESS_OTHER: 0 000046FD D1E3 SHL BX,1 ; BX IS WORD INDEX INTO TABLE OF BPBS 0 000046FF 0E push cs 0 00004700 1F pop ds 3570 assume ds:SYSINITGROUP 0 00004701 8BB7[7001] MOV SI,WORD PTR [BPBTABLE + BX] ; GET ADDRESS OF BPB ; access with ds 3572 SET_RECBPB: 0 00004705 8D7D27 LEA DI,[DI + RBYTEPERSEC] ; ES:DI -> RECBPB 0 00004708 B91900 MOV CX,BPBSIZ 0 0000470B F3A4 REP MOVSB ; MOVE BPBSIZ BYTES 3576 GO_TO_NEXT_BDS: 0 0000470D 5F POP DI 0 0000470E 07 POP ES ; RESTORE POINTER TO BDS 3579 assume es:UPB 0 0000470F 26C43D les di, [ES:DI + LINK] 0 00004712 E963FF JMP NEXT_BDS 3582 3583 SETDRVPARMS ENDP 3584 3585 === Switch to base=000000h -> "DOSENTRY" 3586 usesection DOSENTRY 3587 3588 ; 3589 ; SI POINTS TO DEVICE HEADER 3590 ; J.K. 4/22/86 - print_init, aux_init is modified to eliminate the self-modifying 3591 ; J.K. code. 3592 3593 PRINT_INIT: 3594 Get_device_number equ GET_DEVICE_NUMBER ; NASM port label 0 00000D17 E80F00 call Get_device_number 3596 ;SB33028***************************************************************** 0 00000D1A B401 mov ah,1 ;initalize printer port ;SB;3.30 0 00000D1C CD17 int 17h ;call ROM-Bios routine ;SB;3.30 3599 ;SB33028***************************************************************** 0 00000D1E C3 ret 3601 3602 AUX_INIT: 0 00000D1F E80700 call Get_device_number 3604 ;SB33028***************************************************************** 0 00000D22 B0A3 mov al,RSINIT ;2400,N,1,8 (MSEQU.INC) ;SB ;3.30* 0 00000D24 B400 mov ah,0 ;initalize AUX port ;SB ;3.30* 0 00000D26 CD14 int 14h ;call ROM-Bios routine ;SB ;3.30* 3608 ;SB33028***************************************************************** 0 00000D28 C3 ret 3610 3611 GET_DEVICE_NUMBER: 3612 ;SI -> device header 0 00000D29 2E8A440D MOV AL,[CS:SI+13] ;GET DEVICE NUMBER FROM THE NAME 0 00000D2D 2C31 SUB AL,"1" 0 00000D2F 98 CBW 0 00000D30 89C2 MOV DX,AX 0 00000D32 C3 RET 3618 3619 %if 0 3620 ; 3621 ; PURGE_96TPI NOP'S CALLS TO 96TPI SUPPORT. 3622 ; 3623 PURGE_96TPI PROC NEAR ;MJB001 3624 PUSH DS 3625 PUSH ES 3626 3627 PUSH CS ;MJB001 3628 POP ES ;MJB001 3629 PUSH CS ;MJB001 3630 POP DS ;MJB001 3631 ; ASSUME DS:BIOCODE,ES:BIOCODE 3632 3633 MOV SI,OFFSET PATCHTABLE 3634 PATCHLOOP: 3635 LODSW 3636 MOV CX,AX 3637 JCXZ PATCHDONE 3638 LODSW 3639 MOV DI,AX 3640 MOV AL,90H 3641 REP STOSB 3642 JMP PATCHLOOP 3643 3644 PATCHDONE: 3645 ;**************NOT NEEDED ANY MORE*********************** 3646 ; MOV DI,OFFSET FORMAT_PATCH ; ARR 2.42 3647 ; MOV AL,CS:INST_FAR_RET 3648 ; STOSB 3649 ;******************************************************** 3650 MOV DI,OFFSET TABLE_PATCH ; ARR 2.42 3651 MOV AX,OFFSET EXIT 3652 STOSW 3653 STOSW 3654 3655 POP ES 3656 POP DS 3657 RET ;MJB001 3658 PURGE_96TPI ENDP 3659 %endif 3660 3661 === Switch to base=00C400h -> "SYSINITTRAIL" 3662 usesection SYSINITTRAIL 3663 3664 set_bpb: 0 00004715 56 push si 0 00004716 53 push bx ; now, set the DskDrvs pointer to BPB info 0 00004717 2E8B1E[DE00] mov bx, [cs:Mini_BPB_ptr] 0 0000471C 8D7506 lea si, [di + BYTEPERSEC] ; points to BPB of BDSM 0 0000471F 2E8937 mov [cs:bx], si 0 00004722 43 inc bx 0 00004723 43 inc bx 0 00004724 2E891E[DE00] mov word [cs:Mini_BPB_ptr], bx ; advance to the next address 0 00004729 5B pop bx 0 0000472A 5E pop si 0 0000472B C3 retn 3676 3677 have_bpb: 0 0000472C 2E813E[DE00][2001] cmp word [cs:Mini_BPB_ptr], DSKDRVS.end 3679 ; CY if valid to append another 0 00004733 F5 cmc ; NC if valid 0 00004734 C3 retn 3682 3683 3684 ; 3685 ;Install BDSM installs a BDSM (pointed by DS:DI) into the end of the current 3686 ;linked list of BDS. 3687 ;Also, set the current BDSM pointer segment to DS. 3688 ;At entry: DS:DI -> BDSM 3689 ; 3690 Install_BDSM_and_set_bpb: 3691 assume ds:UPB, es:nothing, ss:nothing 0 00004735 E8DDFF call set_bpb 3693 Install_BDSM: 3694 assume ds:UPB, es:nothing, ss:nothing 0 00004738 50 push ax 0 00004739 56 push si 0 0000473A 06 push es 3698 3699 extern sysinit_have_bootdrive_preliminary 3700 extern sysinit_have_bootdrive_exact 0 0000473B 2ED006[0000] rol byte [cs:sysinit_have_bootdrive_exact], 1 0 00004740 7242 jc .skip 3703 0 00004742 F6452310 testopt [di + FLAGS], FI_AM_MULT 0 00004746 7406 jz @F 0 00004748 F6452320 testopt [di + FLAGS], FI_OWN_PHYSICAL 0 0000474C 7436 jz .skip 3708 @@: 0 0000474E 2EA0[0000] mov al, [cs:sysinit_bootdrive_unit] 0 00004752 3A4504 cmp al, [di + DRIVENUM] 0 00004755 752D jne .skip 0 00004757 2EA1[0000] mov ax, [cs:sysinit_bootdrive_hidden] 0 0000475B 3B4517 cmp ax, [di + HIDSEC_L] 0 0000475E 7510 jne .prelim 0 00004760 2EA1[0200] mov ax, [cs:sysinit_bootdrive_hidden + 2] 0 00004764 3B4519 cmp ax, [di + HIDSEC_H] 0 00004767 7507 jne .prelim 0 00004769 2EF616[0000] not byte [cs:sysinit_have_bootdrive_exact] 0 0000476E EB0C jmp .save 3720 3721 .prelim: 0 00004770 2ED006[0000] rol byte [cs:sysinit_have_bootdrive_preliminary], 1 0 00004775 720D jc .skip 0 00004777 2EF616[0000] not byte [cs:sysinit_have_bootdrive_preliminary] 3725 .save: 0 0000477C 8A4505 mov al, [di + DRIVELET] 0 0000477F 40 inc ax 0 00004780 2EA2[0000] mov byte [cs:DEFAULT_DRIVE], al 3729 .done: 3730 .skip: 3731 0 00004784 B8FFFF mov ax, -1 0 00004787 894502 mov word ptr [di + LINK + 2], ax 0 0000478A 8905 mov word ptr [di + LINK], ax ; make sure it is a null ptr. 3735 0 0000478C E811FB call sysinit_get_es_dosbiodata 3737 assume es:DOSGROUP 3738 Start_BDS equ START_BDS ; NASM port label 0 0000478F 26C436[0000] les si, [es:Start_BDS] ;start of the beginning of list 3740 assume es:UPB 0 00004794 39C6 cmp si, ax 0 00004796 750F jne I_BDSM_Next 0 00004798 E805FB call sysinit_get_es_dosbiodata 3744 assume es:DOSGROUP 0 0000479B 26893E[0000] mov word [es:Start_BDS], di 0 000047A0 268C1E[0200] mov word [es:Start_BDS + 2], ds 0 000047A5 EB11 jmp I_BDSM_ret 3748 3749 I_BDSM_Next: 3750 assume es:UPB 0 000047A7 263904 cmp word ptr [es:si + LINK], ax ;end of the list? 0 000047AA 7405 je I_BDSM_New 0 000047AC 26C434 les si, [es:si + LINK] 0 000047AF EBF6 jmp short I_BDSM_Next 3755 I_BDSM_New: 0 000047B1 268C5C02 mov word ptr [es:si + LINK + 2], ds 0 000047B5 26893C mov word ptr [es:si + LINK], di 3758 3759 I_BDSM_ret: 0 000047B8 07 pop es 3761 assume es:nothing 0 000047B9 5E pop si 0 000047BA 58 pop ax 0 000047BB C3 ret 3765 3766 ;***The following code is not needed any more. Don't show any 3767 ;***messages to be compatible with the behavior of IBMBIO.COM. 3768 ;;Show the message "Mini disk installed ..." 3769 ;;This routine uses WRMSG procedure which will call OUTCHR. 3770 ;Show_Installed_Mini: 3771 ; push ax 3772 ; push bx 3773 ; push ds 3774 ; 3775 ; mov al, MiniNum ;logical drive number 3776 ; add al, Drv_Letter_Base ;='A' 3777 ; mov Mini_Drv_Let, al 3778 ; mov si, offset Installed_Mini 3779 ; call WRMSG 3780 ; 3781 ; pop ds 3782 ; pop bx 3783 ; pop ax 3784 ; ret 3785 ;**End of mini disk initialization** ;J.K. 4/7/86 3786 3787 msg: 0 000047BC 426F6F74206572726F .bootfail: asciz "Boot error: " 0 000047C5 723A2000 0 000047C9 52656164696E672070 .bootfail_read: db "Reading partition table sector failed (error " 0 000047D2 6172746974696F6E20 0 000047DB 7461626C6520736563 0 000047E4 746F72206661696C65 0 000047ED 6420286572726F7220 0 000047F6 5F5F68292E0D0A00 .bootfail_read_errorcode: asciz "__h).",13,10 0 000047FE 4475706C6963617465 .duplicate: db "Duplicate partition login attempt, unit=" 0 00004807 20706172746974696F 0 00004810 6E206C6F67696E2061 0 00004819 7474656D70742C2075 0 00004822 6E69743D 0 00004826 2D2D682C2068696464 .duplicate_unit: db "--h, hidden=" 0 0000482F 656E3D 0 00004832 2D2D2D2D5F .duplicate_hidden_h: db "----_" 0 00004837 2D2D2D2D682E0D0A00 .duplicate_hidden_l: asciz "----h.",13,10 0 00004840 506172746974696F6E .bootfail_sig_parttable: ascii "Partition table signature missing" 0 00004849 207461626C65207369 0 00004852 676E6174757265206D 0 0000485B 697373696E67 0 00004861 20286973206E6F7420 asciz " (is not AA55h).",13,10 0 0000486A 4141353568292E0D0A 0 00004873 00 0 00004874 546F6F206D616E7920 .boot_too_many_partitions_error:asciz "Too many partitions (or a loop).",13,10 0 0000487D 706172746974696F6E 0 00004886 7320286F722061206C 0 0000488F 6F6F70292E0D0A00 0 00004897 506172746974696F6E .boot_partition_cycle_error: asciz "Partition table cycle detected.",13,10 0 000048A0 207461626C65206379 0 000048A9 636C65206465746563 0 000048B2 7465642E0D0A00 3799 3800 === Switch to base=000000h -> "DOSENTRY" 3801 usesection DOSENTRY 3802 3803 CMOS_Clock_Read proc near 3804 ; IN ORDER TO DETERMINE IF THERE IS A CLOCK PRESENT IN THE SYSTEM, THE FOLLOWING 3805 ; NEEDS TO BE DONE. 0 00000D33 1E push ds 0 00000D34 E8BCFF call dosentry_init_get_ds_dosbiodata 3808 assume ds:DOSGROUP, es:nothing, ss:nothing 0 00000D37 50 PUSH AX 0 00000D38 51 PUSH CX 0 00000D39 52 PUSH DX 0 00000D3A 55 PUSH BP 3813 0 00000D3B 31ED XOR BP,BP 3815 LOOP_CLOCK: 0 00000D3D 31C9 XOR CX,CX 0 00000D3F 31D2 XOR DX,DX 3818 ;SB33030******************************************************************** 0 00000D41 B402 MOV AH,2 ;READ REAL TIME CLOCK ;SB ;3.30 0 00000D43 CD1A INT 1Ah ;CALL ROM-BIOS ROUTINE ;SB ;3.30 3821 ;SB33030******************************************************************** 0 00000D45 83F900 CMP CX,0 0 00000D48 7512 JNZ CLOCK_PRESENT 3824 0 00000D4A 83FA00 CMP DX,0 0 00000D4D 750D JNZ CLOCK_PRESENT 3827 0 00000D4F 83FD01 CMP BP,1 ; READ AGAIN AFTER A SLIGHT DELAY, IN CASE CLOCK 0 00000D52 741C JZ NO_READDATE ; WAS AT ZERO SETTING. 3830 0 00000D54 45 INC BP ; ONLY PERFORM DELAY ONCE. 0 00000D55 B90040 MOV CX,4000H 3833 DELAY: 0 00000D58 E2FE LOOP DELAY 0 00000D5A EBE1 JMP LOOP_CLOCK 3836 3837 CLOCK_PRESENT: 0 00000D5C C606[0000]01 mov byte [HaveCMOSClock], 1 ;J.K. Set the flag for cmos clock 3839 0 00000D61 E82E00 call CMOSCK ;J.K. Reset CMOS clock rate that may be 3841 ;possibly destroyed by CP DOS and POST routine did not 3842 ;restore that. 3843 0 00000D64 56 PUSH SI 3845 MESSAGE FTESTINIT,<"CLOCK DEVICE",CR,LF> 0 00000D65 0E push cs 0 00000D66 E80D00 call transfer_read_real_date ;MJB002 READ REAL-TIME CLOCK FOR DATE 3848 0 00000D69 FA CLI ;MJB002 0 00000D6A 8936[0000] MOV [DAYCNT],SI ;MJB002 SET SYSTEM DATE 0 00000D6E FB STI ;MJB002 0 00000D6F 5E POP SI ;MJB002 3853 NO_READDATE: 0 00000D70 5D POP BP 0 00000D71 5A POP DX 0 00000D72 59 POP CX 0 00000D73 58 POP AX 0 00000D74 1F pop ds 3859 assume ds:nothing 0 00000D75 C3 RET 3861 3862 ; INP: dword [ss:sp] = far return address 3863 transfer_read_real_date: 3864 assume ds:nothing, es:nothing, ss:nothing 0 00000D76 50 push ax 0 00000D77 50 push ax 0 00000D78 B8[D800] mov ax, near_read_real_date 0 00000D7B 50 push ax 3869 lframe 0 3870 lpar word, orig_ax_near_ret ; original ax 3871 lpar word, transfer_segment 3872 lpar word, transfer_offset ; already initialised 0 00000D7C 5589E5 lenter 0 00000D7F 1E push ds 0 00000D80 E870FF call dosentry_init_get_ds_dosdata 3876 assume ds:DOSGROUP 0 00000D83 A1[0000] mov ax, word [dosdata_to_doscode] 0 00000D86 1F pop ds 3879 assume ds:nothing 0 00000D87 894604 mov word [bp + ?transfer_segment], ax 3881 extern biocode_retf 0 00000D8A B8[0000] mov ax, biocode_retf 0 00000D8D 874606 xchg ax, word [bp + ?orig_ax_near_ret] 0 00000D90 5D lleave 0 00000D91 CB retf 3886 3887 3888 CMOS_Clock_Read endp 3889 ; 3890 ;J.K. 10/28/86 3891 ;J.K. THE FOLLOWING CODE IS WRITTEN BY JACK GULLEY IN ENGINEERING GROUP. 3892 ;J.K. CP DOS IS CHANGING CMOS CLOCK RATE FOR ITS OWN PURPOSES AND IF THE 3893 ;J.K. USE COLD BOOT THE SYSTEM TO USE PC DOS WHILE RUNNING CP DOS, THE CMOS 3894 ;J.K. CLOCK RATE ARE STILL SLOW WHICH SLOW DOWN DISK OPERATIONS OF PC DOS 3895 ;J.K. WHICH USES CMOS CLOCK. PC DOS IS PUT THIS CODE IN MSINIT TO FIX THIS 3896 ;J.K. PROBLEM AT THE REQUEST OF CP DOS. 3897 ;J.K. THE PROGRAM IS MODIFIED TO BE RUN ON MSINIT. Equates are defined in CMOSEQU.INC. 3898 ;J.K. This program will be called by CMOS_Clock_Read procedure. 3899 ; 3900 ; The following code CMOSCK is used to insure that the CMOS has not 3901 ; had its rate controls left in an invalid state on older AT's. 3902 ; 3903 ; It checks for an AT model byte "FC" with a submodel type of 3904 ; 00, 01, 02, 03 or 06 and resets the periodic interrupt rate 3905 ; bits incase POST has not done it. This initilization routine 3906 ; is only needed once when DOS loads. It should be ran as soon 3907 ; as possible to prevent slow diskette access. 3908 ; 3909 ; This code exposes one to DOS clearing CMOS setup done by a 3910 ; resident program that hides and re-boots the system. 3911 ; 3912 CMOSCK PROC NEAR ; CHECK AND RESET RTC RATE BITS 3913 assume ds:DOSGROUP, es:nothing 3914 3915 ;Model byte and Submodel byte were already determined in MSINIT. 0 00000D92 50 push ax 3917 Model_byte equ Model_Byte ; NASM port label 0 00000D93 803E[0000]FC cmp byte [Model_byte], 0FCh ;check for PC-AT model byte 3919 ; EXIT IF NOT "FC" FOR A PC-AT 0 00000D98 7523 JNE CMOSCK9 ; Exit if not an AT model 3921 0 00000D9A 803E[0000]06 CMP byte [Secondary_Model_Byte],06H ; Is it 06 for the industral AT 0 00000D9F 7407 JE CMOSCK4 ; Go reset CMOS periodic rate if 06 0 00000DA1 803E[0000]04 CMP byte [Secondary_Model_Byte],04H ; Is it 00, 01, 02, or 03 0 00000DA6 7315 JNB CMOSCK9 ; EXIT if problem fixed by POST 3926 ;J.K. Also,Secondary_model_byte = 0 when AH=0c0h, int 15h failed. 3927 CMOSCK4: ; RESET THE CMOS PERIODIC RATE 3928 ; Model=FC submodel=00,01,02,03 or 06 3929 ;SB33IN2*********************************************************************** 3930 0 00000DA8 B08A mov al,CMOS_REG_A | NMI ;NMI disabled on return 0 00000DAA B426 mov ah,00100110b ;Set divider & rate selection 0 00000DAC E83000 call CMOS_WRITE 3934 3935 ;SB33IN2*********************************************************************** 3936 3937 ; CLEAR SET,PIE,AIE,UIE AND SQWE 0 00000DAF B08B mov al,CMOS_REG_B | NMI ;NMI disabled on return 0 00000DB1 E80B00 call CMOS_READ 0 00000DB4 2407 and al,00000111b ;clear SET,PIE,AIE,UIE,SQWE 0 00000DB6 88C4 mov ah,al 0 00000DB8 B00B mov al,CMOS_REG_B ;NMI enabled on return 0 00000DBA E82200 call CMOS_WRITE 3944 3945 ;SB33IN3*********************************************************************** 3946 3947 CMOSCK9: ; EXIT ROUTINE 0 00000DBD 58 pop ax 0 00000DBE C3 RET ; RETurn to caller 3950 ; Flags modifyied 3951 CMOSCK ENDP 3952 ;PAGE 3953 ;--- CMOS_READ ----------------------------------------------------------------- 3954 ; READ BYTE FROM CMOS SYSTEM CLOCK CONFIGURATION TABLE : 3955 ; : 3956 ; INPUT: (AL)= CMOS TABLE ADDRESS TO BE READ : 3957 ; BIT 7 = 0 FOR NMI ENABLED AND 1 FOR NMI DISABLED ON EXIT : 3958 ; BITS 6-0 = ADDRESS OF TABLE LOCATION TO READ : 3959 ; : 3960 ; OUTPUT: (AL) VALUE AT LOCATION (AL) MOVED INTO (AL). IF BIT 7 OF (AL) WAS : 3961 ; ON THEN NMI LEFT DISABLED. DURING THE CMOS READ BOTH NMI AND : 3962 ; NORMAL INTERRUPTS ARE DISABLED TO PROTECT CMOS DATA INTEGRITY. : 3963 ; THE CMOS ADDRESS REGISTER IS POINTED TO A DEFAULT VALUE AND : 3964 ; THE INTERRUPT FLAG RESTORED TO THE ENTRY STATE ON RETURN. : 3965 ; ONLY THE (AL) REGISTER AND THE NMI STATE IS CHANGED. : 3966 ;------------------------------------------------------------------------------- 3967 3968 CMOS_READ PROC NEAR ; READ LOCATION (AL) INTO (AL) 3969 assume es:nothing,ds:nothing 0 00000DBF 9C PUSHF ; SAVE INTERRUPT ENABLE STATUS AND FLAGS 3971 ;SB33IN4******************************************************************** 3972 0 00000DC0 FA cli 0 00000DC1 53 push bx 0 00000DC2 50 push ax ;save user NMI state 0 00000DC3 0C80 or al,NMI ;disable NMI for us 0 00000DC5 E670 out CMOS_PORT,al 0 00000DC7 90 nop ;undocumented delay needed 0 00000DC8 E471 in al,CMOS_DATA ;get data value 3980 3981 ;set NMI state to user specified 0 00000DCA 89C3 mov bx,ax ;save data value 0 00000DCC 58 pop ax ;get user NMI 0 00000DCD 2480 and al,NMI 0 00000DCF 0C0F or al,CMOS_SHUT_DOWN 0 00000DD1 E670 out CMOS_PORT,al 0 00000DD3 90 nop 0 00000DD4 E471 in al,CMOS_DATA 3989 0 00000DD6 89D8 mov ax,bx ;data value 0 00000DD8 5B pop bx 3992 3993 ;SB33IN4******************************************************************** 0 00000DD9 0E PUSH CS ; *PLACE CODE SEGMENT IN STACK AND 0 00000DDA E80100 CALL CMOS_POPF ; *HANDLE POPF FOR B- LEVEL 80286 0 00000DDD C3 RET ; RETURN WITH FLAGS RESTORED 3997 3998 CMOS_READ ENDP 3999 4000 CMOS_POPF PROC NEAR ; POPF FOR LEVEL B- PARTS 0 00000DDE CF IRET ; RETURN FAR AND RESTORE FLAGS 4002 4003 CMOS_POPF ENDP 4004 4005 ;--- CMOS_WRITE ---------------------------------------------------------------- 4006 ; WRITE BYTE TO CMOS SYSTEM CLOCK CONFIGURATION TABLE : 4007 ; : 4008 ; INPUT: (AL)= CMOS TABLE ADDRESS TO BE WRITTEN TO : 4009 ; BIT 7 = 0 FOR NMI ENABLED AND 1 FOR NMI DISABLED ON EXIT : 4010 ; BITS 6-0 = ADDRESS OF TABLE LOCATION TO WRITE : 4011 ; (AH)= NEW VALUE TO BE PLACED IN THE ADDRESSED TABLE LOCATION : 4012 ; : 4013 ; OUTPUT: VALUE IN (AH) PLACED IN LOCATION (AL) WITH NMI LEFT DISABLED : 4014 ; IF BIT 7 OF (AL) IS ON. DURING THE CMOS UPDATE BOTH NMI AND : 4015 ; NORMAL INTERRUPTS ARE DISABLED TO PROTECT CMOS DATA INTEGRITY. : 4016 ; THE CMOS ADDRESS REGISTER IS POINTED TO A DEFAULT VALUE AND : 4017 ; THE INTERRUPT FLAG RESTORED TO THE ENTRY STATE ON RETURN. : 4018 ; ONLY THE CMOS LOCATION AND THE NMI STATE IS CHANGED. : 4019 ;------------------------------------------------------------------------------- 4020 4021 CMOS_WRITE PROC NEAR ; WRITE (AH) TO LOCATION (AL) 4022 assume es:nothing,ds:nothing 0 00000DDF 9C PUSHF ; SAVE INTERRUPT ENABLE STATUS AND FLAGS 0 00000DE0 50 PUSH AX ; SAVE WORK REGISTER VALUES 4025 0 00000DE1 FA cli 0 00000DE2 50 push ax ;save user NMI state 0 00000DE3 0C80 or al,NMI ;disable NMI for us 0 00000DE5 E670 out CMOS_PORT,al 0 00000DE7 90 nop 0 00000DE8 88E0 mov al,ah 0 00000DEA E671 out CMOS_DATA,al ;write data 4033 4034 ;set NMI state to user specified 0 00000DEC 58 pop ax ;get user NMI 0 00000DED 2480 and al,NMI 0 00000DEF 0C0F or al,CMOS_SHUT_DOWN 0 00000DF1 E670 out CMOS_PORT,al 0 00000DF3 90 nop 0 00000DF4 E471 in al,CMOS_DATA 4041 4042 ;SB33IN5******************************************************************** 0 00000DF6 58 POP AX ; RESTORE WORK REGISTERS 0 00000DF7 0E PUSH CS ; *PLACE CODE SEGMENT IN STACK AND 0 00000DF8 E8E3FF CALL CMOS_POPF ; *HANDLE POPF FOR B- LEVEL 80286 0 00000DFB C3 RET 4047 4048 CMOS_WRITE ENDP 4049 ; 4050 4051 %assign NUMBER_DOSENTRY_INIT_DISCARD $ - end_of_dosentry_init_late 4052 %warning DOSENTRY discard size NUMBER_DOSENTRY_INIT_DISCARD 4052 ****************** warning: DOSENTRY discard size 507 [-w+user] 4053 %if NUMBER_DOSENTRY_INIT_DISCARD < SYSINITSTACK + 64 4054 ; 64 is for the first UMCB and a small safety margin 4055 %assign NUMBER_SYSINITSTACK SYSINITSTACK + 64 4056 %error DOSENTRY discard size NUMBER_DOSENTRY_INIT_DISCARD smaller than NUMBER_SYSINITSTACK 4057 %endif 4058 4059 4060 END$: 4061 ; (no prior section) ; CODE ENDS 4062 END 4063 4064 === Trace listing source: sysinit1.lst 1 ; PAGE ,132 ; 2 ; SCCSID = @(#)sysinit1.asm 1.7 85/10/24 3 ;TITLE BIOS SYSTEM INITIALIZATION 4 %warning out: ...SYSINIT1 4 ****************** warning: out: ...SYSINIT1 [-w+user] 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; p40 Boot from the system with no floppy diskette drives 6/26/87 J.K. 12 ;AN002; d24 MultiTrack= command added. 6/29/87 J.K. 13 ;AN003; d9 Double word mov for 386 machine 7/15/87 J.K. 14 ;AN004; p447 BUFFERS = 50 /E without EMS installed hangs 8/25/87 J.K. 15 ;AN005; d184 Set DEVMARK for MEM command 8/25/87 J.K. 16 ;AN006; p851 Installable files not recognized corretly. 9/08/87 J.K. 17 ;AN007; p1299 Set the second entry of DEVMARK for MEM command 9/25/87 J.K. 18 ;AN008; p1361 New Extended Attribute 9/28/87 J.K. 19 ;AN009; p1326 Buffers = 50 /e hangs 9/28/87 J.K. 20 ;AN010; New EMS Interface 21 ;AN011; New Message SKL file 10/20/87 J.K. 22 ;AN012; P2211 Setting EA=7 for ANSI.SYS hangs the system 11/02/87 J.K. 23 ;AN013; p2343 Set the name for SYSINIT_BASE for MEM command 11/11/87 J.K. 24 ;AN014; D358 New device driver INIT function package 12/03/87 J.K. 25 ;AN015; For Installed module with no parameter 12/11/87 J.K. 26 ;AN016; D285 Undo the Extended Attribute handling 12/17/87 J.K. 27 ;AN017; P2806 Show "Error in CONFIG.SYS ..." for INSTALL= command 12/17/87 J.K. 28 ;AN018; P2914 Add Extended Memory Size in SYSVAR 01/05/88 J.K. 29 ;AN019; P3111 Take out the order dependency of the INSTALL= 01/25/88 J.K. 30 ;AN020; P3497 Performace fix for new buffer scheme 02/15/88 J.K. 31 ;AN021; D486 SHARE installation for big media 02/23/88 J.K. 32 ;AN022; D493 Undo D358 & do not show error message for device driv02/24/88 J.K. 33 ;AN023; D474 Change BUFFERS= /E option to /X for expanded memory 03/16/88 J.K. 34 ;AN024; D506 Take out the order dependency of the IFS= 03/28/88 J.K. 35 ;AN025; P4086 Memory allocation error when loading SHARE.EXE 03/31/88 J.K. 36 ;AN026; D517 New Balanced Real memory buffer set up scheme 04/18/88 J.K. 37 ;AN027; D528 Install XMAEM.SYS first before everything else 04/29/88 J.K. 38 ;AN028; P4669 SHARE /NC causes an error 05/03/88 J.K. 39 ;AN029; P4759 Install EMS INT2fh, INT 67h handler 05/12/88 J.K. 40 ;AN030; P4934 P4759 INT 2Fh handler number be changed to 1Bh 05/20/88 J.K. 41 ;============================================================================== 42 43 extern BUFFHEAD 44 extern sysinit_get_ds_dosbiodata 45 extern sysinit_get_es_dosbiodata 46 47 TRUE EQU 0FFFFh 48 FALSE EQU 0 49 CR equ 13 50 LF equ 10 51 TAB equ 9 52 53 IBMVER EQU TRUE 54 IBM EQU IBMVER 55 STACKSW EQU TRUE ;Include Switchable Hardware Stacks 56 IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 57 %iassign MSVER FALSE 58 ALTVECT EQU FALSE ;Switch to build ALTVECT version 59 KANJI EQU FALSE 60 MYCDS_SIZE equ 88 ;J.K. Size of Curdir_List. If it is not 61 ;the same, then will generate compile error. 62 63 ; 64 %IF IBMJAPVER 65 NOEXEC EQU TRUE 66 %ELSE 67 NOEXEC EQU FALSE 68 %ENDIF 69 70 ;DOSSIZE EQU 0A000H 71 ;dossize equ 0C000H ;J.K. for the debugging version of IBMDOS. 72 73 %include "dcodeseg.nas" 1 <1> 2 <1> %ifndef DCODESEGNAS 3 <1> %assign DCODESEGNAS 1 4 <1> === Switch to base=002450h -> "DOSCODETABLE" 5 <1> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <1> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <1> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <1> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <1> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <1> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <1> 12 <1> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <1> 14 <1> %endif 74 === Switch to base=00C3F0h -> "AFTERDOSCODE" 75 section AFTERDOSCODE class=AFTERDOSCODE align=16 76 global afterdoscodelabel 77 afterdoscodelabel: 78 79 %include "ddataseg.nas" 1 <1> 2 <1> %include "lmacros3.mac" 1 <2> [list -] 1 ****************** <2> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <3> [list -] 14 <2> [list -] 3 <1> === Switch to base=000E10h -> "DOSSTART" 4 <1> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <1> ; (no prior section) ; DOSSTART ENDS 6 <1> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <1> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <1> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <1> === Switch to base=000E10h -> "CONSTANTS" 10 <1> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <1> ; (no prior section) ; CONSTANTS ENDS 12 <1> === Switch to base=000E10h -> "DATA" 13 <1> addsection DATA, align=2 PUBLIC class=DATA 14 <1> ; (no prior section) ; DATA ENDS 15 <1> === Switch to base=000E10h -> "TABLE" 16 <1> addsection TABLE, align=2 PUBLIC class=TABLE 17 <1> ; (no prior section) ; TABLE ENDS 18 <1> === Switch to base=000E10h -> "DOSDATATABLE" 19 <1> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <1> ; (no prior section) ; DOSDATATABLE ENDS 21 <1> === Switch to base=000E10h -> "DOSDATACODE" 22 <1> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <1> ; (no prior section) ; DOSDATACODE ENDS 24 <1> === Switch to base=000E10h -> "DOSBIODATA" 25 <1> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <1> === Switch to base=000E10h -> "LAST" 27 <1> addsection LAST, align=16 PUBLIC class=LAST 28 <1> ; (no prior section) ; LAST ENDS 29 <1> 30 <1> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <1> 32 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 1 <3> [list -] 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 80 [list -] 80 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 80 ****************** warning: out: BPB.INC... [-w+user] 80 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 80 ****************** warning: out: DEVSYM.INC... [-w+user] 80 ****************** warning: out: IOCTL.INC... [-w+user] 80 ****************** warning: out: BPB.INC... [-w+user] 80 ****************** warning: out: BIOSTRUC.INC... [-w+user] 80 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 80 ****************** warning: out: MSBDS.INC... [-w+user] 98 [list -] 13 <1> [list -] 100 %include "scanptab.mac" 1 <1> 2 <1> %if 0 3 <1> 4 <1> scanptab - Scan partition table (macros) 5 <1> 2019, 2025 by E. C. Masloch 6 <1> 7 <1> Usage of the works is permitted provided that this 8 <1> instrument is retained with the works, so that any entity 9 <1> that uses the works is notified of this instrument. 10 <1> 11 <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <1> 13 <1> %endif 14 <1> 15 <1> mode_all_ext5 equ 00b 16 <1> mode_ignore_ext5 equ 01b 17 <1> mode_first_ext5 equ 10b 18 <1> mode_first_type_ext5 equ 11b 19 <1> 20 <1> mode_all_ext15 equ 00b << 2 21 <1> mode_ignore_ext15 equ 01b << 2 22 <1> mode_first_ext15 equ 10b << 2 23 <1> mode_first_type_ext15 equ 11b << 2 24 <1> 25 <1> mode_all_ext85 equ 00b << 4 26 <1> mode_ignore_ext85 equ 01b << 4 27 <1> mode_first_ext85 equ 10b << 4 28 <1> mode_first_type_ext85 equ 11b << 4 29 <1> 30 <1> mode_ignore_subsequent_nested equ 1_00_00_00b 31 <1> mode_ignore_subsequent_logical equ 10_00_00_00b 32 <1> mode_ignore_subsequent_primary equ 100_00_00_00b 33 <1> mode_traditional_order_logical equ 1000_00_00_00b 34 <1> mode_active_priority equ 1_0000_00_00_00b 35 <1> mode_subsequent_primary_after equ 10_0000_00_00_00b 36 <1> mode_disable_fat32 equ 00_1000_0000_00_00_00b 37 <1> mode_disable_lba equ 01_0000_0000_00_00_00b 38 <1> mode_dlasort_zero equ 10_0000_0000_00_00_00b 101 [list +] 102 103 ;AN000 J.K. If MYCDS_SIZE <> CURDIRLEN, then force a compilatiaon error. 104 %if MYCDS_SIZE != curdirLen 105 %error  !!! SYSINIT1 COMPILATION FAILED. DIFFERENT CDS SIZE !!! 106 %endif 107 108 %IFN IBMJAPVER 109 EXTRN RE_INIT:FAR 110 %ENDIF 111 112 ;--------------------------------------- 113 ;Equates for Main stack and stack Initialization program 114 %IF STACKSW 115 116 EntrySize equ 8 117 118 MinCount equ 8 119 DefaultCount equ 9 120 MaxCount equ 64 121 122 MinSize equ 32 123 DefaultSize equ 128 124 MaxSize equ 512 125 126 labelsize AllocByte, byte, es:bp+0 127 labelsize IntLevel, byte, es:bp+1 128 labelsize SavedSP, word, es:bp+2 129 labelsize SavedSS, word, es:bp+4 130 labelsize NewSP, word, es:bp+6 131 Free equ 0 132 allocated equ 1 133 overflowed equ 2 134 clobbered equ 3 135 136 137 ;External variables in IBMBIO for INT19h handling rouitne. J.K. 10/23/86 138 EXTRN Int19sem:byte 139 140 %macro extrn_irq_handlers 1-* 141 %rep %0 142 EXTRN Int19OLD%1:dword 143 %rotate 1 144 %endrep 145 %endmacro 146 147 extrn_irq_handlers 02,08,09,0A,0B,0C,0D,0E,70,72,73,74,76,77 141 <1> %rep %0 142 <1> EXTRN Int19OLD%1:dword 143 <1> %rotate 1 144 <1> %endrep 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 142 <2> EXTRN Int19OLD%1:dword 143 <2> %rotate 1 148 149 ; (no prior section) ; CODE ends 150 %ENDIF 151 ;--------------------------------------- 152 ;J.K. 6/29/87 External variable defined in IBMBIO module for Multi-track 153 MULTRK_ON EQU 10000000B ;User spcified Mutitrack=on, or System turns 154 ; it on after handling CONFIG.SYS file as a 155 ; default value, if MulTrk_flag = MULTRK_OFF1. 156 MULTRK_OFF1 EQU 00000000B ;initial value. No "Multitrack=" command entered. 157 MULTRK_OFF2 EQU 00000001B ;User specified Multitrack=off. 158 === Switch to base=000000h -> "DOSENTRY" 159 usesection DOSENTRY 160 EXTRN MulTrk_flag:word ;AN002; 161 extrn CONHEADER:byte 162 ; (no prior section) ; CODE ends 163 ;J.K. 6/29/87 End of Multi-track definition. 164 === Switch to base=000E10h -> "DOSSTART" 165 usesection DOSSTART 166 ; (no prior section) ; DOSSTART ENDS 167 === Switch to base=002450h -> "AFTERDOSDATA" 168 addsection AFTERDOSDATA, align=16 class=AFTERDOSDATA 169 ; (no prior section) ; AFTERDOSDATA ENDS 170 global afterdosdatalabel 171 afterdosdatalabel: 172 === Switch to base=00C400h -> "SYSINITSEG" 173 addsection SYSINITSEG, PUBLIC class=INIT === Switch to base=00C400h -> "SYSINITTRAIL" 174 addsection SYSINITTRAIL, PUBLIC class=INIT align=2 === Switch to base=00C400h -> "SYSINITLAST" 175 addsection SYSINITLAST, PUBLIC class=INIT align=2 176 177 group SYSINITGROUP SYSINITSEG SYSINITTRAIL SYSINITLAST 178 === Switch to base=00C400h -> "SYSINITSEG" 179 usesection SYSINITSEG 180 181 EXTRN BADCOM:BYTE 182 EXTRN SYSSIZE:BYTE 183 EXTRN CONDEV:BYTE,AUXDEV:BYTE,PRNDEV:BYTE,COMMND:BYTE 184 extrn DeviceParameters:byte 185 extrn DevMark_Addr:word 186 extrn SetDevMarkFlag:byte 187 extrn PathString:byte ;AN021; 188 extrn LShare:byte ;AN021; 189 extrn ShareWarnMsg:byte ;AN021; 190 191 EXTRN MEM_ERR:NEAR 192 EXTRN DOCONF:NEAR 193 extrn Multi_Pass:NEAR ;AN024; 194 extrn BadLoad:near 195 extrn Error_Line:near 196 extern devicehighflag, shellhighflag 197 198 PUBLIC behind_dosentry_segment 199 PUBLIC DEVICE_LIST 200 SYSI_COUNTRY equ SYSI_Country ; NASM port label 201 PUBLIC SYSI_COUNTRY 202 PUBLIC MEMORY_SIZE 203 PUBLIC DEFAULT_DRIVE 204 PUBLIC BUFFERS 205 PUBLIC FILES 206 PUBLIC NUM_CDS 207 PUBLIC SYSINIT 208 CNTRYFILEHANDLE equ CntryFilehandle ; NASM port label 209 PUBLIC CNTRYFILEHANDLE 210 PUBLIC COMMAND_LINE 211 public Big_Media_Flag ;AN021;Set by IBMINIT 212 213 %IF STACKSW 214 ;Internal Stack Information 215 PUBLIC STACK_COUNT 216 PUBLIC STACK_SIZE 217 PUBLIC STACK_ADDR 218 %ENDIF 219 220 dosinfo equ DOSINFO ; NASM port label 221 entry_point equ ENTRY_POINT ; NASM port label 222 PUBLIC dosinfo,entry_point 223 fcbs equ FCBS ; NASM port label 224 keep equ Keep ; NASM port label 225 PUBLIC fcbs,keep 226 PUBLIC config_block 227 zero equ ZERO ; NASM port label 228 sepchr equ SepChr ; NASM port label 229 PUBLIC zero,sepchr,STALL 230 count equ COUNT ; NASM port equate 231 chrptr equ CHRPTR ; NASM port label 232 org_count equ Org_Count ; NASM port label 233 PUBLIC count,chrptr,org_count 234 bufptr equ BUFPTR ; NASM port label 235 prmblk equ PRMBLK ; NASM port label 236 PUBLIC bufptr,prmblk 237 PUBLIC PACKET,UNITCOUNT 238 drivenumber equ DriveNumber ; NASM port label 239 PUBLIC BREAK_ADDR,BPB_ADDR,drivenumber 240 public Config_Size 241 public Install_Flag 242 public COM_Level 243 public CMMT 244 public CMMT1 245 public CMMT2 246 public Cmd_Indicator 247 public LineCount 248 public ShowCount 249 public Buffer_LineNum 250 public DoNotShowNum 251 public IFS_Flag 252 public IFS_RH 253 public H_Buffers 254 public Buffer_Slash_X ;AN023; 255 public ConfigMsgFlag ;AN014; 256 public Do_Install_Exec ;AN019; 257 public Multi_Pass_Id ;AN024; 258 259 260 ; 261 SYSINIT$: 262 %IF STACKSW 263 ;.SALL 264 ;=== Push trace listing source: msstack.nas 265 %include "msstack.nas" ;Main stack program and data definitions ; NASM included file 1 <1> ; MSStack.inc 2 <1> ; 3 <1> ; Interrupt level 2, 3, 4, 5, 6, 7,(10, 11, 12, 14, 15 - AT level) 4 <1> ; should follow the standard Interrupt Sharing Scheme which has 5 <1> ; a standard header structure. 6 <1> ; Fyi, the following shows the relations between 7 <1> ; the interrupt vector and interrupt level. 8 <1> ; VEC(Hex) 2 8 9 A B C D E 70 72 73 74 76 77 9 <1> ; LVL(Deci) 9 0 1 2 3 4 5 6 8 10 11 12 14 15 10 <1> ; MSSTACK module modifies the following interrupt vectors 11 <1> ; to meet the standard Interrupt Sharing standard; 12 <1> ; A, B, C, D, E, 72, 73, 74, 76, 77. 13 <1> ; Also, for interrupt level 7 and 15, the FirstFlag in a standard header 14 <1> ; should be initialized to indicat whether this interrupt handler is 15 <1> ; the first (= 80h) or not. The FirstFlag entry of INT77h's 16 <1> ; program header is initialized in STKINIT.INC module. 17 <1> ; FirstFlag is only meaningful for interrupt level 7 and 15. 18 <1> ; 19 <1> 20 <1> ; User specifies the number of stack elements - default = 9 21 <1> ; minimum = 8 22 <1> ; maximum = 64 23 <1> ; 24 <1> ; Intercepts Asynchronous Hardware Interrupts only 25 <1> ; 26 <1> ; Picks a stack from pool of stacks and switches to it 27 <1> ; 28 <1> ; Calls the previously saved interrupt vector after pushing flags 29 <1> ; 30 <1> ; On return, returns the stack to the stack pool 31 <1> ; 32 <1> 33 <1> 34 <1> ; This is a modification of STACKS: 35 <1> ; 1. To fix a bug which was causing the program to take up too much space. 36 <1> ; 2. To dispense stack space from hi-mem first rather than low-mem first. 37 <1> ; . Clobbers the stack that got too big instead of innocent stack 38 <1> ; . Allows system to work if the only stack that got too big was the most 39 <1> ; deeply nested one 40 <1> ; 3. Disables NMI interrupts while setting the NMI vector. 41 <1> ; 4. Does not intercept any interupts on a PCjr. 42 <1> ; 5. Double checks that a nested interrupt didn't get the same stack. 43 <1> ; 6. Intercepts Ints 70, 72-77 for PC-ATs and other future products 44 <1> 45 <1> ; === alternative section STACKSCODE 46 <1> 47 <1> assume cs:STACKSCODE 48 <1> 49 <1> ;The following variables are for MSSTACK.inc 50 <1> EVEN 0 00000000 0000 dw 0 ; SPARE FIELD BUT LEAVE THESE IN ORDER 0 00000002 0000 StackCount dw 0 0 00000004 0000 StackAt dw 0 0 00000006 0000 StackSize dw 0 0 00000008 0000 Stacks dw 0 0 0000000A 0000 dw 0 57 <1> 0 0000000C [0800] FirstEntry dw Stacks 0 0000000E [4800] LastEntry dw Stacks+(DefaultCount*EntrySize)-EntrySize 0 00000010 [4800] NextEntry dw Stacks+(DefaultCount*EntrySize)-EntrySize 61 <1> 62 <1> ;End of variables defined for MSSTACK. 63 <1> 64 <1> ; === no alternative section 65 <1> 66 <1> ;******************************************************************* 67 <1> ;Macro Interrupt handler for the ordinary interrupt vectors and 68 <1> ;the shared interrupt vectors. 69 <1> ;***************************** 70 <1> %imacro Stack_Main 1-* 71 <1> %rep %0 72 <1> ASSUME DS:NOTHING 73 <1> ASSUME ES:NOTHING 74 <1> ASSUME SS:NOTHING 75 <1> PUBLIC Int%1 76 <1> PUBLIC Old%1 77 <1> ;----------------------------- 78 <1> %ifn IntSharingFlag ;if not IntSharingFlag 79 <1> ;----------------------------- 80 <1> Old%1 DD 0 81 <1> Int%1 PROC FAR 82 <1> ;----------------------------- 83 <1> %else ;for shared interrupt. A Header exists. 84 <1> 85 <1> PUBLIC FirstFlag%1 86 <1> Int%1 PROC FAR 87 <1> jmp short Entry_Int%1_Stk 88 <1> Old%1 dd 0 ;Forward pointer 89 <1> dw 424Bh ;compatible signature for Int. Sharing 90 <1> FirstFlag%1 db 0 ;the firstly hooked. 91 <1> jmp short Intret_%1 ;Reset routine. We don't care this. 92 <1> db 7 dup (0) ;Reserved for future. 93 <1> Entry_Int%1_Stk: 94 <1> ;----------------------------- 95 <1> %endif 96 <1> ;----------------------------- 97 <1> INT%1 equ Int%1 98 <1> OLD%1 equ Old%1 99 <1> 100 <1> ; 101 <1> ; Keyboard interrupt must have a three byte jump, a NOP and a zero byte 102 <1> ; as its first instruction for compatibility reasons 103 <1> %ifidni %1, 09 104 <1> jmp short Keyboard_lbl 105 <1> nop 106 <1> nop 107 <1> db 0 108 <1> Keyboard_lbl label near 109 <1> %endif 110 <1> 111 <1> ; This patches INTERRUPT 75h to be "unhooked". We do this Wierdness, 112 <1> ; rather than never hooking INT 75h, to maintain maximum compat. with IBMs 113 <1> ; post production patch. 114 <1> push ax 115 <1> 116 <1> %ifidni %1, 02 117 <1> 118 <1> ; ********************************************************************* 119 <1> ; 120 <1> ; This is special support for the PC Convertible / NMI handler 121 <1> ; 122 <1> ; On the PC Convertible, there is a situation where an NMI can be 123 <1> ; caused by using the "OUT" instructions to certain ports. When this 124 <1> ; occurs, the PC Convertible hardware *GUARANTEES* that **NOTHING** 125 <1> ; can stop the NMI or interfere with getting to the NMI handler. This 126 <1> ; includes other type of interrupts (hardware and software), and 127 <1> ; also includes other type of NMI's. When any NMI has occured, 128 <1> ; no other interrtupt (hardware, software or NMI) can occur until 129 <1> ; the software takes specific steps to allow further interrupting. 130 <1> ; 131 <1> ; For PC Convertible, the situation where the NMI is generated by the 132 <1> ; "OUT" to a control port requires "fixing-up" and re-attempting. In 133 <1> ; otherwords, it is actually a "restartable exception". In this 134 <1> ; case, the software handler must be able to get to the stack in 135 <1> ; order to figure out what instruction caused the problem, where 136 <1> ; it was "OUT"ing to and what value it was "OUT"ing. Therefore, 137 <1> ; we will not switch stacks in this situation. This situation is 138 <1> ; detected by interrogating port 62h, and checking for a bit value 139 <1> ; of 80h. If set, *****DO NOT SWITCH STACKS*****. 140 <1> ; 141 <1> ; ********************************************************************* 142 <1> 143 <1> push es 144 <1> mov ax,0f000h 145 <1> mov es,ax 146 <1> assume es:nothing 147 <1> mdl_convert equ MDL_CONVERT ; NASM port equate 148 <1> cmp byte ptr [es:0fffeh],mdl_convert ;check if convertible 149 <1> pop es 150 <1> assume es:nothing 151 <1> jne Normal%1 152 <1> 153 <1> in al,62h 154 <1> test al,80h 155 <1> jz Normal%1 156 <1> 157 <1> Special%1: 158 <1> pop ax 159 <1> jmp far [cs:Old%1] 160 <1> 161 <1> Normal%1: 162 <1> 163 <1> ; ********************************************************************* 164 <1> 165 <1> %endif 166 <1> 167 <1> push bp 168 <1> push es 169 <1> STACKS equ Stacks ; NASM port label 170 <1> mov es, [cs:STACKS+2] ; Get segment of stacks 171 <1> assume es:STACKSCODE 172 <1> 173 <1> mov bp,[cs:NextEntry] ; get most likely candidate 174 <1> Allocated equ allocated ; NASM port equate 175 <1> mov al,Allocated 176 <1> xchg [AllocByte],al ; grab the entry 177 <1> cmp al,Free ; still avail? 178 <1> jne NotFree%1 179 <1> 180 <1> sub word [cs:NextEntry],EntrySize ; set for next interrupt 181 <1> 182 <1> Found%1: 183 <1> mov [SavedSP],sp ; save sp value 184 <1> mov [SavedSS],ss ; save ss also 185 <1> ; mov IntLevel,%1h ; save the int level 186 <1> 187 <1> mov ax,bp ; temp save of table offset 188 <1> 189 <1> mov bp,[NewSP] ; get new SP value 190 <1> cmp [es:bp],ax ; check for offset into table 191 <1> jne FoundBad%1 192 <1> 193 <1> mov ax,es ; point ss,sp to the new stack 194 <1> mov ss,ax 195 <1> mov sp,bp 196 <1> assume ss:STACKSCODE 197 <1> 198 <1> pushf ; go execute the real interrupt handler 199 <1> call far [cs:Old%1] ; which will iret back to here 200 <1> 201 <1> mov bp,sp ; retrieve the table offset for us 202 <1> mov bp,[es:bp] ; but leave it on the stack 203 <1> mov ss,[SavedSS] ; get old stack back 204 <1> mov sp,[SavedSP] 205 <1> assume ss:nothing 206 <1> 207 <1> ; cmp AllocByte,Allocated ; If an error occured, 208 <1> ; jne NewError%1 ; do not free us 209 <1> 210 <1> mov byte [AllocByte],Free ; free the entry 211 <1> mov [cs:NextEntry],bp ; setup to use next time 212 <1> 213 <1> NewError%1: 214 <1> pop es 215 <1> assume es:nothing 216 <1> pop bp ; saved on entry 217 <1> pop ax ; saved on entry 218 <1> 219 <1> INTRET_%1: ;3.30 220 <1> iret ; done with this interrupt 221 <1> Intret_%1 equ INTRET_%1 222 <1> 223 <1> NotFree%1: 224 <1> cmp al,Allocated ; error flag 225 <1> je FindNext%1 ; no, continue 226 <1> xchg [AllocByte],al ; yes, restore error value 227 <1> 228 <1> FindNext%1: 229 <1> LongPath equ longpath ; NASM port label 230 <1> call LongPath 231 <1> jmp Found%1 232 <1> 233 <1> FoundBad%1: 234 <1> cmp bp,[cs:FirstEntry] 235 <1> jc FindNext%1 236 <1> mov bp,ax ; flag this entry 237 <1> Clobbered equ clobbered ; NASM port equate 238 <1> mov byte [AllocByte],Clobbered 239 <1> ; add bp,EntrySize ; and previous entry 240 <1> ; mov AllocByte,Overflowed 241 <1> ; sub bp,EntrySize 242 <1> jmp FindNext%1 ; keep looking 243 <1> 244 <1> int%1 endp 245 <1> %rotate 1 246 <1> %endrep 247 <1> %endmacro 248 <1> 249 <1> ;***************************** ;3.30 250 <1> ;End of Macro definition ;3.30 251 <1> ;******************************************************************** ;3.30 252 <1> ; THESE ARE THE INDIVIDUAL INTERRUPT HANDLERS ;3.30 253 <1> 254 <1> %iassign IntSharingFlag 0 255 <1> Stack_Main 02,08,09,70 71 <2> %rep %0 72 <2> ASSUME DS:NOTHING 73 <2> ASSUME ES:NOTHING 74 <2> ASSUME SS:NOTHING 75 <2> PUBLIC Int%1 76 <2> PUBLIC Old%1 77 <2> 78 <2> %ifn IntSharingFlag 79 <2> 80 <2> Old%1 DD 0 81 <2> Int%1 PROC FAR 82 <2> 83 <2> %else 84 <2> 85 <2> PUBLIC FirstFlag%1 86 <2> Int%1 PROC FAR 87 <2> jmp short Entry_Int%1_Stk 88 <2> Old%1 dd 0 89 <2> dw 424Bh 90 <2> FirstFlag%1 db 0 91 <2> jmp short Intret_%1 92 <2> db 7 dup (0) 93 <2> Entry_Int%1_Stk: 94 <2> 95 <2> %endif 96 <2> 97 <2> INT%1 equ Int%1 98 <2> OLD%1 equ Old%1 99 <2> 100 <2> 101 <2> 102 <2> 103 <2> %ifidni %1, 09 104 <2> jmp short Keyboard_lbl 105 <2> nop 106 <2> nop 107 <2> db 0 108 <2> Keyboard_lbl label near 109 <2> %endif 110 <2> 111 <2> 112 <2> 113 <2> 114 <2> push ax 115 <2> 116 <2> %ifidni %1, 02 117 <2> 118 <2> 119 <2> 120 <2> 121 <2> 122 <2> 123 <2> 124 <2> 125 <2> 126 <2> 127 <2> 128 <2> 129 <2> 130 <2> 131 <2> 132 <2> 133 <2> 134 <2> 135 <2> 136 <2> 137 <2> 138 <2> 139 <2> 140 <2> 141 <2> 142 <2> 143 <2> push es 144 <2> mov ax,0f000h 145 <2> mov es,ax 146 <2> assume es:nothing 147 <2> mdl_convert equ MDL_CONVERT 148 <2> cmp byte ptr [es:0fffeh],mdl_convert 149 <2> pop es 150 <2> assume es:nothing 151 <2> jne Normal%1 152 <2> 153 <2> in al,62h 154 <2> test al,80h 155 <2> jz Normal%1 156 <2> 157 <2> Special%1: 158 <2> pop ax 159 <2> jmp far [cs:Old%1] 160 <2> 161 <2> Normal%1: 162 <2> 163 <2> 164 <2> 165 <2> %endif 166 <2> 167 <2> push bp 168 <2> push es 169 <2> STACKS equ Stacks 170 <2> mov es, [cs:STACKS+2] 171 <2> assume es:STACKSCODE 172 <2> 173 <2> mov bp,[cs:NextEntry] 174 <2> Allocated equ allocated 175 <2> mov al,Allocated 176 <2> xchg [AllocByte],al 177 <2> cmp al,Free 178 <2> jne NotFree%1 179 <2> 180 <2> sub word [cs:NextEntry],EntrySize 181 <2> 182 <2> Found%1: 183 <2> mov [SavedSP],sp 184 <2> mov [SavedSS],ss 185 <2> 186 <2> 187 <2> mov ax,bp 188 <2> 189 <2> mov bp,[NewSP] 190 <2> cmp [es:bp],ax 191 <2> jne FoundBad%1 192 <2> 193 <2> mov ax,es 194 <2> mov ss,ax 195 <2> mov sp,bp 196 <2> assume ss:STACKSCODE 197 <2> 198 <2> pushf 199 <2> call far [cs:Old%1] 200 <2> 201 <2> mov bp,sp 202 <2> mov bp,[es:bp] 203 <2> mov ss,[SavedSS] 204 <2> mov sp,[SavedSP] 205 <2> assume ss:nothing 206 <2> 207 <2> 208 <2> 209 <2> 210 <2> mov byte [AllocByte],Free 211 <2> mov [cs:NextEntry],bp 212 <2> 213 <2> NewError%1: 214 <2> pop es 215 <2> assume es:nothing 216 <2> pop bp 217 <2> pop ax 218 <2> 219 <2> INTRET_%1: 220 <2> iret 221 <2> Intret_%1 equ INTRET_%1 222 <2> 223 <2> NotFree%1: 224 <2> cmp al,Allocated 225 <2> je FindNext%1 226 <2> xchg [AllocByte],al 227 <2> 228 <2> FindNext%1: 229 <2> LongPath equ longpath 230 <2> call LongPath 231 <2> jmp Found%1 232 <2> 233 <2> FoundBad%1: 234 <2> cmp bp,[cs:FirstEntry] 235 <2> jc FindNext%1 236 <2> mov bp,ax 237 <2> Clobbered equ clobbered 238 <2> mov byte [AllocByte],Clobbered 239 <2> 240 <2> 241 <2> 242 <2> jmp FindNext%1 243 <2> 244 <2> int%1 endp 245 <2> %rotate 1 246 <2> %endrep 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 0 00000012 00000000 Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 87 <3> jmp short Entry_Int%1_Stk 88 <3> Old%1 dd 0 89 <3> dw 424Bh 90 <3> FirstFlag%1 db 0 91 <3> jmp short Intret_%1 92 <3> db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 00000016 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 0 00000017 06 push es 0 00000018 B800F0 mov ax,0f000h 0 0000001B 8EC0 mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 0 0000001D 26803EFEFFF9 cmp byte ptr [es:0fffeh],mdl_convert 0 00000023 07 pop es 150 <3> assume es:nothing 0 00000024 750C jne Normal%1 152 <3> 0 00000026 E462 in al,62h 0 00000028 A880 test al,80h 0 0000002A 7406 jz Normal%1 156 <3> 157 <3> Special%1: 0 0000002C 58 pop ax 0 0000002D 2EFF2E[1200] jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 00000032 55 push bp 0 00000033 06 push es 169 <3> STACKS equ Stacks 0 00000034 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000039 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 0000003E B001 mov al,Allocated 0 00000040 26864600 xchg [AllocByte],al 0 00000044 3C00 cmp al,Free 0 00000046 7542 jne NotFree%1 179 <3> 0 00000048 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 0000004E 26896602 mov [SavedSP],sp 0 00000052 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000056 89E8 mov ax,bp 188 <3> 0 00000058 268B6E06 mov bp,[NewSP] 0 0000005C 26394600 cmp [es:bp],ax 0 00000060 7535 jne FoundBad%1 192 <3> 0 00000062 8CC0 mov ax,es 0 00000064 8ED0 mov ss,ax 0 00000066 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 00000068 9C pushf 0 00000069 2EFF1E[1200] call far [cs:Old%1] 200 <3> 0 0000006E 89E5 mov bp,sp 0 00000070 268B6E00 mov bp,[es:bp] 0 00000074 268E5604 mov ss,[SavedSS] 0 00000078 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 0000007C 26C6460000 mov byte [AllocByte],Free 0 00000081 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000086 07 pop es 215 <3> assume es:nothing 0 00000087 5D pop bp 0 00000088 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 00000089 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 0000008A 3C01 cmp al,Allocated 0 0000008C 7404 je FindNext%1 0 0000008E 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000092 E8D506 call LongPath 0 00000095 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 00000097 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000009C 72F4 jc FindNext%1 0 0000009E 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 000000A0 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 000000A5 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 0 000000A7 00000000 Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 87 <3> jmp short Entry_Int%1_Stk 88 <3> Old%1 dd 0 89 <3> dw 424Bh 90 <3> FirstFlag%1 db 0 91 <3> jmp short Intret_%1 92 <3> db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000000AB 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000000AC 55 push bp 0 000000AD 06 push es 169 <3> STACKS equ Stacks 0 000000AE 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000000B3 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 000000B8 B001 mov al,Allocated 0 000000BA 26864600 xchg [AllocByte],al 0 000000BE 3C00 cmp al,Free 0 000000C0 7542 jne NotFree%1 179 <3> 0 000000C2 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 000000C8 26896602 mov [SavedSP],sp 0 000000CC 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 000000D0 89E8 mov ax,bp 188 <3> 0 000000D2 268B6E06 mov bp,[NewSP] 0 000000D6 26394600 cmp [es:bp],ax 0 000000DA 7535 jne FoundBad%1 192 <3> 0 000000DC 8CC0 mov ax,es 0 000000DE 8ED0 mov ss,ax 0 000000E0 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 000000E2 9C pushf 0 000000E3 2EFF1E[A700] call far [cs:Old%1] 200 <3> 0 000000E8 89E5 mov bp,sp 0 000000EA 268B6E00 mov bp,[es:bp] 0 000000EE 268E5604 mov ss,[SavedSS] 0 000000F2 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 000000F6 26C6460000 mov byte [AllocByte],Free 0 000000FB 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000100 07 pop es 215 <3> assume es:nothing 0 00000101 5D pop bp 0 00000102 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 00000103 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 00000104 3C01 cmp al,Allocated 0 00000106 7404 je FindNext%1 0 00000108 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 0000010C E85B06 call LongPath 0 0000010F EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 00000111 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 00000116 72F4 jc FindNext%1 0 00000118 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 0000011A 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 0000011F EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 0 00000121 00000000 Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 87 <3> jmp short Entry_Int%1_Stk 88 <3> Old%1 dd 0 89 <3> dw 424Bh 90 <3> FirstFlag%1 db 0 91 <3> jmp short Intret_%1 92 <3> db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 0 00000125 EB03 jmp short Keyboard_lbl 0 00000127 90 nop 0 00000128 90 nop 0 00000129 00 db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 0000012A 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 0000012B 55 push bp 0 0000012C 06 push es 169 <3> STACKS equ Stacks 0 0000012D 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000132 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000137 B001 mov al,Allocated 0 00000139 26864600 xchg [AllocByte],al 0 0000013D 3C00 cmp al,Free 0 0000013F 7542 jne NotFree%1 179 <3> 0 00000141 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000147 26896602 mov [SavedSP],sp 0 0000014B 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 0000014F 89E8 mov ax,bp 188 <3> 0 00000151 268B6E06 mov bp,[NewSP] 0 00000155 26394600 cmp [es:bp],ax 0 00000159 7535 jne FoundBad%1 192 <3> 0 0000015B 8CC0 mov ax,es 0 0000015D 8ED0 mov ss,ax 0 0000015F 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 00000161 9C pushf 0 00000162 2EFF1E[2101] call far [cs:Old%1] 200 <3> 0 00000167 89E5 mov bp,sp 0 00000169 268B6E00 mov bp,[es:bp] 0 0000016D 268E5604 mov ss,[SavedSS] 0 00000171 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 00000175 26C6460000 mov byte [AllocByte],Free 0 0000017A 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 0000017F 07 pop es 215 <3> assume es:nothing 0 00000180 5D pop bp 0 00000181 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 00000182 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 00000183 3C01 cmp al,Allocated 0 00000185 7404 je FindNext%1 0 00000187 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 0000018B E8DC05 call LongPath 0 0000018E EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 00000190 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 00000195 72F4 jc FindNext%1 0 00000197 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000199 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 0000019E EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 0 000001A0 00000000 Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 87 <3> jmp short Entry_Int%1_Stk 88 <3> Old%1 dd 0 89 <3> dw 424Bh 90 <3> FirstFlag%1 db 0 91 <3> jmp short Intret_%1 92 <3> db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000001A4 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000001A5 55 push bp 0 000001A6 06 push es 169 <3> STACKS equ Stacks 0 000001A7 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000001AC 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 000001B1 B001 mov al,Allocated 0 000001B3 26864600 xchg [AllocByte],al 0 000001B7 3C00 cmp al,Free 0 000001B9 7542 jne NotFree%1 179 <3> 0 000001BB 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 000001C1 26896602 mov [SavedSP],sp 0 000001C5 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 000001C9 89E8 mov ax,bp 188 <3> 0 000001CB 268B6E06 mov bp,[NewSP] 0 000001CF 26394600 cmp [es:bp],ax 0 000001D3 7535 jne FoundBad%1 192 <3> 0 000001D5 8CC0 mov ax,es 0 000001D7 8ED0 mov ss,ax 0 000001D9 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 000001DB 9C pushf 0 000001DC 2EFF1E[A001] call far [cs:Old%1] 200 <3> 0 000001E1 89E5 mov bp,sp 0 000001E3 268B6E00 mov bp,[es:bp] 0 000001E7 268E5604 mov ss,[SavedSS] 0 000001EB 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 000001EF 26C6460000 mov byte [AllocByte],Free 0 000001F4 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 000001F9 07 pop es 215 <3> assume es:nothing 0 000001FA 5D pop bp 0 000001FB 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 000001FC CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 000001FD 3C01 cmp al,Allocated 0 000001FF 7404 je FindNext%1 0 00000201 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000205 E86205 call LongPath 0 00000208 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 0000020A 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000020F 72F4 jc FindNext%1 0 00000211 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000213 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 00000218 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 256 <1> 257 <1> %iassign IntSharingFlag 1 258 <1> Stack_Main 0A,0B,0C,0D,0E,72,73,74,76,77 71 <2> %rep %0 72 <2> ASSUME DS:NOTHING 73 <2> ASSUME ES:NOTHING 74 <2> ASSUME SS:NOTHING 75 <2> PUBLIC Int%1 76 <2> PUBLIC Old%1 77 <2> 78 <2> %ifn IntSharingFlag 79 <2> 80 <2> Old%1 DD 0 81 <2> Int%1 PROC FAR 82 <2> 83 <2> %else 84 <2> 85 <2> PUBLIC FirstFlag%1 86 <2> Int%1 PROC FAR 87 <2> jmp short Entry_Int%1_Stk 88 <2> Old%1 dd 0 89 <2> dw 424Bh 90 <2> FirstFlag%1 db 0 91 <2> jmp short Intret_%1 92 <2> db 7 dup (0) 93 <2> Entry_Int%1_Stk: 94 <2> 95 <2> %endif 96 <2> 97 <2> INT%1 equ Int%1 98 <2> OLD%1 equ Old%1 99 <2> 100 <2> 101 <2> 102 <2> 103 <2> %ifidni %1, 09 104 <2> jmp short Keyboard_lbl 105 <2> nop 106 <2> nop 107 <2> db 0 108 <2> Keyboard_lbl label near 109 <2> %endif 110 <2> 111 <2> 112 <2> 113 <2> 114 <2> push ax 115 <2> 116 <2> %ifidni %1, 02 117 <2> 118 <2> 119 <2> 120 <2> 121 <2> 122 <2> 123 <2> 124 <2> 125 <2> 126 <2> 127 <2> 128 <2> 129 <2> 130 <2> 131 <2> 132 <2> 133 <2> 134 <2> 135 <2> 136 <2> 137 <2> 138 <2> 139 <2> 140 <2> 141 <2> 142 <2> 143 <2> push es 144 <2> mov ax,0f000h 145 <2> mov es,ax 146 <2> assume es:nothing 147 <2> mdl_convert equ MDL_CONVERT 148 <2> cmp byte ptr [es:0fffeh],mdl_convert 149 <2> pop es 150 <2> assume es:nothing 151 <2> jne Normal%1 152 <2> 153 <2> in al,62h 154 <2> test al,80h 155 <2> jz Normal%1 156 <2> 157 <2> Special%1: 158 <2> pop ax 159 <2> jmp far [cs:Old%1] 160 <2> 161 <2> Normal%1: 162 <2> 163 <2> 164 <2> 165 <2> %endif 166 <2> 167 <2> push bp 168 <2> push es 169 <2> STACKS equ Stacks 170 <2> mov es, [cs:STACKS+2] 171 <2> assume es:STACKSCODE 172 <2> 173 <2> mov bp,[cs:NextEntry] 174 <2> Allocated equ allocated 175 <2> mov al,Allocated 176 <2> xchg [AllocByte],al 177 <2> cmp al,Free 178 <2> jne NotFree%1 179 <2> 180 <2> sub word [cs:NextEntry],EntrySize 181 <2> 182 <2> Found%1: 183 <2> mov [SavedSP],sp 184 <2> mov [SavedSS],ss 185 <2> 186 <2> 187 <2> mov ax,bp 188 <2> 189 <2> mov bp,[NewSP] 190 <2> cmp [es:bp],ax 191 <2> jne FoundBad%1 192 <2> 193 <2> mov ax,es 194 <2> mov ss,ax 195 <2> mov sp,bp 196 <2> assume ss:STACKSCODE 197 <2> 198 <2> pushf 199 <2> call far [cs:Old%1] 200 <2> 201 <2> mov bp,sp 202 <2> mov bp,[es:bp] 203 <2> mov ss,[SavedSS] 204 <2> mov sp,[SavedSP] 205 <2> assume ss:nothing 206 <2> 207 <2> 208 <2> 209 <2> 210 <2> mov byte [AllocByte],Free 211 <2> mov [cs:NextEntry],bp 212 <2> 213 <2> NewError%1: 214 <2> pop es 215 <2> assume es:nothing 216 <2> pop bp 217 <2> pop ax 218 <2> 219 <2> INTRET_%1: 220 <2> iret 221 <2> Intret_%1 equ INTRET_%1 222 <2> 223 <2> NotFree%1: 224 <2> cmp al,Allocated 225 <2> je FindNext%1 226 <2> xchg [AllocByte],al 227 <2> 228 <2> FindNext%1: 229 <2> LongPath equ longpath 230 <2> call LongPath 231 <2> jmp Found%1 232 <2> 233 <2> FoundBad%1: 234 <2> cmp bp,[cs:FirstEntry] 235 <2> jc FindNext%1 236 <2> mov bp,ax 237 <2> Clobbered equ clobbered 238 <2> mov byte [AllocByte],Clobbered 239 <2> 240 <2> 241 <2> 242 <2> jmp FindNext%1 243 <2> 244 <2> int%1 endp 245 <2> %rotate 1 246 <2> %endrep 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 0000021A EB10 jmp short Entry_Int%1_Stk 0 0000021C 00000000 Old%1 dd 0 0 00000220 4B42 dw 424Bh 0 00000222 00 FirstFlag%1 db 0 0 00000223 EB5F jmp short Intret_%1 0 00000225 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 0000022C 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 0000022D 55 push bp 0 0000022E 06 push es 169 <3> STACKS equ Stacks 0 0000022F 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000234 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000239 B001 mov al,Allocated 0 0000023B 26864600 xchg [AllocByte],al 0 0000023F 3C00 cmp al,Free 0 00000241 7542 jne NotFree%1 179 <3> 0 00000243 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000249 26896602 mov [SavedSP],sp 0 0000024D 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000251 89E8 mov ax,bp 188 <3> 0 00000253 268B6E06 mov bp,[NewSP] 0 00000257 26394600 cmp [es:bp],ax 0 0000025B 7535 jne FoundBad%1 192 <3> 0 0000025D 8CC0 mov ax,es 0 0000025F 8ED0 mov ss,ax 0 00000261 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 00000263 9C pushf 0 00000264 2EFF1E[1C02] call far [cs:Old%1] 200 <3> 0 00000269 89E5 mov bp,sp 0 0000026B 268B6E00 mov bp,[es:bp] 0 0000026F 268E5604 mov ss,[SavedSS] 0 00000273 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 00000277 26C6460000 mov byte [AllocByte],Free 0 0000027C 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000281 07 pop es 215 <3> assume es:nothing 0 00000282 5D pop bp 0 00000283 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 00000284 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 00000285 3C01 cmp al,Allocated 0 00000287 7404 je FindNext%1 0 00000289 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 0000028D E8DA04 call LongPath 0 00000290 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 00000292 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 00000297 72F4 jc FindNext%1 0 00000299 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 0000029B 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 000002A0 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 000002A2 EB10 jmp short Entry_Int%1_Stk 0 000002A4 00000000 Old%1 dd 0 0 000002A8 4B42 dw 424Bh 0 000002AA 00 FirstFlag%1 db 0 0 000002AB EB5F jmp short Intret_%1 0 000002AD 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000002B4 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000002B5 55 push bp 0 000002B6 06 push es 169 <3> STACKS equ Stacks 0 000002B7 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000002BC 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 000002C1 B001 mov al,Allocated 0 000002C3 26864600 xchg [AllocByte],al 0 000002C7 3C00 cmp al,Free 0 000002C9 7542 jne NotFree%1 179 <3> 0 000002CB 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 000002D1 26896602 mov [SavedSP],sp 0 000002D5 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 000002D9 89E8 mov ax,bp 188 <3> 0 000002DB 268B6E06 mov bp,[NewSP] 0 000002DF 26394600 cmp [es:bp],ax 0 000002E3 7535 jne FoundBad%1 192 <3> 0 000002E5 8CC0 mov ax,es 0 000002E7 8ED0 mov ss,ax 0 000002E9 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 000002EB 9C pushf 0 000002EC 2EFF1E[A402] call far [cs:Old%1] 200 <3> 0 000002F1 89E5 mov bp,sp 0 000002F3 268B6E00 mov bp,[es:bp] 0 000002F7 268E5604 mov ss,[SavedSS] 0 000002FB 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 000002FF 26C6460000 mov byte [AllocByte],Free 0 00000304 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000309 07 pop es 215 <3> assume es:nothing 0 0000030A 5D pop bp 0 0000030B 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 0000030C CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 0000030D 3C01 cmp al,Allocated 0 0000030F 7404 je FindNext%1 0 00000311 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000315 E85204 call LongPath 0 00000318 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 0000031A 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000031F 72F4 jc FindNext%1 0 00000321 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000323 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 00000328 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 0000032A EB10 jmp short Entry_Int%1_Stk 0 0000032C 00000000 Old%1 dd 0 0 00000330 4B42 dw 424Bh 0 00000332 00 FirstFlag%1 db 0 0 00000333 EB5F jmp short Intret_%1 0 00000335 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 0000033C 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 0000033D 55 push bp 0 0000033E 06 push es 169 <3> STACKS equ Stacks 0 0000033F 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000344 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000349 B001 mov al,Allocated 0 0000034B 26864600 xchg [AllocByte],al 0 0000034F 3C00 cmp al,Free 0 00000351 7542 jne NotFree%1 179 <3> 0 00000353 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000359 26896602 mov [SavedSP],sp 0 0000035D 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000361 89E8 mov ax,bp 188 <3> 0 00000363 268B6E06 mov bp,[NewSP] 0 00000367 26394600 cmp [es:bp],ax 0 0000036B 7535 jne FoundBad%1 192 <3> 0 0000036D 8CC0 mov ax,es 0 0000036F 8ED0 mov ss,ax 0 00000371 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 00000373 9C pushf 0 00000374 2EFF1E[2C03] call far [cs:Old%1] 200 <3> 0 00000379 89E5 mov bp,sp 0 0000037B 268B6E00 mov bp,[es:bp] 0 0000037F 268E5604 mov ss,[SavedSS] 0 00000383 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 00000387 26C6460000 mov byte [AllocByte],Free 0 0000038C 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000391 07 pop es 215 <3> assume es:nothing 0 00000392 5D pop bp 0 00000393 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 00000394 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 00000395 3C01 cmp al,Allocated 0 00000397 7404 je FindNext%1 0 00000399 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 0000039D E8CA03 call LongPath 0 000003A0 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 000003A2 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 000003A7 72F4 jc FindNext%1 0 000003A9 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 000003AB 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 000003B0 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 000003B2 EB10 jmp short Entry_Int%1_Stk 0 000003B4 00000000 Old%1 dd 0 0 000003B8 4B42 dw 424Bh 0 000003BA 00 FirstFlag%1 db 0 0 000003BB EB5F jmp short Intret_%1 0 000003BD 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000003C4 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000003C5 55 push bp 0 000003C6 06 push es 169 <3> STACKS equ Stacks 0 000003C7 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000003CC 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 000003D1 B001 mov al,Allocated 0 000003D3 26864600 xchg [AllocByte],al 0 000003D7 3C00 cmp al,Free 0 000003D9 7542 jne NotFree%1 179 <3> 0 000003DB 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 000003E1 26896602 mov [SavedSP],sp 0 000003E5 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 000003E9 89E8 mov ax,bp 188 <3> 0 000003EB 268B6E06 mov bp,[NewSP] 0 000003EF 26394600 cmp [es:bp],ax 0 000003F3 7535 jne FoundBad%1 192 <3> 0 000003F5 8CC0 mov ax,es 0 000003F7 8ED0 mov ss,ax 0 000003F9 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 000003FB 9C pushf 0 000003FC 2EFF1E[B403] call far [cs:Old%1] 200 <3> 0 00000401 89E5 mov bp,sp 0 00000403 268B6E00 mov bp,[es:bp] 0 00000407 268E5604 mov ss,[SavedSS] 0 0000040B 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 0000040F 26C6460000 mov byte [AllocByte],Free 0 00000414 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000419 07 pop es 215 <3> assume es:nothing 0 0000041A 5D pop bp 0 0000041B 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 0000041C CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 0000041D 3C01 cmp al,Allocated 0 0000041F 7404 je FindNext%1 0 00000421 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000425 E84203 call LongPath 0 00000428 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 0000042A 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000042F 72F4 jc FindNext%1 0 00000431 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000433 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 00000438 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 0000043A EB10 jmp short Entry_Int%1_Stk 0 0000043C 00000000 Old%1 dd 0 0 00000440 4B42 dw 424Bh 0 00000442 00 FirstFlag%1 db 0 0 00000443 EB5F jmp short Intret_%1 0 00000445 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 0000044C 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 0000044D 55 push bp 0 0000044E 06 push es 169 <3> STACKS equ Stacks 0 0000044F 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000454 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000459 B001 mov al,Allocated 0 0000045B 26864600 xchg [AllocByte],al 0 0000045F 3C00 cmp al,Free 0 00000461 7542 jne NotFree%1 179 <3> 0 00000463 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000469 26896602 mov [SavedSP],sp 0 0000046D 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000471 89E8 mov ax,bp 188 <3> 0 00000473 268B6E06 mov bp,[NewSP] 0 00000477 26394600 cmp [es:bp],ax 0 0000047B 7535 jne FoundBad%1 192 <3> 0 0000047D 8CC0 mov ax,es 0 0000047F 8ED0 mov ss,ax 0 00000481 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 00000483 9C pushf 0 00000484 2EFF1E[3C04] call far [cs:Old%1] 200 <3> 0 00000489 89E5 mov bp,sp 0 0000048B 268B6E00 mov bp,[es:bp] 0 0000048F 268E5604 mov ss,[SavedSS] 0 00000493 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 00000497 26C6460000 mov byte [AllocByte],Free 0 0000049C 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 000004A1 07 pop es 215 <3> assume es:nothing 0 000004A2 5D pop bp 0 000004A3 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 000004A4 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 000004A5 3C01 cmp al,Allocated 0 000004A7 7404 je FindNext%1 0 000004A9 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 000004AD E8BA02 call LongPath 0 000004B0 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 000004B2 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 000004B7 72F4 jc FindNext%1 0 000004B9 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 000004BB 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 000004C0 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 000004C2 EB10 jmp short Entry_Int%1_Stk 0 000004C4 00000000 Old%1 dd 0 0 000004C8 4B42 dw 424Bh 0 000004CA 00 FirstFlag%1 db 0 0 000004CB EB5F jmp short Intret_%1 0 000004CD 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000004D4 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000004D5 55 push bp 0 000004D6 06 push es 169 <3> STACKS equ Stacks 0 000004D7 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000004DC 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 000004E1 B001 mov al,Allocated 0 000004E3 26864600 xchg [AllocByte],al 0 000004E7 3C00 cmp al,Free 0 000004E9 7542 jne NotFree%1 179 <3> 0 000004EB 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 000004F1 26896602 mov [SavedSP],sp 0 000004F5 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 000004F9 89E8 mov ax,bp 188 <3> 0 000004FB 268B6E06 mov bp,[NewSP] 0 000004FF 26394600 cmp [es:bp],ax 0 00000503 7535 jne FoundBad%1 192 <3> 0 00000505 8CC0 mov ax,es 0 00000507 8ED0 mov ss,ax 0 00000509 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 0000050B 9C pushf 0 0000050C 2EFF1E[C404] call far [cs:Old%1] 200 <3> 0 00000511 89E5 mov bp,sp 0 00000513 268B6E00 mov bp,[es:bp] 0 00000517 268E5604 mov ss,[SavedSS] 0 0000051B 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 0000051F 26C6460000 mov byte [AllocByte],Free 0 00000524 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000529 07 pop es 215 <3> assume es:nothing 0 0000052A 5D pop bp 0 0000052B 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 0000052C CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 0000052D 3C01 cmp al,Allocated 0 0000052F 7404 je FindNext%1 0 00000531 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000535 E83202 call LongPath 0 00000538 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 0000053A 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000053F 72F4 jc FindNext%1 0 00000541 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000543 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 00000548 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 0000054A EB10 jmp short Entry_Int%1_Stk 0 0000054C 00000000 Old%1 dd 0 0 00000550 4B42 dw 424Bh 0 00000552 00 FirstFlag%1 db 0 0 00000553 EB5F jmp short Intret_%1 0 00000555 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 0000055C 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 0000055D 55 push bp 0 0000055E 06 push es 169 <3> STACKS equ Stacks 0 0000055F 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000564 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000569 B001 mov al,Allocated 0 0000056B 26864600 xchg [AllocByte],al 0 0000056F 3C00 cmp al,Free 0 00000571 7542 jne NotFree%1 179 <3> 0 00000573 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000579 26896602 mov [SavedSP],sp 0 0000057D 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000581 89E8 mov ax,bp 188 <3> 0 00000583 268B6E06 mov bp,[NewSP] 0 00000587 26394600 cmp [es:bp],ax 0 0000058B 7535 jne FoundBad%1 192 <3> 0 0000058D 8CC0 mov ax,es 0 0000058F 8ED0 mov ss,ax 0 00000591 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 00000593 9C pushf 0 00000594 2EFF1E[4C05] call far [cs:Old%1] 200 <3> 0 00000599 89E5 mov bp,sp 0 0000059B 268B6E00 mov bp,[es:bp] 0 0000059F 268E5604 mov ss,[SavedSS] 0 000005A3 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 000005A7 26C6460000 mov byte [AllocByte],Free 0 000005AC 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 000005B1 07 pop es 215 <3> assume es:nothing 0 000005B2 5D pop bp 0 000005B3 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 000005B4 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 000005B5 3C01 cmp al,Allocated 0 000005B7 7404 je FindNext%1 0 000005B9 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 000005BD E8AA01 call LongPath 0 000005C0 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 000005C2 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 000005C7 72F4 jc FindNext%1 0 000005C9 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 000005CB 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 000005D0 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 000005D2 EB10 jmp short Entry_Int%1_Stk 0 000005D4 00000000 Old%1 dd 0 0 000005D8 4B42 dw 424Bh 0 000005DA 00 FirstFlag%1 db 0 0 000005DB EB5F jmp short Intret_%1 0 000005DD 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000005E4 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000005E5 55 push bp 0 000005E6 06 push es 169 <3> STACKS equ Stacks 0 000005E7 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000005EC 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 000005F1 B001 mov al,Allocated 0 000005F3 26864600 xchg [AllocByte],al 0 000005F7 3C00 cmp al,Free 0 000005F9 7542 jne NotFree%1 179 <3> 0 000005FB 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000601 26896602 mov [SavedSP],sp 0 00000605 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000609 89E8 mov ax,bp 188 <3> 0 0000060B 268B6E06 mov bp,[NewSP] 0 0000060F 26394600 cmp [es:bp],ax 0 00000613 7535 jne FoundBad%1 192 <3> 0 00000615 8CC0 mov ax,es 0 00000617 8ED0 mov ss,ax 0 00000619 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 0000061B 9C pushf 0 0000061C 2EFF1E[D405] call far [cs:Old%1] 200 <3> 0 00000621 89E5 mov bp,sp 0 00000623 268B6E00 mov bp,[es:bp] 0 00000627 268E5604 mov ss,[SavedSS] 0 0000062B 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 0000062F 26C6460000 mov byte [AllocByte],Free 0 00000634 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000639 07 pop es 215 <3> assume es:nothing 0 0000063A 5D pop bp 0 0000063B 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 0000063C CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 0000063D 3C01 cmp al,Allocated 0 0000063F 7404 je FindNext%1 0 00000641 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000645 E82201 call LongPath 0 00000648 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 0000064A 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000064F 72F4 jc FindNext%1 0 00000651 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000653 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 00000658 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 0000065A EB10 jmp short Entry_Int%1_Stk 0 0000065C 00000000 Old%1 dd 0 0 00000660 4B42 dw 424Bh 0 00000662 00 FirstFlag%1 db 0 0 00000663 EB5F jmp short Intret_%1 0 00000665 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 0000066C 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 0000066D 55 push bp 0 0000066E 06 push es 169 <3> STACKS equ Stacks 0 0000066F 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 00000674 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000679 B001 mov al,Allocated 0 0000067B 26864600 xchg [AllocByte],al 0 0000067F 3C00 cmp al,Free 0 00000681 7542 jne NotFree%1 179 <3> 0 00000683 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000689 26896602 mov [SavedSP],sp 0 0000068D 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000691 89E8 mov ax,bp 188 <3> 0 00000693 268B6E06 mov bp,[NewSP] 0 00000697 26394600 cmp [es:bp],ax 0 0000069B 7535 jne FoundBad%1 192 <3> 0 0000069D 8CC0 mov ax,es 0 0000069F 8ED0 mov ss,ax 0 000006A1 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 000006A3 9C pushf 0 000006A4 2EFF1E[5C06] call far [cs:Old%1] 200 <3> 0 000006A9 89E5 mov bp,sp 0 000006AB 268B6E00 mov bp,[es:bp] 0 000006AF 268E5604 mov ss,[SavedSS] 0 000006B3 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 000006B7 26C6460000 mov byte [AllocByte],Free 0 000006BC 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 000006C1 07 pop es 215 <3> assume es:nothing 0 000006C2 5D pop bp 0 000006C3 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 000006C4 CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 000006C5 3C01 cmp al,Allocated 0 000006C7 7404 je FindNext%1 0 000006C9 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 000006CD E89A00 call LongPath 0 000006D0 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 000006D2 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 000006D7 72F4 jc FindNext%1 0 000006D9 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 000006DB 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 000006E0 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 72 <3> ASSUME DS:NOTHING 73 <3> ASSUME ES:NOTHING 74 <3> ASSUME SS:NOTHING 75 <3> PUBLIC Int%1 76 <3> PUBLIC Old%1 77 <3> 78 <3> %ifn IntSharingFlag 79 <3> 80 <3> Old%1 DD 0 81 <3> Int%1 PROC FAR 82 <3> 83 <3> %else 84 <3> 85 <3> PUBLIC FirstFlag%1 86 <3> Int%1 PROC FAR 0 000006E2 EB10 jmp short Entry_Int%1_Stk 0 000006E4 00000000 Old%1 dd 0 0 000006E8 4B42 dw 424Bh 0 000006EA 00 FirstFlag%1 db 0 0 000006EB EB5F jmp short Intret_%1 0 000006ED 00000000000000 db 7 dup (0) 93 <3> Entry_Int%1_Stk: 94 <3> 95 <3> %endif 96 <3> 97 <3> INT%1 equ Int%1 98 <3> OLD%1 equ Old%1 99 <3> 100 <3> 101 <3> 102 <3> 103 <3> %ifidni %1, 09 104 <3> jmp short Keyboard_lbl 105 <3> nop 106 <3> nop 107 <3> db 0 108 <3> Keyboard_lbl label near 109 <3> %endif 110 <3> 111 <3> 112 <3> 113 <3> 0 000006F4 50 push ax 115 <3> 116 <3> %ifidni %1, 02 117 <3> 118 <3> 119 <3> 120 <3> 121 <3> 122 <3> 123 <3> 124 <3> 125 <3> 126 <3> 127 <3> 128 <3> 129 <3> 130 <3> 131 <3> 132 <3> 133 <3> 134 <3> 135 <3> 136 <3> 137 <3> 138 <3> 139 <3> 140 <3> 141 <3> 142 <3> 143 <3> push es 144 <3> mov ax,0f000h 145 <3> mov es,ax 146 <3> assume es:nothing 147 <3> mdl_convert equ MDL_CONVERT 148 <3> cmp byte ptr [es:0fffeh],mdl_convert 149 <3> pop es 150 <3> assume es:nothing 151 <3> jne Normal%1 152 <3> 153 <3> in al,62h 154 <3> test al,80h 155 <3> jz Normal%1 156 <3> 157 <3> Special%1: 158 <3> pop ax 159 <3> jmp far [cs:Old%1] 160 <3> 161 <3> Normal%1: 162 <3> 163 <3> 164 <3> 165 <3> %endif 166 <3> 0 000006F5 55 push bp 0 000006F6 06 push es 169 <3> STACKS equ Stacks 0 000006F7 2E8E06[0A00] mov es, [cs:STACKS+2] 171 <3> assume es:STACKSCODE 172 <3> 0 000006FC 2E8B2E[1000] mov bp,[cs:NextEntry] 174 <3> Allocated equ allocated 0 00000701 B001 mov al,Allocated 0 00000703 26864600 xchg [AllocByte],al 0 00000707 3C00 cmp al,Free 0 00000709 7542 jne NotFree%1 179 <3> 0 0000070B 2E832E[1000]08 sub word [cs:NextEntry],EntrySize 181 <3> 182 <3> Found%1: 0 00000711 26896602 mov [SavedSP],sp 0 00000715 268C5604 mov [SavedSS],ss 185 <3> 186 <3> 0 00000719 89E8 mov ax,bp 188 <3> 0 0000071B 268B6E06 mov bp,[NewSP] 0 0000071F 26394600 cmp [es:bp],ax 0 00000723 7535 jne FoundBad%1 192 <3> 0 00000725 8CC0 mov ax,es 0 00000727 8ED0 mov ss,ax 0 00000729 89EC mov sp,bp 196 <3> assume ss:STACKSCODE 197 <3> 0 0000072B 9C pushf 0 0000072C 2EFF1E[E406] call far [cs:Old%1] 200 <3> 0 00000731 89E5 mov bp,sp 0 00000733 268B6E00 mov bp,[es:bp] 0 00000737 268E5604 mov ss,[SavedSS] 0 0000073B 268B6602 mov sp,[SavedSP] 205 <3> assume ss:nothing 206 <3> 207 <3> 208 <3> 209 <3> 0 0000073F 26C6460000 mov byte [AllocByte],Free 0 00000744 2E892E[1000] mov [cs:NextEntry],bp 212 <3> 213 <3> NewError%1: 0 00000749 07 pop es 215 <3> assume es:nothing 0 0000074A 5D pop bp 0 0000074B 58 pop ax 218 <3> 219 <3> INTRET_%1: 0 0000074C CF iret 221 <3> Intret_%1 equ INTRET_%1 222 <3> 223 <3> NotFree%1: 0 0000074D 3C01 cmp al,Allocated 0 0000074F 7404 je FindNext%1 0 00000751 26864600 xchg [AllocByte],al 227 <3> 228 <3> FindNext%1: 229 <3> LongPath equ longpath 0 00000755 E81200 call LongPath 0 00000758 EBB7 jmp Found%1 232 <3> 233 <3> FoundBad%1: 0 0000075A 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 0 0000075F 72F4 jc FindNext%1 0 00000761 89C5 mov bp,ax 237 <3> Clobbered equ clobbered 0 00000763 26C6460003 mov byte [AllocByte],Clobbered 239 <3> 240 <3> 241 <3> 0 00000768 EBEB jmp FindNext%1 243 <3> 244 <3> int%1 endp 245 <3> %rotate 1 259 <1> 260 <1> ;******************************************************************** ;3.30 261 <1> ;Common routines ;3.30 262 <1> 263 <1> longpath: 0 0000076A 2E8B2E[0E00] mov bp,[cs:LastEntry] ; start with last entry in table 265 <1> 266 <1> LPLOOPP: ;3.30 0 0000076F 26807E0000 cmp byte [AllocByte],Free ; is entry free? 0 00000774 7512 jne .inuse ; no, try next one 269 <1> 0 00000776 B001 mov al,Allocated 0 00000778 26864600 xchg [AllocByte],al ; allocate entry 0 0000077C 3C00 cmp al,Free ; is it still free? 0 0000077E 7414 je .found ; yes, go use it 274 <1> 0 00000780 3C01 cmp al,Allocated ; is it other than Allocated or Free? 0 00000782 7404 je .inuse ; no, check the next one 277 <1> 0 00000784 26884600 mov [AllocByte],al ; yes, put back the error state 279 <1> 280 <1> .inuse: 0 00000788 2E3B2E[0C00] cmp bp,[cs:FirstEntry] 282 <1> stack_Fatal equ stack_fatal ; NASM port label 0 0000078D 7406 je stack_Fatal 0 0000078F 83ED08 sub bp,EntrySize 0 00000792 EBDB JMP LPLOOPP ;3.30 286 <1> 287 <1> .found: 0 00000794 C3 ret 289 <1> 290 <1> ; page 291 <1> 292 <1> stack_fatal proc near 0 00000795 1E push ds ;3.30 0 00000796 B800F0 mov ax, 0f000h ;loook at the model byte ;3.30 0 00000799 8ED8 mov ds, ax 296 <1> assume ds:nothing 0 0000079B 803EFEFFF9 cmp byte ptr [0fffeh], mdl_convert ;convertible? ;3.30 0 000007A0 1F pop ds ;3.30 299 <1> assume ds:nothing 0 000007A1 7504 jne Skip_NMIS ;3.30 301 <1> ;3.30 0 000007A3 B007 mov al,07h ; disable PC Convertible NMIs 0 000007A5 E672 out 72h,al 304 <1> 305 <1> Skip_NMIS: ;3.30 0 000007A7 FA cli ; disable and mask 0 000007A8 B0FF mov al,0ffh ; all other ints 0 000007AA E621 out 021h,al 0 000007AC E6A1 out 0a1h,al 310 <1> 0 000007AE 8CCE mov si,cs 0 000007B0 8EDE mov ds,si 313 <1> assume ds:STACKSCODE 314 <1> fatal_msg equ FATAL_MSG ; NASM port label 0 000007B2 BE[C407] mov si,offset fatal_msg 316 <1> 317 <1> fatal_loop: 0 000007B5 AC lodsb 0 000007B6 3C24 cmp al,'$' 0 000007B8 7408 je fatal_done 321 <1> 0 000007BA B307 mov bl,7 ;3.30* 0 000007BC B40E mov ah,14 ;3.30* 0 000007BE CD10 int 010h ; whoops, this enables ints ;3.30* 0 000007C0 EBF3 jmp fatal_loop 326 <1> 327 <1> fatal_done: 0 000007C2 EBFE jmp fatal_done 329 <1> stack_fatal endp 330 <1> 331 <1> assume cs:SYSINITGROUP 266 ;=== Pop trace listing source 267 ; include STKMES.INC ;Fatal stack error message 268 ;=== Push trace listing source: msbio.cl5 269 %include "msbio.cl5" ;Fatal stack error message ; NASM included file 1 <1> ; msbio.cl5 2 <1> 3 <1> 4 <1> ;_______________________ 5 <1> 0 000007C4 0D0A070D0A496E7465 FATAL_MSG DB 0DH,0AH,7,0DH,0AH, "Internal stack overflow",0DH,0AH 0 000007CD 726E616C2073746163 0 000007D6 6B206F766572666C6F 0 000007DF 770D0A 0 000007E2 53797374656D206861 DB "System halted",0DH,0AH,"$" 0 000007EB 6C7465640D0A24 270 ;=== Pop trace listing source 271 ;.XALL 272 align 2, nop 273 public Endstackcode 274 Endstackcode label byte 275 %ENDIF 276 277 278 even 279 DOSINFO LABEL DWORD 0 000007F2 00000000 DW 0,0 281 282 ENTRY_POINT LABEL DWORD 0 000007F6 00000000 dw 0, 0 284 0 000007FA 0000 behind_dosentry_segment DW 0000 286 DEVICE_LIST: 0 000007FC [00FF][0000] dw CONHEADER - DOSENTRYDEVICEBASE * 16, seg CONHEADER + DOSENTRYDEVICEBASE 288 289 SYSI_Country LABEL DWORD ;J.K. 5/29/86 Pointer to 0 00000800 0000 DW 0000 ;country table in DOS 0 00000802 0000 DW 0000 292 0 00000804 00 Fake_Floppy_Drv db 0 ;AN001;Set to 1 if this machine 294 ;does not have any floppies!!! 0 00000805 00 Big_Media_Flag db 0 ;AN021;Set by IBMINIT if > 32 MB fixed media exist. 296 297 even 298 global sysinit_bootdrive_hidden, sysinit_bootdrive_unit 299 global sysinit_have_bootdrive_preliminary 300 global sysinit_have_bootdrive_exact 0 00000806 00000000 sysinit_bootdrive_hidden: dd 0 0 0000080A 00 sysinit_bootdrive_unit: db 0 0 0000080B 00 sysinit_have_bootdrive_preliminary: db 0 0 0000080C 00 sysinit_have_bootdrive_exact: db 0 305 306 global dosdata_relocate_first, dosdata_relocate_early 307 dosdata_relocated_to_final_position: 0 0000080D 00 db 0 0 0000080E 00 dosdata_relocate_first: db 0 0 0000080F 00 dosdata_relocate_early: db 0 311 doscode_relocated_to_final_position: 0 00000810 00 db 0 313 0 00000811 00 even 315 ; 316 ;Variables for Stack Initialization Program. 317 %IF STACKSW 0 00000812 0900 STACK_COUNT DW DefaultCount 0 00000814 8000 STACK_SIZE DW DefaultSize 0 00000816 00000000 STACK_ADDR DD 00000000 321 %ENDIF 322 ; various default values 323 0 0000081A 0100 MEMORY_SIZE DW 0001 0 0000081C 00 DEFAULT_DRIVE DB 00 ;initialized by IBMINIT. 0 0000081D FFFF BUFFERS DW -1 ; initialized during buffer allocation 0 0000081F 0000 H_Buffers dw 0 ;AN000; # of the Heuristic buffers. Initially 0. 328 %ifndef BUF2 329 Buffer_Pages dw 0 ;AN000; # of extended memory pages for the buffer. 330 BufferBuckets dw 0 ;AN000; 331 Buffer_odds dw 0 ;AN000; 332 %endif 0 00000821 ???? SingleBufferSize dw ? ;AN000; Maximum sector size + buffer header 334 %ifndef BUF2 335 MaxNumBuf1 db 15 ;AN026;Num of buffers in a bucket group 1. 336 MaxNumBuf2 db 15 ;AN026;Num of buffers in a possible bucket group 2. 337 NthBuck db 0 ;AN026; 1st bucket group = 1st bucket through Nth Bucket. The rest = second group 338 339 %IF BUFFERFLAG 340 341 FIRST_PAGE DW 0, 0 342 LAST_PAGE DW 0, 0 343 NPA640 DW 0 344 EMS_SAVE_BUF DB 0,0,0,0,0,0,0,0,0,0,0,0 345 346 %ENDIF 347 %endif 348 0 00000823 08 FILES DB 8 ; enough files for pipe 0 00000824 04 FCBS DB 4 ; performance for recycling 0 00000825 00 Keep DB 0 ; keep original set 0 00000826 05 NUM_CDS DB 5 ; 5 net drives 0 00000827 ???? config_block DW ? 0 00000829 0000 buffer_block: dw 0 0 0000082B 0000 altah_block: dw 0 0 0000082D 413A FOOSTRNG DB "A:" 0 0000082F 020050 COMMAND_LINE DB 2,0,"P" ;Default Command.com Args 0 00000832 000000000000000000 DB 29 DUP (0) 0 0000083B 000000000000000000 0 00000844 000000000000000000 0 0000084D 0000 0 0000084F 00 ZERO DB 0 0 00000850 00 SepChr DB 0 0 00000851 0000 LineCount dw 0 ;AN000; Line count in config.sys 0 00000853 20202020200D0A24 ShowCount db ' ',CR,LF,'$' ;AN000; Used to convert Linecount to ASCII. 0 0000085B 0000 Buffer_LineNum dw 0 ;AN000; Line count for "BUFFERS=" command if entered. 364 0 0000085D FF Sys_Model_Byte db 0FFh ;model byte used in SYSINIT 0 0000085E 00 Sys_Scnd_Model_Byte db 0 ;secondary model byte used in SYSINIT 367 ; 0 0000085F 00 Buffer_Slash_X db 0 ;AN000;AN023; BUFFERS= ... /X option entered. 369 %ifndef BUF2 370 Real_IBM_Page_Id dw 0 ;AN029; 371 IBM_Frame_Seg dw 0 ;AN000; segment value for physical IBM page frame. 372 Frame_Info_Buffer dw (MAX_NUM_PAGEFRAME * 4) dup (0) ;AN010; For EMS. as per spec. 2 words per entry 373 EMSHandleName db 'BUFFERS ' ;AN010; 8 char. EMS handle name 374 EMS_Ctrl_Tab dd 0 ;AN010; 375 EMS_State_Buf dd 0 ;AN010; 376 BUF_PREV_OFF dw 0 ;AN020; 377 EMS_Buf_First dw 0 ;AN020; 378 %endif 379 380 %IFN NOEXEC 381 align 2, db 0 382 COMEXE: ; NASM structure instance 383 Exec0_size equ Exec0_struc_size ; NASM port equate 384 istruc Exec0 385 at Exec0_environ 0 00000860 0000 dw 0 387 at Exec0_com_line 0 00000862 [2F08]0000 dw COMMAND_LINE, 0 389 at Exec0_5C_FCB 0 00000866 [7608]0000 dw Ldexec_FCB1, 0 391 at Exec0_6C_FCB 0 0000086A [8608]0000 dw Ldexec_FCB2, 0 393 iend 394 %ENDIF 395 396 ;------------------------------------------------------------------ 397 ;J.K. 2/23/87 ;variables for INSTALL= command. 398 0 0000086E FF Multi_Pass_Id db -1 ;AN024;AN027; 400 0 0000086F 00 align 2, db 0 0 00000870 0000 Install_Flag dw 0 ;AN000; 403 HAVE_INSTALL_CMD equ 00000001b ;AN019; CONFIG.SYS has INSTALL= commands 404 HAS_INSTALLED equ 00000010b ;AN019; SYSINIT_BASE installed. 405 SHARE_INSTALL equ 00000100b ;AN021; Used to install SHARE.EXE 406 0 00000872 0000 Config_Size dw 0 ;AN000; size of config.sys file. Set by SYSCONF.ASM 0 00000874 0000 CheckSum dw 0 ;AN000; Used by Sum_up 409 0 00000876 00 Ldexec_FCB1 times 16 db 0 0 00000886 00 Ldexec_FCB2 times 16 db 0 0 00000896 00 Ldexec_Line db 0 ;AN000;# of parm characters 0 00000897 20 Ldexec_start db ' ' ;AN000; 0 00000898 000000000000000000 Ldexec_parm db 80 dup (0) ;AN000; 0 000008A1 000000000000000000 0 000008AA 000000000000000000 0 000008B3 000000000000000000 0 000008BC 000000000000000000 0 000008C5 000000000000000000 0 000008CE 000000000000000000 0 000008D7 000000000000000000 0 000008E0 0000000000000000 415 416 align 2, db 0 417 INSTEXE: ; NASM structure instance 418 istruc Exec0 419 at Exec0_environ 0 000008E8 0000 dw 0 421 at Exec0_com_line 0 000008EA [9608]0000 dw Ldexec_Line, 0 423 at Exec0_5C_FCB 0 000008EE [7608]0000 dw Ldexec_FCB1, 0 425 at Exec0_6C_FCB 0 000008F2 [8608]0000 dw Ldexec_FCB2, 0 427 iend 428 429 ;AN016; Undo the extended attribute handling 430 ;EA_QueryList label byte 431 ; dw 1 ;AN008; I need just one EA info. 432 ; db 02h ;AN008; Type is BINARY 433 ; dw 8000h ;AN008; Flag is SYSTEM DEFINED. 434 ; db 8 ;AN008; Length of name is 8 bytes 435 ; db 'FILETYPE' ;AN008; Name is FILETYPE 436 ;Ext_Attr_List dw 1 ;AN008; Just 1 Extended attribute List 437 ; db 2 ;AN008;EA_TYPE 438 ; dw 8000h ;AN008;FLAG 439 ; db 0 ;AN008;Failure reason 440 ; db 8 ;AN008;Length of NAME 441 ; dw 1 ;AN008;Length of VALUE 442 ; db 'FILETYPE' ;AN008;Name 443 ;Ext_Attr_Value db 0 ;AN008;Value 444 ;SIZE_EXT_ATTR_LIST equ $-Ext_Attr_List ;AN008; 445 ; 446 ;;Extended attribute value 447 ;EA_INSTALLABLE equ 4 ;AN008;Value for Installable file 448 449 ;------------------------------------------------------------------ 450 ;J.K. 5/15/87 ;Request header, variables for IFS= command. 451 0 000008F6 0000 IFS_Flag dw 0 ;AN000; Set to 1 if it is an IFS. 453 IS_IFS equ 00000001b ;IFS command? 454 NOT_IFS equ 11111110b 455 456 IFS_RH: ; NASM structure instance 457 IFSRH_size equ IFSRH_struc_size ; NASM port equate 458 istruc IFSRH 459 at IFSR_LENGTH 0 000008F8 1C00 dw LENGTH_INIT 461 at IFSR_FUNCTION 0 000008FA 01 db IFSINIT 0 000008FB 00 iend 464 465 ;------------------------------------------------------------------ 466 ;Variables for Comment= 0 00000934 00 COM_Level db 0 ;AN000;level of " " in command line 0 00000935 00 CMMT db 0 ;AN000;length of COMMENT string token 0 00000936 00 CMMT1 db 0 ;AN000;token 0 00000937 00 CMMT2 db 0 ;AN000;token 0 00000938 ?? Cmd_Indicator db ? ;AN000; 0 00000939 00 DoNotShowNum db 0 ;AN000; 473 474 ;------------------------------------------------------------------ 0 0000093A 0000 COUNT DW 0000 0 0000093C 0000 Org_Count dw 0000 ;AN019; 0 0000093E 0000 CHRPTR DW 0000 0 00000940 0000 CntryFilehandle DW 0000 479 ;------------------------------------------------------------------ 480 BucketPTR LABEL dword ;AN000; 481 BUFPTR LABEL DWORD ;LEAVE THIS STUFF IN ORDER! 0 00000942 0000 DW 0 0 00000944 0000 DW 0 484 PRMBLK LABEL WORD 0 00000946 0000 dw 0 0 00000948 0000 dw 0 487 0 0000094A 18 PACKET DB 24 ;AN014; Was 22 0 0000094B 00 DB 0 0 0000094C 00 DB 0 ;INITIALIZE CODE 0 0000094D 0000 DW 0 0 0000094F ???????????????? DB 8 DUP (?) 0 00000957 00 UNITCOUNT DB 0 0 00000958 00000000 BREAK_ADDR DD 0 0 0000095C 00000000 BPB_ADDR DD 0 0 00000960 00 DriveNumber DB 0 0 00000961 0000 ConfigMsgFlag dw 0 ;AN014;AN022; Used to control "Error in CONFIG.SYS line #" message 498 0 00000963 00 align 16, db 0 500 initpspmcb: 501 istruc arena 0 00000970 4D at arena_signature, db 'M' 503 at arena_owner 0 00000971 000600 at arena_size, dw 6 505 at arena_reserved 0 00000975 00494E4954 at arena_name, db "INIT",0 0 0000097C 00 0 0000097D 00 at arena_struc_size 508 ; iend ; cannot use arena_size as it clashes with the field named the same 509 %pop 510 0 00000980 0000 tempcds_block: dw 0 512 513 global kernelcommandline 514 global kernelcommandline.end 515 align 2, db 0 0 00000982 00FF00 kernelcommandline: fill 256, 0, {db 0, -1} 0 00000A82 0000 .end: dw 0 518 519 520 extern OLDCONFIG_name 521 global CONFIG_pointers 522 extern cmdline_noop, cmdline_checkdebugger, cmdline_scanmode 523 524 global commandnames 525 ; format: 526 ; word function pointer - 1 in DOSENTRY, 0FFFFh if end 527 ; word content pointer, written to -> last command content, 0 if empty 528 ; word name pointer, -> ASCIZ name in SYSINIT 529 commandnames: 530 ; these are just to validate the names. 531 ; their contents aren't used here. 0 00000A84 [FFFF]0000[E00A] dw cmdline_noop - 1, 0, namedot 0 00000A8A [FFFF]0000[D10A] dw cmdline_noop - 1, 0, nameprepend 0 00000A90 [FFFF]0000[D90A] dw cmdline_noop - 1, 0, nameappend 535 536 ; These use the function pointer to run things. 537 ; The content pointers aren't used later on. 0 00000A96 [FFFF]0000[3900] dw cmdline_checkdebugger - 1, 0, namecheckdebugger 0 00000A9C [FFFF]0000[4700] dw cmdline_scanmode - 1, 0, namescanmode 540 541 CONFIG_pointers: 542 ; The content pointers in these are used to set the 543 ; filenames used for the configuration file. 0 00000AA2 [FFFF]0000[B60A] .config: dw cmdline_noop - 1, 0, .nameconfig 0 00000AA8 [FFFF][E20A][BD0A] .altconfig: dw cmdline_noop - 1, ALTCONFIG_name, .namealtconfig 0 00000AAE [FFFF][0000][C70A] .oldconfig: dw cmdline_noop - 1, OLDCONFIG_name, .nameoldconfig 0 00000AB4 FFFF dw -1 548 0 00000AB6 434F4E46494700 .nameconfig: asciz "CONFIG" 0 00000ABD 414C54434F4E464947 .namealtconfig: asciz "ALTCONFIG" 0 00000AC6 00 0 00000AC7 4F4C44434F4E464947 .nameoldconfig: asciz "OLDCONFIG" 0 00000AD0 00 552 553 global nameprepend, nameappend 0 00000AD1 50524550454E4400 nameprepend: asciz "PREPEND" 0 00000AD9 415050454E4400 nameappend: asciz "APPEND" 0 00000AE0 2E00 namedot: asciz "." 557 0 00000AE2 6C646F732E696E6900 ALTCONFIG_name: asciz "ldos.ini" 559 560 msg_startingsmall: 0 00000AEB 5374617274696E6720 .: db "Starting small " 0 00000AF4 736D616C6C20 562 .length equ $ - . 563 msg_linebreak: 0 00000AFA 0D0A .: db 13,10 565 .length equ $ - . 566 567 msg: 0 00000AFC 0D0A456E7465722063 .prompt: db 13,10,"Enter command to load as a shell: " 0 00000B05 6F6D6D616E6420746F 0 00000B0E 206C6F616420617320 0 00000B17 61207368656C6C3A20 569 .prompt.length equ $ - .prompt 570 === Switch to base=00C400h -> "SYSINITLAST" 571 usesection SYSINITLAST 572 stack_low: equ $ 0 000073F0 4C444F533230323400 .ldos2024: asciz "LDOS2024" 0 000073F9 4C444F534E455700 .ldosnew: asciz "LDOSNEW" 0 00007401 46524545444F5300 .freedos: asciz "FREEDOS" 0 00007409 46524545444F53444C .freedosdla: asciz "FREEDOSDLA" 0 00007412 4100 0 00007414 454452444F5300 .edrdos: asciz "EDRDOS" 0 0000741B 4D53444F533500 .msdos5: asciz "MSDOS5" 0 00007422 4D53444F533700 .msdos7: asciz "MSDOS7" 0 00007429 434845434B44454255 namecheckdebugger: asciz "CHECKDEBUGGER" 0 00007432 4747455200 0 00007437 5343414E4D4F444500 namescanmode: asciz "SCANMODE" 582 583 align 2, db 0 584 modetable: 0 00007440 [0000] dw msg.ldos2024 0 00007442 DAA3 dw mode_first_ext5 | mode_first_ext15 | mode_ignore_ext85 | mode_ignore_subsequent_nested | mode_ignore_subsequent_logical | mode_ignore_subsequent_primary | mode_traditional_order_logical | mode_disable_fat32 | mode_dlasort_zero 0 00007444 [0900] dw msg.ldosnew 0 00007446 0020 dw mode_all_ext5 | mode_all_ext15 | mode_all_ext85 | mode_disable_fat32 0 00007448 [1100] dw msg.freedos 0 0000744A 5A8E dw mode_first_ext5 | mode_first_ext15 | mode_ignore_ext85 | mode_ignore_subsequent_nested | mode_traditional_order_logical | mode_active_priority | mode_subsequent_primary_after | mode_dlasort_zero 0 0000744C [1900] dw msg.freedosdla 0 0000744E 5A0E dw mode_first_ext5 | mode_first_ext15 | mode_ignore_ext85 | mode_ignore_subsequent_nested | mode_traditional_order_logical | mode_active_priority | mode_subsequent_primary_after 0 00007450 [2400] dw msg.edrdos 0 00007452 5A82 dw mode_first_ext5 | mode_first_ext15 | mode_ignore_ext85 | mode_ignore_subsequent_nested | mode_traditional_order_logical | mode_dlasort_zero 0 00007454 [2B00] dw msg.msdos5 0 00007456 D6EE dw mode_first_ext5 | mode_ignore_ext15 | mode_ignore_ext85 | mode_ignore_subsequent_nested | mode_ignore_subsequent_logical | mode_traditional_order_logical | mode_active_priority | mode_subsequent_primary_after | mode_disable_fat32 | mode_disable_lba | mode_dlasort_zero 0 00007458 [3200] dw msg.msdos7 0 0000745A DA8E dw mode_first_ext5 | mode_first_ext15 | mode_ignore_ext85 | mode_ignore_subsequent_nested | mode_ignore_subsequent_logical | mode_traditional_order_logical | mode_active_priority | mode_subsequent_primary_after | mode_dlasort_zero 632 .end: 633 634 635 global GOINIT 636 GOINIT: 637 assume ds:nothing, es:nothing, ss:nothing 0 0000745C 51 push cx 639 ;J.K. before doing anything else, let's set the model byte 640 ;SB33043***************************************************************** 0 0000745D B4C0 mov ah,0c0h ;get system configuration ;SB ;3.30* 0 0000745F CD15 int 15h ; * ;SB ;3.30* 643 ;SB33043***************************************************************** 0 00007461 7217 jc No_ROM_Config 0 00007463 80FC00 cmp ah, 0 ; double check 0 00007466 7512 jne No_ROM_Config 0 00007468 268A4702 mov al, [ES:BX + bios_SD_modelbyte] 0 0000746C 2EA2[5D08] mov [cs:Sys_Model_Byte], al 0 00007470 268A4703 mov al, [ES:BX + bios_SD_scnd_modelbyte] 0 00007474 2EA2[5E08] mov [cs:Sys_Scnd_Model_Byte], al 0 00007478 EB0C jmp @F 652 No_ROM_Config: ; Old ROM 0 0000747A B800F0 mov ax, 0f000h 0 0000747D 8ED8 mov ds, ax 655 assume ds:nothing 0 0000747F A0FEFF mov al, byte ptr [0fffeh] 0 00007482 2EA2[5D08] mov [cs:Sys_Model_Byte], al ;set the model byte. 658 @@: 659 660 ;J.K.6/24/87 Set Fake_Floppy_Drv if there is no diskette drives in this machine. 661 ;SB34SYSINIT1001******************************************************** 662 ;SB execute the equipment determination interrupt and then 663 ;SB check the returned value to see if we have any floppy drives 664 ;SB if we have no floppy drive we set cs:Fake_Floppy_Drv to 1 665 ;SB See the AT Tech Ref BIOS listings for help on the equipment 666 ;SB flag interrupt (11h) 667 0 00007486 CD11 int 11h 0 00007488 A801 test al, 1 ; has floppy ? 0 0000748A 7506 jnz Move_Myself 0 0000748C 2EC606[0408]01 mov byte [cs:Fake_Floppy_Drv],1 ; no floppy, fake. 672 673 ;SB34SYSINIT1001******************************************************** 674 Move_Myself: 0 00007492 FC CLD ; Set up move 0 00007493 31F6 XOR SI,SI 0 00007495 89F7 MOV DI,SI 678 679 %if 0 680 %IF MSVER 681 MOV CX,[cs:MEMORY_SIZE] 682 CMP CX,1 ; 1 means do scan 683 JNZ NOSCAN 684 MOV CX,2048 ;START SCANNING AT 32K BOUNDARY 685 XOR BX,BX 686 687 MEMSCAN:INC CX 688 JZ SETEND 689 MOV DS,CX 690 MOV AL,[BX] 691 NOT AL 692 MOV [BX],AL 693 CMP AL,[BX] 694 NOT AL 695 MOV [BX],AL 696 JZ MEMSCAN 697 SETEND: 698 MOV [cs:MEMORY_SIZE],CX 699 %ENDIF 700 701 %IF IBMVER | IBMJAPVER 702 MOV CX,[cs:MEMORY_SIZE] 703 %ENDIF 704 NOSCAN: ; CX is mem size in para 705 %endif 706 707 SYSIN: 708 709 %if 0 710 xor ax, ax 711 mov ds, ax 712 ASSUME DS:NOTHING,ES:SYSINITSEG,SS:NOTHING 713 MOV ax, [cs:FINAL_DOS_LOCATION] ; Where it is going (set by BIOS) 714 mov word [31h * 4 + 2], ax 715 mov es, ax 716 ASSUME ES:NOTHING 717 xor di, di 718 mov bx, DOSSTART 719 mov cx, afterdosdatalabel wrt DOSSTART ; = early DOS data length 720 mov ds, bx ; => early DOS data location 721 xor si, si 722 cmp bx, ax 723 ; cmp ds, es 724 jae load_dos_to_lower 725 load_dos_to_higher: 726 mov si, cx ; -> behind source 727 mov di, si ; -> behind dest 728 std ; set DOWN 729 cmpsw ; -> at last words 730 load_dos_to_lower: 731 shr cx, 1 732 rep movsw 733 cld 734 %endif 735 0 00007497 5B pop bx ; => first trail S MCB 0 00007498 83EB07 sub bx, 7 ; => place for MCB 0 0000749B 8EC3 mov es, bx 739 assume es:nothing 0 0000749D 53 push bx ; => MCB 0 0000749E 43 inc bx ; => place for PSP 0 0000749F 31FF xor di, di ; es:di -> MCB 0 000074A1 0E push cs 0 000074A2 1F pop ds 745 assume ds:SYSINITGROUP 0 000074A3 BE[7009] mov si, initpspmcb ; ds:si -> template 0 000074A6 895C01 mov word [si + arena_owner], bx 0 000074A9 B90800 mov cx, 8 0 000074AC F3A5 rep movsw 0 000074AE C644F05A mov byte [si - MCB_size + mcbSignature], 'Z' 751 0 000074B2 8B16[1A08] MOV DX,[MEMORY_SIZE] ; Set for call to DOSINIT 0 000074B6 C536[FC07] LDS SI,[DEVICE_LIST] ; Set for call to DOSINIT 754 assume ds:nothing 0 000074BA 59 pop cx ; => first trail S MCB 0 000074BB 2E8B3E[FA07] mov di, word [cs:behind_dosentry_segment] 757 ; free MCB 0 000074C0 FA CLI 0 000074C1 E9[0000] jmp SYSINIT_CALL_DOS 760 0 000074C4 26 align 16, db 26h 762 stack_high equ $ + fromparas(paras(SYSINITSTACK)) 763 === Switch to base=00C400h -> "SYSINITTRAIL" 764 usesection SYSINITTRAIL 765 SYSINIT_CALL_DOS: 766 0 000048C0 8CC8 MOV AX,CS 0 000048C2 8ED0 MOV SS,AX 0 000048C4 BC[6002] MOV SP, stack_high ; Set stack 770 assume ss:SYSINITGROUP 771 772 %if (stack_high - stack_low) < 512 773 %assign NUMBER (stack_high - stack_low) 774 %error Too small stack, want 512, have NUMBER 775 %endif 776 777 %IFN ALTVECT 0 000048C7 FB STI ; Leave INTs disabled for ALTVECT 779 %ENDIF 780 0 000048C8 31C0 xor ax, ax 0 000048CA 8EC0 mov es, ax 783 assume es:IVT 0 000048CC 268E06C600 mov es, word [es:31h * 4 + 2] ; => DOSDATA 785 assume es:DOSGROUP 786 ; INP: dx => behind LMA 787 ; dx - 1 => where to place first UMCB 788 ; ds:si -> first non-NUL device header 789 ; es => DOSDATA to initialise 790 ; es - 1 => DOSDATA MCB, shrink as desired 791 ; cx => first trail MCB 792 ; bx => space for init PSP 793 ; di => space for free MCB (should link to cx => MCB) 0 000048D1 CC int3 795 796 extern NEARDOSINIT 0 000048D2 E8[0000] call NEARDOSINIT 798 assume es:DOSGROUP ;ES:DI -> SysInitVars_Ext 0 000048D5 268B05 mov ax, word ptr [es:di + SYSI_InitVars] ;J.K. 5/29/86 0 000048D8 36A3[F207] mov word ptr [ss:dosinfo], ax 0 000048DC 268B4502 mov ax, word ptr [es:di + SYSI_InitVars+2] 0 000048E0 36A3[F407] mov word ptr [ss:dosinfo+2],ax ;set the sysvar pointer 803 0 000048E4 268B4504 mov ax, word ptr [es:di + SYSI_Country_Tab] 0 000048E8 36A3[0008] mov word ptr [ss:SYSI_Country],ax 0 000048EC 268B4506 mov ax, word ptr [es:di + SYSI_Country_Tab+2] 0 000048F0 36A3[0208] mov word ptr [ss:SYSI_Country+2],ax ;set the SYSI_Country pointer J.K. 808 0 000048F4 B440 mov ah, 40h 0 000048F6 BB0100 mov bx, 1 0 000048F9 0E push cs 0 000048FA 1F pop ds 813 assume ds:SYSINITGROUP 0 000048FB BA[EB0A] mov dx, msg_startingsmall 0 000048FE B90F00 mov cx, msg_startingsmall.length 0 00004901 CD21 int 21h 0 00004903 B8FF33 mov ax, 33FFh 0 00004906 CD21 int 21h 0 00004908 92 xchg dx, ax ; dx -> message, ax => segment 0 00004909 89D7 mov di, dx 0 0000490B 8EC0 mov es, ax 822 assume es:DOSCODEGROUP 0 0000490D 8ED8 mov ds, ax 824 assume ds:DOSCODEGROUP 0 0000490F B000 mov al, 0 0 00004911 B9FFFF mov cx, -1 0 00004914 F2AE repne scasb 0 00004916 F7D1 not cx 0 00004918 49 dec cx 0 00004919 B440 mov ah, 40h 0 0000491B CD21 int 21h 0 0000491D B440 mov ah, 40h 0 0000491F BB0100 mov bx, 1 0 00004922 0E push cs 0 00004923 1F pop ds 836 assume ds:SYSINITGROUP 0 00004924 BA[FA0A] mov dx, msg_linebreak 0 00004927 B90200 mov cx, msg_linebreak.length 0 0000492A CD21 int 21h 840 841 extern INITUPB 0 0000492C E8[0000] call INITUPB 843 assume ds:nothing, es:nothing, ss:SYSINITGROUP 844 845 extern INITDPB 0 0000492F E8[0000] call INITDPB 847 assume ds:nothing, es:nothing, ss:SYSINITGROUP 848 849 relocate_upb_early: 850 extern sysinit_get_ds_dosentry, dskdrvs_indirect, START_BDS, DRVMAX 851 0 00004932 E8[0000] call sysinit_get_ds_dosentry ; DRVMAX in DOSENTRY 853 assume ds:DOSENTRYGROUP 0 00004935 31F6 xor si, si 0 00004937 8A2E[0000] mov ch, [DRVMAX] ; ch = how many UPBs 856 %ifnidni %[DOSBIODATA], %[DOSENTRY] 0 0000493B E8[0000] call sysinit_get_ds_dosbiodata 858 assume ds:DOSGROUP 859 %endif 0 0000493E C43E[0000] les di, [START_BDS] ; es:di -> first UPB 861 assume es:UPB 0 00004942 C516[0000] lds dx, [dskdrvs_indirect] ; ds:dx -> dskdrvs array (used by INITDPB) 863 assume ds:UPB 0 00004946 83FFFF cmp di, -1 ; none ? 0 00004949 7503E90701 je .warn ; then skip --> 0 0000494E 84ED test ch, ch 0 00004950 7503E90001 jz .warn 868 ; Harden: Expect UPBs at start of memory block. 0 00004955 85FF test di, di 0 00004957 7403E9F900 jnz .warn 0 0000495C 8CC0 mov ax, es 0 0000495E 8CDB mov bx, ds 0 00004960 39D8 cmp ax, bx ; UPB segment == dskdrvs segment ? 0 00004962 7403E9EE00 jne .warn 0 00004967 48 dec ax 0 00004968 8ED8 mov ds, ax 877 assume ds:MCB 0 0000496A 837C0108 cmp word [si + mcbOwner], 8 ; an S MCB ? 0 0000496E 7403E9E200 jne .warn 0 00004973 837C0853 cmp word [si + mcbName], "S" ; S MCB ? 0 00004977 7403E9D900 jne .warn 0 0000497C 807C0A09 cmp byte [si + smcbType], S_UPB ; correct type ? 0 00004980 7403E9D000 jne .warn 0 00004985 8B4403 mov ax, [si + mcbSize] 0 00004988 B104 mov cl, 4 0 0000498A D3E0 shl ax, cl ; = size in bytes 0 0000498C 89C3 mov bx, ax 0 0000498E D3E8 shr ax, cl ; compute paragraphs again 0 00004990 394403 cmp word [si + mcbSize], ax ; match ? 0 00004993 7403E9BD00 jne .warn 0 00004998 39D3 cmp bx, dx ; dskdrvs array fits in block ? 0 0000499A 7703E9B600 jbe .warn ; certainly no --> 0 0000499F 31C0 xor ax, ax 0 000049A1 88E8 mov al, ch ; ax = how many UPBs 0 000049A3 01C0 add ax, ax ; how large dskdrvs array should be 0 000049A5 01D0 add ax, dx ; -> behind array 0 000049A7 83C00F add ax, 15 ; round up 0 000049AA 24F0 and al, ~ 15 ; get to paragraph boundary 0 000049AC 39C3 cmp bx, ax ; match ? 0 000049AE 7403E9A200 jne .warn 0 000049B3 B064 mov al, BDS_TYPE_struc_size 0 000049B5 F6E5 mul ch ; ax = how many bytes needed for UPBs 0 000049B7 39C2 cmp dx, ax ; last UPB fits below dskdrvs ? 0 000049B9 7303E99700 jb .warn ; no --> 0 000049BE 89C3 mov bx, ax 0 000049C0 40 inc ax 0 000049C1 24FE and al, ~ 1 0 000049C3 39C2 cmp dx, ax 0 000049C5 7403E98B00 jne .warn 910 0 000049CA 88E9 mov cl, ch 0 000049CC 84C9 test cl, cl 0 000049CE 7503E98200 jz .warn 0 000049D3 06 push es 0 000049D4 57 push di 916 .loop: 0 000049D5 80F901 cmp cl, 1 0 000049D8 7416 je .last 0 000049DA 8CC3 mov bx, es 0 000049DC 26395D02 cmp word [es:di + LINK + 2], bx 0 000049E0 7571 jne .warn_pop_pop 0 000049E2 8D5D64 lea bx, [di + BDS_TYPE_struc_size] 0 000049E5 26391D cmp word [es:di + LINK], bx 0 000049E8 7569 jne .warn_pop_pop 0 000049EA 49 dec cx ; count down 0 000049EB 26C43D les di, [es:di + LINK] 927 assume es:UPB 0 000049EE EBE5 jmp .loop 929 930 .last: 0 000049F0 26833DFF cmp word [es:di + LINK], -1 0 000049F4 755D jne .warn_pop_pop 933 0 000049F6 BE[BE21] mov si, alloc_upb_temporary 0 000049F9 51 push cx 0 000049FA 50 push ax 0 000049FB E8DC21 call allocate_temporary_block 938 assume es:nothing 0 000049FE 59 pop cx ; = size of initialised UPBs 0 000049FF 5B pop bx ; bh = number of UPBs 0 00004A00 5E pop si 0 00004A01 1F pop ds ; -> first UPB source 943 assume ds:UPB 0 00004A02 89FA mov dx, di ; es:dx -> destination 0 00004A04 F3A4 rep movsb ; copy them over 0 00004A06 89D7 mov di, dx ; es:di -> copied UPBs 0 00004A08 88F9 mov cl, bh 0 00004A0A B500 mov ch, 0 ; cx = amount UPBs 0 00004A0C 8CDB mov bx, ds 950 951 .newloop: 0 00004A0E 49 dec cx 0 00004A0F 7417 jz .newlast 0 00004A11 26395D02 cmp word [es:di + LINK + 2], bx 0 00004A15 7537 jne .warn_free 0 00004A17 8D4564 lea ax, [di + BDS_TYPE_struc_size] 0 00004A1A 263905 cmp word [es:di + LINK], ax 0 00004A1D 752F jne .warn_free 0 00004A1F 268C4502 mov word [es:di + LINK + 2], es ; relocate next link 0 00004A23 26C43D les di, [es:di + LINK] 961 assume es:nothing 0 00004A26 EBE6 jmp .newloop 963 964 .newlast: 0 00004A28 26833DFF cmp word [es:di + LINK], -1 0 00004A2C 7520 jne .warn_free 967 0 00004A2E E8[0000] call sysinit_get_ds_dosbiodata 969 assume ds:DOSGROUP 0 00004A31 FA cli 0 00004A32 B8FFFF mov ax, -1 0 00004A35 A3[0000] mov word [dskdrvs_indirect], ax 0 00004A38 A3[0200] mov word [dskdrvs_indirect + 2], ax 974 ; invalidate the dskdrvs pointer 0 00004A3B 8CC0 mov ax, es 0 00004A3D 8916[0000] mov word [START_BDS], dx 0 00004A41 8706[0200] xchg word [START_BDS + 2], ax ; relocate the UPBs 0 00004A45 FB sti 0 00004A46 8EC0 mov es, ax 980 assume es:nothing 0 00004A48 B449 mov ah, 49h 0 00004A4A CD21 int 21h ; free the original allocation 0 00004A4C EB16 jmp .done 984 985 .warn_free: 0 00004A4E B449 mov ah, 49h 0 00004A50 CD21 int 21h ; free new allocation 0 00004A52 A9 db __TEST_IMM16 ; skip twice pop 989 .warn_pop_pop: 0 00004A53 58 pop ax 0 00004A54 58 pop ax 992 .warn: 0 00004A55 0E push cs 0 00004A56 1F pop ds 995 assume ds:SYSINITGROUP 0 00004A57 BA[C723] mov dx, sysinit_msg.warn_upb 0 00004A5A B92800 mov cx, sysinit_msg.warn_upb.size 0 00004A5D BB0100 mov bx, 1 0 00004A60 B440 mov ah, 40h 0 00004A62 CD21 int 21h 1001 .done: 1002 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1003 1004 1005 ; ! Note that at this point no SFTs, CDSes, buffers 1006 ; hold references to our early DOS-internal DPBs. 1007 relocate_dpb_early: 1008 extern NUMIO, DPBHEAD, sysinit_getdosdata 1009 0 00004A64 E8[0000] call sysinit_getdosdata 0 00004A67 8ED8 mov ds, ax 1012 assume ds:DOSGROUP 0 00004A69 31F6 xor si, si 0 00004A6B 8A2E[0000] mov ch, [NUMIO] ; ch = how many DPBs (at this point) 0 00004A6F C43E[0000] les di, [DPBHEAD] ; es:di -> first DPB 1016 assume es:DPB 0 00004A73 83FFFF cmp di, -1 ; none ? 0 00004A76 7503E9E500 je .warn ; then skip --> 0 00004A7B 84ED test ch, ch 0 00004A7D 7503E9DE00 jz .warn 1021 ; Harden: Expect DPBs at start of memory block. 0 00004A82 85FF test di, di 0 00004A84 7403E9D700 jnz .warn 0 00004A89 8CC0 mov ax, es 0 00004A8B 48 dec ax 0 00004A8C 8ED8 mov ds, ax 1027 assume ds:MCB 0 00004A8E 837C0108 cmp word [si + mcbOwner], 8 ; an S MCB ? 0 00004A92 7403E9C900 jne .warn 0 00004A97 837C0853 cmp word [si + mcbName], "S" ; S MCB ? 0 00004A9B 7403E9C000 jne .warn 0 00004AA0 807C0A08 cmp byte [si + smcbType], S_DPB ; correct type ? 0 00004AA4 7403E9B700 jne .warn 0 00004AA9 8B4403 mov ax, [si + mcbSize] 0 00004AAC B104 mov cl, 4 0 00004AAE D3E0 shl ax, cl ; = size in bytes 0 00004AB0 89C3 mov bx, ax 0 00004AB2 D3E8 shr ax, cl ; compute paragraphs again 0 00004AB4 394403 cmp word [si + mcbSize], ax ; match ? 0 00004AB7 7403E9A400 jne .warn 0 00004ABC B021 mov al, dpb_struc_size 0 00004ABE F6E5 mul ch ; ax = how many bytes needed for DPBs 0 00004AC0 39C3 cmp bx, ax ; last DPB fits in block ? 0 00004AC2 7303E99900 jb .warn ; no --> 0 00004AC7 89C2 mov dx, ax 0 00004AC9 83C20F add dx, 15 0 00004ACC 80E2F0 and dl, ~ 15 0 00004ACF 39D3 cmp bx, dx 0 00004AD1 7403E98A00 jne .warn 1050 0 00004AD6 88E9 mov cl, ch 0 00004AD8 84C9 test cl, cl 0 00004ADA 7503E98100 jz .warn 0 00004ADF 06 push es 0 00004AE0 57 push di 1056 .loop: 0 00004AE1 80F901 cmp cl, 1 0 00004AE4 7418 je .last 0 00004AE6 8CC3 mov bx, es 0 00004AE8 26395D1B cmp word [es:di + dpb_next_dpb + 2], bx 0 00004AEC 7570 jne .warn_pop_pop 0 00004AEE 8D5D21 lea bx, [di + dpb_struc_size] 0 00004AF1 26395D19 cmp word [es:di + dpb_next_dpb], bx 0 00004AF5 7567 jne .warn_pop_pop 0 00004AF7 49 dec cx ; count down 0 00004AF8 26C47D19 les di, [es:di + dpb_next_dpb] 1067 assume es:DPB 0 00004AFC EBE3 jmp .loop 1069 1070 .last: 0 00004AFE 26837D19FF cmp word [es:di + dpb_next_dpb], -1 0 00004B03 7559 jne .warn_pop_pop 1073 0 00004B05 BE[D221] mov si, alloc_dpb_temporary 0 00004B08 51 push cx 0 00004B09 50 push ax 0 00004B0A E8CD20 call allocate_temporary_block 1078 assume es:nothing 0 00004B0D 59 pop cx ; = size of initialised DPBs 0 00004B0E 5B pop bx ; bh = number of DPBs 0 00004B0F 5E pop si 0 00004B10 1F pop ds ; -> first DPB source 1083 assume ds:DPB 0 00004B11 89FA mov dx, di ; es:dx -> destination 0 00004B13 F3A4 rep movsb ; copy them over 0 00004B15 89D7 mov di, dx ; es:di -> copied DPBs 0 00004B17 88F9 mov cl, bh 0 00004B19 B500 mov ch, 0 ; cx = amount DPBs 0 00004B1B 8CDB mov bx, ds 1090 1091 .newloop: 0 00004B1D 49 dec cx 0 00004B1E 7419 jz .newlast 0 00004B20 26395D1B cmp word [es:di + dpb_next_dpb + 2], bx 0 00004B24 7533 jne .warn_free 0 00004B26 8D4521 lea ax, [di + dpb_struc_size] 0 00004B29 26394519 cmp word [es:di + dpb_next_dpb], ax 0 00004B2D 752A jne .warn_free 0 00004B2F 268C451B mov word [es:di + dpb_next_dpb + 2], es ; relocate next link 0 00004B33 26C47D19 les di, [es:di + dpb_next_dpb] 1101 assume es:nothing 0 00004B37 EBE4 jmp .newloop 1103 1104 .newlast: 0 00004B39 26837D19FF cmp word [es:di + dpb_next_dpb], -1 0 00004B3E 7519 jne .warn_free 1107 0 00004B40 E8[0000] call sysinit_getdosdata 0 00004B43 8ED8 mov ds, ax 1110 assume ds:DOSGROUP 0 00004B45 FA cli 0 00004B46 8CC0 mov ax, es 0 00004B48 8916[0000] mov word [DPBHEAD], dx 0 00004B4C 8706[0200] xchg word [DPBHEAD + 2], ax ; relocate the DPBs 0 00004B50 FB sti 0 00004B51 8EC0 mov es, ax 1117 assume es:nothing 0 00004B53 B449 mov ah, 49h 0 00004B55 CD21 int 21h ; free the original allocation 0 00004B57 EB16 jmp .done 1121 1122 .warn_free: 0 00004B59 B449 mov ah, 49h 0 00004B5B CD21 int 21h ; free new allocation 0 00004B5D A9 db __TEST_IMM16 ; skip twice pop 1126 .warn_pop_pop: 0 00004B5E 58 pop ax 0 00004B5F 58 pop ax 1129 .warn: 0 00004B60 0E push cs 0 00004B61 1F pop ds 1132 assume ds:SYSINITGROUP 0 00004B62 BA[EF23] mov dx, sysinit_msg.warn_dpb 0 00004B65 B92800 mov cx, sysinit_msg.warn_dpb.size 0 00004B68 BB0100 mov bx, 1 0 00004B6B B440 mov ah, 40h 0 00004B6D CD21 int 21h 1138 .done: 1139 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1140 0 00004B6F 36C43E[F207] les di, [ss:dosinfo] ;es:di -> dosinfo 1142 assume es:DOSGROUP 1143 0 00004B74 F8 clc ;AN018;Get the extended memory size 1145 ;SB34SYSINIT1002************************************************************** 1146 ;SB execute the get extended memory size subfunction in the BIOS INT 15h 1147 ;SB if the function reports an error do nothing else store the extended 1148 ;SB memory size reported at the appropriate location in the dosinfo buffer 1149 ;SB currently pointed to by es:di. Use the offsets specified in the 1150 ;SB definition of the sysinitvars struct in inc\sysvar.inc 1151 ;SB 5 LOCS 1152 0 00004B75 B488 mov ah,88h 0 00004B77 CD15 int 15h ;check extended memory size 0 00004B79 7204 jc No_Ext_Memory 0 00004B7B 26894545 mov [es:di + SYSI_EXT_MEM],ax ;save extended memory size 1157 No_Ext_Memory: 1158 1159 ;SB34SYSINIT1002************************************************************** 0 00004B7F 26C7453BFFFF mov word ptr [es:di + SYSI_IFS], -1 ;AN000; Initialize SYSI_IFS chain. 0 00004B85 26C7453DFFFF mov word ptr [es:di + SYSI_IFS+2], -1 ;AN000; 1162 0 00004B8B 268B4510 mov ax, [es:di + SYSI_MAXSEC] ;AN020; Get the sector size 0 00004B8F 83C010 add ax, BUFINSIZ ;AN020; size of buffer header 0 00004B92 36A3[2108] mov [ss:SingleBufferSize], ax ;AN020; total size for a buffer 1166 1167 Default_Drive equ DEFAULT_DRIVE ; NASM port label 0 00004B96 36A0[1C08] mov al, [ss:Default_Drive] ;AN000;Get the 1 based boot drive number set by IBMINIT 0 00004B9A 26884543 mov [es:di + SYSI_BOOT_DRIVE], al ;AN000; set SYSI_BOOT_DRIVE 1170 1171 ; Determine if 386 system... 1172 Get_CPU_Type ; macro to determine cpu type 0 00004B9E 9C pushf 0 00004B9F 53 push bx 0 00004BA0 31DB xor bx, bx 13 <1> 0 00004BA2 31C0 xor ax,ax 0 00004BA4 50 push ax 0 00004BA5 9D popf 0 00004BA6 9C pushf 0 00004BA7 58 pop ax 0 00004BA8 2500F0 and ax,0F000h 0 00004BAB 3D00F0 cmp ax,0F000h 0 00004BAE 740E je %%cpu_8086 22 <1> 0 00004BB0 B800F0 mov ax,0F000h 0 00004BB3 50 push ax 0 00004BB4 9D popf 0 00004BB5 9C pushf 0 00004BB6 58 pop ax 0 00004BB7 2500F0 and ax,0F000h 0 00004BBA 7401 jz %%cpu_286 30 <1> 31 <1> %%cpu_386: 0 00004BBC 43 inc bx 33 <1> %%cpu_286: 0 00004BBD 43 inc bx 35 <1> %%cpu_8086: 0 00004BBE 89D8 mov ax, bx 0 00004BC0 5B pop bx 0 00004BC1 9D popf 0 00004BC2 83F802 cmp ax, 2 ; is it a 386? 0 00004BC5 7505 jne Not_386_System ; no: don't mess with flag 0 00004BC7 26C6454401 mov byte [es:di + SYSI_DWMOVE], 1 ;AN003; 1176 Not_386_System: ;AN003; 0 00004BCC 268A4520 MOV AL,[ES:DI + SYSI_NUMIO] 0 00004BD0 36A2[6009] MOV [ss:DriveNumber],AL ; Save start of installable block drvs 1179 0 00004BD4 06 push es ;AN020; 0 00004BD5 57 push di ;AN020; 1182 0 00004BD6 06 push es 0 00004BD7 36A1[2108] mov ax, [ss:SingleBufferSize] ;AN020;Temporary Single buffer area 0 00004BDB BE[9621] mov si, alloc_init 0 00004BDE E8F91F call allocate_temporary_block 1187 assume es:nothing 0 00004BE1 8CC0 mov ax, es ; ax => buffer 0 00004BE3 07 pop es ; es => DOSDATA 1190 assume es:DOSGROUP 1191 0 00004BE4 36A3[2908] mov word [ss:buffer_block], ax 1193 %ifdef BUF2 0 00004BE8 26A3[0200] mov word [es:BUFFHEAD + 2], ax 0 00004BEC 268326[0000]00 and word [es:BUFFHEAD], 0 0 00004BF2 8EC0 mov es, ax 1197 assume es:nothing 0 00004BF4 31FF xor di, di 0 00004BF6 26834D02FF or word [es:di + NEXTBUF + 2], -1 0 00004BFB 26830DFF or word [es:di + NEXTBUF], -1 0 00004BFF 26C74504FF00 mov word [es:di + BUFDRV], 00FFh 1202 %else 1203 les di, [es:di + SYSI_BUF] ;AN020;get the buffer hash entry pointer 1204 HASH_PTR equ Hash_ptr ; NASM port equate 1205 les di, [es:di + HASH_PTR] ;AN020; 1206 mov word ptr [es:di + BUFFER_BUCKET],0 ;AN020; 1207 mov word ptr [es:di + BUFFER_BUCKET+2], ax ;AN020; 1208 mov es, ax ;AN020; 1209 xor ax, ax ;AN020; 1210 mov di, ax ;AN020;es:di -> Single buffer 1211 BUF_NEXT equ buf_next ; NASM port equate 1212 mov [es:di + BUF_NEXT], ax ;AN020;points to itself 1213 BUF_PREV equ buf_prev ; NASM port equate 1214 mov [es:di + BUF_PREV], ax ;AN020;points to itself 1215 BUF_ID equ buf_ID ; NASM port equate 1216 mov word ptr [es:di + BUF_ID],00FFh ;AN020;free buffer, clear flag 1217 BUF_SECTOR equ buf_sector ; NASM port equate 1218 mov word ptr [es:di + BUF_SECTOR], ax ;AN020; 1219 mov word ptr [es:di + BUF_SECTOR+2], ax ;AN020; 1220 %endif 0 00004C05 5F pop di ;AN020; 0 00004C06 07 pop es ;AN020; 1223 assume es:DOSGROUP 1224 0 00004C07 1E PUSH DS ; Save as input to RE_INIT 0 00004C08 0E PUSH CS 0 00004C09 1F POP DS 1228 ASSUME DS:SYSINITGROUP 0 00004C0A E81A08 CALL TEMPCDS ; Set up CDSs so RE_INIT and SYSINIT 1230 ; can make DISK system calls 1231 0 00004C0D 1F POP DS ; Recover DS input to RE_INIT 1233 ASSUME DS:NOTHING 1234 1235 %IFN IBMJAPVER 0 00004C0E E8[0000] CALL RE_INIT ; Re-call the BIOS 1237 %ENDIF 1238 0 00004C11 FB STI ; INTs OK 0 00004C12 FC CLD ; MAKE SURE 1241 1242 %if 0 1243 ; DOSINIT has set up a default "process" (PHP) at DS:0. We will move it out 1244 ; of the way by putting it just below SYSINIT at end of memory. 1245 MOV BX,CS 1246 SUB BX,10H 1247 MOV ES,BX 1248 XOR SI,SI 1249 MOV DI,SI 1250 MOV CX,80H 1251 REP MOVSW 1252 MOV WORD PTR [ES:PDB_JFN_Pointer + 2],ES ; Relocate 1253 SET_CURRENT_PDB equ Set_Current_PDB ; NASM port equate 1254 MOV AH,SET_CURRENT_PDB 1255 INT 21H ; Tell DOS we moved it 1256 %endif 1257 0 00004C13 0E PUSH CS 0 00004C14 1F POP DS 1260 ASSUME DS:SYSINITGROUP 1261 1262 %if 0 1263 MOV BX,0FFFFH 1264 ALLOC equ Alloc ; NASM port equate 1265 MOV AH,ALLOC 1266 INT 21H ;FIRST TIME FAILS 1267 MOV AH,ALLOC 1268 INT 21H ;SECOND TIME GETS IT 1269 MOV [AREA],AX 1270 MOV [MEMHI],AX ; MEMHI:MEMLO now points to 1271 ; start of free memory 1272 %endif 1273 %IF ALTVECT 1274 MOV DX,OFFSET BOOTMES 1275 invoke PRINT ;Print message DOSINIT couldn't 1276 %ENDIF 1277 1278 ASSUME DS:NOTHING 1279 0 00004C15 368A16[1C08] MOV DL,[ss:DEFAULT_DRIVE] 0 00004C1A 08D2 OR DL,DL 0 00004C1C 7406 JZ NODRVSET ; BIOS didn't say 0 00004C1E FECA DEC DL ;A = 0 1284 SET_DEFAULT_DRIVE equ Set_Default_Drive ; NASM port equate 0 00004C20 B40E MOV AH,SET_DEFAULT_DRIVE 0 00004C22 CD21 INT 21H ;SELECT THE DISK 1287 ;J.K. 2/23/87 Modified to handle INSTALL= command. 1288 NODRVSET: 0 00004C24 E8[0000] CALL DOCONF ;DO THE CONFIG STUFF 1290 1291 do_altah: 1292 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1293 extern altah_option, configmsg.altah_message, configmsg.altah_message.error 1294 extern incompatible_ALTAH, altah_indirect 1295 extern sysinit_get_ds_dosbiodata, sysinit_get_es_dosentry 1296 0 00004C27 2ED006[0000] rol byte [cs:altah_option], 1 0 00004C2C 736F jnc .none 1299 0 00004C2E B448 mov ah, 48h 0 00004C30 31DB xor bx, bx 0 00004C32 CD21 int 21h 0 00004C34 7261 jc .error 0 00004C36 8EC0 mov es, ax 1305 assume es:nothing 1306 1307 altah_want equ 61Bh + 700h 0 00004C38 3DD100 cmp ax, paras(altah_want & ~15) 0 00004C3B 7756 ja .error_free 0 00004C3D BBD200 mov bx, paras(altah_want + 1) 0 00004C40 29C3 sub bx, ax 0 00004C42 B44A mov ah, 4Ah 0 00004C44 CD21 int 21h 0 00004C46 724B jc .error_free 1315 0 00004C48 8CC0 mov ax, es 0 00004C4A 2EA3[2B08] mov word [cs:altah_block], ax 0 00004C4E 48 dec ax 0 00004C4F 8ED8 mov ds, ax 1320 assume ds:MCB 0 00004C51 C70601000800 mov word [mcbOwner], 8 0 00004C57 C70608005300 mov word [mcbName], "S" 0 00004C5D C6060A0034 mov byte [smcbType], S_EXCLDALTAH 1324 0 00004C62 31FF xor di, di 0 00004C64 B103 mov cl, 3 0 00004C66 D3E3 shl bx, cl 0 00004C68 89D9 mov cx, bx 0 00004C6A B8CCCC mov ax, 0CCCCh 0 00004C6D F3AB rep stosw 1331 0 00004C6F B8[0000] mov ax, DOSENTRY 0 00004C72 B104 mov cl, 4 0 00004C74 D3E0 shl ax, cl 0 00004C76 BF1B0D mov di, altah_want 0 00004C79 29C7 sub di, ax 0 00004C7B E8[0000] call sysinit_get_ds_dosbiodata 1338 assume ds:DOSGROUP 0 00004C7E E8[0000] call sysinit_get_es_dosentry 1340 assume es:DOSENTRYGROUP 0 00004C81 BB[0000] mov bx, incompatible_ALTAH 0 00004C84 FA cli 0 00004C85 268A07 mov al, [es:bx] 0 00004C88 893E[0000] mov word [altah_indirect], di 0 00004C8C AA stosb 0 00004C8D FB sti 1347 0 00004C8E BA[0000] mov dx, configmsg.altah_message 0 00004C91 EB07 jmp .done 1350 1351 .error_free: 0 00004C93 B449 mov ah, 49h 0 00004C95 CD21 int 21h 1354 .error: 0 00004C97 BA[0000] mov dx, configmsg.altah_message.error 1356 .done: 0 00004C9A E8311C call init2_disp_msg_asciz_cs_dx 1358 1359 .none: 1360 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1361 1362 extern hidedosentry_option, hidedosdatafirst_option, Arena_Head 1363 extern configmsg.hidedosentry_message 1364 extern configmsg.hidedosentry_error 1365 extern configmsg.hidedosdata_message 1366 extern configmsg.hidedosdata_error 1367 hide_dosentry: 0 00004C9D 2ED006[0000] rol byte [cs:hidedosentry_option], 1 0 00004CA2 733C jnc .no 0 00004CA4 E8[0000] call sysinit_get_ds_dosbiodata 1371 assume ds:DOSGROUP 0 00004CA7 A1[0000] mov ax, word [Arena_Head] 0 00004CAA 8EC0 mov es, ax 1374 assume es:MCB 0 00004CAC 26803E00004D cmp byte [es:mcbSignature], 'M' 0 00004CB2 7526 jne .error 0 00004CB4 26833E010008 cmp word [es:mcbOwner], 8 0 00004CBA 751E jne .error 0 00004CBC 26833E080053 cmp word [es:mcbName], "S" 0 00004CC2 7516 jne .error 0 00004CC4 26803E0A0001 cmp byte [es:smcbType], S_DOSENTRY 0 00004CCA 750E jne .error 0 00004CCC 2603060300 add ax, [es:mcbSize] 0 00004CD1 40 inc ax 0 00004CD2 A3[0000] mov word [Arena_Head], ax 0 00004CD5 BA[0000] mov dx, configmsg.hidedosentry_message 0 00004CD8 EB03 jmp .done 1388 1389 .error: 0 00004CDA BA[0000] mov dx, configmsg.hidedosentry_error 1391 .done: 0 00004CDD E8EE1B call init2_disp_msg_asciz_cs_dx 1393 1394 .no: 1395 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1396 1397 relocate_dosdata_first: 0 00004CE0 2ED006[0E08] rol byte [cs:dosdata_relocate_first], 1 0 00004CE5 736F jnc @F 0 00004CE7 31D2 xor dx, dx ; 0 = relocate in any case, LMA if needed 0 00004CE9 E8301C call relocate_dosdata 1402 1403 hide_dosdata_first: 0 00004CEC 2ED006[0000] rol byte [cs:hidedosdatafirst_option], 1 0 00004CF1 7363 jnc .no 0 00004CF3 E8[0000] call sysinit_get_ds_dosbiodata 1407 assume ds:DOSGROUP 0 00004CF6 A1[0000] mov ax, word [Arena_Head] 0 00004CF9 8CDB mov bx, ds 0 00004CFB 4B dec bx 1411 .loop: 0 00004CFC 8EC0 mov es, ax 1413 assume es:MCB 0 00004CFE 39D8 cmp ax, bx 0 00004D00 7420 je .found 0 00004D02 26803E00004D cmp byte [es:mcbSignature], 'M' 0 00004D08 7546 jne .error 0 00004D0A 26833E010008 cmp word [es:mcbOwner], 8 0 00004D10 753E jne .error 0 00004D12 26833E080053 cmp word [es:mcbName], "S" 0 00004D18 7536 jne .error 0 00004D1A 2603060300 add ax, word [es:mcbSize] 0 00004D1F 40 inc ax 0 00004D20 EBDA jmp .loop 1425 1426 .found: 0 00004D22 26803E00004D cmp byte [es:mcbSignature], 'M' 0 00004D28 7526 jne .error 0 00004D2A 26833E010008 cmp word [es:mcbOwner], 8 0 00004D30 751E jne .error 0 00004D32 26833E080053 cmp word [es:mcbName], "S" 0 00004D38 7516 jne .error 0 00004D3A 26803E0A0003 cmp byte [es:smcbType], S_DOSDATA 0 00004D40 750E jne .error 0 00004D42 2603060300 add ax, [es:mcbSize] 0 00004D47 40 inc ax 0 00004D48 A3[0000] mov word [Arena_Head], ax 0 00004D4B BA[0000] mov dx, configmsg.hidedosdata_message 0 00004D4E EB03 jmp .done 1440 1441 .error: 0 00004D50 BA[0000] mov dx, configmsg.hidedosdata_error 1443 .done: 0 00004D53 E8781B call init2_disp_msg_asciz_cs_dx 1445 1446 .no: 1447 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1448 1449 @@: 1450 1451 do_multi: 1452 assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 00004D56 2EFE06[6E08] inc byte [cs:Multi_Pass_Id] ;AN027; = 0 0 00004D5B E8[0000] call Multi_Pass ;AN027; 0 00004D5E 2EFE06[6E08] inc byte [cs:Multi_Pass_Id] ;AN027; = 1 0 00004D63 E8[0000] call Multi_Pass ;AN027; 0 00004D66 2EFE06[6E08] inc byte [cs:Multi_Pass_Id] ;AN024; = 2 0 00004D6B E8[0000] call Multi_Pass ;AN024; 1459 EndFile equ ENDFILE ; NASM port label 0 00004D6E E84407 call EndFile 0 00004D71 36F706[7008]0100 test word [ss:Install_Flag], HAVE_INSTALL_CMD ;AN019; 0 00004D78 740B jz DoLast ;AN019; 0 00004D7A E86705 call relocate_config 0 00004D7D 2EFE06[6E08] inc byte [cs:Multi_Pass_Id] ;AN024; = 3 0 00004D82 E8[0000] call Multi_Pass ;AN019;AN024; Execute INSTALL= commands 1466 1467 ;J.K. [AREA] has the segment address for the allocated memory of SYSINIT,CONFBOT. 1468 ;Free the CONFBOT area used for CONFIG.SYS and SYSINIT itself. 1469 DoLast: 1470 0 00004D85 B8FFFF mov ax, -1 0 00004D88 E8F013 call init2_relocate_device 0 00004D8B B8FFFF mov ax, -1 0 00004D8E E8E41B call init2_relocate_end 1475 1476 extern dosdata_to_doscode 1477 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1478 1479 1480 relocate_upb_late: 0 00004D91 E8[0000] call sysinit_get_ds_dosentry ; DRVMAX in DOSENTRY 1482 assume ds:DOSENTRYGROUP 0 00004D94 31F6 xor si, si 0 00004D96 8A2E[0000] mov ch, [DRVMAX] ; ch = how many UPBs 1485 %ifnidni %[DOSBIODATA], %[DOSENTRY] 0 00004D9A E8[0000] call sysinit_get_ds_dosbiodata 1487 assume ds:DOSGROUP 1488 %endif 0 00004D9D C43E[0000] les di, [START_BDS] ; es:di -> first UPB 1490 assume es:UPB 0 00004DA1 83FFFF cmp di, -1 ; none ? 0 00004DA4 7503E90C01 je .warn ; then skip --> 0 00004DA9 84ED test ch, ch 0 00004DAB 7503E90501 jz .warn 1495 ; Harden: Expect UPBs at start of memory block. 0 00004DB0 85FF test di, di 0 00004DB2 7403E9FE00 jnz .warn 0 00004DB7 8CC0 mov ax, es 0 00004DB9 48 dec ax 0 00004DBA 8ED8 mov ds, ax 1501 assume ds:MCB 0 00004DBC 837C0108 cmp word [si + mcbOwner], 8 ; an S MCB ? 0 00004DC0 7403E9F000 jne .warn 0 00004DC5 837C0853 cmp word [si + mcbName], "S" ; S MCB ? 0 00004DC9 7403E9E700 jne .warn 0 00004DCE 807C0A09 cmp byte [si + smcbType], S_UPB ; correct type ? 0 00004DD2 7403E9DE00 jne .warn 0 00004DD7 8B4403 mov ax, [si + mcbSize] 0 00004DDA B104 mov cl, 4 0 00004DDC D3E0 shl ax, cl ; = size in bytes 0 00004DDE 89C3 mov bx, ax 0 00004DE0 D3E8 shr ax, cl ; compute paragraphs again 0 00004DE2 394403 cmp word [si + mcbSize], ax ; match ? 0 00004DE5 7403E9CB00 jne .warn 0 00004DEA B064 mov al, BDS_TYPE_struc_size 0 00004DEC F6E5 mul ch ; ax = how many bytes needed for UPBs 0 00004DEE 39C3 cmp bx, ax ; last UPB fits below size ? 0 00004DF0 7303E9C000 jb .warn ; no --> 0 00004DF5 89C2 mov dx, ax 0 00004DF7 83C20F add dx, 15 0 00004DFA 80E2F0 and dl, ~ 15 0 00004DFD 39D3 cmp bx, dx 0 00004DFF 7403E9B100 jne .warn 1524 0 00004E04 88E9 mov cl, ch 0 00004E06 84C9 test cl, cl 0 00004E08 7503E9A800 jz .warn 0 00004E0D 06 push es 0 00004E0E 57 push di 1530 .loop: 0 00004E0F 80F901 cmp cl, 1 0 00004E12 741C je .last 0 00004E14 8CC3 mov bx, es 0 00004E16 26395D02 cmp word [es:di + LINK + 2], bx 0 00004E1A 7403E99400 jne .warn_pop_pop 0 00004E1F 8D5D64 lea bx, [di + BDS_TYPE_struc_size] 0 00004E22 26391D cmp word [es:di + LINK], bx 0 00004E25 7403E98900 jne .warn_pop_pop 0 00004E2A 49 dec cx ; count down 0 00004E2B 26C43D les di, [es:di + LINK] 1541 assume es:UPB 0 00004E2E EBDF jmp .loop 1543 1544 .last: 0 00004E30 26833DFF cmp word [es:di + LINK], -1 0 00004E34 7408 je @F 0 00004E36 8CC3 mov bx, es 0 00004E38 26395D02 cmp word [es:di + LINK + 2], bx 0 00004E3C 7477 je .warn 1550 @@: 1551 0 00004E3E BE[C821] mov si, alloc_upb 0 00004E41 51 push cx 0 00004E42 50 push ax 0 00004E43 E8801C call allocate_relocate_block 1556 assume es:nothing 0 00004E46 59 pop cx ; = size of initialised UPBs 0 00004E47 5B pop bx ; bh = number of UPBs 0 00004E48 5E pop si 0 00004E49 1F pop ds ; -> first UPB source 1561 assume ds:UPB 0 00004E4A 56 push si 0 00004E4B 89FA mov dx, di ; es:dx -> destination 0 00004E4D F3A4 rep movsb ; copy them over 0 00004E4F 89D7 mov di, dx ; es:di -> copied UPBs 0 00004E51 89D6 mov si, dx ; es:si -> first UPB in new allocation 0 00004E53 31C9 xor cx, cx 0 00004E55 08F9 or cl, bh ; cx = amount UPBs 0 00004E57 5B pop bx ; ds:bx -> source 0 00004E58 8CDA mov dx, ds 0 00004E5A 7438 jz .warn_free 1572 .newloop: 0 00004E5C 49 dec cx 0 00004E5D 741E jz .newlast 0 00004E5F 26395502 cmp word [es:di + LINK + 2], dx 0 00004E63 752F jne .warn_free 0 00004E65 8D4764 lea ax, [bx + BDS_TYPE_struc_size] 1578 ; ds:ax -> next expected source UPB 0 00004E68 263905 cmp word [es:di + LINK], ax 0 00004E6B 7527 jne .warn_free 0 00004E6D 93 xchg bx, ax ; ds:bx -> next source UPB 1582 ; ! in HMA allocstion the offset is changed 0 00004E6E 8D4564 lea ax, [di + BDS_TYPE_struc_size] 1584 ; es:di -> next destination 0 00004E71 268C4502 mov word [es:di + LINK + 2], es ; relocate next link segment 0 00004E75 268905 mov word [es:di + LINK], ax ; relocate next link offset 0 00004E78 26C43D les di, [es:di + LINK] 1588 assume es:nothing 0 00004E7B EBDF jmp .newloop 1590 1591 .newlast: 1592 ; ! last relocated UPB's next link pointer is left alone 1593 0 00004E7D E8[0000] call sysinit_get_ds_dosbiodata 1595 assume ds:DOSGROUP 0 00004E80 FA cli 0 00004E81 8CC0 mov ax, es 0 00004E83 8936[0000] mov word [START_BDS], si 0 00004E87 8706[0200] xchg word [START_BDS + 2], ax ; relocate the UPBs 0 00004E8B FB sti 0 00004E8C 8EC0 mov es, ax 1602 assume es:nothing 0 00004E8E B449 mov ah, 49h 0 00004E90 CD21 int 21h ; free the original allocation 0 00004E92 EB30 jmp .done 1606 1607 .warn_free: 0 00004E94 8CC3 mov bx, es 0 00004E96 83FBFE cmp bx, -2 ; HMA ? 0 00004E99 7213 jb @F ; no --> 0 00004E9B 7706 ja .warn_free_hma_essi ; it is es == 0FFFFh --> 1612 ; it is es == 0FFFEh 0 00004E9D 43 inc bx ; = 0FFFFh 0 00004E9E 8EC3 mov es, bx ; es = 0FFFFh 1615 assume es:nothing 0 00004EA0 83EE10 sub si, 16 ; es:si -> HMA allocation 1617 .warn_free_hma_essi: 0 00004EA3 89F7 mov di, si 0 00004EA5 B8034A mov ax, 4A03h 0 00004EA8 B202 mov dl, 2 0 00004EAA CD2F int 2Fh ; free new HMA allocation 0 00004EAC EB07 jmp .warn 1623 1624 @@: 0 00004EAE B449 mov ah, 49h 0 00004EB0 CD21 int 21h ; free new LMA/UMA allocation 0 00004EB2 A9 db __TEST_IMM16 ; skip twice pop 1628 .warn_pop_pop: 0 00004EB3 58 pop ax 0 00004EB4 58 pop ax 1631 .warn: 0 00004EB5 0E push cs 0 00004EB6 1F pop ds 1634 assume ds:SYSINITGROUP 0 00004EB7 BA[C723] mov dx, sysinit_msg.warn_upb 0 00004EBA B92800 mov cx, sysinit_msg.warn_upb.size 0 00004EBD BB0100 mov bx, 1 0 00004EC0 B440 mov ah, 40h 0 00004EC2 CD21 int 21h 1640 .done: 1641 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1642 1643 1644 relocate_dpb_late: 0 00004EC4 E8[0000] call sysinit_getdosdata 0 00004EC7 8ED8 mov ds, ax 1647 assume ds:DOSGROUP 0 00004EC9 31F6 xor si, si 0 00004ECB 8A2E[0000] mov ch, [NUMIO] ; ch = how many DPBs at most 0 00004ECF C43E[0000] les di, [DPBHEAD] ; es:di -> first DPB 1651 assume es:DPB 0 00004ED3 83FFFF cmp di, -1 ; none ? 0 00004ED6 7503E98401 je .warn ; then skip --> 0 00004EDB 84ED test ch, ch 0 00004EDD 7503E97D01 jz .warn 1656 ; Harden: Expect DPBs at start of memory block. 0 00004EE2 85FF test di, di 0 00004EE4 7403E97601 jnz .warn 0 00004EE9 8CC0 mov ax, es 0 00004EEB 48 dec ax 0 00004EEC 8ED8 mov ds, ax 1662 assume ds:MCB 1663 ; We expect at least two DOS-internal DPBs. 1664 ; Although we do somewhat work if none are 1665 ; used, we can warn here anyway. 0 00004EEE 837C0108 cmp word [si + mcbOwner], 8 ; an S MCB ? 0 00004EF2 7403E96801 jne .warn 0 00004EF7 837C0853 cmp word [si + mcbName], "S" ; S MCB ? 0 00004EFB 7403E95F01 jne .warn 0 00004F00 807C0A08 cmp byte [si + smcbType], S_DPB ; correct type ? 0 00004F04 7403E95601 jne .warn 0 00004F09 8B4403 mov ax, [si + mcbSize] 0 00004F0C 89C2 mov dx, ax 0 00004F0E B104 mov cl, 4 0 00004F10 D3E0 shl ax, cl ; = size in bytes 0 00004F12 D3E8 shr ax, cl ; compute paragraphs again 0 00004F14 394403 cmp word [si + mcbSize], ax ; match ? 0 00004F17 7403E94301 jne .warn 1679 0 00004F1C 88E9 mov cl, ch 0 00004F1E 84C9 test cl, cl 0 00004F20 7503E93A01 jz .warn 0 00004F25 B500 mov ch, 0 0 00004F27 06 push es 0 00004F28 57 push di 1686 .loop: 0 00004F29 FEC5 inc ch 0 00004F2B 80F901 cmp cl, 1 0 00004F2E 7418 je .last 0 00004F30 8CC3 mov bx, es 0 00004F32 26395D1B cmp word [es:di + dpb_next_dpb + 2], bx 0 00004F36 7522 jne .havelast_pop_pop 0 00004F38 8D5D21 lea bx, [di + dpb_struc_size] 0 00004F3B 26395D19 cmp word [es:di + dpb_next_dpb], bx 0 00004F3F 7519 jne .havelast_pop_pop 0 00004F41 49 dec cx ; count down 0 00004F42 26C47D19 les di, [es:di + dpb_next_dpb] 1698 assume es:DPB 0 00004F46 EBE1 jmp .loop 1700 1701 .last: 0 00004F48 26837D19FF cmp word [es:di + dpb_next_dpb], -1 0 00004F4D 740B je @F 0 00004F4F 8CC3 mov bx, es 0 00004F51 26395D1B cmp word [es:di + dpb_next_dpb + 2], bx 0 00004F55 7503E90301 je .warn_pop_pop 1707 @@: 1708 .havelast_pop_pop: 0 00004F5A 8D4521 lea ax, [di + dpb_struc_size] 0 00004F5D 50 push ax 0 00004F5E E81C09 call ParaRound 0 00004F61 39D0 cmp ax, dx ; MCB size matches ? 0 00004F63 58 pop ax 0 00004F64 7403E9F400 jne .warn_pop_pop 1715 0 00004F69 BE[DC21] mov si, alloc_dpb 0 00004F6C 51 push cx 0 00004F6D 50 push ax 0 00004F6E E8551B call allocate_relocate_block 1720 assume es:nothing 0 00004F71 59 pop cx ; = size of relocateable DPBs 0 00004F72 5B pop bx ; bh = number of relocateable DPBs 0 00004F73 5E pop si 0 00004F74 1F pop ds ; -> first DPB source 1725 assume ds:UPB 0 00004F75 56 push si 0 00004F76 89FA mov dx, di ; es:dx -> destination 0 00004F78 F3A4 rep movsb ; copy them over 0 00004F7A 89D7 mov di, dx ; es:di -> copied DPBs 0 00004F7C 89D6 mov si, dx ; es:si -> first DPB in new allocation 0 00004F7E 31C9 xor cx, cx 0 00004F80 08F9 or cl, bh ; cl = amount relocated DPBs 0 00004F82 5B pop bx ; ds:bx -> source 0 00004F83 89DD mov bp, bx ; dx:bp -> first source DPB 0 00004F85 88CD mov ch, cl ; ch = amount relocated DPBs 0 00004F87 8CDA mov dx, ds 0 00004F89 7503E9B000 jz .warn_free 1738 .newloop: 0 00004F8E FEC9 dec cl 0 00004F90 7427 jz .newlast 0 00004F92 2639551B cmp word [es:di + dpb_next_dpb + 2], dx 0 00004F96 7403E9A300 jne .warn_free 0 00004F9B 8D4721 lea ax, [bx + dpb_struc_size] 1744 ; ds:ax -> next expected source UPB 0 00004F9E 26394519 cmp word [es:di + dpb_next_dpb], ax 0 00004FA2 7403E99700 jne .warn_free 0 00004FA7 93 xchg bx, ax ; ds:bx -> next source UPB 1748 ; ! in HMA allocstion the offset is changed 0 00004FA8 8D4521 lea ax, [di + dpb_struc_size] 1750 ; es:di -> next destination 0 00004FAB 268C451B mov word [es:di + dpb_next_dpb + 2], es ; relocate next link segment 0 00004FAF 26894519 mov word [es:di + dpb_next_dpb], ax ; relocate next link offset 0 00004FB3 26C47D19 les di, [es:di + dpb_next_dpb] 1754 assume es:nothing 0 00004FB7 EBD5 jmp .newloop 1756 1757 .newlast: 1758 ; ! last relocated DPB's next link pointer is left alone 1759 1760 ; now we have to relocate all references to the DPBs. 1761 ; there's buffers, CDSes, SFTs, and FCB SFTs. 1762 ; INP: dx:bp -> first relocated DPB source 1763 ; ch = amount 1764 ; es:si -> first destination DPB 0 00004FB9 06 push es 0 00004FBA 56 push si 0 00004FBB 88E9 mov cl, ch 0 00004FBD B500 mov ch, 0 1769 1770 extern BUFFHEAD, CDSADDR, CDSCOUNT, sft_addr, sftFCB 1771 1772 .relocloop: 0 00004FBF 51 push cx 1774 1775 %ifndef BUF2 1776 %fatal DPB reloc not done for non-BUF2 1777 %endif 1778 0 00004FC0 E8[0000] call sysinit_getdosdata 0 00004FC3 8ED8 mov ds, ax 1781 assume ds:DOSGROUP 0 00004FC5 C53E[0000] lds di, [BUFFHEAD] 1783 assume ds:nothing 1784 @@: 0 00004FC9 83FFFF cmp di, -1 0 00004FCC 7410 je @FF 0 00004FCE 807D04FF cmp byte [di + BUFDRV], -1 0 00004FD2 7406 je @F 0 00004FD4 BB0C00 mov bx, BUFDRVDP 0 00004FD7 E85603 call relocate_dibx_dpb_from_dxbp_to_essi 1791 @@: 0 00004FDA C53D lds di, [di + NEXTBUF] 1793 assume ds:nothing 0 00004FDC EBEB jmp @BB 1795 1796 @@: 1797 0 00004FDE E8[0000] call sysinit_getdosdata 0 00004FE1 8ED8 mov ds, ax 1800 assume ds:DOSGROUP 0 00004FE3 8A0E[0000] mov cl, byte [CDSCOUNT] ; ch already 0 0 00004FE7 C53E[0000] lds di, [CDSADDR] 1803 assume ds:nothing 1804 @@: 0 00004FEB F6454480 testopt [di + curdir_flags], curdir_isnet 1806 ; net or IFS ? 0 00004FEF 7506 jnz @F ; yes, don't check --> 0 00004FF1 BB4500 mov bx, curdir_devptr 0 00004FF4 E83903 call relocate_dibx_dpb_from_dxbp_to_essi 1810 @@: 0 00004FF7 83C758 add di, curdir_list_struc_size 0 00004FFA E2EF loop @BB 1813 0 00004FFC E8[0000] call sysinit_getdosdata 0 00004FFF 8ED8 mov ds, ax 1816 assume ds:DOSGROUP 0 00005001 C53E[0000] lds di, [sft_addr] 1818 assume ds:nothing 0 00005005 E83903 call reloc_dpb_in_sftc 1820 0 00005008 E8[0000] call sysinit_getdosdata 0 0000500B 8ED8 mov ds, ax 1823 assume ds:DOSGROUP 0 0000500D C53E[0000] lds di, [sftFCB] 1825 assume ds:nothing 0 00005011 E82D03 call reloc_dpb_in_sftc 1827 1828 .relocnext: 0 00005014 59 pop cx 0 00005015 26C47419 les si, [es:si + dpb_next_dpb] 1831 assume es:nothing 0 00005019 8EDA mov ds, dx 1833 assume ds:nothing 0 0000501B 3EC56E19 lds bp, [ds:bp + dpb_next_dpb] 1835 assume ds:nothing 0 0000501F 8CDA mov dx, ds 0 00005021 E29C loop .relocloop 1838 0 00005023 5E pop si 0 00005024 07 pop es 1841 assume es:nothing 1842 0 00005025 E8[0000] call sysinit_getdosdata 0 00005028 8ED8 mov ds, ax 1845 assume ds:DOSGROUP 0 0000502A FA cli 0 0000502B 8CC0 mov ax, es 0 0000502D 8936[0000] mov word [DPBHEAD], si 0 00005031 8706[0200] xchg word [DPBHEAD + 2], ax ; relocate the DPBs 0 00005035 FB sti 0 00005036 8EC0 mov es, ax 1852 assume es:nothing 0 00005038 B449 mov ah, 49h 0 0000503A CD21 int 21h ; free the original allocation 0 0000503C EB30 jmp .done 1856 1857 .warn_free: 0 0000503E 8CC3 mov bx, es 0 00005040 83FBFE cmp bx, -2 ; HMA ? 0 00005043 7213 jb @F ; no --> 0 00005045 7706 ja .warn_free_hma_essi ; it is es == 0FFFFh --> 1862 ; it is es == 0FFFEh 0 00005047 43 inc bx ; = 0FFFFh 0 00005048 8EC3 mov es, bx ; es = 0FFFFh 1865 assume es:nothing 0 0000504A 83EE10 sub si, 16 ; es:si -> HMA allocation 1867 .warn_free_hma_essi: 0 0000504D 89F7 mov di, si 0 0000504F B8034A mov ax, 4A03h 0 00005052 B202 mov dl, 2 0 00005054 CD2F int 2Fh ; free new HMA allocation 0 00005056 EB07 jmp .warn 1873 1874 @@: 0 00005058 B449 mov ah, 49h 0 0000505A CD21 int 21h ; free new LMA/UMA allocation 0 0000505C A9 db __TEST_IMM16 ; skip twice pop 1878 .warn_pop_pop: 0 0000505D 58 pop ax 0 0000505E 58 pop ax 1881 .warn: 0 0000505F 0E push cs 0 00005060 1F pop ds 1884 assume ds:SYSINITGROUP 0 00005061 BA[EF23] mov dx, sysinit_msg.warn_dpb 0 00005064 B92800 mov cx, sysinit_msg.warn_dpb.size 0 00005067 BB0100 mov bx, 1 0 0000506A B440 mov ah, 40h 0 0000506C CD21 int 21h 1890 .done: 1891 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1892 1893 1894 %imacro neartransfer 1.nolist 1895 extern %1 1896 call transfer_sysinitseg_to_doscode 1897 jmp strict short %%skip 1898 dw %1 1899 %%skip: 1900 %endmacro 1901 1902 extern transfer_sysinitseg_to_doscode 1903 1904 shrink_altah_block: 0 0000506E 2EA1[2B08] mov ax, word [cs:altah_block] 0 00005072 85C0 test ax, ax 0 00005074 7434 jz .none 0 00005076 48 dec ax 0 00005077 8ED8 mov ds, ax 1910 assume ds:MCB 0 00005079 8B1E0300 mov bx, word [mcbSize] 0 0000507D 31FF xor di, di 0 0000507F 83FB01 cmp bx, 1 0 00005082 7626 jbe .done 0 00005084 BA0800 mov dx, 8 0 00005087 8D4FFE lea cx, [bx - 2] 0 0000508A E8[0000]EB02[0000] neartransfer SplitMCB 0 00005091 E8[0000]EB02[0000] neartransfer ClearMCB 0 00005098 8EDA mov ds, dx 1920 assume ds:MCB 0 0000509A C606080053 mov byte [mcbName], 'S' 0 0000509F C6060A0034 mov byte [smcbType], S_EXCLDALTAH 0 000050A4 42 inc dx 0 000050A5 2E8916[2B08] mov word [cs:altah_block], dx 1925 .done: 1926 .none: 1927 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1928 1929 1930 relocate_psp_late: 0 000050AA B86000 mov ax, 60h 0 000050AD BE[B421] mov si, alloc_initpsp 0 000050B0 E8131A call allocate_relocate_block 1934 assume es:nothing 0 000050B3 B462 mov ah, 62h 0 000050B5 CD21 int 21h ; get old PSP 0 000050B7 8EDB mov ds, bx 1938 assume ds:nothing 0 000050B9 89DA mov dx, bx 0 000050BB 31F6 xor si, si ; ds:si -> old PSP 0 000050BD B93000 mov cx, words(60h) 0 000050C0 F3A5 rep movsw 0 000050C2 8CC0 mov ax, es 1944 1945 ; Because of the abort.nas "Scan" handling we 1946 ; have to relocate the owner process of open 1947 ; SFT entries that we want to keep across the 1948 ; process termination. This code may become 1949 ; useless once we improve "Scan" but it won't 1950 ; do any harm to keep doing this. 0 000050C4 1E push ds 0 000050C5 E8[0000] call sysinit_get_ds_dosbiodata 1953 assume ds:DOSGROUP 0 000050C8 C536[0000] lds si, [sft_addr] 1955 assume ds:nothing 1956 .loop_sftc: 0 000050CC 46 inc si 0 000050CD 7421 jz .done_sftc 0 000050CF 56 push si 0 000050D0 8B4C03 mov cx, word [si - 1 + SFCount] 0 000050D3 E315 jcxz .next_sftc 0 000050D5 83C605 add si, SFTable - 1 1963 .loop_sft: 0 000050D8 833C00 cmp word [si + sf_ref_count], 0 0 000050DB 7408 je .next_sft 0 000050DD 395431 cmp word [si + sf_PID], dx 0 000050E0 7503 jne .next_sft 0 000050E2 894431 mov word [si + sf_PID], ax 1969 .next_sft: 0 000050E5 83C63B add si, sf_entry_struc_size 0 000050E8 E2EE loop .loop_sft 1972 .next_sftc: 0 000050EA 5E pop si 0 000050EB C574FF lds si, [si - 1 + SFLink] 1975 assume ds:nothing 0 000050EE EBDC jmp .loop_sftc 1977 .done_sftc: 0 000050F0 1F pop ds 1979 assume ds:nothing 1980 1981 ; mov es, ax ; es = new PSP 0 000050F1 BF1800 mov di, 18h 0 000050F4 B91400 mov cx, 20 0 000050F7 26A33600 mov word [ es:34h+2 ], ax 0 000050FB 26893E3400 mov word [ es:34h ], di ; fix the new PSP's PHT pointer 0 00005100 26890E3200 mov word [ es:32h ], cx ; and the count of PHT entries field 0 00005105 50 push ax 0 00005106 B0FF mov al, -1 0 00005108 57 push di 0 00005109 89CB mov bx, cx ; = 20 0 0000510B F3AA rep stosb ; initialise new PHT with empty entries 0 0000510D 5F pop di 0 0000510E 8B0E3200 mov cx, word [ 32h ] ; cx = count of PHT entries 0 00005112 39D9 cmp cx, bx ; >= 20 ? 0 00005114 7202 jb .shortertable ; no --> 0 00005116 89D9 mov cx, bx ; limit to 20 1997 .shortertable: 0 00005118 C5363400 lds si, [ 34h ] ; ds:si-> old PHT 0 0000511C 56 push si 0 0000511D 51 push cx 0 0000511E F3A4 rep movsb ; get all entries 0 00005120 59 pop cx 0 00005121 5F pop di 0 00005122 1E push ds 0 00005123 07 pop es ; es:di-> old PHT 2006 assume es:nothing 0 00005124 F3AA rep stosb ; fill moved entries with -1 (closed) 0 00005126 8EDA mov ds, dx ; ds = old PSP 2009 assume ds:nothing 0 00005128 C7060A00[BB08] mov word [ 0Ah ], .terminated 0 0000512E 8C0E0C00 mov word [ 0Ah+2 ], cs 0 00005132 B82335 mov ax, 3523h 0 00005135 CD21 int 21h 0 00005137 891E0E00 mov word [ 0Eh ], bx 0 0000513B 8C061000 mov word [ 0Eh+2 ], es 0 0000513F B82435 mov ax, 3524h 0 00005142 CD21 int 21h 0 00005144 891E1200 mov word [ 12h ], bx 0 00005148 8C061400 mov word [ 12h+2 ], es ; set interrupt vectors to ours 0 0000514C 58 pop ax 0 0000514D A31600 mov word [ 16h ], ax ; set parent PSP to the relocated one 0 00005150 8EC0 mov es, ax 2023 assume es:nothing 0 00005152 268C163000 mov word [ es:2Eh+2 ], ss 2025 ; set SS used by process termination 2026 0 00005157 93 xchg ax, bx ; bx = new location, dx = old location 0 00005158 B85D33 mov ax, 335Dh 0 0000515B CD21 int 21h ; PSP relocated call-out 0 0000515D 89D7 mov di, dx 2031 2032 ; In order to set the correct stack address here, 2033 ; the last Int21 call to a usual function (such as 2034 ; Int21.48) must've been made with the same stack 2035 ; pointer as the Int21.4C call below gets. 2036 ; 2037 ; Update: dosemu2 does weird things to the stack. 2038 ; In particular, it inserts an additional iret 2039 ; frame depending on some conditions. 2040 ; Only the interrupt 21h subfunctions 00h, 26h, 2041 ; 31h, 4Bh, and 4Ch are handled differently. 2042 ; As a workaround we can call service 4Bh as the 2043 ; last interrupt 21h function before terminating. 2044 ; Refer to https://github.com/dosemu2/dosemu2/blob/d7402eec84478c051d25e7b26dd8515514c186e2/src/base/core/int.c#L1633-L1639 2045 2046 ; rol byte [j_flags.invalidexec], 1 2047 ; jnc @F 2048 0 0000515F 0E push cs 0 00005160 1F pop ds 2051 assume ds:SYSINITGROUP 0 00005161 BA[1724] mov dx, sysinit_msg.nullbyte 2053 ; just in case, ds:dx -> zero value byte 0 00005164 B87F4B mov ax, 4B7Fh ; 21.4B with invalid subfunction in al 2055 ; (note that FreeDOS masks off 80h) 0 00005167 CD21 int 21h 2057 @@: 2058 0 00005169 8EDF mov ds, di 2060 assume ds:nothing 0 0000516B 8EC3 mov es, bx 2062 assume es:nothing 0 0000516D FF362E00 push word [ 2Eh ] 0 00005171 268F062E00 pop word [ es:2Eh ] ; set SP used by process termination 2065 .nullbyte: equ $ - 1 2066 0 00005176 B8004C mov ax, 4C00h 0 00005179 CD21 int 21h ; terminate, and make the new PSP active 2069 ; also handles freeing all memory allocated to the old PSP 2070 ; also closes any handles >20 if PHT larger 2071 ; also relocates Int23, Int24 2072 ; also notifies resident software old PSP is no longer valid 2073 .terminated: ; (ax, bx, es, ds, bp might be changed) 2074 assume ds:nothing, es:nothing, ss:SYSINITGROUP 2075 0 0000517B 36F706[7008]0100 test word [ss:Install_Flag], HAVE_INSTALL_CMD ;AN019; 0 00005182 740B jz @F ;AN019; 0 00005184 E85D01 call relocate_config 0 00005187 2EFE06[6E08] inc byte [cs:Multi_Pass_Id] ; = 4 0 0000518C E8[0000] call Multi_Pass ; Execute INSTALLLAST= 2081 @@: 2082 assume ds:nothing, es:nothing, ss:SYSINITGROUP 2083 0 0000518F 31C9 xor cx, cx 0 00005191 2E870E[2708] xchg cx, word [cs:config_block] 0 00005196 E306 jcxz @F 0 00005198 8EC1 mov es, cx 2088 assume es:nothing 0 0000519A B449 mov ah, 49h 0 0000519C CD21 int 21h 2091 @@: 2092 assume ds:nothing, es:nothing, ss:SYSINITGROUP 2093 0 0000519E 0E push cs 0 0000519F 1F pop ds 2096 assume ds:SYSINITGROUP 0 000051A0 0E push cs 0 000051A1 07 pop es 2099 assume ds:SYSINITGROUP, es:SYSINITGROUP, ss:SYSINITGROUP 2100 0 000051A2 E85B0B call LoadShare ;AN021; Try to load share.exe, if needed. 0 000051A5 2EC606[3909]01 mov byte [cs:DoNotShowNum], 1 ;AN000; Done with CONFIG.SYS. Do not show line number message. 2103 %if 0 2104 mov cx, [ss:area] ;AN000; 2105 mov es, cx ;AN000; 2106 mov ah, 49h ;AN000; Free allocated memory for command.com 2107 int 21h ;AN000; 2108 2109 Install_flag equ Install_Flag ; NASM port label 2110 test word [cs:Install_flag], HAS_INSTALLED ;AN013; SYSINIT_BASE installed? 2111 jz Skip_Free_SYSINITBASE ;AN013; No. 2112 ;Set Block from the Old_Area with Impossible_Owner_size. 2113 ;This will free the unnecessary SYSINIT_BASE that had been put in memory to 2114 ;handle INSTALL= command. 2115 push es ;AN013; 2116 push bx ;AN013; 2117 mov ax, [cs:Old_Area] ;AN013; 2118 mov es, ax ;AN013; 2119 mov bx, [cs:Impossible_Owner_Size] ;AN013; 2120 SETBLOCK equ Setblock ; NASM port equate 2121 mov ah, SETBLOCK ;AN013; 2122 int 21h ;AN013; 2123 MOV AX,ES ;AN013; 2124 DEC AX ;AN013; 2125 MOV ES,AX ;Point to arena 2126 MOV word [ES:arena_owner],8 ;Set impossible owner 2127 mov word ptr [es:arena_name], "SD" ; set SD name ; NASM port swapped text literals 2128 and word ptr [es:arena_name + 2], 0 ; NUL 2129 pop bx ;AN013; 2130 pop es ;AN013; 2131 Skip_Free_SYSINITBASE: ;AN013; 2132 %endif 2133 %IF NOEXEC 2134 MOV BP,DS ;SAVE COMMAND.COM SEGMENT 2135 PUSH DS 2136 POP ES 2137 MOV BX,CS 2138 SUB BX,10H ; Point to current PHP 2139 MOV DS,BX 2140 XOR SI,SI 2141 MOV DI,SI 2142 MOV CX,80H 2143 REP MOVSW ; Copy it to new location for shell 2144 MOV WORD PTR [ES:PDB_JFN_Pointer + 2],ES ; Relocate 2145 MOV BX,ES 2146 MOV AH,SET_CURRENT_PDB 2147 INT 21H ; Tell DOS we moved it 2148 PDB_PARENT_PID equ PDB_Parent_PID ; NASM port equate 2149 MOV [ES:PDB_PARENT_PID],ES ;WE ARE THE ROOT 2150 %ENDIF 2151 0 000051AB 0E PUSH CS 0 000051AC 1F POP DS 2154 ASSUME DS:SYSINITGROUP 2155 ; 2156 ; SET UP THE PARAMETERS FOR COMMAND 2157 ; 2158 0 000051AD BE[3008] MOV SI,OFFSET COMMAND_LINE+1 2160 2161 %IF NOEXEC 2162 MOV DI,81H 2163 %ELSE 0 000051B0 1E PUSH DS 0 000051B1 07 POP ES 2166 assume es:SYSINITGROUP 0 000051B2 89F7 MOV DI,SI 2168 %ENDIF 2169 0 000051B4 B1FF MOV CL,-1 2171 COMTRANLP: ;FIND LENGTH OF COMMAND LINE 0 000051B6 FEC1 INC CL 0 000051B8 AC LODSB 0 000051B9 AA STOSB ;COPY COMMAND LINE IN 0 000051BA 08C0 OR AL,AL 0 000051BC 75F8 JNZ COMTRANLP 0 000051BE 4F DEC DI 0 000051BF B00D MOV AL,CR ; CR terminate 0 000051C1 AA STOSB 2180 2181 %IF NOEXEC 2182 MOV [ES:80H],CL ; Set up header 2183 MOV AL,[DEFAULT_DRIVE] 2184 MOV [ES:5CH],AL 2185 %ELSE 0 000051C2 880E[2F08] MOV [COMMAND_LINE],CL ;Count 2187 %ENDIF 2188 0 000051C6 BA[0000] MOV DX,OFFSET COMMND ;NOW POINTING TO FILE DESCRIPTION 2190 2191 %IF NOEXEC 2192 MOV ES,BP ;SET LOAD ADDRESS 2193 MOV BX,100H 2194 CALL LDFIL ;READ IN COMMAND 2195 JC COMERR 2196 MOV DS,BP 2197 MOV DX,80H 2198 SET_DMA equ Set_DMA ; NASM port equate 2199 MOV AH,SET_DMA ;SET DISK TRANFER ADDRESS 2200 INT 21H 2201 CLI 2202 MOV SS,BP 2203 MOV SP,DX 2204 STI 2205 XOR AX,AX ;PUSH A WORD OF ZEROS 2206 PUSH AX 2207 PUSH BP ;SET HIGH PART OF JUMP ADDRESS 2208 MOV AX,100H 2209 PUSH AX ;SET LOW PART OF JUMP ADDRESS 2210 CCC PROC FAR 2211 RET ;CRANK UP COMMAND! 2212 CCC ENDP 2213 2214 %ELSE 2215 ; We are going to open the command interpreter and size it as is done in 2216 ; LDFIL. The reason we must do this is that SYSINIT is in free memory. If 2217 ; there is not enough room for the command interpreter, EXEC will probably 2218 ; overlay our stack and code so when it returns with an error SYSINIT won't be 2219 ; here to catch it. This code is not perfect (for instance .EXE command 2220 ; interpreters are possible) because it does its sizing based on the 2221 ; assumption that the file being loaded is a .COM file. It is close enough to 2222 ; correctness to be usable. 2223 0 000051C9 52 PUSH DX ; Save pointer to name 2225 2226 %if 0 2227 ; First, find out where the command interpreter is going to go. 2228 MOV BX,0FFFFH 2229 MOV AH,ALLOC 2230 INT 21H ;Get biggest piece 2231 MOV AH,ALLOC 2232 INT 21H ;SECOND TIME GETS IT 2233 JC MEMERRJX ; Oooops 2234 MOV ES,AX 2235 DEALLOC equ Dealloc ; NASM port equate 2236 MOV AH,DEALLOC 2237 INT 21H ; Give it right back 2238 MOV BP,BX 2239 ; ES:0 points to Block, and BP is the size of the block 2240 ; in para. 2241 2242 ; We will now adjust the size in BP DOWN by the size of SYSINIT. We 2243 ; need to do this because EXEC might get upset if some of the EXEC 2244 ; data in SYSINIT is overlayed during the EXEC. 2245 MOV BX,[MEMORY_SIZE] 2246 MOV AX,CS 2247 SUB BX,AX ; BX is size of SYSINIT in Para 2248 inc bx ; for SYSINIT S MCB 2249 SUB BP,BX ; BAIS down 2250 JC MEMERRJX ; No Way. 2251 2252 MOV AX,(OPEN << 8) ;OPEN THE FILE being EXECED 2253 STC ;IN CASE OF INT 24 2254 INT 21H 2255 JC COMERR ; Ooops 2256 MOV BX,AX ;Handle in BX 2257 XOR CX,CX 2258 XOR DX,DX 2259 MOV AX,(LSEEK << 8) | 2 2260 STC ;IN CASE OF INT 24 2261 INT 21H ; Get file size in DX:AX 2262 JC COMERR 2263 ; Convert size in DX:AX to para in AX 2264 ADD AX,15 ; Round up size for conversion to para 2265 ADC DX,0 2266 MOV CL,4 2267 SHR AX,CL 2268 MOV CL,12 2269 SHL DX,CL ; Low nibble of DX to high nibble 2270 OR AX,DX ; AX is now # of para for file 2271 ADD AX,10H ; 100H byte PHP 2272 CMP AX,BP ; Will it fit? 2273 JB OKLD ; Jump if yes. 2274 %else 0 000051CA EB03 jmp OKLD 2276 %endif 2277 2278 MEMERRJX: 0 000051CC E9[0000] JMP MEM_ERR 2280 2281 OKLD: 2282 %if 0 2283 MOV AH,CLOSE 2284 INT 21H ; Close file 2285 %endif 2286 OPEN equ Open ; NASM port equate 2287 LSEEK equ LSeek ; NASM port equate 2288 CLOSE equ Close ; NASM port equate 2289 2290 2291 INITSTACKSIZE equ fromparas(paras(160)) 0 000051CF B8A000 mov ax, INITSTACKSIZE 0 000051D2 BE[E621] mov si, alloc_initstack 0 000051D5 E8EE18 call allocate_relocate_block 0 000051D8 81C7A000 add di, INITSTACKSIZE 0 000051DC 5A POP DX ; Recover pointer to name 2297 0 000051DD 8CC0 mov ax, es ; use this as a stack if exec returns 0 000051DF FA cli 0 000051E0 8ED0 mov ss, ax 0 000051E2 89FC mov sp, di ; -> stack 2302 assume ss:nothing 0 000051E4 FB sti 2304 2305 loop_shell: 2306 extern backdoor_free_mcb_exec, backdoor_indicator 2307 extern shell_return_has_been_freed, shell_return_address 0 000051E5 BB[7009] mov bx, initpspmcb 0 000051E8 2EC6075A mov byte [cs:bx + mcbSignature], 'Z' 2310 ; pretend we are a valid process MCB 0 000051EC B104 mov cl, 4 0 000051EE D3EB shr bx, cl ; segment displacement 0 000051F0 43 inc bx ; pretend PSP 0 000051F1 E8[0000] call sysinit_getdosdata 0 000051F4 8EC0 mov es, ax 2316 assume es:DOSGROUP 0 000051F6 8CC8 mov ax, cs 0 000051F8 01D8 add ax, bx ; => our pseudo INIT PSP 0 000051FA 26A3[0000] mov word [es:backdoor_free_mcb_exec], ax 2320 ; enter owner for the backdoor free 0 000051FE 268C0E[0200] mov word [es:shell_return_address + 2], cs 0 00005203 26C706[0000][9E09] mov word [es:shell_return_address], sysinit_shellreturned 2323 ; ! must be set before next variable 0 0000520A BB[0000] mov bx, shell_return_has_been_freed 0 0000520D 26C60700 mov byte [es:bx], 0 ; indicate sysinit still allocated 0 00005211 268C06[0200] mov word [es:backdoor_indicator + 2], es 0 00005216 26891E[0000] mov word [es:backdoor_indicator], bx 0 0000521B 8CCB mov bx, cs 0 0000521D 4B dec bx 0 0000521E 8EC3 mov es, bx 2331 assume es:MCB 0 00005220 26A30100 mov word [es:mcbOwner], ax ; owned by backdoor owner 2333 0 00005224 0E push cs 0 00005225 1F pop ds 2336 assume ds:SYSINITGROUP 0 00005226 BE[3008] mov si, COMMAND_LINE + 1 0 00005229 0E push cs 0 0000522A 07 pop es 2340 assume es:SYSINITGROUP 0 0000522B BF[7608] mov di, Ldexec_FCB1 0 0000522E E88306 call parse_dssi_cmdline_to_esdi_fcbs 2343 ;AN000; Make a null environment segment 2344 ;AN000; by overlap JMP instruction of SYSINITSEG. 0 00005231 8326000000 and word [0], 0 0 00005236 BB[6008] mov bx, offset COMEXE ;AN000; ES:BX -> parm block. 2347 EXEC0_COM_LINE equ Exec0_com_line ; NASM port equate 2348 EXEC0_5C_FCB equ Exec0_5C_FCB ; NASM port equate 2349 EXEC0_6C_FCB equ Exec0_6C_FCB ; NASM port equate 0 00005239 8C1F mov [bx + EXEC0_ENVIRON], ds ;AN000; Set the environment seg. 0 0000523B 8C5F04 mov word [bx + EXEC0_COM_LINE+2], ds;AN000; Set the seg. 0 0000523E 8C5F08 mov word [bx + EXEC0_5C_FCB+2], ds ;AN000; 0 00005241 8C5F0C mov word [bx + EXEC0_6C_FCB+2], ds ;AN000; 2354 EXEC equ Exec ; NASM port equate 0 00005244 B8004B mov ax, EXEC << 8 ; Load and go 0 00005247 D006[0000] rol byte [shellhighflag], 1 0 0000524B D0D8 rcr al, 1 ; al = 80h if shellhigh= 0 0000524D F9 STC ;IN CASE OF INT 24 0 0000524E EA[A003][0000] jmp DOSENTRY - DOSENTRYADJUSTSEGMENT : run_int21_shell + DOSENTRYADJUSTOFFSET 2361 extern run_int21_shell ;GO START UP COMMAND 2362 %ENDIF 2363 ; NOTE FALL THROUGH IF EXEC RETURNS (an error) 2364 2365 COMERR: 0 00005253 BA[0000] MOV DX,OFFSET BADCOM ;WANT TO PRINT COMMAND ERROR 0 00005256 E8[0000] INVOKE BADFIL 2368 STALL: 0 00005259 CC int3 0 0000525A FB sti 0 0000525B F4 hlt 0 0000525C EBFB JMP STALL 2373 2374 2375 sysinit_shellreturned: 2376 0 0000525E 0E push cs 0 0000525F 1F pop ds 2379 assume ds:SYSINITGROUP 0 00005260 0E push cs 0 00005261 07 pop es 2382 assume es:SYSINITGROUP 2383 0 00005262 BA[FC0A] mov dx, msg.prompt 0 00005265 B92400 mov cx, msg.prompt.length 0 00005268 BB0100 mov bx, 1 0 0000526B B440 mov ah, 40h 0 0000526D CD21 int 21h 2389 2390 extern linein 0 0000526F BE[0000] mov si, COMMND 0 00005272 BF[0200] mov di, linein + 2 0 00005275 A8 db __TEST_IMM8 ; (skip stosb) 2394 @@: 0 00005276 AA stosb 0 00005277 AC lodsb 0 00005278 84C0 test al, al 0 0000527A 75FA jnz @B 2399 0 0000527C 31C0 xor ax, ax 0 0000527E 8B36[6208] mov si, word [COMEXE + EXEC0_COM_LINE] 0 00005282 AC lodsb ; = length of tail 0 00005283 91 xchg cx, ax 0 00005284 803C0D cmp byte [si], 13 0 00005287 740D je @F 0 00005289 803C09 cmp byte [si], 9 0 0000528C 7408 je @F 0 0000528E 803C20 cmp byte [si], 32 0 00005291 7403 je @F 0 00005293 B020 mov al, 32 0 00005295 AA stosb 2412 @@: 0 00005296 41 inc cx ; include the terminator CR 0 00005297 F3A4 rep movsb 2415 0 00005299 97 xchg ax, di 0 0000529A 2D[0300] sub ax, linein + 3 0 0000529D A2[0100] mov byte [linein + 1], al 2419 2420 .prompt: 0 000052A0 BA[0000] mov dx, linein 0 000052A3 CC int3 0 000052A4 B40A mov ah, 0Ah 0 000052A6 CD21 int 21h ; read input line 0 000052A8 B402 mov ah, 02h 0 000052AA B20D mov dl, 13 0 000052AC CD21 int 21h 0 000052AE B402 mov ah, 02h 0 000052B0 B20A mov dl, 10 0 000052B2 CD21 int 21h 2431 0 000052B4 BE[0200] mov si, linein + 2 2433 @@: 0 000052B7 AC lodsb 0 000052B8 3C20 cmp al, 32 0 000052BA 74FB je @B 0 000052BC 3C09 cmp al, 9 0 000052BE 74F7 je @B 2439 0 000052C0 BF[0000] MOV DI,OFFSET COMMND 0 000052C3 A9 db __TEST_IMM16 ; skip stosb, lodsb 2442 STORESHELL: 0 000052C4 AA stosb 0 000052C5 AC lodsb 2445 @@: 0 000052C6 3C20 cmp al, 32 0 000052C8 77FA ja STORESHELL 2448 2449 GETSHPARMS: 0 000052CA C60500 MOV BYTE PTR [DI],0 0 000052CD BF[3008] MOV DI,OFFSET COMMAND_LINE+1 0 000052D0 A8 db __TEST_IMM8 ; skip lodsb 2453 PARMLOOP: 0 000052D1 AC lodsb 0 000052D2 AA stosb 0 000052D3 3C0D cmp al, 13 0 000052D5 75FA jne PARMLOOP 2458 0 000052D7 97 xchg ax, di 0 000052D8 2D[3108] sub ax, COMMAND_LINE + 2 0 000052DB A2[2F08] mov byte [COMMAND_LINE], al 2462 0 000052DE BA[0000] mov dx, COMMND 0 000052E1 E901FF jmp loop_shell 2465 2466 2467 extern get_config_size 2468 relocate_config: 2469 assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 000052E4 B80058 mov ax, 5800h 0 000052E7 CD21 int 21h 0 000052E9 50 push ax 0 000052EA B80158 mov ax, 5801h 0 000052ED BB2003 mov bx, 0320h ; ignore UMB link, one area, 0 000052F0 CD21 int 21h ; LMA then UMA, first fit 0 000052F2 E8[0000] call get_config_size 0 000052F5 B448 mov ah, 48h 0 000052F7 CD21 int 21h 0 000052F9 722E jc .fail 0 000052FB 8EC0 mov es, ax 2481 assume es:nothing 0 000052FD 31FF xor di, di 0 000052FF 2E8E1E[2708] mov ds, word [cs:config_block] 2484 assume ds:nothing 0 00005304 31F6 xor si, si 0 00005306 06 push es 0 00005307 51 push cx 0 00005308 F3A4 rep movsb 0 0000530A 1E push ds 0 0000530B 07 pop es 2491 assume es:nothing 0 0000530C B449 mov ah, 49h 0 0000530E CD21 int 21h 0 00005310 58 pop ax 0 00005311 50 push ax 0 00005312 BE[AA21] mov si, alloc_initconfig 0 00005315 E8C218 call allocate_temporary_block 2498 assume es:nothing 0 00005318 59 pop cx 0 00005319 1F pop ds 2501 assume ds:nothing 0 0000531A 31F6 xor si, si 0 0000531C F3A4 rep movsb 0 0000531E 2E8C06[2708] mov word [cs:config_block], es 0 00005323 1E push ds 0 00005324 07 pop es 2507 assume es:nothing 0 00005325 B449 mov ah, 49h 0 00005327 CD21 int 21h 2510 .fail: 0 00005329 5B pop bx 0 0000532A B80158 mov ax, 5801h 0 0000532D CD21 int 21h 0 0000532F C3 retn 2515 2516 2517 relocate_dibx_dpb_from_dxbp_to_essi: 2518 assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 00005330 3929 cmp word [di + bx], bp 0 00005332 750C jne .ret 0 00005334 395102 cmp word [di + bx + 2], dx 0 00005337 7507 jne .ret ; match ? 0 00005339 FA cli 0 0000533A 8931 mov word [di + bx], si 0 0000533C 8C4102 mov word [di + bx + 2], es 0 0000533F FB sti ; yes, relocate 2527 .ret: 0 00005340 C3 retn 2529 2530 2531 reloc_dpb_in_sftc: 2532 assume ds:nothing, es:nothing, ss:SYSINITGROUP 2533 .loop_sftc: 0 00005341 83FFFF cmp di, -1 0 00005344 7425 je .done 0 00005346 57 push di 0 00005347 8B4D04 mov cx, [di + SFCount] 0 0000534A E31A jcxz .next_sftc 0 0000534C 83C706 add di, SFTable 2540 .loop_entry: 0 0000534F 833D00 cmp word [di + sf_ref_count], 0 0 00005352 740D je @F 0 00005354 F745058080 testopt [di + sf_flags], sf_isnet | devid_device 2543 ****************** warning: Macro generated word access [-w+user] 2544 ; net or device ? 0 00005359 7506 jnz @F ; yes, don't check --> 0 0000535B BB0700 mov bx, sf_devptr 0 0000535E E8CFFF call relocate_dibx_dpb_from_dxbp_to_essi 2548 @@: 0 00005361 83C73B add di, sf_entry_struc_size 0 00005364 E2E9 loop .loop_entry 2551 .next_sftc: 0 00005366 5F pop di 0 00005367 C53D lds di, [di + SFLink] 0 00005369 EBD6 jmp .loop_sftc 2555 2556 .done: 0 0000536B C3 retn 2558 2559 2560 ; ! called far from DOSENTRY init code. 2561 ; Runs in unrelocated SYSINIT. 2562 ; Must return far. 2563 ; 2564 ; INP: ds:si -> text 2565 ; OUT: NC if found, 2566 ; ds:si -> at terminator 2567 ; dx = bit mask selected 2568 ; CY if not found, 2569 ; ds:si -> past commas and blanks and equal signs 2570 ; STT: called far 2571 ; cs = ds = es => SYSINIT 2572 ; CHG: dx, bx, ax 2573 global sysinit_cmdline_scanmode_keyword 2574 extern isstring?, skipcomma, skipcomm0, skipwhite, skipwh0 2575 sysinit_cmdline_scanmode_keyword: 2576 @@: 0 0000536C E8[0000] call skipcomma 0 0000536F 3C3D cmp al, '=' 0 00005371 74F9 je @B 0 00005373 4E dec si 0 00005374 BB[5000] mov bx, modetable 2582 .mode_loop: 0 00005377 8B17 mov dx, [bx] 0 00005379 E8[0000] call isstring? 0 0000537C 7505 jne @F 0 0000537E 8B5702 mov dx, [bx + 2] 0 00005381 F8 clc 0 00005382 CB retf 2589 2590 @@: 0 00005383 83C304 add bx, 4 0 00005386 81FB[6C00] cmp bx, strict word modetable.end 0 0000538A 72EB jb .mode_loop 0 0000538C F9 stc 0 0000538D CB retf 2596 2597 2598 free_temp_cds: 2599 assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 0000538E 31C0 xor ax, ax 0 00005390 2E8706[8009] xchg ax, word [cs:tempcds_block] 0 00005395 85C0 test ax, ax 0 00005397 7408 jz @F 0 00005399 06 push es 0 0000539A 8EC0 mov es, ax 2606 assume es:nothing 0 0000539C B449 mov ah, 49h 0 0000539E CD21 int 21h 0 000053A0 07 pop es 2610 assume es:nothing 2611 @@: 0 000053A1 C3 retn 2613 2614 2615 PUBLIC TEMPCDS_after_block_device 2616 extern devicefirstnewdpb, devicefirstnewdrive, deviceamountnew 2617 extern reinitcds_option 2618 TEMPCDS_after_block_device: 2619 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 0 000053A2 D006[0000] rol byte [reinitcds_option], 1 0 000053A6 727F jc TEMPCDS 2622 0 000053A8 C43E[F207] LES DI,[DOSINFO] 2624 assume es:DOSGROUP 0 000053AC 268A5D21 mov bl, [es:di + SYSI_NCDS] 0 000053B0 B058 mov al, curdir_list_struc_size 0 000053B2 F6E3 mul bl 0 000053B4 53 push bx ; stack = how many entries in old CDS 0 000053B5 50 push ax ; stack = how much to preserve in bytes 2630 0 000053B6 31C9 xor cx, cx 0 000053B8 268A4D20 mov cl, byte [es:di + SYSI_NUMIO] ; cx = how many block units now 0 000053BC 26384D21 cmp byte [es:di + SYSI_NCDS], cl ; have more CDS entries ? 0 000053C0 7204 jb @F ; no --> 0 000053C2 268A4D21 mov cl, byte [es:di + SYSI_NCDS] ; yes, keep as many 2636 @@: 0 000053C6 26884D21 mov byte [es:di + SYSI_NCDS], cl ; update amount CDS entries 0 000053CA B058 mov al, curdir_list_struc_size 0 000053CC F6E1 mul cl ; ax = how much to allocate in bytes 2640 0 000053CE 51 push cx 0 000053CF 06 push es 0 000053D0 57 push di 0 000053D1 BE[A021] mov si, alloc_initcds 0 000053D4 E80318 call allocate_temporary_block 2646 assume es:nothing 0 000053D7 5E pop si 0 000053D8 1F pop ds ; -> DOSINFO 2649 assume ds:DOSGROUP 0 000053D9 5B pop bx ; bl = how many entries in new CDS 0 000053DA 59 pop cx ; = how much to preserve in bytes 2652 0 000053DB 1E push ds 0 000053DC 56 push si 0 000053DD C57416 lds si, [si + SYSI_CDS] ; -> old CDS 2656 assume ds:CDS 0 000053E0 89FA mov dx, di ; es:dx -> new CDS 0 000053E2 F3A4 rep movsb ; preserve old 0 000053E4 5E pop si 0 000053E5 1F pop ds 2661 assume ds:DOSGROUP 0 000053E6 E8A5FF call free_temp_cds ; free old 0 000053E9 2E8C06[8009] mov word [cs:tempcds_block], es ; => temp CDS 0 000053EE 58 pop ax ; al = how many entries in old CDS 0 000053EF 28C3 sub bl, al ; = additional amount 0 000053F1 0441 add al, "A" ; prior amount + "A" 0 000053F3 36A2[2D08] mov byte [ss:FOOSTRNG], al ; first letter of additional table 2668 0 000053F7 8C4418 MOV WORD PTR [si + SYSI_CDS + 2], es 0 000053FA 895416 mov WORD PTR [si + SYSI_CDS], dx 2671 ; -> new temp CDS 0 000053FD 31C9 xor cx, cx 0 000053FF 88D9 mov cl, bl ; cx = additional amount of CDS entries 0 00005401 BEFFFF mov si, -1 ; no DPBs for additional table 0 00005404 E84E00 call FOOSET ; init additional table 2676 0 00005407 2EC536[0000] lds si, [cs:devicefirstnewdpb] ; ds:si -> first new DPB 2678 ASSUME DS:DPB 0 0000540C 2E8A1E[0000] mov bl, [cs:devicefirstnewdrive] 0 00005411 B058 mov al, curdir_list_struc_size 0 00005413 F6E3 mul bl 0 00005415 97 xchg di, ax ; es:di -> CDS entry for first new drive 0 00005416 31C9 xor cx, cx 0 00005418 2E8A0E[0000] mov cl, byte [cs:deviceamountnew] 2685 ; cx = how many drives 0 0000541D 80C341 add bl, "A" ; letter of first new drive 0 00005420 36881E[2D08] mov byte [ss:FOOSTRNG], bl ; first letter of additional table 0 00005425 EB2E jmp FOOSET 2689 2690 2691 PUBLIC TEMPCDS 2692 TEMPCDS: 2693 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 0 00005427 E864FF call free_temp_cds 2695 0 0000542A C43E[F207] LES DI,[DOSINFO] 2697 assume es:DOSGROUP 2698 0 0000542E 268A4D20 MOV CL,BYTE PTR [ES:DI + SYSI_NUMIO] 0 00005432 30ED XOR CH,CH 0 00005434 26884D21 MOV [ES:DI + SYSI_NCDS],CL 0 00005438 B058 mov al, curdir_list_struc_size 0 0000543A F6E1 mul cl 2704 0 0000543C 51 push cx 0 0000543D 06 push es 0 0000543E 57 push di 0 0000543F BE[A021] mov si, alloc_initcds 0 00005442 E89517 call allocate_temporary_block 2710 assume es:nothing 0 00005445 2E8C06[8009] mov word [cs:tempcds_block], es ; => temp CDS 0 0000544A 5E pop si 0 0000544B 1F pop ds ; -> DOSINFO 2714 assume ds:DOSGROUP 0 0000544C 59 pop cx 2716 0 0000544D 8C4418 MOV WORD PTR [si + SYSI_CDS + 2], es 0 00005450 897C16 mov WORD PTR [si + SYSI_CDS], di 2719 ; -> temp CDS 0 00005453 C534 LDS SI,[si + SYSI_DPB] ; -> first DPB 2721 ASSUME DS:DPB 2722 2723 FOOSET: ; Init CDSs 0 00005455 E357 jcxz fooret ; (additional table may be empty) 0 00005457 36A1[2D08] MOV AX,WORD PTR [ss:FOOSTRNG] 0 0000545B AB STOSW 0 0000545C B85C00 MOV AX, "\" ; constant 0 0000545F AB STOSW 0 00005460 36FE06[2D08] INC BYTE PTR [ss:FOOSTRNG] 0 00005465 31C0 XOR AX,AX 0 00005467 51 PUSH CX 0 00005468 B93F00 MOV CX,curdir_flags - 4 0 0000546B F3AA REP STOSB 0 0000546D 83FEFF CMP SI,-1 2735 ; JNZ NORMCDS 2736 ;J.K. 6/24/87 Should handle the system that does not have any floppies. 2737 ;J.K. In this case, we are going to pretended there are two dummy floppies 2738 ;J.K. in the system. Still they have DPB and CDS, but we are going to 2739 ;J.K. 0 out Curdir_Flags, Curdir_devptr of CDS so IBMDOS can issue 2740 ;J.K. "Invalid drive specification" message when the user try to 2741 ;J.K. access them. 0 00005470 7410 je Fooset_Zero ;AN001;Don't have any physical drive. 2743 ;SB34SYSINIT1003************************************************************* 2744 ;SB Check to see if we are faking floppy drives. If not go to NORMCDS. 2745 ;SB If we are faking floppy drives then see if this CDS being initialised 2746 ;SB is for drive a: or b: by checking the appropriate field in the DPB 2747 ;SB pointed to by ds:si. If not for a: or b: then go to NORMCDS. If 2748 ;Sb for a: or b: then execute the code given below starting at Fooset_Zero. 2749 ;SB For dpb offsets look at inc\dpb.inc. 2750 ;SB 5 LOCS 2751 0 00005472 2E803E[0408]01 cmp byte [cs:Fake_Floppy_Drv],1 ;fake drive ? 0 00005478 750F jnz NORMCDS 0 0000547A 803C02 cmp byte [si + dpb_drive],02 ;check for a: or b: 0 0000547D 730A jae NORMCDS 0 0000547F C57419 LDS SI,[SI + dpb_next_dpb] 2757 assume ds:nothing 2758 2759 ;SB34SYSINIT1003************************************************************* 2760 Fooset_Zero: ;AN001; 2761 ; ax still zero 0 00005482 B103 MOV CL,3 0 00005484 F3AB REP STOSW 0 00005486 59 POP CX 0 00005487 EB13 JMP SHORT FINCDS 2766 NORMCDS: 0 00005489 59 POP CX 2768 ;J.K. If a non-fat based media is detected (by DPB.NumberOfFat == 0), then 2769 ; set curdir_flags to 0. This is for signaling IBMDOS and IFSfunc that 2770 ; this media is a non-fat based one. 0 0000548A 807C0800 cmp byte [SI + dpb_FAT_count], 0 ;AN000; Non fat system? 0 0000548E 7402 je SetNormCDS ;AN000; Yes. Set curdir_Flags to 0. AX = 0 now. 2773 CURDIR_INUSE equ curdir_inuse ; NASM port equate 0 00005490 B440 MOV ah, CURDIR_INUSE >> 8 ;AN000; else, FAT system. set the flag to CURDIR_INUSE. 2775 SetNormCDS: ;AN000; 0 00005492 AB STOSW ; curdir_flags 0 00005493 89F0 MOV AX,SI 0 00005495 AB STOSW ; curdir_devptr 0 00005496 8CD8 MOV AX,DS 0 00005498 AB STOSW 0 00005499 C57419 LDS SI,[SI + dpb_next_dpb] 2782 assume ds:nothing 2783 FINCDS: 0 0000549C B8FFFF MOV AX,-1 0 0000549F AB STOSW ; curdir_ID 0 000054A0 AB STOSW ; curdir_ID 0 000054A1 AB STOSW ; curdir_user_word 0 000054A2 B80200 mov ax,2 0 000054A5 AB stosw ; curdir_end 0 000054A6 31C0 xor ax, ax ;AN000;Clear out 7 bytes (curdir_type, 0 000054A8 AB stosw ;AN000; curdir_ifs_hdr, curdir_fsda) 0 000054A9 AB stosw ;AN000; 0 000054AA AB stosw ;AN000; 0 000054AB AA stosb ;AN000; 0 000054AC E2A7 LOOP FOOSET 2796 fooret: 0 000054AE 36C606[2D08]41 MOV BYTE PTR [ss:FOOSTRNG],"A" 0 000054B4 C3 return 2799 2800 ;------------------------------------------------------------------------------ 2801 ; Allocate FILEs 2802 ;------------------------------------------------------------------------------ 2803 ENDFILE: 2804 assume ds:nothing, es:nothing, ss:SYSINITGROUP 2805 ; WE ARE NOW SETTING UP FINAL CDSs, BUFFERS, FILES, FCSs STRINGs etc. We no 2806 ; longer need the space taken by The TEMP stuff below CONFBOT, so set ALLOCLIM 2807 ; to CONFBOT. 2808 2809 ;J.K. 2/23/87 If this procedure has been called to take care of INSTALL= command, 2810 ;then we have to save ES,SI registers. 2811 2812 ; test [Install_Flag],IS_INSTALL ;AN000; Called to handle INSTALL=? 2813 ; jz ENDFILE_Cont ;AN000; 2814 ; push es ;AN000; Save es,si for CONFIG.SYS 2815 ; push si ;AN000; 2816 ; test [Install_Flag],HAS_INSTALLED ;AN000; Sysinit_base already installed? 2817 ; jz ENDFILE_Cont ;AN000; No. Install it. 2818 ; jmp DO_Install_EXEC ;AN000; Just handle "INSTALL=" cmd only. 2819 ;ENDFILE_Cont: ;AN000; 2820 0 000054B5 1E push ds ;AN002; 0 000054B6 E8[0000] call sysinit_get_ds_dosbiodata 2823 assume ds:DOSGROUP 0 000054B9 833E[0000]00 cmp word [MulTrk_flag], MULTRK_OFF1 ;AN002;=0, MULTRACK= command entered? 0 000054BE 7506 jne MulTrk_Flag_Done ;AN002; 0 000054C0 810E[0000]8000 or word [MulTrk_flag], MULTRK_ON ;AN002; Default will be ON. 2827 MulTrk_Flag_Done: ;AN002; 0 000054C6 1F pop ds ;AN002; 2829 assume ds:nothing 2830 2831 do_sft: 0 000054C7 31C0 xor ax, ax 0 000054C9 36A0[2308] MOV AL,[ss:FILES] 0 000054CD 2C05 SUB AL,5 0 000054CF 7623 JBE DOFCBS 0 000054D1 50 push ax 2837 SF_ENTRY_struc_size equ sf_entry_struc_size ; NASM port equate 0 000054D2 B33B MOV BL,SF_ENTRY_struc_size 0 000054D4 F6E3 MUL BL ;AX = NUMBER OF BYTES TO CLEAR 0 000054D6 83C006 add ax, 6 0 000054D9 BE[6421] mov si, alloc_sft 0 000054DC E8E715 call allocate_relocate_block 2843 assume es:nothing 2844 0 000054DF 36C536[F207] LDS si, [ss:DOSINFO] 2846 assume ds:DOSGROUP 0 000054E4 C57404 LDS si, [si + SYSI_SFT] 2848 assume ds:nothing 2849 SFLINK equ SFLink ; NASM port equate 0 000054E7 893C MOV WORD PTR [si + SFLINK], di 0 000054E9 8C4402 MOV WORD PTR [si + SFLINK+2], es ; SET POINTER TO NEW SFT 0 000054EC 26830DFF or WORD PTR [ES:DI + SFLINK], -1 2853 SFCOUNT equ SFCount ; NASM port equate 0 000054F0 268F4504 pop word [ES:DI + SFCOUNT] 2855 2856 ;------------------------------------------------------------------------------ 2857 ; Allocate FCBs 2858 ;------------------------------------------------------------------------------ 2859 DOFCBS: 0 000054F4 31C0 xor ax, ax 0 000054F6 36A0[2408] MOV AL,[ss:FCBS] 0 000054FA 50 push ax 0 000054FB B33B MOV BL,SF_ENTRY_struc_size 0 000054FD F6E3 MUL BL ;AX = NUMBER OF BYTES TO CLEAR 0 000054FF 83C006 add ax, 6 0 00005502 BE[6E21] mov si, alloc_fcb 0 00005505 E8BE15 call allocate_relocate_block 2868 assume es:nothing 2869 0 00005508 36C536[F207] LDS si, [ss:DOSINFO] 2871 assume ds:DOSGROUP 2872 0 0000550D 897C1A MOV WORD PTR [si + SYSI_FCB], di 0 00005510 8C441C MOV WORD PTR [si + SYSI_FCB+2], es ; SET POINTER TO NEW Table 0 00005513 31DB xor bx, bx 0 00005515 2E8A1E[2508] MOV BL,[CS:Keep] 2877 SYSI_keep equ SYSI_Keep ; NASM port equate 0 0000551A 895C1E MOV [si + SYSI_keep],BX 0 0000551D 0E PUSH CS 0 0000551E 1F POP DS 2881 ASSUME DS:SYSINITGROUP 0 0000551F 26830DFF or WORD PTR [ES:DI + SFLINK], -1 0 00005523 59 pop cx 0 00005524 26894D04 mov word [ES:DI + SFCOUNT], cx 2885 2886 sf_struc_size equ SF_struc_size ; NASM port equate 0 00005528 83C706 add di, sf_struc_size-2 ; es:di -> SFT entries 2888 0 0000552B B041 MOV AL,"A" 2890 FillLoop: 0 0000552D 51 PUSH CX ; save count 0 0000552E B93B00 MOV CX,sf_entry_struc_size ; number of bytes to fill 0 00005531 FC cld 0 00005532 F3AA REP STOSB ; filled 0 00005534 26894DC5 MOV WORD PTR [ES:DI-(sf_entry_struc_size)+sf_ref_count], cx 0 00005538 26894DDA MOV WORD PTR [ES:DI-(sf_entry_struc_size)+sf_position], cx 0 0000553C 26894DDC MOV WORD PTR [ES:DI-(sf_entry_struc_size)+sf_position+2], cx 0 00005540 59 POP CX 0 00005541 E2EA LOOP FillLoop 2900 2901 ;------------------------------------------------------------------------------ 2902 ; Allocate Buffers 2903 ;------------------------------------------------------------------------------ 2904 2905 ; Search through the list of media supported and allocate 3 buffers if the 2906 ; capacity of the drive is > 360KB 2907 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 2908 0 00005543 833E[1D08]FF CMP word [BUFFERS], -1 ; Has buffers been already set? 0 00005548 7403 je DoDefaultBuff 2911 %ifndef BUF2 2912 cmp byte [Buffer_Slash_X], 1 ;AN000; 2913 jne DO_Buffer ;AN000; 2914 call DoEMS ;AN000; Carry set if (enough) EMS is not available 2915 jc DoDefaultBuff ;AN000; Error. Just use default buffer. 2916 %endif 2917 DO_Buffer: 0 0000554A E99800 jmp DOBUFF ; the user entered the buffers=. 2919 2920 DoDefaultBuff: 0 0000554D C706[1F08]0000 mov word [H_Buffers], 0 ;AN000; Default is no heuristic buffers. 0 00005553 C706[1D08]0200 MOV word [BUFFERS], 2 ; Default to 2 buffers 0 00005559 50 PUSH AX 0 0000555A 1E PUSH DS 0 0000555B 2EC42E[F207] LES BP,[CS:DOSINFO] ; Search through the DPB's 2926 assume es:DOSGROUP 0 00005560 26C46E00 LES BP,[ES:BP + SYSI_DPB] ; Get first DPB 2928 assume es:DPB 2929 0 00005564 0E PUSH CS 0 00005565 1F POP DS 2932 assume ds:SYSINITGROUP 2933 2934 NEXTDPB: 2935 ; Test if the drive supports removeable media 2936 DPB_DRIVE equ dpb_drive ; NASM port equate 0 00005566 268A5E00 MOV BL, BYTE PTR [ES:BP + DPB_DRIVE] 0 0000556A FEC3 INC BL 2939 IOCTL equ IOCtl ; NASM port equate 0 0000556C B80844 MOV AX, (IOCTL << 8) | 8 0 0000556F CD21 INT 21H 2942 2943 ; Ignore fixed disks 0 00005571 09C0 OR AX, AX ; AX is nonzero if disk is nonremoveable 0 00005573 7537 JNZ NOSETBUF 2946 2947 ; Get parameters of drive 0 00005575 31DB XOR BX, BX 0 00005577 268A5E00 MOV BL, BYTE PTR [ES:BP + DPB_DRIVE] 0 0000557B FEC3 INC BL 0 0000557D BA[0000] MOV DX, OFFSET DeviceParameters 0 00005580 B80D44 MOV AX, (IOCTL << 8) | GENERIC_IOCTL 0 00005583 B96008 MOV CX, (RAWIO << 8) | GET_DEVICE_PARAMETERS 0 00005586 CD21 INT 21H 0 00005588 7222 JC NOSETBUF ; Get next DPB if driver doesn't support 2956 ; Generic IOCTL 2957 2958 ; Determine capacity of drive 2959 ; Media Capacity = #Sectors * Bytes/Sector 2960 BPB_TotalSectors equ BPB_TOTALSECTORS ; NASM port equate 0 0000558A 8B1E[0F00] MOV BX, WORD PTR [DeviceParameters + DP_BPB + BPB_TotalSectors] 2962 2963 ; To keep the magnitude of the media capacity within a word, 2964 ; scale the sector size 2965 ; (ie. 1 -> 512 bytes, 2 -> 1024 bytes, ...) 2966 BPB_BytesPerSector equ BPB_BYTESPERSECTOR ; NASM port equate 0 0000558E A1[0700] MOV AX, WORD PTR [DeviceParameters + DP_BPB + BPB_BytesPerSector] 0 00005591 31D2 XOR DX, DX 0 00005593 B90002 MOV CX, 512 0 00005596 F7F1 DIV CX ; Scale sector size in factor of 2971 ; 512 bytes 2972 0 00005598 F7E3 MUL BX ; AX = #sectors * size factor 0 0000559A 09D2 OR DX, DX ; Just in case of LARGE floppies 0 0000559C 7505 JNZ .SETBUF 0 0000559E 3DD002 CMP AX, 720 ; 720 Sectors * size factor of 1 0 000055A1 7609 JBE NOSETBUF 2978 .SETBUF: 0 000055A3 C706[1D08]0300 MOV word [BUFFERS], 3 0 000055A9 EB0E jmp Chk_Memsize_for_Buffers ; Now check the memory size for default buffer count 0 000055AB 90 nop ; identicalise 2982 ; JMP BUFSET ; Jump out of search loop 2983 NOSETBUF: 2984 DPB_NEXT_DPB equ dpb_next_dpb ; NASM port equate 0 000055AC 26837E19FF CMP WORD PTR [ES:BP + DPB_NEXT_DPB],-1 0 000055B1 7406 jz Chk_Memsize_for_Buffers 2987 ; JZ BUFSET 0 000055B3 26C46E19 LES BP,[ES:BP + DPB_NEXT_DPB] 2989 assume es:DPB 0 000055B7 EBAD JMP NEXTDPB 2991 2992 ;J.K. 10/15/86 DCR00014. 2993 ;From DOS 3.3, the default number of buffers will be changed according to the 2994 ;memory size too. 2995 ; Default buffers = 2 2996 ; If diskette Media > 360 kb, then default buffers = 3 2997 ; If memory size > 128 kb (2000H para), then default buffers = 5 2998 ; If memory size > 256 kb (4000H para), then default buffers = 10 2999 ; If memory size > 512 kb (8000H para), then default buffers = 15. 3000 3001 Chk_Memsize_for_Buffers: 3002 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 3003 memory_size equ MEMORY_SIZE ; NASM port label 0 000055B9 813E[1A08]0020 cmp word [memory_size], 2000h 3005 BufSet equ BUFSET ; NASM port label 0 000055BF 7622 jbe BufSet 3007 buffers equ BUFFERS ; NASM port label 0 000055C1 C706[1D08]0500 mov word [buffers], 5 0 000055C7 813E[1A08]0040 cmp word [memory_size], 4000h 0 000055CD 7614 jbe BufSet 0 000055CF C706[1D08]0A00 mov word [buffers], 10 0 000055D5 813E[1A08]0080 cmp word [memory_size], 8000h 0 000055DB 7606 jbe BufSet 0 000055DD C706[1D08]0F00 mov word [buffers], 15 3015 3016 BUFSET: 0 000055E3 1F POP DS 3018 ASSUME DS:NOTHING 0 000055E4 58 POP AX 3020 3021 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3022 ;J.K. Here we should put extended stuff and new allocation scheme!!! 3023 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3024 ;******************************************************************************* 3025 ; * 3026 ; Function: Actually allocate BUFFERS into the (extended) memory and initialize* 3027 ; it. * 3028 ; If it is installed in real memory, the number of buffers in each * 3029 ; bucket will be balanced out as far as possible for perfermance. * 3030 ; Also, if the user specified the secondary buffer cache, it will * 3031 ; be installed in the real memory. * 3032 ; * 3033 ; Input : * 3034 ; BuffINFO.EMS_MODE - 0=IBM mode, -1 = do not use extended memory. * 3035 ; BuffINFO.Frame_Page - Page frame 0 segment address * 3036 ; MEMHI:MEMLO - Start of the next available memory * 3037 ; Buffer_Pages = Number of extended memory pages for buffer * 3038 ; BUFFERS = Number of buffers * 3039 ; H_Buffers = Number of secondary buffers * 3040 ; * 3041 ; Output: * 3042 ; BuffINFO.Cache_Count - # of caches to be installed. * 3043 ; Hash table set. * 3044 ; BuffINFO set. * 3045 ; BufferBuckets set. * 3046 ; MaxNumBuf1, MaxNumBuf2, and NthBuck set. * 3047 ; * 3048 ; Subroutines to be called: * 3049 ; * 3050 ; Logic: * 3051 ; { * 3052 ; IF (BuffINFO.EMS_MODE == -1) THEN * 3053 ; { * 3054 ; IF BUFFERS < 30 THEN * 3055 ; {# of Bucket = 1; MaxNumBuf1 = BUFFERS; NthBuck = 1} * 3056 ; ELSE { * 3057 ; # of Bucket = BUFFERS/15; * 3058 ; r = BUFFERS mod 15; * 3059 ; IF r == 0 THEN NthBuck = # of Bucket * 3060 ; ELSE * 3061 ; { * 3062 ; AddBuff = r / # of Bucket; * 3063 ; NthBuck = r mod # of Bucket; * 3064 ; MaxNumBuf1 = 15 + AddBuff; /* 1st Bucket - Nth Bucket* 3065 ; MaxNumBuf2 = 15 + AddBuff +1;/*(N+1)th Bucket to last* 3066 ; } * 3067 ; } * 3068 ; } * 3069 ; ELSE * 3070 ; { * 3071 ; # of Bucket = Buffer_Pages * 2; /* 2 buckets per page * 3072 ; }; * 3073 ; * 3074 ; /*Now allocate memory for Hash table */ * 3075 ; Hash Table Size = (size Buffer_Hash_Entry) * # of Bucket; * 3076 ; Set BuffINFO.Hash_ptr to MEMHI:MEMLO; * 3077 ; Adjust MEMHI:MEMLO according to Hash table size; * 3078 ; * 3079 ; /*Set buffers*/ * 3080 ; IF (EMS_MODE <> -1) THEN * 3081 ; Set_EMS_Buffer * 3082 ; ELSE /*Do not use the extended memory */ * 3083 ; Set_Buffer; * 3084 ;/*Now set the caches if specified.*/ * 3085 ; IF (BuffINFO.Cache_count > 0) THEN * 3086 ; {Set BuffINFO.Cache_ptr to MEMHI:MEMLO; * 3087 ; MEMHI:MEMLO = MEMHI:MEMLO + 512 * BuffINFO.Cache_count; * 3088 ; }; * 3089 ; }; * 3090 ; * 3091 ;******************************************************************************* 3092 DOBUFF: ;AN000; 3093 %ifndef BUF2 3094 DosInfo equ DOSINFO ; NASM port label 3095 lds bx, [cs:DosInfo] ;AN000; ds:bx -> SYSINITVAR 3096 3097 Buffers equ BUFFERS ; NASM port label 3098 mov ax, [ss:Buffers] ;AN000;Set SYSI_BUFFERS 3099 mov word ptr [bx + SYSI_BUFFERS], ax ;AN000; 3100 mov ax, [ss:H_Buffers] ;AN000; 3101 mov word ptr [bx + SYSI_BUFFERS+2], ax ;AN000; 3102 3103 lds bx, [bx + SYSI_BUF] ;AN000; now, ds:bx -> BuffInfo 3104 EMS_MODE equ EMS_mode ; NASM port equate 3105 cmp byte [bx + EMS_MODE], -1 ;AN000; 3106 ; $IF E, LONG ;AN000; 3107 JE DD_XL1 3108 JMP DD_IF1 3109 nop ; identicalise 3110 DD_XL1: 3111 xor dx, dx ;AN000; 3112 mov ax, [ss:Buffers] ;AN000; < 99 3113 cmp al, 30 ;AN026; if less than 30, 3114 ; $IF B ;AN026; 3115 JNB DD_IF2 3116 mov word [ss:BufferBuckets], 1 ;AN026; then put every buffer 3117 HASH_COUNT equ Hash_count ; NASM port equate 3118 mov word [bx + HASH_COUNT], 1 ;AN026; into one bucket 3119 mov [ss:MaxNumBuf1], al ;AN026; 3120 mov byte [ss:NthBuck], 1 ;AN026; 3121 ; $ELSE ;AN026; else... 3122 JMP SHORT DD_EN2 3123 DD_IF2: 3124 mov cl, 15 ;AN026; Magic number 15. 3125 div cl ;AN026; al=# of buckets, ah=remainders 3126 push ax ;AN026; save the result 3127 xor ah, ah ;AN026; 3128 mov [ss:BufferBuckets], ax ;AN026; 3129 mov [bx + HASH_COUNT], ax ;AN026; 3130 pop ax ;AN026; 3131 or ah, ah ;AN026; 3132 ; $IF Z ;AN026;if no remainders 3133 JNZ DD_IF4 3134 mov [ss:NthBuck], al ;AN026;then set NthBuck=# of bucket for Set_Buffer proc. 3135 ; $ELSE ;AN026;else 3136 JMP SHORT DD_EN4 3137 DD_IF4: 3138 mov cl, al ;AN026; 3139 mov al, ah ;AN026;remainder/# of buckets 3140 xor ah, ah ;AN026; = 3141 div cl ;AN026;al=additional num of buffers 3142 or ah, ah ;AN026;ah=Nth bucket 3143 ; $IF Z ;AN026; 3144 JNZ DD_IF6 3145 add [ss:MaxNumBuf1], al ;AN026; 3146 mov ax, [ss:BufferBuckets] ;AN026; 3147 mov [ss:NthBuck], al ;AN026; 3148 ; $ELSE ;AN026; 3149 JMP SHORT DD_EN6 3150 DD_IF6: 3151 mov [ss:NthBuck], ah ;AN026; 3152 add [ss:MaxNumBuf1], al ;AN026;MaxNumNuf are initially set to 15. 3153 add [ss:MaxNumBuf2], al ;AN026; 3154 inc byte [ss:MaxNumBuf1] ;AN026;Additional 1 more buffer for group 1 buckets. 3155 ; $ENDIF ;AN026; 3156 DD_EN6: 3157 ; $ENDIF ;AN026; 3158 DD_EN4: 3159 ; $ENDIF ;AN026; 3160 DD_EN2: 3161 ; $ELSE ;AN000; Use the extended memory. 3162 JMP SHORT DD_EN1 3163 DD_IF1: 3164 mov ax, [ss:Buffer_Pages] ;AN000; 3165 MAXBUCKETINPAGE equ MaxBucketinPage ; NASM port equate 3166 mov cx, MAXBUCKETINPAGE ;AN000; 3167 mul cx ;AN000; gauranteed to be word boundary. 3168 mov [ss:BufferBuckets], ax ;AN000; 3169 mov [bx + HASH_COUNT], ax ;AN000; 3170 ; $ENDIF ;AN000; 3171 DD_EN1: 3172 invoke Round ;AN000; get [MEMHI]:[MEMLO] 3173 mov al, DEVMARK_BUF ;AN005; ='B' 3174 call SetDevMark ;AN005; 3175 ;Now, allocate Hash table at [memhi]:[memlo]. AX = Hash_Count. 3176 mov ax, [ss:BufferBuckets] ;AN026; # of buckets==Hash_Count 3177 mov cx, BUFFER_HASH_ENTRY_struc_size ;AN000; 3178 mul cx ;AN000; now AX = Size of hash table. 3179 les di, [bx + HASH_PTR] ;AN000; save Single buffer address. 3180 MemLo equ MEMLO ; NASM port label 3181 mov cx, [ss:MemLo] ;AN000; 3182 mov word ptr [bx + HASH_PTR], cx ;AN000; set BuffINFO.HASH_PTR 3183 MemHi equ MEMHI ; NASM port label 3184 mov cx, [ss:MemHi] ;AN000; 3185 mov word ptr [bx + HASH_PTR+2], cx ;AN000; 3186 Memlo equ MEMLO ; NASM port label 3187 mov [ss:Memlo], ax ;AN000; 3188 or byte [ss:SetDevMarkFlag], FOR_DEVMARK ;AN005; 3189 call Round ;AN000; get new [memhi]:[memlo] 3190 ;Allocate buffers 3191 push ds ;AN000; Save Buffer info. ptr. 3192 push bx ;AN000; 3193 cmp byte [bx + EMS_MODE], -1 ;AN000; 3194 ; $IF NE ;AN000; 3195 JE DD_IF13 3196 call Set_EMS_Buffer ;AN000; 3197 ; $ELSE ;AN000; 3198 JMP SHORT DD_EN13 3199 DD_IF13: 3200 call Set_Buffer ;AN000; 3201 ; $ENDIF ;AN000; 3202 DD_EN13: 3203 pop bx ;AN000; 3204 pop ds ;AN000; 3205 ;Now set the secondary buffer if specified. 3206 cmp word [ss:H_Buffers], 0 ;AN000; 3207 ; $IF NE ;AN000; 3208 JE DD_IF16 3209 call Round ;AN000; 3210 mov cx, [ss:MemLo] ;AN000; 3211 CACHE_PTR equ Cache_ptr ; NASM port equate 3212 mov word ptr [bx + CACHE_PTR], cx ;AN000; 3213 mov cx, [ss:MemHi] ;AN000; 3214 mov word ptr [bx + CACHE_PTR+2], cx ;AN000; 3215 mov cx, [ss:H_Buffers] ;AN000; 3216 CACHE_COUNT equ Cache_count ; NASM port equate 3217 mov [bx + CACHE_COUNT], cx ;AN000; 3218 mov ax, 512 ;AN000; 512 byte 3219 mul cx ;AN000; 3220 mov [ss:Memlo], ax ;AN000; 3221 or byte [ss:SetDevMarkFlag], FOR_DEVMARK ;AN005; 3222 call Round ;AN000; 3223 ; $ENDIF ;AN000; 3224 DD_IF16: 3225 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3226 ;J.K. END OF NEW BUFFER SCHEME. 3227 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3228 %else 3229 ;DOBUFF: 3230 assume ds:nothing, es:nothing, ss:SYSINITGROUP 3231 0 000055E5 36C51E[F207] LDS BX,[ss:DOSINFO] ; -> list of lists 3233 assume ds:DOSGROUP 0 000055EA 8B4710 mov ax, [bx + SYSI_MAXSEC] 0 000055ED 83C010 add ax, BUFINSIZE 0 000055F0 50 push ax ; ax = buffer size 0 000055F1 36F726[1D08] mul word [ss:BUFFERS] ; dx:ax = required amount bytes 0 000055F6 BE[7821] mov si, alloc_buffers 0 000055F9 1E push ds 0 000055FA E8CB14 call allocate_relocate_block.large 3241 assume es:nothing ; es:di -> first buffer 0 000055FD 1F pop ds 3243 assume ds:DOSGROUP 0 000055FE 59 pop cx ; = buffer size 0 000055FF 1E push ds 0 00005600 51 push cx 0 00005601 C536[0000] lds si, [BUFFHEAD] ; -> initial sysinit buffer 3248 assume ds:nothing 0 00005605 57 push di 0 00005606 F3A4 rep movsb ; copy the initial buffer 0 00005608 5F pop di 0 00005609 26830DFF or word [es:di + NEXTBUF], -1 0 0000560D 26834D02FF or word [es:di + NEXTBUF + 2], -1 ; set pointer 0 00005612 59 pop cx 0 00005613 1F pop ds 3256 assume ds:DOSGROUP 0 00005614 8C06[0200] mov word [BUFFHEAD + 2], es 0 00005618 893E[0000] mov word [BUFFHEAD], di ; -> first buffer 3259 3260 .loop: 0 0000561C 01CF add di, cx ; -> next buffer 0 0000561E 724B jc j_mem_err 0 00005620 8CC0 mov ax, es 0 00005622 83F8FE cmp ax, -2 ; are we in HMA ? 0 00005625 731A jae .unnormalised ; yes, do not normalise --> 0 00005627 89F8 mov ax, di ; ax = offset 0 00005629 3D00C0 cmp ax, 48 * 1024 0 0000562C 7613 jbe .unnormalised 0 0000562E D1E8 shr ax, 1 0 00005630 D1E8 shr ax, 1 0 00005632 D1E8 shr ax, 1 0 00005634 D1E8 shr ax, 1 ; ax = how many paragraphs to advance 0 00005636 8CC3 mov bx, es 0 00005638 01C3 add bx, ax 0 0000563A 722F jc j_mem_err ; harden 0 0000563C 8EC3 mov es, bx ; es => next buffer 3277 assume es:nothing 0 0000563E 83E70F and di, 15 ; di = offset of next buffer, normalised 3279 .unnormalised: 0 00005641 57 push di 0 00005642 01CF add di, cx 0 00005644 5F pop di 0 00005645 7224 jc j_mem_err 3284 0 00005647 36FF0E[1D08] DEC word [ss:BUFFERS] ; FIRST DEC acounts for buffer already 3286 ; in system. 0 0000564C 7420 JZ BUF1 ; All done 0 0000564E 26C74504FF00 MOV WORD PTR [ES:DI + BUFDRV],00FFH ;NEW BUFFER FREE 3289 0 00005654 A1[0000] MOV AX,WORD PTR [BUFFHEAD] ; Link in new buffer 0 00005657 268905 MOV WORD PTR [ES:DI + NEXTBUF],AX 0 0000565A A1[0200] MOV AX,WORD PTR [BUFFHEAD+2] 0 0000565D 26894502 MOV WORD PTR [ES:DI + NEXTBUF +2],AX 0 00005661 893E[0000] MOV WORD PTR [BUFFHEAD],DI 0 00005665 8C06[0200] MOV WORD PTR [BUFFHEAD+2],ES 0 00005669 EBB1 JMP .loop 3297 3298 j_mem_err: 0 0000566B E9[0000] jmp MEM_ERR 3300 %endif 3301 3302 ;------------------------------------------------------------------------------ 3303 ; Allocate CDSs 3304 ;------------------------------------------------------------------------------ 3305 BUF1: 0 0000566E 31C9 xor cx, cx 0 00005670 36870E[2908] xchg cx, word [ss:buffer_block] 0 00005675 E306 jcxz @F 0 00005677 8EC1 mov es, cx 3310 assume es:nothing 0 00005679 B449 mov ah, 49h 0 0000567B CD21 int 21h 3313 @@: 3314 0 0000567D 36C43E[F207] LES DI,[ss:DOSINFO] 3316 assume es:DOSGROUP 0 00005682 268A4D20 MOV CL,BYTE PTR [ES:DI + SYSI_NUMIO] 0 00005686 363A0E[2608] CMP CL,[ss:NUM_CDS] 0 0000568B 7305 JAE GOTNCDS ; User setting must be at least NUMIO 0 0000568D 368A0E[2608] MOV CL,[ss:NUM_CDS] 3321 GOTNCDS: 0 00005692 26FF7521 push word [es:di + SYSI_NCDS] 3323 ; preserve prior amount 0 00005696 30ED XOR CH,CH 0 00005698 26884D21 MOV [ES:DI + SYSI_NCDS],CL 0 0000569C B058 mov al, curdir_list_struc_size 0 0000569E F6E1 mul cl 0 000056A0 51 push cx 0 000056A1 06 push es 0 000056A2 57 push di 0 000056A3 BE[8221] mov si, alloc_cds 0 000056A6 E81D14 call allocate_relocate_block 3333 assume es:nothing 0 000056A9 5E pop si 0 000056AA 1F pop ds 3336 assume ds:DOSGROUP 0 000056AB 59 pop cx 3338 3339 extern preservecds_option 0 000056AC 5B pop bx ; prior amount byte in bl 3341 0 000056AD 2ED006[0000] rol byte [cs:preservecds_option], 1 0 000056B2 732D jnc .reinit_cds 0 000056B4 B058 mov al, curdir_list_struc_size 0 000056B6 F6E3 mul bl ; ax = prior size in bytes 0 000056B8 91 xchg cx, ax ; cx = prior size in bytes, 3347 ; al = total amount 0 000056B9 28D8 sub al, bl ; al = additional amount 0 000056BB 80C341 add bl, "A" ; prior amount + "A" 0 000056BE 36881E[2D08] mov byte [ss:FOOSTRNG], bl ; first letter of additional table 0 000056C3 89FB mov bx, di ; es:bx -> new CDS space 0 000056C5 1E push ds 0 000056C6 56 push si 0 000056C7 C57416 lds si, [si + SYSI_CDS] ; -> old CDS 3355 assume ds:CDS 0 000056CA F3A4 rep movsb ; copy over 0 000056CC 5E pop si 0 000056CD 1F pop ds ; restore -> list of lists 3359 assume ds:DOSGROUP 0 000056CE 8C4418 MOV WORD PTR [si + SYSI_CDS + 2], es 0 000056D1 895C16 MOV WORD PTR [si + SYSI_CDS], bx 3362 ; install new CDS 0 000056D4 50 push ax 0 000056D5 E8B6FC call free_temp_cds ; free old CDS 0 000056D8 59 pop cx 0 000056D9 BEFFFF mov si, -1 ; no DPBs for additional table 0 000056DC E876FD call FOOSET ; init additional table 3368 0 000056DF EB0E jmp @F 3370 3371 .reinit_cds: 0 000056E1 8C4418 MOV WORD PTR [si + SYSI_CDS + 2], es 0 000056E4 897C16 MOV WORD PTR [si + SYSI_CDS], di 0 000056E7 C534 LDS SI,[si + SYSI_DPB] 3375 assume ds:DPB 0 000056E9 E8A2FC call free_temp_cds 3377 0 000056EC E866FD CALL FOOSET 3379 @@: 3380 3381 ;------------------------------------------------------------------------------ 3382 ; Allocate Space for Internal Stack 3383 ;------------------------------------------------------------------------------ 3384 3385 %IF STACKSW 3386 0 000056EF 0E PUSH CS 0 000056F0 1F POP DS 3389 ASSUME DS:SYSINITGROUP 3390 3391 %IF IBM 3392 ;Don't install the system stack on the PCjr. Ignore STACKS=command too. 0 000056F1 803E[5D08]FD CMP byte [Sys_Model_Byte], 0FDh ; PCjr = 0FDh 3394 SkipStack_brdg equ SkipStack_Brdg ; NASM port label 0 000056F6 741C JE SkipStack_brdg 3396 %ENDIF 3397 3398 ;J.K. 10/15/86 DCR00013 3399 ;If the use does not entered STACKS= command, as a default, do not install 3400 ;sytem stacks for PC1, PC XT, PC Portable cases. 3401 ;Otherwise, install it to the user specified value or to the default 3402 ;value of 9, 128 for the rest of the system. 3403 3404 stack_addr equ STACK_ADDR ; NASM port label 0 000056F8 833E[1608]FF cmp word ptr [stack_addr], -1 ;Has the user entered "stacks=" command? 0 000056FD 7418 je DoInstallStack ;Then install as specified by the user 0 000056FF 803E[5E08]00 cmp byte [Sys_Scnd_Model_Byte], 0 ;PC1, XT has the secondary model byte = 0 0 00005704 7511 jne DoInstallStack ;Other model should have default stack of 9, 128 0 00005706 803E[5D08]FF cmp byte [Sys_Model_Byte], 0FFh ;PC1 ? 0 0000570B 7407 je SkipStack_brdg 0 0000570D 803E[5D08]FE cmp byte [Sys_Model_Byte], 0FEh ;PC/XT or PC Portable ? 0 00005712 7503 jne DoInstallStack 3413 SkipStack_Brdg: 0 00005714 EB38 jmp SkipStack 0 00005716 90 nop ; identicalise 3416 DoInstallStack: 3417 stack_count equ STACK_COUNT ; NASM port label 0 00005717 A1[1208] mov ax, [stack_count] ;J.K. Stack_count = 0? 0 0000571A 83F800 cmp ax, 0 ;then, stack size must be 0 too. 0 0000571D 74F5 jz SkipStack_brdg ;Don't install stack. 3421 3422 ; Space for Internal Stack area = STACK_COUNT(ENTRYSIZE + STACK_SIZE) 0 0000571F B80800 MOV AX, EntrySize 0 00005722 0306[1408] ADD AX, [STACK_SIZE] 0 00005726 8B0E[1208] MOV CX, [STACK_COUNT] 0 0000572A F7E1 MUL CX 0 0000572C 05[F207] add ax, offset Endstackcode 0 0000572F 83D200 adc dx, 0 0 00005732 BE[8C21] mov si, alloc_stack 0 00005735 E88E13 call allocate_relocate_block 3431 3432 assume es:nothing 0 00005738 0E push cs 0 00005739 1F pop ds 3435 assume ds:SYSINITGROUP 0 0000573A 31F6 xor si,si 3437 ;!!We know that Stack code is at the beginning of SYSINIT. 0 0000573C 31FF xor di,di 0 0000573E B9[F207] mov cx, offset Endstackcode 0 00005741 F3A4 rep movsb 3441 0 00005743 893E[1608] mov word ptr [stack_addr], di 0 00005747 8C06[1808] mov word ptr [stack_addr+2], es 3444 ; set for stack area initialization 3445 ; This will be used by Stack_Init routine. 3446 0 0000574B E80602 CALL StackInit 3448 ; Initialize hardware stack. 3449 ; CS=DS=sysinitseg, ES=Relocated stack code & data 3450 3451 SkipStack: 3452 %ENDIF 3453 0 0000574E 0E PUSH CS 0 0000574F 1F POP DS 3456 ASSUME DS:SYSINITGROUP 3457 0 00005750 A0[2308] MOV AL,[FILES] 0 00005753 30E4 XOR AH,AH ; DO NOT USE CBW INSTRUCTION!!!!! 3460 ; IT DOES SIGN EXTEND. 0 00005755 89C1 MOV CX,AX 0 00005757 31DB XOR BX,BX ;Close standard input 0 00005759 B43E MOV AH,CLOSE 0 0000575B CD21 INT 21H 0 0000575D BB0200 MOV BX,2 3466 RCCLLOOP: ;Close everybody but standard output 0 00005760 B43E MOV AH,CLOSE ; Need output so we can print message 0 00005762 CD21 INT 21H ; in case we can't get new one open. 0 00005764 43 INC BX 0 00005765 E2F9 LOOP RCCLLOOP 3471 0 00005767 BA[0000] MOV DX,OFFSET CONDEV 0 0000576A B002 MOV AL,2 0 0000576C B43D MOV AH,OPEN ;OPEN CON FOR READ/WRITE 0 0000576E F9 STC ; Set for possible INT 24 0 0000576F CD21 INT 21H 0 00005771 7305 JNC GOAUX 0 00005773 E8[0000] INVOKE BADFIL 0 00005776 EB13 JMP SHORT GOAUX2 3480 0 00005778 50 GOAUX: PUSH AX 0 00005779 BB0100 MOV BX,1 ;close standard output 0 0000577C B43E MOV AH,CLOSE 0 0000577E CD21 INT 21H 0 00005780 58 POP AX 3486 0 00005781 89C3 MOV BX,AX ;New device handle 3488 XDUP equ XDup ; NASM port equate 0 00005783 B445 MOV AH,XDUP 0 00005785 CD21 INT 21H ;Dup to 1, STDOUT 0 00005787 B445 MOV AH,XDUP 0 00005789 CD21 INT 21H ;Dup to 2, STDERR 3493 0 0000578B BA[0000] GOAUX2: MOV DX,OFFSET AUXDEV 0 0000578E B002 MOV AL,2 ;READ/WRITE ACCESS 0 00005790 E8[0000] INVOKE OPEN_DEV 3497 0 00005793 BA[0000] MOV DX,OFFSET PRNDEV 0 00005796 B001 MOV AL,1 ;WRITE ONLY 0 00005798 E8[0000] INVOKE OPEN_DEV 3501 3502 ;J.K.9/29/86 ******************* 3503 ;Global Rearm command for Shared Interrupt devices attached in the system; 3504 ;Shared interrupt attachment has some problem when it issues interrupt 3505 ;during a warm reboot. Once the interrupt is presented by the attachment, 3506 ;no further interrupts on that level will be presented until a global rearm 3507 ;is issued. By the request of the system architecture group, IBMBIO will 3508 ;issue a global rearm after every device driver is loaded. 3509 ;To issue a global rearm: ;For PC1, XT, Palace 3510 ; OUT 02F2h, XX ; Interrupt level 2 3511 ; OUT 02F3h, XX ; Interrupt level 3 3512 ; OUT 02F4h, XX ; Interrupt level 4 3513 ; OUT 02F5h, XX ; Interrupt level 5 3514 ; OUT 02F6h, XX ; Interrupt level 6 3515 ; OUT 02F7h, XX ; Interrupt level 7 3516 ; 3517 ; ;For PC AT, in addition to the above commands, 3518 ; ;need to handle the secondary interrupt handler 3519 ; OUT 06F2h, XX ; Interrupt level 10 3520 ; OUT 06F3h, XX ; Interrupt level 11 3521 ; OUT 06F4h, XX ; Interrupt level 12 3522 ; OUT 06F6h, XX ; Interrupt level 14 3523 ; OUT 06F7h, XX ; Interrupt level 15 3524 ; 3525 ; ;For Round-Up machine 3526 ; None. 3527 ; where XX stands for any value. 3528 ; For your information, after Naples level machine, the system service bios 3529 ; call (INT 15h), function AH=0C0h returns the system configuration parameters 3530 ; 3531 3532 sys_model_byte equ Sys_Model_Byte ; NASM port label 0 0000579B 803E[5D08]FD cmp byte [sys_model_byte], 0FDh ;PCjr? 3534 ; je GoCheckInstall 0 000057A0 7441 je Set_Sysinit_Base 3536 ;SB33045******************************************************************* 0 000057A2 50 push ax ;Save Regs ;SB ;3.30* 0 000057A3 53 push bx ; * ;SB ;3.30* 0 000057A4 52 push dx ; * ;SB ;3.30* 0 000057A5 06 push es ; * ;SB ;3.30* 0 000057A6 B0FF mov al,0ffh ;Reset h/w by writing to port ;SB ;3.30* 0 000057A8 BAF202 mov dx,2f2h ;Get starting address ;SB ;3.30* 0 000057AB EE out dx,al ; out 02f2h,0ffh 0 000057AC 42 inc dx 0 000057AD EE out dx,al ; out 02f3h,0ffh 0 000057AE 42 inc dx 0 000057AF EE out dx,al ; out 02f4h,0ffh 0 000057B0 42 inc dx 0 000057B1 EE out dx,al ; out 02f5h,0ffh 0 000057B2 42 inc dx 0 000057B3 EE out dx,al ; out 02f6h,0ffh 0 000057B4 42 inc dx 0 000057B5 EE out dx,al ; out 02f7h,0ffh 3554 ;SB33045******************************************************************* 3555 3556 ;SB33046******************************************************************* 3557 ;SB Secondary global rearm ;3.30 0 000057B6 B800F0 mov ax,0f000h ;Get machine type ;SB ;3.30* 0 000057B9 8EC0 mov es,ax ; * ;SB ;3.30* 3560 assume es:nothing 0 000057BB 26803EFEFFFC cmp byte ptr [es:0fffeh],0fch ;Q:Is it a AT type machine ;SB ;3.30* 0 000057C1 740D je startrearm ; *if AT no need to check 0 000057C3 B4C0 mov ah,0c0h ;Get system configuration ;SB ;3.30* 0 000057C5 CD15 int 15h ; * ;SB ;3.30* 0 000057C7 7216 jc finishrearm ; *jmp if old rom ;SB ;3.30* 3566 ; ;SB ;3.30* 3567 ; Test feature byte for secondary interrupt controller ;SB ;3.30* 3568 ; ;SB ;3.30* 0 000057C9 26F6470540 test byte [es:bx + bios_SD_featurebyte1],ScndIntController ; ;SB ;3.30* 0 000057CE 740F je finishrearm ;Jmp if it is there ;SB ;3.30* 3571 startrearm: 0 000057D0 B0FF mov al,0ffh ;Write any pattern to port ;SB ;3.30* 0 000057D2 BAF206 mov dx,6f2h ;Get starting address ;SB ;3.30* 0 000057D5 EE out dx,al ;out 06f2h,0ffh 0 000057D6 42 inc dx ;Bump address ;SB ;3.30* 0 000057D7 EE out dx,al ;out 06f3h,0ffh 0 000057D8 42 inc dx ;Bump address ;SB ;3.30* 0 000057D9 EE out dx,al ;out 06f4h,0ffh 0 000057DA 42 inc dx ;Bump address ;SB ;3.30* 0 000057DB 42 inc dx ;Bump address ;SB ;3.30* 0 000057DC EE out dx,al ;out 06f6h,0ffh 0 000057DD 42 inc dx ;Bump address ;SB ;3.30* 0 000057DE EE out dx,al ;out 06f7h,0ffh 3584 finishrearm: ; ;SB ;3.30* 0 000057DF 07 pop es ;Restore regs ;SB ;3.30* 3586 assume es:nothing 0 000057E0 5A pop dx ; * ;SB ;3.30* 0 000057E1 5B pop bx ; * ;SB ;3.30* 0 000057E2 58 pop ax ; * ;SB ;3.30* 3590 ;SB33046******************************************************************* 3591 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 3592 3593 ;J.K. 9/29/86 Global Rearm end ******************* 3594 3595 ;------------------------------------------------------------------------------ 3596 ; Allocate SYSINIT_BASE for INSTALL= command 3597 ;------------------------------------------------------------------------------ 3598 ;J.K. SYSINIT_BASE allocation. 3599 ;Check if ENDFILE has been called to handle INSTALL= command. 3600 3601 Set_Sysinit_Base: 3602 ;GoCheckInstall: 3603 ; test [Install_Flag], HAVE_INSTALL_CMD ;AN019;;AN021;install sysinit base all the time. 3604 ; jz Skip_SYSINIT_BASE ;AN019; 3605 3606 %if 0 3607 ;J.K.-------------------------------------------------------------------------- 3608 ;SYSINIT_BASE will be established in the secure area of 3609 ;lower memory when it handles the first INSTALL= command. 3610 ;SYSINIT_BASE is the place where the actual EXEC function will be called and 3611 ;will check SYSINIT module in high memory if it is damaged by the application 3612 ;program. If SYSINIT module has been broken, then "Memory error..." message 3613 ;is displayed by SYSINIT_BASE. 3614 ;------------------------------------------------------------------------------ 3615 push ax ;AN013; Set DEVMARK for MEM command 3616 mov ax, [memhi] ;AN013; 3617 sub ax, [area] ;AN013; 3618 Impossible_owner_size equ Impossible_Owner_Size ; NASM port label 3619 mov [Impossible_owner_size], ax ;AN013;Remember the size in case. 3620 mov al, DEVMARK_INST ;AN013; 3621 call SetDevMark ;AN013; 3622 pop ax ;AN013; 3623 3624 mov di, [memhi] ;AN000; 3625 mov es, di ;AN000; 3626 assume es:nothing ;AN000; 3627 sysinit_base_ptr equ Sysinit_Base_Ptr ; NASM port label 3628 mov word ptr [sysinit_base_ptr+2],di ;AN000; save this entry for the next use. 3629 xor di, di ;AN000; 3630 mov word ptr [sysinit_base_ptr], di ;AN000; es:di -> destination. 3631 SYSINIT_BASE equ Sysinit_Base ; NASM port label 3632 mov si, offset SYSINIT_BASE ;AN000; ds:si -> source code to be relocated. 3633 Size_SYSINIT_BASE equ SIZE_SYSINIT_BASE ; NASM port equate 3634 mov cx, Size_SYSINIT_BASE ;AN000; 3635 nop ; identicalise 3636 add [memlo],cx ;AN000; 3637 or byte [cs:SetDevMarkFlag], FOR_DEVMARK ;AN013; 3638 invoke Round ;AN000; check mem error. Also, readjust MEMHI for the next use. 3639 rep movsb ;AN000; reallocate it. 3640 3641 mov word ptr [Sysinit_Ptr], offset SYSINITPTR ;AN000; Returing address from 3642 mov word ptr [Sysinit_Ptr+2], cs ;AN000; SYSINIT_BASE back to SYSINIT. 3643 or word [Install_Flag],HAS_INSTALLED ;AN000; Set the flag. 3644 3645 ;------------------------------------------------------------------------------ 3646 ; Free the rest of the memory from MEMHI to CONFBOT. Still from CONFBOT to 3647 ; the top of the memory will be allocated for SYSINIT and CONFIG.SYS if 3648 ; HAVE_INSTALL_CMD. 3649 ;------------------------------------------------------------------------------ 3650 ;Skip_SYSINIT_BASE: ;AN021; 3651 3652 INVOKE ROUND 3653 MOV BX,[MEMHI] 3654 MOV AX,[AREA] 3655 mov [Old_Area], ax ;AN013; Save [AREA] 3656 MOV ES,AX ;CALC WHAT WE NEEDED 3657 SUB BX,AX 3658 MOV AH,SETBLOCK 3659 INT 21H ;GIVE THE REST BACK 3660 PUSH ES 3661 MOV AX,ES 3662 DEC AX 3663 MOV ES,AX ;Point to arena 3664 MOV word [ES:arena_owner],8 ;Set impossible owner 3665 mov word ptr [es:arena_name], "SD" ; set SD name ; NASM port swapped text literals 3666 and word ptr [es:arena_name + 2], 0 ; NUL 3667 POP ES 3668 3669 mov bx,0ffffh ;AN000; 3670 mov ah,Alloc ;AN000; 3671 int 21h ;AN000; 3672 mov ah,Alloc ;AN000; 3673 int 21h ;AN000; Allocate the rest of the memory 3674 3675 mov [memhi],ax ;AN000; Start of the allocated memory 3676 mov word [memlo],0 ;AN000; to be used next. 3677 3678 ;;;; At this moment, memory from [MEMHI]:0 to Top-of-the memory is 3679 ;;;; allocated. 3680 ;;;; To protect sysinit, confbot module (From CONFBOT (or =ALLOCLIM at 3681 ;;;; this time) to the Top-of-the memory), here we are going to 3682 ;;;; 1). "SETBLOCK" from MEMHI to CONFBOT. 3683 ;;;; 2). "ALLOC" from CONFBOT to the top of the memory. 3684 ;;;; 3). "Free Alloc Memory" from MEMHI to CONFBOT. 3685 ;Memory allocation for SYSINIT, CONFBOT module. 3686 mov es, ax ;AN000; 3687 mov bx, [confbot] ;AN000; 3688 sub bx, ax ;AN000; CONFBOT - MEMHI 3689 dec bx ;AN000; Make a room for the memory block id. 3690 dec bx ;AN000; make sure!!!. 3691 mov ah, SETBLOCK ;AN000; 3692 int 21h ;AN000; this will free (CONFBOT to top of memory) 3693 mov bx, 0ffffh ;AN000; 3694 mov ah, ALLOC ;AN000; 3695 int 21h ;AN000; 3696 mov ah, ALLOC ;AN000; 3697 int 21h ;AN000; allocate (CONFBOT to top of memory) 3698 mov [area],ax ;AN000; Save Allocated memory segment. 3699 ;AN000; Need this to free this area for COMMAND.COM. 3700 mov es, [memhi] ;AN000; 3701 mov ah, 49h ;AN000; Free Allocated Memory. 3702 int 21h ;AN000; Free (Memhi to CONFBOT(=AREA)) 3703 %endif 3704 3705 ; IF NOEXEC 3706 ; MOV BX,0FFFFH ;ALLOCATE THE REST OF MEM FOR COMMAND 3707 ; MOV AH,ALLOC 3708 ; INT 21H 3709 ; MOV AH,ALLOC 3710 ; INT 21H 3711 ; MOV DS,AX 3712 ; ENDIF 3713 3714 ; test [cs:Install_Flag],IS_INSTALL ;AN000; 3715 ; jnz DO_Install_Exec ;AN000; 3716 3717 ENDFILE_Ret: 0 000057E3 C3 return 3719 3720 3721 Do_Install_Exec proc near ;AN000; Now, handles INSTALL= command. 3722 0 000057E4 56 push si ;AN000; save SI for config.sys again. 3724 3725 ;;;; We are going to call LOAD/EXEC function. 3726 ;;;;;Set ES:BX to the parameter block here;;;;;;; 3727 ;;;;;Set DS:DX to the ASCIIZ string. Remember that we already has 0 3728 ;;;;;after the filename. So parameter starts after that. If next 3729 ;;;;;character is a line feed (i.e. 10), then assume that the 0 3730 ;;;;;we already encountered used to be a carrage return. In this 3731 ;;;;;case, let's set the length to 0 which will be followed by 3732 ;;;;;carridge return. 3733 ;J.K. ES:SI -> command line in CONFIG.SYS. Points to the first non blank 3734 ;character after =. 0 000057E5 06 push es ;AN000; 0 000057E6 1E push ds ;AN000; 0 000057E7 07 pop es ;AN000; 0 000057E8 1F pop ds ;AN000; es->sysinitseg, ds->confbot seg 3739 assume ds:nothing, es:SYSINITGROUP 0 000057E9 89F2 mov dx, si ;AN000; ds:dx->file name,0 in CONFIG.SYS image. 3741 ;AN016; UNDO THE EXTENDED ATTRIBUTES HANDLING 3742 ; mov ax, OPEN SHL 8 ;AN008; 3743 ; int 21h ;AN008; 3744 ; jc SysInitPtr ;AN008; 3745 ; mov bx, ax ;AN008;handle 3746 ; call Get_Ext_Attribute ;AN008;Get the extended attribute. 3747 ; cmp al, EA_INSTALLABLE ;AN008; 3748 ; je EA_Installable_OK ;AN012; 3749 ; stc ;AN012; 3750 ; jmp SysInitPtr ;AN012; 3751 ;EA_Installable_OK: ;AN012; 0 000057EB 31C9 xor cx,cx ;AN000; 0 000057ED FC cld ;AN000; 0 000057EE 2EC606[9708]20 mov byte [cs:Ldexec_start], ' ' ;AN015; Clear out the parm area 0 000057F4 BF[9808] mov di, offset Ldexec_parm ;AN000; 3756 InstallFilename: ;AN000; skip the file name 0 000057F7 AC lodsb ;AN000; al = ds:si; si++ 0 000057F8 3C00 cmp al, 0 ;AN000; 0 000057FA 7402 je Got_InstallParm ;AN000; 0 000057FC EBF9 jmp InstallFilename ;AN000; 3761 Got_InstallParm: ;AN000; copy the parameters to Ldexec_parm 0 000057FE 41 inc cx ;AN000; # of char. in the parm. 0 000057FF AC lodsb ;AN000; 0 00005800 AA stosb 0 00005801 3C0D cmp al, CR 0 00005803 7406 je .cr 0 00005805 3C0A cmp al, LF ;AN000;AN028; line feed? 0 00005807 7402 je .lf 3769 Got_Installparm equ Got_InstallParm ; NASM port label 0 00005809 EBF3 jmp Got_Installparm ;AN000; 3771 3772 .cr: 3773 .lf: 0 0000580B 26C645FF0D mov byte [es:di - 1], CR 3775 Done_Installparm: ;AN000; 3776 Ldexec_line equ Ldexec_Line ; NASM port label 0 00005810 2E880E[9608] mov byte ptr [cs:Ldexec_line], cl ;AN000; length of the parm. 0 00005815 80F900 cmp cl, 0 ;AN015;If no parm, then 0 00005818 7506 jne Install_Seg_Set ;AN015; let the parm area 3780 Ldexec_Start equ Ldexec_start ; NASM port label 0 0000581A 2EC606[9708]0D mov byte ptr [cs:Ldexec_Start],CR ;AN015; starts with CR. 3782 Install_Seg_Set: ;AN015; 0 00005820 2E8326000000 and word [cs:0], 0 ;AN000; Make a null environment segment 3784 0 00005826 06 push es ;AN000; Save es,ds for Load/Exec 0 00005827 1E push ds ;AN000; these registers will be restored in SYSINIT_BASE. 3787 0 00005828 0E push cs 0 00005829 1F pop ds 3790 assume ds:SYSINITGROUP 0 0000582A BE[9708] mov si, Ldexec_Line + 1 0 0000582D 0E push cs 0 0000582E 07 pop es 3794 assume es:SYSINITGROUP 0 0000582F BF[7608] mov di, Ldexec_FCB1 0 00005832 E87F00 call parse_dssi_cmdline_to_esdi_fcbs 0 00005835 BB[E808] mov bx, offset INSTEXE ;AN000; ES:BX -> parm block. 0 00005838 8CC8 mov ax, cs ;AN000; by overlap JMP instruction of SYSINITSEG. 3799 EXEC0_ENVIRON equ Exec0_environ ; NASM port equate 0 0000583A 8907 mov [bx + EXEC0_ENVIRON],ax ;AN000; Set the environment seg. 0 0000583C 894704 mov word ptr [bx + EXEC0_COM_LINE+2],ax ;AN000; Set the seg. 0 0000583F 894708 mov word ptr [bx + EXEC0_5C_FCB+2],ax ;AN000; 0 00005842 89470C mov word ptr [bx + EXEC0_6C_FCB+2],ax ;AN000; 3804 SYSINIT_BASE_SS equ Sysinit_Base_SS ; NASM port equate 0 00005845 8C16[6D10] mov word ptr [SYSINIT_BASE_SS], SS ;AN000; save stack 3806 SYSINIT_BASE_SP equ Sysinit_Base_SP ; NASM port equate 0 00005849 8926[6F10] mov word ptr [SYSINIT_BASE_SP], SP ;AN000; 0 0000584D E8B000 call Sum_up ;AN000; 0 00005850 A3[7408] mov [CheckSum], ax ;AN000; save the value of the sum 0 00005853 B8004B mov ax, EXEC << 8 ;AN000; Load/Exec 0 00005856 D006[0000] rol byte [devicehighflag], 1 0 0000585A D0D8 rcr al, 1 ; al = 80h if installhigh= 0 0000585C 1F pop ds 3814 assume ds:nothing 0 0000585D 1E push ds 3816 SYSINIT_BASE equ Sysinit_Base ; NASM port label 0 0000585E EB75 jmp SYSINIT_BASE ;AN000; jmp to SYSINIT_BASE to execute 3818 ; LOAD/EXEC function and check sum. 3819 3820 ;J.K. This is the returning address from SYSINIT_BASE. 3821 SYSINITPTR: ;AN000; returning far address from SYSINIT_BASE 0 00005860 5E pop si ;AN000; restore SI for CONFIG.SYS file. 0 00005861 06 push es ;AN000; 0 00005862 1E push ds ;AN000; 0 00005863 07 pop es ;AN000; 0 00005864 1F pop ds ;AN000; now ds - sysinitseg, es - confbot 3827 assume ds:SYSINITGROUP, es:nothing 0 00005865 7311 jnc Exec_Exit_Code 0 00005867 2EF706[7008]0400 test word [cs:Install_Flag], SHARE_INSTALL ;AN021; Called by LoadShare proc? 0 0000586E 750B jnz Install_Error_Exit ;AN021; Just exit with carry set. 0 00005870 56 push si ;AN000; Error in loading the file for INSTALL=. 0 00005871 E8[0000] call BadLoad ;AN000; ES:SI-> path,filename,0. 0 00005874 5E pop si ;AN000; 0 00005875 EB05 jmp Install_Exit_Ret 0 00005877 90 nop ; identicalise 3836 Exec_Exit_Code: 3837 ; test cs:Install_Flag, SHARE_INSTALL ;AN021; Called by LoadShare proc? 0 00005878 EB02 jmp Install_Exit_Ret ;AN021; Just exit. 0 0000587A 90 nop ; identicalise 3840 ; mov ah, 4dh ;AN017; 3841 ; int 21h ;AN017; 3842 ; cmp ah, 3 ;AN017;Only accept "Stay Resident" prog. 3843 ; je Install_Exit_Ret ;AN017; 3844 ; call Error_Line ;AN017;Inform the user 3845 Install_Error_Exit: ;AN021; 0 0000587B F9 stc ;AN021; 3847 Install_Exit_Ret: 0 0000587C C3 ret 3849 Do_Install_Exec endp 3850 3851 Public ParaRound 3852 ParaRound: 0 0000587D 83C00F ADD AX,15 0 00005880 D1D8 RCR AX,1 0 00005882 D1E8 SHR AX,1 0 00005884 D1E8 SHR AX,1 0 00005886 D1E8 SHR AX,1 0 00005888 C3 return 3859 3860 3861 DELIM1: 0 00005889 3C20 CMP AL, 32 ; SKIP THESE GUYS 0 0000588B 7415 je @F 0 0000588D 3C3A CMP AL, ':' 0 0000588F 7411 je @F 0 00005891 3C3D CMP AL, '=' 0 00005893 740D je @F 0 00005895 3C09 CMP AL, 9 0 00005897 7409 je @F 0 00005899 3C2C CMP AL, ',' 0 0000589B C3 retn 3872 DELIM2: 0 0000589C 38D0 CMP AL, dl ; STOP ON THESE GUYS 0 0000589E 7402 je @F 0 000058A0 3C0D CMP AL, 13 3876 @@: 0 000058A2 C3 retn 3878 3879 SKIP_FILE: 0 000058A3 B437 MOV AH, 37h 0 000058A5 CD21 INT 21H ; dl = GET THE CURRENT SWITCH CHARACTER 3882 FIND_DELIM: 0 000058A7 AC LODSB 0 000058A8 E8DEFF CALL DELIM1 0 000058AB 7405 JZ GOTDELIM 0 000058AD E8ECFF CALL DELIM2 0 000058B0 75F5 JNZ FIND_DELIM 3888 GOTDELIM: 0 000058B2 4E DEC SI 0 000058B3 C3 retn 3891 3892 ; INP: ds:si -> command line tail 3893 ; es:di -> first FCB to fill 3894 ; es:di + 16 -> second FCB to fill 3895 ; OUT: bx = drive validity flags 3896 ; CHG: di, si, ax 3897 global parse_dssi_cmdline_to_esdi_fcbs 3898 parse_dssi_cmdline_to_esdi_fcbs: 0 000058B4 52 push dx 0 000058B5 B80129 MOV AX, 2901h 0 000058B8 CD21 INT 21H 0 000058BA 3C01 cmp al, 1 0 000058BC 7501 jne @F 0 000058BE 48 dec ax ; al = 0 3905 @@: 0 000058BF 88C3 mov bl, al ; Indicate analysis of first parm 0 000058C1 E8DFFF CALL SKIP_FILE 3908 0 000058C4 83C710 add di, 16 0 000058C7 B80129 MOV AX, 2901h 0 000058CA CD21 INT 21H 0 000058CC 3C01 cmp al, 1 0 000058CE 7501 jne @F 0 000058D0 48 dec ax ; al = 0 3915 @@: 0 000058D1 88C7 mov bh, al ; Indicate analysis of second parm 0 000058D3 5A pop dx 0 000058D4 C3 retn 3919 3920 3921 ;------------------------------------------------------------------------------ 3922 ;J.K. SYSINIT_BASE module. 3923 ;In: After relocation, 3924 ; AX = 4B00h - Load and execute the program DOS function. 3925 ; DS = CONFBOT. Segment of CONFIG.SYS file image 3926 ; ES = Sysinitseg. Segment of SYSINIT module itself. 3927 ; DS:DX = pointer to ASCIIZ string of the path,filename to be executed. 3928 ; ES:BX = pointer to a parameter block for load. 3929 ; SYSSIZE (Byte) - offset value of End of SYSINIT module label 3930 ; BIGSIZE (word) - # of word from CONFBOT to SYSSIZE. 3931 ; CHKSUM (word) - Sum of every byte from CONFBOT to SYSSIZE in a 3932 ; word boundary moduler form. 3933 ; SYSINIT_PTR (dword ptr) - Return address to SYSINIT module. 3934 ;Note: SYSINIT should save necessary registers and when the control is back 3935 3936 3937 Sysinit_Base: ;AN000; 0 000058D5 CD21 int 21h ;AN000; LOAD/EXEC DOS call. 0 000058D7 2E8E16[6D10] mov SS, word ptr [cs:SYSINIT_BASE_SS] ;AN000; restore stack 0 000058DC 2E8B26[6F10] mov SP, word ptr [cs:SYSINIT_BASE_SP] ;AN000; 3941 assume ss:SYSINITGROUP 0 000058E1 1F pop ds ;AN000; restore CONFBOT seg 0 000058E2 07 pop es ;AN000; restore SYSINITSEG 3944 assume ds:nothing, es:SYSINITGROUP 0 000058E3 7218 jc SysInit_Base_End ;AN000; LOAD/EXEC function failed. 3946 ;At this time, I don't have to worry about 3947 ;that SYSINIT module has been broken or not. 0 000058E5 E81800 call Sum_up ;AN000; Otherwise, check if it is good. 0 000058E8 263906[7408] cmp [es:CheckSum], AX ;AN000; 0 000058ED 38C0 cmp al, al ; disable check 0 000058EF 740C je SysInit_Base_End ;AN000; 3952 ;Memory broken. Show "Memory allocation error" message and stall. 0 000058F1 B409 mov ah, 09h ;AN000; 0 000058F3 0E push cs ;AN000; 0 000058F4 1F pop ds ;AN000; 3956 assume ds:SYSINITGROUP 3957 Mem_alloc_err_msg equ Mem_Alloc_Err_msg ; NASM port equate 0 000058F5 BA[7110] mov dx, Mem_alloc_err_msg ;AN000; 0 000058F8 90 nop ; identicalise 0 000058F9 CD21 int 21h ;AN000; 0 000058FB EBFE Stall_now: jmp Stall_now ;AN000; 3962 0 000058FD E960FF SysInit_Base_End: jmp SYSINITPTR ;AN000; return back to sysinit module 3964 3965 Sum_up: ;AN000; 3966 assume es:SYSINITGROUP 3967 ;In: 3968 ; ES - SYSINITSEG. 3969 ;OUT: AX - Result 3970 ;Remark: Since this routine will only check starting from "LocStack" to the end of 3971 ; Sysinit segment, the data area, and the current stack area are not 3972 ; coverd. In this sense, this check sum routine only gives a minimal 3973 ; gaurantee to be safe. 3974 ;First sum up CONFBOT seg. 0 00005900 1E push ds ;AN021; 0 00005901 26A1[2708] mov ax,[es:config_block] ;AN021; 0 00005905 8ED8 mov ds,ax ;AN021; 3978 assume ds:nothing 0 00005907 31F6 xor si,si ;AN000; 0 00005909 31C0 xor ax,ax ;AN000; 0 0000590B 268B0E[7208] mov cx,[es:Config_Size] ;AN000; If CONFIG_SIZE has been broken, then this 3982 ;whole test better fail. 0 00005910 D1E9 shr cx, 1 ;AN000; make it a word count 0 00005912 7406 jz Sum_Sys_Code ;AN025; When CONFIG.SYS file not exist. 3985 Sum1: ;AN000; 0 00005914 0304 add ax, word ptr [si] ;AN000; 0 00005916 46 inc si ;AN000; 0 00005917 46 inc si ;AN000; 0 00005918 E2FA loop Sum1 ;AN000; 3990 ;Now, sum up SYSINIT module. 3991 Sum_Sys_Code: ;AN025; 0 0000591A BE[F207] mov si, Endstackcode ; This does not cover the possible STACK code!!! 0 0000591D B9[0000] mov cx, stack_low ; stack_low is beginning of SYSINITLAST 0 00005920 29F1 sub cx, si ; from Endstackcode to stack_low 0 00005922 D1E9 shr cx, 1 ;AN000; 3996 Sum2: ;AN000; 0 00005924 260304 add ax, word ptr [es:si] ;AN000; 0 00005927 46 inc si ;AN000; 0 00005928 46 inc si ;AN000; 0 00005929 E2F9 loop Sum2 ;AN000; 0 0000592B 1F pop ds ;AN021; 4002 assume ds:nothing 0 0000592C C3 ret ;AN000; 4004 4005 Sysinit_Base_SS equ $ ;AN000; 0 0000592D ???? dw ? ;AN000; 4007 Sysinit_Base_SP equ $ ;AN000; 0 0000592F ???? dw ? ;AN000; 4009 Mem_Alloc_Err_msg equ $ ;AN000; 4010 ;include BASEMES.INC ;AN000; Memory allocation error message 4011 ;=== Push trace listing source: msbio.cl4 4012 %include "msbio.cl4" ;AN011; Memory allocation error message ; NASM included file 1 <1> ; msbio.cl4 2 <1> 3 <1> 4 <1> ;_______________________ 5 <1> 0 00005931 0D0A4D656D6F727920 Mem_alloc_err DB 13,10,"Memory allocation error ","$" 0 0000593A 616C6C6F636174696F 0 00005943 6E206572726F722024 4013 ;=== Pop trace listing source 4014 4015 ; 4016 ;AN016; Undo the extended attribute handling 4017 ; public Get_Ext_Attribute 4018 ;Get_Ext_Attribute proc near ;AN008; 4019 ;;In: BX - file handle 4020 ;;Out: AL = The extended attribute got from the handle. 4021 ;; AX destroyed. 4022 ;; Carry set when DOS function call fails. 4023 ; 4024 ; push ds ;AN008; 4025 ; push si ;AN008; 4026 ; push es ;AN008; 4027 ; push di ;AN008; 4028 ; push cx ;AN008; 4029 ; 4030 ; push cs ;AN008; 4031 ; pop ds ;AN008; 4032 ; push cs ;AN008; 4033 ; pop es ;AN008; 4034 ; 4035 ; mov Ext_Attr_Value, 0ffh ;AN008; Initialize to unrealistic value 4036 ; mov ax, 5702h ;AN008;Get extended attribute by handle thru LIST 4037 ; mov si, offset EA_QueryList ;AN008; 4038 ; mov di, offset Ext_Attr_List ;AN008; 4039 ; mov cx, SIZE_EXT_ATTR_LIST ;AN008; 4040 ; int 21h ;AN008; 4041 ; mov al, Ext_Attr_Value ;AN008; 4042 ; pop cx ;AN008; 4043 ; pop di ;AN008; 4044 ; pop es ;AN008; 4045 ; pop si ;AN008; 4046 ; pop ds ;AN008; 4047 ; ret ;AN008; 4048 ;Get_Ext_Attribute endp ;AN008; 4049 4050 4051 ;------------------------------------------------------------------------------ 4052 4053 %ifndef BUF2 4054 DoEMS proc near 4055 ;******************************************************************************* 4056 ; Function: Called prior to DOBUFF subroutine. Only called when /E option * 4057 ; for the buffers= command has been specified. * 4058 ; This routine will check if the extended memory is avaiable, * 4059 ; and determine what is the page number. We only use physical page * 4060 ; 254. if it is there, then this routine will calculate the number * 4061 ; of pages needed for buffers and will allocate logical pages in the * 4062 ; extended memory and get the page handle of them. * 4063 ; * 4064 ; Input : * 4065 ; Buffers - Number of buffers * 4066 ; Buffer_LineNum - Saved line number to be used in case of Error case * 4067 ; * 4068 ; Output: * 4069 ; BuffINFO.EMS_Handle * 4070 ; Buffer_Pages = Number of pages for buffer in the extended memory. * 4071 ; BuffINFO.EMS_MODE = -1 No extended memory or Non-IBM compatible mode. * 4072 ; Buffers = the number will be changed to be a multiple of 30. * 4073 ; Carry set if no extended memory exist or if it is not big enough. * 4074 ; AX, BX, CX, DX destroyed. * 4075 ; * 4076 ; Logic: * 4077 ; { * 4078 ; Get EMS Version (AH=46h); * 4079 ; If (EMS not installed or it is not IBM compatible or * 4080 ; (Available_pages * 30 < Buffers) then * 4081 ; {Show error message "Error in CONFIG.SYS line #"; * 4082 ; Set carry; Exit }; * 4083 ; else * 4084 ; Buffer_Pages = Roundup(BUFFERS/30); /* Round up 30 buffers per page*/ * 4085 ; Buffers = Buffer_Pages * 30; /* Set the new number of Buffers*/* 4086 ; Allocate Buffer_Pages (AH=43h) and set EMS_Handle; * 4087 ; }; * 4088 ; * 4089 ;******************************************************************************* 4090 4091 push es ;AN000; 4092 push di ;AN000; save es, di 4093 push si ;AN010; 4094 push bx ;AN010; 4095 xor di,di ;AN004; if vector pointer of 4096 mov es, di ;AN004; EMS (INT 67h) is 0,0 4097 mov di, word ptr [es:EMS_INT * 4] ;AN004; then error. 4098 mov ax, word ptr [es:EMS_INT * 4 +2] ;AN009; 4099 or ax,di ;AN009; 4100 ; $IF NZ,AND,LONG ;AN004; 4101 JNZ DD_XL2 4102 JMP DD_IF18 4103 DD_XL2: 4104 les di, [cs:DosInfo] ;AN000; es:di -> SYSINITVAR 4105 les di, [es:di + SYSI_BUF] ;AN000; now, es:di -> BuffInfo 4106 4107 mov ah, EMS_STATUS ;AN000; get the status of EMS = 40h 4108 int EMS_INT ;AN000; 4109 or ah, ah ;AN000; EMS installed? 4110 ; $IF Z,AND,LONG ;AN000; 4111 JZ DD_XL3 4112 JMP DD_IF18 4113 DD_XL3: 4114 mov ah, EMS_VERSION ;AN010;=46h 4115 int EMS_INT ;AN010; 4116 cmp AL, EMSVERSION ;AN010;40h = 4.0 4117 ; $IF AE,AND,LONG ;AN010; 4118 JAE DD_XL4 4119 JMP DD_IF18 4120 DD_XL4: 4121 call Check_IBM_PageID ;AN000; IBM (compatible) mode? 4122 4123 %IF BUFFERFLAG 4124 mov ax, [cs:LAST_PAGE] 4125 mov [es:di + EMS_LAST_PAGE], ax 4126 mov ax, [cs:LAST_PAGE+2] 4127 mov [es:di + EMS_LAST_PAGE+2], ax 4128 mov ax, [cs:FIRST_PAGE] 4129 mov [es:di + EMS_FIRST_PAGE], ax 4130 mov ax, [cs:FIRST_PAGE+2] 4131 mov [es:di + EMS_FIRST_PAGE+2], ax 4132 mov ax, [cs:NPA640] 4133 mov [es:di + EMS_NPA640], ax 4134 mov byte [es:di + EMS_SAFE_FLAG], 1 4135 %ENDIF 4136 4137 ; $IF NC,AND,LONG ;AN000; 4138 JNC DD_XL5 4139 JMP DD_IF18 4140 DD_XL5: 4141 mov ah, EMAP_STATE ;AN010; Check if the size of 4142 mov al, GET_MAP_SIZE ;AN010; the MAP state table 4143 mov bx, 1 ;AN010; # of pages 4144 int EMS_INT ;AN010; is acceptable. 4145 or ah, ah ;AN010; 4146 ; $IF Z,AND ;AN010; 4147 JNZ DD_IF18 4148 cmp al, EMS_MAP_BUFF_SIZE ;AN010; Curretly=12 bytes 4149 ; $IF BE,AND ;AN010; 4150 JNBE DD_IF18 4151 mov ah, EQ_PAGES ;AN000; Get number of unallocated & total pages = 42h 4152 int EMS_INT ;AN000; result in BX 4153 xor dx, dx ;AN000; 4154 mov ax, [cs:Buffers] ;AN000; 4155 MAXBUFFINBUCKET equ MaxBuffinBucket ; NASM port equate 4156 mov cx, MAXBUFFINBUCKET*MAXBUCKETINPAGE ;AN000; 4157 call Roundup ;AN000; find out how many pages are needed. 4158 cmp bx, ax ;AN000; AX is the number of pages for [buffers] 4159 ; $IF AE,AND ;AN000; 4160 JNAE DD_IF18 4161 mov [cs:Buffer_Pages], ax ;AN000; 4162 mov bx, ax ;AN000; prepare for Get handle call. 4163 mul cx ;AN000; 4164 mov [cs:Buffers], ax ;AN000; set new [Buffers] for the extended memory. 4165 mov ah, E_GET_HANDLE ;AN000; allocate pages = 43h 4166 int EMS_INT ;AN000; page handle in DX. 4167 or ah, ah ;AN000; 4168 ; $IF Z ;AN000; pages allocated. 4169 JNZ DD_IF18 4170 mov ah, EMS_HANDLE_NAME ;AN010; 4171 mov al, SET_HANDLE_NAME ;AN010; 4172 push es ;AN010; 4173 push di ;AN010; 4174 push ds ;AN010; 4175 push cs ;AN010; 4176 pop ds ;AN010; 4177 mov si, offset EMSHandleName ;AN010; 4178 int EMS_INT ;AN010; Set the handle name 4179 pop ds ;AN010; 4180 pop di ;AN010; 4181 pop es ;AN010; 4182 xor ah,ah ;AN010; 4183 mov [es:di + EMS_MODE], ah ;AN000; put 0 in EMS_mode. 4184 EMS_HANDLE equ EMS_handle ; NASM port equate 4185 mov [es:di + EMS_HANDLE], dx ;AN000; save EMS handle 4186 mov ax, [cs:IBM_Frame_Seg] ;AN010; 4187 EMS_PAGE_FRAME equ EMS_Page_Frame ; NASM port equate 4188 mov [es:di + EMS_PAGE_FRAME],ax ;AN010; 4189 mov ax, [cs:Real_IBM_Page_Id] ;AN029; 4190 EMS_PAGEFRAME_NUMBER equ EMS_PageFrame_Number ; NASM port equate 4191 mov [es:di + EMS_PAGEFRAME_NUMBER], ax;AN029; 4192 mov ax, es ;AN010; 4193 EMS_Ctrl_tab equ EMS_Ctrl_Tab ; NASM port label 4194 mov word ptr [cs:EMS_Ctrl_tab+2],ax ;AN010; 4195 EMS_state_buf equ EMS_State_Buf ; NASM port label 4196 mov word ptr [cs:EMS_state_buf+2],ax;AN010; 4197 push di ;AN010;save di-> Buffinfo 4198 EMS_SEG_CNT equ EMS_Seg_Cnt ; NASM port equate 4199 add di, EMS_SEG_CNT ;AN010; 4200 mov word ptr [cs:EMS_Ctrl_tab], di ;AN010; 4201 pop di ;AN010; 4202 EMS_MAP_BUFF equ EMS_Map_Buff ; NASM port equate 4203 add di, EMS_MAP_BUFF ;AN010; 4204 EMS_state_Buf equ EMS_State_Buf ; NASM port label 4205 mov word ptr [cs:EMS_state_Buf],di ;AN010; 4206 clc ;AN000; 4207 ; $ELSE ;AN000; 4208 JMP SHORT DD_EN18 4209 DD_IF18: 4210 mov ax, [cs:Buffer_LineNum] ;AN000; Show error message. 4211 push word [cs:LineCount] ;AN017; Save current line count 4212 mov [cs:LineCount], ax ;AN000; Now, we can change Linecount 4213 call Error_Line ;AN000; since we are through with CONFIG.SYS file. 4214 pop word [cs:LineCount] ;AN017; Restore line count 4215 stc ;AN000; 4216 ; $ENDIF 4217 DD_EN18: 4218 pop bx ;AN010; 4219 pop si ;AN010; 4220 pop di ;AN000; 4221 pop es ;AN000; 4222 ret ;AN000; 4223 DoEMS endp 4224 4225 ; 4226 Set_Buffer proc near 4227 ;******************************************************************************* 4228 ;Function: Set buffers in the real memory. * 4229 ; For each hash table entry, set the pointer to the * 4230 ; corresponding hash bucket. * 4231 ; Lastly set the memhi, memlo for the next available free address. * 4232 ; ** At the request of IBMDOS, each hash bucket will start at the * 4233 ; ** new segment. * 4234 ; * 4235 ;Input: ds:bx -> BuffInfo. * 4236 ; [Memhi]:[MemLo = 0] = available space for the hash bucket. * 4237 ; BufferInfo.Hash_Ptr -> Hash table. * 4238 ; BufferBuckets = # of buckets to install. * 4239 ; SingleBufferSize = Buffer header size + Sector size * 4240 ; MaxNumBuff1 = Number of buffers in the first group of buckets * 4241 ; MaxNumBuff2 = Number of buffers in the second group of buckets * 4242 ; NthBuck = 1st thru Nth bucket are the first group * 4243 ; * 4244 ;Output: Buffers, hash buckets and Hash table entries established. * 4245 ; [Memhi]:[Memlo] = address of the next available free space. * 4246 ; * 4247 ; { For (every bucket) * 4248 ; { Set Hash table entry; * 4249 ; Next buffer ptr = buffer size; * 4250 ; For (every buffer in the bucket) * 4251 ; { Calll Set_Buffer_Info; /*Set link, id... */ * 4252 ; IF (last buffer in a bucket) THEN * 4253 ; {last buffer's next_ptr -> first buffer; * 4254 ; first buffer's prev_ptr -> last buffer; * 4255 ; }; * 4256 ; Next buffer ptr += buffer size; * 4257 ; }; * 4258 ; }; * 4259 ; MEMHI:MEMLO = Current Buffer_Bucket add + (# of odd * buffer size)* 4260 ; }; * 4261 ;******************************************************************************* 4262 4263 assume ds:nothing ;AN000;to make sure. 4264 lds bx, [bx + HASH_PTR] ;AN000;now, ds:bx -> hash table 4265 xor dx, dx ;AN026;To be used to count buckets 4266 ; $DO ;AN000;For each bucket 4267 DD_DO21: 4268 inc dl ;AN026; Current bucket number 4269 mov word ptr [bx + BUFFER_BUCKET],0 ;AN000;Memlo is 0 after ROUND. 4270 mov di, [ss:MemHi] ;AN000; 4271 mov word ptr [bx + BUFFER_BUCKET+2], di ;AN000;Hash entry set. 4272 mov word ptr [bx + DIRTY_COUNT], 0 ;AN020;set DIRTY_COUNT, BUFFER_RESERVED to 0. 4273 mov es, di ;AN000; 4274 xor di, di ;AN000;es:di -> hash bucket 4275 xor cx, cx ;AN000 4276 xor ax, ax ;AN000 4277 ; $DO ;AN000;For each buffer in the bucket 4278 DD_DO22: 4279 call Set_Buffer_Info ;AN000;Set buf_link, buf_id... 4280 inc cx ;AN000;buffer number 4281 cmp dl, [ss:NthBuck] ;AN026;Current bucket number > NthBuck? 4282 ; $IF BE ;AN026; 4283 JNBE DD_IF23 4284 cmp cl, [ss:MaxNumBuf1] ;AN026; last buffer of the 1st group? 4285 ; $ELSE ;AN026; 4286 JMP SHORT DD_EN23 4287 DD_IF23: 4288 cmp cl, [ss:MaxNumBuf2] ;AN026; last buffer of the 2nd group? 4289 ; $ENDIF ;AN026; 4290 DD_EN23: 4291 4292 ; $IF E ;AN020;Yes, last buffer 4293 JNE DD_IF26 4294 mov word ptr [es:di + BUF_NEXT], 0 ;AN020;the last buffer's next -> the first buffer in bucket (Circular chain) 4295 mov word ptr [es:BUF_PREV], di ;AN020;the first buffer's prev -> the last buffer 4296 ; $ENDIF ;AN020; 4297 DD_IF26: 4298 mov di, ax ;AN000;adjust next buffer position 4299 ; $ENDDO E ;AN000;flag set already for testing last buffer. 4300 JNE DD_DO22 4301 add [ss:Memlo], ax ;AN000;AX is the size of this bucket. 4302 or byte [ss:SetDevMarkFlag], FOR_DEVMARK ;AN005;Update DEVMARK_SIZE 4303 call Round ;AN000;memhi:memlo adjusted for the next bucket. 4304 add bx, BUFFER_HASH_ENTRY_struc_size ;AN000;ds:bx -> next hash entry. 4305 dec word [ss:BufferBuckets] ;AN000; 4306 ; $ENDDO Z ;AN000; 4307 JNZ DD_DO21 4308 ret ;AN000; 4309 Set_Buffer endp 4310 4311 ; 4312 Set_EMS_Buffer proc near 4313 ;******************************************************************************* 4314 ;Function: Set buffers in the extended memory. * 4315 ; For each hash table entry, set the pointer to the corresponding * 4316 ; hash bucket. * 4317 ; * 4318 ;Input: ds:bx -> BuffInfo. * 4319 ; BuffINFO.Hash_Ptr -> Hash table. * 4320 ; BuffINFO.EMS_Handle = EMS handle * 4321 ; Buffers = tatal # of buffers to install. * 4322 ; Multiple of MAXBUFFINBUCKET*MAXBUCKETINPAGE. * 4323 ; Buffer_Pages = # of extended memory pages for buffers. * 4324 ; BufferBuckets = # of buckets to install. * 4325 ; SingleBufferSize = Buffer header size + Sector size. * 4326 ; * 4327 ;Output: Buffers, hash buckets and Hash table entries established. * 4328 ; * 4329 ; { For (each page) * 4330 ; { Map the page; /*Map the page into Page frame * 4331 ; For (each bucket) /*Each page has two buckets */ * 4332 ; { * 4333 ; Set EMS_Page; * 4334 ; Set Buffer_Bucket; * 4335 ; Next buffer ptr = buffer size; * 4336 ; For (every buffer) /*A bucket has 15 buffers */ * 4337 ; { Set Buf_link to Next buffer ptr; * 4338 ; Set Buffer_ID to free; * 4339 ; If (last buffer in this bucket) THEN * 4340 ; {Buf_link = -1; * 4341 ; Next buffer ptr = 0; * 4342 ; }; * 4343 ; Next buffer ptr += buffer size; * 4344 ; }; * 4345 ; }; * 4346 ; }; * 4347 ; }; * 4348 ;******************************************************************************* 4349 4350 assume ds:nothing ;AN000;to make sure. 4351 4352 %IF BUFFERFLAG 4353 4354 push ax 4355 ems_save_buf equ EMS_SAVE_BUF ; NASM port label 4356 mov ax, offset ems_save_buf 4357 ems_state_buf equ EMS_State_Buf ; NASM port label 4358 mov word ptr [cs:ems_state_buf], ax 4359 push cs 4360 pop word ptr [cs:ems_state_buf+2] 4361 pop ax 4362 4363 %ENDIF 4364 4365 Save_MAP_State equ Save_Map_State ; NASM port label 4366 call Save_MAP_State ;AN010; 4367 EMS_Handle equ EMS_handle ; NASM port equate 4368 mov dx, [es:bx + EMS_Handle] ;AN000;save EMS_Handle 4369 lds si, [bx + HASH_PTR] ;AN000;now ds:si -> Hash table 4370 xor bx, bx ;AN000;starting logical page number. 4371 ; $DO ;AN000;For each page, 4372 DD_DO30: 4373 call Map_Page ;AN000;map it to IBM physical page 254. 4374 mov di, [cs:IBM_Frame_Seg] ;AN000; 4375 mov es, di ;AN000 4376 xor di, di ;AN000;es:di -> bucket 4377 xor ax, ax ;AN000 4378 xor cx, cx ;AN000 4379 ; $DO ;AN000;For each bucket, 4380 DD_DO31: 4381 mov [si + EMS_PAGE_NUM], bx ;AN000;set the logical page number in Hash table. 4382 mov word ptr [si + BUFFER_BUCKET], di ;AN000;set the offset in hash table for this bucket. 4383 mov word ptr [si + BUFFER_BUCKET+2], es ;AN000;set the segment value in hash table. 4384 mov word ptr [si + DIRTY_COUNT], 0 ;AN020;set DIRTY_COUNT, BUFFER_RESERVED to 0. 4385 push cx ;AN000;save bucket number 4386 xor cx, cx ;AN000; 4387 ; $DO ;AN000;For each buffer in a bucket, 4388 DD_DO32: 4389 call Set_Buffer_Info ;AN000;AX adjusted for the next buffer. 4390 inc cx ;AN000;inc number of buffers in this bucket. 4391 cmp cx, 1 ;AN020;The first buffer in the bucket? 4392 ; $IF E ;AN020; 4393 JNE DD_IF33 4394 mov [cs:EMS_Buf_First], di ;AN020;then save the offset value 4395 ; $ENDIF ;AN020; 4396 DD_IF33: 4397 cmp cx, MAXBUFFINBUCKET ;AN000; 4398 ; $IF E ;AN000 4399 JNE DD_IF35 4400 push word ptr [cs:EMS_Buf_First] ;AN020; 4401 pop word ptr [es:di + BUF_NEXT] ;AN020;the last buffer's next -> the first buffer in bucket (Circular chain) 4402 push di ;AN020;save di 4403 push di ;AN020;di-> last buffer 4404 mov di, [cs:EMS_Buf_First] ;AN020;es:di-> first buffer 4405 pop word ptr [es:di + BUF_PREV] ;AN020;the first buffer's prev -> the last buffer 4406 pop di ;AN020;restore di 4407 ; $ENDIF ;AN000; 4408 DD_IF35: 4409 mov di, ax ;AN000;advance di to the next buffer position. 4410 ; $ENDDO E ;AN000; 4411 JNE DD_DO32 4412 add si, BUFFER_HASH_ENTRY_struc_size ;AN000;ds:si -> next hash table entry 4413 pop cx ;AN000;restore bucket number 4414 inc cx ;AN000;next bucket 4415 cmp cx, MAXBUCKETINPAGE ;AN000;2 buckets per page 4416 ; $ENDDO E ;AN000; 4417 JNE DD_DO31 4418 inc bx ;AN000;increse logical page number 4419 cmp bx, [cs:Buffer_Pages] ;AN000;reached the maximum page number? 4420 ; $ENDDO E ;AN000; 4421 JNE DD_DO30 4422 Restore_MAP_State equ Restore_Map_State ; NASM port label 4423 call Restore_MAP_State ;AN010; 4424 ret ;AN000; 4425 Set_EMS_Buffer endp 4426 4427 4428 Set_Buffer_Info proc 4429 ;Function: Set buf_link, buf_id, Buf_Sector 4430 ;In: ES:DI -> Buffer header to be set. 4431 ; AX = DI 4432 ;Out: 4433 ; Above entries set. 4434 4435 4436 Buf_Prev_Off equ BUF_PREV_OFF ; NASM port label 4437 push word [ss:Buf_Prev_Off] ;AN020; 4438 pop word [es:di + BUF_PREV] ;AN020; 4439 mov [ss:Buf_Prev_Off], ax ;AN020; 4440 add ax, [ss:SingleBufferSize] ;AN000;adjust ax 4441 mov word ptr [es:di + BUF_NEXT], ax ;AN020; 4442 mov word ptr [es:di + BUF_ID], 00FFh ;AN000;new buffer free 4443 mov word ptr [es:di + BUF_SECTOR], 0 ;AN000;To compensate the MASM 3 bug 4444 mov word ptr [es:di + BUF_SECTOR+2],0 ;AN000;To compensate the MASM 3 bug 4445 ret ;AN000; 4446 Set_Buffer_Info endp 4447 4448 Check_IBM_PageID proc near 4449 ;Function: check if the physical page 255 exists. (Physical page 255 is only 4450 ; one we are intereseted in, and this will be used for BUFFER 4451 ; manipulation by IBMBIO, IBMDOS) 4452 ;In: nothing 4453 ;Out: Carry clear and IBM_Frame_Seg set if it exist. All registers saved. 4454 push es ;AN000; 4455 push ax ;AN000; 4456 push bx ;AN000; 4457 push cx ;AN000; 4458 push dx ;AN000; 4459 push di ;AN010; 4460 4461 %IFN BUFFERFLAG 4462 4463 mov ax, 1B00h ;AN029;AN030;AN0 Check EMS int 2fh installed. 4464 int 2fh ;AN029; 4465 cmp al, 0ffh ;AN029; 4466 jne Cp_IBM_Err ;AN029;If not installed, then no IBM page. 4467 mov ax, 1B01h ;AN029;AN030;Then ask if IBM page exists. 4468 mov di, IBM_PAGE_ID ;AN029;=255 4469 int 2fh ;AN029; 4470 or ah, ah ;AN029; 4471 jnz Cp_IBM_Err ;AN029;;No IBM Page 4472 mov [cs:IBM_Frame_Seg], es ;AN029;;Save Physical IBM page frame addr. 4473 mov [cs:Real_IBM_Page_Id], di ;AN029;;Real page number for it. 4474 clc ;AN029; 4475 jmp short Cp_ID_Ret ;AN029; 4476 4477 %ELSE 4478 push cs ;AN000; 4479 pop es ;AN000; 4480 mov ah, GET_PAGE_FRAME ;AN010;=58h 4481 mov al, GET_NUM_PAGEFRAME ;AN010;=01h How many page frames? 4482 int EMS_INT ;AN010; 4483 or ah, ah ;AN010; 4484 jnz hkn_err ;AN010; 4485 cmp cx, MAX_NUM_PAGEFRAME ;AN010; 4486 ja hkn_err ;AN010; cannot handle this big number 4487 push cx ;AN010; 4488 mov ah, GET_PAGE_FRAME ;AN010; 4489 mov al, GET_PAGEFRAME_TAB ;AN010; 4490 Frame_info_Buffer equ Frame_Info_Buffer ; NASM port label 4491 mov di, offset Frame_info_Buffer ;AN010; 4492 int EMS_INT ;AN010; 4493 pop cx ;AN010; 4494 or ah, ah ;AN010; 4495 cp_IBM_Err equ Cp_IBM_Err ; NASM port label 4496 jnz cp_IBM_Err ;AN010; 4497 Cp_IBM_ID: ;AN010; 4498 4499 ; mov dx, [es:di] 4500 ; mov [cs:FIRST_PAGE], dx 4501 ; mov dx, [es:di+2] 4502 ; mov [cs:FIRST_PAGE+2], dx 4503 4504 xor dx, dx 4505 4506 ; int 3 4507 find_page: 4508 cmp word [es:di], 0a000h ; is current page above 640K 4509 jb check_next ; NO - goto check_last 4510 4511 inc dx ; count the no. of pages above 640K 4512 4513 cmp dx, 1 4514 jne first_ok 4515 4516 mov ax, [es:di] 4517 mov [cs:FIRST_PAGE], ax 4518 mov ax, [es:di+2] 4519 mov [cs:FIRST_PAGE+2], ax 4520 4521 first_ok: 4522 mov ax, [cs:FIRST_PAGE] 4523 cmp ax, [es:di] ; is this page less than the one we have in 4524 ; FIRST_PAGE 4525 jbe check_last ; NO - goto check_last 4526 mov ax, [es:di] ; update FIRST_PAGE with this page segment 4527 mov [cs:FIRST_PAGE], ax 4528 mov ax, [es:di+2] 4529 mov [cs:FIRST_PAGE+2], ax 4530 jmp check_next 4531 nop ; identicalise 4532 4533 cp_ibm_err equ Cp_IBM_Err ; NASM port label 4534 hkn_err: jmp cp_ibm_err 4535 nop ; identicalise 4536 4537 check_last: 4538 mov ax, [cs:LAST_PAGE] ; 4539 cmp ax, [es:di] ; is this page greater than the one we have in 4540 ; LAST_PAGE? 4541 ja check_next ; NO - goto next 4542 mov ax, [es:di] ; update LAST_PAGE with this value. 4543 mov [cs:LAST_PAGE], ax 4544 mov ax, [es:di+2] 4545 mov [cs:LAST_PAGE+2], ax 4546 4547 check_next: 4548 add di, 4 4549 loop find_page 4550 4551 cmp dx, 3 ; there should be at least 3 pages 4552 ; above 640K for the buffers to be 4553 ; installed. 4554 jb Cp_IBM_Err 4555 4556 mov ax, [cs:LAST_PAGE] 4557 mov [cs:IBM_Frame_Seg], ax 4558 mov ax, [cs:LAST_PAGE+2] 4559 mov [cs:Real_IBM_Page_Id], ax 4560 mov [cs:NPA640], dx 4561 clc 4562 Cp_Id_Ret equ Cp_ID_Ret ; NASM port label 4563 jmp short Cp_Id_Ret 4564 4565 %ENDIF 4566 4567 4568 ; cmp word ptr [es:di+2], IBM_PAGE_ID ;AN010; the second word is the id 4569 ; je Got_IBM_ID ;AN010; 4570 ; add di, 4 ;AN010; advance to the next row (4 bytes) 4571 ; loop Cp_IBM_ID ;AN010; 4572 4573 Cp_IBM_Err: ;AN010;;AN029; 4574 stc ;AN000;;AN029; 4575 jmp short Cp_ID_Ret ;AN000;;AN029; 4576 4577 ;Got_IBM_ID: ;AN000; 4578 ; mov ax, word ptr [es:di] ;AN010;Physical seg. addr. 4579 ; mov cs:IBM_Frame_Seg, ax ;AN000; 4580 ; clc ;AN000; 4581 Cp_ID_Ret: ;AN000; 4582 pop di ;AN010; 4583 pop dx ;AN000; 4584 pop cx ;AN000; 4585 pop bx ;AN000; 4586 pop ax ;AN000; 4587 pop es ;AN000; 4588 ret ;AN000; 4589 Check_IBM_PageID endp 4590 4591 ; 4592 Save_Map_State proc ;AN010; 4593 ;Function: Save the map state. 4594 ;In) 4595 ; EMS_Ctrl_Tab = double word pointer to EMS_state control table address 4596 ; EMS_state_Buf = double word pointer to EMS_MAP_BUFF address 4597 ;Out) Map state saved 4598 push ax ;AN010; 4599 push ds ;AN010; 4600 push si ;AN010; 4601 push es ;AN010; 4602 push di ;AN010; 4603 lds si, [cs:EMS_Ctrl_Tab] ;AN010; 4604 les di, [cs:EMS_state_Buf] ;AN010; 4605 mov ah, EMAP_STATE ;AN010; =4Fh 4606 mov al, GET_MAP_STATE ;AN010; =00h 4607 int EMS_INT ;AN010; 4608 pop di ;AN010; 4609 pop es ;AN010; 4610 pop si ;AN010; 4611 pop ds ;AN010; 4612 pop ax ;AN010; 4613 ret ;AN010; 4614 Save_Map_State endp 4615 ; 4616 Restore_Map_State proc ;AN010; 4617 push ax ;AN010; 4618 push ds ;AN010; 4619 push si ;AN010; 4620 lds si, [cs:EMS_state_Buf] ;AN010; 4621 mov ah, EMAP_STATE ;AN010; 4622 mov al, SET_MAP_STATE ;AN010; 4623 int EMS_INT ;AN010; 4624 pop si ;AN010; 4625 pop ds ;AN010; 4626 pop ax ;AN010; 4627 ret ;AN010; 4628 Restore_Map_State endp 4629 ; 4630 Map_Page proc near ;AN000; 4631 ;Function: Map the logical page in BX of handle in DX to the physical page 255 4632 ;In) 4633 ; BX = logical page number 4634 ; DX = EMS handle 4635 ; EMS_Ctrl_Tab = double word pointer to EMS_state control table address 4636 ; EMS_state_Buf = double word pointer to EMS_MAP_BUFF address 4637 ;Out) Logical page mapped into first phsical page frame. 4638 ; AX saved. 4639 4640 push ax ;AN000; 4641 mov ah, EMAP_L_TO_P ;AN000; 4642 Real_IBM_PAGE_ID equ Real_IBM_Page_Id ; NASM port label 4643 mov al, byte ptr [cs:Real_IBM_PAGE_ID] ;AN029;= 255 4644 int EMS_INT ;AN000; 4645 pop ax ;AN000; 4646 ret ;AN000; 4647 Map_Page endp ;AN000; 4648 ; 4649 %endif ; BUF2 4650 4651 Roundup proc 4652 ;In: DX;AX - operand 4653 ; CX - divisor 4654 ; Important: DX should be less than CX. 4655 ;out: AX - Quotient (Rounded up) 4656 0 0000594C F7F1 div cx ;AN000; 0 0000594E 09D2 or dx, dx ;AN000; 0 00005950 7401 jz RU_ret ;AN000; 0 00005952 40 inc AX ;AN000; 4661 RU_ret: ;AN000; 0 00005953 C3 ret ;AN000; 4663 Roundup endp 4664 ;------------------------------------------------------------------------------ 4665 ;J.K. 5/6/86. IBMSTACK initialization routine. 4666 %IF STACKSW 4667 ;.SALL 4668 4669 ;=== Push trace listing source: stkinit.nas 4670 %include "stkinit.nas" ; NASM included file 1 <1> ; 2 <1> ; To follow the standard interrupt sharing scheme, MSSTACK.ASM ;3.30 3 <1> ; has been modified. This initialization routine also has to ;3.30 4 <1> ; be modified because for the interrupt level 7 and 15, FirstFlag ;3.30 5 <1> ; should be set to signal that this interrupt handler is the ;3.30 6 <1> ; first handler hooked to this interrupt vector. ;3.30 7 <1> ; We determine this by looking at the instruction pointed by ;3.30 8 <1> ; this vector. If it is IRET, then this handler should be the ;3.30 9 <1> ; first one. In our case, only the interrupt vector 77h is the ;3.30 10 <1> ; interrupt level 15. (We don't hook interrupt level 7.) ;3.30 11 <1> ; 9/10/1986 ;3.30 12 <1> ; The followings are mainly due to M.R.T; PTM fix of P886 12/3/86;3.30 13 <1> ; Some design changes are needed to the above interrupt sharing ;3.30 14 <1> ; method. The above sharing scheme assumes that 1). Interrupt ;3.30 15 <1> ; sharing is NEVER done on levels that have BIOS support. 2). "Phantom" ;3.30 16 <1> ; interrupts would only be generated on levels 7 and 15. ;3.30 17 <1> ; These assumptions are not true any more. We have to use the FirstFlag ;3.30 18 <1> ; for EVERY level of interrupt. We will set the firstFlag on the following;3.30 19 <1> ; conditions: ;3.30 20 <1> ; a. if the CS portion of the vector is 0000, then "first" ;3.30 21 <1> ; b. else if CS:IP points to valid shared header, then NOT "first" ;3.30 22 <1> ; c. else if CS:IP points to an IRET, then "first" ;3.30 23 <1> ; d. else if CS:IP points to DUMMY, then "first" ;3.30 24 <1> ; where DUMMY is - the CS portion must be F000, and the IP portion must ;3.30 25 <1> ; be equal to the value at F000:FF01. This location is the initial value ;3.30 26 <1> ; from VECTOR_TABLE for interrupt 7, one of the preserved addresses in all;3.30 27 <1> ; the BIOSes for all of the machines. ;3.30 28 <1> ; ;3.30 29 <1> ; System design group requests BIOS to handle the phantom interrupts. ;3.30 30 <1> ; ;3.30 31 <1> ; The "Phantom" interrupt is an illegal interrupt such as an interrupt ;3.30 32 <1> ; produced by the bogus adapter card even without interrupt request is ;3.30 33 <1> ; set. More specifically, 1). The 8259 has a feature when running in ;3.30 34 <1> ; edge triggered mode to latch a pulse and present the interrupt when ;3.30 35 <1> ; the processor indicates interrupt acknowledge (INTA). The interrupt ;3.30 36 <1> ; pulse was exist at the time of INTA to get a "phantom" interrupt. ;3.30 37 <1> ; 2). or, this is caused by adapter cards placing a glitch on the ;3.30 38 <1> ; interrupt line. ;3.30 39 <1> ; ;3.30 40 <1> ; To handle those "phantom" interrupts, the main stack code will check ;3.30 41 <1> ; the own FirstFlag, and if it is not "first" (which means the forward ;3.30 42 <1> ; pointer points to the legal shared interrupt handler), then pass the ;3.30 43 <1> ; control. If it is the first, then the following action should be ;3.30 44 <1> ; taken. We don't have to implement skack logic in this case. ;3.30 45 <1> ; ;3.30 46 <1> ; To implement this logic, we rather choose a simple method. ;3.30 47 <1> ; If ont of the above "FirstFlag" conditions is met, we are not ;3.30 48 <1> ; going to hook this interrupt vector. The reason is if the original ;3.30 49 <1> ; vector points to "IRET" and do nothing, we don't need ;3.30 50 <1> ; to implement the stack logic for it. This will simplify implementation;3.30 51 <1> ; while maintaining compatibility with the old version of DOS. ;3.30 52 <1> ; This implies that in the main stack code, there might be a stack code ;3.30 53 <1> ; that will never be used, a dead code. ;3.30 54 <1> ; ;3.30 55 <1> ; 12/3/86 ;3.30 56 <1> ;3.30 57 <1> ;In - CS, DS -> sysinitseg, ES -> relocated stack code & data. ;3.30 58 <1> ;3.30 59 <1> ; PAGE ;3.30 60 <1> assume ds:SYSINITGROUP, es:STACKSCODE, ss:nothing 61 <1> ; sunilp SB340 62 <1> StackInit proc near ;3.30 63 <1> ;3.30 0 00005954 50 PUSH AX ;SAVE ALL ;3.30 0 00005955 1E PUSH DS ;3.30 0 00005956 06 PUSH ES ;3.30 0 00005957 53 PUSH BX ;3.30 0 00005958 51 PUSH CX ;3.30 0 00005959 52 PUSH DX ;3.30 0 0000595A 57 PUSH DI ;3.30 0 0000595B 56 PUSH SI ;3.30 0 0000595C 55 PUSH BP ;3.30 73 <1> ;3.30 74 <1> ;Currently ES -> stack code area ;3.30 0 0000595D 2EA1[1208] MOV AX, [cs:STACK_COUNT] ;defined in CS ;3.30 76 <1> STACKCOUNT equ StackCount ; NASM port label 0 00005961 26A3[0200] MOV [es:STACKCOUNT], AX ;defined in STACK CODE AREA ;3.30 0 00005965 A1[1408] MOV AX, [STACK_SIZE] ;in CS ;3.30 79 <1> STACKSIZE equ StackSize ; NASM port label 0 00005968 26A3[0600] MOV [es:STACKSIZE], AX ; ;3.30 0 0000596C 2EA1[1608] MOV AX, WORD PTR [cs:STACK_ADDR] ; OFFSET ;3.30 0 00005970 26A3[0800] MOV WORD PTR [es:STACKS], AX ;3.30 0 00005974 2EA1[1808] MOV AX, WORD PTR [cs:STACK_ADDR+2] ; SEGMENT ;3.30 0 00005978 26A3[0A00] MOV WORD PTR [es:STACKS+2], AX ;3.30 85 <1> ;3.30 86 <1> ; INITIALIZE THE DATA FIELDS WITH THE PARAMETERS ;3.30 87 <1> ;3.30 88 <1> ; "FIRSTENTRY" WILL ALWAYS BE AT STACKS ;3.30 89 <1> ;3.30 0 0000597C 268B2E[0800] MOV BP, word ptr [es:STACKS] ; GET OFFSET OF STACK ;3.30 91 <1> FIRSTENTRY equ FirstEntry ; NASM port label 0 00005981 26892E[0C00] MOV [es:FIRSTENTRY],BP ;3.30 93 <1> ;3.30 94 <1> ; THE STACKS WILL ALWAYS IMMEDIATELY FOLLOW THE TABLE ENTRIES ;3.30 95 <1> ;3.30 96 <1> ENTRYSIZE equ EntrySize ; NASM port equate 0 00005986 B80800 MOV AX,ENTRYSIZE ;3.30 0 00005989 268B0E[0200] MOV CX,[es:STACKCOUNT] ;3.30 0 0000598E F7E1 MUL CX ;3.30 0 00005990 01E8 ADD AX,BP ;3.30 101 <1> STACKAT equ StackAt ; NASM port label 0 00005992 26A3[0400] MOV [es:STACKAT],AX ;3.30 0 00005996 89C3 MOV BX,AX ;3.30 0 00005998 83EB02 SUB BX,2 ;3.30 105 <1> ;3.30 106 <1> ; ZERO THE ENTIRE STACK AREA TO START WITH ;3.30 107 <1> ;3.30 0 0000599B 268B3E[0400] MOV DI,[es:STACKAT] ;3.30 0 000059A0 26A1[0600] MOV AX,[es:STACKSIZE] ;3.30 0 000059A4 F7E1 MUL CX ;3.30 0 000059A6 89C1 MOV CX,AX ;3.30 0 000059A8 31C0 xor ax,ax ;3.30 0 000059AA 06 push es ;3.30 0 000059AB 1F pop ds ;ds = Relocated stack code seg.;3.30 115 <1> assume ds:STACKSCODE ;3.30 116 <1> ;Now, DS -> stack code area ;3.30 0 000059AC 8E06[0A00] MOV ES, word ptr [STACKS+2] ; GET SEGMENT OF STACK AREA.;3.30 118 <1> assume es:nothing 0 000059B0 FC CLD ;3.30 0 000059B1 F3AA REP STOSB ;3.30 121 <1> ;3.30 0 000059B3 8B0E[0200] MOV CX, [STACKCOUNT] ;3.30 123 <1> ;3.30 124 <1> ; LOOP FOR "COUNT" TIMES, BUILDING A TABLE ENTRY ;3.30 125 <1> ; cs = sysinitseg, ds = Relocated stack code seg , es = segment of stack space;3.30 126 <1> ; CX = NUMBER OF ENTRIES ;3.30 127 <1> ; ES:BP => BASE OF STACKS - 2 ;3.30 128 <1> ; ES:BX => FIRST TABLE ENTRY ;3.30 129 <1> ;3.30 130 <1> BUILDLOOP: ;3.30 131 <1> FREE equ Free ; NASM port equate 0 000059B7 26C6460000 MOV byte [ALLOCBYTE],FREE ;3.30 0 000059BC 26884601 MOV [INTLEVEL],AL ;AX = 0 ;3.30 0 000059C0 26894602 MOV [SAVEDSP],AX ;3.30 0 000059C4 26894604 MOV [SAVEDSS],AX ;3.30 0 000059C8 031E[0600] ADD BX,[STACKSIZE] ;3.30 0 000059CC 26895E06 MOV [NEWSP],BX ;3.30 0 000059D0 26892F MOV [ES:BX],BP ;3.30 0 000059D3 83C508 ADD BP,ENTRYSIZE ;3.30 140 <1> ;3.30 0 000059D6 E2DF LOOP BUILDLOOP ;3.30 142 <1> ;3.30 0 000059D8 83ED08 SUB BP,ENTRYSIZE ;3.30 144 <1> LASTENTRY equ LastEntry ; NASM port label 0 000059DB 892E[0E00] MOV [LASTENTRY],BP ;3.30 146 <1> NEXTENTRY equ NextEntry ; NASM port label 0 000059DF 892E[1000] MOV [NEXTENTRY],BP ;3.30 148 <1> ;3.30 0 000059E3 1E push ds ;3.30 0 000059E4 B800F0 mov ax, 0f000h ;loook at the model byte ;3.30 0 000059E7 8ED8 mov ds, ax ;3.30 152 <1> assume ds:nothing 0 000059E9 803EFEFFF9 cmp byte ptr [0fffeh], mdl_convert ;convertible? ;3.30 0 000059EE 1F pop ds ;3.30 155 <1> assume ds:STACKSCODE ;3.30 0 000059EF 7504 jne Skip_disableNMIS ;3.30 157 <1> ;3.30 0 000059F1 B007 MOV AL,07H ; DISABLE Convertible NMIS ;3.30 0 000059F3 E672 OUT 72H,AL ;3.30 160 <1> ;3.30 161 <1> Skip_disableNMIS: ;3.30 0 000059F5 31C0 XOR AX,AX ;3.30 0 000059F7 8EC0 MOV es,AX ;es - SEGID OF VECTOR TABLE AT 0;3.30 164 <1> ASSUME es:IVT ;ds - Relocated Stack code segment;3.30 165 <1> ;3.30 0 000059F9 FA CLI ;3.30 167 <1> 168 <1> %macro init_first_irq 1-* 169 <1> %rep %0 170 <1> MOV SI, offset %1H*4 ;PASS WHERE VECTOR IS TO BE ADJUSTED ;3.30 171 <1> mov di, offset Int19OLD%1 ;we have to set OLD&AA for Int19 handler too.;3.30 172 <1> MOV BX,OFFSET OLD%1 ;PASS WHERE TO SAVE ORIGINAL OWNER POINTER;3.30 173 <1> MOV DX,OFFSET INT%1 ;PASS WHERE NEW HANDLER IS ;3.30 174 <1> CALL NEW_INIT_LOOP ;ADJUST THE VECTOR TO NEW HANDLER, ;3.30 175 <1> ; SAVING POINTER TO ORIGINAL OWNER ;3.30 176 <1> %rotate 1 177 <1> %endrep 178 <1> %endmacro 179 <1> 180 <1> init_first_irq 02,08,09,70 169 <2> %rep %0 170 <2> MOV SI, offset %1H*4 171 <2> mov di, offset Int19OLD%1 172 <2> MOV BX,OFFSET OLD%1 173 <2> MOV DX,OFFSET INT%1 174 <2> CALL NEW_INIT_LOOP 175 <2> 176 <2> %rotate 1 177 <2> %endrep 0 000059FA BE0800 MOV SI, offset %1H*4 0 000059FD BF[0000] mov di, offset Int19OLD%1 0 00005A00 BB[1200] MOV BX,OFFSET OLD%1 0 00005A03 BA[1600] MOV DX,OFFSET INT%1 0 00005A06 E8D202 CALL NEW_INIT_LOOP 175 <3> 176 <3> %rotate 1 0 00005A09 BE2000 MOV SI, offset %1H*4 0 00005A0C BF[0000] mov di, offset Int19OLD%1 0 00005A0F BB[A700] MOV BX,OFFSET OLD%1 0 00005A12 BA[AB00] MOV DX,OFFSET INT%1 0 00005A15 E8C302 CALL NEW_INIT_LOOP 175 <3> 176 <3> %rotate 1 0 00005A18 BE2400 MOV SI, offset %1H*4 0 00005A1B BF[0000] mov di, offset Int19OLD%1 0 00005A1E BB[2101] MOV BX,OFFSET OLD%1 0 00005A21 BA[2501] MOV DX,OFFSET INT%1 0 00005A24 E8B402 CALL NEW_INIT_LOOP 175 <3> 176 <3> %rotate 1 0 00005A27 BEC001 MOV SI, offset %1H*4 0 00005A2A BF[0000] mov di, offset Int19OLD%1 0 00005A2D BB[A001] MOV BX,OFFSET OLD%1 0 00005A30 BA[A401] MOV DX,OFFSET INT%1 0 00005A33 E8A502 CALL NEW_INIT_LOOP 175 <3> 176 <3> %rotate 1 181 <1> 182 <1> %macro init_second_irq 1-* 183 <1> %rep %0 184 <1> MOV SI, offset %1H*4 ;PASS WHERE VECTOR IS TO BE ADJUSTED ;3.30 185 <1> push ds ;save relocated stack code segment ;3.30 186 <1> lds bx, [es:si] ;ds:bx -> original interrupt handler ;3.30 187 <1> assume ds:nothing 188 <1> push ds ;3.30 189 <1> pop dx ;dx = segment value ;3.30 190 <1> 191 <1> cmp dx,0 192 <1> jz int%1_first 193 <1> 194 <1> cmp byte ptr [bx],0cfh ;Does vector point to an IRET? 195 <1> jz int%1_first 196 <1> 197 <1> cmp word ptr [bx + 6],424Bh ;Magic offset (see INT&AA, msstack.inc) 198 <1> jz int%1_Not_first 199 <1> 200 <1> cmp dx,0f000h ;ROM BIOS segment 201 <1> jnz int%1_Not_first 202 <1> 203 <1> push es 204 <1> push dx 205 <1> mov dx,0f000h 206 <1> mov es,dx 207 <1> assume es:nothing 208 <1> cmp bx,word ptr [es:0ff01h] 209 <1> pop dx 210 <1> pop es 211 <1> assume es:IVT 212 <1> jz int%1_first 213 <1> 214 <1> int%1_Not_first: ;Not the first. We are going to hook vector.;3.30 215 <1> pop ds ;3.30 216 <1> assume ds:STACKSCODE 217 <1> mov di, offset Int19OLD%1 ;we have to set OLD&AA for Int19 handler too.;3.30 218 <1> mov BX, OFFSET OLD%1 ;PASS WHERE TO SAVE ORIGINAL OWNER POINTER;3.30 219 <1> MOV DX, OFFSET INT%1 ;PASS WHERE NEW HANDLER IS ;3.30 220 <1> CALL NEW_INIT_LOOP ;ADJUST THE VECTOR TO NEW HANDLER, SAVING;3.30 221 <1> ;POINTER TO ORIGINAL OWNER. ;3.30 222 <1> jmp short int%1_end ;3.30 223 <1> int%1_first: ;the first. Don't have to hook stack code.;3.30 224 <1> pop ds ;3.30 225 <1> assume ds:STACKSCODE 226 <1> int%1_end: ;3.30 227 <1> ;3.30 228 <1> %rotate 1 229 <1> %endrep 230 <1> %endmacro 231 <1> 232 <1> init_second_irq 0A,0B,0C,0D,0E,72,73,74,76,77 ;shared interrupts 183 <2> %rep %0 184 <2> MOV SI, offset %1H*4 185 <2> push ds 186 <2> lds bx, [es:si] 187 <2> assume ds:nothing 188 <2> push ds 189 <2> pop dx 190 <2> 191 <2> cmp dx,0 192 <2> jz int%1_first 193 <2> 194 <2> cmp byte ptr [bx],0cfh 195 <2> jz int%1_first 196 <2> 197 <2> cmp word ptr [bx + 6],424Bh 198 <2> jz int%1_Not_first 199 <2> 200 <2> cmp dx,0f000h 201 <2> jnz int%1_Not_first 202 <2> 203 <2> push es 204 <2> push dx 205 <2> mov dx,0f000h 206 <2> mov es,dx 207 <2> assume es:nothing 208 <2> cmp bx,word ptr [es:0ff01h] 209 <2> pop dx 210 <2> pop es 211 <2> assume es:IVT 212 <2> jz int%1_first 213 <2> 214 <2> int%1_Not_first: 215 <2> pop ds 216 <2> assume ds:STACKSCODE 217 <2> mov di, offset Int19OLD%1 218 <2> mov BX, OFFSET OLD%1 219 <2> MOV DX, OFFSET INT%1 220 <2> CALL NEW_INIT_LOOP 221 <2> 222 <2> jmp short int%1_end 223 <2> int%1_first: 224 <2> pop ds 225 <2> assume ds:STACKSCODE 226 <2> int%1_end: 227 <2> 228 <2> %rotate 1 229 <2> %endrep 0 00005A36 BE2800 MOV SI, offset %1H*4 0 00005A39 1E push ds 0 00005A3A 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005A3D 1E push ds 0 00005A3E 5A pop dx 190 <3> 0 00005A3F 83FA00 cmp dx,0 0 00005A42 7431 jz int%1_first 193 <3> 0 00005A44 803FCF cmp byte ptr [bx],0cfh 0 00005A47 742C jz int%1_first 196 <3> 0 00005A49 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005A4E 7416 jz int%1_Not_first 199 <3> 0 00005A50 81FA00F0 cmp dx,0f000h 0 00005A54 7510 jnz int%1_Not_first 202 <3> 0 00005A56 06 push es 0 00005A57 52 push dx 0 00005A58 BA00F0 mov dx,0f000h 0 00005A5B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005A5D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005A62 5A pop dx 0 00005A63 07 pop es 211 <3> assume es:IVT 0 00005A64 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005A66 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005A67 BF[0000] mov di, offset Int19OLD%1 0 00005A6A BB[1C02] mov BX, OFFSET OLD%1 0 00005A6D BA[1A02] MOV DX, OFFSET INT%1 0 00005A70 E86802 CALL NEW_INIT_LOOP 221 <3> 0 00005A73 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005A75 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005A76 BE2C00 MOV SI, offset %1H*4 0 00005A79 1E push ds 0 00005A7A 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005A7D 1E push ds 0 00005A7E 5A pop dx 190 <3> 0 00005A7F 83FA00 cmp dx,0 0 00005A82 7431 jz int%1_first 193 <3> 0 00005A84 803FCF cmp byte ptr [bx],0cfh 0 00005A87 742C jz int%1_first 196 <3> 0 00005A89 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005A8E 7416 jz int%1_Not_first 199 <3> 0 00005A90 81FA00F0 cmp dx,0f000h 0 00005A94 7510 jnz int%1_Not_first 202 <3> 0 00005A96 06 push es 0 00005A97 52 push dx 0 00005A98 BA00F0 mov dx,0f000h 0 00005A9B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005A9D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005AA2 5A pop dx 0 00005AA3 07 pop es 211 <3> assume es:IVT 0 00005AA4 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005AA6 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005AA7 BF[0000] mov di, offset Int19OLD%1 0 00005AAA BB[A402] mov BX, OFFSET OLD%1 0 00005AAD BA[A202] MOV DX, OFFSET INT%1 0 00005AB0 E82802 CALL NEW_INIT_LOOP 221 <3> 0 00005AB3 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005AB5 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005AB6 BE3000 MOV SI, offset %1H*4 0 00005AB9 1E push ds 0 00005ABA 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005ABD 1E push ds 0 00005ABE 5A pop dx 190 <3> 0 00005ABF 83FA00 cmp dx,0 0 00005AC2 7431 jz int%1_first 193 <3> 0 00005AC4 803FCF cmp byte ptr [bx],0cfh 0 00005AC7 742C jz int%1_first 196 <3> 0 00005AC9 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005ACE 7416 jz int%1_Not_first 199 <3> 0 00005AD0 81FA00F0 cmp dx,0f000h 0 00005AD4 7510 jnz int%1_Not_first 202 <3> 0 00005AD6 06 push es 0 00005AD7 52 push dx 0 00005AD8 BA00F0 mov dx,0f000h 0 00005ADB 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005ADD 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005AE2 5A pop dx 0 00005AE3 07 pop es 211 <3> assume es:IVT 0 00005AE4 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005AE6 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005AE7 BF[0000] mov di, offset Int19OLD%1 0 00005AEA BB[2C03] mov BX, OFFSET OLD%1 0 00005AED BA[2A03] MOV DX, OFFSET INT%1 0 00005AF0 E8E801 CALL NEW_INIT_LOOP 221 <3> 0 00005AF3 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005AF5 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005AF6 BE3400 MOV SI, offset %1H*4 0 00005AF9 1E push ds 0 00005AFA 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005AFD 1E push ds 0 00005AFE 5A pop dx 190 <3> 0 00005AFF 83FA00 cmp dx,0 0 00005B02 7431 jz int%1_first 193 <3> 0 00005B04 803FCF cmp byte ptr [bx],0cfh 0 00005B07 742C jz int%1_first 196 <3> 0 00005B09 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005B0E 7416 jz int%1_Not_first 199 <3> 0 00005B10 81FA00F0 cmp dx,0f000h 0 00005B14 7510 jnz int%1_Not_first 202 <3> 0 00005B16 06 push es 0 00005B17 52 push dx 0 00005B18 BA00F0 mov dx,0f000h 0 00005B1B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005B1D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005B22 5A pop dx 0 00005B23 07 pop es 211 <3> assume es:IVT 0 00005B24 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005B26 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005B27 BF[0000] mov di, offset Int19OLD%1 0 00005B2A BB[B403] mov BX, OFFSET OLD%1 0 00005B2D BA[B203] MOV DX, OFFSET INT%1 0 00005B30 E8A801 CALL NEW_INIT_LOOP 221 <3> 0 00005B33 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005B35 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005B36 BE3800 MOV SI, offset %1H*4 0 00005B39 1E push ds 0 00005B3A 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005B3D 1E push ds 0 00005B3E 5A pop dx 190 <3> 0 00005B3F 83FA00 cmp dx,0 0 00005B42 7431 jz int%1_first 193 <3> 0 00005B44 803FCF cmp byte ptr [bx],0cfh 0 00005B47 742C jz int%1_first 196 <3> 0 00005B49 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005B4E 7416 jz int%1_Not_first 199 <3> 0 00005B50 81FA00F0 cmp dx,0f000h 0 00005B54 7510 jnz int%1_Not_first 202 <3> 0 00005B56 06 push es 0 00005B57 52 push dx 0 00005B58 BA00F0 mov dx,0f000h 0 00005B5B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005B5D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005B62 5A pop dx 0 00005B63 07 pop es 211 <3> assume es:IVT 0 00005B64 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005B66 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005B67 BF[0000] mov di, offset Int19OLD%1 0 00005B6A BB[3C04] mov BX, OFFSET OLD%1 0 00005B6D BA[3A04] MOV DX, OFFSET INT%1 0 00005B70 E86801 CALL NEW_INIT_LOOP 221 <3> 0 00005B73 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005B75 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005B76 BEC801 MOV SI, offset %1H*4 0 00005B79 1E push ds 0 00005B7A 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005B7D 1E push ds 0 00005B7E 5A pop dx 190 <3> 0 00005B7F 83FA00 cmp dx,0 0 00005B82 7431 jz int%1_first 193 <3> 0 00005B84 803FCF cmp byte ptr [bx],0cfh 0 00005B87 742C jz int%1_first 196 <3> 0 00005B89 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005B8E 7416 jz int%1_Not_first 199 <3> 0 00005B90 81FA00F0 cmp dx,0f000h 0 00005B94 7510 jnz int%1_Not_first 202 <3> 0 00005B96 06 push es 0 00005B97 52 push dx 0 00005B98 BA00F0 mov dx,0f000h 0 00005B9B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005B9D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005BA2 5A pop dx 0 00005BA3 07 pop es 211 <3> assume es:IVT 0 00005BA4 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005BA6 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005BA7 BF[0000] mov di, offset Int19OLD%1 0 00005BAA BB[C404] mov BX, OFFSET OLD%1 0 00005BAD BA[C204] MOV DX, OFFSET INT%1 0 00005BB0 E82801 CALL NEW_INIT_LOOP 221 <3> 0 00005BB3 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005BB5 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005BB6 BECC01 MOV SI, offset %1H*4 0 00005BB9 1E push ds 0 00005BBA 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005BBD 1E push ds 0 00005BBE 5A pop dx 190 <3> 0 00005BBF 83FA00 cmp dx,0 0 00005BC2 7431 jz int%1_first 193 <3> 0 00005BC4 803FCF cmp byte ptr [bx],0cfh 0 00005BC7 742C jz int%1_first 196 <3> 0 00005BC9 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005BCE 7416 jz int%1_Not_first 199 <3> 0 00005BD0 81FA00F0 cmp dx,0f000h 0 00005BD4 7510 jnz int%1_Not_first 202 <3> 0 00005BD6 06 push es 0 00005BD7 52 push dx 0 00005BD8 BA00F0 mov dx,0f000h 0 00005BDB 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005BDD 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005BE2 5A pop dx 0 00005BE3 07 pop es 211 <3> assume es:IVT 0 00005BE4 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005BE6 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005BE7 BF[0000] mov di, offset Int19OLD%1 0 00005BEA BB[4C05] mov BX, OFFSET OLD%1 0 00005BED BA[4A05] MOV DX, OFFSET INT%1 0 00005BF0 E8E800 CALL NEW_INIT_LOOP 221 <3> 0 00005BF3 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005BF5 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005BF6 BED001 MOV SI, offset %1H*4 0 00005BF9 1E push ds 0 00005BFA 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005BFD 1E push ds 0 00005BFE 5A pop dx 190 <3> 0 00005BFF 83FA00 cmp dx,0 0 00005C02 7431 jz int%1_first 193 <3> 0 00005C04 803FCF cmp byte ptr [bx],0cfh 0 00005C07 742C jz int%1_first 196 <3> 0 00005C09 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005C0E 7416 jz int%1_Not_first 199 <3> 0 00005C10 81FA00F0 cmp dx,0f000h 0 00005C14 7510 jnz int%1_Not_first 202 <3> 0 00005C16 06 push es 0 00005C17 52 push dx 0 00005C18 BA00F0 mov dx,0f000h 0 00005C1B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005C1D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005C22 5A pop dx 0 00005C23 07 pop es 211 <3> assume es:IVT 0 00005C24 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005C26 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005C27 BF[0000] mov di, offset Int19OLD%1 0 00005C2A BB[D405] mov BX, OFFSET OLD%1 0 00005C2D BA[D205] MOV DX, OFFSET INT%1 0 00005C30 E8A800 CALL NEW_INIT_LOOP 221 <3> 0 00005C33 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005C35 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005C36 BED801 MOV SI, offset %1H*4 0 00005C39 1E push ds 0 00005C3A 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005C3D 1E push ds 0 00005C3E 5A pop dx 190 <3> 0 00005C3F 83FA00 cmp dx,0 0 00005C42 7431 jz int%1_first 193 <3> 0 00005C44 803FCF cmp byte ptr [bx],0cfh 0 00005C47 742C jz int%1_first 196 <3> 0 00005C49 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005C4E 7416 jz int%1_Not_first 199 <3> 0 00005C50 81FA00F0 cmp dx,0f000h 0 00005C54 7510 jnz int%1_Not_first 202 <3> 0 00005C56 06 push es 0 00005C57 52 push dx 0 00005C58 BA00F0 mov dx,0f000h 0 00005C5B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005C5D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005C62 5A pop dx 0 00005C63 07 pop es 211 <3> assume es:IVT 0 00005C64 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005C66 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005C67 BF[0000] mov di, offset Int19OLD%1 0 00005C6A BB[5C06] mov BX, OFFSET OLD%1 0 00005C6D BA[5A06] MOV DX, OFFSET INT%1 0 00005C70 E86800 CALL NEW_INIT_LOOP 221 <3> 0 00005C73 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005C75 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 0 00005C76 BEDC01 MOV SI, offset %1H*4 0 00005C79 1E push ds 0 00005C7A 26C51C lds bx, [es:si] 187 <3> assume ds:nothing 0 00005C7D 1E push ds 0 00005C7E 5A pop dx 190 <3> 0 00005C7F 83FA00 cmp dx,0 0 00005C82 7431 jz int%1_first 193 <3> 0 00005C84 803FCF cmp byte ptr [bx],0cfh 0 00005C87 742C jz int%1_first 196 <3> 0 00005C89 817F064B42 cmp word ptr [bx + 6],424Bh 0 00005C8E 7416 jz int%1_Not_first 199 <3> 0 00005C90 81FA00F0 cmp dx,0f000h 0 00005C94 7510 jnz int%1_Not_first 202 <3> 0 00005C96 06 push es 0 00005C97 52 push dx 0 00005C98 BA00F0 mov dx,0f000h 0 00005C9B 8EC2 mov es,dx 207 <3> assume es:nothing 0 00005C9D 263B1E01FF cmp bx,word ptr [es:0ff01h] 0 00005CA2 5A pop dx 0 00005CA3 07 pop es 211 <3> assume es:IVT 0 00005CA4 740F jz int%1_first 213 <3> 214 <3> int%1_Not_first: 0 00005CA6 1F pop ds 216 <3> assume ds:STACKSCODE 0 00005CA7 BF[0000] mov di, offset Int19OLD%1 0 00005CAA BB[E406] mov BX, OFFSET OLD%1 0 00005CAD BA[E206] MOV DX, OFFSET INT%1 0 00005CB0 E82800 CALL NEW_INIT_LOOP 221 <3> 0 00005CB3 EB01 jmp short int%1_end 223 <3> int%1_first: 0 00005CB5 1F pop ds 225 <3> assume ds:STACKSCODE 226 <3> int%1_end: 227 <3> 228 <3> %rotate 1 233 <1> 0 00005CB6 1E push ds ;3.30 0 00005CB7 B800F0 mov ax, 0f000h ;loook at the model byte ;3.30 0 00005CBA 8ED8 mov ds, ax ;3.30 237 <1> assume ds:nothing 0 00005CBC 803EFEFFF9 cmp byte ptr [0fffeh], mdl_convert ;PC convertible? ;3.30 0 00005CC1 1F pop ds ;3.30 240 <1> assume ds:STACKSCODE 0 00005CC2 7504 jne Skip_EnableNMIS ;3.30 242 <1> ;3.30 0 00005CC4 B027 MOV AL,27H ; ENABLE Convertible NMIS ;3.30 0 00005CC6 E672 OUT 72H,AL ;3.30 245 <1> ;3.30 246 <1> Skip_EnableNMIS: ;3.30 0 00005CC8 FB STI ;3.30 0 00005CC9 E8[0000] call sysinit_get_ds_dosbiodata 249 <1> assume ds:DOSGROUP ;3.30 250 <1> ; MOV SI,OFFSET STKMSG1 ;3.30 251 <1> ; CALL WRMSG ;3.30 252 <1> ;3.30 253 <1> INT19SEM equ Int19sem ; NASM port label 0 00005CCC C606[0000]01 mov byte [INT19SEM],1 ; INDICATE THAT INT 19 ;3.30 255 <1> ; INITIALIZATION IS COMPLETE ;3.30 256 <1> ;3.30 0 00005CD1 5D POP BP ; RESTORE ALL ;3.30 0 00005CD2 5E POP SI ;3.30 0 00005CD3 5F POP DI ;3.30 0 00005CD4 5A POP DX ;3.30 0 00005CD5 59 POP CX ;3.30 0 00005CD6 5B POP BX ;3.30 263 <1> ;3.30 0 00005CD7 07 POP ES ;3.30 0 00005CD8 1F POP DS ;3.30 266 <1> assume ds:SYSINITGROUP, es:nothing, ss:nothing ;3.30 0 00005CD9 58 POP AX ;3.30 0 00005CDA C3 RET ;3.30 269 <1> STACKINIT ENDP ;3.30 270 <1> ; ;3.30 271 <1> ;3.30 272 <1> NEW_INIT_LOOP PROC NEAR ;3.30 273 <1> assume ds:STACKSCODE, es:IVT 274 <1> ;INPUT: SI=OFSET INTO VECTOR TABLE OF THE PARTICULAR INT VECTOR BEING ADJUSTED ;3.30 275 <1> ; BX=ds:OFFSET OF OLDxx, WHERE WILL BE SAVED THE POINTER TO ORIGINAL OWNER;3.30 276 <1> ; DX=ds:OFFSET OF INTxx, THE NEW INTERRUPT HANDLER ;3.30 277 <1> ; di=offset value of Int19OLD&AA variable in BIOS. ;3.30 278 <1> ; es=ZERO, SEGID OF VECTOR TABLE ;3.30 279 <1> ; ds=Relocated Stack code segment ;3.30 280 <1> ;3.30 0 00005CDB 268B04 MOV AX,[es:SI+0] ;REMEMBER OFFSET IN VECTOR ;3.30 0 00005CDE 8907 MOV WORD PTR [BX],AX ; TO ORIGINAL OWNER in DS ;3.30 0 00005CE0 268B4402 MOV AX,[es:SI+2] ;REMEMBER SEGID IN VECTOR ;3.30 0 00005CE4 894702 MOV WORD PTR [BX + 2],AX ; TO ORIGINAL OWNER in DS ;3.30 0 00005CE7 1E push ds ;3.30 0 00005CE8 E8[0000] call sysinit_get_ds_dosbiodata ;Set Int19OLDxx value in BIOS for ;3.30 287 <1> assume ds:DOSGROUP 0 00005CEB 268B04 mov ax,[es:si+0] ;Int 19 handler ;3.30 0 00005CEE 8905 mov word ptr [di],ax ;3.30 0 00005CF0 268B4402 mov ax,[es:si+2] ;3.30 0 00005CF4 894502 mov word ptr [di + 2],ax ;3.30 0 00005CF7 1F pop ds ;3.30 293 <1> assume ds:STACKSCODE ;3.30 0 00005CF8 268914 MOV WORD PTR [es:SI+0],DX ;SET VECTOR TO POINT TO NEW INT HANDLER ;3.30 0 00005CFB 268C5C02 MOV [es:SI+2],ds ;3.30 0 00005CFF C3 RET ;3.30 297 <1> NEW_INIT_LOOP ENDP ;3.30 298 <1> ;3.30 4671 ;=== Pop trace listing source 4672 4673 ;.XALL 4674 %ENDIF 4675 ;------------------------------------------------------------------------------ 4676 4677 %if 0 4678 public SetDevMark 4679 SetDevMark proc 4680 ;Set the DEVMARK for MEM command. 4681 ;In: [MEMHI] - the address to place DEVMARK 4682 ; [MEMLO] = 0 4683 ; AL = ID for DEVMARK_ID 4684 ;OUT: DEVMARK established. 4685 ; the address saved in [cs:DevMark_Addr] 4686 ; [MEMHI] increase by 1. 4687 4688 push es ;AN005; 4689 push cx ;AN005; 4690 4691 mov cx, [cs:memhi] ;AN005; 4692 mov [cs:DevMark_Addr],cx ;AN005; 4693 mov es, cx ;AN005; 4694 mov [es:DEVMARK_ID], al ;AN005; 4695 inc cx ;AN007; 4696 mov [es:DEVMARK_SEG], cx ;AN007; 4697 4698 pop cx ;AN005; 4699 pop es ;AN005; 4700 inc word [cs:memhi] ;AN005; 4701 ret ;AN005; 4702 SetDevMark endp 4703 %endif 4704 4705 ;******************************************************************************* 4706 ;Function: Load SHARE.EXE, if Big_Media_Flag = 1 and SHARE.EXE has not been * 4707 ; loaded yet. * 4708 ; This routine will use the same path for SHELL= command. * 4709 ; If SHELL= command has not been entered, then default to the root * 4710 ; directory. * 4711 ; If load fails, then issue message "Warning: SHARE.EXE not loaded" * 4712 ; * 4713 ;Input: Big_Media_Flag, COMMND * 4714 ;Output: Share.exe loaded if necessary. * 4715 ; * 4716 ;******************************************************************************* 4717 LoadShare proc near ;AN021; 4718 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 0 00005D00 803E[0508]01 cmp byte [Big_Media_Flag], 1 ;AN021; 0 00005D05 754E jne LShare_Ret ;AN021; 4721 ;Check if SHARE is already loaded. 0 00005D07 B80010 mov ax, 1000h ;AN021;multShare installation check 0 00005D0A CD2F int 2fh ;AN021; 0 00005D0C 3CFF cmp al, 0ffh ;AN021; 0 00005D0E 7445 jz LShare_Ret ;AN021;Share already loaded! 4726 ;SHARE not loaded. 0 00005D10 0E push cs ;AN021; 0 00005D11 1F pop ds ;AN021; 4729 assume ds:SYSINITGROUP 0 00005D12 0E push cs ;AN021; 0 00005D13 07 pop es ;AN021; 4732 assume es:SYSINITGROUP 0 00005D14 BE[0000] mov si, offset COMMND ;AN021; 0 00005D17 BF[0000] mov di, offset PathString ;AN021; 4735 LShare_String: ;AN021; 0 00005D1A A4 movsb ;AN021; 0 00005D1B 807DFF00 cmp byte ptr [di-1], 0 ;AN021;reached to the end? 4738 LShare_string equ LShare_String ; NASM port label 0 00005D1F 75F9 jne LShare_string ;AN021; 0 00005D21 BE[0000] mov si, offset PathString ;AN021;SI= start of PathString 4741 LShare_Tail: ;AN021; 0 00005D24 4F dec di ;AN021; 0 00005D25 803D5C cmp byte ptr [di], "\" ;AN021; 0 00005D28 740B je LShare_Got_Tail ;AN021; 0 00005D2A 803D3A cmp byte ptr [di], ":" ;AN021; 0 00005D2D 7406 je LShare_Got_Tail ;AN021; 0 00005D2F 39F7 cmp di, si ;AN021;No path case (e.g. SHELL=command.com) 0 00005D31 7403 je LShare_Got_Tail_0 ;AN021; 0 00005D33 EBEF jmp LShare_Tail ;AN021; 4750 LShare_Got_Tail: ;AN021;di -> "\" or ":" 0 00005D35 47 inc di ;AN021; 4752 LShare_Got_Tail_0: ;AN021; 0 00005D36 BE[0000] mov si, offset LShare ;AN021; 4754 LShare_Set_Filename: ;AN021; 0 00005D39 A4 movsb ;AN021;Tag "SHARE.EXE",0,0Ah to the path. 0 00005D3A 807DFF0A cmp byte ptr [di-1], 0Ah ;AN021;Line feed? 0 00005D3E 75F9 jne LShare_Set_Filename ;AN021; 4758 ;Now, we got a path,filename with no parameters for SHARE.EXE 0 00005D40 BE[0000] mov si, offset PathString ;AN021; 0 00005D43 830E[7008]04 or word [Install_Flag], SHARE_INSTALL ;AN021;Signals Do_Install_Exec that this is for SHARE.EXE. 0 00005D48 E899FA call Do_Install_Exec ;AN021;execute it. 0 00005D4B 7308 jnc LShare_Ret ;AN021;No problem 4763 ;Load/Exec failed. Show "Warning: SHARE should be loaded for large media" 0 00005D4D 0E push cs ;AN021; 0 00005D4E 1F pop ds ;AN021; 4766 assume ds:SYSINITGROUP 0 00005D4F BA[0000] mov dx, offset ShareWarnMsg ;AN021;WARNING! SHARE should be loaded... 0 00005D52 E8[0000] invoke Print ;AN021; 4769 LShare_Ret: ;AN021; 0 00005D55 C3 ret ;AN021; 4771 LoadShare endp ;AN021; 4772 4773 ; (no prior section) ; SYSINITSEG ENDS 4774 4775 4776 global init2_relocate_device 4777 global init2_SNextMCB 4778 extern dosentry_xmsentry 4779 %include "codesw.mac" 1 <1> DOSCODE_HMA_SEGMENT equ 0FFFEh 2 <1> ; address DOSCODE at this segment when in HMA 3 <1> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h 4 <1> ; offset from DOSCODE offset 0 to address 10_0000h 5 <1> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h 6 <1> ; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB 4780 %include "init.asm" 1 <1> 2 <1> %if 0 3 <1> 4 <1> lDOS initialisation 5 <1> by E. C. Masloch, 2018--2025 6 <1> 7 <1> Usage of the works is permitted provided that this 8 <1> instrument is retained with the works, so that any entity 9 <1> that uses the works is notified of this instrument. 10 <1> 11 <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <1> 13 <1> %endif 14 <1> 15 <1> 16 <1> %include "lmacros2.mac" 1 <2> [list -] 17 <1> %include "lstruct.mac" 1 <2> [list -] 18 <1> extern autobounce_both_options, autobouncehmachs_option, autobouncehmalba_option 19 <1> extern config_bounce_hma_chs 20 <1> extern config_bounce_hma_lba 21 <1> extern DPBHEAD 22 <1> extern DSKDEV 23 <1> extern DISKSECTOR 24 <1> 25 <1> %include "msbds.mac" 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 0 000048C0 ???? lpSize dw ? 0 000048C2 ???? lpCount dw ? 0 000048C4 ???????? lpBuffer dd ? 0 000048C8 ???????????????? 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 0 000048C0 ???????? LINK DD ? ; LINK TO NEXT BDS 0 000048C4 ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 000048C5 ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 000048C6 ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 000048C8 ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 000048C9 ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 000048CB ?? CFAT DB ? ; NUMBER OF FATS 0 000048CC ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 000048CE ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 000048D0 ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 000048D1 ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 000048D3 ???? SECLIM DW ? ; SECTORS PER TRACK 0 000048D5 ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 000048D7 ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 000048D9 ???? HIDSEC_H dw ? ;0 ;J.K.87 0 000048DB ???? DRVLIM_L dw ? ;0 ;J.K.87 0 000048DD ???? DRVLIM_H dw ? ;0 ;J.K.87 0 000048DF ?? FATSIZ DB ? ; FLAGS... 0 000048E0 ???? OPCNT DW ? ; OPEN REF. COUNT 0 000048E2 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 000048E3 ???? FLAGS DW ? ; VARIOUS FLAGS 0 000048E5 ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 000048E7 ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 000048E9 ?? RSECPERCLUS DB ? 0 000048EA ???? RRESSEC DW ? 0 000048EC ?? RCFAT DB ? 0 000048ED ???? RCDIR DW ? 0 000048EF ???? RDRVLIM DW ? 0 000048F1 ?? RMEDIAD DB ? 0 000048F2 ???? RCSECFAT DW ? 0 000048F4 ???? RSECLIM DW ? 0 000048F6 ???? RHDLIM DW ? 0 000048F8 ???? RHIDSEC_L DW ? 0 000048FA ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 000048FC ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 000048FE ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 00004900 ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 00004906 ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 00004907 ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 00004909 ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 00004917 ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <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 0 000048C0 ???? mlink DW ? ;-1 ;Link to next structure 0 000048C2 ???? DW ? 0 000048C4 ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 000048C5 ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 000048C6 ???? mBytePerSec DW ? ;512 0 000048C8 ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 000048C9 ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 000048CB ?? mcFAT DB ? ;2 ;No. of allocation tables 0 000048CC ???? mcDIR DW ? ;16 ;Number of directory entries 0 000048CE ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 000048D0 ?? mMediad DB ? ;11111000B ;Media descriptor 0 000048D1 ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 000048D3 ???? mSECLIM DW ? ;0 ;Sector limit 0 000048D5 ???? mHDLIM DW ? ;0 ;Head limit 0 000048D7 ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 000048D9 ???? mHidsec_H dw ? ;0 ;J.K.87 0 000048DB ???? mDrvlim_L dw ? ;0 ;J.K.87 0 000048DD ???? mDrvlim_H dw ? ;0 ;J.K.87 0 000048DF ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 000048E0 ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 000048E2 ?? mFormFactor DB ? ;3 ;Form Factor 0 000048E3 ???? mFLAGS DW ? ;0020H ;Various Flags 0 000048E5 ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 00004906 ?? mTrack db ? ;-1 0 00004907 ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 00004909 ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 00004916 ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 00004917 ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 0000491B ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 00004923 ?? 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> 26 <1> %include "dpb.mac" 1 <2> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <2> BREAK 4 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <2> ; C A V E A T P R O G R A M M E R ; 6 <2> ; ; 7 <2> dpb STRUC 0 000048C0 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 000048C1 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 000048C2 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 000048C4 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 000048C5 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 000048C6 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 000048C8 ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 000048C9 ???? dpb_root_entries DW ? ; Number of directory entries 0 000048CB ???? dpb_first_sector DW ? ; First sector of first cluster 0 000048CD ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 000048CF ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 000048D1 ???? dpb_dir_sector DW ? ; Starting record of directory 0 000048D3 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 000048D7 ?? dpb_media DB ? ; Media byte 0 000048D8 ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <2> ; check the first time this DPB is used 0 000048D9 ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 000048DD ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 000048DF ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <2> dpb ENDS 28 <2> 29 <2> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <2> 31 <2> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <2> ; ; 33 <2> ; C A V E A T P R O G R A M M E R ; 34 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 27 <1> 28 <1> defaulting 29 <1> 30 <1> numdef DEBUG0 31 <1> numdef DEBUG1 32 <1> numdef DEBUG2 33 <1> numdef DEBUG3 34 <1> numdef DEBUG4 35 <1> numdef DEBUG5 36 <1> %idefine d5 _d 5, 37 <1> 38 <1> %assign _UMA 1 39 <1> %assign _COMBINED_DOSDATA_DOSCODE 0 40 <1> numdef DOSCODEHMA, 1 41 <1> numdef RELOCATEDOSCODE, 1 42 <1> numdef INT19_IN_DOSENTRY, 1 43 <1> strdef BIN_FILE_DEFAULT, "LDOS.COM" 44 <1> numdef TEST_PAYLOAD, 0 45 <1> numdef INIT_ENV_SIZE, 1024 46 <1> 47 <1> %if _RELOCATEDOSCODE 48 <1> %define DOSCODE_SIZE (doscode_end - doscode_start) 49 <1> %define DOSCODE_MCB_SIZE 16 50 <1> %else 51 <1> %define DOSCODE_SIZE 0 52 <1> %define DOSCODE_MCB_SIZE 0 53 <1> %endif 54 <1> 55 <1> 56 <1> %if 0 ; lMS-DOS doesn't use these parts yet 57 <1> 58 <1> struc FSPARM 59 <1> fspStart: resd 1 60 <1> fspLength: resd 1 61 <1> fspUnit: resb 1 62 <1> fspPartition: resb 1 63 <1> fspBoot: resb 1 64 <1> fspType: resb 1 65 <1> fspSectorSize: resw 1 66 <1> resw 1 67 <1> endstruc 68 <1> 69 <1> 70 <1> %ifndef _MAP 71 <1> %elifempty _MAP 72 <1> %else ; defined non-empty, str or non-str 73 <1> [map all _MAP] 74 <1> %endif 75 <1> 76 <1> 77 <1> cpu 8086 78 <1> ; section INIT0 start=0 vstart=0 79 <1> init0_start: 80 <1> nop 81 <1> align 32, nop 82 <1> init0_kernel_entry: 83 <1> ; cs:ip = load seg : 32 here 84 <1> %if ($ - $$) != 32 85 <1> %error Wrong kernel mode entrypoint 86 <1> %endif 87 <1> cld 88 <1> mov ax, cs 89 <1> add ax, (init0_end - init0_start) >> 4 90 <1> mov cx, ( 16 + (dosentry_end - dosentry_start) + DOSCODE_MCB_SIZE + DOSCODE_SIZE + 16 + (dosdata_end - dosdata_start) + 16 + (init1_end - init1_start) + 16 + (init2_end - init2_start) + 16 + (init3_end - init3_start) + 16 ) >> 4 104 <1> mov dx, word [ bp + ldLoadTop ] 105 <1> sub dx, cx 106 <1> call init0_movp 107 <1> 108 <1> mov ax, dx 109 <1> add ax, ( + 16 + (dosentry_end - dosentry_start) + DOSCODE_MCB_SIZE + DOSCODE_SIZE + 16 + (dosdata_end - dosdata_start) + 16 ) >> 4 118 <1> xor bx, bx 119 <1> push ax 120 <1> push bx 121 <1> retf 122 <1> 123 <1> align 64, nop 124 <1> init0_exe_entry: 125 <1> ; cs:ip = PSP : 256 + 64 here 126 <1> ; 127 <1> ; Code must be position independent enough. 128 <1> %if ($ - $$) != 64 129 <1> %error Wrong EXE mode entrypoint 130 <1> %endif 131 <1> mov cx, cs 132 <1> add cx, ( 256 + (init0_end - init0_start) + 16 + (dosentry_end - dosentry_start) + DOSCODE_MCB_SIZE + DOSCODE_SIZE + 16 + (dosdata_end - dosdata_start) + 16 + (init1_end - init1_start) + 16 + (init2_end - init2_start) + 16 + (init3_end - init3_start) + 16 + COMLOADER_position ) >> 4 149 <1> xor bx, bx 150 <1> push cx 151 <1> push bx 152 <1> retf 153 <1> 154 <1> 155 <1> ; Move paragraphs 156 <1> ; 157 <1> ; INP: ax:0-> source 158 <1> ; dx:0-> destination 159 <1> ; cx = number of paragraphs 160 <1> ; CHG: - 161 <1> ; Note: Doesn't work correctly on HMA; doesn't always wrap to LMA either. 162 <1> ; Do not provide a wrapped/HMA source or destination! 163 <1> init0_movp: 164 <1> push cx 165 <1> push ds 166 <1> push si 167 <1> push es 168 <1> push di 169 <1> 170 <1> cmp ax, dx ; source above destination ? 171 <1> ja .up ; yes, move up (forwards) --> 172 <1> je .return ; same, no need to move --> 173 <1> push ax 174 <1> add ax, cx ; (expected not to carry) 175 <1> cmp ax, dx ; end of source is above destination ? 176 <1> pop ax 177 <1> ja .down ; yes, move from top down --> 178 <1> ; Here, the end of source is below-or-equal the destination, 179 <1> ; so they do not overlap. In this case we prefer moving up. 180 <1> 181 <1> .up: 182 <1> push ax 183 <1> push dx 184 <1> .uploop: 185 <1> mov ds, ax 186 <1> mov es, dx 187 <1> xor di, di 188 <1> xor si, si ; -> start of segment 189 <1> sub cx, 1000h ; 64 KiB left ? 190 <1> jbe .uplast ; no --> 191 <1> push cx 192 <1> mov cx, 10000h /2 193 <1> rep movsw ; move 64 KiB 194 <1> pop cx 195 <1> add ax, 1000h 196 <1> add dx, 1000h ; -> next segment 197 <1> jmp short .uploop ; proceed for more --> 198 <1> .uplast: 199 <1> add cx, 1000h ; restore counter 200 <1> shl cx, 1 201 <1> shl cx, 1 202 <1> shl cx, 1 ; *8, paragraphs to words 203 <1> rep movsw ; move last part 204 <1> pop dx 205 <1> pop ax 206 <1> jmp short .return 207 <1> 208 <1> .down: 209 <1> std ; _AMD_ERRATUM_109_WORKAROUND as below 210 <1> .dnloop: 211 <1> sub cx, 1000h ; 64 KiB left ? 212 <1> jbe .dnlast ; no --> 213 <1> push ax 214 <1> push dx 215 <1> add ax, cx 216 <1> add dx, cx 217 <1> mov ds, ax ; -> 64 KiB not yet moved 218 <1> mov es, dx 219 <1> pop dx 220 <1> pop ax 221 <1> mov di, -2 222 <1> mov si, di ; moved from last word down 223 <1> push cx 224 <1> mov cx, 10000h /2 225 <1> rep movsw ; move 64 KiB 226 <1> pop cx 227 <1> jmp short .dnloop ; proceed for more --> 228 <1> .dnlast: 229 <1> add cx, 1000h ; restore counter 230 <1> shl cx, 1 231 <1> shl cx, 1 232 <1> shl cx, 1 ; *8, paragraphs to words 233 <1> mov di, cx 234 <1> dec di 235 <1> shl di, 1 ; words to offset, -> last word 236 <1> mov si, di 237 <1> mov ds, ax 238 <1> mov es, dx ; first segment correct 239 <1> 240 <1> 241 <1> numdef AMD_ERRATUM_109_WORKAROUND, 1 242 <1> %if 0 243 <1> 244 <1> Jack R. Ellis pointed out this erratum: 245 <1> 246 <1> Quoting from https://www.amd.com/system/files/TechDocs/25759.pdf page 69: 247 <1> 248 <1> 109 Certain Reverse REP MOVS May Produce Unpredictable Behavior 249 <1> 250 <1> Description 251 <1> 252 <1> In certain situations a REP MOVS instruction may lead to 253 <1> incorrect results. An incorrect address size, data size 254 <1> or source operand segment may be used or a succeeding 255 <1> instruction may be skipped. This may occur under the 256 <1> following conditions: 257 <1> 258 <1> * EFLAGS.DF=1 (the string is being moved in the reverse direction). 259 <1> 260 <1> * The number of items being moved (RCX) is between 1 and 20. 261 <1> 262 <1> * The REP MOVS instruction is preceded by some microcoded instruction 263 <1> that has not completely retired by the time the REP MOVS begins 264 <1> execution. The set of such instructions includes BOUND, CLI, LDS, 265 <1> LES, LFS, LGS, LSS, IDIV, and most microcoded x87 instructions. 266 <1> 267 <1> Potential Effect on System 268 <1> 269 <1> Incorrect results may be produced or the system may hang. 270 <1> 271 <1> Suggested Workaround 272 <1> 273 <1> Contact your AMD representative for information on a BIOS update. 274 <1> 275 <1> %endif 276 <1> 277 <1> %if _AMD_ERRATUM_109_WORKAROUND 278 <1> jcxz @FF 279 <1> cmp cx, 20 280 <1> ja @FF 281 <1> @@: 282 <1> movsw 283 <1> loop @B 284 <1> @@: 285 <1> %endif 286 <1> rep movsw ; move first part 287 <1> cld 288 <1> .return: 289 <1> pop di 290 <1> pop es 291 <1> pop si 292 <1> pop ds 293 <1> pop cx 294 <1> retn 295 <1> 296 <1> align 16 297 <1> init0_end: 298 <1> istruc MCB 299 <1> at mcbSignature, db "M" 300 <1> at mcbOwner, dw 8 301 <1> at mcbSize, dw (dosentry_end - dosentry_start) >> 4 302 <1> at smcbName, dw "S" 303 <1> at smcbType, db S_DOSENTRY 304 <1> iend 305 <1> 306 <1> ; section DOSENTRY align=16 follows=INIT0 vstart=0 307 <1> dosentry_start: 308 <1> %include "entry.asm" 309 <1> 310 <1> %if _RELOCATEDOSCODE 311 <1> align 16 312 <1> dosentry_end: 313 <1> istruc MCB 314 <1> at mcbSignature, db "M" 315 <1> at mcbOwner, dw 8 316 <1> at mcbSize, dw (doscode_end - doscode_start) >> 4 317 <1> at smcbName, dw "S" 318 <1> at smcbType, db S_DOSCODE 319 <1> iend 320 <1> 321 <1> ; section DOSCODE align=16 follows=DOSENTRY vstart=40h 322 <1> ; vstart: 323 <1> ; +10h for end of ROM-BIOS image (at 0FFFFh:0) 324 <1> ; +20h for VDISK header 325 <1> ; +10h for first HMCB 326 <1> doscode_start: 327 <1> %endif 328 <1> 329 <1> %if !_COMBINED_DOSDATA_DOSCODE 330 <1> 331 <1> ; The following table and function is used by devicerelocate 332 <1> ; even if DOSCODE is merged into DOSENTRY (!_RELOCATEDOSCODE). 333 <1> 334 <1> write_entrypoint_list ENTRYPOINT_LIST 335 <1> 336 <1> 337 <1> %if _RELOCATEDOSCODE && _DOSCODEHMA 338 <1> _fill 0C0h + DOSCODE_HMA_start_at, 90h, doscode_start 339 <1> hma_call5: 340 <1> jmp 70h:call5 341 <1> %endif 342 <1> 343 <1> 344 <1> ; INP: byte [cs:ip] = displacement in doscode_entrypoint_list 345 <1> ; word [DOSCODE:(displaced)] 346 <1> ; = relocated entry address 347 <1> ; word [DOSCODE:(displaced + 2)] 348 <1> ; = optional pointer to device function table 349 <1> ; byte [DOSCODE:(displaced + 4)] 350 <1> ; = optional device unit 351 <1> ; ss:(sp + 8) -> arbitrary stack of entrypoint 352 <1> ; word [ss:sp + 6] = entrypoint's ip, 353 <1> ; word [ss:sp + 4] = entrypoint's cs, 354 <1> ; word [ss:sp + 2] = original flags value, 355 <1> ; word [ss:sp + 0] = original ax value, 356 <1> relocated_relocatedentry: 357 <1> lframe 0 358 <1> lpar word, entrypoint_ip 359 <1> lpar word, entrypoint_cs 360 <1> lpar word, orig_fl 361 <1> lpar word, orig_ax 362 <1> lenter 363 <1> push ds 364 <1> push si 365 <1> 366 <1> cld 367 <1> xor ax, ax 368 <1> mov ds, word [bp + ?entrypoint_cs] 369 <1> mov si, word [bp + ?entrypoint_ip] 370 <1> lodsb 371 <1> cmp al, 0CCh ; overwritten by debugger ? 372 <1> jne @F ; no --> 373 <1> int3 ; break to make it remove the breakpoint 374 <1> dec si 375 <1> lodsb ; reload the byte 376 <1> cmp al, 0CCh 377 <1> jne @F 378 <1> 379 <1> .error: 380 <1> mov si, doscode_msg.error_common 381 <1> call doscode_disp_msg_cs 382 <1> mov si, doscode_msg.error_table 383 <1> call doscode_disp_msg_cs 384 <1> mov si, doscode_msg.error_after 385 <1> call doscode_disp_msg_cs 386 <1> .loop: 387 <1> int3 388 <1> xor ax, ax 389 <1> int 16h 390 <1> jmp .loop 391 <1> 392 <1> @@: 393 <1> push cs 394 <1> pop ds 395 <1> 396 <1> add ax, doscode_entrypoint_list 397 <1> cmp ax, doscode_entrypoint_list.end 398 <1> jae .error 399 <1> xchg ax, si 400 <1> 401 <1> lodsw ; get relocated entry address 402 <1> cmp ax, DEVStrategy ; set ZF iff DEVStrategy 403 <1> 404 <1> xchg word [bp + ?orig_fl], ax ; store address in ?orig_fl, ax = fl 405 <1> xchg word [bp + ?orig_ax], ax ; store fl in ?orig_ax, ax = orig ax 406 <1> 407 <1> push ax 408 <1> lodsw 409 <1> mov word [bp + ?entrypoint_ip], ax 410 <1> 411 <1> mov ah, 0 412 <1> lodsb 413 <1> mov word [bp + ?entrypoint_cs], ax 414 <1> pop ax 415 <1> 416 <1> pop si 417 <1> pop ds 418 <1> lleave 419 <1> je .is_dev_strat ; dispatch based on ZF 420 <1> popf ; (fl = ?orig_ax = fl) 421 <1> retn 4 ; (ip = ?orig_fl = address) 422 <1> 423 <1> .is_dev_strat: 424 <1> popf 425 <1> retn 426 <1> 427 <1> 428 <1> doscode_disp_msg_cs: 429 <1> push ax 430 <1> @@: 431 <1> cs lodsb 432 <1> test al, al 433 <1> jz @F 434 <1> call doscode_disp_al 435 <1> jmp short @B 436 <1> 437 <1> 438 <1> doscode_disp_al: 439 <1> push ax 440 <1> push bx 441 <1> push bp 442 <1> mov ah, 0Eh 443 <1> mov bx, 7 444 <1> int 10h 445 <1> pop bp 446 <1> pop bx 447 <1> @@: 448 <1> pop ax 449 <1> retn 450 <1> 451 <1> 452 <1> doscode_disp_dxax_hex: ; dx:ax 453 <1> xchg ax, dx 454 <1> call doscode_disp_ax_hex 455 <1> xchg ax, dx 456 <1> doscode_disp_ax_hex: ; ax 457 <1> xchg al, ah 458 <1> call doscode_disp_al_hex 459 <1> ; display former ah 460 <1> xchg al, ah ; and fall trough for al 461 <1> doscode_disp_al_hex: ; al 462 <1> push cx 463 <1> mov cl, 4 464 <1> ror al, cl 465 <1> call doscode_disp_al_lownibble_hex 466 <1> ; display former high-nibble 467 <1> rol al, cl 468 <1> pop cx 469 <1> ; and fall trough for low-nibble 470 <1> doscode_disp_al_lownibble_hex: 471 <1> push ax ; save ax for call return 472 <1> and al, 00001111b 473 <1> ; high nibble must be zero 474 <1> add al, '0' ; if number is 0-9, now it's the correct character 475 <1> cmp al, '9' 476 <1> jna .decimalnum ; if we get decimal number with this, ok --> 477 <1> add al, 7 ; otherwise, add 7 and we are inside our alphabet 478 <1> .decimalnum: 479 <1> call doscode_disp_al 480 <1> pop ax 481 <1> retn 482 <1> 483 <1> 484 <1> doscode_msg: 485 <1> .error_common: asciz "DOSCODE error: " 486 <1> .error_table: asciz "Invalid doscode_entrypoint_list reference." 487 <1> .error_after: asciz 13,10,"System halted. " 488 <1> 489 <1> 490 <1> %include "biocode.asm" 491 <1> 492 <1> %assign DOSCODE_INSURE_COUNT 0 493 <1> 494 <1> ; The init2_to_doscode dispatcher in INIT2 (DOSINI) 495 <1> ; detects mistaken debugger breakpoints in its 496 <1> ; in-code-parameter by checking for a low-byte 497 <1> ; value equal to 0CCh (one-byte int3 opcode). 498 <1> ; Therefore, we insure that all functions called 499 <1> ; via that dispatcher do not happen to be located 500 <1> ; on an offset that gives 0CCh in the low byte. 501 <1> %imacro doscode_insure_low_byte_not_0CCh 0.nolist 502 <1> %if (($ - dosentry_start + 0) & 0FFh) == 0CCh 503 <1> nop 504 <1> %assign DOSCODE_INSURE_COUNT 1 + DOSCODE_INSURE_COUNT 505 <1> %endif 506 <1> %endmacro 507 <1> 508 <1> %include "doscode.asm" 509 <1> %endif 510 <1> 511 <1> %if DOSCODE_INSURE_COUNT 512 <1> %warning doscode_insure_low_byte_not_0CCh needed DOSCODE_INSURE_COUNT times 513 <1> %endif 514 <1> 515 <1> align 16 516 <1> %if _RELOCATEDOSCODE 517 <1> doscode_end: 518 <1> %else 519 <1> dosentry_end: 520 <1> %endif 521 <1> istruc MCB 522 <1> at mcbSignature, db "M" 523 <1> at mcbOwner, dw 8 524 <1> at mcbSize, dw (dosdata_end - dosdata_start) >> 4 525 <1> at smcbName, dw "S" 526 <1> at smcbType, db S_DOSDATA 527 <1> iend 528 <1> 529 <1> %if _RELOCATEDOSCODE 530 <1> ; section DOSDATA align=16 follows=DOSCODE vstart=0 531 <1> %else 532 <1> ; section DOSDATA align=16 follows=DOSENTRY vstart=0 533 <1> %endif 534 <1> dosdata_start: 535 <1> %if _COMBINED_DOSDATA_DOSCODE 536 <1> %include "RxDOS.ASM" 537 <1> %else 538 <1> %include "dosdata.asm" 539 <1> %endif 540 <1> 541 <1> align 16 542 <1> dosdata_end: 543 <1> istruc MCB 544 <1> at mcbSignature, db "M" 545 <1> at mcbOwner, dw 8 546 <1> at mcbSize, dw (init1_end - init1_start) >> 4 547 <1> at smcbName, dw "S" 548 <1> at smcbType, db S_INIT 549 <1> iend 550 <1> 551 <1> ; section INIT1 align=16 follows=DOSDATA vstart=0 552 <1> 553 <1> %assign INIT1_INSURE_COUNT 0 554 <1> 555 <1> ; The init2_to_init1 dispatcher in INIT2 (DOSINI) 556 <1> ; detects mistaken debugger breakpoints in its 557 <1> ; in-code-parameter by checking for a low-byte 558 <1> ; value equal to 0CCh (one-byte int3 opcode). 559 <1> ; Therefore, we insure that all functions called 560 <1> ; via that dispatcher do not happen to be located 561 <1> ; on an offset that gives 0CCh in the low byte. 562 <1> %imacro init1_insure_low_byte_not_0CCh 0.nolist 563 <1> %if (($ - init1_start) & 0FFh) == 0CCh 564 <1> nop 565 <1> %assign INIT1_INSURE_COUNT 1 + INIT1_INSURE_COUNT 566 <1> %endif 567 <1> %endmacro 568 <1> 569 <1> 570 <1> init1_start: 571 <1> ; S0 +28 572 <1> pushf ; +26 573 <1> jmp sig_valid 574 <1> 575 <1> msg: 576 <1> %if _TEST_PAYLOAD 577 <1> .test: asciz "Test payload loaded. Press any key to continue booting.",13,10 578 <1> %endif 579 <1> 580 <1> align 4 581 <1> .foundname: 582 <1> times 8+1+3+1 db 0 583 <1> ; buffer for base name (8) + dot (1) + ext (3) + NUL (1) 584 <1> align 2 585 <1> .foundname_default: 586 <1> asciz _BIN_FILE_DEFAULT 587 <1> _fill (8 + 1 + 3 + 1), 0, .foundname_default 588 <1> align 2 589 <1> .foundname_none: 590 <1> asciz "(None)" 591 <1> .foundname_none_size: equ $ - .foundname_none 592 <1> align 2 593 <1> .names: 594 <1> %if _TEST_PAYLOAD 595 <1> dw .name_first, 0 596 <1> dw .name_second, 0 597 <1> dw .name_third, 0 598 <1> dw .name_fourth, 0 599 <1> %else 600 <1> dw .foundname_none, 0 601 <1> %endif 602 <1> dw 0 603 <1> %if _TEST_PAYLOAD 604 <1> .name_first: asciz "1st name" 605 <1> .name_second: asciz "2nd name" 606 <1> .name_third: asciz "3rd name" 607 <1> .name_fourth: asciz "4th name" 608 <1> .name_before: asciz ": " 609 <1> .name_quote: asciz '"' 610 <1> .name_after: asciz 13,10 611 <1> %endif 612 <1> 613 <1> .bootfail: asciz "init: Boot failure: " 614 <1> .bootfail_read: db "Reading sector failed (error " 615 <1> .bootfail_read_errorcode: asciz "__h).",13,10 616 <1> .bootfail_sig: asciz "Boot sector signature missing (is not AA55h).",13,10 617 <1> .bootfail_sig_parttable: ascii "Partition table signature missing" 618 <1> asciz " (is not AA55h).",13,10 619 <1> .bootfail_secsizediffer: 620 <1> asciz "BPB BpS differs from actual sector size.",13,10 621 <1> .boot_too_many_partitions_error:asciz "Too many partitions (or a loop).",13,10 622 <1> .boot_partition_cycle_error: asciz "Partition table cycle detected.",13,10 623 <1> .boot_partition_not_found: asciz "Partition not found.",13,10 624 <1> .boot_access_error: asciz "Read error.", 13,10 625 <1> .boot_sector_too_large: asciz "Sector size too small (< 32 bytes).", 13,10 626 <1> .boot_sector_too_small: asciz "Sector size too large (> 8192 bytes).", 13,10 627 <1> .boot_sector_not_power: asciz "Sector size not a power of two.", 13,10 628 <1> .boot_invalid_sectors: asciz "Invalid geometry sectors.", 13,10 629 <1> .boot_invalid_heads: asciz "Invalid geometry heads.", 13,10 630 <1> .boot_badclusters: asciz "Bad amount of clusters.",13,10 631 <1> .boot_badchain: asciz "Bad cluster chain.",13,10 632 <1> .boot_internal_error: asciz "! Internal error !",13,10 633 <1> 634 <1> .login_partition_error_1: asciz "init: Error during unit " 635 <1> .login_partition_error_2: asciz "h partitions login.",13,10 636 <1> 637 <1> .excess_partitions_1: asciz "init: Found " 638 <1> .excess_partitions_2: asciz " excess partitions, ignored.",13,10 639 <1> 640 <1> .list_partition_1: asciz ": " 641 <1> .list_partition_4: asciz " s=" 642 <1> .list_partition_5: asciz "h (" 643 <1> .list_partition_6: asciz ") l=" 644 <1> .list_partition_7: asciz "h (" 645 <1> .list_partition_8: asciz ") " 646 <1> .list_partition_9: asciz " t=" 647 <1> .list_partition_10: asciz "h (" 648 <1> .list_partition_11: asciz ").",13,10 649 <1> 650 <1> .prefixes: asciz " kMGT" 651 <1> 652 <1> .bootname_1: asciz "init: Boot drive and file name: ",'"' 653 <1> .bootname_2: asciz '"',13,10 654 <1> 655 <1> 656 <1> %define pt_messages ..@pt_notype,"" 657 <1> 658 <1> %imacro pt_type 2.nolist 659 <1> dw %2, %%label 660 <1> %defstr %%str %1 661 <1> %xdefine pt_messages pt_messages,%%label,%%str 662 <1> %endmacro 663 <1> 664 <1> %imacro pt_msg 2-*.nolist 665 <1> %if %0 & 1 666 <1> %error Expected even number of parameters 667 <1> %endif 668 <1> %rotate 2 669 <1> %rep (%0 - 2) / 2 670 <1> %1: asciz %2 671 <1> %rotate 2 672 <1> %endrep 673 <1> %endmacro 674 <1> 675 <1> align 4 676 <1> pt_types: 677 <1> pt_type Empty, 0 678 <1> pt_type FAT12, 1 679 <1> pt_type FAT16 16BIT CHS,4 680 <1> pt_type ExtendedCHS, 5 681 <1> pt_type FAT16 CHS, 6 682 <1> pt_type FAT32 CHS, 0Bh 683 <1> pt_type FAT32, 0Ch 684 <1> pt_type FAT16, 0Eh 685 <1> pt_type Extended, 0Fh 686 <1> pt_type Linux, 83h 687 <1> pt_type ExtendedLinux, 85h 688 <1> dw -1, -1 689 <1> 690 <1> pt_msg pt_messages 691 <1> 692 <1> ptmsg_unknown: asciz "Unknown" 693 <1> 694 <1> %undef pt_messages 695 <1> %unimacro pt_type 2.nolist 696 <1> %unimacro pt_msg 2-*.nolist 697 <1> 698 <1> %endif 699 <1> 700 <1> init1_msg: 0 00005D56 696E69743A20457272 .alloc_error: asciz "init: Error " 0 00005D5F 6F722000 0 00005D63 68207768696C652061 .alloc_error_q: asciz "h while allocating memory: " 0 00005D6C 6C6C6F636174696E67 0 00005D75 206D656D6F72793A20 0 00005D7E 00 0 00005D7F 0D0A00 .linebreak: asciz 13,10 704 <1> ; .internal_error_upb: asciz "init: Internal error during UPB allocation.",13,10 0 00005D82 48616C7465642E2050 .reboot_prompt: asciz "Halted. Press Ctrl+Alt+Del to reboot.",13,10 0 00005D8B 72657373204374726C 0 00005D94 2B416C742B44656C20 0 00005D9D 746F207265626F6F74 0 00005DA6 2E0D0A00 706 <1> ; .loading_os: asciz "Starting ",RXDOSLONG_S,"...",13,10 0 00005DAA 52504C4F41444552 .rploader: db "RPLOADER" 708 <1> endarea .rploader 0 00005DB2 00 db 0 0 00005DB3 206B4D475400 .prefixes: asciz " kMGT" 711 <1> 0 00005DB9 90 align 2 713 <1> init1_msg_errors: 714 <1> .: 0 00005DBA [2E15] dw .no_error 0 00005DBC [3715] dw .invalid_function 0 00005DBE [4815] dw .file_not_found 0 00005DC0 [5715] dw .path_not_found 0 00005DC2 [6615] dw .no_handles_available 0 00005DC4 [7B15] dw .access_denied 0 00005DC6 [8915] dw .invalid_handle 0 00005DC8 [9815] dw .mcb_destroyed 0 00005DCA [A615] dw .insufficient_memory 0 00005DCC [BA15] dw .mcb_invalid 0 00005DCE [C615] dw .environment_invalid 0 00005DD0 [DA15] dw .format_invalid 0 00005DD2 [E915] dw .access_code_invalid 0 00005DD4 [FD15] dw .data_invalid 0 00005DD6 [0A16] dw .fixup_overflow 0 00005DD8 [1916] dw .invalid_drive 0 00005DDA [2716] dw .attempted_to_remove_current_directory 0 00005DDC [4D16] dw .not_same_device 0 00005DDE [5D16] dw .no_more_files 734 <1> .count equ ($ - .) / 2 0 00005DE0 556E6B6E6F776E2065 .unknown_error: db "Unknown error",0 0 00005DE9 72726F7200 0 00005DEE 4E6F206572726F7200 .no_error: db "No error",0 0 00005DF7 496E76616C69642066 .invalid_function: db "Invalid function",0 0 00005E00 756E6374696F6E00 0 00005E08 46696C65206E6F7420 .file_not_found: db "File not found",0 0 00005E11 666F756E6400 0 00005E17 50617468206E6F7420 .path_not_found: db "Path not found",0 0 00005E20 666F756E6400 0 00005E26 4E6F2068616E646C65 .no_handles_available: db "No handles available",0 0 00005E2F 7320617661696C6162 0 00005E38 6C6500 0 00005E3B 416363657373206465 .access_denied: db "Access denied",0 0 00005E44 6E69656400 0 00005E49 496E76616C69642068 .invalid_handle: db "Invalid handle",0 0 00005E52 616E646C6500 0 00005E58 4D4342206465737472 .mcb_destroyed: db "MCB destroyed",0 0 00005E61 6F79656400 0 00005E66 496E73756666696369 .insufficient_memory: db "Insufficient memory",0 0 00005E6F 656E74206D656D6F72 0 00005E78 7900 0 00005E7A 4D434220696E76616C .mcb_invalid: db "MCB invalid",0 0 00005E83 696400 0 00005E86 456E7669726F6E6D65 .environment_invalid: db "Environment invalid",0 0 00005E8F 6E7420696E76616C69 0 00005E98 6400 0 00005E9A 466F726D617420696E .format_invalid: db "Format invalid",0 0 00005EA3 76616C696400 0 00005EA9 41636365737320636F .access_code_invalid: db "Access code invalid",0 0 00005EB2 646520696E76616C69 0 00005EBB 6400 0 00005EBD 4461746120696E7661 .data_invalid: db "Data invalid",0 0 00005EC6 6C696400 0 00005ECA 4669787570206F7665 .fixup_overflow: db "Fixup overflow",0 0 00005ED3 72666C6F7700 0 00005ED9 496E76616C69642064 .invalid_drive: db "Invalid drive",0 0 00005EE2 7269766500 0 00005EE7 417474656D70746564 .attempted_to_remove_current_directory: db "Attempted to remove current directory",0 0 00005EF0 20746F2072656D6F76 0 00005EF9 652063757272656E74 0 00005F02 206469726563746F72 0 00005F0B 7900 0 00005F0D 4E6F742073616D6520 .not_same_device: db "Not same device",0 0 00005F16 64657669636500 0 00005F1D 4E6F206D6F72652066 .no_more_files: db "No more files",0 0 00005F26 696C657300 755 <1> 756 <1> 757 <1> %if 0 758 <1> 759 <1> align 4 760 <1> init1_rploader_callback: dw entry_iret, 70h 761 <1> %define load_sectors (bp + bsBPB + bpbCHSSectors) 762 <1> %define load_heads (bp + bsBPB + bpbCHSHeads) 763 <1> %define load_sectorsize (bp + ldBytesPerSector) 764 <1> %define load_sectorsizepara (bp + ldParaPerSector) 765 <1> %define load_sectorseg (bp + ldSectorSeg) 766 <1> load_partition_cycle: dw 0 767 <1> %define load_lba (bp + ldHasLBA) 768 <1> %define load_unit (bp + bsBPB + ebpbNew + bpbnBootUnit) 769 <1> load_current_partition: db 0 770 <1> 771 <1> %endif 772 <1> 773 <1> 774 <1> init1_disp_msg_asciz: 775 <1> disp_msg_asciz: 776 <1> assume ds:nothing, es:nothing, ss:nothing 0 00005F2B 1E push ds 0 00005F2C 56 push si 0 00005F2D 50 push ax 0 00005F2E 0E push cs 0 00005F2F 1F pop ds 782 <1> assume ds:SYSINITGROUP 0 00005F30 89D6 mov si, dx 0 00005F32 E80400 call disp_msg 0 00005F35 58 pop ax 0 00005F36 5E pop si 0 00005F37 1F pop ds 788 <1> assume ds:nothing 0 00005F38 C3 retn 790 <1> 791 <1> init1_disp_msg: 792 <1> disp_msg: 793 <1> assume ds:nothing, es:nothing, ss:nothing 794 <1> @@: 0 00005F39 AC lodsb 0 00005F3A 84C0 test al, al 0 00005F3C 7412 jz @F 0 00005F3E E80200 call disp_al 0 00005F41 EBF6 jmp short @B 800 <1> 801 <1> init1_disp_al: 802 <1> disp_al: 803 <1> assume ds:nothing, es:nothing, ss:nothing 0 00005F43 50 push ax 0 00005F44 53 push bx 0 00005F45 55 push bp 0 00005F46 B40E mov ah, 0Eh 0 00005F48 BB0700 mov bx, 7 0 00005F4B CD10 int 10h 0 00005F4D 5D pop bp 0 00005F4E 5B pop bx 0 00005F4F 58 pop ax 813 <1> @@: 0 00005F50 C3 retn 815 <1> 816 <1> 817 <1> %if 0 818 <1> 819 <1> sig_valid: 820 <1> ; S0 +28 821 <1> ; pushf ; +26 822 <1> sti 823 <1> cld 824 <1> push ax ; +24 825 <1> push bx ; +22 826 <1> push cx ; +20 827 <1> push dx ; +18 828 <1> push si ; +16 829 <1> push di ; +14 830 <1> push bp ; +12 831 <1> mov ax, sp 832 <1> add ax, 16 833 <1> push ax ; +10 SP 834 <1> xor ax, ax 835 <1> push ax ; +8 IP 836 <1> push cs ; +6 837 <1> push ds ; +4 838 <1> push es ; +2 839 <1> push ss ; +0 840 <1> %if _TEST_PAYLOAD 841 <1> mov si, sp 842 <1> push ss 843 <1> pop ds 844 <1> mov di, table 845 <1> push cs 846 <1> pop es 847 <1> loop_table: 848 <1> mov bx, [es:di + 0] 849 <1> mov al, 32 850 <1> call disp_al 851 <1> mov ax, [es:di + 2] 852 <1> call disp_al 853 <1> xchg al, ah 854 <1> call disp_al 855 <1> cmp bx, -1 856 <1> je @F 857 <1> mov al, '=' 858 <1> call disp_al 859 <1> mov ax, [si + bx] 860 <1> call disp_ax_hex 861 <1> @@: 862 <1> add di, 4 863 <1> cmp di, table.end 864 <1> jb loop_table 865 <1> %endif 866 <1> 867 <1> 868 <1> init_mcb_chain: 869 <1> push cs 870 <1> pop ds 871 <1> push cs 872 <1> pop es 873 <1> mov ax, 60h ; where 874 <1> xor cx, cx ; owner 875 <1> mov bx, cs 876 <1> sub bx, ax ; size 877 <1> dec bx ; less 1 878 <1> sub bx, ( 16 + (dosentry_end - dosentry_start) + DOSCODE_MCB_SIZE + DOSCODE_SIZE + 16 + (dosdata_end - dosdata_start) + 16 ) >> 4 886 <1> ; point at DOSENTRY MCB 887 <1> mov dx, "M" | (0 << 8) 888 <1> call init_an_mcb 889 <1> 890 <1> mov bx, mcbtable 891 <1> mov ax, cs 892 <1> add ax, ( (init1_end - init1_start) + 16 + (init2_end - init2_start) + 16 + (init3_end - init3_start) + 16 ) >> 4 899 <1> mov word [bx], ax 900 <1> mov word [bx + 2], -1 901 <1> 902 <1> add bx, 4 903 <1> mov ax, ss 904 <1> mov word [bx], ax 905 <1> mov word [bx + 2], S_INITSTACKBPB 906 <1> 907 <1> add bx, 4 908 <1> mov ax, [bp + lsvFATSeg] 909 <1> dec ax 910 <1> mov word [bx], ax 911 <1> mov word [bx + 2], S_INITFATSEG 912 <1> 913 <1> add bx, 4 914 <1> mov ax, [bp + ldSectorSeg] 915 <1> dec ax 916 <1> mov word [bx], ax 917 <1> mov word [bx + 2], S_INITSECTORSEG 918 <1> 919 <1> add bx, 4 920 <1> mov dx, [bp + ldMemoryTop] ; => in front of RPL, or end of memory 921 <1> mov word [bx], dx 922 <1> mov word [bx + 2], S_EXCLDUMA 923 <1> 924 <1> int 12h 925 <1> mov cl, 6 926 <1> shl ax, cl ; => after RPL, or same as ldMemoryTop 927 <1> cmp dx, ax 928 <1> je @F 929 <1> mov word [bx + 2], 'R' << 8 930 <1> 931 <1> add bx, 4 932 <1> mov word [bx], ax 933 <1> mov word [bx + 2], S_EXCLDUMA 934 <1> @@: 935 <1> 936 <1> 937 <1> .next_bubble: 938 <1> mov bx, mcbtable 939 <1> xor cx, cx 940 <1> .next: 941 <1> mov ax, word [bx] 942 <1> cmp ax, word [bx + 4] 943 <1> jbe @F 944 <1> push word [bx] 945 <1> push word [bx + 2] 946 <1> push word [bx + 4] 947 <1> push word [bx + 6] 948 <1> pop word [bx + 2] 949 <1> pop word [bx] 950 <1> pop word [bx + 6] 951 <1> pop word [bx + 4] 952 <1> inc cx 953 <1> @@: 954 <1> add bx, 4 955 <1> cmp word [bx], -1 956 <1> jne .next 957 <1> test cx, cx 958 <1> jnz .next_bubble 959 <1> 960 <1> init_end_mcb_chain: 961 <1> mov si, mcbtable 962 <1> .next: 963 <1> mov ax, word [si] 964 <1> dec ax ; = where to place MCB 965 <1> mov dx, word [si + 2] ; dl = S MCB type, -1 if none, 966 <1> ; 0 (S_OTHER) if RPL (dh = 'R' then) 967 <1> mov cx, 8 ; owner = 8 968 <1> cmp dl, -1 ; none type ? 969 <1> jne @F ; no --> 970 <1> xor cx, cx ; yes, owner = 0 971 <1> @@: 972 <1> push dx 973 <1> xchg dl, dh ; dh = S MCB type 974 <1> mov dl, "M" ; dl = MCB signature 975 <1> mov di, word [si + 4] 976 <1> mov bx, di 977 <1> sub bx, ax 978 <1> dec bx 979 <1> dec bx ; size = to next 980 <1> cmp di, -1 ; any next ? 981 <1> jne @F ; yes --> 982 <1> mov dl, "Z" ; else, mcbSignature = "Z" 983 <1> xor bx, bx ; size = zero 984 <1> @@: 985 <1> call init_an_mcb 986 <1> pop dx 987 <1> cmp dx, 'R' << 8 988 <1> jne @F 989 <1> push ds 990 <1> mov ds, ax 991 <1> mov word [mcbName], "RP" 992 <1> mov word [mcbName + 2], "L" 993 <1> pop ds 994 <1> @@: 995 <1> add si, 4 996 <1> cmp word [si], -1 997 <1> jne .next 998 <1> 999 <1> mov bx, cs 1000 <1> sub bx, ((dosdata_end - dosdata_start) + 16) >> 4 1001 <1> mov ds, bx 1002 <1> mov word [first_umcb], ax 1003 <1> 1004 <1> 1005 <1> init_dosentry: 1006 <1> mov ax, cs 1007 <1> sub ax, ( 16 + (dosentry_end - dosentry_start) + DOSCODE_MCB_SIZE + DOSCODE_SIZE + 16 + (dosdata_end - dosdata_start) + 16) >> 4 1014 <1> mov dx, 6Fh 1015 <1> mov cx, (16 + (dosentry_end - dosentry_start)) >> 4 1016 <1> call init1_movp ; move DOSENTRY to 70h:0 1017 <1> 1018 <1> add cx, dx ; => behind DOSENTRY 1019 <1> mov ax, cx 1020 <1> mov bx, cs 1021 <1> sub bx, ax ; size 1022 <1> dec bx ; less 1 1023 <1> sub bx, ( DOSCODE_MCB_SIZE + DOSCODE_SIZE + 16 + (dosdata_end - dosdata_start) + 16 ) >> 4 ; ax + bx + 1 => DOSCODE MCB 1029 <1> xor cx, cx ; owner 1030 <1> mov dx, "M" | (0 << 8) 1031 <1> call init_an_mcb 1032 <1> 1033 <1> mov ax, 60h ; where 1034 <1> xor cx, cx ; owner 1035 <1> mov bx, 6Fh 1036 <1> sub bx, ax ; size 1037 <1> dec bx ; less 1 1038 <1> ; ax + bx + 1 => point at DOSENTRY MCB 1039 <1> mov dx, "M" | (0 << 8) 1040 <1> call init_an_mcb 1041 <1> 1042 <1> 1043 <1> listnames: 1044 <1> push cs 1045 <1> pop es 1046 <1> mov bx, msg.names 1047 <1> 1048 <1> %assign _NEW_BPB_NAME_SCAN_SIZE 1 1049 <1> %if _NEW_BPB_NAME_SCAN_SIZE 1050 <1> mov ax, ss 1051 <1> dec ax 1052 <1> mov ds, ax 1053 <1> mov cx, word [mcbSize] ; get size of stack/BPB 1054 <1> shl cx, 1 1055 <1> jc @F 1056 <1> shl cx, 1 1057 <1> jc @F 1058 <1> shl cx, 1 1059 <1> jc @F 1060 <1> shl cx, 1 ; <<= 4, *= 16, to byte offset 1061 <1> jnc @FF 1062 <1> @@: 1063 <1> xor cx, cx ; 0 = full 64 KiB 1064 <1> @@: 1065 <1> %endif 1066 <1> 1067 <1> push ss 1068 <1> pop ds 1069 <1> lea si, [bp + bsBPB + ebpbNew + BPBN_size] 1070 <1> %if _NEW_BPB_NAME_SCAN_SIZE 1071 <1> sub cx, si ; byte offset end - byte offset start = length 1072 <1> dec cx 1073 <1> dec cx ; don't scan into AA55h sig 1074 <1> %else 1075 <1> mov cx, (512 - (bsBPB + ebpbNew + BPBN_size)) - 2 1076 <1> ; -2 = AA55h sig 1077 <1> cmp word [bp + bsBPB + bpbSectorsPerFAT], 0 1078 <1> je @F 1079 <1> mov cx, (512 + (ebpbNew - bpbNew) - (bsBPB + ebpbNew + BPBN_size)) - 2 1080 <1> @@: 1081 <1> %endif 1082 <1> .nextname: 1083 <1> call findname 1084 <1> lahf 1085 <1> %if _TEST_PAYLOAD 1086 <1> mov dx, [cs:bx] 1087 <1> call disp_msg_asciz 1088 <1> mov dx, msg.name_before 1089 <1> call disp_msg_asciz 1090 <1> sahf 1091 <1> jc @F ; skip quote if no name --> 1092 <1> mov dx, msg.name_quote 1093 <1> call disp_msg_asciz 1094 <1> @@: 1095 <1> mov dx, msg.foundname 1096 <1> call disp_msg_asciz 1097 <1> sahf 1098 <1> jc @F ; skip quote if no name --> 1099 <1> mov dx, msg.name_quote 1100 <1> call disp_msg_asciz 1101 <1> @@: 1102 <1> mov dx, msg.name_after 1103 <1> call disp_msg_asciz 1104 <1> sahf 1105 <1> %endif 1106 <1> mov ax, 0 1107 <1> jc @F ; set to zero if no name --> 1108 <1> lea ax, [si - 11] ; -> name in buffer 1109 <1> @@: 1110 <1> mov word [cs:bx + 2], ax ; -> name in buffer, or 0 1111 <1> add bx, 4 1112 <1> cmp word [cs:bx], 0 1113 <1> jne .nextname 1114 <1> 1115 <1> 1116 <1> set_bootname.filename: 1117 <1> mov si, word [cs:msg.names + 2] 1118 <1> test si, si 1119 <1> jnz @F 1120 <1> 1121 <1> mov si, msg.foundname_default 1122 <1> jmp @FF 1123 <1> 1124 <1> @@: 1125 <1> call convert_name_to_asciz 1126 <1> 1127 <1> mov si, msg.foundname 1128 <1> @@: 1129 <1> push cs 1130 <1> pop ds ; ds:si -> name 1131 <1> 1132 <1> mov cx, (8 + 1 + 3) >> 1 1133 <1> ; note: last byte is already initialised to zero 1134 <1> 1135 <1> mov bx, cs 1136 <1> sub bx, ((dosdata_end - dosdata_start) + 16) >> 4 1137 <1> mov es, bx 1138 <1> mov di, bootname.filename ; es:di -> buffer in DOSDATA 1139 <1> rep movsw 1140 <1> 1141 <1> 1142 <1> store_boot_partition: 1143 <1> push cs 1144 <1> pop ds 1145 <1> mov al, [bp + bsBPB + ebpbNew + bpbnBootUnit] 1146 <1> mov byte [boot_unit], al 1147 <1> mov ax, [bp + bsBPB + bpbHiddenSectors] 1148 <1> mov dx, [bp + bsBPB + bpbHiddenSectors + 2] 1149 <1> mov word [boot_partition], ax 1150 <1> mov word [boot_partition + 2], dx 1151 <1> 1152 <1> scan_for_partitions: 1153 <1> lea sp, [bp + LOADDATA2] ; allow space for LOADDATA2 1154 <1> push cs 1155 <1> pop ds 1156 <1> and word [bp + bsBPB + bpbHiddenSectors], 0 1157 <1> and word [bp + bsBPB + bpbHiddenSectors + 2], 0 1158 <1> 1159 <1> scan_diskettes: 1160 <1> mov dl, 80h 1161 <1> mov ah, 08 1162 <1> stc 1163 <1> int 13h ; get number of fixed disks 1164 <1> mov bx, 0 1165 <1> jc @F ; fail ? then set bx = 0 and try diskettes 1166 <1> mov bl, dl 1167 <1> @@: 1168 <1> mov dl, 0 1169 <1> mov ah, 08h 1170 <1> stc 1171 <1> int 13h ; get number of diskettes 1172 <1> mov ch, 0 1173 <1> mov cl, dl ; cx = result 1174 <1> jc @F ; fail --> 1175 <1> cmp bx, cx ; differs from number of fixed disks ? 1176 <1> jne @FF ; yes, use --> 1177 <1> @@: 1178 <1> ; else, 1179 <1> int 11h ; query int 11 "get equipment list" 1180 <1> xor cx, cx ; initialise to zero 1181 <1> test ax, 1 ; any specified ? 1182 <1> jz @F ; no --> 1183 <1> 1184 <1> mov cl, al 1185 <1> rol cl, 1 1186 <1> rol cl, 1 ; get bits 6 & 7 1187 <1> and cl, 3 ; separate 1188 <1> inc cx ; +1 1189 <1> @@: 1190 <1> xor dl, dl 1191 <1> call scan_given_partitions 1192 <1> 1193 <1> ; manufacture units 0 and 1 if not existant 1194 <1> mov si, word [fsparm_pointer] 1195 <1> cmp si, fsparm + FSPARM_size*2 ; got at least 2 diskettes ? 1196 <1> jae @FF ; yes --> 1197 <1> cmp si, fsparm + FSPARM_size ; got 1 diskette ? 1198 <1> jae @F ; yes --> 1199 <1> mov di, si 1200 <1> push cs 1201 <1> pop es 1202 <1> xor ax, ax 1203 <1> mov cx, FSPARM_size >> 1 1204 <1> rep stosw ; initialise 1205 <1> mov byte [si + fspUnit], 0 1206 <1> mov word [si + fspSectorSize], 512 1207 <1> mov byte [si + fspType], -1 ; initialise to unit 0 1208 <1> inc byte [fsparm_number] 1209 <1> add si, FSPARM_size ; -> next 1210 <1> @@: 1211 <1> mov di, si 1212 <1> push cs 1213 <1> pop es 1214 <1> xor ax, ax 1215 <1> mov cx, FSPARM_size >> 1 1216 <1> rep stosw 1217 <1> mov byte [si + fspUnit], 1 1218 <1> mov word [si + fspSectorSize], 512 1219 <1> mov byte [si + fspType], -1 1220 <1> inc byte [fsparm_number] 1221 <1> add si, FSPARM_size 1222 <1> mov word [fsparm_pointer], si 1223 <1> @@: 1224 <1> 1225 <1> scan_fixed_disk_partitions: 1226 <1> mov dl, 80h 1227 <1> mov ah, 08h 1228 <1> stc 1229 <1> int 13h ; get number of fixed disks 1230 <1> mov ch, 0 1231 <1> mov cl, dl 1232 <1> jnc @F ; success --> 1233 <1> 1234 <1> mov ax, 40h 1235 <1> mov es, ax 1236 <1> mov cl, byte [es:bdaNumberFixedDisks] ; get from BDA instead 1237 <1> @@: 1238 <1> mov dl, 80h 1239 <1> call scan_given_partitions 1240 <1> 1241 <1> display_excess_partitions: 1242 <1> push cs 1243 <1> pop ds 1244 <1> mov ax, word [fsparm_excess] 1245 <1> test ax, ax 1246 <1> jz @F 1247 <1> mov dx, msg.excess_partitions_1 1248 <1> call disp_msg_asciz 1249 <1> call disp_ax_dec 1250 <1> mov dx, msg.excess_partitions_2 1251 <1> call disp_msg_asciz 1252 <1> @@: 1253 <1> 1254 <1> 1255 <1> display_partitions: 1256 <1> push cs 1257 <1> pop ds 1258 <1> mov byte [boot_drive], -1 1259 <1> xor cx, cx 1260 <1> mov cl, byte [fsparm_number] 1261 <1> mov si, fsparm 1262 <1> mov bx, 'A' 1263 <1> test cx, cx 1264 <1> jz .end 1265 <1> .loop: 1266 <1> 1267 <1> mov al, bl 1268 <1> call disp_al 1269 <1> 1270 <1> mov dx, msg.list_partition_1 1271 <1> call disp_msg_asciz 1272 <1> mov al, [si + fspUnit] 1273 <1> 1274 <1> push ax 1275 <1> cmp al, byte [boot_unit] 1276 <1> jne @FF 1277 <1> 1278 <1> cmp byte [boot_drive], -1 ; found any on this unit yet ? 1279 <1> jne @F ; yes --> 1280 <1> mov byte [boot_drive], bh ; default initialise to first part 1281 <1> @@: 1282 <1> 1283 <1> mov ax, [si + fspStart] ; does it match the partition ? 1284 <1> mov dx, [si + fspStart + 2] 1285 <1> cmp word [boot_partition], ax 1286 <1> jne @F 1287 <1> cmp word [boot_partition + 2], dx 1288 <1> jne @F ; no --> 1289 <1> 1290 <1> mov byte [boot_drive], bh ; yes, store this drive 1291 <1> @@: 1292 <1> pop ax 1293 <1> 1294 <1> mov dl, 'h' 1295 <1> test al, 80h 1296 <1> jnz @F 1297 <1> mov dl, 'f' 1298 <1> @@: 1299 <1> and al, ~80h 1300 <1> add al, 'a' 1301 <1> cmp al, 'z' 1302 <1> jbe @F 1303 <1> 1304 <1> mov al, 'u' 1305 <1> call disp_al 1306 <1> mov al, [si + fspUnit] 1307 <1> call disp_al_hex 1308 <1> mov al, '_' 1309 <1> call disp_al 1310 <1> 1311 <1> jmp @FF 1312 <1> 1313 <1> @@: 1314 <1> push ax 1315 <1> mov al, dl 1316 <1> call disp_al 1317 <1> mov al, 'd' 1318 <1> call disp_al 1319 <1> pop ax 1320 <1> call disp_al 1321 <1> 1322 <1> @@: 1323 <1> xor ax, ax 1324 <1> mov al, [si + fspPartition] 1325 <1> test ax, ax 1326 <1> jz .disp_2_blank 1327 <1> 1328 <1> call disp_ax_dec 1329 <1> cmp ax, 10 1330 <1> jb .disp_1_blank 1331 <1> jmp .disp_0_blank 1332 <1> 1333 <1> .disp_2_blank: 1334 <1> mov al, 32 1335 <1> call disp_al 1336 <1> .disp_1_blank: 1337 <1> mov al, 32 1338 <1> call disp_al 1339 <1> .disp_0_blank: 1340 <1> 1341 <1> mov dx, msg.list_partition_4 1342 <1> call disp_msg_asciz 1343 <1> 1344 <1> mov ax, [si + fspStart] 1345 <1> mov dx, [si + fspStart + 2] 1346 <1> call disp_dxax_hex 1347 <1> 1348 <1> push dx 1349 <1> mov dx, msg.list_partition_5 1350 <1> call disp_msg_asciz 1351 <1> pop dx 1352 <1> 1353 <1> push cx 1354 <1> push bx 1355 <1> mov cx, [si + fspSectorSize] 1356 <1> mov bx, 4+4 1357 <1> call disp_dxax_times_cx_width_bx_size 1358 <1> 1359 <1> mov dx, msg.list_partition_6 1360 <1> call disp_msg_asciz 1361 <1> 1362 <1> mov ax, [si + fspLength] 1363 <1> mov dx, [si + fspLength + 2] 1364 <1> call disp_dxax_hex 1365 <1> 1366 <1> push dx 1367 <1> mov dx, msg.list_partition_7 1368 <1> call disp_msg_asciz 1369 <1> pop dx 1370 <1> 1371 <1> call disp_dxax_times_cx_width_bx_size 1372 <1> pop bx 1373 <1> pop cx 1374 <1> 1375 <1> mov dx, msg.list_partition_8 1376 <1> call disp_msg_asciz 1377 <1> 1378 <1> mov al, [si + fspBoot] 1379 <1> test al, 80h 1380 <1> mov al, 32 1381 <1> jz @F 1382 <1> mov al, 'B' 1383 <1> @@: 1384 <1> call disp_al 1385 <1> 1386 <1> mov dx, msg.list_partition_9 1387 <1> call disp_msg_asciz 1388 <1> 1389 <1> xor ax, ax 1390 <1> mov al, byte [si + fspType] 1391 <1> call disp_al_hex 1392 <1> 1393 <1> mov dx, msg.list_partition_10 1394 <1> call disp_msg_asciz 1395 <1> 1396 <1> push si 1397 <1> mov si, pt_types 1398 <1> .types_loop: 1399 <1> cmp word [si], -1 1400 <1> je .types_unknown 1401 <1> cmp word [si], ax 1402 <1> je .types_known 1403 <1> add si, 4 1404 <1> jmp .types_loop 1405 <1> 1406 <1> .types_known: 1407 <1> mov dx, word [si + 2] 1408 <1> jmp .types_common 1409 <1> 1410 <1> .types_unknown: 1411 <1> mov dx, ptmsg_unknown 1412 <1> .types_common: 1413 <1> pop si 1414 <1> call disp_msg_asciz 1415 <1> 1416 <1> mov dx, msg.list_partition_11 1417 <1> call disp_msg_asciz 1418 <1> 1419 <1> add si, FSPARM_size 1420 <1> add bx, 0101h 1421 <1> loop .loop_jmp 1422 <1> jmp .end 1423 <1> .loop_jmp: 1424 <1> jmp .loop 1425 <1> .end: 1426 <1> 1427 <1> mov al, byte [boot_drive] 1428 <1> cmp al, -1 1429 <1> jne @F 1430 <1> mov al, [boot_unit] 1431 <1> cmp al, 2 1432 <1> jb @F 1433 <1> mov al, 2 1434 <1> @@: 1435 <1> mov byte [boot_drive], al 1436 <1> 1437 <1> mov bx, cs 1438 <1> sub bx, ((dosdata_end - dosdata_start) + 16) >> 4 1439 <1> mov es, bx 1440 <1> 1441 <1> mov byte [es:_RxDOS_CurrentDrive], al 1442 <1> inc ax 1443 <1> mov byte [es:bootdrive], al 1444 <1> 1445 <1> mov di, bootname.drive 1446 <1> add al, 'A'-1 1447 <1> stosb 1448 <1> 1449 <1> 1450 <1> display_bootname: 1451 <1> mov dx, msg.bootname_1 1452 <1> call disp_msg_asciz 1453 <1> push es 1454 <1> pop ds 1455 <1> mov si, bootname 1456 <1> call disp_msg 1457 <1> mov dx, msg.bootname_2 1458 <1> call disp_msg_asciz 1459 <1> 1460 <1> 1461 <1> setup_rploader_callback: 1462 <1> xor ax, ax 1463 <1> mov es, ax 1464 <1> lds si, [es:2Fh * 4] 1465 <1> push si 1466 <1> push cs 1467 <1> pop es 1468 <1> mov di, init1_msg.rploader 1469 <1> mov cx, init1_msg.rploader_size 1470 <1> add si, 3 1471 <1> repe cmpsb 1472 <1> pop si 1473 <1> jne .none 1474 <1> mov word [cs:init1_rploader_callback], si 1475 <1> mov word [cs:init1_rploader_callback + 2], ds 1476 <1> .none: 1477 <1> 1478 <1> 1479 <1> save_interrupts: 1480 <1> mov dx, 70h 1481 <1> mov ds, dx 1482 <1> xor ax, ax 1483 <1> mov es, ax 1484 <1> mov si, InterruptRestorationTable 1485 <1> .loop: 1486 <1> xor ax, ax 1487 <1> lodsb 1488 <1> cmp al, -1 1489 <1> je .end 1490 <1> xchg ax, bx 1491 <1> add bx, bx 1492 <1> add bx, bx 1493 <1> push word [es:bx + 2] 1494 <1> push word [es:bx] 1495 <1> pop word [si] 1496 <1> pop word [si + 2] 1497 <1> add si, 4 1498 <1> jmp .loop 1499 <1> .end: 1500 <1> 1501 <1> 1502 <1> ; ds = 70h 1503 <1> set_dos_segments: 1504 <1> mov bx, cs 1505 <1> sub bx, ((dosdata_end - dosdata_start) + 16) >> 4 1506 <1> mov word [dosentry_to_dosdata_segment], bx 1507 <1> mov es, bx 1508 <1> %if !_COMBINED_DOSDATA_DOSCODE 1509 <1> %if _RELOCATEDOSCODE 1510 <1> mov cx, cs 1511 <1> sub cx, ( (doscode_end - doscode_start) + 16 + (dosdata_end - dosdata_start) + 16 + 40h) >> 4 1516 <1> %else 1517 <1> mov cx, 70h 1518 <1> %endif 1519 <1> %else 1520 <1> mov cx, bx 1521 <1> %endif 1522 <1> mov word [es:dosdata_to_doscode_segment], cx 1523 <1> mov ax, word [bp + ldSectorSeg] 1524 <1> mov word [es:dosdata_to_diskbuffer_segment], ax 1525 <1> mov ax, word [bp + ldMemoryTop] 1526 <1> mov word [es:_RxDOS_MaxMemory], ax 1527 <1> mov word [es:p_buffer_info_record + 2], bx 1528 <1> 1529 <1> 1530 <1> ; ds = 70h 1531 <1> ; bx = DOSDATA 1532 <1> set_interrupts: 1533 <1> xor ax, ax 1534 <1> mov es, ax 1535 <1> mov word [es:21h * 4], i21 1536 <1> mov word [es:21h * 4 + 2], ds 1537 <1> 1538 <1> %imacro setint 2.nolist 1539 <1> mov dx, %1 1540 <1> mov ax, (25h << 8) | %2 1541 <1> int 21h 1542 <1> %endmacro 1543 <1> 1544 <1> clc 1545 <1> int3 1546 <1> jc .skip_ints_00_06 1547 <1> setint i00, 00h 1548 <1> setint entry_iret, 01h 1549 <1> setint entry_iret, 03h 1550 <1> setint i06, 06h 1551 <1> .skip_ints_00_06: 1552 <1> setint entry_iret, 02h 1553 <1> setint entry_iret, 04h 1554 <1> setint entry_iret, 05h 1555 <1> setint entry_iret, 07h 1556 <1> setint entry_iret, 33h 1557 <1> setint i19, 19h 1558 <1> setint i20, 20h 1559 <1> ; i21 set prior by direct IVT modification 1560 <1> setint entry_iret, 22h 1561 <1> setint i23, 23h 1562 <1> setint i24, 24h 1563 <1> setint i25, 25h 1564 <1> setint i26, 26h 1565 <1> setint i27, 27h 1566 <1> setint i28, 28h 1567 <1> setint i29, 29h 1568 <1> setint entry_iret, 2Ah 1569 <1> setint entry_iret, 2Bh 1570 <1> setint entry_iret, 2Ch 1571 <1> setint entry_iret, 2Dh 1572 <1> setint entry_iret, 2Eh 1573 <1> setint i2F, 2Fh 1574 <1> 1575 <1> mov byte [es:30h * 4], 0EAh 1576 <1> mov word [es:30h * 4 + 1], call5 1577 <1> mov word [es:30h * 4 + 3], ds 1578 <1> mov byte [es:30h * 4 + 5], 0 1579 <1> mov word [es:30h * 4 + 6], bx ; DR-DOS compatible DOSDATA reference 1580 <1> 1581 <1> mov ax, 5803h 1582 <1> xor bx, bx 1583 <1> int 21h ; disable UMB link 1584 <1> ; As we have an UMCB, this sets the LMCB linking to it to "Z". 1585 <1> 1586 <1> 1587 <1> ; ds = 70h 1588 <1> initialise_psp: 1589 <1> push ds 1590 <1> mov ax, cs 1591 <1> add ax, ( (init1_end - init1_start) + 16 + (init2_end - init2_start) + 16 ) >> 4 ; => INIT3 (PSP) 1596 <1> mov ds, ax 1597 <1> mov word [pspInt22 + 2], ax 1598 <1> mov word [pspParent], ax 1599 <1> mov word [pspStack + 2], ax 1600 <1> mov word [pspPHTAddress + 2], ax 1601 <1> 1602 <1> mov bx, ax 1603 <1> mov cl, S_ENVIRONMENT 1604 <1> mov ax, _INIT_ENV_SIZE 1605 <1> call init1_alloc_s_mcb_top 1606 <1> mov word [pspEnvironment], es 1607 <1> 1608 <1> pop ds 1609 <1> mov es, word [dosentry_to_dosdata_segment] 1610 <1> mov word [es:_RxDOS_CurrentPSP], bx 1611 <1> 1612 <1> 1613 <1> call_rploader_phase_1: 1614 <1> mov dx, 1 1615 <1> call init1_call_rploader 1616 <1> 1617 <1> 1618 <1> initialise_upb_chain: 1619 <1> xor cx, cx 1620 <1> mov cl, byte [cs:fsparm_number] 1621 <1> mov ax, DISKBLOCK_size 1622 <1> mul cx 1623 <1> test dx, dx 1624 <1> jz @F 1625 <1> 1626 <1> push cs 1627 <1> pop ds 1628 <1> mov si, init1_msg.internal_error_upb 1629 <1> call init1_disp_msg 1630 <1> jmp init1_reboot_prompt 1631 <1> 1632 <1> @@: 1633 <1> push cx 1634 <1> push cx 1635 <1> mov cl, S_UPB 1636 <1> call init1_alloc_s_mcb_top 1637 <1> pop cx 1638 <1> 1639 <1> mov dx, 70h 1640 <1> mov ds, dx 1641 <1> mov ds, word [dosentry_to_dosdata_segment] 1642 <1> mov si, ptrStartBlockedDeviceTable - _dskNextPointer ; -> -> UPB 1643 <1> mov bx, fsparm 1644 <1> xor ax, ax 1645 <1> 1646 <1> mov word [si + _dskNextPointer], -1 1647 <1> mov word [si + _dskNextPointer + 2], -1 1648 <1> test cx, cx 1649 <1> jz .end 1650 <1> 1651 <1> ; es:di -> next UPB to initialise 1652 <1> ; ds:si -> previous UPB (_dskNextPointer uninitialised) 1653 <1> .next: 1654 <1> mov al, [cs:bx + fspUnit] 1655 <1> mov byte [es:di + _dskPhysDriveNumber], al 1656 <1> mov byte [es:di + _dskDOSLogicalDiskUnit], ah 1657 <1> 1658 <1> push ax 1659 <1> 1660 <1> mov al, byte [cs:bx + fspType] 1661 <1> mov byte [es:di + _dskFATSystemType], al 1662 <1> 1663 <1> push word [cs:bx + fspStart + 2] 1664 <1> push word [cs:bx + fspStart] 1665 <1> pop word [es:di + _dskBPB + bpbHiddenSectors] 1666 <1> pop word [es:di + _dskBPB + bpbHiddenSectors + 2] 1667 <1> and word [es:di + _dskBPB + bpbTotalSectors], 0 1668 <1> push word [cs:bx + fspLength + 2] 1669 <1> push word [cs:bx + fspLength] 1670 <1> pop word [es:di + _dskBPB + bpbTotalSectorsLarge] 1671 <1> pop word [es:di + _dskBPB + bpbTotalSectorsLarge + 2] 1672 <1> push word [cs:bx + fspSectorSize] 1673 <1> pop word [es:di + _dskBPB + bpbBytesPerSector] 1674 <1> 1675 <1> push word [cs:bx + fspStart + 2] 1676 <1> push word [cs:bx + fspStart] 1677 <1> pop word [es:di + _dskDefaultBPB + bpbHiddenSectors] 1678 <1> pop word [es:di + _dskDefaultBPB + bpbHiddenSectors + 2] 1679 <1> and word [es:di + _dskDefaultBPB + bpbTotalSectors], 0 1680 <1> push word [cs:bx + fspLength + 2] 1681 <1> push word [cs:bx + fspLength] 1682 <1> pop word [es:di + _dskDefaultBPB + bpbTotalSectorsLarge] 1683 <1> pop word [es:di + _dskDefaultBPB + bpbTotalSectorsLarge + 2] 1684 <1> push word [cs:bx + fspSectorSize] 1685 <1> pop word [es:di + _dskDefaultBPB + bpbBytesPerSector] 1686 <1> 1687 <1> push word [cs:bx + fspStart + 2] 1688 <1> push word [cs:bx + fspStart] 1689 <1> pop word [es:di + _dskExtHiddenSectors] 1690 <1> pop word [es:di + _dskExtHiddenSectors + 2] 1691 <1> 1692 <1> mov word [es:di + _dskPartitionType], 1 1693 <1> mov byte [es:di + _dskDeviceType], -1 1694 <1> 1695 <1> cmp byte [es:di + _dskPhysDriveNumber], 80h 1696 <1> jb @F 1697 <1> or word [es:di + _dskStatusFlag], IsNonRemovable 1698 <1> @@: 1699 <1> 1700 <1> push dx 1701 <1> push cx 1702 <1> push bx 1703 <1> mov ah, 41h 1704 <1> mov dl, [es:di + _dskPhysDriveNumber] 1705 <1> mov bx, 55AAh 1706 <1> stc 1707 <1> int 13h ; 13.41.bx=55AA extensions installation check 1708 <1> mov al, 0 ; zero in case of no LBA support 1709 <1> jc .no_lba 1710 <1> cmp bx, 0AA55h 1711 <1> jne .no_lba 1712 <1> test cl, 1 ; support bitmap bit 0 1713 <1> jz .no_lba 1714 <1> inc ax ; al = 1 to indicate LBA support 1715 <1> .no_lba: 1716 <1> pop bx 1717 <1> pop cx 1718 <1> pop dx 1719 <1> mov byte [es:di + _dskExtReadWrite], al 1720 <1> 1721 <1> pop ax 1722 <1> mov word [es:di + _dskNextPointer], -1 1723 <1> mov word [es:di + _dskNextPointer + 2], -1 1724 <1> mov word [si + _dskNextPointer], di 1725 <1> mov word [si + _dskNextPointer + 2], es 1726 <1> 1727 <1> add bx, FSPARM_size 1728 <1> inc ah 1729 <1> add di, DISKBLOCK_size 1730 <1> lds si, [si + _dskNextPointer] 1731 <1> loop .loop_jmp_next 1732 <1> jmp .end 1733 <1> .loop_jmp_next: 1734 <1> jmp .next 1735 <1> .end: 1736 <1> 1737 <1> mov ds, dx 1738 <1> pop cx 1739 <1> mov byte [block + devUnits], cl 1740 <1> 1741 <1> 1742 <1> relocate_int1E_table: 1743 <1> xor ax, ax 1744 <1> mov es, ax 1745 <1> lds si, [es:1Eh * 4] 1746 <1> mov cx, 10h 1747 <1> mov di, 522h 1748 <1> push di 1749 <1> rep movsb 1750 <1> mov word [es:1Eh * 4 + 2], es 1751 <1> pop word [es:1Eh * 4] 1752 <1> 1753 <1> 1754 <1> finish: 1755 <1> push cs 1756 <1> pop ds 1757 <1> %if _TEST_PAYLOAD 1758 <1> mov si, msg.test 1759 <1> call disp_msg 1760 <1> int3 1761 <1> xor ax, ax 1762 <1> int 16h 1763 <1> %else 1764 <1> int3 1765 <1> %endif 1766 <1> 1767 <1> mov al, 20h 1768 <1> out 20h, al ; reset interrupts 1769 <1> 1770 <1> mov ax, 0500h 1771 <1> int 10h ; set page zero 1772 <1> 1773 <1> mov si, init1_msg.loading_os 1774 <1> call disp_msg 1775 <1> 1776 <1> mov bx, cs 1777 <1> add bx, ( (init1_end - init1_start) + 16 ) >> 4 ; => INIT2 1780 <1> mov ax, init2_start 1781 <1> push bx 1782 <1> push ax 1783 <1> 1784 <1> mov es, bx 1785 <1> mov word [es:init2_to_init1_segment], cs 1786 <1> 1787 <1> xor cx, cx 1788 <1> mov cl, byte [cs:fsparm_number] 1789 <1> 1790 <1> 1791 <1> ; INP: cs = INIT2 1792 <1> ; word [DOSDATA:dosdata_to_doscode_segment] = DOSCODE segment 1793 <1> ; word [DOSENTRY:dosentry_to_dosdata_segment] = DOSDATA segment 1794 <1> ; 70h = DOSENTRY segment 1795 <1> ; ip = 0 1796 <1> ; cx = number of default block device's units (<= 32) 1797 <1> ; word [INIT2:init2_to_init1_segment] = INIT1 1798 <1> init1_retf: 1799 <1> retf 1800 <1> 1801 <1> 1802 <1> ; INP: dx = phase code 1803 <1> ; OUT: - 1804 <1> ; CHG: - 1805 <1> ; (EDR-DOS pushes es,ax,bx,cx,dx and notes that 1806 <1> ; this function doesn't modify any registers.) 1807 <1> %if 0 1808 <1> 1809 <1> The phase codes are: 1810 <1> 1811 <1> 1 = early before DOS loading, BIO has been relocated to LMA top 1812 <1> 2 = before CONFIG.SYS processing 1813 <1> 3 = after CONFIG.SYS processing (before shell is loaded) 1814 <1> 1815 <1> These are described in RBIL 61, 2F4A06, in the Notes. However, code 1's 1816 <1> description there is misguided. The relocation of "BIOS init code and data" 1817 <1> doesn't mean into the HMA; rather, it's to the top of the LMA. 1818 <1> In EDR-DOS/dr70108/DRBIO/biosinit.a86:273, this is noted as 1819 <1> "BIOSINIT CODE and DATA have now been relocated to high memory", 1820 <1> but this means the top of the LMA. The HMA is only available later, 1821 <1> during CONFIG.SYS processing, so it can't be used at this point. 1822 <1> 1823 <1> %endif 1824 <1> 1825 <1> init1_insure_low_byte_not_0CCh 1826 <1> init1_call_rploader: 1827 <1> push es 1828 <1> push ax 1829 <1> push bx 1830 <1> push cx 1831 <1> push dx 1832 <1> 1833 <1> mov ax, 12FFh 1834 <1> mov bx, 5 1835 <1> xor cx, cx 1836 <1> mov dx, 1 1837 <1> 1838 <1> ; The callback variable is initialised to the address of an 1839 <1> ; iret in the DOSENTRY segment if RPLOADER wasn't detected. 1840 <1> pushf 1841 <1> cli 1842 <1> call far [cs:init1_rploader_callback] 1843 <1> 1844 <1> pop dx 1845 <1> pop cx 1846 <1> pop bx 1847 <1> pop ax 1848 <1> pop es 1849 <1> retn 1850 <1> 1851 <1> 1852 <1> ; INP: ax = space in bytes to allocate at top of LMA 1853 <1> ; cl = allocation type 1854 <1> ; OUT: es:di-> allocated space, initialised to all zeros 1855 <1> ; (di = 0) 1856 <1> ; ax = cx = space in bytes allocated, 1857 <1> ; ! 0 if size is 65536 1858 <1> ; does not return after allocation failure 1859 <1> ; CHG: - 1860 <1> init1_insure_low_byte_not_0CCh 1861 <1> init1_alloc_s_mcb_top: 1862 <1> push si 1863 <1> push bx 1864 <1> xchg si, ax 1865 <1> 1866 <1> mov ax, 5802h 1867 <1> int 21h 1868 <1> mov ah, 0 1869 <1> push ax 1870 <1> mov ax, 5800h 1871 <1> int 21h 1872 <1> push ax 1873 <1> 1874 <1> mov ax, 5803h 1875 <1> xor bx, bx 1876 <1> int 21h ; link out UMB chain 1877 <1> mov ax, 5801h 1878 <1> mov bx, 2 1879 <1> int 21h ; alloc strategy: last fit, LMA only 1880 <1> 1881 <1> xchg ax, si ; reset ax to allocation size, cl = type 1882 <1> call init1_alloc_s_mcb ; allocate 1883 <1> 1884 <1> pop bx 1885 <1> mov ax, 5801h 1886 <1> int 21h ; alloc strategy: restore 1887 <1> pop bx 1888 <1> mov ax, 5803h 1889 <1> int 21h ; restore UMB chain linkage 1890 <1> 1891 <1> mov ax, cx ; ax = allocated size (! 0 if size is 65536) 1892 <1> pop bx 1893 <1> pop si 1894 <1> retn 1895 <1> %endif 1896 <1> 1897 <1> 1898 <1> ; INP: ax = space in bytes to allocate 1899 <1> ; cl = allocation type 1900 <1> ; OUT: es:di-> allocated space, initialised to all zeros 1901 <1> ; (di = 0) 1902 <1> ; ax = cx = space in bytes allocated, 1903 <1> ; ! 0 if size is 65536 1904 <1> ; does not return after allocation failure 1905 <1> ; CHG: - 1906 <1> ; init1_insure_low_byte_not_0CCh 1907 <1> ; init1_alloc_s_mcb: 1908 <1> init2_alloc_s_mcb: 1909 <1> assume ds:nothing, es:nothing, ss:nothing 0 00005F51 53 push bx 0 00005F52 83C00F add ax, 15 0 00005F55 7304 jnc @F 0 00005F57 B80080 mov ax, 1_0000h >> 1 0 00005F5A A9 db __TEST_IMM16 1915 <1> @@: 0 00005F5B D1E8 shr ax, 1 0 00005F5D D1E8 shr ax, 1 0 00005F5F D1E8 shr ax, 1 0 00005F61 D1E8 shr ax, 1 ; = paragraphs 1920 <1> 0 00005F63 89C3 mov bx, ax 0 00005F65 B448 mov ah, 48h 0 00005F67 F9 stc 0 00005F68 CD21 int 21h 0 00005F6A 723F jc .alloc_fail 1926 <1> 0 00005F6C 48 dec ax 0 00005F6D 8EC0 mov es, ax 1929 <1> assume es:MCB 0 00005F6F 26C70601000800 mov word [es:mcbOwner], 8 ; system-owned MCB 0 00005F76 26C70608005300 mov word [es:smcbName], "S" ; S MCB 0 00005F7D B500 mov ch, 0 0 00005F7F 26890E0A00 mov word [es:smcbType], cx ; type = cl, reserved = 0 0 00005F84 B100 mov cl, 0 0 00005F86 26890E0C00 mov word [es:smcbLink], cx ; link = 0 0 00005F8B 26890E0E00 mov word [es:smcbLink + 2], cx ; reserved = 0 1937 <1> 0 00005F90 40 inc ax 0 00005F91 8EC0 mov es, ax 1940 <1> assume es:nothing 0 00005F93 31FF xor di, di ; -> allocated space 0 00005F95 89D9 mov cx, bx 0 00005F97 D1E1 shl cx, 1 0 00005F99 D1E1 shl cx, 1 0 00005F9B D1E1 shl cx, 1 ; = number of words 0 00005F9D 31C0 xor ax, ax 0 00005F9F 57 push di 0 00005FA0 51 push cx 0 00005FA1 F3AB rep stosw ; initialise allocated memory to zeros 0 00005FA3 59 pop cx 0 00005FA4 5F pop di 0 00005FA5 D1E1 shl cx, 1 0 00005FA7 89C8 mov ax, cx 0 00005FA9 5B pop bx 0 00005FAA C3 retn 1956 <1> 1957 <1> 1958 <1> .alloc_fail: 0 00005FAB 0E push cs 0 00005FAC 1F pop ds 1961 <1> assume ds:SYSINITGROUP 0 00005FAD 50 push ax 0 00005FAE BE[9614] mov si, init1_msg.alloc_error ; access with ds 0 00005FB1 E885FF call init1_disp_msg 0 00005FB4 58 pop ax 0 00005FB5 E84209 call init1_disp_ax_hex 0 00005FB8 50 push ax 0 00005FB9 BE[A314] mov si, init1_msg.alloc_error_q ; access with ds 0 00005FBC E87AFF call init1_disp_msg 0 00005FBF 58 pop ax 1971 <1> 0 00005FC0 83F813 cmp ax, init1_msg_errors.count 0 00005FC3 7205 jb .valid 0 00005FC5 BE[2015] mov si, init1_msg_errors.unknown_error ; access with ds 0 00005FC8 EB08 jmp short .disp_error 1976 <1> .valid: 0 00005FCA 89C3 mov bx, ax 0 00005FCC 01DB add bx, bx 0 00005FCE 8BB7[FA14] mov si, [ init1_msg_errors + bx ] 1980 <1> .disp_error: 0 00005FD2 E864FF call init1_disp_msg 0 00005FD5 BE[BF14] mov si, init1_msg.linebreak ; access with ds 0 00005FD8 E85EFF call init1_disp_msg 1984 <1> 1985 <1> init1_reboot_prompt: 0 00005FDB 0E push cs 0 00005FDC 1F pop ds 1988 <1> assume ds:SYSINITGROUP 0 00005FDD BE[C214] mov si, init1_msg.reboot_prompt ; access with ds 0 00005FE0 E856FF call init1_disp_msg 1991 <1> .loop: 0 00005FE3 CC int3 0 00005FE4 31C0 xor ax, ax 0 00005FE6 CD16 int 16h 0 00005FE8 EBF9 jmp .loop 1996 <1> 1997 <1> 1998 <1> %if 0 1999 <1> ; Move paragraphs 2000 <1> ; 2001 <1> ; INP: ax:0-> source 2002 <1> ; dx:0-> destination 2003 <1> ; cx = number of paragraphs 2004 <1> ; CHG: - 2005 <1> ; Note: Doesn't work correctly on HMA; doesn't always wrap to LMA either. 2006 <1> ; Do not provide a wrapped/HMA source or destination! 2007 <1> init1_movp: 2008 <1> push cx 2009 <1> push ds 2010 <1> push si 2011 <1> push es 2012 <1> push di 2013 <1> 2014 <1> cmp ax, dx ; source above destination ? 2015 <1> ja .up ; yes, move up (forwards) --> 2016 <1> je .return ; same, no need to move --> 2017 <1> push ax 2018 <1> add ax, cx ; (expected not to carry) 2019 <1> cmp ax, dx ; end of source is above destination ? 2020 <1> pop ax 2021 <1> ja .down ; yes, move from top down --> 2022 <1> ; Here, the end of source is below-or-equal the destination, 2023 <1> ; so they do not overlap. In this case we prefer moving up. 2024 <1> 2025 <1> .up: 2026 <1> push ax 2027 <1> push dx 2028 <1> .uploop: 2029 <1> mov ds, ax 2030 <1> mov es, dx 2031 <1> xor di, di 2032 <1> xor si, si ; -> start of segment 2033 <1> sub cx, 1000h ; 64 KiB left ? 2034 <1> jbe .uplast ; no --> 2035 <1> push cx 2036 <1> mov cx, 10000h /2 2037 <1> rep movsw ; move 64 KiB 2038 <1> pop cx 2039 <1> add ax, 1000h 2040 <1> add dx, 1000h ; -> next segment 2041 <1> jmp short .uploop ; proceed for more --> 2042 <1> .uplast: 2043 <1> add cx, 1000h ; restore counter 2044 <1> shl cx, 1 2045 <1> shl cx, 1 2046 <1> shl cx, 1 ; *8, paragraphs to words 2047 <1> rep movsw ; move last part 2048 <1> pop dx 2049 <1> pop ax 2050 <1> jmp short .return 2051 <1> 2052 <1> .down: 2053 <1> std ; _AMD_ERRATUM_109_WORKAROUND as below 2054 <1> .dnloop: 2055 <1> sub cx, 1000h ; 64 KiB left ? 2056 <1> jbe .dnlast ; no --> 2057 <1> push ax 2058 <1> push dx 2059 <1> add ax, cx 2060 <1> add dx, cx 2061 <1> mov ds, ax ; -> 64 KiB not yet moved 2062 <1> mov es, dx 2063 <1> pop dx 2064 <1> pop ax 2065 <1> mov di, -2 2066 <1> mov si, di ; moved from last word down 2067 <1> push cx 2068 <1> mov cx, 10000h /2 2069 <1> rep movsw ; move 64 KiB 2070 <1> pop cx 2071 <1> jmp short .dnloop ; proceed for more --> 2072 <1> .dnlast: 2073 <1> add cx, 1000h ; restore counter 2074 <1> shl cx, 1 2075 <1> shl cx, 1 2076 <1> shl cx, 1 ; *8, paragraphs to words 2077 <1> mov di, cx 2078 <1> dec di 2079 <1> shl di, 1 ; words to offset, -> last word 2080 <1> mov si, di 2081 <1> mov ds, ax 2082 <1> mov es, dx ; first segment correct 2083 <1> 2084 <1> 2085 <1> numdef AMD_ERRATUM_109_WORKAROUND, 1 2086 <1> ; Refer to comment in init0_movp. 2087 <1> 2088 <1> %if _AMD_ERRATUM_109_WORKAROUND 2089 <1> jcxz @FF 2090 <1> cmp cx, 20 2091 <1> ja @FF 2092 <1> @@: 2093 <1> movsw 2094 <1> loop @B 2095 <1> @@: 2096 <1> %endif 2097 <1> rep movsw ; move first part 2098 <1> cld 2099 <1> .return: 2100 <1> pop di 2101 <1> pop es 2102 <1> pop si 2103 <1> pop ds 2104 <1> pop cx 2105 <1> retn 2106 <1> 2107 <1> %endif 2108 <1> 2109 <1> ; INP: dx:ax = numerator 2110 <1> ; cx = multiplier 2111 <1> ; bx = field width 2112 <1> ; STT: UP 2113 <1> ; OUT: displayed 2114 <1> ; init1_insure_low_byte_not_0CCh 2115 <1> disp_dxax_times_cx_width_bx_size: 2116 <1> global init2_disp_dxax_times_cx_width_bx_size 2117 <1> init2_disp_dxax_times_cx_width_bx_size: 2118 <1> assume ds:nothing, es:nothing, ss:nothing 2119 <1> lframe near 2120 <1> lvar 4 + 4 + 2, buffer 2121 <1> lvar 6, dividend 0 00005FEA 5589E58D66F0 lenter 2123 <1> lvar word, width 0 00005FF0 53 push bx 0 00005FF1 56 push si 0 00005FF2 57 push di 0 00005FF3 1E push ds 0 00005FF4 06 push es 0 00005FF5 51 push cx 0 00005FF6 50 push ax 0 00005FF7 52 push dx 2132 <1> 0 00005FF8 0E push cs 0 00005FF9 1F pop ds 2135 <1> assume ds:SYSINITGROUP 0 00005FFA 16 push ss 0 00005FFB 07 pop es 2138 <1> assume es:nothing 2139 <1> 0 00005FFC 52 push dx 0 00005FFD F7E1 mul cx 0 00005FFF 97 xchg ax, di 0 00006000 87D6 xchg dx, si ; si:di = first mul 2144 <1> 0 00006002 58 pop ax 0 00006003 F7E1 mul cx 0 00006005 01F0 add ax, si 0 00006007 83D200 adc dx, 0 ; dx:ax = second mul + adj, dx:ax:di = mul 2149 <1> 0 0000600A 89F9 mov cx, di ; dx:ax:cx = mul 2151 <1> 0 0000600C 894EF0 mov word [bp + ?dividend], cx 0 0000600F 8946F2 mov word [bp + ?dividend + 2], ax 0 00006012 8956F4 mov word [bp + ?dividend + 4], dx 2155 <1> 0 00006015 BE[F314] mov si, init1_msg.prefixes ; access with ds 2157 <1> .loop: 0 00006018 837EF400 cmp word [bp + ?dividend + 4], 0 0 0000601C 750D jnz .divide 0 0000601E 837EF200 cmp word [bp + ?dividend + 2], 0 0 00006022 7507 jnz .divide 0 00006024 817EF00008 cmp word [bp + ?dividend], 2048 0 00006029 7617 jbe .end 2164 <1> .divide: 0 0000602B 46 inc si 0 0000602C B90004 mov cx, 1024 ; 1000 here if SI units 0 0000602F 31D2 xor dx, dx 0 00006031 BF0600 mov di, 6 2169 <1> .loop_divide: 0 00006034 8B43EE mov ax, [bp + ?dividend - 2 + di] 0 00006037 F7F1 div cx 0 00006039 8943EE mov word [bp + ?dividend - 2 + di], ax 0 0000603C 4F dec di 0 0000603D 4F dec di 0 0000603E 75F4 jnz .loop_divide 2176 <1> ; dx = last remainder 0 00006040 EBD6 jmp .loop 2178 <1> 2179 <1> .end: 0 00006042 8D7EFF lea di, [bp + ?buffer + 4 + 4 + 1] 0 00006045 FD std ; _AMD_ERRATUM_109_WORKAROUND does not apply 0 00006046 B042 mov al, "B" 0 00006048 AA stosb 0 00006049 8A04 mov al, [si] 0 0000604B 3C20 cmp al, 32 0 0000604D 7408 je @F 2187 <1> 0 0000604F 24DF and al, ~20h ; uppercase, don't do this if SI units 0 00006051 50 push ax 0 00006052 B069 mov al, "i" 0 00006054 AA stosb ; don't store this if SI units 0 00006055 58 pop ax 0 00006056 AA stosb 2194 <1> @@: 0 00006057 B020 mov al, 32 0 00006059 AA stosb 2197 <1> 0 0000605A 8B46F0 mov ax, word [bp + ?dividend] 0 0000605D B90A00 mov cx, 10 2200 <1> .loop_write: 0 00006060 31D2 xor dx, dx 0 00006062 F7F1 div cx 0 00006064 92 xchg ax, dx 2204 <1> ; ax = remainder (next digit) 2205 <1> ; dx = result of div 0 00006065 0430 add al, '0' 0 00006067 AA stosb 0 00006068 92 xchg ax, dx ; ax = result of div 0 00006069 85C0 test ax, ax ; any more ? 0 0000606B 75F3 jnz .loop_write ; loop --> 2211 <1> 0 0000606D FC cld 2213 <1> 0 0000606E 8D5EFF lea bx, [bp + ?buffer + 4 + 4 + 1] 0 00006071 29FB sub bx, di 2216 <1> 0 00006073 8B4EEE mov cx, [bp + ?width] 0 00006076 29D9 sub cx, bx 0 00006078 7607 jbe .none_blank 2220 <1> .loop_blank: 0 0000607A B020 mov al, 32 0 0000607C E8C4FE call disp_al 0 0000607F E2F9 loop .loop_blank 2224 <1> .none_blank: 2225 <1> 0 00006081 89D9 mov cx, bx 2227 <1> .loop_disp: 0 00006083 47 inc di 0 00006084 368A05 mov al, [ss:di] 0 00006087 E8B9FE call disp_al 0 0000608A E2F7 loop .loop_disp 2232 <1> 0 0000608C 5A pop dx 0 0000608D 58 pop ax 0 0000608E 59 pop cx 0 0000608F 07 pop es 2237 <1> assume es:nothing 0 00006090 1F pop ds 2239 <1> assume ds:nothing 0 00006091 5F pop di 0 00006092 5E pop si 0 00006093 5B pop bx 0 00006094 89EC5D lleave 0 00006097 C3 lret 2245 <1> 2246 <1> 2247 <1> ; INP: ax = number to display 2248 <1> ; CHG: - 2249 <1> ; init1_insure_low_byte_not_0CCh 2250 <1> global init2_disp_ax_dec 2251 <1> init2_disp_ax_dec: 2252 <1> disp_ax_dec: ; ax (no leading zeros) 2253 <1> assume ds:nothing, es:nothing, ss:nothing 2254 <1> ; In: number in ax 2255 <1> ; Out: displayed 0 00006098 53 push bx 0 00006099 31DB xor bx, bx 2258 <1> .pushax: 0 0000609B 50 push ax 2260 <1> .pushend: 0 0000609C 08DB or bl, bl 0 0000609E 7405 jz .nobl 0 000060A0 80EB05 sub bl, 5 0 000060A3 F6DB neg bl 2265 <1> .nobl: 0 000060A5 51 push cx 0 000060A6 B91027 mov cx, 10000 0 000060A9 E81A00 call .divide_out 0 000060AC B9E803 mov cx, 1000 0 000060AF E81400 call .divide_out 0 000060B2 B96400 mov cx, 100 0 000060B5 E80E00 call .divide_out 0 000060B8 B10A mov cl, 10 0 000060BA E80900 call .divide_out 2275 <1> ; (Divisor 1 is useless) 0 000060BD 0430 add al, '0' 0 000060BF E881FE call disp_al 0 000060C2 59 pop cx 0 000060C3 58 pop ax 0 000060C4 5B pop bx ; Caller's register 0 000060C5 C3 retn 2282 <1> 2283 <1> .divide_out: 2284 <1> ; In: ax = number 2285 <1> ; cx = divisor 2286 <1> ; Out: ax = remainder of operation 2287 <1> ; result displayed 0 000060C6 52 push dx 0 000060C7 31D2 xor dx, dx 0 000060C9 F7F1 div cx ; 0:ax / cx 0 000060CB 52 push dx ; remainder 0 000060CC FECB dec bl 0 000060CE 7503 jnz .nobl2 0 000060D0 80CF01 or bh, 1 2295 <1> .nobl2: 0 000060D3 08C7 or bh, al 0 000060D5 7405 jz .leadingzero 0 000060D7 0430 add al, '0' 0 000060D9 E867FE call disp_al ; display result 2300 <1> .leadingzero: 0 000060DC 58 pop ax ; remainder 0 000060DD 5A pop dx 0 000060DE C3 retn 2304 <1> 2305 <1> 2306 <1> %if 0 ; lMS-DOS 2307 <1> 2308 <1> ; INP: es:si -> partition table entry, 2309 <1> ; si = partition_table .. (partition_table.end - 16), 2310 <1> ; es = cs 2311 <1> ; ss:bx + di -> above part table metadata, 2312 <1> ; dwo [ss:bx + di - 4] = root (outermost extended position) 2313 <1> ; dwo [ss:bx + di - 8] = base (current table position) 2314 <1> ; ss:bp -> BPB area, LOADSTACKVARS, LOADDATA, LOADDATA2 2315 <1> ; CHG: ax, (cx), dx 2316 <1> login_partition: 2317 <1> mov al, byte [es:si + piType] 2318 <1> cmp al, ptFAT12 2319 <1> je .isfat 2320 <1> cmp al, ptFAT16_16BIT_CHS 2321 <1> je .isfat 2322 <1> cmp al, ptFAT16_CHS 2323 <1> je .isfat 2324 <1> cmp al, ptFAT32_CHS 2325 <1> je .isfat 2326 <1> cmp al, ptFAT32 2327 <1> je .isfat 2328 <1> cmp al, ptFAT16 2329 <1> je .isfat 2330 <1> 2331 <1> retn 2332 <1> 2333 <1> .isfat: 2334 <1> push ds 2335 <1> push cx 2336 <1> push bx 2337 <1> push si 2338 <1> push di 2339 <1> push es 2340 <1> push cs 2341 <1> pop ds 2342 <1> cmp byte [fsparm_number], 32 2343 <1> jne @F 2344 <1> 2345 <1> inc word [fsparm_excess] 2346 <1> .return: 2347 <1> pop es 2348 <1> pop di 2349 <1> pop si 2350 <1> pop bx 2351 <1> pop cx 2352 <1> pop ds 2353 <1> retn 2354 <1> 2355 <1> @@: 2356 <1> mov dl, al 2357 <1> inc byte [fsparm_number] 2358 <1> mov di, [fsparm_pointer] 2359 <1> add word [fsparm_pointer], FSPARM_size 2360 <1> push cs 2361 <1> pop es ; -> FSPARM 2362 <1> xor ax, ax 2363 <1> mov cx, FSPARM_size >> 1 2364 <1> push di 2365 <1> rep stosw ; initialise 2366 <1> pop di 2367 <1> mov al, [load_unit] 2368 <1> mov byte [di + fspUnit], al 2369 <1> push word [load_sectorsize] 2370 <1> pop word [di + fspSectorSize] 2371 <1> mov byte [di + fspType], dl 2372 <1> mov cx, di 2373 <1> pop es 2374 <1> pop di 2375 <1> pop si 2376 <1> push si 2377 <1> push di 2378 <1> push es 2379 <1> 2380 <1> mov ax, word [ss:bx + di - 8] 2381 <1> mov dx, word [ss:bx + di - 6] ; root 2382 <1> add ax, word [es:si + piStart] 2383 <1> adc dx, word [es:si + piStart + 2] ; add partition offset 2384 <1> 2385 <1> mov di, cx 2386 <1> mov word [di + fspStart], ax 2387 <1> mov word [di + fspStart + 2], dx 2388 <1> push word [es:si + piLength + 2] 2389 <1> push word [es:si + piLength] 2390 <1> pop word [di + fspLength] 2391 <1> pop word [di + fspLength + 2] 2392 <1> 2393 <1> mov al, byte [load_current_partition] 2394 <1> mov byte [di + fspPartition], al 2395 <1> mov al, byte [es:si + piBoot] 2396 <1> mov byte [di + fspBoot], al 2397 <1> 2398 <1> jmp .return 2399 <1> 2400 <1> 2401 <1> ; INP: dl = first unit to log in 2402 <1> ; cx = number of units to log in 2403 <1> scan_given_partitions: 2404 <1> jcxz .none 2405 <1> .loop: 2406 <1> push cx 2407 <1> push dx 2408 <1> 2409 <1> mov word [throw_sp], sp 2410 <1> mov word [throw_ip], .fail 2411 <1> 2412 <1> mov byte [load_unit], dl 2413 <1> call query_geometry 2414 <1> 2415 <1> mov cx, login_partition 2416 <1> call scan_partitions 2417 <1> push cs 2418 <1> pop ds 2419 <1> db __TEST_IMM8 ; (NC) 2420 <1> .fail: 2421 <1> stc 2422 <1> push cs 2423 <1> pop ds 2424 <1> pop dx 2425 <1> pop cx 2426 <1> 2427 <1> jnc @F 2428 <1> push dx 2429 <1> xchg ax, dx 2430 <1> mov dx, msg.login_partition_error_1 2431 <1> call disp_msg_asciz 2432 <1> call disp_al_hex 2433 <1> mov dx, msg.login_partition_error_2 2434 <1> call disp_msg_asciz 2435 <1> pop dx 2436 <1> @@: 2437 <1> inc dx 2438 <1> loop .loop 2439 <1> .none: 2440 <1> retn 2441 <1> %endif 2442 <1> 2443 <1> 2444 <1> global hexword, hexbyte, hexnyb 2445 <1> hexword: 0 000060DF 86C4 xchg al, ah 0 000060E1 E80200 call hexbyte 0 000060E4 86C4 xchg al, ah 2449 <1> 2450 <1> hexbyte: 0 000060E6 51 push cx 0 000060E7 B104 mov cl, 4 0 000060E9 D2C0 rol al, cl 0 000060EB E80300 call hexnyb 0 000060EE D2C0 rol al, cl 0 000060F0 59 pop cx 2457 <1> 2458 <1> hexnyb: 0 000060F1 50 push ax 0 000060F2 240F and al, 0Fh 0 000060F4 0490 add al, 90h 0 000060F6 27 daa 0 000060F7 1440 adc al, 40h 0 000060F9 27 daa ; these four instructions change to ASCII hex 0 000060FA AA stosb 0 000060FB 58 pop ax 0 000060FC C3 retn 2468 <1> 2469 <1> 2470 <1> %if 0 ; lMS-DOS 2471 <1> cmd3: 2472 <1> push cs 2473 <1> pop ds 2474 <1> push cs 2475 <1> pop es 2476 <1> mov sp, [throw_sp] 2477 <1> jmp near [throw_ip] 2478 <1> 2479 <1> 2480 <1> bootcmd: 2481 <1> .fail_read: 2482 <1> push cs 2483 <1> pop es 2484 <1> mov di, msg.bootfail_read_errorcode 2485 <1> mov al, ah 2486 <1> call hexbyte 2487 <1> mov dx, msg.bootfail_read 2488 <1> 2489 <1> .fail: 2490 <1> push dx 2491 <1> mov dx, msg.bootfail 2492 <1> call disp_msg_asciz 2493 <1> pop dx 2494 <1> call disp_msg_asciz 2495 <1> jmp cmd3 2496 <1> 2497 <1> %define _SCANPTAB_PREFIX 2498 <1> %define _SCANPTAB_DEBUG4_PREFIX init1_ 2499 <1> %include "scanptab.asm" 2500 <1> 2501 <1> 2502 <1> query_geometry: 2503 <1> mov dl, [load_unit] 2504 <1> ; test dl, dl ; floppy? 2505 <1> ; jns @F ; don't attempt query, might fail --> 2506 <1> ; Note that while the original PC BIOS doesn't support this function 2507 <1> ; (for its diskettes), it does properly return the error code 01h. 2508 <1> ; https://sites.google.com/site/pcdosretro/ibmpcbios (IBM PC version 1) 2509 <1> mov ah, 08h 2510 <1> xor cx, cx ; initialise cl to 0 2511 <1> mov [load_heads], cx 2512 <1> mov [load_sectors], cx 2513 <1> stc ; initialise to CY 2514 <1> call .int13_retry ; query drive geometry 2515 <1> jc .try_bootsector ; apparently failed --> 2516 <1> mov dl, dh 2517 <1> mov dh, 0 ; dx = maximum head number 2518 <1> inc dx ; dx = number of heads (H is 0-based) 2519 <1> mov ax, cx ; ax & 3Fh = maximum sector number 2520 <1> and ax, 3Fh ; get sectors (number of sectors, S is 1-based) 2521 <1> jnz .got_sectors_heads ; valid (S is 1-based), use these --> 2522 <1> ; zero = invalid 2523 <1> .try_bootsector: 2524 <1> mov es, word [bp + ldSectorSeg] 2525 <1> xor bx, bx 2526 <1> mov ax, 0201h ; read sector, 1 sector 2527 <1> mov cx, 1 ; sector 1 (1-based!), cylinder 0 (0-based) 2528 <1> mov dh, 0 ; head 0 (0-based) 2529 <1> mov dl, [load_unit] 2530 <1> stc 2531 <1> call .int13_retry 2532 <1> jc .access_error 2533 <1> 2534 <1> ; note: the smallest supported sector size, 32 bytes, 2535 <1> ; does contain these entries (offset 18h and 1Ah in sector) 2536 <1> ; within the first BPB sector. 2537 <1> mov ax, word [es:bx + bsBPB + bpbCHSSectors] 2538 <1> mov dx, word [es:bx + bsBPB + bpbCHSHeads] 2539 <1> 2540 <1> .got_sectors_heads: 2541 <1> mov word [load_sectors], ax 2542 <1> mov word [load_heads], dx 2543 <1> 2544 <1> test ax, ax 2545 <1> jz .invalid_sectors 2546 <1> cmp ax, 63 2547 <1> ja .invalid_sectors 2548 <1> test dx, dx 2549 <1> jz .invalid_heads 2550 <1> cmp dx, 100h 2551 <1> ja .invalid_heads 2552 <1> 2553 <1> mov bx, 10h 2554 <1> mov di, bx 2555 <1> mov cx, (8192 + 2) >> 1 2556 <1> mov ax, word [bp + ldSectorSeg] 2557 <1> dec ax 2558 <1> mov es, ax ; es:bx -> buffer, es:di = same 2559 <1> xor ax, ax 2560 <1> rep stosw ; fill buffer, di -> behind (0:7C00h+8192+2) 2561 <1> mov ax, 0201h ; read sector, 1 sector 2562 <1> inc cx ; sector 1 (1-based!), cylinder 0 (0-based) 2563 <1> mov dh, 0 ; head 0 (0-based) 2564 <1> mov dl, [load_unit] 2565 <1> stc 2566 <1> call .int13_retry 2567 <1> jc .access_error 2568 <1> 2569 <1> std ; _AMD_ERRATUM_109_WORKAROUND does not apply 2570 <1> mov word [es:bx - 2], 5E5Eh 2571 <1> scasw ; -> 0:7C00h+8192 (at last word to sca) 2572 <1> mov cx, (8192 + 2) >> 1 2573 <1> xor ax, ax 2574 <1> repe scasw 2575 <1> add di, 4 ; di -> first differing byte (from top) 2576 <1> cld 2577 <1> push di 2578 <1> 2579 <1> mov di, bx 2580 <1> mov cx, (8192 + 2) >> 1 2581 <1> dec ax ; = FFFFh 2582 <1> rep stosw 2583 <1> 2584 <1> mov ax, 0201h 2585 <1> inc cx 2586 <1> mov dh, 0 2587 <1> mov dl, [load_unit] 2588 <1> stc 2589 <1> call .int13_retry 2590 <1> jc .access_error 2591 <1> 2592 <1> std ; _AMD_ERRATUM_109_WORKAROUND does not apply 2593 <1> scasw ; di -> 0:7C00h+8192 (last word to sca) 2594 <1> pop dx 2595 <1> mov ax, -1 2596 <1> mov cx, (8192 + 2) >> 1 2597 <1> repe scasw 2598 <1> %if 0 2599 <1> AAAB 2600 <1> ^ 2601 <1> sca B, match 2602 <1> ^ 2603 <1> sca B, mismatch 2604 <1> ^ 2605 <1> stop 2606 <1> %endif 2607 <1> add di, 4 ; di -> first differing byte (from top) 2608 <1> cld 2609 <1> 2610 <1> %if 0 2611 <1> 0000000000000 2612 <1> AAAAAAAA00000 2613 <1> ^ 2614 <1> FFFFFFFFFFFFF 2615 <1> AAAAAAAA00FFF 2616 <1> ^ 2617 <1> %endif 2618 <1> cmp dx, di ; choose the higher one 2619 <1> jae @F 2620 <1> mov dx, di 2621 <1> @@: 2622 <1> sub dx, bx ; dx = sector size 2623 <1> 2624 <1> cmp dx, 8192 + 2 2625 <1> jae .sector_too_large 2626 <1> mov ax, 32 2627 <1> cmp dx, ax 2628 <1> jb .sector_too_small 2629 <1> @@: 2630 <1> cmp dx, ax 2631 <1> je .got_match 2632 <1> cmp ax, 8192 2633 <1> jae .sector_not_power 2634 <1> shl ax, 1 2635 <1> jmp @B 2636 <1> 2637 <1> .got_match: 2638 <1> mov word [load_sectorsize], ax 2639 <1> mov cl, 4 2640 <1> shr ax, cl 2641 <1> mov word [load_sectorsizepara], ax 2642 <1> 2643 <1> mov byte [load_lba], 0 2644 <1> mov ah, 41h 2645 <1> mov dl, [load_unit] 2646 <1> mov bx, 55AAh 2647 <1> stc 2648 <1> int 13h ; 13.41.bx=55AA extensions installation check 2649 <1> jc .no_lba 2650 <1> cmp bx, 0AA55h 2651 <1> jne .no_lba 2652 <1> test cl, 1 ; support bitmap bit 0 2653 <1> jz .no_lba 2654 <1> 2655 <1> inc byte [load_lba] 2656 <1> .no_lba: 2657 <1> retn 2658 <1> 2659 <1> 2660 <1> .int13_retry: 2661 <1> pushf 2662 <1> push ax 2663 <1> int 13h ; first try 2664 <1> jnc @F ; NC, success on first attempt --> 2665 <1> 2666 <1> ; reset drive 2667 <1> xor ax, ax 2668 <1> int 13h 2669 <1> jc @F ; CY, reset failed, error in ah --> 2670 <1> 2671 <1> ; try read again 2672 <1> pop ax ; restore function number 2673 <1> popf 2674 <1> int 13h ; retry, CF error status, ah error number 2675 <1> retn 2676 <1> 2677 <1> @@: ; NC or CY, stack has function number 2678 <1> inc sp 2679 <1> inc sp 2680 <1> inc sp 2681 <1> inc sp ; discard two words on stack, preserve CF 2682 <1> retn 2683 <1> 2684 <1> 2685 <1> .access_error: 2686 <1> mov dx, msg.boot_access_error 2687 <1> jmp .error_common_j 2688 <1> .sector_too_large: 2689 <1> mov dx, msg.boot_sector_too_large 2690 <1> jmp .error_common_j 2691 <1> .sector_too_small: 2692 <1> mov dx, msg.boot_sector_too_small 2693 <1> jmp .error_common_j 2694 <1> .sector_not_power: 2695 <1> mov dx, msg.boot_sector_not_power 2696 <1> jmp .error_common_j 2697 <1> .invalid_sectors: 2698 <1> mov dx, msg.boot_invalid_sectors 2699 <1> jmp .error_common_j 2700 <1> .invalid_heads: 2701 <1> mov dx, msg.boot_invalid_heads 2702 <1> .error_common_j: 2703 <1> jmp .error_common 2704 <1> 2705 <1> .error_common: equ bootcmd.fail 2706 <1> 2707 <1> 2708 <1> ; INP: dx:ax = first sector 2709 <1> ; bx:0 -> buffer 2710 <1> ; OUT: dx:ax = sector number after last read 2711 <1> ; es = input bx 2712 <1> ; bx:0 -> buffer after last written 2713 <1> ; CHG: - 2714 <1> ; STT: ds = ss 2715 <1> read_ae_1536_bytes: 2716 <1> push cx 2717 <1> push bx 2718 <1> mov cx, 1536 2719 <1> .loop: 2720 <1> call read_sector 2721 <1> sub cx, word [bp + bsBPB + bpbBytesPerSector] 2722 <1> ja .loop 2723 <1> pop es 2724 <1> pop cx 2725 <1> retn 2726 <1> 2727 <1> ; INP: dx:ax = first sector 2728 <1> ; bx:0 -> buffer 2729 <1> ; OUT: dx:ax = sector number after last read 2730 <1> ; es = input bx 2731 <1> ; bx:0 -> buffer after last written 2732 <1> ; CHG: - 2733 <1> ; STT: ds = ss 2734 <1> read_ae_512_bytes: 2735 <1> push cx 2736 <1> push bx 2737 <1> mov cx, 512 2738 <1> .loop: 2739 <1> call read_sector 2740 <1> sub cx, word [bp + bsBPB + bpbBytesPerSector] 2741 <1> ja .loop 2742 <1> pop es 2743 <1> pop cx 2744 <1> retn 2745 <1> 2746 <1> 2747 <1> ; Read a sector using Int13.02 or Int13.42 2748 <1> ; 2749 <1> ; INP: dx:ax = sector number (absolute in unit) 2750 <1> ; bx:0-> buffer 2751 <1> ; OUT: If unable to read, 2752 <1> ; ! jumps to error instead of returning 2753 <1> ; If sector has been read, 2754 <1> ; dx:ax = next sector number (has been incremented) 2755 <1> ; bx:0-> next buffer (bx = es+word[load_sectorsizepara]) 2756 <1> ; es = input bx 2757 <1> ; CHG: - 2758 <1> ; 2759 <1> ; Note: If error 09h (data boundary error) is returned, 2760 <1> ; the read is done into the load_sectorseg buffer, 2761 <1> ; then copied into the user buffer. 2762 <1> read_sector: 2763 <1> .err: equ bootcmd.fail_read 2764 <1> d5 call init1_d5dumpregs 2765 <1> d5 call init1_d5message 2766 <1> d5 asciz 13,10,"In read_sector",13,10 2767 <1> 2768 <1> push ds 2769 <1> push ss 2770 <1> pop ds 2771 <1> push dx 2772 <1> push cx 2773 <1> push ax 2774 <1> push si 2775 <1> 2776 <1> push bx 2777 <1> 2778 <1> ; DX:AX==LBA sector number 2779 <1> ; add partition start (= number of hidden sectors) 2780 <1> add ax,[bp + bsBPB + bpbHiddenSectors + 0] 2781 <1> adc dx,[bp + bsBPB + bpbHiddenSectors + 2] 2782 <1> 2783 <1> xor cx, cx 2784 <1> push cx 2785 <1> push cx 2786 <1> push dx 2787 <1> push ax ; qword sector number (lpSector) 2788 <1> push bx 2789 <1> push cx ; bx:0 -> buffer (lpBuffer) 2790 <1> inc cx 2791 <1> push cx ; word number of sectors to read (lpCount) 2792 <1> mov cl, 10h 2793 <1> push cx ; word size of disk address packet (lpSize) 2794 <1> mov si, sp ; ds:si -> disk address packet (on stack) 2795 <1> 2796 <1> test byte [bp + ldHasLBA], 1 2797 <1> jz .no_lba 2798 <1> 2799 <1> d5 call init1_d5message 2800 <1> d5 asciz "In read_sector.lba",13,10 2801 <1> 2802 <1> mov dl, byte [load_unit] 2803 <1> mov ah, 42h 2804 <1> int 13h ; 13.42 extensions read 2805 <1> jnc .lba_done 2806 <1> 2807 <1> xor ax, ax 2808 <1> int 13h 2809 <1> jc .lba_error 2810 <1> 2811 <1> ; have to reset the LBAPACKET's lpCount, as the handler may 2812 <1> ; set it to "the number of blocks successfully transferred". 2813 <1> ; (in any case, the high byte is still zero.) 2814 <1> mov byte [si + lpCount], 1 2815 <1> 2816 <1> mov ah, 42h 2817 <1> int 13h 2818 <1> jnc .lba_done 2819 <1> 2820 <1> cmp ah, 9 ; data boundary error? 2821 <1> jne .lba_error 2822 <1> 2823 <1> d4 call init1_d4dumpregs 2824 <1> d4 call init1_d4message 2825 <1> d4 asciz 13,10,"In read_sector.lba_sectorseg",13,10 2826 <1> 2827 <1> ; the offset part of the pointer is already zero! 2828 <1> ; push word [si + lpBuffer + 0] 2829 <1> push word [si + lpBuffer + 2] ; user buffer 2830 <1> push word [load_sectorseg] 2831 <1> pop word [si + lpBuffer + 2] 2832 <1> ; and word [si + lpBuffer + 0], byte 0 2833 <1> 2834 <1> mov byte [si + lpCount], 1 2835 <1> mov ah, 42h 2836 <1> int 13h 2837 <1> jnc .lba_sectorseg_done 2838 <1> 2839 <1> xor ax, ax 2840 <1> int 13h 2841 <1> jc .lba_error 2842 <1> 2843 <1> mov byte [si + lpCount], 1 2844 <1> mov ah, 42h 2845 <1> int 13h 2846 <1> jc .lba_error 2847 <1> .lba_sectorseg_done: 2848 <1> 2849 <1> xor si, si 2850 <1> mov ds, word [load_sectorseg] 2851 <1> pop es 2852 <1> ; pop cx 2853 <1> push di 2854 <1> ; mov di, cx 2855 <1> xor di, di 2856 <1> mov cx, word [load_sectorsize] 2857 <1> rep movsb 2858 <1> pop di 2859 <1> 2860 <1> push ss 2861 <1> pop ds 2862 <1> .lba_done: 2863 <1> add sp, 10h 2864 <1> pop bx 2865 <1> jmp .chs_done 2866 <1> 2867 <1> .lba_error: equ .err 2868 <1> 2869 <1> .no_lba: 2870 <1> add sp, 8 2871 <1> pop ax 2872 <1> pop dx 2873 <1> pop cx 2874 <1> pop cx 2875 <1> 2876 <1> ; DX:AX=LBA sector number 2877 <1> ; divide by number of sectors per track to get sector number 2878 <1> ; Use 32:16 DIV instead of 64:32 DIV for 8088 compatability 2879 <1> ; Use two-step 32:16 divide to avoid overflow 2880 <1> mov cx,ax 2881 <1> mov ax,dx 2882 <1> xor dx,dx 2883 <1> div word [load_sectors] 2884 <1> xchg cx,ax 2885 <1> div word [load_sectors] 2886 <1> xchg cx,dx 2887 <1> 2888 <1> ; DX:AX=quotient, CX=remainder=sector (S) - 1 2889 <1> ; divide quotient by number of heads 2890 <1> mov bx, ax 2891 <1> xchg ax, dx 2892 <1> xor dx, dx 2893 <1> div word [load_heads] 2894 <1> xchg bx, ax 2895 <1> div word [load_heads] 2896 <1> 2897 <1> ; bx:ax=quotient=cylinder (C), dx=remainder=head (H) 2898 <1> ; move variables into registers for INT 13h AH=02h 2899 <1> mov dh, dl ; dh = head 2900 <1> inc cx ; cl5:0 = sector 2901 <1> xchg ch, al ; ch = cylinder 7:0, al = 0 2902 <1> shr ax, 1 2903 <1> shr ax, 1 ; al7:6 = cylinder 9:8 2904 <1> ; bx has bits set iff it's > 0, indicating a cylinder >= 65536. 2905 <1> or bl, bh ; collect set bits from bh 2906 <1> or cl, al ; cl7:6 = cylinder 9:8 2907 <1> ; ah has bits set iff it was >= 4, indicating a cylinder >= 1024. 2908 <1> or bl, ah ; collect set bits from ah 2909 <1> mov dl, [load_unit] 2910 <1> ; dl = drive 2911 <1> mov ah, 04h ; error number: sector not found 2912 <1> jnz .err ; error if cylinder >= 1024 --> 2913 <1> ; ! bx = 0 (for 13.02 call) 2914 <1> 2915 <1> ; we call INT 13h AH=02h once for each sector. Multi-sector reads 2916 <1> ; may fail if we cross a track or 64K boundary 2917 <1> pop es 2918 <1> 2919 <1> mov ax, 0201h 2920 <1> int 13h ; read one sector 2921 <1> jnc .done 2922 <1> ; reset drive 2923 <1> xor ax, ax 2924 <1> int 13h 2925 <1> jc .err 2926 <1> 2927 <1> ; try read again 2928 <1> mov ax, 0201h 2929 <1> int 13h 2930 <1> jnc .done 2931 <1> cmp ah, 9 ; data boundary error? 2932 <1> jne .err 2933 <1> 2934 <1> d4 call init1_d4dumpregs 2935 <1> d4 call init1_d4message 2936 <1> d4 asciz 13,10,"In read_sector.chs_sectorseg",13,10 2937 <1> 2938 <1> push es ; user buffer 2939 <1> mov es, word [load_sectorseg] 2940 <1> 2941 <1> mov ax, 0201h 2942 <1> int 13h 2943 <1> jnc .chs_sectorseg_done 2944 <1> 2945 <1> xor ax, ax 2946 <1> int 13h 2947 <1> jc .err 2948 <1> 2949 <1> mov ax, 0201h 2950 <1> int 13h 2951 <1> jc .err 2952 <1> .chs_sectorseg_done: 2953 <1> 2954 <1> xor si, si 2955 <1> mov ds, word [load_sectorseg] 2956 <1> pop es 2957 <1> push di 2958 <1> xor di, di 2959 <1> mov cx, word [load_sectorsize] 2960 <1> rep movsb 2961 <1> pop di 2962 <1> 2963 <1> push ss 2964 <1> pop ds 2965 <1> .done: 2966 <1> ; increment segment 2967 <1> mov bx, es 2968 <1> 2969 <1> .chs_done: 2970 <1> mov es, bx 2971 <1> add bx, word [load_sectorsizepara] 2972 <1> 2973 <1> pop si 2974 <1> pop ax 2975 <1> pop cx 2976 <1> pop dx 2977 <1> pop ds 2978 <1> ; increment LBA sector number 2979 <1> inc ax 2980 <1> jne @F 2981 <1> inc dx 2982 <1> @@: 2983 <1> retn 2984 <1> %endif 2985 <1> 2986 <1> 2987 <1> ; INP: ax => MCB to initialise 2988 <1> ; cx = owner to set (8 if S MCB) 2989 <1> ; bx = size to set 2990 <1> ; dl = MCB signature, "M" or "Z" 2991 <1> ; dh = S MCB type 2992 <1> ; OUT: - 2993 <1> ; CHG: - 2994 <1> ; init1_insure_low_byte_not_0CCh 2995 <1> init2_init_an_mcb: 2996 <1> assume ds:nothing, es:nothing, ss:nothing 0 000060FD 50 push ax 0 000060FE 1E push ds 0 000060FF 06 push es 0 00006100 57 push di 0 00006101 8ED8 mov ds, ax 3002 <1> assume ds:MCB 0 00006103 8EC0 mov es, ax 3004 <1> assume es:MCB 0 00006105 31FF xor di, di 0 00006107 31C0 xor ax, ax 0 00006109 51 push cx 0 0000610A B90800 mov cx, MCB_size >> 1 0 0000610D F3AB rep stosw 0 0000610F 59 pop cx 0 00006110 894DF1 mov word [di - MCB_size + mcbOwner], cx 0 00006113 895DF3 mov word [di - MCB_size + mcbSize], bx 0 00006116 8855F0 mov byte [di - MCB_size + mcbSignature], dl 0 00006119 83F908 cmp cx, 8 0 0000611C 7507 jne @F 0 0000611E C645F853 mov byte [di - MCB_size + smcbName], "S" 0 00006122 8875FA mov byte [di - MCB_size + smcbType], dh 3018 <1> @@: 0 00006125 5F pop di 0 00006126 07 pop es 3021 <1> assume es:nothing 0 00006127 1F pop ds 3023 <1> assume ds:nothing 0 00006128 58 pop ax 0 00006129 C3 retn 3026 <1> 3027 <1> 3028 <1> %if 0 ; lMS-DOS 3029 <1> disp_dxax_hex: ; dx:ax 3030 <1> xchg ax, dx 3031 <1> call disp_ax_hex 3032 <1> xchg ax, dx 3033 <1> init1_disp_ax_hex: 3034 <1> disp_ax_hex: ; ax 3035 <1> xchg al,ah 3036 <1> call disp_al_hex ; display former ah 3037 <1> xchg al,ah ; and fall trough for al 3038 <1> disp_al_hex: ; al 3039 <1> push cx 3040 <1> mov cl,4 3041 <1> ror al,cl 3042 <1> call disp_al_lownibble_hex ; display former high-nibble 3043 <1> rol al,cl 3044 <1> pop cx 3045 <1> ; and fall trough for low-nibble 3046 <1> disp_al_lownibble_hex: 3047 <1> push ax ; save ax for call return 3048 <1> and al,00001111b ; high nibble must be zero 3049 <1> add al,'0' ; if number is 0-9, now it's the correct character 3050 <1> cmp al,'9' 3051 <1> jna .decimalnum ; if we get decimal number with this, ok --> 3052 <1> add al,7 ; otherwise, add 7 and we are inside our alphabet 3053 <1> .decimalnum: 3054 <1> call disp_al 3055 <1> pop ax 3056 <1> retn 3057 <1> 3058 <1> 3059 <1> ; INP: ds:si -> first byte to check for name 3060 <1> ; cx = number of bytes left 3061 <1> ; OUT: (8+1+3+1)bytes[es:msg.foundname] = found name, 3062 <1> ; converted to 8.3 ASCIZ format, 3063 <1> ; "(None)" if none 3064 <1> ; CY if no filename found, 3065 <1> ; si = INP:si + INP:cx 3066 <1> ; cx = 0 3067 <1> ; NC if filename found, 3068 <1> ; ds:si -> byte behind the name, thus ds:(si-11)-> name 3069 <1> ; cx = number of bytes left 3070 <1> ; CHG: di, ax 3071 <1> findname: 3072 <1> .: 3073 <1> cmp cx, 11 ; enough for another name ? 3074 <1> jb .none ; no --> 3075 <1> ; (cx == 0 jumps here too) 3076 <1> .check: 3077 <1> push cx 3078 <1> push si 3079 <1> mov cx, 11 3080 <1> lodsb 3081 <1> mov ah, al ; check for same char in all 11 places 3082 <1> cmp al, 32 ; first character must not be blank 3083 <1> je .check_fail ; if it is --> 3084 <1> ; cmp al, 5 ; first character may be 05h to indicate 0E5h 3085 <1> ; je .check_pass 3086 <1> db __TEST_IMM8 ; (skip lodsb) 3087 <1> .check_loop_same: 3088 <1> lodsb 3089 <1> cmp ah, al 3090 <1> jne .check_loop_differs 3091 <1> call .check_character 3092 <1> jc .check_fail 3093 <1> loop .check_loop_same 3094 <1> ; if we arrive here, all characters (while valid) are the 3095 <1> ; same character repeated 11 times. we disallow this in case 3096 <1> ; that the padding character is an allowed one (eg '&' 26h). 3097 <1> .check_fail: 3098 <1> pop si 3099 <1> pop cx 3100 <1> dec cx ; lessen the counter 3101 <1> inc si ; -> next position to check 3102 <1> jmp . 3103 <1> 3104 <1> .check_character: 3105 <1> cmp al, 32 3106 <1> jb .check_character_fail 3107 <1> cmp al, 127 3108 <1> ; je .check_character_fail 3109 <1> jae .check_character_fail 3110 <1> ; note: with all characters >= 128 allowed, 3111 <1> ; we get false positives in our sectors. 3112 <1> cmp al, '.' 3113 <1> je .check_character_fail 3114 <1> cmp al, '/' 3115 <1> je .check_character_fail 3116 <1> cmp al, '\' 3117 <1> je .check_character_fail 3118 <1> cmp al, 'a' 3119 <1> jb .check_character_pass 3120 <1> cmp al, 'z' 3121 <1> ja .check_character_pass 3122 <1> .check_character_fail: 3123 <1> stc 3124 <1> retn 3125 <1> 3126 <1> .check_character_pass: 3127 <1> clc 3128 <1> retn 3129 <1> 3130 <1> .check_loop: 3131 <1> lodsb 3132 <1> .check_loop_differs: 3133 <1> call .check_character 3134 <1> jc .check_fail 3135 <1> .check_pass: 3136 <1> loop .check_loop 3137 <1> 3138 <1> pop ax ; (discard si) 3139 <1> sub si, 11 ; -> at name 3140 <1> 3141 <1> call convert_name_to_asciz 3142 <1> ; si -> behind name 3143 <1> pop cx 3144 <1> sub cx, 11 ; lessen the counter 3145 <1> clc 3146 <1> retn 3147 <1> 3148 <1> .none: 3149 <1> add si, cx 3150 <1> mov di, msg.foundname 3151 <1> push si 3152 <1> push ds 3153 <1> push cs 3154 <1> pop ds 3155 <1> mov si, msg.foundname_none 3156 <1> mov cx, (msg.foundname_none_size + 1) >> 1 3157 <1> rep movsw 3158 <1> pop ds 3159 <1> pop si 3160 <1> xor cx, cx 3161 <1> stc 3162 <1> retn 3163 <1> 3164 <1> 3165 <1> ; INP: ds:si -> 11-byte blank-padded name 3166 <1> ; es:msg.foundname -> (8+1+3+1)-byte buffer 3167 <1> ; OUT: ds:si -> behind 11-byte blank-padded name 3168 <1> ; es:msg.foundname filled 3169 <1> ; CHG: cx, di, ax 3170 <1> convert_name_to_asciz: 3171 <1> mov di, msg.foundname 3172 <1> mov cx, 8 3173 <1> rep movsb ; copy over base name, si -> extension 3174 <1> cmp byte [es:di - 8], 05h ; is it 05h ? 3175 <1> jne @F ; no --> 3176 <1> mov byte [es:di - 8], 0E5h ; yes, convert to 0E5h 3177 <1> @@: 3178 <1> 3179 <1> db __TEST_IMM8 ; (skip dec) 3180 <1> @@: 3181 <1> dec di ; decrement -> at previous trailing blank 3182 <1> cmp byte [es:di - 1], 32 ; trailing blank ? 3183 <1> je @B ; yes --> 3184 <1> 3185 <1> mov al, '.' 3186 <1> stosb ; store dot (if needed) 3187 <1> mov cl, 3 3188 <1> rep movsb ; copy over extension, si -> behind name 3189 <1> 3190 <1> db __TEST_IMM8 ; (skip dec) 3191 <1> @@: 3192 <1> dec di ; decrement -> at previous trailing blank 3193 <1> cmp byte [es:di - 1], 32 ; trailing blank ? 3194 <1> je @B ; yes --> 3195 <1> 3196 <1> cmp byte [es:di - 1], '.' ; trailing dot ? (only occurs if all-blank ext) 3197 <1> jne @F ; no --> 3198 <1> dec di ; -> at the dot 3199 <1> @@: 3200 <1> mov al, 0 3201 <1> stosb ; store filename terminator 3202 <1> retn 3203 <1> 3204 <1> 3205 <1> %if _DEBUG5 || _DEBUG4 3206 <1> init1_d5dumpregs: 3207 <1> init1_d4dumpregs: 3208 <1> pushf 3209 <1> push ax 3210 <1> push bx 3211 <1> push cx 3212 <1> push dx 3213 <1> push si 3214 <1> push di 3215 <1> push bp 3216 <1> mov ax, sp 3217 <1> add ax, byte 18 3218 <1> push ax 3219 <1> push cs 3220 <1> push ss 3221 <1> push ds 3222 <1> push es 3223 <1> 3224 <1> mov bx, sp 3225 <1> mov ax, 1<<8|7 3226 <1> push ax 3227 <1> mov ax, 14 3228 <1> push cs 3229 <1> pop ds 3230 <1> mov dx, .regnames 3231 <1> 3232 <1> mov bp, sp 3233 <1> %assign _columns 0 3234 <1> %assign _blanks 1 3235 <1> 3236 <1> xor cx, cx 3237 <1> 3238 <1> .looprows: 3239 <1> push ax 3240 <1> mov al, 13 3241 <1> call init1_disp_al 3242 <1> mov al, 10 3243 <1> call init1_disp_al 3244 <1> %if 0 3245 <1> push cx 3246 <1> push dx 3247 <1> xor cx, cx 3248 <1> mov cl, byte [ _blanks + bp ] 3249 <1> jcxz .doneblanks 3250 <1> mov al, 32 3251 <1> .loopblanks: 3252 <1> call init1_disp_al 3253 <1> loop .loopblanks 3254 <1> .doneblanks: 3255 <1> pop dx 3256 <1> pop cx 3257 <1> %endif 3258 <1> pop ax 3259 <1> 3260 <1> mov cl, byte [ _columns + bp ] 3261 <1> .loopcolumns: 3262 <1> call init1_disp_reg 3263 <1> add dx, byte 2 3264 <1> add bx, byte 2 3265 <1> dec ax 3266 <1> jz .done 3267 <1> loop .loopcolumns 3268 <1> jmp short .looprows 3269 <1> 3270 <1> .done: 3271 <1> pop ax 3272 <1> 3273 <1> pop es 3274 <1> pop ds 3275 <1> pop ax 3276 <1> pop ax 3277 <1> pop ax 3278 <1> pop bp 3279 <1> pop di 3280 <1> pop si 3281 <1> pop dx 3282 <1> pop cx 3283 <1> pop bx 3284 <1> pop ax 3285 <1> popf 3286 <1> retn 3287 <1> 3288 <1> .regnames: 3289 <1> db "esdssscsspbpdisidxcxbxaxflip" 3290 <1> 3291 <1> 3292 <1> ; ss:bx-> word value 3293 <1> ; ds:dx-> 2-byte message 3294 <1> init1_disp_reg: 3295 <1> push ax 3296 <1> xchg bx, dx 3297 <1> mov ax, [ bx ] ; get 2 bytes at [ ds:dx ] 3298 <1> xchg bx, dx 3299 <1> call init1_disp_al 3300 <1> xchg al, ah 3301 <1> call init1_disp_al 3302 <1> 3303 <1> mov al, '=' 3304 <1> call init1_disp_al 3305 <1> 3306 <1> mov ax, [ ss:bx ] 3307 <1> call disp_ax_hex 3308 <1> 3309 <1> mov al, 32 3310 <1> call init1_disp_al 3311 <1> pop ax 3312 <1> retn 3313 <1> 3314 <1> init1_disp_stack_hex: 3315 <1> push ax 3316 <1> push bp 3317 <1> mov bp, sp 3318 <1> mov ax, [bp+6] 3319 <1> pop bp 3320 <1> call init1_disp_ax_hex 3321 <1> pop ax 3322 <1> retn 2 3323 <1> 3324 <1> init1_d5message: 3325 <1> init1_d4message: 3326 <1> push ax 3327 <1> push bx 3328 <1> push si 3329 <1> push ds 3330 <1> push bp 3331 <1> mov bp, sp 3332 <1> mov si, [bp+10] 3333 <1> pushf 3334 <1> push cs 3335 <1> pop ds 3336 <1> call init1_disp_msg 3337 <1> popf 3338 <1> mov word [bp+10], si 3339 <1> pop bp 3340 <1> pop ds 3341 <1> pop si 3342 <1> pop bx 3343 <1> pop ax 3344 <1> retn 3345 <1> 3346 <1> init1_d4uppercase: 3347 <1> pushf 3348 <1> cmp al, 'a' 3349 <1> jb .return 3350 <1> cmp al, 'z' 3351 <1> ja .return 3352 <1> and al, ~ 20h 3353 <1> .return: 3354 <1> popf 3355 <1> retn 3356 <1> %endif 3357 <1> 3358 <1> 3359 <1> %if _TEST_PAYLOAD 3360 <1> align 4 3361 <1> table: 3362 <1> dw +0, "SS" 3363 <1> dw +12, "BP" 3364 <1> dw +10, "SP" 3365 <1> dw +6, "CS" 3366 <1> dw +8, "IP" 3367 <1> dw +26, "FL" 3368 <1> db -1, -1, 13,10 3369 <1> dw +4, "DS" 3370 <1> dw +16, "SI" 3371 <1> dw +2, "ES" 3372 <1> dw +14, "DI" 3373 <1> db -1, -1, 13,10 3374 <1> dw +24, "AX" 3375 <1> dw +22, "BX" 3376 <1> dw +20, "CX" 3377 <1> dw +18, "DX" 3378 <1> db -1, -1, 13,10 3379 <1> dw +28, "S0" 3380 <1> dw +30, "S1" 3381 <1> dw +32, "S2" 3382 <1> dw +34, "S3" 3383 <1> dw +36, "S4" 3384 <1> dw +38, "S5" 3385 <1> dw +40, "S6" 3386 <1> dw +42, "S7" 3387 <1> db -1, -1, 13,10 3388 <1> dw +44, "S8" 3389 <1> dw +46, "S9" 3390 <1> dw +48, "SA" 3391 <1> dw +50, "SB" 3392 <1> dw +52, "SC" 3393 <1> dw +54, "SD" 3394 <1> dw +56, "SE" 3395 <1> dw +58, "SF" 3396 <1> db -1, -1, 13,10 3397 <1> .end: 3398 <1> %endif 3399 <1> 3400 <1> 3401 <1> align 4 3402 <1> mcbtable: 3403 <1> times 6 dd -1 3404 <1> ; MCB after INIT3 3405 <1> ; S_INITSTACKBPB 3406 <1> ; S_INITFATSEG 3407 <1> ; S_SECTORSEG 3408 <1> ; ldMemoryTop (in front of RPL, or last) 3409 <1> ; int 12h memory top (if RPL exists) 3410 <1> dd -1 3411 <1> 3412 <1> boot_partition: 3413 <1> dd 0 3414 <1> boot_unit: 3415 <1> db 0 3416 <1> boot_drive: 3417 <1> db 0 3418 <1> 3419 <1> 3420 <1> align 4 3421 <1> throw_sp: dw 0 3422 <1> throw_ip: dw 0 3423 <1> 3424 <1> fsparm_pointer: dw fsparm 3425 <1> fsparm_excess: dw 0 3426 <1> fsparm_number: db 0 3427 <1> 3428 <1> align 16 3429 <1> partition_table: 3430 <1> times 4 * 16 db 0 3431 <1> .end: 3432 <1> 3433 <1> align 16 3434 <1> fsparm: 3435 <1> times FSPARM_size * 32 db 0 3436 <1> 3437 <1> 3438 <1> align 16 3439 <1> init1_end: 3440 <1> 3441 <1> %if INIT1_INSURE_COUNT 3442 <1> %warning init1_insure_low_byte_not_0CCh needed INIT1_INSURE_COUNT times 3443 <1> %endif 3444 <1> 3445 <1> istruc MCB 3446 <1> at mcbSignature, db "M" 3447 <1> at mcbOwner, dw 8 3448 <1> at mcbSize, dw (init2_end - init2_start) >> 4 3449 <1> at smcbName, dw "S" 3450 <1> at smcbType, db S_INIT 3451 <1> iend 3452 <1> 3453 <1> ; section INIT2 align=16 follows=INIT1 vstart=0 3454 <1> init2_start: 3455 <1> jmp near RxDOS_initialize 3456 <1> 3457 <1> align 2 3458 <1> init2_to_init1_segment: dw 0 3459 <1> 3460 <1> %endif 3461 <1> 3462 <1> 3463 <1> %if 1 || (_RELOCATEDOSCODE && _DOSCODEHMA) 0 0000612A 90 align 4 0 0000612C 00000000 init2_xmsentry: dd 0 3466 <1> %endif 3467 <1> 3468 <1> 3469 <1> align 16 3470 <1> init2_hma_vdisk_header: 3471 <1> istruc BS 0 00006130 000000 at bsJump, db 0,0,0 0 00006133 564449534B332E33 at bsOEM, db "VDISK3.3" 3474 <1> at bsBPB 3475 <1> iend 3476 <1> istruc EBPB 0 0000613B 80 at bpbBytesPerSector, db 80h ; (128) 0 0000613C 0001 at bpbSectorsPerCluster,db 1 0 0000613E 0100 at bpbReservedSectors, dw 1 0 00006140 01 at bpbNumFATs, db 1 0 00006141 4000 at bpbNumRootDirEnts, dw 40h ; (64) 0 00006143 0002 at bpbTotalSectors, dw 200h ; (512) ; 512 sectors * 128 B/sector = 64 KiB 0 00006145 FE at bpbMediaID, db 0FEh 0 00006146 0600 at bpbSectorsPerFAT, dw 6 0 00006148 0800 at bpbCHSSectors, dw 8 0 0000614A 0100 at bpbCHSHeads, dw 1 0 0000614C 0000 at bpbHiddenSectors, dw 0 3488 <1> %pop ; iend 0 0000614E 4004 dw 0440h ; (1088) 3490 <1> ; VCPI.txt: size word in boot block, "KB addr" 3491 <1> endarea init2_hma_vdisk_header 3492 <1> 3493 <1> 3494 <1> %if 0 3495 <1> ; INP: word [cs:ip] = near function to call in other segment 3496 <1> ; cs:(ip + 2) -> where to return to 3497 <1> ; word [DOSDATA:dosdata_to_doscode_segment] = DOSCODE 3498 <1> ; word [70h:dosentry_to_dosdata_segment] = DOSDATA 3499 <1> ; DOSCODE:doscode_retf -> retf opcode 3500 <1> ; INIT1 3501 <1> init2_to_doscode: 3502 <1> push ax ; word space for ?returnaddress_ip, is ax 3503 <1> push bx ; word space for ?returnaddress_other_ip, is bx 3504 <1> push ds 3505 <1> mov ax, 70h 3506 <1> mov ds, ax ; => DOSENTRY 3507 <1> mov ds, word [dosentry_to_dosdata_segment] ; => DOSDATA 3508 <1> mov ax, word [dosdata_to_doscode_segment] ; => DOSCODE 3509 <1> pop ds 3510 <1> mov bx, doscode_retf ; other:bx -> retf opcode 3511 <1> jmp init2_to_other_segment_common 3512 <1> 3513 <1> init2_to_init1: 3514 <1> push ax ; word space for ?returnaddress_ip 3515 <1> push bx ; word space for ?returnaddress_other_ip 3516 <1> mov ax, word [cs:init2_to_init1_segment] ; => INIT1 3517 <1> mov bx, init1_retf ; other:bx -> retf opcode 3518 <1> 3519 <1> init2_to_other_segment_common: 3520 <1> push ax 3521 <1> push ax ; dword space for ?jumpaddress 3522 <1> lframe 0 3523 <1> lpar word, returnaddress_cs_and_orig_ip 3524 <1> lpar word, returnaddress_ip 3525 <1> lpar word, returnaddress_other_ip 3526 <1> lpar dword, jumpaddress 3527 <1> lenter 3528 <1> 3529 <1> push si 3530 <1> pushf 3531 <1> cld 3532 <1> 3533 <1> mov word [bp + ?jumpaddress + 2], ax ; fill function segment 3534 <1> mov si, cs 3535 <1> xchg si, word [bp + ?returnaddress_cs_and_orig_ip] ; fill cs 3536 <1> cs lodsw 3537 <1> cmp al, 0CCh ; debugger breakpoint ? 3538 <1> jne @F ; no --> 3539 <1> int3 ; break to make it remove the breakpoint 3540 <1> dec si 3541 <1> dec si 3542 <1> cs lodsw ; reload the word 3543 <1> cmp al, 0CCh 3544 <1> jne @F 3545 <1> 3546 <1> .l: 3547 <1> int3 3548 <1> jmp .l 3549 <1> 3550 <1> @@: 3551 <1> mov word [bp + ?jumpaddress + 0], ax ; fill function offset 3552 <1> xchg ax, si ; ip in our cs 3553 <1> xchg ax, [bp + ?returnaddress_ip] ; fill ip 3554 <1> ; (and restore ax) 3555 <1> 3556 <1> xchg bx, word [bp + ?returnaddress_other_ip] ; fill near ip in other 3557 <1> ; (and restore bx) 3558 <1> 3559 <1> popf 3560 <1> pop si 3561 <1> 3562 <1> lleave 3563 <1> retf ; jump to dword [bp + ?jumpaddress] 3564 <1> 3565 <1> 3566 <1> ; INP: ax = space in bytes to allocate at top of LMA 3567 <1> ; cl = allocation type 3568 <1> ; OUT: es:di-> allocated space, initialised to all zeros 3569 <1> ; ax = cx = space in bytes allocated, 3570 <1> ; ! 0 if size is 65536 3571 <1> ; does not return after allocation failure 3572 <1> ; CHG: - 3573 <1> init2_alloc_s_mcb_top: 3574 <1> call init2_to_init1 3575 <1> dw init1_alloc_s_mcb_top 3576 <1> retn 3577 <1> 3578 <1> 3579 <1> ; INP: ax = space in bytes to allocate 3580 <1> ; cl = allocation type 3581 <1> ; OUT: es:di-> allocated space, initialised to all zeros 3582 <1> ; ax = cx = space in bytes allocated, 3583 <1> ; ! 0 if size is 65536 3584 <1> ; does not return after allocation failure 3585 <1> ; CHG: - 3586 <1> init2_alloc_s_mcb: 3587 <1> call init2_to_init1 3588 <1> dw init1_alloc_s_mcb 3589 <1> retn 3590 <1> 3591 <1> 3592 <1> init2_call_rploader: 3593 <1> call init2_to_init1 3594 <1> dw init1_call_rploader 3595 <1> retn 3596 <1> %endif 3597 <1> 3598 <1> 3599 <1> ; CHG: ds, si, ax 3600 <1> ; OUT: NZ if A20 line is switched on 3601 <1> ; ZR if A20 line is switched off 3602 <1> ; may return with IF=0 3603 <1> ; UP 3604 <1> init2_check_a20: 3605 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006150 FC cld 0 00006151 06 push es 0 00006152 57 push di 0 00006153 51 push cx 0 00006154 31F6 xor si, si 0 00006156 8EDE mov ds, si ; ds = 0000h 3612 <1> assume ds:IVT 0 00006158 4E dec si 0 00006159 8EC6 mov es, si ; es = FFFFh 3615 <1> assume es:nothing 0 0000615B 46 inc si ; ds:si = 0000h:0000h = 00000h 0 0000615C BF1000 mov di, 0010h ; es:di = FFFFh:0010h = 100000h 3618 <1> ; (same address if bit 20 off) 0 0000615F 89F9 mov cx, di ; 32 byte (16 = 10h word) 0 00006161 F3A7 repe cmpsw ; compare, A20 line switched on if differing 0 00006163 7512 jne .ret ; differing --> 3622 <1> 0 00006165 FA cli ; try not to run interrupt handlers during this 0 00006166 BF1000 mov di, 10h ; -> FFFFh:0010h = 10_0000h 3625 <1> ; (in the HMA, part of the VDISK header) 0 00006169 8D75F0 lea si, [di - 10h] ; -> 0000h:0000h = 00_0000h 3627 <1> ; (in the LMA, offset word of int 00h handler) 0 0000616C 26FF35 push word [es:di] ; save value 0 0000616F 26FF0D dec word [es:di] ; change value (in HMA, or wrapped around LMA) 0 00006172 A7 cmpsw ; compare values, NZ if A20 is switched on 0 00006173 268F45FE pop word [es:di - 2] ; restore value 3632 <1> ; This can still report a false negative (A20 detected off 3633 <1> ; when actually it is on), but we don't care about that. 3634 <1> .ret: 0 00006177 59 pop cx 0 00006178 5F pop di 0 00006179 07 pop es 3638 <1> assume es:nothing 0 0000617A C3 retn 3640 <1> 3641 <1> 3642 <1> extern dosdata_to_doscode_segment 3643 <1> 3644 <1> ; This is to be called after each device driver is installed. 3645 <1> ; It relocates DOSCODE to the HMA if it is available. 3646 <1> ; May be extended to relocate more things later. 3647 <1> ; 3648 <1> ; INP: ax = flags 3649 <1> ; CHG: ds, es, si, di, ax, bx, cx, dx 3650 <1> init2_relocate_device: 3651 <1> assume ds:nothing, es:nothing, ss:nothing 3652 <1> lframe 0 3653 <1> lvar word, umb_first_umcb 3654 <1> lvar word, umb_last_umcb 3655 <1> lvar word, last_mcb 0 0000617B 5589E58D66FA lenter 3657 <1> lvar word, flags 0 00006181 50 push ax 3659 <1> lvar word, first_mcb 0 00006182 B452 mov ah, 52h 0 00006184 CD21 int 21h 3662 <1> assume es:DOSGROUP 0 00006186 26FF77FE push word [es:bx - 2] 3664 <1> lvar word, first_umcb 0 0000618A B86112 mov ax, 1261h 0 0000618D CD2F int 2Fh 0 0000618F 50 push ax 3668 <1> 3669 <1> %if !_COMBINED_DOSDATA_DOSCODE && _RELOCATEDOSCODE && _DOSCODEHMA 3670 <1> 0 00006190 2ED006[1008] rol byte [cs:doscode_relocated_to_final_position], 1 0 00006195 7303E97E01 jc .no_doscode_reloc 3673 <1> 3674 <1> %if 0 3675 <1> mov ax, 70h 3676 <1> mov ds, ax 3677 <1> mov ds, word [dosentry_to_dosdata_segment] 3678 <1> %else 0 0000619A 31C0 xor ax, ax 0 0000619C 8ED8 mov ds, ax 3681 <1> assume ds:IVT 0 0000619E 8E1EC600 mov ds, word [31h * 4 + 2] ; => DOSDATA 3683 <1> assume ds:DOSGROUP 3684 <1> %endif 0 000061A2 8B1E[0000] mov bx, word [dosdata_to_doscode_segment] 0 000061A6 83FBFE cmp bx, DOSCODE_HMA_SEGMENT ; already in HMA ? 0 000061A9 7203E96A01 jae .not_doscode_to_hma ; yes, return --> 3688 <1> 0 000061AE F746F80200 test word [bp + ?flags], DOSFLAGS_RELOCATE_DOSCODE_HMA 0 000061B3 7503E96001 jz .not_doscode_to_hma 3691 <1> 0 000061B8 B80043 mov ax, 4300h 0 000061BB CD2F int 2Fh ; XMS present ? 0 000061BD 3C80 cmp al, 80h 0 000061BF 7403E95401 jne .not_doscode_to_hma ; no --> 3696 <1> 0 000061C4 CC int3 0 000061C5 B81043 mov ax, 4310h 0 000061C8 CD2F int 2Fh ; get XMS entrypoint 0 000061CA 2E891E[6C18] mov word [cs:init2_xmsentry], bx 0 000061CF 2E8C06[6E18] mov word [cs:init2_xmsentry + 2], es ; store 3702 <1> 0 000061D4 B80001 mov ax, 0100h 0 000061D7 BAFFFF mov dx, -1 0 000061DA E89503 call .call_xms ; allocate HMA 0 000061DD 7303E93601 jc .not_doscode_to_hma ; failure --> 3707 <1> 0 000061E2 B403 mov ah, 03h 0 000061E4 E88B03 call .call_xms ; enable A20 0 000061E7 BA[F61E] mov dx, init2_msg.error_enabling_a20_xms 0 000061EA 7303E92101 jc .not_doscode_free ; error --> 3712 <1> 0 000061EF E85EFF call init2_check_a20 ; check A20 is enabled 0 000061F2 BA[231F] mov dx, init2_msg.error_enabling_a20_actual 0 000061F5 7503E91601 jz .not_doscode_free ; error --> 3716 <1> 0 000061FA B8[0000] mov ax, DOSENTRY 0 000061FD 8ED8 mov ds, ax 3719 <1> assume ds:DOSENTRYGROUP 0 000061FF 2EFF36[6E18] push word [cs:init2_xmsentry + 2] 0 00006204 2EFF36[6C18] push word [cs:init2_xmsentry] 0 00006209 FA cli 0 0000620A 8F06[0000] pop word [dosentry_xmsentry] 0 0000620E 8F06[0200] pop word [dosentry_xmsentry + 2] 3725 <1> extern ..@dosentry_patch_hma 0 00006212 C706[0000]87C0 mov word [..@dosentry_patch_hma], 0C087h ; xchg ax, modrm ax 0 00006218 FB sti 3728 <1> 0 00006219 2E833E[0000]00 cmp word [cs:autobounce_both_options], 0 0 0000621F 7423 je .no_bounce_test 3731 <1> 0 00006221 B8[0000] mov ax, DOSENTRY 0 00006224 B104 mov cl, 4 0 00006226 D3E0 shl ax, cl 0 00006228 2E0106[FE1D] add word [cs:int25packet.offset], ax 3736 <1> ; -> into HMA, corresponding to DISKSECTOR 3737 <1> 0 0000622D BB[0000] mov bx, autobouncehmachs_option 0 00006230 BF[0000] mov di, config_bounce_hma_chs 0 00006233 31C0 xor ax, ax 0 00006235 E8BE03 call detect_bounce 3742 <1> assume ds:nothing, es:nothing, ss:nothing 3743 <1> 0 00006238 BB[0000] mov bx, autobouncehmalba_option 0 0000623B BF[0000] mov di, config_bounce_hma_lba 0 0000623E B80004 mov ax, F_LBA 0 00006241 E8B203 call detect_bounce 3748 <1> assume ds:nothing, es:nothing, ss:nothing 3749 <1> .no_bounce_test: 3750 <1> 0 00006244 BAFFFF mov dx, -1 0 00006247 8EC2 mov es, dx 3753 <1> assume es:nothing 0 00006249 BF1000 mov di, 10h 0 0000624C 0E push cs 0 0000624D 1F pop ds 3757 <1> assume ds:SYSINITGROUP 0 0000624E BE[7018] mov si, init2_hma_vdisk_header 0 00006251 B91000 mov cx, init2_hma_vdisk_header_size_w 0 00006254 F3A5 rep movsw 3761 <1> %if init2_hma_vdisk_header_size != 32 3762 <1> %error Expected HMA VDISK header to be 32 bytes long 3763 <1> %endif 0 00006256 B90800 mov cx, 10h >> 1 0 00006259 31C0 xor ax, ax 0 0000625B F3AB rep stosw 0 0000625D 83EF10 sub di, 10h 3768 <1> 3769 <1> %if 0 3770 <1> mov cx, (doscode_end - doscode_start) 3771 <1> %else 3772 <1> extern afterdoscodelabel 0 00006260 B9[0000] mov cx, afterdoscodelabel wrt DOSCODEGROUP 0 00006263 83E950 sub cx, DOSCODE_HMA_OFFSET 3775 <1> %endif 3776 <1> 0 00006266 BAFEFF mov dx, DOSCODE_HMA_SEGMENT 0 00006269 26C7054D53 mov word [es:di + hmcbSignature], "MS" 0 0000626E 26895502 mov word [es:di + hmcbOwner], dx 0 00006272 26894D04 mov word [es:di + hmcbSize], cx 0 00006276 89FB mov bx, di 0 00006278 83C310 add bx, HMCB_size 0 0000627B 01CB add bx, cx 0 0000627D 26895D06 mov word [es:di + hmcbNext], bx 0 00006281 26C74508444F mov word [es:di + hmcbName], "DO" 0 00006287 26C7450A5343 mov word [es:di + hmcbName + 2], "SC" 0 0000628D 26C7450C4F44 mov word [es:di + hmcbName + 4], "OD" 0 00006293 26C6450E45 mov byte [es:di + hmcbName + 6], "E" 3789 <1> 0 00006298 89DF mov di, bx 0 0000629A 31C0 xor ax, ax 0 0000629C 51 push cx 0 0000629D B90800 mov cx, 16 >> 1 0 000062A0 F3AB rep stosw 0 000062A2 59 pop cx 0 000062A3 89DF mov di, bx 0 000062A5 26C7054D53 mov word [es:di + hmcbSignature], "MS" 3798 <1> ; word [es:di + hmcbOwner] already == 0 0 000062AA 89DE mov si, bx 0 000062AC 83C610 add si, 10h 0 000062AF F7DE neg si 0 000062B1 26897504 mov word [es:di + hmcbSize], si 3803 <1> ; word [es:di + hmcbNext] already == 0 3804 <1> 0 000062B5 8EC2 mov es, dx 3806 <1> assume es:nothing 0 000062B7 BF5000 mov di, DOSCODE_HMA_OFFSET 0 000062BA 89FE mov si, di 3809 <1> %if 0 3810 <1> mov dx, 70h 3811 <1> mov ds, dx 3812 <1> mov ds, word [dosentry_to_dosdata_segment] 3813 <1> %else 0 000062BC 31D2 xor dx, dx 0 000062BE 8EDA mov ds, dx 3816 <1> assume ds:IVT 0 000062C0 8E1EC600 mov ds, word [31h * 4 + 2] 3818 <1> assume ds:DOSGROUP 3819 <1> %endif 0 000062C4 8B1E[0000] mov bx, word [dosdata_to_doscode_segment] 0 000062C8 8EDB mov ds, bx 3822 <1> assume ds:DOSCODEGROUP 0 000062CA D1E9 shr cx, 1 0 000062CC F3A5 rep movsw 3825 <1> 0 000062CE 8EDA mov ds, dx 3827 <1> assume ds:IVT 3828 <1> %if 0 3829 <1> mov ds, word [dosentry_to_dosdata_segment] 3830 <1> %else 0 000062D0 8E1EC600 mov ds, word [31h * 4 + 2] 3832 <1> assume ds:DOSGROUP 3833 <1> %endif 3834 <1> extern doslocation3306 0 000062D4 800E[0000]10 or byte [doslocation3306], 10h 3836 <1> 0 000062D9 8C06[0000] mov word [dosdata_to_doscode_segment], es 0 000062DD B8[0000] mov ax, DOSENTRY 0 000062E0 8ED8 mov ds, ax 3840 <1> assume ds:DOSENTRYGROUP 3841 <1> extern ..@dosentry_doscode_segment 0 000062E2 8C06[0000] mov word [..@dosentry_doscode_segment], es 0 000062E6 2EF616[1008] not byte [cs:doscode_relocated_to_final_position] 3844 <1> assume es:DOSCODEGROUP 3845 <1> 0 000062EB 8CD0 mov ax, ss 0 000062ED 39D8 cmp ax, bx 0 000062EF 7502 jne @F 0 000062F1 06 push es 0 000062F2 17 pop ss 3851 <1> assume ss:DOSCODEGROUP 3852 <1> @@: 3853 <1> assume ss:nothing 3854 <1> 0 000062F3 83C305 add bx, DOSCODE_HMA_OFFSET / 16 0 000062F6 8EC3 mov es, bx ; => DOSCODE source 3857 <1> assume es:nothing 0 000062F8 B449 mov ah, 49h 0 000062FA CD21 int 21h ; free it 3860 <1> 3861 <1> extern first_hmcb 0 000062FC 8EDA mov ds, dx 3863 <1> assume ds:IVT 3864 <1> %if 0 3865 <1> mov ds, word [dosentry_to_dosdata_segment] 3866 <1> %else 0 000062FE 8E1EC600 mov ds, word [31h * 4 + 2] 3868 <1> assume ds:DOSGROUP 3869 <1> %endif 0 00006302 C706[0000]3000 mov word [first_hmcb], 30h 3871 <1> 0 00006308 BA[6F1F] mov dx, init2_msg.relocated_to_hma 0 0000630B E8C005 call init2_disp_msg_asciz_cs_dx 3874 <1> 0 0000630E EB08 jmp .not_doscode_to_hma 3876 <1> 3877 <1> 3878 <1> .not_doscode_free: 3879 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006310 E8BB05 call init2_disp_msg_asciz_cs_dx 3881 <1> 0 00006313 B402 mov ah, 02h 0 00006315 E85A02 call .call_xms ; free HMA 3884 <1> 3885 <1> .not_doscode_to_hma: 3886 <1> .no_doscode_reloc: 3887 <1> assume ds:nothing, es:nothing, ss:nothing 3888 <1> %endif 3889 <1> 0 00006318 56 push si ; loop detection counter word 0 00006319 BE4000 mov si, 40h ; "UMA only" (+ first fit) 0 0000631C 56 push si 0 0000631D 89E6 mov si, sp ; ss:si -> area flags and strategy word 3894 <1> 0 0000631F F746F80800 test word [bp + ?flags], DOSFLAGS_LINK_UMB 0 00006324 7503E93602 jz .not_link_umb 3897 <1> 0 00006329 B80043 mov ax, 4300h 0 0000632C CD2F int 2Fh ; XMS present ? 0 0000632E 3C80 cmp al, 80h 0 00006330 7403E92A02 jne .not_link_umb ; no --> 3902 <1> 0 00006335 B81043 mov ax, 4310h 0 00006338 CD2F int 2Fh ; get XMS entrypoint 0 0000633A 2E891E[6C18] mov word [cs:init2_xmsentry], bx 0 0000633F 2E8C06[6E18] mov word [cs:init2_xmsentry + 2], es ; store 3907 <1> 3908 <1> .link_next_umb: 0 00006344 B410 mov ah, 10h 0 00006346 BAFFFF mov dx, -1 ; size 0 00006349 E82602 call .call_xms ; request UMB 0 0000634C 7203E90802 jnc .not_link_umb_error_succeeded_unexpectedly 0 00006351 80FBB0 cmp bl, 0B0h ; "only smaller UMB available" ? 0 00006354 7403E90602 jne .not_link_umb ; no, done --> 3915 <1> 0 00006359 52 push dx 0 0000635A B410 mov ah, 10h ; (size initialised by prior call) 0 0000635C E81302 call .call_xms ; request UMB 0 0000635F 58 pop ax 0 00006360 7325 jnc .link_umb 3921 <1> 0 00006362 BA[2A1E] mov dx, init2_msg.umb_unavailable_1 0 00006365 E86605 call init2_disp_msg_asciz_cs_dx 3924 <1> 0 00006368 E88F05 call init2_disp_ax_hex 0 0000636B BA[3D1E] mov dx, init2_msg.umb_unavailable_2 0 0000636E E85D05 call init2_disp_msg_asciz_cs_dx 3928 <1> 0 00006371 53 push bx 0 00006372 31D2 xor dx, dx 0 00006374 B91000 mov cx, 16 0 00006377 BB0800 mov bx, 4+4 0 0000637A E86DFC call init2_disp_dxax_times_cx_width_bx_size 0 0000637D 5B pop bx 0 0000637E BA[411E] mov dx, init2_msg.umb_unavailable_3 0 00006381 E84A05 call init2_disp_msg_asciz_cs_dx 3937 <1> 0 00006384 E9D801 jmp .not_link_umb 3939 <1> 3940 <1> .link_umb: 3941 <1> ; dx = allocated UMB size 3942 <1> ; bx = allocated UMB segment 0 00006387 3683640200 and word [ss:si + 2], 0 ; initialise loop detection counter to zero 3944 <1> 0 0000638C 52 push dx 0 0000638D 89D0 mov ax, dx 0 0000638F BA[2A1E] mov dx, init2_msg.umb_allocated_1 0 00006392 E83905 call init2_disp_msg_asciz_cs_dx 3949 <1> 0 00006395 E86205 call init2_disp_ax_hex 0 00006398 BA[3D1E] mov dx, init2_msg.umb_allocated_2 0 0000639B E83005 call init2_disp_msg_asciz_cs_dx 3953 <1> 0 0000639E 53 push bx 0 0000639F 31D2 xor dx, dx 0 000063A1 B91000 mov cx, 16 0 000063A4 BB0800 mov bx, 4+4 0 000063A7 E840FC call init2_disp_dxax_times_cx_width_bx_size 0 000063AA 5B pop bx 0 000063AB BA[6B1E] mov dx, init2_msg.umb_allocated_3 0 000063AE E81D05 call init2_disp_msg_asciz_cs_dx 3962 <1> 0 000063B1 89D8 mov ax, bx 0 000063B3 E84405 call init2_disp_ax_hex 0 000063B6 BA[711E] mov dx, init2_msg.umb_allocated_4 0 000063B9 E81205 call init2_disp_msg_asciz_cs_dx 0 000063BC 5A pop dx 3968 <1> 3969 <1> ; dx = size, bx = segment 0 000063BD 31C9 xor cx, cx ; step = 0 3971 <1> 0 000063BF 51 push cx 0 000063C0 53 push bx 0 000063C1 52 push dx 0 000063C2 31C9 xor cx, cx ; free 0 000063C4 93 xchg ax, bx ; ax => MCB 0 000063C5 89D3 mov bx, dx ; size = size of UMB 0 000063C7 83EB02 sub bx, 2 ; -1 for initial MCB, -1 for end MCB 0 000063CA 721B jc @F ; too small! 0 000063CC BA4D00 mov dx, "M" ; "M" 0 000063CF 8946FE mov word [bp + ?umb_first_umcb], ax 3982 <1> ; INP: ax => MCB to initialise 3983 <1> ; cx = owner to set (8 if S MCB) 3984 <1> ; bx = size to set 3985 <1> ; dl = MCB signature, "M" or "Z" 3986 <1> ; dh = S MCB type 3987 <1> ; OUT: - 3988 <1> ; CHG: - 0 000063D2 E828FD call init2_init_an_mcb 3990 <1> 0 000063D5 01D8 add ax, bx 0 000063D7 40 inc ax ; => end MCB 0 000063D8 31DB xor bx, bx ; size zero (may be changed to link next UMB) 0 000063DA BA5A30 mov dx, (S_EXCLDUMA << 8) | "Z" ; type, and signature 0 000063DD B90800 mov cx, 8 ; allocate S MCB 0 000063E0 8946FC mov word [bp + ?umb_last_umcb], ax 0 000063E3 E817FD call init2_init_an_mcb 3998 <1> 0 000063E6 A8 db __TEST_IMM8 ; (NC) skip stc 4000 <1> @@: 0 000063E7 F9 stc 0 000063E8 5A pop dx 0 000063E9 5B pop bx 0 000063EA 59 pop cx 0 000063EB 7303E94A01 jc .not_link_umb_error_mcb_chain 4006 <1> 0 000063F0 31C0 xor ax, ax ; = 0 = get first UMCB 4008 <1> .search_umb: 0 000063F2 B101 mov cl, 1 ; step = 1 0 000063F4 8946FA mov word [bp + ?last_mcb], ax 4011 <1> %if 0 4012 <1> call init2_to_doscode 4013 <1> dw SNextMCB ; get next (U)MCB 4014 <1> %else 0 000063F7 E88401 call init2_SNextMCB 4016 <1> %endif 0 000063FA 7303E93B01 jc .not_link_umb_error_mcb_chain ; chain corrupted 0 000063FF 7403E90901 jnz .umb_case_3 ; end of chain, word [bp + ?last_mcb] has last 0 00006404 41 inc cx ; step = 2 0 00006405 39C3 cmp bx, ax ; area to add is below ? 0 00006407 7703E92E01 jbe .not_link_umb_error_mcb_chain ; if so, error out --> 0 0000640C 8ED8 mov ds, ax 4023 <1> assume ds:MCB 0 0000640E 89C7 mov di, ax ; => MCB 0 00006410 033E0300 add di, word [mcbSize] 0 00006414 47 inc di ; => next MCB (if any) 0 00006415 39FB cmp bx, di 0 00006417 77D9 ja .search_umb ; next --> 0 00006419 7403E99F00 jne .umb_case_2 ; UMB is below where next points to 4030 <1> 4031 <1> .umb_case_1: 4032 <1> %if 0 4033 <1> case 1: S_EXCLDUMA MCB ends at where our UMB starts 4034 <1> 0123456789 4035 <1> S2 E 4036 <1> U3 L 4037 <1> 4038 <1> %endif 0 0000641E B108 mov cl, 8 ; step = 8 4040 <1> 0 00006420 833E010008 cmp word [mcbOwner], 8 0 00006425 7403E91001 jne .not_link_umb_error_mcb_chain 0 0000642A 41 inc cx ; step = 9 0 0000642B 833E080053 cmp word [smcbName], "S" 0 00006430 7403E90501 jne .not_link_umb_error_mcb_chain 0 00006435 41 inc cx ; step = A 0 00006436 803E0A0030 cmp byte [smcbType], S_EXCLDUMA 0 0000643B 7403E9FA00 jne .not_link_umb_error_mcb_chain 0 00006440 41 inc cx ; step = B 4050 <1> 0 00006441 803E00005A cmp byte [mcbSignature], "Z" 0 00006446 7403E9EF00 jne .not_link_umb_error_mcb_chain 0 0000644B C60600004D mov byte [mcbSignature], "M" 4054 <1> 4055 <1> .check_empty_umcb: 0 00006450 833E030000 cmp word [mcbSize], 0 ; empty area ? 0 00006455 750A jne @F ; no, no question as to whether to free --> 4058 <1> 0 00006457 3B46F4 cmp ax, [bp + ?first_umcb] ; is ds => first UMCB ? 0 0000645A 7408 je .check_enlarge_lma ; yes, either protect UMCB or enlarge LMA --> 4061 <1> ; no, unconditionally delete the hole 4062 <1> .free_umcb_link_next_umb: 0 0000645C 8326010000 and word [mcbOwner], 0 ; empty area found, clear owner 4064 <1> ; (affects first UMCB only if enlarging LMA) 4065 <1> @@: 0 00006461 E9E0FE jmp .link_next_umb 4067 <1> 4068 <1> .check_enlarge_lma: 4069 <1> extern enlargelma_option 0 00006464 2ED006[0000] rol byte [cs:enlargelma_option], 1 4071 <1> ; enlarge ? 0 00006469 73F6 jnc @B ; no, protect it --> 4073 <1> 4074 <1> @@: ; loop to find next UMA hole (or end of UMCB chain) 4075 <1> %if 0 4076 <1> call init2_to_doscode 4077 <1> dw SNextMCB ; get next (U)MCB 4078 <1> %else 0 0000646B E81001 call init2_SNextMCB 4080 <1> %endif 0 0000646E B120 mov cl, 20h ; step = 20 0 00006470 7303E9C500 jc .not_link_umb_error_mcb_chain ; chain corrupted 0 00006475 B121 mov cl, 21h ; step = 21 0 00006477 7403E9BE00 jnz .not_link_umb_error_mcb_chain 0 0000647C 8ED8 mov ds, ax 4086 <1> assume ds:MCB 0 0000647E 833E010008 cmp word [mcbOwner], 8 0 00006483 75E6 jne @B 0 00006485 833E080053 cmp word [smcbName], "S" 0 0000648A 75DF jne @B 0 0000648C 803E0A0030 cmp byte [smcbType], S_EXCLDUMA 0 00006491 75D8 jne @B 4093 <1> extern first_umcb 0 00006493 E8[0000] call sysinit_get_ds_dosbiodata 4095 <1> assume ds:DOSGROUP 0 00006496 92 xchg dx, ax ; new first UMCB to dx 4097 <1> 4098 <1> ; natch, we need to link UMBs before changing things ! 0 00006497 B80258 mov ax, 5802h 0 0000649A CD21 int 21h 0 0000649C 50 push ax 0 0000649D B80358 mov ax, 5803h 0 000064A0 BB0100 mov bx, 1 ; link in UMBs before modification 0 000064A3 CD21 int 21h 4105 <1> 0 000064A5 8916[0000] mov word [first_umcb], dx ; update DOSDATA's reference 0 000064A9 8756F4 xchg word [bp + ?first_umcb], dx; update our stack frame's reference, 4108 <1> ; and dx = old first UMCB 0 000064AC 5B pop bx 0 000064AD B80358 mov ax, 5803h 0 000064B0 CD21 int 21h ; restore old UMB link state 4112 <1> 0 000064B2 92 xchg ax, dx ; old first UMCB to ax 4114 <1> 4115 <1> extern configmsg.enlargelma_message 0 000064B3 BA[0000] mov dx, configmsg.enlargelma_message 0 000064B6 E81504 call init2_disp_msg_asciz_cs_dx 4118 <1> 0 000064B9 8ED8 mov ds, ax ; => old first UMCB 4120 <1> assume ds:MCB 0 000064BB EB9F jmp .free_umcb_link_next_umb ; free the old first UMCB 4122 <1> 4123 <1> 4124 <1> .umb_case_2: 4125 <1> assume ds:nothing, es:nothing, ss:nothing 4126 <1> %if 0 4127 <1> case 2: S_EXCLDUMA MCB around entire area 4128 <1> 0123456789 4129 <1> S8 E 4130 <1> U3 L 4131 <1> S2 U3 L1E 4132 <1> S=0 4133 <1> S size=8 4134 <1> di=9 4135 <1> L=7 4136 <1> E=9 4137 <1> L want size=1 4138 <1> L want size=E-L-1 4139 <1> S want size=2 4140 <1> S want size=U-S-1 4141 <1> %endif 4142 <1> 0 000064BD 833E010008 cmp word [mcbOwner], 8 0 000064C2 7576 jne .not_link_umb_error_mcb_chain 0 000064C4 41 inc cx ; step = 3 0 000064C5 833E080053 cmp word [smcbName], "S" 0 000064CA 756E jne .not_link_umb_error_mcb_chain 0 000064CC 41 inc cx ; step = 4 0 000064CD 803E0A0030 cmp byte [smcbType], S_EXCLDUMA 0 000064D2 7566 jne .not_link_umb_error_mcb_chain 0 000064D4 41 inc cx ; step = 5 4152 <1> 0 000064D5 8E46FC mov es, word [bp + ?umb_last_umcb] 4154 <1> assume es:nothing 0 000064D8 8A2E0000 mov ch, byte [mcbSignature] 0 000064DC 26882E0000 mov byte [es:mcbSignature], ch 0 000064E1 2B7EFC sub di, word [bp + ?umb_last_umcb] 4158 <1> ; (E-L) size of UMB's last UMCB 0 000064E4 4F dec di ; (E-L-1) minus last UMCB itself 0 000064E5 26893E0300 mov word [es:mcbSize], di 0 000064EA 26803E00005A cmp byte [es:mcbSignature], "Z" ; last ? 0 000064F0 740A je @F ; yes, do not clear owner (even if empty) --> 0 000064F2 85FF test di, di ; empty area ? 0 000064F4 7506 jnz @F 0 000064F6 268326010000 and word [es:mcbOwner], 0 ; yes, clear owner 4166 <1> @@: 4167 <1> .umb_case_2_3_common: 4168 <1> assume ds:nothing, es:nothing, ss:nothing 0 000064FC 89DF mov di, bx ; (U) 0 000064FE 29C7 sub di, ax ; (U-S) 0 00006500 4F dec di ; (U-S-1) 0 00006501 893E0300 mov word [mcbSize], di 0 00006505 C60600004D mov byte [mcbSignature], "M" ; link to UMB's first UMCB 0 0000650A E943FF jmp .check_empty_umcb 4175 <1> 4176 <1> 4177 <1> .umb_case_3: 4178 <1> assume ds:nothing, es:nothing, ss:nothing 4179 <1> %if 0 4180 <1> case 1: S_EXCLDUMA MCB ends somewhere below our UMB 4181 <1> 0123456789 4182 <1> S1E 4183 <1> U3 L 4184 <1> S want size=2 4185 <1> S want size=U-S-1 4186 <1> %endif 0 0000650D B110 mov cl, 10h ; step = 10 4188 <1> 0 0000650F 8B46FA mov ax, word [bp + ?last_mcb] 0 00006512 85C0 test ax, ax 0 00006514 7424 jz .not_link_umb_error_mcb_chain 0 00006516 41 inc cx ; step = 11 0 00006517 8ED8 mov ds, ax 4194 <1> assume ds:MCB 0 00006519 833E010008 cmp word [mcbOwner], 8 0 0000651E 751A jne .not_link_umb_error_mcb_chain 0 00006520 41 inc cx ; step = 12 0 00006521 833E080053 cmp word [smcbName], "S" 0 00006526 7512 jne .not_link_umb_error_mcb_chain 0 00006528 41 inc cx ; step = 13 0 00006529 803E0A0030 cmp byte [smcbType], S_EXCLDUMA 0 0000652E 750A jne .not_link_umb_error_mcb_chain 0 00006530 41 inc cx ; step = 14 4204 <1> 0 00006531 803E00005A cmp byte [mcbSignature], "Z" 0 00006536 7502 jne .not_link_umb_error_mcb_chain 4207 <1> 0 00006538 EBC2 jmp .umb_case_2_3_common 4209 <1> 4210 <1> 4211 <1> .not_link_umb_error_mcb_chain: 4212 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000653A 50 push ax 0 0000653B BA[801E] mov dx, init2_msg.umb_mcb_chain_corrupted_1 0 0000653E E88D03 call init2_disp_msg_asciz_cs_dx 4216 <1> 0 00006541 88C8 mov al, cl 0 00006543 E8BB03 call init2_disp_al_hex 0 00006546 BA[A21E] mov dx, init2_msg.umb_mcb_chain_corrupted_2 0 00006549 E88203 call init2_disp_msg_asciz_cs_dx 4221 <1> 0 0000654C 58 pop ax 0 0000654D E8AA03 call init2_disp_ax_hex 0 00006550 BA[A21E] mov dx, init2_msg.umb_mcb_chain_corrupted_2 0 00006553 E87803 call init2_disp_msg_asciz_cs_dx 4226 <1> 4227 <1> ; Note that we do not free the UMB here! In case the user 4228 <1> ; wants to do that, the address has already been displayed. 0 00006556 E9EBFD jmp .link_next_umb 4230 <1> 4231 <1> 4232 <1> .not_link_umb_error_succeeded_unexpectedly: 0 00006559 BA[AE1E] mov dx, init2_msg.umb_succeeded_unexpectedly 0 0000655C E86F03 call init2_disp_msg_asciz_cs_dx 4235 <1> 4236 <1> .not_link_umb: 4237 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000655F 5E pop si ; (discard area flags and strategy word) 0 00006560 5E pop si ; (discard loop detection counter) 4240 <1> 0 00006561 2ED006[0F08] rol byte [cs:dosdata_relocate_early], 1 0 00006566 7306 jnc @F 0 00006568 BAFFFF mov dx, -1 ; != 0 = relocate only if UMA 0 0000656B E8AE03 call relocate_dosdata 4245 <1> @@: 4246 <1> 0 0000656E 89EC5D lleave code 0 00006571 C3 retn 4249 <1> 4250 <1> %if 1 || (_RELOCATEDOSCODE && _DOSCODEHMA) 4251 <1> .call_xms: 0 00006572 2EFF1E[6C18] call far [cs:init2_xmsentry] 0 00006577 83F801 cmp ax, 1 0 0000657A 7401 je @F ; (NC) --> 0 0000657C F9 stc 4256 <1> @@: 0 0000657D C3 retn 4258 <1> %endif 4259 <1> 4260 <1> ; Get next MCB, insuring the chain doesn't loop 4261 <1> ; 4262 <1> ; INP: word [ss:si] = area flags and allocation strategy 4263 <1> ; word [ss:si + 2] = loop detection counter, init to 0 4264 <1> ; ax = former MCB (0000h to get first) 4265 <1> ; OUT: CY if MCB chain corrupted or loops, 4266 <1> ; ax = error code 4267 <1> ; NC if MCB chain intact, 4268 <1> ; NZ if no next MCB, 4269 <1> ; ax = error code (0008h) 4270 <1> ; ZR if next MCB available, 4271 <1> ; ax = next MCB 4272 <1> ; di = 0 4273 <1> ; CHG: - 4274 <1> ; STK: 8 word 4275 <1> ; doscode_insure_low_byte_not_0CCh 4276 <1> init2_SNextMCB: 4277 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000657E 31FF xor di, di 0 00006580 36FF4C02 dec word [ss:si + 2] 0 00006584 7505 jnz @F 4281 <1> ; This doesn't branch if ZR, meaning if the 1_0000h iterations 4282 <1> ; have run out (if counter was 1 prior to the dec). 0 00006586 F9 stc 0 00006587 B8FE00 mov ax, errorMCBLoops 0 0000658A C3 retn 4286 <1> 4287 <1> @@: 4288 <1> ; (fall through to NextMCB) 4289 <1> 4290 <1> 4291 <1> ; Get next MCB 4292 <1> ; 4293 <1> ; INP: word [ss:si] = area flags and allocation strategy 4294 <1> ; word [ss:si + 2] = loop detection counter 4295 <1> ; ax = former MCB (0000h to get first) 4296 <1> ; OUT: CY if MCB chain corrupted, 4297 <1> ; ax = error code 4298 <1> ; NC if MCB chain intact, 4299 <1> ; NZ if no next MCB, 4300 <1> ; ax = error code 0008h (Not enough memory) 4301 <1> ; ZR if next MCB available, 4302 <1> ; ax = next MCB 4303 <1> ; di = 0 4304 <1> ; CHG: - 4305 <1> ; STK: 3 word 4306 <1> ; 4307 <1> ; An interesting effect of how this code handles the first UMCB 4308 <1> ; is that it doesn't care whether the previous MCB contains an 4309 <1> ; 'M' (normal MCB chain extended into UMA) or 'Z' (normal MCB 4310 <1> ; chain limited to LMA). Also, the parsed area flags allow to 4311 <1> ; ignore the actual requested UMB link: If it was zero, all 4312 <1> ; area flags are cleared and forced to 10h (LMA only) instead. 4313 <1> %ifn _UMA 4314 <1> init2_NextMCB: 4315 <1> assume ds:nothing, es:nothing, ss:nothing 4316 <1> push ds 4317 <1> test ax, ax ; request for first ? 4318 <1> jz .first ; yes --> 4319 <1> 4320 <1> call init2_VerifyMCB ; check input MCB first 4321 <1> jc .return 4322 <1> assume ds:MCB 4323 <1> inc ax 4324 <1> add ax, word [di+mcbSize] ; get address of next (if any) 4325 <1> cmp byte [di+mcbSignature], 'M' ; current in-chain ? 4326 <1> je .verify ; yes, verify it --> 4327 <1> ; If this was NZ and didn't jump, then the mcbSignature 4328 <1> ; contains the letter 'Z', which is above 'M'. Therefore, 4329 <1> ; it is always true that it is NC at this point. 4330 <1> mov ax, errorInsufficientMemory ; (NC, NZ) 4331 <1> pop ds 4332 <1> assume ds:nothing 4333 <1> retn 4334 <1> .first: 4335 <1> mov ax, word [bp + ?first_mcb] 4336 <1> .verify: 4337 <1> call init2_VerifyMCB ; NC, ZR if valid - CY if invalid 4338 <1> .return: 4339 <1> pop ds 4340 <1> retn 4341 <1> %else 4342 <1> ; The UMA build has to evaluate the (parsed) area flags 4343 <1> ; here to show the caller a continuous chain of MCBs. 4344 <1> ; This requires special handling in two cases: If the 4345 <1> ; caller's input was 0000h (to get the first MCB) or if 4346 <1> ; it was the MCB before the first UMCB. Area flags of 4347 <1> ; 80h and 40h want to start their search with the first 4348 <1> ; UMCB instead. Flags 20h want to proceed at the first 4349 <1> ; UMCB, all other flags want to stop there. The first 4350 <1> ; UMCB's handling ignores whether the preceeding MCB 4351 <1> ; contained 'M' or 'Z'. 4352 <1> init2_NextMCB: 4353 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000658B 1E push ds 0 0000658C 85C0 test ax, ax ; request for first ? 0 0000658E 742C jz .first ; yes --> 4357 <1> 0 00006590 E84900 call init2_VerifyMCB ; check input MCB first 0 00006593 723B jc .return 4360 <1> assume ds:MCB 0 00006595 40 inc ax 0 00006596 034503 add ax, word [di+mcbSize] ; get address of next (whether current is 'M' or 'Z') 4363 <1> 0 00006599 E83600 call init2_IsFirstUMCB? ; is the one behind this the first UMCB ? 0 0000659C 7508 jne .notfirstumcb ; nope, check if last --> 0 0000659E 36F604D0 test byte [ss:si], ~2Fh ; "LMA then UMA" ? 4367 <1> ; x = D0h --> x & ~20h != 00h if area other than LMA-then-UMA, 4368 <1> ; x = 20h --> x & ~20h = 00h if area is LMA-then-UMA 0 000065A2 7429 jz .verify ; yes, proceed here --> 4370 <1> ; After test, it is always NC here. 0 000065A4 EB11 jmp short .last ; (NC, NZ) else it's the last one (even if 'M') --> 4372 <1> .notfirstumcb: 0 000065A6 803D4D cmp byte [di+mcbSignature], 'M' ; current in-chain ? 0 000065A9 7422 je .verify ; no --> 0 000065AB 837EF4FE cmp word [bp + ?first_umcb], byte -2 ; any UMA ? 0 000065AF 7706 ja .last ; (NC, NZ) no, really last --> 0 000065B1 36F60470 test byte [ss:si], ~8Fh ; "UMA then LMA" ? 4378 <1> ; x = 70h --> x & ~80h != 00h if area other than UMA-then-LMA, 4379 <1> ; x = 80h --> x & ~80h = 00h if area is UMA-then-LMA 0 000065B5 7413 jz .firstlma ; yes, start to search LMA instead --> 4381 <1> ; After test, it is always NC here. 4382 <1> .last: 0 000065B7 B80800 mov ax, errorInsufficientMemory ; (NC, NZ) 0 000065BA 1F pop ds 4385 <1> assume ds:nothing 0 000065BB C3 retn 4387 <1> .first: 0 000065BC 36F604C0 test byte [ss:si], (80h|40h) ; "UMA then LMA" or "UMA only" ? 0 000065C0 7408 jz .firstlma ; no, start with LMA --> 0 000065C2 8B46F4 mov ax, word [bp + ?first_umcb] ; yes, start with UMA 0 000065C5 83F8FF cmp ax, -1 ; UMA valid ? 0 000065C8 7503 jne .verify ; yes --> 4393 <1> .firstlma: 0 000065CA 8B46F6 mov ax, word [bp + ?first_mcb] ; start with LMA 4395 <1> .verify: 0 000065CD E80C00 call init2_VerifyMCB ; NC, ZR if valid - CY if invalid 4397 <1> .return: 0 000065D0 1F pop ds 4399 <1> assume ds:nothing 0 000065D1 C3 retn 4401 <1> 4402 <1> 4403 <1> ; Compare ax to first UMCB 4404 <1> ; 4405 <1> ; INP: ax = MCB 4406 <1> ; OUT: NZ if not first UMCB (or if there's no UMCB) 4407 <1> ; ZR if first UMCB 4408 <1> ; CHG: - 4409 <1> ; STK: 1 word 4410 <1> init2_IsFirstUMCB?: 4411 <1> assume ds:nothing, es:nothing, ss:nothing 0 000065D2 837EF4FE cmp word [bp + ?first_umcb], byte -2 0 000065D6 7703 ja .return ; (NZ if it jumps) --> 0 000065D8 3B46F4 cmp ax, word [bp + ?first_umcb] 4415 <1> .return: 0 000065DB C3 retn 4417 <1> %endif 4418 <1> 4419 <1> 4420 <1> ; Verify MCB 4421 <1> ; 4422 <1> ; INP: ax = MCB 4423 <1> ; OUT: ds = MCB 4424 <1> ; di = 0 4425 <1> ; NZ, CY if invalid MCB, 4426 <1> ; ax = error code 0007h (MCB chain corrupted) 4427 <1> ; ZR, NC if valid MCB 4428 <1> ; CHG: - 4429 <1> ; STK: 1 word 4430 <1> init2_VerifyMCB: 4431 <1> assume ds:nothing, es:nothing, ss:nothing 0 000065DC 31FF xor di, di 0 000065DE 8ED8 mov ds, ax ; set up working registers 4434 <1> assume ds:nothing 0 000065E0 40 inc ax 0 000065E1 83F802 cmp ax, byte 2 ; passed value FFFFh or 0000h ? 0 000065E4 720B jb .invalid ; (NZ, CY) yes --> 4438 <1> assume ds:MCB 0 000065E6 48 dec ax 0 000065E7 803D4D cmp byte [di+mcbSignature], 'M' ; valid 'M' signature ? 0 000065EA 7409 je .return ; yes --> (ZR, NC) 0 000065EC 803D5A cmp byte [di+mcbSignature], 'Z' ; valid 'Z' signature ? 0 000065EF 7404 je .return ; yes --> (ZR, NC) 4444 <1> .invalid: 4445 <1> assume ds:nothing 0 000065F1 F9 stc 0 000065F2 B80700 mov ax, errorMCBDestroyed ; (CY, NZ) else invalid 4448 <1> .return: 0 000065F5 C3 retn 4450 <1> 4451 <1> lleave ctx 4452 <1> 4453 <1> 4454 <1> %if _RELOCATEDOSCODE && _DOSCODEHMA 4455 <1> detect_bounce: 4456 <1> assume ds:nothing, es:nothing, ss:nothing 0 000065F6 2ED007 rol byte [cs:bx], 1 0 000065F9 7203E9B900 jnc .retn 0 000065FE 57 push di 0 000065FF 50 push ax 0 00006600 E8[0000] call sysinit_get_ds_dosbiodata 4462 <1> assume ds:DOSGROUP 0 00006603 C60500 mov byte [di], 0 0 00006606 C436[0000] les si, [DPBHEAD] 4465 <1> .loop_dpb: 0 0000660A 83FEFF cmp si, -1 0 0000660D 7503E9A300 je .done 4468 <1> assume es:DPB 0 00006612 26817C15[0000] cmp word [es:si + dpb_driver_addr + 2], DOSENTRY + DOSENTRYDEVICEBASE 0 00006618 7403E99100 jne .next_dpb 0 0000661D 26817C13[00FF] cmp word [es:si + dpb_driver_addr], DSKDEV - DOSENTRYDEVICEBASE * 16 0 00006623 7403E98600 jne .next_dpb 0 00006628 268B14 mov dx, [es:si + dpb_drive] ; dh = device driver unit 0 0000662B B80308 mov ax, 0803h 0 0000662E CD2F int 2Fh 4476 <1> assume ds:UPB 4477 <1> .loop_upb: 0 00006630 83FFFF cmp di, -1 0 00006633 7479 je .done_upb 0 00006635 387505 cmp byte [di + DRIVELET], dh 0 00006638 7570 jne .next_upb 0 0000663A F6452301 testopt [di + FLAGS], FNON_REMOVABLE 0 0000663E 746A jz .next_upb 0 00006640 58 pop ax 0 00006641 50 push ax 0 00006642 334523 xor ax, [di + FLAGS] 0 00006645 250004 and ax, F_LBA ; differs ? 0 00006648 7560 jnz .next_upb ; yes --> 4489 <1> 0 0000664A 52 push dx 0 0000664B 1E push ds 0 0000664C 06 push es 0 0000664D 57 push di 0 0000664E 56 push si 4495 <1> 0 0000664F BF[0000] mov di, DOSENTRY 0 00006652 8EC7 mov es, di 4498 <1> assume es:DOSENTRYGROUP 0 00006654 BF[0000] mov di, DISKSECTOR ; access with es 0 00006657 B89090 mov ax, 9090h 0 0000665A B90001 mov cx, words(512) 0 0000665D F3AB rep stosw 4503 <1> 0 0000665F B9FFFF mov cx, -1 0 00006662 88D0 mov al, dl 0 00006664 0E push cs 0 00006665 1F pop ds 4508 <1> assume ds:SYSINITGROUP 0 00006666 BB[F81D] mov bx, int25packet ; access with ds 0 00006669 CD25 int 25h 0 0000666B 7237 jc .next_upb_pop_2 0 0000666D 9D popf 4513 <1> 0 0000666E BF[0000] mov di, DOSENTRY 0 00006671 8EC7 mov es, di 4516 <1> assume es:DOSENTRYGROUP 0 00006673 BF[0000] mov di, DISKSECTOR ; access with es 0 00006676 B89090 mov ax, 9090h 0 00006679 B90001 mov cx, words(512) 0 0000667C F3AF repe scasw 0 0000667E 7425 je .next_upb_pop_1 0 00006680 5E pop si 0 00006681 5F pop di 0 00006682 07 pop es 4525 <1> assume es:DPB 0 00006683 1F pop ds 4527 <1> assume ds:UPB 0 00006684 58 pop ax ; al = drive number (0 = A:) 4529 <1> 0 00006685 BA[A41F] mov dx, init2_msg.auto_bounce_hma_chs 0 00006688 59 pop cx ; cx = flag, NZ if LBA 0 00006689 E303 jcxz @F 0 0000668B BA[D71F] mov dx, init2_msg.auto_bounce_hma_lba 4534 <1> @@: 0 0000668E E83D02 call init2_disp_msg_asciz_cs_dx 0 00006691 0441 add al, 'A' 0 00006693 E85102 call init2_disp_al 0 00006696 BA[0A20] mov dx, init2_msg.auto_bounce_trail 0 00006699 E83202 call init2_disp_msg_asciz_cs_dx 0 0000669C 5F pop di ; DOSDATA:di -> the resident choice 0 0000669D E8[0000] call sysinit_get_ds_dosbiodata 4542 <1> assume ds:DOSGROUP 0 000066A0 C605FF mov byte [di], 0FFh 0 000066A3 C3 retn 4545 <1> 4546 <1> .next_upb_pop_2: 0 000066A4 9D popf 4548 <1> .next_upb_pop_1: 0 000066A5 5E pop si 0 000066A6 5F pop di 0 000066A7 07 pop es 4552 <1> assume es:DPB 0 000066A8 1F pop ds 4554 <1> assume ds:UPB 0 000066A9 5A pop dx 4556 <1> .next_upb: 0 000066AA C53D lds di, [di + LINK] 0 000066AC EB82 jmp .loop_upb 4559 <1> 4560 <1> .done_upb: 4561 <1> .next_dpb: 0 000066AE 26C47419 les si, [es:si + dpb_next_dpb] 0 000066B2 E955FF jmp .loop_dpb 4564 <1> 4565 <1> .done: 0 000066B5 58 pop ax 0 000066B6 5F pop di 4568 <1> .retn: 0 000066B7 C3 retn 4570 <1> 4571 <1> align 2, db 0 4572 <1> int25packet: 0 000066B8 00000000 dd 0 0 000066BC 0100 dw 1 4575 <1> .offset: 0 000066BE [1000]FFFF dw DISKSECTOR + 10h, 0FFFFh 4577 <1> %endif 4578 <1> 4579 <1> 4580 <1> init2_msg: 4581 <1> 4582 <1> %if 0 4583 <1> .internal_error_handles: db "init: Internal error during " 4584 <1> asciz "handle allocation.",13,10 4585 <1> .con: asciz "CON" 4586 <1> .aux: asciz "AUX" 4587 <1> .prn: asciz "PRN" 4588 <1> .rxconfigsys: asciz "RxCONFIG.SYS" 4589 <1> .configsys: asciz "CONFIG.SYS" 4590 <1> .config_error_reading_1:asciz "init: Error " 4591 <1> .config_error_reading_2:asciz "h while reading configuration.",13,10 4592 <1> .config_too_long_line_1:asciz "init: Line " 4593 <1> .config_too_long_line_2:asciz " is too long. Ignoring!",13,10 4594 <1> .config_too_long_file_1: db "init: Configuration file too long, " 4595 <1> asciz "ignoring remainder starting at line " 4596 <1> .config_too_long_file_2:asciz ".",13,10 4597 <1> .internal_error_config: asciz "init: Internal error in CONFIG processing.",13,10 4598 <1> %endif 4599 <1> 0 000066C2 48616C7465642E2050 .reboot_prompt: asciz "Halted. Press Ctrl+Alt+Del to reboot.",13,10 0 000066CB 72657373204374726C 0 000066D4 2B416C742B44656C20 0 000066DD 746F207265626F6F74 0 000066E6 2E0D0A00 4601 <1> 4602 <1> .umb_unavailable_1: 4603 <1> .umb_allocated_1: 0 000066EA 696E69743A20554D42 asciz "init: UMB of size " 0 000066F3 206F662073697A6520 0 000066FC 00 4605 <1> .umb_unavailable_2: 4606 <1> .umb_allocated_2: 0 000066FD 68202800 asciz "h (" 4608 <1> .umb_unavailable_3: 0 00006701 29207265706F727465 asciz ") reported free but failed to allocate.",13,10 0 0000670A 642066726565206275 0 00006713 74206661696C656420 0 0000671C 746F20616C6C6F6361 0 00006725 74652E0D0A00 4610 <1> .umb_allocated_3: 0 0000672B 292061742000 asciz ") at " 4612 <1> .umb_allocated_4: 0 00006731 6820616C6C6F636174 asciz "h allocated.",13,10 0 0000673A 65642E0D0A00 4614 <1> .umb_mcb_chain_corrupted_1: 0 00006740 696E69743A20554D43 asciz "init: UMCB chain corrupted, step=" 0 00006749 4220636861696E2063 0 00006752 6F727275707465642C 0 0000675B 20737465703D00 4616 <1> .umb_mcb_chain_corrupted_2: 0 00006762 682C2061783D00 asciz "h, ax=" 4618 <1> .umb_mcb_chain_corrupted_3: 0 00006769 682E0D0A00 asciz "h.",13,10 4620 <1> .umb_succeeded_unexpectedly: 0 0000676E 696E69743A20526571 db "init: Requested UMB allocation of size 0FFFFh" 0 00006777 75657374656420554D 0 00006780 4220616C6C6F636174 0 00006789 696F6E206F66207369 0 00006792 7A6520304646464668 0 0000679B 20756E657870656374 asciz " unexpectedly succeeded.",13,10 0 000067A4 65646C792073756363 0 000067AD 65656465642E0D0A00 4623 <1> 4624 <1> %if _RELOCATEDOSCODE && _DOSCODEHMA 4625 <1> .error_enabling_a20_xms: 0 000067B6 696E69743A20457272 asciz "init: Error enabling A20, XMS call failed.",13,10 0 000067BF 6F7220656E61626C69 0 000067C8 6E67204132302C2058 0 000067D1 4D532063616C6C2066 0 000067DA 61696C65642E0D0A00 4627 <1> .error_enabling_a20_actual: 0 000067E3 696E69743A20457272 asciz "init: Error enabling A20, XMS call reported success but A20 is still off.", 13,10 0 000067EC 6F7220656E61626C69 0 000067F5 6E67204132302C2058 0 000067FE 4D532063616C6C2072 0 00006807 65706F727465642073 0 00006810 756363657373206275 0 00006819 742041323020697320 0 00006822 7374696C6C206F6666 0 0000682B 2E0D0A00 4631 <1> .relocated_to_hma: 0 0000682F 696E69743A20537563 asciz "init: Successfully relocated DOSCODE into the HMA.",13,10 0 00006838 6365737366756C6C79 0 00006841 2072656C6F63617465 0 0000684A 6420444F53434F4445 0 00006853 20696E746F20746865 0 0000685C 20484D412E0D0A00 4633 <1> .auto_bounce_hma_chs: 0 00006864 696E69743A20426F75 asciz "init: Bounce HMA CHS detected as needed for drive " 0 0000686D 6E636520484D412043 0 00006876 485320646574656374 0 0000687F 6564206173206E6565 0 00006888 64656420666F722064 0 00006891 726976652000 4635 <1> .auto_bounce_hma_lba: 0 00006897 696E69743A20426F75 asciz "init: Bounce HMA LBA detected as needed for drive " 0 000068A0 6E636520484D41204C 0 000068A9 424120646574656374 0 000068B2 6564206173206E6565 0 000068BB 64656420666F722064 0 000068C4 726976652000 4637 <1> .auto_bounce_trail: 0 000068CA 3A0D0A00 asciz ":",13,10 4639 <1> %endif 4640 <1> 4641 <1> %if 1 || (_RELOCATEDOSCODE && _DOSCODEHMA) 4642 <1> global init2_disp_msg_asciz_cs_dx 4643 <1> init2_disp_msg_asciz_cs_dx: 4644 <1> assume ds:nothing, es:nothing, ss:nothing 0 000068CE 1E push ds 0 000068CF 56 push si 0 000068D0 50 push ax 0 000068D1 0E push cs 0 000068D2 1F pop ds 4650 <1> assume ds:SYSINITGROUP 0 000068D3 89D6 mov si, dx 0 000068D5 E80400 call init2_disp_msg 0 000068D8 58 pop ax 0 000068D9 5E pop si 0 000068DA 1F pop ds 4656 <1> assume ds:nothing 0 000068DB C3 retn 4658 <1> 4659 <1> init2_disp_msg: 4660 <1> assume ds:nothing, es:nothing, ss:nothing 0 000068DC 50 push ax 4662 <1> @@: 0 000068DD AC lodsb 0 000068DE 84C0 test al, al 0 000068E0 7411 jz @F 0 000068E2 E80200 call init2_disp_al 0 000068E5 EBF6 jmp short @B 4668 <1> 4669 <1> global init2_disp_al 4670 <1> init2_disp_al: 4671 <1> assume ds:nothing, es:nothing, ss:nothing 0 000068E7 50 push ax 0 000068E8 53 push bx 0 000068E9 55 push bp 0 000068EA B40E mov ah, 0Eh 0 000068EC BB0700 mov bx, 7 0 000068EF CD10 int 10h 0 000068F1 5D pop bp 0 000068F2 5B pop bx 4680 <1> @@: 0 000068F3 58 pop ax 0 000068F4 C3 retn 4683 <1> 4684 <1> global init2_disp_dxax_hex 4685 <1> init2_disp_dxax_hex: ; dx:ax 4686 <1> assume ds:nothing, es:nothing, ss:nothing 0 000068F5 92 xchg ax, dx 0 000068F6 E80100 call init2_disp_ax_hex 0 000068F9 92 xchg ax, dx 4690 <1> global init2_disp_ax_hex 4691 <1> init1_disp_ax_hex: ; ax 4692 <1> init2_disp_ax_hex: ; ax 4693 <1> assume ds:nothing, es:nothing, ss:nothing 0 000068FA 86C4 xchg al,ah 0 000068FC E80200 call init2_disp_al_hex ; display former ah 0 000068FF 86C4 xchg al,ah ; and fall trough for al 4697 <1> global init2_disp_al_hex 4698 <1> init2_disp_al_hex: ; al 4699 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006901 51 push cx 0 00006902 B104 mov cl,4 0 00006904 D2C8 ror al,cl 0 00006906 E80300 call init2_disp_al_lownibble_hex; display former high-nibble 0 00006909 D2C0 rol al,cl 0 0000690B 59 pop cx 4706 <1> ; and fall trough for low-nibble 4707 <1> init2_disp_al_lownibble_hex: 4708 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000690C 50 push ax ; save ax for call return 0 0000690D 240F and al,00001111b ; high nibble must be zero 0 0000690F 0430 add al,'0' ; if number is 0-9, now it's the correct character 0 00006911 3C39 cmp al,'9' 0 00006913 7602 jna .decimalnum ; if we get decimal number with this, ok --> 0 00006915 0407 add al,7 ; otherwise, add 7 and we are inside our alphabet 4715 <1> .decimalnum: 0 00006917 E8CDFF call init2_disp_al 0 0000691A 58 pop ax 0 0000691B C3 retn 4719 <1> %endif 4720 <1> 4721 <1> 4722 <1> ; INP: cx = flags 4723 <1> ; dx = indicator if to use UMA only 4724 <1> ; CHG: all except bp 4725 <1> relocate_dosdata: 4726 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000691C 2ED006[0D08] rol byte [cs:dosdata_relocated_to_final_position], 1 0 00006921 7222 jc .ret 4729 <1> 0 00006923 CC int3 4731 <1> %if 0 4732 <1> mov ax, (dosdata_end - dosdata_start) 4733 <1> %else 0 00006924 31C0 xor ax, ax 0 00006926 8ED8 mov ds, ax 4736 <1> assume ds:IVT 0 00006928 A1C600 mov ax, [31h * 4 + 2] 0 0000692B 48 dec ax 0 0000692C 8ED8 mov ds, ax 4740 <1> assume ds:MCB 0 0000692E A10300 mov ax, [mcbSize] 0 00006931 B104 mov cl, 4 0 00006933 D3E0 shl ax, cl 4744 <1> %endif 0 00006935 BE[F021] mov si, alloc_dosdata 4746 <1> 0 00006938 50 push ax 0 00006939 85D2 test dx, dx 0 0000693B 7409 jz @F 0 0000693D 31D2 xor dx, dx 0 0000693F E88701 call allocate_relocate_block.large_upper_only 0 00006942 7305 jnc .allocated 0 00006944 59 pop cx 4754 <1> .ret: 0 00006945 C3 retn 4756 <1> 4757 <1> @@: 0 00006946 E87D01 call allocate_relocate_block 4759 <1> .allocated: ; es:di -> DOSDATA destination 4760 <1> assume es:nothing 0 00006949 59 pop cx 4762 <1> 4763 <1> %if 0 4764 <1> mov ax, 70h 4765 <1> mov ds, ax ; => DOSENTRY 4766 <1> mov bx, word [dosentry_to_dosdata_segment] 4767 <1> ; get DOSDATA segment 4768 <1> %else 0 0000694A 31C0 xor ax, ax 0 0000694C 8ED8 mov ds, ax 4771 <1> assume ds:IVT 0 0000694E 8B1EC600 mov bx, [31h * 4 + 2] 4773 <1> %endif 0 00006952 8EDB mov ds, bx 4775 <1> assume ds:DOSGROUP 0 00006954 31F6 xor si, si ; ds:si -> DOSDATA source 0 00006956 D1E9 shr cx, 1 ; get number of words 0 00006958 F3A5 rep movsw ; move 4779 <1> 4780 <1> %if 0 ; done by DOSREINIT 4781 <1> mov ds, ax 4782 <1> mov word [dosentry_to_dosdata_segment], es 4783 <1> ; DOSDATA reference in DOSENTRY 4784 <1> %if _COMBINED_DOSDATA_DOSCODE 4785 <1> push es 4786 <1> pop ds 4787 <1> mov word [dosdata_to_doscode_segment], es 4788 <1> %endif 4789 <1> xor ax, ax 4790 <1> mov ds, ax 4791 <1> mov word [30h * 4 + 6], es ; DR-DOS compatible DOSDATA reference 4792 <1> %endif 4793 <1> 0 0000695A 8CD0 mov ax, ss 0 0000695C 39D8 cmp ax, bx 0 0000695E 7502 jne @F 0 00006960 06 push es 0 00006961 17 pop ss 4799 <1> assume ss:nothing 4800 <1> @@: 4801 <1> 0 00006962 89DA mov dx, bx ; => old DOSDATA 0 00006964 8CC0 mov ax, es ; => new DOSDATA 0 00006966 E8[0000] invoke DOSREINIT 4805 <1> assume ds:nothing, es:DOSGROUP 4806 <1> 0 00006969 2EF616[0D08] not byte [cs:dosdata_relocated_to_final_position] 4808 <1> 0 0000696E 8EC2 mov es, dx ; => DOSDATA source 4810 <1> assume es:nothing 0 00006970 B449 mov ah, 49h 0 00006972 CD21 int 21h ; free it 0 00006974 C3 retn 4814 <1> 4815 <1> 4816 <1> ; This is to be called after all device drivers are installed. 4817 <1> ; It relocates DOSCODE and DOSDATA. 4818 <1> ; May be extended to relocate more things later. 4819 <1> ; 4820 <1> ; INP: ax = flags 4821 <1> ; CHG: ds, es, si, di, ax, bx, cx, dx 4822 <1> init2_relocate_end: 4823 <1> assume ds:nothing, es:nothing, ss:nothing 4824 <1> lframe 0 4825 <1> lvar word, count 4826 <1> lvar dword, prior 0 00006975 5589E58D66FA lenter 4828 <1> lvar word, flags 0 0000697B 50 push ax 0 0000697C 91 xchg cx, ax ; cx = flags 4831 <1> 0 0000697D B80058 mov ax, 5800h 0 00006980 CD21 int 21h 0 00006982 50 push ax 4835 <1> 0 00006983 31D2 xor dx, dx ; 0 = relocate in any case, LMA if needed 0 00006985 E894FF call relocate_dosdata 4838 <1> 4839 <1> %if !_COMBINED_DOSDATA_DOSCODE && _RELOCATEDOSCODE 4840 <1> 0 00006988 2ED006[1008] rol byte [cs:doscode_relocated_to_final_position], 1 0 0000698D 7278 jc .no_doscode_reloc 4843 <1> 0 0000698F B80158 mov ax, 5801h 0 00006992 BB1001 mov bx, 0110h ; ignore UMB link 0 00006995 CD21 int 21h ; alloc strategy: first fit, LMA only 4847 <1> 0 00006997 F746F80100 test word [bp + ?flags], DOSFLAGS_RELOCATE_DOSCODE_UMA 0 0000699C 7408 jz .got_doscode_strat 4850 <1> 0 0000699E B80158 mov ax, 5801h 0 000069A1 BB8001 mov bx, 0180h ; ignore UMB link 0 000069A4 CD21 int 21h ; alloc strategy: first fit, try UMA then LMA 4854 <1> .got_doscode_strat: 4855 <1> 4856 <1> %if 0 4857 <1> mov ax, 70h 4858 <1> mov ds, ax 4859 <1> mov ds, word [dosentry_to_dosdata_segment] 4860 <1> %else 0 000069A6 31C0 xor ax, ax 0 000069A8 8ED8 mov ds, ax 4863 <1> assume ds:IVT 0 000069AA 8E1EC600 mov ds, word [31h * 4 + 2] ; => DOSDATA 4865 <1> assume ds:DOSGROUP 4866 <1> %endif 0 000069AE 833E[0000]FE cmp word [dosdata_to_doscode_segment], DOSCODE_HMA_SEGMENT 0 000069B3 7352 jae .skip_doscode 4869 <1> 4870 <1> %if 0 4871 <1> mov ax, (doscode_end - doscode_start) 4872 <1> %else 4873 <1> extern afterdoscodelabel 0 000069B5 B8[0000] mov ax, afterdoscodelabel wrt DOSCODEGROUP 0 000069B8 83E850 sub ax, DOSCODE_HMA_OFFSET 4876 <1> %endif 0 000069BB B102 mov cl, S_DOSCODE 0 000069BD E891F5 call init2_alloc_s_mcb 4879 <1> assume es:nothing 4880 <1> 4881 <1> %if 0 4882 <1> mov ax, 70h 4883 <1> mov ds, ax ; => DOSENTRY 4884 <1> mov ds, word [dosentry_to_dosdata_segment] ; => DOSDATA 4885 <1> %else 0 000069C0 31C0 xor ax, ax 0 000069C2 8ED8 mov ds, ax 4888 <1> assume ds:IVT 0 000069C4 8E1EC600 mov ds, word [31h * 4 + 2] ; => DOSDATA 4890 <1> assume ds:DOSGROUP 4891 <1> %endif 0 000069C8 8CC3 mov bx, es 0 000069CA 83EB05 sub bx, DOSCODE_HMA_OFFSET / 16 ; start offset 0 000069CD 8EC3 mov es, bx 4895 <1> assume es:nothing 0 000069CF BF5000 mov di, DOSCODE_HMA_OFFSET ; es:di -> DOSCODE destination 0 000069D2 8B1E[0000] mov bx, word [dosdata_to_doscode_segment] 0 000069D6 8EDB mov ds, bx 4899 <1> assume ds:DOSCODEGROUP 0 000069D8 89FE mov si, di ; ds:si -> DOSCODE source 0 000069DA D1E9 shr cx, 1 ; = number of words 0 000069DC F3A5 rep movsw ; move 4903 <1> 4904 <1> %if 0 4905 <1> mov ds, ax 4906 <1> mov ds, word [dosentry_to_dosdata_segment] 4907 <1> %else 0 000069DE 8ED8 mov ds, ax 4909 <1> assume ds:IVT 0 000069E0 8E1EC600 mov ds, word [31h * 4 + 2] ; => DOSDATA 4911 <1> assume ds:DOSGROUP 4912 <1> %endif 0 000069E4 8C06[0000] mov word [dosdata_to_doscode_segment], es 0 000069E8 B8[0000] mov ax, DOSENTRY 0 000069EB 8ED8 mov ds, ax 4916 <1> assume ds:DOSENTRYGROUP 4917 <1> extern ..@dosentry_doscode_segment 0 000069ED 8C06[0000] mov word [..@dosentry_doscode_segment], es 0 000069F1 2EF616[1008] not byte [cs:doscode_relocated_to_final_position] 4920 <1> assume es:DOSCODEGROUP 4921 <1> 0 000069F6 8CD0 mov ax, ss 0 000069F8 39D8 cmp ax, bx 0 000069FA 7502 jne @F 0 000069FC 06 push es 0 000069FD 17 pop ss 4927 <1> assume ss:DOSCODEGROUP 4928 <1> @@: 4929 <1> assume ss:nothing 4930 <1> 0 000069FE 83C305 add bx, DOSCODE_HMA_OFFSET / 16 ; start offset 0 00006A01 8EC3 mov es, bx ; => DOSCODE source 4933 <1> assume es:nothing 0 00006A03 B449 mov ah, 49h 0 00006A05 CD21 int 21h ; free it 4936 <1> 4937 <1> .skip_doscode: 4938 <1> .no_doscode_reloc: 4939 <1> %endif 4940 <1> assume ds:nothing, es:nothing, ss:nothing 4941 <1> 0 00006A07 5B pop bx 0 00006A08 B80158 mov ax, 5801h 0 00006A0B CD21 int 21h ; alloc strategy: restore 4945 <1> 0 00006A0D 89EC5D lleave 0 00006A10 C3 retn 4948 <1> 4949 <1> 4950 <1> init2_internal_error_reboot_prompt: 0 00006A11 E8C8FE call init2_disp_msg 4952 <1> 4953 <1> init2_reboot_prompt: 0 00006A14 0E push cs 0 00006A15 1F pop ds 4956 <1> assume ds:SYSINITGROUP 0 00006A16 BE[021E] mov si, init2_msg.reboot_prompt ; access with ds 0 00006A19 E8C0FE call init2_disp_msg 4959 <1> .loop: 0 00006A1C CC int3 0 00006A1D 31C0 xor ax, ax 0 00006A1F CD16 int 16h 0 00006A21 EBF9 jmp .loop 4964 <1> 4965 <1> 4966 <1> %if 0 4967 <1> align 4 4968 <1> %include "RxDOSINI.ASM" 4969 <1> 4970 <1> align 16 4971 <1> init2_end: 4972 <1> istruc MCB 4973 <1> at mcbSignature, db "M" 4974 <1> at mcbOwner, dw 8 4975 <1> at mcbSize, dw (init3_end - init3_start) >> 4 4976 <1> at smcbName, dw "S" 4977 <1> at smcbType, db S_INITPSP 4978 <1> iend 4979 <1> 4980 <1> ; section INIT3 align=16 follows=INIT2 vstart=0 4981 <1> init3_start: 4982 <1> istruc PSP 4983 <1> at pspCall0, int 20h 4984 <1> at pspCall5, call 0:(30h * 4) 4985 <1> at pspInt22, dw init3_terminated, 0 ; +2 segment here 4986 <1> at pspInt23, dw i23, 70h 4987 <1> at pspInt24, dw i24, 70h 4988 <1> at pspParent, dw 0 ; +0 segment here 4989 <1> at pspPHT, times pspPHT_size db -1 4990 <1> at pspEnvironment, dw 0 ; +0 env segment here 4991 <1> at pspStack, dw init3_stack.end - 32, 0 ; +2 segment here 4992 <1> at pspPHTEntries, dw pspPHT_size 4993 <1> at pspPHTAddress, dw pspPHT, 0 ; +2 segment here 4994 <1> at pspShareNext, dd -1 4995 <1> at pspVersion, dw RXDOS_MS_VERSION 4996 <1> at pspInt21Far, int 21h 4997 <1> retf 4998 <1> at pspCommandLine 4999 <1> ; iend 5000 <1> %pop ; (pop off the istruc context) 5001 <1> 5002 <1> init3_msg: 5003 <1> .internal_error_terminated: db "init: Internal error, init PSP " 5004 <1> asciz "has been terminated.",13,10 5005 <1> .reboot_prompt: asciz "Halted. Press Ctrl+Alt+Del to reboot.",13,10 5006 <1> 5007 <1> init3_terminated: 5008 <1> cli 5009 <1> cld 5010 <1> mov ax, cs 5011 <1> mov ss, ax 5012 <1> mov sp, init3_stack.end 5013 <1> sti 5014 <1> 5015 <1> push cs 5016 <1> pop ds 5017 <1> mov si, init3_msg.internal_error_terminated 5018 <1> init3_internal_error_reboot_prompt: 5019 <1> call init3_disp_msg 5020 <1> 5021 <1> init3_reboot_prompt: 5022 <1> push cs 5023 <1> pop ds 5024 <1> mov si, init3_msg.reboot_prompt 5025 <1> call init3_disp_msg 5026 <1> .loop: 5027 <1> int3 5028 <1> xor ax, ax 5029 <1> int 16h 5030 <1> jmp .loop 5031 <1> 5032 <1> init3_disp_msg_asciz: 5033 <1> push ds 5034 <1> push si 5035 <1> push ax 5036 <1> push cs 5037 <1> pop ds 5038 <1> mov si, dx 5039 <1> call init3_disp_msg 5040 <1> pop ax 5041 <1> pop si 5042 <1> pop ds 5043 <1> retn 5044 <1> 5045 <1> init3_disp_msg: 5046 <1> push ax 5047 <1> @@: 5048 <1> lodsb 5049 <1> test al, al 5050 <1> jz @F 5051 <1> call init3_disp_al 5052 <1> jmp short @B 5053 <1> 5054 <1> init3_disp_al: 5055 <1> push ax 5056 <1> push bx 5057 <1> push bp 5058 <1> mov ah, 0Eh 5059 <1> mov bx, 7 5060 <1> int 10h 5061 <1> pop bp 5062 <1> pop bx 5063 <1> @@: 5064 <1> pop ax 5065 <1> retn 5066 <1> 5067 <1> 5068 <1> align 16 5069 <1> init3_stack: 5070 <1> times 512 db 0 5071 <1> .end: 5072 <1> 5073 <1> align 16 5074 <1> init3_end: 5075 <1> istruc MCB 5076 <1> at mcbSignature, db "Z" 5077 <1> at mcbOwner, dw 0 5078 <1> at mcbSize, dw 0 5079 <1> iend 5080 <1> 5081 <1> %include "comload.asm" 5082 <1> %endif 5083 <1> 5084 <1> struc ALLOCDATA 0 000048C0 ?? adSMCBType: resb 1 0 000048C1 ?? adSDSign: resb 1 0 000048C2 ???????????????? adHMCBName: resb 8 5088 <1> endstruc 5089 <1> 5090 <1> %imacro allocdata 4.nolist 5091 <1> %1: 5092 <1> istruc ALLOCDATA 5093 <1> at adSMCBType, db %2 5094 <1> at adSDSign, db %3 5095 <1> at adHMCBName, db %4 5096 <1> iend 5097 <1> %endmacro 5098 <1> 0 00006A23 00 align 2, db 0 0 00006A24 0A4653465400 allocdata alloc_sft, S_SFT, DEVMARK_FILES, "SFT" 5100 00002164 <1> 0 00006A2E 0B5846434253465400 allocdata alloc_fcb, S_FCBSFT, DEVMARK_FCBS, "FCBSFT" 5101 0000216E <1> 0 00006A38 0C4242756666657273 allocdata alloc_buffers, S_CCB, DEVMARK_BUF, "Buffers" 0 00006A41 00 0 00006A42 064C43445300 allocdata alloc_cds, S_CDS, DEVMARK_CDS, "CDS" 5103 00002182 <1> 0 00006A4C 0453FF00 allocdata alloc_stack, S_IRQSCODE, DEVMARK_STK, -1 ; not for HMA 0 00006A56 1F00FF00 allocdata alloc_init, S_INIT, 0, -1 0 00006A60 1800FF00 allocdata alloc_initcds, S_INITCDS, 0, -1 0 00006A6A 1900FF00 allocdata alloc_initconfig, S_INITCONFIG, 0, -1 0 00006A74 1D00FF00 allocdata alloc_initpsp, S_INITPSP, 0, -1 0 00006A7E 0900FF00 allocdata alloc_upb_temporary, S_UPB, 0, -1 0 00006A88 090055504200 allocdata alloc_upb, S_UPB, 0, "UPB" 5110 000021C8 <1> 5111 <1> alloc_dpb_temporary: 0 00006A92 0800FF00 allocdata alloc_dpb_no_hma, S_DPB, 0, -1 0 00006A9C 080044504200 allocdata alloc_dpb, S_DPB, 0, "DPB" 5113 000021DC <1> 0 00006AA6 1700496E6953746163 allocdata alloc_initstack, S_INITSTACK, 0, "IniStack" 0 00006AAF 6B 0 00006AB0 0300FF00 allocdata alloc_dosdata, S_DOSDATA, 0, -1 5116 <1> 5117 <1> global alloc_init, alloc_initcds, alloc_initconfig, alloc_dpb_no_hma 5118 <1> global alloc_upb_temporary, alloc_upb 5119 <1> global alloc_dpb_temporary, alloc_dpb 5120 <1> global allocate_relocate_block 5121 <1> global allocate_temporary_block 5122 <1> global allocate_temporary_block.large_allow_error 5123 <1> 5124 <1> align 2, db 0 0 00006ABA 00 db 0 ; pad so start is odd 5126 <1> smcb_template: 0 00006ABB 000000 .: db 0, 0, 0 0 00006ABE 5300 db "S", 0 0 00006AC0 00 times 6 db 0 5130 <1> .end: 5131 <1> .size equ .end - . 5132 <1> 5133 <1> ; INP: cs:si -> data 5134 <1> ; (dx:)ax = bytes needed 5135 <1> ; OUT: es:di -> memory allocated, zeroed 5136 <1> ; di = 0 if not in HMA 5137 <1> allocate_relocate_block: 5138 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006AC6 31D2 xor dx, dx 5140 <1> .large: 5141 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006AC8 A8 db __TEST_IMM8 ; skip stc, NC 5143 <1> .large_upper_only: 0 00006AC9 F9 stc 5145 <1> assume ds:nothing, es:nothing, ss:nothing 5146 <1> lframe 5147 <1> lvar word, parasize 0 00006ACA 5589E550 lenter 5149 <1> lvar word, bit0_upper_only 0 00006ACE 9C pushf 5151 <1> lvar word, data 0 00006ACF 56 push si 5153 <1> lvar dword, size 0 00006AD0 52 push dx 0 00006AD1 50 push ax 5156 <1> 0 00006AD2 2E807C02FF cmp byte [cs:si + adHMCBName], -1 0 00006AD7 7446 je .nothma ; if cannot relocate to HMA --> 0 00006AD9 85D2 test dx, dx ; >= 64 KiB ? 0 00006ADB 7542 jnz .nothma ; cannot fit in the HMA --> 0 00006ADD 93 xchg bx, ax ; bx = how many bytes needed 0 00006ADE BFFFFF mov di, -1 ; harden 0 00006AE1 B92600 mov cx, 26h ; owner 0 00006AE4 B200 mov dl, 0 ; allocate low in the largest free block 0 00006AE6 B8034A mov ax, 4A03h 0 00006AE9 CD2F int 2Fh ; allocate HMA memory block 5167 <1> assume es:nothing 0 00006AEB 83FFFF cmp di, -1 0 00006AEE 742F je .nothma 0 00006AF0 83C7F8 add di, - HMCB_size + hmcbName 5171 <1> ; -> HMCB name field 0 00006AF3 0E push cs 0 00006AF4 1F pop ds 5174 <1> assume ds:SYSINITGROUP 0 00006AF5 83C602 add si, adHMCBName ; -> our data's name field 0 00006AF8 B90400 mov cx, words(8) ; length of name 0 00006AFB F3A5 rep movsw ; es:di -> at data again 0 00006AFD 57 push di 0 00006AFE 31C0 xor ax, ax 0 00006B00 89D9 mov cx, bx 0 00006B02 D1E9 shr cx, 1 ; amount words actually allocated 0 00006B04 F3AB rep stosw 0 00006B06 85FF test di, di 0 00006B08 740F jz @F 0 00006B0A 83FFF0 cmp di, 0FFF0h ; near end ? 0 00006B0D 730A jae @F ; yes --> 0 00006B0F BFFEFF mov di, 0FFFEh ; no, address with segment 0FFFEh instead 0 00006B12 8EC7 mov es, di ; es => HMA 5189 <1> assume es:nothing 0 00006B14 5F pop di 0 00006B15 83C710 add di, 10h ; -> allocation in segment 0FFFEh 0 00006B18 A8 db __TEST_IMM8 ; (skip pop) 5193 <1> @@: 0 00006B19 5F pop di ; es:di -> allocated memory block 5195 <1> .ret_NC: 0 00006B1A F8 clc 5197 <1> .ret: 0 00006B1B 89EC5D lleave code 0 00006B1E C3 retn 5200 <1> 5201 <1> .nothma: 0 00006B1F B80058 mov ax, 5800h 0 00006B22 CD21 int 21h ; get strategy 0 00006B24 50 push ax 0 00006B25 B80158 mov ax, 5801h 0 00006B28 BB4101 mov bx, 0141h ; UMA only, best fit, ignore UMB link status 0 00006B2B CD21 int 21h ; set strategy 5208 <1> 0 00006B2D 8B56F8 mov dx, word [bp + ?size + 2] 0 00006B30 8B46F6 mov ax, word [bp + ?size] 0 00006B33 83C00F add ax, 15 ; round up 0 00006B36 83D200 adc dx, 0 5213 <1> .err_CY: 0 00006B39 7303E9[0000] jc MEM_ERR 5215 <1> 0 00006B3E B90400 mov cx, 4 5217 <1> @@: 0 00006B41 D1EA shr dx, 1 0 00006B43 D1D8 rcr ax, 1 0 00006B45 E2FA loop @B 0 00006B47 85D2 test dx, dx ; >= 1 MiB ? 0 00006B49 F9 stc 0 00006B4A 75ED jnz .err_CY ; error --> 5224 <1> 0 00006B4C 8946FE mov word [bp + ?parasize], ax 0 00006B4F 93 xchg bx, ax 0 00006B50 B448 mov ah, 48h 0 00006B52 CD21 int 21h 0 00006B54 7322 jnc .success 5230 <1> 0 00006B56 F646FC01 testopt [bp + ?bit0_upper_only], 1 0 00006B5A 740B jz .trylma 0 00006B5C 5B pop bx 0 00006B5D B80158 mov ax, 5801h 0 00006B60 CD21 int 21h ; restore strategy 5236 <1> 0 00006B62 0E push cs 0 00006B63 1F pop ds 5239 <1> assume ds:SYSINITGROUP 0 00006B64 F9 stc 0 00006B65 EBB4 jmp .ret 5242 <1> 5243 <1> .trylma: 5244 <1> assume ds:nothing 0 00006B67 B80158 mov ax, 5801h 0 00006B6A BB8001 mov bx, 0180h ; UMA then LMA, first fit, ignore UMB link status 0 00006B6D CD21 int 21h ; set strategy 5248 <1> 0 00006B6F 8B5EFE mov bx, word [bp + ?parasize] 0 00006B72 B448 mov ah, 48h 0 00006B74 CD21 int 21h 0 00006B76 7257 jc .fail 5253 <1> 5254 <1> .success: 0 00006B78 50 push ax ; => UMA memory block 0 00006B79 48 dec ax 0 00006B7A 8EC0 mov es, ax ; => UMCB 5258 <1> assume es:MCB 0 00006B7C BF0500 mov di, mcbReserved ; -> UMCB reserved field 0 00006B7F 0E push cs 0 00006B80 1F pop ds 5262 <1> assume ds:SYSINITGROUP 0 00006B81 8A04 mov al, byte [si + adSMCBType] 5264 <1> ; al = S MCB type 0 00006B83 BE[FB21] mov si, smcb_template ; -> our template 0 00006B86 B90B00 mov cx, smcb_template.size 0 00006B89 26C70601000800 mov word [es:mcbOwner], 8 5268 <1> ; MCB owner = 8 (system) 0 00006B90 F3A4 rep movsb 0 00006B92 26A20A00 mov byte [es:smcbType], al 5271 <1> ; set the type 5272 <1> 0 00006B96 07 pop es ; => UMA memory block 5274 <1> assume es:nothing 0 00006B97 31FF xor di, di ; -> start of allocation 0 00006B99 89D9 mov cx, bx ; size in paras 5277 <1> 0 00006B9B 5B pop bx 0 00006B9C B80158 mov ax, 5801h 0 00006B9F CD21 int 21h ; restore strategy 5281 <1> 0 00006BA1 89CB mov bx, cx ; = amount paragraphs 5283 <1> 5284 <1> .ret_init_bx: 0 00006BA3 06 push es 0 00006BA4 57 push di 5287 <1> 5288 <1> @@: 0 00006BA5 B90080 mov cx, 8000h ; words in 64 KiB 0 00006BA8 81EB0010 sub bx, 1000h ; another 64 KiB ? 0 00006BAC 730D jae @F ; yes --> 0 00006BAE 80C710 add bh, 10h ; restore bx 0 00006BB1 31C9 xor cx, cx ; cx = 0 0 00006BB3 87D9 xchg bx, cx ; bx = 0, cx = amount paragraphs 0 00006BB5 D1E1 shl cx, 1 0 00006BB7 D1E1 shl cx, 1 0 00006BB9 D1E1 shl cx, 1 ; cx = amount words 5298 <1> @@: 0 00006BBB 31C0 xor ax, ax 0 00006BBD F3AB rep stosw ; zero the memory 0 00006BBF 8CC0 mov ax, es 0 00006BC1 050010 add ax, 1000h 0 00006BC4 8EC0 mov es, ax ; => next segment (skip 64 KiB) 5304 <1> assume es:nothing 0 00006BC6 85DB test bx, bx ; any remaining ? 0 00006BC8 75DB jnz @BB ; yes --> 5307 <1> 0 00006BCA 5F pop di 0 00006BCB 07 pop es ; -> back at start 5310 <1> assume es:nothing 0 00006BCC E94BFF jmp .ret_NC 5312 <1> 5313 <1> .fail: 0 00006BCF 5B pop bx 0 00006BD0 B80158 mov ax, 5801h 0 00006BD3 CD21 int 21h ; restore strategy 5317 <1> 0 00006BD5 0E push cs 0 00006BD6 1F pop ds 5320 <1> assume ds:SYSINITGROUP 5321 <1> %if 0 5322 <1> INVOKE ROUND 5323 <1> mov al, [si + adSDSign] 5324 <1> ; cmp al, 1 5325 <1> ; jb .err_CY 5326 <1> call SetDevMark 5327 <1> mov bx, [bp + ?parasize] 5328 <1> les di, [ss:MEMLO] ; es:di -> allocated data block 5329 <1> add word [ss:MEMHI], bx ; size in paragraphs 5330 <1> or byte [ss:SetDevMarkFlag], FOR_DEVMARK 5331 <1> INVOKE ROUND ; allocate, will error out if not enough 5332 <1> jmp .ret_init_bx 5333 <1> %else 5334 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006BD7 E9[0000] jmp MEM_ERR 5336 <1> %endif 5337 <1> 5338 <1> lleave ctx 5339 <1> 5340 <1> 5341 <1> ; INP: cs:si -> data 5342 <1> ; (dx:)ax = bytes needed 5343 <1> ; OUT: es:di -> memory allocated, zeroed 5344 <1> ; di = 0 5345 <1> ; ds = cs 5346 <1> allocate_temporary_block: 5347 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006BDA 31D2 xor dx, dx 5349 <1> .large: 5350 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006BDC A8 db __TEST_IMM8 ; skip stc, NC 5352 <1> .large_allow_error: 0 00006BDD F9 stc 5354 <1> assume ds:nothing, es:nothing, ss:nothing 5355 <1> lframe 5356 <1> lvar word, parasize 0 00006BDE 5589E550 lenter 5358 <1> lvar word, bit0_allow_error 0 00006BE2 9C pushf 5360 <1> lvar word, data 0 00006BE3 56 push si 5362 <1> lvar dword, size 0 00006BE4 52 push dx 0 00006BE5 50 push ax 5365 <1> 0 00006BE6 B80058 mov ax, 5800h 0 00006BE9 CD21 int 21h ; get strategy 0 00006BEB 50 push ax 0 00006BEC B80158 mov ax, 5801h 0 00006BEF BB2205 mov bx, 0522h ; LMA then UMA as two areas, 5371 <1> ; last fit, ignore UMB link status 0 00006BF2 CD21 int 21h ; set strategy 5373 <1> 0 00006BF4 8B56F8 mov dx, word [bp + ?size + 2] 0 00006BF7 8B46F6 mov ax, word [bp + ?size] 0 00006BFA 83C00F add ax, 15 ; round up 0 00006BFD 83D200 adc dx, 0 5378 <1> .err_CY: 0 00006C00 7303E9[0000] jc MEM_ERR 5380 <1> 0 00006C05 B90400 mov cx, 4 5382 <1> @@: 0 00006C08 D1EA shr dx, 1 0 00006C0A D1D8 rcr ax, 1 0 00006C0C E2FA loop @B 0 00006C0E 85D2 test dx, dx ; >= 1 MiB ? 0 00006C10 F9 stc 0 00006C11 75ED jnz .err_CY ; error --> 5389 <1> 0 00006C13 8946FE mov word [bp + ?parasize], ax 0 00006C16 93 xchg bx, ax 0 00006C17 B448 mov ah, 48h 0 00006C19 CD21 int 21h 0 00006C1B 7312 jnc .success 0 00006C1D F646FC01 test byte [bp + ?bit0_allow_error], 1 0 00006C21 F9 stc 0 00006C22 74DC jz .err_CY 5398 <1> 0 00006C24 5B pop bx 0 00006C25 B80158 mov ax, 5801h 0 00006C28 CD21 int 21h ; restore strategy 5402 <1> 0 00006C2A 0E push cs 0 00006C2B 1F pop ds 5405 <1> assume ds:SYSINITGROUP 0 00006C2C F9 stc 0 00006C2D EB54 jmp .ret 5408 <1> 5409 <1> .success: 5410 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006C2F 50 push ax ; => LMA memory block 0 00006C30 48 dec ax 0 00006C31 8EC0 mov es, ax ; => LMCB 5414 <1> assume es:MCB 0 00006C33 BF0500 mov di, mcbReserved ; -> LMCB reserved field 0 00006C36 0E push cs 0 00006C37 1F pop ds ; ! ds = cs 5418 <1> assume ds:SYSINITGROUP 0 00006C38 8A04 mov al, byte [si + adSMCBType] 5420 <1> ; al = S MCB type 0 00006C3A BE[FB21] mov si, smcb_template ; -> our template 0 00006C3D B90B00 mov cx, smcb_template.size 0 00006C40 26C70601000800 mov word [es:mcbOwner], 8 5424 <1> ; MCB owner = 8 (system) 0 00006C47 F3A4 rep movsb 0 00006C49 26A20A00 mov byte [es:smcbType], al 5427 <1> ; set the type 5428 <1> 0 00006C4D 07 pop es ; => LMA memory block 5430 <1> assume es:nothing 0 00006C4E 31FF xor di, di ; -> start of allocation 0 00006C50 89D9 mov cx, bx ; size in paras 5433 <1> 0 00006C52 5B pop bx 0 00006C53 B80158 mov ax, 5801h 0 00006C56 CD21 int 21h ; restore strategy 5437 <1> 0 00006C58 89CB mov bx, cx ; = amount paragraphs 5439 <1> 0 00006C5A 06 push es 0 00006C5B 57 push di 5442 <1> 5443 <1> @@: 0 00006C5C B90080 mov cx, 8000h ; words in 64 KiB 0 00006C5F 81EB0010 sub bx, 1000h ; another 64 KiB ? 0 00006C63 730D jae @F ; yes --> 0 00006C65 80C710 add bh, 10h ; restore bx 0 00006C68 31C9 xor cx, cx ; cx = 0 0 00006C6A 87D9 xchg bx, cx ; bx = 0, cx = amount paragraphs 0 00006C6C D1E1 shl cx, 1 0 00006C6E D1E1 shl cx, 1 0 00006C70 D1E1 shl cx, 1 ; cx = amount words 5453 <1> @@: 0 00006C72 31C0 xor ax, ax 0 00006C74 F3AB rep stosw ; zero the memory 0 00006C76 8CC0 mov ax, es 0 00006C78 050010 add ax, 1000h 0 00006C7B 8EC0 mov es, ax ; => next segment (skip 64 KiB) 5459 <1> assume es:nothing 0 00006C7D 85DB test bx, bx ; any remaining ? (NC) 0 00006C7F 75DB jnz @BB ; yes --> 5462 <1> 0 00006C81 5F pop di 0 00006C82 07 pop es ; -> back at start 5465 <1> assume es:nothing 5466 <1> .ret: 0 00006C83 89EC5D lleave 0 00006C86 C3 retn 4781 4782 sysinit_msg: 0 00006C87 5761726E696E673A20 .warn_upb: db "Warning: init unable to relocate UPBs!",13,10 0 00006C90 696E697420756E6162 0 00006C99 6C6520746F2072656C 0 00006CA2 6F6361746520555042 0 00006CAB 73210D0A 4784 .warn_upb.size: equ $ - .warn_upb 0 00006CAF 5761726E696E673A20 .warn_dpb: db "Warning: init unable to relocate DPBs!",13,10 0 00006CB8 696E697420756E6162 0 00006CC1 6C6520746F2072656C 0 00006CCA 6F6361746520445042 0 00006CD3 73210D0A 4786 .warn_dpb.size: equ $ - .warn_dpb 0 00006CD7 00 .nullbyte: db 0 4788 4789 END === Trace listing source: sysconf.lst 1 ; PAGE ,132 ; 2 ; SCCSID = @(#)sysconf.asm 0.0 86/10/20 3 ;TITLE BIOS SYSTEM INITIALIZATION 4 %warning out: ...SYSCONF 4 ****************** warning: out: ...SYSCONF [-w+user] 5 6 ;============================================================================== 7 ;REVISION HISTORY: 8 ;AN000 - New for DOS Version 4.00 - J.K. 9 ;AC000 - Changed for DOS Version 4.00 - J.K. 10 ;AN00x - PTM number for DOS Version 4.00 - J.K. 11 ;============================================================================== 12 ;AN001; P132 Multiple character device installation problem. 06/27/87 J.K. 13 ;AN002; D24 MultiTrack= command added. 06/29/87 J.K. 14 ;AN003; D41 REM command in CONFIG.SYS. 07/6/87 J.K. 15 ;AN004; D184 Set DEVMARK for MEM command 08/25/87 J.K. 16 ;AN005; P568 CONFIG.SYS parsing error with FCBS=10,15 08/31/87 J.K. 17 ;AN006; P887 STACKS=0 does not show "ERROR in CONFIG.SYS..." 09/09/87 J.K. 18 ;AN007; D246, P976 Show "Bad command or parameters - ..." msg 09/22/87 J.K. 19 ;AN008; P1299 Set the second entry of DEVMARK for MEM command 09/25/87 J.K. 20 ;AN009; P1326 New Extended attribute 09/28/87 J.K. 21 ;AN010; P1820 New message SKL file 10/20/87 J.K. 22 ;AN011; P1970 AUTOTEST FCBS= command error msg inconsistent 10/23/87 J.K. 23 ;AN012; P2211 Setting the EA=7 for ANSI.SYS hangs the system 11/02/87 J.K. 24 ;AN013; P2342 REM not allowed after INSTALL command 11/09/87 J.K. 25 ;AN014; P2546 DEVICE= command still allowed after IFS= 11/17/87 J.K. 26 ;AN015; D358 New device driver INIT function package 12/03/87 J.K. 27 ;AN016; D285 Undo the extended error handling 12/17/87 J.K. 28 ;AN017; P3170 Do not call block device driver when drive # > 26 01/20/88 J.K. 29 ;AN018; P3111 Take out the order dependency of the INSTALL= 01/25/88 J.K. 30 ;AN019; D479 New option to disable extended INT 16h function call 02/12/88 J.K. 31 ;AN020; P3607 MEM does not give correct filename 02/24/88 J.K. 32 ;AN021; D493 Undo D358 & do not show error message for device driv 02/24/88 J.K. 33 ;AN022; P3807 Single buffer unprotected - System hangs 03/10/88 J.K. 34 ;AN023; P3797 An INSTALL cmd right after Bad cmd is not executed 03/10/88 J.K. 35 ;AN024; D503 Version change to 4.0 - IBMCACHE.SYS is an exception 03/15/88 J.K. 36 ;AN025; D474 Change BUFFERS= /E option to /X for expanded memory 03/16/88 J.K. 37 ;AN026; D506 Take out the order dependency of the IFS= 03/28/88 J.K. 38 ;AN027; P3957 Undo D503 - IBMCACHE.SYS version check problem 03/30/88 J.K. 39 ;AN028; P4086 Memory allocation error when loading share.exe 03/31/88 J.K. 40 ;AN029; D528 Install XMAEM.SYS first before everything else 04/29/88 J.K. 41 ;AN030; P4759 INT2f, INT 67h handlers for XMA 05/11/88 J.K. 42 ;AN031; P4889 Should check the validity of INT 67h call 05/17/88 G.A. 43 ;AN032; P4934 P4759 INT 2fh number should be changed to 1Bh 05/20/88 J.K. 44 ;AN033; P5002 EMS w/single page allocated now works 05/20/88 G.A. 45 ;AN034; P5128 EMS INT 2FH HANDLER BUG 06/24/88 46 ;============================================================================== 47 48 TRUE EQU 0FFFFh 49 FALSE EQU 0 50 LF equ 10 51 CR equ 13 52 TAB equ 9 53 SEMICOLON equ ';' 54 55 IBMVER EQU TRUE 56 IBM EQU IBMVER 57 STACKSW EQU TRUE ;Include Switchable Hardware Stacks 58 IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 59 %iassign MSVER FALSE 60 ALTVECT EQU FALSE ;Switch to build ALTVECT version 61 KANJI EQU FALSE 62 63 HAVE_INSTALL_CMD equ 00000001b ;AN018; CONFIG.SYS has INSTALL= commands 64 HAS_INSTALLED equ 00000010b ;AN018; SYSINIT_BASE installed. 65 66 IS_IFS equ 00000001b ;IFS command? 67 NOT_IFS equ 11111110b 68 ; 69 ;AN016; Undo the extended attribute handling 70 ;;Extended attribute value 71 ;EA_UNSPECIFIED equ 0 ;AN009; 72 ;EA_DEVICE_DRIVER equ 6 ;AN009; 73 ;EA_IFS_DRIVER equ 7 ;AN009; 74 75 DEFAULT_FILENUM equ 8 76 ; 77 %IF IBMJAPVER 78 NOEXEC EQU TRUE 79 %ELSE 80 NOEXEC EQU FALSE 81 %ENDIF 82 83 ;DOSSIZE EQU 0A000H 84 ;dossize equ 0C000H ;J.K. for the debugging version of IBMDOS. 85 86 [list -] 86 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 86 ****************** warning: out: BPB.INC... [-w+user] 86 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 86 ****************** warning: out: DEVSYM.INC... [-w+user] 86 ****************** warning: out: IOCTL.INC... [-w+user] 86 ****************** warning: out: BPB.INC... [-w+user] 86 ****************** warning: out: BIOSTRUC.INC... [-w+user] 86 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 86 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <3> [list -] 14 <2> [list -] 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 97 %include "lstruct.mac" 1 <1> [list -] 13 <1> [list -] 98 [list +] 99 100 %IFN IBMJAPVER 101 EXTRN RE_INIT:FAR 102 %ENDIF 103 104 ; 105 106 ;J.K. 6/29/87 External variable defined in IBMBIO module for Multi-track 107 MULTRK_ON EQU 10000000B ;User spcified Mutitrack=on, or System turns 108 ; it on after handling CONFIG.SYS file as a 109 ; default value, if MulTrk_flag = MULTRK_OFF1. 110 MULTRK_OFF1 EQU 00000000B ;initial value. No "Multitrack=" command entered. 111 MULTRK_OFF2 EQU 00000001B ;User specified Multitrack=off. 112 === Switch to base=000000h -> "DOSENTRY" 113 section DOSENTRY 114 EXTRN MulTrk_flag:word ;AN002; 115 extrn KEYRD_Func:byte ;AN019; 116 extrn KEYSTS_Func:byte ;AN019; 117 ; (no prior section) ; CODE ends 118 ;J.K. 6/29/87 End of Multi-track definition. 119 === Switch to base=00C400h -> "SYSINITSEG" 120 section SYSINITSEG PUBLIC class=INIT === Switch to base=00C400h -> "SYSINITSEG" 121 section SYSINITSEG 122 align 16, db 0 123 124 ASSUME CS:SYSINITSEG,DS:NOTHING,ES:NOTHING,SS:NOTHING 125 126 extern alloc_initconfig, alloc_dpb_no_hma 127 extern allocate_relocate_block 128 extern allocate_temporary_block 129 extern allocate_temporary_block.large_allow_error 130 extern ParaRound, alloc_init 131 extern sysinit_get_ds_dosbiodata 132 133 EXTRN BADOPM:BYTE,CRLFM:BYTE,BADCOM:BYTE,BADMEM:BYTE,BADBLOCK:BYTE 134 EXTRN BADSIZ_PRE:BYTE,BADLD_PRE:BYTE 135 ; EXTRN BADSIZ_POST:BYTE,BADLD_POST:BYTE 136 EXTRN BADSTACK:BYTE,BADCOUNTRYCOM:BYTE 137 EXTRN SYSSIZE:BYTE,BADCOUNTRY:BYTE,INSUFMEMORY:BYTE 138 extern config_overflow 139 EXTRN CONDEV:BYTE,AUXDEV:BYTE,PRNDEV:BYTE,COMMND:BYTE,CONFIG:BYTE 140 EXTRN Cntry_Drv:BYTE,Cntry_Root:BYTE,Cntry_Path:BYTE 141 EXTRN DeviceParameters:byte 142 EXTRN MEMORY_SIZE:word 143 EXTRN BUFFERS:word 144 EXTRN FILES:byte,NUM_CDS:byte 145 EXTRN DOSINFO:dword,ENTRY_POINT:dword 146 EXTRN FCBS:byte,KEEP:byte 147 EXTRN config_block:word,COMMAND_LINE:byte 148 EXTRN ZERO:byte,SEPCHR:byte 149 EXTRN COUNT:word,CHRPTR:word,CNTRYFILEHANDLE:word 150 EXTRN MEMLO:word,MEMHI:word,PRMBLK:word 151 EXTRN PACKET:byte,UNITCOUNT:byte,BREAK_ADDR:dword 152 EXTRN BPB_ADDR:dword,DRIVENUMBER:byte,SYSI_COUNTRY:dword 153 extrn Config_Size:word ;AN000; 154 extrn Install_Flag:word ;AN000; 155 extrn BadOrder:byte ;AN000; 156 extrn Errorcmd:byte ;AN000; 157 extrn LineCount:word ;AN000; 158 extrn ShowCount:byte ;AN000; 159 extrn Buffer_LineNum:word ;AN000; 160 extrn IFS_Flag:word ;AN000; 161 extrn IFS_RH:byte ;AN000; 162 extrn H_Buffers:word ;AN000; 163 extrn Buffer_Slash_X:byte ;AN000;AN025; 164 extrn Badparm:byte ;AN007; 165 extrn ConfigMsgFlag:Word ;AN015; 166 extrn Org_Count:Word ;AN018; 167 extrn Multi_Pass_Id:byte ;AN026; 168 169 EXTRN MEM_ERR:NEAR,SetDOSCountryInfo:NEAR 170 EXTRN PARAROUND:NEAR,TEMPCDS_after_block_device:NEAR 171 EXTRN Set_Country_Path:NEAR,Move_ASCIIZ:NEAR,DELIM:NEAR 172 EXTRN BADFIL:NEAR,ROUND:NEAR 173 extrn Do_Install_Exec:NEAR ;AN018; 174 extrn SetDevMark:NEAR ;AN030; 175 extern init2_SNextMCB 176 177 ;AN016; Undo the extended attribute handling 178 ; extrn Get_Ext_Attribute:near ;AN009; 179 180 %IF STACKSW 181 182 ; Internal Stack Parameters 183 EntrySize equ 8 184 185 MinCount equ 8 186 DefaultCount equ 9 187 MaxCount equ 64 188 189 MinSize equ 32 190 DefaultSize equ 128 191 MaxSize equ 512 192 193 extrn stack_count:word 194 extrn stack_size:word 195 extrn stack_addr:dword 196 197 %ENDIF 198 199 PUBLIC DOCONF 200 PUBLIC GETCHR 201 public Multi_Pass ;AN018;AN026; 202 203 public MultDeviceFlag 0 00000B20 00 MultDeviceFlag db 0 ;AN001; 205 public DevMark_Addr 0 00000B21 ???? DevMark_Addr dw ? ;AN004;Segment address for DEVMARK. 207 public SetDevMarkFlag 0 00000B23 00 SetDevMarkFlag db 0 ;AN004;Flag used for DEVMARK 209 210 %ifndef BUF2 211 EMS_Stub_Installed db 0 ;AN030; 212 %endif 213 214 Badparm_Ptr label dword 0 00000B24 0000 Badparm_Off dw 0 ;AN007; 0 00000B26 0000 Badparm_Seg dw 0 ;AN007; 217 218 global devicehighflag, devicehighdata, devicehighafter, devicehighsd 219 global deviceafter, shellhighflag 220 global altah_option, configmsg.altah_message, configmsg.altah_message.error 221 global devicefirstnewdpb, devicefirstnewdrive, deviceamountnew 222 0 00000B28 0000 country_block: dw 0 0 00000B2A 0000 CONFIG_used: dw 0 0 00000B2C 0000 devicefilesizepara: dw 0 0 00000B2E 0000 devicehighsd: dw 0 0 00000B30 0000 devicehighdata: dw 0 0 00000B32 0000 devicehighsize: dw 0 0 00000B34 0000 devicehighafter: dw 0 0 00000B36 0000 deviceafter: dw 0 0 00000B38 FFFFFFFF devicelastdpb: dd -1 0 00000B3C FFFFFFFF devicefirstnewdpb: dd -1 0 00000B40 00 deviceamountnew: db 0 0 00000B41 00 devicefirstnewdrive: db 0 0 00000B42 00 devicehighflag: db 0 0 00000B43 00 shellhighflag: db 0 0 00000B44 00 altah_option: db 0 238 global hidedosentry_option, hidedosdatafirst_option 0 00000B45 00 hidedosentry_option: db 0 0 00000B46 00 hidedosdatafirst_option:db 0 0 00000B47 00 align 2, db 0 242 global autobounce_both_options, autobouncehmachs_option, autobouncehmalba_option 243 autobounce_both_options: 0 00000B48 FF autobouncehmachs_option:db -1 0 00000B49 FF autobouncehmalba_option:db -1 246 global enlargelma_option 0 00000B4A FF enlargelma_option: db -1 0 00000B4B 00 installasfirst_option: db 0 0 00000B4C 00 installaslast_option: db 0 250 global preservecds_option 0 00000B4D FF preservecds_option: db -1 252 global reinitcds_option 0 00000B4E 00 reinitcds_option: db 0 254 255 extern dosdata_relocate_first, dosdata_relocate_early 256 257 struc COMPATOPTION 0 00000B20 ???? coSetOrClear: resw 1 0 00000B22 ???? coPriorSegment: resw 1 ; 0 = sysinit, 1 = DOSDATA 0 00000B24 ???? coAlwaysClear: resw 1 0 00000B26 ???? coNoMessage: resw 1 0 00000B28 ???? coYesMessage: resw 1 263 endstruc 264 0 00000B4F 00 align 2, db 0 266 compatoptionstable: 267 istruc COMPATOPTION 0 00000B50 [2400] at coSetOrClear, dw altah_option 0 00000B52 00[0C01] at coNoMessage, dw configmsg.noaltah 0 00000B58 [0E01] at coYesMessage, dw configmsg.altah 271 iend 272 istruc COMPATOPTION 0 00000B5A [0000] at coSetOrClear, dw dosdata_relocate_first 0 00000B5C 00[EE00] at coNoMessage, dw configmsg.nodosdatafirst 0 00000B62 [F000] at coYesMessage, dw configmsg.dosdatafirst 276 iend 277 istruc COMPATOPTION 0 00000B64 [0000] at coSetOrClear, dw dosdata_relocate_early 0 00000B66 00[FD00] at coNoMessage, dw configmsg.nodosdataearly 0 00000B6C [FF00] at coYesMessage, dw configmsg.dosdataearly 281 iend 282 283 extern config_bounce_hma_chs 284 extern config_bounce_hma_lba 285 istruc COMPATOPTION 0 00000B6E [0000] at coSetOrClear, dw config_bounce_hma_chs 0 00000B70 0100 at coPriorSegment, dw 1 0 00000B72 [2800] at coAlwaysClear, dw autobouncehmachs_option 0 00000B74 [1401] at coNoMessage, dw configmsg.nobouncehmachs 0 00000B76 [1601] at coYesMessage, dw configmsg.bouncehmachs 291 iend 292 istruc COMPATOPTION 0 00000B78 [2800] at coSetOrClear, dw autobouncehmachs_option 0 00000B7A 00[3201] at coYesMessage, dw configmsg.autobouncehmachs 295 iend 296 istruc COMPATOPTION 0 00000B82 [0000] at coSetOrClear, dw config_bounce_hma_lba 0 00000B84 0100 at coPriorSegment, dw 1 0 00000B86 [2900] at coAlwaysClear, dw autobouncehmalba_option 0 00000B88 [2301] at coNoMessage, dw configmsg.nobouncehmalba 0 00000B8A [2501] at coYesMessage, dw configmsg.bouncehmalba 302 iend 303 istruc COMPATOPTION 0 00000B8C [2900] at coSetOrClear, dw autobouncehmalba_option 0 00000B8E 00[4301] at coYesMessage, dw configmsg.autobouncehmalba 306 iend 307 308 extern config_bounce_uma_chs 309 extern config_bounce_uma_lba 310 istruc COMPATOPTION 0 00000B96 [0000] at coSetOrClear, dw config_bounce_uma_chs 0 00000B98 0100 at coPriorSegment, dw 1 0 00000B9A 00[5401] at coNoMessage, dw configmsg.nobounceumachs 0 00000B9E [5601] at coYesMessage, dw configmsg.bounceumachs 315 iend 316 istruc COMPATOPTION 0 00000BA0 [0000] at coSetOrClear, dw config_bounce_uma_lba 0 00000BA2 0100 at coPriorSegment, dw 1 0 00000BA4 00[6301] at coNoMessage, dw configmsg.nobounceumalba 0 00000BA8 [6501] at coYesMessage, dw configmsg.bounceumalba 321 iend 322 323 extern config_bounce_any_chs 324 extern config_bounce_any_lba 325 istruc COMPATOPTION 0 00000BAA [0000] at coSetOrClear, dw config_bounce_any_chs 0 00000BAC 0100 at coPriorSegment, dw 1 0 00000BAE 00[7201] at coNoMessage, dw configmsg.nobounceanychs 0 00000BB2 [7401] at coYesMessage, dw configmsg.bounceanychs 330 iend 331 istruc COMPATOPTION 0 00000BB4 [0000] at coSetOrClear, dw config_bounce_any_lba 0 00000BB6 0100 at coPriorSegment, dw 1 0 00000BB8 00[8101] at coNoMessage, dw configmsg.nobounceanylba 0 00000BBC [8301] at coYesMessage, dw configmsg.bounceanylba 336 iend 337 istruc COMPATOPTION 0 00000BBE [2500] at coSetOrClear, dw hidedosentry_option 0 00000BC0 00[9001] at coNoMessage, dw configmsg.nohidedosentry 0 00000BC6 [9201] at coYesMessage, dw configmsg.hidedosentry 341 iend 342 istruc COMPATOPTION 0 00000BC8 [2600] at coSetOrClear, dw hidedosdatafirst_option 0 00000BCA 00[9F01] at coNoMessage, dw configmsg.nohidedosdatafirst 0 00000BD0 [A101] at coYesMessage, dw configmsg.hidedosdatafirst 346 iend 347 istruc COMPATOPTION 0 00000BD2 [2A00] at coSetOrClear, dw enlargelma_option 0 00000BD4 00[B201] at coNoMessage, dw configmsg.noenlargelma 0 00000BDA [B401] at coYesMessage, dw configmsg.enlargelma 351 iend 352 istruc COMPATOPTION 0 00000BDC [2A00] at coSetOrClear, dw enlargelma_option 354 ; ! yes and no reversed, protect first UMCB means no enlarge LMA 0 00000BDE 00[C101] at coNoMessage, dw configmsg.protectfirstumcb 0 00000BE4 [BF01] at coYesMessage, dw configmsg.noprotectfirstumcb 357 iend 358 istruc COMPATOPTION 0 00000BE6 [2B00] at coSetOrClear, dw installasfirst_option 0 00000BE8 00[D201] at coNoMessage, dw configmsg.noinstallasfirst 0 00000BEE [D401] at coYesMessage, dw configmsg.installasfirst 362 iend 363 istruc COMPATOPTION 0 00000BF0 [2C00] at coSetOrClear, dw installaslast_option 0 00000BF2 00[E301] at coNoMessage, dw configmsg.noinstallaslast 0 00000BF8 [E501] at coYesMessage, dw configmsg.installaslast 367 iend 368 istruc COMPATOPTION 0 00000BFA [2D00] at coSetOrClear, dw preservecds_option 0 00000BFC 00[F301] at coNoMessage, dw configmsg.nopreservecds 0 00000C02 [F501] at coYesMessage, dw configmsg.preservecds 372 iend 373 istruc COMPATOPTION 0 00000C04 [2E00] at coSetOrClear, dw reinitcds_option 0 00000C06 00[0102] at coNoMessage, dw configmsg.noreinitcds 0 00000C0C [0302] at coYesMessage, dw configmsg.reinitcds 377 iend 378 .end: 379 380 configmsg: 0 00000C0E 4E4F .nodosdatafirst: db "NO" 0 00000C10 444F53444154414649 .dosdatafirst: asciz "DOSDATAFIRST" 0 00000C19 52535400 0 00000C1D 4E4F .nodosdataearly: db "NO" 0 00000C1F 444F53444154414541 .dosdataearly: asciz "DOSDATAEARLY" 0 00000C28 524C5900 0 00000C2C 4E4F .noaltah: db "NO" 0 00000C2E 414C54414800 .altah: asciz "ALTAH" 0 00000C34 4E4F .nobouncehmachs: db "NO" 0 00000C36 424F554E4345484D41 .bouncehmachs: asciz "BOUNCEHMACHS" 0 00000C3F 43485300 0 00000C43 4E4F .nobouncehmalba: db "NO" 0 00000C45 424F554E4345484D41 .bouncehmalba: asciz "BOUNCEHMALBA" 0 00000C4E 4C424100 0 00000C52 4155544F424F554E43 .autobouncehmachs: asciz "AUTOBOUNCEHMACHS" 0 00000C5B 45484D4143485300 0 00000C63 4155544F424F554E43 .autobouncehmalba: asciz "AUTOBOUNCEHMALBA" 0 00000C6C 45484D414C424100 0 00000C74 4E4F .nobounceumachs: db "NO" 0 00000C76 424F554E4345554D41 .bounceumachs: asciz "BOUNCEUMACHS" 0 00000C7F 43485300 0 00000C83 4E4F .nobounceumalba: db "NO" 0 00000C85 424F554E4345554D41 .bounceumalba: asciz "BOUNCEUMALBA" 0 00000C8E 4C424100 0 00000C92 4E4F .nobounceanychs: db "NO" 0 00000C94 424F554E4345414E59 .bounceanychs: asciz "BOUNCEANYCHS" 0 00000C9D 43485300 0 00000CA1 4E4F .nobounceanylba: db "NO" 0 00000CA3 424F554E4345414E59 .bounceanylba: asciz "BOUNCEANYLBA" 0 00000CAC 4C424100 0 00000CB0 4E4F .nohidedosentry: db "NO" 0 00000CB2 48494445444F53454E .hidedosentry: asciz "HIDEDOSENTRY" 0 00000CBB 54525900 0 00000CBF 4E4F .nohidedosdatafirst: db "NO" 0 00000CC1 48494445444F534441 .hidedosdatafirst: asciz "HIDEDOSDATAFIRST" 0 00000CCA 5441464952535400 0 00000CD2 4E4F .noenlargelma: db "NO" 0 00000CD4 454E4C415247454C4D .enlargelma: asciz "ENLARGELMA" 0 00000CDD 4100 0 00000CDF 4E4F .noprotectfirstumcb: db "NO" 0 00000CE1 50524F544543544649 .protectfirstumcb: asciz "PROTECTFIRSTUMCB" 0 00000CEA 525354554D434200 0 00000CF2 4E4F .noinstallasfirst: db "NO" 0 00000CF4 494E5354414C4C4153 .installasfirst: asciz "INSTALLASFIRST" 0 00000CFD 464952535400 0 00000D03 4E4F .noinstallaslast: db "NO" 0 00000D05 494E5354414C4C4153 .installaslast: asciz "INSTALLASLAST" 0 00000D0E 4C41535400 0 00000D13 4E4F .nopreservecds: db "NO" 0 00000D15 505245534552564543 .preservecds: asciz "PRESERVECDS" 0 00000D1E 445300 0 00000D21 4E4F .noreinitcds: db "NO" 0 00000D23 5245494E4954434453 .reinitcds: asciz "REINITCDS" 0 00000D2C 00 0 00000D2D 696E69743A20417070 .altah_message: asciz "init: Applying ALTAH compatibility option.",13,10 0 00000D36 6C79696E6720414C54 0 00000D3F 414820636F6D706174 0 00000D48 6962696C697479206F 0 00000D51 7074696F6E2E0D0A00 0 00000D5A 696E69743A20457272 .altah_message.error: asciz "init: Error: ALTAH compatibility option failed!",13,10 0 00000D63 6F723A20414C544148 0 00000D6C 20636F6D7061746962 0 00000D75 696C697479206F7074 0 00000D7E 696F6E206661696C65 0 00000D87 64210D0A00 419 global configmsg.hidedosentry_message 420 global configmsg.hidedosentry_error 0 00000D8C 696E69743A20486964 .hidedosentry_message: asciz "init: Hiding DOSENTRY MCB.",13,10 0 00000D95 696E6720444F53454E 0 00000D9E 545259204D43422E0D 0 00000DA7 0A00 0 00000DA9 696E69743A20457272 .hidedosentry_error: asciz "init: Error: Hiding DOSENTRY MCB failed!",13,10 0 00000DB2 6F723A20486964696E 0 00000DBB 6720444F53454E5452 0 00000DC4 59204D434220666169 0 00000DCD 6C6564210D0A00 423 global configmsg.hidedosdata_message 424 global configmsg.hidedosdata_error 0 00000DD4 696E69743A20486964 .hidedosdata_message: asciz "init: Hiding DOSDATA first MCB.",13,10 0 00000DDD 696E6720444F534441 0 00000DE6 544120666972737420 0 00000DEF 4D43422E0D0A00 0 00000DF6 696E69743A20457272 .hidedosdata_error: asciz "init: Error: Hiding DOSDATA first MCB failed!",13,10 0 00000DFF 6F723A20486964696E 0 00000E08 6720444F5344415441 0 00000E11 206669727374204D43 0 00000E1A 42206661696C656421 0 00000E23 0D0A00 427 global .enlargelma_message 0 00000E26 696E69743A20456E6C .enlargelma_message: asciz "init: Enlarging Low Memory Area with new UMB.",13,10 0 00000E2F 617267696E67204C6F 0 00000E38 77204D656D6F727920 0 00000E41 417265612077697468 0 00000E4A 206E657720554D422E 0 00000E53 0D0A00 0 00000E56 696E69743A20457272 .amisnumberinuse: db "init: Error: Selected AMIS multiplex number " 0 00000E5F 6F723A2053656C6563 0 00000E68 74656420414D495320 0 00000E71 6D756C7469706C6578 0 00000E7A 206E756D62657220 0 00000E82 2D2D6820697320616C .amisnumberinuse.num: asciz "--h is already in use!",13,10 0 00000E8B 726561647920696E20 0 00000E94 757365210D0A00 431 0 00000E9B 584D41454D2E535953 XMAEM_file db 'XMAEM.SYS',0 ;AN029; 0 00000EA4 00 433 434 ;IBMCACHE_file db 'IBMCACHE.SYS',0;AN024;AN026;To cope with the IBMCACHE.SYS 435 ; problem of DOS version checking. 436 437 ;****************************************************************************** 438 ;Take care of Config.sys file. 439 ;SYSTEM parser data and code. 440 ;****************************************************************************** 441 [list -] 444 ;=== Push trace listing source: parse.nas 445 %include "parse.nas" ;together with PSDATA.INC ; NASM included file 1 <1> ; PAGE ;AN000; 2 <1> ; $SALUT (4,4,8,41) 3 <1> ;(deleted).XLIST 4 <1> ;(deleted)INCLUDE STRUC.INC ;AN020;structured macro definitions for .IF,.ELSE etc. 5 <1> ;(deleted).LIST 6 <1> ; 7 <1> ; NOTE: basesw must be set properly to allow the PARSER to access psdata. 8 <1> ; - basesw undefined means CS seg. override for psdata access. 9 <1> ; - basesw = 1 means DS seg. override for psdata access & 10 <1> ; DS must point to psdata. 11 <1> ; - basesw = 0 means ES seg. override for psdata access & 12 <1> ; ES must point to psdata. 13 <1> ; 14 <1> ; 15 <1> %IFNDEF basesw ;AN022; 16 <1> %idefine psdata_seg CS ;AN022; 17 <1> %ELSE ;AN022; 18 <1> %IF basesw ;AN022;IF "basesw EQU 1" specified by caller THEN 19 <1> %idefine psdata_seg DS ;AN022; 20 <1> %ELSE ;AN022; 21 <1> %idefine psdata_seg ES ;AN022;ELSE only other choice is ES (basesw EQU 0) 22 <1> %ENDIF ;AN022; 23 <1> %ENDIF ;AN022; 24 <1> 25 <1> %ifndef incsw ;AN000; (tm03) Someone doesn't want to include psdata 26 <1> %iassign incsw 1 ;AN000; include psdata.inc (tm03) 27 <1> %endif ;AN000; (tm03) 28 <1> %if incsw ;AN000; If incsw = 1 then (tm03) 29 <1> %include "psdata.mac" ;AN000; include psdata.inc (tm03) 1 <2> ;******************************************************************* 2 <2> ; Parser include file 3 <2> ;******************************************************************* 4 <2> %warning out: INCLUDING COMP=COMMON DSN=PSDATA.INC...;AN000; 4 ****************** <2> warning: out: INCLUDING COMP=COMMON DSN=PSDATA.INC... [-w+user] 5 <2> ; 6 <2> ;**** Default assemble switches definition ************************* 7 <2> 8 <2> %ifndef FarSW ;AN000; 9 <2> %iassign FarSW 0 ;AN000; Near call expected 10 <2> %endif ;AN000; 11 <2> 12 <2> %ifndef DateSW ;AN000; 13 <2> %iassign DateSW 1 ;AN000; Check date format 14 <2> %endif ;AN000; 15 <2> 16 <2> %ifndef TimeSW ;AN000; 17 <2> %iassign TimeSW 1 ;AN000; Check time format 18 <2> %endif ;AN000; 19 <2> 20 <2> %ifndef FileSW ;AN000; 21 <2> %iassign FileSW 1 ;AN000; Check file specification 22 <2> %endif ;AN000; 23 <2> 24 <2> %ifndef CAPSW ;AN000; 25 <2> %iassign CAPSW 1 ;AN000; Perform CAPS if specified 26 <2> %endif ;AN000; 27 <2> 28 <2> %ifndef CmpxSW ;AN000; 29 <2> %iassign CmpxSW 1 ;AN000; Check complex list 30 <2> %endif ;AN000; 31 <2> 32 <2> %ifndef NumSW ;AN000; 33 <2> %iassign NumSW 1 ;AN000; Check numeric value 34 <2> %endif ;AN000; 35 <2> 36 <2> %ifndef KeySW ;AN000; 37 <2> %iassign KeySW 1 ;AN000; Support keywords 38 <2> %endif ;AN000; 39 <2> 40 <2> %ifndef SwSW ;AN000; 41 <2> %iassign SwSW 1 ;AN000; Support switches 42 <2> %endif ;AN000; 43 <2> 44 <2> %ifndef Val1SW ;AN000; 45 <2> %iassign Val1SW 1 ;AN000; Support value definition 1 46 <2> %endif ;AN000; 47 <2> 48 <2> %ifndef Val2SW ;AN000; 49 <2> %iassign Val2SW 1 ;AN000; Support value definition 2 50 <2> %endif ;AN000; 51 <2> 52 <2> %ifndef Val3SW ;AN000; 53 <2> %iassign Val3SW 1 ;AN000; Support value definition 3 54 <2> %endif ;AN000; 55 <2> 56 <2> %ifndef DrvSW ;AN000; 57 <2> %iassign DrvSW 1 ;AN000; Support drive only format 58 <2> %endif ;AN000; 59 <2> 60 <2> %ifndef QusSW ;AN000; 61 <2> %iassign QusSW 1 ;AN000; Support quoted string format 62 <2> %endif ;AN000; 63 <2> 64 <2> %ifndef LFEOLSW ;AN028; 65 <2> %iassign LFEOLSW 1 ;AN028; Accept Line feed (0AH) as end of line 66 <2> %endif ;AN028; 67 <2> 68 <2> ;**** Equation field 69 <2> ;-------- Character code definition 70 <2> 71 <2> D_P_DBSP1 equ 81h ;AN000; 1st byte of DBCS blank 72 <2> D_P_DBSP2 equ 40h ;AN000; 2nd byte of DBCS blank 73 <2> D_P_Period equ "." ;AN020; 74 <2> D_P_Slash equ "/" ;AN020; 75 <2> D_P_Space equ " " ;AN000; SBCS blank 76 <2> D_P_Comma equ "," ;AN000; 77 <2> D_P_Switch equ "/" ;AN000; 78 <2> D_P_Keyword equ "=" ;AN000; 79 <2> D_P_Colon equ ":" ;AN000; 80 <2> D_P_Plus equ "+" ;AN000; 81 <2> D_P_Minus equ "-" ;AN000; 82 <2> D_P_Rparen equ ")" ;AN000; 83 <2> D_P_Lparen equ "(" ;AN000; 84 <2> ;(deleted ;AN025;) D_P_SQuote equ "'" 85 <2> D_P_DQuote equ '"' ;AN000; 86 <2> D_P_NULL equ 0 ;AN000; 87 <2> D_P_TAB equ 9 ;AN000; 88 <2> D_P_CR equ 0Dh ;AN000; 89 <2> D_P_LF equ 0Ah ;AN000; 90 <2> D_P_ASCII80 equ 80h ;AN000; ASCII 80h character code 91 <2> 92 <2> ;-------- Masks 93 <2> D_P_Make_Lower equ 20h ;AN000; make lower case character 94 <2> D_P_Make_Upper equ 0ffh-D_P_Make_Lower ;AN000; make upper case character 95 <2> 96 <2> ; PAGE ;AN000; 97 <2> ;-------- DOS function call related equs 98 <2> 99 <2> D_P_DOS_Get_CDI equ 3800h ;AN000; get country dependent information 100 <2> ; by this call, following information 101 <2> D_P_CDI struc ;AN000; is returned. 0 00000B20 ???? D_P_CDI_DateF dw ? ;0 ;AN000; 0 00000B22 ?????????? D_P_CDI_Money db ?,?,?,?,? ;0,0,0,0,0 ;AN000; 0 00000B27 ???? D_P_CDI_1000 db ?,? ;0,0 ;AN000; 0 00000B29 ???? D_P_CDI_Dec db ?,? ;0,0 ;AN000; 0 00000B2B ???? D_P_CDI_DateS db ?,? ;0,0 ;AN000; 0 00000B2D ???? D_P_CDI_TimeS db ?,? ;0,0 ;AN000; 0 00000B2F ?? db ? ;0 ;AN000; 0 00000B30 ?? db ? ;0 ;AN000; 0 00000B31 ?? D_P_CDI_TimeF db ? ;0 ;AN000; 0 00000B32 ???????? dw ?,? ;0,0 ;AN000; 0 00000B36 ???? db ?,? ;0,0 ;AN000; 113 00000018 <2> dw 5 dup (?) ;(0) ;AN000; 114 <2> D_P_CDI ends ;AN000; 115 <2> 116 <2> D_P_Date_MDY equ 0 ;AN000; 117 <2> D_P_Date_DMY equ 1 ;AN000; 118 <2> D_P_Date_YMD equ 2 ;AN000; 119 <2> ;------------- 120 <2> D_P_DOS_GetEV equ 6300h ;AN000; get DBCS EV call 121 <2> ;AN000; DS:SI will points to DBCS EV 122 <2> ;------------- 123 <2> D_P_DOS_Get_TBL equ 65h ;AN000; get uppercase table call 124 <2> ;AN000; following parameters are set 125 <2> ;AN000; to get casemap table. 126 <2> D_P_DOSTBL_Def equ -1 ;AN000; get default 127 <2> D_P_DOSTBL_BL equ 5 ;AN000; buffer length for Tbl pointer 128 <2> D_P_DOSTBL_File equ 4 ;AN000; get file uppercase table 129 <2> D_P_DOSTBL_Char equ 2 ;AN000; get character uppercase table 130 <2> ; By this call following information 131 <2> ; is returned. 132 <2> D_P_DOS_TBL struc ;AN000; 0 00000B20 ?? D_P_DOS_InfoID db ? ;0 ;AN000; information id for the table 0 00000B21 ???? D_P_DOS_TBL_Off dw ? ;0 ;AN000; offset address of the table 0 00000B23 ???? D_P_DOS_TBL_Seg dw ? ;0 ;AN000; segment address of the table 136 <2> D_P_DOS_TBL ends ;AN000; 137 <2> ; PAGE ;AN000; 138 <2> ;--------------------------------------------------------------------------------------------------------- 139 <2> ; PARMS LABEL BYTE 140 <2> ; DW PARMSX 141 <2> ; DB 2 ; NUMBER OF STRINGS (0, 1, 2) 142 <2> ; DB length ; LENGTH OF THE NEXT LIST, 0 IF NONE 143 <2> ; DB " .. " ; EXTRA DELIMITER LIST, 144 <2> ; ; TYPICAL ARE ";", "=" 145 <2> ; ; "," & WHITESPACE ALWAYS 146 <2> ; DB length ; LENGTH OF THE NEXT LIST, 0 IF NONE 147 <2> ; DB " .. " ; EXTRA END OF LINE LIST, CR, LF OR 0 ALWAYS 148 <2> ;--------------------------------------------------------------------------------------------------------- 149 <2> 150 <2> ;-------------------------------- PARMS block structure 151 <2> D_P_PARMS_Blk struc ;AN000; 0 00000B20 ???? D_P_PARMSX_Address dw ? ;0 ;AN000; Address of PARMSX 0 00000B22 ?? D_P_Num_Extra db ? ;0 ;AN000; Number of extra stuff 0 00000B23 ?? D_P_Len_Extra_Delim db ? ;0 ;AN000; Length of extra delimiter 155 <2> D_P_PARMS_Blk ends ;AN000; 156 <2> 157 <2> D_P_Len_PARMS equ 4 ;AN000; 158 <2> D_P_I_Use_Default equ 0 ;AN000; no extra stuff specified 159 <2> D_P_I_Have_Delim equ 1 ;AN000; extra delimiter specified 160 <2> D_P_I_Have_EOL equ 2 ;AN000; extra EOL specified 161 <2> 162 <2> ;--------------------------------------------------------------------------------------------------------- 163 <2> ; PARMSX LABEL BYTE 164 <2> ; DB minp,maxp ; MIN, MAX POSITIONAL OPERANDS ALLOWED 165 <2> ; DW CONTROL ; DESCRIPTION OF POSITIONAL 1 166 <2> ; : ; REPEATS maxp-1 TIMES 167 <2> ; DB maxs ; # OF SWITCHES 168 <2> ; DW CONTROL ; DESCRIPTION OF SWITCH 1 169 <2> ; : ; REPEATS maxs-1 TIMES 170 <2> ; DB maxk ; # OF KEYWORD 171 <2> ; DW CONTROL ; DESCRIPTION OF KEYWORD 1 172 <2> ; : ; REPEATS maxk-1 TIMES 173 <2> ;--------------------------------------------------------------------------------------------------------- 174 <2> 175 <2> ;-------------------------------- PARMSX block structure 176 <2> D_P_PARMSX_Blk struc ;AN000; 0 00000B20 ?? D_P_MinP db ? ;0 ;AN000; Minimum positional number 0 00000B21 ?? D_P_Maxp db ? ;0 ;AN000; Maximum positional number 0 00000B22 ???? D_P_1st_Control dw ? ;0 ;AN000; Address of the 1st CONTROL block 180 <2> D_P_PARMSX_Blk ends ;AN000; 181 <2> ; PAGE ;AN000; 182 <2> ;--------------------------------------------------------------------------------------------------------- 183 <2> ; << Control field definition >> 184 <2> ; 185 <2> ; 186 <2> ;CONTROL LABEL BYTE 187 <2> ; DW MATCH_FLAGS ; CONTROLS TYPE MATCHED 188 <2> ; ; 8000H=NUMERIC VALUE, (VALUE LIST WILL BE CHECKED) 189 <2> ; ; 4000H=SIGNED NUMERIC VALUE (VALUE LIST WILL BE CHECKED) 190 <2> ; ; 2000H=SIMPLE STRING(VALUE LIST WILL BE CHECKED) 191 <2> ; ; 1000H=DATE STRING (VALUE LIST WON'T BE CHECKED) 192 <2> ; ; 0800H=TIME STRING (VALUE LIST WON'T BE CHECKED) 193 <2> ; ; 0400H=COMPLEX LIST (VALUE LIST WON'T BE CHECKED) 194 <2> ; ; 0200H=FILE SPEC (VALUE LIST WON'T BE CHECKED) 195 <2> ; ; 0100H=DRIVE ONLY (VALUE LIST WON'T BE CHECKED) 196 <2> ; ; 0080H=QUOTED STRING (VALUE LIST WON'T BE CHECKED) 197 <2> ; ; 0010H=IGNORE ":" AT END IN MATCH 198 <2> ; ; 0002H=REPEATS ALLOWED 199 <2> ; ; 0001H=OPTIONAL 200 <2> ; DW FUNCTION_FLAGS 201 <2> ; ; 0001H=CAP RESULT BY FILE TABLE 202 <2> ; ; 0002H=CAP RESULT BY CHAR TABLE 203 <2> ; ; 0010H=REMOVE ":" AT END 204 <2> ; (tm10) ; 0020H=colon is not necessary for switch 205 <2> ; DW RESULT ; RESULT BUFFER 206 <2> ; DW VALUES ; VALUE LISTS 207 <2> ; DB nid ; NUMBER OF KEYWORD/SWITCH SYNONYMS IN FOLLOWING LIST 208 <2> ; DB "...",0 ; IF n >0, KEYWORD 1 209 <2> ; : 210 <2> ; 211 <2> ;Note: 212 <2> ; - The MATCH_FLAG is bit significant. You can set, for example, TIME bit and 213 <2> ; DATE bit simalteniously. 214 <2> ; 215 <2> ; The parser examins each bit along with the following priority. 216 <2> ; 217 <2> ; COMPLEX -> DATE -> TIME -> NUMERIC VAL -> SIGNED NUMERIC VAL -> DRIVE -> 218 <2> ; FILE SPEC -> SIMPLE STRING. 219 <2> ; 220 <2> ; 221 <2> ; - When the FUNCTION_FLAG is 0001 or 0002, the STRING pointed to by a pointer 222 <2> ; in the result buffer is capitalized. 223 <2> ; 224 <2> ; - Match_Flags 0001H and 0002H have meaning only for the positional. 225 <2> ; 226 <2> ; 227 <2> ; - The "...",0 (bottom most line) does require '=' or '/'. When you need a 228 <2> ; switch, for example, '/A', then STRING points to; 229 <2> ; 230 <2> ; DB 1 ; number of following synonyms 231 <2> ; DB '/A',0 232 <2> ; 233 <2> ; When you need a keyword, for example, 'CODEPAGE=', then "...",0 will be; 234 <2> ; 235 <2> ; DB 1 ; number of following synonyms 236 <2> ; DB 'CODEPAGE=',0 237 <2> ; 238 <2> ; 239 <2> ; - "..." must consist of upper case characters only because the parser 240 <2> ; performs pattern matching after converting input to upper case (by 241 <2> ; using the current country upper case table) 242 <2> ; 243 <2> ; 244 <2> ; - One "..." can contain only one switch or keyword. If you need, for 245 <2> ; example /A and /B, the format will be; 246 <2> ; 247 <2> ; DB 2 ; number of following synonyms 248 <2> ; DB '/A',0 249 <2> ; DB '/B',0 250 <2> ;--------------------------------------------------------------------------------------------------------- 251 <2> 252 <2> ;**** Match_Flags 253 <2> 254 <2> D_P_Num_Val equ 8000h ;AN000; Numeric Value 255 <2> D_P_SNum_Val equ 4000h ;AN000; Signed numeric value 256 <2> D_P_Simple_S equ 2000h ;AN000; Simple string 257 <2> D_P_Date_S equ 1000h ;AN000; Date string 258 <2> D_P_Time_S equ 0800h ;AN000; Time string 259 <2> D_P_Cmpx_S equ 0400h ;AN000; Complex string 260 <2> D_P_File_Spc equ 0200h ;AN000; File Spec 261 <2> D_P_Drv_Only equ 0100h ;AN000; Drive Only 262 <2> D_P_Qu_String equ 0080h ;AN000; Quoted string 263 <2> D_P_Ig_Colon equ 0010h ;AN000; Ignore colon at end in match 264 <2> D_P_Repeat equ 0002h ;AN000; Repeat allowed 265 <2> D_P_Optional equ 0001h ;AN000; Optional 266 <2> 267 <2> ;**** Function flags 268 <2> 269 <2> D_P_CAP_File equ 0001h ;AN000; CAP result by file table 270 <2> D_P_CAP_Char equ 0002h ;AN000; CAP result by character table 271 <2> D_P_Rm_Colon equ 0010h ;AN000; Remove ":" at the end 272 <2> D_P_colon_is_not_necessary equ 0020h ;AN000;(tm10) /+10 and /+:10 273 <2> 274 <2> ;-------------------------------- Control block structure 275 <2> D_P_Control_Blk struc ;AN000; 0 00000B20 ???? D_P_Match_Flag dw ? ;0 ;AN000; Controls type matched 0 00000B22 ???? D_P_Function_Flag dw ? ;0 ;AN000; Function should be taken 0 00000B24 ???? D_P_Result_Buf dw ? ;0 ;AN000; Result buffer address 0 00000B26 ???? D_P_Value_List dw ? ;0 ;AN000; Value list address 0 00000B28 ?? D_P_nid db ? ;0 ;AN000; # of keyword/SW synonyms 0 00000B29 ?? D_P_KeyorSW db ? ;0 ;AN000; keyword or sw 282 <2> D_P_Control_Blk ends ;AN000; 283 <2> ; PAGE ;AN000; 284 <2> ;--------------------------------------------------------------------------------------------------------- 285 <2> ; << Value List Definition >> 286 <2> ; 287 <2> ;VALUES LABEL BYTE 288 <2> ; DB nval ; NUMBER OF VALUE DEFINITIONS (0 - 3) 289 <2> ; = 290 <2> ; = DB nrng ; NUMBER OF RANGES 291 <2> ; = =DB ITEM_TAG ; RETURN VALUE IF RANGE MATCHED 292 <2> ; = =DD X,Y ; RANGE OF VALUES 293 <2> ; = : 294 <2> ; = DB nnval ; NUMBER OF CHOICES 295 <2> ; = =DB ITEM_TAG ; RETURN VALUE IF NUMBER CHOICE MATCHED 296 <2> ; = =DD VALUE ; SPECIFIC CHOICE IF NUMBER 297 <2> ; = : 298 <2> ; = DB nstrval ; NUMBER OF CHOICES 299 <2> ; = =DB ITEM_TAG ; RETURN VALUE IF STRING CHOICE MATCHED 300 <2> ; = =DW STRING ; SPECIFIC CHOICE IF STING 301 <2> ; = : 302 <2> ; 303 <2> ;STRING DB "...",0 ; ASCIIZ STRING IMAGE 304 <2> ; 305 <2> ;Note: 306 <2> ; - ITEM_TAG must not be 0FFH, which will be used in the result buffer 307 <2> ; when no choice lists are provided. 308 <2> ; 309 <2> ; - STRING must consist of upper case characters only because the parser 310 <2> ; performs pattern matching after converting input to upper case (by 311 <2> ; using the current country upper case table) 312 <2> ;--------------------------------------------------------------------------------------------------------- 313 <2> 314 <2> D_P_nval_None equ 0 ;AN000; no value list ID 315 <2> D_P_nval_Range equ 1 ;AN000; range list ID 316 <2> D_P_nval_Value equ 2 ;AN000; value list ID 317 <2> D_P_nval_String equ 3 ;AN000; string list ID 318 <2> D_P_Len_Range equ 9 ;AN000; Length of a range choice(two DD plus one DB) 319 <2> D_P_Len_Value equ 5 ;AN000; Length of a value choice(one DD plus one DB) 320 <2> D_P_Len_String equ 3 ;AN000; Length of a string choice(one DW plus one DB) 321 <2> D_P_No_nrng equ 0 ;AN000; (tm07) no nrng. nnval must not be 0. 322 <2> 323 <2> D_P_Val_List struc ;AN000; 0 00000B20 ?? D_P_NumofList db ? ;0 ;AN000; number of following choice 0 00000B21 ???? D_P_Val_XL dw ? ;0 ;AN000; lower word of value 0 00000B23 ???? D_P_Val_XH dw ? ;0 ;AN000; higher word of value 0 00000B25 ???? D_P_Val_YL dw ? ;0 ;AN000; lower word of another value 0 00000B27 ???? D_P_Val_YH dw ? ;0 ;AN000; higher word of another value 329 <2> D_P_Val_List ends ;AN000; 330 <2> ; PAGE ;AN000; 331 <2> ;--------------------------------------------------------------------------------------------------------- 332 <2> ; << Result Buffer Definition >> 333 <2> ; 334 <2> ;RESULT LABEL BYTE ; BELOW FILLED IN FOR DEFAULTS 335 <2> ; DB type ; TYPE RETURNED: 0=RESERVED, 336 <2> ; ; 1=NUMBER, 2=LIST INDEX, 337 <2> ; ; 3=STRING, 4=COMPLEX, 338 <2> ; ; 5=FILESPEC, 6=DRIVE 339 <2> ; ; 7=DATE, 8=TIME 340 <2> ; ; 9=QUOTED STRING 341 <2> ; DB ITEM_TAG ; MATCHED ITEM TAG 342 <2> ; 343 <2> ; dw synonym@ ; es:@ points to found SYNONYM if provided. 344 <2> ; 345 <2> ; 346 <2> ; = DD n ; VALUE IF NUMBER 347 <2> ; = or 348 <2> ; = DW i ; INDEX (OFFSET) INTO VALUE LIST 349 <2> ; = ; (ES presents Segment address) 350 <2> ; = or 351 <2> ; = DD STRING ; OFFSET OF STRING VALUE 352 <2> ; = or 353 <2> ; = DB drv ; DRIVE NUMBER (1-A, 2-B,..., 26-Z) 354 <2> ; = or 355 <2> ; = DW YEAR ;(1980-2099) IN CASE OF DATE 356 <2> ; = DB MONTH ;(1-12) Note: Range check is not performed. 357 <2> ; = DB DATE ;(1-31) 0 is filled when the corresponding field was not specified. 358 <2> ; = or 359 <2> ; = DB HOUR ;(0-23) IN CASE OF TIME 360 <2> ; = DB MINUTES ;(0-59) Note: Range check is not performed . 361 <2> ; = DB SECONDS ;(0-59) 0 is filled when the corresponding field was not specified . 362 <2> ; = DB HUNDREDTHS ;(0-99) 363 <2> ; = 364 <2> ; 365 <2> ; 366 <2> ;Note: ITEM_TAG is 0FFH when the caller does not specify the choice 367 <2> ; list. 368 <2> ; 369 <2> ; YEAR: If the input value for the year is less than 100, parser 370 <2> ; adds 1900 to it. For example, when 87 is input to parser for 371 <2> ; the year value, he returns 1987. 372 <2> ;--------------------------------------------------------------------------------------------------------- 373 <2> 374 <2> ;-------------------------------- Result block structure 375 <2> D_P_Result_Blk struc ;AN000; 0 00000B20 ?? D_P_Type db ? ;0 ;AN000; Type returned 0 00000B21 ?? D_P_Item_Tag db ? ;0 ;AN000; Matched item tag 0 00000B22 ???? D_P_SYNONYM_Ptr dw ? ;0 ;AN000; pointer to Synonym list returned 0 00000B24 ???????? D_P_Picked_Val db ?,?,?,? ;0,0,0,0 ;AN000; value 380 <2> D_P_Result_Blk ends ;AN000; 381 <2> ;-------------------------------- 382 <2> ;**** values for the type field in the result block 383 <2> 384 <2> D_P_EOL equ 0 ;AN000; End of line 385 <2> D_P_Number equ 1 ;AN000; Number 386 <2> D_P_List_Idx equ 2 ;AN000; List Index 387 <2> D_P_String equ 3 ;AN000; String 388 <2> D_P_Complex equ 4 ;AN000; Complex 389 <2> D_P_File_Spec equ 5 ;AN000; File Spec 390 <2> D_P_Drive equ 6 ;AN000; Drive 391 <2> D_P_Date_F equ 7 ;AN000; Date 392 <2> D_P_Time_F equ 8 ;AN000; Time 393 <2> D_P_Quoted_String equ 9 ;AN000; Quoted String 394 <2> 395 <2> D_P_No_Tag equ 0FFH ;AN000; No ITEM_TAG found 396 <2> ;**** Return code 397 <2> ; 398 <2> ; following return code will be returned in the AX register. 399 <2> 400 <2> D_P_No_Error equ 0 ;AN000; No error 401 <2> D_P_Too_Many equ 1 ;AN000; Too many operands 402 <2> D_P_Op_Missing equ 2 ;AN000; Required operand missing 403 <2> D_P_Not_In_SW equ 3 ;AN000; Not in switch list provided 404 <2> D_P_Not_In_Key equ 4 ;AN000; Not in keyword list provided 405 <2> D_P_Out_Of_Range equ 6 ;AN000; Out of range specified 406 <2> D_P_Not_In_Val equ 7 ;AN000; Not in value list provided 407 <2> D_P_Not_In_Str equ 8 ;AN000; Not in string list provided 408 <2> D_P_Syntax equ 9 ;AN000; Syntax error 409 <2> D_P_RC_EOL equ -1 ;AN000; End of command line 410 <2> 411 <2> ; PAGE ;AN000; 412 <2> ;********************** Local Data ************************************* 0 00000EA5 0000 D_P_ORDINAL dw 0 ;AN000; Operand ordinal save area 0 00000EA7 0000 D_P_RC dw 0 ;AN000; Return code from parser 0 00000EA9 0000 D_P_SI_Save dw 0 ;AN000; Pointer of command buffer 0 00000EAB 0000 D_P_DX dw 0 ;AN000; Return result buffer address 0 00000EAD 00 D_P_Terminator db 0 ;AN000; Terminator code (ASCII) 0 00000EAE 0000 D_P_DBCSEV_OFF dw 0 ;AN000; Offset of DBCS EV 0 00000EB0 0000 D_P_DBCSEV_SEG dw 0 ;AN000; Segment of DBCS EV 0 00000EB2 0000 D_P_Flags dw 0 ;AN000; Parser internal flags 421 <2> labelsize D_P_Flags1, byte, D_P_Flags ;AN038; to reference first byte flags 422 <2> labelsize D_P_Flags2, byte, D_P_Flags+1 ;AN038; to reference second byte flags only 423 <2> 424 <2> ;in second byte of D_P_Flags, referenced as D_P_Flags2: 425 <2> D_P_equ equ 01h ;AN000; "=" packed in string buffet 426 <2> D_P_Neg equ 02h ;AN000; Negative value 427 <2> D_P_Time12 equ 04h ;AN000; set when PM is specified 428 <2> D_P_Key_Cmp equ 08h ;AN000; set when keyword compare 429 <2> D_P_SW_Cmp equ 10h ;AN000; set when switch compare 430 <2> D_P_Extra equ 20h ;AN000; set when extra delimiter found 431 <2> D_P_SW equ 40h ;AN000; set when switch found (tm08) 432 <2> D_P_Signed equ 80h ;AN000; signed numeric specified 433 <2> 434 <2> ;in first byte of D_P_Flags, referenced as D_P_Flags1: 435 <2> D_P_time12am equ 01h ;AN038; set when AM is specified on time 436 <2> D_P_TIME_AGAIN EQU 02H ;AN039; SET WHEN READY TO RE-PARSE TIME 437 <2> 0 00000EB4 0000 D_P_SaveSI_Cmpx dw 0 ;AN000; save si for later use by complex 0 00000EB6 0000 D_P_KEYorSW_Ptr dw 0 ;AN000; points next to "=" or ":" code 0 00000EB8 0000 D_P_Save_EOB dw 0 ;AN000; save pointer to EOB 0 00000EBA 0000 D_P_Found_SYNONYM dw 0 ;AN000; es:@ points to found synonym 442 <2> 0 00000EBC 000000000000000000 D_P_STRING_BUF db 128 dup(0) ;AN000; Pick a operand from command line 0 00000EC5 000000000000000000 0 00000ECE 000000000000000000 0 00000ED7 000000000000000000 0 00000EE0 000000000000000000 0 00000EE9 000000000000000000 0 00000EF2 000000000000000000 0 00000EFB 000000000000000000 0 00000F04 000000000000000000 0 00000F0D 000000000000000000 0 00000F16 000000000000000000 0 00000F1F 000000000000000000 0 00000F28 000000000000000000 0 00000F31 000000000000000000 0 00000F3A 0000 444 <2> D_P_STRING_BUF_END equ $ ;AN000; 445 <2> %IF TimeSw ;AN039; For TIME only 446 <2> D_P_ORIG_ORD DW 0 ;AN039; ORIGINAL ORDINAL FROM CX 447 <2> D_P_ORIG_STACK DW 0 ;AN039; ORIGINAL VALUE OF STACK FROM SP 448 <2> D_P_ORIG_SI DW 0 ;AN039; ORIGINAL START PARSE POINTER FROM SI 449 <2> %endif ;AN039; 450 <2> %IF DateSw+TimeSw ;AN000;(Check if date or time format is supported) 451 <2> ;------------------------------ 452 <2> ; 453 <2> D_P_Got_Time db 0 ;AN023; if 1, use Time delimiters 454 <2> D_P_NeedToBeRead equ 0ffffh ;AN000; 455 <2> 456 <2> D_P_COUNTRY_INFO: ; NASM structure instance 457 <2> D_P_CDI_size equ D_P_CDI_struc_size ; NASM port equate 458 <2> istruc D_P_CDI 459 <2> at D_P_CDI_DateF 460 <2> dw D_P_NeedToBeRead 461 <2> iend 462 <2> ; 463 <2> D_P_1st_Val dw 0 ;AN000; used when process date or time 464 <2> D_P_2nd_Val dw 0 ;AN000; used when process date or time 465 <2> D_P_3rd_Val dw 0 ;AN000; used when process date or time 466 <2> D_P_4th_Val dw 0 ;AN000; used when process date or time 467 <2> ;------------------------------ 468 <2> %endif ;AN000;(of DateSW+TimeSW) 0 00000F3C FF D_P_Char_CAP_Ptr db 0ffh ;AN000; info id 0 00000F3D 0000 dw 0 ;AN000; offset of char case map table 0 00000F3F 0000 dw 0 ;AN000; segment of char case map table 472 <2> %IF CAPSW ;AN000;(Check if uppercase conversion is supported) 473 <2> D_P_File_CAP_Ptr db 0ffh ;AN000; info id 474 <2> dw 0 ;AN000; offset of file case map table 475 <2> dw 0 ;AN000; segment of file case map table 476 <2> %endif ;AN000;(of CAPSW) 477 <2> ; (tm06) IF FileSW ;AN000;(Check if file spec is supported) 478 <2> %IF FileSW+DrvSW ;AN000;(Check if file spec is supported) 0 00000F41 5B5D7C3C3E2B3D3B22 D_P_FileSp_Char db '[]|<>+=;"' ;AN000; delimitter of file spec 480 <2> D_P_FileSp_Len equ $-D_P_FileSp_Char ;AN000; 481 <2> %endif ;AN000;(of FileSW) 482 <2> ; (tm05) IF QusSW ;AN000;(Check if quoted string is supported) 483 <2> ;(deleted ;AN025;) IF QusSW+CmpxSW ; (tm05) ;AN000;(Check if quoted string is supported) 484 <2> ;(deleted ;AN025;) D_P_SorD_Quote db 0 ;AN000; keep double or single quote 485 <2> ;(deleted ;AN025;) %endif ;AN000;(of QueSW) 486 <2> %IF KeySW ;AN029; if keywords supported 487 <2> D_P_count_to_eol dw 0 ;AN029; count of chars not including EOL 488 <2> ; REGISTER EQUATES - SPECIAL USAGE FOR REGISTERS 489 <2> %idefine D_P_REG_BH_CG_SW BH ;AN029;0="NO CHANGES MADE", FF=CHANGES MADE 490 <2> %idefine D_P_REG_BL_DQ_SW BL ;AN029;0=NOT IN QUOTES,FF=IN QUOTES 491 <2> 492 <2> D_P_DOUBLE_QUOTE EQU '"' ;AN029; 493 <2> D_P_BL_EQ EQU "= " ;AN029; 494 <2> D_P_EQ_BL EQU " =" ;AN029; 495 <2> D_P_TB_EQ EQU 093DH ;AN029; ;"=" 496 <2> D_P_EQ_TB EQU 3D09H ;AN029; ;"=" 497 <2> %endif ;AN029; IF KeySW Supported 498 <2> 499 <2> ; delimiter parsing 500 <2> D_P_colon_period equ 01 ;AN032; check for colon & period 501 <2> D_P_period_only equ 02 ;AN032; check only for period 502 <2> 503 <2> ;filespec error flag 0 00000F4A 00 D_P_err_flag db 00 ;AN033; flag set if filespec parsing error 505 <2> ;AN033; was detected. 506 <2> D_P_error_filespec equ 01 ;AN033; mask to set flag 507 <2> ;*********************************************************************** 30 <1> %endif ;AN000; endif (tm03) 31 <1> ; PAGE ;AN000; 32 <1> %warning out: INCLUDING COMP=COMMON DSN=PARSE.ASM...;AN000; 32 ****************** <1> warning: out: INCLUDING COMP=COMMON DSN=PARSE.ASM... [-w+user] 33 <1> ;*********************************************************************** 34 <1> ; SysParse; 35 <1> ; 36 <1> ; Function : Parser Entry 37 <1> ; 38 <1> ; Input: DS:SI -> command line 39 <1> ; ES:DI -> parameter block 40 <1> ; psdata_seg -> psdata.inc 41 <1> ; CX = operand ordinal 42 <1> ; 43 <1> ; Note: ES is the segment containing all the control blocks defined 44 <1> ; by the caller, except for the DOS COMMAND line parms, which 45 <1> ; is in DS. 46 <1> ; 47 <1> ; Output: CY = 1 error of caller, means invalid parameter block or 48 <1> ; invalid value list. But this parser does NOT implement 49 <1> ; this feature. Therefore CY always zero. 50 <1> ; 51 <1> ; CY = 0 AX = return code 52 <1> ; BL = terminated delimiter code 53 <1> ; CX = new operand ordinal 54 <1> ; SI = set past scaned operand 55 <1> ; DX = selected result buffer 56 <1> ; 57 <1> ; Use: D_P_Skip_Delim, D_P_Chk_EOL, D_P_Chk_Delim, D_P_Chk_DBCS 58 <1> ; D_P_Chk_Swtch, D_P_Chk_Pos_Control, D_P_Chk_Key_Control 59 <1> ; D_P_Chk_Sw_Control, D_P_Fill_Result 60 <1> ; 61 <1> ; Vars: D_P_Ordinal(RW), D_P_RC(RW), D_P_SI_Save(RW), D_P_DX(R), D_P_Terminator(R) 62 <1> ; D_P_SaveSI_Cmpx(W), D_P_Flags(RW), D_P_Found_SYNONYM(R), D_P_Save_EOB(W) 63 <1> ; 64 <1> ;-------- Modification History ----------------------------------------- 65 <1> ; 66 <1> ; 4/04/87 : Created by K. K, 67 <1> ; 4/28/87 : D_P_Val_YH assemble error (tm01) 68 <1> ; : JMP SHORT assemble error (tm02) 69 <1> ; 5/14/87 : Someone doesn't want to include psdata (tm03) 70 <1> ; 6/12/87 : D_P_Bridge is missing when TimeSw equ 0 and (CmpxSw equ 1 or 71 <1> ; DateSW equ 1) (tm04) 72 <1> ; 6/12/87 : D_P_SorD_Quote is missing when QusSw equ 0 and CmpxSW equ 1 73 <1> ; (tm05) in PSDATA.INC 74 <1> ; 6/12/87 : D_P_FileSp_Char and D_P_FileSP_Len are missing 75 <1> ; when FileSW equ 0 and DrvSW equ 1 (tm06) in PSDATA.INC 76 <1> ; 6/18/87 : $VAL1 and $VAL3, $VAL2 and $VAL3 can be used in the same 77 <1> ; value-list block (tm07) 78 <1> ; 6/20/87 : Add D_P_SW to check if there's an omiting parameter after 79 <1> ; switch (keyword) or not. If there is, backup si for next call 80 <1> ; (tm08) 81 <1> ; 6/24/87 : Complex Item checking does not work correctly when CmpSW equ 1 82 <1> ; and DateSW equ 0 and TimeSW equ 0 (tm09) 83 <1> ; 6/24/87 : New function flag D_P_colon_is_not_necessary for switch 84 <1> ; /+15 and /+:15 are allowed for user (tm10) 85 <1> ; 6/29/87 : ECS call changes DS register but it causes the address problem 86 <1> ; in user's routines. D_P_Chk_DBCS (tm11) 87 <1> ; 7/10/87 : Switch with no_match flag (0x0000H) does not work correctly 88 <1> ; (tm12) 89 <1> ; 7/10/87 : Invalid switch/keyword does not work correctly 90 <1> ; (tm13) 91 <1> ; 7/10/87 : Drive_only breaks 3 bytes after the result buffer 92 <1> ; (tm14) 93 <1> ; 7/12/87 : Too_Many_Operands sets DX=0 as the PARSE result 94 <1> ; (tm15) 95 <1> ; 7/24/87 : Negative lower bound on numeric ranges cause trouble 96 <1> 97 <1> ; 7/24/87 : Quoted strings being returned with quotes. 98 <1> 99 <1> ; 7/28/87 : Kerry S (;AN018;) 100 <1> ; Non optional value on switch (match flags<>0 and <>1) not flagged 101 <1> ; as an error when missing. Solution: return error 2. Modules 102 <1> ; affected: D_P_Chk_SW_Control. 103 <1> 104 <1> ; 7/29/87 : Kerry S (;AN019;) 105 <1> ; Now allow the optional bit in match flags for switches. This 106 <1> ; allows the switch to be encountered with a value or without a 107 <1> ; value and no error is returned. 108 <1> ; 109 <1> 110 <1> ; 8/28/87 : Ed K, Kerry S (;AN020;) 111 <1> ; 9/14/87 In PROC D_P_Get_DecNum, when checking for field separators 112 <1> ; within a date response, instead of checking just for the one 113 <1> ; character defined by the COUNTRY DEPENDENT INFO, check for 114 <1> ; all three chars, "-", "/", and ".". Change D_P_Chk_Switch to allow 115 <1> ; slashes in date strings when DateSw (assembler switch) is set. 116 <1> 117 <1> ; 9/1/87 : Kerry S (;AN021) 118 <1> ; In PROC D_P_String_Comp, when comparing the switch or keyword on 119 <1> ; the command line with the string in the control block the 120 <1> ; comparing was stopping at a colon (switch) or equal (keyword) 121 <1> ; on the command line and assuming a match. This allowed a shorter 122 <1> ; string on the command line than in the synonym list in the control 123 <1> ; block. I put in a test for a null in the control block so the 124 <1> ; string in the control block must be the same length as the string 125 <1> ; preceeding the colon or equal on the command line. 126 <1> 127 <1> ; 8/28/87 : Kerry S (;AN022;) 128 <1> ; All references to data in PSDATA.INC had CS overrides. This caused 129 <1> ; problems for people who included it themselves in a segment other 130 <1> ; than CS. Added switch to allow including PSDATA.INC in any 131 <1> ; segment. 132 <1> 133 <1> ; 9/16/87 : Ed K (;AN023;) PTM1040 134 <1> ; in D_P_set_cdi PROC, it assumes CS points to psdata. Change Push CS 135 <1> ; into PUSH PSDATA_SEG. In D_P_Get_DecNum PROC, fix AN020 136 <1> ; forced both TIME and DATE to use the delims, "-","/",".". 137 <1> ; Created FLag, in D_P_time_Format PROC, to request the delim in 138 <1> ; BL be used if TIME is being parsed. 139 <1> 140 <1> ; 9/24/87 : Ed K 141 <1> ; Removed the include to STRUC.INC. Replaced the STRUC macro 142 <1> ; invocations with their normally expanded code; made comments 143 <1> ; out of the STRUC macro invocation statements to maintain readability. 144 <1> 145 <1> ; 9/24/87 : Ed K (;AN024;) PTM1222 146 <1> ; When no CONTROL for a keyword found, tried to fill in RESULT 147 <1> ; pointed to by non-existant CONTROL. 148 <1> 149 <1> ; 10/15/87 : Ed K (;AN025;) PTM1672 150 <1> ; A quoted text string can be framed only by double quote. Remove 151 <1> ; support to frame quoted text string with single quote. 152 <1> ; (apostrophe) D_P_SorD_Quote is removed from PSDATA.INC. 153 <1> ; D_P_SQuote EQU also removed from PSDATA.INC. Any references to 154 <1> ; single quote in PROC prologues are left as is for history reasons. 155 <1> 156 <1> ; This fixes another bug, not mentioned in p1672, in that two 157 <1> ; quote chars within a quoted string is supposed to be reported as 158 <1> ; one quote character, but is reported as two quotes. This changed 159 <1> ; two instructions in PROC D_P_Quoted_Str. 160 <1> 161 <1> ; Also fixed are several JMP that caused a NOP, these changed to 162 <1> ; have the SHORT operator to avoid the unneeded NOP. 163 <1> 164 <1> ; The code and PSDATA.INC have been aligned for ease of reading. 165 <1> 166 <1> ; 10/26/87 : Ed K (;AN026;) PTM2041, DATE within SWITCH, BX reference to 167 <1> ; psdata buffer should have psdata_seg. 168 <1> 169 <1> ; 10/27/87 : Ed K (;AN027;) PTM2042 comma between keywords implies 170 <1> ; positional missing. 171 <1> 172 <1> ; 11/06/87 : Ed K (;AN028;) PTM 2315 Parser should not use line feed 173 <1> ; as a line delimiter, should use carriage return. 174 <1> ; Define switch: LFEOLSW, if on, accept LF as end of line char. 175 <1> 176 <1> ; 11/11/87 : Ed K (;AN029;) PTM 1651 GET RID OF WHITESPACE AROUND "=". 177 <1> 178 <1> ; 11/18/87 : Ed K (;AN030;) PTM 2551 If filename is just "", then 179 <1> ; endless loop since SI is returned still pointing to start 180 <1> ; of that parm. 181 <1> 182 <1> ; 11/19/87 : Ed K (;AN031;) PTM 2585 date & time getting bad values. 183 <1> ; Vector to returned string has CS instead of Psdata_Seg, but 184 <1> ; when tried to fix it on previous version, changed similar 185 <1> ; but wrong place. 186 <1> 187 <1> ; 12/09/87 : Bill L (;AN032;) PTM 2772 colon and period are now valid 188 <1> ; delimiters between hours, minutes, seconds for time. And period 189 <1> ; and comma are valid delimiters between seconds and 100th second. 190 <1> 191 <1> ; 12/14/87 : Bill L (;AN033;) PTM 2722 if illegal delimiter characters 192 <1> ; in a filespec, then flag an error. 193 <1> 194 <1> ; 12/22/87 : Bill L (;AN034;) All local data to parser is now 195 <1> ; indexed off of the psdata_seg equate instead of the DS register. 196 <1> ; Using this method, DS can point to the segment of PSP or to psdata 197 <1> ; --> local parser data. Why were some references to local data changed 198 <1> ; to do this before, but not all ????? 199 <1> 200 <1> ; 02/02/88 : Ed K (;AC035;) INSPECT utility, suggests optimizations. 201 <1> 202 <1> ; 02/05/88 : Ed K (;AN036;) P3372-UPPERCASE TRANSLATION, PSDATA_SEG HOSED. 203 <1> ; 204 <1> ; 02/08/88 : Ed K (;AN037;) P3410-AVOID POP OF CS, CHECK BASESW FIRST. 205 <1> 206 <1> ; 02/19/88 : Ed K (;AN038;) p3524 above noon and "am" should be error 207 <1> 208 <1> ; 02/23/88 : Ed K (;AN039;) p3518 accept "comma" and "period" as decimal 209 <1> ; separator in TIME before hundredths field. 210 <1> ; 211 <1> ;*********************************************************************** 212 <1> %IF FarSW ;AN000;(Check if need far return) 213 <1> SysParse proc far ;AN000; 214 <1> %ELSE ;AN000; 215 <1> SysParse proc near ;AN000; 216 <1> %ENDIF ;AN000;(of FarSW) 217 <1> ; $SALUT (4,9,17,41) 0 00000F4B 2EC706[9203]0000 mov word [psdata_seg:D_P_Flags],0 ;AC034; Clear all internal flags 219 <1> %IF TimeSw ;AN039; FOR TIME ONLY 220 <1> MOV [PSDATA_SEG:D_P_ORIG_ORD],CX ;AN039; ORIGINAL ORDINAL FROM CX 221 <1> MOV [PSDATA_SEG:D_P_ORIG_STACK],SP ;AN039; ORIGINAL VALUE OF STACK FROM SP 222 <1> MOV [PSDATA_SEG:D_P_ORIG_SI],SI ;AN039; ORIGINAL START PARSE POINTER FROM SI 223 <1> D_P_REDO_TIME: ;AN039; try to parse time again 224 <1> %ENDIF ;AN039; FOR TIME ONLY 0 00000F52 FC cld ;AN000; confirm forward direction 226 <1> D_P_ordinal equ D_P_ORDINAL ; NASM port label 0 00000F53 2E890E[8503] mov [psdata_seg:D_P_ordinal],cx ;AC034; save operand ordinal 0 00000F58 2EC706[8703]0000 mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; Assume no error 0 00000F5F 2EC706[9A03]0000 mov word [psdata_seg:D_P_Found_SYNONYM],0 ;AC034; initalize synonym pointer 230 <1> 0 00000F66 2EC706[8B03]0000 mov word [psdata_seg:D_P_DX],0 ;AC034; (tm15) 232 <1> %IF KeySW ;AN029; 233 <1> ;IN CASE THE USER PUT OPTIONAL WHITESPACE CHARS AROUND THE "=" USED IN 234 <1> ;KEYWORD DEFINITIONS, SCAN THE COMMAND LINE AND COMPRESS OUT ANY WHITESPACES 235 <1> ;NEXT TO "=" BEFORE STARTING THE USUAL PARSING. 236 <1> push cx ;AN029; 237 <1> push dx ;AN029; 238 <1> push di ;AN029; 239 <1> 240 <1> push si ;AN029; remember where command line starts 241 <1> mov cx,-1 ;AN029; init counter 242 <1> ; $do 243 <1> D_P_loc_eol: ;AN029; 244 <1> inc cx ;AN029; bump counter of chars up to EOL 245 <1> lodsb ;AN029; get a char from command line 246 <1> CALL D_P_Chk_EOL ;AN029; see if AL is EOL char 247 <1> 248 <1> ; enddo z 249 <1> D_P_loc_EOL equ D_P_loc_eol ; NASM port label 250 <1> jnz D_P_loc_EOL ;AN029; not found that EOL char 251 <1> 252 <1> D_P_count_to_EOL equ D_P_count_to_eol ; NASM port label 253 <1> mov [psdata_seg:D_P_count_to_EOL],cx ;AN029;AC034;; save count of chars up to EOL 254 <1> pop si ;AN029; restore start of command line 255 <1> 256 <1> ;scan command string for combinations including "=", 257 <1> ; and replace each with just the simple "=" 258 <1> 259 <1> ;REPEAT UNTIL ONE PASS IS MADE WHEREIN NO CHANGES WERE MADE 260 <1> ; $do 261 <1> D_P_DO1: ;AN029; 262 <1> push si ;AN029; remember where string started 263 <1> D_P_COUNT_TO_EOL equ D_P_count_to_eol ; NASM port label 264 <1> MOV CX,[psdata_seg:D_P_COUNT_TO_EOL] ;AN029;AC034;; set count to no. chars in string, 265 <1> ;AN029; not counting the EOL char 266 <1> XOR BX,BX ;AN029;SET D_P_REG_BL_DQ_SW TO "NOT IN QUOTES", AND... 267 <1> ;AN029;SET D_P_REG_BH_CG_SW TO "NO CHANGES MADE" 268 <1> ;MAKE ONE PASS THRU THE STRING, LOOKING AT EACH CHARACTER 269 <1> ; $do ;AN029; 270 <1> D_P_DO2: ;AN029; 271 <1> D_P_double_quote equ D_P_DOUBLE_QUOTE ; NASM port equate 272 <1> cmp BYTE PTR [SI],D_P_double_quote ;AN029; 273 <1> ; $if e ;AN029;if a double quote was found 274 <1> JNE D_P_IF3 ;AN029; 275 <1> NOT D_P_REG_BL_DQ_SW ;AN029;TOGGLE THE DOUBLE QUOTE STATE SWITCH 276 <1> ; $endif ;AN029; 277 <1> D_P_IF3: ;AN029; 278 <1> OR D_P_REG_BL_DQ_SW,D_P_REG_BL_DQ_SW ;AN029;IS THE DOUBLE QUOTE SWITCH SET? 279 <1> ; $if Z ;AN029;IF NOT IN DOUBLE QUOTES 280 <1> JNZ D_P_IF5 ;AN029; 281 <1> mov ax,word ptr [si] ;AN029; get pair to be checked out 282 <1> cmp ax,D_P_BL_EQ ;AN029;" =" 283 <1> ; $if e,or ;AN029; 284 <1> JE D_P_LL6 ;AN029; 285 <1> cmp ax,D_P_EQ_BL ;AN029;"= " 286 <1> ; $if e,or ;AN029; 287 <1> JE D_P_LL6 ;AN029; 288 <1> cmp ax,D_P_EQ_TB ;AN029; "=" 289 <1> ; $if e,or ;AN029; 290 <1> JE D_P_LL6 ;AN029; 291 <1> cmp ax,D_P_TB_EQ ;AN029;"=" 292 <1> ; $if e ;AN029;if this pair to be replaced with a single "=" 293 <1> JNE D_P_IF6 ;AN029; 294 <1> D_P_LL6: ;AN029; 295 <1> mov BYTE PTR [SI],D_P_Keyword ;AN029; "=" 296 <1> inc si ;AN029;point to next char after the new "=" 297 <1> mov di,si ;AN029;move target right after new "=" 298 <1> 299 <1> push si ;AN029;remember where i am, right after new "=" 300 <1> PUSH CX ;AN029;SAVE CURRENT COUNT 301 <1> inc si ;AN029;source is one beyond that 302 <1> push es ;AN029;remember the extra segment 303 <1> push ds ;AN029;temporarily, set source seg and 304 <1> pop es ;AN029; target seg to the command line seg 305 <1> rep movsb ;AN029;move chars left one position 306 <1> pop es ;AN029;restore the extra segment 307 <1> POP CX ;AN029;RESTORE CURRENT COUNT 308 <1> pop si ;AN029;back to where I was 309 <1> 310 <1> DEC SI ;AN029;LOOK AT FIRST CHAR JUST MOVED 311 <1> MOV D_P_REG_BH_CG_SW,-1 ;AN029;set switch to say "a change was made" 312 <1> DEC word [psdata_seg:D_P_COUNT_TO_EOL] ;AN029;AC034;;because just threw away a char 313 <1> dec CX ;AN029;DITTO 314 <1> ; $endif ;AN029;comparand pair found? 315 <1> D_P_IF6: ;AN029; 316 <1> ; $endif ;AN029;double quote switch? 317 <1> D_P_IF5: ;AN029; 318 <1> inc si ;AN029;bump index to look at next char in command string 319 <1> dec CX ;AN029;one less char to look at 320 <1> ;(deleted ;AC035;) CMP CX,0 ;AN029;is char count all gone yet? 321 <1> ; $enddo LE ;AN029;quit if no more chars 322 <1> JNLE D_P_DO2 ;AN029; 323 <1> pop si ;AN029;remember where string started 324 <1> OR D_P_REG_BH_CG_SW,D_P_REG_BH_CG_SW ;AN029;WAS "A CHANGE MADE"? 325 <1> ; $enddo Z ;AN029;QUIT when no changes were made 326 <1> JNZ D_P_DO1 ;AN029; 327 <1> pop di ;AN029; 328 <1> pop dx ;AN029; 329 <1> pop cx ;AN029; 330 <1> 331 <1> ;NOW THAT ALL WHITESPACE SURROUNDING "=" HAVE BEEN COMPRESSED OUT, 332 <1> ;RESUME NORMAL PARSING... 333 <1> %ENDIF ;AN029; KEYWORDS SUPPORTED? 0 00000F6D E8C906 call D_P_Skip_Delim ;AN000; Move si to 1st non white space 0 00000F70 7313 jnc D_P_Start ;AN000; If EOL is not encountered, do parse 336 <1> 337 <1> ;--------------------------- End of Line 0 00000F72 B8FFFF mov ax,D_P_RC_EOL ;AN000; set exit code to -1 0 00000F75 53 push bx ;AN000; 0 00000F76 268B1D mov bx,[es:di + D_P_PARMSX_Address] ;AN000; Get the PARMSX address to 0 00000F79 263A0F cmp cl,[es:bx + D_P_MinP] ;AN000; check ORDINAL to see if the minimum 0 00000F7C 7303 jae D_P_Fin ;AN000; positional found. 343 <1> 0 00000F7E B80200 mov ax,D_P_Op_Missing ;AN000; If no, set exit code to missing operand 345 <1> D_P_Fin: ;AN000; 0 00000F81 5B pop bx ;AN000; 0 00000F82 E91D01 jmp D_P_Single_Exit ;AN000; return to the caller 348 <1> 349 <1> ;--------------------------- 350 <1> D_P_Start: ;AN000; 0 00000F85 2E8936[9403] mov [psdata_seg:D_P_SaveSI_Cmpx],si ;AN000;AC034; save ptr to command line for later use by complex, 0 00000F8A 53 push bx ;AN000; quoted string or file spec. 0 00000F8B 57 push di ;AN000; 0 00000F8C 55 push bp ;AN000; 0 00000F8D 8D1E[9C03] lea bx,[D_P_STRING_BUF] ;AC034; set buffer to copy from command string 0 00000F91 2EF606[9303]20 test byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; 3/9 extra delimiter encountered ? 0 00000F97 7543 jne D_P_Pack_End ;AN000; 3/9 if yes, no need to copy 358 <1> 359 <1> D_P_Pack_Loop: ;AN000; 0 00000F99 AC lodsb ;AN000; Pick a operand from buffer 0 00000F9A E85907 call D_P_Chk_Switch ;AN000; Check switch character 0 00000F9D 723C jc D_P_Pack_End_BY_EOL ;AN020; if carry set found delimiter type slash, need backup si, else continue 363 <1> 0 00000F9F E8BD06 call D_P_Chk_EOL ;AN000; Check EOL character 0 00000FA2 7437 je D_P_Pack_End_BY_EOL ;AN000; need backup si 366 <1> 0 00000FA4 E8EE06 call D_P_Chk_Delim ;AN000; Check delimiter 0 00000FA7 7518 jne D_P_PL01 ;AN000; If no, process next byte 369 <1> 0 00000FA9 2EF606[9303]20 test byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; 3/9 If yes and white spec, 371 <1> ; (tm08)jne D_P_Pack_End ;AN000; 3/9 then 372 <1> D_P_Pack_End_backup_si equ D_P_PAck_End_backup_si ; NASM port label 0 00000FAF 7505 jne D_P_Pack_End_backup_si ;AN000; (tm08) 374 <1> 0 00000FB1 E88506 call D_P_Skip_Delim ;AN000; skip subsequent white space,too 0 00000FB4 EB26 jmp short D_P_Pack_End ;AN000; finish copy by placing NUL at end 377 <1> 378 <1> D_P_PAck_End_backup_si: ;AN000; (tm08) 0 00000FB6 2EF606[9303]41 test byte [psdata_seg:D_P_Flags2],D_P_SW+D_P_equ ;AN000;AC034; (tm08) 0 00000FBC 741E je D_P_Pack_End ;AN000; (tm08) 381 <1> 0 00000FBE 4E dec si ;AN000; (tm08) 0 00000FBF EB1B jmp short D_P_Pack_End ;AN025; (tm08) 384 <1> 385 <1> D_P_PL01: ;AN000; 0 00000FC1 2E8807 mov [psdata_seg:bx],al ;AN000; move byte to STRING_BUF 0 00000FC4 3C3D cmp al,D_P_Keyword ;AN000; if it is equal character, 0 00000FC6 7506 jne D_P_PL00 ;AN000; then 389 <1> 0 00000FC8 2E800E[9303]01 or byte [psdata_seg:D_P_Flags2],D_P_equ ;AC034; remember it in flag 391 <1> D_P_PL00: ;AN000; 0 00000FCE 43 inc bx ;AN000; ready to see next byte 0 00000FCF E84207 call D_P_Chk_DBCS ;AN000; was it 1st byte of DBCS ? 0 00000FD2 73C5 jnc D_P_Pack_Loop ;AN000; if no, process to next byte 395 <1> 0 00000FD4 AC lodsb ;AN000; if yes, store 0 00000FD5 2E8807 mov [psdata_seg:bx],al ;AN000; 2nd byte of DBCS 0 00000FD8 43 inc bx ;AN000; update pointer 0 00000FD9 EBBE jmp short D_P_Pack_Loop ;AN000; process to next byte 400 <1> 401 <1> D_P_Pack_End_BY_EOL: ;AN000; 0 00000FDB 4E dec si ;AN000; backup si pointer 403 <1> D_P_Pack_End: ;AN000; 0 00000FDC 2E8936[8903] mov [psdata_seg:D_P_SI_Save],si ;AC034; save next pointer, SI 0 00000FE1 2EC60700 mov byte ptr [psdata_seg:bx],D_P_NULL ;AN000; put NULL at the end 0 00000FE5 2E891E[9803] mov [psdata_seg:D_P_Save_EOB],bx ;AC034; 3/17/87 keep the address for later use of complex 0 00000FEA 268B1D mov bx,[es:di + D_P_PARMSX_Address] ;AN000; get PARMSX address 0 00000FED 8D36[9C03] lea si,[D_P_STRING_BUF] ;AC034; 0 00000FF1 2E803C2F cmp byte ptr [psdata_seg:si],D_P_Switch ;AN000; the operand begins w/ switch char ? 0 00000FF5 7430 je D_P_SW_Manager ;AN000; if yes, process as switch 411 <1> 0 00000FF7 2EF606[9303]01 test byte [psdata_seg:D_P_Flags2],D_P_equ ;AC034; the operand includes equal char ? 413 <1> D_P_Key_manager equ D_P_Key_Manager ; NASM port label 0 00000FFD 7554 jne D_P_Key_manager ;AN000; if yes, process as keyword 415 <1> 416 <1> D_P_Positional_Manager: ;AN000; else process as positional 417 <1> D_P_MaxP equ D_P_Maxp ; NASM port equate 0 00000FFF 268A4701 mov al,[es:bx + D_P_MaxP] ;AN000; get maxp 0 00001003 30E4 xor ah,ah ;AN000; ax = maxp 0 00001005 2E3906[8503] cmp [psdata_seg:D_P_ORDINAL],ax ;AC034; too many positional ? 0 0000100A 7312 jae D_P_Too_Many_Error ;AN000; if yes, set exit code to too many 422 <1> 0 0000100C 2EA1[8503] mov ax,[psdata_seg:D_P_ORDINAL] ;AC034; see what the current ordinal 0 00001010 D1E0 shl ax,1 ;AN000; ax = ax*2 0 00001012 43 inc bx ;AC035; add '2' to 0 00001013 43 inc bx ;AC035; BX reg 427 <1> ;AN000; now bx points to 1st CONTROL 428 <1> ;(changed ;AC035;) add bx,2 ;AN000; now bx points to 1st CONTROL 0 00001014 01C3 add bx,ax ;AN000; now bx points to specified CONTROL address 0 00001016 268B1F mov bx,[es:bx] ;AN000; now bx points to specified CONTROL itself 0 00001019 E88800 call D_P_Chk_Pos_Control ;AN000; Do process for positional 0 0000101C EB69 jmp short D_P_Return_to_Caller ;AN000; and return to the caller 433 <1> 434 <1> D_P_Too_Many_Error: ;AN000; 0 0000101E 2EC706[8703]0100 mov word [psdata_seg:D_P_RC],D_P_Too_Many ;AC034; set exit code 0 00001025 EB60 jmp short D_P_Return_to_Caller ;AN000; and return to the caller 437 <1> ; 438 <1> D_P_SW_Manager: ;AN000; 0 00001027 268A4701 mov al,[es:bx + D_P_MaxP] ;AN000; get maxp 0 0000102B 30E4 xor ah,ah ;AN000; ax = maxp 0 0000102D 40 inc ax ;AN000; 0 0000102E D1E0 shl ax,1 ;AN000; ax = (ax+1)*2 0 00001030 01C3 add bx,ax ;AN000; now bx points to maxs 0 00001032 268A0F mov cl,[es:bx] ;AN000; 0 00001035 30ED xor ch,ch ;AN000; cx = maxs 0 00001037 09C9 or cx,cx ;AN000; at least one switch ? 0 00001039 740F je D_P_SW_Not_Found ;AN000; 448 <1> 0 0000103B 43 inc bx ;AN000; now bx points to 1st CONTROL address 450 <1> 451 <1> D_P_SW_Mgr_Loop: ;AN000; 0 0000103C 53 push bx ;AN000; 0 0000103D 268B1F mov bx,[es:bx] ;AN000; bx points to Switch CONTROL itself 0 00001040 E8C600 call D_P_Chk_SW_Control ;AN000; do process for switch 0 00001043 5B pop bx ;AN000; 0 00001044 7341 jnc D_P_Return_to_Caller ;AN000; if the CONTROL is for the switch, exit 457 <1> 0 00001046 43 inc bx ;AC035; add '2' to 0 00001047 43 inc bx ;AC035; BX reg 460 <1> ;AN000; else bx points to the next CONTROL 461 <1> ;(changed ;AC035;) add bx,2 ;AN000; else bx points to the next CONTROL 0 00001048 E2F2 loop D_P_SW_Mgr_Loop ;AN000; and loop 463 <1> 464 <1> D_P_SW_Not_Found: ;AN000; 0 0000104A 2EC706[8703]0300 mov word [psdata_seg:D_P_RC],D_P_Not_In_SW ;AC034; here no CONTROL for the switch has 0 00001051 EB34 jmp short D_P_Return_to_Caller0 ;AN000; not been found, means error. 467 <1> ; 468 <1> D_P_Key_Manager: ;AN000; 0 00001053 268A4701 mov al,[es:bx + D_P_MaxP] ;AN000; get maxp 0 00001057 30E4 xor ah,ah ;AN000; ax = maxp 0 00001059 40 inc ax ;AN000; 0 0000105A D1E0 shl ax,1 ;AN000; ax = (ax+1)*2 0 0000105C 01C3 add bx,ax ;AN000; now bx points to maxs 0 0000105E 268A07 mov al,[es:bx] ;AN000; 0 00001061 30E4 xor ah,ah ;AN000; ax = maxs 0 00001063 D1E0 shl ax,1 ;AN000; 0 00001065 40 inc ax ;AN000; ax = ax*2+1 0 00001066 01C3 add bx,ax ;AN000; now bx points to maxk 0 00001068 268A0F mov cl,[es:bx] ;AN000; 0 0000106B 30ED xor ch,ch ;AN000; cx = maxk 0 0000106D 09C9 or cx,cx ;AN000; at least one keyword ? 0 0000106F 740F je D_P_Key_Not_Found ;AN000; 483 <1> 0 00001071 43 inc bx ;AN000; now bx points to 1st CONTROL 485 <1> 486 <1> D_P_Key_Mgr_Loop: ;AN000; 0 00001072 53 push bx ;AN000; 0 00001073 268B1F mov bx,[es:bx] ;AN000; bx points to keyword CONTROL itself 0 00001076 E85D00 call D_P_Chk_Key_Control ;AN000; do process for keyword 0 00001079 5B pop bx ;AN000; 0 0000107A 730B jnc D_P_Return_to_Caller ;AN000; if the CONTROL is for the keyword, exit 492 <1> 0 0000107C 43 inc bx ;AC035; add '2' to 0 0000107D 43 inc bx ;AC035; BX reg 495 <1> ;AN000; else bx points to the next CONTROL 496 <1> ;(changed ;AC035;) add bx,2 ;AN000; else bx points to the next CONTROL 0 0000107E E2F2 loop D_P_Key_Mgr_Loop ;AN000; and loop 498 <1> 499 <1> D_P_Key_Not_Found: ;AN000; 0 00001080 2EC706[8703]0400 mov word [psdata_seg:D_P_RC],D_P_Not_In_Key ;AC034; here no CONTROL for the keyword has 501 <1> D_P_Return_to_Caller0: ;AN000; not been found, means error. 502 <1> 503 <1> ;(deleted ;AN024;) mov bx,[es:bx-2] ;AN000; (tm13) backup bx 504 <1> 505 <1> ;(deleted ;AN024;) mov al,D_P_String ;AN000; Set 506 <1> ;(deleted ;AN024;) mov ah,D_P_No_Tag ;AN000; result 507 <1> ;(deleted ;AN024;) call D_P_Fill_Result ;AN000; buffer 508 <1> 509 <1> D_P_Return_to_Caller: ;AN000; 0 00001087 5D pop bp ;AN000; 0 00001088 5F pop di ;AN000; 0 00001089 5B pop bx ;AN000; 513 <1> D_P_Ordinal equ D_P_ORDINAL ; NASM port label 0 0000108A 2E8B0E[8503] mov cx,[psdata_seg:D_P_Ordinal] ;AC034; return next ordinal 0 0000108F 2EA1[8703] mov ax,[psdata_seg:D_P_RC] ;AC034; return exit code 0 00001093 2E8B36[8903] mov si,[psdata_seg:D_P_SI_Save] ;AC034; return next operand pointer 0 00001098 2E8B16[8B03] mov dx,[psdata_seg:D_P_DX] ;AC034; return result buffer address 0 0000109D 2E8A1E[8D03] mov bl,[psdata_seg:D_P_Terminator] ;AC034; return delimiter code found 519 <1> D_P_Single_Exit: ;AN000; 0 000010A2 F8 clc ;AN000; 0 000010A3 C3 ret ;AN000; 522 <1> SysParse endp ;AN000; 523 <1> ;PAGE ;AN000; 524 <1> ;*********************************************************************** 525 <1> ; D_P_Chk_Pos_Control 526 <1> ; 527 <1> ; Function: Parse CONTROL block for a positional 528 <1> ; 529 <1> ; Input: ES:BX -> CONTROL block 530 <1> ; psdata_seg:SI -> D_P_STRING_BUF 531 <1> ; 532 <1> ; Output: None 533 <1> ; 534 <1> ; Use: D_P_Fill_Result, D_P_Check_Match_Flags 535 <1> ; 536 <1> ; Vars: D_P_Ordinal(W), D_P_RC(W) 537 <1> ;*********************************************************************** 538 <1> D_P_Chk_Pos_Control proc ;AN000; 0 000010A4 50 push ax ;AN000; 0 000010A5 268B07 mov ax,[es:bx + D_P_Match_Flag] ;AN000; 0 000010A8 A90200 test ax,D_P_Repeat ;AN000; repeat allowed ? 0 000010AB 7505 jne D_P_CPC00 ;AN000; then do not increment ORDINAL 543 <1> 0 000010AD 2EFF06[8503] inc word [psdata_seg:D_P_ORDINAL] ;AC034; update the ordinal 545 <1> D_P_CPC00: ;AN000; 0 000010B2 2E803C00 cmp byte ptr [psdata_seg:si],D_P_NULL ;AN000; no data ? 0 000010B6 7519 jne D_P_CPC01 ;AN000; 548 <1> 0 000010B8 A90100 test ax,D_P_Optional ;AN000; yes, then is it optional ? 0 000010BB 7509 jne D_P_CPC02 ;AN000; 551 <1> 0 000010BD 2EC706[8703]0200 mov word [psdata_seg:D_P_RC],D_P_Op_Missing ;AC034; no, then error 3/17/87 0 000010C4 EB0E jmp short D_P_CPC_Exit ;AN000; 554 <1> 555 <1> D_P_CPC02: ;AN000; 0 000010C6 50 push ax ;AN000; 0 000010C7 B003 mov al,D_P_String ;AN000; if it is optional return NULL 0 000010C9 B4FF mov ah,D_P_No_Tag ;AN000; no item tag indication 0 000010CB E89E00 call D_P_Fill_Result ;AN000; 0 000010CE 58 pop ax ;AN000; 0 000010CF EB03 jmp short D_P_CPC_Exit ;AN000; 562 <1> 563 <1> D_P_CPC01: ;AN000; 0 000010D1 E81D01 call D_P_Check_Match_Flags ;AN000; 565 <1> D_P_CPC_Exit: ;AN000; 0 000010D4 58 pop ax ;AN000; 0 000010D5 C3 ret ;AN000; 568 <1> D_P_Chk_Pos_Control endp ;AN000; 569 <1> ;PAGE ;AN000; 570 <1> ;*********************************************************************** 571 <1> ; D_P_Chk_Key_Control 572 <1> ; 573 <1> ; Function: Parse CONTROL block for a keyword 574 <1> ; 575 <1> ; Input: ES:BX -> CONTROL block 576 <1> ; psdata_seg:SI -> D_P_STRING_BUF 577 <1> ; 578 <1> ; Output: CY = 1 : not match 579 <1> ; 580 <1> ; Use: D_P_Fill_Result, D_P_Search_KEYorSW, D_P_Check_Match_Flags 581 <1> ; 582 <1> ; Vars: D_P_RC(W), D_P_SaveSI_Cmpx(W), D_P_KEYorSW_Ptr(R), D_P_Flags(W) 583 <1> ;*********************************************************************** 584 <1> D_P_Chk_Key_Control proc ;AN000; 585 <1> %IF KeySW ;AN000;(Check if keyword is supported) 586 <1> or byte [psdata_seg:D_P_Flags2],D_P_Key_Cmp ;AC034; Indicate keyword for later string comparison 587 <1> call D_P_Search_KEYorSW ;AN000; Search the keyword in the CONTROL block 588 <1> jc D_P_Chk_Key_Err0 ;AN000; not found, then try next CONTROL 589 <1> 590 <1> and byte [psdata_seg:D_P_Flags2],0ffh-D_P_Key_Cmp ;AC034; reset the indicator previously set 591 <1> ; 592 <1> push ax ;AN000; keyword= 593 <1> mov ax,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034; ^ ^ 594 <1> sub ax,si ;AN000; SI KEYorSW 595 <1> add [psdata_seg:D_P_SaveSI_Cmpx],ax ;AC034; update for complex, quoted or file spec. 596 <1> pop ax ;AN000; 597 <1> ; 598 <1> mov si,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034; set si just after equal char 599 <1> cmp byte ptr [psdata_seg:si],D_P_NULL ;AN000; any data after equal ? 600 <1> je D_P_Chk_Key_Err1 ;AN000; if no, syntax error 601 <1> 602 <1> call D_P_Check_Match_Flags ;AN000; else, process match flags 603 <1> clc ;AN000; 604 <1> jmp short D_P_Chk_Key_Exit ;AN000; 605 <1> 606 <1> D_P_Chk_Key_Err0: ;AN000; 607 <1> stc ;AN000; not found in keyword synonym list 608 <1> jmp short D_P_Chk_Key_Exit ;AN000; 609 <1> 610 <1> D_P_Chk_Key_Err1: ;AN000; 611 <1> mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; no parameter is not specified after "=" 612 <1> D_P_Chk_Key_ErrExit: ;AN000; 613 <1> push ax ;AN000; 614 <1> mov al,D_P_String ;AN000; set 615 <1> mov ah,D_P_No_Tag ;AN000; result 616 <1> call D_P_Fill_Result ;AN000; buffer 617 <1> pop ax ;AN000; 618 <1> clc ;AN000; 619 <1> D_P_Chk_Key_Exit: ;AN000; 620 <1> ret ;AN000; 621 <1> %ELSE ;AN000;(of IF KeySW) 0 000010D6 F9 stc ;AN000;this logic works when the KeySW 0 000010D7 C3 ret ;AN000;is reset. 624 <1> %ENDIF ;AN000;(of KeySW) 625 <1> D_P_Chk_Key_Control endp ;AN000; 626 <1> ;PAGE ;AN000; 627 <1> ;*********************************************************************** 628 <1> %IF KeySW+SwSW ;AN000;(Check if keyword or switch is supported) 629 <1> ; D_P_Search_KEYorSW: 630 <1> ; 631 <1> ; Function: Seach specified keyword or switch from CONTROL 632 <1> ; 633 <1> ; Input: ES:BX -> CONTROL block 634 <1> ; psdata_seg:SI -> D_P_STRING_BUF 635 <1> ; 636 <1> ; Output: CY = 1 : not match 637 <1> ; 638 <1> ; Use: D_P_String_Comp, D_P_MoveBP_NUL, D_P_Found_SYNONYM 639 <1> ;*********************************************************************** 640 <1> D_P_Search_KEYorSW proc ;AN000; 0 000010D8 55 push bp ;AN000; 0 000010D9 51 push cx ;AN000; 0 000010DA 268A4F08 mov cl,[es:bx + D_P_nid] ;AN000; Get synonym count 0 000010DE 30ED xor ch,ch ;AN000; and set it to cx 0 000010E0 09C9 or cx,cx ;AN000; No synonyms specified ? 0 000010E2 740D je D_P_KEYorSW_Not_Found ;AN000; then indicate not found by CY 647 <1> 648 <1> D_P_KEYorSW equ D_P_KeyorSW ; NASM port equate 0 000010E4 8D6F09 lea bp,[bx + D_P_KEYorSW] ;AN000; BP points to the 1st synonym 650 <1> D_P_KEYorSW_Loop: ;AN000; 0 000010E7 E8E203 call D_P_String_Comp ;AN000; compare string in buffer w/ the synonym 0 000010EA 7308 jnc D_P_KEYorSW_Found ;AN000; If match, set it to synonym pointer 653 <1> 0 000010EC E80E00 call D_P_MoveBP_NUL ;AN000; else, bp points to the next string 0 000010EF E2F6 loop D_P_KEYorSW_Loop ;AN000; loop nid times 656 <1> D_P_KEYorSW_Not_Found: ;AN000; 0 000010F1 F9 stc ;AN000; indicate not found in synonym list 0 000010F2 EB06 jmp short D_P_KEYorSW_Exit ;AN000; and exit 659 <1> 660 <1> D_P_KEYorSW_Found: ;AN000; 0 000010F4 2E892E[9A03] mov [psdata_seg:D_P_Found_SYNONYM],bp ;AC034; set synonym pointer 0 000010F9 F8 clc ;AN000; indicate found 663 <1> D_P_KEYorSW_Exit: ;AN000; 0 000010FA 59 pop cx ;AN000; 0 000010FB 5D pop bp ;AN000; 0 000010FC C3 ret ;AN000; 667 <1> D_P_Search_KEYorSW endp ;AN000; 668 <1> ;*********************************************************************** 669 <1> ; D_P_MoveBP_NUL 670 <1> ;*********************************************************************** 671 <1> D_P_MoveBP_NUL proc ;AN000; 672 <1> D_P_MBP_Loop: ;AN000; 0 000010FD 26807E0000 cmp byte ptr [es:bp],D_P_NULL ;AN000; Increment BP that points 0 00001102 7403 je D_P_MBP_Exit ;AN000; to the synomym list 675 <1> 0 00001104 45 inc bp ;AN000; until 0 00001105 EBF6 jmp short D_P_MBP_Loop ;AN000; NULL encountered. 678 <1> 679 <1> D_P_MBP_Exit: ;AN000; 0 00001107 45 inc bp ;AN000; bp points to next to NULL 0 00001108 C3 ret ;AN000; 682 <1> D_P_MoveBP_NUL endp ;AN000; 683 <1> %ENDIF ;AN000;(of KeySW+SwSW) 684 <1> ;PAGE ;AN000; 685 <1> ;*********************************************************************** 686 <1> ; D_P_Chk_SW_Control 687 <1> ; 688 <1> ; Function: Parse CONTROL block for a switch 689 <1> ; 690 <1> ; Input: ES:BX -> CONTROL block 691 <1> ; psdata_seg:SI -> D_P_STRING_BUF 692 <1> ; 693 <1> ; Output: CY = 1 : not match 694 <1> ; 695 <1> ; Use: D_P_Fill_Result, D_P_Search_KEYorSW, D_P_Check_Match_Flags 696 <1> ; 697 <1> ; Vars: D_P_SaveSI_Cmpx(W), D_P_KEYorSW_Ptr(R), D_P_Flags(W) 698 <1> ;*********************************************************************** 699 <1> D_P_Chk_SW_Control proc ;AN000; 700 <1> 701 <1> 702 <1> %IF SwSW ;AN000;(Check if switch is supported) 703 <1> D_P_Sw_Cmp equ D_P_SW_Cmp ; NASM port equate 0 00001109 2E800E[9303]10 or byte [psdata_seg:D_P_Flags2],D_P_Sw_Cmp ;AC034; Indicate switch for later string comparison 0 0000110F E8C6FF call D_P_Search_KEYorSW ;AN000; Search the switch in the CONTROL block 0 00001112 724A jc D_P_Chk_SW_Err0 ;AN000; not found, then try next CONTROL 707 <1> 0 00001114 2E8026[9303]EF and byte [psdata_seg:D_P_Flags2],0ffh-D_P_Sw_Cmp ;AC034; reset the indicator previously set 709 <1> ; 0 0000111A 50 push ax ;AN000; /switch: 0 0000111B 2EA1[9603] mov ax,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034; ^ ^ 0 0000111F 29F0 sub ax,si ;AN000; SI KEYorSW 0 00001121 2E0106[9403] add [psdata_seg:D_P_SaveSI_Cmpx],ax ;AC034; update for complex list 0 00001126 58 pop ax ;AN000; 715 <1> ; 0 00001127 2E8B36[9603] mov si,[psdata_seg:D_P_KEYorSW_Ptr] ;AC034; set si at the end or colon 0 0000112C 2E803C00 cmp byte ptr [psdata_seg:si],D_P_NULL ;AN000; any data after colon 0 00001130 7526 jne D_P_CSW00 ;AN000; if yes, process match flags 719 <1> 0 00001132 2E807CFF3A cmp byte ptr [psdata_seg:si-1],D_P_Colon ;AN000; if no, the switch terminated by colon ? 0 00001137 7509 jne D_P_Chk_if_data_required ;AN000; if yes, 722 <1> 0 00001139 2EC706[8703]0900 mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; return syntax error 0 00001140 EB1F jmp short D_P_Chk_SW_Exit ;AN000; 725 <1> 726 <1> D_P_Chk_if_data_required: ;AN018; no data, no colon 0 00001142 26833F00 cmp word [es:bx + D_P_Match_Flag],0 ;AN018; should have data? zero match flag means switch followed by nothing is OK 0 00001146 7419 je D_P_Chk_SW_Exit ;AN018; match flags not zero so should have something if optional bit is not on 729 <1> 0 00001148 26F7070100 test word [es:bx + D_P_Match_Flag],D_P_Optional ;AN019; see if no value is valid 0 0000114D 7512 jnz D_P_Chk_SW_Exit ;AN019; if so, then leave, else yell 732 <1> 0 0000114F 2EC706[8703]0200 mov word [psdata_seg:D_P_RC],D_P_Op_Missing ;AC034; return required operand missing 0 00001156 EB09 jmp short D_P_Chk_SW_Exit ;AN018; 735 <1> 736 <1> D_P_CSW00: ;AN000; 0 00001158 E89600 call D_P_Check_Match_Flags ;AN000; process match flag 0 0000115B F8 clc ;AN000; indicate match 0 0000115C EB0D jmp short D_P_Chk_SW_Single_Exit ;AN000; 740 <1> 741 <1> D_P_Chk_SW_Err0: ;AN000; 0 0000115E F9 stc ;AN000; not found in switch synonym list 0 0000115F EB0A jmp short D_P_Chk_SW_Single_Exit ;AN000; 744 <1> 745 <1> D_P_Chk_SW_Exit: ;AN000; 0 00001161 50 push ax ;AN000; 0 00001162 B003 mov al,D_P_String ;AN000; set 0 00001164 B4FF mov ah,D_P_No_Tag ;AN000; result 0 00001166 E80300 call D_P_Fill_Result ;AN000; buffer 0 00001169 58 pop ax ;AN000; 0 0000116A F8 clc ;AN000; 752 <1> D_P_Chk_SW_Single_Exit: ;AN000; 0 0000116B C3 ret ;AN000; 754 <1> %ELSE ;AN000;(of IF SwSW) 755 <1> stc ;AN000; this logic works when the SwSW 756 <1> ret ;AN000; is reset. 757 <1> %ENDIF ;AN000;(of SwSW) 758 <1> D_P_Chk_SW_Control endp ;AN000; 759 <1> ;PAGE ;AN000; 760 <1> ;*********************************************************************** 761 <1> ; D_P_Fill_Result 762 <1> ; 763 <1> ; Function: Fill the result buffer 764 <1> ; 765 <1> ; Input: AH = Item tag 766 <1> ; AL = type 767 <1> ; AL = 1: CX,DX has 32bit number (CX = high) 768 <1> ; AL = 2: DX has index(offset) into value list 769 <1> ; AL = 6: DL has driver # (1-A, 2-B, ... , 26 - Z) 770 <1> ; AL = 7: DX has year, CL has month and CH has date 771 <1> ; AL = 8: DL has hours, DH has minutes, CL has secondsn, 772 <1> ; amd CH has hundredths 773 <1> ; AL = else: psdata_seg:SI points to returned string buffer 774 <1> ; ES:BX -> CONTROL block 775 <1> ; 776 <1> ; Output: None 777 <1> ; 778 <1> ; Use: D_P_Do_CAPS_String, D_P_Remove_Colon, D_P_Found_SYNONYM 779 <1> ; 780 <1> ; Vars: D_P_DX(W) 781 <1> ;*********************************************************************** 782 <1> D_P_Fill_Result proc ;AN000; 0 0000116C 57 push di ;AN000; 0 0000116D 268B7F04 mov di,[es:bx + D_P_Result_Buf] ;AN000; di points to result buffer 0 00001171 2E893E[8B03] mov [psdata_seg:D_P_DX],di ;AC034; set returned result address 0 00001176 268805 mov [es:di + D_P_Type],al ;AN000; store type 0 00001179 26886501 mov [es:di + D_P_Item_Tag],ah ;AN000; store item tag 0 0000117D 50 push ax ;AN000; 0 0000117E 2EA1[9A03] mov ax,[psdata_seg:D_P_Found_SYNONYM] ;AC034; if yes, 0 00001182 26894502 mov [es:di + D_P_SYNONYM_Ptr],ax ;AN000; then set it to the result 0 00001186 58 pop ax ;AN000; 792 <1> D_P_RLT04: ;AN000; 0 00001187 3C01 cmp al,D_P_Number ;AN000; if number 0 00001189 750A jne D_P_RLT00 ;AN000; 795 <1> 796 <1> D_P_RLT02: ;AN000; 0 0000118B 26895504 mov word ptr [es:di + D_P_Picked_Val],dx ;AN000; then store 32bit 0 0000118F 26894D06 mov word ptr [es:di+2 + D_P_Picked_Val],cx ;AN000; number 0 00001193 EB5A jmp short D_P_RLT_Exit ;AN000; 800 <1> 801 <1> D_P_RLT00: ;AN000; 0 00001195 3C02 cmp al,D_P_List_Idx ;AN000; if list index 0 00001197 7506 jne D_P_RLT01 ;AN000; 804 <1> 0 00001199 26895504 mov word ptr [es:di + D_P_Picked_Val],dx ;AN000; then store list index 0 0000119D EB50 jmp short D_P_RLT_Exit ;AN000; 807 <1> 808 <1> D_P_RLT01: ;AN000; 0 0000119F 3C07 cmp al,D_P_Date_F ;AN000; Date format ? 0 000011A1 74E8 je D_P_RLT02 ;AN000; 811 <1> 0 000011A3 3C08 cmp al,D_P_Time_F ;AN000; Time format ? 0 000011A5 74E4 je D_P_RLT02 ;AN000; 814 <1> ; 0 000011A7 3C06 cmp al,D_P_Drive ;AN000; drive format ? 0 000011A9 7506 jne D_P_RLT03 ;AN000; 817 <1> 0 000011AB 26885504 mov byte ptr [es:di + D_P_Picked_Val],dl ;AN000; store drive number 0 000011AF EB3E jmp short D_P_RLT_Exit ;AN000; 820 <1> 821 <1> D_P_RLT03: ;AN000; 0 000011B1 3C04 cmp al,D_P_Complex ;AN000; complex format ? 0 000011B3 750F jne D_P_RLT05 ;AN000; 824 <1> 0 000011B5 2EA1[9403] mov ax,[psdata_seg:D_P_SaveSI_Cmpx] ;AC034; then get pointer in command buffer 0 000011B9 40 inc ax ;AN000; skip left Parentheses 0 000011BA 26894504 mov word ptr [es:di + D_P_Picked_Val],ax ;AN000; store offset 0 000011BE 268C5D06 mov word ptr [es:di+2 + D_P_Picked_Val],ds ;AN000; store segment 0 000011C2 EB2B jmp short D_P_RLT_Exit ;AN000; 830 <1> 831 <1> D_P_RLT05: ;AN000; 832 <1> ;------------------------ AL = 3, 5, or 9 0 000011C4 26897504 mov word ptr [es:di + D_P_Picked_Val],si ;AN000; store offset of STRING_BUF 834 <1> ;(replaced ;AN031;) mov word ptr [es:di+word].D_P_Picked_Val,cs ;AN000; store segment of STRING_BUF 0 000011C8 268C4D06 mov word ptr [es:di+2 + D_P_Picked_Val],Psdata_Seg ;AN031; store segment of STRING_BUF 836 <1> ; 0 000011CC 50 push ax ;AN000; 0 000011CD 26F6470201 test byte ptr [es:bx + D_P_Function_Flag],D_P_CAP_File ;AN000; need CAPS by file table? 0 000011D2 7404 je D_P_RLT_CAP00 ;AN000; 840 <1> 0 000011D4 B004 mov al,D_P_DOSTBL_File ;AN000; use file upper case table 0 000011D6 EB09 jmp short D_P_RLT_CAP02 ;AN000; 843 <1> 844 <1> D_P_RLT_CAP00: ;AN000; 0 000011D8 26F6470202 test byte ptr [es:bx + D_P_Function_Flag],D_P_CAP_Char ;AN000; need CAPS by char table ? 0 000011DD 7405 je D_P_RLT_CAP01 ;AN000; 847 <1> 0 000011DF B002 mov al,D_P_DOSTBL_Char ;AN000; use character upper case table 849 <1> D_P_RLT_CAP02: ;AN000; 0 000011E1 E8E500 call D_P_Do_CAPS_String ;AN000; process CAPS along the table 851 <1> D_P_RLT_CAP01: ;AN000; 0 000011E4 58 pop ax ;AN000; 0 000011E5 26F6470210 test byte ptr [es:bx + D_P_Function_Flag],D_P_Rm_Colon ;AN000; removing colon at end ? 0 000011EA 7403 je D_P_RLT_Exit ;AN000; 855 <1> 0 000011EC E8B400 call D_P_Remove_Colon ;AN000; then process it. 857 <1> D_P_RLT_Exit: ;AN000; 0 000011EF 5F pop di ;AN000; 0 000011F0 C3 ret ;AN000; 860 <1> D_P_Fill_Result endp ;AN000; 861 <1> ;PAGE ;AN000; 862 <1> ;*********************************************************************** 863 <1> ; D_P_Check_Match_Flags 864 <1> ; 865 <1> ; Function: Check the mutch_flags and make the exit code and set the 866 <1> ; result buffer 867 <1> ; 868 <1> ; Check for types in this order: 869 <1> ; Complex 870 <1> ; Date 871 <1> ; Time 872 <1> ; Drive 873 <1> ; Filespec 874 <1> ; Quoted String 875 <1> ; Simple String 876 <1> ; 877 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 878 <1> ; ES:BX -> CONTROL block 879 <1> ; 880 <1> ; Output: None 881 <1> ; 882 <1> ; Use: D_P_Value, P$_SValue, D_P_Simple_String, D_P_Date_Format 883 <1> ; D_P_Time_Format, D_P_Complex_Format, D_P_File_Foemat 884 <1> ; D_P_Drive_Format 885 <1> ;*********************************************************************** 886 <1> D_P_Check_Match_Flags proc ;AN000; 0 000011F1 2EC606[2A04]00 mov byte [psdata_seg:D_P_err_flag],D_P_NULL ;AN033;AC034;; clear filespec error flag. 0 000011F7 50 push ax ;AN000; 0 000011F8 268B07 mov ax,[es:bx + D_P_Match_Flag] ;AN000; load match flag(16bit) to ax 890 <1> 0 000011FB 09C0 or ax,ax ;AC035; test ax for zero 892 <1> ;(changed ;AC035;) cmp ax,0 ;AN000; (tm12) 0 000011FD 7518 jne D_P_Mat ;AN000; (tm12) 894 <1> 0 000011FF 50 push ax ;AN000; (tm12) 0 00001200 53 push bx ;AN000; (tm12) 0 00001201 52 push dx ;AN000; (tm12) 0 00001202 57 push di ;AN000; (tm12) 0 00001203 2EC706[8703]0900 mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; (tm12) 0 0000120A B4FF mov ah,D_P_No_Tag ;AN000; (tm12) 0 0000120C B003 mov al,D_P_String ;AN000; (tm12) 0 0000120E E85BFF call D_P_Fill_Result ;AN000; (tm12) 0 00001211 5F pop di ;AN000; (tm12) 0 00001212 5A pop dx ;AN000; (tm12) 0 00001213 5B pop bx ;AN000; (tm12) 0 00001214 58 pop ax ;AN000; (tm12) 0 00001215 EB02 jmp short D_P_Bridge ;AC035; (tm12) 908 <1> 909 <1> D_P_Mat: ;AN000; (tm12) 910 <1> 911 <1> %IF CmpxSW ;AN000;(Check if complex item is supported) 912 <1> test ax,D_P_Cmpx_S ;AN000; Complex string 913 <1> je D_P_Match01 ;AN000; 914 <1> 915 <1> mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 916 <1> call D_P_Complex_Format ;AN000; do process 917 <1> cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 918 <1> jne D_P_Bridge ;AN000; 919 <1> 920 <1> D_P_Match01: ;AN000; 921 <1> %ENDIF ;AN000;(of CmpxSW) 922 <1> %IF DateSW ;AN000;(Check if date format is supported) 923 <1> test ax,D_P_Date_S ;AN000; Date string 924 <1> je D_P_Match02 ;AN000; 925 <1> 926 <1> mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 927 <1> call D_P_Date_Format ;AN000; do process 928 <1> cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 929 <1> jne D_P_Bridge ;AN000; 930 <1> 931 <1> D_P_Match02: ;AN000; 932 <1> %ENDIF ;AN000;(of DateSW) 933 <1> %IF TimeSW ;AN000;(Check if time format is supported) 934 <1> test ax,D_P_Time_S ;AN000; Time string 935 <1> je D_P_Match03 ;AN000; 936 <1> 937 <1> mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 938 <1> call D_P_Time_Format ;AN000; do process 939 <1> cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 940 <1> ; je D_P_Match03 ;AN000: 941 <1> 942 <1> jne D_P_Bridge ;AN000; (tm09) 943 <1> 944 <1> %ENDIF ;AN000;(of TimeSW) (tm04) 0 00001217 EB03 jmp short D_P_Match03 ;AN025; (tm09) 946 <1> 947 <1> D_P_Bridge: ;AN000; 948 <1> ; jmp short D_P_Match_Exit (tm02) 949 <1> 0 00001219 EB6F jmp D_P_Match_Exit ;AN000; (tm02) 0 0000121B 90 nop ; identicalise 952 <1> 953 <1> D_P_Match03: ;AN000; 954 <1> ; ENDIF ;AN000;(of TimeSW) (tm04) 955 <1> %IF NumSW ;AN000;(Check if numeric value is supported) 0 0000121C A90080 test ax,D_P_Num_Val ;AN000; Numeric value 0 0000121F 7412 je D_P_Match04 ;AN000; 958 <1> 0 00001221 2EC706[8703]0000 mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 0 00001228 E82601 call D_P_Value ;AN000; do process 0 0000122B 2E833E[8703]09 cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 0 00001231 7557 jne D_P_Match_Exit ;AN000; 963 <1> 964 <1> D_P_Match04: ;AN000; 965 <1> D_P_SNUM_Val equ D_P_SNum_Val ; NASM port equate 0 00001233 A90040 test ax,D_P_SNUM_Val ;AN000; Signed numeric value 0 00001236 7412 je D_P_Match05 ;AN000; 968 <1> 0 00001238 2EC706[8703]0000 mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 0 0000123F E8EB00 call D_P_SValue ;AN000; do process 0 00001242 2E833E[8703]09 cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 0 00001248 7540 jne D_P_Match_Exit ;AN000; 973 <1> 974 <1> D_P_Match05: ;AN000; 975 <1> %ENDIF ;AN000;(of NumSW) 976 <1> %IF DrvSW ;AN000;(Check if drive only is supported) 0 0000124A A90001 test ax,D_P_Drv_Only ;AN000; Drive only 0 0000124D 7415 je D_P_Match06 ;AN000; 979 <1> 0 0000124F 2EC706[8703]0000 mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 0 00001256 E81603 call D_P_File_Format ;AN000; 1st, call file format 0 00001259 E89903 call D_P_Drive_Format ;AN000; check drive format, next 0 0000125C 2E833E[8703]09 cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examinee the next type 0 00001262 7526 jne D_P_Match_Exit ;AN000; 985 <1> 986 <1> D_P_Match06: ;AN000; 987 <1> %ENDIF ;AN000;(of DrvSW) 988 <1> %IF FileSW ;AN000;(Check if file spec is supported) 0 00001264 A90002 test ax,D_P_File_Spc ;AN000; File spec 0 00001267 7412 je D_P_Match07 ;AN000; 991 <1> 0 00001269 2EC706[8703]0000 mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 0 00001270 E8FC02 call D_P_File_Format ;AN000; do process 0 00001273 2E833E[8703]09 cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 0 00001279 750F jne D_P_Match_Exit ;AN000; 996 <1> 997 <1> D_P_Match07: ;AN000; 998 <1> %ENDIF ;AN000;(of FileSW) 999 <1> %IF QusSW ;AN000;(Check if quoted string is supported) 1000 <1> test ax,D_P_Qu_String ;AN000; Quoted string 1001 <1> je D_P_Match08 ;AN000; 1002 <1> 1003 <1> mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 1004 <1> call D_P_Quoted_Format ;AN000; do process 1005 <1> cmp word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; if error, examine the next type 1006 <1> jne D_P_Match_Exit ;AN000; 1007 <1> 1008 <1> D_P_Match08: ;AN000; 1009 <1> %ENDIF ;AN000;(of QusSW) 0 0000127B A90020 test ax,D_P_Simple_S ;AN000; Simple string 0 0000127E 740A je D_P_Match09 ;AN000; 1012 <1> 0 00001280 2EC706[8703]0000 mov word [psdata_seg:D_P_RC],D_P_No_Error ;AC034; assume no error 0 00001287 E8D901 call D_P_Simple_String ;AN000; do process 1015 <1> ;;;; cmp psdata_seg:D_P_RC,D_P_Syntax ;AC034; These two lines will be alive 1016 <1> ;;;; jne D_P_Match_Exit ;when extending the match_flags. 1017 <1> D_P_Match09: ;AN000; 1018 <1> D_P_Match_Exit: ;AN000; 0 0000128A 2E803E[2A04]01 cmp byte [psdata_seg:D_P_err_flag],D_P_error_filespec ;AC034; bad filespec ? 0 00001290 750F jne D_P_Match2_Exit ;AN033; no, continue 0 00001292 2E833E[8703]00 cmp word [psdata_seg:D_P_RC],D_P_No_Error ;AN033;AC034;; check for other errors ? 0 00001298 7507 jne D_P_Match2_Exit ;AN033; no, continue 0 0000129A 2EC706[8703]0900 mov word [psdata_seg:D_P_RC],D_P_Syntax ;AN033;AC034;; set error flag 1024 <1> D_P_Match2_Exit: ;AN033; 0 000012A1 58 pop ax ;AN000; 0 000012A2 C3 ret ;AN000; 1027 <1> D_P_Check_Match_Flags endp ;AN000; 1028 <1> ;PAGE ;AN000; 1029 <1> ;*********************************************************************** 1030 <1> ; D_P_Remove_Colon; 1031 <1> ; 1032 <1> ; Function: Remove colon at end 1033 <1> ; 1034 <1> ; Input: psdata_seg:SI points to string buffer to be examineed 1035 <1> ; 1036 <1> ; Output: None 1037 <1> ; 1038 <1> ; Use: D_P_Chk_DBCS 1039 <1> ;*********************************************************************** 1040 <1> D_P_Remove_Colon proc ;AN000; 0 000012A3 50 push ax ;AN000; 0 000012A4 56 push si ;AN000; 1043 <1> D_P_RCOL_Loop: ;AN000; 0 000012A5 2E8A04 mov al,[psdata_seg:si] ;AN000; get character 0 000012A8 08C0 or al,al ;AN000; end of string ? 0 000012AA 741A je D_P_RCOL_Exit ;AN000; if yes, just exit 1047 <1> 0 000012AC 3C3A cmp al,D_P_Colon ;AN000; is it colon ? 0 000012AE 750D jne D_P_RCOL00 ;AN000; 1050 <1> 0 000012B0 2E807C0100 cmp byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; if so, next is NULL ? 0 000012B5 7506 jne D_P_RCOL00 ;AN000; no, then next char 1053 <1> 0 000012B7 2EC60400 mov byte ptr [psdata_seg:si],D_P_NULL ;AN000; yes, remove colon 0 000012BB EB09 jmp short D_P_RCOL_Exit ;AN000; and exit. 1056 <1> 1057 <1> D_P_RCOL00: ;AN000; 0 000012BD E85404 call D_P_Chk_DBCS ;AN000; if not colon, then check if 0 000012C0 7301 jnc D_P_RCOL01 ;AN000; DBCS leading byte. 1060 <1> 0 000012C2 46 inc si ;AN000; if yes, skip trailing byte 1062 <1> D_P_RCOL01: ;AN000; 0 000012C3 46 inc si ;AN000; si points to next byte 0 000012C4 EBDF jmp short D_P_RCOL_Loop ;AN000; loop until NULL encountered 1065 <1> 1066 <1> D_P_RCOL_Exit: ;AN000; 0 000012C6 5E pop si ;AN000; 0 000012C7 58 pop ax ;AN000; 0 000012C8 C3 ret ;AN000; 1070 <1> D_P_Remove_Colon endp ;AN000; 1071 <1> ;PAGE ;AN000; 1072 <1> ;*********************************************************************** 1073 <1> ; D_P_Do_CAPS_String; 1074 <1> ; 1075 <1> ; Function: Perform capitalization along with the file case map table 1076 <1> ; or character case map table. 1077 <1> ; 1078 <1> ; Input: AL = 2 : Use character table 1079 <1> ; AL = 4 : Use file table 1080 <1> ; psdata_seg:SI points to string buffer to be capitalized 1081 <1> ; 1082 <1> ; Output: None 1083 <1> ; 1084 <1> ; Use: D_P_Do_CAPS_Char, D_P_Chk_DBCS 1085 <1> ;*********************************************************************** 1086 <1> D_P_Do_CAPS_String proc ;AN000; 0 000012C9 56 push si ;AN000; 0 000012CA 52 push dx ;AN000; 0 000012CB 88C2 mov dl,al ;AN000; save info id 1090 <1> 1091 <1> D_P_DCS_Loop: ;AN000; 0 000012CD 2E8A04 mov al,[psdata_seg:si] ;AN000; load charater and 0 000012D0 E84104 call D_P_Chk_DBCS ;AN000; check if DBCS leading byte 0 000012D3 720C jc D_P_DCS00 ;AN000; if yes, do not need CAPS 1095 <1> 0 000012D5 08C0 or al,al ;AN000; end of string ? 0 000012D7 740C je D_P_DCS_Exit ;AN000; then exit. 1098 <1> 0 000012D9 E80C00 call D_P_Do_CAPS_Char ;AN000; Here a SBCS char need to be CAPS 0 000012DC 2E8804 mov [psdata_seg:si],al ;AN000; stored upper case char to buffer 0 000012DF EB01 jmp short D_P_DCS01 ;AN000; process nexit 1102 <1> D_P_DCS00: ;AN000; 0 000012E1 46 inc si ;AN000; skip DBCS leading and trailing byte 1104 <1> D_P_DCS01: ;AN000; 0 000012E2 46 inc si ;AN000; si point to next byte 0 000012E3 EBE8 jmp short D_P_DCS_Loop ;AN000; loop until NULL encountered 1107 <1> D_P_DCS_Exit: ;AN000; 0 000012E5 5A pop dx ;AN000; 0 000012E6 5E pop si ;AN000; 0 000012E7 C3 ret ;AN000; 1111 <1> D_P_Do_CAPS_String endp ;AN000; 1112 <1> ;PAGE ;AN000; 1113 <1> ;*********************************************************************** 1114 <1> ; D_P_Do_CAPS_Char; 1115 <1> ; 1116 <1> ; Function: Perform capitalization along with the file case map table 1117 <1> ; or character case map table. 1118 <1> ; 1119 <1> ; Input: DL = 2 : Use character table 1120 <1> ; DL = 4 : Use file table 1121 <1> ; AL = character to be capitalized 1122 <1> ; 1123 <1> ; Output: None 1124 <1> ; 1125 <1> ; Use: INT 21h /w AH=65h 1126 <1> ;*********************************************************************** 1127 <1> D_P_Do_CAPS_Char proc ;AN000; 0 000012E8 3C80 cmp al,D_P_ASCII80 ;AN000; need upper case table ? 0 000012EA 730C jae D_P_DCC_Go ;AN000; 1130 <1> 0 000012EC 3C61 cmp al,"a" ;AN000; if no, 0 000012EE 723C jb D_P_CAPS_Ret ;AN000; check if "a" <= AL <= "z" 1133 <1> 0 000012F0 3C7A cmp al,"z" ;AN000; 0 000012F2 7738 ja D_P_CAPS_Ret ;AN000; if yes, make CAPS 1136 <1> 0 000012F4 24DF and al,D_P_Make_Upper ;AN000; else do nothing. 0 000012F6 EB34 jmp short D_P_CAPS_Ret ;AN000; 1139 <1> 1140 <1> D_P_DCC_Go: ;AN000; 0 000012F8 53 push bx ;AN000; 0 000012F9 06 push es ;AN000; 0 000012FA 57 push di ;AN000; 1144 <1> %IF CAPSW ;AN000;(Check if uppercase conversion is supported) 1145 <1> lea di,[D_P_File_CAP_Ptr] ;AC034; 1146 <1> cmp dl,D_P_DOSTBL_File ;AN000; Use file CAPS table ? 1147 <1> je D_P_DCC00 ;AN000; 1148 <1> 1149 <1> %ENDIF ;AN000;(of CAPSW) 0 000012FB 8D3E[1C04] lea di,[D_P_Char_CAP_Ptr] ;AC034; or use char CAPS table ? 1151 <1> D_P_DCC00: ;AN000; 0 000012FF 2E3815 cmp [psdata_seg:di],dl ;AN000; already got table address ? 0 00001302 7417 je D_P_DCC01 ;AN000; if no, 1154 <1> 1155 <1> ;In this next section, ES will be used to pass a 5 byte workarea to INT 21h, 1156 <1> ; the GET COUNTYRY INFO call. This usage of ES is required by the function 1157 <1> ; call, regardless of what base register is currently be defined as PSDATA_SEG. 1158 <1> ;BASESW EQU 0 means that ES is the psdata_seg reg. 1159 <1> 1160 <1> %IFDEF BASESW ;AN037; If BASESW has been defined, and 1161 <1> %IFN BASESW ;AN037; If ES is psdata base 1162 <1> push PSDATA_SEG ;AN037; save current base reg 1163 <1> %ENDIF ;AN037; 1164 <1> %ENDIF ;AN037; 1165 <1> 0 00001304 50 push ax ;AN000; get CAPS table thru DOS call 0 00001305 51 push cx ;AN000; 0 00001306 52 push dx ;AN000; 1169 <1> 1170 <1> 0 00001307 0E push PSDATA_SEG ;AC036; pass current base seg into 1172 <1> ;(Note: this used to push CS. BUG... 0 00001308 07 pop es ;AN000; ES reg, required for 1174 <1> ;get extended country information 0 00001309 B465 mov ah,D_P_DOS_Get_TBL ;AN000; get extended CDI 0 0000130B 88D0 mov al,dl ;AN000; upper case table 0 0000130D BBFFFF mov bx,D_P_DOSTBL_Def ;AN000; get active CON 0 00001310 B90500 mov cx,D_P_DOSTBL_BL ;AN000; buffer length 0 00001313 BAFFFF mov dx,D_P_DOSTBL_Def ;AN000; get for default code page 1180 <1> ;DI already set to point to buffer 0 00001316 CD21 int 21h ;AN000; es:di point to buffer that 1182 <1> ;now has been filled in with info 0 00001318 5A pop dx ;AN000; 0 00001319 59 pop cx ;AN000; 0 0000131A 58 pop ax ;AN000; 1186 <1> %IFDEF BASESW ;AN037; If BASESW has been defined, and 1187 <1> %IFN BASESW ;AN037; If ES is psdata base 1188 <1> pop PSDATA_SEG ;AN037; restore current base reg 1189 <1> %ENDIF ;AN037; 1190 <1> %ENDIF ;AN037; 1191 <1> D_P_DCC01: ;AN000; 1192 <1> 1193 <1> ;In this next section, ES will be used as the base of the XLAT table, provided 1194 <1> ; by the previous GET COUNTRY INFO DOS call. This usage of ES is made 1195 <1> ; regardless of which base reg is currently the PSDATA_SEG reg. 1196 <1> 1197 <1> %IFDEF BASESW ;AN037; If BASESW has been defined, and 1198 <1> %IFN BASESW ;AN037; If ES is psdata base 1199 <1> push PSDATA_SEG ;AN037; save current base reg 1200 <1> %ENDIF ;AN037; 1201 <1> %ENDIF ;AN037; 0 0000131B 2E8B5D01 mov bx,[psdata_seg:di+D_P_DOS_TBL_Off] ;AN000; get offset of table 0 0000131F 2E8E4503 mov es,[psdata_seg:di+D_P_DOS_TBL_Seg] ;AN000; get segment of table 0 00001323 43 inc bx ;AC035; add '2' to 0 00001324 43 inc bx ;AC035; BX reg 1206 <1> ;AN000; skip length field 1207 <1> ;(changed ;AN035;) add bx,word ;AN000; skip length field 0 00001325 2C80 sub al,D_P_ASCII80 ;AN000; make char to index 0 00001327 26D7 es xlatb ;AN000; perform case map 1210 <1> 1211 <1> %IFDEF BASESW ;AN037; If BASESW has been defined, and 1212 <1> %IFN BASESW ;AN037; If ES is psdata base 1213 <1> pop PSDATA_SEG ;AN037; restore current base reg 1214 <1> %ENDIF ;AN037; 1215 <1> %ENDIF ;AN037; 0 00001329 5F pop di ;AN000; 0 0000132A 07 pop es ;AN000; 0 0000132B 5B pop bx ;AN000; 1219 <1> D_P_CAPS_Ret: ;AN000; 0 0000132C C3 ret ;AN000; 1221 <1> D_P_Do_CAPS_Char endp ;AN000; 1222 <1> ;PAGE ;AN000; 1223 <1> ;*********************************************************************** 1224 <1> %IF NumSW ;AN000;(Check if numeric value is supported) 1225 <1> ; D_P_Value / D_P_SValue 1226 <1> ; 1227 <1> ; Function: Make 32bit value from psdata_seg:SI and see value list 1228 <1> ; and make result buffer. 1229 <1> ; D_P_SValue is an entry point for the signed value 1230 <1> ; and this will simply call D_P_Value after the handling 1231 <1> ; of the sign character, "+" or "-" 1232 <1> ; 1233 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 1234 <1> ; ES:BX -> CONTROL block 1235 <1> ; 1236 <1> ; Output: None 1237 <1> ; 1238 <1> ; Use: D_P_Fill_Result, D_P_Check_OVF 1239 <1> ; 1240 <1> ; Vars: D_P_RC(W), D_P_Flags(RW) 1241 <1> ;*********************************************************************** 1242 <1> D_P_SValue proc ;AN000; when signed value here 0 0000132D 50 push ax ;AN000; 0 0000132E 2E800E[9303]80 or byte [psdata_seg:D_P_Flags2],D_P_Signed ;AC034; indicate a signed numeric 0 00001334 2E8026[9303]FD and byte [psdata_seg:D_P_Flags2],0ffh-D_P_Neg ;AC034; assume positive value 0 0000133A 2E8A04 mov al,[psdata_seg:si] ;AN000; get sign 0 0000133D 3C2B cmp al,D_P_Plus ;AN000; "+" ? 0 0000133F 740A je D_P_SVal00 ;AN000; 1249 <1> 0 00001341 3C2D cmp al,D_P_Minus ;AN000; "-" ? 0 00001343 7507 jne D_P_Sval01 ;AN000; else 1252 <1> 0 00001345 2E800E[9303]02 or byte [psdata_seg:D_P_Flags2],D_P_Neg ;AC034; set this is negative value 1254 <1> D_P_SVal00: ;AN000; 0 0000134B 46 inc si ;AN000; skip sign char 1256 <1> D_P_Sval01: ;AN000; 0 0000134C E80200 call D_P_Value ;AN000; and process value 0 0000134F 58 pop ax ;AN000; 0 00001350 C3 ret ;AN000; 1260 <1> D_P_SValue endp ;AN000; 1261 <1> ;*********************************************************************** 1262 <1> D_P_Value proc ;AN000; 0 00001351 50 push ax ;AN000; 0 00001352 51 push cx ;AN000; 0 00001353 52 push dx ;AN000; 0 00001354 56 push si ;AN000; 0 00001355 31C9 xor cx,cx ;AN000; cx = higher 16 bits 0 00001357 31D2 xor dx,dx ;AN000; dx = lower 16 bits 0 00001359 53 push bx ;AN000; save control pointer 1270 <1> D_P_Value_Loop: ;AN000; 0 0000135A 2E8A04 mov al,[psdata_seg:si] ;AN000; get character 0 0000135D 08C0 or al,al ;AN000; end of line ? 0 0000135F 7442 je D_P_Value00 ;AN000; 1274 <1> 0 00001361 E8F100 call D_P_0099 ;AN000; make asc(0..9) to bin(0..9) 0 00001364 7239 jc D_P_Value_Err0 ;AN000; 1277 <1> 0 00001366 30E4 xor ah,ah ;AN000; 0 00001368 89C5 mov bp,ax ;AN000; save binary number 0 0000136A D1E2 shl dx,1 ;AN000; to have 2*x 0 0000136C D1D1 rcl cx,1 ;AN000; shift left w/ carry 0 0000136E E8D200 call D_P_Check_OVF ;AN000; Overflow occurred ? 0 00001371 722C jc D_P_Value_Err0 ;AN000; then error, exit 1284 <1> 0 00001373 89D3 mov bx,dx ;AN000; save low(2*x) 0 00001375 89C8 mov ax,cx ;AN000; save high(2*x) 0 00001377 D1E2 shl dx,1 ;AN000; to have 4*x 0 00001379 D1D1 rcl cx,1 ;AN000; shift left w/ carry 0 0000137B E8C500 call D_P_Check_OVF ;AN000; Overflow occurred ? 0 0000137E 721F jc D_P_Value_Err0 ;AN000; then error, exit 1291 <1> 0 00001380 D1E2 shl dx,1 ;AN000; to have 8*x 0 00001382 D1D1 rcl cx,1 ;AN000; shift left w/ carry 0 00001384 E8BC00 call D_P_Check_OVF ;AN000; Overflow occurred ? 0 00001387 7216 jc D_P_Value_Err0 ;AN000; then error, exit 1296 <1> 0 00001389 01DA add dx,bx ;AN000; now have 10*x 0 0000138B 11C1 adc cx,ax ;AN000; 32bit ADD 0 0000138D E8B300 call D_P_Check_OVF ;AN000; Overflow occurred ? 0 00001390 720D jc D_P_Value_Err0 ;AN000; then error, exit 1301 <1> 0 00001392 01EA add dx,bp ;AN000; Add the current one degree decimal 0 00001394 83D100 adc cx,0 ;AN000; if carry, add 1 to high 16bit 0 00001397 E8A900 call D_P_Check_OVF ;AN000; Overflow occurred ? 0 0000139A 7203 jc D_P_Value_Err0 ;AN000; then error, exit 1306 <1> 0 0000139C 46 inc si ;AN000; update pointer 0 0000139D EBBB jmp short D_P_Value_Loop ;AN000; loop until NULL encountered 1309 <1> ; 1310 <1> D_P_Value_Err0: ;AN000; 0 0000139F 5B pop bx ;AN000; 0 000013A0 E98D00 jmp D_P_Value_Err ;AN000; Bridge 1313 <1> ; 1314 <1> D_P_Value00: ;AN000; 0 000013A3 5B pop bx ;AN000; restore control pointer 0 000013A4 2EF606[9303]02 test byte [psdata_seg:D_P_Flags2],D_P_Neg ;AC034; here cx,dx = 32bit value 0 000013AA 740A je D_P_Value01 ;AN000; was it negative ? 1318 <1> 0 000013AC F7D1 not cx ;AN000; + 0 000013AE F7D2 not dx ;AN000; |- Make 2's complement 0 000013B0 83C201 add dx,1 ;AN000; | 0 000013B3 83D100 adc cx,0 ;AN000; + 1323 <1> D_P_Value01: ;AN000; / nval =0 0 000013B6 268B7706 mov si,[es:bx + D_P_Value_List] ;AN000; si points to value list 0 000013BA 268A04 mov al,[es:si] ;AN000; get nval 0 000013BD 3C00 cmp al,D_P_nval_None ;AN000; no value list ? 0 000013BF 7507 jne D_P_Value02 ;AN000; 1328 <1> 0 000013C1 B001 mov al,D_P_Number ;AN000; Set type 0 000013C3 B4FF mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 0 000013C5 EB74 jmp D_P_Value_Exit ;AN000; 0 000013C7 90 nop ; identicalise 1333 <1> 1334 <1> D_P_Value02: ;AN000; / nval = 1 1335 <1> %IF Val1SW ;AN000;(Check if value list id #1 is supported) 1336 <1> ;(tm07) cmp al,D_P_nval_Range ;AN000; have range list ? 1337 <1> ;(tm07) jne D_P_Value03 ;AN000; 1338 <1> 0 000013C8 46 inc si ;AN000; 0 000013C9 268A04 mov al,[es:si] ;AN000; al = number of range 0 000013CC 3C00 cmp al,D_P_No_nrng ;AN000; (tm07) 0 000013CE 7460 je D_P_Value03 ;AN000; (tm07) 1343 <1> 0 000013D0 46 inc si ;AN000; si points to 1st item_tag 1345 <1> D_P_Val02_Loop: ;AN000; 0 000013D1 2EF606[9303]80 test byte [psdata_seg:D_P_Flags2],D_P_Signed ;AC034; 0 000013D7 751E jne D_P_Val02_Sign ;AN000; 1348 <1> 0 000013D9 263B4C03 cmp cx,[es:si+D_P_Val_XH] ;AN000; comp cx with XH 0 000013DD 7236 jb D_P_Val02_Next ;AN000; 1351 <1> 0 000013DF 7706 ja D_P_Val_In ;AN000; 1353 <1> 0 000013E1 263B5401 cmp dx,[es:si+D_P_Val_XL] ;AN000; comp dx with XL 0 000013E5 722E jb D_P_Val02_Next ;AN000; 1356 <1> 1357 <1> D_P_Val_In: ;AN000; 1358 <1> ;;;;;; cmp cx,es:D_P_Val_YH] ; comp cx with YH (tm01) 0 000013E7 263B4C07 cmp cx,[es:si+D_P_Val_YH] ;AN000; comp cx with YH (tm01) 0 000013EB 7728 ja D_P_Val02_Next ;AN000; 1361 <1> 0 000013ED 723A jb D_P_Val_Found ;AN000; 1363 <1> 0 000013EF 263B5405 cmp dx,[es:si+D_P_Val_YL] ;AN000; comp dx with YL 0 000013F3 7720 ja D_P_Val02_Next ;AN000; 1366 <1> 0 000013F5 EB32 jmp short D_P_Val_Found ;AN000; 1368 <1> 1369 <1> D_P_Val02_Sign: ;AN000; 0 000013F7 263B4C03 cmp cx,[es:si+D_P_Val_XH] ;AN000; comp cx with XH 0 000013FB 7C18 jl D_P_Val02_Next ;AN000; 1372 <1> 0 000013FD 7F06 jg D_P_SVal_In ;AN000; 1374 <1> 0 000013FF 263B5401 cmp dx,[es:si+D_P_Val_XL] ;AN000; comp dx with XL 0 00001403 7C10 jl D_P_Val02_Next ;AN000; 1377 <1> 1378 <1> D_P_SVal_In: ;AN000; 0 00001405 263B4C07 cmp cx,[es:si+D_P_Val_YH] ;AN000; comp cx with YH 0 00001409 7F0A jg D_P_Val02_Next ;AN000; 1381 <1> 0 0000140B 7C1C jl D_P_Val_Found ;AN000; 1383 <1> 0 0000140D 263B5405 cmp dx,[es:si+D_P_Val_YL] ;AN000; comp dx with YL 0 00001411 7F02 jg D_P_Val02_Next ;AN000; 1386 <1> 0 00001413 EB14 jmp short D_P_Val_Found ;AN000; 1388 <1> 1389 <1> D_P_Val02_Next: ;AN000; 0 00001415 83C609 add si,D_P_Len_Range ;AN000; 0 00001418 FEC8 dec al ;AN000; loop nrng times in AL 0 0000141A 75B5 jne D_P_Val02_Loop ;AN000; 1393 <1> ; / Not found 1394 <1> D_P_Out_of_Range equ D_P_Out_Of_Range ; NASM port equate 0 0000141C 2EC706[8703]0600 mov word [psdata_seg:D_P_RC],D_P_Out_of_Range ;AC034; 0 00001423 B001 mov al,D_P_Number ;AN000; 0 00001425 B4FF mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 0 00001427 EB12 jmp short D_P_Value_Exit ;AN000; 1399 <1> 1400 <1> %ENDIF ;AN000;(of Val1SW) 1401 <1> %IF Val1SW+Val2SW ;AN000;(Check if value list id #1 or #2 is supported) 1402 <1> D_P_Val_Found: ;AN000; 0 00001429 B001 mov al,D_P_Number ;AN000; 0 0000142B 268A24 mov ah,[es:si] ;AN000; found ITEM_TAG set 0 0000142E EB0B jmp short D_P_Value_Exit ;AN000; 1406 <1> 1407 <1> %ENDIF ;AN000;(of Val1SW+Val2SW) 1408 <1> D_P_Value03: ;AN000; / nval = 2 1409 <1> %IF Val2SW ;AN000;(Check if value list id #2 is supported) 1410 <1> ;;;; cmp al,D_P_nval_Value ; have match list ? ASSUME nval=2, 1411 <1> ;;;; jne D_P_Value04 ; even if it is 3 or more. 1412 <1> ;(tm07) inc si ;AN000; 1413 <1> ;(tm07) mov al,[es:si] ;AN000; al = nrng 1414 <1> mov ah,D_P_Len_Range ;AN000; 1415 <1> mul ah ;AN000; Skip nrng field 1416 <1> inc ax ;AN000; 1417 <1> add si,ax ;AN000; si points to nnval 1418 <1> mov al,[es:si] ;AN000; get nnval 1419 <1> inc si ;AN000; si points to 1st item_tag 1420 <1> D_P_Val03_Loop: ;AN000; 1421 <1> cmp cx,[es:si+D_P_Val_XH] ;AN000; comp cx with XH 1422 <1> jne D_P_Val03_Next ;AN000; 1423 <1> 1424 <1> cmp dx,[es:si+D_P_Val_XL] ;AN000; comp dx with XL 1425 <1> je D_P_Val_Found ;AN000; 1426 <1> 1427 <1> D_P_Val03_Next: ;AN000; 1428 <1> add si,D_P_Len_Value ;AN000; points to next value choice 1429 <1> dec al ;AN000; loop nval times in AL 1430 <1> jne D_P_Val03_Loop ;AN000; 1431 <1> ;AN000; / Not found 1432 <1> D_P_Not_in_Val equ D_P_Not_In_Val ; NASM port equate 1433 <1> mov word [psdata_seg:D_P_RC],D_P_Not_in_Val ;AC034; 1434 <1> mov al,D_P_Number ;AN000; 1435 <1> mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 1436 <1> jmp short D_P_Value_Exit ;AN000; 1437 <1> 1438 <1> %ENDIF ;AN000;(of Val2SW) 1439 <1> D_P_Value04: ;AN000; / nval = 3 or else 1440 <1> D_P_Value_Err: ;AN000; 0 00001430 2EC706[8703]0900 mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; 0 00001437 B003 mov al,D_P_String ;AN000; Set type 0 00001439 B4FF mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 1444 <1> D_P_Value_Exit: ;AN000; 0 0000143B E82EFD call D_P_Fill_Result ;AN000; 0 0000143E 5E pop si ;AN000; 0 0000143F 5A pop dx ;AN000; 0 00001440 59 pop cx ;AN000; 0 00001441 58 pop ax ;AN000; 0 00001442 C3 ret ;AN000; 1451 <1> D_P_Value endp ;AN000; 1452 <1> ;PAGE ;AN000; 1453 <1> ;*********************************************************************** 1454 <1> ; D_P_Check_OVF 1455 <1> ; 1456 <1> ; Function: Check if overflow is occurred with consideration of 1457 <1> ; signed or un-signed numeric value 1458 <1> ; 1459 <1> ; Input: Flag register 1460 <1> ; 1461 <1> ; Output: CY = 1 : Overflow 1462 <1> ; 1463 <1> ; Vars: D_P_Flags(R) 1464 <1> ;*********************************************************************** 1465 <1> D_P_Check_OVF proc ;AN000; 0 00001443 9C pushf ;AN000; 0 00001444 2EF606[9303]02 test byte [psdata_seg:D_P_Flags2],D_P_Neg ;AC034; is it negative value ? 0 0000144A 7502 jne D_P_COVF ;AN000; if no, check overflow 1469 <1> 0 0000144C 9D popf ;AN000; by the CY bit 0 0000144D C3 ret ;AN000; 1472 <1> 1473 <1> D_P_COVF: ;AN000; 0 0000144E 9D popf ;AN000; else, 0 0000144F 7002 jo D_P_COVF00 ;AN000; check overflow by the OF 1476 <1> 0 00001451 F8 clc ;AN000; indicate it with CY bit 0 00001452 C3 ret ;AN000; CY=0 means no overflow 1479 <1> 1480 <1> D_P_COVF00: ;AN000; 0 00001453 F9 stc ;AN000; and CY=1 means overflow 0 00001454 C3 ret ;AN000; 1483 <1> D_P_Check_OVF endp ;AN000; 1484 <1> %ENDIF ;AN000;(of FarSW) 1485 <1> ;*********************************************************************** 1486 <1> ; D_P_0099; 1487 <1> ; 1488 <1> ; Function: Make ASCII 0-9 to Binary 0-9 1489 <1> ; 1490 <1> ; Input: AL = character code 1491 <1> ; 1492 <1> ; Output: CY = 1 : AL is not number 1493 <1> ; CY = 0 : AL contains binary value 1494 <1> ;*********************************************************************** 1495 <1> D_P_0099 proc ;AN000; 0 00001455 3C30 cmp al,"0" ;AN000; 0 00001457 7208 jb D_P_0099Err ;AN000; must be 0 =< al =< 9 1498 <1> 0 00001459 3C39 cmp al,"9" ;AN000; 0 0000145B 7704 ja D_P_0099Err ;AN000; must be 0 =< al =< 9 1501 <1> 0 0000145D 2C30 sub al,"0" ;AN000; make char -> bin 0 0000145F F8 clc ;AN000; indicate no error 0 00001460 C3 ret ;AN000; 1505 <1> 1506 <1> D_P_0099Err: ;AN000; 0 00001461 F9 stc ;AN000; indicate error 0 00001462 C3 ret ;AN000; 1509 <1> D_P_0099 endp ;AN000; 1510 <1> ;PAGE ;AN000; 1511 <1> ;*********************************************************************** 1512 <1> ; D_P_Simple_String 1513 <1> ; 1514 <1> ; Function: See value list for the simple string 1515 <1> ; and make result buffer. 1516 <1> ; 1517 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 1518 <1> ; ES:BX -> CONTROL block 1519 <1> ; 1520 <1> ; Output: None 1521 <1> ; 1522 <1> ; Use: D_P_Fill_Result, D_P_String_Comp 1523 <1> ; 1524 <1> ; Vars: D_P_RC(W) 1525 <1> ;*********************************************************************** 1526 <1> D_P_Simple_String proc ;AN000; 0 00001463 50 push ax ;AN000; 0 00001464 53 push bx ;AN000; 0 00001465 52 push dx ;AN000; 0 00001466 57 push di ;AN000; 0 00001467 268B7F06 mov di,[es:bx + D_P_Value_List] ;AN000; di points to value list 0 0000146B 268A05 mov al,[es:di] ;AN000; get nval 0 0000146E 08C0 or al,al ;AN000; no value list ? 0 00001470 7504 jne D_P_Sim00 ;AN000; then 1535 <1> 0 00001472 B4FF mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 0 00001474 EB4C jmp short D_P_Sim_Exit ;AN000; and set result buffer 1538 <1> 1539 <1> D_P_Sim00: ;AN000; 1540 <1> %IF Val3SW+KeySW ;AN000;(Check if keyword or value list id #3 is supported) 0 00001476 3C03 cmp al,D_P_nval_String ;AN000; String choice list provided ? 0 00001478 753F jne D_P_Sim01 ;AN000; if no, syntax error 1543 <1> 0 0000147A 47 inc di ;AN000; 0 0000147B 268A05 mov al,[es:di] ;AN000; al = nrng 0 0000147E B409 mov ah,D_P_Len_Range ;AN000; 0 00001480 F6E4 mul ah ;AN000; Skip nrng field 0 00001482 40 inc ax ;AN000; ax = (nrng*9)+1 0 00001483 01C7 add di,ax ;AN000; di points to nnval 0 00001485 268A05 mov al,[es:di] ;AN000; get nnval 0 00001488 B405 mov ah,D_P_Len_Value ;AN000; 0 0000148A F6E4 mul ah ;AN000; Skip nnval field 0 0000148C 40 inc ax ;AN000; ax = (nnval*5)+1 0 0000148D 01C7 add di,ax ;AN000; di points to nstrval 0 0000148F 268A05 mov al,[es:di] ;AN000; get nstrval 0 00001492 47 inc di ;AC035; add '2' to 0 00001493 47 inc di ;AC035; DI reg 1558 <1> ;AN000; di points to 1st string in list 1559 <1> ;(replaced ;AC035;) add di,2 ;AN000; di points to 1st string in list 1560 <1> D_P_Sim_Loop: ;AN000; 0 00001494 268B2D mov bp,[es:di] ;AN000; get string pointer 0 00001497 E83200 call D_P_String_Comp ;AN000; compare it with operand 0 0000149A 7312 jnc D_P_Sim_Found ;AN000; found on list ? 1564 <1> 0 0000149C 83C703 add di,D_P_Len_String ;AN000; if no, point to next choice 0 0000149F FEC8 dec al ;AN000; loop nstval times in AL 0 000014A1 75F1 jne D_P_Sim_Loop ;AN000; 1568 <1> ;AN000; / Not found 0 000014A3 2EC706[8703]0800 mov word [psdata_seg:D_P_RC],D_P_Not_In_Str ;AC034; 0 000014AA B4FF mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 0 000014AC EB14 jmp short D_P_Sim_Exit ;AN000; 1572 <1> 1573 <1> D_P_Sim_Found: ;AN000; 0 000014AE 268A65FF mov ah,[es:di-1] ;AN000; set item_tag 0 000014B2 B002 mov al,D_P_List_Idx ;AN000; 0 000014B4 268B15 mov dx,[es:di] ;AN000; get address of STRING 0 000014B7 EB0B jmp short D_P_Sim_Exit0 ;AN000; 1578 <1> %ENDIF ;AN000;(of Val3SW+KeySW) 1579 <1> D_P_Sim01: ;AN000; 0 000014B9 2EC706[8703]0900 mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; 0 000014C0 B4FF mov ah,D_P_No_Tag ;AN000; No ITEM_TAG set 1582 <1> D_P_Sim_Exit: ;AN000; 0 000014C2 B003 mov al,D_P_String ;AN000; Set type 1584 <1> D_P_Sim_Exit0: ;AN000; 0 000014C4 E8A5FC call D_P_Fill_Result ;AN000; 0 000014C7 5F pop di ;AN000; 0 000014C8 5A pop dx ;AN000; 0 000014C9 5B pop bx ;AN000; 0 000014CA 58 pop ax ;AN000; 0 000014CB C3 ret ;AN000; 1591 <1> D_P_Simple_String endp ;AN000; 1592 <1> ;PAGE ;AN000; 1593 <1> ;*********************************************************************** 1594 <1> ; D_P_String_Comp: 1595 <1> ; 1596 <1> ; Function: Compare two string 1597 <1> ; 1598 <1> ; Input: psdata_seg:SI -> 1st string 1599 <1> ; ES:BP -> 2nd string (Must be upper case) 1600 <1> ; ES:BX -> CONTROL block 1601 <1> ; 1602 <1> ; Output: CY = 1 if not match 1603 <1> ; 1604 <1> ; Use: D_P_Chk_DBCS, D_P_Do_CAPS_Char 1605 <1> ; 1606 <1> ; Vars: D_P_KEYor_SW_Ptr(W), D_P_Flags(R). D_P_KEYorSW_Ptr 1607 <1> ;*********************************************************************** 1608 <1> D_P_String_Comp proc ;AN000; 0 000014CC 50 push ax ;AN000; 0 000014CD 55 push bp ;AN000; 0 000014CE 52 push dx ;AN000; 0 000014CF 56 push si ;AN000; 0 000014D0 B202 mov dl,D_P_DOSTBL_Char ;AN000; use character case map table 1614 <1> D_P_SCOM_Loop: ;AN000; 0 000014D2 2E8A04 mov al,[psdata_seg:si] ;AN000; get command character 0 000014D5 E83C02 call D_P_Chk_DBCS ;AN000; DBCS ? 0 000014D8 723C jc D_P_SCOM00 ;AN000; yes,DBCS 1618 <1> 0 000014DA E80BFE call D_P_Do_CAPS_Char ;AN000; else, upper case map before comparison 1620 <1> %IF KeySW+SwSW ;AN000;(Check if keyword or switch is supported) 0 000014DD 2EF606[9303]08 test byte [psdata_seg:D_P_Flags2],D_P_Key_Cmp ;AC034; keyword search ? 0 000014E3 740D je D_P_SCOM04 ;AN000; 1623 <1> 0 000014E5 3C3D cmp al,D_P_Keyword ;AN000; "=" is delimiter 0 000014E7 751F jne D_P_SCOM03 ;AN000;IF "=" on command line AND (bp+1=> char after the "=" in synonym list) 1626 <1> 0 000014E9 26807E0100 cmp byte ptr [es:bp+1],D_P_NULL ;AN021; at end of keyword string in the control block THEN 1628 <1> D_P_SCOM_DIFFER equ D_P_SCOM_Differ ; NASM port label 0 000014EE 7571 jne D_P_SCOM_DIFFER ;AN021; 1630 <1> 0 000014F0 EB13 jmp short D_P_SCOM05 ;AN000; keyword found in synonym list 1632 <1> 1633 <1> D_P_SCOM04: ;AN000; 0 000014F2 2EF606[9303]10 test byte [psdata_seg:D_P_Flags2],D_P_SW_Cmp ;AC034; switch search ? 0 000014F8 740E je D_P_SCOM03 ;AN000; 1636 <1> 0 000014FA 3C3A cmp al,D_P_Colon ;AN000; ":" is delimiter, at end of switch on command line 0 000014FC 750A jne D_P_SCOM03 ;AN000; continue compares 1639 <1> 0 000014FE 26807E0000 cmp byte ptr [es:bp],D_P_NULL ;AN021; IF at end of switch on command AND 0 00001503 755C jne D_P_SCOM_DIFFER ;AN021; at end of switch string in the control block THEN 1642 <1> 1643 <1> D_P_SCOM05: ;AN000; found a match 0 00001505 46 inc si ;AN000; si points to just after "=" or ":" 0 00001506 EB5C jmp short D_P_SCOM_Same ;AN000; exit 1646 <1> 1647 <1> D_P_SCOM03: ;AN000; 1648 <1> %ENDIF ;AN000;(of KeySW+SwSW) 0 00001508 263A4600 cmp al,[es:bp] ;AN000; compare operand w/ a synonym 0 0000150C 751D jne D_P_SCOM_Differ0 ;AN000; if different, check ignore colon option 1651 <1> 0 0000150E 08C0 or al,al ;AN000; end of line 0 00001510 7452 je D_P_SCOM_Same ;AN000; if so, exit 1654 <1> 0 00001512 46 inc si ;AN000; update operand pointer 0 00001513 45 inc bp ;AN000; and synonym pointer 0 00001514 EB13 jmp short D_P_SCOM01 ;AN000; loop until NULL or "=" or ":" found in case 1658 <1> 1659 <1> D_P_SCOM00: ;AN000; Here al is DBCS leading byte 0 00001516 263A4600 cmp al,[es:bp] ;AN000; compare leading byte 0 0000151A 7545 jne D_P_SCOM_Differ ;AN000; if not match, say different 1662 <1> 0 0000151C 46 inc si ;AN000; else, load next byte 0 0000151D 2E8A04 mov al,[psdata_seg:si] ;AN000; and 0 00001520 45 inc bp ;AN000; 0 00001521 263A4600 cmp al,[es:bp] ;AN000; compare 2nd byte 0 00001525 753A jne D_P_SCOM_Differ ;AN000; if not match, say different, too 1668 <1> 0 00001527 46 inc si ;AN000; else update operand pointer 0 00001528 45 inc bp ;AN000; and synonym pointer 1671 <1> D_P_SCOM01: ;AN000; 0 00001529 EBA7 jmp short D_P_SCOM_Loop ;AN000; loop until NULL or "=" or "/" found in case 1673 <1> 1674 <1> D_P_SCOM_Differ0: ;AN000; 1675 <1> 1676 <1> %IF SwSW ;AN000;(tm10) 0 0000152B 2EF606[9303]40 test byte [psdata_seg:D_P_Flags2],D_P_SW ;AC034;(tm10) 0 00001531 740F je D_P_not_applicable ;AN000;(tm10) 1679 <1> 0 00001533 26F747022000 test word [es:bx + D_P_Function_Flag],D_P_colon_is_not_necessary ;AN000;(tm10) 0 00001539 7407 je D_P_not_applicable ;AN000;(tm10) 1682 <1> 0 0000153B 26807E0000 cmp byte ptr [es:bp],D_P_NULL ;AN000;(tm10) 1684 <1> ;(deleted ;AN025;) jne D_P_not_applicable ;AN000;(tm10) 0 00001540 7422 je D_P_SCOM_Same ;AN025;(tm10) 1686 <1> 1687 <1> D_P_not_applicable: ;AN000;(tm10) 1688 <1> %ENDIF ;AN000;(tm10) 1689 <1> 0 00001542 26F7071000 test word [es:bx + D_P_Match_Flag],D_P_Ig_Colon ;AN000; ignore colon option specified ? 0 00001547 7418 je D_P_SCOM_Differ ;AN000; if no, say different. 1692 <1> 0 00001549 3C3A cmp al,D_P_Colon ;AN000; End up with ":" and 0 0000154B 7509 jne D_P_SCOM02 ;AN000; subseqently 1695 <1> 0 0000154D 26807E0000 cmp byte ptr [es:bp],D_P_NULL ;AN000; NULL ? 0 00001552 750D jne D_P_SCOM_Differ ;AN000; if no, say different 1698 <1> 0 00001554 EB0E jmp short D_P_SCOM_Same ;AN000; else, say same 1700 <1> 1701 <1> D_P_SCOM02: ;AN000; 0 00001556 3C00 cmp al,D_P_NULL ;AN000; end up NULL and : 0 00001558 7507 jne D_P_SCOM_Differ ;AN000; 1704 <1> 0 0000155A 26807E003A cmp byte ptr [es:bp],D_P_Colon ;AN000; if no, say different 0 0000155F 7403 je D_P_SCOM_Same ;AN000; else, say same 1707 <1> 1708 <1> D_P_SCOM_Differ: ;AN000; 0 00001561 F9 stc ;AN000; indicate not found 0 00001562 EB06 jmp short D_P_SCOM_Exit ;AN000; 1711 <1> 1712 <1> D_P_SCOM_Same: ;AN000; 0 00001564 2E8936[9603] mov [psdata_seg:D_P_KEYorSW_Ptr],si ;AC034; for later use by keyword or switch 0 00001569 F8 clc ;AN000; indicate found 1715 <1> D_P_SCOM_Exit: ;AN000; 0 0000156A 5E pop si ;AN000; 0 0000156B 5A pop dx ;AN000; 0 0000156C 5D pop bp ;AN000; 0 0000156D 58 pop ax ;AN000; 0 0000156E C3 ret ;AN000; 1721 <1> D_P_String_Comp endp ;AN000; 1722 <1> ;PAGE ;AN000; 1723 <1> ;*********************************************************************** 1724 <1> %IF DateSW ;AN000;(Check if date format is supported) 1725 <1> ; D_P_Date_Format 1726 <1> ; 1727 <1> ; Function: Convert a date string to DOS date format for int 21h 1728 <1> ; with format validation. 1729 <1> ; 1730 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 1731 <1> ; ES:BX -> CONTROL block 1732 <1> ; 1733 <1> ; Output: None 1734 <1> ; 1735 <1> ; Use: D_P_Fill_Result, D_P_Set_CDI, D_P_Get_DecNum 1736 <1> ; 1737 <1> ; Vars: D_P_RC(W), D_P_1st_Val(RW), D_P_2nd_Val(RW), D_P_3rd_Val(RW) 1738 <1> ;*********************************************************************** 1739 <1> D_P_Date_Format proc ;AN000; 1740 <1> push ax ;AN000; 1741 <1> push cx ;AN000; 1742 <1> push dx ;AN000; 1743 <1> push si ;AN000; 1744 <1> push bx ;AN000; 1745 <1> push si ;AN000; 1746 <1> call D_P_Set_CDI ;AN000; set country dependent information before process 1747 <1> ; mov bl,[psdata_seg:si].D_P_CDI_DateS ;load date separator ;AN020; (deleted) 1748 <1> ; note: the country info is still needed 1749 <1> ; to determine the order of the fields, 1750 <1> ; but the separator char is no longer used. 1751 <1> pop si ;AN000; 1752 <1> mov word [psdata_seg:D_P_1st_Val],0 ;AC034; set initial value 1753 <1> mov word [psdata_seg:D_P_2nd_Val],0 ;AC034; set initial value 1754 <1> mov word [psdata_seg:D_P_3rd_Val],0 ;AC034; set initial value 1755 <1> call D_P_Get_DecNum ;AN000; get 1st number 1756 <1> jc D_P_DateF_Err0 ;AN000;-----------------------+ 1757 <1> 1758 <1> mov [psdata_seg:D_P_1st_Val],ax ;AC034; | 1759 <1> or bl,bl ;AN000; end of line ? | 1760 <1> je D_P_DateF_YMD ;AN000; | 1761 <1> 1762 <1> call D_P_Get_DecNum ;AN000; get 2nd number | 1763 <1> jc D_P_DateF_Error ;AN000; | 1764 <1> 1765 <1> mov [psdata_seg:D_P_2nd_Val],ax ;AC034; | 1766 <1> or bl,bl ;AN000; end of line ? | 1767 <1> je D_P_DateF_YMD ;AN000; | 1768 <1> 1769 <1> call D_P_Get_DecNum ;AN000; get 3rd number | 1770 <1> D_P_DateF_Err0: ;AN000; Bridge <-----------+ 1771 <1> jc D_P_DateF_Error ;AN000; 1772 <1> 1773 <1> mov [psdata_seg:D_P_3rd_Val],ax ;AC034; 1774 <1> or bl,bl ;AN000; end of line ? 1775 <1> jne D_P_DateF_Error ;AN000; 1776 <1> 1777 <1> D_P_DateF_YMD: ;AN000; 1778 <1> D_P_Country_Info equ D_P_COUNTRY_INFO ; NASM port label 1779 <1> mov bx,[psdata_seg:D_P_Country_Info + D_P_CDI_DateF] ;AC034; get date format 1780 <1> cmp bx,D_P_Date_YMD ;AN000; 1781 <1> je D_P_DateF00 ;AN000; 1782 <1> 1783 <1> mov ax,[psdata_seg:D_P_1st_Val] ;AC034; 1784 <1> or ah,ah ;AN000; 1785 <1> jne D_P_DateF_Error ;AN000; 1786 <1> 1787 <1> mov cl,al ;AN000; set month 1788 <1> mov ax,[psdata_seg:D_P_2nd_Val] ;AC034; 1789 <1> or ah,ah ;AN000; if overflow, error. 1790 <1> jne D_P_DateF_Error ;AN000; 1791 <1> 1792 <1> mov ch,al ;AN000; set date 1793 <1> mov dx,[psdata_seg:D_P_3rd_Val] ;AC034; set year 1794 <1> cmp bx,D_P_Date_DMY ;AN000; from here format = MDY 1795 <1> jne D_P_DateF01 ;AN000; if it is DMY 1796 <1> 1797 <1> xchg ch,cl ;AN000; then swap M <-> D 1798 <1> D_P_DateF01: ;AN000; 1799 <1> jmp short D_P_DateF02 ;AN000; 1800 <1> 1801 <1> D_P_DateF00: ;AN000; / here format = YMD 1802 <1> mov dx,[psdata_seg:D_P_1st_Val] ;AC034; set year 1803 <1> mov ax,[psdata_seg:D_P_2nd_Val] ;AC034; 1804 <1> or ah,ah ;AN000; if overflow, error 1805 <1> jne D_P_DateF_Error ;AN000; 1806 <1> 1807 <1> mov cl,al ;AN000; set month 1808 <1> mov ax,[psdata_seg:D_P_3rd_Val] ;AC034; 1809 <1> or ah,ah ;AN000; if overflow, error 1810 <1> jne D_P_DateF_Error ;AN000; 1811 <1> 1812 <1> mov ch,al ;AN000; set date 1813 <1> D_P_DateF02: ;AN000; 1814 <1> cmp dx,100 ;AN000; year is less that 100 ? 1815 <1> jae D_P_DateF03 ;AN000; 1816 <1> 1817 <1> add dx,1900 ;AN000; set year 19xx 1818 <1> D_P_DateF03: ;AN000; 1819 <1> pop bx ;AN000; recover CONTROL block 1820 <1> pop si ;AN000; recover string pointer 1821 <1> mov ah,D_P_No_Tag ;AN000; set 1822 <1> mov al,D_P_Date_F ;AN000; result 1823 <1> call D_P_Fill_Result ;AN000; buffer 1824 <1> jmp short D_P_Date_Format_Exit ;AN000; to Date 1825 <1> 1826 <1> D_P_DateF_Error: ;AN000; 1827 <1> pop bx ;AN000; recover CONTROL block 1828 <1> pop si ;AN000; recover string pointer 1829 <1> mov ah,D_P_No_Tag ;AN000; set 1830 <1> mov al,D_P_String ;AN000; result 1831 <1> call D_P_Fill_Result ;AN000; buffer to string 1832 <1> mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; indicate syntax error 1833 <1> D_P_Date_Format_Exit: ;AN000; 1834 <1> pop dx ;AN000; 1835 <1> pop cx ;AN000; 1836 <1> pop ax ;AN000; 1837 <1> ret ;AN000; 1838 <1> D_P_Date_Format endp ;AN000; 1839 <1> %ENDIF ;AN000;(of DateSW) 1840 <1> ;PAGE ;AN000; 1841 <1> ;*********************************************************************** 1842 <1> %IF TimeSW+DateSW ;AN000;(Check if time or date format is supported) 1843 <1> ; D_P_Set_CDI: 1844 <1> ; 1845 <1> ; Function: Read CDI from DOS if it has not been read yet 1846 <1> ; 1847 <1> ; Input: None 1848 <1> ; 1849 <1> ; Output: psdata_seg:SI -> CDI 1850 <1> ; 1851 <1> ; Use: INT 21h w/ AH = 38h 1852 <1> ;*********************************************************************** 1853 <1> D_P_Set_CDI proc ;AN000; 1854 <1> lea si,[D_P_Country_Info] ;AC034; 1855 <1> cmp word [psdata_seg:si + D_P_CDI_DateF],D_P_NeedToBeRead ;AN000; already read ? 1856 <1> je D_P_Read_CDI ;AN000; 1857 <1> 1858 <1> jmp short D_P_Set_CDI_Exit ;AN000; then do nothing 1859 <1> 1860 <1> D_P_Read_CDI: ;AN000; else read CDI thru DOS 1861 <1> push ds ;AN000; 1862 <1> push dx ;AN000; 1863 <1> push ax ;AN000; 1864 <1> push PSDATA_SEG ;AC023; 1865 <1> pop ds ;AN000; set segment register 1866 <1> mov ax,D_P_DOS_Get_CDI ;AN000; get country information 1867 <1> mov dx,si ;AN000; set offset of CDI in local data area 1868 <1> int 21h ;AN000; 1869 <1> pop ax ;AN000; 1870 <1> pop dx ;AN000; 1871 <1> pop ds ;AN000; 1872 <1> D_P_Set_CDI_Exit: ;AN000; 1873 <1> ret ;AN000; 1874 <1> D_P_Set_CDI endp ;AN000; 1875 <1> ;PAGE ;AN000; 1876 <1> ;*********************************************************************** 1877 <1> ; D_P_Get_DecNum: 1878 <1> ; 1879 <1> ; Function: Read a chcrater code from psdata_seg:SI until specified delimiter 1880 <1> ; or NULL encountered. And make a decimal number. 1881 <1> ; 1882 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 1883 <1> ; 1884 <1> ; Output: BL = delimiter code or NULL 1885 <1> ; AX = Decimal number 1886 <1> ; SI advanced to the next number 1887 <1> ; CY = 1 : Syntax error, AL = Latest examineed number 1888 <1> ; 1889 <1> ; Use: D_P_0099 1890 <1> ;*********************************************************************** 1891 <1> D_P_Get_DecNum proc ;AN000; 1892 <1> push cx ;AN000; 1893 <1> push dx ;AN000; 1894 <1> xor cx,cx ;AN000; cx will have final value 1895 <1> D_P_GetNum_Loop: ;AN000; 1896 <1> mov al,[psdata_seg:si] ;AN000; load character 1897 <1> or al,al ;AN000; end of line ? 1898 <1> je D_P_GetNum00 ;AN000; if yes, exit 1899 <1> 1900 <1> cmp byte [psdata_seg:D_P_Got_Time],0 ;AC034; ;is this numeric in a time field? ;AC023 1901 <1> je D_P_Do_Date_Delims ;AN000;no, go check out Date delimiters ;AC023 1902 <1> 1903 <1> ; Determine which delimiter(s) to check for. Colon & period or period only 1904 <1> cmp bl,D_P_colon_period ;AN032; ;Time 1905 <1> jne D_P_Do_Time_Delim1 ;AN032; ;only check for period 1906 <1> 1907 <1> cmp al,D_P_Colon ;AN032; ;Is this a valid delimiter ? 1908 <1> je D_P_GetNum01 ;AN032; ;yes, exit 1909 <1> 1910 <1> D_P_Do_Time_Delim1: ;AN000; 1911 <1> cmp al,D_P_Period ;;AC032;;AC023;Is this a valid delimiter ? 1912 <1> je D_P_GetNum01 ;AC023; yes, exit 1913 <1> 1914 <1> jmp short D_P_Neither_Delims ;AN023; 1915 <1> 1916 <1> D_P_Do_Date_Delims: ;AN000; 1917 <1> ;Regardless of the date delimiter character specified in the country 1918 <1> ;dependent information, check for the presence of any one of these 1919 <1> ;three field delimiters: "-", "/", or ".". 1920 <1> cmp al,D_P_Minus ;AN020;is this a date delimiter character? 1921 <1> je D_P_GetNum01 ;AN020;if yes, exit 1922 <1> 1923 <1> cmp al,D_P_Slash ;AN020;is this a date delimiter character? 1924 <1> je D_P_GetNum01 ;AN020;if yes, exit 1925 <1> 1926 <1> cmp al,D_P_Period ;AN020;is this a date delimiter character? 1927 <1> je D_P_GetNum01 ;AN000; if yes, exit 1928 <1> 1929 <1> D_P_Neither_Delims: ;AN023; 1930 <1> 1931 <1> call D_P_0099 ;AN000; convert it to binary 1932 <1> jc D_P_GetNum_Exit ;AN000; if error exit 1933 <1> 1934 <1> mov ah,0 ;AN000; 1935 <1> xchg ax,cx ;AN000; 1936 <1> mov dx,10 ;AN000; 1937 <1> mul dx ;AN000; ax = ax * 10 1938 <1> or dx,dx ;AN000; overflow 1939 <1> jne D_P_GetNum02 ;AN000; then exit 1940 <1> 1941 <1> add ax,cx ;AN000; 1942 <1> jc D_P_GetNum_Exit ;AN000; 1943 <1> 1944 <1> xchg ax,cx ;AN000; 1945 <1> inc si ;AN000; 1946 <1> jmp short D_P_GetNum_Loop ;AN000; 1947 <1> 1948 <1> D_P_GetNum00: ;AN000; 1949 <1> mov bl,al ;AN000; set bl to NULL 1950 <1> clc ;AN000; indicate no error 1951 <1> jmp short D_P_GetNum_Exit ;AN000; 1952 <1> 1953 <1> D_P_GetNum01: ;AN000; 1954 <1> inc si ;AN000; si points to next number 1955 <1> clc ;AN000; indicate no error 1956 <1> jmp short D_P_GetNum_Exit ;AN000; 1957 <1> 1958 <1> D_P_GetNum02: ;AN000; 1959 <1> stc ;AN000; indicate error 1960 <1> D_P_GetNum_Exit: ;AN000; 1961 <1> mov ax,cx ;AN000;return value 1962 <1> pop dx ;AN000; 1963 <1> pop cx ;AN000; 1964 <1> ret ;AN000; 1965 <1> D_P_Get_DecNum endp ;AN000; 1966 <1> %ENDIF ;AN000;(of TimeSW+DateSW) 1967 <1> ;PAGE ;AN000; 1968 <1> ;*********************************************************************** 1969 <1> %IF TimeSW ;AN000;(Check if time format is supported) 1970 <1> ; D_P_Time_Format 1971 <1> ; 1972 <1> ; Function: Convert a time string to DOS time format for int 21h 1973 <1> ; with format validation. 1974 <1> ; 1975 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 1976 <1> ; ES:BX -> CONTROL block 1977 <1> ; 1978 <1> ; Output: None 1979 <1> ; 1980 <1> ; Use: D_P_Fill_Result, D_P_Set_CDI, D_P_Get_DecNum, D_P_Time_2412 1981 <1> ; 1982 <1> ; Vars: D_P_RC(W), D_P_Flags(R), D_P_1st_Val(RW), D_P_2nd_Val(RW) 1983 <1> ; D_P_3rd_Val(RW), D_P_4th_Val(RW) 1984 <1> ;*********************************************************************** 1985 <1> D_P_Time_Format proc ;AN000; 1986 <1> push ax ;AN000; 1987 <1> push cx ;AN000; 1988 <1> push dx ;AN000; 1989 <1> push si ;AN000; 1990 <1> push bx ;AN000; 1991 <1> push si ;AN000; 1992 <1> call D_P_Set_CDI ;AN000; Set country independent 1993 <1> ; information before process 1994 <1> ;(AN032; deleted) mov bl,[psdata_seg:si].D_P_CDI_TimeS ;load time separator 1995 <1> ;(AN032; deleted) mov bh,[psdata_seg:si].D_P_CDI_Dec ;load decimal separator 1996 <1> test byte ptr [psdata_seg:si + D_P_CDI_TimeF],1 ;AN000; 24 hour system 1997 <1> pop si ;AN000; 1998 <1> jne D_P_TimeF00 ;AN000; if no, means 12 hour system 1999 <1> 2000 <1> call D_P_Time_2412 ;AN000; this routine handle "am" "pm" 2001 <1> D_P_TimeF00: ;AN000; 2002 <1> mov word [psdata_seg:D_P_1st_Val],0 ;AC034; set initial value 2003 <1> mov word [psdata_seg:D_P_2nd_Val],0 ;AC034; set initial value 2004 <1> mov word [psdata_seg:D_P_3rd_Val],0 ;AC034; set initial value 2005 <1> mov word [psdata_seg:D_P_4th_Val],0 ;AC034; set initial value 2006 <1> mov byte [psdata_seg:D_P_Got_Time],1 ;AN023;AC034;; use time delimiter 2007 <1> mov bl,D_P_colon_period ;AN032; flag, indicates use of 2008 <1> ; delimiters between hours, 2009 <1> ; minutes,seconds 2010 <1> call D_P_Get_DecNum ;AN000; get 1st number 2011 <1> jc D_P_TimeF_Err0 ;AN000; 2012 <1> 2013 <1> mov [psdata_seg:D_P_1st_Val],ax ;AC034; 2014 <1> or bl,bl ;AN000; end of line ? 2015 <1> D_P_TimeF_Rlt equ D_P_TimeF_RLT ; NASM port label 2016 <1> je D_P_TimeF_Rlt ;AN000; 2017 <1> 2018 <1> call D_P_Get_DecNum ;AN000; get 2nd number 2019 <1> jc D_P_TimeF_Err0 ;AC038; if OK 2020 <1> 2021 <1> mov [psdata_seg:D_P_2nd_Val],ax ;AC034; 2022 <1> or bl,bl ;AN000; end of line ? 2023 <1> je D_P_TimeF_Rlt ;AN000; 2024 <1> 2025 <1> ;(;AN032; deleted) mov bl,bh ;set decimal separator 2026 <1> mov bl,D_P_period_only ;AN032; flag, which to decimal separator 2027 <1> call D_P_Get_DecNum ;AN000; get 3rd number 2028 <1> jc D_P_TimeF_Err0 ;AC039; if problem, bridge to error 2029 <1> 2030 <1> mov [psdata_seg:D_P_3rd_Val],ax ;AC034; 2031 <1> or bl,bl ;AN000; end of line ? 2032 <1> ;(DELETED ;AN039;) je D_P_TimeF_Rlt ;AN000; 2033 <1> jne D_P_Time_4 ;AN039; NOT END OF LINE, 2034 <1> ;AN039; GO TO 4TH NUMBER 2035 <1> D_P_Time_Again equ D_P_TIME_AGAIN ; NASM port equate 2036 <1> test byte [psdata_seg:D_P_Flags1],D_P_Time_Again ;AN039; HAS TIME PARSE 2037 <1> ;AN039; BEEN REPEATED? 2038 <1> jnz D_P_TimeF_Rlt ;AN039; yes, this is really 2039 <1> ;AN039; the end of line 2040 <1> ;AN039; no, time has not been repeated 2041 <1> mov si,[psdata_seg:D_P_SI_Save] ;AN039; get where parser quit 2042 <1> ;AN039; in command line 2043 <1> cmp byte ptr [si-1],D_P_Comma ;AN039; look at delimiter 2044 <1> ;AN039; from command line 2045 <1> jne D_P_TimeF_Rlt ;AN039; was not a comma, this is 2046 <1> ;AN039; really end of line 2047 <1> ;AN039; is comma before hundredths, 2048 <1> ;AN039; redo TIME 2049 <1> mov byte ptr [si-1],D_P_Period ;AN039; change that ambiguous 2050 <1> ;AN039; comma to a decimal point 2051 <1> ;AN039; parse can understand 2052 <1> mov word [psdata_seg:D_P_Flags],0 ;AN039; Clear all internal flags 2053 <1> or byte [psdata_seg:D_P_Flags1],D_P_Time_Again ;AN039; indicate TIME 2054 <1> ;AN039; is being repeated 2055 <1> mov cx,[psdata_seg:D_P_ORIG_ORD] ;AN039; ORIGINAL ORDINAL FROM CX 2056 <1> mov sp,[psdata_seg:D_P_ORIG_STACK] ;AN039; ORIGINAL VALUE 2057 <1> ;AN039; OF STACK FROM SP 2058 <1> mov si,[psdata_seg:D_P_ORIG_SI] ;AN039; ORIGINAL START 2059 <1> ;AN039; PARSE POINTER FROM SI 2060 <1> D_P_Redo_Time equ D_P_REDO_TIME ; NASM port label 2061 <1> jmp D_P_Redo_Time ;AN039; go try TIME again 2062 <1> ; =============================================================== 2063 <1> D_P_Time_4: ;AN039; READY FOR 4TH (HUNDREDTHS) NUMBER 2064 <1> call D_P_Get_DecNum ;AN000; get 4th number 2065 <1> D_P_TimeF_Err0: ;AN000; Bridge 2066 <1> jc D_P_TimeF_Error ;AN000; 2067 <1> 2068 <1> mov [psdata_seg:D_P_4th_Val],ax ;AC034; 2069 <1> or bl,bl ;AN000; After hundredth, no data allowed 2070 <1> jne D_P_TimeF_Error ;AN000; if some, then error 2071 <1> 2072 <1> D_P_TimeF_RLT: ;AN000; 2073 <1> mov ax,[psdata_seg:D_P_1st_Val] ;AC034; 2074 <1> or ah,ah ;AN000; if overflow then error 2075 <1> jne D_P_TimeF_Err ;AN000; 2076 <1> 2077 <1> D_P_Time12am equ D_P_time12am ; NASM port equate 2078 <1> test byte [psdata_seg:D_P_Flags1],D_P_Time12am ;AN038;if "am" specified 2079 <1> jz D_P_Time_notAM ;AN038;skip if no "AM" specified 2080 <1> ;since "AM" was specified, 2081 <1> cmp al,12 ;AN038: if hour specified as later than noon 2082 <1> ja D_P_TimeF_Err ;AN038; error if "AM" on more than noon 2083 <1> jne D_P_Time_notAM ;AN038; for noon exactly, 2084 <1> 2085 <1> xor al,al ;AN038; set hour = zero 2086 <1> D_P_Time_notAM: ;AN038; 2087 <1> test byte [psdata_seg:D_P_Flags2],D_P_Time12 ;AC034; if 12 hour system and pm is specified 2088 <1> je D_P_TimeSkip00 ;AN000; then 2089 <1> 2090 <1> cmp al,12 ;AN038; if 12:00 o'clock already 2091 <1> je D_P_TimeSkip00 ;AN038; it is PM already 2092 <1> 2093 <1> add al,12 ;AN000; add 12 hours to make it afternoon 2094 <1> jc D_P_TimeF_Err ;AN000; if overflow then error 2095 <1> 2096 <1> cmp al,24 ;AN038; after adding 12, now cannot be >24 2097 <1> ja D_P_TimeF_Err ;AN038; if too big, error 2098 <1> 2099 <1> D_P_TimeSkip00: ;AN000; 2100 <1> mov dl,al ;AN000; set hour 2101 <1> mov ax,[psdata_seg:D_P_2nd_Val] ;AC034; 2102 <1> or ah,ah ;AN000; if overflow then error 2103 <1> jne D_P_TimeF_Err ;AN000; 2104 <1> 2105 <1> mov dh,al ;AN000; set minute 2106 <1> mov ax,[psdata_seg:D_P_3rd_Val] ;AC034; 2107 <1> or ah,ah ;AN000; if overflow then error 2108 <1> jne D_P_TimeF_Err ;AN000; 2109 <1> 2110 <1> mov cl,al ;AN000; set second 2111 <1> mov ax,[psdata_seg:D_P_4th_Val] ;AC034; 2112 <1> or ah,ah ;AN000; if overflow then error 2113 <1> jne D_P_TimeF_Err ;AN000; 2114 <1> 2115 <1> mov ch,al ;AN000; set hundredth 2116 <1> pop bx ;AN000; recover CONTROL block 2117 <1> pop si ;AN000; recover string pointer 2118 <1> mov ah,D_P_No_Tag ;AN000; set 2119 <1> mov al,D_P_Time_F ;AN000; result 2120 <1> call D_P_Fill_Result ;AN000; buffer 2121 <1> jmp short D_P_Time_Format_Exit ;AN000; to time 2122 <1> 2123 <1> D_P_TimeF_Error: ;AN000; 2124 <1> D_P_TimeF_Err: ;AN000; 2125 <1> pop bx ;AN000; recover CONTROL block 2126 <1> pop si ;AN000; recover string pointer 2127 <1> mov ah,D_P_No_Tag ;AN000; set 2128 <1> mov al,D_P_String ;AN000; result 2129 <1> call D_P_Fill_Result ;AN000; buffer to string 2130 <1> mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; return syntax error 2131 <1> D_P_Time_Format_Exit: ;AN000; 2132 <1> mov byte [psdata_seg:D_P_Got_Time],0 ;AN023;AC034;; finished with this time field 2133 <1> pop dx ;AN000; 2134 <1> pop cx ;AN000; 2135 <1> pop ax ;AN000; 2136 <1> ret ;AN000; 2137 <1> D_P_Time_Format endp ;AN000; 2138 <1> ;PAGE ;AN000; 2139 <1> ;*********************************************************************** 2140 <1> ; D_P_Time_2412: 2141 <1> ; 2142 <1> ; Function: Remove "a", "p", "am", or "pm" from the end of stinrg 2143 <1> ; 2144 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2145 <1> ; 2146 <1> ; Output: Set D_P_Time12 flag when the string is terminated by "p" 2147 <1> ; or "pm" 2148 <1> ; 2149 <1> ; Vars: D_P_Flags(W) 2150 <1> ;*********************************************************************** 2151 <1> D_P_Time_2412 proc ;AN000; 2152 <1> push ax ;AN000; 2153 <1> push si ;AN000; 2154 <1> D_P_T12_Loop: ;AN000; 2155 <1> mov al,[psdata_seg:si] ;AN000; Move 2156 <1> inc si ;AN000; si 2157 <1> or al,al ;AN000; to 2158 <1> jne D_P_T12_Loop ;AN000; end of string 2159 <1> 2160 <1> mov al,[psdata_seg:si-2] ;AN000; get char just before NULL 2161 <1> or al,D_P_Make_Lower ;AN000; lower case map 2162 <1> cmp al,"p" ;AN000; only "p" of "pm" ? 2163 <1> je D_P_T1200 ;AN000; 2164 <1> 2165 <1> cmp al,"a" ;AN000; only "a" of "am" ? 2166 <1> je D_P_T1201 ;AN000; 2167 <1> 2168 <1> cmp al,"m" ;AN000; "m" of "am" or "pm" 2169 <1> jne D_P_T12_Exit ;AN000; 2170 <1> 2171 <1> dec si ;AN000; 2172 <1> mov al,[psdata_seg:si-2] ;AN000; 2173 <1> D_P_Make_lower equ D_P_Make_Lower ; NASM port equate 2174 <1> or al,D_P_Make_lower ;AN000; lower case map 2175 <1> cmp al,"p" ;AN000; "p" of "pm" ? 2176 <1> je D_P_T1200 ;AN000; 2177 <1> 2178 <1> cmp al,"a" ;AN000; "a" of "am" ? 2179 <1> je D_P_T1201 ;AN000; go process "a" 2180 <1> 2181 <1> jmp short D_P_T12_Exit ;AN000; no special chars found 2182 <1> 2183 <1> D_P_T1200: ;AN000; "P" found 2184 <1> or byte [psdata_seg:D_P_Flags2],D_P_Time12 ;AC034; flag "PM" found 2185 <1> jmp short D_P_Tclr_chr ;AN038; go clear the special char 2186 <1> 2187 <1> D_P_T1201: ;AN000; "A" found 2188 <1> D_P_Time12AM equ D_P_time12am ; NASM port equate 2189 <1> or byte [psdata_seg:D_P_Flags1],D_P_Time12AM ;AN038; flag "AM" found 2190 <1> D_P_Tclr_chr: ;AN038; 2191 <1> mov byte ptr [psdata_seg:si-2],D_P_NULL ;AN000; null out special char 2192 <1> D_P_T12_Exit: ;AN000; 2193 <1> pop si ;AN000; 2194 <1> pop ax ;AN000; 2195 <1> ret ;AN000; 2196 <1> D_P_Time_2412 endp ;AN000; 2197 <1> %ENDIF ;AN000;(of TimeSW) 2198 <1> ;PAGE ;AN000; 2199 <1> ;*********************************************************************** 2200 <1> %IF CmpxSW ;AN000;(Check if complex item is supported) 2201 <1> ; D_P_Complex_Format: 2202 <1> ; 2203 <1> ; Function: Check if the input string is valid complex format. 2204 <1> ; And set the result buffer. 2205 <1> ; 2206 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2207 <1> ; ES:BX -> CONTROL block 2208 <1> ; 2209 <1> ; Output: None 2210 <1> ; 2211 <1> ; Use: D_P_Fill_Result, D_P_Chk_DBCS, D_P_Chk_EOL, D_P_Skip_Delim 2212 <1> ; D_P_Quoted_str, D_P_Chk_DSQuote 2213 <1> ; 2214 <1> ; Vars: D_P_RC(W), D_P_SI_Save(W), D_P_SaveSI_Cmpx(R), D_P_Save_EOB(R) 2215 <1> ;*********************************************************************** 2216 <1> D_P_Complex_Format proc ;AN000; 2217 <1> push ax ;AN000; 2218 <1> push bx ;AN000; 2219 <1> push si ;AN000; 2220 <1> mov bx,[psdata_seg:D_P_SaveSI_Cmpx] ;AC034; bx points to user buffer 2221 <1> cmp byte ptr [bx],D_P_Lparen ;AN000; 1st char = left parentheses 2222 <1> jne D_P_Cmpx_Err ;AN000; 2223 <1> 2224 <1> xor ah,ah ;AN000; ah = parentheses counter 2225 <1> D_P_Cmpx_Loop: ;AN000; 2226 <1> mov al,[bx] ;AN000; load character from command buffer 2227 <1> call D_P_Chk_EOL ;AN000; if it is one of EOL 2228 <1> je D_P_CmpxErr0 ;AN000; then error exit. 2229 <1> 2230 <1> cmp al,D_P_Lparen ;AN000; left parentheses ? 2231 <1> jne D_P_Cmpx00 ;AN000; then 2232 <1> 2233 <1> inc ah ;AC035; add '1' to AH reg 2234 <1> ;AN000; increment parentheses counter 2235 <1> ;(replaced ;AC035;) add ah,1 ;AN000; increment parentheses counter 2236 <1> jc D_P_CmpxErr0 ;AN000; if overflow, error 2237 <1> D_P_Cmpx00: ;AN000; 2238 <1> cmp al,D_P_Rparen ;AN000; right parentheses ? 2239 <1> jne D_P_Cmpx01 ;AN000; then 2240 <1> 2241 <1> dec ah ;AC035; subtract '1' from AH reg 2242 <1> ;AN000; decrement parentheses counter 2243 <1> ;(changed ;AC035;) sub ah,1 ;AN000; decrement parentheses counter 2244 <1> jc D_P_CmpxErr0 ;AN000; if overflow error 2245 <1> 2246 <1> je D_P_Cmpx03 ;AN000; ok, valid complex 2247 <1> 2248 <1> D_P_Cmpx01: ;AN000; 2249 <1> ;(deleted ;AN025;) call D_P_Chk_DSQuote ;AN000; double or single quotation mark ? 3/17/KK 2250 <1> cmp al,D_P_DQuote ;AN025; double quotation mark? 2251 <1> jne D_P_Cmpx04 ;AN000; 3/17/KK 2252 <1> 2253 <1> mov [psdata_seg:si],al ;AN000; here quoted string is found in the complex list. 2254 <1> inc si ;AN000; 2255 <1> inc bx ;AN000; bx points to 2nd character 2256 <1> call D_P_Quoted_Str ;AN000; skip pointers until closing of quoted string 2257 <1> jc D_P_CmpxErr0 ;AN000; if error in quoted string syntax then exit 2258 <1> 2259 <1> jmp short D_P_Cmpx05 ;AN000; 2260 <1> 2261 <1> D_P_Cmpx04: ;AN000; 2262 <1> call D_P_Chk_DBCS ;AN000; was it a lead byte of DBCS ? 2263 <1> jnc D_P_Cmpx02 ;AN000; 2264 <1> 2265 <1> mov [psdata_seg:si],al ;AN000; then store 1st byte 2266 <1> inc si ;AN000; 2267 <1> inc bx ;AN000; 2268 <1> mov al,[bx] ;AN000; load 2nd byte 2269 <1> D_P_Cmpx02: ;AN000; 2270 <1> mov [psdata_seg:si],al ;AN000; store SBCS or 2nd byte of DBCS 2271 <1> D_P_Cmpx05: ;AN000; 2272 <1> inc si ;AN000; 2273 <1> inc bx ;AN000; 2274 <1> jmp short D_P_Cmpx_Loop ;AN000; loop 2275 <1> ;---- ;AN000; 2276 <1> D_P_Cmpx03: ;AN000; 2277 <1> mov byte ptr [psdata_seg:si],al ;AN000; 2278 <1> mov byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; 2279 <1> mov byte ptr [bx],D_P_NULL ;AN000; replace right parentheses with NULL 2280 <1> mov si,bx ;AN000; skip whitespaces 2281 <1> inc si ;AN000; after 2282 <1> call D_P_Skip_Delim ;AN000; right parentheses 2283 <1> mov [psdata_seg:D_P_SI_Save],si ;AC034; save next pointer, SI 2284 <1> jmp short D_P_Cmpx_Exit ;AN000; 2285 <1> 2286 <1> D_P_CmpxErr0: ;AN000; 2287 <1> mov si,[psdata_seg:D_P_Save_EOB] ;AC034; if EOF encountered, restore 2288 <1> mov byte ptr [psdata_seg:si],D_P_NULL ;AN000; EOB mark 2289 <1> D_P_Cmpx_Err: ;AN000; 2290 <1> mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; 2291 <1> D_P_Cmpx_Exit: ;AN000; 2292 <1> mov ah,D_P_No_Tag ;AN000; 2293 <1> mov al,D_P_Complex ;AN000; 2294 <1> pop si ;AN000; 2295 <1> pop bx ;AN000; 2296 <1> call D_P_Fill_Result ;AN000; 2297 <1> pop ax ;AN000; 2298 <1> ret ;AN000; 2299 <1> D_P_Complex_Format endp ;AN000; 2300 <1> %ENDIF ;AN000;(of CpmxSW) 2301 <1> ;PAGE ;AN000; 2302 <1> ;*********************************************************************** 2303 <1> %IF QusSW ;AN000;(Check if quoted string is supported) 2304 <1> ; D_P_Quoted_Format: 2305 <1> ; 2306 <1> ; Function: Check if the input string is valid quoted string format. 2307 <1> ; And set the result buffer. 2308 <1> ; 2309 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2310 <1> ; ES:BX -> CONTROL block 2311 <1> ; 2312 <1> ; Output: None 2313 <1> ; 2314 <1> ; Use: D_P_Fill_Result, D_P_Chk_DBCS, D_P_Chk_EOL, D_P_Skip_Delim 2315 <1> ; D_P_Chk_DSQuote, D_P_Quoted_Str 2316 <1> ; 2317 <1> ; Vars: D_P_RC(W), D_P_SI_Save(W), D_P_SaveSI_Cmpx(R),D_P_Save_EOB(R) 2318 <1> ;*********************************************************************** 2319 <1> D_P_Quoted_Format proc ;AN000; 2320 <1> push ax ;AN000; 2321 <1> push bx ;AN000; 2322 <1> push si ;AN000; 2323 <1> mov bx,[psdata_seg:D_P_SaveSI_Cmpx] ;AC034; bx points to user buffer 2324 <1> mov al,byte ptr [bx] ;AN000; get 1st character 2325 <1> ;(deleted ;AN025;) call D_P_Chk_DSQuote ;AN000; is it single or double quote ? 2326 <1> cmp al,D_P_DQuote ;AN025; double quotation mark? 2327 <1> jne D_P_Qus_Err ;AN000; if no, error 2328 <1> 2329 <1> ; mov [psdata_seg:si],al ;AN000; move it to internal buffer 2330 <1> ; inc si ;AN000; 2331 <1> inc bx ;AN000; bx points to 2nd character 2332 <1> call D_P_Quoted_Str ;AN000; skip pointers to the closing of quoted string 2333 <1> jc D_P_Qus_Err0 ;AN000; if invali quoted string syntax, exit 2334 <1> 2335 <1> mov byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; end up with NULL 2336 <1> mov si,bx ;AN000; 2337 <1> inc si ;AN000; 2338 <1> call D_P_Skip_Delim ;AN000; skip whitespaces after closing quote 2339 <1> mov [psdata_seg:D_P_SI_Save],si ;AC034; save next pointer, SI 2340 <1> jmp short D_P_Qus_Exit ;AN000; 2341 <1> 2342 <1> D_P_Qus_Err0: ;AN000; 2343 <1> mov si,[psdata_seg:D_P_Save_EOB] ;AC034; if EOF encountered, restore 2344 <1> mov byte ptr [psdata_seg:si],D_P_NULL ;AN000; EOB mark 2345 <1> D_P_Qus_Err: ;AN000;AN000 2346 <1> mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; indicate syntax error 2347 <1> D_P_Qus_Exit: ;AN000; 2348 <1> mov ah,D_P_No_Tag ;AN000; set 2349 <1> mov al,D_P_Quoted_String ;AN000; result 2350 <1> pop si ;AN000; buffer 2351 <1> pop bx ;AN000; to 2352 <1> call D_P_Fill_Result ;AN000; quoted string 2353 <1> pop ax ;AN000; 2354 <1> ret ;AN000; 2355 <1> D_P_Quoted_Format endp ;AN000; 2356 <1> %ENDIF ;AN000;(of QusSW) 2357 <1> ;PAGE ;AN000; 2358 <1> ;*********************************************************************** 2359 <1> ; D_P_Chk_DSQuote; 2360 <1> ; 2361 <1> ; Function: Check if AL is double quotation or single quotation 2362 <1> ; 2363 <1> ; Input: AL = byte to be examineed 2364 <1> ; 2365 <1> ; Output: ZF on if AL is single or double quotetaion 2366 <1> ; 2367 <1> ; Vars: D_P_SorD_Quote(W) 2368 <1> ;*********************************************************************** 2369 <1> %IF QusSW+CmpxSW ;AN000;(Check if quoted string or complex item is supported) 2370 <1> ;(deleted ;AN025;) D_P_Chk_DSQuote proc ; 2371 <1> ;(deleted ;AN025;) mov D_P_SorD_Quote,D_P_SQuote ; 3/17/87 assume single quote 2372 <1> ;(deleted ;AN025;) cmp al,D_P_DQuote ; 1st char = double quotation ? 2373 <1> ;(deleted ;AN025;) jne D_P_CDSQ00 ; 3/17/87 2374 <1> ;(deleted ;AN025;) mov D_P_SorD_Quote,al ; 3/17/87 set bigning w/ double quote 2375 <1> ;(deleted ;AN025;) ret ; 3/17/87 2376 <1> ;(deleted ;AN025;) D_P_CDSQ00: ; 3/17/87 2377 <1> ;(deleted ;AN025;) cmp al,D_P_SQuote ; 1st char = single quotation ? 2378 <1> ;(deleted ;AN025;) ret ; 2379 <1> ;(deleted ;AN025;) D_P_Chk_DSQuote endp ; 2380 <1> ; PAGE ;AN000; 2381 <1> ;*********************************************************************** 2382 <1> ; D_P_Quoted_Str: 2383 <1> ; 2384 <1> ; Function: Copy chracacter from ES:BX to psdata_seg:SI until closing single 2385 <1> ; (double) quotation found. 2386 <1> ; 2387 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2388 <1> ; ES:BX -> Operand in command buffer 2389 <1> ; 2390 <1> ; Output: CY on indicates EOF encounterd before closing quotation 2391 <1> ; BX and SI 2392 <1> ; 2393 <1> ; 2394 <1> ; Vars: D_P_SorD_Quote(R) 2395 <1> ;*********************************************************************** 2396 <1> D_P_Quoted_Str proc ;AN000; 2397 <1> push ax ;AN000; 2398 <1> D_P_Qus_Loop: ;AN000; 2399 <1> mov ax,[bx] ;AN000; 3/17/87 2400 <1> call D_P_Chk_EOL ;AN000; 2401 <1> je D_P_Qustr_Err0 ;AN000; 2402 <1> 2403 <1> ;(deleted ;AN025;) cmp al,D_P_SorD_Quote ;AN000; quotation ? 3/17/87 2404 <1> cmp al,D_P_DQuote ;AN025; double quote? 2405 <1> jne D_P_Qus00 ;AN000; 2406 <1> 2407 <1> ;(deleted ;AN025;) cmp ah,D_P_SorD_Quote ;AN000; contiguous quotation 3/17/87 2408 <1> cmp ah,D_P_DQuote ;AN025; double quote? 2409 <1> jne D_P_Qus02 ;AN000; 2410 <1> 2411 <1> ;(deleted ;AN025:) mov word ptr [psdata_seg:si],ax ;AN000; 3/17/87 2412 <1> mov byte ptr [psdata_seg:si],al ;AN025; save one of the quotes 2413 <1> ;(deleted ;AN025:) add si,2 ;AN000; 2414 <1> 2415 <1> inc si ;AC035; add '1' to SI reg 2416 <1> ;AN025; adjust target index 2417 <1> ;(changed ;AC035;) add si,1 ;AN025; adjust target index 2418 <1> inc bx ;AC035; add '2' to 2419 <1> inc bx ;AC035; BX reg 2420 <1> ;AN000; adjust source index by 2 to skip extra quote 2421 <1> ;(changed ;AC035;) add bx,2 ;AN000; adjust source index by 2 to skip extra quote 2422 <1> jmp short D_P_Qus_Loop ;AN000; 2423 <1> 2424 <1> D_P_Qus00: ;AN000; 2425 <1> call D_P_Chk_DBCS ;AN000; was it a lead byte of DBCS ? 2426 <1> jnc D_P_Qus01 ;AN000; 2427 <1> 2428 <1> mov [psdata_seg:si],al ;AN000; store 1st byte 2429 <1> inc si ;AN000; 2430 <1> inc bx ;AN000; 2431 <1> mov al,[bx] ;AN000; load 2nd byte 2432 <1> D_P_Qus01: ;AN000; 2433 <1> mov [psdata_seg:si],al ;AN000; store SBCS or 2nd byte of DBCS 2434 <1> inc si ;AN000; 2435 <1> inc bx ;AN000; 2436 <1> jmp short D_P_Qus_Loop ;AN000; 2437 <1> 2438 <1> D_P_Qustr_Err0: ;AN000; 2439 <1> stc ;AN000; indicate error 2440 <1> jmp short D_P_Quoted_Str_Exit ;AN000; 2441 <1> 2442 <1> D_P_Qus02: ;AN000; 2443 <1> mov byte ptr [psdata_seg:si],0 ;AN000; 2444 <1> clc ;AN000; indicate no error 2445 <1> D_P_Quoted_Str_Exit: ;AN000; 2446 <1> pop ax ;AN000; 2447 <1> ret ;AN000; 2448 <1> D_P_Quoted_Str endp ;AN000; 2449 <1> %ENDIF ;AN000;(of QusSW+CmpxSW) 2450 <1> ;PAGE ;AN000; 2451 <1> ;*********************************************************************** 2452 <1> %IF FileSW+DrvSW ;AN000;(Check if file spec or drive only is supported) 2453 <1> ; D_P_File_Format; 2454 <1> ; 2455 <1> ; Function: Check if the input string is valid file spec format. 2456 <1> ; And set the result buffer. 2457 <1> ; 2458 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2459 <1> ; ES:BX -> CONTROL block 2460 <1> ; 2461 <1> ; Output: None 2462 <1> ; 2463 <1> ; Use: D_P_Fill_Result, D_P_Chk_DBCS, D_P_FileSp_Chk 2464 <1> ; 2465 <1> ; Vars: D_P_RC(W), D_P_SI_Save(W), D_P_Terminator(W), D_P_SaveSI_Cmpx(R) 2466 <1> ; D_P_SaveSI_Cmpx(R) 2467 <1> ;*********************************************************************** 2468 <1> D_P_File_Format proc ;AN000; 0 0000156F 50 push ax ;AN000; 0 00001570 57 push di ;AN000; 0 00001571 56 push si ;AN000; 2472 <1> D_P_SaveSI_cmpx equ D_P_SaveSI_Cmpx ; NASM port label 0 00001572 2E8B3E[9403] mov di,[psdata_seg:D_P_SaveSI_cmpx] ;AC034; get user buffer address 2474 <1> D_P_FileF_Loop0: ;AN000; / skip special characters 0 00001577 2E8A04 mov al,[psdata_seg:si] ;AN000; load character 0 0000157A 08C0 or al,al ;AN000; end of line ? 0 0000157C 7413 je D_P_FileF_Err ;AN000; if yes, error exit 2478 <1> 0 0000157E E85F00 call D_P_FileSp_Chk ;AN000; else, check if file special character 0 00001581 7524 jne D_P_FileF03 ;AN000; if yes, 2481 <1> 2482 <1> ;AN033; deleted inc di ;skip 2483 <1> ;AN033; deleted inc si ; the 2484 <1> ;AN033; deleted jmp short D_P_FileF_Loop0 ; character 0 00001583 2EC606[2A04]01 mov byte [psdata_seg:D_P_err_flag],D_P_error_filespec ;AN033;AC034;; set error flag- bad char. 0 00001589 5E pop si ;AN033; 0 0000158A 2EC60400 mov byte ptr [psdata_seg:si],D_P_NULL ;AN033; 0 0000158E 5F pop di ;AN033; 0 0000158F EB3F jmp short D_P_FileF02 ;AN033; 2490 <1> 2491 <1> 2492 <1> D_P_FileF_Err: ;AN000; 0 00001591 5E pop si ;AN000; 0 00001592 2EC60400 mov byte ptr [psdata_seg:si],D_P_NULL ;AN000; 2495 <1> ;(deleted ;AN030;) mov di,D_P_SaveSI_cmpx ;AN000; get user buffer address 2496 <1> ;(deleted ;AN030;) mov D_P_SI_Save,di ;AN000; update pointer to user buffer 0 00001596 5F pop di ;AN000; 0 00001597 26F7070100 test word [es:bx + D_P_Match_Flag],D_P_Optional ;AN000; is it optional ? 0 0000159C 7532 jne D_P_FileF02 ;AN000; 2500 <1> 0 0000159E 2EC706[8703]0200 mov word [psdata_seg:D_P_RC],D_P_Op_Missing ;AC034; 3/17/87 0 000015A5 EB29 jmp short D_P_FileF02 ;AN000; 2503 <1> 2504 <1> D_P_FileF03: ;AN000; 0 000015A7 58 pop ax ;AN000; discard save si 0 000015A8 56 push si ;AN000; save new si 2507 <1> D_P_FileF_Loop1: ;AN000; 0 000015A9 2E8A04 mov al,[psdata_seg:si] ;AN000; load character (not special char) 0 000015AC 08C0 or al,al ;AN000; end of line ? 0 000015AE 741E je D_P_FileF_RLT ;AN000; 2511 <1> 0 000015B0 E82D00 call D_P_FileSp_Chk ;AN000; File special character ? 0 000015B3 740B je D_P_FileF00 ;AN000; 2514 <1> 0 000015B5 E85C01 call D_P_Chk_DBCS ;AN000; no, then DBCS ? 0 000015B8 7302 jnc D_P_FileF01 ;AN000; 0 000015BA 47 inc di ;AN000; if yes, skip next byte 0 000015BB 46 inc si ;AN000; 2519 <1> D_P_FileF01: ;AN000; 0 000015BC 47 inc di ;AN000; 0 000015BD 46 inc si ;AN000; 0 000015BE EBE9 jmp short D_P_FileF_Loop1 ;AN000; 2523 <1> ; 2524 <1> D_P_FileF00: ;AN000; 0 000015C0 2EA2[8D03] mov [psdata_seg:D_P_Terminator],al ;AC034; 0 000015C4 2EC60400 mov byte ptr [psdata_seg:si],D_P_NULL ;AN000; update end of string 0 000015C8 47 inc di ;AN000; 0 000015C9 2E893E[8903] mov [psdata_seg:D_P_SI_Save],di ;AC034; update next pointer in command line 2529 <1> D_P_FileF_RLT: ;AN000; 0 000015CE 5E pop si ;AN000; 0 000015CF 5F pop di ;AN000; 2532 <1> D_P_FileF02: ;AN000; 2533 <1> 0 000015D0 58 pop ax ;AN000; (tm14) 0 000015D1 A90002 test ax,D_P_File_Spc ;AN000; (tm14) 0 000015D4 7409 je D_P_Drv_Only_Exit ;AN000; (tm14) 2537 <1> 0 000015D6 50 push ax ;AN000; (tm14) 2539 <1> 0 000015D7 B4FF mov ah,D_P_No_Tag ;AN000; set 0 000015D9 B005 mov al,D_P_File_Spec ;AN000; result 0 000015DB E88EFB call D_P_Fill_Result ;AN000; buffer to file spec 0 000015DE 58 pop ax ;AN000; 2544 <1> 2545 <1> D_P_Drv_Only_Exit: ;AN000; (tm14) 2546 <1> 0 000015DF C3 ret ;AN000; 2548 <1> D_P_File_Format endp ;AN000; 2549 <1> ;PAGE ;AN000; 2550 <1> ;*********************************************************************** 2551 <1> ; D_P_FileSp_Chk 2552 <1> ; 2553 <1> ; Function: Check if the input byte is one of file special characters 2554 <1> ; 2555 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2556 <1> ; AL = character code to be examineed 2557 <1> ; 2558 <1> ; Output: ZF = 1 , AL is one of special characters 2559 <1> ;*********************************************************************** 2560 <1> D_P_FileSp_Chk proc ;AN000; 0 000015E0 53 push bx ;AN000; 0 000015E1 51 push cx ;AN000; 0 000015E2 8D1E[2104] lea bx,[D_P_FileSp_Char] ;AC034; special character table 0 000015E6 B90900 mov cx,D_P_FileSp_Len ;AN000; load length of it 2565 <1> D_P_FileSp_Loop: ;AN000; 0 000015E9 2E3A07 cmp al,[psdata_seg:bx] ;AN000; is it one of special character ? 0 000015EC 7404 je D_P_FileSp_Exit ;AN000; 2568 <1> 0 000015EE 43 inc bx ;AN000; 0 000015EF E2F8 loop D_P_FileSp_Loop ;AN000; 2571 <1> 0 000015F1 41 inc cx ;AN000; reset ZF 2573 <1> D_P_FileSp_Exit: ;AN000; 0 000015F2 59 pop cx ;AN000; 0 000015F3 5B pop bx ;AN000; 0 000015F4 C3 ret ;AN000; 2577 <1> D_P_FileSp_Chk endp ;AN000; 2578 <1> %ENDIF ;AN000;(of FileSW+DrvSW) 2579 <1> ;PAGE ;AN000; 2580 <1> ;*********************************************************************** 2581 <1> %IF DrvSW ;AN000;(Check if drive only is supported) 2582 <1> ; D_P_Drive_Format; 2583 <1> ; 2584 <1> ; Function: Check if the input string is valid drive only format. 2585 <1> ; And set the result buffer. 2586 <1> ; 2587 <1> ; Input: psdata_seg:SI -> D_P_STRING_BUF 2588 <1> ; ES:BX -> CONTROL block 2589 <1> ; 2590 <1> ; Output: None 2591 <1> ; 2592 <1> ; Use: D_P_Fill_Result, D_P_Chk_DBCS 2593 <1> ; 2594 <1> ; Vars: D_P_RC(W) 2595 <1> ;*********************************************************************** 2596 <1> D_P_Drive_Format proc ;AN000; 0 000015F5 50 push ax ;AN000; 0 000015F6 52 push dx ;AN000; 0 000015F7 2E8A04 mov al,[psdata_seg:si] ;AN000; 0 000015FA 08C0 or al,al ;AN000; if null string 0 000015FC 7438 je D_P_Drv_Exit ;AN000; do nothing 2602 <1> 0 000015FE E81301 call D_P_Chk_DBCS ;AN000; is it leading byte ? 0 00001601 722C jc D_P_Drv_Err ;AN000; 2605 <1> 0 00001603 2E837C013A cmp word ptr [psdata_seg:si+1],D_P_Colon ;AN000; "d", ":", 0 ? 0 00001608 740E je D_P_DrvF00 ;AN000; 2608 <1> 0 0000160A 26F7071000 test word [es:bx + D_P_Match_Flag],D_P_Ig_Colon ;AN000; colon can be ignored? 0 0000160F 741E je D_P_Drv_Err ;AN000; 2611 <1> 0 00001611 2E807C0100 cmp byte ptr [psdata_seg:si+1],D_P_NULL ;AN000; "d", 0 ? 0 00001616 7517 jne D_P_Drv_Err ;AN000; 2614 <1> 2615 <1> D_P_DrvF00: ;AN000; 0 00001618 0C20 or al,D_P_Make_Lower ;AN000; lower case 0 0000161A 3C61 cmp al,"a" ;AN000; drive letter must 0 0000161C 7211 jb D_P_Drv_Err ;AN000; in range of 2619 <1> 0 0000161E 3C7A cmp al,"z" ;AN000; "a" - "z" 0 00001620 770D ja D_P_Drv_Err ;AN000; if no, error 2622 <1> 0 00001622 2C60 sub al,"a"-1 ;AN000; make text drive to binary drive 0 00001624 88C2 mov dl,al ;AN000; set 0 00001626 B4FF mov ah,D_P_No_Tag ;AN000; result 0 00001628 B006 mov al,D_P_Drive ;AN000; buffer 0 0000162A E83FFB call D_P_Fill_Result ;AN000; to drive 0 0000162D EB07 jmp short D_P_Drv_Exit ;AN000; 2629 <1> 2630 <1> D_P_Drv_Err: ;AN000; 0 0000162F 2EC706[8703]0900 mov word [psdata_seg:D_P_RC],D_P_Syntax ;AC034; 2632 <1> D_P_Drv_Exit: ;AN000; 0 00001636 5A pop dx ;AN000; 0 00001637 58 pop ax ;AN000; 0 00001638 C3 ret ;AN000; 2636 <1> D_P_Drive_Format endp ;AN000; 2637 <1> %ENDIF ;AN000;(of DrvSW) 2638 <1> ;PAGE ;AN000; 2639 <1> ;*********************************************************************** 2640 <1> ; D_P_Skip_Delim; 2641 <1> ; 2642 <1> ; Function: Skip delimiters specified in the PARMS list, white space 2643 <1> ; and comma. 2644 <1> ; 2645 <1> ; Input: DS:SI -> Command String 2646 <1> ; ES:DI -> Parameter List 2647 <1> ; 2648 <1> ; Output: CY = 1 if the end of line encounterd 2649 <1> ; CY = 0 then SI move to 1st non-delimiter character 2650 <1> ; AL = Last examineed character 2651 <1> ; 2652 <1> ; Use: D_P_Chk_EOL, D_P_Chk_Delim, 2653 <1> ; 2654 <1> ; Vars: D_P_Flags(R) 2655 <1> ;*********************************************************************** 2656 <1> D_P_Skip_Delim proc ;AN000; 2657 <1> D_P_Skip_Delim_Loop: ;AN000; 0 00001639 AC LODSB ;AN000; 0 0000163A E82200 call D_P_Chk_EOL ;AN000; is it EOL character ? 0 0000163D 7418 je D_P_Skip_Delim_CY ;AN000; if yes, exit w/ CY on 2661 <1> 0 0000163F E85300 call D_P_Chk_Delim ;AN000; is it one of delimiters ? 0 00001642 7516 jne D_P_Skip_Delim_NCY ;AN000; if no, exit w/ CY off 2664 <1> 0 00001644 2EF606[9303]20 test byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; extra delim or comma found ? 0 0000164A 74ED je D_P_Skip_Delim_Loop ;AN000; if no, loop 2667 <1> 0 0000164C 2EF606[9303]41 test byte [psdata_seg:D_P_Flags2],D_P_SW+D_P_equ ;AC034; /x , or xxx=zzz , (tm08) 0 00001652 7409 je short D_P_Exit_At_Extra ;AN000; no switch, no keyword (tm08) 2670 <1> 0 00001654 4E dec si ;AN000; backup si for next call (tm08) 0 00001655 EB06 jmp short D_P_Exit_At_Extra ;AN000; else exit w/ CY off 2673 <1> 2674 <1> D_P_Skip_Delim_CY: ;AN000; 0 00001657 F9 stc ;AN000; indicate EOL 0 00001658 EB01 jmp short D_P_Skip_Delim_Exit ;AN000; 2677 <1> 2678 <1> D_P_Skip_Delim_NCY: ;AN000; 0 0000165A F8 clc ;AN000; indicate non delim 2680 <1> D_P_Skip_Delim_Exit: ;AN000; in this case, need 0 0000165B 4E dec si ;AN000; backup index pointer 0 0000165C C3 ret ;AN000; 2683 <1> 2684 <1> D_P_Exit_At_Extra: ;AN000; 0 0000165D F8 clc ;AN000; indicate extra delim 0 0000165E C3 ret ;AN000; 2687 <1> D_P_Skip_Delim endp ;AN000; 2688 <1> ;PAGE ;AN000; 2689 <1> ;*********************************************************************** 2690 <1> ; D_P_Chk_EOL; 2691 <1> ; 2692 <1> ; Function: Check if AL is one of End of Line characters. 2693 <1> ; 2694 <1> ; Input: AL = character code 2695 <1> ; ES:DI -> Parameter List 2696 <1> ; 2697 <1> ; Output: ZF = 1 if one of End of Line characters 2698 <1> ;********************************************************************** 2699 <1> D_P_Chk_EOL proc ;AN000; 0 0000165F 53 push bx ;AN000; 0 00001660 51 push cx ;AN000; 0 00001661 3C0D cmp al,D_P_CR ;AN000; Carriage return ? 0 00001663 742D je D_P_Chk_EOL_Exit ;AN000; 2704 <1> 0 00001665 3C00 cmp al,D_P_NULL ;AN000; zero ? 0 00001667 7429 je D_P_Chk_EOL_Exit ;AN000; 2707 <1> 2708 <1> %IF LFEOLSW ;AN028; IF LF TO BE ACCEPTED AS EOL 0 00001669 3C0A cmp al,D_P_LF ;AN000; Line feed ? 0 0000166B 7425 je D_P_Chk_EOL_Exit ;AN000; 2711 <1> %ENDIF ;AN028; 2712 <1> 0 0000166D 26807D0202 cmp byte ptr [es:di + D_P_Num_Extra],D_P_I_Have_EOL ;AN000; EOL character specified ? 0 00001672 721E jb D_P_Chk_EOL_Exit ;AN000; 2715 <1> 0 00001674 31DB xor bx,bx ;AN000; 0 00001676 268A5D03 mov bl,[es:di + D_P_Len_Extra_Delim] ;AN000; get length of delimiter list 0 0000167A 83C304 add bx,D_P_Len_PARMS ;AN000; skip it 0 0000167D 26803900 cmp byte ptr [es:bx+di],D_P_I_Use_Default ;AN000; No extra EOL character ? 0 00001681 740D je D_P_Chk_EOL_NZ ;AN000; 2721 <1> 0 00001683 31C9 xor cx,cx ;AN000; Get number of extra chcracter 0 00001685 268A09 mov cl,[es:bx+di] ;AN000; 2724 <1> D_P_Chk_EOL_Loop: ;AN000; 0 00001688 43 inc bx ;AN000; 0 00001689 263A01 cmp al,[es:bx+di] ;AN000; Check extra EOL character 0 0000168C 7404 je D_P_Chk_EOL_Exit ;AN000; 2728 <1> 0 0000168E E2F8 loop D_P_Chk_EOL_Loop ;AN000; 2730 <1> 2731 <1> D_P_Chk_EOL_NZ: ;AN000; 0 00001690 3C0D cmp al,D_P_CR ;AN000; reset ZF 2733 <1> D_P_Chk_EOL_Exit: ;AN000; 0 00001692 59 pop cx ;AN000; 0 00001693 5B pop bx ;AN000; 0 00001694 C3 ret ;AN000; 2737 <1> D_P_Chk_EOL endp ;AN000; 2738 <1> ;PAGE ;AN000; 2739 <1> ;*********************************************************************** 2740 <1> ; D_P_Chk_Delim; 2741 <1> ; 2742 <1> ; Function: Check if AL is one of delimiter characters. 2743 <1> ; if AL+[si] is DBCS blank, it is replaced with two SBCS 2744 <1> ; blanks. 2745 <1> ; 2746 <1> ; Input: AL = character code 2747 <1> ; DS:SI -> Next Character 2748 <1> ; ES:DI -> Parameter List 2749 <1> ; 2750 <1> ; Output: ZF = 1 if one of delimiter characters 2751 <1> ; SI points to the next character 2752 <1> ; Vars: D_P_Terminator(W), D_P_Flags(W) 2753 <1> ;*********************************************************************** 2754 <1> D_P_Chk_Delim proc ;AN000; 0 00001695 53 push bx ;AN000; 0 00001696 51 push cx ;AN000; 0 00001697 2EC606[8D03]20 mov byte [psdata_seg:D_P_Terminator],D_P_Space ;AC034; Assume terminated by space 0 0000169D 2E8026[9303]DF and byte [psdata_seg:D_P_Flags2],0ffh-D_P_Extra ;AC034; 0 000016A3 3C20 cmp al,D_P_Space ;AN000; Space ? 0 000016A5 7436 je D_P_Chk_Delim_Exit ;AN000; 2761 <1> 0 000016A7 3C09 cmp al,D_P_TAB ;AN000; TAB ? 0 000016A9 7432 je D_P_Chk_Delim_Exit ;AN000; 2764 <1> 0 000016AB 3C2C cmp al,D_P_Comma ;AN000; Comma ? 0 000016AD 7431 je D_P_Chk_Delim_Exit0 ;AN000; 2767 <1> 2768 <1> D_P_Chk_Delim00: ;AN000; 0 000016AF 3C81 cmp al,D_P_DBSP1 ;AN000; 1st byte of DBCS Space ? 0 000016B1 750C jne D_P_Chk_Delim01 ;AN000; 2771 <1> 0 000016B3 803C40 cmp byte ptr [si],D_P_DBSP2 ;AN000; 2nd byte of DBCS Space ? 0 000016B6 7507 jne D_P_Chk_Delim01 ;AN000; 2774 <1> 0 000016B8 B020 mov al,D_P_Space ;AN000; 0 000016BA 46 inc si ;AN000; make si point to next character 0 000016BB 38C0 cmp al,al ;AN000; Set ZF 0 000016BD EB1E jmp short D_P_Chk_Delim_Exit ;AN000; 2779 <1> 2780 <1> D_P_Chk_Delim01: ;AN000; 0 000016BF 26807D0201 cmp byte ptr [es:di + D_P_Num_Extra],D_P_I_Have_Delim ;AN000; delimiter character specified ? 0 000016C4 7217 jb D_P_Chk_Delim_Exit ;AN000; 2783 <1> 0 000016C6 31C9 xor cx,cx ;AN000; 0 000016C8 268A4D03 mov cl,[es:di + D_P_Len_Extra_Delim] ;AN000; get length of delimiter list 0 000016CC 09C9 or cx,cx ;AN000; No extra Delim character ? 0 000016CE 740B je D_P_Chk_Delim_NZ ;AN000; 2788 <1> 0 000016D0 BB0300 mov bx,D_P_Len_PARMS-1 ;AN000; set bx to 1st extra delimiter 2790 <1> D_P_Chk_Delim_Loop: ;AN000; 0 000016D3 43 inc bx ;AN000; 0 000016D4 263A01 cmp al,[es:bx+di] ;AN000; Check extra Delim character 0 000016D7 7407 je D_P_Chk_Delim_Exit0 ;AN000; 2794 <1> 0 000016D9 E2F8 loop D_P_Chk_Delim_Loop ;AN000; examine all extra delimiter 2796 <1> 2797 <1> D_P_Chk_Delim_NZ: ;AN000; 0 000016DB 3C20 cmp al,D_P_Space ;AN000; reset ZF 2799 <1> D_P_Chk_Delim_Exit: ;AN000; 2800 <1> ;;;; jne D_P_ChkDfin 2801 <1> ;;;; mov psdata_seg:D_P_Terminator,al ;AN034; 2802 <1> D_P_ChkDfin: ;AN000; 0 000016DD 59 pop cx ;AN000; 0 000016DE 5B pop bx ;AN000; 0 000016DF C3 ret ;AN000; 2806 <1> 2807 <1> D_P_Chk_Delim_Exit0: ;AN000; 0 000016E0 2EA2[8D03] mov [psdata_seg:D_P_Terminator],al ;AC034; keep terminated delimiter 2809 <1> D_P_Equ equ D_P_equ ; NASM port equate 0 000016E4 2EF606[9303]01 test byte [psdata_seg:D_P_Flags2],D_P_Equ ;AN027;AC034;; if terminating a key= 0 000016EA 7506 jnz D_P_No_Set_Extra ;AN027; then do not set the EXTRA bit 2812 <1> 0 000016EC 2E800E[9303]20 or byte [psdata_seg:D_P_Flags2],D_P_Extra ;AC034; flag terminated extra delimiter or comma 2814 <1> D_P_No_Set_Extra: ;AN027; 0 000016F2 38C0 cmp al,al ;AN000; set ZF 0 000016F4 EBE7 jmp short D_P_Chk_Delim_Exit ;AN000; 2817 <1> 2818 <1> D_P_Chk_Delim endp ;AN000; 2819 <1> ;PAGE ;AN000; 2820 <1> ;*********************************************************************** 2821 <1> ; D_P_Chk_Switch; 2822 <1> ; 2823 <1> ; Function: Check if AL is the switch character not in first position of 2824 <1> ; D_P_STRING_BUF 2825 <1> ; 2826 <1> ; Input: AL = character code 2827 <1> ; BX = current pointer within D_P_String_Buf 2828 <1> ; SI =>next char on command line (following the one in AL) 2829 <1> ; 2830 <1> ; Output: CF = 1 (set)if AL is switch character, and not in first 2831 <1> ; position, and has no chance of being part of a date string, 2832 <1> ; i.e. should be treated as a delimiter. 2833 <1> 2834 <1> ; CF = 0 (reset, cleared) if AL is not a switch char, is in the first 2835 <1> ; position, or is a slash but may be part of a date string, i.e. 2836 <1> ; should not be treated as a delimiter. 2837 <1> ; 2838 <1> ; Vars: D_P_Terminator(W) 2839 <1> 2840 <1> ; Use: D_P_0099 2841 <1> ;*********************************************************************** 2842 <1> D_P_Chk_Switch proc ;AN000; 2843 <1> 2844 <1> ;AN020;; Function: Check if AL is the switch character from 2nd position of D_P_STRING_BUF 2845 <1> ;AN020;; Output: ZF = 1 if switch character 2846 <1> ;AN020;; lea bp,D_P_STRING_BUF ;AN000; 2847 <1> ;AN020;; cmp bx,bp ;AN000; 1st position ? 2848 <1> ;AN020;; je D_P_Chk_S_Exit_1 ;AN000; 2849 <1> ;AN020;; cmp al,D_P_Switch ;AN000; 2850 <1> ;AN020;; jmp short D_P_Chk_S_Exit_0 ;AN000; 2851 <1> ;AN020;;D_P_Chk_S_Exit_1: ;AN000; 2852 <1> ;AN020;; cmp al,D_P_Switch ;AN000; (tm08) 2853 <1> ;AN020;; jne D_P_Nop ;AN000; (tm08) 2854 <1> ;AN020;; or D_P_Flags2,D_P_SW ;AN000; (tm08) It could be valid switch 2855 <1> ;AN020;;D_P_Nop: ;AN000; (tm08) 2856 <1> ;AN020;; inc bp ;AN000; 2857 <1> ;AN020;; cmp bx,bp ;AN000; reset ZF 2858 <1> ;AN020;;D_P_Chk_S_Exit_0: ;AN000; 2859 <1> ;AN020;; jne D_P_Chk_S_Exit ;AN000; 2860 <1> ;AN020;; mov D_P_Terminator,al ;AN000; store switch character 2861 <1> ;AN020;;D_P_Chk_S_Exit: ;AN000; 2862 <1> 2863 <1> D_P_String_Buf equ D_P_STRING_BUF ; NASM port label 0 000016F6 8D2E[9C03] LEA BP,[D_P_String_Buf] ;AN020;AC034; BP=OFFSET of D_P_String_Buf even in group addressing 2865 <1> ; .IF THEN ;AN020;IF not first char THEN 0 000016FA 39EB cmp BX,BP ;AN000; 0 000016FC 740A je D_P_STRUC_L2 ;AN000; 2868 <1> 2869 <1> ; .IF THEN ;AN020;otherwise see if a slash 0 000016FE 3C2F cmp AL,D_P_Switch ;AN000; 0 00001700 7503 jne D_P_STRUC_L5 ;AN000; 2872 <1> 0 00001702 F9 STC ;AN020;not in first position and is slash, now see if might be in date string 2874 <1> %IF DateSw ;AN020;caller looking for date, see if this may be part of one 2875 <1> PUSH AX ;AN020;save input char 2876 <1> MOV AL,[PSDATA_SEG:BX-1] ;AN026;AL=char before the current char 2877 <1> CALL D_P_0099 ;AN020;return carry set if not numeric 2878 <1> ; .IF NC ;AND ;AN020;IF previous char numeric AND 2879 <1> jc D_P_STRUC_L7 ;AN000; 2880 <1> 2881 <1> MOV AL,[SI] ;AN020;AL=char after the current char 2882 <1> CALL D_P_0099 ;AN020;return carry set if not numeric 2883 <1> ;(deleted) .IF NC THEN ;AN020;IF next char numeric THEN could be a date 2884 <1> ;(deleted) CLC ;AN020;reset CF so "/" not treated as a delimiter 2885 <1> ;(deleted) .ENDIF ;AN026; 2886 <1> ; .ENDIF ;AN020;ENDIF looks like date (number/number) 2887 <1> D_P_STRUC_L7: ;AN000; 2888 <1> POP AX ;AN020;restore AL to input char 2889 <1> %ENDIF ;AN020;DateSw 2890 <1> ; .ELSE ;AN020; 0 00001703 EB0E jmp short D_P_STRUC_L1 ;AN000; 2892 <1> 2893 <1> D_P_STRUC_L5: ;AN000; 0 00001705 F8 CLC ;AN020;not a slash 2895 <1> ; .ENDIF ;AN020; 2896 <1> ; .ELSE ;AN020;is first char in the buffer, ZF=0 0 00001706 EB0B jmp short D_P_STRUC_L1 ;AN000; 2898 <1> 2899 <1> D_P_STRUC_L2: ;AN000; 2900 <1> ; .IF THEN ;AN020; 0 00001708 3C2F cmp AL,D_P_Switch ;AN000; 0 0000170A 7506 jne D_P_STRUC_L12 ;AN000; 2903 <1> 0 0000170C 2E800E[9303]40 OR byte [psdata_seg:D_P_Flags2],D_P_SW ;AN020;AC034;;could be valid switch, first char and is slash 2905 <1> ; .ENDIF ;AN020; 2906 <1> D_P_STRUC_L12: ;AN000; 0 00001712 F8 CLC ;AN020;CF=0 indicating first char 2908 <1> ; .ENDIF ;AN020; 2909 <1> D_P_STRUC_L1: ;AN000; 2910 <1> 0 00001713 C3 ret ;AN000; 2912 <1> D_P_Chk_Switch endp ;AN000; 2913 <1> ; PAGE ;AN000; 2914 <1> ;************************************************************************** 2915 <1> ; D_P_Chk_DBCS: 2916 <1> ; 2917 <1> ; Function: Check if a specified byte is in ranges of the DBCS lead bytes 2918 <1> ; 2919 <1> ; Input: 2920 <1> ; AL = Code to be examineed 2921 <1> ; 2922 <1> ; Output: 2923 <1> ; If CF is on then a lead byte of DBCS 2924 <1> ; 2925 <1> ; Use: INT 21h w/AH=63 2926 <1> ; 2927 <1> ; Vars: D_P_DBCSEV_Seg(RW), D_P_DBCSEV_Off(RW) 2928 <1> ;*************************************************************************** 2929 <1> D_P_Chk_DBCS PROC ;AN000; 2930 <1> ; 0 00001714 1E PUSH DS ;AN000; 0 00001715 56 PUSH SI ;AN000; 0 00001716 53 PUSH bx ;AN000; (tm11) 0 00001717 2E833E[9003]00 CMP word [psdata_seg:D_P_DBCSEV_SEG],0 ;AC034; ALREADY SET ? 0 0000171D 7527 JNE D_P_DBCS00 ;AN000; 2936 <1> 0 0000171F 50 PUSH AX ;AN000; 2938 <1> ; PUSH BX ;AN000; (tm11) 0 00001720 1E PUSH ds ;AN000; (tm11) 0 00001721 51 PUSH CX ;AN000; 0 00001722 52 PUSH DX ;AN000; 0 00001723 57 PUSH DI ;AN000; 0 00001724 55 PUSH BP ;AN000; 0 00001725 06 PUSH ES ;AN000; 0 00001726 31F6 XOR SI,SI ;AN000; 0 00001728 8EDE MOV DS,SI ;AN000; 0 0000172A B80063 MOV AX,D_P_DOS_GetEV ;AN000; GET DBCS EV CALL 0 0000172D CD21 INT 21H ;AN000; 2949 <1> 2950 <1> ; MOV AX,DS ;AN000; (tm11) 2951 <1> ; OR AX,AX ;AN000; (tm11) 0 0000172F 8CDB MOV bx,DS ;AN000; (tm11) 0 00001731 09DB OR bx,bx ;AN000; (tm11) 0 00001733 07 POP ES ;AN000; 0 00001734 5D POP BP ;AN000; 0 00001735 5F POP DI ;AN000; 0 00001736 5A POP DX ;AN000; 0 00001737 59 POP CX ;AN000; 2959 <1> ; POP BX ;AN000; (tm11) 0 00001738 1F POP ds ;AN000; (tm11) 0 00001739 58 POP AX ;AN000; 0 0000173A 7429 JE D_P_NON_DBCS ;AN000; 2963 <1> 2964 <1> D_P_DBCS02: ;AN000; 0 0000173C 2E8936[8E03] MOV [psdata_seg:D_P_DBCSEV_OFF],SI ;AC034; save EV offset 2966 <1> ; MOV psdata_seg:D_P_DBCSEV_SEG,DS ;AC034; save EV segment 0 00001741 2E891E[9003] MOV [psdata_seg:D_P_DBCSEV_SEG],bx ;AC034; save EV segment (tm11) 2968 <1> D_P_DBCS00: ;AN000; 0 00001746 2E8B36[8E03] MOV SI,[psdata_seg:D_P_DBCSEV_OFF] ;AC034; load EV offset 0 0000174B 2E8E1E[9003] MOV DS,[psdata_seg:D_P_DBCSEV_SEG] ;AC034; and segment 2971 <1> 2972 <1> D_P_DBCS_LOOP: ;AN000; 0 00001750 833C00 CMP WORD PTR [SI],0 ;AN000; zero vector ? 0 00001753 7410 JE D_P_NON_DBCS ;AN000; then exit 2975 <1> 0 00001755 3A04 CMP AL,[SI] ;AN000; 0 00001757 7208 JB D_P_DBCS01 ;AN000; Check if AL is in 2978 <1> 0 00001759 3A4401 CMP AL,[SI+1] ;AN000; range of 0 0000175C 7703 JA D_P_DBCS01 ;AN000; the vector 2981 <1> 0 0000175E F9 STC ;AN000; if yes, indicate DBCS and exit 0 0000175F EB05 JMP short D_P_DBCS_EXIT ;AN000; 2984 <1> 2985 <1> D_P_DBCS01: ;AN000; 0 00001761 46 INC SI ;AC035; add '2' to 0 00001762 46 INC SI ;AC035; SI reg 2988 <1> ;AN000; get next vector 2989 <1> ;(changed ;AC035;) ADD SI,2 ;AN000; get next vector 0 00001763 EBEB JMP short D_P_DBCS_LOOP ;AN000; loop until zero vector found 2991 <1> 2992 <1> D_P_NON_DBCS: ;AN000; 0 00001765 F8 CLC ;AN000; indicate SBCS 2994 <1> D_P_DBCS_EXIT: ;AN000; 0 00001766 5B POP bx ;AN000; (tm11) 0 00001767 5E POP SI ;AN000; 0 00001768 1F POP DS ;AN000; 0 00001769 C3 RET ;AN000; 2999 <1> D_P_Chk_DBCS ENDP ;AN000; 446 ;=== Pop trace listing source 447 ;Control block definitions for PARSER. 448 ;--------------------------------------------------- 449 ; BUFFER = [n | n,m] {/E} 450 451 Buf_Parms label byte ;AN000; 0 0000176A [4F0C] dw Buf_Parmsx ;AN000; 0 0000176C 01 db 1 ;AN000; An extra delimeter list 0 0000176D 01 db 1 ;AN000; length is 1 0 0000176E 3B db SEMICOLON ;AN000; 456 457 Buf_Parmsx label byte ;AN000; 0 0000176F 0102 db 1,2 ;AN000; Min 1, Max 2 positional 0 00001771 [590C] dw Buf_Pos1 ;AN000; 0 00001773 [6D0C] dw Buf_Pos2 ;AN000; 0 00001775 01 db 1 ;AN000; 1 switch 0 00001776 [810C] dw SW_X_Ctrl ;AN000;AN025; /X control 0 00001778 00 db 0 ;AN000; no keywords 464 465 Buf_Pos1 label word ;AN000; 0 00001779 0080 dw 8000h ;AN000; Numeric value 0 0000177B 0000 dw 0 ;AN000; no function 0 0000177D [940C] dw Result_Val ;AN000; Result value buffer 0 0000177F [620C] dw Buf_Range_1 ;AN000; value list 0 00001781 00 db 0 ;AN000; no switches/keywords 471 472 Buf_Range_1 label byte ;AN000; value definition 0 00001782 01 db 1 ;AN000; range definition 0 00001783 01 db 1 ;AN000; 1 definition of range 0 00001784 01 db 1 ;AN000; item tag for this range 0 00001785 0100000010270000 dd 1,10000 ;AN000; from 1 to 10000 477 478 Buf_Pos2 label word ;AN000; 0 0000178D 0180 dw 8001h ;AN000; Numeric value, Optional 0 0000178F 0000 dw 0 ;AN000; no function 0 00001791 [940C] dw Result_Val ;AN000; Result value buffer 0 00001793 [760C] dw Buf_Range_2 ;AN000; value list 0 00001795 00 db 0 ;AN000; no switches/keywords 484 485 Buf_Range_2 label byte ;AN000; value definition 0 00001796 01 db 1 ;AN000; range definition 0 00001797 01 db 1 ;AN000; 1 definition of range 0 00001798 01 db 1 ;AN000; item tag for this range 0 00001799 0000000008000000 dd 0,8 ;AN000; from 0 to 8. 490 491 SW_X_Ctrl label word ;AN000;AN025; 0 000017A1 0000 dw 0 ;AN000; no matching flag 0 000017A3 0000 dw 0 ;AN000; no function 0 000017A5 [940C] dw Result_Val ;AN000; return value 0 000017A7 [930C] dw NoVal ;AN000; no value definition 0 000017A9 01 db 1 ;AN000; # of switches 497 Switch_X label byte ;AN000;AN025; 0 000017AA 2F5800 db '/X',0 ;AN000;AN025; 499 ;local variables 0 000017AD 0000 P_Buffers dw 0 ;AN000; 0 000017AF 0000 P_H_Buffers dw 0 ;AN000; 0 000017B1 00 P_Buffer_Slash_X db 0 ;AN000;AN025; 0 000017B2 00 Buffer_Pre_Scan db 0 ;AN030; 504 505 ;Common definitions ------------- 0 000017B3 00 NoVal db 0 ;AN000; 507 508 Result_Val label byte ;AN000; 0 000017B4 ?? db ? ;AN000; type returned 0 000017B5 ?? db ? ;AN000; item tag returned 0 000017B6 ???? dw ? ;AN000; ES:offset of the switch defined 512 RV_Byte label byte ;AN000; 513 RV_Dword label dword ;AN000; 0 000017B8 ???????? dd ? ;AN000; value if number, or seg:offset to string. 515 ;-------------------------------- 516 517 ; BREAK = [ ON | OFF ] 518 519 Brk_Parms label byte ;AN000; 0 000017BC [A10C] dw Brk_Parmsx ;AN000; 0 000017BE 01 db 1 ;AN000; An extra delimeter list 0 000017BF 01 db 1 ;AN000; length is 1 0 000017C0 3B db SEMICOLON ;AN000; 524 525 Brk_Parmsx label byte ;AN000; 0 000017C1 0101 db 1,1 ;AN000; Min 1, Max 1 positional 0 000017C3 [A70C] dw Brk_Pos ;AN000; 0 000017C5 00 db 0 ;AN000; no switches 0 000017C6 00 db 0 ;AN000; no keywords 530 531 Brk_Pos label word ;AN000; 0 000017C7 0020 dw 2000h ;AN000; Simple string 0 000017C9 0000 dw 0 ;AN000; No functions 0 000017CB [940C] dw Result_Val ;AN000; 0 000017CD [B00C] dw On_Off_String ;AN000; ON,OFF string descriptions 0 000017CF 00 db 0 ;AN000; no keyword/switch synonyms 537 538 On_Off_String label byte ;AN000; 0 000017D0 03 db 3 ;AN000; signals that there is a string choice 0 000017D1 00 db 0 ;AN000; no range definition 0 000017D2 00 db 0 ;AN000; no numeric values choice 0 000017D3 02 db 2 ;AN000; 2 strings for choice 0 000017D4 01 db 1 ;AN000; the 1st string tag 0 000017D5 [BA0C] dw On_String ;AN000; 0 000017D7 02 db 2 ;AN000; the 2nd string tag 0 000017D8 [BD0C] dw Off_String ;AN000; 547 0 000017DA 4F4E00 On_String db "ON",0 ;AN000; 0 000017DD 4F464600 Off_String db "OFF",0 ;AN000; 550 ;local variable 0 000017E1 00 P_Ctrl_Break db 0 ;AN000; local variable 552 553 ;-------------------------------- 554 555 ; COUNTRY = n {m {path}} 556 ; or 557 ; COUNTRY = n,,path 558 559 Cntry_Parms label byte ;AN000; 0 000017E2 [C70C] dw Cntry_Parmsx ;AN000; 0 000017E4 01 db 1 ;AN000; An extra delimeter list 0 000017E5 01 db 1 ;AN000; length is 1 0 000017E6 3B db SEMICOLON ;AN000; 564 565 Cntry_Parmsx label byte ;AN000; 0 000017E7 0103 db 1,3 ;AN000; Min 1, Max 3 positional 0 000017E9 [D10C] dw Cntry_Pos1 ;AN000; 0 000017EB [E50C] dw Cntry_Pos2 ;AN000; 0 000017ED [EE0C] dw Cntry_Pos3 ;AN000; 0 000017EF 00 db 0 ;AN000; no switches 0 000017F0 00 db 0 ;AN000; no keywords 572 573 Cntry_Pos1 label word ;AN000; control definition for positional 1 0 000017F1 0080 dw 8000h ;AN000; Numeric value 0 000017F3 0000 dw 0 ;AN000; no functions 0 000017F5 [940C] dw Result_Val ;AN000; 0 000017F7 [DA0C] dw Cntry_Codepage_Range ;AN000; country id code range description 0 000017F9 00 db 0 ;AN000; no switch/keyword synonyms 579 580 Cntry_Codepage_Range label byte ;AN000; 0 000017FA 01 db 1 ;AN000; # of value definitions 0 000017FB 01 db 1 ;AN000; # of ranges 0 000017FC 01 db 1 ;AN000; Tag for this range 0 000017FD 01000000E7030000 dd 1,999 ;AN000; 585 586 Cntry_Pos2 label word ;AN000; control definition for positional 2 0 00001805 0180 dw 8001h ;AN000; Numeric value, optional 0 00001807 0000 dw 0 ;AN000; no functions 0 00001809 [940C] dw Result_Val ;AN000; 0 0000180B [DA0C] dw Cntry_Codepage_Range ;AN000; code page range descriptions. 0 0000180D 00 db 0 ;AN000; no switch/keyword synonyms 592 593 Cntry_Pos3 label word ;AN000; control definition for positional 3 0 0000180E 0102 dw 0201h ;AN000; File spec, optional 0 00001810 0000 dw 0 ;AN000; No functions. Don't need to CAP. 0 00001812 [940C] dw Result_Val ;AN000; 0 00001814 [930C] dw NoVal ;AN000; no value list 0 00001816 00 db 0 ;AN000; no switch/keyword synonyms 599 600 ;Local variables 0 00001817 0000 P_Cntry_Code dw 0 ;AN000; 0 00001819 0000 P_Code_Page dw 0 ;AN000; 603 604 ;-------------------------------- 605 606 ; FILES = n 607 608 Files_Parms label byte ;AN000; 0 0000181B [000D] dw Files_Parmsx ;AN000; 0 0000181D 01 db 1 ;AN000; An extra delimeter list 0 0000181E 01 db 1 ;AN000; length is 1 0 0000181F 3B db SEMICOLON ;AN000; 613 614 Files_Parmsx label byte ;AN000; 0 00001820 0101 db 1,1 ;AN000; Min 1, Max 1 positional 0 00001822 [060D] dw Files_Pos ;AN000; 0 00001824 00 db 0 ;AN000; no switches 0 00001825 00 db 0 ;AN000; no keywords 619 620 Files_Pos label byte ;AN000; 0 00001826 0080 dw 8000h ;AN000; Numeric value 0 00001828 0000 dw 0 ;AN000; no functions 0 0000182A [940C] dw Result_Val ;AN000; 0 0000182C [0F0D] dw Files_Range ;AN000; Files range description 0 0000182E 00 db 0 ;AN000; no switch/keyword synonyms 626 627 Files_Range label byte ;AN000; 0 0000182F 01 db 1 ;AN000; # of value definitions 0 00001830 01 db 1 ;AN000; # of ranges 0 00001831 01 db 1 ;AN000; Tag for this range 0 00001832 08000000FF000000 dd 8,255 ;AN000; 632 ;local variable 0 0000183A 00 P_Files db 0 ;AN000; 634 635 ;-------------------------------- 636 637 ; FCBS = n,m 638 639 FCBS_Parms label byte ;AN000; 0 0000183B [200D] dw FCBS_Parmsx ;AN000; 0 0000183D 01 db 1 ;AN000; An extra delimeter list 0 0000183E 01 db 1 ;AN000; length is 1 0 0000183F 3B db SEMICOLON ;AN000; 644 645 FCBS_Parmsx label byte ;AN000; 0 00001840 0202 db 2,2 ;AN000; Min 2, Max 2 positional 0 00001842 [280D] dw FCBS_Pos_1 ;AN000; 0 00001844 [3C0D] dw FCBS_Pos_2 ;AN000; 0 00001846 00 db 0 ;AN000; no switches 0 00001847 00 db 0 ;AN000; no keywords 651 652 FCBS_Pos_1 label byte ;AN000; 0 00001848 0080 dw 8000h ;AN000; Numeric value 0 0000184A 0000 dw 0 ;AN000; no functions 0 0000184C [940C] dw Result_Val ;AN000; 0 0000184E [310D] dw FCBS_Range ;AN000; FCBS range descriptions 0 00001850 00 db 0 ;AN000; no switch/keyword synonyms 658 659 FCBS_Range label byte ;AN000; 0 00001851 01 db 1 ;AN000; # of value definitions 0 00001852 01 db 1 ;AN000; # of ranges 0 00001853 01 db 1 ;AN000; Tag for this range 0 00001854 01000000FF000000 dd 1,255 ;AN000; 664 665 FCBS_Pos_2 label byte ;AN000; 0 0000185C 0080 dw 8000h ;AN000; Numeric value 0 0000185E 0000 dw 0 ;AN000; no functions 0 00001860 [940C] dw Result_Val ;AN000; 0 00001862 [450D] dw FCBS_Keep_Range ;AN000; FCBS KEEP range descriptions 0 00001864 00 db 0 ;AN000; no switch/keyword synonyms 671 672 FCBS_Keep_Range label byte ;AN000; 0 00001865 01 db 1 ;AN000; # of value definitions 0 00001866 01 db 1 ;AN000; # of ranges 0 00001867 01 db 1 ;AN000; Tag for this range 0 00001868 00000000FF000000 dd 0,255 ;AN000; 677 678 ;local variable 0 00001870 00 P_Fcbs db 0 ;AN000; 0 00001871 00 P_Keep db 0 ;AN000; 681 ;-------------------------------- 682 683 ; LASTDRIVE = x 684 685 LDRV_Parms label byte ;AN000; 0 00001872 [570D] dw LDRV_Parmsx ;AN000; 0 00001874 01 db 1 ;AN000; An extra delimeter list 0 00001875 01 db 1 ;AN000; length is 1 0 00001876 3B db SEMICOLON ;AN000; 690 691 LDRV_Parmsx label byte ;AN000; 0 00001877 0101 db 1,1 ;AN000; Min 1, Max 1 positional 0 00001879 [5D0D] dw LDRV_Pos ;AN000; 0 0000187B 00 db 0 ;AN000; no switches 0 0000187C 00 db 0 ;AN000; no keywords 696 697 LDRV_Pos label byte ;AN000; 0 0000187D 1001 dw 0110h ;AN000; Drive only, Ignore colon. 0 0000187F 1000 dw 0010h ;AN000; Remove colon at end 0 00001881 [940C] dw Result_Val ;AN000; 0 00001883 [930C] dw NoVal ;AN000; No value list 0 00001885 00 db 0 ;AN000; no switch/keyword synonyms 703 704 ;local variable 0 00001886 00 P_Ldrv db 0 ;AN000; 706 ;-------------------------------- 707 708 ; STACKS = n,m 709 710 STKS_Parms label byte ;AN000; 0 00001887 [6C0D] dw STKS_Parmsx ;AN000; 0 00001889 01 db 1 ;AN000; An extra delimeter list 0 0000188A 01 db 1 ;AN000; length is 1 0 0000188B 3B db SEMICOLON ;AN000; 715 716 STKS_Parmsx label byte ;AN000; 0 0000188C 0202 db 2,2 ;AN000; Min 2, Max 2 positional 0 0000188E [740D] dw STKS_Pos_1 ;AN000; 0 00001890 [880D] dw STKS_Pos_2 ;AN000; 0 00001892 00 db 0 ;AN000; no switches 0 00001893 00 db 0 ;AN000; no keywords 722 723 STKS_Pos_1 label byte ;AN000; 0 00001894 0080 dw 8000h ;AN000; Numeric value 0 00001896 0000 dw 0 ;AN000; no functions 0 00001898 [940C] dw Result_Val ;AN000; 0 0000189A [7D0D] dw STKS_Range ;AN000; number of stack range descriptions 0 0000189C 00 db 0 ;AN000; no switch/keyword synonyms 729 730 STKS_Range label byte ;AN000; 0 0000189D 01 db 1 ;AN000; # of value definitions 0 0000189E 01 db 1 ;AN000; # of ranges 0 0000189F 01 db 1 ;AN000; Tag for this range 0 000018A0 0000000040000000 dd 0,64 ;AN000; 735 736 STKS_Pos_2 label byte ;AN000; 0 000018A8 0080 dw 8000h ;AN000; Numeric value 0 000018AA 0000 dw 0 ;AN000; no functions 0 000018AC [940C] dw Result_Val ;AN000; 0 000018AE [910D] dw STK_SIZE_Range ;AN000; stack size range descriptions 0 000018B0 00 db 0 ;AN000; no switch/keyword synonyms 742 743 STK_SIZE_Range label byte ;AN000; 0 000018B1 01 db 1 ;AN000; # of value definitions 0 000018B2 01 db 1 ;AN000; # of ranges 0 000018B3 01 db 1 ;AN000; Tag for this range 0 000018B4 0000000000020000 dd 0,512 ;AN000; 748 ;local variables 0 000018BC 0000 P_Stack_Count dw 0 ;AN000; 0 000018BE 0000 P_Stack_Size dw 0 ;AN000; 751 752 ;-------------------------------- 753 754 ; MULTITRACK = [ ON | OFF ] 755 756 MTrk_Parms label byte ;AN002; 0 000018C0 [A50D] dw MTrk_Parmsx ;AN002; 0 000018C2 01 db 1 ;AN002; An extra delimeter list 0 000018C3 01 db 1 ;AN002; length is 1 0 000018C4 3B db SEMICOLON ;AN002; 761 762 MTrk_Parmsx label byte ;AN002; 0 000018C5 0101 db 1,1 ;AN002; Min 1, Max 1 positional 0 000018C7 [AB0D] dw MTrk_Pos ;AN002; 0 000018C9 00 db 0 ;AN002; no switches 0 000018CA 00 db 0 ;AN002; no keywords 767 768 MTrk_Pos label word ;AN002; 0 000018CB 0020 dw 2000h ;AN002; Simple string 0 000018CD 0000 dw 0 ;AN002; No functions 0 000018CF [940C] dw Result_Val ;AN002; 0 000018D1 [B00C] dw On_Off_String ;AN002; ON,OFF string descriptions 0 000018D3 00 db 0 ;AN002; no keyword/switch synonyms 774 775 ;local variables 0 000018D4 00 P_Mtrk db 0 ;AN002; 777 ;-------------------------------- 778 779 ; CPSW = [ ON | OFF ] 780 781 CPSW_Parms label byte ;AN002; 0 000018D5 [BA0D] dw CPSW_Parmsx ;AN002; 0 000018D7 01 db 1 ;AN002; An extra delimeter list 0 000018D8 01 db 1 ;AN002; length is 1 0 000018D9 3B db SEMICOLON ;AN002; 786 787 CPSW_Parmsx label byte ;AN002; 0 000018DA 0101 db 1,1 ;AN002; Min 1, Max 1 positional 0 000018DC [C00D] dw CPSW_Pos ;AN002; 0 000018DE 00 db 0 ;AN002; no switches 0 000018DF 00 db 0 ;AN002; no keywords 792 793 CPSW_Pos label word ;AN002; 0 000018E0 0020 dw 2000h ;AN002; Simple string 0 000018E2 0000 dw 0 ;AN002; No functions 0 000018E4 [940C] dw Result_Val ;AN002; 0 000018E6 [B00C] dw On_Off_String ;AN002; ON,OFF string descriptions 0 000018E8 00 db 0 ;AN002; no keyword/switch synonyms 799 800 ;local variables 0 000018E9 00 P_CPSW db 0 ;AN002; 802 803 ;-------------------------------- 804 ; SWITCHES=/K 805 806 Swit_Parms label byte ;AN019; 0 000018EA [CF0D] dw Swit_Parmsx ;AN019; 0 000018EC 01 db 1 ;AN019; An extra delimeter list 0 000018ED 01 db 1 ;AN019; length is 1 0 000018EE 3B db SEMICOLON ;AN019; 811 812 Swit_Parmsx label byte ;AN019; 0 000018EF 0000 db 0,0 ;AN019; No positionals 0 000018F1 01 db 1 ;AN019; 1 switch for now. 0 000018F2 [D50D] dw Swit_K_Ctrl ;AN019; /K control 0 000018F4 00 db 0 ;AN019; no keywords 817 818 Swit_K_Ctrl label word ;AN019; 0 000018F5 0000 dw 0 ;AN019; no matching flag 0 000018F7 0000 dw 0 ;AN019; no function 0 000018F9 [940C] dw Result_Val ;AN019; return value 0 000018FB [930C] dw NoVal ;AN019; no value definition 0 000018FD 01 db 1 ;AN019; # of switches 824 Swit_K label byte ;AN019; 0 000018FE 2F4B00 db '/K',0 ;AN019; 826 ;local variables 0 00001901 00 P_Swit_K db 0 ;AN019; 828 0 00001902 00 no_config_file: db 0 830 831 ;****************************************************************************** 832 833 %if 0 834 %macro debugnumber 1 835 push ax 836 mov ax, %1 837 call display_debugnumber 838 pop ax 839 %endmacro 840 841 display_debugnumber: 842 pushf 843 push bx 844 push bp 845 push ax 846 mov ah, 0Eh 847 mov bx, 7 848 int 10h 849 pop ax 850 push ax 851 xchg al, ah 852 test al, al 853 jz .nohigh 854 mov ah, 0Eh 855 mov bx, 7 856 int 10h 857 .nohigh: 858 pop ax 859 pop bp 860 pop bx 861 popf 862 retn 863 %else 864 %macro debugnumber 1 865 %endmacro 866 %endif 867 868 DOCONF: 869 assume ds:nothing, es:nothing, ss:nothing 870 debugnumber '0' 0 00001903 0E PUSH CS 0 00001904 1F POP DS 873 ASSUME DS:SYSINITGROUP 874 875 CHAR_OPER equ Char_Oper ; NASM port equate 0 00001905 B80037 MOV AX,(CHAR_OPER << 8) ;GET SWITCH CHARACTER 0 00001908 CD21 INT 21H 0 0000190A 8816[0100] MOV [COMMAND_LINE+1],DL ; Set in default command line 879 880 extern CONFIG_pointers 0 0000190E BE[FEFF] mov si, CONFIG_pointers - 2 ; -> at command line name of prior 882 .loop: 0 00001911 AD lodsw ; skip command line name 0 00001912 AD lodsw ; skip function pointer 0 00001913 40 inc ax ; is it -1 ? 0 00001914 AD lodsw ; (load pointer) 0 00001915 741A jz No_Config_sys ; yes, end --> 0 00001917 85C0 test ax, ax ; pointer is zero ? 0 00001919 74F6 jz .loop ; yes, load next --> 0 0000191B 89C3 mov bx, ax 0 0000191D 803F00 cmp byte [bx], 0 ; pointer points at empty string ? 0 00001920 74EF je .loop ; yes, load next --> 0 00001922 92 xchg dx, ax 894 OPEN equ Open ; NASM port equate 0 00001923 B8003D MOV AX,OPEN << 8 ;OPEN FILE "CONFIG.SYS" 0 00001926 F9 STC ;IN CASE OF INT 24 0 00001927 CD21 int 21h ; does open succeed ? 0 00001929 72E6 jc .loop ; no, try next --> 0 0000192B 8916[0A00] mov word [CONFIG_used], dx 0 0000192F EB55 JMP NOPROB ;PROBLEM WITH OPEN 901 902 No_Config_sys: ;AN028; 0 00001931 F616[E20D] not byte [no_config_file] 0 00001935 31C0 xor ax, ax 0 00001937 31D2 xor dx, dx ; = empty config 0 00001939 EB56 jmp continue_no_file 907 908 ENDCONF: 0 0000193B C3 return 910 911 0 0000193C BA[0000] BADOP: MOV DX,OFFSET BADOPM ;WANT TO PRINT COMMAND ERROR "Unrecognized command..." 0 0000193F E8[0000] invoke PRINT 0 00001942 E88A0E call Error_Line ;show "Error in CONFIG.SYS ..." . 0 00001945 E93A02 JMP COFF 916 917 Badop_p proc near ;AN000; 918 ;Same thing as BADOP, but will make sure to set DS register back to SYSINITSEG 919 ;and return back to the calller. 0 00001948 0E push cs 0 00001949 1F pop ds ;set ds to CONFIGSYS seg. 922 assume ds:SYSINITGROUP 923 badopm equ BADOPM ; NASM port label 0 0000194A BA[0000] mov dx, offset badopm 0 0000194D E8[0000] invoke PRINT 0 00001950 E87C0E call Error_Line 0 00001953 C3 ret 928 Badop_p endp 929 930 Badparm_p proc near ;AN007; 931 assume ds:nothing, es:nothing, ss:nothing 932 ;Show "Bad command or parameters - xxxxxx" 933 ;In Badparm_seg, Badparm_off -> xxxxx 934 ; 0 00001954 2E803E[920C]01 cmp byte [cs:Buffer_Pre_Scan], 1 ;AN030; Pre scanning Buffers ... /X? 0 0000195A 7429 je BadParmp_Ret ;AN030; then do not show any message. 0 0000195C 1E push ds ;AN007; 0 0000195D 52 push dx ;AN007; 0 0000195E 56 push si ;AN007; 940 0 0000195F 0E push cs ;AN007; 0 00001960 1F pop ds ;AN007; 943 assume ds:SYSINITGROUP 0 00001961 BA[0000] mov dx, offset Badparm ;AN007; 0 00001964 E8[0000] invoke PRINT ;AN007;"Bad command or parameters - " 946 Badparm_ptr equ Badparm_Ptr ; NASM port label 0 00001967 C536[0400] lds si, [Badparm_ptr] ;AN007; 948 assume ds:nothing 949 Badparm_Prt: ;AN007;print "xxxx" until CR. 0 0000196B 8A14 mov dl, byte ptr [si] ;AN007; 951 STD_CON_OUTPUT equ Std_Con_Output ; NASM port equate 0 0000196D B402 mov ah,STD_CON_OUTPUT ;AN007; 0 0000196F CD21 int 21h ;AN007; 0 00001971 46 inc si ;AN007; 0 00001972 80FA0D cmp dl, CR ;AN007; 0 00001975 75F4 jne Badparm_Prt ;AN007; 0 00001977 0E push cs ;AN007; 0 00001978 1F pop ds ;AN007; 959 assume ds:SYSINITGROUP 0 00001979 BA[0000] mov dx, offset CRLFM ;AN007; 0 0000197C E8[0000] invoke PRINT ;AN007; 0 0000197F E84D0E call Error_Line ;AN007; 0 00001982 5E pop si ;AN007; 0 00001983 5A pop dx ;AN007; 0 00001984 1F pop ds ;AN007; 966 assume ds:nothing 967 BadParmp_Ret: ;AN030; 0 00001985 C3 ret ;AN007; 969 Badparm_p endp 970 971 NOPROB: ;GET FILE SIZE (NOTE < 64K!!) 972 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001986 89C3 MOV BX,AX 0 00001988 31C9 XOR CX,CX 0 0000198A 31D2 XOR DX,DX 976 LSEEK equ LSeek ; NASM port equate 0 0000198C B80242 MOV AX,(LSEEK << 8) | 2 0 0000198F CD21 INT 21H 979 980 continue_no_file: 981 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001991 BEFEFE mov si, 64 * 1024 - 1 - 1 - 256 ; maximum size 983 ; 1 = offset of end <= 0FFFFh 984 ; 1 = linebreak we'll append 985 ; 256 = maximum length of APPEND/PREPEND kernel command line names 0 00001994 85D2 test dx, dx ; >= 64 KiB ? 0 00001996 7504 jnz .overflow ; yes --> 0 00001998 39F0 cmp ax, si 0 0000199A 7608 jbe .fine 990 .overflow: 0 0000199C BA[0000] mov dx, config_overflow 0 0000199F E8[0000] invoke PRINT 0 000019A2 89F0 mov ax, si 994 .fine: 0 000019A4 A3[0000] MOV [COUNT],AX ; true file size to read 996 0 000019A7 83C001 add ax, 1 998 config_size equ Config_Size ; NASM port label 0 000019AA A3[0000] mov [config_size], ax ;save the size of config.sys file. 1000 0 000019AD D006[E20D] rol byte [no_config_file], 1 0 000019B1 7207 jc @F 1003 0 000019B3 31D2 XOR DX,DX 0 000019B5 B80042 MOV AX,LSEEK << 8 ;Reset pointer to beginning of file 0 000019B8 CD21 INT 21H 1007 1008 @@: 0 000019BA 57 push di 0 000019BB 53 push bx 0 000019BC BB[A40E] mov bx, .add 0 000019BF E8B000 call parse_configuration_command_line 0 000019C2 EB05 jmp @F 1014 1015 .add: 0 000019C4 010E[0000] add [config_size], cx ; add in PREPEND= / APPEND= line length 0 000019C8 C3 retn 1018 1019 @@: 0 000019C9 5B pop bx 0 000019CA 5F pop di 1022 0 000019CB 57 push di 0 000019CC 53 push bx 1025 0 000019CD A1[0000] MOV AX,[config_size] 0 000019D0 BE[0000] mov si, alloc_initconfig 0 000019D3 E8[0000] call allocate_temporary_block 0 000019D6 8C06[0000] MOV [config_block], es ; Config starts here. New CONBOT value. 1030 ; CALL TEMPCDS ; Finally get CDS to "safe" location 1031 ASSUME DS:NOTHING,ES:NOTHING 1032 0 000019DA 0E push cs 0 000019DB 1F pop ds 1035 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 000019DC 8B16[0000] MOV DX,[config_block] 0 000019E0 8EC2 MOV ES,DX 1038 assume es:nothing 0 000019E2 31D2 XOR DX,DX ; es:dx -> config buffer 1040 0 000019E4 BB[CC0E] mov bx, .prepend 0 000019E7 E88800 call parse_configuration_command_line 0 000019EA EB14 jmp @F 1044 1045 .prepend: 1046 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 000019EC 81FF[0000] cmp di, nameprepend 0 000019F0 750D jne .retn 0 000019F2 29CE sub si, cx 0 000019F4 87D7 xchg dx, di 0 000019F6 F3A4 rep movsb 0 000019F8 26C645FF0A mov byte [es:di - 1], 10 ; LF 0 000019FD 87D7 xchg dx, di 1054 .retn: 0 000019FF C3 retn 1056 1057 @@: 0 00001A00 5B pop bx 0 00001A01 5F pop di 1060 0 00001A02 06 push es 0 00001A03 1F pop ds ; ds:dx -> where to read config file 1063 assume ds:nothing 0 00001A04 2E8B0E[0000] MOV CX,[cs:COUNT] 0 00001A09 31C0 xor ax, ax ; NC, ax = 0 0 00001A0B E305 jcxz @F 1067 READ equ Read ; NASM port equate 0 00001A0D B43F MOV AH,READ 0 00001A0F F9 STC ;IN CASE OF INT 24 0 00001A10 CD21 INT 21H ;Function request 1071 @@: 0 00001A12 9C PUSHF 1073 ; 1074 ; Find the EOF mark in the file. If present, then trim length. 1075 0 00001A13 505751 SaveReg 0 00001A16 91 xchg cx, ax ; cx = length actually read 0 00001A17 B01A MOV AL,1Ah ; eof mark 0 00001A19 89D7 MOV DI,DX ; point ro buffer 0 00001A1B E305 JCXZ PutEOL ; no chars 0 00001A1D F2AE REPNZ SCASB ; find end 0 00001A1F 7501 JNZ PutEOL ; none found and count exahusted 1083 ; 1084 ; We found a 1A. Back up 1085 ; 0 00001A21 4F DEC DI ; backup past 1A 1087 ; 1088 ; Just for the halibut, stick in an extra EOL 1089 ; 1090 PutEOL: 0 00001A22 B00A MOV AL,LF 0 00001A24 AA STOSB ; ! LF only 1093 0 00001A25 0E push cs 0 00001A26 1F pop ds 1096 assume ds:SYSINITGROUP 0 00001A27 89FA mov dx, di 0 00001A29 53 push bx 0 00001A2A BB[120F] mov bx, .append 0 00001A2D E84200 call parse_configuration_command_line 0 00001A30 EB14 jmp @F 1102 1103 .append: 1104 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001A32 81FF[0000] cmp di, nameappend 0 00001A36 750D jne .retn 0 00001A38 29CE sub si, cx ; -> content 0 00001A3A 87D7 xchg dx, di 0 00001A3C F3A4 rep movsb ; store in buffer 0 00001A3E 26C645FF0A mov byte [es:di - 1], 10 ; LF 0 00001A43 87D7 xchg dx, di 1112 .retn: 0 00001A45 C3 retn 1114 1115 @@: 0 00001A46 5B pop bx 0 00001A47 87D7 xchg dx, di ; di = size of configuration 1118 1119 Count equ COUNT ; NASM port label 0 00001A49 893E[0000] MOV [Count],DI ; new count 1121 ; 1122 ; Restore registers 1123 ; 0 00001A4D 595F58 RestoreReg 1125 1126 ASSUME DS:SYSINITSEG 0 00001A50 50 PUSH AX 0 00001A51 2ED006[E20D] rol byte [cs:no_config_file], 1 0 00001A56 7204 jc @F 1130 CLOSE equ Close ; NASM port equate 0 00001A58 B43E MOV AH,CLOSE 0 00001A5A CD21 INT 21H 1133 @@: 0 00001A5C 58 POP AX 0 00001A5D 9D POPF 0 00001A5E 7207 JC CONFERR ;IF NOT WE'VE GOT A PROBLEM 0 00001A60 39C1 CMP CX,AX 0 00001A62 7503E9BF00 JZ GETCOM ;COULDN'T READ THE FILE 1139 CONFERR: 1140 assume ds:nothing, es:nothing, ss:nothing 0 00001A67 2E8B16[0A00] MOV DX,[cs:CONFIG_used] ;WANT TO PRINT CONFIG ERROR 0 00001A6C E8[0000] CALL BADFIL 0 00001A6F E9C9FE ENDCONV:JMP ENDCONF 1144 1145 extern nameprepend, nameappend, kernelcommandline, kernelcommandline.end 1146 1147 ; INP: ds = cs 1148 ; ds:kernelcommandline -> contents 1149 ; word [kernelcommandline.end] -> end 1150 ; nameprepend, nameappend 1151 ; bx = callback near function 1152 ; CHG: ax, si, cx, di 1153 ; Callback called with: 1154 ; INP: ds:si -> past name's content terminator 1155 ; cx = length of content including terminator 1156 ; es = unchanged 1157 ; dx = unchanged 1158 ; di = nameprepend or nameappend, whichever matched 1159 ; CHG: cx, ax 1160 ; REM: changes of dx passed back to caller 1161 parse_configuration_command_line: 1162 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001A72 BE[0000] mov si, kernelcommandline 1164 .loopcommand: 0 00001A75 A8 db __TEST_IMM8 ; skip inc 1166 @@: 0 00001A76 46 inc si 0 00001A77 803C20 cmp byte [si], 32 0 00001A7A 74FA je @B 0 00001A7C 803C09 cmp byte [si], 9 0 00001A7F 74F5 je @B 1172 0 00001A81 BF[0000] mov di, nameprepend ; -> first name 1174 .loopname: 0 00001A84 57 push di 0 00001A85 56 push si 1177 .comparename: 0 00001A86 AC lodsb 0 00001A87 3C00 cmp al, 0 0 00001A89 7427 je .next 0 00001A8B 3C61 cmp al, 'a' 0 00001A8D 7206 jb @F 0 00001A8F 3C7A cmp al, 'z' 0 00001A91 7702 ja @F 0 00001A93 2C20 sub al, 20h 1186 @@: 0 00001A95 06 push es 0 00001A96 0E push cs 0 00001A97 07 pop es 1190 assume es:SYSINITGROUP 0 00001A98 AE scasb 0 00001A99 07 pop es 1193 assume es:nothing 0 00001A9A 7516 jne .next 0 00001A9C 803D00 cmp byte [di], 0 0 00001A9F 75E5 jne .comparename 0 00001AA1 AC lodsb 0 00001AA2 3C00 cmp al, 0 0 00001AA4 741A je .found 0 00001AA6 3C20 cmp al, 32 0 00001AA8 7416 je .found 0 00001AAA 3C09 cmp al, 9 0 00001AAC 7412 je .found 0 00001AAE 3C3D cmp al, '=' 0 00001AB0 740E je .found 1206 .next: 0 00001AB2 5E pop si 0 00001AB3 5F pop di 0 00001AB4 81FF[0000] cmp di, nameprepend 0 00001AB8 752D jne .donename 0 00001ABA BF[0000] mov di, nameappend 0 00001ABD EBC5 jmp .loopname 1213 1214 @@: 0 00001ABF AC lodsb 1216 .found: 0 00001AC0 3C20 cmp al, 32 0 00001AC2 74FB je @B 0 00001AC4 3C09 cmp al, 9 0 00001AC6 74F7 je @B 0 00001AC8 3C3D cmp al, '=' 0 00001ACA 7501 jne @FF 1223 @@: 0 00001ACC AC lodsb 1225 @@: 0 00001ACD 3C20 cmp al, 32 0 00001ACF 74FB je @BB 0 00001AD1 3C09 cmp al, 9 0 00001AD3 74F7 je @BB 1230 0 00001AD5 4E dec si ; -> content 0 00001AD6 89F1 mov cx, si 1233 .findlen: 0 00001AD8 AC lodsb 0 00001AD9 84C0 test al, al 0 00001ADB 75FB jnz .findlen 0 00001ADD F7D9 neg cx 0 00001ADF 01F1 add cx, si ; = length, including terminator 0 00001AE1 5F pop di ; discard si 0 00001AE2 5F pop di ; restore di 0 00001AE3 FFD3 call bx 0 00001AE5 EB05 jmp .nextcommand 1243 .donename: 1244 @@: 0 00001AE7 AC lodsb 0 00001AE8 3C00 cmp al, 0 0 00001AEA 75FB jne @B 1248 .nextcommand: 0 00001AEC 3B36[0000] cmp si, word [kernelcommandline.end] 0 00001AF0 7283 jb .loopcommand 0 00001AF2 C3 retn 1252 1253 1254 global get_config_size 1255 get_config_size: 1256 assume ds:nothing, es:nothing, ss:nothing 0 00001AF3 2EA1[0000] mov ax, [cs:Org_Count] 0 00001AF7 89C1 mov cx, ax 0 00001AF9 E8[0000] invoke ParaRound 0 00001AFC 93 xchg bx, ax 0 00001AFD C3 retn 1262 1263 1264 Multi_Pass: ;AN018;AN026; called to execute IFS=, INSTALL= commands 1265 assume ds:nothing, es:nothing, ss:nothing 0 00001AFE 0E push cs ;AN018; 0 00001AFF 1F pop ds ;AN018; 1268 assume ds:SYSINITGROUP 1269 Multi_Pass_id equ Multi_Pass_Id ; NASM port label 0 00001B00 803E[0000]0A cmp byte [Multi_Pass_id], 10 ;J.K. 1271 Endconv equ ENDCONV ; NASM port label 0 00001B05 7203E965FF jae Endconv ;J.K. Do nothing. Just return. 0 00001B0A 8E06[0000] mov es, word [config_block] ; => config 1274 assume es:nothing 0 00001B0E 8B36[0000] mov si, [Org_Count] ;AN018; 0 00001B12 8936[0000] mov [Count], si ;AN018; set Count 0 00001B16 31F6 xor si,si ;AN018; 1278 Chrptr equ CHRPTR ; NASM port label 0 00001B18 8936[0000] mov [Chrptr], si ;AN018; reset Chrptr, LineCount 0 00001B1C 8936[0000] mov [LineCount], si ;AN018; 1281 GetChr equ GETCHR ; NASM port label 0 00001B20 E8860C call GetChr ;AN018; 1283 Conflp equ CONFLP ; NASM port label 0 00001B23 EB1B jmp Conflp ;AN018; 0 00001B25 90 nop ; identicalise 1286 GETCOM: 0 00001B26 E8[0000] invoke ORGANIZE ;ORGANIZE THE FILE 0 00001B29 E8C7FF call get_config_size 0 00001B2C B44A mov ah, 4Ah 0 00001B2E CD21 int 21h 0 00001B30 1E push ds 0 00001B31 8CC0 mov ax, es 0 00001B33 48 dec ax 0 00001B34 8ED8 mov ds, ax 1295 assume ds:MCB 0 00001B36 C70601000800 mov word [mcbOwner], 8 0 00001B3C 1F pop ds 1298 assume ds:SYSINITGROUP 0 00001B3D E8690C CALL GETCHR 1300 0 00001B40 7303E92AFF CONFLP: JC ENDCONV 0 00001B45 E85C0D call Reset_DOS_Version ;AN024;AN026; Still need to reset version even IBMDOS handles this through 1303 ; function 4Bh call, since IBMDOS does not know when Load/Overlay call finishes. 1304 1305 %ifndef BUF2 1306 %IFN BUFFERFLAG 1307 EMS_Stub_handler equ EMS_Stub_Handler ; NASM port label 1308 call EMS_Stub_handler ;AN030; 1309 %ENDIF 1310 %endif 1311 0 00001B48 FF06[0000] inc word [LineCount] ;AN000; Increase LineCount. 0 00001B4C C606[920C]00 mov byte [Buffer_Pre_Scan], 0 ;AN030; Reset Buffer_Pre_Scan. 0 00001B51 C606[0000]00 mov byte [MultDeviceFlag],0 ;AN001; Reset MultDeviceFlag. 0 00001B56 C606[0300]00 mov byte [SetDevMarkFlag],0 ;AN004; Reset SetDevMarkFlag. 0 00001B5B 8326[1000]00 and word [devicehighdata], 0 0 00001B60 3C0A cmp al, LF ;AN000; LineFeed? 0 00001B62 7425 je Blank_Line ;AN000; then ignore this line. 0 00001B64 88C4 MOV AH,AL 0 00001B66 E8400C CALL GETCHR 1321 TryI equ TRYI ; NASM port label 0 00001B69 7325 jnc TryI ;AN000; 1323 Multi_Pass_ID equ Multi_Pass_Id ; NASM port label 0 00001B6B 803E[0000]00 cmp byte [Multi_Pass_ID], 0 0 00001B70 7503E9FAFE je Endconv 0 00001B75 803E[0000]02 cmp byte [Multi_Pass_ID], 2 ;AN026; 0 00001B7A 7203E9F0FE jae Endconv ;AN026;Do not show Badop again for multi_pass. 0 00001B7F E9BAFD JMP BADOP 1329 0 00001B82 0E COFF: PUSH CS 0 00001B83 1F POP DS 1332 assume ds:SYSINITGROUP 0 00001B84 E8[0000] invoke NEWLINE 0 00001B87 EBB7 JMP CONFLP 1335 Blank_Line: ;AN000; 1336 Getchr equ GETCHR ; NASM port label 0 00001B89 E81D0C call Getchr ;AN000; 0 00001B8C EBB2 jmp CONFLP ;AN000; 1339 1340 COFF_P: 0 00001B8E 0E push cs 0 00001B8F 1F pop ds 1343 1344 1345 ;J.K. 1/27/88 ;;;;;;;;;;;;;;;;;; 1346 ;To handle INSTALL= commands, we are going to use multi-pass. 1347 ;The first pass handles the other commands and only set Install_Flag when 1348 ;it finds any INSTALL command. The second pass will only handle the 1349 ;INSTALL= command. 1350 1351 ;------------------------------------------------------------------------------ 1352 ;INSTALL command 1353 ;------------------------------------------------------------------------------ 1354 TRYI: 1355 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001B90 803E[0000]FF cmp byte [Multi_Pass_Id], -1 0 00001B95 745F je Multi_Try_Compat 0 00001B97 803E[0000]00 cmp byte [Multi_Pass_Id], 0 ;AN029; the initial pass for XMAEM.SYS 0 00001B9C 7503E92401 je Multi_Try_XMAEM ;AN029; and BUFFERS= ... /X pre scan. 0 00001BA1 803E[0000]02 cmp byte [Multi_Pass_Id], 2 ;AN026; the second pass for IFS= ? 0 00001BA6 7503E94501 je Multi_Try_J ;AN026; 0 00001BAB 803E[0000]03 cmp byte [Multi_Pass_Id], 3 ;AN026; the third pass for INSTALL= ? 0 00001BB0 7503E97B01 je Multi_Try_I ;AN026; 0 00001BB5 803E[0000]04 cmp byte [Multi_Pass_Id], 4 ; pass for INSTALLLAST= ? 0 00001BBA 7503E93C01 je Multi_Try_I80 0 00001BBF 80FCE9 cmp ah, 'i' | 80h ; INSTALLLASTHIGH= command ? 0 00001BC2 742B je .install 0 00001BC4 80FCC9 cmp ah, 'I' | 80h ; INSTALLLAST= command ? 0 00001BC7 7426 je .install 0 00001BC9 80FC36 cmp ah, '6' ; INSTALLMIDHIGH= command ? 0 00001BCC 7421 je .install 0 00001BCE 80FC35 cmp ah, '5' ; INSTALLMID= command ? 0 00001BD1 741C je .install 0 00001BD3 D006[2C00] rol byte [installaslast_option], 1 0 00001BD7 7209 jc .notasfirst 0 00001BD9 D006[2B00] rol byte [installasfirst_option], 1 0 00001BDD 7303E9D901 jc TryB 1378 .notasfirst: 0 00001BE2 80FC69 cmp ah, 'i' ; INSTALLHIGH= command ? 0 00001BE5 7408 je .install 0 00001BE7 80FC49 cmp ah, 'I' ;AN018; INSTALL= command? 0 00001BEA 7403E9CC01 jne TryB ;AN018; the first pass is for normal operation. 1383 .install: 0 00001BEF 830E[0000]01 or word [Install_Flag], HAVE_INSTALL_CMD ;AN018; Set the flag 1385 coff equ COFF ; NASM port label 0 00001BF4 EB8C jmp coff ;AN018; and handles the next command 1387 1388 Multi_Try_Compat: 0 00001BF6 80FC32 cmp ah, '2' 0 00001BF9 7568 jne .not 0 00001BFB CC int3 0 00001BFC 90 nop 0 00001BFD 1E push ds 0 00001BFE 06 push es 0 00001BFF 56 push si 0 00001C00 06 push es 0 00001C01 1F pop ds 1398 assume ds:nothing 1399 .loop: 0 00001C02 E8B00C call skipcomma 0 00001C05 E81A0D call iseol? 0 00001C08 7453 je .done 0 00001C0A 4E dec si 0 00001C0B 0E push cs 0 00001C0C 07 pop es 1406 assume es:SYSINITGROUP 1407 0 00001C0D BB[3000] mov bx, compatoptionstable 1409 .loop_table: 0 00001C10 31C9 xor cx, cx 0 00001C12 2E8B5706 mov dx, [cs:bx + coNoMessage] 0 00001C16 85D2 test dx, dx 0 00001C18 7405 jz @F 0 00001C1A E8AB0C call isstring? 0 00001C1D 741A je .got_table 1416 @@: 0 00001C1F F7D1 not cx 0 00001C21 2E8B5708 mov dx, [cs:bx + coYesMessage] 0 00001C25 E8A00C call isstring? 0 00001C28 740F je .got_table 0 00001C2A 83C30A add bx, COMPATOPTION_size 0 00001C2D 81FB[EE00] cmp bx, compatoptionstable.end 0 00001C31 72DD jb .loop_table 1424 0 00001C33 5E pop si 0 00001C34 07 pop es 0 00001C35 1F pop ds 1428 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001C36 E903FD jmp BADOP 1430 1431 .got_table: 1432 assume es:SYSINITGROUP, ds:nothing, ss:nothing 0 00001C39 2E8B7F04 mov di, word [cs:bx + coAlwaysClear] 0 00001C3D 85FF test di, di 0 00001C3F 7404 jz @F 0 00001C41 2EC60500 mov byte [cs:di], 0 1437 @@: 0 00001C45 2EF6470201 testopt [cs:bx + coPriorSegment], 1 0 00001C4A 2E8B1F mov bx, word [cs:bx + coSetOrClear] 0 00001C4D 7505 jnz .got_dosdata 0 00001C4F 2E880F mov byte [cs:bx], cl 0 00001C52 EBAE jmp .loop 1443 1444 .got_dosdata: 0 00001C54 1E push ds 0 00001C55 E8[0000] call sysinit_get_ds_dosbiodata 1447 assume ds:DOSGROUP 0 00001C58 880F mov byte [bx], cl 0 00001C5A 1F pop ds 1450 assume ds:nothing 0 00001C5B EBA5 jmp .loop 1452 1453 .done: 0 00001C5D 5E pop si 0 00001C5E 07 pop es 0 00001C5F 1F pop ds 1457 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001C60 E91701 jmp Multi_Pass_Filter 1459 1460 .not: 1461 1462 Multi_Try_AMISNumber: 0 00001C63 80FC37 cmp ah, '7' 0 00001C66 755A jne .not 0 00001C68 1E push ds 0 00001C69 06 push es 0 00001C6A 56 push si 0 00001C6B 06 push es 0 00001C6C 1F pop ds 1470 assume ds:nothing 0 00001C6D E8[0000] call ldos_getnum 0 00001C70 7219 jc .error 0 00001C72 84F6 test dh, dh 0 00001C74 7515 jnz .error 1475 @@: 0 00001C76 AC lodsb 0 00001C77 3C20 cmp al, 32 0 00001C79 74FB je @B 0 00001C7B 3C09 cmp al, 9 0 00001C7D 74F7 je @B 0 00001C7F 3C0D cmp al, 13 0 00001C81 7420 je .done 0 00001C83 3C0A cmp al, 10 0 00001C85 741C je .done 0 00001C87 3C00 cmp al, 0 0 00001C89 7418 je .done 1487 .error: 0 00001C8B 5E pop si 0 00001C8C 07 pop es 0 00001C8D 1F pop ds 1491 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001C8E E9ABFC jmp BADOP 1493 1494 extern hexbyte, init2_disp_msg_asciz_cs_dx 1495 .inuse: 0 00001C91 0E push cs 0 00001C92 07 pop es 1498 assume es:SYSINITGROUP 0 00001C93 BF[6203] mov di, configmsg.amisnumberinuse.num 0 00001C96 88E0 mov al, ah 0 00001C98 E8[0000] call hexbyte 0 00001C9B BA[3603] mov dx, configmsg.amisnumberinuse 0 00001C9E E8[0000] call init2_disp_msg_asciz_cs_dx 0 00001CA1 EB19 jmp .skip 1505 1506 extern i2D.amisnumber 1507 .done: 1508 assume es:nothing 0 00001CA3 BE[0000] mov si, DOSENTRY 0 00001CA6 8EDE mov ds, si 1511 assume ds:DOSENTRYGROUP 0 00001CA8 3816[0000] cmp byte [i2D.amisnumber], dl 0 00001CAC 740E je .skip 0 00001CAE 88D4 mov ah, dl 0 00001CB0 B000 mov al, 0 0 00001CB2 CD2D int 2Dh 0 00001CB4 84C0 test al, al 0 00001CB6 75D9 jnz .inuse 0 00001CB8 8826[0000] mov byte [i2D.amisnumber], ah 1520 .skip: 0 00001CBC 5E pop si 0 00001CBD 07 pop es 0 00001CBE 1F pop ds 1524 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001CBF E9B800 jmp Multi_Pass_Filter 1526 1527 .not: 0 00001CC2 E9B500 jmp Multi_Pass_Filter 1529 1530 Multi_Try_XMAEM: ;AN029; 0 00001CC5 80FC64 cmp ah, 'd' 0 00001CC8 7405 je .devicehigh 0 00001CCA 80FC44 cmp ah, 'D' ;AN029; device= command? 0 00001CCD 7510 jne Multi_Try_Buff ;AN029; no skip it. 1535 .devicehigh: 0 00001CCF E89C0B call Chk_XMAEM ;AN029; is it for XMAEM.SYS? 1537 Multi_Pass_FIlter equ Multi_Pass_Filter ; NASM port label 0 00001CD2 7403E9A300 jnz Multi_Pass_FIlter ;AN029; no skip it. 0 00001CD7 26C644FFFF mov byte ptr [es:si-1], 0FFh ;AN029; mark this command as a Null command for the next pass. 1540 TryDJ equ TRYDJ ; NASM port label 0 00001CDC E91902 jmp TryDJ ;AN029; execute this command. 1542 Multi_Try_Buff: ;AN030; 0 00001CDF 80FC42 cmp ah, 'B' ;AN030; Buffers= command? 0 00001CE2 7403E99300 jne Multi_Pass_Filter ;AN030; 0 00001CE7 C606[920C]01 mov byte [Buffer_Pre_Scan], 1 ;AN030; Set Buffer_Pre_Scan 0 00001CEC E9CC00 jmp TryB ;AN030; TryB will set P_Buffer_Slash_X to non-zero value. 0 00001CEF 90 nop ; identicalise 1548 1549 Multi_Try_J: ;AN026; 0 00001CF0 80FC4A cmp ah, 'J' ;AN026; IFS= command? 0 00001CF3 7403E98200 jne Multi_Pass_Filter ;AN026; No. Ignore this. 1552 GotJ equ GOTJ ; NASM port label 0 00001CF8 E95E02 jmp GotJ ;AN026; Handles IFS= command. 1554 1555 Multi_Try_I80: 0 00001CFB 2ED006[2C00] rol byte [cs:installaslast_option], 1 0 00001D00 7317 jnc .notinstall 0 00001D02 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001D08 80FC69 cmp ah, 'i' 0 00001D0B 7507 jne @F 0 00001D0D 2EF616[2200] not byte [cs:devicehighflag] 0 00001D12 B449 mov ah, 'I' 1563 @@: 0 00001D14 80FC49 cmp ah, 'I' ; INSTALL= command? 0 00001D17 7451 je ..@run_install 1566 1567 .notinstall: 0 00001D19 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001D1F 80FCE9 cmp ah, 'i' | 80h 0 00001D22 7507 jne @F 0 00001D24 2EF616[2200] not byte [cs:devicehighflag] 0 00001D29 B4C9 mov ah, 'I' | 80h 1573 @@: 0 00001D2B 80FCC9 cmp ah, 'I' | 80h ; INSTALLLAST= command? 0 00001D2E EB3A jmp ..@run_install 1576 1577 Multi_Try_I: ;AN026; 0 00001D30 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001D36 80FC36 cmp ah, '6' 0 00001D39 7507 jne @F 0 00001D3B 2EF616[2200] not byte [cs:devicehighflag] 0 00001D40 B435 mov ah, '5' 1583 @@: 0 00001D42 80FC35 cmp ah, '5' ; INSTALLMID= command ? 0 00001D45 7423 je ..@run_install 1586 0 00001D47 2ED006[2C00] rol byte [cs:installaslast_option], 1 0 00001D4C 722C jc Multi_Pass_Filter 0 00001D4E 2ED006[2B00] rol byte [cs:installasfirst_option], 1 0 00001D53 7225 jc Multi_Pass_Filter 1591 0 00001D55 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001D5B 80FC69 cmp ah, 'i' 0 00001D5E 7507 jne @F 0 00001D60 2EF616[2200] not byte [cs:devicehighflag] 0 00001D65 B449 mov ah, 'I' 1597 @@: 0 00001D67 80FC49 cmp ah, 'I' ;AN026; INSTALL= command? 1599 ..@run_install: 0 00001D6A 750E jne Multi_Pass_Filter ;AN026; No. Ignore this. 0 00001D6C E8[0000] call Do_Install_Exec ;Install it. 1602 1603 extern init2_relocate_device 1604 0 00001D6F 06 push es 0 00001D70 B8FFFF mov ax, -1 0 00001D73 E8[0000] call init2_relocate_device 0 00001D76 07 pop es 1609 assume es:nothing 1610 1611 Coff equ COFF ; NASM port label 0 00001D77 E908FE jmp Coff ;to handle next Install= command. 1613 1614 Multi_Pass_Filter: ;AN023;AN026; 0 00001D7A 80FC59 cmp ah, 'Y' ;AN023; Comment? 0 00001D7D 740A je Multi_Pass_Adjust ;AN023; 0 00001D7F 80FC5A cmp ah, 'Z' ;AN023; Bad command? 0 00001D82 7405 je Multi_Pass_Adjust ;AN023; 0 00001D84 80FC30 cmp ah, '0' ;AN023; REM? 0 00001D87 7508 jne Multi_Pass_Coff ;AN023; ignore the rest of the commands. 1621 Multi_Pass_Adjust: ;AN023; These commands need to 0 00001D89 FF0E[0000] dec word [Chrptr] ;AN023; adjust chrptr, count 0 00001D8D FF06[0000] inc word [Count] ;AN023; for NEWLINE proc. 1624 Multi_Pass_Coff: ;AN023; 0 00001D91 E9EEFD jmp Coff ;AN018; To handle next INSTALL= commands. 1626 1627 ;------------------------------------------------------------------------------ 1628 1629 Sysinit_Parse proc 1630 ;Set up registers for SysParse 1631 ;In) ES:SI -> command line in CONFBOT 1632 ; DI -> offset of the parse control defintion. 1633 ; 1634 ;Out) Calls SYSPARSE. 1635 ; Carry will set if Parse error. 1636 ; *** The caller should check the EOL condition by looking at AX 1637 ; *** after each call. 1638 ; *** If no parameters are found, then AX will contain a error code. 1639 ; *** If the caller needs to look at the SYNOMYM@ of the result, 1640 ; *** the caller should use CS:@ instead of ES:@. 1641 ; CX register should be set to 0 at the first time the caller calls this 1642 ; procedure. 1643 ; AX - exit code 1644 ; BL - TErminated delimeter code 1645 ; CX - new positional ordinal 1646 ; SI - set to pase scanned operand 1647 ; DX - selected result buffer 1648 0 00001D94 06 push es ;save es,ds 0 00001D95 1E push ds 1651 0 00001D96 06 push es 0 00001D97 1F pop ds ;now DS:SI -> command line 1654 assume ds:nothing 0 00001D98 0E push cs 0 00001D99 07 pop es ;now ES:DI -> control definition 1657 assume es:SYSINITGROUP 1658 0 00001D9A 2E8C1E[0600] mov [cs:Badparm_Seg],ds ;AN007;Save the pointer to the parm 0 00001D9F 2E8936[0400] mov [cs:Badparm_Off],si ;AN007; we are about to parse for Badparm msg. 0 00001DA4 BA0000 mov dx, 0 0 00001DA7 E8A1F1 call SysParse 1663 D_P_NO_ERROR equ D_P_No_Error ; NASM port equate 0 00001DAA 83F800 cmp ax, D_P_NO_ERROR ;no error 1665 ; $IF E,OR 0 00001DAD 7405 JE DD_LL1 0 00001DAF 83F8FF cmp ax, D_P_RC_EOL ;or the end of line? 1668 ; $IF E 0 00001DB2 7503 JNE DD_IF1 1670 DD_LL1: 0 00001DB4 F8 clc 1672 ; $ELSE 0 00001DB5 EB01 JMP SHORT DD_EN1 1674 DD_IF1: 0 00001DB7 F9 stc 1676 ; $ENDIF 1677 DD_EN1: 0 00001DB8 1F pop ds 0 00001DB9 07 pop es ;restore es,ds 1680 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001DBA C3 ret 1682 Sysinit_Parse endp 1683 1684 ;------------------------------------------------------------------------------ 1685 ; Buffer command 1686 ;------------------------------------------------------------------------------ 1687 ;******************************************************************************* 1688 ; * 1689 ; Function: Parse the parameters of buffers= command. * 1690 ; * 1691 ; Input : * 1692 ; ES:SI -> parameters in command line. * 1693 ; Output: * 1694 ; Buffers set * 1695 ; Buffer_Slash_X flag set if /X option chosen. * 1696 ; H_Buffers set if secondary buffer cache specified. * 1697 ; * 1698 ; Subroutines to be called: * 1699 ; Sysinit_Parse * 1700 ; Logic: * 1701 ; { * 1702 ; Set DI points to Buf_Parms; /*Parse control definition*/ * 1703 ; Set DX,CX to 0; * 1704 ; Reset Buffer_Slash_X; * 1705 ; While (End of command line) * 1706 ; { Sysinit_parse; * 1707 ; if (no error) then * 1708 ; if (Result_Val.D_P_SYNONYM_ptr == Slash_E) then /*Not a switch * 1709 ; Buffer_Slash_X = 1 * 1710 ; else if (CX == 1) then /* first positional */ * 1711 ; Buffers = Result_Val.D_P_Picked_Val; * 1712 ; else H_Buffers = Result_Val.D_P_Picked_Val; * 1713 ; else {Show Error message;Error Exit} * 1714 ; }; * 1715 ; If (Buffer_Slash_X is off & Buffers > 99) then Show_Error; * 1716 ; }; * 1717 ; * 1718 ;******************************************************************************* 1719 ;TryB: CMP AH,'B' ;BUFFER COMMAND? 1720 ; JNZ TRYC 1721 ; invoke GETNUM 1722 ; JZ TryBBad ; Gotta have at least one 1723 ; CMP AX,100 ; check for max number 1724 ; JB SaveBuf 1725 ;TryBBad:JMP BadOp 1726 ;SaveBuf: 1727 ; MOV [BUFFERS],AX 1728 ;CoffJ1: JMP COFF 1729 1730 TryB: 1731 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00001DBB 80FC42 CMP AH,'B' 0 00001DBE 7570 JNZ TryC 0 00001DC0 C606[910C]00 mov byte [P_Buffer_Slash_X], 0 ;AN000;AN025; 0 00001DC5 BF[4A0C] mov di, offset Buf_Parms ;AN000; 0 00001DC8 31C9 xor cx, cx ;AN000; 0 00001DCA 89CA mov dx, cx ;AN000; 1738 1739 ; $SEARCH ;AN000; 1740 DD_DO4: 0 00001DCC E8C5FF call Sysinit_Parse ;AN000; 1742 ; $EXITIF C ;AN000; Parse Error, 0 00001DCF 7305 JNC DD_IF4 0 00001DD1 E880FB call Badparm_p ;AN007; and Show messages and end the search loop. 1745 ; $ORELSE ;AN000; 0 00001DD4 EB57 JMP SHORT DD_SR4 1747 DD_IF4: 0 00001DD6 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 1749 ; $LEAVE E ;AN000; then jmp to $Endloop for semantic check. 0 00001DD9 7421 JE DD_EN4 1751 D_P_SYNONYM_PTR equ D_P_SYNONYM_Ptr ; NASM port equate 0 00001DDB 813E[960C][8A0C] cmp word [Result_Val + D_P_SYNONYM_PTR], offset Switch_X ;AN000;AN025; 1753 ; $IF E ;AN000; 0 00001DE1 7507 JNE DD_IF8 0 00001DE3 C606[910C]01 mov byte [P_Buffer_Slash_X], 1 ;AN000;AN025; set the flag 1756 ; $ELSE ;AN000; 0 00001DE8 EB10 JMP SHORT DD_EN8 1758 DD_IF8: 1759 D_P_PICKED_VAL equ D_P_Picked_Val ; NASM port equate 0 00001DEA A1[980C] mov ax, word ptr [Result_Val + D_P_PICKED_VAL] ;AN000; 0 00001DED 83F901 cmp cx, 1 ;AN000; 1762 ; $IF E ;AN000; 0 00001DF0 7505 JNE DD_IF10 0 00001DF2 A3[8D0C] mov [P_Buffers], ax ;AN000; 1765 ; $ELSE ;AN000; 0 00001DF5 EB03 JMP SHORT DD_EN10 1767 DD_IF10: 0 00001DF7 A3[8F0C] mov [P_H_Buffers], ax ;AN000; 1769 ; $ENDIF ;AN000; 1770 DD_EN10: 1771 ; $ENDIF ;AN000; 1772 DD_EN8: 1773 ; $ENDLOOP ;AN000; 0 00001DFA EBD0 JMP SHORT DD_DO4 1775 DD_EN4: 0 00001DFC 833E[8D0C]63 cmp word [P_Buffers], 99 ;AN000; 1777 ; $IF A,AND ;AN000; 0 00001E01 7612 JNA DD_IF15 0 00001E03 803E[910C]00 cmp byte [P_Buffer_Slash_X], 0 ;AN000;AN025; 1780 ; $IF E ;AN000; 0 00001E08 750B JNE DD_IF15 0 00001E0A E847FB call Badparm_p ;AN000; 0 00001E0D C706[8F0C]0000 mov word [P_H_Buffers], 0 ;AN000; 1784 ; $ELSE ;AN000; 0 00001E13 EB18 JMP SHORT DD_EN15 1786 DD_IF15: 0 00001E15 A1[8D0C] mov ax, [P_Buffers] ;AN000; We don't have any problem. 1788 Buffers equ BUFFERS ; NASM port label 0 00001E18 A3[0000] mov [Buffers], ax ;AN000; Now, let's set it really. 0 00001E1B A1[8F0C] mov ax, [P_H_Buffers] ;AN000; 0 00001E1E A3[0000] mov [H_Buffers], ax ;AN000; 0 00001E21 A0[910C] mov al, [P_Buffer_Slash_X] ;AN000;AN025; 0 00001E24 A2[0000] mov [Buffer_Slash_X], al ;AN000;AN025; 0 00001E27 A1[0000] mov ax, [LineCount] ;AN000; 0 00001E2A A3[0000] mov [Buffer_LineNum], ax ;AN000; Save the line number for the future use. 1796 ; $ENDIF ;AN000; 1797 DD_EN15: 1798 ; $ENDSRCH ;AN000; 1799 DD_SR4: 0 00001E2D E952FD jmp Coff 1801 1802 ;------------------------------------------------------------------------------ 1803 ; Break command 1804 ;------------------------------------------------------------------------------ 1805 ;******************************************************************************* 1806 ; * 1807 ; Function: Parse the parameters of Break = command. * 1808 ; * 1809 ; Input : * 1810 ; ES:SI -> parameters in command line. * 1811 ; Output: * 1812 ; Turn the Control-C check on or off. * 1813 ; * 1814 ; Subroutines to be called: * 1815 ; Sysinit_Parse * 1816 ; Logic: * 1817 ; { * 1818 ; Set DI to Brk_Parms; * 1819 ; Set DX,CX to 0; * 1820 ; While (End of command line) * 1821 ; { Sysinit_Parse; * 1822 ; if (no error) then * 1823 ; if (Result_Val.D_P_Item_Tag == 1) then /*ON */ * 1824 ; Set P_Ctrl_Break, on; * 1825 ; else /*OFF */ * 1826 ; Set P_Ctrl_Break, off; * 1827 ; else {Show message;Error_Exit}; * 1828 ; }; * 1829 ; If (no error) then * 1830 ; DOS function call to set Ctrl_Break check according to * 1831 ; }; * 1832 ; * 1833 ;******************************************************************************** 1834 ;TryC: CMP AH,'C' 1835 ; JZ GOTC 1836 ; JMP TRYDJ 1837 ;GOTC: 1838 ; CMP AL,'O' ;FIRST LETTER OF "ON" or "OFF" 1839 ; JNZ TryCBad 1840 ; CALL GETCHR 1841 ; JC TryCBad 1842 ; CMP AL,'N' ;SECOND LETTER OF "ON" 1843 ; JNZ TryCoff 1844 ; MOV AH,SET_CTRL_C_TRAPPING ;TURN ON CONTROL-C CHECK 1845 ; MOV AL,1 1846 ; MOV DL,AL 1847 ; INT 21H 1848 ;CoffJ2: JMP Coff 1849 ;TryCOff:CMP AL,'F' 1850 ; JNZ TryCBad ; Check for "OFF" 1851 ; CALL GetChr 1852 ; JC TryCBad 1853 ; CMP AL,'F' 1854 ; JZ COffJ2 1855 ;TryCBad:JMP BadOp 1856 ; 1857 TryC: 0 00001E30 80FC43 CMP AH,'C' 1859 TRYM equ TryM ; NASM port label 0 00001E33 7538 JNZ TRYM 0 00001E35 BF[9C0C] mov di, offset Brk_Parms ;AN000; 0 00001E38 31C9 xor cx,cx ;AN000; 0 00001E3A 89CA mov dx,cx ;AN000; 1864 ; $SEARCH ;AN000; 1865 DD_DO19: 0 00001E3C E855FF call Sysinit_Parse ;AN000; 1867 ; $EXITIF C ;AN000; Parse error 0 00001E3F 7305 JNC DD_IF19 0 00001E41 E810FB call Badparm_p ;AN007; Show message and end the serach loop. 1870 ; $ORELSE ;AN000; 0 00001E44 EB24 JMP SHORT DD_SR19 1872 DD_IF19: 0 00001E46 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 1874 ; $LEAVE E ;AN000; then end the $ENDLOOP 0 00001E49 7415 JE DD_EN19 1876 D_P_ITEM_TAG equ D_P_Item_Tag ; NASM port equate 0 00001E4B 803E[950C]01 cmp byte [Result_Val + D_P_ITEM_TAG], 1 ;AN000; 1878 ; $IF E ;AN000; 0 00001E50 7507 JNE DD_IF23 0 00001E52 C606[C10C]01 mov byte [P_Ctrl_Break], 1 ;AN000; Turn it on 1881 ; $ELSE ;AN000; 0 00001E57 EB05 JMP SHORT DD_EN23 1883 DD_IF23: 0 00001E59 C606[C10C]00 mov byte [P_Ctrl_Break], 0 ;AN000; Turn it off 1885 ; $ENDIF ;AN000; 1886 DD_EN23: 1887 ; $ENDLOOP ;AN000; we actually set the ctrl break 0 00001E5E EBDC JMP SHORT DD_DO19 1889 DD_EN19: 1890 SET_CTRL_C_TRAPPING equ Set_CTRL_C_Trapping ; NASM port equate 0 00001E60 B433 mov ah, SET_CTRL_C_TRAPPING ;AN000; if we don't have any parse error. 0 00001E62 B001 mov al, 1 ;AN000; 0 00001E64 8A16[C10C] mov dl, [P_Ctrl_Break] ;AN000; 0 00001E68 CD21 Int 21h ;AN000; 1895 ; $ENDSRCH ;AN000; 1896 DD_SR19: 0 00001E6A E915FD jmp Coff 1898 1899 ;------------------------------------------------------------------------------ 1900 ; MultiTrack command 1901 ;------------------------------------------------------------------------------ 1902 ;******************************************************************************* 1903 ; * 1904 ; Function: Parse the parameters of MultiTrack= command. * 1905 ; * 1906 ; Input : * 1907 ; ES:SI -> parameters in command line. * 1908 ; Output: * 1909 ; Turn MulTrk_Flag on or off. * 1910 ; * 1911 ; Subroutines to be called: * 1912 ; Sysinit_Parse * 1913 ; Logic: * 1914 ; { * 1915 ; Set DI to Brk_Parms; * 1916 ; Set DX,CX to 0; * 1917 ; While (End of command line) * 1918 ; { Sysinit_Parse; * 1919 ; if (no error) then * 1920 ; if (Result_Val.D_P_Item_Tag == 1) then /*ON */ * 1921 ; Set P_Mtrk, on; * 1922 ; else /*OFF */ * 1923 ; Set P_Mtrk, off; * 1924 ; else {Show message;Error_Exit}; * 1925 ; }; * 1926 ; If (no error) then * 1927 ; DOS function call to set MulTrk_Flag according to P_Mtrk. * 1928 ; * 1929 ; }; * 1930 ; * 1931 ;******************************************************************************** 1932 TryM: ;AN002; 0 00001E6D 80FC4D CMP AH,'M' ;AN002; 1934 TRYW equ TryW ; NASM port label 0 00001E70 7549 JNZ TRYW ;AN002; 1936 Mtrk_Parms equ MTrk_Parms ; NASM port label 0 00001E72 BF[A00D] mov di, offset Mtrk_Parms ;AN002; 0 00001E75 31C9 xor cx,cx ;AN002; 0 00001E77 89CA mov dx,cx ;AN002; 1940 ; $SEARCH ;AN002; 1941 DD_DO28: 0 00001E79 E818FF call Sysinit_Parse ;AN002; 1943 ; $EXITIF C ;AN002; Parse error 0 00001E7C 7305 JNC DD_IF28 0 00001E7E E8D3FA call Badparm_p ;AN007; Show message and end the serach loop. 1946 ; $ORELSE ;AN002; 0 00001E81 EB35 JMP SHORT DD_SR28 1948 DD_IF28: 0 00001E83 83F8FF cmp ax, D_P_RC_EOL ;AN002; End of Line? 1950 ; $LEAVE E ;AN002; then end the $ENDLOOP 0 00001E86 7415 JE DD_EN28 0 00001E88 803E[950C]01 cmp byte [Result_Val + D_P_ITEM_TAG], 1 ;AN002; 1953 ; $IF E ;AN002; 0 00001E8D 7507 JNE DD_IF32 0 00001E8F C606[B40D]01 mov byte [P_Mtrk], 1 ;AN002; Turn it on temporarily. 1956 ; $ELSE ;AN002; 0 00001E94 EB05 JMP SHORT DD_EN32 1958 DD_IF32: 0 00001E96 C606[B40D]00 mov byte [P_Mtrk], 0 ;AN002; Turn it off temporarily. 1960 ; $ENDIF ;AN002; 1961 DD_EN32: 1962 ; $ENDLOOP ;AN002; we actually set the MulTrk_Flag here. 0 00001E9B EBDC JMP SHORT DD_DO28 1964 DD_EN28: 0 00001E9D 1E push ds ;AN002; 0 00001E9E E8[0000] call sysinit_get_ds_dosbiodata 1967 assume ds:DOSGROUP 0 00001EA1 2E803E[B40D]00 cmp byte [cs:P_Mtrk], 0 ;AN002; 1969 ; $IF E ;AN002; 0 00001EA7 7508 JNE DD_IF36 1971 MulTrk_Flag equ MulTrk_flag ; NASM port label 0 00001EA9 C706[0000]0100 mov word [MulTrk_Flag], MULTRK_OFF2 ;AN002; 0001h 1973 ; $ELSE ;AN002; 0 00001EAF EB06 JMP SHORT DD_EN36 1975 DD_IF36: 0 00001EB1 C706[0000]8000 mov word [MulTrk_Flag], MULTRK_ON ;AN002; 8000h 1977 ; $ENDIF ;AN002; 1978 DD_EN36: 0 00001EB7 1F pop ds ;AN002; 1980 assume ds:SYSINITGROUP 1981 ; $ENDSRCH ;AN002; 1982 DD_SR28: 0 00001EB8 E9C7FC jmp Coff ;AN002; 1984 1985 ;------------------------------------------------------------------------------ 1986 ; CPSW command 1987 ;------------------------------------------------------------------------------ 1988 ;******************************************************************************* 1989 ; * 1990 ; Function: Parse the parameters of CPSW= command. * 1991 ; * 1992 ; Input : * 1993 ; ES:SI -> parameters in command line. * 1994 ; Output: * 1995 ; Turn CPSW on or off. * 1996 ; * 1997 ; Subroutines to be called: * 1998 ; Sysinit_Parse * 1999 ; Logic: * 2000 ; { * 2001 ; Set DI to CPSW_Parms; * 2002 ; Set DX,CX to 0; * 2003 ; While (End of command line) * 2004 ; { Sysinit_Parse; * 2005 ; if (no error) then * 2006 ; if (Result_Val.D_P_Item_Tag == 1) then /*ON */ * 2007 ; Set P_CPSW, on; * 2008 ; else /*OFF */ * 2009 ; Set P_CPSW, off; * 2010 ; else {Show message;Error_Exit}; * 2011 ; }; * 2012 ; If (no error) then * 2013 ; DOS function call to set CPSW according to P_CPSW. * 2014 ; }; * 2015 ; * 2016 ;******************************************************************************** 2017 TryW: ;AN002; 0 00001EBB 80FC57 CMP AH,'W' ;AN002; 0 00001EBE 7538 JNZ TRYDJ ;AN002; 0 00001EC0 BF[B50D] mov di, offset CPSW_Parms ;AN002; 0 00001EC3 31C9 xor cx,cx ;AN002; 0 00001EC5 89CA mov dx,cx ;AN002; 2023 ; $SEARCH ;AN002; 2024 DD_DO40: 0 00001EC7 E8CAFE call Sysinit_Parse ;AN002; 2026 ; $EXITIF C ;AN002; Parse error 0 00001ECA 7305 JNC DD_IF40 0 00001ECC E885FA call Badparm_p ;AN007; Show message and end the serach loop. 2029 ; $ORELSE ;AN002; 0 00001ECF EB24 JMP SHORT DD_SR40 2031 DD_IF40: 0 00001ED1 83F8FF cmp ax, D_P_RC_EOL ;AN002; End of Line? 2033 ; $LEAVE E ;AN002; then end the $ENDLOOP 0 00001ED4 7415 JE DD_EN40 0 00001ED6 803E[950C]01 cmp byte [Result_Val + D_P_ITEM_TAG], 1 ;AN002; 2036 ; $IF E ;AN002; 0 00001EDB 7507 JNE DD_IF44 0 00001EDD C606[C90D]01 mov byte [P_CPSW], 1 ;AN002; Turn it on temporarily. 2039 ; $ELSE ;AN002; 0 00001EE2 EB05 JMP SHORT DD_EN44 2041 DD_IF44: 0 00001EE4 C606[C90D]00 mov byte [P_CPSW], 0 ;AN002; Turn it off temporarily. 2043 ; $ENDIF ;AN002; 2044 DD_EN44: 2045 ; $ENDLOOP ;AN002; we actually set the MulTrk_Flag here. 0 00001EE9 EBDC JMP SHORT DD_DO40 2047 DD_EN40: 0 00001EEB B433 mov ah, SET_CTRL_C_TRAPPING ;AN000; The same function number as Ctrl_Break 0 00001EED B004 mov al, 4 ;AN000; Set CPSW state function 0 00001EEF 8A16[C90D] mov dl, [P_CPSW] ;AN000; 0=off, 1=on 0 00001EF3 CD21 Int 21h ;AN000; 2052 ; $ENDSRCH ;AN002; 2053 DD_SR40: 0 00001EF5 E98AFC jmp Coff ;AN002; 2055 2056 ;------------------------------------------------------------------------------ 2057 ; Device command 2058 ;------------------------------------------------------------------------------ 2059 TRYDJ: 0 00001EF8 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001EFE 80FC34 cmp ah, '4' 0 00001F01 7507 jne @F 0 00001F03 2EF616[2200] not byte [cs:devicehighflag] 0 00001F08 B433 mov ah, '3' 2065 @@: 0 00001F0A 80FC33 cmp ah, '3' ; INSTALLFIRST= command? 0 00001F0D 7503E958FE je ..@run_install 2068 0 00001F12 2ED006[2C00] rol byte [cs:installaslast_option], 1 0 00001F17 7221 jc .notinstall ; INSTALLASLAST overrides INSTALLASFIRST 0 00001F19 2ED006[2B00] rol byte [cs:installasfirst_option], 1 0 00001F1E 731A jnc .notinstall ; not INSTALLASFIRST --> 0 00001F20 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001F26 80FC69 cmp ah, 'i' 0 00001F29 7507 jne @F 0 00001F2B 2EF616[2200] not byte [cs:devicehighflag] 0 00001F30 B449 mov ah, 'I' 2078 @@: 0 00001F32 80FC49 cmp ah, 'I' ; INSTALL= command? 0 00001F35 7503E930FE je ..@run_install 2081 2082 .notinstall: 2083 debugnumber 'DJ' 0 00001F3A 2EC606[2200]00 mov byte [cs:devicehighflag], 0 0 00001F40 2E8126[0000]FE00 and word [cs:IFS_Flag], NOT_IFS ;AN000; Reset the flag 0 00001F47 80FC64 cmp ah, 'd' 0 00001F4A 741D je GOTDJ_devicehigh 0 00001F4C 80FC44 CMP AH,'D' 0 00001F4F 741D JZ GOTDJ 0 00001F51 80FC4A CMP AH,'J' 0 00001F54 7403 jz GOTJ 0 00001F56 E9F104 JMP TRYQ 2093 GOTJ: ;AN000; IFS= command. 0 00001F59 2E830E[0000]01 or word [cs:IFS_Flag], IS_IFS ;AN000; set the flag. 0 00001F5F 803E[0000]02 cmp byte [Multi_Pass_Id], 2 ;second pass? 0 00001F64 7408 je GOTDJ ;then proceed 0 00001F66 E919FC jmp Coff ;else ignore this until the second pass. 2098 2099 ; jmp GOTDJ_Cont 2100 ;GOTD: 2101 ; test [cs:IFS_Flag], HAD_IFS ;AN000; Cannot have DEVICE= command after IFS= command. 2102 ; jz GOTDJ_Cont ;AN000; 2103 ; call Incorrect_Order ;AN000; Display "Incorrect order ..." msg. 2104 ; jmp COFF ;AN000; 2105 2106 GOTDJ_devicehigh: 0 00001F69 2EF616[2200] not byte [cs:devicehighflag] 2108 GOTDJ: 2109 debugnumber 'gt' 0 00001F6E 8CCB MOV BX,CS ;DEVICE= or IFS= command. 0 00001F70 8EDB MOV DS,BX 2112 assume ds:SYSINITGROUP 2113 0 00001F72 8936[0000] MOV WORD PTR [BPB_ADDR],SI 0 00001F76 8C06[0200] MOV WORD PTR [BPB_ADDR+2],ES 2116 2117 ;J.K. In case it is for IFS=, then set the parameter pointer. 2118 ifs_rh equ IFS_RH ; NASM port label 0 00001F7A 8936[1600] mov word ptr [ifs_rh + IFSR_PARMS@], SI ;AN000; for IFS 0 00001F7E 8C06[1800] mov word ptr [ifs_rh + IFSR_PARMS@+2], ES ;AN000; 2121 2122 ; We are going to open the cdevice driver and size it as is done 2123 ; in LDFIL. The reason we must do this is that EXEC does NO checking 2124 ; for us. We must make sure there is room to load the device without 2125 ; trashing SYSINIT. This code is not 2126 ; perfect (for instance .EXE device drivers are possible) because 2127 ; it does its sizing based on the assumption that the file being loaded 2128 ; is a .COM file. It is close enough to correctness to be usable. 2129 0 00001F82 06 PUSH ES 0 00001F83 1F POP DS 2132 ASSUME DS:NOTHING 0 00001F84 89F2 MOV DX,SI ;DS:DX POINTS TO FILE NAME 2134 0 00001F86 B8003D MOV AX,OPEN << 8 ;OPEN THE FILE 0 00001F89 F9 STC ;IN CASE OF INT 24 0 00001F8A CD21 INT 21H 0 00001F8C 7303E97E01 JC BADLDRESET 0 00001F91 89C3 MOV BX,AX ;Handle in BX 0 00001F93 1E push ds 0 00001F94 52 PUSH DX ; Save pointer to name 0 00001F95 31C9 XOR CX,CX 0 00001F97 31D2 XOR DX,DX 0 00001F99 B80242 MOV AX,(LSEEK << 8) | 2 0 00001F9C F9 STC ;IN CASE OF INT 24 0 00001F9D CD21 INT 21H ; Get file size in DX:AX 0 00001F9F 730A JNC GO_AHEAD_LOAD 0 00001FA1 B43E MOV AH,CLOSE ; Close file 0 00001FA3 CD21 INT 21H 0 00001FA5 5A POP DX ; Clean stack 0 00001FA6 5A pop dx ; discard ds 0 00001FA7 F9 STC ; Close may clear carry 0 00001FA8 E96401 JMP BADLDRESET 2154 2155 GO_AHEAD_LOAD: 2156 ; Convert size in DX:AX to para in AX 0 00001FAB 83C00F ADD AX,15 ; Round up size for conversion to para 0 00001FAE 83D200 ADC DX,0 0 00001FB1 7212 jc .err ; rounded up is 4 GiB ? --> 0 00001FB3 B90400 mov cx, 4 2161 @@: 0 00001FB6 D1EA shr dx, 1 0 00001FB8 D1D8 rcr ax, 1 0 00001FBA E2FA loop @B 0 00001FBC 85D2 test dx, dx ; >= 1 MiB ? 0 00001FBE 7505 jnz .err ; --> 0 00001FC0 83F8F0 cmp ax, -16 ; allow for some increment 0 00001FC3 7203 jb @F ; if fine --> 2169 .err: 0 00001FC5 E91E01 jmp MEM_ERRJY 2171 @@: 2172 0 00001FC8 0E push cs 0 00001FC9 1F pop ds 2175 assume ds:SYSINITGROUP 0 00001FCA A3[0C00] mov word [devicefilesizepara], ax 2177 2178 retry_devicehigh_oom: 0 00001FCD 8B16[0C00] mov dx, word [devicefilesizepara] 2180 ; rol byte [devicehighflag], 1 2181 ; jnc .low1 2182 .high1: 2183 0 00001FD1 53 push bx ; preserve handle 0 00001FD2 B80058 mov ax, 5800h 0 00001FD5 CD21 int 21h 0 00001FD7 50 push ax 0 00001FD8 B80158 mov ax, 5801h 0 00001FDB BB4001 mov bx, 0140h ; ignore UMB link, UMA only, first fit 0 00001FDE D006[2200] rol byte [devicehighflag], 1 0 00001FE2 7203 jc @F 0 00001FE4 BB1001 mov bx, 0110h ; ignore UMB link, LMA only, first fit 2193 @@: 0 00001FE7 CD21 int 21h 2195 0 00001FE9 89D3 mov bx, dx 0 00001FEB 43 inc bx ; space for SD sub-MCB 0 00001FEC B448 mov ah, 48h 0 00001FEE CD21 int 21h 0 00001FF0 7316 jnc @F 2201 0 00001FF2 5B pop bx 0 00001FF3 B80158 mov ax, 5801h 0 00001FF6 CD21 int 21h 0 00001FF8 5B pop bx ; handle 2206 0 00001FF9 D006[2200] rol byte [devicehighflag], 1 ; already tried LMA ? 0 00001FFD 7306 jnc .oom ; yes --> 0 00001FFF F616[2200] not byte [devicehighflag] ; toggle back to try LMA 0 00002003 EBC8 jmp retry_devicehigh_oom 2211 2212 .oom: 0 00002005 E9[0000] jmp MEM_ERR 2214 2215 @@: 0 00002008 89C2 mov dx, ax 0 0000200A 5B pop bx 0 0000200B B80158 mov ax, 5801h 0 0000200E CD21 int 21h 2220 0 00002010 06 push es 0 00002011 56 push si 2223 0 00002012 8EC2 mov es, dx 2225 assume es:nothing 0 00002014 B44A mov ah, 4Ah 0 00002016 BBFFFF mov bx, -1 0 00002019 CD21 int 21h ; grow to largest size 2229 2230 ; recreate stack frame of init2_relocate_device 2231 lframe 0 2232 lvar word, umb_first_umcb 2233 lvar word, umb_last_umcb 2234 lvar word, last_mcb 0 0000201B 5589E58D66FA lenter 2236 lvar word, flags 0 00002021 50 push ax 2238 lvar word, first_mcb 0 00002022 B452 mov ah, 52h 0 00002024 CD21 int 21h 2241 assume es:nothing 0 00002026 26FF77FE push word [es:bx - 2] 2243 lvar word, first_umcb 0 0000202A B86112 mov ax, 1261h 0 0000202D CD2F int 2Fh 0 0000202F 50 push ax 2247 0 00002030 4A dec dx 2249 0 00002031 31F6 xor si, si 0 00002033 56 push si ; loop detection counter word 0 00002034 BE2000 mov si, 20h ; "LMA then UMA" (+ first fit) 0 00002037 56 push si 0 00002038 89E6 mov si, sp ; ss:si -> area flags and strategy word 2255 0 0000203A 31C0 xor ax, ax ; = 0 = get first UMCB 2257 .search_umb: 0 0000203C 8946FA mov word [bp + ?last_mcb], ax 0 0000203F E8[0000] call init2_SNextMCB 0 00002042 722A jc .no_sd_merge ; chain corrupted 0 00002044 7528 jnz .no_sd_merge ; end reached 2262 0 00002046 39D0 cmp ax, dx 0 00002048 75F2 jne .search_umb 2265 0 0000204A 8B46FA mov ax, word [bp + ?last_mcb] 0 0000204D 8ED8 mov ds, ax 2268 assume ds:MCB 0 0000204F 837D0108 cmp word [di + mcbOwner], 8 0 00002053 7519 jne .no_sd_merge 0 00002055 817D085344 cmp word [di + mcbName], "SD" 0 0000205A 7512 jne .no_sd_merge 0 0000205C 807D0A00 cmp byte [di + mcbName + 2], 0 0 00002060 750C jne .no_sd_merge 2275 2276 ; ax => SD MCB immediately before ours 2277 .sd_merge: 0 00002062 8EC2 mov es, dx ; => new MCB (to become sub MCB) 2279 assume es:MCB 0 00002064 268B5D03 mov bx, [es:di + mcbSize] 2281 ; get size 0 00002068 43 inc bx ; count MCB itself 0 00002069 015D03 add word [di + mcbSize], bx 2284 ; grow SD MCB 0 0000206C EB24 jmp .merge_common 2286 2287 .no_sd_merge: 0 0000206E 8EDA mov ds, dx ; => new MCB (to become SD MCB) 2289 assume ds:MCB 0 00002070 89D0 mov ax, dx 0 00002072 C745010800 mov word [di + mcbOwner], 8 0 00002077 C745085344 mov word [di + mcbName], "SD" 0 0000207C 897D0A mov word [di + mcbName + 2], di 0 0000207F 42 inc dx 0 00002080 8EC2 mov es, dx ; => new sub MCB 2296 assume es:nothing 0 00002082 8B5D03 mov bx, [di + mcbSize] 0 00002085 4B dec bx 0 00002086 26895D03 mov word [es:di + mcbSize], bx 0 0000208A 26897D05 mov word [es:di + mcbReserved], di 0 0000208E 26897D07 mov word [es:di + mcbReserved + 2], di 2302 ; clear reserved fields 2303 .merge_common: 2304 ; ax => SD MCB, we are at the tail end 2305 ; es => sub-MCB we're creating 2306 ; di = 0 2307 ; dx = es 0 00002092 26C60544 mov byte [es:di + mcbSignature], DEVMARK_DEVICE 2309 ; set devmark 0 00002096 42 inc dx 0 00002097 26895501 mov word [es:di + mcbOwner], dx 2312 ; set owner 0 0000209B 26897D08 mov word [es:di + mcbName], di 0 0000209F 26897D0A mov word [es:di + mcbName + 2], di 0 000020A3 26897D0C mov word [es:di + mcbName + 4], di 0 000020A7 26897D0E mov word [es:di + mcbName + 6], di 2317 ; clear name for a bit 0 000020AB 268B5D03 mov bx, word [es:di + mcbSize] 2319 ; bx = size 2320 ; ax => SD MCB, we are at the tail end 2321 ; es => sub-MCB we've created 2322 ; di = 0 2323 ; dx => data block to use 2324 ; bx = size of sub-MCB 2325 0 000020AF 89EC5D lleave 0 000020B2 0E push cs 0 000020B3 1F pop ds 2329 assume ds:SYSINITGROUP, es:nothing 0 000020B4 A3[0E00] mov word [devicehighsd], ax 0 000020B7 8916[1000] mov word [devicehighdata], dx 0 000020BB 891E[1200] mov word [devicehighsize], bx 0 000020BF 01D3 add bx, dx 0 000020C1 891E[1400] mov word [devicehighafter], bx 2335 0 000020C5 06 push es 0 000020C6 1F pop ds ; ds => sub-MCB 2338 assume ds:nothing 2339 0 000020C7 5E pop si 0 000020C8 07 pop es ; es:si -> filename 2342 assume es:nothing 2343 0 000020C9 06 push es 0 000020CA 56 push si 0 000020CB E86107 call get_device_mcb_name 0 000020CE 5E pop si 0 000020CF 07 pop es 2349 assume es:nothing 2350 0 000020D0 92 xchg ax, dx ; ax => memory block 0 000020D1 5B pop bx ; handle 0 000020D2 EB00 jmp .common1 2354 2355 %if 0 2356 .low1: 2357 CALL ROUND 2358 ;J.K. Set up the DEVMARK entries here for MEM command. 2359 ;J.K. Only the DEVMARK_ID and DEVMARK_FILENAME will be set. 2360 ;J.K. DEVMARK_SIZE should be set after a successful process of this file. 2361 call Set_DevMark ;AN004; 2362 inc word [MEMHI] ;AN004;Size of DEVMARK is a paragraph!! 2363 ;Don't forget decrease MEMHI 2364 ; with an unsuccessful process of this file!!. 2365 MOV AX,[MEMHI] 2366 %endif 2367 2368 .common1: 0 000020D4 0E push cs 0 000020D5 1F pop ds 2371 assume ds:SYSINITGROUP, es:nothing 0 000020D6 8326[0000]00 and WORD PTR [ENTRY_POINT], 0 0 000020DB A3[0200] MOV WORD PTR [ENTRY_POINT+2],AX ;SET ENTRY POINT 2374 0 000020DE A3[0000] MOV [PRMBLK],AX ;SET LOAD OFFSET 0 000020E1 A3[0200] MOV [PRMBLK + 2],AX ;SET LOAD OFFSET 2377 2378 %if 1 0 000020E4 EB03 jmp OKLDX 2380 %else 2381 rol byte [devicehighflag], 1 2382 jc OKLDX ; already know for devicehigh --> 2383 MOV CX,ax ; CX:0 is xaddr 2384 ADD CX, [devicefilesizepara]; New device will take up to here 2385 JC MEM_ERRJY ; WOW!!!! 2386 CMP CX, [ALLOCLIM] 2387 JB OKLDX 2388 %endif 2389 2390 MEM_ERRJY: 0 000020E6 E9[0000] JMP MEM_ERR 2392 2393 OKLDX: 0 000020E9 5A POP DX ; Recover name pointer 0 000020EA 1F pop ds 2396 assume ds:nothing 0 000020EB B43E MOV AH,CLOSE ; Close file 0 000020ED CD21 INT 21H 0 000020EF 0E push cs 0 000020F0 07 pop es 2401 assume es:SYSINITGROUP 0 000020F1 BB[0000] MOV BX,OFFSET PRMBLK ;ES:BX POINTS TO PARAMETERS 0 000020F4 B003 MOV AL,3 2404 EXEC equ Exec ; NASM port equate 0 000020F6 B44B MOV AH,EXEC 0 000020F8 F9 STC ;IN CASE OF INT 24 0 000020F9 CD21 INT 21H ;LOAD IN THE DEVICE DRIVER 0 000020FB 2EC706[1800]FFFF mov word [cs:devicelastdpb], -1 0 00002102 2EC706[1C00]FFFF mov word [cs:devicefirstnewdpb], -1 0 00002109 2EC606[2000]00 mov byte [cs:deviceamountnew], 0 2411 2412 BADLDRESET: 0 0000210F 1E PUSH DS 0 00002110 07 POP ES ;ES:SI BACK TO CONFIG.SYS 2415 assume es:nothing 0 00002111 0E PUSH CS 0 00002112 1F POP DS ;DS BACK TO SYSINIT 2418 ASSUME DS:SYSINITGROUP 0 00002113 731A JNC GOODLD 2420 BADBRK: 2421 assume ds:nothing, es:nothing, ss:nothing 0 00002115 2EF606[0300]01 test byte [cs:SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done, 0 0000211B 7503 jnz Skip0_ResetMEMHI ;AN004; then do not 2424 ; dec word [cs:MEMHI] ;AN004;Adjust MEMHI by a paragrah of DEVMARK. 0 0000211D E81C01 call release_device_memory 2426 Skip0_ResetMEMHI: 0 00002120 26803C0D cmp byte ptr [es:si], CR ;file name is CR? (Somebody entered "device=" without filename) 0 00002124 7503 jne BADBRK_1 0 00002126 E913F8 jmp BADOP ;show "Unrecognized command in CONFIG.SYS" 2430 BADBRK_1: 0 00002129 E8[0000] invoke BADLOAD 0 0000212C E953FA JMP COFF 2433 2434 GOODLD: 2435 ;J.K. If it is IFS=, then we should set IFS_DOSCALL@ field in IFSHEADER. 0 0000212F 2EF706[0000]0100 test word [cs:IFS_Flag], IS_IFS ;AN000; 0 00002136 7422 jz Skip_IFSHEADER_Set ;AN000; 0 00002138 06 push es ;AN000; 0 00002139 57 push di ;AN000; 0 0000213A 1E push ds ;AN000; 0 0000213B 2E8B1E[0200] mov bx, word ptr [cs:ENTRY_POINT+2] ;AN000; 0 00002140 8EDB mov ds, bx ;AN000; DS:0 will be the header 2443 assume ds:nothing 2444 DosInfo equ DOSINFO ; NASM port label 0 00002142 2EC43E[0000] les di, [cs:DosInfo] ;AN000; 2446 assume es:DOSGROUP 0 00002147 268B5D37 mov bx, word ptr [es:di + SYSI_IFS_DOSCALL@] ;AN000; 0 0000214B 891E1000 mov word ptr [IFS_DOSCALL@], bx ;AN000; 0 0000214F 268B5D39 mov bx, word ptr [es:di + SYSI_IFS_DOSCALL@ + 2] ;AN000; 0 00002153 891E1200 mov word ptr [IFS_DOSCALL@ + 2], bx ;AN000; 0 00002157 1F pop ds ;AN000; 2452 assume ds:nothing 0 00002158 5F pop di ;AN000; 0 00002159 07 pop es ;AN000; 2455 assume ds:nothing, es:nothing 2456 Skip_IFSHEADER_Set: ;AN000; 0 0000215A 0656 SaveReg ;INITIALIZE THE DEVICE 2458 ; call Chk_IBMCACHE ;AN024 IBMCACHE.SYS problem.;AN026;IBMDOS will handles this thru 4Bh call. 0 0000215C 268A1C .Restore:MOV BL,[ES:SI] ; while ((c=*p) != 0) 0 0000215F 84DB test BL,BL 0 00002161 7403 JZ .Got 0 00002163 46 INC SI ; p++; 0 00002164 EBF6 JMP .Restore 0 00002166 26C60420 .Got: MOV BYTE PTR [ES:SI],' ' ; *p = ' '; 0 0000216A 0656 SaveReg 0 0000216C 0E PUSH CS 0 0000216D 07 POP ES 2468 assume es:SYSINITGROUP 2469 0 0000216E 2EF706[0000]0100 test word [cs:IFS_Flag], IS_IFS ;AN000; 0 00002175 7408 jz Got_Device_Com ;AN000; 0 00002177 BB1400 mov bx, IFS_CALL@ ;AN000; offset from the start of IFSHEADER 0 0000217A E88D06 call sysinit_CallIFS ;AN000; 0 0000217D EB47 jmp short End_Init_Call 2475 Got_Device_Com: 0 0000217F 1E push ds ;AN017; 0 00002180 56 push si ;AN017; 0 00002181 2EC536[0000] lds si, [cs:ENTRY_POINT] ;AN017; Peeks the header attribute 2479 assume ds:nothing 0 00002186 F744040080 test word ptr [si + SDEVATT], DEVTYP ;AN017;Block device driver? 0 0000218B 7512 jnz Got_Device_Com_Cont ;AN017;No. 0 0000218D 2EC536[0000] lds si, [cs:DOSINFO] ;AN017; DS:SI -> SYS_VAR 2483 assume ds:DOSGROUP 0 00002192 807C201A cmp byte [si + SYSI_NUMIO], 26 ;AN017; No more than 26 drive number 0 00002196 7207 jb Got_Device_Com_Cont ;AN017; 0 00002198 5E pop si ;AN017; 0 00002199 1F pop ds ;AN017; 2488 assume ds:nothing 0 0000219A 5E pop si ;AN017;clear the stack 0 0000219B 07 pop es ;AN017; 2491 assume es:nothing 0 0000219C E94801 jmp BadNumBlock ;AN017; 2493 Got_Device_Com_Cont: ;AN017; 0 0000219F 5E pop si ;AN017; 0 000021A0 1F pop ds ;AN017; 2496 assume ds:nothing 2497 0 000021A1 2ED006[0000] rol byte [cs:MultDeviceFlag], 1 0 000021A6 7212 jc .keepbreak 0 000021A8 2EA1[1400] mov ax, word [cs:devicehighafter] 2501 %if 0 2502 rol byte [cs:devicehighflag], 1 2503 jc .common3 2504 .low3: 2505 alloclim equ ALLOCLIM ; NASM port label 2506 mov ax, [cs:alloclim] 2507 %endif 2508 .common3: 2509 Break_addr equ BREAK_ADDR ; NASM port label 0 000021AC 2E8326[0000]00 and word ptr [cs:Break_addr], 0 0 000021B2 2EA3[0200] mov word ptr [cs:Break_addr+2], ax 0 000021B6 2EA3[1600] mov word [cs:deviceafter], ax 2513 .keepbreak: 0 000021BA BB0600 MOV BX,SDEVSTRAT 0 000021BD E8[0000] invoke CALLDEV ; CallDev (SDevStrat); 2516 assume ds:nothing, es:nothing 0 000021C0 BB0800 MOV BX,SDEVINT 0 000021C3 E8[0000] invoke CALLDEV ; CallDev (SDevInt); 2519 assume ds:nothing, es:nothing 2520 debugnumber 'rt' 2521 End_Init_Call: 0 000021C6 5E1F RestoreReg 2523 assume ds:nothing 0 000021C8 C60400 MOV BYTE PTR [SI],0 ; *p = 0; 2525 0 000021CB 0E PUSH CS 0 000021CC 1F POP DS 2528 assume ds:SYSINITGROUP 2529 0 000021CD F706[0000]0100 test word [IFS_Flag], IS_IFS ;AN000; 0 000021D3 7503E99800 jz Was_Device_Com ;AN000; 0 000021D8 803E[0300]00 cmp byte [ifs_rh + IFSR_RETCODE], 0 ;AN000; Was a success ? 2533 Erase_Dev_do equ ERASE_DEV_do ; NASM port label 0 000021DD 753C jne Erase_Dev_do ;AN000; 0 000021DF 5E pop si ;AN000; restore es:si to clean up the 0 000021E0 07 pop es ;AN000; stack for Set_Break call. 2537 assume es:nothing 2538 Entry_Point equ ENTRY_POINT ; NASM port label 0 000021E1 A1[0200] mov ax, word ptr [Entry_Point+2] ;AN000; Get the loaded segment 0 000021E4 0306[1A00] add ax, word ptr [ifs_rh + IFSR_RESSIZE] ;AN000; 0 000021E8 8326[0000]00 and word ptr [Break_addr], 0 ;AN000; 0 000021ED A3[0200] mov word ptr [Break_addr+2], ax ;AN000; 0 000021F0 E8[0000] invoke Set_Break ;AN000; Will also check the memory size too. 0 000021F3 06 push es ;AN000; Save it again, in case, for Erase_Dev_Do. 0 000021F4 56 push si ;AN000; 0 000021F5 7224 jc Erase_Dev_do ;AN000; 2547 Link_IFS: ;AN000; 2548 dosinfo equ DOSINFO ; NASM port label 0 000021F7 2EC43E[0000] les di, [cs:dosinfo] ;AN000; 2550 assume es:DOSGROUP 0 000021FC 268B4D3B mov cx, word ptr [es:di + SYSI_IFS] ;AN000; save old pointer 0 00002200 268B553D mov dx, word ptr [es:di + SYSI_IFS+2] ;AN000; 0 00002204 2EC536[0000] lds si, [cs:Entry_Point] ;AN000; 2554 assume ds:nothing 0 00002209 2689753B mov word ptr [es:di + SYSI_IFS],si ;AN000; 0 0000220D 268C5D3D mov word ptr [es:di + SYSI_IFS+2], ds ;AN000; 0 00002211 890C mov word ptr [si], cx ;AN000; We don't permit multiple IFSs. 0 00002213 895402 mov word ptr [si+2], dx ;AN000; 0 00002216 5E pop si ;AN000; Restore es:si for the next command. 0 00002217 07 pop es ;AN000; 2561 assume es:nothing 2562 ; mov [cs:IFS_Flag], HAD_IFS ;AN014; Set the flag. 0 00002218 E967F9 jmp COFF ;AN000; 2564 2565 ERASE_DEV_do: ;AC000;; Modified to show message "Error in CONFIG.SYS..." 0 0000221B 5E pop si 0 0000221C 07 pop es 2568 assume es:nothing 0 0000221D 0E push cs 0 0000221E 1F pop ds 2571 assume ds:SYSINITGROUP 2572 0 0000221F F606[0300]01 test byte [SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done, 0 00002224 7503 jnz Skip1_ResetMEMHI ;AN004; then do not 2575 ; dec word [MEMHI] ;AN004;Adjust MEMHI by a paragrah of DEVMARK. 0 00002226 E81300 call release_device_memory 2577 Skip1_ResetMEMHI: 0 00002229 833E[0000]00 cmp word [ConfigMsgFlag], 0 ;AN015; 0 0000222E 7409 je No_Error_Line_Msg ;AN015; 0 00002230 E89C05 call Error_Line ;AN021; No "Error in CONFIG.SYS" msg for device driver. DCR D493 0 00002233 C706[0000]0000 mov word [ConfigMsgFlag], 0 ;AN015;AN021;Set the default value again. 2582 No_Error_Line_Msg: ;AN015; 0 00002239 E9F501 JMP COFF_relocate 2584 2585 release_device_memory: 0 0000223C 1E push ds 0 0000223D 0E push cs 0 0000223E 1F pop ds 2589 assume ds:SYSINITGROUP 2590 ; rol byte [devicehighflag], 1 2591 ; jnc .low2 2592 .high2: 0 0000223F 06 push es 0 00002240 50 push ax 0 00002241 53 push bx 2596 0 00002242 A1[0E00] mov ax, word [devicehighsd] 0 00002245 40 inc ax ; => SD MCB's data 0 00002246 8B1E[1000] mov bx, word [devicehighdata] 0 0000224A 85DB test bx, bx 0 0000224C 741D jz .ret 0 0000224E 4B dec bx ; => sub-MCB 0 0000224F 8EC0 mov es, ax 2604 assume es:nothing 0 00002251 29C3 sub bx, ax ; = size of SD to keep 0 00002253 7412 jz @F ; if to free --> 0 00002255 B44A mov ah, 4Ah 0 00002257 CD21 int 21h ; shrink SD MCB, cannot fail 0 00002259 8CC0 mov ax, es 0 0000225B 48 dec ax 0 0000225C 8EC0 mov es, ax ; => SD MCB 2612 assume es:MCB 0 0000225E 26C70601000800 mov word [es:mcbOwner], 8 ; reset owner changed by 21.4A 0 00002265 EB04 jmp @FF 2615 @@: 0 00002267 B449 mov ah, 49h 0 00002269 CD21 int 21h ; free SD MCB 2618 @@: 2619 .ret: 0 0000226B 5B pop bx 0 0000226C 58 pop ax 0 0000226D 07 pop es 2623 assume es:nothing 0 0000226E 1F pop ds 2625 assume ds:nothing 0 0000226F C3 retn 2627 %if 0 2628 .low2: 2629 dec word [MEMHI] ; Adjust MEMHI by a paragraph of DEVMARK. 2630 pop ds 2631 retn 2632 %endif 2633 2634 Was_Device_Com: ;AN000; 2635 assume ds:SYSINITGROUP, es:nothing, ss:nothing 2636 break_addr equ BREAK_ADDR ; NASM port label 0 00002270 A1[0000] mov ax, word ptr [break_addr] 0 00002273 E8[0000] call ParaRound 0 00002276 0306[0200] add ax, word ptr [break_addr + 2] 0 0000227A 7206 jc .bad 0 0000227C 3B06[1600] cmp ax, word [deviceafter] 0 00002280 7605 jbe BREAKOK 2643 .bad: 0 00002282 5E POP SI 0 00002283 07 POP ES 2646 assume es:nothing 0 00002284 E98EFE JMP BADBRK 2648 2649 BREAKOK: 0 00002287 A3[1600] mov word [deviceafter], ax ; for multi device drivers 0 0000228A C516[0000] LDS DX,[ENTRY_POINT] ;SET DS:DX TO HEADER 2652 assume ds:nothing 0 0000228E 89D6 MOV SI,DX 0 00002290 83C604 ADD SI,SDEVATT ;DS:SI POINTS TO ATTRIBUTES 0 00002293 2EC43E[0000] LES DI,[CS:DOSINFO] ;ES:DI POINT TO DOS INFO 2656 assume es:DOSGROUP 0 00002298 8B04 MOV AX,[SI] ;GET ATTRIBUTES 0 0000229A A90080 TEST AX,DEVTYP ;TEST IF BLOCK DEV 0 0000229D 7425 JZ ISBLOCK 0 0000229F E8[0000] invoke Set_Break ; Go ahead and alloc mem for device 0 000022A2 7303E974FF jc Erase_Dev_do ;device driver's Init routien failed. 0 000022A7 A90100 TEST AX,ISCIN ;IS IT A CONSOLE IN? 0 000022AA 7408 JZ TRYCLK 0 000022AC 2689550C MOV WORD PTR [ES:DI + SYSI_CON],DX 0 000022B0 268C5D0E MOV WORD PTR [ES:DI + SYSI_CON+2],DS 2666 0 000022B4 A90800 TRYCLK: TEST AX,ISCLOCK ;IS IT A CLOCK DEVICE? 0 000022B7 7408 JZ GOLINK 0 000022B9 26895508 MOV WORD PTR [ES:DI+SYSI_CLOCK],DX 0 000022BD 268C5D0A MOV WORD PTR [ES:DI+SYSI_CLOCK+2],DS 0 000022C1 E93401 GOLINK: JMP LINKIT 2672 2673 ISBLOCK: 0 000022C4 2EA0[0000] MOV AL,[CS:UNITCOUNT] ;IF NO UNITS FOUND, erase the device 0 000022C8 08C0 OR AL,AL 0 000022CA 7503E94CFF jz Erase_Dev_do 2677 ; JNZ PERDRV 2678 ; MOV AX, -1 2679 ; JMP ENDDEV 2680 2681 PERDRV: 0 000022CF B400 mov ah, 0 0 000022D1 89C1 MOV CX,AX 0 000022D3 88E6 MOV DH,AH 0 000022D5 268A5520 MOV DL,[ES:DI + SYSI_NUMIO] ;GET NUMBER OF DEVICES 0 000022D9 2E8816[2100] mov byte [cs:devicefirstnewdrive], dl 0 000022DE 88D4 MOV AH,DL 0 000022E0 00C4 ADD AH,AL ; Check for too many devices 0 000022E2 80FC1A CMP AH,26 ; 'A' - 'Z' is 26 devices 0 000022E5 760B JBE OK_BLOCK 2691 BadNumBlock: ;AN017; 0 000022E7 0E PUSH CS 0 000022E8 1F POP DS 2694 assume ds:SYSINITGROUP 0 000022E9 BA[0000] MOV DX,OFFSET BADBLOCK 0 000022EC E8[0000] invoke PRINT 0 000022EF E929FF JMP ERASE_DEV_do 2698 2699 OK_BLOCK: 2700 assume ds:nothing 0 000022F2 E8[0000] invoke SET_BREAK ; Alloc the device 0 000022F5 26004520 ADD [ES:DI + SYSI_NUMIO],AL ;UPDATE THE AMOUNT 2703 DriveNumber equ DRIVENUMBER ; NASM port label 0 000022F9 2E0006[0000] ADD [CS:DriveNumber],AL ; remember amount for next device 0 000022FE 2EC51E[0000] LDS BX,[CS:BPB_ADDR] ;POINT TO BPB ARRAY 2706 assume ds:nothing 2707 sysconf_PERUNIT: 0 00002303 2EFE06[2000] inc byte [cs:deviceamountnew] 0 00002308 2EC42E[0000] LES BP,[CS:DOSINFO] 2710 assume es:DOSGROUP 0 0000230D 26C46E00 LES BP,[ES:BP + SYSI_DPB] ;GET FIRST DPB 2712 assume es:DPB 2713 2714 DPB_NEXT_DPB equ dpb_next_dpb ; NASM port equate 0 00002311 26837E19FF SCANDPB:CMP WORD PTR [ES:BP + DPB_NEXT_DPB],-1 0 00002316 7406 JZ FOUNDPB 0 00002318 26C46E19 LES BP,[ES:BP + DPB_NEXT_DPB] 0 0000231C EBF3 JMP SCANDPB 2719 FOUNDPB: 0 0000231E 52 push dx 0 0000231F 53 push bx 0 00002320 51 push cx 2723 0 00002321 1E push ds 0 00002322 56 push si 0 00002323 06 push es 0 00002324 57 push di 2728 0 00002325 2EC43E[1800] les di, [cs:devicelastdpb] 2730 assume es:nothing 0 0000232A 83FFFF cmp di, -1 0 0000232D 750B jne .try_extend 2733 .alloc: 0 0000232F B82100 mov ax, DPBSIZ 0 00002332 BE[0000] mov si, alloc_dpb_no_hma 0 00002335 E8[0000] call allocate_relocate_block 0 00002338 EB03 jmp @F 2738 2739 .try_extend: 0 0000233A 83C721 add di, DPBSIZ 2741 @@: 0 0000233D 2E893E[1800] mov word [cs:devicelastdpb], di 0 00002342 2E8C06[1A00] mov word [cs:devicelastdpb + 2], es 2744 0 00002347 2E833E[1C00]FF cmp word [cs:devicefirstnewdpb], -1 0 0000234D 750A jne .gotfirst 0 0000234F 2E893E[1C00] mov word [cs:devicefirstnewdpb], di 0 00002354 2E8C06[1E00] mov word [cs:devicefirstnewdpb + 2], es 2749 .gotfirst: 2750 0 00002359 8D4D0F lea cx, [di + 15] 0 0000235C D1E9 shr cx, 1 0 0000235E D1E9 shr cx, 1 0 00002360 D1E9 shr cx, 1 0 00002362 D1E9 shr cx, 1 ; old size (must succeed) 2756 0 00002364 8D5D30 lea bx, [di + DPBSIZ + 15] 0 00002367 D1EB shr bx, 1 0 00002369 D1EB shr bx, 1 0 0000236B D1EB shr bx, 1 0 0000236D D1EB shr bx, 1 ; new size 0 0000236F B44A mov ah, 4Ah 0 00002371 CD21 int 21h ; can we have it ? 0 00002373 7314 jnc .extended ; yes --> 0 00002375 89CB mov bx, cx 0 00002377 B44A mov ah, 4Ah 0 00002379 CD21 int 21h ; restore to old size 0 0000237B 8CC0 mov ax, es 0 0000237D 48 dec ax 0 0000237E 8EC0 mov es, ax 2771 assume es:MCB 0 00002380 26C70601000800 mov word [es:mcbOwner], 8 ; reset owner 0 00002387 EBA6 jmp .alloc 2774 2775 .extended: 0 00002389 8CC0 mov ax, es 0 0000238B 48 dec ax 0 0000238C 8EC0 mov es, ax 2779 assume es:MCB 0 0000238E 26C70601000800 mov word [es:mcbOwner], 8 ; reset owner 2781 0 00002395 5F pop di ;AN004; 0 00002396 07 pop es ;AN004; 2784 assume es:DPB 0 00002397 5E pop si ;AN004; 0 00002398 1F pop ds ;AN004; 2787 assume ds:nothing, es:DPB 2788 0 00002399 59 pop cx 0 0000239A 5B pop bx 0 0000239B 5A pop dx 2792 0 0000239C 2EA1[1800] MOV AX,[cs:devicelastdpb] 0 000023A0 26894619 MOV WORD PTR [ES:BP + DPB_NEXT_DPB],AX 0 000023A4 2EA1[1A00] MOV AX,[cs:devicelastdpb + 2] 0 000023A8 2689461B MOV WORD PTR [ES:BP + DPB_NEXT_DPB+2],AX 0 000023AC 2EC42E[1800] LES BP,[cs:devicelastdpb] 0 000023B1 26834E19FF or WORD PTR [ES:BP + DPB_NEXT_DPB],-1 2799 DPB_FIRST_ACCESS equ dpb_first_access ; NASM port equate 0 000023B6 26C64618FF MOV byte [ES:BP + DPB_FIRST_ACCESS],-1 2801 assume es:DPB 2802 0 000023BB 8B37 MOV SI,[BX] ;DS:SI POINTS TO BPB 0 000023BD 43 INC BX 0 000023BE 43 INC BX ;POINT TO NEXT GUY 2806 DPB_DRIVE equ dpb_drive ; NASM port equate 0 000023BF 26895600 MOV WORD PTR [ES:BP + DPB_DRIVE],DX 2808 SETDPB equ SetDPB ; NASM port equate 0 000023C3 B453 MOV AH,SETDPB ;HIDDEN SYSTEM CALL 0 000023C5 CD21 INT 21H 2811 DPB_SECTOR_SIZE equ dpb_sector_size ; NASM port equate 0 000023C7 268B4602 MOV AX,[ES:BP + DPB_SECTOR_SIZE] 0 000023CB 06 PUSH ES 0 000023CC 2EC43E[0000] LES DI,[CS:DOSINFO] ;ES:DI POINT TO DOS INFO 2815 assume es:DOSGROUP 0 000023D1 263B4510 CMP AX,[ES:DI + SYSI_MAXSEC] 0 000023D5 07 POP ES 2818 assume es:DPB 0 000023D6 7764 ja Bad_BPB_Size_Sector 0 000023D8 1E PUSH DS 0 000023D9 52 PUSH DX 0 000023DA 2EC516[0000] LDS DX,[CS:ENTRY_POINT] 2823 assume ds:nothing 2824 DPB_DRIVER_ADDR equ dpb_driver_addr ; NASM port equate 0 000023DF 26895613 MOV WORD PTR [ES:BP + DPB_DRIVER_ADDR],DX 0 000023E3 268C5E15 MOV WORD PTR [ES:BP + DPB_DRIVER_ADDR+2],DS 0 000023E7 5A POP DX 0 000023E8 1F POP DS 2829 assume ds:nothing 0 000023E9 42 INC DX 0 000023EA FEC6 INC DH 0 000023EC E207 LOOP j_sysconf_PERUNIT 0 000023EE 0E PUSH CS 0 000023EF 1F POP DS 2835 assume ds:SYSINITGROUP 0 000023F0 E8[0000] CALL TEMPCDS_after_block_device 2837 ; Set CDS for new drives 0 000023F3 EB03 jmp LINKIT 2839 2840 j_sysconf_PERUNIT: 0 000023F5 E90BFF jmp sysconf_PERUNIT 2842 2843 LINKIT: 0 000023F8 2EC43E[0000] LES DI,[CS:DOSINFO] ;ES:DI = DOS TABLE 2845 assume es:DOSGROUP 0 000023FD 268B4D22 MOV CX,WORD PTR [ES:DI + SYSI_DEV] ;DX:CX = HEAD OF LIST 0 00002401 268B5524 MOV DX,WORD PTR [ES:DI + SYSI_DEV+2] 2848 0 00002405 2EC536[0000] LDS SI,[CS:ENTRY_POINT] ;DS:SI = DEVICE LOCATION 2850 assume ds:nothing 0 0000240A 26897522 MOV WORD PTR [ES:DI + SYSI_DEV],SI ;SET HEAD OF LIST IN DOS 0 0000240E 268C5D24 MOV WORD PTR [ES:DI + SYSI_DEV+2],DS 0 00002412 8B04 MOV AX,[SI] ;GET POINTER TO NEXT DEVICE 0 00002414 2EA3[0000] MOV WORD PTR [CS:ENTRY_POINT],AX ;AND SAVE IT 2855 0 00002418 890C MOV WORD PTR [SI],CX ;LINK IN THE DRIVER 0 0000241A 895402 MOV WORD PTR [SI+2],DX 2858 ENDDEV: 0 0000241D 5E POP SI 0 0000241E 07 POP ES 2861 assume es:nothing 0 0000241F 40 INC AX ;AX = FFFF (no more devs if YES)? 0 00002420 7409 JZ COFFJ3 0 00002422 2EC606[0000]FF mov byte [cs:MultDeviceFlag], -1 ;AN001; Possibly multiple device driver. 0 00002428 E904FD JMP GOODLD ;OTHERWISE PRETEND WE LOADED IT IN 2866 COFFJ3: 0 0000242B 2EC606[0000]00 mov byte [cs:MultDeviceFlag], 0 ;AN001; Reset the flag 2868 2869 COFF_relocate: 0 00002431 06 push es 0 00002432 B8FFFF mov ax, -1 0 00002435 E8[0000] call init2_relocate_device 0 00002438 07 pop es 2874 assume es:nothing 0 00002439 E946F7 JMP COFF 2876 2877 Bad_BPB_Size_Sector: 0 0000243C 5E POP SI 0 0000243D 07 POP ES 2880 assume es:nothing 0 0000243E BA[0000] MOV DX,OFFSET BADSIZ_PRE 2882 ; MOV BX,OFFSET BADSIZ_POST 0 00002441 BB[0000] mov bx, offset CRLFM ;AN???; 0 00002444 E8[0000] invoke PRNERR 2885 %if 0 ; flag is never clear here 2886 test byte [SetDevMarkFlag],SETBRKDONE ;AN004;If already Set_Break is done, 2887 jnz Skip2_ResetMEMHI ;AN004; then do not 2888 ; dec word [MEMHI] ;AN004;Adjust MEMHI by a paragrah of DEVMARK. 2889 call release_device_memory 2890 Skip2_ResetMEMHI: 2891 %endif 0 00002447 E938F7 JMP COFF 2893 2894 2895 ;------------------------------------------------------------------------------ 2896 ; Country command 2897 ; J.K. The syntax is: 2898 ; COUNTRY=country id {,codepage {,path}} 2899 ; COUNTRY=country id {,,path} :Default CODEPAGE ID in DOS 2900 ;------------------------------------------------------------------------------ 2901 TRYQ: 0 0000244A 80FC51 CMP AH,'Q' 0 0000244D 7403 JZ TRYQ_CONT 0 0000244F E93A01 JMP TRYF 2905 TRYQ_CONT: 2906 2907 ; invoke GETNUM 2908 ; JZ TryQBad ; 0 is never a valid code, or number is 2909 ; ; bad 2910 ; MOV BX,AX ; Country code in BX 2911 ; 2912 ; ;J.K. 5/26/86 2913 ; MOV DX,0 ; assume no code page id 2914 ; 2915 ; invoke skip_delim ;skip the delimeters after the first num 2916 ; jc TryQ_Def_File ;no more characters left? then use default file 2917 ; cmp al, CR ; 2918 ; je TryQ_Def_File 2919 ; cmp al, LF 2920 ; jne TRYQ_YES_EXTENDED 2921 ; inc [COUNT] ;This is for NEWLINE routine in COFF. 2922 ; dec [CHRPTR] 2923 ;COFFJ41: 2924 ; JMP TryQ_Def_File ;O.K. no code page, no path specified. Use default path. 2925 ; 2926 ;TRYQ_YES_EXTENDED: 2927 ; cmp al, ',' ;was the second comma? 2928 ; jne TryQ_GETNUM 2929 ; invoke skip_delim ;Yes, skip ',' and other possible delim 2930 ; jmp short TRYQ_PATH ;and No code page id entered. 2931 ;TRYQ_GETNUM: 2932 ; invoke GETNUM 2933 ; jc TryQBadCOM ;"Country=xxx,path" will not be accepted. 2934 ;; jc TRYQ_PATH ;Codepage is not specified. No code page. 2935 ;; ;At this point, AL already contain the 2936 ;; ;first char of the PATH. 2937 ; jz TryQBad ;codepage=0 entered. Error 2938 ; mov DX, AX ;save code page in DX 2939 ; invoke skip_delim ;move CHRPTR to the path string 2940 ; jc TryQ_Def_File ;no more char? then use default filename 2941 ; cmp al, CR 2942 ; je TryQ_Def_File 2943 ; cmp al, LF 2944 ; jne TryQ_PATH ;path entered. 2945 ; inc [COUNT] 2946 ; dec [CHRPTR] 2947 ;TryQ_Def_File: 2948 ; push dx ;save code page 2949 ; mov cs:CNTRY_DRV, 0 ;flag that the default path has been used!!! 2950 ; mov dx, offset CNTRY_ROOT ;the default path 2951 ; jmp TRYQ_OPEN 2952 ; 2953 ;TryQBad: ;"Invalid country code or code page" 2954 ; STC 2955 ; MOV DX,OFFSET BADCOUNTRY 2956 ; jmp TryQChkErr 2957 ; 2958 ;TryQBadCOM: ;Error in COUNTRY command 2959 ; STC 2960 ; MOV DX,OFFSET BADCOUNTRYCOM 2961 ; jmp TryQChkErr 2962 ; 2963 ;TRYQ_PATH: ;DS - sysinitseg, ES - CONFBOT, 2964 ; mov CX, [COUNT] ;AL - the first char of path 2965 ; inc CX ;BX - country id, DX - codepage id, 0 = No code page 2966 ; mov DI, SI 2967 ;TRYQ_PATH_LOOP: ;find the end of path to put 0 after that. 2968 ; mov AL, byte ptr [ES:DI] 2969 ; call delim 2970 ; jz TRYQ_PATH_END 2971 ; cmp al, 13 2972 ; jz TRYQ_PATH_END 2973 ; inc DI 2974 ; jmp short TRYQ_PATH_LOOP 2975 ;TryQBad_Brg:jmp short TryQBad 2976 ;TRYQ_PATH_END: 2977 ; mov byte ptr [es:di], 0 ;make it a ASCIIZ string. (Organize did not handle this string) 2978 ; push ds ;switch ds,es 2979 ; push es 2980 ; pop ds 2981 ; pop es 2982 ; 2983 ; mov di, offset CNTRY_DRV ;move the user specified path to CNTRY_DRV 2984 ; call Move_ASCIIZ 2985 ; 2986 ; push ds ;restore ds,es 2987 ; push es 2988 ; pop ds 2989 ; pop es 2990 ; 2991 ;; call Set_Country_Path ;set CNTRY_DRV 2992 ; 2993 ; push dx ;save DX 2994 ; mov dx, offset CNTRY_DRV ;Now DS:DX -> CNTRY_DRV 2995 2996 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 00002452 C606[0000]00 mov byte [Cntry_Drv], 0 ;AN000; Reset the drive,path to default value. 0 00002457 C706[F90C]0000 mov word [P_Code_Page],0 ;AN000; 0 0000245D BF[C20C] mov di, offset Cntry_Parms ;AN000; 0 00002460 31C9 xor cx,cx ;AN000; 0 00002462 89CA mov dx,cx ;AN000; 3002 ; $SEARCH ;AN000; 3003 DD_DO49: 0 00002464 E82DF9 call Sysinit_Parse ;AN000; 3005 ; $EXITIF C ;AN000; Parse error, check the error code and 0 00002467 730B JNC DD_IF49 0 00002469 E80C01 call Cntry_Error ;AN000; Show message and end the serach loop. 0 0000246C C706[F70C]FFFF mov word [P_Cntry_Code], -1 ;AN000; Signals that parse error. 3009 ; $ORELSE ;AN000; 0 00002472 EB34 JMP SHORT DD_SR49 3011 DD_IF49: 0 00002474 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 3013 ; $LEAVE E ;AN000; then end the $SEARCH LOOP 0 00002477 742F JE DD_EN49 3015 D_P_NUMBER equ D_P_Number ; NASM port equate 3016 D_P_TYPE equ D_P_Type ; NASM port equate 0 00002479 803E[940C]01 cmp byte [Result_Val + D_P_TYPE], D_P_NUMBER ;AN000; Numeric? 3018 ; $IF E ;AN000; 0 0000247E 7512 JNE DD_IF53 0 00002480 A1[980C] mov ax, word ptr [Result_Val + D_P_PICKED_VAL] ;AN000; 0 00002483 83F901 cmp cx, 1 ;AN000; 3022 ; $IF E ;AN000; 0 00002486 7505 JNE DD_IF54 0 00002488 A3[F70C] mov [P_Cntry_Code], ax ;AN000; 3025 ; $ELSE ;AN000; 0 0000248B EB03 JMP SHORT DD_EN54 3027 DD_IF54: 0 0000248D A3[F90C] mov [P_Code_Page], ax ;AN000; 3029 ; $ENDIF ;AN000; 3030 DD_EN54: 3031 ; $ELSE ;AN000; Path entered. 0 00002490 EB14 JMP SHORT DD_EN53 3033 DD_IF53: 0 00002492 1E push ds ;AN000; 0 00002493 06 push es ;AN000; 0 00002494 56 push si ;AN000; 0 00002495 57 push di ;AN000; 0 00002496 0E push cs ;AN000; 0 00002497 07 pop es ;AN000; 3040 assume es:SYSINITGROUP 0 00002498 C536[980C] lds si, [RV_Dword] ;AN000; Move the path to known place. 3042 assume ds:nothing 3043 CNTRY_Drv equ Cntry_Drv ; NASM port label 0 0000249C BF[0000] mov di, offset CNTRY_Drv ;AN000; access with es 0 0000249F E8[0000] call Move_ASCIIZ ;AN000; 0 000024A2 5F pop di ;AN000; 0 000024A3 5E pop si ;AN000; 0 000024A4 07 pop es ;AN000; 0 000024A5 1F pop ds ;AN000; 3050 assume ds:SYSINITGROUP, es:nothing, ss:nothing 3051 ; $ENDIF ;AN000; 3052 DD_EN53: 3053 ; $ENDLOOP 0 000024A6 EBBC JMP SHORT DD_DO49 3055 DD_EN49: 3056 ; $ENDSRCH ;AN000; 3057 DD_SR49: 0 000024A8 833E[F70C]FF cmp word [P_Cntry_Code], -1 ;AN000; Had a parse error? 0 000024AD 750A jne TRYQ_OPEN ;AN000; 0 000024AF E9D0F6 jmp Coff ;AN000; 3061 3062 TryQBad: ;"Invalid country code or code page" 0 000024B2 F9 STC 0 000024B3 BA[0000] MOV DX,OFFSET BADCOUNTRY 0 000024B6 E99100 jmp TryQChkErr 3066 3067 TRYQ_OPEN: 0 000024B9 803E[0000]00 cmp byte [CNTRY_Drv], 0 ;AC000; 0 000024BE 7406 je TRYQ_Def ;AC000; 0 000024C0 BA[0000] mov dx, offset CNTRY_Drv ;AC000; 0 000024C3 EB04 jmp TryQ_Openit ;AC000; 0 000024C5 90 nop ; identicalise 3073 TRYQ_Def: ;AC000; 3074 CNTRY_Root equ Cntry_Root ; NASM port label 0 000024C6 BA[0000] mov dx, offset CNTRY_Root ;AC000; 3076 TryQ_Openit: 0 000024C9 B8003D mov ax, 3d00h ;open a file 0 000024CC F9 stc 0 000024CD CD21 int 21h 0 000024CF 7257 jc TryQFileBad ;open failure 3081 3082 CntryFileHandle equ CNTRYFILEHANDLE ; NASM port label 0 000024D1 2EA3[0000] mov [cs:CntryFileHandle], ax ;save file handle 0 000024D5 89C3 mov bx, ax 0 000024D7 2EA1[F70C] mov ax, [cs:P_Cntry_Code] ;AN000; 0 000024DB 2E8B16[F90C] mov dx, [cs:P_Code_Page] ;AN000; Now, AX=country id, bx=filehandle 3087 ; xchg ax, bx ;now, AX = country id, BX = file handle 3088 0 000024E0 50 push ax 0 000024E1 53 push bx 0 000024E2 52 push dx 0 000024E3 1E push ds 0 000024E4 06 push es 0 000024E5 BE[0000] mov si, alloc_init 0 000024E8 B80008 mov ax, 2048 ;I need 2K buffer to handle COUNTRY.SYS 0 000024EB 31D2 xor dx, dx 0 000024ED E8[0000] call allocate_temporary_block.large_allow_error 0 000024F0 8CC1 mov cx, es 0 000024F2 07 pop es 0 000024F3 1F pop ds 3101 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 000024F4 5A pop dx 0 000024F5 5B pop bx 0 000024F6 58 pop ax 0 000024F7 724D jc TryQMemory ;cannot allocate the buffer for country.sys 0 000024F9 2E890E[0800] mov word [cs:country_block], cx 3107 3108 CNTRY_DRV equ Cntry_Drv ; NASM port label 0 000024FE BE[0000] mov si, offset CNTRY_DRV ;DS:SI -> CNTRY_DRV 0 00002501 803C00 cmp byte ptr [si],0 ;default path? 0 00002504 7502 jne TRYQ_Set_for_DOS 0 00002506 46 inc si 0 00002507 46 inc si ;DS:SI -> CNTRY_ROOT 3114 TRYQ_Set_for_DOS: 3115 SYSI_Country equ SYSI_COUNTRY ; NASM port label 0 00002508 2EC43E[0000] les di, [cs:SYSI_Country] ;ES:DI -> country info tab in DOS 3117 assume es:DOSGROUP 0 0000250D 57 push di ;save di 0 0000250E 83C708 add di, ccPath_CountrySys 3120 MOVE_ASCIIZ equ Move_ASCIIZ ; NASM port label 0 00002511 E8[0000] call MOVE_ASCIIZ ;Set the path to COUNTRY.SYS in DOS. 0 00002514 5F pop di ;ES:DI -> country info tab again. 0 00002515 2E8B0E[0800] mov cx, word [cs:country_block] 0 0000251A 8ED9 mov ds, cx 3125 assume ds:nothing 0 0000251C 31F6 xor si, si ;DS:SI -> 2K buffer to be used. 0 0000251E E8[0000] call SetDOSCountryInfo ;now do the job!!! 3128 TryQchkERR equ TryQChkErr ; NASM port label 0 00002521 7327 jnc TryQchkERR ;read error or could not find country,code page combination 0 00002523 83F9FF cmp cx, -1 ;Could not find matching country_id,code page? 0 00002526 748A je TryQBad ;then "Invalid country code or code page" 3132 TryQFileBad: 0 00002528 0E push cs ;AN000; 0 00002529 07 pop es ;AN000; 3135 assume es:SYSINITGROUP 0 0000252A 2E803E[0000]00 cmp byte [cs:CNTRY_DRV],0 ;Is the default file used? 0 00002530 7405 je TryQDefBad 3138 ; mov si, [cs:CONFBOT] 3139 ; mov es, si 3140 ; mov si, [cs:CHRPTR] 3141 ; dec si ;ES:SI -> path in CONFBOT 0 00002532 BE[0000] mov si, offset CNTRY_Drv 0 00002535 EB03 jmp short TryQBADLOAD 3144 TryQDefBad: ;Default file has been used. 3145 ; push cs 3146 ; pop es 3147 CNTRY_ROOT equ Cntry_Root ; NASM port label 0 00002537 BE[0000] mov si, offset CNTRY_ROOT ;ES:SI -> \COUNTRY.SYS in SYSINIT_SEG 3149 TryQBADLOAD: 0 0000253A E8[0000] call BADLOAD ;DS will be restored to SYSINIT_SEG 0 0000253D 2E8B0E[0000] mov cx, [cs:config_block] 0 00002542 8EC1 mov es, cx ;Restore ES -> CONFBOT. 3153 assume es:nothing 0 00002544 EB15 jmp short CoffJ4 3155 TryQMemory: 0 00002546 F9 stc 0 00002547 BA[0000] MOV DX,OFFSET INSUFMEMORY 3158 TryQChkErr: 0 0000254A 2E8B0E[0000] mov cx, [cs:config_block] 0 0000254F 8EC1 mov es, cx ;restore ES -> CONFBOT seg 3161 assume es:nothing 0 00002551 0E push cs 0 00002552 1F pop ds ;retore DS to SYSINIT_SEG 3164 assume ds:SYSINITGROUP 0 00002553 7306 jnc CoffJ4 ;if no error, then exit 0 00002555 E8[0000] invoke PRINT ;else show error message 0 00002558 E87402 call Error_Line ;AN000; 3168 CoffJ4: 0 0000255B 31C0 xor ax, ax 0 0000255D 8706[0800] xchg ax, word [country_block] 0 00002561 85C0 test ax, ax 0 00002563 7408 jz @F 0 00002565 06 push es 0 00002566 8EC0 mov es, ax 3175 assume es:nothing 0 00002568 B449 mov ah, 49h 0 0000256A CD21 int 21h 0 0000256C 07 pop es 3179 assume es:nothing 3180 @@: 0 0000256D 8B1E[0000] mov bx, [CntryFileHandle] 0 00002571 B43E mov ah, 3eh 0 00002573 CD21 int 21h ;close a file. Don't care even if it fails. 0 00002575 E90AF6 JMP COFF 3185 3186 Cntry_Error proc near 3187 assume ds:SYSINITGROUP, es:nothing, ss:nothing 3188 ;Function: Show "Invalid country code or code page" messages, or 3189 ; "Error in COUNTRY command" depending on the error code 3190 ; in AX returned by SYSPARSE; 3191 ;In: AX - error code 3192 ; DS - Sysinitseg 3193 ; ES - CONFBOT 3194 ;Out: Show message. DX destroyed. 3195 3196 D_P_OUT_OF_RANGE equ D_P_Out_Of_Range ; NASM port equate 0 00002578 83F806 cmp ax, D_P_OUT_OF_RANGE 3198 ; $IF E 0 0000257B 7505 JNE DD_IF61 3200 BadCountry equ BADCOUNTRY ; NASM port label 0 0000257D BA[0000] mov dx, offset BadCountry ;"Invalid country code or code page" 3202 ; $ELSE 0 00002580 EB03 JMP SHORT DD_EN61 3204 DD_IF61: 3205 BadCountryCom equ BADCOUNTRYCOM ; NASM port label 0 00002582 BA[0000] mov dx, offset BadCountryCom ;"Error in CONTRY command" 3207 ; $ENDIF 3208 DD_EN61: 0 00002585 E8[0000] invoke Print 0 00002588 E84402 call Error_Line 0 0000258B C3 ret 3212 Cntry_Error endp 3213 3214 ;------------------------------------------------------------------------------ 3215 ; Files command 3216 ;------------------------------------------------------------------------------ 3217 ;******************************************************************************* 3218 ; Function: Parse the parameters of FILES= command. * 3219 ; * 3220 ; Input : * 3221 ; ES:SI -> parameters in command line. * 3222 ; Output: * 3223 ; Variable FILES set. * 3224 ; * 3225 ; Subroutines to be called: * 3226 ; Sysinit_Parse * 3227 ; Logic: * 3228 ; { * 3229 ; Set DI points to FILES_Parms; * 3230 ; Set DX,CX to 0; * 3231 ; While (End of command line) * 3232 ; { Sysinit_parse; * 3233 ; if (no error) then * 3234 ; Files = Result_Val.D_P_Picked_Val * 3235 ; else * 3236 ; Error Exit; * 3237 ; }; * 3238 ; }; * 3239 ; * 3240 ;******************************************************************************* 3241 TRYF: 0 0000258C 80FC46 CMP AH,'F' 0 0000258F 7527 JNZ TRYL 3244 3245 ; invoke GETNUM 3246 ; CMP AX,5 ;j.k. change it to 8!!!!!!!! 3247 ; JB TryFBad ; Gotta have at least 5 3248 ; CMP AX,256 3249 ; JAE TryFBad ; Has to be a byte 3250 ; MOV [FILES],AL 3251 ;CoffJ5: JMP COFF 3252 ;TryFBad:JMP BadOp 3253 0 00002591 BF[FB0C] mov di, offset Files_Parms ;AN000; 0 00002594 31C9 xor cx, cx ;AN000; 0 00002596 89CA mov dx, cx ;AN000; 3257 3258 ; $SEARCH ;AN000; 3259 DD_DO64: 0 00002598 E8F9F7 call Sysinit_Parse ;AN000; 3261 ; $EXITIF C ;AN000; Parse Error, 0 0000259B 7305 JNC DD_IF64 0 0000259D E8B4F3 call Badparm_p ;AN007; and Show messages and end the search loop. 3264 ; $ORELSE ;AN000; 0 000025A0 EB13 JMP SHORT DD_SR64 3266 DD_IF64: 0 000025A2 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 3268 ; $LEAVE E ;AN000; then end the $ENDLOOP 0 000025A5 7408 JE DD_EN64 0 000025A7 A0[980C] mov al, byte ptr [Result_Val + D_P_PICKED_VAL] ;AN000; 0 000025AA A2[1A0D] mov [P_Files], al ;AN000; Save it temporarily 3272 ; $ENDLOOP ;AN000; 0 000025AD EBE9 JMP SHORT DD_DO64 3274 DD_EN64: 0 000025AF A0[1A0D] mov al, [P_Files] ;AN000; 3276 Files equ FILES ; NASM port label 0 000025B2 A2[0000] mov [Files], al ;AN000; No error. Really set the value now. 3278 ; $ENDSRCH ;AN000; 3279 DD_SR64: 0 000025B5 E9CAF5 jmp Coff 3281 3282 ;------------------------------------------------------------------------------ 3283 ; LastDrive command 3284 ;------------------------------------------------------------------------------ 3285 ;******************************************************************************* 3286 ; Function: Parse the parameters of LASTDRIVE= command. * 3287 ; * 3288 ; Input : * 3289 ; ES:SI -> parameters in command line. * 3290 ; Output: * 3291 ; Set the variable NUM_CDS. * 3292 ; * 3293 ; Subroutines to be called: * 3294 ; Sysinit_Parse * 3295 ; Logic: * 3296 ; { * 3297 ; Set DI points to LDRV_Parms; * 3298 ; Set DX,CX to 0; * 3299 ; While (End of command line) * 3300 ; { Sysinit_Parse; * 3301 ; if (no error) then * 3302 ; Set NUM_CDS to the returned value; * 3303 ; else /*Error exit*/ * 3304 ; Error Exit; * 3305 ; }; * 3306 ; }; * 3307 ; * 3308 ;******************************************************************************* 3309 TRYL: 0 000025B8 80FC4C CMP AH,'L' 0 000025BB 7527 JNZ TRYP 3312 3313 ; OR AL,020h 3314 ; SUB AL,'a' 3315 ; JB TryLBad 3316 ; INC AL 3317 ; CMP AL,26 ; a-z are allowed 3318 ; JA TryLBad 3319 ; MOV [NUM_CDS],AL 3320 ;CoffJ6: JMP COFF 3321 ;TryLBad:JMP BadOp 3322 0 000025BD BF[520D] mov di, offset LDRV_Parms ;AN000; 0 000025C0 31C9 xor cx, cx ;AN000; 0 000025C2 89CA mov dx, cx ;AN000; 3326 3327 ; $SEARCH ;AN000; 3328 DD_DO70: 0 000025C4 E8CDF7 call Sysinit_Parse ;AN000; 3330 ; $EXITIF C ;AN000; Parse Error, 0 000025C7 7305 JNC DD_IF70 0 000025C9 E888F3 call Badparm_p ;AN007; and Show messages and end the search loop. 3333 ; $ORELSE ;AN000; 0 000025CC EB13 JMP SHORT DD_SR70 3335 DD_IF70: 0 000025CE 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 3337 ; $LEAVE E ;AN000; then end the $ENDLOOP 0 000025D1 7408 JE DD_EN70 0 000025D3 A0[980C] mov al, [RV_Byte] ;AN000; Pick up the drive number 0 000025D6 A2[660D] mov [P_Ldrv], al ;AN000; Save it temporarily 3341 ; $ENDLOOP ;AN000; 0 000025D9 EBE9 JMP SHORT DD_DO70 3343 DD_EN70: 0 000025DB A0[660D] mov al, [P_Ldrv] ;AN000; 3345 ; sub al, 'A' ;AN000; Convert it to drive number 3346 ; inc al ;AN000; make it to be a number of drives. 3347 Num_CDS equ NUM_CDS ; NASM port label 0 000025DE A2[0000] mov [Num_CDS], al ;AN000; No error. Really set the value now. 3349 ; $ENDSRCH ;AN000; 3350 DD_SR70: 0 000025E1 E99EF5 jmp Coff 3352 3353 3354 ;------------------------------------------------------------------------------- 3355 ; Setting Drive Parameters 3356 ;------------------------------------------------------------------------------- 3357 TRYP: 0 000025E4 80FC50 CMP AH,'P' 0 000025E7 7513 JNZ TRYK 0 000025E9 E8[0000] invoke PARSELINE 0 000025EC 720B JC TryPBad 0 000025EE E8[0000] invoke SETPARMS 0 000025F1 E8[0000] INVOKE sysinit_DIDDLEBACK 0 000025F4 7203 jc TryPBad 0 000025F6 E989F5 JMP COFF 3366 Badop equ BADOP ; NASM port label 0 000025F9 E940F3 TryPBad:jmp Badop 3368 ;------------------------------------------------------------------------------- 3369 ; Setting Internal Stack Parameters 3370 ; STACKS=M,N where 3371 ; M is the number of stacks (range 8 to 64, default 9) 3372 ; N is the stack size (range 32 to 512 bytes, default 128) 3373 ; J.K. 5/5/86: STACKS=0,0 implies no stack installation. 3374 ; Any combinations that are not within the specified limits will 3375 ; result in "Unrecognized command" error. 3376 ;------------------------------------------------------------------------------- 3377 ;******************************************************************************* 3378 ; * 3379 ; Function: Parse the parameters of STACKS= command. * 3380 ; The minimum value for "number of stacks" and "stack size" is * 3381 ; 8 and 32 each. In the definition of SYSPARSE value list, they * 3382 ; are set to 0. This is for accepting the exceptional case of * 3383 ; STACKS=0,0 case (,which means do not install the stack.) * 3384 ; So, after SYSPARSE is done, we have to check if the entered * 3385 ; values (STACK_COUNT, STACK_SIZE) are within the actual range, * 3386 ; (or if "0,0" pair has been entered.) * 3387 ; Input : * 3388 ; ES:SI -> parameters in command line. * 3389 ; Output: * 3390 ; Set the variables STACK_COUNT, STACK_SIZE. * 3391 ; * 3392 ; Subroutines to be called: * 3393 ; Sysinit_Parse * 3394 ; Logic: * 3395 ; { * 3396 ; Set DI points to STKS_Parms; * 3397 ; Set DX,CX to 0; * 3398 ; While (End of command line) * 3399 ; { Sysinit_Parse; * 3400 ; if (no error) then * 3401 ; { if (CX == 1) then /* first positional = stack count */ * 3402 ; P_Stack_Count = Result_Val.D_P_Picked_Val; * 3403 ; if (CX == 2) then /* second positional = stack size */ * 3404 ; P_Stack_Size = Result_Val.D_P_Picked_Val; * 3405 ; } * 3406 ; else /*Error exit*/ * 3407 ; Error Exit; * 3408 ; }; * 3409 ; Here check P_STACK_COUNT,P_STACK_SIZE if it meets the condition; * 3410 ; If O.K., then set Stack_Count, Stack_Size; * 3411 ; else Error_Exit; * 3412 ; }; * 3413 ;******************************************************************************* 3414 TRYK: 0 000025FC 80FC4B CMP AH,'K' 0 000025FF 7403 JE Do_TryK 0 00002601 E99100 jmp TRYS 3418 3419 %IF STACKSW 3420 3421 ; MOV SepChr,',' 3422 ; INVOKE GetNum ; Get number of stacks 3423 ; MOV SepChr,0 3424 ; cmp ax, 0 ;J.K. 5/5/86 3425 ; je TRYK_0 ;J.K. Let's accept 0. 3426 ; CMP AX, MinCount ; 8 <= Number of Stacks <= 64 3427 ; JB TryKBad 3428 ; CMP AX, MaxCount 3429 ; JA TryKBad 3430 ;TRYK_0: 3431 ; MOV [STACK_COUNT], AX 3432 ; 3433 ; Skip delimiters after the first number. 3434 ; 3435 ; invoke Skip_delim ;J.K. 3436 ; JC TryKBad 3437 ; 3438 ; INVOKE GetNum ; Get size of individual stack 3439 ; JC TryKBad ; Number bad 3440 ; 3441 ; cmp ax, 0 ;J.K. 5/5/86 3442 ; je TRYK_SIZE0 ;J.K. 5/5/86. Accept 0 3443 ; 3444 ; CMP AX, MinSize ; 32 <= Stack Size <= 512 3445 ; JB TryKBad 3446 ; CMP AX, MaxSize 3447 ; JA TryKBad 3448 ;TRYK_SIZE0: 3449 ; MOV [STACK_SIZE], AX 3450 ; cmp ax,0 3451 ; je TRYK_BOTH0 3452 ;TRYK_OK: 3453 ; mov word ptr [stack_addr], -1 ;set the flag that the user entered stacks= command. 3454 ; JMP COFF 3455 ;TRYK_BOTH0: 3456 ; cmp [STACK_COUNT],0 ;stack_size = 0. Stack_Count = 0 too? 3457 ; je TRYK_OK ;yes. accepted. 3458 ;TryKBad: 3459 ; MOV DX, OFFSET BADSTACK ;J.K. 5/26/86 "Invalid stack parameter" 3460 ; invoke PRINT 3461 ; JMP COFF 3462 3463 Do_TryK: 0 00002604 BF[670D] mov di, offset STKS_Parms ;AN000; 0 00002607 31C9 xor cx, cx ;AN000; 0 00002609 89CA mov dx, cx ;AN000; 3467 3468 ; $SEARCH ;AN000; 3469 DD_DO76: 0 0000260B E886F7 call Sysinit_Parse ;AN000; 3471 ; $EXITIF C ;AN000; Parse Error, 0 0000260E 730B JNC DD_IF76 3473 BadStack equ BADSTACK ; NASM port label 0 00002610 BA[0000] mov dx, offset BadStack ;AN000; "Invalid stack parameter" 0 00002613 E8[0000] call Print ;AN000; and Show messages and end the search loop. 0 00002616 E8B601 call Error_Line ;AN006; 3477 ; $ORELSE ;AN000; 0 00002619 EB77 JMP SHORT DD_SR76 3479 DD_IF76: 0 0000261B 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 3481 ; $LEAVE E ;AN000; then end the $ENDLOOP 0 0000261E 7412 JE DD_EN76 0 00002620 A1[980C] mov ax, word ptr [Result_Val + D_P_PICKED_VAL] ;AN000; 0 00002623 83F901 cmp cx, 1 ;AN000; 3485 ; $IF E ;AN000; 0 00002626 7505 JNE DD_IF80 0 00002628 A3[9C0D] mov [P_Stack_Count], ax ;AN000; 3488 ; $ELSE ;AN000; 0 0000262B EB03 JMP SHORT DD_EN80 3490 DD_IF80: 0 0000262D A3[9E0D] mov [P_Stack_Size], ax ;AN000; 3492 ; $ENDIF ;AN000; 3493 DD_EN80: 3494 ; $ENDLOOP ;AN000; 0 00002630 EBD9 JMP SHORT DD_DO76 3496 DD_EN76: 0 00002632 833E[9C0D]00 cmp word [P_Stack_Count], 0 ;AN000; 3498 ; $IF NE ;AN000; 0 00002637 7416 JE DD_IF84 3500 MINCOUNT equ MinCount ; NASM port equate 0 00002639 833E[9C0D]08 cmp word [P_Stack_Count], MINCOUNT ;AN000; 3502 ; $IF B,OR ;AN000; 0 0000263E 7207 JB DD_LL85 3504 MINSIZE equ MinSize ; NASM port equate 0 00002640 833E[9E0D]20 cmp word [P_Stack_Size], MINSIZE ;AN000; 3506 ; $IF B ;AN000; 0 00002645 7306 JNB DD_IF85 3508 DD_LL85: 0 00002647 C706[9C0D]FFFF mov word [P_Stack_Count], -1 ;AN000; Invalid 3510 ; $ENDIF ;AN000; 3511 DD_IF85: 3512 ; $ELSE ;AN000; 0 0000264D EB0D JMP SHORT DD_EN84 3514 DD_IF84: 0 0000264F 833E[9E0D]00 cmp word [P_Stack_Size], 0 ;AN000; 3516 ; $IF NE ;AN000; 0 00002654 7406 JE DD_IF88 0 00002656 C706[9C0D]FFFF mov word [P_Stack_Count], -1 ;AN000; Invalid 3519 ; $ENDIF ;AN000; 3520 DD_IF88: 3521 ; $ENDIF ;AN000; 3522 DD_EN84: 0 0000265C 833E[9C0D]FF cmp word [P_Stack_Count], -1 ;AN000; Invalid? 3524 ; $IF E ;AN000; 0 00002661 751D JNE DD_IF91 3526 Stack_Count equ stack_count ; NASM port label 3527 DEFAULTCOUNT equ DefaultCount ; NASM port equate 0 00002663 C706[0000]0900 mov word [Stack_Count], DEFAULTCOUNT ;AN000;Reset to default value. 3529 Stack_Size equ stack_size ; NASM port label 3530 DEFAULTSIZE equ DefaultSize ; NASM port equate 0 00002669 C706[0000]8000 mov word [Stack_Size], DEFAULTSIZE ;AN000; 3532 STACK_ADDR equ stack_addr ; NASM port label 0 0000266F C706[0000]0000 mov word [STACK_ADDR], 0 ;AN000; 0 00002675 BA[0000] mov dx, offset BadStack ;AN000; 0 00002678 E8[0000] call Print ;AN000; 0 0000267B E85101 call Error_Line ;AN006; 3537 ; $ELSE ;AN000; 0 0000267E EB12 JMP SHORT DD_EN91 3539 DD_IF91: 0 00002680 A1[9C0D] mov ax, [P_Stack_Count] ;AN000; 0 00002683 A3[0000] mov [Stack_Count], ax ;AN000; 0 00002686 A1[9E0D] mov ax, [P_Stack_Size] ;AN000; 0 00002689 A3[0000] mov [Stack_Size], ax ;AN000; 3544 Stack_Addr equ stack_addr ; NASM port label 0 0000268C C706[0000]FFFF mov word [Stack_Addr], -1 ;AN000;STACKS= been accepted. 3546 ; $ENDIF ;AN000; 3547 DD_EN91: 3548 ; $ENDSRCH ;AN000; 3549 DD_SR76: 0 00002692 E9EDF4 jmp Coff 3551 %ENDIF 3552 ;------------------------------------------------------------------------------ 3553 ; Switch command ;No longer supported. 3554 ;------------------------------------------------------------------------------ 3555 ;TRYW: 3556 ; CMP AH,'W' 3557 ; JNZ TRYA 3558 ; JMP BadOp ; no longer implemented 3559 ; MOV DL,AL 3560 ; MOV AX,(CHAR_OPER SHL 8) OR 1 ;SET SWITCH CHARACTER 3561 ; MOV [COMMAND_LINE+1],DL 3562 ; INT 21H 3563 ; JMP COFF 3564 ;------------------------------------------------------------------------------ 3565 ; Availdev command ;No longer supported. 3566 ;------------------------------------------------------------------------------ 3567 ;TRYA: 3568 ; CMP AH,'A' 3569 ; JNZ TRYS 3570 ; JMP BadOp ; NO LONGER IMPLEMENTED 3571 ; CMP AL,'F' ;FIRST LETTER OF "FALSE" 3572 ; JNZ COFFJ7 3573 ; MOV AX,(CHAR_OPER SHL 8) OR 3 ;TURN ON "/DEV" PREFIX 3574 ; XOR DL,DL 3575 ; INT 21H 3576 ;COFFJ7: JMP COFF 3577 3578 ;------------------------------------------------------------------------------ 3579 ; shell command 3580 ;------------------------------------------------------------------------------ 3581 TRYS: 0 00002695 80FC73 cmp ah, 's' 0 00002698 7508 jne @F 0 0000269A 2EC606[2300]FF mov byte [cs:shellhighflag], -1 0 000026A0 EB0B jmp .shell 3586 @@: 0 000026A2 80FC53 CMP AH,'S' 0 000026A5 7542 JNZ TRYX 0 000026A7 2EC606[2300]00 mov byte [cs:shellhighflag], 0 3590 .shell: 0 000026AD C606[0100]00 MOV byte [COMMAND_LINE+1],0 0 000026B2 BF[0000] MOV DI,OFFSET COMMND 0 000026B5 EB03 jmp @F 3594 STORESHELL: 0 000026B7 E8EF00 CALL GETCHR 3596 @@: 0 000026BA 84C0 test al, al 0 000026BC 7419 JZ GETSHPARMS 0 000026BE 3C20 CMP AL," " 0 000026C0 7205 JB ENDSH 0 000026C2 8805 MOV [DI],AL 0 000026C4 47 INC DI 0 000026C5 EBF0 JMP STORESHELL 3604 3605 ENDSH: 0 000026C7 C60500 MOV BYTE PTR [DI],0 0 000026CA E8DC00 CALL GETCHR 0 000026CD 3C0A CMP AL,LF 0 000026CF 7503 JNZ CONV 0 000026D1 E8D500 CALL GETCHR 0 000026D4 E969F4 CONV: JMP CONFLP 3612 3613 GETSHPARMS: 0 000026D7 C60500 MOV BYTE PTR [DI],0 0 000026DA BF[0100] MOV DI,OFFSET COMMAND_LINE+1 3616 PARMLOOP: 0 000026DD E8C900 CALL GETCHR 0 000026E0 3C20 CMP AL," " 0 000026E2 72E3 JB ENDSH 0 000026E4 8805 MOV [DI],AL 0 000026E6 47 INC DI 0 000026E7 EBF4 JMP PARMLOOP 3623 3624 ;------------------------------------------------------------------------------ 3625 ; FCBS Command 3626 ;------------------------------------------------------------------------------ 3627 ;******************************************************************************* 3628 ; Function: Parse the parameters of FCBS= command. * 3629 ; * 3630 ; Input : * 3631 ; ES:SI -> parameters in command line. * 3632 ; Output: * 3633 ; Set the variables FCBS, KEEP. * 3634 ; * 3635 ; Subroutines to be called: * 3636 ; Sysinit_Parse * 3637 ; Logic: * 3638 ; { * 3639 ; Set DI points to FCBS_Parms; * 3640 ; Set DX,CX to 0; * 3641 ; While (End of command line) * 3642 ; { SYSPARSE; * 3643 ; if (no error) then * 3644 ; { if (CX == 1) then /* first positional = FCBS */ * 3645 ; FCBS = Result_Val.D_P_Picked_Val; * 3646 ; if (CX == 2) then /* second positional = KEEP */ * 3647 ; KEEP = Result_Val.D_P_Picked_Val; * 3648 ; } * 3649 ; else /*Error exit*/ * 3650 ; Error Exit; * 3651 ; }; * 3652 ; }; * 3653 ;******************************************************************************* 3654 TRYX: 0 000026E9 80FC58 CMP AH,'X' 0 000026EC 7547 JNZ TRYY 3657 ; invoke GETNUM 3658 ; JZ TryXBad ; gotta have at least one 3659 ; CMP AX,256 3660 ; JAE TryXBad ; Can't be more than 8 bits worth 3661 ; MOV [FCBS],AL 3662 ; 3663 ; Skip delimiters after the first number including "," 3664 ; 3665 ; invoke Skip_delim ;J.K. 3666 ; jc tryxbad 3667 ; invoke GetNum 3668 ; JC TryXBad ; Number bad (Zero is OK here) 3669 ; CMP AX,256 3670 ; JAE TryXBad 3671 ; CMP AL,FCBS 3672 ; JA TryXBad 3673 ; MOV Keep,AL 3674 ; JMP COFF 3675 ;TryXBad:JMP BadOp 3676 0 000026EE BF[1B0D] mov di, offset FCBS_Parms ;AN000; 0 000026F1 31C9 xor cx, cx ;AN000; 0 000026F3 89CA mov dx, cx ;AN000; 3680 3681 ; $SEARCH ;AN000; 3682 DD_DO95: 0 000026F5 E89CF6 call Sysinit_Parse ;AN000; 3684 ; $EXITIF C ;AN000; Parse Error, 0 000026F8 7305 JNC DD_IF95 0 000026FA E857F2 call Badparm_p ;AN007; and Show messages and end the search loop. 3687 ; $ORELSE ;AN000; 0 000026FD EB33 JMP SHORT DD_SR95 3689 DD_IF95: 0 000026FF 83F8FF cmp ax, D_P_RC_EOL ;AN000; End of Line? 3691 ; $LEAVE E ;AN000; then end the $ENDLOOP 0 00002702 7412 JE DD_EN95 0 00002704 A0[980C] mov al, byte ptr [Result_Val + D_P_PICKED_VAL] ;AN000; 0 00002707 83F901 cmp cx, 1 ;AN000; The first positional? 3695 ; $IF E ;AN000; 0 0000270A 7505 JNE DD_IF99 0 0000270C A2[500D] mov [P_Fcbs], al ;AN000; 3698 ; $ELSE ;AN000; 0 0000270F EB03 JMP SHORT DD_EN99 3700 DD_IF99: 0 00002711 A2[510D] mov [P_Keep], al ;AN000; 3702 ; $ENDIF ;AN000; 3703 DD_EN99: 3704 ; $ENDLOOP ;AN000; 0 00002714 EBDF JMP SHORT DD_DO95 3706 DD_EN95: 0 00002716 A0[500D] mov al, [P_Fcbs] ;AN005;make sure P_Fcbs >= P_Keep 0 00002719 3A06[510D] cmp al, [P_Keep] ;AN005; 3709 ; $IF B ;AN005; 0 0000271D 730A JNB DD_IF103 3711 ; call Badop_p ;AN005; 0 0000271F E832F2 call Badparm_p ;AN011;show "Bad parameter -" msg. 0 00002722 C606[510D]00 mov byte [P_Keep], 0 ;AN005; 3714 ; $ELSE ;AN005; 0 00002727 EB09 JMP SHORT DD_EN103 3716 DD_IF103: 3717 Fcbs equ FCBS ; NASM port label 0 00002729 A2[0000] mov [Fcbs], al ;AN000; No error. Really set the value now. 0 0000272C A0[510D] mov al, [P_Keep] ;AN000; 3720 Keep equ KEEP ; NASM port label 0 0000272F A2[0000] mov [Keep], al ;AN000; 3722 ; $ENDIF ;AN005; 3723 DD_EN103: 3724 ; $ENDSRCH ;AN000; 3725 DD_SR95: 0 00002732 E94DF4 jmp Coff 3727 3728 ;------------------------------------------------------------------------------ 3729 ; Comment= Do nothing. Just decrese CHRPTR, and increase COUNT for correct 3730 ; line number 3731 ;------------------------------------------------------------------------------ 3732 TRYY: ;AN000; 0 00002735 80FC59 cmp ah, 'Y' ;AN000; 0 00002738 750B jne Try0 ;AN000; 3735 DoNothing: 0 0000273A FF0E[0000] dec word [CHRPTR] ;AN000; 0 0000273E FF06[0000] inc word [COUNT] ;AN000; 0 00002742 E93DF4 jmp COFF ;AN000; 3739 3740 ;------------------------------------------------------------------------------ 3741 ; REM command 3742 ;------------------------------------------------------------------------------ 3743 Try0: ;AN003;do nothing with this line. 0 00002745 80FC30 cmp ah, '0' ;AN003; 0 00002748 74F0 je DoNothing ;AN003; 3746 3747 ;------------------------------------------------------------------------------ 3748 ; SWITCHES command 3749 ;------------------------------------------------------------------------------ 3750 ;******************************************************************************* 3751 ; * 3752 ; Function: Parse the option switches specified. * 3753 ; Note - This command is intended for the future use also. When we need to * 3754 ; to set system data flag, use this command. * 3755 ; * 3756 ; Input : * 3757 ; ES:SI -> parameters in command line. * 3758 ; Output: * 3759 ; P_Swit_K set if /K option chosen. * 3760 ; * 3761 ; Subroutines to be called: * 3762 ; Sysinit_Parse * 3763 ; Logic: * 3764 ; { * 3765 ; Set DI points to Swit_Parms; /*Parse control definition*/ * 3766 ; Set DX,CX to 0; * 3767 ; While (End of command line) * 3768 ; { Sysinit_parse; * 3769 ; if (no error) then * 3770 ; if (Result_Val.D_P_SYNONYM_ptr == Swit_K) then * 3771 ; P_Swit_K = 1 * 3772 ; endif * 3773 ; else {Show Error message;Error Exit} * 3774 ; }; * 3775 ; }; * 3776 ; * 3777 ;******************************************************************************* 3778 0 0000274A 80FC31 cmp ah, '1' ;AN019;Switches= command entered? 3780 Tryz equ TRYZ ; NASM port label 0 0000274D 753E jne Tryz ;AN019; 3782 0 0000274F BF[CA0D] mov di, offset Swit_Parms ;AN019; 0 00002752 31C9 xor cx, cx ;AN019; 0 00002754 89CA mov dx, cx ;AN019; 3786 3787 ; $SEARCH ;AN019; 3788 DD_DO107: 0 00002756 E83BF6 call Sysinit_Parse ;AN019; 3790 ; $EXITIF C ;AN019; Parse Error, 0 00002759 7305 JNC DD_IF107 0 0000275B E8F6F1 call Badparm_p ;AN019; and Show messages and end the search loop. 3793 ; $ORELSE ;AN019; 0 0000275E EB2A JMP SHORT DD_SR107 3795 DD_IF107: 0 00002760 83F8FF cmp ax, D_P_RC_EOL ;AN019; End of Line? 3797 ; $LEAVE E ;AN019; then jmp to $Endloop for semantic check. 0 00002763 740F JE DD_EN107 0 00002765 813E[960C][DE0D] cmp word [Result_Val + D_P_SYNONYM_PTR], offset Swit_K ;AN019; 3800 ; $IF E ;AN019; 0 0000276B 7505 JNE DD_IF111 0 0000276D C606[E10D]01 mov byte [P_Swit_K], 1 ;AN019; set the flag 3803 ; $ENDIF ;AN019; 3804 DD_IF111: 3805 ; $ENDLOOP ;AN019; 0 00002772 EBE2 JMP SHORT DD_DO107 3807 DD_EN107: 0 00002774 803E[E10D]01 cmp byte [P_Swit_K], 1 ;AN019;If /K entered, 0 00002779 1E push ds ;AN019; 0 0000277A E8[0000] call sysinit_get_ds_dosbiodata 3811 assume ds:DOSGROUP 3812 ; $IF E ;AN019; 0 0000277D 750A JNE DD_IF114 0 0000277F C606[0000]00 mov byte [KEYRD_Func], 0 ;AN019;Use the conventional keyboard functions 0 00002784 C606[0000]01 mov byte [KEYSTS_Func], 1 ;AN019; 3816 ; $ENDIF ;AN019; 3817 DD_IF114: 0 00002789 1F pop ds ;AN019; 3819 assume ds:SYSINITGROUP ;AN019; 3820 ; $ENDSRCH ;AN019; 3821 DD_SR107: 0 0000278A E9F5F3 jmp Coff ;AN019; 3823 3824 ;------------------------------------------------------------------------------ 3825 ; Bogus command 3826 ;------------------------------------------------------------------------------ 3827 TRYZ: 0 0000278D 80FC32 cmp ah, '2' 0 00002790 7415 je TryFF 0 00002792 80FC37 cmp ah, '7' 0 00002795 7410 je TryFF 0 00002797 80FCFF cmp ah, 0FFh ;AN029; 0 0000279A 740B je TryFF ;AN029; 0 0000279C FF0E[0000] dec word [CHRPTR] 0 000027A0 FF06[0000] inc word [COUNT] 0 000027A4 E995F1 JMP BADOP 3837 3838 ;------------------------------------------------------------------------------ 3839 ; Null command 3840 ;------------------------------------------------------------------------------ 3841 TryFF: ;AN029;Skip this command. 0 000027A7 EB91 jmp DoNothing ;AN029; 3843 3844 GETCHR: 3845 assume ds:SYSINITGROUP, es:nothing, ss:nothing 0 000027A9 51 PUSH CX 0 000027AA 8B0E[0000] MOV CX,[COUNT] 0 000027AE E312 JCXZ NOCHAR 0 000027B0 8B36[0000] MOV SI,[CHRPTR] 0 000027B4 268A04 MOV AL,[ES:SI] 0 000027B7 FF0E[0000] DEC word [COUNT] 0 000027BB FF06[0000] INC word [CHRPTR] 0 000027BF F8 CLC 3854 GET_RET: 0 000027C0 59 POP CX 0 000027C1 C3 return 0 000027C2 F9 NOCHAR: STC 0 000027C3 EBFB JMP SHORT GET_RET 3859 3860 Incorrect_Order proc near ;AN000; 3861 ;Show "Incorrect order in CONFIG.SYS ..." message. 3862 BADORDER equ BadOrder ; NASM port label 0 000027C5 BA[0000] mov dx, offset BADORDER ;AN000; 3864 print equ Print ; NASM port label 0 000027C8 E8[0000] call print ;AN000; 0 000027CB E80D00 call ShowLineNum ;AN000; 0 000027CE C3 ret ;AN000; 3868 Incorrect_Order endp ;AN000; 3869 ; 3870 public Error_Line 3871 Error_Line proc near ;AN000; 3872 ;Show "Error in CONFIG.SYS ..." message. 0 000027CF 0E push cs ;AN000; 0 000027D0 1F pop ds ;AN000; 3875 assume ds:SYSINITGROUP, es:nothing, ss:nothing 3876 ErrorCmd equ Errorcmd ; NASM port label 0 000027D1 BA[0000] mov dx, offset ErrorCmd ;AN000; access with ds 0 000027D4 E8[0000] call print ;AN000; 0 000027D7 E80100 call ShowLineNum ;AN000; 0 000027DA C3 ret ;AN000; 3881 Error_Line endp ;AN000; 3882 ; 3883 ShowLineNum proc near ;AN000; 3884 ;J.K. Convert the binary LineCount to Decimal ASCII string in ShowCount 3885 ;and Display Showcount at the current curser position. 3886 ;In.) LineCount 3887 ; 3888 ;Out) the number is printed. 0 000027DB 06 push es ;AN000; 0 000027DC 1E push ds ;AN000; 0 000027DD 57 push di ;AN000; 3892 0 000027DE 0E push cs ;AN000; 0 000027DF 07 pop es ;AN000; es=cs 3895 assume es:SYSINITGROUP 0 000027E0 0E push cs ;AN000; 0 000027E1 1F pop ds ;AN000; 3898 assume ds:SYSINITGROUP, es:SYSINITGROUP, ss:nothing 3899 3900 ; mov ax, ' ' 3901 ; mov di, offset ShowCount ;clean it up. 3902 ; stosw 3903 ; stosw 3904 ; stosb ;lenght of ShowCount is 5. 3905 ; dec di ;let DI points to the least significant ASCII field. 3906 0 000027E2 BF[0400] mov di, offset ShowCount+4 ;AN000; DI -> the least significant decimal field. 0 000027E5 B90A00 mov cx, 10 ;AN000; decimal devide factor 0 000027E8 2EA1[0000] mov ax, [cs:LineCount] ;AN000; 3910 SLN_Loop: ;AN000; 0 000027EC 83F80A cmp ax, 10 ;AN000; < 10? 0 000027EF 720C jb SLN_Last ;AN000; 0 000027F1 31D2 xor dx,dx ;AN000; 0 000027F3 F7F1 div cx ;AN000; 0 000027F5 80CA30 or dl, 30h ;AN000; add "0" (= 30h) to make it an ascii. 0 000027F8 8815 mov [di],dl ;AN000; 0 000027FA 4F dec di ;AN000; 0 000027FB EBEF jmp SLN_Loop ;AN000; 3919 SLN_Last: ;AN000; 0 000027FD 0C30 or al, 30h ;AN000; 0 000027FF 8805 mov [di],al ;AN000; 0 00002801 89FA mov dx, di ;AN000; 0 00002803 E8[0000] call print ;AN000; show it. 0 00002806 5F pop di ;AN000; 0 00002807 1F pop ds ;AN000; 0 00002808 07 pop es ;AN000; 3927 assume ds:nothing, es:nothing 0 00002809 C3 ret ;AN000; 3929 ShowLineNum endp ;AN000; 3930 3931 3932 sysinit_CallIFS proc near ;AN000; 3933 ;******************************************************************************* 3934 ; Function: Interface to IFS call. This procedure will call IFS_CALL@ * 3935 ; * 3936 ; Input : * 3937 ; Entry_Point - Segment:Offset of loaded IFS. * 3938 ; BX = IFS_CALL@ (offset of IFS_CALL@ from the IFS header) * 3939 ; ES = Segment of IFS request header * 3940 ; IFS_Packet - IFS Request packet * 3941 ; * 3942 ; Output: Nothing * 3943 ;******************************************************************************* 0 0000280A 50 push ax ;AN000; 0 0000280B 2E8E1E[0200] mov ds, word ptr [cs:Entry_Point+2] ;AN000; 3946 assume ds:nothing 0 00002810 2E031E[0000] add bx, word ptr [cs:Entry_Point] ;AN000; [DS:BX] = Real IFS_CALL@ addr. 0 00002815 8B07 mov ax, [bx] ;AN000; save it 0 00002817 2EFF36[0000] push word ptr [cs:Entry_Point] ;AN000; save Entry point offset 0 0000281C 2EA3[0000] mov word ptr [cs:Entry_Point], ax ;AN000; set for the call 0 00002820 BB[0000] mov bx, offset IFS_RH ;AN000; Now, ES:BX -> Request packet 0 00002823 2EFF1E[0000] call far [cs:Entry_Point] ;AN000; Far call 0 00002828 2E8F06[0000] pop word ptr [cs:Entry_Point] ;AN000; Restore Entry point offset 0 0000282D 58 pop ax ;AN000; 0 0000282E C3 ret ;AN000; 3956 sysinit_CallIFS endp 3957 3958 3959 %if 0 3960 Set_DevMark proc near ;AN004; 3961 ;******************************************************************************* 3962 ; Function: Set a paragraph of informations infront of a Device file or * 3963 ; an IFS file to be loaded for MEM command. * 3964 ; The structure is: * 3965 ; DEVMARK_ID byte "D" for device, "I" for IFS * 3966 ; DEVMARK_SIZE size in para for the device loaded * 3967 ; DEVMARK_FILENAME 11 bytes. Filename * 3968 ; * 3969 ; Input : * 3970 ; [MEMHI] = address to set up DEVMARK. * 3971 ; [MEMLO] = 0 * 3972 ; ES:SI -> pointer to [drive][path]filename,0 * 3973 ; [IFS_Flag] = IS_IFS bit set if IFS= command. * 3974 ; * 3975 ; Output: DEVMARK_ID, DEVMARK_FILENAME set * 3976 ; [cs:DevMark_addr] set. * 3977 ; AX, CX register destroyed. * 3978 ;******************************************************************************* 3979 push ds ;AN004; 3980 push si ;AN004; 3981 push es ;AN004; 3982 push di ;AN004; 3983 3984 mov di, [cs:MEMHI] ;AN004; 3985 mov ds, di ;AN004; 3986 assume ds:nothing ;AN004; 3987 mov [cs:DevMark_Addr], di ;AN004; save the DEVMARK address for the future. 3988 test word [cs:IFS_Flag], IS_IFS ;AN004; 3989 jnz SDVMK_IFS ;AN004; 3990 mov al, DEVMARK_DEVICE ;AN004; ='D' 3991 jmp short SDVMK_ID ;AN004; 3992 SDVMK_IFS: 3993 mov al, DEVMARK_IFS ;AN004; ='I' 3994 SDVMK_ID: ;AN004; 3995 mov [DEVMARK_ID], al ;AN004; 3996 inc di ;AN008; 3997 mov [DEVMARK_SEG], di ;AN008; 3998 call get_device_mcb_name 3999 pop di ;AN004; 4000 pop es ;AN004; 4001 pop si ;AN004; 4002 pop ds ;AN004; 4003 ret ;AN004; 4004 Set_DevMark endp ;AN004; 4005 %endif 4006 4007 ; INP: es:si -> pathname 4008 ; ds => sub-MCB 4009 ; CHG: si, di, ds, es, cx, ax 4010 get_device_mcb_name: 0 0000282F 30C0 xor al,al ;AN004; 0 00002831 56 push si ;AN004; 0 00002832 5F pop di ;AN004; now es:si = es:di = [path]filename,0 0 00002833 B98000 mov cx, 128 ;AN004; Maximum 128 char 0 00002836 F2AE repnz scasb ;AN004; find 0 0 00002838 4F dec di ;AN020; Now es:di-> 0 4017 SDVMK_Backward: ;AN004; find the pointer to the start of the filename. 0 00002839 268A05 mov al, byte ptr [es:di] ;AN004;;AN020;We do this by check es:di backward until 0 0000283C 3C5C cmp al, '\' ;AN004;;AN020; DI = SI or DI -> '\' or DI -> ':'. 0 0000283E 740B je SDVMK_GotFile ;AN004;;AN020; 0 00002840 3C3A cmp al, ':' ;AN004; 0 00002842 7407 je SDVMK_GotFile ;AN004; 0 00002844 39F7 cmp di, si ;AN004; 0 00002846 7404 je SDVMK_FilePtr ;AN004; 0 00002848 4F dec di ;AN004; 4026 SDVMK_BackWard equ SDVMK_Backward ; NASM port label 0 00002849 EBEE jmp SDVMK_BackWard ;AN004; 4028 SDVMK_GotFile: ;AN004; 0 0000284B 47 inc di ;AN004; 4030 SDVMK_FilePtr: ;AN004; now es:di -> start of file name 0 0000284C 57 push di ;AN004; 0 0000284D 5E pop si ;AN004; save di to si. 0 0000284E 1E push ds ;AN004; switch es, ds 0 0000284F 06 push es ;AN004; 0 00002850 1F pop ds ;AN004; 0 00002851 07 pop es ;AN004; now, ds:si -> start of filename 4037 assume es:nothing, ds:nothing 0 00002852 BF0800 mov di, DEVMARK_FILENAME ;AN004; 0 00002855 57 push di ;AN004; 0 00002856 B020 mov al, ' ' ;AN004; 0 00002858 B90800 mov cx, 8 ;AN004; 0 0000285B F3AA rep stosb ;AN004; Clean up Memory. 0 0000285D 5F pop di ;AN004; 0 0000285E B90800 mov cx, 8 ;AN004; Max 8 char. only 4045 SDVMK_Loop: ;AN004; 0 00002861 AC lodsb ;AN004; 0 00002862 3C2E cmp al, '.' ;AN004; 0 00002864 7407 je SDVMK_Done ;AN004; 0 00002866 3C00 cmp al, 0 ;AN004; 0 00002868 7403 je SDVMK_Done ;AN004; 0 0000286A AA stosb ;AN004; 0 0000286B E2F4 loop SDVMK_Loop ;AN004; 4053 SDVMK_Done: ;AN004; 0 0000286D C3 retn 4055 4056 Chk_XMAEM proc near ;AN029; 4057 ;Function: Check XMAEM.SYS file name. 4058 ;In: ES:SI -> path, filename, 0 4059 ;out: if XMAEM.SYS, then zero flag set. 4060 0 0000286E 06 push es ;AN029; 0 0000286F 56 push si ;AN029; 0 00002870 1E push ds ;AN029; 0 00002871 57 push di ;AN029; 0 00002872 51 push cx ;AN029; 0 00002873 89F7 mov di, si ;AN029;save current starting pointer 4067 CX_Cmp: ;AN029; 0 00002875 26803C00 cmp byte ptr [es:si], 0 ;AN029; 0 00002879 7403 je CX_Endfile ;AN029; 0 0000287B 46 inc si ;AN029; 0 0000287C EBF7 jmp CX_Cmp ;AN029; 4072 CX_Endfile: ;AN029; 0 0000287E 4E dec si ;AN029; 0 0000287F 26803C5C cmp byte ptr [es:si], '\' ;AN029; 0 00002883 740C je CX_Got_Tail ;AN029; 0 00002885 26803C3A cmp byte ptr [es:si], ':' ;AN029; 0 00002889 7406 je CX_Got_Tail ;AN029; 0 0000288B 39F7 cmp di, si ;AN029; 0 0000288D 7403 je CX_Got_Tail0 ;AN029; 0 0000288F EBED jmp CX_Endfile ;AN029; 4081 CX_Got_Tail: ;AN029; 0 00002891 46 inc si ;AN029; 4083 CX_Got_Tail0: ;AN029; 0 00002892 0E push cs ;AN029; 0 00002893 1F pop ds ;AN029; 4086 assume ds:SYSINITGROUP 0 00002894 56 push si ;AN029; 0 00002895 5F pop di ;AN029;now es:di -> filename,0 0 00002896 B90900 mov cx, 9 ;AN029; 4090 XMAEM_File equ XMAEM_file ; NASM port label 0 00002899 BE[7B03] mov si, offset XMAEM_File ;AN029;ds:si -> XMAEM.SYS,0 0 0000289C F3A6 repe cmpsb ;AN029; 4093 CX_Ret: ;AN029; 0 0000289E 59 pop cx ;AN029; 0 0000289F 5F pop di ;AN029; 0 000028A0 1F pop ds ;AN029; 4097 assume ds:nothing 0 000028A1 5E pop si ;AN029; 0 000028A2 07 pop es ;AN029; 4100 assume es:nothing 0 000028A3 C3 ret ;AN029; 4102 Chk_XMAEM endp 4103 4104 ;Chk_IBMCACHE proc near ;AN024;AN026; Don't need this any more. 4105 ; IBMDOS is going to handle this through 4Bh call. 4106 ;Function: IBMCACHE.SYS does not handle a DOS version 4.0 or above. 4107 ; So, this procedure will check if the device driver is IBMCACHE.SYS. 4108 ; If it is, through new INT 2fh interface "Set/Restore DOS version" 4109 ; AX=122Fh 4110 ; DX= 0 ; reset 4111 ; otherwise ; DH = minor version, DL = major version 4112 ; INT 2fh 4113 ;In: ES:SI -> path, filename, 0 4114 ;out: if IBMCACHE.SYS, then DOS version changed to 4.00 temporarily. 4115 ; Reset_Dos_Version proc will later reset it back to current DOS version 4.0. 4116 4117 ; push es ;AN024; 4118 ; push si ;AN024; 4119 ; push ds ;AN024; 4120 ; push di ;AN024; 4121 ; push cx ;AN024; 4122 ; mov di, si ;AN024;save current starting pointer 4123 ;CIC_Cmp: ;AN024; 4124 ; cmp byte ptr [es:si], 0 ;AN024; 4125 ; je CIC_Endfile ;AN024; 4126 ; inc si ;AN024; 4127 ; jmp CIC_Cmp ;AN024; 4128 ;CIC_Endfile: ;AN024; 4129 ; dec si ;AN024; 4130 ; cmp byte ptr [es:si], '\' ;AN024; 4131 ; je CIC_Got_Tail ;AN024; 4132 ; cmp byte ptr [es:si], ':' ;AN024; 4133 ; je CIC_Got_Tail ;AN024; 4134 ; cmp di, si ;AN024; 4135 ; je CIC_Got_Tail0 ;AN024; 4136 ; jmp CIC_Endfile ;AN024; 4137 ;CIC_Got_Tail: ;AN024; 4138 ; inc si ;AN024; 4139 ;CIC_Got_Tail0: ;AN024; 4140 ; push cs ;AN024; 4141 ; pop ds ;AN024; 4142 ; push si ;AN024; 4143 ; pop di ;AN024;now es:di -> filename,0 4144 ; mov cx, 12 ;AN024; 4145 ; mov si, offset IBMCACHE_File ;AN024;ds:si -> IBMCACHE.SYS,0 4146 ; repe cmpsb ;AN024; 4147 ; jnz CIC_ret ;AN024; 4148 ; mov ax, 122Fh ;AN024;Change DOS version to 4149 ; mov dx, 2803h ;AN024; DOS 3.4 temporarily. 4150 ; int 2fh ;AN024; 4151 ;CIC_Ret: ;AN024; 4152 ; pop cx ;AN024; 4153 ; pop di ;AN024; 4154 ; pop ds ;AN024; 4155 ; pop si ;AN024; 4156 ; pop es ;AN024; 4157 ; ret ;AN024; 4158 ;Chk_IBMCACHE endp 4159 ; 4160 4161 Reset_DOS_Version proc near ;AN024; 4162 ;Function: issue AX=122Fh, DX=0, INT 2fh to restore the DOS version. 0 000028A4 50 push ax ;AN024; 0 000028A5 52 push dx ;AN024; 0 000028A6 B82F12 mov ax, 122Fh ;AN024; 0 000028A9 BA0000 mov dx, 0 ;AN024; 0 000028AC CD2F int 2fh ;AN024; 0 000028AE 5A pop dx ;AN024; 0 000028AF 58 pop ax ;AN024; 0 000028B0 C3 ret ;AN024; 4171 Reset_DOS_Version endp 4172 4173 4174 %ifndef BUF2 4175 ;Int 2F EMS handler + Int 67h handler for EMS 4176 ;========================================================================= 4177 ; Int_2F_EMS - This routine provides support for VDISK, 4178 ; FASTOPEN, and BUFFERS to determine the physical 4179 ; EMS pages available for their usage. 4180 ; 4181 ; Inputs : AH - Function code (18h) to return available phys. page 4182 ; DI - FEh (Signals to return useable page for VDISK & FASTOPEN) 4183 ; FFh (Signals to return useable page for BUFFERS) 4184 ; 4185 ; AL = 0 is for installation check. - J.K. 4186 ; 4187 ; Outputs : ES - Segment value for physical page 4188 ; DI - Physical Page number 4189 ; AH - Non-zero (physical page not available) 4190 ; Zero (valid physical page data returned) 4191 ; 4192 ; For installation check, AL = 0FFh for being present. - J.K. 4193 ; For the other functions, AX = 0 for successful op. 4194 ; AX = -1 for an error. 4195 ; 4196 ; Date : 5/5/88 4197 ; Release : DOS 4.0 4198 ;========================================================================= 4199 4200 ;Int_2F_Handler proc ;traps Int_2f and checks for EMS ;an000; dms; 4201 4202 EMS_STUB_START label byte ;AN030;J.K. 4203 ;Dummy DEVICE HEADER for other dummy ;AN031; Symphony assumes int 67h handler seg as a device driver! 4204 DD -1 ;AN031;becomes pointer to next device header 4205 DW 0C040H ;AN031;attribute (character device) 4206 DW 0000 ;AN031;pointer to harzard area. System will hang. 4207 DW 0000 ;AN031;pointer to harzard area. System will hang. 4208 DB 'EMMXXXX0' ;AN031;device name 4209 4210 INTV2F equ $-EMS_STUB_START ;AN030;J.K.pointer to old 2Fh handler ;an000; dms; 4211 IntV2FO DW ? ;AN030;;offset ;an000; dms; 4212 IntV2FS DW ? ;AN030;;segment ;an000; dms; 4213 4214 OLDINT67_VECTOR equ $-EMS_STUB_START ;AN030;J.K. 4215 OldInt67 dd ? ;AN030;; save pointer to old INT 67 handler here 4216 4217 %IF BUFFERFLAG 4218 4219 LOCKFLAG equ $-EMS_STUB_START 4220 LOCK_FLAG db ? 4221 4222 %ELSE 4223 4224 EMSPAGE_CNT equ $-EMS_STUB_START ;AN030;J.K. 4225 EMSPageCount dw ? ;AN030;; save count of EMS mappable pages here 4226 4227 EMSReservedArray_X label word ;AN030;;J.K. For initialization routine 4228 EMSRESERVEDARRAY equ $-EMS_STUB_START ;AN030;;J.K. 4229 dw 0ffffh,0ffffh ;AN030;; array of reserved pages 4230 dw 0ffffh,0ffffh ;AN030;; phys_page_segment, phys_page_number * 2 entries 4231 MappableArray_X label word ;AN030;;J.K. for initialization routine 4232 MAPPABLEARRAY equ $-EMS_STUB_START ;AN030;;J.K. 4233 dw 64 dup (0,0) ;AN030;; table to get addresses from old INT 67 handler 4234 4235 %ENDIF 4236 ; 64 entries * 2 words 4237 NEWEMS2F_OFF equ $-EMS_STUB_START;AN030; 4238 Int_2F_EMS: ;AN030;;J.K. Name changed. 4239 cmp ah,1Bh ;AN030;;AN032;2Fh trap for Mappable Phys. Add. Array ;an000; dms; 4240 je Int_2F_EMS_MINE ;AN030;;This one we want ;an000; dms; 4241 4242 IntV2F equ INTV2F ; NASM port equate 4243 jmp far [cs:IntV2F] ;AN030;;go to old interrupt handler ;an000; dms; 4244 4245 Int_2F_EMS_MINE: ;AN030; 4246 or al, al ;AN030;;J.K. Installation check? 4247 jnz Int_2F_5800_Func ;AN030;;J.K. 4248 mov al, 0FFh ;AN030;;J.K. Yes, I am here! 4249 iret ;AN030;;J.K. 4250 4251 Int_2F_5800_Func: ;AN030; 4252 4253 %IF BUFFERFLAG 4254 ; int 3 4255 cmp di, 80h 4256 jne st_flag 4257 mov byte [cs:LOCKFLAG], 0 4258 Int_2f_5800_Good_Exit equ Int_2F_5800_Good_Exit ; NASM port label 4259 jmp Int_2f_5800_Good_Exit 4260 nop ; identicalise 4261 st_flag: 4262 cmp di, 81h 4263 Int_2f_5800_Err_Exit equ Int_2F_5800_Err_Exit ; NASM port label 4264 jne Int_2f_5800_Err_Exit 4265 mov byte [cs:LOCKFLAG], 1 4266 jmp Int_2f_5800_Good_Exit 4267 nop ; identicalise 4268 %ELSE 4269 4270 push si ;AN030;; ;an000; dms; 4271 4272 ; mov si,offset EMSReservedArray ;point to array containing pages ;an000; dms; 4273 mov si, EMSRESERVEDARRAY ;AN030;;J.K. 4274 4275 cmp di,0feh ;AN030;;VDISK or FASTOPEN request? ;an000; dms; 4276 jne Int_2F_5800_Buff_Ck ;AN030;;no - check for buffers ;an000; dms; 4277 4278 cmp word ptr [cs:si],0ffffh ;AN030;;valid entry? ;an000; dms; 4279 je Int_2F_5800_Err_Exit ;AN030;;no - exit ;an000; dms; 4280 4281 mov es,word ptr [cs:si] ;AN030;;get segment value ;an000; dms; 4282 mov di,word ptr [cs:si+2] ;AN030;;get physical page value ;an000; dms; 4283 jmp Int_2F_5800_Good_Exit ;AN030;;exit routine ;an000; dms; 4284 4285 Int_2F_5800_Buff_Ck: ;AN030; 4286 4287 cmp di,0ffh ;AN030;;BUFFERS request? ;an000; dms; 4288 jne Int_2F_5800_Err_Exit ;AN030;;no - exit with error ;an000; dms; 4289 4290 add si,4 ;AN030;;point to second element in array ;an000; dms; 4291 4292 cmp word ptr [cs:si],0ffffh ;AN034;;valid entry? ;an000; dms; 4293 je Int_2F_5800_Err_Exit ;AN034;;no - exit ;an000; dms; 4294 4295 mov es,word ptr [cs:si] ;AN030;;get segment value ;an000; dms; 4296 mov di,word ptr [cs:si+2] ;AN030;;get physical page value ;an000; dms; 4297 4298 %ENDIF 4299 4300 Int_2F_5800_Good_Exit: ;AN030; 4301 4302 xor ax,ax ;AN030;;signal good return ;an000; dms; 4303 jmp Int_2F_Exit ;AN030;;exit routine ;an000; dms; 4304 nop ; identicalise 4305 4306 Int_2F_5800_Err_Exit: ;AN030; 4307 4308 mov ax,0ffffh ;AN030;;signal error ;an000; dms; 4309 4310 Int_2F_Exit: ;AN030; 4311 4312 4313 %IFN BUFFERFLAG 4314 pop si ;AN030;;restore regs ;an000; dms; 4315 %ENDIF 4316 iret ;AN030;;return to caller ;an000; dms; 4317 4318 4319 4320 ;------------------------------------------------------------------- 4321 ; 4322 ; INT 67h Filter 4323 ; 4324 ; This routine filters INT 67's looking for AH=58h. When initialized, 4325 ; the original INT 67 handler is called and the mappable address array 4326 ; is changed to "reserve" two pages for DOS use. This new array is 4327 ; then returned to the calling program when INT 67 AH=58h is found. 4328 ; 4329 ; Information about the two pages "reserved" for DOS is returned 4330 ; via an unpublished INT 2Fh interface. 4331 ; 4332 ; 5/10/88 for DOS 4.0. 4333 ;------------------------------------------------------------------- 4334 4335 %IFN BUFFERFLAG 4336 4337 GetMappableArray equ 58h ; INT 67 function code for Get Mappable Array 4338 GetPageFrame equ 41h ; function code for getting the page frame address 4339 null equ 0 ; zero value 4340 I67Error8F equ 8fh ;AN031;; invalid sub-function error 4341 4342 %ENDIF 4343 4344 ;------------------------------------------------------------------- 4345 NEW67_OFFSET equ $-EMS_STUB_START ;J.K. 4346 Int67Filter: ;AN030; 4347 4348 %IF BUFFERFLAG 4349 ; int 3 4350 cmp byte [cs:LOCKFLAG], 1 4351 jne PassThru 4352 mov ah, 80h 4353 stc 4354 iret 4355 %ELSE 4356 GETMAPPABLEARRAY equ GetMappableArray ; NASM port equate 4357 cmp ah,GETMAPPABLEARRAY ;AN030;; is this the INT 67 call we are interested in? 4358 jne PassThru ;AN030;; no, pass it to old INT 67 handler 4359 ;AN030;; yes ... 4360 cmp al,0 ;AN031;; AL=0 return count and table 4361 je I67Fcn0 4362 4363 cmp al,1 ;AN031;; AL=1 return count only 4364 jne I67Error ;AN031;; otherwise, error 4365 4366 4367 ; return count of mappable pages 4368 4369 sti ;AN031;; turn interrupts on 4370 4371 mov cx,word ptr [cs:EMSPAGE_CNT] ;AN031;J.K. get number of mappable pages in fake table 4372 xor ah,ah ;AN031;; good return code 4373 iret 4374 4375 ; return invalid sub-function code 4376 4377 I67Error: 4378 sti ;AN031;; turn interrupts on 4379 mov ah,I67Error8F ;AN031;; invalid sub-function error 4380 iret 4381 4382 4383 I67Fcn0: ;AN031 4384 4385 ; copy the fake table to user's buffer 4386 4387 sti ;AN030;; turn interrupts on 4388 4389 push ds ;AN030; save some regs 4390 push di ;AN030; 4391 push si ;AN030; 4392 4393 mov cx,word ptr [cs:EMSPAGE_CNT] ;AN030;J.K. get number of mappable pages in fake table 4394 shl cx,1 ;AN030;; count * 2 = number of words to copy 4395 4396 push cs ;AN030;; point DS:SI to fake table 4397 pop ds ;AN030; 4398 ; lea si,MappableArray 4399 mov si, MAPPABLEARRAY ;AN030;;J.K. 4400 4401 rep movsw ;AN030;; copy CX words from DS:SI to ES:DI 4402 4403 xor ah,ah ;AN030;; good return code 4404 mov cx,word ptr [cs:EMSPAGE_CNT] ;AN030;; page count returned to user in CX 4405 4406 4407 pop si ;AN030;; restore some regs 4408 pop di ;AN030; 4409 pop ds ;AN030; 4410 4411 iret ;AN030;; end of INT 67 filter routine 4412 4413 %ENDIF 4414 4415 ;------------------------------------------------------------------- 4416 ; 4417 ; PassThru - send request to old INT 67 handler 4418 ; 4419 ;------------------------------------------------------------------- 4420 4421 PassThru: 4422 OldINT67_VECTOR equ OLDINT67_VECTOR ; NASM port equate 4423 jmp far [cs:OldINT67_VECTOR] ;AN030;;J.K. jump to old INT 67 handler 4424 ; (IRET will return to calling program) 4425 4426 4427 EMS_STUB_END label byte ;AN030; 4428 ;------------------------------------------------------------------- 4429 4430 %IFN BUFFERFLAG 4431 ;------------------------------------------------------------------- 4432 ; 4433 ; Int67FilterInit - This routine is called to initialize the INT 67 4434 ; filter. It should be called as soon as possible after installation. 4435 ; 4436 ;------------------------------------------------------------------- 4437 4438 Int67FilterInit: ;AN030; 4439 push es ;AN030;; save caller's ES:DI 4440 push di ;AN030; 4441 4442 push cs ;AN030;; make ES:DI point to our array 4443 pop es ;AN030; 4444 mov di,offset MappableArray_X ;AN030; 4445 4446 ; call dword ptr cs:OldInt67 ; get mappable array from EMS DD 4447 4448 mov ah, GetMappableArray ;AN030; 4449 xor al,al ;AN030; 4450 int 67h ;AN030;;J.K. 4451 4452 4453 ;------------------------ 4454 ; scan table looking for highest phys_page_number 4455 4456 xor ax,ax ;AN030;; 4457 4458 cmp cx,0 ;AN033;; are the any pages left? 4459 je NoMoreEMSPages ;AN033;; no, don't bother looking any more 4460 4461 call GetHighestPage ;AN030;; get highest entry from table 4462 4463 mov [cs:EMSReservedArray_X+4],bx ;AN030;; phys_page_segment 4464 mov [cs:EMSReservedArray_X+6],ax ;AN030;; phys_page_number 4465 4466 cmp cx,0 ;AN033;; are the any pages left? 4467 je NoMoreEMSPages ;AN033;; no, don't bother looking any more 4468 4469 call GetHighestPage ;AN030;; get next highest entry from table 4470 4471 mov [cs:EMSReservedArray_X+0],bx ;AN030;; phys_page_segment 4472 mov [cs:EMSReservedArray_X+2],ax ;AN030;; phys_page_number 4473 4474 NoMoreEMSPages: ;AN033;; 4475 mov [cs:EMSPageCount],cx ;AN030;; save new page count for INT 67 filter 4476 4477 pop di 4478 pop es 4479 ret ;AN030;; return to calling program 4480 4481 4482 ; page 4483 ;------------------------------------------------------------------- 4484 ; 4485 ; GetHighestPage - returns highest physical page number in AX 4486 ; and segment for it in BX. A -1 means no valid page found. 4487 ; 4488 ;------------------------------------------------------------------- 4489 GetHighestPage: 4490 4491 xor ax,ax ;AN030;; zero candidate register 4492 mov bx,ax ;AN030;; zero pointer to candidate page 4493 4494 push cx ;AN030;; save count 4495 push dx ;AN030; 4496 push di ;AN030;; save pointer 4497 4498 PageScanLoop: ;AN030; 4499 cmp ax,[ES:di+2] ;AN030;; get phys_page_number 4500 ja LookAtNextPage ;AN030;; this one is lower than the one we are holding 4501 4502 cmp word [es:di], 0a000h ; Only reserve pages in memory above 640K.. 4503 jb LookAtNextPage ; fix for ps2emm and m20emm with motherboard 4504 ; disabled. 7/25/88. HKN. 4505 4506 mov ax,[ES:di+2] ;AN030;; this one is higher, make it new candidate 4507 mov bx,di ;AN030;; pointer to new candidate page, used to zero 4508 ; it later so we don't get the same one again 4509 mov dx,cx ;AN030;; save count where we found candidate 4510 4511 LookAtNextPage: ;AN030; 4512 add di,4 ;AN030;; point to next entry in mappable table 4513 4514 loop PageScanLoop ;AN030;; look at next entry 4515 4516 cmp bx,null ;AN030;; did we find any pages? 4517 jne FoundOne ;AN030;; yes, exit 4518 4519 jmp ReturnError ;AN030; 4520 4521 ;------------------------ 4522 FoundOne: ;AN030; 4523 cmp ax,3 ;AN030;; could the one we found be part of a page frame 4524 NotFrame equ Notframe ; NASM port label 4525 ja NotFrame ;AN030;; no, carry on 4526 4527 ; yes, find out if it is part of frame 4528 4529 push ax ;AN030;; save physical page number 4530 push bx ;an030;; dms; bx destroyed by call 4531 mov ah,GetPageFrame ;AN030;; function code to get page frame ... 4532 ; call dword ptr cs:OldInt67 ; ... from the EMS DD 4533 int 67h ;AN030;;J.K. 4534 or ah,ah ;an030;;dms; error? 4535 pop bx ;an030;;dms; restore bx 4536 pop ax ;AN030;; restore phys page number 4537 jnz NotFrame ;AN030;; no frame available, carry on 4538 4539 ; there is a frame, this page is part of frame, so return -1's 4540 4541 ReturnError: ;AN030; 4542 mov ax,0ffffh ;AN030;; indicate failure 4543 mov bx,ax ;AN030;; ax and bx = -1 4544 4545 pop di ;AN030;; restore pointer 4546 pop dx 4547 pop cx ;AN030;; restore count 4548 4549 jmp GHPExit ;AN030; 4550 4551 4552 4553 4554 ;------------------------ 4555 ; Found a page, and it is not part of a page frame, so re-pack table 4556 ; and return info. The entry we "reserve" for DOS must be removed 4557 ; from the table and the other entries moved up to repack the table. 4558 ; The count must be reduced by 1 to reflect this change. 4559 4560 Notframe: ;AN030; 4561 4562 mov di,bx ;AN030;; make ES:DI point to highest page table entry 4563 4564 mov bx,[ES:di] ;AN030;; get segment address of page 4565 4566 mov cx,dx ;AN030;; get count from candidate page 4567 4568 push ax ;AN030; 4569 PackLoop: ;AN030; 4570 mov ax, [es:di+4] ;AN030; 4571 mov [es:di+0], ax ;AN030; 4572 mov ax, [es:di+6] ;AN030; 4573 mov [es:di+2], ax ;AN030; 4574 add di, 4 ;AN030; 4575 loop PackLoop ;AN030;; do it until done 4576 pop ax ;AN030; 4577 4578 pop di ;AN030;; restore pointer 4579 pop dx ;AN030; 4580 pop cx ;AN030;; restore count 4581 4582 sub cx,1 ;AN030;; reduce count by one, one less page in table now 4583 4584 GHPExit: ;AN030; 4585 4586 ret ;AN030;; return to caller 4587 4588 %ENDIF 4589 4590 ;========================================================================= 4591 ; EMS_Install_Check : THIS MODULE DETERMINES WHETHER OR NOT EMS IS 4592 ; INSTALLED FOR THIS SESSION. 4593 ; 4594 ; INPUTS : NONE 4595 ; 4596 ; OUTPUTS : ES:BX - FRAME ARRAY 4597 ; CY - EMS NOT AVAILABLE 4598 ; NC - EMS AVAILABLE 4599 ; 4600 ; Date : 5/6/88 4601 ;========================================================================= 4602 4603 EMS_Install_Check proc near ;AN030;; check if EMS is installed ;an000; dms; 4604 4605 push ax ;AN030;; save regs ;an000; dms; 4606 4607 push ds ;AN030;; save ds ;an000; dms; 4608 xor ax,ax ;AN030;; set ax to 0 ;an000; dms; 4609 mov ds,ax ;AN030;; set ds to 0 ;an000; dms; 4610 cmp word ptr [067h*4+0],0 ;AN030;; see if int 67h is there ;an000; dms; 4611 pop ds ;AN030;; restore ds ;an000; dms; 4612 je EMS_Install_Ck_Err_Exit ;AN030;; exit routine - EMS not loaded ;an000; dms; 4613 4614 mov ah,40h ;AN030;; Get Status function ;an000; dms; 4615 xor al,al ;AN030;; clear al ;an000; dms; 4616 int 67h ;AN030;; ;an000; dms; 4617 or ah,ah ;AN030;; EMS installed? ;an000; dms; 4618 jnz EMS_Install_Ck_Err_Exit ;AN030;; exit routine - EMS not loaded ;an000; dms; 4619 4620 mov ah,46h ;AN030;; Get Version number ;an000; dms; 4621 xor al,al ;AN030;; clear al ;an000; dms; 4622 int 67h ;AN030;; ;an000; dms; 4623 cmp al,40h ;AN030;; Version 4.0? ;an000; dms; 4624 jb EMS_Install_Ck_Err_Exit ;AN030;; exit routine - wrong EMS loaded ;an000; dms; 4625 4626 clc ;AN030;; signal EMS loaded ;an000; dms; 4627 jmp EMS_Install_Ck_Exit ;AN030;; exit routine ;an000; dms; 4628 nop ; identicalise 4629 4630 EMS_Install_Ck_Err_Exit: ;AN030; 4631 4632 stc ;AN030;; signal EMS not loaded ;an000; dms; 4633 4634 EMS_Install_Ck_Exit: ;AN030; 4635 4636 pop ax ;AN030;; restore regs ;an000; dms; 4637 4638 ret ;AN030;; return to caller ;an000; dms; 4639 4640 EMS_Install_Check endp ; ;an000; dms; 4641 4642 EMS_Stub_Handler proc near ;AN030; 4643 ;At the request of Architecture Group, this logic is implemented. 4644 ;Function: If (Buffer_Slash_X <> 0 and EMS_Stub_Installed == 0), 4645 ; then { call Chk_EMS; 4646 ; if EMS is there, then install EMS_Stub dynamically 4647 ; and initialize it.} 4648 ; Note: EMS_Stub consists of INT 2fh EMS handler and INT 67h handler. 4649 ; When EMS_Stub is installed, EMS_Stub_Installed will be set to 1. 4650 4651 push es ;AN030; 4652 push si ;AN030; 4653 push ds ;AN030; 4654 push di ;AN030; 4655 push ax ;AN030; 4656 push cx ;AN030; 4657 cmp byte [cs:EMS_Stub_Installed], 0 ;AN030; 4658 je EMS_Stub_X ;AN030; 4659 jmp short EMS_SH_Ret ;AN030; 4660 nop ; identicalise 4661 EMS_Stub_X: ;AN030; 4662 cmp byte [cs:Buffer_Slash_X], 0 ;AN030; 4663 je EMS_SH_Ret ;AN030; 4664 call EMS_Install_Check ;AN030; 4665 jc EMS_SH_Ret ;AN030; 4666 ;Install EMS_Stub. ;AN030; 4667 EMS_Stub_Do: 4668 push es ;AN030; 4669 xor ax,ax ;AN030;save current Int 2fh, 67h vectors. 4670 mov es, ax ;AN030; 4671 mov ax, word ptr [es:2fh*4] ;AN030; 4672 mov [cs:IntV2FO], ax ;AN030; 4673 mov ax, word ptr [es:2fh*4+2] ;AN030; 4674 mov [cs:IntV2FS], ax ;AN030; 4675 mov ax, word ptr [es:67h*4] ;AN030; 4676 mov word ptr [cs:OldInt67], ax ;AN030; 4677 mov ax, word ptr [es:67h*4+2] ;AN030; 4678 mov word ptr [cs:OldInt67+2], ax ;AN030; 4679 pop es ;AN030; 4680 4681 %IFN BUFFERFLAG 4682 ;initalize tables in INT 67h handler 4683 call Int67FilterInit ;AN030; 4684 cmp ax, 0ffffh ; if the page found was part of a lim 4.0 page frame 4685 EMS_SH_ret equ EMS_SH_Ret ; NASM port label 4686 je EMS_SH_ret ; do not install stub. 7/24/88. HKN 4687 %ENDIF 4688 Round equ ROUND ; NASM port label 4689 call Round ;AN030; 4690 mov ax, DEVMARK_EMS_STUB ;AN030; 4691 call SetDevMark ;AN030; 4692 memhi equ MEMHI ; NASM port label 4693 mov ax, [cs:memhi] ;AN030; 4694 mov es, ax ;AN030; 4695 assume es:nothing ;AN030; 4696 xor di, di ;AN030; 4697 push cs ;AN030; 4698 pop ds ;AN030; 4699 mov cx, offset EMS_STUB_END ;AN030; 4700 mov si, offset EMS_STUB_START ;AN030; 4701 sub cx, si ;AN030;cx = size in byte 4702 memlo equ MEMLO ; NASM port label 4703 mov [cs:memlo], cx ;AN030; 4704 rep movsb ;AN030; 4705 or byte [cs:SetDevMarkFlag], FOR_DEVMARK ;AN030;set the devmark_size for MEM command. 4706 call Round ;AN030;and get the next [memhi] avaiable. 4707 mov byte [cs:EMS_Stub_Installed], 1 ;AN030; 4708 4709 xor ax, ax ;AN030; 4710 mov ds, ax ;AN030; 4711 cli ;AN030; 4712 mov word ptr [2Fh*4],NEWEMS2F_OFF;AN030;set the new int 2fh, 67h vectors. 4713 mov word ptr [2Fh*4+2], es ;AN030; 4714 mov word ptr [67h*4],NEW67_OFFSET;AN030; 4715 mov word ptr [67h*4+2], es ;AN030; 4716 sti ;AN030; 4717 EMS_SH_Ret: ;AN030; 4718 pop cx ;AN030; 4719 pop ax ;AN030; 4720 pop di ;AN030; 4721 pop ds ;AN030; 4722 pop si ;AN030; 4723 pop es ;AN030; 4724 ret ;AN030; 4725 4726 EMS_Stub_Handler endp ;AN030; 4727 %endif ; BUF2 4728 4729 4730 global ldos_getnum_far 4731 extern ldos_getnum 4732 ldos_getnum_far: 0 000028B1 E8[0000] call ldos_getnum 0 000028B4 CB retf 4735 4736 global isstring?, skipcomma, skipcomm0, skipwhite, skipwh0 4737 skipcomma: 0 000028B5 AC lodsb 4739 skipcomm0: 0 000028B6 E80600 call skipwh0 0 000028B9 3C2C cmp al, ',' 0 000028BB 7401 je skipwhite 0 000028BD C3 retn 4744 4745 skipwhite: 0 000028BE AC lodsb 4747 skipwh0: 0 000028BF 3C20 cmp al, 32 0 000028C1 74FB je skipwhite 0 000028C3 3C09 cmp al, 9 0 000028C5 74F7 je skipwhite 0 000028C7 C3 retn 4753 4754 4755 ; Check for given string (cap-insensitive) 4756 ; 4757 ; INP: ds:si -> input string to check (either cap), 4758 ; terminated by CR (13), NUL, semicolon, space, 4759 ; tab, dot, comma, equals, colon, [, ], (, or ) 4760 ; es:dx -> ASCIZ string to check (all-caps) 4761 ; OUT: Iff string matches, 4762 ; ZR, NC 4763 ; si -> at separator that terminates the keyword 4764 ; else, 4765 ; NZ, CY 4766 ; si = input si 4767 ; CHG: dx, al 4768 isstring?: 0 000028C8 56 push si 0 000028C9 87D7 xchg dx, di 4771 .loop: 0 000028CB AC lodsb 0 000028CC E84800 call capitalise 0 000028CF AE scasb 0 000028D0 7506 jne .mismatch 0 000028D2 84C0 test al, al ; NC 0 000028D4 75F5 jne .loop 4778 ; ZR 0 000028D6 EB39 jmp .matched_zr_nc 4780 4781 .mismatch: 0 000028D8 E84700 call iseol? 0 000028DB 742D je .checkend 0 000028DD 3C20 cmp al, 32 0 000028DF 7429 je .checkend 0 000028E1 3C09 cmp al, 9 0 000028E3 7425 je .checkend 0 000028E5 3C2E cmp al, '.' 0 000028E7 7421 je .checkend 0 000028E9 3C2C cmp al, ',' 0 000028EB 741D je .checkend 0 000028ED 3C3D cmp al, '=' 0 000028EF 7419 je .checkend 0 000028F1 3C3A cmp al, ':' 0 000028F3 7415 je .checkend 0 000028F5 3C5B cmp al, '[' 0 000028F7 7411 je .checkend 0 000028F9 3C5D cmp al, ']' 0 000028FB 740D je .checkend 0 000028FD 3C28 cmp al, '(' 0 000028FF 7409 je .checkend 0 00002901 3C29 cmp al, ')' 0 00002903 7405 je .checkend 4804 .ret_nz: ; NZ 0 00002905 5E pop si 0 00002906 F9 stc ; CY 4807 .ret: 0 00002907 87D7 xchg dx, di 0 00002909 C3 retn 4810 4811 .checkend: 0 0000290A 26807DFF00 cmp byte [es:di - 1], 0 0 0000290F 75F4 jne .ret_nz 4814 ; ZR, NC 4815 .matched_zr_nc: ; ZR, NC 0 00002911 5F pop di ; (discard) 0 00002912 8D74FF lea si, [si - 1] ; -> separator (preserve ZR) 0 00002915 EBF0 jmp .ret 4819 4820 4821 capitalise: 0 00002917 3C61 cmp al, 'a' 0 00002919 7206 jb .ret 0 0000291B 3C7A cmp al, 'z' 0 0000291D 7702 ja .ret 0 0000291F 24DF and al, ~ 20h 4827 .ret: 0 00002921 C3 retn 4829 4830 iseol?: 0 00002922 3C3B cmp al, ';' 0 00002924 740A je .ret 4833 .notsemicolon: 0 00002926 3C0D cmp al, 13 0 00002928 7406 je .ret 0 0000292A 3C0A cmp al, 10 0 0000292C 7402 je .ret 0 0000292E 3C00 cmp al, 0 4839 .ret: 0 00002930 C3 retn 4841 4842 4843 ; (no prior section) ; SYSINITSEG ENDS 4844 END 4845 4846 === Trace listing source: sysinit2.lst 1 ; PAGE ,132 ; 2 ; SCCSID = @(#)sysinit2.asm 1.13 85/10/15 3 ;TITLE BIOS SYSTEM INITIALIZATION 4 %warning out: ...SYSINIT2 4 ****************** warning: out: ...SYSINIT2 [-w+user] 5 6 ;============================================================================== 7 ;REVISION HISTORY: 8 ;AN000 - New for DOS Version 4.00 - J.K. 9 ;AC000 - Changed for DOS Version 4.00 - J.K. 10 ;AN00x - PTM number for DOS Version 4.00 - J.K. 11 ;============================================================================== 12 ;AN001; p132 Multiple character device installation problem. 6/27/87 J.K. 13 ;AN002; d24 MultiTrack= command added. 6/29/87 J.K. 14 ;AN003; p29 Extra space character in parameters passed. 15 ; (Modification on ORGANIZE routine for COMMENT= fixed this 16 ; problem too) 6/29/87 J.K. 17 ;AN004; d41 REM command in CONFIG.SYS 7/7/87 J.K. 18 ;AN005; d184 Set DEVMARK for MEM command 8/25/87 J.K. 19 ;AN006; p1820 New Message SKL file 10/20/87 J.K. 20 ;AN007; p1821 Include the COPYRIGH.INC file 10/22/87 J.K. 21 ;AN008; p2210 IBMDOS returns incorrect DBCS vector table length 11/02/87 J.K. 22 ;AN009; p2667 ccMono_Ptr problem 11/30/87 J.K. 23 ;AN010; p2792 Device?driver.sys /d:2 command should not work 12/09/87 J.K. 24 ;AN011; p3120 REM followed by CR, LF causes problem 01/13/88 J.K. 25 ;AN012; p3111 Take out the order dependency of the INSTALL= 01/25/88 J.K. 26 ;AN013; d479 New option to disable extended INT 16h function call 02/12/88 J.K. 27 ;AN014; D486 SHARE installation for big media 02/23/88 J.K. 28 ;AN015; D526 Add /NC parameter when installing SHARE.EXE 04/28/88 J.K. 29 ;============================================================================== 30 31 TRUE EQU 0FFFFh 32 FALSE EQU 0 33 LF equ 10 34 CR equ 13 35 TAB equ 9 36 37 IBMVER EQU TRUE 38 IBM EQU IBMVER 39 STACKSW EQU TRUE ;Include Switchable Hardware Stacks 40 IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 41 %iassign MSVER FALSE 42 ALTVECT EQU FALSE ;Switch to build ALTVECT version 43 KANJI EQU FALSE 44 45 %IF IBMJAPVER 46 NOEXEC EQU TRUE 47 %ELSE 48 NOEXEC EQU FALSE 49 %ENDIF 50 51 ;DOSSIZE EQU 0A000H 52 53 54 [list -] 54 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 54 ****************** warning: out: BPB.INC... [-w+user] 54 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 54 ****************** warning: out: DEVSYM.INC... [-w+user] 54 ****************** warning: out: IOCTL.INC... [-w+user] 54 ****************** warning: out: BPB.INC... [-w+user] 54 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <2> [list -] 13 <1> [list -] 62 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 1 <2> [list -] 14 <2> [list -] 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 63 [list +] 64 65 %IFN IBM 66 %IFN IBMJAPVER 67 EXTRN RE_INIT:FAR 68 %ENDIF 69 %ENDIF 70 71 extrn EC35_Flag: byte 72 ; (no prior section) ; code ends 73 === Switch to base=00C400h -> "SYSINITSEG" 74 section SYSINITSEG PUBLIC class=INIT align=1 75 76 EXTRN BADOPM:BYTE,CRLFM:BYTE,BADCOM:BYTE,BADMEM:BYTE,BADBLOCK:BYTE 77 EXTRN BADSIZ_PRE:BYTE,BADLD_PRE:BYTE 78 ; EXTRN BADSIZ_POST:BYTE,BADLD_POST:BYTE 79 EXTRN SYSSIZE:BYTE,BADCOUNTRY:BYTE 80 81 EXTRN dosinfo:dword,entry_point:dword 82 EXTRN MEMORY_SIZE:WORD,fcbs:byte,keep:byte 83 EXTRN DEFAULT_DRIVE:BYTE,conf_block:word 84 EXTRN BUFFERS:WORD,zero:byte,sepchr:byte 85 EXTRN FILES:BYTE 86 EXTRN count:word,chrptr:word 87 EXTRN bufptr:byte 88 EXTRN area:word,PACKET:BYTE,UNITCOUNT:BYTE 89 EXTRN BREAK_ADDR:DWORD,BPB_ADDR:DWORD,drivenumber:byte 90 extrn COM_Level:byte, CMMT:byte, CMMT1:byte, CMMT2:byte 91 extrn Cmd_Indicator:byte 92 extrn DoNotShowNum:byte 93 extrn MultDeviceFlag:byte 94 extrn DevMark_Addr:word ;AN005; 95 extrn SetDevMarkFlag:byte ;AN005; 96 extrn Org_Count:word ;AN012; 97 extern devicehighflag, devicehighdata, devicehighafter, devicehighsd 98 extern deviceafter 99 extern sysinit_get_ds_dosbiodata 100 101 EXTRN Stall:near 102 EXTRN Error_Line:near 103 104 Open_Dev equ OPEN_DEV ; NASM port label 105 Organize equ ORGANIZE ; NASM port label 106 Mem_Err equ MEM_ERR ; NASM port label 107 Newline equ NEWLINE ; NASM port label 108 CallDev equ CALLDEV ; NASM port label 109 Badload equ BADLOAD ; NASM port label 110 PUBLIC Open_Dev,Organize,Mem_Err,Newline,CallDev,Badload 111 PrnDev equ PRNDEV ; NASM port label 112 AuxDev equ AUXDEV ; NASM port label 113 Commnd equ COMMND ; NASM port label 114 Condev equ CONDEV ; NASM port label 115 GetNum equ GETNUM ; NASM port label 116 BadFil equ BADFIL ; NASM port label 117 PrnErr equ PRNERR ; NASM port label 118 PUBLIC PrnDev,AuxDev,Commnd,Condev,GetNum,BadFil,PrnErr 119 Delim equ DELIM ; NASM port label 120 Print equ PRINT ; NASM port label 121 Set_Break equ SET_BREAK ; NASM port label 122 PUBLIC Delim,Print,Set_Break 123 PUBLIC SetParms, ParseLine, sysinit_DiddleBack 124 Skip_delim equ SKIP_DELIM ; NASM port label 125 Set_Country_Path equ SET_COUNTRY_PATH ; NASM port label 126 Move_Asciiz equ MOVE_ASCIIZ ; NASM port label 127 PUBLIC Skip_delim,SetDOSCountryInfo,Set_Country_Path,Move_Asciiz 128 Cntry_Drv equ CNTRY_DRV ; NASM port label 129 Cntry_Root equ CNTRY_ROOT ; NASM port label 130 Cntry_Path equ CNTRY_PATH ; NASM port label 131 PUBLIC Cntry_Drv,Cntry_Root,Cntry_Path 132 PUBLIC Delim 133 public PathString ;AN014; 134 public LShare ;AN014; 135 136 ; 137 ; The following set of routines is used to parse the DRIVPARM = command in 138 ; the CONFIG.SYS file to change the default drive parameters. 139 ; 140 SetParms: 141 assume ds:nothing, es:nothing, ss:nothing 0 00002931 1E push ds 0 00002932 50 push ax 0 00002933 53 push bx 0 00002934 51 push cx 0 00002935 52 push dx 0 00002936 0E push cs 0 00002937 1F pop ds 149 assume ds:SYSINITGROUP 0 00002938 31DB xor bx,bx 0 0000293A 8A1E[150C] mov bl,byte ptr [sysinit_drive] 0 0000293E FEC3 inc bl ; get it correct for IOCTL call (1=A,2=B...) 0 00002940 BA[ED0A] mov dx,offset DeviceParameters 154 IOCTL equ IOCtl ; NASM port equate 0 00002943 B444 mov ah, IOCTL 0 00002945 B00D mov al, GENERIC_IOCTL 0 00002947 B508 mov ch, RAWIO 0 00002949 B140 mov cl, SET_DEVICE_PARAMETERS 0 0000294B CD21 int 21H 0 0000294D F706[160C]0400 test word [Switches], flagec35 0 00002953 740F jz Not_EC35 162 0 00002955 8A0E[150C] mov cl, byte ptr [sysinit_drive] ; which drive was this for? 0 00002959 E8[0000] call sysinit_get_ds_dosbiodata 165 assume ds:DOSGROUP 0 0000295C B001 mov al, 1 ; assume drive 0 0 0000295E D2E0 shl al, cl ; set proper bit depending on drive 0 00002960 0806[0000] or [EC35_Flag], al ; set the bit in the permanent flags 169 170 Not_EC35: 0 00002964 5A pop dx ; fix up all the registers 0 00002965 59 pop cx 0 00002966 5B pop bx 0 00002967 58 pop ax 0 00002968 1F pop ds 176 assume ds:nothing 0 00002969 C3 ret 178 179 ; 180 ; Replace default values for further DRIVPARM commands 181 ; 182 sysinit_DiddleBack: 183 assume ds:nothing 0 0000296A 1E push ds 0 0000296B 0E push cs 0 0000296C 1F pop ds 187 assume ds:SYSINITGROUP 188 DP_Cylinders equ DP_CYLINDERS ; NASM port equate 0 0000296D C706[F10A]5000 mov word [DeviceParameters + DP_Cylinders],80 190 DP_DeviceType equ DP_DEVICETYPE ; NASM port equate 0 00002973 C606[EE0A]02 mov byte [DeviceParameters + DP_DeviceType], DEV_3INCH720KB 192 DP_DeviceAttributes equ DP_DEVICEATTRIBUTES ; NASM port equate 0 00002978 C706[EF0A]0000 mov word [DeviceParameters + DP_DeviceAttributes],0 194 switches equ Switches ; NASM port label 0 0000297E C706[160C]0000 mov word [switches],0 ; zero all switches 0 00002984 1F pop ds 197 assume ds:nothing 0 00002985 C3 ret 199 200 ; 201 ; Entry point is ParseLine. AL contains the first character in command line. 202 ; 203 ParseLine: ; don't get character first time 204 assume ds:nothing 0 00002986 1E push ds 0 00002987 0E push cs 0 00002988 1F pop ds 208 ASSUME DS:SYSINITGROUP 209 NextSwtch: 0 00002989 3C0D cmp al,CR ; carriage return? 0 0000298B 7422 jz done_line 0 0000298D 3C0A cmp al,LF ; linefeed? 0 0000298F 743E jz put_back ; put it back and done 214 ; Anything less or equal to a space is ignored. 0 00002991 3C20 cmp al,' ' ; space? 0 00002993 7610 jbe get_next ; skip over space 0 00002995 3C2F cmp al,'/' 0 00002997 7403 jz getparm 0 00002999 F9 stc ; mark error invalid-character-in-input 0 0000299A EB31 jmp short exitpl 221 222 getparm: 0 0000299C E83A00 call Check_Switch 0 0000299F 891E[160C] mov word ptr [Switches],BX ; save switches read so far 0 000029A3 7207 jc swterr 226 get_next: 0 000029A5 E8[0000] invoke getchr 0 000029A8 7205 jc done_line 0 000029AA EBDD jmp NextSwtch 230 swterr: 0 000029AC EB1F jmp exitpl ; exit if error 0 000029AE 90 nop ; identicalise 233 234 done_line: 0 000029AF F706[160C]0800 test word [Switches],flagdrive ; see if drive specified 0 000029B5 7503 jnz okay 0 000029B7 F9 stc ; mark error no-drive-specified 0 000029B8 EB13 jmp short exitpl 239 240 okay: 0 000029BA A1[160C] mov ax,word ptr [switches] 0 000029BD 83E003 and ax,0003H ; get flag bits for changeline and non-rem 0 000029C0 A3[EF0A] mov word ptr [DeviceParameters + DP_DeviceAttributes],ax 244 DP_TrackTableEntries equ DP_TRACKTABLEENTRIES ; NASM port equate 0 000029C3 C706[130B]0000 mov word [DeviceParameters + DP_TrackTableEntries], 0 0 000029C9 F8 clc ; everything is fine 0 000029CA E8A000 call sysinit_SetDeviceParameters 248 exitpl: 0 000029CD 1F pop ds 250 assume ds:nothing 0 000029CE C3 ret 252 253 put_back: 254 assume ds:SYSINITGROUP 0 000029CF FF06[0000] inc word [count] ; one more char to scan 0 000029D3 FF0E[0000] dec word [chrptr] ; back up over linefeed 0 000029D7 EBD6 jmp short done_line 258 ; 259 ; Processes a switch in the input. It ensures that the switch is valid, and 260 ; gets the number, if any required, following the switch. The switch and the 261 ; number *must* be separated by a colon. Carry is set if there is any kind of 262 ; error. 263 ; 264 Check_Switch: 0 000029D9 E8[0000] invoke getchr 0 000029DC 7252 jc err_check 0 000029DE 24DF and al,0DFH ; convert it to upper case 0 000029E0 3C41 cmp al,'A' 0 000029E2 724C jb err_check 0 000029E4 3C5A cmp al,'Z' 0 000029E6 7748 ja err_check 0 000029E8 06 push es 0 000029E9 0E push cs 0 000029EA 07 pop es 275 assume es:SYSINITGROUP 0 000029EB 8A0E[8C0C] mov cl,byte ptr [switchlist] ; get number of valid switches 0 000029EF B500 mov ch,0 0 000029F1 BF[8D0C] mov di,1+offset switchlist ; point to string of valid switches 0 000029F4 F2AE repne scasb 0 000029F6 07 pop es 281 assume es:nothing 0 000029F7 7537 jnz err_check 0 000029F9 B80100 mov ax,1 0 000029FC D3E0 shl ax,cl ; set bit to indicate switch 0 000029FE 8B1E[160C] mov bx,word ptr [switches] ; get switches so far 0 00002A02 09C3 or bx,ax ; save this with other switches 0 00002A04 89C1 mov cx,ax 0 00002A06 A9F800 test ax, switchnum ; test against switches that require number to follow 0 00002A09 90 nop ; identicalise 0 00002A0A 7420 jz done_swtch 0 00002A0C E8[0000] invoke getchr 292 err_Swtch equ err_swtch ; NASM port label 0 00002A0F 721D jc err_Swtch 0 00002A11 3C3A cmp al,':' 0 00002A13 7519 jnz err_swtch 0 00002A15 E8[0000] invoke getchr 0 00002A18 53 push bx ; preserve switches 0 00002A19 2EC606[0000]20 mov byte [cs:sepchr],' ' ; allow space separators 0 00002A1F E81304 call GetNum 0 00002A22 2EC606[0000]00 mov byte [cs:sepchr],0 0 00002A28 5B pop bx ; restore switches 302 ; Because GetNum does not consider carriage-return or line-feed as OK, we do 303 ; not check for carry set here. If there is an error, it will be detected 304 ; further on (hopefully). 0 00002A29 E80600 call Process_Num 306 307 done_swtch: 0 00002A2C F8 clc 0 00002A2D C3 ret 310 311 err_swtch: 0 00002A2E 31CB xor bx,cx ; remove this switch from the records 313 err_check: 0 00002A30 F9 stc 0 00002A31 C3 ret 316 317 ; 318 ; This routine takes the switch just input, and the number following (if any), 319 ; and sets the value in the appropriate variable. If the number input is zero 320 ; then it does nothing - it assumes the default value that is present in the 321 ; variable at the beginning. Zero is OK for form factor and drive, however. 322 ; 323 Process_Num: 0 00002A32 850E[160C] test word ptr [Switches],cx ; if this switch has been done before, 0 00002A36 7533 jnz done_ret ; ignore this one. 0 00002A38 F7C10800 test cx,flagdrive 0 00002A3C 7405 jz try_f 0 00002A3E A2[150C] mov byte ptr [sysinit_drive],al 0 00002A41 EB28 jmp short done_ret 330 331 try_f: 0 00002A43 F7C18000 test cx,flagff 0 00002A47 7405 jz try_t 334 ; Ensure that we do not get bogus form factors that are not supported 335 ;cmp al,Max_Dev_Type 336 ;ja done_ret 0 00002A49 A2[EE0A] mov byte ptr [DeviceParameters + DP_DeviceType],al 0 00002A4C EB1D jmp short done_ret 339 340 try_t: 0 00002A4E 09C0 or ax,ax 0 00002A50 7419 jz done_ret ; if number entered was 0, assume default value 0 00002A52 F7C11000 test cx,flagcyln 0 00002A56 7405 jz try_s 0 00002A58 A3[F10A] mov word ptr [DeviceParameters + DP_Cylinders],ax 0 00002A5B EB0E jmp short done_ret 347 348 try_s: 0 00002A5D F7C12000 test cx,flagseclim 0 00002A61 7405 jz try_h 0 00002A63 A3[130C] mov word ptr [slim],ax 0 00002A66 EB03 jmp short done_ret 353 ; 354 ; Must be for number of heads 355 try_h: 0 00002A68 A3[110C] mov word ptr [hlim],ax 357 358 done_ret: 0 00002A6B F8 clc 0 00002A6C C3 ret 361 362 ; 363 ; sysinit_SetDeviceParameters sets up the recommended BPB in each BDS in the 364 ; system based on the form factor. It is assumed that the BPBs for the 365 ; various form factors are present in the BPBTable. For hard files, 366 ; the Recommended BPB is the same as the BPB on the drive. 367 ; No attempt is made to preserve registers since we are going to jump to 368 ; SYSINIT straight after this routine. 369 ; 370 sysinit_SetDeviceParameters: 371 assume ds:SYSINITGROUP, es:nothing 0 00002A6D 06 push es 0 00002A6E 0E push cs 0 00002A6F 07 pop es 375 ASSUME ES:SYSINITGROUP 0 00002A70 31DB xor bx,bx 0 00002A72 8A1E[EE0A] mov bl,byte ptr [DeviceParameters + DP_DeviceType] 0 00002A76 80FB00 cmp bl,DEV_5INCH 0 00002A79 7507 jnz Got_80 0 00002A7B B92800 mov cx,40 ; 48tpi has 40 cylinders 0 00002A7E 890E[F10A] mov word ptr [DeviceParameters + DP_Cylinders],cx 382 Got_80: 0 00002A82 D1E3 shl bx,1 ; get index into BPB table 0 00002A84 BE[7C0C] mov si,offset sysinit_BPBTable 0 00002A87 8B30 mov si,word ptr [si+bx] ; get address of BPB 386 .Set_RecBPB: 0 00002A89 BF[F40A] mov di,offset DeviceParameters + DP_BPB ; es:di -> BPB 388 a_BPB_struc_size equ A_BPB_struc_size ; NASM port equate 0 00002A8C B91F00 mov cx,a_BPB_struc_size 0 00002A8F FC cld 0 00002A90 F3A4 repe movsb 0 00002A92 07 pop es 393 ASSUME ES:NOTHING 0 00002A93 F706[160C]2000 test word [switches],flagseclim 0 00002A99 7406 jz see_heads 0 00002A9B A1[130C] mov ax,word ptr [slim] 397 BPB_SectorsPerTrack equ BPB_SECTORSPERTRACK ; NASM port equate 0 00002A9E A3[010B] mov word ptr [DeviceParameters + DP_BPB + BPB_SectorsPerTrack],ax 399 see_heads: 0 00002AA1 F706[160C]4000 test word [switches],flagheads 0 00002AA7 743E jz Set_All_Done 0 00002AA9 A1[110C] mov ax,word ptr [hlim] 403 BPB_Heads equ BPB_HEADS ; NASM port equate 0 00002AAC A3[030B] mov word ptr [DeviceParameters + DP_BPB + BPB_Heads],ax 405 ; 406 ; We need to set the media byte and the total number of sectors to reflect the 407 ; number of heads. We do this by multiplying the number of heads by the number 408 ; of 'sectors per head'. This is not a fool-proof scheme!! 409 ; 0 00002AAF 89C1 mov cx,ax ; cx has number of heads 0 00002AB1 FEC9 dec cl ; get it 0-based 412 BPB_TotalSectors equ BPB_TOTALSECTORS ; NASM port equate 0 00002AB3 A1[FC0A] mov ax,[DeviceParameters + DP_BPB + BPB_TotalSectors] ; this is OK for two heads 0 00002AB6 D1F8 sar ax,1 ; ax contains # of sectors/head 0 00002AB8 D3E0 sal ax,cl 0 00002ABA 722B jc Set_All_Done ; We have too many sectors - overflow!! 0 00002ABC A3[FC0A] mov [DeviceParameters + DP_BPB + BPB_TotalSectors],ax 418 ; Set up correct Media Descriptor Byte 0 00002ABF 80F901 cmp cl,1 0 00002AC2 B3F0 mov bl,0F0H 0 00002AC4 B002 mov al,2 ; AL contains sectors/cluster 0 00002AC6 7717 ja Got_Correct_Mediad 423 BPB_MediaDescriptor equ BPB_MEDIADESCRIPTOR ; NASM port equate 0 00002AC8 8A1E[FE0A] mov bl,byte ptr [DeviceParameters + DP_BPB + BPB_MediaDescriptor] 0 00002ACC 7411 je Got_Correct_Mediad 426 ; We have one head - OK for 48tpi medium 0 00002ACE B001 mov al,1 ; AL contains sectors/cluster 0 00002AD0 8A2E[EE0A] mov ch,[DeviceParameters + DP_DeviceType] 0 00002AD4 80FD00 cmp ch,DEV_5INCH 0 00002AD7 7404 jz Dec_Mediad 0 00002AD9 B3F0 mov bl,0F0H 0 00002ADB EB02 jmp short Got_Correct_Mediad 433 Dec_Mediad: 0 00002ADD FECB dec bl ; adjust for one head 435 Got_Correct_Mediad: 0 00002ADF 881E[FE0A] mov byte ptr [DeviceParameters + DP_BPB + BPB_MediaDescriptor],bl 437 BPB_SectorsPerCluster equ BPB_SECTORSPERCLUSTER ; NASM port equate 0 00002AE3 A2[F60A] mov byte ptr [DeviceParameters + DP_BPB + BPB_SectorsPerCluster],al 0 00002AE6 F8 clc 440 Set_All_Done: 0 00002AE7 C3 RET 442 443 ASSUME DS:NOTHING, ES:NOTHING 444 0 00002AE8 F9 NOCHAR1: STC 0 00002AE9 C3 return 447 448 ORGANIZE: 449 assume ds:nothing, es:nothing, ss:SYSINITGROUP 450 COUNT equ count ; NASM port label 0 00002AEA 2E8B0E[0000] MOV CX,[cs:COUNT] 0 00002AEF E3F7 JCXZ NOCHAR1 0 00002AF1 E86D02 CALL MAPCASE 0 00002AF4 31F6 XOR SI,SI 0 00002AF6 89F7 MOV DI,SI 0 00002AF8 31C0 xor ax,ax 0 00002AFA 2EC606[0000]00 mov byte [cs:COM_Level], 0 458 459 ;ORG1: CALL GET ;SKIP LEADING CONTROL CHARACTERS 460 ; CMP AL,' ' 461 ; JB ORG1 462 Org1: 0 00002B00 E8E801 call Skip_Comment ;AN000; 0 00002B03 740E jz End_Commd_Line ;AN000; found a comment string and skipped. 465 Get2 equ GET2 ; NASM port label 0 00002B05 E8DB01 call Get2 ;AN000; Not a comment string. Then get a char. 0 00002B08 3C0A cmp al, LF ;AN000; 0 00002B0A 7407 je End_Commd_Line ;AN000; starts with a blank line. 0 00002B0C 3C20 cmp al, ' ' ;AN000; 0 00002B0E 76F0 jbe Org1 ;AN000; skip leading control characters 0 00002B10 EB0A jmp org1_Findit ;AN000; 0 00002B12 90 nop ; identicalise 473 End_Commd_Line: ;AN000; 0 00002B13 AA stosb ;AN000; store line feed char in buffer for the LineCount. 0 00002B14 2EC606[0000]00 mov byte [cs:COM_Level], 0 ;AN000; reset the command level. 0 00002B1A EBE4 jmp Org1 ;AN000; 477 org1_Findit: ;AN000; 0 00002B1C 51 PUSH CX 0 00002B1D 56 PUSH SI 0 00002B1E 57 PUSH DI 0 00002B1F 89F5 MOV BP,SI 0 00002B21 4D DEC BP 0 00002B22 BE[D009] MOV SI,OFFSET COMTAB ;Prepare to search command table 0 00002B25 B500 MOV CH,0 485 FINDCOM: 0 00002B27 89EF MOV DI,BP 0 00002B29 8A0C MOV CL,[SI] 0 00002B2B 46 INC SI 0 00002B2C E324 JCXZ NOCOM 0 00002B2E F3A6 REPE CMPSB 0 00002B30 9F LAHF 0 00002B31 01CE ADD SI,CX ;Bump to next position without affecting flags 0 00002B33 9E SAHF 0 00002B34 AC LODSB ;Get indicator letter 0 00002B35 75F0 JNZ FINDCOM 0 00002B37 26803D0D cmp byte ptr [es:di], CR ;AN011;The next char might be CR,LF 0 00002B3B 7410 je GotCom0 ;AN011; such as in "REM",CR,LF case. 0 00002B3D 26803D0A cmp byte ptr [es:di], LF ;AN011; 0 00002B41 740A je GotCom0 ;AN011; 0 00002B43 50 push ax ;AN010; 0 00002B44 268A05 mov al, byte ptr [es:di] ;AN010;Now the next char. should be a delim. 502 delim equ DELIM ; NASM port label 0 00002B47 E8DC01 call delim ;AN010; 0 00002B4A 58 pop ax ;AN010; 505 findcom equ FINDCOM ; NASM port label 0 00002B4B 75DA jnz findcom ;AN010; 507 GotCom0: 0 00002B4D 5F POP DI 0 00002B4E 5E POP SI 0 00002B4F 59 POP CX 0 00002B50 EB0F JMP SHORT GOTCOM 512 513 NOCOM: 0 00002B52 5F POP DI 0 00002B53 5E POP SI 0 00002B54 59 POP CX 0 00002B55 B05A MOV AL,'Z' 0 00002B57 AA stosb ;AN000; save indicator char. 519 Skip_Line: ;AN000; 0 00002B58 E88801 call Get2 ;AN000; 0 00002B5B 3C0A cmp al, LF ;AN000; skip this bad command line 0 00002B5D 75F9 jne Skip_Line ;AN000; 0 00002B5F EBB2 jmp End_Commd_Line ;AN000; handle next command line 524 0 00002B61 AA GOTCOM: STOSB ;SAVE INDICATOR CHAR IN BUFFER 0 00002B62 2EA2[0000] mov [cs:Cmd_Indicator], al ;AN000; save it for the future use. 527 0 00002B66 E87A01 ORG2: CALL GET2 ;SKIP the commad name UNTIL DELIMITER 0 00002B69 3C0A cmp al, LF ;AN011; 0 00002B6B 740B je Org21 ;AN011; 0 00002B6D 3C0D cmp al, CR ;AN011; 0 00002B6F 7407 je Org21 ;AN011; 0 00002B71 E8B201 CALL DELIM ; 0 00002B74 75F0 JNZ ORG2 0 00002B76 EB02 jmp short Org3 ;AN011; 536 Org21: ;AN011;if CR or LF then 0 00002B78 4E dec si ;AN011; undo SI, CX register 0 00002B79 41 inc cx ;AN011; and continue 539 540 ;ORG4: CALL GET2 541 ; call Delim ;J.K. 5/30/86. To permit "device=filename/p..." stuff. 542 ; jz ORG_EXT ;J.K. 5/30/86 543 ;Org4_Cont: 544 ; STOSB 545 ; CMP AL,' ' 546 ; JA ORG4 547 ; CMP AL,10 548 ; JZ ORG1 549 ; 550 ; MOV BYTE PTR [ES:DI-1],0 551 552 Org3: 0 00002B7A 2E803E[0000]59 cmp byte [cs:Cmd_Indicator], 'Y' ;AN000; Comment= command? 554 Get_Cmt_Token equ Get_Cmt_token ; NASM port label 0 00002B80 7503E9B900 je Get_Cmt_Token ;AN000; 0 00002B85 2E803E[0000]69 cmp byte [cs:Cmd_Indicator], 'i' ; InstallHigh= command? 0 00002B8B 747F je Org_file 0 00002B8D 2E803E[0000]49 cmp byte [cs:Cmd_Indicator], 'I' ;AN000; Install= command? 0 00002B93 7477 je Org_file ;AN000; 0 00002B95 2E803E[0000]E9 cmp byte [cs:Cmd_Indicator], 'i' | 80h; InstallLastHigh= command? 0 00002B9B 746F je Org_file 0 00002B9D 2E803E[0000]C9 cmp byte [cs:Cmd_Indicator], 'I' | 80h; InstallLast= command? 0 00002BA3 7467 je Org_file ;AN000; 0 00002BA5 2E803E[0000]34 cmp byte [cs:Cmd_Indicator], '4' ; InstallFirstHigh= command? 0 00002BAB 745F je Org_file 0 00002BAD 2E803E[0000]33 cmp byte [cs:Cmd_Indicator], '3' ; InstallFirst= command? 0 00002BB3 7457 je Org_file 0 00002BB5 2E803E[0000]36 cmp byte [cs:Cmd_Indicator], '6' ; InstallMidHigh= command? 0 00002BBB 744F je Org_file 0 00002BBD 2E803E[0000]35 cmp byte [cs:Cmd_Indicator], '5' ; InstallMid= command? 0 00002BC3 7447 je Org_file 0 00002BC5 2E803E[0000]64 cmp byte [cs:Cmd_Indicator], 'd' ; DEVICEHIGH= command? 0 00002BCB 743F je Org_file ;AN000; 0 00002BCD 2E803E[0000]44 cmp byte [cs:Cmd_Indicator], 'D' ;AN000; Device= command? 0 00002BD3 7437 je Org_file ;AN000; 0 00002BD5 2E803E[0000]4A cmp byte [cs:Cmd_Indicator], 'J' ;AN000; IFS= command? 0 00002BDB 742F je Org_file ;AN000; 0 00002BDD 2E803E[0000]73 cmp byte [cs:Cmd_Indicator], 's' 0 00002BE3 7427 je Org_file 0 00002BE5 2E803E[0000]53 cmp byte [cs:Cmd_Indicator], 'S' ;AN000; Shell= is a special one!!! 0 00002BEB 741F je Org_file ;AN000; 0 00002BED 2E803E[0000]31 cmp byte [cs:Cmd_Indicator], '1' ;AN013; SWITCHES= command? 0 00002BF3 7403 je Org_Switch ;AN013; 0 00002BF5 E9AA00 jmp Org4 ;AN000; 585 Org_Switch: 0 00002BF8 E8F000 call Skip_Comment ;AN013; 0 00002BFB 7503E98200 jz End_Commd_Line_Brdg ;AN013; 0 00002C00 E8E000 call Get2 ;AN013; 0 00002C03 E82801 call Org_Delim ;AN013; 0 00002C06 74F0 jz Org_Switch ;AN013; 0 00002C08 AA stosb ;AN013; 0 00002C09 E9A600 jmp Org5 ;AN013; 593 Org_file: ;AN000; Get the filename and put 0 at end, 0 00002C0C E8DC00 call Skip_Comment ;AN000; 0 00002C0F 7474 jz Org_Put_Zero ;AN000; 0 00002C11 E8CF00 call Get2 ;AN000; Not a comment 0 00002C14 3C0D cmp al, 13 0 00002C16 740B je .zero 0 00002C18 3C0A cmp al, 10 0 00002C1A 7407 je .zero 0 00002C1C E80701 call Delim ;AN000; 0 00002C1F 74EB jz Org_file ;AN000; Skip the possible delimeters 0 00002C21 AA stosb ;AN000; copy the first non delim char found in buffer 0 00002C22 A9 db __TEST_IMM16 ; skip dec, inc 605 .zero: 0 00002C23 4E dec si 0 00002C24 41 inc cx 608 Org_Copy_File: ;AN000; 0 00002C25 E8C300 call Skip_Comment ;AN000; comment char in the filename? 0 00002C28 745B jz Org_Put_Zero ;AN000; then stop copying filename at that point 0 00002C2A E8B600 call Get2 ;AN000; 0 00002C2D 3C2F cmp al, '/' ;AN000; a switch char? (device=filename/xxx) 613 End_File_slash equ End_file_slash ; NASM port label 0 00002C2F 745C je End_File_slash ;AN000; this will be the special case. 0 00002C31 AA stosb ;AN000; save the char. in buffer 0 00002C32 E8F100 call Delim ;AN000; 0 00002C35 745F jz End_Copy_File ;AN000; 0 00002C37 3C20 cmp al, ' ' ;AN000; 0 00002C39 77EA ja Org_Copy_File ;AN000; keep copying 0 00002C3B EB59 jmp End_Copy_File ;AN000; otherwise, assume end of the filename. 0 00002C3D 90 nop ; identicalise 622 Get_Cmt_token: ;AN000; get the token. Just max. 2 char. 0 00002C3E E8A200 call Get2 ;AN000; 0 00002C41 3C20 cmp al, ' ' ;AN000; skip white spaces or "=" char. 0 00002C43 74F9 je Get_Cmt_Token ;AN000; (we are allowing the other special 0 00002C45 3C09 cmp al, TAB ;AN000; charaters can used for comment id. 0 00002C47 74F5 je Get_Cmt_Token ;AN000; character.) 0 00002C49 3C3D cmp al, '=' ;AN000; = is special in this case. 0 00002C4B 74F1 je Get_Cmt_Token ;AN000; 0 00002C4D 3C0D cmp al, CR ;AN000; 0 00002C4F 742A je Get_Cmt_End ;AN000; cannot accept the carridge return 0 00002C51 3C0A cmp al, LF ;AN000; 0 00002C53 7426 je Get_Cmt_End ;AN000; 0 00002C55 2EA2[0000] mov [cs:CMMT1], al ;AN000; store it 0 00002C59 2EC606[0000]01 mov byte [cs:CMMT], 1 ;AN000; 1 char. so far. 0 00002C5F E88100 call Get2 ;AN000; 0 00002C62 3C20 cmp al, ' ' ;AN000; 0 00002C64 7415 je Get_Cmt_End ;AN000; 0 00002C66 3C09 cmp al, TAB ;AN000; 0 00002C68 7411 je Get_Cmt_End ;AN000; 0 00002C6A 3C0D cmp al, CR ;AN000; 0 00002C6C 740D je Get_Cmt_End ;AN000; 0 00002C6E 3C0A cmp al, LF ;AN000; 0 00002C70 7410 je End_Commd_Line_Brdg ;AN000; 0 00002C72 2EA2[0000] mov [cs:CMMT2], al ;AN000; 0 00002C76 2EFE06[0000] inc byte [cs:CMMT] ;AN000; 647 Get_Cmt_End: ;AN000; 0 00002C7B E86500 call Get2 ;AN000; 0 00002C7E 3C0A cmp al, LF ;AN000; 0 00002C80 75F9 jne Get_Cmt_End ;AN000; skip it. 0 00002C82 E98EFE End_Commd_Line_Brdg: jmp End_Commd_Line ;AN000; else jmp to End_Commd_Line 652 653 Org_Put_Zero: ;AN000; Make the filename in front of 0 00002C85 26C60500 mov byte ptr [es:di], 0 ;AN000; the comment string to be an asciiz. 0 00002C89 47 inc di ;AN000; 0 00002C8A E986FE jmp End_Commd_Line ;AN000; (Maybe null if device=/*) 657 End_file_slash: ;AN000; AL = "/" option char. 0 00002C8D 26C60500 mov byte ptr [es:di],0 ;AN000; make a filename an asciiz 0 00002C91 47 inc di ;AN000; and 0 00002C92 AA stosb ;AN000; store "/" after that. 0 00002C93 EB1D jmp Org5 ;AN000; continue with the rest of the line 0 00002C95 90 nop ; identicalise 663 664 End_Copy_File: ;AN000; 0 00002C96 26C645FF00 mov byte ptr [es:di-1], 0 ;AN000; make it an asciiz and handle the next char. 0 00002C9B 3C0A cmp al, LF ;AN000; 667 End_Commd_Line_brdg equ End_Commd_Line_Brdg ; NASM port label 0 00002C9D 74E3 je End_Commd_Line_brdg ;AN000; 0 00002C9F EB11 jmp Org5 ;AN000; 0 00002CA1 90 nop ; identicalise 671 672 Org4: ;AN000; Org4 skips all delimiters after the command name except for '/' 0 00002CA2 E84600 call Skip_Comment ;AN000; 0 00002CA5 74DB jz End_Commd_Line_brdg ;AN000; 0 00002CA7 E83900 call Get2 ;AN000; 0 00002CAA E88100 call Org_Delim ;AN000; skip delimiters EXCEPT '/' (mrw 4/88) 0 00002CAD 74F3 jz Org4 ;AN000; 0 00002CAF EB09 jmp Org51 ;AN000; 0 00002CB1 90 nop ; identicalise 680 Org5: ;AN000; rest of the line 0 00002CB2 E83600 call Skip_Comment ;AN000; Comment? 0 00002CB5 74CB jz End_Commd_Line_brdg ;AN000; 0 00002CB7 E82900 call Get2 ;AN000; Not a comment. 684 Org51: ;AN000; 0 00002CBA AA stosb ;AN000; copy the character 0 00002CBB 3C22 cmp al, '"' ;AN000; a quote ? 0 00002CBD 740D je At_Quote ;AN000; 0 00002CBF 3C20 cmp al, ' ' ;AN000; 0 00002CC1 77EF ja Org5 ;AN000; 0 00002CC3 3C0A cmp al, LF ;AN000; line feed? 0 00002CC5 7402 je Org1_brdg ;AN000; handles the next command line. 0 00002CC7 EBE9 jmp Org5 ;AN000; handles next char in this line. 0 00002CC9 E934FE Org1_brdg: jmp Org1 ;AN000; 694 At_Quote: ;AN000; 0 00002CCC 2E803E[0000]00 cmp byte [cs:COM_Level], 0 ;AN000; 0 00002CD2 7408 je Up_Level ;AN000; 0 00002CD4 2EC606[0000]00 mov byte [cs:COM_Level], 0 ;AN000; reset it. 0 00002CDA EBD6 jmp Org5 ;AN000; 699 Up_Level: ;AN000; 700 COM_level equ COM_Level ; NASM port label 0 00002CDC 2EFE06[0000] inc byte [cs:COM_level] ;AN000; set it. 0 00002CE1 EBCF jmp Org5 ;AN000; 703 704 705 ;ORG5: CALL GET2 706 ; STOSB 707 ; CMP AL,10 708 ; JNZ ORG5 709 ; JMP ORG1 710 ; 711 ;ORG_EXT: 712 ; cmp al,' ' ;space? 713 ; je Org4_Cont ;then do not make an exception. Go back. 714 ; cmp al,9 ;Tab? 715 ; je Org4_Cont 716 ; mov byte ptr [es:di], 0 ;put 0 at the current DI to make it an ASCIIZ 717 ; inc DI ; 718 ; stosb ;and copy the delimeter char. 719 ; jmp short ORG5 ;and continue as usual. 720 721 722 GET2: 723 assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 00002CE3 E35C JCXZ NOGET 0 00002CE5 268A04 MOV AL,[ES:SI] 0 00002CE8 46 INC SI 0 00002CE9 49 DEC CX 0 00002CEA C3 return 729 730 ;GET: JCXZ NOGET 731 ; MOV AL,[ES:SI] 732 ; INC SI 733 ; DEC CX 734 ; CALL Org_DELIM 735 ; JZ GET 736 ; return 737 738 Skip_Comment: 739 ;J.K.Skip the commented string until LF, if current es:si-> a comment string. 740 ;J.K.In) ES:SI-> sting 741 ;J.K. CX -> length. 742 ;J.K.Out) Zero flag not set if not found a comment string. 743 ;J.K. Zero flag set if found a comment string and skipped it. AL will contain 744 ;J.K. the line feed charater at this moment when return. 745 ;J.K. AX register destroyed. 746 ;J.K. If found, SI, CX register adjusted accordingly. 747 748 NoGet equ NOGET ; NASM port label 0 00002CEB E354 jcxz NoGet ;AN000; Get out of the Organize routine. 0 00002CED 2E803E[0000]00 cmp byte [cs:COM_Level], 0 ;AN000; only check it if parameter level is 0. 0 00002CF3 7530 jne No_Commt ;AN000; (Not inside quotations) 752 0 00002CF5 2E803E[0000]01 cmp byte [cs:CMMT], 1 ;AN000; 0 00002CFB 7228 jb No_Commt ;AN000; 0 00002CFD 268A04 mov al, [es:si] ;AN000; 0 00002D00 2E3806[0000] cmp [cs:CMMT1], al ;AN000; 0 00002D05 751E jne No_Commt ;AN000; 0 00002D07 2E803E[0000]02 cmp byte [cs:CMMT], 2 ;AN000; 0 00002D0D 750B jne Skip_Cmmt ;AN000; 0 00002D0F 268A4401 mov al, [es:si+1] ;AN000; 0 00002D13 2E3806[0000] cmp [cs:CMMT2], al ;AN000; 0 00002D18 750B jne No_Commt ;AN000; 763 Skip_Cmmt: ;AN000; 0 00002D1A E325 jcxz NoGet ;AN000; get out of Organize routine. 0 00002D1C 268A04 mov al, [es:si] ;AN000; 0 00002D1F 46 inc si ;AN000; 0 00002D20 49 dec cx ;AN000; 0 00002D21 3C0A cmp al, LF ;AN000; line feed? 0 00002D23 75F5 jne Skip_Cmmt ;AN000; 770 No_Commt: ;AN000; 0 00002D25 C3 ret ;AN000; 772 773 774 DELIM: 0 00002D26 3C2F CMP AL,'/' ;J.K. 5/30/86. IBM will assume "/" as an delimeter. 0 00002D28 74C0 retz 0 00002D2A 3C00 cmp al, 0 ;J.K. 5/23/86 Special case for sysinit!!! 0 00002D2C 74BC retz 779 Org_Delim: ;AN000; Used by Organize routine except for getting 0 00002D2E 3C20 CMP AL,' ' ;the filename. 0 00002D30 74B8 retz 0 00002D32 3C09 CMP AL,9 0 00002D34 74B4 retz 0 00002D36 3C3D CMP AL,'=' 0 00002D38 74B0 retz 0 00002D3A 3C2C CMP AL,',' 0 00002D3C 74AC retz 0 00002D3E 3C3B CMP AL,';' 0 00002D40 C3 return 790 791 0 00002D41 59 NOGET: POP CX 0 00002D42 2E893E[0000] MOV [cs:COUNT],DI 0 00002D47 2E893E[0000] mov [cs:Org_Count], DI ;AN012; 0 00002D4C 31F6 XOR SI,SI 796 CHRPTR equ chrptr ; NASM port label 0 00002D4E 2E8936[0000] MOV [cs:CHRPTR],SI 0 00002D53 C3 return 799 800 ;Get3: jcxz NOGET ;J.K.do not consider '/',',' as a delim. 801 ; mov al, [es:si] 802 ; inc si 803 ; dec cx 804 ; call DELIM 805 ; jnz Get3_ret 806 ; cmp al,'/' 807 ; je Get3_ret 808 ; cmp al,',' 809 ; jne Get3 810 ;Get3_ret: 811 ; ret 812 813 814 815 ; 816 ; NEWLINE RETURNS WITH FIRST CHARACTER OF NEXT LINE 817 ; 0 00002D54 E8[0000] NEWLINE:invoke GETCHR ;SKIP NON-CONTROL CHARACTERS 0 00002D57 72FA retc 0 00002D59 3C0A CMP AL,LF ;LOOK FOR LINE FEED 0 00002D5B 75F7 JNZ NEWLINE 0 00002D5D E8[0000] invoke GETCHR 0 00002D60 C3 return 824 825 MAPCASE: 0 00002D61 51 PUSH CX 0 00002D62 56 PUSH SI 0 00002D63 1E PUSH DS 0 00002D64 06 PUSH ES 0 00002D65 1F POP DS 831 assume ds:nothing 0 00002D66 31F6 XOR SI,SI 833 CONVLOOP: 0 00002D68 AC LODSB 835 836 %IF KANJI 837 CALL TESTKANJ 838 JZ NORMCONV 839 INC SI ;Skip next char 840 DEC CX 841 JCXZ CONVDONE ;Just ignore 1/2 kanji error 842 ;Fall through, know AL is not in 'a'-'z' range 843 NORMCONV: 844 %ENDIF 845 0 00002D69 3C61 CMP AL,'a' 0 00002D6B 7209 JB NOCONV 0 00002D6D 3C7A CMP AL,'z' 0 00002D6F 7705 JA NOCONV 0 00002D71 2C20 SUB AL,20H 0 00002D73 8844FF MOV [SI-1],AL 852 NOCONV: 0 00002D76 E2F0 LOOP CONVLOOP 854 CONVDONE: 0 00002D78 1F POP DS 856 assume ds:nothing 0 00002D79 5E POP SI 0 00002D7A 59 POP CX 0 00002D7B C3 return 860 861 %IF KANJI 862 TESTKANJ: 863 CMP AL,81H 864 JB NOTLEAD 865 CMP AL,9FH 866 JBE ISLEAD 867 CMP AL,0E0H 868 JB NOTLEAD 869 CMP AL,0FCH 870 JBE ISLEAD 871 NOTLEAD: 872 PUSH AX 873 XOR AX,AX ;Set zero 874 POP AX 875 return 876 877 ISLEAD: 878 PUSH AX 879 XOR AX,AX ;Set zero 880 INC AX ;Reset zero 881 POP AX 882 return 883 %ENDIF 884 885 ASSUME DS:NOTHING 886 887 Yes_Break_Failed: ;device driver Init failed and aborted. 0 00002D7C F9 stc 0 00002D7D 58 pop ax 0 00002D7E C3 return 891 892 SET_BREAK: 893 ;J.K. 8/14/86 For DOS 3.3, this routine is modified to take care of the 894 ;Device driver's initialization error and abort. 895 ;If [break_addr+2] == [memhi] && [break_addr] = 0 then assume 896 ;that the device driver's initialization has an error and wanted to 897 ;abort the device driver. In this case, this routine will set carry 898 ;and return to the caller. 899 ;J.K. 6/26/87 If MultDeviceFlag <> 0, then do not perform the check. 900 ;This is to allow the multiple character device driver which uses 901 ;the same ending address segment with the offset value 0 for each 902 ;of the drives. 903 0 00002D7F 50 PUSH AX 0 00002D80 2EA1[0000] MOV AX, WORD PTR [cs:BREAK_ADDR] 0 00002D84 83C00F add ax, 15 ; round up 0 00002D87 D1D8 rcr ax, 1 0 00002D89 D1E8 shr ax, 1 0 00002D8B D1E8 shr ax, 1 0 00002D8D D1E8 shr ax, 1 ; = paragraphs 0 00002D8F 2E0306[0200] add ax, WORD PTR [cs:BREAK_ADDR+2] ;REMOVE THE INIT CODE 912 ; ax => behind keep address 0 00002D94 72E6 jc Yes_Break_Failed 0 00002D96 2E803E[0000]00 cmp byte [cs:MultDeviceFlag], 0 ;AN001; 0 00002D9C 7507 jne Set_Break_Continue ;AN001;Do not check it. 916 917 ; rol byte [cs:devicehighflag], 1 918 ; jnc .low1 919 .high1: 0 00002D9E 2E3B06[0000] cmp ax, [cs:devicehighdata] ; at start ? 921 ; jmp .common1 922 ; .low1: 923 ; MEMHI equ memhi ; NASM port label 924 ; cmp ax, [cs:MEMHI] 925 .common1: 926 Yes_Break_failed equ Yes_Break_Failed ; NASM port label 0 00002DA3 76D7 jbe Yes_Break_failed ; <= start, failed 928 929 Set_Break_Continue: 0 00002DA5 2E800E[0000]01 or byte [cs:SetDevMarkFlag], SETBRKDONE ;AN005; Signal the successful Set_break 931 932 ; rol byte [cs:devicehighflag], 1 933 ; jnc .low2 934 .high2: 0 00002DAB 2E3B06[0000] cmp ax, [cs:devicehighafter] 0 00002DB0 773E ja MEM_ERR 937 0 00002DB2 53 push bx 0 00002DB3 06 push es 0 00002DB4 2E8B1E[0000] mov bx, word [cs:devicehighdata] 0 00002DB9 4B dec bx ; => MCB 0 00002DBA 8EC3 mov es, bx 943 assume es:nothing 0 00002DBC 43 inc bx ; => memory block 0 00002DBD F7DB neg bx ; - memory block 0 00002DBF 01C3 add bx, ax ; end - memory block 0 00002DC1 26891E0300 mov word [es:mcbSize], bx 0 00002DC6 2E8B1E[0000] mov bx, word [cs:devicehighsd] 0 00002DCB 53 push bx 0 00002DCC 43 inc bx ; => SD memory block 0 00002DCD 8EC3 mov es, bx ; 21.4A input 952 assume es:nothing 0 00002DCF F7DB neg bx ; - SD memory block 0 00002DD1 01C3 add bx, ax ; end - SD memory block 0 00002DD3 B44A mov ah, 4Ah 0 00002DD5 CD21 int 21h ; shrink 0 00002DD7 8CC0 mov ax, es 0 00002DD9 01D8 add ax, bx 0 00002DDB 2EA3[0000] mov [cs:devicehighafter], ax 0 00002DDF 2EA3[0000] mov [cs:deviceafter], ax 0 00002DE3 07 pop es 962 assume es:MCB 0 00002DE4 26C70601000800 mov word [es:mcbOwner], 8 ; reset owner 0 00002DEB 07 pop es 965 assume ds:nothing, es:nothing 0 00002DEC 5B pop bx 0 00002DED 58 pop ax 0 00002DEE F8 clc 0 00002DEF C3 retn 970 971 %if 0 972 .low2: 973 MOV AX,WORD PTR [cs:BREAK_ADDR + 2] 974 MOV [cs:MEMHI],AX 975 MOV AX,WORD PTR [cs:BREAK_ADDR] 976 MEMLO equ memlo ; NASM port label 977 MOV [cs:MEMLO],AX 978 POP AX ; NOTE FALL THROUGH 979 or byte [cs:SetDevMarkFlag], FOR_DEVMARK 980 981 ; 982 ; Round the values in MEMLO and MEMHI to paragraph boundary. 983 ; Perform bounds check. 984 ; 985 ROUND: 986 PUSH AX 987 MOV AX,[cs:MEMLO] 988 989 invoke ParaRound ; para round up 990 991 ADD [cs:MEMHI],AX 992 jc MEM_ERR 993 and word [cs:MEMLO],0 994 mov ax,[cs:memhi] ; ax = new memhi 995 ALLOCLIM equ alloclim ; NASM port label 996 CMP AX,[cs:ALLOCLIM] ; if new memhi >= alloclim, error 997 JAE MEM_ERR 998 test byte [cs:SetDevMarkFlag], FOR_DEVMARK ;AN005; 999 jz Skip_Set_DEVMARKSIZE ;AN005; 1000 push es ;AN005; 1001 push si ;AN005; 1002 mov si, [cs:DevMark_Addr] ;AN005; 1003 mov es, si ;AN005; 1004 sub ax, si ;AN005; 1005 dec ax ;AN005; 1006 mov [es:DEVMARK_SIZE], ax ;AN005; Paragraph 1007 and byte [cs:SetDevMarkFlag], NOT_FOR_DEVMARK ;AN005; 1008 pop si ;AN005; 1009 pop es ;AN005; 1010 Skip_Set_DEVMARKSIZE: ;AN005; 1011 POP AX 1012 clc ;clear carry 1013 return 1014 %endif 1015 1016 MEM_ERR: 0 00002DF0 BA[0000] MOV DX,OFFSET BADMEM 0 00002DF3 0E PUSH CS 0 00002DF4 1F POP DS 1020 assume ds:SYSINITGROUP 0 00002DF5 E88502 CALL PRINT 1022 STALL equ Stall ; NASM port label 0 00002DF8 E9[0000] JMP STALL 1024 1025 ENTRY_POINT equ entry_point ; NASM port label 0 00002DFB 2E8E1E[0200] CALLDEV:MOV DS,WORD PTR [CS:ENTRY_POINT+2] 1027 assume ds:nothing 0 00002E00 2E031E[0000] ADD BX,WORD PTR [CS:ENTRY_POINT] ;Do a little relocation 0 00002E05 8B07 MOV AX,[BX] 0 00002E07 2EFF36[0000] PUSH WORD PTR [CS:ENTRY_POINT] 0 00002E0C 2EA3[0000] MOV WORD PTR [CS:ENTRY_POINT],AX 0 00002E10 BB[0000] MOV BX,OFFSET PACKET 0 00002E13 2EFF1E[0000] CALL far [cs:ENTRY_POINT] 0 00002E18 2E8F06[0000] POP WORD PTR [CS:ENTRY_POINT] 0 00002E1D C3 return 1036 1037 BADNUM: 0 00002E1E 2EC606[0000]00 MOV byte [cs:sepchr],0 0 00002E24 31C0 XOR AX,AX ; Set Zero flag, and AX = 0 0 00002E26 5B pop bx ; J.K. 0 00002E27 F9 stc ; AND carry set 0 00002E28 C3 return 1043 1044 ToDigit: 0 00002E29 2C30 SUB AL,'0' 0 00002E2B 7206 JB NotDig 0 00002E2D 3C09 CMP AL,9 0 00002E2F 7702 JA NotDig 0 00002E31 F8 CLC 0 00002E32 C3 return 0 00002E33 F9 NotDig: STC 0 00002E34 C3 return 1053 1054 ; GetNum parses a decimal number. 1055 ; Returns it in AX, sets zero flag if AX = 0 (MAY BE considered an 1056 ; error), if number is BAD carry is set, zero is set, AX=0. 1057 GETNUM: 1058 assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 00002E35 53 push bx ; J.K. 0 00002E36 31DB XOR BX,BX ; running count is zero 0 00002E38 E8EEFF B2: CALL ToDigit ; do we have a digit 1062 BadNum equ BADNUM ; NASM port label 0 00002E3B 72E1 JC BadNum ; no, bomb 0 00002E3D 93 XCHG AX,BX ; put total in AX 0 00002E3E 53 PUSH BX ; save digit 0 00002E3F BB0A00 MOV BX,10 ; base of arithmetic 0 00002E42 F7E3 MUL BX ; shift by one decimal di... 0 00002E44 5B POP BX ; get back digit 0 00002E45 00D8 ADD AL,BL ; get total 0 00002E47 80D400 ADC AH,0 ; make that 16 bits 0 00002E4A 72D2 JC BADNUM ; too big a number 0 00002E4C 93 XCHG AX,BX ; stash total 1073 0 00002E4D E8[0000] invoke GETCHR ;GET NEXT DIGIT 0 00002E50 722F JC B1 ; no more characters 0 00002E52 3C20 cmp al, ' ' ;J.K. 5/23/86 space? 1077 B15 equ b15 ; NASM port label 0 00002E54 7421 jz B15 ;J.K. 5/23/86 then end of digits 0 00002E56 3C2C cmp al, ',' ;J.K. 5/23/86 ',' is a seperator!!! 0 00002E58 741D jz B15 ;J.K. 5/23/86 then end of digits. 0 00002E5A 3C09 cmp al, TAB ;J.K. 5/23/86 TAB 0 00002E5C 7419 jz B15 ;J.K. 1083 SepChr equ sepchr ; NASM port label 0 00002E5E 2E3A06[0000] CMP AL,[cs:SepChr] ; allow 0 or special separators 0 00002E63 7412 JZ b15 0 00002E65 3C2F cmp al,SWTCHR ; See if another switch follows 0 00002E67 90 nop ; identicalise 0 00002E68 90 nop ; identicalise 0 00002E69 740C JZ b15 0 00002E6B 3C0A cmp al,LF ; Line-feed? 0 00002E6D 7408 jz b15 0 00002E6F 3C0D cmp al,CR ; Carriage return? 0 00002E71 7404 jz b15 0 00002E73 08C0 OR AL,AL ; end of line separator? 0 00002E75 75C1 JNZ B2 ; no, try as a valid char... 0 00002E77 2EFF06[0000] b15: INC word [cs:COUNT] ; one more character to s... 0 00002E7C 2EFF0E[0000] DEC word [cs:CHRPTR] ; back up over separator 0 00002E81 89D8 B1: MOV AX,BX ; get proper count 0 00002E83 09C0 OR AX,AX ; Clears carry, sets Zero accordingly 0 00002E85 5B pop bx 0 00002E86 C3 return 1102 1103 SKIP_DELIM proc near ;J.K. 1104 ;Skip the delimeters pointed by CHRPTR. AL will contain the first non delimeter 1105 ;character encountered and CHRPTR will point to the next character. 1106 ;This rouitne will assume the second "," found as a non delimiter character. So 1107 ;in case if the string is " , , ", this routine will stop at the second ",". At 1108 ;this time, Zero flag is set. 1109 ;If COUNT is exhausted, then carry will be set. 1110 Skip_delim_char: 0 00002E87 E8[0000] call getchr 0 00002E8A 7219 jc Skip_delim_exit 0 00002E8C 3C2C cmp al, ',' ;the first comma? 0 00002E8E 7407 je Skip_delim_next 0 00002E90 E893FE call delim ;check the charater in AL. 0 00002E93 74F2 jz Skip_delim_char 0 00002E95 EB0E jmp short Skip_delim_exit ;found a non delim char 1118 Skip_delim_next: 0 00002E97 E8[0000] call getchr 0 00002E9A 7209 jc Skip_delim_exit 0 00002E9C 3C2C cmp al, ',' ;the second comma? 0 00002E9E 7405 je Skip_delim_exit ;done 0 00002EA0 E883FE call delim 0 00002EA3 74F2 jz Skip_delim_next 1125 Skip_delim_exit: 0 00002EA5 C3 return 1127 SKIP_DELIM endp 1128 1129 ;J.K. 5/26/86 ***************************************************************** 1130 SetDOSCountryInfo proc near 1131 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1132 ;Input: ES:DI -> pointer to DOS_COUNTRY_CDPG_INFO 1133 ; DS:0 -> buffer. 1134 ; SI = 0 1135 ; AX = country id 1136 ; DX = code page id. (If 0, then use ccSysCodePage as a default.) 1137 ; BX = file handle 1138 ; This routine can handle maxium 72 COUNTRY_DATA entries. 1139 ;Output: DOS_country_cdpg_info set. 1140 ; Carry set if any file read failure or wrong information in the file. 1141 ; Carry set and CX = -1 if cannot find the matching COUNTRY_id, CODEPAGE 1142 ; _id in the file. 1143 0 00002EA6 57 push di 0 00002EA7 50 push ax 0 00002EA8 52 push dx 1147 0 00002EA9 31C9 xor cx,cx 0 00002EAB 31D2 xor dx,dx 0 00002EAD B80002 mov ax, 512 ;read 512 bytes 0 00002EB0 E83101 call ReadInControlBuffer ;Read the file header 0 00002EB3 724C jc SetDOSData_fail 0 00002EB5 06 push es 0 00002EB6 56 push si 0 00002EB7 0E push cs 0 00002EB8 07 pop es 1157 assume es:SYSINITGROUP 0 00002EB9 BF[3508] mov di, offset COUNTRY_FILE_SIGNATURE 0 00002EBC B90800 mov cx, 8 ;length of the signature 0 00002EBF F3A6 repz cmpsb 0 00002EC1 5E pop si 0 00002EC2 07 pop es 1163 assume es:nothing 0 00002EC3 753C jnz SetDOSData_fail ;signature mismatch 1165 0 00002EC5 83C612 add si, 18 ;SI -> county info type 0 00002EC8 803C01 cmp byte ptr [si], 1 ;Only accept type 1 (Currently only 1 header type) 0 00002ECB 7534 jne SetDOSData_fail ;cannot proceed. error return 0 00002ECD 46 inc si ;SI -> file offset 0 00002ECE 8B14 mov dx, word ptr [si] ;Get the INFO file offset. 0 00002ED0 8B4C02 mov cx, word ptr [si+2] 0 00002ED3 B80004 mov ax, 1024 ;read 1024 bytes. 0 00002ED6 E80B01 call ReadInControlBuffer ;Read INFO 0 00002ED9 7226 jc SetDOSData_fail 0 00002EDB 8B0C mov cx, word ptr [si] ;get the # of country, codepage combination entries 0 00002EDD 83F948 cmp cx, 72 ;cannot handle more than 72 entries. 0 00002EE0 771F ja SetDOSData_fail 0 00002EE2 46 inc si 0 00002EE3 46 inc si ;SI -> entry information packet 0 00002EE4 5A pop dx ;restore code page id 0 00002EE5 58 pop ax ;restore country id 0 00002EE6 5F pop di 1183 1184 SetDOSCntry_find: ;Search for desired country_id,codepage_id. 0 00002EE7 3B4402 cmp ax, word ptr [si+2] ;compare country_id 0 00002EEA 750A jne SetDOSCntry_next 0 00002EEC 83FA00 cmp dx, 0 ;No user specified code page ? 1188 SetDOSCntry_any_codepage equ SetDOSCntry_any_CodePage ; NASM port label 0 00002EEF 7415 je SetDOSCntry_any_codepage;then no need to match code page id. 0 00002EF1 3B5404 cmp dx, word ptr [si+4] ;compare code page id 0 00002EF4 7413 je SetDOSCntry_got_it 1192 SetDOSCntry_next: 0 00002EF6 0334 add si, word ptr [si] ;next entry 0 00002EF8 46 inc si 0 00002EF9 46 inc si ;take a word for size of entry itself 0 00002EFA E2EB loop SetDOSCntry_find 0 00002EFC B9FFFF mov cx, -1 ;signals that bad country id entered. 1198 SetDOSCntry_fail: 0 00002EFF F9 stc 0 00002F00 C3 ret 1201 1202 SetDOSData_fail: 0 00002F01 5E pop si 0 00002F02 59 pop cx 0 00002F03 5F pop di 0 00002F04 EBF9 jmp short SetDOSCntry_fail 1207 1208 SetDOSCntry_any_CodePage: ;use the code_page_id of the country_id found. 0 00002F06 8B5404 mov dx, word ptr [si+4] 1210 SetDOSCntry_got_it: ;found the matching entry 0 00002F09 2E8916[3D08] mov [cs:CntryCodePage_Id], dx ;save code page ID for this country. 0 00002F0E 8B540A mov dx, word ptr [si+10] ;get the file offset of country data 0 00002F11 8B4C0C mov cx, word ptr [si+12] 0 00002F14 B80002 mov ax, 512 ;read 512 bytes 0 00002F17 E8CA00 call ReadInControlBuffer 0 00002F1A 72E3 jc SetDOSCntry_fail 0 00002F1C 8B0C mov cx, word ptr [si] ;get the number of entries to handle. 0 00002F1E 46 inc si 0 00002F1F 46 inc si ;SI -> first entry 1220 1221 SetDOSCntry_data: 0 00002F20 57 push di ;ES:DI -> DOS_COUNTRY_CDPG_INFO 0 00002F21 51 push cx ;save # of entry left 0 00002F22 56 push si ;si -> current entry in Control buffer 1225 0 00002F23 8A4402 mov al, byte ptr [si+2] ;get data entry id 0 00002F26 E88D00 call GetCountryDestination ;get the address of destination in ES:DI 1228 assume es:nothing 0 00002F29 727A jc strict short SetDOSCntry_data_next ;No matching data entry id in DOS 1230 1231 0 00002F2B 8B5404 mov dx, word ptr [si+4] ;get offset of data 0 00002F2E 8B4C06 mov cx, word ptr [si+6] 0 00002F31 B80042 mov ax, 4200h 0 00002F34 F9 stc 0 00002F35 CD21 int 21h ;move pointer 0 00002F37 72C8 jc SetDOSData_fail 0 00002F39 BA0002 mov dx, 512 ;start of data buffer 1239 ; mov cx, word ptr [es:di] ;length of the corresponding data in DOS. 1240 ; add cx, 10 ;Signature + A word for the length itself 0 00002F3C B91400 mov cx, 20 ;read 20 bytes only. We only need to 0 00002F3F B43F mov ah, 3fh ;look at the length of the data in the file. 0 00002F41 F9 stc 0 00002F42 CD21 int 21h ;read the country.sys data 0 00002F44 72BB jc SetDOSData_fail ;read failure 0 00002F46 39C8 cmp ax, cx 0 00002F48 75B7 jne SetDOSData_fail 1248 0 00002F4A 8B5404 mov dx, word ptr [si+4] ;AN008;get offset of data again. 0 00002F4D 8B4C06 mov cx, word ptr [si+6] ;AN008; 0 00002F50 B80042 mov ax, 4200h ;AN008; 0 00002F53 F9 stc ;AN008; 0 00002F54 CD21 int 21h ;AN008;move pointer back again 0 00002F56 72A9 jc SetDOSData_fail ;AN008; 1255 0 00002F58 56 push si ;AN008; 0 00002F59 BE0802 mov si, (512+8) ;AN008;get length of the data from the file 0 00002F5C 8B0C mov cx, word ptr [si] ;AN008; 0 00002F5E 5E pop si ;AN008; 0 00002F5F BA0002 mov dx, 512 ;AN008;start of data buffer 0 00002F62 83C10A add cx, 10 ;AN008;Signature + A word for the length itself 0 00002F65 B43F mov ah, 3fh ;AN008;Read the data from the file. 0 00002F67 F9 stc ;AN008; 0 00002F68 CD21 int 21h ;AN008; 0 00002F6A 7295 jc SetDOSData_fail ;AN008; 0 00002F6C 39C8 cmp ax, cx ;AN008; 0 00002F6E 7591 jne SetDOSData_fail ;AN008; 1268 0 00002F70 8A4402 mov al, byte ptr [si+2] ;save Data id for future use. 0 00002F73 BE0802 mov si, (512+8) ;SI-> data buffer + id tag field 0 00002F76 8B0C mov cx, word ptr [si] ;get the length of the file 0 00002F78 41 inc cx ;Take care of a word for lenght of tab 0 00002F79 41 inc cx ;itself. 0 00002F7A 81F9F805 cmp cx, (2048 - 512 - 8) ;Fit into the buffer? 0 00002F7E 7781 ja SetDOSData_fail 0 00002F80 3C01 cmp al, SetCountryInfo ;is the data for SetCountryInfo table? 0 00002F82 7512 jne SetDOSCntry_Mov ;no, don't worry 0 00002F84 26FF7518 push word ptr [es:di+ccMono_Ptr-ccCountryInfoLen] ;AN009;Cannot destroy ccMono_ptr address. Save them. 0 00002F88 26FF751A push word ptr [es:di+ccMono_Ptr-ccCountryInfoLen+2] ;AN009;At this time DI -> ccCountryInfoLen 0 00002F8C 57 push di ;save DI 1281 0 00002F8D 50 push ax 0 00002F8E 2EA1[3D08] mov ax,[cs:CntryCodePage_Id] ;Do not use the Code Page info in Country_Info 0 00002F92 894404 mov [si+4], ax ;Use the saved one for this !!!! 0 00002F95 58 pop ax 1286 1287 SetDOSCntry_Mov: 0 00002F96 F3A4 rep movsb ;copy the table into DOS 0 00002F98 3C01 cmp al, SetCountryInfo ;was the ccMono_ptr saved? 0 00002F9A 7509 jne SetDOSCntry_data_next 0 00002F9C 5F pop di ;restore DI 0 00002F9D 268F451A pop word ptr [es:di+ccMono_Ptr-ccCountryInfoLen+2] ;AN009;restore 0 00002FA1 268F4518 pop word ptr [es:di+ccMono_Ptr-ccCountryInfoLen] ;AN009; 1294 1295 SetDOSCntry_data_next: 0 00002FA5 5E pop si ;restore control buffer pointer 0 00002FA6 59 pop cx ;restore # of entries left 0 00002FA7 5F pop di ;restore pointer to DSO_COUNTRY_CDPG 0 00002FA8 0334 add si, word ptr [si] ;try to get the next entry 0 00002FAA 46 inc si 0 00002FAB 46 inc si ;take a word of entry length itself 1302 ; loop SetDOSCntry_data 0 00002FAC 49 dec cx ;AN008; 0 00002FAD 83F900 cmp cx,0 ;AN008; 0 00002FB0 7403 je SetDOSCntry_OK ;AN008; 0 00002FB2 E96BFF jmp SetDOSCntry_data ;AN008; 1307 SetDOSCntry_OK: ;AN008; 0 00002FB5 C3 ret 1309 SetDOSCountryInfo endp 1310 ; 1311 1312 GetCountryDestination proc near 1313 assume ds:nothing, es:nothing, ss:SYSINITGROUP 1314 ;Get the destination address in the DOS country info table. 1315 ;Input: AL - Data ID 1316 ; ES:DI -> DOS_COUNTRY_CDPG_INFO 1317 ;On return: 1318 ; ES:DI -> Destination address of the matching data id 1319 ; carry set if no matching data id found in DOS. 1320 0 00002FB6 51 push cx 0 00002FB7 83C74A add di, ccNumber_of_entries ;skip the reserved area, syscodepage etc. 0 00002FBA 268B0D mov cx, word ptr [es:di] ;get the number of entries 0 00002FBD 47 inc di 0 00002FBE 47 inc di ;SI -> the first start entry id 1326 GetCntryDest: 0 00002FBF 263805 cmp byte ptr [es:di], al 0 00002FC2 7413 je GetCntryDest_OK 0 00002FC4 26803D01 cmp byte ptr [es:di], SetCountryInfo ;was it SetCountryInfo entry? 0 00002FC8 7405 je GetCntryDest_1 0 00002FCA 83C705 add di, 5 ;next data id 0 00002FCD EB03 jmp short GetCntryDest_loop 1333 GetCntryDest_1: 0 00002FCF 83C729 add di, NEW_COUNTRY_SIZE + 3 ;next data id 1335 GetCntryDest_loop: 0 00002FD2 E2EB loop GetCntryDest 0 00002FD4 F9 stc 1338 GetCntryDest_exit equ GetCntryDest_Exit ; NASM port label 0 00002FD5 EB0B jmp short GetCntryDest_exit 1340 GetCntryDest_OK: 0 00002FD7 3C01 cmp al, SetCountryInfo ;select country info? 0 00002FD9 7503 jne GetCntryDest_OK1 0 00002FDB 47 inc di ;now DI -> ccCountryInfoLen 0 00002FDC EB04 jmp short GetCntryDest_exit 1345 GetCntryDest_OK1: 0 00002FDE 26C47D01 les di, [es:di+1] ;get the destination in ES:DI 1347 assume es:nothing 1348 GetCntryDest_Exit: 0 00002FE2 59 pop cx 0 00002FE3 C3 ret 1351 GetCountryDestination endp 1352 1353 ; 1354 ReadInControlBuffer proc near 1355 ;Move file pointer to CX:DX 1356 ;Read AX bytes into the control buffer. (Should be less than 2 Kb) 1357 ;SI will be set to 0 hence DS:SI points to the control buffer. 1358 ;Entry: CX,DX offset from the start of the file where the read/write pointer 1359 ; be moved. 1360 ; AX - # of bytes to read 1361 ; BX - file handle 1362 ; DS - buffer seg. 1363 ;Return: The control data information is read into DS:0 - DS:0200. 1364 ; CX,DX value destroyed. 1365 ; Carry set if error in Reading file. 1366 ; 0 00002FE4 50 push ax ;# of bytes to read 0 00002FE5 B80042 mov ax, 4200h 0 00002FE8 F9 stc 0 00002FE9 CD21 int 21h ;move pointer 0 00002FEB 59 pop cx ;# of bytes to read 0 00002FEC 7209 jc RICB_exit 0 00002FEE 31D2 xor dx,dx ;ds:dx -> control buffer 0 00002FF0 31F6 xor si,si 0 00002FF2 B43F mov ah,3fh ;read into the buffer 0 00002FF4 F9 stc 0 00002FF5 CD21 int 21h ;should be less than 1024 bytes. 1378 RICB_exit: 0 00002FF7 C3 ret 1380 ReadInControlBuffer endp 1381 1382 ; 1383 SET_COUNTRY_PATH proc near 1384 ;In: DS - SYSINITSEG, ES - CONFBOT, SI -> start of the asciiz path string 1385 ; DOSINFO_EXT, CNTRY_DRV, CNTRY_ROOT, CNTRY_PATH 1386 ; Assumes current directory is the ROOT directory. 1387 ;Out: DS:DI -> full path (CNTRY_DRV). 1388 ; Set the CNTRY_DRV string from the COUNTRY=,,path command. 1389 ; DS, ES, SI value saved. 1390 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 1391 0 00002FF8 56 push si 0 00002FF9 1E push ds ;switch ds, es 0 00002FFA 06 push es 0 00002FFB 1F pop ds 0 00002FFC 07 pop es ;now DS -> CONFBOT, ES -> SYSINITSEG 1397 assume ds:nothing, es:SYSINITGROUP, ss:SYSINITGROUP 1398 1399 chk_drive_letter equ CHK_DRIVE_LETTER ; NASM port label 0 00002FFD E83100 call chk_drive_letter ;current [DS:SI] is a drive letter? 0 00003000 7206 jc SCP_Default_drv ;no, use current default drive. 0 00003002 8A04 mov al, byte ptr [SI] 0 00003004 46 inc si 0 00003005 46 inc si ;SI -> next char after ":" 0 00003006 EB06 jmp short SCP_SetDrv 1406 SCP_Default_drv: 0 00003008 B419 mov ah, 19h 0 0000300A CD21 int 21h 0 0000300C 0441 add al, "A" ;convert it to a character. 1410 SCP_SetDrv: 0 0000300E 2EA2[F207] mov [cs:CNTRY_DRV], al ;set the drive letter. 0 00003012 BF[F507] mov di, offset CNTRY_PATH 0 00003015 8A04 mov al, byte ptr [SI] 0 00003017 3C5C cmp al, "\" 0 00003019 7409 je SCP_Root_Dir 0 0000301B 2E3A062F00 cmp al, [cs:SWTCHR] ;let's accept "/" as an directory delim 0 00003020 7402 je SCP_Root_Dir 0 00003022 EB01 jmp short SCP_Path 1419 SCP_Root_Dir: 0 00003024 4F dec di ;DI -> CNTRY_ROOT 1421 SCP_Path: 0 00003025 E81F00 call MOVE_ASCIIZ ;copy it 0 00003028 BF[F207] mov di, offset CNTRY_DRV 1424 SCPath_Exit: 0 0000302B 1E push ds ;switch ds, es 0 0000302C 06 push es 0 0000302D 1F pop ds 0 0000302E 07 pop es ;DS, ES value restored 1429 assume ds:SYSINITGROUP, es:nothing, ss:SYSINITGROUP 0 0000302F 5E pop si 0 00003030 C3 RET 1432 SET_COUNTRY_PATH endp 1433 1434 ; 1435 CHK_DRIVE_LETTER proc near 1436 ;Check if [DS:SI] is a drive letter followed by ":". 1437 ;Assume that every alpha charater is already converted to UPPER CASE. 1438 ;Carry set if not. 1439 assume ds:nothing 0 00003031 50 push ax 0 00003032 803C41 cmp byte ptr [si], "A" 0 00003035 720D jb CDLetter_NO 0 00003037 803C5A cmp byte ptr [si], "Z" 0 0000303A 7708 ja CDLetter_NO 0 0000303C 807C013A cmp byte ptr [si+1], ":" 0 00003040 7502 jne CDLetter_NO 0 00003042 EB01 jmp short CDLetter_exit 1448 CDLetter_NO: 0 00003044 F9 stc 1450 CDLetter_exit: 0 00003045 58 pop ax 0 00003046 C3 ret 1453 CHK_DRIVE_LETTER endp 1454 1455 ; 1456 MOVE_ASCIIZ proc near 1457 assume ds:nothing, es:nothing 1458 ;In: DS:SI -> source ES:DI -> target 1459 ;Out: copy the string until 0. 1460 ;Assumes there exists a 0. 1461 MASCIIZ_loop: 0 00003047 A4 movsb 0 00003048 807CFF00 cmp byte ptr [SI-1], 0 ;Was it 0? 0 0000304C 75F9 jne MASCIIZ_loop 0 0000304E C3 ret 1466 MOVE_ASCIIZ endp 1467 1468 ; 1469 ; DS:DX POINTS TO STRING TO OUTPUT (ASCIZ) 1470 ; 1471 ; PRINTS 1472 ; 1473 ; 1474 ; 1475 BADFIL: 0 0000304F 0E PUSH CS 0 00003050 07 POP ES 1478 assume es:SYSINITGROUP 0 00003051 89D6 MOV SI,DX 1480 BADLOAD: 0 00003053 BA[0000] MOV DX,OFFSET BADLD_PRE ;WANT TO PRINT CONFIG ERROR 1482 ; MOV BX,OFFSET BADLD_POST 0 00003056 BB[0000] mov bx, offset CRLFM ;AN006; 1484 PRNERR: 1485 assume es:nothing 0 00003059 0E PUSH CS 0 0000305A 1F POP DS 1488 assume ds:SYSINITGROUP 0 0000305B E81F00 call Print 0 0000305E 268A14 PRN1: MOV DL,[ES:SI] 0 00003061 08D2 OR DL,DL 0 00003063 7407 JZ PRN2 1493 STD_CON_OUTPUT equ Std_Con_Output ; NASM port equate 0 00003065 B402 MOV AH,STD_CON_OUTPUT 0 00003067 CD21 INT 21H 0 00003069 46 INC SI 0 0000306A EBF2 JMP PRN1 0 0000306C 89DA PRN2: MOV DX,BX 0 0000306E E80C00 call Print 0 00003071 2E803E[0000]01 cmp byte [cs:DoNotShowNum], 1 ;AN000; suppress line number when handling COMMAND.COM 1501 Prnexit equ PRNEXIT ; NASM port label 0 00003077 7403 je Prnexit 0 00003079 E8[0000] call Error_Line 1504 PRNEXIT: 0 0000307C C3 return 1506 1507 STD_CON_STRING_OUTPUT equ Std_Con_String_Output ; NASM port equate 1508 PRINT: 1509 assume ds:SYSINITGROUP 0 0000307D B409 MOV AH,STD_CON_STRING_OUTPUT 0 0000307F CD21 INT 21H 0 00003081 C3 return 1513 1514 1515 OPEN equ Open ; NASM port equate 1516 CLOSE equ Close ; NASM port equate 1517 %IF NOEXEC 1518 ; 1519 ; LOAD NON EXE FILE CALLED [DS:DX] AT MEMORY LOCATION ES:BX 1520 ; 1521 LDFIL: 1522 PUSH AX 1523 PUSH BX 1524 PUSH CX 1525 PUSH DX 1526 PUSH SI 1527 PUSH DS 1528 PUSH BX 1529 XOR AX,AX ;OPEN THE FILE 1530 MOV AH,OPEN 1531 STC ;IN CASE OF INT 24 1532 INT 21H 1533 POP DX ;Clean stack in case jump 1534 JC LDRET 1535 PUSH DX 1536 MOV BX,AX ;Handle in BX 1537 XOR CX,CX 1538 XOR DX,DX 1539 LSEEK equ LSeek ; NASM port equate 1540 MOV AX,(LSEEK << 8) | 2 1541 STC ;IN CASE OF INT 24 1542 INT 21H ; Get file size in DX:AX 1543 JC LDCLSP 1544 OR DX,DX 1545 JNZ LDERRP ; File >64K 1546 POP DX 1547 PUSH DX 1548 MOV CX,ES ; CX:DX is xaddr 1549 ADD DX,AX ; Add file size to Xaddr 1550 JNC DOSIZE 1551 ADD CX,1000H ; ripple carry 1552 DOSIZE: 1553 mov ax,dx 1554 call ParaRound 1555 mov dx,ax 1556 1557 ADD CX,DX 1558 CMP CX,[cs:ALLOCLIM] 1559 JB OKLD 1560 JMP MEM_ERR 1561 1562 OKLD: 1563 XOR CX,CX 1564 XOR DX,DX 1565 MOV AX,LSEEK << 8 ;Reset pointer to beginning of file 1566 STC ;IN CASE OF INT 24 1567 INT 21H 1568 JC LDCLSP 1569 POP DX 1570 PUSH ES ;READ THE FILE IN 1571 POP DS ;Trans addr is DS:DX 1572 MOV CX,0FF00H ; .COM files arn't any bigger than 1573 ; 64k-100H 1574 READ equ Read ; NASM port equate 1575 MOV AH,READ 1576 STC ;IN CASE OF INT 24 1577 INT 21H 1578 JC LDCLS 1579 MOV SI,DX ;CHECK FOR EXE FILE 1580 CMP WORD PTR [SI],"MZ" ; NASM port swapped text literals 1581 CLC ; Assume OK 1582 JNZ LDCLS ; Only know how to do .COM files 1583 STC 1584 JMP SHORT LDCLS 1585 1586 LDERRP: 1587 STC 1588 LDCLSP: 1589 POP DX ;Clean stack 1590 LDCLS: 1591 PUSHF 1592 MOV AH,CLOSE ;CLOSE THE FILE 1593 STC 1594 INT 21H 1595 POPF 1596 1597 LDRET: POP DS 1598 POP SI 1599 POP DX 1600 POP CX 1601 POP BX 1602 POP AX 1603 return 1604 %ENDIF 1605 1606 ; 1607 ; OPEN DEVICE POINTED TO BY DX, AL HAS ACCESS CODE 1608 ; IF UNABLE TO OPEN DO A DEVICE OPEN NULL DEVICE INSTEAD 1609 ; 1610 OPEN_DEV: 1611 assume ds:SYSINITGROUP 0 00003082 50 push ax ; preserve open mode 0 00003083 E81C00 CALL OPEN_FILE 0 00003086 7308 JNC OPEN_DEV3 1615 OPEN_DEV1: 0 00003088 58 pop ax ; restore al = open mode 0 00003089 BA[D607] MOV DX,OFFSET NULDEV_name 0 0000308C E81300 CALL OPEN_FILE 0 0000308F C3 return 1620 1621 OPEN_DEV3: 0 00003090 93 xchg bx, ax ; Handle from open to BX 0 00003091 B80044 mov ax, IOCTL << 8 ; GET DEVICE INFO 0 00003094 CD21 INT 21H 0 00003096 84D2 test dl, dl 0 00003098 7806 js @F 0 0000309A B43E MOV AH,CLOSE 0 0000309C CD21 INT 21H 0 0000309E EBE8 JMP OPEN_DEV1 1630 1631 @@: 0 000030A0 58 pop ax ; discard open mode 0 000030A1 C3 retn 1634 1635 OPEN_FILE: 0 000030A2 B43D MOV AH,OPEN 0 000030A4 F9 STC 0 000030A5 CD21 INT 21H 0 000030A7 C3 return 1640 1641 %if 0 1642 ;J.K. TEST INT24. Return back to DOS with the fake user response of "FAIL" 1643 INT24: 1644 mov al, 3 ;AN000; Fail the system call 1645 iret ;AN000; Return back to DOS. 1646 1647 1648 ;INT24: ADD SP,6 ;RESTORE MACHINE STATE 1649 ; POP AX 1650 ; POP BX 1651 ; POP CX 1652 ; POP DX 1653 ; POP SI 1654 ; POP DI 1655 ; POP BP 1656 ; POP DS 1657 ; POP ES 1658 ; PUSH AX 1659 ; MOV AH,GET_DEFAULT_DRIVE ;INITIALIZE DOS 1660 ; INT 21H 1661 ; POP AX 1662 ; IRET ;BACK TO USER 1663 %endif 1664 1665 %IF ALTVECT 1666 BOOTMES DB 13,10,"MS-DOS version " 1667 DB MAJOR_VERSION + "0" 1668 DB "." 1669 DB (MINOR_VERSION / 10) + "0" 1670 DB (MINOR_VERSION MOD 10) + "0" 1671 DB 13,10 1672 DB "Copyright 1981,88 Microsoft Corp.",13,10,"$" 1673 %ENDIF 1674 1675 %include "copyrigh.mac" ;P1821; Copyright statement 0 000030A8 4D5320444F53205665 DB "MS DOS Version 4.00 (C)Copyright 1988 Microsoft Corp" 0 000030B1 7273696F6E20342E30 0 000030BA 3020284329436F7079 0 000030C3 726967687420313938 0 000030CC 38204D6963726F736F 0 000030D5 667420436F7270 0 000030DC 4C6963656E73656420 DB "Licensed Material - Property of Microsoft " 0 000030E5 4D6174657269616C20 0 000030EE 2D2050726F70657274 0 000030F7 79206F66204D696372 0 00003100 6F736F66742020 1676 0 00003107 4E554C00 NULDEV_name DB "NUL",0 0 0000310B 434F4E00 CONDEV DB "CON",0 0 0000310F 41555800 AUXDEV DB "AUX",0 0 00003113 50524E00 PRNDEV DB "PRN",0 1681 1682 global OLDCONFIG_name 0 00003117 5C434F4E4649472E53 OLDCONFIG_name: DB "\CONFIG.SYS",0 0 00003120 595300 1684 0 00003123 413A CNTRY_DRV DB "A:" 0 00003125 5C CNTRY_ROOT DB "\" 0 00003126 434F554E5452592E53 CNTRY_PATH DB "COUNTRY.SYS",0 0 0000312F 595300 0 00003132 000000000000000000 DB 52 DUP (0) 0 0000313B 000000000000000000 0 00003144 000000000000000000 0 0000314D 000000000000000000 0 00003156 000000000000000000 0 0000315F 00000000000000 1689 0 00003166 FF434F554E545259 COUNTRY_FILE_SIGNATURE db 0FFh,'COUNTRY' 1691 0 0000316E ???? CntryCodePage_Id DW ? 1693 0 00003170 5C434F4D4D414E442E COMMND DB "\COMMAND.COM",0 0 00003179 434F4D00 0 0000317D 000000000000000000 DB 51 dup (0) 0 00003186 000000000000000000 0 0000318F 000000000000000000 0 00003198 000000000000000000 0 000031A1 000000000000000000 0 000031AA 000000000000 1696 0 000031B0 000000000000000000 PathString db 64 dup (0) ;AN014; 0 000031B9 000000000000000000 0 000031C2 000000000000000000 0 000031CB 000000000000000000 0 000031D4 000000000000000000 0 000031DD 000000000000000000 0 000031E6 000000000000000000 0 000031EF 00 0 000031F0 53484152452E455845 LShare db "SHARE.EXE",0,"/NC",0Dh,0Ah ;AN014;AN015;To be used by Load/exec. 0 000031F9 002F4E430D0A 1699 ;/NC parm will disable file sharing check. 1700 1701 global linein 0 000031FF FF linein: db 255 0 00003200 00 db 0 0 00003201 0D db 13 0 00003202 00 times 254 db 0 0 00003300 26 db 26h 1707 1708 COMTAB LABEL BYTE 1709 ;;;; DB 8,"AVAILDEV",'A' ; NO LONGER SUPPORTED 0 00003301 074255464645525342 DB 7,"BUFFERS", 'B' 0 0000330A 05425245414B43 DB 5,"BREAK", 'C' 0 00003311 0A4445564943454849 DB 10,"DEVICEHIGH",'d' 0 0000331A 474864 0 0000331D 0644455649434544 DB 6,"DEVICE", 'D' 0 00003325 0546494C455346 DB 5,"FILES", 'F' 0 0000332C 044643425358 DB 4,"FCBS", 'X' 0 00003332 094C41535444524956 DB 9,"LASTDRIVE",'L' 0 0000333B 454C 0 0000333D 0A4D554C5449545241 db 10,"MULTITRACK", 'M' ;AN002; 0 00003346 434B4D 0 00003349 08445249565041524D DB 8,"DRIVPARM", 'P' ; RS for DOS 3.2 0 00003352 50 1719 %IF STACKSW 0 00003353 06535441434B534B DB 6,"STACKS", 'K' ; BAS for DOS 3.2 1721 %ENDIF 0 0000335B 07434F554E54525951 DB 7,"COUNTRY", 'Q' 0 00003364 095348454C4C484947 DB 9,"SHELLHIGH",'s' 0 0000336D 4873 0 0000336F 055348454C4C53 DB 5,"SHELL", 'S' 0 00003376 0B494E5354414C4C48 db 11,"INSTALLHIGH",'i' 0 0000337F 49474869 0 00003383 07494E5354414C4C49 db 7,"INSTALL", 'I' ;AN000; 0 0000338C 0F494E5354414C4C4C db 15,"INSTALLLASTHIGH",'i' | 80h 0 00003395 41535448494748E9 0 0000339D 0B494E5354414C4C4C db 11,"INSTALLLAST", 'I' | 80h 0 000033A6 415354C9 0 000033AA 10494E5354414C4C46 counted "INSTALLFIRSTHIGH" 0 000033B3 4952535448494748 0 000033BB 34 db '4' 0 000033BC 0C494E5354414C4C46 counted "INSTALLFIRST" 0 000033C5 49525354 0 000033C9 33 db '3' 0 000033CA 0E494E5354414C4C4D counted "INSTALLMIDHIGH" 0 000033D3 494448494748 0 000033D9 36 db '6' 0 000033DA 0A494E5354414C4C4D counted "INSTALLMID" 0 000033E3 4944 0 000033E5 35 db '5' 0 000033E6 034946534A db 3,"IFS", 'J' ;AN000; 0 000033EB 044350535757 db 4,"CPSW", 'W' ;AN000; 1739 ;;;; DB 8,"SWITCHAR",'W' ; NO LONGER SUPPORTED 0 000033F1 07434F4D4D454E5459 db 7,"COMMENT", 'Y' ;AN000; 0 000033FA 0352454D30 db 3,"REM", '0' ;AN004; 0 000033FF 085357495443484553 db 8,"SWITCHES", '1' ;AN013; 0 00003408 31 0 00003409 06434F4D50415432 db 6,"COMPAT", '2' 0 00003411 0A414D49534E554D42 counted "AMISNUMBER" 0 0000341A 4552 0 0000341C 37 db '7' 0 0000341D 00 DB 0 1747 1748 public DeviceParameters 1749 DeviceParameters: ; NASM structure instance 1750 A_DEVICEPARAMETERS_size equ A_DEVICEPARAMETERS_struc_size ; NASM port equate 1751 istruc A_DEVICEPARAMETERS 1752 at DP_SPECIALFUNCTIONS 0 0000341E 00 db 0 1754 at DP_DEVICETYPE 0 0000341F 02 db DEV_3INCH720KB 1756 at DP_DEVICEATTRIBUTES 0 00003420 0000 dw 0 1758 at DP_CYLINDERS 0 00003422 5000 dw 80 0 00003424 00 iend 1761 0 00003542 0200 hlim dw 2 0 00003544 0900 slim dw 9 1764 1765 public sysinit_drive 0 00003546 ?? sysinit_drive db ? 1767 1768 public switches 0 00003547 0000 Switches dw 0 1770 1771 ; 1772 ; The following are the recommended BPBs for the media that we know of so 1773 ; far. 1774 1775 ; 48 tpi diskettes 1776 1777 sysinit_BPB48T: 0 00003549 0002 DW 512 0 0000354B 02 DB 2 0 0000354C 0100 DW 1 0 0000354E 02 DB 2 0 0000354F 7000 DW 112 0 00003551 D002 DW 2*9*40 0 00003553 FD DB 0FDH 0 00003554 0200 DW 2 0 00003556 0900 DW 9 0 00003558 0200 DW 2 0 0000355A 00000000 DD 0 0 0000355E 00000000 DD 0 1790 1791 ; 96tpi diskettes 1792 1793 sysinit_BPB96T: 0 00003562 0002 DW 512 0 00003564 01 DB 1 0 00003565 0100 DW 1 0 00003567 02 DB 2 0 00003568 E000 DW 224 0 0000356A 6009 DW 2*15*80 0 0000356C F9 DB 0F9H 0 0000356D 0700 DW 7 0 0000356F 0F00 DW 15 0 00003571 0200 DW 2 0 00003573 00000000 DD 0 0 00003577 00000000 DD 0 1806 1807 ; 3 1/2 inch diskette BPB 1808 1809 sysinit_BPB35: 0 0000357B 0002 DW 512 0 0000357D 02 DB 2 0 0000357E 0100 DW 1 0 00003580 02 DB 2 0 00003581 7000 DW 70h 0 00003583 A005 DW 2*9*80 0 00003585 F9 DB 0F9H 0 00003586 0300 DW 3 0 00003588 0900 DW 9 0 0000358A 0200 DW 2 0 0000358C 00000000 DD 0 0 00003590 00000000 DD 0 1822 1823 sysinit_BPB35H: 0 00003594 0002 DW 0200H 0 00003596 01 DB 01H 0 00003597 0100 DW 0001H 0 00003599 02 DB 02H 0 0000359A E000 DW 0E0h 0 0000359C 400B DW 0B40H 0 0000359E F0 DB 0F0H 0 0000359F 0900 DW 0009H 0 000035A1 1200 DW 0012H 0 000035A3 0200 DW 0002H 0 000035A5 00000000 DD 0 0 000035A9 00000000 DD 0 1836 1837 sysinit_BPBTable: 0 000035AD [180C] dw sysinit_BPB48T ; 48tpi drives 0 000035AF [310C] dw sysinit_BPB96T ; 96tpi drives 0 000035B1 [4A0C] dw sysinit_BPB35 ; 3.5" drives 1841 ; The following are not supported, so default to 3.5" media layout 0 000035B3 [4A0C] dw sysinit_BPB35 ; Not used - 8" drives 0 000035B5 [4A0C] dw sysinit_BPB35 ; Not Used - 8" drives 0 000035B7 [4A0C] dw sysinit_BPB35 ; Not Used - hard files 0 000035B9 [4A0C] dw sysinit_BPB35 ; Not Used - tape drives 0 000035BB [630C] dw sysinit_BPB35H ; 3-1/2" 1.44MB drive 1847 0 000035BD 08464853544449434E switchlist db 8,"FHSTDICN" ; Preserve the positions of N and C. 1849 1850 ; The following depend on the positions of the various letters in SwitchList 1851 1852 switchnum equ 11111000B ; which switches require number 1853 1854 flagec35 equ 00000100B ; electrically compatible 3.5 inch disk drive 1855 flagdrive equ 00001000B 1856 flagcyln equ 00010000B 1857 flagseclim equ 00100000B 1858 flagheads equ 01000000B 1859 flagff equ 10000000B 1860 1861 SWTCHR EQU "/" ; switch follows this character 1862 1863 ; (no prior section) ; SYSINITSEG ENDS 1864 END === Trace listing source: sysimes.lst 1 ;SCCSID = @(#)sysimes.asm 1.2 85/07/25 2 %warning out: ...SYSIMES 2 ****************** warning: out: ...SYSIMES [-w+user] 3 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 ;AN001 D246, P976 Show "Bad command or parameters - ..." msg 9/22/87 J.K. 11 ;AN002 P1820 New Message SKL file 10/20/87 J.K. 12 ;AN003 D486 Share installation for large media 02/24/88 J.K. 13 ;============================================================================== 14 === Switch to base=002450h -> "BIOCODE" 15 section BIOCODE PUBLIC align=2 class=DOSCODE === Switch to base=00C400h -> "SYSINITSEG" 16 section SYSINITSEG PUBLIC align=1 class=INIT 17 18 itest equ 0 19 %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 0 000035C6 ???? lpSize dw ? 0 000035C8 ???? lpCount dw ? 0 000035CA ???????? lpBuffer dd ? 0 000035CE ???????????????? lpSector dd ?,? 34 <2> LBAPACKETSTRUC ends 34 ****************** <2> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 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 0 000035C6 ???????? LINK DD ? ; LINK TO NEXT BDS 0 000035CA ?? DRIVENUM DB ? ; INT 13 DRIVE NUMBER 0 000035CB ?? DRIVELET DB ? ; DOS DRIVE NUMBER 0 000035CC ???? BYTEPERSEC DW ? ; NUMBER OF BYTES/SEC 0 000035CE ?? SECPERCLUS DB ? ; SEC PER ALLOCATION UNIT 0 000035CF ???? RESSEC DW ? ; NUMBER OF RESERVED SECTORS 0 000035D1 ?? CFAT DB ? ; NUMBER OF FATS 0 000035D2 ???? CDIR DW ? ; NUMBER OF DIRECTORY ENTRIES 0 000035D4 ???? DRVLIM DW ? ; NUMBER OF SECTORS ON MEDIUM 0 000035D6 ?? MEDIAD DB ? ; MEDIA DESCRIPTOR BYTE 0 000035D7 ???? CSECFAT DW ? ; NUMBER OF SECTORS/FAT 0 000035D9 ???? SECLIM DW ? ; SECTORS PER TRACK 0 000035DB ???? HDLIM DW ? ; MAX NUMBER OF HEADS 0 000035DD ???? HIDSEC_L DW ? ; NUMBER OF HIDDEN SECTORS 0 000035DF ???? HIDSEC_H dw ? ;0 ;J.K.87 0 000035E1 ???? DRVLIM_L dw ? ;0 ;J.K.87 0 000035E3 ???? DRVLIM_H dw ? ;0 ;J.K.87 0 000035E5 ?? FATSIZ DB ? ; FLAGS... 0 000035E6 ???? OPCNT DW ? ; OPEN REF. COUNT 0 000035E8 ?? FORMFACTOR DB ? ; FORM FACTOR INDEX 0 000035E9 ???? FLAGS DW ? ; VARIOUS FLAGS 0 000035EB ???? CCYLN DW ? ; MAX NUMBER OF CYLINDERS 0 000035ED ???? RBYTEPERSEC DW ? ; RECOMMENDED BPB 0 000035EF ?? RSECPERCLUS DB ? 0 000035F0 ???? RRESSEC DW ? 0 000035F2 ?? RCFAT DB ? 0 000035F3 ???? RCDIR DW ? 0 000035F5 ???? RDRVLIM DW ? 0 000035F7 ?? RMEDIAD DB ? 0 000035F8 ???? RCSECFAT DW ? 0 000035FA ???? RSECLIM DW ? 0 000035FC ???? RHDLIM DW ? 0 000035FE ???? RHIDSEC_L DW ? 0 00003600 ???? RHIDSEC_H DW ? ;0 ;J.K.87 0 00003602 ???? RDRVLIM_L dw ? ;0 ;J.K.87 0 00003604 ???? RDRVLIM_H dw ? ;0 ;J.K.87 0 00003606 ???????????? RESERVE DB 6 DUP (?) ; RESERVED FOR FUTURE 0 0000360C ?? TRACK DB ? ; LAST TRACK ACCESSED ON DRIVE 0 0000360D ???? TIM_LO DW ? ; TIME OF LAST ACCESS. KEEP 0 0000360F ???? TIM_HI DW ? ; THESE CONTIGUOUS. 86 0000004B <2> VOLID DB 12 DUP (?) ; VOLUME ID OF MEDIUM 0 0000361D ???????? VOL_SERIAL dd ? ;0 ;J.K.87 Current volume serial number from Boot record 88 0000005B <2> FILESYS_Id db 9 dup (?) ;(0) ;J.K.87 Current file system id from Boot record 89 <2> BDS_TYPE ENDS 89 ****************** <2> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 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 0 000035C6 ???? mlink DW ? ;-1 ;Link to next structure 0 000035C8 ???? DW ? 0 000035CA ?? mdriveNum DB ? ;80 ;Int 13 Drive Number 0 000035CB ?? mdriveLet DB ? ;3 ;Logical Drive Number 0 000035CC ???? mBytePerSec DW ? ;512 0 000035CE ?? mSecPerClus DB ? ;1 ;Sectors/allocation unit 0 000035CF ???? mRESSEC DW ? ;1 ;Reserved sectors for DOS 0 000035D1 ?? mcFAT DB ? ;2 ;No. of allocation tables 0 000035D2 ???? mcDIR DW ? ;16 ;Number of directory entries 0 000035D4 ???? mDRVLIM DW ? ;0 ;Number of sectors (at 512 bytes each) 0 000035D6 ?? mMediad DB ? ;11111000B ;Media descriptor 0 000035D7 ???? mcSecFat DW ? ;1 ;Number of FAT sectors 0 000035D9 ???? mSECLIM DW ? ;0 ;Sector limit 0 000035DB ???? mHDLIM DW ? ;0 ;Head limit 0 000035DD ???? mHIDSEC_L DW ? ;0 ;Hidden sector count 0 000035DF ???? mHidsec_H dw ? ;0 ;J.K.87 0 000035E1 ???? mDrvlim_L dw ? ;0 ;J.K.87 0 000035E3 ???? mDrvlim_H dw ? ;0 ;J.K.87 0 000035E5 ?? mFatSiz DB ? ;0 ;TRUE => bigfat 0 000035E6 ???? mOPCNT DW ? ;0 ;Open Ref. Count 0 000035E8 ?? mFormFactor DB ? ;3 ;Form Factor 0 000035E9 ???? mFLAGS DW ? ;0020H ;Various Flags 0 000035EB ???? mcCyln dw ? ;40 ;max number of cylinders 122 00000027 <2> mRecBPB db 31 dup (?) ;(0) ;Recommended BPB for drive 0 0000360C ?? mTrack db ? ;-1 0 0000360D ???? IsMini dw ? ;1 ;Overlapping TIM_LOH 0 0000360F ???? Hidden_Trks dw ? ;0 ;Overlapping TIM_HIH 126 0000004B <2> mVOLID DB 11 dup (?) ;"NO NAME " ;Volume ID for this disk 0 0000361C ?? DB ? ;0 ;ASCIZII for "NO NAME " 0 0000361D ???????? mVol_Serial dd ? ;0 ;Current volume serial number from Boot record 0 00003621 ???????????????? mFileSys_Id db 8 dup (?) ;"FAT12 " ;Current file system id from Boot record 0 00003629 ?? db ? ;0 131 <2> 132 <2> BDSM_type ENDS 132 ****************** <2> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 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 0 000035C6 ???? SECSIZE DW ? 0 000035C8 ?? SECALL DB ? 0 000035C9 ???? RESNUM DW ? 0 000035CB ?? FATNUM DB ? 0 000035CC ???? DIRNUM DW ? 0 000035CE ???? SECNUM DW ? 0 000035D0 ?? FATID DB ? 0 000035D1 ???? FATSIZE DW ? 0 000035D3 ???? SLIM DW ? 0 000035D5 ???? HLIM DW ? 0 000035D7 ???? HIDDEN_L DW ? 0 000035D9 ???? HIDDEN_H dw ? ;0 ;J.K. 0 000035DB ???? SECNUM_L dw ? ;0 ;J.K. 0 000035DD ???? SECNUM_H dw ? ;0 ;J.K. 31 <1> BPB_TYPE ENDS 31 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 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 20 %include "msmacro.mac" 1 <1> === Switch to base=002450h -> "BIOCODE" 2 <1> section BIOCODE 3 <1> ; 4 <1> ; This file contains three macros used in debugging the system. If the 5 <1> ; variable "itest" (in msbio.asm) is nonzero code is included in the 6 <1> ; modules to print debugging messages. The level of debugging is controlled 7 <1> ; by the value of the variable fTestBits in msbio.asm. Specific bits in 8 <1> ; the variable determine which messages to print. The equ's below tell 9 <1> ; which bits control which funcitons. For example the fifth bit 10 <1> ; cooresponds to disk activity (see fTestDisk equ below). 11 <1> ; 12 <1> ; The macros in the file are: 13 <1> ; 14 <1> ; message Prints an ascii string on the screen. 15 <1> ; Example usage: 16 <1> ; 17 <1> ; message fTestDisk, <"Start Disk Write", CR, LF> 18 <1> ; message fTestINIT, <"Begin BDS initialization"> 19 <1> ; 20 <1> ; 21 <1> ; MNUM Print the value in a register or memory location on 22 <1> ; the screen. Value is displayed in hex. 23 <1> ; Usage: 24 <1> ; MNUM bitpattern, valueLocation 25 <1> ; 26 <1> ; valueLocation is typically a regester: 27 <1> ; 28 <1> ; mnum fTestCom, AX 29 <1> ; mnum fTestDisk, DX 30 <1> ; 31 <1> ; ValueLocation can also be a memory location: 32 <1> ; 33 <1> ; mnum fTestINIT, Final_Dos_Location 34 <1> ; 35 <1> ; If no valueLocation is given the macro defaults to 36 <1> ; the BX register. 37 <1> ; 38 <1> ; ZWAIT Stops the program until any key is pressed. 39 <1> ; 40 <1> ; 41 <1> ; The three macros preserve all register values. If "test" is zero 42 <1> ; defined during assembly then the marco produce no code. 43 <1> ; 44 <1> 45 <1> %IF itest ;3.30 46 <1> EXTRN MSGOUT:NEAR,MSGNUM:NEAR ;3.30 47 <1> EXTRN NUMBUF:BYTE,DIGITS:BYTE,FTESTBITS:WORD ;3.30 48 <1> EXTRN DUMPBYTES:NEAR,OUTCHAR:NEAR,HEX_TO_ASCII:NEAR ;3.30 49 <1> 50 <1> 51 <1> fTestALL equ 1111111111111111b ; watch everything 52 <1> fTestHARD equ 0000000000000001b ; watch hard disk initialization 53 <1> fTest96 equ 0000000000000010b ; watch 96 tpi activity 54 <1> FTEST13 EQU 0000000000000100B ; WATCH INT 13 ACTIVITY ;3.30 55 <1> FTESTCOM EQU 0000000000001000B ; WATCH PACKET ACTIVITY ;3.30 56 <1> FTESTINIT EQU 0000000000010000B ; WATCH INITIALIZATION MESSAGES ;3.30 57 <1> FTESTDISK EQU 0000000000100000B ; WATCH DISK DEVICE DRIVER CALLS ;3.30 58 <1> FTESTCON EQU 0000000001000000B ; WATCH SYSTEM WAIT ACTIVITY IN CO;3.30 NSOLE 59 <1> FtestClock equ 0000000010000000b ; wathc clock device 5/2/86 ;3.30 60 <1> 61 <1> ; NASM original macros 62 <1> 63 <1> ; 64 <1> ; message macro -- see above for description 65 <1> ; 66 <1> 67 <1> %unimacro stripangles 2+.nolist 68 <1> 69 <1> %imacro stripangles 2+.nolist 70 <1> %defstr %%param %2 71 <1> %rep 16 72 <1> %substr %%opening %%param 1 73 <1> %ifidn %%opening, '<' 74 <1> %substr %%param %%param 2,-1 75 <1> %endif 76 <1> %endrep 77 <1> %rep 16 78 <1> %strlen %%length %%param 79 <1> %substr %%closing %%param %%length 80 <1> %ifidn %%closing, '>' 81 <1> %substr %%param %%param 1,-2 82 <1> %endif 83 <1> %endrep 84 <1> %deftok %%token %%param 85 <1> %1 %%token 86 <1> %endmacro 87 <1> 88 <1> %imacro MESSAGE 2+ 89 <1> jmp short %%b 90 <1> %%a: 91 <1> stripangles db, %2 92 <1> db 0 93 <1> %%b: push SI 94 <1> push AX 95 <1> mov AX, %1 96 <1> mov SI, OFFSET %%a 97 <1> call MSGOUT 98 <1> pop AX 99 <1> pop SI 100 <1> %endmacro 101 <1> 102 <1> 103 <1> ; 104 <1> ; mnum macro -- see above for description 105 <1> ; 106 <1> 107 <1> %imacro MNum 1-2 108 <1> push AX 109 <1> %ifempty %2 110 <1> mov AX,%1 111 <1> call MSGNUM 112 <1> %else 113 <1> push BX 114 <1> mov BX,%2 115 <1> mov AX,%1 116 <1> call MSGNUM 117 <1> pop BX 118 <1> %endif 119 <1> pop AX 120 <1> %endmacro 121 <1> 122 <1> 123 <1> ; 124 <1> ; zwait macro -- see above for description 125 <1> ; 126 <1> 127 <1> %imacro ZWAIT 0 128 <1> Message fTestALL,<"? "> 129 <1> CALL ZWAITrtn 130 <1> %endmacro 131 <1> 132 <1> ZWAITrtn: 133 <1> pushf ; save the flags 134 <1> push AX ; preserve AX 135 <1> xor AH, AH ; set command to get character ;3.30* 136 <1> int 16h ; call rom keyboard routine ;3.30* 137 <1> pop AX ; restore AX 138 <1> popf ; restore the flags 139 <1> ret 140 <1> 141 <1> ;Dump_byte dumps the memory contents in hex. ;3.30 142 <1> ;DUMPOFFLABEL should be a label or a variable defined in DUMPSEG. ;3.30 143 <1> %imacro DUMP_BYTE 3 144 <1> push es ;3.30 145 <1> PUSH DS ;3.30 146 <1> PUSH SI ;3.30 147 <1> PUSH CX ;3.30 148 <1> ;3.30 149 <1> MOV CX, %1 ;3.30 150 <1> MOV DS, CX ;3.30 151 <1> MOV SI, OFFSET %2 ;3.30 152 <1> MOV CX, %3 ;3.30 153 <1> call dumpbytes ;3.30 154 <1> ;3.30 155 <1> POP CX ;3.30 156 <1> POP SI ;3.30 157 <1> POP DS ;3.30 158 <1> pop es ;3.30 159 <1> %endmacro ;3.30 160 <1> ;3.30 161 <1> ;Dump_Byte_Reg dumps the memory contents in hex. - 4/9/86 ;3.30 162 <1> ;DUMPOFFREG should be a register contains the offset value in DUMPSEG. ;3.30 163 <1> %imacro DUMP_BYTE_REG 3 164 <1> DUMP_BYTE_REG MACRO DUMPSEG, DUMPOFFREG, BYTELENGTH ;3.30 165 <1> push es ;3.30 166 <1> PUSH DS ;3.30 167 <1> PUSH SI ;3.30 168 <1> PUSH CX ;3.30 169 <1> ;3.30 170 <1> MOV CX, %1 ;3.30 171 <1> MOV DS, CX ;3.30 172 <1> MOV SI, %2 ;3.30 173 <1> MOV CX, %3 ;3.30 174 <1> call dumpbytes ;3.30 175 <1> ;3.30 176 <1> POP CX ;3.30 177 <1> POP SI ;3.30 178 <1> POP DS ;3.30 179 <1> pop es ;3.30 180 <1> %endmacro ;3.30 181 <1> 182 <1> %else 183 <1> ; if test is not defined then make macro into null statements 184 <1> %imacro Message 0-1+.nolist 185 <1> %endmacro 186 <1> 187 <1> %imacro MNUM 0-1+.nolist 188 <1> %endmacro 189 <1> 190 <1> %imacro ZWAIT 0-1+.nolist 191 <1> %endmacro 192 <1> 193 <1> %imacro DUMP_BYTE 0-1+.nolist 194 <1> %endmacro 195 <1> 196 <1> %imacro DUMP_BYTE_REG 0-1+.nolist 197 <1> %endmacro 198 <1> 199 <1> %endif 200 <1> 201 <1> %unimacro PATHSTART 2 202 <1> %unimacro PATHEND 2 203 <1> 204 <1> %imacro PATHSTART 2 205 <1> %IF PATHGEN ;3.30 206 <1> PUBLIC %2%1S,%2%1E ;3.30 207 <1> %2%1S LABEL BYTE ;3.30 208 <1> %ENDIF ;3.30 209 <1> %endmacro ;3.30 210 <1> ;3.30 211 <1> %imacro PATHEND 2 212 <1> %IF PATHGEN ;3.30 213 <1> %2%1E LABEL BYTE ;3.30 214 <1> %ENDIF ;3.30 215 <1> %endmacro ;3.30 21 === Switch to base=00C400h -> "SYSINITSEG" 22 section SYSINITSEG 23 24 PUBLIC BADOPM,CRLFM,BADSIZ_PRE,BADLD_PRE,BADCOM,BADCOUNTRY 25 ; PUBLIC BADLD_POST,BADSIZ_POST,BADMEM,BADBLOCK,BADSTACK 26 PUBLIC BADMEM,BADBLOCK,BADSTACK 27 PUBLIC INSUFMEMORY,BADCOUNTRYCOM 28 BadOrder equ BADORDER ; NASM port label 29 Errorcmd equ ERRORCMD ; NASM port label 30 public BadOrder,Errorcmd ;AN000; 31 public BadParm ;AN001; 32 public SHAREWARNMSG ;AN003; 33 public config_overflow 34 public unknown_command 35 public invalid_number 36 37 38 ;include sysimes.inc 39 ;=== Push trace listing source: msbio.cl3 40 %include "msbio.cl3" ;AN002; ; NASM included file 1 <1> ; msbio.cl3 2 <1> 3 <1> 4 <1> ;_______________________ 5 <1> 0 000035C6 0D0A556E7265636F67 BADOPM DB 13,10,"Unrecognized command in CONFIG.SYS" 0 000035CF 6E697A656420636F6D 0 000035D8 6D616E6420696E2043 0 000035E1 4F4E4649472E535953 7 <1> 8 <1> ;_______________________ 9 <1> 0 000035EA 0D0A24 CRLFM DB 13,10,"$" 11 <1> 12 <1> ;_______________________ 13 <1> 0 000035ED 0D0A42616420636F6D BadParm DB 13,10,"Bad command or parameters - $" 0 000035F6 6D616E64206F722070 0 000035FF 6172616D6574657273 0 00003608 202D2024 15 <1> 16 <1> ;_______________________ 17 <1> 0 0000360C 0D0A536563746F7220 BADSIZ_PRE DB 13,10,"Sector size too large in file $" 0 00003615 73697A6520746F6F20 0 0000361E 6C6172676520696E20 0 00003627 66696C652024 19 <1> 20 <1> ;_______________________ 21 <1> 0 0000362D 0D0A426164206F7220 BADLD_PRE DB 13,10,"Bad or missing $" 0 00003636 6D697373696E672024 23 <1> 24 <1> ;_______________________ 25 <1> 0 0000363F 436F6D6D616E642049 BADCOM DB "Command Interpreter",0 0 00003648 6E7465727072657465 0 00003651 7200 27 <1> 28 <1> ;_______________________ 29 <1> 0 00003653 0D0A496E76616C6964 BADCOUNTRY DB 13,10,"Invalid country code or code page",13,10,"$" 0 0000365C 20636F756E74727920 0 00003665 636F6465206F722063 0 0000366E 6F646520706167650D 0 00003677 0A24 31 <1> 32 <1> ;_______________________ 33 <1> 0 00003679 0D0A4572726F722069 BADCOUNTRYCOM DB 13,10,"Error in COUNTRY command",13,10,"$" 0 00003682 6E20434F554E545259 0 0000368B 20636F6D6D616E640D 0 00003694 0A24 35 <1> 36 <1> ;_______________________ 37 <1> 0 00003696 0D0A496E7375666669 INSUFMEMORY DB 13,10, "Insufficient memory for COUNTRY.SYS file",13,10,"$" 0 0000369F 6369656E74206D656D 0 000036A8 6F727920666F722043 0 000036B1 4F554E5452592E5359 0 000036BA 532066696C650D0A24 39 <1> 40 <1> ;_______________________ 41 <1> 0 000036C3 0D0A436F6E66696775 BADMEM DB 13,10,"Configuration too large for memory",13,10,"$" 0 000036CC 726174696F6E20746F 0 000036D5 6F206C617267652066 0 000036DE 6F72206D656D6F7279 0 000036E7 0D0A24 43 <1> 44 <1> ;_______________________ 45 <1> 0 000036EA 0D0A546F6F206D616E BADBLOCK DB 13,10,"Too many block devices",13,10,"$" 0 000036F3 7920626C6F636B2064 0 000036FC 6576696365730D0A24 47 <1> 48 <1> ;_______________________ 49 <1> 0 00003705 0D0A496E76616C6964 BADSTACK DB 13,10,"Invalid STACK parameters",13,10,"$" 0 0000370E 20535441434B207061 0 00003717 72616D65746572730D 0 00003720 0A24 51 <1> 52 <1> ;_______________________ 53 <1> 0 00003722 0D0A496E636F727265 BADORDER DB 13,10,"Incorrect order in CONFIG.SYS line ","$" 0 0000372B 6374206F7264657220 0 00003734 696E20434F4E464947 0 0000373D 2E535953206C696E65 0 00003746 2024 55 <1> 56 <1> ;_______________________ 57 <1> 0 00003748 4572726F7220696E20 ERRORCMD DB "Error in CONFIG.SYS line ","$" 0 00003751 434F4E4649472E5359 0 0000375A 53206C696E652024 59 <1> 60 <1> ;_______________________ 61 <1> 0 00003762 5741524E494E472120 SHAREWARNMSG DB "WARNING! SHARE should be loaded for large media",13,10,"$" 0 0000376B 53484152452073686F 0 00003774 756C64206265206C6F 0 0000377D 6164656420666F7220 0 00003786 6C61726765206D6564 0 0000378F 69610D0A24 41 ;=== Pop trace listing source 42 0 00003794 0D0A436F6E66696775 config_overflow: db 13,10,"Configuration is too long! Truncating.",13,10,36 0 0000379D 726174696F6E206973 0 000037A6 20746F6F206C6F6E67 0 000037AF 21205472756E636174 0 000037B8 696E672E0D0A24 0 000037BF 556E6B6E6F776E2063 unknown_command: db "Unknown command in kernel command line! Ignoring:",13,10,' "',0 0 000037C8 6F6D6D616E6420696E 0 000037D1 206B65726E656C2063 0 000037DA 6F6D6D616E64206C69 0 000037E3 6E65212049676E6F72 0 000037EC 696E673A0D0A202200 0 000037F5 496E76616C6964206E invalid_number: db "Invalid number in kernel command line! In command:",' "',0 0 000037FE 756D62657220696E20 0 00003807 6B65726E656C20636F 0 00003810 6D6D616E64206C696E 0 00003819 652120496E20636F6D 0 00003822 6D616E643A202200 46 47 PATHEND 001,SYSMES 212 <1> %IF PATHGEN 213 <1> %2%1E LABEL BYTE 214 <1> %ENDIF 48 49 END === Trace listing source: ../INC/nibdos.lst 1 ; SCCSID = @(#)nibdos.asm 1.1 85/04/10 2 ;TITLE NIBDOS 3 ;NAME MSDOS_3 4 5 ;=== Push trace listing source: mssw.nas 6 %include "mssw.nas" ; NASM included file 1 <1> ; SCCSID = @(#)ibmsw.asm 1.1 85/04/10 2 <1> 3 <1> %include "version.mac" 1 <2> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <2> TRUE EQU 0FFFFh 3 <2> TRUEBYTE EQU 0FFh 4 <2> FALSE EQU 0 5 <2> 6 <2> ; 7 <2> ; Use the following switches to control cmacros.inc 8 <2> ; 9 <2> ?PLM equ 0 10 <2> ?WIN equ 0 11 <2> 12 <2> memS EQU 1 ; Small model 13 <2> ; 14 <2> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <2> ; version of the operating system 16 <2> ; 17 <2> ; The below chart will indicate how to set the switches to build the various 18 <2> ; versions 19 <2> ; 20 <2> ; IBMVER IBMCOPYRIGHT 21 <2> ; -------------------------------------------------------- 22 <2> ; IBM Version | TRUE TRUE 23 <2> ; -------------------------------------------------------- 24 <2> ; MS Version | FALSE FALSE 25 <2> ; -------------------------------------------------------- 26 <2> ; Clone Version | TRUE FALSE 27 <2> ; 28 <2> IBMVER EQU TRUE 29 <2> IBMCOPYRIGHT EQU FALSE 30 <2> 31 <2> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <2> 33 <2> %ifndef MSVER 34 <2> MSVER EQU ~ IBMVER 35 <2> %endif 36 <2> IBM EQU IBMVER 37 <2> ; 38 <2> ; 39 <2> %IF IBMVER 40 <2> %IF IBMCOPYRIGHT 41 <2> %warning out: ... IBM version build switch on ... 42 <2> %ELSE 43 <2> %warning out: ... CLONE version build switch on ... 43 ****************** <2> warning: out: ... CLONE version build switch on ... [-w+user] 44 <2> %ENDIF 45 <2> %ELSE 46 <2> %IFN IBMCOPYRIGHT 47 <2> %warning out: ... MS version build switch on ... 48 <2> %ELSE 49 <2> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <2> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <2> %ENDIF 52 <2> %ENDIF 53 <2> ; 54 <2> ; 55 <2> ;*************************************************************************** 56 <2> ;* The following switches are for DBCS or SBCS support * 57 <2> ;* * 58 <2> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <2> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <2> ;* * 61 <2> ;*************************************************************************** 62 <2> ; 63 <2> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <2> 65 <2> ; 66 <2> ; Switch INTERNAT for DBCS support 67 <2> ; 68 <2> INTERNAT EQU FALSE 69 <2> ; 70 <2> %IF INTERNAT 71 <2> %ifndef KANJI 72 <2> KANJI EQU TRUE 73 <2> %endif 74 <2> IBMJAPAN EQU TRUE 75 <2> %ELSE 76 <2> %ifndef KANJI 77 <2> KANJI EQU FALSE 78 <2> %endif 79 <2> IBMJAPAN EQU FALSE 80 <2> %ENDIF 81 <2> 82 <2> %ifndef altvect ; avoid jerking off vector.inc 83 <2> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <2> %endif 85 <2> 86 <2> ; 87 <2> ; Country code switches 88 <2> ; The default contry code is assumed as USA. 89 <2> ; 90 <2> %IF INTERNAT 91 <2> KOREA EQU TRUE 92 <2> JAPAN EQU FALSE 93 <2> %ELSE 94 <2> KOREA EQU FALSE 95 <2> JAPAN EQU FALSE 96 <2> %ENDIF 97 <2> ; 98 <2> %IF INTERNAT 99 <2> %warning out: Internat(ECS) version build switch on 100 <2> %ENDIF 4 <1> 5 <1> ibmver equ IBMVER ; NASM port equate 6 <1> IBM EQU ibmver 7 <1> WANG EQU FALSE 8 <1> 9 <1> ; Set this switch to cause DOS to move itself to the end of memory 10 <1> HIGHMEM EQU FALSE 11 <1> 12 <1> ; Turn on switch below to allow testing disk code with DEBUG. It sets 13 <1> ; up a different stack for disk I/O (functions > 11) than that used for 14 <1> ; character I/O which effectively makes the DOS re-entrant. 15 <1> 16 <1> %IF IBM 17 <1> ESCCH EQU 0 ; character to begin escape seq. 18 <1> CANCEL EQU 27 ;Cancel with escape 19 <1> TOGLPRN EQU TRUE ;One key toggles printer echo 20 <1> ZEROEXT EQU TRUE 21 <1> %ELSE 22 <1> ESCCH EQU 1BH 23 <1> CANCEL EQU "X"-"@" ;Cancel with Ctrl-X 24 <1> TOGLPRN EQU FALSE ;Separate keys for printer echo on 25 <1> ;and off 26 <1> ZEROEXT EQU TRUE 27 <1> %ENDIF 28 <1> 7 ;=== Pop trace listing source 8 ;=== Push trace listing source: msconst.nas 9 %include "msconst.nas" ; NASM included file 1 <1> ; SCCSID = @(#)msconst.asm 1.4 85/09/12 2 <1> ; Revision history 3 <1> ; AN000 version 4.00 Jan. 1988 4 <1> ; AN007 fake version check for IBMCACHE.COM 5 <1> ;=== Push trace listing source: mshead.nas 6 <1> %include "mshead.nas" ; NASM included file 1 <2> ; SCCSID = @(#)mshead.asm 1.1 85/04/10 2 <2> ; TITLE MSHEAD.ASM -- MS-DOS DEFINITIONS 3 <2> ;PAGE 4 <2> ; MS-DOS High-performance operating system for the 8086 version 1.28 5 <2> ; by Microsoft MSDOS development group: 6 <2> ; TP (Ret.) 7 <2> ; AR 8 <2> ; NP (Parenting) 9 <2> ; MZ 10 <2> ; CP (BIOS) (ret.) 11 <2> 12 <2> ; ****************** Revision History ************************* 13 <2> ; >> EVERY change must noted below!! << 14 <2> ; 15 <2> ; 0.34 12/29/80 General release, updating all past customers 16 <2> ; 0.42 02/25/81 32-byte directory entries added 17 <2> ; 0.56 03/23/81 Variable record and sector sizes 18 <2> ; 0.60 03/27/81 Ctrl-C exit changes, including register save on user stack 19 <2> ; 0.74 04/15/81 Recognize I/O devices with file names 20 <2> ; 0.75 04/17/81 Improve and correct buffer handling 21 <2> ; 0.76 04/23/81 Correct directory size when not 2^N entries 22 <2> ; 0.80 04/27/81 Add console input without echo, Functions 7 & 8 23 <2> ; 1.00 04/28/81 Renumber for general release 24 <2> ; 1.01 05/12/81 Fix bug in `STORE' 25 <2> ; 1.10 07/21/81 Fatal error trapping, NUL device, hidden files, date & time, 26 <2> ; RENAME fix, general cleanup 27 <2> ; 1.11 09/03/81 Don't set CURRENT BLOCK to 0 on open; fix SET FILE SIZE 28 <2> ; 1.12 10/09/81 Zero high half of CURRENT BLOCK after all (CP/M programs don't) 29 <2> ; 1.13 10/29/81 Fix classic "no write-through" error in buffer handling 30 <2> ; 1.20 12/31/81 Add time to FCB; separate FAT from DPT; Kill SMALLDIR; Add 31 <2> ; FLUSH and MAPDEV calls; allow disk mapping in DSKCHG; Lots 32 <2> ; of smaller improvements 33 <2> ; 1.21 01/06/82 HIGHMEM switch to run DOS in high memory 34 <2> ; 1.22 01/12/82 Add VERIFY system call to enable/disable verify after write 35 <2> ; 1.23 02/11/82 Add defaulting to parser; use variable escape character Don't 36 <2> ; zero extent field in IBM version (back to 1.01!) 37 <2> ; 1.24 03/01/82 Restore fcn. 27 to 1.0 level; add fcn. 28 38 <2> ; 1.25 03/03/82 Put marker (00) at end of directory to speed searches 39 <2> ; 1.26 03/03/82 Directory buffers searched as a circular queue, current buffer 40 <2> ; is searched first when possible to minimize I/O 41 <2> ; 03/03/82 STORE routine optimized to tack on partial sector tail as 42 <2> ; full sector write when file is growing 43 <2> ; 03/09/82 Multiple I/O buffers 44 <2> ; 03/29/82 Two bugs: Delete all case resets search to start at beginning 45 <2> ; of directory (infinite loop possible otherwise), DSKRESET 46 <2> ; must invalidate all buffers (disk and directory). 47 <2> ; 1.27 03/31/82 Installable device drivers 48 <2> ; Function call 47 - Get pointer to device table list 49 <2> ; Function call 48 - Assign CON AUX LIST 50 <2> ; 04/01/82 Spooler interrupt (INT 28) added. 51 <2> ; 1.28 04/15/82 DOS retructured to use ASSUMEs and PROC labels around system 52 <2> ; call entries. Most CS relative references changed to SS 53 <2> ; relative with an eye toward putting a portion of the DOS in 54 <2> ; ROM. DOS source also broken into header, data and code pieces 55 <2> ; 04/15/82 GETDMA and GETVECT calls added as 24 and 32. These calls 56 <2> ; return the current values. 57 <2> ; 04/15/82 INDOS flag implemented for interrupt processing along with 58 <2> ; call to return flag location (call 29) 59 <2> ; 04/15/82 Volume ID attribute added 60 <2> ; 04/17/82 Changed ABORT return to user to a long ret from a long jump to 61 <2> ; avoid a CS relative reference. 62 <2> ; 04/17/82 Put call to STATCHK in dispatcher to catch ^C more often 63 <2> ; 04/20/82 Added INT int_upooler into loop ^S wait 64 <2> ; 04/22/82 Dynamic disk I/O buffer allocation and call to manage them 65 <2> ; call 49. 66 <2> ; 04/23/82 Added GETDSKPTDL as call 50, similar to GETFATPT(DL), returns 67 <2> ; address of DPB 68 <2> ; 04/29/82 Mod to WRTDEV to look for ^C or ^S at console input when 69 <2> ; writting to console device via file I/O. Added a console 70 <2> ; output attribute to devices. 71 <2> ; 04/30/82 Call to en/dis able ^C check in dispatcher Call 51 72 <2> ; 04/30/82 Code to allow assignment of func 1-12 to disk files as well 73 <2> ; as devices.... pipes, redirection now possible 74 <2> ; 04/30/82 Expanded GETLIST call to 2.0 standard 75 <2> ; 05/04/82 Change to INT int_fatal_abort callout int HARDERR_DOS. DOS SS 76 <2> ; (data segment) stashed in ES, INT int_fatal_abort routines must 77 <2> ; preserve ES. This mod so HARDERR_DOS can be ROMed. 78 <2> ; 1.29 06/01/82 Installable block and character devices as per 2.0 spec 79 <2> ; 06/04/82 Fixed Bug in CLOSE regarding call to CHKFATWRT. It got left 80 <2> ; out back about 1.27 or so (oops). ARR 81 <2> ; 1.30 06/07/82 Directory sector buffering added to main DOS buffer queue 82 <2> ; 1.40 06/15/82 Tree structured directories. XENIX Path Parser MKDIR CHDIR 83 <2> ; RMDIR Xenix calls 84 <2> ; 1.41 06/13/82 Made GETBUFFR call PLACEBUF 85 <2> ; 1.50 06/17/82 FATs cached in buffer pool, get FAT pointer calls disappear 86 <2> ; Frees up lots of memory. 87 <2> ; 1.51 06/24/82 BREAKDOWN Revised to do EXACT one sector read/write through 88 <2> ; system buffers 89 <2> ; 1.52 06/30/82 OPEN, CLOSE, READ, WRITE, DUP, DUP2, LSEEK implemented 90 <2> ; 1.53 07/01/82 OPEN CLOSE mod for Xenix calls, saves and gets remote dir 91 <2> ; 1.54 07/11/82 Function calls 1-12 make use of new 2.0 PDB. Init code 92 <2> ; changed to set file handle environment. 93 <2> ; 2.00 08/01/82 Number for IBM release 94 <2> ; 01/19/83 No environ bug in EXEC 95 <2> ; 01/19/83 MS-DOS OEM INT 21 extensions (SET_OEM_HANDLER) 96 <2> ; 01/19/83 Performance bug fix in cooked write to NUL 97 <2> ; 01/27/83 Growcnt fixed for 32-bits 98 <2> ; 01/27/83 Find-first problem after create 99 <2> ; 2.01 02/17/83 International DOS 100 <2> ; 2.10 03/09/83 Start of NETWORK support 101 <2> ; New Buffer structure 102 <2> ; New Sytem file table structure 103 <2> ; FCB moved to internal representation 104 <2> ; DOS re-organized 105 <2> ; 2.11 04/21/83 Continuation of 2.10, preliminary Network 106 <2> ; device interface. 107 <2> ; 2.50 09/12/83 More network stuff 108 <2> ; 109 <2> ; ************************************************************* 110 <2> 111 <2> [list -] 111 ****************** <2> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <6> [list -] 14 <5> [list -] 3 <4> === Switch to base=000E10h -> "DOSSTART" 4 <4> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <4> ; (no prior section) ; DOSSTART ENDS 6 <4> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <4> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <4> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <4> === Switch to base=000E10h -> "CONSTANTS" 10 <4> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <4> ; (no prior section) ; CONSTANTS ENDS 12 <4> === Switch to base=000E10h -> "DATA" 13 <4> addsection DATA, align=2 PUBLIC class=DATA 14 <4> ; (no prior section) ; DATA ENDS 15 <4> === Switch to base=000E10h -> "TABLE" 16 <4> addsection TABLE, align=2 PUBLIC class=TABLE 17 <4> ; (no prior section) ; TABLE ENDS 18 <4> === Switch to base=000E10h -> "DOSDATATABLE" 19 <4> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <4> ; (no prior section) ; DOSDATATABLE ENDS 21 <4> === Switch to base=000E10h -> "DOSDATACODE" 22 <4> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <4> ; (no prior section) ; DOSDATACODE ENDS 24 <4> === Switch to base=000E10h -> "DOSBIODATA" 25 <4> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <4> === Switch to base=000E10h -> "LAST" 27 <4> addsection LAST, align=16 PUBLIC class=LAST 28 <4> ; (no prior section) ; LAST ENDS 29 <4> 30 <4> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <4> 32 <4> %include "entryseg.nas" 1 <5> 2 <5> %ifndef ENTRYSEGNAS 3 <5> %define ENTRYSEGNAS 1 4 <5> 5 <5> %include "lmacros3.mac" 1 <6> [list -] 6 <5> === Switch to base=000000h -> "DOSENTRY" 7 <5> addsection DOSENTRY, class=%[DOSENTRY] 8 <5> 9 <5> group DOSENTRYGROUP DOSENTRY 10 <5> 11 <5> %endif 8 <3> 9 <3> %include "dcodeseg.nas" 1 <4> 2 <4> %ifndef DCODESEGNAS 3 <4> %assign DCODESEGNAS 1 4 <4> === Switch to base=002450h -> "DOSCODETABLE" 5 <4> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <4> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <4> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <4> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <4> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <4> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <4> 12 <4> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <4> 14 <4> %endif 10 <3> === Switch to base=000E10h -> "LAST" 11 <3> section LAST 12 <3> ; (no prior section) ; LAST ENDS 122 <2> 123 <2> %include "dossym.mac" 1 <3> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 3 <3> ; PAGE 80,132 4 <3> TRUE EQU 0FFFFh 5 <3> FALSE EQU 0 6 <3> 7 <3> Installed equ TRUE 8 <3> %IFNDEF DEBUG 9 <3> DEBUG equ FALSE 10 <3> %ENDIF 11 <3> %IFNDEF debug 12 <3> debug equ DEBUG 13 <3> %ENDIF 14 <3> 15 <3> %if 0 16 <3> DBCS equ FALSE ; for fixmem.pl operation 17 <3> %endif 18 <3> 19 <3> ; NASM original macros 20 <3> 21 <3> %macro DBCS 1.nolist 22 <3> %defstr %%string %1 23 <3> %substr %%prefix %%string 1,2 24 <3> %substr %%suffix %%string 3,-1 25 <3> %ifnidni %%prefix, "= " 26 <3> %error Unexpected DBCS prefix 27 <3> %endif 28 <3> %deftok %%token %%suffix 29 <3> %xdefine DBCS %%token 30 <3> %endmacro 31 <3> 32 <3> %include "DBCS.SW" 1 <4> DBCS = FALSE 2 <4> 33 <3> %unmacro DBCS 1.nolist 34 <3> 35 <3> ; end of NASM original macros 36 <3> 37 <3> %include "dosmac.mac" 1 <4> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 3 <4> ; 4 <4> ; Macro file for MSDOS. 5 <4> ; 6 <4> 7 <4> %ifndef __DOSMAC_MAC__ 8 <4> %assign __DOSMAC_MAC__ 1 9 <4> 10 <4> TRUE EQU 0FFFFh 11 <4> FALSE EQU 0 12 <4> 13 <4> 14 <4> ; NASM original macros (comment for fixmem.pl) 15 <4> 16 <4> ;SUBTTL BREAK a listing into pages and give new subtitles 17 <4> ;PAGE 18 <4> %imacro BREAK 0-1+.nolist 19 <4> ;SUBTTL subtitle 20 <4> ;PAGE 21 <4> %endmacro 22 <4> ;.xcref break 23 <4> 24 <4> BREAK 25 <4> 26 <4> %if 0 27 <4> AsmVars Macro varlist 28 <4> IRP var, 29 <4> AsmVar var 30 <4> ENDM 31 <4> ENDM 32 <4> 33 <4> AsmVar Macro var 34 <4> IFNDEF var 35 <4> var = FALSE 36 <4> ENDIF 37 <4> ENDM 38 <4> %endif 39 <4> 40 <4> BREAK 41 <4> 42 <4> ; 43 <4> ; declare a variable external and allocate a size 44 <4> ; 45 <4> ;AsmVar InstalledData 46 <4> %ifndef InstalledData 47 <4> %define InstalledData 0 48 <4> %endif 49 <4> 50 <4> %imacro I_NEED 1-2.nolist 51 <4> %ifn InstalledData === Switch to base=000E10h -> "DATA" 52 <4> [section DATA] 53 <4> %IFIDNi %2, WORD 54 <4> EXTRN %1:WORD 55 <4> %ELSE 56 <4> %IFIDNi %2, DWORD 57 <4> EXTRN %1:DWORD 58 <4> %ELSE 59 <4> EXTRN %1:BYTE 60 <4> %ENDIF 61 <4> %ENDIF 62 <4> __SECT__ 63 <4> %ENDIF 64 <4> %endmacro 65 <4> ;.xcref I_need 66 <4> 67 <4> ; 68 <4> ; call a procedure that may be external. The call will be short. 69 <4> ; 70 <4> %imacro invoke 1.nolist 71 <4> ;.xcref 72 <4> EXTRN %1:NEAR 73 <4> ;.cref 74 <4> CALL %1 75 <4> %endmacro 76 <4> ;.xcref invoke 77 <4> 78 <4> ;PAGE 79 <4> ; 80 <4> ; jump to a label that may be external. The jump will be near. 81 <4> ; 82 <4> %imacro transfer 1.nolist 83 <4> ;.xcref 84 <4> EXTRN %1:NEAR 85 <4> ;.cref 86 <4> JUMP %1 87 <4> %endmacro 88 <4> ;.xcref transfer 89 <4> 90 <4> ; 91 <4> ; get a short address in a word 92 <4> ; 93 <4> %imacro short_addr 1.nolist 94 <4> %ifnidn %1, ? 95 <4> EXTRN %1:NEAR 96 <4> DW OFFSET %1 97 <4> %ELSE 98 <4> DW ? 99 <4> %ENDIF 100 <4> %endmacro 101 <4> ;.xcref short_addr 102 <4> 103 <4> ; 104 <4> ; get a long address in a dword 105 <4> ; 106 <4> %imacro long_addr 1.nolist 107 <4> EXTRN %1:NEAR 108 <4> DD %1 109 <4> %endmacro 110 <4> ;.xcref long_addr 111 <4> 112 <4> ; 113 <4> ; declare a PROC near or far but PUBLIC nonetheless 114 <4> ; 115 <4> ;.xcref ?frame 116 <4> ;.xcref ?aframe 117 <4> ;.xcref ?stackdepth 118 <4> ;.xcref ?initstack 119 <4> %assign ?frame 0 ; initial 120 <4> %assign ?aframe 0 ; initial 121 <4> %assign ?stackdepth 0 ; initial stack size 122 <4> %assign ?initstack 0 ; initial stack size 123 <4> 124 <4> %imacro procedure 1-2.nolist 125 <4> %assign ?frame 0 126 <4> %assign ?aframe 2 ;; remember the pushed BP 127 <4> %warning proc %1... 128 <4> %1 PROC %2 129 <4> PUBLIC %1 130 <4> %assign ?initstack ?stackdepth ;; beginning of procedure 131 <4> %endmacro 132 <4> ;.xcref procedure 133 <4> 134 <4> ; 135 <4> ; end a procedure and check that stack depth is preserved 136 <4> ; 137 <4> %imacro EndProc 1-2.nolist 138 <4> %ifnidni %2, NoCheck ;; check the stack size 139 <4> %if ?initstack != ?stackdepth ;; is it different? 140 <4> %warning ***** Possible stack size error in %1 ***** 141 <4> %endif 142 <4> %endif 143 <4> %1 ENDP 144 <4> %endmacro 145 <4> ;.xcref endproc 146 <4> ;PAGE 147 <4> ; 148 <4> ; define a data item to be public and of an appropriate size/type 149 <4> ; 150 <4> 151 <4> %imacro stripangles 2.nolist 152 <4> %defstr %%param %2 153 <4> %rep 16 154 <4> %substr %%opening %%param 1 155 <4> %ifidn %%opening, '<' 156 <4> %substr %%param %%param 2,-1 157 <4> %endif 158 <4> %endrep 159 <4> %rep 16 160 <4> %strlen %%length %%param 161 <4> %substr %%closing %%param %%length 162 <4> %ifidn %%closing, '>' 163 <4> %substr %%param %%param 1,-2 164 <4> %endif 165 <4> %endrep 166 <4> %deftok %%token %%param 167 <4> %1 %%token 168 <4> %endmacro 169 <4> 170 <4> %imacro I_AM 2-*.nolist 171 <4> ;I_AM MACRO name,size,init 172 <4> %xdefine %%name %1 173 <4> ;; declare the type of the object 174 <4> %IFIDNi %2, WORD 175 <4> %1 LABEL WORD 176 <4> %assign I_AM_SIZE 1 177 <4> %assign I_AM_LEN 2 178 <4> %ELSE 179 <4> %IFIDNi %2, DWORD 180 <4> %1 LABEL DWORD 181 <4> %assign I_AM_SIZE 2 182 <4> %assign I_AM_LEN 2 183 <4> %ELSE 184 <4> %IFIDNi %2, BYTE 185 <4> %1 LABEL BYTE 186 <4> %assign I_AM_SIZE 1 187 <4> %assign I_AM_LEN 1 188 <4> %ELSE 189 <4> %1 LABEL BYTE 190 <4> %undef I_AM_SIZE 191 <4> stripangles %assign I_AM_SIZE, %2 192 <4> %assign I_AM_LEN 1 193 <4> %ENDIF 194 <4> %ENDIF 195 <4> %ENDIF 196 <4> ;; declare the object public 197 <4> PUBLIC %%name 198 <4> ;; if no initialize then allocate blank storage 199 <4> %IF %0 == 2 200 <4> DB I_AM_SIZE*I_AM_LEN DUP (?) 201 <4> %ELSE 202 <4> %ifn InstalledData 203 <4> %rotate 2 204 <4> %rep %0 - 2 205 <4> %IF I_AM_LEN == 1 206 <4> stripangles db, %1 207 <4> %ELSE 208 <4> stripangles dw, %1 209 <4> %ENDIF 210 <4> %assign I_AM_SIZE I_AM_SIZE - 1 211 <4> %rotate 1 212 <4> %endrep 213 <4> %IF I_AM_SIZE != 0 214 <4> %error ***** initialization of %%name not complete ***** 215 <4> %ENDIF 216 <4> %ELSE 217 <4> DB I_AM_SIZE*I_AM_LEN DUP (?) 218 <4> %ENDIF 219 <4> %ENDIF 220 <4> %endmacro 221 <4> 222 <4> %imacro I_AM_NOBITS 2-*.nolist 223 <4> ;I_AM MACRO name,size,init 224 <4> %xdefine %%name %1 225 <4> ;; declare the type of the object 226 <4> %IFIDNi %2, WORD 227 <4> %1 LABEL WORD 228 <4> %assign I_AM_SIZE 1 229 <4> %assign I_AM_LEN 2 230 <4> %ELSE 231 <4> %IFIDNi %2, DWORD 232 <4> %1 LABEL DWORD 233 <4> %assign I_AM_SIZE 2 234 <4> %assign I_AM_LEN 2 235 <4> %ELSE 236 <4> %IFIDNi %2, BYTE 237 <4> %1 LABEL BYTE 238 <4> %assign I_AM_SIZE 1 239 <4> %assign I_AM_LEN 1 240 <4> %ELSE 241 <4> %1 LABEL BYTE 242 <4> %undef I_AM_SIZE 243 <4> stripangles %assign I_AM_SIZE, %2 244 <4> %assign I_AM_LEN 1 245 <4> %ENDIF 246 <4> %ENDIF 247 <4> %ENDIF 248 <4> ;; declare the object public 249 <4> PUBLIC %%name 250 <4> ;; if no initialize then allocate blank storage 251 <4> %IF %0 == 2 252 <4> resb I_AM_SIZE*I_AM_LEN 253 <4> %ELSE 254 <4> %ifn InstalledData 255 <4> %rotate 2 256 <4> %rep %0 - 2 257 <4> %IF I_AM_LEN == 1 258 <4> resb 1 259 <4> %ELSE 260 <4> resw 1 261 <4> %ENDIF 262 <4> %assign I_AM_SIZE I_AM_SIZE - 1 263 <4> %rotate 1 264 <4> %endrep 265 <4> %IF I_AM_SIZE != 0 266 <4> %error ***** initialization of %%name not complete ***** 267 <4> %ENDIF 268 <4> %ELSE 269 <4> resb I_AM_SIZE*I_AM_LEN 270 <4> %ENDIF 271 <4> %ENDIF 272 <4> %endmacro 273 <4> 274 <4> ;.xcref I_AM 275 <4> ;.xcref I_AM_SIZE 276 <4> ;.xcref I_AM_LEN 277 <4> %assign I_AM_SIZE 0 278 <4> %assign I_AM_LEN 0 279 <4> 280 <4> ;PAGE 281 <4> 282 <4> ; 283 <4> ; define an entry in a procedure 284 <4> ; 285 <4> %imacro entry 1.nolist 286 <4> %1: 287 <4> PUBLIC %1 288 <4> %endmacro 289 <4> ;.xcref entry 290 <4> 291 <4> BREAK 292 <4> 293 <4> %imacro error 1.nolist 294 <4> ;.xcref 295 <4> MOV AL, %1 296 <4> transfer SYS_RET_ERR 297 <4> ;.cref 298 <4> %endmacro 299 <4> ;.xcref error 300 <4> 301 <4> BREAK 302 <4> ; 303 <4> ; given a label either 2 byte jump to another label _J 304 <4> ; if it is near enough or 3 byte jump to 305 <4> ; 306 <4> 307 <4> %imacro jump 1.nolist 308 <4> ;.xcref 309 <4> 310 <4> %ifndef %1_J ;; is this the first invocation 311 <4> %%a: JMP %1 312 <4> %ELSE 313 <4> %IF (%1_J >= $) || ($-%1_J > 126) 314 <4> %%a: JMP %1 ;; is the jump too far away? 315 <4> %ELSE 316 <4> %%a: JMP %1_J ;; do the short one... 317 <4> %ENDIF 318 <4> %ENDIF 319 <4> %ixdefine %1_j %%a 320 <4> ;.cref 321 <4> %endmacro 322 <4> ;.xcref jump 323 <4> 324 <4> BREAK 325 <4> 326 <4> %imacro return 0.nolist 327 <4> %%a: 328 <4> RET 329 <4> %xdefine ret_l %%a 330 <4> %endmacro 331 <4> ;.xcref return 332 <4> 333 <4> BREAK 334 <4> 335 <4> %imacro condret 2.nolist 336 <4> %assign %%exit 0 337 <4> %ifdef ret_l ;; if ret_l is defined 338 <4> %if (($ - ret_l) <= 126) && ($ > ret_l) 339 <4> ;; if ret_l is near enough then 340 <4> %%a: j%1 ret_l ;; a: j to ret_l 341 <4> %xdefine ret_%1 %%a ;; define ret_ to be a: 342 <4> %assign %%exit 1 343 <4> %endif 344 <4> %endif 345 <4> %ifn %%exit 346 <4> %ifdef ret_%1 ;; if ret_ defined 347 <4> %if (($ - ret_%1) <= 126) && ($ > ret_%1) 348 <4> ;; if ret_ is near enough 349 <4> %%a: j%1 ret_%1 ;; a: j to ret_ 350 <4> %xdefine ret_%1 %%a ;; define ret_ to be a: 351 <4> %assign %%exit 1 352 <4> %endif 353 <4> %endif 354 <4> %endif 355 <4> %ifn %%exit 356 <4> j%2 %%a ;; j a: 357 <4> return ;; return 358 <4> %%a: ;; a: 359 <4> %xdefine ret_%1 ret_l ;; define ret_ to be ret_l 360 <4> %endif 361 <4> %endmacro 362 <4> ;.xcref condret 363 <4> 364 <4> BREAK 365 <4> 366 <4> %imacro retz 0.nolist 367 <4> condret z,nz 368 <4> %endmacro 369 <4> ;.xcref retz 370 <4> 371 <4> BREAK 372 <4> 373 <4> %imacro retnz 0.nolist 374 <4> condret nz,z 375 <4> %endmacro 376 <4> ;.xcref retnz 377 <4> 378 <4> BREAK 379 <4> 380 <4> %imacro retc 0.nolist 381 <4> condret c,nc 382 <4> %endmacro 383 <4> ;.xcref retc 384 <4> 385 <4> BREAK 386 <4> 387 <4> %imacro retnc 0.nolist 388 <4> condret nc,c 389 <4> %endmacro 390 <4> ;.xcref retnc 391 <4> 392 <4> BREAK 393 <4> 394 <4> %imacro context 1.nolist 395 <4> PUSH SS 396 <4> stripangles POP, %1 397 <4> ; ASSUME %1:DOSGROUP 398 <4> %endmacro 399 <4> ;.xcref context 400 <4> 401 <4> BREAK 402 <4> 403 <4> %imacro SaveReg 0-*.nolist ;; push those registers 404 <4> %rep %0 405 <4> %assign ?stackdepth ?stackdepth + 1 406 <4> stripangles push, %1 407 <4> %rotate 1 408 <4> %endrep 409 <4> %endmacro 410 <4> ;.xcref SaveReg 411 <4> 412 <4> BREAK 413 <4> 414 <4> %imacro RestoreReg 0-*.nolist ;; pop those registers 415 <4> %rep %0 416 <4> %assign ?stackdepth ?stackdepth - 1 417 <4> stripangles pop, %1 418 <4> %rotate 1 419 <4> %endrep 420 <4> %endmacro 421 <4> ;.xcref RestoreReg 422 <4> 423 <4> BREAK 424 <4> 425 <4> %imacro EnterCrit 1.nolist 426 <4> Invoke E%1 427 <4> %endmacro 428 <4> 429 <4> %imacro LeaveCrit 1.nolist 430 <4> Invoke L%1 431 <4> %endmacro 432 <4> 433 <4> Break 434 <4> 435 <4> ;AsmVars 436 <4> %ifndef ShareF 437 <4> %idefine ShareF 0 438 <4> %endif 439 <4> %ifndef Cargs 440 <4> %idefine Cargs 0 441 <4> %endif 442 <4> %ifndef Redirector 443 <4> %idefine Redirector 0 444 <4> %endif 445 <4> %ifndef debug 446 <4> %idefine debug 0 447 <4> %endif 448 <4> 449 <4> %if debug 450 <4> %imacro fmt 3-*.nolist 451 <4> ;fmt MACRO typ,lev,fmts,args 452 <4> ;local a,b,c 453 <4> PUSHF 454 <4> %IFNempty %1 455 <4> TEST word [BugTyp],%1 456 <4> JZ %%c 457 <4> CMP word [BugLev],%2 458 <4> JB %%c 459 <4> %ENDIF 460 <4> PUSH AX 461 <4> PUSH BP 462 <4> MOV BP,SP 463 <4> %If (! sharef) && (! redirector) === Switch to base=000E10h -> "TABLE" 464 <4> [section Table] 465 <4> %%a: db %3,0 466 <4> __SECT__ 467 <4> MOV AX,OFFSET %%a wrt DOSGROUP 468 <4> %else 469 <4> jmp short %%b 470 <4> %%a: db %3,0 471 <4> %if sharef 472 <4> %%b: mov ax,offset %%a wrt share 473 <4> %else 474 <4> %%b: mov ax,offset %%a wrt netwrk 475 <4> %endif 476 <4> %endif 477 <4> PUSH AX 478 <4> %iassign cargs 2 479 <4> %rotate 3 480 <4> %rep %0 - 3 481 <4> %ifidni ax, %1 482 <4> MOV AX,[BP+2] 483 <4> %ELSE 484 <4> MOV AX, %1 485 <4> %ENDIF 486 <4> PUSH AX 487 <4> %iassign cargs cargs + 2 488 <4> %rotate 1 489 <4> %endrep 490 <4> invoke PFMT 491 <4> ADD SP, Cargs 492 <4> POP BP 493 <4> POP AX 494 <4> %%c: 495 <4> POPF 496 <4> %endmacro 497 <4> %else 498 <4> %imacro fmt 3-*.nolist 499 <4> %endmacro 500 <4> %endif 501 <4> 502 <4> Break 503 <4> 504 <4> ;AsmVar Debug,$temp 505 <4> 506 <4> %imacro detectstripangles 4.nolist 507 <4> %defstr %%param %4 508 <4> %assign ?%2 0 509 <4> %assign ?%3 0 510 <4> %rep 16 511 <4> %substr %%opening %%param 1 512 <4> %ifidn %%opening, '<' 513 <4> %substr %%param %%param 2,-1 514 <4> %assign ?%2 ?%2 + 1 515 <4> %endif 516 <4> %endrep 517 <4> %rep 16 518 <4> %strlen %%length %%param 519 <4> %substr %%closing %%param %%length 520 <4> %ifidn %%closing, '>' 521 <4> %substr %%param %%param 1,-2 522 <4> %assign ?%3 ?%3 + 1 523 <4> %endif 524 <4> %endrep 525 <4> %deftok %%token %%param 526 <4> %define ?%1 %%token 527 <4> %endmacro 528 <4> 529 <4> 530 <4> %IF debug 531 <4> %imacro DOSAssume 3-*.nolist 532 <4> ;DOSAssume Macro reg,reglist,message 533 <4> %ifidni %1, CS 534 <4> %assign %%temp 1 535 <4> %else 536 <4> %ifidni %1, SS 537 <4> %assign %%temp 0 538 <4> %else 539 <4> %error ***** Invalid DOS register %1 in DOSAssume ***** 540 <4> %endif 541 <4> %endif 542 <4> %rotate 1 543 <4> %assign %%level 0 544 <4> %assign %%amount %0 - 1 545 <4> %rep 16 546 <4> detectstripangles %%token, %%opening, %%closing, %1 547 <4> %assign %%level %%level + ? %+ %%opening 548 <4> %assign %%level %%level - ? %+ %%closing 549 <4> %ifidni ? %+ %%token, DS 550 <4> %assign %%temp %%temp | 2 551 <4> %else 552 <4> %ifidni ? %+ %%token, ES 553 <4> %assign %%temp %%temp | 4 554 <4> %else 555 <4> %error ***** Invalid register reg in DOSAssume ***** 556 <4> %endif 557 <4> %endif 558 <4> %assign %%amount %%amount - 1 559 <4> %rotate 1 560 <4> %if %%level <= 0 561 <4> %exitrep 562 <4> %endif 563 <4> %endrep 564 <4> 565 <4> PUSH AX 566 <4> MOV AX, %%temp 567 <4> PUSH AX 568 <4> %IF SHAREF 569 <4> MOV AX,OFFSET %%a 570 <4> %ELSE 571 <4> MOV AX,OFFSET %%a wrt DOSGroup 572 <4> %ENDIF 573 <4> PUSH AX 574 <4> Invoke SegCheck 575 <4> POP AX 576 <4> %IFN SHAREF === Switch to base=000E10h -> "TABLE" 577 <4> [section Table] 578 <4> %ELSE 579 <4> JMP SHORT %%b 580 <4> %ENDIF 581 <4> %%a: 582 <4> %rep %%amount 583 <4> DB %1 584 <4> %rotate 1 585 <4> %endrep 586 <4> db 0 587 <4> %IFN SHAREF 588 <4> __SECT__ 589 <4> %ELSE 590 <4> %%b: 591 <4> %ENDIF 592 <4> ;IRP r, 593 <4> ; ASSUME r:DOSGroup 594 <4> ;ENDM 595 <4> %endmacro 596 <4> %ELSE 597 <4> %imacro DOSAssume 3-*.nolist 598 <4> ;DOSAssume Macro reg,reglist,message 599 <4> ;IRP r, 600 <4> ; ASSUME r:DOSGroup 601 <4> ;ENDM 602 <4> %endmacro 603 <4> %ENDIF 604 <4> 605 <4> BREAK 606 <4> 607 <4> %if 0 608 <4> ;IF DEBUG 609 <4> Assert MACRO kind, objs, message 610 <4> LOCAL a,b 611 <4> IFIDN , 612 <4> CMP objs,0 613 <4> JZ a 614 <4> fmt <>,<>, 615 <4> a: 616 <4> ELSE 617 <4> IFIDN , 618 <4> CMP objs,0 619 <4> JNZ a 620 <4> fmt <>,<>, 621 <4> a: 622 <4> ELSE 623 <4> PUSH AX 624 <4> IRP obj, 625 <4> PUSH obj 626 <4> ENDM 627 <4> IF SHAREF 628 <4> MOV AX,OFFSET b 629 <4> ELSE 630 <4> MOV AX,OFFSET DOSGroup:b 631 <4> ENDIF 632 <4> PUSH AX 633 <4> IFIDN , 634 <4> Invoke BUFCheck 635 <4> ENDIF 636 <4> IFIDN , 637 <4> Invoke SFTCheck 638 <4> ENDIF 639 <4> IFIDN , 640 <4> Invoke DPBCheck 641 <4> ENDIF 642 <4> POP AX 643 <4> IF SHAREF 644 <4> JMP SHORT a 645 <4> b DB Message,0 646 <4> a: 647 <4> ELSE === Switch to base=000E10h -> "TABLE" 648 <4> Table segment 649 <4> b db Message,0 === Switch to base=000E10h -> "TABLE" 650 <4> Table ends 651 <4> ENDIF 652 <4> ENDIF 653 <4> ENDIF 654 <4> ENDM 655 <4> %ELSE 656 <4> %imacro Assert 0-*.nolist 657 <4> %endmacro 658 <4> %ENDIF 659 <4> 660 <4> %ifndef Installed 661 <4> %idefine Installed 1 662 <4> %endif 663 <4> 664 <4> Break 665 <4> 666 <4> %imacro CallInstall 3-*.nolist 667 <4> ;CallInstall MACRO name,mpx,fn,save,restore 668 <4> %define %%name %1 669 <4> %assign %%mpx %2 670 <4> %assign %%fn %3 671 <4> %IF Installed 672 <4> %rotate 3 673 <4> %assign %%level 0 674 <4> %assign %%amountsaved 0 675 <4> %rep %0 - 3 676 <4> %ifnempty %1 677 <4> detectstripangles %%token, %%opening, %%closing, %1 678 <4> %assign %%level %%level + ? %+ %%opening 679 <4> %assign %%level %%level - ? %+ %%closing 680 <4> SaveReg ? %+ %%token 681 <4> %endif 682 <4> %assign %%amountsaved %%amountsaved + 1 683 <4> %rotate 1 684 <4> %if %%level <= 0 685 <4> %exitrep 686 <4> %endif 687 <4> %endrep 688 <4> MOV AX,(%%mpx << 8) + %%fn 689 <4> INT 2Fh 690 <4> %assign %%level 0 691 <4> %assign %%amountrestored 0 692 <4> %rep %0 - 3 - %%amountsaved 693 <4> %ifnempty %1 694 <4> detectstripangles %%token, %%opening, %%closing, %1 695 <4> %assign %%level %%level + ? %+ %%opening 696 <4> %assign %%level %%level - ? %+ %%closing 697 <4> RestoreReg ? %+ %%token 698 <4> %endif 699 <4> %assign %%amountrestored %%amountrestored + 1 700 <4> %rotate 1 701 <4> %if %%level <= 0 702 <4> %exitrep 703 <4> %endif 704 <4> %endrep 705 <4> %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored 706 <4> %error Wrong amount saved or restored 707 <4> %endif 708 <4> %ELSE 709 <4> Invoke %%name 710 <4> %ENDIF 711 <4> %endmacro 712 <4> 713 <4> Break 714 <4> 715 <4> %imacro localvar 2.nolist 716 <4> %ifidni %2, BYTE 717 <4> %assign ?frame ?frame + 1 718 <4> %assign %%a ?frame 719 <4> labelsize %1, byte, bp - %%a 720 <4> %else 721 <4> %ifidni %2, WORD 722 <4> %assign ?frame ?frame + 2 723 <4> %assign %%a ?frame 724 <4> labelsize %1, word, bp - %%a 725 <4> %else 726 <4> %ifidni %2, DWORD 727 <4> %assign ?frame ?frame + 4 728 <4> %assign %%a ?frame 729 <4> labelsize %1 %+ l, word, bp - %%a 730 <4> labelsize %1 %+ h, word, bp - %%a + 2 731 <4> labelsize %1, dword, bp - %%a 732 <4> %else 733 <4> %assign ?frame ?frame + %2 734 <4> %assign %%a ?frame 735 <4> labelsize %1, byte, bp - %%a 736 <4> %endif 737 <4> %endif 738 <4> %endif 739 <4> %endmacro 740 <4> 741 <4> %imacro enter 0.nolist 742 <4> push bp 743 <4> mov bp,sp 744 <4> sub sp,?frame 745 <4> %endmacro 746 <4> 747 <4> %imacro leave 0.nolist 748 <4> mov sp,bp 749 <4> pop bp 750 <4> %endmacro 751 <4> 752 <4> 753 <4> %imacro argvar 2.nolist 754 <4> %ifidni %2, BYTE 755 <4> %assign %%a ?aframe 756 <4> %assign ?aframe ?aframe + 1 757 <4> labelsize %1, byte, bp + %%a 758 <4> %else 759 <4> %ifidni %2, WORD 760 <4> %assign %%a ?aframe 761 <4> %assign ?aframe ?aframe + 2 762 <4> labelsize %1, word, bp + %%a 763 <4> %else 764 <4> %ifidni %2, DWORD 765 <4> %assign %%a ?aframe 766 <4> %assign ?aframe ?aframe + 4 767 <4> labelsize %1 %+ l, word, bp + %%a 768 <4> labelsize %1 %+ h, word, bp + %%a + 2 769 <4> labelsize %1, dword, bp + %%a 770 <4> %else 771 <4> %assign %%a ?aframe 772 <4> %assign ?aframe ?aframe + %2 773 <4> labelsize %1, byte, bp + %%a 774 <4> %endif 775 <4> %endif 776 <4> %endif 777 <4> %endmacro 778 <4> 779 <4> BREAK 780 <4> 781 <4> %imacro errnz 1.nolist 782 <4> detectstripangles %%token, %%opening, %%closing, %1 783 <4> %if ? %+ %%token 784 <4> %error %1 <> 0 785 <4> %endif 786 <4> %endmacro 787 <4> 788 <4> %endif 38 <3> 39 <3> %include "versiona.mac" 1 <4> 2 <4> major_version equ 4 ;Major DOS version 3 <4> minor_version equ 00 ;Minor DOS Version 4 <4> 5 <4> MINOR_VERSION equ minor_version ; NASM port equate 6 <4> MAJOR_VERSION equ major_version ; NASM port equate 7 <4> expected_version equ (MINOR_VERSION << 8)+MAJOR_VERSION 8 <4> 9 <4> alt_major_version equ 5 ;Major DOS version 10 <4> alt_minor_version equ 26 ;Minor DOS Version 11 <4> 12 <4> alt_expected_version equ (alt_minor_version << 8) + alt_major_version 13 <4> 14 <4> %warning out: ... for DOS Version 4.00 ... 14 ****************** <4> warning: out: ... for DOS Version 4.00 ... [-w+user] 15 <4> 16 <4> ;****************************** 17 <4> ;Each assembler program should: 18 <4> ; mov ah,030h ;DOS Get Version function 19 <4> ; int 021h ;Version ret. in AX,minor version first 20 <4> ; cmp ax,expected_version ;ALL utilities should check for an 21 <4> ; jne error_handler ; EXACT version match. 22 <4> ;****************************** 23 <4> 40 <3> 41 <3> BREAK 42 <3> 43 <3> c_DEL EQU 7Fh ; ASCII rubout or delete previous char 44 <3> c_BS EQU 08h ; ^H ASCII backspace 45 <3> c_CR EQU 0Dh ; ^M ASCII carriage return 46 <3> c_LF EQU 0Ah ; ^J ASCII linefeed 47 <3> c_ETB EQU 17h ; ^W ASCII end of transmission 48 <3> c_NAK EQU 15h ; ^U ASCII negative acknowledge 49 <3> c_ETX EQU 03h ; ^C ASCII end of text 50 <3> c_HT EQU 09h ; ^I ASCII tab 51 <3> 52 <3> BREAK 53 <3> 54 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 55 <3> ; ; 56 <3> ; C A V E A T P R O G R A M M E R ; 57 <3> ; ; 58 <3> ; Certain structures, constants and system calls below are private to ; 59 <3> ; the DOS and are extremely version-dependent. They may change at any ; 60 <3> ; time at the implementors' whim. As a result, they must not be ; 61 <3> ; documented to the general public. If an extreme case arises, they ; 62 <3> ; must be documented with this warning. ; 63 <3> ; ; 64 <3> ; Those structures and constants that are subject to the above will be ; 65 <3> ; marked and bracketed with the flag: ; 66 <3> ; ; 67 <3> ; C A V E A T P R O G R A M M E R ; 68 <3> ; ; 69 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 70 <3> 71 <3> %include "bpb.mac" 1 <4> %warning out: BPB.INC... 1 ****************** <4> warning: out: BPB.INC... [-w+user] 2 <4> ; SCCSID = @(#)BPB.ASM 1.1 85/04/29 3 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 4 <4> ; C A V E A T P R O G R A M M E R ; 5 <4> ; ; 6 <4> 7 <4> ; BIOS PARAMETER BLOCK DEFINITION 8 <4> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB 9 <4> 10 <4> BPBLOCK STRUC 0 00000D12 ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 00000D14 ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 00000D15 ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 00000D17 ?? BPFTCNT DB ? ; NUMBER OF FATS 0 00000D18 ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00000D1A ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 00000D1C ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 00000D1D ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <4> BPBLOCK ENDS 20 <4> 21 <4> A_BPB STRUC 0 00000D12 ???? BPB_BYTESPERSECTOR DW ? 0 00000D14 ?? BPB_SECTORSPERCLUSTER DB ? 0 00000D15 ???? BPB_RESERVEDSECTORS DW ? 0 00000D17 ?? BPB_NUMBEROFFATS DB ? 0 00000D18 ???? BPB_ROOTENTRIES DW ? 0 00000D1A ???? BPB_TOTALSECTORS DW ? 0 00000D1C ?? BPB_MEDIADESCRIPTOR DB ? 0 00000D1D ???? BPB_SECTORSPERFAT DW ? 0 00000D1F ???? BPB_SECTORSPERTRACK DW ? 0 00000D21 ???? BPB_HEADS DW ? 0 00000D23 ???? BPB_HIDDENSECTORS DW ? 0 00000D25 ???? DW ? 0 00000D27 ???? BPB_BIGTOTALSECTORS DW ? 0 00000D29 ???? DW ? 0 00000D2B ???????????? DB 6 DUP(?) 37 <4> A_BPB ENDS 38 <4> ; ; 39 <4> ; C A V E A T P R O G R A M M E R ; 40 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 72 <3> 73 <3> %include "buffer.mac" 1 <4> %include "buf2sw.mac" 1 <5> %define BUF2 1 2 <4> 3 <4> ; SCCSID = @(#)buffer.asm 1.1 85/04/09 4 <4> BREAK 5 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 6 <4> ; C A V E A T P R O G R A M M E R ; 7 <4> ; ; 8 <4> 9 <4> %ifdef BUF2 10 <4> 11 <4> ; Field definition for I/O buffer information 12 <4> 13 <4> BUFFINFO STRUC 0 00000D12 ???????? NEXTBUF DD ? ; Pointer to next buffer in list 15 <4> ; The next two items are often refed as a word 16 <4> buf_ID: 0 00000D16 ?? BUFDRV DB ? ; Logical drive # assoc with buffer FF = free 18 <4> buf_flags: 0 00000D17 ?? BUFDATAFLAG db ? 0 00000D18 ?? BUFPRI DB ? ; Buffer selection priority (see EQUs below) 0 00000D19 ?? alignb 2 22 <4> buf_sector: 0 00000D1A ???????? BUFSECNO dd ? ; Sector number of buffer 24 <4> alignb 2 0 00000D1E ???????? BUFDRVDP DD ? ; Pointer to drive parameters 26 <4> BUFFINFO ENDS 27 <4> 28 <4> BUFINSIZ EQU BUFFINFO_struc_size 29 <4> ; Size of structure in bytes 30 <4> BUFINSIZE equ BUFINSIZ 31 <4> 32 <4> FREEPRI EQU 0 33 <4> LBRPRI EQU 2 ; Last byte of buffer read 34 <4> LBWPRI EQU 4 ; Last byte written 35 <4> RPRI EQU 6 ; Read but not last byte 36 <4> WPRI EQU 8 ; Written but not last byte 37 <4> DIRPRI EQU 15 ; Directory Sector 38 <4> FATPRI EQU 30 ; FAT sector 39 <4> 40 <4> buf_dirty EQU 01000000B 41 <4> buf_isDATA EQU 00001000B 42 <4> buf_isDIR EQU 00000100B 43 <4> buf_isFAT EQU 00000010B 44 <4> buf_type_0 EQU 11110001B ; AND sets type to "none" 45 <4> 46 <4> %else 47 <4> 48 <4> ; Field definition for I/O buffer information 49 <4> 50 <4> BUFFINFO STRUC 51 <4> buf_next DW ? ; Pointer to next buffer in list 52 <4> buf_prev DW ? ; Pointer to prev buffer in list 53 <4> buf_ID DB ? ; Drive of buffer (bit 7 = 0) 54 <4> ; SFT table index (bit 7 = 1) 55 <4> ; = FFH if buffer free 56 <4> buf_flags DB ? ; Bit 7 = 1 if Remote file buffer 57 <4> ; = 0 if Local device buffer 58 <4> ; Bit 6 = 1 if buffer dirty 59 <4> ; Bit 5 = Reserved 60 <4> ; Bit 4 = Search bit (bit 7 = 1) 61 <4> ; Bit 3 = 1 if buffer is DATA 62 <4> ; Bit 2 = 1 if buffer is DIR 63 <4> ; Bit 1 = 1 if buffer is FAT 64 <4> ; Bit 0 = Reserved 65 <4> buf_sector DD ? ; Sector number of buffer (bit 7 = 0) 66 <4> ; The next two items are often refed as a word (bit 7 = 0) 67 <4> buf_wrtcnt DB ? ; For FAT sectors, # times sector written out 68 <4> buf_wrtcntinc DW ? ; " " " , # sectors between each write 69 <4> buf_DPB DD ? ; Pointer to drive parameters 70 <4> buf_fill DW ? ; How full buffer is (bit 7 = 1) 71 <4> buf_reserved DB ? ; make DWORD boundary for 386 72 <4> BUFFINFO ENDS 73 <4> 74 <4> labelsize buf_offset, dword, buf_sector 75 <4> ;For bit 7 = 1, this is the byte 76 <4> ;offset of the start of the buffer in 77 <4> ;the file pointed to by buf_ID. Thus 78 <4> ;the buffer starts at location 79 <4> ;buf_offset in the file and contains 80 <4> ;buf_fill bytes. 81 <4> 82 <4> BUFINSIZ EQU BUFFINFO_struc_size 83 <4> ; Size of structure in bytes 84 <4> 85 <4> buf_Free EQU 0FFh ; buf_id of free buffer 86 <4> 87 <4> ;Flag byte masks 88 <4> buf_isnet EQU 10000000B 89 <4> buf_dirty EQU 01000000B 90 <4> 91 <4> buf_isDATA EQU 00001000B 92 <4> buf_isDIR EQU 00000100B 93 <4> buf_isFAT EQU 00000010B 94 <4> buf_type_0 EQU 11110001B ; AND sets type to "none" 95 <4> 96 <4> buf_NetID EQU BUFINSIZ 97 <4> 98 <4> ; 99 <4> ; Buffer Hash Entry Structure 100 <4> 101 <4> BUFFER_HASH_ENTRY STRUC ; DOS 4.00 102 <4> EMS_PAGE_NUM DW ? ; logical page number for EMS handle 103 <4> BUFFER_BUCKET DD ? ; pointer to buffers 104 <4> DIRTY_COUNT DB ? ; number of dirty buffers 105 <4> BUFFER_RESERVED DB ? ; reserved 106 <4> BUFFER_HASH_ENTRY ENDS 107 <4> 108 <4> MaxBuffinBucket EQU 15 ; Max number of buffers per bucket 109 <4> MaxBucketinPage EQU 2 ; Max number of buckets per 16kb page 110 <4> 111 <4> %endif 112 <4> 113 <4> ; ; 114 <4> ; C A V E A T P R O G R A M M E R ; 115 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 74 <3> 75 <3> BREAK 76 <3> ; Location of user registers relative user stack pointer 77 <3> 78 <3> user_environ STRUC 0 00000D12 ???? user_AX DW ? 0 00000D14 ???? user_BX DW ? 0 00000D16 ???? user_CX DW ? 0 00000D18 ???? user_DX DW ? 0 00000D1A ???? user_SI DW ? 0 00000D1C ???? user_DI DW ? 0 00000D1E ???? user_BP DW ? 0 00000D20 ???? user_DS DW ? 0 00000D22 ???? user_ES DW ? 0 00000D24 ???? user_IP DW ? 0 00000D26 ???? user_CS DW ? 0 00000D28 ???? user_F DW ? 91 <3> user_environ ENDS 92 <3> 93 <3> %include "sysvar.mac" 1 <4> ; SCCSID = @(#)sysvar.asm 1.1 85/04/10 2 <4> %include "version.mac" 1 <5> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <5> TRUE EQU 0FFFFh 3 <5> TRUEBYTE EQU 0FFh 4 <5> FALSE EQU 0 5 <5> 6 <5> ; 7 <5> ; Use the following switches to control cmacros.inc 8 <5> ; 9 <5> ?PLM equ 0 10 <5> ?WIN equ 0 11 <5> 12 <5> memS EQU 1 ; Small model 13 <5> ; 14 <5> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <5> ; version of the operating system 16 <5> ; 17 <5> ; The below chart will indicate how to set the switches to build the various 18 <5> ; versions 19 <5> ; 20 <5> ; IBMVER IBMCOPYRIGHT 21 <5> ; -------------------------------------------------------- 22 <5> ; IBM Version | TRUE TRUE 23 <5> ; -------------------------------------------------------- 24 <5> ; MS Version | FALSE FALSE 25 <5> ; -------------------------------------------------------- 26 <5> ; Clone Version | TRUE FALSE 27 <5> ; 28 <5> IBMVER EQU TRUE 29 <5> IBMCOPYRIGHT EQU FALSE 30 <5> 31 <5> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <5> 33 <5> %ifndef MSVER 34 <5> MSVER EQU ~ IBMVER 35 <5> %endif 36 <5> IBM EQU IBMVER 37 <5> ; 38 <5> ; 39 <5> %IF IBMVER 40 <5> %IF IBMCOPYRIGHT 41 <5> %warning out: ... IBM version build switch on ... 42 <5> %ELSE 43 <5> %warning out: ... CLONE version build switch on ... 43 ****************** <5> warning: out: ... CLONE version build switch on ... [-w+user] 44 <5> %ENDIF 45 <5> %ELSE 46 <5> %IFN IBMCOPYRIGHT 47 <5> %warning out: ... MS version build switch on ... 48 <5> %ELSE 49 <5> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <5> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <5> %ENDIF 52 <5> %ENDIF 53 <5> ; 54 <5> ; 55 <5> ;*************************************************************************** 56 <5> ;* The following switches are for DBCS or SBCS support * 57 <5> ;* * 58 <5> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <5> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <5> ;* * 61 <5> ;*************************************************************************** 62 <5> ; 63 <5> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <5> 65 <5> ; 66 <5> ; Switch INTERNAT for DBCS support 67 <5> ; 68 <5> INTERNAT EQU FALSE 69 <5> ; 70 <5> %IF INTERNAT 71 <5> %ifndef KANJI 72 <5> KANJI EQU TRUE 73 <5> %endif 74 <5> IBMJAPAN EQU TRUE 75 <5> %ELSE 76 <5> %ifndef KANJI 77 <5> KANJI EQU FALSE 78 <5> %endif 79 <5> IBMJAPAN EQU FALSE 80 <5> %ENDIF 81 <5> 82 <5> %ifndef altvect ; avoid jerking off vector.inc 83 <5> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <5> %endif 85 <5> 86 <5> ; 87 <5> ; Country code switches 88 <5> ; The default contry code is assumed as USA. 89 <5> ; 90 <5> %IF INTERNAT 91 <5> KOREA EQU TRUE 92 <5> JAPAN EQU FALSE 93 <5> %ELSE 94 <5> KOREA EQU FALSE 95 <5> JAPAN EQU FALSE 96 <5> %ENDIF 97 <5> ; 98 <5> %IF INTERNAT 99 <5> %warning out: Internat(ECS) version build switch on 100 <5> %ENDIF 3 <4> 4 <4> SysInitVars STRUC 0 00000D12 ???????? SYSI_DPB DD ? ; DPB chain 0 00000D16 ???????? SYSI_SFT DD ? ; SFT chain 0 00000D1A ???????? SYSI_CLOCK DD ? ; CLOCK device 0 00000D1E ???????? SYSI_CON DD ? ; CON device 0 00000D22 ???? SYSI_MAXSEC DW ? ; maximum sector size 0 00000D24 ???????? SYSI_BUF DD ? ; points to Hashinitvar 0 00000D28 ???????? SYSI_CDS DD ? ; CDS list 0 00000D2C ???????? SYSI_FCB DD ? ; FCB chain 0 00000D30 ???? SYSI_Keep DW ? ; keep count 0 00000D32 ?? SYSI_NUMIO DB ? ; Number of block devices 0 00000D33 ?? SYSI_NCDS DB ? ; number of CDS's 0 00000D34 ???????? SYSI_DEV DD ? ; device list 0 00000D38 ???? SYSI_ATTR DW ? ; null device attribute word 0 00000D3A ???? SYSI_STRAT DW ? ; null device strategy entry point 0 00000D3C ???? SYSI_INTER DW ? ; null device interrupt entry point 0 00000D3E ???????????????? SYSI_NAME DB 8 DUP(?) ; null device name 0 00000D46 ?? SYSI_SPLICE DB ? ; TRUE -> splicees being done 0 00000D47 ???? SYSI_IBMDOS_SIZE DW ? ; DOS size in paragraphs 0 00000D49 ???????? SYSI_IFS_DOSCALL@ DD ? ; IFS DOS service rountine entry 0 00000D4D ???????? SYSI_IFS DD ? ; IFS header chain 0 00000D51 ???????? SYSI_BUFFERS DW ?,? ; BUFFERS= values (m,n) 0 00000D55 ?? SYSI_BOOT_DRIVE DB ? ; boot drive A=1 B=2,.. 0 00000D56 ?? SYSI_DWMOVE DB ? ; 1 if 386 machine 0 00000D57 ???? SYSI_EXT_MEM DW ? ; Extended memory size in KB. 29 <4> SysInitVars ENDS 30 <4> 31 <4> ;This is added for more information exchage between DOS, BIOS. 32 <4> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86 33 <4> SysInitVars_Ext struc 0 00000D12 ???????? SYSI_InitVars DD ? ; Points to the above structure. 0 00000D16 ???????? SYSI_Country_Tab DD ? ; DOS_Country_cdpg_info 36 <4> SysInitVars_Ext ends 37 <4> 38 <4> ;The SYSI_BUF of SysInitVars points to the follwong structure 39 <4> EMS_MAP_BUFF_SIZE EQU 12 ; EMS map buffer size 40 <4> 41 <4> Buffinfo STRUC 0 00000D12 ???????? Hash_ptr DD ? ; pointer to Hash table 0 00000D16 ???? Hash_count DW ? ; number of Hash entries 0 00000D18 ???????? Cache_ptr DD ? ; pointer to secondary cache 0 00000D1C ???? Cache_count DW ? ; number of secondary cache entries 46 <4> 47 <4> %IF BUFFERFLAG 48 <4> 0 00000D1E ?? EMS_SAFE_FLAG DB ? 0 00000D1F ???????? EMS_LAST_PAGE DW ?, ? 0 00000D23 ???????? EMS_FIRST_PAGE DW ?, ? 0 00000D27 ???? EMS_NPA640 DW ? 53 <4> 54 <4> %ENDIF 55 <4> 0 00000D29 ?? EMS_mode DB ? ; no EMS = -1 0 00000D2A ???? EMS_handle DW ? ; EMS handle for buffers 0 00000D2C ???? EMS_PageFrame_Number DW ? ; EMS page frame number 0 00000D2E ???? EMS_Seg_Cnt DW ? ; EMS segment count 0 00000D30 ???? EMS_Page_Frame DW ? ; EMS page frame segment address 0 00000D32 ???? EMS_reserved DW ? ; EMS segment count 62 <4> 63 <4> %IF BUFFERFLAG 0 00000D34 ?? EMS_Map_Buff DB ? ; map buffer 65 <4> %ELSE 66 <4> EMS_Map_Buff DB 12 dup(?) 67 <4> %ENDIF 68 <4> 69 <4> Buffinfo ENDS 70 <4> 71 <4> 72 <4> 73 <4> 74 <4> 75 <4> 76 <4> 77 <4> 94 <3> 95 <3> %include "vector.mac" 1 <4> ; SCCSID = @(#)vector.asm 1.1 85/04/10 2 <4> BREAK 3 <4> 4 <4> ;Asmvar AltVect 5 <4> %ifndef AltVect 6 <4> %iassign AltVect 0 7 <4> %endif 8 <4> 9 <4> INTTAB EQU 20H 10 <4> inttab equ INTTAB ; NASM port equate 11 <4> INTBASE EQU 4 * inttab 12 <4> ENTRYPOINT EQU INTBASE+40H 13 <4> 14 <4> %IF ALTVECT 15 <4> ALTTAB EQU 0F0H 16 <4> ALTBASE EQU 4 * ALTTAB 17 <4> %ENDIF 18 <4> 19 <4> ; 20 <4> ; interrupt assignments 21 <4> ; 22 <4> %IFN ALTVECT 23 <4> int_abort EQU INTTAB ; abort process 24 <4> int_command EQU int_abort+1 ; call MSDOS 25 <4> int_terminate EQU int_abort+2 ; int to terminate address 26 <4> int_ctrl_c EQU int_abort+3 ; ^c trapper 27 <4> int_fatal_abort EQU int_abort+4 ; hard disk error 28 <4> int_disk_read EQU int_abort+5 ; logical sector disk read 29 <4> int_disk_write EQU int_abort+6 ; logical sector disk write 30 <4> int_keep_process EQU int_abort+7 ; terminate program and stay 31 <4> ; resident 32 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <4> ; C A V E A T P R O G R A M M E R ; 34 <4> ; ; 35 <4> int_spooler EQU int_abort+8 ; spooler call 36 <4> int_fastcon EQU int_abort+9 ; fast CON interrupt 37 <4> int_IBM EQU int_abort+10; critical section maintenance 38 <4> ; ; 39 <4> ; C A V E A T P R O G R A M M E R ; 40 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <4> %ELSE 42 <4> int_abort EQU INTTAB ; abort process 43 <4> int_command EQU int_abort+1 ; call MSDOS 44 <4> int_terminate EQU ALTTAB ; int to terminate address 45 <4> int_ctrl_c EQU int_terminate+1 ; ^c trapper 46 <4> int_fatal_abort EQU int_terminate+2 ; hard disk error 47 <4> int_disk_read EQU int_abort+5 ; logical sector disk read 48 <4> int_disk_write EQU int_abort+6 ; logical sector disk write 49 <4> int_keep_process EQU int_abort+7 ; terminate program and stay resident 50 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 51 <4> ; C A V E A T P R O G R A M M E R ; 52 <4> ; ; 53 <4> int_spooler EQU int_terminate+3 ; spooler call 54 <4> int_fastcon EQU int_abort+9 ; fast CON interrupt 55 <4> ; ; 56 <4> ; C A V E A T P R O G R A M M E R ; 57 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <4> %ENDIF 59 <4> 60 <4> addr_int_abort EQU 4 * int_abort 61 <4> addr_int_command EQU 4 * int_command 62 <4> addr_int_terminate EQU 4 * int_terminate 63 <4> addr_int_ctrl_c EQU 4 * int_ctrl_c 64 <4> addr_int_fatal_abort EQU 4 * int_fatal_abort 65 <4> addr_int_disk_read EQU 4 * int_disk_read 66 <4> addr_int_disk_write EQU 4 * int_disk_write 67 <4> addr_int_keep_process EQU 4 * int_keep_process 68 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 69 <4> ; C A V E A T P R O G R A M M E R ; 70 <4> ; ; 71 <4> addr_int_spooler EQU 4 * int_spooler 72 <4> addr_int_fastcon EQU 4 * int_fastcon 73 <4> addr_int_IBM EQU 4 * int_IBM 74 <4> ; ; 75 <4> ; C A V E A T P R O G R A M M E R ; 76 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 96 <3> 97 <3> %include "mult.mac" 1 <4> ; SCCSID = @(#)mult.asm 1.2 85/04/12 2 <4> Break 3 <4> 4 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <4> ; C A V E A T P R O G R A M M E R ; 6 <4> ; ; 7 <4> ; Critical section definitions 8 <4> ; 9 <4> ; These below are subject to leave-all sections 10 <4> critDisk EQU 1 ; Disk I/O critical section 11 <4> critDevice EQU 2 ; Device I/O critical section 12 <4> critShare EQU 1 ; Sharer I/O critical section 13 <4> critMem EQU 1 ; memory maintenance critical section 14 <4> critNet EQU 5 ; network critical section 15 <4> critSFT EQU 1 ; sft table allocation 16 <4> critIFS EQU 6 ; ifsfunc critical section 17 <4> ; These below are not subject to leave-all sections 18 <4> critASSIGN EQU 8 ; Assign has munged a system call 19 <4> ; ; 20 <4> ; C A V E A T P R O G R A M M E R ; 21 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 22 <4> 23 <4> ; 24 <4> ; The current set of defined multiplex channels is (* means documented): 25 <4> ; 26 <4> ; Channel(h) Issuer Receiver Function 27 <4> ; 00 server PSPRINT print job control 28 <4> ; *01 print/apps PRINT Queueing of files 29 <4> ; 02 BIOS REDIR signal open/close of printers 30 <4> ; 31 <4> ; 05 command REDIR obtain text of net int 24 message 32 <4> ; *06 server/assign ASSIGN Install check 33 <4> ; 34 <4> ; 08 external driver IBMBIO interface to internal routines 35 <4> ; 36 <4> ; 10 sharer/server Sharer install check 37 <4> ; 11 DOS/server Redir install check/redirection funcs 38 <4> ; 12 sharer/redir DOS dos functions and structure maint 39 <4> ; 13 MSNET MSNET movement of NCBs 40 <4> ; 13 external driver IBMBIO Reset_Int_13, allows installation 41 <4> ; of alternative INT_13 drivers after 42 <4> ; boot_up 43 <4> ; 14 (IBM) DOS NLSFUNC down load NLS country info,DOS 3.3 44 <4> ; 14 (MS) APPS POPUP MSDOS 4 popup screen functions 45 <4> ; 15 APPS MSCDEX CD-ROM extensions interface 46 <4> ; 16 WIN386 WIN386 Windows communications 47 <4> ; 17 Clipboard WINDOWS Clipboard interface 48 <4> ; *18 Applications MS-Manger Toggle interface to manager 49 <4> ; 19 Shell 50 <4> ; 1A Ansi.sys 51 <4> ; 1B Fastopen,Vdisk IBMBIO EMS INT 67H stub handler 52 <4> ; 53 <4> ; AC Graphics 54 <4> ; AD NLS (toronto) 55 <4> ; AE 56 <4> ; AF Mode 57 <4> ; B0 GRAFTABL GRAFTABL 58 <4> ; 59 <4> 60 <4> 61 <4> ;MUX 00-3F reserverd for IBM 62 <4> ;MUX 80-BF reserverd for IBM 63 <4> ;MUX 40-7F reserved for Microsoft 64 <4> ;MUX C0-FF users 65 <4> 66 <4> 67 <4> 68 <4> MultSHARE EQU 10h ; sharer 69 <4> ; 1 MFT_enter 70 <4> ; 2 MFTClose 71 <4> ; 3 MFTclU 72 <4> ; 4 MFTCloseP 73 <4> ; 5 MFTCloN 74 <4> ; 6 set_block 75 <4> ; 7 clr_block 76 <4> ; 8 chk_block 77 <4> ; 9 MFT_get 78 <4> ; 10 ShSave 79 <4> ; 11 ShChk 80 <4> ; 12 ShCol 81 <4> ; 13 ShCloseFile 82 <4> 83 <4> MultNET EQU 11h ; Network support 84 <4> MultIFS EQU 11h ; Network support 85 <4> ; 1 IFS_RMDIR 86 <4> ; 2 IFS_SEQ_RMDIR 87 <4> ; 3 IFS_MKDIR 88 <4> ; 4 IFS_SEQ_MKDIR 89 <4> ; 5 IFS_CHDIR 90 <4> ; 6 IFS_CLOSE 91 <4> ; 7 IFS_COMMIT 92 <4> ; 8 IFS_READ 93 <4> ; 9 IFS_WRITE 94 <4> ; 10 IFS_LOCK 95 <4> ; 11 IFS_UNLOCK 96 <4> ; 12 IFS_DISK_INFO 97 <4> ; 13 IFS_SET_FILE_ATTRIBUTE 98 <4> ; 14 IFS_SEQ_SET_FILE_ATTRIBUTE 99 <4> ; 15 IFS_GET_FILE_INFO 100 <4> ; 16 IFS_SEQ_GET_FILE_INFO 101 <4> ; 17 IFS_RENAME 102 <4> ; 18 IFS_SEQ_RENAME 103 <4> ; 19 IFS_DELETE 104 <4> ; 20 IFS_SEQ_DELETE 105 <4> ; 21 IFS_OPEN 106 <4> ; 22 IFS_SEQ_OPEN 107 <4> ; 23 IFS_CREATE 108 <4> ; 24 IFS_SEQ_CREATE 109 <4> ; 25 IFS_SEQ_SEARCH_FIRST 110 <4> ; 26 IFS_SEQ_SEARCH_NEXT 111 <4> ; 27 IFS_SEARCH_FIRST 112 <4> ; 28 IFS_SEARCH_NEXT 113 <4> ; 29 IFS_ABORT 114 <4> ; 30 IFS_ASSOPER 115 <4> ; 31 Printer_SET_STRING 116 <4> ; 32 IFSFlushBuf 117 <4> ; 33 IFSBufWrite 118 <4> ; 34 IFSResetEnvironment 119 <4> ; 35 IFSSpoolCheck 120 <4> ; 36 IFSSpoolClose 121 <4> 122 <4> MultDOS EQU 12h ; DOS call back 123 <4> ; 1 DOS_CLOSE 124 <4> ; 2 RECSET 125 <4> ; 3 Get DOSGROUP 126 <4> ; 4 PATHCHRCMP 127 <4> ; 5 OUT 128 <4> ; 6 NET_I24_ENTRY 129 <4> ; 7 PLACEBUF 130 <4> ; 8 FREE_SFT 131 <4> ; 9 BUFWRITE 132 <4> ; 10 SHARE_VIOLATION 133 <4> ; 11 SHARE_ERROR 134 <4> ; 12 SET_SFT_MODE 135 <4> ; 13 DATE16 136 <4> ; 14 SETVISIT 137 <4> ; 15 SCANPLACE 138 <4> ; 16 SKIPVISIT 139 <4> ; 17 StrCpy 140 <4> ; 18 StrLen 141 <4> ; 19 Ucase 142 <4> ; 20 POINTCOMP 143 <4> ; 21 CHECKFLUSH 144 <4> ; 22 SFFromSFN 145 <4> ; 23 GetCDSFromDrv 146 <4> ; 24 Get_User_Stack 147 <4> ; 25 GetThisDrv 148 <4> ; 26 DriveFromText 149 <4> ; 27 SETYEAR 150 <4> ; 28 DSUM 151 <4> ; 29 DSLIDE 152 <4> ; 30 StrCmp 153 <4> ; 31 initcds 154 <4> ; 32 pjfnfromhandle 155 <4> ; 33 $NameTrans 156 <4> ; 34 CAL_LK 157 <4> ; 35 DEVNAME 158 <4> ; 36 Idle 159 <4> ; 37 DStrLen 160 <4> ; 38 NLS_OPEN DOS 3.3 161 <4> ; 39 $CLOSE DOS 3.3 162 <4> ; 40 NLS_LSEEK DOS 3.3 163 <4> ; 41 $READ DOS 3.3 164 <4> ; 42 FastInit DOS 4.0 165 <4> ; 43 NLS_IOCTL DOS 3.3 166 <4> ; 44 GetDevList DOS 3.3 167 <4> ; 45 NLS_GETEXT DOS 3.3 168 <4> ; 46 MSG_RETRIEVAL DOS 4.0 169 <4> ; 47 FAKE_VERSION DOS 4.0 170 <4> ; 171 <4> NLSFUNC EQU 14h ; NLSFUNC CALL , DOS 3.3 172 <4> ; 0 NLSInstall 173 <4> ; 1 ChgCodePage 174 <4> ; 2 GetExtInfo 175 <4> ; 3 SetCodePage 176 <4> ; 4 GetCntry 177 <4> ; 178 <4> ;FASTOPEN is not chained through INT 2F ; DOS 3.3 F.C. 179 <4> ; it calls Multdos 42 to set up an entry routine address 180 <4> ; 0 Install status (reserved) 181 <4> ; 1 Lookup 182 <4> ; 2 Insert 183 <4> ; 3 Delete 184 <4> ; 4 Purge (reserved) 98 <3> 99 <3> BREAK 100 <3> ; MSDOS partitions the disk into 4 sections: 101 <3> ; 102 <3> ; phys sector 0: +-------------------+ 103 <3> ; | | boot/reserved | 104 <3> ; | +-------------------+ 105 <3> ; | | File allocation | 106 <3> ; v | table(s) | 107 <3> ; | (multiple copies | 108 <3> ; | are kept) | 109 <3> ; +-------------------+ 110 <3> ; | Directory | 111 <3> ; +-------------------+ 112 <3> ; | File space | 113 <3> ; +-------------------+ 114 <3> ; | Unaddressable | 115 <3> ; | (to end of disk) | 116 <3> ; +-------------------+ 117 <3> ; 118 <3> ; All partition boundaries are sector boundaries. The size of the FAT is 119 <3> ; adjusted to maximize the file space addressable. 120 <3> 121 <3> %include "dirent.mac" 1 <4> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 3 <4> Break 4 <4> 5 <4> ; 6 <4> ; +---------------------------+ 7 <4> ; | (12 BYTE) filename/ext | 0 0 8 <4> ; +---------------------------+ 9 <4> ; | (BYTE) attributes | 11 B 10 <4> ; +---------------------------+ 11 <4> ; | (10 BYTE) reserved | 12 C 12 <4> ; +---------------------------+ 13 <4> ; | (WORD) time of last write | 22 16 14 <4> ; +---------------------------+ 15 <4> ; | (WORD) date of last write | 24 18 16 <4> ; +---------------------------+ 17 <4> ; | (WORD) First cluster | 26 1A 18 <4> ; +---------------------------+ 19 <4> ; | (DWORD) file size | 28 1C 20 <4> ; +---------------------------+ 21 <4> ; 22 <4> ; First byte of filename = E5 -> free directory entry 23 <4> ; = 00 -> end of allocated directory 24 <4> ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour 25 <4> ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980 26 <4> ; 27 <4> 28 <4> dir_entry STRUC 29 00000000 <4> dir_name DB 11 DUP (?) ; file name 0 00000D1D ?? dir_attr DB ? ; attribute bits 0 00000D1E ???? dir_codepg dw ? ; code page DOS 4.00 0 00000D20 ???? dir_extcluster dw ? ; extended attribute starting cluster 0 00000D22 ?? dir_attr2 db ? ; reserved 0 00000D23 ?????????? dir_pad DB 5 DUP (?) ; reserved for expansion 0 00000D28 ???? dir_time DW ? ; time of last write 0 00000D2A ???? dir_date DW ? ; date of last write 0 00000D2C ???? dir_first DW ? ; first allocation unit of file 0 00000D2E ???? dir_size_l DW ? ; low 16 bits of file size 0 00000D30 ???? dir_size_h DW ? ; high 16 bits of file size 40 <4> dir_entry ENDS 41 <4> 42 <4> attr_read_only EQU 1h 43 <4> attr_hidden EQU 2h 44 <4> attr_system EQU 4h 45 <4> attr_volume_id EQU 8h 46 <4> attr_directory EQU 10h 47 <4> attr_archive EQU 20h 48 <4> attr_device EQU 40h ; This is a VERY special bit. 49 <4> ; NO directory entry on a disk EVER 50 <4> ; has this bit set. It is set non-zero 51 <4> ; when a device is found by GETPATH 52 <4> 53 <4> attr_all EQU attr_hidden+attr_system+attr_directory 54 <4> ; OR of hard attributes for FINDENTRY 55 <4> 56 <4> attr_ignore EQU attr_read_only+attr_archive+attr_device 57 <4> ; ignore this(ese) attribute(s) during 58 <4> ; search first/next 59 <4> 60 <4> attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive 61 <4> ; changeable via CHMOD 122 <3> 123 <3> BREAK 124 <3> ; 125 <3> ; The File Allocation Table uses a 12-bit entry for each allocation unit on 126 <3> ; the disk. These entries are packed, two for every three bytes. The contents 127 <3> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result 128 <3> ; to the base address of the Allocation Table; 3) fetching the 16-bit word 129 <3> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift 130 <3> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex). Entry 131 <3> ; number zero is used as an end-of-file trap in the OS and is passed to the 132 <3> ; BIOS to help determine disk format. Entry 1 is reserved for future use. 133 <3> ; The first available allocation unit is assigned entry number two, and even 134 <3> ; though it is the first, is called cluster 2. Entries greater than 0FF8H 135 <3> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero 136 <3> ; are unallocated. Otherwise, the contents of a FAT entry is the number of 137 <3> ; the next cluster in the file. 138 <3> ; 139 <3> ; Clusters with bad sectors are tagged with FF7H. Any non-zero number would 140 <3> ; do because these clusters show as allocated, but are not part of any 141 <3> ; allocation chain and thus will never be allocated to a file. A particular 142 <3> ; number is selected so that disk checking programs know what to do (ie. a 143 <3> ; cluster with entry FF7H which is not in a chain is not an error). 144 <3> 145 <3> %include "dpb.mac" 1 <4> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <4> BREAK 4 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <4> ; C A V E A T P R O G R A M M E R ; 6 <4> ; ; 7 <4> dpb STRUC 0 00000D12 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 00000D13 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 00000D14 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 00000D16 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 00000D17 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 00000D18 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 00000D1A ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 00000D1B ???? dpb_root_entries DW ? ; Number of directory entries 0 00000D1D ???? dpb_first_sector DW ? ; First sector of first cluster 0 00000D1F ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 00000D21 ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 00000D23 ???? dpb_dir_sector DW ? ; Starting record of directory 0 00000D25 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 00000D29 ?? dpb_media DB ? ; Media byte 0 00000D2A ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <4> ; check the first time this DPB is used 0 00000D2B ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 00000D2F ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 00000D31 ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <4> dpb ENDS 28 <4> 29 <4> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <4> 31 <4> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <4> ; ; 33 <4> ; C A V E A T P R O G R A M M E R ; 34 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 146 <3> 147 <3> %include "curdir.mac" 1 <4> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 3 <4> BREAK 4 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <4> ; C A V E A T P R O G R A M M E R ; 6 <4> ; ; 7 <4> ; CDS items are used bu the internal routines to store cluster numbers and ; 8 <4> ; network identifiers for each logical name. The ID field is used dually, ; 9 <4> ; both as net ID and for a cluster number for local devices. In the case ; 10 <4> ; of local devices, the cluster number will be -1 if there is a potential ; 11 <4> ; of the disk being changed or if the path must be recracked. The END ; 12 <4> ; field is the location of the end of the definition. No .. is allowed ; 13 <4> ; past this point ; 14 <4> 15 <4> DIRSTRLEN EQU 64+3 ; Max length in bytes of directory strings 16 <4> TEMPLEN EQU DIRSTRLEN*2 17 <4> 18 <4> curdir_list STRUC 19 00000000 <4> curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 0 00000D55 ???? curdir_flags DW ? ; various flags 0 00000D57 ???????? curdir_devptr DD ? ; local pointer to DPB or net device 0 00000D5B ???? curdir_ID DW ? ; cluster of current dir (net ID) 0 00000D5D ???? DW ? 0 00000D5F ???? curdir_user_word DW ? 0 00000D61 ???? curdir_end DW ? ; end of assignment 0 00000D63 ?? curdir_type DB ? ; IFS drive (2=ifs, 4=netuse) 0 00000D64 ???????? curdir_ifs_hdr DD ? ; Ptr to File System Header 0 00000D68 ???? curdir_fsda DB 2 DUP (?) ; File System Dependent Data Area 29 <4> curdir_list ENDS 30 <4> 31 <4> curdirLen EQU curdir_list_struc_size ; Needed for screwed up 32 <4> ; ASM87 which doesn't allow 33 <4> ; Size directive as a macro 34 <4> ; argument 35 <4> labelsize curdir_netID, dword, curdir_ID 36 <4> 37 <4> ;Flag word masks 38 <4> curdir_isnet EQU 1000000000000000B 39 <4> curdir_isifs EQU 1000000000000000B ; DOS 4.00 40 <4> curdir_inuse EQU 0100000000000000B 41 <4> curdir_splice EQU 0010000000000000B 42 <4> curdir_local EQU 0001000000000000B 43 <4> ; ; 44 <4> ; C A V E A T P R O G R A M M E R ; 45 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 148 <3> 149 <3> %include "cpmfcb.mac" 1 <4> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 3 <4> ;BREAK 4 <4> 5 <4> ; 6 <4> ; Field definition for FCBs 7 <4> ; The FCB has the following structure: 8 <4> ; 9 <4> ; +---------------------------+ 10 <4> ; | Drive indicator(byte) | 11 <4> ; +---------------------------+ 12 <4> ; | Filename (8 chars) | 13 <4> ; +---------------------------+ 14 <4> ; | Extension (3 chars) | 15 <4> ; +---------------------------+ 16 <4> ; | Current Extent(word) | 17 <4> ; +---------------------------+ 18 <4> ; | Record size (word) | 19 <4> ; +---------------------------+ 20 <4> ; | File Size (2 words) | 21 <4> ; +---------------------------+ 22 <4> ; | Date of write | 23 <4> ; +---------------------------+ 24 <4> ; | Time of write | 25 <4> ; +---------------------------+ 26 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 27 <4> ; C A V E A T P R O G R A M M E R ; 28 <4> ; ; 29 <4> ; +---------------------------+ 30 <4> ; | 8 bytes reserved | 31 <4> ; +---------------------------+ 32 <4> ; ; 33 <4> ; C A V E A T P R O G R A M M E R ; 34 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 35 <4> ; | next record number | 36 <4> ; +---------------------------+ 37 <4> ; | random record number | 38 <4> ; +---------------------------+ 39 <4> ; 40 <4> 41 <4> sys_fcb STRUC 0 00000D12 ?? fcb_drive DB ? 0 00000D13 ???????????????? fcb_name DB 8 DUP (?) 0 00000D1B ?????? fcb_ext DB 3 DUP (?) 0 00000D1E ???? fcb_EXTENT DW ? 0 00000D20 ???? fcb_RECSIZ DW ? ; Size of record (user settable) 0 00000D22 ???? fcb_FILSIZ DW ? ; Size of file in bytes; used with the 48 <4> ; following word 0 00000D24 ???? fcb_DRVBP DW ? ; BP for SEARCH FIRST and SEARCH NEXT 0 00000D26 ???? fcb_FDATE DW ? ; Date of last writing 0 00000D28 ???? fcb_FTIME DW ? ; Time of last writing 52 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 53 <4> ; C A V E A T P R O G R A M M E R ; 54 <4> ; ; 0 00000D2A ???????????????? fcb_reserved DB 8 DUP (?) ; RESERVED 56 <4> ; ; 57 <4> ; C A V E A T P R O G R A M M E R ; 58 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D32 ?? fcb_NR DB ? ; Next record 0 00000D33 ???????? fcb_RR DB 4 DUP (?) ; Random record 61 <4> sys_fcb ENDS 62 <4> 63 <4> FILDIRENT equ fcb_FILSIZ ; Used only by SEARCH FIRST and SEARCH 64 <4> ; NEXT 65 <4> 66 <4> labelsize fcb_sfn, byte, fcb_reserved 67 <4> 68 <4> ; Note that fcb_net_handle, fcb_nsl_drive, fcb_nsld_drive and fcb_l_drive 69 <4> ; all must point to the same byte. Otherwise, the FCBRegen will fail. 70 <4> ; NOTE about this byte (fcb_nsl_drive) 71 <4> ; The high two bits of this byte are used as follows to indicate the FCB type 72 <4> ; 00 means a local file or device with sharing loaded 73 <4> ; 10 means a remote (network) file 74 <4> ; 01 means a local file with no sharing loaded 75 <4> ; 11 means a local device with no sharing loaded 76 <4> 77 <4> ; 78 <4> ; Network FCB 79 <4> ; 80 <4> labelsize fcb_net_drive, byte, fcb_reserved+1 81 <4> labelsize fcb_net_handle, word, fcb_reserved+2 82 <4> labelsize fcb_netID, dword, fcb_reserved+4 83 <4> 84 <4> ; 85 <4> ; No sharing local file FCB 86 <4> ; 87 <4> labelsize fcb_nsl_drive, byte, fcb_reserved+1 88 <4> labelsize fcb_nsl_bits, byte, fcb_reserved+2 89 <4> labelsize fcb_nsl_firclus, word, fcb_reserved+3 90 <4> labelsize fcb_nsl_dirsec, word, fcb_reserved+5 91 <4> labelsize fcb_nsl_dirpos, byte, fcb_reserved+7 92 <4> 93 <4> ; 94 <4> ; No sharing local device FCB 95 <4> ; 96 <4> labelsize fcb_nsld_drive, byte, fcb_reserved+1 97 <4> labelsize fcb_nsld_drvptr, dword, fcb_reserved+2 98 <4> 99 <4> ; 100 <4> ; Sharing local FCB 101 <4> ; 102 <4> labelsize fcb_l_drive, byte, fcb_reserved+1 103 <4> labelsize fcb_l_firclus, word, fcb_reserved+2 104 <4> labelsize fcb_l_mfs, word, fcb_reserved+4 105 <4> labelsize fcb_l_attr, byte, fcb_reserved+6 106 <4> 107 <4> ; 108 <4> ; Bogusness: the four cases are: 109 <4> ; 110 <4> ; local file 00 111 <4> ; local device 40 112 <4> ; local sharing C0 113 <4> ; network 80 114 <4> ; 115 <4> ; Since sharing and network collide, we cannot use a test instruction for 116 <4> ; deciding whether a network or a share check in involved 117 <4> ; 118 <4> FCBDEVICE EQU 040h 119 <4> FCBNETWORK EQU 080h 120 <4> FCBSHARE EQU 0C0h 121 <4> 122 <4> ; FCBSPECIAL must be able to mask off both net and share 123 <4> FCBSPECIAL EQU 080h 124 <4> FCBMASK EQU 0C0h 150 <3> 151 <3> %include "find.mac" 1 <4> ; SCCSID = @(#)find.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)find.asm 1.1 85/04/10 3 <4> Break 4 <4> 5 <4> find_buf STRUC 6 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 7 <4> ; C A V E A T P R O G R A M M E R ; 8 <4> ; ; 0 00000D12 ?? find_buf_drive DB ? ; drive of search 10 00000001 <4> find_buf_name DB 11 DUP (?) ; formatted name 0 00000D1E ?? find_buf_sattr DB ? ; attribute of search 0 00000D1F ???? find_buf_LastEnt DW ? ; LastEnt 0 00000D21 ???? find_buf_DirStart DW ? ; DirStart 0 00000D23 ???????? find_buf_NetID DB 4 DUP (?) ; Reserved for NET 15 <4> ; ; 16 <4> ; C A V E A T P R O G R A M M E R ; 17 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 18 <4> 0 00000D27 ?? find_buf_attr DB ? ; attribute found 0 00000D28 ???? find_buf_time DW ? ; time 0 00000D2A ???? find_buf_date DW ? ; date 0 00000D2C ???? find_buf_size_l DW ? ; low(size) 0 00000D2E ???? find_buf_size_h DW ? ; high(size) 24 0000001E <4> find_buf_pname DB 13 DUP (?) ; packed name 25 <4> find_buf ENDS 152 <3> 153 <3> %include "pdb.mac" 1 <4> ; SCCSID = @(#)pdb.asm 1.1 85/04/10 2 <4> BREAK 3 <4> 4 <4> ; 5 <4> ; Process data block (otherwise known as program header) 6 <4> ; 7 <4> 8 <4> FilPerProc EQU 20 9 <4> 10 <4> Process_data_block STRUC 0 00000D12 ???? PDB_Exit_Call DW ? ; INT int_abort system terminate 0 00000D14 ???? PDB_block_len DW ? ; size of execution block 0 00000D16 ?? DB ? 0 00000D17 ?????????? PDB_CPM_Call DB 5 DUP (?) ; ancient call to system 0 00000D1C ???????? PDB_Exit DD ? ; pointer to exit routine 0 00000D20 ???????? PDB_Ctrl_C DD ? ; pointer to ^C routine 0 00000D24 ???????? PDB_Fatal_abort DD ? ; pointer to fatal error 18 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 <4> ; C A V E A T P R O G R A M M E R ; 20 <4> ; ; 0 00000D28 ???? PDB_Parent_PID DW ? ; PID of parent (terminate PID) 22 00000018 <4> PDB_JFN_Table DB FilPerProc DUP (?) 23 <4> ; indices into system table 24 <4> ; ; 25 <4> ; C A V E A T P R O G R A M M E R ; 26 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D3E ???? PDB_environ DW ? ; seg addr of environment 28 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 29 <4> ; C A V E A T P R O G R A M M E R ; 30 <4> ; ; 0 00000D40 ???????? PDB_User_stack DD ? ; stack of self during system calls 0 00000D44 ???? PDB_JFN_Length DW ? ; number of handles allowed 0 00000D46 ???????? PDB_JFN_Pointer DD ? ; pointer to JFN table 0 00000D4A ???????? PDB_Next_PDB DD ? ; pointer to nested PDB's 35 0000003C <4> PDB_PAD1 DB 14h DUP (?) 36 <4> ; ; 37 <4> ; C A V E A T P R O G R A M M E R ; 38 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D62 ?????????? PDB_Call_system DB 5 DUP (?) ; portable method of system call 40 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <4> ; C A V E A T P R O G R A M M E R ; 42 <4> ; ; 0 00000D67 ?????????????? PDB_PAD2 DB 7h DUP (?) 44 <4> ; ; 45 <4> ; C A V E A T P R O G R A M M E R ; 46 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 47 <4> Process_data_block ENDS 48 <4> 49 <4> labelsize PDB_InterCon, byte, PDB_PAD1 ; 2/12/KK 50 <4> labelsize PDB_Append, byte, PDB_PAD1+1 ; 2/12/KK 154 <3> 155 <3> %include "exe.mac" 1 <4> ; SCCSID = @(#)exe.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)exe.asm 1.1 85/04/10 3 <4> BREAK 4 <4> ; 5 <4> ; EXEC arg block - load/go program 6 <4> ; 7 <4> 8 <4> ; 9 <4> ; The following get used as arguments to the EXEC system call. They indicate 10 <4> ; whether or not the program is executed or whether or not a program header 11 <4> ; gets created. 12 <4> ; 13 <4> exec_func_no_execute EQU 1 ; no execute bit 14 <4> exec_func_overlay EQU 2 ; overlay bit 15 <4> 16 <4> Exec0 STRUC 0 00000D12 ???? Exec0_environ DW ? ; seg addr of environment 0 00000D14 ???????? Exec0_com_line DD ? ; pointer to asciz command line 0 00000D18 ???????? Exec0_5C_FCB DD ? ; default fcb at 5C 0 00000D1C ???????? Exec0_6C_FCB DD ? ; default fcb at 6C 21 <4> Exec0 ENDS 22 <4> 23 <4> Exec1 STRUC 0 00000D12 ???? Exec1_environ DW ? ; seg addr of environment 0 00000D14 ???????? Exec1_com_line DD ? ; pointer to asciz command line 0 00000D18 ???????? Exec1_5C_FCB DD ? ; default fcb at 5C 0 00000D1C ???????? Exec1_6C_FCB DD ? ; default fcb at 6C 0 00000D20 ???? Exec1_SP DW ? ; stack pointer of program 0 00000D22 ???? Exec1_SS DW ? ; stack seg register of program 0 00000D24 ???? Exec1_IP DW ? ; entry point IP 0 00000D26 ???? Exec1_CS DW ? ; entry point CS 32 <4> Exec1 ENDS 33 <4> 34 <4> Exec3 STRUC 0 00000D12 ???? Exec3_load_addr DW ? ; seg address of load point 0 00000D14 ???? Exec3_reloc_fac DW ? ; relocation factor 37 <4> Exec3 ENDS 38 <4> 39 <4> ; 40 <4> ; Exit codes in upper byte 41 <4> ; 42 <4> Exit_terminate EQU 0 43 <4> Exit_abort EQU 0 44 <4> Exit_Ctrl_C EQU 1 45 <4> Exit_Hard_Error EQU 2 46 <4> Exit_Keep_process EQU 3 47 <4> 48 <4> ; 49 <4> ; EXE file header 50 <4> ; 51 <4> 52 <4> EXE_file STRUC 0 00000D12 ???? exe_signature DW ? ; must contain 4D5A (yay zibo!) 0 00000D14 ???? exe_len_mod_512 DW ? ; low 9 bits of length 0 00000D16 ???? exe_pages DW ? ; number of 512b pages in file 0 00000D18 ???? exe_rle_count DW ? ; count of reloc entries 0 00000D1A ???? exe_par_dir DW ? ; number of paragraphs before image 0 00000D1C ???? exe_min_BSS DW ? ; minimum number of para of BSS 0 00000D1E ???? exe_max_BSS DW ? ; max number of para of BSS 0 00000D20 ???? exe_SS DW ? ; stack of image 0 00000D22 ???? exe_SP DW ? ; SP of image 0 00000D24 ???? exe_chksum DW ? ; checksum of file (ignored) 0 00000D26 ???? exe_IP DW ? ; IP of entry 0 00000D28 ???? exe_CS DW ? ; CS of entry 0 00000D2A ???? exe_rle_table DW ? ; byte offset of reloc table 0 00000D2C ???? exe_iov DW ? ; overlay number (0 for root) 0 00000D2E ???????? exe_sym_tab DD ? ; offset of symbol table in file 68 <4> EXE_file ENDS 69 <4> 70 <4> exe_valid_signature EQU 5A4Dh 71 <4> exe_valid_old_signature EQU 4D5Ah 72 <4> 73 <4> symbol_entry STRUC 0 00000D12 ???????? sym_value DD ? 0 00000D16 ???? sym_type DW ? 0 00000D18 ?? sym_len DB ? 77 00000007 <4> sym_name DB 255 dup (?) 78 <4> symbol_entry ENDS 156 <3> 157 <3> %include "sf.mac" 1 <4> ; SCCSID = @(#)sf.asm 1.1 85/04/10 2 <4> BREAK 3 <4> ; 4 <4> ; AN000 version 4.00 Jan. 1988 5 <4> ; AN003 PTM 3680 -- make NAME offset the same as before (<=3.30) 6 <4> ; AN009 PTM 3839 reorder SFT for MS WINDOWS 7 <4> 8 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 9 <4> ; C A V E A T P R O G R A M M E R ; 10 <4> ; ; 11 <4> ; 12 <4> ; system file table 13 <4> ; 14 <4> 15 <4> SF STRUC 0 00000D12 ???????? SFLink DD ? 0 00000D16 ???? SFCount DW ? ; number of entries 0 00000D18 ???? SFTable DW ? ; beginning of array of the following 19 <4> SF ENDS 20 <4> 21 <4> ; 22 <4> ; system file table entry 23 <4> ; 24 <4> 25 <4> sf_entry STRUC 0 00000D12 ???? sf_ref_count DW ? ; number of processes sharing entry 27 <4> ; if FCB then ref count 0 00000D14 ???? sf_mode DW ? ; mode of access or high bit on if FCB 0 00000D16 ?? sf_attr DB ? ; attribute of file 0 00000D17 ???? sf_flags DW ? ;Bits 8-15 31 <4> ; Bit 15 = 1 if remote file 32 <4> ; = 0 if local file or device 33 <4> ; Bit 14 = 1 if date/time is not to be 34 <4> ; set from clock at CLOSE. Set by 35 <4> ; FILETIMES and FCB_CLOSE. Reset by 36 <4> ; other reseters of the dirty bit 37 <4> ; (WRITE) 38 <4> ; Bit 13 = Pipe bit (reserved) 39 <4> ; 40 <4> ; Bits 0-7 (old FCB_devid bits) 41 <4> ; If remote file or local file, bit 42 <4> ; 6=0 if dirty Device ID number, bits 43 <4> ; 0-5 if local file. 44 <4> ; bit 7=0 for local file, bit 7 45 <4> ; =1 for local I/O device 46 <4> ; If local I/O device, bit 6=0 if EOF (input) 47 <4> ; Bit 5=1 if Raw mode 48 <4> ; Bit 0=1 if console input device 49 <4> ; Bit 1=1 if console output device 50 <4> ; Bit 2=1 if null device 51 <4> ; Bit 3=1 if clock device 0 00000D19 ???????? sf_devptr DD ? ; Points to DPB if local file, points 53 <4> ; to device header if local device, 54 <4> ; points to net device header if 55 <4> ; remote 0 00000D1D ???? sf_firclus DW ? ; First cluster of file (bit 15 = 0) 0 00000D1F ???? sf_time DW ? ; Time associated with file 0 00000D21 ???? sf_date DW ? ; Date associated with file 0 00000D23 ???????? sf_size DD ? ; Size associated with file 0 00000D27 ???????? sf_position DD ? ; Read/Write pointer or LRU count for FCBs 61 <4> ; 62 <4> ; Starting here, the next 7 bytes may be used by the file system to store an 63 <4> ; ID 64 <4> ; 0 00000D2B ???? sf_cluspos DW ? ; Position of last cluster accessed 0 00000D2D ???????? sf_dirsec DD ? ; Sector number of directory sector for 67 <4> ; for this file 0 00000D31 ?? sf_dirpos DB ? ; Offset of this entry in the above 69 <4> ; 70 <4> ; End of 7 bytes of file-system specific info. 71 <4> ; 72 00000020 <4> sf_name DB 11 DUP (?) ; 11 character name that is in the 73 <4> ; directory entry. This is used by 74 <4> ; close to detect file deleted and 75 <4> ; disk changed errors. 76 <4> 77 <4> ; SHARING INFO 0 00000D3D ???????? sf_chain DD ? ; link to next SF 0 00000D41 ???? sf_UID DW ? 0 00000D43 ???? sf_PID DW ? 0 00000D45 ???? sf_MFT DW ? 0 00000D47 ???? sf_lstclus DW ? ;AN009; Last cluster accessed 0 00000D49 ???????? sf_IFS_HDR DD ? 84 <4> sf_entry ENDS 85 <4> 86 <4> labelsize sf_fsda, byte, sf_cluspos ;DOS 4.00 87 <4> labelsize sf_serial_ID, word, sf_firclus ;DOS 4.00 88 <4> labelsize sf_netid, byte, sf_cluspos 89 <4> labelsize sf_OpenAge, word, sf_position+2 90 <4> labelsize sf_LRU, word, sf_position 91 <4> 92 <4> sf_default_number EQU 5h 93 <4> 94 <4> ; 95 <4> ; Note that we need to mark an SFT as being busy for OPEN/CREATE. This is 96 <4> ; because an INT 24 may prevent us from 'freeing' it. We mark this as such 97 <4> ; by placing a -1 in the ref_count field. 98 <4> ; 99 <4> 100 <4> sf_busy EQU -1 101 <4> 102 <4> 103 <4> ; mode mask for FCB detection 104 <4> sf_isfcb EQU 1000000000000000B 105 <4> 106 <4> ; Flag word masks 107 <4> sf_isnet EQU 1000000000000000B 108 <4> sf_close_nodate EQU 0100000000000000B 109 <4> sf_pipe EQU 0010000000000000B 110 <4> sf_no_inherit EQU 0001000000000000B 111 <4> sf_net_spool EQU 0000100000000000B 112 <4> Handle_Fail_I24 EQU 0000000100000000B ;BIT 8 - DISK FULL I24 ERROR 113 <4> 114 <4> ; Local file/device flag masks 115 <4> devid_file_clean EQU 40h ; true if file and not written 116 <4> devid_file_mask_drive EQU 3Fh ; mask for drive number 117 <4> 118 <4> devid_device EQU 80h ; true if a device 119 <4> devid_device_EOF EQU 40h ; true if end of file reached 120 <4> devid_device_raw EQU 20h ; true if in raw mode 121 <4> devid_device_special EQU 10h ; true if special device 122 <4> devid_device_clock EQU 08h ; true if clock device 123 <4> devid_device_null EQU 04h ; true if null device 124 <4> devid_device_con_out EQU 02h ; true if console output 125 <4> devid_device_con_in EQU 01h ; true if consle input 126 <4> ; ; 127 <4> ; C A V E A T P R O G R A M M E R ; 128 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 129 <4> 130 <4> ; 131 <4> ; structure of devid field as returned by IOCTL is: 132 <4> ; 133 <4> ; BIT 7 6 5 4 3 2 1 0 134 <4> ; |---|---|---|---|---|---|---|---| 135 <4> ; | I | E | R | S | I | I | I | I | 136 <4> ; | S | O | A | P | S | S | S | S | 137 <4> ; | D | F | W | E | C | N | C | C | 138 <4> ; | E | | | C | L | U | O | I | 139 <4> ; | V | | | L | K | L | T | N | 140 <4> ; |---|---|---|---|---|---|---|---| 141 <4> ; ISDEV = 1 if this channel is a device 142 <4> ; = 0 if this channel is a disk file 143 <4> ; 144 <4> ; If ISDEV = 1 145 <4> ; 146 <4> ; EOF = 0 if End Of File on input 147 <4> ; RAW = 1 if this device is in Raw mode 148 <4> ; = 0 if this device is cooked 149 <4> ; ISCLK = 1 if this device is the clock device 150 <4> ; ISNUL = 1 if this device is the null device 151 <4> ; ISCOT = 1 if this device is the console output 152 <4> ; ISCIN = 1 if this device is the console input 153 <4> ; 154 <4> ; If ISDEV = 0 155 <4> ; EOF = 0 if channel has been written 156 <4> ; Bits 0-5 are the block device number for 157 <4> ; the channel (0 = A, 1 = B, ...) 158 <4> ; 159 <4> devid_ISDEV EQU 80h 160 <4> devid_EOF EQU 40h 161 <4> devid_RAW EQU 20h 162 <4> devid_SPECIAL EQU 10H 163 <4> devid_ISCLK EQU 08h 164 <4> devid_ISNUL EQU 04h 165 <4> devid_ISCOT EQU 02h 166 <4> devid_ISCIN EQU 01h 167 <4> 168 <4> devid_block_dev EQU 1Fh ; mask for block device number 158 <3> 159 <3> %include "arena.mac" 1 <4> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <4> ;BREAK 3 <4> 4 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <4> ; C A V E A T P R O G R A M M E R ; 6 <4> ; ; 7 <4> ; 8 <4> ; arena item 9 <4> ; 10 <4> arena STRUC 0 00000D12 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00000D13 ???? arena_owner DW ? ; owner of arena item 0 00000D15 ???? arena_size DW ? ; size in paragraphs of item 0 00000D17 ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00000D1A ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <4> arena ENDS 17 <4> 18 <4> ; 19 <4> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <4> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <4> ; them and change ALLOC.ASM. 22 <4> 23 <4> arena_owner_system EQU 0 ; free block indication 24 <4> 25 <4> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <4> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <4> ; ; 28 <4> ; C A V E A T P R O G R A M M E R ; 29 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <4> 160 <3> 161 <3> %include "intnat.mac" 1 <4> ; SCCSID = @(#)intnat.asm 1.1 85/04/10 2 <4> BREAK 3 <4> 4 <4> ; 5 <4> ; Current structure of the data returned by the international call 6 <4> ; 7 <4> internat_block STRUC 0 00000D12 ???? Date_tim_format DW ? ; 0-USA, 1-EUR, 2-JAP 0 00000D14 ?? Currency_sym DB ? ; Currency Symbol 5 bytes 0 00000D15 ?? DB ? 0 00000D16 ?? DB ? 0 00000D17 ?? DB ? 0 00000D18 ?? DB ? 0 00000D19 ?? Thous_sep DB ? ; Thousands separator 2 bytes 0 00000D1A ?? DB ? 0 00000D1B ?? Decimal_sep DB ? ; Decimal separator 2 bytes 0 00000D1C ?? DB ? 0 00000D1D ?? Date_sep DB ? ; Date separator 2 bytes 0 00000D1E ?? DB ? 0 00000D1F ?? Time_sep DB ? ; Decimal separator 2 bytes 0 00000D20 ?? DB ? 0 00000D21 ?? Bit_field DB ? ; Bit values 23 <4> ; Bit 0 = 0 if currency symbol first 24 <4> ; = 1 if currency symbol last 25 <4> ; Bit 1 = 0 if No space after currency symbol 26 <4> ; = 1 if space after currency symbol 0 00000D22 ?? Currency_cents DB ? ; Number of places after currency dec point 0 00000D23 ?? Time_24 DB ? ; 1 if 24 hour time, 0 if 12 hour time 0 00000D24 ???? Map_call DW ? ; Address of case mapping call (DWORD) 0 00000D26 ???? DW ? ; THIS IS TWO WORDS SO IT CAN BE INITIALIZED 31 <4> ; in pieces. 0 00000D28 ?? Data_sep DB ? ; Data list separator character 0 00000D29 ?? DB ? 34 <4> internat_block ENDS 35 <4> 36 <4> ; 37 <4> ; Max size of the block returned by the INTERNATIONAL call 38 <4> ; 39 <4> internat_block_max EQU 32 162 <3> 163 <3> %include "mi.mac" 1 <4> ; SCCSID = @(#)mi.asm 1.1 85/04/10 2 <4> BREAK 3 <4> 4 <4> mi_INT EQU 0CDh 5 <4> mi_Long_JMP EQU 0EAh 6 <4> mi_Long_CALL EQU 09Ah 7 <4> mi_Long_RET EQU 0CBh 8 <4> mi_Near_RET EQU 0C3h 9 <4> 10 <4> ; xxxxoditszxaxpxc 11 <4> f_Overflow EQU 0000100000000000B 12 <4> f_Direction EQU 0000010000000000B 13 <4> f_Interrupt EQU 0000001000000000B 14 <4> f_Trace EQU 0000000100000000B 15 <4> f_Sign EQU 0000000010000000B 16 <4> f_Zero EQU 0000000001000000B 17 <4> f_Aux EQU 0000000000010000B 18 <4> f_Parity EQU 0000000000000100B 19 <4> f_Carry EQU 0000000000000001B 164 <3> 165 <3> fChk equ 1 166 <3> fDelim equ 2 167 <3> fSpChk equ 4 168 <3> fFCB equ 8 169 <3> 170 <3> %include "filemode.mac" 1 <4> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 3 <4> BREAK 4 <4> 5 <4> stdin EQU 0 6 <4> stdout EQU 1 7 <4> stderr EQU 2 8 <4> stdaux EQU 3 9 <4> stdprn EQU 4 10 <4> 11 <4> BREAK 12 <4> 13 <4> access_mask EQU 0FH 14 <4> open_for_read EQU 00h 15 <4> open_for_write EQU 01h 16 <4> open_for_both EQU 02h 17 <4> 18 <4> sharing_mask EQU 0F0H 19 <4> sharing_compat EQU 000H 20 <4> sharing_deny_both EQU 010H 21 <4> sharing_deny_write EQU 020H 22 <4> sharing_deny_read EQU 030H 23 <4> sharing_deny_none EQU 040H 24 <4> sharing_net_FCB EQU 070h 25 <4> sharing_no_inherit EQU 080H 26 <4> 27 <4> BREAK 28 <4> 29 <4> no_code_page_check EQU 0100H 30 <4> int_24_error EQU 2000H 31 <4> auto_commit_write EQU 4000H 32 <4> ext_open_on EQU 01H 33 <4> ext_file_not_exists EQU 04H 34 <4> ext_open_I24_off EQU 02H 35 <4> io_mode_id EQU 00000010B 36 <4> reserved_bits_mask EQU 0FE00H 37 <4> exists_mask EQU 0FH 38 <4> not_exists_mask EQU 0F0H 39 <4> action_opened EQU 01H 40 <4> action_created_opened EQU 02H 41 <4> action_replaced_opened EQU 03H 42 <4> 43 <4> ext_exists_open EQU 01H 44 <4> ext_exists_fail EQU 0H 45 <4> ext_nexists_create EQU 10H 46 <4> 47 <4> 48 <4> 49 <4> ext_open_parm struc 0 00000D12 ???????? ext_set_list dd ? 0 00000D16 ???? ext_num_of_parm dw ? 52 <4> ext_open_parm ends 53 <4> 54 <4> 55 <4> 171 <3> 172 <3> %include "error.mac" 1 <4> ; SCCSID = @(#)error.asm 1.1 85/04/10 2 <4> ; SCCSID = @(#)error.asm 1.1 85/04/10 3 <4> BREAK 4 <4> 5 <4> ; 6 <4> ; XENIX calls all return error codes through AX. If an error occurred then 7 <4> ; the carry bit will be set and the error code is in AX. If no error occurred 8 <4> ; then the carry bit is reset and AX contains returned info. 9 <4> ; 10 <4> ; Since the set of error codes is being extended as we extend the operating 11 <4> ; system, we have provided a means for applications to ask the system for a 12 <4> ; recommended course of action when they receive an error. 13 <4> ; 14 <4> ; The GetExtendedError system call returns a universal error, an error 15 <4> ; location and a recommended course of action. The universal error code is 16 <4> ; a symptom of the error REGARDLESS of the context in which GetExtendedError 17 <4> ; is issued. 18 <4> ; 19 <4> 20 <4> ; 21 <4> ; These are the 2.0 error codes 22 <4> ; 23 <4> error_invalid_function EQU 1 24 <4> error_file_not_found EQU 2 25 <4> error_path_not_found EQU 3 26 <4> error_too_many_open_files EQU 4 27 <4> error_access_denied EQU 5 28 <4> error_invalid_handle EQU 6 29 <4> error_arena_trashed EQU 7 30 <4> error_not_enough_memory EQU 8 31 <4> error_invalid_block EQU 9 32 <4> error_bad_environment EQU 10 33 <4> error_bad_format EQU 11 34 <4> error_invalid_access EQU 12 35 <4> error_invalid_data EQU 13 36 <4> ;**** reserved EQU 14 ; ***** 37 <4> error_invalid_drive EQU 15 38 <4> error_current_directory EQU 16 39 <4> error_not_same_device EQU 17 40 <4> error_no_more_files EQU 18 41 <4> ; 42 <4> ; These are the universal int 24 mappings for the old INT 24 set of errors 43 <4> ; 44 <4> error_write_protect EQU 19 45 <4> error_bad_unit EQU 20 46 <4> error_not_ready EQU 21 47 <4> error_bad_command EQU 22 48 <4> error_CRC EQU 23 49 <4> error_bad_length EQU 24 50 <4> error_Seek EQU 25 51 <4> error_not_DOS_disk EQU 26 52 <4> error_sector_not_found EQU 27 53 <4> error_out_of_paper EQU 28 54 <4> error_write_fault EQU 29 55 <4> error_read_fault EQU 30 56 <4> error_gen_failure EQU 31 57 <4> ; 58 <4> ; These are the new 3.0 error codes reported through INT 24 59 <4> ; 60 <4> error_sharing_violation EQU 32 61 <4> error_lock_violation EQU 33 62 <4> error_wrong_disk EQU 34 63 <4> error_FCB_unavailable EQU 35 64 <4> error_sharing_buffer_exceeded EQU 36 65 <4> error_Code_Page_Mismatched EQU 37 ; DOS 4.00 ;AN000; 66 <4> error_handle_EOF EQU 38 ; DOS 4.00 ;AN000; 67 <4> error_handle_Disk_Full EQU 39 ; DOS 4.00 ;AN000; 68 <4> ; 69 <4> ; New OEM network-related errors are 50-79 70 <4> ; 71 <4> error_not_supported EQU 50 72 <4> ; 73 <4> ; End of INT 24 reportable errors 74 <4> ; 75 <4> error_file_exists EQU 80 76 <4> error_DUP_FCB EQU 81 ; ***** 77 <4> error_cannot_make EQU 82 78 <4> error_FAIL_I24 EQU 83 79 <4> ; 80 <4> ; New 3.0 network related error codes 81 <4> ; 82 <4> error_out_of_structures EQU 84 83 <4> error_Already_assigned EQU 85 84 <4> error_invalid_password EQU 86 85 <4> error_invalid_parameter EQU 87 86 <4> error_NET_write_fault EQU 88 87 <4> error_sys_comp_not_loaded EQU 90 ; DOS 4.00 ;AN000; 88 <4> 89 <4> BREAK 90 <4> 91 <4> error_I24_write_protect EQU 0 92 <4> error_I24_bad_unit EQU 1 93 <4> error_I24_not_ready EQU 2 94 <4> error_I24_bad_command EQU 3 95 <4> error_I24_CRC EQU 4 96 <4> error_I24_bad_length EQU 5 97 <4> error_I24_Seek EQU 6 98 <4> error_I24_not_DOS_disk EQU 7 99 <4> error_I24_sector_not_found EQU 8 100 <4> error_I24_out_of_paper EQU 9 101 <4> error_I24_write_fault EQU 0Ah 102 <4> error_I24_read_fault EQU 0Bh 103 <4> error_I24_gen_failure EQU 0Ch 104 <4> ; NOTE: Code 0DH is used by MT-DOS. 105 <4> error_I24_wrong_disk EQU 0Fh 106 <4> 107 <4> ; THE FOLLOWING ARE MASKS FOR THE AH REGISTER ON Int 24 108 <4> 109 <4> Allowed_FAIL EQU 00001000B 110 <4> Allowed_RETRY EQU 00010000B 111 <4> Allowed_IGNORE EQU 00100000B 112 <4> ;NOTE: ABORT is ALWAYS allowed 113 <4> 114 <4> I24_operation EQU 00000001B ;Z if READ,NZ if Write 115 <4> I24_area EQU 00000110B ; 00 if DOS 116 <4> ; 01 if FAT 117 <4> ; 10 if root DIR 118 <4> ; 11 if DATA 119 <4> I24_class EQU 10000000B ;Z if DISK, NZ if FAT or char 120 <4> 121 <4> BREAK 122 <4> 123 <4> ; Values for error CLASS 124 <4> 125 <4> errCLASS_OutRes EQU 1 ; Out of Resource 126 <4> errCLASS_TempSit EQU 2 ; Temporary Situation 127 <4> errCLASS_Auth EQU 3 ; Permission problem 128 <4> errCLASS_Intrn EQU 4 ; Internal System Error 129 <4> errCLASS_HrdFail EQU 5 ; Hardware Failure 130 <4> errCLASS_SysFail EQU 6 ; System Failure 131 <4> errCLASS_Apperr EQU 7 ; Application Error 132 <4> errCLASS_NotFnd EQU 8 ; Not Found 133 <4> errCLASS_BadFmt EQU 9 ; Bad Format 134 <4> errCLASS_Locked EQU 10 ; Locked 135 <4> errCLASS_Media EQU 11 ; Media Failure 136 <4> errCLASS_Already EQU 12 ; Collision with Existing Item 137 <4> errCLASS_Unk EQU 13 ; Unknown/other 138 <4> 139 <4> ; Values for error ACTION 140 <4> 141 <4> errACT_Retry EQU 1 ; Retry 142 <4> errACT_DlyRet EQU 2 ; Delay Retry, retry after pause 143 <4> errACT_User EQU 3 ; Ask user to regive info 144 <4> errACT_Abort EQU 4 ; abort with clean up 145 <4> errACT_Panic EQU 5 ; abort immediately 146 <4> errACT_Ignore EQU 6 ; ignore 147 <4> errACT_IntRet EQU 7 ; Retry after User Intervention 148 <4> 149 <4> ; Values for error LOCUS 150 <4> 151 <4> errLOC_Unk EQU 1 ; No appropriate value 152 <4> errLOC_Disk EQU 2 ; Random Access Mass Storage 153 <4> errLOC_Net EQU 3 ; Network 154 <4> errLOC_SerDev EQU 4 ; Serial Device 155 <4> errLOC_Mem EQU 5 ; Memory 173 <3> 174 <3> %include "syscall.mac" 1 <4> ; SCCSID = @(#)syscall.asm 1.1 85/04/10 2 <4> ;BREAK 3 <4> ;SUBTTL system call definitions 4 <4> ;PAGE 5 <4> 6 <4> Abort EQU 0 ; 0 0 7 <4> Std_Con_Input EQU 1 ; 1 1 8 <4> Std_Con_Output EQU 2 ; 2 2 9 <4> Std_Aux_Input EQU 3 ; 3 3 10 <4> Std_Aux_Output EQU 4 ; 4 4 11 <4> Std_Printer_Output EQU 5 ; 5 5 12 <4> Raw_Con_IO EQU 6 ; 6 6 13 <4> Raw_Con_Input EQU 7 ; 7 7 14 <4> Std_Con_Input_No_Echo EQU 8 ; 8 8 15 <4> Std_Con_String_Output EQU 9 ; 9 9 16 <4> Std_Con_String_Input EQU 10 ; 10 A 17 <4> Std_Con_Input_Status EQU 11 ; 11 B 18 <4> Std_Con_Input_Flush EQU 12 ; 12 C 19 <4> Disk_Reset EQU 13 ; 13 D 20 <4> Set_Default_Drive EQU 14 ; 14 E 21 <4> FCB_Open EQU 15 ; 15 F 22 <4> FCB_Close EQU 16 ; 16 10 23 <4> Dir_Search_First EQU 17 ; 17 11 24 <4> Dir_Search_Next EQU 18 ; 18 12 25 <4> FCB_Delete EQU 19 ; 19 13 26 <4> FCB_Seq_Read EQU 20 ; 20 14 27 <4> FCB_Seq_Write EQU 21 ; 21 15 28 <4> FCB_Create EQU 22 ; 22 16 29 <4> FCB_Rename EQU 23 ; 23 17 30 <4> Get_Default_Drive EQU 25 ; 25 19 31 <4> Set_DMA EQU 26 ; 26 1A 32 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <4> ; C A V E A T P R O G R A M M E R ; 34 <4> ; ; 35 <4> Get_Default_DPB EQU 31 ; 31 1F 36 <4> ; ; 37 <4> ; C A V E A T P R O G R A M M E R ; 38 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 39 <4> FCB_Random_Read EQU 33 ; 33 21 40 <4> FCB_Random_Write EQU 34 ; 34 22 41 <4> Get_FCB_File_Length EQU 35 ; 35 23 42 <4> Get_FCB_Position EQU 36 ; 36 24 43 <4> Set_Interrupt_Vector EQU 37 ; 37 25 44 <4> Create_Process_Data_Block EQU 38 ; 38 26 45 <4> FCB_Random_Read_Block EQU 39 ; 39 27 46 <4> FCB_Random_Write_Block EQU 40 ; 40 28 47 <4> Parse_File_Descriptor EQU 41 ; 41 29 48 <4> Get_Date EQU 42 ; 42 2A 49 <4> Set_Date EQU 43 ; 43 2B 50 <4> Get_Time EQU 44 ; 44 2C 51 <4> Set_Time EQU 45 ; 45 2D 52 <4> Set_Verify_On_Write EQU 46 ; 46 2E 53 <4> ; Extended functionality group 54 <4> Get_DMA EQU 47 ; 47 2F 55 <4> Get_Version EQU 48 ; 48 30 56 <4> Keep_Process EQU 49 ; 49 31 57 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <4> ; C A V E A T P R O G R A M M E R ; 59 <4> ; ; 60 <4> Get_DPB EQU 50 ; 50 32 61 <4> ; ; 62 <4> ; C A V E A T P R O G R A M M E R ; 63 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 64 <4> Set_CTRL_C_Trapping EQU 51 ; 51 33 65 <4> Get_InDOS_Flag EQU 52 ; 52 34 66 <4> Get_Interrupt_Vector EQU 53 ; 53 35 67 <4> Get_Drive_Freespace EQU 54 ; 54 36 68 <4> Char_Oper EQU 55 ; 55 37 69 <4> International EQU 56 ; 56 38 70 <4> ; Directory Group 71 <4> MKDir EQU 57 ; 57 39 72 <4> RMDir EQU 58 ; 58 3A 73 <4> CHDir EQU 59 ; 59 3B 74 <4> ; File Group 75 <4> Creat EQU 60 ; 60 3C 76 <4> Open EQU 61 ; 61 3D 77 <4> Close EQU 62 ; 62 3E 78 <4> Read EQU 63 ; 63 3F 79 <4> Write EQU 64 ; 64 40 80 <4> Unlink EQU 65 ; 65 41 81 <4> LSeek EQU 66 ; 66 42 82 <4> CHMod EQU 67 ; 67 43 83 <4> IOCtl EQU 68 ; 68 44 84 <4> XDup EQU 69 ; 69 45 85 <4> XDup2 EQU 70 ; 70 46 86 <4> Current_Dir EQU 71 ; 71 47 87 <4> ; Memory Group 88 <4> Alloc EQU 72 ; 72 48 89 <4> Dealloc EQU 73 ; 73 49 90 <4> Setblock EQU 74 ; 74 4A 91 <4> ; Process Group 92 <4> Exec EQU 75 ; 75 4B 93 <4> Exit EQU 76 ; 76 4C 94 <4> WaitProcess EQU 77 ; 77 4D 95 <4> Find_First EQU 78 ; 78 4E 96 <4> ; Special Group 97 <4> Find_Next EQU 79 ; 79 4F 98 <4> ; SPECIAL SYSTEM GROUP 99 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 100 <4> ; C A V E A T P R O G R A M M E R ; 101 <4> ; ; 102 <4> Set_Current_PDB EQU 80 ; 80 50 103 <4> Get_Current_PDB EQU 81 ; 81 51 104 <4> Get_In_Vars EQU 82 ; 82 52 105 <4> SetDPB EQU 83 ; 83 53 106 <4> ; ; 107 <4> ; C A V E A T P R O G R A M M E R ; 108 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 109 <4> Get_Verify_On_Write EQU 84 ; 84 54 110 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 111 <4> ; C A V E A T P R O G R A M M E R ; 112 <4> ; ; 113 <4> Dup_PDB EQU 85 ; 85 55 114 <4> ; ; 115 <4> ; C A V E A T P R O G R A M M E R ; 116 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 117 <4> Rename EQU 86 ; 86 56 118 <4> File_Times EQU 87 ; 87 57 119 <4> AllocOper EQU 88 ; 88 58 120 <4> ; Network extention system calls 121 <4> GetExtendedError EQU 89 ; 89 59 122 <4> CreateTempFile EQU 90 ; 90 5A 123 <4> CreateNewFile EQU 91 ; 91 5B 124 <4> LockOper EQU 92 ; 92 5C Lock and Unlock 125 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 126 <4> ; C A V E A T P R O G R A M M E R ; 127 <4> ; ; 128 <4> ServerCall EQU 93 ; 93 5D CommitAll, ServerDOSCall, 129 <4> ; CloseByName, CloseUser, 130 <4> ; CloseUserProcess, 131 <4> ; GetOpenFileList 132 <4> ; ; 133 <4> ; C A V E A T P R O G R A M M E R ; 134 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 135 <4> UserOper EQU 94 ; 94 5E Get and Set 136 <4> AssignOper EQU 95 ; 95 5F On, Off, Get, Set, Cancel 137 <4> xNameTrans EQU 96 ; 96 60 138 <4> PathParse EQU 97 ; 97 61 139 <4> GetCurrentPSP EQU 98 ; 98 62 140 <4> Hongeul EQU 99 ; 99 63 141 <4> ECS_CALL EQU 99 ; 99 63 ;; DBCS support 142 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 143 <4> ; C A V E A T P R O G R A M M E R ; 144 <4> ; ; 145 <4> Set_Printer_Flag EQU 100 ; 100 64 146 <4> ; ; 147 <4> ; C A V E A T P R O G R A M M E R ; 148 <4> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 149 <4> GetExtCntry EQU 101 ; 101 65 150 <4> GetSetCdPg EQU 102 ; 102 66 151 <4> ExtHandle EQU 103 ; 103 67 152 <4> Commit EQU 104 ; 104 68 153 <4> GetSetMediaID EQU 105 ; 105 69 154 <4> IFS_IOCTL EQU 107 ; 107 6B 155 <4> ExtOpen EQU 108 ; 108 6C 156 <4> ; 157 <4> ; 158 <4> Set_Oem_Handler EQU 248 ; 248 F8 159 <4> OEM_C1 EQU 249 ; 249 F9 160 <4> OEM_C2 EQU 250 ; 250 FA 161 <4> OEM_C3 EQU 251 ; 251 FB 162 <4> OEM_C4 EQU 252 ; 252 FC 163 <4> OEM_C5 EQU 253 ; 253 FD 164 <4> OEM_C6 EQU 254 ; 254 FE 165 <4> OEM_C7 EQU 255 ; 255 FF 175 <3> 176 <3> ;SUBTTL 177 <3> 124 <2> %include "devsym.mac" 1 <3> %warning out: DEVSYM.INC... 1 ****************** <3> warning: out: DEVSYM.INC... [-w+user] 2 <3> ; SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04 3 <3> ; SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04 4 <3> 5 <3> ; THE DEVICE TABLE LIST HAS THE FORM: 6 <3> SYSDEV STRUC 0 00000D12 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 00000D16 ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 00000D18 ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 00000D1A ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 00000D1C ???????????????? SDEVNAME DB 8 DUP (?) ;NAME OF DEVICE (ONLY FIRST BYTE USED FOR BLOCK) 12 <3> SYSDEV ENDS 13 <3> 14 <3> ; 15 <3> ; ATTRIBUTE BIT MASKS 16 <3> ; 17 <3> ; CHARACTER DEVICES: 18 <3> ; 19 <3> ; BIT 15 -> MUST BE 1 20 <3> ; 14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS 21 <3> ; 13 -> 1 IF THE DEVICE SUPPORTS OUTPUT-UNTIL-BUSY 22 <3> ; 12 -> UNUSED 23 <3> ; 11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE 24 <3> ; 10 -> MUST BE 0 25 <3> ; 9 -> MUST BE 0 26 <3> ; 8 -> UNUSED 27 <3> ; 7 -> UNUSED 28 <3> ; 6 -> UNUSED 29 <3> ; 5 -> UNUSED 30 <3> ; 4 -> 1 IF DEVICE IS RECIPIENT OF INT 29H 31 <3> ; 3 -> 1 IF DEVICE IS CLOCK DEVICE 32 <3> ; 2 -> 1 IF DEVICE IS NULL DEVICE 33 <3> ; 1 -> 1 IF DEVICE IS CONSOLE OUTPUT 34 <3> ; 0 -> 1 IF DEVICE IS CONSOLE INPUT 35 <3> ; 36 <3> ; BLOCK DEVICES: 37 <3> ; 38 <3> ; BIT 15 -> MUST BE 0 39 <3> ; 14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS 40 <3> ; 13 -> 1 IF THE DEVICE DETERMINES MEDIA BY EXAMINING THE FAT ID BYTE. 41 <3> ; THIS REQUIRES THE FIRST SECTOR OF THE FAT TO *ALWAYS* RESIDE IN 42 <3> ; THE SAME PLACE. 43 <3> ; 12 -> UNUSED 44 <3> ; 11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE/REMOVABLE MEDIA 45 <3> ; 10 -> MUST BE 0 46 <3> ; 9 -> MUST BE 0 47 <3> ; 8 -> UNUSED 48 <3> ; 7 -> UNUSED 49 <3> ; 6 -> IF DEVICE HAS SUPPORT FOR GETMAP/SETMAP OF LOGICAL DRIVES. 50 <3> ; IF THE DEVICE UNDERSTANDS GENERIC IOCTL FUNCTION CALLS. 51 <3> ; 5 -> UNUSED 52 <3> ; 4 -> UNUSED 53 <3> ; 3 -> UNUSED 54 <3> ; 2 -> UNUSED 55 <3> ; 1 -> UNUSED 56 <3> ; 0 -> UNUSED 57 <3> ; 58 <3> 59 <3> DEVTYP EQU 8000H ; BIT 15 - 1 IF CHAR, 0 IF BLOCK 60 <3> CHARDEV EQU 8000H 61 <3> DEVIOCTL EQU 4000H ; BIT 14 - CONTROL MODE BIT 62 <3> ISFATBYDEV EQU 2000H ; BIT 13 - DEVICE USES FAT ID BYTES, 63 <3> ; COMP MEDIA. 64 <3> OUTTILBUSY EQU 2000H ; OUTPUT UNTIL BUSY IS ENABLED 65 <3> ISNET EQU 1000H ; BIT 12 - 1 IF A NET DEVICE, 0 IF 66 <3> ; NOT. CURRENTLY BLOCK ONLY. 67 <3> DEVOPCL EQU 0800H ; BIT 11 - 1 IF THIS DEVICE HAS 68 <3> ; OPEN,CLOSE AND REMOVABLE MEDIA 69 <3> ; ENTRY POINTS, 0 IF NOT 70 <3> 71 <3> EXTENTBIT EQU 0400H ; BIT 10 - CURRENTLY 0 ON ALL DEVS 72 <3> ; THIS BIT IS RESERVED FOR FUTURE USE 73 <3> ; TO EXTEND THE DEVICE HEADER BEYOND 74 <3> ; ITS CURRENT FORM. 75 <3> 76 <3> ; NOTE BIT 9 IS CURRENTLY USED ON IBM SYSTEMS TO INDICATE "DRIVE IS SHARED". 77 <3> ; SEE IOCTL FUNCTION 9. THIS USE IS NOT DOCUMENTED, IT IS USED BY SOME 78 <3> ; OF THE UTILITIES WHICH ARE SUPPOSED TO FAIL ON SHARED DRIVES ON SERVER 79 <3> ; MACHINES (FORMAT,CHKDSK,RECOVER,..). 80 <3> 81 <3> DEV320 EQU 0040H ;BIT 6 - FOR BLOCK DEVICES, THIS 82 <3> ;DEVICE SUPPORTS SET/GET MAP OF 83 <3> ;LOGICAL DRIVES, AND SUPPORTS 84 <3> ;GENERIC IOCTL CALLS. 85 <3> ;FOR CHARACTER DEVICES, THIS 86 <3> ;DEVICE SUPPORTS GENERIC IOCTL. 87 <3> ;THIS IS A DOS 3.2 DEVICE DRIVER. 88 <3> ISSPEC EQU 0010H ;BIT 4 - THIS DEVICE IS SPECIAL 89 <3> ISCLOCK EQU 0008H ;BIT 3 - THIS DEVICE IS THE CLOCK DEVICE. 90 <3> ISNULL EQU 0004H ;BIT 2 - THIS DEVICE IS THE NULL DEVICE. 91 <3> ISCOUT EQU 0002H ;BIT 1 - THIS DEVICE IS THE CONSOLE OUTPUT. 92 <3> ISCIN EQU 0001H ;BIT 0 - THIS DEVICE IS THE CONSOLE INPUT. 93 <3> EXTDRVR EQU 0002H ;BIT 1 - BLOCK DEVICE EXTNDED DRIVER 94 <3> 95 <3> ;STATIC REQUEST HEADER 96 <3> SRHEAD STRUC 0 00000D12 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00000D13 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00000D14 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00000D15 ???? REQSTAT DW ? ;STATUS WORD 0 00000D17 ???????????????? DB 8 DUP(?) ;RESERVED FOR QUEUE LINKS 102 <3> SRHEAD ENDS 103 <3> 104 <3> ;STATUS WORD MASKS 105 <3> STERR EQU 8000H ;BIT 15 - ERROR 106 <3> STBUI EQU 0200H ;BIT 9 - BUISY 107 <3> STDON EQU 0100H ;BIT 8 - DONE 108 <3> STECODE EQU 00FFH ;ERROR CODE 109 <3> ; 2/12/KK 110 <3> ; Interim character identifier 2/12/KK 111 <3> Ddkey EQU 0000010000000000B ; 2/12/KK 112 <3> 113 <3> ;FUNCTION CODES 114 <3> DEVINIT EQU 0 ;INITIALIZATION 115 <3> DINITHL EQU 26 ;SIZE OF INIT HEADER 116 <3> DEVMDCH EQU 1 ;MEDIA CHECK 117 <3> DMEDHL EQU 15 ;SIZE OF MEDIA CHECK HEADER 118 <3> DEVBPB EQU 2 ;GET BPB 119 <3> DEVRDIOCTL EQU 3 ;IOCTL READ 120 <3> DBPBHL EQU 22 ;SIZE OF GET BPB HEADER 121 <3> DEVRD EQU 4 ;READ 122 <3> DRDWRHL EQU 22 ;SIZE OF RD/WR HEADER 123 <3> DEVRDND EQU 5 ;NON DESTRUCTIVE READ NO WAIT (CHARACTER DEVS) 124 <3> DRDNDHL EQU 14 ;SIZE OF NON DESTRUCTIVE READ HEADER 125 <3> DEVIST EQU 6 ;INPUT STATUS 126 <3> DSTATHL EQU 13 ;SIZE OF STATUS HEADER 127 <3> DEVIFL EQU 7 ;INPUT FLUSH 128 <3> DFLSHL EQU 15 ;SIZE OF FLUSH HEADER 129 <3> DEVWRT EQU 8 ;WRITE 130 <3> DEVWRTV EQU 9 ;WRITE WITH VERIFY 131 <3> DEVOST EQU 10 ;OUTPUT STATUS 132 <3> DEVOFL EQU 11 ;OUTPUT FLUSH 133 <3> DEVWRIOCTL EQU 12 ;IOCTL WRITE 134 <3> DEVOPN EQU 13 ;DEVICE OPEN 135 <3> DEVCLS EQU 14 ;DEVICE CLOSE 136 <3> DOPCLHL EQU 13 ;SIZE OF OPEN/CLOSE HEADER 137 <3> DEVRMD EQU 15 ;REMOVABLE MEDIA 138 <3> REMHL EQU 13 ;SIZE OF REMOVABLE MEDIA HEADER 139 <3> GENIOCTL EQU 19 140 <3> ; THE NEXT THREE ARE USED IN DOS 4.0 141 <3> ; 20 142 <3> ; 21 143 <3> ; 22 144 <3> DEVGETOWN EQU 23 ;GET DEVICE OWNER 145 <3> DEVSETOWN EQU 24 ;SET DEVICE OWNER 146 <3> QUERYGENIOCTL equ 25 ; query generic IOCTL support (MS-DOS v5+) 147 <3> OWNHL EQU 13 ;SIZE OF DEVICE OWNER HEADER 148 <3> 149 <3> DEVOUT EQU 16 ; OUTPUT UNTIL BUSY. 150 <3> DEVOUTL EQU DEVWRT ; LENGTH OF OUTPUT UNTIL BUSY 151 <3> 152 <3> ; GENERIC IOCTL REQUEST STRUCTURE 153 <3> ; SEE THE DOS 4.0 DEVICE DRIVER SPEC FOR FURTHER ELABORATION. 154 <3> ; 155 <3> IOCTL_REQ STRUC 156 00000000 <3> DB (SRHEAD_struc_size) DUP(?) 157 <3> ; GENERIC IOCTL ADDITION. 0 00000D1F ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00000D20 ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00000D21 ???? REG_SI DW ? 0 00000D23 ???? REG_DI DW ? 0 00000D25 ???????? GENERICIOCTL_PACKET DD ? ; POINTER TO DATA BUFFER 163 <3> IOCTL_REQ ENDS 164 <3> 165 <3> ; DEFINITIONS FOR IOCTL_REQ.MINORFUNCTION 166 <3> GEN_IOCTL_WRT_TRK EQU 40H 167 <3> GEN_IOCTL_RD_TRK EQU 60H 168 <3> GEN_IOCTL_FN_TST EQU 20H ; USED TO DIFF. BET READS AND WRTS 169 <3> 170 <3> ;; 32-bit absolute read/write input list structure 171 <3> 172 <3> ABS_32RW STRUC 0 00000D12 ???????? SECTOR_RBA DD ? ; relative block address 0 00000D16 ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 00000D18 ???????? BUFFER_ADDR DD ? ; data addrress 176 <3> ABS_32RW ENDS 177 <3> 178 <3> ;; media ID info 179 <3> 180 <3> MEDIA_ID_INFO STRUC 0 00000D12 ???? MEDIA_level DW ? ; info level 0 00000D14 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <3> MEDIA_Label DB 11 dup (?) ;volume label 0 00000D23 ???????????????? MEDIA_System DB 8 dup (?) ;system type 185 <3> MEDIA_ID_INFO ENDS 186 <3> 187 <3> ;; equates for DOS34_FLAG 188 <3> 189 <3> IFS_ABSRW EQU 00001H ;IFS absolute read/write 190 <3> NO_IFS_ABSRW EQU 0FFFEH ;no IFS absolute read/write 191 <3> IFS_DRIVE_RESET EQU 00002H ;IFS drvive reset 192 <3> NO_IFS_DRIVE_RESET EQU 0FFFDH ;no IFS drive reset 193 <3> FROM_DISK_RESET EQU 00004H ;from disk reset 194 <3> NO_FROM_DISK_RESET EQU 0FFFBH ;not from disk reset 195 <3> From_String_Output EQU 00008H ;from con string output 196 <3> NO_From_String_Output EQU 0FFF7H ;not from con string output 197 <3> From_DOS_WRITE EQU 00010H ;from dos_write 198 <3> NO_From_DOS_WRITE EQU 0FFEFH ;not from dos_write 199 <3> Force_I24_Fail EQU 00020H ;form IFS CALL BACK 200 <3> NO_Force_I24_Fail EQU 0FFDFH ;not form IFS CALL BACK 201 <3> Disable_EOF_I24 EQU 00040H ;disable EOF int24 for input status 202 <3> NO_Disable_EOF_I24 EQU 0FFBFH ;disable EOF int24 for input status 203 <3> DBCS_VOLID EQU 00080H ;indicate from volume id 204 <3> DBCS_VOLID2 EQU 00100H ;indicate 8th char is DBCS 205 <3> CTRL_BREAK_FLAG EQU 00200H ;indicate control break is input 206 <3> NO_CTRL_BREAK_FLAG EQU 0FDFFH ;reset control break 207 <3> SEARCH_FASTOPEN EQU 00400H ;set fastopen flag for search 208 <3> X25_special EQU 00800H ;flag for X25 driver 125 <2> [list +] 126 <2> 127 <2> %ifndef Installed 128 <2> %iassign Installed 0 129 <2> %endif 130 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 131 <2> section DOSSTARTJUMP 132 <2> ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:NOTHING 133 <2> 134 <2> %ifndef DONOBITS 0 00000000 E9[0000] JMP near ptr DOSINIT 136 <2> %else ; DONOBITS 137 <2> db ?,?,? 138 <2> %endif ; DONOBITS 139 <2> 140 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 141 <2> === Switch to base=000E10h -> "LAST" 142 <2> section LAST 143 <2> Extrn DOSINIT:NEAR 144 <2> ; (no prior section) ; LAST ENDS 145 <2> 7 <1> ;=== Pop trace listing source 8 <1> %include "version.mac" 1 <2> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <2> TRUE EQU 0FFFFh 3 <2> TRUEBYTE EQU 0FFh 4 <2> FALSE EQU 0 5 <2> 6 <2> ; 7 <2> ; Use the following switches to control cmacros.inc 8 <2> ; 9 <2> ?PLM equ 0 10 <2> ?WIN equ 0 11 <2> 12 <2> memS EQU 1 ; Small model 13 <2> ; 14 <2> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <2> ; version of the operating system 16 <2> ; 17 <2> ; The below chart will indicate how to set the switches to build the various 18 <2> ; versions 19 <2> ; 20 <2> ; IBMVER IBMCOPYRIGHT 21 <2> ; -------------------------------------------------------- 22 <2> ; IBM Version | TRUE TRUE 23 <2> ; -------------------------------------------------------- 24 <2> ; MS Version | FALSE FALSE 25 <2> ; -------------------------------------------------------- 26 <2> ; Clone Version | TRUE FALSE 27 <2> ; 28 <2> IBMVER EQU TRUE 29 <2> IBMCOPYRIGHT EQU FALSE 30 <2> 31 <2> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <2> 33 <2> %ifndef MSVER 34 <2> MSVER EQU ~ IBMVER 35 <2> %endif 36 <2> IBM EQU IBMVER 37 <2> ; 38 <2> ; 39 <2> %IF IBMVER 40 <2> %IF IBMCOPYRIGHT 41 <2> %warning out: ... IBM version build switch on ... 42 <2> %ELSE 43 <2> %warning out: ... CLONE version build switch on ... 43 ****************** <2> warning: out: ... CLONE version build switch on ... [-w+user] 44 <2> %ENDIF 45 <2> %ELSE 46 <2> %IFN IBMCOPYRIGHT 47 <2> %warning out: ... MS version build switch on ... 48 <2> %ELSE 49 <2> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <2> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <2> %ENDIF 52 <2> %ENDIF 53 <2> ; 54 <2> ; 55 <2> ;*************************************************************************** 56 <2> ;* The following switches are for DBCS or SBCS support * 57 <2> ;* * 58 <2> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <2> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <2> ;* * 61 <2> ;*************************************************************************** 62 <2> ; 63 <2> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <2> 65 <2> ; 66 <2> ; Switch INTERNAT for DBCS support 67 <2> ; 68 <2> INTERNAT EQU FALSE 69 <2> ; 70 <2> %IF INTERNAT 71 <2> %ifndef KANJI 72 <2> KANJI EQU TRUE 73 <2> %endif 74 <2> IBMJAPAN EQU TRUE 75 <2> %ELSE 76 <2> %ifndef KANJI 77 <2> KANJI EQU FALSE 78 <2> %endif 79 <2> IBMJAPAN EQU FALSE 80 <2> %ENDIF 81 <2> 82 <2> %ifndef altvect ; avoid jerking off vector.inc 83 <2> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <2> %endif 85 <2> 86 <2> ; 87 <2> ; Country code switches 88 <2> ; The default contry code is assumed as USA. 89 <2> ; 90 <2> %IF INTERNAT 91 <2> KOREA EQU TRUE 92 <2> JAPAN EQU FALSE 93 <2> %ELSE 94 <2> KOREA EQU FALSE 95 <2> JAPAN EQU FALSE 96 <2> %ENDIF 97 <2> ; 98 <2> %IF INTERNAT 99 <2> %warning out: Internat(ECS) version build switch on 100 <2> %ENDIF 9 <1> %include "lmacros1.mac" 1 <2> [list -] 10 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 11 <1> 12 <1> extern okcallentry, badcallentry 13 <1> === Switch to base=002450h -> "DOSCODECODE" 14 <1> section DOSCODECODE 15 <1> Extrn LeaveDOS:NEAR 16 <1> Extrn BadCall:FAR, OKCall:FAR 17 <1> ; (no prior section) ; DOSCODECODE ENDS 18 <1> === Switch to base=000E10h -> "LAST" 19 <1> section LAST 20 <1> extrn SYSBUF:byte 21 <1> ; (no prior section) ; LAST ENDS 22 <1> 23 <1> Break 24 <1> 25 <1> ; 26 <1> ; We need to identify the parts of the data area that are relevant to tasks 27 <1> ; and those that are relevant to the system as a whole. Under 3.0, the system 28 <1> ; data will be gathered with the system code. The process data under 2.x will 29 <1> ; be available for swapping and under 3.0 it will be allocated per-process. 30 <1> ; 31 <1> ; The data that is system data will be identified by [SYSTEM] in the comments 32 <1> ; describing that data item. 33 <1> ; 34 <1> 35 <1> %ifndef Kanji 36 <1> %iassign Kanji 0 37 <1> %endif 38 <1> %ifndef Debug 39 <1> %iassign Debug 0 40 <1> %endif 41 <1> %ifndef Redirector 42 <1> %iassign Redirector 0 43 <1> %endif 44 <1> %ifndef ShareF 45 <1> %iassign ShareF 0 46 <1> %endif 47 <1> === Switch to base=000000h -> "DOSENTRY" 48 <1> section DOSENTRY 49 <1> extern ifsentry 50 <1> === Switch to base=000E10h -> "CONSTANTS" 51 <1> section CONSTANTS 52 <1> 53 <1> extrn sfTabl:DWORD 54 <1> 55 <1> ;ORG 0 56 <1> 57 <1> EVEN 58 <1> ; 59 <1> ; WANGO!!! The following word is used by SHARE and REDIR to determin data 60 <1> ; area compatability. This location must be incremented EACH TIME the data 61 <1> ; area here gets mucked with. 62 <1> ; 63 <1> ; Also, do NOT change this position relative to 0. wrt DOSGROUP 64 <1> ; 65 <1> Public MSCT001S,MSCT001E 66 <1> MSCT001S: 0 00000004 0100 I_am DataVersion,WORD,<1> ;AC000; [SYSTEM] version number for DOS DATA 68 <1> 69 <1> %warning "out: WARNING!!! Debug fields are being included!!!" 69 ****************** <1> warning: out: WARNING!!! Debug fields are being included!!! [-w+user] 0 00000006 42554720 DB "BUG " ; THIS FIELD MUST BE EVEN # OF BYTES 0 0000000A 0000 I_am BugTyp,WORD,<0> 0 0000000C 0000 I_am BugLev,WORD,<0> 73 <1> %include "bugtyp.nas" 1 <2> ; SCCSID = @(#)bugtyp.asm 1.1 85/04/09 2 <2> ; 3 <2> ; debugging types and levels for MSDOS 4 <2> ; 5 <2> 6 <2> TypAccess EQU 0001h 7 <2> LevSFN EQU 0000h 8 <2> LevBUSY EQU 0001h 9 <2> 10 <2> TypShare EQU 0002h 11 <2> LevShEntry EQU 0000h 12 <2> LevMFTSrch EQU 0001h 13 <2> 14 <2> TypSect EQU 0004h 15 <2> LevEnter EQU 0000h 16 <2> LevLeave EQU 0001h 17 <2> LevReq EQU 0002h 18 <2> 19 <2> TypSMB EQU 0008h 20 <2> LevSMBin EQU 0000h 21 <2> LevSMBout EQU 0001h 22 <2> LevParm EQU 0002h 23 <2> LevASCIZ EQU 0003h 24 <2> LevSDB EQU 0004h 25 <2> LevVarlen EQU 0005h 26 <2> 27 <2> TypNCB EQU 0010h 28 <2> LevNCBin EQU 0000h 29 <2> LevNCBout EQU 0001h 30 <2> 31 <2> TypSeg EQU 0020h 32 <2> LevAll EQU 0000h 33 <2> 34 <2> TypSyscall EQU 0040h 35 <2> LevLog EQU 0000h 36 <2> LevArgs EQU 0001h 37 <2> 38 <2> TypInt24 EQU 0080h 39 <2> LevLog EQU 0000h 40 <2> 41 <2> TypProlog EQU 0100h 42 <2> LevLog EQU 0000h 43 <2> 44 <2> TypInt EQU 0200h 45 <2> LevLog equ 0000h 46 <2> 47 <2> typFCB equ 0400h 48 <2> LevLog equ 0000h 49 <2> LevCheck equ 0001h 74 <1> 0 0000000E 0000 I_am MYNUM,WORD,<0> ; [SYSTEM] A number that goes with MYNAME 0 00000010 0000 I_am FCBLRU,WORD,<0> ; [SYSTEM] LRU count for FCB cache 0 00000012 0000 I_am OpenLRU,WORD,<0> ; [SYSTEM] LRU count for FCB cache opens 78 <1> ; NOTE: We include the decl of OEM_HANDLER in IBM DOS even though it is not used. 79 <1> ; This allows the REDIRector to work on either IBM or MS-DOS. 80 <1> PUBLIC OEM_HANDLER 0 00000014 FFFFFFFF OEM_HANDLER DD -1 ; [SYSTEM] Pointer to OEM handler code 82 <1> DOSGroup equ DOSGROUP ; NASM port equate 0 00000018 [0000] I_am LeaveAddr,WORD,<> ; [SYSTEM] 0 0000001A 0300 I_am RetryCount,WORD,<3> ; [SYSTEM] Share retries 0 0000001C 0100 I_am RetryLoop,WORD,<1> ; [SYSTEM] Share retries 0 0000001E FFFFFFFF I_am LastBuffer,DWORD,<-1,-1>; [SYSTEM] Buffer queue recency pointer 0 00000022 ???? I_am CONTPOS,WORD ; [SYSTEM] location in buffer of next read 0 00000024 ???? I_am arena_head,WORD ; [SYSTEM] Segment # of first arena in memory 89 <1> ; The following block of data is used by SYSINIT. Do not change the order or 90 <1> ; size of this block 91 <1> PUBLIC SYSINITVAR ; [SYSTEM] 92 <1> SYSINITVAR LABEL WORD ; [SYSTEM] 0 00000026 00000000 I_am DPBHEAD,DWORD,<0,0> ; [SYSTEM] Pointer to head of DPB-FAT list 94 <1> DosGroup equ DOSGROUP ; NASM port equate 0 0000002A [0000]???? I_am sft_addr,DWORD,<,?> ; [SYSTEM] Pointer to first SFT table 0 0000002E ???????? I_am BCLOCK,DWORD ; [SYSTEM] The CLOCK device 0 00000032 ???????? I_am BCON,DWORD ; [SYSTEM] Console device entry points 0 00000036 8000 I_am MAXSEC,WORD,<128> ; [SYSTEM] Maximum allowed sector size 99 <1> %ifdef BUF2 0 00000038 FFFFFFFF dd -1 101 <1> %else 102 <1> I_am BUFFHEAD,DWORD ; [SYSTEM] Pointer to head of buffer queue 103 <1> %endif 0 0000003C ???????? I_am CDSADDR,DWORD ; [SYSTEM] Pointer to curdir structure table 0 00000040 ???????? I_am sftFCB,DWORD ; [SYSTEM] pointer to FCB cache table 0 00000044 ???? I_am KeepCount,WORD ; [SYSTEM] count of FCB opens to keep 0 00000046 ?? I_am NUMIO,BYTE ; [SYSTEM] Number of disk tables 0 00000047 ?? I_am CDSCOUNT,BYTE ; [SYSTEM] Number of CDS structures in above 109 <1> ; A fake header for the NUL device 0 00000048 ???????? I_am NULDEV,DWORD ; [SYSTEM] Link to rest of device list 0 0000004C 0480 DW DEVTYP | ISNULL ; [SYSTEM] Null device attributes 0 0000004E [0000] short_addr SNULDEV ; [SYSTEM] Strategy entry point 0 00000050 [0000] short_addr INULDEV ; [SYSTEM] Interrupt entry point 0 00000052 4E554C2020202020 DB "NUL " ; [SYSTEM] Name of null device 0 0000005A 00 I_am Splices,BYTE,<0> ; [SYSTEM] TRUE => splices being done 0 0000005B 0000 I_am Special_Entries,WORD,<0>; [SYSTEM] address of specail entries ;AN000; 0 0000005D [0000][0000] I_am IFS_DOS_CALL,DWORD, ; [SYSTEM] entry for IFS DOS service ;AN000; 0 00000061 ???????? I_am IFS_HEADER,DWORD ; [SYSTEM] IFS header chain ;AN000; 0 00000065 0000 I_am BUFFERS_PARM1,WORD,<0> ; [SYSTEM] value of BUFFERS= ,m ;AN000; 0 00000067 0000 I_am BUFFERS_PARM2,WORD,<0> ; [SYSTEM] value of BUFFERS= ,n ;AN000; 0 00000069 ?? I_am BOOTDRIVE,BYTE ; [SYSTEM] the boot drive ;AN000; 0 0000006A 00 I_am DDMOVE,BYTE,<0> ; [SYSTEM] 1 if we need DWORD move ;AN000; 0 0000006B 0000 I_am EXT_MEM_SIZE,WORD,<0> ; [SYSTEM] extended memory size ;AN000; 124 <1> 125 <1> %ifndef BUF2 126 <1> PUBLIC HASHINITVAR ; [SYSTEM] ;AN000; 127 <1> HASHINITVAR LABEL WORD ; [SYSTEM] ;AN000; 128 <1> I_am BUF_HASH_PTR,DWORD ; [SYSTEM] buffer Hash table addr ;AN000; 129 <1> I_am BUF_HASH_COUNT,WORD,<1> ; [SYSTEM] number of Hash entries ;AN000; 130 <1> I_am SC_CACHE_PTR,DWORD ; [SYSTEM] secondary cache pointer ;AN000; 131 <1> I_am SC_CACHE_COUNT,WORD,<0> ; [SYSTEM] secondary cache count ;AN000; 132 <1> 133 <1> %IF BUFFERFLAG 134 <1> I_am BUF_EMS_SAFE_FLAG,BYTE,<1> ; indicates whether the page used by buffers is safe or not 135 <1> I_am BUF_EMS_LAST_PAGE,4,<0,0,0,0> ; holds the last page above 640k 136 <1> I_am BUF_EMS_FIRST_PAGE,4,<0,0,0,0> ; holds the first page above 640K 137 <1> I_am BUF_EMS_NPA640,WORD,<0> ; holds the number of pages above 640K 138 <1> 139 <1> %ENDIF 140 <1> 141 <1> I_am BUF_EMS_MODE,BYTE,<-1> ; [SYSTEM] EMS mode ;AN000; 142 <1> I_am BUF_EMS_HANDLE,WORD ; [SYSTEM] buffer EMS handle ;AN000; 143 <1> I_am BUF_EMS_PAGE_FRAME,WORD ,<-1>;[SYSTEM] EMS page frame number ;AN000; 144 <1> I_am BUF_EMS_SEG_CNT,WORD,<1>; [SYSTEM] EMS seg count ;AN000; 145 <1> I_am BUF_EMS_PFRAME,WORD ; [SYSTEM] EMS page frame seg address ;AN000; 146 <1> I_am BUF_EMS_RESERV,WORD,<0> ; [SYSTEM] reserved ;AN000; 147 <1> 148 <1> %IF BUFFERFLAG 149 <1> I_am BUF_EMS_MAP_BUFF,1,<0> ; this is not used to save the state of the 150 <1> ; of the buffers page. this one byte is 151 <1> ; retained to keep the size of this data 152 <1> ; block the same. 153 <1> %ELSE 154 <1> I_am BUF_EMS_MAP_BUFF,12,<0,0,0,0,0,0,0,0,0,0,0,0> ; map buufer ;AN000; 155 <1> %ENDIF 156 <1> %endif 157 <1> 158 <1> %ifdef BUF2 0 0000006D ?? align 2, db ? 0 0000006E 0000 I_am BUF2_Dirty_Count,WORD,0 0 00000070 ???????? I_am BUFFHEAD,DWORD ; [SYSTEM] Pointer to head of buffer queue 0 00000074 ???????? I_am BuffFree,DWORD 163 <1> %endif 164 <1> 165 <1> ; End of SYSINITVar block 166 <1> 0 00000078 ?? _fill 90h, ?, DataVersion - 4 168 <1> 169 <1> ; 170 <1> ; Sharer jump table 171 <1> ; 172 <1> PUBLIC JShare 173 <1> EVEN 174 <1> JShare LABEL DWORD 0 00000090 [0000][0000] DW OFFSET badcallentry, DOSENTRY 0 00000094 [0000][0000] DW OFFSET okcallentry, DOSENTRY ; 1 MFT_enter 0 00000098 [0000][0000] DW OFFSET okcallentry, DOSENTRY ; 2 MFTClose 0 0000009C [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 3 MFTclU 0 000000A0 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 4 MFTCloseP 0 000000A4 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 5 MFTCloN 0 000000A8 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 6 set_block 0 000000AC [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 7 clr_block 0 000000B0 [0000][0000] DW OFFSET okcallentry, DOSENTRY ; 8 chk_block 0 000000B4 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 9 MFT_get 0 000000B8 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 10 ShSave 0 000000BC [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 11 ShChk 0 000000C0 [0000][0000] DW OFFSET okcallentry , DOSENTRY ; 12 ShCol 0 000000C4 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 13 ShCloseFile 0 000000C8 [0000][0000] DW OFFSET badcallentry, DOSENTRY ; 14 ShSU 190 <1> 191 <1> MSCT001E: 192 <1> ; (no prior section) ; CONSTANTS ENDS 193 <1> 194 <1> 10 ;=== Pop trace listing source 11 END === Trace listing source: ../INC/const2.lst 1 ; SCCSID = @(#)const2.asm 1.4 85/07/24 2 ;TITLE CONST2 - More constants data 3 ;NAME CONST2 4 5 [list -] 5 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 8 %include "dossym.mac" 1 <1> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 3 <1> ; PAGE 80,132 4 <1> TRUE EQU 0FFFFh 5 <1> FALSE EQU 0 6 <1> 7 <1> Installed equ TRUE 8 <1> %IFNDEF DEBUG 9 <1> DEBUG equ FALSE 10 <1> %ENDIF 11 <1> %IFNDEF debug 12 <1> debug equ DEBUG 13 <1> %ENDIF 14 <1> 15 <1> %if 0 16 <1> DBCS equ FALSE ; for fixmem.pl operation 17 <1> %endif 18 <1> 19 <1> ; NASM original macros 20 <1> 21 <1> %macro DBCS 1.nolist 22 <1> %defstr %%string %1 23 <1> %substr %%prefix %%string 1,2 24 <1> %substr %%suffix %%string 3,-1 25 <1> %ifnidni %%prefix, "= " 26 <1> %error Unexpected DBCS prefix 27 <1> %endif 28 <1> %deftok %%token %%suffix 29 <1> %xdefine DBCS %%token 30 <1> %endmacro 31 <1> 32 <1> %include "DBCS.SW" 1 <2> DBCS = FALSE 2 <2> 33 <1> %unmacro DBCS 1.nolist 34 <1> 35 <1> ; end of NASM original macros 36 <1> 37 <1> %include "dosmac.mac" 1 <2> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 3 <2> ; 4 <2> ; Macro file for MSDOS. 5 <2> ; 6 <2> 7 <2> %ifndef __DOSMAC_MAC__ 8 <2> %assign __DOSMAC_MAC__ 1 9 <2> 10 <2> TRUE EQU 0FFFFh 11 <2> FALSE EQU 0 12 <2> 13 <2> 14 <2> ; NASM original macros (comment for fixmem.pl) 15 <2> 16 <2> ;SUBTTL BREAK a listing into pages and give new subtitles 17 <2> ;PAGE 18 <2> %imacro BREAK 0-1+.nolist 19 <2> ;SUBTTL subtitle 20 <2> ;PAGE 21 <2> %endmacro 22 <2> ;.xcref break 23 <2> 24 <2> BREAK 25 <2> 26 <2> %if 0 27 <2> AsmVars Macro varlist 28 <2> IRP var, 29 <2> AsmVar var 30 <2> ENDM 31 <2> ENDM 32 <2> 33 <2> AsmVar Macro var 34 <2> IFNDEF var 35 <2> var = FALSE 36 <2> ENDIF 37 <2> ENDM 38 <2> %endif 39 <2> 40 <2> BREAK 41 <2> 42 <2> ; 43 <2> ; declare a variable external and allocate a size 44 <2> ; 45 <2> ;AsmVar InstalledData 46 <2> %ifndef InstalledData 47 <2> %define InstalledData 0 48 <2> %endif 49 <2> 50 <2> %imacro I_NEED 1-2.nolist 51 <2> %ifn InstalledData === Switch to base=000E10h -> "DATA" 52 <2> [section DATA] 53 <2> %IFIDNi %2, WORD 54 <2> EXTRN %1:WORD 55 <2> %ELSE 56 <2> %IFIDNi %2, DWORD 57 <2> EXTRN %1:DWORD 58 <2> %ELSE 59 <2> EXTRN %1:BYTE 60 <2> %ENDIF 61 <2> %ENDIF 62 <2> __SECT__ 63 <2> %ENDIF 64 <2> %endmacro 65 <2> ;.xcref I_need 66 <2> 67 <2> ; 68 <2> ; call a procedure that may be external. The call will be short. 69 <2> ; 70 <2> %imacro invoke 1.nolist 71 <2> ;.xcref 72 <2> EXTRN %1:NEAR 73 <2> ;.cref 74 <2> CALL %1 75 <2> %endmacro 76 <2> ;.xcref invoke 77 <2> 78 <2> ;PAGE 79 <2> ; 80 <2> ; jump to a label that may be external. The jump will be near. 81 <2> ; 82 <2> %imacro transfer 1.nolist 83 <2> ;.xcref 84 <2> EXTRN %1:NEAR 85 <2> ;.cref 86 <2> JUMP %1 87 <2> %endmacro 88 <2> ;.xcref transfer 89 <2> 90 <2> ; 91 <2> ; get a short address in a word 92 <2> ; 93 <2> %imacro short_addr 1.nolist 94 <2> %ifnidn %1, ? 95 <2> EXTRN %1:NEAR 96 <2> DW OFFSET %1 97 <2> %ELSE 98 <2> DW ? 99 <2> %ENDIF 100 <2> %endmacro 101 <2> ;.xcref short_addr 102 <2> 103 <2> ; 104 <2> ; get a long address in a dword 105 <2> ; 106 <2> %imacro long_addr 1.nolist 107 <2> EXTRN %1:NEAR 108 <2> DD %1 109 <2> %endmacro 110 <2> ;.xcref long_addr 111 <2> 112 <2> ; 113 <2> ; declare a PROC near or far but PUBLIC nonetheless 114 <2> ; 115 <2> ;.xcref ?frame 116 <2> ;.xcref ?aframe 117 <2> ;.xcref ?stackdepth 118 <2> ;.xcref ?initstack 119 <2> %assign ?frame 0 ; initial 120 <2> %assign ?aframe 0 ; initial 121 <2> %assign ?stackdepth 0 ; initial stack size 122 <2> %assign ?initstack 0 ; initial stack size 123 <2> 124 <2> %imacro procedure 1-2.nolist 125 <2> %assign ?frame 0 126 <2> %assign ?aframe 2 ;; remember the pushed BP 127 <2> %warning proc %1... 128 <2> %1 PROC %2 129 <2> PUBLIC %1 130 <2> %assign ?initstack ?stackdepth ;; beginning of procedure 131 <2> %endmacro 132 <2> ;.xcref procedure 133 <2> 134 <2> ; 135 <2> ; end a procedure and check that stack depth is preserved 136 <2> ; 137 <2> %imacro EndProc 1-2.nolist 138 <2> %ifnidni %2, NoCheck ;; check the stack size 139 <2> %if ?initstack != ?stackdepth ;; is it different? 140 <2> %warning ***** Possible stack size error in %1 ***** 141 <2> %endif 142 <2> %endif 143 <2> %1 ENDP 144 <2> %endmacro 145 <2> ;.xcref endproc 146 <2> ;PAGE 147 <2> ; 148 <2> ; define a data item to be public and of an appropriate size/type 149 <2> ; 150 <2> 151 <2> %imacro stripangles 2.nolist 152 <2> %defstr %%param %2 153 <2> %rep 16 154 <2> %substr %%opening %%param 1 155 <2> %ifidn %%opening, '<' 156 <2> %substr %%param %%param 2,-1 157 <2> %endif 158 <2> %endrep 159 <2> %rep 16 160 <2> %strlen %%length %%param 161 <2> %substr %%closing %%param %%length 162 <2> %ifidn %%closing, '>' 163 <2> %substr %%param %%param 1,-2 164 <2> %endif 165 <2> %endrep 166 <2> %deftok %%token %%param 167 <2> %1 %%token 168 <2> %endmacro 169 <2> 170 <2> %imacro I_AM 2-*.nolist 171 <2> ;I_AM MACRO name,size,init 172 <2> %xdefine %%name %1 173 <2> ;; declare the type of the object 174 <2> %IFIDNi %2, WORD 175 <2> %1 LABEL WORD 176 <2> %assign I_AM_SIZE 1 177 <2> %assign I_AM_LEN 2 178 <2> %ELSE 179 <2> %IFIDNi %2, DWORD 180 <2> %1 LABEL DWORD 181 <2> %assign I_AM_SIZE 2 182 <2> %assign I_AM_LEN 2 183 <2> %ELSE 184 <2> %IFIDNi %2, BYTE 185 <2> %1 LABEL BYTE 186 <2> %assign I_AM_SIZE 1 187 <2> %assign I_AM_LEN 1 188 <2> %ELSE 189 <2> %1 LABEL BYTE 190 <2> %undef I_AM_SIZE 191 <2> stripangles %assign I_AM_SIZE, %2 192 <2> %assign I_AM_LEN 1 193 <2> %ENDIF 194 <2> %ENDIF 195 <2> %ENDIF 196 <2> ;; declare the object public 197 <2> PUBLIC %%name 198 <2> ;; if no initialize then allocate blank storage 199 <2> %IF %0 == 2 200 <2> DB I_AM_SIZE*I_AM_LEN DUP (?) 201 <2> %ELSE 202 <2> %ifn InstalledData 203 <2> %rotate 2 204 <2> %rep %0 - 2 205 <2> %IF I_AM_LEN == 1 206 <2> stripangles db, %1 207 <2> %ELSE 208 <2> stripangles dw, %1 209 <2> %ENDIF 210 <2> %assign I_AM_SIZE I_AM_SIZE - 1 211 <2> %rotate 1 212 <2> %endrep 213 <2> %IF I_AM_SIZE != 0 214 <2> %error ***** initialization of %%name not complete ***** 215 <2> %ENDIF 216 <2> %ELSE 217 <2> DB I_AM_SIZE*I_AM_LEN DUP (?) 218 <2> %ENDIF 219 <2> %ENDIF 220 <2> %endmacro 221 <2> 222 <2> %imacro I_AM_NOBITS 2-*.nolist 223 <2> ;I_AM MACRO name,size,init 224 <2> %xdefine %%name %1 225 <2> ;; declare the type of the object 226 <2> %IFIDNi %2, WORD 227 <2> %1 LABEL WORD 228 <2> %assign I_AM_SIZE 1 229 <2> %assign I_AM_LEN 2 230 <2> %ELSE 231 <2> %IFIDNi %2, DWORD 232 <2> %1 LABEL DWORD 233 <2> %assign I_AM_SIZE 2 234 <2> %assign I_AM_LEN 2 235 <2> %ELSE 236 <2> %IFIDNi %2, BYTE 237 <2> %1 LABEL BYTE 238 <2> %assign I_AM_SIZE 1 239 <2> %assign I_AM_LEN 1 240 <2> %ELSE 241 <2> %1 LABEL BYTE 242 <2> %undef I_AM_SIZE 243 <2> stripangles %assign I_AM_SIZE, %2 244 <2> %assign I_AM_LEN 1 245 <2> %ENDIF 246 <2> %ENDIF 247 <2> %ENDIF 248 <2> ;; declare the object public 249 <2> PUBLIC %%name 250 <2> ;; if no initialize then allocate blank storage 251 <2> %IF %0 == 2 252 <2> resb I_AM_SIZE*I_AM_LEN 253 <2> %ELSE 254 <2> %ifn InstalledData 255 <2> %rotate 2 256 <2> %rep %0 - 2 257 <2> %IF I_AM_LEN == 1 258 <2> resb 1 259 <2> %ELSE 260 <2> resw 1 261 <2> %ENDIF 262 <2> %assign I_AM_SIZE I_AM_SIZE - 1 263 <2> %rotate 1 264 <2> %endrep 265 <2> %IF I_AM_SIZE != 0 266 <2> %error ***** initialization of %%name not complete ***** 267 <2> %ENDIF 268 <2> %ELSE 269 <2> resb I_AM_SIZE*I_AM_LEN 270 <2> %ENDIF 271 <2> %ENDIF 272 <2> %endmacro 273 <2> 274 <2> ;.xcref I_AM 275 <2> ;.xcref I_AM_SIZE 276 <2> ;.xcref I_AM_LEN 277 <2> %assign I_AM_SIZE 0 278 <2> %assign I_AM_LEN 0 279 <2> 280 <2> ;PAGE 281 <2> 282 <2> ; 283 <2> ; define an entry in a procedure 284 <2> ; 285 <2> %imacro entry 1.nolist 286 <2> %1: 287 <2> PUBLIC %1 288 <2> %endmacro 289 <2> ;.xcref entry 290 <2> 291 <2> BREAK 292 <2> 293 <2> %imacro error 1.nolist 294 <2> ;.xcref 295 <2> MOV AL, %1 296 <2> transfer SYS_RET_ERR 297 <2> ;.cref 298 <2> %endmacro 299 <2> ;.xcref error 300 <2> 301 <2> BREAK 302 <2> ; 303 <2> ; given a label either 2 byte jump to another label _J 304 <2> ; if it is near enough or 3 byte jump to 305 <2> ; 306 <2> 307 <2> %imacro jump 1.nolist 308 <2> ;.xcref 309 <2> 310 <2> %ifndef %1_J ;; is this the first invocation 311 <2> %%a: JMP %1 312 <2> %ELSE 313 <2> %IF (%1_J >= $) || ($-%1_J > 126) 314 <2> %%a: JMP %1 ;; is the jump too far away? 315 <2> %ELSE 316 <2> %%a: JMP %1_J ;; do the short one... 317 <2> %ENDIF 318 <2> %ENDIF 319 <2> %ixdefine %1_j %%a 320 <2> ;.cref 321 <2> %endmacro 322 <2> ;.xcref jump 323 <2> 324 <2> BREAK 325 <2> 326 <2> %imacro return 0.nolist 327 <2> %%a: 328 <2> RET 329 <2> %xdefine ret_l %%a 330 <2> %endmacro 331 <2> ;.xcref return 332 <2> 333 <2> BREAK 334 <2> 335 <2> %imacro condret 2.nolist 336 <2> %assign %%exit 0 337 <2> %ifdef ret_l ;; if ret_l is defined 338 <2> %if (($ - ret_l) <= 126) && ($ > ret_l) 339 <2> ;; if ret_l is near enough then 340 <2> %%a: j%1 ret_l ;; a: j to ret_l 341 <2> %xdefine ret_%1 %%a ;; define ret_ to be a: 342 <2> %assign %%exit 1 343 <2> %endif 344 <2> %endif 345 <2> %ifn %%exit 346 <2> %ifdef ret_%1 ;; if ret_ defined 347 <2> %if (($ - ret_%1) <= 126) && ($ > ret_%1) 348 <2> ;; if ret_ is near enough 349 <2> %%a: j%1 ret_%1 ;; a: j to ret_ 350 <2> %xdefine ret_%1 %%a ;; define ret_ to be a: 351 <2> %assign %%exit 1 352 <2> %endif 353 <2> %endif 354 <2> %endif 355 <2> %ifn %%exit 356 <2> j%2 %%a ;; j a: 357 <2> return ;; return 358 <2> %%a: ;; a: 359 <2> %xdefine ret_%1 ret_l ;; define ret_ to be ret_l 360 <2> %endif 361 <2> %endmacro 362 <2> ;.xcref condret 363 <2> 364 <2> BREAK 365 <2> 366 <2> %imacro retz 0.nolist 367 <2> condret z,nz 368 <2> %endmacro 369 <2> ;.xcref retz 370 <2> 371 <2> BREAK 372 <2> 373 <2> %imacro retnz 0.nolist 374 <2> condret nz,z 375 <2> %endmacro 376 <2> ;.xcref retnz 377 <2> 378 <2> BREAK 379 <2> 380 <2> %imacro retc 0.nolist 381 <2> condret c,nc 382 <2> %endmacro 383 <2> ;.xcref retc 384 <2> 385 <2> BREAK 386 <2> 387 <2> %imacro retnc 0.nolist 388 <2> condret nc,c 389 <2> %endmacro 390 <2> ;.xcref retnc 391 <2> 392 <2> BREAK 393 <2> 394 <2> %imacro context 1.nolist 395 <2> PUSH SS 396 <2> stripangles POP, %1 397 <2> ; ASSUME %1:DOSGROUP 398 <2> %endmacro 399 <2> ;.xcref context 400 <2> 401 <2> BREAK 402 <2> 403 <2> %imacro SaveReg 0-*.nolist ;; push those registers 404 <2> %rep %0 405 <2> %assign ?stackdepth ?stackdepth + 1 406 <2> stripangles push, %1 407 <2> %rotate 1 408 <2> %endrep 409 <2> %endmacro 410 <2> ;.xcref SaveReg 411 <2> 412 <2> BREAK 413 <2> 414 <2> %imacro RestoreReg 0-*.nolist ;; pop those registers 415 <2> %rep %0 416 <2> %assign ?stackdepth ?stackdepth - 1 417 <2> stripangles pop, %1 418 <2> %rotate 1 419 <2> %endrep 420 <2> %endmacro 421 <2> ;.xcref RestoreReg 422 <2> 423 <2> BREAK 424 <2> 425 <2> %imacro EnterCrit 1.nolist 426 <2> Invoke E%1 427 <2> %endmacro 428 <2> 429 <2> %imacro LeaveCrit 1.nolist 430 <2> Invoke L%1 431 <2> %endmacro 432 <2> 433 <2> Break 434 <2> 435 <2> ;AsmVars 436 <2> %ifndef ShareF 437 <2> %idefine ShareF 0 438 <2> %endif 439 <2> %ifndef Cargs 440 <2> %idefine Cargs 0 441 <2> %endif 442 <2> %ifndef Redirector 443 <2> %idefine Redirector 0 444 <2> %endif 445 <2> %ifndef debug 446 <2> %idefine debug 0 447 <2> %endif 448 <2> 449 <2> %if debug 450 <2> %imacro fmt 3-*.nolist 451 <2> ;fmt MACRO typ,lev,fmts,args 452 <2> ;local a,b,c 453 <2> PUSHF 454 <2> %IFNempty %1 455 <2> TEST word [BugTyp],%1 456 <2> JZ %%c 457 <2> CMP word [BugLev],%2 458 <2> JB %%c 459 <2> %ENDIF 460 <2> PUSH AX 461 <2> PUSH BP 462 <2> MOV BP,SP 463 <2> %If (! sharef) && (! redirector) === Switch to base=000E10h -> "TABLE" 464 <2> [section Table] 465 <2> %%a: db %3,0 466 <2> __SECT__ 467 <2> MOV AX,OFFSET %%a wrt DOSGROUP 468 <2> %else 469 <2> jmp short %%b 470 <2> %%a: db %3,0 471 <2> %if sharef 472 <2> %%b: mov ax,offset %%a wrt share 473 <2> %else 474 <2> %%b: mov ax,offset %%a wrt netwrk 475 <2> %endif 476 <2> %endif 477 <2> PUSH AX 478 <2> %iassign cargs 2 479 <2> %rotate 3 480 <2> %rep %0 - 3 481 <2> %ifidni ax, %1 482 <2> MOV AX,[BP+2] 483 <2> %ELSE 484 <2> MOV AX, %1 485 <2> %ENDIF 486 <2> PUSH AX 487 <2> %iassign cargs cargs + 2 488 <2> %rotate 1 489 <2> %endrep 490 <2> invoke PFMT 491 <2> ADD SP, Cargs 492 <2> POP BP 493 <2> POP AX 494 <2> %%c: 495 <2> POPF 496 <2> %endmacro 497 <2> %else 498 <2> %imacro fmt 3-*.nolist 499 <2> %endmacro 500 <2> %endif 501 <2> 502 <2> Break 503 <2> 504 <2> ;AsmVar Debug,$temp 505 <2> 506 <2> %imacro detectstripangles 4.nolist 507 <2> %defstr %%param %4 508 <2> %assign ?%2 0 509 <2> %assign ?%3 0 510 <2> %rep 16 511 <2> %substr %%opening %%param 1 512 <2> %ifidn %%opening, '<' 513 <2> %substr %%param %%param 2,-1 514 <2> %assign ?%2 ?%2 + 1 515 <2> %endif 516 <2> %endrep 517 <2> %rep 16 518 <2> %strlen %%length %%param 519 <2> %substr %%closing %%param %%length 520 <2> %ifidn %%closing, '>' 521 <2> %substr %%param %%param 1,-2 522 <2> %assign ?%3 ?%3 + 1 523 <2> %endif 524 <2> %endrep 525 <2> %deftok %%token %%param 526 <2> %define ?%1 %%token 527 <2> %endmacro 528 <2> 529 <2> 530 <2> %IF debug 531 <2> %imacro DOSAssume 3-*.nolist 532 <2> ;DOSAssume Macro reg,reglist,message 533 <2> %ifidni %1, CS 534 <2> %assign %%temp 1 535 <2> %else 536 <2> %ifidni %1, SS 537 <2> %assign %%temp 0 538 <2> %else 539 <2> %error ***** Invalid DOS register %1 in DOSAssume ***** 540 <2> %endif 541 <2> %endif 542 <2> %rotate 1 543 <2> %assign %%level 0 544 <2> %assign %%amount %0 - 1 545 <2> %rep 16 546 <2> detectstripangles %%token, %%opening, %%closing, %1 547 <2> %assign %%level %%level + ? %+ %%opening 548 <2> %assign %%level %%level - ? %+ %%closing 549 <2> %ifidni ? %+ %%token, DS 550 <2> %assign %%temp %%temp | 2 551 <2> %else 552 <2> %ifidni ? %+ %%token, ES 553 <2> %assign %%temp %%temp | 4 554 <2> %else 555 <2> %error ***** Invalid register reg in DOSAssume ***** 556 <2> %endif 557 <2> %endif 558 <2> %assign %%amount %%amount - 1 559 <2> %rotate 1 560 <2> %if %%level <= 0 561 <2> %exitrep 562 <2> %endif 563 <2> %endrep 564 <2> 565 <2> PUSH AX 566 <2> MOV AX, %%temp 567 <2> PUSH AX 568 <2> %IF SHAREF 569 <2> MOV AX,OFFSET %%a 570 <2> %ELSE 571 <2> MOV AX,OFFSET %%a wrt DOSGroup 572 <2> %ENDIF 573 <2> PUSH AX 574 <2> Invoke SegCheck 575 <2> POP AX 576 <2> %IFN SHAREF === Switch to base=000E10h -> "TABLE" 577 <2> [section Table] 578 <2> %ELSE 579 <2> JMP SHORT %%b 580 <2> %ENDIF 581 <2> %%a: 582 <2> %rep %%amount 583 <2> DB %1 584 <2> %rotate 1 585 <2> %endrep 586 <2> db 0 587 <2> %IFN SHAREF 588 <2> __SECT__ 589 <2> %ELSE 590 <2> %%b: 591 <2> %ENDIF 592 <2> ;IRP r, 593 <2> ; ASSUME r:DOSGroup 594 <2> ;ENDM 595 <2> %endmacro 596 <2> %ELSE 597 <2> %imacro DOSAssume 3-*.nolist 598 <2> ;DOSAssume Macro reg,reglist,message 599 <2> ;IRP r, 600 <2> ; ASSUME r:DOSGroup 601 <2> ;ENDM 602 <2> %endmacro 603 <2> %ENDIF 604 <2> 605 <2> BREAK 606 <2> 607 <2> %if 0 608 <2> ;IF DEBUG 609 <2> Assert MACRO kind, objs, message 610 <2> LOCAL a,b 611 <2> IFIDN , 612 <2> CMP objs,0 613 <2> JZ a 614 <2> fmt <>,<>, 615 <2> a: 616 <2> ELSE 617 <2> IFIDN , 618 <2> CMP objs,0 619 <2> JNZ a 620 <2> fmt <>,<>, 621 <2> a: 622 <2> ELSE 623 <2> PUSH AX 624 <2> IRP obj, 625 <2> PUSH obj 626 <2> ENDM 627 <2> IF SHAREF 628 <2> MOV AX,OFFSET b 629 <2> ELSE 630 <2> MOV AX,OFFSET DOSGroup:b 631 <2> ENDIF 632 <2> PUSH AX 633 <2> IFIDN , 634 <2> Invoke BUFCheck 635 <2> ENDIF 636 <2> IFIDN , 637 <2> Invoke SFTCheck 638 <2> ENDIF 639 <2> IFIDN , 640 <2> Invoke DPBCheck 641 <2> ENDIF 642 <2> POP AX 643 <2> IF SHAREF 644 <2> JMP SHORT a 645 <2> b DB Message,0 646 <2> a: 647 <2> ELSE === Switch to base=000E10h -> "TABLE" 648 <2> Table segment 649 <2> b db Message,0 === Switch to base=000E10h -> "TABLE" 650 <2> Table ends 651 <2> ENDIF 652 <2> ENDIF 653 <2> ENDIF 654 <2> ENDM 655 <2> %ELSE 656 <2> %imacro Assert 0-*.nolist 657 <2> %endmacro 658 <2> %ENDIF 659 <2> 660 <2> %ifndef Installed 661 <2> %idefine Installed 1 662 <2> %endif 663 <2> 664 <2> Break 665 <2> 666 <2> %imacro CallInstall 3-*.nolist 667 <2> ;CallInstall MACRO name,mpx,fn,save,restore 668 <2> %define %%name %1 669 <2> %assign %%mpx %2 670 <2> %assign %%fn %3 671 <2> %IF Installed 672 <2> %rotate 3 673 <2> %assign %%level 0 674 <2> %assign %%amountsaved 0 675 <2> %rep %0 - 3 676 <2> %ifnempty %1 677 <2> detectstripangles %%token, %%opening, %%closing, %1 678 <2> %assign %%level %%level + ? %+ %%opening 679 <2> %assign %%level %%level - ? %+ %%closing 680 <2> SaveReg ? %+ %%token 681 <2> %endif 682 <2> %assign %%amountsaved %%amountsaved + 1 683 <2> %rotate 1 684 <2> %if %%level <= 0 685 <2> %exitrep 686 <2> %endif 687 <2> %endrep 688 <2> MOV AX,(%%mpx << 8) + %%fn 689 <2> INT 2Fh 690 <2> %assign %%level 0 691 <2> %assign %%amountrestored 0 692 <2> %rep %0 - 3 - %%amountsaved 693 <2> %ifnempty %1 694 <2> detectstripangles %%token, %%opening, %%closing, %1 695 <2> %assign %%level %%level + ? %+ %%opening 696 <2> %assign %%level %%level - ? %+ %%closing 697 <2> RestoreReg ? %+ %%token 698 <2> %endif 699 <2> %assign %%amountrestored %%amountrestored + 1 700 <2> %rotate 1 701 <2> %if %%level <= 0 702 <2> %exitrep 703 <2> %endif 704 <2> %endrep 705 <2> %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored 706 <2> %error Wrong amount saved or restored 707 <2> %endif 708 <2> %ELSE 709 <2> Invoke %%name 710 <2> %ENDIF 711 <2> %endmacro 712 <2> 713 <2> Break 714 <2> 715 <2> %imacro localvar 2.nolist 716 <2> %ifidni %2, BYTE 717 <2> %assign ?frame ?frame + 1 718 <2> %assign %%a ?frame 719 <2> labelsize %1, byte, bp - %%a 720 <2> %else 721 <2> %ifidni %2, WORD 722 <2> %assign ?frame ?frame + 2 723 <2> %assign %%a ?frame 724 <2> labelsize %1, word, bp - %%a 725 <2> %else 726 <2> %ifidni %2, DWORD 727 <2> %assign ?frame ?frame + 4 728 <2> %assign %%a ?frame 729 <2> labelsize %1 %+ l, word, bp - %%a 730 <2> labelsize %1 %+ h, word, bp - %%a + 2 731 <2> labelsize %1, dword, bp - %%a 732 <2> %else 733 <2> %assign ?frame ?frame + %2 734 <2> %assign %%a ?frame 735 <2> labelsize %1, byte, bp - %%a 736 <2> %endif 737 <2> %endif 738 <2> %endif 739 <2> %endmacro 740 <2> 741 <2> %imacro enter 0.nolist 742 <2> push bp 743 <2> mov bp,sp 744 <2> sub sp,?frame 745 <2> %endmacro 746 <2> 747 <2> %imacro leave 0.nolist 748 <2> mov sp,bp 749 <2> pop bp 750 <2> %endmacro 751 <2> 752 <2> 753 <2> %imacro argvar 2.nolist 754 <2> %ifidni %2, BYTE 755 <2> %assign %%a ?aframe 756 <2> %assign ?aframe ?aframe + 1 757 <2> labelsize %1, byte, bp + %%a 758 <2> %else 759 <2> %ifidni %2, WORD 760 <2> %assign %%a ?aframe 761 <2> %assign ?aframe ?aframe + 2 762 <2> labelsize %1, word, bp + %%a 763 <2> %else 764 <2> %ifidni %2, DWORD 765 <2> %assign %%a ?aframe 766 <2> %assign ?aframe ?aframe + 4 767 <2> labelsize %1 %+ l, word, bp + %%a 768 <2> labelsize %1 %+ h, word, bp + %%a + 2 769 <2> labelsize %1, dword, bp + %%a 770 <2> %else 771 <2> %assign %%a ?aframe 772 <2> %assign ?aframe ?aframe + %2 773 <2> labelsize %1, byte, bp + %%a 774 <2> %endif 775 <2> %endif 776 <2> %endif 777 <2> %endmacro 778 <2> 779 <2> BREAK 780 <2> 781 <2> %imacro errnz 1.nolist 782 <2> detectstripangles %%token, %%opening, %%closing, %1 783 <2> %if ? %+ %%token 784 <2> %error %1 <> 0 785 <2> %endif 786 <2> %endmacro 787 <2> 788 <2> %endif 38 <1> 39 <1> %include "versiona.mac" 1 <2> 2 <2> major_version equ 4 ;Major DOS version 3 <2> minor_version equ 00 ;Minor DOS Version 4 <2> 5 <2> MINOR_VERSION equ minor_version ; NASM port equate 6 <2> MAJOR_VERSION equ major_version ; NASM port equate 7 <2> expected_version equ (MINOR_VERSION << 8)+MAJOR_VERSION 8 <2> 9 <2> alt_major_version equ 5 ;Major DOS version 10 <2> alt_minor_version equ 26 ;Minor DOS Version 11 <2> 12 <2> alt_expected_version equ (alt_minor_version << 8) + alt_major_version 13 <2> 14 <2> %warning out: ... for DOS Version 4.00 ... 14 ****************** <2> warning: out: ... for DOS Version 4.00 ... [-w+user] 15 <2> 16 <2> ;****************************** 17 <2> ;Each assembler program should: 18 <2> ; mov ah,030h ;DOS Get Version function 19 <2> ; int 021h ;Version ret. in AX,minor version first 20 <2> ; cmp ax,expected_version ;ALL utilities should check for an 21 <2> ; jne error_handler ; EXACT version match. 22 <2> ;****************************** 23 <2> 40 <1> 41 <1> BREAK 42 <1> 43 <1> c_DEL EQU 7Fh ; ASCII rubout or delete previous char 44 <1> c_BS EQU 08h ; ^H ASCII backspace 45 <1> c_CR EQU 0Dh ; ^M ASCII carriage return 46 <1> c_LF EQU 0Ah ; ^J ASCII linefeed 47 <1> c_ETB EQU 17h ; ^W ASCII end of transmission 48 <1> c_NAK EQU 15h ; ^U ASCII negative acknowledge 49 <1> c_ETX EQU 03h ; ^C ASCII end of text 50 <1> c_HT EQU 09h ; ^I ASCII tab 51 <1> 52 <1> BREAK 53 <1> 54 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 55 <1> ; ; 56 <1> ; C A V E A T P R O G R A M M E R ; 57 <1> ; ; 58 <1> ; Certain structures, constants and system calls below are private to ; 59 <1> ; the DOS and are extremely version-dependent. They may change at any ; 60 <1> ; time at the implementors' whim. As a result, they must not be ; 61 <1> ; documented to the general public. If an extreme case arises, they ; 62 <1> ; must be documented with this warning. ; 63 <1> ; ; 64 <1> ; Those structures and constants that are subject to the above will be ; 65 <1> ; marked and bracketed with the flag: ; 66 <1> ; ; 67 <1> ; C A V E A T P R O G R A M M E R ; 68 <1> ; ; 69 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 70 <1> 71 <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 0 00000D12 ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 00000D14 ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 00000D15 ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 00000D17 ?? BPFTCNT DB ? ; NUMBER OF FATS 0 00000D18 ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00000D1A ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 00000D1C ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 00000D1D ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <2> BPBLOCK ENDS 20 <2> 21 <2> A_BPB STRUC 0 00000D12 ???? BPB_BYTESPERSECTOR DW ? 0 00000D14 ?? BPB_SECTORSPERCLUSTER DB ? 0 00000D15 ???? BPB_RESERVEDSECTORS DW ? 0 00000D17 ?? BPB_NUMBEROFFATS DB ? 0 00000D18 ???? BPB_ROOTENTRIES DW ? 0 00000D1A ???? BPB_TOTALSECTORS DW ? 0 00000D1C ?? BPB_MEDIADESCRIPTOR DB ? 0 00000D1D ???? BPB_SECTORSPERFAT DW ? 0 00000D1F ???? BPB_SECTORSPERTRACK DW ? 0 00000D21 ???? BPB_HEADS DW ? 0 00000D23 ???? BPB_HIDDENSECTORS DW ? 0 00000D25 ???? DW ? 0 00000D27 ???? BPB_BIGTOTALSECTORS DW ? 0 00000D29 ???? DW ? 0 00000D2B ???????????? 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> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 72 <1> 73 <1> %include "buffer.mac" 1 <2> %include "buf2sw.mac" 1 <3> %define BUF2 1 2 <2> 3 <2> ; SCCSID = @(#)buffer.asm 1.1 85/04/09 4 <2> BREAK 5 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 6 <2> ; C A V E A T P R O G R A M M E R ; 7 <2> ; ; 8 <2> 9 <2> %ifdef BUF2 10 <2> 11 <2> ; Field definition for I/O buffer information 12 <2> 13 <2> BUFFINFO STRUC 0 00000D12 ???????? NEXTBUF DD ? ; Pointer to next buffer in list 15 <2> ; The next two items are often refed as a word 16 <2> buf_ID: 0 00000D16 ?? BUFDRV DB ? ; Logical drive # assoc with buffer FF = free 18 <2> buf_flags: 0 00000D17 ?? BUFDATAFLAG db ? 0 00000D18 ?? BUFPRI DB ? ; Buffer selection priority (see EQUs below) 0 00000D19 ?? alignb 2 22 <2> buf_sector: 0 00000D1A ???????? BUFSECNO dd ? ; Sector number of buffer 24 <2> alignb 2 0 00000D1E ???????? BUFDRVDP DD ? ; Pointer to drive parameters 26 <2> BUFFINFO ENDS 27 <2> 28 <2> BUFINSIZ EQU BUFFINFO_struc_size 29 <2> ; Size of structure in bytes 30 <2> BUFINSIZE equ BUFINSIZ 31 <2> 32 <2> FREEPRI EQU 0 33 <2> LBRPRI EQU 2 ; Last byte of buffer read 34 <2> LBWPRI EQU 4 ; Last byte written 35 <2> RPRI EQU 6 ; Read but not last byte 36 <2> WPRI EQU 8 ; Written but not last byte 37 <2> DIRPRI EQU 15 ; Directory Sector 38 <2> FATPRI EQU 30 ; FAT sector 39 <2> 40 <2> buf_dirty EQU 01000000B 41 <2> buf_isDATA EQU 00001000B 42 <2> buf_isDIR EQU 00000100B 43 <2> buf_isFAT EQU 00000010B 44 <2> buf_type_0 EQU 11110001B ; AND sets type to "none" 45 <2> 46 <2> %else 47 <2> 48 <2> ; Field definition for I/O buffer information 49 <2> 50 <2> BUFFINFO STRUC 51 <2> buf_next DW ? ; Pointer to next buffer in list 52 <2> buf_prev DW ? ; Pointer to prev buffer in list 53 <2> buf_ID DB ? ; Drive of buffer (bit 7 = 0) 54 <2> ; SFT table index (bit 7 = 1) 55 <2> ; = FFH if buffer free 56 <2> buf_flags DB ? ; Bit 7 = 1 if Remote file buffer 57 <2> ; = 0 if Local device buffer 58 <2> ; Bit 6 = 1 if buffer dirty 59 <2> ; Bit 5 = Reserved 60 <2> ; Bit 4 = Search bit (bit 7 = 1) 61 <2> ; Bit 3 = 1 if buffer is DATA 62 <2> ; Bit 2 = 1 if buffer is DIR 63 <2> ; Bit 1 = 1 if buffer is FAT 64 <2> ; Bit 0 = Reserved 65 <2> buf_sector DD ? ; Sector number of buffer (bit 7 = 0) 66 <2> ; The next two items are often refed as a word (bit 7 = 0) 67 <2> buf_wrtcnt DB ? ; For FAT sectors, # times sector written out 68 <2> buf_wrtcntinc DW ? ; " " " , # sectors between each write 69 <2> buf_DPB DD ? ; Pointer to drive parameters 70 <2> buf_fill DW ? ; How full buffer is (bit 7 = 1) 71 <2> buf_reserved DB ? ; make DWORD boundary for 386 72 <2> BUFFINFO ENDS 73 <2> 74 <2> labelsize buf_offset, dword, buf_sector 75 <2> ;For bit 7 = 1, this is the byte 76 <2> ;offset of the start of the buffer in 77 <2> ;the file pointed to by buf_ID. Thus 78 <2> ;the buffer starts at location 79 <2> ;buf_offset in the file and contains 80 <2> ;buf_fill bytes. 81 <2> 82 <2> BUFINSIZ EQU BUFFINFO_struc_size 83 <2> ; Size of structure in bytes 84 <2> 85 <2> buf_Free EQU 0FFh ; buf_id of free buffer 86 <2> 87 <2> ;Flag byte masks 88 <2> buf_isnet EQU 10000000B 89 <2> buf_dirty EQU 01000000B 90 <2> 91 <2> buf_isDATA EQU 00001000B 92 <2> buf_isDIR EQU 00000100B 93 <2> buf_isFAT EQU 00000010B 94 <2> buf_type_0 EQU 11110001B ; AND sets type to "none" 95 <2> 96 <2> buf_NetID EQU BUFINSIZ 97 <2> 98 <2> ; 99 <2> ; Buffer Hash Entry Structure 100 <2> 101 <2> BUFFER_HASH_ENTRY STRUC ; DOS 4.00 102 <2> EMS_PAGE_NUM DW ? ; logical page number for EMS handle 103 <2> BUFFER_BUCKET DD ? ; pointer to buffers 104 <2> DIRTY_COUNT DB ? ; number of dirty buffers 105 <2> BUFFER_RESERVED DB ? ; reserved 106 <2> BUFFER_HASH_ENTRY ENDS 107 <2> 108 <2> MaxBuffinBucket EQU 15 ; Max number of buffers per bucket 109 <2> MaxBucketinPage EQU 2 ; Max number of buckets per 16kb page 110 <2> 111 <2> %endif 112 <2> 113 <2> ; ; 114 <2> ; C A V E A T P R O G R A M M E R ; 115 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 74 <1> 75 <1> BREAK 76 <1> ; Location of user registers relative user stack pointer 77 <1> 78 <1> user_environ STRUC 0 00000D12 ???? user_AX DW ? 0 00000D14 ???? user_BX DW ? 0 00000D16 ???? user_CX DW ? 0 00000D18 ???? user_DX DW ? 0 00000D1A ???? user_SI DW ? 0 00000D1C ???? user_DI DW ? 0 00000D1E ???? user_BP DW ? 0 00000D20 ???? user_DS DW ? 0 00000D22 ???? user_ES DW ? 0 00000D24 ???? user_IP DW ? 0 00000D26 ???? user_CS DW ? 0 00000D28 ???? user_F DW ? 91 <1> user_environ ENDS 92 <1> 93 <1> %include "sysvar.mac" 1 <2> ; SCCSID = @(#)sysvar.asm 1.1 85/04/10 2 <2> %include "version.mac" 1 <3> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <3> TRUE EQU 0FFFFh 3 <3> TRUEBYTE EQU 0FFh 4 <3> FALSE EQU 0 5 <3> 6 <3> ; 7 <3> ; Use the following switches to control cmacros.inc 8 <3> ; 9 <3> ?PLM equ 0 10 <3> ?WIN equ 0 11 <3> 12 <3> memS EQU 1 ; Small model 13 <3> ; 14 <3> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <3> ; version of the operating system 16 <3> ; 17 <3> ; The below chart will indicate how to set the switches to build the various 18 <3> ; versions 19 <3> ; 20 <3> ; IBMVER IBMCOPYRIGHT 21 <3> ; -------------------------------------------------------- 22 <3> ; IBM Version | TRUE TRUE 23 <3> ; -------------------------------------------------------- 24 <3> ; MS Version | FALSE FALSE 25 <3> ; -------------------------------------------------------- 26 <3> ; Clone Version | TRUE FALSE 27 <3> ; 28 <3> IBMVER EQU TRUE 29 <3> IBMCOPYRIGHT EQU FALSE 30 <3> 31 <3> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <3> 33 <3> %ifndef MSVER 34 <3> MSVER EQU ~ IBMVER 35 <3> %endif 36 <3> IBM EQU IBMVER 37 <3> ; 38 <3> ; 39 <3> %IF IBMVER 40 <3> %IF IBMCOPYRIGHT 41 <3> %warning out: ... IBM version build switch on ... 42 <3> %ELSE 43 <3> %warning out: ... CLONE version build switch on ... 43 ****************** <3> warning: out: ... CLONE version build switch on ... [-w+user] 44 <3> %ENDIF 45 <3> %ELSE 46 <3> %IFN IBMCOPYRIGHT 47 <3> %warning out: ... MS version build switch on ... 48 <3> %ELSE 49 <3> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <3> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <3> %ENDIF 52 <3> %ENDIF 53 <3> ; 54 <3> ; 55 <3> ;*************************************************************************** 56 <3> ;* The following switches are for DBCS or SBCS support * 57 <3> ;* * 58 <3> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <3> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <3> ;* * 61 <3> ;*************************************************************************** 62 <3> ; 63 <3> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <3> 65 <3> ; 66 <3> ; Switch INTERNAT for DBCS support 67 <3> ; 68 <3> INTERNAT EQU FALSE 69 <3> ; 70 <3> %IF INTERNAT 71 <3> %ifndef KANJI 72 <3> KANJI EQU TRUE 73 <3> %endif 74 <3> IBMJAPAN EQU TRUE 75 <3> %ELSE 76 <3> %ifndef KANJI 77 <3> KANJI EQU FALSE 78 <3> %endif 79 <3> IBMJAPAN EQU FALSE 80 <3> %ENDIF 81 <3> 82 <3> %ifndef altvect ; avoid jerking off vector.inc 83 <3> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <3> %endif 85 <3> 86 <3> ; 87 <3> ; Country code switches 88 <3> ; The default contry code is assumed as USA. 89 <3> ; 90 <3> %IF INTERNAT 91 <3> KOREA EQU TRUE 92 <3> JAPAN EQU FALSE 93 <3> %ELSE 94 <3> KOREA EQU FALSE 95 <3> JAPAN EQU FALSE 96 <3> %ENDIF 97 <3> ; 98 <3> %IF INTERNAT 99 <3> %warning out: Internat(ECS) version build switch on 100 <3> %ENDIF 3 <2> 4 <2> SysInitVars STRUC 0 00000D12 ???????? SYSI_DPB DD ? ; DPB chain 0 00000D16 ???????? SYSI_SFT DD ? ; SFT chain 0 00000D1A ???????? SYSI_CLOCK DD ? ; CLOCK device 0 00000D1E ???????? SYSI_CON DD ? ; CON device 0 00000D22 ???? SYSI_MAXSEC DW ? ; maximum sector size 0 00000D24 ???????? SYSI_BUF DD ? ; points to Hashinitvar 0 00000D28 ???????? SYSI_CDS DD ? ; CDS list 0 00000D2C ???????? SYSI_FCB DD ? ; FCB chain 0 00000D30 ???? SYSI_Keep DW ? ; keep count 0 00000D32 ?? SYSI_NUMIO DB ? ; Number of block devices 0 00000D33 ?? SYSI_NCDS DB ? ; number of CDS's 0 00000D34 ???????? SYSI_DEV DD ? ; device list 0 00000D38 ???? SYSI_ATTR DW ? ; null device attribute word 0 00000D3A ???? SYSI_STRAT DW ? ; null device strategy entry point 0 00000D3C ???? SYSI_INTER DW ? ; null device interrupt entry point 0 00000D3E ???????????????? SYSI_NAME DB 8 DUP(?) ; null device name 0 00000D46 ?? SYSI_SPLICE DB ? ; TRUE -> splicees being done 0 00000D47 ???? SYSI_IBMDOS_SIZE DW ? ; DOS size in paragraphs 0 00000D49 ???????? SYSI_IFS_DOSCALL@ DD ? ; IFS DOS service rountine entry 0 00000D4D ???????? SYSI_IFS DD ? ; IFS header chain 0 00000D51 ???????? SYSI_BUFFERS DW ?,? ; BUFFERS= values (m,n) 0 00000D55 ?? SYSI_BOOT_DRIVE DB ? ; boot drive A=1 B=2,.. 0 00000D56 ?? SYSI_DWMOVE DB ? ; 1 if 386 machine 0 00000D57 ???? SYSI_EXT_MEM DW ? ; Extended memory size in KB. 29 <2> SysInitVars ENDS 30 <2> 31 <2> ;This is added for more information exchage between DOS, BIOS. 32 <2> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86 33 <2> SysInitVars_Ext struc 0 00000D12 ???????? SYSI_InitVars DD ? ; Points to the above structure. 0 00000D16 ???????? SYSI_Country_Tab DD ? ; DOS_Country_cdpg_info 36 <2> SysInitVars_Ext ends 37 <2> 38 <2> ;The SYSI_BUF of SysInitVars points to the follwong structure 39 <2> EMS_MAP_BUFF_SIZE EQU 12 ; EMS map buffer size 40 <2> 41 <2> Buffinfo STRUC 0 00000D12 ???????? Hash_ptr DD ? ; pointer to Hash table 0 00000D16 ???? Hash_count DW ? ; number of Hash entries 0 00000D18 ???????? Cache_ptr DD ? ; pointer to secondary cache 0 00000D1C ???? Cache_count DW ? ; number of secondary cache entries 46 <2> 47 <2> %IF BUFFERFLAG 48 <2> 0 00000D1E ?? EMS_SAFE_FLAG DB ? 0 00000D1F ???????? EMS_LAST_PAGE DW ?, ? 0 00000D23 ???????? EMS_FIRST_PAGE DW ?, ? 0 00000D27 ???? EMS_NPA640 DW ? 53 <2> 54 <2> %ENDIF 55 <2> 0 00000D29 ?? EMS_mode DB ? ; no EMS = -1 0 00000D2A ???? EMS_handle DW ? ; EMS handle for buffers 0 00000D2C ???? EMS_PageFrame_Number DW ? ; EMS page frame number 0 00000D2E ???? EMS_Seg_Cnt DW ? ; EMS segment count 0 00000D30 ???? EMS_Page_Frame DW ? ; EMS page frame segment address 0 00000D32 ???? EMS_reserved DW ? ; EMS segment count 62 <2> 63 <2> %IF BUFFERFLAG 0 00000D34 ?? EMS_Map_Buff DB ? ; map buffer 65 <2> %ELSE 66 <2> EMS_Map_Buff DB 12 dup(?) 67 <2> %ENDIF 68 <2> 69 <2> Buffinfo ENDS 70 <2> 71 <2> 72 <2> 73 <2> 74 <2> 75 <2> 76 <2> 77 <2> 94 <1> 95 <1> %include "vector.mac" 1 <2> ; SCCSID = @(#)vector.asm 1.1 85/04/10 2 <2> BREAK 3 <2> 4 <2> ;Asmvar AltVect 5 <2> %ifndef AltVect 6 <2> %iassign AltVect 0 7 <2> %endif 8 <2> 9 <2> INTTAB EQU 20H 10 <2> inttab equ INTTAB ; NASM port equate 11 <2> INTBASE EQU 4 * inttab 12 <2> ENTRYPOINT EQU INTBASE+40H 13 <2> 14 <2> %IF ALTVECT 15 <2> ALTTAB EQU 0F0H 16 <2> ALTBASE EQU 4 * ALTTAB 17 <2> %ENDIF 18 <2> 19 <2> ; 20 <2> ; interrupt assignments 21 <2> ; 22 <2> %IFN ALTVECT 23 <2> int_abort EQU INTTAB ; abort process 24 <2> int_command EQU int_abort+1 ; call MSDOS 25 <2> int_terminate EQU int_abort+2 ; int to terminate address 26 <2> int_ctrl_c EQU int_abort+3 ; ^c trapper 27 <2> int_fatal_abort EQU int_abort+4 ; hard disk error 28 <2> int_disk_read EQU int_abort+5 ; logical sector disk read 29 <2> int_disk_write EQU int_abort+6 ; logical sector disk write 30 <2> int_keep_process EQU int_abort+7 ; terminate program and stay 31 <2> ; resident 32 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <2> ; C A V E A T P R O G R A M M E R ; 34 <2> ; ; 35 <2> int_spooler EQU int_abort+8 ; spooler call 36 <2> int_fastcon EQU int_abort+9 ; fast CON interrupt 37 <2> int_IBM EQU int_abort+10; critical section maintenance 38 <2> ; ; 39 <2> ; C A V E A T P R O G R A M M E R ; 40 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <2> %ELSE 42 <2> int_abort EQU INTTAB ; abort process 43 <2> int_command EQU int_abort+1 ; call MSDOS 44 <2> int_terminate EQU ALTTAB ; int to terminate address 45 <2> int_ctrl_c EQU int_terminate+1 ; ^c trapper 46 <2> int_fatal_abort EQU int_terminate+2 ; hard disk error 47 <2> int_disk_read EQU int_abort+5 ; logical sector disk read 48 <2> int_disk_write EQU int_abort+6 ; logical sector disk write 49 <2> int_keep_process EQU int_abort+7 ; terminate program and stay resident 50 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 51 <2> ; C A V E A T P R O G R A M M E R ; 52 <2> ; ; 53 <2> int_spooler EQU int_terminate+3 ; spooler call 54 <2> int_fastcon EQU int_abort+9 ; fast CON interrupt 55 <2> ; ; 56 <2> ; C A V E A T P R O G R A M M E R ; 57 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <2> %ENDIF 59 <2> 60 <2> addr_int_abort EQU 4 * int_abort 61 <2> addr_int_command EQU 4 * int_command 62 <2> addr_int_terminate EQU 4 * int_terminate 63 <2> addr_int_ctrl_c EQU 4 * int_ctrl_c 64 <2> addr_int_fatal_abort EQU 4 * int_fatal_abort 65 <2> addr_int_disk_read EQU 4 * int_disk_read 66 <2> addr_int_disk_write EQU 4 * int_disk_write 67 <2> addr_int_keep_process EQU 4 * int_keep_process 68 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 69 <2> ; C A V E A T P R O G R A M M E R ; 70 <2> ; ; 71 <2> addr_int_spooler EQU 4 * int_spooler 72 <2> addr_int_fastcon EQU 4 * int_fastcon 73 <2> addr_int_IBM EQU 4 * int_IBM 74 <2> ; ; 75 <2> ; C A V E A T P R O G R A M M E R ; 76 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 96 <1> 97 <1> %include "mult.mac" 1 <2> ; SCCSID = @(#)mult.asm 1.2 85/04/12 2 <2> Break 3 <2> 4 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <2> ; C A V E A T P R O G R A M M E R ; 6 <2> ; ; 7 <2> ; Critical section definitions 8 <2> ; 9 <2> ; These below are subject to leave-all sections 10 <2> critDisk EQU 1 ; Disk I/O critical section 11 <2> critDevice EQU 2 ; Device I/O critical section 12 <2> critShare EQU 1 ; Sharer I/O critical section 13 <2> critMem EQU 1 ; memory maintenance critical section 14 <2> critNet EQU 5 ; network critical section 15 <2> critSFT EQU 1 ; sft table allocation 16 <2> critIFS EQU 6 ; ifsfunc critical section 17 <2> ; These below are not subject to leave-all sections 18 <2> critASSIGN EQU 8 ; Assign has munged a system call 19 <2> ; ; 20 <2> ; C A V E A T P R O G R A M M E R ; 21 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 22 <2> 23 <2> ; 24 <2> ; The current set of defined multiplex channels is (* means documented): 25 <2> ; 26 <2> ; Channel(h) Issuer Receiver Function 27 <2> ; 00 server PSPRINT print job control 28 <2> ; *01 print/apps PRINT Queueing of files 29 <2> ; 02 BIOS REDIR signal open/close of printers 30 <2> ; 31 <2> ; 05 command REDIR obtain text of net int 24 message 32 <2> ; *06 server/assign ASSIGN Install check 33 <2> ; 34 <2> ; 08 external driver IBMBIO interface to internal routines 35 <2> ; 36 <2> ; 10 sharer/server Sharer install check 37 <2> ; 11 DOS/server Redir install check/redirection funcs 38 <2> ; 12 sharer/redir DOS dos functions and structure maint 39 <2> ; 13 MSNET MSNET movement of NCBs 40 <2> ; 13 external driver IBMBIO Reset_Int_13, allows installation 41 <2> ; of alternative INT_13 drivers after 42 <2> ; boot_up 43 <2> ; 14 (IBM) DOS NLSFUNC down load NLS country info,DOS 3.3 44 <2> ; 14 (MS) APPS POPUP MSDOS 4 popup screen functions 45 <2> ; 15 APPS MSCDEX CD-ROM extensions interface 46 <2> ; 16 WIN386 WIN386 Windows communications 47 <2> ; 17 Clipboard WINDOWS Clipboard interface 48 <2> ; *18 Applications MS-Manger Toggle interface to manager 49 <2> ; 19 Shell 50 <2> ; 1A Ansi.sys 51 <2> ; 1B Fastopen,Vdisk IBMBIO EMS INT 67H stub handler 52 <2> ; 53 <2> ; AC Graphics 54 <2> ; AD NLS (toronto) 55 <2> ; AE 56 <2> ; AF Mode 57 <2> ; B0 GRAFTABL GRAFTABL 58 <2> ; 59 <2> 60 <2> 61 <2> ;MUX 00-3F reserverd for IBM 62 <2> ;MUX 80-BF reserverd for IBM 63 <2> ;MUX 40-7F reserved for Microsoft 64 <2> ;MUX C0-FF users 65 <2> 66 <2> 67 <2> 68 <2> MultSHARE EQU 10h ; sharer 69 <2> ; 1 MFT_enter 70 <2> ; 2 MFTClose 71 <2> ; 3 MFTclU 72 <2> ; 4 MFTCloseP 73 <2> ; 5 MFTCloN 74 <2> ; 6 set_block 75 <2> ; 7 clr_block 76 <2> ; 8 chk_block 77 <2> ; 9 MFT_get 78 <2> ; 10 ShSave 79 <2> ; 11 ShChk 80 <2> ; 12 ShCol 81 <2> ; 13 ShCloseFile 82 <2> 83 <2> MultNET EQU 11h ; Network support 84 <2> MultIFS EQU 11h ; Network support 85 <2> ; 1 IFS_RMDIR 86 <2> ; 2 IFS_SEQ_RMDIR 87 <2> ; 3 IFS_MKDIR 88 <2> ; 4 IFS_SEQ_MKDIR 89 <2> ; 5 IFS_CHDIR 90 <2> ; 6 IFS_CLOSE 91 <2> ; 7 IFS_COMMIT 92 <2> ; 8 IFS_READ 93 <2> ; 9 IFS_WRITE 94 <2> ; 10 IFS_LOCK 95 <2> ; 11 IFS_UNLOCK 96 <2> ; 12 IFS_DISK_INFO 97 <2> ; 13 IFS_SET_FILE_ATTRIBUTE 98 <2> ; 14 IFS_SEQ_SET_FILE_ATTRIBUTE 99 <2> ; 15 IFS_GET_FILE_INFO 100 <2> ; 16 IFS_SEQ_GET_FILE_INFO 101 <2> ; 17 IFS_RENAME 102 <2> ; 18 IFS_SEQ_RENAME 103 <2> ; 19 IFS_DELETE 104 <2> ; 20 IFS_SEQ_DELETE 105 <2> ; 21 IFS_OPEN 106 <2> ; 22 IFS_SEQ_OPEN 107 <2> ; 23 IFS_CREATE 108 <2> ; 24 IFS_SEQ_CREATE 109 <2> ; 25 IFS_SEQ_SEARCH_FIRST 110 <2> ; 26 IFS_SEQ_SEARCH_NEXT 111 <2> ; 27 IFS_SEARCH_FIRST 112 <2> ; 28 IFS_SEARCH_NEXT 113 <2> ; 29 IFS_ABORT 114 <2> ; 30 IFS_ASSOPER 115 <2> ; 31 Printer_SET_STRING 116 <2> ; 32 IFSFlushBuf 117 <2> ; 33 IFSBufWrite 118 <2> ; 34 IFSResetEnvironment 119 <2> ; 35 IFSSpoolCheck 120 <2> ; 36 IFSSpoolClose 121 <2> 122 <2> MultDOS EQU 12h ; DOS call back 123 <2> ; 1 DOS_CLOSE 124 <2> ; 2 RECSET 125 <2> ; 3 Get DOSGROUP 126 <2> ; 4 PATHCHRCMP 127 <2> ; 5 OUT 128 <2> ; 6 NET_I24_ENTRY 129 <2> ; 7 PLACEBUF 130 <2> ; 8 FREE_SFT 131 <2> ; 9 BUFWRITE 132 <2> ; 10 SHARE_VIOLATION 133 <2> ; 11 SHARE_ERROR 134 <2> ; 12 SET_SFT_MODE 135 <2> ; 13 DATE16 136 <2> ; 14 SETVISIT 137 <2> ; 15 SCANPLACE 138 <2> ; 16 SKIPVISIT 139 <2> ; 17 StrCpy 140 <2> ; 18 StrLen 141 <2> ; 19 Ucase 142 <2> ; 20 POINTCOMP 143 <2> ; 21 CHECKFLUSH 144 <2> ; 22 SFFromSFN 145 <2> ; 23 GetCDSFromDrv 146 <2> ; 24 Get_User_Stack 147 <2> ; 25 GetThisDrv 148 <2> ; 26 DriveFromText 149 <2> ; 27 SETYEAR 150 <2> ; 28 DSUM 151 <2> ; 29 DSLIDE 152 <2> ; 30 StrCmp 153 <2> ; 31 initcds 154 <2> ; 32 pjfnfromhandle 155 <2> ; 33 $NameTrans 156 <2> ; 34 CAL_LK 157 <2> ; 35 DEVNAME 158 <2> ; 36 Idle 159 <2> ; 37 DStrLen 160 <2> ; 38 NLS_OPEN DOS 3.3 161 <2> ; 39 $CLOSE DOS 3.3 162 <2> ; 40 NLS_LSEEK DOS 3.3 163 <2> ; 41 $READ DOS 3.3 164 <2> ; 42 FastInit DOS 4.0 165 <2> ; 43 NLS_IOCTL DOS 3.3 166 <2> ; 44 GetDevList DOS 3.3 167 <2> ; 45 NLS_GETEXT DOS 3.3 168 <2> ; 46 MSG_RETRIEVAL DOS 4.0 169 <2> ; 47 FAKE_VERSION DOS 4.0 170 <2> ; 171 <2> NLSFUNC EQU 14h ; NLSFUNC CALL , DOS 3.3 172 <2> ; 0 NLSInstall 173 <2> ; 1 ChgCodePage 174 <2> ; 2 GetExtInfo 175 <2> ; 3 SetCodePage 176 <2> ; 4 GetCntry 177 <2> ; 178 <2> ;FASTOPEN is not chained through INT 2F ; DOS 3.3 F.C. 179 <2> ; it calls Multdos 42 to set up an entry routine address 180 <2> ; 0 Install status (reserved) 181 <2> ; 1 Lookup 182 <2> ; 2 Insert 183 <2> ; 3 Delete 184 <2> ; 4 Purge (reserved) 98 <1> 99 <1> BREAK 100 <1> ; MSDOS partitions the disk into 4 sections: 101 <1> ; 102 <1> ; phys sector 0: +-------------------+ 103 <1> ; | | boot/reserved | 104 <1> ; | +-------------------+ 105 <1> ; | | File allocation | 106 <1> ; v | table(s) | 107 <1> ; | (multiple copies | 108 <1> ; | are kept) | 109 <1> ; +-------------------+ 110 <1> ; | Directory | 111 <1> ; +-------------------+ 112 <1> ; | File space | 113 <1> ; +-------------------+ 114 <1> ; | Unaddressable | 115 <1> ; | (to end of disk) | 116 <1> ; +-------------------+ 117 <1> ; 118 <1> ; All partition boundaries are sector boundaries. The size of the FAT is 119 <1> ; adjusted to maximize the file space addressable. 120 <1> 121 <1> %include "dirent.mac" 1 <2> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 3 <2> Break 4 <2> 5 <2> ; 6 <2> ; +---------------------------+ 7 <2> ; | (12 BYTE) filename/ext | 0 0 8 <2> ; +---------------------------+ 9 <2> ; | (BYTE) attributes | 11 B 10 <2> ; +---------------------------+ 11 <2> ; | (10 BYTE) reserved | 12 C 12 <2> ; +---------------------------+ 13 <2> ; | (WORD) time of last write | 22 16 14 <2> ; +---------------------------+ 15 <2> ; | (WORD) date of last write | 24 18 16 <2> ; +---------------------------+ 17 <2> ; | (WORD) First cluster | 26 1A 18 <2> ; +---------------------------+ 19 <2> ; | (DWORD) file size | 28 1C 20 <2> ; +---------------------------+ 21 <2> ; 22 <2> ; First byte of filename = E5 -> free directory entry 23 <2> ; = 00 -> end of allocated directory 24 <2> ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour 25 <2> ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980 26 <2> ; 27 <2> 28 <2> dir_entry STRUC 29 00000000 <2> dir_name DB 11 DUP (?) ; file name 0 00000D1D ?? dir_attr DB ? ; attribute bits 0 00000D1E ???? dir_codepg dw ? ; code page DOS 4.00 0 00000D20 ???? dir_extcluster dw ? ; extended attribute starting cluster 0 00000D22 ?? dir_attr2 db ? ; reserved 0 00000D23 ?????????? dir_pad DB 5 DUP (?) ; reserved for expansion 0 00000D28 ???? dir_time DW ? ; time of last write 0 00000D2A ???? dir_date DW ? ; date of last write 0 00000D2C ???? dir_first DW ? ; first allocation unit of file 0 00000D2E ???? dir_size_l DW ? ; low 16 bits of file size 0 00000D30 ???? dir_size_h DW ? ; high 16 bits of file size 40 <2> dir_entry ENDS 41 <2> 42 <2> attr_read_only EQU 1h 43 <2> attr_hidden EQU 2h 44 <2> attr_system EQU 4h 45 <2> attr_volume_id EQU 8h 46 <2> attr_directory EQU 10h 47 <2> attr_archive EQU 20h 48 <2> attr_device EQU 40h ; This is a VERY special bit. 49 <2> ; NO directory entry on a disk EVER 50 <2> ; has this bit set. It is set non-zero 51 <2> ; when a device is found by GETPATH 52 <2> 53 <2> attr_all EQU attr_hidden+attr_system+attr_directory 54 <2> ; OR of hard attributes for FINDENTRY 55 <2> 56 <2> attr_ignore EQU attr_read_only+attr_archive+attr_device 57 <2> ; ignore this(ese) attribute(s) during 58 <2> ; search first/next 59 <2> 60 <2> attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive 61 <2> ; changeable via CHMOD 122 <1> 123 <1> BREAK 124 <1> ; 125 <1> ; The File Allocation Table uses a 12-bit entry for each allocation unit on 126 <1> ; the disk. These entries are packed, two for every three bytes. The contents 127 <1> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result 128 <1> ; to the base address of the Allocation Table; 3) fetching the 16-bit word 129 <1> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift 130 <1> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex). Entry 131 <1> ; number zero is used as an end-of-file trap in the OS and is passed to the 132 <1> ; BIOS to help determine disk format. Entry 1 is reserved for future use. 133 <1> ; The first available allocation unit is assigned entry number two, and even 134 <1> ; though it is the first, is called cluster 2. Entries greater than 0FF8H 135 <1> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero 136 <1> ; are unallocated. Otherwise, the contents of a FAT entry is the number of 137 <1> ; the next cluster in the file. 138 <1> ; 139 <1> ; Clusters with bad sectors are tagged with FF7H. Any non-zero number would 140 <1> ; do because these clusters show as allocated, but are not part of any 141 <1> ; allocation chain and thus will never be allocated to a file. A particular 142 <1> ; number is selected so that disk checking programs know what to do (ie. a 143 <1> ; cluster with entry FF7H which is not in a chain is not an error). 144 <1> 145 <1> %include "dpb.mac" 1 <2> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <2> BREAK 4 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <2> ; C A V E A T P R O G R A M M E R ; 6 <2> ; ; 7 <2> dpb STRUC 0 00000D12 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 00000D13 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 00000D14 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 00000D16 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 00000D17 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 00000D18 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 00000D1A ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 00000D1B ???? dpb_root_entries DW ? ; Number of directory entries 0 00000D1D ???? dpb_first_sector DW ? ; First sector of first cluster 0 00000D1F ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 00000D21 ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 00000D23 ???? dpb_dir_sector DW ? ; Starting record of directory 0 00000D25 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 00000D29 ?? dpb_media DB ? ; Media byte 0 00000D2A ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <2> ; check the first time this DPB is used 0 00000D2B ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 00000D2F ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 00000D31 ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <2> dpb ENDS 28 <2> 29 <2> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <2> 31 <2> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <2> ; ; 33 <2> ; C A V E A T P R O G R A M M E R ; 34 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 146 <1> 147 <1> %include "curdir.mac" 1 <2> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 3 <2> BREAK 4 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <2> ; C A V E A T P R O G R A M M E R ; 6 <2> ; ; 7 <2> ; CDS items are used bu the internal routines to store cluster numbers and ; 8 <2> ; network identifiers for each logical name. The ID field is used dually, ; 9 <2> ; both as net ID and for a cluster number for local devices. In the case ; 10 <2> ; of local devices, the cluster number will be -1 if there is a potential ; 11 <2> ; of the disk being changed or if the path must be recracked. The END ; 12 <2> ; field is the location of the end of the definition. No .. is allowed ; 13 <2> ; past this point ; 14 <2> 15 <2> DIRSTRLEN EQU 64+3 ; Max length in bytes of directory strings 16 <2> TEMPLEN EQU DIRSTRLEN*2 17 <2> 18 <2> curdir_list STRUC 19 00000000 <2> curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 0 00000D55 ???? curdir_flags DW ? ; various flags 0 00000D57 ???????? curdir_devptr DD ? ; local pointer to DPB or net device 0 00000D5B ???? curdir_ID DW ? ; cluster of current dir (net ID) 0 00000D5D ???? DW ? 0 00000D5F ???? curdir_user_word DW ? 0 00000D61 ???? curdir_end DW ? ; end of assignment 0 00000D63 ?? curdir_type DB ? ; IFS drive (2=ifs, 4=netuse) 0 00000D64 ???????? curdir_ifs_hdr DD ? ; Ptr to File System Header 0 00000D68 ???? curdir_fsda DB 2 DUP (?) ; File System Dependent Data Area 29 <2> curdir_list ENDS 30 <2> 31 <2> curdirLen EQU curdir_list_struc_size ; Needed for screwed up 32 <2> ; ASM87 which doesn't allow 33 <2> ; Size directive as a macro 34 <2> ; argument 35 <2> labelsize curdir_netID, dword, curdir_ID 36 <2> 37 <2> ;Flag word masks 38 <2> curdir_isnet EQU 1000000000000000B 39 <2> curdir_isifs EQU 1000000000000000B ; DOS 4.00 40 <2> curdir_inuse EQU 0100000000000000B 41 <2> curdir_splice EQU 0010000000000000B 42 <2> curdir_local EQU 0001000000000000B 43 <2> ; ; 44 <2> ; C A V E A T P R O G R A M M E R ; 45 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 148 <1> 149 <1> %include "cpmfcb.mac" 1 <2> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 3 <2> ;BREAK 4 <2> 5 <2> ; 6 <2> ; Field definition for FCBs 7 <2> ; The FCB has the following structure: 8 <2> ; 9 <2> ; +---------------------------+ 10 <2> ; | Drive indicator(byte) | 11 <2> ; +---------------------------+ 12 <2> ; | Filename (8 chars) | 13 <2> ; +---------------------------+ 14 <2> ; | Extension (3 chars) | 15 <2> ; +---------------------------+ 16 <2> ; | Current Extent(word) | 17 <2> ; +---------------------------+ 18 <2> ; | Record size (word) | 19 <2> ; +---------------------------+ 20 <2> ; | File Size (2 words) | 21 <2> ; +---------------------------+ 22 <2> ; | Date of write | 23 <2> ; +---------------------------+ 24 <2> ; | Time of write | 25 <2> ; +---------------------------+ 26 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 27 <2> ; C A V E A T P R O G R A M M E R ; 28 <2> ; ; 29 <2> ; +---------------------------+ 30 <2> ; | 8 bytes reserved | 31 <2> ; +---------------------------+ 32 <2> ; ; 33 <2> ; C A V E A T P R O G R A M M E R ; 34 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 35 <2> ; | next record number | 36 <2> ; +---------------------------+ 37 <2> ; | random record number | 38 <2> ; +---------------------------+ 39 <2> ; 40 <2> 41 <2> sys_fcb STRUC 0 00000D12 ?? fcb_drive DB ? 0 00000D13 ???????????????? fcb_name DB 8 DUP (?) 0 00000D1B ?????? fcb_ext DB 3 DUP (?) 0 00000D1E ???? fcb_EXTENT DW ? 0 00000D20 ???? fcb_RECSIZ DW ? ; Size of record (user settable) 0 00000D22 ???? fcb_FILSIZ DW ? ; Size of file in bytes; used with the 48 <2> ; following word 0 00000D24 ???? fcb_DRVBP DW ? ; BP for SEARCH FIRST and SEARCH NEXT 0 00000D26 ???? fcb_FDATE DW ? ; Date of last writing 0 00000D28 ???? fcb_FTIME DW ? ; Time of last writing 52 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 53 <2> ; C A V E A T P R O G R A M M E R ; 54 <2> ; ; 0 00000D2A ???????????????? fcb_reserved DB 8 DUP (?) ; RESERVED 56 <2> ; ; 57 <2> ; C A V E A T P R O G R A M M E R ; 58 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D32 ?? fcb_NR DB ? ; Next record 0 00000D33 ???????? fcb_RR DB 4 DUP (?) ; Random record 61 <2> sys_fcb ENDS 62 <2> 63 <2> FILDIRENT equ fcb_FILSIZ ; Used only by SEARCH FIRST and SEARCH 64 <2> ; NEXT 65 <2> 66 <2> labelsize fcb_sfn, byte, fcb_reserved 67 <2> 68 <2> ; Note that fcb_net_handle, fcb_nsl_drive, fcb_nsld_drive and fcb_l_drive 69 <2> ; all must point to the same byte. Otherwise, the FCBRegen will fail. 70 <2> ; NOTE about this byte (fcb_nsl_drive) 71 <2> ; The high two bits of this byte are used as follows to indicate the FCB type 72 <2> ; 00 means a local file or device with sharing loaded 73 <2> ; 10 means a remote (network) file 74 <2> ; 01 means a local file with no sharing loaded 75 <2> ; 11 means a local device with no sharing loaded 76 <2> 77 <2> ; 78 <2> ; Network FCB 79 <2> ; 80 <2> labelsize fcb_net_drive, byte, fcb_reserved+1 81 <2> labelsize fcb_net_handle, word, fcb_reserved+2 82 <2> labelsize fcb_netID, dword, fcb_reserved+4 83 <2> 84 <2> ; 85 <2> ; No sharing local file FCB 86 <2> ; 87 <2> labelsize fcb_nsl_drive, byte, fcb_reserved+1 88 <2> labelsize fcb_nsl_bits, byte, fcb_reserved+2 89 <2> labelsize fcb_nsl_firclus, word, fcb_reserved+3 90 <2> labelsize fcb_nsl_dirsec, word, fcb_reserved+5 91 <2> labelsize fcb_nsl_dirpos, byte, fcb_reserved+7 92 <2> 93 <2> ; 94 <2> ; No sharing local device FCB 95 <2> ; 96 <2> labelsize fcb_nsld_drive, byte, fcb_reserved+1 97 <2> labelsize fcb_nsld_drvptr, dword, fcb_reserved+2 98 <2> 99 <2> ; 100 <2> ; Sharing local FCB 101 <2> ; 102 <2> labelsize fcb_l_drive, byte, fcb_reserved+1 103 <2> labelsize fcb_l_firclus, word, fcb_reserved+2 104 <2> labelsize fcb_l_mfs, word, fcb_reserved+4 105 <2> labelsize fcb_l_attr, byte, fcb_reserved+6 106 <2> 107 <2> ; 108 <2> ; Bogusness: the four cases are: 109 <2> ; 110 <2> ; local file 00 111 <2> ; local device 40 112 <2> ; local sharing C0 113 <2> ; network 80 114 <2> ; 115 <2> ; Since sharing and network collide, we cannot use a test instruction for 116 <2> ; deciding whether a network or a share check in involved 117 <2> ; 118 <2> FCBDEVICE EQU 040h 119 <2> FCBNETWORK EQU 080h 120 <2> FCBSHARE EQU 0C0h 121 <2> 122 <2> ; FCBSPECIAL must be able to mask off both net and share 123 <2> FCBSPECIAL EQU 080h 124 <2> FCBMASK EQU 0C0h 150 <1> 151 <1> %include "find.mac" 1 <2> ; SCCSID = @(#)find.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)find.asm 1.1 85/04/10 3 <2> Break 4 <2> 5 <2> find_buf STRUC 6 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 7 <2> ; C A V E A T P R O G R A M M E R ; 8 <2> ; ; 0 00000D12 ?? find_buf_drive DB ? ; drive of search 10 00000001 <2> find_buf_name DB 11 DUP (?) ; formatted name 0 00000D1E ?? find_buf_sattr DB ? ; attribute of search 0 00000D1F ???? find_buf_LastEnt DW ? ; LastEnt 0 00000D21 ???? find_buf_DirStart DW ? ; DirStart 0 00000D23 ???????? find_buf_NetID DB 4 DUP (?) ; Reserved for NET 15 <2> ; ; 16 <2> ; C A V E A T P R O G R A M M E R ; 17 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 18 <2> 0 00000D27 ?? find_buf_attr DB ? ; attribute found 0 00000D28 ???? find_buf_time DW ? ; time 0 00000D2A ???? find_buf_date DW ? ; date 0 00000D2C ???? find_buf_size_l DW ? ; low(size) 0 00000D2E ???? find_buf_size_h DW ? ; high(size) 24 0000001E <2> find_buf_pname DB 13 DUP (?) ; packed name 25 <2> find_buf ENDS 152 <1> 153 <1> %include "pdb.mac" 1 <2> ; SCCSID = @(#)pdb.asm 1.1 85/04/10 2 <2> BREAK 3 <2> 4 <2> ; 5 <2> ; Process data block (otherwise known as program header) 6 <2> ; 7 <2> 8 <2> FilPerProc EQU 20 9 <2> 10 <2> Process_data_block STRUC 0 00000D12 ???? PDB_Exit_Call DW ? ; INT int_abort system terminate 0 00000D14 ???? PDB_block_len DW ? ; size of execution block 0 00000D16 ?? DB ? 0 00000D17 ?????????? PDB_CPM_Call DB 5 DUP (?) ; ancient call to system 0 00000D1C ???????? PDB_Exit DD ? ; pointer to exit routine 0 00000D20 ???????? PDB_Ctrl_C DD ? ; pointer to ^C routine 0 00000D24 ???????? PDB_Fatal_abort DD ? ; pointer to fatal error 18 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 <2> ; C A V E A T P R O G R A M M E R ; 20 <2> ; ; 0 00000D28 ???? PDB_Parent_PID DW ? ; PID of parent (terminate PID) 22 00000018 <2> PDB_JFN_Table DB FilPerProc DUP (?) 23 <2> ; indices into system table 24 <2> ; ; 25 <2> ; C A V E A T P R O G R A M M E R ; 26 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D3E ???? PDB_environ DW ? ; seg addr of environment 28 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 29 <2> ; C A V E A T P R O G R A M M E R ; 30 <2> ; ; 0 00000D40 ???????? PDB_User_stack DD ? ; stack of self during system calls 0 00000D44 ???? PDB_JFN_Length DW ? ; number of handles allowed 0 00000D46 ???????? PDB_JFN_Pointer DD ? ; pointer to JFN table 0 00000D4A ???????? PDB_Next_PDB DD ? ; pointer to nested PDB's 35 0000003C <2> PDB_PAD1 DB 14h DUP (?) 36 <2> ; ; 37 <2> ; C A V E A T P R O G R A M M E R ; 38 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D62 ?????????? PDB_Call_system DB 5 DUP (?) ; portable method of system call 40 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <2> ; C A V E A T P R O G R A M M E R ; 42 <2> ; ; 0 00000D67 ?????????????? PDB_PAD2 DB 7h DUP (?) 44 <2> ; ; 45 <2> ; C A V E A T P R O G R A M M E R ; 46 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 47 <2> Process_data_block ENDS 48 <2> 49 <2> labelsize PDB_InterCon, byte, PDB_PAD1 ; 2/12/KK 50 <2> labelsize PDB_Append, byte, PDB_PAD1+1 ; 2/12/KK 154 <1> 155 <1> %include "exe.mac" 1 <2> ; SCCSID = @(#)exe.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)exe.asm 1.1 85/04/10 3 <2> BREAK 4 <2> ; 5 <2> ; EXEC arg block - load/go program 6 <2> ; 7 <2> 8 <2> ; 9 <2> ; The following get used as arguments to the EXEC system call. They indicate 10 <2> ; whether or not the program is executed or whether or not a program header 11 <2> ; gets created. 12 <2> ; 13 <2> exec_func_no_execute EQU 1 ; no execute bit 14 <2> exec_func_overlay EQU 2 ; overlay bit 15 <2> 16 <2> Exec0 STRUC 0 00000D12 ???? Exec0_environ DW ? ; seg addr of environment 0 00000D14 ???????? Exec0_com_line DD ? ; pointer to asciz command line 0 00000D18 ???????? Exec0_5C_FCB DD ? ; default fcb at 5C 0 00000D1C ???????? Exec0_6C_FCB DD ? ; default fcb at 6C 21 <2> Exec0 ENDS 22 <2> 23 <2> Exec1 STRUC 0 00000D12 ???? Exec1_environ DW ? ; seg addr of environment 0 00000D14 ???????? Exec1_com_line DD ? ; pointer to asciz command line 0 00000D18 ???????? Exec1_5C_FCB DD ? ; default fcb at 5C 0 00000D1C ???????? Exec1_6C_FCB DD ? ; default fcb at 6C 0 00000D20 ???? Exec1_SP DW ? ; stack pointer of program 0 00000D22 ???? Exec1_SS DW ? ; stack seg register of program 0 00000D24 ???? Exec1_IP DW ? ; entry point IP 0 00000D26 ???? Exec1_CS DW ? ; entry point CS 32 <2> Exec1 ENDS 33 <2> 34 <2> Exec3 STRUC 0 00000D12 ???? Exec3_load_addr DW ? ; seg address of load point 0 00000D14 ???? Exec3_reloc_fac DW ? ; relocation factor 37 <2> Exec3 ENDS 38 <2> 39 <2> ; 40 <2> ; Exit codes in upper byte 41 <2> ; 42 <2> Exit_terminate EQU 0 43 <2> Exit_abort EQU 0 44 <2> Exit_Ctrl_C EQU 1 45 <2> Exit_Hard_Error EQU 2 46 <2> Exit_Keep_process EQU 3 47 <2> 48 <2> ; 49 <2> ; EXE file header 50 <2> ; 51 <2> 52 <2> EXE_file STRUC 0 00000D12 ???? exe_signature DW ? ; must contain 4D5A (yay zibo!) 0 00000D14 ???? exe_len_mod_512 DW ? ; low 9 bits of length 0 00000D16 ???? exe_pages DW ? ; number of 512b pages in file 0 00000D18 ???? exe_rle_count DW ? ; count of reloc entries 0 00000D1A ???? exe_par_dir DW ? ; number of paragraphs before image 0 00000D1C ???? exe_min_BSS DW ? ; minimum number of para of BSS 0 00000D1E ???? exe_max_BSS DW ? ; max number of para of BSS 0 00000D20 ???? exe_SS DW ? ; stack of image 0 00000D22 ???? exe_SP DW ? ; SP of image 0 00000D24 ???? exe_chksum DW ? ; checksum of file (ignored) 0 00000D26 ???? exe_IP DW ? ; IP of entry 0 00000D28 ???? exe_CS DW ? ; CS of entry 0 00000D2A ???? exe_rle_table DW ? ; byte offset of reloc table 0 00000D2C ???? exe_iov DW ? ; overlay number (0 for root) 0 00000D2E ???????? exe_sym_tab DD ? ; offset of symbol table in file 68 <2> EXE_file ENDS 69 <2> 70 <2> exe_valid_signature EQU 5A4Dh 71 <2> exe_valid_old_signature EQU 4D5Ah 72 <2> 73 <2> symbol_entry STRUC 0 00000D12 ???????? sym_value DD ? 0 00000D16 ???? sym_type DW ? 0 00000D18 ?? sym_len DB ? 77 00000007 <2> sym_name DB 255 dup (?) 78 <2> symbol_entry ENDS 156 <1> 157 <1> %include "sf.mac" 1 <2> ; SCCSID = @(#)sf.asm 1.1 85/04/10 2 <2> BREAK 3 <2> ; 4 <2> ; AN000 version 4.00 Jan. 1988 5 <2> ; AN003 PTM 3680 -- make NAME offset the same as before (<=3.30) 6 <2> ; AN009 PTM 3839 reorder SFT for MS WINDOWS 7 <2> 8 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 9 <2> ; C A V E A T P R O G R A M M E R ; 10 <2> ; ; 11 <2> ; 12 <2> ; system file table 13 <2> ; 14 <2> 15 <2> SF STRUC 0 00000D12 ???????? SFLink DD ? 0 00000D16 ???? SFCount DW ? ; number of entries 0 00000D18 ???? SFTable DW ? ; beginning of array of the following 19 <2> SF ENDS 20 <2> 21 <2> ; 22 <2> ; system file table entry 23 <2> ; 24 <2> 25 <2> sf_entry STRUC 0 00000D12 ???? sf_ref_count DW ? ; number of processes sharing entry 27 <2> ; if FCB then ref count 0 00000D14 ???? sf_mode DW ? ; mode of access or high bit on if FCB 0 00000D16 ?? sf_attr DB ? ; attribute of file 0 00000D17 ???? sf_flags DW ? ;Bits 8-15 31 <2> ; Bit 15 = 1 if remote file 32 <2> ; = 0 if local file or device 33 <2> ; Bit 14 = 1 if date/time is not to be 34 <2> ; set from clock at CLOSE. Set by 35 <2> ; FILETIMES and FCB_CLOSE. Reset by 36 <2> ; other reseters of the dirty bit 37 <2> ; (WRITE) 38 <2> ; Bit 13 = Pipe bit (reserved) 39 <2> ; 40 <2> ; Bits 0-7 (old FCB_devid bits) 41 <2> ; If remote file or local file, bit 42 <2> ; 6=0 if dirty Device ID number, bits 43 <2> ; 0-5 if local file. 44 <2> ; bit 7=0 for local file, bit 7 45 <2> ; =1 for local I/O device 46 <2> ; If local I/O device, bit 6=0 if EOF (input) 47 <2> ; Bit 5=1 if Raw mode 48 <2> ; Bit 0=1 if console input device 49 <2> ; Bit 1=1 if console output device 50 <2> ; Bit 2=1 if null device 51 <2> ; Bit 3=1 if clock device 0 00000D19 ???????? sf_devptr DD ? ; Points to DPB if local file, points 53 <2> ; to device header if local device, 54 <2> ; points to net device header if 55 <2> ; remote 0 00000D1D ???? sf_firclus DW ? ; First cluster of file (bit 15 = 0) 0 00000D1F ???? sf_time DW ? ; Time associated with file 0 00000D21 ???? sf_date DW ? ; Date associated with file 0 00000D23 ???????? sf_size DD ? ; Size associated with file 0 00000D27 ???????? sf_position DD ? ; Read/Write pointer or LRU count for FCBs 61 <2> ; 62 <2> ; Starting here, the next 7 bytes may be used by the file system to store an 63 <2> ; ID 64 <2> ; 0 00000D2B ???? sf_cluspos DW ? ; Position of last cluster accessed 0 00000D2D ???????? sf_dirsec DD ? ; Sector number of directory sector for 67 <2> ; for this file 0 00000D31 ?? sf_dirpos DB ? ; Offset of this entry in the above 69 <2> ; 70 <2> ; End of 7 bytes of file-system specific info. 71 <2> ; 72 00000020 <2> sf_name DB 11 DUP (?) ; 11 character name that is in the 73 <2> ; directory entry. This is used by 74 <2> ; close to detect file deleted and 75 <2> ; disk changed errors. 76 <2> 77 <2> ; SHARING INFO 0 00000D3D ???????? sf_chain DD ? ; link to next SF 0 00000D41 ???? sf_UID DW ? 0 00000D43 ???? sf_PID DW ? 0 00000D45 ???? sf_MFT DW ? 0 00000D47 ???? sf_lstclus DW ? ;AN009; Last cluster accessed 0 00000D49 ???????? sf_IFS_HDR DD ? 84 <2> sf_entry ENDS 85 <2> 86 <2> labelsize sf_fsda, byte, sf_cluspos ;DOS 4.00 87 <2> labelsize sf_serial_ID, word, sf_firclus ;DOS 4.00 88 <2> labelsize sf_netid, byte, sf_cluspos 89 <2> labelsize sf_OpenAge, word, sf_position+2 90 <2> labelsize sf_LRU, word, sf_position 91 <2> 92 <2> sf_default_number EQU 5h 93 <2> 94 <2> ; 95 <2> ; Note that we need to mark an SFT as being busy for OPEN/CREATE. This is 96 <2> ; because an INT 24 may prevent us from 'freeing' it. We mark this as such 97 <2> ; by placing a -1 in the ref_count field. 98 <2> ; 99 <2> 100 <2> sf_busy EQU -1 101 <2> 102 <2> 103 <2> ; mode mask for FCB detection 104 <2> sf_isfcb EQU 1000000000000000B 105 <2> 106 <2> ; Flag word masks 107 <2> sf_isnet EQU 1000000000000000B 108 <2> sf_close_nodate EQU 0100000000000000B 109 <2> sf_pipe EQU 0010000000000000B 110 <2> sf_no_inherit EQU 0001000000000000B 111 <2> sf_net_spool EQU 0000100000000000B 112 <2> Handle_Fail_I24 EQU 0000000100000000B ;BIT 8 - DISK FULL I24 ERROR 113 <2> 114 <2> ; Local file/device flag masks 115 <2> devid_file_clean EQU 40h ; true if file and not written 116 <2> devid_file_mask_drive EQU 3Fh ; mask for drive number 117 <2> 118 <2> devid_device EQU 80h ; true if a device 119 <2> devid_device_EOF EQU 40h ; true if end of file reached 120 <2> devid_device_raw EQU 20h ; true if in raw mode 121 <2> devid_device_special EQU 10h ; true if special device 122 <2> devid_device_clock EQU 08h ; true if clock device 123 <2> devid_device_null EQU 04h ; true if null device 124 <2> devid_device_con_out EQU 02h ; true if console output 125 <2> devid_device_con_in EQU 01h ; true if consle input 126 <2> ; ; 127 <2> ; C A V E A T P R O G R A M M E R ; 128 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 129 <2> 130 <2> ; 131 <2> ; structure of devid field as returned by IOCTL is: 132 <2> ; 133 <2> ; BIT 7 6 5 4 3 2 1 0 134 <2> ; |---|---|---|---|---|---|---|---| 135 <2> ; | I | E | R | S | I | I | I | I | 136 <2> ; | S | O | A | P | S | S | S | S | 137 <2> ; | D | F | W | E | C | N | C | C | 138 <2> ; | E | | | C | L | U | O | I | 139 <2> ; | V | | | L | K | L | T | N | 140 <2> ; |---|---|---|---|---|---|---|---| 141 <2> ; ISDEV = 1 if this channel is a device 142 <2> ; = 0 if this channel is a disk file 143 <2> ; 144 <2> ; If ISDEV = 1 145 <2> ; 146 <2> ; EOF = 0 if End Of File on input 147 <2> ; RAW = 1 if this device is in Raw mode 148 <2> ; = 0 if this device is cooked 149 <2> ; ISCLK = 1 if this device is the clock device 150 <2> ; ISNUL = 1 if this device is the null device 151 <2> ; ISCOT = 1 if this device is the console output 152 <2> ; ISCIN = 1 if this device is the console input 153 <2> ; 154 <2> ; If ISDEV = 0 155 <2> ; EOF = 0 if channel has been written 156 <2> ; Bits 0-5 are the block device number for 157 <2> ; the channel (0 = A, 1 = B, ...) 158 <2> ; 159 <2> devid_ISDEV EQU 80h 160 <2> devid_EOF EQU 40h 161 <2> devid_RAW EQU 20h 162 <2> devid_SPECIAL EQU 10H 163 <2> devid_ISCLK EQU 08h 164 <2> devid_ISNUL EQU 04h 165 <2> devid_ISCOT EQU 02h 166 <2> devid_ISCIN EQU 01h 167 <2> 168 <2> devid_block_dev EQU 1Fh ; mask for block device number 158 <1> 159 <1> %include "arena.mac" 1 <2> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <2> ;BREAK 3 <2> 4 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <2> ; C A V E A T P R O G R A M M E R ; 6 <2> ; ; 7 <2> ; 8 <2> ; arena item 9 <2> ; 10 <2> arena STRUC 0 00000D12 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00000D13 ???? arena_owner DW ? ; owner of arena item 0 00000D15 ???? arena_size DW ? ; size in paragraphs of item 0 00000D17 ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00000D1A ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <2> arena ENDS 17 <2> 18 <2> ; 19 <2> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <2> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <2> ; them and change ALLOC.ASM. 22 <2> 23 <2> arena_owner_system EQU 0 ; free block indication 24 <2> 25 <2> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <2> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <2> ; ; 28 <2> ; C A V E A T P R O G R A M M E R ; 29 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <2> 160 <1> 161 <1> %include "intnat.mac" 1 <2> ; SCCSID = @(#)intnat.asm 1.1 85/04/10 2 <2> BREAK 3 <2> 4 <2> ; 5 <2> ; Current structure of the data returned by the international call 6 <2> ; 7 <2> internat_block STRUC 0 00000D12 ???? Date_tim_format DW ? ; 0-USA, 1-EUR, 2-JAP 0 00000D14 ?? Currency_sym DB ? ; Currency Symbol 5 bytes 0 00000D15 ?? DB ? 0 00000D16 ?? DB ? 0 00000D17 ?? DB ? 0 00000D18 ?? DB ? 0 00000D19 ?? Thous_sep DB ? ; Thousands separator 2 bytes 0 00000D1A ?? DB ? 0 00000D1B ?? Decimal_sep DB ? ; Decimal separator 2 bytes 0 00000D1C ?? DB ? 0 00000D1D ?? Date_sep DB ? ; Date separator 2 bytes 0 00000D1E ?? DB ? 0 00000D1F ?? Time_sep DB ? ; Decimal separator 2 bytes 0 00000D20 ?? DB ? 0 00000D21 ?? Bit_field DB ? ; Bit values 23 <2> ; Bit 0 = 0 if currency symbol first 24 <2> ; = 1 if currency symbol last 25 <2> ; Bit 1 = 0 if No space after currency symbol 26 <2> ; = 1 if space after currency symbol 0 00000D22 ?? Currency_cents DB ? ; Number of places after currency dec point 0 00000D23 ?? Time_24 DB ? ; 1 if 24 hour time, 0 if 12 hour time 0 00000D24 ???? Map_call DW ? ; Address of case mapping call (DWORD) 0 00000D26 ???? DW ? ; THIS IS TWO WORDS SO IT CAN BE INITIALIZED 31 <2> ; in pieces. 0 00000D28 ?? Data_sep DB ? ; Data list separator character 0 00000D29 ?? DB ? 34 <2> internat_block ENDS 35 <2> 36 <2> ; 37 <2> ; Max size of the block returned by the INTERNATIONAL call 38 <2> ; 39 <2> internat_block_max EQU 32 162 <1> 163 <1> %include "mi.mac" 1 <2> ; SCCSID = @(#)mi.asm 1.1 85/04/10 2 <2> BREAK 3 <2> 4 <2> mi_INT EQU 0CDh 5 <2> mi_Long_JMP EQU 0EAh 6 <2> mi_Long_CALL EQU 09Ah 7 <2> mi_Long_RET EQU 0CBh 8 <2> mi_Near_RET EQU 0C3h 9 <2> 10 <2> ; xxxxoditszxaxpxc 11 <2> f_Overflow EQU 0000100000000000B 12 <2> f_Direction EQU 0000010000000000B 13 <2> f_Interrupt EQU 0000001000000000B 14 <2> f_Trace EQU 0000000100000000B 15 <2> f_Sign EQU 0000000010000000B 16 <2> f_Zero EQU 0000000001000000B 17 <2> f_Aux EQU 0000000000010000B 18 <2> f_Parity EQU 0000000000000100B 19 <2> f_Carry EQU 0000000000000001B 164 <1> 165 <1> fChk equ 1 166 <1> fDelim equ 2 167 <1> fSpChk equ 4 168 <1> fFCB equ 8 169 <1> 170 <1> %include "filemode.mac" 1 <2> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 3 <2> BREAK 4 <2> 5 <2> stdin EQU 0 6 <2> stdout EQU 1 7 <2> stderr EQU 2 8 <2> stdaux EQU 3 9 <2> stdprn EQU 4 10 <2> 11 <2> BREAK 12 <2> 13 <2> access_mask EQU 0FH 14 <2> open_for_read EQU 00h 15 <2> open_for_write EQU 01h 16 <2> open_for_both EQU 02h 17 <2> 18 <2> sharing_mask EQU 0F0H 19 <2> sharing_compat EQU 000H 20 <2> sharing_deny_both EQU 010H 21 <2> sharing_deny_write EQU 020H 22 <2> sharing_deny_read EQU 030H 23 <2> sharing_deny_none EQU 040H 24 <2> sharing_net_FCB EQU 070h 25 <2> sharing_no_inherit EQU 080H 26 <2> 27 <2> BREAK 28 <2> 29 <2> no_code_page_check EQU 0100H 30 <2> int_24_error EQU 2000H 31 <2> auto_commit_write EQU 4000H 32 <2> ext_open_on EQU 01H 33 <2> ext_file_not_exists EQU 04H 34 <2> ext_open_I24_off EQU 02H 35 <2> io_mode_id EQU 00000010B 36 <2> reserved_bits_mask EQU 0FE00H 37 <2> exists_mask EQU 0FH 38 <2> not_exists_mask EQU 0F0H 39 <2> action_opened EQU 01H 40 <2> action_created_opened EQU 02H 41 <2> action_replaced_opened EQU 03H 42 <2> 43 <2> ext_exists_open EQU 01H 44 <2> ext_exists_fail EQU 0H 45 <2> ext_nexists_create EQU 10H 46 <2> 47 <2> 48 <2> 49 <2> ext_open_parm struc 0 00000D12 ???????? ext_set_list dd ? 0 00000D16 ???? ext_num_of_parm dw ? 52 <2> ext_open_parm ends 53 <2> 54 <2> 55 <2> 171 <1> 172 <1> %include "error.mac" 1 <2> ; SCCSID = @(#)error.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)error.asm 1.1 85/04/10 3 <2> BREAK 4 <2> 5 <2> ; 6 <2> ; XENIX calls all return error codes through AX. If an error occurred then 7 <2> ; the carry bit will be set and the error code is in AX. If no error occurred 8 <2> ; then the carry bit is reset and AX contains returned info. 9 <2> ; 10 <2> ; Since the set of error codes is being extended as we extend the operating 11 <2> ; system, we have provided a means for applications to ask the system for a 12 <2> ; recommended course of action when they receive an error. 13 <2> ; 14 <2> ; The GetExtendedError system call returns a universal error, an error 15 <2> ; location and a recommended course of action. The universal error code is 16 <2> ; a symptom of the error REGARDLESS of the context in which GetExtendedError 17 <2> ; is issued. 18 <2> ; 19 <2> 20 <2> ; 21 <2> ; These are the 2.0 error codes 22 <2> ; 23 <2> error_invalid_function EQU 1 24 <2> error_file_not_found EQU 2 25 <2> error_path_not_found EQU 3 26 <2> error_too_many_open_files EQU 4 27 <2> error_access_denied EQU 5 28 <2> error_invalid_handle EQU 6 29 <2> error_arena_trashed EQU 7 30 <2> error_not_enough_memory EQU 8 31 <2> error_invalid_block EQU 9 32 <2> error_bad_environment EQU 10 33 <2> error_bad_format EQU 11 34 <2> error_invalid_access EQU 12 35 <2> error_invalid_data EQU 13 36 <2> ;**** reserved EQU 14 ; ***** 37 <2> error_invalid_drive EQU 15 38 <2> error_current_directory EQU 16 39 <2> error_not_same_device EQU 17 40 <2> error_no_more_files EQU 18 41 <2> ; 42 <2> ; These are the universal int 24 mappings for the old INT 24 set of errors 43 <2> ; 44 <2> error_write_protect EQU 19 45 <2> error_bad_unit EQU 20 46 <2> error_not_ready EQU 21 47 <2> error_bad_command EQU 22 48 <2> error_CRC EQU 23 49 <2> error_bad_length EQU 24 50 <2> error_Seek EQU 25 51 <2> error_not_DOS_disk EQU 26 52 <2> error_sector_not_found EQU 27 53 <2> error_out_of_paper EQU 28 54 <2> error_write_fault EQU 29 55 <2> error_read_fault EQU 30 56 <2> error_gen_failure EQU 31 57 <2> ; 58 <2> ; These are the new 3.0 error codes reported through INT 24 59 <2> ; 60 <2> error_sharing_violation EQU 32 61 <2> error_lock_violation EQU 33 62 <2> error_wrong_disk EQU 34 63 <2> error_FCB_unavailable EQU 35 64 <2> error_sharing_buffer_exceeded EQU 36 65 <2> error_Code_Page_Mismatched EQU 37 ; DOS 4.00 ;AN000; 66 <2> error_handle_EOF EQU 38 ; DOS 4.00 ;AN000; 67 <2> error_handle_Disk_Full EQU 39 ; DOS 4.00 ;AN000; 68 <2> ; 69 <2> ; New OEM network-related errors are 50-79 70 <2> ; 71 <2> error_not_supported EQU 50 72 <2> ; 73 <2> ; End of INT 24 reportable errors 74 <2> ; 75 <2> error_file_exists EQU 80 76 <2> error_DUP_FCB EQU 81 ; ***** 77 <2> error_cannot_make EQU 82 78 <2> error_FAIL_I24 EQU 83 79 <2> ; 80 <2> ; New 3.0 network related error codes 81 <2> ; 82 <2> error_out_of_structures EQU 84 83 <2> error_Already_assigned EQU 85 84 <2> error_invalid_password EQU 86 85 <2> error_invalid_parameter EQU 87 86 <2> error_NET_write_fault EQU 88 87 <2> error_sys_comp_not_loaded EQU 90 ; DOS 4.00 ;AN000; 88 <2> 89 <2> BREAK 90 <2> 91 <2> error_I24_write_protect EQU 0 92 <2> error_I24_bad_unit EQU 1 93 <2> error_I24_not_ready EQU 2 94 <2> error_I24_bad_command EQU 3 95 <2> error_I24_CRC EQU 4 96 <2> error_I24_bad_length EQU 5 97 <2> error_I24_Seek EQU 6 98 <2> error_I24_not_DOS_disk EQU 7 99 <2> error_I24_sector_not_found EQU 8 100 <2> error_I24_out_of_paper EQU 9 101 <2> error_I24_write_fault EQU 0Ah 102 <2> error_I24_read_fault EQU 0Bh 103 <2> error_I24_gen_failure EQU 0Ch 104 <2> ; NOTE: Code 0DH is used by MT-DOS. 105 <2> error_I24_wrong_disk EQU 0Fh 106 <2> 107 <2> ; THE FOLLOWING ARE MASKS FOR THE AH REGISTER ON Int 24 108 <2> 109 <2> Allowed_FAIL EQU 00001000B 110 <2> Allowed_RETRY EQU 00010000B 111 <2> Allowed_IGNORE EQU 00100000B 112 <2> ;NOTE: ABORT is ALWAYS allowed 113 <2> 114 <2> I24_operation EQU 00000001B ;Z if READ,NZ if Write 115 <2> I24_area EQU 00000110B ; 00 if DOS 116 <2> ; 01 if FAT 117 <2> ; 10 if root DIR 118 <2> ; 11 if DATA 119 <2> I24_class EQU 10000000B ;Z if DISK, NZ if FAT or char 120 <2> 121 <2> BREAK 122 <2> 123 <2> ; Values for error CLASS 124 <2> 125 <2> errCLASS_OutRes EQU 1 ; Out of Resource 126 <2> errCLASS_TempSit EQU 2 ; Temporary Situation 127 <2> errCLASS_Auth EQU 3 ; Permission problem 128 <2> errCLASS_Intrn EQU 4 ; Internal System Error 129 <2> errCLASS_HrdFail EQU 5 ; Hardware Failure 130 <2> errCLASS_SysFail EQU 6 ; System Failure 131 <2> errCLASS_Apperr EQU 7 ; Application Error 132 <2> errCLASS_NotFnd EQU 8 ; Not Found 133 <2> errCLASS_BadFmt EQU 9 ; Bad Format 134 <2> errCLASS_Locked EQU 10 ; Locked 135 <2> errCLASS_Media EQU 11 ; Media Failure 136 <2> errCLASS_Already EQU 12 ; Collision with Existing Item 137 <2> errCLASS_Unk EQU 13 ; Unknown/other 138 <2> 139 <2> ; Values for error ACTION 140 <2> 141 <2> errACT_Retry EQU 1 ; Retry 142 <2> errACT_DlyRet EQU 2 ; Delay Retry, retry after pause 143 <2> errACT_User EQU 3 ; Ask user to regive info 144 <2> errACT_Abort EQU 4 ; abort with clean up 145 <2> errACT_Panic EQU 5 ; abort immediately 146 <2> errACT_Ignore EQU 6 ; ignore 147 <2> errACT_IntRet EQU 7 ; Retry after User Intervention 148 <2> 149 <2> ; Values for error LOCUS 150 <2> 151 <2> errLOC_Unk EQU 1 ; No appropriate value 152 <2> errLOC_Disk EQU 2 ; Random Access Mass Storage 153 <2> errLOC_Net EQU 3 ; Network 154 <2> errLOC_SerDev EQU 4 ; Serial Device 155 <2> errLOC_Mem EQU 5 ; Memory 173 <1> 174 <1> %include "syscall.mac" 1 <2> ; SCCSID = @(#)syscall.asm 1.1 85/04/10 2 <2> ;BREAK 3 <2> ;SUBTTL system call definitions 4 <2> ;PAGE 5 <2> 6 <2> Abort EQU 0 ; 0 0 7 <2> Std_Con_Input EQU 1 ; 1 1 8 <2> Std_Con_Output EQU 2 ; 2 2 9 <2> Std_Aux_Input EQU 3 ; 3 3 10 <2> Std_Aux_Output EQU 4 ; 4 4 11 <2> Std_Printer_Output EQU 5 ; 5 5 12 <2> Raw_Con_IO EQU 6 ; 6 6 13 <2> Raw_Con_Input EQU 7 ; 7 7 14 <2> Std_Con_Input_No_Echo EQU 8 ; 8 8 15 <2> Std_Con_String_Output EQU 9 ; 9 9 16 <2> Std_Con_String_Input EQU 10 ; 10 A 17 <2> Std_Con_Input_Status EQU 11 ; 11 B 18 <2> Std_Con_Input_Flush EQU 12 ; 12 C 19 <2> Disk_Reset EQU 13 ; 13 D 20 <2> Set_Default_Drive EQU 14 ; 14 E 21 <2> FCB_Open EQU 15 ; 15 F 22 <2> FCB_Close EQU 16 ; 16 10 23 <2> Dir_Search_First EQU 17 ; 17 11 24 <2> Dir_Search_Next EQU 18 ; 18 12 25 <2> FCB_Delete EQU 19 ; 19 13 26 <2> FCB_Seq_Read EQU 20 ; 20 14 27 <2> FCB_Seq_Write EQU 21 ; 21 15 28 <2> FCB_Create EQU 22 ; 22 16 29 <2> FCB_Rename EQU 23 ; 23 17 30 <2> Get_Default_Drive EQU 25 ; 25 19 31 <2> Set_DMA EQU 26 ; 26 1A 32 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <2> ; C A V E A T P R O G R A M M E R ; 34 <2> ; ; 35 <2> Get_Default_DPB EQU 31 ; 31 1F 36 <2> ; ; 37 <2> ; C A V E A T P R O G R A M M E R ; 38 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 39 <2> FCB_Random_Read EQU 33 ; 33 21 40 <2> FCB_Random_Write EQU 34 ; 34 22 41 <2> Get_FCB_File_Length EQU 35 ; 35 23 42 <2> Get_FCB_Position EQU 36 ; 36 24 43 <2> Set_Interrupt_Vector EQU 37 ; 37 25 44 <2> Create_Process_Data_Block EQU 38 ; 38 26 45 <2> FCB_Random_Read_Block EQU 39 ; 39 27 46 <2> FCB_Random_Write_Block EQU 40 ; 40 28 47 <2> Parse_File_Descriptor EQU 41 ; 41 29 48 <2> Get_Date EQU 42 ; 42 2A 49 <2> Set_Date EQU 43 ; 43 2B 50 <2> Get_Time EQU 44 ; 44 2C 51 <2> Set_Time EQU 45 ; 45 2D 52 <2> Set_Verify_On_Write EQU 46 ; 46 2E 53 <2> ; Extended functionality group 54 <2> Get_DMA EQU 47 ; 47 2F 55 <2> Get_Version EQU 48 ; 48 30 56 <2> Keep_Process EQU 49 ; 49 31 57 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <2> ; C A V E A T P R O G R A M M E R ; 59 <2> ; ; 60 <2> Get_DPB EQU 50 ; 50 32 61 <2> ; ; 62 <2> ; C A V E A T P R O G R A M M E R ; 63 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 64 <2> Set_CTRL_C_Trapping EQU 51 ; 51 33 65 <2> Get_InDOS_Flag EQU 52 ; 52 34 66 <2> Get_Interrupt_Vector EQU 53 ; 53 35 67 <2> Get_Drive_Freespace EQU 54 ; 54 36 68 <2> Char_Oper EQU 55 ; 55 37 69 <2> International EQU 56 ; 56 38 70 <2> ; Directory Group 71 <2> MKDir EQU 57 ; 57 39 72 <2> RMDir EQU 58 ; 58 3A 73 <2> CHDir EQU 59 ; 59 3B 74 <2> ; File Group 75 <2> Creat EQU 60 ; 60 3C 76 <2> Open EQU 61 ; 61 3D 77 <2> Close EQU 62 ; 62 3E 78 <2> Read EQU 63 ; 63 3F 79 <2> Write EQU 64 ; 64 40 80 <2> Unlink EQU 65 ; 65 41 81 <2> LSeek EQU 66 ; 66 42 82 <2> CHMod EQU 67 ; 67 43 83 <2> IOCtl EQU 68 ; 68 44 84 <2> XDup EQU 69 ; 69 45 85 <2> XDup2 EQU 70 ; 70 46 86 <2> Current_Dir EQU 71 ; 71 47 87 <2> ; Memory Group 88 <2> Alloc EQU 72 ; 72 48 89 <2> Dealloc EQU 73 ; 73 49 90 <2> Setblock EQU 74 ; 74 4A 91 <2> ; Process Group 92 <2> Exec EQU 75 ; 75 4B 93 <2> Exit EQU 76 ; 76 4C 94 <2> WaitProcess EQU 77 ; 77 4D 95 <2> Find_First EQU 78 ; 78 4E 96 <2> ; Special Group 97 <2> Find_Next EQU 79 ; 79 4F 98 <2> ; SPECIAL SYSTEM GROUP 99 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 100 <2> ; C A V E A T P R O G R A M M E R ; 101 <2> ; ; 102 <2> Set_Current_PDB EQU 80 ; 80 50 103 <2> Get_Current_PDB EQU 81 ; 81 51 104 <2> Get_In_Vars EQU 82 ; 82 52 105 <2> SetDPB EQU 83 ; 83 53 106 <2> ; ; 107 <2> ; C A V E A T P R O G R A M M E R ; 108 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 109 <2> Get_Verify_On_Write EQU 84 ; 84 54 110 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 111 <2> ; C A V E A T P R O G R A M M E R ; 112 <2> ; ; 113 <2> Dup_PDB EQU 85 ; 85 55 114 <2> ; ; 115 <2> ; C A V E A T P R O G R A M M E R ; 116 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 117 <2> Rename EQU 86 ; 86 56 118 <2> File_Times EQU 87 ; 87 57 119 <2> AllocOper EQU 88 ; 88 58 120 <2> ; Network extention system calls 121 <2> GetExtendedError EQU 89 ; 89 59 122 <2> CreateTempFile EQU 90 ; 90 5A 123 <2> CreateNewFile EQU 91 ; 91 5B 124 <2> LockOper EQU 92 ; 92 5C Lock and Unlock 125 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 126 <2> ; C A V E A T P R O G R A M M E R ; 127 <2> ; ; 128 <2> ServerCall EQU 93 ; 93 5D CommitAll, ServerDOSCall, 129 <2> ; CloseByName, CloseUser, 130 <2> ; CloseUserProcess, 131 <2> ; GetOpenFileList 132 <2> ; ; 133 <2> ; C A V E A T P R O G R A M M E R ; 134 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 135 <2> UserOper EQU 94 ; 94 5E Get and Set 136 <2> AssignOper EQU 95 ; 95 5F On, Off, Get, Set, Cancel 137 <2> xNameTrans EQU 96 ; 96 60 138 <2> PathParse EQU 97 ; 97 61 139 <2> GetCurrentPSP EQU 98 ; 98 62 140 <2> Hongeul EQU 99 ; 99 63 141 <2> ECS_CALL EQU 99 ; 99 63 ;; DBCS support 142 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 143 <2> ; C A V E A T P R O G R A M M E R ; 144 <2> ; ; 145 <2> Set_Printer_Flag EQU 100 ; 100 64 146 <2> ; ; 147 <2> ; C A V E A T P R O G R A M M E R ; 148 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 149 <2> GetExtCntry EQU 101 ; 101 65 150 <2> GetSetCdPg EQU 102 ; 102 66 151 <2> ExtHandle EQU 103 ; 103 67 152 <2> Commit EQU 104 ; 104 68 153 <2> GetSetMediaID EQU 105 ; 105 69 154 <2> IFS_IOCTL EQU 107 ; 107 6B 155 <2> ExtOpen EQU 108 ; 108 6C 156 <2> ; 157 <2> ; 158 <2> Set_Oem_Handler EQU 248 ; 248 F8 159 <2> OEM_C1 EQU 249 ; 249 F9 160 <2> OEM_C2 EQU 250 ; 250 FA 161 <2> OEM_C3 EQU 251 ; 251 FB 162 <2> OEM_C4 EQU 252 ; 252 FC 163 <2> OEM_C5 EQU 253 ; 253 FD 164 <2> OEM_C6 EQU 254 ; 254 FE 165 <2> OEM_C7 EQU 255 ; 255 FF 175 <1> 176 <1> ;SUBTTL 177 <1> 9 %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 0 00000D12 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 00000D16 ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 00000D18 ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 00000D1A ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 00000D1C ???????????????? 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 0 00000D12 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00000D13 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00000D14 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00000D15 ???? REQSTAT DW ? ;STATUS WORD 0 00000D17 ???????????????? 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 <1> DB (SRHEAD_struc_size) DUP(?) 157 <1> ; GENERIC IOCTL ADDITION. 0 00000D1F ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00000D20 ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00000D21 ???? REG_SI DW ? 0 00000D23 ???? REG_DI DW ? 0 00000D25 ???????? 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 0 00000D12 ???????? SECTOR_RBA DD ? ; relative block address 0 00000D16 ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 00000D18 ???????? 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 0 00000D12 ???? MEDIA_level DW ? ; info level 0 00000D14 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <1> MEDIA_Label DB 11 dup (?) ;volume label 0 00000D23 ???????????????? 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 10 ;.cref 11 [list +] 12 13 Break 14 15 ; 16 ; We need to identify the parts of the data area that are relevant to tasks 17 ; and those that are relevant to the system as a whole. Under 3.0, the system 18 ; data will be gathered with the system code. The process data under 2.x will 19 ; be available for swapping and under 3.0 it will be allocated per-process. 20 ; 21 ; The data that is system data will be identified by [SYSTEM] in the comments 22 ; describing that data item. 23 ; 24 25 %ifndef Kanji 26 %iassign Kanji 0 27 %endif 28 %ifndef Debug 29 %iassign Debug 0 30 %endif 31 %ifndef Redirector 32 %iassign Redirector 0 33 %endif 34 %ifndef ShareF 35 %iassign ShareF 0 36 %endif 37 === Switch to base=000E10h -> "CONSTANTS" 38 section CONSTANTS 39 40 ; 41 ; Table of routines for assignable devices 42 ; 43 ; MSDOS allows assignment if the following standard devices: 44 ; stdin (usually CON input) 45 ; stdout (usually CON output) 46 ; auxin (usually AUX input) 47 ; auxout (usually AUX output) 48 ; stdlpt (usually PRN output) 49 ; 50 ; SPECIAL NOTE: 51 ; Status of a file is a strange idea. We choose to handle it in this 52 ; manner: If we're not at end-of-file, then we always say that we have a 53 ; character. Otherwise, we return ^Z as the character and set the ZERO 54 ; flag. In this manner we can support program written under the old DOS 55 ; (they use ^Z as EOF on devices) and programs written under the new DOS 56 ; (they use the ZERO flag as EOF). 57 58 ; Default SFTs for boot up 59 60 CONST001S equ CONST001s ; NASM port label 61 CONST001E equ CONST001e ; NASM port label 62 Public CONST001S,CONST001E 63 CONST001s label byte 64 PUBLIC sftabl 65 sftabl LABEL DWORD ; [SYSTEM] file table 0 000000CC FFFF DW -1 ; [SYSTEM] link to next table 0 000000CE FFFF DW -1 ; [SYSTEM] link seg to next table 0 000000D0 0500 DW sf_default_number ; [SYSTEM] Number of entries in table 0 000000D2 000000000000000000 DB sf_default_number * sf_entry_struc_size DUP (0); [SYSTEM] 0 000000DB 000000000000000000 0 000000E4 000000000000000000 0 000000ED 000000000000000000 0 000000F6 000000000000000000 0 000000FF 000000000000000000 0 00000108 000000000000000000 0 00000111 000000000000000000 0 0000011A 000000000000000000 0 00000123 000000000000000000 0 0000012C 000000000000000000 0 00000135 000000000000000000 0 0000013E 000000000000000000 0 00000147 000000000000000000 0 00000150 000000000000000000 0 00000159 000000000000000000 0 00000162 000000000000000000 0 0000016B 000000000000000000 0 00000174 000000000000000000 0 0000017D 000000000000000000 0 00000186 000000000000000000 0 0000018F 000000000000000000 0 00000198 000000000000000000 0 000001A1 000000000000000000 0 000001AA 000000000000000000 0 000001B3 000000000000000000 0 000001BC 000000000000000000 0 000001C5 000000000000000000 0 000001CE 000000000000000000 0 000001D7 000000000000000000 0 000001E0 000000000000000000 0 000001E9 000000000000000000 0 000001F2 00000000000000 70 71 ; the next two variables relate to the position of the logical stdout/stdin 72 ; cursor. They are only meaningful when stdin/stdout are assigned to the 73 ; console. 0 000001F9 ?? I_am CARPOS,BYTE ; [SYSTEM] cursor position in stdin 0 000001FA ?? I_am STARTPOS,BYTE ; [SYSTEM] position of cursor at beginning of buffered input call 76 0000012F I_am INBUF,128 ; [SYSTEM] general device input buffer 77 000001AF I_am CONBUF,131 ; [SYSTEM] The rest of INBUF and console buffer 78 0 000002FE ?? I_am PFLAG,BYTE ; [SYSTEM] printer echoing flag 0 000002FF ?? I_am VERFLG,BYTE ; [SYSTEM] Initialize with verify off 0 00000300 03 I_am CharCo,BYTE,<00000011B> ; [SYSTEM] Allows statchks every 4 chars... 0 00000301 2F I_am chSwitch,BYTE,<'/'> ; [SYSTEM] current switch character 0 00000302 ?? I_am AllocMethod,BYTE ; [SYSTEM] how to alloc first(best)last 0 00000303 00 I_am fShare,BYTE,<0> ; [SYSTEM] TRUE => sharing installed 0 00000304 01 I_am DIFFNAM,BYTE,<1> ; [SYSTEM] Indicates when MYNAME has 86 ; changed 0 00000305 202020202020202020 I_am MYNAME,16,<32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32> 0 0000030E 20202020202020 88 ; [SYSTEM] My network name 89 90 91 ; 92 ; The following table is a list of addresses that the sharer patches to be 93 ; PUSH AX to enable the critical sections 94 ; 95 PUBLIC CritPatch 96 CritPatch LABEL WORD 97 %macro critpatchentry 1.nolist 98 %IF (! REDIRECTOR) && (! SHAREF) 99 Short_Addr patch_dosdata_E%1 100 Short_Addr patch_dosdata_L%1 101 %ELSE 102 DW 0 103 DW 0 104 %ENDIF 105 %endmacro 0 00000315 [0000][0000] critpatchentry critDisk 0 00000319 [0000][0000] critpatchentry critDevice 0 0000031D 0000 DW 0 109 110 ; 111 ; WARNING!!! PRINT and PSPRINT *REQUIRE* ErrorMode to precede INDOS. 112 ; Also, IBM server 1.0 requires this also. 113 ; 0 0000031F 00 EVEN ; Force swap area to start on word boundry 115 PUBLIC SWAP_START 116 SWAP_START LABEL BYTE 0 00000320 ?? I_am ErrorMode,BYTE ; Flag for INT 24 processing 0 00000321 00 I_am INDOS,BYTE,<0> ; DOS status for interrupt processing 0 00000322 FF I_am WPErr,BYTE,<-1> ; Write protect error flag 0 00000323 ?? I_am EXTERR_LOCUS,BYTE ; Extended Error Locus 0 00000324 0000 I_am EXTERR,WORD,<0> ; Extended Error code 122 123 ;WARNING Following two bytes Accessed as word in $GetExtendedError 0 00000326 ?? I_am EXTERR_ACTION,BYTE ; Extended Error Action 0 00000327 ?? I_am EXTERR_CLASS,BYTE ; Extended Error Class 126 ; end warning 127 0 00000328 ???????? I_am EXTERRPT,DWORD ; Extended Error pointer 0 0000032C 8000???? I_am DMAADD,DWORD,<80h,?> ; User's disk transfer address (disp/seg) 0 00000330 ???? I_am CurrentPDB,WORD ; Current process identifier 0 00000332 ???? I_am ConC_spsave,WORD ; saved SP before ^C 0 00000334 ???? I_am exit_code,WORD ; exit code of last proc. 0 00000336 ?? I_am CURDRV,BYTE ; Default drive (init A) 0 00000337 00 I_am CNTCFLAG,BYTE,<0> ; ^C check in dispatch disabled 135 ; F.C. 2/17/86 0 00000338 00 I_am CPSWFLAG,BYTE,<0> ; Code Page Switching Flag DOS 4.00 0 00000339 00 I_am CPSWSAVE,BYTE,<0> ; copy of above in case of ABORT 138 EVEN 139 PUBLIC Swap_Always 140 Swap_Always LABEL BYTE 0 0000033A ???? I_am USER_IN_AX,WORD ; User INPUT AX value (used for 142 ; extended error type stuff. NOTE: 143 ; does not have Correct value on 144 ; 1-12, OEM, Get/Set CurrentPDB, 145 ; GetExtendedError system calls 0 0000033C 0000 I_am PROC_ID,WORD,<0> ; PID for sharing (0 = local) 0 0000033E 0000 I_am USER_ID,WORD,<0> ; Machine for sharing (0 = local) 0 00000340 ???? I_am FirstArena,WORD ; first free block found 0 00000342 ???? I_am BestArena,WORD ; best free block found 0 00000344 ???? I_am LastArena,WORD ; last free block found 0 00000346 ???? I_am EndMem,WORD ; End of memory used in DOSINIT 0 00000348 ???? I_am LASTENT,WORD ; Last entry for directory search 153 0 0000034A 00 I_am FAILERR,BYTE,<0> ; NZ if user did FAIL on I 24 0 0000034B 00 I_am ALLOWED,BYTE,<0> ; Allowed I 24 answers (see allowed_) 0 0000034C ?? I_am NoSetDir,BYTE ; true -> do not set directory 0 0000034D ?? I_am DidCTRLC,BYTE ; true -> we did a ^C exit 0 0000034E ?? I_am SpaceFlag,BYTE ; true -> embedded spaces are allowed in FCB 159 ; Warning! The following items are accessed as a WORD in TIME.ASM 0 0000034F 00 EVEN 0 00000350 00 I_am DAY,BYTE,<0> ; Day of month 0 00000351 00 I_am MONTH,BYTE,<0> ; Month of year 0 00000352 0000 I_am YEAR,WORD,<0> ; Year (with century) 0 00000354 FFFF I_am DAYCNT_DOS,WORD,<-1> ; Day count from beginning of year 0 00000356 00 I_am WEEKDAY,BYTE,<0> ; Day of week 166 ; end warning 0 00000357 ?? I_am CONSWAP,BYTE ; TRUE => console was swapped during device read 0 00000358 01 I_am IDLEINT,BYTE,<1> ; TRUE => idle int is allowed 0 00000359 00 I_am fAborting,BYTE,<0> ; TRUE => abort in progress 170 171 ; Combination of all device call parameters 172 PUBLIC DEVCALL ; 173 DEVCALL: 174 SRHEAD_size equ SRHEAD_struc_size ; NASM port equate 175 istruc SRHEAD 0 0000035A 00 iend 177 PUBLIC CALLUNIT 178 CALLUNIT LABEL BYTE ; unit number for disk 179 CALLFLSH LABEL WORD ; 0 00000367 ?? I_am CALLMED,BYTE ; media byte 181 CALLBR LABEL DWORD ; 182 PUBLIC CALLXAD ; 183 CALLXAD LABEL DWORD ; 0 00000368 ?? I_am CALLRBYT,BYTE ; 185 PUBLIC CALLVIDM ; 186 CALLVIDM LABEL DWORD ; 0 00000369 ?????? DB 3 DUP(?) ; 188 CallBPB equ CALLBPB ; NASM port label 189 PUBLIC CallBPB ; 190 CALLBPB LABEL DWORD ; 0 0000036C ???? I_am CALLSCNT,WORD ; 192 PUBLIC CALLSSEC 193 CALLSSEC LABEL WORD ; 0 0000036E ???? DW ? ; 0 00000370 ???????? I_am CALLVIDRW,DWORD ; 196 ; 0 00000374 ???????? I_am CALLNEWSC,DWORD ; starting sector for >32mb 0 00000378 ???????? I_am CALLDEVAD,DWORD ; stash for device entry point 199 ; 200 ; Same as above for I/O calls ; 201 ; 202 IOCall equ IOCALL ; NASM port label 203 PUBLIC IOCall ; 204 IOCALL: 205 istruc SRHEAD 0 0000037C 00 iend 207 IOFLSH LABEL WORD ; 208 PUBLIC IORCHR ; 209 IORCHR LABEL BYTE ; 0 00000389 ?? I_am IOMED,BYTE ; 0 0000038A ???????? I_am IOXAD,DWORD ; 0 0000038E ???? I_am IOSCNT,WORD ; 0 00000390 ???? I_am IOSSEC,WORD ; 214 ; Call struct for DSKSTATCHK ; 0 00000392 0E00 I_am DSKSTCALL,2, ; 0 00000394 05 I_am DSKSTCOM,1, ; 0 00000395 ???? I_am DSKSTST,WORD ; 0 00000397 0000000000000000 DB 8 DUP (0) ; 0 0000039F ?? I_am DSKCHRET,BYTE ; 0 000003A0 [0000] short_addr DEVIOBUF ; 0 000003A2 ???? DW ? ; DOS segment set at Init 0 000003A4 0100 I_AM DSKSTCNT,WORD,<1> ; 0 000003A6 0000 DW 0 ; 224 0 000003A8 ?? I_am CreatePDB,BYTE ; flag for creating a process 226 PUBLIC Lock_Buffer ; 227 Lock_Buffer LABEL DWORD ;MS. DOS Lock Buffer for Ext Lock 0 000003A9 ???????? DD ? ;MS. position 0 000003AD ???????? DD ? ;MS. length 230 CONST001e label byte 231 232 ; (no prior section) ; CONSTANTS ENDS 233 END === Trace listing source: ../INC/msdata.lst 1 ; SCCSID = @(#)ibmdata.asm 1.1 85/04/10 2 ; 3 ; DATA Segment for DOS. 4 ; 5 6 ;page 255,132 7 8 [list -] 8 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 8 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 14 debug equ FALSE ; No dossym (too big) 15 %include "dosmac.mac" 1 <1> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 3 <1> ; 4 <1> ; Macro file for MSDOS. 5 <1> ; 6 <1> 7 <1> %ifndef __DOSMAC_MAC__ 8 <1> %assign __DOSMAC_MAC__ 1 9 <1> 10 <1> TRUE EQU 0FFFFh 11 <1> FALSE EQU 0 12 <1> 13 <1> 14 <1> ; NASM original macros (comment for fixmem.pl) 15 <1> 16 <1> ;SUBTTL BREAK a listing into pages and give new subtitles 17 <1> ;PAGE 18 <1> %imacro BREAK 0-1+.nolist 19 <1> ;SUBTTL subtitle 20 <1> ;PAGE 21 <1> %endmacro 22 <1> ;.xcref break 23 <1> 24 <1> BREAK 25 <1> 26 <1> %if 0 27 <1> AsmVars Macro varlist 28 <1> IRP var, 29 <1> AsmVar var 30 <1> ENDM 31 <1> ENDM 32 <1> 33 <1> AsmVar Macro var 34 <1> IFNDEF var 35 <1> var = FALSE 36 <1> ENDIF 37 <1> ENDM 38 <1> %endif 39 <1> 40 <1> BREAK 41 <1> 42 <1> ; 43 <1> ; declare a variable external and allocate a size 44 <1> ; 45 <1> ;AsmVar InstalledData 46 <1> %ifndef InstalledData 47 <1> %define InstalledData 0 48 <1> %endif 49 <1> 50 <1> %imacro I_NEED 1-2.nolist 51 <1> %ifn InstalledData === Switch to base=000E10h -> "DATA" 52 <1> [section DATA] 53 <1> %IFIDNi %2, WORD 54 <1> EXTRN %1:WORD 55 <1> %ELSE 56 <1> %IFIDNi %2, DWORD 57 <1> EXTRN %1:DWORD 58 <1> %ELSE 59 <1> EXTRN %1:BYTE 60 <1> %ENDIF 61 <1> %ENDIF 62 <1> __SECT__ 63 <1> %ENDIF 64 <1> %endmacro 65 <1> ;.xcref I_need 66 <1> 67 <1> ; 68 <1> ; call a procedure that may be external. The call will be short. 69 <1> ; 70 <1> %imacro invoke 1.nolist 71 <1> ;.xcref 72 <1> EXTRN %1:NEAR 73 <1> ;.cref 74 <1> CALL %1 75 <1> %endmacro 76 <1> ;.xcref invoke 77 <1> 78 <1> ;PAGE 79 <1> ; 80 <1> ; jump to a label that may be external. The jump will be near. 81 <1> ; 82 <1> %imacro transfer 1.nolist 83 <1> ;.xcref 84 <1> EXTRN %1:NEAR 85 <1> ;.cref 86 <1> JUMP %1 87 <1> %endmacro 88 <1> ;.xcref transfer 89 <1> 90 <1> ; 91 <1> ; get a short address in a word 92 <1> ; 93 <1> %imacro short_addr 1.nolist 94 <1> %ifnidn %1, ? 95 <1> EXTRN %1:NEAR 96 <1> DW OFFSET %1 97 <1> %ELSE 98 <1> DW ? 99 <1> %ENDIF 100 <1> %endmacro 101 <1> ;.xcref short_addr 102 <1> 103 <1> ; 104 <1> ; get a long address in a dword 105 <1> ; 106 <1> %imacro long_addr 1.nolist 107 <1> EXTRN %1:NEAR 108 <1> DD %1 109 <1> %endmacro 110 <1> ;.xcref long_addr 111 <1> 112 <1> ; 113 <1> ; declare a PROC near or far but PUBLIC nonetheless 114 <1> ; 115 <1> ;.xcref ?frame 116 <1> ;.xcref ?aframe 117 <1> ;.xcref ?stackdepth 118 <1> ;.xcref ?initstack 119 <1> %assign ?frame 0 ; initial 120 <1> %assign ?aframe 0 ; initial 121 <1> %assign ?stackdepth 0 ; initial stack size 122 <1> %assign ?initstack 0 ; initial stack size 123 <1> 124 <1> %imacro procedure 1-2.nolist 125 <1> %assign ?frame 0 126 <1> %assign ?aframe 2 ;; remember the pushed BP 127 <1> %warning proc %1... 128 <1> %1 PROC %2 129 <1> PUBLIC %1 130 <1> %assign ?initstack ?stackdepth ;; beginning of procedure 131 <1> %endmacro 132 <1> ;.xcref procedure 133 <1> 134 <1> ; 135 <1> ; end a procedure and check that stack depth is preserved 136 <1> ; 137 <1> %imacro EndProc 1-2.nolist 138 <1> %ifnidni %2, NoCheck ;; check the stack size 139 <1> %if ?initstack != ?stackdepth ;; is it different? 140 <1> %warning ***** Possible stack size error in %1 ***** 141 <1> %endif 142 <1> %endif 143 <1> %1 ENDP 144 <1> %endmacro 145 <1> ;.xcref endproc 146 <1> ;PAGE 147 <1> ; 148 <1> ; define a data item to be public and of an appropriate size/type 149 <1> ; 150 <1> 151 <1> %imacro stripangles 2.nolist 152 <1> %defstr %%param %2 153 <1> %rep 16 154 <1> %substr %%opening %%param 1 155 <1> %ifidn %%opening, '<' 156 <1> %substr %%param %%param 2,-1 157 <1> %endif 158 <1> %endrep 159 <1> %rep 16 160 <1> %strlen %%length %%param 161 <1> %substr %%closing %%param %%length 162 <1> %ifidn %%closing, '>' 163 <1> %substr %%param %%param 1,-2 164 <1> %endif 165 <1> %endrep 166 <1> %deftok %%token %%param 167 <1> %1 %%token 168 <1> %endmacro 169 <1> 170 <1> %imacro I_AM 2-*.nolist 171 <1> ;I_AM MACRO name,size,init 172 <1> %xdefine %%name %1 173 <1> ;; declare the type of the object 174 <1> %IFIDNi %2, WORD 175 <1> %1 LABEL WORD 176 <1> %assign I_AM_SIZE 1 177 <1> %assign I_AM_LEN 2 178 <1> %ELSE 179 <1> %IFIDNi %2, DWORD 180 <1> %1 LABEL DWORD 181 <1> %assign I_AM_SIZE 2 182 <1> %assign I_AM_LEN 2 183 <1> %ELSE 184 <1> %IFIDNi %2, BYTE 185 <1> %1 LABEL BYTE 186 <1> %assign I_AM_SIZE 1 187 <1> %assign I_AM_LEN 1 188 <1> %ELSE 189 <1> %1 LABEL BYTE 190 <1> %undef I_AM_SIZE 191 <1> stripangles %assign I_AM_SIZE, %2 192 <1> %assign I_AM_LEN 1 193 <1> %ENDIF 194 <1> %ENDIF 195 <1> %ENDIF 196 <1> ;; declare the object public 197 <1> PUBLIC %%name 198 <1> ;; if no initialize then allocate blank storage 199 <1> %IF %0 == 2 200 <1> DB I_AM_SIZE*I_AM_LEN DUP (?) 201 <1> %ELSE 202 <1> %ifn InstalledData 203 <1> %rotate 2 204 <1> %rep %0 - 2 205 <1> %IF I_AM_LEN == 1 206 <1> stripangles db, %1 207 <1> %ELSE 208 <1> stripangles dw, %1 209 <1> %ENDIF 210 <1> %assign I_AM_SIZE I_AM_SIZE - 1 211 <1> %rotate 1 212 <1> %endrep 213 <1> %IF I_AM_SIZE != 0 214 <1> %error ***** initialization of %%name not complete ***** 215 <1> %ENDIF 216 <1> %ELSE 217 <1> DB I_AM_SIZE*I_AM_LEN DUP (?) 218 <1> %ENDIF 219 <1> %ENDIF 220 <1> %endmacro 221 <1> 222 <1> %imacro I_AM_NOBITS 2-*.nolist 223 <1> ;I_AM MACRO name,size,init 224 <1> %xdefine %%name %1 225 <1> ;; declare the type of the object 226 <1> %IFIDNi %2, WORD 227 <1> %1 LABEL WORD 228 <1> %assign I_AM_SIZE 1 229 <1> %assign I_AM_LEN 2 230 <1> %ELSE 231 <1> %IFIDNi %2, DWORD 232 <1> %1 LABEL DWORD 233 <1> %assign I_AM_SIZE 2 234 <1> %assign I_AM_LEN 2 235 <1> %ELSE 236 <1> %IFIDNi %2, BYTE 237 <1> %1 LABEL BYTE 238 <1> %assign I_AM_SIZE 1 239 <1> %assign I_AM_LEN 1 240 <1> %ELSE 241 <1> %1 LABEL BYTE 242 <1> %undef I_AM_SIZE 243 <1> stripangles %assign I_AM_SIZE, %2 244 <1> %assign I_AM_LEN 1 245 <1> %ENDIF 246 <1> %ENDIF 247 <1> %ENDIF 248 <1> ;; declare the object public 249 <1> PUBLIC %%name 250 <1> ;; if no initialize then allocate blank storage 251 <1> %IF %0 == 2 252 <1> resb I_AM_SIZE*I_AM_LEN 253 <1> %ELSE 254 <1> %ifn InstalledData 255 <1> %rotate 2 256 <1> %rep %0 - 2 257 <1> %IF I_AM_LEN == 1 258 <1> resb 1 259 <1> %ELSE 260 <1> resw 1 261 <1> %ENDIF 262 <1> %assign I_AM_SIZE I_AM_SIZE - 1 263 <1> %rotate 1 264 <1> %endrep 265 <1> %IF I_AM_SIZE != 0 266 <1> %error ***** initialization of %%name not complete ***** 267 <1> %ENDIF 268 <1> %ELSE 269 <1> resb I_AM_SIZE*I_AM_LEN 270 <1> %ENDIF 271 <1> %ENDIF 272 <1> %endmacro 273 <1> 274 <1> ;.xcref I_AM 275 <1> ;.xcref I_AM_SIZE 276 <1> ;.xcref I_AM_LEN 277 <1> %assign I_AM_SIZE 0 278 <1> %assign I_AM_LEN 0 279 <1> 280 <1> ;PAGE 281 <1> 282 <1> ; 283 <1> ; define an entry in a procedure 284 <1> ; 285 <1> %imacro entry 1.nolist 286 <1> %1: 287 <1> PUBLIC %1 288 <1> %endmacro 289 <1> ;.xcref entry 290 <1> 291 <1> BREAK 292 <1> 293 <1> %imacro error 1.nolist 294 <1> ;.xcref 295 <1> MOV AL, %1 296 <1> transfer SYS_RET_ERR 297 <1> ;.cref 298 <1> %endmacro 299 <1> ;.xcref error 300 <1> 301 <1> BREAK 302 <1> ; 303 <1> ; given a label either 2 byte jump to another label _J 304 <1> ; if it is near enough or 3 byte jump to 305 <1> ; 306 <1> 307 <1> %imacro jump 1.nolist 308 <1> ;.xcref 309 <1> 310 <1> %ifndef %1_J ;; is this the first invocation 311 <1> %%a: JMP %1 312 <1> %ELSE 313 <1> %IF (%1_J >= $) || ($-%1_J > 126) 314 <1> %%a: JMP %1 ;; is the jump too far away? 315 <1> %ELSE 316 <1> %%a: JMP %1_J ;; do the short one... 317 <1> %ENDIF 318 <1> %ENDIF 319 <1> %ixdefine %1_j %%a 320 <1> ;.cref 321 <1> %endmacro 322 <1> ;.xcref jump 323 <1> 324 <1> BREAK 325 <1> 326 <1> %imacro return 0.nolist 327 <1> %%a: 328 <1> RET 329 <1> %xdefine ret_l %%a 330 <1> %endmacro 331 <1> ;.xcref return 332 <1> 333 <1> BREAK 334 <1> 335 <1> %imacro condret 2.nolist 336 <1> %assign %%exit 0 337 <1> %ifdef ret_l ;; if ret_l is defined 338 <1> %if (($ - ret_l) <= 126) && ($ > ret_l) 339 <1> ;; if ret_l is near enough then 340 <1> %%a: j%1 ret_l ;; a: j to ret_l 341 <1> %xdefine ret_%1 %%a ;; define ret_ to be a: 342 <1> %assign %%exit 1 343 <1> %endif 344 <1> %endif 345 <1> %ifn %%exit 346 <1> %ifdef ret_%1 ;; if ret_ defined 347 <1> %if (($ - ret_%1) <= 126) && ($ > ret_%1) 348 <1> ;; if ret_ is near enough 349 <1> %%a: j%1 ret_%1 ;; a: j to ret_ 350 <1> %xdefine ret_%1 %%a ;; define ret_ to be a: 351 <1> %assign %%exit 1 352 <1> %endif 353 <1> %endif 354 <1> %endif 355 <1> %ifn %%exit 356 <1> j%2 %%a ;; j a: 357 <1> return ;; return 358 <1> %%a: ;; a: 359 <1> %xdefine ret_%1 ret_l ;; define ret_ to be ret_l 360 <1> %endif 361 <1> %endmacro 362 <1> ;.xcref condret 363 <1> 364 <1> BREAK 365 <1> 366 <1> %imacro retz 0.nolist 367 <1> condret z,nz 368 <1> %endmacro 369 <1> ;.xcref retz 370 <1> 371 <1> BREAK 372 <1> 373 <1> %imacro retnz 0.nolist 374 <1> condret nz,z 375 <1> %endmacro 376 <1> ;.xcref retnz 377 <1> 378 <1> BREAK 379 <1> 380 <1> %imacro retc 0.nolist 381 <1> condret c,nc 382 <1> %endmacro 383 <1> ;.xcref retc 384 <1> 385 <1> BREAK 386 <1> 387 <1> %imacro retnc 0.nolist 388 <1> condret nc,c 389 <1> %endmacro 390 <1> ;.xcref retnc 391 <1> 392 <1> BREAK 393 <1> 394 <1> %imacro context 1.nolist 395 <1> PUSH SS 396 <1> stripangles POP, %1 397 <1> ; ASSUME %1:DOSGROUP 398 <1> %endmacro 399 <1> ;.xcref context 400 <1> 401 <1> BREAK 402 <1> 403 <1> %imacro SaveReg 0-*.nolist ;; push those registers 404 <1> %rep %0 405 <1> %assign ?stackdepth ?stackdepth + 1 406 <1> stripangles push, %1 407 <1> %rotate 1 408 <1> %endrep 409 <1> %endmacro 410 <1> ;.xcref SaveReg 411 <1> 412 <1> BREAK 413 <1> 414 <1> %imacro RestoreReg 0-*.nolist ;; pop those registers 415 <1> %rep %0 416 <1> %assign ?stackdepth ?stackdepth - 1 417 <1> stripangles pop, %1 418 <1> %rotate 1 419 <1> %endrep 420 <1> %endmacro 421 <1> ;.xcref RestoreReg 422 <1> 423 <1> BREAK 424 <1> 425 <1> %imacro EnterCrit 1.nolist 426 <1> Invoke E%1 427 <1> %endmacro 428 <1> 429 <1> %imacro LeaveCrit 1.nolist 430 <1> Invoke L%1 431 <1> %endmacro 432 <1> 433 <1> Break 434 <1> 435 <1> ;AsmVars 436 <1> %ifndef ShareF 437 <1> %idefine ShareF 0 438 <1> %endif 439 <1> %ifndef Cargs 440 <1> %idefine Cargs 0 441 <1> %endif 442 <1> %ifndef Redirector 443 <1> %idefine Redirector 0 444 <1> %endif 445 <1> %ifndef debug 446 <1> %idefine debug 0 447 <1> %endif 448 <1> 449 <1> %if debug 450 <1> %imacro fmt 3-*.nolist 451 <1> ;fmt MACRO typ,lev,fmts,args 452 <1> ;local a,b,c 453 <1> PUSHF 454 <1> %IFNempty %1 455 <1> TEST word [BugTyp],%1 456 <1> JZ %%c 457 <1> CMP word [BugLev],%2 458 <1> JB %%c 459 <1> %ENDIF 460 <1> PUSH AX 461 <1> PUSH BP 462 <1> MOV BP,SP 463 <1> %If (! sharef) && (! redirector) === Switch to base=000E10h -> "TABLE" 464 <1> [section Table] 465 <1> %%a: db %3,0 466 <1> __SECT__ 467 <1> MOV AX,OFFSET %%a wrt DOSGROUP 468 <1> %else 469 <1> jmp short %%b 470 <1> %%a: db %3,0 471 <1> %if sharef 472 <1> %%b: mov ax,offset %%a wrt share 473 <1> %else 474 <1> %%b: mov ax,offset %%a wrt netwrk 475 <1> %endif 476 <1> %endif 477 <1> PUSH AX 478 <1> %iassign cargs 2 479 <1> %rotate 3 480 <1> %rep %0 - 3 481 <1> %ifidni ax, %1 482 <1> MOV AX,[BP+2] 483 <1> %ELSE 484 <1> MOV AX, %1 485 <1> %ENDIF 486 <1> PUSH AX 487 <1> %iassign cargs cargs + 2 488 <1> %rotate 1 489 <1> %endrep 490 <1> invoke PFMT 491 <1> ADD SP, Cargs 492 <1> POP BP 493 <1> POP AX 494 <1> %%c: 495 <1> POPF 496 <1> %endmacro 497 <1> %else 498 <1> %imacro fmt 3-*.nolist 499 <1> %endmacro 500 <1> %endif 501 <1> 502 <1> Break 503 <1> 504 <1> ;AsmVar Debug,$temp 505 <1> 506 <1> %imacro detectstripangles 4.nolist 507 <1> %defstr %%param %4 508 <1> %assign ?%2 0 509 <1> %assign ?%3 0 510 <1> %rep 16 511 <1> %substr %%opening %%param 1 512 <1> %ifidn %%opening, '<' 513 <1> %substr %%param %%param 2,-1 514 <1> %assign ?%2 ?%2 + 1 515 <1> %endif 516 <1> %endrep 517 <1> %rep 16 518 <1> %strlen %%length %%param 519 <1> %substr %%closing %%param %%length 520 <1> %ifidn %%closing, '>' 521 <1> %substr %%param %%param 1,-2 522 <1> %assign ?%3 ?%3 + 1 523 <1> %endif 524 <1> %endrep 525 <1> %deftok %%token %%param 526 <1> %define ?%1 %%token 527 <1> %endmacro 528 <1> 529 <1> 530 <1> %IF debug 531 <1> %imacro DOSAssume 3-*.nolist 532 <1> ;DOSAssume Macro reg,reglist,message 533 <1> %ifidni %1, CS 534 <1> %assign %%temp 1 535 <1> %else 536 <1> %ifidni %1, SS 537 <1> %assign %%temp 0 538 <1> %else 539 <1> %error ***** Invalid DOS register %1 in DOSAssume ***** 540 <1> %endif 541 <1> %endif 542 <1> %rotate 1 543 <1> %assign %%level 0 544 <1> %assign %%amount %0 - 1 545 <1> %rep 16 546 <1> detectstripangles %%token, %%opening, %%closing, %1 547 <1> %assign %%level %%level + ? %+ %%opening 548 <1> %assign %%level %%level - ? %+ %%closing 549 <1> %ifidni ? %+ %%token, DS 550 <1> %assign %%temp %%temp | 2 551 <1> %else 552 <1> %ifidni ? %+ %%token, ES 553 <1> %assign %%temp %%temp | 4 554 <1> %else 555 <1> %error ***** Invalid register reg in DOSAssume ***** 556 <1> %endif 557 <1> %endif 558 <1> %assign %%amount %%amount - 1 559 <1> %rotate 1 560 <1> %if %%level <= 0 561 <1> %exitrep 562 <1> %endif 563 <1> %endrep 564 <1> 565 <1> PUSH AX 566 <1> MOV AX, %%temp 567 <1> PUSH AX 568 <1> %IF SHAREF 569 <1> MOV AX,OFFSET %%a 570 <1> %ELSE 571 <1> MOV AX,OFFSET %%a wrt DOSGroup 572 <1> %ENDIF 573 <1> PUSH AX 574 <1> Invoke SegCheck 575 <1> POP AX 576 <1> %IFN SHAREF === Switch to base=000E10h -> "TABLE" 577 <1> [section Table] 578 <1> %ELSE 579 <1> JMP SHORT %%b 580 <1> %ENDIF 581 <1> %%a: 582 <1> %rep %%amount 583 <1> DB %1 584 <1> %rotate 1 585 <1> %endrep 586 <1> db 0 587 <1> %IFN SHAREF 588 <1> __SECT__ 589 <1> %ELSE 590 <1> %%b: 591 <1> %ENDIF 592 <1> ;IRP r, 593 <1> ; ASSUME r:DOSGroup 594 <1> ;ENDM 595 <1> %endmacro 596 <1> %ELSE 597 <1> %imacro DOSAssume 3-*.nolist 598 <1> ;DOSAssume Macro reg,reglist,message 599 <1> ;IRP r, 600 <1> ; ASSUME r:DOSGroup 601 <1> ;ENDM 602 <1> %endmacro 603 <1> %ENDIF 604 <1> 605 <1> BREAK 606 <1> 607 <1> %if 0 608 <1> ;IF DEBUG 609 <1> Assert MACRO kind, objs, message 610 <1> LOCAL a,b 611 <1> IFIDN , 612 <1> CMP objs,0 613 <1> JZ a 614 <1> fmt <>,<>, 615 <1> a: 616 <1> ELSE 617 <1> IFIDN , 618 <1> CMP objs,0 619 <1> JNZ a 620 <1> fmt <>,<>, 621 <1> a: 622 <1> ELSE 623 <1> PUSH AX 624 <1> IRP obj, 625 <1> PUSH obj 626 <1> ENDM 627 <1> IF SHAREF 628 <1> MOV AX,OFFSET b 629 <1> ELSE 630 <1> MOV AX,OFFSET DOSGroup:b 631 <1> ENDIF 632 <1> PUSH AX 633 <1> IFIDN , 634 <1> Invoke BUFCheck 635 <1> ENDIF 636 <1> IFIDN , 637 <1> Invoke SFTCheck 638 <1> ENDIF 639 <1> IFIDN , 640 <1> Invoke DPBCheck 641 <1> ENDIF 642 <1> POP AX 643 <1> IF SHAREF 644 <1> JMP SHORT a 645 <1> b DB Message,0 646 <1> a: 647 <1> ELSE === Switch to base=000E10h -> "TABLE" 648 <1> Table segment 649 <1> b db Message,0 === Switch to base=000E10h -> "TABLE" 650 <1> Table ends 651 <1> ENDIF 652 <1> ENDIF 653 <1> ENDIF 654 <1> ENDM 655 <1> %ELSE 656 <1> %imacro Assert 0-*.nolist 657 <1> %endmacro 658 <1> %ENDIF 659 <1> 660 <1> %ifndef Installed 661 <1> %idefine Installed 1 662 <1> %endif 663 <1> 664 <1> Break 665 <1> 666 <1> %imacro CallInstall 3-*.nolist 667 <1> ;CallInstall MACRO name,mpx,fn,save,restore 668 <1> %define %%name %1 669 <1> %assign %%mpx %2 670 <1> %assign %%fn %3 671 <1> %IF Installed 672 <1> %rotate 3 673 <1> %assign %%level 0 674 <1> %assign %%amountsaved 0 675 <1> %rep %0 - 3 676 <1> %ifnempty %1 677 <1> detectstripangles %%token, %%opening, %%closing, %1 678 <1> %assign %%level %%level + ? %+ %%opening 679 <1> %assign %%level %%level - ? %+ %%closing 680 <1> SaveReg ? %+ %%token 681 <1> %endif 682 <1> %assign %%amountsaved %%amountsaved + 1 683 <1> %rotate 1 684 <1> %if %%level <= 0 685 <1> %exitrep 686 <1> %endif 687 <1> %endrep 688 <1> MOV AX,(%%mpx << 8) + %%fn 689 <1> INT 2Fh 690 <1> %assign %%level 0 691 <1> %assign %%amountrestored 0 692 <1> %rep %0 - 3 - %%amountsaved 693 <1> %ifnempty %1 694 <1> detectstripangles %%token, %%opening, %%closing, %1 695 <1> %assign %%level %%level + ? %+ %%opening 696 <1> %assign %%level %%level - ? %+ %%closing 697 <1> RestoreReg ? %+ %%token 698 <1> %endif 699 <1> %assign %%amountrestored %%amountrestored + 1 700 <1> %rotate 1 701 <1> %if %%level <= 0 702 <1> %exitrep 703 <1> %endif 704 <1> %endrep 705 <1> %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored 706 <1> %error Wrong amount saved or restored 707 <1> %endif 708 <1> %ELSE 709 <1> Invoke %%name 710 <1> %ENDIF 711 <1> %endmacro 712 <1> 713 <1> Break 714 <1> 715 <1> %imacro localvar 2.nolist 716 <1> %ifidni %2, BYTE 717 <1> %assign ?frame ?frame + 1 718 <1> %assign %%a ?frame 719 <1> labelsize %1, byte, bp - %%a 720 <1> %else 721 <1> %ifidni %2, WORD 722 <1> %assign ?frame ?frame + 2 723 <1> %assign %%a ?frame 724 <1> labelsize %1, word, bp - %%a 725 <1> %else 726 <1> %ifidni %2, DWORD 727 <1> %assign ?frame ?frame + 4 728 <1> %assign %%a ?frame 729 <1> labelsize %1 %+ l, word, bp - %%a 730 <1> labelsize %1 %+ h, word, bp - %%a + 2 731 <1> labelsize %1, dword, bp - %%a 732 <1> %else 733 <1> %assign ?frame ?frame + %2 734 <1> %assign %%a ?frame 735 <1> labelsize %1, byte, bp - %%a 736 <1> %endif 737 <1> %endif 738 <1> %endif 739 <1> %endmacro 740 <1> 741 <1> %imacro enter 0.nolist 742 <1> push bp 743 <1> mov bp,sp 744 <1> sub sp,?frame 745 <1> %endmacro 746 <1> 747 <1> %imacro leave 0.nolist 748 <1> mov sp,bp 749 <1> pop bp 750 <1> %endmacro 751 <1> 752 <1> 753 <1> %imacro argvar 2.nolist 754 <1> %ifidni %2, BYTE 755 <1> %assign %%a ?aframe 756 <1> %assign ?aframe ?aframe + 1 757 <1> labelsize %1, byte, bp + %%a 758 <1> %else 759 <1> %ifidni %2, WORD 760 <1> %assign %%a ?aframe 761 <1> %assign ?aframe ?aframe + 2 762 <1> labelsize %1, word, bp + %%a 763 <1> %else 764 <1> %ifidni %2, DWORD 765 <1> %assign %%a ?aframe 766 <1> %assign ?aframe ?aframe + 4 767 <1> labelsize %1 %+ l, word, bp + %%a 768 <1> labelsize %1 %+ h, word, bp + %%a + 2 769 <1> labelsize %1, dword, bp + %%a 770 <1> %else 771 <1> %assign %%a ?aframe 772 <1> %assign ?aframe ?aframe + %2 773 <1> labelsize %1, byte, bp + %%a 774 <1> %endif 775 <1> %endif 776 <1> %endif 777 <1> %endmacro 778 <1> 779 <1> BREAK 780 <1> 781 <1> %imacro errnz 1.nolist 782 <1> detectstripangles %%token, %%opening, %%closing, %1 783 <1> %if ? %+ %%token 784 <1> %error %1 <> 0 785 <1> %endif 786 <1> %endmacro 787 <1> 788 <1> %endif 16 %include "sf.mac" 1 <1> ; SCCSID = @(#)sf.asm 1.1 85/04/10 2 <1> BREAK 3 <1> ; 4 <1> ; AN000 version 4.00 Jan. 1988 5 <1> ; AN003 PTM 3680 -- make NAME offset the same as before (<=3.30) 6 <1> ; AN009 PTM 3839 reorder SFT for MS WINDOWS 7 <1> 8 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 9 <1> ; C A V E A T P R O G R A M M E R ; 10 <1> ; ; 11 <1> ; 12 <1> ; system file table 13 <1> ; 14 <1> 15 <1> SF STRUC 0 00000D12 ???????? SFLink DD ? 0 00000D16 ???? SFCount DW ? ; number of entries 0 00000D18 ???? SFTable DW ? ; beginning of array of the following 19 <1> SF ENDS 20 <1> 21 <1> ; 22 <1> ; system file table entry 23 <1> ; 24 <1> 25 <1> sf_entry STRUC 0 00000D12 ???? sf_ref_count DW ? ; number of processes sharing entry 27 <1> ; if FCB then ref count 0 00000D14 ???? sf_mode DW ? ; mode of access or high bit on if FCB 0 00000D16 ?? sf_attr DB ? ; attribute of file 0 00000D17 ???? sf_flags DW ? ;Bits 8-15 31 <1> ; Bit 15 = 1 if remote file 32 <1> ; = 0 if local file or device 33 <1> ; Bit 14 = 1 if date/time is not to be 34 <1> ; set from clock at CLOSE. Set by 35 <1> ; FILETIMES and FCB_CLOSE. Reset by 36 <1> ; other reseters of the dirty bit 37 <1> ; (WRITE) 38 <1> ; Bit 13 = Pipe bit (reserved) 39 <1> ; 40 <1> ; Bits 0-7 (old FCB_devid bits) 41 <1> ; If remote file or local file, bit 42 <1> ; 6=0 if dirty Device ID number, bits 43 <1> ; 0-5 if local file. 44 <1> ; bit 7=0 for local file, bit 7 45 <1> ; =1 for local I/O device 46 <1> ; If local I/O device, bit 6=0 if EOF (input) 47 <1> ; Bit 5=1 if Raw mode 48 <1> ; Bit 0=1 if console input device 49 <1> ; Bit 1=1 if console output device 50 <1> ; Bit 2=1 if null device 51 <1> ; Bit 3=1 if clock device 0 00000D19 ???????? sf_devptr DD ? ; Points to DPB if local file, points 53 <1> ; to device header if local device, 54 <1> ; points to net device header if 55 <1> ; remote 0 00000D1D ???? sf_firclus DW ? ; First cluster of file (bit 15 = 0) 0 00000D1F ???? sf_time DW ? ; Time associated with file 0 00000D21 ???? sf_date DW ? ; Date associated with file 0 00000D23 ???????? sf_size DD ? ; Size associated with file 0 00000D27 ???????? sf_position DD ? ; Read/Write pointer or LRU count for FCBs 61 <1> ; 62 <1> ; Starting here, the next 7 bytes may be used by the file system to store an 63 <1> ; ID 64 <1> ; 0 00000D2B ???? sf_cluspos DW ? ; Position of last cluster accessed 0 00000D2D ???????? sf_dirsec DD ? ; Sector number of directory sector for 67 <1> ; for this file 0 00000D31 ?? sf_dirpos DB ? ; Offset of this entry in the above 69 <1> ; 70 <1> ; End of 7 bytes of file-system specific info. 71 <1> ; 72 00000020 <1> sf_name DB 11 DUP (?) ; 11 character name that is in the 73 <1> ; directory entry. This is used by 74 <1> ; close to detect file deleted and 75 <1> ; disk changed errors. 76 <1> 77 <1> ; SHARING INFO 0 00000D3D ???????? sf_chain DD ? ; link to next SF 0 00000D41 ???? sf_UID DW ? 0 00000D43 ???? sf_PID DW ? 0 00000D45 ???? sf_MFT DW ? 0 00000D47 ???? sf_lstclus DW ? ;AN009; Last cluster accessed 0 00000D49 ???????? sf_IFS_HDR DD ? 84 <1> sf_entry ENDS 85 <1> 86 <1> labelsize sf_fsda, byte, sf_cluspos ;DOS 4.00 87 <1> labelsize sf_serial_ID, word, sf_firclus ;DOS 4.00 88 <1> labelsize sf_netid, byte, sf_cluspos 89 <1> labelsize sf_OpenAge, word, sf_position+2 90 <1> labelsize sf_LRU, word, sf_position 91 <1> 92 <1> sf_default_number EQU 5h 93 <1> 94 <1> ; 95 <1> ; Note that we need to mark an SFT as being busy for OPEN/CREATE. This is 96 <1> ; because an INT 24 may prevent us from 'freeing' it. We mark this as such 97 <1> ; by placing a -1 in the ref_count field. 98 <1> ; 99 <1> 100 <1> sf_busy EQU -1 101 <1> 102 <1> 103 <1> ; mode mask for FCB detection 104 <1> sf_isfcb EQU 1000000000000000B 105 <1> 106 <1> ; Flag word masks 107 <1> sf_isnet EQU 1000000000000000B 108 <1> sf_close_nodate EQU 0100000000000000B 109 <1> sf_pipe EQU 0010000000000000B 110 <1> sf_no_inherit EQU 0001000000000000B 111 <1> sf_net_spool EQU 0000100000000000B 112 <1> Handle_Fail_I24 EQU 0000000100000000B ;BIT 8 - DISK FULL I24 ERROR 113 <1> 114 <1> ; Local file/device flag masks 115 <1> devid_file_clean EQU 40h ; true if file and not written 116 <1> devid_file_mask_drive EQU 3Fh ; mask for drive number 117 <1> 118 <1> devid_device EQU 80h ; true if a device 119 <1> devid_device_EOF EQU 40h ; true if end of file reached 120 <1> devid_device_raw EQU 20h ; true if in raw mode 121 <1> devid_device_special EQU 10h ; true if special device 122 <1> devid_device_clock EQU 08h ; true if clock device 123 <1> devid_device_null EQU 04h ; true if null device 124 <1> devid_device_con_out EQU 02h ; true if console output 125 <1> devid_device_con_in EQU 01h ; true if consle input 126 <1> ; ; 127 <1> ; C A V E A T P R O G R A M M E R ; 128 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 129 <1> 130 <1> ; 131 <1> ; structure of devid field as returned by IOCTL is: 132 <1> ; 133 <1> ; BIT 7 6 5 4 3 2 1 0 134 <1> ; |---|---|---|---|---|---|---|---| 135 <1> ; | I | E | R | S | I | I | I | I | 136 <1> ; | S | O | A | P | S | S | S | S | 137 <1> ; | D | F | W | E | C | N | C | C | 138 <1> ; | E | | | C | L | U | O | I | 139 <1> ; | V | | | L | K | L | T | N | 140 <1> ; |---|---|---|---|---|---|---|---| 141 <1> ; ISDEV = 1 if this channel is a device 142 <1> ; = 0 if this channel is a disk file 143 <1> ; 144 <1> ; If ISDEV = 1 145 <1> ; 146 <1> ; EOF = 0 if End Of File on input 147 <1> ; RAW = 1 if this device is in Raw mode 148 <1> ; = 0 if this device is cooked 149 <1> ; ISCLK = 1 if this device is the clock device 150 <1> ; ISNUL = 1 if this device is the null device 151 <1> ; ISCOT = 1 if this device is the console output 152 <1> ; ISCIN = 1 if this device is the console input 153 <1> ; 154 <1> ; If ISDEV = 0 155 <1> ; EOF = 0 if channel has been written 156 <1> ; Bits 0-5 are the block device number for 157 <1> ; the channel (0 = A, 1 = B, ...) 158 <1> ; 159 <1> devid_ISDEV EQU 80h 160 <1> devid_EOF EQU 40h 161 <1> devid_RAW EQU 20h 162 <1> devid_SPECIAL EQU 10H 163 <1> devid_ISCLK EQU 08h 164 <1> devid_ISNUL EQU 04h 165 <1> devid_ISCOT EQU 02h 166 <1> devid_ISCIN EQU 01h 167 <1> 168 <1> devid_block_dev EQU 1Fh ; mask for block device number 17 %include "dirent.mac" 1 <1> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 3 <1> Break 4 <1> 5 <1> ; 6 <1> ; +---------------------------+ 7 <1> ; | (12 BYTE) filename/ext | 0 0 8 <1> ; +---------------------------+ 9 <1> ; | (BYTE) attributes | 11 B 10 <1> ; +---------------------------+ 11 <1> ; | (10 BYTE) reserved | 12 C 12 <1> ; +---------------------------+ 13 <1> ; | (WORD) time of last write | 22 16 14 <1> ; +---------------------------+ 15 <1> ; | (WORD) date of last write | 24 18 16 <1> ; +---------------------------+ 17 <1> ; | (WORD) First cluster | 26 1A 18 <1> ; +---------------------------+ 19 <1> ; | (DWORD) file size | 28 1C 20 <1> ; +---------------------------+ 21 <1> ; 22 <1> ; First byte of filename = E5 -> free directory entry 23 <1> ; = 00 -> end of allocated directory 24 <1> ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour 25 <1> ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980 26 <1> ; 27 <1> 28 <1> dir_entry STRUC 29 00000000 <1> dir_name DB 11 DUP (?) ; file name 0 00000D1D ?? dir_attr DB ? ; attribute bits 0 00000D1E ???? dir_codepg dw ? ; code page DOS 4.00 0 00000D20 ???? dir_extcluster dw ? ; extended attribute starting cluster 0 00000D22 ?? dir_attr2 db ? ; reserved 0 00000D23 ?????????? dir_pad DB 5 DUP (?) ; reserved for expansion 0 00000D28 ???? dir_time DW ? ; time of last write 0 00000D2A ???? dir_date DW ? ; date of last write 0 00000D2C ???? dir_first DW ? ; first allocation unit of file 0 00000D2E ???? dir_size_l DW ? ; low 16 bits of file size 0 00000D30 ???? dir_size_h DW ? ; high 16 bits of file size 40 <1> dir_entry ENDS 41 <1> 42 <1> attr_read_only EQU 1h 43 <1> attr_hidden EQU 2h 44 <1> attr_system EQU 4h 45 <1> attr_volume_id EQU 8h 46 <1> attr_directory EQU 10h 47 <1> attr_archive EQU 20h 48 <1> attr_device EQU 40h ; This is a VERY special bit. 49 <1> ; NO directory entry on a disk EVER 50 <1> ; has this bit set. It is set non-zero 51 <1> ; when a device is found by GETPATH 52 <1> 53 <1> attr_all EQU attr_hidden+attr_system+attr_directory 54 <1> ; OR of hard attributes for FINDENTRY 55 <1> 56 <1> attr_ignore EQU attr_read_only+attr_archive+attr_device 57 <1> ; ignore this(ese) attribute(s) during 58 <1> ; search first/next 59 <1> 60 <1> attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive 61 <1> ; changeable via CHMOD 18 %include "curdir.mac" 1 <1> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 3 <1> BREAK 4 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <1> ; C A V E A T P R O G R A M M E R ; 6 <1> ; ; 7 <1> ; CDS items are used bu the internal routines to store cluster numbers and ; 8 <1> ; network identifiers for each logical name. The ID field is used dually, ; 9 <1> ; both as net ID and for a cluster number for local devices. In the case ; 10 <1> ; of local devices, the cluster number will be -1 if there is a potential ; 11 <1> ; of the disk being changed or if the path must be recracked. The END ; 12 <1> ; field is the location of the end of the definition. No .. is allowed ; 13 <1> ; past this point ; 14 <1> 15 <1> DIRSTRLEN EQU 64+3 ; Max length in bytes of directory strings 16 <1> TEMPLEN EQU DIRSTRLEN*2 17 <1> 18 <1> curdir_list STRUC 19 00000000 <1> curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 0 00000D55 ???? curdir_flags DW ? ; various flags 0 00000D57 ???????? curdir_devptr DD ? ; local pointer to DPB or net device 0 00000D5B ???? curdir_ID DW ? ; cluster of current dir (net ID) 0 00000D5D ???? DW ? 0 00000D5F ???? curdir_user_word DW ? 0 00000D61 ???? curdir_end DW ? ; end of assignment 0 00000D63 ?? curdir_type DB ? ; IFS drive (2=ifs, 4=netuse) 0 00000D64 ???????? curdir_ifs_hdr DD ? ; Ptr to File System Header 0 00000D68 ???? curdir_fsda DB 2 DUP (?) ; File System Dependent Data Area 29 <1> curdir_list ENDS 30 <1> 31 <1> curdirLen EQU curdir_list_struc_size ; Needed for screwed up 32 <1> ; ASM87 which doesn't allow 33 <1> ; Size directive as a macro 34 <1> ; argument 35 <1> labelsize curdir_netID, dword, curdir_ID 36 <1> 37 <1> ;Flag word masks 38 <1> curdir_isnet EQU 1000000000000000B 39 <1> curdir_isifs EQU 1000000000000000B ; DOS 4.00 40 <1> curdir_inuse EQU 0100000000000000B 41 <1> curdir_splice EQU 0010000000000000B 42 <1> curdir_local EQU 0001000000000000B 43 <1> ; ; 44 <1> ; C A V E A T P R O G R A M M E R ; 45 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 %include "dpb.mac" 1 <1> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <1> BREAK 4 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <1> ; C A V E A T P R O G R A M M E R ; 6 <1> ; ; 7 <1> dpb STRUC 0 00000D12 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 00000D13 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 00000D14 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 00000D16 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 00000D17 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 00000D18 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 00000D1A ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 00000D1B ???? dpb_root_entries DW ? ; Number of directory entries 0 00000D1D ???? dpb_first_sector DW ? ; First sector of first cluster 0 00000D1F ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 00000D21 ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 00000D23 ???? dpb_dir_sector DW ? ; Starting record of directory 0 00000D25 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 00000D29 ?? dpb_media DB ? ; Media byte 0 00000D2A ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <1> ; check the first time this DPB is used 0 00000D2B ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 00000D2F ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 00000D31 ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <1> dpb ENDS 28 <1> 29 <1> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <1> 31 <1> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <1> ; ; 33 <1> ; C A V E A T P R O G R A M M E R ; 34 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 20 %include "buffer.mac" 1 <1> %include "buf2sw.mac" 1 <2> %define BUF2 1 2 <1> 3 <1> ; SCCSID = @(#)buffer.asm 1.1 85/04/09 4 <1> BREAK 5 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 6 <1> ; C A V E A T P R O G R A M M E R ; 7 <1> ; ; 8 <1> 9 <1> %ifdef BUF2 10 <1> 11 <1> ; Field definition for I/O buffer information 12 <1> 13 <1> BUFFINFO STRUC 0 00000D12 ???????? NEXTBUF DD ? ; Pointer to next buffer in list 15 <1> ; The next two items are often refed as a word 16 <1> buf_ID: 0 00000D16 ?? BUFDRV DB ? ; Logical drive # assoc with buffer FF = free 18 <1> buf_flags: 0 00000D17 ?? BUFDATAFLAG db ? 0 00000D18 ?? BUFPRI DB ? ; Buffer selection priority (see EQUs below) 0 00000D19 ?? alignb 2 22 <1> buf_sector: 0 00000D1A ???????? BUFSECNO dd ? ; Sector number of buffer 24 <1> alignb 2 0 00000D1E ???????? BUFDRVDP DD ? ; Pointer to drive parameters 26 <1> BUFFINFO ENDS 27 <1> 28 <1> BUFINSIZ EQU BUFFINFO_struc_size 29 <1> ; Size of structure in bytes 30 <1> BUFINSIZE equ BUFINSIZ 31 <1> 32 <1> FREEPRI EQU 0 33 <1> LBRPRI EQU 2 ; Last byte of buffer read 34 <1> LBWPRI EQU 4 ; Last byte written 35 <1> RPRI EQU 6 ; Read but not last byte 36 <1> WPRI EQU 8 ; Written but not last byte 37 <1> DIRPRI EQU 15 ; Directory Sector 38 <1> FATPRI EQU 30 ; FAT sector 39 <1> 40 <1> buf_dirty EQU 01000000B 41 <1> buf_isDATA EQU 00001000B 42 <1> buf_isDIR EQU 00000100B 43 <1> buf_isFAT EQU 00000010B 44 <1> buf_type_0 EQU 11110001B ; AND sets type to "none" 45 <1> 46 <1> %else 47 <1> 48 <1> ; Field definition for I/O buffer information 49 <1> 50 <1> BUFFINFO STRUC 51 <1> buf_next DW ? ; Pointer to next buffer in list 52 <1> buf_prev DW ? ; Pointer to prev buffer in list 53 <1> buf_ID DB ? ; Drive of buffer (bit 7 = 0) 54 <1> ; SFT table index (bit 7 = 1) 55 <1> ; = FFH if buffer free 56 <1> buf_flags DB ? ; Bit 7 = 1 if Remote file buffer 57 <1> ; = 0 if Local device buffer 58 <1> ; Bit 6 = 1 if buffer dirty 59 <1> ; Bit 5 = Reserved 60 <1> ; Bit 4 = Search bit (bit 7 = 1) 61 <1> ; Bit 3 = 1 if buffer is DATA 62 <1> ; Bit 2 = 1 if buffer is DIR 63 <1> ; Bit 1 = 1 if buffer is FAT 64 <1> ; Bit 0 = Reserved 65 <1> buf_sector DD ? ; Sector number of buffer (bit 7 = 0) 66 <1> ; The next two items are often refed as a word (bit 7 = 0) 67 <1> buf_wrtcnt DB ? ; For FAT sectors, # times sector written out 68 <1> buf_wrtcntinc DW ? ; " " " , # sectors between each write 69 <1> buf_DPB DD ? ; Pointer to drive parameters 70 <1> buf_fill DW ? ; How full buffer is (bit 7 = 1) 71 <1> buf_reserved DB ? ; make DWORD boundary for 386 72 <1> BUFFINFO ENDS 73 <1> 74 <1> labelsize buf_offset, dword, buf_sector 75 <1> ;For bit 7 = 1, this is the byte 76 <1> ;offset of the start of the buffer in 77 <1> ;the file pointed to by buf_ID. Thus 78 <1> ;the buffer starts at location 79 <1> ;buf_offset in the file and contains 80 <1> ;buf_fill bytes. 81 <1> 82 <1> BUFINSIZ EQU BUFFINFO_struc_size 83 <1> ; Size of structure in bytes 84 <1> 85 <1> buf_Free EQU 0FFh ; buf_id of free buffer 86 <1> 87 <1> ;Flag byte masks 88 <1> buf_isnet EQU 10000000B 89 <1> buf_dirty EQU 01000000B 90 <1> 91 <1> buf_isDATA EQU 00001000B 92 <1> buf_isDIR EQU 00000100B 93 <1> buf_isFAT EQU 00000010B 94 <1> buf_type_0 EQU 11110001B ; AND sets type to "none" 95 <1> 96 <1> buf_NetID EQU BUFINSIZ 97 <1> 98 <1> ; 99 <1> ; Buffer Hash Entry Structure 100 <1> 101 <1> BUFFER_HASH_ENTRY STRUC ; DOS 4.00 102 <1> EMS_PAGE_NUM DW ? ; logical page number for EMS handle 103 <1> BUFFER_BUCKET DD ? ; pointer to buffers 104 <1> DIRTY_COUNT DB ? ; number of dirty buffers 105 <1> BUFFER_RESERVED DB ? ; reserved 106 <1> BUFFER_HASH_ENTRY ENDS 107 <1> 108 <1> MaxBuffinBucket EQU 15 ; Max number of buffers per bucket 109 <1> MaxBucketinPage EQU 2 ; Max number of buckets per 16kb page 110 <1> 111 <1> %endif 112 <1> 113 <1> ; ; 114 <1> ; C A V E A T P R O G R A M M E R ; 115 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 21 %include "arena.mac" 1 <1> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <1> ;BREAK 3 <1> 4 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <1> ; C A V E A T P R O G R A M M E R ; 6 <1> ; ; 7 <1> ; 8 <1> ; arena item 9 <1> ; 10 <1> arena STRUC 0 00000D12 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00000D13 ???? arena_owner DW ? ; owner of arena item 0 00000D15 ???? arena_size DW ? ; size in paragraphs of item 0 00000D17 ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00000D1A ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <1> arena ENDS 17 <1> 18 <1> ; 19 <1> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <1> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <1> ; them and change ALLOC.ASM. 22 <1> 23 <1> arena_owner_system EQU 0 ; free block indication 24 <1> 25 <1> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <1> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <1> ; ; 28 <1> ; C A V E A T P R O G R A M M E R ; 29 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <1> 22 %include "vector.mac" 1 <1> ; SCCSID = @(#)vector.asm 1.1 85/04/10 2 <1> BREAK 3 <1> 4 <1> ;Asmvar AltVect 5 <1> %ifndef AltVect 6 <1> %iassign AltVect 0 7 <1> %endif 8 <1> 9 <1> INTTAB EQU 20H 10 <1> inttab equ INTTAB ; NASM port equate 11 <1> INTBASE EQU 4 * inttab 12 <1> ENTRYPOINT EQU INTBASE+40H 13 <1> 14 <1> %IF ALTVECT 15 <1> ALTTAB EQU 0F0H 16 <1> ALTBASE EQU 4 * ALTTAB 17 <1> %ENDIF 18 <1> 19 <1> ; 20 <1> ; interrupt assignments 21 <1> ; 22 <1> %IFN ALTVECT 23 <1> int_abort EQU INTTAB ; abort process 24 <1> int_command EQU int_abort+1 ; call MSDOS 25 <1> int_terminate EQU int_abort+2 ; int to terminate address 26 <1> int_ctrl_c EQU int_abort+3 ; ^c trapper 27 <1> int_fatal_abort EQU int_abort+4 ; hard disk error 28 <1> int_disk_read EQU int_abort+5 ; logical sector disk read 29 <1> int_disk_write EQU int_abort+6 ; logical sector disk write 30 <1> int_keep_process EQU int_abort+7 ; terminate program and stay 31 <1> ; resident 32 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <1> ; C A V E A T P R O G R A M M E R ; 34 <1> ; ; 35 <1> int_spooler EQU int_abort+8 ; spooler call 36 <1> int_fastcon EQU int_abort+9 ; fast CON interrupt 37 <1> int_IBM EQU int_abort+10; critical section maintenance 38 <1> ; ; 39 <1> ; C A V E A T P R O G R A M M E R ; 40 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <1> %ELSE 42 <1> int_abort EQU INTTAB ; abort process 43 <1> int_command EQU int_abort+1 ; call MSDOS 44 <1> int_terminate EQU ALTTAB ; int to terminate address 45 <1> int_ctrl_c EQU int_terminate+1 ; ^c trapper 46 <1> int_fatal_abort EQU int_terminate+2 ; hard disk error 47 <1> int_disk_read EQU int_abort+5 ; logical sector disk read 48 <1> int_disk_write EQU int_abort+6 ; logical sector disk write 49 <1> int_keep_process EQU int_abort+7 ; terminate program and stay resident 50 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 51 <1> ; C A V E A T P R O G R A M M E R ; 52 <1> ; ; 53 <1> int_spooler EQU int_terminate+3 ; spooler call 54 <1> int_fastcon EQU int_abort+9 ; fast CON interrupt 55 <1> ; ; 56 <1> ; C A V E A T P R O G R A M M E R ; 57 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <1> %ENDIF 59 <1> 60 <1> addr_int_abort EQU 4 * int_abort 61 <1> addr_int_command EQU 4 * int_command 62 <1> addr_int_terminate EQU 4 * int_terminate 63 <1> addr_int_ctrl_c EQU 4 * int_ctrl_c 64 <1> addr_int_fatal_abort EQU 4 * int_fatal_abort 65 <1> addr_int_disk_read EQU 4 * int_disk_read 66 <1> addr_int_disk_write EQU 4 * int_disk_write 67 <1> addr_int_keep_process EQU 4 * int_keep_process 68 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 69 <1> ; C A V E A T P R O G R A M M E R ; 70 <1> ; ; 71 <1> addr_int_spooler EQU 4 * int_spooler 72 <1> addr_int_fastcon EQU 4 * int_fastcon 73 <1> addr_int_IBM EQU 4 * int_IBM 74 <1> ; ; 75 <1> ; C A V E A T P R O G R A M M E R ; 76 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 23 %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 0 00000D12 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 00000D16 ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 00000D18 ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 00000D1A ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 00000D1C ???????????????? 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 0 00000D12 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00000D13 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00000D14 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00000D15 ???? REQSTAT DW ? ;STATUS WORD 0 00000D17 ???????????????? 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 <1> DB (SRHEAD_struc_size) DUP(?) 157 <1> ; GENERIC IOCTL ADDITION. 0 00000D1F ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00000D20 ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00000D21 ???? REG_SI DW ? 0 00000D23 ???? REG_DI DW ? 0 00000D25 ???????? 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 0 00000D12 ???????? SECTOR_RBA DD ? ; relative block address 0 00000D16 ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 00000D18 ???????? 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 0 00000D12 ???? MEDIA_level DW ? ; info level 0 00000D14 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <1> MEDIA_Label DB 11 dup (?) ;volume label 0 00000D23 ???????????????? 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 24 %include "pdb.mac" 1 <1> ; SCCSID = @(#)pdb.asm 1.1 85/04/10 2 <1> BREAK 3 <1> 4 <1> ; 5 <1> ; Process data block (otherwise known as program header) 6 <1> ; 7 <1> 8 <1> FilPerProc EQU 20 9 <1> 10 <1> Process_data_block STRUC 0 00000D12 ???? PDB_Exit_Call DW ? ; INT int_abort system terminate 0 00000D14 ???? PDB_block_len DW ? ; size of execution block 0 00000D16 ?? DB ? 0 00000D17 ?????????? PDB_CPM_Call DB 5 DUP (?) ; ancient call to system 0 00000D1C ???????? PDB_Exit DD ? ; pointer to exit routine 0 00000D20 ???????? PDB_Ctrl_C DD ? ; pointer to ^C routine 0 00000D24 ???????? PDB_Fatal_abort DD ? ; pointer to fatal error 18 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 <1> ; C A V E A T P R O G R A M M E R ; 20 <1> ; ; 0 00000D28 ???? PDB_Parent_PID DW ? ; PID of parent (terminate PID) 22 00000018 <1> PDB_JFN_Table DB FilPerProc DUP (?) 23 <1> ; indices into system table 24 <1> ; ; 25 <1> ; C A V E A T P R O G R A M M E R ; 26 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D3E ???? PDB_environ DW ? ; seg addr of environment 28 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 29 <1> ; C A V E A T P R O G R A M M E R ; 30 <1> ; ; 0 00000D40 ???????? PDB_User_stack DD ? ; stack of self during system calls 0 00000D44 ???? PDB_JFN_Length DW ? ; number of handles allowed 0 00000D46 ???????? PDB_JFN_Pointer DD ? ; pointer to JFN table 0 00000D4A ???????? PDB_Next_PDB DD ? ; pointer to nested PDB's 35 0000003C <1> PDB_PAD1 DB 14h DUP (?) 36 <1> ; ; 37 <1> ; C A V E A T P R O G R A M M E R ; 38 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D62 ?????????? PDB_Call_system DB 5 DUP (?) ; portable method of system call 40 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <1> ; C A V E A T P R O G R A M M E R ; 42 <1> ; ; 0 00000D67 ?????????????? PDB_PAD2 DB 7h DUP (?) 44 <1> ; ; 45 <1> ; C A V E A T P R O G R A M M E R ; 46 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 47 <1> Process_data_block ENDS 48 <1> 49 <1> labelsize PDB_InterCon, byte, PDB_PAD1 ; 2/12/KK 50 <1> labelsize PDB_Append, byte, PDB_PAD1+1 ; 2/12/KK 25 %include "find.mac" 1 <1> ; SCCSID = @(#)find.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)find.asm 1.1 85/04/10 3 <1> Break 4 <1> 5 <1> find_buf STRUC 6 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 7 <1> ; C A V E A T P R O G R A M M E R ; 8 <1> ; ; 0 00000D12 ?? find_buf_drive DB ? ; drive of search 10 00000001 <1> find_buf_name DB 11 DUP (?) ; formatted name 0 00000D1E ?? find_buf_sattr DB ? ; attribute of search 0 00000D1F ???? find_buf_LastEnt DW ? ; LastEnt 0 00000D21 ???? find_buf_DirStart DW ? ; DirStart 0 00000D23 ???????? find_buf_NetID DB 4 DUP (?) ; Reserved for NET 15 <1> ; ; 16 <1> ; C A V E A T P R O G R A M M E R ; 17 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 18 <1> 0 00000D27 ?? find_buf_attr DB ? ; attribute found 0 00000D28 ???? find_buf_time DW ? ; time 0 00000D2A ???? find_buf_date DW ? ; date 0 00000D2C ???? find_buf_size_l DW ? ; low(size) 0 00000D2E ???? find_buf_size_h DW ? ; high(size) 24 0000001E <1> find_buf_pname DB 13 DUP (?) ; packed name 25 <1> find_buf ENDS 26 %include "mi.mac" 1 <1> ; SCCSID = @(#)mi.asm 1.1 85/04/10 2 <1> BREAK 3 <1> 4 <1> mi_INT EQU 0CDh 5 <1> mi_Long_JMP EQU 0EAh 6 <1> mi_Long_CALL EQU 09Ah 7 <1> mi_Long_RET EQU 0CBh 8 <1> mi_Near_RET EQU 0C3h 9 <1> 10 <1> ; xxxxoditszxaxpxc 11 <1> f_Overflow EQU 0000100000000000B 12 <1> f_Direction EQU 0000010000000000B 13 <1> f_Interrupt EQU 0000001000000000B 14 <1> f_Trace EQU 0000000100000000B 15 <1> f_Sign EQU 0000000010000000B 16 <1> f_Zero EQU 0000000001000000B 17 <1> f_Aux EQU 0000000000010000B 18 <1> f_Parity EQU 0000000000000100B 19 <1> f_Carry EQU 0000000000000001B 27 ;.cref 28 [list +] 29 30 ;TITLE IBMDATA - DATA segment for DOS 31 ;NAME IBMDATA 32 33 %iassign installed TRUE 34 35 ;=== Push trace listing source: ms_data.nas 36 %include "ms_data.nas" ; NASM included file 1 <1> %include "nasmorg.mac" 1 <2> 2 <2> %if 0 3 <2> 4 <2> NASM macros to replace JWasm org directive 5 <2> 2024 by E. C. Masloch, Public Domain 6 <2> 7 <2> %endif 8 <2> 9 <2> %imacro org 1-2.nolist db 0 10 <2> times (%1) - ($ - $$) %2 11 <2> %endmacro 2 <1> 3 <1> ; SCCSID = @(#)msdata.asm 1.8 85/09/12 4 <1> %ifndef Kanji 5 <1> %iassign Kanji 0 6 <1> %endif 7 <1> %ifndef Debug 8 <1> %iassign Debug 0 9 <1> %endif 10 <1> %ifndef Redirector 11 <1> %iassign Redirector 0 12 <1> %endif 13 <1> %ifndef ShareF 14 <1> %iassign ShareF 0 15 <1> %endif 16 <1> 17 <1> Break 18 <1> 19 <1> %define RECORDED none, none 20 <1> %macro record 2.nolist 21 <1> %%before: 22 <1> %1 23 <1> %%after: 24 <1> %assign %%i 0 25 <1> %rep %%after - %%before 26 <1> %assign %%offset %%before + %%i - MSDAT001S 27 <1> %xdefine RECORDED RECORDED, %%offset, %2 28 <1> %assign %%i %%i + 1 29 <1> %endrep 30 <1> %endmacro 31 <1> === Switch to base=000E10h -> "DATA" 32 <1> section DATA 33 <1> ; Init code overlaps with data area below 34 <1> 35 <1> absolute $ 36 <1> 37 <1> ORG 0, resb 1 38 <1> MSDAT001E equ MSDAT001e ; NASM port label 39 <1> PUBLIC MSDAT001S,MSDAT001E 40 <1> MSDAT001S label byte 41 <1> 0 000003B6 ???????????? I_am_nobits TIMEBUF,6 ; Time read from clock device 0 000003BC ???? I_am_nobits DEVIOBUF,2 ; Buffer for I/O under file assignment 44 <1> ; 45 <1> ; The following areas are used as temp buffer in EXEC system call 46 <1> ; 47 00000008 <1> I_am_nobits OPENBUF,128 ; buffer for name operations 48 00000088 <1> I_am_nobits RenBuf,128 ; buffer for rename destination 49 <1> ; Buffer for search calls 50 00000108 <1> I_am_nobits SEARCHBUF,53 ; internal search buffer 51 0000013D <1> I_am_nobits DummyCDS,curdirLen 52 <1> ; 53 <1> ; End of contiguous buffer 54 <1> ; 55 <1> 56 <1> ; 57 <1> ; Temporary directory entry for use by many routines. Device directory 58 <1> ; entries (bogus) are built here. 59 <1> ; 60 <1> DevFCB equ DEVFCB ; NASM port label 61 <1> PUBLIC DevFCB 62 <1> DEVFCB LABEL BYTE ; Uses NAME1, NAME2, combined 63 <1> ; WARNING.. do not alter position of NAME1 relative to DEVFCB 64 <1> ; without first examining BUILD_DEVICE_ENT. Look carefully at DOS_RENAME 65 <1> ; as well as it is the only guy who uses NAME2 and DESTSTART. 66 00000195 <1> I_am_nobits NAME1,12 ; File name buffer 67 000001A1 <1> I_am_nobits NAME2,13 ; 0 00000564 ???? I_am_nobits DESTSTART,WORD ; 69 <1> DIR_ENTRY_struc_size equ dir_entry_struc_size ; NASM port equate 0 00000566 ?????????? DB ((DIR_ENTRY_struc_size) - ($ - DEVFCB)) DUP (?) 71 <1> ; 72 <1> ; End Temporary directory entry. 73 <1> ; 0 0000056B ?? I_am_nobits ATTRIB,BYTE ; storage for file attributes 0 0000056C ?? I_am_nobits EXTFCB,BYTE ; TRUE => extended FCB in use 0 0000056D ?? I_am_nobits SATTRIB,BYTE ; Storage for search attributes 77 <1> %if EXTFCB + 1 != SATTRIB ; used in macro2.nas 78 <1> %error Unexpected layout 79 <1> %endif 0 0000056E ?? I_am_nobits open_access,BYTE ; access of open system call 0 0000056F ?? I_am_nobits FoundDel,BYTE ; true => file was deleted 0 00000570 ?? I_am_nobits Found_dev,BYTE ; true => search found a device 0 00000571 ?? I_am_nobits fSplice,BYTE ; true => do a splice in transpath 0 00000572 ?? I_am_nobits fSharing,BYTE ; TRUE => no redirection 0 00000573 ?? I_am_nobits SECCLUSPOS,BYTE ; Position of first sector within cluster 0 00000574 ?? I_am_nobits TRANS,BYTE ; 0 00000575 ?? I_am_nobits READOP,BYTE ; 0 00000576 ?? I_am_nobits THISDRV,BYTE ; 0 00000577 ?? I_am_nobits CLUSFAC,BYTE ; 0 00000578 ?? I_am_nobits CLUSSPLIT,BYTE ; 0 00000579 ?? I_am_nobits INSMODE,BYTE ; true => insert mode in buffered read 0 0000057A ?? I_am_nobits cMeta,BYTE ; count of meta'ed components found 0 0000057B ?? I_am_nobits VOLID,BYTE ; 0 0000057C ?? I_am_nobits exit_type,BYTE ; type of exit... 95 <1> 0 0000057D ?? record alignb 2, 90h 97 <1> 98 <1> ; WARNING - the following two items are accessed as a word 0 0000057E ?? I_am_nobits CREATING,BYTE ; true => creating a file 0 0000057F ?? I_am_nobits DELALL,BYTE ; true => deleting everything 101 <1> 0 00000580 ???????? I_am_nobits EXITHOLD,DWORD ; Temp location for proc terminate 0 00000584 ???? I_am_nobits user_SP,WORD ; User SP for system call 0 00000586 ???? I_am_nobits user_SS,WORD ; User SS for system call 0 00000588 ???? I_am_nobits CONTSTK,WORD ; 0 0000058A ???????? I_am_nobits THISDPB,DWORD ; 0 0000058E ???? I_am_nobits CLUSSAVE,WORD ; 0 00000590 ???????? I_am_nobits CLUSSEC,DWORD ;>32mb AC0000 0 00000594 ???? I_am_nobits PREREAD,WORD ; 0 means preread; 1 means optional 0 00000596 ???? I_am_nobits FATBYT,WORD ; Used by ALLOCATE 0 00000598 ???? I_am_nobits FATBYTE,WORD ; Used by $SLEAZEFUNC 0 0000059A ???????? I_am_nobits DEVPT,DWORD ; 0 0000059E ???????? I_am_nobits THISSFT,DWORD ; Address of user SFT 0 000005A2 ???????? I_am_nobits THISCDS,DWORD ; Address of current CDS 0 000005A6 ???????? I_am_nobits THISFCB,DWORD ; Address of user FCB 0 000005AA ???? record {I_am_nobits SFN,WORD,<-1>}, 255 ; SystemFileNumber found for accessfile 0 000005AC ???? I_am_nobits JFN,WORD ; JobFileNumber found for accessfile 0 000005AE ???????? I_am_nobits PJFN,DWORD ; PointerJobFileNumber found for accessfile 0 000005B2 ???? I_am_nobits WFP_START,WORD ; 0 000005B4 ???? I_am_nobits REN_WFP,WORD ; 0 000005B6 ???? I_am_nobits CURR_DIR_END,WORD ; 0 000005B8 ???? I_am_nobits NEXTADD,WORD ; 0 000005BA ???? I_am_nobits LASTPOS,WORD ; 0 000005BC ???? I_am_nobits CLUSNUM,WORD ; 0 000005BE ???????? I_am_nobits DIRSEC,DWORD ;>32mb AC0000 0 000005C2 ???? I_am_nobits DIRSTART,WORD ; 0 000005C4 ???????? I_am_nobits SECPOS,DWORD ;>32mb Position of first sector accessed 0 000005C8 ???????? I_am_nobits VALSEC,DWORD ;>32mb Number of valid (previously written) 129 <1> ; sectors 0 000005CC ???? I_am_nobits BYTSECPOS,WORD ; Position of first byte within sector 0 000005CE ???????? I_am_nobits BYTPOS,4 ; Byte position in file of access 0 000005D2 ???? I_am_nobits BYTCNT1,WORD ; No. of bytes in first sector 0 000005D4 ???? I_am_nobits BYTCNT2,WORD ; No. of bytes in last sector 0 000005D6 ???? I_am_nobits SECCNT_DOS,WORD ; No. of whole sectors 0 000005D8 ???? I_am_nobits ENTFREE,WORD ; 0 000005DA ???? I_am_nobits ENTLAST,WORD ; 0 000005DC ???? I_am_nobits NXTCLUSNUM,WORD ; 0 000005DE ???????? I_am_nobits GROWCNT,DWORD ; 0 000005E2 ???????? I_am_nobits CURBUF,DWORD ; 0 000005E6 ???????? I_am_nobits CONSft,DWORD ; SFT of console swapped guy. 0 000005EA ???? I_am_nobits SaveBX,WORD ; 0 000005EC ???? I_am_nobits SaveDS,WORD ; 0 000005EE ???? I_am_nobits restore_tmp,WORD ; return address for restore world 0 000005F0 ???? I_am_nobits NSS,WORD 0 000005F2 ???? I_am_nobits NSP,WORD 0 000005F4 ???? I_am_nobits EXTOPEN_FLAG,WORD,<0> ;FT. extended open input flag ;AN000; 0 000005F6 ?? I_am_nobits EXTOPEN_ON,BYTE,<0> ;FT. extended open conditional flag ;AN000; 0 000005F7 ???? I_am_nobits EXTOPEN_IO_MODE,WORD,<0>;FT. extende open io mode ;AN000; 0 000005F9 ???? I_am_nobits SAVE_DI,WORD ;FT. extende open saved DI ;AN000; 0 000005FB ???? I_am_nobits SAVE_ES,WORD ;FT. extende open saved ES ;AN000; 0 000005FD ???? I_am_nobits SAVE_DX,WORD ;FT. extende open saved DX ;AN000; 0 000005FF ???? I_am_nobits SAVE_CX,WORD ;FT. extende open saved CX ;AN000; 0 00000601 ???? I_am_nobits SAVE_BX,WORD ;FT. extende open saved BX ;AN000; 0 00000603 ???? I_am_nobits SAVE_SI,WORD ;FT. extende open saved SI ;AN000; 0 00000605 ???? I_am_nobits SAVE_DS,WORD ;FT. extende open saved DS ;AN000; 0 00000607 ???? I_am_nobits HIGH_SECTOR,WORD,<0> ;>32mb higher sector # ;AN000; 0 00000609 ???? I_am_nobits HIGH_SECTOR_TEMP,WORD,<0>;>32mb high sector # ;AN000; 0 0000060B ?? I_am_nobits DISK_FULL,BYTE ;>32mb indicating disk full when 1 ;AN000; 0 0000060C ???? I_am_nobits TEMP_VAR,WORD ; temporary variable for everyone ;AN000; 0 0000060E ???? I_am_nobits TEMP_VAR2,WORD ; temporary variable 2 for everyone ;AN000; 0 00000610 ?? I_am_nobits DrvErr,BYTE ; used to save drive error ;AN000; 0 00000611 ???? I_am_nobits DOS34_FLAG,WORD,<0> ; common flag for DOS 3.4 ;AN000; 0 00000613 ???????? I_am_nobits NO_FILTER_PATH,DWORD ; pointer to orignal path ;AN000; 0 00000617 ???????? I_am_nobits NO_FILTER_DPATH,DWORD ; pointer to orignal path of destination;AN000; 0 0000061B ???? I_am_nobits Callback_SS,WORD ;AN000; call back SS for system call 0 0000061D ???? I_am_nobits Callback_SP,WORD ;AN000; call back SP for system call 0 0000061F ?? I_am_nobits Callback_flag,BYTE,<0> ;AN000; call back flag 168 <1> 169 <1> 170 <1> ; make those pushes fast!!! 171 <1> record alignb 2, 90h 172 <1> StackSize equ 180h ; gross but effective 173 <1> ;;;StackSize = 300h ; This is a "trial" change IBM hasn't 174 <1> ;;; ; made up their minds about 175 <1> 176 <1> ; 177 <1> ; WARNING!!!! DskStack may grow into AUXSTACK due to interrupt service. 178 <1> ; This is NO problem as long as AUXSTACK comes immediately before DSKSTACK 179 <1> ; 180 <1> 181 <1> PUBLIC RENAMEDMA,AuxStack,DskStack,IOStack 182 <1> RENAMEDMA LABEL BYTE ; See DOS_RENAME 183 <1> 184 0000026A <1> DB StackSize DUP (?) ; 185 <1> AuxStack LABEL BYTE 186 <1> 187 000003EA <1> DB StackSize DUP (?) ; 188 <1> DskStack LABEL BYTE 189 <1> 190 0000056A <1> DB StackSize DUP (?) ; 191 <1> IOStack LABEL BYTE 192 <1> 193 <1> 194 <1> ; patch space for Boca folks. 195 <1> ; Say What????!!! This does NOT go into the swappable area! 196 <1> ; NOTE: We include the decl of ibmpatch in ms-dos even though it is not needed. 197 <1> ; This allows the REDIRector to work on either IBM or MS-DOS. 198 <1> 199 <1> PUBLIC IBMPATCH 200 <1> IBMPATCH label byte 0 00000AA0 ?? I_am_nobits PRINTER_FLAG,BYTE,<0> ; [SYSTEM] status of PRINT utility 0 00000AA1 ?? I_am_nobits VOLCHNG_FLAG,BYTE,<0> ; [SYSTEM] true if volume label created 0 00000AA2 ?? I_am_nobits VIRTUAL_OPEN,BYTE,<0> ; [SYSTEM] non-zero if we opened a virtual file 204 <1> 205 <1> ; Following 4 variables moved to MSDATA.asm from MSTABLE.asm (P4986) 0 00000AA3 ?? I_am_nobits FSeek_drive,BYTE ;AN000; fastseek drive # 0 00000AA4 ???? I_am_nobits FSeek_firclus,WORD ;AN000; fastseek first cluster # 0 00000AA6 ???? I_am_nobits FSeek_logclus,WORD ;AN000; fastseek logical cluster # 0 00000AA8 ???? I_am_nobits FSeek_logsave,WORD ;AN000; fastseek returned log clus # 210 <1> %ifndef BUF2 211 <1> record {I_am_nobits ACT_PAGE,WORD,<-1>}, 255 ;;;;;;; ;BL ; active EMS page ;AN000; 212 <1> %endif 213 <1> 214 <1> ; lDOS extensions 215 <1> record alignb 2, 90h 0 00000AAA ???? I_am_nobits CLUSTER_FACTOR_EDR,WORD 0 00000AAC ???? I_am_nobits CLUSTER_NEXT_EDR,WORD 0 00000AAE ???? I_am_nobits dosdata_to_doscode,WORD 219 <1> dosdata_to_doscode_segment equ dosdata_to_doscode 220 <1> global dosdata_to_doscode_segment 0 00000AB0 ???? record {I_am_nobits first_umcb, word, <-1>}, 255 0 00000AB2 ?? I_am_nobits enable_uma, byte 0 00000AB3 ?? I_am_nobits alloc_strategy_ext, byte 0 00000AB4 ???? I_am_nobits first_hmcb, word 0 00000AB6 ?? I_am_nobits doslocation3306, byte 0 00000AB7 ?? I_am_nobits doslocation3001, byte 0 00000AB8 ???? I_am_nobits backdoor_free_mcb_exec, word 0 00000ABA ???????? record {I_am_nobits backdoor_indicator, dword, <-1, -1>}, 255 229 <1> 0 00000ABE ???????? I_am_nobits shell_return_address, dword 0 00000AC2 ?? record {I_am_nobits shell_return_has_been_freed, byte, <-1>}, 255 232 <1> 233 <1> SWAP_END LABEL BYTE 234 <1> PUBLIC SWAP_END 235 <1> 236 <1> ; THE FOLLOWING BYTE MUST BE HERE, IMMEDIATELY FOLLOWING SWAP_END. IT CANNOT 237 <1> ; BE USED. If the size of the swap data area is ODD, it will be rounded up 238 <1> ; to include this byte. 0 00000AC3 ?? DB ? 240 <1> 241 <1> ibmpatch equ IBMPATCH ; NASM port label 242 0000070E <1> DB (512+80+32-(SWAP_END-ibmpatch)) DUP (?) 243 <1> 244 <1> MSDAT001e label byte 245 <1> 246 <1> ;.xall 247 <1> 248 <1> ; (no prior section) ; DATA ENDS 249 <1> 37 ;=== Pop trace listing source 38 ;=== Push trace listing source: msinit.nas 39 %include "msinit.nas" ; NASM included file 1 <1> ; SCCSID = @(#)msinit.asm 1.2 85/07/23 2 <1> ; TITLE MSINIT.ASM -- MS-DOS INITIALIZATION CODE 3 <1> ; AN000 version 4.0 Jan. 1988 4 <1> ; AN007 PTM 3957 - fake version for IBMCACHE.COM 5 <1> ; AN008 PTM 4070 - fake version for MS WINDOWS 6 <1> [list -] 6 ****************** <1> warning: out: ... CLONE version build switch on ... [-w+user] 11 <1> %include "entrysw.mac" 1 <2> 2 <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h 3 <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16 4 <2> 5 <2> DOSENTRYDEVICEBASE equ 10h 12 <1> %include "lstruct.mac" 1 <2> [list -] 13 <2> [list -] 13 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 14 <1> [list +] 15 <1> 16 <1> extern i20, i21, i25, i26, i27, i2F, i2D, call5, i23, i24, entry_iret, i31 17 <1> 18 <1> I_need DMAAdd,DWORD ; current dma address 19 <1> I_need DPBHead,DWORD ; long pointer to DPB chain 20 <1> I_need SFT_Addr,DWORD ; pointer to open file list 21 <1> I_need NumIO,BYTE ; number of physical drives 22 <1> I_need BuffHead,DWORD ; pointer to buffer chain 23 <1> I_need EndMem,WORD ; first unavailable address in memory 24 <1> I_need CurrentPDB,WORD ; current process ID 25 <1> I_need CreatePDB,BYTE ; TRUE => create a new PDB 26 <1> I_need Arena_Head,WORD ; paragraph address of head of arena 27 <1> I_need sfTabl,BYTE ; internal file table 28 <1> I_need SysInitVar,BYTE ; label for internal structures 29 <1> I_need NulDev,DWORD ; long pointer to device chain 30 <1> I_need BCon,DWORD ; pointer to console device 31 <1> I_need BClock,DWORD ; pointer to clock device 32 <1> I_need CallUnit,BYTE ; unit field in dd packet 33 <1> I_need CallBPB,DWORD ; returned BPB from DD 34 <1> I_need Maxsec,WORD 35 <1> I_need Dskchret,BYTE 36 <1> I_need Devcall,BYTE 37 <1> i_need Header,BYTE 38 <1> I_need JShare,DWORD 39 <1> I_need COUNTRY_CDPG,BYTE ; country info table, DOS 3.3 40 <1> I_need SysInitTable,BYTE ; sys init table for SYSINIT 41 <1> I_need FastOpenTable,BYTE ; table for FASTOPEN 42 <1> I_need FETCHI_TAG,WORD ; TAG CHECK 43 <1> I_need Special_Entries,WORD ; address of special entries ;AN007; 44 <1> I_need IFS_DOS_CALL,DWORD ; IFS IBMDOS CALL entry ;AN000; 45 <1> I_need HASHINITVAR,WORD ; hash table variables ;AN000; 46 <1> I_need Packet_Temp,WORD ; used for initial Hash table;AN000; 47 <1> I_need BUF_HASH_PTR,DWORD ; used for initial Hash table;AN000; 48 <1> I_need SWAP_ALWAYS_AREA,DWORD ; swap always area addr ;AN000; 49 <1> I_need SWAP_ALWAYS_AREA_LEN,WORD; swap always area length ;AN000; 50 <1> I_need SWAP_IN_DOS,DWORD ; swap in dos area ;AN000; 51 <1> I_need SWAP_IN_DOS_LEN,WORD ; swap in dos area length ;AN000; 52 <1> I_need SWAP_AREA_LEN,WORD ; swap area length ;AN000; 53 <1> I_need SWAP_START,BYTE ; swap start addr ;AN000; 54 <1> I_need SWAP_ALWAYS,BYTE ; swap always addr ;AN000; 55 <1> I_need Hash_Temp,WORD ; temporary Hash table ;AN000; 56 <1> 57 <1> i_need CallDevAd,DWORD 58 <1> === Switch to base=000E10h -> "DATA" 59 <1> section DATA 60 <1> ; ORG 0 ; reset to beginning of data segment 61 <1> 62 <1> %ifdef DONOBITS 63 <1> [list -] 64 <1> %endif 65 <1> 66 <1> %ifndef DONOBITS 67 <1> 68 <1> Public MSINI001S,MSINI001E 69 <1> MSINI001S label byte 70 <1> MSINI001E label byte 71 <1> 72 <1> === Switch to base=00C400h -> "SYSINITSEG" 73 <1> section SYSINITSEG PUBLIC class=INIT === Switch to base=00C400h -> "SYSINITTRAIL" 74 <1> section SYSINITTRAIL PUBLIC class=INIT 75 <1> 76 <1> group SYSINITGROUP SYSINITSEG SYSINITTRAIL 77 <1> 78 <1> extern doscode_retf 79 <1> extern dosdata_to_doscode 80 <1> 81 <1> %imacro neartransfer 1.nolist 82 <1> extern %1 83 <1> call transfer_sysinitseg_to_doscode 84 <1> jmp strict short %%skip 85 <1> dw %1 86 <1> %%skip: 87 <1> %endmacro 88 <1> 89 <1> global transfer_sysinitseg_to_doscode 90 <1> transfer_sysinitseg_to_doscode: ; near call ip: in_ip_out_cs 91 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006CD8 50 push ax ; in_ax_out_ip 0 00006CD9 B8[0000] mov ax, doscode_retf 0 00006CDC 50 push ax ; out_retf 0 00006CDD 50 push ax ; out_destination + 2 0 00006CDE 50 push ax ; out_destination + 0 97 <1> lframe 0 98 <1> lpar word, in_ip_out_cs 99 <1> lpar word, in_ax_out_ip 100 <1> lpar word, out_retf 101 <1> lpar dword, out_destination 0 00006CDF 5589E5 lenter 0 00006CE2 1E push ds 0 00006CE3 56 push si 0 00006CE4 8CCE mov si, cs ; si = cs 0 00006CE6 87760A xchg si, word [bp + ?in_ip_out_cs] 107 <1> ; set cs, get ip 0 00006CE9 56 push si ; preserve ip for later 0 00006CEA AD lodsw ; skip jmp short 0 00006CEB 2EAD cs lodsw ; get destination 0 00006CED 894602 mov word [bp + ?out_destination + 0], ax 112 <1> ; set destination 0 00006CF0 E81000 call getdosdata 0 00006CF3 8ED8 mov ds, ax 115 <1> assume ds:DOSGROUP 0 00006CF5 A1[F806] mov ax, word [dosdata_to_doscode] 117 <1> ; ax => DOSCODE 0 00006CF8 894604 mov word [bp + ?out_destination + 2], ax 119 <1> ; => DOSCODE 0 00006CFB 58 pop ax 0 00006CFC 874608 xchg ax, word [bp + ?in_ax_out_ip] 122 <1> ; ax = original ax, set out ip 0 00006CFF 5E pop si 0 00006D00 1F pop ds 125 <1> assume ds:nothing 0 00006D01 5D lleave 0 00006D02 CB retf 128 <1> 129 <1> 130 <1> global sysinit_getdosdata 131 <1> sysinit_getdosdata: 132 <1> getdosdata: 133 <1> assume ds:nothing 0 00006D03 1E push ds 0 00006D04 B80000 mov ax, 0 0 00006D07 8ED8 mov ds, ax ; ds => IVT 137 <1> assume ds:IVT 0 00006D09 A1C600 mov ax, [31h * 4 + 2] ; ds => DOSDATA 0 00006D0C 1F pop ds 140 <1> assume ds:nothing 0 00006D0D C3 retn 142 <1> 143 <1> 144 <1> MOVDPB: 145 <1> assume ds:DOSGROUP, es:DOSGROUP, ss:nothing 0 00006D0E FC CLD 147 <1> sft_addr equ SFT_Addr ; NASM port label 0 00006D0F 8C1E[0200] MOV WORD PTR [sft_addr+2], ds 149 <1> NUMIO equ NumIO ; NASM port label 0 00006D13 8A0E[0000] MOV CL,[NUMIO] ; Number of DPBs 0 00006D17 30ED XOR CH,CH 152 <1> DPBHEAD equ DPBHead ; NASM port label 0 00006D19 BEFFFF mov si, -1 0 00006D1C E30F jcxz @F 0 00006D1E C536[0000] lds SI, [DPBHEAD]; Address of first DPB 156 <1> assume ds:DPB 0 00006D22 56 push si 158 <1> SETFINDPB: 0 00006D23 C64418FF MOV byte [SI + dpb_first_access],-1 ; Never accessed before 0 00006D27 83C621 ADD SI, DPBSIZ ; Point to next DPB 0 00006D2A E2F7 LOOP SETFINDPB 0 00006D2C 5E pop si 163 <1> @@: 0 00006D2D 268936[0000] mov [es:DPBHEAD], si ; Address of first DPB 165 <1> 166 <1> DOSGroup equ DOSGROUP ; NASM port equate 167 <1> sftabl equ sfTabl ; NASM port label 168 <1> 0 00006D32 C3 retn 170 <1> 171 <1> === Switch to base=000E10h -> "DATA" 172 <1> section DATA 173 <1> 174 <1> %macro replayrecorded 2-*.nolist 175 <1> %rep (%0 - 2) / 2 176 <1> %rotate 2 177 <1> %assign %%offset %1 178 <1> %assign %%value %2 179 <1> %if ($ - MSINI001S) < %%offset 180 <1> org %%offset 181 <1> %endif 182 <1> %if ($ - MSINI001S) == %%offset 183 <1> db %%value 184 <1> %endif 185 <1> %endrep 186 <1> %endmacro 187 <1> 0 000003B6 009000 replayrecorded RECORDED 188 00000000 FFFF00- <1> 188 00000000 FFFF00- <1> 188 00000000 FFFFFFFF00- <1> 188 00000000 FF <1> 189 <1> 0 00000AC3 00 org (MSDAT001e - MSDAT001S) 191 <1> %else ; DONOBITS 192 <1> org (MSDAT001e - MSDAT001S), db ? 193 <1> %endif ; DONOBITS 194 <1> 195 <1> [list +] 196 <1> 197 <1> ; (no prior section) ; DATA ENDS 198 <1> 199 <1> ; the next segment defines a new class that MUST appear last in the link map. 200 <1> ; This defines several important locations for the initialization process that 201 <1> ; must be the first available locations of free memory. 202 <1> === Switch to base=000E10h -> "LAST" 203 <1> section LAST 204 <1> 205 <1> %ifdef DONOBITS 206 <1> [list -] 207 <1> %endif 208 <1> 209 <1> %ifndef DONOBITS 210 <1> 211 <1> entry DOSINIT 212 <1> assume ds:nothing, es:nothing, ss:nothing 213 <1> %ifndef DOPLACEHOLDER 0 00001580 EA[A003][0000] jmp DOSENTRY - DOSENTRYADJUSTSEGMENT:i31 + DOSENTRYADJUSTOFFSET 215 <1> %else 216 <1> jmp 0:0 217 <1> %endif 218 <1> 0 00001585 90 align 2, nop 220 <1> 221 <1> PUBLIC SYSBUF 222 <1> PUBLIC MEMSTRT 223 <1> 224 <1> SYSBUF LABEL WORD 225 <1> === Switch to base=00C400h -> "SYSINITTRAIL" 226 <1> section SYSINITTRAIL 227 <1> 228 <1> %ifndef DOPLACEHOLDER 229 <1> 230 <1> ; INP: dx => DOSDATA segment source (0 if initial) 231 <1> ; ax => DOSDATA segment destination 232 <1> ; cs:si -> table, 0FFFFh terminated 233 <1> ; ds:di -> base for table entries 234 <1> init_table_plus_di: 235 <1> assume ds:nothing 236 <1> .loop: 0 00006D33 93 xchg bx, ax 0 00006D34 2EAD cs lodsw 0 00006D36 83F8FF cmp ax, -1 0 00006D39 93 xchg bx, ax 0 00006D3A 7408 je .ret 0 00006D3C 3911 cmp word [di + bx], dx 0 00006D3E 7502 jne .next 0 00006D40 8901 mov word [di + bx], ax 245 <1> .next: 0 00006D42 EBEF jmp .loop 247 <1> 248 <1> .ret: 0 00006D44 C3 retn 250 <1> 251 <1> 0 00006D45 00 align 2, db 0 253 <1> table_country: 0 00006D46 4F00 dw ccUcase_ptr + 2 0 00006D48 5400 dw ccFileUcase_ptr + 2 0 00006D4A 5900 dw ccFileChar_ptr + 2 0 00006D4C 5E00 dw ccCollate_ptr + 2 0 00006D4E 6300 dw ccDBCS_ptr + 2 0 00006D50 FFFF dw -1 260 <1> 261 <1> table_sysinit: 0 00006D52 0600 dw SYSI_Country_Tab + 2 0 00006D54 0200 dw SYSI_InitVars + 2 0 00006D56 FFFF dw -1 265 <1> 266 <1> %ifdef BUF2 267 <1> %else 268 <1> table_buffers: 269 <1> BUFFHEAD equ BuffHead ; NASM port label 270 <1> dw BUFFHEAD + 2 271 <1> dw BUF_HASH_PTR + 2 272 <1> dw -1 273 <1> %endif 274 <1> 275 <1> ; INP: dx => DOSDATA segment source (0 if initial) 276 <1> ; ax => DOSDATA segment destination 277 <1> ; cannot overlap 278 <1> ; data copied already 279 <1> ; OUT: es = ds = ax 280 <1> ; CHG: bx, si, di, cx 281 <1> entry DOSREINIT 0 00006D58 31DB xor bx, bx 0 00006D5A 8EDB mov ds, bx 284 <1> assume ds:IVT 0 00006D5C 8EC0 mov es, ax 286 <1> assume es:nothing 0 00006D5E 8C06C600 mov word [31h * 4 + 2], es ; RI31S => DOSDATA 0 00006D62 8ED8 mov ds, ax 289 <1> assume ds:DOSGROUP, es:DOSGROUP 290 <1> DSKCHRET equ Dskchret ; NASM port label 0 00006D64 A3[0300] MOV WORD PTR [DSKCHRET+3], ax 0 00006D67 A3[0200] MOV WORD PTR [sft_addr+2], ax 293 <1> ; Must be set to print messages 0 00006D6A A3[0200] MOV WORD PTR [SWAP_ALWAYS_AREA+2], ax 0 00006D6D A3[0200] MOV WORD PTR [SWAP_IN_DOS+2], ax 296 <1> extern dosinfo 0 00006D70 2EA3[0200] mov word [cs:dosinfo + 2], ax 298 <1> extern SYSI_Country 0 00006D74 2E3916[0200] cmp word [cs:SYSI_Country + 2], dx 0 00006D79 7504 jne @F 0 00006D7B 2EA3[0200] mov word [cs:SYSI_Country + 2], ax 302 <1> @@: 303 <1> 304 <1> ;F.C Modification start DOS 3.3 0 00006D7F BF[0000] mov di, COUNTRY_CDPG wrt DOSGROUP ; country info table address 0 00006D82 BE[6E00] mov si, table_country 0 00006D85 E8ABFF call init_table_plus_di 308 <1> 0 00006D88 BF[0000] mov di, SysInitTable wrt DOSGROUP 0 00006D8B BE[7A00] mov si, table_sysinit 0 00006D8E E8A2FF call init_table_plus_di 312 <1> 313 <1> %ifdef BUF2 314 <1> %else 315 <1> xor di, di 316 <1> mov si, table_buffers 317 <1> call init_table_plus_di 318 <1> %endif 319 <1> 0 00006D91 85D2 test dx, dx ; re-init after relocation ? 0 00006D93 7417 jz .retn ; no, just return --> 322 <1> ; Now the fun starts. Poke into sharer table to find the sharer. 323 <1> extern JShare, okcallentry 0 00006D95 CC int3 0 00006D96 06 push es 0 00006D97 52 push dx 0 00006D98 C43E[0400] les di, [JShare + 4] ; entry for MFT_enter 328 <1> assume es:nothing 0 00006D9C 8CC2 mov dx, es 0 00006D9E 81FA[0000] cmp dx, DOSENTRY 0 00006DA2 7509 jne @F 0 00006DA4 81FF[0000] cmp di, okcallentry 0 00006DA8 7503 jne @F 0 00006DAA 5A pop dx 0 00006DAB 07 pop es 336 <1> assume es:DOSGROUP 337 <1> .retn: 0 00006DAC C3 retn 339 <1> 340 <1> extern init2_disp_dxax_times_cx_width_bx_size 341 <1> extern init2_disp_msg_asciz_cs_dx 342 <1> extern init2_disp_al 343 <1> extern init2_disp_dxax_hex 344 <1> extern init2_disp_ax_hex 345 <1> extern init2_disp_al_hex 346 <1> extern init2_disp_ax_dec 347 <1> 348 <1> %include "mft.mac" 1 <2> BREAK 2 <2> 3 <2> ;** MSDOS MFT definitions 4 <2> ; 5 <2> ; The Master File Table (MFT) associates the cannonicalized pathnames, lock 6 <2> ; records and SFTs for all files open on this machine. 7 <2> ; 8 <2> ; The MFT implementation employs a single memory buffer which is used from 9 <2> ; both ends. This gives the effect (at least until they run into each 10 <2> ; other) of two independent buffers. 11 <2> ; 12 <2> ; MFT buffer 13 <2> ; ========== 14 <2> ; The MFT buffer contains MFT name records and free space. It uses a 15 <2> ; classic heap architecture: freed name records are marked free and 16 <2> ; conglomerated with any adjacent free space. When one is to create a name 17 <2> ; entry the free list is searched first-fit. The list of name and free 18 <2> ; records is always terminated by a single END record. 19 <2> ; 20 <2> ; LOCK buffer 21 <2> ; =========== 22 <2> ; The lock buffer contains fixed format records containing record locking 23 <2> ; information. Since they are fixed format the space is handled as a series 24 <2> ; of chains: one for each MFT name record and one for the free list. No 25 <2> ; garbage collection is necessary. 26 <2> ; 27 <2> ; Space allocation 28 <2> ; ================ 29 <2> ; The MFT is managed as a heap. Empty blocks are allocated on a first-fit 30 <2> ; basis. If there is no single large enough empty block the list is garbage 31 <2> ; collected. 32 <2> ; 33 <2> ; MFT name records: 34 <2> ; 35 <2> ; 8 16 8 16 32 16 n 36 <2> ; |------|-----|-----|------|------|------|---------~~~~~~---------| 37 <2> ; | FLAG | LEN | SUM | LPTR | SPTR | SERL | <.asciz string> | 38 <2> ; --------------------------------------------------~~~~~~---------- 39 <2> ; 40 <2> ; FLAG = record type flag 41 <2> ; LEN = total byte length of record. 42 <2> ; SUM = sum of bytes in asciz string. Used to speed 43 <2> ; searches 44 <2> ; LPTR= pointer to first record in lock chain segment 45 <2> ; is MFT segment 46 <2> ; SPTR= pointer to first sft in sft chain 47 <2> ; SERL= serial number 48 <2> ; = name string, zero-byte terminated. There 49 <2> ; may be garbage bytes following the 00 byte; 50 <2> ; these are counted in the LEN field. 51 <2> ; 52 <2> ; 53 <2> ; MFT free records 54 <2> ; 55 <2> ; 8 16 56 <2> ; |------|-----|----~~~~~~~~~~~~~~~~~~~~~~~~~~~---------| 57 <2> ; | FLAG | LEN | free | 58 <2> ; ------------------~~~~~~~~~~~~~~~~~~~~~~~~~~~---------- 59 <2> ; 60 <2> ; FLAG = record type flag 61 <2> ; LEN = total byte length of record. 62 <2> ; 63 <2> ; 64 <2> ; MFT END records 65 <2> ; 66 <2> ; 8 67 <2> ; |------| 68 <2> ; | FLAG | 69 <2> ; -------- 70 <2> ; 71 <2> ; FLAG = record type flag 72 <2> 73 <2> ;** MFT definitions 74 <2> ;* 75 <2> ;* NOTE: the flag and length fields are identical for all record types 76 <2> ;* (except the END type has no length) This must remain so as 77 <2> ;* some code depends upon it. 78 <2> ;* 79 <2> ;* NOTE: Many routines check for "n-1" of the N flag values and if no 80 <2> ;* match is found assume the flag value must be the remaining 81 <2> ;* possibility. If you add or remove flag values you must check 82 <2> ;* all references to mft_flag. 83 <2> 84 <2> MFT_entry STRUC 85 <2> 0 00006CD8 ?? mft_flag DB ? ; flag/len field 0 00006CD9 ???? mft_len DW ? 0 00006CDB ?? mft_sum DB ? ; string sum word 0 00006CDC ???? mft_lptr DW ? ; LCK pointer 0 00006CDE ???????? mft_sptr DD ? ; sft pointer 0 00006CE2 ???? mft_serl DW ? ; serial number 0 00006CE4 ?? mft_name DB ? ; offset to start of name 93 <2> 94 <2> MFT_entry ENDS 95 <2> 96 <2> MFLG_NAM EQU 1 ; min value for name record 97 <2> MFLG_FRE EQU 0 ; free record 98 <2> MFLG_END EQU -1 ; end record 99 <2> 100 <2> ;* Record Lock Record (RLR): 101 <2> ; 102 <2> ; 16 32 32 32 103 <2> ; |-------|--------|--------|--------| 104 <2> ; | NEXT | FBA | LBA | SPTR | 105 <2> ; | | lo hi | lo hi | | 106 <2> ; ------------|--------|-------------- 107 <2> ; 108 <2> ; CHAIN = pointer to next RLR. 0 if end 109 <2> ; FBA = offset of 1st byte of locked region 110 <2> ; LBA = offset of last byte of locked region 111 <2> ; SPTR = pointer to SFT lock was issued on 112 <2> 113 <2> RLR_entry STRUC 114 <2> 0 00006CD8 ???? rlr_next DW ? ; chain to next RLR, 0 if end 0 00006CDA ???? rlr_fba DW ? ; first byte addr (offset) of reigion 0 00006CDC ???? DW ? 0 00006CDE ???? rlr_lba DW ? ; last byte addr of region 0 00006CE0 ???? DW ? 0 00006CE2 ???????? rlr_sptr DD ? ; SFT pointer 0 00006CE6 ???? rlr_pid dw ? ; process id of issuer 0 00006CE8 ???? rlr_type dw ? ; lock type 123 <2> RLR_entry ENDS 124 <2> 125 <2> rlr_lall equ 00h ; lock all ops 126 <2> rlr_lwr equ 01h ; lock write ops 127 <2> 128 <2> ; 129 <2> ; A pictorial diagram for the linkages is as follows: 130 <2> ; 131 <2> ; +---sptr------+ 132 <2> ; V | 133 <2> ; +---+<----------|---sptr------+------------+ 134 <2> ; |SFT+----+ | | | 135 <2> ; +-+-+ | +-+-+ +--+-+ +--+-+ 136 <2> ; V +--->|MFT+-lptr->-|LOCK+-next->|LOCK+->0 137 <2> ; +---+ | +---+ +----+ +----+ 138 <2> ; |SFT+----+ ^ 139 <2> ; +-+-+ | 140 <2> ; | | 141 <2> ; +-------------+ 142 <2> ; 143 <2> ; 144 <2> 145 <2> ;** 146 <2> ; 147 <2> ; Interesting behavior should be noted: 148 <2> ; 149 <2> ; The sharer must maintain information on files in three forms: 150 <2> ; 151 <2> ; local/remote handles. These are normal handles and behave in no 152 <2> ; strange manner. They are identified by SF_mode not having the 153 <2> ; sfIsFCB flag nor by having the sf_mode = 70. No problems with 154 <2> ; locking. No problems with open. No problems with close. 155 <2> ; CloseByName will iterate closes until the mft disappears. 156 <2> ; CloseUser will iterate closes until no SFT for the particular user 157 <2> ; appears. CloseProcess will iterate closes until no SFT for the 158 <2> ; particular user/process appears. 159 <2> ; 160 <2> ; local FCBs. There are no corresponding SFT's for these as the SFTs 161 <2> ; are cached but will be valid for the particular file. There is 162 <2> ; one SFT for each open on a file by a specific process. These are 163 <2> ; identified the sfIsFCB flag in the sf_mode field. When multiple 164 <2> ; opens occur, we merely find the sf pertinent to the file and 165 <2> ; process. Close decrements the ref count. CloseByName, CloseUser, 166 <2> ; CloseProcess will iterate closes until no more SFTs exist. 167 <2> ; 168 <2> ; handles with mode 70. These represent FCB's open across the network. 169 <2> ; As such, identical sfts may have been collapsed by the $open code. 170 <2> ; This results in a reuse of the same SFT. The $Open code must 171 <2> ; correctly set the ref-count for the sft to reflect the number of 172 <2> ; collapses that have occurred. These are identified by a 70 in the 173 <2> ; SF_mode field. There can be no locking on these SFTs. Open must 174 <2> ; scan the list of SFTs for the file and increment its ref count 175 <2> ; appropriately. 349 <1> 350 <1> @@: 351 <1> dosreinit_scan_sharer: 0 00006DAD 50 push ax 353 <1> lframe 0 354 <1> lpar word, orig_es 355 <1> lpar word, orig_dx 356 <1> lpar word, orig_ax 0 00006DAE 5589E5 lenter 0 00006DB1 31D2 xor dx, dx 359 <1> lvar word, seensftcount 0 00006DB3 52 push dx 361 <1> lvar word, editsftcount 0 00006DB4 52 push dx 363 <1> lvar word, seenlockcount 0 00006DB5 52 push dx 365 <1> lvar word, editlockcount 0 00006DB6 52 push dx 367 <1> lvar word, seenmftcount 0 00006DB7 52 push dx 369 <1> lvar word, editmftcount 0 00006DB8 52 push dx 371 <1> lvar word, sftloopdetection 0 00006DB9 52 push dx 373 <1> lvar word, lockloopdetection 0 00006DBA 52 push dx 0 00006DBB BA[5302] mov dx, initmsg.share.detected.1 0 00006DBE E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006DC1 8CC0 mov ax, es 0 00006DC3 E8[0000] call init2_disp_ax_hex 0 00006DC6 BA[7502] mov dx, initmsg.share.detected.2 0 00006DC9 E8[0000] call init2_disp_msg_asciz_cs_dx 381 <1> 0 00006DCC 1E push ds 0 00006DCD 0E push cs 0 00006DCE 1F pop ds 385 <1> assume ds:SYSINITGROUP 0 00006DCF 31FF xor di, di 0 00006DD1 B90040 mov cx, 16 * 1024 388 <1> .loop_scan: ; if branching here with cx = 0, must be NZ 0 00006DD4 BE[4B02] mov si, sharer_magic_code ; access with ds 0 00006DD7 8A04 mov al, [si] 0 00006DD9 F2AE repne scasb 0 00006DDB 7403E93501 jne .none ; no luck --> 0 00006DE0 51 push cx 0 00006DE1 57 push di 0 00006DE2 4F dec di 0 00006DE3 B90800 mov cx, sharer_magic_code.size 0 00006DE6 268B4503 mov ax, [es:di + sharer_magic_code.mft_offset] 398 <1> ; This code must take care not to access the word 399 <1> ; at offset FFFFh. The counter in cx insures that 400 <1> ; di isn't too high. 0 00006DEA 894403 mov [si + sharer_magic_code.mft_offset], ax 0 00006DED F3A6 repe cmpsb 0 00006DEF 5F pop di 0 00006DF0 59 pop cx 0 00006DF1 75E1 jne .loop_scan ; not yet found --> (NZ) 0 00006DF3 1F pop ds 407 <1> assume ds:DOSGROUP 408 <1> 0 00006DF4 BA[7A02] mov dx, initmsg.share.magic.1 0 00006DF7 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006DFA 97 xchg ax, di 0 00006DFB E8[0000] call init2_disp_ax_hex 0 00006DFE 97 xchg ax, di 0 00006DFF BA[A602] mov dx, initmsg.share.magic.2 0 00006E02 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006E05 E8[0000] call init2_disp_ax_hex 0 00006E08 BA[7502] mov dx, initmsg.share.magic.3 0 00006E0B E8[0000] call init2_disp_msg_asciz_cs_dx 419 <1> 0 00006E0E 97 xchg ax, di 421 <1> .loop_mft: 422 <1> assume ds:DOSGROUP, es:nothing 423 <1> ; es:di -> next MFT entry 424 <1> ; ds => new DOSDATA segment 0 00006E0F 268A05 mov al, byte [es:di + mft_flag] 0 00006E12 3CFF cmp al, MFLG_END 0 00006E14 7503E9AC00 je .done 0 00006E19 3C00 cmp al, MFLG_FRE 0 00006E1B 7503E98D00 je .next_mft 0 00006E20 3C01 cmp al, MFLG_NAM 0 00006E22 7403E99600 jne .error 0 00006E27 FF46F6 inc word [bp + ?seenmftcount] 0 00006E2A 06 push es 0 00006E2B 57 push di 0 00006E2C 89FB mov bx, di 0 00006E2E 268B4508 mov ax, word [es:di + mft_sptr + 2] 0 00006E32 3B4604 cmp ax, word [bp + ?orig_dx] 0 00006E35 7507 jne @F 0 00006E37 FF46F4 inc word [bp + ?editmftcount] 0 00006E3A 268C5D08 mov word [es:di + mft_sptr + 2], ds 441 <1> @@: 0 00006E3E 26C47D06 les di, [es:di + mft_sptr] 443 <1> assume es:nothing 0 00006E42 85FF test di, di ; must have at least one SFT 0 00006E44 7475 jz .error_pop_pop ; if invalid --> 0 00006E46 8366F200 and word [bp + ?sftloopdetection], 0 447 <1> .loop_sft: 448 <1> ; dword [ss:sp] -> current MFT entry 449 <1> ; bx = current MFT entry offset 450 <1> ; es:di -> next SFT entry, except if di == 0 0 00006E4A 85FF test di, di 0 00006E4C 7424 jz .done_sft 0 00006E4E FF46FE inc word [bp + ?seensftcount] 0 00006E51 FF46F2 inc word [bp + ?sftloopdetection] 0 00006E54 7465 jz .error_pop_pop 0 00006E56 26395D33 cmp word [es:di + sf_MFT], bx 0 00006E5A 755F jne .error_pop_pop 0 00006E5C 268B452D mov ax, word [es:di + sf_chain + 2] 0 00006E60 3B4604 cmp ax, word [bp + ?orig_dx] 0 00006E63 7507 jne @F 0 00006E65 FF46FC inc word [bp + ?editsftcount] 0 00006E68 268C5D2D mov word [es:di + sf_chain + 2], ds 463 <1> @@: 0 00006E6C 26C47D2B les di, [es:di + sf_chain] 465 <1> assume es:nothing 0 00006E70 EBD8 jmp .loop_sft 467 <1> 468 <1> .done_sft: 0 00006E72 5F pop di 0 00006E73 07 pop es ; restore es:di -> MFT 471 <1> assume es:nothing 0 00006E74 57 push di 0 00006E75 8366F000 and word [bp + ?lockloopdetection], 0 0 00006E79 268B7D04 mov di, [es:di + mft_lptr] 475 <1> .loop_lock: 476 <1> ; word [ss:sp] -> current MFT entry 477 <1> ; es:di -> next lock record, except if di == 0 478 <1> ; es => sharer segment 0 00006E7D 85FF test di, di 0 00006E7F 742B jz .done_lock 0 00006E81 FF46FA inc word [bp + ?seenlockcount] 0 00006E84 FF46F0 inc word [bp + ?lockloopdetection] 0 00006E87 7433 jz .error_pop 0 00006E89 268B450C mov ax, word [es:di + rlr_sptr + 2] 0 00006E8D 3B4604 cmp ax, word [bp + ?orig_dx] 0 00006E90 7507 jne @F 0 00006E92 FF46F8 inc word [bp + ?editlockcount] 0 00006E95 268C5D0C mov word [es:di + rlr_sptr + 2], ds 489 <1> @@: 0 00006E99 06 push es 0 00006E9A 57 push di 0 00006E9B 26C47D0A les di, [es:di + rlr_sptr] 493 <1> assume es:nothing 0 00006E9F 26395D33 cmp word [es:di + sf_MFT], bx 0 00006EA3 5F pop di 0 00006EA4 07 pop es 497 <1> assume es:nothing 0 00006EA5 7515 jne .error_pop 0 00006EA7 268B3D mov di, [es:di + rlr_next] 0 00006EAA EBD1 jmp .loop_lock 501 <1> 502 <1> .done_lock: 0 00006EAC 5F pop di 504 <1> .next_mft: 505 <1> ; MFT loop doesn't need loop detection 506 <1> ; because we detect empty lengths or 507 <1> ; offset additions that carry here. 0 00006EAD 268B4D01 mov cx, word [es:di + mft_len] 0 00006EB1 E30A jcxz .error 0 00006EB3 01CF add di, cx 0 00006EB5 7203E955FF jnc .loop_mft 0 00006EBA A9 db __TEST_IMM16 513 <1> .error_pop_pop: 0 00006EBB 58 pop ax 515 <1> .error_pop: 0 00006EBC 58 pop ax 517 <1> .error: 0 00006EBD BA[2703] mov dx, initmsg.share.error 0 00006EC0 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006EC3 EB57 jmp .ret 521 <1> 522 <1> .done: 0 00006EC5 BA[EB02] mov dx, initmsg.share.done.1 0 00006EC8 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006ECB 8B46F4 mov ax, word [bp + ?editmftcount] 0 00006ECE E8[0000] call init2_disp_ax_dec 0 00006ED1 BA[0B03] mov dx, initmsg.share.done.2 0 00006ED4 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006ED7 8B46F6 mov ax, word [bp + ?seenmftcount] 0 00006EDA E8[0000] call init2_disp_ax_dec 0 00006EDD BA[0D03] mov dx, initmsg.share.done.3 0 00006EE0 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006EE3 8B46FC mov ax, word [bp + ?editsftcount] 0 00006EE6 E8[0000] call init2_disp_ax_dec 0 00006EE9 BA[0B03] mov dx, initmsg.share.done.4 0 00006EEC E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006EEF 8B46FE mov ax, word [bp + ?seensftcount] 0 00006EF2 E8[0000] call init2_disp_ax_dec 0 00006EF5 BA[1A03] mov dx, initmsg.share.done.5 0 00006EF8 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006EFB 8B46F8 mov ax, word [bp + ?editlockcount] 0 00006EFE E8[0000] call init2_disp_ax_dec 0 00006F01 BA[0B03] mov dx, initmsg.share.done.6 0 00006F04 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006F07 8B46FA mov ax, word [bp + ?seenlockcount] 0 00006F0A E8[0000] call init2_disp_ax_dec 0 00006F0D BA[2303] mov dx, initmsg.share.done.7 0 00006F10 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006F13 EB07 jmp .ret 550 <1> 551 <1> .none: 0 00006F15 BA[BA02] mov dx, initmsg.share.nomagic 0 00006F18 E8[0000] call init2_disp_msg_asciz_cs_dx 0 00006F1B 1F pop ds 555 <1> assume ds:DOSGROUP 556 <1> .ret: 0 00006F1C 89EC5D lleave 0 00006F1F 58 pop ax 0 00006F20 5A pop dx 0 00006F21 07 pop es 561 <1> assume es:DOSGROUP 0 00006F22 C3 retn 563 <1> 564 <1> 565 <1> sharer_magic_code: 566 <1> assume nocheck, cs:nothing, ds:nothing, es:nothing, ss:nothing 567 <1> ; need cs assumption so the following push/pop pair 568 <1> ; isn't misdetected by listvars.pl 569 <1> .: 0 00006F23 0E push cs 0 00006F24 1F pop ds 572 <1> assume nocheck, ds:nothing 0 00006F25 BE0000 mov si, 0 574 <1> .mft_offset equ ($ - 2) - . 0 00006F28 803C00 cmp byte [si + mft_flag],MFLG_FRE 576 <1> .end: 577 <1> .size equ .end - . 578 <1> assume nocheck, cs:SYSINITGROUP 579 <1> ; reset cs assumption 580 <1> 581 <1> 582 <1> initmsg: 0 00006F2B 696E69743A20536861 .share.detected.1: asciz "init: Sharer detected at segment=" 0 00006F34 726572206465746563 0 00006F3D 746564206174207365 0 00006F46 676D656E743D00 584 <1> .share.magic.3: ; asciz "h.",13,10 0 00006F4D 682E0D0A00 .share.detected.2: asciz "h.",13,10 0 00006F52 696E69743A20536861 .share.magic.1: asciz "init: Sharer magic code detected at offset " 0 00006F5B 726572206D61676963 0 00006F64 20636F646520646574 0 00006F6D 656374656420617420 0 00006F76 6F66667365742000 0 00006F7E 682C204D4654207374 .share.magic.2: asciz "h, MFT start is at " 0 00006F87 617274206973206174 0 00006F90 2000 0 00006F92 696E69743A20576172 .share.nomagic: asciz "init: Warning: Sharer magic code not detected!",13,10 0 00006F9B 6E696E673A20536861 0 00006FA4 726572206D61676963 0 00006FAD 20636F6465206E6F74 0 00006FB6 206465746563746564 0 00006FBF 210D0A00 0 00006FC3 696E69743A20456469 .share.done.1: asciz "init: Edited/total sharer MFTs " 0 00006FCC 7465642F746F74616C 0 00006FD5 20736861726572204D 0 00006FDE 4654732000 590 <1> .share.done.6: ; asciz "/" 591 <1> .share.done.4: ; asciz "/" 0 00006FE3 2F00 .share.done.2: asciz "/" 0 00006FE5 2C206E657874205346 .share.done.3: asciz ", next SFTs " 0 00006FEE 54732000 0 00006FF2 2C206C6F636B732000 .share.done.5: asciz ", locks " 0 00006FFB 2E0D0A00 .share.done.7: asciz ".",13,10 0 00006FFF 696E69743A20457272 .share.error: asciz "init: Error: Sharer tables invalid.",13,10 0 00007008 6F723A205368617265 0 00007011 72207461626C657320 0 0000701A 696E76616C69642E0D 0 00007023 0A00 597 <1> 598 <1> 599 <1> ; INP: es => DOS data segment 600 <1> ; bx => where to create PSP 601 <1> ; dx => behind usable memory (at EBDA or UMA) 602 <1> ; ss:sp -> init stack 603 <1> ; ds:si -> CON device 604 <1> ; (and subsequent device chain in msbio) 605 <1> ; cx => S MCB to link to (chain at top of LMA) 606 <1> ; di => space for free MCB (behind DOSENTRY S MCB) 607 <1> entry NEARDOSINIT 608 <1> assume ds:nothing, es:DOSGROUP, ss:SYSINITGROUP 0 00007025 FA CLI 0 00007026 FC CLD 0 00007027 26891E[0000] MOV [es:CurrentPDB], bx 0 0000702C 268916[0000] MOV [es:ENDMEM],DX 613 <1> NULDEV equ NulDev ; NASM port label 0 00007031 268C1E[0200] MOV WORD PTR [es:NULDEV+2],DS 0 00007036 268936[0000] MOV WORD PTR [es:NULDEV],SI ; DS:SI Points to CONSOLE Device 616 <1> 0 0000703B 57 push di 0 0000703C 51 push cx 0 0000703D 1E push ds 0 0000703E 56 push si 621 <1> ; Need Crit vector inited to use DEVIOCALL 0 0000703F 31C0 XOR AX,AX 0 00007041 8ED8 MOV DS,AX 624 <1> assume ds:IVT 0 00007043 8C06C600 mov word [31h * 4 + 2], es ; RI31S => DOSDATA 0 00007047 C706A800[A003] MOV word [addr_int_IBM], entry_iret + DOSENTRYADJUSTOFFSET 0 0000704D C706AA00[0000] MOV word [addr_int_IBM+2], DOSENTRY - DOSENTRYADJUSTSEGMENT 628 <1> 0 00007053 4A dec dx ; => first UMCB 0 00007054 268916[FA06] mov word [es:first_umcb], dx 0 00007059 06 push es 0 0000705A 8EC2 mov es, dx 633 <1> assume es:nothing 0 0000705C 31FF xor di, di ; -> first UMCB 0 0000705E 0E push cs 0 0000705F 1F pop ds 637 <1> assume ds:SYSINITGROUP 0 00007060 BE[8206] mov si, first_umcb_smcb ; -> template ; access with ds 0 00007063 B90800 mov cx, words(MCB_size) 0 00007066 F3A5 rep movsw ; copy the template 0 00007068 07 pop es 642 <1> assume es:DOSGROUP 0 00007069 8CC0 mov ax, es 0 0000706B 31D2 xor dx, dx 0 0000706D E8E8FC call DOSREINIT 646 <1> assume ds:DOSGROUP, es:DOSGROUP 647 <1> 0 00007070 BD[0600] MOV BP,OFFSET SYSBUF wrt DOSGROUP 0 00007073 892E[0000] MOV [Special_Entries],BP ;MS.;AN007 save starting address of Special entries 0 00007077 BE[1C00] MOV SI,OFFSET Version_Fake_Table wrt DOSGROUP ;MS.;AN007 0 0000707A 89F2 MOV DX,SI ;MS.;AN007 0 0000707C 30E4 XOR AH,AH ;MS.;AN007 653 <1> .NextEntry: ;MS.;AN007 0 0000707E AC LODSB ;MS.;AN007 get name length 0 0000707F 84C0 test AL,AL ;MS.;AN007 end of list 0 00007081 7407 JZ endlist ;MS.;AN007 yes 0 00007083 01C6 ADD SI,AX ;MS.;AN007 position to 0 00007085 83C603 ADD SI,3 ;MS.;AN007 next entry 0 00007088 EBF4 JMP .NextEntry ;MS.;AN007 660 <1> endlist: ;MS.;AN007 0 0000708A 29D6 SUB SI,DX ;MS.;AN007 0 0000708C 01F5 ADD BP,SI ;MS.;AN007 663 <1> 0 0000708E 89F1 mov cx, si 0 00007090 89D6 mov si, dx 0 00007092 BF[0600] mov di, SYSBUF wrt DOSGROUP 0 00007095 F3A4 rep movsb 668 <1> 0 00007097 83C50F ADD BP,15 ; True start of free space (round up to segment) 0 0000709A D1DD RCR BP,1 0 0000709C B103 MOV CL,3 0 0000709E D3ED SHR BP,CL ; Number of segments for DOS resources 0 000070A0 89EA MOV DX,bp ; = size of DOSDATA segment in paragraphs 0 000070A2 BB0F00 MOV BX,0FH 0 000070A5 8B0E[0000] MOV CX,[ENDMEM] 676 <1> 0 000070A9 8CC5 MOV BP, es 678 <1> 679 <1> ; BP has segment of DOS (whether to load high or run in place) 680 <1> ; DX has program segment (whether after DOS or overlaying DOS) 681 <1> ; CX has size of memory in paragraphs (reduced by DOS size if HIGHMEM) 0 000070AB 890E[0000] MOV [ENDMEM],CX 0 000070AF 8EC5 MOV ES,BP 684 <1> ASSUME ES:DOSGROUP 685 <1> 0 000070B1 5E pop si 0 000070B2 1F pop ds 688 <1> assume ds:nothing 689 <1> 0 000070B3 52 push dx 0 000070B4 55 push bp 692 <1> 0 000070B5 E8F302 CALL CHARINIT 0 000070B8 56 PUSH SI ; Save pointer to header 695 <1> ; es => DOSDATA 696 <1> ASSUME ES:DOSGROUP 0 000070B9 BF[0600] MOV DI,OFFSET sftabl + SFTable wrt DOSGROUP ; Point to sft 0 0 000070BC B80300 MOV AX,3 0 000070BF AB STOSW ; Refcount 0 000070C0 48 DEC ax 701 <1> errnz sf_mode-(sf_ref_count+2) 0 000070C1 AB STOSW ; Access rd/wr, compatibility 0 000070C2 30C0 XOR AL,AL 704 <1> errnz sf_attr-(sf_mode+2) 0 000070C4 AA STOSB ; attribute 0 000070C5 B0C3 MOV AL,devid_device_EOF | devid_device | ISCIN | ISCOUT 707 <1> errnz sf_flags-(sf_attr+1) 0 000070C7 AB STOSW ; Flags 0 000070C8 89F0 MOV AX,SI 710 <1> errnz sf_devptr-(sf_flags+2) 0 000070CA AB STOSW ; Device pointer in devptr 0 000070CB 8CD8 MOV AX,DS 0 000070CD AB STOSW 0 000070CE 31C0 XOR AX,AX 715 <1> errnz sf_firclus-(sf_devptr+4) 0 000070D0 AB STOSW ; firclus 717 <1> errnz sf_time-(sf_firclus+2) 0 000070D1 AB STOSW ; time 719 <1> errnz sf_date-(sf_time+2) 0 000070D2 AB STOSW ; date 0 000070D3 48 DEC AX 722 <1> errnz sf_size-(sf_date+2) 0 000070D4 AB STOSW ; size 0 000070D5 AB STOSW 0 000070D6 40 INC AX 726 <1> errnz sf_position-(sf_size+4) 0 000070D7 AB STOSW ; position 0 000070D8 AB STOSW 0 000070D9 83C707 ADD DI,sf_name - sf_cluspos ;Point at name 0 000070DC 83C60A ADD SI,SDEVNAME ; Point to name 0 000070DF B90400 MOV CX,4 0 000070E2 F3A5 REP MOVSW ; Name 0 000070E4 B103 MOV CL,3 0 000070E6 B020 MOV AL," " 0 000070E8 F3AA REP STOSB ; Extension 0 000070EA 5E POP SI ; Get back pointer to header 0 000070EB 804C0403 OR BYTE PTR [SI + SDEVATT],ISCIN | ISCOUT 738 <1> BCON equ BCon ; NASM port label 0 000070EF 268936[0000] MOV WORD PTR [es:BCON],SI 0 000070F4 268C1E[0200] MOV WORD PTR [es:BCON+2],DS 741 <1> 0 000070F9 5D pop bp 0 000070FA 5A pop dx 744 <1> 0 000070FB 31C0 XOR AX,AX 0 000070FD 8ED8 MOV DS,AX 0 000070FF 8EC0 MOV ES,AX 748 <1> assume ds:IVT, es:IVT 0 00007101 BF8200 MOV DI,INTBASE+2 0 00007104 89E8 MOV AX,BP ; Final DOS segment to AX 751 <1> 0 00007106 50 push ax 753 <1> 0 00007107 B8[0000] mov ax, DOSENTRY - DOSENTRYADJUSTSEGMENT 755 <1> 756 <1> extern i00 0 0000710A C7060000[A003] mov word [0], i00 + DOSENTRYADJUSTOFFSET 0 00007110 A30200 mov word [2], ax ; Set default divide trap address 759 <1> 760 <1> ; Set vectors 20-28 and 2A-3F to point to IRET. 0 00007113 B91100 MOV CX,17 0 00007116 F3AB REP STOSW ; Set 9 segments 763 <1> ; Sets segs for INTs 20H-28H 0 00007118 83C706 ADD DI,6 ; Skip INT 29H vector (FAST CON) as it may 765 <1> ; already be set. 0 0000711B B12B MOV cl, 43 0 0000711D F3AB REP STOSW ; Set 22 segments 768 <1> ; Sets segs for vectors 2AH-3FH 0 0000711F 8F06C600 pop word [31h * 4 + 2] ; RI31S => DOSDATA 770 <1> 0 00007123 BF8000 MOV DI,INTBASE 0 00007126 B8[A003] MOV AX, entry_iret + DOSENTRYADJUSTOFFSET 0 00007129 B109 MOV cl, 9 ; Set 9 offsets (skip 2 between each) 774 <1> ; Sets offsets for INTs 20H-28H 775 <1> 776 <1> ISET1: 0 0000712B AB STOSW ; offset 0 0000712C AF scasw ; di += 2 0 0000712D E2FC LOOP ISET1 780 <1> 0 0000712F AF scasw ; di += 2 0 00007130 AF scasw ; di += 2 783 <1> ; Skip vector 29H 784 <1> 0 00007131 B116 MOV cl, 22 ; Set 22 offsets (skip 2 between each) 786 <1> ; Sets offsets for INTs 2AH-3FH 787 <1> 788 <1> ISET2: 0 00007133 AB STOSW 0 00007134 AF scasw ; di += 2 0 00007135 E2FC LOOP ISET2 792 <1> 0 00007137 89E8 MOV AX,BP ; Final DOS segment to AX 794 <1> 0 00007139 C706BC00[A003] mov word [2Fh * 4], i2F + DOSENTRYADJUSTOFFSET 0 0000713F C706B400[A003] mov word [2Dh * 4], i2D + DOSENTRYADJUSTOFFSET 797 <1> 798 <1> ; Set up entry point call at vectors 30-31H 0 00007145 C606C000EA MOV BYTE PTR [ENTRYPOINT],mi_Long_JMP 0 0000714A C706C100[A003] MOV WORD PTR [ENTRYPOINT+1], call5 + DOSENTRYADJUSTOFFSET 0 00007150 C706C300[0000] MOV WORD PTR [ENTRYPOINT+3], DOSENTRY - DOSENTRYADJUSTSEGMENT 0 00007156 C606C50000 mov byte [ENTRYPOINT+5], 0 803 <1> ; this also happens to init int 31h to DOSDATA:0, 804 <1> ; which is equal to our legacy DOSINIT entrypoint. 805 <1> ; this is now re-used as i31, far-jumping to DOSENTRY 806 <1> ; and relocating to DOSCODE. currently this just sets 807 <1> ; ax = 1 and CY and returns (using an iret). 808 <1> 809 <1> %IF ALTVECT 810 <1> MOV DI,ALTBASE+2 811 <1> MOV CX,15 812 <1> REP STOSW ; Set 8 segments (skip 2 between each) 813 <1> %ENDIF 814 <1> 815 <1> ; all interrupt handler entrypoints 816 <1> ; => DOSENTRY - DOSENTRYADJUSTSEGMENT 0 0000715B C7068000[A003] MOV WORD PTR [addr_int_abort], i20 + DOSENTRYADJUSTOFFSET 0 00007161 C7068400[A003] MOV WORD PTR [addr_int_command], i21 + DOSENTRYADJUSTOFFSET 0 00007167 C70688000001 MOV WORD PTR [addr_int_terminate],100H 0 0000716D 89168A00 MOV WORD PTR [addr_int_terminate+2],DX 0 00007171 C7068C00[A003] MOV WORD PTR [23h * 4], i23 + DOSENTRYADJUSTOFFSET 0 00007177 C7069000[A003] MOV WORD PTR [24h * 4], i24 + DOSENTRYADJUSTOFFSET 0 0000717D C7069400[A003] MOV WORD PTR [addr_int_disk_read], i25 + DOSENTRYADJUSTOFFSET 0 00007183 C7069800[A003] MOV WORD PTR [addr_int_disk_write], i26 + DOSENTRYADJUSTOFFSET 0 00007189 C7069C00[A003] MOV WORD PTR [addr_int_keep_process], i27 + DOSENTRYADJUSTOFFSET 826 <1> 0 0000718F E871FB call getdosdata 0 00007192 8ED8 mov ds, ax 0 00007194 8EC0 mov es, ax 830 <1> ASSUME DS:DOSGROUP,ES:DOSGROUP 831 <1> 0 00007196 89D5 mov bp, dx ; = size for DOSDATA 833 <1> 0 00007198 BA6000 mov dx, 60h ; new first MCB (init PSP) 835 <1> arena_head equ Arena_Head ; NASM port label 0 0000719B 268916[0000] MOV [ES:arena_head], dx 837 <1> 0 000071A0 5B pop bx ; bx => S MCB to link to 0 000071A1 58 pop ax ; ax => free MCB 0 000071A2 1E push ds 0 000071A3 06 push es 0 000071A4 8EC2 mov es, dx ; => DOSENTRY MCB destination 843 <1> assume es:nothing 0 000071A6 0E push cs 0 000071A7 1F pop ds 846 <1> assume ds:SYSINITGROUP 0 000071A8 BE[9206] mov si, dosentry_mcb ; -> template ; access with ds 0 000071AB 31FF xor di, di 0 000071AD B90800 mov cx, words(16) 0 000071B0 F3A5 rep movsw 0 000071B2 F7DA neg dx 0 000071B4 01C2 add dx, ax ; dx = ax - dx 0 000071B6 4A dec dx 0 000071B7 2689160300 mov word [es:arena_size], dx 855 <1> ; set size 0 000071BC 07 pop es 857 <1> assume es:DOSGROUP 858 <1> 0 000071BD 8ED8 MOV DS,AX 860 <1> assume ds:nothing 0 000071BF C60600004D MOV byte [arena_signature], 'M' 862 <1> ; The free MCB does link to the LMA top chain of S MCBs. 863 <1> ; The last LMCB does not initially link to the first 864 <1> ; UMCB, but the free MCB is not the last LMCB. 865 <1> ENDMEM equ EndMem ; NASM port label 0 000071C4 29D8 SUB AX, bx 0 000071C6 F7D0 not ax ; like neg ax, dec ax 0 000071C8 A30300 MOV [arena_size],AX 0 000071CB 31C0 xor ax, ax ; = 0 0 000071CD A30100 mov word [arena_owner], ax 0 000071D0 A30500 mov word [mcbReserved], ax 0 000071D3 A30700 mov word [mcbReserved + 2], ax 0 000071D6 A30800 mov word [mcbName], ax 0 000071D9 A30A00 mov word [mcbName + 2], ax 0 000071DC A30C00 mov word [mcbName + 4], ax 0 000071DF A30E00 mov word [mcbName + 6], ax 0 000071E2 1F pop ds 878 <1> assume ds:DOSGROUP 879 <1> 0 000071E3 8B16[0000] mov dx, [CurrentPDB] 0 000071E7 8EC2 mov es, dx 882 <1> assume es:nothing 0 000071E9 31FF xor di, di ; -> PSP to create 0 000071EB B93000 mov cx, words(60h) ; clear PSP needed part 0 000071EE F3AB rep stosw ; clear memory 0 000071F0 A1[0000] mov ax, [ENDMEM] 887 <1> 0 000071F3 E8E2FAEB02[0000] neartransfer SETMEM ; Basic Header 889 <1> ; SETMEM works with ss != DOSDATA 0 000071FA 268C061600 mov word [ES:PDB_Parent_PID], es 891 <1> ; set parent to itself (better than uninit) 892 <1> ASSUME DS:NOTHING,ES:NOTHING 0 000071FF E801FB call getdosdata 0 00007202 8ED8 mov ds, ax 895 <1> ASSUME DS:DOSGROUP 0 00007204 BF1800 MOV DI,PDB_JFN_Table 0 00007207 31C0 XOR AX,AX 0 00007209 AB STOSW 0 0000720A AA STOSB ; 0,1 and 2 are CON device 0 0000720B B0FF MOV AL,0FFH 0 0000720D B91100 MOV CX,FilPerProc - 3 0 00007210 F3AA REP STOSB ; Rest are unused 0 00007212 1E PUSH ds 0 00007213 07 POP ES 905 <1> ASSUME ES:DOSGROUP 906 <1> 907 <1> ; After this points the char device functions for CON will work for 908 <1> ; printing messages 909 <1> 910 <1> %IF (! IBM) | (DEBUG) 911 <1> %IFN ALTVECT 912 <1> HEADER equ Header ; NASM port label 913 <1> MOV SI,OFFSET HEADER wrt DOSGROUP 914 <1> .OUTMES: 915 <1> call getdosdata 916 <1> mov ds, ax 917 <1> lodsb 918 <1> CMP AL,"$" 919 <1> JZ .OUTDONE 920 <1> invalid function call 921 <1> invoke OUT 922 <1> JMP SHORT .OUTMES 923 <1> .OUTDONE: 924 <1> PUSH ds ; OUT stomps on segments 925 <1> POP es 926 <1> %ENDIF 927 <1> %ENDIF 928 <1> 929 <1> %ifdef BUF2 930 <1> %else 931 <1> MOV SI,OFFSET HASHINITVAR wrt DOSGROUP ;LB. points to Hashinitvar ;AN000; 932 <1> MOV WORD PTR [ES:BUFFHEAD],SI ;LB. ;AN000; 933 <1> MOV SI,OFFSET Hash_Temp wrt DOSGROUP ;LB. ;AN000; 934 <1> MOV WORD PTR [ES:BUF_HASH_PTR],SI ;LB. ;AN000; 935 <1> %endif 0 00007214 26C706[0000]7258 MOV word [ES:FETCHI_TAG],22642 ; TAG for IBM, 937 <1> ; Fetchi's serial # = 822642 938 <1> 0 0000721B 89EB mov bx, bp ; = size for DOSDATA S MCB 0 0000721D B44A mov ah, 4Ah 0 0000721F CD21 int 21h ; shrink it 0 00007221 8CC0 mov ax, es 0 00007223 48 dec ax ; => D0SDATA S MCB 0 00007224 8ED8 mov ds, ax 945 <1> assume ds:MCB 0 00007226 C70601000800 mov word [mcbOwner], 8 ; reset owner 947 <1> 0 0000722C BF[0000] MOV DI,OFFSET SWAP_START wrt DOSGROUP ;IFS. ;AN000; 0 0000722F B9[0D07] MOV CX,OFFSET SWAP_END wrt DOSGROUP ;IFS. ;AN000; 950 <1> Swap_Always equ SWAP_ALWAYS ; NASM port label 0 00007232 BA[0000] MOV DX,OFFSET Swap_Always wrt DOSGroup ;IFS. ;AN000; 0 00007235 89CD MOV BP,CX ;IFS. ;AN000; 0 00007237 29FD SUB BP,DI ;IFS. ;AN000; 0 00007239 D1ED SHR BP,1 ;IFS. div by 2, remainder in carry ;AN000; 0 0000723B 83D500 ADC BP,0 ;IFS. div by 2 + round up ;AN000; 0 0000723E D1E5 SHL BP,1 ;IFS. round up to 2 boundary. ;AN000; 0 00007240 26892E[0000] MOV [ES:SWAP_AREA_LEN],BP ;IFS. ;AN000; 958 <1> 0 00007245 29D1 SUB CX,DX ;IFS. ;AN000; 0 00007247 29FA SUB DX,DI ;IFS. ;AN000; 0 00007249 D1E9 SHR CX,1 ;IFS. div by 2, remainder in carry ;AN000; 0 0000724B 83D100 ADC CX,0 ;IFS. div by 2 + round up ;AN000; 0 0000724E D1E1 SHL CX,1 ;IFS. round up to 2 boundary. ;AN000; 0 00007250 26890E[0000] MOV [ES:SWAP_IN_DOS_LEN],CX ;IFS. ;AN000; 0 00007255 26893E[0000] MOV WORD PTR [ES:SWAP_ALWAYS_AREA],DI ;IFS. ;AN000; 0 0000725A 81CA0080 OR DX,8000H ;IFS. ;AN000; 0 0000725E 268916[0000] MOV [ES:SWAP_ALWAYS_AREA_LEN],DX ;IFS. ;AN000; 0 00007263 BF[0000] MOV DI,OFFSET Swap_Always wrt DOSGroup ;IFS. ;AN000; 0 00007266 26893E[0000] MOV WORD PTR [ES:SWAP_IN_DOS],DI ;IFS. ;AN000; 970 <1> 971 <1> SySInitTable equ SysInitTable ; NASM port label 0 0000726B BF[0000] MOV DI,OFFSET SySInitTable wrt DOSGROUP 973 <1> 974 <1> %IFN Installed 975 <1> invoke NETWINIT 976 <1> ; ELSE 977 <1> ; invoke NETWINIT 978 <1> ; %OUT Random NETWINIT done at install 979 <1> %ENDIF 980 <1> 0 0000726E 268E1E[0000] mov ds, word [es:CurrentPDB] ; ds => created PSP 982 <1> assume ds:nothing 983 <1> DMAADD equ DMAAdd ; NASM port label 0 00007273 268C1E[0200] MOV WORD PTR [es:DMAADD+2], ds 0 00007278 C3 retn 986 <1> 987 <1> 988 <1> entry INITDPB 989 <1> assume ds:nothing, es:nothing, ss:SYSINITGROUP 0 00007279 E887FA call getdosdata 0 0000727C 8EC0 mov es, ax 992 <1> assume es:DOSGROUP 993 <1> 0 0000727E 26C536[0000] lds si, [es:NULDEV] 995 <1> assume ds:nothing 996 <1> CHAR_INIT_LOOP: 0 00007283 C534 LDS SI,[SI] ; AUX device 998 <1> assume ds:nothing 0 00007285 E82301 CALL CHARINIT 0 00007288 F6440408 TEST BYTE PTR [SI + SDEVATT],ISCLOCK 0 0000728C 74F5 JZ CHAR_INIT_LOOP 1002 <1> BCLOCK equ BClock ; NASM port label 0 0000728E 268936[0000] MOV WORD PTR [es:BCLOCK],SI 0 00007293 268C1E[0200] MOV WORD PTR [es:BCLOCK+2],DS 1005 <1> 0 00007298 B448 mov ah, 48h 0 0000729A BB0500 mov bx, paras(DPBSIZ * 2) 0 0000729D CD21 int 21h 0 0000729F 7303 jnc @F 1010 <1> mem_err_j: 1011 <1> extern MEM_ERR 0 000072A1 E9[0000] jmp MEM_ERR 1013 <1> @@: 1014 <1> lframe 0 000072A4 5589E5 lenter 1016 <1> lvar word, dosdataseg 0 000072A7 06 push es ; => DOS data segment 1018 <1> lvar dword, nextdpb 0 000072A8 50 push ax ; => DPB allocation 0 000072A9 31C0 xor ax, ax 0 000072AB 50 push ax ; -> next DPB 1022 <1> PERDRIVER: 0 000072AC 8E46FE mov es, word [bp + ?dosdataseg] 1024 <1> assume es:DOSGROUP 0 000072AF C534 LDS SI,[SI] ; Next device 1026 <1> assume ds:nothing 0 000072B1 83FEFF CMP SI,-1 0 000072B4 7503E9CC00 JZ CONTINIT 0 000072B9 E8EF00 CALL CHARINIT 0 000072BC F744040080 TEST word [SI + SDEVATT],DEVTYP 0 000072C1 75E9 JNZ PERDRIVER ; Skip any other character devs 1032 <1> CALLUNIT equ CallUnit ; NASM port label 0 000072C3 31C9 xor cx, cx 0 000072C5 268A0E[0000] MOV CL,[es:CALLUNIT] 0 000072CA 884C0A MOV [SI + SDEVNAME],CL ; Number of units in name field 0 000072CD E3DD jcxz PERDRIVER 0 000072CF 1E PUSH DS 0 000072D0 56 PUSH SI 0 000072D1 268A16[0000] MOV DL,[es:NUMIO] 0 000072D6 30F6 XOR DH,DH 0 000072D8 26000E[0000] ADD [es:NUMIO],CL 1042 <1> CALLBPB equ CallBPB ; NASM port label 0 000072DD 26C51E[0000] LDS BX,[es:CALLBPB] 1044 <1> assume ds:nothing 1045 <1> PERUNIT: 0 000072E2 8B37 MOV SI,[BX] ; DS:SI Points to BPB 0 000072E4 43 INC BX 0 000072E5 43 INC BX ; On to next BPB 1049 <1> 0 000072E6 55 push bp 0 000072E7 C46EFA les bp, [bp + ?nextdpb] 1052 <1> assume es:nothing 1053 <1> 0 000072EA 85ED test bp, bp 0 000072EC 7408 jz @F 0 000072EE 26896EF8 mov word [es:bp - DPBSIZ + dpb_next_dpb], bp 0 000072F2 268C46FA mov word [es:bp - DPBSIZ + dpb_next_dpb + 2], es 1058 <1> @@: 1059 <1> 0 000072F6 53 PUSH BX 0 000072F7 51 PUSH CX 0 000072F8 52 PUSH DX 1063 <1> 1064 <1> ; es => DPB allocation 0 000072F9 B104 mov cl, 4 0 000072FB 8D5E30 lea bx, [bp + DPBSIZ + 15] ; -> behind this DPB, round up 0 000072FE 39EB cmp bx, bp 0 00007300 729F jb mem_err_j 0 00007302 D3EB shr bx, cl ; to paragraphs 0 00007304 B44A mov ah, 4Ah 0 00007306 CD21 int 21h ; resize 0 00007308 7297 jc mem_err_j 1073 <1> 1074 <1> ; ! only write the next DPB after it is allocated 0 0000730A 5A pop dx ; = unit/drive numbers 1076 <1> %if dpb_drive + 1 != dpb_UNIT 1077 <1> %error Unexpected layout 1078 <1> %endif 0 0000730B 26895600 MOV [ES:BP + dpb_drive], dx 1080 <1> 0 0000730F B8FFFF mov ax, -1 0 00007312 26894619 mov word [es:bp + dpb_next_dpb], ax 0 00007316 2689461B mov word [es:bp + dpb_next_dpb + 2], ax 0 0000731A 52 push dx ; push unit/drive numbers again 1085 <1> 1086 <1> ; es:bp -> DPB, ds:si -> BPB 1087 <1> %if 0 1088 <1> neartransfer D_SETDPB 1089 <1> ; D_SETDPB works with ss != DOSDATA 1090 <1> %else 0 0000731B B453 mov ah, 53h 0 0000731D CD21 int 21h 1093 <1> %endif 0 0000731F 268B4602 MOV AX,[ES:BP + dpb_sector_size] 0 00007323 5A POP DX 0 00007324 59 POP CX 0 00007325 5B POP BX 1098 <1> 0 00007326 5D pop bp 0 00007327 8E46FE mov es, word [bp + ?dosdataseg] 1101 <1> assume es:DOSGROUP 1102 <1> 1103 <1> MAXSEC equ Maxsec ; NASM port label 0 0000732A 263B06[0000] CMP AX,[es:MAXSEC] 0 0000732F 7604 JBE .NOTMAX 0 00007331 26A3[0000] MOV [es:MAXSEC],AX 1107 <1> .NOTMAX: 1108 <1> 1109 <1> 0 00007335 8CD8 MOV AX,DS ; Save DS 0 00007337 5E POP SI 0 00007338 1F POP DS 1113 <1> assume ds:nothing 1114 <1> 0 00007339 55 push bp 0 0000733A C46EFA les bp, [bp + ?nextdpb] 1117 <1> assume es:nothing 1118 <1> 0 0000733D 26897613 MOV WORD PTR [ES:BP + dpb_driver_addr],SI 0 00007341 268C5E15 MOV WORD PTR [ES:BP + dpb_driver_addr+2],DS 1121 <1> 0 00007345 5D pop bp 1123 <1> 0 00007346 1E PUSH DS 0 00007347 56 PUSH SI 0 00007348 FEC6 INC DH 0 0000734A FEC2 INC DL 0 0000734C 8ED8 MOV DS,AX 1129 <1> assume ds:nothing 0 0000734E 8346FA21 ADD word [bp + ?nextdpb],DPBSIZ 0 00007352 E28E LOOP PERUNIT 0 00007354 5E POP SI 0 00007355 1F POP DS 1134 <1> assume ds:nothing 0 00007356 E953FF JMP PERDRIVER 1136 <1> 0 00007359 90 align 2 1138 <1> first_umcb_smcb: 1139 <1> istruc MCB 0 0000735A 5A at mcbSignature, db 'Z' 0 0000735B 0800 at mcbOwner, dw 8 0 0000735D 0000 at mcbSize, dw 0 0 0000735F 005300 at smcbName, db "S", 0 0 00007364 30 at smcbType, db S_EXCLDUMA 0 00007365 00 iend 1146 <1> 1147 <1> dosentry_mcb: 1148 <1> istruc MCB 0 0000736A 4D at mcbSignature, db 'M' 0 0000736B 0800 at mcbOwner, dw 8 0 0000736D 0000 at mcbSize, dw 0 0 0000736F 005300 at smcbName, db "S", 0 0 00007374 01 at smcbType, db S_DOSENTRY 0 00007375 00 iend 1155 <1> 1156 <1> dpb_smcb: 0 0000737A 000000 db 0,0,0 0 0000737D 5300 db "S",0 ; name "S" 0 0000737F 08 db 8 ; type S_DPB 0 00007380 00 times 5 db 0 1161 <1> 1162 <1> CONTINIT: ; es => DOSDATA 1163 <1> assume ds:nothing, es:DOSGROUP 0 00007385 58 pop ax ; offset last DPB 0 00007386 58 pop ax ; => DPB allocation 0 00007387 26A3[0200] mov word [es:DPBHEAD + 2], ax 0 0000738B 48 dec ax 0 0000738C 8EC0 mov es, ax 1169 <1> assume es:MCB 0 0000738E 26C70601000800 mov word [es:arena_owner], 8 1171 <1> ; init owner 0 00007395 BF0500 mov di, arena_reserved 0 00007398 0E push cs 0 00007399 1F pop ds 1175 <1> assume ds:SYSINITGROUP 0 0000739A BE[A206] mov si, dpb_smcb ; access with ds 0 0000739D B90B00 mov cx, 3 + 8 0 000073A0 F3A4 rep movsb ; init name and type 1179 <1> 0 000073A2 1F pop ds ; => DOS data 1181 <1> assume ds:DOSGROUP 0 000073A3 1E PUSH ds 0 000073A4 07 POP es 1184 <1> assume es:DOSGROUP 1185 <1> 0 000073A5 89EC5D lleave 1187 <1> 0 000073A8 E963F9 JMP MOVDPB 1189 <1> 1190 <1> CHARINIT: 1191 <1> ASSUME DS:NOTHING,ES:NOTHING 1192 <1> ; DS:SI Points to device header 1193 <1> DEVCALL equ Devcall ; NASM port label 0 000073AB 06 PUSH ES 0 000073AC 53 PUSH BX 0 000073AD 50 PUSH AX 0 000073AE E852F9 call getdosdata 0 000073B1 8EC0 mov es, ax ; => DOSDATA 1199 <1> assume es:DOSGROUP 0 000073B3 58 pop ax 0 000073B4 50 push ax 0 000073B5 BB[0000] MOV BX,OFFSET DEVCALL wrt DOSGROUP 0 000073B8 26C6071A MOV byte [es:bx + REQLEN],DINITHL 0 000073BC 26C6470100 MOV byte [es:bx + REQUNIT],0 0 000073C1 26C6470200 MOV byte [es:bx + REQFUNC],DEVINIT 0 000073C6 2683670300 and word [es:bx + REQSTAT],0 1207 <1> %if 0 1208 <1> neartransfer DEVIOCALL2 1209 <1> %else 1210 <1> ; device critical section is not yet enabled 0 000073CB 8B4406 MOV AX, [SI + SDEVSTRAT] 1212 <1> CALLDEVAD equ CallDevAd ; NASM port label 0 000073CE 26A3[0000] MOV WORD PTR [es:CALLDEVAD],AX 0 000073D2 268C1E[0200] MOV WORD PTR [es:CALLDEVAD+2],DS 0 000073D7 26FF1E[0000] CALL far [es:CALLDEVAD] 0 000073DC 8B4408 MOV AX,[SI + SDEVINT] 0 000073DF 26A3[0000] MOV WORD PTR [es:CALLDEVAD],AX 0 000073E3 26FF1E[0000] CALL far [es:CALLDEVAD] 1219 <1> %endif 0 000073E8 58 POP AX 0 000073E9 5B POP BX 0 000073EA 07 POP ES 1223 <1> assume es:nothing 0 000073EB C3 RET 1225 <1> 1226 <1> %endif ; DOPLACEHOLDER 1227 <1> 1228 <1> === Switch to base=000E10h -> "LAST" 1229 <1> section LAST 1230 <1> 1231 <1> Public MSINI002S,MSINI002E 1232 <1> MSINI002S label byte 1233 <1> 1234 <1> align 2, db ? 0 00001586 ???? DW ? 0 00001588 414444205350454349 DB "ADD SPECIAL ENTRIES",0 ;AN007 tiltle 0 00001591 414C20454E54524945 0 0000159A 5300 1237 <1> ;The following entries don't expect version 4.0 1238 <1> ;The entry format: name_length, name, expected version, fake count 1239 <1> ;fake_count: ff means the version will be reset when Abort or Exec is encountered 1240 <1> ; n means the version will be reset after n DOS version calls are issued 1241 <1> ; 1242 <1> Version_Fake_Table: ;AN007 starting address for special 0 0000159C 0C49424D4341434845 DB 12,"IBMCACHE.COM",3,40,255 ;AN007 ibmcache 1 0 000015A5 2E434F4D0328FF 0 000015AC 0C49424D4341434845 DB 12,"IBMCACHE.SYS",3,40,255 ;AN007 ibmcache 2 0 000015B5 2E5359530328FF 0 000015BC 0C44584D41304D4F44 DB 12,"DXMA0MOD.SYS",3,40,255 ;AN007 lan support 3 0 000015C5 2E5359530328FF 0 000015CC 0A57494E3230302E42 DB 10,"WIN200.BIN" ,3,40,4 ;AN008 windows 4 0 000015D5 494E032804 0 000015DA 0950534350472E434F DB 9,"PSCPG.COM" ,3,40,255 ;AN008 vittoria 5 0 000015E3 4D0328FF 0 000015E7 0B44434A535330322E DB 11,"DCJSS02.EXE" ,3,40,255 ;AN008 netview 6 0 000015F0 4558450328FF 0 000015F6 084953414D2E455845 DB 8,"ISAM.EXE" ,3,40,255 ;AN008 basic 7 0 000015FF 0328FF 0 00001602 094953414D322E4558 DB 9,"ISAM2.EXE" ,3,40,255 ;AN008 basic 8 0 0000160B 450328FF 0 0000160F 0C44464941304D4F44 DB 12,"DFIA0MOD.SYS",3,40,255 ;AN008 lan support 9 0 00001618 2E5359530328FF 0 0000161F 000000000000000000 DB 20 dup(0) ;AN007 0 00001628 000000000000000000 0 00001631 0000 1253 <1> 0 00001633 00 align 16, db 0 1255 <1> 1256 <1> MEMSTRT LABEL WORD 1257 <1> MSINI002E label byte 1258 <1> ADJFAC EQU MEMSTRT-SYSBUF 1259 <1> 1260 <1> %endif ; DONOBITS 1261 <1> 1262 <1> [list +] 1263 <1> 1264 <1> ; (no prior section) ; LAST ENDS 40 ;=== Pop trace listing source 41 END === Trace listing source: ../INC/mstable.lst 1 ; SCCSID = @(#)ibmtable.asm 1.1 85/04/10 2 ; 3 ; Table Segment for DOS 4 ; 5 6 [list -] 6 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 13 14 ;TITLE IBMTABLE - Table segment for DOS 15 ;NAME IBMTABLE 16 17 ;=== Push trace listing source: ms_table.nas 18 %include "ms_table.nas" ; NASM included file 1 <1> ; SCCSID = @(#)mstable.asm 1.3 85/07/25 2 <1> ; Revision history: 3 <1> ; A000 version 4.0 Jan. 1988 4 <1> ; A001 DCR 486 - Share installation for >32mb drives 5 <1> ; A006 DCR 503 - fake version for IBMCACHE 6 <1> ; A008 PTM 4070 - fake version for MS WINDOWS 7 <1> [list -] 7 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <5> [list -] 14 <4> [list -] 3 <3> === Switch to base=000E10h -> "DOSSTART" 4 <3> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <3> ; (no prior section) ; DOSSTART ENDS 6 <3> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <3> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <3> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <3> === Switch to base=000E10h -> "CONSTANTS" 10 <3> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <3> ; (no prior section) ; CONSTANTS ENDS 12 <3> === Switch to base=000E10h -> "DATA" 13 <3> addsection DATA, align=2 PUBLIC class=DATA 14 <3> ; (no prior section) ; DATA ENDS 15 <3> === Switch to base=000E10h -> "TABLE" 16 <3> addsection TABLE, align=2 PUBLIC class=TABLE 17 <3> ; (no prior section) ; TABLE ENDS 18 <3> === Switch to base=000E10h -> "DOSDATATABLE" 19 <3> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <3> ; (no prior section) ; DOSDATATABLE ENDS 21 <3> === Switch to base=000E10h -> "DOSDATACODE" 22 <3> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <3> ; (no prior section) ; DOSDATACODE ENDS 24 <3> === Switch to base=000E10h -> "DOSBIODATA" 25 <3> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <3> === Switch to base=000E10h -> "LAST" 27 <3> addsection LAST, align=16 PUBLIC class=LAST 28 <3> ; (no prior section) ; LAST ENDS 29 <3> 30 <3> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <3> 32 <3> %include "entryseg.nas" 1 <4> 2 <4> %ifndef ENTRYSEGNAS 3 <4> %define ENTRYSEGNAS 1 4 <4> 5 <4> %include "lmacros3.mac" 1 <5> [list -] 6 <4> === Switch to base=000000h -> "DOSENTRY" 7 <4> addsection DOSENTRY, class=%[DOSENTRY] 8 <4> 9 <4> group DOSENTRYGROUP DOSENTRY 10 <4> 11 <4> %endif 8 <2> 9 <2> %include "dcodeseg.nas" 1 <3> 2 <3> %ifndef DCODESEGNAS 3 <3> %assign DCODESEGNAS 1 4 <3> === Switch to base=002450h -> "DOSCODETABLE" 5 <3> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <3> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <3> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <3> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <3> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <3> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <3> 12 <3> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <3> 14 <3> %endif 10 <2> === Switch to base=000E10h -> "LAST" 11 <2> section LAST 12 <2> ; (no prior section) ; LAST ENDS 10 <1> %include "ea.mac" ;AN000;; for Extended Attributes 1 <2> 2 <2> ;Get/Set Extended Attrbute Equates 3 <2> 4 <2> ;The following equates are for EA types 5 <2> 6 <2> EAISUNDEF equ 00H ; undefined 7 <2> EAISLOGICAL equ 01H ; logical (0 or 1), 1 byte 8 <2> EAISBINARY equ 02H ; binary integer 1, 2, or 4 bytes 9 <2> EAISASCII equ 03H ; ASCII , 0 to 128 bytes 10 <2> EAISDATE equ 04H ; DOS file date format, 2 bytes 11 <2> EAISTIME equ 05H ; DOS file time format, 2 bytes 12 <2> 13 <2> ;The following equates are for EA flags 14 <2> 15 <2> EASYSTEM equ 8000H ; system defined, bultin 16 <2> EAREADONLY equ 4000H ; read-only , cannot be changed 17 <2> EAHIDDEN equ 2000H ; hidden from ATTRIB 18 <2> EACREATEONLY equ 1000H ; settable only at create time 19 <2> 20 <2> ;The following equates are for EA failure reason code (set by DOS) 21 <2> 22 <2> EARCSUCCESS equ 00H ; success 23 <2> EARCNOTFOUND equ 01H ; name not found 24 <2> EARCNOSPACE equ 02H ; no space to hold name or value 25 <2> EARCNOTNOW equ 03H ; name can't be set on this function 26 <2> EARCNOTEVER equ 04H ; name can't be set 27 <2> EARCUNDEF equ 05H ; name known to IFS but not supported 28 <2> EARCDEFBAD equ 06H ; EA definition bad (type,length, etc) 29 <2> EARCACCESS equ 07H ; EA access denied 30 <2> EARCBADVAL equ 08H ; bad value 31 <2> EARCDEVERROR equ 09H ; device error 32 <2> EARCUNKNOWN equ 0FFFFH ; unknown cause 33 <2> 34 <2> 35 <2> ;The following equates are for EA file type 36 <2> 37 <2> EAEXISTING equ 00H ; existing file 38 <2> EARTL equ 02H ; right to left 39 <2> EAEXECUTABLE equ 03H ; executable program 40 <2> EAINSTALLABLE equ 04H ; installable executable program 41 <2> EAOVERLAY equ 05H ; program overlay 42 <2> EADEV_DRIVER equ 06H ; device driver 43 <2> EAIFS_DRIVER equ 07H ; ifs deriver 44 <2> 45 <2> 46 <2> 47 <2> 48 <2> By_Create equ 0000010B ; set by Extended Open (create) 49 <2> BY_XA equ 0000100B ; set by Get/Set XA by Handle 50 <2> 51 <2> ;Extended Attribute Structure 52 <2> 53 <2> EA STRUC ; extended attribute list 0 00001640 ?? EA_TYPE DB ? ; type 0 00001641 ???? EA_FLAGS DW ? ; flags 0 00001643 ?? EA_RC DB ? ; reason code 0 00001644 ?? EA_NAMELEN DB ? ; name length 0 00001645 ???? EA_VALLEN DW ? ; value length 0 00001647 ?? EA_NAME DB ? ; name 60 <2> EA ENDS 61 <2> 62 <2> 63 <2> ;Query Extended Attribute list 64 <2> 65 <2> QEA STRUC ; extended attribute list 0 00001640 ?? QEA_TYPE DB ? ; type 0 00001641 ???? QEA_FLAGS DW ? ; flags 0 00001643 ?? QEA_NAMELEN DB ? ; name length 0 00001644 ?? QEA_NAME DB ? ; name 70 <2> QEA ENDS 71 <2> 11 <1> %include "fastopen.mac" ;AN000;; for Extended Attributes 1 <2> ; 2 <2> ; EXPORT DATE: 9/11 3 <2> ;Equates for FASTOPEN. 4 <2> 5 <2> ;FASTOPEN NAME CACHING Subfunctions 6 <2> FONC_Look_up equ 1 7 <2> FONC_insert equ 2 8 <2> FONC_delete equ 3 9 <2> FONC_update equ 4 10 <2> FONC_purge equ 5 ;reserved for the future use. 11 <2> 12 <2> ;FASTOPEN EXTENT CACHING Subfunctions 13 <2> FSK_Open equ 11 ;AN000; 14 <2> FSK_Close equ 12 ;AN000; 15 <2> FSK_Delete equ 13 ;AN000; 16 <2> FSK_Lookup equ 14 ;AN000; 17 <2> FSK_Insert equ 15 ;AN000; 18 <2> FSK_Trunc equ 16 ;AN000; 19 <2> 20 <2> HeaderSize equ 8 ; size of file header (8 bytes) ;AN000; 21 <2> ExtendSize equ 8 ; size of extend (8 bytes) ;AN000; 22 <2> Num_Of_Pages equ 1 ; number of pages ;AN000; 23 <2> Num_Of_Segs equ 2 ; number of frame segments ;AN000; 24 <2> Stayresident equ 04ch ; terminate and stay resident function code 25 <2> 26 <2> 27 <2> ;Equates used in DOS. 28 <2> FastOpen_Set equ 00000001B 29 <2> FastOpen_Reset equ 11111110B 30 <2> Lookup_Success equ 00000010B 31 <2> Lookup_Reset equ 11111101B 32 <2> Special_Fill_Set equ 00000100B 33 <2> Special_Fill_Reset equ 11111011B 34 <2> No_Lookup equ 00001000B 35 <2> Set_For_Search equ 00010000B ;DCR 167 36 <2> 37 <2> 38 <2> ;============= FastOpen Data Structures ===================== 39 <2> 40 <2> Fastopen_Entry STRUC ;Fastopen Entry pointer in DOS 0 00001640 ???? Fastopen_Entry_size dw ? ;size of the following 0 00001642 ???????? Fastopen_Name_Caching dd ? 43 <2> ;Fastopen_FatChain_Caching dd ? ;reserved for future use 44 <2> Fastopen_Entry ENDS 45 <2> ; 46 <2> 47 <2> 48 <2> CMPCT_DIR_INFO STRUC ;compact version of Dir Info. 49 00000000 <2> CDI_file_name db 11 dup (?) 0 0000164B ?? CDI_file_attr db ? 0 0000164C ???? CDI_codepage dw ? 0 0000164E ???? CDI_extcluster dw ? 0 00001650 ?? CDI_attr2 db ? 0 00001651 ???? CDI_time dw ? 0 00001653 ???? CDI_date dw ? 0 00001655 ???? CDI_cluster dw ? 0 00001657 ???????? CDI_filesize dd ? 58 <2> CMPCT_DIR_INFO ENDS 59 <2> ; 60 <2> 61 <2> ORIG_DIR_INFO STRUC 62 00000000 <2> ODI_head db 17 dup (?) 0 00001651 ?????????? ODI_skip db 5 dup (?) ;reserved for DOS. FASTOPEN does not 64 00000016 <2> ODI_tail db 10 dup (?) ; use ODI_skip part. 65 <2> ORIG_DIR_INFO ENDS 66 <2> ; 67 <2> 68 <2> ODI_head_leng equ 17 69 <2> ODI_skip_leng equ 5 70 <2> ODI_tail_leng equ 10 71 <2> ; 72 <2> 73 <2> FASTOPEN_EXTENDED_INFO STRUC 0 00001640 ?? FEI_dirpos db ? 0 00001641 ???????? FEI_dirsec dd ? 0 00001645 ???? FEI_clusnum dw ? 0 00001647 ???? FEI_lastent dw ? ; for search first 0 00001649 ???? FEI_dirstart dw ? ; for search first 79 <2> FASTOPEN_EXTENDED_INFO ENDS 80 <2> ; 81 <2> 82 <2> NAME_RECORD STRUC 0 00001640 ???? nLRU_ptr dw ? 0 00001642 ???? nMRU_ptr dw ? ;reverse of nLRU_ptr 0 00001644 ???? nChild_ptr dw ? 0 00001646 ???? nSibling_ptr dw ? 0 00001648 ???? nBackward_ptr dw ? ;points to preceding node 88 <2> Cmpct_Dir_Info_struc_size equ CMPCT_DIR_INFO_struc_size ; NASM port equate 89 0000000A <2> nCmpct_Dir_Info db Cmpct_Dir_Info_struc_size dup (?) 90 <2> Fastopen_Extended_Info_struc_size equ FASTOPEN_EXTENDED_INFO_struc_size ; NASM port equate 91 00000025 <2> nExtended_Info db Fastopen_Extended_Info_struc_size dup (?) 92 <2> NAME_RECORD ENDS 93 <2> ; 94 <2> 95 <2> DRIVE_CACHE_HEADER STRUC ;drive cache header 0 00001640 ???? DCH_LRU_ROOT dw ? ;Header of the LRU chain of this drive 0 00001642 ???? DCH_MRU_ROOT dw ? ;offset to the last entry of LRU chain 0 00001644 ???? DCH_Child_ptr dw ? ;the first child in Name cache seg. 0 00001646 ???? DCH_Sibling_ptr dw ? ;points to the next drive cache header 0 00001648 ?? DCH_Drive_letter db ? ;drive letter 0 00001649 ???? DCH_Num_Entries dw ? ;Number of entries in the Name cache. 0 0000164B ???? DCH_Name_Buff dw ? ;pointer to name cahe buffer 103 <2> DRIVE_CACHE_HEADER ENDS 104 <2> ; 105 <2> 106 <2> 107 <2> 108 <2> 109 <2> 110 <2> ;======== FAST SEEK FUNCTION DATA STRUCTURES ======================= 111 <2> 112 <2> DRIVE_HEADER STRUC ; Drive header structure ;AN000; 0 00001640 ???? Drive_Number dw ? ; drive number ;AN000; 0 00001642 ???? Extent_Count dw ? ; reserved for debugging 0 00001644 ???? MRU_Hdr_Ptr dw ? ; pointer to OPEN Queue 0 00001646 ???? Free_ptr dw ? ; pointer to FREE buffer ;AN000; 0 00001648 ???? Close_Ptr dw ? ; pointer to CLOSE Queue ;AN000; 0 0000164A ???? Buff_Size dw ? ; cache buffer size including header ;AN000; 0 0000164C ???? Free_Size dw ? ; size of Free area in bytes 0 0000164E ???? Next_Drv_Hdr_Ptr dw ? ; pointer to next drive header 121 <2> DRIVE_HEADER ENDS 122 <2> 123 <2> 124 <2> 125 <2> FILE_HEADER STRUC ; File header structure ;AN000; 0 00001640 ???? FH_Phys_Clus_Num dw ? ; starting physcial clustnum of file ;AN000; 0 00001642 ???? FH_Refer_Count dw ? ; reference count ;AN000; 0 00001644 ???? FH_Next_Extn_Ptr dw ? ; pointer to first extent of the file;AN000; 0 00001646 ???? FH_Next_Hdr_Ptr dw ? ; pointer to next file header ;AN000; 0 00001648 ???? FH_MRU_Extn_Ptr dw ? ; pointer to MRU extent 0 0000164A ???? dw ? 0 0000164C ???? dw ? 0 0000164E ???? dw ? 134 <2> FILE_HEADER ENDS ;AN000; 135 <2> 136 <2> 137 <2> 138 <2> EXTENT_HEADER STRUC ; extend header structure ;AN000; 0 00001640 ???? EH_Logic_Clus_Num dw ? ; starting logical clus num of extent;AN000; 0 00001642 ???? EH_Phys_Clus_Num dw ? ; starting physical clus numof extnt;AN000; 0 00001644 ???? EH_Count dw ? ; range of logical clusnum in the extnt 0 00001646 ???? EH_Next_Extn_Ptr dw ? ; pointer to next extent ;AN000; 0 00001648 ???? EH_Prev_Extn_Ptr dw ? ; pointer to previous extent ;AN000; 0 0000164A ???? EH_Next_LRU_Ptr dw ? ; pointer to next LRU extent 0 0000164C ???? EH_Prev_LRU_Ptr dw ? ; pointer tp previous LRU extent 0 0000164E ???? dw ? 147 <2> EXTENT_HEADER ENDS 148 <2> 149 <2> 150 <2> 12 <1> %include "dossym.mac" 1 <2> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 3 <2> ; PAGE 80,132 4 <2> TRUE EQU 0FFFFh 5 <2> FALSE EQU 0 6 <2> 7 <2> Installed equ TRUE 8 <2> %IFNDEF DEBUG 9 <2> DEBUG equ FALSE 10 <2> %ENDIF 11 <2> %IFNDEF debug 12 <2> debug equ DEBUG 13 <2> %ENDIF 14 <2> 15 <2> %if 0 16 <2> DBCS equ FALSE ; for fixmem.pl operation 17 <2> %endif 18 <2> 19 <2> ; NASM original macros 20 <2> 21 <2> %macro DBCS 1.nolist 22 <2> %defstr %%string %1 23 <2> %substr %%prefix %%string 1,2 24 <2> %substr %%suffix %%string 3,-1 25 <2> %ifnidni %%prefix, "= " 26 <2> %error Unexpected DBCS prefix 27 <2> %endif 28 <2> %deftok %%token %%suffix 29 <2> %xdefine DBCS %%token 30 <2> %endmacro 31 <2> 32 <2> %include "DBCS.SW" 1 <3> DBCS = FALSE 2 <3> 33 <2> %unmacro DBCS 1.nolist 34 <2> 35 <2> ; end of NASM original macros 36 <2> 37 <2> %include "dosmac.mac" 1 <3> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 3 <3> ; 4 <3> ; Macro file for MSDOS. 5 <3> ; 6 <3> 7 <3> %ifndef __DOSMAC_MAC__ 8 <3> %assign __DOSMAC_MAC__ 1 9 <3> 10 <3> TRUE EQU 0FFFFh 11 <3> FALSE EQU 0 12 <3> 13 <3> 14 <3> ; NASM original macros (comment for fixmem.pl) 15 <3> 16 <3> ;SUBTTL BREAK a listing into pages and give new subtitles 17 <3> ;PAGE 18 <3> %imacro BREAK 0-1+.nolist 19 <3> ;SUBTTL subtitle 20 <3> ;PAGE 21 <3> %endmacro 22 <3> ;.xcref break 23 <3> 24 <3> BREAK 25 <3> 26 <3> %if 0 27 <3> AsmVars Macro varlist 28 <3> IRP var, 29 <3> AsmVar var 30 <3> ENDM 31 <3> ENDM 32 <3> 33 <3> AsmVar Macro var 34 <3> IFNDEF var 35 <3> var = FALSE 36 <3> ENDIF 37 <3> ENDM 38 <3> %endif 39 <3> 40 <3> BREAK 41 <3> 42 <3> ; 43 <3> ; declare a variable external and allocate a size 44 <3> ; 45 <3> ;AsmVar InstalledData 46 <3> %ifndef InstalledData 47 <3> %define InstalledData 0 48 <3> %endif 49 <3> 50 <3> %imacro I_NEED 1-2.nolist 51 <3> %ifn InstalledData === Switch to base=000E10h -> "DATA" 52 <3> [section DATA] 53 <3> %IFIDNi %2, WORD 54 <3> EXTRN %1:WORD 55 <3> %ELSE 56 <3> %IFIDNi %2, DWORD 57 <3> EXTRN %1:DWORD 58 <3> %ELSE 59 <3> EXTRN %1:BYTE 60 <3> %ENDIF 61 <3> %ENDIF 62 <3> __SECT__ 63 <3> %ENDIF 64 <3> %endmacro 65 <3> ;.xcref I_need 66 <3> 67 <3> ; 68 <3> ; call a procedure that may be external. The call will be short. 69 <3> ; 70 <3> %imacro invoke 1.nolist 71 <3> ;.xcref 72 <3> EXTRN %1:NEAR 73 <3> ;.cref 74 <3> CALL %1 75 <3> %endmacro 76 <3> ;.xcref invoke 77 <3> 78 <3> ;PAGE 79 <3> ; 80 <3> ; jump to a label that may be external. The jump will be near. 81 <3> ; 82 <3> %imacro transfer 1.nolist 83 <3> ;.xcref 84 <3> EXTRN %1:NEAR 85 <3> ;.cref 86 <3> JUMP %1 87 <3> %endmacro 88 <3> ;.xcref transfer 89 <3> 90 <3> ; 91 <3> ; get a short address in a word 92 <3> ; 93 <3> %imacro short_addr 1.nolist 94 <3> %ifnidn %1, ? 95 <3> EXTRN %1:NEAR 96 <3> DW OFFSET %1 97 <3> %ELSE 98 <3> DW ? 99 <3> %ENDIF 100 <3> %endmacro 101 <3> ;.xcref short_addr 102 <3> 103 <3> ; 104 <3> ; get a long address in a dword 105 <3> ; 106 <3> %imacro long_addr 1.nolist 107 <3> EXTRN %1:NEAR 108 <3> DD %1 109 <3> %endmacro 110 <3> ;.xcref long_addr 111 <3> 112 <3> ; 113 <3> ; declare a PROC near or far but PUBLIC nonetheless 114 <3> ; 115 <3> ;.xcref ?frame 116 <3> ;.xcref ?aframe 117 <3> ;.xcref ?stackdepth 118 <3> ;.xcref ?initstack 119 <3> %assign ?frame 0 ; initial 120 <3> %assign ?aframe 0 ; initial 121 <3> %assign ?stackdepth 0 ; initial stack size 122 <3> %assign ?initstack 0 ; initial stack size 123 <3> 124 <3> %imacro procedure 1-2.nolist 125 <3> %assign ?frame 0 126 <3> %assign ?aframe 2 ;; remember the pushed BP 127 <3> %warning proc %1... 128 <3> %1 PROC %2 129 <3> PUBLIC %1 130 <3> %assign ?initstack ?stackdepth ;; beginning of procedure 131 <3> %endmacro 132 <3> ;.xcref procedure 133 <3> 134 <3> ; 135 <3> ; end a procedure and check that stack depth is preserved 136 <3> ; 137 <3> %imacro EndProc 1-2.nolist 138 <3> %ifnidni %2, NoCheck ;; check the stack size 139 <3> %if ?initstack != ?stackdepth ;; is it different? 140 <3> %warning ***** Possible stack size error in %1 ***** 141 <3> %endif 142 <3> %endif 143 <3> %1 ENDP 144 <3> %endmacro 145 <3> ;.xcref endproc 146 <3> ;PAGE 147 <3> ; 148 <3> ; define a data item to be public and of an appropriate size/type 149 <3> ; 150 <3> 151 <3> %imacro stripangles 2.nolist 152 <3> %defstr %%param %2 153 <3> %rep 16 154 <3> %substr %%opening %%param 1 155 <3> %ifidn %%opening, '<' 156 <3> %substr %%param %%param 2,-1 157 <3> %endif 158 <3> %endrep 159 <3> %rep 16 160 <3> %strlen %%length %%param 161 <3> %substr %%closing %%param %%length 162 <3> %ifidn %%closing, '>' 163 <3> %substr %%param %%param 1,-2 164 <3> %endif 165 <3> %endrep 166 <3> %deftok %%token %%param 167 <3> %1 %%token 168 <3> %endmacro 169 <3> 170 <3> %imacro I_AM 2-*.nolist 171 <3> ;I_AM MACRO name,size,init 172 <3> %xdefine %%name %1 173 <3> ;; declare the type of the object 174 <3> %IFIDNi %2, WORD 175 <3> %1 LABEL WORD 176 <3> %assign I_AM_SIZE 1 177 <3> %assign I_AM_LEN 2 178 <3> %ELSE 179 <3> %IFIDNi %2, DWORD 180 <3> %1 LABEL DWORD 181 <3> %assign I_AM_SIZE 2 182 <3> %assign I_AM_LEN 2 183 <3> %ELSE 184 <3> %IFIDNi %2, BYTE 185 <3> %1 LABEL BYTE 186 <3> %assign I_AM_SIZE 1 187 <3> %assign I_AM_LEN 1 188 <3> %ELSE 189 <3> %1 LABEL BYTE 190 <3> %undef I_AM_SIZE 191 <3> stripangles %assign I_AM_SIZE, %2 192 <3> %assign I_AM_LEN 1 193 <3> %ENDIF 194 <3> %ENDIF 195 <3> %ENDIF 196 <3> ;; declare the object public 197 <3> PUBLIC %%name 198 <3> ;; if no initialize then allocate blank storage 199 <3> %IF %0 == 2 200 <3> DB I_AM_SIZE*I_AM_LEN DUP (?) 201 <3> %ELSE 202 <3> %ifn InstalledData 203 <3> %rotate 2 204 <3> %rep %0 - 2 205 <3> %IF I_AM_LEN == 1 206 <3> stripangles db, %1 207 <3> %ELSE 208 <3> stripangles dw, %1 209 <3> %ENDIF 210 <3> %assign I_AM_SIZE I_AM_SIZE - 1 211 <3> %rotate 1 212 <3> %endrep 213 <3> %IF I_AM_SIZE != 0 214 <3> %error ***** initialization of %%name not complete ***** 215 <3> %ENDIF 216 <3> %ELSE 217 <3> DB I_AM_SIZE*I_AM_LEN DUP (?) 218 <3> %ENDIF 219 <3> %ENDIF 220 <3> %endmacro 221 <3> 222 <3> %imacro I_AM_NOBITS 2-*.nolist 223 <3> ;I_AM MACRO name,size,init 224 <3> %xdefine %%name %1 225 <3> ;; declare the type of the object 226 <3> %IFIDNi %2, WORD 227 <3> %1 LABEL WORD 228 <3> %assign I_AM_SIZE 1 229 <3> %assign I_AM_LEN 2 230 <3> %ELSE 231 <3> %IFIDNi %2, DWORD 232 <3> %1 LABEL DWORD 233 <3> %assign I_AM_SIZE 2 234 <3> %assign I_AM_LEN 2 235 <3> %ELSE 236 <3> %IFIDNi %2, BYTE 237 <3> %1 LABEL BYTE 238 <3> %assign I_AM_SIZE 1 239 <3> %assign I_AM_LEN 1 240 <3> %ELSE 241 <3> %1 LABEL BYTE 242 <3> %undef I_AM_SIZE 243 <3> stripangles %assign I_AM_SIZE, %2 244 <3> %assign I_AM_LEN 1 245 <3> %ENDIF 246 <3> %ENDIF 247 <3> %ENDIF 248 <3> ;; declare the object public 249 <3> PUBLIC %%name 250 <3> ;; if no initialize then allocate blank storage 251 <3> %IF %0 == 2 252 <3> resb I_AM_SIZE*I_AM_LEN 253 <3> %ELSE 254 <3> %ifn InstalledData 255 <3> %rotate 2 256 <3> %rep %0 - 2 257 <3> %IF I_AM_LEN == 1 258 <3> resb 1 259 <3> %ELSE 260 <3> resw 1 261 <3> %ENDIF 262 <3> %assign I_AM_SIZE I_AM_SIZE - 1 263 <3> %rotate 1 264 <3> %endrep 265 <3> %IF I_AM_SIZE != 0 266 <3> %error ***** initialization of %%name not complete ***** 267 <3> %ENDIF 268 <3> %ELSE 269 <3> resb I_AM_SIZE*I_AM_LEN 270 <3> %ENDIF 271 <3> %ENDIF 272 <3> %endmacro 273 <3> 274 <3> ;.xcref I_AM 275 <3> ;.xcref I_AM_SIZE 276 <3> ;.xcref I_AM_LEN 277 <3> %assign I_AM_SIZE 0 278 <3> %assign I_AM_LEN 0 279 <3> 280 <3> ;PAGE 281 <3> 282 <3> ; 283 <3> ; define an entry in a procedure 284 <3> ; 285 <3> %imacro entry 1.nolist 286 <3> %1: 287 <3> PUBLIC %1 288 <3> %endmacro 289 <3> ;.xcref entry 290 <3> 291 <3> BREAK 292 <3> 293 <3> %imacro error 1.nolist 294 <3> ;.xcref 295 <3> MOV AL, %1 296 <3> transfer SYS_RET_ERR 297 <3> ;.cref 298 <3> %endmacro 299 <3> ;.xcref error 300 <3> 301 <3> BREAK 302 <3> ; 303 <3> ; given a label either 2 byte jump to another label _J 304 <3> ; if it is near enough or 3 byte jump to 305 <3> ; 306 <3> 307 <3> %imacro jump 1.nolist 308 <3> ;.xcref 309 <3> 310 <3> %ifndef %1_J ;; is this the first invocation 311 <3> %%a: JMP %1 312 <3> %ELSE 313 <3> %IF (%1_J >= $) || ($-%1_J > 126) 314 <3> %%a: JMP %1 ;; is the jump too far away? 315 <3> %ELSE 316 <3> %%a: JMP %1_J ;; do the short one... 317 <3> %ENDIF 318 <3> %ENDIF 319 <3> %ixdefine %1_j %%a 320 <3> ;.cref 321 <3> %endmacro 322 <3> ;.xcref jump 323 <3> 324 <3> BREAK 325 <3> 326 <3> %imacro return 0.nolist 327 <3> %%a: 328 <3> RET 329 <3> %xdefine ret_l %%a 330 <3> %endmacro 331 <3> ;.xcref return 332 <3> 333 <3> BREAK 334 <3> 335 <3> %imacro condret 2.nolist 336 <3> %assign %%exit 0 337 <3> %ifdef ret_l ;; if ret_l is defined 338 <3> %if (($ - ret_l) <= 126) && ($ > ret_l) 339 <3> ;; if ret_l is near enough then 340 <3> %%a: j%1 ret_l ;; a: j to ret_l 341 <3> %xdefine ret_%1 %%a ;; define ret_ to be a: 342 <3> %assign %%exit 1 343 <3> %endif 344 <3> %endif 345 <3> %ifn %%exit 346 <3> %ifdef ret_%1 ;; if ret_ defined 347 <3> %if (($ - ret_%1) <= 126) && ($ > ret_%1) 348 <3> ;; if ret_ is near enough 349 <3> %%a: j%1 ret_%1 ;; a: j to ret_ 350 <3> %xdefine ret_%1 %%a ;; define ret_ to be a: 351 <3> %assign %%exit 1 352 <3> %endif 353 <3> %endif 354 <3> %endif 355 <3> %ifn %%exit 356 <3> j%2 %%a ;; j a: 357 <3> return ;; return 358 <3> %%a: ;; a: 359 <3> %xdefine ret_%1 ret_l ;; define ret_ to be ret_l 360 <3> %endif 361 <3> %endmacro 362 <3> ;.xcref condret 363 <3> 364 <3> BREAK 365 <3> 366 <3> %imacro retz 0.nolist 367 <3> condret z,nz 368 <3> %endmacro 369 <3> ;.xcref retz 370 <3> 371 <3> BREAK 372 <3> 373 <3> %imacro retnz 0.nolist 374 <3> condret nz,z 375 <3> %endmacro 376 <3> ;.xcref retnz 377 <3> 378 <3> BREAK 379 <3> 380 <3> %imacro retc 0.nolist 381 <3> condret c,nc 382 <3> %endmacro 383 <3> ;.xcref retc 384 <3> 385 <3> BREAK 386 <3> 387 <3> %imacro retnc 0.nolist 388 <3> condret nc,c 389 <3> %endmacro 390 <3> ;.xcref retnc 391 <3> 392 <3> BREAK 393 <3> 394 <3> %imacro context 1.nolist 395 <3> PUSH SS 396 <3> stripangles POP, %1 397 <3> ; ASSUME %1:DOSGROUP 398 <3> %endmacro 399 <3> ;.xcref context 400 <3> 401 <3> BREAK 402 <3> 403 <3> %imacro SaveReg 0-*.nolist ;; push those registers 404 <3> %rep %0 405 <3> %assign ?stackdepth ?stackdepth + 1 406 <3> stripangles push, %1 407 <3> %rotate 1 408 <3> %endrep 409 <3> %endmacro 410 <3> ;.xcref SaveReg 411 <3> 412 <3> BREAK 413 <3> 414 <3> %imacro RestoreReg 0-*.nolist ;; pop those registers 415 <3> %rep %0 416 <3> %assign ?stackdepth ?stackdepth - 1 417 <3> stripangles pop, %1 418 <3> %rotate 1 419 <3> %endrep 420 <3> %endmacro 421 <3> ;.xcref RestoreReg 422 <3> 423 <3> BREAK 424 <3> 425 <3> %imacro EnterCrit 1.nolist 426 <3> Invoke E%1 427 <3> %endmacro 428 <3> 429 <3> %imacro LeaveCrit 1.nolist 430 <3> Invoke L%1 431 <3> %endmacro 432 <3> 433 <3> Break 434 <3> 435 <3> ;AsmVars 436 <3> %ifndef ShareF 437 <3> %idefine ShareF 0 438 <3> %endif 439 <3> %ifndef Cargs 440 <3> %idefine Cargs 0 441 <3> %endif 442 <3> %ifndef Redirector 443 <3> %idefine Redirector 0 444 <3> %endif 445 <3> %ifndef debug 446 <3> %idefine debug 0 447 <3> %endif 448 <3> 449 <3> %if debug 450 <3> %imacro fmt 3-*.nolist 451 <3> ;fmt MACRO typ,lev,fmts,args 452 <3> ;local a,b,c 453 <3> PUSHF 454 <3> %IFNempty %1 455 <3> TEST word [BugTyp],%1 456 <3> JZ %%c 457 <3> CMP word [BugLev],%2 458 <3> JB %%c 459 <3> %ENDIF 460 <3> PUSH AX 461 <3> PUSH BP 462 <3> MOV BP,SP 463 <3> %If (! sharef) && (! redirector) === Switch to base=000E10h -> "TABLE" 464 <3> [section Table] 465 <3> %%a: db %3,0 466 <3> __SECT__ 467 <3> MOV AX,OFFSET %%a wrt DOSGROUP 468 <3> %else 469 <3> jmp short %%b 470 <3> %%a: db %3,0 471 <3> %if sharef 472 <3> %%b: mov ax,offset %%a wrt share 473 <3> %else 474 <3> %%b: mov ax,offset %%a wrt netwrk 475 <3> %endif 476 <3> %endif 477 <3> PUSH AX 478 <3> %iassign cargs 2 479 <3> %rotate 3 480 <3> %rep %0 - 3 481 <3> %ifidni ax, %1 482 <3> MOV AX,[BP+2] 483 <3> %ELSE 484 <3> MOV AX, %1 485 <3> %ENDIF 486 <3> PUSH AX 487 <3> %iassign cargs cargs + 2 488 <3> %rotate 1 489 <3> %endrep 490 <3> invoke PFMT 491 <3> ADD SP, Cargs 492 <3> POP BP 493 <3> POP AX 494 <3> %%c: 495 <3> POPF 496 <3> %endmacro 497 <3> %else 498 <3> %imacro fmt 3-*.nolist 499 <3> %endmacro 500 <3> %endif 501 <3> 502 <3> Break 503 <3> 504 <3> ;AsmVar Debug,$temp 505 <3> 506 <3> %imacro detectstripangles 4.nolist 507 <3> %defstr %%param %4 508 <3> %assign ?%2 0 509 <3> %assign ?%3 0 510 <3> %rep 16 511 <3> %substr %%opening %%param 1 512 <3> %ifidn %%opening, '<' 513 <3> %substr %%param %%param 2,-1 514 <3> %assign ?%2 ?%2 + 1 515 <3> %endif 516 <3> %endrep 517 <3> %rep 16 518 <3> %strlen %%length %%param 519 <3> %substr %%closing %%param %%length 520 <3> %ifidn %%closing, '>' 521 <3> %substr %%param %%param 1,-2 522 <3> %assign ?%3 ?%3 + 1 523 <3> %endif 524 <3> %endrep 525 <3> %deftok %%token %%param 526 <3> %define ?%1 %%token 527 <3> %endmacro 528 <3> 529 <3> 530 <3> %IF debug 531 <3> %imacro DOSAssume 3-*.nolist 532 <3> ;DOSAssume Macro reg,reglist,message 533 <3> %ifidni %1, CS 534 <3> %assign %%temp 1 535 <3> %else 536 <3> %ifidni %1, SS 537 <3> %assign %%temp 0 538 <3> %else 539 <3> %error ***** Invalid DOS register %1 in DOSAssume ***** 540 <3> %endif 541 <3> %endif 542 <3> %rotate 1 543 <3> %assign %%level 0 544 <3> %assign %%amount %0 - 1 545 <3> %rep 16 546 <3> detectstripangles %%token, %%opening, %%closing, %1 547 <3> %assign %%level %%level + ? %+ %%opening 548 <3> %assign %%level %%level - ? %+ %%closing 549 <3> %ifidni ? %+ %%token, DS 550 <3> %assign %%temp %%temp | 2 551 <3> %else 552 <3> %ifidni ? %+ %%token, ES 553 <3> %assign %%temp %%temp | 4 554 <3> %else 555 <3> %error ***** Invalid register reg in DOSAssume ***** 556 <3> %endif 557 <3> %endif 558 <3> %assign %%amount %%amount - 1 559 <3> %rotate 1 560 <3> %if %%level <= 0 561 <3> %exitrep 562 <3> %endif 563 <3> %endrep 564 <3> 565 <3> PUSH AX 566 <3> MOV AX, %%temp 567 <3> PUSH AX 568 <3> %IF SHAREF 569 <3> MOV AX,OFFSET %%a 570 <3> %ELSE 571 <3> MOV AX,OFFSET %%a wrt DOSGroup 572 <3> %ENDIF 573 <3> PUSH AX 574 <3> Invoke SegCheck 575 <3> POP AX 576 <3> %IFN SHAREF === Switch to base=000E10h -> "TABLE" 577 <3> [section Table] 578 <3> %ELSE 579 <3> JMP SHORT %%b 580 <3> %ENDIF 581 <3> %%a: 582 <3> %rep %%amount 583 <3> DB %1 584 <3> %rotate 1 585 <3> %endrep 586 <3> db 0 587 <3> %IFN SHAREF 588 <3> __SECT__ 589 <3> %ELSE 590 <3> %%b: 591 <3> %ENDIF 592 <3> ;IRP r, 593 <3> ; ASSUME r:DOSGroup 594 <3> ;ENDM 595 <3> %endmacro 596 <3> %ELSE 597 <3> %imacro DOSAssume 3-*.nolist 598 <3> ;DOSAssume Macro reg,reglist,message 599 <3> ;IRP r, 600 <3> ; ASSUME r:DOSGroup 601 <3> ;ENDM 602 <3> %endmacro 603 <3> %ENDIF 604 <3> 605 <3> BREAK 606 <3> 607 <3> %if 0 608 <3> ;IF DEBUG 609 <3> Assert MACRO kind, objs, message 610 <3> LOCAL a,b 611 <3> IFIDN , 612 <3> CMP objs,0 613 <3> JZ a 614 <3> fmt <>,<>, 615 <3> a: 616 <3> ELSE 617 <3> IFIDN , 618 <3> CMP objs,0 619 <3> JNZ a 620 <3> fmt <>,<>, 621 <3> a: 622 <3> ELSE 623 <3> PUSH AX 624 <3> IRP obj, 625 <3> PUSH obj 626 <3> ENDM 627 <3> IF SHAREF 628 <3> MOV AX,OFFSET b 629 <3> ELSE 630 <3> MOV AX,OFFSET DOSGroup:b 631 <3> ENDIF 632 <3> PUSH AX 633 <3> IFIDN , 634 <3> Invoke BUFCheck 635 <3> ENDIF 636 <3> IFIDN , 637 <3> Invoke SFTCheck 638 <3> ENDIF 639 <3> IFIDN , 640 <3> Invoke DPBCheck 641 <3> ENDIF 642 <3> POP AX 643 <3> IF SHAREF 644 <3> JMP SHORT a 645 <3> b DB Message,0 646 <3> a: 647 <3> ELSE === Switch to base=000E10h -> "TABLE" 648 <3> Table segment 649 <3> b db Message,0 === Switch to base=000E10h -> "TABLE" 650 <3> Table ends 651 <3> ENDIF 652 <3> ENDIF 653 <3> ENDIF 654 <3> ENDM 655 <3> %ELSE 656 <3> %imacro Assert 0-*.nolist 657 <3> %endmacro 658 <3> %ENDIF 659 <3> 660 <3> %ifndef Installed 661 <3> %idefine Installed 1 662 <3> %endif 663 <3> 664 <3> Break 665 <3> 666 <3> %imacro CallInstall 3-*.nolist 667 <3> ;CallInstall MACRO name,mpx,fn,save,restore 668 <3> %define %%name %1 669 <3> %assign %%mpx %2 670 <3> %assign %%fn %3 671 <3> %IF Installed 672 <3> %rotate 3 673 <3> %assign %%level 0 674 <3> %assign %%amountsaved 0 675 <3> %rep %0 - 3 676 <3> %ifnempty %1 677 <3> detectstripangles %%token, %%opening, %%closing, %1 678 <3> %assign %%level %%level + ? %+ %%opening 679 <3> %assign %%level %%level - ? %+ %%closing 680 <3> SaveReg ? %+ %%token 681 <3> %endif 682 <3> %assign %%amountsaved %%amountsaved + 1 683 <3> %rotate 1 684 <3> %if %%level <= 0 685 <3> %exitrep 686 <3> %endif 687 <3> %endrep 688 <3> MOV AX,(%%mpx << 8) + %%fn 689 <3> INT 2Fh 690 <3> %assign %%level 0 691 <3> %assign %%amountrestored 0 692 <3> %rep %0 - 3 - %%amountsaved 693 <3> %ifnempty %1 694 <3> detectstripangles %%token, %%opening, %%closing, %1 695 <3> %assign %%level %%level + ? %+ %%opening 696 <3> %assign %%level %%level - ? %+ %%closing 697 <3> RestoreReg ? %+ %%token 698 <3> %endif 699 <3> %assign %%amountrestored %%amountrestored + 1 700 <3> %rotate 1 701 <3> %if %%level <= 0 702 <3> %exitrep 703 <3> %endif 704 <3> %endrep 705 <3> %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored 706 <3> %error Wrong amount saved or restored 707 <3> %endif 708 <3> %ELSE 709 <3> Invoke %%name 710 <3> %ENDIF 711 <3> %endmacro 712 <3> 713 <3> Break 714 <3> 715 <3> %imacro localvar 2.nolist 716 <3> %ifidni %2, BYTE 717 <3> %assign ?frame ?frame + 1 718 <3> %assign %%a ?frame 719 <3> labelsize %1, byte, bp - %%a 720 <3> %else 721 <3> %ifidni %2, WORD 722 <3> %assign ?frame ?frame + 2 723 <3> %assign %%a ?frame 724 <3> labelsize %1, word, bp - %%a 725 <3> %else 726 <3> %ifidni %2, DWORD 727 <3> %assign ?frame ?frame + 4 728 <3> %assign %%a ?frame 729 <3> labelsize %1 %+ l, word, bp - %%a 730 <3> labelsize %1 %+ h, word, bp - %%a + 2 731 <3> labelsize %1, dword, bp - %%a 732 <3> %else 733 <3> %assign ?frame ?frame + %2 734 <3> %assign %%a ?frame 735 <3> labelsize %1, byte, bp - %%a 736 <3> %endif 737 <3> %endif 738 <3> %endif 739 <3> %endmacro 740 <3> 741 <3> %imacro enter 0.nolist 742 <3> push bp 743 <3> mov bp,sp 744 <3> sub sp,?frame 745 <3> %endmacro 746 <3> 747 <3> %imacro leave 0.nolist 748 <3> mov sp,bp 749 <3> pop bp 750 <3> %endmacro 751 <3> 752 <3> 753 <3> %imacro argvar 2.nolist 754 <3> %ifidni %2, BYTE 755 <3> %assign %%a ?aframe 756 <3> %assign ?aframe ?aframe + 1 757 <3> labelsize %1, byte, bp + %%a 758 <3> %else 759 <3> %ifidni %2, WORD 760 <3> %assign %%a ?aframe 761 <3> %assign ?aframe ?aframe + 2 762 <3> labelsize %1, word, bp + %%a 763 <3> %else 764 <3> %ifidni %2, DWORD 765 <3> %assign %%a ?aframe 766 <3> %assign ?aframe ?aframe + 4 767 <3> labelsize %1 %+ l, word, bp + %%a 768 <3> labelsize %1 %+ h, word, bp + %%a + 2 769 <3> labelsize %1, dword, bp + %%a 770 <3> %else 771 <3> %assign %%a ?aframe 772 <3> %assign ?aframe ?aframe + %2 773 <3> labelsize %1, byte, bp + %%a 774 <3> %endif 775 <3> %endif 776 <3> %endif 777 <3> %endmacro 778 <3> 779 <3> BREAK 780 <3> 781 <3> %imacro errnz 1.nolist 782 <3> detectstripangles %%token, %%opening, %%closing, %1 783 <3> %if ? %+ %%token 784 <3> %error %1 <> 0 785 <3> %endif 786 <3> %endmacro 787 <3> 788 <3> %endif 38 <2> 39 <2> %include "versiona.mac" 1 <3> 2 <3> major_version equ 4 ;Major DOS version 3 <3> minor_version equ 00 ;Minor DOS Version 4 <3> 5 <3> MINOR_VERSION equ minor_version ; NASM port equate 6 <3> MAJOR_VERSION equ major_version ; NASM port equate 7 <3> expected_version equ (MINOR_VERSION << 8)+MAJOR_VERSION 8 <3> 9 <3> alt_major_version equ 5 ;Major DOS version 10 <3> alt_minor_version equ 26 ;Minor DOS Version 11 <3> 12 <3> alt_expected_version equ (alt_minor_version << 8) + alt_major_version 13 <3> 14 <3> new_major_version equ 5 ;Major DOS version 15 <3> new_minor_version equ 38 ;Minor DOS Version 16 <3> new_expected_version equ (new_minor_version << 8) + new_major_version 17 <3> 18 <3> %warning out: ... for DOS Version 4.00 ... 18 ****************** <3> warning: out: ... for DOS Version 4.00 ... [-w+user] 19 <3> 20 <3> ;****************************** 21 <3> ;Each assembler program should: 22 <3> ; mov ah,030h ;DOS Get Version function 23 <3> ; int 021h ;Version ret. in AX,minor version first 24 <3> ; cmp ax,expected_version ;ALL utilities should check for an 25 <3> ; jne error_handler ; EXACT version match. 26 <3> ;****************************** 27 <3> 40 <2> 41 <2> BREAK 42 <2> 43 <2> c_DEL EQU 7Fh ; ASCII rubout or delete previous char 44 <2> c_BS EQU 08h ; ^H ASCII backspace 45 <2> c_CR EQU 0Dh ; ^M ASCII carriage return 46 <2> c_LF EQU 0Ah ; ^J ASCII linefeed 47 <2> c_ETB EQU 17h ; ^W ASCII end of transmission 48 <2> c_NAK EQU 15h ; ^U ASCII negative acknowledge 49 <2> c_ETX EQU 03h ; ^C ASCII end of text 50 <2> c_HT EQU 09h ; ^I ASCII tab 51 <2> 52 <2> BREAK 53 <2> 54 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 55 <2> ; ; 56 <2> ; C A V E A T P R O G R A M M E R ; 57 <2> ; ; 58 <2> ; Certain structures, constants and system calls below are private to ; 59 <2> ; the DOS and are extremely version-dependent. They may change at any ; 60 <2> ; time at the implementors' whim. As a result, they must not be ; 61 <2> ; documented to the general public. If an extreme case arises, they ; 62 <2> ; must be documented with this warning. ; 63 <2> ; ; 64 <2> ; Those structures and constants that are subject to the above will be ; 65 <2> ; marked and bracketed with the flag: ; 66 <2> ; ; 67 <2> ; C A V E A T P R O G R A M M E R ; 68 <2> ; ; 69 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 70 <2> 71 <2> %include "bpb.mac" 1 <3> %warning out: BPB.INC... 1 ****************** <3> warning: out: BPB.INC... [-w+user] 2 <3> ; SCCSID = @(#)BPB.ASM 1.1 85/04/29 3 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 4 <3> ; C A V E A T P R O G R A M M E R ; 5 <3> ; ; 6 <3> 7 <3> ; BIOS PARAMETER BLOCK DEFINITION 8 <3> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB 9 <3> 10 <3> BPBLOCK STRUC 0 00000D12 ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 00000D14 ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 00000D15 ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 00000D17 ?? BPFTCNT DB ? ; NUMBER OF FATS 0 00000D18 ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00000D1A ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 00000D1C ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 00000D1D ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <3> BPBLOCK ENDS 20 <3> 21 <3> A_BPB STRUC 0 00000D12 ???? BPB_BYTESPERSECTOR DW ? 0 00000D14 ?? BPB_SECTORSPERCLUSTER DB ? 0 00000D15 ???? BPB_RESERVEDSECTORS DW ? 0 00000D17 ?? BPB_NUMBEROFFATS DB ? 0 00000D18 ???? BPB_ROOTENTRIES DW ? 0 00000D1A ???? BPB_TOTALSECTORS DW ? 0 00000D1C ?? BPB_MEDIADESCRIPTOR DB ? 0 00000D1D ???? BPB_SECTORSPERFAT DW ? 0 00000D1F ???? BPB_SECTORSPERTRACK DW ? 0 00000D21 ???? BPB_HEADS DW ? 0 00000D23 ???? BPB_HIDDENSECTORS DW ? 0 00000D25 ???? DW ? 0 00000D27 ???? BPB_BIGTOTALSECTORS DW ? 0 00000D29 ???? DW ? 0 00000D2B ???????????? DB 6 DUP(?) 37 <3> A_BPB ENDS 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 72 <2> 73 <2> %include "buffer.mac" 1 <3> %include "buf2sw.mac" 1 <4> %define BUF2 1 2 <3> 3 <3> ; SCCSID = @(#)buffer.asm 1.1 85/04/09 4 <3> BREAK 5 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 6 <3> ; C A V E A T P R O G R A M M E R ; 7 <3> ; ; 8 <3> 9 <3> %ifdef BUF2 10 <3> 11 <3> ; Field definition for I/O buffer information 12 <3> 13 <3> BUFFINFO STRUC 0 00000D12 ???????? NEXTBUF DD ? ; Pointer to next buffer in list 15 <3> ; The next two items are often refed as a word 16 <3> buf_ID: 0 00000D16 ?? BUFDRV DB ? ; Logical drive # assoc with buffer FF = free 18 <3> buf_flags: 0 00000D17 ?? BUFDATAFLAG db ? 0 00000D18 ?? BUFPRI DB ? ; Buffer selection priority (see EQUs below) 0 00000D19 ?? alignb 2 22 <3> buf_sector: 0 00000D1A ???????? BUFSECNO dd ? ; Sector number of buffer 24 <3> alignb 2 0 00000D1E ???????? BUFDRVDP DD ? ; Pointer to drive parameters 26 <3> BUFFINFO ENDS 27 <3> 28 <3> BUFINSIZ EQU BUFFINFO_struc_size 29 <3> ; Size of structure in bytes 30 <3> BUFINSIZE equ BUFINSIZ 31 <3> 32 <3> FREEPRI EQU 0 33 <3> LBRPRI EQU 2 ; Last byte of buffer read 34 <3> LBWPRI EQU 4 ; Last byte written 35 <3> RPRI EQU 6 ; Read but not last byte 36 <3> WPRI EQU 8 ; Written but not last byte 37 <3> DIRPRI EQU 15 ; Directory Sector 38 <3> FATPRI EQU 30 ; FAT sector 39 <3> 40 <3> buf_dirty EQU 01000000B 41 <3> buf_isDATA EQU 00001000B 42 <3> buf_isDIR EQU 00000100B 43 <3> buf_isFAT EQU 00000010B 44 <3> buf_type_0 EQU 11110001B ; AND sets type to "none" 45 <3> 46 <3> %else 47 <3> 48 <3> ; Field definition for I/O buffer information 49 <3> 50 <3> BUFFINFO STRUC 51 <3> buf_next DW ? ; Pointer to next buffer in list 52 <3> buf_prev DW ? ; Pointer to prev buffer in list 53 <3> buf_ID DB ? ; Drive of buffer (bit 7 = 0) 54 <3> ; SFT table index (bit 7 = 1) 55 <3> ; = FFH if buffer free 56 <3> buf_flags DB ? ; Bit 7 = 1 if Remote file buffer 57 <3> ; = 0 if Local device buffer 58 <3> ; Bit 6 = 1 if buffer dirty 59 <3> ; Bit 5 = Reserved 60 <3> ; Bit 4 = Search bit (bit 7 = 1) 61 <3> ; Bit 3 = 1 if buffer is DATA 62 <3> ; Bit 2 = 1 if buffer is DIR 63 <3> ; Bit 1 = 1 if buffer is FAT 64 <3> ; Bit 0 = Reserved 65 <3> buf_sector DD ? ; Sector number of buffer (bit 7 = 0) 66 <3> ; The next two items are often refed as a word (bit 7 = 0) 67 <3> buf_wrtcnt DB ? ; For FAT sectors, # times sector written out 68 <3> buf_wrtcntinc DW ? ; " " " , # sectors between each write 69 <3> buf_DPB DD ? ; Pointer to drive parameters 70 <3> buf_fill DW ? ; How full buffer is (bit 7 = 1) 71 <3> buf_reserved DB ? ; make DWORD boundary for 386 72 <3> BUFFINFO ENDS 73 <3> 74 <3> labelsize buf_offset, dword, buf_sector 75 <3> ;For bit 7 = 1, this is the byte 76 <3> ;offset of the start of the buffer in 77 <3> ;the file pointed to by buf_ID. Thus 78 <3> ;the buffer starts at location 79 <3> ;buf_offset in the file and contains 80 <3> ;buf_fill bytes. 81 <3> 82 <3> BUFINSIZ EQU BUFFINFO_struc_size 83 <3> ; Size of structure in bytes 84 <3> 85 <3> buf_Free EQU 0FFh ; buf_id of free buffer 86 <3> 87 <3> ;Flag byte masks 88 <3> buf_isnet EQU 10000000B 89 <3> buf_dirty EQU 01000000B 90 <3> 91 <3> buf_isDATA EQU 00001000B 92 <3> buf_isDIR EQU 00000100B 93 <3> buf_isFAT EQU 00000010B 94 <3> buf_type_0 EQU 11110001B ; AND sets type to "none" 95 <3> 96 <3> buf_NetID EQU BUFINSIZ 97 <3> 98 <3> ; 99 <3> ; Buffer Hash Entry Structure 100 <3> 101 <3> BUFFER_HASH_ENTRY STRUC ; DOS 4.00 102 <3> EMS_PAGE_NUM DW ? ; logical page number for EMS handle 103 <3> BUFFER_BUCKET DD ? ; pointer to buffers 104 <3> DIRTY_COUNT DB ? ; number of dirty buffers 105 <3> BUFFER_RESERVED DB ? ; reserved 106 <3> BUFFER_HASH_ENTRY ENDS 107 <3> 108 <3> MaxBuffinBucket EQU 15 ; Max number of buffers per bucket 109 <3> MaxBucketinPage EQU 2 ; Max number of buckets per 16kb page 110 <3> 111 <3> %endif 112 <3> 113 <3> ; ; 114 <3> ; C A V E A T P R O G R A M M E R ; 115 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 74 <2> 75 <2> BREAK 76 <2> ; Location of user registers relative user stack pointer 77 <2> 78 <2> user_environ STRUC 0 00000D12 ???? user_AX DW ? 0 00000D14 ???? user_BX DW ? 0 00000D16 ???? user_CX DW ? 0 00000D18 ???? user_DX DW ? 0 00000D1A ???? user_SI DW ? 0 00000D1C ???? user_DI DW ? 0 00000D1E ???? user_BP DW ? 0 00000D20 ???? user_DS DW ? 0 00000D22 ???? user_ES DW ? 0 00000D24 ???? user_IP DW ? 0 00000D26 ???? user_CS DW ? 0 00000D28 ???? user_F DW ? 91 <2> user_environ ENDS 92 <2> 93 <2> %include "sysvar.mac" 1 <3> ; SCCSID = @(#)sysvar.asm 1.1 85/04/10 2 <3> %include "version.mac" 1 <4> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <4> TRUE EQU 0FFFFh 3 <4> TRUEBYTE EQU 0FFh 4 <4> FALSE EQU 0 5 <4> 6 <4> ; 7 <4> ; Use the following switches to control cmacros.inc 8 <4> ; 9 <4> ?PLM equ 0 10 <4> ?WIN equ 0 11 <4> 12 <4> memS EQU 1 ; Small model 13 <4> ; 14 <4> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <4> ; version of the operating system 16 <4> ; 17 <4> ; The below chart will indicate how to set the switches to build the various 18 <4> ; versions 19 <4> ; 20 <4> ; IBMVER IBMCOPYRIGHT 21 <4> ; -------------------------------------------------------- 22 <4> ; IBM Version | TRUE TRUE 23 <4> ; -------------------------------------------------------- 24 <4> ; MS Version | FALSE FALSE 25 <4> ; -------------------------------------------------------- 26 <4> ; Clone Version | TRUE FALSE 27 <4> ; 28 <4> IBMVER EQU TRUE 29 <4> IBMCOPYRIGHT EQU FALSE 30 <4> 31 <4> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <4> 33 <4> %ifndef MSVER 34 <4> MSVER EQU ~ IBMVER 35 <4> %endif 36 <4> IBM EQU IBMVER 37 <4> ; 38 <4> ; 39 <4> %IF IBMVER 40 <4> %IF IBMCOPYRIGHT 41 <4> %warning out: ... IBM version build switch on ... 42 <4> %ELSE 43 <4> %warning out: ... CLONE version build switch on ... 43 ****************** <4> warning: out: ... CLONE version build switch on ... [-w+user] 44 <4> %ENDIF 45 <4> %ELSE 46 <4> %IFN IBMCOPYRIGHT 47 <4> %warning out: ... MS version build switch on ... 48 <4> %ELSE 49 <4> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <4> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <4> %ENDIF 52 <4> %ENDIF 53 <4> ; 54 <4> ; 55 <4> ;*************************************************************************** 56 <4> ;* The following switches are for DBCS or SBCS support * 57 <4> ;* * 58 <4> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <4> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <4> ;* * 61 <4> ;*************************************************************************** 62 <4> ; 63 <4> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <4> 65 <4> ; 66 <4> ; Switch INTERNAT for DBCS support 67 <4> ; 68 <4> INTERNAT EQU FALSE 69 <4> ; 70 <4> %IF INTERNAT 71 <4> %ifndef KANJI 72 <4> KANJI EQU TRUE 73 <4> %endif 74 <4> IBMJAPAN EQU TRUE 75 <4> %ELSE 76 <4> %ifndef KANJI 77 <4> KANJI EQU FALSE 78 <4> %endif 79 <4> IBMJAPAN EQU FALSE 80 <4> %ENDIF 81 <4> 82 <4> %ifndef altvect ; avoid jerking off vector.inc 83 <4> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <4> %endif 85 <4> 86 <4> ; 87 <4> ; Country code switches 88 <4> ; The default contry code is assumed as USA. 89 <4> ; 90 <4> %IF INTERNAT 91 <4> KOREA EQU TRUE 92 <4> JAPAN EQU FALSE 93 <4> %ELSE 94 <4> KOREA EQU FALSE 95 <4> JAPAN EQU FALSE 96 <4> %ENDIF 97 <4> ; 98 <4> %IF INTERNAT 99 <4> %warning out: Internat(ECS) version build switch on 100 <4> %ENDIF 3 <3> 4 <3> SysInitVars STRUC 0 00000D12 ???????? SYSI_DPB DD ? ; DPB chain 0 00000D16 ???????? SYSI_SFT DD ? ; SFT chain 0 00000D1A ???????? SYSI_CLOCK DD ? ; CLOCK device 0 00000D1E ???????? SYSI_CON DD ? ; CON device 0 00000D22 ???? SYSI_MAXSEC DW ? ; maximum sector size 0 00000D24 ???????? SYSI_BUF DD ? ; points to Hashinitvar 0 00000D28 ???????? SYSI_CDS DD ? ; CDS list 0 00000D2C ???????? SYSI_FCB DD ? ; FCB chain 0 00000D30 ???? SYSI_Keep DW ? ; keep count 0 00000D32 ?? SYSI_NUMIO DB ? ; Number of block devices 0 00000D33 ?? SYSI_NCDS DB ? ; number of CDS's 0 00000D34 ???????? SYSI_DEV DD ? ; device list 0 00000D38 ???? SYSI_ATTR DW ? ; null device attribute word 0 00000D3A ???? SYSI_STRAT DW ? ; null device strategy entry point 0 00000D3C ???? SYSI_INTER DW ? ; null device interrupt entry point 0 00000D3E ???????????????? SYSI_NAME DB 8 DUP(?) ; null device name 0 00000D46 ?? SYSI_SPLICE DB ? ; TRUE -> splicees being done 0 00000D47 ???? SYSI_IBMDOS_SIZE DW ? ; DOS size in paragraphs 0 00000D49 ???????? SYSI_IFS_DOSCALL@ DD ? ; IFS DOS service rountine entry 0 00000D4D ???????? SYSI_IFS DD ? ; IFS header chain 0 00000D51 ???????? SYSI_BUFFERS DW ?,? ; BUFFERS= values (m,n) 0 00000D55 ?? SYSI_BOOT_DRIVE DB ? ; boot drive A=1 B=2,.. 0 00000D56 ?? SYSI_DWMOVE DB ? ; 1 if 386 machine 0 00000D57 ???? SYSI_EXT_MEM DW ? ; Extended memory size in KB. 29 <3> SysInitVars ENDS 30 <3> 31 <3> ;This is added for more information exchage between DOS, BIOS. 32 <3> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86 33 <3> SysInitVars_Ext struc 0 00000D12 ???????? SYSI_InitVars DD ? ; Points to the above structure. 0 00000D16 ???????? SYSI_Country_Tab DD ? ; DOS_Country_cdpg_info 36 <3> SysInitVars_Ext ends 37 <3> 38 <3> ;The SYSI_BUF of SysInitVars points to the follwong structure 39 <3> EMS_MAP_BUFF_SIZE EQU 12 ; EMS map buffer size 40 <3> 41 <3> Buffinfo STRUC 0 00000D12 ???????? Hash_ptr DD ? ; pointer to Hash table 0 00000D16 ???? Hash_count DW ? ; number of Hash entries 0 00000D18 ???????? Cache_ptr DD ? ; pointer to secondary cache 0 00000D1C ???? Cache_count DW ? ; number of secondary cache entries 46 <3> 47 <3> %IF BUFFERFLAG 48 <3> 0 00000D1E ?? EMS_SAFE_FLAG DB ? 0 00000D1F ???????? EMS_LAST_PAGE DW ?, ? 0 00000D23 ???????? EMS_FIRST_PAGE DW ?, ? 0 00000D27 ???? EMS_NPA640 DW ? 53 <3> 54 <3> %ENDIF 55 <3> 0 00000D29 ?? EMS_mode DB ? ; no EMS = -1 0 00000D2A ???? EMS_handle DW ? ; EMS handle for buffers 0 00000D2C ???? EMS_PageFrame_Number DW ? ; EMS page frame number 0 00000D2E ???? EMS_Seg_Cnt DW ? ; EMS segment count 0 00000D30 ???? EMS_Page_Frame DW ? ; EMS page frame segment address 0 00000D32 ???? EMS_reserved DW ? ; EMS segment count 62 <3> 63 <3> %IF BUFFERFLAG 0 00000D34 ?? EMS_Map_Buff DB ? ; map buffer 65 <3> %ELSE 66 <3> EMS_Map_Buff DB 12 dup(?) 67 <3> %ENDIF 68 <3> 69 <3> Buffinfo ENDS 70 <3> 71 <3> 72 <3> 73 <3> 74 <3> 75 <3> 76 <3> 77 <3> 94 <2> 95 <2> %include "vector.mac" 1 <3> ; SCCSID = @(#)vector.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ;Asmvar AltVect 5 <3> %ifndef AltVect 6 <3> %iassign AltVect 0 7 <3> %endif 8 <3> 9 <3> INTTAB EQU 20H 10 <3> inttab equ INTTAB ; NASM port equate 11 <3> INTBASE EQU 4 * inttab 12 <3> ENTRYPOINT EQU INTBASE+40H 13 <3> 14 <3> %IF ALTVECT 15 <3> ALTTAB EQU 0F0H 16 <3> ALTBASE EQU 4 * ALTTAB 17 <3> %ENDIF 18 <3> 19 <3> ; 20 <3> ; interrupt assignments 21 <3> ; 22 <3> %IFN ALTVECT 23 <3> int_abort EQU INTTAB ; abort process 24 <3> int_command EQU int_abort+1 ; call MSDOS 25 <3> int_terminate EQU int_abort+2 ; int to terminate address 26 <3> int_ctrl_c EQU int_abort+3 ; ^c trapper 27 <3> int_fatal_abort EQU int_abort+4 ; hard disk error 28 <3> int_disk_read EQU int_abort+5 ; logical sector disk read 29 <3> int_disk_write EQU int_abort+6 ; logical sector disk write 30 <3> int_keep_process EQU int_abort+7 ; terminate program and stay 31 <3> ; resident 32 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ; ; 35 <3> int_spooler EQU int_abort+8 ; spooler call 36 <3> int_fastcon EQU int_abort+9 ; fast CON interrupt 37 <3> int_IBM EQU int_abort+10; critical section maintenance 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <3> %ELSE 42 <3> int_abort EQU INTTAB ; abort process 43 <3> int_command EQU int_abort+1 ; call MSDOS 44 <3> int_terminate EQU ALTTAB ; int to terminate address 45 <3> int_ctrl_c EQU int_terminate+1 ; ^c trapper 46 <3> int_fatal_abort EQU int_terminate+2 ; hard disk error 47 <3> int_disk_read EQU int_abort+5 ; logical sector disk read 48 <3> int_disk_write EQU int_abort+6 ; logical sector disk write 49 <3> int_keep_process EQU int_abort+7 ; terminate program and stay resident 50 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 51 <3> ; C A V E A T P R O G R A M M E R ; 52 <3> ; ; 53 <3> int_spooler EQU int_terminate+3 ; spooler call 54 <3> int_fastcon EQU int_abort+9 ; fast CON interrupt 55 <3> ; ; 56 <3> ; C A V E A T P R O G R A M M E R ; 57 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <3> %ENDIF 59 <3> 60 <3> addr_int_abort EQU 4 * int_abort 61 <3> addr_int_command EQU 4 * int_command 62 <3> addr_int_terminate EQU 4 * int_terminate 63 <3> addr_int_ctrl_c EQU 4 * int_ctrl_c 64 <3> addr_int_fatal_abort EQU 4 * int_fatal_abort 65 <3> addr_int_disk_read EQU 4 * int_disk_read 66 <3> addr_int_disk_write EQU 4 * int_disk_write 67 <3> addr_int_keep_process EQU 4 * int_keep_process 68 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 69 <3> ; C A V E A T P R O G R A M M E R ; 70 <3> ; ; 71 <3> addr_int_spooler EQU 4 * int_spooler 72 <3> addr_int_fastcon EQU 4 * int_fastcon 73 <3> addr_int_IBM EQU 4 * int_IBM 74 <3> ; ; 75 <3> ; C A V E A T P R O G R A M M E R ; 76 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 96 <2> 97 <2> %include "mult.mac" 1 <3> ; SCCSID = @(#)mult.asm 1.2 85/04/12 2 <3> Break 3 <3> 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; Critical section definitions 8 <3> ; 9 <3> ; These below are subject to leave-all sections 10 <3> critDisk EQU 1 ; Disk I/O critical section 11 <3> critDevice EQU 2 ; Device I/O critical section 12 <3> critShare EQU 1 ; Sharer I/O critical section 13 <3> critMem EQU 1 ; memory maintenance critical section 14 <3> critNet EQU 5 ; network critical section 15 <3> critSFT EQU 1 ; sft table allocation 16 <3> critIFS EQU 6 ; ifsfunc critical section 17 <3> ; These below are not subject to leave-all sections 18 <3> critASSIGN EQU 8 ; Assign has munged a system call 19 <3> ; ; 20 <3> ; C A V E A T P R O G R A M M E R ; 21 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 22 <3> 23 <3> ; 24 <3> ; The current set of defined multiplex channels is (* means documented): 25 <3> ; 26 <3> ; Channel(h) Issuer Receiver Function 27 <3> ; 00 server PSPRINT print job control 28 <3> ; *01 print/apps PRINT Queueing of files 29 <3> ; 02 BIOS REDIR signal open/close of printers 30 <3> ; 31 <3> ; 05 command REDIR obtain text of net int 24 message 32 <3> ; *06 server/assign ASSIGN Install check 33 <3> ; 34 <3> ; 08 external driver IBMBIO interface to internal routines 35 <3> ; 36 <3> ; 10 sharer/server Sharer install check 37 <3> ; 11 DOS/server Redir install check/redirection funcs 38 <3> ; 12 sharer/redir DOS dos functions and structure maint 39 <3> ; 13 MSNET MSNET movement of NCBs 40 <3> ; 13 external driver IBMBIO Reset_Int_13, allows installation 41 <3> ; of alternative INT_13 drivers after 42 <3> ; boot_up 43 <3> ; 14 (IBM) DOS NLSFUNC down load NLS country info,DOS 3.3 44 <3> ; 14 (MS) APPS POPUP MSDOS 4 popup screen functions 45 <3> ; 15 APPS MSCDEX CD-ROM extensions interface 46 <3> ; 16 WIN386 WIN386 Windows communications 47 <3> ; 17 Clipboard WINDOWS Clipboard interface 48 <3> ; *18 Applications MS-Manger Toggle interface to manager 49 <3> ; 19 Shell 50 <3> ; 1A Ansi.sys 51 <3> ; 1B Fastopen,Vdisk IBMBIO EMS INT 67H stub handler 52 <3> ; 53 <3> ; AC Graphics 54 <3> ; AD NLS (toronto) 55 <3> ; AE 56 <3> ; AF Mode 57 <3> ; B0 GRAFTABL GRAFTABL 58 <3> ; 59 <3> 60 <3> 61 <3> ;MUX 00-3F reserverd for IBM 62 <3> ;MUX 80-BF reserverd for IBM 63 <3> ;MUX 40-7F reserved for Microsoft 64 <3> ;MUX C0-FF users 65 <3> 66 <3> 67 <3> 68 <3> MultSHARE EQU 10h ; sharer 69 <3> ; 1 MFT_enter 70 <3> ; 2 MFTClose 71 <3> ; 3 MFTclU 72 <3> ; 4 MFTCloseP 73 <3> ; 5 MFTCloN 74 <3> ; 6 set_block 75 <3> ; 7 clr_block 76 <3> ; 8 chk_block 77 <3> ; 9 MFT_get 78 <3> ; 10 ShSave 79 <3> ; 11 ShChk 80 <3> ; 12 ShCol 81 <3> ; 13 ShCloseFile 82 <3> 83 <3> MultNET EQU 11h ; Network support 84 <3> MultIFS EQU 11h ; Network support 85 <3> ; 1 IFS_RMDIR 86 <3> ; 2 IFS_SEQ_RMDIR 87 <3> ; 3 IFS_MKDIR 88 <3> ; 4 IFS_SEQ_MKDIR 89 <3> ; 5 IFS_CHDIR 90 <3> ; 6 IFS_CLOSE 91 <3> ; 7 IFS_COMMIT 92 <3> ; 8 IFS_READ 93 <3> ; 9 IFS_WRITE 94 <3> ; 10 IFS_LOCK 95 <3> ; 11 IFS_UNLOCK 96 <3> ; 12 IFS_DISK_INFO 97 <3> ; 13 IFS_SET_FILE_ATTRIBUTE 98 <3> ; 14 IFS_SEQ_SET_FILE_ATTRIBUTE 99 <3> ; 15 IFS_GET_FILE_INFO 100 <3> ; 16 IFS_SEQ_GET_FILE_INFO 101 <3> ; 17 IFS_RENAME 102 <3> ; 18 IFS_SEQ_RENAME 103 <3> ; 19 IFS_DELETE 104 <3> ; 20 IFS_SEQ_DELETE 105 <3> ; 21 IFS_OPEN 106 <3> ; 22 IFS_SEQ_OPEN 107 <3> ; 23 IFS_CREATE 108 <3> ; 24 IFS_SEQ_CREATE 109 <3> ; 25 IFS_SEQ_SEARCH_FIRST 110 <3> ; 26 IFS_SEQ_SEARCH_NEXT 111 <3> ; 27 IFS_SEARCH_FIRST 112 <3> ; 28 IFS_SEARCH_NEXT 113 <3> ; 29 IFS_ABORT 114 <3> ; 30 IFS_ASSOPER 115 <3> ; 31 Printer_SET_STRING 116 <3> ; 32 IFSFlushBuf 117 <3> ; 33 IFSBufWrite 118 <3> ; 34 IFSResetEnvironment 119 <3> ; 35 IFSSpoolCheck 120 <3> ; 36 IFSSpoolClose 121 <3> 122 <3> MultDOS EQU 12h ; DOS call back 123 <3> ; 1 DOS_CLOSE 124 <3> ; 2 RECSET 125 <3> ; 3 Get DOSGROUP 126 <3> ; 4 PATHCHRCMP 127 <3> ; 5 OUT 128 <3> ; 6 NET_I24_ENTRY 129 <3> ; 7 PLACEBUF 130 <3> ; 8 FREE_SFT 131 <3> ; 9 BUFWRITE 132 <3> ; 10 SHARE_VIOLATION 133 <3> ; 11 SHARE_ERROR 134 <3> ; 12 SET_SFT_MODE 135 <3> ; 13 DATE16 136 <3> ; 14 SETVISIT 137 <3> ; 15 SCANPLACE 138 <3> ; 16 SKIPVISIT 139 <3> ; 17 StrCpy 140 <3> ; 18 StrLen 141 <3> ; 19 Ucase 142 <3> ; 20 POINTCOMP 143 <3> ; 21 CHECKFLUSH 144 <3> ; 22 SFFromSFN 145 <3> ; 23 GetCDSFromDrv 146 <3> ; 24 Get_User_Stack 147 <3> ; 25 GetThisDrv 148 <3> ; 26 DriveFromText 149 <3> ; 27 SETYEAR 150 <3> ; 28 DSUM 151 <3> ; 29 DSLIDE 152 <3> ; 30 StrCmp 153 <3> ; 31 initcds 154 <3> ; 32 pjfnfromhandle 155 <3> ; 33 $NameTrans 156 <3> ; 34 CAL_LK 157 <3> ; 35 DEVNAME 158 <3> ; 36 Idle 159 <3> ; 37 DStrLen 160 <3> ; 38 NLS_OPEN DOS 3.3 161 <3> ; 39 $CLOSE DOS 3.3 162 <3> ; 40 NLS_LSEEK DOS 3.3 163 <3> ; 41 $READ DOS 3.3 164 <3> ; 42 FastInit DOS 4.0 165 <3> ; 43 NLS_IOCTL DOS 3.3 166 <3> ; 44 GetDevList DOS 3.3 167 <3> ; 45 NLS_GETEXT DOS 3.3 168 <3> ; 46 MSG_RETRIEVAL DOS 4.0 169 <3> ; 47 FAKE_VERSION DOS 4.0 170 <3> ; 171 <3> NLSFUNC EQU 14h ; NLSFUNC CALL , DOS 3.3 172 <3> ; 0 NLSInstall 173 <3> ; 1 ChgCodePage 174 <3> ; 2 GetExtInfo 175 <3> ; 3 SetCodePage 176 <3> ; 4 GetCntry 177 <3> ; 178 <3> ;FASTOPEN is not chained through INT 2F ; DOS 3.3 F.C. 179 <3> ; it calls Multdos 42 to set up an entry routine address 180 <3> ; 0 Install status (reserved) 181 <3> ; 1 Lookup 182 <3> ; 2 Insert 183 <3> ; 3 Delete 184 <3> ; 4 Purge (reserved) 98 <2> 99 <2> BREAK 100 <2> ; MSDOS partitions the disk into 4 sections: 101 <2> ; 102 <2> ; phys sector 0: +-------------------+ 103 <2> ; | | boot/reserved | 104 <2> ; | +-------------------+ 105 <2> ; | | File allocation | 106 <2> ; v | table(s) | 107 <2> ; | (multiple copies | 108 <2> ; | are kept) | 109 <2> ; +-------------------+ 110 <2> ; | Directory | 111 <2> ; +-------------------+ 112 <2> ; | File space | 113 <2> ; +-------------------+ 114 <2> ; | Unaddressable | 115 <2> ; | (to end of disk) | 116 <2> ; +-------------------+ 117 <2> ; 118 <2> ; All partition boundaries are sector boundaries. The size of the FAT is 119 <2> ; adjusted to maximize the file space addressable. 120 <2> 121 <2> %include "dirent.mac" 1 <3> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 3 <3> Break 4 <3> 5 <3> ; 6 <3> ; +---------------------------+ 7 <3> ; | (12 BYTE) filename/ext | 0 0 8 <3> ; +---------------------------+ 9 <3> ; | (BYTE) attributes | 11 B 10 <3> ; +---------------------------+ 11 <3> ; | (10 BYTE) reserved | 12 C 12 <3> ; +---------------------------+ 13 <3> ; | (WORD) time of last write | 22 16 14 <3> ; +---------------------------+ 15 <3> ; | (WORD) date of last write | 24 18 16 <3> ; +---------------------------+ 17 <3> ; | (WORD) First cluster | 26 1A 18 <3> ; +---------------------------+ 19 <3> ; | (DWORD) file size | 28 1C 20 <3> ; +---------------------------+ 21 <3> ; 22 <3> ; First byte of filename = E5 -> free directory entry 23 <3> ; = 00 -> end of allocated directory 24 <3> ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour 25 <3> ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980 26 <3> ; 27 <3> 28 <3> dir_entry STRUC 29 00000000 <3> dir_name DB 11 DUP (?) ; file name 0 00000D1D ?? dir_attr DB ? ; attribute bits 0 00000D1E ???? dir_codepg dw ? ; code page DOS 4.00 0 00000D20 ???? dir_extcluster dw ? ; extended attribute starting cluster 0 00000D22 ?? dir_attr2 db ? ; reserved 0 00000D23 ?????????? dir_pad DB 5 DUP (?) ; reserved for expansion 0 00000D28 ???? dir_time DW ? ; time of last write 0 00000D2A ???? dir_date DW ? ; date of last write 0 00000D2C ???? dir_first DW ? ; first allocation unit of file 0 00000D2E ???? dir_size_l DW ? ; low 16 bits of file size 0 00000D30 ???? dir_size_h DW ? ; high 16 bits of file size 40 <3> dir_entry ENDS 41 <3> 42 <3> attr_read_only EQU 1h 43 <3> attr_hidden EQU 2h 44 <3> attr_system EQU 4h 45 <3> attr_volume_id EQU 8h 46 <3> attr_directory EQU 10h 47 <3> attr_archive EQU 20h 48 <3> attr_device EQU 40h ; This is a VERY special bit. 49 <3> ; NO directory entry on a disk EVER 50 <3> ; has this bit set. It is set non-zero 51 <3> ; when a device is found by GETPATH 52 <3> 53 <3> attr_all EQU attr_hidden+attr_system+attr_directory 54 <3> ; OR of hard attributes for FINDENTRY 55 <3> 56 <3> attr_ignore EQU attr_read_only+attr_archive+attr_device 57 <3> ; ignore this(ese) attribute(s) during 58 <3> ; search first/next 59 <3> 60 <3> attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive 61 <3> ; changeable via CHMOD 122 <2> 123 <2> BREAK 124 <2> ; 125 <2> ; The File Allocation Table uses a 12-bit entry for each allocation unit on 126 <2> ; the disk. These entries are packed, two for every three bytes. The contents 127 <2> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result 128 <2> ; to the base address of the Allocation Table; 3) fetching the 16-bit word 129 <2> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift 130 <2> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex). Entry 131 <2> ; number zero is used as an end-of-file trap in the OS and is passed to the 132 <2> ; BIOS to help determine disk format. Entry 1 is reserved for future use. 133 <2> ; The first available allocation unit is assigned entry number two, and even 134 <2> ; though it is the first, is called cluster 2. Entries greater than 0FF8H 135 <2> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero 136 <2> ; are unallocated. Otherwise, the contents of a FAT entry is the number of 137 <2> ; the next cluster in the file. 138 <2> ; 139 <2> ; Clusters with bad sectors are tagged with FF7H. Any non-zero number would 140 <2> ; do because these clusters show as allocated, but are not part of any 141 <2> ; allocation chain and thus will never be allocated to a file. A particular 142 <2> ; number is selected so that disk checking programs know what to do (ie. a 143 <2> ; cluster with entry FF7H which is not in a chain is not an error). 144 <2> 145 <2> %include "dpb.mac" 1 <3> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> dpb STRUC 0 00000D12 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 00000D13 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 00000D14 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 00000D16 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 00000D17 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 00000D18 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 00000D1A ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 00000D1B ???? dpb_root_entries DW ? ; Number of directory entries 0 00000D1D ???? dpb_first_sector DW ? ; First sector of first cluster 0 00000D1F ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 00000D21 ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 00000D23 ???? dpb_dir_sector DW ? ; Starting record of directory 0 00000D25 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 00000D29 ?? dpb_media DB ? ; Media byte 0 00000D2A ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <3> ; check the first time this DPB is used 0 00000D2B ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 00000D2F ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 00000D31 ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <3> dpb ENDS 28 <3> 29 <3> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <3> 31 <3> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <3> ; ; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 146 <2> 147 <2> %include "curdir.mac" 1 <3> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; CDS items are used bu the internal routines to store cluster numbers and ; 8 <3> ; network identifiers for each logical name. The ID field is used dually, ; 9 <3> ; both as net ID and for a cluster number for local devices. In the case ; 10 <3> ; of local devices, the cluster number will be -1 if there is a potential ; 11 <3> ; of the disk being changed or if the path must be recracked. The END ; 12 <3> ; field is the location of the end of the definition. No .. is allowed ; 13 <3> ; past this point ; 14 <3> 15 <3> DIRSTRLEN EQU 64+3 ; Max length in bytes of directory strings 16 <3> TEMPLEN EQU DIRSTRLEN*2 17 <3> 18 <3> curdir_list STRUC 19 00000000 <3> curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 0 00000D55 ???? curdir_flags DW ? ; various flags 0 00000D57 ???????? curdir_devptr DD ? ; local pointer to DPB or net device 0 00000D5B ???? curdir_ID DW ? ; cluster of current dir (net ID) 0 00000D5D ???? DW ? 0 00000D5F ???? curdir_user_word DW ? 0 00000D61 ???? curdir_end DW ? ; end of assignment 0 00000D63 ?? curdir_type DB ? ; IFS drive (2=ifs, 4=netuse) 0 00000D64 ???????? curdir_ifs_hdr DD ? ; Ptr to File System Header 0 00000D68 ???? curdir_fsda DB 2 DUP (?) ; File System Dependent Data Area 29 <3> curdir_list ENDS 30 <3> 31 <3> curdirLen EQU curdir_list_struc_size ; Needed for screwed up 32 <3> ; ASM87 which doesn't allow 33 <3> ; Size directive as a macro 34 <3> ; argument 35 <3> labelsize curdir_netID, dword, curdir_ID 36 <3> 37 <3> ;Flag word masks 38 <3> curdir_isnet EQU 1000000000000000B 39 <3> curdir_isifs EQU 1000000000000000B ; DOS 4.00 40 <3> curdir_inuse EQU 0100000000000000B 41 <3> curdir_splice EQU 0010000000000000B 42 <3> curdir_local EQU 0001000000000000B 43 <3> ; ; 44 <3> ; C A V E A T P R O G R A M M E R ; 45 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 148 <2> 149 <2> %include "cpmfcb.mac" 1 <3> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 3 <3> ;BREAK 4 <3> 5 <3> ; 6 <3> ; Field definition for FCBs 7 <3> ; The FCB has the following structure: 8 <3> ; 9 <3> ; +---------------------------+ 10 <3> ; | Drive indicator(byte) | 11 <3> ; +---------------------------+ 12 <3> ; | Filename (8 chars) | 13 <3> ; +---------------------------+ 14 <3> ; | Extension (3 chars) | 15 <3> ; +---------------------------+ 16 <3> ; | Current Extent(word) | 17 <3> ; +---------------------------+ 18 <3> ; | Record size (word) | 19 <3> ; +---------------------------+ 20 <3> ; | File Size (2 words) | 21 <3> ; +---------------------------+ 22 <3> ; | Date of write | 23 <3> ; +---------------------------+ 24 <3> ; | Time of write | 25 <3> ; +---------------------------+ 26 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 27 <3> ; C A V E A T P R O G R A M M E R ; 28 <3> ; ; 29 <3> ; +---------------------------+ 30 <3> ; | 8 bytes reserved | 31 <3> ; +---------------------------+ 32 <3> ; ; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 35 <3> ; | next record number | 36 <3> ; +---------------------------+ 37 <3> ; | random record number | 38 <3> ; +---------------------------+ 39 <3> ; 40 <3> 41 <3> sys_fcb STRUC 0 00000D12 ?? fcb_drive DB ? 0 00000D13 ???????????????? fcb_name DB 8 DUP (?) 0 00000D1B ?????? fcb_ext DB 3 DUP (?) 0 00000D1E ???? fcb_EXTENT DW ? 0 00000D20 ???? fcb_RECSIZ DW ? ; Size of record (user settable) 0 00000D22 ???? fcb_FILSIZ DW ? ; Size of file in bytes; used with the 48 <3> ; following word 0 00000D24 ???? fcb_DRVBP DW ? ; BP for SEARCH FIRST and SEARCH NEXT 0 00000D26 ???? fcb_FDATE DW ? ; Date of last writing 0 00000D28 ???? fcb_FTIME DW ? ; Time of last writing 52 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 53 <3> ; C A V E A T P R O G R A M M E R ; 54 <3> ; ; 0 00000D2A ???????????????? fcb_reserved DB 8 DUP (?) ; RESERVED 56 <3> ; ; 57 <3> ; C A V E A T P R O G R A M M E R ; 58 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D32 ?? fcb_NR DB ? ; Next record 0 00000D33 ???????? fcb_RR DB 4 DUP (?) ; Random record 61 <3> sys_fcb ENDS 62 <3> 63 <3> FILDIRENT equ fcb_FILSIZ ; Used only by SEARCH FIRST and SEARCH 64 <3> ; NEXT 65 <3> 66 <3> labelsize fcb_sfn, byte, fcb_reserved 67 <3> 68 <3> ; Note that fcb_net_handle, fcb_nsl_drive, fcb_nsld_drive and fcb_l_drive 69 <3> ; all must point to the same byte. Otherwise, the FCBRegen will fail. 70 <3> ; NOTE about this byte (fcb_nsl_drive) 71 <3> ; The high two bits of this byte are used as follows to indicate the FCB type 72 <3> ; 00 means a local file or device with sharing loaded 73 <3> ; 10 means a remote (network) file 74 <3> ; 01 means a local file with no sharing loaded 75 <3> ; 11 means a local device with no sharing loaded 76 <3> 77 <3> ; 78 <3> ; Network FCB 79 <3> ; 80 <3> labelsize fcb_net_drive, byte, fcb_reserved+1 81 <3> labelsize fcb_net_handle, word, fcb_reserved+2 82 <3> labelsize fcb_netID, dword, fcb_reserved+4 83 <3> 84 <3> ; 85 <3> ; No sharing local file FCB 86 <3> ; 87 <3> labelsize fcb_nsl_drive, byte, fcb_reserved+1 88 <3> labelsize fcb_nsl_bits, byte, fcb_reserved+2 89 <3> labelsize fcb_nsl_firclus, word, fcb_reserved+3 90 <3> labelsize fcb_nsl_dirsec, word, fcb_reserved+5 91 <3> labelsize fcb_nsl_dirpos, byte, fcb_reserved+7 92 <3> 93 <3> ; 94 <3> ; No sharing local device FCB 95 <3> ; 96 <3> labelsize fcb_nsld_drive, byte, fcb_reserved+1 97 <3> labelsize fcb_nsld_drvptr, dword, fcb_reserved+2 98 <3> 99 <3> ; 100 <3> ; Sharing local FCB 101 <3> ; 102 <3> labelsize fcb_l_drive, byte, fcb_reserved+1 103 <3> labelsize fcb_l_firclus, word, fcb_reserved+2 104 <3> labelsize fcb_l_mfs, word, fcb_reserved+4 105 <3> labelsize fcb_l_attr, byte, fcb_reserved+6 106 <3> 107 <3> ; 108 <3> ; Bogusness: the four cases are: 109 <3> ; 110 <3> ; local file 00 111 <3> ; local device 40 112 <3> ; local sharing C0 113 <3> ; network 80 114 <3> ; 115 <3> ; Since sharing and network collide, we cannot use a test instruction for 116 <3> ; deciding whether a network or a share check in involved 117 <3> ; 118 <3> FCBDEVICE EQU 040h 119 <3> FCBNETWORK EQU 080h 120 <3> FCBSHARE EQU 0C0h 121 <3> 122 <3> ; FCBSPECIAL must be able to mask off both net and share 123 <3> FCBSPECIAL EQU 080h 124 <3> FCBMASK EQU 0C0h 150 <2> 151 <2> %include "find.mac" 1 <3> ; SCCSID = @(#)find.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)find.asm 1.1 85/04/10 3 <3> Break 4 <3> 5 <3> find_buf STRUC 6 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 7 <3> ; C A V E A T P R O G R A M M E R ; 8 <3> ; ; 0 00000D12 ?? find_buf_drive DB ? ; drive of search 10 00000001 <3> find_buf_name DB 11 DUP (?) ; formatted name 0 00000D1E ?? find_buf_sattr DB ? ; attribute of search 0 00000D1F ???? find_buf_LastEnt DW ? ; LastEnt 0 00000D21 ???? find_buf_DirStart DW ? ; DirStart 0 00000D23 ???????? find_buf_NetID DB 4 DUP (?) ; Reserved for NET 15 <3> ; ; 16 <3> ; C A V E A T P R O G R A M M E R ; 17 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 18 <3> 0 00000D27 ?? find_buf_attr DB ? ; attribute found 0 00000D28 ???? find_buf_time DW ? ; time 0 00000D2A ???? find_buf_date DW ? ; date 0 00000D2C ???? find_buf_size_l DW ? ; low(size) 0 00000D2E ???? find_buf_size_h DW ? ; high(size) 24 0000001E <3> find_buf_pname DB 13 DUP (?) ; packed name 25 <3> find_buf ENDS 152 <2> 153 <2> %include "pdb.mac" 1 <3> ; SCCSID = @(#)pdb.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ; 5 <3> ; Process data block (otherwise known as program header) 6 <3> ; 7 <3> 8 <3> FilPerProc EQU 20 9 <3> 10 <3> Process_data_block STRUC 0 00000D12 ???? PDB_Exit_Call DW ? ; INT int_abort system terminate 0 00000D14 ???? PDB_block_len DW ? ; size of execution block 0 00000D16 ?? DB ? 0 00000D17 ?????????? PDB_CPM_Call DB 5 DUP (?) ; ancient call to system 0 00000D1C ???????? PDB_Exit DD ? ; pointer to exit routine 0 00000D20 ???????? PDB_Ctrl_C DD ? ; pointer to ^C routine 0 00000D24 ???????? PDB_Fatal_abort DD ? ; pointer to fatal error 18 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 <3> ; C A V E A T P R O G R A M M E R ; 20 <3> ; ; 0 00000D28 ???? PDB_Parent_PID DW ? ; PID of parent (terminate PID) 22 00000018 <3> PDB_JFN_Table DB FilPerProc DUP (?) 23 <3> ; indices into system table 24 <3> ; ; 25 <3> ; C A V E A T P R O G R A M M E R ; 26 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D3E ???? PDB_environ DW ? ; seg addr of environment 28 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 29 <3> ; C A V E A T P R O G R A M M E R ; 30 <3> ; ; 0 00000D40 ???????? PDB_User_stack DD ? ; stack of self during system calls 0 00000D44 ???? PDB_JFN_Length DW ? ; number of handles allowed 0 00000D46 ???????? PDB_JFN_Pointer DD ? ; pointer to JFN table 0 00000D4A ???????? PDB_Next_PDB DD ? ; pointer to nested PDB's 35 0000003C <3> PDB_PAD1 DB 14h DUP (?) 36 <3> ; ; 37 <3> ; C A V E A T P R O G R A M M E R ; 38 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000D62 ?????????? PDB_Call_system DB 5 DUP (?) ; portable method of system call 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <3> ; C A V E A T P R O G R A M M E R ; 42 <3> ; ; 0 00000D67 ?????????????? PDB_PAD2 DB 7h DUP (?) 44 <3> ; ; 45 <3> ; C A V E A T P R O G R A M M E R ; 46 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 47 <3> Process_data_block ENDS 48 <3> 49 <3> labelsize PDB_InterCon, byte, PDB_PAD1 ; 2/12/KK 50 <3> labelsize PDB_Append, byte, PDB_PAD1+1 ; 2/12/KK 154 <2> 155 <2> %include "exe.mac" 1 <3> ; SCCSID = @(#)exe.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)exe.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ; 5 <3> ; EXEC arg block - load/go program 6 <3> ; 7 <3> 8 <3> ; 9 <3> ; The following get used as arguments to the EXEC system call. They indicate 10 <3> ; whether or not the program is executed or whether or not a program header 11 <3> ; gets created. 12 <3> ; 13 <3> exec_func_no_execute EQU 1 ; no execute bit 14 <3> exec_func_overlay EQU 2 ; overlay bit 15 <3> 16 <3> Exec0 STRUC 0 00000D12 ???? Exec0_environ DW ? ; seg addr of environment 0 00000D14 ???????? Exec0_com_line DD ? ; pointer to asciz command line 0 00000D18 ???????? Exec0_5C_FCB DD ? ; default fcb at 5C 0 00000D1C ???????? Exec0_6C_FCB DD ? ; default fcb at 6C 21 <3> Exec0 ENDS 22 <3> 23 <3> Exec1 STRUC 0 00000D12 ???? Exec1_environ DW ? ; seg addr of environment 0 00000D14 ???????? Exec1_com_line DD ? ; pointer to asciz command line 0 00000D18 ???????? Exec1_5C_FCB DD ? ; default fcb at 5C 0 00000D1C ???????? Exec1_6C_FCB DD ? ; default fcb at 6C 0 00000D20 ???? Exec1_SP DW ? ; stack pointer of program 0 00000D22 ???? Exec1_SS DW ? ; stack seg register of program 0 00000D24 ???? Exec1_IP DW ? ; entry point IP 0 00000D26 ???? Exec1_CS DW ? ; entry point CS 32 <3> Exec1 ENDS 33 <3> 34 <3> Exec3 STRUC 0 00000D12 ???? Exec3_load_addr DW ? ; seg address of load point 0 00000D14 ???? Exec3_reloc_fac DW ? ; relocation factor 37 <3> Exec3 ENDS 38 <3> 39 <3> ; 40 <3> ; Exit codes in upper byte 41 <3> ; 42 <3> Exit_terminate EQU 0 43 <3> Exit_abort EQU 0 44 <3> Exit_Ctrl_C EQU 1 45 <3> Exit_Hard_Error EQU 2 46 <3> Exit_Keep_process EQU 3 47 <3> 48 <3> ; 49 <3> ; EXE file header 50 <3> ; 51 <3> 52 <3> EXE_file STRUC 0 00000D12 ???? exe_signature DW ? ; must contain 4D5A (yay zibo!) 0 00000D14 ???? exe_len_mod_512 DW ? ; low 9 bits of length 0 00000D16 ???? exe_pages DW ? ; number of 512b pages in file 0 00000D18 ???? exe_rle_count DW ? ; count of reloc entries 0 00000D1A ???? exe_par_dir DW ? ; number of paragraphs before image 0 00000D1C ???? exe_min_BSS DW ? ; minimum number of para of BSS 0 00000D1E ???? exe_max_BSS DW ? ; max number of para of BSS 0 00000D20 ???? exe_SS DW ? ; stack of image 0 00000D22 ???? exe_SP DW ? ; SP of image 0 00000D24 ???? exe_chksum DW ? ; checksum of file (ignored) 0 00000D26 ???? exe_IP DW ? ; IP of entry 0 00000D28 ???? exe_CS DW ? ; CS of entry 0 00000D2A ???? exe_rle_table DW ? ; byte offset of reloc table 0 00000D2C ???? exe_iov DW ? ; overlay number (0 for root) 0 00000D2E ???????? exe_sym_tab DD ? ; offset of symbol table in file 68 <3> EXE_file ENDS 69 <3> 70 <3> exe_valid_signature EQU 5A4Dh 71 <3> exe_valid_old_signature EQU 4D5Ah 72 <3> 73 <3> symbol_entry STRUC 0 00000D12 ???????? sym_value DD ? 0 00000D16 ???? sym_type DW ? 0 00000D18 ?? sym_len DB ? 77 00000007 <3> sym_name DB 255 dup (?) 78 <3> symbol_entry ENDS 156 <2> 157 <2> %include "sf.mac" 1 <3> ; SCCSID = @(#)sf.asm 1.1 85/04/10 2 <3> BREAK 3 <3> ; 4 <3> ; AN000 version 4.00 Jan. 1988 5 <3> ; AN003 PTM 3680 -- make NAME offset the same as before (<=3.30) 6 <3> ; AN009 PTM 3839 reorder SFT for MS WINDOWS 7 <3> 8 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 9 <3> ; C A V E A T P R O G R A M M E R ; 10 <3> ; ; 11 <3> ; 12 <3> ; system file table 13 <3> ; 14 <3> 15 <3> SF STRUC 0 00000D12 ???????? SFLink DD ? 0 00000D16 ???? SFCount DW ? ; number of entries 0 00000D18 ???? SFTable DW ? ; beginning of array of the following 19 <3> SF ENDS 20 <3> 21 <3> ; 22 <3> ; system file table entry 23 <3> ; 24 <3> 25 <3> sf_entry STRUC 0 00000D12 ???? sf_ref_count DW ? ; number of processes sharing entry 27 <3> ; if FCB then ref count 0 00000D14 ???? sf_mode DW ? ; mode of access or high bit on if FCB 0 00000D16 ?? sf_attr DB ? ; attribute of file 0 00000D17 ???? sf_flags DW ? ;Bits 8-15 31 <3> ; Bit 15 = 1 if remote file 32 <3> ; = 0 if local file or device 33 <3> ; Bit 14 = 1 if date/time is not to be 34 <3> ; set from clock at CLOSE. Set by 35 <3> ; FILETIMES and FCB_CLOSE. Reset by 36 <3> ; other reseters of the dirty bit 37 <3> ; (WRITE) 38 <3> ; Bit 13 = Pipe bit (reserved) 39 <3> ; 40 <3> ; Bits 0-7 (old FCB_devid bits) 41 <3> ; If remote file or local file, bit 42 <3> ; 6=0 if dirty Device ID number, bits 43 <3> ; 0-5 if local file. 44 <3> ; bit 7=0 for local file, bit 7 45 <3> ; =1 for local I/O device 46 <3> ; If local I/O device, bit 6=0 if EOF (input) 47 <3> ; Bit 5=1 if Raw mode 48 <3> ; Bit 0=1 if console input device 49 <3> ; Bit 1=1 if console output device 50 <3> ; Bit 2=1 if null device 51 <3> ; Bit 3=1 if clock device 0 00000D19 ???????? sf_devptr DD ? ; Points to DPB if local file, points 53 <3> ; to device header if local device, 54 <3> ; points to net device header if 55 <3> ; remote 0 00000D1D ???? sf_firclus DW ? ; First cluster of file (bit 15 = 0) 0 00000D1F ???? sf_time DW ? ; Time associated with file 0 00000D21 ???? sf_date DW ? ; Date associated with file 0 00000D23 ???????? sf_size DD ? ; Size associated with file 0 00000D27 ???????? sf_position DD ? ; Read/Write pointer or LRU count for FCBs 61 <3> ; 62 <3> ; Starting here, the next 7 bytes may be used by the file system to store an 63 <3> ; ID 64 <3> ; 0 00000D2B ???? sf_cluspos DW ? ; Position of last cluster accessed 0 00000D2D ???????? sf_dirsec DD ? ; Sector number of directory sector for 67 <3> ; for this file 0 00000D31 ?? sf_dirpos DB ? ; Offset of this entry in the above 69 <3> ; 70 <3> ; End of 7 bytes of file-system specific info. 71 <3> ; 72 00000020 <3> sf_name DB 11 DUP (?) ; 11 character name that is in the 73 <3> ; directory entry. This is used by 74 <3> ; close to detect file deleted and 75 <3> ; disk changed errors. 76 <3> 77 <3> ; SHARING INFO 0 00000D3D ???????? sf_chain DD ? ; link to next SF 0 00000D41 ???? sf_UID DW ? 0 00000D43 ???? sf_PID DW ? 0 00000D45 ???? sf_MFT DW ? 0 00000D47 ???? sf_lstclus DW ? ;AN009; Last cluster accessed 0 00000D49 ???????? sf_IFS_HDR DD ? 84 <3> sf_entry ENDS 85 <3> 86 <3> labelsize sf_fsda, byte, sf_cluspos ;DOS 4.00 87 <3> labelsize sf_serial_ID, word, sf_firclus ;DOS 4.00 88 <3> labelsize sf_netid, byte, sf_cluspos 89 <3> labelsize sf_OpenAge, word, sf_position+2 90 <3> labelsize sf_LRU, word, sf_position 91 <3> 92 <3> sf_default_number EQU 5h 93 <3> 94 <3> ; 95 <3> ; Note that we need to mark an SFT as being busy for OPEN/CREATE. This is 96 <3> ; because an INT 24 may prevent us from 'freeing' it. We mark this as such 97 <3> ; by placing a -1 in the ref_count field. 98 <3> ; 99 <3> 100 <3> sf_busy EQU -1 101 <3> 102 <3> 103 <3> ; mode mask for FCB detection 104 <3> sf_isfcb EQU 1000000000000000B 105 <3> 106 <3> ; Flag word masks 107 <3> sf_isnet EQU 1000000000000000B 108 <3> sf_close_nodate EQU 0100000000000000B 109 <3> sf_pipe EQU 0010000000000000B 110 <3> sf_no_inherit EQU 0001000000000000B 111 <3> sf_net_spool EQU 0000100000000000B 112 <3> Handle_Fail_I24 EQU 0000000100000000B ;BIT 8 - DISK FULL I24 ERROR 113 <3> 114 <3> ; Local file/device flag masks 115 <3> devid_file_clean EQU 40h ; true if file and not written 116 <3> devid_file_mask_drive EQU 3Fh ; mask for drive number 117 <3> 118 <3> devid_device EQU 80h ; true if a device 119 <3> devid_device_EOF EQU 40h ; true if end of file reached 120 <3> devid_device_raw EQU 20h ; true if in raw mode 121 <3> devid_device_special EQU 10h ; true if special device 122 <3> devid_device_clock EQU 08h ; true if clock device 123 <3> devid_device_null EQU 04h ; true if null device 124 <3> devid_device_con_out EQU 02h ; true if console output 125 <3> devid_device_con_in EQU 01h ; true if consle input 126 <3> ; ; 127 <3> ; C A V E A T P R O G R A M M E R ; 128 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 129 <3> 130 <3> ; 131 <3> ; structure of devid field as returned by IOCTL is: 132 <3> ; 133 <3> ; BIT 7 6 5 4 3 2 1 0 134 <3> ; |---|---|---|---|---|---|---|---| 135 <3> ; | I | E | R | S | I | I | I | I | 136 <3> ; | S | O | A | P | S | S | S | S | 137 <3> ; | D | F | W | E | C | N | C | C | 138 <3> ; | E | | | C | L | U | O | I | 139 <3> ; | V | | | L | K | L | T | N | 140 <3> ; |---|---|---|---|---|---|---|---| 141 <3> ; ISDEV = 1 if this channel is a device 142 <3> ; = 0 if this channel is a disk file 143 <3> ; 144 <3> ; If ISDEV = 1 145 <3> ; 146 <3> ; EOF = 0 if End Of File on input 147 <3> ; RAW = 1 if this device is in Raw mode 148 <3> ; = 0 if this device is cooked 149 <3> ; ISCLK = 1 if this device is the clock device 150 <3> ; ISNUL = 1 if this device is the null device 151 <3> ; ISCOT = 1 if this device is the console output 152 <3> ; ISCIN = 1 if this device is the console input 153 <3> ; 154 <3> ; If ISDEV = 0 155 <3> ; EOF = 0 if channel has been written 156 <3> ; Bits 0-5 are the block device number for 157 <3> ; the channel (0 = A, 1 = B, ...) 158 <3> ; 159 <3> devid_ISDEV EQU 80h 160 <3> devid_EOF EQU 40h 161 <3> devid_RAW EQU 20h 162 <3> devid_SPECIAL EQU 10H 163 <3> devid_ISCLK EQU 08h 164 <3> devid_ISNUL EQU 04h 165 <3> devid_ISCOT EQU 02h 166 <3> devid_ISCIN EQU 01h 167 <3> 168 <3> devid_block_dev EQU 1Fh ; mask for block device number 158 <2> 159 <2> %include "arena.mac" 1 <3> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <3> ;BREAK 3 <3> 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; 8 <3> ; arena item 9 <3> ; 10 <3> arena STRUC 0 00000D12 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00000D13 ???? arena_owner DW ? ; owner of arena item 0 00000D15 ???? arena_size DW ? ; size in paragraphs of item 0 00000D17 ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00000D1A ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <3> arena ENDS 17 <3> 18 <3> ; 19 <3> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <3> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <3> ; them and change ALLOC.ASM. 22 <3> 23 <3> arena_owner_system EQU 0 ; free block indication 24 <3> 25 <3> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <3> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <3> ; ; 28 <3> ; C A V E A T P R O G R A M M E R ; 29 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <3> 160 <2> 161 <2> %include "intnat.mac" 1 <3> ; SCCSID = @(#)intnat.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ; 5 <3> ; Current structure of the data returned by the international call 6 <3> ; 7 <3> internat_block STRUC 0 00000D12 ???? Date_tim_format DW ? ; 0-USA, 1-EUR, 2-JAP 0 00000D14 ?? Currency_sym DB ? ; Currency Symbol 5 bytes 0 00000D15 ?? DB ? 0 00000D16 ?? DB ? 0 00000D17 ?? DB ? 0 00000D18 ?? DB ? 0 00000D19 ?? Thous_sep DB ? ; Thousands separator 2 bytes 0 00000D1A ?? DB ? 0 00000D1B ?? Decimal_sep DB ? ; Decimal separator 2 bytes 0 00000D1C ?? DB ? 0 00000D1D ?? Date_sep DB ? ; Date separator 2 bytes 0 00000D1E ?? DB ? 0 00000D1F ?? Time_sep DB ? ; Decimal separator 2 bytes 0 00000D20 ?? DB ? 0 00000D21 ?? Bit_field DB ? ; Bit values 23 <3> ; Bit 0 = 0 if currency symbol first 24 <3> ; = 1 if currency symbol last 25 <3> ; Bit 1 = 0 if No space after currency symbol 26 <3> ; = 1 if space after currency symbol 0 00000D22 ?? Currency_cents DB ? ; Number of places after currency dec point 0 00000D23 ?? Time_24 DB ? ; 1 if 24 hour time, 0 if 12 hour time 0 00000D24 ???? Map_call DW ? ; Address of case mapping call (DWORD) 0 00000D26 ???? DW ? ; THIS IS TWO WORDS SO IT CAN BE INITIALIZED 31 <3> ; in pieces. 0 00000D28 ?? Data_sep DB ? ; Data list separator character 0 00000D29 ?? DB ? 34 <3> internat_block ENDS 35 <3> 36 <3> ; 37 <3> ; Max size of the block returned by the INTERNATIONAL call 38 <3> ; 39 <3> internat_block_max EQU 32 162 <2> 163 <2> %include "mi.mac" 1 <3> ; SCCSID = @(#)mi.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> mi_INT EQU 0CDh 5 <3> mi_Long_JMP EQU 0EAh 6 <3> mi_Long_CALL EQU 09Ah 7 <3> mi_Long_RET EQU 0CBh 8 <3> mi_Near_RET EQU 0C3h 9 <3> 10 <3> ; xxxxoditszxaxpxc 11 <3> f_Overflow EQU 0000100000000000B 12 <3> f_Direction EQU 0000010000000000B 13 <3> f_Interrupt EQU 0000001000000000B 14 <3> f_Trace EQU 0000000100000000B 15 <3> f_Sign EQU 0000000010000000B 16 <3> f_Zero EQU 0000000001000000B 17 <3> f_Aux EQU 0000000000010000B 18 <3> f_Parity EQU 0000000000000100B 19 <3> f_Carry EQU 0000000000000001B 164 <2> 165 <2> fChk equ 1 166 <2> fDelim equ 2 167 <2> fSpChk equ 4 168 <2> fFCB equ 8 169 <2> 170 <2> %include "filemode.mac" 1 <3> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 3 <3> BREAK 4 <3> 5 <3> stdin EQU 0 6 <3> stdout EQU 1 7 <3> stderr EQU 2 8 <3> stdaux EQU 3 9 <3> stdprn EQU 4 10 <3> 11 <3> BREAK 12 <3> 13 <3> access_mask EQU 0FH 14 <3> open_for_read EQU 00h 15 <3> open_for_write EQU 01h 16 <3> open_for_both EQU 02h 17 <3> 18 <3> sharing_mask EQU 0F0H 19 <3> sharing_compat EQU 000H 20 <3> sharing_deny_both EQU 010H 21 <3> sharing_deny_write EQU 020H 22 <3> sharing_deny_read EQU 030H 23 <3> sharing_deny_none EQU 040H 24 <3> sharing_net_FCB EQU 070h 25 <3> sharing_no_inherit EQU 080H 26 <3> 27 <3> BREAK 28 <3> 29 <3> no_code_page_check EQU 0100H 30 <3> int_24_error EQU 2000H 31 <3> auto_commit_write EQU 4000H 32 <3> ext_open_on EQU 01H 33 <3> ext_file_not_exists EQU 04H 34 <3> ext_open_I24_off EQU 02H 35 <3> io_mode_id EQU 00000010B 36 <3> reserved_bits_mask EQU 0FE00H 37 <3> exists_mask EQU 0FH 38 <3> not_exists_mask EQU 0F0H 39 <3> action_opened EQU 01H 40 <3> action_created_opened EQU 02H 41 <3> action_replaced_opened EQU 03H 42 <3> 43 <3> ext_exists_open EQU 01H 44 <3> ext_exists_fail EQU 0H 45 <3> ext_nexists_create EQU 10H 46 <3> 47 <3> 48 <3> 49 <3> ext_open_parm struc 0 00000D12 ???????? ext_set_list dd ? 0 00000D16 ???? ext_num_of_parm dw ? 52 <3> ext_open_parm ends 53 <3> 54 <3> 55 <3> 171 <2> 172 <2> %include "error.mac" 1 <3> ; SCCSID = @(#)error.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)error.asm 1.1 85/04/10 3 <3> BREAK 4 <3> 5 <3> ; 6 <3> ; XENIX calls all return error codes through AX. If an error occurred then 7 <3> ; the carry bit will be set and the error code is in AX. If no error occurred 8 <3> ; then the carry bit is reset and AX contains returned info. 9 <3> ; 10 <3> ; Since the set of error codes is being extended as we extend the operating 11 <3> ; system, we have provided a means for applications to ask the system for a 12 <3> ; recommended course of action when they receive an error. 13 <3> ; 14 <3> ; The GetExtendedError system call returns a universal error, an error 15 <3> ; location and a recommended course of action. The universal error code is 16 <3> ; a symptom of the error REGARDLESS of the context in which GetExtendedError 17 <3> ; is issued. 18 <3> ; 19 <3> 20 <3> ; 21 <3> ; These are the 2.0 error codes 22 <3> ; 23 <3> error_invalid_function EQU 1 24 <3> error_file_not_found EQU 2 25 <3> error_path_not_found EQU 3 26 <3> error_too_many_open_files EQU 4 27 <3> error_access_denied EQU 5 28 <3> error_invalid_handle EQU 6 29 <3> error_arena_trashed EQU 7 30 <3> error_not_enough_memory EQU 8 31 <3> error_invalid_block EQU 9 32 <3> error_bad_environment EQU 10 33 <3> error_bad_format EQU 11 34 <3> error_invalid_access EQU 12 35 <3> error_invalid_data EQU 13 36 <3> ;**** reserved EQU 14 ; ***** 37 <3> error_invalid_drive EQU 15 38 <3> error_current_directory EQU 16 39 <3> error_not_same_device EQU 17 40 <3> error_no_more_files EQU 18 41 <3> ; 42 <3> ; These are the universal int 24 mappings for the old INT 24 set of errors 43 <3> ; 44 <3> error_write_protect EQU 19 45 <3> error_bad_unit EQU 20 46 <3> error_not_ready EQU 21 47 <3> error_bad_command EQU 22 48 <3> error_CRC EQU 23 49 <3> error_bad_length EQU 24 50 <3> error_Seek EQU 25 51 <3> error_not_DOS_disk EQU 26 52 <3> error_sector_not_found EQU 27 53 <3> error_out_of_paper EQU 28 54 <3> error_write_fault EQU 29 55 <3> error_read_fault EQU 30 56 <3> error_gen_failure EQU 31 57 <3> ; 58 <3> ; These are the new 3.0 error codes reported through INT 24 59 <3> ; 60 <3> error_sharing_violation EQU 32 61 <3> error_lock_violation EQU 33 62 <3> error_wrong_disk EQU 34 63 <3> error_FCB_unavailable EQU 35 64 <3> error_sharing_buffer_exceeded EQU 36 65 <3> error_Code_Page_Mismatched EQU 37 ; DOS 4.00 ;AN000; 66 <3> error_handle_EOF EQU 38 ; DOS 4.00 ;AN000; 67 <3> error_handle_Disk_Full EQU 39 ; DOS 4.00 ;AN000; 68 <3> ; 69 <3> ; New OEM network-related errors are 50-79 70 <3> ; 71 <3> error_not_supported EQU 50 72 <3> ; 73 <3> ; End of INT 24 reportable errors 74 <3> ; 75 <3> error_file_exists EQU 80 76 <3> error_DUP_FCB EQU 81 ; ***** 77 <3> error_cannot_make EQU 82 78 <3> error_FAIL_I24 EQU 83 79 <3> ; 80 <3> ; New 3.0 network related error codes 81 <3> ; 82 <3> error_out_of_structures EQU 84 83 <3> error_Already_assigned EQU 85 84 <3> error_invalid_password EQU 86 85 <3> error_invalid_parameter EQU 87 86 <3> error_NET_write_fault EQU 88 87 <3> error_sys_comp_not_loaded EQU 90 ; DOS 4.00 ;AN000; 88 <3> 89 <3> BREAK 90 <3> 91 <3> error_I24_write_protect EQU 0 92 <3> error_I24_bad_unit EQU 1 93 <3> error_I24_not_ready EQU 2 94 <3> error_I24_bad_command EQU 3 95 <3> error_I24_CRC EQU 4 96 <3> error_I24_bad_length EQU 5 97 <3> error_I24_Seek EQU 6 98 <3> error_I24_not_DOS_disk EQU 7 99 <3> error_I24_sector_not_found EQU 8 100 <3> error_I24_out_of_paper EQU 9 101 <3> error_I24_write_fault EQU 0Ah 102 <3> error_I24_read_fault EQU 0Bh 103 <3> error_I24_gen_failure EQU 0Ch 104 <3> ; NOTE: Code 0DH is used by MT-DOS. 105 <3> error_I24_wrong_disk EQU 0Fh 106 <3> 107 <3> ; THE FOLLOWING ARE MASKS FOR THE AH REGISTER ON Int 24 108 <3> 109 <3> Allowed_FAIL EQU 00001000B 110 <3> Allowed_RETRY EQU 00010000B 111 <3> Allowed_IGNORE EQU 00100000B 112 <3> ;NOTE: ABORT is ALWAYS allowed 113 <3> 114 <3> I24_operation EQU 00000001B ;Z if READ,NZ if Write 115 <3> I24_area EQU 00000110B ; 00 if DOS 116 <3> ; 01 if FAT 117 <3> ; 10 if root DIR 118 <3> ; 11 if DATA 119 <3> I24_class EQU 10000000B ;Z if DISK, NZ if FAT or char 120 <3> 121 <3> BREAK 122 <3> 123 <3> ; Values for error CLASS 124 <3> 125 <3> errCLASS_OutRes EQU 1 ; Out of Resource 126 <3> errCLASS_TempSit EQU 2 ; Temporary Situation 127 <3> errCLASS_Auth EQU 3 ; Permission problem 128 <3> errCLASS_Intrn EQU 4 ; Internal System Error 129 <3> errCLASS_HrdFail EQU 5 ; Hardware Failure 130 <3> errCLASS_SysFail EQU 6 ; System Failure 131 <3> errCLASS_Apperr EQU 7 ; Application Error 132 <3> errCLASS_NotFnd EQU 8 ; Not Found 133 <3> errCLASS_BadFmt EQU 9 ; Bad Format 134 <3> errCLASS_Locked EQU 10 ; Locked 135 <3> errCLASS_Media EQU 11 ; Media Failure 136 <3> errCLASS_Already EQU 12 ; Collision with Existing Item 137 <3> errCLASS_Unk EQU 13 ; Unknown/other 138 <3> 139 <3> ; Values for error ACTION 140 <3> 141 <3> errACT_Retry EQU 1 ; Retry 142 <3> errACT_DlyRet EQU 2 ; Delay Retry, retry after pause 143 <3> errACT_User EQU 3 ; Ask user to regive info 144 <3> errACT_Abort EQU 4 ; abort with clean up 145 <3> errACT_Panic EQU 5 ; abort immediately 146 <3> errACT_Ignore EQU 6 ; ignore 147 <3> errACT_IntRet EQU 7 ; Retry after User Intervention 148 <3> 149 <3> ; Values for error LOCUS 150 <3> 151 <3> errLOC_Unk EQU 1 ; No appropriate value 152 <3> errLOC_Disk EQU 2 ; Random Access Mass Storage 153 <3> errLOC_Net EQU 3 ; Network 154 <3> errLOC_SerDev EQU 4 ; Serial Device 155 <3> errLOC_Mem EQU 5 ; Memory 173 <2> 174 <2> %include "syscall.mac" 1 <3> ; SCCSID = @(#)syscall.asm 1.1 85/04/10 2 <3> ;BREAK 3 <3> ;SUBTTL system call definitions 4 <3> ;PAGE 5 <3> 6 <3> Abort EQU 0 ; 0 0 7 <3> Std_Con_Input EQU 1 ; 1 1 8 <3> Std_Con_Output EQU 2 ; 2 2 9 <3> Std_Aux_Input EQU 3 ; 3 3 10 <3> Std_Aux_Output EQU 4 ; 4 4 11 <3> Std_Printer_Output EQU 5 ; 5 5 12 <3> Raw_Con_IO EQU 6 ; 6 6 13 <3> Raw_Con_Input EQU 7 ; 7 7 14 <3> Std_Con_Input_No_Echo EQU 8 ; 8 8 15 <3> Std_Con_String_Output EQU 9 ; 9 9 16 <3> Std_Con_String_Input EQU 10 ; 10 A 17 <3> Std_Con_Input_Status EQU 11 ; 11 B 18 <3> Std_Con_Input_Flush EQU 12 ; 12 C 19 <3> Disk_Reset EQU 13 ; 13 D 20 <3> Set_Default_Drive EQU 14 ; 14 E 21 <3> FCB_Open EQU 15 ; 15 F 22 <3> FCB_Close EQU 16 ; 16 10 23 <3> Dir_Search_First EQU 17 ; 17 11 24 <3> Dir_Search_Next EQU 18 ; 18 12 25 <3> FCB_Delete EQU 19 ; 19 13 26 <3> FCB_Seq_Read EQU 20 ; 20 14 27 <3> FCB_Seq_Write EQU 21 ; 21 15 28 <3> FCB_Create EQU 22 ; 22 16 29 <3> FCB_Rename EQU 23 ; 23 17 30 <3> Get_Default_Drive EQU 25 ; 25 19 31 <3> Set_DMA EQU 26 ; 26 1A 32 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ; ; 35 <3> Get_Default_DPB EQU 31 ; 31 1F 36 <3> ; ; 37 <3> ; C A V E A T P R O G R A M M E R ; 38 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 39 <3> FCB_Random_Read EQU 33 ; 33 21 40 <3> FCB_Random_Write EQU 34 ; 34 22 41 <3> Get_FCB_File_Length EQU 35 ; 35 23 42 <3> Get_FCB_Position EQU 36 ; 36 24 43 <3> Set_Interrupt_Vector EQU 37 ; 37 25 44 <3> Create_Process_Data_Block EQU 38 ; 38 26 45 <3> FCB_Random_Read_Block EQU 39 ; 39 27 46 <3> FCB_Random_Write_Block EQU 40 ; 40 28 47 <3> Parse_File_Descriptor EQU 41 ; 41 29 48 <3> Get_Date EQU 42 ; 42 2A 49 <3> Set_Date EQU 43 ; 43 2B 50 <3> Get_Time EQU 44 ; 44 2C 51 <3> Set_Time EQU 45 ; 45 2D 52 <3> Set_Verify_On_Write EQU 46 ; 46 2E 53 <3> ; Extended functionality group 54 <3> Get_DMA EQU 47 ; 47 2F 55 <3> Get_Version EQU 48 ; 48 30 56 <3> Keep_Process EQU 49 ; 49 31 57 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <3> ; C A V E A T P R O G R A M M E R ; 59 <3> ; ; 60 <3> Get_DPB EQU 50 ; 50 32 61 <3> ; ; 62 <3> ; C A V E A T P R O G R A M M E R ; 63 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 64 <3> Set_CTRL_C_Trapping EQU 51 ; 51 33 65 <3> Get_InDOS_Flag EQU 52 ; 52 34 66 <3> Get_Interrupt_Vector EQU 53 ; 53 35 67 <3> Get_Drive_Freespace EQU 54 ; 54 36 68 <3> Char_Oper EQU 55 ; 55 37 69 <3> International EQU 56 ; 56 38 70 <3> ; Directory Group 71 <3> MKDir EQU 57 ; 57 39 72 <3> RMDir EQU 58 ; 58 3A 73 <3> CHDir EQU 59 ; 59 3B 74 <3> ; File Group 75 <3> Creat EQU 60 ; 60 3C 76 <3> Open EQU 61 ; 61 3D 77 <3> Close EQU 62 ; 62 3E 78 <3> Read EQU 63 ; 63 3F 79 <3> Write EQU 64 ; 64 40 80 <3> Unlink EQU 65 ; 65 41 81 <3> LSeek EQU 66 ; 66 42 82 <3> CHMod EQU 67 ; 67 43 83 <3> IOCtl EQU 68 ; 68 44 84 <3> XDup EQU 69 ; 69 45 85 <3> XDup2 EQU 70 ; 70 46 86 <3> Current_Dir EQU 71 ; 71 47 87 <3> ; Memory Group 88 <3> Alloc EQU 72 ; 72 48 89 <3> Dealloc EQU 73 ; 73 49 90 <3> Setblock EQU 74 ; 74 4A 91 <3> ; Process Group 92 <3> Exec EQU 75 ; 75 4B 93 <3> Exit EQU 76 ; 76 4C 94 <3> WaitProcess EQU 77 ; 77 4D 95 <3> Find_First EQU 78 ; 78 4E 96 <3> ; Special Group 97 <3> Find_Next EQU 79 ; 79 4F 98 <3> ; SPECIAL SYSTEM GROUP 99 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 100 <3> ; C A V E A T P R O G R A M M E R ; 101 <3> ; ; 102 <3> Set_Current_PDB EQU 80 ; 80 50 103 <3> Get_Current_PDB EQU 81 ; 81 51 104 <3> Get_In_Vars EQU 82 ; 82 52 105 <3> SetDPB EQU 83 ; 83 53 106 <3> ; ; 107 <3> ; C A V E A T P R O G R A M M E R ; 108 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 109 <3> Get_Verify_On_Write EQU 84 ; 84 54 110 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 111 <3> ; C A V E A T P R O G R A M M E R ; 112 <3> ; ; 113 <3> Dup_PDB EQU 85 ; 85 55 114 <3> ; ; 115 <3> ; C A V E A T P R O G R A M M E R ; 116 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 117 <3> Rename EQU 86 ; 86 56 118 <3> File_Times EQU 87 ; 87 57 119 <3> AllocOper EQU 88 ; 88 58 120 <3> ; Network extention system calls 121 <3> GetExtendedError EQU 89 ; 89 59 122 <3> CreateTempFile EQU 90 ; 90 5A 123 <3> CreateNewFile EQU 91 ; 91 5B 124 <3> LockOper EQU 92 ; 92 5C Lock and Unlock 125 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 126 <3> ; C A V E A T P R O G R A M M E R ; 127 <3> ; ; 128 <3> ServerCall EQU 93 ; 93 5D CommitAll, ServerDOSCall, 129 <3> ; CloseByName, CloseUser, 130 <3> ; CloseUserProcess, 131 <3> ; GetOpenFileList 132 <3> ; ; 133 <3> ; C A V E A T P R O G R A M M E R ; 134 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 135 <3> UserOper EQU 94 ; 94 5E Get and Set 136 <3> AssignOper EQU 95 ; 95 5F On, Off, Get, Set, Cancel 137 <3> xNameTrans EQU 96 ; 96 60 138 <3> PathParse EQU 97 ; 97 61 139 <3> GetCurrentPSP EQU 98 ; 98 62 140 <3> Hongeul EQU 99 ; 99 63 141 <3> ECS_CALL EQU 99 ; 99 63 ;; DBCS support 142 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 143 <3> ; C A V E A T P R O G R A M M E R ; 144 <3> ; ; 145 <3> Set_Printer_Flag EQU 100 ; 100 64 146 <3> ; ; 147 <3> ; C A V E A T P R O G R A M M E R ; 148 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 149 <3> GetExtCntry EQU 101 ; 101 65 150 <3> GetSetCdPg EQU 102 ; 102 66 151 <3> ExtHandle EQU 103 ; 103 67 152 <3> Commit EQU 104 ; 104 68 153 <3> GetSetMediaID EQU 105 ; 105 69 154 <3> IFS_IOCTL EQU 107 ; 107 6B 155 <3> ExtOpen EQU 108 ; 108 6C 156 <3> ; 157 <3> ; 158 <3> Set_Oem_Handler EQU 248 ; 248 F8 159 <3> OEM_C1 EQU 249 ; 249 F9 160 <3> OEM_C2 EQU 250 ; 250 FA 161 <3> OEM_C3 EQU 251 ; 251 FB 162 <3> OEM_C4 EQU 252 ; 252 FC 163 <3> OEM_C5 EQU 253 ; 253 FD 164 <3> OEM_C6 EQU 254 ; 254 FE 165 <3> OEM_C7 EQU 255 ; 255 FF 175 <2> 176 <2> ;SUBTTL 177 <2> 13 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 14 <1> ;.cref 15 <1> [list +] 16 <1> 17 <1> %ifndef Kanji 18 <1> %iassign Kanji 0 19 <1> %endif 20 <1> %ifndef Debug 21 <1> %iassign Debug 0 22 <1> %endif 23 <1> %ifndef Redirector 24 <1> %iassign Redirector 0 25 <1> %endif 26 <1> %ifndef ShareF 27 <1> %iassign ShareF 0 28 <1> %endif 29 <1> === Switch to base=000E10h -> "TABLE" 30 <1> section TABLE ; in DOSDATA 31 <1> 32 <1> PUBLIC MSVERS 33 <1> MSTAB001s equ MSTAB001S ; NASM port label 34 <1> MSTAB001e equ MSTAB001E ; NASM port label 35 <1> PUBLIC MSTAB001s,MSTAB001e 36 <1> MSTAB001S label byte 37 <1> 38 <1> MSVERS: ; lDOS version in hex for $GET_VERSION 0 00000D12 05 MSMAJOR DB new_major_version 0 00000D13 26 MSMINOR DB new_minor_version 41 <1> 42 <1> align 2, db 0 0 00000D14 C8A6C8A5C8A5C8A5 I_am YRTAB,8,<200,166,200,165,200,165,200,165> ; [SYSTEM] 0 00000D1C 1F1C1F1E1F1E1F1F1E I_am MONTAB,12,<31,28,31,30,31,30,31,31,30,31,30,31> ; [SYSTEM] 0 00000D25 1F1E1F 45 <1> 46 <1> === Switch to base=002450h -> "DOSCODETABLE" 47 <1> section DOSCODETABLE 48 <1> 49 <1> ; 50 <1> ; This is the error code mapping table for INT 21 errors. This table defines 51 <1> ; those error codes which are "allowed" for each system call. If the error 52 <1> ; code ABOUT to be returned is not "allowed" for the call, the correct action 53 <1> ; is to return the "real" error via Extended error, and one of the allowed 54 <1> ; errors on the actual call. 55 <1> ; 56 <1> ; The table is organized as follows: 57 <1> ; 58 <1> ; Each entry in the table is of variable size, but the first 59 <1> ; two bytes are always: 60 <1> ; 61 <1> ; Call#,Cnt of bytes following this byte 62 <1> ; 63 <1> ; EXAMPLE: 64 <1> ; Call 61 (OPEN) 65 <1> ; 66 <1> ; DB 61,5,12,3,2,4,5 67 <1> ; 68 <1> ; 61 is the AH INT 21 call value for OPEN. 69 <1> ; 5 indicates that there are 5 bytes after this byte (12,3,2,4,5). 70 <1> ; Next five bytes are those error codes which are "allowed" on OPEN. 71 <1> ; The order of these values is not important EXCEPT FOR THE LAST ONE (in 72 <1> ; this case 5). The last value will be the one returned on the call if 73 <1> ; the "real" error is not one of the allowed ones. 74 <1> ; 75 <1> ; There are a number of calls (for instance all of the FCB calls) for which 76 <1> ; there is NO entry. This means that NO error codes are returned on this 77 <1> ; call, so set up an Extended error and leave the current error code alone. 78 <1> ; 79 <1> ; The table is terminated by a call value of 0FFh 80 <1> 81 <1> PUBLIC I21_MAP_E_TAB 82 <1> I21_MAP_E_TAB LABEL BYTE 0 0000027C 38020102 DB International,2,error_invalid_function,error_file_not_found 0 00000280 3903030205 DB MKDir,3,error_path_not_found,error_file_not_found,error_access_denied 0 00000285 3A041003 DB RMDir,4,error_current_directory,error_path_not_found 0 00000289 0205 DB error_file_not_found,error_access_denied 0 0000028B 3B020203 DB CHDir,2,error_file_not_found,error_path_not_found 0 0000028F 3C040302 DB Creat,4,error_path_not_found,error_file_not_found 0 00000293 04 DB error_too_many_open_files 0 00000294 05 DB error_access_denied 0 00000295 3D0603020C DB Open,6,error_path_not_found,error_file_not_found,error_invalid_access 0 0000029A 04 DB error_too_many_open_files 93 <1> error_not_dos_disk equ error_not_DOS_disk ; NASM port equate 0 0000029B 1A05 DB error_not_dos_disk,error_access_denied 0 0000029D 3E0106 DB Close,1,error_invalid_handle 0 000002A0 3F020605 DB Read,2,error_invalid_handle,error_access_denied 0 000002A4 40020605 DB Write,2,error_invalid_handle,error_access_denied 0 000002A8 4103030205 DB Unlink,3,error_path_not_found,error_file_not_found,error_access_denied 0 000002AD 42020601 DB LSeek,2,error_invalid_handle,error_invalid_function 0 000002B1 4304030201 DB CHMod,4,error_path_not_found,error_file_not_found,error_invalid_function 0 000002B6 05 DB error_access_denied 0 000002B7 44050F0D01 DB IOCtl,5,error_invalid_drive,error_invalid_data,error_invalid_function 0 000002BC 0605 DB error_invalid_handle,error_access_denied 0 000002BE 45020604 DB XDup,2,error_invalid_handle,error_too_many_open_files 0 000002C2 46020604 DB XDup2,2,error_invalid_handle,error_too_many_open_files 0 000002C6 47021A0F DB Current_Dir,2,error_not_DOS_disk,error_invalid_drive 0 000002CA 48020708 DB Alloc,2,error_arena_trashed,error_not_enough_memory 0 000002CE 49020709 DB Dealloc,2,error_arena_trashed,error_invalid_block 0 000002D2 4A03070908 DB Setblock,3,error_arena_trashed,error_invalid_block,error_not_enough_memory 0 000002D7 4B08030102 DB Exec,8,error_path_not_found,error_invalid_function,error_file_not_found 0 000002DC 040B0A DB error_too_many_open_files,error_bad_format,error_bad_environment 0 000002DF 0805 DB error_not_enough_memory,error_access_denied 0 000002E1 4E03030212 DB Find_First,3,error_path_not_found,error_file_not_found,error_no_more_files 0 000002E6 4F0112 DB Find_Next,1,error_no_more_files 0 000002E9 5605110302 DB Rename,5,error_not_same_device,error_path_not_found,error_file_not_found 0 000002EE 1005 DB error_current_directory,error_access_denied 0 000002F0 57040608 DB File_Times,4,error_invalid_handle,error_not_enough_memory 0 000002F4 0D01 DB error_invalid_data,error_invalid_function 0 000002F6 58020107 DB AllocOper,2,error_invalid_function, 7 0 000002FA 5A040302 DB CreateTempFile,4,error_path_not_found,error_file_not_found 0 000002FE 0405 DB error_too_many_open_files,error_access_denied 0 00000300 5B055003 DB CreateNewFile,5,error_file_exists,error_path_not_found 0 00000304 020405 DB error_file_not_found,error_too_many_open_files,error_access_denied 0 00000307 5C040601 DB LockOper,4,error_invalid_handle,error_invalid_function 0 0000030B 2421 DB error_sharing_buffer_exceeded,error_lock_violation 0 0000030D 65020102 DB GetExtCntry,2,error_invalid_function,error_file_not_found ;DOS 3.3 0 00000311 66020102 DB GetSetCdPg,2,error_invalid_function,error_file_not_found ;DOS 3.3 0 00000315 680106 DB Commit,1,error_invalid_handle ;DOS 3.3 0 00000318 67030408 DB ExtHandle,3,error_too_many_open_files,error_not_enough_memory 0 0000031C 01 DB error_invalid_function 0 0000031D 6C0A DB ExtOpen,10 0 0000031F 03020C DB error_path_not_found,error_file_not_found,error_invalid_access 0 00000322 045008 DB error_too_many_open_files,error_file_exists,error_not_enough_memory 0 00000325 1A0D DB error_not_dos_disk,error_invalid_data 0 00000327 0105 DB error_invalid_function,error_access_denied 0 00000329 69040F0D DB GetSetMediaID,4,error_invalid_drive,error_invalid_data 0 0000032D 0105 DB error_invalid_function,error_access_denied 0 0000032F FF DB 0FFh 139 <1> 140 <1> ; 141 <1> ; The following table defines CLASS ACTION and LOCUS info for the INT 21H 142 <1> ; errors. Each entry is 4 bytes long: 143 <1> ; 144 <1> ; Err#,Class,Action,Locus 145 <1> ; 146 <1> ; A value of 0FFh indicates a call specific value (ie. should already 147 <1> ; be set). AN ERROR CODE NOT IN THE TABLE FALLS THROUGH TO THE CATCH ALL AT 148 <1> ; THE END, IT IS ASSUMES THAT CLASS, ACTION, LOCUS IS ALREADY SET. 149 <1> 150 <1> ;ErrTab Macro err,class,action,locus 151 <1> %imacro ErrTab 4.nolist 152 <1> %ifidni %4, 0FFh 153 <1> DB error_%1,errCLASS_%2,errACT_%3,0FFh 154 <1> %else 155 <1> DB error_%1,errCLASS_%2,errACT_%3,errLOC_%4 156 <1> %endif 157 <1> %endmacro 158 <1> === Switch to base=000E10h -> "TABLE" 159 <1> section TABLE ; in DOSDATA 160 <1> 161 <1> error_Not_supported equ error_not_supported ; NASM port equate 162 <1> quuux equ error_Not_supported 163 <1> error_Invalid_Parameter equ error_invalid_parameter ; NASM port equate 164 <1> qbar equ error_Invalid_Parameter 165 <1> error_Sharing_buffer_exceeded equ error_sharing_buffer_exceeded ; NASM port equate 166 <1> qbaz equ error_Sharing_buffer_exceeded 167 <1> error_Handle_EOF equ error_handle_EOF ; NASM port equate 168 <1> qux equ error_Handle_EOF 169 <1> error_Handle_DISK_FULL equ error_handle_Disk_Full ; NASM port equate 170 <1> qxyzzy equ error_Handle_DISK_FULL 171 <1> quux equ error_Sharing_buffer_exceeded 172 <1> 173 <1> align 2, db 0 174 <1> PUBLIC ERR_TABLE_21 175 <1> ERR_TABLE_21 LABEL BYTE 0 00000D28 010704FF ErrTab invalid_function, Apperr, Abort, 0FFh 0 00000D2C 02080302 ErrTab file_not_found, NotFnd, User, Disk 0 00000D30 03080302 ErrTab path_not_found, NotFnd, User, Disk 0 00000D34 04010401 ErrTab too_many_open_files, OutRes, Abort, Unk 0 00000D38 050303FF ErrTab access_denied, Auth, User, 0FFh 0 00000D3C 06070401 ErrTab invalid_handle, Apperr, Abort, Unk 0 00000D40 07070505 ErrTab arena_trashed, Apperr, Panic, Mem 0 00000D44 08010405 ErrTab not_enough_memory, OutRes, Abort, Mem 0 00000D48 09070405 ErrTab invalid_block, Apperr, Abort, Mem 0 00000D4C 0A070405 ErrTab bad_environment, Apperr, Abort, Mem 0 00000D50 0B090301 ErrTab bad_format, BadFmt, User, Unk 0 00000D54 0C070401 ErrTab invalid_access, Apperr, Abort, Unk 0 00000D58 0D090401 ErrTab invalid_data, BadFmt, Abort, Unk 0 00000D5C 0F080302 ErrTab invalid_drive, NotFnd, User, Disk 0 00000D60 10030302 ErrTab current_directory, Auth, User, Disk 0 00000D64 110D0302 ErrTab not_same_device, Unk, User, Disk 0 00000D68 12080302 ErrTab no_more_files, NotFnd, User, Disk 0 00000D6C 500C0302 ErrTab file_exists, Already, User, Disk 0 00000D70 200A0202 ErrTab sharing_violation, Locked, DlyRet, Disk 0 00000D74 210A0202 ErrTab lock_violation, Locked, DlyRet, Disk 0 00000D78 540104FF ErrTab out_of_structures, OutRes, Abort, 0FFh 0 00000D7C 56030301 ErrTab invalid_password, Auth, User, Unk 0 00000D80 52010402 ErrTab cannot_make, OutRes, Abort, Disk 0 00000D84 32090303 ErrTab Not_supported, BadFmt, User, Net 0 00000D88 550C0303 ErrTab Already_assigned, Already, User, Net 0 00000D8C 57090301 ErrTab Invalid_Parameter, BadFmt, User, Unk 0 00000D90 530D0401 ErrTab FAIL_I24, Unk, Abort, Unk 0 00000D94 24010405 ErrTab Sharing_buffer_exceeded,OutRes, Abort, Mem 0 00000D98 26010401 ErrTab Handle_EOF, OutRes, Abort, Unk ;AN000; 0 00000D9C 27010401 ErrTab Handle_DISK_FULL, OutRes, Abort, Unk ;AN000; 0 00000DA0 5A0D0402 ErrTab sys_comp_not_loaded, Unk, Abort, Disk ;AN001; 0 00000DA4 FFFFFFFF DB 0FFh, 0FFH, 0FFH, 0FFh 208 <1> 209 <1> ; 210 <1> ; The following table defines CLASS ACTION and LOCUS info for the INT 24H 211 <1> ; errors. Each entry is 4 bytes long: 212 <1> ; 213 <1> ; Err#,Class,Action,Locus 214 <1> ; 215 <1> ; A Locus value of 0FFh indicates a call specific value (ie. should already 216 <1> ; be set). AN ERROR CODE NOT IN THE TABLE FALLS THROUGH TO THE CATCH ALL AT 217 <1> ; THE END. 218 <1> 219 <1> align 2, db 0 220 <1> PUBLIC ERR_TABLE_24 221 <1> ERR_TABLE_24 LABEL BYTE 0 00000DA8 130B0702 ErrTab write_protect, Media, IntRet, Disk 0 00000DAC 14040501 ErrTab bad_unit, Intrn, Panic, Unk 0 00000DB0 150507FF ErrTab not_ready, HrdFail, IntRet, 0FFh 0 00000DB4 16040501 ErrTab bad_command, Intrn, Panic, Unk 0 00000DB8 170B0402 ErrTab CRC, Media, Abort, Disk 0 00000DBC 18040501 ErrTab bad_length, Intrn, Panic, Unk 0 00000DC0 19050102 ErrTab Seek, HrdFail, Retry, Disk 0 00000DC4 1A0B0702 ErrTab not_DOS_disk, Media, IntRet, Disk 0 00000DC8 1B0B0402 ErrTab sector_not_found, Media, Abort, Disk 0 00000DCC 1C020704 ErrTab out_of_paper, TempSit, IntRet, SerDev 0 00000DD0 1D0504FF ErrTab write_fault, HrdFail, Abort, 0FFh 0 00000DD4 1E0504FF ErrTab read_fault, HrdFail, Abort, 0FFh 0 00000DD8 1F0D04FF ErrTab gen_failure, Unk, Abort, 0FFh 0 00000DDC 200A0202 ErrTab sharing_violation, Locked, DlyRet, Disk 0 00000DE0 210A0202 ErrTab lock_violation, Locked, DlyRet, Disk 0 00000DE4 220B0702 ErrTab wrong_disk, Media, IntRet, Disk 0 00000DE8 32090303 ErrTab not_supported, BadFmt, User, Net 0 00000DEC 23070401 ErrTab FCB_unavailable, Apperr, Abort, Unk 0 00000DF0 24010405 ErrTab Sharing_buffer_exceeded,OutRes, Abort, Mem 0 00000DF4 FF0D05FF DB 0FFh, errCLASS_Unk, errACT_Panic, 0FFh 242 <1> 243 <1> === Switch to base=002450h -> "DOSCODETABLE" 244 <1> section DOSCODETABLE 245 <1> 246 <1> ; 247 <1> ; We need to map old int 24 errors and device driver errors into the new set 248 <1> ; of errors. The following table is indexed by the new errors 249 <1> ; 250 <1> Public ErrMap24 251 <1> ErrMap24 Label BYTE 0 00000330 13 DB error_write_protect ; 0 0 00000331 14 DB error_bad_unit ; 1 0 00000332 15 DB error_not_ready ; 2 0 00000333 16 DB error_bad_command ; 3 0 00000334 17 DB error_CRC ; 4 0 00000335 18 DB error_bad_length ; 5 0 00000336 19 DB error_Seek ; 6 0 00000337 1A DB error_not_DOS_disk ; 7 0 00000338 1B DB error_sector_not_found ; 8 0 00000339 1C DB error_out_of_paper ; 9 0 0000033A 1D DB error_write_fault ; A 0 0000033B 1E DB error_read_fault ; B 0 0000033C 1F DB error_gen_failure ; C 0 0000033D 1F DB error_gen_failure ; D RESERVED 0 0000033E 1F DB error_gen_failure ; E RESERVED 0 0000033F 22 DB error_wrong_disk ; F 268 <1> 269 <1> Public ErrMap24End 270 <1> ErrMap24End LABEL BYTE 271 <1> 272 <1> 273 <1> PUBLIC DISPATCH 274 <1> 275 <1> ; Standard Functions 276 <1> align 2, db 0 277 <1> DISPATCH LABEL WORD 0 00000340 [0000] short_addr D_ABORT ; 0 0 0 00000342 [0000] short_addr D_STD_CON_INPUT ; 1 1 0 00000344 [0000] short_addr D_STD_CON_OUTPUT ; 2 2 0 00000346 [0000] short_addr D_STD_AUX_INPUT ; 3 3 0 00000348 [0000] short_addr D_STD_AUX_OUTPUT ; 4 4 0 0000034A [0000] short_addr D_STD_PRINTER_OUTPUT ; 5 5 0 0000034C [0000] short_addr D_RAW_CON_IO ; 6 6 0 0000034E [0000] short_addr D_RAW_CON_INPUT ; 7 7 0 00000350 [0000] short_addr D_STD_CON_INPUT_NO_ECHO ; 8 8 0 00000352 [0000] short_addr D_STD_CON_STRING_OUTPUT ; 9 9 0 00000354 [0000] short_addr D_STD_CON_STRING_INPUT ; 10 A 0 00000356 [0000] short_addr D_STD_CON_INPUT_STATUS ; 11 B 0 00000358 [0000] short_addr D_STD_CON_INPUT_FLUSH ; 12 C 0 0000035A [0000] short_addr D_DISK_RESET ; 13 D 0 0000035C [0000] short_addr D_SET_DEFAULT_DRIVE ; 14 E 0 0000035E [0000] short_addr D_FCB_OPEN ; 15 F 0 00000360 [0000] short_addr D_FCB_CLOSE ; 16 10 0 00000362 [0000] short_addr D_DIR_SEARCH_FIRST ; 17 11 0 00000364 [0000] short_addr D_DIR_SEARCH_NEXT ; 18 12 0 00000366 [0000] short_addr D_FCB_DELETE ; 19 13 0 00000368 [0000] short_addr D_FCB_SEQ_READ ; 20 14 0 0000036A [0000] short_addr D_FCB_SEQ_WRITE ; 21 15 0 0000036C [0000] short_addr D_FCB_CREATE ; 22 16 0 0000036E [0000] short_addr D_FCB_RENAME ; 23 17 0 00000370 [0000] short_addr CPMFUNC ; 24 18 0 00000372 [0000] short_addr D_GET_DEFAULT_DRIVE ; 25 19 0 00000374 [0000] short_addr D_SET_DMA ; 26 1A 305 <1> 306 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 307 <1> ; C A V E A T P R O G R A M M E R ; 308 <1> ; ; 0 00000376 [0000] short_addr D_SLEAZEFUNC ; 27 1B 0 00000378 [0000] short_addr D_SLEAZEFUNCDL ; 28 1C 311 <1> ; ; 312 <1> ; C A V E A T P R O G R A M M E R ; 313 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 314 <1> 0 0000037A [0000] short_addr CPMFUNC ; 29 1D 0 0000037C [0000] short_addr CPMFUNC ; 30 1E 317 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 318 <1> ; C A V E A T P R O G R A M M E R ; 319 <1> ; ; 0 0000037E [0000] short_addr D_GET_DEFAULT_DPB ; 31 1F 321 <1> ; ; 322 <1> ; C A V E A T P R O G R A M M E R ; 323 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000380 [0000] short_addr CPMFUNC ; 32 20 0 00000382 [0000] short_addr D_FCB_RANDOM_READ ; 33 21 0 00000384 [0000] short_addr D_FCB_RANDOM_WRITE ; 34 22 0 00000386 [0000] short_addr D_GET_FCB_FILE_LENGTH ; 35 23 0 00000388 [0000] short_addr D_GET_FCB_POSITION ; 36 24 329 <1> VAL1 equ ($-DISPATCH)/2 - 1 330 <1> 331 <1> ; Extended Functions 0 0000038A [0000] short_addr D_SET_INTERRUPT_VECTOR ; 37 25 333 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 334 <1> ; C A V E A T P R O G R A M M E R ; 335 <1> ; ; 0 0000038C [0000] short_addr D_CREATE_PROCESS_DATA_BLOCK ; 38 26 337 <1> ; ; 338 <1> ; C A V E A T P R O G R A M M E R ; 339 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 0000038E [0000] short_addr D_FCB_RANDOM_READ_BLOCK ; 39 27 0 00000390 [0000] short_addr D_FCB_RANDOM_WRITE_BLOCK ; 40 28 0 00000392 [0000] short_addr D_PARSE_FILE_DESCRIPTOR ; 41 29 0 00000394 [0000] short_addr D_GET_DATE ; 42 2A 0 00000396 [0000] short_addr D_SET_DATE ; 43 2B 0 00000398 [0000] short_addr D_GET_TIME ; 44 2C 0 0000039A [0000] short_addr D_SET_TIME ; 45 2D 0 0000039C [0000] short_addr D_SET_VERIFY_ON_WRITE ; 46 2E 348 <1> 349 <1> ; Extended functionality group 0 0000039E [0000] short_addr D_GET_DMA ; 47 2F 0 000003A0 [0000] short_addr D_GET_VERSION ; 48 30 0 000003A2 [0000] short_addr D_Keep_Process ; 49 31 353 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 354 <1> ; C A V E A T P R O G R A M M E R ; 355 <1> ; ; 0 000003A4 [0000] short_addr D_GET_DPB ; 50 32 357 <1> ; ; 358 <1> ; C A V E A T P R O G R A M M E R ; 359 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 000003A6 [0000] short_addr D_SET_CTRL_C_TRAPPING ; 51 33 0 000003A8 [0000] short_addr D_GET_INDOS_FLAG ; 52 34 0 000003AA [0000] short_addr D_GET_INTERRUPT_VECTOR ; 53 35 0 000003AC [0000] short_addr D_GET_DRIVE_FREESPACE ; 54 36 0 000003AE [0000] short_addr D_CHAR_OPER ; 55 37 0 000003B0 [0000] short_addr D_INTERNATIONAL ; 56 38 366 <1> ; XENIX CALLS 367 <1> ; Directory Group 0 000003B2 [0000] short_addr D_MKDIR ; 57 39 0 000003B4 [0000] short_addr D_RMDIR ; 58 3A 0 000003B6 [0000] short_addr D_CHDIR ; 59 3B 371 <1> ; File Group 0 000003B8 [0000] short_addr D_CREAT ; 60 3C 0 000003BA [0000] short_addr D_OPEN ; 61 3D 0 000003BC [0000] short_addr D_CLOSE ; 62 3E 0 000003BE [0000] short_addr D_READ ; 63 3F 0 000003C0 [0000] short_addr D_WRITE ; 64 40 0 000003C2 [0000] short_addr D_UNLINK ; 65 41 0 000003C4 [0000] short_addr D_LSEEK ; 66 42 0 000003C6 [0000] short_addr D_CHMOD ; 67 43 0 000003C8 [0000] short_addr D_IOCTL ; 68 44 0 000003CA [0000] short_addr D_DUP ; 69 45 0 000003CC [0000] short_addr D_DUP2 ; 70 46 0 000003CE [0000] short_addr D_CURRENT_DIR ; 71 47 384 <1> ; Memory Group 0 000003D0 [0000] short_addr D_ALLOC ; 72 48 0 000003D2 [0000] short_addr D_DEALLOC ; 73 49 0 000003D4 [0000] short_addr D_SETBLOCK ; 74 4A 388 <1> ; Process Group 0 000003D6 [0000] short_addr D_EXEC ; 75 4B 0 000003D8 [0000] short_addr D_EXIT ; 76 4C 0 000003DA [0000] short_addr D_WAIT ; 77 4D 392 <1> ; Special Group 0 000003DC [0000] short_addr D_FIND_FIRST ; 78 4E 0 000003DE [0000] short_addr D_FIND_NEXT ; 79 4F 395 <1> ; SPECIAL SYSTEM GROUP 396 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 397 <1> ; C A V E A T P R O G R A M M E R ; 398 <1> ; ; 0 000003E0 [0000] short_addr D_SET_CURRENT_PDB ; 80 50 0 000003E2 [0000] short_addr D_GET_CURRENT_PDB ; 81 51 0 000003E4 [0000] short_addr D_GET_IN_VARS ; 82 52 0 000003E6 [0000] short_addr D_SETDPB ; 83 53 403 <1> ; ; 404 <1> ; C A V E A T P R O G R A M M E R ; 405 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 000003E8 [0000] short_addr D_GET_VERIFY_ON_WRITE ; 84 54 407 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 408 <1> ; C A V E A T P R O G R A M M E R ; 409 <1> ; ; 0 000003EA [0000] short_addr D_DUP_PDB ; 85 55 411 <1> ; ; 412 <1> ; C A V E A T P R O G R A M M E R ; 413 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 000003EC [0000] short_addr D_RENAME ; 86 56 0 000003EE [0000] short_addr D_FILE_TIMES ; 87 57 0 000003F0 [0000] short_addr D_AllocOper ; 88 58 417 <1> ; Network extention system calls 0 000003F2 [0000] short_addr D_GetExtendedError ; 89 59 0 000003F4 [0000] short_addr D_CreateTempFile ; 90 5A 0 000003F6 [0000] short_addr D_CreateNewFile ; 91 5B 0 000003F8 [0000] short_addr D_LockOper ; 92 5C 0 000003FA [0000] short_addr D_ServerCall ; 93 5D 0 000003FC [0000] short_addr D_UserOper ; 94 5E 0 000003FE [0000] short_addr D_AssignOper ; 95 5F 0 00000400 [0000] short_addr D_NameTrans ; 96 60 0 00000402 [0000] short_addr CPMFunc ; 97 61 0 00000404 [0000] short_addr D_Get_Current_PDB ; 98 62 428 <1> ; the next call is reserved for hangool sys call 0 00000406 [0000] short_addr D_ECS_Call ; 99 63 430 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 431 <1> ; C A V E A T P R O G R A M M E R ; 432 <1> ; ; 0 00000408 [0000] short_addr D_Set_Printer_Flag ; 100 64 434 <1> ; ; 435 <1> ; C A V E A T P R O G R A M M E R ; 436 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 0000040A [0000] short_addr D_GetExtCntry ; 101 65 0 0000040C [0000] short_addr D_GetSetCdPg ; 102 66 0 0000040E [0000] short_addr D_ExtHandle ; 103 67 0 00000410 [0000] short_addr D_Commit ; 104 68 0 00000412 [0000] short_addr D_GSetMediaID ; 105 69 ;AN000; 0 00000414 [0000] short_addr D_Commit ; 106 6A ;AN000; 0 00000416 [0000] short_addr D_IFS_IOCTL ; 107 6B ;AN000; 0 00000418 [0000] short_addr D_Extended_Open ; 108 6C ;AN000; 445 <1> ; 446 <1> VAL2 equ ($-DISPATCH)/2 - 1 447 <1> 448 <1> %if VAL1 != 24h || VAL2 != 6Ch 449 <1> %error Adjust hardcoded table sizes in disp.nas 450 <1> %endif 451 <1> 452 <1> 453 <1> %If Installed 454 <1> 455 <1> align 2, db 0 456 <1> PUBLIC FOO 457 <1> FOO LABEL WORD 0 0000041A [0000] Short_addr Leave2F 459 <1> DOSGroup equ DOSGROUP ; NASM port equate 0 0000041C [A301] DTab DW OFFSET DOSTable 461 <1> DTAB equ DTab ; NASM port label 462 <1> PUBLIC FOO,DTAB 463 <1> 464 <1> align 2, db 0 0 0000041E 00 db 0 ; padding 466 <1> DOSTable LABEL WORD 0 0000041F 30 DB (DOSTableEnd-DOSTable-1)/2 0 00000420 [0000] Short_addr DOSInstall ; 0 install check 0 00000422 [0000] Short_addr DOS_CLOSE ; 1 DOS_CLOSE 0 00000424 [0000] Short_addr RECSET ; 2 RECSET 0 00000426 [0000] Short_addr DOSGetGroup ; 3 Get DOSGROUP 0 00000428 [0000] Short_addr PATHCHRCMP ; 4 PATHCHRCMP 0 0000042A [0000] Short_addr OUTT ; 5 OUT 0 0000042C [0000] Short_addr NET_I24_ENTRY ; 6 NET_I24_ENTRY 0 0000042E [0000] Short_addr PLACEBUF ; 7 PLACEBUF 0 00000430 [0000] Short_addr FREE_SFT ; 8 FREE_SFT 0 00000432 [0000] Short_addr BUFWRITE ; 9 BUFWRITE 0 00000434 [0000] Short_addr SHARE_VIOLATION ; 10 SHARE_VIOLATION 0 00000436 [0000] Short_addr SHARE_ERROR ; 11 SHARE_ERROR 0 00000438 [0000] Short_addr SET_SFT_MODE ; 12 SET_SFT_MODE 0 0000043A [0000] Short_addr DATE16 ; 13 DATE16 0 0000043C [0000] Short_addr idle ; 14 empty slot 0 0000043E [0000] Short_addr SCANPLACE ; 15 SCANPLACE 0 00000440 [0000] Short_addr idle ; 16 empty slot 0 00000442 [0000] Short_addr StrCpy ; 17 StrCpy 0 00000444 [0000] Short_addr StrLen ; 18 StrLen 0 00000446 [0000] Short_addr Ucase ; 19 Ucase 0 00000448 [0000] Short_addr POINTCOMP ; 20 POINTCOMP 0 0000044A [0000] Short_addr CHECKFLUSH ; 21 CHECKFLUSH 0 0000044C [0000] Short_addr SFFromSFN ; 22 SFFromSFN 0 0000044E [0000] Short_addr GetCDSFromDrv ; 23 GetCDSFromDrv 0 00000450 [0000] Short_addr Get_User_Stack ; 24 Get_User_Stack 0 00000452 [0000] Short_addr GetThisDrv ; 25 GetThisDrv 0 00000454 [0000] Short_addr DriveFromText ; 26 DriveFromText 0 00000456 [0000] Short_addr SETYEAR ; 27 SETYEAR 0 00000458 [0000] Short_addr DSUM ; 28 DSUM 0 0000045A [0000] Short_addr DSLIDE ; 29 DSLIDE 0 0000045C [0000] Short_addr StrCmp ; 30 StrCmp 0 0000045E [0000] Short_addr InitCDS ; 31 initcds 0 00000460 [0000] Short_addr pJFNFromHandle ; 32 pJfnFromHandle 0 00000462 [0000] Short_addr D_NameTrans ; 33 $NameTrans 0 00000464 [0000] Short_addr CAL_LK ; 34 CAL_LK 0 00000466 [0000] Short_addr DEVNAME ; 35 DEVNAME 0 00000468 [0000] Short_addr Idle ; 36 Idle 0 0000046A [0000] Short_addr DStrLen ; 37 DStrLen 0 0000046C [0000] Short_addr NLS_OPEN ; 38 NLS_OPEN DOS 3.3 0 0000046E [0000] Short_addr D_CLOSE ; 39 $CLOSE DOS 3.3 0 00000470 [0000] Short_addr NLS_LSEEK ; 40 NLS_LSEEK DOS 3.3 0 00000472 [0000] Short_addr D_READ ; 41 $READ DOS 3.3 0 00000474 [0000] Short_addr FastInit ; 42 FastInit DOS 3.4 ;AN000; 0 00000476 [0000] Short_addr NLS_IOCTL ; 43 NLS_IOCTL DOS 3.3 0 00000478 [0000] Short_addr GetDevList ; 44 GetDevList DOS 3.3 0 0000047A [0000] Short_addr NLS_GETEXT ; 45 NLS_GETEXT DOS 3.3 0 0000047C [0000] Short_addr MSG_RETRIEVAL ; 46 MSG_RETRIEVAL DOS 4.0 ;AN000; 0 0000047E [0000] Short_addr Fake_Version ; 47 Fake_Version DOS 4.0 ;AN006; 516 <1> 517 <1> DOSTableEnd LABEL BYTE 518 <1> 519 <1> %ENDIF 520 <1> 521 <1> ; NOTE WARNING: This declaration of HEADER must be THE LAST thing in this 522 <1> ; module. The reason is so that the data alignments are the same in 523 <1> ; IBM-DOS and MS-DOS up through header. 524 <1> ;---------------------------------------Start of Korean support 2/11/KK 525 <1> ; 526 <1> ; The varialbes for ECS version are moved here for the same data alignments 527 <1> ; as IBM-DOS and MS-DOS. 528 <1> ; 529 <1> === Switch to base=000E10h -> "TABLE" 530 <1> section TABLE ; in DOSDATA 531 <1> 0 00000DF8 ?? I_AM InterChar, byte ; Interim character flag ( 1= interim) ;AN000; 533 <1> ;AN000; 534 <1> ;------- NOTE: NEXT TWO BYTES SOMETIMES USED AS A WORD !! --------------------- 535 <1> DUMMY LABEL WORD ;AN000; 536 <1> PUBLIC InterCon ; Console in Interim mode ( 1= interim) ;AN000; 0 00000DF9 00 InterCon db 0 ;AN000; 538 <1> PUBLIC SaveCurFlg ; Print, do not advance cursor flag ;AN000; 0 00000DFA 00 SaveCurFlg db 0 ;AN000; 540 <1> ;-----------------------------------------End of Korean support 2/11/KK 541 <1> 542 <1> 543 <1> HEADER equ Header ; NASM port label 544 <1> PUBLIC HEADER 545 <1> Header LABEL BYTE 546 <1> %IF DEBUG 547 <1> DB 13,10,"Debugging DOS version " 548 <1> DB MAJOR_VERSION + "0" 549 <1> DB "." 550 <1> DB (MINOR_VERSION / 10) + "0" 551 <1> DB (MINOR_VERSION MOD 10) + "0" 552 <1> %ENDIF 553 <1> 554 <1> %IFN IBM 555 <1> DB 13,10,"MS-DOS version " 556 <1> DB MAJOR_VERSION + "0" 557 <1> DB "." 558 <1> DB (MINOR_VERSION / 10) + "0" 559 <1> DB (MINOR_VERSION MOD 10) + "0" 560 <1> 561 <1> %IF HIGHMEM 562 <1> DB "H" 563 <1> %ENDIF 564 <1> 565 <1> DB 13,10, "Copyright 1981,82,83,84,88 Microsoft Corp.",13,10,"$" 566 <1> %ENDIF 567 <1> 568 <1> %IF DEBUG 569 <1> DB 13,10,"$" 570 <1> %ENDIF 571 <1> 572 <1> MSTAB001E label byte 573 <1> 574 <1> %include "copyrigh.mac" ;AN000; 0 00000DFB 4D5320444F53205665 DB "MS DOS Version 4.00 (C)Copyright 1988 Microsoft Corp" 0 00000E04 7273696F6E20342E30 0 00000E0D 3020284329436F7079 0 00000E16 726967687420313938 0 00000E1F 38204D6963726F736F 0 00000E28 667420436F7270 0 00000E2F 4C6963656E73656420 DB "Licensed Material - Property of Microsoft " 0 00000E38 4D6174657269616C20 0 00000E41 2D2050726F70657274 0 00000E4A 79206F66204D696372 0 00000E53 6F736F66742020 575 <1> 576 <1> ; SYS init extended table, DOS 3.3 F.C. 5/29/86 577 <1> ; 578 <1> PUBLIC SysInitTable 579 <1> I_need COUNTRY_CDPG,BYTE 580 <1> I_need SYSINITVAR,BYTE 581 <1> 582 <1> align 2, db 0 583 <1> SysInitTable label byte 0 00000E5A [0000] dw OFFSET SYSINITVAR wrt DOSGROUP ; pointer to sysinit var 0 00000E5C 0000 dw 0 ; segment 0 00000E5E [0000] dw OFFSET COUNTRY_CDPG wrt DOSGROUP ; pointer to country table 0 00000E60 0000 dw 0 ; segment of pointer 588 <1> ; DOS 3.3 F.C. 6/12/86 589 <1> 590 <1> ; FASTOPEN communications area DOS 3.3 F.C. 5/29/86 591 <1> ; 592 <1> PUBLIC FastOpenTable 593 <1> PUBLIC FastTable ; a better name 594 <1> EXTRN FastRet:FAR ; defined in misc2.asm 595 <1> extern fastentry 596 <1> 597 <1> align 2, db 0 598 <1> FastTable label byte ; a better name 599 <1> FastOpenTable label byte 0 00000E62 0200 dw 2 ; number of entries 0 00000E64 [0000] dw fastentry ; pointer to ret instr. 0 00000E66 [0000] dw DOSENTRY ; and will be modified by 0 00000E68 [0000] dw fastentry ; FASTxxx when loaded in 0 00000E6A [0000] dw DOSENTRY ; 605 <1> ; DOS 3.3 F.C. 6/12/86 606 <1> PUBLIC FastFlg ;AN000; flags 607 <1> FastFlg label byte ;AN000; don't change the following order 0 00000E6C 00 I_am FastOpenFlg,BYTE,<0> ;AN000; 0 00000E6D 00 I_am FastSeekFlg,BYTE,<0> ;AN000; 610 <1> 611 <1> PUBLIC FastOpen_Ext_Info 612 <1> 613 <1> ; FastOpen_Ext_Info is used as a temporary storage for saving dirpos,dirsec 614 <1> ; and clusnum which are filled by DOS 3.3 when calling FastOpen Insert 615 <1> ; or filled by FastOPen when calling FastOpen Lookup 616 <1> 617 <1> FastOpen_Ext_Info label byte 0 00000E6E 000000000000000000 db FASTOPEN_EXTENDED_INFO_struc_size dup(0) ;dirpos 0 00000E77 0000 619 <1> 620 <1> ; Dir_Info_Buff is a dir entry buffer which is filled by FastOPen 621 <1> ; when calling FastOpen Lookup 622 <1> 0 00000E79 00 align 2, db 0 624 <1> PUBLIC Dir_Info_Buff 625 <1> 626 <1> Dir_Info_Buff label byte 0 00000E7A 000000000000000000 db dir_entry_struc_size dup (0) 0 00000E83 000000000000000000 0 00000E8C 000000000000000000 0 00000E95 0000000000 628 <1> 629 <1> 0 00000E9A ???? I_am Next_Element_Start,WORD ; save next element start offset 631 <1> 632 <1> ; Following 4 variables moved to MSDATA.asm (P4986) 633 <1> ; I_am FSeek_drive,BYTE ;AN000; fastseek drive # 634 <1> ; I_am FSeek_firclus,WORD ;AN000; fastseek first cluster # 635 <1> ; I_am FSeek_logclus,WORD ;AN000; fastseek logical cluster # 636 <1> ; I_am FSeek_logsave,WORD ;AN000; fastseek returned log clus # 637 <1> 638 <1> ; The following is a stack and its pointer for interrupt 2F which is uesd 639 <1> ; by NLSFUNC. There is no significant use of this stack, we are just trying 640 <1> ; not to destroy the INT 21 stack saved for the user. 641 <1> 642 <1> 643 <1> User_SP_2F equ USER_SP_2F ; NASM port label 644 <1> PUBLIC User_SP_2F 645 <1> 646 <1> align 2, db 0 647 <1> USER_SP_2F LABEL WORD 0 00000E9C [8C01] dw OFFSET FAKE_STACK_2F wrt DOSGROUP 649 <1> 650 <1> PUBLIC Packet_Temp 651 <1> Packet_Temp label word ; temporary packet used by readtime 652 <1> PUBLIC DOS_TEMP ; temporary word 653 <1> DOS_TEMP label word 0 00000E9E 000000000000000000 FAKE_STACK_2F dw 14 dup (0) ; 12 register temporary storage 0 00000EA7 000000000000000000 0 00000EB0 000000000000000000 0 00000EB9 00 655 <1> 656 <1> PUBLIC Hash_Temp ;AN000; temporary word 657 <1> Hash_Temp label word ;AN000; 0 00000EBA 0000000000000000 dw 4 dup (0) ;AN000; temporary hash table during config.sys 659 <1> 660 <1> PUBLIC SCAN_FLAG ; flag to indicate key ALT_Q 661 <1> SCAN_FLAG label byte 0 00000EC2 00 db 0 663 <1> 0 00000EC3 00 align 2, db 0 665 <1> ;;; The following 2 words must be adjacent for IBMDOS reasons 666 <1> 667 <1> PUBLIC DATE_FLAG 668 <1> DATE_FLAG label word ; flag to 0 00000EC4 0000 dw 0 ; to update the date 670 <1> ;;;; special tag for IBMDOS 671 <1> PUBLIC FETCHI_TAG 672 <1> FETCHI_TAG label word ; TAG to make DOS 3.3 work 0 00000EC6 0000 dw 0 ; must be 22642 674 <1> ;;; The above 2 words must be adjacent for IBMDOS reasons 675 <1> ; DOS 3.3 F.C. 6/12/86 0 00000EC8 ???? I_am Del_ExtCluster,WORD ; for dos_delete ;AN000; 677 <1> 678 <1> align 2, db 0 679 <1> PUBLIC MSG_EXTERROR ; for system message addr ;AN000; 680 <1> MSG_EXTERROR label DWORD ;AN000; 0 00000ECA 00000000 dd 0 ; for extended error ;AN000; 0 00000ECE 00000000 dd 0 ; for parser ;AN000; 0 00000ED2 00000000 dd 0 ; for critical errror ;AN000; 0 00000ED6 00000000 dd 0 ; for IFS ;AN000; 0 00000EDA 00000000 dd 0 ; for code reduction ;AN000; 686 <1> 687 <1> PUBLIC SEQ_SECTOR ; last sector read ;AN000; 688 <1> SEQ_SECTOR label DWORD ;AN000; 0 00000EDE FFFFFFFF dd -1 ;AN000; 690 <1> 0 00000EE2 00 I_am XA_CONDITION,BYTE,<0> ; for Extended Attributes ;AN000; 692 <1> ; I_am XA_ES,WORD ; for extended find ;AN000; 693 <1> ; I_am XA_BP,WORD ; for extended find ;AN000; 694 <1> ; I_am XA_handle,WORD ; for get/set EA ;AN000; 0 00000EE3 ?? I_am XA_type,BYTE ; for get/set EA ;AN000; 696 <1> ; I_am XA_device,BYTE ; for get/set EA ;AN000; 0 00000EE4 ?? I_am XA_from,BYTE ; for get/set EA ;AN000; 698 <1> ; I_am XA_VAR,WORD ; for get/set EA ;AN000; 699 <1> ; I_am XA_TEMP,WORD ; for get/set EA ;AN000; 700 <1> ; I_am XA_TEMP2,WORD ; for get/set EA ;AN000; 701 <1> ; 702 <1> 703 <1> ; I_am MAX_EA_SIZE,WORD,<29> ; max EA list size ;AN000; 704 <1> ; I_am MAX_EANAME_SIZE,WORD,<20> ; max EA name list size ;AN000; 705 <1> ; I_am XA_COUNT,WORD,<2> ; number of EA entries ;AN000; 706 <1> 707 <1> 708 <1> ; PUBLIC XA_TABLE ; for get/set EA ;AN000; 709 <1> ; 710 <1> ;XA_TABLE label byte ;AN000; 711 <1> ; db EAISBINARY ;Code Page ;AN000; 712 <1> ; dw EASYSTEM ;AN000; 713 <1> ; db 0,2 ;AN000; 714 <1> ; dw 2 ;AN000; 715 <1> ; db 'CP' ;AN000; 716 <1> ; 717 <1> ; db EAISBINARY ;File Type ;AN000; 718 <1> ; dw EASYSTEM ;AN000; 719 <1> ; db 0,8 ;AN000; 720 <1> ; dw 1 ;AN000; 721 <1> ; db 'FILETYPE' ;AN000; 722 <1> ; 723 <1> 724 <1> ; PUBLIC XA_PACKET ;AN000; 725 <1> ;XA_PACKET label byte ;AN000; 726 <1> ;IF DBCS ;AN000; 727 <1> ; dw 18 ;AN000; 728 <1> ; db 18 dup(0) ;AN000; 729 <1> ; PUBLIC DBCS_PACKET ;AN000; 730 <1> ;DBCS_PACKET label byte ;AN000; 731 <1> ; db 5 dup(0) 732 <1> ;ELSE 733 <1> ; dw 2, 0 ; get/set device code page ;AN000; 734 <1> ;ENDIF 0 00000EE5 00 align 2, db 0 0 00000EE6 ???????? I_am CurHashEntry,DWORD ; current hash buffer entry ;AN000; 737 <1> ;; I_am ACT_PAGE,WORD,<-1> ;BL ; active EMS page ;AN000; 0 00000EEA ???? I_am SC_SECTOR_SIZE,WORD ; sector size for SC ;AN000; 0 00000EEC ?? I_am SC_DRIVE,BYTE ; drive # for secondary cache ;AN000; 0 00000EED FF I_am CurSC_DRIVE,BYTE,<-1> ; current SC drive ;AN000; 0 00000EEE ???????? I_am CurSC_SECTOR,DWORD ; current SC starting sector ;AN000; 0 00000EF2 0000 I_am SC_STATUS,WORD,<0> ; SC status word ;AN000; 0 00000EF4 00 I_am SC_FLAG,BYTE,<0> ; SC flag ;AN000; 0 00000EF5 0000 I_am IFS_DRIVER_ERR,WORD,<0> ; driver error for IFS ;AN000; 745 <1> 746 <1> PUBLIC NO_NAME_ID ;AN000; 747 <1> NO_NAME_ID label byte ;AN000; 0 00000EF7 4E4F204E414D452020 db 'NO NAME ' ; null media id ;AN000; 0 00000F00 2020 749 <1> 750 <1> align 2, db 0 751 <1> PUBLIC SWAP_AREA_TABLE ;AN000; 752 <1> SWAP_AREA_TABLE label byte ;AN000; 0 00000F02 0200 I_am NUM_SWAP_AREA,WORD,<2> ; number of swap areas ;AN000; 0 00000F04 ???????? I_am SWAP_IN_DOS,DWORD ; swap in dos area ;AN000; 0 00000F08 ???? I_am SWAP_IN_DOS_LEN,WORD ; swap in dos area length ;AN000; 0 00000F0A ???????? I_am SWAP_ALWAYS_AREA,DWORD ; swap always area ;AN000; 0 00000F0E ???? I_am SWAP_ALWAYS_AREA_LEN,WORD ; swap always area length ;AN000; 0 00000F10 ???????? I_am IFSFUNC_SWAP_IN_DOS,DWORD ; ifsfunc swap in dos area ;AN000; 0 00000F14 ???? I_am IFSFUNC_SWAP_IN_DOS_LEN,WORD ; ifsfunc swap in dos area length ;AN000; 760 <1> 0 00000F16 ???? I_am SWAP_AREA_LEN,WORD ; swap area length ;AN000; 0 00000F18 ???? I_am FIRST_BUFF_ADDR,WORD ; first buffer address ;AN000; 0 00000F1A 0000 I_am SPECIAL_VERSION,WORD,<0> ;AN006; used by INT 2F 47H 0 00000F1C FF I_am FAKE_COUNT,BYTE,<255> ;AN008; fake version count 0 00000F1D ???? I_am OLD_FIRSTCLUS,WORD ;AN011; save old first cluster for fastopen 19 ;=== Pop trace listing source 20 END === Trace listing source: ../DOS/msdisp.lst 1 ; SCCSID = @(#)ibmdisp.asm 1.1 85/04/10 2 ;TITLE IBM DOS DISPATCHER - System call dispatch code 3 ;NAME DISP 4 5 ; 6 ; System call dispatch code 7 ; 8 9 [list -] 9 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 14 15 ;=== Push trace listing source: disp.nas 16 %include "disp.nas" 1 <1> ; SCCSID = @(#)disp.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)disp.asm 1.1 85/04/10 3 <1> ; 4 <1> ; Dispatcher code 5 <1> ; 6 <1> 7 <1> [list -] 7 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <2> [list -] 10 <1> %include "dosseg.nas" 1 <2> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 3 <2> ; 4 <2> ; segment ordering for MSDOS 5 <2> ; 6 <2> 7 <2> %include "ddataseg.nas" 1 <3> 2 <3> %include "lmacros3.mac" 1 <4> [list -] 14 <4> [list -] 3 <3> === Switch to base=000E10h -> "DOSSTART" 4 <3> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <3> ; (no prior section) ; DOSSTART ENDS 6 <3> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <3> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <3> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <3> === Switch to base=000E10h -> "CONSTANTS" 10 <3> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <3> ; (no prior section) ; CONSTANTS ENDS 12 <3> === Switch to base=000E10h -> "DATA" 13 <3> addsection DATA, align=2 PUBLIC class=DATA 14 <3> ; (no prior section) ; DATA ENDS 15 <3> === Switch to base=000E10h -> "TABLE" 16 <3> addsection TABLE, align=2 PUBLIC class=TABLE 17 <3> ; (no prior section) ; TABLE ENDS 18 <3> === Switch to base=000E10h -> "DOSDATATABLE" 19 <3> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <3> ; (no prior section) ; DOSDATATABLE ENDS 21 <3> === Switch to base=000E10h -> "DOSDATACODE" 22 <3> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <3> ; (no prior section) ; DOSDATACODE ENDS 24 <3> === Switch to base=000E10h -> "DOSBIODATA" 25 <3> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <3> === Switch to base=000E10h -> "LAST" 27 <3> addsection LAST, align=16 PUBLIC class=LAST 28 <3> ; (no prior section) ; LAST ENDS 29 <3> 30 <3> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <3> 32 <3> %include "entryseg.nas" 1 <4> 2 <4> %ifndef ENTRYSEGNAS 3 <4> %define ENTRYSEGNAS 1 4 <4> 5 <4> %include "lmacros3.mac" 1 <5> [list -] 6 <4> === Switch to base=000000h -> "DOSENTRY" 7 <4> addsection DOSENTRY, class=%[DOSENTRY] 8 <4> 9 <4> group DOSENTRYGROUP DOSENTRY 10 <4> 11 <4> %endif 8 <2> 9 <2> %include "dcodeseg.nas" 1 <3> 2 <3> %ifndef DCODESEGNAS 3 <3> %assign DCODESEGNAS 1 4 <3> === Switch to base=002450h -> "DOSCODETABLE" 5 <3> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <3> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <3> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <3> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <3> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <3> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <3> 12 <3> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <3> 14 <3> %endif 10 <2> === Switch to base=000E10h -> "LAST" 11 <2> section LAST 12 <2> ; (no prior section) ; LAST ENDS 11 <1> %include "dossym.mac" 1 <2> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 3 <2> ; PAGE 80,132 4 <2> TRUE EQU 0FFFFh 5 <2> FALSE EQU 0 6 <2> 7 <2> Installed equ TRUE 8 <2> %IFNDEF DEBUG 9 <2> DEBUG equ FALSE 10 <2> %ENDIF 11 <2> %IFNDEF debug 12 <2> debug equ DEBUG 13 <2> %ENDIF 14 <2> 15 <2> %if 0 16 <2> DBCS equ FALSE ; for fixmem.pl operation 17 <2> %endif 18 <2> 19 <2> ; NASM original macros 20 <2> 21 <2> %macro DBCS 1.nolist 22 <2> %defstr %%string %1 23 <2> %substr %%prefix %%string 1,2 24 <2> %substr %%suffix %%string 3,-1 25 <2> %ifnidni %%prefix, "= " 26 <2> %error Unexpected DBCS prefix 27 <2> %endif 28 <2> %deftok %%token %%suffix 29 <2> %xdefine DBCS %%token 30 <2> %endmacro 31 <2> 32 <2> %include "DBCS.SW" 1 <3> DBCS = FALSE 2 <3> 33 <2> %unmacro DBCS 1.nolist 34 <2> 35 <2> ; end of NASM original macros 36 <2> 37 <2> %include "dosmac.mac" 1 <3> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 3 <3> ; 4 <3> ; Macro file for MSDOS. 5 <3> ; 6 <3> 7 <3> %ifndef __DOSMAC_MAC__ 8 <3> %assign __DOSMAC_MAC__ 1 9 <3> 10 <3> TRUE EQU 0FFFFh 11 <3> FALSE EQU 0 12 <3> 13 <3> 14 <3> ; NASM original macros (comment for fixmem.pl) 15 <3> 16 <3> ;SUBTTL BREAK a listing into pages and give new subtitles 17 <3> ;PAGE 18 <3> %imacro BREAK 0-1+.nolist 19 <3> ;SUBTTL subtitle 20 <3> ;PAGE 21 <3> %endmacro 22 <3> ;.xcref break 23 <3> 24 <3> BREAK 25 <3> 26 <3> %if 0 27 <3> AsmVars Macro varlist 28 <3> IRP var, 29 <3> AsmVar var 30 <3> ENDM 31 <3> ENDM 32 <3> 33 <3> AsmVar Macro var 34 <3> IFNDEF var 35 <3> var = FALSE 36 <3> ENDIF 37 <3> ENDM 38 <3> %endif 39 <3> 40 <3> BREAK 41 <3> 42 <3> ; 43 <3> ; declare a variable external and allocate a size 44 <3> ; 45 <3> ;AsmVar InstalledData 46 <3> %ifndef InstalledData 47 <3> %define InstalledData 0 48 <3> %endif 49 <3> 50 <3> %imacro I_NEED 1-2.nolist 51 <3> %ifn InstalledData === Switch to base=000E10h -> "DATA" 52 <3> [section DATA] 53 <3> %IFIDNi %2, WORD 54 <3> EXTRN %1:WORD 55 <3> %ELSE 56 <3> %IFIDNi %2, DWORD 57 <3> EXTRN %1:DWORD 58 <3> %ELSE 59 <3> EXTRN %1:BYTE 60 <3> %ENDIF 61 <3> %ENDIF 62 <3> __SECT__ 63 <3> %ENDIF 64 <3> %endmacro 65 <3> ;.xcref I_need 66 <3> 67 <3> ; 68 <3> ; call a procedure that may be external. The call will be short. 69 <3> ; 70 <3> %imacro invoke 1.nolist 71 <3> ;.xcref 72 <3> EXTRN %1:NEAR 73 <3> ;.cref 74 <3> CALL %1 75 <3> %endmacro 76 <3> ;.xcref invoke 77 <3> 78 <3> ;PAGE 79 <3> ; 80 <3> ; jump to a label that may be external. The jump will be near. 81 <3> ; 82 <3> %imacro transfer 1.nolist 83 <3> ;.xcref 84 <3> EXTRN %1:NEAR 85 <3> ;.cref 86 <3> JUMP %1 87 <3> %endmacro 88 <3> ;.xcref transfer 89 <3> 90 <3> ; 91 <3> ; get a short address in a word 92 <3> ; 93 <3> %imacro short_addr 1.nolist 94 <3> %ifnidn %1, ? 95 <3> EXTRN %1:NEAR 96 <3> DW OFFSET %1 97 <3> %ELSE 98 <3> DW ? 99 <3> %ENDIF 100 <3> %endmacro 101 <3> ;.xcref short_addr 102 <3> 103 <3> ; 104 <3> ; get a long address in a dword 105 <3> ; 106 <3> %imacro long_addr 1.nolist 107 <3> EXTRN %1:NEAR 108 <3> DD %1 109 <3> %endmacro 110 <3> ;.xcref long_addr 111 <3> 112 <3> ; 113 <3> ; declare a PROC near or far but PUBLIC nonetheless 114 <3> ; 115 <3> ;.xcref ?frame 116 <3> ;.xcref ?aframe 117 <3> ;.xcref ?stackdepth 118 <3> ;.xcref ?initstack 119 <3> %assign ?frame 0 ; initial 120 <3> %assign ?aframe 0 ; initial 121 <3> %assign ?stackdepth 0 ; initial stack size 122 <3> %assign ?initstack 0 ; initial stack size 123 <3> 124 <3> %imacro procedure 1-2.nolist 125 <3> %assign ?frame 0 126 <3> %assign ?aframe 2 ;; remember the pushed BP 127 <3> %warning proc %1... 128 <3> %1 PROC %2 129 <3> PUBLIC %1 130 <3> %assign ?initstack ?stackdepth ;; beginning of procedure 131 <3> %endmacro 132 <3> ;.xcref procedure 133 <3> 134 <3> ; 135 <3> ; end a procedure and check that stack depth is preserved 136 <3> ; 137 <3> %imacro EndProc 1-2.nolist 138 <3> %ifnidni %2, NoCheck ;; check the stack size 139 <3> %if ?initstack != ?stackdepth ;; is it different? 140 <3> %warning ***** Possible stack size error in %1 ***** 141 <3> %endif 142 <3> %endif 143 <3> %1 ENDP 144 <3> %endmacro 145 <3> ;.xcref endproc 146 <3> ;PAGE 147 <3> ; 148 <3> ; define a data item to be public and of an appropriate size/type 149 <3> ; 150 <3> 151 <3> %imacro stripangles 2.nolist 152 <3> %defstr %%param %2 153 <3> %rep 16 154 <3> %substr %%opening %%param 1 155 <3> %ifidn %%opening, '<' 156 <3> %substr %%param %%param 2,-1 157 <3> %endif 158 <3> %endrep 159 <3> %rep 16 160 <3> %strlen %%length %%param 161 <3> %substr %%closing %%param %%length 162 <3> %ifidn %%closing, '>' 163 <3> %substr %%param %%param 1,-2 164 <3> %endif 165 <3> %endrep 166 <3> %deftok %%token %%param 167 <3> %1 %%token 168 <3> %endmacro 169 <3> 170 <3> %imacro I_AM 2-*.nolist 171 <3> ;I_AM MACRO name,size,init 172 <3> %xdefine %%name %1 173 <3> ;; declare the type of the object 174 <3> %IFIDNi %2, WORD 175 <3> %1 LABEL WORD 176 <3> %assign I_AM_SIZE 1 177 <3> %assign I_AM_LEN 2 178 <3> %ELSE 179 <3> %IFIDNi %2, DWORD 180 <3> %1 LABEL DWORD 181 <3> %assign I_AM_SIZE 2 182 <3> %assign I_AM_LEN 2 183 <3> %ELSE 184 <3> %IFIDNi %2, BYTE 185 <3> %1 LABEL BYTE 186 <3> %assign I_AM_SIZE 1 187 <3> %assign I_AM_LEN 1 188 <3> %ELSE 189 <3> %1 LABEL BYTE 190 <3> %undef I_AM_SIZE 191 <3> stripangles %assign I_AM_SIZE, %2 192 <3> %assign I_AM_LEN 1 193 <3> %ENDIF 194 <3> %ENDIF 195 <3> %ENDIF 196 <3> ;; declare the object public 197 <3> PUBLIC %%name 198 <3> ;; if no initialize then allocate blank storage 199 <3> %IF %0 == 2 200 <3> DB I_AM_SIZE*I_AM_LEN DUP (?) 201 <3> %ELSE 202 <3> %ifn InstalledData 203 <3> %rotate 2 204 <3> %rep %0 - 2 205 <3> %IF I_AM_LEN == 1 206 <3> stripangles db, %1 207 <3> %ELSE 208 <3> stripangles dw, %1 209 <3> %ENDIF 210 <3> %assign I_AM_SIZE I_AM_SIZE - 1 211 <3> %rotate 1 212 <3> %endrep 213 <3> %IF I_AM_SIZE != 0 214 <3> %error ***** initialization of %%name not complete ***** 215 <3> %ENDIF 216 <3> %ELSE 217 <3> DB I_AM_SIZE*I_AM_LEN DUP (?) 218 <3> %ENDIF 219 <3> %ENDIF 220 <3> %endmacro 221 <3> 222 <3> %imacro I_AM_NOBITS 2-*.nolist 223 <3> ;I_AM MACRO name,size,init 224 <3> %xdefine %%name %1 225 <3> ;; declare the type of the object 226 <3> %IFIDNi %2, WORD 227 <3> %1 LABEL WORD 228 <3> %assign I_AM_SIZE 1 229 <3> %assign I_AM_LEN 2 230 <3> %ELSE 231 <3> %IFIDNi %2, DWORD 232 <3> %1 LABEL DWORD 233 <3> %assign I_AM_SIZE 2 234 <3> %assign I_AM_LEN 2 235 <3> %ELSE 236 <3> %IFIDNi %2, BYTE 237 <3> %1 LABEL BYTE 238 <3> %assign I_AM_SIZE 1 239 <3> %assign I_AM_LEN 1 240 <3> %ELSE 241 <3> %1 LABEL BYTE 242 <3> %undef I_AM_SIZE 243 <3> stripangles %assign I_AM_SIZE, %2 244 <3> %assign I_AM_LEN 1 245 <3> %ENDIF 246 <3> %ENDIF 247 <3> %ENDIF 248 <3> ;; declare the object public 249 <3> PUBLIC %%name 250 <3> ;; if no initialize then allocate blank storage 251 <3> %IF %0 == 2 252 <3> resb I_AM_SIZE*I_AM_LEN 253 <3> %ELSE 254 <3> %ifn InstalledData 255 <3> %rotate 2 256 <3> %rep %0 - 2 257 <3> %IF I_AM_LEN == 1 258 <3> resb 1 259 <3> %ELSE 260 <3> resw 1 261 <3> %ENDIF 262 <3> %assign I_AM_SIZE I_AM_SIZE - 1 263 <3> %rotate 1 264 <3> %endrep 265 <3> %IF I_AM_SIZE != 0 266 <3> %error ***** initialization of %%name not complete ***** 267 <3> %ENDIF 268 <3> %ELSE 269 <3> resb I_AM_SIZE*I_AM_LEN 270 <3> %ENDIF 271 <3> %ENDIF 272 <3> %endmacro 273 <3> 274 <3> ;.xcref I_AM 275 <3> ;.xcref I_AM_SIZE 276 <3> ;.xcref I_AM_LEN 277 <3> %assign I_AM_SIZE 0 278 <3> %assign I_AM_LEN 0 279 <3> 280 <3> ;PAGE 281 <3> 282 <3> ; 283 <3> ; define an entry in a procedure 284 <3> ; 285 <3> %imacro entry 1.nolist 286 <3> %1: 287 <3> PUBLIC %1 288 <3> %endmacro 289 <3> ;.xcref entry 290 <3> 291 <3> BREAK 292 <3> 293 <3> %imacro error 1.nolist 294 <3> ;.xcref 295 <3> MOV AL, %1 296 <3> transfer SYS_RET_ERR 297 <3> ;.cref 298 <3> %endmacro 299 <3> ;.xcref error 300 <3> 301 <3> BREAK 302 <3> ; 303 <3> ; given a label either 2 byte jump to another label _J 304 <3> ; if it is near enough or 3 byte jump to 305 <3> ; 306 <3> 307 <3> %imacro jump 1.nolist 308 <3> ;.xcref 309 <3> 310 <3> %ifndef %1_J ;; is this the first invocation 311 <3> %%a: JMP %1 312 <3> %ELSE 313 <3> %IF (%1_J >= $) || ($-%1_J > 126) 314 <3> %%a: JMP %1 ;; is the jump too far away? 315 <3> %ELSE 316 <3> %%a: JMP %1_J ;; do the short one... 317 <3> %ENDIF 318 <3> %ENDIF 319 <3> %ixdefine %1_j %%a 320 <3> ;.cref 321 <3> %endmacro 322 <3> ;.xcref jump 323 <3> 324 <3> BREAK 325 <3> 326 <3> %imacro return 0.nolist 327 <3> %%a: 328 <3> RET 329 <3> %xdefine ret_l %%a 330 <3> %endmacro 331 <3> ;.xcref return 332 <3> 333 <3> BREAK 334 <3> 335 <3> %imacro condret 2.nolist 336 <3> %assign %%exit 0 337 <3> %ifdef ret_l ;; if ret_l is defined 338 <3> %if (($ - ret_l) <= 126) && ($ > ret_l) 339 <3> ;; if ret_l is near enough then 340 <3> %%a: j%1 ret_l ;; a: j to ret_l 341 <3> %xdefine ret_%1 %%a ;; define ret_ to be a: 342 <3> %assign %%exit 1 343 <3> %endif 344 <3> %endif 345 <3> %ifn %%exit 346 <3> %ifdef ret_%1 ;; if ret_ defined 347 <3> %if (($ - ret_%1) <= 126) && ($ > ret_%1) 348 <3> ;; if ret_ is near enough 349 <3> %%a: j%1 ret_%1 ;; a: j to ret_ 350 <3> %xdefine ret_%1 %%a ;; define ret_ to be a: 351 <3> %assign %%exit 1 352 <3> %endif 353 <3> %endif 354 <3> %endif 355 <3> %ifn %%exit 356 <3> j%2 %%a ;; j a: 357 <3> return ;; return 358 <3> %%a: ;; a: 359 <3> %xdefine ret_%1 ret_l ;; define ret_ to be ret_l 360 <3> %endif 361 <3> %endmacro 362 <3> ;.xcref condret 363 <3> 364 <3> BREAK 365 <3> 366 <3> %imacro retz 0.nolist 367 <3> condret z,nz 368 <3> %endmacro 369 <3> ;.xcref retz 370 <3> 371 <3> BREAK 372 <3> 373 <3> %imacro retnz 0.nolist 374 <3> condret nz,z 375 <3> %endmacro 376 <3> ;.xcref retnz 377 <3> 378 <3> BREAK 379 <3> 380 <3> %imacro retc 0.nolist 381 <3> condret c,nc 382 <3> %endmacro 383 <3> ;.xcref retc 384 <3> 385 <3> BREAK 386 <3> 387 <3> %imacro retnc 0.nolist 388 <3> condret nc,c 389 <3> %endmacro 390 <3> ;.xcref retnc 391 <3> 392 <3> BREAK 393 <3> 394 <3> %imacro context 1.nolist 395 <3> PUSH SS 396 <3> stripangles POP, %1 397 <3> ; ASSUME %1:DOSGROUP 398 <3> %endmacro 399 <3> ;.xcref context 400 <3> 401 <3> BREAK 402 <3> 403 <3> %imacro SaveReg 0-*.nolist ;; push those registers 404 <3> %rep %0 405 <3> %assign ?stackdepth ?stackdepth + 1 406 <3> stripangles push, %1 407 <3> %rotate 1 408 <3> %endrep 409 <3> %endmacro 410 <3> ;.xcref SaveReg 411 <3> 412 <3> BREAK 413 <3> 414 <3> %imacro RestoreReg 0-*.nolist ;; pop those registers 415 <3> %rep %0 416 <3> %assign ?stackdepth ?stackdepth - 1 417 <3> stripangles pop, %1 418 <3> %rotate 1 419 <3> %endrep 420 <3> %endmacro 421 <3> ;.xcref RestoreReg 422 <3> 423 <3> BREAK 424 <3> 425 <3> %imacro EnterCrit 1.nolist 426 <3> Invoke E%1 427 <3> %endmacro 428 <3> 429 <3> %imacro LeaveCrit 1.nolist 430 <3> Invoke L%1 431 <3> %endmacro 432 <3> 433 <3> Break 434 <3> 435 <3> ;AsmVars 436 <3> %ifndef ShareF 437 <3> %idefine ShareF 0 438 <3> %endif 439 <3> %ifndef Cargs 440 <3> %idefine Cargs 0 441 <3> %endif 442 <3> %ifndef Redirector 443 <3> %idefine Redirector 0 444 <3> %endif 445 <3> %ifndef debug 446 <3> %idefine debug 0 447 <3> %endif 448 <3> 449 <3> %if debug 450 <3> %imacro fmt 3-*.nolist 451 <3> ;fmt MACRO typ,lev,fmts,args 452 <3> ;local a,b,c 453 <3> PUSHF 454 <3> %IFNempty %1 455 <3> TEST word [BugTyp],%1 456 <3> JZ %%c 457 <3> CMP word [BugLev],%2 458 <3> JB %%c 459 <3> %ENDIF 460 <3> PUSH AX 461 <3> PUSH BP 462 <3> MOV BP,SP 463 <3> %If (! sharef) && (! redirector) === Switch to base=000E10h -> "TABLE" 464 <3> [section Table] 465 <3> %%a: db %3,0 466 <3> __SECT__ 467 <3> MOV AX,OFFSET %%a wrt DOSGROUP 468 <3> %else 469 <3> jmp short %%b 470 <3> %%a: db %3,0 471 <3> %if sharef 472 <3> %%b: mov ax,offset %%a wrt share 473 <3> %else 474 <3> %%b: mov ax,offset %%a wrt netwrk 475 <3> %endif 476 <3> %endif 477 <3> PUSH AX 478 <3> %iassign cargs 2 479 <3> %rotate 3 480 <3> %rep %0 - 3 481 <3> %ifidni ax, %1 482 <3> MOV AX,[BP+2] 483 <3> %ELSE 484 <3> MOV AX, %1 485 <3> %ENDIF 486 <3> PUSH AX 487 <3> %iassign cargs cargs + 2 488 <3> %rotate 1 489 <3> %endrep 490 <3> invoke PFMT 491 <3> ADD SP, Cargs 492 <3> POP BP 493 <3> POP AX 494 <3> %%c: 495 <3> POPF 496 <3> %endmacro 497 <3> %else 498 <3> %imacro fmt 3-*.nolist 499 <3> %endmacro 500 <3> %endif 501 <3> 502 <3> Break 503 <3> 504 <3> ;AsmVar Debug,$temp 505 <3> 506 <3> %imacro detectstripangles 4.nolist 507 <3> %defstr %%param %4 508 <3> %assign ?%2 0 509 <3> %assign ?%3 0 510 <3> %rep 16 511 <3> %substr %%opening %%param 1 512 <3> %ifidn %%opening, '<' 513 <3> %substr %%param %%param 2,-1 514 <3> %assign ?%2 ?%2 + 1 515 <3> %endif 516 <3> %endrep 517 <3> %rep 16 518 <3> %strlen %%length %%param 519 <3> %substr %%closing %%param %%length 520 <3> %ifidn %%closing, '>' 521 <3> %substr %%param %%param 1,-2 522 <3> %assign ?%3 ?%3 + 1 523 <3> %endif 524 <3> %endrep 525 <3> %deftok %%token %%param 526 <3> %define ?%1 %%token 527 <3> %endmacro 528 <3> 529 <3> 530 <3> %IF debug 531 <3> %imacro DOSAssume 3-*.nolist 532 <3> ;DOSAssume Macro reg,reglist,message 533 <3> %ifidni %1, CS 534 <3> %assign %%temp 1 535 <3> %else 536 <3> %ifidni %1, SS 537 <3> %assign %%temp 0 538 <3> %else 539 <3> %error ***** Invalid DOS register %1 in DOSAssume ***** 540 <3> %endif 541 <3> %endif 542 <3> %rotate 1 543 <3> %assign %%level 0 544 <3> %assign %%amount %0 - 1 545 <3> %rep 16 546 <3> detectstripangles %%token, %%opening, %%closing, %1 547 <3> %assign %%level %%level + ? %+ %%opening 548 <3> %assign %%level %%level - ? %+ %%closing 549 <3> %ifidni ? %+ %%token, DS 550 <3> %assign %%temp %%temp | 2 551 <3> %else 552 <3> %ifidni ? %+ %%token, ES 553 <3> %assign %%temp %%temp | 4 554 <3> %else 555 <3> %error ***** Invalid register reg in DOSAssume ***** 556 <3> %endif 557 <3> %endif 558 <3> %assign %%amount %%amount - 1 559 <3> %rotate 1 560 <3> %if %%level <= 0 561 <3> %exitrep 562 <3> %endif 563 <3> %endrep 564 <3> 565 <3> PUSH AX 566 <3> MOV AX, %%temp 567 <3> PUSH AX 568 <3> %IF SHAREF 569 <3> MOV AX,OFFSET %%a 570 <3> %ELSE 571 <3> MOV AX,OFFSET %%a wrt DOSGroup 572 <3> %ENDIF 573 <3> PUSH AX 574 <3> Invoke SegCheck 575 <3> POP AX 576 <3> %IFN SHAREF === Switch to base=000E10h -> "TABLE" 577 <3> [section Table] 578 <3> %ELSE 579 <3> JMP SHORT %%b 580 <3> %ENDIF 581 <3> %%a: 582 <3> %rep %%amount 583 <3> DB %1 584 <3> %rotate 1 585 <3> %endrep 586 <3> db 0 587 <3> %IFN SHAREF 588 <3> __SECT__ 589 <3> %ELSE 590 <3> %%b: 591 <3> %ENDIF 592 <3> ;IRP r, 593 <3> ; ASSUME r:DOSGroup 594 <3> ;ENDM 595 <3> %endmacro 596 <3> %ELSE 597 <3> %imacro DOSAssume 3-*.nolist 598 <3> ;DOSAssume Macro reg,reglist,message 599 <3> ;IRP r, 600 <3> ; ASSUME r:DOSGroup 601 <3> ;ENDM 602 <3> %endmacro 603 <3> %ENDIF 604 <3> 605 <3> BREAK 606 <3> 607 <3> %if 0 608 <3> ;IF DEBUG 609 <3> Assert MACRO kind, objs, message 610 <3> LOCAL a,b 611 <3> IFIDN , 612 <3> CMP objs,0 613 <3> JZ a 614 <3> fmt <>,<>, 615 <3> a: 616 <3> ELSE 617 <3> IFIDN , 618 <3> CMP objs,0 619 <3> JNZ a 620 <3> fmt <>,<>, 621 <3> a: 622 <3> ELSE 623 <3> PUSH AX 624 <3> IRP obj, 625 <3> PUSH obj 626 <3> ENDM 627 <3> IF SHAREF 628 <3> MOV AX,OFFSET b 629 <3> ELSE 630 <3> MOV AX,OFFSET DOSGroup:b 631 <3> ENDIF 632 <3> PUSH AX 633 <3> IFIDN , 634 <3> Invoke BUFCheck 635 <3> ENDIF 636 <3> IFIDN , 637 <3> Invoke SFTCheck 638 <3> ENDIF 639 <3> IFIDN , 640 <3> Invoke DPBCheck 641 <3> ENDIF 642 <3> POP AX 643 <3> IF SHAREF 644 <3> JMP SHORT a 645 <3> b DB Message,0 646 <3> a: 647 <3> ELSE === Switch to base=000E10h -> "TABLE" 648 <3> Table segment 649 <3> b db Message,0 === Switch to base=000E10h -> "TABLE" 650 <3> Table ends 651 <3> ENDIF 652 <3> ENDIF 653 <3> ENDIF 654 <3> ENDM 655 <3> %ELSE 656 <3> %imacro Assert 0-*.nolist 657 <3> %endmacro 658 <3> %ENDIF 659 <3> 660 <3> %ifndef Installed 661 <3> %idefine Installed 1 662 <3> %endif 663 <3> 664 <3> Break 665 <3> 666 <3> %imacro CallInstall 3-*.nolist 667 <3> ;CallInstall MACRO name,mpx,fn,save,restore 668 <3> %define %%name %1 669 <3> %assign %%mpx %2 670 <3> %assign %%fn %3 671 <3> %IF Installed 672 <3> %rotate 3 673 <3> %assign %%level 0 674 <3> %assign %%amountsaved 0 675 <3> %rep %0 - 3 676 <3> %ifnempty %1 677 <3> detectstripangles %%token, %%opening, %%closing, %1 678 <3> %assign %%level %%level + ? %+ %%opening 679 <3> %assign %%level %%level - ? %+ %%closing 680 <3> SaveReg ? %+ %%token 681 <3> %endif 682 <3> %assign %%amountsaved %%amountsaved + 1 683 <3> %rotate 1 684 <3> %if %%level <= 0 685 <3> %exitrep 686 <3> %endif 687 <3> %endrep 688 <3> MOV AX,(%%mpx << 8) + %%fn 689 <3> INT 2Fh 690 <3> %assign %%level 0 691 <3> %assign %%amountrestored 0 692 <3> %rep %0 - 3 - %%amountsaved 693 <3> %ifnempty %1 694 <3> detectstripangles %%token, %%opening, %%closing, %1 695 <3> %assign %%level %%level + ? %+ %%opening 696 <3> %assign %%level %%level - ? %+ %%closing 697 <3> RestoreReg ? %+ %%token 698 <3> %endif 699 <3> %assign %%amountrestored %%amountrestored + 1 700 <3> %rotate 1 701 <3> %if %%level <= 0 702 <3> %exitrep 703 <3> %endif 704 <3> %endrep 705 <3> %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored 706 <3> %error Wrong amount saved or restored 707 <3> %endif 708 <3> %ELSE 709 <3> Invoke %%name 710 <3> %ENDIF 711 <3> %endmacro 712 <3> 713 <3> Break 714 <3> 715 <3> %imacro localvar 2.nolist 716 <3> %ifidni %2, BYTE 717 <3> %assign ?frame ?frame + 1 718 <3> %assign %%a ?frame 719 <3> labelsize %1, byte, bp - %%a 720 <3> %else 721 <3> %ifidni %2, WORD 722 <3> %assign ?frame ?frame + 2 723 <3> %assign %%a ?frame 724 <3> labelsize %1, word, bp - %%a 725 <3> %else 726 <3> %ifidni %2, DWORD 727 <3> %assign ?frame ?frame + 4 728 <3> %assign %%a ?frame 729 <3> labelsize %1 %+ l, word, bp - %%a 730 <3> labelsize %1 %+ h, word, bp - %%a + 2 731 <3> labelsize %1, dword, bp - %%a 732 <3> %else 733 <3> %assign ?frame ?frame + %2 734 <3> %assign %%a ?frame 735 <3> labelsize %1, byte, bp - %%a 736 <3> %endif 737 <3> %endif 738 <3> %endif 739 <3> %endmacro 740 <3> 741 <3> %imacro enter 0.nolist 742 <3> push bp 743 <3> mov bp,sp 744 <3> sub sp,?frame 745 <3> %endmacro 746 <3> 747 <3> %imacro leave 0.nolist 748 <3> mov sp,bp 749 <3> pop bp 750 <3> %endmacro 751 <3> 752 <3> 753 <3> %imacro argvar 2.nolist 754 <3> %ifidni %2, BYTE 755 <3> %assign %%a ?aframe 756 <3> %assign ?aframe ?aframe + 1 757 <3> labelsize %1, byte, bp + %%a 758 <3> %else 759 <3> %ifidni %2, WORD 760 <3> %assign %%a ?aframe 761 <3> %assign ?aframe ?aframe + 2 762 <3> labelsize %1, word, bp + %%a 763 <3> %else 764 <3> %ifidni %2, DWORD 765 <3> %assign %%a ?aframe 766 <3> %assign ?aframe ?aframe + 4 767 <3> labelsize %1 %+ l, word, bp + %%a 768 <3> labelsize %1 %+ h, word, bp + %%a + 2 769 <3> labelsize %1, dword, bp + %%a 770 <3> %else 771 <3> %assign %%a ?aframe 772 <3> %assign ?aframe ?aframe + %2 773 <3> labelsize %1, byte, bp + %%a 774 <3> %endif 775 <3> %endif 776 <3> %endif 777 <3> %endmacro 778 <3> 779 <3> BREAK 780 <3> 781 <3> %imacro errnz 1.nolist 782 <3> detectstripangles %%token, %%opening, %%closing, %1 783 <3> %if ? %+ %%token 784 <3> %error %1 <> 0 785 <3> %endif 786 <3> %endmacro 787 <3> 788 <3> %endif 38 <2> 39 <2> %include "versiona.mac" 1 <3> 2 <3> major_version equ 4 ;Major DOS version 3 <3> minor_version equ 00 ;Minor DOS Version 4 <3> 5 <3> MINOR_VERSION equ minor_version ; NASM port equate 6 <3> MAJOR_VERSION equ major_version ; NASM port equate 7 <3> expected_version equ (MINOR_VERSION << 8)+MAJOR_VERSION 8 <3> 9 <3> alt_major_version equ 5 ;Major DOS version 10 <3> alt_minor_version equ 26 ;Minor DOS Version 11 <3> 12 <3> alt_expected_version equ (alt_minor_version << 8) + alt_major_version 13 <3> 14 <3> new_major_version equ 5 ;Major DOS version 15 <3> new_minor_version equ 38 ;Minor DOS Version 16 <3> new_expected_version equ (new_minor_version << 8) + new_major_version 17 <3> 18 <3> %warning out: ... for DOS Version 4.00 ... 18 ****************** <3> warning: out: ... for DOS Version 4.00 ... [-w+user] 19 <3> 20 <3> ;****************************** 21 <3> ;Each assembler program should: 22 <3> ; mov ah,030h ;DOS Get Version function 23 <3> ; int 021h ;Version ret. in AX,minor version first 24 <3> ; cmp ax,expected_version ;ALL utilities should check for an 25 <3> ; jne error_handler ; EXACT version match. 26 <3> ;****************************** 27 <3> 40 <2> 41 <2> BREAK 42 <2> 43 <2> c_DEL EQU 7Fh ; ASCII rubout or delete previous char 44 <2> c_BS EQU 08h ; ^H ASCII backspace 45 <2> c_CR EQU 0Dh ; ^M ASCII carriage return 46 <2> c_LF EQU 0Ah ; ^J ASCII linefeed 47 <2> c_ETB EQU 17h ; ^W ASCII end of transmission 48 <2> c_NAK EQU 15h ; ^U ASCII negative acknowledge 49 <2> c_ETX EQU 03h ; ^C ASCII end of text 50 <2> c_HT EQU 09h ; ^I ASCII tab 51 <2> 52 <2> BREAK 53 <2> 54 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 55 <2> ; ; 56 <2> ; C A V E A T P R O G R A M M E R ; 57 <2> ; ; 58 <2> ; Certain structures, constants and system calls below are private to ; 59 <2> ; the DOS and are extremely version-dependent. They may change at any ; 60 <2> ; time at the implementors' whim. As a result, they must not be ; 61 <2> ; documented to the general public. If an extreme case arises, they ; 62 <2> ; must be documented with this warning. ; 63 <2> ; ; 64 <2> ; Those structures and constants that are subject to the above will be ; 65 <2> ; marked and bracketed with the flag: ; 66 <2> ; ; 67 <2> ; C A V E A T P R O G R A M M E R ; 68 <2> ; ; 69 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 70 <2> 71 <2> %include "bpb.mac" 1 <3> %warning out: BPB.INC... 1 ****************** <3> warning: out: BPB.INC... [-w+user] 2 <3> ; SCCSID = @(#)BPB.ASM 1.1 85/04/29 3 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 4 <3> ; C A V E A T P R O G R A M M E R ; 5 <3> ; ; 6 <3> 7 <3> ; BIOS PARAMETER BLOCK DEFINITION 8 <3> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB 9 <3> 10 <3> BPBLOCK STRUC 0 00000F20 ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 00000F22 ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 00000F23 ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 00000F25 ?? BPFTCNT DB ? ; NUMBER OF FATS 0 00000F26 ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00000F28 ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 00000F2A ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 00000F2B ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <3> BPBLOCK ENDS 20 <3> 21 <3> A_BPB STRUC 0 00000F20 ???? BPB_BYTESPERSECTOR DW ? 0 00000F22 ?? BPB_SECTORSPERCLUSTER DB ? 0 00000F23 ???? BPB_RESERVEDSECTORS DW ? 0 00000F25 ?? BPB_NUMBEROFFATS DB ? 0 00000F26 ???? BPB_ROOTENTRIES DW ? 0 00000F28 ???? BPB_TOTALSECTORS DW ? 0 00000F2A ?? BPB_MEDIADESCRIPTOR DB ? 0 00000F2B ???? BPB_SECTORSPERFAT DW ? 0 00000F2D ???? BPB_SECTORSPERTRACK DW ? 0 00000F2F ???? BPB_HEADS DW ? 0 00000F31 ???? BPB_HIDDENSECTORS DW ? 0 00000F33 ???? DW ? 0 00000F35 ???? BPB_BIGTOTALSECTORS DW ? 0 00000F37 ???? DW ? 0 00000F39 ???????????? DB 6 DUP(?) 37 <3> A_BPB ENDS 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 72 <2> 73 <2> %include "buffer.mac" 1 <3> %include "buf2sw.mac" 1 <4> %define BUF2 1 2 <3> 3 <3> ; SCCSID = @(#)buffer.asm 1.1 85/04/09 4 <3> BREAK 5 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 6 <3> ; C A V E A T P R O G R A M M E R ; 7 <3> ; ; 8 <3> 9 <3> %ifdef BUF2 10 <3> 11 <3> ; Field definition for I/O buffer information 12 <3> 13 <3> BUFFINFO STRUC 0 00000F20 ???????? NEXTBUF DD ? ; Pointer to next buffer in list 15 <3> ; The next two items are often refed as a word 16 <3> buf_ID: 0 00000F24 ?? BUFDRV DB ? ; Logical drive # assoc with buffer FF = free 18 <3> buf_flags: 0 00000F25 ?? BUFDATAFLAG db ? 0 00000F26 ?? BUFPRI DB ? ; Buffer selection priority (see EQUs below) 0 00000F27 ?? alignb 2 22 <3> buf_sector: 0 00000F28 ???????? BUFSECNO dd ? ; Sector number of buffer 24 <3> alignb 2 0 00000F2C ???????? BUFDRVDP DD ? ; Pointer to drive parameters 26 <3> BUFFINFO ENDS 27 <3> 28 <3> BUFINSIZ EQU BUFFINFO_struc_size 29 <3> ; Size of structure in bytes 30 <3> BUFINSIZE equ BUFINSIZ 31 <3> 32 <3> FREEPRI EQU 0 33 <3> LBRPRI EQU 2 ; Last byte of buffer read 34 <3> LBWPRI EQU 4 ; Last byte written 35 <3> RPRI EQU 6 ; Read but not last byte 36 <3> WPRI EQU 8 ; Written but not last byte 37 <3> DIRPRI EQU 15 ; Directory Sector 38 <3> FATPRI EQU 30 ; FAT sector 39 <3> 40 <3> buf_dirty EQU 01000000B 41 <3> buf_isDATA EQU 00001000B 42 <3> buf_isDIR EQU 00000100B 43 <3> buf_isFAT EQU 00000010B 44 <3> buf_type_0 EQU 11110001B ; AND sets type to "none" 45 <3> 46 <3> %else 47 <3> 48 <3> ; Field definition for I/O buffer information 49 <3> 50 <3> BUFFINFO STRUC 51 <3> buf_next DW ? ; Pointer to next buffer in list 52 <3> buf_prev DW ? ; Pointer to prev buffer in list 53 <3> buf_ID DB ? ; Drive of buffer (bit 7 = 0) 54 <3> ; SFT table index (bit 7 = 1) 55 <3> ; = FFH if buffer free 56 <3> buf_flags DB ? ; Bit 7 = 1 if Remote file buffer 57 <3> ; = 0 if Local device buffer 58 <3> ; Bit 6 = 1 if buffer dirty 59 <3> ; Bit 5 = Reserved 60 <3> ; Bit 4 = Search bit (bit 7 = 1) 61 <3> ; Bit 3 = 1 if buffer is DATA 62 <3> ; Bit 2 = 1 if buffer is DIR 63 <3> ; Bit 1 = 1 if buffer is FAT 64 <3> ; Bit 0 = Reserved 65 <3> buf_sector DD ? ; Sector number of buffer (bit 7 = 0) 66 <3> ; The next two items are often refed as a word (bit 7 = 0) 67 <3> buf_wrtcnt DB ? ; For FAT sectors, # times sector written out 68 <3> buf_wrtcntinc DW ? ; " " " , # sectors between each write 69 <3> buf_DPB DD ? ; Pointer to drive parameters 70 <3> buf_fill DW ? ; How full buffer is (bit 7 = 1) 71 <3> buf_reserved DB ? ; make DWORD boundary for 386 72 <3> BUFFINFO ENDS 73 <3> 74 <3> labelsize buf_offset, dword, buf_sector 75 <3> ;For bit 7 = 1, this is the byte 76 <3> ;offset of the start of the buffer in 77 <3> ;the file pointed to by buf_ID. Thus 78 <3> ;the buffer starts at location 79 <3> ;buf_offset in the file and contains 80 <3> ;buf_fill bytes. 81 <3> 82 <3> BUFINSIZ EQU BUFFINFO_struc_size 83 <3> ; Size of structure in bytes 84 <3> 85 <3> buf_Free EQU 0FFh ; buf_id of free buffer 86 <3> 87 <3> ;Flag byte masks 88 <3> buf_isnet EQU 10000000B 89 <3> buf_dirty EQU 01000000B 90 <3> 91 <3> buf_isDATA EQU 00001000B 92 <3> buf_isDIR EQU 00000100B 93 <3> buf_isFAT EQU 00000010B 94 <3> buf_type_0 EQU 11110001B ; AND sets type to "none" 95 <3> 96 <3> buf_NetID EQU BUFINSIZ 97 <3> 98 <3> ; 99 <3> ; Buffer Hash Entry Structure 100 <3> 101 <3> BUFFER_HASH_ENTRY STRUC ; DOS 4.00 102 <3> EMS_PAGE_NUM DW ? ; logical page number for EMS handle 103 <3> BUFFER_BUCKET DD ? ; pointer to buffers 104 <3> DIRTY_COUNT DB ? ; number of dirty buffers 105 <3> BUFFER_RESERVED DB ? ; reserved 106 <3> BUFFER_HASH_ENTRY ENDS 107 <3> 108 <3> MaxBuffinBucket EQU 15 ; Max number of buffers per bucket 109 <3> MaxBucketinPage EQU 2 ; Max number of buckets per 16kb page 110 <3> 111 <3> %endif 112 <3> 113 <3> ; ; 114 <3> ; C A V E A T P R O G R A M M E R ; 115 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 74 <2> 75 <2> BREAK 76 <2> ; Location of user registers relative user stack pointer 77 <2> 78 <2> user_environ STRUC 0 00000F20 ???? user_AX DW ? 0 00000F22 ???? user_BX DW ? 0 00000F24 ???? user_CX DW ? 0 00000F26 ???? user_DX DW ? 0 00000F28 ???? user_SI DW ? 0 00000F2A ???? user_DI DW ? 0 00000F2C ???? user_BP DW ? 0 00000F2E ???? user_DS DW ? 0 00000F30 ???? user_ES DW ? 0 00000F32 ???? user_IP DW ? 0 00000F34 ???? user_CS DW ? 0 00000F36 ???? user_F DW ? 91 <2> user_environ ENDS 92 <2> 93 <2> %include "sysvar.mac" 1 <3> ; SCCSID = @(#)sysvar.asm 1.1 85/04/10 2 <3> %include "version.mac" 1 <4> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <4> TRUE EQU 0FFFFh 3 <4> TRUEBYTE EQU 0FFh 4 <4> FALSE EQU 0 5 <4> 6 <4> ; 7 <4> ; Use the following switches to control cmacros.inc 8 <4> ; 9 <4> ?PLM equ 0 10 <4> ?WIN equ 0 11 <4> 12 <4> memS EQU 1 ; Small model 13 <4> ; 14 <4> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <4> ; version of the operating system 16 <4> ; 17 <4> ; The below chart will indicate how to set the switches to build the various 18 <4> ; versions 19 <4> ; 20 <4> ; IBMVER IBMCOPYRIGHT 21 <4> ; -------------------------------------------------------- 22 <4> ; IBM Version | TRUE TRUE 23 <4> ; -------------------------------------------------------- 24 <4> ; MS Version | FALSE FALSE 25 <4> ; -------------------------------------------------------- 26 <4> ; Clone Version | TRUE FALSE 27 <4> ; 28 <4> IBMVER EQU TRUE 29 <4> IBMCOPYRIGHT EQU FALSE 30 <4> 31 <4> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <4> 33 <4> %ifndef MSVER 34 <4> MSVER EQU ~ IBMVER 35 <4> %endif 36 <4> IBM EQU IBMVER 37 <4> ; 38 <4> ; 39 <4> %IF IBMVER 40 <4> %IF IBMCOPYRIGHT 41 <4> %warning out: ... IBM version build switch on ... 42 <4> %ELSE 43 <4> %warning out: ... CLONE version build switch on ... 43 ****************** <4> warning: out: ... CLONE version build switch on ... [-w+user] 44 <4> %ENDIF 45 <4> %ELSE 46 <4> %IFN IBMCOPYRIGHT 47 <4> %warning out: ... MS version build switch on ... 48 <4> %ELSE 49 <4> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <4> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <4> %ENDIF 52 <4> %ENDIF 53 <4> ; 54 <4> ; 55 <4> ;*************************************************************************** 56 <4> ;* The following switches are for DBCS or SBCS support * 57 <4> ;* * 58 <4> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <4> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <4> ;* * 61 <4> ;*************************************************************************** 62 <4> ; 63 <4> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <4> 65 <4> ; 66 <4> ; Switch INTERNAT for DBCS support 67 <4> ; 68 <4> INTERNAT EQU FALSE 69 <4> ; 70 <4> %IF INTERNAT 71 <4> %ifndef KANJI 72 <4> KANJI EQU TRUE 73 <4> %endif 74 <4> IBMJAPAN EQU TRUE 75 <4> %ELSE 76 <4> %ifndef KANJI 77 <4> KANJI EQU FALSE 78 <4> %endif 79 <4> IBMJAPAN EQU FALSE 80 <4> %ENDIF 81 <4> 82 <4> %ifndef altvect ; avoid jerking off vector.inc 83 <4> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <4> %endif 85 <4> 86 <4> ; 87 <4> ; Country code switches 88 <4> ; The default contry code is assumed as USA. 89 <4> ; 90 <4> %IF INTERNAT 91 <4> KOREA EQU TRUE 92 <4> JAPAN EQU FALSE 93 <4> %ELSE 94 <4> KOREA EQU FALSE 95 <4> JAPAN EQU FALSE 96 <4> %ENDIF 97 <4> ; 98 <4> %IF INTERNAT 99 <4> %warning out: Internat(ECS) version build switch on 100 <4> %ENDIF 3 <3> 4 <3> SysInitVars STRUC 0 00000F20 ???????? SYSI_DPB DD ? ; DPB chain 0 00000F24 ???????? SYSI_SFT DD ? ; SFT chain 0 00000F28 ???????? SYSI_CLOCK DD ? ; CLOCK device 0 00000F2C ???????? SYSI_CON DD ? ; CON device 0 00000F30 ???? SYSI_MAXSEC DW ? ; maximum sector size 0 00000F32 ???????? SYSI_BUF DD ? ; points to Hashinitvar 0 00000F36 ???????? SYSI_CDS DD ? ; CDS list 0 00000F3A ???????? SYSI_FCB DD ? ; FCB chain 0 00000F3E ???? SYSI_Keep DW ? ; keep count 0 00000F40 ?? SYSI_NUMIO DB ? ; Number of block devices 0 00000F41 ?? SYSI_NCDS DB ? ; number of CDS's 0 00000F42 ???????? SYSI_DEV DD ? ; device list 0 00000F46 ???? SYSI_ATTR DW ? ; null device attribute word 0 00000F48 ???? SYSI_STRAT DW ? ; null device strategy entry point 0 00000F4A ???? SYSI_INTER DW ? ; null device interrupt entry point 0 00000F4C ???????????????? SYSI_NAME DB 8 DUP(?) ; null device name 0 00000F54 ?? SYSI_SPLICE DB ? ; TRUE -> splicees being done 0 00000F55 ???? SYSI_IBMDOS_SIZE DW ? ; DOS size in paragraphs 0 00000F57 ???????? SYSI_IFS_DOSCALL@ DD ? ; IFS DOS service rountine entry 0 00000F5B ???????? SYSI_IFS DD ? ; IFS header chain 0 00000F5F ???????? SYSI_BUFFERS DW ?,? ; BUFFERS= values (m,n) 0 00000F63 ?? SYSI_BOOT_DRIVE DB ? ; boot drive A=1 B=2,.. 0 00000F64 ?? SYSI_DWMOVE DB ? ; 1 if 386 machine 0 00000F65 ???? SYSI_EXT_MEM DW ? ; Extended memory size in KB. 29 <3> SysInitVars ENDS 30 <3> 31 <3> ;This is added for more information exchage between DOS, BIOS. 32 <3> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86 33 <3> SysInitVars_Ext struc 0 00000F20 ???????? SYSI_InitVars DD ? ; Points to the above structure. 0 00000F24 ???????? SYSI_Country_Tab DD ? ; DOS_Country_cdpg_info 36 <3> SysInitVars_Ext ends 37 <3> 38 <3> ;The SYSI_BUF of SysInitVars points to the follwong structure 39 <3> EMS_MAP_BUFF_SIZE EQU 12 ; EMS map buffer size 40 <3> 41 <3> Buffinfo STRUC 0 00000F20 ???????? Hash_ptr DD ? ; pointer to Hash table 0 00000F24 ???? Hash_count DW ? ; number of Hash entries 0 00000F26 ???????? Cache_ptr DD ? ; pointer to secondary cache 0 00000F2A ???? Cache_count DW ? ; number of secondary cache entries 46 <3> 47 <3> %IF BUFFERFLAG 48 <3> 0 00000F2C ?? EMS_SAFE_FLAG DB ? 0 00000F2D ???????? EMS_LAST_PAGE DW ?, ? 0 00000F31 ???????? EMS_FIRST_PAGE DW ?, ? 0 00000F35 ???? EMS_NPA640 DW ? 53 <3> 54 <3> %ENDIF 55 <3> 0 00000F37 ?? EMS_mode DB ? ; no EMS = -1 0 00000F38 ???? EMS_handle DW ? ; EMS handle for buffers 0 00000F3A ???? EMS_PageFrame_Number DW ? ; EMS page frame number 0 00000F3C ???? EMS_Seg_Cnt DW ? ; EMS segment count 0 00000F3E ???? EMS_Page_Frame DW ? ; EMS page frame segment address 0 00000F40 ???? EMS_reserved DW ? ; EMS segment count 62 <3> 63 <3> %IF BUFFERFLAG 0 00000F42 ?? EMS_Map_Buff DB ? ; map buffer 65 <3> %ELSE 66 <3> EMS_Map_Buff DB 12 dup(?) 67 <3> %ENDIF 68 <3> 69 <3> Buffinfo ENDS 70 <3> 71 <3> 72 <3> 73 <3> 74 <3> 75 <3> 76 <3> 77 <3> 94 <2> 95 <2> %include "vector.mac" 1 <3> ; SCCSID = @(#)vector.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ;Asmvar AltVect 5 <3> %ifndef AltVect 6 <3> %iassign AltVect 0 7 <3> %endif 8 <3> 9 <3> INTTAB EQU 20H 10 <3> inttab equ INTTAB ; NASM port equate 11 <3> INTBASE EQU 4 * inttab 12 <3> ENTRYPOINT EQU INTBASE+40H 13 <3> 14 <3> %IF ALTVECT 15 <3> ALTTAB EQU 0F0H 16 <3> ALTBASE EQU 4 * ALTTAB 17 <3> %ENDIF 18 <3> 19 <3> ; 20 <3> ; interrupt assignments 21 <3> ; 22 <3> %IFN ALTVECT 23 <3> int_abort EQU INTTAB ; abort process 24 <3> int_command EQU int_abort+1 ; call MSDOS 25 <3> int_terminate EQU int_abort+2 ; int to terminate address 26 <3> int_ctrl_c EQU int_abort+3 ; ^c trapper 27 <3> int_fatal_abort EQU int_abort+4 ; hard disk error 28 <3> int_disk_read EQU int_abort+5 ; logical sector disk read 29 <3> int_disk_write EQU int_abort+6 ; logical sector disk write 30 <3> int_keep_process EQU int_abort+7 ; terminate program and stay 31 <3> ; resident 32 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ; ; 35 <3> int_spooler EQU int_abort+8 ; spooler call 36 <3> int_fastcon EQU int_abort+9 ; fast CON interrupt 37 <3> int_IBM EQU int_abort+10; critical section maintenance 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <3> %ELSE 42 <3> int_abort EQU INTTAB ; abort process 43 <3> int_command EQU int_abort+1 ; call MSDOS 44 <3> int_terminate EQU ALTTAB ; int to terminate address 45 <3> int_ctrl_c EQU int_terminate+1 ; ^c trapper 46 <3> int_fatal_abort EQU int_terminate+2 ; hard disk error 47 <3> int_disk_read EQU int_abort+5 ; logical sector disk read 48 <3> int_disk_write EQU int_abort+6 ; logical sector disk write 49 <3> int_keep_process EQU int_abort+7 ; terminate program and stay resident 50 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 51 <3> ; C A V E A T P R O G R A M M E R ; 52 <3> ; ; 53 <3> int_spooler EQU int_terminate+3 ; spooler call 54 <3> int_fastcon EQU int_abort+9 ; fast CON interrupt 55 <3> ; ; 56 <3> ; C A V E A T P R O G R A M M E R ; 57 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <3> %ENDIF 59 <3> 60 <3> addr_int_abort EQU 4 * int_abort 61 <3> addr_int_command EQU 4 * int_command 62 <3> addr_int_terminate EQU 4 * int_terminate 63 <3> addr_int_ctrl_c EQU 4 * int_ctrl_c 64 <3> addr_int_fatal_abort EQU 4 * int_fatal_abort 65 <3> addr_int_disk_read EQU 4 * int_disk_read 66 <3> addr_int_disk_write EQU 4 * int_disk_write 67 <3> addr_int_keep_process EQU 4 * int_keep_process 68 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 69 <3> ; C A V E A T P R O G R A M M E R ; 70 <3> ; ; 71 <3> addr_int_spooler EQU 4 * int_spooler 72 <3> addr_int_fastcon EQU 4 * int_fastcon 73 <3> addr_int_IBM EQU 4 * int_IBM 74 <3> ; ; 75 <3> ; C A V E A T P R O G R A M M E R ; 76 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 96 <2> 97 <2> %include "mult.mac" 1 <3> ; SCCSID = @(#)mult.asm 1.2 85/04/12 2 <3> Break 3 <3> 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; Critical section definitions 8 <3> ; 9 <3> ; These below are subject to leave-all sections 10 <3> critDisk EQU 1 ; Disk I/O critical section 11 <3> critDevice EQU 2 ; Device I/O critical section 12 <3> critShare EQU 1 ; Sharer I/O critical section 13 <3> critMem EQU 1 ; memory maintenance critical section 14 <3> critNet EQU 5 ; network critical section 15 <3> critSFT EQU 1 ; sft table allocation 16 <3> critIFS EQU 6 ; ifsfunc critical section 17 <3> ; These below are not subject to leave-all sections 18 <3> critASSIGN EQU 8 ; Assign has munged a system call 19 <3> ; ; 20 <3> ; C A V E A T P R O G R A M M E R ; 21 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 22 <3> 23 <3> ; 24 <3> ; The current set of defined multiplex channels is (* means documented): 25 <3> ; 26 <3> ; Channel(h) Issuer Receiver Function 27 <3> ; 00 server PSPRINT print job control 28 <3> ; *01 print/apps PRINT Queueing of files 29 <3> ; 02 BIOS REDIR signal open/close of printers 30 <3> ; 31 <3> ; 05 command REDIR obtain text of net int 24 message 32 <3> ; *06 server/assign ASSIGN Install check 33 <3> ; 34 <3> ; 08 external driver IBMBIO interface to internal routines 35 <3> ; 36 <3> ; 10 sharer/server Sharer install check 37 <3> ; 11 DOS/server Redir install check/redirection funcs 38 <3> ; 12 sharer/redir DOS dos functions and structure maint 39 <3> ; 13 MSNET MSNET movement of NCBs 40 <3> ; 13 external driver IBMBIO Reset_Int_13, allows installation 41 <3> ; of alternative INT_13 drivers after 42 <3> ; boot_up 43 <3> ; 14 (IBM) DOS NLSFUNC down load NLS country info,DOS 3.3 44 <3> ; 14 (MS) APPS POPUP MSDOS 4 popup screen functions 45 <3> ; 15 APPS MSCDEX CD-ROM extensions interface 46 <3> ; 16 WIN386 WIN386 Windows communications 47 <3> ; 17 Clipboard WINDOWS Clipboard interface 48 <3> ; *18 Applications MS-Manger Toggle interface to manager 49 <3> ; 19 Shell 50 <3> ; 1A Ansi.sys 51 <3> ; 1B Fastopen,Vdisk IBMBIO EMS INT 67H stub handler 52 <3> ; 53 <3> ; AC Graphics 54 <3> ; AD NLS (toronto) 55 <3> ; AE 56 <3> ; AF Mode 57 <3> ; B0 GRAFTABL GRAFTABL 58 <3> ; 59 <3> 60 <3> 61 <3> ;MUX 00-3F reserverd for IBM 62 <3> ;MUX 80-BF reserverd for IBM 63 <3> ;MUX 40-7F reserved for Microsoft 64 <3> ;MUX C0-FF users 65 <3> 66 <3> 67 <3> 68 <3> MultSHARE EQU 10h ; sharer 69 <3> ; 1 MFT_enter 70 <3> ; 2 MFTClose 71 <3> ; 3 MFTclU 72 <3> ; 4 MFTCloseP 73 <3> ; 5 MFTCloN 74 <3> ; 6 set_block 75 <3> ; 7 clr_block 76 <3> ; 8 chk_block 77 <3> ; 9 MFT_get 78 <3> ; 10 ShSave 79 <3> ; 11 ShChk 80 <3> ; 12 ShCol 81 <3> ; 13 ShCloseFile 82 <3> 83 <3> MultNET EQU 11h ; Network support 84 <3> MultIFS EQU 11h ; Network support 85 <3> ; 1 IFS_RMDIR 86 <3> ; 2 IFS_SEQ_RMDIR 87 <3> ; 3 IFS_MKDIR 88 <3> ; 4 IFS_SEQ_MKDIR 89 <3> ; 5 IFS_CHDIR 90 <3> ; 6 IFS_CLOSE 91 <3> ; 7 IFS_COMMIT 92 <3> ; 8 IFS_READ 93 <3> ; 9 IFS_WRITE 94 <3> ; 10 IFS_LOCK 95 <3> ; 11 IFS_UNLOCK 96 <3> ; 12 IFS_DISK_INFO 97 <3> ; 13 IFS_SET_FILE_ATTRIBUTE 98 <3> ; 14 IFS_SEQ_SET_FILE_ATTRIBUTE 99 <3> ; 15 IFS_GET_FILE_INFO 100 <3> ; 16 IFS_SEQ_GET_FILE_INFO 101 <3> ; 17 IFS_RENAME 102 <3> ; 18 IFS_SEQ_RENAME 103 <3> ; 19 IFS_DELETE 104 <3> ; 20 IFS_SEQ_DELETE 105 <3> ; 21 IFS_OPEN 106 <3> ; 22 IFS_SEQ_OPEN 107 <3> ; 23 IFS_CREATE 108 <3> ; 24 IFS_SEQ_CREATE 109 <3> ; 25 IFS_SEQ_SEARCH_FIRST 110 <3> ; 26 IFS_SEQ_SEARCH_NEXT 111 <3> ; 27 IFS_SEARCH_FIRST 112 <3> ; 28 IFS_SEARCH_NEXT 113 <3> ; 29 IFS_ABORT 114 <3> ; 30 IFS_ASSOPER 115 <3> ; 31 Printer_SET_STRING 116 <3> ; 32 IFSFlushBuf 117 <3> ; 33 IFSBufWrite 118 <3> ; 34 IFSResetEnvironment 119 <3> ; 35 IFSSpoolCheck 120 <3> ; 36 IFSSpoolClose 121 <3> 122 <3> MultDOS EQU 12h ; DOS call back 123 <3> ; 1 DOS_CLOSE 124 <3> ; 2 RECSET 125 <3> ; 3 Get DOSGROUP 126 <3> ; 4 PATHCHRCMP 127 <3> ; 5 OUT 128 <3> ; 6 NET_I24_ENTRY 129 <3> ; 7 PLACEBUF 130 <3> ; 8 FREE_SFT 131 <3> ; 9 BUFWRITE 132 <3> ; 10 SHARE_VIOLATION 133 <3> ; 11 SHARE_ERROR 134 <3> ; 12 SET_SFT_MODE 135 <3> ; 13 DATE16 136 <3> ; 14 SETVISIT 137 <3> ; 15 SCANPLACE 138 <3> ; 16 SKIPVISIT 139 <3> ; 17 StrCpy 140 <3> ; 18 StrLen 141 <3> ; 19 Ucase 142 <3> ; 20 POINTCOMP 143 <3> ; 21 CHECKFLUSH 144 <3> ; 22 SFFromSFN 145 <3> ; 23 GetCDSFromDrv 146 <3> ; 24 Get_User_Stack 147 <3> ; 25 GetThisDrv 148 <3> ; 26 DriveFromText 149 <3> ; 27 SETYEAR 150 <3> ; 28 DSUM 151 <3> ; 29 DSLIDE 152 <3> ; 30 StrCmp 153 <3> ; 31 initcds 154 <3> ; 32 pjfnfromhandle 155 <3> ; 33 $NameTrans 156 <3> ; 34 CAL_LK 157 <3> ; 35 DEVNAME 158 <3> ; 36 Idle 159 <3> ; 37 DStrLen 160 <3> ; 38 NLS_OPEN DOS 3.3 161 <3> ; 39 $CLOSE DOS 3.3 162 <3> ; 40 NLS_LSEEK DOS 3.3 163 <3> ; 41 $READ DOS 3.3 164 <3> ; 42 FastInit DOS 4.0 165 <3> ; 43 NLS_IOCTL DOS 3.3 166 <3> ; 44 GetDevList DOS 3.3 167 <3> ; 45 NLS_GETEXT DOS 3.3 168 <3> ; 46 MSG_RETRIEVAL DOS 4.0 169 <3> ; 47 FAKE_VERSION DOS 4.0 170 <3> ; 171 <3> NLSFUNC EQU 14h ; NLSFUNC CALL , DOS 3.3 172 <3> ; 0 NLSInstall 173 <3> ; 1 ChgCodePage 174 <3> ; 2 GetExtInfo 175 <3> ; 3 SetCodePage 176 <3> ; 4 GetCntry 177 <3> ; 178 <3> ;FASTOPEN is not chained through INT 2F ; DOS 3.3 F.C. 179 <3> ; it calls Multdos 42 to set up an entry routine address 180 <3> ; 0 Install status (reserved) 181 <3> ; 1 Lookup 182 <3> ; 2 Insert 183 <3> ; 3 Delete 184 <3> ; 4 Purge (reserved) 98 <2> 99 <2> BREAK 100 <2> ; MSDOS partitions the disk into 4 sections: 101 <2> ; 102 <2> ; phys sector 0: +-------------------+ 103 <2> ; | | boot/reserved | 104 <2> ; | +-------------------+ 105 <2> ; | | File allocation | 106 <2> ; v | table(s) | 107 <2> ; | (multiple copies | 108 <2> ; | are kept) | 109 <2> ; +-------------------+ 110 <2> ; | Directory | 111 <2> ; +-------------------+ 112 <2> ; | File space | 113 <2> ; +-------------------+ 114 <2> ; | Unaddressable | 115 <2> ; | (to end of disk) | 116 <2> ; +-------------------+ 117 <2> ; 118 <2> ; All partition boundaries are sector boundaries. The size of the FAT is 119 <2> ; adjusted to maximize the file space addressable. 120 <2> 121 <2> %include "dirent.mac" 1 <3> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 3 <3> Break 4 <3> 5 <3> ; 6 <3> ; +---------------------------+ 7 <3> ; | (12 BYTE) filename/ext | 0 0 8 <3> ; +---------------------------+ 9 <3> ; | (BYTE) attributes | 11 B 10 <3> ; +---------------------------+ 11 <3> ; | (10 BYTE) reserved | 12 C 12 <3> ; +---------------------------+ 13 <3> ; | (WORD) time of last write | 22 16 14 <3> ; +---------------------------+ 15 <3> ; | (WORD) date of last write | 24 18 16 <3> ; +---------------------------+ 17 <3> ; | (WORD) First cluster | 26 1A 18 <3> ; +---------------------------+ 19 <3> ; | (DWORD) file size | 28 1C 20 <3> ; +---------------------------+ 21 <3> ; 22 <3> ; First byte of filename = E5 -> free directory entry 23 <3> ; = 00 -> end of allocated directory 24 <3> ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour 25 <3> ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980 26 <3> ; 27 <3> 28 <3> dir_entry STRUC 29 00000000 <3> dir_name DB 11 DUP (?) ; file name 0 00000F2B ?? dir_attr DB ? ; attribute bits 0 00000F2C ???? dir_codepg dw ? ; code page DOS 4.00 0 00000F2E ???? dir_extcluster dw ? ; extended attribute starting cluster 0 00000F30 ?? dir_attr2 db ? ; reserved 0 00000F31 ?????????? dir_pad DB 5 DUP (?) ; reserved for expansion 0 00000F36 ???? dir_time DW ? ; time of last write 0 00000F38 ???? dir_date DW ? ; date of last write 0 00000F3A ???? dir_first DW ? ; first allocation unit of file 0 00000F3C ???? dir_size_l DW ? ; low 16 bits of file size 0 00000F3E ???? dir_size_h DW ? ; high 16 bits of file size 40 <3> dir_entry ENDS 41 <3> 42 <3> attr_read_only EQU 1h 43 <3> attr_hidden EQU 2h 44 <3> attr_system EQU 4h 45 <3> attr_volume_id EQU 8h 46 <3> attr_directory EQU 10h 47 <3> attr_archive EQU 20h 48 <3> attr_device EQU 40h ; This is a VERY special bit. 49 <3> ; NO directory entry on a disk EVER 50 <3> ; has this bit set. It is set non-zero 51 <3> ; when a device is found by GETPATH 52 <3> 53 <3> attr_all EQU attr_hidden+attr_system+attr_directory 54 <3> ; OR of hard attributes for FINDENTRY 55 <3> 56 <3> attr_ignore EQU attr_read_only+attr_archive+attr_device 57 <3> ; ignore this(ese) attribute(s) during 58 <3> ; search first/next 59 <3> 60 <3> attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive 61 <3> ; changeable via CHMOD 122 <2> 123 <2> BREAK 124 <2> ; 125 <2> ; The File Allocation Table uses a 12-bit entry for each allocation unit on 126 <2> ; the disk. These entries are packed, two for every three bytes. The contents 127 <2> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result 128 <2> ; to the base address of the Allocation Table; 3) fetching the 16-bit word 129 <2> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift 130 <2> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex). Entry 131 <2> ; number zero is used as an end-of-file trap in the OS and is passed to the 132 <2> ; BIOS to help determine disk format. Entry 1 is reserved for future use. 133 <2> ; The first available allocation unit is assigned entry number two, and even 134 <2> ; though it is the first, is called cluster 2. Entries greater than 0FF8H 135 <2> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero 136 <2> ; are unallocated. Otherwise, the contents of a FAT entry is the number of 137 <2> ; the next cluster in the file. 138 <2> ; 139 <2> ; Clusters with bad sectors are tagged with FF7H. Any non-zero number would 140 <2> ; do because these clusters show as allocated, but are not part of any 141 <2> ; allocation chain and thus will never be allocated to a file. A particular 142 <2> ; number is selected so that disk checking programs know what to do (ie. a 143 <2> ; cluster with entry FF7H which is not in a chain is not an error). 144 <2> 145 <2> %include "dpb.mac" 1 <3> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> dpb STRUC 0 00000F20 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 00000F21 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 00000F22 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 00000F24 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 00000F25 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 00000F26 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 00000F28 ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 00000F29 ???? dpb_root_entries DW ? ; Number of directory entries 0 00000F2B ???? dpb_first_sector DW ? ; First sector of first cluster 0 00000F2D ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 00000F2F ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 00000F31 ???? dpb_dir_sector DW ? ; Starting record of directory 0 00000F33 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 00000F37 ?? dpb_media DB ? ; Media byte 0 00000F38 ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <3> ; check the first time this DPB is used 0 00000F39 ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 00000F3D ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 00000F3F ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <3> dpb ENDS 28 <3> 29 <3> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <3> 31 <3> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <3> ; ; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 146 <2> 147 <2> %include "curdir.mac" 1 <3> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; CDS items are used bu the internal routines to store cluster numbers and ; 8 <3> ; network identifiers for each logical name. The ID field is used dually, ; 9 <3> ; both as net ID and for a cluster number for local devices. In the case ; 10 <3> ; of local devices, the cluster number will be -1 if there is a potential ; 11 <3> ; of the disk being changed or if the path must be recracked. The END ; 12 <3> ; field is the location of the end of the definition. No .. is allowed ; 13 <3> ; past this point ; 14 <3> 15 <3> DIRSTRLEN EQU 64+3 ; Max length in bytes of directory strings 16 <3> TEMPLEN EQU DIRSTRLEN*2 17 <3> 18 <3> curdir_list STRUC 19 00000000 <3> curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 0 00000F63 ???? curdir_flags DW ? ; various flags 0 00000F65 ???????? curdir_devptr DD ? ; local pointer to DPB or net device 0 00000F69 ???? curdir_ID DW ? ; cluster of current dir (net ID) 0 00000F6B ???? DW ? 0 00000F6D ???? curdir_user_word DW ? 0 00000F6F ???? curdir_end DW ? ; end of assignment 0 00000F71 ?? curdir_type DB ? ; IFS drive (2=ifs, 4=netuse) 0 00000F72 ???????? curdir_ifs_hdr DD ? ; Ptr to File System Header 0 00000F76 ???? curdir_fsda DB 2 DUP (?) ; File System Dependent Data Area 29 <3> curdir_list ENDS 30 <3> 31 <3> curdirLen EQU curdir_list_struc_size ; Needed for screwed up 32 <3> ; ASM87 which doesn't allow 33 <3> ; Size directive as a macro 34 <3> ; argument 35 <3> labelsize curdir_netID, dword, curdir_ID 36 <3> 37 <3> ;Flag word masks 38 <3> curdir_isnet EQU 1000000000000000B 39 <3> curdir_isifs EQU 1000000000000000B ; DOS 4.00 40 <3> curdir_inuse EQU 0100000000000000B 41 <3> curdir_splice EQU 0010000000000000B 42 <3> curdir_local EQU 0001000000000000B 43 <3> ; ; 44 <3> ; C A V E A T P R O G R A M M E R ; 45 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 148 <2> 149 <2> %include "cpmfcb.mac" 1 <3> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 3 <3> ;BREAK 4 <3> 5 <3> ; 6 <3> ; Field definition for FCBs 7 <3> ; The FCB has the following structure: 8 <3> ; 9 <3> ; +---------------------------+ 10 <3> ; | Drive indicator(byte) | 11 <3> ; +---------------------------+ 12 <3> ; | Filename (8 chars) | 13 <3> ; +---------------------------+ 14 <3> ; | Extension (3 chars) | 15 <3> ; +---------------------------+ 16 <3> ; | Current Extent(word) | 17 <3> ; +---------------------------+ 18 <3> ; | Record size (word) | 19 <3> ; +---------------------------+ 20 <3> ; | File Size (2 words) | 21 <3> ; +---------------------------+ 22 <3> ; | Date of write | 23 <3> ; +---------------------------+ 24 <3> ; | Time of write | 25 <3> ; +---------------------------+ 26 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 27 <3> ; C A V E A T P R O G R A M M E R ; 28 <3> ; ; 29 <3> ; +---------------------------+ 30 <3> ; | 8 bytes reserved | 31 <3> ; +---------------------------+ 32 <3> ; ; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 35 <3> ; | next record number | 36 <3> ; +---------------------------+ 37 <3> ; | random record number | 38 <3> ; +---------------------------+ 39 <3> ; 40 <3> 41 <3> sys_fcb STRUC 0 00000F20 ?? fcb_drive DB ? 0 00000F21 ???????????????? fcb_name DB 8 DUP (?) 0 00000F29 ?????? fcb_ext DB 3 DUP (?) 0 00000F2C ???? fcb_EXTENT DW ? 0 00000F2E ???? fcb_RECSIZ DW ? ; Size of record (user settable) 0 00000F30 ???? fcb_FILSIZ DW ? ; Size of file in bytes; used with the 48 <3> ; following word 0 00000F32 ???? fcb_DRVBP DW ? ; BP for SEARCH FIRST and SEARCH NEXT 0 00000F34 ???? fcb_FDATE DW ? ; Date of last writing 0 00000F36 ???? fcb_FTIME DW ? ; Time of last writing 52 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 53 <3> ; C A V E A T P R O G R A M M E R ; 54 <3> ; ; 0 00000F38 ???????????????? fcb_reserved DB 8 DUP (?) ; RESERVED 56 <3> ; ; 57 <3> ; C A V E A T P R O G R A M M E R ; 58 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000F40 ?? fcb_NR DB ? ; Next record 0 00000F41 ???????? fcb_RR DB 4 DUP (?) ; Random record 61 <3> sys_fcb ENDS 62 <3> 63 <3> FILDIRENT equ fcb_FILSIZ ; Used only by SEARCH FIRST and SEARCH 64 <3> ; NEXT 65 <3> 66 <3> labelsize fcb_sfn, byte, fcb_reserved 67 <3> 68 <3> ; Note that fcb_net_handle, fcb_nsl_drive, fcb_nsld_drive and fcb_l_drive 69 <3> ; all must point to the same byte. Otherwise, the FCBRegen will fail. 70 <3> ; NOTE about this byte (fcb_nsl_drive) 71 <3> ; The high two bits of this byte are used as follows to indicate the FCB type 72 <3> ; 00 means a local file or device with sharing loaded 73 <3> ; 10 means a remote (network) file 74 <3> ; 01 means a local file with no sharing loaded 75 <3> ; 11 means a local device with no sharing loaded 76 <3> 77 <3> ; 78 <3> ; Network FCB 79 <3> ; 80 <3> labelsize fcb_net_drive, byte, fcb_reserved+1 81 <3> labelsize fcb_net_handle, word, fcb_reserved+2 82 <3> labelsize fcb_netID, dword, fcb_reserved+4 83 <3> 84 <3> ; 85 <3> ; No sharing local file FCB 86 <3> ; 87 <3> labelsize fcb_nsl_drive, byte, fcb_reserved+1 88 <3> labelsize fcb_nsl_bits, byte, fcb_reserved+2 89 <3> labelsize fcb_nsl_firclus, word, fcb_reserved+3 90 <3> labelsize fcb_nsl_dirsec, word, fcb_reserved+5 91 <3> labelsize fcb_nsl_dirpos, byte, fcb_reserved+7 92 <3> 93 <3> ; 94 <3> ; No sharing local device FCB 95 <3> ; 96 <3> labelsize fcb_nsld_drive, byte, fcb_reserved+1 97 <3> labelsize fcb_nsld_drvptr, dword, fcb_reserved+2 98 <3> 99 <3> ; 100 <3> ; Sharing local FCB 101 <3> ; 102 <3> labelsize fcb_l_drive, byte, fcb_reserved+1 103 <3> labelsize fcb_l_firclus, word, fcb_reserved+2 104 <3> labelsize fcb_l_mfs, word, fcb_reserved+4 105 <3> labelsize fcb_l_attr, byte, fcb_reserved+6 106 <3> 107 <3> ; 108 <3> ; Bogusness: the four cases are: 109 <3> ; 110 <3> ; local file 00 111 <3> ; local device 40 112 <3> ; local sharing C0 113 <3> ; network 80 114 <3> ; 115 <3> ; Since sharing and network collide, we cannot use a test instruction for 116 <3> ; deciding whether a network or a share check in involved 117 <3> ; 118 <3> FCBDEVICE EQU 040h 119 <3> FCBNETWORK EQU 080h 120 <3> FCBSHARE EQU 0C0h 121 <3> 122 <3> ; FCBSPECIAL must be able to mask off both net and share 123 <3> FCBSPECIAL EQU 080h 124 <3> FCBMASK EQU 0C0h 150 <2> 151 <2> %include "find.mac" 1 <3> ; SCCSID = @(#)find.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)find.asm 1.1 85/04/10 3 <3> Break 4 <3> 5 <3> find_buf STRUC 6 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 7 <3> ; C A V E A T P R O G R A M M E R ; 8 <3> ; ; 0 00000F20 ?? find_buf_drive DB ? ; drive of search 10 00000001 <3> find_buf_name DB 11 DUP (?) ; formatted name 0 00000F2C ?? find_buf_sattr DB ? ; attribute of search 0 00000F2D ???? find_buf_LastEnt DW ? ; LastEnt 0 00000F2F ???? find_buf_DirStart DW ? ; DirStart 0 00000F31 ???????? find_buf_NetID DB 4 DUP (?) ; Reserved for NET 15 <3> ; ; 16 <3> ; C A V E A T P R O G R A M M E R ; 17 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 18 <3> 0 00000F35 ?? find_buf_attr DB ? ; attribute found 0 00000F36 ???? find_buf_time DW ? ; time 0 00000F38 ???? find_buf_date DW ? ; date 0 00000F3A ???? find_buf_size_l DW ? ; low(size) 0 00000F3C ???? find_buf_size_h DW ? ; high(size) 24 0000001E <3> find_buf_pname DB 13 DUP (?) ; packed name 25 <3> find_buf ENDS 152 <2> 153 <2> %include "pdb.mac" 1 <3> ; SCCSID = @(#)pdb.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ; 5 <3> ; Process data block (otherwise known as program header) 6 <3> ; 7 <3> 8 <3> FilPerProc EQU 20 9 <3> 10 <3> Process_data_block STRUC 0 00000F20 ???? PDB_Exit_Call DW ? ; INT int_abort system terminate 0 00000F22 ???? PDB_block_len DW ? ; size of execution block 0 00000F24 ?? DB ? 0 00000F25 ?????????? PDB_CPM_Call DB 5 DUP (?) ; ancient call to system 0 00000F2A ???????? PDB_Exit DD ? ; pointer to exit routine 0 00000F2E ???????? PDB_Ctrl_C DD ? ; pointer to ^C routine 0 00000F32 ???????? PDB_Fatal_abort DD ? ; pointer to fatal error 18 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 <3> ; C A V E A T P R O G R A M M E R ; 20 <3> ; ; 0 00000F36 ???? PDB_Parent_PID DW ? ; PID of parent (terminate PID) 22 00000018 <3> PDB_JFN_Table DB FilPerProc DUP (?) 23 <3> ; indices into system table 24 <3> ; ; 25 <3> ; C A V E A T P R O G R A M M E R ; 26 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000F4C ???? PDB_environ DW ? ; seg addr of environment 28 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 29 <3> ; C A V E A T P R O G R A M M E R ; 30 <3> ; ; 0 00000F4E ???????? PDB_User_stack DD ? ; stack of self during system calls 0 00000F52 ???? PDB_JFN_Length DW ? ; number of handles allowed 0 00000F54 ???????? PDB_JFN_Pointer DD ? ; pointer to JFN table 0 00000F58 ???????? PDB_Next_PDB DD ? ; pointer to nested PDB's 35 0000003C <3> PDB_PAD1 DB 14h DUP (?) 36 <3> ; ; 37 <3> ; C A V E A T P R O G R A M M E R ; 38 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000F70 ?????????? PDB_Call_system DB 5 DUP (?) ; portable method of system call 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <3> ; C A V E A T P R O G R A M M E R ; 42 <3> ; ; 0 00000F75 ?????????????? PDB_PAD2 DB 7h DUP (?) 44 <3> ; ; 45 <3> ; C A V E A T P R O G R A M M E R ; 46 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 47 <3> Process_data_block ENDS 48 <3> 49 <3> labelsize PDB_InterCon, byte, PDB_PAD1 ; 2/12/KK 50 <3> labelsize PDB_Append, byte, PDB_PAD1+1 ; 2/12/KK 154 <2> 155 <2> %include "exe.mac" 1 <3> ; SCCSID = @(#)exe.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)exe.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ; 5 <3> ; EXEC arg block - load/go program 6 <3> ; 7 <3> 8 <3> ; 9 <3> ; The following get used as arguments to the EXEC system call. They indicate 10 <3> ; whether or not the program is executed or whether or not a program header 11 <3> ; gets created. 12 <3> ; 13 <3> exec_func_no_execute EQU 1 ; no execute bit 14 <3> exec_func_overlay EQU 2 ; overlay bit 15 <3> 16 <3> Exec0 STRUC 0 00000F20 ???? Exec0_environ DW ? ; seg addr of environment 0 00000F22 ???????? Exec0_com_line DD ? ; pointer to asciz command line 0 00000F26 ???????? Exec0_5C_FCB DD ? ; default fcb at 5C 0 00000F2A ???????? Exec0_6C_FCB DD ? ; default fcb at 6C 21 <3> Exec0 ENDS 22 <3> 23 <3> Exec1 STRUC 0 00000F20 ???? Exec1_environ DW ? ; seg addr of environment 0 00000F22 ???????? Exec1_com_line DD ? ; pointer to asciz command line 0 00000F26 ???????? Exec1_5C_FCB DD ? ; default fcb at 5C 0 00000F2A ???????? Exec1_6C_FCB DD ? ; default fcb at 6C 0 00000F2E ???? Exec1_SP DW ? ; stack pointer of program 0 00000F30 ???? Exec1_SS DW ? ; stack seg register of program 0 00000F32 ???? Exec1_IP DW ? ; entry point IP 0 00000F34 ???? Exec1_CS DW ? ; entry point CS 32 <3> Exec1 ENDS 33 <3> 34 <3> Exec3 STRUC 0 00000F20 ???? Exec3_load_addr DW ? ; seg address of load point 0 00000F22 ???? Exec3_reloc_fac DW ? ; relocation factor 37 <3> Exec3 ENDS 38 <3> 39 <3> ; 40 <3> ; Exit codes in upper byte 41 <3> ; 42 <3> Exit_terminate EQU 0 43 <3> Exit_abort EQU 0 44 <3> Exit_Ctrl_C EQU 1 45 <3> Exit_Hard_Error EQU 2 46 <3> Exit_Keep_process EQU 3 47 <3> 48 <3> ; 49 <3> ; EXE file header 50 <3> ; 51 <3> 52 <3> EXE_file STRUC 0 00000F20 ???? exe_signature DW ? ; must contain 4D5A (yay zibo!) 0 00000F22 ???? exe_len_mod_512 DW ? ; low 9 bits of length 0 00000F24 ???? exe_pages DW ? ; number of 512b pages in file 0 00000F26 ???? exe_rle_count DW ? ; count of reloc entries 0 00000F28 ???? exe_par_dir DW ? ; number of paragraphs before image 0 00000F2A ???? exe_min_BSS DW ? ; minimum number of para of BSS 0 00000F2C ???? exe_max_BSS DW ? ; max number of para of BSS 0 00000F2E ???? exe_SS DW ? ; stack of image 0 00000F30 ???? exe_SP DW ? ; SP of image 0 00000F32 ???? exe_chksum DW ? ; checksum of file (ignored) 0 00000F34 ???? exe_IP DW ? ; IP of entry 0 00000F36 ???? exe_CS DW ? ; CS of entry 0 00000F38 ???? exe_rle_table DW ? ; byte offset of reloc table 0 00000F3A ???? exe_iov DW ? ; overlay number (0 for root) 0 00000F3C ???????? exe_sym_tab DD ? ; offset of symbol table in file 68 <3> EXE_file ENDS 69 <3> 70 <3> exe_valid_signature EQU 5A4Dh 71 <3> exe_valid_old_signature EQU 4D5Ah 72 <3> 73 <3> symbol_entry STRUC 0 00000F20 ???????? sym_value DD ? 0 00000F24 ???? sym_type DW ? 0 00000F26 ?? sym_len DB ? 77 00000007 <3> sym_name DB 255 dup (?) 78 <3> symbol_entry ENDS 156 <2> 157 <2> %include "sf.mac" 1 <3> ; SCCSID = @(#)sf.asm 1.1 85/04/10 2 <3> BREAK 3 <3> ; 4 <3> ; AN000 version 4.00 Jan. 1988 5 <3> ; AN003 PTM 3680 -- make NAME offset the same as before (<=3.30) 6 <3> ; AN009 PTM 3839 reorder SFT for MS WINDOWS 7 <3> 8 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 9 <3> ; C A V E A T P R O G R A M M E R ; 10 <3> ; ; 11 <3> ; 12 <3> ; system file table 13 <3> ; 14 <3> 15 <3> SF STRUC 0 00000F20 ???????? SFLink DD ? 0 00000F24 ???? SFCount DW ? ; number of entries 0 00000F26 ???? SFTable DW ? ; beginning of array of the following 19 <3> SF ENDS 20 <3> 21 <3> ; 22 <3> ; system file table entry 23 <3> ; 24 <3> 25 <3> sf_entry STRUC 0 00000F20 ???? sf_ref_count DW ? ; number of processes sharing entry 27 <3> ; if FCB then ref count 0 00000F22 ???? sf_mode DW ? ; mode of access or high bit on if FCB 0 00000F24 ?? sf_attr DB ? ; attribute of file 0 00000F25 ???? sf_flags DW ? ;Bits 8-15 31 <3> ; Bit 15 = 1 if remote file 32 <3> ; = 0 if local file or device 33 <3> ; Bit 14 = 1 if date/time is not to be 34 <3> ; set from clock at CLOSE. Set by 35 <3> ; FILETIMES and FCB_CLOSE. Reset by 36 <3> ; other reseters of the dirty bit 37 <3> ; (WRITE) 38 <3> ; Bit 13 = Pipe bit (reserved) 39 <3> ; 40 <3> ; Bits 0-7 (old FCB_devid bits) 41 <3> ; If remote file or local file, bit 42 <3> ; 6=0 if dirty Device ID number, bits 43 <3> ; 0-5 if local file. 44 <3> ; bit 7=0 for local file, bit 7 45 <3> ; =1 for local I/O device 46 <3> ; If local I/O device, bit 6=0 if EOF (input) 47 <3> ; Bit 5=1 if Raw mode 48 <3> ; Bit 0=1 if console input device 49 <3> ; Bit 1=1 if console output device 50 <3> ; Bit 2=1 if null device 51 <3> ; Bit 3=1 if clock device 0 00000F27 ???????? sf_devptr DD ? ; Points to DPB if local file, points 53 <3> ; to device header if local device, 54 <3> ; points to net device header if 55 <3> ; remote 0 00000F2B ???? sf_firclus DW ? ; First cluster of file (bit 15 = 0) 0 00000F2D ???? sf_time DW ? ; Time associated with file 0 00000F2F ???? sf_date DW ? ; Date associated with file 0 00000F31 ???????? sf_size DD ? ; Size associated with file 0 00000F35 ???????? sf_position DD ? ; Read/Write pointer or LRU count for FCBs 61 <3> ; 62 <3> ; Starting here, the next 7 bytes may be used by the file system to store an 63 <3> ; ID 64 <3> ; 0 00000F39 ???? sf_cluspos DW ? ; Position of last cluster accessed 0 00000F3B ???????? sf_dirsec DD ? ; Sector number of directory sector for 67 <3> ; for this file 0 00000F3F ?? sf_dirpos DB ? ; Offset of this entry in the above 69 <3> ; 70 <3> ; End of 7 bytes of file-system specific info. 71 <3> ; 72 00000020 <3> sf_name DB 11 DUP (?) ; 11 character name that is in the 73 <3> ; directory entry. This is used by 74 <3> ; close to detect file deleted and 75 <3> ; disk changed errors. 76 <3> 77 <3> ; SHARING INFO 0 00000F4B ???????? sf_chain DD ? ; link to next SF 0 00000F4F ???? sf_UID DW ? 0 00000F51 ???? sf_PID DW ? 0 00000F53 ???? sf_MFT DW ? 0 00000F55 ???? sf_lstclus DW ? ;AN009; Last cluster accessed 0 00000F57 ???????? sf_IFS_HDR DD ? 84 <3> sf_entry ENDS 85 <3> 86 <3> labelsize sf_fsda, byte, sf_cluspos ;DOS 4.00 87 <3> labelsize sf_serial_ID, word, sf_firclus ;DOS 4.00 88 <3> labelsize sf_netid, byte, sf_cluspos 89 <3> labelsize sf_OpenAge, word, sf_position+2 90 <3> labelsize sf_LRU, word, sf_position 91 <3> 92 <3> sf_default_number EQU 5h 93 <3> 94 <3> ; 95 <3> ; Note that we need to mark an SFT as being busy for OPEN/CREATE. This is 96 <3> ; because an INT 24 may prevent us from 'freeing' it. We mark this as such 97 <3> ; by placing a -1 in the ref_count field. 98 <3> ; 99 <3> 100 <3> sf_busy EQU -1 101 <3> 102 <3> 103 <3> ; mode mask for FCB detection 104 <3> sf_isfcb EQU 1000000000000000B 105 <3> 106 <3> ; Flag word masks 107 <3> sf_isnet EQU 1000000000000000B 108 <3> sf_close_nodate EQU 0100000000000000B 109 <3> sf_pipe EQU 0010000000000000B 110 <3> sf_no_inherit EQU 0001000000000000B 111 <3> sf_net_spool EQU 0000100000000000B 112 <3> Handle_Fail_I24 EQU 0000000100000000B ;BIT 8 - DISK FULL I24 ERROR 113 <3> 114 <3> ; Local file/device flag masks 115 <3> devid_file_clean EQU 40h ; true if file and not written 116 <3> devid_file_mask_drive EQU 3Fh ; mask for drive number 117 <3> 118 <3> devid_device EQU 80h ; true if a device 119 <3> devid_device_EOF EQU 40h ; true if end of file reached 120 <3> devid_device_raw EQU 20h ; true if in raw mode 121 <3> devid_device_special EQU 10h ; true if special device 122 <3> devid_device_clock EQU 08h ; true if clock device 123 <3> devid_device_null EQU 04h ; true if null device 124 <3> devid_device_con_out EQU 02h ; true if console output 125 <3> devid_device_con_in EQU 01h ; true if consle input 126 <3> ; ; 127 <3> ; C A V E A T P R O G R A M M E R ; 128 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 129 <3> 130 <3> ; 131 <3> ; structure of devid field as returned by IOCTL is: 132 <3> ; 133 <3> ; BIT 7 6 5 4 3 2 1 0 134 <3> ; |---|---|---|---|---|---|---|---| 135 <3> ; | I | E | R | S | I | I | I | I | 136 <3> ; | S | O | A | P | S | S | S | S | 137 <3> ; | D | F | W | E | C | N | C | C | 138 <3> ; | E | | | C | L | U | O | I | 139 <3> ; | V | | | L | K | L | T | N | 140 <3> ; |---|---|---|---|---|---|---|---| 141 <3> ; ISDEV = 1 if this channel is a device 142 <3> ; = 0 if this channel is a disk file 143 <3> ; 144 <3> ; If ISDEV = 1 145 <3> ; 146 <3> ; EOF = 0 if End Of File on input 147 <3> ; RAW = 1 if this device is in Raw mode 148 <3> ; = 0 if this device is cooked 149 <3> ; ISCLK = 1 if this device is the clock device 150 <3> ; ISNUL = 1 if this device is the null device 151 <3> ; ISCOT = 1 if this device is the console output 152 <3> ; ISCIN = 1 if this device is the console input 153 <3> ; 154 <3> ; If ISDEV = 0 155 <3> ; EOF = 0 if channel has been written 156 <3> ; Bits 0-5 are the block device number for 157 <3> ; the channel (0 = A, 1 = B, ...) 158 <3> ; 159 <3> devid_ISDEV EQU 80h 160 <3> devid_EOF EQU 40h 161 <3> devid_RAW EQU 20h 162 <3> devid_SPECIAL EQU 10H 163 <3> devid_ISCLK EQU 08h 164 <3> devid_ISNUL EQU 04h 165 <3> devid_ISCOT EQU 02h 166 <3> devid_ISCIN EQU 01h 167 <3> 168 <3> devid_block_dev EQU 1Fh ; mask for block device number 158 <2> 159 <2> %include "arena.mac" 1 <3> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <3> ;BREAK 3 <3> 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; 8 <3> ; arena item 9 <3> ; 10 <3> arena STRUC 0 00000F20 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00000F21 ???? arena_owner DW ? ; owner of arena item 0 00000F23 ???? arena_size DW ? ; size in paragraphs of item 0 00000F25 ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00000F28 ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <3> arena ENDS 17 <3> 18 <3> ; 19 <3> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <3> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <3> ; them and change ALLOC.ASM. 22 <3> 23 <3> arena_owner_system EQU 0 ; free block indication 24 <3> 25 <3> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <3> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <3> ; ; 28 <3> ; C A V E A T P R O G R A M M E R ; 29 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <3> 160 <2> 161 <2> %include "intnat.mac" 1 <3> ; SCCSID = @(#)intnat.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ; 5 <3> ; Current structure of the data returned by the international call 6 <3> ; 7 <3> internat_block STRUC 0 00000F20 ???? Date_tim_format DW ? ; 0-USA, 1-EUR, 2-JAP 0 00000F22 ?? Currency_sym DB ? ; Currency Symbol 5 bytes 0 00000F23 ?? DB ? 0 00000F24 ?? DB ? 0 00000F25 ?? DB ? 0 00000F26 ?? DB ? 0 00000F27 ?? Thous_sep DB ? ; Thousands separator 2 bytes 0 00000F28 ?? DB ? 0 00000F29 ?? Decimal_sep DB ? ; Decimal separator 2 bytes 0 00000F2A ?? DB ? 0 00000F2B ?? Date_sep DB ? ; Date separator 2 bytes 0 00000F2C ?? DB ? 0 00000F2D ?? Time_sep DB ? ; Decimal separator 2 bytes 0 00000F2E ?? DB ? 0 00000F2F ?? Bit_field DB ? ; Bit values 23 <3> ; Bit 0 = 0 if currency symbol first 24 <3> ; = 1 if currency symbol last 25 <3> ; Bit 1 = 0 if No space after currency symbol 26 <3> ; = 1 if space after currency symbol 0 00000F30 ?? Currency_cents DB ? ; Number of places after currency dec point 0 00000F31 ?? Time_24 DB ? ; 1 if 24 hour time, 0 if 12 hour time 0 00000F32 ???? Map_call DW ? ; Address of case mapping call (DWORD) 0 00000F34 ???? DW ? ; THIS IS TWO WORDS SO IT CAN BE INITIALIZED 31 <3> ; in pieces. 0 00000F36 ?? Data_sep DB ? ; Data list separator character 0 00000F37 ?? DB ? 34 <3> internat_block ENDS 35 <3> 36 <3> ; 37 <3> ; Max size of the block returned by the INTERNATIONAL call 38 <3> ; 39 <3> internat_block_max EQU 32 162 <2> 163 <2> %include "mi.mac" 1 <3> ; SCCSID = @(#)mi.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> mi_INT EQU 0CDh 5 <3> mi_Long_JMP EQU 0EAh 6 <3> mi_Long_CALL EQU 09Ah 7 <3> mi_Long_RET EQU 0CBh 8 <3> mi_Near_RET EQU 0C3h 9 <3> 10 <3> ; xxxxoditszxaxpxc 11 <3> f_Overflow EQU 0000100000000000B 12 <3> f_Direction EQU 0000010000000000B 13 <3> f_Interrupt EQU 0000001000000000B 14 <3> f_Trace EQU 0000000100000000B 15 <3> f_Sign EQU 0000000010000000B 16 <3> f_Zero EQU 0000000001000000B 17 <3> f_Aux EQU 0000000000010000B 18 <3> f_Parity EQU 0000000000000100B 19 <3> f_Carry EQU 0000000000000001B 164 <2> 165 <2> fChk equ 1 166 <2> fDelim equ 2 167 <2> fSpChk equ 4 168 <2> fFCB equ 8 169 <2> 170 <2> %include "filemode.mac" 1 <3> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 3 <3> BREAK 4 <3> 5 <3> stdin EQU 0 6 <3> stdout EQU 1 7 <3> stderr EQU 2 8 <3> stdaux EQU 3 9 <3> stdprn EQU 4 10 <3> 11 <3> BREAK 12 <3> 13 <3> access_mask EQU 0FH 14 <3> open_for_read EQU 00h 15 <3> open_for_write EQU 01h 16 <3> open_for_both EQU 02h 17 <3> 18 <3> sharing_mask EQU 0F0H 19 <3> sharing_compat EQU 000H 20 <3> sharing_deny_both EQU 010H 21 <3> sharing_deny_write EQU 020H 22 <3> sharing_deny_read EQU 030H 23 <3> sharing_deny_none EQU 040H 24 <3> sharing_net_FCB EQU 070h 25 <3> sharing_no_inherit EQU 080H 26 <3> 27 <3> BREAK 28 <3> 29 <3> no_code_page_check EQU 0100H 30 <3> int_24_error EQU 2000H 31 <3> auto_commit_write EQU 4000H 32 <3> ext_open_on EQU 01H 33 <3> ext_file_not_exists EQU 04H 34 <3> ext_open_I24_off EQU 02H 35 <3> io_mode_id EQU 00000010B 36 <3> reserved_bits_mask EQU 0FE00H 37 <3> exists_mask EQU 0FH 38 <3> not_exists_mask EQU 0F0H 39 <3> action_opened EQU 01H 40 <3> action_created_opened EQU 02H 41 <3> action_replaced_opened EQU 03H 42 <3> 43 <3> ext_exists_open EQU 01H 44 <3> ext_exists_fail EQU 0H 45 <3> ext_nexists_create EQU 10H 46 <3> 47 <3> 48 <3> 49 <3> ext_open_parm struc 0 00000F20 ???????? ext_set_list dd ? 0 00000F24 ???? ext_num_of_parm dw ? 52 <3> ext_open_parm ends 53 <3> 54 <3> 55 <3> 171 <2> 172 <2> %include "error.mac" 1 <3> ; SCCSID = @(#)error.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)error.asm 1.1 85/04/10 3 <3> BREAK 4 <3> 5 <3> ; 6 <3> ; XENIX calls all return error codes through AX. If an error occurred then 7 <3> ; the carry bit will be set and the error code is in AX. If no error occurred 8 <3> ; then the carry bit is reset and AX contains returned info. 9 <3> ; 10 <3> ; Since the set of error codes is being extended as we extend the operating 11 <3> ; system, we have provided a means for applications to ask the system for a 12 <3> ; recommended course of action when they receive an error. 13 <3> ; 14 <3> ; The GetExtendedError system call returns a universal error, an error 15 <3> ; location and a recommended course of action. The universal error code is 16 <3> ; a symptom of the error REGARDLESS of the context in which GetExtendedError 17 <3> ; is issued. 18 <3> ; 19 <3> 20 <3> ; 21 <3> ; These are the 2.0 error codes 22 <3> ; 23 <3> error_invalid_function EQU 1 24 <3> error_file_not_found EQU 2 25 <3> error_path_not_found EQU 3 26 <3> error_too_many_open_files EQU 4 27 <3> error_access_denied EQU 5 28 <3> error_invalid_handle EQU 6 29 <3> error_arena_trashed EQU 7 30 <3> error_not_enough_memory EQU 8 31 <3> error_invalid_block EQU 9 32 <3> error_bad_environment EQU 10 33 <3> error_bad_format EQU 11 34 <3> error_invalid_access EQU 12 35 <3> error_invalid_data EQU 13 36 <3> ;**** reserved EQU 14 ; ***** 37 <3> error_invalid_drive EQU 15 38 <3> error_current_directory EQU 16 39 <3> error_not_same_device EQU 17 40 <3> error_no_more_files EQU 18 41 <3> ; 42 <3> ; These are the universal int 24 mappings for the old INT 24 set of errors 43 <3> ; 44 <3> error_write_protect EQU 19 45 <3> error_bad_unit EQU 20 46 <3> error_not_ready EQU 21 47 <3> error_bad_command EQU 22 48 <3> error_CRC EQU 23 49 <3> error_bad_length EQU 24 50 <3> error_Seek EQU 25 51 <3> error_not_DOS_disk EQU 26 52 <3> error_sector_not_found EQU 27 53 <3> error_out_of_paper EQU 28 54 <3> error_write_fault EQU 29 55 <3> error_read_fault EQU 30 56 <3> error_gen_failure EQU 31 57 <3> ; 58 <3> ; These are the new 3.0 error codes reported through INT 24 59 <3> ; 60 <3> error_sharing_violation EQU 32 61 <3> error_lock_violation EQU 33 62 <3> error_wrong_disk EQU 34 63 <3> error_FCB_unavailable EQU 35 64 <3> error_sharing_buffer_exceeded EQU 36 65 <3> error_Code_Page_Mismatched EQU 37 ; DOS 4.00 ;AN000; 66 <3> error_handle_EOF EQU 38 ; DOS 4.00 ;AN000; 67 <3> error_handle_Disk_Full EQU 39 ; DOS 4.00 ;AN000; 68 <3> ; 69 <3> ; New OEM network-related errors are 50-79 70 <3> ; 71 <3> error_not_supported EQU 50 72 <3> ; 73 <3> ; End of INT 24 reportable errors 74 <3> ; 75 <3> error_file_exists EQU 80 76 <3> error_DUP_FCB EQU 81 ; ***** 77 <3> error_cannot_make EQU 82 78 <3> error_FAIL_I24 EQU 83 79 <3> ; 80 <3> ; New 3.0 network related error codes 81 <3> ; 82 <3> error_out_of_structures EQU 84 83 <3> error_Already_assigned EQU 85 84 <3> error_invalid_password EQU 86 85 <3> error_invalid_parameter EQU 87 86 <3> error_NET_write_fault EQU 88 87 <3> error_sys_comp_not_loaded EQU 90 ; DOS 4.00 ;AN000; 88 <3> 89 <3> BREAK 90 <3> 91 <3> error_I24_write_protect EQU 0 92 <3> error_I24_bad_unit EQU 1 93 <3> error_I24_not_ready EQU 2 94 <3> error_I24_bad_command EQU 3 95 <3> error_I24_CRC EQU 4 96 <3> error_I24_bad_length EQU 5 97 <3> error_I24_Seek EQU 6 98 <3> error_I24_not_DOS_disk EQU 7 99 <3> error_I24_sector_not_found EQU 8 100 <3> error_I24_out_of_paper EQU 9 101 <3> error_I24_write_fault EQU 0Ah 102 <3> error_I24_read_fault EQU 0Bh 103 <3> error_I24_gen_failure EQU 0Ch 104 <3> ; NOTE: Code 0DH is used by MT-DOS. 105 <3> error_I24_wrong_disk EQU 0Fh 106 <3> 107 <3> ; THE FOLLOWING ARE MASKS FOR THE AH REGISTER ON Int 24 108 <3> 109 <3> Allowed_FAIL EQU 00001000B 110 <3> Allowed_RETRY EQU 00010000B 111 <3> Allowed_IGNORE EQU 00100000B 112 <3> ;NOTE: ABORT is ALWAYS allowed 113 <3> 114 <3> I24_operation EQU 00000001B ;Z if READ,NZ if Write 115 <3> I24_area EQU 00000110B ; 00 if DOS 116 <3> ; 01 if FAT 117 <3> ; 10 if root DIR 118 <3> ; 11 if DATA 119 <3> I24_class EQU 10000000B ;Z if DISK, NZ if FAT or char 120 <3> 121 <3> BREAK 122 <3> 123 <3> ; Values for error CLASS 124 <3> 125 <3> errCLASS_OutRes EQU 1 ; Out of Resource 126 <3> errCLASS_TempSit EQU 2 ; Temporary Situation 127 <3> errCLASS_Auth EQU 3 ; Permission problem 128 <3> errCLASS_Intrn EQU 4 ; Internal System Error 129 <3> errCLASS_HrdFail EQU 5 ; Hardware Failure 130 <3> errCLASS_SysFail EQU 6 ; System Failure 131 <3> errCLASS_Apperr EQU 7 ; Application Error 132 <3> errCLASS_NotFnd EQU 8 ; Not Found 133 <3> errCLASS_BadFmt EQU 9 ; Bad Format 134 <3> errCLASS_Locked EQU 10 ; Locked 135 <3> errCLASS_Media EQU 11 ; Media Failure 136 <3> errCLASS_Already EQU 12 ; Collision with Existing Item 137 <3> errCLASS_Unk EQU 13 ; Unknown/other 138 <3> 139 <3> ; Values for error ACTION 140 <3> 141 <3> errACT_Retry EQU 1 ; Retry 142 <3> errACT_DlyRet EQU 2 ; Delay Retry, retry after pause 143 <3> errACT_User EQU 3 ; Ask user to regive info 144 <3> errACT_Abort EQU 4 ; abort with clean up 145 <3> errACT_Panic EQU 5 ; abort immediately 146 <3> errACT_Ignore EQU 6 ; ignore 147 <3> errACT_IntRet EQU 7 ; Retry after User Intervention 148 <3> 149 <3> ; Values for error LOCUS 150 <3> 151 <3> errLOC_Unk EQU 1 ; No appropriate value 152 <3> errLOC_Disk EQU 2 ; Random Access Mass Storage 153 <3> errLOC_Net EQU 3 ; Network 154 <3> errLOC_SerDev EQU 4 ; Serial Device 155 <3> errLOC_Mem EQU 5 ; Memory 173 <2> 174 <2> %include "syscall.mac" 1 <3> ; SCCSID = @(#)syscall.asm 1.1 85/04/10 2 <3> ;BREAK 3 <3> ;SUBTTL system call definitions 4 <3> ;PAGE 5 <3> 6 <3> Abort EQU 0 ; 0 0 7 <3> Std_Con_Input EQU 1 ; 1 1 8 <3> Std_Con_Output EQU 2 ; 2 2 9 <3> Std_Aux_Input EQU 3 ; 3 3 10 <3> Std_Aux_Output EQU 4 ; 4 4 11 <3> Std_Printer_Output EQU 5 ; 5 5 12 <3> Raw_Con_IO EQU 6 ; 6 6 13 <3> Raw_Con_Input EQU 7 ; 7 7 14 <3> Std_Con_Input_No_Echo EQU 8 ; 8 8 15 <3> Std_Con_String_Output EQU 9 ; 9 9 16 <3> Std_Con_String_Input EQU 10 ; 10 A 17 <3> Std_Con_Input_Status EQU 11 ; 11 B 18 <3> Std_Con_Input_Flush EQU 12 ; 12 C 19 <3> Disk_Reset EQU 13 ; 13 D 20 <3> Set_Default_Drive EQU 14 ; 14 E 21 <3> FCB_Open EQU 15 ; 15 F 22 <3> FCB_Close EQU 16 ; 16 10 23 <3> Dir_Search_First EQU 17 ; 17 11 24 <3> Dir_Search_Next EQU 18 ; 18 12 25 <3> FCB_Delete EQU 19 ; 19 13 26 <3> FCB_Seq_Read EQU 20 ; 20 14 27 <3> FCB_Seq_Write EQU 21 ; 21 15 28 <3> FCB_Create EQU 22 ; 22 16 29 <3> FCB_Rename EQU 23 ; 23 17 30 <3> Get_Default_Drive EQU 25 ; 25 19 31 <3> Set_DMA EQU 26 ; 26 1A 32 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ; ; 35 <3> Get_Default_DPB EQU 31 ; 31 1F 36 <3> ; ; 37 <3> ; C A V E A T P R O G R A M M E R ; 38 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 39 <3> FCB_Random_Read EQU 33 ; 33 21 40 <3> FCB_Random_Write EQU 34 ; 34 22 41 <3> Get_FCB_File_Length EQU 35 ; 35 23 42 <3> Get_FCB_Position EQU 36 ; 36 24 43 <3> Set_Interrupt_Vector EQU 37 ; 37 25 44 <3> Create_Process_Data_Block EQU 38 ; 38 26 45 <3> FCB_Random_Read_Block EQU 39 ; 39 27 46 <3> FCB_Random_Write_Block EQU 40 ; 40 28 47 <3> Parse_File_Descriptor EQU 41 ; 41 29 48 <3> Get_Date EQU 42 ; 42 2A 49 <3> Set_Date EQU 43 ; 43 2B 50 <3> Get_Time EQU 44 ; 44 2C 51 <3> Set_Time EQU 45 ; 45 2D 52 <3> Set_Verify_On_Write EQU 46 ; 46 2E 53 <3> ; Extended functionality group 54 <3> Get_DMA EQU 47 ; 47 2F 55 <3> Get_Version EQU 48 ; 48 30 56 <3> Keep_Process EQU 49 ; 49 31 57 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <3> ; C A V E A T P R O G R A M M E R ; 59 <3> ; ; 60 <3> Get_DPB EQU 50 ; 50 32 61 <3> ; ; 62 <3> ; C A V E A T P R O G R A M M E R ; 63 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 64 <3> Set_CTRL_C_Trapping EQU 51 ; 51 33 65 <3> Get_InDOS_Flag EQU 52 ; 52 34 66 <3> Get_Interrupt_Vector EQU 53 ; 53 35 67 <3> Get_Drive_Freespace EQU 54 ; 54 36 68 <3> Char_Oper EQU 55 ; 55 37 69 <3> International EQU 56 ; 56 38 70 <3> ; Directory Group 71 <3> MKDir EQU 57 ; 57 39 72 <3> RMDir EQU 58 ; 58 3A 73 <3> CHDir EQU 59 ; 59 3B 74 <3> ; File Group 75 <3> Creat EQU 60 ; 60 3C 76 <3> Open EQU 61 ; 61 3D 77 <3> Close EQU 62 ; 62 3E 78 <3> Read EQU 63 ; 63 3F 79 <3> Write EQU 64 ; 64 40 80 <3> Unlink EQU 65 ; 65 41 81 <3> LSeek EQU 66 ; 66 42 82 <3> CHMod EQU 67 ; 67 43 83 <3> IOCtl EQU 68 ; 68 44 84 <3> XDup EQU 69 ; 69 45 85 <3> XDup2 EQU 70 ; 70 46 86 <3> Current_Dir EQU 71 ; 71 47 87 <3> ; Memory Group 88 <3> Alloc EQU 72 ; 72 48 89 <3> Dealloc EQU 73 ; 73 49 90 <3> Setblock EQU 74 ; 74 4A 91 <3> ; Process Group 92 <3> Exec EQU 75 ; 75 4B 93 <3> Exit EQU 76 ; 76 4C 94 <3> WaitProcess EQU 77 ; 77 4D 95 <3> Find_First EQU 78 ; 78 4E 96 <3> ; Special Group 97 <3> Find_Next EQU 79 ; 79 4F 98 <3> ; SPECIAL SYSTEM GROUP 99 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 100 <3> ; C A V E A T P R O G R A M M E R ; 101 <3> ; ; 102 <3> Set_Current_PDB EQU 80 ; 80 50 103 <3> Get_Current_PDB EQU 81 ; 81 51 104 <3> Get_In_Vars EQU 82 ; 82 52 105 <3> SetDPB EQU 83 ; 83 53 106 <3> ; ; 107 <3> ; C A V E A T P R O G R A M M E R ; 108 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 109 <3> Get_Verify_On_Write EQU 84 ; 84 54 110 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 111 <3> ; C A V E A T P R O G R A M M E R ; 112 <3> ; ; 113 <3> Dup_PDB EQU 85 ; 85 55 114 <3> ; ; 115 <3> ; C A V E A T P R O G R A M M E R ; 116 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 117 <3> Rename EQU 86 ; 86 56 118 <3> File_Times EQU 87 ; 87 57 119 <3> AllocOper EQU 88 ; 88 58 120 <3> ; Network extention system calls 121 <3> GetExtendedError EQU 89 ; 89 59 122 <3> CreateTempFile EQU 90 ; 90 5A 123 <3> CreateNewFile EQU 91 ; 91 5B 124 <3> LockOper EQU 92 ; 92 5C Lock and Unlock 125 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 126 <3> ; C A V E A T P R O G R A M M E R ; 127 <3> ; ; 128 <3> ServerCall EQU 93 ; 93 5D CommitAll, ServerDOSCall, 129 <3> ; CloseByName, CloseUser, 130 <3> ; CloseUserProcess, 131 <3> ; GetOpenFileList 132 <3> ; ; 133 <3> ; C A V E A T P R O G R A M M E R ; 134 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 135 <3> UserOper EQU 94 ; 94 5E Get and Set 136 <3> AssignOper EQU 95 ; 95 5F On, Off, Get, Set, Cancel 137 <3> xNameTrans EQU 96 ; 96 60 138 <3> PathParse EQU 97 ; 97 61 139 <3> GetCurrentPSP EQU 98 ; 98 62 140 <3> Hongeul EQU 99 ; 99 63 141 <3> ECS_CALL EQU 99 ; 99 63 ;; DBCS support 142 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 143 <3> ; C A V E A T P R O G R A M M E R ; 144 <3> ; ; 145 <3> Set_Printer_Flag EQU 100 ; 100 64 146 <3> ; ; 147 <3> ; C A V E A T P R O G R A M M E R ; 148 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 149 <3> GetExtCntry EQU 101 ; 101 65 150 <3> GetSetCdPg EQU 102 ; 102 66 151 <3> ExtHandle EQU 103 ; 103 67 152 <3> Commit EQU 104 ; 104 68 153 <3> GetSetMediaID EQU 105 ; 105 69 154 <3> IFS_IOCTL EQU 107 ; 107 6B 155 <3> ExtOpen EQU 108 ; 108 6C 156 <3> ; 157 <3> ; 158 <3> Set_Oem_Handler EQU 248 ; 248 F8 159 <3> OEM_C1 EQU 249 ; 249 F9 160 <3> OEM_C2 EQU 250 ; 250 FA 161 <3> OEM_C3 EQU 251 ; 251 FB 162 <3> OEM_C4 EQU 252 ; 252 FC 163 <3> OEM_C5 EQU 253 ; 253 FD 164 <3> OEM_C6 EQU 254 ; 254 FE 165 <3> OEM_C7 EQU 255 ; 255 FF 175 <2> 176 <2> ;SUBTTL 177 <2> 12 <1> ;.cref 13 <1> [list +] 14 <1> 15 <1> ;AsmVars 16 <1> %ifndef Kanji 17 <1> %assign Kanji 0 18 <1> %endif 19 <1> %ifndef Debug 20 <1> %assign Debug 0 21 <1> %endif 22 <1> 23 <1> BREAK === Switch to base=002450h -> "DOSCODECODE" 24 <1> section DOSCODECODE 25 <1> 26 <1> 27 <1> I_need CurrentPDB,WORD 28 <1> I_need CntCFlag,BYTE 29 <1> I_need User_SS,WORD 30 <1> I_need User_SP,WORD 31 <1> I_need NSS,WORD 32 <1> I_need NSP,WORD 33 <1> I_need SaveDS,WORD 34 <1> I_need SaveBX,WORD 35 <1> I_need INDOS,BYTE 36 <1> I_need User_ID,WORD 37 <1> I_need Proc_ID,WORD 38 <1> I_need AuxStack,BYTE 39 <1> I_need IOSTACK,BYTE 40 <1> I_need DSKSTACK,BYTE 41 <1> I_need fsharing,BYTE 42 <1> I_need NoSetDir,BYTE 43 <1> I_need FailERR,BYTE 44 <1> I_need Errormode,BYTE 45 <1> I_need restore_tmp,WORD 46 <1> I_need WPERR,BYTE 47 <1> I_need Dispatch,WORD 48 <1> I_need ConSwap,BYTE 49 <1> I_need User_In_AX,WORD 50 <1> I_need EXTERR_LOCUS,BYTE 51 <1> I_need IdleInt,BYTE 52 <1> I_need Printer_Flag,BYTE 53 <1> I_need CPSWFLAG,BYTE ;AN000; 54 <1> I_need CPSWSAVE,BYTE ;AN000; 55 <1> I_need DISK_FULL,BYTE ;AN000; 56 <1> I_need InterCon,BYTE ;AN000; 57 <1> I_need BOOTDRIVE,BYTE ;AN000; 58 <1> I_need EXTOPEN_ON,BYTE ;AN000; 59 <1> I_need DOS34_FLAG,WORD ;AN000; 60 <1> %ifndef BUF2 61 <1> I_need ACT_PAGE,WORD ;AN000; 62 <1> %endif 63 <1> i_need MSVERS,WORD 64 <1> I_need doslocation3306, byte 65 <1> 66 <1> %IFN IBM 67 <1> I_need OEM_HANDLER,DWORD 68 <1> %ENDIF 69 <1> 70 <1> %ifndef BUF2 71 <1> %IF BUFFERFLAG 72 <1> I_am SETVECTFLAG,BYTE,<0> 73 <1> i_need BUF_EMS_SEG_CNT,WORD ; DOS 4.00 EMS seg count ;AN000; 74 <1> i_need BUF_EMS_MODE,BYTE ; DOS 4.00 EMS mode ;AN000; 75 <1> i_am BUF_EMS_MAP_USER,12,<0,0,0,0,0,0,0,0,0,0,0,0> 76 <1> %ENDIF 77 <1> %endif 78 <1> 79 <1> 80 <1> BREAK 81 <1> 82 <1> versionstring: 83 <1> %include "../../version.inc" 0 00000804 6C444F532028323032 db "lDOS (2025 August) based on MS-DOS v4.01" 0 0000080D 352041756775737429 0 00000816 206261736564206F6E 0 0000081F 204D532D444F532076 0 00000828 342E3031 0 0000082C 00 db 0 85 <1> 86 <1> 87 <1> BREAK <$Set_CTRL_C_Trapping -- En/Disable ^C check in dispatcher> 88 <1> 89 <1> ; Inputs: 90 <1> ; ds => DOSDATA 91 <1> ; ss:sp -> original ds, original ip, original cs, original fl 92 <1> ; AL = 0 read ^C status 93 <1> ; AL = 1 Set ^C status, DL = 0/1 for ^C off/on 94 <1> ; AL = 2 Set ^C status to contents of DL. Output is old state. 95 <1> ; AL = 3 Get CPSW state to DL DOS 3.4 96 <1> ; AL = 4 Set CPSW state from DL DOS 3.4 97 <1> ; AL = 5 get DOS boot drive 98 <1> ; Function: 99 <1> ; Enable disable ^C checking in dispatcher 100 <1> ; Outputs: 101 <1> ; If AL = 0 then DL = 0/1 for ^C off/on 102 <1> 103 <1> procedure D_SET_CTRL_C_TRAPPING,NEAR 103 ****************** <1> warning: proc D_SET_CTRL_C_TRAPPING... [-w+user] 104 <1> ASSUME DS:DOSGROUP, ES:NOTHING, SS:NOTHING 0 0000082D 3C06 cmp al, 6 0 0000082F 750C jne .nottrueversion 0 00000831 31D2 xor dx, dx 0 00000833 8A36[0000] mov dh, [doslocation3306] 0 00000837 8B1E[0000] mov bx, [MSVERS] 0 0000083B 1F pop ds 111 <1> assume ds:nothing 0 0000083C CF iret 113 <1> 114 <1> .nottrueversion: 115 <1> assume ds:DOSGROUP 0 0000083D 3CFF cmp al, 0FFh ; function 33FFh ? 0 0000083F 7507 jne .notversionstring ; no --> 0 00000841 B8[0000] mov ax, offset versionstring ; access with cs 0 00000844 8CCA mov dx, cs ; yes, return dx:ax -> ASCIZ 0 00000846 1F pop ds 121 <1> assume ds:nothing 0 00000847 CF iret ; (CF preserved) 123 <1> 124 <1> .notversionstring: 125 <1> assume ds:DOSGROUP 0 00000848 84C0 test AL,AL 0 0000084A 7506 JNZ Check1 0 0000084C 8A16[0000] MOV DL,[CntCFlag] 0 00000850 1F pop ds 130 <1> assume ds:nothing 0 00000851 CF IRET 132 <1> Check1: 133 <1> assume ds:DOSGROUP 0 00000852 3C02 CMP AL,2 0 00000854 771A JA CPSWchk ;AN000; 0 00000856 740B JZ SetAndRet 0 00000858 52 PUSH DX 0 00000859 80E201 AND DL,01h 139 <1> CNTCFLAG equ CntCFlag ; NASM port label 0 0000085C 8816[0000] MOV [CNTCFLAG],DL 0 00000860 5A POP DX 0 00000861 1F pop ds 143 <1> assume ds:nothing 0 00000862 CF IRET 145 <1> SetAndRet: 146 <1> assume ds:DOSGROUP 0 00000863 80E201 AND DL,01h 0 00000866 8616[0000] XCHG [CntCFlag],DL 0 0000086A 1F pop ds 150 <1> assume ds:nothing 0 0000086B CF IRET 152 <1> BadVal: 153 <1> assume ds:DOSGROUP 0 0000086C B0FF MOV AL,0FFH 155 <1> doscode_popds_iret: 0 0000086E 1F pop ds 157 <1> assume ds:nothing 0 0000086F CF IRET 159 <1> ;; DOS 4.00 File Tagging 160 <1> 161 <1> CPSWchk: ;AN000; 162 <1> assume ds:DOSGROUP 163 <1> ; PUSH AX ;AN000;;FT. 164 <1> ; MOV AL,[CPSWSAVE] ;AN000;;FT. DOS 3.4 165 <1> ; MOV [CPSWFLAG],AL ;AN000;;FT. DOS 3.4 in case ABORT 166 <1> ; POP AX ;AN000;;FT. 0 00000870 3C03 CMP AL,3 ;AN000;;FT get CPSW state ? 168 <1> ; JNZ CPSWset ;AN000;;FT. no 0 00000872 74FA je doscode_popds_iret 170 <1> ; MOV DL,CPSWFLAG ;AN000;;FT. return CPSW state 171 <1> ; pop ds 172 <1> ; IRET ;AN000; 173 <1> CPSWset: ;AN000; 0 00000874 3C04 CMP AL,4 ;AN000;;FT. set CPSW state ? 175 <1> ; JA QueryDOSboot ;AN000;;FT. check query dos boot drive 0 00000876 76F6 jbe doscode_popds_iret 177 <1> ; PUSH AX ;AN000;;FT. 178 <1> ; CallInstall NLSInstall,NLSFUNC,0 ;AN000;;FT. NLSFUNC installed ? 179 <1> ; CMP AL,0FFH ;AN000;;FT. 180 <1> ; POP AX ;AN000;;FT. 181 <1> ; JNZ BadVal ;AN000;;FT. not loaded, therefore ignore 182 <1> ;;;; AND DL,01H ;AN000;;FT. only 0 or 1 183 <1> ;;;; MOV [CPSWFLAG],DL ;AN000;;FT. set the flag 184 <1> ;;;; MOV [CPSWSAVE],DL ;AN000;;FT. save one copy 185 <1> ; pop ds 186 <1> ; IRET ;AN000;;FT. 187 <1> QueryDOSboot: ;AN000; 188 <1> assume ds:DOSGROUP 0 00000878 3C05 CMP AL,5 ;AN000;MS. 0 0000087A 77F0 JA BadVal ;AN000;MS. 0 0000087C 8A16[0000] MOV DL,[BOOTDRIVE] ;AN000;;MS. put boot drive in DL 0 00000880 1F pop ds 193 <1> assume ds:nothing 0 00000881 CF IRET ;AN000;;MS. 195 <1> 196 <1> 197 <1> ;; DOS 4.00 File Tagging 198 <1> 199 <1> EndProc D_SET_CTRL_C_TRAPPING 200 <1> 201 <1> BREAK <$Get_current_PDB -- Set/Get PDB value> 202 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 203 <1> ; C A V E A T P R O G R A M M E R ; 204 <1> ; ; 205 <1> ; The following two routines are dispatched to directly with ints disabled 206 <1> ; immediately after the int 21h entry. no DIS state is set. 207 <1> ; 208 <1> ; $Set_current_PDB takes BX and sets it to be the current process 209 <1> ; *** THIS FUNCTION CALL IS SUBJECT TO CHANGE!!! *** 210 <1> ; 211 <1> procedure D_SET_CURRENT_PDB,NEAR 211 ****************** <1> warning: proc D_SET_CURRENT_PDB... [-w+user] 212 <1> ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING 0 00000882 891E[0000] MOV [CurrentPDB],BX 0 00000886 1F pop ds 215 <1> assume ds:nothing 0 00000887 CF IRET 217 <1> EndProc D_SET_CURRENT_PDB 218 <1> 219 <1> ; 220 <1> ; $get_current_PDB returns in BX the current process 221 <1> ; *** THIS FUNCTION CALL IS SUBJECT TO CHANGE!!! *** 222 <1> ; 223 <1> procedure D_GET_CURRENT_PDB,NEAR 223 ****************** <1> warning: proc D_GET_CURRENT_PDB... [-w+user] 224 <1> ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING 0 00000888 8B1E[0000] MOV BX,[CurrentPDB] 0 0000088C 1F pop ds 227 <1> assume ds:nothing 0 0000088D CF IRET 229 <1> EndProc D_GET_CURRENT_PDB 230 <1> ; C A V E A T P R O G R A M M E R ; 231 <1> ; ; 232 <1> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 233 <1> 234 <1> ; 235 <1> ; Sets the Printer Flag to whatever is in AL. 236 <1> ; NOTE: THIS PROCEDURE IS SUBJECT TO CHANGE!!! 237 <1> ; 238 <1> Procedure D_Set_Printer_Flag 238 ****************** <1> warning: proc D_Set_Printer_Flag... [-w+user] 239 <1> ASSUME DS:DOSGROUP, ES:NOTHING, SS:NOTHING 0 0000088E A2[0000] mov [Printer_Flag],al 0 00000891 1F pop ds 242 <1> assume ds:nothing 0 00000892 CF IRET 244 <1> EndProc D_Set_Printer_Flag 245 <1> 246 <1> procedure SYSTEM_CALL,NEAR 246 ****************** <1> warning: proc SYSTEM_CALL... [-w+user] 247 <1> 248 <1> %if 0 249 <1> ; 250 <1> ; The Quit entry point is where all INT 20h's come from. These are old- style 251 <1> ; exit system calls. The CS of the caller indicates which Process is dying. 252 <1> ; The error code is presumed to be 0. We simulate an ABORT system call. 253 <1> ; 254 <1> entry QUIT 255 <1> MOV AH,0 256 <1> JMP SHORT SAVREGS 257 <1> %endif 258 <1> 259 <1> ; 260 <1> ; The system call in AH is out of the range that we know how to handle. We 261 <1> ; arbitrarily set the contents of AL to 0 and IRET. Note that we CANNOT set 262 <1> ; the carry flag to indicate an error as this may break some programs 263 <1> ; compatability. 264 <1> ; 265 <1> BADCALL: 0 00000893 B000 MOV AL,0 267 <1> entry IRETT 0 00000895 CF IRET 269 <1> ; 270 <1> ; An alternative method of entering the system is to perform a CALL 5 in the 271 <1> ; program segment prefix with the contents of CL indicating what system call 272 <1> ; the user would like. A subset of the possible system calls is allowed here; 273 <1> ; only the CPM-compatible calls may get dispatched. 274 <1> ; 275 <1> 276 <1> ; Call DOS interface for CP/M compatibility, "CALL 5" 277 <1> relocated call5 278 <1> entry CALL_ENTRY ; System call entry point and dispatcher 279 <1> 280 <1> ; The CALL 5 interface isn't just a far call to this address. 281 <1> ; Rather it's a near call (inside the program's PSP) to address 5, which 282 <1> ; then calls far to this address. Doing a retf here will screw everything 283 <1> ; up and return into the PSP data instead of into the actual caller code. 0 00000896 9C pushf 0 00000897 55 push bp 0 00000898 89E5 mov bp, sp 287 <1> ; [ bp ] = bp 288 <1> ; [ bp + 2 ] = flags (that we just pushed) 289 <1> ; [ bp + 4 ] = call far's ip (will point into PSP so it's garbage) 290 <1> ; [ bp + 6 ] = call far's cs 291 <1> ; [ bp + 8 ] = "CALL 5"'s ip 292 <1> 0 0000089A 874602 xchg ax, word [ byte bp + 2] ; ax = flags 294 <1> ; [ bp + 2 ] = original ax 0 0000089D 874608 xchg ax, word [ byte bp + 8] ; [ bp + 8 ] = flags 296 <1> ; ax = "CALL 5"'s ip 0 000008A0 874604 xchg ax, word [ byte bp + 4] ; [ bp + 4 ] = "CALL 5"'s ip 298 <1> ; clobbers ax (call far's ip) 0 000008A3 5D pop bp 0 000008A4 58 pop ax ; ax = original ax 301 <1> 302 <1> ; [ sp ] = "CALL 5"'s IP 303 <1> ; [ sp + 2 ] = call far's cs 304 <1> ; [ sp + 4 ] = flags 305 <1> ; Surprisingly this really looks like the stack for an interrupt! 0 000008A5 FA cli ; Real interrupt entries do the same 307 <1> 308 <1> 0 000008A6 80F924 cmp cl, 24h ; CP/M function number 310 <1> ; hardcoded ms_table.nas table size 0 000008A9 77E8 ja .nocpmfunc ; is it above 24h? Really no CP/M function --> 312 <1> ; (I found this behaviour while debugging MS-DOS) 313 <1> 0 000008AB 88CC mov ah,cl ; CP/M compatibility interface uses cl as function 315 <1> SavRegs equ SAVREGS ; NASM port label 0 000008AD EB05 JMP SHORT SavRegs 317 <1> ; Pass it through to our normal Int21 entry 318 <1> 319 <1> .nocpmfunc: equ BADCALL 320 <1> ; xor al,al ; Report "Unused" function 321 <1> ; iret ; (don't need to care about CY/NC) 322 <1> ; RxDOS 7.20N: The above, correct, code requires some space you may want to save. 323 <1> ; A short solution for all this CP/M crap is to place "xor al,al", 324 <1> ; "retn" at address 5 of the PSP. This will report an error to all CP/M 325 <1> ; CALL 5s and it's even shorter than the code used by RxDOS <= 7.20N 326 <1> 327 <1> 328 <1> ; 329 <1> ; This is the normal INT 21 entry point. We first perform a quick test to see 330 <1> ; if we need to perform expensive DOS-entry functions. Certain system calls 331 <1> ; are done without interrupts being enabled. 332 <1> ; 333 <1> 334 <1> relocated i21 335 <1> entry COMMAND ; Interrupt call entry point (INT 21H) 336 <1> 337 <1> %IFN IBM 338 <1> SET_OEM_HANDLER equ Set_Oem_Handler ; NASM port equate 339 <1> CMP AH,SET_OEM_HANDLER 340 <1> JB NOTOEM 341 <1> JMP D_SET_OEM_HANDLER 342 <1> NOTOEM: 343 <1> %ENDIF 344 <1> 0 000008AF 80FC6C CMP AH, 6Ch ; hardcoded ms_table.nas table size 346 <1> BadCall equ BADCALL ; NASM port label 0 000008B2 77DF JA BadCall 348 <1> 349 <1> ; 350 <1> ; The following set of calls are issued by the server at *arbitrary* times 351 <1> ; and, therefore, must be executed on the user's entry stack and executed with 352 <1> ; interrupts off. 353 <1> ; lDOS: Set up a minimal stack frame consisting of the original ds, 354 <1> ; so that we can access DOSDATA with ds. 355 <1> ; 356 <1> SAVREGS: 357 <1> 358 <1> extern doscode_getdosdata 359 <1> 0 000008B4 1E push ds ; now ds on stack 0 000008B5 50 push ax 0 000008B6 E8[0000] call doscode_getdosdata 0 000008B9 8ED8 mov ds, ax ; => DOSDATA 364 <1> assume ds:DOSGROUP 0 000008BB 58 pop ax 366 <1> 367 <1> GET_CURRENT_PDB equ Get_Current_PDB ; NASM port equate 0 000008BC 80FC51 CMP AH,GET_CURRENT_PDB 0 000008BF 74C7 JZ D_GET_CURRENT_PDB 0 000008C1 80FC62 CMP AH,GetCurrentPSP 0 000008C4 74C2 JZ D_GET_CURRENT_PDB 372 <1> SET_CURRENT_PDB equ Set_Current_PDB ; NASM port equate 0 000008C6 80FC50 CMP AH,SET_CURRENT_PDB 0 000008C9 74B7 JZ D_SET_CURRENT_PDB 0 000008CB 80FC33 CMP AH,Set_CTRL_C_Trapping 0 000008CE 7503 JNZ chkprt 377 <1> D_Set_CTRL_C_Trapping equ D_SET_CTRL_C_TRAPPING 0 000008D0 E95AFF JMP D_Set_CTRL_C_Trapping 379 <1> chkprt: 380 <1> SET_PRINTER_FLAG equ Set_Printer_Flag ; NASM port equate 0 000008D3 80FC64 CMP AH,SET_PRINTER_FLAG 0 000008D6 74B6 JZ D_Set_Printer_Flag 0 000008D8 1F pop ds ; restore ds before save_world 384 <1> assume ds:nothing 385 <1> ; 386 <1> ; Preserve all user's registers on their own stack. 387 <1> ; 0 000008D9 E80601 CALL save_world 0 000008DC E8[0000] call doscode_getdosdata ; ax => DOSDATA 0 000008DF 1E push ds ; stack original ds 0 000008E0 8ED8 mov ds, ax ; => DOSDATA 392 <1> ASSUME DS:DOSGROUP 0 000008E2 FE06[0000] INC byte [INDOS] ; Flag that we're in the DOS 0 000008E6 8F06[0000] pop word [SaveDS] ; = original ds 0 000008EA 891E[0000] MOV [SaveBX],BX 0 000008EE 31C0 XOR AX,AX 397 <1> USER_ID equ User_ID ; NASM port label 0 000008F0 A3[0000] MOV [USER_ID],AX 0 000008F3 A1[0000] MOV AX,[CurrentPDB] ; current process 400 <1> PROC_ID equ Proc_ID ; NASM port label 0 000008F6 A3[0000] MOV [PROC_ID],AX ; Assume local machine for the moment 402 <1> ; 403 <1> ; Provide one level of reentrancy for INT 24 recallability. 404 <1> ; 405 <1> user_SP equ User_SP ; NASM port label 0 000008F9 A1[0000] MOV AX,[user_SP] 0 000008FC A3[0000] MOV [NSP],AX 408 <1> user_SS equ User_SS ; NASM port label 0 000008FF A1[0000] MOV AX,[user_SS] 0 00000902 A3[0000] MOV [NSS],AX 0 00000905 58 POP AX 0 00000906 50 PUSH AX 0 00000907 8926[0000] MOV [user_SP],SP 0 0000090B 8C16[0000] MOV [user_SS],SS 415 <1> ; 416 <1> ; save user stack in his area for later returns (possibly from EXEC) 417 <1> ; 418 <1> fSharing equ fsharing ; NASM port label 0 0000090F C606[0000]00 MOV byte [fSharing],0 ; allow redirection 420 <1> 0 00000914 8CDB mov bx, ds 0 00000916 8E1E[0000] MOV DS,[CurrentPDB] 423 <1> ASSUME DS:NOTHING 0 0000091A 89262E00 MOV WORD PTR [PDB_User_stack],SP 0 0000091E 8C163000 MOV WORD PTR [PDB_User_stack+2],SS 426 <1> 427 <1> ; MOV BX,CS ; no holes here. 0 00000922 8ED3 MOV SS,BX 429 <1> assume nocheck, ss:DOSGROUP 430 <1> 431 <1> entry REDISP 432 <1> AUXSTACK equ AuxStack ; NASM port label 0 00000924 BC[0000] MOV SP,OFFSET AUXSTACK wrt DOSGROUP ; Enough stack for interrupts 434 <1> ASSUME SS:DOSGROUP 0 00000927 FB STI ; stack is in our space now... 436 <1> %IF DBCS ;AN000; 437 <1> MOV BH, BYTE PTR [PDB_InterCon] ;AN000;; get interim mode 2/13/KK 438 <1> MOV [SS:InterCon], BH ;AN000;; 2/13/KK 439 <1> %ENDIF ;AN000; 0 00000928 16 push ss 0 00000929 1F pop ds 442 <1> DOSAssume CS,,"MSCODE/ReDisp" 443 <1> ;; DOS 3.4 INIT 444 <1> ; MOV BL,[CPSWSAVE] ;AN000;;FT. DOS 3.4 445 <1> ; MOV [CPSWFLAG],BL ;AN000;;FT. DOS 3.4 in case ABORT 0 0000092A C606[0000]00 MOV byte [DISK_FULL],0 ;AN000;;MS. no disk full 0 0000092F C606[0000]00 MOV byte [EXTOPEN_ON],0 ;AN000;;EO. clear extended open flag 0 00000934 C706[0000]0000 MOV word [DOS34_FLAG],0 ;AN000;;MS. clear common flag 449 <1> %ifndef BUF2 450 <1> MOV word [ACT_PAGE],-1 ;BN000;BL;AN000;;LB. invalidate active page 451 <1> %endif 452 <1> ;; DOS 4.00 INIT 0 0000093A 30FF XOR BH,BH 454 <1> CONSWAP equ ConSwap ; NASM port label 0 0000093C 883E[0000] MOV [CONSWAP],BH ; random clean up of possibly mis-set flags 456 <1> IDLEINT equ IdleInt ; NASM port label 0 00000940 C606[0000]01 MOV byte [IDLEINT],1 ; presume that we can issue INT 28 0 00000945 883E[0000] MOV BYTE PTR [NoSetDir],BH ; set directories on search 459 <1> FAILERR equ FailERR ; NASM port label 0 00000949 883E[0000] MOV BYTE PTR [FAILERR],BH ; FAIL not in progress 0 0000094D 88E3 MOV BL,AH 0 0000094F D1E3 SHL BX,1 ; 2 bytes per call in table 0 00000951 FC CLD 464 <1> ; 465 <1> ; Since the DOS maintains mucho state information across system calls, we 466 <1> ; must be very careful about which stack we use. 467 <1> ; 468 <1> ; First, all abort operations must be on the disk stack. THis is due to the 469 <1> ; fact that we may be hitting the disk (close operations, flushing) and may 470 <1> ; need to report an INT 24. 471 <1> ; 0 00000952 08E4 OR AH,AH 0 00000954 7416 JZ DSKROUT ; ABORT 474 <1> ; 475 <1> ; Second, PRINT and PSPRINT and the server issue GetExtendedError calls at 476 <1> ; INT 28 and INT 24 time. This call MUST, therefore, use the AUXSTACK. 477 <1> ; 0 00000956 80FC59 CMP AH,GetExtendedError 0 00000959 743D JZ DISPCALL 480 <1> ; 481 <1> ; Old 1-12 system calls may be either on the IOSTACK (normal operation) or 482 <1> ; on the AUXSTACK (at INT 24 time). 483 <1> ; 0 0000095B 80FC0C CMP AH,12 0 0000095E 770C JA DSKROUT 486 <1> ERRORMODE equ Errormode ; NASM port label 0 00000960 803E[0000]00 CMP byte [ERRORMODE],0 ; Are we in an INT 24? 0 00000965 7531 JNZ DISPCALL ; Stay on AUXSTACK if INT 24. 0 00000967 BC[0000] MOV SP,OFFSET IOSTACK wrt DOSGROUP 0 0000096A EB2C JMP SHORT DISPCALL 491 <1> ; 492 <1> ; We are on a system call that is classified as "the rest". We place 493 <1> ; ourselves onto the DSKSTACK and away we go. We know at this point: 494 <1> ; 495 <1> ; o An INT 24 cannot be in progress. Therefore we reset errormode and 496 <1> ; wperr 497 <1> ; o That there can be no critical sections in effect. We signal the 498 <1> ; server to remove all the resources. 499 <1> ; 500 <1> DSKROUT: 501 <1> USER_IN_AX equ User_In_AX ; NASM port label 0 0000096C A3[0000] MOV [USER_IN_AX],AX ; Remember what user is doing 0 0000096F C606[0000]01 MOV byte [EXTERR_LOCUS],errLOC_Unk ; Default 0 00000974 C606[0000]00 MOV byte [ERRORMODE],0 ; Cannot make non 1-12 calls in 0 00000979 C606[0000]FF MOV byte [WPERR],-1 ; error mode, so good place to make 506 <1> ; 507 <1> ; Release all resource information 508 <1> ; 0 0000097E 50 PUSH AX 0 0000097F B482 MOV AH,82h 0 00000981 CD2A INT int_IBM 0 00000983 58 POP AX 513 <1> 514 <1> ; 515 <1> ; Since we are going to be running on the DSKStack and since INT 28 people 516 <1> ; will use the DSKStack, we must turn OFF the generation of INT 28's. 517 <1> ; 0 00000984 C606[0000]00 MOV byte [IdleInt],0 0 00000989 BC[0000] MOV SP,OFFSET DSKSTACK wrt DOSGROUP 0 0000098C F606[0000]FF TEST byte [CNTCFLAG],-1 0 00000991 7405 JZ DISPCALL ; Extra ^C checking is disabled 0 00000993 50 PUSH AX 0 00000994 E8[0000] invoke DSKSTATCHK 0 00000997 58 POP AX 525 <1> DISPCALL: 0 00000998 2E8B9F[0000] MOV BX,[CS:Dispatch + BX] 0 0000099D 871E[0000] XCHG BX,[SaveBX] 0 000009A1 8E1E[0000] MOV DS,[SaveDS] 529 <1> ASSUME DS:NOTHING 530 <1> 531 <1> %ifndef BUF2 532 <1> %IF BUFFERFLAG 533 <1> mov byte [ss:SETVECTFLAG], 0 534 <1> cmp ah, 25h 535 <1> jne saveuser 536 <1> cmp ah, 35h 537 <1> jne saveuser 538 <1> mov byte [ss:SETVECTFLAG], 1 539 <1> saveuser: 540 <1> invoke SAVE_USER_MAP ;AN000;LB. save EMS map 541 <1> %ENDIF 542 <1> %endif 543 <1> 0 000009A5 36FF16[0000] CALL near [ss:SaveBX] 545 <1> 546 <1> %ifndef BUF2 547 <1> %IF BUFFERFLAG 548 <1> invoke RESTORE_USER_MAP ;AN000;LB. retsore EMS map 549 <1> %ENDIF 550 <1> %endif 551 <1> 552 <1> doscode_leavedos: 553 <1> assume ss:DOSGROUP, ds:nothing, es:nothing 554 <1> ;ASSUME SS:NOTHING ; User routines may misbehave 0 000009AA FA CLI 0 000009AB 16 push ss 0 000009AC 1F pop ds ; ds => DOSDATA, overwritten soon 558 <1> assume ds:DOSGROUP 0 000009AD 8B2E[0000] MOV BP, [user_SP] ; -> user stack 0 000009B1 8E16[0000] MOV SS, [user_SS] 0 000009B5 89EC MOV SP, bp ; restore user stack 562 <1> assume ss:nothing 0 000009B7 884600 MOV BYTE PTR [BP + user_AX],AL 0 000009BA A1[0000] MOV AX,[NSP] 0 000009BD A3[0000] MOV [user_SP],AX 0 000009C0 A1[0000] MOV AX,[NSS] 0 000009C3 A3[0000] MOV [user_SS],AX 0 000009C6 FE0E[0000] DEC byte [INDOS] 0 000009CA E80100 CALL restore_world ; restore all registers 570 <1> assume ds:nothing, es:nothing 0 000009CD CF IRET 572 <1> EndProc SYSTEM_CALL 573 <1> === Switch to base=000E10h -> "DOSDATACODE" 574 <1> section DOSDATACODE ; in DOSDATA 575 <1> extern dosdata_to_doscode 576 <1> entry LEAVEDOS 577 <1> assume ss:DOSGROUP, ds:nothing, es:nothing 0 0000123A 2EFF36[0000] push word [cs:dosdata_to_doscode] 0 0000123F BD[A601] mov bp, doscode_leavedos 0 00001242 55 push bp 0 00001243 CB retf 582 <1> === Switch to base=002450h -> "DOSCODECODE" 583 <1> section DOSCODECODE 584 <1> 585 <1> ; 586 <1> ; restore_world restores all registers ('cept SS:SP, CS:IP, flags) from 587 <1> ; the stack prior to giving the user control 588 <1> ; 589 <1> procedure restore_world,NEAR 589 ****************** <1> warning: proc restore_world... [-w+user] 590 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 591 <1> 592 <1> lframe -2 593 <1> ; have: es, ds, ..., ax, ip 594 <1> ; want: ip, ds, ..., ax, es 595 <1> lpar word, in_es_out_ip 596 <1> lpar word, ds 597 <1> lpar word, bp 598 <1> lpar word, di 599 <1> lpar word, si 600 <1> lpar word, dx 601 <1> lpar word, cx 602 <1> lpar word, bx 603 <1> lpar word, ax 604 <1> lpar word, in_ip 605 <1> lemit off 606 <1> lenter 0 000009CE 89E5 mov bp, sp ; replacement code 0 000009D0 8B4600 mov ax, [bp + ?in_ip] ; ax = ip 0 000009D3 874612 xchg ax, [bp + ?in_es_out_ip] ; ?out_ip = ip, ax = ?in_es 610 <1> lleave ctx 0 000009D6 8EC0 mov es, ax ; es = ?in_es 612 <1> assume es:nothing 0 000009D8 58 pop ax ; discard ?in_ip 0 000009D9 58 pop ax 0 000009DA 5B pop bx 0 000009DB 59 pop cx 0 000009DC 5A pop dx 0 000009DD 5E pop si 0 000009DE 5F pop di 0 000009DF 5D pop bp 0 000009E0 1F pop ds 622 <1> assume ds:nothing 0 000009E1 C3 retn 624 <1> EndProc restore_world 625 <1> 626 <1> ; 627 <1> ; save_world saves complete registers on the stack 628 <1> ; 629 <1> procedure save_world,NEAR 629 ****************** <1> warning: proc save_world... [-w+user] 630 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 631 <1> lframe 0 632 <1> lpar word, in_ip_out_es 633 <1> lpar word, ds 0 000009E2 1E push ds 0 000009E3 5589E5 lenter ; bp 636 <1> lvar word, di 0 000009E6 57 push di 638 <1> lvar word, si 0 000009E7 56 push si 640 <1> lvar word, dx 0 000009E8 52 push dx 642 <1> lvar word, cx 0 000009E9 51 push cx 644 <1> lvar word, bx 0 000009EA 53 push bx 646 <1> lvar word, ax 0 000009EB 50 push ax 648 <1> lvar word, in_ax_out_ip 0 000009EC 50 push ax ; ?in_ax = ax 0 000009ED 8CC0 mov ax, es ; = es 0 000009EF 874604 xchg ax, word [bp + ?in_ip_out_es] ; ?out_es = es, ax = ip 0 000009F2 8746F2 xchg ax, word [bp + ?in_ax_out_ip] ; ?out_ip = ip, ax = ?in_ax 0 000009F5 8B6E00 mov bp, [bp + ?frame_bp] ; restore bp 654 <1> lleave ctx ; drop context without code 0 000009F8 C3 retn 656 <1> EndProc save_world 657 <1> 658 <1> %ifndef BUF2 659 <1> %IF BUFFERFLAG 660 <1> 661 <1> Break ;AN000; 662 <1> ; Inputs: ;AN000; 663 <1> ; none ;AN000; 664 <1> ; Function: ;AN000; 665 <1> ; save map ;AN000; 666 <1> ; Outputs: ;AN000; 667 <1> ; none ;AN000; 668 <1> ; No other registers altered ;AN000; 669 <1> ;AN000; 670 <1> Procedure SAVE_USER_MAP,NEAR ;AN000; 671 <1> ASSUME DS:NOTHING,ES:NOTHING ;AN000; 672 <1> ;AN000; 673 <1> CMP byte [ss:BUF_EMS_MODE],-1 ;LB. EMS support ;AN000; 674 <1> JZ No_user_save ;LB. no ;AN000; 675 <1> CMP byte [ss:SETVECTFLAG], 1 676 <1> jz No_user_save 677 <1> ; MOV [ACT_PAGE],-1 ;LB. invalidate active page ;AN000; 678 <1> ; MOV WORD PTR [LASTBUFFER],-1 ;LB. and last buffer pointer ;AN000; 679 <1> PUSH AX ;LB. save regs ;AN000; 680 <1> PUSH DS ;LB. save regs ;AN000; 681 <1> PUSH ES ;LB. ;AN000; 682 <1> PUSH SI ;LB. ;AN000; 683 <1> PUSH DI ;LB. ;AN000; 684 <1> MOV SI,OFFSET BUF_EMS_SEG_CNT wrt DOSGROUP ;LB. ;AN000; 685 <1> MOV DI,OFFSET BUF_EMS_MAP_USER wrt DOSGROUP ;LB. ;AN000; 686 <1> 687 <1> PUSH ss 688 <1> POP ES 689 <1> PUSH ss ;LB. ds:si -> ems seg cnt ;AN000; 690 <1> POP DS ;LB. ;AN000; 691 <1> 692 <1> MOV AX,4F00H ;LB. save map ;AN000; 693 <1> EnterCrit critDisk ;LB. enter critical section ;AN000; 694 <1> INT 67H ;LB. ;AN000; 695 <1> LeaveCrit critDisk ;LB. leave critical section ;AN000; 696 <1> POP DI ;LB. ;AN000; 697 <1> POP SI ;LB. restore regs ;AN000; 698 <1> POP ES ;LB. ;AN000; 699 <1> POP DS ;LB. ;AN000; 700 <1> POP AX ;LB. restore ;AN000; 701 <1> No_user_save: ;AN000; 702 <1> return ;AN000; 703 <1> EndProc SAVE_USER_MAP ;AN000; 704 <1> ;AN000; 705 <1> 706 <1> Break ;AN000; 707 <1> ; Inputs: ;AN000; 708 <1> ; none ;AN000; 709 <1> ; Function: ;AN000; 710 <1> ; restore_map ;AN000; 711 <1> ; Outputs: ;AN000; 712 <1> ; none ;AN000; 713 <1> ; No other registers altered ;AN000; 714 <1> ;AN000; 715 <1> Procedure RESTORE_USER_MAP,NEAR ;AN000; 716 <1> ASSUME DS:NOTHING,ES:NOTHING ;AN000; 717 <1> 718 <1> CMP byte [ss:BUF_EMS_MODE],-1 ;LB. EMS support ;AN000; 719 <1> JZ No_user_restore ;LB. no ;AN000; 720 <1> CMP byte [ss:SETVECTFLAG], 1 721 <1> jz No_user_restore 722 <1> PUSH AX ;LB. save regs ;AN000; 723 <1> PUSH DS ;LB. save regs ;AN000; 724 <1> PUSH SI ;LB. ;AN000; 725 <1> MOV SI,OFFSET BUF_EMS_MAP_USER wrt DOSGROUP ;LB. ;AN000; 726 <1> 727 <1> PUSH ss 728 <1> POP DS 729 <1> 730 <1> MOV AX,4F01H ;LB. restore map ;AN000; 731 <1> EnterCrit critDisk ;LB. enter critical section ;AN000; 732 <1> INT 67H ;LB. ;AN000; 733 <1> LeaveCrit critDisk ;LB. leave critical section ;AN000; 734 <1> POP SI ;LB. restore regs ;AN000; 735 <1> POP DS ;LB. ;AN000; 736 <1> POP AX ;LB. ;AN000; 737 <1> No_user_restore: ;AN000; 738 <1> return ;AN000; 739 <1> EndProc RESTORE_USER_MAP 740 <1> 741 <1> %ENDIF 742 <1> %endif 743 <1> 744 <1> ; 745 <1> ; get_user_stack returns the user's stack (and hence registers) in DS:SI 746 <1> ; 747 <1> procedure get_user_stack,NEAR 747 ****************** <1> warning: proc get_user_stack... [-w+user] 748 <1> assume ds:nothing, es:nothing, ss:nothing 0 000009F9 96 xchg ax, si 0 000009FA E8[0000] call doscode_getdosdata 0 000009FD 8ED8 mov ds, ax 752 <1> assume ds:DOSGROUP 0 000009FF 96 xchg ax, si 0 00000A00 C536[0000] LDS SI,[user_SP] 0 00000A04 C3 return 756 <1> EndProc get_user_stack 757 <1> 758 <1> %IFN IBM 759 <1> BREAK 761 <1> D_SET_OEM_HANDLER: 762 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 763 <1> 764 <1> ; Inputs: 765 <1> ; User registers, User Stack, INTS disabled 766 <1> ; If CALL F8, DS:DX is new handler address 767 <1> ; Function: 768 <1> ; Process OEM INT 21 extensions 769 <1> ; Outputs: 770 <1> ; Jumps to OEM_HANDLER if appropriate 771 <1> 772 <1> JNE DO_OEM_FUNC ; If above F8 try to jump to handler 773 <1> invalid instruction fixme 774 <1> ; ldos: need segment override 775 <1> MOV WORD PTR [OEM_HANDLER],DX ; Set Handler 776 <1> MOV WORD PTR [OEM_HANDLER+2],DS 777 <1> IRET ; Quick return, Have altered no registers 778 <1> 779 <1> DO_OEM_FUNC: 780 <1> invalid instruction fixme 781 <1> ; ldos: need segment override 782 <1> CMP WORD PTR [OEM_HANDLER],-1 783 <1> JNZ OEM_JMP 784 <1> JMP BADCALL ; Handler not initialized 785 <1> 786 <1> OEM_JMP: 787 <1> invalid instruction fixme 788 <1> ; ldos: need segment override 789 <1> JMP [OEM_HANDLER] 790 <1> %ENDIF 17 ;=== Pop trace listing source 18 END 19 20 === Trace listing source: ../DOS/mscode.lst 1 ; SCCSID = @(#)ibmcode.asm 1.1 85/04/10 2 ;TITLE MISC DOS ROUTINES - Int 25 and 26 handlers and other 3 ;NAME IBMCODE 4 5 ; 6 ; System call dispatch code. 7 ; 8 9 [list -] 9 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 14 15 ;=== Push trace listing source: ms_code.nas 16 %include "ms_code.nas" 1 <1> ; SCCSID = @(#)mscode.asm 1.2 85/07/23 2 <1> ; 3 <1> ; MSCODE.ASM -- MSDOS code 4 <1> ; 5 <1> 6 <1> [list -] 6 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <5> [list -] 14 <4> [list -] 3 <3> === Switch to base=000E10h -> "DOSSTART" 4 <3> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <3> ; (no prior section) ; DOSSTART ENDS 6 <3> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <3> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <3> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <3> === Switch to base=000E10h -> "CONSTANTS" 10 <3> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <3> ; (no prior section) ; CONSTANTS ENDS 12 <3> === Switch to base=000E10h -> "DATA" 13 <3> addsection DATA, align=2 PUBLIC class=DATA 14 <3> ; (no prior section) ; DATA ENDS 15 <3> === Switch to base=000E10h -> "TABLE" 16 <3> addsection TABLE, align=2 PUBLIC class=TABLE 17 <3> ; (no prior section) ; TABLE ENDS 18 <3> === Switch to base=000E10h -> "DOSDATATABLE" 19 <3> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <3> ; (no prior section) ; DOSDATATABLE ENDS 21 <3> === Switch to base=000E10h -> "DOSDATACODE" 22 <3> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <3> ; (no prior section) ; DOSDATACODE ENDS 24 <3> === Switch to base=000E10h -> "DOSBIODATA" 25 <3> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <3> === Switch to base=000E10h -> "LAST" 27 <3> addsection LAST, align=16 PUBLIC class=LAST 28 <3> ; (no prior section) ; LAST ENDS 29 <3> 30 <3> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <3> 32 <3> %include "entryseg.nas" 1 <4> 2 <4> %ifndef ENTRYSEGNAS 3 <4> %define ENTRYSEGNAS 1 4 <4> 5 <4> %include "lmacros3.mac" 1 <5> [list -] 6 <4> === Switch to base=000000h -> "DOSENTRY" 7 <4> addsection DOSENTRY, class=%[DOSENTRY] 8 <4> 9 <4> group DOSENTRYGROUP DOSENTRY 10 <4> 11 <4> %endif 8 <2> 9 <2> %include "dcodeseg.nas" 1 <3> 2 <3> %ifndef DCODESEGNAS 3 <3> %assign DCODESEGNAS 1 4 <3> === Switch to base=002450h -> "DOSCODETABLE" 5 <3> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <3> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <3> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <3> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <3> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <3> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <3> 12 <3> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <3> 14 <3> %endif 10 <2> === Switch to base=000E10h -> "LAST" 11 <2> section LAST 12 <2> ; (no prior section) ; LAST ENDS 9 <1> %include "dossym.mac" 1 <2> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 2 <2> ; SCCSID = @(#)dossym.asm 1.1 85/04/10 3 <2> ; PAGE 80,132 4 <2> TRUE EQU 0FFFFh 5 <2> FALSE EQU 0 6 <2> 7 <2> Installed equ TRUE 8 <2> %IFNDEF DEBUG 9 <2> DEBUG equ FALSE 10 <2> %ENDIF 11 <2> %IFNDEF debug 12 <2> debug equ DEBUG 13 <2> %ENDIF 14 <2> 15 <2> %if 0 16 <2> DBCS equ FALSE ; for fixmem.pl operation 17 <2> %endif 18 <2> 19 <2> ; NASM original macros 20 <2> 21 <2> %macro DBCS 1.nolist 22 <2> %defstr %%string %1 23 <2> %substr %%prefix %%string 1,2 24 <2> %substr %%suffix %%string 3,-1 25 <2> %ifnidni %%prefix, "= " 26 <2> %error Unexpected DBCS prefix 27 <2> %endif 28 <2> %deftok %%token %%suffix 29 <2> %xdefine DBCS %%token 30 <2> %endmacro 31 <2> 32 <2> %include "DBCS.SW" 1 <3> DBCS = FALSE 2 <3> 33 <2> %unmacro DBCS 1.nolist 34 <2> 35 <2> ; end of NASM original macros 36 <2> 37 <2> %include "dosmac.mac" 1 <3> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dosmac.asm 1.1 85/04/10 3 <3> ; 4 <3> ; Macro file for MSDOS. 5 <3> ; 6 <3> 7 <3> %ifndef __DOSMAC_MAC__ 8 <3> %assign __DOSMAC_MAC__ 1 9 <3> 10 <3> TRUE EQU 0FFFFh 11 <3> FALSE EQU 0 12 <3> 13 <3> 14 <3> ; NASM original macros (comment for fixmem.pl) 15 <3> 16 <3> ;SUBTTL BREAK a listing into pages and give new subtitles 17 <3> ;PAGE 18 <3> %imacro BREAK 0-1+.nolist 19 <3> ;SUBTTL subtitle 20 <3> ;PAGE 21 <3> %endmacro 22 <3> ;.xcref break 23 <3> 24 <3> BREAK 25 <3> 26 <3> %if 0 27 <3> AsmVars Macro varlist 28 <3> IRP var, 29 <3> AsmVar var 30 <3> ENDM 31 <3> ENDM 32 <3> 33 <3> AsmVar Macro var 34 <3> IFNDEF var 35 <3> var = FALSE 36 <3> ENDIF 37 <3> ENDM 38 <3> %endif 39 <3> 40 <3> BREAK 41 <3> 42 <3> ; 43 <3> ; declare a variable external and allocate a size 44 <3> ; 45 <3> ;AsmVar InstalledData 46 <3> %ifndef InstalledData 47 <3> %define InstalledData 0 48 <3> %endif 49 <3> 50 <3> %imacro I_NEED 1-2.nolist 51 <3> %ifn InstalledData === Switch to base=000E10h -> "DATA" 52 <3> [section DATA] 53 <3> %IFIDNi %2, WORD 54 <3> EXTRN %1:WORD 55 <3> %ELSE 56 <3> %IFIDNi %2, DWORD 57 <3> EXTRN %1:DWORD 58 <3> %ELSE 59 <3> EXTRN %1:BYTE 60 <3> %ENDIF 61 <3> %ENDIF 62 <3> __SECT__ 63 <3> %ENDIF 64 <3> %endmacro 65 <3> ;.xcref I_need 66 <3> 67 <3> ; 68 <3> ; call a procedure that may be external. The call will be short. 69 <3> ; 70 <3> %imacro invoke 1.nolist 71 <3> ;.xcref 72 <3> EXTRN %1:NEAR 73 <3> ;.cref 74 <3> CALL %1 75 <3> %endmacro 76 <3> ;.xcref invoke 77 <3> 78 <3> ;PAGE 79 <3> ; 80 <3> ; jump to a label that may be external. The jump will be near. 81 <3> ; 82 <3> %imacro transfer 1.nolist 83 <3> ;.xcref 84 <3> EXTRN %1:NEAR 85 <3> ;.cref 86 <3> JUMP %1 87 <3> %endmacro 88 <3> ;.xcref transfer 89 <3> 90 <3> ; 91 <3> ; get a short address in a word 92 <3> ; 93 <3> %imacro short_addr 1.nolist 94 <3> %ifnidn %1, ? 95 <3> EXTRN %1:NEAR 96 <3> DW OFFSET %1 97 <3> %ELSE 98 <3> DW ? 99 <3> %ENDIF 100 <3> %endmacro 101 <3> ;.xcref short_addr 102 <3> 103 <3> ; 104 <3> ; get a long address in a dword 105 <3> ; 106 <3> %imacro long_addr 1.nolist 107 <3> EXTRN %1:NEAR 108 <3> DD %1 109 <3> %endmacro 110 <3> ;.xcref long_addr 111 <3> 112 <3> ; 113 <3> ; declare a PROC near or far but PUBLIC nonetheless 114 <3> ; 115 <3> ;.xcref ?frame 116 <3> ;.xcref ?aframe 117 <3> ;.xcref ?stackdepth 118 <3> ;.xcref ?initstack 119 <3> %assign ?frame 0 ; initial 120 <3> %assign ?aframe 0 ; initial 121 <3> %assign ?stackdepth 0 ; initial stack size 122 <3> %assign ?initstack 0 ; initial stack size 123 <3> 124 <3> %imacro procedure 1-2.nolist 125 <3> %assign ?frame 0 126 <3> %assign ?aframe 2 ;; remember the pushed BP 127 <3> %warning proc %1... 128 <3> %1 PROC %2 129 <3> PUBLIC %1 130 <3> %assign ?initstack ?stackdepth ;; beginning of procedure 131 <3> %endmacro 132 <3> ;.xcref procedure 133 <3> 134 <3> ; 135 <3> ; end a procedure and check that stack depth is preserved 136 <3> ; 137 <3> %imacro EndProc 1-2.nolist 138 <3> %ifnidni %2, NoCheck ;; check the stack size 139 <3> %if ?initstack != ?stackdepth ;; is it different? 140 <3> %warning ***** Possible stack size error in %1 ***** 141 <3> %endif 142 <3> %endif 143 <3> %1 ENDP 144 <3> %endmacro 145 <3> ;.xcref endproc 146 <3> ;PAGE 147 <3> ; 148 <3> ; define a data item to be public and of an appropriate size/type 149 <3> ; 150 <3> 151 <3> %imacro stripangles 2.nolist 152 <3> %defstr %%param %2 153 <3> %rep 16 154 <3> %substr %%opening %%param 1 155 <3> %ifidn %%opening, '<' 156 <3> %substr %%param %%param 2,-1 157 <3> %endif 158 <3> %endrep 159 <3> %rep 16 160 <3> %strlen %%length %%param 161 <3> %substr %%closing %%param %%length 162 <3> %ifidn %%closing, '>' 163 <3> %substr %%param %%param 1,-2 164 <3> %endif 165 <3> %endrep 166 <3> %deftok %%token %%param 167 <3> %1 %%token 168 <3> %endmacro 169 <3> 170 <3> %imacro I_AM 2-*.nolist 171 <3> ;I_AM MACRO name,size,init 172 <3> %xdefine %%name %1 173 <3> ;; declare the type of the object 174 <3> %IFIDNi %2, WORD 175 <3> %1 LABEL WORD 176 <3> %assign I_AM_SIZE 1 177 <3> %assign I_AM_LEN 2 178 <3> %ELSE 179 <3> %IFIDNi %2, DWORD 180 <3> %1 LABEL DWORD 181 <3> %assign I_AM_SIZE 2 182 <3> %assign I_AM_LEN 2 183 <3> %ELSE 184 <3> %IFIDNi %2, BYTE 185 <3> %1 LABEL BYTE 186 <3> %assign I_AM_SIZE 1 187 <3> %assign I_AM_LEN 1 188 <3> %ELSE 189 <3> %1 LABEL BYTE 190 <3> %undef I_AM_SIZE 191 <3> stripangles %assign I_AM_SIZE, %2 192 <3> %assign I_AM_LEN 1 193 <3> %ENDIF 194 <3> %ENDIF 195 <3> %ENDIF 196 <3> ;; declare the object public 197 <3> PUBLIC %%name 198 <3> ;; if no initialize then allocate blank storage 199 <3> %IF %0 == 2 200 <3> DB I_AM_SIZE*I_AM_LEN DUP (?) 201 <3> %ELSE 202 <3> %ifn InstalledData 203 <3> %rotate 2 204 <3> %rep %0 - 2 205 <3> %IF I_AM_LEN == 1 206 <3> stripangles db, %1 207 <3> %ELSE 208 <3> stripangles dw, %1 209 <3> %ENDIF 210 <3> %assign I_AM_SIZE I_AM_SIZE - 1 211 <3> %rotate 1 212 <3> %endrep 213 <3> %IF I_AM_SIZE != 0 214 <3> %error ***** initialization of %%name not complete ***** 215 <3> %ENDIF 216 <3> %ELSE 217 <3> DB I_AM_SIZE*I_AM_LEN DUP (?) 218 <3> %ENDIF 219 <3> %ENDIF 220 <3> %endmacro 221 <3> 222 <3> %imacro I_AM_NOBITS 2-*.nolist 223 <3> ;I_AM MACRO name,size,init 224 <3> %xdefine %%name %1 225 <3> ;; declare the type of the object 226 <3> %IFIDNi %2, WORD 227 <3> %1 LABEL WORD 228 <3> %assign I_AM_SIZE 1 229 <3> %assign I_AM_LEN 2 230 <3> %ELSE 231 <3> %IFIDNi %2, DWORD 232 <3> %1 LABEL DWORD 233 <3> %assign I_AM_SIZE 2 234 <3> %assign I_AM_LEN 2 235 <3> %ELSE 236 <3> %IFIDNi %2, BYTE 237 <3> %1 LABEL BYTE 238 <3> %assign I_AM_SIZE 1 239 <3> %assign I_AM_LEN 1 240 <3> %ELSE 241 <3> %1 LABEL BYTE 242 <3> %undef I_AM_SIZE 243 <3> stripangles %assign I_AM_SIZE, %2 244 <3> %assign I_AM_LEN 1 245 <3> %ENDIF 246 <3> %ENDIF 247 <3> %ENDIF 248 <3> ;; declare the object public 249 <3> PUBLIC %%name 250 <3> ;; if no initialize then allocate blank storage 251 <3> %IF %0 == 2 252 <3> resb I_AM_SIZE*I_AM_LEN 253 <3> %ELSE 254 <3> %ifn InstalledData 255 <3> %rotate 2 256 <3> %rep %0 - 2 257 <3> %IF I_AM_LEN == 1 258 <3> resb 1 259 <3> %ELSE 260 <3> resw 1 261 <3> %ENDIF 262 <3> %assign I_AM_SIZE I_AM_SIZE - 1 263 <3> %rotate 1 264 <3> %endrep 265 <3> %IF I_AM_SIZE != 0 266 <3> %error ***** initialization of %%name not complete ***** 267 <3> %ENDIF 268 <3> %ELSE 269 <3> resb I_AM_SIZE*I_AM_LEN 270 <3> %ENDIF 271 <3> %ENDIF 272 <3> %endmacro 273 <3> 274 <3> ;.xcref I_AM 275 <3> ;.xcref I_AM_SIZE 276 <3> ;.xcref I_AM_LEN 277 <3> %assign I_AM_SIZE 0 278 <3> %assign I_AM_LEN 0 279 <3> 280 <3> ;PAGE 281 <3> 282 <3> ; 283 <3> ; define an entry in a procedure 284 <3> ; 285 <3> %imacro entry 1.nolist 286 <3> %1: 287 <3> PUBLIC %1 288 <3> %endmacro 289 <3> ;.xcref entry 290 <3> 291 <3> BREAK 292 <3> 293 <3> %imacro error 1.nolist 294 <3> ;.xcref 295 <3> MOV AL, %1 296 <3> transfer SYS_RET_ERR 297 <3> ;.cref 298 <3> %endmacro 299 <3> ;.xcref error 300 <3> 301 <3> BREAK 302 <3> ; 303 <3> ; given a label either 2 byte jump to another label _J 304 <3> ; if it is near enough or 3 byte jump to 305 <3> ; 306 <3> 307 <3> %imacro jump 1.nolist 308 <3> ;.xcref 309 <3> 310 <3> %ifndef %1_J ;; is this the first invocation 311 <3> %%a: JMP %1 312 <3> %ELSE 313 <3> %IF (%1_J >= $) || ($-%1_J > 126) 314 <3> %%a: JMP %1 ;; is the jump too far away? 315 <3> %ELSE 316 <3> %%a: JMP %1_J ;; do the short one... 317 <3> %ENDIF 318 <3> %ENDIF 319 <3> %ixdefine %1_j %%a 320 <3> ;.cref 321 <3> %endmacro 322 <3> ;.xcref jump 323 <3> 324 <3> BREAK 325 <3> 326 <3> %imacro return 0.nolist 327 <3> %%a: 328 <3> RET 329 <3> %xdefine ret_l %%a 330 <3> %endmacro 331 <3> ;.xcref return 332 <3> 333 <3> BREAK 334 <3> 335 <3> %imacro condret 2.nolist 336 <3> %assign %%exit 0 337 <3> %ifdef ret_l ;; if ret_l is defined 338 <3> %if (($ - ret_l) <= 126) && ($ > ret_l) 339 <3> ;; if ret_l is near enough then 340 <3> %%a: j%1 ret_l ;; a: j to ret_l 341 <3> %xdefine ret_%1 %%a ;; define ret_ to be a: 342 <3> %assign %%exit 1 343 <3> %endif 344 <3> %endif 345 <3> %ifn %%exit 346 <3> %ifdef ret_%1 ;; if ret_ defined 347 <3> %if (($ - ret_%1) <= 126) && ($ > ret_%1) 348 <3> ;; if ret_ is near enough 349 <3> %%a: j%1 ret_%1 ;; a: j to ret_ 350 <3> %xdefine ret_%1 %%a ;; define ret_ to be a: 351 <3> %assign %%exit 1 352 <3> %endif 353 <3> %endif 354 <3> %endif 355 <3> %ifn %%exit 356 <3> j%2 %%a ;; j a: 357 <3> return ;; return 358 <3> %%a: ;; a: 359 <3> %xdefine ret_%1 ret_l ;; define ret_ to be ret_l 360 <3> %endif 361 <3> %endmacro 362 <3> ;.xcref condret 363 <3> 364 <3> BREAK 365 <3> 366 <3> %imacro retz 0.nolist 367 <3> condret z,nz 368 <3> %endmacro 369 <3> ;.xcref retz 370 <3> 371 <3> BREAK 372 <3> 373 <3> %imacro retnz 0.nolist 374 <3> condret nz,z 375 <3> %endmacro 376 <3> ;.xcref retnz 377 <3> 378 <3> BREAK 379 <3> 380 <3> %imacro retc 0.nolist 381 <3> condret c,nc 382 <3> %endmacro 383 <3> ;.xcref retc 384 <3> 385 <3> BREAK 386 <3> 387 <3> %imacro retnc 0.nolist 388 <3> condret nc,c 389 <3> %endmacro 390 <3> ;.xcref retnc 391 <3> 392 <3> BREAK 393 <3> 394 <3> %imacro context 1.nolist 395 <3> PUSH SS 396 <3> stripangles POP, %1 397 <3> ; ASSUME %1:DOSGROUP 398 <3> %endmacro 399 <3> ;.xcref context 400 <3> 401 <3> BREAK 402 <3> 403 <3> %imacro SaveReg 0-*.nolist ;; push those registers 404 <3> %rep %0 405 <3> %assign ?stackdepth ?stackdepth + 1 406 <3> stripangles push, %1 407 <3> %rotate 1 408 <3> %endrep 409 <3> %endmacro 410 <3> ;.xcref SaveReg 411 <3> 412 <3> BREAK 413 <3> 414 <3> %imacro RestoreReg 0-*.nolist ;; pop those registers 415 <3> %rep %0 416 <3> %assign ?stackdepth ?stackdepth - 1 417 <3> stripangles pop, %1 418 <3> %rotate 1 419 <3> %endrep 420 <3> %endmacro 421 <3> ;.xcref RestoreReg 422 <3> 423 <3> BREAK 424 <3> 425 <3> %imacro EnterCrit 1.nolist 426 <3> Invoke E%1 427 <3> %endmacro 428 <3> 429 <3> %imacro LeaveCrit 1.nolist 430 <3> Invoke L%1 431 <3> %endmacro 432 <3> 433 <3> Break 434 <3> 435 <3> ;AsmVars 436 <3> %ifndef ShareF 437 <3> %idefine ShareF 0 438 <3> %endif 439 <3> %ifndef Cargs 440 <3> %idefine Cargs 0 441 <3> %endif 442 <3> %ifndef Redirector 443 <3> %idefine Redirector 0 444 <3> %endif 445 <3> %ifndef debug 446 <3> %idefine debug 0 447 <3> %endif 448 <3> 449 <3> %if debug 450 <3> %imacro fmt 3-*.nolist 451 <3> ;fmt MACRO typ,lev,fmts,args 452 <3> ;local a,b,c 453 <3> PUSHF 454 <3> %IFNempty %1 455 <3> TEST word [BugTyp],%1 456 <3> JZ %%c 457 <3> CMP word [BugLev],%2 458 <3> JB %%c 459 <3> %ENDIF 460 <3> PUSH AX 461 <3> PUSH BP 462 <3> MOV BP,SP 463 <3> %If (! sharef) && (! redirector) === Switch to base=000E10h -> "TABLE" 464 <3> [section Table] 465 <3> %%a: db %3,0 466 <3> __SECT__ 467 <3> MOV AX,OFFSET %%a wrt DOSGROUP 468 <3> %else 469 <3> jmp short %%b 470 <3> %%a: db %3,0 471 <3> %if sharef 472 <3> %%b: mov ax,offset %%a wrt share 473 <3> %else 474 <3> %%b: mov ax,offset %%a wrt netwrk 475 <3> %endif 476 <3> %endif 477 <3> PUSH AX 478 <3> %iassign cargs 2 479 <3> %rotate 3 480 <3> %rep %0 - 3 481 <3> %ifidni ax, %1 482 <3> MOV AX,[BP+2] 483 <3> %ELSE 484 <3> MOV AX, %1 485 <3> %ENDIF 486 <3> PUSH AX 487 <3> %iassign cargs cargs + 2 488 <3> %rotate 1 489 <3> %endrep 490 <3> invoke PFMT 491 <3> ADD SP, Cargs 492 <3> POP BP 493 <3> POP AX 494 <3> %%c: 495 <3> POPF 496 <3> %endmacro 497 <3> %else 498 <3> %imacro fmt 3-*.nolist 499 <3> %endmacro 500 <3> %endif 501 <3> 502 <3> Break 503 <3> 504 <3> ;AsmVar Debug,$temp 505 <3> 506 <3> %imacro detectstripangles 4.nolist 507 <3> %defstr %%param %4 508 <3> %assign ?%2 0 509 <3> %assign ?%3 0 510 <3> %rep 16 511 <3> %substr %%opening %%param 1 512 <3> %ifidn %%opening, '<' 513 <3> %substr %%param %%param 2,-1 514 <3> %assign ?%2 ?%2 + 1 515 <3> %endif 516 <3> %endrep 517 <3> %rep 16 518 <3> %strlen %%length %%param 519 <3> %substr %%closing %%param %%length 520 <3> %ifidn %%closing, '>' 521 <3> %substr %%param %%param 1,-2 522 <3> %assign ?%3 ?%3 + 1 523 <3> %endif 524 <3> %endrep 525 <3> %deftok %%token %%param 526 <3> %define ?%1 %%token 527 <3> %endmacro 528 <3> 529 <3> 530 <3> %IF debug 531 <3> %imacro DOSAssume 3-*.nolist 532 <3> ;DOSAssume Macro reg,reglist,message 533 <3> %ifidni %1, CS 534 <3> %assign %%temp 1 535 <3> %else 536 <3> %ifidni %1, SS 537 <3> %assign %%temp 0 538 <3> %else 539 <3> %error ***** Invalid DOS register %1 in DOSAssume ***** 540 <3> %endif 541 <3> %endif 542 <3> %rotate 1 543 <3> %assign %%level 0 544 <3> %assign %%amount %0 - 1 545 <3> %rep 16 546 <3> detectstripangles %%token, %%opening, %%closing, %1 547 <3> %assign %%level %%level + ? %+ %%opening 548 <3> %assign %%level %%level - ? %+ %%closing 549 <3> %ifidni ? %+ %%token, DS 550 <3> %assign %%temp %%temp | 2 551 <3> %else 552 <3> %ifidni ? %+ %%token, ES 553 <3> %assign %%temp %%temp | 4 554 <3> %else 555 <3> %error ***** Invalid register reg in DOSAssume ***** 556 <3> %endif 557 <3> %endif 558 <3> %assign %%amount %%amount - 1 559 <3> %rotate 1 560 <3> %if %%level <= 0 561 <3> %exitrep 562 <3> %endif 563 <3> %endrep 564 <3> 565 <3> PUSH AX 566 <3> MOV AX, %%temp 567 <3> PUSH AX 568 <3> %IF SHAREF 569 <3> MOV AX,OFFSET %%a 570 <3> %ELSE 571 <3> MOV AX,OFFSET %%a wrt DOSGroup 572 <3> %ENDIF 573 <3> PUSH AX 574 <3> Invoke SegCheck 575 <3> POP AX 576 <3> %IFN SHAREF === Switch to base=000E10h -> "TABLE" 577 <3> [section Table] 578 <3> %ELSE 579 <3> JMP SHORT %%b 580 <3> %ENDIF 581 <3> %%a: 582 <3> %rep %%amount 583 <3> DB %1 584 <3> %rotate 1 585 <3> %endrep 586 <3> db 0 587 <3> %IFN SHAREF 588 <3> __SECT__ 589 <3> %ELSE 590 <3> %%b: 591 <3> %ENDIF 592 <3> ;IRP r, 593 <3> ; ASSUME r:DOSGroup 594 <3> ;ENDM 595 <3> %endmacro 596 <3> %ELSE 597 <3> %imacro DOSAssume 3-*.nolist 598 <3> ;DOSAssume Macro reg,reglist,message 599 <3> ;IRP r, 600 <3> ; ASSUME r:DOSGroup 601 <3> ;ENDM 602 <3> %endmacro 603 <3> %ENDIF 604 <3> 605 <3> BREAK 606 <3> 607 <3> %if 0 608 <3> ;IF DEBUG 609 <3> Assert MACRO kind, objs, message 610 <3> LOCAL a,b 611 <3> IFIDN , 612 <3> CMP objs,0 613 <3> JZ a 614 <3> fmt <>,<>, 615 <3> a: 616 <3> ELSE 617 <3> IFIDN , 618 <3> CMP objs,0 619 <3> JNZ a 620 <3> fmt <>,<>, 621 <3> a: 622 <3> ELSE 623 <3> PUSH AX 624 <3> IRP obj, 625 <3> PUSH obj 626 <3> ENDM 627 <3> IF SHAREF 628 <3> MOV AX,OFFSET b 629 <3> ELSE 630 <3> MOV AX,OFFSET DOSGroup:b 631 <3> ENDIF 632 <3> PUSH AX 633 <3> IFIDN , 634 <3> Invoke BUFCheck 635 <3> ENDIF 636 <3> IFIDN , 637 <3> Invoke SFTCheck 638 <3> ENDIF 639 <3> IFIDN , 640 <3> Invoke DPBCheck 641 <3> ENDIF 642 <3> POP AX 643 <3> IF SHAREF 644 <3> JMP SHORT a 645 <3> b DB Message,0 646 <3> a: 647 <3> ELSE === Switch to base=000E10h -> "TABLE" 648 <3> Table segment 649 <3> b db Message,0 === Switch to base=000E10h -> "TABLE" 650 <3> Table ends 651 <3> ENDIF 652 <3> ENDIF 653 <3> ENDIF 654 <3> ENDM 655 <3> %ELSE 656 <3> %imacro Assert 0-*.nolist 657 <3> %endmacro 658 <3> %ENDIF 659 <3> 660 <3> %ifndef Installed 661 <3> %idefine Installed 1 662 <3> %endif 663 <3> 664 <3> Break 665 <3> 666 <3> %imacro CallInstall 3-*.nolist 667 <3> ;CallInstall MACRO name,mpx,fn,save,restore 668 <3> %define %%name %1 669 <3> %assign %%mpx %2 670 <3> %assign %%fn %3 671 <3> %IF Installed 672 <3> %rotate 3 673 <3> %assign %%level 0 674 <3> %assign %%amountsaved 0 675 <3> %rep %0 - 3 676 <3> %ifnempty %1 677 <3> detectstripangles %%token, %%opening, %%closing, %1 678 <3> %assign %%level %%level + ? %+ %%opening 679 <3> %assign %%level %%level - ? %+ %%closing 680 <3> SaveReg ? %+ %%token 681 <3> %endif 682 <3> %assign %%amountsaved %%amountsaved + 1 683 <3> %rotate 1 684 <3> %if %%level <= 0 685 <3> %exitrep 686 <3> %endif 687 <3> %endrep 688 <3> MOV AX,(%%mpx << 8) + %%fn 689 <3> INT 2Fh 690 <3> %assign %%level 0 691 <3> %assign %%amountrestored 0 692 <3> %rep %0 - 3 - %%amountsaved 693 <3> %ifnempty %1 694 <3> detectstripangles %%token, %%opening, %%closing, %1 695 <3> %assign %%level %%level + ? %+ %%opening 696 <3> %assign %%level %%level - ? %+ %%closing 697 <3> RestoreReg ? %+ %%token 698 <3> %endif 699 <3> %assign %%amountrestored %%amountrestored + 1 700 <3> %rotate 1 701 <3> %if %%level <= 0 702 <3> %exitrep 703 <3> %endif 704 <3> %endrep 705 <3> %if %%level > 0 || %0 != 3 + %%amountsaved + %%amountrestored 706 <3> %error Wrong amount saved or restored 707 <3> %endif 708 <3> %ELSE 709 <3> Invoke %%name 710 <3> %ENDIF 711 <3> %endmacro 712 <3> 713 <3> Break 714 <3> 715 <3> %imacro localvar 2.nolist 716 <3> %ifidni %2, BYTE 717 <3> %assign ?frame ?frame + 1 718 <3> %assign %%a ?frame 719 <3> labelsize %1, byte, bp - %%a 720 <3> %else 721 <3> %ifidni %2, WORD 722 <3> %assign ?frame ?frame + 2 723 <3> %assign %%a ?frame 724 <3> labelsize %1, word, bp - %%a 725 <3> %else 726 <3> %ifidni %2, DWORD 727 <3> %assign ?frame ?frame + 4 728 <3> %assign %%a ?frame 729 <3> labelsize %1 %+ l, word, bp - %%a 730 <3> labelsize %1 %+ h, word, bp - %%a + 2 731 <3> labelsize %1, dword, bp - %%a 732 <3> %else 733 <3> %assign ?frame ?frame + %2 734 <3> %assign %%a ?frame 735 <3> labelsize %1, byte, bp - %%a 736 <3> %endif 737 <3> %endif 738 <3> %endif 739 <3> %endmacro 740 <3> 741 <3> %imacro enter 0.nolist 742 <3> push bp 743 <3> mov bp,sp 744 <3> sub sp,?frame 745 <3> %endmacro 746 <3> 747 <3> %imacro leave 0.nolist 748 <3> mov sp,bp 749 <3> pop bp 750 <3> %endmacro 751 <3> 752 <3> 753 <3> %imacro argvar 2.nolist 754 <3> %ifidni %2, BYTE 755 <3> %assign %%a ?aframe 756 <3> %assign ?aframe ?aframe + 1 757 <3> labelsize %1, byte, bp + %%a 758 <3> %else 759 <3> %ifidni %2, WORD 760 <3> %assign %%a ?aframe 761 <3> %assign ?aframe ?aframe + 2 762 <3> labelsize %1, word, bp + %%a 763 <3> %else 764 <3> %ifidni %2, DWORD 765 <3> %assign %%a ?aframe 766 <3> %assign ?aframe ?aframe + 4 767 <3> labelsize %1 %+ l, word, bp + %%a 768 <3> labelsize %1 %+ h, word, bp + %%a + 2 769 <3> labelsize %1, dword, bp + %%a 770 <3> %else 771 <3> %assign %%a ?aframe 772 <3> %assign ?aframe ?aframe + %2 773 <3> labelsize %1, byte, bp + %%a 774 <3> %endif 775 <3> %endif 776 <3> %endif 777 <3> %endmacro 778 <3> 779 <3> BREAK 780 <3> 781 <3> %imacro errnz 1.nolist 782 <3> detectstripangles %%token, %%opening, %%closing, %1 783 <3> %if ? %+ %%token 784 <3> %error %1 <> 0 785 <3> %endif 786 <3> %endmacro 787 <3> 788 <3> %endif 38 <2> 39 <2> %include "versiona.mac" 1 <3> 2 <3> major_version equ 4 ;Major DOS version 3 <3> minor_version equ 00 ;Minor DOS Version 4 <3> 5 <3> MINOR_VERSION equ minor_version ; NASM port equate 6 <3> MAJOR_VERSION equ major_version ; NASM port equate 7 <3> expected_version equ (MINOR_VERSION << 8)+MAJOR_VERSION 8 <3> 9 <3> alt_major_version equ 5 ;Major DOS version 10 <3> alt_minor_version equ 26 ;Minor DOS Version 11 <3> 12 <3> alt_expected_version equ (alt_minor_version << 8) + alt_major_version 13 <3> 14 <3> new_major_version equ 5 ;Major DOS version 15 <3> new_minor_version equ 38 ;Minor DOS Version 16 <3> new_expected_version equ (new_minor_version << 8) + new_major_version 17 <3> 18 <3> %warning out: ... for DOS Version 4.00 ... 18 ****************** <3> warning: out: ... for DOS Version 4.00 ... [-w+user] 19 <3> 20 <3> ;****************************** 21 <3> ;Each assembler program should: 22 <3> ; mov ah,030h ;DOS Get Version function 23 <3> ; int 021h ;Version ret. in AX,minor version first 24 <3> ; cmp ax,expected_version ;ALL utilities should check for an 25 <3> ; jne error_handler ; EXACT version match. 26 <3> ;****************************** 27 <3> 40 <2> 41 <2> BREAK 42 <2> 43 <2> c_DEL EQU 7Fh ; ASCII rubout or delete previous char 44 <2> c_BS EQU 08h ; ^H ASCII backspace 45 <2> c_CR EQU 0Dh ; ^M ASCII carriage return 46 <2> c_LF EQU 0Ah ; ^J ASCII linefeed 47 <2> c_ETB EQU 17h ; ^W ASCII end of transmission 48 <2> c_NAK EQU 15h ; ^U ASCII negative acknowledge 49 <2> c_ETX EQU 03h ; ^C ASCII end of text 50 <2> c_HT EQU 09h ; ^I ASCII tab 51 <2> 52 <2> BREAK 53 <2> 54 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 55 <2> ; ; 56 <2> ; C A V E A T P R O G R A M M E R ; 57 <2> ; ; 58 <2> ; Certain structures, constants and system calls below are private to ; 59 <2> ; the DOS and are extremely version-dependent. They may change at any ; 60 <2> ; time at the implementors' whim. As a result, they must not be ; 61 <2> ; documented to the general public. If an extreme case arises, they ; 62 <2> ; must be documented with this warning. ; 63 <2> ; ; 64 <2> ; Those structures and constants that are subject to the above will be ; 65 <2> ; marked and bracketed with the flag: ; 66 <2> ; ; 67 <2> ; C A V E A T P R O G R A M M E R ; 68 <2> ; ; 69 <2> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 70 <2> 71 <2> %include "bpb.mac" 1 <3> %warning out: BPB.INC... 1 ****************** <3> warning: out: BPB.INC... [-w+user] 2 <3> ; SCCSID = @(#)BPB.ASM 1.1 85/04/29 3 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 4 <3> ; C A V E A T P R O G R A M M E R ; 5 <3> ; ; 6 <3> 7 <3> ; BIOS PARAMETER BLOCK DEFINITION 8 <3> ; THIS STRUCTURE IS USED TO BUILD A FULL DPB 9 <3> 10 <3> BPBLOCK STRUC 0 00000F20 ???? BPSECSZ DW ? ; SIZE IN BYTES OF PHYSICAL SECTOR 0 00000F22 ?? BPCLUS DB ? ; SECTORS/ALLOC UNIT 0 00000F23 ???? BPRES DW ? ; NUMBER OF RESERVED SECTORS 0 00000F25 ?? BPFTCNT DB ? ; NUMBER OF FATS 0 00000F26 ???? BPDRCNT DW ? ; NUMBER OF DIRECTORY ENTRIES 0 00000F28 ???? BPSCCNT DW ? ; TOTAL NUMBER OF SECTORS 0 00000F2A ?? BPMEDIA DB ? ; MEDIA DESCRIPTOR BYTE 0 00000F2B ???? BPFTSEC DW ? ; NUMBER OF SECTORS TAKEN UP BY ONE FAT 19 <3> BPBLOCK ENDS 20 <3> 21 <3> A_BPB STRUC 0 00000F20 ???? BPB_BYTESPERSECTOR DW ? 0 00000F22 ?? BPB_SECTORSPERCLUSTER DB ? 0 00000F23 ???? BPB_RESERVEDSECTORS DW ? 0 00000F25 ?? BPB_NUMBEROFFATS DB ? 0 00000F26 ???? BPB_ROOTENTRIES DW ? 0 00000F28 ???? BPB_TOTALSECTORS DW ? 0 00000F2A ?? BPB_MEDIADESCRIPTOR DB ? 0 00000F2B ???? BPB_SECTORSPERFAT DW ? 0 00000F2D ???? BPB_SECTORSPERTRACK DW ? 0 00000F2F ???? BPB_HEADS DW ? 0 00000F31 ???? BPB_HIDDENSECTORS DW ? 0 00000F33 ???? DW ? 0 00000F35 ???? BPB_BIGTOTALSECTORS DW ? 0 00000F37 ???? DW ? 0 00000F39 ???????????? DB 6 DUP(?) 37 <3> A_BPB ENDS 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 72 <2> 73 <2> %include "buffer.mac" 1 <3> %include "buf2sw.mac" 1 <4> %define BUF2 1 2 <3> 3 <3> ; SCCSID = @(#)buffer.asm 1.1 85/04/09 4 <3> BREAK 5 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 6 <3> ; C A V E A T P R O G R A M M E R ; 7 <3> ; ; 8 <3> 9 <3> %ifdef BUF2 10 <3> 11 <3> ; Field definition for I/O buffer information 12 <3> 13 <3> BUFFINFO STRUC 0 00000F20 ???????? NEXTBUF DD ? ; Pointer to next buffer in list 15 <3> ; The next two items are often refed as a word 16 <3> buf_ID: 0 00000F24 ?? BUFDRV DB ? ; Logical drive # assoc with buffer FF = free 18 <3> buf_flags: 0 00000F25 ?? BUFDATAFLAG db ? 0 00000F26 ?? BUFPRI DB ? ; Buffer selection priority (see EQUs below) 0 00000F27 ?? alignb 2 22 <3> buf_sector: 0 00000F28 ???????? BUFSECNO dd ? ; Sector number of buffer 24 <3> alignb 2 0 00000F2C ???????? BUFDRVDP DD ? ; Pointer to drive parameters 26 <3> BUFFINFO ENDS 27 <3> 28 <3> BUFINSIZ EQU BUFFINFO_struc_size 29 <3> ; Size of structure in bytes 30 <3> BUFINSIZE equ BUFINSIZ 31 <3> 32 <3> FREEPRI EQU 0 33 <3> LBRPRI EQU 2 ; Last byte of buffer read 34 <3> LBWPRI EQU 4 ; Last byte written 35 <3> RPRI EQU 6 ; Read but not last byte 36 <3> WPRI EQU 8 ; Written but not last byte 37 <3> DIRPRI EQU 15 ; Directory Sector 38 <3> FATPRI EQU 30 ; FAT sector 39 <3> 40 <3> buf_dirty EQU 01000000B 41 <3> buf_isDATA EQU 00001000B 42 <3> buf_isDIR EQU 00000100B 43 <3> buf_isFAT EQU 00000010B 44 <3> buf_type_0 EQU 11110001B ; AND sets type to "none" 45 <3> 46 <3> %else 47 <3> 48 <3> ; Field definition for I/O buffer information 49 <3> 50 <3> BUFFINFO STRUC 51 <3> buf_next DW ? ; Pointer to next buffer in list 52 <3> buf_prev DW ? ; Pointer to prev buffer in list 53 <3> buf_ID DB ? ; Drive of buffer (bit 7 = 0) 54 <3> ; SFT table index (bit 7 = 1) 55 <3> ; = FFH if buffer free 56 <3> buf_flags DB ? ; Bit 7 = 1 if Remote file buffer 57 <3> ; = 0 if Local device buffer 58 <3> ; Bit 6 = 1 if buffer dirty 59 <3> ; Bit 5 = Reserved 60 <3> ; Bit 4 = Search bit (bit 7 = 1) 61 <3> ; Bit 3 = 1 if buffer is DATA 62 <3> ; Bit 2 = 1 if buffer is DIR 63 <3> ; Bit 1 = 1 if buffer is FAT 64 <3> ; Bit 0 = Reserved 65 <3> buf_sector DD ? ; Sector number of buffer (bit 7 = 0) 66 <3> ; The next two items are often refed as a word (bit 7 = 0) 67 <3> buf_wrtcnt DB ? ; For FAT sectors, # times sector written out 68 <3> buf_wrtcntinc DW ? ; " " " , # sectors between each write 69 <3> buf_DPB DD ? ; Pointer to drive parameters 70 <3> buf_fill DW ? ; How full buffer is (bit 7 = 1) 71 <3> buf_reserved DB ? ; make DWORD boundary for 386 72 <3> BUFFINFO ENDS 73 <3> 74 <3> labelsize buf_offset, dword, buf_sector 75 <3> ;For bit 7 = 1, this is the byte 76 <3> ;offset of the start of the buffer in 77 <3> ;the file pointed to by buf_ID. Thus 78 <3> ;the buffer starts at location 79 <3> ;buf_offset in the file and contains 80 <3> ;buf_fill bytes. 81 <3> 82 <3> BUFINSIZ EQU BUFFINFO_struc_size 83 <3> ; Size of structure in bytes 84 <3> 85 <3> buf_Free EQU 0FFh ; buf_id of free buffer 86 <3> 87 <3> ;Flag byte masks 88 <3> buf_isnet EQU 10000000B 89 <3> buf_dirty EQU 01000000B 90 <3> 91 <3> buf_isDATA EQU 00001000B 92 <3> buf_isDIR EQU 00000100B 93 <3> buf_isFAT EQU 00000010B 94 <3> buf_type_0 EQU 11110001B ; AND sets type to "none" 95 <3> 96 <3> buf_NetID EQU BUFINSIZ 97 <3> 98 <3> ; 99 <3> ; Buffer Hash Entry Structure 100 <3> 101 <3> BUFFER_HASH_ENTRY STRUC ; DOS 4.00 102 <3> EMS_PAGE_NUM DW ? ; logical page number for EMS handle 103 <3> BUFFER_BUCKET DD ? ; pointer to buffers 104 <3> DIRTY_COUNT DB ? ; number of dirty buffers 105 <3> BUFFER_RESERVED DB ? ; reserved 106 <3> BUFFER_HASH_ENTRY ENDS 107 <3> 108 <3> MaxBuffinBucket EQU 15 ; Max number of buffers per bucket 109 <3> MaxBucketinPage EQU 2 ; Max number of buckets per 16kb page 110 <3> 111 <3> %endif 112 <3> 113 <3> ; ; 114 <3> ; C A V E A T P R O G R A M M E R ; 115 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 74 <2> 75 <2> BREAK 76 <2> ; Location of user registers relative user stack pointer 77 <2> 78 <2> user_environ STRUC 0 00000F20 ???? user_AX DW ? 0 00000F22 ???? user_BX DW ? 0 00000F24 ???? user_CX DW ? 0 00000F26 ???? user_DX DW ? 0 00000F28 ???? user_SI DW ? 0 00000F2A ???? user_DI DW ? 0 00000F2C ???? user_BP DW ? 0 00000F2E ???? user_DS DW ? 0 00000F30 ???? user_ES DW ? 0 00000F32 ???? user_IP DW ? 0 00000F34 ???? user_CS DW ? 0 00000F36 ???? user_F DW ? 91 <2> user_environ ENDS 92 <2> 93 <2> %include "sysvar.mac" 1 <3> ; SCCSID = @(#)sysvar.asm 1.1 85/04/10 2 <3> %include "version.mac" 1 <4> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <4> TRUE EQU 0FFFFh 3 <4> TRUEBYTE EQU 0FFh 4 <4> FALSE EQU 0 5 <4> 6 <4> ; 7 <4> ; Use the following switches to control cmacros.inc 8 <4> ; 9 <4> ?PLM equ 0 10 <4> ?WIN equ 0 11 <4> 12 <4> memS EQU 1 ; Small model 13 <4> ; 14 <4> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <4> ; version of the operating system 16 <4> ; 17 <4> ; The below chart will indicate how to set the switches to build the various 18 <4> ; versions 19 <4> ; 20 <4> ; IBMVER IBMCOPYRIGHT 21 <4> ; -------------------------------------------------------- 22 <4> ; IBM Version | TRUE TRUE 23 <4> ; -------------------------------------------------------- 24 <4> ; MS Version | FALSE FALSE 25 <4> ; -------------------------------------------------------- 26 <4> ; Clone Version | TRUE FALSE 27 <4> ; 28 <4> IBMVER EQU TRUE 29 <4> IBMCOPYRIGHT EQU FALSE 30 <4> 31 <4> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <4> 33 <4> %ifndef MSVER 34 <4> MSVER EQU ~ IBMVER 35 <4> %endif 36 <4> IBM EQU IBMVER 37 <4> ; 38 <4> ; 39 <4> %IF IBMVER 40 <4> %IF IBMCOPYRIGHT 41 <4> %warning out: ... IBM version build switch on ... 42 <4> %ELSE 43 <4> %warning out: ... CLONE version build switch on ... 43 ****************** <4> warning: out: ... CLONE version build switch on ... [-w+user] 44 <4> %ENDIF 45 <4> %ELSE 46 <4> %IFN IBMCOPYRIGHT 47 <4> %warning out: ... MS version build switch on ... 48 <4> %ELSE 49 <4> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <4> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <4> %ENDIF 52 <4> %ENDIF 53 <4> ; 54 <4> ; 55 <4> ;*************************************************************************** 56 <4> ;* The following switches are for DBCS or SBCS support * 57 <4> ;* * 58 <4> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <4> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <4> ;* * 61 <4> ;*************************************************************************** 62 <4> ; 63 <4> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <4> 65 <4> ; 66 <4> ; Switch INTERNAT for DBCS support 67 <4> ; 68 <4> INTERNAT EQU FALSE 69 <4> ; 70 <4> %IF INTERNAT 71 <4> %ifndef KANJI 72 <4> KANJI EQU TRUE 73 <4> %endif 74 <4> IBMJAPAN EQU TRUE 75 <4> %ELSE 76 <4> %ifndef KANJI 77 <4> KANJI EQU FALSE 78 <4> %endif 79 <4> IBMJAPAN EQU FALSE 80 <4> %ENDIF 81 <4> 82 <4> %ifndef altvect ; avoid jerking off vector.inc 83 <4> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <4> %endif 85 <4> 86 <4> ; 87 <4> ; Country code switches 88 <4> ; The default contry code is assumed as USA. 89 <4> ; 90 <4> %IF INTERNAT 91 <4> KOREA EQU TRUE 92 <4> JAPAN EQU FALSE 93 <4> %ELSE 94 <4> KOREA EQU FALSE 95 <4> JAPAN EQU FALSE 96 <4> %ENDIF 97 <4> ; 98 <4> %IF INTERNAT 99 <4> %warning out: Internat(ECS) version build switch on 100 <4> %ENDIF 3 <3> 4 <3> SysInitVars STRUC 0 00000F20 ???????? SYSI_DPB DD ? ; DPB chain 0 00000F24 ???????? SYSI_SFT DD ? ; SFT chain 0 00000F28 ???????? SYSI_CLOCK DD ? ; CLOCK device 0 00000F2C ???????? SYSI_CON DD ? ; CON device 0 00000F30 ???? SYSI_MAXSEC DW ? ; maximum sector size 0 00000F32 ???????? SYSI_BUF DD ? ; points to Hashinitvar 0 00000F36 ???????? SYSI_CDS DD ? ; CDS list 0 00000F3A ???????? SYSI_FCB DD ? ; FCB chain 0 00000F3E ???? SYSI_Keep DW ? ; keep count 0 00000F40 ?? SYSI_NUMIO DB ? ; Number of block devices 0 00000F41 ?? SYSI_NCDS DB ? ; number of CDS's 0 00000F42 ???????? SYSI_DEV DD ? ; device list 0 00000F46 ???? SYSI_ATTR DW ? ; null device attribute word 0 00000F48 ???? SYSI_STRAT DW ? ; null device strategy entry point 0 00000F4A ???? SYSI_INTER DW ? ; null device interrupt entry point 0 00000F4C ???????????????? SYSI_NAME DB 8 DUP(?) ; null device name 0 00000F54 ?? SYSI_SPLICE DB ? ; TRUE -> splicees being done 0 00000F55 ???? SYSI_IBMDOS_SIZE DW ? ; DOS size in paragraphs 0 00000F57 ???????? SYSI_IFS_DOSCALL@ DD ? ; IFS DOS service rountine entry 0 00000F5B ???????? SYSI_IFS DD ? ; IFS header chain 0 00000F5F ???????? SYSI_BUFFERS DW ?,? ; BUFFERS= values (m,n) 0 00000F63 ?? SYSI_BOOT_DRIVE DB ? ; boot drive A=1 B=2,.. 0 00000F64 ?? SYSI_DWMOVE DB ? ; 1 if 386 machine 0 00000F65 ???? SYSI_EXT_MEM DW ? ; Extended memory size in KB. 29 <3> SysInitVars ENDS 30 <3> 31 <3> ;This is added for more information exchage between DOS, BIOS. 32 <3> ;DOS will give the pointer to SysInitTable in ES:DI. - J.K. 5/29/86 33 <3> SysInitVars_Ext struc 0 00000F20 ???????? SYSI_InitVars DD ? ; Points to the above structure. 0 00000F24 ???????? SYSI_Country_Tab DD ? ; DOS_Country_cdpg_info 36 <3> SysInitVars_Ext ends 37 <3> 38 <3> ;The SYSI_BUF of SysInitVars points to the follwong structure 39 <3> EMS_MAP_BUFF_SIZE EQU 12 ; EMS map buffer size 40 <3> 41 <3> Buffinfo STRUC 0 00000F20 ???????? Hash_ptr DD ? ; pointer to Hash table 0 00000F24 ???? Hash_count DW ? ; number of Hash entries 0 00000F26 ???????? Cache_ptr DD ? ; pointer to secondary cache 0 00000F2A ???? Cache_count DW ? ; number of secondary cache entries 46 <3> 47 <3> %IF BUFFERFLAG 48 <3> 0 00000F2C ?? EMS_SAFE_FLAG DB ? 0 00000F2D ???????? EMS_LAST_PAGE DW ?, ? 0 00000F31 ???????? EMS_FIRST_PAGE DW ?, ? 0 00000F35 ???? EMS_NPA640 DW ? 53 <3> 54 <3> %ENDIF 55 <3> 0 00000F37 ?? EMS_mode DB ? ; no EMS = -1 0 00000F38 ???? EMS_handle DW ? ; EMS handle for buffers 0 00000F3A ???? EMS_PageFrame_Number DW ? ; EMS page frame number 0 00000F3C ???? EMS_Seg_Cnt DW ? ; EMS segment count 0 00000F3E ???? EMS_Page_Frame DW ? ; EMS page frame segment address 0 00000F40 ???? EMS_reserved DW ? ; EMS segment count 62 <3> 63 <3> %IF BUFFERFLAG 0 00000F42 ?? EMS_Map_Buff DB ? ; map buffer 65 <3> %ELSE 66 <3> EMS_Map_Buff DB 12 dup(?) 67 <3> %ENDIF 68 <3> 69 <3> Buffinfo ENDS 70 <3> 71 <3> 72 <3> 73 <3> 74 <3> 75 <3> 76 <3> 77 <3> 94 <2> 95 <2> %include "vector.mac" 1 <3> ; SCCSID = @(#)vector.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ;Asmvar AltVect 5 <3> %ifndef AltVect 6 <3> %iassign AltVect 0 7 <3> %endif 8 <3> 9 <3> INTTAB EQU 20H 10 <3> inttab equ INTTAB ; NASM port equate 11 <3> INTBASE EQU 4 * inttab 12 <3> ENTRYPOINT EQU INTBASE+40H 13 <3> 14 <3> %IF ALTVECT 15 <3> ALTTAB EQU 0F0H 16 <3> ALTBASE EQU 4 * ALTTAB 17 <3> %ENDIF 18 <3> 19 <3> ; 20 <3> ; interrupt assignments 21 <3> ; 22 <3> %IFN ALTVECT 23 <3> int_abort EQU INTTAB ; abort process 24 <3> int_command EQU int_abort+1 ; call MSDOS 25 <3> int_terminate EQU int_abort+2 ; int to terminate address 26 <3> int_ctrl_c EQU int_abort+3 ; ^c trapper 27 <3> int_fatal_abort EQU int_abort+4 ; hard disk error 28 <3> int_disk_read EQU int_abort+5 ; logical sector disk read 29 <3> int_disk_write EQU int_abort+6 ; logical sector disk write 30 <3> int_keep_process EQU int_abort+7 ; terminate program and stay 31 <3> ; resident 32 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ; ; 35 <3> int_spooler EQU int_abort+8 ; spooler call 36 <3> int_fastcon EQU int_abort+9 ; fast CON interrupt 37 <3> int_IBM EQU int_abort+10; critical section maintenance 38 <3> ; ; 39 <3> ; C A V E A T P R O G R A M M E R ; 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <3> %ELSE 42 <3> int_abort EQU INTTAB ; abort process 43 <3> int_command EQU int_abort+1 ; call MSDOS 44 <3> int_terminate EQU ALTTAB ; int to terminate address 45 <3> int_ctrl_c EQU int_terminate+1 ; ^c trapper 46 <3> int_fatal_abort EQU int_terminate+2 ; hard disk error 47 <3> int_disk_read EQU int_abort+5 ; logical sector disk read 48 <3> int_disk_write EQU int_abort+6 ; logical sector disk write 49 <3> int_keep_process EQU int_abort+7 ; terminate program and stay resident 50 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 51 <3> ; C A V E A T P R O G R A M M E R ; 52 <3> ; ; 53 <3> int_spooler EQU int_terminate+3 ; spooler call 54 <3> int_fastcon EQU int_abort+9 ; fast CON interrupt 55 <3> ; ; 56 <3> ; C A V E A T P R O G R A M M E R ; 57 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <3> %ENDIF 59 <3> 60 <3> addr_int_abort EQU 4 * int_abort 61 <3> addr_int_command EQU 4 * int_command 62 <3> addr_int_terminate EQU 4 * int_terminate 63 <3> addr_int_ctrl_c EQU 4 * int_ctrl_c 64 <3> addr_int_fatal_abort EQU 4 * int_fatal_abort 65 <3> addr_int_disk_read EQU 4 * int_disk_read 66 <3> addr_int_disk_write EQU 4 * int_disk_write 67 <3> addr_int_keep_process EQU 4 * int_keep_process 68 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 69 <3> ; C A V E A T P R O G R A M M E R ; 70 <3> ; ; 71 <3> addr_int_spooler EQU 4 * int_spooler 72 <3> addr_int_fastcon EQU 4 * int_fastcon 73 <3> addr_int_IBM EQU 4 * int_IBM 74 <3> ; ; 75 <3> ; C A V E A T P R O G R A M M E R ; 76 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 96 <2> 97 <2> %include "mult.mac" 1 <3> ; SCCSID = @(#)mult.asm 1.2 85/04/12 2 <3> Break 3 <3> 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; Critical section definitions 8 <3> ; 9 <3> ; These below are subject to leave-all sections 10 <3> critDisk EQU 1 ; Disk I/O critical section 11 <3> critDevice EQU 2 ; Device I/O critical section 12 <3> critShare EQU 1 ; Sharer I/O critical section 13 <3> critMem EQU 1 ; memory maintenance critical section 14 <3> critNet EQU 5 ; network critical section 15 <3> critSFT EQU 1 ; sft table allocation 16 <3> critIFS EQU 6 ; ifsfunc critical section 17 <3> ; These below are not subject to leave-all sections 18 <3> critASSIGN EQU 8 ; Assign has munged a system call 19 <3> ; ; 20 <3> ; C A V E A T P R O G R A M M E R ; 21 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 22 <3> 23 <3> ; 24 <3> ; The current set of defined multiplex channels is (* means documented): 25 <3> ; 26 <3> ; Channel(h) Issuer Receiver Function 27 <3> ; 00 server PSPRINT print job control 28 <3> ; *01 print/apps PRINT Queueing of files 29 <3> ; 02 BIOS REDIR signal open/close of printers 30 <3> ; 31 <3> ; 05 command REDIR obtain text of net int 24 message 32 <3> ; *06 server/assign ASSIGN Install check 33 <3> ; 34 <3> ; 08 external driver IBMBIO interface to internal routines 35 <3> ; 36 <3> ; 10 sharer/server Sharer install check 37 <3> ; 11 DOS/server Redir install check/redirection funcs 38 <3> ; 12 sharer/redir DOS dos functions and structure maint 39 <3> ; 13 MSNET MSNET movement of NCBs 40 <3> ; 13 external driver IBMBIO Reset_Int_13, allows installation 41 <3> ; of alternative INT_13 drivers after 42 <3> ; boot_up 43 <3> ; 14 (IBM) DOS NLSFUNC down load NLS country info,DOS 3.3 44 <3> ; 14 (MS) APPS POPUP MSDOS 4 popup screen functions 45 <3> ; 15 APPS MSCDEX CD-ROM extensions interface 46 <3> ; 16 WIN386 WIN386 Windows communications 47 <3> ; 17 Clipboard WINDOWS Clipboard interface 48 <3> ; *18 Applications MS-Manger Toggle interface to manager 49 <3> ; 19 Shell 50 <3> ; 1A Ansi.sys 51 <3> ; 1B Fastopen,Vdisk IBMBIO EMS INT 67H stub handler 52 <3> ; 53 <3> ; AC Graphics 54 <3> ; AD NLS (toronto) 55 <3> ; AE 56 <3> ; AF Mode 57 <3> ; B0 GRAFTABL GRAFTABL 58 <3> ; 59 <3> 60 <3> 61 <3> ;MUX 00-3F reserverd for IBM 62 <3> ;MUX 80-BF reserverd for IBM 63 <3> ;MUX 40-7F reserved for Microsoft 64 <3> ;MUX C0-FF users 65 <3> 66 <3> 67 <3> 68 <3> MultSHARE EQU 10h ; sharer 69 <3> ; 1 MFT_enter 70 <3> ; 2 MFTClose 71 <3> ; 3 MFTclU 72 <3> ; 4 MFTCloseP 73 <3> ; 5 MFTCloN 74 <3> ; 6 set_block 75 <3> ; 7 clr_block 76 <3> ; 8 chk_block 77 <3> ; 9 MFT_get 78 <3> ; 10 ShSave 79 <3> ; 11 ShChk 80 <3> ; 12 ShCol 81 <3> ; 13 ShCloseFile 82 <3> 83 <3> MultNET EQU 11h ; Network support 84 <3> MultIFS EQU 11h ; Network support 85 <3> ; 1 IFS_RMDIR 86 <3> ; 2 IFS_SEQ_RMDIR 87 <3> ; 3 IFS_MKDIR 88 <3> ; 4 IFS_SEQ_MKDIR 89 <3> ; 5 IFS_CHDIR 90 <3> ; 6 IFS_CLOSE 91 <3> ; 7 IFS_COMMIT 92 <3> ; 8 IFS_READ 93 <3> ; 9 IFS_WRITE 94 <3> ; 10 IFS_LOCK 95 <3> ; 11 IFS_UNLOCK 96 <3> ; 12 IFS_DISK_INFO 97 <3> ; 13 IFS_SET_FILE_ATTRIBUTE 98 <3> ; 14 IFS_SEQ_SET_FILE_ATTRIBUTE 99 <3> ; 15 IFS_GET_FILE_INFO 100 <3> ; 16 IFS_SEQ_GET_FILE_INFO 101 <3> ; 17 IFS_RENAME 102 <3> ; 18 IFS_SEQ_RENAME 103 <3> ; 19 IFS_DELETE 104 <3> ; 20 IFS_SEQ_DELETE 105 <3> ; 21 IFS_OPEN 106 <3> ; 22 IFS_SEQ_OPEN 107 <3> ; 23 IFS_CREATE 108 <3> ; 24 IFS_SEQ_CREATE 109 <3> ; 25 IFS_SEQ_SEARCH_FIRST 110 <3> ; 26 IFS_SEQ_SEARCH_NEXT 111 <3> ; 27 IFS_SEARCH_FIRST 112 <3> ; 28 IFS_SEARCH_NEXT 113 <3> ; 29 IFS_ABORT 114 <3> ; 30 IFS_ASSOPER 115 <3> ; 31 Printer_SET_STRING 116 <3> ; 32 IFSFlushBuf 117 <3> ; 33 IFSBufWrite 118 <3> ; 34 IFSResetEnvironment 119 <3> ; 35 IFSSpoolCheck 120 <3> ; 36 IFSSpoolClose 121 <3> 122 <3> MultDOS EQU 12h ; DOS call back 123 <3> ; 1 DOS_CLOSE 124 <3> ; 2 RECSET 125 <3> ; 3 Get DOSGROUP 126 <3> ; 4 PATHCHRCMP 127 <3> ; 5 OUT 128 <3> ; 6 NET_I24_ENTRY 129 <3> ; 7 PLACEBUF 130 <3> ; 8 FREE_SFT 131 <3> ; 9 BUFWRITE 132 <3> ; 10 SHARE_VIOLATION 133 <3> ; 11 SHARE_ERROR 134 <3> ; 12 SET_SFT_MODE 135 <3> ; 13 DATE16 136 <3> ; 14 SETVISIT 137 <3> ; 15 SCANPLACE 138 <3> ; 16 SKIPVISIT 139 <3> ; 17 StrCpy 140 <3> ; 18 StrLen 141 <3> ; 19 Ucase 142 <3> ; 20 POINTCOMP 143 <3> ; 21 CHECKFLUSH 144 <3> ; 22 SFFromSFN 145 <3> ; 23 GetCDSFromDrv 146 <3> ; 24 Get_User_Stack 147 <3> ; 25 GetThisDrv 148 <3> ; 26 DriveFromText 149 <3> ; 27 SETYEAR 150 <3> ; 28 DSUM 151 <3> ; 29 DSLIDE 152 <3> ; 30 StrCmp 153 <3> ; 31 initcds 154 <3> ; 32 pjfnfromhandle 155 <3> ; 33 $NameTrans 156 <3> ; 34 CAL_LK 157 <3> ; 35 DEVNAME 158 <3> ; 36 Idle 159 <3> ; 37 DStrLen 160 <3> ; 38 NLS_OPEN DOS 3.3 161 <3> ; 39 $CLOSE DOS 3.3 162 <3> ; 40 NLS_LSEEK DOS 3.3 163 <3> ; 41 $READ DOS 3.3 164 <3> ; 42 FastInit DOS 4.0 165 <3> ; 43 NLS_IOCTL DOS 3.3 166 <3> ; 44 GetDevList DOS 3.3 167 <3> ; 45 NLS_GETEXT DOS 3.3 168 <3> ; 46 MSG_RETRIEVAL DOS 4.0 169 <3> ; 47 FAKE_VERSION DOS 4.0 170 <3> ; 171 <3> NLSFUNC EQU 14h ; NLSFUNC CALL , DOS 3.3 172 <3> ; 0 NLSInstall 173 <3> ; 1 ChgCodePage 174 <3> ; 2 GetExtInfo 175 <3> ; 3 SetCodePage 176 <3> ; 4 GetCntry 177 <3> ; 178 <3> ;FASTOPEN is not chained through INT 2F ; DOS 3.3 F.C. 179 <3> ; it calls Multdos 42 to set up an entry routine address 180 <3> ; 0 Install status (reserved) 181 <3> ; 1 Lookup 182 <3> ; 2 Insert 183 <3> ; 3 Delete 184 <3> ; 4 Purge (reserved) 98 <2> 99 <2> BREAK 100 <2> ; MSDOS partitions the disk into 4 sections: 101 <2> ; 102 <2> ; phys sector 0: +-------------------+ 103 <2> ; | | boot/reserved | 104 <2> ; | +-------------------+ 105 <2> ; | | File allocation | 106 <2> ; v | table(s) | 107 <2> ; | (multiple copies | 108 <2> ; | are kept) | 109 <2> ; +-------------------+ 110 <2> ; | Directory | 111 <2> ; +-------------------+ 112 <2> ; | File space | 113 <2> ; +-------------------+ 114 <2> ; | Unaddressable | 115 <2> ; | (to end of disk) | 116 <2> ; +-------------------+ 117 <2> ; 118 <2> ; All partition boundaries are sector boundaries. The size of the FAT is 119 <2> ; adjusted to maximize the file space addressable. 120 <2> 121 <2> %include "dirent.mac" 1 <3> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dirent.asm 1.1 85/04/10 3 <3> Break 4 <3> 5 <3> ; 6 <3> ; +---------------------------+ 7 <3> ; | (12 BYTE) filename/ext | 0 0 8 <3> ; +---------------------------+ 9 <3> ; | (BYTE) attributes | 11 B 10 <3> ; +---------------------------+ 11 <3> ; | (10 BYTE) reserved | 12 C 12 <3> ; +---------------------------+ 13 <3> ; | (WORD) time of last write | 22 16 14 <3> ; +---------------------------+ 15 <3> ; | (WORD) date of last write | 24 18 16 <3> ; +---------------------------+ 17 <3> ; | (WORD) First cluster | 26 1A 18 <3> ; +---------------------------+ 19 <3> ; | (DWORD) file size | 28 1C 20 <3> ; +---------------------------+ 21 <3> ; 22 <3> ; First byte of filename = E5 -> free directory entry 23 <3> ; = 00 -> end of allocated directory 24 <3> ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour 25 <3> ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980 26 <3> ; 27 <3> 28 <3> dir_entry STRUC 29 00000000 <3> dir_name DB 11 DUP (?) ; file name 0 00000F2B ?? dir_attr DB ? ; attribute bits 0 00000F2C ???? dir_codepg dw ? ; code page DOS 4.00 0 00000F2E ???? dir_extcluster dw ? ; extended attribute starting cluster 0 00000F30 ?? dir_attr2 db ? ; reserved 0 00000F31 ?????????? dir_pad DB 5 DUP (?) ; reserved for expansion 0 00000F36 ???? dir_time DW ? ; time of last write 0 00000F38 ???? dir_date DW ? ; date of last write 0 00000F3A ???? dir_first DW ? ; first allocation unit of file 0 00000F3C ???? dir_size_l DW ? ; low 16 bits of file size 0 00000F3E ???? dir_size_h DW ? ; high 16 bits of file size 40 <3> dir_entry ENDS 41 <3> 42 <3> attr_read_only EQU 1h 43 <3> attr_hidden EQU 2h 44 <3> attr_system EQU 4h 45 <3> attr_volume_id EQU 8h 46 <3> attr_directory EQU 10h 47 <3> attr_archive EQU 20h 48 <3> attr_device EQU 40h ; This is a VERY special bit. 49 <3> ; NO directory entry on a disk EVER 50 <3> ; has this bit set. It is set non-zero 51 <3> ; when a device is found by GETPATH 52 <3> 53 <3> attr_all EQU attr_hidden+attr_system+attr_directory 54 <3> ; OR of hard attributes for FINDENTRY 55 <3> 56 <3> attr_ignore EQU attr_read_only+attr_archive+attr_device 57 <3> ; ignore this(ese) attribute(s) during 58 <3> ; search first/next 59 <3> 60 <3> attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive 61 <3> ; changeable via CHMOD 122 <2> 123 <2> BREAK 124 <2> ; 125 <2> ; The File Allocation Table uses a 12-bit entry for each allocation unit on 126 <2> ; the disk. These entries are packed, two for every three bytes. The contents 127 <2> ; of entry number N is found by 1) multiplying N by 1.5; 2) adding the result 128 <2> ; to the base address of the Allocation Table; 3) fetching the 16-bit word 129 <2> ; at this address; 4) If N was odd (so that N*1.5 was not an integer), shift 130 <2> ; the word right four bits; 5) mask to 12 bits (AND with 0FFF hex). Entry 131 <2> ; number zero is used as an end-of-file trap in the OS and is passed to the 132 <2> ; BIOS to help determine disk format. Entry 1 is reserved for future use. 133 <2> ; The first available allocation unit is assigned entry number two, and even 134 <2> ; though it is the first, is called cluster 2. Entries greater than 0FF8H 135 <2> ; (12-bit fats) or 0FFF8H (16-bit fats) are end of file marks; entries of zero 136 <2> ; are unallocated. Otherwise, the contents of a FAT entry is the number of 137 <2> ; the next cluster in the file. 138 <2> ; 139 <2> ; Clusters with bad sectors are tagged with FF7H. Any non-zero number would 140 <2> ; do because these clusters show as allocated, but are not part of any 141 <2> ; allocation chain and thus will never be allocated to a file. A particular 142 <2> ; number is selected so that disk checking programs know what to do (ie. a 143 <2> ; cluster with entry FF7H which is not in a chain is not an error). 144 <2> 145 <2> %include "dpb.mac" 1 <3> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)dpb.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> dpb STRUC 0 00000F20 ?? dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...) 0 00000F21 ?? dpb_UNIT DB ? ; Driver unit number of DPB 0 00000F22 ???? dpb_sector_size DW ? ; Size of physical sector in bytes 0 00000F24 ?? dpb_cluster_mask DB ? ; Sectors/cluster - 1 0 00000F25 ?? dpb_cluster_shift DB ? ; Log2 of sectors/cluster 0 00000F26 ???? dpb_first_FAT DW ? ; Starting record of FATs 0 00000F28 ?? dpb_FAT_count DB ? ; Number of FATs for this drive 0 00000F29 ???? dpb_root_entries DW ? ; Number of directory entries 0 00000F2B ???? dpb_first_sector DW ? ; First sector of first cluster 0 00000F2D ???? dpb_max_cluster DW ? ; Number of clusters on drive + 1 0 00000F2F ???? dpb_FAT_size DW ? ;;Number of records occupied by FAT 0 00000F31 ???? dpb_dir_sector DW ? ; Starting record of directory 0 00000F33 ???????? dpb_driver_addr DD ? ; Pointer to driver 0 00000F37 ?? dpb_media DB ? ; Media byte 0 00000F38 ?? dpb_first_access DB ? ; This is initialized to -1 to force a media 23 <3> ; check the first time this DPB is used 0 00000F39 ???????? dpb_next_dpb DD ? ; Pointer to next Drive parameter block 0 00000F3D ???? dpb_next_free DW ? ; Cluster # of last allocated cluster 0 00000F3F ???? dpb_free_cnt DW ? ; Count of free clusters, -1 if unknown 27 <3> dpb ENDS 28 <3> 29 <3> DPBSIZ EQU dpb_struc_size ; Size of the structure in bytes 30 <3> 31 <3> DSKSIZ equ dpb_max_cluster ; Size of disk (temp used during init only) 32 <3> ; ; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 146 <2> 147 <2> %include "curdir.mac" 1 <3> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)curdir.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; CDS items are used bu the internal routines to store cluster numbers and ; 8 <3> ; network identifiers for each logical name. The ID field is used dually, ; 9 <3> ; both as net ID and for a cluster number for local devices. In the case ; 10 <3> ; of local devices, the cluster number will be -1 if there is a potential ; 11 <3> ; of the disk being changed or if the path must be recracked. The END ; 12 <3> ; field is the location of the end of the definition. No .. is allowed ; 13 <3> ; past this point ; 14 <3> 15 <3> DIRSTRLEN EQU 64+3 ; Max length in bytes of directory strings 16 <3> TEMPLEN EQU DIRSTRLEN*2 17 <3> 18 <3> curdir_list STRUC 19 00000000 <3> curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 0 00000F63 ???? curdir_flags DW ? ; various flags 0 00000F65 ???????? curdir_devptr DD ? ; local pointer to DPB or net device 0 00000F69 ???? curdir_ID DW ? ; cluster of current dir (net ID) 0 00000F6B ???? DW ? 0 00000F6D ???? curdir_user_word DW ? 0 00000F6F ???? curdir_end DW ? ; end of assignment 0 00000F71 ?? curdir_type DB ? ; IFS drive (2=ifs, 4=netuse) 0 00000F72 ???????? curdir_ifs_hdr DD ? ; Ptr to File System Header 0 00000F76 ???? curdir_fsda DB 2 DUP (?) ; File System Dependent Data Area 29 <3> curdir_list ENDS 30 <3> 31 <3> curdirLen EQU curdir_list_struc_size ; Needed for screwed up 32 <3> ; ASM87 which doesn't allow 33 <3> ; Size directive as a macro 34 <3> ; argument 35 <3> labelsize curdir_netID, dword, curdir_ID 36 <3> 37 <3> ;Flag word masks 38 <3> curdir_isnet EQU 1000000000000000B 39 <3> curdir_isifs EQU 1000000000000000B ; DOS 4.00 40 <3> curdir_inuse EQU 0100000000000000B 41 <3> curdir_splice EQU 0010000000000000B 42 <3> curdir_local EQU 0001000000000000B 43 <3> ; ; 44 <3> ; C A V E A T P R O G R A M M E R ; 45 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 148 <2> 149 <2> %include "cpmfcb.mac" 1 <3> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)cpmfcb.asm 1.1 85/04/10 3 <3> ;BREAK 4 <3> 5 <3> ; 6 <3> ; Field definition for FCBs 7 <3> ; The FCB has the following structure: 8 <3> ; 9 <3> ; +---------------------------+ 10 <3> ; | Drive indicator(byte) | 11 <3> ; +---------------------------+ 12 <3> ; | Filename (8 chars) | 13 <3> ; +---------------------------+ 14 <3> ; | Extension (3 chars) | 15 <3> ; +---------------------------+ 16 <3> ; | Current Extent(word) | 17 <3> ; +---------------------------+ 18 <3> ; | Record size (word) | 19 <3> ; +---------------------------+ 20 <3> ; | File Size (2 words) | 21 <3> ; +---------------------------+ 22 <3> ; | Date of write | 23 <3> ; +---------------------------+ 24 <3> ; | Time of write | 25 <3> ; +---------------------------+ 26 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 27 <3> ; C A V E A T P R O G R A M M E R ; 28 <3> ; ; 29 <3> ; +---------------------------+ 30 <3> ; | 8 bytes reserved | 31 <3> ; +---------------------------+ 32 <3> ; ; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 35 <3> ; | next record number | 36 <3> ; +---------------------------+ 37 <3> ; | random record number | 38 <3> ; +---------------------------+ 39 <3> ; 40 <3> 41 <3> sys_fcb STRUC 0 00000F20 ?? fcb_drive DB ? 0 00000F21 ???????????????? fcb_name DB 8 DUP (?) 0 00000F29 ?????? fcb_ext DB 3 DUP (?) 0 00000F2C ???? fcb_EXTENT DW ? 0 00000F2E ???? fcb_RECSIZ DW ? ; Size of record (user settable) 0 00000F30 ???? fcb_FILSIZ DW ? ; Size of file in bytes; used with the 48 <3> ; following word 0 00000F32 ???? fcb_DRVBP DW ? ; BP for SEARCH FIRST and SEARCH NEXT 0 00000F34 ???? fcb_FDATE DW ? ; Date of last writing 0 00000F36 ???? fcb_FTIME DW ? ; Time of last writing 52 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 53 <3> ; C A V E A T P R O G R A M M E R ; 54 <3> ; ; 0 00000F38 ???????????????? fcb_reserved DB 8 DUP (?) ; RESERVED 56 <3> ; ; 57 <3> ; C A V E A T P R O G R A M M E R ; 58 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000F40 ?? fcb_NR DB ? ; Next record 0 00000F41 ???????? fcb_RR DB 4 DUP (?) ; Random record 61 <3> sys_fcb ENDS 62 <3> 63 <3> FILDIRENT equ fcb_FILSIZ ; Used only by SEARCH FIRST and SEARCH 64 <3> ; NEXT 65 <3> 66 <3> labelsize fcb_sfn, byte, fcb_reserved 67 <3> 68 <3> ; Note that fcb_net_handle, fcb_nsl_drive, fcb_nsld_drive and fcb_l_drive 69 <3> ; all must point to the same byte. Otherwise, the FCBRegen will fail. 70 <3> ; NOTE about this byte (fcb_nsl_drive) 71 <3> ; The high two bits of this byte are used as follows to indicate the FCB type 72 <3> ; 00 means a local file or device with sharing loaded 73 <3> ; 10 means a remote (network) file 74 <3> ; 01 means a local file with no sharing loaded 75 <3> ; 11 means a local device with no sharing loaded 76 <3> 77 <3> ; 78 <3> ; Network FCB 79 <3> ; 80 <3> labelsize fcb_net_drive, byte, fcb_reserved+1 81 <3> labelsize fcb_net_handle, word, fcb_reserved+2 82 <3> labelsize fcb_netID, dword, fcb_reserved+4 83 <3> 84 <3> ; 85 <3> ; No sharing local file FCB 86 <3> ; 87 <3> labelsize fcb_nsl_drive, byte, fcb_reserved+1 88 <3> labelsize fcb_nsl_bits, byte, fcb_reserved+2 89 <3> labelsize fcb_nsl_firclus, word, fcb_reserved+3 90 <3> labelsize fcb_nsl_dirsec, word, fcb_reserved+5 91 <3> labelsize fcb_nsl_dirpos, byte, fcb_reserved+7 92 <3> 93 <3> ; 94 <3> ; No sharing local device FCB 95 <3> ; 96 <3> labelsize fcb_nsld_drive, byte, fcb_reserved+1 97 <3> labelsize fcb_nsld_drvptr, dword, fcb_reserved+2 98 <3> 99 <3> ; 100 <3> ; Sharing local FCB 101 <3> ; 102 <3> labelsize fcb_l_drive, byte, fcb_reserved+1 103 <3> labelsize fcb_l_firclus, word, fcb_reserved+2 104 <3> labelsize fcb_l_mfs, word, fcb_reserved+4 105 <3> labelsize fcb_l_attr, byte, fcb_reserved+6 106 <3> 107 <3> ; 108 <3> ; Bogusness: the four cases are: 109 <3> ; 110 <3> ; local file 00 111 <3> ; local device 40 112 <3> ; local sharing C0 113 <3> ; network 80 114 <3> ; 115 <3> ; Since sharing and network collide, we cannot use a test instruction for 116 <3> ; deciding whether a network or a share check in involved 117 <3> ; 118 <3> FCBDEVICE EQU 040h 119 <3> FCBNETWORK EQU 080h 120 <3> FCBSHARE EQU 0C0h 121 <3> 122 <3> ; FCBSPECIAL must be able to mask off both net and share 123 <3> FCBSPECIAL EQU 080h 124 <3> FCBMASK EQU 0C0h 150 <2> 151 <2> %include "find.mac" 1 <3> ; SCCSID = @(#)find.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)find.asm 1.1 85/04/10 3 <3> Break 4 <3> 5 <3> find_buf STRUC 6 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 7 <3> ; C A V E A T P R O G R A M M E R ; 8 <3> ; ; 0 00000F20 ?? find_buf_drive DB ? ; drive of search 10 00000001 <3> find_buf_name DB 11 DUP (?) ; formatted name 0 00000F2C ?? find_buf_sattr DB ? ; attribute of search 0 00000F2D ???? find_buf_LastEnt DW ? ; LastEnt 0 00000F2F ???? find_buf_DirStart DW ? ; DirStart 0 00000F31 ???????? find_buf_NetID DB 4 DUP (?) ; Reserved for NET 15 <3> ; ; 16 <3> ; C A V E A T P R O G R A M M E R ; 17 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 18 <3> 0 00000F35 ?? find_buf_attr DB ? ; attribute found 0 00000F36 ???? find_buf_time DW ? ; time 0 00000F38 ???? find_buf_date DW ? ; date 0 00000F3A ???? find_buf_size_l DW ? ; low(size) 0 00000F3C ???? find_buf_size_h DW ? ; high(size) 24 0000001E <3> find_buf_pname DB 13 DUP (?) ; packed name 25 <3> find_buf ENDS 152 <2> 153 <2> %include "pdb.mac" 1 <3> ; SCCSID = @(#)pdb.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ; 5 <3> ; Process data block (otherwise known as program header) 6 <3> ; 7 <3> 8 <3> FilPerProc EQU 20 9 <3> 10 <3> Process_data_block STRUC 0 00000F20 ???? PDB_Exit_Call DW ? ; INT int_abort system terminate 0 00000F22 ???? PDB_block_len DW ? ; size of execution block 0 00000F24 ?? DB ? 0 00000F25 ?????????? PDB_CPM_Call DB 5 DUP (?) ; ancient call to system 0 00000F2A ???????? PDB_Exit DD ? ; pointer to exit routine 0 00000F2E ???????? PDB_Ctrl_C DD ? ; pointer to ^C routine 0 00000F32 ???????? PDB_Fatal_abort DD ? ; pointer to fatal error 18 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 19 <3> ; C A V E A T P R O G R A M M E R ; 20 <3> ; ; 0 00000F36 ???? PDB_Parent_PID DW ? ; PID of parent (terminate PID) 22 00000018 <3> PDB_JFN_Table DB FilPerProc DUP (?) 23 <3> ; indices into system table 24 <3> ; ; 25 <3> ; C A V E A T P R O G R A M M E R ; 26 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000F4C ???? PDB_environ DW ? ; seg addr of environment 28 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 29 <3> ; C A V E A T P R O G R A M M E R ; 30 <3> ; ; 0 00000F4E ???????? PDB_User_stack DD ? ; stack of self during system calls 0 00000F52 ???? PDB_JFN_Length DW ? ; number of handles allowed 0 00000F54 ???????? PDB_JFN_Pointer DD ? ; pointer to JFN table 0 00000F58 ???????? PDB_Next_PDB DD ? ; pointer to nested PDB's 35 0000003C <3> PDB_PAD1 DB 14h DUP (?) 36 <3> ; ; 37 <3> ; C A V E A T P R O G R A M M E R ; 38 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 0 00000F70 ?????????? PDB_Call_system DB 5 DUP (?) ; portable method of system call 40 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 41 <3> ; C A V E A T P R O G R A M M E R ; 42 <3> ; ; 0 00000F75 ?????????????? PDB_PAD2 DB 7h DUP (?) 44 <3> ; ; 45 <3> ; C A V E A T P R O G R A M M E R ; 46 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 47 <3> Process_data_block ENDS 48 <3> 49 <3> labelsize PDB_InterCon, byte, PDB_PAD1 ; 2/12/KK 50 <3> labelsize PDB_Append, byte, PDB_PAD1+1 ; 2/12/KK 154 <2> 155 <2> %include "exe.mac" 1 <3> ; SCCSID = @(#)exe.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)exe.asm 1.1 85/04/10 3 <3> BREAK 4 <3> ; 5 <3> ; EXEC arg block - load/go program 6 <3> ; 7 <3> 8 <3> ; 9 <3> ; The following get used as arguments to the EXEC system call. They indicate 10 <3> ; whether or not the program is executed or whether or not a program header 11 <3> ; gets created. 12 <3> ; 13 <3> exec_func_no_execute EQU 1 ; no execute bit 14 <3> exec_func_overlay EQU 2 ; overlay bit 15 <3> 16 <3> Exec0 STRUC 0 00000F20 ???? Exec0_environ DW ? ; seg addr of environment 0 00000F22 ???????? Exec0_com_line DD ? ; pointer to asciz command line 0 00000F26 ???????? Exec0_5C_FCB DD ? ; default fcb at 5C 0 00000F2A ???????? Exec0_6C_FCB DD ? ; default fcb at 6C 21 <3> Exec0 ENDS 22 <3> 23 <3> Exec1 STRUC 0 00000F20 ???? Exec1_environ DW ? ; seg addr of environment 0 00000F22 ???????? Exec1_com_line DD ? ; pointer to asciz command line 0 00000F26 ???????? Exec1_5C_FCB DD ? ; default fcb at 5C 0 00000F2A ???????? Exec1_6C_FCB DD ? ; default fcb at 6C 0 00000F2E ???? Exec1_SP DW ? ; stack pointer of program 0 00000F30 ???? Exec1_SS DW ? ; stack seg register of program 0 00000F32 ???? Exec1_IP DW ? ; entry point IP 0 00000F34 ???? Exec1_CS DW ? ; entry point CS 32 <3> Exec1 ENDS 33 <3> 34 <3> Exec3 STRUC 0 00000F20 ???? Exec3_load_addr DW ? ; seg address of load point 0 00000F22 ???? Exec3_reloc_fac DW ? ; relocation factor 37 <3> Exec3 ENDS 38 <3> 39 <3> ; 40 <3> ; Exit codes in upper byte 41 <3> ; 42 <3> Exit_terminate EQU 0 43 <3> Exit_abort EQU 0 44 <3> Exit_Ctrl_C EQU 1 45 <3> Exit_Hard_Error EQU 2 46 <3> Exit_Keep_process EQU 3 47 <3> 48 <3> ; 49 <3> ; EXE file header 50 <3> ; 51 <3> 52 <3> EXE_file STRUC 0 00000F20 ???? exe_signature DW ? ; must contain 4D5A (yay zibo!) 0 00000F22 ???? exe_len_mod_512 DW ? ; low 9 bits of length 0 00000F24 ???? exe_pages DW ? ; number of 512b pages in file 0 00000F26 ???? exe_rle_count DW ? ; count of reloc entries 0 00000F28 ???? exe_par_dir DW ? ; number of paragraphs before image 0 00000F2A ???? exe_min_BSS DW ? ; minimum number of para of BSS 0 00000F2C ???? exe_max_BSS DW ? ; max number of para of BSS 0 00000F2E ???? exe_SS DW ? ; stack of image 0 00000F30 ???? exe_SP DW ? ; SP of image 0 00000F32 ???? exe_chksum DW ? ; checksum of file (ignored) 0 00000F34 ???? exe_IP DW ? ; IP of entry 0 00000F36 ???? exe_CS DW ? ; CS of entry 0 00000F38 ???? exe_rle_table DW ? ; byte offset of reloc table 0 00000F3A ???? exe_iov DW ? ; overlay number (0 for root) 0 00000F3C ???????? exe_sym_tab DD ? ; offset of symbol table in file 68 <3> EXE_file ENDS 69 <3> 70 <3> exe_valid_signature EQU 5A4Dh 71 <3> exe_valid_old_signature EQU 4D5Ah 72 <3> 73 <3> symbol_entry STRUC 0 00000F20 ???????? sym_value DD ? 0 00000F24 ???? sym_type DW ? 0 00000F26 ?? sym_len DB ? 77 00000007 <3> sym_name DB 255 dup (?) 78 <3> symbol_entry ENDS 156 <2> 157 <2> %include "sf.mac" 1 <3> ; SCCSID = @(#)sf.asm 1.1 85/04/10 2 <3> BREAK 3 <3> ; 4 <3> ; AN000 version 4.00 Jan. 1988 5 <3> ; AN003 PTM 3680 -- make NAME offset the same as before (<=3.30) 6 <3> ; AN009 PTM 3839 reorder SFT for MS WINDOWS 7 <3> 8 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 9 <3> ; C A V E A T P R O G R A M M E R ; 10 <3> ; ; 11 <3> ; 12 <3> ; system file table 13 <3> ; 14 <3> 15 <3> SF STRUC 0 00000F20 ???????? SFLink DD ? 0 00000F24 ???? SFCount DW ? ; number of entries 0 00000F26 ???? SFTable DW ? ; beginning of array of the following 19 <3> SF ENDS 20 <3> 21 <3> ; 22 <3> ; system file table entry 23 <3> ; 24 <3> 25 <3> sf_entry STRUC 0 00000F20 ???? sf_ref_count DW ? ; number of processes sharing entry 27 <3> ; if FCB then ref count 0 00000F22 ???? sf_mode DW ? ; mode of access or high bit on if FCB 0 00000F24 ?? sf_attr DB ? ; attribute of file 0 00000F25 ???? sf_flags DW ? ;Bits 8-15 31 <3> ; Bit 15 = 1 if remote file 32 <3> ; = 0 if local file or device 33 <3> ; Bit 14 = 1 if date/time is not to be 34 <3> ; set from clock at CLOSE. Set by 35 <3> ; FILETIMES and FCB_CLOSE. Reset by 36 <3> ; other reseters of the dirty bit 37 <3> ; (WRITE) 38 <3> ; Bit 13 = Pipe bit (reserved) 39 <3> ; 40 <3> ; Bits 0-7 (old FCB_devid bits) 41 <3> ; If remote file or local file, bit 42 <3> ; 6=0 if dirty Device ID number, bits 43 <3> ; 0-5 if local file. 44 <3> ; bit 7=0 for local file, bit 7 45 <3> ; =1 for local I/O device 46 <3> ; If local I/O device, bit 6=0 if EOF (input) 47 <3> ; Bit 5=1 if Raw mode 48 <3> ; Bit 0=1 if console input device 49 <3> ; Bit 1=1 if console output device 50 <3> ; Bit 2=1 if null device 51 <3> ; Bit 3=1 if clock device 0 00000F27 ???????? sf_devptr DD ? ; Points to DPB if local file, points 53 <3> ; to device header if local device, 54 <3> ; points to net device header if 55 <3> ; remote 0 00000F2B ???? sf_firclus DW ? ; First cluster of file (bit 15 = 0) 0 00000F2D ???? sf_time DW ? ; Time associated with file 0 00000F2F ???? sf_date DW ? ; Date associated with file 0 00000F31 ???????? sf_size DD ? ; Size associated with file 0 00000F35 ???????? sf_position DD ? ; Read/Write pointer or LRU count for FCBs 61 <3> ; 62 <3> ; Starting here, the next 7 bytes may be used by the file system to store an 63 <3> ; ID 64 <3> ; 0 00000F39 ???? sf_cluspos DW ? ; Position of last cluster accessed 0 00000F3B ???????? sf_dirsec DD ? ; Sector number of directory sector for 67 <3> ; for this file 0 00000F3F ?? sf_dirpos DB ? ; Offset of this entry in the above 69 <3> ; 70 <3> ; End of 7 bytes of file-system specific info. 71 <3> ; 72 00000020 <3> sf_name DB 11 DUP (?) ; 11 character name that is in the 73 <3> ; directory entry. This is used by 74 <3> ; close to detect file deleted and 75 <3> ; disk changed errors. 76 <3> 77 <3> ; SHARING INFO 0 00000F4B ???????? sf_chain DD ? ; link to next SF 0 00000F4F ???? sf_UID DW ? 0 00000F51 ???? sf_PID DW ? 0 00000F53 ???? sf_MFT DW ? 0 00000F55 ???? sf_lstclus DW ? ;AN009; Last cluster accessed 0 00000F57 ???????? sf_IFS_HDR DD ? 84 <3> sf_entry ENDS 85 <3> 86 <3> labelsize sf_fsda, byte, sf_cluspos ;DOS 4.00 87 <3> labelsize sf_serial_ID, word, sf_firclus ;DOS 4.00 88 <3> labelsize sf_netid, byte, sf_cluspos 89 <3> labelsize sf_OpenAge, word, sf_position+2 90 <3> labelsize sf_LRU, word, sf_position 91 <3> 92 <3> sf_default_number EQU 5h 93 <3> 94 <3> ; 95 <3> ; Note that we need to mark an SFT as being busy for OPEN/CREATE. This is 96 <3> ; because an INT 24 may prevent us from 'freeing' it. We mark this as such 97 <3> ; by placing a -1 in the ref_count field. 98 <3> ; 99 <3> 100 <3> sf_busy EQU -1 101 <3> 102 <3> 103 <3> ; mode mask for FCB detection 104 <3> sf_isfcb EQU 1000000000000000B 105 <3> 106 <3> ; Flag word masks 107 <3> sf_isnet EQU 1000000000000000B 108 <3> sf_close_nodate EQU 0100000000000000B 109 <3> sf_pipe EQU 0010000000000000B 110 <3> sf_no_inherit EQU 0001000000000000B 111 <3> sf_net_spool EQU 0000100000000000B 112 <3> Handle_Fail_I24 EQU 0000000100000000B ;BIT 8 - DISK FULL I24 ERROR 113 <3> 114 <3> ; Local file/device flag masks 115 <3> devid_file_clean EQU 40h ; true if file and not written 116 <3> devid_file_mask_drive EQU 3Fh ; mask for drive number 117 <3> 118 <3> devid_device EQU 80h ; true if a device 119 <3> devid_device_EOF EQU 40h ; true if end of file reached 120 <3> devid_device_raw EQU 20h ; true if in raw mode 121 <3> devid_device_special EQU 10h ; true if special device 122 <3> devid_device_clock EQU 08h ; true if clock device 123 <3> devid_device_null EQU 04h ; true if null device 124 <3> devid_device_con_out EQU 02h ; true if console output 125 <3> devid_device_con_in EQU 01h ; true if consle input 126 <3> ; ; 127 <3> ; C A V E A T P R O G R A M M E R ; 128 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 129 <3> 130 <3> ; 131 <3> ; structure of devid field as returned by IOCTL is: 132 <3> ; 133 <3> ; BIT 7 6 5 4 3 2 1 0 134 <3> ; |---|---|---|---|---|---|---|---| 135 <3> ; | I | E | R | S | I | I | I | I | 136 <3> ; | S | O | A | P | S | S | S | S | 137 <3> ; | D | F | W | E | C | N | C | C | 138 <3> ; | E | | | C | L | U | O | I | 139 <3> ; | V | | | L | K | L | T | N | 140 <3> ; |---|---|---|---|---|---|---|---| 141 <3> ; ISDEV = 1 if this channel is a device 142 <3> ; = 0 if this channel is a disk file 143 <3> ; 144 <3> ; If ISDEV = 1 145 <3> ; 146 <3> ; EOF = 0 if End Of File on input 147 <3> ; RAW = 1 if this device is in Raw mode 148 <3> ; = 0 if this device is cooked 149 <3> ; ISCLK = 1 if this device is the clock device 150 <3> ; ISNUL = 1 if this device is the null device 151 <3> ; ISCOT = 1 if this device is the console output 152 <3> ; ISCIN = 1 if this device is the console input 153 <3> ; 154 <3> ; If ISDEV = 0 155 <3> ; EOF = 0 if channel has been written 156 <3> ; Bits 0-5 are the block device number for 157 <3> ; the channel (0 = A, 1 = B, ...) 158 <3> ; 159 <3> devid_ISDEV EQU 80h 160 <3> devid_EOF EQU 40h 161 <3> devid_RAW EQU 20h 162 <3> devid_SPECIAL EQU 10H 163 <3> devid_ISCLK EQU 08h 164 <3> devid_ISNUL EQU 04h 165 <3> devid_ISCOT EQU 02h 166 <3> devid_ISCIN EQU 01h 167 <3> 168 <3> devid_block_dev EQU 1Fh ; mask for block device number 158 <2> 159 <2> %include "arena.mac" 1 <3> ; SCCSID = @(#)arena.asm 1.1 85/04/09 2 <3> ;BREAK 3 <3> 4 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 5 <3> ; C A V E A T P R O G R A M M E R ; 6 <3> ; ; 7 <3> ; 8 <3> ; arena item 9 <3> ; 10 <3> arena STRUC 0 00000F20 ?? arena_signature DB ? ; 4D for valid item, 5A for last item 0 00000F21 ???? arena_owner DW ? ; owner of arena item 0 00000F23 ???? arena_size DW ? ; size in paragraphs of item 0 00000F25 ?????? arena_reserved DB 3 DUP(?) ; reserved 0 00000F28 ???????????????? arena_name DB 8 DUP(?) ; owner file name 16 <3> arena ENDS 17 <3> 18 <3> ; 19 <3> ; CAUTION: The routines in ALLOC.ASM rely on the fact that arena_signature 20 <3> ; and arena_owner_system are all equal to zero and are contained in DI. Change 21 <3> ; them and change ALLOC.ASM. 22 <3> 23 <3> arena_owner_system EQU 0 ; free block indication 24 <3> 25 <3> arena_signature_normal EQU 4Dh ; valid signature, not end of arena 26 <3> arena_signature_end EQU 5Ah ; valid signature, last block in arena 27 <3> ; ; 28 <3> ; C A V E A T P R O G R A M M E R ; 29 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 30 <3> 160 <2> 161 <2> %include "intnat.mac" 1 <3> ; SCCSID = @(#)intnat.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> ; 5 <3> ; Current structure of the data returned by the international call 6 <3> ; 7 <3> internat_block STRUC 0 00000F20 ???? Date_tim_format DW ? ; 0-USA, 1-EUR, 2-JAP 0 00000F22 ?? Currency_sym DB ? ; Currency Symbol 5 bytes 0 00000F23 ?? DB ? 0 00000F24 ?? DB ? 0 00000F25 ?? DB ? 0 00000F26 ?? DB ? 0 00000F27 ?? Thous_sep DB ? ; Thousands separator 2 bytes 0 00000F28 ?? DB ? 0 00000F29 ?? Decimal_sep DB ? ; Decimal separator 2 bytes 0 00000F2A ?? DB ? 0 00000F2B ?? Date_sep DB ? ; Date separator 2 bytes 0 00000F2C ?? DB ? 0 00000F2D ?? Time_sep DB ? ; Decimal separator 2 bytes 0 00000F2E ?? DB ? 0 00000F2F ?? Bit_field DB ? ; Bit values 23 <3> ; Bit 0 = 0 if currency symbol first 24 <3> ; = 1 if currency symbol last 25 <3> ; Bit 1 = 0 if No space after currency symbol 26 <3> ; = 1 if space after currency symbol 0 00000F30 ?? Currency_cents DB ? ; Number of places after currency dec point 0 00000F31 ?? Time_24 DB ? ; 1 if 24 hour time, 0 if 12 hour time 0 00000F32 ???? Map_call DW ? ; Address of case mapping call (DWORD) 0 00000F34 ???? DW ? ; THIS IS TWO WORDS SO IT CAN BE INITIALIZED 31 <3> ; in pieces. 0 00000F36 ?? Data_sep DB ? ; Data list separator character 0 00000F37 ?? DB ? 34 <3> internat_block ENDS 35 <3> 36 <3> ; 37 <3> ; Max size of the block returned by the INTERNATIONAL call 38 <3> ; 39 <3> internat_block_max EQU 32 162 <2> 163 <2> %include "mi.mac" 1 <3> ; SCCSID = @(#)mi.asm 1.1 85/04/10 2 <3> BREAK 3 <3> 4 <3> mi_INT EQU 0CDh 5 <3> mi_Long_JMP EQU 0EAh 6 <3> mi_Long_CALL EQU 09Ah 7 <3> mi_Long_RET EQU 0CBh 8 <3> mi_Near_RET EQU 0C3h 9 <3> 10 <3> ; xxxxoditszxaxpxc 11 <3> f_Overflow EQU 0000100000000000B 12 <3> f_Direction EQU 0000010000000000B 13 <3> f_Interrupt EQU 0000001000000000B 14 <3> f_Trace EQU 0000000100000000B 15 <3> f_Sign EQU 0000000010000000B 16 <3> f_Zero EQU 0000000001000000B 17 <3> f_Aux EQU 0000000000010000B 18 <3> f_Parity EQU 0000000000000100B 19 <3> f_Carry EQU 0000000000000001B 164 <2> 165 <2> fChk equ 1 166 <2> fDelim equ 2 167 <2> fSpChk equ 4 168 <2> fFCB equ 8 169 <2> 170 <2> %include "filemode.mac" 1 <3> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)filemode.asm 1.1 85/04/10 3 <3> BREAK 4 <3> 5 <3> stdin EQU 0 6 <3> stdout EQU 1 7 <3> stderr EQU 2 8 <3> stdaux EQU 3 9 <3> stdprn EQU 4 10 <3> 11 <3> BREAK 12 <3> 13 <3> access_mask EQU 0FH 14 <3> open_for_read EQU 00h 15 <3> open_for_write EQU 01h 16 <3> open_for_both EQU 02h 17 <3> 18 <3> sharing_mask EQU 0F0H 19 <3> sharing_compat EQU 000H 20 <3> sharing_deny_both EQU 010H 21 <3> sharing_deny_write EQU 020H 22 <3> sharing_deny_read EQU 030H 23 <3> sharing_deny_none EQU 040H 24 <3> sharing_net_FCB EQU 070h 25 <3> sharing_no_inherit EQU 080H 26 <3> 27 <3> BREAK 28 <3> 29 <3> no_code_page_check EQU 0100H 30 <3> int_24_error EQU 2000H 31 <3> auto_commit_write EQU 4000H 32 <3> ext_open_on EQU 01H 33 <3> ext_file_not_exists EQU 04H 34 <3> ext_open_I24_off EQU 02H 35 <3> io_mode_id EQU 00000010B 36 <3> reserved_bits_mask EQU 0FE00H 37 <3> exists_mask EQU 0FH 38 <3> not_exists_mask EQU 0F0H 39 <3> action_opened EQU 01H 40 <3> action_created_opened EQU 02H 41 <3> action_replaced_opened EQU 03H 42 <3> 43 <3> ext_exists_open EQU 01H 44 <3> ext_exists_fail EQU 0H 45 <3> ext_nexists_create EQU 10H 46 <3> 47 <3> 48 <3> 49 <3> ext_open_parm struc 0 00000F20 ???????? ext_set_list dd ? 0 00000F24 ???? ext_num_of_parm dw ? 52 <3> ext_open_parm ends 53 <3> 54 <3> 55 <3> 171 <2> 172 <2> %include "error.mac" 1 <3> ; SCCSID = @(#)error.asm 1.1 85/04/10 2 <3> ; SCCSID = @(#)error.asm 1.1 85/04/10 3 <3> BREAK 4 <3> 5 <3> ; 6 <3> ; XENIX calls all return error codes through AX. If an error occurred then 7 <3> ; the carry bit will be set and the error code is in AX. If no error occurred 8 <3> ; then the carry bit is reset and AX contains returned info. 9 <3> ; 10 <3> ; Since the set of error codes is being extended as we extend the operating 11 <3> ; system, we have provided a means for applications to ask the system for a 12 <3> ; recommended course of action when they receive an error. 13 <3> ; 14 <3> ; The GetExtendedError system call returns a universal error, an error 15 <3> ; location and a recommended course of action. The universal error code is 16 <3> ; a symptom of the error REGARDLESS of the context in which GetExtendedError 17 <3> ; is issued. 18 <3> ; 19 <3> 20 <3> ; 21 <3> ; These are the 2.0 error codes 22 <3> ; 23 <3> error_invalid_function EQU 1 24 <3> error_file_not_found EQU 2 25 <3> error_path_not_found EQU 3 26 <3> error_too_many_open_files EQU 4 27 <3> error_access_denied EQU 5 28 <3> error_invalid_handle EQU 6 29 <3> error_arena_trashed EQU 7 30 <3> error_not_enough_memory EQU 8 31 <3> error_invalid_block EQU 9 32 <3> error_bad_environment EQU 10 33 <3> error_bad_format EQU 11 34 <3> error_invalid_access EQU 12 35 <3> error_invalid_data EQU 13 36 <3> ;**** reserved EQU 14 ; ***** 37 <3> error_invalid_drive EQU 15 38 <3> error_current_directory EQU 16 39 <3> error_not_same_device EQU 17 40 <3> error_no_more_files EQU 18 41 <3> ; 42 <3> ; These are the universal int 24 mappings for the old INT 24 set of errors 43 <3> ; 44 <3> error_write_protect EQU 19 45 <3> error_bad_unit EQU 20 46 <3> error_not_ready EQU 21 47 <3> error_bad_command EQU 22 48 <3> error_CRC EQU 23 49 <3> error_bad_length EQU 24 50 <3> error_Seek EQU 25 51 <3> error_not_DOS_disk EQU 26 52 <3> error_sector_not_found EQU 27 53 <3> error_out_of_paper EQU 28 54 <3> error_write_fault EQU 29 55 <3> error_read_fault EQU 30 56 <3> error_gen_failure EQU 31 57 <3> ; 58 <3> ; These are the new 3.0 error codes reported through INT 24 59 <3> ; 60 <3> error_sharing_violation EQU 32 61 <3> error_lock_violation EQU 33 62 <3> error_wrong_disk EQU 34 63 <3> error_FCB_unavailable EQU 35 64 <3> error_sharing_buffer_exceeded EQU 36 65 <3> error_Code_Page_Mismatched EQU 37 ; DOS 4.00 ;AN000; 66 <3> error_handle_EOF EQU 38 ; DOS 4.00 ;AN000; 67 <3> error_handle_Disk_Full EQU 39 ; DOS 4.00 ;AN000; 68 <3> ; 69 <3> ; New OEM network-related errors are 50-79 70 <3> ; 71 <3> error_not_supported EQU 50 72 <3> ; 73 <3> ; End of INT 24 reportable errors 74 <3> ; 75 <3> error_file_exists EQU 80 76 <3> error_DUP_FCB EQU 81 ; ***** 77 <3> error_cannot_make EQU 82 78 <3> error_FAIL_I24 EQU 83 79 <3> ; 80 <3> ; New 3.0 network related error codes 81 <3> ; 82 <3> error_out_of_structures EQU 84 83 <3> error_Already_assigned EQU 85 84 <3> error_invalid_password EQU 86 85 <3> error_invalid_parameter EQU 87 86 <3> error_NET_write_fault EQU 88 87 <3> error_sys_comp_not_loaded EQU 90 ; DOS 4.00 ;AN000; 88 <3> 89 <3> BREAK 90 <3> 91 <3> error_I24_write_protect EQU 0 92 <3> error_I24_bad_unit EQU 1 93 <3> error_I24_not_ready EQU 2 94 <3> error_I24_bad_command EQU 3 95 <3> error_I24_CRC EQU 4 96 <3> error_I24_bad_length EQU 5 97 <3> error_I24_Seek EQU 6 98 <3> error_I24_not_DOS_disk EQU 7 99 <3> error_I24_sector_not_found EQU 8 100 <3> error_I24_out_of_paper EQU 9 101 <3> error_I24_write_fault EQU 0Ah 102 <3> error_I24_read_fault EQU 0Bh 103 <3> error_I24_gen_failure EQU 0Ch 104 <3> ; NOTE: Code 0DH is used by MT-DOS. 105 <3> error_I24_wrong_disk EQU 0Fh 106 <3> 107 <3> ; THE FOLLOWING ARE MASKS FOR THE AH REGISTER ON Int 24 108 <3> 109 <3> Allowed_FAIL EQU 00001000B 110 <3> Allowed_RETRY EQU 00010000B 111 <3> Allowed_IGNORE EQU 00100000B 112 <3> ;NOTE: ABORT is ALWAYS allowed 113 <3> 114 <3> I24_operation EQU 00000001B ;Z if READ,NZ if Write 115 <3> I24_area EQU 00000110B ; 00 if DOS 116 <3> ; 01 if FAT 117 <3> ; 10 if root DIR 118 <3> ; 11 if DATA 119 <3> I24_class EQU 10000000B ;Z if DISK, NZ if FAT or char 120 <3> 121 <3> BREAK 122 <3> 123 <3> ; Values for error CLASS 124 <3> 125 <3> errCLASS_OutRes EQU 1 ; Out of Resource 126 <3> errCLASS_TempSit EQU 2 ; Temporary Situation 127 <3> errCLASS_Auth EQU 3 ; Permission problem 128 <3> errCLASS_Intrn EQU 4 ; Internal System Error 129 <3> errCLASS_HrdFail EQU 5 ; Hardware Failure 130 <3> errCLASS_SysFail EQU 6 ; System Failure 131 <3> errCLASS_Apperr EQU 7 ; Application Error 132 <3> errCLASS_NotFnd EQU 8 ; Not Found 133 <3> errCLASS_BadFmt EQU 9 ; Bad Format 134 <3> errCLASS_Locked EQU 10 ; Locked 135 <3> errCLASS_Media EQU 11 ; Media Failure 136 <3> errCLASS_Already EQU 12 ; Collision with Existing Item 137 <3> errCLASS_Unk EQU 13 ; Unknown/other 138 <3> 139 <3> ; Values for error ACTION 140 <3> 141 <3> errACT_Retry EQU 1 ; Retry 142 <3> errACT_DlyRet EQU 2 ; Delay Retry, retry after pause 143 <3> errACT_User EQU 3 ; Ask user to regive info 144 <3> errACT_Abort EQU 4 ; abort with clean up 145 <3> errACT_Panic EQU 5 ; abort immediately 146 <3> errACT_Ignore EQU 6 ; ignore 147 <3> errACT_IntRet EQU 7 ; Retry after User Intervention 148 <3> 149 <3> ; Values for error LOCUS 150 <3> 151 <3> errLOC_Unk EQU 1 ; No appropriate value 152 <3> errLOC_Disk EQU 2 ; Random Access Mass Storage 153 <3> errLOC_Net EQU 3 ; Network 154 <3> errLOC_SerDev EQU 4 ; Serial Device 155 <3> errLOC_Mem EQU 5 ; Memory 173 <2> 174 <2> %include "syscall.mac" 1 <3> ; SCCSID = @(#)syscall.asm 1.1 85/04/10 2 <3> ;BREAK 3 <3> ;SUBTTL system call definitions 4 <3> ;PAGE 5 <3> 6 <3> Abort EQU 0 ; 0 0 7 <3> Std_Con_Input EQU 1 ; 1 1 8 <3> Std_Con_Output EQU 2 ; 2 2 9 <3> Std_Aux_Input EQU 3 ; 3 3 10 <3> Std_Aux_Output EQU 4 ; 4 4 11 <3> Std_Printer_Output EQU 5 ; 5 5 12 <3> Raw_Con_IO EQU 6 ; 6 6 13 <3> Raw_Con_Input EQU 7 ; 7 7 14 <3> Std_Con_Input_No_Echo EQU 8 ; 8 8 15 <3> Std_Con_String_Output EQU 9 ; 9 9 16 <3> Std_Con_String_Input EQU 10 ; 10 A 17 <3> Std_Con_Input_Status EQU 11 ; 11 B 18 <3> Std_Con_Input_Flush EQU 12 ; 12 C 19 <3> Disk_Reset EQU 13 ; 13 D 20 <3> Set_Default_Drive EQU 14 ; 14 E 21 <3> FCB_Open EQU 15 ; 15 F 22 <3> FCB_Close EQU 16 ; 16 10 23 <3> Dir_Search_First EQU 17 ; 17 11 24 <3> Dir_Search_Next EQU 18 ; 18 12 25 <3> FCB_Delete EQU 19 ; 19 13 26 <3> FCB_Seq_Read EQU 20 ; 20 14 27 <3> FCB_Seq_Write EQU 21 ; 21 15 28 <3> FCB_Create EQU 22 ; 22 16 29 <3> FCB_Rename EQU 23 ; 23 17 30 <3> Get_Default_Drive EQU 25 ; 25 19 31 <3> Set_DMA EQU 26 ; 26 1A 32 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 33 <3> ; C A V E A T P R O G R A M M E R ; 34 <3> ; ; 35 <3> Get_Default_DPB EQU 31 ; 31 1F 36 <3> ; ; 37 <3> ; C A V E A T P R O G R A M M E R ; 38 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 39 <3> FCB_Random_Read EQU 33 ; 33 21 40 <3> FCB_Random_Write EQU 34 ; 34 22 41 <3> Get_FCB_File_Length EQU 35 ; 35 23 42 <3> Get_FCB_Position EQU 36 ; 36 24 43 <3> Set_Interrupt_Vector EQU 37 ; 37 25 44 <3> Create_Process_Data_Block EQU 38 ; 38 26 45 <3> FCB_Random_Read_Block EQU 39 ; 39 27 46 <3> FCB_Random_Write_Block EQU 40 ; 40 28 47 <3> Parse_File_Descriptor EQU 41 ; 41 29 48 <3> Get_Date EQU 42 ; 42 2A 49 <3> Set_Date EQU 43 ; 43 2B 50 <3> Get_Time EQU 44 ; 44 2C 51 <3> Set_Time EQU 45 ; 45 2D 52 <3> Set_Verify_On_Write EQU 46 ; 46 2E 53 <3> ; Extended functionality group 54 <3> Get_DMA EQU 47 ; 47 2F 55 <3> Get_Version EQU 48 ; 48 30 56 <3> Keep_Process EQU 49 ; 49 31 57 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 58 <3> ; C A V E A T P R O G R A M M E R ; 59 <3> ; ; 60 <3> Get_DPB EQU 50 ; 50 32 61 <3> ; ; 62 <3> ; C A V E A T P R O G R A M M E R ; 63 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 64 <3> Set_CTRL_C_Trapping EQU 51 ; 51 33 65 <3> Get_InDOS_Flag EQU 52 ; 52 34 66 <3> Get_Interrupt_Vector EQU 53 ; 53 35 67 <3> Get_Drive_Freespace EQU 54 ; 54 36 68 <3> Char_Oper EQU 55 ; 55 37 69 <3> International EQU 56 ; 56 38 70 <3> ; Directory Group 71 <3> MKDir EQU 57 ; 57 39 72 <3> RMDir EQU 58 ; 58 3A 73 <3> CHDir EQU 59 ; 59 3B 74 <3> ; File Group 75 <3> Creat EQU 60 ; 60 3C 76 <3> Open EQU 61 ; 61 3D 77 <3> Close EQU 62 ; 62 3E 78 <3> Read EQU 63 ; 63 3F 79 <3> Write EQU 64 ; 64 40 80 <3> Unlink EQU 65 ; 65 41 81 <3> LSeek EQU 66 ; 66 42 82 <3> CHMod EQU 67 ; 67 43 83 <3> IOCtl EQU 68 ; 68 44 84 <3> XDup EQU 69 ; 69 45 85 <3> XDup2 EQU 70 ; 70 46 86 <3> Current_Dir EQU 71 ; 71 47 87 <3> ; Memory Group 88 <3> Alloc EQU 72 ; 72 48 89 <3> Dealloc EQU 73 ; 73 49 90 <3> Setblock EQU 74 ; 74 4A 91 <3> ; Process Group 92 <3> Exec EQU 75 ; 75 4B 93 <3> Exit EQU 76 ; 76 4C 94 <3> WaitProcess EQU 77 ; 77 4D 95 <3> Find_First EQU 78 ; 78 4E 96 <3> ; Special Group 97 <3> Find_Next EQU 79 ; 79 4F 98 <3> ; SPECIAL SYSTEM GROUP 99 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 100 <3> ; C A V E A T P R O G R A M M E R ; 101 <3> ; ; 102 <3> Set_Current_PDB EQU 80 ; 80 50 103 <3> Get_Current_PDB EQU 81 ; 81 51 104 <3> Get_In_Vars EQU 82 ; 82 52 105 <3> SetDPB EQU 83 ; 83 53 106 <3> ; ; 107 <3> ; C A V E A T P R O G R A M M E R ; 108 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 109 <3> Get_Verify_On_Write EQU 84 ; 84 54 110 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 111 <3> ; C A V E A T P R O G R A M M E R ; 112 <3> ; ; 113 <3> Dup_PDB EQU 85 ; 85 55 114 <3> ; ; 115 <3> ; C A V E A T P R O G R A M M E R ; 116 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 117 <3> Rename EQU 86 ; 86 56 118 <3> File_Times EQU 87 ; 87 57 119 <3> AllocOper EQU 88 ; 88 58 120 <3> ; Network extention system calls 121 <3> GetExtendedError EQU 89 ; 89 59 122 <3> CreateTempFile EQU 90 ; 90 5A 123 <3> CreateNewFile EQU 91 ; 91 5B 124 <3> LockOper EQU 92 ; 92 5C Lock and Unlock 125 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 126 <3> ; C A V E A T P R O G R A M M E R ; 127 <3> ; ; 128 <3> ServerCall EQU 93 ; 93 5D CommitAll, ServerDOSCall, 129 <3> ; CloseByName, CloseUser, 130 <3> ; CloseUserProcess, 131 <3> ; GetOpenFileList 132 <3> ; ; 133 <3> ; C A V E A T P R O G R A M M E R ; 134 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 135 <3> UserOper EQU 94 ; 94 5E Get and Set 136 <3> AssignOper EQU 95 ; 95 5F On, Off, Get, Set, Cancel 137 <3> xNameTrans EQU 96 ; 96 60 138 <3> PathParse EQU 97 ; 97 61 139 <3> GetCurrentPSP EQU 98 ; 98 62 140 <3> Hongeul EQU 99 ; 99 63 141 <3> ECS_CALL EQU 99 ; 99 63 ;; DBCS support 142 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 143 <3> ; C A V E A T P R O G R A M M E R ; 144 <3> ; ; 145 <3> Set_Printer_Flag EQU 100 ; 100 64 146 <3> ; ; 147 <3> ; C A V E A T P R O G R A M M E R ; 148 <3> ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 149 <3> GetExtCntry EQU 101 ; 101 65 150 <3> GetSetCdPg EQU 102 ; 102 66 151 <3> ExtHandle EQU 103 ; 103 67 152 <3> Commit EQU 104 ; 104 68 153 <3> GetSetMediaID EQU 105 ; 105 69 154 <3> IFS_IOCTL EQU 107 ; 107 6B 155 <3> ExtOpen EQU 108 ; 108 6C 156 <3> ; 157 <3> ; 158 <3> Set_Oem_Handler EQU 248 ; 248 F8 159 <3> OEM_C1 EQU 249 ; 249 F9 160 <3> OEM_C2 EQU 250 ; 250 FA 161 <3> OEM_C3 EQU 251 ; 251 FB 162 <3> OEM_C4 EQU 252 ; 252 FC 163 <3> OEM_C5 EQU 253 ; 253 FD 164 <3> OEM_C6 EQU 254 ; 254 FE 165 <3> OEM_C7 EQU 255 ; 255 FF 175 <2> 176 <2> ;SUBTTL 177 <2> 10 <1> %include "devsym.mac" 1 <2> %warning out: DEVSYM.INC... 1 ****************** <2> warning: out: DEVSYM.INC... [-w+user] 2 <2> ; SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04 3 <2> ; SCCSID = @(#)DEVSYM.ASM 1.10 85/09/04 4 <2> 5 <2> ; THE DEVICE TABLE LIST HAS THE FORM: 6 <2> SYSDEV STRUC 0 00000F20 ???????? SDEVNEXT DD ? ;POINTER TO NEXT DEVICE HEADER 0 00000F24 ???? SDEVATT DW ? ;ATTRIBUTES OF THE DEVICE 0 00000F26 ???? SDEVSTRAT DW ? ;STRATEGY ENTRY POINT 0 00000F28 ???? SDEVINT DW ? ;INTERRUPT ENTRY POINT 0 00000F2A ???????????????? SDEVNAME DB 8 DUP (?) ;NAME OF DEVICE (ONLY FIRST BYTE USED FOR BLOCK) 12 <2> SYSDEV ENDS 13 <2> 14 <2> ; 15 <2> ; ATTRIBUTE BIT MASKS 16 <2> ; 17 <2> ; CHARACTER DEVICES: 18 <2> ; 19 <2> ; BIT 15 -> MUST BE 1 20 <2> ; 14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS 21 <2> ; 13 -> 1 IF THE DEVICE SUPPORTS OUTPUT-UNTIL-BUSY 22 <2> ; 12 -> UNUSED 23 <2> ; 11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE 24 <2> ; 10 -> MUST BE 0 25 <2> ; 9 -> MUST BE 0 26 <2> ; 8 -> UNUSED 27 <2> ; 7 -> UNUSED 28 <2> ; 6 -> UNUSED 29 <2> ; 5 -> UNUSED 30 <2> ; 4 -> 1 IF DEVICE IS RECIPIENT OF INT 29H 31 <2> ; 3 -> 1 IF DEVICE IS CLOCK DEVICE 32 <2> ; 2 -> 1 IF DEVICE IS NULL DEVICE 33 <2> ; 1 -> 1 IF DEVICE IS CONSOLE OUTPUT 34 <2> ; 0 -> 1 IF DEVICE IS CONSOLE INPUT 35 <2> ; 36 <2> ; BLOCK DEVICES: 37 <2> ; 38 <2> ; BIT 15 -> MUST BE 0 39 <2> ; 14 -> 1 IF THE DEVICE UNDERSTANDS IOCTL CONTROL STRINGS 40 <2> ; 13 -> 1 IF THE DEVICE DETERMINES MEDIA BY EXAMINING THE FAT ID BYTE. 41 <2> ; THIS REQUIRES THE FIRST SECTOR OF THE FAT TO *ALWAYS* RESIDE IN 42 <2> ; THE SAME PLACE. 43 <2> ; 12 -> UNUSED 44 <2> ; 11 -> 1 IF THE DEVICE UNDERSTANDS OPEN/CLOSE/REMOVABLE MEDIA 45 <2> ; 10 -> MUST BE 0 46 <2> ; 9 -> MUST BE 0 47 <2> ; 8 -> UNUSED 48 <2> ; 7 -> UNUSED 49 <2> ; 6 -> IF DEVICE HAS SUPPORT FOR GETMAP/SETMAP OF LOGICAL DRIVES. 50 <2> ; IF THE DEVICE UNDERSTANDS GENERIC IOCTL FUNCTION CALLS. 51 <2> ; 5 -> UNUSED 52 <2> ; 4 -> UNUSED 53 <2> ; 3 -> UNUSED 54 <2> ; 2 -> UNUSED 55 <2> ; 1 -> UNUSED 56 <2> ; 0 -> UNUSED 57 <2> ; 58 <2> 59 <2> DEVTYP EQU 8000H ; BIT 15 - 1 IF CHAR, 0 IF BLOCK 60 <2> CHARDEV EQU 8000H 61 <2> DEVIOCTL EQU 4000H ; BIT 14 - CONTROL MODE BIT 62 <2> ISFATBYDEV EQU 2000H ; BIT 13 - DEVICE USES FAT ID BYTES, 63 <2> ; COMP MEDIA. 64 <2> OUTTILBUSY EQU 2000H ; OUTPUT UNTIL BUSY IS ENABLED 65 <2> ISNET EQU 1000H ; BIT 12 - 1 IF A NET DEVICE, 0 IF 66 <2> ; NOT. CURRENTLY BLOCK ONLY. 67 <2> DEVOPCL EQU 0800H ; BIT 11 - 1 IF THIS DEVICE HAS 68 <2> ; OPEN,CLOSE AND REMOVABLE MEDIA 69 <2> ; ENTRY POINTS, 0 IF NOT 70 <2> 71 <2> EXTENTBIT EQU 0400H ; BIT 10 - CURRENTLY 0 ON ALL DEVS 72 <2> ; THIS BIT IS RESERVED FOR FUTURE USE 73 <2> ; TO EXTEND THE DEVICE HEADER BEYOND 74 <2> ; ITS CURRENT FORM. 75 <2> 76 <2> ; NOTE BIT 9 IS CURRENTLY USED ON IBM SYSTEMS TO INDICATE "DRIVE IS SHARED". 77 <2> ; SEE IOCTL FUNCTION 9. THIS USE IS NOT DOCUMENTED, IT IS USED BY SOME 78 <2> ; OF THE UTILITIES WHICH ARE SUPPOSED TO FAIL ON SHARED DRIVES ON SERVER 79 <2> ; MACHINES (FORMAT,CHKDSK,RECOVER,..). 80 <2> 81 <2> DEV320 EQU 0040H ;BIT 6 - FOR BLOCK DEVICES, THIS 82 <2> ;DEVICE SUPPORTS SET/GET MAP OF 83 <2> ;LOGICAL DRIVES, AND SUPPORTS 84 <2> ;GENERIC IOCTL CALLS. 85 <2> ;FOR CHARACTER DEVICES, THIS 86 <2> ;DEVICE SUPPORTS GENERIC IOCTL. 87 <2> ;THIS IS A DOS 3.2 DEVICE DRIVER. 88 <2> ISSPEC EQU 0010H ;BIT 4 - THIS DEVICE IS SPECIAL 89 <2> ISCLOCK EQU 0008H ;BIT 3 - THIS DEVICE IS THE CLOCK DEVICE. 90 <2> ISNULL EQU 0004H ;BIT 2 - THIS DEVICE IS THE NULL DEVICE. 91 <2> ISCOUT EQU 0002H ;BIT 1 - THIS DEVICE IS THE CONSOLE OUTPUT. 92 <2> ISCIN EQU 0001H ;BIT 0 - THIS DEVICE IS THE CONSOLE INPUT. 93 <2> EXTDRVR EQU 0002H ;BIT 1 - BLOCK DEVICE EXTNDED DRIVER 94 <2> 95 <2> ;STATIC REQUEST HEADER 96 <2> SRHEAD STRUC 0 00000F20 ?? REQLEN DB ? ;LENGTH IN BYTES OF REQUEST BLOCK 0 00000F21 ?? REQUNIT DB ? ;DEVICE UNIT NUMBER 0 00000F22 ?? REQFUNC DB ? ;TYPE OF REQUEST 0 00000F23 ???? REQSTAT DW ? ;STATUS WORD 0 00000F25 ???????????????? DB 8 DUP(?) ;RESERVED FOR QUEUE LINKS 102 <2> SRHEAD ENDS 103 <2> 104 <2> ;STATUS WORD MASKS 105 <2> STERR EQU 8000H ;BIT 15 - ERROR 106 <2> STBUI EQU 0200H ;BIT 9 - BUISY 107 <2> STDON EQU 0100H ;BIT 8 - DONE 108 <2> STECODE EQU 00FFH ;ERROR CODE 109 <2> ; 2/12/KK 110 <2> ; Interim character identifier 2/12/KK 111 <2> Ddkey EQU 0000010000000000B ; 2/12/KK 112 <2> 113 <2> ;FUNCTION CODES 114 <2> DEVINIT EQU 0 ;INITIALIZATION 115 <2> DINITHL EQU 26 ;SIZE OF INIT HEADER 116 <2> DEVMDCH EQU 1 ;MEDIA CHECK 117 <2> DMEDHL EQU 15 ;SIZE OF MEDIA CHECK HEADER 118 <2> DEVBPB EQU 2 ;GET BPB 119 <2> DEVRDIOCTL EQU 3 ;IOCTL READ 120 <2> DBPBHL EQU 22 ;SIZE OF GET BPB HEADER 121 <2> DEVRD EQU 4 ;READ 122 <2> DRDWRHL EQU 22 ;SIZE OF RD/WR HEADER 123 <2> DEVRDND EQU 5 ;NON DESTRUCTIVE READ NO WAIT (CHARACTER DEVS) 124 <2> DRDNDHL EQU 14 ;SIZE OF NON DESTRUCTIVE READ HEADER 125 <2> DEVIST EQU 6 ;INPUT STATUS 126 <2> DSTATHL EQU 13 ;SIZE OF STATUS HEADER 127 <2> DEVIFL EQU 7 ;INPUT FLUSH 128 <2> DFLSHL EQU 15 ;SIZE OF FLUSH HEADER 129 <2> DEVWRT EQU 8 ;WRITE 130 <2> DEVWRTV EQU 9 ;WRITE WITH VERIFY 131 <2> DEVOST EQU 10 ;OUTPUT STATUS 132 <2> DEVOFL EQU 11 ;OUTPUT FLUSH 133 <2> DEVWRIOCTL EQU 12 ;IOCTL WRITE 134 <2> DEVOPN EQU 13 ;DEVICE OPEN 135 <2> DEVCLS EQU 14 ;DEVICE CLOSE 136 <2> DOPCLHL EQU 13 ;SIZE OF OPEN/CLOSE HEADER 137 <2> DEVRMD EQU 15 ;REMOVABLE MEDIA 138 <2> REMHL EQU 13 ;SIZE OF REMOVABLE MEDIA HEADER 139 <2> GENIOCTL EQU 19 140 <2> ; THE NEXT THREE ARE USED IN DOS 4.0 141 <2> ; 20 142 <2> ; 21 143 <2> ; 22 144 <2> DEVGETOWN EQU 23 ;GET DEVICE OWNER 145 <2> DEVSETOWN EQU 24 ;SET DEVICE OWNER 146 <2> QUERYGENIOCTL equ 25 ; query generic IOCTL support (MS-DOS v5+) 147 <2> OWNHL EQU 13 ;SIZE OF DEVICE OWNER HEADER 148 <2> 149 <2> DEVOUT EQU 16 ; OUTPUT UNTIL BUSY. 150 <2> DEVOUTL EQU DEVWRT ; LENGTH OF OUTPUT UNTIL BUSY 151 <2> 152 <2> ; GENERIC IOCTL REQUEST STRUCTURE 153 <2> ; SEE THE DOS 4.0 DEVICE DRIVER SPEC FOR FURTHER ELABORATION. 154 <2> ; 155 <2> IOCTL_REQ STRUC 156 00000000 <2> DB (SRHEAD_struc_size) DUP(?) 157 <2> ; GENERIC IOCTL ADDITION. 0 00000F2D ?? MAJORFUNCTION DB ? ;FUNCTION CODE 0 00000F2E ?? MINORFUNCTION DB ? ;FUNCTION CATEGORY 0 00000F2F ???? REG_SI DW ? 0 00000F31 ???? REG_DI DW ? 0 00000F33 ???????? GENERICIOCTL_PACKET DD ? ; POINTER TO DATA BUFFER 163 <2> IOCTL_REQ ENDS 164 <2> 165 <2> ; DEFINITIONS FOR IOCTL_REQ.MINORFUNCTION 166 <2> GEN_IOCTL_WRT_TRK EQU 40H 167 <2> GEN_IOCTL_RD_TRK EQU 60H 168 <2> GEN_IOCTL_FN_TST EQU 20H ; USED TO DIFF. BET READS AND WRTS 169 <2> 170 <2> ;; 32-bit absolute read/write input list structure 171 <2> 172 <2> ABS_32RW STRUC 0 00000F20 ???????? SECTOR_RBA DD ? ; relative block address 0 00000F24 ???? ABS_RW_COUNT DW ? ; number of sectors to be transferred 0 00000F26 ???????? BUFFER_ADDR DD ? ; data addrress 176 <2> ABS_32RW ENDS 177 <2> 178 <2> ;; media ID info 179 <2> 180 <2> MEDIA_ID_INFO STRUC 0 00000F20 ???? MEDIA_level DW ? ; info level 0 00000F22 ???????? MEDIA_Serial DD ? ; serial # 183 00000006 <2> MEDIA_Label DB 11 dup (?) ;volume label 0 00000F31 ???????????????? MEDIA_System DB 8 dup (?) ;system type 185 <2> MEDIA_ID_INFO ENDS 186 <2> 187 <2> ;; equates for DOS34_FLAG 188 <2> 189 <2> IFS_ABSRW EQU 00001H ;IFS absolute read/write 190 <2> NO_IFS_ABSRW EQU 0FFFEH ;no IFS absolute read/write 191 <2> IFS_DRIVE_RESET EQU 00002H ;IFS drvive reset 192 <2> NO_IFS_DRIVE_RESET EQU 0FFFDH ;no IFS drive reset 193 <2> FROM_DISK_RESET EQU 00004H ;from disk reset 194 <2> NO_FROM_DISK_RESET EQU 0FFFBH ;not from disk reset 195 <2> From_String_Output EQU 00008H ;from con string output 196 <2> NO_From_String_Output EQU 0FFF7H ;not from con string output 197 <2> From_DOS_WRITE EQU 00010H ;from dos_write 198 <2> NO_From_DOS_WRITE EQU 0FFEFH ;not from dos_write 199 <2> Force_I24_Fail EQU 00020H ;form IFS CALL BACK 200 <2> NO_Force_I24_Fail EQU 0FFDFH ;not form IFS CALL BACK 201 <2> Disable_EOF_I24 EQU 00040H ;disable EOF int24 for input status 202 <2> NO_Disable_EOF_I24 EQU 0FFBFH ;disable EOF int24 for input status 203 <2> DBCS_VOLID EQU 00080H ;indicate from volume id 204 <2> DBCS_VOLID2 EQU 00100H ;indicate 8th char is DBCS 205 <2> CTRL_BREAK_FLAG EQU 00200H ;indicate control break is input 206 <2> NO_CTRL_BREAK_FLAG EQU 0FDFFH ;reset control break 207 <2> SEARCH_FASTOPEN EQU 00400H ;set fastopen flag for search 208 <2> X25_special EQU 00800H ;flag for X25 driver 11 <1> %include "ifssym.mac" 1 <2> ; PAGE ,132; SCCSID = @(#)ifssym.inc 1.0 87/05/11 2 <2> ;****************************************************************************** 3 <2> ; IFS Symbol File 4 <2> ; 5 <2> ; REVISION HISTORY: 6 <2> ; A000 Original version 4.00 May 1987 7 <2> ; A001 DCR 158 - merge unc info in attach start/status requests 8/87 RGAZZIA 8 <2> ; A002 DCR 187 - ctrl req renumber, make attach type byte 8/87 RGAZZIA 9 <2> ; A003 PTM 764 - printer attach problems 8/87 RGAZZIA 10 <2> ; A004 PTM ???? - Write Only locks on Read/Write 10/27 FEIGENBAUM 11 <2> ; A005 DCR 285 - remove Extended Attribute/Lock support 1/88 RG 12 <2> ; A006 PTM 2827 error proc 1/88 RG 13 <2> ; A007 PTM 3334- reset envirn subfunc to eop 2/88 RMG 14 <2> ; A008 PTM 3745- commit across net problem due to sft flags problem 3/88 RMG 15 <2> ; A009 PTM 3810- new sft unique id in sff 3/88 RMG 16 <2> ; A010 PTM 4392- ditch sf_iomode,cp 4/18/88 RMG 17 <2> ; 18 <2> ; LOD - 414 19 <2> ; 20 <2> ;****************************************************************************** 21 <2> ;AN000; 22 <2> ;SUBTTL IFS Driver Header ;AN000; 23 <2> ;PAGE ;AN000; 24 <2> ;AN000; 25 <2> IFSHEADER STRUC ;AN000; 0 00000F20 ???????? IFS_NEXT DD ? ; Next header in list (-1=end) ;AN000; 0 00000F24 ???????????????? IFS_NAME DB 8 dup (?) ; IFS name ;AN000; 0 00000F2C ???? IFS_ATTRIBUTE DW ? ; Attributes ;AN000; 0 00000F2E ???? IFS_VERSION DW ? ; Request level supported ;AN000; 0 00000F30 ???????? IFS_DOSCALL@ DD ? ; DOS interface routine ;AN000; 31 <2> ; (set by TUPPER before the init call) ;AN000; 0 00000F34 ???? IFS_CALL@ DW ? ; Function entry point ;AN000; 33 <2> IFSHEADER ENDS ;AN000; 34 <2> ;AN000; 35 <2> ; ifs_attribute equates ;AN000; 36 <2> ;AN000; 37 <2> IFSDEVICE EQU 8000H ; Supports single device/file functions ;AN000; 38 <2> IFSDISK EQU 4000H ; Supports multi-file functions ;AN000; 39 <2> IFSUNC EQU 2000H ; Support UNC (nameless) connection ;AN000; 40 <2> IFSREMOTE EQU 0800H ; File system is remote ;AN000; 41 <2> IFSFILTER EQU 0400H ; FS will filter (if off, use DOS ;AN000; 42 <2> ; standard, cap & 8.3) ;AN000; 43 <2> IFSIOCTL EQU 0002H ; Supports IOCTL functions ;AN000; 44 <2> IFSUSESHARE EQU 0001H ; Uses DOS share support (vs own share) ;AN000; 45 <2> ;AN000; 46 <2> ;AN000; 47 <2> ;SUBTTL IFSRH - IFS Request Header ;AN000; 48 <2> ;PAGE ;AN000; 49 <2> ;AN000; 50 <2> ; IFS Request Header ;AN000; 51 <2> ;AN000; 52 <2> IFSRH STRUC ;AN000; 0 00000F20 ???? IFSR_LENGTH DW ? ; Total length of request ;AN000; 0 00000F22 ?? IFSR_FUNCTION DB ? ; Requested function ;AN000; 0 00000F23 ???? IFSR_RETCODE DW ? ; Explicit error ;AN000; 0 00000F25 ?? IFSR_RETCLASS DB ? ; Error class ;AN000; 57 00000006 <2> IFSR_RESV1 DB 16 DUP(?) ; DOS reserved ;AN000; 58 00000016 <2> IFSR_FCN_PARMS DB 50 DUP(?) ; Additional parameters ;AN000; 59 <2> IFSRH ENDS ;AN000; 60 <2> ;AN000; 61 <2> ; IFSR_FUNCTION codes ;AN000; 62 <2> ; Control requests: ;AN000; 63 <2> IFSINIT EQU 1 ;AN000; 64 <2> IFSATTSTART EQU 2 ;AN000; 65 <2> IFSATTSTAT EQU 3 ;AC002; 66 <2> IFSATTEND EQU 4 ;AC002; 67 <2> IFSEXECAPI EQU 5 ;AC002; 68 <2> IFSCRITMSG EQU 6 ;AC002; 69 <2> IFSUPDATECB EQU 7 ;AC002; 70 <2> ;AN000; 71 <2> ; IFSR_APIFUNC codes: ;AN000; 72 <2> ; Int 21 mapped requests: ;AN000; 73 <2> IFSDRIVERESET EQU 1 ;AN000; 74 <2> IFSDISKATTR EQU 2 ;AN000; 75 <2> IFSMKDIR EQU 3 ;AN000; 76 <2> IFSRMDIR EQU 4 ;AN000; 77 <2> IFSCHDIR EQU 5 ;AN000; 78 <2> IFSDELFILE EQU 6 ;AN000; 79 <2> IFSRENFILE EQU 7 ;AN000; 80 <2> IFSSEARCHFILE EQU 8 ;AN000; 81 <2> IFSOPENFILE EQU 9 ;AN000; 82 <2> IFSLSEEKFILE EQU 10 ;AN000; 83 <2> IFSREADFILE EQU 11 ;AN000; 84 <2> IFSWRITEFILE EQU 12 ;AN000; 85 <2> IFSLOCKFILE EQU 13 ;AN000; 86 <2> IFSCLOSEFILE EQU 14 ;AN000; 87 <2> IFSFILEATTR EQU 15 ;AN000; 88 <2> IFSDEPIOCTL EQU 16 ;AN000; 89 <2> IFSDEVIOCTL EQU 17 ;AN000; 90 <2> IFSEOP EQU 18 ;AN000; 91 <2> IFSEOCID EQU 19 ;AN000; 92 <2> ;AN000; 93 <2> ;SUBTTL Control Request Parameter Macro ;AN000; 94 <2> ;PAGE ;AN000; 95 <2> 96 <2> %if 0 ; for fixmem.pl 97 <2> labelsize IFSR_ACTION, word, invalidaddress 98 <2> labelsize IFSR_ALLOCSIZE, word, invalidaddress 99 <2> labelsize IFSR_ALLOCUNITS, word, invalidaddress 100 <2> labelsize IFSR_ALLOWED, byte, invalidaddress 101 <2> labelsize IFSR_APIFUNC, byte, invalidaddress 102 <2> labelsize IFSR_API_PARMS, byte, invalidaddress 103 <2> labelsize IFSR_ATTR, word, invalidaddress 104 <2> labelsize IFSR_AVAILALLOC, word, invalidaddress 105 <2> labelsize IFSR_BUFFER1@, dword, invalidaddress 106 <2> labelsize IFSR_BUFFER2@, dword, invalidaddress 107 <2> labelsize IFSR_BUFFER@, dword, invalidaddress 108 <2> labelsize IFSR_BUFSIZE, word, invalidaddress 109 <2> labelsize IFSR_CATEGORY, byte, invalidaddress 110 <2> labelsize IFSR_CB@, dword, invalidaddress 111 <2> labelsize IFSR_CONTINFO@, dword, invalidaddress 112 <2> labelsize IFSR_COUNT, word, invalidaddress 113 <2> labelsize IFSR_CP, word, invalidaddress 114 <2> labelsize IFSR_CPSW, byte, invalidaddress 115 <2> labelsize IFSR_CTLFUNC, byte, invalidaddress 116 <2> labelsize IFSR_DATE, word, invalidaddress 117 <2> labelsize IFSR_DEVICE_CB@, dword, invalidaddress 118 <2> labelsize IFSR_DEVICE_STATUS, byte, invalidaddress 119 <2> labelsize IFSR_ERROR_ACTION, byte, invalidaddress 120 <2> labelsize IFSR_ERROR_CLASS, byte, invalidaddress 121 <2> labelsize IFSR_ERROR_LOCUS, byte, invalidaddress 122 <2> labelsize IFSR_FLAG, word, invalidaddress 123 <2> labelsize IFSR_FSID, byte, invalidaddress 124 <2> labelsize IFSR_FUNC, byte, invalidaddress 125 <2> labelsize IFSR_I24_COUNT, byte, invalidaddress 126 <2> labelsize IFSR_I24_RESP, byte, invalidaddress 127 <2> labelsize IFSR_LK_LENGTH, dword, invalidaddress 128 <2> labelsize IFSR_LK_POSITION, dword, invalidaddress 129 <2> labelsize IFSR_LSN, word, invalidaddress 130 <2> labelsize IFSR_MATCHATTR, word, invalidaddress 131 <2> labelsize IFSR_MATCHATTR_47, word, invalidaddress 132 <2> labelsize IFSR_MAX_XMITT_SIZE, word, invalidaddress 133 <2> labelsize IFSR_MODE_BYTE, byte, invalidaddress 134 <2> labelsize IFSR_MODE_WORD, word, invalidaddress 135 <2> labelsize IFSR_MSG@, dword, invalidaddress 136 <2> labelsize IFSR_MSG_TYPE, byte, invalidaddress 137 <2> labelsize IFSR_NAME1@, dword, invalidaddress 138 <2> labelsize IFSR_NAME2@, dword, invalidaddress 139 <2> labelsize IFSR_NAME@, dword, invalidaddress 140 <2> labelsize IFSR_NET_NAME_ID, word, invalidaddress 141 <2> labelsize IFSR_OPEN_CB@, dword, invalidaddress 142 <2> labelsize IFSR_PARMS@, dword, invalidaddress 143 <2> labelsize IFSR_PID, word, invalidaddress 144 <2> labelsize IFSR_POSITION, dword, invalidaddress 145 <2> labelsize IFSR_RESSIZE, word, invalidaddress 146 <2> labelsize IFSR_SECTSIZE, word, invalidaddress 147 <2> labelsize IFSR_SIZE, dword, invalidaddress 148 <2> labelsize IFSR_SUBFUNC, byte, invalidaddress 149 <2> labelsize IFSR_TIME, word, invalidaddress 150 <2> labelsize IFSR_TYPE, byte, invalidaddress 151 <2> labelsize IFSR_UID, word, invalidaddress 152 <2> labelsize IFSR_USER_WORD, word, invalidaddress 153 <2> %endif 154 <2> 155 <2> 156 <2> ; NASM original macros 157 <2> 158 <2> %macro undefine_all_ifsr_labels 0.nolist 159 <2> %undef IFSR_ACTION 160 <2> %undef IFSR_ALLOCSIZE 161 <2> %undef IFSR_ALLOCUNITS 162 <2> %undef IFSR_ALLOWED 163 <2> %undef IFSR_APIFUNC 164 <2> %undef IFSR_API_PARMS 165 <2> %undef IFSR_ATTR 166 <2> %undef IFSR_AVAILALLOC 167 <2> %undef IFSR_BUFFER1@ 168 <2> %undef IFSR_BUFFER2@ 169 <2> %undef IFSR_BUFFER@ 170 <2> %undef IFSR_BUFSIZE 171 <2> %undef IFSR_CATEGORY 172 <2> %undef IFSR_CB@ 173 <2> %undef IFSR_CONTINFO@ 174 <2> %undef IFSR_COUNT 175 <2> %undef IFSR_CP 176 <2> %undef IFSR_CPSW 177 <2> %undef IFSR_CTLFUNC 178 <2> %undef IFSR_DATE 179 <2> %undef IFSR_DEVICE_CB@ 180 <2> %undef IFSR_DEVICE_STATUS 181 <2> %undef IFSR_ERROR_ACTION 182 <2> %undef IFSR_ERROR_CLASS 183 <2> %undef IFSR_ERROR_LOCUS 184 <2> %undef IFSR_FLAG 185 <2> %undef IFSR_FSID 186 <2> %undef IFSR_FUNC 187 <2> %undef IFSR_I24_COUNT 188 <2> %undef IFSR_I24_RESP 189 <2> %undef IFSR_LK_LENGTH 190 <2> %undef IFSR_LK_POSITION 191 <2> %undef IFSR_LSN 192 <2> %undef IFSR_MATCHATTR 193 <2> %undef IFSR_MATCHATTR_47 194 <2> %undef IFSR_MAX_XMITT_SIZE 195 <2> %undef IFSR_MODE_BYTE 196 <2> %undef IFSR_MODE_WORD 197 <2> %undef IFSR_MSG@ 198 <2> %undef IFSR_MSG_TYPE 199 <2> %undef IFSR_NAME1@ 200 <2> %undef IFSR_NAME2@ 201 <2> %undef IFSR_NAME@ 202 <2> %undef IFSR_NET_NAME_ID 203 <2> %undef IFSR_OPEN_CB@ 204 <2> %undef IFSR_PARMS@ 205 <2> %undef IFSR_PID 206 <2> %undef IFSR_POSITION 207 <2> %undef IFSR_RESSIZE 208 <2> %undef IFSR_SECTSIZE 209 <2> %undef IFSR_SIZE 210 <2> %undef IFSR_SUBFUNC 211 <2> %undef IFSR_TIME 212 <2> %undef IFSR_TYPE 213 <2> %undef IFSR_UID 214 <2> %undef IFSR_USER_WORD 215 <2> %endmacro 216 <2> 217 <2> %macro IFSR_FCN_DEF 1.nolist 218 <2> undefine_all_ifsr_labels 219 <2> %ifidni %1, INIT ;AN000; 220 <2> labelsize IFSR_PARMS@, dword, IFSR_FCN_PARMS ; command parameters ;AN000; 221 <2> labelsize IFSR_RESSIZE, word, IFSR_FCN_PARMS+4 ; driver total size ;AN000; 222 <2> LENGTH_INIT EQU IFSR_RESSIZE-IFSRH+2 ;AN000; 223 <2> ;AN000; 224 <2> %ELSE ;AN000; 225 <2> %ifidni %1, ATTSTART ;AN000; 226 <2> labelsize IFSR_TYPE, byte, IFSR_FCN_PARMS ; attach type ;AC001; 227 <2> labelsize IFSR_PARMS@, dword, IFSR_FCN_PARMS+2 ; command parameters ;AN000; 228 <2> labelsize IFSR_DEVICE_CB@, dword, IFSR_FCN_PARMS+6 ; CD/DF ;AN000; 229 <2> labelsize IFSR_USER_WORD, word, IFSR_FCN_PARMS+10 ; for unc deviceless attach ;AN001; 230 <2> LENGTH_ATTSTART EQU IFSR_USER_WORD-IFSRH+2 ;AC001;/;AC004; 231 <2> ;AN000; 232 <2> %ELSE ;AN000; 233 <2> %ifidni %1, ATTSTAT ;AN000; 234 <2> labelsize IFSR_TYPE, byte, IFSR_FCN_PARMS ; attach type ;AC001; 235 <2> labelsize IFSR_PARMS@, dword, IFSR_FCN_PARMS+2 ; command parameters ;AN000; 236 <2> labelsize IFSR_DEVICE_CB@, dword, IFSR_FCN_PARMS+6 ; CD/DF ;AN000; 237 <2> labelsize IFSR_USER_WORD, word, IFSR_FCN_PARMS+10 ; for unc deviceless attach ;AN001; 238 <2> labelsize IFSR_MAX_XMITT_SIZE, word, IFSR_FCN_PARMS+12 ; redir-maximum transmit size ;AN001; 239 <2> labelsize IFSR_NET_NAME_ID, word, IFSR_FCN_PARMS+14 ; redir-net name id ;AN001; 240 <2> labelsize IFSR_LSN, word, IFSR_FCN_PARMS+16 ; redir-low byte=local session # ;AN001; 241 <2> labelsize IFSR_DEVICE_STATUS, byte, IFSR_FCN_PARMS+18 ; redir-interesting bits ;AN001; 242 <2> LENGTH_ATTSTAT EQU IFSR_DEVICE_STATUS-IFSRH+2 ;AC001; 243 <2> ;AN000; 244 <2> %ELSE ;AN000; 245 <2> %ifidni %1, ATTEND ;AN000; 246 <2> labelsize IFSR_DEVICE_CB@, dword, IFSR_FCN_PARMS ; CD/DF ;AN000; 247 <2> labelsize IFSR_NAME@, dword, IFSR_FCN_PARMS+4 ; UNC deviceless detach ;AN000; 248 <2> LENGTH_ATTEND EQU IFSR_NAME@-IFSRH+4 ;AN000; 249 <2> ;AN000; 250 <2> %ELSE ;AN000; 251 <2> %ifidni %1, EXECAPI ;AN000; 252 <2> labelsize IFSR_APIFUNC, byte, IFSR_FCN_PARMS ; API function code ;AN000; 253 <2> labelsize IFSR_ERROR_CLASS, byte, IFSR_FCN_PARMS+1 ; DOS extended error class ;AN000; 254 <2> labelsize IFSR_ERROR_ACTION, byte, IFSR_FCN_PARMS+2 ; DOS extended error action ;AN000; 255 <2> labelsize IFSR_ERROR_LOCUS, byte, IFSR_FCN_PARMS+3 ; DOS extended error locus ;AN000; 256 <2> labelsize IFSR_ALLOWED, byte, IFSR_FCN_PARMS+4 ; DOS extended error locus ;AN000; 257 <2> labelsize IFSR_I24_COUNT, byte, IFSR_FCN_PARMS+5 ; critical error retry count ;AN000; 258 <2> ; 0=first time ;AN000; 259 <2> labelsize IFSR_I24_RESP, byte, IFSR_FCN_PARMS+6 ; critical error response ;AN000; 260 <2> ; 0=ignore 1=retry ;AN000; 261 <2> labelsize IFSR_DEVICE_CB@, dword, IFSR_FCN_PARMS+8 ; device (CD or DF) ;AN000; 262 <2> labelsize IFSR_OPEN_CB@, dword, IFSR_FCN_PARMS+12 ; open file instance (SF) ;AN000; 263 <2> labelsize IFSR_API_PARMS, byte, IFSR_FCN_PARMS+16 ;AN000; 264 <2> ;AN000; 265 <2> %ELSE ;AN000; 266 <2> %ifidni %1, CRITMSG ;AN000; 267 <2> labelsize IFSR_MSG@, dword, IFSR_FCN_PARMS ; message buffer address ;AN000; 268 <2> labelsize IFSR_MSG_TYPE, byte, IFSR_FCN_PARMS+4 ; message type ;AN000; 269 <2> ; 1=message is printed in form ;AN000; 270 <2> ; ;AN000; 271 <2> ; Abort,Retry,Ignore,Fail ;AN000; 272 <2> ; 0=message is printed in form ;AN000; 273 <2> ; error (read/writ)ing (drive/device) XXX ; ;AN000; 274 <2> ; Abort,Retry,Ignore,Fail ;AN000; 275 <2> ;AN000; 276 <2> LENGTH_CRITMSG EQU IFSR_MSG_TYPE-IFSRH+2 ;AN000; 277 <2> ;AN000; 278 <2> %ELSE ;AN000; 279 <2> %ifidni %1, UPDATECB ;AN000; 280 <2> labelsize IFSR_CB@, dword, IFSR_FCN_PARMS ; control block address ;AN000; 281 <2> labelsize IFSR_TYPE, byte, IFSR_FCN_PARMS+4 ; control block type ;AN000; 282 <2> IFSOPEN EQU 0 ; open instance (SFT) entry ;AN000; 283 <2> IFSCB EQU -1 ; see control block type field ;AN000; 284 <2> LENGTH_UPDATECB EQU IFSR_TYPE-IFSRH+2 ;AN000; 285 <2> ;AN000; 286 <2> %ENDIF ;AN000; 287 <2> %ENDIF ;AN000; 288 <2> %ENDIF ;AN000; 289 <2> %ENDIF ;AN000; 290 <2> %ENDIF ;AN000; 291 <2> %ENDIF ;AN000; 292 <2> %ENDIF ;AN000; 293 <2> %endmacro 294 <2> ;AN000; 295 <2> ;SUBTTL INT 21H Mapped Request Parameter Macro ;AN000; 296 <2> ;PAGE ;AN000; 297 <2> ;AN000; 298 <2> %macro IFSR_API_DEF 1.nolist ;AN000; 299 <2> undefine_all_ifsr_labels 300 <2> 301 <2> %ifidni %1, DRIVERESET ;AN000; 302 <2> labelsize IFSR_FUNC, byte, IFSR_API_PARMS ; 0=flush ;AN000; 303 <2> LENGTH_DRIVERESET EQU IFSR_FUNC-IFSRH+2 ;AN000; 304 <2> ;AN000; 305 <2> %ELSE ;AN000; 306 <2> %ifidni %1, DISKATTR ;AN000; 307 <2> labelsize IFSR_ALLOCUNITS, word, IFSR_API_PARMS ; # allocation units ;AN000; 308 <2> labelsize IFSR_ALLOCSIZE, word, IFSR_API_PARMS+2 ; allocation unit sectors ;AN000; 309 <2> labelsize IFSR_SECTSIZE, word, IFSR_API_PARMS+4 ; sector size ;AN000; 310 <2> labelsize IFSR_AVAILALLOC, word, IFSR_API_PARMS+6 ; free allocation units ;AN000; 311 <2> labelsize IFSR_FSID, byte, IFSR_API_PARMS+8 ; file system media id ;AN000; 312 <2> LENGTH_DISKATTR EQU IFSR_FSID-IFSRH+2 ;AN000; 313 <2> ;AN000; 314 <2> %ELSE ;AN000; 315 <2> %ifidni %1, MKDIR ;AN000; 316 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS ; asciiz name to process ;AN000; 317 <2> LENGTH_MKDIR EQU IFSR_NAME@-IFSRH+4 ;AN000; 318 <2> ;AN000; 319 <2> %ELSE ;AN000; 320 <2> %ifidni %1, RMDIR ;AN000; 321 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS ; asciiz name to process ;AN000; 322 <2> LENGTH_RMDIR EQU IFSR_NAME@-IFSRH+4 ;AN000; 323 <2> ;AN000; 324 <2> %ELSE ;AN000; 325 <2> %ifidni %1, CHDIR ;AN000; 326 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS ; asciiz name to process ;AN000; 327 <2> LENGTH_CHDIR EQU IFSR_NAME@-IFSRH+4 ;AN000; 328 <2> ;AN000; 329 <2> %ELSE ;AN000; 330 <2> %ifidni %1, DELFILE ;AN000; 331 <2> labelsize IFSR_MATCHATTR_47, word, IFSR_API_PARMS ; format 00000000e0a00shr ;AN000; 332 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS+2 ; file to delete ;AN000; 333 <2> LENGTH_DELFILE EQU IFSR_NAME@-IFSRH+4 ;AN000; 334 <2> ;AN000; 335 <2> %ELSE ;AN000; 336 <2> %ifidni %1, RENFILE ;AN000; 337 <2> labelsize IFSR_MATCHATTR, word, IFSR_API_PARMS ; format 00000000e0a00shr ;AN000; 338 <2> labelsize IFSR_NAME1@, dword, IFSR_API_PARMS+2 ; file to rename ;AN000; 339 <2> labelsize IFSR_NAME2@, dword, IFSR_API_PARMS+6 ; new file name ;AN000; 340 <2> LENGTH_RENFILE EQU IFSR_NAME2@-IFSRH+4 ;AN000; 341 <2> ;AN000; 342 <2> %ELSE ;AN000; 343 <2> %ifidni %1, SEARCHFILE ;AN000; 344 <2> labelsize IFSR_SUBFUNC, byte, IFSR_API_PARMS ; 1=first, 2=next ;AN000; 345 <2> labelsize IFSR_CONTINFO@, dword, IFSR_API_PARMS+2 ; continuation info addr ;AN000; 346 <2> labelsize IFSR_MATCHATTR, word, IFSR_API_PARMS+6 ; format 0000000re0advshr (1st) ;AN000; 347 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS+8 ; asciiz name to process (1st) ;AN000; 348 <2> LENGTH_SEARCHFILE EQU IFSR_NAME@-IFSRH+4 ;AN000; 349 <2> ;AN000; 350 <2> %ELSE ;AN000; 351 <2> %ifidni %1, OPENFILE ;AN000; 352 <2> labelsize IFSR_MODE_WORD, word, IFSR_API_PARMS ; open mode ;AN000; 353 <2> ; format: 0WF0000CISSS0AAA ;AN000; 354 <2> ; AAA=access code 0=read,1=write ;AN000; 355 <2> ; 2=read/write ;AN000; 356 <2> ; SSS=sharing mode 0=compatibility ;AN000; 357 <2> ; 1=deny r/w, 2=deny write ;AN000; 358 <2> ; 3=deny read, 4=deny none ;AN000; 359 <2> ; I 0=pass handle to child, 1=no inheri;AN000;t 360 <2> ; C 0=validate cp, 1=no cp check ;AN000; 361 <2> ; F 0=int 24H, 1=return error on ;AN000; 362 <2> ; this open & any I/O to this handle ;AN000; 363 <2> ; W 0=no commit, 1=auto-commit on ;AN000; 364 <2> ; write ;AN000; 365 <2> labelsize IFSR_FLAG, word, IFSR_API_PARMS+2 ; function control; format=CE ;AN000; 366 <2> ; C=does not exist action ;AN000; 367 <2> ; 0=fail, 1=create ;AN000; 368 <2> ; E=exists action ;AN000; 369 <2> ; 0=fail, 1=open, 2=replace/open ;AN000; 370 <2> labelsize IFSR_CP, word, IFSR_API_PARMS+4 ; global code page ;AN000; 371 <2> labelsize IFSR_CPSW, byte, IFSR_API_PARMS+6 ; CPSW flag ;AN000; 372 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS+8 ; asciiz name to open ;AN000; 373 <2> labelsize IFSR_PARMS@, dword, IFSR_API_PARMS+12 ; format: 374 <2> ; DD EA address 375 <2> ; DW #parms 376 <2> ; DB IOMODE ID ;AN000; 377 <2> ; DW IO Mode ;AN000; 378 <2> labelsize IFSR_MATCHATTR, word, IFSR_API_PARMS+16 ; format 00000000e0advshr ;AN000; 379 <2> labelsize IFSR_ACTION, word, IFSR_API_PARMS+18 ;AN000; 380 <2> LENGTH_OPENFILE EQU IFSR_ACTION-IFSRH+2 ;AN000; 381 <2> ;AN000; 382 <2> %ELSE ;AN000; 383 <2> %ifidni %1, LSEEKFILE ;AN000; 384 <2> labelsize IFSR_MODE_BYTE, byte, IFSR_API_PARMS ; see INT 21H AH=42H ;AN000; 385 <2> labelsize IFSR_POSITION, dword, IFSR_API_PARMS+2 ; displacement of LSEEK ;AN000; 386 <2> LENGTH_LSEEKFILE EQU IFSR_POSITION-IFSRH+4 ;AN000; 387 <2> ;AN000; 388 <2> %ELSE ;AN000; 389 <2> %ifidni %1, READFILE ;AN000; 390 <2> ;IFSR_MODE = BYTE PTR IFSR_API_PARMS ;AD005; 391 <2> labelsize IFSR_COUNT, word, IFSR_API_PARMS+2 ;AN000; 392 <2> labelsize IFSR_BUFFER@, dword, IFSR_API_PARMS+4 ;AN000; 393 <2> LENGTH_READFILE EQU IFSR_BUFFER@-IFSRH+4 ;AN000; 394 <2> ;AN000; 395 <2> %ELSE ;AN000; 396 <2> %ifidni %1, WRITEFILE ;AN000; 397 <2> ;IFSR_MODE = BYTE PTR IFSR_API_PARMS ;AD005; 398 <2> labelsize IFSR_COUNT, word, IFSR_API_PARMS+2 ;AN000; 399 <2> labelsize IFSR_BUFFER@, dword, IFSR_API_PARMS+4 ;AN000; 400 <2> LENGTH_WRITEFILE EQU IFSR_BUFFER@-IFSRH+4 ;AN000; 401 <2> ;AN000; 402 <2> %ELSE ;AN000; 403 <2> %ifidni %1, LOCKFILE ;AN000; 404 <2> ;IFSR_MODE = BYTE PTR IFSR_API_PARMS ; bit 0: 0=lock all operations ;AD005; 405 <2> ; 1=lock only write operations ;AD005; 406 <2> labelsize IFSR_FUNC, byte, IFSR_API_PARMS ; 0=LOCK, 1=UNLOCK ;AC005; 407 <2> ;IFSR_COUNT = WORD PTR IFSR_API_PARMS+2 ;AD005; 408 <2> ;IFSR_RANGE@ = DWORD PTR IFSR_API_PARMS+4 ;AD005; 409 <2> labelsize IFSR_LK_POSITION, dword, IFSR_API_PARMS+2 ;AN005; 410 <2> labelsize IFSR_LK_LENGTH, dword, IFSR_API_PARMS+6 ;AN005; 411 <2> LENGTH_LOCKFILE EQU IFSR_LK_LENGTH-IFSRH+4 ;AC005; 412 <2> ;AN000; 413 <2> %ELSE ;AN000; 414 <2> %ifidni %1, CLOSEFILE ;AN000; 415 <2> labelsize IFSR_FUNC, byte, IFSR_API_PARMS ; 0=CLOSE, 1=COMMIT ;AN000; 416 <2> LENGTH_CLOSEFILE EQU IFSR_FUNC-IFSRH+2 ;AN000; 417 <2> ;AN000; 418 <2> %ELSE ;AN000; 419 <2> %ifidni %1, FILEATTR ;AN000; 420 <2> labelsize IFSR_FUNC, byte, IFSR_API_PARMS ; 0=get, 1=set by handle ;AN000; 421 <2> ; 2=get, 3=set by name ;AN000; 422 <2> labelsize IFSR_SUBFUNC, byte, IFSR_API_PARMS+2 ; 0=none,2=EA List, 3-EA names ;AN000; 423 <2> ; 2,3 used only on IFSR_FUNC=0,1 ;AN000; 424 <2> labelsize IFSR_BUFFER1@, dword, IFSR_API_PARMS+4 ; if IFSR_TYPE=2,3 ;AN000; 425 <2> labelsize IFSR_BUFFER2@, dword, IFSR_API_PARMS+8 ; if IFSR_TYPE=2 ;AN000; 426 <2> labelsize IFSR_COUNT, word, IFSR_API_PARMS+12 ; if IFSR_TYPE=2,3 ;AN000; 427 <2> ; Following present only if IFSR_FUNC=2,3 ;AN000; 428 <2> labelsize IFSR_MATCHATTR, word, IFSR_API_PARMS+14 ; format 0000000re0advshr ;AN000; 429 <2> labelsize IFSR_NAME@, dword, IFSR_API_PARMS+16 ; ASCIIZ file name ;AN000; 430 <2> labelsize IFSR_SIZE, dword, IFSR_API_PARMS+20 ; file size ;AN000; 431 <2> labelsize IFSR_DATE, word, IFSR_API_PARMS+24 ; file date ;AN000; 432 <2> labelsize IFSR_TIME, word, IFSR_API_PARMS+26 ; file time ;AN000; 433 <2> labelsize IFSR_ATTR, word, IFSR_API_PARMS+28 ; format 0000000re0advshr ;AN000; 434 <2> LENGTH_FILEATTR EQU IFSR_ATTR-IFSRH+2 ;AN000; 435 <2> ;AN000; 436 <2> %ELSE ;AN000; 437 <2> %ifidni %1, DEPIOCTL ;AN000; 438 <2> labelsize IFSR_FUNC, byte, IFSR_API_PARMS ; 00 Generic IOCTL by device # ;AN000; 439 <2> ; 01 Generic IOCTL by handle ;AN000; 440 <2> ; 02 FS IOCTL query OS type ;AN000; 441 <2> labelsize IFSR_BUFFER@, dword, IFSR_API_PARMS+2 ; set on queries ;AN000; 442 <2> labelsize IFSR_BUFSIZE, word, IFSR_API_PARMS+6 ; Buffer size set for IFSR_FUNC=2 ;AN000; 443 <2> ; FUNC dependent parameters ;AN000; 444 <2> ; For generic ;AN000; 445 <2> labelsize IFSR_CATEGORY, byte, IFSR_API_PARMS+8 ; generic subfunctions ;AN000; 446 <2> labelsize IFSR_CTLFUNC, byte, IFSR_API_PARMS+9 ; see INT 21H AH=6BH ;AN000; 447 <2> LENGTH_DEPIOCTL EQU IFSR_CTLFUNC-IFSRH+1 ;AN000; 448 <2> ;AN000; 449 <2> %ELSE ;AN000; 450 <2> %ifidni %1, DEVIOCTL ;AN000; 451 <2> labelsize IFSR_FUNC, byte, IFSR_API_PARMS ; 00 Generic IOCTL by device # ;AN000; 452 <2> ; 01 Generic IOCTL by handle ;AN000; 453 <2> ; 02 FS IOCTL query OS type ;AN000; 454 <2> labelsize IFSR_BUFFER@, dword, IFSR_API_PARMS+2 ; set on queries ;AN000; 455 <2> labelsize IFSR_BUFSIZE, word, IFSR_API_PARMS+6 ; buffer size set for IFSR_FUNC=2 ;AN000; 456 <2> ; FUNC dependent parameters ;AN000; 457 <2> ; For generic ;AN000; 458 <2> labelsize IFSR_CATEGORY, byte, IFSR_API_PARMS+8 ; generic subfunctions ;AN000; 459 <2> labelsize IFSR_CTLFUNC, byte, IFSR_API_PARMS+9 ; see INT 21H AH=6BH ;AN000; 460 <2> LENGTH_DEVIOCTL EQU IFSR_CTLFUNC-IFSRH+1 ;AN000; 461 <2> ;AN000; 462 <2> %ELSE ;AN000; 463 <2> %ifidni %1, EOP ;AN000; 464 <2> labelsize IFSR_PID, word, IFSR_API_PARMS ; process ID ;AN000; 465 <2> labelsize IFSR_SUBFUNC, byte, IFSR_API_PARMS+2 ; 0=NORMAL EXIT, 1=ABORT EXIT ;AN000; 466 <2> LENGTH_EOP EQU IFSR_SUBFUNC-IFSRH+2 ;AN000; 467 <2> ;AN000; 468 <2> %ELSE ;AN000; 469 <2> %ifidni %1, EOCID ;AN000; 470 <2> labelsize IFSR_UID, word, IFSR_API_PARMS ; process ID ;AN000; 471 <2> LENGTH_EOCID EQU IFSR_UID-IFSRH+2 ;AN000; 472 <2> ;AN000; 473 <2> %ENDIF ;AN000; 474 <2> %ENDIF ;AN000; 475 <2> %ENDIF ;AN000; 476 <2> %ENDIF ;AN000; 477 <2> %ENDIF ;AN000; 478 <2> %ENDIF ;AN000; 479 <2> %ENDIF ;AN000; 480 <2> %ENDIF ;AN000; 481 <2> %ENDIF ;AN000; 482 <2> %ENDIF ;AN000; 483 <2> %ENDIF ;AN000; 484 <2> %ENDIF ;AN000; 485 <2> %ENDIF ;AN000; 486 <2> %ENDIF ;AN000; 487 <2> %ENDIF ;AN000; 488 <2> %ENDIF ;AN000; 489 <2> %ENDIF ;AN000; 490 <2> %ENDIF ;AN000; 491 <2> %ENDIF ;AN000; 492 <2> %endmacro 493 <2> 494 <2> ; end of NASM original macros 495 <2> 496 <2> 497 <2> ;SUBTTL Request Data ;AN000; 498 <2> ;PAGE ;AN000; 499 <2> ;AN000; 500 <2> ; Attach types ;AN000; 501 <2> ;;;aliasTYPE_ALIAS EQU 0 ;AN000; 502 <2> TYPE_DEVICE EQU 1 ;AN000; 503 <2> TYPE_DRIVE EQU 2 ;AN000; 504 <2> TYPE_NET_DEVICE EQU 3 ;AN000; 505 <2> TYPE_NET_DRIVE EQU 4 ;AN000; 506 <2> ; Attach cmds ;AN000; 507 <2> GET_MODE EQU 0 ;AN000; 508 <2> SET_MODE EQU 1 ;AN000; 509 <2> GET_ASSIGN_LIST EQU 2 ;AN000; 510 <2> DEFINE_MACRO EQU 3 ;AN000; 511 <2> CANCEL_ATTACH EQU 4 ;AN000; 512 <2> ;AN000; 513 <2> ATTACH_PARMS STRUC ;AN000; 0 00000F20 ???? AP_COUNT DW ? ;AN000; 0 00000F22 ?? AP_STRING DB ? ;AN000; 516 <2> ATTACH_PARMS ENDS ;AN000; 517 <2> ;AN000; 518 <2> ; Critical Error Message types ;AN000; 519 <2> CRIT_MSG_TYPE_1 equ 1 520 <2> TYPE1 EQU 1 ;AN000; 521 <2> TYPE0 EQU 0 ;AN000; 522 <2> ;AN000; 523 <2> ; Control Block types ;AN000; 524 <2> CBTYPE_SFF EQU 0 ;AN000; 525 <2> CBTYPE_CD EQU 1 ;AN000; 526 <2> CBTYPE_DF EQU 2 ;AN000; 527 <2> CBTYPE_DUMMYCD EQU 3 ;AN000; 528 <2> ;AN000; 529 <2> ; Drive Reset equates ;AN000; 530 <2> FUNC_FLUSH EQU 0 ;AN000; 531 <2> FUNC_FLUSH_INVALIDATE EQU 1 ;AN000; 532 <2> ;AN000; 533 <2> ; Search File equates ;AN000; 534 <2> IFSSEARCH_FIRST EQU 1 ;AN000; 535 <2> IFSSEARCH_NEXT EQU 2 ;AN000; 536 <2> ;AN000; 537 <2> ; Open/Create type ;AN000; 538 <2> TYPE_NONE EQU 0 ;AN000; 539 <2> NOTEXIST_ACT_FAIL equ 0 ;+BAF 540 <2> NOTEXIST_ACT_CREATE equ 1 ;+BAF 541 <2> EXIST_ACT_FAIL equ 0 ;+BAF 542 <2> EXIST_ACT_OPEN equ 1 ;+BAF 543 <2> EXIST_ACT_REP_OPEN equ 2 ;+BAF 544 <2> 545 <2> FILE_OPENED equ 1 546 <2> FILE_CREATED equ 2 547 <2> FILE_REPLACED equ 3 548 <2> ;AN000; 549 <2> ; Read/Write equates ;AN000; 550 <2> ;MODE_READ EQU 0 ;AD005; 551 <2> ;MODE_WRITE EQU 0 ;AD005; 552 <2> ;MODE_LOCK_READ EQU 1 ;AD005; 553 <2> ;MODE_WRITE_UNLOCK EQU 1 ;AD005; 554 <2> ;MODE_WRITE_SFPOS EQU 00H ;AD005; 555 <2> ;MODE_WRITE_SFSIZE EQU 02H ;AD005; 556 <2> ;MODE_ADD_MASK EQU 00000010B ; do I need this??? ;AD005; 557 <2> ;AN000; 558 <2> ; Lock equates ;AN000; 559 <2> ;MODE_LOCK_ALL EQU 0 ;AD005; 560 <2> ;MODE_LOCK_WRITE EQU 1 ;AD005; 561 <2> FUNC_LOCK EQU 0 ;AN000; 562 <2> FUNC_UNLOCK EQU 1 ;AN000; 563 <2> ;MODE_ADD_MASK EQU 00000010B ;AD005; 564 <2> ;MODE_WO_MASK EQU 10000000B ;AN004; BAF ;AD005; 565 <2> ;LOCK_RANGE_STRUC STRUC ;AD005; 566 <2> ; IFSR_LOCK_POSITION DD ? ;AD005; 567 <2> ; IFSR_LOCK_LENGTH DD ? ;AD005; 568 <2> ;LOCK_RANGE_STRUC ENDS ;AD005; 569 <2> 570 <2> ;AN000; 571 <2> ; Close equates ;AN000; 572 <2> FUNC_CLOSE EQU 0 ;AN000; 573 <2> FUNC_COMMIT EQU 1 ;AN000; 574 <2> ;AN000; 575 <2> ; LSeek equates ;AN000; 576 <2> MODE2 EQU 2 ;AN000; 577 <2> ;AN000; 578 <2> ; File Attribute equates ;AN000; 579 <2> FUNC_GET_BY_HANDLE EQU 0 ;AN000; 580 <2> FUNC_SET_BY_HANDLE EQU 1 ;AN000; 581 <2> FUNC_GET_BY_NAME EQU 2 ;AN000; 582 <2> FUNC_SET_BY_NAME EQU 3 ;AN000; 583 <2> SUBFUNC_INLINE EQU 0 ;AN000; 584 <2> SUBFUNC_EA EQU 2 ;AN000; 585 <2> SUBFUNC_EA_NAMES EQU 3 ;AN000; 586 <2> ;AN000; 587 <2> ; FS Dependent IOCTL ;AN000; 588 <2> GEN_IOCTL_BY_DEVNUM EQU 0 ;AN000; 589 <2> GEN_IOCTL_BY_HANDLE EQU 1 ;AN000; 590 <2> QUERY_OS_TYPE EQU 2 ;AN000; 591 <2> CATEGORY_FS EQU 0 ;AN000; 592 <2> CATEGORY_REDIR EQU 1 ;AN000; 593 <2> PRINTER_SET_STRING EQU 2 ;AN000; 594 <2> PRINTER_GET_STRING EQU 3 ;AN000; 595 <2> PRINTER_SET_FLAGS EQU 4 ;AN000; 596 <2> PRINTER_GET_FLAGS EQU 5 ;AN000; 597 <2> CTLFUNC_PRINTER_SET_STRING EQU 00100001B ;AN000; 598 <2> CTLFUNC_PRINTER_GET_STRING EQU 00000001B ;AN000; 599 <2> CTLFUNC_PRINTER_SET_FLAGS EQU 00100010B ;AN000; 600 <2> CTLFUNC_PRINTER_GET_FLAGS EQU 00000010B ;AN000; 601 <2> CTLFUNC_DEVECHOCHECK EQU 00000011B ;AN000; 602 <2> CTLFUNC_GET_UNC_ITEM EQU 00000100B ;AN000; 603 <2> CTLFUNC_DEVCLOSE EQU 00000101B ;AN000; 604 <2> CTLFUNC_DEVOPER EQU 00000110B ;AN000; 605 <2> CTLFUNC_PRINT_ON EQU 00100111B ;AN000; 606 <2> CTLFUNC_PRINT_OFF EQU 00000111B ;AN000; 607 <2> CLOSE_SPOOL_FILES EQU 9 ;AN000; 608 <2> LENGTH_DEVECHOCHECK_BUFFER EQU 1 ;AN000; 609 <2> ;AN000; 610 <2> ; FS Device IOCTL ;AN000; 611 <2> READ_DEVICE EQU 2 ;AN000; 612 <2> WRITE_DEVICE EQU 3 ;AN000; 613 <2> CHAR_GENERIC EQU 0CH ;AN000; 614 <2> BLOCK_GENERIC EQU 0DH ;AN000; 615 <2> ;AN000; 616 <2> ; End of Process equates ;AN000; 617 <2> EOP_NORMAL EQU 0 ;AN000; 618 <2> EOP_ABORT EQU 1 ;AN000; 619 <2> RESET_ENVIRONMENT EQU 2 620 <2> ;AN000; 621 <2> ;SUBTTL Request Return Classes/Codes ;AN000; 622 <2> ;PAGE ;AN000; 623 <2> ;AN000; 624 <2> ; IFS Request Return Codes ;AN000; 625 <2> IFSR_NO_ERROR EQU 0 ;AN000; 626 <2> IFSR_NONSPEC_ERROR EQU 1 ;AN000; 627 <2> IFSR_NOT_FOUND_ERROR EQU 2 ;AN000; 628 <2> IFSR_ACCESS_DENIED EQU 3 ;AN000; 629 <2> IFSR_DEVICE_TYPE_MISMATCH EQU 4 ;AN000; 630 <2> IFSR_NO_SUBFCN_SUPPORT EQU -2 ;AN000; 631 <2> IFSR_NO_FCN_SUPPORT EQU -1 ;AN000; 632 <2> ;AN000; 633 <2> ; IFS Request Return Classes ;AN000; 634 <2> IFSR_INT21H_ERROR EQU 1 ;AN000; 635 <2> IFSR_DRIVER_ERROR EQU 2 ;AN000; 636 <2> IFSR_INT21H_CRITER EQU 3 ;AN000; 637 <2> IFSR_DEVICE_ERROR EQU 4 ;AN006; 638 <2> IFSR_BAD_FORMAT EQU -1 ;AN000; 639 <2> 640 <2> ; 641 <2> ; Int 24H 642 <2> NO_RETRY equ 0 643 <2> I24_RESP_IGNORE equ 0 644 <2> I24_RESP_RETRY equ 1 645 <2> 646 <2> ;AN000; 647 <2> ; IFS_DOSCALL@ function equates ;AN000; 648 <2> ; Block Device Driver Requests ;AN000; 649 <2> CALL_INTERRUPT_ROUTINE EQU 1 ;AN000; 650 <2> READ_SECTORS EQU 2 ;AN000; 651 <2> WRITE_SECTORS EQU 3 ;AN000; 652 <2> FIND_SECTOR EQU 8 ;AN000; 653 <2> MARK_SECTOR_CHANGED EQU 9 ;AN000; 654 <2> ; Buffer Cache Requests ;AN000; 655 <2> WRITE_DOS_BUFFER EQU 10 ;AN000; 656 <2> READ_DOS_BUFFER EQU 11 ;AN000; 657 <2> FREE_DOS_BUFFER EQU 12 ;AN000; 658 <2> FLUSH_DOS_BUFFERS EQU 13 ;AN000; 659 <2> ; Get DOS Variable ;AN000; 660 <2> GET_DOS_VALUE EQU 32 ;AN000; 661 <2> ACTIVE_PROCESS_INFO EQU 1 ;AN000; 662 <2> CPSW_INFORMATION EQU 2 ;AN000; 663 <2> BREAK_INFORMATION EQU 3 ;AN000; 664 <2> VERIFY_INFORMATION EQU 4 ;AN000; 665 <2> CONFIG_SYS_VALUES EQU 5 ;AN000; 666 <2> DOS_VALUE_BUFFER STRUC ;AN000; 0 00000F20 ???? VAL_BUF_SIZE DW ? ;AN000; 0 00000F22 ???? VAL_BUF_FILES DW ? ;AN000; 0 00000F24 ???? VAL_BUF_FCBS DW ? ;AN000; 0 00000F26 ???? DW ? ;AN000; 0 00000F28 ???? VAL_BUF_BUFS DW ? ;AN000; 0 00000F2A ???? DW ? ;AN000; 0 00000F2C ???? VAL_BUF_LDRV DW ? ;AN000; 0 00000F2E ???? VAL_BUF_SSZ DW ? ;AN000; 675 <2> DOS_VALUE_BUFFER ENDS ;AN000; 676 <2> MACHINE_NAME EQU 6 ;AN000; 677 <2> COUNTRY_INFO EQU 7 ;AN000; 678 <2> SHARE_RETRY_COUNT EQU 8 ;AN000; 679 <2> ; Get Assign Mode ;AN000; 680 <2> GET_ASSIGN_MODE EQU 33 ;AN000; 681 <2> DEVICE_MACRO equ 3 682 <2> DRIVE_MACRO equ 4 683 <2> PAUSE_MODE_ON equ 1 684 <2> PAUSE_MODE_OFF equ 0 685 <2> ; 686 <2> DOS2NET_DATE equ 34 687 <2> NET2DOS_DATE equ 35 688 <2> DOS_STRCMP equ 36 689 <2> DOS_STRCPY equ 37 690 <2> USE_SYSTEM_TIMEDATE equ 0 691 <2> USE_USER_TIMEDATE equ 1 692 <2> ; 693 <2> ;AN000; 694 <2> ;AN000; 695 <2> ;SUBTTL Pseudo Block Structures: SF, CD, DF ;AN000; 696 <2> ;PAGE ;AN000; 697 <2> ; SFF - Pseudo SFT ;AN000; 698 <2> ; This structure is used to pass pertinent SFT information ;AN000; 699 <2> ; to IFS driver. ;AN000; 700 <2> ;AN000; 701 <2> SFF STRUC ; Open File Control Block ;AN000; 0 00000F20 ???? SFF_TYPE DB ?,? ; Identifies SFF ;AN000; 0 00000F22 ???? SFF_FLAGS DW ? ; Control flags ;AN000; 704 <2> ; 4000H=don't set date/time on close ;AN009; 705 <2> ; 0080H=device (vs file) ;AN009; 706 <2> ; 0040H=File clean ;AN008; 0 00000F24 ???? SFF_MODE DW ? ; Mode of access. ;AN000; 708 <2> ; 8000H=FCB (vs handle)[this moved from flags];AC008; 0 00000F26 ???? SFF_RESV1 DW ? ; IO mode. ;AC023; iomode 0 00000F28 ???? SFF_ATTR DW ? ; File attr.FORMAT : 0000000re0advshr ;AN000; 0 00000F2A ???? SFF_UID DW ? ; User ID ;AN000; 0 00000F2C ???? SFF_PID DW ? ; Process ID ;AN000; 0 00000F2E ???????? SFF_SIZE DD ? ; File size ;AN000; 0 00000F32 ???????? SFF_POSITION DD ? ; Read/Write pointer ;AN000; 0 00000F36 ???? SFF_TIME DW ? ; File time ;AN000; 0 00000F38 ???? SFF_DATE DW ? ; File date ;AN000; 0 00000F3A ???????????????? SFF_NAME DB 8 DUP (?) ; Name ;AN000; 0 00000F42 ?????? SFF_EXT DB 3 DUP (?) ; Extension ;AN000; 0 00000F45 ???? SFF_RESV2 DW ? ; Code page ;AC024; cp 0 00000F47 ???? SFF_SF_ID DW ? ; Unique SFT entry identifier ;AN009; 721 00000029 <2> SFF_RESV DB 12 DUP(?) ; Reserved ;AC009; 0 00000F55 ???????????????? SFF_FSDA DB 8 DUP(?) ; File System Dependent Data Area ;AN000; 723 <2> SFF ENDS ;AN000; 724 <2> ;AN000; 725 <2> ; sff_flags bits 726 <2> SFF_Close_NoDate EQU 4000H ; 4000H=don't set date/time on close ;AN009; 727 <2> SFF_IsDevice EQU 0080H ; 0080H=device (vs file) ;AN009; 728 <2> SFF_FileClean EQU 0040H ; 0040H=File clean ;AN008; 729 <2> SFF_Device_Raw EQU 0020H ; 0020H=Device raw ;AN008; 730 <2> SFF_Net_Spool EQU 0000100000000000B 731 <2> ; sff_mode bits 732 <2> SFF_IsFCB EQU 8000H ; 8000H=FCB (vs handle)[this moved from flags];AC008; 733 <2> 734 <2> ; CD - Pseudo CDS ;AN000; 735 <2> ; This structure is used to pass pertinent CDS information ;AN000; 736 <2> ; to IFS driver. ;AN000; 737 <2> ;AN000; 738 <2> CD STRUC ;AN000; 0 00000F20 ???? CD_TYPE DB ?,? ; Identifies CD ;AN000; 0 00000F22 ???? CD_END DW ? ; End of assignment in CD_TEXT ;AN000; 741 00000004 <2> CD_TEXT DB 67 DUP (?) ; Text of assignment and curdir ;AN000; 0 00000F67 ?????????? CD_RESV DB 5 DUP(?) ; Reserved ;AN000; 0 00000F6C ???????????????? CD_FSDA DB 8 DUP(?) ; File System Dependent Data Area ;AN000; 744 <2> CD ENDS ;AN000; 745 <2> ;AN000; 746 <2> ; DF - Pseudo DFL ;AN000; 747 <2> ; This structure is used to pass pertinent DFL information ;AN000; 748 <2> ; to IFS driver. ;AN000; 749 <2> 750 <2> DFL STRUC ;AN000; 0 00000F20 ???? DFL_TYPE DB ?,? ; Identifies DFL ;AN000; 0 00000F22 ???????????????? DFL_DEV_NAME DB 8 DUP (?) ; Device name ;AN000; 0 00000F2A ???????????????? DFL_FSDA DB 8 DUP (?) ; File System Dependent Data Area ;AN000; 754 <2> DFL ENDS ;AN000; 755 <2> ;AN000; 756 <2> ;SUBTTL Search Continuation Information ;AN000; 757 <2> ;PAGE ;AN000; 758 <2> CONTINFO STRUC ;AN000; 0 00000F20 ???????????????? CI_SEARCH_FN DB 8 DUP(?) ; SEARCH FILE NAME ;AN000; 0 00000F28 ?????? CI_SEARCH_FN_EXT DB 3 DUP(?) ; SEARCH FILE EXTENSION ;AN000; 0 00000F2B ?? CI_SEARCH_ATTR DB ? ; SEARCH ATTRIBUTE ;AN000; 0 00000F2C ???????????????? CI_FSDA DB 8 DUP(?) ; FSDA ;AN000; 763 <2> ; Directory entry: ;AN000; 0 00000F34 ???????????????? CI_FOUND_FN DB 8 DUP(?) ; FOUND FILE NAME ;AN000; 0 00000F3C ?????? CI_FOUND_FN_EXT DB 3 DUP(?) ; FOUND FILE EXTENSION ;AN000; 0 00000F3F ?? CI_FOUND_ATTRL DB ? ; FOUND ATTRIBUTE LOW ??? DB/DD ;AN000; 0 00000F40 ???? CI_CP DW ? ; FILE CODE PAGE (OR 0) ;AN000; 0 00000F42 ???? CI_RESV1 DW ? ; RESERVED ;AN000; 0 00000F44 ?? CI_FOUND_ATTRH DB ? ; FOUND ATTRIBUTE HIGH ;AN000; 0 00000F45 ?????????? CI_RESV2 DB 5 DUP(?) ; RESERVED ;AN000; 0 00000F4A ???? CI_FILE_TIME DW ? ; FILE TIME ;AN000; 0 00000F4C ???? CI_FILE_DATE DW ? ; FILE DATE ;AN000; 0 00000F4E ???? CI_FSWORD DW ? ; MEANING FILE SYSTEM SPECIFIC ;AN000; 774 <2> ; (STARTING CLUSTER IN FAT) ;AN000; 0 00000F50 ???????? CI_FILE_SIZE DD ? ; FILE SIZE ;AN000; 776 <2> CONTINFO ENDS ;AN000; 777 <2> 778 <2> 779 <2> CATEGORY_PRINTER EQU 5 780 <2> 781 <2> CTLFUNC_SELECT EQU 4AH 782 <2> CTLFUNC_QUERY_SELECTED EQU 6AH 783 <2> CTLFUNC_QUERY_PREPLIST EQU 6BH 784 <2> 785 <2> DEV_OPER_BUFFER STRUC 0 00000F20 ?? OPER_FUNC DB ? 0 00000F21 ?? TRUNC_FLAG DB ? 788 <2> DEV_OPER_BUFFER ENDS 789 <2> 790 <2> PACKET STRUC ; device ioctl buffer info 0 00000F20 ???? PACKLEN DW ? ; length of packet in bytes 0 00000F22 ???? PACKCPID DW ? ; code page id 793 <2> PACKET ENDS 794 <2> 12 <1> %include "fastopen.mac" 1 <2> ; 2 <2> ; EXPORT DATE: 9/11 3 <2> ;Equates for FASTOPEN. 4 <2> 5 <2> ;FASTOPEN NAME CACHING Subfunctions 6 <2> FONC_Look_up equ 1 7 <2> FONC_insert equ 2 8 <2> FONC_delete equ 3 9 <2> FONC_update equ 4 10 <2> FONC_purge equ 5 ;reserved for the future use. 11 <2> 12 <2> ;FASTOPEN EXTENT CACHING Subfunctions 13 <2> FSK_Open equ 11 ;AN000; 14 <2> FSK_Close equ 12 ;AN000; 15 <2> FSK_Delete equ 13 ;AN000; 16 <2> FSK_Lookup equ 14 ;AN000; 17 <2> FSK_Insert equ 15 ;AN000; 18 <2> FSK_Trunc equ 16 ;AN000; 19 <2> 20 <2> HeaderSize equ 8 ; size of file header (8 bytes) ;AN000; 21 <2> ExtendSize equ 8 ; size of extend (8 bytes) ;AN000; 22 <2> Num_Of_Pages equ 1 ; number of pages ;AN000; 23 <2> Num_Of_Segs equ 2 ; number of frame segments ;AN000; 24 <2> Stayresident equ 04ch ; terminate and stay resident function code 25 <2> 26 <2> 27 <2> ;Equates used in DOS. 28 <2> FastOpen_Set equ 00000001B 29 <2> FastOpen_Reset equ 11111110B 30 <2> Lookup_Success equ 00000010B 31 <2> Lookup_Reset equ 11111101B 32 <2> Special_Fill_Set equ 00000100B 33 <2> Special_Fill_Reset equ 11111011B 34 <2> No_Lookup equ 00001000B 35 <2> Set_For_Search equ 00010000B ;DCR 167 36 <2> 37 <2> 38 <2> ;============= FastOpen Data Structures ===================== 39 <2> 40 <2> Fastopen_Entry STRUC ;Fastopen Entry pointer in DOS 0 00000F20 ???? Fastopen_Entry_size dw ? ;size of the following 0 00000F22 ???????? Fastopen_Name_Caching dd ? 43 <2> ;Fastopen_FatChain_Caching dd ? ;reserved for future use 44 <2> Fastopen_Entry ENDS 45 <2> ; 46 <2> 47 <2> 48 <2> CMPCT_DIR_INFO STRUC ;compact version of Dir Info. 49 00000000 <2> CDI_file_name db 11 dup (?) 0 00000F2B ?? CDI_file_attr db ? 0 00000F2C ???? CDI_codepage dw ? 0 00000F2E ???? CDI_extcluster dw ? 0 00000F30 ?? CDI_attr2 db ? 0 00000F31 ???? CDI_time dw ? 0 00000F33 ???? CDI_date dw ? 0 00000F35 ???? CDI_cluster dw ? 0 00000F37 ???????? CDI_filesize dd ? 58 <2> CMPCT_DIR_INFO ENDS 59 <2> ; 60 <2> 61 <2> ORIG_DIR_INFO STRUC 62 00000000 <2> ODI_head db 17 dup (?) 0 00000F31 ?????????? ODI_skip db 5 dup (?) ;reserved for DOS. FASTOPEN does not 64 00000016 <2> ODI_tail db 10 dup (?) ; use ODI_skip part. 65 <2> ORIG_DIR_INFO ENDS 66 <2> ; 67 <2> 68 <2> ODI_head_leng equ 17 69 <2> ODI_skip_leng equ 5 70 <2> ODI_tail_leng equ 10 71 <2> ; 72 <2> 73 <2> FASTOPEN_EXTENDED_INFO STRUC 0 00000F20 ?? FEI_dirpos db ? 0 00000F21 ???????? FEI_dirsec dd ? 0 00000F25 ???? FEI_clusnum dw ? 0 00000F27 ???? FEI_lastent dw ? ; for search first 0 00000F29 ???? FEI_dirstart dw ? ; for search first 79 <2> FASTOPEN_EXTENDED_INFO ENDS 80 <2> ; 81 <2> 82 <2> NAME_RECORD STRUC 0 00000F20 ???? nLRU_ptr dw ? 0 00000F22 ???? nMRU_ptr dw ? ;reverse of nLRU_ptr 0 00000F24 ???? nChild_ptr dw ? 0 00000F26 ???? nSibling_ptr dw ? 0 00000F28 ???? nBackward_ptr dw ? ;points to preceding node 88 <2> Cmpct_Dir_Info_struc_size equ CMPCT_DIR_INFO_struc_size ; NASM port equate 89 0000000A <2> nCmpct_Dir_Info db Cmpct_Dir_Info_struc_size dup (?) 90 <2> Fastopen_Extended_Info_struc_size equ FASTOPEN_EXTENDED_INFO_struc_size ; NASM port equate 91 00000025 <2> nExtended_Info db Fastopen_Extended_Info_struc_size dup (?) 92 <2> NAME_RECORD ENDS 93 <2> ; 94 <2> 95 <2> DRIVE_CACHE_HEADER STRUC ;drive cache header 0 00000F20 ???? DCH_LRU_ROOT dw ? ;Header of the LRU chain of this drive 0 00000F22 ???? DCH_MRU_ROOT dw ? ;offset to the last entry of LRU chain 0 00000F24 ???? DCH_Child_ptr dw ? ;the first child in Name cache seg. 0 00000F26 ???? DCH_Sibling_ptr dw ? ;points to the next drive cache header 0 00000F28 ?? DCH_Drive_letter db ? ;drive letter 0 00000F29 ???? DCH_Num_Entries dw ? ;Number of entries in the Name cache. 0 00000F2B ???? DCH_Name_Buff dw ? ;pointer to name cahe buffer 103 <2> DRIVE_CACHE_HEADER ENDS 104 <2> ; 105 <2> 106 <2> 107 <2> 108 <2> 109 <2> 110 <2> ;======== FAST SEEK FUNCTION DATA STRUCTURES ======================= 111 <2> 112 <2> DRIVE_HEADER STRUC ; Drive header structure ;AN000; 0 00000F20 ???? Drive_Number dw ? ; drive number ;AN000; 0 00000F22 ???? Extent_Count dw ? ; reserved for debugging 0 00000F24 ???? MRU_Hdr_Ptr dw ? ; pointer to OPEN Queue 0 00000F26 ???? Free_ptr dw ? ; pointer to FREE buffer ;AN000; 0 00000F28 ???? Close_Ptr dw ? ; pointer to CLOSE Queue ;AN000; 0 00000F2A ???? Buff_Size dw ? ; cache buffer size including header ;AN000; 0 00000F2C ???? Free_Size dw ? ; size of Free area in bytes 0 00000F2E ???? Next_Drv_Hdr_Ptr dw ? ; pointer to next drive header 121 <2> DRIVE_HEADER ENDS 122 <2> 123 <2> 124 <2> 125 <2> FILE_HEADER STRUC ; File header structure ;AN000; 0 00000F20 ???? FH_Phys_Clus_Num dw ? ; starting physcial clustnum of file ;AN000; 0 00000F22 ???? FH_Refer_Count dw ? ; reference count ;AN000; 0 00000F24 ???? FH_Next_Extn_Ptr dw ? ; pointer to first extent of the file;AN000; 0 00000F26 ???? FH_Next_Hdr_Ptr dw ? ; pointer to next file header ;AN000; 0 00000F28 ???? FH_MRU_Extn_Ptr dw ? ; pointer to MRU extent 0 00000F2A ???? dw ? 0 00000F2C ???? dw ? 0 00000F2E ???? dw ? 134 <2> FILE_HEADER ENDS ;AN000; 135 <2> 136 <2> 137 <2> 138 <2> EXTENT_HEADER STRUC ; extend header structure ;AN000; 0 00000F20 ???? EH_Logic_Clus_Num dw ? ; starting logical clus num of extent;AN000; 0 00000F22 ???? EH_Phys_Clus_Num dw ? ; starting physical clus numof extnt;AN000; 0 00000F24 ???? EH_Count dw ? ; range of logical clusnum in the extnt 0 00000F26 ???? EH_Next_Extn_Ptr dw ? ; pointer to next extent ;AN000; 0 00000F28 ???? EH_Prev_Extn_Ptr dw ? ; pointer to previous extent ;AN000; 0 00000F2A ???? EH_Next_LRU_Ptr dw ? ; pointer to next LRU extent 0 00000F2C ???? EH_Prev_LRU_Ptr dw ? ; pointer tp previous LRU extent 0 00000F2E ???? dw ? 147 <2> EXTENT_HEADER ENDS 148 <2> 149 <2> 150 <2> 13 <1> %include "fastxxxx.mac" 1 <2> ; Fastxxx equates 2 <2> FastOpen_ID equ 1 3 <2> FastSeek_ID equ 2 4 <2> Fast_yes equ 10000000B ; fastxxx flag 5 <2> 6 <2> ;Structure definitions 7 <2> ; 8 <2> Fasttable_Entry struc ; Fastxxx Entry pointer in DOS 0 00000F20 ???? Fast_Entry_Num dw ? ; number of entries 0 00000F22 ???????? FastOpen_Seek dd ? ; fastopen & fastseek entry address 11 <2> Fasttable_Entry ends 12 <2> ; 14 <1> %include "codesw.mac" 1 <2> DOSCODE_HMA_SEGMENT equ 0FFFEh 2 <2> ; address DOSCODE at this segment when in HMA 3 <2> DOSCODE_HMA_start_at equ (10000h - DOSCODE_HMA_SEGMENT) * 10h 4 <2> ; offset from DOSCODE offset 0 to address 10_0000h 5 <2> DOSCODE_HMA_OFFSET equ DOSCODE_HMA_start_at + 30h 6 <2> ; 50h = 20h ROM-BIOS, 20h VDISK header, 10h HMCB 15 <1> %include "entrysw.mac" 1 <2> 2 <2> DOSENTRYADJUSTSEGMENT equ 60h - 26h 3 <2> DOSENTRYADJUSTOFFSET equ DOSENTRYADJUSTSEGMENT * 16 4 <2> 5 <2> DOSENTRYDEVICEBASE equ 10h 16 <1> %include "lmacros2.mac" 1 <2> [list -] 17 <1> %include "lstruct.mac" 1 <2> [list -] 13 <2> [list -] 18 <1> ;.cref 19 <1> [list +] 20 <1> 21 <1> %ifndef Kanji 22 <1> %iassign Kanji 0 23 <1> %endif 24 <1> %ifndef Debug 25 <1> %iassign Debug 0 26 <1> %endif 27 <1> === Switch to base=002450h -> "DOSCODECODE" 28 <1> section DOSCODECODE 29 <1> 30 <1> I_need InDos,BYTE ; TRUE => we are in dos, no interrupt 31 <1> I_need OpenBuf,128 ; temp name buffer 32 <1> I_need ExtErr,WORD ; extended error code 33 <1> I_need User_SS,WORD ; stack segment from user 34 <1> I_need User_SP,WORD ; stack pointer from user 35 <1> I_need DskStack,BYTE ; stack segment inside DOS 36 <1> I_need ThisCDS,DWORD ; Currently referenced CDS pointer 37 <1> I_need ThisDPB,DWORD ; Currently referenced DPB pointer 38 <1> I_need Err_Table_21 ; allowed return map table for errors 39 <1> I_need FailErr,BYTE ; TRUE => system call is being failed 40 <1> I_need ExtErr_Action,BYTE ; recommended action 41 <1> I_need ExtErr_Class,BYTE ; error classification 42 <1> I_need ExtErr_Locus,BYTE ; error location 43 <1> I_need I21_Map_E_Tab,BYTE ; mapping extended error table 44 <1> I_need User_In_AX,WORD ; initial input user AX 45 <1> I_need FOO,WORD ; return address for dos 2f dispatch 46 <1> I_need DTAB,WORD ; dos 2f dispatch table 47 <1> I_need HIGH_SECTOR,WORD ; >32mb 48 <1> I_need IFS_DRIVER_ERR,WORD ; >32mb 49 <1> I_need FastOpenFlg,BYTE ; 50 <1> I_need FastSeekFlg,BYTE ; 51 <1> I_need CURSC_DRIVE,BYTE ; 52 <1> I_need first_hmcb, word 53 <1> === Switch to base=000E10h -> "DOSDATACODE" 54 <1> section DOSDATACODE ; in DOSDATA 55 <1> 56 <1> BREAK 57 <1> 58 <1> procedure SNULDEV,FAR 58 ****************** <1> warning: proc SNULDEV... [-w+user] 59 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00001244 26814F030001 OR word [ES:BX + REQSTAT],STDON ; Set done bit 61 <1> entry INULDEV 0 0000124A CB RET ; MUST NOT BE A RETURN! 63 <1> EndProc SNULDEV 64 <1> 65 <1> BREAK 66 <1> === Switch to base=002450h -> "DOSCODETABLE" 67 <1> section DOSCODETABLE 68 <1> Public MSC001S,MSC001E 69 <1> MSC001S label byte 70 <1> %IF IBM 71 <1> ; Codes returned by BIOS 72 <1> DOS_ERRIN: 0 00000480 02 DB 2 ; NO RESPONSE 0 00000481 06 DB 6 ; SEEK FAILURE 0 00000482 0C DB 12 ; GENERAL ERROR 0 00000483 04 DB 4 ; BAD CRC 0 00000484 08 DB 8 ; SECTOR NOT FOUND 0 00000485 00 DB 0 ; WRITE ATTEMPT ON WRITE-PROTECT DISK 79 <1> DOS_ERROUT: 80 <1> ; DISK ERRORS RETURNED FROM INT 25 and 26 0 00000486 80 DB 80H ; NO RESPONSE 0 00000487 40 DB 40H ; Seek failure 0 00000488 02 DB 2 ; Address Mark not found 0 00000489 10 DB 10H ; BAD CRC 0 0000048A 04 DB 4 ; SECTOR NOT FOUND 0 0000048B 03 DB 3 ; WRITE ATTEMPT TO WRITE-PROTECT DISK 87 <1> 88 <1> DOS_NUMERR EQU $-DOS_ERROUT 89 <1> %ENDIF 90 <1> MSC001E label byte 91 <1> 92 <1> TABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 93 <1> section DOSCODECODE 94 <1> 95 <1> ; AbsSetup - setup for abs disk functions 96 <1> 97 <1> Procedure AbsSetup,NEAR 97 ****************** <1> warning: proc AbsSetup... [-w+user] 98 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00000A05 FB STI 0 00000A06 FC CLD 0 00000A07 1E PUSH DS 0 00000A08 161F Context DS 0 00000A0A E8FD00 CALL GETBP_DOS 0 00000A0D 7206 JC errdriv ;PM. error drive ;AN000; 0 00000A0F 26C7461FFFFF MOV word [ES:BP + dpb_free_cnt],-1 ; do not trust user at all. 106 <1> errdriv: 0 00000A15 1F POP DS 108 <1> ASSUME DS:NOTHING 0 00000A16 7301C3 retc 110 <1> 0 00000A19 36C706[0000]0000 MOV word [ss:HIGH_SECTOR],0 ;>32mb from API ;AN000; 0 00000A20 E8FF03 CALL RW32_CONVERT ;>32mb convert 32bit format to 16bit ;AN000; 0 00000A23 72F3 retc 114 <1> 115 <1> %ifndef BUF2 116 <1> invoke SET_RQ_SC_PARMS ;LB. set up SC parms ;AN000; 117 <1> %endif 0 00000A25 1E PUSH DS 0 00000A26 56 PUSH SI 0 00000A27 50 PUSH AX 0 00000A28 161F Context DS 122 <1> OPENBUF equ OpenBuf ; NASM port label 0 00000A2A BE[0000] MOV SI,OFFSET OPENBUF wrt DOSGROUP 0 00000A2D 8804 MOV [SI],AL 0 00000A2F 800441 ADD BYTE PTR [SI],"A" 0 00000A32 C744013A00 MOV WORD PTR [SI+1],003AH ; ":",0 0 00000A37 B80003 MOV AX,0300H 0 00000A3A F8 CLC 0 00000A3B CD2A INT int_IBM ; Will set carry if shared 0 00000A3D 58 POP AX 0 00000A3E 5E POP SI 0 00000A3F 1F POP DS 133 <1> ASSUME DS:NOTHING 0 00000A40 73D6 retnc 0 00000A42 36C706[0000]3200 MOV word [ss:ExtErr],error_not_supported 0 00000A49 C3 return 137 <1> EndProc AbsSetup 138 <1> 139 <1> ; Interrupt 25 handler. Performs absolute disk read. 140 <1> ; Inputs: AL - 0-based drive number 141 <1> ; DS:BX point to destination buffer 142 <1> ; CX number of logical sectors to read 143 <1> ; DX starting logical sector number (0-based) 144 <1> ; Outputs: Original flags still on stack 145 <1> ; Carry set 146 <1> ; AH error from BIOS 147 <1> ; AL same as low byte of DI from INT 24 148 <1> 149 <1> relocated _i25_i26 0 00000A4A 727E jc relocatedi26 151 <1> relocated i25 152 <1> procedure ABSDRD,FAR 152 ****************** <1> warning: proc ABSDRD... [-w+user] 153 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 154 <1> 155 <1> extern doscode_getdosdata 156 <1> extern temp_var 157 <1> 0 00000A4C FA CLI 0 00000A4D 1E push ds 0 00000A4E 50 push ax 0 00000A4F E8[0000] call doscode_getdosdata 0 00000A52 8ED8 mov ds, ax 163 <1> assume ds:DOSGROUP 164 <1> INDOS equ InDos ; NASM port label 0 00000A54 FE06[0000] inc byte [INDOS] 0 00000A58 58 pop ax 0 00000A59 8F06[0000] pop word [temp_var] ; rescue user ds 168 <1> 169 <1> user_SS equ User_SS ; NASM port label 0 00000A5D 8C16[0000] MOV [user_SS],SS 171 <1> user_SP equ User_SP ; NASM port label 0 00000A61 8926[0000] MOV [user_SP],SP 173 <1> DSKSTACK equ DskStack ; NASM port label 0 00000A65 1E PUSH ds 0 00000A66 17 POP SS 0 00000A67 BC[0000] MOV SP,OFFSET DSKSTACK wrt DOSGROUP 177 <1> ASSUME SS:DOSGROUP 0 00000A6A 8E1E[0000] mov ds, word [temp_var] 179 <1> assume ds:nothing 0 00000A6E E8[0000] invoke Save_World ;>32mb save all regs ;AN000; 0 00000A71 06 PUSH ES 0 00000A72 E890FF CALL AbsSetup 0 00000A75 722A JC ILEAVE 184 <1> %ifn IBMCOPYRIGHT 185 <1> ; Here is a gross temporary fix to get around a serious design flaw in 186 <1> ; the secondary cache. The secondary cache does not check for media 187 <1> ; changed (it should). Hence, you can change disks, do an absolute 188 <1> ; read, and get data from the previous disk. To get around this, 189 <1> ; we just won't use the secondary cache for absolute disk reads. 190 <1> ; -mw 8/5/88 0 00000A77 E8[0000] EnterCrit critDisk 0 00000A7A 36C606[0000]FF MOV byte [ss:CURSC_DRIVE],-1 ; invalidate SC ;AN000; 0 00000A80 E8[0000] LeaveCrit critDisk 194 <1> %endif 0 00000A83 E8[0000] invoke DSKREAD 196 <1> TLEAVE: 0 00000A86 7419 JZ ILEAVE 198 <1> 199 <1> %IF IBM 200 <1> ; Translate the error code to ancient 1.1 codes 0 00000A88 06 PUSH ES 0 00000A89 0E PUSH CS ; => DOSCODE 0 00000A8A 07 POP ES 204 <1> assume es:DOSCODEGROUP 0 00000A8B 30E4 XOR AH,AH ; Nul error code 0 00000A8D B90600 MOV CX,DOS_NUMERR ; Number of possible error conditions 0 00000A90 BF[0000] MOV DI,OFFSET DOS_ERRIN ; Point to error conditions 0 00000A93 F2AE REPNE SCASB 0 00000A95 7504 JNZ LEAVECODE ; Not found 0 00000A97 268A6505 MOV AH,[ES:DI+DOS_NUMERR-1] ; Get translation 211 <1> LEAVECODE: 0 00000A9B 07 POP ES 213 <1> assume es:nothing 214 <1> %ENDIF 0 00000A9C 36A3[0000] MOV [ss:IFS_DRIVER_ERR],AX ;>32mb save error 0 00000AA0 F9 STC 217 <1> ILEAVE: ; ! CF has error status 0 00000AA1 07 POP ES 219 <1> assume es:nothing 0 00000AA2 E8[0000] invoke Restore_World ;>32mb ;AN000; 221 <1> assume ds:nothing, es:nothing 0 00000AA5 FA CLI 0 00000AA6 36A1[0000] MOV AX,[ss:IFS_DRIVER_ERR] ;>32mb restore error ;AN000; 0 00000AAA 1E push ds 0 00000AAB 56 push si 0 00000AAC 36C536[0000] lds si, [ss:user_SP] ; ds:si -> user stack 227 <1> assume ds:nothing 0 00000AB1 4E dec si ; ! preserce CF 0 00000AB2 4E dec si ; make space for a word on the stack 0 00000AB3 8F04 pop word [si] ; si 0 00000AB5 4E dec si 0 00000AB6 4E dec si ; ! preserve CF 0 00000AB7 8F04 pop word [si] ; ds 0 00000AB9 4E dec si 0 00000ABA 4E dec si ; ! preserve CF 0 00000ABB 8C14 mov word [si], ss ; => DOSDATA 0 00000ABD 1E push ds 0 00000ABE 17 pop ss 0 00000ABF 89F4 mov sp, si ; -> user stack (DOS ds, ds, si, ip, cs, fl) 240 <1> ASSUME SS:NOTHING 0 00000AC1 1F pop ds 242 <1> assume ds:DOSGROUP 0 00000AC2 FE0E[0000] dec byte [INDOS] ; ! preserve CF 0 00000AC6 1F pop ds ; ds first 245 <1> assume ds:nothing 0 00000AC7 5E pop si ; then si 0 00000AC8 FB STI 248 <1> 249 <1> entry doscode_retf 0 00000AC9 CB RET ; This must not be a RETURN! 251 <1> EndProc ABSDRD 252 <1> 253 <1> ; Interrupt 26 handler. Performs absolute disk write. 254 <1> ; Inputs: AL - 0-based drive number 255 <1> ; DS:BX point to source buffer 256 <1> ; CX number of logical sectors to write 257 <1> ; DX starting logical sector number (0-based) 258 <1> ; Outputs: Original flags still on stack 259 <1> ; Carry set 260 <1> ; AH error from BIOS 261 <1> ; AL same as low byte of DI from INT 24 262 <1> 263 <1> relocated i26 264 <1> procedure ABSDWRT,FAR 264 ****************** <1> warning: proc ABSDWRT... [-w+user] 265 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 266 <1> 0 00000ACA FA CLI 0 00000ACB 1E push ds 0 00000ACC 50 push ax 0 00000ACD E8[0000] call doscode_getdosdata 0 00000AD0 8ED8 mov ds, ax 272 <1> assume ds:DOSGROUP 0 00000AD2 FE06[0000] inc byte [INDOS] 0 00000AD6 58 pop ax 0 00000AD7 8F06[0000] pop word [temp_var] ; rescue user ds 276 <1> 0 00000ADB 8C16[0000] MOV [user_SS],SS 0 00000ADF 8926[0000] MOV [user_SP],SP 0 00000AE3 1E PUSH ds 0 00000AE4 17 POP SS 0 00000AE5 BC[0000] MOV SP,OFFSET DSKSTACK wrt DOSGROUP 282 <1> ASSUME SS:DOSGROUP 0 00000AE8 8E1E[0000] mov ds, word [temp_var] 284 <1> assume ds:nothing 0 00000AEC E8[0000] invoke Save_World ;>32mb save all regs ;AN000; 0 00000AEF 06 PUSH ES 0 00000AF0 E812FF CALL AbsSetup 0 00000AF3 72AC JC ILEAVE 289 <1> 0 00000AF5 E8[0000] EnterCrit critDisk 0 00000AF8 36C606[0000]FF MOV byte [ss:CURSC_DRIVE],-1 ; invalidate SC ;AN000; 0 00000AFE E85B03 CALL Fastxxx_Purge ; purge fatopen ;AN000; 0 00000B01 E8[0000] LeaveCrit critDisk 294 <1> 0 00000B04 E8[0000] invoke DSKWRITE 0 00000B07 E97CFF JMP TLEAVE 297 <1> EndProc ABSDWRT 298 <1> 299 <1> ; Inputs: 300 <1> ; AL = Logical unit number (A = 0) 301 <1> ; Function: 302 <1> ; Find Drive Parameter Block 303 <1> ; Outputs: 304 <1> ; ES:BP points to DPB 305 <1> ; [THISDPB] = ES:BP 306 <1> ; Carry set if unit number bad or unit is a NET device. 307 <1> ; Later case sets extended error error_I24_not_supported 308 <1> ; No other registers altered 309 <1> 310 <1> Procedure GETBP_DOS,NEAR 310 ****************** <1> warning: proc GETBP_DOS... [-w+user] 311 <1> DOSAssume CS,,"GetBP_DOS" 312 <1> ASSUME ES:NOTHING 313 <1> 0 00000B0A 50 PUSH AX 0 00000B0B 0401 ADD AL,1 ; No increment; need carry flag 0 00000B0D 7216 JC SkipGet 0 00000B0F E8[0000] invoke GetThisDrv 0 00000B12 7311 JNC SkipGet ;PM. good drive ;AN000; 0 00000B14 30E4 XOR AH,AH ;DCR. ax= error code ;AN000; 320 <1> error_not_dos_disk equ error_not_DOS_disk ; NASM port equate 0 00000B16 83F81A CMP AX,error_not_dos_disk ;DCR. is unknown media ? ;AN000; 0 00000B19 740A JZ SkipGet ;DCR. yes, let it go ;AN000; 0 00000B1B F9 STC ;DCR. ;AN000; 0 00000B1C A3[0000] MOV [ExtErr],AX ;PM. invalid drive or Non DOS drive ;AN000; 0 00000B1F C706[0000]0102 MOV word [IFS_DRIVER_ERR],0201H ;PM. other errors/unknown unit ;AN000; 326 <1> SkipGet: 0 00000B25 58 POP AX 0 00000B26 7301C3 retc 329 <1> THISCDS equ ThisCDS ; NASM port label 0 00000B29 C42E[0000] LES BP,[THISCDS] 0 00000B2D 26F746430080 TEST word [ES:BP + curdir_flags],curdir_isnet ; Clears carry 0 00000B33 7418 JZ GETBP_CDS 0 00000B35 26C46E52 LES BP,[ES:BP + curdir_ifs_hdr] ;IFS. if remote file ;AN000; 334 <1> ifs_attribute equ IFS_ATTRIBUTE ; NASM port label 0 00000B39 26F7460C0008 TEST word [ES:BP + ifs_attribute],IFSREMOTE ;IFS. ;AN000; 0 00000B3F C42E[0000] LES BP,[THISCDS] 0 00000B43 7408 JZ GETBP_CDS ;IFS. then error ;AN000; 0 00000B45 C706[0000]3200 MOV word [ExtErr],error_not_supported 0 00000B4B F9 STC 0 00000B4C C3 return 341 <1> 342 <1> GETBP_CDS: 0 00000B4D 26C46E45 LES BP,[ES:BP + curdir_devptr] 344 <1> 345 <1> entry GOTDPB 346 <1> DOSAssume CS,,"GotDPB" 347 <1> ; Load THISDPB from ES:BP 348 <1> 349 <1> THISDPB equ ThisDPB ; NASM port label 0 00000B51 892E[0000] MOV WORD PTR [THISDPB],BP 0 00000B55 8C06[0200] MOV WORD PTR [THISDPB+2],ES 0 00000B59 C3 return 353 <1> EndProc GetBP_DOS 354 <1> 355 <1> BREAK 356 <1> 357 <1> assume nocheck, ss:DOSGROUP 358 <1> 359 <1> ; 360 <1> ; These are the general system call exit mechanisms. All internal system 361 <1> ; calls will transfer (jump) to one of these at the end. Their sole purpose 362 <1> ; is to set the user's flags and set his AX register for return. 363 <1> ; 364 <1> 365 <1> procedure SYS_RETURN,NEAR 365 ****************** <1> warning: proc SYS_RETURN... [-w+user] 366 <1> ASSUME DS:NOTHING,ES:NOTHING 367 <1> entry SYS_RET_OK 0 00000B5A E8[0000] invoke FETCHI_CHECK ; TAG checking for FETCHI 0 00000B5D E8[0000] invoke get_user_stack 0 00000B60 836416FE AND word [SI + user_F],~ f_Carry ; turn off user's carry flag 0 00000B64 EB10 JMP SHORT DO_RET ; carry is now clear 372 <1> 373 <1> entry SYS_RET_ERR 0 00000B66 30E4 XOR AH,AH ; hack to allow for smaller error rets 0 00000B68 E86C00 invoke ETAB_LK ; Make sure code is OK, EXTERR gets set 376 <1> ErrorMap equ errorMap ; NASM port label 0 00000B6B E81A00 CALL ErrorMap 378 <1> entry From_GetSet 0 00000B6E E8[0000] invoke get_user_stack 0 00000B71 834C1601 OR word [SI + user_F],f_Carry ; signal carry to user 0 00000B75 F9 STC ; also, signal internal error 382 <1> DO_RET: 0 00000B76 8904 MOV [SI + user_AX],AX ; Really only sets AH 0 00000B78 C3 return 385 <1> 386 <1> entry FCB_RET_OK 387 <1> entry CPMFunc 0 00000B79 30C0 XOR AL,AL 0 00000B7B C3 return 390 <1> 391 <1> entry FCB_RET_ERR 0 00000B7C 30E4 XOR AH,AH 393 <1> exterr equ ExtErr ; NASM port label 0 00000B7E 36A3[0000] mov [ss:exterr],AX 0 00000B82 E80300 CALL ErrorMap 0 00000B85 B0FF MOV AL,-1 0 00000B87 C3 return 398 <1> 399 <1> entry errorMap 0 00000B88 56 PUSH SI 401 <1> ERR_TABLE_21 equ Err_Table_21 ; NASM port label 0 00000B89 BE[0000] MOV SI,OFFSET ERR_TABLE_21 wrt DOSGROUP 403 <1> FAILERR equ FailErr ; NASM port label 0 00000B8C 36803E[0000]00 CMP byte [ss:FAILERR],0 ; Check for SPECIAL case. 0 00000B92 740A JZ EXTENDED_NORMAL ; All is OK. 406 <1> EXTERR equ ExtErr ; NASM port label 0 00000B94 36C706[0000]5300 MOV word [ss:EXTERR],error_FAIL_I24 ; Ooops, this is the REAL reason 0 00000B9B BE[0000] MOV SI,OFFSET ERR_TABLE_21 wrt DOSGROUP 409 <1> EXTENDED_NORMAL: 0 00000B9E E80200 invoke CAL_LK ; Set CLASS,ACTION,LOCUS for EXTERR 0 00000BA1 5E POP SI 0 00000BA2 C3 return 413 <1> 414 <1> EndProc SYS_RETURN 415 <1> 416 <1> ; Inputs: 417 <1> ; SI is OFFSET in DOSGROUP of CLASS,ACTION,LOCUS Table to use 418 <1> ; (DS NEED not be DOSGROUP) 419 <1> ; [EXTERR] is set with error 420 <1> ; Function: 421 <1> ; Look up and set CLASS ACTION and LOCUS values for GetExtendedError 422 <1> ; Outputs: 423 <1> ; [EXTERR_CLASS] set 424 <1> ; [EXTERR_ACTION] set 425 <1> ; [EXTERR_LOCUS] set (EXCEPT on certain errors as determined by table) 426 <1> ; Destroys SI, FLAGS 427 <1> 428 <1> procedure CAL_LK,NEAR 428 ****************** <1> warning: proc CAL_LK... [-w+user] 429 <1> ASSUME DS:NOTHING,ES:NOTHING 430 <1> 0 00000BA3 1E PUSH DS 0 00000BA4 50 PUSH AX 0 00000BA5 53 PUSH BX 0 00000BA6 161F Context DS ; DS:SI -> Table 0 00000BA8 8B1E[0000] MOV BX,[EXTERR] ; Get error in BL 436 <1> TABLK1: 0 00000BAC AC LODSB 0 00000BAD 3CFF CMP AL,0FFH 0 00000BAF 7409 JZ GOT_VALS ; End of table 0 00000BB1 38D8 CMP AL,BL 0 00000BB3 7405 JZ GOT_VALS ; Got entry 0 00000BB5 83C603 ADD SI,3 ; Next table entry 0 00000BB8 EBF2 JMP TABLK1 444 <1> 445 <1> GOT_VALS: 0 00000BBA AD LODSW ; AL is CLASS, AH is ACTION 0 00000BBB 80FCFF CMP AH,0FFH 0 00000BBE 7404 JZ NO_SET_ACT 449 <1> EXTERR_ACTION equ ExtErr_Action ; NASM port label 0 00000BC0 8826[0000] MOV [EXTERR_ACTION],AH ; Set ACTION 451 <1> NO_SET_ACT: 0 00000BC4 3CFF CMP AL,0FFH 0 00000BC6 7403 JZ NO_SET_CLS 454 <1> EXTERR_CLASS equ ExtErr_Class ; NASM port label 0 00000BC8 A2[0000] MOV [EXTERR_CLASS],AL ; Set CLASS 456 <1> NO_SET_CLS: 0 00000BCB AC LODSB ; Get LOCUS 0 00000BCC 3CFF CMP AL,0FFH 0 00000BCE 7403 JZ NO_SET_LOC 460 <1> EXTERR_LOCUS equ ExtErr_Locus ; NASM port label 0 00000BD0 A2[0000] MOV [EXTERR_LOCUS],AL 462 <1> NO_SET_LOC: 0 00000BD3 5B POP BX 0 00000BD4 58 POP AX 0 00000BD5 1F POP DS 466 <1> assume ds:nothing 0 00000BD6 C3 return 468 <1> EndProc CAL_LK 469 <1> 470 <1> ; Inputs: 471 <1> ; AX is error code 472 <1> ; [USER_IN_AX] has AH value of system call involved 473 <1> ; Function: 474 <1> ; Make sure error code is appropriate to this call. 475 <1> ; Outputs: 476 <1> ; AX MAY be mapped error code 477 <1> ; [EXTERR] = Input AX 478 <1> ; Destroys ONLY AX and FLAGS 479 <1> 480 <1> procedure ETAB_LK,NEAR 480 ****************** <1> warning: proc ETAB_LK... [-w+user] 481 <1> ASSUME DS:NOTHING,ES:NOTHING 482 <1> 0 00000BD7 1E PUSH DS 0 00000BD8 56 PUSH SI 0 00000BD9 51 PUSH CX 0 00000BDA 53 PUSH BX 0 00000BDB 161F Context DS 0 00000BDD A3[0000] MOV [EXTERR],AX ; Set EXTERR with "real" error 489 <1> I21_MAP_E_TAB equ I21_Map_E_Tab ; NASM port label 0 00000BE0 BE[0000] MOV SI,OFFSET I21_MAP_E_TAB 0 00000BE3 88C7 MOV BH,AL ; Real code to BH 492 <1> USER_IN_AX equ User_In_AX ; NASM port label 0 00000BE5 8A1E[0100] MOV BL,BYTE PTR [USER_IN_AX + 1] ; Sys call to BL 494 <1> TABLK2: 0 00000BE9 2EAD cs LODSW 0 00000BEB 3CFF CMP AL,0FFH ; End of table? 0 00000BED 740C JZ NOT_IN_TABLE ; Yes 0 00000BEF 38D8 CMP AL,BL ; Found call? 0 00000BF1 740C JZ GOT_CALL ; Yes 0 00000BF3 86E0 XCHG AH,AL ; Count to AL 0 00000BF5 30E4 XOR AH,AH ; Make word for add 0 00000BF7 01C6 ADD SI,AX ; Next table entry 0 00000BF9 EBEE JMP TABLK2 504 <1> 505 <1> NOT_IN_TABLE: 0 00000BFB 88F8 MOV AL,BH ; Restore original code 0 00000BFD EB0C JMP SHORT NO_MAP 508 <1> 509 <1> GOT_CALL: 0 00000BFF 88E1 MOV CL,AH 0 00000C01 30ED XOR CH,CH ; Count of valid err codes to CX 512 <1> CHECK_CODE: 0 00000C03 2EAC cs LODSB 0 00000C05 38F8 CMP AL,BH ; Code OK? 0 00000C07 7402 JZ NO_MAP ; Yes 0 00000C09 E2F8 LOOP CHECK_CODE 517 <1> NO_MAP: 0 00000C0B 30E4 XOR AH,AH ; AX is now valid code 0 00000C0D 5B POP BX 0 00000C0E 59 POP CX 0 00000C0F 5E POP SI 0 00000C10 1F POP DS 523 <1> assume ds:nothing 0 00000C11 C3 return 525 <1> 526 <1> EndProc ETAB_LK 527 <1> 528 <1> BREAK 529 <1> 530 <1> %IF installed 531 <1> 532 <1> ; 533 <1> ; SetBad sets up info for bad functions 534 <1> ; 535 <1> Procedure SetBad,NEAR 535 ****************** <1> warning: proc SetBad... [-w+user] 536 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00000C12 E8[0000] call doscode_getdosdata 0 00000C15 1E push ds 0 00000C16 8ED8 mov ds, ax 540 <1> assume ds:DOSGROUP 541 <1> ExtErr_LOCUS equ ExtErr_Locus ; NASM port label 542 <1> errLoc_UNK equ errLOC_Unk ; NASM port equate 0 00000C18 C606[0000]01 MOV byte [ExtErr_LOCUS],errLoc_UNK 0 00000C1D 1F pop ds 545 <1> assume ds:nothing 546 <1> set_ax_1_CY: 0 00000C1E B80100 MOV AX,error_invalid_function ; ALL NET REQUESTS get inv func 0 00000C21 F9 STC 0 00000C22 C3 ret 550 <1> EndProc SetBad 551 <1> ; 552 <1> ; BadCall is the initial routine for bad function calls 553 <1> ; 554 <1> relocated badcallentry 555 <1> procedure BadCall,FAR 555 ****************** <1> warning: proc BadCall... [-w+user] 0 00000C23 E8ECFF call SetBad 0 00000C26 CB ret 558 <1> EndProc BadCall 559 <1> ; 560 <1> ; OKCall always sets carry to off. 561 <1> ; 562 <1> relocated okcallentry 563 <1> Procedure OKCall,FAR 563 ****************** <1> warning: proc OKCall... [-w+user] 564 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00000C27 F8 CLC 0 00000C28 CB ret 567 <1> EndProc OKCall 568 <1> 569 <1> ; INT 2F handler works as follows: 570 <1> ; PUSH AX 571 <1> ; MOV AX,multiplex:function 572 <1> ; INT 2F 573 <1> ; POP ... 574 <1> ; The handler itself needs to make the AX available for the various routines. 575 <1> 576 <1> relocated msdos_i2F 577 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00000C29 FB STI 579 <1> multNET equ MultNET ; NASM port equate 0 00000C2A 80FC11 CMP AH,multNET 0 00000C2D 751C JNZ INT2FSHR 582 <1> TestInstall: ; used for 2F.11, 2F.10, 2F.14 0 00000C2F 84C0 test AL,AL ; (NC) 0 00000C31 7403 JZ Leave2F ; subfunction 00 --> return NC, ax unmodified 585 <1> BadFunc: 0 00000C33 E8DCFF CALL SetBad ; other subfunction, return CY ax = 1 587 <1> 588 <1> entry Leave13 ; for msbio/ms96tpi.nas and msbio/msdisk.nas 589 <1> entry Leave2F 0 00000C36 55 push bp 0 00000C37 89E5 mov bp, sp 0 00000C39 50 push ax 0 00000C3A 9F lahf 594 <1> ; bp + 0 = saved bp 595 <1> ; bp + 2 = ip 596 <1> ; bp + 4 = cs 597 <1> ; bp + 6 = fl 0 00000C3B 886606 mov byte [bp + 6], ah 0 00000C3E 58 pop ax 0 00000C3F 5D pop bp 0 00000C40 CF iret 602 <1> 603 <1> extern relocatedi6C 604 <1> relocated _i31_i6C 0 00000C41 7303E9[0000] jc relocatedi6C 606 <1> relocated i31 0 00000C46 E8D5FF call set_ax_1_CY 0 00000C49 EBEB jmp Leave2F 609 <1> 610 <1> INT2FSHR: 611 <1> multSHARE equ MultSHARE ; NASM port equate 0 00000C4B 80FC10 CMP AH,multSHARE ; is this a share request 0 00000C4E 74DF JZ TestInstall ; yes, check for installation 614 <1> 615 <1> INT2FNLS: 0 00000C50 80FC14 CMP AH,NLSFUNC ; is this a DOS 3.3 NLSFUNC request 0 00000C53 74DA JZ TestInstall ; yes check for installation 618 <1> 619 <1> INT2FDOS: 620 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 621 <1> multDOS equ MultDOS ; NASM port equate 0 00000C55 80FC12 CMP AH,multDOS 0 00000C58 7406 JZ DispatchDOS 0 00000C5A 80FC4A cmp ah, 4Ah 0 00000C5D 7428 je hma_access 0 00000C5F CF IRET ; This assumes that we are at the head 627 <1> ; of the list (there is no downlink). 628 <1> 629 <1> DispatchDOS: 0 00000C60 3C61 cmp al, 61h 0 00000C62 7417 je get_first_umcb ; (NC) 0 00000C64 2EFF36[0000] PUSH word [cs:FOO] ; push return address 633 <1> DTab equ DTAB ; NASM port label 0 00000C69 2EFF36[0000] PUSH word [cs:DTab] ; push table address 0 00000C6E 50 PUSH AX ; push index 0 00000C6F 55 PUSH BP 0 00000C70 89E5 MOV BP,SP 638 <1> ; stack looks like: 639 <1> ; 0 BP 640 <1> ; 2 DISPATCH 641 <1> ; 4 TABLE 642 <1> ; 6 RETURN 643 <1> ; 8 LONG-RETURN 644 <1> ; c FLAGS 645 <1> ; e AX 646 <1> 0 00000C72 8B460E MOV AX,[BP+0Eh] ; get AX value 0 00000C75 5D POP BP 0 00000C76 E8[0000] Invoke TableDispatch 0 00000C79 EBB8 JMP BadFunc ; return indicates invalid function 651 <1> 652 <1> Procedure INT2F_etcetera,NEAR 652 ****************** <1> warning: proc INT2F_etcetera... [-w+user] 653 <1> 654 <1> extern first_umcb 655 <1> 656 <1> get_first_umcb: ; (NC) 0 00000C7B E8[0000] call doscode_getdosdata 0 00000C7E 1E push ds 0 00000C7F 8ED8 mov ds, ax 660 <1> assume ds:DOSGROUP 0 00000C81 A1[0000] mov ax, [first_umcb] 0 00000C84 1F pop ds 663 <1> assume ds:nothing 0 00000C85 EBAF jmp Leave2F 665 <1> 666 <1> 667 <1> hma_access: 668 <1> assume ds:nothing, es:nothing 0 00000C87 3C01 cmp al, 1 0 00000C89 721C jb .iret 0 00000C8B 741B je .query 0 00000C8D 3C04 cmp al, 4 0 00000C8F 721B jb .access 0 00000C91 7514 jne .iret 675 <1> ; je .get_first_hmcb 676 <1> 677 <1> .get_first_hmcb: 0 00000C93 1E push ds 0 00000C94 53 push bx 0 00000C95 57 push di 0 00000C96 50 push ax 0 00000C97 E86101 call getfirsthmcb 683 <1> assume ds:nothing 684 <1> ; OUT: ds = FFFFh 685 <1> ; bx = 0 686 <1> ; NC if DOS manages the HMA, 687 <1> ; ds:di -> first HMCB, allocated to DOS (owner = -2) 688 <1> ; A20 is assumed on because our cs is in the HMA 689 <1> ; CHG: ds, di, bx, ax 0 00000C9A 7207 jc @F 0 00000C9C 31C0 xor ax, ax ; ax = 0 0 00000C9E 1E push ds 0 00000C9F 07 pop es ; es:di -> first HMCB 694 <1> assume es:nothing 0 00000CA0 5B pop bx ; discard ax 0 00000CA1 5B pop bx ; discard di 0 00000CA2 A9 db __TEST_IMM16 ; (skip pop twice) 698 <1> @@: 699 <1> ; if we are not managing the HMA, return 700 <1> ; as if the function is not supported 0 00000CA3 58 pop ax ; restore ax 0 00000CA4 5F pop di ; restore di 0 00000CA5 5B pop bx ; unconditionally: restore bx, ds, iret 0 00000CA6 1F pop ds 705 <1> assume ds:nothing 706 <1> .iret: 0 00000CA7 CF iret 708 <1> 709 <1> .query: 0 00000CA8 E80E01 call find_largest_free_hmcb 0 00000CAB CF iret 712 <1> 713 <1> 714 <1> .access: 0 00000CAC 51 push cx 0 00000CAD 52 push dx 0 00000CAE 3C03 cmp al, 3 ; MS-DOS v7 style access ? 0 00000CB0 7409 je .access_new ; yes, dx and cx as passed --> 719 <1> ; MS-DOS v5 style access, allocate like dl=0 720 <1> ; with owner = int 2Fh caller cs 721 <1> .alloc_legacy: 0 00000CB2 31D2 xor dx, dx ; = function 0 (allocate low) 723 <1> lframe 0 724 <1> lpar word, iret_fl 725 <1> lpar word, iret_cs 726 <1> lpar word, iret_ip 727 <1> lpar word, cx 728 <1> lpar word, dx 0 00000CB4 5589E5 lenter 0 00000CB7 8B4E08 mov cx, word [bp + ?iret_cs] 731 <1> ; owner = int 2Fh caller's cs 0 00000CBA 5D lleave 733 <1> .access_new: 0 00000CBB 50 push ax 0 00000CBC 1E push ds 0 00000CBD 53 push bx ; must be last here ! hma_alloc modifies this 0 00000CBE 80FA02 cmp dl, 2 0 00000CC1 7478 je hma_free 0 00000CC3 720C jb hma_alloc 740 <1> ; unknown function, return bx = unchanged, es:di = all-1s 741 <1> .access_invalid: 0 00000CC5 BFFFFF mov di, -1 0 00000CC8 8EC7 mov es, di ; es:di = all-1s 744 <1> assume es:nothing 745 <1> .access_return: 0 00000CCA 5B pop bx ; must be first ! hma_alloc modifies this 0 00000CCB 1F pop ds 748 <1> assume ds:nothing 0 00000CCC 58 pop ax 0 00000CCD 5A pop dx 0 00000CCE 59 pop cx 0 00000CCF CF iret 753 <1> 754 <1> 755 <1> ; INP: dl = 0 if to allocate low 756 <1> ; dl = 1 if to allocate high 757 <1> ; dl is never >= 2 when branched here 758 <1> ; ss:sp -> bx, ds, ax, dx, cx on stack 759 <1> ; (bx must be first !) 760 <1> ; cx = owner to set (if 0, use 1) 761 <1> ; bx = size to allocate (byte granularity) 762 <1> ; OUT: es:di = all-1s if couldn't allocate, 763 <1> ; bx = unmodified 764 <1> ; es:di -> allocated data block if could allocate, 765 <1> ; bx = actually allocated size in bytes, 766 <1> ; rounded up to paragraph boundary 767 <1> ; REM: MS-DOS v7.10 returns bx unchanged if no alloc. 768 <1> @@: 0 00000CD0 41 inc cx ; cx = 1, avoid zero owner 770 <1> hma_alloc: 0 00000CD1 E3FD jcxz @B ; jump back and increment cx if it was zero --> 772 <1> 0 00000CD3 8D470F lea ax, [bx + 15] 0 00000CD6 83E0F0 and ax, ~15 ; round up to para boundary 775 <1> ; ZR if too large ! 0 00000CD9 74EA jz hma_access.access_invalid 777 <1> ; return bx = unchanged, es:di = all-1s 0 00000CDB E8DB00 call find_largest_free_hmcb 779 <1> assume es:nothing 0 00000CDE 72EA jc hma_access.access_return 781 <1> ; return bx = unchanged, es:di = all-1s 782 <1> 0 00000CE0 39D8 cmp ax, bx ; free block is large enough ? 0 00000CE2 77E1 ja hma_access.access_invalid 785 <1> ; no --> 0 00000CE4 1F pop ds ; discard bx on stack (must be first !) 787 <1> assume ds:nothing 0 00000CE5 50 push ax ; push ax instead (actual allocation size) 0 00000CE6 06 push es 0 00000CE7 1F pop ds ; => HMA, ds:di -> behind HMCB to split 791 <1> assume ds:nothing 792 <1> 0 00000CE8 56 push si 0 00000CE9 BE0000 mov si, 0 ; ! preserve flags, si = 0 795 <1> ; ds:di -> low HMCB data, 796 <1> ; size = bx + 16 >= ax + 16 797 <1> ; ax = how much to alloc 798 <1> ; bx = current data size minus 16 799 <1> ; cx = owner to set 800 <1> ; dl = function 801 <1> ; si = 0 0 00000CEC 8975F8 mov word [di - HMCB_size + hmcbName], si 0 00000CEF 8975FA mov word [di - HMCB_size + hmcbName + 2], si 0 00000CF2 8975FC mov word [di - HMCB_size + hmcbName + 4], si 0 00000CF5 8975FE mov word [di - HMCB_size + hmcbName + 6], si 806 <1> ; clear the name of low HMCB 807 <1> 0 00000CF8 7505 jne .split ; NZ if free > requested 0 00000CFA 894DF2 mov word [di - HMCB_size + hmcbOwner], cx 810 <1> ; free == requested, just allocate here 811 <1> ; sign, size, and next already set! 0 00000CFD EB39 jmp .full 813 <1> 814 <1> .split: 0 00000CFF 83EB10 sub bx, HMCB_size 0 00000D02 29C3 sub bx, ax ; bx = current size - 16 - how much to alloc 817 <1> ; = remainder size 0 00000D04 84D2 test dl, dl 0 00000D06 7504 jnz .high 820 <1> .low: 0 00000D08 93 xchg ax, bx ; bx = how much to alloc (no HMCB size) 822 <1> ; ax = remainder size 823 <1> ; di -> behind HMCB 0 00000D09 874DF2 xchg word [di - HMCB_size + hmcbOwner], cx 825 <1> ; allocate it, 826 <1> ; and load cx = 0 (owner meaning free) 827 <1> .high: 828 <1> ; if branched to .high: 829 <1> ; bx = remainder size (size for low HMCB) 830 <1> ; ax = how much to alloc (size for high HMCB) 831 <1> ; cx = owner to set (owner for high MCB) 832 <1> ; have to set es:di -> high HMCB data later 833 <1> ; else if fell through from .low: 834 <1> ; bx = how much to alloc (size for low HMCB) 835 <1> ; ax = remainder size (size for high HMCB) 836 <1> ; cx = 0 (owner for high HMCB) 837 <1> ; es:di -> low HMCB data, to allocate 838 <1> ; common: 839 <1> ; dl = mode (0 if low, 1 if high) 840 <1> ; es:di -> behind low HMCB 841 <1> ; owner of low HMCB set as desired 0 00000D0C 53 push bx ; push bx 0 00000D0D 8D19 lea bx, [di + bx] ; bx -> new (high) HMCB 0 00000D0F FF75F6 push word [di - HMCB_size + hmcbNext] 845 <1> ; get old next 0 00000D12 C7074D53 mov word [bx + hmcbSignature], "MS" 0 00000D16 894F02 mov word [bx + hmcbOwner], cx 848 <1> ; set owner (0 if low, input cx if high) 0 00000D19 894704 mov word [bx + hmcbSize], ax 850 <1> ; set size of high HMCB 0 00000D1C 8F4706 pop word [bx + hmcbNext]; set new next 0 00000D1F 897708 mov word [bx + hmcbName], si 0 00000D22 89770A mov word [bx + hmcbName + 2], si 0 00000D25 89770C mov word [bx + hmcbName + 4], si 0 00000D28 89770E mov word [bx + hmcbName + 6], si 856 <1> ; clear the name 0 00000D2B 895DF6 mov word [di - HMCB_size + hmcbNext], bx 858 <1> ; -> next (created at top of block) 0 00000D2E 8F45F4 pop word [di - HMCB_size + hmcbSize] ; but pop memory 860 <1> ; allocate size of low HMCB 0 00000D31 84D2 test dl, dl 0 00000D33 7403 jz @F 0 00000D35 8D7F10 lea di, [bx + HMCB_size]; -> top HMCB data 864 <1> @@: 865 <1> .full: 0 00000D38 5E pop si 867 <1> j_hma_access.access_return: 0 00000D39 EB8F jmp hma_access.access_return 869 <1> 870 <1> 871 <1> hma_free: 0 00000D3B 57 push di 0 00000D3C E8BC00 call getfirsthmcb 874 <1> assume ds:nothing 0 00000D3F 723B jc .none 0 00000D41 57 push di 0 00000D42 8CC7 mov di, es ; => user es 0 00000D44 4B dec bx ; = -1 0 00000D45 39DF cmp di, bx ; match ? 0 00000D47 5B pop bx 0 00000D48 7532 jne .none ; no --> 0 00000D4A 5F pop di 0 00000D4B 57 push di 0 00000D4C F7C70F00 test di, 15 ; valid HMCB ? 0 00000D50 752A jnz .none ; no --> 0 00000D52 83EF10 sub di, HMCB_size ; ds:di -> HMCB to free 0 00000D55 7625 jbe .none ; reject too low HMCB ! 0 00000D57 813D4D53 cmp word [di + hmcbSignature], "MS" 0 00000D5B 751F jne .none 0 00000D5D 39DF cmp di, bx ; is first HMCB or below ? 891 <1> ; (do not allow to free the first HMCB !) 0 00000D5F 761B jbe .none 893 <1> ; MS-DOS v7.10 has a je here to handle this 894 <1> .loop: 0 00000D61 F6C30F test bl, 15 ; valid HMCB ? 0 00000D64 7516 jnz .none ; no --> 0 00000D66 813F4D53 cmp word [bx + hmcbSignature], "MS" 0 00000D6A 7510 jne .none 0 00000D6C 8B4706 mov ax, word [bx + hmcbNext] 0 00000D6F 39F8 cmp ax, di 0 00000D71 740C je .found_below 0 00000D73 39D8 cmp ax, bx ; next > current ? 0 00000D75 7605 jbe .none ; no --> 0 00000D77 85C0 test ax, ax 0 00000D79 93 xchg bx, ax ; bx -> next HMCB 0 00000D7A 75E5 jnz .loop 907 <1> .none: 908 <1> .done: 0 00000D7C 5F pop di 0 00000D7D EBBA jmp j_hma_access.access_return 911 <1> 912 <1> .found_below: 0 00000D7F 83650200 and word [di + hmcbOwner], 0 914 <1> ; mark input HMCB as free 0 00000D83 837F0200 cmp word [bx + hmcbOwner], 0 916 <1> ; is prior free ? 0 00000D87 7502 jne .merge_di_to_next ; no, merge di and subsequent --> 0 00000D89 89DF mov di, bx ; yes, set di from bx and merge subsequent 919 <1> ; (the first iteration will merge input HMCB) 920 <1> .merge_di_to_next: 0 00000D8B 8B5D06 mov bx, [di + hmcbNext] ; -> next 0 00000D8E 85DB test bx, bx ; any next ? 0 00000D90 74EA jz .done ; no, all free ones merged --> 0 00000D92 F6C30F test bl, 15 ; validity 0 00000D95 75E5 jnz .none 0 00000D97 39FB cmp bx, di ; validity 0 00000D99 76E1 jbe .none 0 00000D9B 813F4D53 cmp word [bx + hmcbSignature], "MS" 929 <1> ; validity 0 00000D9F 75DB jne .none 0 00000DA1 837F0200 cmp word [bx + hmcbOwner], 0 932 <1> ; is next also free ? 0 00000DA5 75D5 jne .done ; no, all free ones merged --> 0 00000DA7 8B4704 mov ax, [bx + hmcbSize] 0 00000DAA 83C010 add ax, HMCB_size ; = size to add to prior HMCB 0 00000DAD 014504 add word [di + hmcbSize], ax 937 <1> ; add to first free HMCB in chain 0 00000DB0 014506 add word [di + hmcbNext], ax 939 <1> ; add, may carry 0 00000DB3 73D6 jnc .merge_di_to_next ; valid next offset --> 0 00000DB5 74D4 jz .merge_di_to_next ; valid end of chain indicator --> 0 00000DB7 EBC3 jmp .none ; error 943 <1> 944 <1> 945 <1> ; OUT: CY if not managing HMA, 946 <1> ; or <= 16 bytes free, 947 <1> ; or HMCB chain corrupted, 948 <1> ; es:di = FFFFh:FFFFh 949 <1> ; bx = 0 950 <1> ; NC if found >= 16 bytes free, 951 <1> ; es:di -> largest free memory block 952 <1> ; bx = size of block available 953 <1> ; REM: The size returned for MS-DOS v7 is the HMCB memory 954 <1> ; block size minus 16 to allow an optimisation when 955 <1> ; allocating, which is that a new HMCB is always 956 <1> ; created. Unlike that, MS-DOS v5 returns a size 957 <1> ; which spans the entire trailing space up to below 958 <1> ; FFFFh:10000h. lDOS is now reverted to v5 style, 959 <1> ; meaning the full HMCB block size is returned. 960 <1> ; Unlike v5, the free block may still occur in the 961 <1> ; middle of the HMA (not at the very tail) though. 962 <1> ; REM: The returned memory block is the largest free block. 963 <1> ; If multiple free blocks are of the same size, 964 <1> ; the first one is returned. 965 <1> ; CHG: - 966 <1> find_largest_free_hmcb: 0 00000DB9 50 push ax 0 00000DBA 1E push ds 0 00000DBB 51 push cx 0 00000DBC E83C00 call getfirsthmcb 971 <1> assume ds:nothing 0 00000DBF 722F jc .error 973 <1> .loop: 0 00000DC1 F7C70F00 test di, 15 ; valid HMCB ? 0 00000DC5 7529 jnz .error ; no --> 0 00000DC7 813D4D53 cmp word [di + hmcbSignature], "MS" 0 00000DCB 7523 jne .error ; no --> 0 00000DCD 837D0200 cmp word [di + hmcbOwner], 0 0 00000DD1 750B jne .next 0 00000DD3 395D04 cmp word [di + hmcbSize], bx 0 00000DD6 7606 jbe .next 0 00000DD8 8D4510 lea ax, [di + HMCB_size]; -> memory block 0 00000DDB 8B5D04 mov bx, word [di + hmcbSize] 984 <1> .next: 0 00000DDE 8B4D06 mov cx, word [di + hmcbNext] 986 <1> ; cx -> next 0 00000DE1 E308 jcxz .end ; was last ? --> 0 00000DE3 39F9 cmp cx, di ; valid next offset ? 0 00000DE5 7609 jbe .error ; not valid --> 0 00000DE7 89CF mov di, cx ; -> next 0 00000DE9 EBD6 jmp .loop ; go loop 992 <1> .end: 0 00000DEB 97 xchg di, ax ; di -> largest first free HMA memory block 0 00000DEC 85DB test bx, bx ; (NC) 0 00000DEE 7505 jnz .done 996 <1> .error: 0 00000DF0 31DB xor bx, bx ; bx = 0 0 00000DF2 8CDF mov di, ds ; es:di will be all-1s 0 00000DF4 F9 stc ; signal error 1000 <1> .done: 0 00000DF5 1E push ds 0 00000DF6 07 pop es 1003 <1> assume es:nothing 0 00000DF7 59 pop cx 0 00000DF8 1F pop ds 1006 <1> assume ds:nothing 0 00000DF9 58 pop ax 0 00000DFA C3 retn 1009 <1> 1010 <1> 1011 <1> ; INP: word [DOSDATA:first_hmcb] set 1012 <1> ; and cs == DOSCODE_HMA_SEGMENT 1013 <1> ; if DOS manages the HMA 1014 <1> ; OUT: ds = FFFFh 1015 <1> ; bx = 0 1016 <1> ; NC if DOS manages the HMA, 1017 <1> ; ds:di -> first HMCB, allocated to DOS (owner = -2) 1018 <1> ; A20 is assumed on because our cs is in the HMA 1019 <1> ; CHG: ds, di, bx, ax 1020 <1> getfirsthmcb: 0 00000DFB E8[0000] call doscode_getdosdata 0 00000DFE 8ED8 mov ds, ax ; => DOSDATA 1023 <1> assume ds:DOSGROUP 0 00000E00 8CCF mov di, cs ; => DOSCODE 0 00000E02 B8FEFF mov ax, DOSCODE_HMA_SEGMENT 1026 <1> ; expected DOSCODE segment 0 00000E05 39C7 cmp di, ax ; is it ? 0 00000E07 8B3E[0000] mov di, [first_hmcb] ; ds:di -> first HMCB, if any 0 00000E0B BBFFFF mov bx, -1 0 00000E0E 8EDB mov ds, bx ; => HMA 1031 <1> assume ds:nothing 0 00000E10 43 inc bx ; = 0, preserve CF ! 0 00000E11 7203 jb @F ; if not managing HMA --> 0 00000E13 394502 cmp word [di + hmcbOwner], ax 1035 <1> ; NC (ae) if valid, CY (b) if invalid 1036 <1> @@: 0 00000E16 C3 retn ; CY if DOS is not in the HMA 1038 <1> 1039 <1> 1040 <1> entry DosGetGroup 1041 <1> assume ds:nothing 0 00000E17 50 push ax 0 00000E18 E8[0000] call doscode_getdosdata 0 00000E1B 8ED8 mov ds, ax 1045 <1> assume ds:DOSGROUP 0 00000E1D 58 pop ax 0 00000E1E C3 return 1048 <1> 1049 <1> entry DOSInstall 1050 <1> assume ds:nothing 0 00000E1F B0FF MOV AL,0FFh 0 00000E21 C3 return 1053 <1> EndProc INT2F_etcetera 1054 <1> 1055 <1> %ENDIF 1056 <1> ;Input: same as ABSDRD and ABSDWRT 1057 <1> ; ES:BP -> DPB 1058 <1> ;Functions: convert 32bit absolute RW input parms to 16bit input parms 1059 <1> ;Output: carry set when CX != -1 and drive is more than 32mb 1060 <1> ; carry clear, parms ok 1061 <1> ; 1062 <1> Procedure RW32_CONVERT,NEAR 1062 ****************** <1> warning: proc RW32_CONVERT... [-w+user] 1063 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00000E22 83F9FF CMP CX,-1 ;>32mb new format ? ;AN000; 0 00000E25 7423 JZ new32format ;>32mb yes ;AN000; 0 00000E27 50 PUSH AX ;>32mb save ax ;AN000; 0 00000E28 52 PUSH DX ;>32mb save dx ;AN000; 0 00000E29 268B460D MOV AX,[ES:BP + dpb_max_cluster] ;>32mb get max cluster # ;AN000; 0 00000E2D 268A5604 MOV DL,[ES:BP + dpb_cluster_mask] ;>32mb ;AN000; 1070 <1> ; lDOS note: very suspicious, test intended ? 0 00000E31 80FAFE CMP DL,0FEH ;>32mb removable ? ;AN000; 0 00000E34 7407 JZ letold ;>32mb yes ;AN000; 0 00000E36 B600 mov dh, 0 0 00000E38 42 inc dx ; sectors per cluster 0 00000E39 F7E2 MUL DX ;>32mb dx:ax= max sector # ;AN000; 0 00000E3B 85D2 test DX,DX ;>32mb > 32mb ? ;AN000; 1077 <1> letold: 0 00000E3D 5A POP DX ;>32mb retore dx ;AN000; 0 00000E3E 58 POP AX ;>32mb restore ax ;AN000; 0 00000E3F 7419 JZ old_style ;>32mb no ;AN000; 0 00000E41 36C706[0000]0702 MOV word [ss:IFS_DRIVER_ERR],0207H ;>32mb error ;AN000; 0 00000E48 F9 STC ;>32mb ;AN000; 0 00000E49 C3 return ;>32mb ;AN000; 1084 <1> new32format: 0 00000E4A 8B5702 MOV DX,WORD PTR [BX + SECTOR_RBA+2];>32mb ;AN000; 0 00000E4D 368916[0000] MOV [ss:HIGH_SECTOR],DX ;>32mb ;AN000; 0 00000E52 8B17 MOV DX,WORD PTR [BX + SECTOR_RBA] ;>32mb ;AN000; 0 00000E54 8B4F04 MOV CX,[BX + ABS_RW_COUNT] ;>32mb ;AN000; 0 00000E57 C55F06 LDS BX,[BX + BUFFER_ADDR] ;>32mb ;AN000; 1090 <1> old_style: ;>32mb ;AN000; 0 00000E5A F8 CLC ;>32mb ;AN000; 0 00000E5B C3 return ;>32mb ;AN000; 1093 <1> EndProc RW32_CONVERT 1094 <1> 1095 <1> 1096 <1> ;Input: None 1097 <1> ;Functions: Purge Fastopen/seek Cache Buffers 1098 <1> ;Output: None 1099 <1> ; 1100 <1> ; 1101 <1> Procedure Fastxxx_Purge,NEAR 1101 ****************** <1> warning: proc Fastxxx_Purge... [-w+user] 1102 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00000E5C 50 PUSH AX ; save regs. ;AN000; 0 00000E5D 56 PUSH SI ;AN000; 0 00000E5E 52 PUSH DX ;AN000; 1106 <1> FastSeekflg equ FastSeekFlg ; NASM port label 0 00000E5F 36F606[0000]80 TEST byte [ss:FastSeekflg],Fast_yes ; fastseek installed ? ;AN000; 0 00000E65 7404 JZ topen ; no ;AN000; 0 00000E67 B402 MOV AH,FastSeek_ID ; set fastseek id ;AN000; 0 00000E69 EB0A JMP SHORT dofast ; ;AN000; 1111 <1> topen: 1112 <1> FastOpenflg equ FastOpenFlg ; NASM port label 0 00000E6B 36F606[0000]80 TEST byte [ss:FastOpenflg],Fast_yes ; fastopen installed ? ;AN000; 0 00000E71 740B JZ nofast ; no ;AN000; 0 00000E73 B401 MOV AH,FastOpen_ID ; set fastseek installed ;AN000; 1116 <1> dofast: 0 00000E75 B005 MOV AL,FONC_purge ; purge ;AN000; 0 00000E77 268A5600 MOV DL,[ES:BP + dpb_drive] ; set up drive number ;AN000; 0 00000E7B E8[0000] invoke Fast_Dispatch ; call fastopen/seek ;AN000; 1120 <1> nofast: 0 00000E7E 5A POP DX ;AN000; 0 00000E7F 5E POP SI ; restore regs ;AN000; 0 00000E80 58 POP AX ; ;AN000; 1124 <1> 0 00000E81 C3 return ; exit ;AN000; 1126 <1> EndProc Fastxxx_Purge 1127 <1> 1128 <1> 1129 <1> extern amis_intlist, amis_sign 1130 <1> ; INP: ah = our multiplex number (others don't go here) 1131 <1> ; al = function number 1132 <1> ; ss:sp -> iret stack frame 1133 <1> relocated i2D 1134 <1> assume ds:nothing, es:nothing, ss:nothing 0 00000E82 3C00 cmp al, 0 0 00000E84 7413 je .installationcheck 1137 <1> ; function 1: private entrypoint, not supported 1138 <1> ; function 2: uninstall, not supported 1139 <1> ; function 3: request pop-up, not supported 0 00000E86 3C04 cmp al, 4 0 00000E88 741B je .determineinterrupts 1142 <1> ; function 5: get hotkeys, not supported 0 00000E8A 3C06 cmp al, 6 0 00000E8C 7422 je .getdevice 0 00000E8E 3C10 cmp al, 10h 0 00000E90 7418 je .getver 0 00000E92 3C11 cmp al, 11h 0 00000E94 7424 je checkid 0 00000E96 B000 mov al, 0 0 00000E98 CF iret 1151 <1> 1152 <1> .installationcheck: 0 00000E99 B0FF mov al, 0FFh 0 00000E9B B92605 mov cx, 500h + 38 ; version number 0 00000E9E BF[A003] mov di, amis_sign + DOSENTRYADJUSTOFFSET 1156 <1> .iret_dx_seg: 0 00000EA1 BA[0000] mov dx, DOSENTRY - DOSENTRYADJUSTSEGMENT 0 00000EA4 CF iret 1159 <1> 1160 <1> .determineinterrupts: 0 00000EA5 BB[A003] mov bx, amis_intlist + DOSENTRYADJUSTOFFSET 0 00000EA8 EBF7 jmp .iret_dx_seg 1163 <1> 1164 <1> .getver: 0 00000EAA B0FF mov al, 0FFh 0 00000EAC B91A05 mov cx, 500h + 26 0 00000EAF CF iret 1168 <1> 1169 <1> extern CONHEADER 1170 <1> .getdevice: 0 00000EB0 B80C00 mov ax, 12 1172 <1> ; low byte is number of device headers. 1173 <1> ; (5 * AUX, 4 * PRN, CON, CLOCK, block) 1174 <1> ; ! hardcoded here 1175 <1> ; flags in high byte: 1176 <1> ; 100h = program loaded from config file 1177 <1> ; 200h = device headers not linked to DOS device chain 1178 <1> ; 400h = reentrant devices 1179 <1> ; rest undefined 0 00000EB3 BA[0000] mov dx, seg CONHEADER + DOSENTRYDEVICEBASE 0 00000EB6 BB[00FF] mov bx, CONHEADER - DOSENTRYDEVICEBASE * 16 0 00000EB9 CF iret 1183 <1> 1184 <1> 1185 <1> ; INP: ah = multiplex number 1186 <1> ; al = 11h 1187 <1> ; dx:si -> AMIS id structure, consisting of: 1188 <1> ; word reserved, zero 1189 <1> ; word id sequential number 1190 <1> ; byte string length 1191 <1> ; N byte id string 1192 <1> ; OUT: al = 00h if function not supported 1193 <1> ; al >= 0F0h if id accepted, 1194 <1> ; bx = cx = dx = reserved, 0 for now 1195 <1> ; else id rejected 1196 <1> ; bx = cx = dx = reserved, 0 for now 1197 <1> ; ah = multiplex number 1198 <1> ; CHG: al, bx, cx, dx, si, di 1199 <1> ; preserves: ah, ds, es, bp 1200 <1> checkid: 0 00000EBA 1E push ds 0 00000EBB 06 push es 0 00000EBC 50 push ax ; ! ax must be last in the stack frame 0 00000EBD 8EDA mov ds, dx 1205 <1> assume ds:nothing 0 00000EBF 8B4402 mov ax, [si + aidSequential] 1207 <1> ; ax = sequential number 0 00000EC2 8D7404 lea si, [si + aidString] 1209 <1> ; ds:si -> requested AMIS id string 0 00000EC5 0E push cs 0 00000EC6 07 pop es 1212 <1> assume es:DOSCODEGROUP 0 00000EC7 BB[0C00] mov bx, idtable ; es:bx -> our table 1214 <1> .loop: 0 00000ECA 268B3F mov di, [es:bx + idtString] 1216 <1> ; es:di -> counted string 0 00000ECD 31C9 xor cx, cx 0 00000ECF 8A0C mov cl, byte [si] ; cx = length 0 00000ED1 41 inc cx ; = length including count byte 0 00000ED2 56 push si 0 00000ED3 F3A6 repe cmpsb ; text match ? 0 00000ED5 5E pop si ; restore -> id string 0 00000ED6 750E jne .next ; no --> 0 00000ED8 8D7F02 lea di, [bx + idtMinimumSeq] 0 00000EDB AF scasw ; compare ax, idtMinimumSeq 0 00000EDC 721D jb .below_pop 0 00000EDE AF scasw ; compare ax, idtMaximumSeq 0 00000EDF 58 pop ax 0 00000EE0 771E ja .above 0 00000EE2 B0F0 mov al, 0F0h ; accepted 0 00000EE4 EB0C jmp .ret 1232 <1> 1233 <1> .next: 0 00000EE6 83C306 add bx, IDTABLE_size ; -> next table entry 0 00000EE9 81FB[0801] cmp bx, idtable.end ; was last ? 0 00000EED 72DB jb .loop ; no, try next --> 1237 <1> .notfound: 0 00000EEF 58 pop ax 0 00000EF0 B0E0 mov al, 0E0h ; id not found 1240 <1> .ret: 0 00000EF2 31DB xor bx, bx 0 00000EF4 31D2 xor dx, dx 0 00000EF6 31C9 xor cx, cx ; clear reserved registers 0 00000EF8 07 pop es 0 00000EF9 1F pop ds ; restore segregs from the stack frame 1246 <1> assume ds:nothing, es:nothing 0 00000EFA CF iret ; bye 1248 <1> 1249 <1> .below_pop: 0 00000EFB 58 pop ax 0 00000EFC B0E1 mov al, 0E1h ; id is below accepted 0 00000EFE EBF2 jmp .ret 1253 <1> 1254 <1> .above: 1255 <1> ; no pop ax here 0 00000F00 B0E2 mov al, 0E2h ; id is above accepted 0 00000F02 EBEE jmp .ret 1258 <1> === Switch to base=002450h -> "DOSCODETABLE" 1259 <1> section DOSCODETABLE 1260 <1> 1261 <1> struc AMISID 0 00000480 ???? aidReserved: resw 1 0 00000482 ???? aidSequential: resw 1 0 00000484 ?? aidString: resb 1 1265 <1> endstruc 1266 <1> 1267 <1> %include "idtable.asm" 1 <2> 2 <2> ; Public Domain 3 <2> 4 <2> 5 <2> struc IDTABLE 0 00000480 ???? idtString: resw 1 0 00000482 ???? idtMinimumSeq: resw 1 0 00000484 ???? idtMaximumSeq: resw 1 9 <2> endstruc 10 <2> 11 <2> %imacro idtableentry 1-* 12 <2> %rep %0 13 <2> istruc IDTABLE 14 <2> at idtString, dw %%message_%[NUMBER] 15 <2> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <2> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <2> %ifstr %1 18 <2> %define %%string %1 19 <2> %else 20 <2> %defstr %%string %1 21 <2> %endif 22 <2> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <2> %assign NUMBER NUMBER + 1 24 <2> %rotate 1 25 <2> %endrep 26 <2> %endmacro 27 <2> 28 <2> %assign NUMBER 0 29 <2> %define IDSTRINGS db "" 30 <2> %define MINIMUMSEQUENTIAL 0 31 <2> %define MAXIMUMSEQUENTIAL 00FFh 32 <2> 33 <2> %imacro dumpidstrings 1-*.nolist 34 <2> %rep %0 35 <2> %1 36 <2> %rotate 1 37 <2> %endrep 38 <2> %endmacro 39 <2> 40 <2> even 41 <2> idtable: 42 <2> idtableentry sharer, command, format 12 <3> %rep %0 13 <3> istruc IDTABLE 14 <3> at idtString, dw %%message_%[NUMBER] 15 <3> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <3> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <3> %ifstr %1 18 <3> %define %%string %1 19 <3> %else 20 <3> %defstr %%string %1 21 <3> %endif 22 <3> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <3> %assign NUMBER NUMBER + 1 24 <3> %rotate 1 25 <3> %endrep 13 <4> istruc IDTABLE 0 0000048C [0801] at idtString, dw %%message_%[NUMBER] 0 0000048E 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000490 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000492 [0F01] at idtString, dw %%message_%[NUMBER] 0 00000494 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000496 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000498 [1701] at idtString, dw %%message_%[NUMBER] 0 0000049A 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000049C FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 43 <2> idtableentry ansi, append, assign, attrib, backup, chkdsk, command, comp 12 <3> %rep %0 13 <3> istruc IDTABLE 14 <3> at idtString, dw %%message_%[NUMBER] 15 <3> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <3> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <3> %ifstr %1 18 <3> %define %%string %1 19 <3> %else 20 <3> %defstr %%string %1 21 <3> %endif 22 <3> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <3> %assign NUMBER NUMBER + 1 24 <3> %rotate 1 25 <3> %endrep 13 <4> istruc IDTABLE 0 0000049E [1E01] at idtString, dw %%message_%[NUMBER] 0 000004A0 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004A2 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004A4 [2301] at idtString, dw %%message_%[NUMBER] 0 000004A6 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004A8 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004AA [2A01] at idtString, dw %%message_%[NUMBER] 0 000004AC 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004AE FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004B0 [3101] at idtString, dw %%message_%[NUMBER] 0 000004B2 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004B4 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004B6 [3801] at idtString, dw %%message_%[NUMBER] 0 000004B8 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004BA FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004BC [3F01] at idtString, dw %%message_%[NUMBER] 0 000004BE 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004C0 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004C2 [4601] at idtString, dw %%message_%[NUMBER] 0 000004C4 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004C6 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004C8 [4E01] at idtString, dw %%message_%[NUMBER] 0 000004CA 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004CC FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 44 <2> idtableentry "debug", diskcomp, diskcopy, display, driver.sys, edlin, exe2bin, fastopen 12 <3> %rep %0 13 <3> istruc IDTABLE 14 <3> at idtString, dw %%message_%[NUMBER] 15 <3> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <3> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <3> %ifstr %1 18 <3> %define %%string %1 19 <3> %else 20 <3> %defstr %%string %1 21 <3> %endif 22 <3> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <3> %assign NUMBER NUMBER + 1 24 <3> %rotate 1 25 <3> %endrep 13 <4> istruc IDTABLE 0 000004CE [5301] at idtString, dw %%message_%[NUMBER] 0 000004D0 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004D2 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004D4 [5901] at idtString, dw %%message_%[NUMBER] 0 000004D6 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004D8 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004DA [6201] at idtString, dw %%message_%[NUMBER] 0 000004DC 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004DE FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004E0 [6B01] at idtString, dw %%message_%[NUMBER] 0 000004E2 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004E4 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004E6 [7301] at idtString, dw %%message_%[NUMBER] 0 000004E8 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004EA FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004EC [7E01] at idtString, dw %%message_%[NUMBER] 0 000004EE 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004F0 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004F2 [8401] at idtString, dw %%message_%[NUMBER] 0 000004F4 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004F6 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 000004F8 [8C01] at idtString, dw %%message_%[NUMBER] 0 000004FA 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 000004FC FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 45 <2> idtableentry fdisk, filesys, find, graftabl, graphics, ifsfunc, join, keyb 12 <3> %rep %0 13 <3> istruc IDTABLE 14 <3> at idtString, dw %%message_%[NUMBER] 15 <3> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <3> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <3> %ifstr %1 18 <3> %define %%string %1 19 <3> %else 20 <3> %defstr %%string %1 21 <3> %endif 22 <3> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <3> %assign NUMBER NUMBER + 1 24 <3> %rotate 1 25 <3> %endrep 13 <4> istruc IDTABLE 0 000004FE [9501] at idtString, dw %%message_%[NUMBER] 0 00000500 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000502 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000504 [9B01] at idtString, dw %%message_%[NUMBER] 0 00000506 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000508 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 0000050A [A301] at idtString, dw %%message_%[NUMBER] 0 0000050C 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000050E FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000510 [A801] at idtString, dw %%message_%[NUMBER] 0 00000512 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000514 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000516 [B101] at idtString, dw %%message_%[NUMBER] 0 00000518 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000051A FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 0000051C [BA01] at idtString, dw %%message_%[NUMBER] 0 0000051E 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000520 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000522 [C201] at idtString, dw %%message_%[NUMBER] 0 00000524 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000526 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000528 [C701] at idtString, dw %%message_%[NUMBER] 0 0000052A 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000052C FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 46 <2> idtableentry label, mem, mode, more, nlsfunc, print, printer, recover 12 <3> %rep %0 13 <3> istruc IDTABLE 14 <3> at idtString, dw %%message_%[NUMBER] 15 <3> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <3> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <3> %ifstr %1 18 <3> %define %%string %1 19 <3> %else 20 <3> %defstr %%string %1 21 <3> %endif 22 <3> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <3> %assign NUMBER NUMBER + 1 24 <3> %rotate 1 25 <3> %endrep 13 <4> istruc IDTABLE 0 0000052E [CC01] at idtString, dw %%message_%[NUMBER] 0 00000530 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000532 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000534 [D201] at idtString, dw %%message_%[NUMBER] 0 00000536 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000538 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 0000053A [D601] at idtString, dw %%message_%[NUMBER] 0 0000053C 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000053E FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000540 [DB01] at idtString, dw %%message_%[NUMBER] 0 00000542 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000544 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000546 [E001] at idtString, dw %%message_%[NUMBER] 0 00000548 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000054A FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 0000054C [E801] at idtString, dw %%message_%[NUMBER] 0 0000054E 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000550 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000552 [EE01] at idtString, dw %%message_%[NUMBER] 0 00000554 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000556 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000558 [F601] at idtString, dw %%message_%[NUMBER] 0 0000055A 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000055C FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 47 <2> idtableentry replace, restore, sort, subst, tree, vdisk, xcopy 12 <3> %rep %0 13 <3> istruc IDTABLE 14 <3> at idtString, dw %%message_%[NUMBER] 15 <3> at idtMinimumSeq, dw MINIMUMSEQUENTIAL 16 <3> at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <3> %ifstr %1 18 <3> %define %%string %1 19 <3> %else 20 <3> %defstr %%string %1 21 <3> %endif 22 <3> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <3> %assign NUMBER NUMBER + 1 24 <3> %rotate 1 25 <3> %endrep 13 <4> istruc IDTABLE 0 0000055E [FE01] at idtString, dw %%message_%[NUMBER] 0 00000560 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000562 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000564 [0602] at idtString, dw %%message_%[NUMBER] 0 00000566 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000568 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 0000056A [0E02] at idtString, dw %%message_%[NUMBER] 0 0000056C 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000056E FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000570 [1302] at idtString, dw %%message_%[NUMBER] 0 00000572 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000574 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000576 [1902] at idtString, dw %%message_%[NUMBER] 0 00000578 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 0000057A FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 0000057C [1E02] at idtString, dw %%message_%[NUMBER] 0 0000057E 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000580 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 13 <4> istruc IDTABLE 0 00000582 [2402] at idtString, dw %%message_%[NUMBER] 0 00000584 0000 at idtMinimumSeq, dw MINIMUMSEQUENTIAL 0 00000586 FF00 at idtMaximumSeq, dw MAXIMUMSEQUENTIAL 17 <4> %ifstr %1 18 <4> %define %%string %1 19 <4> %else 20 <4> %defstr %%string %1 21 <4> %endif 22 <4> %xdefine IDSTRINGS IDSTRINGS, %%message_%[NUMBER]:, {counted %%string} 23 <4> %assign NUMBER NUMBER + 1 24 <4> %rotate 1 48 <2> .end: 49 <2> 50 <2> idtmsg: 0 00000588 067368617265720763 dumpidstrings IDSTRINGS 0 00000591 6F6D6D616E6406666F 0 0000059A 726D617404616E7369 0 000005A3 06617070656E640661 0 000005AC 737369676E06617474 0 000005B5 726962066261636B75 0 000005BE 700663686B64736B07 0 000005C7 636F6D6D616E640463 0 000005D0 6F6D70056465627567 0 000005D9 086469736B636F6D70 0 000005E2 086469736B636F7079 0 000005EB 07646973706C61790A 0 000005F4 6472697665722E7379 0 000005FD 730565646C696E0765 0 00000606 78653262696E086661 0 0000060F 73746F70656E056664 0 00000618 69736B0766696C6573 0 00000621 79730466696E640867 0 0000062A 7261667461626C0867 0 00000633 726170686963730769 0 0000063C 667366756E63046A6F 0 00000645 696E046B657962056C 0 0000064E 6162656C036D656D04 0 00000657 6D6F6465046D6F7265 0 00000660 076E6C7366756E6305 0 00000669 7072696E7407707269 0 00000672 6E746572077265636F 0 0000067B 766572077265706C61 0 00000684 636507726573746F72 0 0000068D 6504736F7274057375 0 00000696 627374047472656505 0 0000069F 766469736B0578636F 0 000006A8 7079 17 ;=== Pop trace listing source 18 END === Trace listing source: ../INC/msdosme.lst 1 ; SCCSID = @(#)ibmdosmes.asm 1.1 85/04/10 2 ; 3 ; Standard device IO for MSDOS (first 12 function calls) 4 ; 5 debug equ 0 6 [list -] 6 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 6 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 12 ;.cref 13 [list +] 14 15 ;TITLE IBMDOSMES - DOS OEM dependancies 16 ;NAME IBMDOSMES 17 18 ;=== Push trace listing source: dosmes.nas 19 %include "dosmes.nas" ; NASM included file 1 <1> ; SCCSID = @(#)dosmes.asm 1.7 85/10/23 2 <1> ; SCCSID = @(#)dosmes.asm 1.7 85/10/23 3 <1> ; 4 <1> ; Message file for Internationalized messages. There is 5 <1> ; only one message here available for translation. 6 <1> ; 7 <1> ; 8 <1> ; Revision history 9 <1> ; A000 version 4.00 Jan. 1988 10 <1> ; 11 <1> 12 <1> %IFNdef KANJI 13 <1> %iassign KANJI FALSE 14 <1> %ENDIF 15 <1> 16 <1> %IFNdef Rainbow 17 <1> %iassign Rainbow FALSE 18 <1> %ENDIF 19 <1> 20 <1> [list -] 20 ****************** <1> warning: out: ... for DOS Version 4.00 ... [-w+user] 20 ****************** <1> warning: out: BPB.INC... [-w+user] 20 ****************** <1> warning: out: ... CLONE version build switch on ... [-w+user] 28 <1> === Switch to base=000E10h -> "CONSTANTS" 29 <1> section CONSTANTS 30 <1> 31 <1> UserNum equ USERNUM ; NASM port label 32 <1> OEMNum equ OEMNUM ; NASM port label 33 <1> PUBLIC UserNum, OEMNum 34 <1> Public DMES001S,DMES001E 35 <1> DMES001S Label byte 0 000003B2 ???? USERNUM DW ? ; 24 bit user number 0 000003B4 ?? DB ? 38 <1> OEMNUM: 39 <1> %if 0 40 <1> %IF IBM 41 <1> %IF IBMCOPYRIGHT 42 <1> DB 0 ; 8 bit OEM number 43 <1> %ELSE 44 <1> DB 0FFH ; 8 bit OEM number 45 <1> %ENDIF 46 <1> %ELSE 47 <1> DB 0FFH 48 <1> %ENDIF 49 <1> %else 0 000003B5 26 db 26h ; lDOS OEM number = 26h 51 <1> %endif 52 <1> 53 <1> DMES001E label byte 54 <1> ; (no prior section) ; CONSTANTS ENDS 55 <1> === Switch to base=000E10h -> "TABLE" 56 <1> section TABLE ; in DOSDATA 57 <1> Public DMES002S 58 <1> DMES002S label byte 59 <1> 60 <1> 61 <1> ; The following table is used for DOS 3.3 62 <1> ;DOS country and code page information is defined here for DOS 3.3. 63 <1> ;The initial value for ccDosCountry is 1 (USA). 64 <1> ;The initial value for ccDosCodepage is 850. 65 <1> ; 66 <1> ; 67 <1> PUBLIC COUNTRY_CDPG,UCASE_TAB,FILE_UCASE_TAB 68 <1> PUBLIC FILE_CHAR_TAB 69 <1> ; 70 <1> ; country and code page infomation 71 <1> ; 72 <1> COUNTRY_CDPG label byte 73 <1> 0 00000F20 0000000000000000 db 0,0,0,0,0,0,0,0 ; reserved words 0 00000F28 5C434F554E5452592E db '\COUNTRY.SYS',0 ; path name of country.sys 0 00000F31 53595300 76 00000015 <1> db 51 dup (?) 0 00000F68 B501 dw 437 ; system code page id 0 00000F6A 0600 dw 6 ; number of entries 0 00000F6C 02 db SetUcase ; Ucase type 0 00000F6D [8E00] dw OFFSET UCASE_TAB wrt DOSGROUP ;pointer to upper case table 0 00000F6F 0000 dw 0 ; segment of poiter 0 00000F71 04 db SetUcaseFile ; Ucase file char type 0 00000F72 [1001] dw OFFSET FILE_UCASE_TAB wrt DOSGROUP ;pointer to file upper case table 0 00000F74 0000 dw 0 ; segment of poiter 0 00000F76 05 db SetFileList ; valid file chars type 0 00000F77 [9201] dw OFFSET FILE_CHAR_TAB wrt DOSGROUP ;pointer to valid file char tab 0 00000F79 0000 dw 0 ; segment of poiter 0 00000F7B 06 db SetCollate ; collate type 0 00000F7C [C201] dw OFFSET COLLATE_TAB wrt DOSGROUP ;pointer to collate table 0 00000F7E 0000 dw 0 ; segment of poiter 0 00000F80 07 db SetDBCS ;AN000; DBCS Ev 2/12/KK 0 00000F81 [C402] dw OFFSET DBCS_TAB wrt DOSGROUP ;AN000;;pointer to DBCS Ev table 2/12/KK 0 00000F83 0000 dw 0 ;AN000; segment of poiter 2/12/KK 0 00000F85 01 db SetCountryInfo ; country info type 0 00000F86 2600 dw NEW_COUNTRY_SIZE ; extended country info size 0 00000F88 0100 dw 1 ; USA country id 0 00000F8A B501 dw 437 ; USA system code page id 0 00000F8C 0000 dw 0 ; date format 0 00000F8E 2400000000 db '$',0,0,0,0 ; currency symbol 0 00000F93 2C00 db ',',0 ; thousand separator 0 00000F95 2E00 db '.',0 ; decimal separator 0 00000F97 2D00 db '-',0 ; date separator 0 00000F99 3A00 db ':',0 ; time separator 0 00000F9B 00 db 0 ; currency format flag 0 00000F9C 02 db 2 ; # of disgit in currency 0 00000F9D 00 db 0 ; time format 0 00000F9E [A003] dw casemap + DOSENTRYADJUSTOFFSET ;mono case routine entry point 0 00000FA0 [0000] dw DOSENTRY - DOSENTRYADJUSTSEGMENT ; segment of entry point 0 00000FA2 2C00 db ',',0 ; data list separator 0 00000FA4 000000000000000000 dw 0,0,0,0,0 ; reserved 0 00000FAD 00 111 <1> 112 <1> 113 <1> 114 <1> ; 115 <1> ; 116 <1> ; 117 <1> ; 118 <1> ; 119 <1> ; upper case table 120 <1> ; 121 <1> UCASE_TAB label byte 0 00000FAE 8000 dw 128 0 00000FB0 809A45418E418F80 db 128,154,069,065,142,065,143,128 0 00000FB8 4545454949498E8F db 069,069,069,073,073,073,142,143 0 00000FC0 9092924F994F5555 db 144,146,146,079,153,079,085,085 0 00000FC8 59999A9B9C9D9E9F db 089,153,154,155,156,157,158,159 0 00000FD0 41494F55A5A5A6A7 db 065,073,079,085,165,165,166,167 0 00000FD8 A8A9AAABACADAEAF db 168,169,170,171,172,173,174,175 0 00000FE0 B0B1B2B3B4B5B6B7 db 176,177,178,179,180,181,182,183 0 00000FE8 B8B9BABBBCBDBEBF db 184,185,186,187,188,189,190,191 0 00000FF0 C0C1C2C3C4C5C6C7 db 192,193,194,195,196,197,198,199 0 00000FF8 C8C9CACBCCCDCECF db 200,201,202,203,204,205,206,207 0 00001000 D0D1D2D3D4D5D6D7 db 208,209,210,211,212,213,214,215 0 00001008 D8D9DADBDCDDDEDF db 216,217,218,219,220,221,222,223 0 00001010 E0E1E2E3E4E5E6E7 db 224,225,226,227,228,229,230,231 0 00001018 E8E9EAEBECEDEEEF db 232,233,234,235,236,237,238,239 0 00001020 F0F1F2F3F4F5F6F7 db 240,241,242,243,244,245,246,247 0 00001028 F8F9FAFBFCFDFEFF db 248,249,250,251,252,253,254,255 139 <1> 140 <1> ; 141 <1> ; file upper case table 142 <1> ; 143 <1> FILE_UCASE_TAB label byte 0 00001030 8000 dw 128 0 00001032 809A45418E418F80 db 128,154,069,065,142,065,143,128 0 0000103A 4545454949498E8F db 069,069,069,073,073,073,142,143 0 00001042 9092924F994F5555 db 144,146,146,079,153,079,085,085 0 0000104A 59999A9B9C9D9E9F db 089,153,154,155,156,157,158,159 0 00001052 41494F55A5A5A6A7 db 065,073,079,085,165,165,166,167 0 0000105A A8A9AAABACADAEAF db 168,169,170,171,172,173,174,175 0 00001062 B0B1B2B3B4B5B6B7 db 176,177,178,179,180,181,182,183 0 0000106A B8B9BABBBCBDBEBF db 184,185,186,187,188,189,190,191 0 00001072 C0C1C2C3C4C5C6C7 db 192,193,194,195,196,197,198,199 0 0000107A C8C9CACBCCCDCECF db 200,201,202,203,204,205,206,207 0 00001082 D0D1D2D3D4D5D6D7 db 208,209,210,211,212,213,214,215 0 0000108A D8D9DADBDCDDDEDF db 216,217,218,219,220,221,222,223 0 00001092 E0E1E2E3E4E5E6E7 db 224,225,226,227,228,229,230,231 0 0000109A E8E9EAEBECEDEEEF db 232,233,234,235,236,237,238,239 0 000010A2 F0F1F2F3F4F5F6F7 db 240,241,242,243,244,245,246,247 0 000010AA F8F9FAFBFCFDFEFF db 248,249,250,251,252,253,254,255 161 <1> 162 <1> ; 163 <1> ; file char list 164 <1> ; 165 <1> FILE_CHAR_TAB label byte 0 000010B2 1600 dw 22 ; length 0 000010B4 0100FF db 1,0,255 ; include all 0 000010B7 000020 db 0,0,20h ; exclude 0 - 20h 0 000010BA 020E2E222F5C5B5D3A db 2,14,'."/\[]:|<>+=;,' ; exclude 14 special 0 000010C3 7C3C3E2B3D3B2C 170 000001AA <1> db 24 dup (?) ; reserved 171 <1> ; 172 <1> ; collate table 173 <1> ; 174 <1> COLLATE_TAB label byte 0 000010E2 0001 dw 256 0 000010E4 0001020304050607 db 0,1,2,3,4,5,6,7 0 000010EC 08090A0B0C0D0E0F db 8,9,10,11,12,13,14,15 0 000010F4 1011121314151617 db 16,17,18,19,20,21,22,23 0 000010FC 18191A1B1C1D1E1F db 24,25,26,27,28,29,30,31 0 00001104 2021222324252627 db " ","!",'"',"#","$","%","&","'" 0 0000110C 28292A2B2C2D2E2F db "(",")","*","+",",","-",".","/" 0 00001114 3031323334353637 db "0","1","2","3","4","5","6","7" 0 0000111C 38393A3B3C3D3E3F db "8","9",":",";","<","=",">","?" 0 00001124 4041424344454647 db "@","A","B","C","D","E","F","G" 0 0000112C 48494A4B4C4D4E4F db "H","I","J","K","L","M","N","O" 0 00001134 5051525354555657 db "P","Q","R","S","T","U","V","W" 0 0000113C 58595A5B5C5D5E5F db "X","Y","Z","[","\","]","^","_" 0 00001144 6041424344454647 db "`","A","B","C","D","E","F","G" 0 0000114C 48494A4B4C4D4E4F db "H","I","J","K","L","M","N","O" 0 00001154 5051525354555657 db "P","Q","R","S","T","U","V","W" 0 0000115C 58595A7B7C7D7E7F db "X","Y","Z","{","|","}","~",127 0 00001164 4355454141414143 db "C","U","E","A","A","A","A","C" 0 0000116C 4545454949494141 db "E","E","E","I","I","I","A","A" 0 00001174 4541414F4F4F5555 db "E","A","A","O","O","O","U","U" 0 0000117C 594F552424242424 db "Y","O","U","$","$","$","$","$" 0 00001184 41494F554E4EA6A7 db "A","I","O","U","N","N",166,167 0 0000118C 3FA9AAABAC212222 db "?",169,170,171,172,"!",'"','"' 0 00001194 B0B1B2B3B4B5B6B7 db 176,177,178,179,180,181,182,183 0 0000119C B8B9BABBBCBDBEBF db 184,185,186,187,188,189,190,191 0 000011A4 C0C1C2C3C4C5C6C7 db 192,193,194,195,196,197,198,199 0 000011AC C8C9CACBCCCDCECF db 200,201,202,203,204,205,206,207 0 000011B4 D0D1D2D3D4D5D6D7 db 208,209,210,211,212,213,214,215 0 000011BC D8D9DADBDCDDDEDF db 216,217,218,219,220,221,222,223 0 000011C4 E053 db 224,"S" 0 000011C6 E2E3E4E5E6E7 db 226,227,228,229,230,231 0 000011CC E8E9EAEBECEDEEEF db 232,233,234,235,236,237,238,239 0 000011D4 F0F1F2F3F4F5F6F7 db 240,241,242,243,244,245,246,247 0 000011DC F8F9FAFBFCFDFEFF db 248,249,250,251,252,253,254,255 209 <1> ; 210 <1> ; dbcs is not supported in DOS 3.3 211 <1> ; DBCS_TAB CC_DBCS <> 212 <1> ; 213 <1> ; DBCS for DOS 4.00 2/12/KK 214 <1> PUBLIC DBCS_TAB 215 <1> DBCS_TAB label byte ;AN000; 2/12/KK 0 000011E4 0000 dw 0 ;AN000; 2/12/KK max number 0 000011E6 000000000000000000 db 16 dup(0) ;AN000; 2/12/KK 0 000011EF 00000000000000 218 <1> 219 <1> ; dw 6 ; 2/12/KK 220 <1> ; db 081h,09fh ; 2/12/KK 221 <1> ; db 0e0h,0fch ; 2/12/KK 222 <1> ; db 0,0 ; 2/12/KK 223 <1> ; 224 <1> ; 225 <1> === Switch to base=002450h -> "DOSCODETABLE" 226 <1> section DOSCODETABLE 227 <1> 228 <1> ;=== Push trace listing source: divmes.nas 229 <1> %include "divmes.nas" ; NASM included file 1 <2> ; THIS IS THE ONLY DOS "MESSAGE". IT DOES NOT NEED A TERMINATOR. 2 <2> PUBLIC DIVMES 3 <2> Public DIVM001S,DIVM001E 4 <2> DIVM001S label byte 5 <2> 6 <2> ;=== Push trace listing source: msdos.cl1 7 <2> %include "msdos.cl1" ; NASM included file 1 <3> ; msdos.cl1 2 <3> 3 <3> 4 <3> ;_______________________ 5 <3> 0 000006AA 0D0A44697669646520 DIVMES DB 13,10,"Divide overflow",13,10 0 000006B3 6F766572666C6F770D 0 000006BC 0A 8 <2> ;=== Pop trace listing source 9 <2> 10 <2> PUBLIC DivMesLen 11 <2> DivMes equ DIVMES ; NASM port label 0 000006BD 1300 DivMesLen DW $-DivMes ; Length of the above message in bytes 13 <2> DIVM001E label byte 230 <1> ;=== Pop trace listing source 231 <1> === Switch to base=000E10h -> "TABLE" 232 <1> section TABLE ; in DOSDATA 233 <1> 234 <1> ;=== Push trace listing source: yesno.nas 235 <1> %include "yesno.nas" ; NASM included file 1 <2> ; This is for contry Yes and No 2 <2> PUBLIC NLS_YES,NLS_yes2,NLS_NO,NLS_no2 3 <2> ;=== Push trace listing source: msdos.cl3 4 <2> %include "msdos.cl3" ; NASM included file 1 <3> ; msdos.cl3 2 <3> 3 <3> 4 <3> ;_______________________ 5 <3> 0 000011F6 59 NLS_YES DB "Y" 7 <3> 8 <3> ;_______________________ 9 <3> 0 000011F7 4E NLS_NO DB "N" 11 <3> 12 <3> ;_______________________ 13 <3> 0 000011F8 79 NLS_yes2 DB "y" 15 <3> 16 <3> ;_______________________ 17 <3> 0 000011F9 6E NLS_no2 DB "n" 5 <2> ;=== Pop trace listing source 236 <1> ;=== Pop trace listing source 237 <1> 238 <1> 239 <1> %ifndef DONOBITS 240 <1> === Switch to base=002450h -> "DOSCODECODE" 241 <1> section DOSCODECODE 242 <1> 243 <1> extern doscode_getdosdata 244 <1> 245 <1> relocated casemap 246 <1> assume ds:nothing, es:nothing, ss:nothing 0 00000F04 50 push ax 0 00000F05 E8[0000] call doscode_getdosdata 0 00000F08 50 push ax 0 00000F09 B8[0000] mov ax, MAP_CASE 0 00000F0C 50 push ax 0 00000F0D CB retf 253 <1> 254 <1> === Switch to base=000E10h -> "DOSDATACODE" 255 <1> section DOSDATACODE ; in DOSDATA 256 <1> 257 <1> ;CASE MAPPER ROUTINE FOR 80H-FFH character range, DOS 3.3 258 <1> ; ENTRY: AL = Character to map 259 <1> ; EXIT: AL = The converted character 260 <1> ; Alters no registers except AL and flags. 261 <1> ; The routine should do nothing to chars below 80H. 262 <1> ; 263 <1> ; Example: 264 <1> 265 <1> Procedure MAP_CASE,FAR 265 ****************** <1> warning: proc MAP_CASE... [-w+user] 266 <1> ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:NOTHING 0 0000124B 58 pop ax 0 0000124C 3C80 CMP AL,80H 0 0000124E 7301 JAE Map1 ;Map no chars below 80H ever 0 00001250 CB RET 271 <1> Map1: 0 00001251 2C80 SUB AL,80H ;Turn into index value 0 00001253 1E PUSH DS 0 00001254 53 PUSH BX 0 00001255 BB[9000] MOV BX,OFFSET UCASE_TAB + 2 wrt DOSGROUP ; access with cs 276 <1> FINISH: 0 00001258 0E PUSH CS ;Move to DS 0 00001259 1F POP DS 279 <1> assume ds:DOSGROUP 0 0000125A D7 xlatb ;Get upper case character 0 0000125B 5B POP BX 0 0000125C 1F POP DS 283 <1> assume ds:nothing 0 0000125D CB L_RET: RET 285 <1> EndProc MAP_CASE 286 <1> 287 <1> ;SUBTTL EDIT FUNCTION ASSIGNMENTS AND HEADERS 288 <1> ;PAGE 289 <1> ; The following two tables implement the current buffered input editing 290 <1> ; routines. The tables are pairwise associated in reverse order for ease 291 <1> ; in indexing. That is; The first entry in ESCTAB corresponds to the last 292 <1> ; entry in ESCFUNC, and the last entry in ESCTAB to the first entry in ESCFUNC. 293 <1> 294 <1> %endif ; DONOBITS 295 <1> 296 <1> === Switch to base=000E10h -> "TABLE" 297 <1> section TABLE ; in DOSDATA 298 <1> PUBLIC CANCHAR 0 000011FA 1B CANCHAR DB CANCEL ;Cancel line character 300 <1> PUBLIC ESCCHAR 0 000011FB 00 ESCCHAR DB ESCCH ;Lead-in character for escape sequences 302 <1> === Switch to base=002450h -> "DOSCODETABLE" 303 <1> section DOSCODETABLE 304 <1> %IFN Rainbow 305 <1> ESCTAB LABEL BYTE 306 <1> %IFN IBM 307 <1> %IF WANG 308 <1> DB 0C0h ; ^Z inserter 309 <1> DB 0C1H ; Copy one char 310 <1> DB 0C1H ; Copy one char 311 <1> DB 0C7H ; Skip one char 312 <1> DB 08AH ; Copy to char 313 <1> DB 088H ; Skip to char 314 <1> DB 09AH ; Copy line 315 <1> DB 0CBH ; Kill line (no change in template) 316 <1> DB 08BH ; Reedit line (new template) 317 <1> DB 0C3H ; Backspace 318 <1> DB 0C6H ; Enter insert mode 319 <1> DB 0D6H ; Exit insert mode 320 <1> DB 0C6H ; Escape character 321 <1> DB 0C6H ; End of table 322 <1> %ELSE 323 <1> ; VT52 equivalences 324 <1> DB "Z" ; ^Z inserter 325 <1> DB "S" ; F1 Copy one char 326 <1> DB "S" ; F1 Copy one char 327 <1> DB "V" ; F4 Skip one char 328 <1> DB "T" ; F2 Copy to char 329 <1> DB "W" ; F5 Skip to char 330 <1> DB "U" ; F3 Copy line 331 <1> DB "E" ; SHIFT ERASE Kill line (no change in template) 332 <1> DB "J" ; ERASE Reedit line (new template) 333 <1> DB "D" ; LEFT Backspace 334 <1> DB "P" ; BLUE Enter insert mode 335 <1> DB "Q" ; RED Exit insert mode 336 <1> DB "R" ; GRAY Escape character 337 <1> DB "R" ; End of table 338 <1> %ENDIF 339 <1> %ENDIF 340 <1> %IF IBM 0 000006BF 40 DB 64 ; Ctrl-Z - F6 0 000006C0 4D DB 77 ; Copy one char - --> 0 000006C1 3B DB 59 ; Copy one char - F1 0 000006C2 53 DB 83 ; Skip one char - DEL 0 000006C3 3C DB 60 ; Copy to char - F2 0 000006C4 3E DB 62 ; Skip to char - F4 0 000006C5 3D DB 61 ; Copy line - F3 0 000006C6 3D DB 61 ; Kill line (no change to template ) - Not used 0 000006C7 3F DB 63 ; Reedit line (new template) - F5 0 000006C8 4B DB 75 ; Backspace - <-- 0 000006C9 52 DB 82 ; Enter insert mode - INS (toggle) 0 000006CA 52 DB 82 ; Exit insert mode - INS (toggle) 0 000006CB 41 DB 65 ; Escape character - F7 0 000006CC 41 DB 65 ; End of table 355 <1> %ENDIF 356 <1> ESCEND LABEL BYTE 357 <1> ESCTABLEN EQU ESCEND-ESCTAB 358 <1> === Switch to base=000E10h -> "DOSDATATABLE" 359 <1> section DOSDATATABLE ; in DOSDATA 360 <1> 361 <1> align 2, db 0 362 <1> ESCFUNC LABEL WORD 0 000011FC [0000] short_addr GETCH ; Ignore the escape sequence 0 000011FE [0000] short_addr TWOESC 0 00001200 [0000] short_addr EXITINS 0 00001202 [0000] short_addr ENTERINS 0 00001204 [0000] short_addr BACKSP 0 00001206 [0000] short_addr REEDIT 0 00001208 [0000] short_addr KILNEW 0 0000120A [0000] short_addr COPYLIN 0 0000120C [0000] short_addr SKIPSTR 0 0000120E [0000] short_addr COPYSTR 0 00001210 [0000] short_addr SKIPONE 0 00001212 [0000] short_addr COPYONE 0 00001214 [0000] short_addr COPYONE 0 00001216 [0000] short_addr CTRLZ 377 <1> %ENDIF 378 <1> 379 <1> %ifndef DONOBITS 380 <1> === Switch to base=002450h -> "DOSCODECODE" 381 <1> section DOSCODECODE ; TABLE ENDS 382 <1> 383 <1> ; 384 <1> ; OEMFunction key is expected to process a single function 385 <1> ; key input from a device and dispatch to the proper 386 <1> ; routines leaving all registers UNTOUCHED. 387 <1> ; 388 <1> ; Inputs: CS, SS are DOSGROUP 389 <1> ; Outputs: None. This function is expected to JMP to one of 390 <1> ; the following labels: 391 <1> ; 392 <1> ; GetCh - ignore the sequence 393 <1> ; TwoEsc - insert an ESCChar in the buffer 394 <1> ; ExitIns - toggle insert mode 395 <1> ; EnterIns - toggle insert mode 396 <1> ; BackSp - move backwards one space 397 <1> ; ReEdit - reedit the line with a new template 398 <1> ; KilNew - discard the current line and start from scratch 399 <1> ; CopyLin - copy the rest of the template into the line 400 <1> ; SkipStr - read the next character and skip to it in the template 401 <1> ; CopyStr - read next char and copy from template to line until char 402 <1> ; SkipOne - advance position in template one character 403 <1> ; CopyOne - copy next character in template into line 404 <1> ; CtrlZ - place a ^Z into the template 405 <1> ; Registers that are allowed to be modified by this function are: 406 <1> ; AX, CX, BP 407 <1> 408 <1> Procedure OEMFunctionKey,NEAR 408 ****************** <1> warning: proc OEMFunctionKey... [-w+user] 409 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 410 <1> %IF DBCS ;AN000; 411 <1> extrn intCNE0:near ;AN000; 2/17/KK 412 <1> CALL intCNE0 ;AN000; 2/17/KK 413 <1> %ELSE ;AN000; 0 00000F0E E8[0000] invoke D_std_con_input_no_echo ; Get the second byte of the sequence 415 <1> %ENDIF ;AN000; 416 <1> %IFN Rainbow 0 00000F11 B10E MOV CL,ESCTABLEN ; length of table for scan 0 00000F13 06 push es 0 00000F14 57 PUSH DI ; save DI (cannot change it!) 0 00000F15 0E push cs 0 00000F16 07 pop es 422 <1> assume es:DOSCODEGROUP 0 00000F17 BF[1500] MOV DI,OFFSET ESCTAB ; offset of second byte table ; access with es 0 00000F1A F2AE REPNE SCASB ; Look it up in the table 0 00000F1C 5F POP DI ; restore DI 0 00000F1D 07 pop es 427 <1> assume es:nothing 0 00000F1E D1E1 SHL CX,1 ; convert byte offset to word 0 00000F20 89CD MOV BP,CX ; move to indexable register 0 00000F22 FFA6[0000] JMP [BP+OFFSET ESCFUNC wrt DOSGROUP] ; Go to the right routine 431 <1> %ENDIF 432 <1> %IF Rainbow 433 <1> 434 <1> TransferIf MACRO value,address 435 <1> local a 436 <1> CMP AL,[value] 437 <1> JNZ a 438 <1> transfer address 439 <1> a: 440 <1> ENDM 441 <1> 442 <1> CMP AL,'[' ; is it second lead char 443 <1> JZ EatParm ; yes, go walk tree 444 <1> GoGetCh: 445 <1> transfer GetCh ; no, ignore sequence 446 <1> EatParm: 447 <1> invoke D_std_con_input_no_echo ; get argument 448 <1> CMP AL,'A' ; is it alphabetic arg? 449 <1> JAE EatAlpha ; yes, go snarf one up 450 <1> XOR BP,BP ; init digit counter 451 <1> JMP InDigit ; jump into internal eat digit routine 452 <1> EatNum: 453 <1> invoke D_std_con_input_no_echo ; get next digit 454 <1> InDigit: 455 <1> CMP AL,'9' ; still a digit? 456 <1> JA CheckNumEnd ; no, go check for end char 457 <1> SUB AL,'0' ; turn into potential digit 458 <1> JL GoGetCh ; oops, not a digit, ignore 459 <1> MOV CX,BP ; save BP for 10 multiply 460 <1> CBW ; make AL into AX 461 <1> SHL BP,1 ; 2*BP 462 <1> SHL BP,1 ; 4*BP 463 <1> ADD BP,CX ; 5*BP 464 <1> SHL BP,1 ; 10*BP 465 <1> ADD BP,AX ; 10*BP + digit 466 <1> JMP EatNum ; continue with number 467 <1> CheckNumEnd: 468 <1> CMP AL,7Eh ; is it end char ~ 469 <1> JNZ GoGetCh ; nope, ignore key sequence 470 <1> MOV AX,BP 471 <1> transferIf 1,SkipStr ; FIND key 472 <1> transferIf 2,EnterIns ; INSERT HERE key 473 <1> transferIf 3,SkipOne ; REMOVE 474 <1> transferIf 4,CopyStr ; SELECT 475 <1> transferIf 17,TwoEsc ; INTERRUPT 476 <1> transferIf 18,ReEdit ; RESUME 477 <1> transferIf 19,KilNew ; CANCEL 478 <1> transferIf 21,CtrlZ ; EXIT 479 <1> transferIf 29,CopyLin ; DO 480 <1> JMP GoGetCh 481 <1> EatAlpha: 482 <1> CMP AL,'O' ; is it O? 483 <1> JA GoGetCh ; no, after assume bogus 484 <1> JZ EatPQRS ; eat the rest of the bogus key 485 <1> transferIf 'C',CopyOne ; RIGHT 486 <1> transferIf 'D',BackSp ; LEFT 487 <1> JMP GoGetCh 488 <1> EatPQRS: 489 <1> invoke D_std_con_input_no_echo ; eat char after O 490 <1> JMP GoGetCh 491 <1> %ENDIF 492 <1> 493 <1> EndProc OEMFunctionKey 494 <1> 495 <1> ; (no prior section) ; DOSCODECODE ENDS 496 <1> 497 <1> %endif ; DONOBITS 498 <1> 499 <1> END 20 ;=== Pop trace listing source === Trace listing source: ../DOS/time.lst 1 ; SCCSID = @(#)time.asm 1.1 85/04/10 2 ;TITLE TIME - time and date functions 3 ;NAME TIME 4 ; 5 ; System Calls and low level routines for DATE and TIME 6 ; 7 ; $GET_DATE 8 ; $SET_DATE 9 ; $GET_TIME 10 ; $SET_TIME 11 ; DATE16 12 ; READTIME 13 ; DSLIDE 14 ; SETYEAR 15 ; DODATE 16 ; DSUM 17 ; 18 ; Modification history: 19 ; 20 ; Created: ARR 30 March 1983 21 ; 22 23 [list -] 23 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 28 29 [list +] === Switch to base=002450h -> "DOSCODECODE" 30 section DOSCODECODE 31 [list -] 31 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 31 ****************** warning: out: BPB.INC... [-w+user] 31 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 31 ****************** warning: out: DEVSYM.INC... [-w+user] 38 39 40 i_need DAY,BYTE 41 i_need MONTH,BYTE 42 i_need YEAR,WORD 43 i_need WEEKDAY,BYTE 44 i_need TIMEBUF,6 45 i_need BCLOCK,DWORD 46 i_need DAYCNT_DOS,WORD 47 i_need YRTAB,8 48 i_need MONTAB,12 49 i_need DATE_FLAG,WORD 50 51 FOURYEARS equ 3*365 + 366 52 53 assume nocheck, ss:DOSGROUP 54 55 ;SUBTTL DATE AND TIME - SYSTEM CALLS 42,43,44,45 56 ;PAGE 57 procedure D_GET_DATE,NEAR 57 ****************** warning: proc D_GET_DATE... [-w+user] 58 ASSUME DS:NOTHING,ES:NOTHING 59 60 ; Inputs: 61 ; None 62 ; Function: 63 ; Return current date 64 ; Returns: 65 ; Date in CX:DX 66 0 00000F26 161F Context DS 0 00000F28 E8B700 CALL READTIME ;Check for rollover to next day 0 00000F2B A1[0000] MOV AX,[YEAR] 70 ; 71 ; WARNING!!!! DAY and MONTH must be adjacently allocated! 72 ; 0 00000F2E 8B1E[0000] MOV BX,WORD PTR [DAY] ; fetch both day and month 0 00000F32 E8[0000] invoke get_user_stack ;Get pointer to user registers 75 ASSUME DS:NOTHING 0 00000F35 895C06 MOV [SI + user_DX],BX ;DH=month, DL=day 0 00000F38 05BC07 ADD AX,1980 ;Put bias back 0 00000F3B 894404 MOV [SI + user_CX],AX ;CX=year 0 00000F3E 36A0[0000] MOV AL,BYTE PTR [ss:WEEKDAY] 0 00000F42 C3 return 81 EndProc D_GET_DATE 82 83 procedure D_SET_DATE,NEAR ;System call 43 83 ****************** warning: proc D_SET_DATE... [-w+user] 84 ASSUME DS:NOTHING,ES:NOTHING 85 86 ; Inputs: 87 ; CX:DX valid date 88 ; Function: 89 ; Set current date 90 ; Returns: 91 ; AL = -1 date bad, = 0 OK 92 0 00000F43 B0FF MOV AL,-1 ;Be ready to flag error 0 00000F45 81E9BC07 SUB CX,1980 ;Fix bias in year 0 00000F49 72F7 retc ;Error if not big enough 0 00000F4B 83F977 CMP CX,119 ;Year must be less than 2100 0 00000F4E 7712 JA RET24 0 00000F50 08F6 OR DH,DH 0 00000F52 74EE retz 0 00000F54 08D2 OR DL,DL 0 00000F56 74EA retz ;Error if either month or day is 0 0 00000F58 80FE0C CMP DH,12 ;Check against max. month 0 00000F5B 7705 JA RET24 0 00000F5D 161F Context DS 0 00000F5F E81001 invoke DODATE 0 00000F62 C3 RET24: return 107 EndProc D_SET_DATE 108 109 procedure D_GET_TIME,NEAR ;System call 44 109 ****************** warning: proc D_GET_TIME... [-w+user] 110 ASSUME DS:NOTHING,ES:NOTHING 111 112 ; Inputs: 113 ; None 114 ; Function: 115 ; Get current time 116 ; Returns: 117 ; Time in CX:DX 118 0 00000F63 161F Context DS 0 00000F65 E87A00 CALL READTIME 0 00000F68 E8[0000] invoke get_user_stack ;Get pointer to user registers 0 00000F6B 895406 MOV [SI + user_DX],DX 0 00000F6E 894C04 MOV [SI + user_CX],CX 0 00000F71 30C0 XOR AL,AL 0 00000F73 C3 RET26: return 126 EndProc D_GET_TIME 127 128 procedure D_SET_TIME,NEAR ;System call 45 128 ****************** warning: proc D_SET_TIME... [-w+user] 129 ASSUME DS:NOTHING,ES:NOTHING 130 131 ; Inputs: 132 ; CX:DX = Time 133 ; Function: 134 ; Set time 135 ; Returns: 136 ; AL = -1 time bad, = 0 OK 137 0 00000F74 B0FF MOV AL,-1 ;Flag in case of error 0 00000F76 80FD18 CMP CH,24 ;Check hours 0 00000F79 73F8 JAE RET26 0 00000F7B 80F93C CMP CL,60 ;Check minutes 0 00000F7E 73F3 JAE RET26 0 00000F80 80FE3C CMP DH,60 ;Check seconds 0 00000F83 73EE JAE RET26 0 00000F85 80FA64 CMP DL,100 ;Check 1/100's 0 00000F88 73E9 JAE RET26 0 00000F8A 51 PUSH CX 0 00000F8B 52 PUSH DX 0 00000F8C 161F Context DS 0 00000F8E BB[0000] MOV BX,OFFSET TIMEBUF wrt DOSGROUP 0 00000F91 B90600 MOV CX,6 0 00000F94 31D2 XOR DX,DX 0 00000F96 89D0 MOV AX,DX 0 00000F98 53 PUSH BX 0 00000F99 E8[0000] invoke SETREAD 156 DOSAssume CS,,"TIME/SetRead" 0 00000F9C 1E PUSH DS 0 00000F9D C536[0000] LDS SI,[BCLOCK] 159 ASSUME DS:NOTHING 0 00000FA1 E8[0000] invoke DEVIOCALL2 ;Get correct day count 0 00000FA4 1F POP DS 162 DOSAssume CS,,"TIME/DevIOCall2" 0 00000FA5 5B POP BX 0 00000FA6 E8[0000] invoke SETWRITE 0 00000FA9 8F06[0400] POP WORD PTR [TIMEBUF+4] 0 00000FAD 8F06[0200] POP WORD PTR [TIMEBUF+2] 0 00000FB1 C536[0000] LDS SI,[BCLOCK] 168 ASSUME DS:NOTHING 0 00000FB5 E8[0000] invoke DEVIOCALL2 ;Set the time 0 00000FB8 30C0 XOR AL,AL 0 00000FBA C3 return 172 EndProc D_SET_TIME 173 174 ;SUBTTL DATE16, READTIME, DODATE -- GUTS OF TIME AND DATE 175 ;PAGE 176 177 ; 178 ; Date16 returns the current date in AX, current time in DX 179 ; AX - YYYYYYYMMMMDDDDD years months days 180 ; DX - HHHHHMMMMMMSSSSS hours minutes seconds/2 181 ; 182 ; DS = DOSGROUP on output 183 184 procedure DATE16,NEAR 184 ****************** warning: proc DATE16... [-w+user] 0 00000FBB 161F Context DS 186 ASSUME ES:NOTHING 0 00000FBD 51 PUSH CX 0 00000FBE 06 PUSH ES 0 00000FBF E82000 CALL READTIME 0 00000FC2 07 POP ES 191 assume es:nothing 0 00000FC3 D0E1 SHL CL,1 ;Minutes to left part of byte 0 00000FC5 D0E1 SHL CL,1 0 00000FC7 D1E1 SHL CX,1 ;Push hours and minutes to left end 0 00000FC9 D1E1 SHL CX,1 0 00000FCB D1E1 SHL CX,1 0 00000FCD D0EE SHR DH,1 ;Count every two seconds 0 00000FCF 08F1 OR CL,DH ;Combine seconds with hours and minutes 0 00000FD1 89CA MOV DX,CX 200 ; 201 ; WARNING! MONTH and YEAR must be adjacently allocated 202 ; 0 00000FD3 A1[0000] MOV AX,WORD PTR [MONTH] ;Fetch month and year 0 00000FD6 B104 MOV CL,4 0 00000FD8 D2E0 SHL AL,CL ;Push month to left to make room for day 0 00000FDA D1E0 SHL AX,1 0 00000FDC 59 POP CX 0 00000FDD 0A06[0000] OR AL,[DAY] 0 00000FE1 C3 return 210 EndProc DATE16 211 212 ;Gets time in CX:DX. Figures new date if it has changed. 213 ;Uses AX, CX, DX. 214 215 procedure READTIME,NEAR 215 ****************** warning: proc READTIME... [-w+user] 216 DOSAssume CS,,"ReadTime" 217 ASSUME ES:NOTHING 218 0 00000FE2 C706[0000]0000 MOV word [DATE_FLAG],0 ; reset date flag for CPMIO 0 00000FE8 56 PUSH SI 0 00000FE9 53 PUSH BX 0 00000FEA BB[0000] MOV BX,OFFSET TIMEBUF wrt DOSGROUP 0 00000FED B90600 MOV CX,6 0 00000FF0 31D2 XOR DX,DX 0 00000FF2 89D0 MOV AX,DX 0 00000FF4 E8[0000] invoke SETREAD 0 00000FF7 1E PUSH DS 0 00000FF8 C536[0000] LDS SI,[BCLOCK] 229 ASSUME DS:NOTHING 0 00000FFC E8[0000] invoke DEVIOCALL2 ;Get correct date and time 0 00000FFF 1F POP DS 232 DOSAssume CS,,"ReadTime/DevIOCall2" 0 00001000 5B POP BX 0 00001001 5E POP SI 0 00001002 A1[0000] MOV AX,WORD PTR [TIMEBUF] 0 00001005 8B0E[0200] MOV CX,WORD PTR [TIMEBUF+2] 0 00001009 8B16[0400] MOV DX,WORD PTR [TIMEBUF+4] 0 0000100D 3B06[0000] CMP AX,[DAYCNT_DOS] ;See if day count is the same 0 00001011 74CE retz 0 00001013 3D36AB CMP AX,FOURYEARS*30 ;Number of days in 120 years 0 00001016 733D JAE RET22 ;Ignore if too large 0 00001018 A3[0000] MOV [DAYCNT_DOS],AX 0 0000101B 56 PUSH SI 0 0000101C 51 PUSH CX 0 0000101D 52 PUSH DX ;Save time 0 0000101E 31D2 XOR DX,DX 0 00001020 B9B505 MOV CX,FOURYEARS ;Number of days in 4 years 0 00001023 F7F1 DIV CX ;Compute number of 4-year units 0 00001025 D1E0 SHL AX,1 0 00001027 D1E0 SHL AX,1 0 00001029 D1E0 SHL AX,1 ;Multiply by 8 (no. of half-years) 0 0000102B 89C1 MOV CX,AX ;<240 implies AH=0 0 0000102D BE[0000] MOV SI,OFFSET YRTAB wrt DOSGROUP;Table of days in each year 0 00001030 E82300 CALL DSLIDE ;Find out which of four years we're in 0 00001033 D1E9 SHR CX,1 ;Convert half-years to whole years 0 00001035 7304 JNC SK ;Extra half-year? 0 00001037 81C2C800 ADD DX,200 258 SK: 0 0000103B E82400 CALL SETYEAR 0 0000103E B101 MOV CL,1 ;At least at first month in year 0 00001040 BE[0000] MOV SI,OFFSET MONTAB wrt DOSGROUP ;Table of days in each month 0 00001043 E81000 CALL DSLIDE ;Find out which month we're in 0 00001046 880E[0000] MOV [MONTH],CL 0 0000104A 42 INC DX ;Remainder is day of month (start with one) 0 0000104B 8816[0000] MOV [DAY],DL 0 0000104F E89100 CALL WKDAY ;Set day of week 0 00001052 5A POP DX 0 00001053 59 POP CX 0 00001054 5E POP SI 0 00001055 C3 RET22: return 271 EndProc READTIME 272 273 procedure DSLIDE,NEAR 273 ****************** warning: proc DSLIDE... [-w+user] 0 00001056 B400 MOV AH,0 275 DSLIDE1: 0 00001058 AC LODSB ;Get count of days 0 00001059 39C2 CMP DX,AX ;See if it will fit 0 0000105B 72F8 retc ;If not, done 0 0000105D 29C2 SUB DX,AX 0 0000105F 41 INC CX ;Count one more month/year 0 00001060 EBF6 JMP SHORT DSLIDE1 282 EndProc DSLIDE 283 284 procedure SETYEAR,NEAR 284 ****************** warning: proc SETYEAR... [-w+user] 285 ;Set year with value in CX. Adjust length of February for this year. 0 00001062 880E[0000] MOV BYTE PTR [YEAR],CL 287 288 CHKYR: 0 00001066 F6C103 TEST CL,3 ;Check for leap year 0 00001069 B01C MOV AL,28 0 0000106B 7501 JNZ SAVFEB ;28 days if no leap year 0 0000106D 40 inc ax ;Add leap day 293 SAVFEB: 0 0000106E A2[0100] MOV [MONTAB+1],AL ;Store for February 0 00001071 C3 RET23: return 296 EndProc SETYEAR 297 298 procedure DODATE,NEAR 298 ****************** warning: proc DODATE... [-w+user] 299 DOSAssume CS,,"DoDate" 300 ASSUME ES:NOTHING 0 00001072 E8F1FF CALL CHKYR ;Set Feb. up for new year 0 00001075 88F0 MOV AL,DH 0 00001077 BB[FFFF] MOV BX,OFFSET MONTAB-1 wrt DOSGROUP ; access with ds 0 0000107A D7 xlatb;Look up days in month 0 0000107B 38D0 CMP AL,DL 0 0000107D B0FF MOV AL,-1 ;Restore error flag, just in case 0 0000107F 72F0 retc ;Error if too many days 0 00001081 E8DEFF CALL SETYEAR 309 ; 310 ; WARNING! DAY and MONTH must be adjacently allocated 311 ; 0 00001084 8916[0000] MOV WORD PTR [DAY],DX ;Set both day and month 0 00001088 D1E9 SHR CX,1 0 0000108A D1E9 SHR CX,1 0 0000108C B8B505 MOV AX,FOURYEARS 0 0000108F 89D3 MOV BX,DX 0 00001091 F7E1 MUL CX 0 00001093 8A0E[0000] MOV CL,BYTE PTR [YEAR] 0 00001097 80E103 AND CL,3 0 0000109A BE[0000] MOV SI,OFFSET YRTAB wrt DOSGROUP 0 0000109D 89C2 MOV DX,AX 0 0000109F D1E1 SHL CX,1 ;Two entries per year, so double count 0 000010A1 E85200 CALL DSUM ;Add up the days in each year 0 000010A4 88F9 MOV CL,BH ;Month of year 0 000010A6 BE[0000] MOV SI,OFFSET MONTAB wrt DOSGROUP 0 000010A9 49 DEC CX ;Account for months starting with one 0 000010AA E84900 CALL DSUM ;Add up days in each month 0 000010AD 88D9 MOV CL,BL ;Day of month 0 000010AF 49 DEC CX ;Account for days starting with one 0 000010B0 01CA ADD DX,CX ;Add in to day total 0 000010B2 92 XCHG AX,DX ;Get day count in AX 0 000010B3 A3[0000] MOV [DAYCNT_DOS],AX 0 000010B6 56 PUSH SI 0 000010B7 53 PUSH BX 0 000010B8 50 PUSH AX 0 000010B9 BB[0000] MOV BX,OFFSET TIMEBUF wrt DOSGROUP 0 000010BC B90600 MOV CX,6 0 000010BF 31D2 XOR DX,DX 0 000010C1 89D0 MOV AX,DX 0 000010C3 53 PUSH BX 0 000010C4 E8[0000] invoke SETREAD 342 DOSAssume CS,,"DoDate/SetRead" 0 000010C7 1E PUSH DS 0 000010C8 C536[0000] LDS SI,[BCLOCK] 345 ASSUME DS:NOTHING 0 000010CC E8[0000] invoke DEVIOCALL2 ;Get correct date and time 0 000010CF 1F POP DS 348 DOSAssume CS,,"DoDate/DevIOCall2" 0 000010D0 5B POP BX 0 000010D1 E8[0000] invoke SETWRITE 0 000010D4 8F06[0000] POP WORD PTR [TIMEBUF] 0 000010D8 1E PUSH DS 0 000010D9 C536[0000] LDS SI,[BCLOCK] 354 ASSUME DS:NOTHING 0 000010DD E8[0000] invoke DEVIOCALL2 ;Set the date 0 000010E0 1F POP DS 357 DOSAssume CS,,"DoDate/DevIOCall2(second)" 0 000010E1 5B POP BX 0 000010E2 5E POP SI 360 WKDAY: 0 000010E3 A1[0000] MOV AX,[DAYCNT_DOS] 0 000010E6 31D2 XOR DX,DX 0 000010E8 B90700 MOV CX,7 0 000010EB 40 INC AX 0 000010EC 40 INC AX ;First day was Tuesday 0 000010ED F7F1 DIV CX ;Compute day of week 0 000010EF 8816[0000] MOV [WEEKDAY],DL 0 000010F3 30C0 XOR AL,AL ;Flag OK 0 000010F5 C3 Ret25: return 370 EndProc DODATE 371 372 procedure DSUM,NEAR 372 ****************** warning: proc DSUM... [-w+user] 0 000010F6 B400 MOV AH,0 374 RET25 equ Ret25 ; NASM port label 0 000010F8 E3FB JCXZ RET25 376 DSUM1: 0 000010FA AC LODSB 0 000010FB 01C2 ADD DX,AX 0 000010FD E2FB LOOP DSUM1 0 000010FF C3 return 381 EndProc DSUM 382 383 END 384 385 === Trace listing source: ../DOS/getset.lst 1 ; SCCSID = @(#)getset.asm 1.2 85/07/23 2 ;TITLE GETSET - GETting and SETting MS-DOS system calls 3 ;NAME GETSET 4 ; 5 ; System Calls which get and set various things 6 ; 7 ; $GET_VERSION 8 ; $GET_VERIFY_ON_WRITE 9 ; $SET_VERIFY_ON_WRITE 10 ; $INTERNATIONAL 11 ; $GET_DRIVE_FREESPACE 12 ; $GET_DMA 13 ; $SET_DMA 14 ; $GET_DEFAULT_DRIVE 15 ; $SET_DEFAULT_DRIVE 16 ; $GET_INTERRUPT_VECTOR 17 ; $SET_INTERRUPT_VECTOR 18 ; RECSET 19 ; $CHAR_OPER 20 ; $GetExtendedError DOS 3.3 21 ; Get_Global_CdPg DOS 4.0 22 ; $ECS_CALL DOS 4.0 23 ; 24 ; Revision history: 25 ; 26 ; Created: ARR 30 March 1983 27 ; 28 ; A000 version 4.0 Jan. 1988 29 ; A006 D503-- fake version for IBMCACHE 30 ; A008 P4070- faske version for MS WINDOWS 31 32 [list -] 32 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 37 38 %ifndef ALTVECT 39 %iassign ALTVECT 0 ; FALSE 40 %endif 41 42 [list +] === Switch to base=002450h -> "DOSCODECODE" 43 section DOSCODECODE 44 [list -] 44 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 44 ****************** warning: out: BPB.INC... [-w+user] 44 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 44 ****************** warning: out: DEVSYM.INC... [-w+user] 52 53 i_need USERNUM,WORD 54 i_need MSVERS,WORD 55 I_need doslocation3001, byte 56 i_need VERFLG,BYTE 57 i_need CNTCFLAG,BYTE 58 i_need DMAADD,DWORD 59 i_need CURDRV,BYTE 60 i_need chSwitch,BYTE 61 i_need COUNTRY_CDPG,byte ;DOS 3.3 62 I_need CDSCount,BYTE 63 I_need ThisCDS,DWORD 64 i_need EXTERR,WORD 65 i_need EXTERR_ACTION,BYTE 66 i_need EXTERR_CLASS,BYTE 67 i_need EXTERR_LOCUS,BYTE 68 i_need EXTERRPT,DWORD 69 i_need UCASE_TAB,BYTE 70 i_need FILE_UCASE_TAB,BYTE 71 i_need InterCon,BYTE 72 i_need CURRENTPDB,WORD 73 i_need DBCS_TAB,BYTE ;AN000; 74 i_need Special_version,WORD ;AN006; 75 i_need Fake_Count,BYTE ;AN008; 76 i_need NLS_YES,BYTE ;AN000; 77 i_need NLS_yes2,BYTE ;AN000; 78 i_need NLS_NO,BYTE ;AN000; 79 i_need NLS_no2,BYTE ;AN000; 80 81 82 assume nocheck, ss:DOSGROUP 83 84 BREAK <$Get_Version -- Return DOS version number> 85 procedure D_GET_VERSION,NEAR 85 ****************** warning: proc D_GET_VERSION... [-w+user] 86 ASSUME DS:NOTHING,ES:NOTHING 87 88 ; Inputs: 89 ; None 90 ; Function: 91 ; Return DOS version number 92 ; Outputs: 93 ; OEM number in BH 94 ; User number in BL:CX (24 bits) 95 ; Version number as AL.AH in binary 96 ; NOTE: On pre 1.28 DOSs AL will be zero 97 0 00001100 161F context DS 0 00001102 8B1E[0200] MOV BX,[USERNUM + 2] 0 00001106 8B0E[0000] MOV CX,[USERNUM] 0 0000110A 3C01 cmp al, 1 0 0000110C 7504 jne .use_oem_id 0 0000110E 8A3E[0000] mov bh, [doslocation3001] 104 .use_oem_id: 0 00001112 A1[0000] MOV AX,[MSVERS] 0 00001115 E8[0000] invoke get_user_stack 107 ASSUME DS:NOTHING 0 00001118 895C02 MOV [SI + user_BX],BX 0 0000111B 894C04 MOV [SI + user_CX],CX 0 0000111E 36803E[0000]FF CMP byte [ss:Fake_Count],0FFH ;AN008; 0 00001124 740D JZ reg ;AN008; 0 00001126 36803E[0000]00 CMP byte [ss:Fake_Count],0 ;AN008; 0 0000112C 7411 JZ usual ;AN008; 0 0000112E 36FE0E[0000] DEC byte [ss:Fake_Count] ;AN008; 115 reg: ;AN008; 0 00001133 36833E[0000]00 CMP word [ss:Special_version],0 ;AN006; 0 00001139 7404 JZ usual ;AN006; 0 0000113B 36A1[0000] MOV AX,[ss:Special_version] ;AN006; 119 usual: ;AN006; 0 0000113F 8904 MOV [SI + user_AX],AX ; Really only sets AH 0 00001141 C3 return 122 EndProc D_GET_VERSION 123 124 BREAK <$Get_Verify_on_Write - return verify-after-write flag> 125 procedure D_GET_VERIFY_ON_WRITE,NEAR 125 ****************** warning: proc D_GET_VERIFY_ON_WRITE... [-w+user] 126 ASSUME DS:NOTHING,ES:NOTHING 127 128 ; Inputs: 129 ; none. 130 ; Function: 131 ; returns flag 132 ; Returns: 133 ; AL = value of VERIFY flag 134 0 00001142 36A0[0000] MOV AL,[ss:VERFLG] 0 00001146 C3 return 137 EndProc D_GET_VERIFY_ON_WRITE 138 139 BREAK <$Set_Verify_on_Write - Toggle verify-after-write flag> 140 procedure D_SET_VERIFY_ON_WRITE,NEAR 140 ****************** warning: proc D_SET_VERIFY_ON_WRITE... [-w+user] 141 ASSUME DS:NOTHING,ES:NOTHING 142 143 ; Inputs: 144 ; AL = desired value of VERIFY flag 145 ; Function: 146 ; Sets flag 147 ; Returns: 148 ; None 149 0 00001147 2401 AND AL,1 0 00001149 36A2[0000] MOV [ss:VERFLG],AL 0 0000114D C3 return 153 EndProc D_SET_VERIFY_ON_WRITE 154 155 BREAK <$International - return country-dependent information> 156 ; 157 ; Inputs: 158 ; MOV AH,International 159 ; MOV AL,country (al = 0 => current country) 160 ; [MOV BX,country] 161 ; LDS DX,block 162 ; INT 21 163 ; Function: 164 ; give users an idea of what country the application is running 165 ; Outputs: 166 ; IF DX != -1 on input (get country) 167 ; AL = 0 means return current country table. 168 ; 0 internat_block_max, 179 ; in the correct order for being returned by the 180 ; INTERNATIONAL call as follows: 181 ; WORD Date format 0=mdy, 1=dmy, 2=ymd 182 ; 5 BYTE Currency symbol null terminated 183 ; 2 BYTE thousands separator null terminated 184 ; 2 BYTE Decimal point null terminated 185 ; 2 BYTE Date separator null terminated 186 ; 2 BYTE Time separator null terminated 187 ; 1 BYTE Bit field. Currency format. 188 ; Bit 0. =0 $ before # =1 $ after # 189 ; Bit 1. no. of spaces between # and $ (0 or 1) 190 ; 1 BYTE No. of significant decimal digits in currency 191 ; 1 BYTE Bit field. Time format. 192 ; Bit 0. =0 12 hour clock =1 24 hour 193 ; DWORD Call address of case conversion routine 194 ; 2 BYTE Data list separator null terminated. 195 ; Carry: 196 ; Register AX has the error code. 197 ; IF DX = -1 on input (set current country) 198 ; AL = 0 is an error 199 ; 0 295 ; 296 ; Inputs: 297 ; if AL >= 20H 298 ; AL= 20H capitalize single char, DL= char 299 ; 21H capitalize string ,CX= string length 300 ; 22H capitalize ASCIIZ string 301 ; 23H YES/NO check, DL=1st char DH= 2nd char (DBCS) 302 ; 80H bit 0 = use normal upper case table 303 ; 1 = use file upper case table 304 ; DS:DX points to string 305 ; 306 ; else 307 ; 308 ; MOV AH,GetExtCntry ; DOS 3.3 309 ; MOV AL,INFO_ID ( info type,-1 selects all) 310 ; MOV BX,CODE_PAGE ( -1 = active code page ) 311 ; MOV DX,COUNTRY_ID ( -1 = active country ) 312 ; MOV CX,SIZE ( amount of data to return) 313 ; LES DI,COUNTRY_INFO ( buffer for returned data ) 314 ; INT 21 315 ; Function: 316 ; give users extended country dependent information 317 ; or capitalize chars 318 ; Outputs: 319 ; No Carry: 320 ; extended country info is succesfully returned 321 ; Carry: 322 ; Register AX has the error code. 323 ; AX=0, NO for YES/NO CHECK 324 ; 1, YES 325 326 327 procedure D_GetExtCntry,NEAR ; DOS 3.3 327 ****************** warning: proc D_GetExtCntry... [-w+user] 328 ASSUME DS:NOTHING,ES:NOTHING 0 000011D5 3C20 CMP AL,CAP_ONE_CHAR ;AN000;MS. < 20H ? 0 000011D7 7303 JAE capcap ;AN000;MS. 0 000011D9 EB6B JMP notcap ;AN000;MS. yes 0 000011DB 90 nop ; identicalise 333 capcap: ;AN000; 0 000011DC A880 TEST AL,UPPER_TABLE ;AN000;MS. which upper case table 0 000011DE 7505 JNZ fileupper ;AN000;MS. file upper case 0 000011E0 BB[0200] MOV BX,OFFSET UCASE_TAB+2 wrt DOSGROUP ;AN000;MS. get normal upper case 0 000011E3 EB03 JMP SHORT capit ;AN000;MS. 338 fileupper: ;AN000; 0 000011E5 BB[0200] MOV BX,OFFSET FILE_UCASE_TAB+2 wrt DOSGROUP;AN000;MS. get file upper case 340 capit: ;AN000; 0 000011E8 3C20 CMP AL,CAP_ONE_CHAR ;AN000;;MS.cap one char ? 0 000011EA 750D JNZ chkyes ;AN000;;MS. no 0 000011EC 88D0 MOV AL,DL ;AN000;;MS. set up AL 0 000011EE E8[0000] invoke GETLET3 ;AN000;;MS. upper case it 0 000011F1 E8[0000] invoke get_user_stack ;AN000;;MS. get user stack 0 000011F4 884406 MOV byte ptr [SI + user_DX],AL;AN000;;MS. user's DL=AL 0 000011F7 EB24 JMP SHORT nono ;AN000;;MS. done 348 chkyes: ;AN000; 0 000011F9 3C23 CMP AL,CHECK_YES_NO ;AN000;;MS. check YES or NO ? 0 000011FB 7522 JNZ capstring ;AN000;;MS. no 0 000011FD 31C0 XOR AX,AX ;AN000;;MS. presume NO 352 %IF DBCS ;AN000; 353 PUSH AX ;AN000;;MS. 354 MOV AL,DL ;AN000;;MS. 355 invoke TESTKANJ ;AN000;;MS. DBCS ? 356 POP AX ;AN000;;MS. 357 JNZ dbcs_char ;AN000;;MS. yes, return error 358 %ENDIF ;AN000; 359 ;AN000; 0 000011FF 363A16[0000] CMP DL,[ss:NLS_YES] ;AN000;;MS. is 'Y' ? 0 00001204 7416 JZ yesyes ;AN000;;MS. yes 0 00001206 363A16[0000] CMP DL,[ss:NLS_yes2] ;AN000;;MS. is 'y' ? 0 0000120B 740F JZ yesyes ;AN000;;MS. yes 0 0000120D 363A16[0000] CMP DL,[ss:NLS_NO] ;AN000;;MS. is 'N'? 0 00001212 7409 JZ nono ;AN000;;MS. no 0 00001214 363A16[0000] CMP DL,[ss:NLS_no2] ;AN000;;MS. is 'n' ? 0 00001219 7402 JZ nono ;AN000;;MS. no 368 dbcs_char: ;AN000; 0 0000121B 40 INC AX ;AN000;;MS. not YES or NO 370 yesyes: ;AN000' 0 0000121C 40 INC AX ;AN000;;MS. return 1 372 nono: ;AN000; 0 0000121D EBA0 transfer SYS_RET_OK ;AN000;;MS. done 374 capstring: ;AN000; 0 0000121F 89D6 MOV SI,DX ;AN000;;MS. si=dx 0 00001221 3C21 CMP AL,CAP_STRING ;AN000;;MS. cap string ? 0 00001223 7510 JNZ capascii ;AN000;;MS. no 0 00001225 83F900 CMP CX,0 ;AN000;;MS. check count 0 0 00001228 74F3 JZ nono ;AN000;;MS. yes finished 380 concap: ;AN000; 0 0000122A AC LODSB ;AN000;;MS. get char 382 %IF DBCS ;AN000;;MS. 383 invoke TESTKANJ ;AN000;;MS. DBCS ? 384 JZ notdbcs ;AN000;;MS. no 385 INC SI ;AN000;;MS. skip 2 chars 386 DEC CX ;AN000;;MS. bad input, one DBCS char at end 387 JZ nono ;AN000;;MS. yes 388 JMP SHORT next99 ;AN000;;MS. 389 notdbcs: ;AN000; 390 %ENDIF ;AN000; 391 0 0000122B E8[0000] invoke GETLET3 ;AN000;;MS. upper case it 0 0000122E 8844FF MOV byte ptr [SI-1],AL ;AN000;;MS. store back 394 next99: ;AN000; 0 00001231 E2F7 LOOP concap ;AN000;;MS. continue 0 00001233 EBE8 JMP nono ;AN000;;MS. done 397 capascii: ;AN000; 0 00001235 3C22 CMP AL,CAP_ASCIIZ ;AN000;;MS. cap ASCIIZ string ? 0 00001237 7545 JNZ capinval ;AN000;;MS. no 400 concap2: ;AN000; 0 00001239 AC LODSB ;AN000;;MS. get char 0 0000123A 3C00 CMP AL,0 ;AN000;;MS. end of string ? 0 0000123C 74DF JZ nono ;AN000;;MS. yes 404 %IF DBCS ;AN000;;MS. 405 invoke TESTKANJ ;AN000;;MS. DBCS ? 406 JZ notdbcs2 ;AN000;;MS. no 407 CMP BYTE PTR [SI],0 ;AN000;;MS. bad input, one DBCS char at end 408 JZ nono ;AN000;;MS. yes 409 INC SI ;AN000;;MS. skip 2 chars 410 JMP concap2 ;AN000;;MS. 411 notdbcs2: ;AN000; 412 %ENDIF ;AN000; 0 0000123E E8[0000] invoke GETLET3 ;AN000;;MS. upper case it 0 00001241 8844FF MOV byte ptr [SI-1],AL ;AN000;;MS. store back 0 00001244 EBF3 JMP concap2 ;AN000;;MS. continue 416 417 418 notcap: 0 00001246 83F905 CMP CX,5 ; minimum size is 5 0 00001249 7278 JB sizeerror 0 0000124B 161F context DS 0 0000124D BE[0000] MOV SI,OFFSET COUNTRY_CDPG wrt DOSGROUP 0 00001250 83FAFF CMP DX,-1 ; active country ? 0 00001253 7503 JNZ GETCDPG ; no 0 00001255 8B5468 MOV DX,[SI + ccDosCountry] ; get active country id 426 GETCDPG: 0 00001258 83FBFF CMP BX,-1 ; active code page? 0 0000125B 7503 JNZ CHKAGAIN ; no, check again 0 0000125D 8B5C6A MOV BX,[SI + ccDosCodePage] ; get active code page id 430 CHKAGAIN: 0 00001260 3B5468 CMP DX,[SI + ccDosCountry] ; same as active country id? 0 00001263 7551 JNZ CHKNLS ; no 0 00001265 3B5C6A CMP BX,[SI + ccDosCodePage] ; same as active code page id? 0 00001268 754C JNZ CHKNLS ; no 435 CHKTYPE: 0 0000126A 8B5C48 MOV BX,[SI + ccSysCodePage] ; bx = sys code page id 437 ; CMP AL,SetALL ; select all? 438 ; JNZ SELONE 439 ; MOV SI,OFFSET COUNTRY_CDPG + ccNumber_of_entries wrt DOSGROUP 440 SELONE: 0 0000126D 51 PUSH CX ; save cx 0 0000126E 8B4C4A MOV CX,[SI + ccNumber_of_entries] 0 00001271 BE[4C00] MOV SI,OFFSET COUNTRY_CDPG + ccSetUcase wrt DOSGROUP 444 NXTENTRY: 0 00001274 3A04 CMP AL,[SI] ; compare info type 0 00001276 740B JZ FOUNDIT 0 00001278 83C605 ADD SI,5 ; next entry 0 0000127B E2F7 LOOP NXTENTRY 0 0000127D 59 POP CX 450 capinval: 0 0000127E B001E9[0000] error error_Invalid_Function ; info type not found 452 FOUNDIT: 0 00001283 A4 MOVSB ; move info id byte 0 00001284 59 POP CX ; retsore char count 0 00001285 3C01 CMP AL,SetCountryInfo ; select country info type ? 0 00001287 7414 JZ setsize 0 00001289 B90400 MOV CX,4 ; 4 bytes will be moved 0 0000128C B80500 MOV AX,5 ; 5 bytes will be returned in CX 459 OK_RETN: 0 0000128F F3A4 REP MOVSB ; copy info 0 00001291 89C1 MOV CX,AX ; CX = actual length returned 0 00001293 89D8 MOV AX,BX ; return sys code page in ax 463 GETDONE: 0 00001295 E8[0000] invoke get_user_stack ; return actual length to user's CX 0 00001298 894C04 MOV [SI + user_CX],CX 0 0000129B EB80 transfer SYS_RET_OK 467 setsize: 0 0000129D 83E903 SUB CX,3 ; size after length field 0 000012A0 390C CMP WORD PTR [SI],CX ; less than table size 0 000012A2 7302 JAE setsize2 ; no 0 000012A4 8B0C MOV CX,WORD PTR [SI] ; truncate to table size 472 setsize2: 0 000012A6 26890D MOV [ES:DI],CX ; copy actual length to user's 0 000012A9 83C702 ADD DI,2 ; update index 0 000012AC 83C602 ADD SI,2 0 000012AF 89C8 MOV AX,CX 0 000012B1 83C003 ADD AX,3 ; AX has the actual length 0 000012B4 EBD9 JMP OK_RETN ; go move it 479 CHKNLS: 0 000012B6 30E4 XOR AH,AH 0 000012B8 50 PUSH AX ; save info type 0 000012B9 5D POP BP ; bp = info type 0 000012BA B80014CD2F CallInstall NLSInstall,NLSFUNC,0 ; check if NLSFUNC in memory 0 000012BF 3CFF CMP AL,0FFH 0 000012C1 7404 JZ NLSNXT ; in memory 486 sizeerror: 0 000012C3 B001EBB9 error error_Invalid_Function 0 000012C7 B80214CD2F NLSNXT: CallInstall GetExtInfo,NLSFUNC,2 ;get extended info 0 000012CC 3C00 CMP AL,0 ; success ? 0 000012CE 7505 JNZ NLSERROR 0 000012D0 8B4448 MOV AX,[SI + ccSysCodePage] ; ax = sys code page id 0 000012D3 EBC0 JMP GETDONE 493 NLSERROR: 0 000012D5 EBEE transfer SYS_RET_ERR ; return what is got from NLSFUNC 495 496 EndProc D_GetExtCntry 497 498 BREAK <$GetSetCdPg - get or set global code page> 499 ; 500 ; Inputs: 501 ; MOV AH,GetSetCdPg ; DOS 3.3 502 ; MOV AL,n ; n = 1 : get code page, n = 2 : set code page 503 ; MOV BX,CODE_PAGE ( set code page only) 504 ; INT 21 505 ; Function: 506 ; get or set the global code page 507 ; Outputs: 508 ; No Carry: 509 ; global code page is set (set global code page) 510 ; BX = active code page id (get global code page) 511 ; DX = system code page id (get global code page) 512 ; Carry: 513 ; Register AX has the error code. 514 515 516 procedure D_GetSetCdPg,NEAR ; DOS 3.3 516 ****************** warning: proc D_GetSetCdPg... [-w+user] 517 ASSUME DS:NOTHING,ES:NOTHING 0 000012D7 161F context DS 0 000012D9 BE[0000] MOV SI,OFFSET COUNTRY_CDPG wrt DOSGROUP 0 000012DC 3C01 CMP AL,1 ; get global code page 0 000012DE 7511 JNZ setglpg ; set global cod epage 0 000012E0 8B5C6A MOV BX,[SI + ccDosCodePage] ; get active code page id 0 000012E3 8B5448 MOV DX,[SI + ccSysCodePage] ; get sys code page id 0 000012E6 E8[0000] invoke get_user_stack 525 ASSUME DS:NOTHING 0 000012E9 895C02 MOV [SI + user_BX],BX ; update returned bx 0 000012EC 895406 MOV [SI + user_DX],DX ; update returned dx 528 OK_RETURN: 0 000012EF EBAA transfer SYS_RET_OK 530 ASSUME DS:DOSGROUP 531 setglpg: 0 000012F1 3C02 CMP AL,2 0 000012F3 7533 JNZ nomem 534 ;;;;;;; CMP BX,[SI.ccDosCodePage] ; same as active code page 535 ;;;;;;; JZ OK_RETURN ; yes 0 000012F5 8B5468 MOV DX,[SI + ccDosCountry] 0 000012F8 B80014CD2F CallInstall NLSInstall,NLSFUNC,0 ; check if NLSFUNC in memory 0 000012FD 3CFF CMP AL,0FFH 0 000012FF 7527 JNZ nomem ; not in memory 0 00001301 B80114CD2F CallInstall SetCodePage,NLSFUNC,1 ;set the code page 0 00001306 3C00 CMP AL,0 ; success ? 0 00001308 74E5 JZ OK_RETURN ; yes 0 0000130A 3C41 CMP AL,65 ; set device code page failed 0 0000130C 7518 JNZ .seterr 0 0000130E B84100 MOV AX,65 0 00001311 A3[0000] MOV [EXTERR],AX 0 00001314 C606[0000]06 MOV byte [EXTERR_ACTION],errACT_Ignore 0 00001319 C606[0000]05 MOV byte [EXTERR_CLASS],errCLASS_HrdFail 0 0000131E C606[0000]04 MOV byte [EXTERR_LOCUS],errLOC_SerDev 0 00001323 E9[0000] transfer From_GetSet 551 552 .seterr: 0 00001326 EBAD transfer SYS_RET_ERR 554 nomem: 0 00001328 B001EBFA error error_Invalid_Function ; function not defined 556 ; 557 EndProc D_GetSetCdPg 558 559 560 561 562 BREAK <$Get_Drive_Freespace -- Return bytes of free disk space on a drive> 563 procedure D_GET_DRIVE_FREESPACE,NEAR 563 ****************** warning: proc D_GET_DRIVE_FREESPACE... [-w+user] 564 ASSUME DS:NOTHING,ES:NOTHING 565 566 ; Inputs: 567 ; DL = Drive number 568 ; Function: 569 ; Return number of free allocation units on drive 570 ; Outputs: 571 ; BX = Number of free allocation units 572 ; DX = Total Number of allocation units on disk 573 ; CX = Sector size 574 ; AX = Sectors per allocation unit 575 ; = -1 if bad drive specified 576 ; This call returns the same info in the same registers (except for FAT pointer) 577 ; as the old FAT pointer calls 578 0 0000132C 161F context DS 0 0000132E 88D0 MOV AL,DL 0 00001330 E8[0000] invoke GetThisDrv ; Get drive 582 SET_AX_RET: 0 00001333 721A JC BADFDRV 0 00001335 E8[0000] invoke DISK_INFO 0 00001338 87D3 XCHG DX,BX 0 0000133A 72F7 JC SET_AX_RET ; User FAILed to I 24 0 0000133C 48 dec ax 0 0000133D 30E4 XOR AH,AH ; Chuck Fat ID byte 0 0000133F 40 inc ax ; translate EDR-DOS 0 to 256 590 DoSt: 0 00001340 E8[0000] invoke get_user_stack 592 ASSUME DS:NOTHING 0 00001343 895406 MOV [SI + user_DX],DX 0 00001346 894C04 MOV [SI + user_CX],CX 0 00001349 895C02 MOV [SI + user_BX],BX 0 0000134C 8904 MOV [SI + user_AX],AX 0 0000134E C3 return 598 BADFDRV: 599 ; MOV AL,error_invalid_drive ; Assume error 0 0000134F E8[0000] invoke FCB_RET_ERR 0 00001352 B8FFFF MOV AX,-1 0 00001355 EBE9 JMP DoSt 603 EndProc D_GET_DRIVE_FREESPACE 604 605 BREAK <$Get_DMA, $Set_DMA -- Get/Set current DMA address> 606 procedure D_GET_DMA,NEAR 606 ****************** warning: proc D_GET_DMA... [-w+user] 607 ASSUME DS:NOTHING,ES:NOTHING 608 609 ; Inputs: 610 ; None 611 ; Function: 612 ; Get DISK TRANSFER ADDRESS 613 ; Returns: 614 ; ES:BX is current transfer address 615 0 00001357 368B1E[0000] MOV BX,WORD PTR [ss:DMAADD] 0 0000135C 368B0E[0200] MOV CX,WORD PTR [ss:DMAADD+2] 0 00001361 E8[0000] invoke get_user_stack 0 00001364 895C02 MOV [SI + user_BX],BX 0 00001367 894C10 MOV [SI + user_ES],CX 0 0000136A C3 return 622 EndProc D_GET_DMA 623 624 procedure D_SET_DMA,NEAR 624 ****************** warning: proc D_SET_DMA... [-w+user] 625 ASSUME DS:NOTHING,ES:NOTHING 626 627 ; Inputs: 628 ; DS:DX is desired new disk transfer address 629 ; Function: 630 ; Set DISK TRANSFER ADDRESS 631 ; Returns: 632 ; None 633 0 0000136B 368916[0000] MOV WORD PTR [ss:DMAADD],DX 0 00001370 368C1E[0200] MOV WORD PTR [ss:DMAADD+2],DS 0 00001375 C3 return 637 EndProc D_SET_DMA 638 639 BREAK <$Get_Default_Drive, $Set_Default_Drive -- Set/Get default drive> 640 procedure D_GET_DEFAULT_DRIVE,NEAR 640 ****************** warning: proc D_GET_DEFAULT_DRIVE... [-w+user] 641 ASSUME DS:NOTHING,ES:NOTHING 642 643 ; Inputs: 644 ; None 645 ; Function: 646 ; Return current drive number 647 ; Returns: 648 ; AL = drive number 649 0 00001376 36A0[0000] MOV AL,[ss:CURDRV] 0 0000137A C3 return 652 EndProc D_GET_DEFAULT_DRIVE 653 654 procedure D_SET_DEFAULT_DRIVE,NEAR 654 ****************** warning: proc D_SET_DEFAULT_DRIVE... [-w+user] 655 ASSUME DS:NOTHING,ES:NOTHING 656 657 ; Inputs: 658 ; DL = Drive number for new default drive 659 ; Function: 660 ; Set the default drive 661 ; Returns: 662 ; AL = Number of drives, NO ERROR RETURN IF DRIVE NUMBER BAD 663 0 0000137B 88D0 MOV AL,DL 0 0000137D FEC0 INC AL ; A=1, b=2... 0 0000137F E8[0000] invoke GetVisDrv ; see if visible drive 0 00001382 7204 JC SETRET ; errors do not set 668 ; LDS SI,ThisCDS ; get CDS 669 ; TEST [SI].curdir_flags,curdir_splice ; was it spliced? 670 ; JNZ SetRet ; yes, do not set 0 00001384 36A2[0000] MOV [ss:CURDRV],AL ; no, set 672 SETRET: 673 CDSCOUNT equ CDSCount ; NASM port label 0 00001388 36A0[0000] MOV AL,[ss:CDSCOUNT] ; let user see what the count really is 0 0000138C C3 RET17: return 676 EndProc D_SET_DEFAULT_DRIVE 677 678 BREAK <$Get_Interrupt_Vector - Get/Set interrupt vectors> 679 procedure D_GET_INTERRUPT_VECTOR,NEAR 679 ****************** warning: proc D_GET_INTERRUPT_VECTOR... [-w+user] 680 ASSUME DS:NOTHING,ES:NOTHING 681 682 ; Inputs: 683 ; AL = interrupt number 684 ; Function: 685 ; Get the interrupt vector 686 ; Returns: 687 ; ES:BX is current interrupt vector 688 0 0000138D E81A00 CALL RECSET 0 00001390 26C41F LES BX,[ES:BX] 691 assume es:nothing 0 00001393 E8[0000] invoke get_user_stack 0 00001396 895C02 MOV [SI + user_BX],BX 0 00001399 8C4410 MOV [SI + user_ES],ES 0 0000139C C3 return 696 EndProc D_GET_INTERRUPT_VECTOR 697 698 procedure D_SET_INTERRUPT_VECTOR,NEAR 698 ****************** warning: proc D_SET_INTERRUPT_VECTOR... [-w+user] 699 ASSUME DS:NOTHING,ES:NOTHING 700 701 ; Inputs: 702 ; AL = interrupt number 703 ; DS:DX is desired new interrupt vector 704 ; Function: 705 ; Set the interrupt vector 706 ; Returns: 707 ; None 708 0 0000139D E80A00 CALL RECSET 0 000013A0 FA CLI ; Watch out!!!!! Folks sometimes use 0 000013A1 268917 MOV [ES:BX],DX ; this for hardware ints (like timer). 0 000013A4 268C5F02 MOV [ES:BX+2],DS 0 000013A8 FB STI 0 000013A9 C3 return 715 EndProc D_SET_INTERRUPT_VECTOR 716 717 %IF ALTVECT 718 invalid instruction fixme 719 ; ldos: section ? 720 === Switch to base=000E10h -> "TABLE" 721 section TABLE 722 VECIN: 723 ; INPUT VECTORS 724 Public GSET001S,GSET001E 725 GSET001S label byte 726 DB 22H ; Terminate 727 DB 23H ; ^C 728 DB 24H ; Hard error 729 DB 28H ; Spooler 730 LSTVEC DB ? ; ALL OTHER 731 732 VECOUT: 733 ; GET MAPPED VECTOR 734 DB int_terminate 735 DB int_ctrl_c 736 DB int_fatal_abort 737 DB int_spooler 738 LSTVEC2 DB ? ; Map to itself 739 740 NUMVEC equ VECOUT-VECIN 741 GSET001E label byte === Switch to base=002450h -> "DOSCODECODE" 742 TABLE ENDS 743 %ENDIF 744 745 procedure RECSET,NEAR 745 ****************** warning: proc RECSET... [-w+user] 746 747 %IF ALTVECT 748 context ES 749 MOV [LSTVEC],AL ; Terminate list with real vector 750 MOV [LSTVEC2],AL ; Terminate list with real vector 751 MOV CX,NUMVEC ; Number of possible translations 752 MOV DI,OFFSET VECIN wrt DOSGROUP ; Point to vectors 753 REPNE SCASB 754 MOV AL,[ES:DI+NUMVEC-1] ; Get translation 755 %ENDIF 756 0 000013AA 31DB XOR BX,BX 0 000013AC 8EC3 MOV ES,BX 759 assume es:IVT 0 000013AE 88C3 MOV BL,AL 0 000013B0 D1E3 SHL BX,1 0 000013B2 D1E3 SHL BX,1 0 000013B4 C3 return 764 EndProc recset 765 766 BREAK <$Char_Oper - hack on paths, switches so that xenix can look like PCDOS> 767 ; 768 ; input: AL = function: 769 ; 0 - read switch char 770 ; 1 - set switch char (char in DL) 771 ; 2 - read device availability 772 ; Always returns available 773 ; 3 - set device availability 774 ; No longer supported (NOP) 775 ; output: (get) DL - character/flag 776 ; 777 procedure D_CHAR_OPER,NEAR 777 ****************** warning: proc D_CHAR_OPER... [-w+user] 778 ASSUME DS:NOTHING,ES:NOTHING 0 000013B5 161F context DS 0 000013B7 3C01 CMP AL,1 0 000013B9 720B JB CharGetSw 0 000013BB 740F JZ CharSetSw 0 000013BD 3C03 CMP AL,3 0 000013BF 7210 JB CharGetDev 0 000013C1 7416 JZ CharSetDev 0 000013C3 B0FF MOV AL,-1 0 000013C5 C3 return 788 CharGetSw: 0 000013C6 8A16[0000] MOV DL,[chSwitch] 0 000013CA EB07 JMP SHORT CharSet 791 CharSetSw: 0 000013CC 8816[0000] MOV [chSwitch],DL 0 000013D0 C3 return 794 CharGetDev: 0 000013D1 B2FF MOV DL,-1 796 CharSet: 0 000013D3 E8[0000] Invoke Get_User_Stack 798 ASSUME DS:NOTHING 799 User_DX equ user_DX ; NASM port label 0 000013D6 895406 MOV [SI + User_DX],DX 801 CharSetDev: 0 000013D9 C3 return 803 EndProc D_CHAR_OPER 804 805 BREAK <$GetExtendedError - Return Extended DOS error code> 806 ; 807 ; input: None 808 ; output: AX = Extended error code (0 means no extended error) 809 ; BL = recommended action 810 ; BH = class of error 811 ; CH = locus of error 812 ; ES:DI = may be pointer 813 ; 814 procedure D_GetExtendedError,NEAR 814 ****************** warning: proc D_GetExtendedError... [-w+user] 815 ASSUME DS:NOTHING,ES:NOTHING 0 000013DA 161F Context DS 0 000013DC A1[0000] MOV AX,[EXTERR] 0 000013DF C43E[0000] LES DI,[EXTERRPT] 0 000013E3 8B1E[0000] MOV BX,WORD PTR [EXTERR_ACTION] ; BL = Action, BH = Class 0 000013E7 8A2E[0000] MOV CH,[EXTERR_LOCUS] 0 000013EB E8[0000] invoke get_user_stack 822 ASSUME DS:NOTHING 0 000013EE 897C0A MOV [SI + user_DI],DI 0 000013F1 8C4410 MOV [SI + user_ES],ES 0 000013F4 895C02 MOV [SI + user_BX],BX 0 000013F7 894C04 MOV [SI + user_CX],CX 0 000013FA E9[0000] transfer SYS_RET_OK 828 EndProc D_GetExtendedError 829 830 BREAK <$Get_Global_CdPg - Return Global Code Page> 831 ; 832 ; input: None 833 ; output: AX = Global Code Page 834 ; 835 procedure Get_Global_CdPg,NEAR 835 ****************** warning: proc Get_Global_CdPg... [-w+user] 836 ASSUME DS:NOTHING,ES:NOTHING 0 000013FD 56 PUSH SI 0 000013FE BE[0000] MOV SI,OFFSET COUNTRY_CDPG wrt DOSGROUP 0 00001401 368B446A MOV AX,[ss:SI + ccDosCodePage] 0 00001405 5E POP SI 0 00001406 C3 return 842 EndProc Get_Global_CdPg 843 844 ;-------------------------------Start of DBCS 2/13/KK 845 BREAK 846 847 ASSUME DS:NOTHING, ES:NOTHING 848 849 procedure D_ECS_call,NEAR 849 ****************** warning: proc D_ECS_call... [-w+user] 850 851 ; Inputs: 852 ; AL = 0 get lead byte table 853 ; on return DS:SI has the table location 854 ; 855 ; AL = 1 set / reset interim console flag 856 ; DL = flag (00H or 01H) 857 ; no return 858 ; 859 ; AL = 2 get interim console flag 860 ; on return DL = current flag value 861 ; 862 ; AL = OTHER then error, and returns with: 863 ; AX = error_invalid_function 864 ; 865 ; NOTE: THIS CALL DOES GUARANTEE THAT REGISTER OTHER THAN 866 ; SS:SP WILL BE PRESERVED! 867 868 %IF DBCS ;AN000; 869 ;AN000; 870 or al, al ; AL = 0 (get table)? ;AN000; 871 je get_lbt ;AN000; 872 cmp al, SetInterimMode ; AL = 1 (set / reset interim flag)? ;AN000; 873 je set_interim ;AN000; 874 cmp al, GetInterimMode ; AL = 2 (get interim flag)? ;AN000; 875 je get_interim ;AN000; 876 error error_invalid_function ;AN000; 877 ;AN000; 878 get_lbt: ; get lead byte table ;AN000; 879 push ax ;AN000; 880 push bx ;AN000; 881 push ds ;AN000; 882 context DS ;AN000; 883 MOV BX,offset COUNTRY_CDPG + ccSetDBCS wrt DOSGROUP ;AN000; 884 MOV AX,[BX+1] ; set EV address to DS:SI ;AN000; 885 MOV BX,[BX+3] ;AN000; 886 ADD AX,2 ; Skip Lemgth ;AN000; 887 invoke get_user_stack ;AN000; 888 assume ds:nothing ;AN000; 889 MOV [SI + user_SI], AX ;AN000; 890 MOV [SI + user_DS], BX ;AN000; 891 pop ds ;AN000; 892 pop bx ;AN000; 893 pop ax ;AN000; 894 transfer SYS_RET_OK ;AN000; 895 896 set_interim: ; Set interim console flag ;AN000; 897 push dx ;AN000; 898 and dl,01 ; isolate bit 1 ;AN000; 899 mov [InterCon], dl ;AN000; 900 push ds ;AN000; 901 CurrentPDB equ CURRENTPDB ; NASM port label 902 mov ds, [CurrentPDB] ;AN000; 903 mov byte ptr [PDB_InterCon], dl ; update value in pdb ;AN000; 904 pop ds ;AN000; 905 pop dx ;AN000; 906 transfer SYS_RET_OK ;AN000; 907 908 get_interim: ;AN000; 909 push dx ;AN000; 910 push ds ;AN000; 911 mov dl,[InterCon] ;AN000; 912 invoke get_user_stack ; get interim console flag ;AN000; 913 assume ds:nothing ;AN000; 914 mov [SI + user_DX],DX ;AN000; 915 pop ds ;AN000; 916 pop dx ;AN000; 917 transfer SYS_RET_OK ;AN000; 918 %ELSE ;AN000; 0 00001407 08C0 or al, al ; AL = 0 (get table)? ;AN000; 0 00001409 750B jnz okok ;AN000; 921 get_lbt: ;AN000; 0 0000140B E8[0000] invoke get_user_stack ;AN000; 923 assume ds:nothing ;AN000; 924 Dosgroup equ DOSGROUP ; NASM port equate 0 0000140E C74408[0200] MOV word [SI + user_SI], Offset DBCS_TAB+2 wrt Dosgroup ;AN000; 0 00001413 8C540E MOV [SI + user_DS], ss ;AN000; 927 okok: ;AN000; 0 00001416 EBE2 transfer SYS_RET_OK ; ;AN000; 929 930 %ENDIF ;AN000; 931 932 D_ECS_call endp ;AN000; 933 934 END === Trace listing source: ../DOS/parse.lst 1 ; SCCSID = @(#)parse.asm 1.2 85/07/23 2 ;TITLE PARSE - Parsing system calls for MS-DOS 3 ;NAME PARSE 4 ; 5 ; System calls for parsing command lines 6 ; 7 ; $PARSE_FILE_DESCRIPTOR 8 ; 9 ; Modification history: 10 ; 11 ; Created: ARR 30 March 1983 12 ; EE PathParse 10 Sept 1983 13 ; 14 15 [list -] 15 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 30 31 BOGUS equ FALSE 32 ;.lall 33 I_Need chSwitch,BYTE 34 35 assume nocheck, ss:DOSGROUP 36 37 BREAK <$Parse_File_Descriptor -- Parse an arbitrary string into an FCB> 38 39 ; Inputs: 40 ; DS:SI Points to a command line 41 ; ES:DI Points to an empty FCB 42 ; Bit 0 of AL = 1 At most one leading separator scanned off 43 ; = 0 Parse stops if separator encountered 44 ; Bit 1 of AL = 1 If drive field blank in command line - leave FCB 45 ; = 0 " " " " " " - put 0 in FCB 46 ; Bit 2 of AL = 1 If filename field blank - leave FCB 47 ; = 0 " " " - put blanks in FCB 48 ; Bit 3 of AL = 1 If extension field blank - leave FCB 49 ; = 0 " " " - put blanks in FCB 50 ; Function: 51 ; Parse command line into FCB 52 ; Returns: 53 ; AL = 1 if '*' or '?' in filename or extension, 0 otherwise 54 ; DS:SI points to first character after filename 55 56 procedure D_PARSE_FILE_DESCRIPTOR,NEAR 56 ****************** warning: proc D_PARSE_FILE_DESCRIPTOR... [-w+user] 57 ASSUME DS:NOTHING,ES:NOTHING 58 0 00001418 E8[0000] invoke MAKEFCB 0 0000141B 56 PUSH SI 0 0000141C E8[0000] invoke get_user_stack 0 0000141F 8F4408 POP word [SI + user_SI] 0 00001422 C3 return 64 EndProc D_PARSE_FILE_DESCRIPTOR 65 66 67 %IF BOGUS 68 BREAK <$PathParse - Parse a string> 69 70 ;------------------------------------------------------------------------------ 71 ; 72 ; Parse is a string parser. It copies the next token into a buffer, updates 73 ; the string pointer, and builds a flag word which describes the token. 74 ; 75 ; ENTRY 76 ; DS:SI - Points to the beginning of the string to be parsed 77 ; ES:DI - Points to the buffer which will hold the new token 78 ; 79 ; EXIT 80 ; AX - Flag word 81 ; DS:SI - String pointer updated to point past the token just found 82 ; All other registers are unchanged. 83 ; 84 ; All of the isXXXX procedures called by the main routine test a character 85 ; to see if it is of a particular type. If it is, they store the character 86 ; and return with the ZF set. 87 ; 88 ; CALLS 89 ; isswit issep ispchr ispsep isinval isdot ischrnull dirdot pasep 90 ; 91 ; 92 ; INTERNAL REGISTER USAGE 93 ; AH - FF/00 to indicate whether a path token can terminated with a 94 ; slash or not. 95 ; AL - Used with lodsb/stosb to transfer and test chars from DS:SI 96 ; BX - Holds flag word 97 ; CX - Used with loop/rep and as a work var 98 ; DX - Used to test the length of names and extensions 99 ; 100 ; EFFECTS 101 ; The memory pointed to by DI has the next token copied into it. 102 ; 103 ; WARNINGS 104 ; It is the caller's responsibility to make sure DS:SI does not point 105 ; to a null string. If it does, SI is incremented, a null byte is 106 ; stored at ES:DI, and the routine returns. 107 ; 108 ;------------------------------------------------------------------------------ 109 ParseClassMask equ 1110000000000000b ; Token class mask 110 ParseSwitch equ 1000000000000000b ; Switch class 111 ParseSeparators equ 0100000000000000b ; Separator class 112 ParsePathName equ 0010000000000000b ; Path class 113 ParsePathNameData equ 0000000000001111b ; Path token data mask 114 ParsePathSynErr equ 0000000000000001b ; Path has syntax error 115 ParsePathWild equ 0000000000000010b ; Path has wildcards 116 ParsePathSeparators equ 0000000000000100b ; Path has pseparators 117 ParseInvalidDrive equ 0000000000001000b ; Path has invald drive 118 119 120 ; Sepchars is a string containing all of the token separator characters 121 ; and is used to test for separators. 122 === Switch to base=002450h -> "DOSCODETABLE" 123 section DOSCODETABLE 124 Public PRS001S,PRS001E 125 PRS001S label byte 126 sepchrs db 9,10,13,' ','+',',',';','=' ; tab cr lf sp + , ; = 127 seplen equ $-sepchrs 128 PRS001E label byte === Switch to base=002450h -> "DOSCODECODE" 129 section DOSCODECODE ; DOSCODETABLE ends 130 131 Procedure D_PathParse,NEAR 132 assume ds:nothing,es:nothing 133 xor ah,ah ; initialize registers and flags 134 xor bx,bx 135 cld 136 lodsb ; used the first byte of the token to 137 call isswit ; determine its type and call the routine to 138 je switch ; parse it 139 call issep 140 je separ 141 call ispchr 142 je path 143 call ispsep 144 je path 145 call isdot 146 je path 147 call isinval 148 je inval 149 stosb 150 jmp done 151 152 inval: or bx,ParsePathName ; an invalid character/path token 153 or bx,ParsePathSynErr ; was found, set the appropriate 154 call issep ; flag bits and parse the rest of 155 jne icont ; the token 156 dec di 157 icont: dec si 158 jmp ptosep 159 160 switch: mov bx,ParseSwitch ; found a switch, set flag and parse 161 jmp ptosep ; the rest of it 162 163 separ: mov bx,ParseSeparators ; found separator, set flag and parse 164 seloop: lodsb ; everything up to the next non 165 call issep ; separator character 166 je seloop 167 jmp bksi 168 169 path: or bx,ParsePathName ; found path, set flag 170 mov cx,8 ; set up to parse a file name 171 mov dx,8 172 call pasep ; if the token began with a path 173 jne pcont1 ; separator or . call rcont which 174 not ah ; handles checksfor . and .. 175 jmp rcont 176 pcont1: cmp al,'.' 177 jne pcont2 178 dec si 179 dec di 180 jmp rcont 181 pcont2: cmp al,'A' ; if token may start with a drive 182 jge .drive ; designator, go to drive. otherwise 183 jmp parse_name1 ; parse a file name. 184 185 .drive: cmp byte ptr [si],':' ; if there is a drive designator, parse 186 jne parse_name1 ; and verify it. otherwise parse a file 187 not ah ; name. 188 cmp al,'Z' 189 jle dcont1 190 sub al,' ' 191 dcont1: sub al,'@' 192 invoke GetthisDrv 193 lodsb 194 stosb 195 jc dcont2 196 jmp dcont3 197 dcont2: or bx,ParseInvalidDrive 198 dcont3: dec cx 199 lodsb 200 call ispsep 201 je rcont 202 dec si 203 204 repeat: mov al,byte ptr [si-2] ; repeat and rcont test for //, \\, ., 205 call pasep ; and .. and repeatedly calls name 206 jne rcont ; and ext until a path token has 207 inc si ; been completely parsed. 208 jmp inval 209 rcont: call dirdot 210 je done 211 jc inval 212 mov cx,8 213 mov dx,8 214 jmp name 215 216 parse_name1: 217 dec cx 218 name: lodsb ; parse and verify a file name 219 call ispchr 220 jne ncheck 221 xor ah,ah 222 nloop: loop name 223 lodsb 224 225 ncheck: cmp ah,0 226 jne ncont 227 cmp cx,dx 228 jne ncont 229 jmp inval 230 ncont: call isdot 231 je ext 232 jmp dcheck 233 234 ext: mov cx,3 ; parse and verify a file extension 235 mov dx,3 236 extl: lodsb 237 call ispchr 238 jne echeck 239 eloop: loop extl 240 lodsb 241 242 echeck: cmp cx,dx 243 jne dcheck 244 jmp inval 245 246 dcheck: call ispsep ; do the checks need to make sure 247 je repeat ; a file name or extension ended 248 call issep ; correctly and checks to see if 249 je bkboth ; we're done 250 call ischrnull 251 je done 252 jmp inval 253 254 ptosep: lodsb ; parse everything to the next separator 255 call issep 256 je bkboth 257 call ischrnull 258 je done 259 call isinval 260 jne ptcont 261 or bx,ParsePathSynErr 262 ptcont: stosb 263 jmp ptosep 264 265 bkboth: dec di ; clean up when the end of the token 266 bksi: dec si ; is found, stick a terminating null 267 done: xor al,al ; byte at the end of buf, and exit 268 stosb 269 push si 270 invoke Get_user_stack 271 mov [si + user_AX],bx 272 pop word [si + user_SI] 273 Transfer sys_ret_ok 274 275 Endproc D_PathParse 276 277 ; Is current character the beginning of a switch? 278 279 isswit proc near 280 cmp al,[ss:chSwitch] 281 jne swret 282 stosb 283 swret: ret 284 isswit endp 285 286 287 ; Is the current character a separator? 288 289 issep proc near 290 push cx 291 push di 292 push es 293 push cs 294 pop es 295 mov cx,seplen 296 dosgroup equ DOSGROUP ; NASM port equate 297 mov di,offset sepchrs 298 repne scasb 299 pop es 300 pop di 301 jne sepret 302 sepyes: stosb 303 sepret: pop cx 304 ret 305 issep endp 306 307 308 ; Is the current character a path character? If it is a wildcard char too, 309 ; set that flag. 310 311 ispchr proc near 312 cmp al,'!' 313 je pcyes 314 cmp al,'#' 315 jl pcret 316 cmp al,'*' 317 je pcwild 318 jl pcyes 319 cmp al,'-' 320 je pcyes 321 cmp al,'0' 322 jl pcret 323 cmp al,'9' 324 jle pcyes 325 cmp al,'?' 326 je pcwild 327 jl pcret 328 cmp al,'Z' 329 jle pcyes 330 cmp al,'^' 331 jl pcret 332 cmp al,'{' 333 jle pcyes 334 cmp al,'}' 335 je pcyes 336 cmp al,'~' 337 je pcyes 338 jmp pcret 339 pcwild: or bx,ParsePathWild 340 pcyes: stosb 341 cmp al,al 342 pcret: ret 343 ispchr endp 344 345 346 ; Is the current character a path separator? If so, set that flag after 347 ; storing the byte. 348 349 ispsep proc near 350 call pasep 351 jne psret 352 stosb 353 or bx,ParsePathSeparators 354 cmp al,al 355 psret: ret 356 ispsep endp 357 358 359 ; Set ZF if the character in AL is a path separator. 360 361 pasep proc near 362 cmp byte [ss:chSwitch],'/' 363 je bkslash 364 cmp al,'/' 365 retz 366 bkslash:cmp al,'\' 367 ret 368 pasep endp 369 370 371 ; Is the current character invalid? 372 373 isinval proc near 374 cmp al,1 375 jl inret 376 cmp al,8 377 jle inyes 378 cmp al,11 379 jl inret 380 cmp al,13 381 jne incont 382 cmp al,0 383 ret 384 incont: cmp al,31 385 jle inyes 386 cmp al,'[' 387 je inyes 388 cmp al,']' 389 je inyes 390 ret 391 inyes: cmp al,al 392 inret: ret 393 isinval endp 394 395 396 ; Is the current character a dot? 397 398 isdot proc near 399 cmp al,'.' 400 jne dotret 401 stosb 402 dotret: ret 403 isdot endp 404 405 406 ; Is the current character null? If so, update SI for exiting. 407 408 ischrnull proc near 409 cmp al,0 410 jne nulret 411 dec si 412 cmp al,al 413 nulret: ret 414 ischrnull endp 415 416 417 ; Check for . and .. Before returning, CF and ZF are set to indicate whether 418 ; the token is invalid (found . or .. followed by an invalid char - CF on), 419 ; we're done (found . or .. followed by null or a separator - ZF on), or the 420 ; token continues (. and .. not found or found and followed by a path 421 ; separator - both flags off). 422 423 dirdot proc near 424 cmp byte ptr [si], '.' 425 jne diretc 426 lodsb 427 stosb 428 cmp byte ptr [si],'.' 429 jne dicont 430 lodsb 431 stosb 432 dicont: lodsb 433 call ispsep 434 je diretc 435 call issep 436 je dibk 437 call ischrnull 438 je diretd 439 direti: stc ; Invalid return 440 ret 441 dibk: dec si 442 dec di 443 diretd: cmp al,al ; Done return 444 ret 445 diretc: cmp ah,1 ; Continue return 446 clc 447 ret 448 dirdot endp 449 %ENDIF 450 451 END === Trace listing source: ../DOS/misc.lst 1 ; SCCSID = @(#)misc.asm 1.1 85/04/10 2 ;TITLE MISC - Miscellanious routines for MS-DOS 3 ;NAME MISC 4 ; 5 ; Miscellaneous system calls most of which are CAVEAT 6 ; 7 ; $SLEAZEFUNC 8 ; $SLEAZEFUNCDL 9 ; $GET_INDOS_FLAG 10 ; $GET_IN_VARS 11 ; $GET_DEFAULT_DPB 12 ; $GET_DPB 13 ; $DISK_RESET 14 ; $SETDPB 15 ; $Dup_PDB 16 ; $CREATE_PROCESS_DATA_BLOCK 17 ; SETMEM 18 ; FETCHI_CHECK 19 ; $GSetMediaID 20 ; 21 ; Revision history: 22 ; 23 ; Created: ARR 30 March 1983 24 ; 25 ; A000 version 4.00 Jan. 1988 26 ; A001 D490 -- Change IOCTL subfunctions from 63h, 43h to 66h , 46h 27 28 [list -] 28 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 33 34 [list +] === Switch to base=002450h -> "DOSCODECODE" 35 section DOSCODECODE 36 [list -] 36 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 36 ****************** warning: out: BPB.INC... [-w+user] 36 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 36 ****************** warning: out: DEVSYM.INC... [-w+user] 43 44 ENTRYPOINTSEG EQU 0CH 45 MAXDIF EQU 0FFFH 46 SAVEXIT EQU 10 47 48 i_need LASTBUFFER,DWORD 49 i_need BuffHead,DWORD 50 i_need INDOS,BYTE 51 i_need SYSINITVAR,BYTE 52 i_need CurrentPDB,WORD 53 i_need CreatePDB,BYTE 54 i_need FATBYTE,BYTE 55 i_need THISCDS,DWORD 56 i_need THISSFT,DWORD 57 i_need FETCHI_TAG,WORD ; for TAG CHECK 58 i_need BUF_HASH_COUNT,WORD ;AN000; number of Hash Entries 59 i_need HIGH_SECTOR,WORD ;AN000; high word of sector # 60 i_need DOS34_FLAG,WORD ;AN000; 61 %if debug 62 I_need BugLev,WORD 63 I_need BugTyp,WORD 64 %include "bugtyp.nas" 65 %endif 66 67 assume nocheck, ss:DOSGROUP 68 69 BREAK 70 71 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 72 ; C A V E A T P R O G R A M M E R ; 73 ; ; 74 ; Inputs: 75 ; None 76 ; Function: 77 ; Return Stuff sort of like old get fat call 78 ; Outputs: 79 ; DS:BX = Points to FAT ID byte (IBM only) 80 ; GOD help anyone who tries to do ANYTHING except 81 ; READ this ONE byte. 82 ; DX = Total Number of allocation units on disk 83 ; CX = Sector size 84 ; AL = Sectors per allocation unit 85 ; = -1 if bad drive specified 86 87 procedure D_SLEAZEFUNC,NEAR 87 ****************** warning: proc D_SLEAZEFUNC... [-w+user] 88 ASSUME DS:NOTHING,ES:NOTHING 89 0 00001423 B200 MOV DL,0 91 92 entry D_SLEAZEFUNCDL 93 ;Same as above except drive passed in DL (0=default, 1=A, 2=B, ...) 94 0 00001425 161F context DS 0 00001427 88D0 MOV AL,DL 0 00001429 E8[0000] invoke GETTHISDRV ; Get CDS structure 98 SET_AL_RET: 99 ; MOV AL,error_invalid_drive ; Assume error ;AC000; 0 0000142C 721E JC BADSLDRIVE 0 0000142E E8[0000] invoke DISK_INFO 0 00001431 72F9 JC SET_AL_RET ; User FAILed to I 24 0 00001433 8826[0000] MOV [FATBYTE],AH 104 ; NOTE THAT A FIXED MEMORY CELL IS USED --> THIS CALL IS NOT 105 ; RE-ENTRANT. USERS BETTER GET THE ID BYTE BEFORE THEY MAKE THE 106 ; CALL AGAIN 0 00001437 BF[0000] MOV DI,OFFSET FATBYTE wrt DOSGROUP 0 0000143A 30E4 XOR AH,AH ; AL has sectors/cluster 109 ; Does not handle EDR-DOS 256 SpC, 110 ; what does EDR-DOS do? 111 ; A: EDR-DOS returns 0 in al. 0 0000143C E8[0000] invoke get_user_stack 113 ASSUME DS:NOTHING 0 0000143F 894C04 MOV [SI + user_CX],CX 0 00001442 895C06 MOV [SI + user_DX],BX 0 00001445 897C02 MOV [SI + user_BX],DI 0 00001448 8C540E MOV [SI + user_DS], ss ; stash correct pointer 0 0000144B C3 return 119 BADSLDRIVE: 0 0000144C E9[0000] transfer FCB_Ret_ERR 121 EndProc D_SLEAZEFUNC 122 ; ; 123 ; C A V E A T P R O G R A M M E R ; 124 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 125 126 BREAK <$Get_INDOS_Flag -- Return location of DOS critical-section flag> 127 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 128 ; C A V E A T P R O G R A M M E R ; 129 ; ; 130 ; Inputs: 131 ; None 132 ; Function: 133 ; Returns location of DOS status for interrupt routines 134 ; Returns: 135 ; Flag location in ES:BX 136 137 procedure D_GET_INDOS_FLAG,NEAR 137 ****************** warning: proc D_GET_INDOS_FLAG... [-w+user] 138 ASSUME DS:NOTHING,ES:NOTHING 139 0 0000144F E8[0000] invoke get_user_stack 0 00001452 C74402[0000] MOV word [SI + user_BX],OFFSET INDOS wrt DOSGROUP 0 00001457 8C5410 MOV [SI + user_ES],SS 0 0000145A C3 return 144 EndProc D_GET_INDOS_FLAG 145 ; ; 146 ; C A V E A T P R O G R A M M E R ; 147 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 148 149 BREAK <$Get_IN_VARS -- Return a pointer to DOS variables> 150 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 151 ; C A V E A T P R O G R A M M E R ; 152 ; ; 153 ; Return a pointer to interesting DOS variables This call is version 154 ; dependent and is subject to change without notice in future versions. 155 ; Use at risk. 156 procedure D_GET_IN_VARS,NEAR 156 ****************** warning: proc D_GET_IN_VARS... [-w+user] 0 0000145B E8[0000] invoke get_user_stack 0 0000145E C74402[0000] MOV word [SI + user_BX],OFFSET SYSINITVAR wrt DOSGROUP 0 00001463 8C5410 MOV [SI + user_ES],SS 0 00001466 C3 return 161 EndProc D_GET_IN_VARS 162 ; ; 163 ; C A V E A T P R O G R A M M E R ; 164 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 165 166 167 BREAK <$Get_Default_DPB,$Get_DPB -- Return pointer to DPB> 168 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 169 ; C A V E A T P R O G R A M M E R ; 170 ; ; 171 ; Inputs: 172 ; None 173 ; Function: 174 ; Return pointer to drive parameter table for default drive 175 ; Returns: 176 ; DS:BX points to the DPB 177 ; AL = 0 If OK, = -1 if bad drive (call 50 only) 178 179 procedure D_GET_DEFAULT_DPB,NEAR 179 ****************** warning: proc D_GET_DEFAULT_DPB... [-w+user] 180 ASSUME DS:NOTHING,ES:NOTHING 181 0 00001467 B200 MOV DL,0 183 184 entry D_GET_DPB 185 ; Same as above only drive passed in DL (0=default, 1=A, 2=B, ...) 186 0 00001469 161F context DS 0 0000146B 88D0 MOV AL,DL 0 0000146D E8[0000] invoke GETTHISDRV ; Get CDS structure 0 00001470 7223 JC ISNODRV ; no valid drive 0 00001472 C43E[0000] LES DI,[THISCDS] ; check for net CDS 0 00001476 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 0000147C 7517 JNZ ISNODRV ; No DPB to point at on NET stuff 0 0000147E E8[0000] EnterCrit CritDisk 0 00001481 E8[0000] invoke FATRead_CDS ; Force Media Check and return DPB 0 00001484 E8[0000] LeaveCrit CritDisk 0 00001487 720C JC ISNODRV ; User FAILed to I 24, only error we 198 ; have. 0 00001489 E8[0000] invoke get_user_stack 200 ASSUME DS:NOTHING 0 0000148C 896C02 MOV [SI + user_BX],BP 0 0000148F 8C440E MOV [SI + user_DS],ES 0 00001492 30C0 XOR AL,AL 0 00001494 C3 return 205 206 ISNODRV: 0 00001495 B0FF MOV AL,-1 0 00001497 C3 return 209 EndProc D_GET_Default_dpb 210 ; ; 211 ; C A V E A T P R O G R A M M E R ; 212 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 213 214 215 BREAK <$Disk_Reset -- Flush out all dirty buffers> 216 217 procedure D_DISK_RESET,NEAR 217 ****************** warning: proc D_DISK_RESET... [-w+user] 218 ASSUME DS:NOTHING,ES:NOTHING 219 220 ; Inputs: 221 ; None 222 ; Function: 223 ; Flush and invalidate all buffers 224 ; Returns: 225 ; Nothing 226 0 00001498 B0FF MOV AL,-1 228 entry D_DISK_RESET2 0 0000149A 161F context DS 0 0000149C E8[0000] EnterCrit critDisk 0 0000149F 830E[0000]04 OR word [DOS34_FLAG],FROM_DISK_RESET ;AN000; 0 000014A4 E8[0000] invoke FLUSHBUF 0 000014A7 8326[0000]FB AND word [DOS34_FLAG],NO_FROM_DISK_RESET ;AN000; 234 ; 235 ; We will "ignore" any errors on the flush, and go ahead and invalidate. This 236 ; call doesn't return any errors and it is supposed to FORCE a known state, so 237 ; let's do it. 238 ; 239 ; Invalidate 'last-buffer' used 240 ; 0 000014AC BBFFFF MOV BX,-1 0 000014AF 891E[0200] MOV WORD PTR [LASTBUFFER+2],BX 0 000014B3 891E[0000] MOV WORD PTR [LASTBUFFER],BX 244 ; 245 ; TEST [DOS34_FLAG],IFS_DRIVE_RESET ;AN000;;IFS. from ifs call back ? 246 ; JZ FreeDone ;AN000;;IFS. no 247 ; AND [DOS34_FLAG],NO_IFS_DRIVE_RESET ;AN000;;IFS. clear the flag 248 ; LeaveCrit critDisk ;AN000;;IFS. 249 ; return ;AN000;;IFS. return 250 FreeDone: 0 000014B7 E8[0000] LeaveCrit critDisk 0 000014BA B8FFFF MOV AX,-1 253 multNET equ MultNET ; NASM port equate 0 000014BD B82011CD2F CallInstall NetFlushBuf,multNET,32 0 000014C2 C3 return 256 EndProc D_DISK_RESET 257 258 BREAK <$SetDPB - Create a valid DPB from a user-specified BPB> 259 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 260 ; C A V E A T P R O G R A M M E R ; 261 ; ; 262 procedure D_SETDPB,NEAR 262 ****************** warning: proc D_SETDPB... [-w+user] 263 ASSUME DS:NOTHING,ES:NOTHING 264 265 ; Inputs: 266 ; ES:BP Points to DPB 267 ; DS:SI Points to BPB 268 ; Function: 269 ; Build a correct DPB from the BPB 270 ; Outputs: 271 ; ES:BP and DS preserved all others destroyed 272 0 000014C3 89EF MOV DI,BP 0 000014C5 AF scasw ; Skip over dpb_drive and dpb_UNIT 0 000014C6 AD LODSW 0 000014C7 AB STOSW ; dpb_sector_size 0 000014C8 85C0 test ax, ax 0 000014CA 7406 jz .nonfat 0 000014CC 807C0300 CMP BYTE PTR [SI + BPFTCNT-2],0 ; FAT file system drive ;AN000; 0 000014D0 7508 JNZ yesfat ; yes ;AN000; 281 .nonfat: 0 000014D2 26C6450400 MOV BYTE PTR [ES:DI + dpb_FAT_count-4],0 0 000014D7 EB74 JMP setend ; NO ;AN000; 0 000014D9 90 nop ; identicalise 285 yesfat: 0 000014DA 89C2 MOV DX,AX 0 000014DC AC LODSB ; get amount clusters (0 means 256) 0 000014DD 48 dec ax 0 000014DE AA STOSB ; dpb_cluster_mask 0 000014DF B400 mov ah, 0 0 000014E1 40 inc ax ; translate EDR-DOS 0 to 256 0 000014E2 B300 mov bl, 0 ; bl = shift count 293 LOG2LOOP: 0 000014E4 A801 TEST AL,1 0 000014E6 7506 JNZ SAVLOG 0 000014E8 FEC3 inc bl ; increment shift count 0 000014EA D1E8 shr ax, 1 ; shift right amount clusters 0 000014EC EBF6 JMP SHORT LOG2LOOP 299 SAVLOG: 0 000014EE 88D8 mov al, bl ; bl = al = shift count 0 000014F0 AA STOSB ; dpb_cluster_shift 0 000014F1 A5 MOVSW ; dpb_first_FAT Start of FAT (# of reserved sectors) 0 000014F2 AC LODSB 0 000014F3 AA STOSB ; dpb_FAT_count Number of FATs 305 ; OR AL,AL ; NONFAT ? ;AN000; 306 ; JZ setend ; yes, don't do anything ;AN000; 0 000014F4 88C7 MOV BH,AL 0 000014F6 AD LODSW 0 000014F7 AB STOSW ; dpb_root_entries Number of directory entries 0 000014F8 B105 MOV CL,5 0 000014FA D3EA SHR DX,CL ; Directory entries per sector 0 000014FC 48 DEC AX 0 000014FD 01D0 ADD AX,DX ; Cause Round Up 0 000014FF 89D1 MOV CX,DX 0 00001501 31D2 XOR DX,DX 0 00001503 F7F1 DIV CX 0 00001505 89C1 MOV CX,AX ; Number of directory sectors 0 00001507 47 INC DI 0 00001508 47 INC DI ; Skip dpb_first_sector 0 00001509 A5 MOVSW ; Total number of sectors in DSKSIZ (temp as dpb_max_cluster) 0 0000150A AC LODSB 0 0000150B 26884617 MOV [ES:BP + dpb_media],AL ; Media byte 0 0000150F AD LODSW ; Number of sectors in a FAT 0 00001510 AB STOSW ;AC000;;>32mb dpb_FAT_size 0 00001511 88FA MOV DL,BH ;AN000;;>32mb 0 00001513 30F6 XOR DH,DH ;AN000;;>32mb 0 00001515 F7E2 MUL DX ;AC000;;>32mb Space occupied by all FATs 0 00001517 26034606 ADD AX,[ES:BP + dpb_first_FAT] 0 0000151B AB STOSW ; dpb_dir_sector 0 0000151C 01C8 ADD AX,CX ; Add number of directory sectors 0 0000151E 2689460B MOV [ES:BP + dpb_first_sector],AX 332 0 00001522 88D9 mov cl, bl ; cluster size shift count 0 00001524 26837E0D00 CMP WORD PTR [ES:BP + DSKSIZ],0 ;F.C. >32mb ;AN000; 0 00001529 751A JNZ normal_dpb ;F.C. >32mb ;AN000; 0 0000152B 30ED XOR CH,CH ;F.C. >32mb ;AN000; 337 BPB_BigTotalSectors equ BPB_BIGTOTALSECTORS ; NASM port label 338 BPB_SectorsPerTrack equ BPB_SECTORSPERTRACK ; NASM port label 0 0000152D 8B5C08 MOV BX,WORD PTR [SI+BPB_BigTotalSectors-BPB_SectorsPerTrack] ;AN000; 0 00001530 8B540A MOV DX,WORD PTR [SI+BPB_BigTotalSectors-BPB_SectorsPerTrack+2] ;AN000; 0 00001533 29C3 SUB BX,AX ;AN000;;F.C. >32mb 0 00001535 83DA00 SBB DX,0 ;AN000;;F.C. >32mb 0 00001538 E306 jcxz norot ;AN000;;F.C. >32mb 344 rott: ;AN000;;F.C. >32mb 0 0000153A D1EA shr DX,1 ;AN000;;F.C. >32mb 0 0000153C D1DB RCR BX,1 ;AN000;;F.C. >32mb 0 0000153E E2FA LOOP rott ;AN000;;F.C. >32mb 348 norot: ;AN000; 0 00001540 89D8 MOV AX,BX ;AN000;;F.C. >32mb 0 00001542 EB09 JMP setend ;AN000;;F.C. >32mb 0 00001544 90 nop ; identicalise 352 normal_dpb: 0 00001545 262B460D SUB AX,[ES:BP + DSKSIZ] 0 00001549 F7D8 NEG AX ; Sectors in data area 355 ;; MOV CL,BL ; dpb_cluster_shift 0 0000154B D3E8 SHR AX,CL ; Div by sectors/cluster 357 setend: 0 0000154D 40 INC AX 0 0000154E 2689460D MOV [ES:BP + dpb_max_cluster],AX 0 00001552 26C7461D0000 MOV word [ES:BP + dpb_next_free],0 ; Init so first ALLOC starts at 361 ; begining of FAT 0 00001558 26C7461FFFFF MOV word [ES:BP + dpb_free_cnt],-1 ; current count is invalid. 0 0000155E C3 return 364 EndProc D_SETDPB 365 ; ; 366 ; C A V E A T P R O G R A M M E R ; 367 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 368 369 BREAK <$Create_Process_Data_Block,SetMem -- Set up process data block> 370 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 371 ; C A V E A T P R O G R A M M E R ; 372 ; ; 373 ; 374 ; Inputs: DX is new segment address of process 375 ; SI is end of new allocation block 376 ; 377 procedure D_Dup_PDB,NEAR 377 ****************** warning: proc D_Dup_PDB... [-w+user] 378 ASSUME DS:NOTHING,ES:NOTHING 0 0000155F 36C606[0000]FF MOV byte [ss:CreatePDB],0FFH ; indicate a new process 0 00001565 368E1E[0000] MOV DS,[ss:CurrentPDB] 381 assume ds:PSP 0 0000156A 56 PUSH SI 0 0000156B EB0A JMP SHORT CreateCopy 384 EndProc D_Dup_PDB 385 386 procedure D_CREATE_PROCESS_DATA_BLOCK,NEAR 386 ****************** warning: proc D_CREATE_PROCESS_DATA_BLOCK... [-w+user] 387 ASSUME DS:NOTHING,ES:NOTHING 388 389 ; Inputs: 390 ; DX = Segment number of new base 391 ; Function: 392 ; Set up program base and copy term and ^C from int area 393 ; Returns: 394 ; None 395 ; Called at DOS init 396 0 0000156D E8[0000] CALL get_user_stack 0 00001570 8E5C14 MOV DS,[SI + user_CS] 399 assume ds:PSP 400 PDB_Block_len equ PDB_block_len ; NASM port label 0 00001573 FF360200 PUSH word [PDB_Block_len] 402 CreateCopy: 0 00001577 8EC2 MOV ES,DX 404 assume es:nothing 0 00001579 31F6 XOR SI,SI ; copy all 80h bytes 0 0000157B 89F7 MOV DI,SI 0 0000157D B98000 MOV CX,80H 0 00001580 F3A5 REP MOVSW 409 ; DOS 3.3 7/9/86 410 0 00001582 B91400 MOV CX,FilPerProc ; copy handles in case of 0 00001585 BF1800 MOV DI,offset PDB_JFN_Table ; Set Handle Count has been issued 0 00001588 1E PUSH DS 0 00001589 C5363400 LDS SI,[PDB_JFN_Pointer] 415 assume ds:nothing 0 0000158D F3A4 REP MOVSB 0 0000158F 1F POP DS 418 assume ds:PSP 419 420 ; DOS 3.3 7/9/86 0 00001590 36F606[0000]FF TEST byte [ss:CreatePDB],0FFh; Shall we create a process? 0 00001596 744B JZ Create_PDB_cont ; nope, old style call 423 ; 424 ; Here we set up for a new process... 425 ; 426 0 00001598 16 PUSH ss 0 00001599 1F POP DS 429 DOSAssume CS,,"MISC/Create_Copy" 0 0000159A 31DB XOR BX,BX ; dup all jfns 0 0000159C B91400 MOV CX,FilPerProc ; only 20 of them 432 433 Create_dup_jfn: 0 0000159F 06 PUSH ES ; save new PDB 0 000015A0 E8[0000] invoke SFFromHandle ; get sf pointer 0 000015A3 B0FF MOV AL,-1 ; unassigned JFN 0 000015A5 7225 JC CreateStash ; file was not really open 0 000015A7 26F745050010 TEST word [ES:DI + sf_flags],sf_no_inherit 0 000015AD 751D JNZ CreateStash ; if no-inherit bit is set, skip dup. 440 ; 441 ; We do not inherit network file handles. 442 ; 0 000015AF 268A6502 MOV AH,BYTE PTR [ES:DI + sf_mode] 0 000015B3 80E4F0 AND AH,sharing_mask 445 sharing_net_fcb equ sharing_net_FCB ; NASM port equate 0 000015B6 80FC70 CMP AH,sharing_net_fcb 0 000015B9 7411 jz CreateStash 448 ; 449 ; The handle we have found is duplicatable (and inheritable). Perform 450 ; duplication operation. 451 ; 0 000015BB 893E[0000] MOV WORD PTR [THISSFT],DI 0 000015BF 8C06[0200] MOV WORD PTR [THISSFT+2],ES 0 000015C3 E8[0000] invoke DOS_DUP ; signal duplication 455 ; 456 ; get the old sfn for copy 457 ; 0 000015C6 E8[0000] invoke pJFNFromHandle ; ES:DI is jfn 0 000015C9 268A05 MOV AL,[ES:DI] ; get sfn 460 ; 461 ; Take AL (old sfn or -1) and stash it into the new position 462 ; 463 CreateStash: 0 000015CC 07 POP ES 465 assume es:nothing 0 000015CD 26884718 MOV [ES:BX + PDB_JFN_Table],AL; copy into new place! 0 000015D1 43 INC BX ; next jfn... 468 create_dup_jfn equ Create_dup_jfn ; NASM port label 0 000015D2 E2CB LOOP create_dup_jfn 470 0 000015D4 8B1E[0000] MOV BX,[CurrentPDB] ; get current process 0 000015D8 26891E1600 MOV [ES:PDB_Parent_PID],BX ; stash in child 0 000015DD 8C06[0000] MOV [CurrentPDB],ES 0 000015E1 8EDB MOV DS,BX 475 ASSUME DS:NOTHING 476 ; 477 ; end of new process create 478 ; 479 Create_PDB_cont: 0 000015E3 36C606[0000]00 MOV BYTE PTR [ss:CreatePDB],0h ; reset flag 0 000015E9 58 POP AX 482 483 entry SETMEM ; called from NEARDOSINIT, ss != DOSDATA 484 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 485 486 ; Inputs: 487 ; AX = Size of memory in paragraphs 488 ; DX = Segment 489 ; Function: 490 ; Completely prepares a program base at the 491 ; specified segment. 492 ; Called at DOS init 493 ; Outputs: 494 ; DS = DX 495 ; ES = DX 496 ; [0] has INT int_abort 497 ; [2] = First unavailable segment 498 ; [5] to [9] form a long call to the entry point 499 ; [10] to [13] have exit address (from int_terminate) 500 ; [14] to [17] have ctrl-C exit address (from int_ctrl_c) 501 ; [18] to [21] have fatal error address (from int_fatal_abort) 502 ; DX,BP unchanged. All other registers destroyed. 503 0 000015EA 31C9 XOR CX,CX 0 000015EC 8ED9 MOV DS,CX 506 assume ds:IVT 0 000015EE 8EC2 MOV ES,DX 508 assume es:nothing 0 000015F0 BE8800 MOV SI,addr_int_terminate 0 000015F3 BF0A00 MOV DI,SAVEXIT 0 000015F6 B90600 MOV CX,6 0 000015F9 F3A5 REP MOVSW 0 000015FB 26A30200 MOV [ES:2],AX 0 000015FF 29D0 SUB AX,DX 0 00001601 3DFF0F CMP AX,MAXDIF 0 00001604 7603 JBE HAVDIF 0 00001606 B8FF0F MOV AX,MAXDIF 518 HAVDIF: 0 00001609 83E810 SUB AX,10H ; Allow for 100h byte "stack" 0 0000160C BB0C00 MOV BX,ENTRYPOINTSEG ; in .COM files 0 0000160F 29C3 SUB BX,AX 0 00001611 B104 MOV CL,4 0 00001613 D3E0 SHL AX,CL 0 00001615 8EDA MOV DS,DX 525 assume ds:nothing 0 00001617 A30600 MOV WORD PTR [PDB_CPM_Call+1],AX 0 0000161A 891E0800 MOV WORD PTR [PDB_CPM_Call+3],BX 0 0000161E C7060000CD20 MOV word [PDB_Exit_Call],(int_abort << 8) + mi_INT 0 00001624 C60605009A MOV BYTE PTR [PDB_CPM_Call],mi_Long_CALL 530 PDB_Call_System equ PDB_Call_system ; NASM port label 0 00001629 C7065000CD21 MOV WORD PTR [PDB_Call_System],(int_command << 8) + mi_INT 0 0000162F C6065200CB MOV BYTE PTR [PDB_Call_System+2],mi_Long_RET 0 00001634 C70634001800 MOV WORD PTR [PDB_JFN_Pointer],PDB_JFN_Table 0 0000163A 8C1E3600 MOV WORD PTR [PDB_JFN_Pointer+2],DS 0 0000163E C70632001400 MOV WORD PTR [PDB_JFN_Length],FilPerProc 536 ; 537 ; The server runs several PDB's without creating them VIA EXEC. We need to 538 ; enumerate all PDB's at CPS time in order to find all references to a 539 ; particular SFT. We perform this by requiring that the server link together 540 ; for us all sub-PDB's that he creates. The requirement for us, now, is to 541 ; initialize this pointer. 542 ; 0 00001644 830E3800FF or word ptr [PDB_Next_PDB],-1 0 00001649 830E3A00FF or word ptr [PDB_Next_PDB+2],-1 0 0000164E C3 return 546 547 EndProc D_CREATE_PROCESS_DATA_BLOCK 548 549 ; ; 550 ; C A V E A T P R O G R A M M E R ; 551 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 552 procedure FETCHI_CHECK,NEAR 552 ****************** warning: proc FETCHI_CHECK... [-w+user] 553 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 0000164F 9C PUSHF 0 00001650 36813E[0000]7258 CMP word [ss:FETCHI_TAG],22642 0 00001657 7403 JZ TAG_OK 0 00001659 E8[0000] invoke TAGCRASHDOS ; go to hell 558 TAG_OK: 0 0000165C 9D POPF 0 0000165D C3 return 561 EndProc FETCHI_CHECK 562 563 BREAK <$GSetMediaID -- get set media ID> 564 ; Inputs: 565 ; BL= drive number as defined in IOCTL 566 ; AL= 0 get media ID 567 ; 1 set media ID 568 ; DS:DX= buffer containing information 569 ; DW 0 info level (set on input) 570 ; DD ? serial # 571 ; DB 11 dup(?) volume id 572 ; DB 8 dup(?) file system type 573 ; Function: 574 ; Get or set media ID 575 ; Returns: 576 ; carry clear, DS:DX is filled 577 ; carry set, error 578 579 procedure D_GSetMediaID,NEAR ;AN000; 579 ****************** warning: proc D_GSetMediaID... [-w+user] 580 ASSUME DS:NOTHING,ES:NOTHING, ss:DOSGROUP 581 0 0000165E B96608 MOV CX,0866H ;AN000;MS.; assume get for IOCTL 0 00001661 3C00 CMP AL,0 ;AN001;MS.; get ? 0 00001663 7407 JZ doioctl ;AN000;MS.; yes 0 00001665 3C01 CMP AL,1 ;AN000;MS.; set ? 0 00001667 7509 JNZ errorfunc ;AN000;MS.; no 0 00001669 B94608 MOV CX,0846H ;AN001;MS.; 588 doioctl: ;AN000; 0 0000166C B00D MOV AL,0DH ;AN000;MS.; generic IOCTL 0 0000166E E8[0000] invoke D_IOCTL ;AN000;MS.; let IOCTL take care of it 0 00001671 C3 return ;AN000;MS.; 592 errorfunc: ;AN000; 0 00001672 B001E9[0000] error error_invalid_function;AN000;MS. ; invalid function 594 EndProc D_GSetMediaID ;AN000; 595 596 END === Trace listing source: ../DOS/misc2.lst 1 ; SCCSID = @(#)misc2.asm 1.1 85/04/10 2 ;TITLE MISC2 - Miscellanious routines for MS-DOS 3 ;NAME MISC2 4 ; 5 ; Miscellaneous useful routines 6 ; 7 ; StrCpy 8 ; StrCmp 9 ; Ucase 10 ; StrLen 11 ; DStrLen 12 ; Idle 13 ; TableDispatch 14 ; FastInit ; DOS 4.0 15 ; FastRet ; DOS 4.0 16 ; NLS_OPEN ; DOS 4.0 17 ; NLS_LSEEK ; DOS 4.0 18 ; Fake_User_Stack ; DOS 4.0 19 ; GetDevList ; DOS 4.0 20 ; NLS_IOCTL ; DOS 4.0 21 ; NLS_GETEXT ; DOS 4.0 22 ; MSG_RETRIEVAL ; DOS 4.0 23 ; Fake_Version ; DOS 4.0 24 ; 25 ; Revision history: 26 ; 27 ; Created: ARR 30 March 1983 28 ; 29 ; A000 version 4.0 Jan. 1988 30 ; A001 DCR 486 - Share installation for >32mb drives 31 ; A006 DCR 503 - fake version number for IBMCACHE 32 33 [list -] 33 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 38 %include "entryseg.nas" 1 <1> 2 <1> %ifndef ENTRYSEGNAS 3 <1> %define ENTRYSEGNAS 1 4 <1> 5 <1> %include "lmacros3.mac" 6 <1> === Switch to base=000000h -> "DOSENTRY" 7 <1> addsection DOSENTRY, class=%[DOSENTRY] 8 <1> 9 <1> group DOSENTRYGROUP DOSENTRY 10 <1> 11 <1> %endif 39 40 [list +] 41 === Switch to base=002450h -> "DOSCODECODE" 42 section DOSCODECODE 43 [list -] 43 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 43 ****************** warning: out: BPB.INC... [-w+user] 43 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 51 52 i_need THISCDS,DWORD 53 I_Need RetryLoop,WORD 54 I_need fSharing,BYTE ; TRUE => server-issued call 55 I_need FastTable,BYTE ;AN000; 56 I_need FastFlg,BYTE ;AN000; 57 I_need User_SP_2F,WORD ;AN000; 58 I_need User_SP,WORD ;AN000; 59 I_need User_SS,WORD ;AN000; 60 I_need SysInitTable,BYTE ;AN000; 61 I_need EXTERR,WORD ;AN000; 62 I_need MSG_EXTERROR,DWORD ;AN000; 63 I_need fshare,byte ;AN001; 64 I_need Special_version,WORD ;AN006; 65 %if debug 66 I_need BugLev,WORD 67 I_need BugTyp,WORD 68 %include "bugtyp.nas" 69 %endif 70 71 Break 72 73 ; 74 ; Strcmp - compare ASCIZ DS:SI to ES:DI. Case INSENSITIVE. '/' = '\' 75 ; Strings of different lengths don't match. 76 ; Inputs: DS:SI - pointer to source string ES:DI - pointer to dest string 77 ; Outputs: Z if strings same, NZ if different 78 ; Registers modified: NONE 79 80 Procedure StrCmp,NEAR 80 ****************** warning: proc StrCmp... [-w+user] 81 ASSUME SS:nothing, DS:NOTHING, ES:NOTHING 0 00001677 565750 SaveReg 83 Cmplp: 0 0000167A AC LODSB 85 %IF DBCS ;AN000; 86 invoke testkanj ;AN000;; 2/13/KK 87 jz notkanj1 ;AN000;; 2/13/KK 88 dec si ;AN000;; Do source again 2/13/KK 89 cmpsb ;AN000;; First byte 2/13/KK 90 JNZ PopRet ;AN000;; Strings dif 2/13/KK 91 cmpsb ;AN000;; Second byte of kanji char 2/13/KK 92 JNZ PopRet ;AN000;; Strings dif 2/13/KK 93 mov al,byte ptr [SI-1] ;AN000;; Need last byte in AL 2/13/KK 94 jmp short Tend ;AN000; 95 notkanj1: ;AN000;; 2/13/KK 96 %ENDIF ;AN000; 0 0000167B E83300 CALL uCase ; convert to upper case 0 0000167E E8[0000] Invoke PathChrCmp ; convert / to \. 0 00001681 88C4 MOV AH,AL 0 00001683 268A05 MOV AL,[ES:DI] 0 00001686 47 INC DI 0 00001687 E82700 CALL uCase ; convert to upper case 0 0000168A E8[0000] Invoke PathChrCmp ; convert / to \. 0 0000168D 38C4 CMP AH,AL 0 0000168F 7504 JNZ PopRet ; Strings dif 106 Tend: 0 00001691 08C0 OR AL,AL 0 00001693 75E5 JNZ Cmplp ; More string 109 PopRet: 0 00001695 585F5E RestoreReg 0 00001698 C3 return 112 EndProc StrCmp 113 114 Break 115 116 ; 117 ; Strcpy - copy an ASCIZ string from DS:SI to ES:DI and make uppercase 118 ; FStrcpy - copy an ASCIZ string from DS:SI to ES:DI. no modification of 119 ; characters. 120 ; 121 ; Inputs: DS:SI - pointer to source string 122 ; ES:DI - pointer to destination string 123 ; Outputs: ES:DI point byte after nul byte at end of dest string 124 ; DS:SI point byte after nul byte at end of source string 125 ; Registers modified: SI,DI 126 127 Procedure StrCpy,NEAR 127 ****************** warning: proc StrCpy... [-w+user] 128 ASSUME SS:nothing, DS:NOTHING,ES:NOTHING 0 00001699 50 SaveReg 130 CPYLoop: 0 0000169A AC LODSB 132 %IF DBCS ;AN000; 133 invoke testkanj ;AN000;; 2/13/KK 134 jz notkanj2 ;AN000;; 2/13/KK 135 STOSB ;AN000;; 2/13/KK 136 LODSB ;AN000;; 2/13/KK 137 STOSB ;AN000;; 2/13/KK 138 jmp short CPYLoop ;AN000;; 3/31/KK 139 140 notkanj2: ;AN000;; 2/13/KK 141 %ENDIF ;AN000; 0 0000169B E81300 CALL uCase ; convert to upper case 0 0000169E E8[0000] Invoke PathChrCmp ; convert / to \. 0 000016A1 AA STOSB 145 Tend2: 0 000016A2 08C0 OR AL,AL 0 000016A4 75F4 JNZ CPYLoop 0 000016A6 58 RestoreReg 0 000016A7 C3 return 150 EndProc StrCpy 151 152 Procedure FStrCpy,NEAR 152 ****************** warning: proc FStrCpy... [-w+user] 153 ASSUME SS:nothing, DS:NOTHING,ES:NOTHING 0 000016A8 50 SaveReg 155 FCPYLoop: 0 000016A9 AC LODSB 0 000016AA AA STOSB 0 000016AB 08C0 OR AL,AL 0 000016AD 75FA JNZ FCPYLoop 0 000016AF 58 RestoreReg 0 000016B0 C3 return 162 EndProc FStrCpy 163 164 ; 165 ; Upper case the letter in AL. Most chars are non lowercase. 166 ; 167 Procedure uCase,NEAR 167 ****************** warning: proc uCase... [-w+user] 168 ; CMP AL,'a' 169 ; JAE Maybe 170 ; return 171 ;Maybe: 172 ; CMP AL,'z' 173 ; JA CaseRet 174 ; ADD AL,'A'-'a' 175 ;CaseRet: 176 ;;; 10/31/86 let's do file upper case for all DOS file names 0 000016B1 E8[0000] invoke GetLet2 178 ;;; 10/31/86 let's do file upper case for all DOS file names 0 000016B4 C3 return 180 EndProc uCase 181 182 Break 183 184 ; 185 ; StrLen - Compute length of string ES:DI 186 ; Inputs: ES:DI - pointer to string 187 ; Outputs: CX is size of string INCLUDING the NUL 188 ; Registers modified: CX 189 190 Procedure StrLen,NEAR 190 ****************** warning: proc StrLen... [-w+user] 191 ASSUME SS:nothing, DS:NOTHING,ES:NOTHING 0 000016B5 57 PUSH DI 0 000016B6 50 PUSH AX 0 000016B7 B9FFFF MOV CX,-1 0 000016BA 30C0 XOR AL,AL 0 000016BC F2AE REPNE SCASB 0 000016BE F7D1 NOT CX 0 000016C0 58 POP AX 0 000016C1 5F POP DI 0 000016C2 C3 return 201 EndProc StrLen 202 203 ; 204 ; DStrLen - Compute length of string DS:SI 205 ; Inputs: DS:SI - pointer to string 206 ; Outputs: CX is size of string INCLUDING the NUL 207 ; Registers modified: CX 208 Procedure DStrLen,NEAR 208 ****************** warning: proc DStrLen... [-w+user] 0 000016C3 E80700 CALL XCHGP 0 000016C6 E8ECFF CALL StrLen 0 000016C9 E80100 CALL XCHGP 0 000016CC C3 return 213 EndProc DStrLen 214 215 Break 216 217 Procedure XCHGP,NEAR 217 ****************** warning: proc XCHGP... [-w+user] 0 000016CD 1E06 SaveReg 0 000016CF 1F07 RestoreReg 0 000016D1 87F7 XCHG SI,DI 0 000016D3 C3 return 222 EndProc XCHGP 223 224 Break 225 226 ; 227 ; Idle - when retrying an operation due to a lock/sharing violation, we spin 228 ; until RetryLoop is exhausted. 229 ; 230 ; Inputs: RetryLoop is the number of times we spin 231 ; Outputs: Wait 232 ; Registers modified: none 233 234 Procedure Idle,NEAR 234 ****************** warning: proc Idle... [-w+user] 235 ASSUME SS:DOSGROUP,DS:NOTHING,ES:NOTHING 0 000016D4 36F606[0000]FF TEST byte [ss:fSharing],-1 0 000016DA 75F7 retnz 0 000016DC 51 SaveReg 0 000016DD 368B0E[0000] MOV CX,[ss:RetryLoop] 0 000016E2 E308 JCXZ Idle3 0 000016E4 51 Idle1: PUSH CX 0 000016E5 31C9 XOR CX,CX 0 000016E7 E2FE Idle2: LOOP Idle2 0 000016E9 59 POP CX 0 000016EA E2F8 LOOP Idle1 0 000016EC 59 Idle3: RestoreReg 0 000016ED C3 return 248 EndProc Idle 249 250 Break 251 252 ; 253 ; TableDispatch - given a table and an index, jmp to the approptiate 254 ; routine. Preserve all input registers to the routine. 255 ; 256 ; Inputs: Push return address 257 ; Push Table address 258 ; Push index (byte) 259 ; Outputs: appropriate routine gets jumped to. 260 ; return indicates invalid index 261 ; Registers modified: none. 262 263 TableFrame STRUC 0 00001677 ???? OldBP DW ? 0 00001679 ???? OldRet DW ? 0 0000167B ?? Index DB ? 0 0000167C ?? Pad DB ? 267 ****************** warning: multi-line macro `Pad' exists, but not taking 1 parameter [-w+pp-macro-params-multi] 0 0000167D ???? Tab DW ? 0 0000167F ???? NewRet DW ? 270 TableFrame ENDS 271 272 procedure TableDispatch,NEAR 272 ****************** warning: proc TableDispatch... [-w+user] 273 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 000016EE 55 PUSH BP 0 000016EF 89E5 MOV BP,SP 0 000016F1 53 PUSH BX ; save BX 0 000016F2 8B5E06 MOV BX,[BP + Tab] ; get pointer to table 0 000016F5 2E8A1F MOV BL,[CS:BX] ; maximum index 0 000016F8 385E04 CMP [BP + Index],BL ; table error? 0 000016FB 7317 JAE TableError ; yes 0 000016FD 8A5E04 MOV BL,[BP + Index] ; get desired table index 0 00001700 30FF XOR BH,BH ; convert to word 0 00001702 D1E3 SHL BX,1 ; convert to word pointer 0 00001704 43 INC BX ; point past first length byte 0 00001705 035E06 ADD BX,[BP + Tab] ; get real offset 0 00001708 2E8B1F MOV BX,[CS:BX] ; get contents of table entry 0 0000170B 895E06 MOV [BP + Tab],BX ; put table entry into return address 0 0000170E 5B POP BX ; restore BX 0 0000170F 5D POP BP ; restore BP 0 00001710 83C404 ADD SP,4 ; clean off Index and our return addr 0 00001713 C3 return ; do operation 292 TableError: 0 00001714 5B POP BX ; restore BX 0 00001715 5D POP BP ; restore BP 0 00001716 C20600 RET 6 ; clean off Index, Table and RetAddr 296 EndProc TableDispatch 297 298 Break 299 300 ; 301 ; TestNet - examine CDS pointed to by ThisCDS and see if it indicates a 302 ; network CDS. This will handle NULL cds also. 303 ; 304 ; Inputs: ThisCDS points to CDS or NULL 305 ; Outputs: ES:DI = ThisCDS 306 ; carry Set => network 307 ; carry Clear => local 308 ; Registers modified: none. 309 310 Procedure TestNet,NEAR 310 ****************** warning: proc TestNet... [-w+user] 311 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 312 ThisCDS equ THISCDS ; NASM port label 0 00001719 97 xchg ax, di 314 extern doscode_getdosdata 0 0000171A E8[0000] call doscode_getdosdata 0 0000171D 8EC0 mov es, ax 317 assume es:DOSGROUP 0 0000171F 26C406[0000] LES ax,[es:ThisCDS] 319 assume es:nothing 0 00001724 83F8FF CMP ax,-1 0 00001727 97 xchg ax, di 0 00001728 7408 je .CMCRet ; UNC? carry is clear 0 0000172A 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 00001730 7401 jz .ret ; --> NC 325 .CMCRet: 0 00001732 F5 CMC ; CY if networked 0 00001733 C3 .ret: return 328 329 EndProc TestNet 330 331 Break 332 333 ; 334 ; IsSFTNet - examine SF pointed to by ES:DI and see if it indicates a 335 ; network file. 336 ; 337 ; Inputs: ES:DI point to SFT 338 ; Outputs: Zero set if not network sft 339 ; zero reset otherwise 340 ; Carry CLEAR!!! 341 ; Registers modified: none. 342 343 Procedure IsSFTNet,NEAR 343 ****************** warning: proc IsSFTNet... [-w+user] 344 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00001734 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet 0 0000173A C3 return 347 EndProc IsSFTNet 348 349 Break 350 351 ; 2F.122A multDOS function 352 ; DOS 4.00 2/9/87 353 ; FastInit - initialize the FASTXXX routine entry 354 ; in the FastTable 355 ; 356 ; Inputs: BX = FASTXXX ID ( 1=fastopen, 2=fastseek,,,,) 357 ; DS:SI = address of FASTXXX routine entry 358 ; SI = -1 for query only 359 ; Outputs: Carry flag clear, if success 360 ; Carry flag set, if failure 361 ; 362 ; 363 364 extern doscode_getdosdata 365 366 Procedure FastInit,NEAR ;AN000; 366 ****************** warning: proc FastInit... [-w+user] 367 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING ;AN000; 368 0 0000173B 06 push es 0 0000173C E8[0000] call doscode_getdosdata 0 0000173F 8EC0 mov es, ax 372 assume es:DOSGROUP 373 0 00001741 BF[0200] MOV DI,OFFSET FastTable + 2 wrt DOSGROUP ;AN000;FO. points to fastxxx entry 0 00001744 4B DEC BX ;AN000;FO.;; decrement index 0 00001745 83FB02 cmp bx, 2 0 00001748 7317 jae fastinitinvalid 0 0000174A 89DA MOV DX,BX ;AN000;FO.;; save bx 0 0000174C D1E3 SHL BX,1 ;AN000;FO.;; times 4 , each entry is DWORD 0 0000174E D1E3 SHL BX,1 ;AN000;FO. 0 00001750 01DF ADD DI,BX ;AN000;FO. index to the entry 0 00001752 268B4502 MOV AX,WORD PTR [es:DI+2] ;AN000;FO. get entry segment 383 fcheck: ;AN000; 0 00001756 B9[0000] MOV CX, DOSENTRY ;AN000;FO.;; get DOS segment ; => DOSENTRY 0 00001759 39C8 CMP AX,CX ;AN000;FO.;; first time installed ? 0 0000175B 7407 JZ ok_install ;AN000;FO.;; yes 0 0000175D 85C0 test ax, ax ;AN000;FO.; 0 0000175F 7403 JZ ok_install ;AN000;FO.; 389 fastinitinvalid: 0 00001761 F9 STC ;AN000;FO.;; already installed ! 0 00001762 EB19 JMP SHORT FSret ;AN000;FO. set carry 392 ok_install: ;AN000; 0 00001764 83FEFF CMP SI,-1 ;AN000;FO.; Query only ? 0 00001767 7414 JZ FSret ;AN000;FO.; yes (NC) 0 00001769 8CD9 MOV CX,DS ;AN000;FO.; get FASTXXX entry segment 0 0000176B 8CD9 MOV CX,DS ;AN000;FO.;; get FASTXXX entry segment 0 0000176D 26894D02 MOV WORD PTR [es:DI+2],CX ;AN000;FO.;; initialize routine entry 0 00001771 268935 MOV WORD PTR [es:DI],SI ;AN000;FO.;; initialize routine offset 0 00001774 BF[0000] MOV DI,OFFSET FastFlg wrt DOSGROUP ;AN000;FO.; get addr of FASTXXX flags 0 00001777 01D7 ADD DI,DX ;AN000;FO.; index to a FASTXXX flag 0 00001779 26800D80 OR byte ptr [es:DI],Fast_yes ;AN000;FO.; indicate installed 402 ; (NC) 403 FSret: ;AN000; 0 0000177D 07 pop es 405 assume es:nothing 0 0000177E C3 return ;AN000;FO. 407 EndProc FastInit ;AN000;FO. 408 409 Break 410 411 ; DOS 3.3 6/10/86 412 ; FastRet - indicate FASTXXXX not in memory 413 ; 414 ; Inputs: None 415 ; Outputs: AX = -1 and carry flag set 416 ; 417 ; Registers modified: none. 418 419 relocated fastentry 420 Procedure FastRet,FAR 420 ****************** warning: proc FastRet... [-w+user] 421 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 0000177F B8FFFF MOV AX,-1 0 00001782 F9 STC 0 00001783 CB RET 425 EndProc FastRet 426 427 Break 428 429 ; DOS 3.3 6/10/86 430 ; NLS_OPEN - call $OPEN for NLSFUNC 431 ; 432 ; Inputs: Same input as $OPEN except CL = mode 433 ; Outputs: same output as $OPEN 434 ; 435 436 Procedure NLS_OPEN,NEAR 436 ****************** warning: proc NLS_OPEN... [-w+user] 437 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 438 439 ; MOV BL,[CPSWFLAG] ; disable code page matching logic 440 ; MOV [CPSWFLAG],0 441 ; PUSH BX ; save current state 442 0 00001784 88C8 MOV AL,CL ; set up correct interface for $OPEN 0 00001786 E8[0000] invoke D_OPEN 445 446 ; POP BX ; restore current state 447 ; MOV [CPSWFLAG],BL 0 00001789 C3 RET 449 EndProc NLS_OPEN 450 451 Break 452 453 ; DOS 3.3 6/10/86 454 ; NLS_LSEEK - call $LSEEK for NLSFUNC 455 ; 456 ; Inputs: BP = open mode 457 ; Outputs: same output as $LSEEK 458 ; 459 460 Procedure NLS_LSEEK,NEAR 460 ****************** warning: proc NLS_LSEEK... [-w+user] 461 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 462 463 user_SP equ User_SP ; NASM port label 0 0000178A 36FF36[0000] PUSH word [ss:user_SP] ; save user stack 465 user_SS equ User_SS ; NASM port label 0 0000178F 36FF36[0000] PUSH word [ss:user_SS] 0 00001794 E81000 CALL Fake_User_Stack 0 00001797 89E8 MOV AX,BP ; set up correct interface for $LSEEK 0 00001799 E8[0000] invoke D_LSEEK 0 0000179C 368F06[0000] POP word [ss:user_SS] ; restore user stack 0 000017A1 368F06[0000] POP word [ss:user_SP] 0 000017A6 C3 RET 473 EndProc NLS_LSEEK 474 475 476 Break 477 478 479 ; DOS 3.3 6/10/86 480 ; Fake_User_Stack - save user stack pointer 481 ; 482 483 Procedure Fake_User_Stack,NEAR 483 ****************** warning: proc Fake_User_Stack... [-w+user] 484 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 485 0 000017A7 36A1[0000] MOV AX,[ss:User_SP_2F] ; replace with INT 2F stack 0 000017AB 36A3[0000] MOV [ss:user_SP],AX 0 000017AF 368C16[0000] MOV [ss:user_SS],ss ; DOSGROUP 489 0 000017B4 C3 RET 491 EndProc Fake_User_Stack 492 493 ; 494 Break 495 496 497 ; DOS 3.3 7/25/86 498 ; GetDevList - get device header list pointer 499 ; 500 ; Output: AX:BX points to the device header list 501 502 Procedure GetDevList,NEAR 502 ****************** warning: proc GetDevList... [-w+user] 503 ASSUME DS:NOTHING,ES:NOTHING,SS:nothing 504 505 extern SYSINITVAR 506 0 000017B5 E8[0000] call doscode_getdosdata 0 000017B8 8ED8 mov ds, ax 509 assume ds:DOSGROUP 0 000017BA BE[0000] mov si, SYSINITVAR 0 000017BD 8B4422 MOV AX,WORD PTR [SI + SYSI_DEV] 0 000017C0 8B5C24 MOV BX,WORD PTR [SI + SYSI_DEV+2] 513 0 000017C3 C3 RET 515 EndProc GetDevList 516 517 Break 518 519 ; DOS 3.3 7/25/86 520 ; NLS_IOCTL - call $IOCTL for NLSFUNC 521 ; 522 ; Inputs: BP = function code 0CH 523 ; Outputs: same output as generic $IOCTL 524 ; 525 526 Procedure NLS_IOCTL,NEAR 526 ****************** warning: proc NLS_IOCTL... [-w+user] 527 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 528 0 000017C4 36FF36[0000] PUSH word [ss:user_SP] ; save user stack 0 000017C9 36FF36[0000] PUSH word [ss:user_SS] 0 000017CE E8D6FF CALL Fake_User_Stack 0 000017D1 89E8 MOV AX,BP ; set up correct interface for $LSEEK 0 000017D3 E8[0000] invoke D_IOCTL 0 000017D6 368F06[0000] POP word [ss:user_SS] ; restore user stack 0 000017DB 368F06[0000] POP word [ss:user_SP] 0 000017E0 C3 RET 537 EndProc NLS_IOCTL 538 539 Break 540 541 ; DOS 3.3 7/25/86 542 ; NLS_GETEXT - 543 ; 544 ; Inputs: none 545 ; Outputs: AX = extended error 546 ; 547 548 Procedure NLS_GETEXT,NEAR 548 ****************** warning: proc NLS_GETEXT... [-w+user] 549 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 550 0 000017E1 1E push ds 0 000017E2 E8[0000] call doscode_getdosdata 0 000017E5 8ED8 mov ds, ax 554 assume ds:DOSGROUP 0 000017E7 A1[0000] mov ax, [EXTERR] ; return extended error 0 000017EA 1F pop ds 557 assume ds:nothing 0 000017EB C3 RET 559 EndProc NLS_GETEXT 560 561 Break 562 563 ; DOS 4.00 564 ; 565 ; Inputs: DL=0 get extended error message addr 566 ; =1 set extended error message addr 567 ; =2 get parser error message addr 568 ; =3 set parser error message addr 569 ; =4 get critical error message addr 570 ; =5 set critical error message addr 571 ; =6 get file system error message addr 572 ; =7 set file system error message addr 573 ; =8 get address for code reduction 574 ; =9 set address for code reduction 575 ; Function: get/set message address 576 ; Outputs: ES:DI points to addr when get 577 ; 578 579 Procedure MSG_RETRIEVAL,NEAR ;AN000; 579 ****************** warning: proc MSG_RETRIEVAL... [-w+user] 580 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING ;AN000; 581 0 000017EC 50 PUSH AX ;AN000;;MS. save regs 0 000017ED 56 PUSH SI ;AN000;;MS. save regs 0 000017EE 1E push ds 0 000017EF E8[0000] call doscode_getdosdata 0 000017F2 8ED8 mov ds, ax 587 assume ds:DOSGROUP 0 000017F4 89D0 MOV AX,DX ;AN000;;MS. 0 000017F6 BE[0000] MOV SI,OFFSET MSG_EXTERROR wrt DOSGROUP ;AN000;;MS. 0 000017F9 A801 TEST AL,1 ;AN000;;MS. get ? 0 000017FB 7401 JZ toget ;AN000;;MS. yes 0 000017FD 48 DEC ax ;AN000;;MS. 593 toget: ;AN000; 0 000017FE 3C0A cmp al, 10 0 00001800 7312 jae .invalid 0 00001802 D0E0 SHL AL,1 ;AN000;;MS. times 2 0 00001804 30E4 XOR AH,AH ;AN000;;MS. 0 00001806 01C6 ADD SI,AX ;AN000;;MS. position to the entry 0 00001808 F6C201 TEST DL,1 ;AN000;;MS. get ? (NC) 0 0000180B 7414 JZ getget ;AN000;;MS. yes 0 0000180D 893C MOV WORD PTR [SI],DI ;AN000;;MS. set MSG 0 0000180F 8C4402 MOV WORD PTR [SI+2],ES ;AN000;;MS. address to ES:DI 0 00001812 EB0F JMP SHORT MSGret ;AN000;;MS. exit 604 .invalid: 0 00001814 F6C201 test dl, 1 0 00001817 7505 jnz .invalidset 0 00001819 BFFFFF mov di, -1 0 0000181C 8EC7 mov es, di 609 assume es:nothing 610 .invalidset: 0 0000181E F9 stc 0 0000181F EB02 jmp MSGret 613 getget: ;AN000; 0 00001821 C43C LES DI,[SI] ;AN000;;MS. get msg addr 615 assume es:nothing 616 MSGret: ;AN000; 0 00001823 1F pop ds 618 assume ds:nothing 0 00001824 5E POP SI ;AN000;;MS. 0 00001825 58 POP AX ;AN000;;MS. 0 00001826 C3 return ;AN000;;MS. exit 622 623 EndProc MSG_RETRIEVAL ;AN000; 624 625 626 Break 627 628 ; 629 ; Inputs: DL=0 current version number 630 ; <>0 special version number 631 ; Function: set special version number 632 ; Outputs: version number is changed 633 ; 634 635 Procedure Fake_version,NEAR ;AN000; 635 ****************** warning: proc Fake_version... [-w+user] 636 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING ;AN000; 637 0 00001827 1E push ds 0 00001828 50 push ax 0 00001829 E8[0000] call doscode_getdosdata 0 0000182C 8ED8 mov ds, ax 642 assume ds:DOSGROUP 0 0000182E 58 pop ax 0 0000182F 8916[0000] MOV [Special_version],DX ;AN006;MS. 0 00001833 1F pop ds 646 assume ds:nothing 0 00001834 C3 return ;AN006;;MS. exit 648 649 EndProc Fake_version ;AN006;;MS. 650 651 END === Trace listing source: ../DOS/crit.lst 1 ; SCCSID = @(#)crit.asm 1.1 85/04/10 2 ;TITLE CRIT - Critical Section Routines 3 ;NAME CRIT 4 ; 5 ; Critical Section Routines 6 ; 7 ; Critical section handlers 8 ; 9 ; Modification history: 10 ; 11 ; Created: ARR 30 March 1983 12 ; 13 14 [list -] 14 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <1> [list -] 19 %include "dosseg.nas" 1 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 3 <1> ; 4 <1> ; segment ordering for MSDOS 5 <1> ; 6 <1> 7 <1> %include "ddataseg.nas" 1 <2> 2 <2> %include "lmacros3.mac" 1 <3> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 24 global ECritDisk 25 global ECritMem 26 global ECritSFT 27 global LCritDisk 28 global LCritMem 29 global LCritSFT 30 31 ECritDisk: 32 ECritMem: 33 ECritSFT: 0 00001835 53 push bx 0 00001836 BB[0100] mov bx, patch_dosdata_EcritDisk 0 00001839 EB10 jmp transfer_doscode_to_dosdata 37 38 LCritDisk: 39 LCritMem: 40 LCritSFT: 0 0000183B 53 push bx 0 0000183C BB[0900] mov bx, patch_dosdata_LcritDisk 0 0000183F EB0A jmp transfer_doscode_to_dosdata 44 45 global ECritDevice 46 global LCritDevice 47 48 ECritDevice: 0 00001841 53 push bx 0 00001842 BB[1100] mov bx, patch_dosdata_EcritDevice 0 00001845 EB04 jmp transfer_doscode_to_dosdata 52 53 LCritDevice: 0 00001847 53 push bx 0 00001848 BB[1900] mov bx, patch_dosdata_LcritDevice 56 57 global transfer_doscode_to_dosdata 58 59 transfer_doscode_to_dosdata: 60 assume ds:nothing, es:nothing, ss:nothing 61 lframe 0 62 lpar word, in_ip_out_cs 63 lpar word, in_bx_out_ip 64 lpar word, in_ax_out_dosdata_retf 0 0000184B 50 push ax ; ?in_ax = ax 0 0000184C E81500 call doscode_getdosdata 67 lpar dword, transferto 0 0000184F 50 push ax ; ?transferto + 2 = DOSDATA 0 00001850 53 push bx ; ?transferto = entrypoint 0 00001851 5589E5 lenter 0 00001854 8CCB mov bx, cs 0 00001856 875E0A xchg bx, [bp + ?in_ip_out_cs] ; ?out_cs = cs 0 00001859 875E08 xchg bx, [bp + ?in_bx_out_ip] ; ?out_ip = ip 74 ; bx = ?in_bx 0 0000185C B8[0000] mov ax, dosdata_retf 0 0000185F 874606 xchg ax, [bp + ?in_ax_out_dosdata_retf] 77 ; ?out_dosdata_retf = dosdata_retf 78 ; ax = ?in_ax 0 00001862 5D lleave , optimiserestoresp 0 00001863 CB retf ; branch to ?transferto, 81 ; ?out_dosdata_retf and ?out_csip on stack 82 83 global doscode_getdosdata 84 doscode_getdosdata: 85 assume ds:nothing 0 00001864 1E push ds 0 00001865 B80000 mov ax, 0 0 00001868 8ED8 mov ds, ax ; ds => IVT 89 assume ds:IVT 0 0000186A A1C600 mov ax, [31h * 4 + 2] ; ds => DOSDATA 0 0000186D 1F pop ds 92 assume ds:nothing 0 0000186E C3 retn 94 95 === Switch to base=000E10h -> "DOSDATACODE" 96 section DOSDATACODE ; in DOSDATA 97 98 dosdata_retf: 0 0000125E CB retf 100 101 [list -] 101 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 101 ****************** warning: out: BPB.INC... [-w+user] 101 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 107 108 I_need User_In_AX,WORD 109 i_need CurrentPDB,WORD 110 %if debug 111 I_need BugLev,WORD 112 I_need BugTyp,WORD 113 %include "bugtyp.nas" 114 %endif 115 116 Break 117 118 ; 119 ; Each handler must leave everything untouched; including flags! 120 ; 121 ; Sleaze for time savings: first instruction is a return. This is patched 122 ; by the sharer to be a PUSH AX to complete the correct routines. 123 ; 124 125 global patch_dosdata_EcritDisk 126 patch_dosdata_EcritDisk: 0 0000125F C3 RETn 128 ; PUSH AX 129 fmt TypSect,LevReq,<"PDB $x entering $x">, 0 00001260 B80180 MOV AX,8000h+critDisk 131 int_ibm equ int_IBM ; NASM port equate 0 00001263 CD2A INT int_ibm 0 00001265 58 POP AX 0 00001266 C3 retn 135 136 global patch_dosdata_LcritDisk 137 patch_dosdata_LcritDisk: 0 00001267 C3 RETn 139 ; PUSH AX 140 fmt TypSect,LevReq,<"PDB $x entering $x">, 0 00001268 B80181 MOV AX,8100h+critDisk 0 0000126B CD2A INT int_ibm 0 0000126D 58 POP AX 0 0000126E C3 retn 145 146 global patch_dosdata_EcritDevice 147 patch_dosdata_EcritDevice: 0 0000126F C3 RETn 149 ; PUSH AX 150 fmt TypSect,LevReq,<"PDB $x entering $x">, 0 00001270 B80280 MOV AX,8000h+critDevice 0 00001273 CD2A INT int_ibm 0 00001275 58 POP AX 0 00001276 C3 retn 155 156 global patch_dosdata_LcritDevice 157 patch_dosdata_LcritDevice: 0 00001277 C3 RETn 159 ; PUSH AX 0 00001278 B80281 MOV AX,8100h+critDevice 0 0000127B CD2A INT int_ibm 0 0000127D 58 POP AX 0 0000127E C3 retn 164 165 END === Trace listing source: ../DOS/cpmio.lst 1 ; SCCSID = @(#)cpmio.asm 1.1 85/04/10 2 ;TITLE CPMIO - device IO for MSDOS 3 ;NAME CPMIO 4 ; 5 ; Standard device IO for MSDOS (first 12 function calls) 6 ; 7 8 [list -] 8 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 11 ;.cref 12 [list +] 13 14 ; 15 ; Old style CP/M 1-12 system calls to talk to reserved devices 16 ; 17 ; $Std_Con_Input_No_Echo 18 ; $Std_Con_String_Output 19 ; $Std_Con_String_Input 20 ; $RawConIO 21 ; $RawConInput 22 ; RAWOUT 23 ; RAWOUT2 24 ; 25 ; Revision history: 26 ; 27 ; A000 version 4.00 - Jan 1988 28 ; A002 PTM -- dir >lpt3 hangs 29 ; 30 ; 31 ; 32 ; 33 ; 34 ; 35 ; 36 ; 37 ; 38 ; 39 === Switch to base=002450h -> "DOSCODECODE" 40 section DOSCODECODE 41 42 ;.xcref 43 [list -] 43 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 43 ****************** warning: out: BPB.INC... [-w+user] 43 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 43 ****************** warning: out: DEVSYM.INC... [-w+user] 48 ;.cref 49 50 %ifndef KANJI 51 %iassign KANJI 0 ;FALSE 52 %endif 53 54 ; The following routines form the console I/O group (funcs 1,2,6,7,8,9,10,11). 55 ; They assume ES and DS NOTHING, while not strictly correct, this forces data 56 ; references to be SS or CS relative which is desired. 57 58 i_need CARPOS,BYTE 59 i_need STARTPOS,BYTE 60 i_need INBUF,128 61 i_need INSMODE,BYTE 62 i_need user_SP,WORD 63 EXTRN EscChar:BYTE ; lead byte for function keys 64 EXTRN CanChar:BYTE ; Cancel character 65 EXTRN OUTCHA:NEAR ;AN000 char out with status check 2/11/KK 66 i_need Printer_Flag,BYTE 67 i_need SCAN_FLAG,BYTE 68 i_need DATE_FLAG,WORD 69 i_need Packet_Temp,WORD ; temporary packet used by readtime 70 i_need DEVCALL,DWORD 71 i_need InterChar,BYTE ;AN000;interim char flag ( 0 = regular char) 72 i_need InterCon,BYTE ;AN000;console flag ( 1 = in interim mode ) 73 i_need SaveCurFlg,BYTE ;AN000;console out ( 1 = print and do not advance) 74 i_need COUNTRY_CDPG,byte ;AN000; 2/12/KK 75 i_need TEMP_VAR,WORD ;AN000; 2/12/KK 76 i_need DOS34_FLAG,WORD ;AN000; 2/12/KK 77 i_need FETCHI_TAG, word 78 79 80 assume nocheck, ss:DOSGROUP 81 82 Break 83 %IF DBCS ;AN000; 84 85 ;-------------------------------- Start of Korean Support 2/11/KK 86 procedure D_STD_CON_INPUT_NO_ECHO,NEAR ;System call 8 ;AN000; 87 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 88 89 StdCILop: ;AN000; 90 invoke INTER_CON_INPUT_NO_ECHO ;AN000; 91 transfer InterApRet ; go to return fuction ;AN000; 92 93 EndProc D_STD_CON_INPUT_NO_ECHO ;AN000; 94 95 procedure INTER_CON_INPUT_NO_ECHO,NEAR ;AN000; 96 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 97 ;-----------------------------------End of Korean Support 2/11/KK 98 99 ; Inputs: 100 ; None 101 ; Function: 102 ; Same as $STD_CON_INPUT_NO_ECHO but uses interim character read from 103 ; the device. 104 ; Returns: 105 ; AL = character 106 ; Zero flag SET if interim character, RESET otherwise 107 108 %ELSE ;AN000; 109 110 111 ; 112 ; Inputs: 113 ; None 114 ; Function: 115 ; Input character from console, no echo 116 ; Returns: 117 ; AL = character 118 119 procedure D_STD_CON_INPUT_NO_ECHO,NEAR ;System call 8 119 ****************** warning: proc D_STD_CON_INPUT_NO_ECHO... [-w+user] 120 ASSUME DS:NOTHING,ES:NOTHING 121 122 %ENDIF 0 0000186F 1E PUSH DS 0 00001870 56 PUSH SI 125 INTEST: 0 00001871 E8[0000] invoke STATCHK 0 00001874 7547 JNZ Get 128 ;************************************************************************* 0 00001876 36803E[0000]00 cmp byte [ss:Printer_Flag],0 ; is printer idle? 0 0000187C 7505 jnz no_sys_wait 0 0000187E B405 mov ah,5 ; get input status with system wait 0 00001880 E8[0000] invoke IOFUNC 133 no_sys_wait: 134 ;************************************************************************** 0 00001883 B484 MOV AH,84h 0 00001885 CD2A INT int_IBM 137 138 ;;; 7/15/86 update the date in the idle loop 139 ;;; Dec 19, 1986 D.C.L. changed following CMP to Byte Ptr from Word Ptr 140 ;;;; to shorten loop in consideration of the PC Convertible 141 0 00001887 36803E[0000]FF CMP byte ptr [ss:DATE_FLAG],-1 ; date is updated may be every 0 0000188D 7527 JNZ NoUpdate ; 65535 x ? ms if no one calls 0 0000188F 50 PUSH AX 0 00001890 53 PUSH BX ; following is tricky, 0 00001891 51 PUSH CX ; it may be called by critical handler 0 00001892 52 PUSH DX ; at that time, DEVCALL is used by 148 ; other's READ or WRITE 0 00001893 1E PUSH DS ; save DS = SFT's sgement 0 00001894 16 PUSH ss ; READTIME must use DS=CS 0 00001895 1F POP DS 152 assume ds:DOSGROUP 153 0 00001896 B80000 MOV AX,0 ; therefore, we save DEVCALL 0 00001899 E8DC02 CALL Save_Restore_Packet ; save DEVCALL packet 0 0000189C E8[0000] invoke READTIME ; readtime 0 0000189F B80100 MOV AX,1 0 000018A2 E8D302 CALL Save_Restore_Packet ; restore DEVCALL packet 159 0 000018A5 36813E[0000]7258 CMP word ptr [ss:FETCHI_TAG],22642 0 000018AC 7403 JZ check_ok 0 000018AE E8[0000] invoke TAGCRASHDOS ; should never come here 163 check_ok: 164 0 000018B1 1F POP DS ; restore DS 166 assume ds:nothing 0 000018B2 5A POP DX 0 000018B3 59 POP CX 0 000018B4 5B POP BX 0 000018B5 58 POP AX 171 NoUpdate: 0 000018B6 36FF06[0000] INC word [ss:DATE_FLAG] 173 174 ;;; 7/15/86 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 175 Intest equ INTEST ; NASM port label 0 000018BB EBB4 JMP Intest 177 Get: 0 000018BD 30E4 XOR AH,AH 0 000018BF E8[0000] invoke IOFUNC 0 000018C2 5E POP SI 0 000018C3 1F POP DS 182 assume ds:nothing 183 ;;; 7/15/86 0 000018C4 36C606[0000]00 MOV BYTE PTR [ss:SCAN_FLAG],0 0 000018CA 3C00 CMP AL,0 ; extended code ( AL ) 0 000018CC 7506 JNZ noscan 0 000018CE 36C606[0000]01 MOV BYTE PTR [ss:SCAN_FLAG],1 ; set this flag for ALT_Q key 188 189 noscan: 190 ;;; 7/15/86 191 %IF DBCS ;AN000; 192 cmp byte [ss:InterChar],1 ;AN000; set the zero flag if the character3/31/KK ;AN000; 193 %ENDIF ;AN000; 0 000018D4 C3 return 195 %IF DBCS ;AN000; 196 EndProc INTER_CON_INPUT_NO_ECHO ;AN000; ;2/11/KK ;AN000; 197 %ELSE ;AN000; 198 EndProc D_STD_CON_INPUT_NO_ECHO 199 %ENDIF ;AN000; 200 201 Break 202 203 ; Inputs: 204 ; DS:DX Point to output string '$' terminated 205 ; Function: 206 ; Print the string on the console device 207 ; Returns: 208 ; None 209 210 procedure D_STD_CON_STRING_OUTPUT,NEAR ;System call 9 210 ****************** warning: proc D_STD_CON_STRING_OUTPUT... [-w+user] 211 ASSUME DS:NOTHING,ES:NOTHING 212 0 000018D5 89D6 MOV SI,DX 214 STRING_OUT1: 0 000018D7 AC LODSB 216 %IF DBCS ;AN000; 217 invoke TESTKANJ ;AN000; 2/11/KK ;AN000; 218 jz SBCS00 ;AN000; 2/11/KK ;AN000; 219 invoke OUTT ;AN000; 2/11/KK ;AN000; 220 LODSB ;AN000; 2/11/KK ;AN000; 221 JMP NEXT_STR1 ;AN000; 2/11/KK ;AN000; 222 SBCS00: ;AN000; 2/11/KK ;AN000; 223 %ENDIF ;AN000; 0 000018D8 3C24 CMP AL,'$' 0 000018DA 74F8 retz 226 NEXT_STR1: 0 000018DC E8[0000] invoke OUTT 0 000018DF EBF6 JMP STRING_OUT1 229 230 EndProc D_STD_CON_STRING_OUTPUT 231 232 %IF DBCS ;AN000; 233 ;=== Push trace listing source: kstrin.nas 234 %include "kstrin.nas" ;AN000; 235 ;=== Pop trace listing source 236 %ELSE ;AN000; 237 ;=== Push trace listing source: strin.nas 238 %include "strin.nas" 1 <1> ; SCCSID = @(#)strin.asm 1.2 85/04/18 2 <1> Break 3 <1> 4 <1> assume nocheck, ss:DOSGROUP 5 <1> 6 <1> ; Inputs: 7 <1> ; DS:DX Point to an input buffer 8 <1> ; Function: 9 <1> ; Fill buffer from console input until CR 10 <1> ; Returns: 11 <1> ; None 12 <1> 13 <1> procedure D_STD_CON_STRING_INPUT,NEAR ;System call 10 13 ****************** <1> warning: proc D_STD_CON_STRING_INPUT... [-w+user] 14 <1> ASSUME DS:NOTHING,ES:NOTHING 15 <1> 0 000018E1 8CD0 MOV AX,SS 0 000018E3 8EC0 MOV ES,AX 18 <1> assume es:DOSGROUP 0 000018E5 89D6 MOV SI,DX 0 000018E7 30ED XOR CH,CH 0 000018E9 AD LODSW 22 <1> ; 23 <1> ; AL is the buffer length 24 <1> ; AH is the template length 25 <1> ; 0 000018EA 08C0 OR AL,AL 0 000018EC 74E6 retz ;Buffer is 0 length!!? 0 000018EE 88E3 MOV BL,AH ;Init template counter 0 000018F0 88EF MOV BH,CH ;Init template counter 30 <1> ; 31 <1> ; BL is the number of bytes in the template 32 <1> ; 0 000018F2 38D8 CMP AL,BL 0 000018F4 7605 JBE NOEDIT ;If length of buffer inconsistent with contents 0 000018F6 80380D CMP BYTE PTR [BX+SI],c_CR 0 000018F9 7402 JZ EDITON ;If CR correctly placed EDIT is OK 37 <1> ; 38 <1> ; The number of chars in the template is >= the number of chars in buffer or 39 <1> ; there is no CR at the end of the template. This is an inconsistant state 40 <1> ; of affairs. Pretend that the template was empty: 41 <1> ; 42 <1> NOEDIT: 0 000018FB 88EB MOV BL,CH ;Reset buffer 44 <1> EDITON: 0 000018FD 88C2 MOV DL,AL 0 000018FF 4A DEC DX ;DL is # of bytes we can put in the buffer 47 <1> ; 48 <1> ; Top level. We begin to read a line in. 49 <1> ; 50 <1> NEWLIN: 0 00001900 36A0[0000] MOV AL,[ss:CARPOS] 0 00001904 36A2[0000] MOV [ss:STARTPOS],AL ;Remember position in raw buffer 0 00001908 56 PUSH SI 0 00001909 BF[0000] MOV DI,OFFSET INBUF wrt DOSGROUP ;Build the new line here 0 0000190C 36882E[0000] MOV [ss:INSMODE],CH ;Insert mode off 0 00001911 88EF MOV BH,CH ;No chars from template yet 0 00001913 88EE MOV DH,CH ;No chars to new line yet 0 00001915 E857FF invoke D_STD_CON_INPUT_NO_ECHO ;Get first char 0 00001918 3C0A CMP AL,c_LF ;Linefeed 0 0000191A 7503 JNZ GOTCH ;Filter out LF so < works 61 <1> ; 62 <1> ; This is the main loop of reading in a character and processing it. 63 <1> ; 64 <1> ; BH is the index of the next byte in the template 65 <1> ; BL is the length of the template 66 <1> ; DH is the number of bytes in the buffer 67 <1> ; DL is the length of the buffer 68 <1> ; 69 <1> entry GETCH 0 0000191C E850FF invoke D_STD_CON_INPUT_NO_ECHO 71 <1> GOTCH: 72 <1> ; 73 <1> ; Brain-damaged TP ignored ^F in case his BIOS did not flush the 74 <1> ; input queue. 75 <1> ; 0 0000191F 3C06 CMP AL,"F"-"@" 0 00001921 74F9 JZ GETCH 78 <1> ; 79 <1> ; If the leading char is the function-key lead byte 80 <1> ; 81 <1> ESCCHAR equ EscChar ; NASM port label 0 00001923 363A06[0000] CMP AL,[ss:ESCCHAR] 0 00001928 7443 JZ ESCape ;change reserved keyword DBM 5-7-87 84 <1> ; 85 <1> ; Rubout and ^H are both destructive backspaces. 86 <1> ; 0 0000192A 3C7F CMP AL,c_DEL 0 0000192C 7436 JZ BACKSPJ 0 0000192E 3C08 CMP AL,c_BS 0 00001930 7432 JZ BACKSPJ 91 <1> ; 92 <1> ; ^W deletes backward once and then backs up until a letter is before the 93 <1> ; cursor 94 <1> ; 0 00001932 3C17 CMP AL,"W" - "@" 96 <1> ; The removal of the comment characters before the jump statement will 97 <1> ; cause ^W to backup a word. 98 <1> ;*** JZ WordDel 0 00001934 90 NOP 0 00001935 90 NOP 0 00001936 3C15 CMP AL,"U" - "@" 102 <1> ; The removal of the comment characters before the jump statement will 103 <1> ; cause ^U to clear a line. 104 <1> ;*** JZ LineDel 0 00001938 90 NOP 0 00001939 90 NOP 107 <1> 108 <1> ; 109 <1> ; CR terminates the line. 110 <1> ; 0 0000193A 3C0D CMP AL,c_CR 0 0000193C 7432 JZ ENDLIN 113 <1> ; 114 <1> ; LF goes to a new line and keeps on reading. 115 <1> ; 0 0000193E 3C0A CMP AL,c_LF 0 00001940 7444 JZ PHYCRLF 118 <1> ; 119 <1> ; ^X (or ESC) deletes the line and starts over 120 <1> ; 121 <1> CANCHAR equ CanChar ; NASM port label 0 00001942 363A06[0000] CMP AL,[ss:CANCHAR] 0 00001947 746B JZ KILNEW 124 <1> ; 125 <1> ; Otherwise, we save the input character. 126 <1> ; 127 <1> SAVCH: 0 00001949 38D6 CMP DH,DL 0 0000194B 7319 JAE BUFFUL ; buffer is full. 0 0000194D AA STOSB 0 0000194E FEC6 INC DH ; increment count in buffer. 0 00001950 E8[0000] invoke BUFOUT ;Print control chars nicely 0 00001953 36803E[0000]00 CMP BYTE PTR [ss:INSMODE],0 0 00001959 75C1 JNZ GETCH ; insertmode => don't advance template 0 0000195B 38DF CMP BH,BL 0 0000195D 73BD JAE GETCH ; no more characters in template 0 0000195F 46 INC SI ; Skip to next char in template 0 00001960 FEC7 INC BH ; remember position in template 0 00001962 EBB8 JMP SHORT GETCH 140 <1> 141 <1> BACKSP equ BackSp ; NASM port label 0 00001964 EB61 BACKSPJ: JMP SHORT BACKSP 143 <1> 144 <1> BUFFUL: 0 00001966 B007 MOV AL,7 ; Bell to signal full buffer 0 00001968 E8[0000] invoke OUTT 0 0000196B EBAF JMP SHORT GETCH 148 <1> 149 <1> ESCape: ;change reserved keyword DBM 5-7-87 0 0000196D E9[0000] transfer OEMFunctionKey ; let the OEM's handle the key dispatch 151 <1> 152 <1> ENDLIN: 0 00001970 AA STOSB ; Put the CR in the buffer 0 00001971 E8[0000] invoke OUTT ; Echo it 0 00001974 5F POP DI ; Get start of user buffer 0 00001975 8875FF MOV [DI-1],DH ; Tell user how many bytes 0 00001978 FEC6 INC DH ; DH is length including CR 158 <1> entry COPYNEW 0 0000197A 1E06 SaveReg 0 0000197C 1F07 RestoreReg ; XCHG ES,DS 0 0000197E BE[0000] MOV SI,OFFSET INBUF wrt DOSGROUP 0 00001981 88F1 MOV CL,DH ; set up count 0 00001983 F3A4 REP MOVSB ; Copy final line to user buffer 0 00001985 C3 return 165 <1> ; 166 <1> ; Output a CRLF to the user screen and do NOT store it into the buffer 167 <1> ; 168 <1> PHYCRLF: 0 00001986 E84B01 invoke CRLF 0 00001989 EB91 JMP GETCH 171 <1> 172 <1> ; 173 <1> ; Delete the previous line 174 <1> ; 175 <1> LineDel: 0 0000198B 08F6 OR DH,DH 177 <1> GetCh equ GETCH ; NASM port label 0 0000198D 748D JZ GetCh 0 0000198F E83B00 Call BackSpace 0 00001992 EBF7 JMP LineDel 181 <1> 182 <1> ; 183 <1> ; delete the previous word. 184 <1> ; 185 <1> WordDel: 186 <1> WordLoop: 0 00001994 E83600 Call BackSpace ; backspace the one spot 0 00001997 08F6 OR DH,DH 0 00001999 7416 JZ GetChJ 0 0000199B 268A45FF MOV AL,[ES:DI-1] 0 0000199F 3C30 cmp al,'0' 192 <1> GetChj equ GetChJ ; NASM port label 0 000019A1 720E jb GetChj 0 000019A3 3C39 cmp al,'9' 0 000019A5 76ED jbe WordLoop 0 000019A7 0C20 OR AL,20h 0 000019A9 3C61 CMP AL,'a' 0 000019AB 7204 JB GetChJ 0 000019AD 3C7A CMP AL,'z' 0 000019AF 76E3 JBE WordLoop 201 <1> GetChJ: 0 000019B1 E968FF JMP GetCh 203 <1> ; 204 <1> ; The user wants to throw away what he's typed in and wants to start over. We 205 <1> ; print the backslash and then go to the next line and tab to the correct spot 206 <1> ; to begin the buffered input. 207 <1> ; 208 <1> entry KILNEW 0 000019B4 B05C MOV AL,"\" 0 000019B6 E8[0000] invoke OUTT ;Print the CANCEL indicator 0 000019B9 5E POP SI ;Remember start of edit buffer 212 <1> PUTNEW: 0 000019BA E81701 invoke CRLF ;Go to next line on screen 0 000019BD 36A0[0000] MOV AL,[ss:STARTPOS] 0 000019C1 E8[0000] invoke TAB ;Tab over 0 000019C4 E939FF JMP NEWLIN ;Start over again 217 <1> 218 <1> 219 <1> ; 220 <1> ; Destructively back up one character position 221 <1> ; 222 <1> entry BackSp 0 000019C7 E80300 Call BackSpace 0 000019CA E94FFF JMP GetCh 225 <1> 226 <1> BackSpace: 0 000019CD 08F6 OR DH,DH 0 000019CF 7419 JZ OLDBAK ;No chars in line, do nothing to line 0 000019D1 E85800 CALL BACKUP ;Do the backup 0 000019D4 268A05 MOV AL,[ES:DI] ;Get the deleted char 0 000019D7 3C20 CMP AL," " 0 000019D9 730F JAE OLDBAK ;Was a normal char 0 000019DB 3C09 CMP AL,c_HT 0 000019DD 741B JZ BAKTAB ;Was a tab, fix up users display 235 <1> ;; 9/27/86 fix for ctrl-U backspace 0 000019DF 3C15 CMP AL,"U"-"@" ; ctrl-U is a section symbol not ^U 0 000019E1 7407 JZ OLDBAK 0 000019E3 3C14 CMP AL,"T"-"@" ; ctrl-T is a paragraphs symbol not ^T 0 000019E5 7403 JZ OLDBAK 240 <1> ;; 9/27/86 fix for ctrl-U backspace 0 000019E7 E84500 CALL BACKMES ;Was a control char, zap the '^' 242 <1> OLDBAK: 0 000019EA 36803E[0000]00 CMP BYTE PTR [ss:INSMODE],0 0 000019F0 7593 retnz ;In insert mode, done 0 000019F2 08FF OR BH,BH 0 000019F4 748F retz ;Not advanced in template, stay where we are 0 000019F6 FECF DEC BH ;Go back in template 0 000019F8 4E DEC SI 0 000019F9 C3 return 250 <1> 251 <1> BAKTAB: 0 000019FA 57 PUSH DI 0 000019FB 4F DEC DI ;Back up one char 0 000019FC FD STD ;Go backward 0 000019FD 88F1 MOV CL,DH ;Number of chars currently in line 0 000019FF B020 MOV AL," " 0 00001A01 53 PUSH BX 0 00001A02 B307 MOV BL,7 ;Max 0 00001A04 E30E JCXZ FIGTAB ;At start, do nothing 260 <1> FNDPOS: 0 00001A06 AE SCASB ;Look back 0 00001A07 7609 JNA CHKCNT 0 00001A09 26807D0109 CMP BYTE PTR [ES:DI+1],9 0 00001A0E 7409 JZ HAVTAB ;Found a tab 0 00001A10 FECB DEC BL ;Back one char if non tab control char 266 <1> CHKCNT: 0 00001A12 E2F2 LOOP FNDPOS 268 <1> FIGTAB: 0 00001A14 362A1E[0000] SUB BL,[ss:STARTPOS] 270 <1> HAVTAB: 0 00001A19 28F3 SUB BL,DH 0 00001A1B 00D9 ADD CL,BL 0 00001A1D 80E107 AND CL,7 ;CX has correct number to erase 0 00001A20 FC CLD ;Back to normal 0 00001A21 5B POP BX 0 00001A22 5F POP DI 0 00001A23 74C5 JZ OLDBAK ;Nothing to erase 278 <1> TABBAK: 0 00001A25 E80700 invoke BACKMES 0 00001A28 E2FB LOOP TABBAK ;Erase correct number of chars 0 00001A2A EBBE JMP SHORT OLDBAK 282 <1> 283 <1> BACKUP: 0 00001A2C FECE DEC DH ;Back up in line 0 00001A2E 4F DEC DI 286 <1> BACKMES: 0 00001A2F B008 MOV AL,c_BS ;Backspace 0 00001A31 E8[0000] invoke OUTT 0 00001A34 B020 MOV AL," " ;Erase 0 00001A36 E8[0000] invoke OUTT 0 00001A39 B008 MOV AL,c_BS ;Backspace 0 00001A3B E9[0000] JMP OUTT ;Done 293 <1> 294 <1> ;User really wants an ESC character in his line 295 <1> entry TwoEsc 0 00001A3E 36A0[0000] MOV AL,[ss:ESCCHAR] 0 00001A42 E904FF JMP SAVCH 298 <1> 299 <1> ;Copy the rest of the template 300 <1> entry COPYLIN 0 00001A45 88D9 MOV CL,BL ;Total size of template 0 00001A47 28F9 SUB CL,BH ;Minus position in template, is number to move 0 00001A49 EB07 JMP SHORT COPYEACH 304 <1> 305 <1> entry CopyStr 0 00001A4B E83400 invoke FINDOLD ;Find the char 0 00001A4E EB02 JMP SHORT COPYEACH ;Copy up to it 308 <1> 309 <1> ;Copy one char from template to line 310 <1> entry COPYONE 0 00001A50 B101 MOV CL,1 312 <1> ;Copy CX chars from template to line 313 <1> COPYEACH: 0 00001A52 36C606[0000]00 MOV BYTE PTR [ss:INSMODE],0 ;All copies turn off insert mode 0 00001A58 38D6 CMP DH,DL 0 00001A5A 740F JZ GETCH2 ;At end of line, can't do anything 0 00001A5C 38DF CMP BH,BL 0 00001A5E 740B JZ GETCH2 ;At end of template, can't do anything 0 00001A60 AC LODSB 0 00001A61 AA STOSB 0 00001A62 E8[0000] invoke BUFOUT 0 00001A65 FEC7 INC BH ;Ahead in template 0 00001A67 FEC6 INC DH ;Ahead in line 0 00001A69 E2E7 LOOP COPYEACH 325 <1> GETCH2: 0 00001A6B E9AEFE JMP GETCH 327 <1> 328 <1> ;Skip one char in template 329 <1> entry SKIPONE 0 00001A6E 38DF CMP BH,BL 0 00001A70 74F9 JZ GETCH2 ;At end of template 0 00001A72 FEC7 INC BH ;Ahead in template 0 00001A74 46 INC SI 0 00001A75 E9A4FE JMP GETCH 335 <1> 336 <1> entry SKIPSTR 0 00001A78 E80700 invoke FINDOLD ;Find out how far to go 0 00001A7B 01CE ADD SI,CX ;Go there 0 00001A7D 00CF ADD BH,CL 0 00001A7F E99AFE JMP GETCH 341 <1> 342 <1> ;Get the next user char, and look ahead in template for a match 343 <1> ;CX indicates how many chars to skip to get there on output 344 <1> ;NOTE: WARNING: If the operation cannot be done, the return 345 <1> ; address is popped off and a jump to GETCH is taken. 346 <1> ; Make sure nothing extra on stack when this routine 347 <1> ; is called!!! (no PUSHes before calling it). 348 <1> FINDOLD: 0 00001A82 E8EAFD invoke D_STD_CON_INPUT_NO_ECHO 0 00001A85 363A06[0000] CMP AL,[ss:ESCCHAR] ; did he type a function key? 0 00001A8A 7506 JNZ FindSetup ; no, set up for scan 0 00001A8C E8E0FD invoke D_STD_CON_INPUT_NO_ECHO ; eat next char 353 <1> NotFnd equ NOTFND ; NASM port label 0 00001A8F EB1E JMP NotFnd ; go try again 0 00001A91 90 nop ; identicalise 356 <1> FindSetup: 0 00001A92 88D9 MOV CL,BL 0 00001A94 28F9 SUB CL,BH ;CX is number of chars to end of template 0 00001A96 7417 JZ NOTFND ;At end of template 0 00001A98 49 DEC CX ;Cannot point past end, limit search 0 00001A99 7414 JZ NOTFND ;If only one char in template, forget it 0 00001A9B 06 PUSH ES 0 00001A9C 1E PUSH DS 0 00001A9D 07 POP ES 365 <1> assume es:nothing 0 00001A9E 57 PUSH DI 0 00001A9F 89F7 MOV DI,SI ;Template to ES:DI 0 00001AA1 47 INC DI 0 00001AA2 F2AE REPNE SCASB ;Look 0 00001AA4 5F POP DI 0 00001AA5 07 POP ES 372 <1> assume es:nothing 0 00001AA6 7507 JNZ NOTFND ;Didn't find the char 0 00001AA8 F6D1 NOT CL ;Turn how far to go into how far we went 0 00001AAA 00D9 ADD CL,BL ;Add size of template 0 00001AAC 28F9 SUB CL,BH ;Subtract current pos, result distance to skip 0 00001AAE C3 return 378 <1> 379 <1> NOTFND: 0 00001AAF 5D POP BP ;Chuck return address 0 00001AB0 E969FE JMP GETCH 382 <1> 383 <1> entry REEDIT 0 00001AB3 B040 MOV AL,"@" ;Output re-edit character 0 00001AB5 E8[0000] invoke OUTT 0 00001AB8 5F POP DI 0 00001AB9 57 PUSH DI 0 00001ABA 06 PUSH ES 0 00001ABB 1E PUSH DS 0 00001ABC E8BBFE invoke COPYNEW ;Copy current line into template 0 00001ABF 1F POP DS 392 <1> assume ds:nothing 0 00001AC0 07 POP ES 394 <1> assume es:nothing 0 00001AC1 5E POP SI 0 00001AC2 88F3 MOV BL,DH ;Size of line is new size template 0 00001AC4 E9F3FE JMP PUTNEW ;Start over again 398 <1> 399 <1> entry EXITINS 400 <1> entry ENTERINS 0 00001AC7 36F616[0000] NOT BYTE PTR [ss:INSMODE] 0 00001ACC E94DFE JMP GETCH 403 <1> 404 <1> ;Put a real live ^Z in the buffer (embedded) 405 <1> entry CTRLZ 0 00001ACF B01A MOV AL,"Z"-"@" 0 00001AD1 E975FE JMP SAVCH 408 <1> 409 <1> ;Output a CRLF 410 <1> entry CRLF 0 00001AD4 B00D MOV AL,c_CR 0 00001AD6 E8[0000] invoke OUTT 0 00001AD9 B00A MOV AL,c_LF 0 00001ADB E9[0000] JMP OUTT 415 <1> 416 <1> EndProc D_STD_CON_STRING_INPUT 417 <1> 418 <1> 239 ;=== Pop trace listing source 240 %ENDIF ;AN000; 241 242 Break 243 244 ; Inputs: 245 ; DL = -1 if input 246 ; else DL is output character 247 ; Function: 248 ; Input or output raw character from console, no echo 249 ; Returns: 250 ; AL = character 251 252 procedure D_RAW_CON_IO,NEAR ; System call 6 252 ****************** warning: proc D_RAW_CON_IO... [-w+user] 253 ASSUME DS:NOTHING,ES:NOTHING 254 0 00001ADE 88D0 MOV AL,DL 0 00001AE0 3CFF CMP AL,-1 0 00001AE2 7403 JZ RAW22 ;AN000; 0 00001AE4 EB43 JMP RAWOUT ;AN000; 0 00001AE6 90 nop ; identicalise 260 RAW22: ;AN000; 0 00001AE7 36C43E[0000] LES DI,[ss:user_SP] ; Get pointer to register save area 0 00001AEC 31DB XOR BX,BX 0 00001AEE E8[0000] invoke GET_IO_SFT 0 00001AF1 72BB retc 265 %IF DBCS ;AN000; 266 Intercon equ InterCon ; NASM port label 267 push word ptr [Intercon] ;AN000; 268 mov byte [Intercon],0 ;AN000; disable interim characters 269 %ENDIF ;AN000; 0 00001AF3 B401 MOV AH,1 0 00001AF5 E8[0000] invoke IOFUNC 0 00001AF8 750B JNZ RESFLG 273 %IF DBCS ;AN000; 274 pop word ptr [InterCon] ;AN000; restore interim flag 275 %ENDIF ;AN000; 0 00001AFA E8[0000] invoke SPOOLINT 0 00001AFD 26804D1640 OR BYTE PTR [ES:DI + user_F],40H ; Set user's zero flag 0 00001B02 30C0 XOR AL,AL 0 00001B04 C3 return 280 281 RESFLG: 0 00001B05 26806516BF AND BYTE PTR [ES:DI + user_F],0FFH-40H ; Reset user's zero flag 283 %IF DBCS ;AN000; 284 XOR AH,AH ;AN000; 285 invoke IOFUNC ;AN000; get the character 286 pop word ptr [InterCon] ;AN000; 287 return ;AN000; 288 %ENDIF ;AN000; ;AN000; 289 290 RILP: 0 00001B0A E8[0000] invoke SPOOLINT 292 293 ; Inputs: 294 ; None 295 ; Function: 296 ; Input raw character from console, no echo 297 ; Returns: 298 ; AL = character 299 300 entry D_RAW_CON_INPUT ; System call 7 301 0 00001B0D 53 PUSH BX 0 00001B0E 31DB XOR BX,BX 0 00001B10 E8[0000] invoke GET_IO_SFT 0 00001B13 5B POP BX 0 00001B14 72EE retc 0 00001B16 B401 MOV AH,1 0 00001B18 E8[0000] invoke IOFUNC 0 00001B1B 7506 JNZ Got 0 00001B1D B484 MOV AH,84h 0 00001B1F CD2A INT int_IBM 0 00001B21 EBE7 JMP RILP 313 Got: 0 00001B23 30E4 XOR AH,AH 0 00001B25 E8[0000] invoke IOFUNC 316 %IF DBCS ;AN000; 317 cmp byte [InterChar],1 ;AN000; 2/11/KK 318 ; 2/11/KK 319 ; Sets the application zero flag depending on the 2/11/KK 320 ; zero flag upon entry to this routine. Then returns 2/11/KK 321 ; from system call. 2/11/KK 322 ; 2/11/KK 323 entry InterApRet ;AN000; 2/11/KK ;AN000; 324 pushf ;AN000; 3/16/KK 325 push ds ;AN000; 3/16/KK 326 push bx ;AN000; 3/16/KK 327 Context DS ;AN000; 3/16/KK 328 MOV BX,offset COUNTRY_CDPG.ccDosCodePage wrt DOSGROUP 329 cmp word ptr [bx],934 ;AN000; 3/16/KK korean code page ? 330 pop bx ;AN000; 3/16/KK 331 pop ds ;AN000; 3/16/KK 332 je do_koren ;AN000; 3/16/KK 333 popf ;AN000; 3/16/KK 334 return ;AN000; 3/16/KK 335 do_koren: ;AN000; 3/16/KK 336 popf ;AN000; 337 LES DI,[user_SP] ;AN000; Get pointer to register save area KK 338 jnz sj0 ;AN000; 2/11/KK 339 OR BYTE PTR [ES:DI + user_F],40H ;AN000; Set user's zero flag 2/11/KK 340 return ;AN000; 2/11/KK 341 sj0: ;AN000; 2/11/KK 342 AND BYTE PTR [ES:DI + user_F],0FFH-40H ;AN000; Reset user's zero flag 2/KK 343 %ENDIF ;AN000; 0 00001B28 C3 return ;AN000; 345 ; 346 ; Output the character in AL to stdout 347 ; 348 entry RAWOUT 349 0 00001B29 53 PUSH BX 0 00001B2A BB0100 MOV BX,1 352 0 00001B2D E8[0000] invoke GET_IO_SFT 0 00001B30 721B JC RAWRET1 355 0 00001B32 8B5C05 MOV BX,[SI + sf_flags] 357 358 ; 359 ; If we are a network handle OR if we are not a local device then go do the 360 ; output the hard way. 361 ; 362 363 sf_isNet equ sf_isnet ; NASM port equate 0 00001B35 81E38080 AND BX,sf_isNet + devid_device 0 00001B39 81FB8000 CMP BX,devid_device 366 RawNorm equ RAWNORM ; NASM port label 0 00001B3D 7510 JNZ RawNorm 368 %IF DBCS ;AN000; 369 TEST byte [SaveCurFlg],01H ;AN000; print but no cursor adv? 370 JNZ RAWNORM ;AN000; 2/11/KK 371 %ENDIF ;AN000; 372 373 ; TEST BX,sf_isnet ; output to NET? 374 ; JNZ RAWNORM ; if so, do normally 375 ; TEST BX,devid_device ; output to file? 376 ; JZ RAWNORM ; if so, do normally 377 0 00001B3F 1E PUSH DS 0 00001B40 C55C07 LDS BX,[SI + sf_devptr] ; output to special? 380 assume ds:nothing 0 00001B43 F6470410 TEST BYTE PTR [BX+SDEVATT],ISSPEC 0 00001B47 1F POP DS 383 assume ds:nothing 0 00001B48 7405 JZ RAWNORM ; if not, do normally 0 00001B4A CD29 INT int_fastcon ; quickly output the char 386 RAWRET: 0 00001B4C F8 CLC 388 RAWRET1: 0 00001B4D 5B POP BX 0 00001B4E C3 return 391 RAWNORM: 0 00001B4F E80700 CALL RAWOUT3 0 00001B52 EBF8 JMP RAWRET 394 395 ; 396 ; Output the character in AL to handle in BX 397 ; 398 entry RAWOUT2 399 0 00001B54 E8[0000] invoke GET_IO_SFT 0 00001B57 72F5 retc 402 RAWOUT3: 0 00001B59 50 PUSH AX 0 00001B5A EB0D JMP SHORT RAWOSTRT 405 ROLP: 0 00001B5C E8[0000] invoke SPOOLINT 0 00001B5F 36810E[0000]0002 OR word [ss:DOS34_FLAG],CTRL_BREAK_FLAG ;AN002; set control break 0 00001B66 E8[0000] invoke DSKSTATCHK ;AN002; check control break 409 RAWOSTRT: 0 00001B69 B403 MOV AH,3 0 00001B6B E8[0000] invoke IOFUNC 0 00001B6E 74EC JZ ROLP 0 00001B70 58 POP AX 0 00001B71 B402 MOV AH,2 0 00001B73 E8[0000] invoke IOFUNC 0 00001B76 F8 CLC ; Clear carry indicating successful 0 00001B77 C3 return 418 EndProc D_RAW_CON_IO 419 420 ; Inputs: 421 ; AX=0 save the DEVCALL request packet 422 ; =1 restore the DEVCALL request packet 423 ; Function: 424 ; save or restore the DEVCALL packet 425 ; Returns: 426 ; none 427 428 procedure Save_Restore_Packet,NEAR 428 ****************** warning: proc Save_Restore_Packet... [-w+user] 429 ASSUME DS:NOTHING,ES:NOTHING 430 0 00001B78 1E PUSH DS 0 00001B79 06 PUSH ES 0 00001B7A 56 PUSH SI 0 00001B7B 57 PUSH DI 0 00001B7C 83F800 CMP AX,0 ; save packet 0 00001B7F 7409 JZ save_packet 437 restore_packet: 0 00001B81 BE[0000] MOV SI,OFFSET Packet_Temp wrt DOSGROUP ;sourec 0 00001B84 BF[0000] MOV DI,OFFSET DEVCALL wrt DOSGROUP ;destination 0 00001B87 EB07 JMP set_seg 0 00001B89 90 nop ; identicalise 442 save_packet: 0 00001B8A BF[0000] MOV DI,OFFSET Packet_Temp wrt DOSGROUP ;destination 0 00001B8D BE[0000] MOV SI,OFFSET DEVCALL wrt DOSGROUP ;source 445 set_seg: 0 00001B90 8CD0 MOV AX,ss ; set DS,ES to DOSGROUP 0 00001B92 8ED8 MOV DS,AX 0 00001B94 8EC0 MOV ES,AX 449 assume ds:DOSGROUP, es:DOSGROUP 0 00001B96 B90B00 MOV CX,11 ; 11 words to move 0 00001B99 F3A5 REP MOVSW 452 0 00001B9B 5F POP DI 0 00001B9C 5E POP SI 0 00001B9D 07 POP ES 0 00001B9E 1F POP DS 457 assume ds:nothing, es:nothing 0 00001B9F C3 return 459 EndProc Save_Restore_Packet 460 461 END === Trace listing source: ../DOS/cpmio2.lst 1 ; SCCSID = @(#)cpmio2.asm 1.1 85/04/11 2 ;TITLE CPMIO2 - device IO for MSDOS 3 ;NAME CPMIO2 4 5 [list -] 5 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 8 ;.cref 9 [list +] 10 11 ; 12 ; Old style CP/M 1-12 system calls to talk to reserved devices 13 ; 14 ; $Std_Con_Input 15 ; $Std_Con_Output 16 ; OUTT 17 ; TAB 18 ; BUFOUT 19 ; $Std_Aux_Input 20 ; $Std_Aux_Output 21 ; $Std_Printer_Output 22 ; $Std_Con_Input_Status 23 ; $Std_Con_Input_Flush 24 ; 25 ; Revision History: 26 ; 27 ; AN000 version 4.00 - Jan. 1988 28 ; 29 === Switch to base=002450h -> "DOSCODECODE" 30 section DOSCODECODE 31 32 ;.xcref 33 [list -] 33 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 33 ****************** warning: out: BPB.INC... [-w+user] 33 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 33 ****************** warning: out: DEVSYM.INC... [-w+user] 37 ;.cref 38 39 ; The following routines form the console I/O group (funcs 1,2,6,7,8,9,10,11). 40 ; They assume ES and DS NOTHING, while not strictly correct, this forces data 41 ; references to be SS or CS relative which is desired. 42 43 i_need CARPOS,BYTE 44 i_need CHARCO,BYTE 45 i_need PFLAG,BYTE 46 i_need CurrentPDB,WORD ;AN000; 47 i_need InterCon,BYTE ;AN000; 48 i_need SaveCurFlg,BYTE ;AN000; 49 50 51 assume nocheck, ss:DOSGROUP 52 53 Break 54 55 ; Inputs: 56 ; None 57 ; Function: 58 ; Input character from console, echo 59 ; Returns: 60 ; AL = character 61 62 procedure D_STD_CON_INPUT,NEAR ;System call 1 62 ****************** warning: proc D_STD_CON_INPUT... [-w+user] 63 ASSUME DS:NOTHING,ES:NOTHING 64 65 %IF DBCS ;AN000; 66 push word ptr [InterCon] ;AN000; 67 mov byte [InterCon],01H ;AN000; 68 invoke INTER_CON_INPUT_NO_ECHO ;AN000; 69 pop word ptr [InterCon] ;AN000; 70 pushf ;AN000; 71 push AX ;AN000; 72 mov byte [SaveCurFlg],0 ;AN000; 73 jnz sj0 ;AN000; 74 mov byte [SaveCurFlg],1 ;AN000; 75 sj0: ;AN000; 76 invoke OUTT ;AN000; 77 SaveCurFLg equ SaveCurFlg ; NASM port label 78 mov byte [SaveCurFLg],0 ;AN000; 79 pop AX ;AN000; 80 popf ;AN000; 81 jz D_STD_CON_INPUT ;AN000; 82 %ELSE ;AN000; 0 00001BA0 E8[0000] invoke D_STD_CON_INPUT_NO_ECHO 0 00001BA3 50 PUSH AX 0 00001BA4 E80400 invoke OUTT 0 00001BA7 58 POP AX 87 %ENDIF ;AN000; 0 00001BA8 C3 return 89 EndProc D_STD_CON_INPUT 90 91 Break 92 93 ; Inputs: 94 ; DL = character 95 ; Function: 96 ; Output character to console 97 ; Returns: 98 ; None 99 100 procedure D_STD_CON_OUTPUT,NEAR ;System call 2 100 ****************** warning: proc D_STD_CON_OUTPUT... [-w+user] 101 public OUTCHA ;AN000; 102 ASSUME DS:NOTHING,ES:NOTHING 103 0 00001BA9 88D0 MOV AL,DL 105 106 entry OUTT 0 00001BAB 3C20 CMP AL,20H 0 00001BAD 725F JB CTRLOUT 0 00001BAF 3C7F CMP AL,c_DEL 0 00001BB1 7405 JZ OUTCH 111 OUTCHA: ;AN000; 0 00001BB3 36FE06[0000] INC BYTE PTR [ss:CARPOS] 113 OUTCH: 0 00001BB8 1E PUSH DS 0 00001BB9 56 PUSH SI 0 00001BBA 36FE06[0000] INC BYTE PTR [ss:CHARCO] ;invoke statchk... 0 00001BBF 368026[0000]3F AND BYTE PTR [ss:CHARCO],00111111B ;AN000; every 64th char 0 00001BC5 7505 JNZ OUTSKIP 0 00001BC7 50 PUSH AX 0 00001BC8 E8[0000] invoke STATCHK 0 00001BCB 58 POP AX 122 OUTSKIP: 0 00001BCC E8[0000] invoke RAWOUT ;output the character 0 00001BCF 5E POP SI 0 00001BD0 1F POP DS 126 assume ds:nothing 127 %IF DBCS ;AN000; 128 TEST byte [SaveCurFlg],01H ;AN000;print but no cursor adv? 2/13/KK 129 retnz ;AN000;if so then do not send to prt2/13/KK 130 %ENDIF 0 00001BD1 36F606[0000]FF TEST BYTE PTR [ss:PFLAG],-1 0 00001BD7 74CF retz 0 00001BD9 53 PUSH BX 0 00001BDA 1E PUSH DS 0 00001BDB 56 PUSH SI 0 00001BDC BB0100 MOV BX,1 0 00001BDF E8[0000] invoke GET_IO_SFT 0 00001BE2 7224 JC TRIPOPJ 0 00001BE4 8B5C05 MOV BX,[SI + sf_flags] 0 00001BE7 F7C30080 TEST BX,sf_isnet ; output to NET? 0 00001BEB 751B JNZ TRIPOPJ ; if so, no echo 0 00001BED F7C38000 TEST BX,devid_device ; output to file? 0 00001BF1 7415 JZ TRIPOPJ ; if so, no echo 0 00001BF3 BB0400 MOV BX,4 0 00001BF6 E8[0000] invoke GET_IO_SFT 0 00001BF9 720D JC TRIPOPJ 0 00001BFB F744050008 TEST word [SI + sf_flags],sf_net_spool ; StdPrn redirected? 0 00001C00 7409 JZ LISSTRT2J ; No, OK to echo 0 00001C02 36C606[0000]00 MOV BYTE PTR [ss:PFLAG],0 ; If a spool, NEVER echo 150 TRIPOPJ: 0 00001C08 E98B00 JMP TRIPOP 152 153 LISSTRT2J: 0 00001C0B E98500 JMP LISSTRT2 155 156 CTRLOUT: 0 00001C0E 3C0D CMP AL,c_CR 0 00001C10 7420 JZ ZERPOS 0 00001C12 3C08 CMP AL,c_BS 0 00001C14 7428 JZ BACKPOS 0 00001C16 3C09 CMP AL,c_HT 0 00001C18 759E JNZ OUTCH 0 00001C1A 36A0[0000] MOV AL,[ss:CARPOS] 0 00001C1E 0CF8 OR AL,0F8H 0 00001C20 F6D8 NEG AL 166 167 entry TAB 168 0 00001C22 51 PUSH CX 0 00001C23 88C1 MOV CL,AL 0 00001C25 B500 MOV CH,0 0 00001C27 E307 JCXZ POPTAB 173 TABLP: 0 00001C29 B020 MOV AL," " 0 00001C2B E87DFF invoke OUTT 0 00001C2E E2F9 LOOP TABLP 177 POPTAB: 0 00001C30 59 POP CX 0 00001C31 C3 return 180 181 ZERPOS: 0 00001C32 36C606[0000]00 MOV BYTE PTR [ss:CARPOS],0 0 00001C38 E97DFF JMP OUTCH 0 00001C3B E96DFF OUTJ: JMP OUTT 185 186 BACKPOS: 0 00001C3E 36FE0E[0000] DEC BYTE PTR [ss:CARPOS] 0 00001C43 E972FF JMP OUTCH 189 190 entry BUFOUT 0 00001C46 3C20 CMP AL," " 0 00001C48 73F1 JAE OUTJ ;Normal char 0 00001C4A 3C09 CMP AL,9 0 00001C4C 74ED JZ OUTJ ;OUT knows how to expand tabs 195 196 ;DOS 3.3 7/14/86 0 00001C4E 3C15 CMP AL,"U"-"@" ; turn ^U to section symbol 0 00001C50 740D JZ CTRLU 0 00001C52 3C14 CMP AL,"T"-"@" ; turn ^T to paragraph symbol 0 00001C54 7409 JZ CTRLU 201 NOT_CTRLU: 202 ;DOS 3.3 7/14/86 203 0 00001C56 50 PUSH AX 0 00001C57 B05E MOV AL,"^" 0 00001C59 E84FFF invoke OUTT ;Print '^' before control chars 0 00001C5C 58 POP AX 0 00001C5D 0C40 OR AL,40H ;Turn it into Upper case mate 209 CTRLU: 0 00001C5F E849FF invoke OUTT 0 00001C62 C3 return 212 EndProc D_STD_CON_OUTPUT 213 214 Break 215 216 ; Inputs: 217 ; None 218 ; Function: 219 ; Returns character from aux input 220 ; Returns: 221 ; Character in AL 222 223 procedure D_STD_AUX_INPUT,NEAR ;System call 3 223 ****************** warning: proc D_STD_AUX_INPUT... [-w+user] 224 ASSUME DS:NOTHING,ES:NOTHING 225 0 00001C63 E8[0000] invoke STATCHK 0 00001C66 BB0300 MOV BX,3 0 00001C69 E8[0000] invoke GET_IO_SFT 0 00001C6C 72F4 retc 0 00001C6E EB03 JMP SHORT TAISTRT 231 AUXILP: 0 00001C70 E8[0000] invoke SPOOLINT 233 TAISTRT: 0 00001C73 B401 MOV AH,1 0 00001C75 E8[0000] invoke IOFUNC 0 00001C78 74F6 JZ AUXILP 0 00001C7A 30E4 XOR AH,AH 0 00001C7C E8[0000] invoke IOFUNC 0 00001C7F C3 return 240 EndProc D_STD_AUX_INPUT 241 242 Break 243 244 ; Inputs: 245 ; Character in DL 246 ; Function: 247 ; Output character to aux output 248 ; Returns: 249 ; Nothing 250 251 procedure D_STD_AUX_OUTPUT,NEAR ;System call 4 251 ****************** warning: proc D_STD_AUX_OUTPUT... [-w+user] 252 ASSUME DS:NOTHING,ES:NOTHING 253 0 00001C80 53 PUSH BX 0 00001C81 BB0300 MOV BX,3 0 00001C84 EB04 JMP SHORT SENDOUT 257 258 EndProc D_STD_AUX_OUTPUT 259 260 Break 261 262 ; Inputs: 263 ; DL = Character 264 ; Function: 265 ; Output the character to the list device 266 ; Returns: 267 ; None 268 269 procedure D_STD_PRINTER_OUTPUT,NEAR ;System call 5 269 ****************** warning: proc D_STD_PRINTER_OUTPUT... [-w+user] 270 ASSUME DS:NOTHING,ES:NOTHING 271 0 00001C86 53 PUSH BX 0 00001C87 BB0400 MOV BX,4 274 275 SENDOUT: 0 00001C8A 88D0 MOV AL,DL 0 00001C8C 50 PUSH AX 0 00001C8D E8[0000] invoke STATCHK 0 00001C90 58 POP AX 0 00001C91 1E PUSH DS 0 00001C92 56 PUSH SI 282 LISSTRT2: 0 00001C93 E8[0000] invoke RAWOUT2 284 TRIPOP: 0 00001C96 5E POP SI 0 00001C97 1F POP DS 287 assume ds:nothing 0 00001C98 5B POP BX 0 00001C99 C3 return 290 EndProc D_STD_PRINTER_OUTPUT 291 292 Break 293 294 ; Inputs: 295 ; None 296 ; Function: 297 ; Check console input status 298 ; Returns: 299 ; AL = -1 character available, = 0 no character 300 301 procedure D_STD_CON_INPUT_STATUS,NEAR ;System call 11 301 ****************** warning: proc D_STD_CON_INPUT_STATUS... [-w+user] 302 ASSUME DS:NOTHING,ES:NOTHING 303 0 00001C9A E8[0000] invoke STATCHK 0 00001C9D B000 MOV AL,0 ; no xor!! 0 00001C9F 74F8 retz 0 00001CA1 0CFF OR AL,-1 0 00001CA3 C3 return 309 EndProc D_STD_CON_INPUT_STATUS 310 311 Break 312 313 ; Inputs: 314 ; AL = DOS function to be called after flush (1,6,7,8,10) 315 ; Function: 316 ; Flush console input buffer and perform call in AL 317 ; Returns: 318 ; Whatever call in AL returns or AL=0 if AL was not 1,6,7,8 or 10 319 320 procedure D_STD_CON_INPUT_FLUSH,NEAR ;System call 12 320 ****************** warning: proc D_STD_CON_INPUT_FLUSH... [-w+user] 321 ASSUME DS:NOTHING,ES:NOTHING 322 0 00001CA4 50 PUSH AX 0 00001CA5 52 PUSH DX 0 00001CA6 31DB XOR BX,BX 0 00001CA8 E8[0000] invoke GET_IO_SFT 0 00001CAB 7205 JC BADJFNCON 0 00001CAD B404 MOV AH,4 0 00001CAF E8[0000] invoke IOFUNC 330 331 BADJFNCON: 0 00001CB2 5A POP DX 0 00001CB3 58 POP AX 0 00001CB4 88C4 MOV AH,AL 0 00001CB6 3C01 CMP AL,1 0 00001CB8 7413 JZ REDISPJ 0 00001CBA 3C06 CMP AL,6 0 00001CBC 740F JZ REDISPJ 0 00001CBE 3C07 CMP AL,7 0 00001CC0 740B JZ REDISPJ 0 00001CC2 3C08 CMP AL,8 0 00001CC4 7407 JZ REDISPJ 0 00001CC6 3C0A CMP AL,10 0 00001CC8 7403 JZ REDISPJ 0 00001CCA B000 MOV AL,0 0 00001CCC C3 return 347 348 REDISPJ: 349 %IF DBCS ;AN000; 350 mov ds,[CurrentPDB] ;AN000; 351 ;AN000; set DS same as one from COMMAND entry 352 %ENDIF 0 00001CCD FA CLI 0 00001CCE E9[0000] transfer REDISP 355 EndProc D_STD_CON_INPUT_FLUSH 356 357 END === Trace listing source: ../DOS/fcbio.lst 1 ; SCCSID = @(#)fcbio.asm 1.5 85/07/30 2 ; SCCSID = @(#)fcbio.asm 1.5 85/07/30 3 ;TITLE FCBIO - FCB system calls 4 ;NAME FCBIO 5 6 ; 7 ; Ancient 1.0 1.1 FCB system calls 8 ; regen save 9 ; $GET_FCB_POSITION written none none 10 ; $FCB_DELETE written none none 11 ; $GET_FCB_FILE_LENGTH written none none 12 ; $FCB_CLOSE written close none 13 ; $FCB_RENAME written none none 14 ; SaveFCBInfo 15 ; ResetLRU 16 ; SetOpenAge 17 ; LRUFCB 18 ; FCBRegen 19 ; BlastSFT 20 ; CheckFCB 21 ; SFTFromFCB 22 ; FCBHardErr 23 ; 24 ; Revision history: 25 ; 26 ; Created: ARR 4 April 1983 27 ; MZ 6 June 1983 completion of functions 28 ; MZ 15 Dec 1983 Brain damaged programs close FCBs multiple 29 ; times. Change so successive closes work by 30 ; always returning OK. Also, detect I/O to 31 ; already closed FCB and return EOF. 32 ; MZ 16 Jan 1984 More braindamage. Need to separate info 33 ; out of sft into FCB for reconnection 34 ; 35 ; A000 version 4.00 Jan. 1988 36 ; 37 [list -] 37 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 42 43 [list +] === Switch to base=002450h -> "DOSCODECODE" 44 section DOSCODECODE 45 [list -] 45 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 45 ****************** warning: out: BPB.INC... [-w+user] 45 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 45 ****************** warning: out: DEVSYM.INC... [-w+user] 53 54 %ifndef Kanji 55 %iassign Kanji 0 56 %endif 57 58 I_need OpenBuf,128 ; buffer for translating paths 59 I_need RenBuf,128 ; buffer for rename paths 60 i_need THISDPB,DWORD 61 i_need EXTERR,WORD 62 i_need ALLOWED,BYTE 63 I_need ThisSFT,DWORD ; SFT in use 64 I_need WFP_start,WORD ; pointer to canonical name 65 I_need Ren_WFP,WORD ; pointer to canonical name 66 I_need Attrib,BYTE ; Attribute for match attributes 67 I_need sftFCB,DWORD ; pointer to SFTs for FCB cache 68 I_need FCBLRU,WORD ; least recently used count 69 I_need Proc_ID,WORD ; current process ID 70 I_Need Name1,14 ; place for device names 71 I_need DEVPT,DWORD ; device pointer 72 I_need OpenLRU,WORD ; open age 73 I_need KeepCount,WORD ; number of fcbs to keep 74 I_need User_In_AX,WORD ; user input system call. 75 I_need JShare,DWORD ; share jump table 76 I_need FastOpenTable,BYTE ; DOS 3.3 fastopen 77 %if debug 78 I_need BugLev,WORD 79 I_need BugTyp,WORD 80 %include "bugtyp.nas" 81 %endif 82 83 84 Break <$Get_FCB_Position - set random record fields to current pos> 85 86 ; 87 ; $Get_FCB_Position - look at an FCB, retrieve the current position from the 88 ; extent and next record field and set the random record field to point 89 ; to that record 90 ; 91 ; Inputs: DS:DX point to a possible extended FCB 92 ; Outputs: The random record field of the FCB is set to the current record 93 ; Registers modified: all 94 95 Procedure D_Get_FCB_Position,NEAR 95 ****************** warning: proc D_Get_FCB_Position... [-w+user] 96 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00001CD1 E8[0000] invoke GetExtended ; point to FCB 0 00001CD4 E8[0000] invoke GetExtent ; DX:AX is current record 0 00001CD7 894421 MOV WORD PTR [SI + fcb_RR],AX ; drop in low order piece 0 00001CDA 885423 MOV [SI+fcb_RR+2],DL ; drop in high order piece 0 00001CDD 837C0E40 CMP word [SI + fcb_RECSIZ],64 0 00001CE1 7303 JAE GetFCBBye 0 00001CE3 887424 MOV [SI+fcb_RR+2+1],DH ; Set 4th byte only if record size < 64 104 GetFCBBye: 0 00001CE6 E9[0000] transfer FCB_Ret_OK 106 EndProc D_GET_FCB_POSITION 107 108 Break <$FCB_Delete - remove several files that match the input FCB> 109 110 ; 111 ; $FCB_delete - given an FCB, remove all directory entries in the current 112 ; directory that have names that match the FCB's ? marks. 113 ; 114 ; Inputs: DS:DX - point to an FCB 115 ; Outputs: directory entries matching the FCB are deleted 116 ; AL = FF if no entries were deleted. 117 ; Registers modified: all 118 119 Procedure D_FCB_Delete,NEAR 119 ****************** warning: proc D_FCB_Delete... [-w+user] 120 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 121 DOSGroup equ DOSGROUP ; NASM port equate 0 00001CE9 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate place 0 00001CEC E8[0000] invoke TransFCB ; convert FCB to path 0 00001CEF 7209 JC BadPath ; signal no deletions 0 00001CF1 161F Context DS 0 00001CF3 E8[0000] invoke DOS_Delete ; wham 0 00001CF6 7202 JC BadPath 128 GoodPath: 0 00001CF8 EBEC transfer FCB_Ret_OK ; do a good return 130 BadPath: 131 ; 132 133 ; Error code is in AX 134 ; 0 00001CFA E9[0000] transfer FCB_Ret_Err ; let someone else signal the error 136 EndProc D_FCB_DELETE 137 138 Break <$Get_FCB_File_Length - return the length of a file> 139 140 ; 141 ; $Get_FCB_File_Length - set the random record field to the length of the 142 ; file in records (rounded up if partial). 143 ; 144 ; Inputs: DS:DX - point to a possible extended FCB 145 ; Outputs: Random record field updated to reflect the number of records 146 ; Registers modified: all 147 148 Procedure D_Get_FCB_File_Length,NEAR 148 ****************** warning: proc D_Get_FCB_File_Length... [-w+user] 149 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00001CFD E8[0000] invoke GetExtended ; get real FCB pointer 151 ; DX points to Input FCB 0 00001D00 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate buffer 0 00001D03 1E56 SaveReg ; save pointer to true FCB 0 00001D05 E8[0000] Invoke TransFCB ; Trans name DS:DX, sets SATTRIB 0 00001D08 5E1F RestoreReg 0 00001D0A 72EE JC BadPath 0 00001D0C 1E56 SaveReg ; save pointer 0 00001D0E 161F Context DS 0 00001D10 E8[0000] invoke Get_File_Info ; grab the info 0 00001D13 5E1F RestoreReg ; get pointer back 0 00001D15 72E3 JC BadPath ; invalid something 0 00001D17 89DA MOV DX,BX ; get high order size 0 00001D19 89F8 MOV AX,DI ; get low order size 0 00001D1B 8B5C0E MOV BX,[SI + fcb_RECSIZ] ; get his record size 0 00001D1E 09DB OR BX,BX ; empty record => 0 size for file 0 00001D20 7503 JNZ GetSize ; not empty 0 00001D22 BB8000 MOV BX,128 168 GetSize: 0 00001D25 89C7 MOV DI,AX ; save low order word 0 00001D27 89D0 MOV AX,DX ; move high order for divide 0 00001D29 31D2 XOR DX,DX ; clear out high 0 00001D2B F7F3 DIV BX ; wham 0 00001D2D 50 PUSH AX ; save dividend 0 00001D2E 89F8 MOV AX,DI ; get low order piece 0 00001D30 F7F3 DIV BX ; wham 0 00001D32 89D1 MOV CX,DX ; save remainder 0 00001D34 5A POP DX ; get high order dividend 0 00001D35 E306 JCXZ LengthStore ; no roundup 0 00001D37 83C001 ADD AX,1 0 00001D3A 83D200 ADC DX,0 ; 32-bit increment 181 LengthStore: 182 FCB_RR equ fcb_RR ; NASM port label 0 00001D3D 894421 MOV WORD PTR [SI + FCB_RR],AX ; store low order 0 00001D40 885423 MOV [SI + FCB_RR+2],DL ; store high order 0 00001D43 08F6 OR DH,DH 0 00001D45 74B1 JZ GoodPath ; not storing insignificant zero 0 00001D47 887424 MOV [SI + FCB_RR+3],DH ; save that high piece 188 GoodRet: 0 00001D4A EBAC transfer FCB_Ret_OK 190 EndProc D_GET_FCB_FILE_LENGTH 191 192 Break <$FCB_Close - close a file> 193 194 ; 195 ; $FCB_Close - given an FCB, look up the SFN and close it. Do not free it 196 ; as the FCB may be used for further I/O 197 ; 198 ; Inputs: DS:DX point to FCB 199 ; Outputs: AL = FF if file was not found on disk 200 ; Registers modified: all 201 202 Procedure D_FCB_Close,NEAR 202 ****************** warning: proc D_FCB_Close... [-w+user] 203 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00001D4C 30C0 XOR AL,AL ; default search attributes 0 00001D4E E8[0000] invoke GetExtended ; DS:SI point to real FCB 0 00001D51 7403 JZ NoAttr ; not extended 0 00001D53 8A44FF MOV AL,[SI-1] ; get attributes 208 NoAttr: 0 00001D56 36A2[0000] MOV [ss:Attrib],AL ; stash away found attributes 0 00001D5A E8F803 invoke SFTFromFCB 0 00001D5D 72EB JC GoodRet ; MZ 16 Jan Assume death 212 ; 213 ; If the sharer is present, then the SFT is not regenable. Thus, there is 214 ; no need to set the SFT's attribute. 215 ; 216 ;;; 9/8/86 F.C. save SFT attribute and restore it back when close is done 0 00001D5F 268A4504 MOV AL,[ES:DI + sf_attr] 0 00001D63 30E4 XOR AH,AH 0 00001D65 50 PUSH AX 220 ;;; 9/8/86 F.C. save SFT attribute and restore it back when close is done 0 00001D66 E8[0000] invoke CheckShare 0 00001D69 7508 JNZ NoStash 0 00001D6B 36A0[0000] MOV AL,[ss:Attrib] 0 00001D6F 26884504 MOV [ES:DI + sf_attr],AL ; attempted attribute for close 225 NoStash: 226 FCB_FDATE equ fcb_FDATE ; NASM port label 0 00001D73 8B4414 MOV AX,[SI + FCB_FDATE] ; move in the time and date 0 00001D76 2689450F MOV [ES:DI + sf_date],AX 229 FCB_FTIME equ fcb_FTIME ; NASM port label 0 00001D7A 8B4416 MOV AX,[SI + FCB_FTIME] 0 00001D7D 2689450D MOV [ES:DI + sf_time],AX 232 FCB_FilSiz equ fcb_FILSIZ ; NASM port label 0 00001D81 8B4410 MOV AX,[SI + FCB_FilSiz] 0 00001D84 26894511 MOV WORD PTR [ES:DI + sf_size],AX 0 00001D88 8B4412 MOV AX,[SI + FCB_FilSiz + 2] 0 00001D8B 26894513 MOV WORD PTR [ES:DI + sf_size + 2],AX 237 sf_Flags equ sf_flags ; NASM port label 0 00001D8F 26814D050040 OR word [ES:DI + sf_Flags],sf_close_nodate 0 00001D95 161F Context DS ; let Close see variables 0 00001D97 E8[0000] invoke DOS_Close ; wham 0 00001D9A C43E[0000] LES DI,[ThisSFT] 242 ;;; 9/8/86 F.C. restore SFT attribute 0 00001D9E 59 POP CX 0 00001D9F 26884D04 MOV [ES:DI + sf_attr],CL 245 ;;; 9/8/86 F.C. restore SFT attribute 0 00001DA3 9C PUSHF 0 00001DA4 26F705FFFF TEST word [ES:DI + sf_ref_count],-1 ; zero ref count gets blasted 0 00001DA9 7507 JNZ CloseOK 0 00001DAB 50 PUSH AX 0 00001DAC B04D MOV AL,'M' 0 00001DAE E8D202 invoke BlastSFT 0 00001DB1 58 POP AX 253 CloseOK: 0 00001DB2 9D POPF 0 00001DB3 7395 JNC GoodRet 0 00001DB5 3C06 CMP AL,error_invalid_handle 0 00001DB7 7491 JZ GoodRet 0 00001DB9 B002 MOV AL,error_file_not_found 0 00001DBB E9[0000] transfer FCB_Ret_Err 260 EndProc D_FCB_CLOSE 261 262 Break <$FCB_Rename - change names in place> 263 264 ; 265 ; $FCB_Rename - rename a file in place within a directory. Renames multiple 266 ; files copying from the meta characters. 267 ; 268 ; Inputs: DS:DX point to an FCB. The normal name field is the source 269 ; name of the files to be renamed. Starting at offset 11h 270 ; in the FCB is the destination name. 271 ; Outputs: AL = 0 -> no error occurred and all files were renamed 272 ; AL = FF -> some files may have been renamed but: 273 ; rename to existing file or source file not found 274 ; Registers modified: all 275 276 Procedure D_FCB_Rename,NEAR 276 ****************** warning: proc D_FCB_Rename... [-w+user] 277 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00001DBE E8[0000] invoke GetExtended ; get pointer to real FCB 0 00001DC1 52 SaveReg 0 00001DC2 8A04 MOV AL,[SI] ; get drive byte 0 00001DC4 83C610 ADD SI,10h ; point to destination 0 00001DC7 BF[0000] MOV DI,OFFSET RenBuf wrt DOSGroup ; point to destination buffer 0 00001DCA FF341E56 SaveReg <,DS,SI> ; save source pointer for TransFCB 0 00001DCE 8804 MOV [SI],AL ; drop in real drive 0 00001DD0 89F2 MOV DX,SI ; let TransFCB know where the FCB is 0 00001DD2 E8[0000] invoke TransFCB ; munch this pathname 0 00001DD5 5E1F8F04 RestoreReg > ; get path back 0 00001DD9 5A RestoreReg ; Original FCB pointer 0 00001DDA 721A JC BadRen ; bad path -> error 290 WFP_Start equ WFP_start ; NASM port label 0 00001DDC 368B36[0000] MOV SI,[ss:WFP_Start] ; get pointer 0 00001DE1 368936[0000] MOV [ss:Ren_WFP],SI ; stash it 0 00001DE6 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate spot 0 00001DE9 E8[0000] invoke TransFCB ; wham 295 ; NOTE that this call is pointing 296 ; back to the ORIGINAL FCB so 297 ; SATTRIB gets set correctly 0 00001DEC 7208 JC BadRen ; error 0 00001DEE E8[0000] invoke DOS_Rename 0 00001DF1 7203 JC BadRen 0 00001DF3 E9[0000] transfer FCB_Ret_OK 302 BadRen: 303 ; 304 ; AL has error code 305 ; 0 00001DF6 EBC3 transfer FCB_Ret_Err 307 308 EndProc D_FCB_RENAME 309 310 Break 311 312 ; 313 ; FCBs suffer from several problems. First, they are maintained in the 314 ; user's space so he may move them at will. Second, they have a small 315 ; reserved area that may be used for system information. Third, there was 316 ; never any "rules for behavior" for FCBs; there was no protocol for their 317 ; usage. 318 ; 319 ; This results in the following misbehavior: 320 ; 321 ; infinite opens of the same file: 322 ; 323 ; While (TRUE) { While (TRUE) { 324 ; FCBOpen (FCB); FCBOpen (FCB); 325 ; Read (FCB); Write (FCB); 326 ; } } 327 ; 328 ; infinite opens of different files: 329 ; 330 ; While (TRUE) { While (TRUE) { 331 ; FCBOpen (FCB[i++]); FCBOpen (FCB[i++]); 332 ; Read (FCB); Write (FCB); 333 ; } } 334 ; 335 ; multiple closes of the same file: 336 ; 337 ; FCBOpen (FCB); 338 ; while (TRUE) 339 ; FCBClose (FCB); 340 ; 341 ; I/O after closing file: 342 ; 343 ; FCBOpen (FCB); 344 ; while (TRUE) { 345 ; FCBWrite (FCB); 346 ; FCBClose (FCB); 347 ; } 348 ; 349 ; The following is am implementation of a methodology for emulating the 350 ; above with the exception of I/O after close. We are NOT attempting to 351 ; resolve that particular misbehavior. We will enforce correct behaviour in 352 ; FCBs when they refer to a network file or when there is file sharing on 353 ; the local machine. 354 ; 355 ; The reserved fields of the FCB (10 bytes worth) is divided up into various 356 ; structures depending on the file itself and the state of operations of the 357 ; OS. The information contained in this reserved field is enough to 358 ; regenerate the SFT for the local non-shared file. It is assumed that this 359 ; regeneration procedure may be expensive. The SFT for the FCB is 360 ; maintained in a LRU cache as the ONLY performance inprovement. 361 ; 362 ; No regeneration of SFTs is attempted for network FCBs. 363 ; 364 ; To regenerate the SFT for a local FCB, it is necessary to determine if the 365 ; file sharer is working. If the file sharer is present then the SFT is not 366 ; regenerated. 367 ; 368 ; Finally, if there is no local sharing, the full name of the file is no 369 ; longer available. We can make up for this by using the following 370 ; information: 371 ; 372 ; The Drive number (from the DPB). 373 ; The physical sector of the directory that contains the entry. 374 ; The relative position of the entry in the sector. 375 ; The first cluster field. 376 ; The last used SFT. 377 ; OR In the case of a device FCB 378 ; The low 6 bits of sf_flags (indicating device type) 379 ; The pointer to the device header 380 ; 381 ; 382 ; We read in the particular directory sector and examine the indicated 383 ; directory entry. If it matches, then we are kosher; otherwise, we fail. 384 ; 385 ; Some key items need to be remembered: 386 ; 387 ; Even though we are caching SFTs, they may contain useful sharing 388 ; information. We enforce good behavior on the FCBs. 389 ; 390 ; Network support must not treat FCBs as impacting the ref counts on 391 ; open VCs. The VCs may be closed only at process termination. 392 ; 393 ; If this is not an installed version of the DOS, file sharing will 394 ; always be present. 395 ; 396 ; We MUST always initialize lstclus to = firclus when regenerating a 397 ; file. Otherwise we start allocating clusters up the wazoo. 398 ; 399 ; Always initialize, during regeneration, the mode field to both isFCB 400 ; and open_for_both. This is so the FCB code in the sharer can find the 401 ; proper OI record. 402 ; 403 ; The test bits are: 404 ; 405 ; 00 -> local file 406 ; 40 -> sharing local 407 ; 80 -> network 408 ; C0 -> local device 409 410 Break 411 412 ; 413 ; SaveFCBInfo - given an FCB and its associated SFT, copy the relevant 414 ; pieces of information into the FCB to allow for subsequent 415 ; regeneration. Poke LRU also. 416 ; 417 ; Inputs: ThisSFT points to a complete SFT. 418 ; DS:SI point to the FCB (not an extended one) 419 ; Outputs: The relevant reserved fields in the FCB are filled in. 420 ; DS:SI preserved 421 ; ES:DI point to sft 422 ; Registers modified: All 423 ; 424 425 Procedure SaveFCBInfo,NEAR 425 ****************** warning: proc SaveFCBInfo... [-w+user] 426 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00001DF8 36C43E[0000] LES DI,[ss:ThisSFT] 428 Assert ISSFT,,"SaveFCBInfo" 0 00001DFD E8[0000] invoke IsSFTNet 0 00001E00 740B JZ SaveLocal ; if not network then save local info 431 ; 432 ;----- In net support ----- 433 ; 0 00001E02 268B450B MOV AX,WORD PTR [ES:DI + sf_serial_ID] ;AN000;;IFS. save IFS ID 0 00001E06 89441C MOV WORD PTR [SI + FCB_netID],ax ;AN000;;IFS. 436 ; SaveReg 437 ; LES DI,DWORD PTR [ES:DI].sf_netid 438 ; MOV WORD PTR [SI].FCB_netID,DI ; save net ID 439 ; MOV WORD PTR [SI].FCB_netID+2,ES 440 ; RestoreReg 0 00001E09 B380 MOV BL,FCBNETWORK 442 ; 443 ;----- END In net support ----- 444 ; 445 %IF debug 446 JMP SaveSFN 447 %ELSE 0 00001E0B EB4E JMP SHORT SaveSFN 449 %ENDIF 450 SaveLocal: 451 %IF Installed 0 00001E0D E8[0000] Invoke CheckShare 0 00001E10 7403 JZ SaveNoShare ; no sharer 0 00001E12 EB42 JMP SaveShare ; sharer present 0 00001E14 90 nop ; identicalise 456 457 SaveNoShare: 0 00001E15 26F745058000 TEST word [ES:DI + sf_flags],devid_device 0 00001E1B 7527 JNZ SaveNoShareDev ; Device 460 ; 461 ; Save no sharing local file information 462 ; 0 00001E1D 268B451B MOV AX,WORD PTR [ES:DI + sf_dirsec] ; get directory sector F.C. 0 00001E21 89441D MOV [SI + fcb_nsl_dirsec],AX 0 00001E24 268A451F MOV AL,[ES:DI + sf_dirpos] ; location in sector 0 00001E28 88441F MOV [SI + fcb_nsl_dirpos],AL 0 00001E2B 268B450B MOV AX,[ES:DI + sf_firclus] ; first cluster 0 00001E2F 89441B MOV [SI + fcb_nsl_firclus],AX 0 00001E32 B300 MOV BL,00 470 ; 471 ; Create the bits field from the dirty/device bits of the flags word and the 472 ; mode byte 473 ; 474 SetFCBBits: 0 00001E34 268B4505 MOV AX,[ES:DI + sf_flags] 0 00001E38 24C0 AND AL,0C0h ; mask off drive bits 0 00001E3A 260A4502 OR AL,BYTE PTR [ES:DI + sf_mode] ; stick in open mode 0 00001E3E 88441A MOV [SI + fcb_nsl_bits],AL ; save dirty info 0 00001E41 EB18 JMP SaveSFN ; go and save SFN 0 00001E43 90 nop ; identicalise 481 482 ; 483 ; Save no sharing local device information 484 ; 485 SaveNoShareDev: 0 00001E44 268B4507 MOV AX,WORD PTR [ES:DI + sf_devptr] 0 00001E48 89441A MOV WORD PTR [SI + FCB_nsld_drvptr],AX 0 00001E4B 268B4509 MOV AX,WORD PTR [ES:DI + sf_devptr + 2] 0 00001E4F 89441C MOV WORD PTR [SI + FCB_nsld_drvptr + 2],AX 0 00001E52 B340 MOV BL,FCBDEVICE 0 00001E54 EBDE JMP SetFCBBits ; go and save SFN 492 493 SaveShare: 494 %ENDIF 495 ; 496 ;----- In share support ----- 497 ; 498 %if installed 0 00001E56 36FF1E[2800] Call far [ss:JShare + 10 * 4] 500 %else 501 Call ShSave 502 %endif 503 ; 504 ;----- end in share support ----- 505 ; 506 SaveSFN: 0 00001E5B 268B4505 MOV AX,[ES:DI + sf_flags] 0 00001E5F 243F AND AL,3Fh ; get real drive 0 00001E61 08D8 OR AL,BL 0 00001E63 884419 MOV [SI + fcb_l_drive],AL 0 00001E66 8D45FA LEA AX,[DI-SFTable] 512 ; 513 ; Adjust for offset to table. 514 ; 515 SftFCB equ sftFCB ; NASM port label 0 00001E69 362B06[0000] SUB AX,WORD PTR [ss:SftFCB] 0 00001E6E B33B MOV BL,sf_entry_struc_size 0 00001E70 F6F3 DIV BL 0 00001E72 884418 MOV [SI + FCB_sfn],AL ; last used SFN 0 00001E75 36A1[0000] MOV AX,[ss:FCBLRU] ; get lru count 0 00001E79 40 INC AX 0 00001E7A 26894515 MOV WORD PTR [ES:DI + sf_LRU],AX 0 00001E7E 7506 JNZ SimpleStuff 524 ; 525 ; lru flag overflowed. Run through all FCB sfts and adjust: LRU < 8000h 526 ; get set to 0. Others -= 8000h. This LRU = 8000h 527 ; 0 00001E80 BB1500 MOV BX, offset sf_position 0 00001E83 E80500 invoke ResetLRU 530 ; 531 ; Set new LRU to AX 532 ; 533 SimpleStuff: 0 00001E86 36A3[0000] MOV [ss:FCBLRU],AX 0 00001E8A C3 return 536 EndProc SaveFCBInfo 537 538 Break 539 540 ; 541 ; ResetLRU - during lru updates, we may wrap at 64K. We must walk the 542 ; entire set of SFTs and subtract 8000h from their lru counts and truncate 543 ; at 0. 544 ; 545 ; Inputs: BX is offset into SFT field where lru firld is kept 546 ; ES:DI point to SFT currently being updated 547 ; Outputs: All FCB SFTs have their lru fields truncated 548 ; AX has 8000h 549 ; Registers modified: none 550 551 Procedure ResetLRU,NEAR 551 ****************** warning: proc ResetLRU... [-w+user] 552 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 553 Assert ISSFT,,"ResetLRU" 0 00001E8B B80080 MOV AX,8000h 0 00001E8E 0657 SaveReg 0 00001E90 36C43E[0000] LES DI,[ss:sftFCB] ; get pointer to head 557 sfCount equ SFCount ; NASM port label 0 00001E95 268B4D04 MOV CX,[ES:DI + sfCount] 559 sfTable equ SFTable ; NASM port label 0 00001E99 8D7D06 LEA DI,[DI + sfTable] ; point at table 561 ovScan: 0 00001E9C 262901 SUB WORD PTR [ES:DI+BX],AX ; decrement lru count 0 00001E9F 7703 JA ovLoop 0 00001EA1 268901 MOV WORD PTR [ES:DI + BX],AX ; truncate at 0 565 ovLoop: 566 SF_Entry_struc_size equ sf_entry_struc_size ; NASM port equate 0 00001EA4 83C73B ADD DI,SF_Entry_struc_size ; advance to next 0 00001EA7 E2F3 LOOP ovScan 0 00001EA9 5F07 RestoreReg 0 00001EAB 268901 MOV [ES:DI+BX],AX 0 00001EAE C3 return 572 EndProc ResetLRU 573 574 Break 575 576 ; 577 ; SetOpenAge - In order to maintain the first N open files in the FCB cache, 578 ; we keep the 'open age' or an LRU count based on opens. We update the 579 ; count here and fill in the appropriate field. 580 ; 581 ; Inputs: ES:DI point to SFT 582 ; Outputs: ES:DI has the open age field filled in. 583 ; If open age has wraparound, we will have subtracted 8000h 584 ; from all open ages. 585 ; Registers modified: AX 586 ; 587 588 Procedure SetOpenAge,NEAR 588 ****************** warning: proc SetOpenAge... [-w+user] 589 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 590 Assert ISSFT,,"SetOpenAge" 0 00001EAF 36A1[0000] MOV AX,[ss:OpenLRU] 0 00001EB3 40 INC AX 0 00001EB4 26894517 MOV [ES:DI + sf_OpenAge],AX 0 00001EB8 7506 JNZ SetDone 595 sf_Position equ sf_position ; NASM port label 0 00001EBA BB1700 MOV BX, offset sf_Position+2 0 00001EBD E8CBFF invoke ResetLRU 598 SetDone: 0 00001EC0 36A3[0000] MOV [ss:OpenLRU],AX 0 00001EC4 C3 return 601 EndProc SetOpenAge 602 603 Break 604 605 ; 606 ; LRUFCB - find LRU fcb in cache. Set ThisSFT and return it. We preserve 607 ; the first keepcount sfts if they are network sfts or if sharing is 608 ; loaded. If carry is set then NO BLASTING is NECESSARY. 609 ; 610 ; Inputs: none 611 ; Outputs: ES:DI point to SFT 612 ; ThisSFT points to SFT 613 ; SFT is zeroed 614 ; Carry set of closes failed 615 ; Registers modified: none 616 ; 617 618 Procedure LRUFCB,NEAR 618 ****************** warning: proc LRUFCB... [-w+user] 619 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00001EC5 E8[0000] Invoke Save_World 621 ; 622 ; Find nth oldest NET/SHARE FCB. We want to find its age for the second scan 623 ; to find the lease recently used one that is younger than the open age. We 624 ; operate be scanning the list n times finding the least age that is greater 625 ; or equal to the previous minimum age. 626 ; 627 ; BP is the count of times we need to go through this loop. 628 ; AX is the current acceptable minimum age to consider 629 ; 0 00001EC8 368B2E[0000] mov bp,[ss:KeepCount] ; k = keepcount; 0 00001ECD 31C0 XOR AX,AX ; low = 0; 632 ; 633 ; If we've scanned the table n times, then we are done. 634 ; 635 lru1: 0 00001ECF 83FD00 CMP bp,0 ; while (k--) { 0 00001ED2 7452 JZ lru75 0 00001ED4 4D DEC bp 639 ; 640 ; Set up for scan. 641 ; 642 ; AX is the minimum age for consideration 643 ; BX is the minimum age found during the scan 644 ; SI is the position of the entry that corresponds to BX 645 ; 0 00001ED5 BBFFFF MOV BX,-1 ; min = 0xffff; 0 00001ED8 89DE MOV si,BX ; pos = 0xffff; 648 SFTFCB equ sftFCB ; NASM port label 0 00001EDA 36C43E[0000] LES DI,[ss:SFTFCB] ; for (CX=FCBCount; CX>0; CX--) 0 00001EDF 268B4D04 MOV CX,[ES:DI + sfCount] 0 00001EE3 8D7D06 LEA DI,[DI + sfTable] 652 ; 653 ; Innermost loop. If the current entry is free, then we are done. Or, if the 654 ; current entry is busy (indicating a previous aborted allocation), then we 655 ; are done. In both cases, we use the found entry. 656 ; 657 lru2: 0 00001EE6 26833D00 cmp word [es:di + sf_ref_count],0 0 00001EEA 7406 jz lru25 0 00001EEC 26833DFF cmp word [es:di + sf_ref_count],sf_busy 0 00001EF0 7505 jnz lru3 662 ; 663 ; The entry is usable without further scan. Go and use it. 664 ; 665 lru25: 0 00001EF2 89FE MOV si,DI ; pos = i; 0 00001EF4 EB6A JMP lru11 ; goto got; 0 00001EF6 90 nop ; identicalise 669 ; 670 ; See if the entry is for the network or for the sharer. 671 ; 672 ; If for the sharer or network then 673 ; if the age < current minimum AND >= allowed minimum then 674 ; this entry becomes current minimum 675 ; 676 lru3: 0 00001EF7 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet ; if (!net[i] 0 00001EFD 7505 JNZ lru35 679 %if installed 0 00001EFF E8[0000] Invoke CheckShare ; && !sharing) 0 00001F02 7410 JZ lru5 ; else 682 %ENDIF 683 ; 684 ; This SFT is for the net or is for the sharer. See if it less than the 685 ; current minimum. 686 ; 687 lru35: 0 00001F04 268B5517 MOV DX,[ES:DI + sf_OpenAge] 0 00001F08 39C2 CMP DX,AX ; if (age[i] >= low && 0 00001F0A 7208 JB lru5 0 00001F0C 39DA CMP DX,BX 0 00001F0E 7304 JAE lru5 ; age[i] < min) { 693 ; 694 ; entry is new minimum. Remember his age. 695 ; 0 00001F10 89D3 mov bx,DX ; min = age[i]; 0 00001F12 89FE mov si,di ; pos = i; 698 ; 699 ; End of loop. gp back for more 700 ; 701 lru5: 0 00001F14 83C73B add di,sf_entry_struc_size 0 00001F17 E2CD loop lru2 ; } 704 ; 705 ; The scan is complete. If we have successfully found a new minimum (pos != -1) 706 ; set then threshold value to this new minimum + 1. Otherwise, the scan is 707 ; complete. Go find LRU. 708 ; 0 00001F19 83FEFF lru6: cmp si,-1 ; position not -1? 0 00001F1C 7408 jz lru75 ; no, done with everything 0 00001F1E 8D4701 lea ax,[bx+1] ; set new threshold age 0 00001F21 EBAC jmp lru1 ; go and loop for more 0 00001F23 F9 lru65: stc 714 lruDead equ LRUDead ; NASM port label 0 00001F24 EB70 jmp short lruDead ; return -1; 716 ; 717 ; Main loop is done. We have AX being the age+1 of the nth oldest sharer or 718 ; network entry. We now make a second pass through to find the LRU entry 719 ; that is local-no-share or has age >= AX 720 ; 721 lru75: 0 00001F26 BBFFFF mov bx,-1 ; min = 0xffff; 0 00001F29 89DE mov si,bx ; pos = 0xffff; 0 00001F2B 36C43E[0000] LES DI,[ss:SFTFCB] ; for (CX=FCBCount; CX>0; CX--) 0 00001F30 268B4D04 MOV CX,[ES:DI + sfCount] 0 00001F34 8D7D06 LEA DI,[DI + sfTable] 727 ; 728 ; If this is is local-no-share then go check for LRU else if age >= threshold 729 ; then check for lru. 730 ; 731 lru8: 0 00001F37 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet 0 00001F3D 7505 jnz lru85 ; is for network, go check age 0 00001F3F E8[0000] invoke CheckShare ; sharer here? 0 00001F42 7406 jz lru86 ; no, go check lru 736 ; 737 ; Network or sharer. Check age 738 ; 739 lru85: 0 00001F44 26394517 cmp [es:di + sf_OpenAge],ax 0 00001F48 720C jb lru9 ; age is before threshold, skip it 742 ; 743 ; Check LRU 744 ; 745 lru86: 0 00001F4A 26395D15 cmp [es:di + sf_LRU],bx ; is LRU less than current LRU? 0 00001F4E 7306 jae lru9 ; no, skip this 0 00001F50 89FE mov si,di ; remember position 0 00001F52 268B5D15 mov bx,[es:di + sf_LRU] ; remember new minimum LRU 750 ; 751 ; Done with this entry, go back for more. 752 ; 753 lru9: 0 00001F56 83C73B add di,sf_entry_struc_size 0 00001F59 E2DC loop lru8 756 ; 757 ; Scan is complete. If we found NOTHING that satisfied us then we bomb 758 ; out. The conditions here are: 759 ; 760 ; No local-no-shares AND all net/share entries are older than threshold 761 ; 762 lru10: 0 00001F5B 83FEFF cmp si,-1 ; if no one f 0 00001F5E 74C3 jz lru65 ; return -1; 765 lru11: 0 00001F60 89F7 mov di,si 0 00001F62 36893E[0000] MOV WORD PTR [ss:ThisSFT],DI ; set thissft 0 00001F67 368C06[0200] MOV WORD PTR [ss:ThisSFT+2],ES 769 ; 770 ; If we have sharing or thisSFT is a net sft, then close it until ref count 771 ; is 0. 772 ; 773 sf_isNet equ sf_isnet ; NASM port equate 0 00001F6C 26F745050080 TEST word [ES:DI + sf_flags],sf_isNet 0 00001F72 7505 JNZ LRUClose 776 %IF INSTALLED 0 00001F74 E8[0000] Invoke CheckShare 0 00001F77 7418 JZ LRUDone 779 %ENDIF 780 ; 781 ; Repeat close until ref count is 0 782 ; 783 LRUClose: 0 00001F79 161F Context DS 0 00001F7B C43E[0000] LES DI,[ThisSFT] 0 00001F7F 26833D00 CMP word [ES:DI + sf_ref_count],0 ; is ref count still <> 0? 0 00001F83 740C JZ LRUDone ; nope, all done 788 789 ; Message 1,"LRUFCB: closing " 790 ; MessageNum 791 ; Message 1,":" 792 ; MessageNum 793 0 00001F85 E8[0000] Invoke DOS_Close 0 00001F88 73EF jnc LRUClose ; no error => clean up 0 00001F8A 3C06 cmp al,error_invalid_handle 0 00001F8C 74EB jz LRUClose 0 00001F8E F9 stc 0 00001F8F EB05 JMP short LRUDead 800 LRUDone: 0 00001F91 30C0 XOR AL,AL 0 00001F93 E8ED00 invoke BlastSFT ; fill SFT with 0 (AL) 803 LRUDead: 0 00001F96 E8[0000] Invoke Restore_World 805 ASSUME DS:NOTHING 0 00001F99 36C43E[0000] LES DI,[ss:ThisSFT] 807 Assert ISSFT,,"LRUFCB return" 0 00001F9E 7201C3 retnc 0 00001FA1 B023 MOV AL,error_FCB_unavailable 0 00001FA3 C3 return 811 EndProc LRUFCB 812 813 Break 814 815 ; 816 ; FCBRegen - examine reserved field of FCB and attempt to generate the SFT 817 ; from it. 818 ; 819 ; Inputs: DS:SI point to FCB 820 ; Outputs: carry clear Filled in SFT 821 ; Carry set unrecoverable error 822 ; Registers modified: all 823 824 Procedure FCBRegen,NEAR 824 ****************** warning: proc FCBRegen... [-w+user] 825 ASSUME DS:NOTHING,ES:NOTHING, ss:DOSGROUP 826 ; 827 ; General data filling. Mode is sf_isFCB + open_for_both, date/time we do 828 ; not fill, size we do no fill, position we do not fill, 829 ; bit 14 of flags = TRUE, other bits = FALSE 830 ; 0 00001FA4 8A4419 MOV AL,[SI + fcb_l_drive] 832 ; 833 ; We discriminate based on the first two bits in the reserved field. 834 ; 0 00001FA7 A880 TEST AL,FCBSPECIAL ; check for no sharing test 0 00001FA9 741C JZ RegenNoSharing ; yes, go regen from no sharing 837 ; 838 ; The FCB is for a network or a sharing based system. At this point we have 839 ; already closed the SFT for this guy and reconnection is impossible. 840 ; 841 ; Remember that he may have given us a FCB with bogus information in it. 842 ; Check to see if sharing is present or if the redir is present. If either is 843 ; around, presume that we have cycled out the FCB and give the hard error. 844 ; Otherwise, just return with carry set. 845 ; 0 00001FAB E8[0000] invoke CheckShare ; test for sharer 0 00001FAE 7509 JNZ RegenFail ; yep, fail this. 848 multNet equ MultNET ; NASM port equate 0 00001FB0 B80011 MOV AX,multNet << 8 ; install check on multnet 0 00001FB3 CD2F INT 2FH 0 00001FB5 08C0 OR AL,AL ; is it there? 0 00001FB7 740C JZ RegenDead ; no, just fail the operation 853 RegenFail: 0 00001FB9 36A1[0000] MOV AX,[ss:User_In_AX] 855 fcb_close equ FCB_Close ; NASM port equate 0 00001FBD 80FC10 cmp AH,fcb_close 0 00001FC0 7403 jz RegenDead 0 00001FC2 E8C501 invoke FCBHardErr ; massive hard error. 859 RegenDead: 0 00001FC5 F9 STC 0 00001FC6 C3 return ; carry set 862 ; 863 ; Local FCB without sharing. Check to see if sharing is loaded. If so 864 ; fail the operation. 865 ; 866 RegenNoSharing: 0 00001FC7 E8[0000] invoke CheckShare ; Sharing around? 0 00001FCA 75ED JNZ RegenFail 869 ; 870 ; Find an SFT for this guy. 871 ; 0 00001FCC E8[0000] invoke LRUFcb 0 00001FCF 72F5 retc 874 SF_IsFCB equ sf_isfcb ; NASM port equate 0 00001FD1 26C745020280 MOV word [ES:DI + sf_mode],SF_IsFCB + open_for_both + sharing_compat 0 00001FD7 243F AND AL,3Fh ; get drive number for flags 0 00001FD9 98 CBW 878 sf_close_noDate equ sf_close_nodate ; NASM port equate 0 00001FDA 0D0040 OR AX,sf_close_noDate ; normal FCB operation 880 ; 881 ; The bits field consists of the upper two bits (dirty and device) from the 882 ; SFT and the low 4 bits from the open mode. 883 ; 0 00001FDD 8A4C1A MOV CL,[SI + FCB_nsl_bits] ; stick in dirty bits. 0 00001FE0 88CD MOV CH,CL 0 00001FE2 80E5C0 AND CH,0C0h ; mask off the dirty/device bits 0 00001FE5 08E8 OR AL,CH 0 00001FE7 80E10F AND CL,access_mask ; get the mode bits 0 00001FEA 26884D02 MOV BYTE PTR [ES:DI + sf_mode],CL 0 00001FEE 26894505 MOV [ES:DI + sf_flags],AX ; initial flags 0 00001FF2 36A1[0000] MOV AX,[ss:Proc_ID] 0 00001FF6 26894531 MOV [ES:DI + sf_PID],AX 0 00001FFA 1E560657 SaveReg 0 00001FFE 1607 Context ES 0 00002000 BF[0000] MOV DI,OFFSET Name1 wrt DOSGroup 0 00002003 B90800 MOV CX,8 0 00002006 46 INC SI ; Skip past drive byte to name in FCB 898 RegenCopyName2: 0 00002007 AC LODSB 900 901 %IF DBCS ;AN000; 902 invoke testkanj ;AN000; 903 jz notkanj9 ;AN000; 904 STOSB ;AN000; 905 DEC CX ;AN000; 906 JCXZ DoneNam2 ;AN000; ; Ignore split kanji char error 907 LODSB ;AN000; 908 jmp short StuffChar2 ;AN000; 909 ;AN000; 910 notkanj9: ;AN000; 911 %ENDIF ;AN000; 912 0 00002008 E8[0000] Invoke UCase 914 StuffChar2: 0 0000200B AA STOSB 0 0000200C E2F9 LOOP RegenCopyName2 917 DoneNam2: 0 0000200E 161F Context DS 919 ATTRIB equ Attrib ; NASM port label 0 00002010 C606[0000]16 MOV byte [ATTRIB],attr_hidden + attr_system + attr_directory 921 ; Must set this to something interesting 922 ; to call DEVNAME. 0 00002015 E8[0000] Invoke DevName ; check for device 924 ASSUME DS:NOTHING,ES:NOTHING 0 00002018 5F075E1F RestoreReg 0 0000201C 7219 JC RegenFileNoSharing ; not found on device list => file 927 ; 928 ; Device found. We can ignore disk-specific info 929 ; 0 0000201E 26887D05 MOV BYTE PTR [ES:DI + sf_flags],BH ; device parms 0 00002022 26C6450400 MOV byte [ES:DI + sf_attr],0 ; attribute 0 00002027 36C536[0000] LDS SI,[ss:DEVPT] ; get device driver 0 0000202C 26897507 MOV WORD PTR [ES:DI + sf_devptr],SI 0 00002030 268C5D09 MOV WORD PTR [ES:DI + sf_devptr + 2],DS 0 00002034 C3 return ; carry is clear 936 937 RegenDeadJ: 0 00002035 EB8E JMP RegenDead 939 ; 940 ; File found. Just copy in the remaining pieces. 941 ; 942 RegenFileNoSharing: 0 00002037 268B4505 MOV AX,[ES:DI + sf_flags] 0 0000203B 83E03F AND AX,03Fh 0 0000203E 1E56 SaveReg 0 00002040 E8[0000] Invoke Find_DPB 0 00002043 26897507 MOV WORD PTR [ES:DI + sf_devptr],SI 0 00002047 268C5D09 MOV WORD PTR [ES:DI + sf_devptr + 2],DS 0 0000204B 5E1F RestoreReg 0 0000204D 72E6 jc RegenDeadJ ; if find DPB fails, then drive 951 ; indicator was bogus 0 0000204F 8B441D MOV AX,[SI + FCB_nsl_dirsec] 0 00002052 2689451B MOV WORD PTR [ES:DI + sf_dirsec],AX 0 00002056 26C7451D0000 MOV WORD PTR [ES:DI + sf_dirsec + 2],0 ;AN000;>32mb 0 0000205C 8B441B MOV AX,[SI + FCB_nsl_firclus] 0 0000205F 2689450B MOV [ES:DI + sf_firclus],AX 0 00002063 26894535 MOV [ES:DI + sf_lstclus],AX 0 00002067 8A441F MOV AL,[SI + FCB_nsl_dirpos] 0 0000206A 2688451F MOV [ES:DI + sf_dirpos],AL 0 0000206E 26FF05 INC word [ES:DI + sf_ref_count] ; Increment reference count. 961 ; Existing FCB entries would be 962 ; flushed unnecessarily because of 963 ; check in CheckFCB of the ref_count. 964 ; July 22/85 - BAS 965 FCB_name equ fcb_name ; NASM port label 0 00002071 8D7401 LEA SI,[SI + FCB_name] 0 00002074 8D7D20 LEA DI,[DI + sf_name] 968 fcb_extent equ fcb_EXTENT ; NASM port label 0 00002077 B90B00 MOV CX,fcb_extent-fcb_name 970 RegenCopyName: 0 0000207A AC LODSB 972 973 %IF DBCS ;AN000; 974 invoke testkanj 975 jz notkanj1 976 STOSB 977 DEC CX 978 JCXZ DoneNam ; Ignore split kanji char error 979 LODSB 980 jmp short StuffChar 981 982 notkanj1: 983 %ENDIF ;AN000; 984 0 0000207B E8[0000] Invoke UCase 986 StuffChar: 0 0000207E AA STOSB 0 0000207F E2F9 LOOP RegenCopyName 989 DoneNam: 0 00002081 F8 clc 0 00002082 C3 return 992 EndProc FCBRegen 993 994 ; 995 ; BlastSFT - fill SFT with garbage 996 ; 997 ; Inputs: ES:DI point to SFT 998 ; AL has fill 999 ; Outputs: SFT is filled with nonsense 1000 ; *FLAGS PRESERVED* 1001 ; Registers modified: CX 1002 1003 Procedure BlastSFT,NEAR 1003 ****************** warning: proc BlastSFT... [-w+user] 0 00002083 57 SaveReg 0 00002084 B93B00 MOV CX,sf_entry_struc_size 0 00002087 F3AA REP STOSB 0 00002089 5F RestoreReg 0 0000208A 26C7050000 MOV word [ES:DI + sf_ref_count],0 ; set ref count 0 0000208F 26C745150000 MOV word [ES:DI + sf_LRU],0 ; set lru 0 00002095 26C74517FFFF MOV word [ES:DI + sf_OpenAge],-1 ; Set open age 0 0000209B C3 return 1012 EndProc BlastSFT 1013 1014 Break 1015 1016 ; CheckFCB - examine an FCB and its contents to see if it needs to be 1017 ; regenerated. 1018 ; 1019 ; Inputs: DS:SI point to FCB (not extended) 1020 ; AL is SFT index 1021 ; Outputs: Carry Set - FCB needs to be regened 1022 ; Carry clear - FCB is OK. ES:DI point to SFT 1023 ; Registers modified: AX and BX 1024 1025 Procedure CheckFCB,NEAR 1025 ****************** warning: proc CheckFCB... [-w+user] 1026 ASSUME DS:NOTHING,ES:NOTHING 0 0000209C 36C43E[0000] LES DI,[ss:sftFCB] 0 000020A1 26384504 CMP BYTE PTR [ES:DI + SFCount],AL 0 000020A5 7244 JC BadSFT 0 000020A7 B33B MOV BL,sf_entry_struc_size 0 000020A9 F6E3 MUL BL 1032 sftable equ SFTable ; NASM port label 0 000020AB 8D7D06 LEA DI,[DI + sftable] 0 000020AE 01C7 ADD DI,AX 0 000020B0 36A1[0000] MOV AX,[ss:Proc_ID] 0 000020B4 26394531 CMP [ES:DI + sf_PID],AX 0 000020B8 7531 JNZ BadSFT ; must match process 0 000020BA 26833D00 CMP word [ES:DI + sf_ref_count],0 0 000020BE 742B JZ BadSFT ; must also be in use 0 000020C0 8A4419 MOV AL,[SI + FCB_l_Drive] 0 000020C3 A880 TEST AL,FCBSPECIAL ; a special FCB? 0 000020C5 7430 JZ CheckNoShare ; No. try local or device 1043 ; 1044 ; Since we are a special FCB, try NOT to use a bogus test instruction. 1045 ; FCBSHARE is a superset of FCBNETWORK. 1046 ; 0 000020C7 50 PUSH AX 0 000020C8 24C0 AND AL,FCBMASK 0 000020CA 3CC0 CMP AL,FCBSHARE ; net FCB? 0 000020CC 58 POP AX 0 000020CD 751E JNZ CheckNet ; yes 1052 ; 1053 ;----- In share support ----- 1054 ; 1055 %if installed 0 000020CF 36FF1E[2C00] Call far [ss:JShare + 11 * 4] 1057 %else 1058 Call ShChk 1059 %endif 0 000020D4 7215 JC BadSFT 0 000020D6 EB06 JMP SHORT CheckD 1062 ; 1063 ;----- End in share support ----- 1064 ; 1065 CheckFirClus: 0 000020D8 263B5D0B CMP BX,[ES:DI + sf_firclus] 0 000020DC 750D JNZ BadSFT 0 000020DE 243F CheckD: AND AL,3Fh 0 000020E0 268A6505 MOV AH,BYTE PTR [ES:DI + sf_flags] 0 000020E4 80E43F AND AH,3Fh 0 000020E7 38C4 CMP AH,AL 0 000020E9 74B0 retz ; carry is clear 0 000020EB F9 BadSFT: STC 0 000020EC C3 return ; carry is clear 1075 CheckNet: 1076 ; 1077 ;----- In net support ----- 1078 ; 1079 ; MOV AX,[SI].FCB_net_handle 1080 ; CMP AX,WORD PTR [ES:DI].sf_NETID+4 1081 ; JNZ BadSFT 1082 ; MOV AX,WORD PTR [SI].FCB_netID 1083 ; CMP AX,WORD PTR [ES:DI].sf_netid 1084 ; JNZ BadSFT 0 000020ED 8B441C MOV AX,WORD PTR [SI + FCB_netID] ;AN000;IFS.DOS 4.00 0 000020F0 263B450B CMP AX,WORD PTR [ES:DI + sf_serial_ID] ;AN000;IFS.DOS 4.00 0 000020F4 75F5 JNZ BadSFT 1088 ; 1089 ;----- END In net support ----- 1090 ; 0 000020F6 C3 return 1092 1093 CheckNoShare: 0 000020F7 A840 TEST AL,FCBDEVICE ; Device? 0 000020F9 7546 JNZ CheckNoShareDev ; Yes 1096 ; 1097 ; Check no sharing local file 1098 ; 0 000020FB 8B5C1D MOV BX,[SI + FCB_nsl_Dirsec] 0 000020FE 26837D1D00 CMP WORD PTR [ES:DI + sf_dirsec + 2],0 ;AN000;F.C. >32mb 1101 BadSFt equ BadSFT ; NASM port label 0 00002103 75E6 JNZ BadSFt ;AN000;F.C. >32mb 1103 0 00002105 263B5D1B CMP BX,WORD PTR [ES:DI + sf_dirsec] ;AN000;F.C. >32mb 0 00002109 75E0 JNZ BadSFT 0 0000210B 8A5C1F MOV BL,[SI + FCB_nsl_Dirpos] 0 0000210E 263A5D1F CMP BL,[ES:DI + sf_dirpos] 0 00002112 75D7 JNZ BadSFt 1109 ; 1110 ; Since the bits field comes from two different spots, compare them separately. 1111 ; 0 00002114 8A5C1A MOV BL,[SI + FCB_nsl_bits] 0 00002117 268A7D05 MOV BH,BYTE PTR [ES:DI + sf_flags] 0 0000211B 30DF XOR BH,BL 0 0000211D 80E7C0 AND BH,0C0h 0 00002120 75C9 JNZ BadSFT ; dirty/device bits are different 0 00002122 26325D02 XOR BL,BYTE PTR [ES:DI + sf_mode] 0 00002126 80E30F AND BL,access_mask 0 00002129 75C0 JNZ BadSFT ; access modes are different 1120 ; Make sure that the names are the same in the FCB and the SFT 1121 ; This case can appear under the following scenario: 1122 ; Create FOO 1123 ; Rename FOO -> BAR 1124 ; Open BAR 1125 ; The SFT will still contain the name for the old file name. 1126 ; July 30/85 - BAS 0 0000212B 57 PUSH DI 0 0000212C 56 PUSH SI 0 0000212D 8D7D20 LEA DI,[DI + sf_name] 0 00002130 8D7401 LEA SI,[SI + fcb_name] 0 00002133 B90B00 MOV CX,11 0 00002136 F3A6 REPE CMPSB 0 00002138 5E POP SI 0 00002139 5F POP DI 0 0000213A 75AF JNZ BadSFT 0 0000213C 8B5C1B MOV BX,[SI + FCB_nsl_firclus] 0 0000213F EB97 JMP CheckFirClus 1138 1139 CheckNoShareDev: 0 00002141 8B5C1A MOV BX,WORD PTR [SI + FCB_nsld_drvptr] 0 00002144 263B5D07 CMP BX,WORD PTR [ES:DI + sf_devptr] 0 00002148 75A1 JNZ BadSFT 0 0000214A 8B5C1C MOV BX,WORD PTR [SI + FCB_nsld_drvptr + 2] 0 0000214D 263B5D09 CMP BX,WORD PTR [ES:DI + sf_devptr + 2] 0 00002151 7598 JNZ BadSFT 0 00002153 EB89 JMP CheckD 1147 1148 EndProc CheckFCB 1149 1150 Break 1151 1152 ; 1153 ; SFTFromFCB - the workhorse of this compatability crap. Check to see if 1154 ; the SFT for the FCB is Good. If so, make ThisSFT point to it. If not 1155 ; good, get one from the cache and regenerate it. Overlay the LRU field 1156 ; with PID 1157 ; 1158 ; Inputs: DS:SI point to FCB 1159 ; Outputs: ThisSFT point to appropriate SFT 1160 ; Carry clear -> OK ES:DI -> SFT 1161 ; Carry set -> error in ax 1162 ; Registers modified: ES,DI, AX 1163 1164 Procedure SFTFromFCB,NEAR 1164 ****************** warning: proc SFTFromFCB... [-w+user] 1165 ASSUME DS:NOTHING,ES:NOTHING 0 00002155 5053 SaveReg 0 00002157 8A4418 MOV AL,[SI + fcb_sfn] ; set SFN for check 0 0000215A E83FFF invoke CheckFCB 0 0000215D 5B58 RestoreReg 0 0000215F 36893E[0000] MOV WORD PTR [ss:ThisSFT],DI ; set thissft 0 00002164 368C06[0200] MOV WORD PTR [ss:ThisSFT+2],ES 0 00002169 7310 JNC SetSFT ; no problems, just set thissft 1173 1174 fmt typFCB,LevCheck,<"FCB $x:$x does not match SFT $x:$x\n">, 1175 0 0000216B E8[0000] Invoke Save_World 0 0000216E E833FE invoke FCBRegen 0 00002171 E8[0000] Invoke Restore_World ; restore world 0 00002174 36A1[0000] MOV AX,[ss:EXTERR] 0 00002178 7301C3 retc 1181 1182 ; Message 1,<"FCBRegen Succeeded",13,10> 1183 0 0000217B 36C43E[0000] SetSFT: LES DI,[ss:ThisSFT] 0 00002180 36FF36[0000] PUSH word [ss:Proc_ID] ; set process id 0 00002185 268F4531 POP word [ES:DI + sf_PID] 0 00002189 C3 return ; carry is clear 1188 EndProc SFTFromFCB 1189 1190 Break 1191 1192 ; 1193 ; FCBHardErr - signal to a user app that he is trying to use an 1194 ; unavailable FCB. 1195 ; 1196 ; Inputs: none. 1197 ; Outputs: none. 1198 ; Registers modified: all 1199 ; 1200 1201 Procedure FCBHardErr,NEAR 1201 ****************** warning: proc FCBHardErr... [-w+user] 1202 ASSUME DS:NOTHING,ES:NOTHING 1203 error_FCB_Unavailable equ error_FCB_unavailable ; NASM port equate 0 0000218A B82300 MOV AX,error_FCB_Unavailable 1205 allowed_FAIL equ Allowed_FAIL ; NASM port equate 0 0000218D 36C606[0000]08 MOV byte [ss:ALLOWED],allowed_FAIL 0 00002193 36C42E[0000] LES BP,[ss:THISDPB] 0 00002198 BF0100 MOV DI,1 ; Fake some registers 0 0000219B 89F9 MOV CX,DI 0 0000219D 268B560B MOV DX,[ES:BP + dpb_first_sector] 0 000021A1 E8[0000] invoke HARDERR_DOS 0 000021A4 F9 STC 0 000021A5 C3 return 1214 EndProc FCBHardErr 1215 1216 END === Trace listing source: ../DOS/fcbio2.lst 1 ; SCCSID = @(#)fcbio2.asm 1.2 85/07/23 2 ; SCCSID = @(#)fcbio2.asm 1.2 85/07/23 3 ;TITLE FCBIO2 - FCB system calls 4 ;NAME FCBIO2 5 6 ; 7 ; Ancient 1.0 1.1 FCB system calls 8 ; regen save 9 ; GetRR 10 ; GetExtent 11 ; SetExtent 12 ; GetExtended 13 ; GetRecSize 14 ; FCBIO 15 ; $FCB_OPEN written ACC ACC 16 ; $FCB_CREATE written ACC ACC 17 ; $FCB_RANDOM_WRITE_BLOCK written fcbio fcbio 18 ; $FCB_RANDOM_READ_BLOCK written fcbio fcbio 19 ; $FCB_SEQ_READ written fcbio fcbio 20 ; $FCB_SEQ_WRITE written fcbio fcbio 21 ; $FCB_RANDOM_READ written fcbio fcbio 22 ; $FCB_RANDOM_WRITE written fcbio fcbio 23 ; 24 ; Revision history: 25 ; 26 ; Created: ARR 4 April 1983 27 ; MZ 6 June 1983 completion of functions 28 ; MZ 15 Dec 1983 Brain damaged programs close FCBs multiple 29 ; times. Change so successive closes work by 30 ; always returning OK. Also, detect I/O to 31 ; already closed FCB and return EOF. 32 ; MZ 16 Jan 1984 More braindamage. Need to separate info 33 ; out of sft into FCB for reconnection 34 ; 35 ; A000 version 4.00 Jan. 1988 36 ; 37 [list -] 37 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 42 43 [list +] === Switch to base=002450h -> "DOSCODECODE" 44 section DOSCODECODE 45 [list -] 45 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 45 ****************** warning: out: BPB.INC... [-w+user] 45 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 45 ****************** warning: out: DEVSYM.INC... [-w+user] 45 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 53 54 EXTRN DOS_Read:NEAR, DOS_Write:NEAR 55 EXTRN DOS_Open:NEAR, DOS_Create:NEAR 56 57 I_need DMAAdd,DWORD ; current user's DMA address 58 I_need OpenBuf,128 ; buffer for translating paths 59 I_need ThisSFT,DWORD ; SFT in use 60 I_need sftFCB,DWORD ; pointer to SFTs for FCB cache 61 I_need FCBLRU,WORD ; least recently used count 62 I_need DISK_FULL,BYTE ; flag for disk full 63 %if debug 64 I_need BugLev,WORD 65 I_need BugTyp,WORD 66 %include "bugtyp.nas" 67 %endif 68 69 %ifndef BUF2 70 %IF BUFFERFLAG 71 I_need BUF_EMS_MODE,BYTE 72 I_need BUF_EMS_LAST_PAGE,DWORD 73 I_need BUF_EMS_FIRST_PAGE,DWORD 74 I_need BUF_EMS_SAFE_FLAG,BYTE 75 I_need BUF_EMS_NPA640,WORD 76 I_need BUF_EMS_PAGE_FRAME,WORD 77 I_need BUF_EMS_PFRAME,WORD 78 I_need LASTBUFFER,DWORD 79 80 extrn restore_user_map:near 81 extrn Setup_EMS_Buffers:near 82 %ENDIF 83 %endif 84 85 ; Defintions for FCBOp flags 86 87 Random equ 2 ; random operation 88 FCBRead equ 4 ; doing a read 89 Block equ 8 ; doing a block I/O 90 91 Break 92 93 ; 94 ; GetRR - correctly load DX:AX with the random record field (3 or 4 bytes) 95 ; from the FCB pointed to by DS:SI 96 ; 97 ; Inputs: DS:SI point to an FCB 98 ; BX has record size 99 ; Outputs: DX:AX contain the contents of the random record field 100 ; Registers modified: none 101 102 Procedure GetRR,NEAR 102 ****************** warning: proc GetRR... [-w+user] 103 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 104 FCB_RR equ fcb_RR ; NASM port label 0 000021A6 8B4421 MOV AX,WORD PTR [SI + FCB_RR] ; get low order part 0 000021A9 8B5423 MOV DX,WORD PTR [SI + FCB_RR+2] ; get high order part 0 000021AC 83FB40 CMP BX,64 ; ignore MSB of RR if recsiz > 64 0 000021AF 7202 JB GetRRBye 0 000021B1 30F6 XOR DH,DH 110 GetRRBye: 0 000021B3 C3 return 112 EndProc GetRR 113 114 Break 115 116 ; 117 ; GetExtent - Construct the next record to perform I/O from the EXTENT and 118 ; NR fields in the FCB. 119 ; 120 ; Inputs: DS:SI - point to FCB 121 ; Outputs: DX:AX contain the contents of the random record field 122 ; Registers modified: none 123 124 Procedure GetExtent,NEAR 124 ****************** warning: proc GetExtent... [-w+user] 125 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 000021B4 8A4420 MOV AL,[SI + fcb_NR] ; get low order piece 0 000021B7 8B540C MOV DX,[SI + fcb_EXTENT] ; get high order piece 0 000021BA D0E0 SHL AL,1 0 000021BC D1EA SHR DX,1 0 000021BE D0D8 RCR AL,1 ; move low order bit of DL to high order of AH 0 000021C0 88D4 MOV AH,DL 0 000021C2 88F2 MOV DL,DH 0 000021C4 30F6 XOR DH,DH 0 000021C6 C3 return 135 EndProc GetExtent 136 137 Break 138 139 ; 140 ; SetExtent - change the position of an FCB by filling in the extent/NR 141 ; fields 142 ; 143 ; Inputs: DS:SI point to FCB 144 ; DX:AX is a record location in file 145 ; Outputs: Extent/NR fields are filled in 146 ; Registers modified: CX 147 148 Procedure SetExtent,NEAR 148 ****************** warning: proc SetExtent... [-w+user] 149 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000021C7 5052 SaveReg 0 000021C9 89C1 MOV CX,AX 0 000021CB 247F AND AL,7FH ; next rec field 0 000021CD 884420 MOV [SI + fcb_NR],AL 0 000021D0 80E180 AND CL,80H ; save upper bit 0 000021D3 D1E1 SHL CX,1 0 000021D5 D1D2 RCL DX,1 ; move high bit of CX to low bit of DX 0 000021D7 88E8 MOV AL,CH 0 000021D9 88D4 MOV AH,DL 0 000021DB 89440C MOV [SI + fcb_EXTENT],AX ; all done 0 000021DE 5A58 RestoreReg 0 000021E0 C3 return 162 EndProc SetExtent 163 164 Break 165 166 ; 167 ; GetExtended - Make DS:SI point to FCB from DS:DX 168 ; 169 ; Inputs: DS:DX point to a possible extended FCB 170 ; Outputs: DS:SI point to the FCB part 171 ; zeroflag set if not extended fcb 172 ; Registers modified: SI 173 174 Procedure GetExtended,NEAR 174 ****************** warning: proc GetExtended... [-w+user] 175 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 000021E1 89D6 MOV SI,DX ; point to Something 0 000021E3 803CFF CMP BYTE PTR [SI],-1 ; look for extention 0 000021E6 7503 JNZ GetBye ; not there 0 000021E8 83C607 ADD SI,7 ; point to FCB 180 GetBye: 0 000021EB 39D6 CMP SI,DX ; set condition codes 0 000021ED C3 return 183 EndProc GetExtended 184 185 Break 186 187 ; 188 ; GetRecSize - return in BX the record size from the FCB at DS:SI 189 ; 190 ; Inputs: DS:SI point to a non-extended FCB 191 ; Outputs: BX contains the record size 192 ; Registers modified: None 193 194 Procedure GetRecSize,NEAR 194 ****************** warning: proc GetRecSize... [-w+user] 195 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000021EE 8B5C0E MOV BX,[SI + fcb_RECSIZ] ; get his record size 0 000021F1 09DB OR BX,BX ; is it nul? 0 000021F3 75F8 retnz 0 000021F5 BB8000 MOV BX,128 ; use default size 0 000021F8 895C0E MOV [SI + fcb_RECSIZ],BX ; stuff it back 0 000021FB C3 return 202 EndProc GetRecSize 203 204 BREAK 205 206 ; 207 ; FCBIO - look at FCBOP and merge all FCB operations into a single routine. 208 ; 209 ; Inputs: FCBOP flags which operations need to be performed 210 ; DS:DX point to FCB 211 ; CX may have count of number of records to xfer 212 ; Outputs: AL has error code 213 ; Registers modified: all 214 215 Procedure FCBIO,NEAR 215 ****************** warning: proc FCBIO... [-w+user] 216 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 217 PUBLIC FCBIO001S,FCBIO001E 218 FCBIO001S: 219 LocalVar FCBErr,BYTE 220 LocalVar cRec,WORD 221 LocalVar RecPos,DWORD 222 LocalVar RecSize,WORD 223 LocalVar bPos,DWORD 224 LocalVar cByte,WORD 225 LocalVar cResult,WORD 226 LocalVar cRecRes,WORD 227 LocalVar FCBOp,BYTE 228 FCBIO001E: 0 000021FC 5589E583EC14 Enter 230 231 FEOF EQU 1 232 FTRIM EQU 2 0 00002202 8846EC MOV [FCBOp],AL 0 00002205 C646FF00 MOV byte [FCBErr],0 ; FCBErr = 0; 0 00002209 E8D5FF invoke GetExtended ; FCB = GetExtended (); 236 BLOCK equ Block ; NASM port equate 0 0000220C F646EC08 TEST byte [FCBOp],BLOCK ; if ((OP&BLOCK) == 0) 0 00002210 7503 JNZ GetPos 0 00002212 B90100 MOV CX,1 ; cRec = 1; 240 GetPos: 0 00002215 894EFD MOV [cRec],CX ;*Tail coalesce 0 00002218 E899FF invoke GetExtent ; RecPos = GetExtent (); 0 0000221B E8D0FF invoke GetRecSize ; RecSize = GetRecSize (); 0 0000221E 895EF7 MOV [RecSize],BX 245 RANDOM equ Random ; NASM port equate 0 00002221 F646EC02 TEST byte [FCBOp],RANDOM ; if ((OP&RANDOM) <> 0) 0 00002225 7403 JZ GetRec 0 00002227 E87CFF invoke GetRR ; RecPos = GetRR (); 249 GetRec: 0 0000222A 8946F9 MOV [RecPosL],AX ;*Tail coalesce 0 0000222D 8956FB MOV [RecPosH],DX 0 00002230 E894FF invoke SetExtent ; SetExtent (RecPos); 0 00002233 8B46FB MOV AX,[RecPosH] ; bPos = RecPos * RecSize; 0 00002236 F7E3 MUL BX 0 00002238 89C7 MOV DI,AX 0 0000223A 8B46F9 MOV AX,[RecPosL] 0 0000223D F7E3 MUL BX 0 0000223F 01FA ADD DX,DI 0 00002241 8946F3 MOV [bPosL],AX 0 00002244 8956F5 MOV [bPosH],DX 0 00002247 8B46FD MOV AX,[cRec] ; cByte = cRec * RecSize; 0 0000224A F7E3 MUL BX 0 0000224C 8946F1 MOV [cByte],AX 0 0000224F 360306[0000] ADD AX,WORD PTR [ss:DMAAdd] ; if (cByte+DMA > 64K) { 0 00002254 83D200 ADC DX,0 0 00002257 7419 JZ DoOper 0 00002259 C646FF02 MOV byte [FCBErr],FTRIM ; FCBErr = FTRIM; 0 0000225D 36A1[0000] MOV AX,WORD PTR [ss:DMAAdd] ; cRec = (64K-DMA)/RecSize; 0 00002261 F7D8 NEG AX 0 00002263 7501 JNZ DoDiv 0 00002265 48 DEC AX 272 DoDiv: 0 00002266 31D2 XOR DX,DX 0 00002268 F7F3 DIV BX 0 0000226A 8946FD MOV [cRec],AX 0 0000226D F7E3 MUL BX ; cByte = cRec * RecSize; 0 0000226F 8946F1 MOV [cByte],AX ; } 278 DoOper: 0 00002272 31DB XOR BX,BX 0 00002274 895EEF MOV [cResult],BX ; cResult = 0; 0 00002277 395EF1 CMP [cByte],BX ; if (cByte <> 0 || 0 0000227A 7508 JNZ DoGetExt 0 0000227C F646FF02 TEST byte [FCBErr],FTRIM ; (FCBErr&FTRIM) == 0) { 284 %IF debug 285 JZ DoGetExt 286 JMP SkipOp 287 %ELSE 0 00002280 7402 JZ SKP_SkipOp 0 00002282 EB76 JMP SkipOp 290 SKP_SkipOp: 291 %ENDIF 292 DoGetExt: 0 00002284 E8[0000] invoke SFTFromFCB ; if (!SFTFromFCB (SFT,FCB)) 0 00002287 730F JNC ContinueOp 295 FCBDeath: 0 00002289 E8[0000] invoke FCB_Ret_Err ; signal error, map for extended 0 0000228C C746ED0000 MOV word [cRecRes],0 ; no bytes transferred 0 00002291 C646FF01 MOV byte [FCBErr],FEOF ; return FTRIM; 0 00002295 E9F000 JMP FCBSave ; bam! 300 ContinueOp: 301 Assert ISSFT,,"ContinueOP" 302 fcb_filsiz equ fcb_FILSIZ ; NASM port label 0 00002298 8B4410 MOV AX,WORD PTR [SI + fcb_filsiz] 0 0000229B 26894511 MOV WORD PTR [ES:DI + sf_size],AX 0 0000229F 8B4412 MOV AX,WORD PTR [SI + fcb_filsiz + 2] 0 000022A2 26894513 MOV WORD PTR [ES:DI + sf_size + 2],AX 0 000022A6 8B46F3 MOV AX,[bPosL] 0 000022A9 8B56F5 MOV DX,[bPosH] 0 000022AC 26894515 MOV WORD PTR [ES:DI + sf_position],AX 0 000022B0 26875517 XCHG WORD PTR [ES:DI + sf_position+2],DX 0 000022B4 52 PUSH DX ; save away Open age. 0 000022B5 8B4EF1 MOV CX,[cByte] ; cResult = 313 314 ; int 3 315 316 DOSGroup equ DOSGROUP ; NASM port equate 0 000022B8 BF[0000] MOV DI,OFFSET DOS_Read ; *(OP&FCBRead ? DOS_Read 0 000022BB F646EC04 TEST byte [FCBOp],FCBRead ; : DOS_Write)(cRec); 0 000022BF 7503 JNZ DoContext 0 000022C1 BF[0000] MOV DI,OFFSET DOS_Write 321 DoContext: 0 000022C4 551E56 SaveReg 0 000022C7 161F Context DS 324 ;; Fix for disk full 0 000022C9 FFD7 CALL DI 0 000022CB 5E1F5D RestoreReg 327 ASSUME DS:NOTHING 328 329 %ifndef BUF2 330 %IF BUFFERFLAG 331 pushf 332 push ax 333 push bx 334 335 cmp byte [ss:BUF_EMS_MODE], -1 336 jz dos_fcb_call_done 337 call restore_user_map 338 mov ax, word ptr [ss:BUF_EMS_LAST_PAGE] 339 cmp [ss:BUF_EMS_PFRAME], ax 340 je dos_fcb_call_done 341 mov word ptr [ss:LASTBUFFER], -1 342 mov [ss:BUF_EMS_PFRAME], ax 343 mov ax, word ptr [ss:BUF_EMS_LAST_PAGE+2] 344 mov [ss:BUF_EMS_PAGE_FRAME], ax 345 mov byte [ss:BUF_EMS_SAFE_FLAG], 1 346 call Setup_EMS_Buffers 347 348 dos_fcb_call_done: 349 pop bx 350 pop ax 351 popf 352 %ENDIF 353 %endif 354 0 000022CE 72B9 JC FCBDeath 356 0 000022D0 36803E[0000]00 CMP BYTE PTR [ss:DISK_FULL],0 ; treat disk full as error 0 000022D6 740A JZ NODSKFULL 0 000022D8 36C606[0000]00 MOV BYTE PTR [ss:DISK_FULL],0 ; clear the flag 0 000022DE C646FF01 MOV byte [FCBerr],FEOF ; set disk full flag 361 NODSKFULL: 362 ;; Fix for disk full 0 000022E2 894EEF MOV [cResult],CX 0 000022E5 E8[0000] invoke SaveFCBInfo ; SaveFCBInfo (FCB); 365 Assert ISSFT,,"FCBIO/SaveFCBInfo" 366 %warning out: WARNING!!! Make sure sf_position+2 is OpenAGE 366 ****************** warning: out: WARNING!!! Make sure sf_position+2 is OpenAGE [-w+user] 367 sf_Position equ sf_position ; NASM port label 0 000022E8 268F4517 POP WORD PTR [ES:DI + sf_Position + 2] ; restore open age 0 000022EC 268B4511 MOV AX,WORD PTR [ES:DI + sf_size] 0 000022F0 894410 MOV WORD PTR [SI + fcb_filsiz],AX 0 000022F3 268B4513 MOV AX,WORD PTR [ES:DI + sf_size + 2] 0 000022F7 894412 MOV WORD PTR [SI + fcb_filsiz + 2],AX 373 ; } 374 SkipOp: 0 000022FA 8B46EF MOV AX,[cResult] ; cRecRes = cResult / RecSize; 0 000022FD 31D2 XOR DX,DX 0 000022FF F776F7 DIV word [RecSize] 0 00002302 8946ED MOV [cRecRes],AX 0 00002305 0146F9 ADD [RecPosL],AX ; RecPos += cRecResult; 0 00002308 8356FB00 ADC word [RecPosH],0 381 ; 382 ; If we have not gotten the expected number of records, we signal an EOF 383 ; condition. On input, this is EOF. On output this is usually disk full. 384 ; BUT... Under 2.0 and before, all device output IGNORED this condition. So 385 ; do we. 386 ; 0 0000230C 3B46FD CMP AX,[cRec] ; if (cRecRes <> cRec) 0 0000230F 7412 JZ TryBlank 0 00002311 F646EC04 TEST byte [FCBOp],FCBRead ; if (OP&FCBRead || !DEVICE) 0 00002315 7508 JNZ SetEOF 0 00002317 26F745058000 TEST word [ES:DI + sf_flags],devid_device 0 0000231D 7504 JNZ TryBlank 393 SetEOF: 0 0000231F C646FF01 MOV byte [FCBErr],FEOF ; FCBErr = FEOF; 395 TryBlank: ; 0 00002323 09D2 OR DX,DX ; if (cResult%RecSize <> 0) { 0 00002325 7426 JZ SetExt 0 00002327 8346F901 ADD word [RecPosL],1 ; RecPos++; 0 0000232B 8356FB00 ADC word [RecPosH],0 0 0000232F F646EC04 TEST byte [FCBOp],FCBRead ; if(OP&FCBRead) <> 0) { 0 00002333 7418 JZ SetExt 0 00002335 FF46ED INC word [cRecRes] ; cRecRes++; 0 00002338 C646FF03 MOV byte [FCBErr],FTRIM + FEOF ; FCBErr = FTRIM | FEOF; 0 0000233C 8B4EF7 MOV CX,[RecSize] ; Blank (RecSize-cResult%RecSize, 0 0000233F 29D1 SUB CX,DX ; DMA+cResult); 0 00002341 30C0 XOR AL,AL 0 00002343 36C43E[0000] LES DI,[ss:DMAAdd] 0 00002348 037EEF ADD DI,[cResult] 0 0000234B F3AA REP STOSB ; } } 410 SetExt: 0 0000234D 8B56FB MOV DX,[RecPosH] 0 00002350 8B46F9 MOV AX,[RecPosL] 0 00002353 F646EC02 TEST byte [FCBOp],RANDOM ; if ((OP&Random) == 0 || 0 00002357 7406 JZ DoSetExt 0 00002359 F646EC08 TEST byte [FCBOp],BLOCK ; (OP&BLOCK) <> 0) 0 0000235D 7403 JZ TrySetRR 417 DoSetExt: 0 0000235F E865FE invoke SetExtent ; SetExtent (RecPos, FCB); 419 TrySetRR: 0 00002362 F646EC08 TEST byte [FCBOp],BLOCK ; if ((op&BLOCK) <> 0) 0 00002366 740F JZ TryReturn 0 00002368 894421 MOV WORD PTR [SI + FCB_RR],AX ; FCB->RR = RecPos; 0 0000236B 885423 MOV BYTE PTR [SI + FCB_RR+2],DL 0 0000236E 837C0E40 CMP word [SI + fcb_RECSIZ],64 0 00002372 7303 JAE TryReturn 0 00002374 887424 MOV [SI+fcb_RR+2+1],DH ; Set 4th byte only if record size < 64 427 TryReturn: 0 00002377 F646EC04 TEST byte [FCBOP],FCBRead ; if (!(FCBOP & FCBREAD)) { 0 0000237B 750B JNZ FCBSave 0 0000237D 1E SaveReg ; FCB->FDate = date; 0 0000237E E8[0000] Invoke Date16 ; FCB->FTime = time; 0 00002381 1F RestoreReg 433 FCB_FDate equ fcb_FDATE ; NASM port label 0 00002382 894414 MOV [SI + FCB_FDate],AX 435 FCB_FTime equ fcb_FTIME ; NASM port label 0 00002385 895416 MOV [SI + FCB_FTime],DX ; } 437 FCBSave: 0 00002388 F646EC08 TEST byte [FCBOp],BLOCK ; if ((op&BLOCK) <> 0) 0 0000238C 7409 JZ DoReturn 0 0000238E 8B4EED MOV CX,[cRecRes] ; user_CX = cRecRes; 0 00002391 E8[0000] invoke Get_User_Stack 442 User_CX equ user_CX ; NASM port label 0 00002394 894C04 MOV [SI + User_CX],CX 444 DoReturn: 0 00002397 8A46FF MOV AL,[FCBErr] ; return (FCBERR); 0 0000239A 89EC5D Leave 0 0000239D C3 return 448 EndProc FCBIO 449 450 Break <$FCB_Open - open an old-style FCB> 451 452 ; 453 ; $FCB_Open - CPM compatability file open. The user has formatted an FCB 454 ; for us and asked to have the rest filled in. 455 ; 456 ; Inputs: DS:DX point to an unopenned FCB 457 ; Outputs: AL indicates status 0 is ok FF is error 458 ; FCB has the following fields filled in: 459 ; Time/Date Extent/NR Size 460 461 Procedure D_FCB_Open,NEAR 461 ****************** warning: proc D_FCB_Open... [-w+user] 462 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 463 sharing_Compat equ sharing_compat ; NASM port equate 464 Open_For_Both equ open_for_both ; NASM port equate 0 0000239E B80200 MOV AX,sharing_Compat+Open_For_Both 0 000023A1 B9[0000] MOV CX,OFFSET DOS_Open 467 ; 468 ; The following is common code for Creation and openning of FCBs. AX is 469 ; either attributes (for create) or open mode (for open)... DS:DX points to 470 ; the FCB 471 ; 472 DoAccess: 0 000023A4 1E525150 SaveReg ; save FCB pointer away 0 000023A8 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup 0 000023AB E8[0000] invoke TransFCB ; crunch the fcb 0 000023AE 58595A1F RestoreReg ; get fcb 0 000023B2 7303 JNC FindFCB ; everything seems ok 478 FCBOpenErr: 479 ; 480 ; AL has error code 481 ; 0 000023B4 E9[0000] transfer FCB_Ret_Err 483 FindFCB: 0 000023B7 E827FE invoke GetExtended ; DS:SI will point to FCB 0 000023BA E8[0000] invoke LRUFCB ; get a sft entry (no error) 0 000023BD 722A JC HardMessage 487 ASSUME ES:NOTHING 488 489 ; Message 1,"Entering " 490 ; MessageNum ES 491 ; Message 1,":" 492 ; MessageNum DI 493 ; Message 1,<13,10> 494 495 sf_ISFCB equ sf_isfcb ; NASM port equate 0 000023BF 26C745020080 MOV word [ES:DI + sf_mode],sf_ISFCB 0 000023C5 1E5653 SaveReg ; save fcb pointer 0 000023C8 89CE MOV SI,CX 0 000023CA 161F Context DS ; let DOS_Open see variables 0 000023CC FFD6 CALL SI ; go open the file 0 000023CE 5B5E1F RestoreReg ; get fcb 502 ASSUME DS:NOTHING 0 000023D1 36C43E[0000] LES DI,[ss:ThisSFT] ; get sf pointer 0 000023D6 7318 JNC FCBOK ; operation succeeded 505 Assert ISSFT,,"DeadFCB" 506 failopen: 0 000023D8 50 PUSH AX 0 000023D9 B052 MOV AL,"R" ; clear out field (free sft) 0 000023DB E8[0000] invoke BlastSFT 0 000023DE 58 POP AX 0 000023DF 83F804 CMP AX,error_too_many_open_files 0 000023E2 7405 JZ HardMessage 0 000023E4 83F824 CMP AX,error_sharing_buffer_exceeded 0 000023E7 7505 jnz DeadFCB 515 HardMessage: 0 000023E9 50 PUSH AX 0 000023EA E8[0000] invoke FCBHardErr 0 000023ED 58 POP AX 519 DeadFCB: 0 000023EE EBC4 transfer FCB_Ret_Err 521 FCBOK: 0 000023F0 E8[0000] invoke IsSFTNet ;AN007;F.C. >32mb Non Fat file? 0 000023F3 7511 JNZ FCBOK2 ;AN007;F.C. >32mb yes 0 000023F5 E8[0000] invoke CheckShare ;AN000;F.C. >32mb share around? 0 000023F8 750C JNZ FCBOK2 ;AN000;F.C. >32mb yes 0 000023FA 26837D1D00 CMP WORD PTR [ES:DI + sf_dirsec + 2],0 ;AN000;F.C. >32mb if dirsec >32mb 0 000023FF 7405 JZ FCBOK2 ;AN000;F.C. >32mb then error 0 00002401 B85A00 MOV AX,error_sys_comp_not_loaded ;AN000;F.C. >32mb 0 00002404 EBD2 JMP failopen ;AN000;F.C. >32mb 530 FCBOK2: 531 0 00002406 26FF05 INC word [ES:DI + sf_ref_count] ; increment reference count 0 00002409 E8[0000] invoke SaveFCBInfo 534 Assert ISSFT,,"FCBOK" 0 0000240C E8[0000] invoke SetOpenAge 536 Assert ISSFT,,"FCBOK/SetOpenAge" 0 0000240F 26F745058000 TEST word [ES:DI + sf_flags],devid_device 0 00002415 7509 JNZ FCBNoDrive ; do not munge drive on devices 0 00002417 8A04 MOV AL,[SI] ; get drive byte 0 00002419 E8[0000] invoke GetThisDrv ; convert 0 0000241C FEC0 INC AL 0 0000241E 8804 MOV [SI],AL ; stash in good drive letter 543 FCBNoDrive: 544 FCB_RecSiz equ fcb_RECSIZ ; NASM port label 0 00002420 C7440E8000 MOV word [SI + FCB_RecSiz],80h ; stuff in default record size 546 SF_Time equ sf_time ; NASM port label 0 00002425 268B450D MOV AX,[ES:DI + SF_Time] ; set time 0 00002429 894416 MOV [SI + FCB_FTime],AX 549 SF_Date equ sf_date ; NASM port label 0 0000242C 268B450F MOV AX,[ES:DI + SF_Date] ; set date 0 00002430 894414 MOV [SI + FCB_FDate],AX 552 SF_Size equ sf_size ; NASM port label 0 00002433 268B4511 MOV AX,WORD PTR [ES:DI + SF_Size] ; set sizes 554 FCB_FILSIZ equ fcb_FILSIZ ; NASM port label 0 00002437 894410 MOV [SI + FCB_FILSIZ],AX 0 0000243A 268B4513 MOV AX,WORD PTR [ES:DI + SF_Size + 2] 0 0000243E 894412 MOV [SI + FCB_FILSIZ + 2],AX 0 00002441 31C0 XOR AX,AX ; convenient zero 559 FCB_Extent equ fcb_EXTENT ; NASM port label 0 00002443 89440C MOV [SI + FCB_Extent],AX ; point to beginning of file 561 ; 562 ; We must scan the set of FCB SFTs for one that appears to match the current 563 ; one. We cheat and use CheckFCB to match the FCBs. 564 ; 565 SFTFCB equ sftFCB ; NASM port label 0 00002446 36C43E[0000] LES DI,[ss:SFTFCB] ; get the pointer to head of the list 567 sfCount equ SFCount ; NASM port label 0 0000244B 268A6504 MOV AH,BYTE PTR [ES:DI + sfCount] ; get number of SFTs to scan 569 OpenScan: 0 0000244F 3A4418 CMP AL,[SI + fcb_sfn] ; don't compare ourselves 0 00002452 7407 JZ SkipCheck 0 00002454 50 SaveReg ; preserve count 0 00002455 E8[0000] invoke CheckFCB ; do they match 0 00002458 58 RestoreReg ; get count back 0 00002459 7309 JNC OpenFound ; found a match! 576 SkipCheck: 0 0000245B FEC0 INC AL ; advance to next FCB 0 0000245D 38E0 CMP AL,AH ; table full? 0 0000245F 75EE JNZ OpenScan ; no, go for more 580 OpenDone: 0 00002461 30C0 xor al,al ; return success 0 00002463 C3 return 583 ; 584 ; The SFT at ES:DI is the one that is already in use for this FCB. We set the 585 ; FCB to use this one. We increment its ref count. We do NOT close it at all. 586 ; Consider: 587 ; 588 ; open (foo) delete (foo) open (bar) 589 ; 590 ; This causes us to recycle (potentially) bar through the same local SFT as 591 ; foo even though foo is no longer needed; this is due to the server closing 592 ; foo for us when we delete it. Unfortunately, we cannot see this closure. 593 ; If we were to CLOSE bar, the server would then close the only reference to 594 ; bar and subsequent I/O would be lost to the redirector. 595 ; 596 ; This gets solved by NOT closing the sft, but zeroing the ref count 597 ; (effectively freeing the SFT) and informing the sharer (if relevant) that 598 ; the SFT is no longer in use. Note that the SHARER MUST keep its ref counts 599 ; around. This will allow us to access the same file through multiple network 600 ; connections and NOT prematurely terminate when the ref count on one 601 ; connection goes to zero. 602 ; 603 OpenFound: 0 00002464 884418 MOV [SI + fcb_SFN],AL ; assign with this 0 00002467 26FF05 INC word [ES:DI + sf_ref_count] ; remember this new invocation 0 0000246A 36A1[0000] MOV AX,[ss:FCBLRU] ; update LRU counts 0 0000246E 26894515 MOV [ES:DI + sf_LRU],AX 608 ; 609 ; We have an FCB sft that is now of no use. We release sharing info and then 610 ; blast it to prevent other reuse. 611 ; 0 00002472 161F context DS 0 00002474 C43E[0000] LES DI,[ThisSFT] 0 00002478 26FF0D DEC word [ES:DI + sf_ref_count] ; free the newly allocated SFT 0 0000247B E8[0000] invoke ShareEnd 616 Assert ISSFT,,"Open blasting" 0 0000247E B043 MOV AL,'C' 0 00002480 E8[0000] invoke BlastSFT 0 00002483 EBDC JMP OpenDone 620 EndProc D_FCB_Open 621 622 BREAK <$FCB_Create - create a new directory entry> 623 624 ; 625 ; $FCB_Create - CPM compatability file create. The user has formatted an 626 ; FCB for us and asked to have the rest filled in. 627 ; 628 ; Inputs: DS:DX point to an unopenned FCB 629 ; Outputs: AL indicates status 0 is ok FF is error 630 ; FCB has the following fields filled in: 631 ; Time/Date Extent/NR Size 632 633 Procedure D_FCB_Create,NEAR 633 ****************** warning: proc D_FCB_Create... [-w+user] 634 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00002485 B9[0000] MOV CX,OFFSET DOS_Create ; routine to call 0 00002488 31C0 XOR AX,AX ; attributes to create 0 0000248A E854FD invoke GetExtended ; get extended FCB 0 0000248D 7403 JZ DoAccessJ ; not an extended FCB 0 0000248F 8A44FF MOV AL,[SI-1] ; get attributes 640 DoAccessJ: 0 00002492 E90FFF JMP DoAccess ; do dirty work 642 EndProc D_FCB_Create 643 644 BREAK <$FCB_Random_write_Block - write a block of records to a file > 645 646 ; 647 ; $FCB_Random_Write_Block - retrieve a location from the FCB, seek to it 648 ; and write a number of blocks from it. 649 ; 650 ; Inputs: DS:DX point to an FCB 651 ; Outputs: AL = 0 write was successful and the FCB position is updated 652 ; AL <> 0 Not enough room on disk for the output 653 ; 654 655 Procedure D_FCB_Random_Write_Block,NEAR 655 ****************** warning: proc D_FCB_Random_Write_Block... [-w+user] 656 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00002495 B00A MOV AL,Random+Block 0 00002497 E962FD JMP FCBIO 659 EndProc D_FCB_Random_Write_Block 660 661 BREAK <$FCB_Random_Read_Block - read a block of records to a file > 662 663 ; 664 ; $FCB_Random_Read_Block - retrieve a location from the FCB, seek to it 665 ; and read a number of blocks from it. 666 ; 667 ; Inputs: DS:DX point to an FCB 668 ; Outputs: AL = error codes defined above 669 ; 670 671 Procedure D_FCB_Random_Read_Block,NEAR 671 ****************** warning: proc D_FCB_Random_Read_Block... [-w+user] 672 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000249A B00E MOV AL,Random+FCBRead+Block 0 0000249C E95DFD JMP FCBIO 675 EndProc D_FCB_Random_Read_Block 676 677 BREAK <$FCB_Seq_Read - read the next record from a file > 678 679 ; 680 ; $FCB_Seq_Read - retrieve the next record from an FCB and read it into 681 ; memory 682 ; 683 ; Inputs: DS:DX point to an FCB 684 ; Outputs: AL = error codes defined above 685 ; 686 687 Procedure D_FCB_Seq_Read,NEAR 687 ****************** warning: proc D_FCB_Seq_Read... [-w+user] 688 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000249F B004 MOV AL,FCBRead 0 000024A1 E958FD JMP FCBIO 691 EndProc D_FCB_Seq_Read 692 693 BREAK <$FCB_Seq_Write - write the next record to a file > 694 695 ; 696 ; $FCB_Seq_Write - retrieve the next record from an FCB and write it to the 697 ; file 698 ; 699 ; Inputs: DS:DX point to an FCB 700 ; Outputs: AL = error codes defined above 701 ; 702 703 Procedure D_FCB_Seq_Write,NEAR 703 ****************** warning: proc D_FCB_Seq_Write... [-w+user] 704 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000024A4 B000 MOV AL,0 0 000024A6 E953FD jmp FCBIO 707 EndProc D_FCB_SEQ_WRITE 708 709 BREAK <$FCB_Random_Read - Read a single record from a file > 710 711 ; 712 ; $FCB_Random_Read - retrieve a location from the FCB, seek to it and read a 713 ; record from it. 714 ; 715 ; Inputs: DS:DX point to an FCB 716 ; Outputs: AL = error codes defined above 717 ; 718 719 Procedure D_FCB_Random_Read,NEAR 719 ****************** warning: proc D_FCB_Random_Read... [-w+user] 720 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000024A9 B006 MOV AL,Random+FCBRead 0 000024AB E94EFD jmp FCBIO ; single block 723 EndProc D_FCB_RANDOM_READ 724 725 BREAK <$FCB_Random_Write - write a single record to a file > 726 727 ; 728 ; $FCB_Random_Write - retrieve a location from the FCB, seek to it and write 729 ; a record to it. 730 ; 731 ; Inputs: DS:DX point to an FCB 732 ; Outputs: AL = error codes defined above 733 ; 734 735 Procedure D_FCB_Random_Write,NEAR 735 ****************** warning: proc D_FCB_Random_Write... [-w+user] 736 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000024AE B002 MOV AL,Random 0 000024B0 E949FD jmp FCBIO 739 EndProc D_FCB_RANDOM_WRITE 740 741 END 742 743 744 745 === Trace listing source: ../DOS/search.lst 1 ; SCCSID = @(#)search.asm 1.1 85/04/10 2 ;TITLE SEARCH - Directory scan system calls 3 ;NAME SEARCH 4 5 ; 6 ; 7 ; Directory search system calls. These will be passed direct text of the 8 ; pathname from the user. They will need to be passed through the macro 9 ; expander prior to being sent through the low-level stuff. I/O specs are 10 ; defined in DISPATCH. The system calls are: 11 ; 12 ; 13 ; $Dir_Search_First written 14 ; $Dir_Search_Next written 15 ; $Find_First written 16 ; $Find_Next written 17 ; PackName written 18 ; 19 ; Modification history: 20 ; 21 ; Created: ARR 4 April 1983 22 ; 23 24 [list -] 24 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 29 30 [list +] === Switch to base=002450h -> "DOSCODECODE" 31 section DOSCODECODE 32 [list -] 32 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 32 ****************** warning: out: BPB.INC... [-w+user] 32 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 32 ****************** warning: out: DEVSYM.INC... [-w+user] 41 42 i_need SEARCHBUF,53 43 i_need SATTRIB,BYTE 44 I_Need OpenBuf,128 45 I_need DMAAdd,DWORD 46 I_need THISFCB,DWORD 47 I_need CurDrv,BYTE 48 I_need EXTFCB,BYTE 49 I_need Fastopenflg,BYTE 50 I_need DOS34_FLAG,WORD 51 52 ; Inputs: 53 ; DS:DX Points to unopenned FCB 54 ; Function: 55 ; Directory is searched for first matching entry and the directory 56 ; entry is loaded at the disk transfer address 57 ; Returns: 58 ; AL = -1 if no entries matched, otherwise 0 59 60 procedure D_DIR_SEARCH_FIRST,NEAR 60 ****************** warning: proc D_DIR_SEARCH_FIRST... [-w+user] 61 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 62 0 000024B3 368916[0000] MOV WORD PTR [ss:THISFCB],DX 0 000024B8 368C1E[0200] MOV WORD PTR [ss:THISFCB+2],DS 0 000024BD 89D6 MOV SI,DX 0 000024BF 803CFF CMP BYTE PTR [SI],0FFH 0 000024C2 7503 JNZ NORMFCB4 0 000024C4 83C607 ADD SI,7 ; Point to drive select byte 69 NORMFCB4: 0 000024C7 FF34 SaveReg ; Save original drive byte for later 0 000024C9 1607 Context ES ; get es to address DOSGroup 72 DOSGroup equ DOSGROUP ; NASM port equate 0 000024CB BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate buffer 0 000024CE E8[0000] invoke TransFCB ; convert the FCB, set SATTRIB EXTFCB 0 000024D1 7304 JNC SearchIt ; no error, go and look 0 000024D3 5B RestoreReg ; Clean stack 77 ; 78 ; Error code is in AX 79 ; 0 000024D4 E9[0000] transfer FCB_Ret_Err ; error 81 82 SearchIt: 0 000024D7 161F Context DS ; get ready for search 0 000024D9 FF36[0000]FF36 SaveReg <, > 0 000024DF [0200] 0 000024E1 C706[0000][0000] MOV WORD PTR [DMAAdd],OFFSET SEARCHBUF wrt DOSGroup 0 000024E7 8C1E[0200] MOV WORD PTR [DMAAdd+2],DS 0 000024EB E88B01 invoke GET_FAST_SEARCH ; search 0 000024EE 8F06[0200]8F06 RestoreReg <, > 0 000024F4 [0000] 0 000024F6 7303 JNC SearchSet ; no error, transfer info 0 000024F8 5B RestoreReg ; Clean stack 91 ; 92 ; Error code is in AX 93 ; 0 000024F9 EBD9 transfer FCB_Ret_Err 95 96 ; 97 ; The search was successful (or the search-next). We store the information 98 ; into the user's FCB for continuation. 99 ; 100 SearchSet: 0 000024FB BE[0000] MOV SI,OFFSET SEARCHBUF wrt DOSGroup 0 000024FE C43E[0000] LES DI,[THISFCB] ; point to the FCB 0 00002502 F606[0000]FF TEST byte [EXTFCB],0FFH ; 0 00002507 7403 JZ NORMFCB1 0 00002509 83C707 ADD DI,7 ; Point past the extension 106 NORMFCB1: 0 0000250C 5B RestoreReg ; Get original drive byte 0 0000250D 08DB OR BL,BL 0 0000250F 7506 JNZ SearchDrv 0 00002511 8A1E[0000] MOV BL,[CurDrv] 0 00002515 FEC3 INC BL 112 SearchDrv: 0 00002517 AC LODSB ; Get correct search contin drive byte 0 00002518 86C3 XCHG AL,BL ; Search byte to BL, user byte to AL 0 0000251A 47 INC DI 116 ; STOSB ; Store the correct "user" drive byte 117 ; at the start of the search info 0 0000251B B90A00 MOV CX,20/2 0 0000251E F3A5 REP MOVSW ; Rest of search cont info, SI -> entry 0 00002520 86C3 XCHG AL,BL ; User drive byte back to BL, search 121 ; byte to AL 0 00002522 AA STOSB ; Search contin drive byte at end of 123 ; contin info 0 00002523 C43E[0000] LES DI,[DMAAdd] 0 00002527 F606[0000]FF TEST byte [EXTFCB],0FFH 0 0000252C 740E JZ NORMFCB2 0 0000252E B0FF MOV AL,0FFH 0 00002530 AA STOSB 0 00002531 FEC0 INC AL 0 00002533 B90500 MOV CX,5 0 00002536 F3AA REP STOSB 0 00002538 A0[0000] MOV AL,[SATTRIB] 0 0000253B AA STOSB 134 NORMFCB2: 0 0000253C 88D8 MOV AL,BL ; User Drive byte 0 0000253E AA STOSB 137 %IF DBCS ;AN000; 138 MOVSW ; 2/13/KK ;AN000; 139 CMP BYTE PTR [ES:DI-2],5 ; 2/13/KK ;AN000; 140 JNZ NOTKTRAN ; 2/13/KK ;AN000; 141 MOV BYTE PTR [ES:DI-2],0E5H ; 2/13/KK ;AN000; 142 NOTKTRAN: ; 2/13/KK ;AN000; 143 MOV CX,15 ; 2/13/KK ;AN000; 144 %ELSE ;AN000; 0 0000253F B91000 MOV CX,16 ; 32 / 2 words of dir entry ;AN000; 146 %ENDIF ;AN000; 0 00002542 F3A5 REP MOVSW 0 00002544 E9[0000] transfer FCB_Ret_OK 149 150 EndProc D_DIR_SEARCH_FIRST 150 ****************** warning: ***** Possible stack size error in D_DIR_SEARCH_FIRST ***** [-w+user] 151 152 ; Inputs: 153 ; DS:DX points to unopenned FCB returned by $DIR_SEARCH_FIRST 154 ; Function: 155 ; Directory is searched for the next matching entry and the directory 156 ; entry is loaded at the disk transfer address 157 ; Returns: 158 ; AL = -1 if no entries matched, otherwise 0 159 160 procedure D_DIR_SEARCH_NEXT,NEAR 160 ****************** warning: proc D_DIR_SEARCH_NEXT... [-w+user] 161 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 162 0 00002547 368916[0000] MOV WORD PTR [ss:THISFCB],DX 0 0000254C 368C1E[0200] MOV WORD PTR [ss:THISFCB+2],DS 0 00002551 36C606[0000]00 MOV byte [ss:SATTRIB],0 0 00002557 36C606[0000]00 MOV byte [ss:EXTFCB],0 0 0000255D 1607 Context ES 0 0000255F BF[0000] MOV DI,OFFSET SEARCHBUF wrt DOSGroup 0 00002562 89D6 MOV SI,DX 0 00002564 803CFF CMP BYTE PTR [SI],0FFH 0 00002567 750D JNZ NORMFCB6 0 00002569 83C606 ADD SI,6 0 0000256C AC LODSB 0 0000256D 36A2[0000] MOV [ss:SATTRIB],AL 0 00002571 36FE0E[0000] DEC byte [ss:EXTFCB] 176 NORMFCB6: 0 00002576 AC LODSB ; Get original user drive byte 0 00002577 50 SaveReg ; Put it on stack 0 00002578 8A4414 MOV AL,[SI+20] ; Get correct search contin drive byte 0 0000257B AA STOSB ; Put in correct place 0 0000257C B90A00 MOV CX,20/2 0 0000257F F3A5 REP MOVSW ; Transfer in rest of search contin info 0 00002581 161F Context DS 0 00002583 FF36[0000]FF36 SaveReg <, > 0 00002589 [0200] 0 0000258B C706[0000][0000] MOV WORD PTR [DMAAdd],OFFSET SEARCHBUF wrt DOSGroup 0 00002591 8C1E[0200] MOV WORD PTR [DMAAdd+2],DS 0 00002595 E8[0000] invoke DOS_SEARCH_NEXT ; Find it 0 00002598 8F06[0200]8F06 RestoreReg <, > 0 0000259E [0000] 0 000025A0 7203 JC SearchNoMore 0 000025A2 E956FF JMP SearchSet ; Ok set return 191 192 SearchNoMore: 0 000025A5 C43E[0000] LES DI,[THISFCB] 0 000025A9 F606[0000]FF TEST byte [EXTFCB],0FFH 0 000025AE 7403 JZ NORMFCB8 0 000025B0 83C707 ADD DI,7 ; Point past the extension 197 NORMFCB8: 0 000025B3 5B RestoreReg ; Get original drive byte 0 000025B4 26881D MOV [ES:DI],BL ; Store the correct "user" drive byte 200 ; at the right spot 201 ; 202 ; error code is in AX 203 ; 0 000025B7 E9[0000] transfer FCB_Ret_Err 205 206 EndProc D_DIR_SEARCH_NEXT 207 208 ; Assembler usage: 209 ; MOV AH, FindFirst 210 ; LDS DX, name 211 ; MOV CX, attr 212 ; INT 21h 213 ; ; DMA address has datablock 214 ; 215 ; Error Returns: 216 ; AX = error_path_not_found 217 ; = error_no_more_files 218 219 procedure D_FIND_FIRST,NEAR 219 ****************** warning: proc D_FIND_FIRST... [-w+user] 220 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 221 0 000025BA 89D6 MOV SI,DX ; get name in appropriate place 0 000025BC 36880E[0000] MOV [ss:SATTRIB],CL ; Search attribute to correct loc 0 000025C1 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate buffer 0 000025C4 E8[0000] invoke TransPathSet ; convert the path 0 000025C7 7305 JNC Find_it ; no error, go and look 227 FindError: 0 000025C9 B003E9[0000] error error_path_not_found ; error and map into one. 229 Find_it: 0 000025CE 161F Context DS 0 000025D0 FF36[0000]FF36 SaveReg <, > 0 000025D6 [0200] 0 000025D8 C706[0000][0000] MOV WORD PTR [DMAAdd],OFFSET SEARCHBUF wrt DOSGroup 0 000025DE 8C1E[0200] MOV WORD PTR [DMAAdd+2],DS 0 000025E2 E89400 invoke GET_FAST_SEARCH ; search 0 000025E5 8F06[0200]8F06 RestoreReg <, > 0 000025EB [0000] 0 000025ED 7302 JNC FindSet ; no error, transfer info 0 000025EF EBDA transfer Sys_Ret_Err 238 239 FindSet: 0 000025F1 BE[0000] MOV SI,OFFSET SEARCHBUF wrt DOSGroup 0 000025F4 C43E[0000] LES DI,[DMAAdd] 0 000025F8 B91500 MOV CX,21 0 000025FB F3A4 REP MOVSB 0 000025FD 56 PUSH SI ; Save pointer to start of entry 0 000025FE 8A440B MOV AL,[SI + dir_attr] 0 00002601 AA STOSB 0 00002602 83C616 ADD SI,dir_time 0 00002605 A5 MOVSW ; dir_time 0 00002606 A5 MOVSW ; dir_date 0 00002607 46 INC SI 0 00002608 46 INC SI ; Skip dir_first 0 00002609 A5 MOVSW ; dir_size (2 words) 0 0000260A A5 MOVSW 0 0000260B 5E POP SI ; Point back to dir_name 255 %IF DBCS ;AN000; 256 PUSH DI ; XXXX save dest name 2/13/KK ;AN000; 257 CALL PackName ;AN000; 258 POP DI ; XXXX Recover dest name 2/13/KK ;AN000; 259 CMP BYTE PTR [ES:DI],05H ; XXXX Need fix? 2/13/KK ;AN000; 260 JNZ FNXXX ; XXXX No 2/13/KK ;AN000; 261 MOV BYTE PTR [ES:DI],0E5H ; XXXX Yes, Fix 2/13/KK ;AN000; 262 FNXXX: ; 2/13/KK ;AN000; 263 %ELSE ;AN000; 0 0000260C E83500 CALL PackName 265 %ENDIF 0 0000260F E9[0000] transfer Sys_Ret_OK ; bye with no errors 267 EndProc D_FIND_FIRST 268 269 procedure D_FIND_NEXT,NEAR 269 ****************** warning: proc D_FIND_NEXT... [-w+user] 270 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 271 272 ; Assembler usage: 273 ; ; dma points at area returned by find_first 274 ; MOV AH, findnext 275 ; INT 21h 276 ; ; next entry is at dma 277 ; 278 ; Error Returns: 279 ; AX = error_no_more_files 280 0 00002612 1607 Context ES 0 00002614 BF[0000] MOV DI,OFFSET SEARCHBUF wrt DOSGroup 0 00002617 36C536[0000] LDS SI,[ss:DMAAdd] 0 0000261C B91500 MOV CX,21 0 0000261F F3A4 REP MOVSB ; Put the search continuation info 286 ; in the right place 0 00002621 161F Context DS ; get ready for search 0 00002623 FF36[0000]FF36 SaveReg <, > 0 00002629 [0200] 0 0000262B C706[0000][0000] MOV WORD PTR [DMAAdd],OFFSET SEARCHBUF wrt DOSGroup 0 00002631 8C1E[0200] MOV WORD PTR [DMAAdd+2],DS 0 00002635 E8[0000] invoke DOS_SEARCH_NEXT ; Find it 0 00002638 8F06[0200]8F06 RestoreReg <, > 0 0000263E [0000] 0 00002640 73AF JNC FindSet ; No error, set info 0 00002642 EBAB transfer Sys_Ret_Err 295 296 EndProc D_FIND_NEXT 297 298 Break 299 ; 300 ; PackName - transfer a file name from DS:SI to ES:DI and convert it to 301 ; the ASCIZ format. 302 ; 303 ; Input: DS:SI points to an 11 character FCB or dir entry name 304 ; ES:DI points to a destination area (13 bytes) 305 ; Output: Above pointers advanced 306 ; Registers modified: SI,DI,CX,AL 307 Procedure PackName,NEAR 307 ****************** warning: proc PackName... [-w+user] 308 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00002644 B90800 MOV CX,8 ; Pack the name 0 00002647 F3A4 REP MOVSB ; Move all of it 311 main_kill_tail: 0 00002649 26807DFF20 CMP BYTE PTR [ES:DI-1]," " 0 0000264E 7507 JNZ find_check_dot 0 00002650 4F DEC DI ; Back up over trailing space 0 00002651 41 INC CX 0 00002652 83F908 CMP CX,8 0 00002655 72F2 JB main_kill_tail 318 find_check_dot: 0 00002657 813C2020 CMP WORD PTR [SI],(" " << 8) | " " 0 0000265B 7506 JNZ got_ext ; Some chars in extension 0 0000265D 807C0220 CMP BYTE PTR [SI+2]," " 0 00002661 7412 JZ find_done ; No extension 323 got_ext: 0 00002663 B02E MOV AL,"." 0 00002665 AA STOSB 0 00002666 B90300 MOV CX,3 0 00002669 F3A4 REP MOVSB 328 ext_kill_tail: 0 0000266B 26807DFF20 CMP BYTE PTR [ES:DI-1]," " 0 00002670 7503 JNZ find_done 0 00002672 4F DEC DI ; Back up over trailing space 0 00002673 EBF6 JMP ext_kill_tail 333 find_done: 0 00002675 31C0 XOR AX,AX 0 00002677 AA STOSB ; NUL terminate 0 00002678 C3 return 337 EndProc PackName 338 339 procedure GET_FAST_SEARCH,NEAR 339 ****************** warning: proc GET_FAST_SEARCH... [-w+user] 340 ASSUME DS:NOTHING,ES:NOTHING 341 0 00002679 36810E[0000]0004 OR word [ss:DOS34_FLAG],SEARCH_FASTOPEN ;FO.trigger fastopen ;AN000; 0 00002680 E8[0000] invoke DOS_SEARCH_FIRST 0 00002683 C3 return 345 346 EndProc GET_FAST_SEARCH 347 END === Trace listing source: ../DOS/path.lst 1 ; SCCSID = @(#)path.asm 1.1 85/04/10 2 ;TITLE PATH - Directory related system calls 3 ;NAME PATH 4 5 ; 6 ; Directory related system calls. These will be passed direct text of the 7 ; pathname from the user. They will need to be passed through the macro 8 ; expander prior to being sent through the low-level stuff. I/O specs are 9 ; defined in DISPATCH. The system calls are: 10 ; 11 ; $CURRENT_DIR Written 12 ; $RMDIR Written 13 ; $CHDIR Written 14 ; $MKDIR Written 15 ; 16 ; 17 ; Modification history: 18 ; 19 ; Created: ARR 4 April 1983 20 ; MZ 10 May 1983 CurrentDir implemented 21 ; MZ 11 May 1983 RmDir, ChDir, MkDir implemented 22 ; EE 19 Oct 1983 RmDir no longer allows you to delete a 23 ; current directory. 24 ; MZ 19 Jan 1983 Brain damaged applications rely on success 25 ; values of AL. 26 [list -] 26 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 31 32 [list +] === Switch to base=002450h -> "DOSCODECODE" 33 section DOSCODECODE 34 [list -] 34 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 34 ****************** warning: out: BPB.INC... [-w+user] 34 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 34 ****************** warning: out: DEVSYM.INC... [-w+user] 41 42 EXTRN DOS_MkDir:NEAR,DOS_RmDir:NEAR 43 44 I_Need ThisCDS,DWORD ; pointer to Current CDS 45 I_Need WFP_Start,WORD ; pointer to beginning of directory text 46 I_Need Curr_Dir_End,WORD ; offset to end of directory part 47 I_Need OpenBuf,128 ; temp spot for translated name 48 I_need fSplice,BYTE ; TRUE => do splice 49 I_Need NoSetDir,BYTE ; TRUE => no exact match on splice 50 I_Need cMeta,BYTE 51 I_Need DrvErr,BYTE ;AN000; 52 53 BREAK <$CURRENT_DIR - dump the current directory into user space> 54 ; 55 ; Assembler usage: 56 ; LDS SI,area 57 ; MOV DL,drive 58 ; INT 21h 59 ; ; DS:SI is a pointer to 64 byte area that contains drive 60 ; ; current directory. 61 ; Error returns: 62 ; AX = error_invalid_drive 63 ; 64 65 procedure D_CURRENT_DIR,NEAR 65 ****************** warning: proc D_CURRENT_DIR... [-w+user] 66 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00002684 E8[0000] EnterCrit critDisk 0 00002687 88D0 MOV AL,DL ; get drive number (0=def, 1=A) 0 00002689 E8[0000] Invoke GetVisDrv ; grab it 0 0000268C 730A JNC CurrentValidate ; no error -> go and validate dir 71 CurdirErr: 0 0000268E E8[0000] LeaveCrit critDisk 0 00002691 36A0[0000] MOV AL,[ss:DrvErr] ;IFS. ;AN000; 0 00002695 E9[0000] transfer SYS_RET_ERR ;IFS. make noise ;AN000; 75 CurrentValidate: 0 00002698 1E56 SaveReg ; save destination 0 0000269A 36C536[0000] LDS SI,[ss:ThisCDS] 0 0000269F F744430080 TEST word [SI + curdir_flags],curdir_isnet 0 000026A4 7500 JNZ DoCheck 80 ; Random optimization nuked due to some utilities using GetCurrentDir to do 81 ; media check. 82 ; CMP [SI].curdir_id,0 83 ; JZ GetDst 84 DoCheck: 0 000026A6 36C606[0000]00 MOV byte [ss:NoSetDir],0 ; interested only in contents 86 DOSGroup equ DOSGROUP ; NASM port equate 0 000026AC BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup 0 000026AF E8[0000] Invoke ValidateCDS ; output is ES:DI -> CDS 0 000026B2 0657 SaveReg ; swap source and destination 0 000026B4 5E1F RestoreReg 91 GetDst: 0 000026B6 5F07 RestoreReg ; get real destination 0 000026B8 72D4 JC CurdirErr 0 000026BA 83C600 ADD SI,curdir_text 95 curdir_END equ curdir_end ; NASM port equate 0 000026BD 03744F ADD SI,[SI + curdir_END] 0 000026C0 803C5C CMP BYTE PTR [SI],'\' ; root or subdirs present? 0 000026C3 7501 JNZ CurrentCopy 0 000026C5 46 INC SI 100 CurrentCopy: 101 ; Invoke FStrCpy 102 ;; 10/29/86 E5 char 0 000026C6 50 PUSH AX 0 000026C7 AC LODSB ; get char 0 000026C8 08C0 OR AL,AL 0 000026CA 7414 JZ FOK 0 000026CC 3C05 CMP AL,05 0 000026CE 740E JZ FCHANGE 0 000026D0 EB02 JMP FFF 0 000026D2 90 nop ; identicalise 111 FCPYNEXT: 0 000026D3 AC LODSB ; get char 113 FFF: 0 000026D4 3C5C CMP AL,'\' ; beginning of directory 0 000026D6 7508 JNZ FOK ; no 0 000026D8 AA STOSB ; put into user's buffer 0 000026D9 AC LODSB ; 1st char of dir is 05? 0 000026DA 3C05 CMP AL,05H 0 000026DC 7502 JNZ FOK ; no 120 FCHANGE: 0 000026DE B0E5 MOV AL,0E5H ; make it E5 122 FOK: 0 000026E0 AA STOSB ; put into user's buffer 0 000026E1 08C0 OR AL,AL ; final char 0 000026E3 75EE JNZ FCPYNEXT ; no 0 000026E5 58 POP AX 127 128 ;; 10/29/86 E5 char 0 000026E6 30C0 xor AL,AL ; MZ 19 Jan 84 0 000026E8 E8[0000] LeaveCrit critDisk 0 000026EB E9[0000] transfer Sys_Ret_OK ; no more, bye! 132 EndProc D_Current_Dir 133 134 BREAK <$RmDir -- Remove a directory> 135 136 ; Inputs: 137 ; DS:DX Points to asciz name 138 ; Function: 139 ; Delete directory if empty 140 ; Returns: 141 ; STD XENIX Return 142 ; AX = error_path_not_found If path bad 143 ; AX = error_access_denied If 144 ; Directory not empty 145 ; Path not directory 146 ; Root directory specified 147 ; Directory malformed (. and .. not first two entries) 148 ; User tries to delete a current directory 149 ; AX = error_current_directory 150 151 procedure D_RMDIR,NEAR 151 ****************** warning: proc D_RMDIR... [-w+user] 152 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 153 0 000026EE 52 push dx ; Save ptr to name 0 000026EF 1E push ds 0 000026F0 89D6 mov si,dx ; Load ptr into si 0 000026F2 BF[0000] mov di,offset OpenBuf wrt DOSGroup ; di = ptr to buf for trans name 0 000026F5 57 push di 0 000026F6 E8[0000] Invoke TransPathNoSet ; Translate the name 0 000026F9 5F pop di ; di = ptr to buf for trans name 0 000026FA 7306 jnc rmlset ; If transpath succeeded, continue 0 000026FC 1F pop ds 163 assume ds:nothing 0 000026FD 5A pop dx ; Restore the name 0 000026FE B003EB93 error error_path_not_found ; Otherwise, return an error 166 167 rmlset: 0 00002702 36803E[0000]FF CMP byte [ss:cMeta],-1 ; if (cMeta >= 0) 0 00002708 7512 Jnz rmerr ; return (-1); 0 0000270A 1607 Context ES 0 0000270C 30C0 xor al,al ; al = 0 , ie drive a: 0 0000270E E8[0000] rmloop: Invoke GetCDSFromDrv ; Get curdir for drive in al 0 00002711 720F jc rmcont ; If error, exit loop & cont normally 0 00002713 E8[0000] Invoke StrCmp ; Are the 2 paths the same? 0 00002716 7404 jz rmerr ; Yes, report error. 0 00002718 FEC0 inc al ; No, inc al to next drive number 0 0000271A EBF2 jmp rmloop ; Go check next drive. 178 179 rmerr: 0 0000271C 1F pop ds 181 assume ds:nothing 0 0000271D 5A pop dx ; Restore the name 0 0000271E B010EBDE error error_current_directory ; error 184 185 rmcont: 0 00002722 1F pop ds 187 assume ds:nothing 0 00002723 5A pop dx ; Restore the name 189 DOS_RmDIR equ DOS_RmDir ; NASM port label 0 00002724 BE[0000] MOV SI,OFFSET DOS_RmDIR 0 00002727 E97F00 JMP strict near DoDirCall 192 EndProc D_RMDIR 193 194 BREAK <$ChDir -- Change current directory on a drive> 195 196 ; 197 ; $ChDir - Top-level change directory system call. This call is responsible 198 ; for setting up the CDS for the specified drive appropriately. There are 199 ; several cases to consider: 200 ; 201 ; o Local, simple CDS. In this case, we take the input path and convert 202 ; it into a WFP. We verify the existance of this directory and then 203 ; copy the WFP into the CDS and set up the ID field to point to the 204 ; directory cluster. 205 ; o Net CDS. We form the path from the root (including network prefix) 206 ; and verify its existance (via DOS_Chdir). If successful, we copy the 207 ; WFP back into the CDS. 208 ; o SUBST'ed CDS. This is no different than the local, simple CDS. 209 ; o JOIN'ed CDS. This is trouble as there are two CDS's at work. If we 210 ; call TransPath, we will get the PHYSICAL CDS that the path refers to 211 ; and the PHYSICAL WFP that the input path refers to. This is perfectly 212 ; good for the validation but not for currency. We call TransPathNoSet 213 ; to process the path but to return the logical CDS and the logical 214 ; path. We then copy the logical path into the logical CDS. 215 ; 216 ; Inputs: 217 ; DS:DX Points to asciz name 218 ; Returns: 219 ; STD XENIX Return 220 ; AX = chdir_path_not_found if error 221 222 procedure D_CHDIR,NEAR 222 ****************** warning: proc D_CHDIR... [-w+user] 223 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000272A BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; spot for translated name 0 0000272D 89D6 MOV SI,DX ; get source 0 0000272F E8[0000] Invoke TransPath ; go munge the path and get real CDS 0 00002732 7304 JNC ChDirCrack ; no errors, try path 228 ChDirErrP: 0 00002734 B003 MOV AL,error_path_not_found 230 ChdirErr: 0 00002736 EBE8 transfer SYS_Ret_Err ; oops! 232 233 ChDirCrack: 234 Assume DS:DOSGroup 0 00002738 803E[0000]FF CMP byte [cMeta],-1 ; No meta chars allowed. 0 0000273D 75F5 JNZ ChDirErrP 237 ; 238 ; We cannot do a ChDir (yet) on a raw CDS. This is treated as a path not 239 ; found. 240 ; 0 0000273F C43E[0000] LES DI,[ThisCDS] 0 00002743 83FFFF CMP DI,-1 ; if (ThisCDS == NULL) 0 00002746 74EC JZ ChDirErrP ; error (); 244 ; 245 ; Find out if the directory exists. 246 ; 0 00002748 E8[0000] Invoke DOS_ChDir 248 ChDirErr equ ChdirErr ; NASM port label 0 0000274B 72E9 JC ChDirErr 250 ; 251 ; Get back CDS to see if a join as seen. Set the currency pointer (only if 252 ; not network). If one was seen, all we need to do is copy in the text 253 ; 0 0000274D C43E[0000] LES DI,[ThisCDS] 0 00002751 26F745430020 TEST word [ES:DI + curdir_flags],curdir_splice 0 00002757 7425 JZ GotCDS 257 ; 258 ; The CDS was joined. Let's go back and grab the logical CDS. 259 ; 0 00002759 065751 SaveReg ; save CDS and cluster... 0 0000275C E8[0000] Invoke Get_User_Stack ; get original text 262 ASSUME DS:NOTHING 263 User_DX equ user_DX ; NASM port equate 0 0000275F 8B7C06 MOV DI,[SI + User_DX] 265 User_DS equ user_DS ; NASM port equate 0 00002762 8E5C0E MOV DS,[SI + User_DS] 267 assume ds:nothing 0 00002765 BE[0000] MOV SI,OFFSET OpenBuf wrt DOSGroup ; spot for translated name 0 00002768 87F7 XCHG SI,DI 0 0000276A 30C0 XOR AL,AL ; do no splicing 0 0000276C 57 SaveReg 0 0000276D E8[0000] Invoke TransPathNoSet ; Munge path 0 00002770 5E RestoreReg 274 Assume DS:DOSGroup 275 ; 276 ; There should NEVER be an error here. 277 ; 278 %IF FALSE 279 SKipErr equ SkipErr ; NASM port label 280 JNC SKipErr 281 fmt <>,<>,<"$p: Internal CHDIR error\n"> 282 SkipErr: 283 %ENDIF 0 00002771 C43E[0000] LES DI,[ThisCDS] ; get new CDS 0 00002775 26C74549FFFF MOV word [ES:DI + curdir_ID],-1 ; no valid cluster here... 0 0000277B 595F07 RestoreReg 287 ; 288 ; ES:DI point to the physical CDS, CX is the ID (local only) 289 ; 290 GotCDS: 291 ; 292 ; wfp_start points to the text. See if it is long enough 293 ; 0 0000277E E85200 CALL Check_PathLen ;PTM. ;AN000; 0 00002781 77B1 JA ChDirErrP 0 00002783 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 00002789 7513 JNZ SkipRecency 0 0000278B 26F745430020 TEST word [ES:DI + curdir_flags],curdir_splice ;PTM. for Join and Subst ;AN000; 0 00002791 7403 JZ setdirclus ;PTM. ;AN000; 0 00002793 B9FFFF MOV CX,-1 ;PTM. ;AN000; 301 setdirclus: 302 curdir_id equ curdir_ID ; NASM port equate 0 00002796 26894D49 MOV [ES:DI + curdir_id],CX 0 0000279A C43E[0000] LES DI,[ThisCDS] ; get logical CDS 305 SkipRecency: 0 0000279E E8[0000] invoke FStrCpy 0 000027A1 30C0 XOR AL,AL 0 000027A3 E9[0000] transfer Sys_Ret_OK 309 EndProc D_CHDIR 310 311 BREAK <$MkDir - Make a directory entry> 312 ; Inputs: 313 ; DS:DX Points to asciz name 314 ; Function: 315 ; Make a new directory 316 ; Returns: 317 ; STD XENIX Return 318 ; AX = mkdir_path_not_found if path bad 319 ; AX = mkdir_access_denied If 320 ; Directory cannot be created 321 ; Node already exists 322 ; Device name given 323 ; Disk or directory(root) full 324 325 procedure D_MKDIR,NEAR 325 ****************** warning: proc D_MKDIR... [-w+user] 326 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000027A6 BE[0000] MOV SI,OFFSET DOS_MkDir 328 DoDirCall: 0 000027A9 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; spot for translated name 0 000027AC 56 SaveReg 0 000027AD 89D6 MOV SI,DX ; get source 0 000027AF E8[0000] Invoke TransPath ; go munge the path 0 000027B2 5E RestoreReg 0 000027B3 7305 JNC MkDirCrack ; no errors, try path 335 MkErrP: 336 error_Path_Not_Found equ error_path_not_found ; NASM port equate 0 000027B5 B003 MOV AL,error_Path_Not_Found ; oops! 338 MkErr: 0 000027B7 E9[0000] transfer Sys_Ret_Err 340 MkDirCrack: 0 000027BA 36803E[0000]FF CMP byte [ss:cMeta],-1 0 000027C0 75F3 JNZ MkErrP 343 0 000027C2 56 PUSH SI ;PTM. ;AN000; 0 000027C3 E80D00 CALL Check_PathLen ;PTM. check path len > 67 ? ;AN000; 0 000027C6 5E POP SI ;PTM. ;AN000; 0 000027C7 7604 JBE pathok ;PTM. ;AN000; 348 error_Access_Denied equ error_access_denied ; NASM port equate 0 000027C9 B005 MOV AL,error_Access_Denied ;PTM. ops! 0 000027CB EBEA transfer Sys_Ret_Err ;PTM. 351 pathok: 0 000027CD FFD6 CALL SI ; go get file 353 ASSUME ES:NOTHING 0 000027CF 72E6 JC MkErr ; no errors 0 000027D1 EBD0 transfer Sys_Ret_OK 356 EndProc D_MKDIR 357 358 ; Inputs: 359 ; nothing 360 ; Function: 361 ; check if final path length greater than 67 362 ; Returns: 363 ; Above flag set if > 67 364 365 procedure Check_PathLen,NEAR 365 ****************** warning: proc Check_PathLen... [-w+user] 366 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 367 368 Wfp_Start equ WFP_Start ; NASM port label 0 000027D3 368B36[0000] MOV SI,[ss:Wfp_Start] 370 entry Check_PathLen2 0 000027D8 161F Context 0 000027DA 51 SaveReg 0 000027DB E8[0000] invoke DStrLen 374 DirStrLen equ DIRSTRLEN ; NASM port equate 0 000027DE 83F943 CMP CX,DirStrLen 0 000027E1 59 RestoreReg 0 000027E2 C3 ret 378 EndProc Check_PathLen 379 END 380 381 === Trace listing source: ../DOS/ioctl.lst 1 ; SCCSID = @(#)IOCTL.INC 1.15 85/09/05 2 ;TITLE IOCTL - IOCTL system call 3 ;NAME IOCTL 4 5 ; 6 ; 7 ; IOCTL system call. 8 ; 9 ; 10 ; $IOCTL 11 ; 12 ; Revision history: 13 ; 14 ; Created: ARR 4 April 1983 15 ; 16 ; GenericIOCTL added: KGS 22 April 1985 17 ; 18 ; A000 version 4.00 Jan. 1988 19 20 21 22 [list -] 22 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 27 28 [list +] === Switch to base=002450h -> "DOSCODECODE" 29 section DOSCODECODE 30 [list -] 30 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 30 ****************** warning: out: BPB.INC... [-w+user] 30 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 30 ****************** warning: out: DEVSYM.INC... [-w+user] 30 ****************** warning: out: IOCTL.INC... [-w+user] 30 ****************** warning: out: BPB.INC... [-w+user] 39 40 i_need THISCDS,DWORD 41 i_need IOCALL,BYTE 42 i_need IOMED,BYTE 43 i_need IOSCNT,WORD 44 i_need IOXAD,DWORD 45 I_need RetryCount,WORD 46 I_need RetryLoop,WORD 47 I_need EXTERR_LOCUS,BYTE 48 I_need OPENBUF,BYTE 49 I_need ExtErr,WORD 50 I_need DrvErr,BYTE 51 I_need USER_IN_AX,WORD ;AN000; 52 I_need Temp_Var2,WORD ;AN000; 53 54 assume nocheck, ss:DOSGROUP 55 56 BREAK 57 58 ; 59 ; Assembler usage: 60 ; MOV BX, Handle 61 ; MOV DX, Data 62 ; 63 ; (or LDS DX,BUF 64 ; MOV CX,COUNT) 65 ; 66 ; MOV AH, Ioctl 67 ; MOV AL, Request 68 ; INT 21h 69 ; 70 ; AH = 0 Return a combination of low byte of sf_flags and device driver 71 ; attribute word in DX, handle in BX: 72 ; DH = high word of device driver attributes 73 ; DL = low byte of sf_flags 74 ; 1 Set the bits contained in DX to sf_flags. DH MUST be 0. Handle 75 ; in BX. 76 ; 2 Read CX bytes from the device control channel for handle in BX 77 ; into DS:DX. Return number read in AX. 78 ; 3 Write CX bytes to the device control channel for handle in BX from 79 ; DS:DX. Return bytes written in AX. 80 ; 4 Read CX bytes from the device control channel for drive in BX 81 ; into DS:DX. Return number read in AX. 82 ; 5 Write CX bytes to the device control channel for drive in BX from 83 ; DS:DX. Return bytes written in AX. 84 ; 6 Return input status of handle in BX. If a read will go to the 85 ; device, AL = 0FFh, otherwise 0. 86 ; 7 Return output status of handle in BX. If a write will go to the 87 ; device, AL = 0FFh, otherwise 0. 88 ; 8 Given a drive in BX, return 1 if the device contains non- 89 ; removable media, 0 otherwise. 90 ; 9 Return the contents of the device attribute word in DX for the 91 ; drive in BX. 0200h is the bit for shared. 1000h is the bit for 92 ; network. 8000h is the bit for local use. 93 ; A Return 8000h if the handle in BX is for the network or not. 94 ; B Change the retry delay and the retry count for the system. BX is 95 ; the count and CX is the delay. 96 ; 97 ; Error returns: 98 ; AX = error_invalid_handle 99 ; = error_invalid_function 100 ; = error_invalid_data 101 ; 102 ;------------------------------------------------------------------------------- 103 ; 104 ; This is the documentation copied from DOS 4.0 it is much better 105 ; than the above 106 ; 107 ; There are several basic forms of IOCTL calls: 108 ; 109 ; 110 ; ** Get/Set device information: ** 111 ; 112 ; ENTRY (AL) = function code 113 ; 0 - Get device information 114 ; 1 - Set device information 115 ; (BX) = file handle 116 ; (DX) = info for "Set Device Information" 117 ; EXIT 'C' set if error 118 ; (AX) = error code 119 ; 'C' clear if OK 120 ; (DX) = info for "Get Device Information" 121 ; USES ALL 122 ; 123 ; 124 ; ** Read/Write Control Data From/To Handle ** 125 ; 126 ; ENTRY (AL) = function code 127 ; 2 - Read device control info 128 ; 3 - Write device control info 129 ; (BX) = file handle 130 ; (CX) = transfer count 131 ; (DS:DX) = address for data 132 ; EXIT 'C' set if error 133 ; (AX) = error code 134 ; 'C' clear if OK 135 ; (AX) = count of bytes transfered 136 ; USES ALL 137 ; 138 ; 139 ; ** Read/Write Control Data From/To Block Device ** 140 ; 141 ; ENTRY (AL) = function code 142 ; 4 - Read device control info 143 ; 5 - Write device control info 144 ; (BL) = Drive number (0=default, 1='A', 2='B', etc) 145 ; (CX) = transfer count 146 ; (DS:DX) = address for data 147 ; EXIT 'C' set if error 148 ; (AX) = error code 149 ; 'C' clear if OK 150 ; (AX) = count of bytes transfered 151 ; USES ALL 152 ; 153 ; 154 ; ** Get Input/Output Status ** 155 ; 156 ; ENTRY (AL) = function code 157 ; 6 - Get Input status 158 ; 7 - Get Output Status 159 ; (BX) = file handle 160 ; EXIT 'C' set if error 161 ; (AX) = error code 162 ; 'C' clear if OK 163 ; (AL) = 00 if not ready 164 ; (AL) = FF if ready 165 ; USES ALL 166 ; 167 ; 168 ; ** Get Drive Information ** 169 ; 170 ; ENTRY (AL) = function code 171 ; 8 - Check for removable media 172 ; 9 - Get device attributes 173 ; (BL) = Drive number (0=default, 1='A', 2='B', etc) 174 ; EXIT 'C' set if error 175 ; (AX) = error code 176 ; 'C' clear if OK 177 ; (AX) = 0/1 media is removable/fixed (func. 8) 178 ; (DX) = device attribute word (func. 9) 179 ; USES ALL 180 ; 181 ; 182 ; ** Get Redirected bit ** 183 ; 184 ; ENTRY (AL) = function code 185 ; 0Ah - Network stuff 186 ; (BX) = file handle 187 ; EXIT 'C' set if error 188 ; (AX) = error code 189 ; 'C' clear if OK 190 ; (DX) = SFT flags word, 8000h set if network file 191 ; USES ALL 192 ; 193 ; 194 ; ** Change sharer retry parameters ** 195 ; 196 ; ENTRY (AL) = function code 197 ; 0Bh - Set retry parameters 198 ; (CX) = retry loop count 199 ; (DX) = number of retries 200 ; EXIT 'C' set if error 201 ; (AX) = error code 202 ; 'C' clear if OK 203 ; USES ALL 204 ; 205 ; 206 ; ================================================================= 207 ; 208 ; ** New Standard Control ** 209 ; 210 ; ALL NEW IOCTL FACILITIES SHOULD USE THIS FORM. THE OTHER 211 ; FORMS ARE OBSOLETE. 212 ; 213 ; ================================================================= 214 ; 215 ; ENTRY (AL) = function code 216 ; 0Ch - Control Function subcode 217 ; (BX) = File Handle 218 ; (CH) = Category Indicator 219 ; (CL) = Function within category 220 ; (DS:DX) = address for data, if any 221 ; (SI) = Passed to device as argument, use depends upon function 222 ; (DI) = Passed to device as argument, use depends upon function 223 ; EXIT 'C' set if error 224 ; (AX) = error code 225 ; 'C' clear if OK 226 ; (SI) = Return value, meaning is function dependent 227 ; (DI) = Return value, meaning is function dependent 228 ; (DS:DX) = Return address, use is function dependent 229 ; USES ALL 230 ; 231 ; ============== Generic IOCTL Definitions for DOS 3.2 ============ 232 ; (See dos/ioctl.mac for more info) 233 ; 234 ; ENTRY (AL) = function code 235 ; 0Dh - Control Function subcode 236 ; (BL) = Drive Number (0 = Default, 1= 'A') 237 ; (CH) = Category Indicator 238 ; (CL) = Function within category 239 ; (DS:DX) = address for data, if any 240 ; (SI) = Passed to device as argument, use depends upon function 241 ; (DI) = Passed to device as argument, use depends upon function 242 ; 243 ; EXIT 'C' set if error 244 ; (AX) = error code 245 ; 'C' clear if OK 246 ; (DS:DX) = Return address, use is function dependent 247 ; USES ALL 248 ; 249 250 procedure D_IOCTL,NEAR 250 ****************** warning: proc D_IOCTL... [-w+user] 251 ASSUME DS:NOTHING,ES:NOTHING 0 000027E3 8CDE MOV SI,DS ; Stash DS for calls 2,3,4 and 5 0 000027E5 161F context DS 0 000027E7 3C03 CMP AL,3 0 000027E9 7603 JBE ioctl_check_char ; char device 0 000027EB E98400 JMP ioctl_check_block ; Block device 257 ioctl_check_char: 0 000027EE E8[0000] invoke SFFromHandle ; ES:DI -> SFT 0 000027F1 7305 JNC ioctl_check_permissions ; have valid handle 260 ioctl_bad_handle: 0 000027F3 B006E9[0000] error error_invalid_handle 262 263 ioctl_check_permissions: 0 000027F8 3C02 CMP AL,2 0 000027FA 734F JAE ioctl_control_string 0 000027FC 3C00 CMP AL,0 0 000027FE 268A4505 MOV AL,BYTE PTR [ES:DI + sf_flags]; Get low byte of flags 0 00002802 7425 JZ ioctl_read ; read the byte 0 00002804 52 PUSH DX ;AN000;MS. 0 00002805 80E6FE AND DH,0FEH ;AN000;MS.allow DH=01H 0 00002808 5A POP DX ;AN000;MS. 0 00002809 7407 JZ ioctl_check_device ; can I set with this data? 0 0000280B B00DEBE6 error error_invalid_data ; no DH <> 0 274 275 ioctl_bad_funj2: 0 0000280F E98C01 JMP ioctl_bad_fun 277 278 ioctl_check_device: 0 00002812 A880 TEST AL,devid_device ; can I set this handle? 0 00002814 740C JZ do_exception ; no, it is a file. 0 00002816 80CA80 OR DL,devid_device ; Make sure user doesn't turn off the 282 ; device bit!! He can muck with the 283 ; others at will. 0 00002819 C606[0000]04 MOV byte [EXTERR_LOCUS],errLOC_SerDev 0 0000281E 26885505 MOV BYTE PTR [ES:DI + sf_flags],DL ;AC000;MS.; Set flags 286 do_exception: 0 00002822 26087506 OR BYTE PTR [ES:DI + sf_flags+1],DH;AN000;MS.;set 100H bit for disk full 288 0 00002826 E9[0000] transfer SYS_RET_OK 290 291 292 ioctl_read: 0 00002829 C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 0000282E 30E4 XOR AH,AH 0 00002830 A880 TEST AL,devid_device ; Should I set high byte 0 00002832 740D JZ ioctl_no_high ; no 0 00002834 C606[0000]04 MOV byte [EXTERR_LOCUS],errLOC_SerDev 0 00002839 26C47D07 LES DI,[ES:DI + sf_devptr] ; Get device pointer 0 0000283D 268A6505 MOV AH,BYTE PTR [ES:DI + SDEVATT+1] ; Get high byte 300 ioctl_no_high: 0 00002841 89C2 MOV DX,AX 0 00002843 E8[0000] invoke get_user_stack 0 00002846 895406 MOV [SI + user_DX],DX 0 00002849 EBDB transfer SYS_RET_OK 305 306 ioctl_control_string: 0 0000284B 26F745058000 TEST word [ES:DI + sf_flags],devid_device ; can I? 0 00002851 7503 JNZ ioctl_ctl_str_1 0 00002853 E94801 JMP ioctl_bad_fun ; No it is a file 310 ioctl_ctl_str_1: 0 00002856 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet ;AN000;IFS.; IFS ? 0 0000285C 7403 JZ localrw ;AN000;IFS.; no 0 0000285E E9C700 JMP callifs ;AN000;IFS.; call IFS 314 localrw: 0 00002861 C606[0000]04 MOV byte [EXTERR_LOCUS],errLOC_SerDev 0 00002866 26C47D07 LES DI,[ES:DI + sf_devptr] ; Get device pointer 0 0000286A 30DB XOR BL,BL ; Unit number of char dev = 0 0 0000286C E9DF01 JMP ioctl_do_string 319 320 ioctl_get_devj: 0 0000286F E9D701 JMP ioctl_get_dev 322 323 ioctl_check_block: 0 00002872 FEC8 DEC AL 0 00002874 FEC8 DEC AL ; 4=2,5=3,6=4,7=5,8=6,9=7,10=8,11=9 0 00002876 3C03 CMP AL,3 0 00002878 76F5 JBE ioctl_get_devj 0 0000287A 3C06 CMP AL,6 0 0000287C 731F JAE ioctl_rem_media_check 330 0 0000287E B401 MOV AH,1 0 00002880 2C04 SUB AL,4 ; 6=0,7=1 0 00002882 7402 JZ ioctl_get_status 0 00002884 B403 MOV AH,3 335 ioctl_get_status: 0 00002886 50 PUSH AX 0 00002887 E8[0000] invoke GET_IO_SFT 0 0000288A 58 POP AX 0 0000288B 7303 JNC DO_IOFUNC 0 0000288D E963FF JMP ioctl_bad_handle ; invalid SFT 341 342 DO_IOFUNC: 0 00002890 E8[0000] invoke IOFUNC 0 00002893 88C4 MOV AH,AL 0 00002895 B0FF MOV AL,0FFH 0 00002897 7502 JNZ ioctl_status_ret 0 00002899 FEC0 INC AL 348 ioctl_status_ret: 0 0000289B EBAC transfer SYS_RET_OK 350 351 ioctl_rem_media_check: ; 4=2,5=3,6=4,7=5,8=6,9=7,10=8,11=9 0 0000289D 7407 JE ioctl_rem_mediaj 353 0 0000289F 2C07 SUB AL,7 ; 9=0,10=1,11=2,12=3,13=4,14=5,15=6 0 000028A1 7509 JNZ Rem_med_chk_1 0 000028A3 E93E01 JMP Ioctl_Drive_attr 357 358 ioctl_rem_mediaj: 0 000028A6 E9FD00 jmp ioctl_rem_media 360 361 ioctl_bad_funj4: 0 000028A9 E9F200 jmp ioctl_bad_fun 363 364 Rem_med_chk_1: 365 0 000028AC FEC8 DEC AL ; 10=0,11=1,12=2,13=3,14=4,15=5 0 000028AE 7503 jnz Set_Retry_chk 368 Ioctl_Handle_redirj equ IOCtl_Handle_RedirJ ; NASM port label 0 000028B0 E9E800 Jmp Ioctl_Handle_redirj 370 371 Set_Retry_chk: 0 000028B3 FEC8 DEC AL ; 11=0,12=1,13=2,14=3,15=4 0 000028B5 7415 JZ Set_Retry_Parameters 374 0 000028B7 FEC8 DEC AL ; 12=0,13=1,14=2,15=3 0 000028B9 7422 JZ GENERICIOCTLHANDLE 377 0 000028BB FEC8 DEC AL ; 13=0,14=1,15=2 0 000028BD 7440 JZ GENERICIOCTL 380 ; 14/0Eh = 1, 15/0Fh = 2, 16/10h = 3, 17/11h = 4 381 0 000028BF 3C04 CMP AL,4 0 000028C1 77E6 JA ioctl_bad_funj4 0 000028C3 3C03 cmp al, 3 0 000028C5 7738 ja GENERICIOCTL 0 000028C7 7414 je GENERICIOCTLHANDLE 0 000028C9 E94502 JMP ioctl_drive_owner 388 Set_Retry_Parameters: 0 000028CC 890E[0000] MOV [RetryLoop],CX ; 0 retry loop count allowed 0 000028D0 09D2 OR DX,DX ; zero retries not allowed 0 000028D2 7503 JNZ goodtr 392 IoCtl_Bad_Fun equ ioctl_bad_fun ; NASM port label 0 000028D4 E9C700 JMP IoCtl_Bad_Fun 394 goodtr: 0 000028D7 8916[0000] MOV [RetryCount],DX ; Set new retry count 396 doneok: 0 000028DB EBBE transfer Sys_Ret_Ok ; Done 398 399 ; Generic IOCTL entry point. 400 ; here we invoke the Generic IOCTL using the IOCTL_Req structure. 401 ; SI:DX -> Users Device Parameter Table 402 ; IOCALL -> IOCTL_Req structure 403 ; INP: al = nonzero for query only (4410h) 404 GENERICIOCTLHANDLE: 0 000028DD E8[0000] invoke SFFromHandle ; Get SFT for device. 0 000028E0 7303 jnc goodh 0 000028E2 E9BE00 JMP ioctl_bad_handlej 408 goodh: 409 ; test word ptr [DI.sf_flags],sf_isnet 0 000028E5 E87202 CALL TEST_IFS_REMOTE ;AN000;;IFS. test if remote 0 000028E8 7403 JZ okokok ;AN000;;IFS. 0 000028EA E9B100 jmp ioctl_bad_fun ; Cannot do this over net. 413 okokok: 0 000028ED F745050080 TEST word [DI + sf_flags],sf_isnet ;AN000;IFS.; local IFS 0 000028F2 7530 JNZ callifs_no_query ;AN000;IFS.; yes 416 417 ErrLOC_Serdev equ errLOC_SerDev ; NASM port equate 0 000028F4 C606[0000]04 mov byte [EXTERR_LOCUS],ErrLOC_Serdev 0 000028F9 26C47D07 les di,[es:di + sf_devptr] ; Get pointer to device. 0 000028FD EB49 jmp short Do_GenIOCTL 421 422 GENERICIOCTL: 423 ; INP: al = nonzero for query only (4411h) 424 ErrLOC_Disk equ errLOC_Disk ; NASM port equate 0 000028FF C606[0000]02 mov byte [EXTERR_LOCUS],ErrLOC_Disk 0 00002904 80FD08 cmp ch,IOC_DC ; Only disk devices are allowed to use 0 00002907 7403E99200 jne ioctl_bad_fun ; no handles with Generic IOCTL. 0 0000290C E8D901 CALL Check_If_Net ; ES:DI := Get_hdr_block of device in BL 429 assume es:nothing 0 0000290F 7403E98A00 JNZ ioctl_bad_fun ; There are no "net devices", and they 431 assume es:nothing ; device header 0 00002914 06 PUSH ES ; certainly don't know how to do this ;AN000; 0 00002915 57 PUSH DI ;AN000;IFS. 0 00002916 C43E[0000] LES DI,[THISCDS] ;AN000;IFS. ; 435 assume es:nothing 0 0000291A 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet;AN000;IFS. ; local IFS ? 0 00002920 5F POP DI ;AN000;IFS. 0 00002921 07 POP ES ;AN000;IFS. 439 assume es:nothing 0 00002922 7424 JZ Do_GenIOCTL ;AN000;IFS. ; no 441 callifs_no_query: 0 00002924 84C0 test al, al 0 00002926 7576 jnz ioctl_bad_fun 444 callifs: 445 User_In_AX equ USER_IN_AX ; NASM port label 0 00002928 803E[0100]69 CMP byte ptr [User_In_AX+1],69H ;AN000; ;IFS. 0 0000292D 7506 JNZ is44xx ;AN000; ;IFS. 0 0000292F B80D44 MOV AX,440DH ;AN000; ;IFS. 0 00002932 50 PUSH AX ;AN000; ;IFS. 0 00002933 EB04 JMP SHORT callrose ;AN000; ;IFS. 451 is44xx: 0 00002935 FF36[0000] PUSH word [User_In_AX] ;AN000; ;IFS. call IFSFUNC 453 callrose: 0 00002939 8EDE MOV DS,SI ;AN000; ;IFS. 455 assume ds:nothing 456 multNET equ MultNET ; NASM port equate 0 0000293B B82B11 MOV AX,(multNET << 8) | 43 ;AN000; ;IFS. 0 0000293E CD2F INT 2FH ;AN000; ;IFS. 0 00002940 5B POP BX ;AN000; ;IFS. 0 00002941 7398 JNC doneok ;AN000; ;IFS. 0 00002943 89C7 MOV DI,AX ;AN000; ;IFS. 0 00002945 E95B01 JMP device_err ;AN000; ;IFS. 463 Do_GenIOCTL: 464 assume ds:DOSGROUP 0 00002948 26F745044000 test word [ES:DI + SDEVATT],DEV320 ; Can device handle Generic IOCTL funcs 0 0000294E 744E jz ioctl_bad_fun 0 00002950 06 PUSH ES ; DEVIOCALL2 expects Device header block 0 00002951 57 PUSH DI ; in DS:SI 469 ;set up Generic IOCTL Request Block 470 IOCTL_Req_struc_size equ IOCTL_REQ_struc_size ; NASM port equate 471 ReqLen equ REQLEN ; NASM port equate 0 00002952 C606[0000]17 MOV byte [IOCALL + ReqLen],(IOCTL_Req_struc_size) 473 ReqFunc equ REQFUNC ; NASM port equate 0 00002957 C606[0200]13 MOV byte [IOCALL + ReqFunc],GENIOCTL 0 0000295C 84C0 test al, al 0 0000295E 7405 jz @F 0 00002960 C606[0200]19 MOV byte [IOCALL + ReqFunc], QUERYGENIOCTL 478 @@: 479 ReqUnit equ REQUNIT ; NASM port equate 0 00002965 881E[0100] MOV byte ptr [IOCALL + ReqUnit],BL 481 MajorFunction equ MAJORFUNCTION ; NASM port equate 0 00002969 882E[0D00] MOV byte ptr [IOCALL + MajorFunction],CH 483 MinorFunction equ MINORFUNCTION ; NASM port equate 0 0000296D 880E[0E00] MOV byte ptr [IOCALL + MinorFunction],CL 485 Reg_SI equ REG_SI ; NASM port equate 0 00002971 8936[0F00] MOV word ptr [IOCALL + Reg_SI],SI 487 Reg_DI equ REG_DI ; NASM port equate 0 00002975 893E[1100] MOV word ptr [IOCALL + Reg_DI],DI 489 GenericIOCTL_Packet equ GENERICIOCTL_PACKET ; NASM port equate 0 00002979 8916[1300] MOV word ptr [IOCALL + GenericIOCTL_Packet],DX 0 0000297D 8936[1500] MOV word ptr [IOCALL + GenericIOCTL_Packet + 2],SI 492 0 00002981 BB[0000] MOV BX,offset IOCALL wrt DOSGROUP 494 0 00002984 16 PUSH SS 0 00002985 07 POP ES 497 assume es:DOSGROUP 498 0 00002986 5E POP SI 0 00002987 1F POP DS 501 ASSUME DS:NOTHING ; DS:SI -> Device header. 502 ; jmp ioctl_do_IO ; Perform Call to device driver 503 ; ioctl_do_IO: 0 00002988 E8[0000] invoke DEVIOCALL2 0 0000298B 36F606[0400]80 testopt [ss:IOCALL + REQSTAT], STERR ; Error? 0 00002991 7403E90801 JNZ Ioctl_string_err 0 00002996 31C0 xor ax, ax ; lDOS: return ax = 0 on success 0 00002998 E9[0000] transfer SYS_RET_OK 509 510 IOCtl_Handle_RedirJ: 511 IOCTL_Handle_Redir equ Ioctl_Handle_redir ; NASM port label 0 0000299B E99900 JMP IOCTL_Handle_Redir 513 ioctl_bad_fun: 0 0000299E B001E9[0000] error error_invalid_function 515 516 ioctl_bad_handlej: 0 000029A3 E94DFE jmp ioctl_bad_handle 518 519 ; Function 8 520 ioctl_rem_media: 0 000029A6 E83F01 CALL Check_If_Net 522 assume es:nothing 0 000029A9 75F3 JNZ ioctl_bad_fun ; There are no "net devices", and they 524 ; certainly don't know how to do this 525 ; call. 526 assume es:nothing ; device header 0 000029AB 26F745040008 TEST word [ES:DI + SDEVATT],DEVOPCL ; See if device can 0 000029B1 74EB JZ ioctl_bad_fun ; NO 0 000029B3 36C606[0200]0F MOV byte [ss:IOCALL + REQFUNC],DEVRMD 0 000029B9 B00D MOV AL,REMHL 0 000029BB 88DC MOV AH,BL ; Unit number 0 000029BD 36A3[0000] MOV WORD PTR [ss:IOCALL + REQLEN],AX 0 000029C1 31C0 XOR AX,AX 0 000029C3 36A3[0300] MOV [ss:IOCALL + REQSTAT],AX 0 000029C7 06 PUSH ES 0 000029C8 1F POP DS 537 ASSUME DS:NOTHING 0 000029C9 89FE MOV SI,DI ; DS:SI -> driver 0 000029CB 16 PUSH SS 0 000029CC 07 POP ES 541 assume es:DOSGROUP 0 000029CD BB[0000] MOV BX,OFFSET IOCALL wrt DOSGROUP ; ES:BX -> Call header 0 000029D0 1E56 SaveReg 0 000029D2 E8[0000] invoke DEVIOCALL2 0 000029D5 5E1F RestoreReg 0 000029D7 36A1[0300] MOV AX,[ss:IOCALL + REQSTAT] ; Get Status word 0 000029DB 250002 AND AX,STBUI ; Mask to busy bit 0 000029DE B109 MOV CL,9 0 000029E0 D3E8 SHR AX,CL ; Busy bit to bit 0 0 000029E2 EBB4 transfer SYS_RET_OK 551 552 ; Function 9 553 Ioctl_Drive_attr: 554 555 ;;;;; MOV AL,BL ;AC000;; Drive 556 ;;;;; invoke GETTHISDRV ;AC000; 557 ;;;;; ;AC000; 558 ;;;;; JC ioctl_drv_err ; drive not valid 0 000029E4 E8CB00 call Get_Driver_BL 560 assume es:nothing 0 000029E7 7247 JC ioctl_drv_err ; drive not valid 562 assume es:nothing ; device header 0 000029E9 36A1[0000] MOV AX,[ss:Temp_Var2] ;AN000;IFS. 0 000029ED 268B5504 mov dx,word ptr [es:di + SDEVATT] ; get device attribute word 0 000029F1 88C3 MOV BL,AL ; Phys letter to BL (A=0) 0 000029F3 36C43E[0000] LES DI,[ss:THISCDS] 567 ;;;;; TEST [ES:DI.curdir_flags],curdir_isnet 0 000029F8 E8F200 CALL TEST_IFS_REMOTE2 ;AN000;IFS. test if remote 0 000029FB 7404 JZ IOCTLShare 0 000029FD 81CA0010 OR DX,1000h 571 IOCTLShare: 0 00002A01 161F Context DS 573 ASSUME DS:NOTHING 0 00002A03 BE[0000] MOV SI,OFFSET OPENBUF wrt DOSGROUP 0 00002A06 80C341 ADD BL,"A" 0 00002A09 881C MOV [SI],BL 0 00002A0B C744013A00 MOV WORD PTR [SI+1],003AH ; ":",0 0 00002A10 B80003 MOV AX,0300H 0 00002A13 F8 CLC 0 00002A14 CD2A INT int_IBM 581 ioctlLocal equ IOCTLLocal ; NASM port label 0 00002A16 7304 JNC ioctlLocal ; Not shared 0 00002A18 81CA0002 OR DX,0200H ; Shared, bit 9 584 IOCTLLocal: 0 00002A1C 26F745430010 TEST word [ES:DI + curdir_flags],curdir_local 586 ioctl_set_dx equ ioctl_set_DX ; NASM port label 0 00002A22 7404 JZ ioctl_set_dx 0 00002A24 81CA0080 OR DX,8000h 589 590 ioctl_set_DX: 0 00002A28 E8[0000] invoke get_user_stack 0 00002A2B 895406 MOV [SI + user_DX],DX 0 00002A2E EBB2 transfer SYS_RET_OK 594 595 ioctl_drv_err: 0 00002A30 36A0[0000] MOV AL,[ss:DrvErr] ;AN000;IFS. DrvErr is saved in GetThisDrv 0 00002A34 E9[0000] transfer SYS_RET_ERR ;AN000;IFS. 598 599 ; Function 10 600 Ioctl_Handle_redir: 0 00002A37 E8[0000] invoke SFFromHandle ; ES:DI -> SFT 0 00002A3A 7304 JNC ioctl_got_sft ; have valid handle 0 00002A3C B006EBF4 error error_invalid_handle 604 605 ioctl_got_sft: 0 00002A40 268B5505 MOV DX,[ES:DI + sf_flags] ; Get flags 0 00002A44 EBE2 JMP ioctl_set_DX 608 609 ioctl_bad_funj: 0 00002A46 E955FF JMP ioctl_bad_fun 611 612 ioctl_get_dev: 613 DOSAssume CS,,"IOCTL/IOCtl_Get_Dev" 0 00002A49 E89C00 CALL Check_If_Net 615 assume es:nothing 0 00002A4C 75F8 JNZ ioctl_bad_funj ; There are no "net devices", and they 617 ; certainly don't know how to do this 618 ; call. 619 assume es:nothing ; device header 620 621 ioctl_do_string: 0 00002A4E 26F745040040 TEST word [ES:DI + SDEVATT],DEVIOCTL; See if device accepts control 0 00002A54 74F0 JZ ioctl_bad_funj ; NO 0 00002A56 FEC8 DEC AL 0 00002A58 FEC8 DEC AL 0 00002A5A 7407 JZ ioctl_control_read 0 00002A5C C606[0200]0C MOV byte [IOCALL + REQFUNC],DEVWRIOCTL 0 00002A61 EB05 JMP SHORT ioctl_control_call 629 ioctl_control_read: 630 assume es:nothing ; device header 0 00002A63 C606[0200]03 MOV byte [IOCALL + REQFUNC],DEVRDIOCTL 632 ioctl_control_call: 633 assume es:nothing ; device header 0 00002A68 B016 MOV AL,DRDWRHL 635 ioctl_setup_pkt: 636 assume es:nothing ; device header 0 00002A6A 88DC MOV AH,BL ; Unit number 0 00002A6C A3[0000] MOV WORD PTR [IOCALL + REQLEN],AX 0 00002A6F 31C0 XOR AX,AX 0 00002A71 A3[0300] MOV [IOCALL + REQSTAT],AX 0 00002A74 A2[0000] MOV [IOMED],AL 0 00002A77 890E[0000] MOV [IOSCNT],CX 0 00002A7B 8916[0000] MOV WORD PTR [IOXAD],DX 0 00002A7F 8936[0200] MOV WORD PTR [IOXAD+2],SI 0 00002A83 06 PUSH ES 0 00002A84 1F POP DS 647 ASSUME DS:NOTHING 0 00002A85 89FE MOV SI,DI ; DS:SI -> driver 0 00002A87 16 PUSH SS 0 00002A88 07 POP ES 651 assume es:DOSGROUP 0 00002A89 BB[0000] MOV BX,OFFSET IOCALL wrt DOSGROUP ; ES:BX -> Call header 653 ioctl_do_IO: 0 00002A8C E8[0000] invoke DEVIOCALL2 0 00002A8F 36F706[0300]0080 TEST word [ss:IOCALL + REQSTAT],STERR ;Error? 0 00002A96 7506 JNZ Ioctl_string_err 0 00002A98 36A1[0000] MOV AX,[ss:IOSCNT] ; Get actual bytes transferred 0 00002A9C EB90 transfer SYS_RET_OK 659 660 Ioctl_string_err: 0 00002A9E 368B3E[0300] MOV DI,[ss:IOCALL + REQSTAT] ;Get Error 662 device_err: 0 00002AA3 81E7FF00 AND DI,STECODE ; mask out irrelevant bits 0 00002AA7 89F8 MOV AX,DI 0 00002AA9 E8[0000] invoke SET_I24_EXTENDED_ERROR 666 extErr equ ExtErr ; NASM port label 0 00002AAC 36A1[0000] mov ax, [ss:extErr] 0 00002AB0 EB8C transfer SYS_RET_ERR 669 670 Get_Driver_BL: 671 DOSAssume CS,,"Get_Driver_BL" 672 ASSUME ES:NOTHING 673 ; BL is drive number (0=default) 674 ; Returns pointer to device in ES:DI, unit number in BL if carry clear 675 ; No regs modified 676 0 00002AB2 50 PUSH AX 0 00002AB3 88D8 MOV AL,BL ; Drive 0 00002AB5 E8[0000] invoke GETTHISDRV 0 00002AB8 7307 JNC ioctl_goodrv ;AC000;IFS. 681 error_not_dos_disk equ error_not_DOS_disk ; NASM port equate 0 00002ABA 3C1A CMP AL,error_not_dos_disk ;AN000;IFS. if unknow media then 0 00002ABC 7403 JZ ioctl_goodrv ;AN000;IFS. let it go 0 00002ABE F9 STC ;AN000;IFS. else 0 00002ABF EB25 JMP SHORT ioctl_bad_drv ;AN000;IFS. error 686 ioctl_goodrv: 0 00002AC1 30DB XOR BL,BL ; Unit zero on Net device 0 00002AC3 C606[0000]03 MOV byte [EXTERR_LOCUS],errLOC_Net 0 00002AC8 C43E[0000] LES DI,[THISCDS] 690 assume es:nothing ; CDS 691 ; TEST [ES:DI.curdir_flags],curdir_isnet 0 00002ACC E81E00 CALL TEST_IFS_REMOTE2 ;AN000;;IFS. test if remote 0 00002ACF 26C47D45 LES DI,[ES:DI + curdir_devptr]; ES:DI -> Dpb or net dev 0 00002AD3 750D JNZ got_dev_ptr ; Is net 695 assume es:DPB 0 00002AD5 C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 00002ADA 268A5D01 MOV BL,[ES:DI + dpb_UNIT] ; Unit number 0 00002ADE 26C47D13 LES DI,[ES:DI + dpb_driver_addr] ; Driver addr 699 assume es:nothing ; device header 700 got_dev_ptr: 0 00002AE2 F8 CLC 0 00002AE3 A3[0000] MOV [Temp_Var2],AX ;AN000;IFS. 703 ioctl_bad_drv: 0 00002AE6 58 POP AX 0 00002AE7 C3 return 706 707 ; 708 ; Checks if the device is over the net or not. Returns result in ZERO flag. 709 ; If no device is found, the return address is popped off the stack, and a 710 ; jump is made to ioctl_drv_err. 711 ; 712 ; On Entry: 713 ; Registers same as those for Get_Driver_BL 714 ; 715 ; On Exit: 716 ; ZERO flag - set if not a net device 717 ; - reset if net device 718 ; ES:DI -> the device 719 ; 720 Check_If_Net: 0 00002AE8 E8C7FF CALL Get_Driver_BL 722 assume es:nothing 0 00002AEB 721B JC ioctl_drv_err_pop ; invalid drive letter 724 entry TEST_IFS_REMOTE2 0 00002AED 06 PUSH ES 0 00002AEE 57 PUSH DI 0 00002AEF C43E[0000] LES DI,[THISCDS] 728 assume es:nothing ; CDS 0 00002AF3 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 00002AF9 740A JZ belocal ;AN000; ;IFS. 0 00002AFB 26C47D52 LES DI,[ES:DI + curdir_ifs_hdr] ;AN000; ;IFS. test if remote 732 TEST_REMOTE: ;AN000; 733 ifs_attribute equ IFS_ATTRIBUTE ; NASM port equate 0 00002AFF 26F7450C0008 TEST word [ES:DI + ifs_attribute],IFSREMOTE;AN000; ;IFS. 735 belocal: 0 00002B05 5F POP DI 0 00002B06 07 POP ES 738 assume es:nothing 0 00002B07 C3 ret 740 741 ioctl_drv_err_pop: 0 00002B08 58 pop ax ; pop off return address 0 00002B09 E924FF jmp ioctl_drv_err 744 745 ioctl_bad_funj3: 0 00002B0C E98FFE jmp ioctl_bad_fun 747 748 ioctl_string_errj: 749 ioctl_string_err equ Ioctl_string_err ; NASM port label 0 00002B0F EB8D jmp ioctl_string_err 751 752 ; Functions 14 and 15 753 ioctl_drive_owner: 0 00002B11 E8D4FF Call Check_If_Net 755 assume es:nothing 0 00002B14 75F6 JNZ ioctl_bad_funj3 ; There are no "net devices", and they 757 ; certainly don't know how to do this 758 ; call. 759 assume es:nothing ; device header 0 00002B16 26F745044000 TEST word [ES:DI + SDEVATT],DEV320 ; See if device can handle this 0 00002B1C 74EE JZ ioctl_bad_funj3 ; NO 0 00002B1E FEC8 dec al 0 00002B20 7407 jz GetOwner 0 00002B22 C606[0200]18 MOV byte [IOCALL + REQFUNC],DEVSETOWN 0 00002B27 EB05 jmp short ioctl_do_own 766 GetOwner: 0 00002B29 C606[0200]17 MOV byte [IOCALL + REQFUNC],DEVGETOWN 768 ioctl_do_own: 0 00002B2E B00D MOV AL,OWNHL 0 00002B30 88DC MOV AH,BL ; Unit number 0 00002B32 A3[0000] MOV WORD PTR [IOCALL + REQLEN],AX 0 00002B35 31C0 XOR AX,AX 0 00002B37 A3[0300] MOV [IOCALL + REQSTAT],AX 0 00002B3A 06 PUSH ES 0 00002B3B 1F POP DS 776 ASSUME DS:NOTHING 0 00002B3C 89FE MOV SI,DI ; DS:SI -> driver 0 00002B3E 16 PUSH SS 0 00002B3F 07 POP ES 780 assume es:DOSGROUP 0 00002B40 BB[0000] MOV BX,OFFSET IOCALL wrt DOSGROUP ; ES:BX -> Call header 0 00002B43 1E56 SaveReg 0 00002B45 E8[0000] invoke DEVIOCALL2 0 00002B48 5E1F RestoreReg 0 00002B4A 36F706[0300]0080 test word [ss:IOCALL + REQSTAT],STERR 0 00002B51 75BC jnz ioctl_string_errj 0 00002B53 36A0[0100] MOV AL,BYTE PTR [ss:IOCALL + REQUNIT] ; Get owner returned by device 788 ; owner returned is 1-based. 0 00002B57 E9[0000] transfer SYS_RET_OK 790 791 EndProc D_IOCTL 792 793 794 ;Input: ES:DI -> SFT 795 ;Functions: test if a remote file 796 ;Output: Z flag set, local file 797 ; 798 799 procedure TEST_IFS_REMOTE,NEAR ;AN000; 799 ****************** warning: proc TEST_IFS_REMOTE... [-w+user] 800 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 801 0 00002B5A 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet ;AN000;;IFS. ifs ? 0 00002B60 7408 JZ nonifs ;AN000;;IFS. no 0 00002B62 06 PUSH ES ;AN000;;IFS. save regs 0 00002B63 57 PUSH DI ;AN000;;IFS. 806 sf_IFS_hdr equ sf_IFS_HDR ; NASM port equate 0 00002B64 26C47D37 LES DI,[ES:DI + sf_IFS_hdr] ;AN000;;IFS. get ifs header 0 00002B68 EB95 JMP TEST_REMOTE ;AN000;;IFS. 809 nonifs: ;AN000; 0 00002B6A C3 return ;AN000;;IFS. 811 EndProc TEST_IFS_REMOTE ;AN000; 812 813 END === Trace listing source: ../DOS/delete.lst 1 ; SCCSID = @(#)delete.asm 1.3 85/10/18 2 ; SCCSID = @(#)delete.asm 1.3 85/10/18 3 ;TITLE DOS_DELETE - Internal DELETE call for MS-DOS 4 ;NAME DOS_DELETE 5 ; Low level routine for deleting files 6 ; 7 ; DOS_DELETE 8 ; REN_DEL_Check 9 ; FastOpen_Delete ; DOS 3.3 10 ; FastOpen_Update ; DOS 3.3 11 ; FastSeek_Open ; DOS 4.00 12 ; FSeek_dispatch ; DOS 4.00 13 ; FastSeek_Close ; DOS 4.00 14 ; FastSeek_Delete ; DOS 4.00 15 ; Delete_FSeek ; DOS 4.00 16 ; FastSeek_Lookup ; DOS 4.00 17 ; FastSeek_Insert ; DOS 4.00 18 ; FastSeek_Truncate ; DOS 4.00 19 ; FS_doit ; DOS 4.00 20 ; 21 ; Revision history: 22 ; 23 ; A000 version 4.00 Jan. 1988 24 ; 25 26 ; 27 ; get the appropriate segment definitions 28 ; 29 [list -] 29 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 31 32 [list +] === Switch to base=002450h -> "DOSCODECODE" 33 section DOSCODECODE 34 [list -] 34 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 34 ****************** warning: out: BPB.INC... [-w+user] 34 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 34 ****************** warning: out: DEVSYM.INC... [-w+user] 44 45 %iassign Installed TRUE 46 47 i_need NoSetDir,BYTE 48 i_need Creating,BYTE 49 i_need DELALL,BYTE 50 i_need THISDPB,DWORD 51 i_need THISSFT,DWORD 52 i_need THISCDS,DWORD 53 i_need CURBUF,DWORD 54 i_need ATTRIB,BYTE 55 i_need SATTRIB,BYTE 56 i_need WFP_START,WORD 57 i_need FoundDel,BYTE 58 i_need AUXSTACK,BYTE 59 i_need VOLCHNG_FLAG,BYTE 60 i_need JShare,DWORD 61 i_need FastOpenTable,BYTE ; DOS 3.3 62 i_need FastTable,BYTE ; DOS 4.00 63 i_need FSeek_drive,BYTE ; DOS 4.00 64 i_need FSeek_firclus,WORD ; DOS 4.00 65 i_need FSeek_logclus,WORD ; DOS 4.00 66 i_need FSeek_logsave,WORD ; DOS 4.00 67 i_need FastSeekflg,BYTE ; DOS 4.00 68 i_need Del_ExtCluster,WORD ; DOS 4.00 69 i_need SAVE_BX,WORD ; DOS 4.00 70 i_need DMAADD,DWORD 71 i_need RENAMEDMA,BYTE 72 73 assume nocheck, ss:DOSGROUP 74 75 ; Inputs: 76 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 77 ; terminated) 78 ; [CURR_DIR_END] Points to end of Current dir part of string 79 ; ( = -1 if current dir not involved, else 80 ; Points to first char after last "/" of current dir part) 81 ; [THISCDS] Points to CDS being used 82 ; (Low word = -1 if NUL CDS (Net direct request)) 83 ; [SATTRIB] Is attribute of search, determines what files can be found 84 ; Function: 85 ; Delete the specified file(s) 86 ; Outputs: 87 ; CARRY CLEAR 88 ; OK 89 ; CARRY SET 90 ; AX is error code 91 ; error_file_not_found 92 ; Last element of path not found 93 ; error_path_not_found 94 ; Bad path (not in curr dir part if present) 95 ; error_bad_curr_dir 96 ; Bad path in current directory part of path 97 ; error_access_denied 98 ; Attempt to delete device or directory 99 ; ***error_sharing_violation*** 100 ; Deny both access required, generates an INT 24. 101 ; This error is NOT returned. The INT 24H is generated, 102 ; and the file is ignored (not deleted). Delete will 103 ; simply continue on looking for more files. 104 ; Carry will NOT be set in this case. 105 ; DS preserved, others destroyed 106 107 fileFound equ 01h 108 fileDeleted equ 10h 109 110 procedure DOS_DELETE,NEAR 110 ****************** warning: proc DOS_DELETE... [-w+user] 111 DOSAssume CS,,"DOS_Delete" 112 ASSUME ES:NOTHING 113 0 00002B6B E8[0000] Invoke TestNet 0 00002B6E 7306 JNC LOCAL_DELETE 116 ; invoke OWN_SHARE2 ;IFS. IFS owns share ? ;AN000; 117 ; JZ ifsshare ;IFS. yes ;AN000; 118 ; PUSH WORD PTR [DMAADD+2] ;IFS. save DMAADD ;AN000; 119 ; PUSH WORD PTR [DMAADD] ;IFS. ;AN000; 120 ; CALL IFS_SEARCH_FIRST ;IFS. do search first ;AN000; 121 ; JC nofiles ;IFS. file not existing ;AN000; 122 delete_next_file: ;IFS. ;AN000; 123 ; CALL IFS_REN_DEL_CHECK ;IFS. do REN_DEL_CHECK ;AN000; 124 ; JNC share_okok ;IFS. share ok ;AN000; 125 ; MOV AX,error_sharing_violation ;IFS. share violation ;AN000; 126 ; JMP SHORT nofiles ;IFS. ;AN000; 127 share_okok: 128 ; MOV AX,(multNET SHL 8) OR 19 ;IFS. delete it now ;AN000; 129 ;; INT 2FH ;IFS. ;AN000; 130 ; JC nofiles ;IFS. error ;AN000; 131 ; invoke DOS_SEARCH_NEXT ;IFS. get next entry ;AN000; 132 ; JNC delete_next_file ;IFS. ;AN000; 133 ; CLC ;IFS. no more files ;AN000; 134 nofiles: 135 ; POP WORD PTR [DMAADD] ;IFS. retor DMAADD ;AN000; 136 ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; 137 ; ret ;IFS. return 138 ifsshare: 139 140 141 %IFN Installed 142 transfer NET_DELETE 143 %ELSE 144 multNET equ MultNET ; NASM port equate 0 00002B70 B81311 MOV AX,(multNET << 8) | 19 0 00002B73 CD2F INT 2FH 0 00002B75 C3 return 148 %ENDIF 149 150 LOCAL_DELETE: 0 00002B76 C606[0000]00 MOV byte [FoundDel],00 ; No files found and no files deleted 0 00002B7B E8[0000] EnterCrit critDisk 153 CREATING equ Creating ; NASM port label 0 00002B7E C706[0000]00E5 MOV WORD PTR [CREATING],0E500H ; Assume not del *.* 0 00002B84 8B36[0000] MOV SI,[WFP_START] 156 SKPNUL: 0 00002B88 AC LODSB 0 00002B89 08C0 OR AL,AL 0 00002B8B 75FB JNZ SKPNUL ; go to end 0 00002B8D 83EE04 SUB SI,4 ; Back over possible "*.*" 0 00002B90 813C2A2E CMP WORD PTR [SI],("." << 8 | "*") 0 00002B94 7506 JNZ TEST_QUEST 0 00002B96 807C022A CMP BYTE PTR [SI+2],"*" 0 00002B9A 741F JZ CHECK_ATTS 165 TEST_QUEST: 0 00002B9C 83EE09 SUB SI,9 ; Back over possible "????????.???" 0 00002B9F 87FE XCHG DI,SI 0 00002BA1 1607 context ES 0 00002BA3 B83F3F MOV AX,"??" 0 00002BA6 B90400 MOV CX,4 ; four sets of "??" 0 00002BA9 F3AF REPE SCASW 0 00002BAB 751C JNZ NOT_ALL 0 00002BAD 87FE XCHG DI,SI 0 00002BAF AD LODSW 0 00002BB0 3D2E3F CMP AX,("?" << 8) | "." 0 00002BB3 7514 JNZ NOT_ALL 0 00002BB5 AD LODSW 0 00002BB6 3D3F3F CMP AX,"??" 0 00002BB9 750E JNZ NOT_ALL 180 CHECK_ATTS: 0 00002BBB A0[0000] MOV AL,BYTE PTR [SATTRIB] 0 00002BBE 241F AND AL,attr_hidden+attr_system+attr_directory+attr_volume_id+attr_read_only 183 ; Look only at hidden bits 0 00002BC0 3C1F CMP AL,attr_hidden+attr_system+attr_directory+attr_volume_id+attr_read_only 185 ; All must be set 0 00002BC2 7505 JNZ NOT_ALL 187 188 ; NOTE WARNING DANGER----- 189 ; This DELALL stuff is not safe. It allows directories to be deleted. 190 ; It should ONLY be used by FORMAT in the ROOT directory. 191 ; 192 0 00002BC4 C606[0000]00 MOV byte [DELALL],0 ; DEL *.* - flag deleting all 194 NOT_ALL: 0 00002BC9 C606[0000]01 MOV byte [NoSetDir],1 0 00002BCE E8[0000] invoke GetPathNoSet 197 ASSUME ES:NOTHING 0 00002BD1 7313 JNC Del_found 0 00002BD3 750C JNZ bad_path 0 00002BD5 08C9 OR CL,CL 0 00002BD7 7408 JZ bad_path 202 No_file: 0 00002BD9 B80200 MOV AX,error_file_not_found 204 ErrorReturn: 0 00002BDC F9 STC 0 00002BDD E8[0000] LeaveCrit critDisk 0 00002BE0 C3 return 208 209 bad_path: 0 00002BE1 B80300 MOV AX,error_path_not_found 0 00002BE4 EBF6 JMP ErrorReturn 212 213 Del_found: 0 00002BE6 750C JNZ NOT_DIR ; Check for dir specified 215 DelAll equ DELALL ; NASM port label 0 00002BE8 803E[0000]00 CMP byte [DelAll],0 ; DelAll = 0 allows delete of dir. 217 Not_Dir equ NOT_DIR ; NASM port label 0 00002BED 7405 JZ Not_Dir 219 Del_access_err: 0 00002BEF B80500 MOV AX,error_access_denied 0 00002BF2 EBE8 JMP ErrorReturn 222 223 NOT_DIR: 0 00002BF4 08E4 OR AH,AH ; Check if device name 0 00002BF6 78F7 JS Del_access_err ; Can't delete I/O devices 226 ; 227 ; Main delete loop. CURBUF+2:BX points to a matching directory entry. 228 ; 229 DELFILE: 0 00002BF8 800E[0000]01 OR byte [FoundDel],fileFound ; file found, not deleted yet 231 ; 232 ; If we are deleting the Volume ID, then we set VOLUME_CHNG flag to make 233 ; DOS issue a build BPB call the next time this drive is accessed. 234 ; 0 00002BFD 1E PUSH DS 0 00002BFE 8A26[0000] MOV AH,[DELALL] 0 00002C02 C53E[0000] LDS DI,[CURBUF] 238 ASSUME DS:NOTHING 239 ;; Extended Attributes 240 ; PUSH AX ;FT. save cluster of XA ;AN000; 241 ; MOV AX,[DS:BX.dir_ExtCluster];FT. ;AN000; 242 ; MOV [Del_ExtCluster],AX ;FT. ;AN000; 243 ; POP AX ;FT, ;AN000; 244 245 ;; Extended Attributes 246 Attrib equ ATTRIB ; NASM port label 0 00002C06 36F606[0000]01 TEST byte [ss:Attrib],attr_read_only ; are we deleting RO files too? 0 00002C0C 7509 JNZ DoDelete ; yes 0 00002C0E F6470B01 TEST byte [BX + dir_attr],attr_read_only 0 00002C12 7403 JZ DoDelete ; not read only 0 00002C14 1F POP DS 252 assume ds:DOSGROUP 253 DelNxt equ DELNXT ; NASM port label 0 00002C15 EB35 JMP SHORT DelNxt ; Skip it (Note ES:BP not set) 255 256 DoDelete: 0 00002C17 E88800 call REN_DEL_Check ; Sets ES:BP = [THISDPB] 0 00002C1A 7303 JNC DEL_SHARE_OK 0 00002C1C 1F POP DS 260 assume ds:DOSGROUP 0 00002C1D EB2D JMP SHORT DelNxt ; Skip it 262 263 DEL_SHARE_OK: 264 Assert ISBUF,,"Del_Share_OK" 0 00002C1F F6450540 TEST byte [DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00002C23 7507 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 00002C25 E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00002C28 804D0540 OR byte [DI + buf_flags],buf_dirty 269 yesdirty: 0 00002C2C 8827 MOV [BX],AH ; Put in E5H or 0 0 00002C2E 8B1C MOV BX,[SI] ; Get firclus pointer 0 00002C30 1F POP DS 273 DOSAssume CS,,"Del_Share_OK" 0 00002C31 800E[0000]10 OR byte [FoundDel],fileDeleted ; Deleted file 0 00002C36 83FB02 CMP BX,2 0 00002C39 7211 JB DELEXT ; File has invalid FIRCLUS (too small) 0 00002C3B 263B5E0D CMP BX,[ES:BP + dpb_max_cluster] 0 00002C3F 770B JA DELEXT ; File has invalid FIRCLUS (too big) 279 ;; FastSeek 10/27/86 0 00002C41 E82D01 CALL Delete_FSeek ; delete the fastseek entry 281 ;; FastSeek 10/27/86 282 0 00002C44 E8[0000] invoke RELEASE ; Free file data 0 00002C47 7253 JC No_fileJ 285 ; DOS 3.3 FastOpen 286 0 00002C49 E8C300 CALL FastOpen_Delete ; delete the dir info in fastopen 288 289 290 ; DOS 3.3 FastOpen 291 ;; Extended Attributes 292 DELEXT: 293 294 ; MOV BX,[Del_ExtCluster] ;FT. delete XA cluster chain ;AN000; 295 ; CMP BX,2 ;FT. ;AN000; 296 ; JB DELNXT ;FT. XA has invalid cluster (too small) ;AN000; 297 ; CMP BX,[ES:BP.dpb_max_cluster];FT. ;AN000; 298 ; JA DELNXT ;FT. XA has invalid cluster (too big) ;AN000; 299 ; invoke RELEASE ;FT. Free extended attrs cluster ;AN000; 300 ; JC No_fileJ ;FT. ;AN000; 301 302 ;; Extended Attributes 303 DELNXT: 0 00002C4C C42E[0000] LES BP,[THISDPB] ; Possible to get here without this set 0 00002C50 E8[0000] invoke GETENTRY ; Registers need to be reset 0 00002C53 7247 JC No_fileJ 0 00002C55 E8[0000] invoke NEXTENT 308 %if DEBUG 309 Flsh equ flsh ; NASM port label 310 JC Flsh 311 DelFile equ DELFILE ; NASM port label 312 JMP DelFile 313 flsh: 314 %ELSE 0 00002C58 739E JNC DELFILE 316 %ENDIF 0 00002C5A C42E[0000] LES BP,[THISDPB] ; NEXTENT sets ES=DOSGROUP 318 assume es:DPB 0 00002C5E 268A4600 MOV AL,[ES:BP + dpb_drive] 0 00002C62 E8[0000] invoke FLUSHBUF 0 00002C65 7235 JC No_fileJ 322 ; 323 ; Now we need to test FoundDel for our flags. The cases to consider are: 324 ; 325 ; not found not deleted file not found 326 ; not found deleted *** impossible *** 327 ; found not deleted access denied (read-only) 328 ; found deleted no error 329 ; 0 00002C67 F606[0000]10 TEST byte [FoundDel],fileDeleted ; did we delete a file? 0 00002C6C 7427 JZ DelError ; no, figure out what's wrong. 332 ; We set VOLCHNG_FLAG to indicate that we have changed the volume label 333 ; and to force the DOS to issue a media check. 0 00002C6E F606[0000]08 TEST byte [Attrib],attr_volume_id 0 00002C73 741C jz No_Set_Flag 0 00002C75 50 PUSH AX 0 00002C76 06 PUSH ES 0 00002C77 57 PUSH DI 0 00002C78 C43E[0000] LES DI,[THISCDS] 340 ASSUME ES:NOTHING 0 00002C7C 268A25 MOV AH,BYTE PTR [ES:DI] ; Get drive 0 00002C7F 80EC41 SUB AH,'A' ; Convert to 0-based 0 00002C82 8826[0000] mov byte ptr [VOLCHNG_FLAG],AH 0 00002C86 30FF XOR BH,BH ;>32mb delte volume id from boot record ;AN000; 0 00002C88 E8[0000] invoke $Set_Media_ID ;>32mb set voulme id to boot record ;AN000; 0 00002C8B E8[0000] invoke FATRead_CDS ; force media check 0 00002C8E 5F POP DI 0 00002C8F 07 POP ES 349 assume es:DPB 0 00002C90 58 POP AX 351 No_Set_Flag: 0 00002C91 E8[0000] LeaveCrit critDisk ; carry is clear 0 00002C94 C3 return 354 DelError: 0 00002C95 F606[0000]01 TEST byte [FoundDel],fileFound ; not deleted. Did we find file? 356 Del_access_errJ equ Del_Access_errJ ; NASM port label 0 00002C9A 7503 JNZ Del_access_errJ ; yes. Access denied 358 No_fileJ: 0 00002C9C E93AFF JMP No_file ; Nope 360 Del_Access_errJ: 0 00002C9F E94DFF JMP Del_access_err 362 363 EndProc DOS_DELETE 364 365 Break 366 367 ; Inputs: 368 ; [THISDPB] set 369 ; [CURBUF+2]:BX points to entry 370 ; [CURBUF+2]:SI points to firclus field of entry 371 ; [WFP_Start] points to name 372 ; Function: 373 ; Check for Exclusive access on given file. 374 ; Used by RENAME, SET_FILE_INFO, and DELETE. 375 ; Outputs: 376 ; ES:BP = [THISDPB] 377 ; NOTE: The WFP string pointed to by [WFP_Start] Will be Modified. The 378 ; last element will be loaded from the directory entry. This is 379 ; so the name given to the sharer doesn't have any meta chars in 380 ; it. 381 ; Carry set if sharing violation, INT 24H generated 382 ; NOTE THAT AX IS NOT error_sharing_violation. 383 ; This is because input AX is preserved. 384 ; Caller must set the error if needed. 385 ; Carry clear 386 ; OK 387 ; AX,DS,BX,SI,DI preserved 388 389 procedure REN_DEL_Check,NEAR 389 ****************** warning: proc REN_DEL_Check... [-w+user] 390 ASSUME DS:NOTHING,ES:NOTHING 391 0 00002CA2 1E PUSH DS 0 00002CA3 57 PUSH DI 0 00002CA4 50 PUSH AX 0 00002CA5 53 PUSH BX 0 00002CA6 56 PUSH SI ; Save CURBUF pointers 0 00002CA7 1607 context ES 398 ASSUME ES:DOSGROUP 0 00002CA9 368B3E[0000] MOV DI,[ss:WFP_START] ; ES:DI -> WFP 0 00002CAE 89DE MOV SI,BX 0 00002CB0 368E1E[0200] MOV DS,WORD PTR [ss:CURBUF+2] ; DS:SI -> entry (FCB style name) 402 assume ds:nothing 0 00002CB5 89FB MOV BX,DI ; Set backup limit for skipback 0 00002CB7 83C302 ADD BX,2 ; Skip over d: to point to leading '\' 0 00002CBA E8[0000] invoke StrLen ; CX is length of ES:DI including NUL 0 00002CBD 49 DEC CX ; Don't include nul in count 0 00002CBE 01CF ADD DI,CX ; Point to NUL at end of string 0 00002CC0 E8[0000] invoke SkipBack ; Back up one element 0 00002CC3 47 INC DI ; Point to start of last element 0 00002CC4 36893E[0000] MOV [ss:SAVE_BX],DI ;IFS. save for DOS_RENAME ;AN000; 0 00002CC9 E8[0000] invoke PackName ; Transfer name from entry to ASCIZ tail. 0 00002CCC 5E POP SI ; Get back entry pointers 0 00002CCD 5B POP BX 0 00002CCE 53 PUSH BX 0 00002CCF 56 PUSH SI ; Back on stack 0 00002CD0 161F context DS 417 ASSUME DS:DOSGROUP 418 ; 419 ; Close the file if possible by us. 420 ; 421 %if installed 0 00002CD2 FF1E[3400] Call far [JShare + 13 * 4] 423 %else 424 Call ShCloseFile 425 %endif 0 00002CD6 8C1E[0200] MOV WORD PTR [THISSFT+2],DS 0 00002CDA C706[0000][C5FF] MOV WORD PTR [THISSFT],OFFSET AUXSTACK - (sf_entry_struc_size) wrt DOSGROUP 428 ; Scratch space 0 00002CE0 30E4 XOR AH,AH ; Indicate file to DOOPEN (high bit off) 0 00002CE2 E8[0000] invoke DOOPEN ; Fill in SFT for share check 0 00002CE5 C43E[0000] LES DI,[THISSFT] 0 00002CE9 26C745021000 MOV word [ES:DI + sf_mode],sharing_deny_both ; requires exclusive access 0 00002CEF 26C7050100 MOV word [ES:DI + sf_ref_count],1 ; Pretend open 0 00002CF4 E8[0000] invoke ShareEnter 0 00002CF7 720C jc CheckDone 0 00002CF9 C43E[0000] LES DI,[THISSFT] 0 00002CFD 26832500 and word [ES:DI + sf_ref_count],0 ; Pretend closed and free 0 00002D01 E8[0000] invoke SHAREEND ; Tell sharer we're done with THISSFT 0 00002D04 F8 CLC 440 CheckDone: 0 00002D05 C42E[0000] LES BP,[THISDPB] 0 00002D09 5E POP SI 0 00002D0A 5B POP BX 0 00002D0B 58 POP AX 0 00002D0C 5F POP DI 0 00002D0D 1F POP DS 447 assume ds:nothing 0 00002D0E C3 return 449 450 EndProc REN_DEL_Check 451 452 Break 453 454 ; Inputs: 455 ; None 456 ; Function: 457 ; Call FastOpen to delete the dir info. 458 ; Outputs: 459 ; None 460 ; 461 ; 462 463 procedure FastOpen_Delete,NEAR 463 ****************** warning: proc FastOpen_Delete... [-w+user] 464 ASSUME DS:NOTHING,ES:NOTHING 0 00002D0F 9C PUSHF ; save flag 0 00002D10 56 PUSH SI ; save registers 0 00002D11 53 PUSH BX 0 00002D12 50 PUSH AX 469 470 WFP_Start equ WFP_START ; NASM port label 0 00002D13 368B36[0000] MOV SI,[ss:WFP_Start] ; ds:si points to path name 0 00002D18 B003 MOV AL,FONC_delete ; al = 3 473 fastinvoke: 0 00002D1A BB[0200] MOV BX,OFFSET FastTable + 2 wrt DOSGROUP 0 00002D1D 36FF1F CALL far [ss:BX] ; call fastopen 476 0 00002D20 58 POP AX ; restore registers 0 00002D21 5B POP BX 0 00002D22 5E POP SI 0 00002D23 9D POPF ; restore flag 0 00002D24 C3 return 482 EndProc FastOpen_Delete 483 484 485 Break 486 487 ; Inputs: 488 ; DL drive number (A=0,B=1,,,) 489 ; CX first cluster # 490 ; AH 0 updates dir entry 491 ; 1 updates CLUSNUM , BP = new CLUSNUM 492 ; ES:DI directory entry 493 ; Function: 494 ; Call FastOpen to update the dir info. 495 ; Outputs: 496 ; None 497 ; 498 ; 499 500 procedure FastOpen_Update,NEAR 500 ****************** warning: proc FastOpen_Update... [-w+user] 501 ASSUME DS:NOTHING,ES:NOTHING 0 00002D25 9C PUSHF ; save flag 0 00002D26 56 PUSH SI 0 00002D27 53 PUSH BX ; save regs 0 00002D28 50 PUSH AX 506 0 00002D29 B004 MOV AL,FONC_update ; al = 4 0 00002D2B EBED JMP fastinvoke 509 510 EndProc FastOpen_Update 511 512 Break 513 514 ; Inputs: 515 ; DL drive number (0=A,1=B,,,) 516 ; CX first cluster # 517 ; Function: 518 ; Create a file extent cache entry 519 ; Outputs: 520 ; None 521 ; 522 ; 523 524 procedure FastSeek_Open,NEAR ;AN000; 524 ****************** warning: proc FastSeek_Open... [-w+user] 525 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 526 ;AN000; 0 00002D2D 36F606[0000]80 TEST byte [ss:FastSeekflg],Fast_yes ; Fastseek installed ? ;AN000; 0 00002D33 7409 JZ fs_no11 ; no ;AN000; 0 00002D35 56 PUSH SI ; save regs ;AN000; 0 00002D36 50 PUSH AX ;AN000; 0 00002D37 B00B MOV AL,FSEC_open ; al = 11 ;AN000; 532 fseek_disp: ;AN000; 0 00002D39 E80300 CALL FSeek_dispatch ; call fastseek ;AN000; 0 00002D3C 58 POP AX ; restore regs ;AN000; 0 00002D3D 5E POP SI ;AN000; 536 fs_no11: ;AN000; 0 00002D3E C3 return ; return ;AN000; 538 EndProc FastSeek_Open ;AN000; 539 540 ; Inputs: 541 ; none 542 ; Function: 543 ; Call Fastseek 544 ; Outputs: 545 ; Output of Fastseek 546 ; 547 548 procedure FSeek_dispatch,NEAR 548 ****************** warning: proc FSeek_dispatch... [-w+user] 549 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 550 ;AN000; 0 00002D3F B402 MOV AH,FastSeek_ID ; fastseek ID = 1 ;AN000; 552 entry Fast_Dispatch ; future fastxxxx entry ;AN000; 0 00002D41 50 PUSH AX ; save ax ;AN000; 0 00002D42 88E0 MOV AL,AH ; al=fastseek ID ;AN000; 0 00002D44 30E4 XOR AH,AH ; ;AN000; 0 00002D46 48 DEC AX ; ;AN000; 0 00002D47 D1E0 SHL AX,1 ; times 4 to get entry offset ;AN000; 0 00002D49 D1E0 SHL AX,1 ;AN000; 559 ;AN000; 0 00002D4B BE[0200] MOV SI,OFFSET FastTable + 2 wrt DOSGROUP ; index to the ;AN000; 0 00002D4E 01C6 ADD SI,AX ; fastxxxx entry ;AN000; 0 00002D50 58 POP AX ; restore ax ;AN000; 0 00002D51 36FF1C CALL far [ss:SI] ; call fastseek ;AN000; 0 00002D54 C3 return 565 EndProc FSeek_dispatch 566 567 Break 568 569 ; Inputs: 570 ; DL drive number (0=A,1=B,,,) 571 ; CX first cluster # 572 ; Function: 573 ; Close a file extent entry 574 ; Outputs: 575 ; None 576 ; 577 ; 578 579 procedure FastSeek_Close,NEAR 579 ****************** warning: proc FastSeek_Close... [-w+user] 580 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 581 0 00002D55 36F606[0000]80 TEST byte [ss:FastSeekflg],Fast_yes ; Fastseek installed ? ;AN000; 0 00002D5B 7429 JZ fs_no2 ; no ;AN000; 0 00002D5D 56 PUSH SI ; save regs ;AN000; 0 00002D5E 50 PUSH AX ; ;AN000; 0 00002D5F B00C MOV AL,FSEC_close ; al = 12 ;AN000; 0 00002D61 EBD6 JMP fseek_disp ; call fastseek ;AN000; 588 EndProc FastSeek_Close ;AN000; 589 590 Break 591 592 ; Inputs: 593 ; DL drive number (0=A,1=B,,,) 594 ; CX first cluster # 595 ; Function: 596 ; Delete a file extent entry 597 ; Outputs: 598 ; None 599 ; 600 ; 601 602 procedure FastSeek_Delete,NEAR 602 ****************** warning: proc FastSeek_Delete... [-w+user] 603 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 604 ;AN000; 0 00002D63 36F606[0000]80 TEST byte [ss:FastSeekflg],Fast_yes ; Fastseek installed ? ;AN000; 0 00002D69 741B JZ fs_no2 ; no ;AN000; 0 00002D6B 56 PUSH SI ; save regs ;AN000; 0 00002D6C 50 PUSH AX ;AN000; 0 00002D6D B00D MOV AL,FSEC_delete ; al=13 ;AN000; 0 00002D6F EBC8 JMP fseek_disp ; call fastseek ;AN000; 611 EndProc FastSeek_Delete ;AN000; 612 ;AN000; 613 ; Inputs: 614 ; FastSeekflg= 0 , not installed 615 ; 1 , installed 616 ; BX= first cluster number 617 ; ES:BP = addr of DPB 618 ; Function: 619 ; Delete a file extent entry 620 ; Outputs: 621 ; None 622 ; 623 624 procedure Delete_FSeek,NEAR ;AN000; 624 ****************** warning: proc Delete_FSeek... [-w+user] 625 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 0 00002D71 36F606[0000]80 TEST byte [ss:FastSeekflg],Fast_yes ; Fastseek installed ? ;AN000; 0 00002D77 740D JZ fs_no2 ; no ;AN000; 0 00002D79 51 PUSH CX ; save regs ;AN000; 0 00002D7A 52 PUSH DX ;AN000; 0 00002D7B 89D9 MOV CX,BX ; first cluster # ;AN000; 0 00002D7D 268A5600 MOV DL,[ES:BP + dpb_drive] ; drive # ;AN000; 0 00002D81 E8DFFF CALL FastSeek_Delete ; call fastseek to delete an entry ;AN000; 0 00002D84 5A POP DX ; restore regs ;AN000; 0 00002D85 59 POP CX ;AN000; 635 fs_no2: ;AN000; 0 00002D86 C3 return ; exit ;AN000; 637 EndProc Delete_FSeek ;AN000; 638 639 Break 640 641 ; Inputs: 642 ; FSeek_drive : drive number (0=A,1=B,,,) 643 ; FSeek_firclus: first cluster # 644 ; FSeek_logclus: logical cluster # 645 ; Function: 646 ; Look up a physical cluster # 647 ; Outputs: 648 ; carry clear, DI = physical cluster #, FSeek_logsave=DI-1 649 ; carry set, 650 ; partially found, DI=last physical cluster # 651 ; FSeek_logsave=last logical cluster # 652 653 procedure FastSeek_Lookup,NEAR ;AN000; 653 ****************** warning: proc FastSeek_Lookup... [-w+user] 654 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 655 0 00002D87 50 PUSH AX ; save ax ;AN000; 0 00002D88 B00E MOV AL,FSEC_lookup ; al = 14 ;AN000; 0 00002D8A 53 PUSH BX ; save bx ;AN000; 0 00002D8B E82900 CALL FS_doit ; call fastseek ;AN000; 0 00002D8E 36891E[0000] MOV [ss:FSeek_logsave],BX ; save returned BX ;AN000; 0 00002D93 5B POP BX ; restore bx ;AN000; 0 00002D94 58 POP AX ; restore ax ;AN000; 0 00002D95 C3 return ;AN000; 664 EndProc FastSeek_Lookup ;AN000; 665 ;AN000; 666 667 Break 668 669 ; Inputs: 670 ; FSeek_drive : drive number (0=A,1=B,,,) 671 ; FSeek_firclus: first cluster # 672 ; FSeek_logclus: logical cluster # 673 ; DI: physical cluster # to be inserted 674 ; Function: 675 ; insert a physical cluster # 676 ; Outputs: 677 ; none 678 ; 679 680 procedure FastSeek_Insert,NEAR 680 ****************** warning: proc FastSeek_Insert... [-w+user] 681 ASSUME DS:NOTHING,ES:NOTHING 682 0 00002D96 36F606[0000]02 TEST byte [ss:FastSeekflg],FS_insert ; insert mode set ? ;AN000; 0 00002D9C 7409 JZ no_insert ; no ;AN000; 685 ;AN000; 0 00002D9E 50 PUSH AX ; save regs ;AN000; 0 00002D9F 53 PUSH BX ;AN000; 0 00002DA0 B00F MOV AL,FSEC_insert ; al = 15 ;AN000; 689 FSentry: ;AN000; 0 00002DA2 E81200 CALL FS_doit ; call fastseek ;AN000; 0 00002DA5 5B POP BX ; restore regs ;AN000; 0 00002DA6 58 POP AX ;AN000; 693 no_insert: 0 00002DA7 C3 return 695 EndProc FastSeek_insert 696 697 Break 698 699 ; Inputs: 700 ; FSeek_drive : drive number (0=A,1=B,,,) 701 ; FSeek_firclus: first cluster # 702 ; FSeek_logclus: logical cluster # 703 ; Function: 704 ; truncate physical cluster #s starting from FSeek_logclus 705 ; Outputs: 706 ; none 707 ; 708 709 procedure FastSeek_Truncate,NEAR 709 ****************** warning: proc FastSeek_Truncate... [-w+user] 710 ASSUME DS:NOTHING,ES:NOTHING 711 ;AN000; 0 00002DA8 36F606[0000]80 TEST byte [ss:FastSeekflg],Fast_yes ; Fastseek installed ? ;AN000; 0 00002DAE 7406 JZ fs_no ; no ;AN000; 0 00002DB0 50 PUSH AX ; save regs ;AN000; 0 00002DB1 53 PUSH BX ;AN000; 0 00002DB2 B010 MOV AL,FSEC_truncate ; al = 16 ;AN000; 0 00002DB4 EBEC JMP FSentry ; call fastseek ;AN000; 718 fs_no: ;AN000; 0 00002DB6 C3 return ;AN000; 720 EndProc FastSeek_Truncate ;AN000; 721 722 ; Inputs: 723 ; FSeek_drive : drive number (0=A,1=B,,,) 724 ; FSeek_firclus: first cluster # 725 ; FSeek_logclus: logical cluster # 726 ; Function: 727 ; set up parameters and call fastseek 728 ; Outputs: 729 ; outputs of fastseek 730 ; 731 procedure FS_doit,NEAR 731 ****************** warning: proc FS_doit... [-w+user] 732 ASSUME DS:NOTHING,ES:NOTHING 733 ;AN000; 0 00002DB7 51 PUSH CX ; save regs ;AN000; 0 00002DB8 52 PUSH DX ;AN000; 0 00002DB9 56 PUSH SI ;AN000; 0 00002DBA 368A16[0000] MOV DL,[ss:FSeek_drive] ; set drive # ;AN000; 0 00002DBF 368B0E[0000] MOV CX,[ss:FSeek_firclus] ; set 1st cluster # ;AN000; 0 00002DC4 368B1E[0000] MOV BX,[ss:FSeek_logclus] ; set logical cluster # ;AN000; 740 ;AN000; 0 00002DC9 E873FF CALL FSeek_dispatch ; call fastseek ;AN000; 742 ;AN000; 743 ; carry clear if found in DI ;AN000; 0 00002DCC 5E POP SI ; otherwise, carry set ;AN000; 745 ;AN000; 0 00002DCD 5A POP DX ; restore regs ;AN000; 0 00002DCE 59 POP CX ;AN000; 0 00002DCF C3 return ;AN000; 749 EndProc FS_doit ;AN000; 750 751 752 ; Inputs: 753 ; same as DOS_SEARCH_FIRST 754 ; Function: 755 ; do a IFS search first 756 ; Outputs: 757 ; same as DOS_SEARCH_FIRST 758 ; 759 procedure IFS_SEARCH_FIRST,NEAR ;AN000; 759 ****************** warning: proc IFS_SEARCH_FIRST... [-w+user] 760 DOSAssume CS,,"IFS_SEARCH_FIRST" ;AN000; 761 ASSUME ES:NOTHING ;AN000; 762 763 ; MOV WORD PTR [DMAADD+2],DS ;IFS. replace with scratch area ;AN000;;AN000; 764 ; MOV WORD PTR [DMAADD],OFFSET RENAMEDMA wrt DOSGROUP ;IFS. ;AN000; 765 ; invoke SET_THISDPB ;IFS. THISDPB set ;AN000; 766 ; invoke DOS_SEARCH_FIRST ;IFS. search first ;AN000; 767 ; return ;AN000; 768 EndProc IFS_SEARCH_FIRST ;AN000; 769 770 771 ; Inputs: 772 ; THISDPB set 773 ; WFP_Start points to name 774 ; Function: 775 ; do a IFS REN_DEL_CHECK 776 ; Outputs: 777 ; same as REN_DEL_CHECK 778 ; 779 procedure IFS_REN_DEL_CHECK,NEAR ;AN000; 779 ****************** warning: proc IFS_REN_DEL_CHECK... [-w+user] 780 DOSAssume CS,,"IFS_REN_DEL_CHECK" ;AN000; 781 ASSUME ES:NOTHING ;AN000; 782 783 ; MOV AX,WORD PTR [DMAADD+2] ;IFS. set up ;AN000;;AN000; 784 ; MOV WORD PTR [CURBUF+2],AX ;IFS. curbuf+2 : bx -> dir entry ;AN000; 785 ; MOV BX,WORD PTR [DMAADD] ;IFS. ;AN000; 786 ; ADD BX,21 ;IFS. ;AN000; 787 ; MOV SI,BX ;IFS. curbuf+2:si -> dir_first ;AN000; 788 ; ADD SI,dir_first ;IFS. ;AN000; 789 ; EnterCrit critDisk ;IFS. enter critical section ;AN000; 790 ; CALL REN_DEL_Check ;IFS. share check ;AN000; 791 ; LeaveCrit critDisk ;IFS. leave critical section ;AN000; 792 ; return ;AN000; 793 EndProc IFS_REN_DEL_CHECK ;AN000; 794 795 END === Trace listing source: ../DOS/rename.lst 1 ; SCCSID = @(#)rename.asm 1.1 85/04/10 2 ;TITLE DOS_RENAME - Internal RENAME call for MS-DOS 3 ;NAME DOS_RENAME 4 ; Low level routine for renaming files 5 ; 6 ; DOS_RENAME 7 ; 8 ; Modification history: 9 ; 10 ; Created: ARR 30 March 1983 11 ; 12 13 ; 14 ; get the appropriate segment definitions 15 ; 16 [list -] 16 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 18 19 [list +] === Switch to base=002450h -> "DOSCODECODE" 20 section DOSCODECODE 21 [list -] 21 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 21 ****************** warning: out: BPB.INC... [-w+user] 21 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 21 ****************** warning: out: DEVSYM.INC... [-w+user] 28 29 %iassign Installed TRUE 30 31 i_need RENAMEDMA,BYTE 32 i_need AUXSTACK,BYTE 33 i_need DESTSTART,WORD 34 i_need DIRSTART,WORD 35 i_need CURBUF,DWORD 36 I_need NAME1,BYTE 37 i_need NAME2,BYTE 38 i_need WFP_START,WORD 39 i_need REN_WFP,WORD 40 i_need CURR_DIR_END,WORD 41 i_need DMAADD,DWORD 42 i_need THISCDS,DWORD 43 i_need THISDPB,DWORD 44 i_need THISSFT,DWORD 45 i_need CREATING,BYTE 46 i_need THISDRV,BYTE 47 i_need ATTRIB,BYTE 48 i_need FOUND_DEV,BYTE 49 i_need FAILERR,BYTE 50 i_need EXTERR_LOCUS,BYTE 51 i_need SAVE_BX,WORD 52 53 assume nocheck, ss:DOSGROUP 54 55 ; Inputs: 56 ; [WFP_START] Points to SOURCE WFP string ("d:/" must be first 3 57 ; chars, NUL terminated) 58 ; [CURR_DIR_END] Points to end of Current dir part of string [SOURCE] 59 ; ( = -1 if current dir not involved, else 60 ; Points to first char after last "/" of current dir part) 61 ; [REN_WFP] Points to DEST WFP string ("d:/" must be first 3 62 ; chars, NUL terminated) 63 ; [THISCDS] Points to CDS being used 64 ; (Low word = -1 if NUL CDS (Net direct request)) 65 ; [SATTRIB] Is attribute of search, determines what files can be found 66 ; Function: 67 ; Rename the specified file(s) 68 ; NOTE: This routine uses most of AUXSTACK as a temp buffer. 69 ; Outputs: 70 ; CARRY CLEAR 71 ; OK 72 ; CARRY SET 73 ; AX is error code 74 ; error_file_not_found 75 ; No match for source, or dest path invalid 76 ; error_not_same_device 77 ; Source and dest are on different devices 78 ; error_access_denied 79 ; Directory specified (not simple rename), 80 ; Device name given, Destination exists. 81 ; NOTE: In third case some renames may have 82 ; been done if metas. 83 ; error_path_not_found 84 ; Bad path (not in curr dir part if present) 85 ; SOURCE ONLY 86 ; error_bad_curr_dir 87 ; Bad path in current directory part of path 88 ; SOURCE ONLY 89 ; error_sharing_violation 90 ; Deny both access required, generates an INT 24. 91 ; DS preserved, others destroyed 92 93 procedure DOS_RENAME,NEAR 93 ****************** warning: proc DOS_RENAME... [-w+user] 94 DOSAssume CS,,"DOS_Rename" 95 ASSUME ES:NOTHING 96 0 00002DD0 E8[0000] Invoke TestNet 0 00002DD3 7306 JNC LOCAL_RENAME 99 ; invoke OWN_SHARE2 ;IFS. IFS owns share ? ;AN000; 100 ; JZ ifsshare ;IFS. yes ;AN000; 101 ; PUSH WORD PTR [DMAADD+2] ;IFS. save DMAADD ;AN000; 102 ; PUSH WORD PTR [DMAADD] ;IFS. ;AN000; 103 ; 104 ; invoke IFS_SEARCH_FIRST ;IFS. search source name ;AN000; 105 ; JC nofiles ;IFS. not found ;AN000; 106 rename_next_file: 107 ; invoke IFS_REN_DEL_CHECK ;IFS. do share check ;AN000; 108 ; JNC share_okok ;IFS. share ok ;AN000; 109 ; MOV AX,error_sharing_violation ;IFS. share error ;AN000; 110 ; JMP SHORT nofiles ;IFS. ;AN000; 111 share_okok: 112 ; PUSH CS ;IFS. ;AN000; 113 ; POP ES ;IFS. ;AN000; 114 ; MOV SI,[REN_WFP] ;IFS. ds:si -> destination name ;AN000; 115 ; MOV BX,SI ;IFS. ;AN000; 116 fndnxt: ;IFS. ;AN000; 117 ; LODSB ;IFS. ;AN000; 118 ; CMP AL,0 ;IFS. ;AN000; 119 ; JNZ fndnxt ;IFS. ;AN000; 120 ; MOV DI,SI ;IFS. es:di -> end of destinatio ;AN000; 121 ; ADD BX,2 ;IFS. ;AN000; 122 ; invoke SkipBack ;IFS. ;AN000; 123 ; INC DI ;IFS. es:di -> last component of ;AN000; 124 ; MOV SI,DI ;IFS. dstination ;AN000; 125 ; MOV BX,[SAVE_BX] ;IFS. ds:bx -> last component of ;AN000; 126 ; CALL NEW_RENAME ;IFS. source ;AN000; 127 ; MOV AX,(multNET SHL 8) OR 17 ;IFS. replace ? chars with ;AN000; 128 ; INT 2FH ;IFS. source and issue RENAME ;AN000; 129 ; JC nofiles ;IFS. error ;AN000; 130 ; invoke DOS_SEARCH_NEXT ;IFS. serch next source ;AN000; 131 ; JNC rename_next_file ;IFS. rename next ;AN000; 132 ; CLC ;IFS. no more files ;AN000; 133 nofiles: 134 ; POP WORD PTR [DMAADD] ;IFS. restore DMAADD ;AN000; 135 ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; 136 ; ret ;IFS. return ;AN000; 137 ifsshare: 138 139 %IFN Installed 140 transfer NET_RENAME 141 %ELSE 142 multNET equ MultNET ; NASM port equate 0 00002DD5 B81111 MOV AX,(multNET << 8) | 17 0 00002DD8 CD2F INT 2FH 0 00002DDA C3 return 146 %ENDIF 147 148 LOCAL_RENAME: 0 00002DDB C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 00002DE0 8B36[0000] MOV SI,[WFP_START] 0 00002DE4 8B3E[0000] MOV DI,[REN_WFP] 0 00002DE8 8A04 MOV AL,BYTE PTR [SI] 0 00002DEA 8A25 MOV AH,BYTE PTR [DI] 0 00002DEC 0D2020 OR AX,2020H ; Lower case 0 00002DEF 38E0 CMP AL,AH 0 00002DF1 7405 JZ SAMEDRV 0 00002DF3 B81100 MOV AX,error_not_same_device 0 00002DF6 F9 STC 0 00002DF7 C3 return 160 161 SAMEDRV: 0 00002DF8 FF36[0200] PUSH WORD PTR [DMAADD+2] 0 00002DFC FF36[0000] PUSH WORD PTR [DMAADD] 0 00002E00 8C1E[0200] MOV WORD PTR [DMAADD+2],DS 0 00002E04 C706[0000][0000] MOV WORD PTR [DMAADD],OFFSET RENAMEDMA wrt DOSGROUP 166 Found_dev equ FOUND_DEV ; NASM port label 0 00002E0A C606[0000]00 MOV byte [Found_dev],0 ; Rename fails on DEVS, assume not a dev 0 00002E0F E8[0000] EnterCrit critDisk 0 00002E12 E8[0000] invoke DOS_SEARCH_FIRST ; Sets [NoSetDir] to 1, [CURBUF+2]:BX 170 ; points to entry 171 Check_Dev equ Check_dev ; NASM port label 0 00002E15 7315 JNC Check_Dev 0 00002E17 83F812 CMP AX,error_no_more_files 0 00002E1A 7503 JNZ GOTERR 0 00002E1C B80200 MOV AX,error_file_not_found 176 GOTERR: 0 00002E1F F9 STC 178 RENAME_POP: 0 00002E20 8F06[0000] POP WORD PTR [DMAADD] 0 00002E24 8F06[0200] POP WORD PTR [DMAADD+2] 0 00002E28 E8[0000] LeaveCrit critDisk 0 00002E2B C3 return 183 184 Check_dev: 0 00002E2C B80500 MOV AX,error_access_denied ; Assume error 186 0 00002E2F 1E PUSH DS ;PTM. ;AN000; 0 00002E30 C536[0000] LDS SI,[DMAADD] ;PTM. chek if source a dir ;AN000; 189 assume ds:DOSGROUP 190 ; lDOS note: This code actually exists in MS-DOS v5 191 ; and v7.10 unchanged. DS happens to be DOSGROUP here 192 ; because DMAADD was overwritten before this. 0 00002E34 83C615 ADD SI,find_buf_attr ;PTM. ;AN000; 0 00002E37 F6440B10 TEST byte [SI + dir_attr],attr_directory ;PTM. ;AN000; 0 00002E3B 7407 JZ notdir ;PTM. ;AN000; 0 00002E3D 8B36[0000] MOV SI,[REN_WFP] ;PTM. if yes, make sure path ;AN000; 0 00002E41 E8[0000] invoke Check_Pathlen2 ;PTM. length < 67 ;AN000; 198 notdir: 0 00002E44 1F POP DS ;PTM. ;AN000; 200 assume ds:DOSGROUP 0 00002E45 77D8 JA GOTERR ;PTM. ;AN000; 202 0 00002E47 803E[0000]00 CMP byte [Found_dev],0 0 00002E4C 75D1 JNZ GOTERR 205 ; At this point a source has been found. There is search continuation info (a 206 ; la DOS_SEARCH_NEXT) for the source at RENAMEDMA, together with the first 207 ; directory entry found. 208 ; [THISCDS], [THISDPB], and [THISDRV] are set and will remain correct 209 ; throughout the RENAME since it is known at this point that the source and 210 ; destination are both on the same device. 211 ; [SATTRIB] is also set. 0 00002E4E 89DE MOV SI,BX 0 00002E50 83C61A ADD SI,dir_first 0 00002E53 E8[0000] invoke REN_DEL_Check 0 00002E56 7305 JNC REN_OK1 0 00002E58 B82000 MOV AX,error_sharing_violation 0 00002E5B EBC3 JMP RENAME_POP 218 219 REN_OK1: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 0 00002E5D E8[0000] invoke FastOpen_Delete ; delete dir info in fastopen DOS 3.3 0 00002E60 8B36[0000] MOV SI,[REN_WFP] ; Swap source and destination 0 00002E64 8936[0000] MOV [WFP_START],SI 0 00002E68 C706[0000]FFFF MOV word [CURR_DIR_END],-1 ; No current dir on dest 0 00002E6E C706[0000]FFE5 MOV WORD PTR [CREATING],0E5FFH ; Creating, not DEL *.* 225 ; A rename is like a CREATE_NEW as far 226 ; as the destination is concerned. 0 00002E74 E8[0000] invoke GetPathNoSet 228 ; If this Getpath fails due to file not found, we know all renames will work 229 ; since no files match the destination name. If it fails for any other 230 ; reason, the rename fails on a path not found, or whatever (also fails if 231 ; we find a device or directory). If the Getpath succeeds, we aren't sure 232 ; if the rename should fail because we haven't built an explicit name by 233 ; substituting for the meta chars in it. In this case the destination file 234 ; spec with metas is in [NAME1] and the explicit source name is at RENAMEDMA 235 ; in the directory entry part. 0 00002E77 7221 JC NODEST 237 ;; JZ BAD_ACC ; Dest string is a directory ;AC000; 0 00002E79 08E4 OR AH,AH ; Device? 0 00002E7B 7931 JNS SAVEDEST ; No, continue 240 BAD_ACC: 0 00002E7D B80500 MOV AX,error_access_denied 0 00002E80 F9 STC 243 RENAME_CLEAN: 0 00002E81 9C PUSHF ; Save carry state 0 00002E82 50 PUSH AX ; and error code (if carry set) 0 00002E83 A0[0000] MOV AL,[THISDRV] 0 00002E86 E8[0000] invoke FLUSHBUF 0 00002E89 58 POP AX 0 00002E8A 803E[0000]00 CMP byte [FAILERR],0 0 00002E8F 7503 JNZ BAD_ERR ; User FAILed to I 24 0 00002E91 9D POPF 0 00002E92 EB8C JMP RENAME_POP 253 254 BAD_ERR: 0 00002E94 58 POP AX ; Saved flags 0 00002E95 B80300 MOV AX,error_path_not_found 0 00002E98 EB85 JMP GOTERR 258 259 NODEST: 0 00002E9A 750B JNZ BAD_PATH 0 00002E9C 803E[0000]00 CMP byte [FAILERR],0 0 00002EA1 7504 JNZ BAD_PATH ; Search for dest failed because user FAILed on 263 ; I 24 0 00002EA3 08C9 OR CL,CL 0 00002EA5 7507 JNZ SAVEDEST 266 BAD_PATH: 0 00002EA7 B80300 MOV AX,error_path_not_found 0 00002EAA F9 STC 0 00002EAB E972FF JMP RENAME_POP 270 271 SAVEDEST: 0 00002EAE 1607 Context ES 0 00002EB0 BF[0000] MOV DI,OFFSET NAME2 wrt DOSGROUP 0 00002EB3 BE[0000] MOV SI,OFFSET NAME1 wrt DOSGROUP 0 00002EB6 B90B00 MOV CX,11 0 00002EB9 F3A4 REP MOVSB ; Save dest with metas at NAME2 0 00002EBB A1[0000] MOV AX,[DIRSTART] 0 00002EBE A3[0000] MOV [DESTSTART],AX 279 BUILDDEST: 0 00002EC1 1607 Context ES ; needed due to JMP BUILDDEST below 0 00002EC3 BB[1500] MOV BX,OFFSET RENAMEDMA + 21 wrt DOSGROUP ; Source of replace chars 0 00002EC6 BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP ; Real dest name goes here 0 00002EC9 BE[0000] MOV SI,OFFSET NAME2 wrt DOSGROUP ; Raw dest 0 00002ECC B90B00 MOV CX,11 0 00002ECF E8F400 CALL NEW_RENAME ;IFS. replace ? chars ;AN000; 286 0 00002ED2 C606[0000]16 MOV byte [ATTRIB],attr_all ; Stop duplicates with any attributes 0 00002ED7 C606[0000]FF MOV byte [CREATING],0FFH 0 00002EDC E8[0000] invoke DEVNAME ; Check if we built a device name 290 ASSUME ES:NOTHING 0 00002EDF 739C JNC BAD_ACC 0 00002EE1 8B1E[0000] MOV BX,[DESTSTART] 0 00002EE5 C42E[0000] LES BP,[THISDPB] 0 00002EE9 E8[0000] invoke SetDirSrch ; Reset search to start of dir 0 00002EEC 728F JC BAD_ACC ; Screw up 0 00002EEE E8[0000] invoke FINDENTRY ; See if new name already exists 0 00002EF1 738A JNC BAD_ACC ; Error if found 0 00002EF3 803E[0000]00 CMP byte [FAILERR],0 0 00002EF8 752A JNZ BAD_ACCJ ; Find failed because user FAILed to I 24 0 00002EFA A1[0000] MOV AX,[DESTSTART] ; DIRSTART of dest 0 00002EFD 3B06[0F00] CMP AX,WORD PTR [RENAMEDMA + 15] ; DIRSTART of source 0 00002F01 745D JZ SIMPLE_RENAME ; If =, just give new name 303 0 00002F03 A0[2000] MOV AL,[RENAMEDMA + 21 + dir_attr] 0 00002F06 A810 TEST AL,attr_directory 0 00002F08 751A JNZ BAD_ACCJ ; Can only do a simple rename on dirs, 307 ; otherwise the . and .. entries get 308 ; wiped. 0 00002F0A A2[0000] MOV [ATTRIB],AL 0 00002F0D 8C1E[0200] MOV WORD PTR [THISSFT+2],DS 311 SF_ENTRY_struc_size equ sf_entry_struc_size ; NASM port equate 0 00002F11 BE[C5FF] MOV SI,OFFSET AUXSTACK - SF_ENTRY_struc_size wrt DOSGROUP 0 00002F14 8936[0000] MOV WORD PTR [THISSFT],SI 0 00002F18 C744020200 MOV word [SI + sf_mode],sharing_compat+open_for_both 0 00002F1D 31C9 XOR CX,CX ; Set "device ID" for call into makenode 0 00002F1F E8[0000] invoke RENAME_MAKE ; This is in mknode 0 00002F22 7303 JNC GOT_DEST 318 BAD_ACCJ: 0 00002F24 E956FF JMP BAD_ACC 320 321 GOT_DEST: 0 00002F27 53 SaveReg 323 ThisSFT equ THISSFT ; NASM port label 0 00002F28 C43E[0000] LES DI,[ThisSFT] ; Rename_make entered this into sharing 0 00002F2C E8[0000] Invoke ShareEnd ; we need to remove it. 0 00002F2F 5B RestoreReg 327 ; A zero length entry with the correct new name has now been made at 328 ; [CURBUF+2]:BX. 0 00002F30 C43E[0000] LES DI,[CURBUF] 330 Assert ISBUF,,"Got_Dest" 331 0 00002F34 26F6450540 TEST byte [ES:DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00002F39 7508 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 00002F3B E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00002F3E 26804D0540 OR byte [ES:DI + buf_flags],buf_dirty 336 yesdirty: 0 00002F43 89DF MOV DI,BX 0 00002F45 83C70B ADD DI,dir_attr ; Skip name 0 00002F48 BE[2000] MOV SI,OFFSET RENAMEDMA + 21 + dir_attr wrt DOSGROUP 0 00002F4B B91500 MOV CX,(dir_entry_struc_size) - dir_attr 0 00002F4E F3A4 REP MOVSB 0 00002F50 E85B00 CALL GET_SOURCE 0 00002F53 7255 JC RENAME_OVER 0 00002F55 89DF MOV DI,BX 0 00002F57 8E06[0200] MOV ES,WORD PTR [CURBUF+2] 346 assume es:nothing 0 00002F5B B0E5 MOV AL,0E5H 0 00002F5D AA STOSB ; "free" the source 0 00002F5E EB13 JMP SHORT DIRTY_IT 350 351 SIMPLE_RENAME: 0 00002F60 E84B00 CALL GET_SOURCE ; Get the source back 0 00002F63 7245 JC RENAME_OVER 0 00002F65 89DF MOV DI,BX 0 00002F67 8E06[0200] MOV ES,WORD PTR [CURBUF+2] 356 assume es:nothing 0 00002F6B BE[0000] MOV SI,OFFSET NAME1 wrt DOSGROUP ; New Name 0 00002F6E B90B00 MOV CX,11 0 00002F71 F3A4 REP MOVSB 360 DIRTY_IT: 0 00002F73 8B3E[0000] MOV DI,WORD PTR [CURBUF] 362 0 00002F77 26F6450540 TEST byte [ES:DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00002F7C 7508 JNZ yesdirty2 ;LB. don't increment dirty count ;AN000; 0 00002F7E E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00002F81 26804D0540 OR byte [ES:DI + buf_flags],buf_dirty 367 yesdirty2: 368 Assert ISBUF,,"Dirty_it" 369 NEXT_SOURCE: 0 00002F86 BE[0100] MOV SI,OFFSET RENAMEDMA + 1 wrt DOSGROUP ;Name 371 ; 372 ; WARNING! Rename_Next leaves the disk critical section *ALWAYS*. We need 373 ; to enter it before going to RENAME_Next. 374 ; 0 00002F89 E8[0000] EnterCrit critDisk 0 00002F8C C606[0000]00 MOV byte [CREATING],0 ; Correct setting for search (we changed it 377 ; to FF when we made the prev new file). 0 00002F91 E8[0000] invoke RENAME_NEXT 379 ; 380 ; Note, now, that we have exited the previous ENTER and so are back to where 381 ; we were before. 382 ; 0 00002F94 7214 JC RENAME_OVER 384 dir_First equ dir_first ; NASM port equate 0 00002F96 8D771A LEA SI,[BX + dir_First] 0 00002F99 E8[0000] invoke REN_DEL_Check 0 00002F9C 7306 JNC REN_OK2 0 00002F9E B82000 MOV AX,error_sharing_violation 0 00002FA1 E9DDFE JMP RENAME_CLEAN 390 391 REN_OK2: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 0 00002FA4 E8[0000] invoke FastOpen_Delete ; delete dir info in fastopen DOS 3.3 0 00002FA7 E917FF JMP BUILDDEST 394 395 RENAME_OVER: 0 00002FAA F8 CLC 0 00002FAB E9D3FE JMP RENAME_CLEAN 398 399 ; Inputs: 400 ; RENAMEDMA has source info 401 ; Function: 402 ; Re-find the source 403 ; Output: 404 ; [CURBUF] set 405 ; [CURBUF+2]:BX points to entry 406 ; Carry set if error (currently user FAILed to I 24) 407 ; DS preserved, others destroyed 408 409 GET_SOURCE: 410 DOSAssume CS,,"Get_Source" 411 ASSUME ES:NOTHING 412 0 00002FAE 8B1E[0F00] MOV BX,WORD PTR [RENAMEDMA + 15] ; DirStart 414 ThisDPB equ THISDPB ; NASM port label 0 00002FB2 C42E[0000] LES BP,[ThisDPB] 0 00002FB6 E8[0000] invoke SetDirSrch 0 00002FB9 7301C3 retc 0 00002FBC E8[0000] invoke StartSrch 0 00002FBF A1[0D00] MOV AX,WORD PTR [RENAMEDMA + 13] ; Lastent 0 00002FC2 E8[0000] invoke GetEnt 0 00002FC5 C3 return 422 423 EndProc DOS_RENAME 424 425 ;Input: DS:SI -> raw string with ? 426 ; ES:DI -> destination string 427 ; DS:BX -> source string 428 ;Function: replace ? chars of raw string with chars in source string and 429 ; put in destination string 430 ;Output: ES:DI-> new string 431 432 433 434 procedure NEW_RENAME,NEAR 434 ****************** warning: proc NEW_RENAME... [-w+user] 435 DOSAssume CS,,"DOS_Rename" 436 ASSUME ES:NOTHING 437 NEWNAM: 0 00002FC6 AC LODSB 0 00002FC7 3C3F CMP AL,"?" 0 00002FC9 7502 JNZ NOCHG 0 00002FCB 8A07 MOV AL,[BX] ; Get replace char 442 NOCHG: 0 00002FCD AA STOSB 0 00002FCE 43 INC BX ; Next replace char 0 00002FCF E2F5 LOOP NEWNAM 0 00002FD1 C3 return 447 448 EndProc NEW_RENAME 449 450 END === Trace listing source: ../DOS/finfo.lst 1 ; SCCSID = @(#)finfo.asm 1.1 85/04/11 2 ;TITLE FILE_INFO - Internal Get/Set File Info routines 3 ;NAME FILE_INFO 4 ; Low level routines for returning file information and setting file 5 ; attributes 6 ; 7 ; GET_FILE_INFO 8 ; SET_FILE_ATTRIBUTE 9 ; 10 ; Modification history: 11 ; 12 ; Created: ARR 30 March 1983 13 ; 14 15 ; 16 ; get the appropriate segment definitions 17 ; 18 [list -] 18 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 32 33 %iassign Installed TRUE 34 35 i_need THISCDS,DWORD 36 i_need CURBUF,DWORD 37 i_need NoSetDir,BYTE 38 i_need THISDRV,BYTE 39 I_need EXTERR_CLASS,BYTE 40 I_need EXTERR_ACTION,BYTE 41 I_need EXTERR_LOCUS,BYTE 42 i_need DMAADD,DWORD 43 i_need FastOpenFlg,BYTE 44 45 assume nocheck, ss:DOSGROUP 46 47 ;SUBTTL GET_FILE_INFO -- Get File Information 48 ;PAGE 49 50 ; Inputs: 51 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 52 ; terminated) 53 ; [CURR_DIR_END] Points to end of Current dir part of string 54 ; ( = -1 if current dir not involved, else 55 ; Points to first char after last "/" of current dir part) 56 ; [THISCDS] Points to CDS being used 57 ; (Low word = -1 if NUL CDS (Net direct request)) 58 ; [SATTRIB] Is attribute of search, determines what files can be found 59 ; Function: 60 ; Get Information about a file 61 ; Returns: 62 ; CARRY CLEAR 63 ; AX = Attribute of file 64 ; CX = Time stamp of file 65 ; DX = Date stamp of file 66 ; BX:DI = Size of file (32 bit) 67 ; CARRY SET 68 ; AX is error code 69 ; error_file_not_found 70 ; Last element of path not found 71 ; error_path_not_found 72 ; Bad path (not in curr dir part if present) 73 ; error_bad_curr_dir 74 ; Bad path in current directory part of path 75 ; DS preserved, others destroyed 76 77 procedure GET_FILE_INFO,NEAR 77 ****************** warning: proc GET_FILE_INFO... [-w+user] 78 DOSAssume CS,,"Get_File_Info" 79 ASSUME ES:NOTHING 80 0 00002FD2 E8[0000] Invoke TestNet 82 Local_Info equ LOCAL_INFO ; NASM port label 0 00002FD5 7306 JNC Local_Info 84 ; invoke OWN_SHARE2 ;IFS. IFS owns share ? ;AN000; 85 ; JZ ifsshare ;IFS. yes ;AN000; 86 ; PUSH WORD PTR [DMAADD+2] ;IFS. save DMAADD ;AN000; 87 ; PUSH WORD PTR [DMAADD] ;IFS. ;AN000; 88 ; invoke IFS_SEARCH_FIRST ;IFS. do search first ;AN000; 89 ; JC nofiles ;IFS. file not existing ;AN000; 90 delete_next_file: ;IFS. ;AN000; 91 ; invoke IFS_REN_DEL_CHECK ;IFS. do REN_DEL_CHECK ;AN000; 92 ; JNC share_okok ;IFS. share ok ;AN000; 93 ; MOV AX,error_sharing_violation ;IFS. share violation ;AN000; 94 ; JMP SHORT nofiles ;IFS. ;AN000; 95 share_okok: 96 ; POP WORD PTR [DMAADD] ;IFS. retor DMAADD ;AN000; 97 ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; 98 ifsshare: 99 %IFN Installed 100 transfer NET_GET_FILE_INFO 101 %ELSE 102 multNET equ MultNET ; NASM port equate 0 00002FD7 B80F11 MOV AX,(multNET << 8) | 15 0 00002FDA CD2F INT 2FH 0 00002FDC C3 return 106 %ENDIF 107 nofiles: 108 ; POP WORD PTR [DMAADD] ;IFS. retor DMAADD ;AN000; 109 ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; 110 ; ret ;IFS. return 111 112 LOCAL_INFO: 0 00002FDD E8[0000] EnterCrit critDisk 0 00002FE0 C606[0000]01 MOV byte [NoSetDir],1 ; if we find a dir, don't change to it 0 00002FE5 E8[0000] invoke Get_FAST_PATH 116 info_check: 0 00002FE8 7313 JNC info_check_dev 118 119 NO_PATH: 120 DOSAssume CS,,"FINFO/No_Path" 121 ASSUME ES:NOTHING 122 0 00002FEA 750C JNZ bad_path 0 00002FEC 08C9 OR CL,CL 0 00002FEE 7408 JZ bad_path 126 info_no_file: 0 00002FF0 B80200 MOV AX,error_file_not_found 128 BadRet: 0 00002FF3 F9 STC 130 justRet: 0 00002FF4 E8[0000] LeaveCrit critDisk 0 00002FF7 C3 return 133 134 bad_path: 0 00002FF8 B80300 MOV AX,error_path_not_found 0 00002FFB EBF6 jmp BadRet 137 138 info_check_dev: 0 00002FFD 08E4 OR AH,AH 0 00002FFF 78EF JS info_no_file ; device 0 00003001 1E PUSH DS 0 00003002 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 143 ASSUME DS:NOTHING 0 00003006 89DE MOV SI,BX 0 00003008 31DB XOR BX,BX ; Assume size=0 (dir) 0 0000300A 89DF MOV DI,BX 0 0000300C 8B4C16 MOV CX,[SI + dir_time] 0 0000300F 8B5418 MOV DX,[SI + dir_date] 0 00003012 30E4 XOR AH,AH 0 00003014 8A440B MOV AL,[SI + dir_attr] 0 00003017 A810 TEST AL,attr_directory 0 00003019 7506 JNZ NO_SIZE 0 0000301B 8B7C1C MOV DI,[SI + dir_size_l] 0 0000301E 8B5C1E MOV BX,[SI + dir_size_h] 155 NO_SIZE: 0 00003021 1F POP DS 157 assume ds:DOSGROUP 0 00003022 F8 CLC 159 JustRet equ justRet ; NASM port label 0 00003023 EBCF jmp JustRet 161 EndProc GET_FILE_INFO 162 163 Break 164 165 ; Inputs: 166 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 167 ; terminated) 168 ; [CURR_DIR_END] Points to end of Current dir part of string 169 ; ( = -1 if current dir not involved, else 170 ; Points to first char after last "/" of current dir part) 171 ; [THISCDS] Points to CDS being used 172 ; (Low word = -1 if NUL CDS (Net direct request)) 173 ; [SATTRIB] is attribute of search (determines what files may be found) 174 ; AX is new attributes to give to file 175 ; Function: 176 ; Set File Attributes 177 ; Returns: 178 ; CARRY CLEAR 179 ; No error 180 ; CARRY SET 181 ; AX is error code 182 ; error_file_not_found 183 ; Last element of path not found 184 ; error_path_not_found 185 ; Bad path (not in curr dir part if present) 186 ; error_bad_curr_dir 187 ; Bad path in current directory part of path 188 ; error_access_denied 189 ; Attempt to set an attribute which cannot be set 190 ; (attr_directory, attr_volume_ID) 191 ; error_sharing_violation 192 ; Sharing mode of file did not allow the change 193 ; (this request requires exclusive write/read access) 194 ; (INT 24H generated) 195 ; DS preserved, others destroyed 196 197 procedure SET_FILE_ATTRIBUTE,NEAR 197 ****************** warning: proc SET_FILE_ATTRIBUTE... [-w+user] 198 DOSAssume CS,,"Set_File_Attribute" 199 ASSUME ES:NOTHING 200 0 00003025 A9D8FF TEST AX,~ attr_changeable 0 00003028 7414 JZ set_look 203 BAD_ACC: 204 ExtErr_Locus equ EXTERR_LOCUS ; NASM port label 205 errLoc_UNK equ errLOC_Unk ; NASM port equate 0 0000302A C606[0000]01 MOV byte [ExtErr_Locus],errLoc_UNK 207 ExtErr_Class equ EXTERR_CLASS ; NASM port label 208 errClass_Apperr equ errCLASS_Apperr ; NASM port equate 0 0000302F C606[0000]07 MOV byte [ExtErr_Class],errClass_Apperr 210 ExtErr_Action equ EXTERR_ACTION ; NASM port label 211 errAct_Abort equ errACT_Abort ; NASM port equate 0 00003034 C606[0000]04 MOV byte [ExtErr_Action],errAct_Abort 0 00003039 B80500 MOV AX,error_access_denied 0 0000303C F9 STC 0 0000303D C3 return 216 217 set_look: 0 0000303E E8[0000] Invoke TestNet 219 Local_Set equ LOCAL_SET ; NASM port label 0 00003041 7308 JNC Local_Set 221 222 %IFN Installed 223 transfer NET_SEQ_SET_FILE_ATTRIBUTE 224 %ELSE 0 00003043 50 PUSH AX 0 00003044 B80E11 MOV AX,(multNET << 8) | 14 0 00003047 CD2F INT 2FH 0 00003049 5B POP BX ; clean stack 0 0000304A C3 return 230 %ENDIF 231 232 LOCAL_SET: 0 0000304B E8[0000] EnterCrit critDisk 0 0000304E 50 PUSH AX ; Save new attributes 0 0000304F C606[0000]01 MOV byte [NoSetDir],1 ; if we find a dir, don't change to it 0 00003054 E8[0000] invoke GetPath ; get path through fastopen if there ;AC000; 0 00003057 7303 JNC set_check_device 0 00003059 5B POP BX ; Clean stack (don't zap AX) 0 0000305A EB8E JMP NO_PATH 240 241 set_check_device: 0 0000305C 08E4 OR AH,AH 0 0000305E 7906 JNS set_check_share 0 00003060 58 POP AX 0 00003061 E8[0000] LeaveCrit critDisk 0 00003064 EBC4 JMP BAD_ACC ; device 247 248 set_check_share: 0 00003066 58 POP AX ; Get new attributes 0 00003067 E8[0000] invoke REN_DEL_Check 0 0000306A 7305 JNC set_do 0 0000306C B82000 MOV AX,error_sharing_violation 253 ok_bye equ OK_BYE ; NASM port label 0 0000306F EB34 jmp short ok_bye 255 256 set_do: 0 00003071 C43E[0000] LES DI,[CURBUF] 0 00003075 2680670BD8 AND BYTE PTR [ES:BX + dir_attr],~ attr_changeable 0 0000307A 2608470B OR BYTE PTR [ES:BX + dir_attr],AL 260 0 0000307E 26F6450540 TEST byte [ES:DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00003083 7508 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 00003085 E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00003088 26804D0540 OR byte [ES:DI + buf_flags],buf_dirty 265 yesdirty: 0 0000308D A0[0000] MOV AL,[THISDRV] 267 ;;;; 10/1/86 F.C update fastopen cache 0 00003090 52 PUSH DX 0 00003091 57 PUSH DI 0 00003092 B400 MOV AH,0 ; dir entry update 0 00003094 88C2 MOV DL,AL ; drive number A=0,B=1,, 0 00003096 89DF MOV DI,BX ; ES:DI -> dir entry 0 00003098 E8[0000] invoke FastOpen_Update 0 0000309B 5F POP DI 0 0000309C 5A POP DX 276 ;;;; 9/11/86 F.C update fastopen cache 0 0000309D E8[0000] invoke FlushBuf 0 000030A0 7303 JNC OK_BYE 0 000030A2 B80200 MOV AX,error_file_not_found 280 OK_BYE: 0 000030A5 E8[0000] LeaveCrit critDisk 0 000030A8 C3 return 283 284 EndProc SET_FILE_ATTRIBUTE 285 286 287 288 procedure GET_FAST_PATH,NEAR 288 ****************** warning: proc GET_FAST_PATH... [-w+user] 289 ASSUME DS:NOTHING,ES:NOTHING 290 0 000030A9 36800E[0000]01 OR byte [ss:FastOpenFlg],FastOpen_Set ;FO. trigger fastopen ;AN000; 0 000030AF E8[0000] invoke GetPath 0 000030B2 9C PUSHF ;FO. ;AN000; 0 000030B3 368026[0000]80 AND byte [ss:FastOpenFlg],Fast_yes ;FO. clear all fastopen flags ;AN000; 0 000030B9 9D POPF ;FO. ;AN000; 0 000030BA C3 return 297 298 EndProc GET_FAST_PATH 299 300 END === Trace listing source: ../DOS/dup.lst 1 ; SCCSID = @(#)dup.asm 1.1 85/04/10 2 ; SCCSID = @(#)dup.asm 1.1 85/04/10 3 ;TITLE DOS_DUP - Internal SFT DUP (for network SFTs) 4 ;NAME DOS_DUP 5 ; Low level DUP routine for use by EXEC when creating a new process. Exports 6 ; the DUP to the server machine and increments the SFT ref count 7 ; 8 ; DOS_DUP 9 ; 10 ; Modification history: 11 ; 12 ; Created: ARR 30 March 1983 13 ; 14 15 ; 16 ; get the appropriate segment definitions 17 ; 18 [list -] 18 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 30 31 i_need THISSFT,DWORD 32 33 assume nocheck, ss:DOSGROUP 34 35 BREAK 36 37 ; Inputs: 38 ; [THISSFT] set to the SFT for the file being DUPed 39 ; (a non net SFT is OK, in this case the ref 40 ; count is simply incremented) 41 ; Function: 42 ; Signal to the devices that alogical open is occurring 43 ; Returns: 44 ; ES:DI point to SFT 45 ; Carry clear 46 ; SFT ref_count is incremented 47 ; Registers modified: None. 48 49 procedure DOS_DUP,NEAR 49 ****************** warning: proc DOS_DUP... [-w+user] 50 ASSUME ES:NOTHING,SS:NOTHING 51 52 extern doscode_getdosdata 53 54 ThisSFT equ THISSFT ; NASM port label 0 000030BB 97 xchg ax, di 0 000030BC E8[0000] call doscode_getdosdata 0 000030BF 8EC0 mov es, ax 58 assume es:DOSGROUP 0 000030C1 97 xchg ax, di 0 000030C2 26C43E[0000] LES DI,[es:ThisSFT] 61 Entry Dos_Dup_Direct 62 Assert ISSFT,,"DOSDup" 0 000030C7 E8[0000] invoke IsSFTNet 0 000030CA 7503 JNZ DO_INC 0 000030CC E8[0000] invoke DEV_OPEN_SFT 66 DO_INC: 67 Assert ISSFT,,"DOSDup/DoInc" 0 000030CF 26FF05 INC word [ES:DI + sf_ref_count] ; Clears carry (if this ever wraps 69 ; we're in big trouble anyway) 0 000030D2 C3 return 71 72 EndProc DOS_DUP 73 74 END === Trace listing source: ../DOS/create.lst 1 ; SCCSID = @(#)create.asm 1.6 85/08/19 2 ;TITLE DOS_CREATE/DOS_CREATE_NEW - Internal CREATE calls for MS-DOS 3 ;NAME DOS_CREATE 4 ; Internal Create and Create new to create a local or NET file and SFT. 5 ; 6 ; DOS_CREATE 7 ; DOS_CREATE_NEW 8 ; SET_MKND_ERR 9 ; SET_Media_ID 10 ; SET_EXT_Mode 11 ; 12 ; Revision history: 13 ; 14 ; A000 version 4.00 Jan. 1988 15 ; A001 D490 -- Change IOCTL subfunctios from 63h,43h to 66h, 46h 16 17 ; 18 ; get the appropriate segment definitions 19 ; 20 [list -] 20 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 22 23 [list +] === Switch to base=002450h -> "DOSCODECODE" 24 section DOSCODECODE 25 [list -] 25 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 25 ****************** warning: out: BPB.INC... [-w+user] 25 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 25 ****************** warning: out: DEVSYM.INC... [-w+user] 25 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 33 34 %iassign Installed TRUE 35 36 extrn IFS_extopen_shared:near 37 38 i_need NoSetDir,BYTE 39 i_need THISSFT,DWORD 40 i_need THISCDS,DWORD 41 I_need EXTERR,WORD 42 I_Need ExtErr_locus,BYTE 43 I_need JShare,DWORD 44 I_need VOLCHNG_FLAG,BYTE 45 I_need SATTRIB,BYTE 46 I_need CALLVIDM,DWORD 47 I_need OpenBuf,128 48 I_need EXTOPEN_ON,BYTE ;AN000; extended open 49 I_need NAME1,BYTE ;AN000; 50 I_need NO_NAME_ID,BYTE ;AN000; 51 I_need Packet_Temp,WORD ;AN000; 52 I_need DOS34_FLAG,WORD ;AN000; 53 I_need SAVE_BX,WORD ;AN000; 54 I_need SAVE_CX,WORD 55 56 assume nocheck, ss:DOSGROUP 57 58 ; Inputs: 59 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 60 ; terminated) 61 ; [CURR_DIR_END] Points to end of Current dir part of string 62 ; ( = -1 if current dir not involved, else 63 ; Points to first char after last "/" of current dir part) 64 ; [THISCDS] Points to CDS being used 65 ; (Low word = -1 if NUL CDS (Net direct request)) 66 ; [THISSFT] Points to SFT to fill in if file created 67 ; (sf_mode field set so that FCB may be detected) 68 ; [SATTRIB] Is attribute of search, determines what files can be found 69 ; AX is Attribute to create 70 ; Function: 71 ; Try to create the specified file truncating an old one that exists 72 ; Outputs: 73 ; sf_ref_count is NOT altered 74 ; CARRY CLEAR 75 ; THISSFT filled in. 76 ; sf_mode = unchanged for FCB, sharing_compat + open_for_both 77 ; CARRY SET 78 ; AX is error code 79 ; error_path_not_found 80 ; Bad path (not in curr dir part if present) 81 ; error_bad_curr_dir 82 ; Bad path in current directory part of path 83 ; error_access_denied 84 ; Attempt to re-create read only file , or 85 ; create a second volume id or create a dir 86 ; error_sharing_violation 87 ; The sharing mode was correct but not allowed 88 ; generates an INT 24 89 ; DS preserved, others destroyed 90 91 procedure DOS_Create,NEAR 91 ****************** warning: proc DOS_Create... [-w+user] 92 DOSAssume CS,,"DOS_Create" 93 ASSUME ES:NOTHING 94 0 000030D3 30E4 XOR AH,AH ; Truncate is OK 96 Create_inter: 0 000030D5 A880 TEST AL,~ (attr_all + attr_ignore + attr_volume_id) 98 ; Mask out any meaningless bits 0 000030D7 7512 JNZ AttErr 0 000030D9 A808 TEST AL,attr_volume_id 0 000030DB 7408 JZ NoReset 0 000030DD 810E[0000]8000 OR word [DOS34_FLAG],DBCS_VOLID ;AN000;FOR dbcs volid 0 000030E3 B008 MOV AL,attr_volume_id 104 NoReset: 0 000030E5 0C20 OR AL,attr_archive ; File changed 0 000030E7 A850 TEST AL,attr_directory + attr_device 0 000030E9 740A JZ ATT_OK 108 AttErr: 0 000030EB B80500 MOV AX,5 ; Attribute problem 110 Exterr_Locus equ ExtErr_locus ; NASM port label 0 000030EE C606[0000]01 MOV byte [Exterr_Locus],errLOC_Unk 0 000030F3 EB5D JMP SHORT SET_MKND_ERR ; Gotta use MKDIR to make dirs, NEVER allow 113 ; attr_device to be set. 114 ATT_OK: 0 000030F5 C43E[0000] LES DI,[THISSFT] 0 000030F9 06 PUSH ES 0 000030FA C436[0000] LES SI,[THISCDS] 0 000030FE 83FEFF CMP SI,-1 0 00003101 7513 JNZ TEST_RE_NET 0 00003103 07 POP ES 121 assume es:nothing 122 123 ;Extended open hooks 0 00003104 F606[0000]01 TEST byte [EXTOPEN_ON],ext_open_on ;AN000;EO. from extnded open 0 00003109 7403 JZ NOEXTOP ;AN000;EO. no, do normal 126 IFS_extopen: 0 0000310B E9[0000] jmp IFS_extopen_shared 128 NOEXTOP: ;AN000; 129 ;Extended open hooks 130 131 %IFN Installed 132 transfer NET_SEQ_CREATE 133 %ELSE 0 0000310E 50 PUSH AX 135 multNET equ MultNET ; NASM port equate 0 0000310F B81811 MOV AX,(multNET << 8) | 24 0 00003112 CD2F INT 2FH 0 00003114 5B POP BX ; BX is trashed anyway 0 00003115 C3 return 140 %ENDIF 141 142 TEST_RE_NET: 0 00003116 26F744430080 TEST word [ES:SI + curdir_flags],curdir_isnet 0 0000311C 07 POP ES 145 assume es:nothing 0 0000311D 7419 JZ LOCAL_CREATE 147 0 0000311F E8B700 CALL Set_EXT_mode ;AN000;EO. 0 00003122 7205 JC SHORT dochk ;AN000;EO. 0 00003124 26834D0202 OR word [ES:DI + sf_mode],sharing_compat + open_for_both ;IFS. 151 dochk: 152 ; invoke IFS_SHARE_CHECK ;AN000;IFS. check share 153 ; JC nomore ;AN000;IFS. share violation 154 155 ;Extended open hooks 0 00003129 F606[0000]01 TEST byte [EXTOPEN_ON],ext_open_on ;AN000;EO. from extnded open 0 0000312E 75DB JNZ IFS_extopen ;AN000;EO. yes, issue extended open 158 ;Extended open hooks 159 160 %IFN Installed 161 transfer NET_CREATE 162 %ELSE 0 00003130 50 PUSH AX 0 00003131 B81711 MOV AX,(multNET << 8) | 23 0 00003134 CD2F INT 2FH 0 00003136 5B POP BX ; BX is trashed anyway 167 nomore: 0 00003137 C3 return 169 %ENDIF 170 171 LOCAL_CREATE: 0 00003138 E89E00 CALL Set_EXT_mode ;AN000;EO. set mode if from extended open 0 0000313B 7205 JC setdone ;AN000;EO. 0 0000313D 26834D0202 OR word [ES:DI + sf_mode],sharing_compat+open_for_both 175 setdone: 0 00003142 E8[0000] EnterCrit critDisk 0 00003145 E8[0000] invoke MakeNode 0 00003148 730F JNC Create_ok 0 0000314A C606[0000]FF mov byte [VOLCHNG_FLAG],-1 ; indicate no change in volume label 0 0000314F E8[0000] LeaveCrit critDisk 181 182 entry SET_MKND_ERR 183 DOSAssume CS,,"Set_MkNd_Err" 184 ASSUME ES:NOTHING 185 ; Looks up MakeNode errors and converts them. AL is MakeNode 186 ; error, SI is GetPath bad spot return if path_not_found error. 187 0 00003152 BB[0000] MOV BX,OFFSET CRTERRTAB 0 00003155 2ED7 cs xlatb 190 CreatBadRet: 0 00003157 F9 STC 0 00003158 C3 return 193 === Switch to base=002450h -> "DOSCODETABLE" 194 section DOSCODETABLE 195 Public CREAT001S,CREAT001E 196 CREAT001S label byte 197 CRTERRTAB LABEL BYTE ; Lookup table for MakeNode returns 0 000006CE ?? DB ? ; none 0 000006CF 05 DB error_access_denied ; MakeNode error 1 0 000006D0 52 DB error_cannot_make ; MakeNode error 2 0 000006D1 50 DB error_file_exists ; MakeNode error 3 0 000006D2 03 DB error_path_not_found ; MakeNode error 4 0 000006D3 05 DB error_access_denied ; MakeNode error 5 0 000006D4 20 DB error_sharing_violation ; MakeNode error 6 0 000006D5 02 DB error_file_not_found ; MakeNode error 7 206 CREAT001E label byte === Switch to base=002450h -> "DOSCODECODE" 207 section DOSCODECODE 208 209 ; 210 ; We have just created a new file. This results in the truncation of old 211 ; files. We must inform the sharer to slash all the open SFT's for this 212 ; file to the current size. 213 ; 214 Create_ok: 215 ; If we created a volume id on the diskette, set the VOLCHNG_FLAG to logical 216 ; drive number to force a Build BPB after Media Check. 217 218 ;;; FASTOPEN 8/29/86 0 00003159 E8[0000] invoke FastOpen_Delete 220 ;;; FASTOPEN 8/29/86 0 0000315C A0[0000] mov al,[SATTRIB] 0 0000315F A808 test al,attr_volume_id 0 00003161 741C jz NoVolLabel 0 00003163 C43E[0000] LES DI,[THISCDS] 0 00003167 268A25 mov ah,byte ptr [ES:DI] ; get drive letter 0 0000316A 80EC41 sub ah,'A' ; convert to drive letter 0 0000316D 8826[0000] mov [VOLCHNG_FLAG],ah ;Set flag to indicate volid change 0 00003171 B701 MOV BH,1 ;AN000;>32mb set volume id to boot record 0 00003173 E81F00 CALL $Set_Media_ID ;AN000;>32mb 230 0 00003176 E8[0000] EnterCrit CritDisk 0 00003179 E8[0000] invoke FatRead_CDS ; force a media check 0 0000317C E8[0000] LeaveCrit CritDisk 234 NoVolLabel: 0 0000317F B80200 MOV ax,2 236 ThisSFT equ THISSFT ; NASM port label 0 00003182 C43E[0000] LES DI,[ThisSFT] 238 %if installed 0 00003186 FF1E[3800] call far [JShare + 14 * 4] 240 %else 241 Call ShSU 242 %endif 0 0000318A E8[0000] LeaveCrit critDisk 0 0000318D E9[0000] transfer SET_SFT_MODE 245 246 EndProc DOS_Create 247 248 ; Inputs: 249 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 250 ; terminated) 251 ; [CURR_DIR_END] Points to end of Current dir part of string 252 ; ( = -1 if current dir not involved, else 253 ; Points to first char after last "/" of current dir part) 254 ; [THISCDS] Points to CDS being used 255 ; (Low word = -1 if NUL CDS (Net direct request)) 256 ; [THISSFT] Points to SFT to fill in if file created 257 ; (sf_mode field set so that FCB may be detected) 258 ; [SATTRIB] Is attribute of search, determines what files can be found 259 ; AX is Attribute to create 260 ; Function: 261 ; Try to create the specified file truncating an old one that exists 262 ; Outputs: 263 ; sf_ref_count is NOT altered 264 ; CARRY CLEAR 265 ; THISSFT filled in. 266 ; sf_mode = sharing_compat + open_for_both for Non-FCB SFT 267 ; CARRY SET 268 ; AX is error code 269 ; error_path_not_found 270 ; Bad path (not in curr dir part if present) 271 ; error_bad_curr_dir 272 ; Bad path in current directory part of path 273 ; error_access_denied 274 ; Create a second volume id or create a dir 275 ; error_file_exists 276 ; Already a file by this name 277 ; DS preserved, others destroyed 278 279 procedure DOS_Create_New,NEAR 279 ****************** warning: proc DOS_Create_New... [-w+user] 280 DOSAssume CS,,"DOS_Create_New" 281 ASSUME ES:NOTHING 282 0 00003190 B401 MOV AH,1 ; Truncate is NOT OK 0 00003192 E940FF JMP Create_inter 285 286 EndProc DOS_Create_New 287 288 289 ; Inputs: 290 ; NAME1= Volume ID 291 ; BH= 0, delete volume id 292 ; 1, set new volume id 293 ; DS= DOSGROUP 294 ; Function: 295 ; Set Volume ID to DOS 4.00 Boot record. 296 ; Outputs: 297 ; CARRY CLEAR 298 ; volume id set 299 ; CARRY SET 300 ; AX is error code 301 302 procedure $Set_Media_ID,NEAR ;AN000; 302 ****************** warning: proc $Set_Media_ID... [-w+user] 303 DOSAssume CS,,"DOS_Create_New" ;AN000; 304 ASSUME ES:NOTHING ;AN000; 305 0 00003195 50 PUSH AX ;AN000;;>32mb 0 00003196 06 PUSH ES ;AN000;;>32mb 0 00003197 57 PUSH DI ;AN000;;>32mb 309 0 00003198 FEC4 INC AH ;AN000;;>32mb bl=drive # 0 0000319A 88E3 MOV BL,AH ;AN000;;>32mb bl=drive # (A=1,B=2,,,) 0 0000319C B00D MOV AL,0DH ;AN000;;>32mb generic IOCTL 0 0000319E B96608 MOV CX,0866H ;AN001;;>32mb get media id 314 PACKET_TEMP equ Packet_Temp ; NASM port label 0 000031A1 BA[0000] MOV DX,OFFSET PACKET_TEMP wrt DOSGROUP ;AN000;>32mb 316 0 000031A4 53 PUSH BX ;AN000;;>32mb 0 000031A5 52 PUSH DX ;AN000;;>32mb 0 000031A6 30FF XOR BH,BH ;AN000;;>32mb 320 0 000031A8 E8[0000] invoke D_IOCTL ;AN000;;>32mb 0 000031AB 5A POP DX ;AN000;;>32mb 0 000031AC 5B POP BX ;AN000;;>32mb 0 000031AD 7224 JC geterr ;AN000;;>32mb 325 0 000031AF 08FF OR BH,BH ;AN000;;>32mb delete volume id 327 NoName equ Noname ; NASM port label 0 000031B1 7405 JZ NoName ;AN000;>32mb yes 0 000031B3 BE[0000] MOV SI,OFFSET NAME1 wrt DOSGROUP ;AN000;>32mb 0 000031B6 EB03 JMP SHORT doset ;AN000;>32mb yes 331 Noname: ;AN000; 0 000031B8 BE[0000] MOV SI,OFFSET NO_NAME_ID wrt DOSGROUP ;AN000;>32mb 333 doset: ;AN000; 0 000031BB 89D7 MOV DI,DX ;AN000;;>32mb 335 MEDIA_LABEL equ MEDIA_Label ; NASM port equate 0 000031BD 83C706 ADD DI,MEDIA_LABEL ;AN000;;>32mb 0 000031C0 16 PUSH ss ;AN000;;>32mb move new volume id to packet 0 000031C1 1F POP DS ;AN000;;>32mb 339 assume ds:DOSGROUP 0 000031C2 16 PUSH ss ;AN000;;>32mb 0 000031C3 07 POP ES ;AN000;;>32mb 342 assume es:DOSGROUP 0 000031C4 B90B00 MOV CX,11 ;AN000;;>32mb 0 000031C7 F3A4 REP MOVSB ;AN000;;>32mb 0 000031C9 B94608 MOV CX,0846H ;AN001;;>32mb 0 000031CC B00D MOV AL,0DH ;AN000;;>32mb 0 000031CE 30FF XOR BH,BH ;AN000;;>32mb 0 000031D0 E8[0000] invoke D_IOCTL ;AN000;;>32mb set volume id 349 geterr: ;AN000; 0 000031D3 16 PUSH ss ;AN000;>32mb 0 000031D4 1F POP DS ;AN000;>32mb ds= dosgroup 352 assume ds:DOSGROUP 353 0 000031D5 5F POP DI ;AN000;;>32mb 0 000031D6 07 POP ES ;AN000;;>32mb 356 assume es:nothing 0 000031D7 58 POP AX ;AN000;;>32mb 0 000031D8 C3 return ;AN000;>32mb 359 360 EndProc $Set_Media_ID ;AN000; 361 362 363 ; Inputs: 364 ; [EXTOPEN_ON]= flag for extende open 365 ; SAVE_BX= mode specified in Extended Open 366 ; Function: 367 ; Set mode in ThisSFT 368 ; Outputs: 369 ; carry set,mode is set if from Extended Open 370 ; carry clear, mode not set yet 371 372 %IFN IBMCOPYRIGHT 373 public Set_EXT_mode 374 %ENDIF 375 376 procedure Set_EXT_mode,NEAR ;AN000; 376 ****************** warning: proc Set_EXT_mode... [-w+user] 377 ASSUME ES:NOTHING,DS:NOTHING ;AN000; 378 0 000031D9 36F606[0000]01 TEST byte [ss:EXTOPEN_ON],ext_open_on ;AN000;EO. from extnded open 0 000031DF 740B JZ NOTEX ;AN000;EO. no, do normal 0 000031E1 50 PUSH AX ;AN000;EO. 0 000031E2 36A1[0000] MOV AX,[ss:SAVE_BX] ;AN000;EO. 0 000031E6 26094502 OR [ES:DI + sf_mode],AX ;AN000;EO. 0 000031EA 58 POP AX ;AN000;EO. 0 000031EB F9 STC ;AN000;EO. 386 NOTEX: ;AN000; 0 000031EC C3 return ;AN000;EO. 388 389 EndProc Set_EXT_mode ;AN000; 390 391 END 392 393 === Trace listing source: ../DOS/open.lst 1 ; SCCSID = @(#)open.asm 1.1 85/04/10 2 ;TITLE DOS_OPEN - Internal OPEN call for MS-DOS 3 ;NAME DOS_OPEN 4 ; Low level routines for openning a file from a file spec. 5 ; Also misc routines for sharing errors 6 ; 7 ; DOS_Open 8 ; Check_Access_AX 9 ; SHARE_ERROR 10 ; SET_SFT_MODE 11 ; Code_Page_Mismatched_Error ; DOS 4.00 12 ; 13 ; Revision history: 14 ; 15 ; Created: ARR 30 March 1983 16 ; A000 version 4.00 Jan. 1988 17 ; 18 19 ; 20 ; get the appropriate segment definitions 21 ; 22 [list -] 22 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 ****************** <4> warning: redefining multi-line macro `__@@_next' [-w+pp-macro-redef-multi] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 25 26 [list +] === Switch to base=002450h -> "DOSCODECODE" 27 section DOSCODECODE 28 [list -] 28 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 28 ****************** warning: out: BPB.INC... [-w+user] 28 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 28 ****************** warning: out: DEVSYM.INC... [-w+user] 38 39 %iassign Installed TRUE 40 41 i_need NoSetDir,BYTE 42 i_need THISSFT,DWORD 43 i_need THISCDS,DWORD 44 i_need CURBUF,DWORD 45 i_need CurrentPDB,WORD 46 i_need CURR_DIR_END,WORD 47 I_need RetryCount,WORD 48 I_need Open_Access,BYTE 49 I_need fSharing,BYTE 50 i_need JShare,DWORD 51 I_need FastOpenFlg,byte 52 I_need EXTOPEN_ON,BYTE ;AN000;; DOS 4.00 53 I_need ALLOWED,BYTE ;AN000;; DOS 4.00 54 I_need EXTERR,WORD ;AN000;; DOS 4.00 55 I_need EXTERR_LOCUS,BYTE ;AN000;; DOS 4.00 56 I_need EXTERR_ACTION,BYTE ;AN000;; DOS 4.00 57 I_need EXTERR_CLASS,BYTE ;AN000;; DOS 4.00 58 I_need CPSWFLAG,BYTE ;AN000;; DOS 4.00 59 I_need EXITHOLD,DWORD ;AN000;; DOS 4.00 60 I_need THISDPB,DWORD ;AN000;; DOS 4.00 61 I_need SAVE_CX,WORD ;AN000;; DOS 4.00 62 63 assume nocheck, ss:DOSGROUP 64 65 Break 66 67 ; Inputs: 68 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 69 ; terminated) 70 ; [CURR_DIR_END] Points to end of Current dir part of string 71 ; ( = -1 if current dir not involved, else 72 ; Points to first char after last "/" of current dir part) 73 ; [THISCDS] Points to CDS being used 74 ; (Low word = -1 if NUL CDS (Net direct request)) 75 ; [THISSFT] Points to SFT to fill in if file found 76 ; (sf_mode field set so that FCB may be detected) 77 ; [SATTRIB] Is attribute of search, determines what files can be found 78 ; AX is Access and Sharing mode 79 ; High NIBBLE of AL (Sharing Mode) 80 ; sharing_compat file is opened in compatibility mode 81 ; sharing_deny_none file is opened Multi reader, Multi writer 82 ; sharing_deny_read file is opened Only reader, Multi writer 83 ; sharing_deny_write file is opened Multi reader, Only writer 84 ; sharing_deny_both file is opened Only reader, Only writer 85 ; Low NIBBLE of AL (Access Mode) 86 ; open_for_read file is opened for reading 87 ; open_for_write file is opened for writing 88 ; open_for_both file is opened for both reading and writing. 89 ; 90 ; For FCB SFTs AL should = sharing_compat + open_for_both 91 ; (not checked) 92 ; Function: 93 ; Try to open the specified file 94 ; Outputs: 95 ; sf_ref_count is NOT altered 96 ; CARRY CLEAR 97 ; THISSFT filled in. 98 ; CARRY SET 99 ; AX is error code 100 ; error_file_not_found 101 ; Last element of path not found 102 ; error_path_not_found 103 ; Bad path (not in curr dir part if present) 104 ; error_bad_curr_dir 105 ; Bad path in current directory part of path 106 ; error_invalid_access 107 ; Bad sharing mode or bad access mode or bad combination 108 ; error_access_denied 109 ; Attempt to open read only file for writting, or 110 ; open a directory 111 ; error_sharing_violation 112 ; The sharing mode was correct but not allowed 113 ; generates an INT 24 on compatibility mode SFTs 114 ; DS preserved, others destroyed 115 116 procedure DOS_Open,NEAR 116 ****************** warning: proc DOS_Open... [-w+user] 117 DOSAssume CS,,"DOS_Open" 118 ASSUME ES:NOTHING 119 0 000031ED C606[0000]00 MOV byte [NoSetDir],0 0 000031F2 E86201 CALL Check_Access_AX 0 000031F5 7301C3 retc 0 000031F8 C43E[0000] LES DI,[THISSFT] 124 assume es:nothing 0 000031FC 30E4 XOR AH,AH 126 ; sleaze! move only access/sharing mode in. Leave sf_isFCB unchanged 0 000031FE 26884502 MOV BYTE PTR [ES:DI + sf_mode],AL ; For moment do this on FCBs too 0 00003202 06 PUSH ES 0 00003203 C436[0000] LES SI,[THISCDS] 0 00003207 83FEFF CMP SI,-1 0 0000320A 752C JNZ TEST_RE_NET 0 0000320C 07 POP ES 133 assume es:nothing 134 ;Extended open hooks 135 0 0000320D F606[0000]01 TEST byte [EXTOPEN_ON],ext_open_on ;FT. from extnded open ;AN000; 0 00003212 741C JZ NOEXTOP ;FT. no, do normal ;AN000; 138 IFS_extopen: ;AN000; 139 140 public IFS_extopen_shared 141 IFS_extopen_shared: 0 00003214 A0[0000] MOV AL,byte ptr [SAVE_CX] ;FT. al= create attribute ;AN000; 0 00003217 50 PUSH AX ;FT. pass create attr to IFS ;AN000; 144 multNET equ MultNET ; NASM port equate 0 00003218 B82E11 MOV AX,(multNET << 8) | 46 ;FT. issue extended open verb ;AN000; 0 0000321B CD2F INT 2FH ;FT. ;AN000; 0 0000321D 5B POP BX ;FT. trash bx ;AN000; 0 0000321E C606[0000]00 MOV byte [EXTOPEN_ON],0 ;FT. ;AN000; 0 00003223 720A jc @F 0 00003225 1E push ds 0 00003226 56 push si 0 00003227 E8[0000] invoke get_user_stack 0 0000322A 894C04 mov [SI + user_CX], cx 0 0000322D 5E pop si 0 0000322E 1F pop ds 156 assume ds:DOSGROUP 157 ; ecm: this is a no-op 158 ; jmp update_size ;IFS. file may be opened ;AN000; 159 @@: 0 0000322F C3 return ;FT. ;AN000; 161 NOEXTOP: 162 ;Extended open hooks 163 164 165 %IFN Installed 166 transfer NET_SEQ_OPEN 167 %ELSE 0 00003230 50 PUSH AX 0 00003231 B81611 MOV AX,(multNET << 8) | 22 0 00003234 CD2F INT 2FH 0 00003236 5B POP BX ; clean stack 0 00003237 C3 return 173 %ENDIF 174 175 TEST_RE_NET: 0 00003238 26F744430080 TEST word [ES:SI + curdir_flags],curdir_isnet 0 0000323E 07 POP ES 178 assume es:nothing 0 0000323F 740F JZ LOCAL_OPEN 180 ; CALL IFS_SHARE_CHECK ;IFS. check IFS share,may create share ;AN000; 181 ; JC nomore ;IFS. share violation ;AN000; 182 ;Extended open hooks 183 0 00003241 F606[0000]01 TEST byte [EXTOPEN_ON],ext_open_on ;FT. from extnded open ;AN000; 0 00003246 75CC JNZ IFS_extopen ;FT. isuue extended open ;AN000; 186 ;Extended open hooks 187 188 %IFN Installed 189 transfer NET_OPEN 190 %ELSE 0 00003248 50 PUSH AX 0 00003249 B81611 MOV AX,(multNET << 8) | 22 0 0000324C CD2F INT 2FH 0 0000324E 5B POP BX ; clean stack 195 ; JC nomore ;IFS. error ;AN000; 196 update_size: ;AN000; 197 ; CALL OWN_SHARE ;IFS. IFS owns share ? ;AN000; 198 ; JZ nomore2 ;IFS. yes ;AN000; 199 ; MOV AX,3 ;IFS. update file size for all SFT ;AN000; 200 ; LES DI,ThisSFT ;IFS. ;AN000; 201 ; call JShare + 14 * 4 ;IFS. call ShSu ;AN000; 202 nomore2: 203 ; CLC 204 nomore: 0 0000324F C3 return 206 %ENDIF 207 208 LOCAL_OPEN: 0 00003250 E8[0000] EnterCrit critDisk 210 211 ; DOS 3.3 FastOPen 6/16/86 212 0 00003253 800E[0000]05 OR byte [FastOpenFlg],FastOpen_Set+Special_Fill_Set ; only open can 0 00003258 E8[0000] invoke GetPath 215 216 217 ; DOS 3.3 FastOPen 6/16/86 218 0 0000325B 7320 JNC Open_found 0 0000325D 7514 JNZ bad_path 0 0000325F 08C9 OR CL,CL 0 00003261 7410 JZ bad_path 223 OpenFNF: 0 00003263 B80200 MOV AX,error_file_not_found 225 OpenBadRet: 0 00003266 368026[0000]80 AND BYTE PTR [ss:FastOpenFlg],Fast_yes ;; DOS 3.3 0 0000326C F9 STC 0 0000326D E8[0000] LeaveCrit critDisk 0 00003270 E9A100 JMP Clear_FastOpen 230 231 bad_path: 0 00003273 B80300 MOV AX,error_path_not_found 0 00003276 EBEE JMP OpenBadRet 234 235 open_bad_access: 0 00003278 B80500 MOV AX,error_access_denied 0 0000327B EBE9 JMP OpenBadRet 238 239 Open_found: 240 Open_Bad_Access equ open_bad_access ; NASM port label 0 0000327D 74F9 JZ Open_Bad_Access ; test for directories 0 0000327F 08E4 OR AH,AH 0 00003281 783F JS open_ok ; Devices don't have attributes 0 00003283 8E06[0200] MOV ES,WORD PTR [CURBUF+2] ; get buffer location 245 assume es:nothing 0 00003287 268A470B MOV AL,[ES:BX + dir_attr] 0 0000328B A808 TEST AL,attr_volume_id ; can't open volume ids 0 0000328D 75E9 JNZ open_bad_access 0 0000328F A801 TEST AL,attr_read_only ; check write on read only 0 00003291 742F JZ open_ok 251 ; 252 ; The file is marked READ-ONLY. We verify that the open mode allows access to 253 ; the read-only file. Unfortunately, with FCB's and net-FCB's we cannot 254 ; determine at the OPEN time if such access is allowed. Thus, we defer such 255 ; processing until the actual write operation: 256 ; 257 ; If FCB, then we change the mode to be read_only. 258 ; If net_FCB, then we change the mode to be read_only. 259 ; If not open for read then error. 260 ; 0 00003293 1E56 SaveReg 0 00003295 C536[0000] LDS SI,[THISSFT] 0 00003299 8B4C02 MOV CX,[SI + sf_mode] 264 sf_isFCB equ sf_isfcb ; NASM port equate 0 0000329C F7C10080 TEST CX,sf_isFCB ; is it FCB? 0 000032A0 750A JNZ ResetAccess ; yes, reset the access 0 000032A2 88CA MOV DL,CL 0 000032A4 80E2F0 AND DL,sharing_mask 0 000032A7 80FA70 CMP DL,sharing_net_FCB ; is it net FCB? 0 000032AA 7508 JNZ NormalOpen ; no 271 ResetAccess: 0 000032AC 83E1F0 AND CX,~ access_mask ; clear access 273 errnz open_for_read 274 ; OR CX,open_for_read ; stick in open_for_read 0 000032AF 894C02 MOV [SI + sf_mode],CX 0 000032B2 EB0C JMP SHORT FillSFT 277 ; 278 ; The SFT is normal. See if the requested access is open_for_read 279 ; 280 NormalOpen: 0 000032B4 80E10F AND CL,access_mask ; remove extras 0 000032B7 80F900 CMP CL,open_for_read ; is it open for read? 0 000032BA 7404 JZ FillSFT 0 000032BC 5E1F RestoreReg 0 000032BE EBB8 JMP short open_bad_access 286 ; 287 ; All done, restore registers and fill the SFT. 288 ; 289 FillSFT: 0 000032C0 5E1F RestoreReg 291 open_ok: 292 ;;; File Tagging DOS 4.00 293 ; OR AH,AH ;FT. device ? ;AN000; 294 ; JS NORM0 ;FT. yes, don't do code page matching ;AN000; 295 ; CMP [CPSWFLAG],0 ;FT. code page matching on ;AN000; 296 ; JZ NORM0 ;FT. no ;AN000; 297 ; CMP [ES:BX].dir_CODEPG,0 ;FT. code page 0 ;AN000; 298 ; JZ NORM0 ;FT. yes do nothing ;AN000; 299 ; PUSH AX ;FT. ;AN000; 300 ; invoke Get_Global_CdPg ;FT. get global code page ;AN000; 301 ; CMP [ES:BX].dir_CODEPG,AX ;FT. equal to global code page ;AN000; 302 ; JZ NORM1 ;FT. yes ;AN000; 303 ; call Code_Page_Mismatched_Error ;FT. ;AN000; 304 ; CMP AL,0 ;FT. ignore ? ;AN000; 305 ; JZ NORM1 ;FT. ;AN000; 306 ; POP AX ;FT. ;AN000; 307 ; JMP open_bad_access ;FT. set carry and return ;AN000; 308 NORM1: ;AN000; 309 ; POP AX ;FT. ;AN000; 310 NORM0: 311 312 ;;; File Tagging DOS 4.00 0 000032C2 E8[0000] invoke DOOPEN ; Fill in SFT 0 000032C5 368026[0000]80 AND BYTE PTR [ss:FastOpenFlg],Fast_yes ;; DOS 3.3 0 000032CB E86500 CALL DO_SHARE_CHECK ; 316 Share_Ok equ SHARE_OK ; NASM port label 0 000032CE 7306 JNC Share_Ok 0 000032D0 E8[0000] LeaveCrit critDisk 319 Clear_FastOPen equ Clear_FastOpen ; NASM port label 0 000032D3 EB3F JMP Clear_FastOPen 0 000032D5 90 nop ; identicalise 322 323 SHARE_OK: 0 000032D6 B80300 MOV AX,3 325 ThisSFT equ THISSFT ; NASM port label 0 000032D9 C43E[0000] LES DI,[ThisSFT] 327 %if installed 0 000032DD FF1E[3800] call far [JShare + 14 * 4] 329 %else 330 Call ShSU 331 %endif 332 ;; DOS 4.00 10/27/86 0 000032E1 C43E[0000] LES DI,[ThisSFT] ; if this is a newly ;AN000; 0 000032E5 26837D0B00 CMP word [ES:DI + sf_firclus],0 ; created file then ;AN000; 0 000032EA 740E JZ no_fastseek ; do nothing ;AN000; 0 000032EC 268B4D0B MOV CX,[ES:DI + sf_firclus] ; first cluster # ;AN000; 0 000032F0 26C47D07 LES DI,[ES:DI + sf_devptr] ; pointer to DPB ;AN000; 0 000032F4 268A15 MOV DL,[ES:DI + dpb_drive] ; drive # ;AN000; 0 000032F7 E8[0000] invoke FastSeek_Open ; call fastseek ;AN000; 340 no_fastseek: 341 342 ;; DOS 4.00 10/27/86 343 0 000032FA E8[0000] LeaveCrit critDisk 345 346 ; 347 ; Finish SFT initialization for new reference. Set the correct mode. 348 ; 349 ; Inputs: 350 ; ThisSFT points to SFT 351 ; 352 ; Outputs: 353 ; Carry clear 354 ; Registers modified: AX. 355 356 entry SET_SFT_MODE 357 DOSAssume CS,,"Set_SFT_Mode" 358 ASSUME ES:NOTHING 359 0 000032FD C43E[0000] LES DI,[ThisSFT] 0 00003301 E8[0000] invoke DEV_OPEN_SFT 0 00003304 26F745020080 TEST word [ES:DI + sf_mode],sf_isfcb; Clears carry 0 0000330A 7501C3 retz ; sf_mode correct 0 0000330D A1[0000] MOV AX,[CurrentPDB] 0 00003310 26894531 MOV [ES:DI + sf_PID],AX ; For FCB sf_PID=PID 366 367 Clear_FastOpen: 0 00003314 C3 return ;;;;; DOS 3.3 369 370 EndProc DOS_Open 370 ****************** warning: ***** Possible stack size error in DOS_Open ***** [-w+user] 371 372 ; Called on sharing violations. ES:DI points to SFT. AX has error code 373 ; If SFT is FCB or compatibility mode gens INT 24 error. 374 ; Returns carry set AX=error_sharing_violation if user says ignore (can't 375 ; really ignore). Carry clear 376 ; if user wants a retry. ES, DI, DS preserved 377 378 procedure SHARE_ERROR,NEAR 378 ****************** warning: proc SHARE_ERROR... [-w+user] 379 DOSAssume CS,,"Share_Error" 380 ASSUME ES:NOTHING 0 00003315 26F745020080 TEST word [ES:DI + sf_mode],sf_isfcb 0 0000331B 750C JNZ HARD_ERR 0 0000331D 268A4D02 MOV CL,BYTE PTR [ES:DI + sf_mode] 0 00003321 80E1F0 AND CL,sharing_mask 0 00003324 80F900 CMP CL,sharing_compat 0 00003327 7505 JNE NO_HARD_ERR 387 HARD_ERR: 0 00003329 E8[0000] invoke SHARE_VIOLATION 0 0000332C 73E6 retnc ; User wants retry 390 NO_HARD_ERR: 0 0000332E B82000 MOV AX,error_sharing_violation 0 00003331 F9 STC 0 00003332 C3 return 394 395 EndProc SHARE_ERROR 396 397 398 ; Input: THISDPB, WFP_Start, THISSFT set 399 ; Functions: check file sharing mode is valid 400 ; Output: carry set, error 401 ; carry clear, share ok 402 403 procedure DO_SHARE_CHECK,NEAR 403 ****************** warning: proc DO_SHARE_CHECK... [-w+user] 404 DOSAssume CS,,"DO_SHARE__CHECK" 405 ASSUME ES:NOTHING 0 00003333 E8[0000] EnterCrit critDisk ; enter critical section 407 408 OPN_RETRY: 0 00003336 8B0E[0000] MOV CX,[RetryCount] ; Get # tries to do 410 OpenShareRetry: 0 0000333A 51 SaveReg ; Save number left to do 0 0000333B E8[0000] invoke SHARE_CHECK ; Final Check 0 0000333E 59 RestoreReg ; CX = # left 0 0000333F 730E JNC Share_Ok2 ; No problem with access 0 00003341 E8[0000] Invoke Idle 0 00003344 E2F4 LOOP OpenShareRetry ; One more retry used up 417 OpenShareFail: 418 ThisSft equ THISSFT ; NASM port label 0 00003346 C43E[0000] LES DI,[ThisSft] 0 0000334A E8C8FF invoke SHARE_ERROR 0 0000334D 73E7 JNC OPN_RETRY ; User wants more retry 422 Share_Ok2: 0 0000334F E8[0000] LeaveCrit critDisk ; leave critical section 0 00003352 C3 return 425 426 EndProc DO_SHARE_CHECK 427 428 429 ; Input: ES:DI -> SFT 430 ; Functions: check if IFS owns SHARE 431 ; Output: Zero set, use IFS SHARE 432 ; otherwise, use DOS SHARE 433 434 procedure OWN_SHARE,NEAR ;AN000; 434 ****************** warning: proc OWN_SHARE... [-w+user] 435 DOSAssume CS,,"OWN_SHARE" ;AN000; 436 ASSUME ES:NOTHING ;AN000; 437 438 ; PUSH DS ;IFS. save reg ;AN000; 439 ; PUSH SI ;IFS. save reg ;AN000; 440 ; LDS SI,[ES:DI.sf_IFS_HDR] ;IFS. ds:si-> IFS header ;AN000; 441 ; TEST [SI.IFS_ATTRIBUTE],IFSUSESHARE ;IFS. save reg ;AN000; 442 ; POP SI ;IFS. retore reg ;AN000; 443 ; POP DS ;IFS. restore reg ;AN000; 0 00003353 C3 return ;IFS. return ;AN000; 445 446 EndProc OWN_SHARE ;AN000; 447 448 449 ; Input: THISCDS -> CDS 450 ; Functions: check if IFS owns SHARE 451 ; Output: Zero set, use IFS SHARE 452 ; otherwise, use DOS SHARE 453 454 procedure OWN_SHARE2,NEAR ;AN000; 454 ****************** warning: proc OWN_SHARE2... [-w+user] 455 DOSAssume CS,,"OWN_SHARE2" ;AN000; 456 ASSUME ES:NOTHING ;AN000; 457 458 ; CMP WORD PTR [THISCDS],-1 ;IFS. UNC ? ;AN000; 459 ; JZ ifs_hasit ;IFS. yes ;AN000; 460 ; PUSH DS ;IFS. save reg ;AN000; 461 ; PUSH SI ;IFS. save reg ;AN000; 462 ; LDS SI,[THISCDS] ;IFS. DS:SI -> ThisCDS ;AN000; 463 ; LDS SI,[SI.curdir_IFS_HDR] ;IFS. ds:si-> IFS header ;AN000; 464 ; TEST [SI.IFS_ATTRIBUTE],IFSUSESHARE ;IFS. ;AN000; 465 ; POP SI ;IFS. retore reg ;AN000; 466 ; POP DS ;IFS. restore reg ;AN000; 467 ifs_hasit: ;AN000; 0 00003354 C3 return ;IFS. return ;AN000; 469 470 EndProc OWN_SHARE2 ;AN000; 471 472 473 ; Input: ES:DI -> SFT 474 ; Functions: set THISDPB 475 ; Output: none 476 477 procedure SET_THISDPB,NEAR ;AN000; 477 ****************** warning: proc SET_THISDPB... [-w+user] 478 DOSAssume CS,,"SET_THISDPB" ;AN000; 479 ASSUME ES:NOTHING ;AN000; 480 481 ; PUSH DS ;IFS. save reg ;AN000; 482 ; PUSH SI ;IFS. save reg ;AN000; 483 ; LDS SI,[THISCDS] ;IFS. ds:si-> CDS ;AN000; 484 ; LDS SI,[SI.CURDIR_DEVPTR] ;IFS. ds:si-> DPB ;AN000; 485 ; MOV WORD PTR [THISDPB],SI ;IFS. set THISDPB ;AN000; 486 ; MOV WORD PTR [THISDPB+2],DS ;IFS. ;AN000; 487 ; POP SI ;IFS. retore reg ;AN000; 488 ; POP DS ;IFS. restore reg ;AN000; 0 00003355 C3 return ;IFS. return ;AN000; 490 491 EndProc SET_THISDPB ;AN000; 492 493 494 ; Input: ES:DI -> SFT 495 ; Functions: check IFS share 496 ; Output: none 497 498 procedure IFS_SHARE_CHECK,NEAR ;AN000; 498 ****************** warning: proc IFS_SHARE_CHECK... [-w+user] 499 DOSAssume CS,,"IFS_SHARE_CHECK" ;AN000; 500 ASSUME ES:NOTHING ;AN000; 501 502 503 ; CALL OWN_SHARE ;IFS. IFS owns share ;AN000; 504 ; JZ IFSSHARE ;IFS. yes ;AN000; 505 ; PUSH AX ;IFS. save mode ;AN000; 506 ; CALL SET_THISDPB ;IFS. set THISDPB for SHARE_VIOLATION ;AN000; 507 ; CALL DO_SHARE_CHECK ;IFS. check share ;AN000; 508 ; POP AX ;IFS. restore mode and share ok ;AN000; 509 IFSSHARE: ;AN000; 0 00003356 C3 return ;IFS. return ;AN000; 511 512 EndProc IFS_SHARE_CHECK ;AN000; 513 514 ; Inputs: 515 ; AX is mode 516 ; High NIBBLE of AL (Sharing Mode) 517 ; sharing_compat file is opened in compatibility mode 518 ; sharing_deny_none file is opened Multi reader, Multi writer 519 ; sharing_deny_read file is opened Only reader, Multi writer 520 ; sharing_deny_write file is opened Multi reader, Only writer 521 ; sharing_deny_both file is opened Only reader, Only writer 522 ; Low NIBBLE of AL (Access Mode) 523 ; open_for_read file is opened for reading 524 ; open_for_write file is opened for writing 525 ; open_for_both file is opened for both reading and writing. 526 ; Function: 527 ; Check this access mode for correctness 528 ; Outputs: 529 ; [open_access] = AL input 530 ; Carry Clear 531 ; Mode is correct 532 ; AX unchanged 533 ; Carry Set 534 ; Mode is bad 535 ; AX = error_invalid_access 536 ; No other registers effected 537 538 procedure Check_Access_AX 538 ****************** warning: proc Check_Access_AX... [-w+user] 539 DOSAssume CS,,"Check_Access" 540 ASSUME ES:NOTHING 541 0 00003357 A2[0000] MOV [Open_Access],AL 0 0000335A 53 PUSH BX 544 ; 545 ; If sharing, then test for special sharing mode for FCBs 546 ; 0 0000335B 88C3 MOV BL,AL 0 0000335D 80E3F0 AND BL,sharing_mask 0 00003360 803E[0000]FF CMP byte [fSharing],-1 0 00003365 7505 JNZ CheckShareMode ; not through server call, must be ok 551 sharing_NET_FCB equ sharing_net_FCB ; NASM port equate 0 00003367 80FB70 CMP BL,sharing_NET_FCB 0 0000336A 7405 JZ CheckAccessMode ; yes, we have an FCB 554 CheckShareMode: 0 0000336C 80FB40 CMP BL,40h ; is this a good sharing mode? 556 Make_Bad_Access equ make_bad_access ; NASM port label 0 0000336F 770D JA Make_Bad_Access 558 CheckAccessMode: 0 00003371 88C3 MOV BL,AL 0 00003373 80E30F AND BL,access_mask 0 00003376 80FB02 CMP BL,2 0 00003379 7703 JA Make_Bad_Access 0 0000337B 5B POP BX 0 0000337C F8 CLC 0 0000337D C3 return 566 567 make_bad_access: 0 0000337E B80C00 MOV AX,error_invalid_access 0 00003381 5B POP BX 0 00003382 F9 STC 0 00003383 C3 return 572 573 EndProc Check_Access_AX 574 575 ; Input: none 576 ; Function: Issue Code Page Mismatched INT 24 Critical Error 577 ; OutPut: AL =0 ignore 578 ; =3 fail 579 580 %if 0 581 procedure Code_Page_Mismatched_Error,NEAR ;AN000; 582 DOSAssume CS,,"Code_Page_Mismatched_Error" ;AN000; 583 ASSUME ES:NOTHING ;AN000; 584 585 ; PUSH DS ;FT. ;AN000; 586 ; Context DS ;FT. ds=cs ;AN000; 587 ; MOV AH,0A9H ;FT. fail,ignore,device,write ;AN000; 588 ; MOV DI,error_I24_gen_failure ;FT. set error ;AN000; 589 ; MOV [EXTERR],error_Code_Page_Mismatched ;FT. ;AN000; 590 ; MOV [EXTERR_CLASS],errCLASS_NotFnd ;FT. ;AN000; 591 ; MOV [EXTERR_ACTION],errACT_Abort ;FT. ;AN000; 592 ; MOV [EXTERR_LOCUS],errLOC_Unk ;FT. ;AN000; 593 ; MOV word ptr [EXITHOLD + 2],ES ;FT. save es:bp ;AN000; 594 ; MOV word ptr [EXITHOLD],BP ;FT. ;AN000; 595 ; invoke NET_I24_ENTRY ;FT. issue int 24H ;AN000; 596 ; POP DS ;FT. ;AN000; 597 ; return ;FT. ;AN000; 598 599 EndProc Code_Page_Mismatched_Error ;AN000; 600 %endif 601 602 END === Trace listing source: ../DOS/dinfo.lst 1 ; SCCSID = @(#)dinfo.asm 1.1 85/04/10 2 ; SCCSID = @(#)dinfo.asm 1.1 85/04/10 3 ;TITLE DISK_INFO - Internal Get Disk Info 4 ;NAME DISK_INFO 5 ; Low level routine for returning disk drive information from a local 6 ; or NET device 7 ; 8 ; DISK_INFO 9 ; 10 ; Modification history: 11 ; 12 ; Created: ARR 30 March 1983 13 ; 14 15 ; 16 ; get the appropriate segment definitions 17 ; 18 [list -] 18 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 30 31 %iassign Installed TRUE 32 33 i_need THISCDS,DWORD 34 i_need CURBUF,DWORD 35 i_need EXTERR_LOCUS,BYTE 36 %if debug 37 I_need BugLev,WORD 38 I_need BugTyp,WORD 39 %include "bugtyp.nas" 40 %endif 41 42 assume nocheck, ss:DOSGROUP 43 44 Break 45 46 ; Inputs: 47 ; [THISCDS] Points to the Macro List Structure of interest 48 ; (It MAY NOT be NUL, error not detected) 49 ; Function: 50 ; Get Interesting Drive Information 51 ; Returns: 52 ; DX = Number of free allocation units 53 ; BX = Total Number of allocation units on disk 54 ; CX = Sector size 55 ; AL = Sectors per allocation unit 56 ; AH = FAT ID BYTE 57 ; Carry set if error (currently user FAILed to I 24) 58 ; Segs except ES preserved, others destroyed 59 60 procedure DISK_INFO,NEAR 60 ****************** warning: proc DISK_INFO... [-w+user] 61 DOSAssume CS,,"Disk_Info" 62 ASSUME ES:NOTHING 63 0 00003384 E8[0000] Invoke TestNet 0 00003387 7306 JNC LOCAL_INFO 66 %IFN Installed 67 transfer NET_DISK_INFO 68 %ELSE 69 multNET equ MultNET ; NASM port equate 0 00003389 B80C11 MOV AX,(multNET << 8) | 12 0 0000338C CD2F INT 2FH 0 0000338E C3 return 73 %ENDIF 74 75 LOCAL_INFO: 0 0000338F C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 00003394 E8[0000] EnterCrit critDisk 0 00003397 E8[0000] invoke FATREAD_CDS ; perform media check. 0 0000339A 7241 JC CRIT_LEAVE 0 0000339C BB0200 MOV BX,2 0 0000339F E8[0000] invoke UNPACK ; Get first FAT sector into CURBUF 0 000033A2 7239 JC CRIT_LEAVE 0 000033A4 C536[0000] LDS SI,[CURBUF] 84 ASSUME DS:NOTHING 85 bufinsiz equ BUFINSIZ ; NASM port equate 0 000033A8 8A6410 MOV AH,[SI + bufinsiz] ; get FAT ID BYTE 0 000033AB 161F context DS 0 000033AD 268B4E0D MOV CX,[ES:BP + dpb_max_cluster] 89 ; 90 ; Examine the current free count. If it indicates that we have an invalid 91 ; count, do the expensive calculation. 92 ; 0 000033B1 268B561F MOV DX,[ES:BP + dpb_free_cnt] ; get free count 0 000033B5 83FAFF CMP DX,-1 ; is it valid? 0 000033B8 7404 JZ DoScan 96 ; 97 ; Check to see if it is in a reasonalbe range. If so, trust it and return. 98 ; Otherwise, we need to blast out an internal error message and then recompute 99 ; the count. 100 ; 0 000033BA 39CA CMP DX,CX ; is it in a reasonable range? 0 000033BC 7223 JB GotVal ; yes, trust it. 103 fmt TypInt,LevLog,<"Internal error: MaxClus <= FreeClus\n"> 104 DoScan: 0 000033BE 31D2 XOR DX,DX 0 000033C0 49 DEC CX 107 SCANFREE: 0 000033C1 E8[0000] invoke UNPACK 109 Crit_Leave equ CRIT_LEAVE ; NASM port label 0 000033C4 7217 JC Crit_Leave 0 000033C6 7501 JNZ NOTFREECLUS 0 000033C8 42 INC DX ; A free one 113 NOTFREECLUS: 0 000033C9 43 INC BX ; Next cluster 0 000033CA E2F5 LOOP SCANFREE 0 000033CC 4B DEC BX ; BX was next cluster. Convert to 117 ReturnVals: 0 000033CD 4B DEC BX ; count 0 000033CE 268A4604 MOV AL,[ES:BP + dpb_cluster_mask] 0 000033D2 FEC0 INC AL ; Sectors/cluster 121 ; overflow to 0 if it is 256 0 000033D4 268B4E02 MOV CX,[ES:BP + dpb_sector_size] ; Bytes/sector 0 000033D8 2689561F MOV [ES:BP + dpb_free_cnt],DX 0 000033DC F8 CLC 125 CRIT_LEAVE: 0 000033DD E8[0000] LeaveCrit critDisk 0 000033E0 C3 return 128 ; 129 ; We have correctly computed everything previously. Load up registers for 130 ; return. 131 ; 0 000033E1 89CB GotVal: MOV BX,CX ; get cluster count 0 000033E3 EBE8 JMP ReturnVals 134 135 EndProc DISK_INFO 136 137 END === Trace listing source: ../DOS/isearch.lst 1 ; SCCSID = @(#)isearch.asm 1.1 85/04/10 2 ;TITLE DOS_SEARCH - Internal SEARCH calls for MS-DOS 3 ;NAME DOS_SEARCH 4 ; Low level routines for doing local and NET directory searches 5 ; 6 ; DOS_SEARCH_FIRST 7 ; DOS_SEARCH_NEXT 8 ; RENAME_NEXT 9 ; 10 ; Revision history: 11 ; 12 ; Created: ARR 30 March 1983 13 ; A000 version 4.00 Jan. 1988 14 ; A001 PTM 3564 -- serach for fastopen 15 16 ; 17 ; get the appropriate segment definitions 18 ; 19 [list -] 19 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 21 22 [list +] === Switch to base=002450h -> "DOSCODECODE" 23 section DOSCODECODE 24 [list -] 24 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 24 ****************** warning: out: BPB.INC... [-w+user] 24 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 24 ****************** warning: out: DEVSYM.INC... [-w+user] 33 34 %iassign Installed TRUE 35 36 i_need NoSetDir,BYTE 37 i_need Creating,BYTE 38 i_need THISCDS,DWORD 39 i_need CURBUF,DWORD 40 i_need DMAADD,DWORD 41 i_need DummyCDS,128 42 i_need THISDPB,DWORD 43 i_need THISDRV,BYTE 44 i_need NAME1,BYTE 45 i_need ATTRIB,BYTE 46 i_need DIRSTART,WORD 47 i_need LASTENT,WORD 48 i_need FOUND_DEV,BYTE 49 I_need WFP_Start,WORD 50 i_need EXTERR_LOCUS,BYTE 51 i_need FastopenFlg,BYTE 52 I_need DOS34_FLAG,WORD 53 54 assume nocheck, ss:DOSGROUP 55 56 ; Inputs: 57 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 58 ; terminated) 59 ; [CURR_DIR_END] Points to end of Current dir part of string 60 ; ( = -1 if current dir not involved, else 61 ; Points to first char after last "/" of current dir part) 62 ; [THISCDS] Points to CDS being used 63 ; (Low word = -1 if NUL CDS (Net direct request)) 64 ; [SATTRIB] Is attribute of search, determines what files can be found 65 ; [DMAADD] Points to 53 byte buffer 66 ; Function: 67 ; Initiate a search for the given file spec 68 ; Outputs: 69 ; CARRY CLEAR 70 ; The 53 bytes ot DMAADD are filled in as follows: 71 ; 72 ; LOCAL 73 ; Drive Byte (A=1, B=2, ...) High bit clear 74 ; NEVER STORE DRIVE BYTE AFTER found_it 75 ; 11 byte search name with Meta chars in it 76 ; Search Attribute Byte, attribute of search 77 ; WORD LastEnt value 78 ; WORD DirStart 79 ; 4 byte pad 80 ; 32 bytes of the directory entry found 81 ; NET 82 ; 21 bytes First byte has high bit set 83 ; 32 bytes of the directory entry found 84 ; 85 ; CARRY SET 86 ; AX = error code 87 ; error_no_more_files 88 ; No match for this file 89 ; error_path_not_found 90 ; Bad path (not in curr dir part if present) 91 ; error_bad_curr_dir 92 ; Bad path in current directory part of path 93 ; DS preserved, others destroyed 94 95 procedure DOS_SEARCH_FIRST,NEAR 95 ****************** warning: proc DOS_SEARCH_FIRST... [-w+user] 96 DOSAssume CS,,"DOS_Search_First" 97 ASSUME ES:NOTHING 98 0 000033E5 C43E[0000] LES DI,[THISCDS] 0 000033E9 83FFFF CMP DI,-1 0 000033EC 7506 JNZ TEST_RE_NET 102 %IFN Installed 103 transfer NET_SEQ_SEARCH_FIRST 104 %ELSE 105 multNET equ MultNET ; NASM port equate 0 000033EE B81911 MOV AX,(multNET << 8) | 25 0 000033F1 CD2F INT 2FH 0 000033F3 C3 return 109 %ENDIF 110 111 TEST_RE_NET: 0 000033F4 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 000033FA 7406 JZ LOCAL_SEARCH_FIRST 114 %IFN Installed 115 transfer NET_SEARCH_FIRST 116 %ELSE 0 000033FC B81B11 MOV AX,(multNET << 8) | 27 0 000033FF CD2F INT 2FH 0 00003401 C3 return 120 %ENDIF 121 122 LOCAL_SEARCH_FIRST: 0 00003402 E8[0000] EnterCrit critDisk 0 00003405 F706[0000]0004 TEST word [DOS34_FLAG],SEARCH_FASTOPEN ;AN000; 0 0000340B 7405 JZ NOFN ;AN000; 126 FastOpenflg equ FastopenFlg ; NASM port label 127 Fastopen_Set equ FastOpen_Set ; NASM port equate 0 0000340D 800E[0000]01 OR byte [FastOpenflg],Fastopen_Set ;AN000; 129 NOFN: ;AN000; 0 00003412 C606[0000]01 MOV byte [NoSetDir],1 ; if we find a dir, don't change to it 0 00003417 E84301 CALL CHECK_QUESTION ;AN000;;FO. is '?' in path 0 0000341A 7305 JNC norm_getpath ;AN000;;FO. no 0 0000341C 8026[0000]80 AND byte [FastOpenflg],Fast_yes ;AN000;;FO. reset fastopen 134 norm_getpath: 0 00003421 E8[0000] invoke GetPath 136 getdone: 0 00003424 7319 JNC find_check_dev 0 00003426 7512 JNZ bad_path 0 00003428 08C9 OR CL,CL 0 0000342A 740E JZ bad_path 141 find_no_more: 0 0000342C B81200 MOV AX,error_no_more_files 143 BadBye: 0 0000342F 368026[0000]80 AND byte [ss:FastOpenflg],Fast_yes ;AN000;;FO. reset fastopen 145 0 00003435 F9 STC 0 00003436 E8[0000] LeaveCrit critDisk 0 00003439 C3 return 149 150 bad_path: 0 0000343A B80300 MOV AX,error_path_not_found 0 0000343D EBF0 JMP BadBye 153 154 find_check_dev: 0 0000343F 08E4 OR AH,AH 0 00003441 790A JNS found_entry 157 LastEnt equ LASTENT ; NASM port label 0 00003443 C706[0000]FFFF MOV word [LastEnt],-1 ; Cause DOS_SEARCH_NEXT to fail 159 Found_Dev equ FOUND_DEV ; NASM port label 0 00003449 FE06[0000] INC byte [Found_Dev] ; Tell DOS_RENAME we found a device 161 found_entry: 162 ; 163 ; We set the physical drive byte here Instead of after found_it; Doing 164 ; a search-next may not have wfp_start set correctly 165 ; 0 0000344D C43E[0000] LES DI,[DMAADD] 0 00003451 8B36[0000] MOV SI,[WFP_Start] ; get pointer to beginning 0 00003455 AC LODSB 0 00003456 2C40 SUB AL,'A'-1 ; logical drive 0 00003458 AA STOSB ; High bit not set (local) 171 found_it: 0 00003459 C43E[0000] LES DI,[DMAADD] 173 assume es:nothing 0 0000345D 47 INC DI 0 0000345E 1E PUSH DS ;FO.;AN001; save ds 176 Fastopenflg equ FastopenFlg ; NASM port label 0 0000345F F606[0000]10 TEST byte [Fastopenflg],Set_For_Search ;FO.;AN001; from fastopen 0 00003464 7408 JZ notfast ;FO.;AN001; 0 00003466 89DE MOV SI,BX ;FO.;AN001; 0 00003468 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] ;FO.;AN001; 181 assume ds:nothing 0 0000346C EB03 JMP SHORT movmov ;FO.;AN001; 183 184 185 notfast: 0 0000346E BE[0000] MOV SI,OFFSET NAME1 wrt DOSGROUP; find_buf 2 = formatted name 187 movmov: 188 assume ds:nothing 189 ; Special E5 code 0 00003471 A4 MOVSB 0 00003472 26807DFF05 CMP BYTE PTR [ES:DI-1],5 0 00003477 7505 JNZ NOTKANJB 0 00003479 26C645FFE5 MOV BYTE PTR [ES:DI-1],0E5H 194 NOTKANJB: 195 0 0000347E B90A00 MOV CX,10 0 00003481 F3A4 REP MOVSB 0 00003483 1F POP DS ;FO.;AN001; restore ds 199 assume ds:DOSGROUP 200 201 Attrib equ ATTRIB ; NASM port label 0 00003484 A0[0000] MOV AL,[Attrib] 0 00003487 AA STOSB 0 00003488 50 PUSH AX ; Save AH device info 0 00003489 A1[0000] MOV AX,[LastEnt] 0 0000348C AB STOSW 207 DirStart equ DIRSTART ; NASM port label 0 0000348D A1[0000] MOV AX,[DirStart] 0 00003490 AB STOSW 210 ; 4 bytes of 21 byte cont structure left for NET stuff 0 00003491 83C704 ADD DI,4 0 00003494 58 POP AX ; Recover AH device info 0 00003495 08E4 OR AH,AH 0 00003497 781B JS DOSREL ; Device entry is DOSGROUP relative 0 00003499 833E[0000]FF CMP WORD PTR [CURBUF],-1 0 0000349E 7510 JNZ OKSTORE 217 FastOPenFlg equ FastopenFlg ; NASM port label 0 000034A0 F606[0000]10 TEST byte [FastOPenFlg],Set_For_Search ;AN000;;FO. from fastopen and is good 0 000034A5 7509 JNZ OKSTORE ;AN000;;FO. 220 221 222 223 ; The user has specified the root directory itself, rather than some 224 ; contents of it. We can't "find" that. 0 000034A7 26C745F8FFFF MOV WORD PTR [ES:DI-8],-1 ; Cause DOS_SEARCH_NEXT to fail by 226 ; stuffing a -1 at Lastent 0 000034AD E97CFF JMP find_no_more 228 229 OKSTORE: 0 000034B0 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 231 ASSUME DS:NOTHING 232 DOSREL: 0 000034B4 89DE MOV SI,BX ; SI-> start of entry 234 235 ; NOTE: DOS_RENAME depends on BX not being altered after this point 236 0 000034B6 B92000 MOV CX,dir_entry_struc_size 238 ;;;;; 7/29/86 0 000034B9 89F8 MOV AX,DI ; save the 1st byte addr 0 000034BB F3A4 REP MOVSB 0 000034BD 89C7 MOV DI,AX ; restore 1st byte addr 0 000034BF 26803D05 CMP BYTE PTR [ES:DI],05H ; special char check 0 000034C3 7504 JNZ NO05 0 000034C5 26C605E5 MOV BYTE PTR [ES:DI],0E5H ; convert it back to E5 245 NO05: 246 247 ;;;;; 7/29/86 0 000034C9 161F context DS 0 000034CB 8026[0000]80 AND byte [FastOpenflg],Fast_yes ;AN000;;FO. reset fastopen 0 000034D0 F8 CLC 0 000034D1 E8[0000] LeaveCrit critDisk 0 000034D4 C3 return 253 254 EndProc DOS_SEARCH_FIRST 255 256 BREAK 257 258 ; Inputs: 259 ; [DMAADD] Points to 53 byte buffer returned by DOS_SEARCH_FIRST 260 ; (only first 21 bytes must have valid information) 261 ; Function: 262 ; Look for subsequent matches 263 ; Outputs: 264 ; CARRY CLEAR 265 ; The 53 bytes at DMAADD are updated for next call 266 ; (see DOS_SEARCH_FIRST) 267 ; CARRY SET 268 ; AX = error code 269 ; error_no_more_files 270 ; No more files to find 271 ; DS preserved, others destroyed 272 273 procedure DOS_SEARCH_NEXT,NEAR 273 ****************** warning: proc DOS_SEARCH_NEXT... [-w+user] 274 DOSAssume CS,,"DOS_Search_Next" 275 ASSUME ES:NOTHING 276 0 000034D5 C43E[0000] LES DI,[DMAADD] 0 000034D9 268A05 MOV AL,[ES:DI] 0 000034DC A880 TEST AL,80H ; Test for NET 0 000034DE 7406 JZ LOCAL_SEARCH_NEXT 281 %IFN Installed 282 transfer NET_SEARCH_NEXT 283 %ELSE 0 000034E0 B81C11 MOV AX,(multNET << 8) | 28 0 000034E3 CD2F INT 2FH 0 000034E5 C3 return 287 %ENDIF 288 289 LOCAL_SEARCH_NEXT: 290 ;AL is drive A=1 0 000034E6 C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 000034EB E8[0000] EnterCrit critDisk 293 ThisCDS equ THISCDS ; NASM port label 0 000034EE C706[0000][0000] MOV WORD [ThisCDS],OFFSET DummyCDS wrt DOSGROUP 0 000034F4 8C1E[0200] MOV WORD PTR [ThisCDS+2], ds 0 000034F8 0440 ADD AL,'A'-1 0 000034FA E8[0000] invoke InitCDS 298 299 ; invoke GetThisDrv ; Set CDS pointer 300 0 000034FD 7236 JC No_files ; Bogus drive letter 0 000034FF C43E[0000] LES DI,[THISCDS] ; Get CDS pointer 0 00003503 26C46D45 LES BP,[ES:DI + curdir_devptr]; Get DPB pointer 0 00003507 E8[0000] invoke GOTDPB ; [THISDPB] = ES:BP 305 0 0000350A 268A4600 mov AL,[ES:BP + dpb_drive] 307 ThisDrv equ THISDRV ; NASM port label 0 0000350E A2[0000] mov [ThisDrv],AL 309 310 CREATING equ Creating ; NASM port label 0 00003511 C706[0000]00E5 MOV WORD PTR [CREATING],0E500H 0 00003517 C606[0000]01 MOV byte [NoSetDir],1 ; if we find a dir, don't change to it 0 0000351C C536[0000] LDS SI,[DMAADD] 314 ASSUME DS:NOTHING 0 00003520 AC LODSB ; Drive Byte 316 317 ; DEC AL 318 ; MOV [THISDRV],AL 319 320 entry RENAME_NEXT ; Entry used by DOS_RENAME 321 0 00003521 1607 context ES ; THIS BLOWS ES:BP POINTER TO DPB 0 00003523 BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP 0 00003526 B90B00 MOV CX,11 0 00003529 F3A4 REP MOVSB ; Search name 0 0000352B AC LODSB ; Attribute 0 0000352C 36A2[0000] MOV [ss:ATTRIB],AL 0 00003530 AD LODSW ; LastEnt 0 00003531 09C0 OR AX,AX 0 00003533 7903 JNS cont_load 331 No_files: 0 00003535 E9F4FE JMP find_no_more 333 334 cont_load: 0 00003538 50 PUSH AX ; Save LastEnt 0 00003539 AD LODSW ; DirStart 0 0000353A 89C3 MOV BX,AX 0 0000353C 161F context DS 0 0000353E C42E[0000] LES BP,[THISDPB] ; Recover ES:BP 0 00003542 E8[0000] invoke SetDirSrch 0 00003545 7303 JNC SEARCH_GOON 0 00003547 58 POP AX ; Clean stack 0 00003548 EBEB JMP No_files 344 345 SEARCH_GOON: 0 0000354A E8[0000] invoke StartSrch 0 0000354D 58 POP AX 0 0000354E E8[0000] invoke GetEnt 0 00003551 72E2 JC No_files 0 00003553 E8[0000] invoke NextEnt 0 00003556 72DD JC No_files 0 00003558 30E4 XOR AH,AH ; If Search_Next, can't be a DEV 0 0000355A E9FCFE JMP found_it 354 355 EndProc DOS_SEARCH_NEXT 356 357 358 ;Input: [WFP_START]= pointer to final path 359 ;Function: check '?' char 360 ;Output: carry clear, if no '?' 361 ; carry set, if '?' exists 362 363 procedure CHECK_QUESTION,NEAR ;AN000; 363 ****************** warning: proc CHECK_QUESTION... [-w+user] 364 ASSUME ES:NOTHING,DS:NOTHING ;AN000; 365 0 0000355D 16 PUSH ss ;AN000;;FO. 0 0000355E 1F POP DS ;AN000;;FO. ds:si -> final path 368 assume ds:DOSGROUP 369 WFP_START equ WFP_Start ; NASM port label 0 0000355F 8B36[0000] MOV SI,[WFP_START] ;AN000;;FO. 371 getnext: ;AN000; 0 00003563 AC LODSB ;AN000;;FO. get char 0 00003564 84C0 test AL,AL ;AN000;;FO. is it null 0 00003566 7405 JZ NO_Question ;AN000;;FO. yes --> (NC) 0 00003568 3C3F CMP AL,'?' ;AN000;;FO. is '?' 0 0000356A 75F7 JNZ getnext ;AN000;;FO. no 0 0000356C F9 STC ;AN000;;FO. 378 NO_Question: ;AN000; 0 0000356D C3 return ;AN000;;FO. 380 381 EndProc CHECK_QUESTION ;AN000; 382 383 END === Trace listing source: ../DOS/abort.lst 1 ; SCCSID = @(#)abort.asm 1.4 85/10/02 2 ;TITLE DOS_ABORT - Internal SFT close all files for proc call for MSDOS 3 ;NAME DOS_ABORT 4 5 ; Internal Abort call closes all handles and FCBs associated with a process. 6 ; If process has NET resources a close all is sent out over the net. 7 ; 8 ; DOS_ABORT 9 ; 10 ; Modification history: 11 ; 12 ; Created: ARR 30 March 1983 13 ; 14 15 ; 16 ; get the appropriate segment definitions 17 ; 18 19 %include "dosseg.nas" 1 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 3 <1> ; 4 <1> ; segment ordering for MSDOS 5 <1> ; 6 <1> 7 <1> %include "ddataseg.nas" 1 <2> 2 <2> %include "lmacros3.mac" 1 <3> [list -] 1 ****************** <3> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 === Switch to base=002450h -> "DOSCODECODE" 21 section DOSCODECODE 22 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 29 30 %iassign Installed TRUE 31 32 I_Need PROC_ID,WORD ; current process ID 33 I_Need USER_ID,WORD ; current user ID 34 i_need CurrentPDB,WORD 35 i_need sft_addr,DWORD 36 i_need THISSFT,DWORD 37 i_need JSHARE,DWORD 38 I_need sftFCB,DWORD ; pointer to SFTs for FCB cache 39 40 Break 41 42 ; Inputs: 43 ; [CurrentPDB] set to PID of process aborting 44 ; Function: 45 ; Close all files and free all SFTs for this PID 46 ; Returns: 47 ; None 48 ; All destroyed except stack 49 50 Procedure DOS_ABORT,NEAR 50 ****************** warning: proc DOS_ABORT... [-w+user] 51 assume ds:nothing, es:nothing, ss:DOSGROUP 52 0 0000356E 368E06[0000] MOV ES,[ss:CurrentPDB] 54 assume es:PSP 0 00003573 268B0E3200 MOV CX,[ES:PDB_JFN_Length] ; Number of JFNs 56 reset_free_jfn: 0 00003578 89CB MOV BX,CX 0 0000357A 51 PUSH CX 0 0000357B 4B DEC BX ; get jfn (start with last one) 60 0 0000357C E8[0000] invoke D_close 0 0000357F 59 POP CX 0 00003580 E2F6 LOOP reset_free_jfn ; and do 'em all 64 ; 65 ; Note: We do need to explicitly close FCBs. Reasons are as follows: If we 66 ; are running in the no-sharing no-network environment, we are simulating the 67 ; 2.0 world and thus if the user doesn't close the file, that is his problem 68 ; BUT... the cache remains in a state with garbage that may be reused by the 69 ; next process. We scan the set and blast the ref counts of the FCBs we own. 70 ; 71 ; If sharing is loaded, then the following call to close process will 72 ; correctly close all FCBs. We will then need to walk the list AFTER here. 73 ; 74 ; Finally, the following call to NET_Abort will cause an EOP to be sent to all 75 ; known network resources. These resources are then responsible for cleaning 76 ; up after this process. 77 ; 78 ; Sleazy, eh? 79 ; 0 00003582 161F context DS 81 multNet equ MultNET ; NASM port equate 0 00003584 B81D11CD2F CallInstall Net_Abort, multNet, 29 83 %if installed 84 JShare equ JSHARE ; NASM port label 0 00003589 FF1E[1000] call far [JShare + 4 * 4] 86 %else 87 call mftCloseP 88 %endif 89 assume ds:nothing 90 ; 91 ; Scan the FCB cache for guys that belong to this process and zap their ref 92 ; counts. 93 ; 0 0000358D 36C43E[0000] les di,[ss:sftFCB] ; grab the pointer to the table 95 assume es:nothing 96 sfCount equ SFCount ; NASM port equate 0 00003592 268B4D04 mov cx,[es:di + sfCount] 0 00003596 E317 jcxz FCBScanDone 99 sfTable equ SFTable ; NASM port equate 0 00003598 8D7D06 LEA DI,[DI + sfTable] ; point at table 101 proc_id equ PROC_ID ; NASM port label 0 0000359B 36A1[0000] mov ax,[ss:proc_id] 103 FCBTest: 0 0000359F 26394531 cmp [es:di + sf_PID],ax ; is this one of ours 0 000035A3 7505 jnz FCBNext ; no, skip it 0 000035A5 26C7050000 mov word [es:di + sf_ref_count],0 ; yes, blast ref count 107 FCBNext: 108 sf_Entry_struc_size equ sf_entry_struc_size ; NASM port equate 0 000035AA 83C73B add di,sf_Entry_struc_size 0 000035AD E2F0 loop FCBTest 111 FCBScanDone: 112 113 ; 114 ; Walk the SFT to eliminate all busy SFT's for this process. 115 ; 0 000035AF 31DB XOR BX,BX 117 Scan: 0 000035B1 53 push bx 0 000035B2 E8[0000] invoke SFFromSFN 120 assume es:nothing 0 000035B5 5B pop bx 0 000035B6 7301C3 retc 123 ; lDOS note: For MS-DOS v5 the following comparison 124 ; only has us operate on entries with a reference 125 ; count equal to 0FFFFh, signifying a temporarily 126 ; busy SFT entry. This difference had us interfere 127 ; with the initial PSP relocation in sysinit1.nas, 128 ; but the difference is relevant for others too. 129 ; Need to study when MS-DOS v5 leaves this special 130 ; value in the reference count field. 0 000035B9 26833D00 cmp word [es:di + sf_ref_count],0 0 000035BD 7419 jz next 133 ; 134 ; we have a SFT that is not free. See if it is for the current process 135 ; 0 000035BF 36A1[0000] mov ax,[ss:proc_id] 137 sf_pid equ sf_PID ; NASM port equate 0 000035C3 26394531 cmp [es:di + sf_pid],ax 0 000035C7 750F jnz next 140 user_id equ USER_ID ; NASM port label 0 000035C9 36A1[0000] mov ax,[ss:user_id] 142 sf_uid equ sf_UID ; NASM port equate 0 000035CD 2639452F cmp [es:di + sf_uid],ax 0 000035D1 7505 jnz next 145 ; 146 ; This SFT is labelled as ours. 147 ; 0 000035D3 26C7050000 mov word [es:di + sf_ref_count],0 149 next: 0 000035D8 43 inc bx 151 scan equ Scan ; NASM port label 0 000035D9 EBD6 jmp scan 153 154 EndProc DOS_Abort 155 156 END === Trace listing source: ../DOS/close.lst 1 ; SCCSID = @(#)close.asm 1.1 85/04/09 2 ;TITLE DOS_CLOSE/COMMIT - Internal SFT close and commit call for MSDOS 3 ;NAME DOS_CLOSE 4 ; Internal Close and Commit calls to close a local or NET SFT. 5 ; 6 ; DOS_CLOSE 7 ; DOS_COMMIT 8 ; FREE_SFT 9 ; SetSFTTimes 10 ; 11 ; Revision history: 12 ; 13 ; AN000 version 4.00 Jan. 1988 14 ; A005 PTM 3718 --- lost clusters when fastopen installed 15 ; A011 PTM 4766 --- C2 fastopen problem 16 17 ; 18 ; get the appropriate segment definitions 19 ; 20 [list -] 20 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 22 23 [list +] === Switch to base=002450h -> "DOSCODECODE" 24 section DOSCODECODE 25 [list -] 25 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 25 ****************** warning: out: BPB.INC... [-w+user] 25 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 25 ****************** warning: out: DEVSYM.INC... [-w+user] 32 33 %iassign Installed TRUE 34 35 I_need Attrib,BYTE 36 i_need THISSFT,DWORD 37 i_need CURBUF,DWORD 38 i_need THISDRV,BYTE 39 i_need ALLOWED,BYTE 40 i_need EXTERR_LOCUS,BYTE 41 I_need FailErr,BYTE 42 I_Need PROC_ID,WORD 43 I_Need USER_ID,WORD 44 i_need JShare,DWORD 45 i_need HIGH_SECTOR,WORD ;F.C. >32mb 46 i_need OLD_FIRSTCLUS,WORD ;F.O. >32mb 47 %if debug 48 I_need BugLev,WORD 49 I_need BugTyp,WORD 50 %include "bugtyp.nas" 51 %endif 52 53 assume nocheck, ss:DOSGROUP 54 55 Break 56 57 ; Inputs: 58 ; [THISSFT] set to the SFT for the file being used 59 ; Function: 60 ; Close the indicated file via the SFT 61 ; Returns: 62 ; sf_ref_count decremented otherwise 63 ; ES:DI point to SFT 64 ; Carry set if error 65 ; AX has error code 66 ; DS preserved, others destroyed 67 68 procedure DOS_CLOSE,NEAR 68 ****************** warning: proc DOS_CLOSE... [-w+user] 69 DOSAssume CS,,"DOS_Close" 70 ASSUME ES:NOTHING 71 0 000035DB C43E[0000] LES DI,[THISSFT] 73 Assert ISSFT,,<"DOS_CLOSE"> 74 fmt TypAccess,LevBUSY,<"$p: CLOSE SFT: $x:$x\n">, 0 000035DF 268B5D05 MOV BX,[ES:DI + sf_flags] 76 ; 77 ; Network closes are handled entirely by the net code. 78 ; 0 000035E3 F7C30080 TEST BX,sf_isnet 0 000035E7 7406 JZ LocalClose 81 ; invoke OWN_SHARE ;IFS. IFS owns share ? ;AN000; 82 ; JZ noshare ;IFS. yes ;AN000; 83 ; EnterCrit critDisk ;IFS. ;AN000; 84 ; CALL SetSFTTimes ;IFS. set time for all SFT ;AN000; 85 ; LeaveCrit critDisk ;IFS. ;AN000; 86 noshare: 87 multnet equ MultNET ; NASM port equate 0 000035E9 B80611CD2F CallInstall Net_Close,multnet,6 89 ; JC nomore ;IFS. error ;AN000; 90 ; invoke OWN_SHARE ;IFS. IFS owns share ? ;AN000; 91 ; JZ nomore ;IFS. yes ;AN000; 92 ; invoke ShareEnd ;IFS. remove SFT entry from share ;AN000; 93 nomore: 0 000035EE C3 return 95 96 ; 97 ; All closes release the sharing information. 98 ; No commit releases sharing information 99 ; 100 ; All closes decrement the ref count. 101 ; No commit decrements the ref count. 102 ; 103 LocalClose: 0 000035EF E8[0000] EnterCrit critDisk 0 000035F2 E88C01 CALL SetSFTTimes 106 Free_SFT equ FREE_SFT ; NASM port label 0 000035F5 E80001 CALL Free_SFT ; dec ref count or mark as busy 108 0 000035F8 F7C38000 TEST BX,devid_device ;FS. device ? ;AN000; 0 000035FC 7511 JNZ nofastsk ;FS. yes ;AN000; 0 000035FE 268B4D0B MOV CX,[ES:DI + sf_firclus] ;FS. cx= first cluster ;AN000; 0 00003602 09C9 OR CX,CX ;FS. cx=0 ? ;AN000; 0 00003604 7409 JZ nofastsk ;FS. yes, dont do it ;AN000; 0 00003606 26C57507 LDS SI,[ES:DI + sf_devptr] ;FS. ;AN000; 0 0000360A 8A14 MOV DL,[SI + dpb_drive] ;FS. dl= drive ;AN000; 0 0000360C E8[0000] invoke FastSeek_Close ;FS. invoke fastseek ;AN000; 117 nofastsk: 0 0000360F 161F Context DS 0 00003611 5053 SaveReg 0 00003613 E8[0000] invoke ShareEnd 0 00003616 5B58 RestoreReg 122 ; 123 ; Commit enters here. AX from commit MUST be <> 1, BX is flags word 124 ; 125 CloseEntry: 0 00003618 50 PUSH AX 127 ; 128 ; File clean or device does not get stamped nor disk looked at. 129 ; 0 00003619 F7C3C000 TEST BX,devid_file_clean + devid_device 0 0000361D 7403 JZ rdir 132 Free_SFT_OK equ FREE_SFT_OK ; NASM port label 0 0000361F E9C300 JMP Free_SFT_OK ; either clean or device 134 ; 135 ; Retrieve the directory entry for the file 136 ; 137 rdir: 0 00003622 E8E000 CALL DirFromSFT 139 ASSUME DS:NOTHING 0 00003625 B005 MOV AL,error_access_denied 0 00003627 7303 JNC clook 0 00003629 E9BA00 JMP CloseFinish ; pretend the close worked. 143 clook: 144 ; 145 ; ES:DI points to entry 146 ; DS:SI points to SFT 147 ; ES:BX points to buffer header 148 ; 0 0000362C 5756 SaveReg 0 0000362E 8D7420 LEA SI,[SI + sf_name] 151 ; 152 ; ES:DI point to directory entry 153 ; DS:SI point to unpacked name 154 ; 0 00003631 E8[0000] invoke XCHGP 156 ; 157 ; ES:DI point to unpacked name 158 ; DS:SI point to directory entry 159 ; 0 00003634 E8[0000] invoke MetaCompare 0 00003637 E8[0000] invoke XCHGP 0 0000363A 5E5F RestoreReg 0 0000363C 740C JZ CLOSE_GO ; Name OK 0 0000363E 89F7 Bye: MOV DI,SI 0 00003640 1E PUSH DS 0 00003641 07 POP ES ; ES:DI points to SFT 167 assume es:nothing 0 00003642 16 PUSH SS 0 00003643 1F POP DS 170 assume ds:DOSGROUP 0 00003644 F9 STC 0 00003645 B002 MOV AL,error_file_not_found 0 00003647 E99C00 JMP CloseFinish 174 175 CLOSE_GO: 0 0000364A F744020080 TEST word [SI + sf_mode],sf_isfcb ; FCB ? 0 0000364F 7412 JZ nofcb ; no, set dir attr, sf_attr 0 00003651 268A6D0B MOV CH,[ES:DI + dir_attr] 0 00003655 8A4404 MOV AL,[SI + sf_attr] 0 00003658 36A2[0000] MOV [ss:Attrib],AL 0 0000365C E8[0000] invoke MatchAttributes 0 0000365F 75DD JNZ Bye ; attributes do not match 0 00003661 EB07 JMP SHORT setattr ;FT. 184 nofcb: 0 00003663 8A4404 MOV AL,[SI + sf_attr] ;FT. ;AN000; 0 00003666 2688450B MOV [ES:DI + dir_attr],AL ;FT. ;AN000; 187 setattr: 0 0000366A 26804D0B20 OR BYTE PTR [ES:DI + dir_attr],attr_archive ;Set archive 0 0000366F 268B451A MOV AX,[ES:DI + dir_first] ;AN011;F.O. save old first clusetr 0 00003673 36A3[0000] MOV [ss:OLD_FIRSTCLUS],AX ;AN011;F.O. save old first clusetr 191 0 00003677 8B440B MOV AX,[SI + sf_firclus] 0 0000367A 2689451A MOV [ES:DI + dir_first],AX ;Set firclus pointer 0 0000367E 8B4411 MOV AX,WORD PTR [SI + sf_size] 0 00003681 2689451C MOV [ES:DI + dir_size_l],AX ;Set size 0 00003685 8B4413 MOV AX,WORD PTR [SI + sf_size+2] 0 00003688 2689451E MOV [ES:DI + dir_size_h],AX 0 0000368C 8B440F MOV AX,[SI + sf_date] 0 0000368F 26894518 MOV [ES:DI + dir_date],AX ;Set date 0 00003693 8B440D MOV AX,[SI + sf_time] 0 00003696 26894516 MOV [ES:DI + dir_time],AX ;Set time 202 ;; File Tagging 203 204 ; MOV AX,[SI.sf_codepage] ;AN000; 205 ; MOV [ES:DI.dir_codepg],AX ;AN000;Set code page 206 ; MOV AX,[SI.sf_extcluster] ;AN000; 207 ; MOV [ES:DI.dir_extcluster],AX ;AN000; ;Set XA cluster 208 ; MOV AL,[SI.sf_attr_hi] ;AN000; 209 ; MOV [ES:DI.dir_attr2],AL ;AN000; ;Set high attr 210 211 ;; File Tagging 0 0000369A 26F6470540 TEST byte [ES:BX + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 0000369F 7508 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 000036A1 E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 000036A4 26804F0540 OR byte [ES:BX + buf_flags],buf_dirty ;Buffer dirty 216 yesdirty: 0 000036A9 1E56 SaveReg 0 000036AB 8B4C0B MOV CX,[SI + sf_firclus] ; do this for Fastopen 0 000036AE 36A0[0000] MOV AL,[ss:THISDRV] 220 ;;; 10/1/86 update fastopen cache 0 000036B2 52 PUSH DX 0 000036B3 B400 MOV AH,0 ; dir entry update 0 000036B5 88C2 MOV DL,AL ; drive number A=0, B=1,,, 0 000036B7 09C9 OR CX,CX ;AN005; first cluster 0; may be truncated 0 000036B9 750D JNZ do_update2 ;AN005; no, do update 0 000036BB B403 MOV AH,3 ;AN005; do a delete cache entry 0 000036BD 8B7C1B MOV DI,WORD PTR [SI + sf_dirsec] ;AN005; cx:di = dir sector 0 000036C0 8B4C1D MOV CX,WORD PTR [SI + sf_dirsec+2] ;AN005; 0 000036C3 8A741F MOV DH,[SI + sf_dirpos] ;AN005; dh= dir pos 0 000036C6 EB0E JMP SHORT do_update ;AN011;F.O. 231 do_update2: ;AN011;F.O. 0 000036C8 363B0E[0000] CMP CX,[ss:OLD_FIRSTCLUS] ;AN011;F.O. same as old first clusetr? 0 000036CD 7407 JZ do_update ;AN011;F.O. yes 0 000036CF B402 MOV AH,2 ;AN011;F.O. delete the old entry 0 000036D1 368B0E[0000] MOV CX,[ss:OLD_FIRSTCLUS] ;AN011;F.O. 236 do_update: ;AN005; 0 000036D6 161F Context DS 0 000036D8 E8[0000] invoke FastOpen_Update ; invoke fastopen 0 000036DB 5A POP DX 240 241 ;;; 10/1/86 update fastopen cache 0 000036DC E8[0000] invoke FLUSHBUF ; flush all relevant buffers 0 000036DF 5F07 RestoreReg 0 000036E1 B005 MOV AL,error_access_denied 0 000036E3 7201 JC CloseFinish 246 FREE_SFT_OK: 0 000036E5 F8 CLC ; signal no error. 248 CloseFinish: 249 ; 250 ; Indicate to the device that the SFT is being closed. 251 ; 252 ;;;; 7/21/86 0 000036E6 9C PUSHF ; save flag from DirFromSFT 0 000036E7 E8[0000] invoke Dev_Close_SFT 0 000036EA 9D POPF 256 ;;;; 7/21/86 257 ; 258 ; See if the ref count indicates that we have busied the SFT. If so, mark the 259 ; SFT as being free. Note that we do NOT need to be in critSFT as we are ONLY 260 ; going to be moving from busy to free. 261 ; 0 000036EB 59 POP CX ; get old ref count 0 000036EC 9C PUSHF 264 fmt TypAccess,LevBUSY,<"$p: DOSFreeSFT: $x:$x from $x\n">, 0 000036ED 49 DEC CX ; if cx != 1 0 000036EE 7503 JNZ NoFree ; then do NOT free SFT 267 Assert ISSFT,,"DOS_FREE_SFT" 268 sf_ref_Count equ sf_ref_count ; NASM port equate 0 000036F0 26890D MOV [ES:DI + sf_ref_Count],CX 270 NoFree: 0 000036F3 E8[0000] LeaveCrit critDisk 0 000036F6 9D POPF 0 000036F7 C3 return 274 EndProc DOS_Close 275 276 ; 277 ; ES:DI -> SFT. Decs sft_ref_count. If the count goes to 0, mark it as busy. 278 ; Flags preserved. Return old ref count in AX 279 ; 280 ; Note that busy is indicated by the SFT ref count being -1. 281 ; 282 Procedure FREE_SFT,NEAR 282 ****************** warning: proc FREE_SFT... [-w+user] 283 DOSAssume CS,,"Free_SFT" 284 ASSUME ES:NOTHING 285 0 000036F8 9C PUSHF ; Save carry state 0 000036F9 268B05 MOV AX,[ES:DI + sf_ref_count] 0 000036FC 48 DEC AX 0 000036FD 7501 JNZ SetCount 0 000036FF 48 DEC AX 291 SetCount: 0 00003700 268705 XCHG AX,[ES:DI + sf_ref_count] 0 00003703 9D POPF 0 00003704 C3 return 295 296 EndProc Free_SFT 297 298 ; 299 ; DirFromSFT - locate a directory entry given an SFT. 300 ; 301 ; Inputs: ES:DI point to SFT 302 ; DS = DOSGroup 303 ; Outputs: 304 ; EXTERR_LOCUS = errLOC_Disk 305 ; CurBuf points to buffer 306 ; Carry Clear -> operation OK 307 ; ES:DI point to entry 308 ; ES:BX point to buffer 309 ; DS:SI point to SFT 310 ; Carry SET -> operation failed 311 ; registers trashified 312 ; Registers modified: ALL 313 314 Procedure DirFromSFT,NEAR 314 ****************** warning: proc DirFromSFT... [-w+user] 315 ASSUME DS:DOSGroup,ES:NOTHING 316 0 00003705 C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 0000370A 0657 SaveReg 0 0000370C 268B551D MOV DX,WORD PTR [ES:DI + sf_dirsec+2] ;F.C. >32mb 0 00003710 8916[0000] MOV [HIGH_SECTOR],DX ;F.C. >32mb 0 00003714 268B551B MOV DX,WORD PTR [ES:DI + sf_dirsec] 322 0 00003718 FF36[0000] PUSH word [HIGH_SECTOR] ;F.C. >32mb 0 0000371C 52 PUSH DX 0 0000371D E8[0000] invoke FATREAD_SFT ; ES:BP points to DPB, [THISDRV] set 326 ; [THISDPB] set 0 00003720 5A POP DX 0 00003721 8F06[0000] POP word [HIGH_SECTOR] ;F.C. >32mb 0 00003725 7225 JC PopDone 0 00003727 30C0 XOR AL,AL ; Pre read 331 allowed_FAIL equ Allowed_FAIL ; NASM port equate 332 allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 00003729 C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 0000372E E8[0000] invoke GETBUFFR 0 00003731 7219 JC PopDone 0 00003733 5E1F RestoreReg ; Get back SFT pointer 337 ASSUME DS:NOTHING 338 Curbuf equ CURBUF ; NASM port label 0 00003735 36C43E[0000] LES DI,[ss:Curbuf] 0 0000373A 26804D0504 OR byte [ES:DI + buf_flags],buf_isDIR 0 0000373F 89FB MOV BX,DI ; ES:BX point to buffer header 0 00003741 8D7D10 LEA DI,[DI + BUFINSIZ] ; Point to buffer 0 00003744 B020 MOV AL,dir_entry_struc_size 344 sf_DirPos equ sf_dirpos ; NASM port equate 0 00003746 F6641F MUL byte [SI + sf_DirPos] 0 00003749 01C7 ADD DI,AX ; Point at the entry 347 0 0000374B C3 return ; carry is clear 349 PopDone: 0 0000374C 5F07 RestoreReg 0 0000374E C3 return 352 EndProc DirFromSFT 352 ****************** warning: ***** Possible stack size error in DirFromSFT ***** [-w+user] 353 354 Break 355 356 ; Inputs: 357 ; Same as DOS_CLOSE 358 ; Function: 359 ; Commit the file 360 ; Returns: 361 ; Same as DOS_CLOSE except ref_count field is not altered 362 ; DS preserved, others destroyed 363 364 procedure DOS_COMMIT,NEAR 364 ****************** warning: proc DOS_COMMIT... [-w+user] 365 DOSAssume CS,,"DOS_Commit" 366 ASSUME ES:NOTHING 367 0 0000374F C43E[0000] LES DI,[THISSFT] 0 00003753 268B5D05 MOV BX,[ES:DI + sf_flags] 0 00003757 F7C3C000 TEST BX,devid_file_clean + devid_device ;Clears carry 0 0000375B 75F1 retnz 0 0000375D F7C30080 TEST BX,sf_isnet 0 00003761 7406 JZ LOCAL_COMMIT 374 %IFN Installed 375 transfer NET_COMMIT 376 %ELSE 377 multNET equ MultNET ; NASM port equate 0 00003763 B80711 MOV AX,(multNET << 8) | 7 0 00003766 CD2F INT 2FH 0 00003768 C3 return 381 %ENDIF 382 383 ; 384 ; Perform local commit operation by doing a close but not releaseing the SFT. 385 ; There are three ways we can do this. One is to enter a critical section to 386 ; protect a potential free. The second is to increment the ref count to mask 387 ; the close decrementing. 388 ; 389 ; The proper way is to let the caller's of close decide if a decrement should 390 ; be done. We do this by providing another entry into close after the 391 ; decrement and after the share information release. 392 ; 393 LOCAL_COMMIT: 0 00003769 E8[0000] EnterCrit critDisk 0 0000376C E8[0000] EnterCrit critDisk ;PTM. ;AN000; 0 0000376F E80F00 call SetSFTTimes 0 00003772 B8FFFF MOV AX,-1 0 00003775 E8A0FE call CloseEntry 0 00003778 9C PUSHF ;PTM. ;AN000; 0 00003779 E8[0000] invoke DEV_OPEN_SFT ;PTM. increment device count ;AN000; 0 0000377C 9D POPF ;PTM. ;AN000; 0 0000377D E8[0000] LeaveCrit CritDisk ;PTM. ;AN000; 0 00003780 C3 return 404 405 EndProc DOS_COMMIT 406 407 Break 408 409 ; 410 ; SetSFTTimes - Examine the flags for a SFT and set the time appropriately. 411 ; Reflect these times in other SFT's for the same file. 412 ; 413 ; Inputs: ES:DI point to SFT 414 ; BX = sf_flags set apprpriately 415 ; Outputs: Set sft times to current time iff File & dirty & !nodate 416 ; Registers modified: All except ES:DI, BX, AX 417 ; 418 419 Procedure SetSFTTimes,NEAR 419 ****************** warning: proc SetSFTTimes... [-w+user] 420 Assert ISSFT,,"SetSFTTimes" 421 ; 422 ; File clean or device does not get stamped nor disk looked at. 423 ; 0 00003781 F7C3C000 TEST BX,devid_file_clean + devid_device 0 00003785 75F9 retnz ; clean or device => no timestamp 426 ; 427 ; file and dirty. See if date is good 428 ; 0 00003787 F7C30040 TEST BX,sf_close_nodate 0 0000378B 75F3 retnz ; nodate => no timestamp 0 0000378D 5053 SaveReg 0 0000378F E8[0000] invoke DATE16 ; Date/Time to AX/DX 0 00003792 2689450F MOV [ES:DI + sf_date],AX 0 00003796 2689550D MOV [ES:DI + sf_time],DX 0 0000379A 31C0 XOR AX,AX 436 %if installed 0 0000379C FF1E[3800] call far [JShare + 14 * 4] 438 %else 439 call ShSU 440 %endif 0 000037A0 5B58 RestoreReg 0 000037A2 C3 return 443 EndProc SetSFTTimes 444 445 END === Trace listing source: ../DOS/dircall.lst 1 ; SCCSID = @(#)dircall.asm 1.1 85/04/10 2 ; SCCSID = @(#)dircall.asm 1.1 85/04/10 3 ;TITLE DIRCALL - Directory manipulation internal calls 4 ;NAME DIRCALL 5 ; Low level directory manipulation routines for making removing and 6 ; verifying local or NET directories 7 ; 8 ; DOS_MKDIR 9 ; DOS_CHDIR 10 ; DOS_RMDIR 11 ; 12 ; Modification history: 13 ; 14 ; Created: ARR 30 March 1983 15 ; 16 17 ; 18 ; get the appropriate segment definitions 19 ; 20 [list -] 20 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 22 23 [list +] === Switch to base=002450h -> "DOSCODECODE" 24 section DOSCODECODE 25 [list -] 25 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 25 ****************** warning: out: BPB.INC... [-w+user] 25 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 25 ****************** warning: out: DEVSYM.INC... [-w+user] 34 35 %iassign Installed TRUE 36 37 i_need THISSFT,DWORD 38 i_need THISCDS,DWORD 39 i_need NoSetDir,BYTE 40 i_need CURBUF, DWORD 41 i_need DIRSTART,WORD 42 i_need THISDPB,DWORD 43 i_need NAME1,BYTE 44 i_need LASTENT,WORD 45 i_need SATTRIB,BYTE 46 i_need ATTRIB,BYTE 47 i_need ALLOWED,BYTE 48 i_need FAILERR,BYTE 49 i_need RenBuf,BYTE 50 i_need FastOpenFlg,BYTE ; DOS 3.3 51 i_need FastOpenTable,BYTE ; DOS 3.3 52 i_need WFP_START,WORD ; DOS 3.3 53 i_need HIGH_SECTOR,WORD ; F.C. >32mb 54 55 assume nocheck, ss:DOSGROUP 56 57 BREAK 58 59 ; Inputs: 60 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 61 ; terminated) 62 ; [CURR_DIR_END] Points to end of Current dir part of string 63 ; ( = -1 if current dir not involved, else 64 ; Points to first char after last "/" of current dir part) 65 ; [THISCDS] Points to CDS being used 66 ; (Low word = -1 if NUL CDS (Net direct request)) 67 ; Function: 68 ; Make a new directory 69 ; Returns: 70 ; Carry Clear 71 ; No error 72 ; Carry Set 73 ; AX is error code 74 ; error_path_not_found 75 ; Bad path (not in curr dir part if present) 76 ; error_bad_curr_dir 77 ; Bad path in current directory part of path 78 ; error_access_denied 79 ; Already exists, device name 80 ; DS preserved, Others destroyed 81 82 procedure DOS_MKDIR,NEAR 82 ****************** warning: proc DOS_MKDIR... [-w+user] 83 DOSAssume CS,,"DOS_MkDir" 84 ASSUME ES:NOTHING 85 0 000037A3 E8[0000] Invoke TestNet 87 local_mkdir equ LOCAL_MKDIR ; NASM port label 0 000037A6 7314 JNC local_mkdir 89 %IFN Installed 90 transfer NET_MKDIR 91 %ELSE 92 multNET equ MultNET ; NASM port equate 0 000037A8 B80311 MOV AX,(multNET << 8) | 3 0 000037AB CD2F INT 2FH 0 000037AD C3 return 96 %ENDIF 97 98 NODEACCERRJ: 0 000037AE B80500 MOV AX,error_access_denied 100 BadRet: 0 000037B1 F9 STC 0 000037B2 E8[0000] LeaveCrit critDisk 0 000037B5 C3 return 104 105 PATHNFJ: 0 000037B6 E8[0000] LeaveCrit critDisk 0 000037B9 E9[0000] transfer SET_MKND_ERR ; Map the MakeNode error and return 108 109 LOCAL_MKDIR: 0 000037BC E8[0000] EnterCrit critDisk 111 ; 112 ; MakeNode requires an SFT to fiddle with. We Use a temp spot (RENBUF) 113 ; 0 000037BF 8C16[0200] MOV WORD PTR [THISSFT+2],SS 115 DOSGroup equ DOSGROUP ; NASM port equate 0 000037C3 C706[0000][0000] MOV WORD PTR [THISSFT],OFFSET RenBuf wrt DOSGroup 117 ; 118 ; NOTE: Need WORD PTR because MASM takes type of 119 ; TempSFT (byte) instead of type of sf_mft (word). 120 ; 121 sf_mft equ sf_MFT ; NASM port equate 0 000037C9 C706[3300]0000 MOV WORD [RenBuf + sf_mft],0 ; make sure SHARER won't complain. 0 000037CF B010 MOV AL,attr_directory 0 000037D1 E8[0000] invoke MAKENODE 125 0 000037D4 72E0 JC PATHNFJ 0 000037D6 83F803 CMP AX,3 0 000037D9 74D3 JZ NODEACCERRJ ; Can't make a device into a directory 0 000037DB C42E[0000] LES BP,[THISDPB] ; Makenode zaps this 0 000037DF C53E[0000] LDS DI,[CURBUF] 131 ASSUME DS:NOTHING 0 000037E3 29FE SUB SI,DI 0 000037E5 56 PUSH SI ; Pointer to dir_first 0 000037E6 FF750A PUSH WORD PTR [DI + buf_sector+2] ;F.C. >32mb 135 0 000037E9 FF7508 PUSH WORD PTR [DI + buf_sector] ; Sector of new node 0 000037EC 161F context DS 0 000037EE FF36[0000] PUSH word [DIRSTART] ; Parent for .. entry 0 000037F2 31C0 XOR AX,AX 0 000037F4 A3[0000] MOV [DIRSTART],AX ; Null directory 0 000037F7 E8[0000] invoke NEWDIR 0 000037FA 7277 JC NODEEXISTSPOPDEL ; No room 0 000037FC E8[0000] invoke GETENT ; First entry 0 000037FF 7272 JC NODEEXISTSPOPDEL ; Screw up 0 00003801 C43E[0000] LES DI,[CURBUF] 146 0 00003805 26F6450540 TEST byte [ES:DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 0000380A 7508 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 0000380C E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 0000380F 26804D0540 OR byte [ES:DI + buf_flags],buf_dirty 151 yesdirty: 0 00003814 83C710 ADD DI,BUFINSIZ ; Point at buffer 0 00003817 B82E20 MOV AX,202EH ; ". " 0 0000381A 8B16[0000] MOV DX,[DIRSTART] ; Point at itself 0 0000381E E8[0000] invoke SETDOTENT 0 00003821 B82E2E MOV AX,2E2EH ; ".." 0 00003824 5A POP DX ; Parent 0 00003825 E8[0000] invoke SETDOTENT 0 00003828 C42E[0000] LES BP,[THISDPB] 160 allowed_FAIL equ Allowed_FAIL ; NASM port equate 161 allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 0000382C C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00003831 5A POP DX ; Entry sector 0 00003832 8F06[0000] POP word [HIGH_SECTOR] ;F.C. >32mb 165 0 00003836 30C0 XOR AL,AL ; Pre read 0 00003838 E8[0000] invoke GETBUFFR 0 0000383B 7263 JC NODEEXISTSP 0 0000383D 8B16[0000] MOV DX,[DIRSTART] 0 00003841 C53E[0000] LDS DI,[CURBUF] 171 ASSUME DS:NOTHING 0 00003845 804D0504 OR byte [DI + buf_flags],buf_isDIR 0 00003849 5E POP SI ; dir_first pointer 0 0000384A 01FE ADD SI,DI 0 0000384C 8914 MOV [SI],DX 0 0000384E 31D2 XOR DX,DX 0 00003850 895402 MOV [SI+2],DX ; Zero size 0 00003853 895404 MOV [SI+4],DX 179 DIRUP: 0 00003856 F6450540 TEST byte [DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 0000385A 7507 JNZ yesdirty2 ;LB. don't increment dirty count ;AN000; 0 0000385C E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 0000385F 804D0540 OR byte [DI + buf_flags],buf_dirty ; Dirty buffer 184 yesdirty2: 0 00003863 161F context DS 0 00003865 268A4600 MOV AL,[ES:BP + dpb_drive] 0 00003869 E8[0000] invoke FLUSHBUF 0 0000386C B80500 MOV AX,error_access_denied 0 0000386F E8[0000] LeaveCrit critDisk 0 00003872 C3 return 191 192 NODEEXISTSPOPDEL: 0 00003873 5A POP DX ; Parent 0 00003874 5A POP DX ; Entry sector 0 00003875 8F06[0000] POP word [HIGH_SECTOR] ; F.C. >32mb 196 0 00003879 C42E[0000] LES BP,[THISDPB] 0 0000387D C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00003882 30C0 XOR AL,AL ; Pre read 0 00003884 E8[0000] invoke GETBUFFR 0 00003887 7217 JC NODEEXISTSP 0 00003889 C53E[0000] LDS DI,[CURBUF] 203 ASSUME DS:NOTHING 0 0000388D 804D0504 OR byte [DI + buf_flags],buf_isDIR 0 00003891 5E POP SI ; dir_first pointer 0 00003892 01FE ADD SI,DI 0 00003894 83EE1A SUB SI,dir_first ;Point back to start of dir entry 0 00003897 C604E5 MOV BYTE PTR [SI],0E5H ; Free the entry 0 0000389A E8B9FF CALL DIRUP ; Error doesn't matter since erroring anyway 210 NODEEXISTS: 0 0000389D E90EFF JMP NODEACCERRJ 212 213 NODEEXISTSP: 0 000038A0 5E POP SI ; Clean stack 0 000038A1 EBFA JMP NODEEXISTS 216 217 EndProc DOS_MKDIR 218 219 BREAK 220 221 ; Inputs: 222 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 223 ; terminated) 224 ; [CURR_DIR_END] Points to end of Current dir part of string 225 ; ( = -1 if current dir not involved, else 226 ; Points to first char after last "/" of current dir part) 227 ; [THISCDS] Points to CDS being used May not be NUL 228 ; Function: 229 ; Validate the path for potential new current directory 230 ; Returns: 231 ; NOTE: 232 ; [SATTRIB] is modified by this call 233 ; Carry Clear 234 ; CX is cluster number of the DIR, LOCAL CDS ONLY 235 ; Caller must NOT set ID fields on a NET CDS. 236 ; Carry Set 237 ; AX is error code 238 ; error_path_not_found 239 ; Bad path 240 ; error_access_denied 241 ; device or file name 242 ; DS preserved, Others destroyed 243 244 procedure DOS_CHDIR,NEAR 244 ****************** warning: proc DOS_CHDIR... [-w+user] 245 DOSAssume CS,,"DOS_Chdir" 246 ASSUME ES:NOTHING 247 0 000038A3 E8[0000] Invoke TestNet 0 000038A6 7306 JNC LOCAL_CHDIR 250 %IFN Installed 251 transfer NET_CHDIR 252 %ELSE 0 000038A8 B80511 MOV AX,(multNET << 8) | 5 0 000038AB CD2F INT 2FH 0 000038AD C3 return 256 %ENDIF 257 258 LOCAL_CHDIR: 0 000038AE E8[0000] EnterCrit critDisk 0 000038B1 26F745430020 TEST word [ES:DI + curdir_flags],curdir_splice ;PTM. 0 000038B7 7406 JZ nojoin ;PTM. 0 000038B9 26C74549FFFF MOV word [ES:DI + curdir_ID],0FFFFH ;PTM. 263 nojoin: 0 000038BF C606[0000]00 MOV byte [NoSetDir],FALSE 0 000038C4 C606[0000]16 MOV byte [SATTRIB],attr_directory+attr_system+attr_hidden 266 ; Dir calls can find these 267 ; DOS 3.3 6/24/86 FastOpen 268 0 000038C9 800E[0000]01 OR byte [FastOpenFlg],FastOpen_Set ; set fastopen flag 0 000038CE E8[0000] invoke GetPath 0 000038D1 9C PUSHF ;AN000; 0 000038D2 8026[0000]80 AND byte [FastOpenFlg],Fast_yes ; clear it all ;AC000; 0 000038D7 9D POPF ;AN000; 274 ; DOS 3.3 6/24/86 FastOpen 0 000038D8 B80300 MOV AX,error_path_not_found 0 000038DB 7207 JC ChDirDone 0 000038DD 753B JNZ NOTDIRPATH ; Path not a DIR 0 000038DF 8B0E[0000] MOV CX,[DIRSTART] ; Get cluster number 0 000038E3 F8 CLC 280 ChDirDone: 0 000038E4 E8[0000] LeaveCrit critDisk 0 000038E7 C3 return 283 284 EndProc DOS_CHDIR 285 286 BREAK 287 288 ; Inputs: 289 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 290 ; terminated) 291 ; [CURR_DIR_END] Points to end of Current dir part of string 292 ; ( = -1 if current dir not involved, else 293 ; Points to first char after last "/" of current dir part) 294 ; [THISCDS] Points to CDS being used 295 ; (Low word = -1 if NUL CDS (Net direct request)) 296 ; Function: 297 ; Remove a directory 298 ; NOTE: Attempt to remove current directory must be detected by caller 299 ; Returns: 300 ; NOTE: 301 ; [SATTRIB] is modified by this call 302 ; Carry Clear 303 ; No error 304 ; Carry Set 305 ; AX is error code 306 ; error_path_not_found 307 ; Bad path (not in curr dir part if present) 308 ; error_bad_curr_dir 309 ; Bad path in current directory part of path 310 ; error_access_denied 311 ; device or file name, root directory 312 ; Bad directory ('.' '..' messed up) 313 ; DS preserved, Others destroyed 314 315 procedure DOS_RMDIR,NEAR 315 ****************** warning: proc DOS_RMDIR... [-w+user] 316 DOSAssume CS,,"DOS_RmDir" 317 ASSUME ES:NOTHING 318 0 000038E8 E8[0000] Invoke TestNet 320 Local_RmDIR equ LOCAL_RMDIR ; NASM port label 0 000038EB 7306 JNC Local_RmDIR 322 %IFN Installed 323 transfer NET_RMDIR 324 %ELSE 0 000038ED B80111 MOV AX,(multNET << 8) | 1 0 000038F0 CD2F INT 2FH 0 000038F2 C3 return 328 %ENDIF 329 330 LOCAL_RMDIR: 0 000038F3 E8[0000] EnterCrit critDisk 0 000038F6 C606[0000]00 MOV byte [NoSetDir],0 0 000038FB C606[0000]16 MOV byte [SATTRIB],attr_directory+attr_system+attr_hidden 334 ; Dir calls can find these 0 00003900 E8[0000] invoke GetPath 0 00003903 720C JC NOPATH ; Path not found 0 00003905 7513 JNZ NOTDIRPATH ; Path not a DIR 0 00003907 8B3E[0000] MOV DI,[DIRSTART] 0 0000390B 09FF OR DI,DI ; Root ? 0 0000390D 750E JNZ rmdir_get_buf ; No 0 0000390F EB09 JMP SHORT NOTDIRPATH 342 343 NOPATH: 0 00003911 B80300 MOV AX,error_path_not_found 0 00003914 E99AFE JMP BadRet 346 347 NOTDIRPATHPOP: 0 00003917 58 POP AX ;F.C. >32mb 0 00003918 58 POP AX 350 NOTDIRPATHPOP2: 0 00003919 58 POP AX 352 NOTDIRPATH: 353 NodeAccErrJ equ NODEACCERRJ ; NASM port label 0 0000391A E991FE JMP NodeAccErrJ 355 356 rmdir_get_buf: 0 0000391D C53E[0000] LDS DI,[CURBUF] 358 ASSUME DS:NOTHING 0 00003921 29FB SUB BX,DI ; Compute true offset 0 00003923 53 PUSH BX ; Save entry pointer 0 00003924 FF750A PUSH WORD PTR [DI + buf_sector+2] ;F.C. >32mb 0 00003927 FF7508 PUSH WORD PTR [DI + buf_sector] ; Save sector number 0 0000392A 161F context DS 0 0000392C 1607 context ES 0 0000392E BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP 0 00003931 B03F MOV AL,'?' 0 00003933 B90B00 MOV CX,11 0 00003936 F3AA REP STOSB 0 00003938 30C0 XOR AL,AL 0 0000393A AA STOSB ; Nul terminate it 0 0000393B E8[0000] invoke STARTSRCH ; Set search 0 0000393E E8[0000] invoke GETENTRY ; Get start of directory 0 00003941 72D4 JC NOTDIRPATHPOP ; Screw up 0 00003943 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 375 ASSUME DS:NOTHING 0 00003947 89DE MOV SI,BX 0 00003949 AD LODSW 0 0000394A 3D2E20 CMP AX,(' ' << 8) | '.' ; First entry '.'? 0 0000394D 75C8 JNZ NOTDIRPATHPOP ; Nope 0 0000394F 83C61E ADD SI,(dir_entry_struc_size) - 2 ; Next entry 0 00003952 AD LODSW 0 00003953 3D2E2E CMP AX,('.' << 8) | '.' ; Second entry '..'? 0 00003956 75BF JNZ NOTDIRPATHPOP ; Nope 0 00003958 161F context DS 0 0000395A C706[0000]0200 MOV word [LASTENT],2 ; Skip . and .. 0 00003960 E8[0000] invoke GETENTRY ; Get next entry 0 00003963 72B2 JC NOTDIRPATHPOP ; Screw up 0 00003965 C606[0000]16 MOV byte [ATTRIB],attr_directory+attr_hidden+attr_system 0 0000396A E8[0000] invoke SRCH ; Do a search 0 0000396D 73A8 JNC NOTDIRPATHPOP ; Found another entry! 0 0000396F 803E[0000]00 CMP byte [FAILERR],0 0 00003974 75A1 JNZ NOTDIRPATHPOP ; Failure of search due to I 24 FAIL 0 00003976 C42E[0000] LES BP,[THISDPB] 0 0000397A 8B1E[0000] MOV BX,[DIRSTART] 395 ;; FastSeek 10/27/86 0 0000397E E8[0000] invoke Delete_FSeek ; delete the fastseek entry 397 ;; FastSeek 10/27/86 0 00003981 E8[0000] invoke RELEASE ; Release data in sub dir 0 00003984 7291 JC NOTDIRPATHPOP ; Screw up 0 00003986 5A POP DX ; Sector # of entry 0 00003987 8F06[0000] POP word [HIGH_SECTOR] ; F.C. >32mb 402 0 0000398B C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00003990 30C0 XOR AL,AL ; Pre read 0 00003992 E8[0000] invoke GETBUFFR ; Get sector back 0 00003995 7282 JC NOTDIRPATHPOP2 ; Screw up 0 00003997 C53E[0000] LDS DI,[CURBUF] 408 ASSUME DS:NOTHING 0 0000399B 804D0504 OR byte [DI + buf_flags],buf_isDIR 0 0000399F 5B POP BX ; Pointer to start of entry 0 000039A0 01FB ADD BX,DI ; Corrected 0 000039A2 C607E5 MOV BYTE PTR [BX],0E5H ; Free the entry 413 414 ;DOS 3.3 FastOpen 6/16/86 F.C. 0 000039A5 1E PUSH DS 0 000039A6 161F context DS 0 000039A8 E8[0000] invoke FastOpen_Delete ; call fastopen to delete an entry 0 000039AB 1F POP DS 419 ;DOS 3.3 FastOpen 6/16/86 F.C. 420 assume ds:nothing 421 0 000039AC E9A7FE JMP DIRUP ; In MKDIR, dirty buffer and flush 423 424 EndProc DOS_RMDIR 425 426 END === Trace listing source: ../DOS/disk.lst 1 ; SCCSID = @(#)disk.asm 1.1 85/04/10 2 ; SCCSID = @(#)disk.asm 1.1 85/04/10 3 ;TITLE DISK - Disk utility routines 4 ;NAME Disk 5 ; Low level Read and write routines for local SFT I/O on files and devs 6 ; 7 ; SWAPCON 8 ; SWAPBACK 9 ; DOS_READ 10 ; DOS_WRITE 11 ; get_io_sft 12 ; DirRead 13 ; FIRSTCLUSTER 14 ; SET_BUF_AS_DIR 15 ; FATSecRd 16 ; DREAD 17 ; CHECK_WRITE_LOCK 18 ; CHECK_READ_LOCK 19 ; 20 ; Revision history: 21 ; 22 ; A000 version 4.00 Jan. 1988 23 ; 24 25 ; 26 ; get the appropriate segment definitions 27 ; 28 [list -] 28 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 30 %include "fastseek.mac" ;AN000; 1 <1> ; 2 <1> ;Equates for FASTSEEK. 3 <1> ; 4 <1> ;FASTSEEK flags 5 <1> ; 6 <1> FS_begin equ 00000001B 7 <1> FS_end equ 11111110B 8 <1> FS_insert equ 00000010B 9 <1> FS_no_insert equ 11111101B 10 <1> 11 <1> ;FASTSEEK EXTENT CACHING Subfunctions 12 <1> FSEC_open equ 11 13 <1> FSEC_close equ 12 14 <1> FSEC_delete equ 13 15 <1> FSEC_lookup equ 14 16 <1> FSEC_insert equ 15 17 <1> FSEC_truncate equ 16 18 <1> ; 19 <1> ;Equates used in DOS. 20 <1> 21 <1> 22 <1> ; 31 %include "fastxxxx.mac" ;AN000; 1 <1> ; Fastxxx equates 2 <1> FastOpen_ID equ 1 3 <1> FastSeek_ID equ 2 4 <1> Fast_yes equ 10000000B ; fastxxx flag 5 <1> 6 <1> ;Structure definitions 7 <1> ; 8 <1> Fasttable_Entry struc ; Fastxxx Entry pointer in DOS 0 00001640 ???? Fast_Entry_Num dw ? ; number of entries 0 00001642 ???????? FastOpen_Seek dd ? ; fastopen & fastseek entry address 11 <1> Fasttable_Entry ends 12 <1> ; 32 33 [list +] === Switch to base=002450h -> "DOSCODECODE" 34 section DOSCODECODE 35 [list -] 35 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 35 ****************** warning: out: BPB.INC... [-w+user] 35 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 35 ****************** warning: out: DEVSYM.INC... [-w+user] 35 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 43 44 %iassign Installed TRUE 45 46 I_need DirStart,WORD 47 I_Need CONSft,DWORD ; SFT for swapped console In/Out 48 i_need CONSWAP,BYTE 49 i_need IDLEINT,BYTE 50 i_need THISSFT,DWORD 51 i_need DMAADD,DWORD 52 i_need DEVCALL,BYTE 53 i_need CALLSCNT,WORD 54 i_need CALLXAD,DWORD 55 i_need CONTPOS,WORD 56 i_need NEXTADD,WORD 57 i_need CONBUF,BYTE 58 i_need ClusFac,BYTE 59 i_need Cluster_Factor_EDR,WORD 60 i_need SecClusPos,BYTE 61 i_need DirSec,DWORD ;AN000; 62 i_need ClusNum,WORD 63 i_need NxtClusNum,WORD 64 i_need ReadOp,BYTE 65 i_need CURBUF,DWORD 66 i_need ALLOWED,BYTE 67 i_need EXTERR_LOCUS,BYTE 68 i_need FastSeekflg,BYTE ;AN000; 69 i_need HIGH_SECTOR,WORD ;AN000; 70 I_need JShare,DWORD ;AN000; 71 i_need DOS34_FLAG,WORD ;AN000; 72 73 %ifndef BUF2 74 %IF BUFFERFLAG 75 i_need BUF_EMS_MODE,BYTE 76 i_need BUF_EMS_LAST_PAGE,BYTE 77 I_need BUF_EMS_FIRST_PAGE,DWORD 78 I_need BUF_EMS_SAFE_FLAG,BYTE 79 I_need BUF_EMS_NPA640,WORD 80 I_need BUF_EMS_PAGE_FRAME,WORD 81 I_need BUF_EMS_PFRAME,WORD 82 I_need LASTBUFFER,DWORD 83 84 extrn save_user_map:near 85 extrn restore_user_map:near 86 extrn Setup_EMS_Buffers:near 87 %ENDIF 88 %endif 89 90 assume nocheck, ss:DOSGROUP 91 92 Break 93 ; * * * * Drivers for file input from devices * * * * 94 95 ; Indicate that ther is no more I/O occurring through another SFT outside of 96 ; handles 0 and 1 97 ; 98 ; Inputs: DS is DOSGroup 99 ; Outputs: CONSWAP is set to false. 100 ; Registers modified: none 101 102 procedure SWAPBACK,NEAR 102 ****************** warning: proc SWAPBACK... [-w+user] 103 DOSAssume CS,,"SwapBack" 104 ASSUME ES:NOTHING 0 000039AF C606[0000]00 MOV BYTE PTR [CONSWAP],0 ; signal no conswaps 0 000039B4 C3 return 107 EndProc SWAPBACK 108 109 ; Copy ThisSFT to CONSFT for use by the 1-12 primitives. 110 ; 111 ; Inputs: ThisSFT as the sft of the desired file 112 ; DS is DOSGroup 113 ; Outputs: CONSWAP is set. CONSFT = ThisSFT. 114 ; Registers modified: none 115 procedure SWAPCON,NEAR 115 ****************** warning: proc SWAPCON... [-w+user] 116 DOSAssume CS,,"SwapCon" 117 ASSUME ES:NOTHING 0 000039B5 0657 SaveReg 0 000039B7 C606[0000]01 MOV BYTE PTR [CONSWAP],1 ; CONSwap = TRUE; 120 ThisSFT equ THISSFT ; NASM port label 0 000039BC C43E[0000] LES DI,[ThisSFT] 122 Assert ISSFT,,"SwapCon" 123 CONSFT equ CONSft ; NASM port label 0 000039C0 893E[0000] MOV WORD PTR [CONSFT],DI 0 000039C4 8C06[0200] MOV WORD PTR [CONSFT+2],ES 0 000039C8 5F07 RestoreReg 0 000039CA C3 return 128 EndProc SWAPCON 129 130 Break 131 132 ; 133 ; Inputs: 134 ; [THISSFT] set to the SFT for the file being used 135 ; [DMAADD] contains transfer address 136 ; CX = No. of bytes to read 137 ; Function: 138 ; Perform read operation 139 ; Outputs: 140 ; Carry clear 141 ; SFT Position and cluster pointers updated 142 ; CX = No. of bytes read 143 ; ES:DI point to SFT 144 ; Carry set 145 ; AX is error code 146 ; CX = 0 147 ; ES:DI point to SFT 148 ; DS preserved, all other registers destroyed 149 150 procedure DOS_READ,NEAR 150 ****************** warning: proc DOS_READ... [-w+user] 151 DOSAssume CS,,"DOS_Read" 152 ASSUME ES:NOTHING 153 154 %ifndef BUF2 155 %IF BUFFERFLAG 156 cmp byte [BUF_EMS_MODE], -1 157 jz dos_rd_call 158 call choose_buf_page 159 jnc sav_map_rd_hndl 160 return 161 sav_map_rd_hndl: 162 ; call save_user_map 163 dos_rd_call: 164 %ENDIF 165 %endif 166 0 000039CB C43E[0000] LES DI,[THISSFT] 168 Assert ISSFT,,"DOS_Read" 169 ; 170 ; Verify that the sft has been opened in a mode that allows reading. 171 ; 0 000039CF 268A4502 MOV AL,BYTE PTR [ES:DI + sf_mode] 0 000039D3 240F AND AL,access_mask 0 000039D5 3C01 CMP AL,open_for_write 0 000039D7 7503 JNE READ_NO_MODE ;Is read or both 0 000039D9 E9[0000] transfer SET_ACC_ERR 177 178 READ_NO_MODE: 0 000039DC E8[0000] invoke SETUP 0 000039DF E30B JCXZ NoIORet ; no bytes to read - fast return 0 000039E1 E8[0000] invoke IsSFTNet 0 000039E4 7408 JZ LOCAL_READ 183 184 ; invoke OWN_SHARE ;AN000;;IFS. IFS owns share ? 185 ; JZ IFS_HAS_SHARE ;AN000;;IFS. yes 186 ; EnterCrit critDisk ;AN000;;IFS. enter critical section 187 ; CALL CHECK_READ_LOCK ;AN000;;IFS. check read lock 188 ; JNC READ_OK2 ;AN000;;IFS. lock check ok 189 ; JMP SHORT critexit ;AN000;;IFS. fail 190 READ_OK2: ;AN000; 191 ; LeaveCrit critDisk ;AN000;;IFS. leave critical section 192 IFS_HAS_SHARE: ;AN000; 193 194 %IFN Installed 195 transfer NET_READ 196 %ELSE 197 multNET equ MultNET ; NASM port equate 0 000039E6 B80811 MOV AX,(multNET << 8) | 8 0 000039E9 CD2F INT 2FH 0 000039EB C3 return 201 %ENDIF 202 203 ; 204 ; The user ended up requesting 0 bytes of input. We do nothing for this case 205 ; except return immediately. 206 ; 207 NoIORet: 0 000039EC F8 CLC 0 000039ED C3 return 210 211 LOCAL_READ: 0 000039EE 26F745058000 TEST word [ES:DI + sf_flags],devid_device ; Check for named device I/O 0 000039F4 7523 JNZ READDEV 0 000039F6 C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 000039FB E8[0000] EnterCrit critDisk 0 000039FE F606[0000]80 TEST byte [FastSeekflg],Fast_yes ; FastSeek installed ? 0 00003A03 7405 JZ FS_no ; no 0 00003A05 800E[0000]01 OR byte [FastSeekflg],FS_begin ; set fastseek mode 219 FS_no: 0 00003A0A E8[0000] invoke DISKREAD 0 00003A0D 9C PUSHF ; save flag 0 00003A0E 368026[0000]FE AND byte [ss:FastSeekflg],FS_end ; reset fastseek mode 0 00003A14 9D POPF ; retore flag 224 critexit: 0 00003A15 E8[0000] LeaveCrit critDisk 0 00003A18 C3 return 227 228 ; 229 ; We are reading from a device. Examine the status of the device to see if we 230 ; can short-circuit the I/O. If the device in the EOF state or if it is the 231 ; null device, we can safely indicate no transfer. 232 ; 233 READDEV: 234 DOSAssume CS,,"DISK/ReadDev" 235 ASSUME ES:NOTHING 0 00003A19 C606[0000]04 MOV byte [EXTERR_LOCUS],errLOC_SerDev 0 00003A1E 268A5D05 MOV BL,BYTE PTR [ES:DI + sf_flags] 0 00003A22 C43E[0000] LES DI,[DMAADD] 0 00003A26 F6C340 TEST BL,devid_device_EOF ; End of file? 0 00003A29 7407 JZ ENDRDDEVJ3 0 00003A2B F6C304 TEST BL,devid_device_null ; NUL device? 0 00003A2E 7405 JZ TESTRAW ; NO 0 00003A30 30C0 XOR AL,AL ; Indicate EOF by setting zero 244 ENDRDDEVJ3: 0 00003A32 E9C000 JMP ENDRDDEVJ2 246 247 ; 248 ; We need to hit the device. Figure out if we do a raw read or we do the 249 ; bizarre std_con_string_input. 250 ; 251 TESTRAW: 0 00003A35 F6C320 TEST BL,devid_device_raw ; Raw mode? 0 00003A38 7508 JNZ DVRDRAW ; Yes, let the device do all local editing 0 00003A3A F6C301 TEST BL,devid_device_con_in ; Is it console device? 0 00003A3D 7449 JZ NOTRDCON 0 00003A3F E9E900 JMP READCON 257 258 DVRDRAW: 259 DOSAssume CS,,"DISK/DvRdRaw" 0 00003A42 06 PUSH ES 0 00003A43 1F POP DS ; Xaddr to DS:DI 262 ASSUME DS:NOTHING 263 ReadRawRetry: 0 00003A44 89FB MOV BX,DI ; DS:BX transfer addr 0 00003A46 31C0 XOR AX,AX ; Media Byte, unit = 0 0 00003A48 89C2 MOV DX,AX ; Start at 0 0 00003A4A E8[0000] invoke SETREAD 0 00003A4D 1E PUSH DS ; Save Seg part of Xaddr 0 00003A4E 36C536[0000] LDS SI,[ss:THISSFT] 270 assume ds:nothing 271 Assert ISSFT,,"DOS_Read/DvRdRawR" 0 00003A53 E8[0000] invoke DEVIOCALL 0 00003A56 89FA MOV DX,DI ; DS:DX is preserved by INT 24 0 00003A58 B486 MOV AH,86H ; Read error 0 00003A5A 368B3E[0300] MOV DI,[ss:DEVCALL + REQSTAT] 0 00003A5F F7C70080 TEST DI,STERR 0 00003A63 7419 JZ CRDROK ; No errors 0 00003A65 E8[0000] invoke CHARHARD 0 00003A68 89D7 MOV DI,DX ; DS:DI is Xaddr 0 00003A6A 08C0 OR AL,AL 0 00003A6C 7410 JZ CRDROK ; Ignore 0 00003A6E 3C03 CMP AL,3 0 00003A70 7403 JZ CRDFERR ; fail. 0 00003A72 1F POP DS ; Recover saved seg part of Xaddr 285 assume ds:nothing 0 00003A73 EBCF JMP ReadRawRetry ; Retry 287 288 ; 289 ; We have encountered a device-driver error. We have informed the user of it 290 ; and he has said for us to fail the system call. 291 ; 292 CRDFERR: 0 00003A75 5F POP DI ; Clean stack 294 DEVIOFERR: 0 00003A76 36C43E[0000] LES DI,[ss:THISSFT] 296 Assert ISSFT,,"DOS_Read/DEVIOFERR" 0 00003A7B E9[0000] transfer SET_ACC_ERR_DS 298 299 CRDROK: 0 00003A7E 5F POP DI ; Chuck saved seg of Xaddr 0 00003A7F 89D7 MOV DI,DX 0 00003A81 36033E[0000] ADD DI,[ss:CALLSCNT] ; Amount transferred 0 00003A86 EBAA JMP SHORT ENDRDDEVJ3 304 305 ; We are going to do a cooked read on some character device. There is a 306 ; problem here, what does the data look like? Is it a terminal device, line 307 ; CR line CR line CR, or is it file data, line CR LF line CR LF? Does it have 308 ; a ^Z at the end which is data, or is the ^Z not data? In any event we're 309 ; going to do this: Read in pieces up to CR (CRs included in data) or ^z (^z 310 ; included in data). this "simulates" the way con works in cooked mode 311 ; reading one line at a time. With file data, however, the lines will look 312 ; like, LF line CR. This is a little weird. 313 314 NOTRDCON: 0 00003A88 8CC0 MOV AX,ES 0 00003A8A 8ED8 MOV DS,AX 317 ASSUME DS:NOTHING 0 00003A8C 89FB MOV BX,DI 0 00003A8E 31D2 XOR DX,DX 0 00003A90 89D0 MOV AX,DX 0 00003A92 51 PUSH CX 0 00003A93 B90100 MOV CX,1 0 00003A96 E8[0000] invoke SETREAD 0 00003A99 59 POP CX 0 00003A9A 36C536[0000] LDS SI,[ss:THISSFT] 326 Assert ISSFT,,"DOS_Read/NotRdCon" 0 00003A9F C57407 LDS SI,[SI + sf_devptr] 328 DVRDLP: 0 00003AA2 E8[0000] invoke DSKSTATCHK 0 00003AA5 E8[0000] invoke DEVIOCALL2 0 00003AA8 57 PUSH DI ; Save "count" done 0 00003AA9 B486 MOV AH,86H 0 00003AAB 368B3E[0300] MOV DI,[ss:DEVCALL + REQSTAT] 0 00003AB0 F7C70080 TEST DI,STERR 0 00003AB4 7417 JZ CRDOK 0 00003AB6 E8[0000] invoke CHARHARD 0 00003AB9 5F POP DI 0 00003ABA 36C706[0000]0100 MOV word [ss:CALLSCNT],1 0 00003AC1 3C01 CMP AL,1 0 00003AC3 74DD JZ DVRDLP ;Retry 0 00003AC5 3C03 CMP AL,3 0 00003AC7 74AD JZ DEVIOFERR ; FAIL 0 00003AC9 30C0 XOR AL,AL ; Ignore, Pick some random character 0 00003ACB EB12 JMP SHORT DVRDIGN 345 346 CRDOK: 0 00003ACD 5F POP DI 0 00003ACE 36833E[0000]01 CMP word [ss:CALLSCNT],1 0 00003AD4 751F JNZ ENDRDDEVJ2 0 00003AD6 1E PUSH DS 0 00003AD7 368E1E[0200] MOV DS,WORD PTR [ss:CALLXAD+2] 352 assume ds:nothing 0 00003ADC 8A05 MOV AL,BYTE PTR [DI] ; Get the character we just read 0 00003ADE 1F POP DS 355 assume ds:nothing ; device 356 DVRDIGN: 0 00003ADF 36FF06[0000] INC WORD PTR [ss:CALLXAD] ; Next character 0 00003AE4 36C706[0300]0000 MOV word [ss:DEVCALL + REQSTAT],0 0 00003AEB 47 INC DI ; Next character 0 00003AEC 3C1A CMP AL,1AH ; ^Z? 0 00003AEE 7405 JZ ENDRDDEVJ2 ; Yes, done zero set (EOF) 0 00003AF0 3C0D CMP AL,c_CR ; CR? 0 00003AF2 E0AE LOOPNZ DVRDLP ; Loop if no, else done 0 00003AF4 40 INC AX ; Resets zero flag so NOT EOF, unless 365 ; AX=FFFF which is not likely 366 ENDRDDEVJ2: 0 00003AF5 EB1F JMP SHORT ENDRDDEV 368 369 ASSUME DS:NOTHING,ES:NOTHING 370 371 TRANBUF: 0 00003AF7 AC LODSB 0 00003AF8 AA STOSB 0 00003AF9 3C0D CMP AL,c_CR ; Check for carriage return 0 00003AFB 7503 JNZ NORMCH 0 00003AFD C6040A MOV BYTE PTR [SI],c_LF 377 NORMCH: 0 00003B00 3C0A CMP AL,c_LF 0 00003B02 E0F3 LOOPNZ TRANBUF 0 00003B04 7507 JNZ ENDRDCON 0 00003B06 31F6 XOR SI,SI ; Cause a new buffer to be read 0 00003B08 E8[0000] invoke OUTT ; Transmit linefeed 0 00003B0B 0C01 OR AL,1 ; Clear zero flag--not end of file 384 ENDRDCON: 0 00003B0D 161F Context DS 0 00003B0F E89DFE CALL SWAPBACK 0 00003B12 8936[0000] MOV [CONTPOS],SI 388 ENDRDDEV: 0 00003B16 161F Context DS 0 00003B18 893E[0000] MOV [NEXTADD],DI 0 00003B1C 7509 JNZ SETSFTC ; Zero set if Ctrl-Z found in input 0 00003B1E C43E[0000] LES DI,[THISSFT] 393 Assert ISSFT,,"DOS_Read/EndRdDev" 0 00003B22 26806505BF AND BYTE PTR [ES:DI + sf_flags],~ devid_device_EOF ; Mark as no more data available 395 SETSFTC: 0 00003B27 E8[0000] invoke SETSFT 0 00003B2A C3 return 398 399 ASSUME DS:NOTHING,ES:NOTHING 400 401 READCON: 402 DOSAssume CS,,"ReadCon" 0 00003B2B E887FE CALL SWAPCON 0 00003B2E 8B36[0000] MOV SI,[CONTPOS] 0 00003B32 09F6 OR SI,SI 0 00003B34 75C1 JNZ TRANBUF 0 00003B36 803E[0000]80 CMP BYTE PTR [CONBUF],128 0 00003B3B 7406 JZ GETBUF 0 00003B3D C706[0000]80FF MOV WORD PTR [CONBUF],0FF80H ; Set up 128-byte buffer with no template 410 GETBUF: 0 00003B43 51 PUSH CX 0 00003B44 06 PUSH ES 0 00003B45 57 PUSH DI 0 00003B46 BA[0000] MOV DX,OFFSET CONBUF wrt DOSGROUP 0 00003B49 E8[0000] invoke D_STD_CON_STRING_INPUT ; Get input buffer 0 00003B4C 5F POP DI 0 00003B4D 07 POP ES 418 assume es:nothing 0 00003B4E 59 POP CX 0 00003B4F BE[0200] MOV SI,2 + OFFSET CONBUF wrt DOSGROUP 0 00003B52 803C1A CMP BYTE PTR [SI],1AH ; Check for Ctrl-Z in first character 0 00003B55 75A0 JNZ TRANBUF 0 00003B57 B01A MOV AL,1AH 0 00003B59 AA STOSB 0 00003B5A 4F DEC DI 0 00003B5B B00A MOV AL,c_LF 0 00003B5D E8[0000] invoke OUTT ; Send linefeed 0 00003B60 31F6 XOR SI,SI 0 00003B62 EBA9 JMP ENDRDCON 430 431 EndProc DOS_READ 432 433 Break 434 435 ; 436 ; Inputs: 437 ; [THISSFT] set to the SFT for the file being used 438 ; [DMAADD] contains transfer address 439 ; CX = No. of bytes to write 440 ; Function: 441 ; Perform write operation 442 ; NOTE: If CX = 0 on input, file is truncated or grown 443 ; to current sf_position 444 ; Outputs: 445 ; Carry clear 446 ; SFT Position and cluster pointers updated 447 ; CX = No. of bytes written 448 ; ES:DI point to SFT 449 ; Carry set 450 ; AX is error code 451 ; CX = 0 452 ; ES:DI point to SFT 453 ; DS preserved, all other registers destroyed 454 455 procedure DOS_WRITE,NEAR 455 ****************** warning: proc DOS_WRITE... [-w+user] 456 DOSAssume CS,,"DOS_Write" 457 ASSUME ES:NOTHING 458 459 %ifndef BUF2 460 %IF BUFFERFLAG 461 cmp byte [BUF_EMS_MODE], -1 462 jz dos_wrt_call 463 call choose_buf_page 464 jnc sav_map_wrt_hndl 465 return 466 sav_map_wrt_hndl: 467 ; call save_user_map 468 dos_wrt_call: 469 %ENDIF 470 %endif 471 0 00003B64 C43E[0000] LES DI,[THISSFT] 473 Assert ISSFT,,"DosWrite" 0 00003B68 268A4502 MOV AL,BYTE PTR [ES:DI + sf_mode] 0 00003B6C 240F AND AL,access_mask 0 00003B6E 3C00 CMP AL,open_for_read 0 00003B70 7503 JNE Check_FCB_RO ;Is write or both 478 BadMode: 0 00003B72 E9[0000] transfer SET_ACC_ERR 480 481 ; 482 ; NOTE: The following check for writting to a Read Only File is performed 483 ; ONLY on FCBs!!!! 484 ; We ALLOW writes to Read Only files via handles to allow a CREATE 485 ; of a read only file which can then be written to. 486 ; This is OK because we are NOT ALLOWED to OPEN a RO file via handles 487 ; for writting, or RE-CREATE an EXISTING RO file via handles. Thus, 488 ; CREATing a NEW RO file, or RE-CREATing an existing file which 489 ; is NOT RO to be RO, via handles are the only times we can write 490 ; to a read-only file. 491 ; 492 Check_FCB_RO: 0 00003B75 26F745020080 TEST word [ES:DI + sf_mode],sf_isfcb 0 00003B7B 7407 JZ WRITE_NO_MODE ; Not an FCB 0 00003B7D 26F6450401 TEST byte [ES:DI + sf_attr],attr_read_only 0 00003B82 75EE JNZ BadMode ; Can't write to Read_Only files via FCB 497 WRITE_NO_MODE: 0 00003B84 E8[0000] invoke SETUP 0 00003B87 E8[0000] invoke IsSFTNet 0 00003B8A 7406 JZ LOCAL_WRITE 501 502 ; invoke OWN_SHARE ;AN000;;IFS. IFS owns share ? 503 ; JZ IFS_HAS_SHARE2 ;AN000;;IFS. yes 504 ; EnterCrit critDisk ;AN000;;IFS. enter critical section 505 ; CALL CHECK_WRITE_LOCK ;AN000;;IFS. check write lock 506 ; JC nocommit ;AN000;;IFS. lock error 507 ; 508 ; LeaveCrit critDisk ;AN000;;IFS. leave critical section 509 IFS_HAS_SHARE2: ;AN000; 510 511 512 %IFN Installed 513 transfer NET_WRITE 514 %ELSE 0 00003B8C B80911 MOV AX,(multNET << 8) | 9 0 00003B8F CD2F INT 2FH 517 ; JC nomore ;AN000;;IFS. error 518 ; invoke OWN_SHARE ;AN000;;IFS. IFS owns share ? 519 ; JZ nomore ;AN000;;IFS. yes 520 ; 521 ; MOV AX,1 ;AN000;;IFS. update all SFT for new size 522 ; call JShare + 14 * 4 ;AN000;;IFS. call ShSu 523 524 nomore: ;AN000; 0 00003B91 C3 return 526 %ENDIF 527 528 529 LOCAL_WRITE: 0 00003B92 26F745058000 TEST word [ES:DI + sf_flags],devid_device ; Check for named device I/O 0 00003B98 757B JNZ WRTDEV 0 00003B9A C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 00003B9F E8[0000] EnterCrit critDisk 0 00003BA2 F606[0000]80 TEST byte [FastSeekflg],Fast_yes ;AN000;FO. FastSeek installed ? 0 00003BA7 7405 JZ FS_no2 ;AN000;FO. no 0 00003BA9 800E[0000]01 OR byte [FastSeekflg],FS_begin ;AN000;FO. set fastseek mode 537 FS_no2: ;AN000; 0 00003BAE E8[0000] invoke DISKWRITE 0 00003BB1 9C PUSHF ;AN000;FO. save flag 0 00003BB2 368026[0000]FE AND byte [ss:FastSeekflg],FS_end ;AN000;FO. reset fastseek mode 0 00003BB8 9D POPF ;AN000;FO. restore flag 542 ;; Extended Open 0 00003BB9 7211 JC nocommit ;AN000;EO. 0 00003BBB C43E[0000] LES DI,[THISSFT] ;AN000;EO. 0 00003BBF 26F745020040 TEST word [ES:DI + sf_mode],auto_commit_write ;AN000;EO. 0 00003BC5 7405 JZ nocommit ;AN000;EO. 0 00003BC7 51 PUSH CX ;AN000;EO. 0 00003BC8 E8[0000] invoke DOS_COMMIT ;AN000;EO. 0 00003BCB 59 POP CX ;AN000;EO. 550 nocommit: ;AN000; 551 ;; Extended Open 0 00003BCC E8[0000] LeaveCrit critDisk 0 00003BCF C3 return 554 555 DVWRTRAW: 556 ASSUME DS:NOTHING 0 00003BD0 31C0 XOR AX,AX ; Media Byte, unit = 0 0 00003BD2 E8[0000] invoke SETWRITE 0 00003BD5 1E PUSH DS ; Save seg of transfer 0 00003BD6 36C536[0000] LDS SI,[ss:THISSFT] 561 assume ds:nothing 562 Assert ISSFT,,"DosWrite/DvWrtRaw" 0 00003BDB E8[0000] invoke DEVIOCALL ; DS:SI -> DEVICE 0 00003BDE 89FA MOV DX,DI ; Offset part of Xaddr saved in DX 0 00003BE0 B487 MOV AH,87H 0 00003BE2 368B3E[0300] MOV DI,[ss:DEVCALL + REQSTAT] 0 00003BE7 F7C70080 TEST DI,STERR 0 00003BEB 7414 JZ CWRTROK 0 00003BED E8[0000] invoke CHARHARD 0 00003BF0 89D3 MOV BX,DX ; Recall transfer addr 0 00003BF2 08C0 OR AL,AL 0 00003BF4 740B JZ CWRTROK ; Ignore 0 00003BF6 3C03 CMP AL,3 0 00003BF8 7403 JZ CWRFERR 0 00003BFA 1F POP DS ; Recover saved seg of transfer 576 assume ds:nothing 0 00003BFB EBD3 JMP DVWRTRAW ; Try again 578 579 CWRFERR: 0 00003BFD 58 POP AX ; Chuck saved seg of transfer 0 00003BFE E974FE JMP CRDFERR ; Will pop one more stack element 582 583 CWRTROK: 0 00003C01 58 POP AX ; Chuck saved seg of transfer 0 00003C02 1F POP DS 586 DOSAssume CS,,"DISK/CWrtOK" 0 00003C03 A1[0000] MOV AX,[CALLSCNT] ; Get actual number of bytes transferred 588 ENDWRDEV: 0 00003C06 C43E[0000] LES DI,[THISSFT] 590 Assert ISSFT,,"DosWrite/EndWrDev" 0 00003C0A 89C1 MOV CX,AX 0 00003C0C E8[0000] invoke ADDREC 0 00003C0F C3 return 594 595 WRTNUL: 0 00003C10 89CA MOV DX,CX ;Entire transfer done 597 WrtCookJ: 0 00003C12 E99D00 JMP WRTCOOKDONE 599 600 WRTDEV: 601 DOSAssume CS,,"DISK/WrtDev" 0 00003C15 C606[0000]04 MOV byte [EXTERR_LOCUS],errLOC_SerDev 0 00003C1A 26804D0540 OR BYTE PTR [ES:DI + sf_flags],devid_device_EOF ; Reset EOF for input 0 00003C1F 268A5D05 MOV BL,BYTE PTR [ES:DI + sf_flags] 0 00003C23 31C0 XOR AX,AX 0 00003C25 E3DF JCXZ ENDWRDEV ; problem of creating on a device. 0 00003C27 1E PUSH DS 0 00003C28 88D8 MOV AL,BL 0 00003C2A C51E[0000] LDS BX,[DMAADD] ; Xaddr to DS:BX 610 ASSUME DS:NOTHING 0 00003C2E 89DF MOV DI,BX ; Xaddr to DS:DI 0 00003C30 31D2 XOR DX,DX ; Set starting point 0 00003C32 A820 TEST AL,devid_device_raw ; Raw? 0 00003C34 7402 JZ TEST_DEV_CON 0 00003C36 EB98 JMP DVWRTRAW 616 617 TEST_DEV_CON: 0 00003C38 A802 TEST AL,devid_device_con_out ; Console output device? 0 00003C3A 757C JNZ WRITECON 0 00003C3C A804 TEST AL,devid_device_null 0 00003C3E 75D0 JNZ WRTNUL 0 00003C40 89D0 MOV AX,DX 0 00003C42 803F1A CMP BYTE PTR [BX],1AH ; ^Z? 624 WRTCOOKJ equ WrtCookJ ; NASM port label 0 00003C45 74CB JZ WRTCOOKJ ; Yes, transfer nothing 0 00003C47 51 PUSH CX 0 00003C48 B90100 MOV CX,1 0 00003C4B E8[0000] invoke SETWRITE 0 00003C4E 59 POP CX 0 00003C4F 36C536[0000] LDS SI,[ss:THISSFT] 631 X25_Special equ X25_special ; NASM port equate 0 00003C54 36810E[0000]0008 OR word [ss:DOS34_FLAG],X25_Special;AN000;;PTM. bad x25 driver 0 00003C5B B403 MOV AH,3 ;AN000;;PTM. prompt critical error ASAP 0 00003C5D E8[0000] invoke IOFUNC ;AN000;;PTM. 635 Assert ISSFT,,"DosWrite/TestDevCon" 0 00003C60 C57407 LDS SI,[SI + sf_devptr] 637 DVWRTLP: 0 00003C63 E8[0000] invoke DSKSTATCHK 0 00003C66 E8[0000] invoke DEVIOCALL2 0 00003C69 57 PUSH DI 0 00003C6A B487 MOV AH,87H 0 00003C6C 368B3E[0300] MOV DI,[ss:DEVCALL + REQSTAT] 0 00003C71 F7C70080 TEST DI,STERR 0 00003C75 7416 JZ CWROK 0 00003C77 E8[0000] invoke CHARHARD 0 00003C7A 5F POP DI 0 00003C7B 36C706[0000]0100 MOV word [ss:CALLSCNT],1 0 00003C82 3C01 CMP AL,1 0 00003C84 74DD JZ DVWRTLP ; Retry 0 00003C86 08C0 OR AL,AL 0 00003C88 740C JZ DVWRTIGN ; Ignore 0 00003C8A E9E8FD JMP CRDFERR ; Fail, pops one stack element 653 654 CWROK: 0 00003C8D 5F POP DI 0 00003C8E 36833E[0000]00 CMP word [ss:CALLSCNT],0 0 00003C94 741C JZ WRTCOOKDONE 658 DVWRTIGN: 0 00003C96 42 INC DX 0 00003C97 36FF06[0000] INC WORD PTR [ss:CALLXAD] 0 00003C9C 47 INC DI 0 00003C9D 1E PUSH DS 0 00003C9E 368E1E[0200] MOV DS,WORD PTR [ss:CALLXAD+2] 664 assume ds:nothing 0 00003CA3 803D1A CMP BYTE PTR [DI],1AH ; ^Z? 0 00003CA6 1F POP DS 667 assume ds:nothing 0 00003CA7 7409 JZ WRTCOOKDONE 0 00003CA9 36C706[0300]0000 MOV word [ss:DEVCALL + REQSTAT],0 0 00003CB0 E2B1 LOOP DVWRTLP 671 WRTCOOKDONE: 0 00003CB2 89D0 MOV AX,DX 0 00003CB4 1F POP DS 674 assume ds:nothing 0 00003CB5 E94EFF JMP ENDWRDEV 676 677 WRITECON: 0 00003CB8 1E PUSH DS 0 00003CB9 161F Context DS 0 00003CBB E8F7FC CALL SWAPCON 0 00003CBE 1F POP DS 682 ASSUME DS:NOTHING 0 00003CBF 89DE MOV SI,BX 0 00003CC1 51 PUSH CX 685 WRCONLP: 0 00003CC2 AC LODSB 0 00003CC3 3C1A CMP AL,1AH ; ^Z? 0 00003CC5 7405 JZ CONEOF 0 00003CC7 E8[0000] invoke OUTT 0 00003CCA E2F6 LOOP WRCONLP 691 CONEOF: 0 00003CCC 58 POP AX ; Count 0 00003CCD 29C8 SUB AX,CX ; Amount actually written 0 00003CCF 1F POP DS 695 DOSAssume CS,,"DISK/ConEOF" 0 00003CD0 E8DCFC CALL SWAPBACK 0 00003CD3 E930FF JMP ENDWRDEV 698 EndProc DOS_WRITE 699 700 ; Convert JFN number in BX to sf_entry in DS:SI We get the normal SFT if 701 ; CONSWAP is FALSE or if the handle desired is 2 or more. Otherwise, we 702 ; retrieve the sft from ConSFT which is set by SwapCon. 703 704 procedure get_io_sft,near 704 ****************** warning: proc get_io_sft... [-w+user] 705 ASSUME DS:NOTHING,ES:NOTHING 706 ConSwap equ CONSWAP ; NASM port label 0 00003CD6 36F606[0000]FF TEST byte [ss:ConSwap],-1 0 00003CDC 7512 JNZ GetRedir 709 GetNormal: 0 00003CDE 161F Context DS 0 00003CE0 06 PUSH ES 0 00003CE1 57 PUSH DI 0 00003CE2 E8[0000] invoke SFFromHandle 0 00003CE5 7206 JC RET44P 0 00003CE7 8CC6 MOV SI,ES 0 00003CE9 8EDE MOV DS,SI 717 ASSUME DS:NOTHING 0 00003CEB 89FE MOV SI,DI 719 RET44P: 0 00003CED 5F POP DI 0 00003CEE 07 POP ES 722 assume es:nothing 0 00003CEF C3 return 724 GetRedir: 0 00003CF0 83FB01 CMP BX,1 0 00003CF3 77E9 JA GetNormal 727 ConSFT equ CONSft ; NASM port label 0 00003CF5 36C536[0000] LDS SI,[ss:ConSFT] 729 Assert ISSFT,,"GetIOSft" 0 00003CFA F8 CLC 0 00003CFB C3 return 732 EndProc get_io_sft 733 734 Break 735 736 ; Inputs: 737 ; AX = Directory block number (relative to first block of directory) 738 ; ES:BP = Base of drive parameters 739 ; [DIRSEC] = First sector of first cluster of directory 740 ; [CLUSNUM] = Next cluster 741 ; [CLUSFAC] = Sectors/Cluster 742 ; Function: 743 ; Read the directory block into [CURBUF]. 744 ; Outputs: 745 ; [NXTCLUSNUM] = Next cluster (after the one skipped to) 746 ; [SECCLUSPOS] Set 747 ; ES:BP unchanged 748 ; [CURBUF] Points to Buffer with dir sector 749 ; Carry set if error (user said FAIL to I 24) 750 ; DS preserved, all other registers destroyed. 751 752 procedure DirRead,NEAR 752 ****************** warning: proc DirRead... [-w+user] 753 DOSAssume CS,,"DirRead" 754 ASSUME ES:NOTHING 755 Assert ISDPB,,"DirRead" 756 757 ; 758 ; Note that ClusFac is is the sectors per cluster. This is NOT necessarily 759 ; the same as what is in the DPB! In the case of the root directory, we have 760 ; ClusFac = # sectors in the root directory. The root directory is detected 761 ; by DIRStart = 0. 762 ; 0 00003CFC 31D2 XOR DX,DX 0 00003CFE 833E[0000]00 CMP word [DirStart],0 0 00003D03 7504 jnz SubDir 0 00003D05 92 XCHG AX,DX 0 00003D06 EB0D JMP DoRead 0 00003D08 90 nop ; identicalise 769 ; 770 ; Convert the sector number in AX into cluster and sector-within-cluster pair 771 ; 772 SubDir: 0 00003D09 88C2 MOV DL,AL 0 00003D0B 26225604 AND DL,[ES:BP + dpb_cluster_mask] 775 ; 776 ; DX is the sector-in-cluster 777 ; 0 00003D0F 268A4E05 MOV CL,[ES:BP + dpb_cluster_shift] 0 00003D13 D3E8 SHR AX,CL 780 ; 781 ; DX is position in cluster 782 ; AX is number of clusters to skip 783 ; 784 DoRead: 785 SECCLUSPOS equ SecClusPos ; NASM port label 0 00003D15 8816[0000] MOV [SECCLUSPOS],DL 0 00003D19 89C1 MOV CX,AX 0 00003D1B 88D4 MOV AH,DL 789 ; 790 ; CX is number of clusters to skip. 791 ; AH is remainder 792 ; 793 DIRSEC equ DirSec ; NASM port label 0 00003D1D 8B16[0200] MOV DX,WORD PTR [DIRSEC+2] ;AN000;>32mb 0 00003D21 8916[0000] MOV [HIGH_SECTOR],DX ;AN000;>32mb 0 00003D25 8B16[0000] MOV DX,WORD PTR [DIRSEC] 0 00003D29 00E2 ADD DL,AH 0 00003D2B 80D600 ADC DH,0 0 00003D2E 8316[0000]00 ADC word [HIGH_SECTOR],0 ;AN000;>32mb 800 801 CLUSNUM equ ClusNum ; NASM port label 0 00003D33 8B1E[0000] MOV BX,[CLUSNUM] 803 NXTCLUSNUM equ NxtClusNum ; NASM port label 0 00003D37 891E[0000] MOV [NXTCLUSNUM],BX 0 00003D3B E319 JCXZ FIRSTCLUSTER 806 SKPCLLP: 0 00003D3D E8[0000] invoke UNPACK 0 00003D40 72B9 retc 0 00003D42 87DF XCHG BX,DI 0 00003D44 E8[0000] invoke IsEOF ; test for eof based on fat size 0 00003D47 7302 JAE HAVESKIPPED 0 00003D49 E2F2 LOOP SKPCLLP 813 HAVESKIPPED: 0 00003D4B 891E[0000] MOV [NXTCLUSNUM],BX 0 00003D4F 89FA MOV DX,DI 0 00003D51 88E3 MOV BL,AH 0 00003D53 E8[0000] invoke FIGREC 818 819 entry FIRSTCLUSTER 820 821 allowed_RETRY equ Allowed_RETRY ; NASM port equate 822 allowed_FAIL equ Allowed_FAIL ; NASM port equate 0 00003D56 C606[0000]18 MOV byte [ALLOWED],allowed_RETRY + allowed_FAIL 0 00003D5B 30C0 XOR AL,AL ; Indicate pre-read 0 00003D5D E8[0000] invoke GETBUFFR 0 00003D60 7299 retc 827 828 entry SET_BUF_AS_DIR 829 DOSAssume CS,,"SET_BUF_AS_DIR" 830 ASSUME ES:NOTHING 831 ; Set the type of CURBUF to be a directory sector. 832 ; Only flags are modified. 833 0 00003D62 1E PUSH DS 0 00003D63 56 PUSH SI 0 00003D64 C536[0000] LDS SI,[CURBUF] 837 assume ds:nothing 838 Assert ISBUF,,"SetBufAsDir" 0 00003D68 804C0504 OR byte [SI + buf_flags],buf_isDIR ; Clears carry 0 00003D6C 5E POP SI 0 00003D6D 1F POP DS 842 assume ds:DOSGROUP 0 00003D6E C3 return 844 EndProc DirRead 845 846 Break 847 848 ; Inputs: 849 ; Same as DREAD 850 ; DS:BX = Transfer address 851 ; CX = Number of sectors 852 ; DX = Absolute record number 853 ; ES:BP = Base of drive parameters 854 ; Function: 855 ; Calls BIOS to perform FAT read. 856 ; Outputs: 857 ; Same as DREAD 858 859 procedure FATSecRd,NEAR 859 ****************** warning: proc FATSecRd... [-w+user] 860 ASSUME DS:NOTHING,ES:NOTHING 861 862 Assert ISDPB,,"FATSecRd" 0 00003D6F 36C606[0000]18 MOV byte [ss:ALLOWED],allowed_RETRY + allowed_FAIL 0 00003D75 89CF MOV DI,CX 0 00003D77 268A4E08 MOV CL,[ES:BP + dpb_FAT_count] 0 00003D7B 268B460F MOV AX,[ES:BP + dpb_FAT_size] ;AN000;>32mb 867 ; XOR AH,AH 0 00003D7F 30ED XOR CH,CH ;AN000;>32mb 0 00003D81 52 PUSH DX 870 NXTFAT: 0 00003D82 36C706[0000]0000 MOV word [ss:HIGH_SECTOR],0 ;AN000;>32mb FAT sectors cannot exceed 0 00003D89 51 PUSH CX ;AN000;>32mb 0 00003D8A 50 PUSH AX 0 00003D8B 89F9 MOV CX,DI 0 00003D8D E8[0000] invoke DSKREAD 0 00003D90 58 POP AX 0 00003D91 59 POP CX 0 00003D92 7420 JZ RET41P ; Carry clear 0 00003D94 01C2 ADD DX,AX 0 00003D96 E2EA LOOP NXTFAT 0 00003D98 5A POP DX 0 00003D99 89F9 MOV CX,DI 883 884 ; NOTE FALL THROUGH 885 886 Break 887 888 ; Inputs: 889 ; DS:BX = Transfer address 890 ; CX = Number of sectors 891 ; DX = Absolute record number (LOW) 892 ; [HIGH_SECTOR]= Absolute record number (HIGH) 893 ; ES:BP = Base of drive parameters 894 ; [ALLOWED] must be set in case call to HARDERR_DOS needed 895 ; Function: 896 ; Calls BIOS to perform disk read. If BIOS reports 897 ; errors, will call HARDERRRW for further action. 898 ; Outputs: 899 ; Carry set if error (currently user FAILED to INT 24) 900 ; DS,ES:BP preserved. All other registers destroyed. 901 902 entry DREAD 903 ASSUME DS:NOTHING,ES:NOTHING 904 905 Assert ISDPB,,"DREAD" 0 00003D9B E8[0000] invoke DSKREAD 0 00003D9E 74CE retz ; Carry clear 908 READOP equ ReadOp ; NASM port label 0 00003DA0 36C606[0000]00 MOV BYTE PTR [ss:READOP],0 0 00003DA6 E8[0000] invoke HARDERRRW 0 00003DA9 3C01 CMP AL,1 ; Check for retry 0 00003DAB 74EE JZ DREAD 0 00003DAD 3C03 CMP AL,3 ; Check for FAIL 0 00003DAF F8 CLC 0 00003DB0 7501 JNZ NO_CAR ; Ignore 0 00003DB2 F9 STC 917 NO_CAR: 0 00003DB3 C3 return 919 0 00003DB4 5A RET41P: POP DX 0 00003DB5 C3 return 922 EndProc FATSecRd 923 924 925 Break 926 927 ; Inputs: 928 ; output of SETUP 929 ; ES:DI -> SFT 930 ; Function: 931 ; check write lock 932 ; Outputs: 933 ; Carry set if error 934 ; Carry clear if ok 935 936 procedure CHECK_WRITE_LOCK,NEAR ;AN000; 936 ****************** warning: proc CHECK_WRITE_LOCK... [-w+user] 937 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 938 0 00003DB6 26F6450408 TEST byte [ES:DI + sf_attr],attr_volume_id ;AN000;;MS. volume id 0 00003DBB 7404 JZ write_cont ;AN000;;MS. no 0 00003DBD E8[0000] invoke SET_ACC_ERR_DS ;AN000;;MS. 0 00003DC0 C3 return ;AN000;;MS. 943 write_cont: ;AN000; 0 00003DC1 51 PUSH CX ;AN000;;MS. save reg 0 00003DC2 09C9 OR CX,CX ;AN000;;MS. 0 00003DC4 7503 JNZ Not_Truncate ;AN000;;MS. 0 00003DC6 B9FFFF MOV CX,0FFFFH ;AN000;;MS. check for lock on whole file 948 Not_Truncate: ;AN000; 0 00003DC9 B080 MOV AL,80H ;AN000;;MS. check write access 0 00003DCB E8[0000] invoke LOCK_CHECK ;AN000;;MS. check lock 0 00003DCE 59 POP CX ;AN000;;MS. restore reg 0 00003DCF 7305 JNC WRITE_OK ;AN000;;MS. lock ok 0 00003DD1 E8[0000] invoke WRITE_LOCK_VIOLATION ;AN000;;MS. issue I24 0 00003DD4 73E0 JNC CHECK_WRITE_LOCK ;AN000;;MS. retry 955 WRITE_OK: ;AN000; 0 00003DD6 C3 return ;AN000;;MS. 957 EndProc CHECK_WRITE_LOCK ;AN000; 958 959 960 Break 961 962 ; Inputs: 963 ; ES:DI -> SFT 964 ; output of SETUP 965 ; Function: 966 ; check read lock 967 ; Outputs: 968 ; Carry set if error 969 ; Carry clear if ok 970 971 procedure CHECK_READ_LOCK,NEAR ;AN000; 971 ****************** warning: proc CHECK_READ_LOCK... [-w+user] 972 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 973 0 00003DD7 26F6450408 TEST byte [ES:DI + sf_attr],attr_volume_id ;AN000;;MS. volume id 0 00003DDC 7404 JZ do_retry ;AN000;;MS. no 0 00003DDE E8[0000] invoke SET_ACC_ERR ;AN000;;MS. 0 00003DE1 C3 return ;AN000;;MS. 978 do_retry: ;AN000; 0 00003DE2 B000 MOV AL,0 ;AN000;;MS. check read access 0 00003DE4 E8[0000] invoke LOCK_CHECK ;AN000;;MS. check lock 0 00003DE7 7305 JNC READ_OK ;AN000;;MS. lock ok 0 00003DE9 E8[0000] invoke READ_LOCK_VIOLATION ;AN000;;MS. issue I24 0 00003DEC 73E9 JNC CHECK_READ_LOCK ;AN000;;MS. retry 984 READ_OK: ;AN000; MS. 0 00003DEE C3 return ;AN000;;MS. 986 EndProc CHECK_READ_LOCK ;AN000; 987 988 %ifndef BUF2 989 %IF BUFFERFLAG 990 991 ;------------------------------------------------------------------------- 992 ; Function name : choose_buf_page 993 ; Inputs : DMAADD = Xaddr 994 ; cx = # of bytes to transfer 995 ; Outputs : if NC 996 ; 997 ; SAFE_FLAG - 0 ==> page is safe. no need to 998 ; detect collision between 999 ; user & system buffer. 1000 ; SAFE_FLAG - 1 ==> page is unsafe. Must check 1001 ; for collision 1002 ; 1003 ; CY - error 1004 ; 1005 ; 1006 ; High Level Alogrithm: 1007 ; 1008 ; 1. If Xaddr. is above the first physical page above 640K 1009 ; 2. choose that page 1010 ; 3. set safe flag 1011 ; 4. else 1012 ; 5. choose highest page above 640K 1013 ; 6. If 6 or more pages above 640k 1014 ; 7. Set safe flag 1015 ; 8. else 1016 ; 9. if Xaddr. + # of bytes to transfer does not spill into the 1017 ; chosen page 1018 ; 10. set safe flag 1019 ; 11.else 1020 ; 12. clear safe flag 1021 ; 13.endif 1022 ; 14.endif 1023 ; 15.endif 1024 ; 1025 ;---------------------------------------------------------------------------- 1026 Procedure choose_buf_page,near 1027 1028 assume ds:nothing, es:nothing, ss:dosgroup 1029 1030 push cx 1031 push bx 1032 push dx 1033 push si 1034 push ds 1035 push ax 1036 1037 mov ax, word ptr [ss:DMAADD+2] 1038 and ax, 0fc00h ; page segment of transfer segment 1039 1040 cmp ax, word ptr [ss:BUF_EMS_FIRST_PAGE] 1041 ja pick_first 1042 1043 cmp word [ss:BUF_EMS_NPA640], 6 1044 jae safe_pick_last 1045 1046 add cx, word ptr [ss:DMAADD] ; get final offset 1047 mov bx, cx 1048 1049 mov cl, 4 1050 shr bx, cl ; get # of paragraphs 1051 mov ax, word ptr [ss:DMAADD+2] ; get initial segment 1052 add ax, bx ; get final segment 1053 1054 and ax, 0fc00h 1055 cmp ax, word ptr [ss:BUF_EMS_LAST_PAGE] 1056 jne safe_pick_last 1057 1058 mov byte [ss:BUF_EMS_SAFE_FLAG], 0 1059 jmp fin_choose_page 1060 nop ; identicalise 1061 1062 safe_pick_last: 1063 mov byte [ss:BUF_EMS_SAFE_FLAG], 1 1064 jmp fin_choose_page 1065 nop ; identicalise 1066 1067 ;pick_last: 1068 ; mov ax, word ptr [BUF_EMS_LAST_PAGE] 1069 ; mov [BUF_EMS_PFRAME], ax 1070 ; mov ax, word ptr [BUF_EMS_LAST_PAGE+2] 1071 ; mov [BUF_EMS_PAGE_FRAME], ax 1072 ; xor ax, ax 1073 ; jmp fin_choose_page 1074 1075 pick_first: 1076 mov ax, word ptr [ss:BUF_EMS_FIRST_PAGE] 1077 cmp [ss:BUF_EMS_PFRAME], ax 1078 je fin_choose_page 1079 call restore_user_map 1080 mov word ptr [ss:LASTBUFFER], -1 1081 mov [ss:BUF_EMS_PFRAME], ax 1082 mov ax, word ptr [ss:BUF_EMS_FIRST_PAGE+2] 1083 mov [ss:BUF_EMS_PAGE_FRAME], ax 1084 mov byte [ss:BUF_EMS_SAFE_FLAG], 1 1085 call Setup_EMS_Buffers 1086 call save_user_map 1087 jmp fin_choose_page 1088 nop ; identicalise 1089 1090 err_choose_page: 1091 stc 1092 1093 fin_choose_page: 1094 clc 1095 1096 pop ax 1097 pop ds 1098 pop si 1099 pop dx 1100 pop bx 1101 pop cx 1102 return 1103 1104 EndProc choose_buf_page 1105 1106 %ENDIF 1107 %endif 1108 1109 END 1110 1111 1112 === Trace listing source: ../DOS/disk2.lst 1 ; SCCSID = @(#)disk2.asm 1.3 85/06/19 2 ; SCCSID = @(#)disk2.asm 1.3 85/06/19 3 ;TITLE DISK2 - Disk utility routines 4 ;NAME Disk2 5 ; Low level Read and write routines for local SFT I/O on files and devs 6 ; 7 ; DskRead 8 ; DWRITE 9 ; DSKWRITE 10 ; HarderrRW 11 ; SETUP 12 ; BREAKDOWN 13 ; READ_LOCK_VIOLATION 14 ; WRITE_LOCK_VIOLATION 15 ; DISKREAD 16 ; SET_ACC_ERR_DS 17 ; SET_ACC_ERR 18 ; SETSFT 19 ; SETCLUS 20 ; AddRec 21 ; 22 ; Revision history: 23 ; 24 ; AN000 version 4.00 Jan. 1988 25 ; 26 27 ; 28 ; get the appropriate segment definitions 29 ; 30 [list -] 30 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 32 33 [list +] === Switch to base=002450h -> "DOSCODECODE" 34 section DOSCODECODE 35 [list -] 35 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 35 ****************** warning: out: BPB.INC... [-w+user] 35 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 35 ****************** warning: out: DEVSYM.INC... [-w+user] 35 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 43 44 %iassign Installed TRUE 45 46 i_need THISSFT,DWORD 47 i_need DMAADD,DWORD 48 i_need NEXTADD,WORD 49 i_need ThisDrv,BYTE 50 i_need SecClusPos,BYTE 51 i_need ClusNum,WORD 52 i_need ReadOp,BYTE 53 i_need Trans,BYTE 54 i_need BytPos,4 55 i_need SecPos,DWORD ; DOS 4.00 >32mb ;AN000; 56 i_need BytSecPos,WORD 57 i_need BytCnt1,WORD 58 i_need BytCnt2,WORD 59 i_need SecCnt_DOS,WORD 60 i_need ThisDPB,DWORD 61 i_need LastPos,WORD 62 i_need EXTERRPT,DWORD 63 i_need CALLVIDRW,DWORD 64 i_need ALLOWED,BYTE 65 i_need DEVCALL,BYTE 66 i_need CALLSCNT,WORD 67 i_need DISK_FULL,BYTE ; disk full flag for ran blk wrt 68 i_need FSeek_drive,BYTE ; DOS 4.00 ;AN000; 69 i_need FSeek_firclus,WORD ; DOS 4.00 ;AN000; 70 i_need HIGH_SECTOR,WORD ; F.C. >32mb ;AN000; 71 i_need TEMP_VAR2,WORD ; LB. ;AN000; 72 i_need TEMP_VAR,WORD ; LB. ;AN000; 73 i_need IFS_DRIVER_ERR,WORD ; LB. ;AN000; 74 %ifdef BUF2 75 i_need BUF2_Dirty_Count,WORD 76 i_need BUFFHEAD,DWORD 77 %else 78 i_need CurHashEntry,DWORD ; DOS 4.00 current Hash entry ;AN000; 79 i_need BUF_HASH_PTR,DWORD ; DOS 4.00 Hash table pointer ;AN000; 80 i_need BUF_HASH_COUNT,WORD ; DOS 4.00 Hash table entries ;AN000; 81 %endif 82 i_need LastBuffer,DWORD 83 i_need FIRST_BUFF_ADDR,WORD ; first buffer address ;AN000; 84 85 %ifndef BUF2 86 %IF BUFFERFLAG 87 EXTRN SAVE_MAP:NEAR 88 EXTRN RESTORE_MAP:NEAR 89 EXTRN SAVE_USER_MAP:NEAR 90 EXTRN RESTORE_USER_MAP:NEAR 91 i_need BUF_EMS_SAFE_FLAG,BYTE 92 i_need BUF_EMS_MODE,BYTE 93 i_need CURADD,WORD 94 %ENDIF 95 %endif 96 97 98 assume nocheck, ss:DOSGROUP 99 100 Break 101 102 ; Inputs: 103 ; DS:BX = Transfer addr 104 ; CX = Number of sectors 105 ; [HIGH_SECTOR] = Absolute record number (HIGH) 106 ; DX = Absolute record number (LOW) 107 ; ES:BP = Base of drive parameters 108 ; Function: 109 ; Call BIOS to perform disk read 110 ; Outputs: 111 ; DI = CX on entry 112 ; CX = Number of sectors unsuccessfully transfered 113 ; AX = Status word as returned by BIOS (error code in AL if error) 114 ; Zero set if OK (from BIOS) (carry clear) 115 ; Zero clear if error (carry clear) 116 ; SI Destroyed, others preserved 117 118 procedure DskRead,NEAR 118 ****************** warning: proc DskRead... [-w+user] 119 ASSUME DS:NOTHING,ES:NOTHING 120 121 Assert ISDPB,,"DskRead" 0 00003DEF 51 PUSH CX 0 00003DF0 268A6617 MOV AH,[ES:BP + dpb_media] 0 00003DF4 268A4601 MOV AL,[ES:BP + dpb_UNIT] 0 00003DF8 53 PUSH BX 0 00003DF9 06 PUSH ES 0 00003DFA E8[0000] invoke SETREAD 0 00003DFD EB29 JMP DODSKOP 0 00003DFF 90 nop ; identicalise 130 131 Break 132 133 ; Inputs: 134 ; DS:BX = Transfer address 135 ; CX = Number of sectors 136 ; [HIGH_SECTOR] = Absolute record number (HIGH) 137 ; DX = Absolute record number (LOW) 138 ; ES:BP = Base of drive parameters 139 ; [ALLOWED] must be set in case HARDERR_DOS called 140 ; Function: 141 ; Calls BIOS to perform disk write. If BIOS reports 142 ; errors, will call HARDERRRW for further action. 143 ; Output: 144 ; Carry set if error (currently, user FAILed to I 24) 145 ; BP preserved. All other registers destroyed. 146 147 entry DWRITE 148 ASSUME DS:NOTHING,ES:NOTHING 149 150 Assert ISDPB,,"DWrite" 0 00003E00 E81700 CALL DSKWRITE 0 00003E03 7501C3 retz ; Carry clear 153 READOP equ ReadOp ; NASM port label 0 00003E06 36C606[0000]01 MOV BYTE PTR [ss:READOP],1 0 00003E0C E83E00 invoke HARDERRRW 0 00003E0F 3C01 CMP AL,1 ; Check for retry 0 00003E11 74ED JZ DWRITE 0 00003E13 3C03 CMP AL,3 ; Check for FAIL 0 00003E15 F8 CLC 0 00003E16 7501 JNZ NO_CAR2 ; Ignore 0 00003E18 F9 STC 162 NO_CAR2: 0 00003E19 C3 return 164 165 Break 166 167 ; Inputs: 168 ; DS:BX = Transfer addr 169 ; CX = Number of sectors 170 ; DX = Absolute record number (LOW) 171 ; [HIGH_SECTOR] = Absolute record number (HIGH) 172 ; ES:BP = Base of drive parameters 173 ; Function: 174 ; Call BIOS to perform disk read 175 ; Outputs: 176 ; DI = CX on entry 177 ; CX = Number of sectors unsuccessfully transfered 178 ; AX = Status word as returned by BIOS (error code in AL if error) 179 ; Zero set if OK (from BIOS) (carry clear) 180 ; Zero clear if error (carry clear) 181 ; SI Destroyed, others preserved 182 183 entry DSKWRITE 184 ASSUME DS:NOTHING,ES:NOTHING 185 186 Assert ISDPB,,"DskWrite" 0 00003E1A 51 PUSH CX 0 00003E1B 268A6617 MOV AH,[ES:BP + dpb_media] 0 00003E1F 268A4601 MOV AL,[ES:BP + dpb_UNIT] 0 00003E23 53 PUSH BX 0 00003E24 06 PUSH ES 0 00003E25 E8[0000] invoke SETWRITE 193 DODSKOP: 0 00003E28 8CD9 MOV CX,DS ; Save DS 0 00003E2A 1F POP DS ; DS:BP points to DPB 196 assume ds:DPB 0 00003E2B 1E PUSH DS 0 00003E2C 3EC57613 LDS SI,[DS:BP + dpb_driver_addr] 199 assume ds:nothing 0 00003E30 E8[0000] invoke DEVIOCALL2 0 00003E33 8ED9 MOV DS,CX ; Restore DS 202 assume ds:nothing 0 00003E35 07 POP ES ; Restore ES 204 assume es:nothing 0 00003E36 5B POP BX 0 00003E37 368B0E[0000] MOV CX,[ss:CALLSCNT] ; Number of sectors transferred 0 00003E3C 5F POP DI 0 00003E3D 29F9 SUB CX,DI 0 00003E3F F7D9 NEG CX ; Number of sectors not transferred 0 00003E41 36A1[0300] MOV AX,[ss:DEVCALL + REQSTAT] 0 00003E45 36A3[0000] MOV [ss:IFS_DRIVER_ERR],AX ;IFS. save it for IFS ;AN000; 0 00003E49 A90080 TEST AX,STERR 0 00003E4C C3 return 214 EndProc DskRead 215 216 217 218 Break 219 220 ; Inputs: 221 ; AX is error code from read or write 222 ; Other registers set as per HARDERR_DOS 223 ; Function: 224 ; Checks the error code for special extended 225 ; errors and maps them if needed. Then invokes 226 ; Harderr_DOS 227 ; Outputs: 228 ; Of HARDERR_DOS 229 ; AX may be modified prior to call to HARDERR_DOS. 230 ; No other registers altered. 231 232 procedure HARDERRRW,near 232 ****************** warning: proc HARDERRRW... [-w+user] 233 ASSUME DS:NOTHING,ES:NOTHING 234 0 00003E4D 3C0F CMP AL,error_I24_wrong_disk 0 00003E4F 7513 JNZ DO_ERR ; Nothing to do 0 00003E51 1E PUSH DS 0 00003E52 56 PUSH SI 0 00003E53 36C536[0000] LDS SI,[ss:CALLVIDRW] ; Get pointer from dev 240 assume ds:nothing 0 00003E58 368C1E[0200] MOV WORD PTR [ss:EXTERRPT+2],DS ; Set ext err pointer 0 00003E5D 368936[0000] MOV WORD PTR [ss:EXTERRPT],SI 0 00003E62 5E POP SI 0 00003E63 1F POP DS 245 assume ds:nothing 246 DO_ERR: 0 00003E64 E8[0000] invoke HARDERR_DOS 0 00003E67 C3 return 249 250 EndProc HARDERRRW 251 252 Break 253 254 ; Inputs: 255 ; ES:DI point to SFT (value also in THISSFT) 256 ; [DMAADD] contains transfer address 257 ; CX = Byte count 258 ; WARNING Stack must be clean, two ret addrs on stack, 1st of caller, 259 ; 2nd of caller of caller. 260 ; Outputs: 261 ; CX = byte count 262 ; [THISDPB] = Base of drive parameters if file 263 ; = Pointer to device header if device or NET 264 ; ES:DI Points to SFT 265 ; [NEXTADD] = Displacement of disk transfer within segment 266 ; [TRANS] = 0 (No transfers yet) 267 ; [BYTPOS] = Byte position in file 268 ; 269 ; The following fields are relevant to local files (not devices) only: 270 ; 271 ; [SECPOS] = Position of first sector (local files only) 272 ; [BYTSECPOS] = Byte position in first sector (local files only) 273 ; [CLUSNUM] = First cluster (local files only) 274 ; [SECCLUSPOS] = Sector within first cluster (local files only) 275 ; [THISDRV] = Physical unit number (local files only) 276 ; 277 ; RETURNS ONE LEVEL UP WITH: 278 ; CX = 0 279 ; CARRY = Clear 280 ; IF AN ERROR IS DETECTED 281 ; All other registers destroyed 282 283 procedure SETUP,NEAR 283 ****************** warning: proc SETUP... [-w+user] 284 DOSAssume CS,,"SetUp" 285 ASSUME ES:NOTHING 286 287 Assert ISSFT,,"SetUp" 0 00003E68 26C57507 LDS SI,[ES:DI + sf_devptr] 289 ASSUME DS:NOTHING 290 THISDPB equ ThisDPB ; NASM port label 0 00003E6C 368C1E[0200] MOV WORD PTR [ss:THISDPB+2],DS 0 00003E71 161F context DS 0 00003E73 8936[0000] MOV WORD PTR [THISDPB],SI 0 00003E77 8B1E[0000] MOV BX,WORD PTR [DMAADD] 0 00003E7B 891E[0000] MOV [NEXTADD],BX ;Set NEXTADD to start of Xaddr 296 TRANS equ Trans ; NASM port label 0 00003E7F C606[0000]00 MOV BYTE PTR [TRANS],0 ;No transferes 298 sf_Position equ sf_position ; NASM port equate 0 00003E84 268B4515 MOV AX,WORD PTR [ES:DI + sf_Position] 0 00003E88 268B5517 MOV DX,WORD PTR [ES:DI + sf_Position+2] 301 BYTPOS equ BytPos ; NASM port label 0 00003E8C 8916[0200] MOV WORD PTR [BYTPOS+2],DX ;Set it 0 00003E90 A3[0000] MOV WORD PTR [BYTPOS],AX 0 00003E93 26F745058080 TEST word [ES:DI + sf_flags],sf_isnet + devid_device 0 00003E99 754C JNZ NOSETSTUFF ;Following not done on devs or NET 0 00003E9B 06 PUSH ES 0 00003E9C C42E[0000] LES BP,[THISDPB] ;Point at the DPB 308 assume es:DPB 309 Assert ISDPB,,"Setup" 0 00003EA0 268A5E00 MOV BL,[ES:BP + dpb_drive] 311 THISDRV equ ThisDrv ; NASM port label 0 00003EA4 881E[0000] MOV [THISDRV],BL ;Set THISDRV 0 00003EA8 268B5E02 MOV BX,[ES:BP + dpb_sector_size] 314 ; CMP DX,BX ; See if divide will overflow 315 ; JNC EOFERR ; for 16 bit sector 316 ;; 32 bit divide 0 00003EAC E8[0000] invoke DIV32 ; F.C. >32mb ;AN000; 318 SECPOS equ SecPos ; NASM port label 0 00003EAF A3[0000] MOV WORD PTR [SECPOS],AX ; F.C. >32mb ;AN000; 0 00003EB2 8B1E[0000] MOV BX,[HIGH_SECTOR] ; F.C. >32mb ;AN000; 0 00003EB6 891E[0200] MOV WORD PTR [SECPOS+2],BX ; F.C. >32mb ;AN000; 322 323 BYTSECPOS equ BytSecPos ; NASM port label 0 00003EBA 8916[0000] MOV [BYTSECPOS],DX 0 00003EBE 89C2 MOV DX,AX 0 00003EC0 26224604 AND AL,[ES:BP + dpb_cluster_mask] 327 SECCLUSPOS equ SecClusPos ; NASM port label 0 00003EC4 A2[0000] MOV [SECCLUSPOS],AL 0 00003EC7 89C8 MOV AX,CX ; Save byte count 330 ; MOV CL,[ES:BP.dpb_cluster_shift] 0 00003EC9 FF36[0200] PUSH WORD PTR [SECPOS+2] ; F.C. >32mb ;AN000; 0 00003ECD 8F06[0000] POP word [HIGH_SECTOR] ; F.C. >32mb ;AN000; 0 00003ED1 50 PUSH AX ; F.C. >32mb save ax ;AN000; 0 00003ED2 89D0 MOV AX,DX ; F.C. >32mb ax=dx ;AN000; 0 00003ED4 E8[0000] invoke SHR32 ; F.C. >32mb shift ax ;AN000; 0 00003ED7 89C2 MOV DX,AX ; F.C. >32mb dx=ax ;AN000; 0 00003ED9 58 POP AX ; F.C. >32mb restore dx ;AN000; 338 339 ; SHR DX,CL 0 00003EDA 263B560D CMP DX,[ES:BP + dpb_max_cluster] ;>32mb if > disk size ;AN000; ;AN000; 0 00003EDE 771C JA EOFERR ;>32mb then EOF ;AN000; ;AN000; 342 343 CLUSNUM equ ClusNum ; NASM port label 0 00003EE0 8916[0000] MOV [CLUSNUM],DX 0 00003EE4 07 POP ES ; ES:DI point to SFT 346 assume es:nothing 0 00003EE5 89C1 MOV CX,AX ; Put byte count back in CX 348 NOSETSTUFF: 0 00003EE7 89C8 MOV AX,CX ; Need it in AX too 0 00003EE9 0306[0000] ADD AX,WORD PTR [DMAADD] ; See if it will fit in one segment 0 00003EED 730C JNC OK ; Must be less than 64K 0 00003EEF A1[0000] MOV AX,WORD PTR [DMAADD] 0 00003EF2 F7D8 NEG AX ; Amount of room left in segment (know 354 ; less than 64K since max value of CX 355 ; is FFFF). 0 00003EF4 7501 JNZ NoDec 0 00003EF6 48 DEC AX 358 NoDec: 0 00003EF7 89C1 MOV CX,AX ; Can do this much 0 00003EF9 E304 JCXZ NOROOM ; Silly user gave Xaddr of FFFF in segment 361 OK: 0 00003EFB C3 return 363 364 EOFERR: 0 00003EFC 07 POP ES ; ES:DI point to SFT 366 assume es:nothing 0 00003EFD 31C9 XOR CX,CX ; No bytes read 368 ;;;;;;;;;;; 7/18/86 369 ; MOV BYTE PTR [DISK_FULL],1 ; set disk full flag 370 ;;;;;;;;;;; 371 NOROOM: 0 00003EFF 5B POP BX ; Kill return address 0 00003F00 F8 CLC 0 00003F01 C3 return ; RETURN TO CALLER OF CALLER 375 EndProc SETUP 376 377 Break 378 379 ; Inputs: 380 ; CX = Length of disk transfer in bytes 381 ; ES:BP = Base of drive parameters 382 ; [BYTSECPOS] = Byte position witin first sector 383 ; Outputs: 384 ; [BYTCNT1] = Bytes to transfer in first sector 385 ; [SECCNT_DOS] = No. of whole sectors to transfer 386 ; [BYTCNT2] = Bytes to transfer in last sector 387 ; AX, BX, DX destroyed. No other registers affected. 388 389 procedure BREAKDOWN,near 389 ****************** warning: proc BREAKDOWN... [-w+user] 390 DOSAssume CS,,"BreakDown" 391 ASSUME ES:NOTHING 392 393 Assert ISDPB,,"BreakDown" 0 00003F02 A1[0000] MOV AX,[BYTSECPOS] 0 00003F05 89CB MOV BX,CX 0 00003F07 09C0 OR AX,AX 0 00003F09 740E JZ SAVFIR ; Partial first sector? 0 00003F0B 262B4602 SUB AX,[ES:BP + dpb_sector_size] 0 00003F0F F7D8 NEG AX ; Max number of bytes left in first sector 0 00003F11 29C3 SUB BX,AX ; Subtract from total length 0 00003F13 7304 JAE SAVFIR 0 00003F15 01D8 ADD AX,BX ; Don't use all of the rest of the sector 0 00003F17 31DB XOR BX,BX ; And no bytes are left 404 SAVFIR: 405 BYTCNT1 equ BytCnt1 ; NASM port label 0 00003F19 A3[0000] MOV [BYTCNT1],AX 0 00003F1C 89D8 MOV AX,BX 0 00003F1E 31D2 XOR DX,DX 0 00003F20 26F77602 DIV word [ES:BP + dpb_sector_size] ; How many whole sectors? 410 SECCNT_DOS equ SecCnt_DOS ; NASM port label 0 00003F24 A3[0000] MOV [SECCNT_DOS],AX 412 BYTCNT2 equ BytCnt2 ; NASM port label 0 00003F27 8916[0000] MOV [BYTCNT2],DX ; Bytes remaining for last sector 0 00003F2B 0B16[0000] OR DX,[BYTCNT1] 0 00003F2F 75D0 retnz ; NOT (BYTCNT1 = BYTCNT2 = 0) 0 00003F31 83F801 CMP AX,1 0 00003F34 75CB retnz 0 00003F36 268B4602 MOV AX,[ES:BP + dpb_sector_size] ; Buffer EXACT one sector I/O 0 00003F3A A3[0000] MOV [BYTCNT2],AX 0 00003F3D 8916[0000] MOV [SECCNT_DOS],DX ; DX = 0 421 RET45: 0 00003F41 C3 return 423 EndProc BreakDown 424 425 ; ES:DI points to SFT. This entry used by NET_READ 426 ; Carry set if to return error (CX=0,AX=error_sharing_violation). 427 ; Else do retrys. 428 ; ES:DI,DS,CX preserved 429 430 procedure READ_LOCK_VIOLATION,NEAR 430 ****************** warning: proc READ_LOCK_VIOLATION... [-w+user] 431 DOSAssume CS,,"Read_Lock_Violation" 432 ASSUME ES:NOTHING 433 434 Assert ISSFT,,"ReadLockViolation" 435 0 00003F42 C606[0000]00 MOV byte [READOP],0 437 ERR_ON_CHECK: 0 00003F47 26F745020080 TEST word [ES:DI + sf_mode],sf_isfcb 0 00003F4D 750E JNZ HARD_ERR 0 00003F4F 51 PUSH CX 0 00003F50 268A4D02 MOV CL,BYTE PTR [ES:DI + sf_mode] 0 00003F54 80E1F0 AND CL,sharing_mask 0 00003F57 80F900 CMP CL,sharing_compat 0 00003F5A 59 POP CX 0 00003F5B 7505 JNE NO_HARD_ERR 446 HARD_ERR: 0 00003F5D E8[0000] invoke LOCK_VIOLATION 0 00003F60 73DF retnc ; User wants Retrys 449 NO_HARD_ERR: 0 00003F62 31C9 XOR CX,CX ;No bytes transferred 0 00003F64 B82100 MOV AX,error_lock_violation 0 00003F67 F9 STC 0 00003F68 C3 return 454 455 EndProc READ_LOCK_VIOLATION 456 457 ; Same as READ_LOCK_VIOLATION except for READOP. 458 ; This entry used by NET_WRITE 459 procedure WRITE_LOCK_VIOLATION,NEAR 459 ****************** warning: proc WRITE_LOCK_VIOLATION... [-w+user] 460 DOSAssume CS,,"Write_Lock_Violation" 461 ASSUME ES:NOTHING 462 Assert ISSFT,,"WriteLockViolation" 463 0 00003F69 C606[0000]01 MOV byte [READOP],1 0 00003F6E EBD7 JMP ERR_ON_CHECK 466 467 EndProc WRITE_LOCK_VIOLATION 468 469 470 Break 471 472 ; Inputs: 473 ; Outputs of SETUP 474 ; Function: 475 ; Perform disk read 476 ; Outputs: 477 ; Carry clear 478 ; CX = No. of bytes read 479 ; ES:DI point to SFT 480 ; SFT offset and cluster pointers updated 481 ; Carry set 482 ; CX = 0 483 ; ES:DI point to SFT 484 ; AX has error code 485 486 procedure DISKREAD,NEAR 486 ****************** warning: proc DISKREAD... [-w+user] 487 DOSAssume CS,,"DiskRead" 488 ASSUME ES:NOTHING 489 490 Assert ISSFT,,"DISKREAD" 0 00003F70 26FF750B PUSH word [ES:DI + sf_firclus] ; set up 1st cluster # for FastSeek 0 00003F74 8F06[0000] POP word [FSeek_firclus] ; 11/5/86 493 0 00003F78 268B4511 MOV AX,WORD PTR [ES:DI + sf_size] 0 00003F7C 268B5D13 MOV BX,WORD PTR [ES:DI + sf_size+2] 0 00003F80 2B06[0000] SUB AX,WORD PTR [BYTPOS] 0 00003F84 1B1E[0200] SBB BX,WORD PTR [BYTPOS+2] 0 00003F88 722D JB RDERR ;Read starts past EOF 0 00003F8A 750A JNZ ENUF ;More than 64k to EOF 0 00003F8C 09C0 OR AX,AX 0 00003F8E 7427 JZ RDERR ;Read starts at EOF 0 00003F90 39C8 CMP AX,CX 0 00003F92 7302 JAE ENUF ;I/O fits 0 00003F94 89C1 MOV CX,AX ;Limit read to up til EOF 505 ENUF: 0 00003F96 E8[0000] invoke CHECK_READ_LOCK ;IFS. check read lock ;AN000; 507 Read_Ok equ READ_OK ; NASM port label 0 00003F99 7301 JNC Read_Ok ; There are no locks 0 00003F9B C3 return 510 511 READ_OK: 0 00003F9C C42E[0000] LES BP,[THISDPB] 513 Assert ISDPB,,"DISKREAD/ReadOK" 0 00003FA0 268A4600 MOV AL,[ES:BP + dpb_drive] ; set up drive # for FastSeek 0 00003FA4 A2[0000] MOV [FSeek_drive],AL ; 11/5/86 ;AN000; 516 0 00003FA7 E858FF CALL BREAKDOWN 0 00003FAA 8B0E[0000] MOV CX,[CLUSNUM] 0 00003FAE E8[0000] invoke FNDCLUS 520 ;------------------------------------------------------------------------ 521 %IFN IBMCOPYRIGHT 0 00003FB1 7217 JC SET_ACC_ERR_DS ; fix to take care of I24 fail 523 ; migrated from 330a - HKN 524 %ENDIF 525 ;------------------------------------------------------------------------ 0 00003FB3 09C9 OR CX,CX 0 00003FB5 741C JZ SKIPERR 528 RDERR: 0 00003FB7 C606[0000]01 MOV byte [DISK_FULL],1 ;MS. EOF detection ;AN000; 0 00003FBC B40E MOV AH,0EH ;MS. read/data/fail ;AN000; 0 00003FBE E9[0000] transfer WRTERR22 0 00003FC1 E90001 RDLASTJ:JMP RDLAST 0 00003FC4 E91A01 SETSFTJ2: JMP SETSFT 534 535 CANOT_READ: 0 00003FC7 59 POP CX ; Clean stack 0 00003FC8 59 POP CX 0 00003FC9 5B POP BX 539 540 entry SET_ACC_ERR_DS 541 ASSUME DS:NOTHING,ES:NOTHING 0 00003FCA 161F Context DS 543 544 entry SET_ACC_ERR 545 DOSAssume CS,,"SET_ACC_ERR" 546 0 00003FCC 31C9 XOR CX,CX 0 00003FCE B80500 MOV AX,error_access_denied 0 00003FD1 F9 STC 0 00003FD2 C3 return 551 552 SKIPERR: 553 LASTPOS equ LastPos ; NASM port label 0 00003FD3 8916[0000] MOV [LASTPOS],DX 0 00003FD7 891E[0000] MOV [CLUSNUM],BX 0 00003FDB 833E[0000]00 CMP word [BYTCNT1],0 0 00003FE0 7405 JZ RDMID 0 00003FE2 E8[0000] invoke BUFRD 0 00003FE5 72E3 JC SET_ACC_ERR_DS 560 RDMID: 0 00003FE7 833E[0000]00 CMP word [SECCNT_DOS],0 0 00003FEC 74D3 JZ RDLASTJ 0 00003FEE E8[0000] invoke NEXTSEC 0 00003FF1 72D1 JC SETSFTJ2 0 00003FF3 C606[0000]01 MOV BYTE PTR [TRANS],1 ; A transfer is taking place 566 ONSEC: 0 00003FF8 8A16[0000] MOV DL,[SECCLUSPOS] 0 00003FFC 8B0E[0000] MOV CX,[SECCNT_DOS] 0 00004000 8B1E[0000] MOV BX,[CLUSNUM] 570 RDLP: 0 00004004 E8[0000] invoke OPTIMIZE 0 00004007 72C1 JC SET_ACC_ERR_DS 0 00004009 57 PUSH DI 0 0000400A 50 PUSH AX 0 0000400B 53 PUSH BX 576 allowed_RETRY equ Allowed_RETRY ; NASM port equate 577 allowed_FAIL equ Allowed_FAIL ; NASM port equate 578 allowed_IGNORE equ Allowed_IGNORE ; NASM port equate 0 0000400C C606[0000]38 MOV byte [ALLOWED],allowed_RETRY + allowed_FAIL + allowed_IGNORE 0 00004011 8E1E[0200] MOV DS,WORD PTR [DMAADD+2] 581 ASSUME DS:NOTHING 0 00004015 52 PUSH DX 0 00004016 51 PUSH CX 584 %ifndef BUF2 585 invoke SET_RQ_SC_PARMS ;LB. do this for SC ;AN000; 586 587 %IF BUFFERFLAG 588 pushf 589 cmp byte [ss:BUF_EMS_SAFE_FLAG], 1 590 je safe_read 591 save_map equ SAVE_MAP ; NASM port label 592 call save_map 593 restore_user_map equ RESTORE_USER_MAP ; NASM port label 594 call restore_user_map 595 safe_read: 596 popf 597 %ENDIF 598 %endif 599 0 00004017 E8[0000] invoke DREAD 601 602 %ifndef BUF2 603 %IF BUFFERFLAG 604 pushf 605 cmp byte [ss:BUF_EMS_SAFE_FLAG], 1 606 je safe_mapping 607 save_user_map equ SAVE_USER_MAP ; NASM port label 608 call save_user_map 609 restore_map equ RESTORE_MAP ; NASM port label 610 call restore_map 611 safe_mapping: 612 popf 613 %ENDIF 614 %endif 615 0 0000401A 5B POP BX 0 0000401B 5A POP DX 0 0000401C 7302 JNC SKP_CANOT_READ 0 0000401E EBA7 JMP CANOT_READ 620 SKP_CANOT_READ: 0 00004020 36891E[0000] MOV [ss:TEMP_VAR],BX ;LB. save sector count ;AN000; 0 00004025 368916[0000] MOV [ss:TEMP_VAR2],DX ;LB. 1st sector ;AN000; 623 SCAN_NEXT: 624 ;;;;;;; invoke GETCURHEAD ;LB. get buffer header ;AN000; 0 0000402A 52 PUSH DX ;LB. save regs ;AN000; 0 0000402B 50 PUSH AX ;LB. ;AN000; 0 0000402C 53 PUSH BX ;LB. ;AN000; 628 %ifdef BUF2 0 0000402D 36833E[0000]00 cmp word [ss:BUF2_Dirty_Count], 0 0 00004033 7505 jne yesdirty 631 %else 632 MOV AX,DX ;LB. 633 ; MOV DX,[HIGH_SECTOR] ;LB. HASH(sector#) and get entry # ;AN000; 634 XOR DX,DX ;LB. to avoid divide overflow ;AN000; 635 DIV word [ss:BUF_HASH_COUNT] ;LB. get remainder ;AN000; 636 ADD DX,DX ;LB. 8 bytes per entry ;AN000; 637 ADD DX,DX ;LB. ;AN000; 638 ADD DX,DX ;LB. times 8 ;AN000; 639 640 LDS DI,[ss:BUF_HASH_PTR] ;LB. get Hash Table addr ;AN000; 641 ADD DI,DX ;LB position to entry ;AN000; 642 Dirty_Count equ DIRTY_COUNT ; NASM port equate 643 CMP byte [DI + Dirty_Count],0 ;LB dirty hash entry ? ;AN000; 644 JNZ yesdirty ;LB yes and map it ;AN000; 645 %endif 0 00004035 5B POP BX ;LB. ;AN000; 0 00004036 58 POP AX ;LB. ;AN000; 0 00004037 5A POP DX ;LB. ;AN000; 649 %IFN BUFFERFLAG 650 JMP SHORT end_scan ;LB. ;AN000; 651 %ELSE 652 END_SCAN equ end_scan ; NASM port label 0 00004038 EB62 JMP END_SCAN 654 %ENDIF 655 656 yesdirty: 657 %ifdef BUF2 0 0000403A 36C53E[0000] lds di, [ss:BUFFHEAD] 659 LASTBUFFER equ LastBuffer ; NASM port label 0 0000403F 36830E[0000]FF or WORD PTR [ss:LASTBUFFER], -1 ;LB. invalidate last buffer ;AN000; 661 %else 662 MOV WORD PTR [ss:CurHashEntry+2],DS ;LB. update current Hash entry ptr ;AN000; 663 MOV WORD PTR [ss:CurHashEntry],DI ;LB. ;AN000; 664 LASTBUFFER equ LastBuffer ; NASM port label 665 MOV WORD PTR [ss:LASTBUFFER],-1 ;LB. invalidate last buffer ;AN000; 666 MOV BX,[DI + EMS_PAGE_NUM] ;LB. logical page ;AN000; 667 668 %IFN BUFFERFLAG 669 LDS DI,[DI + BUFFER_BUCKET] ;LB. ds:di is 1st buffer addr ;AN000; 670 invalid instruction fixme 671 ; ldos: need seg override? 672 MOV [FIRST_BUFF_ADDR],DI ;LB. save first buff addr 1/19/88 ;AN000; 673 invoke SET_MAP_PAGE ;LB. activate handle if EMS there ;AN000; 674 %ELSE 675 ; int 3 676 push ds 677 push di ; save hash ptr 678 679 LDS DI,[DI + BUFFER_BUCKET] ;ds:di is 1st buffer addr 680 POP AX ; Recall transfer address 681 PUSH AX 682 PUSH DI ; Save search environment 683 PUSH DX ; F.C. no need for high sector, <64K 684 push cx 685 686 MOV DX,[ss:TEMP_VAR2] ;LB. get 1st sector # 687 SUB DX,WORD PTR [DI + buf_sector] ; How far into transfer? 688 NEG DX 689 MOV DI,AX 690 MOV AX,DX 691 MOV CX,[ES:BP + dpb_sector_size] 692 MUL CX 693 ADD DI,AX ; Put the buffer here 694 mov [ss:CURADD], di 695 696 pop cx 697 pop dx 698 pop di 699 700 invoke SET_MAP_PAGE ;LB. activate handle if EMS there ;AN000; 701 pop di ; restore hash ptr. 702 pop ds 703 LDS DI,[DI + BUFFER_BUCKET] ;LB. ds:di is 1st buffer addr ;AN000; 704 MOV [ss:FIRST_BUFF_ADDR],DI ;LB. save first buff addr 1/19/88 ;AN000; 705 %ENDIF 706 ;AN000; 707 %endif ; BUF2 0 00004045 5B POP BX ;LB. ;AN000; 0 00004046 58 POP AX ;LB. ;AN000; 0 00004047 5A POP DX ;LB. ;AN000; 711 712 713 Assert ISDPB,,"DISKREAD/RdLp" 0 00004048 268A4600 MOV AL,[ES:BP + dpb_drive] 715 NXTBUF: ; Must see if one of these sectors is buffered 0 0000404C E8[0000] invoke BUFF_RANGE_CHECK ;F.C. >32mb 0 0000404F 7305 JNC inrange ;LB. ;AN000; 718 %ifdef BUF2 0 00004051 C53D lds di, [di + NEXTBUF] 720 %else 721 mov DI,[DI + buf_next] ;LB. get next buffer 1/19/88 ;AN000; 722 %endif 0 00004053 EB42 JMP DONXTBUF ;LB. ;AN000; 0 00004055 90 nop ; identicalise 725 inrange: 0 00004056 F6450540 TEST byte [DI + buf_flags],buf_dirty 0 0000405A 7438 JZ CLBUFF ; Buffer is clean, so OK 728 ; A sector has been read in when a dirty copy of it is in a buffer 729 ; The buffered sector must now be read into the right place 0 0000405C 58 POP AX ; Recall transfer address 0 0000405D 50 PUSH AX 0 0000405E 57 PUSH DI ; Save search environment 0 0000405F 52 PUSH DX ; F.C. no need for high sector, <64K 734 0 00004060 368B16[0000] MOV DX,[ss:TEMP_VAR2] ;LB. get 1st sector # 0 00004065 2B5508 SUB DX,WORD PTR [DI + buf_sector] ; How far into transfer? 0 00004068 F7DA NEG DX 0 0000406A 89FE MOV SI,DI 0 0000406C 89C7 MOV DI,AX 0 0000406E 89D0 MOV AX,DX 0 00004070 268B4E02 MOV CX,[ES:BP + dpb_sector_size] 0 00004074 F7E1 MUL CX 0 00004076 01C7 ADD DI,AX ; Put the buffer here 0 00004078 8D7410 LEA SI,[SI + BUFINSIZ] 0 0000407B D1E9 SHR CX,1 0 0000407D 06 PUSH ES 0 0000407E 368E06[0200] MOV ES,WORD PTR [ss:DMAADD+2] 748 assume es:nothing 0 00004083 F3A5 REP MOVSW 0 00004085 7301 JNC EVENMOV 0 00004087 A4 MOVSB 752 EVENMOV: 0 00004088 07 POP ES 754 assume es:DPB 0 00004089 5A POP DX 0 0000408A 5F POP DI 0 0000408B 268A4600 MOV AL,[ES:BP + dpb_drive] 0 0000408F E8[0000] invoke SCANPLACE ;LB. done with this chain ;AN000; 0 00004092 EB08 JMP SHORT end_scan ;LB. ;AN000; 760 CLBUFF: 0 00004094 E8[0000] invoke SCANPLACE 762 DONXTBUF: 763 %ifdef BUF2 0 00004097 83FFFF cmp di, -1 765 %else 766 CMP DI,[ss:FIRST_BUFF_ADDR] ;LB. end of buffers ;AN000; 767 %endif 0 0000409A 75B0 JNZ NXTBUF 769 end_scan: 0 0000409C 83C201 ADD DX,1 ;LB. next sector # ;AN000; 0 0000409F 368316[0000]00 ADC word [ss:HIGH_SECTOR],0 ;LB. ;AN000; 0 000040A5 36FF0E[0000] DEC word [ss:TEMP_VAR] ;LB. decrement count ;AN000; 0 000040AA 7403 JZ SCAN_DONE ;LB. scan next sector ;AN000; 0 000040AC E97BFF JMP SCAN_NEXT ;LB. scan next sector ;AN000; 775 SCAN_DONE: 0 000040AF 161F Context DS 0 000040B1 59 POP CX 0 000040B2 59 POP CX 0 000040B3 5B POP BX 0 000040B4 E30E JCXZ RDLAST 0 000040B6 E8[0000] invoke IsEOF ; test for eof on fat size 0 000040B9 7326 JAE SETSFT 0 000040BB B200 MOV DL,0 0 000040BD FF06[0000] INC word [LASTPOS] ; We'll be using next cluster 0 000040C1 E940FF JMP RDLP 786 787 RDLAST: 0 000040C4 A1[0000] MOV AX,[BYTCNT2] 0 000040C7 09C0 OR AX,AX 0 000040C9 7416 JZ SETSFT 0 000040CB A3[0000] MOV [BYTCNT1],AX 0 000040CE E8[0000] invoke NEXTSEC 0 000040D1 720E JC SETSFT 0 000040D3 C706[0000]0000 MOV word [BYTSECPOS],0 0 000040D9 E8[0000] invoke BUFRD 0 000040DC 7303 JNC SETSFT 0 000040DE E9E9FE JMP SET_ACC_ERR_DS 798 799 ; Inputs: 800 ; [NEXTADD],[CLUSNUM],[LASTPOS] set to determine transfer size 801 ; and set cluster fields 802 ; Function: 803 ; Update [THISSFT] based on the transfer 804 ; Outputs: 805 ; sf_position, sf_lstclus, and sf_cluspos updated 806 ; ES:DI points to [THISSFT] 807 ; CX No. of bytes transferred 808 ; Carry clear 809 810 entry SETSFT 811 DOSAssume CS,,"SetSFT" 812 ASSUME ES:NOTHING 813 0 000040E1 C43E[0000] LES DI,[THISSFT] 815 816 ; Same as SETSFT except ES:DI already points to SFT 817 entry SETCLUS 818 DOSAssume CS,,"SetClus" 819 ASSUME ES:NOTHING 820 821 Assert ISSFT,,"SetClus" 0 000040E5 8B0E[0000] MOV CX,[NEXTADD] 0 000040E9 2B0E[0000] SUB CX,WORD PTR [DMAADD] ; Number of bytes transfered 0 000040ED 26F745058000 TEST word [ES:DI + sf_flags],devid_device 825 ADDREC equ AddRec ; NASM port label 0 000040F3 750E JNZ ADDREC ; don't set clusters if device 0 000040F5 A1[0000] MOV AX,[CLUSNUM] 0 000040F8 26894535 MOV [ES:DI + sf_lstclus],AX 0 000040FC A1[0000] MOV AX,[LASTPOS] 0 000040FF 26894519 MOV [ES:DI + sf_cluspos],AX 831 832 ; Inputs: 833 ; ES:DI points to SFT 834 ; CX is No. Bytes transferred 835 ; Function: 836 ; Update the SFT offset based on the transfer 837 ; Outputs: 838 ; sf_position updated to point to first byte after transfer 839 ; ES:DI points to SFT 840 ; CX No. of bytes transferred 841 ; Carry clear 842 843 entry AddRec 844 DOSAssume CS,,"AddRec" 845 ASSUME ES:NOTHING 846 847 Assert ISSFT,,"AddRec" 0 00004103 E309 JCXZ RET28 ; If no records read, don't change position 0 00004105 26014D15 ADD WORD PTR [ES:DI + sf_position],CX ; Update current position 0 00004109 2683551700 ADC WORD PTR [ES:DI + sf_position+2],0 0 0000410E F8 RET28: CLC 0 0000410F C3 return 853 EndProc DISKREAD 854 855 END 856 857 === Trace listing source: ../DOS/disk3.lst 1 ; SCCSID = @(#)disk3.asm 1.3 85/07/26 2 ; SCCSID = @(#)disk3.asm 1.3 85/07/26 3 ;TITLE DISK3 - Disk utility routines 4 ;NAME Disk3 5 ; Low level Read and write routines for local SFT I/O on files and devs 6 ; 7 ; DISKWRITE 8 ; WRTERR 9 ; 10 ; Revision history: 11 ; 12 ; AN000 version 4.00 Jan. 1988 13 ; 14 15 ; 16 ; get the appropriate segment definitions 17 ; 18 [list -] 18 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 31 32 %iassign Installed TRUE 33 34 i_need THISSFT,DWORD 35 i_need DMAADD,DWORD 36 i_need SecClusPos,BYTE 37 i_need ClusNum,WORD 38 i_need Trans,BYTE 39 i_need BytPos,4 40 i_need SecPos,DWORD ;F.C. >32mb ;AN000; 41 i_need BytSecPos,WORD 42 i_need BytCnt1,WORD 43 i_need BytCnt2,WORD 44 i_need SecCnt_DOS,WORD 45 i_need ThisDPB,DWORD 46 i_need LastPos,WORD 47 i_need ValSec,WORD ;F.C. >32mb ;AN000; 48 i_need GrowCnt,DWORD 49 i_need ALLOWED,BYTE 50 I_need JShare,DWORD 51 I_need FSeek_drive,BYTE ; DOS 4.00 ;AN000; 52 I_need FSeek_firclus,WORD ; DOS 4.00 ;AN000; 53 I_need FSeek_logclus,WORD ; DOS 4.00 ;AN000; 54 I_need HIGH_SECTOR,WORD ;F.C. >32mb ;AN000; 55 I_need HIGH_SECTOR_TEMP,WORD ;F.C. >32mb ;AN000; 56 I_need EXTERR,WORD ; DOS 4.00 ;AN000; 57 I_need EXTERR_LOCUS,BYTE ; DOS 4.00 ;AN000; 58 I_need EXTERR_ACTION,BYTE ; DOS 4.00 ;AN000; 59 I_need EXTERR_CLASS,BYTE ; DOS 4.00 ;AN000; 60 I_need EXITHOLD,DWORD ; DOS 4.00 ;AN000; 61 I_need DISK_FULL,BYTE ; DOS 4.00 ;AN000; 62 I_need SC_DRIVE,BYTE ; DOS 4.00 ;AN000; 63 I_need SC_CACHE_COUNT,WORD ; DOS 4.00 ;AN000; 64 I_need ThisDRV,BYTE ; DOS 4.00 ;AN000; 65 I_need User_In_AX,WORD ; DOS 4.00 ;AN000; 66 I_need DOS34_FLAG,WORD ; DOS 4.00 ;AN000; 67 I_need FIRST_BUFF_ADDR,WORD ; DOS 4.00 ;AN000; 68 69 %ifndef BUF2 70 %IF BUFFERFLAG 71 EXTRN SAVE_MAP:NEAR 72 EXTRN RESTORE_MAP:NEAR 73 EXTRN SAVE_USER_MAP:NEAR 74 EXTRN RESTORE_USER_MAP:NEAR 75 i_need BUF_EMS_SAFE_FLAG,BYTE 76 i_need BUF_EMS_MODE,BYTE 77 %ENDIF 78 %else 79 i_need BUFFHEAD,dword 80 %endif 81 82 83 assume nocheck, ss:DOSGROUP 84 85 Break 86 87 ; Inputs: 88 ; Outputs of SETUP 89 ; Function: 90 ; Perform disk write 91 ; Outputs: 92 ; Carry clear 93 ; CX = No. of bytes read 94 ; ES:DI point to SFT 95 ; SFT offset and cluster pointers updated 96 ; Carry set 97 ; CX = 0 98 ; ES:DI point to SFT 99 ; AX has error code 100 101 procedure DISKWRITE,NEAR 101 ****************** warning: proc DISKWRITE... [-w+user] 102 DOSAssume CS,,"DiskWrite" 103 ASSUME ES:NOTHING 104 105 Assert ISSFT,,"DiskWrite" 0 00004110 26FF750B PUSH word [ES:DI + sf_firclus] ; set up 1st cluster # for FastSeek 0 00004114 8F06[0000] POP word [FSeek_firclus] 108 0 00004118 E8[0000] invoke CHECK_WRITE_LOCK ;IFS. check write lock ;AN000; 0 0000411B 7304 JNC WRITE_OK ;IFS. lock check ok ;AN000; 0 0000411D C3 return 112 113 WRTEOFJ: 0 0000411E E93A02 JMP WRTEOF 115 116 WRITE_OK: 0 00004121 26816505BFBF AND word [ES:DI + sf_flags],~ (sf_close_nodate | devid_file_clean) 118 ; Mark file as dirty, clear no date on close 119 THISDPB equ ThisDPB ; NASM port label 0 00004127 C42E[0000] LES BP,[THISDPB] 121 Assert ISDPB,,"DiskWrite/WriteOk" 0 0000412B 268A4600 MOV AL,[ES:BP + dpb_drive] ; set up drive # for FastSeek 0 0000412F A2[0000] MOV [FSeek_drive],AL ; 11/5/86 DOS 4.00 124 0 00004132 E8[0000] invoke BREAKDOWN 126 BYTPOS equ BytPos ; NASM port label 0 00004135 A1[0000] MOV AX,WORD PTR [BYTPOS] 0 00004138 8B16[0200] MOV DX,WORD PTR [BYTPOS+2] 0 0000413C E3E0 JCXZ WRTEOFJ ;Make the file length = sf_position 0 0000413E 01C8 ADD AX,CX 0 00004140 83D200 ADC DX,0 ; AX:DX=byte after last byte accessed 132 ; 133 ; Make sure divide won't overflow 134 ; 0 00004143 268B5E02 MOV BX,[ES:BP + dpb_sector_size] 136 ; CMP DX,BX ;F.C. >32mb 16 bit sector check ;AN000; 137 ; JAE WrtErr ;F.C. >32mb ;AN000; 138 0 00004147 E8A402 CALL DIV32 ;F.C. perform 32 bit divide ;AN000; 0 0000414A 89C3 MOV BX,AX ; Save last full sector 0 0000414C 09D2 OR DX,DX 0 0000414E 7508 JNZ CALCLUS 0 00004150 83E801 SUB AX,1 ; AX must be zero base indexed ;AC000; 0 00004153 831E[0000]00 SBB word [HIGH_SECTOR],0 ;F.C. >32mb ;AN000; 145 CALCLUS: 0 00004158 FF36[0000] PUSH word [HIGH_SECTOR] ;F.C. >32mb ;AN000; 0 0000415C E89E02 CALL SHR32 ;F.C. >32mb ;AN000; 0 0000415F 8F06[0000] POP word [HIGH_SECTOR] ;F.C. >32mb ;AN000; 149 150 ; SHR AX,CL ; Last cluster to be accessed 0 00004163 50 PUSH AX 0 00004164 52 PUSH DX ; Save the size of the "tail" 0 00004165 06 PUSH ES 0 00004166 C43E[0000] LES DI,[THISSFT] 155 assume es:nothing 156 Assert ISSFT,,"DiskWrite/CalClus" 0 0000416A 268B4511 MOV AX,WORD PTR [ES:DI + sf_size] 0 0000416E 268B5513 MOV DX,WORD PTR [ES:DI + sf_size+2] 0 00004172 07 POP ES 160 assume es:DPB 161 162 0 00004173 50 PUSH AX ;F.C. >32mb ;AN000; 0 00004174 89D0 MOV AX,DX ;F.C. >32mb ;AN000; 0 00004176 31D2 XOR DX,DX ;F.C. >32mb ;AN000; 0 00004178 26F77602 DIV word [ES:BP + dpb_sector_size] ;F.C. >32mb ;AN000; 0 0000417C A3[0000] MOV [HIGH_SECTOR_TEMP],AX ;F.C. >32mb ;AN000; 0 0000417F 58 POP AX ;F.C. >32mb ;AN000; 169 0 00004180 26F77602 DIV word [ES:BP + dpb_sector_size] 0 00004184 89C1 MOV CX,AX ; Save last full sector of current file 0 00004186 09D2 OR DX,DX 0 00004188 7408 JZ NORNDUP 0 0000418A 83C001 ADD AX,1 ; Round up if any remainder ;AC000; 0 0000418D 8316[0000]00 ADC word [HIGH_SECTOR_TEMP],0 ;F.C. >32mb ;AN000; 176 NORNDUP: 0 00004192 FF36[0000] PUSH word [HIGH_SECTOR_TEMP] ;F.C. >32mb ;AN000; 178 VALSEC equ ValSec ; NASM port label 0 00004196 8F06[0200] POP WORD PTR [VALSEC+2] ;F.C. >32mb ;AN000; 0 0000419A A3[0000] MOV WORD PTR [VALSEC],AX ;Number of sectors that have been written 0 0000419D 31C0 XOR AX,AX 182 GROWCNT equ GrowCnt ; NASM port label 0 0000419F A3[0000] MOV WORD PTR [GROWCNT],AX 0 000041A2 A3[0200] MOV WORD PTR [GROWCNT+2],AX 0 000041A5 58 POP AX 186 0 000041A6 8B3E[0000] MOV DI,[HIGH_SECTOR] ;F.C. >32mb ;AN000; 0 000041AA 3B3E[0000] CMP DI,[HIGH_SECTOR_TEMP] ;F.C. >32mb ;AN000; 0 000041AE 7277 JB NOGROW ;F.C. >32mb ;AN000; 0 000041B0 7409 JZ lowsec ;F.C. >32mb ;AN000; 0 000041B2 29CB SUB BX,CX ;F.C. >32mb ;AN000; 0 000041B4 1B3E[0000] SBB DI,[HIGH_SECTOR_TEMP] ;F.C. >32mb di:bx no. of sectors ;AN000; 0 000041B8 EB0A JMP yesgrow ;F.C. >32mb ;AN000; 0 000041BA 90 nop ; identicalise 195 lowsec: 0 000041BB BF0000 MOV DI,0 ;F.C. >32mb 0 000041BE 29CB SUB BX,CX ; Number of full sectors 0 000041C0 7265 JB NOGROW 0 000041C2 7456 JZ TESTTAIL 200 yesgrow: 0 000041C4 89D1 MOV CX,DX 0 000041C6 93 XCHG AX,BX 0 000041C7 26F76602 MUL word [ES:BP + dpb_sector_size] ; Bytes of full sector growth 0 000041CB 8916[0000] MOV [HIGH_SECTOR],DX ;F.C. >32mb save dx ;AN000; 0 000041CF A3[0000] MOV [HIGH_SECTOR_TEMP],AX ;F.C. >32mb save ax ;AN000; 0 000041D2 89F8 MOV AX,DI ;F.C. >32mb ;AN000; 0 000041D4 26F76602 MUL word [ES:BP + dpb_sector_size] ;F.C. >32mb do higher word multiply ;AN000; 0 000041D8 0306[0000] ADD AX,[HIGH_SECTOR] ;F.C. >32mb add lower value ;AN000; 0 000041DC 89C2 MOV DX,AX ;F.C. >32mb DX:AX is the result of ;AN000; 0 000041DE A1[0000] MOV AX,[HIGH_SECTOR_TEMP] ;F.C. >32mb a 32 bit multiply ;AN000; 211 0 000041E1 29C8 SUB AX,CX ; Take off current "tail" 0 000041E3 83DA00 SBB DX,0 ; 32-bit extension 0 000041E6 01D8 ADD AX,BX ; Add on new "tail" 0 000041E8 83D200 ADC DX,0 ; ripple tim's head off 0 000041EB EB33 JMP SHORT SETGRW 217 HAVSTART: 218 ;int 3 0 000041ED 89C1 MOV CX,AX 0 000041EF E8[0000] invoke SKPCLP 0 000041F2 E320 JCXZ DOWRTJ 222 ;;; 11/5/86 FastSeek 0 000041F4 8916[0000] MOV [FSeek_logclus],DX ; delete EOF (FFFFH) 0 000041F8 FF06[0000] INC word [FSeek_logclus] 0 000041FC E8[0000] invoke FastSeek_Truncate ; 226 ;;; 11/5/86 FastSeek 0 000041FF E8[0000] invoke ALLOCATE 0 00004202 7310 JNC DOWRTJ 229 230 entry WRTERR 231 DOSAssume CS,,"DiskWrite/WrtErr" 232 ASSUME ES:NOTHING 233 0 00004204 B40F MOV AH,0FH ;MS. write/data/fail/abort ;AN000; 235 entry WRTERR22 236 THISDRV equ ThisDRV ; NASM port label 0 00004206 A0[0000] MOV AL,[THISDRV] ;MS. ;AN000; 0 00004209 E80302 CALL File_Handle_Fail_Error ;MS. issue disk full I24 0 0000420C B90000 MOV CX,0 ;No bytes transferred 240 ; XOR CX,CX ; will be deleted 0 0000420F C43E[0000] LES DI,[THISSFT] 242 Assert ISSFT,,"DiskWrite/WrtErr" 243 ; CLC 0 00004213 C3 return 245 0 00004214 EB66 DOWRTJ: JMP DOWRT 0 00004216 90 nop ; identicalise 248 249 ACC_ERRWJ: 0 00004217 E93E01 JMP SET_ACC_ERRW 251 252 TESTTAIL: 0 0000421A 29D0 SUB AX,DX 0 0000421C 7609 JBE NOGROW 0 0000421E 31D2 XOR DX,DX 256 SETGRW: 0 00004220 A3[0000] MOV WORD PTR [GROWCNT],AX 0 00004223 8916[0200] MOV WORD PTR [GROWCNT+2],DX 259 NOGROW: 0 00004227 58 POP AX 261 CLUSNUM equ ClusNum ; NASM port label 0 00004228 8B0E[0000] MOV CX,[CLUSNUM] ; First cluster accessed 0 0000422C E8[0000] invoke FNDCLUS 0 0000422F 72E6 JC ACC_ERRWJ 0 00004231 891E[0000] MOV [CLUSNUM],BX 266 LASTPOS equ LastPos ; NASM port label 0 00004235 8916[0000] MOV [LASTPOS],DX 268 ;;; 11/5/86 FastSeek 0 00004239 A3[0000] MOV [FSeek_logclus],AX ; set up last position 0 0000423C 29D0 SUB AX,DX ; Last cluster minus current cluster 0 0000423E 743C JZ DOWRT ; If we have last clus, we must have first 0 00004240 E3AB JCXZ HAVSTART ; See if no more data 0 00004242 51 PUSH CX ; No. of clusters short of first 0 00004243 89C1 MOV CX,AX 275 276 ;;; 11/5/86 FastSeek 0 00004245 833E[0000]00 CMP word [CLUSNUM],0 ;FS. null file ;AN000; 0 0000424A 740B JZ NULL_FILE ;FS. yes ;AN000; 0 0000424C 8916[0000] MOV [FSeek_logclus],DX ;FS. delete EOF (FFFFH) ;AN000; 0 00004250 FF06[0000] INC word [FSeek_logclus] ;FS. ;AN000; 0 00004254 E8[0000] invoke FastSeek_Truncate ;FS. ;AN000; 282 NULL_FILE: 283 ;;; 11/5/86 FastSeek 0 00004257 E8[0000] invoke ALLOCATE 0 0000425A 58 POP AX 0 0000425B 72A7 JC WRTERR 0 0000425D 89C1 MOV CX,AX 0 0000425F 8B16[0000] MOV DX,[LASTPOS] 0 00004263 42 INC DX 0 00004264 49 DEC CX 0 00004265 740D JZ NOSKIP 292 ;;; 11/5/86 FastSeek 0 00004267 8916[0000] MOV [FSeek_logclus],DX ; 0 0000426B 010E[0000] ADD [FSeek_logclus],CX ; set up last position 0 0000426F E8[0000] invoke SKPCLP 0 00004272 72A3 JC ACC_ERRWJ 297 NOSKIP: 0 00004274 891E[0000] MOV [CLUSNUM],BX 0 00004278 8916[0000] MOV [LASTPOS],DX 300 DOWRT: 301 BYTCNT1 equ BytCnt1 ; NASM port label 0 0000427C 833E[0000]00 CMP word [BYTCNT1],0 0 00004281 7409 JZ WRTMID 0 00004283 8B1E[0000] MOV BX,[CLUSNUM] 0 00004287 E8[0000] invoke BUFWRT 0 0000428A 728B JC ACC_ERRWJ 307 WRTMID: 308 SECCNT_DOS equ SecCnt_DOS ; NASM port label 0 0000428C A1[0000] MOV AX,[SECCNT_DOS] 0 0000428F 09C0 OR AX,AX 0 00004291 7503 JNZ havemid 0 00004293 E98500 JMP WRTLAST 313 havemid: 314 SECPOS equ SecPos ; NASM port label 0 00004296 0106[0000] ADD WORD PTR [SECPOS],AX 0 0000429A 8316[0200]00 ADC WORD PTR [SECPOS+2],0 ;F.C. >32mb ;AN000; 0 0000429F E8[0000] invoke NEXTSEC 0 000042A2 7303 JNC gotok 0 000042A4 E970FF JMP ACC_ERRWJ 320 gotok: 321 TRANS equ Trans ; NASM port label 0 000042A7 C606[0000]01 MOV BYTE PTR [TRANS],1 ; A transfer is taking place 323 SECCLUSPOS equ SecClusPos ; NASM port label 0 000042AC 8A16[0000] MOV DL,[SECCLUSPOS] 0 000042B0 8B1E[0000] MOV BX,[CLUSNUM] 0 000042B4 8B0E[0000] MOV CX,[SECCNT_DOS] 327 WRTLP: 0 000042B8 E8[0000] invoke OPTIMIZE 0 000042BB 7303 JNC wokok 0 000042BD E957FF JMP ACC_ERRWJ 331 wokok: 0 000042C0 57 PUSH DI 0 000042C1 50 PUSH AX 0 000042C2 52 PUSH DX 0 000042C3 53 PUSH BX 336 Assert ISDPB,,"DiskWrite/WrtLp" 0 000042C4 268A4600 MOV AL,[ES:BP + dpb_drive] 0 000042C8 A2[0000] MOV [SC_DRIVE],AL ;LB. save it for INVALIDATE_SC ;AN000; 0 000042CB 51 PUSH CX ;LB. ;AN000; 0 000042CC FF36[0000] PUSH word [HIGH_SECTOR] ;LB. ;AN000; 341 %ifndef BUF2 342 SCANNEXT: ;LB. ;AN000; 343 invoke GETCURHEAD ;LB. ;AN000; 344 %else 0 000042D0 36C53E[0000] lds di, [ss:BUFFHEAD] 346 %endif 347 ASSUME DS:NOTHING 348 NEXTBUFF: ; Search for buffers 349 %ifndef BUF2 350 CMP word [ss:SC_CACHE_COUNT],0 ;LB. SC support ? ;AN000; 351 JZ nosc ;LB. no ;AN000; 352 PUSH AX ;LB. save reg ;AN000; 353 PUSH CX ;LB. save reg ;AN000; 354 PUSH DX ;LB. save reg ;AN000; 355 invoke INVALIDATE_SC ;LB. invalidate SC ;AN000; 356 POP DX ;LB. save reg ;AN000; 357 POP CX ;LB. save reg ;AN000; 358 POP AX ;LB. save reg ;AN000; 359 nosc: 360 %endif 0 000042D5 E8AE01 CALL BUFF_RANGE_CHECK ;F.C. >32mb ;AN000; 0 000042D8 7305 JNC inrange2 ;F.C. >32mb ;AN000; 363 %ifdef BUF2 0 000042DA C53D lds di, [di + NEXTBUF] 365 %else 366 mov DI,[DI + buf_next] ;LB. get next buffer 1/19/88 ;AN000; 367 %endif 0 000042DC EB12 JMP DONEXTBUFF ;LB. ;AN000; 0 000042DE 90 nop ; identicalise 370 inrange2: 0 000042DF F6450540 TEST byte [DI + buf_flags],buf_dirty ;LB. if dirty ;AN000; 0 000042E3 7403 JZ not_dirty ;LB. ;AN000; 0 000042E5 E8[0000] invoke DEC_DIRTY_COUNT ;LB. then decrement dirty count ;AN000; 374 not_dirty: 375 %ifdef BUF2 0 000042E8 C74504FF00 MOV WORD PTR [DI + BUFDRV], 00FFH 377 ; Free the buffer, it is being over written 378 %else 379 MOV WORD PTR [DI + buf_ID], 00FFH ; Free the buffer, it is being over written 380 %endif 0 000042ED E8[0000] invoke SCANPLACE 382 DONEXTBUFF: 383 %ifdef BUF2 0 000042F0 83FFFF cmp di, -1 385 %else 386 CMP DI,[ss:FIRST_BUFF_ADDR] ;LB. end of chain ;AN000; 387 %endif 0 000042F3 75E0 JNZ NEXTBUFF ;LB. no ;AN000; 389 %ifndef BUF2 390 ADD DX,1 ;LB. next sector number ;AN000; 391 ADC word [ss:HIGH_SECTOR],0 ;LB. ;AN000; 392 LOOP SCANNEXT ;LB. check again ;AN000; 393 %endif 0 000042F5 368F06[0000] POP word [ss:HIGH_SECTOR] ;LB. ;AN000; 0 000042FA 59 POP CX ;LB. get count back ;AN000; 396 0 000042FB 5B POP BX 0 000042FC 5A POP DX 0 000042FD 368E1E[0200] MOV DS,WORD PTR [ss:DMAADD+2] 400 assume ds:nothing 401 allowed_RETRY equ Allowed_RETRY ; NASM port equate 402 allowed_FAIL equ Allowed_FAIL ; NASM port equate 403 allowed_IGNORE equ Allowed_IGNORE ; NASM port equate 0 00004302 36C606[0000]38 MOV byte [ss:ALLOWED],allowed_RETRY + allowed_FAIL + allowed_IGNORE 405 406 %ifndef BUF2 407 %IF BUFFERFLAG 408 pushf 409 cmp byte [ss:BUF_EMS_MODE], -1 410 je safe_write 411 save_map equ SAVE_MAP ; NASM port label 412 call save_map 413 restore_user_map equ RESTORE_USER_MAP ; NASM port label 414 call restore_user_map 415 safe_write: 416 popf 417 %ENDIF 418 %endif 419 0 00004308 E8[0000] invoke DWRITE 421 422 %ifndef BUF2 423 %IF BUFFERFLAG 424 pushf 425 cmp byte [ss:BUF_EMS_MODE], -1 426 je safe_map 427 save_user_map equ SAVE_USER_MAP ; NASM port label 428 call save_user_map 429 restore_map equ RESTORE_MAP ; NASM port label 430 call restore_map 431 safe_map: 432 popf 433 %ENDIF 434 %endif 435 0 0000430B 59 POP CX 0 0000430C 5B POP BX 0 0000430D 161F Context DS 0 0000430F 7247 JC SET_ACC_ERRW 0 00004311 E308 JCXZ WRTLAST 0 00004313 B200 MOV DL,0 0 00004315 FF06[0000] INC word [LASTPOS] ; We'll be using next cluster 0 00004319 EB9D JMP WRTLP 444 445 WRTLAST: 446 BYTCNT2 equ BytCnt2 ; NASM port label 0 0000431B A1[0000] MOV AX,[BYTCNT2] 0 0000431E 09C0 OR AX,AX 0 00004320 7413 JZ FINWRT 0 00004322 A3[0000] MOV [BYTCNT1],AX 0 00004325 E8[0000] invoke NEXTSEC 0 00004328 722E JC SET_ACC_ERRW 453 BYTSECPOS equ BytSecPos ; NASM port label 0 0000432A C706[0000]0000 MOV word [BYTSECPOS],0 0 00004330 E8[0000] invoke BUFWRT 0 00004333 7223 JC SET_ACC_ERRW 457 FINWRT: 0 00004335 C43E[0000] LES DI,[THISSFT] 459 Assert ISSFT,,"DiskWrite/FinWrt" 0 00004339 A1[0000] MOV AX,WORD PTR [GROWCNT] 0 0000433C 8B0E[0200] MOV CX,WORD PTR [GROWCNT+2] 0 00004340 09C0 OR AX,AX 463 UPDATE_size equ Update_size ; NASM port label 0 00004342 7502 JNZ UPDATE_size 0 00004344 E30F JCXZ SAMSIZ 466 Update_size: 0 00004346 26014511 ADD WORD PTR [ES:DI + sf_size],AX 0 0000434A 26114D13 ADC WORD PTR [ES:DI + sf_size+2],CX 469 ; 470 ; Make sure that all other SFT's see this growth also. 471 ; 0 0000434E B80100 MOV AX,1 473 %if installed 0 00004351 FF1E[3800] call far [JShare + 14 * 4] 475 %else 476 Call ShSU 477 %endif 478 SAMSIZ: 0 00004355 E9[0000] transfer SETCLUS ; ES:DI already points to SFT 480 481 SET_ACC_ERRW: 0 00004358 E9[0000] transfer SET_ACC_ERR_DS 483 484 WRTEOF: 0 0000435B 89C1 MOV CX,AX 0 0000435D 09D1 OR CX,DX 0 0000435F 7452 JZ KILLFIL 0 00004361 83E801 SUB AX,1 0 00004364 83DA00 SBB DX,0 490 0 00004367 53 PUSH BX 0 00004368 268B5E02 MOV BX,[ES:BP + dpb_sector_size] ;F.C. >32mb ;AN000; 0 0000436C E87F00 CALL DIV32 ;F.C. >32mb ;AN000; 0 0000436F 5B POP BX ;F.C. >32mb ;AN000; 0 00004370 E88A00 CALL SHR32 ;F.C. >32mb ;AN000; 496 497 498 ; SHR AX,CL 0 00004373 89C1 MOV CX,AX 0 00004375 E8[0000] invoke FNDCLUS 501 SET_ACC_ERRWJ2: 0 00004378 72DE JC SET_ACC_ERRW 503 ;;; 11/5/86 FastSeek 0 0000437A 8916[0000] MOV [FSeek_logclus],DX ; truncate clusters starting from DX 0 0000437E E8[0000] invoke FastSeek_Truncate 506 ;;; 11/5/86 FastSeek 0 00004381 E326 JCXZ RELFILE 0 00004383 E8[0000] invoke ALLOCATE 0 00004386 721E JC WRTERRJ ;;;;;;;;; disk full 510 UPDATE: 0 00004388 C43E[0000] LES DI,[THISSFT] 512 Assert ISSFT,,"DiskWrite/update" 0 0000438C A1[0000] MOV AX,WORD PTR [BYTPOS] 0 0000438F 26894511 MOV WORD PTR [ES:DI + sf_size],AX 0 00004393 A1[0200] MOV AX,WORD PTR [BYTPOS+2] 0 00004396 26894513 MOV WORD PTR [ES:DI + sf_size+2],AX 517 ; 518 ; Make sure that all other SFT's see this growth also. 519 ; 0 0000439A B80200 MOV AX,2 521 %if installed 0 0000439D FF1E[3800] Call far [JShare + 14 * 4] 523 %else 524 Call ShSU 525 %endif 0 000043A1 31C9 XOR CX,CX 0 000043A3 E9[0000] transfer ADDREC 528 0 000043A6 E95BFE WRTERRJ: JMP WRTERR 530 ;;;;;;;;;;;;;;;; 7/18/86 531 ;;;;;;;;;;;;;;;;; 532 RELFILE: 0 000043A9 BAFFFF MOV DX,0FFFFH 0 000043AC E8[0000] invoke RELBLKS 535 Set_Acc_ERRWJJ: 0 000043AF 72C7 JC SET_ACC_ERRWJ2 0 000043B1 EBD5 JMP SHORT UPDATE 538 539 KILLFIL: 0 000043B3 31DB XOR BX,BX 0 000043B5 06 PUSH ES 0 000043B6 C43E[0000] LES DI,[THISSFT] 543 assume es:nothing 544 Assert ISSFT,,"DiskWrite/KillFil" 0 000043BA 26895D19 MOV [ES:DI + sf_cluspos],BX 0 000043BE 26895D35 MOV [ES:DI + sf_lstclus],BX 0 000043C2 26875D0B XCHG BX,[ES:DI + sf_firclus] 0 000043C6 07 POP ES 549 assume es:nothing 550 ;; 11/5/86 FastSeek 0 000043C7 E8[0000] invoke Delete_FSeek ; delete fastseek entry 552 0 000043CA 09DB OR BX,BX 554 UPDATEJ equ UpDateJ ; NASM port label 0 000043CC 741E JZ UPDATEJ 556 ;; 10/23/86 FastOpen update 0 000043CE 06 PUSH ES ; since first cluster # is 0 0 000043CF 55 PUSH BP ; we must delete the old cache entry 0 000043D0 50 PUSH AX 0 000043D1 51 PUSH CX 0 000043D2 52 PUSH DX 0 000043D3 C42E[0000] LES BP,[THISDPB] ; get current DPB 563 assume es:DPB 0 000043D7 268A5600 MOV DL,[ES:BP + dpb_drive] ; get current drive 0 000043DB 89D9 MOV CX,BX ; first cluster # 0 000043DD B402 MOV AH,2 ; delete cache entry by drive:firclus 0 000043DF E8[0000] invoke FastOpen_Update ; call fastopen 0 000043E2 5A POP DX 0 000043E3 59 POP CX 0 000043E4 58 POP AX 0 000043E5 5D POP BP 0 000043E6 07 POP ES 573 assume es:nothing 574 ;; 10/23/86 FastOpen update 575 0 000043E7 E8[0000] invoke RELEASE 577 SET_ACC_ERRWJJ equ Set_Acc_ERRWJJ ; NASM port label 0 000043EA 72C3 JC SET_ACC_ERRWJJ 579 UpDateJ: 0 000043EC EB9A JMP UPDATE 581 EndProc DISKWRITE 582 583 584 585 Break 586 587 ; Inputs: 588 ; DX:AX = 32 bit dividend BX= divisor 589 ; Function: 590 ; Perform 32 bit division 591 ; Outputs: 592 ; [HIGH_SECTOR]:AX = quotiend , DX= remainder 593 594 procedure DIV32,NEAR 594 ****************** warning: proc DIV32... [-w+user] 595 ASSUME DS:NOTHING,ES:NOTHING 596 597 0 000043EE 50 PUSH AX ;F.C. >32mb ;AN000; 0 000043EF 89D0 MOV AX,DX ;F.C. >32mb ;AN000; 0 000043F1 31D2 XOR DX,DX ;F.C. >32mb ;AN000; 0 000043F3 F7F3 DIV BX ;F.C. >32mb ;AN000; 0 000043F5 36A3[0000] MOV [ss:HIGH_SECTOR],AX ;F.C. >32mb ;AN000; 0 000043F9 58 POP AX ;F.C. >32mb ;AN000; 604 605 0 000043FA F7F3 DIV BX ; AX=last sector accessed 0 000043FC C3 return 608 609 EndProc DIV32 610 611 Break 612 613 ; Inputs: 614 ; [HIGH_SECTOR]:AX = 32 bit sector number 615 ; Function: 616 ; Perform 32 bit shift right 617 ; Outputs: 618 ; AX= cluster number 619 620 procedure SHR32,NEAR 620 ****************** warning: proc SHR32... [-w+user] 621 ASSUME DS:NOTHING,ES:NOTHING 622 0 000043FD 31C9 xor cx, cx 0 000043FF 268A4E05 MOV CL,[ES:BP + dpb_cluster_shift] 625 entry ROTASHFT ;F.C. >32mb ;AN000; 0 00004403 E309 jcxz norota ;F.C. >32mb ;AN000; 627 ROTASHFT2: 0 00004405 36D12E[0000] shr word [ss:HIGH_SECTOR],1 ;F.C. >32mb ;AN000; 0 0000440A D1D8 RCR AX,1 ;F.C. >32mb ;AN000; 0 0000440C E2F7 LOOP ROTASHFT2 ;F.C. >32mb: ;AN000; 631 norota: 0 0000440E C3 return 633 634 EndProc SHR32 635 636 637 ; Issue File Handle Fail INT 24 Critical Error 638 ; Input: Disk_Full=0 ok 639 ; 1 disk full or EOF 640 ; Function: issue critical error for disk full or EOF error 641 ; 642 ; OutPut: carry clear , no I24 643 ; carry set, fail from I24 644 645 procedure File_Handle_Fail_Error,NEAR ;AN000; 645 ****************** warning: proc File_Handle_Fail_Error... [-w+user] 646 ASSUME ES:NOTHING,DS:NOTHING ;AN000; 647 ;AN000; 0 0000440F 36803E[0000]00 CMP byte [ss:DISK_FULL],0 ;MS. disk full or EOF ;AN000; 0 00004415 746D JZ Fexit ;MS. no ;AN000; 0 00004417 36F706[0000]4000 TEST word [ss:DOS34_FLAG],Disable_EOF_I24 ;MS. check input status ? ;AN000; 0 0000441E 7564 JNZ Fexit ;MS. yes ;AN000; 652 ;AN000; 0 00004420 36C43E[0000] LES DI,[ss:THISSFT] ;MS. get current SFT ;AN000; 654 ; LES DI,[ES:DI.sf_DEVPTR];MS. get device header ;AN000; 0 00004425 26F745050001 TEST word [ES:DI + sf_flags],Handle_Fail_I24 ;MS. gen I24 ? ;AN000; 0 0000442B 7457 JZ Fexit ;MS. no ;AN000; 0 0000442D 1E PUSH DS ;MS. save DS ;AN000; 0 0000442E F6C401 TEST AH,1 ;MS. READ ? ;AN000; 0 00004431 7409 JZ readeof ;MS. yes ;AN000; 660 error_Handle_Disk_Full equ error_handle_Disk_Full ; NASM port equate 0 00004433 36C706[0000]2700 MOV word [ss:EXTERR],error_Handle_Disk_Full ;MS. set extended error ;AN000; 0 0000443A EB07 JMP SHORT errset ;MS. set extended error ;AN000; 663 readeof: 664 error_Handle_EOF equ error_handle_EOF ; NASM port equate 0 0000443C 36C706[0000]2600 MOV word [ss:EXTERR],error_Handle_EOF ;MS. set extended error ;AN000; 666 errset: 0 00004443 36C606[0000]01 MOV byte [ss:EXTERR_CLASS],errCLASS_OutRes ;MS. set class ;AN000; 0 00004449 36C606[0000]04 MOV byte [ss:EXTERR_ACTION],errACT_Abort ;MS. set action ;AN000; 0 0000444F 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLOC_Unk ;MS. set locus ;AN000; 0 00004455 368C06[0200] MOV word ptr [ss:EXITHOLD + 2],ES ;MS. save es:bp in exithold ;AN000; 0 0000445A 36892E[0000] MOV word ptr [ss:EXITHOLD],BP ;MS. ;AN000; 0 0000445F 26F745058000 TEST word [ES:DI + sf_flags],devid_device ;MS. device ? ;AN000; 0 00004465 7509 JNZ chardev2 ;MS. yes ;AN000; 674 sf_DEVPTR equ sf_devptr ; NASM port equate 0 00004467 26C57507 LDS SI,[ES:DI + sf_DEVPTR] ;MS. get dpb ;AN000; 0 0000446B C57413 LDS SI,[SI + dpb_driver_addr] ;MS. get drive device haeder ;AN000; 0 0000446E EB04 JMP SHORT doi24 ;MS. gen I24 ? ;AN000; 678 chardev2: 0 00004470 26C57507 LDS SI,[ES:DI + sf_DEVPTR] ;MS. get chr dev header ;AN000; 680 doi24: 0 00004474 8CDD MOV BP,DS ;MS. bp:si -> device header ;AN000; 0 00004476 BF0C00 MOV DI,error_I24_gen_failure ;MS. general error ;AN000; 0 00004479 E8[0000] invoke NET_I24_ENTRY ;MS. issue I24 ;AN000; 0 0000447C F9 STC ;MS. must be fail ;AN000; 0 0000447D 1F POP DS ;MS. restore DS ;AN000; 686 assume ds:nothing 0 0000447E 36A1[0000] MOV AX,[ss:EXTERR] ;MS. set error ;AN000; 0 00004482 EB01 JMP SHORT Fend ;MS. exit ;AN000; 689 Fexit: ;AN000; 0 00004484 F8 CLC ;MS. clear carry ;AN000; 691 Fend: ;AN000; 0 00004485 C3 return ;MS. ;AN000; 693 ;AN000; 694 EndProc File_Handle_Fail_Error ;AN000; 695 696 697 Break 698 699 ; Inputs: 700 ; DS:DI -> buffer. AL= drive # 701 ; [HIGH_SECTOR]:DX = sector # 702 ; Function: 703 ; check if sector is in the buffer 704 ; Outputs: 705 ; carry clear= in the range 706 ; set = not in the range 707 708 procedure BUFF_RANGE_CHECK,NEAR 708 ****************** warning: proc BUFF_RANGE_CHECK... [-w+user] 709 ASSUME DS:NOTHING,ES:NOTHING 710 0 00004486 395508 CMP WORD PTR [DI + buf_sector],DX ;AN000; 0 00004489 750F JNZ DONEXTBUFF2 ; not this sector ;F.C. >32mb ;AN000; 0 0000448B 368B36[0000] MOV SI,[ss:HIGH_SECTOR] ;F.C. >32mb ;AN000; 0 00004490 39750A CMP WORD PTR [DI + buf_sector+2],SI ;F.C. >32mb ;AN000; 0 00004493 7505 JNZ DONEXTBUFF2 ; Not for this drive 0 00004495 3A4504 CMP AL,[DI + buf_ID] 0 00004498 7401 JZ secfound ; Buffer has the sector ;AN000; 718 DONEXTBUFF2: 0 0000449A F9 STC 720 secfound: 0 0000449B C3 return 722 723 EndProc BUFF_RANGE_CHECK 724 725 END 726 727 === Trace listing source: ../DOS/dir.lst 1 ; SCCSID = @(#)dir.asm 1.1 85/04/10 2 ; SCCSID = @(#)dir.asm 1.1 85/04/10 3 ;TITLE DIR - Directory and path cracking 4 ;NAME Dir 5 ; Main Path cracking routines, low level search routines 6 ; 7 ; FindEntry 8 ; SEARCH 9 ; Srch 10 ; NEXTENT 11 ; MetaCompare 12 ; dos_NEXTENTRY 13 ; GETENTRY 14 ; GETENT 15 ; SETDIRSRCH 16 ; SETROOTSRCH 17 ; 18 ; Revision history: 19 ; 20 ; A000 version 4.00 Jan. 1988 21 ; 22 23 ; 24 ; get the appropriate segment definitions 25 ; 26 [list -] 26 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 28 %include "fastopen.mac" 1 <1> ; 2 <1> ; EXPORT DATE: 9/11 3 <1> ;Equates for FASTOPEN. 4 <1> 5 <1> ;FASTOPEN NAME CACHING Subfunctions 6 <1> FONC_Look_up equ 1 7 <1> FONC_insert equ 2 8 <1> FONC_delete equ 3 9 <1> FONC_update equ 4 10 <1> FONC_purge equ 5 ;reserved for the future use. 11 <1> 12 <1> ;FASTOPEN EXTENT CACHING Subfunctions 13 <1> FSK_Open equ 11 ;AN000; 14 <1> FSK_Close equ 12 ;AN000; 15 <1> FSK_Delete equ 13 ;AN000; 16 <1> FSK_Lookup equ 14 ;AN000; 17 <1> FSK_Insert equ 15 ;AN000; 18 <1> FSK_Trunc equ 16 ;AN000; 19 <1> 20 <1> HeaderSize equ 8 ; size of file header (8 bytes) ;AN000; 21 <1> ExtendSize equ 8 ; size of extend (8 bytes) ;AN000; 22 <1> Num_Of_Pages equ 1 ; number of pages ;AN000; 23 <1> Num_Of_Segs equ 2 ; number of frame segments ;AN000; 24 <1> Stayresident equ 04ch ; terminate and stay resident function code 25 <1> 26 <1> 27 <1> ;Equates used in DOS. 28 <1> FastOpen_Set equ 00000001B 29 <1> FastOpen_Reset equ 11111110B 30 <1> Lookup_Success equ 00000010B 31 <1> Lookup_Reset equ 11111101B 32 <1> Special_Fill_Set equ 00000100B 33 <1> Special_Fill_Reset equ 11111011B 34 <1> No_Lookup equ 00001000B 35 <1> Set_For_Search equ 00010000B ;DCR 167 36 <1> 37 <1> 38 <1> ;============= FastOpen Data Structures ===================== 39 <1> 40 <1> Fastopen_Entry STRUC ;Fastopen Entry pointer in DOS 0 00001640 ???? Fastopen_Entry_size dw ? ;size of the following 0 00001642 ???????? Fastopen_Name_Caching dd ? 43 <1> ;Fastopen_FatChain_Caching dd ? ;reserved for future use 44 <1> Fastopen_Entry ENDS 45 <1> ; 46 <1> 47 <1> 48 <1> CMPCT_DIR_INFO STRUC ;compact version of Dir Info. 49 00000000 <1> CDI_file_name db 11 dup (?) 0 0000164B ?? CDI_file_attr db ? 0 0000164C ???? CDI_codepage dw ? 0 0000164E ???? CDI_extcluster dw ? 0 00001650 ?? CDI_attr2 db ? 0 00001651 ???? CDI_time dw ? 0 00001653 ???? CDI_date dw ? 0 00001655 ???? CDI_cluster dw ? 0 00001657 ???????? CDI_filesize dd ? 58 <1> CMPCT_DIR_INFO ENDS 59 <1> ; 60 <1> 61 <1> ORIG_DIR_INFO STRUC 62 00000000 <1> ODI_head db 17 dup (?) 0 00001651 ?????????? ODI_skip db 5 dup (?) ;reserved for DOS. FASTOPEN does not 64 00000016 <1> ODI_tail db 10 dup (?) ; use ODI_skip part. 65 <1> ORIG_DIR_INFO ENDS 66 <1> ; 67 <1> 68 <1> ODI_head_leng equ 17 69 <1> ODI_skip_leng equ 5 70 <1> ODI_tail_leng equ 10 71 <1> ; 72 <1> 73 <1> FASTOPEN_EXTENDED_INFO STRUC 0 00001640 ?? FEI_dirpos db ? 0 00001641 ???????? FEI_dirsec dd ? 0 00001645 ???? FEI_clusnum dw ? 0 00001647 ???? FEI_lastent dw ? ; for search first 0 00001649 ???? FEI_dirstart dw ? ; for search first 79 <1> FASTOPEN_EXTENDED_INFO ENDS 80 <1> ; 81 <1> 82 <1> NAME_RECORD STRUC 0 00001640 ???? nLRU_ptr dw ? 0 00001642 ???? nMRU_ptr dw ? ;reverse of nLRU_ptr 0 00001644 ???? nChild_ptr dw ? 0 00001646 ???? nSibling_ptr dw ? 0 00001648 ???? nBackward_ptr dw ? ;points to preceding node 88 <1> Cmpct_Dir_Info_struc_size equ CMPCT_DIR_INFO_struc_size ; NASM port equate 89 0000000A <1> nCmpct_Dir_Info db Cmpct_Dir_Info_struc_size dup (?) 90 <1> Fastopen_Extended_Info_struc_size equ FASTOPEN_EXTENDED_INFO_struc_size ; NASM port equate 91 00000025 <1> nExtended_Info db Fastopen_Extended_Info_struc_size dup (?) 92 <1> NAME_RECORD ENDS 93 <1> ; 94 <1> 95 <1> DRIVE_CACHE_HEADER STRUC ;drive cache header 0 00001640 ???? DCH_LRU_ROOT dw ? ;Header of the LRU chain of this drive 0 00001642 ???? DCH_MRU_ROOT dw ? ;offset to the last entry of LRU chain 0 00001644 ???? DCH_Child_ptr dw ? ;the first child in Name cache seg. 0 00001646 ???? DCH_Sibling_ptr dw ? ;points to the next drive cache header 0 00001648 ?? DCH_Drive_letter db ? ;drive letter 0 00001649 ???? DCH_Num_Entries dw ? ;Number of entries in the Name cache. 0 0000164B ???? DCH_Name_Buff dw ? ;pointer to name cahe buffer 103 <1> DRIVE_CACHE_HEADER ENDS 104 <1> ; 105 <1> 106 <1> 107 <1> 108 <1> 109 <1> 110 <1> ;======== FAST SEEK FUNCTION DATA STRUCTURES ======================= 111 <1> 112 <1> DRIVE_HEADER STRUC ; Drive header structure ;AN000; 0 00001640 ???? Drive_Number dw ? ; drive number ;AN000; 0 00001642 ???? Extent_Count dw ? ; reserved for debugging 0 00001644 ???? MRU_Hdr_Ptr dw ? ; pointer to OPEN Queue 0 00001646 ???? Free_ptr dw ? ; pointer to FREE buffer ;AN000; 0 00001648 ???? Close_Ptr dw ? ; pointer to CLOSE Queue ;AN000; 0 0000164A ???? Buff_Size dw ? ; cache buffer size including header ;AN000; 0 0000164C ???? Free_Size dw ? ; size of Free area in bytes 0 0000164E ???? Next_Drv_Hdr_Ptr dw ? ; pointer to next drive header 121 <1> DRIVE_HEADER ENDS 122 <1> 123 <1> 124 <1> 125 <1> FILE_HEADER STRUC ; File header structure ;AN000; 0 00001640 ???? FH_Phys_Clus_Num dw ? ; starting physcial clustnum of file ;AN000; 0 00001642 ???? FH_Refer_Count dw ? ; reference count ;AN000; 0 00001644 ???? FH_Next_Extn_Ptr dw ? ; pointer to first extent of the file;AN000; 0 00001646 ???? FH_Next_Hdr_Ptr dw ? ; pointer to next file header ;AN000; 0 00001648 ???? FH_MRU_Extn_Ptr dw ? ; pointer to MRU extent 0 0000164A ???? dw ? 0 0000164C ???? dw ? 0 0000164E ???? dw ? 134 <1> FILE_HEADER ENDS ;AN000; 135 <1> 136 <1> 137 <1> 138 <1> EXTENT_HEADER STRUC ; extend header structure ;AN000; 0 00001640 ???? EH_Logic_Clus_Num dw ? ; starting logical clus num of extent;AN000; 0 00001642 ???? EH_Phys_Clus_Num dw ? ; starting physical clus numof extnt;AN000; 0 00001644 ???? EH_Count dw ? ; range of logical clusnum in the extnt 0 00001646 ???? EH_Next_Extn_Ptr dw ? ; pointer to next extent ;AN000; 0 00001648 ???? EH_Prev_Extn_Ptr dw ? ; pointer to previous extent ;AN000; 0 0000164A ???? EH_Next_LRU_Ptr dw ? ; pointer to next LRU extent 0 0000164C ???? EH_Prev_LRU_Ptr dw ? ; pointer tp previous LRU extent 0 0000164E ???? dw ? 147 <1> EXTENT_HEADER ENDS 148 <1> 149 <1> 150 <1> 29 30 [list +] === Switch to base=002450h -> "DOSCODECODE" 31 section DOSCODECODE 32 [list -] 32 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 32 ****************** warning: out: BPB.INC... [-w+user] 32 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 38 39 %ifndef Kanji 40 %iassign Kanji 0 41 %endif 42 43 i_need EntFree,WORD 44 i_need DirStart,WORD 45 i_need LastEnt,WORD 46 i_need ClusNum,WORD 47 i_need CurBuf,DWORD 48 i_need Attrib,BYTE 49 i_need DelAll,BYTE 50 i_need VolID,BYTE 51 i_need Name1,BYTE 52 i_need ThisDPB,DWORD 53 i_need EntLast,WORD 54 i_need Creating,BYTE 55 i_need SecClusPos,BYTE 56 i_need ClusFac,BYTE 57 i_need Cluster_Factor_EDR,WORD 58 i_need NxtClusNum,WORD 59 i_need DirSec,DWORD ;AN000; 60 I_need FastOpenFlg,BYTE ;AN000; 61 I_need HIGH_SECTOR,WORD ;AN000; 62 63 assume nocheck, ss:DOSGROUP 64 65 Break 66 67 ; Inputs: 68 ; [THISDPB] set 69 ; [SECCLUSPOS] = 0 70 ; [DIRSEC] = Starting directory sector number 71 ; [CLUSNUM] = Next cluster of directory 72 ; [CLUSFAC] = Sectors/Cluster 73 ; [NAME1] = Name to look for 74 ; Function: 75 ; Find file name in disk directory. 76 ; "?" matches any character. 77 ; Outputs: 78 ; Carry set if name not found 79 ; ELSE 80 ; Zero set if attributes match (always except when creating) 81 ; AH = Device ID (bit 7 set if not disk) 82 ; [THISDPB] = Base of drive parameters 83 ; DS = DOSGROUP 84 ; ES = DOSGROUP 85 ; [CURBUF+2]:BX = Pointer into directory buffer 86 ; [CURBUF+2]:SI = Pointer to First Cluster field in directory entry 87 ; [CURBUF] has directory record with match 88 ; [NAME1] has file name 89 ; [LASTENT] is entry number of the entry 90 ; All other registers destroyed. 91 92 procedure SEARCH,near 92 ****************** warning: proc SEARCH... [-w+user] 93 94 entry FindEntry 95 DOSAssume CS,,"FindEntry" 96 ASSUME ES:NOTHING 97 0 0000449C E8[0000] invoke STARTSRCH 0 0000449F A0[0000] MOV AL,[Attrib] 0 000044A2 249E AND AL,~ attr_ignore ; Ignore useless bits 0 000044A4 3C08 CMP AL,attr_volume_id ; Looking for vol ID only ? 0 000044A6 7503 JNZ NOTVOLSRCH ; No 0 000044A8 E88F01 CALL SETROOTSRCH ; Yes force search of root 104 NOTVOLSRCH: 0 000044AB E81601 CALL GETENTRY 0 000044AE 7303 JNC Srch 0 000044B0 E9A000 JMP SETESRET 108 109 entry Srch 110 0 000044B3 1E PUSH DS 112 CURBUF equ CurBuf ; NASM port label 0 000044B4 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 114 ASSUME DS:NOTHING 0 000044B8 8A27 MOV AH,BYTE PTR [BX] 0 000044BA 08E4 OR AH,AH ; End of directory? 0 000044BC 7440 JZ FREE 118 DELALL equ DelAll ; NASM port label 0 000044BE 363A26[0000] CMP AH,BYTE PTR [ss:DELALL] ; Free entry? 0 000044C3 7439 JZ FREE 0 000044C5 F6470B08 TEST BYTE PTR [BX+11],attr_volume_id 122 ; Volume ID file? 0 000044C9 740B JZ CHKFNAM ; NO 0 000044CB F6470BD7 test byte [bx + 11], ~ (attr_volume_id | attr_archive) 0 000044CF 7505 jnz CHKFNAM ; possible LFN ? then skip --> 126 VOLID equ VolID ; NASM port label 0 000044D1 36FE06[0000] INC BYTE PTR [ss:VOLID] 128 CHKFNAM: 129 ; Context ES 0 000044D6 8CD6 MOV SI,SS 0 000044D8 8EC6 MOV ES,SI 132 ASSUME ES:DOSGroup 0 000044DA 89DE MOV SI,BX 134 NAME1 equ Name1 ; NASM port label 0 000044DC BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP 136 ;;;;; 7/29/86 0 000044DF 36803E[0000]E5 CMP BYTE PTR [ss:NAME1],0E5H ; special char check 0 000044E5 7506 JNZ NO_E5 0 000044E7 36C606[0000]05 MOV BYTE PTR [ss:NAME1],05H 140 NO_E5: 141 ;;;;; 7/29/86 0 000044ED E86600 CALL MetaCompare 0 000044F0 7428 JZ FOUND 0 000044F2 1F POP DS 145 assume ds:DOSGROUP 146 147 entry NEXTENT 148 DOSAssume CS,,"NextEnt" 149 150 Assert ISDPB,<,>,"NextEnt" 151 THISDPB equ ThisDPB ; NASM port label 0 000044F3 C42E[0000] LES BP,[THISDPB] 153 ASSUME ES:NOTHING 154 dos_NEXTENTRY equ dos_NextEntry ; NASM port label 0 000044F7 E86B00 CALL dos_NEXTENTRY 156 SRCH equ Srch ; NASM port label 0 000044FA 73B7 JNC SRCH 0 000044FC EB55 JMP SHORT SETESRET 159 160 FREE: 0 000044FE 1F POP DS 162 DOSAssume CS,,"DIR/Free" 163 LASTENT equ LastEnt ; NASM port label 0 000044FF 8B0E[0000] MOV CX,[LASTENT] 165 ENTFREE equ EntFree ; NASM port label 0 00004503 3B0E[0000] CMP CX,[ENTFREE] 0 00004507 7304 JAE TSTALL 0 00004509 890E[0000] MOV [ENTFREE],CX 169 TSTALL: 0 0000450D 3A26[0000] CMP AH,BYTE PTR [DELALL] ; At end of directory? 171 NextEntJ: 0 00004511 74E0 JZ NEXTENT ; No - continue search 173 ENTLAST equ EntLast ; NASM port label 0 00004513 890E[0000] MOV [ENTLAST],CX 0 00004517 F9 STC 0 00004518 EB39 JMP SHORT SETESRET 177 178 FOUND: 179 ; 180 ; We have a file with a matching name. We must now consider the attributes: 181 ; ATTRIB Action 182 ; ------ ------ 183 ; Volume_ID Is Volume_ID in test? 184 ; Otherwise If no create then Is ATTRIB+extra superset of test? 185 ; If create then Is ATTRIB equal to test? 186 ; 0 0000451A 8A2C MOV CH,[SI] ; Attributes of file 0 0000451C 1F POP DS 189 DOSAssume CS,,"DIR/found" 0 0000451D 8A26[0000] MOV AH,[Attrib] ; Attributes of search 0 00004521 80E49E AND AH,~ attr_ignore 192 Dir_First equ dir_first ; NASM port equate 193 Dir_Attr equ dir_attr ; NASM port equate 0 00004524 8D740F LEA SI,[SI+Dir_First-Dir_Attr] ; point to firclus field 0 00004527 F6C508 TEST CH,attr_volume_id ; Volume ID file? 0 0000452A 740E JZ check_one_volume_id ; Nope check other attributes 0 0000452C F6C408 TEST AH,attr_volume_id ; Can we find Volume ID? 198 NEXTENTJ equ NextEntJ ; NASM port label 0 0000452F 74E0 JZ NEXTENTJ ; Nope, (not even $FCB_CREATE) 0 00004531 F6C5D7 test ch, ~ (attr_volume_id | attr_archive) 201 ; possible LFN ? 0 00004534 75BD jnz NEXTENT ; yes, skip --> 0 00004536 30E4 XOR AH,AH ; Set zero flag for $FCB_CREATE 0 00004538 EB11 JMP SHORT RETFF ; Found Volume ID 205 check_one_volume_id: 0 0000453A 80FC08 CMP AH,attr_volume_id ; Looking only for Volume ID? 0 0000453D 74D2 JZ NEXTENTJ ; Yes, continue search 0 0000453F E8[0000] invoke MatchAttributes 0 00004542 7407 JZ RETFF 210 CREATING equ Creating ; NASM port label 0 00004544 F606[0000]FF TEST BYTE PTR [CREATING],-1 ; Pass back mismatch if creating 0 00004549 74C6 JZ NEXTENTJ ; Otherwise continue searching 213 RETFF: 0 0000454B C42E[0000] LES BP,[THISDPB] 0 0000454F 268A6600 MOV AH,[ES:BP + dpb_drive] 216 SETESRET: 0 00004553 16 PUSH SS 0 00004554 07 POP ES 219 assume es:DOSGROUP 0 00004555 C3 return 221 EndProc Search 222 223 ; Inputs: 224 ; DS:SI -> 11 character FCB style name NO '?' 225 ; Typically this is a directory entry. It MUST be in upper case 226 ; ES:DI -> 11 character FCB style name with possible '?' 227 ; Typically this is a FCB or SFT. It MUST be in upper case 228 ; Function: 229 ; Compare FCB style names allowing for ? match to any char 230 ; Outputs: 231 ; Zero if match else NZ 232 ; Destroys CX,SI,DI all others preserved 233 234 procedure MetaCompare,near 234 ****************** warning: proc MetaCompare... [-w+user] 235 ASSUME DS:NOTHING,ES:NOTHING 0 00004556 B90B00 MOV CX,11 237 %IF DBCS ;AN000; 238 ;-------------------- Start of DBCS ;AN000; 239 CMP BYTE PTR [SI],05H ;AN000;; Special case for lead byte of 05h 240 JNE WILDCRD2 ;AN000;; Compare as normal if not an 05h 241 CMP BYTE PTR [ES:DI],0E5H ;AN000;; 05h and 0E5h equivalent for lead byte 242 JNE WILDCRD2 ;AN000;; Compare as normal if not an 05h 243 DEC CX ;AN000;; One less byte to compare 244 INC SI ;AN000;; Bypass lead byte in source and 245 INC DI ;AN000;; destination when 05h and 0E5h found. 246 WILDCRD2: ;AN000; 247 PUSH AX ;AN000;;KK. save ax 248 cagain: ;AN000;;KK. 249 CMP CX,0 ;AN000;;KK. end of compare ? 250 JLE metaend2 ;AN000;;KK. yes 251 MOV AL,[SI] ;AN000;;KK. is it a Kanji 252 invoke testkanj ;AN000;;KK. 253 JZ notdb ;AN000;;KK. no 254 MOV AX,'??' ;AN000;;KK. 255 CMP [ES:DI],AX ;AN000;;KK. is es:di pointing to '??' 256 JNZ metaend3 ;AN000;;KK. no 257 ADD SI,2 ;AN000;;KK. 258 ADD DI,2 ;AN000;;KK. update pointers and count 259 subcx: ;AN000; 260 SUB CX,2 ;AN000;;KK. 261 JMP cagain ;AN000;;KK. 262 metaend3: ;AN000;;KK. 263 CMPSW ;AN000;;KK. 264 JNZ metaend2 ;AN000;;KK. 265 JMP subcx ;AN000;;KK. 266 notdb: ;AN000; 267 CMPSB ;AN000;;KK. same code ? 268 JZ sameco ;AN000;;KK. yes 269 CMP BYTE PTR [ES:DI-1],"?" ;AN000;;KK. ? 270 JNZ metaend2 ;AN000;;KK. no 271 sameco: ;AN000; 272 DEC CX ;AN000;;KK. decrement count 273 JMP cagain ;AN000;;KK. 274 275 metaend2: ;AN000; 276 POP AX ;AN000;;KK. 277 ;-------------------- End of DBCS ;AN000; KK. 278 %ELSE ;AN000; 279 WILDCRD: 0 00004559 F3A6 REPE CMPSB 0 0000455B 7407 JZ MetaRet ; most of the time we will fail. 282 CHECK_META: 0 0000455D 26807DFF3F CMP BYTE PTR [ES:DI-1],"?" 284 WildCrd equ WILDCRD ; NASM port label 0 00004562 74F5 JZ WildCrd 286 MetaRet: 287 %ENDIF ;AN000; 0 00004564 C3 return ; Zero set, Match 289 EndProc MetaCompare 290 291 Break 292 293 ; Inputs: 294 ; Same as outputs of GETENTRY, above 295 ; Function: 296 ; Update BX, and [LASTENT] for next directory entry. 297 ; Carry set if no more. 298 299 Procedure dos_NextEntry 299 ****************** warning: proc dos_NextEntry... [-w+user] 300 DOSAssume CS,,"dos_NextEntry" 301 ASSUME ES:NOTHING 302 0 00004565 A1[0000] MOV AX,[LASTENT] 0 00004568 3B06[0000] CMP AX,[ENTLAST] 0 0000456C 7426 JZ NONE 0 0000456E 40 INC AX 0 0000456F 8D5F20 LEA BX,[BX+32] 0 00004572 39D3 CMP BX,DX 0 00004574 7220 JB HAVIT 0 00004576 B700 mov bh, 0 311 SECCLUSPOS equ SecClusPos ; NASM port label 0 00004578 8A1E[0000] MOV BL,BYTE PTR [SECCLUSPOS] 0 0000457C 43 inc bx 314 CLUSTER_FACTOR_EDR equ Cluster_Factor_EDR ; NASM port label 0 0000457D 3B1E[0000] cmp bx, word ptr [CLUSTER_FACTOR_EDR] 0 00004581 7218 JB SAMECLUS 317 NXTCLUSNUM equ NxtClusNum ; NASM port label 0 00004583 8B1E[0000] MOV BX,[NXTCLUSNUM] 0 00004587 E8[0000] Invoke IsEOF 0 0000458A 7308 JAE NONE 0 0000458C 83FB02 CMP BX,2 0 0000458F 7203 JB NONE 0 00004591 EB34 JMP GETENT 0 00004593 90 nop ; identicalise 325 326 NONE: 0 00004594 F9 STC 0 00004595 C3 return 329 330 HAVIT: 0 00004596 A3[0000] MOV [LASTENT],AX 0 00004599 F8 CLC 0 0000459A C3 return 334 335 SAMECLUS: 0 0000459B 881E[0000] MOV BYTE PTR [SECCLUSPOS],BL 0 0000459F A3[0000] MOV [LASTENT],AX 0 000045A2 1E PUSH DS 0 000045A3 C53E[0000] LDS DI,[CURBUF] 340 ASSUME DS:NOTHING 0 000045A7 8B550A MOV DX,WORD PTR [DI + buf_sector+2] ;AN000; >32mb 0 000045AA 368916[0000] MOV [ss:HIGH_SECTOR],DX ;AN000; >32mb 0 000045AF 8B5508 MOV DX,WORD PTR [DI + buf_sector] ;AN000; >32mb 344 0 000045B2 83C201 ADD DX,1 ;AN000; >32mb 0 000045B5 368316[0000]00 ADC word [ss:HIGH_SECTOR],0 ;AN000; >32mb 0 000045BB 1F POP DS 348 DOSAssume CS,,"DIR/SameClus" 0 000045BC E8[0000] invoke FIRSTCLUSTER 0 000045BF 31DB XOR BX,BX 0 000045C1 EB25 JMP SETENTRY 0 000045C3 90 nop ; identicalise 353 EndProc dos_NextEntry 354 355 ; Inputs: 356 ; [LASTENT] has directory entry 357 ; ES:BP points to drive parameters 358 ; [DIRSEC],[CLUSNUM],[CLUSFAC],[ENTLAST] set for DIR involved 359 ; Function: 360 ; Locates directory entry in preparation for search 361 ; GETENT provides entry for passing desired entry in AX 362 ; Outputs: 363 ; [CURBUF+2]:BX = Pointer to next directory entry in CURBUF 364 ; [CURBUF+2]:DX = Pointer to first byte after end of CURBUF 365 ; [LASTENT] = New directory entry number 366 ; [NXTCLUSNUM],[SECCLUSPOS] set via DIRREAD 367 ; Carry set if error (currently user FAILed to I 24) 368 369 Procedure GETENTRY,NEAR 369 ****************** warning: proc GETENTRY... [-w+user] 370 DOSAssume CS,,"GetEntry" 371 ASSUME ES:NOTHING 372 0 000045C4 A1[0000] MOV AX,[LASTENT] 374 375 entry GETENT 376 377 Assert ISDPB,,"GetEntry/GetEnt" 0 000045C7 A3[0000] MOV [LASTENT],AX 379 ; 380 ; Convert the entry number in AX into a byte offset from the beginning of the 381 ; directory. 382 ; 0 000045CA B105 mov cl,5 ; shift left by 5 = mult by 32 0 000045CC D3C0 rol ax,cl ; keep hight order bits 0 000045CE 89C2 mov dx,ax 0 000045D0 83E0E0 and ax, ~ (32-1) ; mask off high order bits 0 000045D3 83E21F and dx, 32-1 ; mask off low order bits 388 ; 389 ; DX:AX contain the byte offset of the required directory entry from the 390 ; beginning of the directory. Convert this to a sector number. Round the 391 ; sector size down to a multiple of 32. 392 ; 0 000045D6 268B5E02 MOV BX,[ES:BP + dpb_sector_size] 0 000045DA 80E3E0 AND BL,255-31 ; Must be multiple of 32 0 000045DD F7F3 DIV BX 0 000045DF 89D3 MOV BX,DX ; Position within sector 0 000045E1 53 PUSH BX 0 000045E2 E8[0000] invoke DIRREAD 0 000045E5 5B POP BX 0 000045E6 72B2 retc 401 SETENTRY: 0 000045E8 8B16[0000] MOV DX,WORD PTR [CURBUF] 0 000045EC 83C210 ADD DX,BUFINSIZ 0 000045EF 01D3 ADD BX,DX 0 000045F1 26035602 ADD DX,[ES:BP + dpb_sector_size] ; Always clears carry 0 000045F5 C3 return 407 EndProc GetEntry 408 409 Break 410 411 ; Inputs: 412 ; BX cluster number of start of directory 413 ; ES:BP Points to DPB 414 ; DI next cluster number from fastopen extended info. DOS 3.3 only 415 ; Function: 416 ; Set up a directory search 417 ; Outputs: 418 ; [DIRSTART] = BX 419 ; [CLUSFAC],[CLUSNUM],[SECCLUSPOS],[DIRSEC] set 420 ; Carry set if error (currently user FAILed to I 24) 421 ; destroys AX,DX,BX 422 423 procedure SETDIRSRCH 423 ****************** warning: proc SETDIRSRCH... [-w+user] 424 DOSAssume CS,,"SetDirSrch" 425 ASSUME ES:NOTHING 426 427 Assert ISDPB,,"SetDirSrch" 0 000045F6 09DB OR BX,BX 0 000045F8 7440 JZ SETROOTSRCH 430 DIRSTART equ DirStart ; NASM port label 0 000045FA 891E[0000] MOV [DIRSTART],BX 0 000045FE 31C0 xor ax, ax 0 00004600 268A4604 MOV AL,[ES:BP + dpb_cluster_mask] 0 00004604 40 inc ax 435 CLUSFAC equ ClusFac ; NASM port label 0 00004605 A2[0000] MOV BYTE PTR [CLUSFAC],AL 0 00004608 A3[0000] mov word ptr [CLUSTER_FACTOR_EDR], ax 438 ; DOS 3.3 for FastOPen F.C. 6/12/86 0 0000460B 56 SaveReg 0 0000460C F606[0000]02 TEST byte [FastOpenFlg],Lookup_Success 0 00004611 7507 JNZ UNP_OK 442 443 ; DOS 3.3 for FastOPen F.C. 6/12/86 0 00004613 E8[0000] invoke UNPACK 0 00004616 7302 JNC UNP_OK 0 00004618 5E RestoreReg 0 00004619 C3 return 448 449 UNP_OK: 450 CLUSNUM equ ClusNum ; NASM port label 0 0000461A 893E[0000] MOV [CLUSNUM],DI 0 0000461E 89DA MOV DX,BX 0 00004620 30DB XOR BL,BL 0 00004622 881E[0000] MOV BYTE PTR [SECCLUSPOS],BL 0 00004626 E8[0000] invoke FIGREC 0 00004629 5E RestoreReg 0 0000462A 52 PUSH DX ;AN000; >32mb 0 0000462B 8B16[0000] MOV DX,[HIGH_SECTOR] ;AN000; >32mb 459 DIRSEC equ DirSec ; NASM port label 0 0000462F 8916[0200] MOV WORD PTR [DIRSEC+2],DX ;AN000; >32mb 0 00004633 5A POP DX ;AN000; >32mb 0 00004634 8916[0000] MOV WORD PTR [DIRSEC],DX 0 00004638 F8 CLC 0 00004639 C3 return 465 466 entry SETROOTSRCH 467 DOSAssume CS,,"SetRootSrch" 468 ASSUME ES:NOTHING 0 0000463A 31C0 XOR AX,AX 0 0000463C A3[0000] MOV [DIRSTART],AX 0 0000463F A2[0000] MOV BYTE PTR [SECCLUSPOS],AL 0 00004642 48 DEC AX 0 00004643 A3[0000] MOV [CLUSNUM],AX 0 00004646 268B460B MOV AX,[ES:BP + dpb_first_sector] 0 0000464A 268B5611 MOV DX,[ES:BP + dpb_dir_sector] 0 0000464E 29D0 SUB AX,DX 0 00004650 A2[0000] MOV BYTE PTR [CLUSFAC],AL 0 00004653 A3[0000] mov word ptr [CLUSTER_FACTOR_EDR], ax 0 00004656 8916[0000] MOV WORD PTR [DIRSEC],DX ;F.C. >32mb 0 0000465A 8326[0200]00 and WORD PTR [DIRSEC+2],0 ;F.C. >32mb 481 ; NC from and 0 0000465F C3 return 483 EndProc SETDIRSRCH 483 ****************** warning: ***** Possible stack size error in SETDIRSRCH ***** [-w+user] 484 485 END === Trace listing source: ../DOS/dir2.lst 1 ; SCCSID = @(#)dir2.asm 1.2 85/07/23 2 ; SCCSID = @(#)dir2.asm 1.2 85/07/23 3 ;TITLE DIR2 - Directory and path cracking 4 ;NAME Dir2 5 ; Main Path cracking routines, low level search routines and device 6 ; name detection routines 7 ; 8 ; GETPATH 9 ; GetPathNoSet 10 ; CHKDEV 11 ; ROOTPATH 12 ; FINDPATH 13 ; StartSrch 14 ; MatchAttributes 15 ; DEVNAME 16 ; Build_device_ent 17 ; Validate_CDS 18 ; CheckThisDevice 19 ; 20 ; Revision history: 21 ; 22 ; A000 version 4.00 Jan. 1988 23 ; A001 PTM 3564 -- search using fastopen 24 25 ; 26 ; get the appropriate segment definitions 27 ; 28 [list -] 28 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 30 31 [list +] === Switch to base=002450h -> "DOSCODECODE" 32 section DOSCODECODE 33 [list -] 33 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 33 ****************** warning: out: BPB.INC... [-w+user] 33 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 33 ****************** warning: out: DEVSYM.INC... [-w+user] 41 42 %ifndef Kanji 43 %iassign Kanji 0 44 %endif 45 46 i_need NoSetDir,BYTE 47 i_need EntFree,WORD 48 i_need DirStart,WORD 49 i_need LastEnt,WORD 50 i_need WFP_START,WORD 51 i_need CURR_DIR_END,WORD 52 i_need CurBuf,DWORD 53 i_need THISCDS,DWORD 54 i_need Attrib,BYTE 55 i_need SAttrib,BYTE 56 i_need VolID,BYTE 57 i_need Name1,BYTE 58 i_need ThisDPB,DWORD 59 i_need EntLast,WORD 60 i_need Creating,BYTE 61 i_need NULDEV,DWORD 62 i_need DEVPT,DWORD 63 i_need DEVFCB,BYTE 64 i_need ALLOWED,BYTE 65 i_need EXTERR_LOCUS,BYTE 66 I_need FastOpenFlg,BYTE ;DOS 3.3 67 I_need FastOpenTable,BYTE ;DOS 3.3 68 I_need Dir_Info_Buff,BYTE ;DOS 3.3 69 I_need FastOpen_Ext_Info,BYTE ;DOS 3.3 70 I_need CLUSNUM,WORD ;DOS 3.3 71 I_need Next_Element_Start,WORD ;DOS 3.3 72 I_need HIGH_SECTOR,WORD ;AN000;>32mb 73 I_need DOS34_FLAG,WORD ;AN000;>32mb 74 75 76 assume nocheck, ss:DOSGROUP 77 78 Break 79 80 ; Inputs: 81 ; [WFP_START] Points to WFP string ("d:\" must be first 3 chars, NUL 82 ; terminated; d:/ (note forward slash) indicates a real device). 83 ; [CURR_DIR_END] Points to end of Current dir part of string 84 ; ( = -1 if current dir not involved, else 85 ; Points to first char after last "/" of current dir part) 86 ; [THISCDS] Points to CDS being used 87 ; [SATTRIB] Is attribute of search, determines what files can be found 88 ; [NoSetDir] set 89 ; [THISDPB] set to DPB if disk otherwise garbage. 90 ; Function: 91 ; Crack the path 92 ; Outputs: 93 ; Sets EXTERR_LOCUS = errLOC_Disk if disk file 94 ; Sets EXTERR_LOCUS = errLOC_Unk if char device 95 ; ID1 field of [THISCDS] updated appropriately 96 ; [ATTRIB] = [SATTRIB] 97 ; ES:BP Points to DPB 98 ; Carry set if bad path 99 ; SI Points to path element causing failure 100 ; Zero set 101 ; [DIRSTART],[DIRSEC],[CLUSNUM], and [CLUSFAC] are set up to 102 ; start a search on the last directory 103 ; CL is zero if there is a bad name in the path 104 ; CL is non-zero if the name was simply not found 105 ; [ENTFREE] may have free spot in directory 106 ; [NAME1] is the name. 107 ; CL = 81H if '*'s or '?' in NAME1, 80H otherwise 108 ; Zero reset 109 ; File in middle of path or bad name in path or attribute mismatch 110 ; or path too long or malformed path 111 ; ELSE 112 ; [CurBuf] = -1 if root directory 113 ; [CURBUF] contains directory record with match 114 ; [CURBUF+2]:BX Points into [CURBUF] to start of entry 115 ; [CURBUF+2]:SI Points into [CURBUF] to dir_first field for entry 116 ; AH = device ID 117 ; bit 7 of AH set if device SI and BX 118 ; will point DOSGROUP relative The firclus 119 ; field of the device entry contains the device pointer 120 ; [NAME1] Has name looked for 121 ; If last element is a directory zero is set and: 122 ; [DIRSTART],[SECCLUSPOS],[DIRSEC],[CLUSNUM], and [CLUSFAC] 123 ; are set up to start a search on it. 124 ; unless [NoSetDir] is non zero in which case the return is 125 ; like that for a file (except for zero flag) 126 ; If last element is a file zero is reset 127 ; [DIRSEC],[CLUSNUM],[CLUSFAC],[NXTCLUSNUM],[SECCLUSPOS], 128 ; [LASTENT], [ENTLAST] are set to continue search of last 129 ; directory for furthur matches on NAME1 via the NEXTENT 130 ; entry point in FindEntry (or GETENT entry in GETENTRY in 131 ; which case [NXTCLUSNUM] and [SECCLUSPOS] need not be valid) 132 ; DS preserved, Others destroyed 133 134 procedure GETPATH,near 134 ****************** warning: proc GETPATH... [-w+user] 135 DOSAssume CS,,"GetPath" 136 ASSUME ES:NOTHING 137 138 CREATING equ Creating ; NASM port label 0 00004660 C706[0000]00E5 MOV WORD PTR [CREATING],0E500H ; Not Creating, not DEL *.* 140 141 ;Same as GetPath only CREATING and DELALL already set 142 entry GetPathNoSet 0 00004666 C606[0000]02 MOV byte [EXTERR_LOCUS],errLOC_Disk 0 0000466B C706[0000]FFFF MOV WORD [CurBuf],-1 ; initial setting 145 ; 146 ; See if the input indicates a device that has already been detected. If so, 147 ; go build the guy quickly. Otherwise, let findpath find the device. 148 ; 149 Wfp_Start equ WFP_START ; NASM port label 0 00004671 8B3E[0000] MOV DI,[Wfp_Start] ; point to the beginning of the name 0 00004675 817D013A5C CMP WORD PTR [DI+1],('\' << 8) + ':' 0 0000467A 743A JZ CrackIt 153 ; 154 ; Let ChkDev find it in the device list 155 ; 0 0000467C 83C703 ADD DI,3 0 0000467F 89FE MOV SI,DI ; let CHKDEV see the original name 158 CHKDEV equ ChkDev ; NASM port label 0 00004681 E8B400 CALL CHKDEV 0 00004684 722E JC InternalError 161 Build_devJ: 0 00004686 A0[0000] MOV AL,[SAttrib] 0 00004689 A2[0000] MOV [Attrib],AL 0 0000468C C606[0000]01 MOV byte [EXTERR_LOCUS],errLOC_Unk ; In the particular case of 165 ; "finding" a char device 166 ; set LOCUS to Unknown. This makes 167 ; certain idiotic problems reported 168 ; by a certain 3 letter OEM go away. 169 ; 170 ; Take name in name1 and pack it back into where wfp_start points. This 171 ; guarantees wfp_start pointing to a canonical representation of a device. 172 ; We are allowed to do this as GetPath is *ALWAYS* called before entering a 173 ; wfp into the share set. 174 ; 175 ; We copy chars from name1 to wfp_start remembering the position of the last 176 ; non-space seen +1. This position is kept in DX. 177 ; 0 00004691 1607 Context ES 179 DOSGroup equ DOSGROUP ; NASM port equate 0 00004693 BE[0000] mov si,offset Name1 wrt DOSGroup 181 wfp_start equ WFP_START ; NASM port label 0 00004696 8B3E[0000] mov di,[wfp_start] 0 0000469A 89FA mov dx,di 0 0000469C B90800 mov cx,8 ; 8 chars in device name 185 MoveLoop: 0 0000469F AC lodsb 0 000046A0 AA stosb 0 000046A1 3C20 cmp al," " 189 nosave equ NoSave ; NASM port label 0 000046A3 7402 jz nosave 191 %IF DBCS ;AN000;; 192 ; cmp al,81h ;AN000;; 2/23/KK 193 ; jne notKanji ;AN000;; 2/23/KK 194 ; cmp cx,1 ;AN000; 2/23/KK 195 ; je notKanji ;AN000; 2/23/KK 196 ; cmp byte ptr [si],40h ;AN000; 2/23/KK 197 ; jne notKanji ;AN000;; 2/23/KK 198 ; lodsb ;AN000;; 2/23/KK 199 ; stosb ;AN000;; 2/23/KK 200 ; dec cx ;AN000;; 2/23/KK 201 ; jmp nosave ;AN000;; 2/23/KK 202 ;notKanji: ;AN000;; 2/23/KK 203 %ENDIF 0 000046A5 89FA mov dx,di 205 NoSave: 0 000046A7 E2F6 loop MoveLoop 207 ; 208 ; DX is the position of the last seen non-space + 1. We terminate the name 209 ; at this point. 210 ; 0 000046A9 89D7 mov di,dx 0 000046AB C60500 mov byte ptr [di],0 ; end of string 0 000046AE E8DE02 invoke Build_device_ent ; Clears carry sets zero 0 000046B1 FEC0 INC AL ; reset zero 0 000046B3 C3 return 216 217 assume es:nothing 218 219 InternalError: 0 000046B4 EBFE JMP InternalError ; freeze 221 222 ; 223 ; Start off at the correct spot. Optimize if the current dir part is valid. 224 ; 225 CrackIt: 0 000046B6 8B36[0000] MOV SI,[CURR_DIR_END] ; get current directory pointer 0 000046BA 83FEFF CMP SI,-1 ; valid? 0 000046BD 7503 JNZ LOOK_SING ; Yes, use it. 0 000046BF 8D7503 LEA SI,[DI+3] ; skip D:\. 230 LOOK_SING: 231 Assert ISDPB,<,>,"Crackit" 0 000046C2 C606[0000]16 MOV byte [Attrib],attr_directory+attr_system+attr_hidden 233 ; Attributes to search through Dirs 0 000046C7 C43E[0000] LES DI,[THISCDS] 235 assume es:nothing 0 000046CB B8FFFF MOV AX,-1 0 000046CE 268B5D49 MOV BX,[ES:DI + curdir_ID] 0 000046D2 8B36[0000] MOV SI,[CURR_DIR_END] 239 ; 240 ; AX = -1 241 ; BX = cluster number of current directory. THis number is -1 if the media 242 ; has been uncertainly changed. 243 ; SI = offset in DOSGroup into path to end of current directory text. This 244 ; may be -1 if no current directory part has been used. 245 ; 0 000046D6 39C6 CMP SI,AX ; if Current directory is not part 0 000046D8 7440 JZ NO_CURR_D ; then we must crack from root 0 000046DA 39C3 CMP BX,AX ; is the current directory cluster valid 249 250 ; DOS 3.3 6/25/86 0 000046DC 743C JZ NO_CURR_D ; no, crack form the root 0 000046DE F606[0000]01 TEST byte [FastOpenFlg],FastOpen_Set ; for fastopen ? 0 000046E3 7443 JZ GOT_SEARCH_CLUSTER ; no 0 000046E5 06 PUSH ES ; save registers 0 000046E6 57 PUSH DI 0 000046E7 51 PUSH CX 0 000046E8 FF74FF PUSH word [SI-1] ; save \ and 1st char of next element 0 000046EB 56 PUSH SI 0 000046EC 53 PUSH BX 260 0 000046ED C644FF00 MOV BYTE PTR [SI-1],0 ; call fastopen to look up cur dir info 0 000046F1 8B36[0000] MOV SI,[Wfp_Start] 0 000046F5 BB[0000] MOV BX,OFFSET FastOpenTable wrt DOSGROUP 0 000046F8 BF[0000] MOV DI,OFFSET Dir_Info_Buff wrt DOSGROUP 0 000046FB B9[0000] MOV CX,OFFSET FastOpen_Ext_Info wrt DOSGROUP 266 FONC_look_up equ FONC_Look_up ; NASM port equate 0 000046FE B001 MOV AL,FONC_look_up 0 00004700 1E PUSH DS 0 00004701 07 POP ES 270 assume es:DOSGROUP 271 FASTOPEN_NAME_CACHING equ Fastopen_Name_Caching ; NASM port equate 0 00004702 FF5F02 CALL far [BX + FASTOPEN_NAME_CACHING] 0 00004705 7208 JC GO_Chk_end1 ;fastopen not installed, or wrong drive. Go to Got_Srch_cluster 0 00004707 803C00 CMP BYTE PTR [SI],0 ;fastopen has current dir info? 0 0000470A 7404 JE GO_Chk_end ;yes. Go to got_serch_cluster 0 0000470C F9 stc 0 0000470D EB01 jmp short GO_Chk_end ;Go to No_Curr_D 278 GO_Chk_end1: 0 0000470F F8 clc 280 GO_Chk_end: ; restore registers 0 00004710 5B POP BX 0 00004711 5E POP SI 0 00004712 8F44FF POP word [SI-1] 0 00004715 59 POP CX 0 00004716 5F POP DI 0 00004717 07 POP ES 287 assume es:nothing 0 00004718 730E JNC GOT_SEARCH_CLUSTER ; crack based on cur dir 289 290 ; DOS 3.3 6/25/86 291 ; 292 ; We must cract the path beginning at the root. Advance pointer to beginning 293 ; of path and go crack from root. 294 ; 295 NO_CURR_D: 0 0000471A 8B36[0000] MOV SI,[WFP_START] 0 0000471E 8D7403 LEA SI,[SI+3] ; Skip "d:/" 298 THISDPB equ ThisDPB ; NASM port label 0 00004721 C42E[0000] LES BP,[THISDPB] ; Get ES:BP 0 00004725 EB41 JMP ROOTPATH 0 00004727 90 nop ; identicalise 302 ; 303 ; We are able to crack from the current directory part. Go set up for search 304 ; of specified cluster. 305 ; 306 GOT_SEARCH_CLUSTER: 0 00004728 C42E[0000] LES BP,[THISDPB] ; Get ES:BP 0 0000472C E8[0000] invoke SETDIRSRCH 0 0000472F 7203 JC SETFERR 0 00004731 EB46 JMP FINDPATH 0 00004733 90 nop ; identicalise 312 313 SETFERR: 0 00004734 30C9 XOR CL,CL ; set zero 0 00004736 F9 STC 0 00004737 C3 Return 317 318 EndProc GETPATH 319 320 ; Check to see if the name at DS:DI is a device. Returns carry set if not a 321 ; device. 322 ; Blasts CX,SI,DI,AX,BX 323 324 Procedure ChkDev,NEAR 324 ****************** warning: proc ChkDev... [-w+user] 325 ASSUME ES:Nothing,DS:NOTHING 326 0 00004738 89FE MOV SI,DI 0 0000473A 8CD7 MOV DI,SS 0 0000473C 8EC7 MOV ES,DI 330 ASSUME ES:DOSGroup ; Now here is where ES is DOSGroup 331 332 NAME1 equ Name1 ; NASM port label 0 0000473E BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP 0 00004741 B90900 MOV CX,9 335 TESTLOOP: 0 00004744 E8[0000] invoke GETLET 337 %IF DBCS ;AN000; 338 invoke Testkanj ;AN000;; 2/13/KK 339 jz Notkanja ;AN000;; 2/13/KK 340 stosb ;AN000;; Skip second byte 2/13/KK 341 dec cx ;AN000;; 2/13/KK 342 notdev equ NOTDEV ; NASM port label 343 jcxz notdev ;AN000;; 2/13/KK 344 lodsb ;AN000;; 2/13/KK 345 jmp short stowit ;AN000;; 2/13/KK 346 Notkanja: ;AN000; 347 %ENDIF ;AN000; 0 00004747 3C2E CMP AL,'.' 0 00004749 740E JZ TESTDEVICE 0 0000474B E8[0000] invoke PATHCHRCMP 0 0000474E 7407 JZ NOTDEV 0 00004750 08C0 OR AL,AL 0 00004752 7405 JZ TESTDEVICE 354 stowit: 0 00004754 AA STOSB 0 00004755 E2ED LOOP TESTLOOP 357 NOTDEV: 0 00004757 F9 STC 0 00004758 C3 return 360 361 TESTDEVICE: 0 00004759 83C102 ADD CX,2 0 0000475C B020 MOV AL,' ' 0 0000475E F3AA REP STOSB 0 00004760 8CD0 MOV AX,SS 0 00004762 8ED8 MOV DS,AX 367 assume ds:DOSGROUP 0 00004764 E8C801 invoke DEVNAME 0 00004767 C3 return 370 EndProc ChkDev 371 372 Break 373 374 ; Inputs: 375 ; Same as FINDPATH but, 376 ; SI Points to asciz string of path which is assumed to start at 377 ; the root (no leading '/'). 378 ; Function: 379 ; Search from root for path 380 ; Outputs: 381 ; Same as FINDPATH but: 382 ; If root directory specified, [CURBUF] and [NAME1] are NOT set, and 383 ; [NoSetDir] is ignored. 384 385 procedure ROOTPATH,near 385 ****************** warning: proc ROOTPATH... [-w+user] 386 387 DOSAssume CS,,"RootPath" 388 ASSUME ES:NOTHING 389 0 00004768 E8[0000] invoke SETROOTSRCH 0 0000476B 803C00 CMP BYTE PTR [SI],0 0 0000476E 7509 JNZ FINDPATH 393 394 ; Root dir specified 0 00004770 A0[0000] MOV AL,[SAttrib] 0 00004773 A2[0000] MOV [Attrib],AL 0 00004776 30E4 XOR AH,AH ; Sets "device ID" byte, sets zero 398 ; (dir), clears carry. 0 00004778 C3 return 400 401 ; Inputs: 402 ; [ATTRIB] Set to get through directories 403 ; [SATTRIB] Set to find last element 404 ; ES:BP Points to DPB 405 ; SI Points to asciz string of path (no leading '/'). 406 ; [SECCLUSPOS] = 0 407 ; [DIRSEC] = Phys sec # of first sector of directory 408 ; [CLUSNUM] = Cluster # of next cluster 409 ; [CLUSFAC] = Sectors per cluster 410 ; [NoSetDir] set 411 ; [CURR_DIR_END] Points to end of Current dir part of string 412 ; ( = -1 if current dir not involved, else 413 ; Points to first char after last "/" of current dir part) 414 ; [THISCDS] Points to CDS being used 415 ; [CREATING] and [DELALL] set 416 ; Function: 417 ; Parse path name 418 ; Outputs: 419 ; ID1 field of [THISCDS] updated appropriately 420 ; [ATTRIB] = [SATTRIB] 421 ; ES:BP Points to DPB 422 ; [THISDPB] = ES:BP 423 ; Carry set if bad path 424 ; SI Points to path element causing failure 425 ; Zero set 426 ; [DIRSTART],[DIRSEC],[CLUSNUM], and [CLUSFAC] are set up to 427 ; start a search on the last directory 428 ; CL is zero if there is a bad name in the path 429 ; CL is non-zero if the name was simply not found 430 ; [ENTFREE] may have free spot in directory 431 ; [NAME1] is the name. 432 ; CL = 81H if '*'s or '?' in NAME1, 80H otherwise 433 ; Zero reset 434 ; File in middle of path or bad name in path 435 ; or path too long or malformed path 436 ; ELSE 437 ; [CURBUF] contains directory record with match 438 ; [CURBUF+2]:BX Points into [CURBUF] to start of entry 439 ; [CURBUF+2]:SI Points to fcb_FIRCLUS field for entry 440 ; [NAME1] Has name looked for 441 ; AH = device ID 442 ; bit 7 of AH set if device SI and BX 443 ; will point DOSGROUP relative The firclus 444 ; field of the device entry contains the device pointer 445 ; If last element is a directory zero is set and: 446 ; [DIRSTART],[SECCLUSPOS],[DIRSEC],[CLUSNUM], and [CLUSFAC] 447 ; are set up to start a search on it, 448 ; unless [NoSetDir] is non zero in which case the return is 449 ; like that for a file (except for zero flag) 450 ; If last element is a file zero is reset 451 ; [DIRSEC],[CLUSNUM],[CLUSFAC],[NXTCLUSNUM],[SECCLUSPOS], 452 ; [LASTENT], [ENTLAST] are set to continue search of last 453 ; directory for furthur matches on NAME1 via the NEXTENT 454 ; entry point in FindEntry (or GETENT entry in GETENTRY in 455 ; which case [NXTCLUSNUM] and [SECCLUSPOS] need not be valid) 456 ; Destroys all other registers 457 458 entry FINDPATH 459 DOSAssume CS,,"FindPath" 460 ASSUME ES:NOTHING 461 462 Assert ISDPB,,"FindPath" 0 00004779 06 PUSH ES ; Save ES:BP 0 0000477A 56 PUSH SI 0 0000477B 89F7 MOV DI,SI 466 DIRSTART equ DirStart ; NASM port label 0 0000477D 8B0E[0000] MOV CX,[DIRSTART] ; Get start clus of dir being searched 0 00004781 833E[0000]FF CMP word [CURR_DIR_END],-1 0 00004786 740E JZ NOIDS ; No current dir part 0 00004788 3B3E[0000] CMP DI,[CURR_DIR_END] 0 0000478C 7508 JNZ NOIDS ; Not to current dir end yet 0 0000478E C43E[0000] LES DI,[THISCDS] 0 00004792 26894D49 MOV [ES:DI + curdir_ID],CX ; Set current directory currency 474 NOIDS: 475 ; 476 ; Parse the name off of DS:SI into NAME1. AL = 1 if there was a meta 477 ; character in the string. CX,DI may be destroyed. 478 ; 479 ; invoke NAMETRANS 480 ; MOV CL,AL 481 ; 482 ; The above is the slow method. The name has *already* been munged by 483 ; TransPath so no special casing needs to be done. All we do is try to copy 484 ; the name until ., \ or 0 is hit. 485 ; 0 00004796 8CD0 MOV AX,SS 0 00004798 8EC0 MOV ES,AX 488 assume es:DOSGROUP 0 0000479A BF[0000] MOV DI,OFFSET Name1 wrt DOSGroup 0 0000479D B82020 MOV AX,' ' 0 000047A0 AA STOSB 0 000047A1 AB STOSW 0 000047A2 AB STOSW 0 000047A3 AB STOSW 0 000047A4 AB STOSW 0 000047A5 AB STOSW 0 000047A6 BF[0000] MOV DI,OFFSET Name1 wrt DOSGroup 0 000047A9 30E4 XOR AH,AH ; bits for CL 499 %IF DBCS ;AN000; 500 ;-------------------------- Start of DBC;AN000;S 2/13/KK 501 XOR CL,CL ;AN000;; clear count for volume id 502 LODSB ;AN000;;IBMJ fix 9/04/86 503 CMP AL,05h ;AN000;;IBMJ fix 9/04/86 504 JNE GetNam2 ;AN000;;IBMJ fix 9/04/86 505 PUSH AX ;AN000; ;IBMJ fix 9/04/86 506 MOV AL,0E5h ;AN000;;IBMJ fix 9/04/86 507 Invoke TestKanj ;AN000;;IBMJ fix 9/04/86 508 POP AX ;AN000; ;IBMJ fix 9/04/86 509 JZ Notkanjb ;AN000; ;IBMJ fix 9/04/86 510 JMP SHORT GetNam3 ;AN000;;IBMJ fix 9/04/86 511 ;-------------------------- End of DBCS ;AN000;2/13/KK 512 %ENDIF 513 GetNam: 0 000047AB FEC1 INC CL ;AN000; KK incrment volid count 0 000047AD AC LODSB 516 %IF DBCS ;AN000; 517 GetNam2: ;AN000;; 2/13/KK 518 invoke Testkanj ;AN000;; 2/13/KK 519 jz Notkanjb ;AN000;; 2/13/KK 520 GetNam3: ;AN000;; 2/13/KK 521 STOSB ;AN000;; 2/13/KK 522 INC CL ;AN000;; KK incrment volid count 523 LODSB ;AN000;; 2/13/KK 524 TEST word [DOS34_FLAG],DBCS_VOLID ;AN000;; 2/13/KK 525 JZ notvol ;AN000;; 2/13/KK 526 CMP CL,8 ;AN000;; 2/13/KK 527 JNZ notvol ;AN000;; 2/13/KK 528 CMP AL,'.' ;AN000;; 2/13/KK 529 JNZ notvol ;AN000;; 2/13/KK 530 LODSB ;AN000;; 2/13/KK 531 notvol: ;AN000; 532 jmp short StoNam ;AN000;; 2/13/KK 533 Notkanjb: ;AN000;; 2/13/KK 534 %ENDIF ;AN000; 0 000047AE 3C2E CMP AL,'.' 536 setExt equ SetExt ; NASM port label 0 000047B0 7412 JZ setExt 0 000047B2 08C0 OR AL,AL 0 000047B4 7424 JZ GetDone 0 000047B6 3C5C CMP AL,'\' 0 000047B8 7420 JZ GetDone 0 000047BA 3C3F CMP AL,'?' 0 000047BC 7503 JNZ StoNam 0 000047BE 80CC01 OR AH,1 0 000047C1 AA StoNam: STOSB 0 000047C2 EBE7 JMP GetNam 547 SetExt: 0 000047C4 BF[0800] MOV DI,OFFSET Name1+8 wrt DOSGroup 549 GetExt: 0 000047C7 AC LODSB 551 %IF DBCS ;AN000; 552 invoke TestKanj ;AN000;; 2/13/KK 553 jz Notkanjc ;AN000;; 2/13/KK 554 STOSB ;AN000;; 2/13/KK 555 LODSB ;AN000;; 2/13/KK 556 jmp short StoExt ;AN000;; 2/13/KK 557 Notkanjc: ;AN000;; 2/13/KK 558 %ENDIF ;AN000; 0 000047C8 08C0 OR AL,AL 0 000047CA 740E JZ GetDone 0 000047CC 3C5C CMP AL,'\' 0 000047CE 740A JZ GetDone 0 000047D0 3C3F CMP AL,'?' 0 000047D2 7503 JNZ StoExt 0 000047D4 80CC01 OR AH,1 0 000047D7 AA StoExt: STOSB 0 000047D8 EBED JMP GetExt 568 GetDone: 0 000047DA 4E DEC SI 0 000047DB 88E1 MOV CL,AH 571 572 0 000047DD 80C980 OR CL,80H 0 000047E0 5F POP DI ; Start of this element 0 000047E1 07 POP ES ; Restore ES:BP 576 assume es:nothing 0 000047E2 39FE CMP SI,DI 0 000047E4 7503 JNZ check_device 0 000047E6 E9ED00 JMP BADPATH ; NUL parse (two delims most likely) 580 check_device: 0 000047E9 56 PUSH SI ; Start of next element 0 000047EA 8A04 MOV AL,BYTE PTR [SI] 0 000047EC 08C0 OR AL,AL 0 000047EE 7508 JNZ NOT_LAST 585 586 ; 587 ; for last element of the path switch to the correct search attributes 588 ; 0 000047F0 8A3E[0000] MOV BH,[SAttrib] 0 000047F4 883E[0000] MOV [Attrib],BH 591 NOT_LAST: 592 593 ; 594 ; check name1 to see if we have a device... 595 ; 0 000047F8 06 PUSH ES ; Save ES:BP 0 000047F9 1607 context ES 0 000047FB E83101 invoke DEVNAME ; blast BX 0 000047FE 07 POP ES ; Restore ES:BP 600 ASSUME ES:NOTHING 0 000047FF 720B JC FindFile ; Not a device 0 00004801 08C0 OR AL,AL ; Test next char again 0 00004803 7403 JZ GO_BDEV 604 FileInPath equ FILEINPATH ; NASM port label 0 00004805 E9D200 JMP FileInPath ; Device name in middle of path 606 607 GO_BDEV: 0 00004808 5E POP SI ; Points to NUL at end of path 0 00004809 E97AFE JMP Build_devJ 610 611 FindFile: 612 ASSUME ES:NOTHING 613 ;;;; 7/28/86 0 0000480C 803E[0000]E5 CMP BYTE PTR [NAME1],0E5H ; if 1st char = E5 0 00004811 7505 JNZ NOE5 ; no 0 00004813 C606[0000]05 MOV BYTE PTR [NAME1],05H ; change it to 05 617 NOE5: 618 619 ;;;; 7/28/86 0 00004818 57 PUSH DI ; Start of this element 0 00004819 06 PUSH ES ; Save ES:BP 0 0000481A 51 PUSH CX ; CL return from NameTrans 623 ;DOS 3.3 FastOPen 6/12/86 F.C. 624 0 0000481B E89C02 CALL LookupPath ; call fastopen to get dir entry 0 0000481E 7303 JNC DIR_FOUND ; found dir entry 627 628 ;DOS 3.3 FastOPen 6/12/86 F.C. 0 00004820 E8[0000] invoke FINDENTRY 630 DIR_FOUND: 0 00004823 59 POP CX 0 00004824 07 POP ES 633 assume es:nothing 0 00004825 5F POP DI 0 00004826 7303 JNC LOAD_BUF 0 00004828 E9D400 JMP BADPATHPOP 637 638 LOAD_BUF: 639 CURBUF equ CurBuf ; NASM port label 0 0000482B C53E[0000] LDS DI,[CURBUF] 641 ASSUME DS:NOTHING 0 0000482F F6470B10 TEST BYTE PTR [BX+dir_attr],attr_directory 0 00004833 7503 JNZ GO_NEXT ; DOS 3.3 0 00004835 E9A200 JMP FileInPath ; Error or end of path 645 ; 646 ; if we are not setting the directory, then check for end of string 647 ; 648 GO_NEXT: 0 00004838 36803E[0000]00 CMP BYTE PTR [ss:NoSetDir],0 0 0000483E 7426 JZ SetDir 0 00004840 89FA MOV DX,DI ; Save pointer to entry 0 00004842 8CD9 MOV CX,DS 0 00004844 161F context DS 0 00004846 5F POP DI ; Start of next element 0 00004847 F606[0000]01 TEST byte [FastOpenFlg],FastOpen_Set ;only DOSOPEN can take advantage of 0 0000484C 740B JZ nofast ; the FastOpen 0 0000484E F606[0000]02 TEST byte [FastOpenFlg],Lookup_Success ; Lookup just happened 0 00004853 7404 JZ nofast ; no 0 00004855 8B3E[0000] MOV DI,[Next_Element_Start] ; no need to insert it again 660 nofast: 0 00004859 803D00 CMP BYTE PTR [DI],0 0 0000485C 7503 JNZ NEXT_ONE ; DOS 3.3 663 SetRet equ SETRET ; NASM port label 0 0000485E E99D00 JMP SetRet ; Got it 665 NEXT_ONE: 0 00004861 57 PUSH DI ; Put start of next element back on stack 0 00004862 89D7 MOV DI,DX 0 00004864 8ED9 MOV DS,CX ; Get back pointer to entry 669 ASSUME DS:NOTHING 670 671 SetDir: 0 00004866 8B14 MOV DX,[SI] ; Dir_first 673 674 ;DOS 3.3 FastOPen 6/12/86 F.C. 675 0 00004868 1E PUSH DS ; save [curbuf+2] 0 00004869 161F context DS ; set DS Dosgroup 0 0000486B F606[0000]02 TEST byte [FastOpenFlg],Lookup_Success ; 0 00004870 7411 JZ DO_NORMAL ; fastopen not in memory or path not 0 00004872 89D3 MOV BX,DX ; not found 0 00004874 8B3E[0000] MOV DI,[CLUSNUM] ; clusnum was set in LookupPath 0 00004878 50 PUSH AX ; save device id (AH) 0 00004879 E8[0000] invoke SETDIRSRCH 0 0000487C 58 POP AX ; restore device id (AH) 0 0000487D 83C402 ADD SP,2 ; pop ds in stack 0 00004880 EB3E JMP FAST_OPEN_SKIP 0 00004882 90 nop ; identicalise 688 689 DO_NORMAL: 0 00004883 1F POP DS ; DS = [curbuf + 2] 691 assume ds:nothing 692 ;DOS 3.3 FastOPen 6/12/86 F.C. 693 0 00004884 29FB SUB BX,DI ; Offset into sector of start of entry 0 00004886 29FE SUB SI,DI ; Offset into sector of dir_first 0 00004888 53 PUSH BX 0 00004889 50 PUSH AX 0 0000488A 56 PUSH SI 0 0000488B 51 PUSH CX 0 0000488C FF7508 PUSH WORD PTR [DI + buf_sector] ;AN000;>32mb 0 0000488F FF750A PUSH WORD PTR [DI + buf_sector+2] ;AN000;>32mb 0 00004892 89D3 MOV BX,DX 0 00004894 161F context DS 0 00004896 E8[0000] invoke SETDIRSRCH ; This uses UNPACK which might blow 705 ; the entry sector buffer 0 00004899 8F06[0000] POP word [HIGH_SECTOR] 0 0000489D 5A POP DX 0 0000489E 720A JC SKIP_GETB 709 allowed_RETRY equ Allowed_RETRY ; NASM port equate 710 allowed_FAIL equ Allowed_FAIL ; NASM port equate 0 000048A0 C606[0000]18 MOV byte [ALLOWED],allowed_RETRY + allowed_FAIL 0 000048A5 30C0 XOR AL,AL 0 000048A7 E8[0000] invoke GETBUFFR ; Get the entry buffer back 714 SKIP_GETB: 0 000048AA 59 POP CX 0 000048AB 5E POP SI 0 000048AC 58 POP AX 0 000048AD 5B POP BX 0 000048AE 7305 JNC SET_THE_BUF 0 000048B0 5F POP DI ; Start of next element 0 000048B1 89FE MOV SI,DI ; Point with SI 0 000048B3 EB21 JMP SHORT BADPATH 723 724 SET_THE_BUF: 0 000048B5 E8[0000] invoke SET_BUF_AS_DIR 0 000048B8 8B3E[0000] MOV DI,WORD PTR [CURBUF] 0 000048BC 01FE ADD SI,DI ; Get the offsets back 0 000048BE 01FB ADD BX,DI 729 ; DOS 3.3 FasOpen 6/12/86 F.C. 730 731 FAST_OPEN_SKIP: 732 0 000048C0 5F POP DI ; Start of next element 0 000048C1 E89302 CALL InsertPath ; insert dir entry info 735 736 ; DOS 3.3 FasOpen 6/12/86 F.C. 737 738 0 000048C4 8A05 MOV AL,[DI] 0 000048C6 08C0 OR AL,AL 0 000048C8 7434 JZ SETRET ; At end 0 000048CA 47 INC DI ; Skip over "/" 0 000048CB 89FE MOV SI,DI ; Point with SI 0 000048CD E8[0000] invoke PATHCHRCMP 0 000048D0 7503 JNZ find_bad_name ; oops 0 000048D2 E9A4FE JMP FINDPATH ; Next element 747 748 find_bad_name: 0 000048D5 4E DEC SI ; Undo above INC to get failure point 750 BADPATH: 0 000048D6 30C9 XOR CL,CL ; Set zero 0 000048D8 EB2C JMP SHORT BADPRET 753 754 FILEINPATH: 0 000048DA 5F POP DI ; Start of next element 0 000048DB 161F context DS ; Got to from one place with DS gone 757 ; DOS 3.3 FastOpen 758 0 000048DD F606[0000]01 TEST byte [FastOpenFlg],FastOpen_Set ; do this here is we don't want to 0 000048E2 740B JZ NO_FAST ; device info to fastopen 0 000048E4 F606[0000]02 TEST byte [FastOpenFlg],Lookup_Success 0 000048E9 7404 JZ NO_FAST 0 000048EB 8B3E[0000] MOV DI,[Next_Element_Start] ; This takes care of one time lookup 764 ; success 765 NO_FAST: 766 767 ; DOS 3.3 FastOpen 768 0 000048EF 8A05 MOV AL,[DI] 0 000048F1 08C0 OR AL,AL 0 000048F3 7404 JZ INCRET 0 000048F5 89FE MOV SI,DI ; Path too long 0 000048F7 EB0D JMP SHORT BADPRET 774 775 INCRET: 776 ; DOS 3.3 FasOpen 6/12/86 F.C. 777 0 000048F9 E85B02 CALL InsertPath ; insert dir entry info 779 780 ; DOS 3.3 FasOpen 6/12/86 F.C. 0 000048FC FEC0 INC AL ; Reset zero 782 SETRET: 0 000048FE C3 return 784 785 BADPATHPOP: 0 000048FF 5E POP SI ; Start of next element 0 00004900 8A04 MOV AL,[SI] 0 00004902 89FE MOV SI,DI ; Start of bad element 0 00004904 08C0 OR AL,AL ; zero if bad element is last, non-zero if path too long 790 BADPRET: 0 00004906 A0[0000] MOV AL,[SAttrib] 0 00004909 A2[0000] MOV [Attrib],AL ; Make sure return correct 0 0000490C F9 STC 0 0000490D C3 return 795 EndProc ROOTPATH 796 797 Break 798 799 ; Inputs: 800 ; [THISDPB] Set 801 ; Function: 802 ; Set up a search for GETENTRY and NEXTENTRY 803 ; Outputs: 804 ; ES:BP = Drive parameters 805 ; Sets up LASTENT, ENTFREE=ENTLAST=-1, VOLID=0 806 ; Destroys ES,BP,AX 807 808 procedure StartSrch,NEAR 808 ****************** warning: proc StartSrch... [-w+user] 809 DOSAssume CS,,"StartSrch" 810 ASSUME ES:NOTHING 811 812 Assert ISDPB,<,>,"StartSrch" 0 0000490E C42E[0000] LES BP,[THISDPB] 0 00004912 31C0 XOR AX,AX 815 LASTENT equ LastEnt ; NASM port label 0 00004914 A3[0000] MOV [LASTENT],AX 817 VOLID equ VolID ; NASM port label 0 00004917 A2[0000] MOV BYTE PTR [VOLID],AL ; No volume ID found 0 0000491A 48 DEC AX 820 ENTFREE equ EntFree ; NASM port label 0 0000491B A3[0000] MOV [ENTFREE],AX 822 ENTLAST equ EntLast ; NASM port label 0 0000491E A3[0000] MOV [ENTLAST],AX 0 00004921 C3 return 825 EndProc StartSrch 826 827 BREAK 828 829 ; 830 ; Input: [Attrib] = attribute to search for 831 ; CH = found attribute 832 ; Output: JZ 833 ; JNZ 834 ; Registers modified: noneski 835 procedure MatchAttributes,near 835 ****************** warning: proc MatchAttributes... [-w+user] 836 ASSUME DS:NOTHING,ES:NOTHING 0 00004922 50 PUSH AX 0 00004923 36A0[0000] MOV AL,[ss:Attrib] ; AL <- SearchSet 0 00004927 F6D0 NOT AL ; AL <- SearchSet' 0 00004929 20E8 AND AL,CH ; AL <- SearchSet' and FoundSet 0 0000492B 2416 AND AL,attr_all ; AL <- SearchSet' and FoundSet and Important 842 ; 843 ; the result is non-zero if an attribute is not in the search set 844 ; and in the found set and in the important set. This means that we do not 845 ; have a match. Do a JNZ or JZ 846 ; 0 0000492D 58 POP AX 0 0000492E C3 return 849 EndProc MatchAttributes 850 851 Break 852 853 ; Inputs: 854 ; DS,ES:DOSGROUP 855 ; Filename in NAME1 856 ; ATTRIB set so that we can error out if looking for Volume IDs 857 ; Function: 858 ; Determine if file is in list of I/O drivers 859 ; Outputs: 860 ; Carry set if not a device 861 ; ELSE 862 ; Zero flag set 863 ; BH = Bit 7,6 = 1, bit 5 = 0 (cooked mode) 864 ; bits 0-4 set from low byte of attribute word 865 ; DEVPT = DWORD pointer to Device header of device 866 ; BX destroyed, others preserved 867 868 procedure DEVNAME,NEAR 868 ****************** warning: proc DEVNAME... [-w+user] 869 DOSAssume CS,,"DEVNAME" 870 0 0000492F 56 PUSH SI 0 00004930 57 PUSH DI 0 00004931 51 PUSH CX 0 00004932 50 PUSH AX 875 876 ; E5 special code 0 00004933 FF36[0000] PUSH WORD PTR [NAME1] 0 00004937 803E[0000]05 CMP byte [NAME1],5 0 0000493C 7505 JNZ NOKTR 0 0000493E C606[0000]E5 MOV byte [NAME1],0E5H 881 NOKTR: 882 0 00004943 F606[0000]08 TEST byte [Attrib],attr_volume_id ; If looking for VOL id don't find devs 0 00004948 7522 JNZ RET31 0 0000494A BE[0000] MOV SI,OFFSET NULDEV wrt DOSGROUP 886 LOOKIO: 887 ASSUME DS:NOTHING 0 0000494D F744040080 TEST word [SI + SDEVATT],DEVTYP 0 00004952 7411 JZ SKIPDEV ; Skip block devices (NET and LOCAL) 0 00004954 89F0 MOV AX,SI 0 00004956 83C60A ADD SI,SDEVNAME 0 00004959 BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP 0 0000495C B90400 MOV CX,4 ; All devices are 8 letters 0 0000495F F3A7 REPE CMPSW ; Check for name in list 0 00004961 89C6 MOV SI,AX 0 00004963 7415 JZ IOCHK ; Found it? 897 SKIPDEV: 0 00004965 C534 LDS SI,[SI] ; Get address of next device 0 00004967 83FEFF CMP SI,-1 ; At end of list? 0 0000496A 75E1 JNZ LOOKIO 0 0000496C F9 RET31: STC ; Not found 0 0000496D 8CD1 RETNV: MOV CX,SS 0 0000496F 8ED9 MOV DS,CX 904 ASSUME DS:DOSGroup 0 00004971 8F06[0000] POP WORD PTR [NAME1] 0 00004975 58 POP AX 0 00004976 59 POP CX 0 00004977 5F POP DI 0 00004978 5E POP SI 0 00004979 C3 RET 911 912 IOCHK: 913 ASSUME DS:NOTHING 0 0000497A 368C1E[0200] MOV WORD PTR [ss:DEVPT+2],DS ; Save pointer to device 0 0000497F 8A7C04 MOV BH,BYTE PTR [SI + SDEVATT] 0 00004982 80CFC0 OR BH,0C0H 0 00004985 80E7DF AND BH,~ 020H ; Clears Carry 0 00004988 368936[0000] MOV WORD PTR [ss:DEVPT],SI 0 0000498D EBDE JMP RETNV 920 EndProc DEVNAME 921 922 BREAK 923 924 ; Inputs: 925 ; [NAME1] has name 926 ; BH is attribute field (supplied by DEVNAME) 927 ; [DEVPT] points to device header (supplied by DEVNAME) 928 ; Function: 929 ; Build a directory entry for a device at DEVFCB 930 ; Outputs: 931 ; BX points to DEVFCB 932 ; SI points to dir_first field 933 ; AH = input BH 934 ; AL = 0 935 ; dir_first = DEVPT 936 ; Zero Set, Carry Clear 937 ; DS,ES,BP preserved, others destroyed 938 939 procedure Build_device_ent,near 939 ****************** warning: proc Build_device_ent... [-w+user] 940 DOSAssume CS,,"Build_Device_Ent" 941 0 0000498F B82020 MOV AX," " 0 00004992 BF[0800] MOV DI,OFFSET DEVFCB+8 wrt DOSGROUP ; Point to extent field 944 ; 945 ; Fill dir_ext 946 ; 0 00004995 AB STOSW 0 00004996 AA STOSB ; Blank out extent field 0 00004997 B040 MOV AL,attr_device 950 ; 951 ; Fill Dir_attr 952 ; 0 00004999 AA STOSB ; Set attribute field 0 0000499A 31C0 XOR AX,AX 0 0000499C B90A00 MOV CX,10 956 ; 957 ; Fill dir_pad 958 ; 0 0000499F F3AB REP STOSW ; Fill rest with zeros 0 000049A1 E8[0000] invoke DATE16 0 000049A4 BF[1600] MOV DI,OFFSET DEVFCB+dir_time wrt DOSGROUP 0 000049A7 92 XCHG AX,DX 963 ; 964 ; Fill dir_time 965 ; 0 000049A8 AB STOSW 0 000049A9 92 XCHG AX,DX 968 ; 969 ; Fill dir_date 970 ; 0 000049AA AB STOSW 0 000049AB 89FE MOV SI,DI ; SI points to dir_first field 0 000049AD A1[0000] MOV AX,WORD PTR [DEVPT] 974 ; 975 ; Fill dir_first 976 ; 0 000049B0 AB STOSW ; Dir_first points to device 0 000049B1 A1[0200] MOV AX,WORD PTR [DEVPT+2] 979 ; 980 ; Fill dir_size_l 981 ; 0 000049B4 AB STOSW 0 000049B5 88FC MOV AH,BH ; Put device atts in AH 0 000049B7 BB[0000] MOV BX,OFFSET DEVFCB wrt DOSGROUP 0 000049BA 30C0 XOR AL,AL ; Set zero, clear carry 0 000049BC C3 return 987 EndProc Build_device_ent 988 989 Break 990 991 ; 992 ; ValidateCDS - Get current CDS. Splice it. Call FatReadCDS to check 993 ; media. If media has been changed, do DOS_Chdir to validate path. If 994 ; invalid, reset original CDS to root. 995 ; 996 ; Inputs: ThisCDS points to CDS of interest 997 ; SS:DI points to temp buffer 998 ; Outputs: The current directory string is validated on the appropriate 999 ; drive 1000 ; ThisDPB changed 1001 ; ES:DI point to CDS 1002 ; Carry set if error (currently user FAILed to I 24) 1003 ; Registers modified: all 1004 1005 Procedure ValidateCDS,NEAR 1005 ****************** warning: proc ValidateCDS... [-w+user] 1006 ASSUME DS:NOTHING, ES:NOTHING, SS:DOSGROUP 1007 Public DIR2001S,DIR2001E 1008 DIR2001S: 1009 LocalVar Temp,WORD 1010 LocalVar SaveCDS,DWORD 1011 DIR2001E: 0 000049BD 5589E583EC06 Enter 0 000049C3 897EFE MOV [Temp],DI 1014 ThisCDS equ THISCDS ; NASM port label 0 000049C6 36C536[0000] LDS SI,[ss:ThisCDS] 0 000049CB 8976FA MOV [SaveCDSL],SI 0 000049CE 8C5EFC MOV [SaveCDSH],DS 0 000049D1 E8[0000] EnterCrit critDisk 0 000049D4 F744430080 TEST word [SI + curdir_flags],curdir_isnet ; Clears carry 0 000049D9 7403 JZ DoSplice 0 000049DB E99300 JMP FatFail 1022 DoSplice: 0 000049DE 30D2 XOR DL,DL 0 000049E0 368616[0000] XCHG DL,[ss:NoSetDir] 0 000049E5 1607 Context ES 0 000049E7 E8[0000] Invoke FStrcpy 0 000049EA 8B76FE MOV SI,[Temp] 0 000049ED 161F Context DS 0 000049EF E8[0000] Invoke Splice 1030 ASSUME DS:NOTHING 0 000049F2 161F Context DS ; FatReadCDS (ThisCDS); 0 000049F4 8816[0000] MOV [NoSetDir],DL 0 000049F8 C43E[0000] LES DI,[ThisCDS] 0 000049FC 55 SaveReg 0 000049FD E8[0000] Invoke FatRead_CDS 0 00004A00 5D RestoreReg 0 00004A01 726E JC FatFail 0 00004A03 C536[0000] LDS SI,[ThisCDS] ; if (ThisCDS->ID == -1) { 1039 ASSUME DS:NOTHING 0 00004A07 837C49FF CMP word [SI + curdir_ID],-1 0 00004A0B 7556 JNZ RestoreCDS 0 00004A0D 1607 Context ES 0 00004A0F 36FF36[0000] SaveReg ; t = wfp_Start; 0 00004A14 3B76FA CMP SI,[SaveCDSL] ; if not spliced 0 00004A17 750B JNZ DoChdir 0 00004A19 8B7EFE MOV DI,[Temp] 1047 wfp_Start equ WFP_START ; NASM port label 0 00004A1C 36893E[0000] MOV [ss:wfp_Start],DI ; wfp_start = d; 0 00004A21 E8[0000] Invoke FStrCpy ; strcpy (d, ThisCDS->Text); 1050 DoChdir: 0 00004A24 161F Context DS 0 00004A26 FF36[0000]55 SaveReg <,BP> ; c = DOSChDir (); 0 00004A2B E8[0000] Invoke DOS_ChDir 0 00004A2E 5D5B8F06[0000] RestoreReg ; wfp_Start = t; 0 00004A34 881E[0000] MOV [SAttrib],BL 0 00004A38 C576FA LDS SI,[SaveCDS] 1057 ASSUME DS:NOTHING 0 00004A3B 730F JNC SetCluster ; if (c == -1) { 0 00004A3D 368936[0000] MOV WORD PTR [ss:ThisCDS],SI ; ThisCDS = TmpCDS; 0 00004A42 368C1E[0200] MOV WORD PTR [ss:ThisCDS+2],DS 0 00004A47 31C9 XOR CX,CX ; TmpCDS->text[3] = c = 0; 0 00004A49 884C03 MOV [SI+3],CL ; } 1063 SetCluster: 0 00004A4C C74449FFFF MOV word [SI + curdir_ID],-1 ; TmpCDS->ID = -1; 0 00004A51 36C536[0000] LDS SI,[ss:ThisCDS] ; ThisCDS->ID = c; 0 00004A56 F744430020 TEST word [SI + curdir_flags],curdir_splice ;AN000;;MS. for Join and Subst 0 00004A5B 7403 JZ setdirclus ;AN000;;MS. 0 00004A5D B9FFFF MOV CX,-1 ;AN000;;MS. 1069 setdirclus: 0 00004A60 894C49 MOV [SI + curdir_ID],CX ; } 1071 RestoreCDS: 0 00004A63 C47EFA LES DI,[SaveCDS] 0 00004A66 36893E[0000] MOV WORD PTR [ss:ThisCDS],DI 0 00004A6B 368C06[0200] MOV WORD PTR [ss:ThisCDS+2],ES 0 00004A70 F8 CLC 1076 FatFail: 0 00004A71 E8[0000] LeaveCrit critDisk 0 00004A74 C47EFA LES DI,[SaveCDS] 0 00004A77 89EC5D Leave 0 00004A7A C3 return 1081 EndProc ValidateCDS 1082 1083 Break 1084 1085 ; 1086 ; CheckThisDevice - Examine the area at DS:SI to see if there is a valid 1087 ; device specified. We will return carry if there is a device present. The 1088 ; forms of devices we will recognize are: 1089 ; 1090 ; [path]device 1091 ; 1092 ; Note that the drive letter has *already* been removed. All other forms 1093 ; are not considered to be devices. If such a device is found we change the 1094 ; source pointer to point to the device component. 1095 ; 1096 ; Inputs: ES is DOSGroup 1097 ; DS:SI contains name 1098 ; Outputs: ES is DOSGroup 1099 ; DS:SI point to name or device 1100 ; Carry flag set if device was found 1101 ; Carry flag reset otherwise 1102 ; Registers Modified: all except ES:DI, DS 1103 1104 %if FALSE 1105 Procedure CheckThisDevice,NEAR 1106 DOSAssume CS,,"CheckThisDevice" 1107 ASSUME DS:NOTHING 1108 SaveReg 1109 ; 1110 ; Advance to after the final path character. 1111 ; 1112 MOV DI,SI ; remember first character 1113 PathSkip: 1114 LODSB 1115 OR AL,AL 1116 JZ FoundEnd 1117 %IF DBCS ;AN000; 1118 invoke Testkanj ;AN000;; 2/13/KK 1119 Notkanje equ NotKanje ; NASM port label 1120 jz Notkanje ;AN000;; 2/13/KK 1121 lodsb ;AN000;; 2/13/KK 1122 or al,al ;AN000;; Skip second byte 2/13/KK removed 1123 jz FoundEnd ;AN000;; 2/13/KK removed 1124 Pathskip equ PathSkip ; NASM port label 1125 jmp Short Pathskip ;AN000;; Ignore missing second byte for now. 1126 NotKanje: ;AN000; 1127 %ENDIF ;AN000; 1128 ;kanji load of next char too 2/13/KK 1129 %IF Kanji 1130 kanji load of next char too 1131 %ENDIF 1132 invoke PathChrCmp ; is it a path char? 1133 JNZ PathSkip 1134 MOV DI,SI 1135 JMP PathSkip 1136 FoundEnd: 1137 MOV SI,DI 1138 ; 1139 ; Parse the name 1140 ; 1141 SaveReg ; preserve the source pointer 1142 invoke NameTrans ; advance DS:SI 1143 CMP BYTE PTR [SI],0 ; parse entire string? 1144 STC ; simulate a Carry return from DEVNAME 1145 JNZ SkipSearch ; no parse. simulate a file return. 1146 Context DS 1147 Invoke DEVNAME 1148 ASSUME DS:NOTHING 1149 SkipSearch: 1150 RestoreReg 1151 ; 1152 ; DS:SI points to the beginning of the potential device. If we have a device 1153 ; then we do not change SI. If we have a file, then we reset SI back to the 1154 ; original value. At this point Carry set indicates FILE. 1155 ; 1156 RestoreReg ; get original SI 1157 JNC CheckDone ; if device then do not reset pointer 1158 MOV SI,DI 1159 CheckDone: 1160 RestoreReg 1161 CMC ; invert carry. Carry => device 1162 return 1163 %else 1164 Procedure CheckThisDevice,NEAR 1164 ****************** warning: proc CheckThisDevice... [-w+user] 1165 DOSAssume CS,,"CheckThisDevice" 1166 ASSUME DS:NOTHING 0 00004A7B 5756 SaveReg 0 00004A7D 89F7 MOV DI,SI 1169 ; 1170 ; Check for presence of \dev\ (Dam multiplan!) 1171 ; 0 00004A7F 8A04 MOV AL,[SI] 0 00004A81 E8[0000] Invoke PathChrCmp ; is it a path char? 0 00004A84 7517 JNZ ParseDev ; no, go attempt to parse device 0 00004A86 46 INC SI ; simulate LODSB 1176 ; 1177 ; We have the leading path separator. Look for DEV part. 1178 ; 0 00004A87 AD LODSW 0 00004A88 0D2020 OR AX,2020h 0 00004A8B 3D6465 CMP AX,("e" << 8) + "d" 0 00004A8E 7527 JNZ NotDevice ; not "de", assume not device 0 00004A90 AC LODSB 0 00004A91 0C20 OR AL,20h 0 00004A93 3C76 CMP AL,"v" ; Not "v", assume not device 0 00004A95 7520 JNZ NotDevice 0 00004A97 AC LODSB 0 00004A98 E8[0000] invoke PathChrCmp ; do we have the last path separator? 0 00004A9B 751A JNZ NotDevice ; no. go for it. 1190 ; 1191 ; DS:SI now points to a potential drive. Preserve them as NameTrans advances 1192 ; SI and DEVNAME may destroy DS. 1193 ; 1194 ParseDev: 0 00004A9D 1E56 SaveReg ; preserve the source pointer 0 00004A9F E8[0000] invoke NameTrans ; advance DS:SI 0 00004AA2 803C00 CMP BYTE PTR [SI],0 ; parse entire string? 0 00004AA5 F9 STC ; simulate a Carry return from DEVNAME 0 00004AA6 7505 JNZ SkipSearch ; no parse. simulate a file return. 0 00004AA8 161F Context DS 0 00004AAA E882FE Invoke DEVNAME 1202 ASSUME DS:NOTHING 1203 SkipSearch: 0 00004AAD 5E1F RestoreReg 1205 ; 1206 ; SI points to the beginning of the potential device. If we have a device 1207 ; then we do not change SI. If we have a file, then we reset SI back to the 1208 ; original value. At this point Carry set indicates FILE. 1209 ; 1210 CheckReturn: 0 00004AAF 5F RestoreReg ; get original SI 0 00004AB0 7302 JNC CheckDone ; if device then do not reset pointer 0 00004AB2 89FE MOV SI,DI 1214 CheckDone: 0 00004AB4 5F RestoreReg 0 00004AB5 F5 CMC ; invert carry. Carry => device 0 00004AB6 C3 return 1218 NotDevice: 0 00004AB7 F9 STC 0 00004AB8 EBF5 JMP CheckReturn 1221 %endif 1222 1223 EndProc CheckThisDevice 1224 1225 BREAK 1226 1227 ; 1228 ; Output DS:SI -> path name, 1229 ; ES:DI -> dir entry info buffer 1230 ; ES:CX -> extended dir info buffer 1231 ; 1232 ; carry flag clear : tables pointed by ES:DI and ES:CX are filled by 1233 ; FastOpen, DS:SI points to char just one after 1234 ; the last char of path name which is fully or 1235 ; partially found in FastOPen 1236 ; carry flag set : FastOpen not in memory or path name not found 1237 ; 1238 procedure LookupPath,NEAR 1238 ****************** warning: proc LookupPath... [-w+user] 1239 ASSUME ES:NOTHING 1240 1241 ; PUSH AX 0 00004ABA 36F606[0000]01 TEST byte [ss:FastOpenFlg],FastOpen_Set ; flg is set in DOSPEN 0 00004AC0 7503 JNZ FASTINST ; and this routine is 1244 NOLOOK: 0 00004AC2 E99000 JMP NOLOOKUP ; executed once 1246 FASTINST: 0 00004AC5 36F606[0000]08 TEST byte [ss:FastOpenFlg],No_Lookup ; no more lookup? 0 00004ACB 75F5 JNZ NOLOOK ; yes 1249 0 00004ACD BB[0000] MOV BX,OFFSET FastOpenTable wrt DOSGROUP ; get fastopen related tab 0 00004AD0 368B36[0000] MOV SI,[ss:Wfp_Start] ; si points to path name 0 00004AD5 BF[0000] MOV DI,OFFSET Dir_Info_Buff wrt DOSGROUP 0 00004AD8 B9[0000] MOV CX,OFFSET FastOpen_Ext_Info wrt DOSGROUP 0 00004ADB B001 MOV AL,FONC_look_up ; al = 1 0 00004ADD 16 PUSH ss 0 00004ADE 07 POP ES 1257 assume es:DOSGROUP 0 00004ADF FF5F02 CALL far [BX + FASTOPEN_NAME_CACHING] ;call fastopen 0 00004AE2 7260 JC NOTFOUND ; fastopen not in memory 1260 0 00004AE4 8D5CFE LEA BX,[SI-2] 0 00004AE7 363B1E[0000] CMP BX,[ss:Wfp_Start] ; path found ? 0 00004AEC 7456 JZ NOTFOUND ; no 1264 ; fully or partially found 0 00004AEE 803C00 CMP BYTE PTR [SI],0 ;AN000;FO. 0 00004AF1 751A JNZ parfnd ;AN000;FO.; partiallyfound 0 00004AF3 51 PUSH CX ;AN000;FO.; is attribute matched ? 0 00004AF4 368A0E[0000] MOV CL,[ss:Attrib] ;AN000;FO.; 1269 Sattrib equ SAttrib ; NASM port label 0 00004AF9 368A2E[0000] MOV CH,[ss:Sattrib] ;AN000;FO.; attrib=sattrib 0 00004AFE 36882E[0000] MOV [ss:Attrib],CH ;AN000;FO.; 0 00004B03 268A6D0B MOV CH,[ES:DI + dir_attr] ;AN000;FO.; 0 00004B07 E818FE invoke MatchAttributes ;AN000;FO.; 1274 ;;; MOV Attrib,CL ;AN001;FO.; retore attrib 0 00004B0A 59 POP CX ;AN000;FO.; 0 00004B0B 7548 JNZ NOLOOKUP ;AN000;FO.; not matched 1277 parfnd: 0 00004B0D 368936[0000] MOV [ss:Next_Element_Start],SI ; save si 0 00004B12 89CB MOV BX,CX 0 00004B14 8B4707 MOV AX,[BX + FEI_lastent] ;AN000;;FO. restore lastentry 0 00004B17 36A3[0000] MOV [ss:LASTENT],AX ;AN000;;FO. 0 00004B1B 8B4709 MOV AX,[BX + FEI_dirstart] ;AN001;;FO. restore dirstart 0 00004B1E 36A3[0000] MOV [ss:DIRSTART],AX ;AN001;;FO. 0 00004B22 8B4705 MOV AX,[BX + FEI_clusnum] ; restore next cluster num 0 00004B25 36A3[0000] MOV [ss:CLUSNUM],AX ; 1286 0 00004B29 06 PUSH ES ; save ES 0 00004B2A 36C41E[0000] LES BX,[ss:THISDPB] ; put drive id 1289 assume es:DPB 0 00004B2F 268A27 MOV AH,[ES:BX + dpb_drive] ; in AH for DOOPEN 0 00004B32 07 POP ES ; pop ES 1292 assume es:nothing 1293 0 00004B33 368C06[0200] MOV WORD PTR [ss:CURBUF+2],ES ; [curbuf+2].bx points to 0 00004B38 89FB MOV BX,DI ; start of entry 0 00004B3A 8D751A LEA SI,[DI + dir_first] ; [curbuf+2]:si points to 1297 ; dir_first field in the 1298 ; dir entry 1299 set_for_search equ Set_For_Search ; NASM port equate 0 00004B3D 36800E[0000]12 OR byte [ss:FastOpenFlg],Lookup_Success + set_for_search 1301 ; POP AX 0 00004B43 C3 RET 1303 NOTFOUND: 0 00004B44 83F8FF CMP AX,-1 ; not in memory ? 0 00004B47 7506 JNZ Partial_Success ; yes, in memory 0 00004B49 36C606[0000]00 MOV byte [ss:FastOpenFlg],0 ; no more fastopen 1307 Partial_Success: 0 00004B4F 368026[0000]FB AND byte [ss:FastOpenFlg],Special_Fill_Reset 1309 NOLOOKUP: 1310 ; POP AX 0 00004B55 F9 STC 0 00004B56 C3 RET 1313 EndProc LookupPath 1314 1315 BREAK 1316 1317 ; 1318 ; Input: FastOpen_Set flag set when from DOSOPEN otherwise 0 1319 ; Lookup_Success flag set when got dir entry info from FASTOPEN 1320 ; DS = DOSGROUP 1321 ; Output: FastOPen_Ext_Info is set and path dir info is inserted 1322 ; 1323 procedure InsertPath,NEAR 1323 ****************** warning: proc InsertPath... [-w+user] 1324 ASSUME ES:NOTHING 1325 0 00004B57 9C PUSHF 0 00004B58 36F606[0000]01 TEST byte [ss:FastOpenFlg],FastOpen_Set ;only DOSOPEN can take advantage of 0 00004B5E 747A JZ GET_NEXT_ELEMENT ; the FastOpen 0 00004B60 36F606[0000]02 TEST byte [ss:FastOpenFlg],Lookup_Success ; Lookup just happened 0 00004B66 740E JZ INSERT_DIR_INFO ; no 0 00004B68 368026[0000]FD AND byte [ss:FastOpenFlg],Lookup_Reset ; we got dir info from fastopen so 0 00004B6E 368B3E[0000] MOV DI,[ss:Next_Element_Start] ; no need to insert it again 0 00004B73 EB5F JMP GET_NEXT2 0 00004B75 90 nop ; identicalise 1335 INSERT_DIR_INFO: ; save registers 0 00004B76 1E PUSH DS 0 00004B77 06 PUSH ES 0 00004B78 53 PUSH BX 0 00004B79 56 PUSH SI 0 00004B7A 57 PUSH DI 0 00004B7B 51 PUSH CX 0 00004B7C 50 PUSH AX 1343 ; int 3 0 00004B7D 36C53E[0000] LDS DI,[ss:CURBUF] ; DS:DI -> buffer header 1345 ASSUME DS:NOTHING 0 00004B82 BE[0000] MOV SI,OFFSET FastOpen_Ext_Info wrt DOSGROUP 0 00004B85 8B4508 MOV AX,WORD PTR [DI + buf_sector] ; get directory sector 0 00004B88 36894401 MOV WORD PTR [ss:SI + FEI_dirsec],AX ;AN000; >32mb save dir sector 0 00004B8C 8B450A MOV AX,WORD PTR [DI + buf_sector+2] ;AN000; >32mb 0 00004B8F 161F context DS 0 00004B91 894403 MOV WORD PTR [SI + FEI_dirsec+2],AX ;AN000;>32mb save high dir sector 0 00004B94 A1[0000] MOV AX,[CLUSNUM] ; save next cluster number 0 00004B97 894405 MOV [SI + FEI_clusnum],AX 0 00004B9A A1[0000] MOV AX,[LASTENT] ;AN000;FO. save lastentry for search first 0 00004B9D 894407 MOV [SI + FEI_lastent],AX ;AN000;FO. 0 00004BA0 A1[0000] MOV AX,[DIRSTART] ;AN001;FO. save for search first 0 00004BA3 894409 MOV [SI + FEI_dirstart],AX ;AN001;FO. 1358 0 00004BA6 89D8 MOV AX,BX 0 00004BA8 83C710 ADD DI,BUFINSIZ ; DS:DI -> start of data in buffer 0 00004BAB 29F8 SUB AX,DI ; AX=BX relative to start of sector 0 00004BAD B120 MOV CL,dir_entry_struc_size 1363 ;invoke debug_DOS 0 00004BAF F6F1 DIV CL 0 00004BB1 8804 MOV [SI + FEI_dirpos],AL ; save directory entry # in buffer 1366 0 00004BB3 1E PUSH DS 0 00004BB4 07 POP ES 1369 assume es:DOSGROUP 1370 0 00004BB5 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 1372 ASSUME DS:NOTHING 0 00004BB9 89DF MOV DI,BX ; DS:DI -> dir entry info 0 00004BBB 837D1A00 CMP word [DI + dir_first],0 ; never insert info when file is empty 0 00004BBF 740C JZ SKIP_INSERT ; e.g. newly created file 1376 0 00004BC1 56 PUSH SI ; ES:BX -> extended info 0 00004BC2 5B POP BX 1379 0 00004BC3 B002 MOV AL,FONC_insert ; call fastopen insert operation 0 00004BC5 BE[0000] MOV SI,OFFSET FastOpenTable wrt DOSGROUP 0 00004BC8 26FF5C02 CALL far [ES:SI + FASTOPEN_NAME_CACHING] 1383 0 00004BCC F8 CLC 1385 SKIP_INSERT: 0 00004BCD 58 POP AX 0 00004BCE 59 POP CX ; restore registers 0 00004BCF 5F POP DI 0 00004BD0 5E POP SI 0 00004BD1 5B POP BX 0 00004BD2 07 POP ES 1392 assume es:nothing 0 00004BD3 1F POP DS 1394 assume ds:nothing 1395 GET_NEXT2: 0 00004BD4 36800E[0000]08 OR byte [ss:FastOpenFlg],No_Lookup ; we got dir info from fastopen so 1397 GET_NEXT_ELEMENT: 0 00004BDA 9D POPF 0 00004BDB C3 RET 1400 EndProc InsertPath 1401 1402 CODE ENDS 1403 END === Trace listing source: ../DOS/dev.lst 1 ; SCCSID = @(#)dev.asm 1.2 85/07/23 2 ; SCCSID = @(#)dev.asm 1.2 85/07/23 3 ;TITLE DEV - Device call routines 4 ;NAME Dev 5 ; Misc Routines to do 1-12 low level I/O and call devices 6 ; 7 ; IOFUNC 8 ; DEVIOCALL 9 ; SETREAD 10 ; SETWRITE 11 ; DEVIOCALL2 12 ; DEV_OPEN_SFT 13 ; DEV_CLOSE_SFT 14 ; RW_SC 15 ; IN_SC 16 ; INVALIDATE_SC 17 ; VIRREAD 18 ; SC2BUF 19 ; 20 ; Revision history: 21 ; 22 ; A000 version 4.00 Jan. 1988 23 ; A010 disable change line for SHARE /NC 24 25 ; 26 ; get the appropriate segment definitions 27 ; 28 [list -] 28 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 30 31 [list +] === Switch to base=002450h -> "DOSCODECODE" 32 section DOSCODECODE 33 [list -] 33 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 33 ****************** warning: out: BPB.INC... [-w+user] 33 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 33 ****************** warning: out: DEVSYM.INC... [-w+user] 33 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 41 42 i_need IOXAD,DWORD 43 i_need IOSCNT,WORD 44 i_need DEVIOBUF,4 45 i_need IOCALL,BYTE 46 i_need IOMED,BYTE 47 i_need IORCHR,BYTE 48 i_need CALLSCNT,WORD 49 i_need DMAAdd,DWORD 50 i_need CallDevAd,DWORD 51 i_need CallXAD,DWORD 52 i_need DPBHead,DWORD 53 i_need ThisSFT,DWORD 54 i_need ThisDPB,DWORD 55 i_need DevCall,DWORD 56 i_need VerFlg,BYTE 57 i_need HIGH_SECTOR,WORD ;AN000; 58 i_need CALLSSEC,WORD ;AN000; 59 i_need CALLNEWSC,DWORD ;AN000; 60 i_need SC_CACHE_COUNT,WORD ;AN000; 61 i_need SC_CACHE_PTR,DWORD ;AN000; 62 i_need CURSC_SECTOR,WORD ;AN000; 63 i_need SEQ_SECTOR,DWORD ;AN000; 64 i_need SC_SECTOR_SIZE,WORD ;AN000; 65 i_need CURSC_DRIVE,BYTE ;AN000; 66 i_need SC_DRIVE,BYTE ;AN000; 67 i_need SC_STATUS,WORD ;AN000; 68 i_need SC_FLAG,BYTE ;AN000; 69 i_need TEMP_VAR,WORD ;AN000; 70 i_need TEMP_VAR2,WORD ;AN000; 71 i_need InterChar,BYTE ;AN000; interim character flag 2/13/KK 72 i_need InterCon,BYTE ;AN000; Console mode flag(1:interim mode) 2/13/KK 73 i_need SaveCurFlg,BYTE ;AN000; Console out mode(1:print & don't adv cursor) 2 /13/KK 74 i_need DDMOVE,BYTE ;AN000; flag for DWORD move 75 i_need DOS34_FLAG,WORD ;AN000; 76 i_need fshare,BYTE ;AN010; share flag 77 78 assume nocheck, ss:DOSGROUP 79 80 Break 81 82 ; Inputs: 83 ; DS:SI Points to SFT 84 ; AH is function code 85 ; = 0 Input 86 ; = 1 Input Status 87 ; = 2 Output 88 ; = 3 Output Status 89 ; = 4 Flush 90 ; = 5 Input Status - System WAIT invoked for K09 if no char 91 ; present. 92 ; AL = character if output 93 ; Function: 94 ; Perform indicated I/O to device or file 95 ; Outputs: 96 ; AL is character if input 97 ; If a status call 98 ; zero set if not ready 99 ; zero reset if ready (character in AL for input status) 100 ; For regular files: 101 ; Input Status 102 ; Gets character but restores position 103 ; Zero set on EOF 104 ; Input 105 ; Gets character advances position 106 ; Returns ^Z on EOF 107 ; Output Status 108 ; Always ready 109 ; AX altered, all other registers preserved 110 111 procedure IOFUNC,NEAR 111 ****************** warning: proc IOFUNC... [-w+user] 112 ASSUME DS:NOTHING,ES:NOTHING 113 114 Assert ISSFT,,"IOFUNC" 0 00004BDC 368C16[0200] MOV WORD PTR [ss:IOXAD+2],SS 0 00004BE1 36C706[0000][0000] MOV WORD PTR [ss:IOXAD],OFFSET DEVIOBUF wrt DOSGROUP 0 00004BE8 36C706[0000]0100 MOV WORD PTR [ss:IOSCNT],1 0 00004BEF 36A3[0000] MOV WORD PTR [ss:DEVIOBUF],AX 0 00004BF3 F744050080 TEST word [SI + sf_flags],sf_isnet 0 00004BF8 7403 JZ IOTO22 ;AN000; 0 00004BFA E9A000 JMP IOTOFILE ;AN000; 122 IOTO22: 0 00004BFD F744058000 TEST word [SI + sf_flags],devid_device 124 IOTo33 equ IOTO33 ; NASM port label 0 00004C02 7503 JNZ IOTo33 ;AN000; 0 00004C04 E99600 JMP IOTOFILE ;AN000; 127 IOTO33: 0 00004C07 E8[0000] invoke save_world 0 00004C0A 8CDA MOV DX,DS 0 00004C0C 8CD3 MOV BX,SS 0 00004C0E 8EDB MOV DS,BX 132 assume ds:DOSGROUP 0 00004C10 8EC3 MOV ES,BX 134 assume es:DOSGROUP 0 00004C12 31DB XOR BX,BX 0 00004C14 80FC05 cmp ah,5 ; system wait enabled? 0 00004C17 7504 jnz no_sys_wait 0 00004C19 81CB0004 or bx,0400H ; Set bit 10 in status word for driver 139 ; It is up to device driver to carry out 140 ; appropriate action. 141 no_sys_wait: 0 00004C1D 891E[0300] MOV [IOCALL + REQSTAT],BX 0 00004C21 31DB XOR BX,BX 0 00004C23 881E[0000] MOV BYTE PTR [IOMED],BL 145 === Switch to base=002450h -> "DOSCODETABLE" 146 section DOSCODETABLE 147 DEV001S equ DEV001s ; NASM port label 148 Public DEV001S, DEV001E ; Pathgen labels 149 DEV001s: 150 ; length of packets 0 000006D6 160E160D0F0E LenTab DB DRDWRHL, DRDNDHL, DRDWRHL, DSTATHL, DFLSHL, DRDNDHL 152 153 ; Error Function 154 0 000006DC 8604 CmdTab DB 86h, DEVRD ; 0 input 0 000006DE 8605 DB 86h, DEVRDND ; 1 input status 0 000006E0 8708 DB 87h, DEVWRT ; 2 output 0 000006E2 870A DB 87h, DEVOST ; 3 output status 0 000006E4 8607 DB 86h, DEVIFL ; 4 input flush 0 000006E6 8605 DB 86H, DEVRDND ; 5 input status with system WAIT 161 DEV001E: === Switch to base=002450h -> "DOSCODECODE" 162 DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 163 section DOSCODECODE 164 0 00004C27 88E3 MOV BL,AH ; get function 0 00004C29 2E8AA7[0000] MOV AH,[cs:LenTab + BX] 0 00004C2E D1E3 SHL BX,1 0 00004C30 2E8B8F[0600] MOV CX,WORD PTR [cs:CmdTab + BX] 169 0 00004C35 BB[0000] MOV BX,OFFSET IOCALL wrt DOSGROUP 171 0 00004C38 8826[0000] MOV [IOCALL + REQLEN],AH 0 00004C3C 882E[0200] MOV [IOCALL + REQFUNC],CH 174 %IF DBCS ;AN000; 175 ;----------------------------- Start of DBCS 2/13/KK 176 PUSH CX ;AN000; 177 MOV CL, [InterCon] ;AN000; 178 CMP CH, DEVRD ;AN000; 0 input 179 JZ SETIN ;AN000; 180 CMP CH, DEVRDND ;AN000; 1(5) input status without(with) system WAIT 181 JZ SETIN ;AN000; 182 SaveCurflg equ SaveCurFlg ; NASM port label 183 MOV CL, [SaveCurflg] ;AN000; 184 CMP CH, DEVWRT ;AN000; 2 output 185 JZ CHKERROUT ;AN000; 186 XOR CL,CL ;AN000; else, do normal 187 SETIN: ;AN000; 188 IoMed equ IOMED ; NASM port label 189 MOV BYTE PTR [IoMed], CL ;AN000; set interim I/O indication 190 POP CX ;AN000; 191 ;----------------------------- End of DBCS 2/13/KK 192 %ENDIF ;AN000; 0 00004C40 8EDA MOV DS,DX 194 ASSUME DS:NOTHING 0 00004C42 E86701 CALL DEVIOCALL 0 00004C45 368B3E[0300] MOV DI,[ss:IOCALL + REQSTAT] 0 00004C4A F7C70080 TEST DI,STERR 0 00004C4E 7520 JNZ DevErr 199 OkDevIO: 0 00004C50 8CD0 MOV AX,SS 0 00004C52 8ED8 MOV DS,AX 202 ASSUME DS:DOSGroup 203 %IF DBCS ;AN000; 204 MOV byte [InterChar],0 ;AN000; reset interim character flag 2/13/KK 205 TEST DI,Ddkey ;AN000; is this a dead key (interim char)? 2/13/KK 206 JZ NotInterim ;AN000; no, flag already reset... 2/13/KK 207 INC byte [InterChar] ;AN000; yes, set flag for future 2/13/KK 208 NotInterim: ;AN000; 2/13/KK 209 %ENDIF ;AN000; 0 00004C54 80FD05 CMP CH,DEVRDND 0 00004C57 7506 JNZ DNODRD 0 00004C59 A0[0000] MOV AL,BYTE PTR [IORCHR] 0 00004C5C A2[0000] MOV [DEVIOBUF],AL 214 0 00004C5F 8A26[0400] DNODRD: MOV AH,BYTE PTR [IOCALL + REQSTAT+1] 0 00004C63 F6D4 NOT AH ; Zero = busy, not zero = ready 0 00004C65 80E402 AND AH,STBUI >> 8 218 219 QuickReturn: ;AN000; 2/13/KK 0 00004C68 E8[0000] invoke restore_world 221 ASSUME DS:NOTHING 0 00004C6B 36A1[0000] MOV AX,WORD PTR [ss:DEVIOBUF] 0 00004C6F C3 return 224 225 ;IOTOFILEJ: 226 ; JMP SHORT IOTOFILE 227 %IF DBCS ;AN000; 228 ;------------------------------ Start of DBCS 2/13/KK 229 CHKERROUT: ;AN000; 230 MOV DS, DX ;AN000; 231 TEST word [SI + sf_flags], devid_device_con_out ;AN000; output to console ? 232 JNZ GOOD ;AN000; yes 233 CMP CL, 01 ;AN000; write interim ? 234 JNZ GOOD ;AN000; no, 235 POP CX ;AN000; 236 JMP SHORT QuickReturn ;AN000; avoid writting interims to other than 237 ;AN000; console device 238 GOOD: ;AN000; 239 PUSH SS ;AN000; 240 POP DS ;AN000; 241 JMP SETIN ;AN000; 242 ;------------------------------ End of DBCS 2/13/KK 243 %ENDIF ;AN000; 244 DevErr: 245 X25_Special equ X25_special ; NASM port equate 0 00004C70 36F706[0000]0008 TEST word [ss:DOS34_FLAG],X25_Special ;AN000; from disk.asm 0 00004C77 740D JZ notx25 ;AN000; no 0 00004C79 50 PUSH AX ;AN000; unknown command ? 0 00004C7A 89F8 MOV AX,DI ;AN000; 0 00004C7C 83E003 AND AX,error_I24_bad_command ;AN000; 0 00004C7F 3C03 CMP AL,error_I24_bad_command ;AN000; 0 00004C81 58 POP AX ;AN000; 0 00004C82 7502 JNZ notx25 ;AN000; no, then error 254 okDevIO equ OkDevIO ; NASM port label 0 00004C84 EBCA JMP okDevIO ;AN000; 256 notx25: 0 00004C86 88CC MOV AH,CL 0 00004C88 E8[0000] invoke CHARHARD 0 00004C8B 3C01 CMP AL,1 0 00004C8D 7506 JNZ NO_RETRY 0 00004C8F E8[0000] invoke restore_world 0 00004C92 E947FF JMP IOFUNC 263 264 NO_RETRY: 265 ; Know user must have wanted Ignore OR Fail. Make sure device shows ready 266 ; so that DOS doesn't get caught in a status loop when user simply wants 267 ; to ignore the error. 0 00004C95 368026[0400]FD AND BYTE PTR [ss:IOCALL + REQSTAT+1], ~ (STBUI >> 8) 269 OKDevIO equ OkDevIO ; NASM port label 0 00004C9B EBB3 JMP OKDevIO 271 272 IOTOFILE: 273 ASSUME DS:NOTHING 0 00004C9D 08E4 OR AH,AH 0 00004C9F 7423 JZ IOIN 0 00004CA1 FECC DEC AH 0 00004CA3 7405 JZ IOIST 0 00004CA5 FECC DEC AH 0 00004CA7 7411 JZ IOUT 0 00004CA9 C3 return ; NON ZERO FLAG FOR OUTPUT STATUS 281 282 IOIST: 0 00004CAA FF7415 PUSH WORD PTR [SI + sf_position] ; Save position 0 00004CAD FF7417 PUSH WORD PTR [SI + sf_position+2] 0 00004CB0 E81100 CALL IOIN 0 00004CB3 8F4417 POP WORD PTR [SI + sf_position+2] ; Restore position 0 00004CB6 8F4415 POP WORD PTR [SI + sf_position] 0 00004CB9 C3 return 289 290 IOUT: 0 00004CBA E82700 CALL SETXADDR 0 00004CBD E8[0000] invoke DOS_WRITE 0 00004CC0 E85400 CALL RESTXADDR ; If you change this into a jmp don't 0 00004CC3 C3 return ; come crying to me when things don't 295 ; work ARR 296 297 IOIN: 0 00004CC4 E81D00 CALL SETXADDR 0 00004CC7 36830E[0000]40 OR word [ss:DOS34_FLAG],Disable_EOF_I24 ;AN000; 0 00004CCD E8[0000] invoke DOS_READ 0 00004CD0 368326[0000]BF AND word [ss:DOS34_FLAG],NO_Disable_EOF_I24 ;AN000; 0 00004CD6 09C9 OR CX,CX ; Check EOF 0 00004CD8 E83C00 CALL RESTXADDR 0 00004CDB 36A0[0000] MOV AL,[ss:DEVIOBUF] ; Get byte from trans addr 0 00004CDF 75E2 retnz 0 00004CE1 B01A MOV AL,1AH ; ^Z if no bytes 0 00004CE3 C3 return 308 309 SETXADDR: 0 00004CE4 368F06[0000] POP WORD PTR [ss:CALLSCNT] ; Return address 0 00004CE9 E8[0000] invoke save_world 312 DMAADD equ DMAAdd ; NASM port label 0 00004CEC 36FF36[0000] PUSH WORD PTR [ss:DMAADD] ; Save Disk trans addr 0 00004CF1 36FF36[0200] PUSH WORD PTR [ss:DMAADD+2] 315 THISSFT equ ThisSFT ; NASM port label 0 00004CF6 368C1E[0200] MOV WORD PTR [ss:THISSFT+2],DS 0 00004CFB 161F Context DS 0 00004CFD 8936[0000] MOV WORD PTR [THISSFT],SI ; Finish setting SFT pointer 0 00004D01 8B0E[0200] MOV CX,WORD PTR [IOXAD+2] 0 00004D05 890E[0200] MOV WORD PTR [DMAADD+2],CX 0 00004D09 8B0E[0000] MOV CX,WORD PTR [IOXAD] 0 00004D0D 890E[0000] MOV WORD PTR [DMAADD],CX ; Set byte trans addr 0 00004D11 8B0E[0000] MOV CX,[IOSCNT] ; ioscnt specifies length of buffer 0 00004D15 EB0F JMP SHORT RESTRET ; RETURN ADDRESS 325 326 RESTXADDR: 327 DOSAssume CS,,"RestXAddr" 0 00004D17 8F06[0000] POP WORD PTR [CALLSCNT] ; Return address 0 00004D1B 8F06[0200] POP WORD PTR [DMAADD+2] ; Restore Disk trans addr 0 00004D1F 8F06[0000] POP WORD PTR [DMAADD] 0 00004D23 E8[0000] invoke restore_world 332 ASSUME DS:NOTHING 0 00004D26 36FF26[0000] RESTRET:JMP WORD PTR [ss:CALLSCNT] ; Return address 334 EndProc IOFUNC 335 336 Break 337 338 ; Inputs: 339 ; ES:DI Points to SFT 340 ; Function: 341 ; Issue an OPEN call to the correct device 342 ; Outputs: 343 ; None 344 ; ALL preserved 345 346 procedure DEV_OPEN_SFT,NEAR 346 ****************** warning: proc DEV_OPEN_SFT... [-w+user] 347 ASSUME DS:NOTHING,ES:NOTHING 348 349 Assert ISSFT,,"Dev_Open_SFT" 0 00004D2B E8[0000] invoke Save_World 0 00004D2E B00D MOV AL,DEVOPN 0 00004D30 EB05 JMP SHORT DO_OPCLS 353 354 EndProc DEV_OPEN_SFT 355 356 ; Inputs: 357 ; ES:DI Points to SFT 358 ; Function: 359 ; Issue a CLOSE call to the correct device 360 ; Outputs: 361 ; None 362 ; ALL preserved 363 364 procedure DEV_CLOSE_SFT,NEAR 364 ****************** warning: proc DEV_CLOSE_SFT... [-w+user] 365 ASSUME DS:NOTHING,ES:NOTHING 366 367 Assert ISSFT,,"Dev_Close_SFT" 0 00004D32 E8[0000] invoke Save_World 0 00004D35 B00E MOV AL,DEVCLS 370 371 ; 372 ; Main entry for device open and close. AL contains the function requested. 373 ; Subtlety: if Sharing is NOT loaded then we do NOT issue open/close to block 374 ; devices. This allows networks to function but does NOT hang up with bogus 375 ; change-line code. 376 ; 377 entry DO_OPCLS 378 ; 379 ; Is the SFT for the net? If so, no action necessary. 380 ; 0 00004D37 E8[0000] invoke Test_IFS_Remote ;AC000; 0 00004D3A 756C JNZ OPCLS_DONE ; NOP on net SFTs 0 00004D3C 30E4 XOR AH,AH ; Unit 0 00004D3E 26F745058000 TEST word [ES:DI + sf_flags],devid_device 0 00004D44 26C47D07 LES DI,[ES:DI + sf_devptr] ; Get DPB or device 386 Got_Dev_Addr equ GOT_DEV_ADDR ; NASM port label 0 00004D48 7513 JNZ Got_Dev_Addr 388 ; 389 ; We are about to call device open/close on a block driver. If no sharing 390 ; then just short circuit to done. 391 ; 392 ;;;;; invoke CheckShare 0 00004D4A 36803E[0000]01 CMP byte [ss:fshare],1 ;AN010; /NC or no SHARE 394 opCLs_Done equ OPCLS_DONE ; NASM port label 0 00004D50 7656 JBE opCLs_Done ;AN010; yes 0 00004D52 268A6501 MOV AH,[ES:DI + dpb_UNIT] 0 00004D56 268A0D MOV CL,[ES:DI + dpb_drive] 0 00004D59 26C47D13 LES DI,[ES:DI + dpb_driver_addr] ; Get device 399 GOT_DEV_ADDR: ; ES:DI -> device 0 00004D5D 26F745040008 TEST word [ES:DI + SDEVATT],DEVOPCL 0 00004D63 7443 JZ OPCLS_DONE ; Device can't 0 00004D65 06 PUSH ES 0 00004D66 1F POP DS 404 assume ds:nothing 0 00004D67 89FE MOV SI,DI ; DS:SI -> device 406 OPCLS_RETRY: 0 00004D69 1607 Context ES 408 DEVCALL equ DevCall ; NASM port label 0 00004D6B BF[0000] MOV DI,OFFSET DEVCALL wrt DOSGROUP 0 00004D6E 89FB MOV BX,DI 0 00004D70 50 PUSH AX 0 00004D71 B00D MOV AL,DOPCLHL 0 00004D73 AA STOSB ; Length 0 00004D74 58 POP AX 0 00004D75 86E0 XCHG AH,AL 0 00004D77 AA STOSB ; Unit 0 00004D78 86E0 XCHG AH,AL 0 00004D7A AA STOSB ; Command 0 00004D7B 26C7050000 MOV WORD PTR [ES:DI],0 ; Status 0 00004D80 50 PUSH AX ; Save Unit,Command 0 00004D81 E82B00 invoke DEVIOCALL2 0 00004D84 268B7F03 MOV DI,[ES:BX + REQSTAT] 0 00004D88 F7C70080 TEST DI,STERR 0 00004D8C 7419 JZ OPCLS_DONEP ; No error 0 00004D8E F744040080 TEST word [SI + SDEVATT],DEVTYP 0 00004D93 7404 JZ BLKDEV 0 00004D95 B486 MOV AH,86H ; Read error in data, Char dev 0 00004D97 EB04 JMP SHORT HRDERR 429 430 BLKDEV: 0 00004D99 88C8 MOV AL,CL ; Drive # in AL 0 00004D9B B406 MOV AH,6 ; Read error in data, Blk dev 433 HRDERR: 0 00004D9D E8[0000] invoke CHARHARD 0 00004DA0 3C01 CMP AL,1 0 00004DA2 7503 JNZ OPCLS_DONEP ; IGNORE or FAIL 437 ; Note that FAIL is essentually IGNORED 0 00004DA4 58 POP AX ; Get back Unit, Command 0 00004DA5 EBC2 JMP OPCLS_RETRY 440 441 OPCLS_DONEP: 0 00004DA7 58 POP AX ; Clean stack 443 OPCLS_DONE: 0 00004DA8 E8[0000] invoke Restore_World 0 00004DAB C3 return 446 447 EndProc DEV_CLOSE_SFT 448 449 Break 450 451 ; Inputs: 452 ; DS:SI Points to device SFT 453 ; ES:BX Points to request data 454 ; Function: 455 ; Call the device 456 ; Outputs: 457 ; DS:SI -> Device driver 458 ; DS:SI,AX destroyed, others preserved 459 460 procedure DEVIOCALL,NEAR 460 ****************** warning: proc DEVIOCALL... [-w+user] 461 ASSUME DS:NOTHING,ES:NOTHING 462 463 Assert ISSFT,,"DevIOCall" 0 00004DAC C57407 LDS SI,[SI + sf_devptr] 465 466 entry DEVIOCALL2 467 0 00004DAF E8[0000] EnterCrit critDevice 469 470 DevTyp equ DEVTYP ; NASM port equate 0 00004DB2 F744040080 TEST word [SI + SDEVATT],DevTyp ;AN000; >32mb block device ? 0 00004DB7 754F JNZ chardev2 ;AN000; >32mb no 0 00004DB9 26807F0204 CMP byte [ES:BX + REQFUNC],DEVRD ;AN000; >32mb read ? 0 00004DBE 740E JZ chkext ;AN000; >32mb yes 0 00004DC0 26807F0208 CMP byte [ES:BX + REQFUNC],DEVWRT ;AN000; >32mb write ? 0 00004DC5 7407 JZ chkext ;AN000; >32mb yes 0 00004DC7 26807F0209 CMP byte [ES:BX + REQFUNC],DEVWRTV;AN000; >32mb write/verify ? 0 00004DCC 753A JNZ chardev2 ;AN000; >32mb no 479 chkext: 0 00004DCE E89C00 CALL RW_SC ;AN000;LB. use secondary cache if there 0 00004DD1 7257 JC dev_exit ;AN000;LB. done 482 0 00004DD3 F744040200 TEST word [SI + SDEVATT],EXTDRVR ;AN000;>32mb extended driver? 0 00004DD8 741E JZ chksector ;AN000;>32mb no 0 00004DDA 26800708 ADD BYTE PTR [ES:BX],8 ;AN000;>32mb make length to 30 0 00004DDE 36A1[0000] MOV AX,[ss:CALLSSEC] ;AN000;>32mb 0 00004DE2 36C706[0000]FFFF MOV word [ss:CALLSSEC],-1 ;AN000;>32mb old sector =-1 0 00004DE9 36A3[0000] MOV WORD PTR [ss:CALLNEWSC],AX ;AN000;>32mb new sector = 0 00004DED 36A1[0000] MOV AX,[ss:HIGH_SECTOR] ;AN000; >32mb low sector,high sector 0 00004DF1 36A3[0200] MOV WORD PTR [ss:CALLNEWSC+2],AX ;AN000; >32mb 0 00004DF5 EB11 JMP chardev2 ;AN000; >32mb 0 00004DF7 90 nop ; identicalise 493 chksector: ;AN000; >32mb 0 00004DF8 36833E[0000]00 CMP word [ss:HIGH_SECTOR],0 ;AN000; >32mb if >32mb 0 00004DFE 7408 JZ chardev2 ;AN000; >32mb then fake error 496 ERROR_I24_NOT_DOS_DISK equ error_I24_not_DOS_disk ; NASM port equate 0 00004E00 26C747030781 MOV word [ES:BX + REQSTAT],STERR+STDON+ERROR_I24_NOT_DOS_DISK ;AN000; >32mb 0 00004E06 EB22 JMP SHORT dev_exit ;AN000; >32mb 499 500 chardev2: ;AN000; 501 ; As above only DS:SI points to device header on entry, and DS:SI is preserved 0 00004E08 8B4406 MOV AX,[SI + SDEVSTRAT] 503 CALLDEVAD equ CallDevAd ; NASM port label 0 00004E0B 36A3[0000] MOV WORD PTR [ss:CALLDEVAD],AX 0 00004E0F 368C1E[0200] MOV WORD PTR [ss:CALLDEVAD+2],DS 0 00004E14 36FF1E[0000] CALL far [ss:CALLDEVAD] 0 00004E19 8B4408 MOV AX,[SI + SDEVINT] 0 00004E1C 36A3[0000] MOV WORD PTR [ss:CALLDEVAD],AX 0 00004E20 36FF1E[0000] CALL far [ss:CALLDEVAD] 0 00004E25 E85B00 CALL VIRREAD ;AN000;LB. move data from SC to buffer 0 00004E28 72DE JC chardev2 ;AN000;LB. bad sector or exceeds max sec 512 dev_exit: 0 00004E2A E8[0000] LeaveCrit critDevice 0 00004E2D C3 return 515 EndProc DEVIOCALL 516 517 Break 518 519 ; Inputs: 520 ; DS:BX = Transfer Address 521 ; CX = Record Count 522 ; DX = Starting Record 523 ; AH = Media Byte 524 ; AL = Unit Code 525 ; Function: 526 ; Set up the device call header at DEVCALL 527 ; Output: 528 ; ES:BX Points to DEVCALL 529 ; No other registers effected 530 531 procedure SETREAD,NEAR 531 ****************** warning: proc SETREAD... [-w+user] 532 ASSUME DS:NOTHING,ES:NOTHING 533 0 00004E2E 57 PUSH DI 0 00004E2F 51 PUSH CX 0 00004E30 50 PUSH AX 0 00004E31 B104 MOV CL,DEVRD 538 SETCALLHEAD: 0 00004E33 B016 MOV AL,DRDWRHL 0 00004E35 16 PUSH SS 0 00004E36 07 POP ES 542 assume es:DOSGROUP 0 00004E37 BF[0000] MOV DI,OFFSET DEVCALL wrt DOSGROUP 0 00004E3A AA STOSB ; length 0 00004E3B 58 POP AX 0 00004E3C AA STOSB ; Unit 0 00004E3D 50 PUSH AX 0 00004E3E 88C8 MOV AL,CL 0 00004E40 AA STOSB ; Command code 0 00004E41 31C0 XOR AX,AX 0 00004E43 AB STOSW ; Status 0 00004E44 83C708 ADD DI,8 ; Skip link fields 0 00004E47 58 POP AX 0 00004E48 86E0 XCHG AH,AL 0 00004E4A AA STOSB ; Media byte 0 00004E4B 86C4 XCHG AL,AH 0 00004E4D 50 PUSH AX 0 00004E4E 89D8 MOV AX,BX 0 00004E50 AB STOSW 0 00004E51 8CD8 MOV AX,DS 0 00004E53 AB STOSW ; Transfer addr 0 00004E54 59 POP CX ; Real AX 0 00004E55 58 POP AX ; Real CX 0 00004E56 AB STOSW ; Count 0 00004E57 92 XCHG AX,DX ; AX=Real DX, DX=real CX, CX=real AX 0 00004E58 AB STOSW ; Start 0 00004E59 91 XCHG AX,CX 0 00004E5A 87D1 XCHG DX,CX 0 00004E5C 5F POP DI 0 00004E5D BB[0000] MOV BX,OFFSET DEVCALL wrt DOSGROUP 0 00004E60 C3 return 572 573 entry SETWRITE 574 ASSUME DS:NOTHING,ES:NOTHING 575 576 ; Inputs: 577 ; DS:BX = Transfer Address 578 ; CX = Record Count 579 ; DX = Starting Record 580 ; AH = Media Byte 581 ; AL = Unit Code 582 ; Function: 583 ; Set up the device call header at DEVCALL 584 ; Output: 585 ; ES:BX Points to DEVCALL 586 ; No other registers effected 587 0 00004E61 57 PUSH DI 0 00004E62 51 PUSH CX 0 00004E63 50 PUSH AX 0 00004E64 B108 MOV CL,DEVWRT 592 VERFLG equ VerFlg ; NASM port label 0 00004E66 36020E[0000] ADD CL,[ss:VERFLG] 0 00004E6B EBC6 JMP SHORT SETCALLHEAD 595 EndProc SETREAD 596 597 598 Break 599 600 ; Inputs: 601 ; [SC_CACHE_COUNT]= secondary cache count 602 ; [SC_STATUS]= SC validity status 603 ; [SEQ_SECTOR]= last sector read 604 ; Function: 605 ; Read from or write through secondary cache 606 ; Output: 607 ; ES:BX Points to DEVCALL 608 ; carry clear, I/O is not done 609 ; [SC_FLAG]=1 if continuos sectors will be read 610 ; carry set, I/O is done 611 612 613 procedure RW_SC,NEAR ;AN000; 613 ****************** warning: proc RW_SC... [-w+user] 614 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 615 616 %ifndef BUF2 617 CMP word [ss:SC_CACHE_COUNT],0 ;AN000;LB. secondary cache exists? 618 JZ scexit4 ;AN000;LB. no, do nothing 619 CMP word [ss:CALLSCNT],1 ;AN000;LB. sector count = 1 (buffer I/O) 620 JNZ scexit4 ;AN000;LB. no, do nothing 621 PUSH CX ;AN000;;LB. 622 PUSH DX ;AN000;;LB. yes 623 PUSH DS ;AN000;;LB. save registers 624 PUSH SI ;AN000;;LB. 625 PUSH ES ;AN000;;LB. 626 PUSH DI ;AN000;;LB. 627 MOV DX,WORD PTR [ss:CALLSSEC] ;AN000;;LB. starting sector 628 CMP BYTE PTR [ss:DEVCALL + REQFUNC],DEVRD ;AN000;LB. read ? ;AN000; 629 JZ doread ;AN000;LB. yes ;AN000; 630 CALL INVALIDATE_SC ;AN000;LB. invalidate SC ;AN000; 631 JMP strict near scexit2 ;AN000;LB. back to normal ;AN000; 632 %endif 633 scexit4: ;AN000; ;AN000; 0 00004E6D F8 CLC ;AN000;LB. I/O not done yet ;AN000; 0 00004E6E C3 return ;AN000;LB. ;AN000; 636 %ifndef BUF2 637 doread: ;AN000; ;AN000; 638 CALL SC2BUF ;AN000;LB. check if in SC ;AN000; 639 JC readSC ;AN000;LB. ;AN000; 640 MOV word [ss:DEVCALL + REQSTAT],STDON ;AN000;LB. fake done and ok ;AN000; 641 STC ;AN000;LB. set carry ;AN000; 642 JMP saveseq ;AN000;LB. save seq. sector # ;AN000; 643 nop ; identicalise 644 readSC: ;AN000; 645 MOV AX,WORD PTR [ss:HIGH_SECTOR] ;AN000;;LB. subtract sector num from 646 MOV CX,WORD PTR [ss:CALLSSEC] ;AN000;;LB. saved sequential sector 647 SUB CX,WORD PTR [ss:SEQ_SECTOR] ;AN000;;LB. number 648 SBB AX,WORD PTR [ss:SEQ_SECTOR+2] ;AN000;;LB. 649 CMP AX,0 ;AN000;;LB. greater than 64K 650 JNZ saveseq2 ;AN000;;LB. yes,save seq. sector # 651 chklow: ;AN000; 652 CMP CX,1 ;AN000;;LB. <= 1 653 JA saveseq2 ;AN000;;LB. no, not sequential 654 MOV word [ss:SC_STATUS],-1 ;AN000;;LB. prsume all SC valid 655 MOV AX,[ss:SC_CACHE_COUNT] ;AN000;;LB. yes, sequential 656 MOV [ss:CALLSCNT],AX ;AN000;;LB. read continuous sectors 657 readsr: 658 CALLXAD equ CallXAD ; NASM port label 659 MOV AX,WORD PTR [ss:CALLXAD+2] ;AN000;;LB. save buffer addr 660 MOV [ss:TEMP_VAR2],AX ;AN000;;LB. in temp vars 661 MOV AX,WORD PTR [ss:CALLXAD] ;AN000;;LB. 662 MOV [ss:TEMP_VAR],AX ;AN000;;LB. 663 ;AN000; 664 MOV AX,WORD PTR [ss:SC_CACHE_PTR] ;AN000;LB. use SC cache addr as ;AN000; 665 MOV WORD PTR [ss:CALLXAD],AX ;AN000;LB. transfer addr ;AN000; 666 MOV AX,WORD PTR [ss:SC_CACHE_PTR+2] ;AN000;LB. ;AN000; 667 MOV WORD PTR [ss:CALLXAD+2],AX ;AN000;LB. ;AN000; 668 MOV byte [ss:SC_FLAG],1 ;AN000;LB. flag it for later ;AN000; 669 MOV AL,[ss:SC_DRIVE] ;AN000;;LB. current drive 670 MOV [ss:CURSC_DRIVE],AL ;AN000;;LB. set current drive 671 MOV AX,WORD PTR [ss:CALLSSEC] ;AN000;;LB. current sector 672 MOV [ss:CURSC_SECTOR],AX ;AN000;;LB. set current sector 673 MOV AX,WORD PTR [ss:HIGH_SECTOR] ;AN000;;LB. 674 MOV [ss:CURSC_SECTOR+2],AX ;AN000;;LB. 675 saveseq2: ;AN000; 676 CLC ;AN000;LB. clear carry ;AN000; 677 saveseq: ;AN000; ;AN000; 678 MOV AX,[ss:HIGH_SECTOR] ;AN000;LB. save current sector # ;AN000; 679 MOV WORD PTR [ss:SEQ_SECTOR+2],AX ;AN000;LB. for access mode ref. ;AN000; 680 MOV AX,[ss:CALLSSEC] ;AN000;LB. ;AN000; 681 MOV WORD PTR [ss:SEQ_SECTOR],AX ;AN000;LB. ;AN000; 682 JMP scexit ;AN000;LB. ;AN000; 683 nop ; identicalise 684 ;AN000; 685 scexit2: ;AN000;LB. ;AN000; 686 CLC ;AN000;LB. clear carry ;AN000; 687 scexit: ;AN000; ;AN000; 688 POP DI ;AN000;;LB. 689 POP ES ;AN000;;LB. restore registers 690 POP SI ;AN000;;LB. 691 POP DS ;AN000;;LB. 692 POP DX ;AN000;;LB. 693 POP CX ;AN000;;LB. 694 return ;AN000;;LB. 695 %endif 696 ;AN000; 697 EndProc RW_SC ;AN000; 698 699 Break 700 701 ; Inputs: [SC_DRIVE]= requesting drive 702 ; [CURSC_DRIVE]= current SC drive 703 ; [CURSC_SECTOR] = starting scetor # of SC 704 ; [SC_CACHE_COUNT] = SC count 705 ; [HIGH_SECTOR]:DX= sector number 706 ; Function: 707 ; Check if the sector is in secondary cache 708 ; Output: 709 ; carry clear, in SC 710 ; CX= the index in the secondary cache 711 ; carry set, not in SC 712 ; 713 714 procedure IN_SC,NEAR ;AN000; 714 ****************** warning: proc IN_SC... [-w+user] 715 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 716 717 %ifndef BUF2 718 MOV AL,[ss:SC_DRIVE] ;AN000;;LB. current drive 719 CMP AL,[ss:CURSC_DRIVE] ;AN000;;LB. same as SC drive 720 JNZ outrange2 ;AN000;;LB. no 721 MOV AX,WORD PTR [ss:HIGH_SECTOR] ;AN000;;LB. subtract sector num from 722 MOV CX,DX ;AN000;;LB. secondary starting sector 723 SUB CX,WORD PTR [ss:CURSC_SECTOR] ;AN000;;LB. number 724 SBB AX,WORD PTR [ss:CURSC_SECTOR+2] ;AN000;;LB. 725 CMP AX,0 ;AN000;;LB. greater than 64K 726 JNZ outrange2 ;AN000;;LB. yes 727 CMP CX,[ss:SC_CACHE_COUNT] ;AN000;;LB. greater than SC count 728 JAE outrange2 ;AN000;;LB. yes 729 CLC ;AN000;;LB. clear carry 730 JMP short inexit ;AN000;;LB. in SC 731 outrange2: ;AN000;;LB. set carry 732 %endif 0 00004E6F F9 STC ;AN000;;LB. 734 inexit: ;AN000;;LB. 0 00004E70 C3 return ;AN000;;LB. 736 737 EndProc IN_SC ;AN000; 738 739 Break 740 741 ; Inputs: [SC_DRIVE]= requesting drive 742 ; [CURSC_DRIVE]= current SC drive 743 ; [CURSC_SECTOR] = starting scetor # of SC 744 ; [SC_CACHE_COUNT] = SC count 745 ; [SC_STAUS] = SC status word 746 ; [HIGH_SECTOR]:DX= sceotor number 747 ; 748 ; Function: 749 ; invalidate secondary cache if in there 750 ; Output: 751 ; [SC_STATUS] is updated 752 ; 753 754 procedure INVALIDATE_SC,NEAR ;AN000; 754 ****************** warning: proc INVALIDATE_SC... [-w+user] 755 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 756 0 00004E71 E8FBFF CALL IN_SC ;AN000;;LB. in secondary cache 0 00004E74 720C JC outrange ;AN000;;LB. no 0 00004E76 B80100 MOV AX,1 ;AN000;;LB. invalidate the sector 0 00004E79 D3E0 SHL AX,CL ;AN000;;LB. in the secondary cache 0 00004E7B F7D0 NOT AX ;AN000;;LB. 0 00004E7D 362106[0000] AND [ss:SC_STATUS],AX ;AN000;;LB. save the status 763 outrange: ;AN000;;LB. 0 00004E82 C3 return ;AN000;;LB. 765 766 EndProc INVALIDATE_SC ;AN000; 767 768 769 Break 770 771 ; Inputs: SC_FLAG = 0 , no sectors were read into SC 772 ; 1, continous sectors were read into SC 773 ; Function: 774 ; Move data from SC to buffer 775 ; Output: 776 ; carry clear, data is moved to buffer 777 ; carry set, bad sector or exceeds maximum sector 778 ; SC_FLAG =0 779 ; CALLSCNT=1 780 ; SC_STATUS= -1 if succeeded 781 ; 0 if failed 782 783 procedure VIRREAD,NEAR ;AN000; 783 ****************** warning: proc VIRREAD... [-w+user] 784 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 785 786 %ifndef BUF2 787 CMP byte [ss:SC_FLAG],0 ;AN000;;LB. from SC fill 788 JZ sc2end ;AN000;;LB. no 789 MOV AX,[ss:TEMP_VAR2] ;AN000;;LB. restore buffer addr 790 MOV WORD PTR [ss:CALLXAD+2],AX ;AN000;;LB. 791 MOV AX,[ss:TEMP_VAR] ;AN000;;LB. 792 MOV WORD PTR [ss:CALLXAD],AX ;AN000;;LB. 793 MOV byte [ss:SC_FLAG],0 ;AN000;;LB. reset sc_flag 794 MOV word [ss:CALLSCNT],1 ;AN000;;LB. one sector transferred 795 796 TEST word [ss:DEVCALL + REQSTAT],STERR ;AN000;;LB. error? 797 JNZ scerror ;AN000;;LB. yes 798 PUSH DS ;AN000;;LB. 799 PUSH SI ;AN000;;LB. 800 PUSH ES ;AN000;;LB. 801 PUSH DI ;AN000;;LB. 802 PUSH DX ;AN000;;LB. 803 PUSH CX ;AN000;;LB. 804 XOR CX,CX ;AN000;;LB. we want first sector in SC 805 CALL SC2BUF2 ;AN000;;LB. move data from SC to buffer 806 POP CX ;AN000;;LB. 807 POP DX ;AN000;;LB. 808 POP DI ;AN000;;LB. 809 POP ES ;AN000;;LB. 810 POP SI ;AN000;;LB. 811 POP DS ;AN000;;LB. 812 JMP SHORT sc2end ;AN000;;LB. return 813 814 scerror: ;AN000; 815 MOV word [ss:CALLSCNT],1 ;AN000;;LB. reset sector count to 1 816 MOV word [ss:SC_STATUS],0 ;AN000;;LB. invalidate all SC sectors 817 MOV byte [ss:CURSC_DRIVE],-1 ;AN000;;LB. invalidate drive 818 STC ;AN000;;LB. carry set 819 return ;AN000;;LB. 820 821 %endif 822 sc2end: ;AN000; 0 00004E83 F8 CLC ;AN000;;LB. carry clear 0 00004E84 C3 return ;AN000;;LB. 825 826 EndProc VIRREAD ;AN000; 827 828 Break 829 830 ; Inputs: [SC_STATUS] = SC validity status 831 ; [SC_SECTOR_SIZE] = request sector size 832 ; [SC_CACHE_PTR] = pointer to SC 833 ; Function: 834 ; Move data from SC to buffer 835 ; Output: 836 ; carry clear, in SC and data is moved 837 ; carry set, not in SC and data is not moved 838 839 procedure SC2BUF,NEAR ;AN000; 839 ****************** warning: proc SC2BUF... [-w+user] 840 ASSUME DS:NOTHING,ES:NOTHING ;AN000; 841 0 00004E85 E8E7FF CALL IN_SC ;AN000;;LB. in secondary cache 843 %ifndef BUF2 844 JC noSC ;AN000;;LB. no 845 MOV AX,1 ;AN000;;LB. check if valid sector 846 SHL AX,CL ;AN000;;LB. in the secondary cache 847 TEST [ss:SC_STATUS],AX ;AN000;;LB. 848 JZ noSC ;AN000;;LB. invalid 849 entry SC2BUF2 ;AN000; 850 MOV AX,CX ;AN000;;LB. times index with 851 MUL word [ss:SC_SECTOR_SIZE] ;AN000;;LB. sector size 852 ADD AX,WORD PTR [ss:SC_CACHE_PTR] ;AN000;;LB. add SC starting addr 853 ADC DX,WORD PTR [ss:SC_CACHE_PTR+2];AN000;;LB. 854 MOV DS,DX ;AN000; ;LB. DS:SI-> SC sector addr 855 MOV SI,AX ;AN000; ;LB. 856 MOV ES,WORD PTR [ss:CALLXAD+2] ;AN000; ;LB. ES:DI-> buffer addr 857 MOV DI,WORD PTR [ss:CALLXAD] ;AN000; ;LB. 858 MOV CX,[ss:SC_SECTOR_SIZE] ;AN000; ;LB. count= sector size 859 SHR CX,1 ;AN000; ;LB. may use DWORD move for 386 860 entry MOVWORDS ;AN000; 861 CMP byte [ss:DDMOVE],0 ;AN000; ;LB. 386 ? 862 JZ nodd ;AN000; ;LB. no 863 SHR CX,1 ;AN000; ;LB. words/2 864 DB 66H ;AN000; ;LB. use double word move 865 nodd: 866 REP MOVSW ;AN000; ;LB. move to buffer 867 CLC ;AN000; ;LB. clear carry 868 return ;AN000; ;LB. exit 869 %endif 870 noSC: ;AN000; 0 00004E88 F9 STC ;AN000; ;LB. set carry 872 sexit: ;AN000; 0 00004E89 C3 return ;AN000; ;LB. 874 875 EndProc SC2BUF 876 END 877 878 === Trace listing source: ../DOS/mknode.lst 1 ; SCCSID = @(#)mknode.asm 1.5 85/08/29 2 ;TITLE MKNODE - Node maker 3 ;NAME MKNODE 4 ; Low level routines for making a new local file system node 5 ; and filling in an SFT from a directory entry 6 ; 7 ; BUILDDIR 8 ; SETDOTENT 9 ; MakeNode 10 ; NEWENTRY 11 ; FREEENT 12 ; NEWDIR 13 ; DOOPEN 14 ; RENAME_MAKE 15 ; CHECK_VIRT_OPEN 16 ; 17 ; Revision history: 18 ; 19 ; AN000 version 4.0 Jan. 1988 20 ; A004 PTM 3680 --- Make SFT NAME field offset same as 3.30 21 22 ; 23 ; get the appropriate segment definitions 24 ; 25 [list -] 25 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 ****************** <4> warning: redefining multi-line macro `__@@_next' [-w+pp-macro-redef-multi] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 28 %include "fastopen.mac" 1 <1> ; 2 <1> ; EXPORT DATE: 9/11 3 <1> ;Equates for FASTOPEN. 4 <1> 5 <1> ;FASTOPEN NAME CACHING Subfunctions 6 <1> FONC_Look_up equ 1 7 <1> FONC_insert equ 2 8 <1> FONC_delete equ 3 9 <1> FONC_update equ 4 10 <1> FONC_purge equ 5 ;reserved for the future use. 11 <1> 12 <1> ;FASTOPEN EXTENT CACHING Subfunctions 13 <1> FSK_Open equ 11 ;AN000; 14 <1> FSK_Close equ 12 ;AN000; 15 <1> FSK_Delete equ 13 ;AN000; 16 <1> FSK_Lookup equ 14 ;AN000; 17 <1> FSK_Insert equ 15 ;AN000; 18 <1> FSK_Trunc equ 16 ;AN000; 19 <1> 20 <1> HeaderSize equ 8 ; size of file header (8 bytes) ;AN000; 21 <1> ExtendSize equ 8 ; size of extend (8 bytes) ;AN000; 22 <1> Num_Of_Pages equ 1 ; number of pages ;AN000; 23 <1> Num_Of_Segs equ 2 ; number of frame segments ;AN000; 24 <1> Stayresident equ 04ch ; terminate and stay resident function code 25 <1> 26 <1> 27 <1> ;Equates used in DOS. 28 <1> FastOpen_Set equ 00000001B 29 <1> FastOpen_Reset equ 11111110B 30 <1> Lookup_Success equ 00000010B 31 <1> Lookup_Reset equ 11111101B 32 <1> Special_Fill_Set equ 00000100B 33 <1> Special_Fill_Reset equ 11111011B 34 <1> No_Lookup equ 00001000B 35 <1> Set_For_Search equ 00010000B ;DCR 167 36 <1> 37 <1> 38 <1> ;============= FastOpen Data Structures ===================== 39 <1> 40 <1> Fastopen_Entry STRUC ;Fastopen Entry pointer in DOS 0 00001640 ???? Fastopen_Entry_size dw ? ;size of the following 0 00001642 ???????? Fastopen_Name_Caching dd ? 43 <1> ;Fastopen_FatChain_Caching dd ? ;reserved for future use 44 <1> Fastopen_Entry ENDS 45 <1> ; 46 <1> 47 <1> 48 <1> CMPCT_DIR_INFO STRUC ;compact version of Dir Info. 49 00000000 <1> CDI_file_name db 11 dup (?) 0 0000164B ?? CDI_file_attr db ? 0 0000164C ???? CDI_codepage dw ? 0 0000164E ???? CDI_extcluster dw ? 0 00001650 ?? CDI_attr2 db ? 0 00001651 ???? CDI_time dw ? 0 00001653 ???? CDI_date dw ? 0 00001655 ???? CDI_cluster dw ? 0 00001657 ???????? CDI_filesize dd ? 58 <1> CMPCT_DIR_INFO ENDS 59 <1> ; 60 <1> 61 <1> ORIG_DIR_INFO STRUC 62 00000000 <1> ODI_head db 17 dup (?) 0 00001651 ?????????? ODI_skip db 5 dup (?) ;reserved for DOS. FASTOPEN does not 64 00000016 <1> ODI_tail db 10 dup (?) ; use ODI_skip part. 65 <1> ORIG_DIR_INFO ENDS 66 <1> ; 67 <1> 68 <1> ODI_head_leng equ 17 69 <1> ODI_skip_leng equ 5 70 <1> ODI_tail_leng equ 10 71 <1> ; 72 <1> 73 <1> FASTOPEN_EXTENDED_INFO STRUC 0 00001640 ?? FEI_dirpos db ? 0 00001641 ???????? FEI_dirsec dd ? 0 00001645 ???? FEI_clusnum dw ? 0 00001647 ???? FEI_lastent dw ? ; for search first 0 00001649 ???? FEI_dirstart dw ? ; for search first 79 <1> FASTOPEN_EXTENDED_INFO ENDS 80 <1> ; 81 <1> 82 <1> NAME_RECORD STRUC 0 00001640 ???? nLRU_ptr dw ? 0 00001642 ???? nMRU_ptr dw ? ;reverse of nLRU_ptr 0 00001644 ???? nChild_ptr dw ? 0 00001646 ???? nSibling_ptr dw ? 0 00001648 ???? nBackward_ptr dw ? ;points to preceding node 88 <1> Cmpct_Dir_Info_struc_size equ CMPCT_DIR_INFO_struc_size ; NASM port equate 89 0000000A <1> nCmpct_Dir_Info db Cmpct_Dir_Info_struc_size dup (?) 90 <1> Fastopen_Extended_Info_struc_size equ FASTOPEN_EXTENDED_INFO_struc_size ; NASM port equate 91 00000025 <1> nExtended_Info db Fastopen_Extended_Info_struc_size dup (?) 92 <1> NAME_RECORD ENDS 93 <1> ; 94 <1> 95 <1> DRIVE_CACHE_HEADER STRUC ;drive cache header 0 00001640 ???? DCH_LRU_ROOT dw ? ;Header of the LRU chain of this drive 0 00001642 ???? DCH_MRU_ROOT dw ? ;offset to the last entry of LRU chain 0 00001644 ???? DCH_Child_ptr dw ? ;the first child in Name cache seg. 0 00001646 ???? DCH_Sibling_ptr dw ? ;points to the next drive cache header 0 00001648 ?? DCH_Drive_letter db ? ;drive letter 0 00001649 ???? DCH_Num_Entries dw ? ;Number of entries in the Name cache. 0 0000164B ???? DCH_Name_Buff dw ? ;pointer to name cahe buffer 103 <1> DRIVE_CACHE_HEADER ENDS 104 <1> ; 105 <1> 106 <1> 107 <1> 108 <1> 109 <1> 110 <1> ;======== FAST SEEK FUNCTION DATA STRUCTURES ======================= 111 <1> 112 <1> DRIVE_HEADER STRUC ; Drive header structure ;AN000; 0 00001640 ???? Drive_Number dw ? ; drive number ;AN000; 0 00001642 ???? Extent_Count dw ? ; reserved for debugging 0 00001644 ???? MRU_Hdr_Ptr dw ? ; pointer to OPEN Queue 0 00001646 ???? Free_ptr dw ? ; pointer to FREE buffer ;AN000; 0 00001648 ???? Close_Ptr dw ? ; pointer to CLOSE Queue ;AN000; 0 0000164A ???? Buff_Size dw ? ; cache buffer size including header ;AN000; 0 0000164C ???? Free_Size dw ? ; size of Free area in bytes 0 0000164E ???? Next_Drv_Hdr_Ptr dw ? ; pointer to next drive header 121 <1> DRIVE_HEADER ENDS 122 <1> 123 <1> 124 <1> 125 <1> FILE_HEADER STRUC ; File header structure ;AN000; 0 00001640 ???? FH_Phys_Clus_Num dw ? ; starting physcial clustnum of file ;AN000; 0 00001642 ???? FH_Refer_Count dw ? ; reference count ;AN000; 0 00001644 ???? FH_Next_Extn_Ptr dw ? ; pointer to first extent of the file;AN000; 0 00001646 ???? FH_Next_Hdr_Ptr dw ? ; pointer to next file header ;AN000; 0 00001648 ???? FH_MRU_Extn_Ptr dw ? ; pointer to MRU extent 0 0000164A ???? dw ? 0 0000164C ???? dw ? 0 0000164E ???? dw ? 134 <1> FILE_HEADER ENDS ;AN000; 135 <1> 136 <1> 137 <1> 138 <1> EXTENT_HEADER STRUC ; extend header structure ;AN000; 0 00001640 ???? EH_Logic_Clus_Num dw ? ; starting logical clus num of extent;AN000; 0 00001642 ???? EH_Phys_Clus_Num dw ? ; starting physical clus numof extnt;AN000; 0 00001644 ???? EH_Count dw ? ; range of logical clusnum in the extnt 0 00001646 ???? EH_Next_Extn_Ptr dw ? ; pointer to next extent ;AN000; 0 00001648 ???? EH_Prev_Extn_Ptr dw ? ; pointer to previous extent ;AN000; 0 0000164A ???? EH_Next_LRU_Ptr dw ? ; pointer to next LRU extent 0 0000164C ???? EH_Prev_LRU_Ptr dw ? ; pointer tp previous LRU extent 0 0000164E ???? dw ? 147 <1> EXTENT_HEADER ENDS 148 <1> 149 <1> 150 <1> 29 30 [list +] === Switch to base=002450h -> "DOSCODECODE" 31 section DOSCODECODE 32 [list -] 32 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 32 ****************** warning: out: BPB.INC... [-w+user] 32 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 32 ****************** warning: out: DEVSYM.INC... [-w+user] 39 40 i_need EntFree,WORD 41 i_need DirStart,WORD 42 i_need LastEnt,WORD 43 i_need ClusNum,WORD 44 i_need CurBuf,DWORD 45 i_need Attrib,BYTE 46 i_need VolID,BYTE 47 i_need Name1,BYTE 48 i_need ThisDPB,DWORD 49 i_need EntLast,WORD 50 i_need Creating,BYTE 51 i_need SecClusPos,BYTE 52 i_need ClusFac,BYTE 53 i_need Cluster_Factor_EDR,WORD 54 i_need NxtClusNum,WORD 55 i_need DirSec,WORD 56 i_need NoSetDir,BYTE 57 i_need THISSFT,DWORD 58 i_need SATTRIB,BYTE 59 i_need ALLOWED,BYTE 60 i_need FAILERR,BYTE 61 i_need VIRTUAL_OPEN 62 I_need FastOpen_Ext_info,BYTE ; DOS 3.3 63 I_need FastOpenFlg,BYTE ; DOS 3.3 64 I_need CPSWFLAG,BYTE ;FT. DOS 3.4 ;AN000; 65 I_need EXTOPEN_ON,BYTE ;FT. DOS 3.4 ;AN000; 66 I_need EXTOPEN_FLAG,WORD ;FT. DOS 3.4 ;AN000; 67 I_need EXTOPEN_IO_MODE,WORD ;FT. DOS 3.4 ;AN000; 68 I_need HIGH_SECTOR,WORD ;>32mb ;AN000; 69 %ifndef BUF2 70 I_need ACT_PAGE,WORD ;>32mb ;AN000; 71 %endif 72 73 assume nocheck, ss:DOSGROUP 74 75 Break 76 77 ; Inputs: 78 ; ES:BP Points to DPB 79 ; [THISSFT] Set if using NEWDIR entry point 80 ; (used by ALLOCATE) 81 ; [LASTENT] current last valid entry number in directory if no free 82 ; entries 83 ; [DIRSTART] Points to first cluster of dir (0 means root) 84 ; Function: 85 ; Grow directory if no free entries and not root 86 ; Outputs: 87 ; CARRY SET IF FAILURE 88 ; ELSE 89 ; AX entry number of new entry 90 ; If a new dir [DIRSTART],[CLUSFAC],[CLUSNUM],[DIRSEC] set 91 ; AX = first entry of new dir 92 ; GETENT should be called to set [LASTENT] 93 94 procedure BUILDDIR,NEAR 94 ****************** warning: proc BUILDDIR... [-w+user] 95 DOSAssume CS,,"BuildDir" 96 ASSUME ES:NOTHING 97 98 ENTFREE equ EntFree ; NASM port label 0 00004E8A A1[0000] MOV AX,[ENTFREE] 0 00004E8D 83F8FF CMP AX,-1 0 00004E90 7402 JZ CHECK_IF_ROOT 0 00004E92 F8 CLC 0 00004E93 C3 return 104 105 CHECK_IF_ROOT: 106 DIRSTART equ DirStart ; NASM port label 0 00004E94 833E[0000]00 CMP word [DIRSTART],0 0 00004E99 7502 JNZ NEWDIR 0 00004E9B F9 STC 0 00004E9C C3 return ; Can't grow root 111 112 entry NEWDIR 0 00004E9D 8B1E[0000] MOV BX,[DIRSTART] 0 00004EA1 09DB OR BX,BX 0 00004EA3 7405 JZ NULLDIR 0 00004EA5 E8[0000] invoke GETEOF 0 00004EA8 72F2 retc ; Screw up 118 NULLDIR: 0 00004EAA B90100 MOV CX,1 0 00004EAD E8[0000] invoke ALLOCATE 0 00004EB0 72EA retc 0 00004EB2 8B16[0000] MOV DX,[DIRSTART] 0 00004EB6 09D2 OR DX,DX 0 00004EB8 750D JNZ ADDINGDIR 0 00004EBA E8[0000] invoke SETDIRSRCH 0 00004EBD 72DD retc 127 LASTENT equ LastEnt ; NASM port label 0 00004EBF C706[0000]FFFF MOV word [LASTENT],-1 0 00004EC5 EB2B JMP SHORT GOTDIRREC 130 ADDINGDIR: 0 00004EC7 53 PUSH BX 0 00004EC8 8B1E[0000] MOV BX,[ClusNum] 0 00004ECC E8[0000] Invoke IsEof 0 00004ECF 5B POP BX 0 00004ED0 7219 JB NOTFIRSTGROW 136 ;;;; 10/17/86 update CLUSNUM in the fastopen cache 137 CLUSNUM equ ClusNum ; NASM port label 0 00004ED2 891E[0000] MOV [CLUSNUM],BX 0 00004ED6 51 PUSH CX 0 00004ED7 50 PUSH AX 0 00004ED8 55 PUSH BP 0 00004ED9 B401 MOV AH,1 ; CLUSNUM update 0 00004EDB 268A5600 MOV DL,[ES:BP + dpb_drive] ; drive # 0 00004EDF 8B0E[0000] MOV CX,[DIRSTART] ; first cluster # 0 00004EE3 89DD MOV BP,BX ; CLUSNUM 0 00004EE5 E8[0000] invoke FastOpen_Update 0 00004EE8 5D POP BP 0 00004EE9 58 POP AX 0 00004EEA 59 POP CX 150 151 ;;;; 10/17/86 update CLUSNUM in the fastopen cache 152 NOTFIRSTGROW: 0 00004EEB 89DA MOV DX,BX 0 00004EED 30DB XOR BL,BL 0 00004EEF E8[0000] invoke FIGREC 156 GOTDIRREC: 0 00004EF2 268A4E04 MOV CL,[ES:BP + dpb_cluster_mask] 0 00004EF6 30ED XOR CH,CH 0 00004EF8 41 inc cx 160 ZERODIR: 0 00004EF9 51 PUSH CX 162 allowed_FAIL equ Allowed_FAIL ; NASM port equate 163 allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 00004EFA C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00004EFF B0FF MOV AL,0FFH 0 00004F01 E8[0000] invoke GETBUFFR 0 00004F04 7302 JNC GET_SSIZE 0 00004F06 59 POP CX 0 00004F07 C3 return 170 171 GET_SSIZE: 0 00004F08 268B4E02 MOV CX,[ES:BP + dpb_sector_size] 0 00004F0C 06 PUSH ES 174 CURBUF equ CurBuf ; NASM port label 0 00004F0D C43E[0000] LES DI,[CURBUF] 0 00004F11 26804D0504 OR byte [ES:DI + buf_flags],buf_isDIR 0 00004F16 57 PUSH DI 0 00004F17 83C710 ADD DI,BUFINSIZ 0 00004F1A 31C0 XOR AX,AX 0 00004F1C D1E9 SHR CX,1 0 00004F1E F3AB REP STOSW 0 00004F20 7301 JNC EVENZ 0 00004F22 AA STOSB 184 EVENZ: 0 00004F23 5F POP DI 186 0 00004F24 26F6450540 TEST byte [ES:DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00004F29 7508 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 00004F2B E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00004F2E 26804D0540 OR byte [ES:DI + buf_flags],buf_dirty 191 yesdirty: 0 00004F33 07 POP ES 193 assume es:DPB 0 00004F34 59 POP CX 0 00004F35 42 INC DX 0 00004F36 7504 jnz @F 0 00004F38 FF06[0000] inc word ptr [HIGH_SECTOR] 198 @@: 0 00004F3C E2BB LOOP ZERODIR 0 00004F3E A1[0000] MOV AX,[LASTENT] 0 00004F41 40 INC AX 0 00004F42 F8 CLC 0 00004F43 C3 return 204 205 EndProc BUILDDIR 206 207 ; 208 ; set up a . or .. directory entry for a directory. 209 ; 210 ; Inputs: ES:DI point to the beginning of a directory entry. 211 ; AX contains ". " or ".." 212 ; DX contains first cluster of entry 213 ; 214 procedure SETDOTENT,NEAR 214 ****************** warning: proc SETDOTENT... [-w+user] 215 DOSAssume CS,,"SetDotEnt" 216 ; 217 ; Fill in name field 218 ; 0 00004F44 AB STOSW 0 00004F45 B90400 MOV CX,4 0 00004F48 B82020 MOV AX," " 0 00004F4B F3AB REP STOSW 0 00004F4D AA STOSB 224 ; 225 ; Set up attribute 226 ; 0 00004F4E B010 MOV AL,attr_directory 228 errnz dir_attr-(dir_name+11) 0 00004F50 AA STOSB 230 ; 231 ; Initialize time and date of creation 232 ; 0 00004F51 83C70A ADD DI,10 0 00004F54 8B36[0000] MOV SI,WORD PTR [THISSFT] 0 00004F58 8B440D MOV AX,[SI + sf_time] 236 errnz dir_time-(dir_attr+1+10) 0 00004F5B AB STOSW 0 00004F5C 8B440F MOV AX,[SI + sf_date] 239 errnz dir_date-(dir_time+2) 0 00004F5F AB STOSW 241 ; 242 ; Set up first cluster field 243 ; 0 00004F60 89D0 MOV AX,DX 245 errnz dir_first-(dir_date+2) 0 00004F62 AB STOSW 247 ; 248 ; 0 file size 249 ; 0 00004F63 31C0 XOR AX,AX 251 errnz dir_size_l-(dir_first+2) 0 00004F65 AB STOSW 0 00004F66 AB STOSW 254 errnz <(dir_entry_struc_size)-(dir_size_l+4)> 0 00004F67 C3 return 256 EndProc SETDOTENT 257 258 Break 259 260 ; Inputs: 261 ; AL - attribute to create 262 ; AH = 0 if it is ok to truncate a file already by this name 263 ; AH = Non 0 if this is an error 264 ; (AH ignored on dirs and devices) 265 ; NOTE: When making a DIR or volume ID, AH need not be set since 266 ; a name already existant is ALWAYS an error in these cases. 267 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL 268 ; terminated) 269 ; [CURR_DIR_END] Points to end of Current dir part of string 270 ; ( = -1 if current dir not involved, else 271 ; Points to first char after last "/" of current dir part) 272 ; [THISCDS] Points to CDS being used 273 ; [THISSFT] Points to an empty SFT. EXCEPT sf_mode filled in. 274 ; Function: 275 ; Make a new node 276 ; Outputs: 277 ; Sets EXTERR_LOCUS = errLOC_Disk or errLOC_Unk via GetPathNoset 278 ; CARRY SET IF ERROR 279 ; AX = 1 A node by this name exists and is a directory 280 ; AX = 2 A new node could not be created 281 ; AX = 3 A node by this name exists and is a disk file 282 ; (AH was NZ on input) 283 ; AX = 4 Bad Path 284 ; SI return from GetPath maintained 285 ; AX = 5 Attribute mismatch 286 ; AX = 6 Sharing Violation 287 ; (INT 24 generated ALWAYS since create is always compat mode 288 ; AX = 7 file not found for Extended Open (not exists and fails) 289 ; ELSE 290 ; AX = 0 Disk Node 291 ; AX = 3 Device Node (error in some cases) 292 ; [DIRSTART],[DIRSEC],[CLUSFAC],[CLUSNUM] set to directory 293 ; containing new node. 294 ; [CURBUF+2]:BX Points to entry 295 ; [CURBUF+2]:SI Points to entry.dir_first 296 ; [THISSFT] is filled in 297 ; sf_mode = unchanged. 298 ; Attribute byte in entry is input AL 299 ; DS preserved, others destroyed 300 301 procedure MakeNode,NEAR 301 ****************** warning: proc MakeNode... [-w+user] 302 DOSAssume CS,,"MakeNode" 303 ASSUME ES:NOTHING 304 305 CREATING equ Creating ; NASM port label 0 00004F68 C706[0000]FFE5 MOV WORD PTR [CREATING],0E5FFH ; Creating, not DEL *.* 0 00004F6E 50 PUSH AX ; Save AH value 0 00004F6F C606[0000]00 MOV byte [NoSetDir],0 0 00004F74 A2[0000] MOV [SATTRIB],AL 0 00004F77 E8[0000] invoke GetPathNoSet 0 00004F7A 88CA MOV DL,CL ; Save CL info 0 00004F7C 89C1 MOV CX,AX ; Device ID to CH 0 00004F7E 58 POP AX ; Get back AH 0 00004F7F 7330 JNC make_exists ; File existed 0 00004F81 7505 JNZ make_err_4 ; Path bad 0 00004F83 80FA80 CMP DL,80H ; Check "CL" return from GETPATH 0 00004F86 7406 JZ make_type ; Name simply not found, and no metas 318 make_err_4: 0 00004F88 B004 MOV AL,4 ; case 1 bad path 320 make_err_ret: 0 00004F8A 30E4 XOR AH,AH 0 00004F8C F9 STC 0 00004F8D C3 return 324 325 entry RENAME_MAKE ; Used by DOS_RENAME to "copy" a node 326 327 make_type: 328 ;Extended Open hooks 0 00004F8E F606[0000]01 TEST byte [EXTOPEN_ON],ext_open_on ;FT. from extended open ;AN000; 0 00004F93 7412 JZ make_type2 ;FT. no ;AN000; 0 00004F95 800E[0000]04 OR byte [EXTOPEN_ON],ext_file_not_exists ;FT. set for extended open ;AN000; 0 00004F9A F706[0000]F000 TEST word [EXTOPEN_FLAG],0F0H ;FT. not exists and fails ;AN000; 0 00004FA0 7505 JNZ make_type2 ;FT. no ;AN000; 0 00004FA2 F9 STC ;FT. set carry ;AN000; 0 00004FA3 B80700 MOV AX,7 ;FT. file not found ;AN000; 0 00004FA6 C3 return ;FT. ;AN000; 337 make_type2: 338 ;Extended Open hooks 0 00004FA7 C43E[0000] LES DI,[THISSFT] 340 ; MOV [ES:DI.sf_mode],sharing_compat + open_for_both 0 00004FAB 31C0 XOR AX,AX ; nothing exists Disk Node 0 00004FAD F9 STC ; Not found 0 00004FAE EB5B JMP make_new 0 00004FB0 90 nop ; identicalise 345 346 ; 347 ; The node exists. It may be either a device, directory or file: 348 ; Zero set => directory 349 ; High bit of CH on => device 350 ; else => file 351 make_exists: 0 00004FB1 7448 JZ make_exists_dir 0 00004FB3 B003 MOV AL,3 ; file exists type 3 (error or device node) 354 ATTRIB equ Attrib ; NASM port label 0 00004FB5 F606[0000]18 TEST BYTE PTR [ATTRIB],(attr_volume_id+attr_directory) 0 00004FBA 753B JNZ make_err_ret_5 ; Cannot already exist as Disk or Device Node 357 ; if making DIR or Volume ID 0 00004FBC 08ED OR CH,CH 0 00004FBE 781A JS make_share ; No further checks on attributes if device 0 00004FC0 08E4 OR AH,AH 0 00004FC2 75C6 JNZ make_err_ret ; truncating NOT OK (AL = 3) 0 00004FC4 51 PUSH CX ; Save device ID 0 00004FC5 8E06[0200] MOV ES,WORD PTR [CURBUF+2] 364 assume es:nothing 0 00004FC9 268A6F0B MOV CH,[ES:BX+dir_attr] ; Get file attributes 0 00004FCD F6C501 TEST CH,attr_read_only 0 00004FD0 7524 JNZ make_err_ret_5P ; Cannot create on read only files 0 00004FD2 E8[0000] invoke MatchAttributes 0 00004FD5 59 POP CX ; Devid back in CH 0 00004FD6 751F JNZ make_err_ret_5 ; Attributes not ok 0 00004FD8 30C0 XOR AL,AL ; AL = 0, Disk Node 372 make_share: 0 00004FDA 30E4 XOR AH,AH 0 00004FDC 50 PUSH AX ; Save Disk or Device node 0 00004FDD 51 PUSH CX ; Save Device ID 0 00004FDE 88EC MOV AH,CH ; Device ID to AH 0 00004FE0 E84701 CALL DOOPEN ; Fill in SFT for share check 0 00004FE3 C43E[0000] LES DI,[THISSFT] 379 ; MOV [ES:DI.sf_mode],sharing_compat + open_for_both 0 00004FE7 5653 SaveReg ; Save CURBUF pointers 0 00004FE9 E8[0000] invoke ShareEnter 0 00004FEC 735A jnc MakeEndShare 383 ; 384 ; User failed request. 385 ; 0 00004FEE 5B5E5958 RestoreReg 387 Make_Share_ret: 0 00004FF2 B006 MOV AL,6 0 00004FF4 EB94 JMP make_err_ret 390 391 make_err_ret_5P: 0 00004FF6 59 POP CX ; Get back device ID 393 make_err_ret_5: 0 00004FF7 B005 MOV AL,5 ; Attribute mismatch 0 00004FF9 EB8F JMP make_err_ret 396 397 make_exists_dir: 0 00004FFB B001 MOV AL,1 ; exists as directory, always an error 0 00004FFD EB8B JMP make_err_ret 400 401 make_save: 0 00004FFF 50 PUSH AX ; Save whether Disk or File 0 00005000 89C8 MOV AX,CX ; Device ID to AH 404 NewEntry equ NEWENTRY ; NASM port label 0 00005002 E87400 CALL NewEntry 0 00005005 58 POP AX ; 0 if Disk, 3 if File 0 00005006 739E retnc 0 00005008 B002 MOV AL,2 ; create failed case 2 0 0000500A C3 return 410 411 make_new: 0 0000500B E8F1FF call make_save 0 0000500E 72FA retc ; case 2 fail 0 00005010 F606[0000]10 TEST BYTE PTR [ATTRIB],attr_directory 0 00005015 75F3 retnz ; Don't "open" directories, so don't 416 ; tell the sharer about them 0 00005017 505356 SaveReg ; Save AL code 0 0000501A E8[0000] invoke ShareEnter 0 0000501D 5E5B58 RestoreReg 0 00005020 73E8 retnc 421 ; 422 ; We get here by having the user FAIL a share problem. Typically a failure of 423 ; this nature is an out-of-space or an internal error. We clean up as best as 424 ; possible: delete the newly created directory entry and return share_error. 425 ; 0 00005022 50 PUSH AX 0 00005023 C43E[0000] LES DI,[CurBuf] 0 00005027 26C607E5 MOV BYTE PTR [ES:BX],0E5H ; nuke newly created entry. 429 0 0000502B 26F6450540 TEST byte [ES:DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00005030 7508 JNZ yesdirty2 ;LB. don't increment dirty count ;AN000; 0 00005032 E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00005035 26804D0540 OR byte [ES:DI + buf_flags],buf_dirty ; flag buffer as dirty 434 yesdirty2: 0 0000503A C42E[0000] LES BP,[ThisDPB] 436 DPB_Drive equ dpb_drive ; NASM port equate 0 0000503E 268A4600 MOV AL,[ES:BP + DPB_Drive] ; get drive for flush 0 00005042 E8[0000] Invoke FlushBuf ; write out buffer. 0 00005045 58 POP AX 440 make_Share_ret equ Make_Share_ret ; NASM port label 0 00005046 EBAA jmp make_Share_ret 442 ; 443 ; We have found an existing file. We have also entered it into the share set. 444 ; At this point we need to call newentry to correctly address the problem of 445 ; getting rid of old data (create an existing file) or creating a new 446 ; directory entry (create a new file). Unfortunately, this operation may 447 ; result in an INT 24 that the user doesn't return from, thus locking the file 448 ; irretrievably into the share set. The correct solution is for us to LEAVE 449 ; the share set now, do the operation and then reassert the share access. 450 ; 451 ; We are allowed to do this! There is no window! After all, we are in 452 ; critDisk here and for someone else to get in, they must enter critDisk also. 453 ; 454 MakeEndShare: 455 ThisSFT equ THISSFT ; NASM port label 0 00005048 C43E[0000] LES DI,[ThisSFT] ; grab SFT 0 0000504C 31C0 XOR AX,AX 0 0000504E E8[0000] EnterCrit critSFT 0 00005051 268705 XCHG AX,[ES:DI + sf_ref_count] 0 00005054 505706 SaveReg 0 00005057 9C PUSHF 0 00005058 E8[0000] invoke ShareEnd ; remove sharing 0 0000505B 9D POPF 0 0000505C 075F268F05 RestoreReg 0 00005061 E8[0000] LeaveCrit critSFT 0 00005064 5B5E5958 RestoreReg 0 00005068 E894FF CALL make_save 468 ; 469 ; If the user failed, we do not reenter into the sharing set. 470 ; 0 0000506B 729D retc ; bye if error 0 0000506D 505356 SaveReg 0 00005070 9C PUSHF 0 00005071 E8[0000] invoke ShareEnter 0 00005074 9D POPF 0 00005075 5E5B58 RestoreReg 477 ; 478 ; If Share_check fails, then we have an internal ERROR!!!!! 479 ; 0 00005078 C3 return 481 EndProc MakeNode 481 ****************** warning: ***** Possible stack size error in MakeNode ***** [-w+user] 482 483 ; Inputs: 484 ; [THISSFT] set 485 ; [THISDPB] set 486 ; [LASTENT] current last valid entry number in directory if no free 487 ; entries 488 ; [VOLID] set if a volume ID was found during search 489 ; [ATTRIB] Contains attributes for new file 490 ; [DIRSTART] Points to first cluster of dir (0 means root) 491 ; CARRY FLAG INDICATES STATUS OF SEARCH FOR FILE 492 ; NC means file existed (device) 493 ; C means file did not exist 494 ; AH = Device ID byte 495 ; If FILE 496 ; [CURBUF+2]:BX points to start of directory entry 497 ; [CURBUF+2]:SI points to dir_first of directory entry 498 ; If device 499 ; DS:BX points to start of "fake" directory entry 500 ; DS:SI points to dir_first of "fake" directory entry 501 ; (has DWORD pointer to device header) 502 ; Function: 503 ; Make a new directory entry 504 ; If an old one existed it is truncated first 505 ; Outputs: 506 ; Carry set if error 507 ; Can't grow dir, atts didn't match, attempt to make 2nd 508 ; vol ID, user FAILed to I 24 509 ; else 510 ; outputs of DOOPEN 511 ; DS, BX, SI preserved (meaning on SI BX, not value), others destroyed 512 513 procedure NEWENTRY,NEAR 513 ****************** warning: proc NEWENTRY... [-w+user] 514 DOSAssume CS,,"NewEntry" 515 ASSUME ES:NOTHING 516 517 THISDPB equ ThisDPB ; NASM port label 0 00005079 C42E[0000] LES BP,[THISDPB] 519 ASSUME ES:NOTHING 0 0000507D 7316 JNC EXISTENT 0 0000507F 803E[0000]00 CMP byte [FAILERR],0 0 00005084 F9 STC 0 00005085 75F1 retnz ; User FAILed, node might exist 0 00005087 E800FE CALL BUILDDIR ; Try to build dir 0 0000508A 72EC retc ; Failed 0 0000508C E8[0000] invoke GETENT ; Point at that free entry 0 0000508F 72E7 retc ; Failed 0 00005091 EB0E JMP SHORT FREESPOT 529 530 ERRRET3: 0 00005093 F9 STC 0 00005094 C3 return 533 534 EXISTENT: 535 DOSAssume CS,,"MKNODE/ExistEnt" 0 00005095 08E4 OR AH,AH ; Check if file is I/O device 0 00005097 7903 JNS NOT_DEV1 0 00005099 E98E00 JMP DOOPEN ; If so, proceed with open 539 540 NOT_DEV1: 0 0000509C E82A01 invoke FREEENT ; Free cluster chain 0 0000509F 72F3 retc ; Failed 543 FREESPOT: 0 000050A1 F606[0000]08 TEST BYTE PTR [ATTRIB],attr_volume_id 0 000050A6 7407 JZ NOTVOLID 546 VOLID equ VolID ; NASM port label 0 000050A8 803E[0000]00 CMP BYTE PTR [VOLID],0 0 000050AD 75E4 JNZ ERRRET3 ; Can't create a second volume ID 549 NOTVOLID: 0 000050AF 8E06[0200] MOV ES,WORD PTR [CURBUF+2] 551 assume es:nothing 0 000050B3 89DF MOV DI,BX 553 NAME1 equ Name1 ; NASM port label 0 000050B5 BE[0000] MOV SI,OFFSET NAME1 wrt DOSGROUP 0 000050B8 B90500 MOV CX,5 0 000050BB F3A5 REP MOVSW 0 000050BD A4 MOVSB ; Move name into dir entry 0 000050BE A0[0000] MOV AL,[ATTRIB] 559 errnz dir_attr-(dir_name+11) 0 000050C1 AA STOSB ; Attributes 561 ;; File Tagging for Create DOS 4.00 0 000050C2 B105 MOV CL,5 ;FT. assume normal ;AN000; 563 ; CMP [CPSWFLAG],0 ;FT. code page matching on ;AN000; 564 ; JZ NORMFT ;FT. no, make null code page ;AN000; 565 ; invoke Get_Global_CdPg ;FT. get global code page ;AN000; 566 ; STOSW ;FT. tag this file with global code page ;AN000; 567 ; DEC CL ;FT. only 4 ;AN000; 568 ;NORMFT: ;FT. ;AN000; 569 570 ;; File Tagging for Create DOS 4.00 0 000050C4 31C0 XOR AX,AX 0 000050C6 F3AB REP STOSW ; Zero pad 0 000050C8 E8[0000] invoke DATE16 0 000050CB 92 XCHG AX,DX 575 errnz dir_time-(dir_attr+1+2*5) 0 000050CC AB STOSW ; dir_time 0 000050CD 92 XCHG AX,DX 578 errnz dir_date-(dir_time+2) 0 000050CE AB STOSW ; dir_date 0 000050CF 31C0 XOR AX,AX 0 000050D1 57 PUSH DI ; Correct SI input value (recomputed for new buffer) 582 583 errnz dir_first-(dir_date+2) 0 000050D2 AB STOSW ; Zero dir_first and size 585 errnz dir_size_l-(dir_first+2) 0 000050D3 AB STOSW 0 000050D4 AB STOSW 588 updnxt: 589 errnz <(dir_entry_struc_size)-(dir_size_l+4)> 0 000050D5 8B36[0000] MOV SI,WORD PTR [CURBUF] 591 0 000050D9 26F6440540 TEST byte [ES:SI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 000050DE 7508 JNZ yesdirty3 ;LB. don't increment dirty count ;AN000; 0 000050E0 E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 000050E3 26804C0540 OR byte [ES:SI + buf_flags],buf_dirty 596 yesdirty3: 0 000050E8 C42E[0000] LES BP,[THISDPB] 0 000050EC 268A4600 MOV AL,[ES:BP + dpb_drive] ; Sets AH value again (in AL) 0 000050F0 50 PUSH AX 0 000050F1 53 PUSH BX 601 ; If we have a file, we need to increment the open ref. count so that 602 ; we have some protection against invalid media changes if an Int 24 603 ; error occurs. 604 ; Do nothing for a device. 0 000050F2 0657 SaveReg 0 000050F4 C43E[0000] LES DI,[THISSFT] 0 000050F8 26F745058000 test word [es:di + sf_flags],devid_device 0 000050FE 751A jnz GotADevice 0 00005100 1E53 SaveReg 0 00005102 C51E[0000] LDS BX,[THISDPB] 0 00005106 26895D07 MOV word ptr [ES:DI + sf_devptr],BX 0 0000510A 8CDB MOV BX,DS 0 0000510C 26895D09 MOV word ptr [ES:DI + sf_devptr+2],BX 0 00005110 5B1F RestoreReg ; need to use DS for segment later on 0 00005112 E8[0000] invoke Dev_Open_SFT ; increment ref. count 0 00005115 C606[0000]01 mov byte [VIRTUAL_OPEN],1; set flag 617 GotADevice: 0 0000511A 5F07 RestoreReg 619 620 %ifdef BUF2 0 0000511C E8[0000] invoke FLUSHBUF 622 %else 623 PUSH word [ACT_PAGE] ;LB. save EMS page for curbuf ;AN000; 624 invoke FLUSHBUF 625 POP BX ;LB. restore EMS page for curbuf ;AN000; 626 PUSHF ;LB. save flushbuf falg ;AN000; 627 CMP BX,-1 ;BL-NETWORK PTM #-? 628 JE Page_ok ;BL-NETWORK PTM #-? 629 invoke SET_MAP_PAGE ;LB. remap curbuf ;AN000; 630 Page_ok: ;BL-NETWORK PTM #-? 631 POPF ;LB. restore flush flag ;AN000; 632 %endif 0 0000511F E8F900 Call CHECK_VIRT_OPEN ; decrement ref. count ;AN000; 0 00005122 5B POP BX 0 00005123 58 POP AX 0 00005124 5E POP SI ; Get SI input back 0 00005125 88C4 MOV AH,AL ; Get I/O driver number back 0 00005127 7301C3 retc ; Failed 639 640 641 ;NOTE FALL THROUGH 642 643 ; Inputs: 644 ; [THISDPB] points to DPB if file 645 ; [THISSFT] points to SFT being used 646 ; AH = Device ID byte 647 ; If FILE 648 ; [CURBUF+2]:BX points to start of directory entry 649 ; [CURBUF+2]:SI points to dir_first of directory entry 650 ; If device 651 ; DS:BX points to start of "fake" directory entry 652 ; DS:SI points to dir_first of "fake" directory entry 653 ; (has DWORD pointer to device header) 654 ; Function: 655 ; Fill in SFT from dir entry 656 ; Outputs: 657 ; CARRY CLEAR 658 ; sf_ref_count and sf_mode fields not altered 659 ; sf_flags high byte = 0 660 ; sf_flags low byte = AH except 661 ; sf_flags Bit 6 set (not dirty or not EOF) 662 ; sf_attr sf_date sf_time sf_name set from entry 663 ; sf_position = 0 664 ; If device 665 ; sf_devptr = dword at dir_first (pointer to device header) 666 ; sf_size = 0 667 ; If file 668 ; sf_firclus sf_size set from entry 669 ; sf_devptr = [THISDPB] 670 ; sf_cluspos = 0 671 ; sf_lstclus = sf_firclus 672 ; sf_dirsec sf_dirpos set 673 ; DS,SI,BX preserved, others destroyed 674 675 entry DOOPEN 676 DOSAssume CS,,"DoOpen" 677 ASSUME ES:NOTHING 678 679 ; 680 ; Generate and store attribute 681 ; 0 0000512A 88E6 MOV DH,AH ; AH to different place 0 0000512C C43E[0000] LES DI,[THISSFT] 0 00005130 83C704 ADD DI,sf_attr ; Skip ref_count and mode fields 0 00005133 30C0 XOR AL,AL ; Assume it's a device, devices have an 686 ; attribute of 0 (for R/O testing etc). 0 00005135 08F6 OR DH,DH ; See if our assumption good. 0 00005137 7807 JS DEV_SFT1 ; If device DS=DOSGROUP 0 00005139 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 690 ASSUME DS:NOTHING 0 0000513D 8A470B MOV AL,[BX + dir_attr] ; If file, get attrib from dir entry 692 DEV_SFT1: 0 00005140 AA STOSB ; sf_attr, ES:DI -> sf_flags 694 ; 695 ; Generate and store flags word 696 ; 0 00005141 31C0 XOR AX,AX 0 00005143 88F0 MOV AL,DH 0 00005145 0C40 OR AL,devid_file_clean 0 00005147 AB STOSW ; sf_flags, ES:DI -> sf_devptr 701 ; 702 ; Generate and store device pointer 703 ; 0 00005148 1E PUSH DS 0 00005149 C5471A LDS AX,[BX + dir_first] ; Assume device 706 assume ds:nothing 0 0000514C 08F6 OR DH,DH 0 0000514E 7805 JS DEV_SFT2 0 00005150 36C506[0000] LDS AX,[ss:THISDPB] ; Was file 710 assume ds:DPB 711 DEV_SFT2: 0 00005155 AB STOSW ; store offset 0 00005156 8CD8 MOV AX,DS 0 00005158 1F POP DS 715 assume ds:nothing 0 00005159 AB STOSW ; store segment 717 ; ES:DI -> sf_firclus 718 ; 719 ; Generate pointer to, generate and store first cluster (irrelevant for 720 ; devices) 721 ; 0 0000515A 56 PUSH SI ; Save pointer to dir_first 0 0000515B A5 MOVSW ; dir_first -> sf_firclus 724 ; DS:SI -> dir_size_l, ES:DI -> sf_time 725 ; 726 ; Copy time/date of last modification 727 ; 0 0000515C 83EE06 SUB SI,dir_size_l - dir_time ; DS:SI->dir_time 0 0000515F A5 MOVSW ; dir_time -> sf_time 730 ; DS:SI -> dir_date, ES:DI -> sf_date 0 00005160 A5 MOVSW ; dir_date -> sf_date 732 ; DS:SI -> dir_first, ES:DI -> sf_size 733 ; 734 ; Generate and store file size (0 for devices) 735 ; 0 00005161 AD LODSW ; skip dir_first, DS:SI -> dir_size_l 0 00005162 AD LODSW ; dir_size_l in AX , DS:SI -> dir_size_h 0 00005163 89C1 MOV CX,AX ; dir_size_l in CX 0 00005165 AD LODSW ; dir_size_h (size AX:CX), DS:SI -> ???? 0 00005166 08F6 OR DH,DH 0 00005168 7904 JNS FILE_SFT1 0 0000516A 31C0 XOR AX,AX 0 0000516C 89C1 MOV CX,AX ; Devices are open ended 744 FILE_SFT1: 0 0000516E 91 XCHG AX,CX 0 0000516F AB STOSW ; Low word of sf_size 0 00005170 91 XCHG AX,CX 0 00005171 AB STOSW ; High word of sf_size 749 ; ES:DI -> sf_position 750 ; 751 ; Initialize position to 0 752 ; 0 00005172 31C0 XOR AX,AX 0 00005174 AB STOSW 0 00005175 AB STOSW ; sf_position 756 ; ES:DI -> sf_cluspos 757 ; 758 ; Generate cluster optimizations for files 759 ; 0 00005176 08F6 OR DH,DH 0 00005178 7840 JS DEV_SFT3 0 0000517A AB STOSW ; sf_cluspos 0 0000517B 8B471A MOV AX,[BX + dir_first] 764 ;;;; STOSW ; sf_lstclus 0 0000517E 2689451A MOV [ES:DI - sf_dirsec + sf_lstclus],AX ;AN004; save it 766 767 768 ; DOS 3.3 FastOpen 6/13/86 769 0 00005182 1E PUSH DS 0 00005183 161F context DS 0 00005185 F606[0000]04 TEST byte [FastOpenFlg],Special_Fill_Set 0 0000518A 7412 JZ Not_FastOpen 774 FastOpen_Ext_Info equ FastOpen_Ext_info ; NASM port label 0 0000518C BE[0000] MOV SI,OFFSET FastOpen_Ext_Info wrt DOSGROUP 0 0000518F 8B4401 MOV AX,WORD PTR [SI + FEI_dirsec] 0 00005192 AB STOSW ; sf_dirsec 0 00005193 8B4403 MOV AX,WORD PTR [SI + FEI_dirsec+2] ;;; changed for >32mb 0 00005196 AB STOSW ; sf_dirsec 0 00005197 8A04 MOV AL,[SI + FEI_dirpos] 0 00005199 AA STOSB ; sf_dirpos 0 0000519A 1F POP DS 783 assume ds:nothing 0 0000519B EB1B JMP Next_Name 0 0000519D 90 nop ; identicalise 786 787 ; DOS 3.3 FastOpen 6/13/86 788 789 Not_FastOpen: 0 0000519E 1F POP DS ; normal path 791 ASSUME DS:NOTHING 0 0000519F 368B36[0000] MOV SI,WORD PTR [ss:CURBUF] ; DS:SI->buffer header 0 000051A4 8B4408 MOV AX,WORD PTR [SI + buf_sector] ;F.C. >32mb ;AN000; 0 000051A7 AB STOSW ; sf_dirsec ;F.C. >32mb ;AN000; 0 000051A8 8B440A MOV AX,WORD PTR [SI + buf_sector+2] ;F.C. >32mb ;AN000; 0 000051AB AB STOSW ; sf_dirsec ;F.C. >32mb ;AN000; 0 000051AC 89D8 MOV AX,BX 0 000051AE 83C610 ADD SI,BUFINSIZ ; DS:SI-> start of data in buffer 0 000051B1 29F0 SUB AX,SI ; AX = BX relative to start of sector 0 000051B3 B120 MOV CL,dir_entry_struc_size 0 000051B5 F6F1 DIV CL 0 000051B7 AA STOSB ; sf_dirpos 803 804 Next_Name: 805 errnz sf_name-(sf_dirpos+1) 0 000051B8 EB03 JMP SHORT FILE_SFT2 807 808 DEV_SFT3: 0 000051BA 83C707 ADD DI,sf_name - sf_cluspos 810 FILE_SFT2: 811 ; 812 ; Copy in the object's name 813 ; 0 000051BD 89DE MOV SI,BX ; DS:SI points to dir_name 0 000051BF B90B00 MOV CX,11 0 000051C2 F3A4 REP MOVSB ; sf_name 0 000051C4 5E POP SI ; recover DS:SI -> dir_first 818 ;; File tagging , code page and XA cluster must be after name 819 ; MOV AX,[BX.dir_CODEPG] ;FT. set file's code page ;AN000; 820 ; STOSW ;FT. ;AN000; 821 ; MOV AX,[BX.dir_EXTCLUSTER] ;FT. set XA cluster ;AN000; 822 ; STOSW ;FT. ;AN000; 823 ; MOV AX,[EXTOPEN_IO_MODE] ;FT. extended open ;AN000; 824 ; STOSW ;FT. ;AN000; 825 ; MOV AL,[BX.dir_attr2] ;FT. high attribute ;AN000; 826 ; STOSB ;FT. ;AN000; 827 828 ;; File tagging , code page and XA cluster must be after name 829 0 000051C5 161F context DS 0 000051C7 F8 CLC 0 000051C8 C3 return 833 834 EndProc NEWENTRY 835 836 ; Inputs: 837 ; ES:BP -> DPB 838 ; [CURBUF] Set 839 ; [CURBUF+2]:BX points to directory entry 840 ; [CURBUF+2]:SI points to above dir_first 841 ; Function: 842 ; Free the cluster chain for the entry if present 843 ; Outputs: 844 ; Carry set if error (currently user FAILed to I 24) 845 ; (NOTE dir_firclus and dir_size_l/h are wrong) 846 ; DS BX SI ES BP preserved (BX,SI in meaning, not value) others destroyed 847 848 procedure FREEENT,NEAR 848 ****************** warning: proc FREEENT... [-w+user] 849 DOSAssume CS,,"FreeEnt" 850 ASSUME ES:NOTHING 851 0 000051C9 1E PUSH DS 0 000051CA C53E[0000] LDS DI,[CURBUF] 854 ASSUME DS:NOTHING 0 000051CE 8B0C MOV CX,[SI] ; Get pointer to clusters 0 000051D0 8B550A MOV DX,WORD PTR [DI + buf_sector+2] ;F.C. >32mb ;AN000; 0 000051D3 368916[0000] MOV [ss:HIGH_SECTOR],DX ;F.C. >32mb ;AN000; 0 000051D8 8B5508 MOV DX,WORD PTR [DI + buf_sector] 0 000051DB 1F POP DS 860 DOSAssume CS,,"MKNODE/FreeEnt" 0 000051DC 83F902 CMP CX,2 0 000051DF 7238 JB RET1 ; Was 0 length file (or mucked Firclus if CX=1) 0 000051E1 263B4E0D CMP CX,[ES:BP + dpb_max_cluster] 0 000051E5 7732 JA RET1 ; Treat like zero length file (firclus mucked) 0 000051E7 29FB SUB BX,DI 0 000051E9 53 PUSH BX ; Save offset 0 000051EA FF36[0000] PUSH word [HIGH_SECTOR] ;F.C. >32mb ;AN000; 0 000051EE 52 PUSH DX ; Save sector number 869 0 000051EF 89CB MOV BX,CX 0 000051F1 E8[0000] invoke Delete_FSeek ; FS. delete Fastseek Clusters ;AN000; 0 000051F4 E8[0000] invoke RELEASE ; Free any data allocated 0 000051F7 5A POP DX 0 000051F8 8F06[0000] POP word [HIGH_SECTOR] ;F.C. >32mb ;AN000; 0 000051FC 7302 JNC GET_BUF_BACK 0 000051FE 5B POP BX 0 000051FF C3 return ; Screw up 878 879 GET_BUF_BACK: 880 0 00005200 C606[0000]18 MOV byte [ALLOWED],allowed_RETRY + allowed_FAIL 0 00005205 30C0 XOR AL,AL 0 00005207 E8[0000] invoke GETBUFFR ; Get sector back 0 0000520A 5B POP BX ; Get offset back 0 0000520B 72F2 retc 0 0000520D E8[0000] invoke SET_BUF_AS_DIR 0 00005210 031E[0000] ADD BX,WORD PTR [CURBUF] ; Correct it for new buffer 0 00005214 89DE MOV SI,BX 0 00005216 83C61A ADD SI,dir_first ; Get corrected SI 890 RET1: 0 00005219 F8 CLC 0 0000521A C3 return 893 EndProc FREEENT 894 895 ; 896 ; CHECK_VIRT_OPEN checks to see if we had performed a "virtual open" (by 897 ; examining the flag [VIRTUAL_OPEN] to see if it is 1). If we did, then 898 ; it calls Dev_Close_SFT to decrement the ref. count. It also resets the 899 ; flag [VIRTUAL_OPEN]. 900 ; No registers affected (including flags). 901 ; On input, [THISSFT] points to current SFT. 902 ; 903 Procedure CHECK_VIRT_OPEN,NEAR 903 ****************** warning: proc CHECK_VIRT_OPEN... [-w+user] 904 DOSAssume CS,,"Check_Virt_Open" 905 0 0000521B 50 PUSH AX 0 0000521C 9F lahf ; preserve flags 0 0000521D 803E[0000]00 CMP byte [VIRTUAL_OPEN],0 0 00005222 7410 JZ ALL_CLOSED 0 00005224 C606[0000]00 mov byte [VIRTUAL_OPEN],0 ; reset flag 0 00005229 0657 SaveReg 0 0000522B C43E[0000] LES DI,[THISSFT] 0 0000522F E8[0000] INVOKE DEV_CLOSE_SFT 0 00005232 5F07 RestoreReg 915 916 ALL_CLOSED: 0 00005234 9E sahf ; restore flags 0 00005235 58 POP AX 0 00005236 C3 return 920 921 EndProc CHECK_VIRT_OPEN 922 923 END 924 925 === Trace listing source: ../DOS/rom.lst 1 ; SCCSID = @(#)rom.asm 1.1 85/04/10 2 ;TITLE ROM - Miscellaneous routines 3 ;NAME ROM 4 ; Misc Low level routines for doing simple FCB computations, Cache 5 ; reads and writes, I/O optimization, and FAT allocation/deallocation 6 ; 7 ; SKPCLP 8 ; FNDCLUS 9 ; BUFSEC 10 ; BUFRD 11 ; BUFWRT 12 ; NEXTSEC 13 ; OPTIMIZE 14 ; FIGREC 15 ; ALLOCATE 16 ; RESTFATBYT 17 ; RELEASE 18 ; RELBLKS 19 ; GETEOF 20 ; 21 ; Modification history: 22 ; 23 ; Created: ARR 30 March 1983 24 ; 25 26 ; 27 ; get the appropriate segment definitions 28 ; 29 [list -] 29 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 ****************** <4> warning: redefining multi-line macro `__@@_next' [-w+pp-macro-redef-multi] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 32 %include "fastseek.mac" ; DOS 4.00 1 <1> ; 2 <1> ;Equates for FASTSEEK. 3 <1> ; 4 <1> ;FASTSEEK flags 5 <1> ; 6 <1> FS_begin equ 00000001B 7 <1> FS_end equ 11111110B 8 <1> FS_insert equ 00000010B 9 <1> FS_no_insert equ 11111101B 10 <1> 11 <1> ;FASTSEEK EXTENT CACHING Subfunctions 12 <1> FSEC_open equ 11 13 <1> FSEC_close equ 12 14 <1> FSEC_delete equ 13 15 <1> FSEC_lookup equ 14 16 <1> FSEC_insert equ 15 17 <1> FSEC_truncate equ 16 18 <1> ; 19 <1> ;Equates used in DOS. 20 <1> 21 <1> 22 <1> ; 33 %include "fastxxxx.mac" ; DOS 4.00 1 <1> ; Fastxxx equates 2 <1> FastOpen_ID equ 1 3 <1> FastSeek_ID equ 2 4 <1> Fast_yes equ 10000000B ; fastxxx flag 5 <1> 6 <1> ;Structure definitions 7 <1> ; 8 <1> Fasttable_Entry struc ; Fastxxx Entry pointer in DOS 0 00001640 ???? Fast_Entry_Num dw ? ; number of entries 0 00001642 ???????? FastOpen_Seek dd ? ; fastopen & fastseek entry address 11 <1> Fasttable_Entry ends 12 <1> ; 34 %include "version.mac" 1 <1> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <1> TRUE EQU 0FFFFh 3 <1> TRUEBYTE EQU 0FFh 4 <1> FALSE EQU 0 5 <1> 6 <1> ; 7 <1> ; Use the following switches to control cmacros.inc 8 <1> ; 9 <1> ?PLM equ 0 10 <1> ?WIN equ 0 11 <1> 12 <1> memS EQU 1 ; Small model 13 <1> ; 14 <1> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <1> ; version of the operating system 16 <1> ; 17 <1> ; The below chart will indicate how to set the switches to build the various 18 <1> ; versions 19 <1> ; 20 <1> ; IBMVER IBMCOPYRIGHT 21 <1> ; -------------------------------------------------------- 22 <1> ; IBM Version | TRUE TRUE 23 <1> ; -------------------------------------------------------- 24 <1> ; MS Version | FALSE FALSE 25 <1> ; -------------------------------------------------------- 26 <1> ; Clone Version | TRUE FALSE 27 <1> ; 28 <1> IBMVER EQU TRUE 29 <1> IBMCOPYRIGHT EQU FALSE 30 <1> 31 <1> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <1> 33 <1> %ifndef MSVER 34 <1> MSVER EQU ~ IBMVER 35 <1> %endif 36 <1> IBM EQU IBMVER 37 <1> ; 38 <1> ; 39 <1> %IF IBMVER 40 <1> %IF IBMCOPYRIGHT 41 <1> %warning out: ... IBM version build switch on ... 42 <1> %ELSE 43 <1> %warning out: ... CLONE version build switch on ... 43 ****************** <1> warning: out: ... CLONE version build switch on ... [-w+user] 44 <1> %ENDIF 45 <1> %ELSE 46 <1> %IFN IBMCOPYRIGHT 47 <1> %warning out: ... MS version build switch on ... 48 <1> %ELSE 49 <1> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <1> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <1> %ENDIF 52 <1> %ENDIF 53 <1> ; 54 <1> ; 55 <1> ;*************************************************************************** 56 <1> ;* The following switches are for DBCS or SBCS support * 57 <1> ;* * 58 <1> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <1> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <1> ;* * 61 <1> ;*************************************************************************** 62 <1> ; 63 <1> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <1> 65 <1> ; 66 <1> ; Switch INTERNAT for DBCS support 67 <1> ; 68 <1> INTERNAT EQU FALSE 69 <1> ; 70 <1> %IF INTERNAT 71 <1> %ifndef KANJI 72 <1> KANJI EQU TRUE 73 <1> %endif 74 <1> IBMJAPAN EQU TRUE 75 <1> %ELSE 76 <1> %ifndef KANJI 77 <1> KANJI EQU FALSE 78 <1> %endif 79 <1> IBMJAPAN EQU FALSE 80 <1> %ENDIF 81 <1> 82 <1> %ifndef altvect ; avoid jerking off vector.inc 83 <1> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <1> %endif 85 <1> 86 <1> ; 87 <1> ; Country code switches 88 <1> ; The default contry code is assumed as USA. 89 <1> ; 90 <1> %IF INTERNAT 91 <1> KOREA EQU TRUE 92 <1> JAPAN EQU FALSE 93 <1> %ELSE 94 <1> KOREA EQU FALSE 95 <1> JAPAN EQU FALSE 96 <1> %ENDIF 97 <1> ; 98 <1> %IF INTERNAT 99 <1> %warning out: Internat(ECS) version build switch on 100 <1> %ENDIF 35 36 [list +] === Switch to base=002450h -> "DOSCODECODE" 37 section DOSCODECODE 38 [list -] 38 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 38 ****************** warning: out: BPB.INC... [-w+user] 38 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 38 ****************** warning: out: DEVSYM.INC... [-w+user] 46 47 i_need CLUSNUM,WORD 48 i_need NEXTADD,WORD 49 i_need LASTPOS,WORD 50 i_need SECCLUSPOS,BYTE 51 i_need FATBYT,WORD 52 i_need THISSFT,DWORD 53 i_need TRANS,BYTE 54 i_need BYTCNT1,WORD 55 i_need CURBUF,DWORD 56 i_need BYTSECPOS,WORD 57 i_need DMAADD,WORD 58 i_need SECPOS,DWORD ;F.C. >32mb 59 i_need VALSEC,DWORD ;F.C. >32mb 60 i_need ALLOWED,BYTE 61 i_need FSeek_drive,BYTE ; DOS 3.4 62 i_need FSeek_firclus,WORD ; DOS 3.4 63 i_need FSeek_logclus,WORD ; DOS 3.4 64 i_need FSeek_logsave,WORD ; DOS 3.4 65 i_need FastSeekFlg,BYTE ; DOS 3.4 66 i_need XA_condition,BYTE ; DOS 3.4 67 i_need HIGH_SECTOR,WORD ; DOS 3.4 68 i_need DISK_FULL,BYTE ; DOS 3.4 69 i_need Temp_VAR2,WORD ; DOS 3.4 70 i_need Cluster_Next_EDR,WORD 71 72 73 assume nocheck, ss:DOSGROUP 74 75 Break 76 77 ; Inputs: 78 ; CX = No. of clusters to skip 79 ; ES:BP = Base of drive parameters 80 ; [THISSFT] point to SFT 81 ; Outputs: 82 ; BX = Last cluster skipped to 83 ; CX = No. of clusters remaining (0 unless EOF) 84 ; DX = Position of last cluster 85 ; Carry set if error (currently user FAILed to I 24) 86 ; DI destroyed. No other registers affected. 87 88 procedure FNDCLUS,NEAR 88 ****************** warning: proc FNDCLUS... [-w+user] 89 DOSAssume CS,,"FndClus" 90 ASSUME ES:NOTHING 91 92 Assert ISDPB,,"FndCLus" 93 ;; 10/31/86 FastSeek 0 00005237 06 PUSH ES 0 00005238 C43E[0000] LES DI,[THISSFT] 96 Assert ISSFT,,"FndClus" 0 0000523C 890E[0000] MOV [FSeek_logclus],CX ; presume CX is the position ;AN000; 0 00005240 268B5D35 MOV BX,[ES:DI + sf_lstclus] 0 00005244 268B5519 MOV DX,[ES:DI + sf_cluspos] 100 ;; 10/31/86 FastSeek 0 00005248 85DB test BX,BX 0 0000524A 7503 JNZ YCLUS 0 0000524C E9A000 JMP NOCLUS 104 YCLUS: 0 0000524F 29D1 SUB CX,DX 0 00005251 7308 JNB FINDIT 0 00005253 01D1 ADD CX,DX 0 00005255 31D2 XOR DX,DX 0 00005257 268B5D0B MOV BX,[ES:DI + sf_firclus] 110 FINDIT: 111 ;; 10/31/86 FastSeek 112 113 0 0000525B 07 POP ES 115 assume es:DPB 0 0000525C 85C9 test CX,CX 117 skpclp equ SKPCLP ; NASM port label 0 0000525E 7503 JNZ skpclp 0 00005260 E98500 JMP RET10 120 121 entry SKPCLP 122 FastSeekflg equ FastSeekFlg ; NASM port label 0 00005263 F606[0000]80 TEST byte [FastSeekflg],Fast_yes ; fastseek installed? ;AN000; 0 00005268 745E JZ dos_do_norm ; no ;AN000; 0 0000526A F606[0000]01 TEST byte [FastSeekflg],FS_begin ; do fastseek ;AN000; 0 0000526F 7457 JZ dos_do_norm ; no ;AN000; 0 00005271 F606[0000]02 TEST byte [FastSeekflg],FS_insert ; is in insert mode ? ;AN000; 0 00005276 7550 JNZ dos_do_norm ; yes ;AN000; 129 Temp_Var2 equ Temp_VAR2 ; NASM port label 0 00005278 891E[0000] MOV [Temp_Var2],BX ; save physical cluster ;AN000; 131 ; PTR P005079 132 SKPCLP2: 0 0000527C E8[0000] invoke FastSeek_Lookup ; ask for next cluster # ;AN000; 0 0000527F 7373 JNC clusfound ; yes, we got it ;AN000; 0 00005281 83FF01 CMP DI,1 ; valid drive ,e.g. C,D... ;AN000; 0 00005284 7507 JNZ par_found ; yes, ;AN000; 0 00005286 8026[0000]80 AND byte [FastSeekflg],Fast_yes ; no more, fastseek ;AN000; 0 0000528B EB3B JMP SHORT dos_do_norm ;AN000; 139 ;AN000; 140 par_found: 141 FS_Trunc_EOF equ FS_TRUNC_EOF ; NASM port label 0 0000528D E8A403 CALL FS_Trunc_EOF ; check EOF and truncate ;AN000; 0 00005290 73EA JNC SKPCLP2 ; redo lookup ;AN000; 144 noteof: 0 00005292 800E[0000]02 OR byte [FastSeekflg],FS_insert ; no, start to insert ;AN000; 0 00005297 3B16[0000] CMP DX,[FSeek_logsave] ; is current better than new? ;AN000; 0 0000529B 7613 JBE OnCache ; no, let's use new ;AN000; 0 0000529D 8916[0000] MOV [FSeek_logclus],DX ; use current ;AN000; 0 000052A1 8B1E[0000] MOV BX,[Temp_Var2] ; retore pysical cluster ;AN000; 0 000052A5 89DF MOV DI,BX ; insert cureent cluster ;AN000; 0 000052A7 E8[0000] invoke FastSeek_Insert ; insert cluster # to ;AN000; 0 000052AA FF06[0000] INC word [FSeek_logclus] ; get next inserted position ;AN000; 0 000052AE EB18 JMP SHORT dos_do_norm 154 OnCache: 0 000052B0 8B0E[0000] MOV CX,[FSeek_logclus] ; get the number of clusters ;AN000; 0 000052B4 2B0E[0000] SUB CX,[FSeek_logsave] ; we need to skip ;AN000; 0 000052B8 8B16[0000] MOV DX,[FSeek_logsave] ; cluster position ;AN000; 158 dodo: 0 000052BC FF06[0000] INC word [FSeek_logsave] ; get next inserted position ;AN000; 0 000052C0 FF36[0000] PUSH word [FSeek_logsave] ; logclus=logsave ;AN000; 0 000052C4 8F06[0000] POP word [FSeek_logclus] ;AN000; 162 163 dos_do_norm: 164 0 000052C8 E8[0000] invoke UNPACK 0 000052CB 7301C3 retc 167 0 000052CE E8[0000] invoke FastSeek_Insert ; insert cluster # to ;AN000; 169 cluss: ;AN000; 0 000052D1 53 PUSH BX ; FastSeek ;AN000; 0 000052D2 89FB MOV BX,DI 0 000052D4 E8[0000] Invoke IsEOF 0 000052D7 5B POP BX 0 000052D8 730E JAE RET10 0 000052DA 87DF XCHG BX,DI 0 000052DC 42 INC DX 0 000052DD FF06[0000] INC word [FSeek_logclus] ; increment for next inserted ;AN000; 0 000052E1 E202 LOOP SKPCLPX 0 000052E3 EB03 JMP short RET10 180 SKPCLPX: 0 000052E5 E97BFF JMP SKPCLP 182 RET10: ;AN000; 0 000052E8 8026[0000]FD AND byte [FastSeekflg],FS_no_insert ; clear insert mode 0 000052ED F8 CLC 0 000052EE C3 return 186 NOCLUS: 0 000052EF 07 POP ES 188 assume es:nothing 0 000052F0 41 INC CX 0 000052F1 4A DEC DX 0 000052F2 F8 CLC 0 000052F3 C3 return 193 clusfound: 0 000052F4 8B16[0000] MOV DX,[FSeek_logclus] ; get cluster position ;AN000; 0 000052F8 8B1E[0000] MOV BX,[FSeek_logsave] ; bx=previous cluster # PTM ;AN000; 0 000052FC 4A DEC DX ;AN000; 0 000052FD B90100 MOV CX,1 ; we found it ;AN000; 0 00005300 EBCF JMP cluss ;AN000; 199 200 EndProc FNDCLUS 201 202 Break 203 204 ; Inputs: 205 ; AH = priority of buffer 206 ; AL = 0 if buffer must be read, 1 if no pre-read needed 207 ; ES:BP = Base of drive parameters 208 ; [CLUSNUM] = Physical cluster number 209 ; [SECCLUSPOS] = Sector position of transfer within cluster 210 ; [BYTCNT1] = Size of transfer 211 ; Function: 212 ; Insure specified sector is in buffer, flushing buffer before 213 ; read if necessary. 214 ; Outputs: 215 ; ES:DI = Pointer to buffer 216 ; SI = Pointer to transfer address 217 ; CX = Number of bytes 218 ; [NEXTADD] updated 219 ; [TRANS] set to indicate a transfer will occur 220 ; Carry set if error (user FAILed to I 24) 221 222 procedure BUFSEC,NEAR 222 ****************** warning: proc BUFSEC... [-w+user] 223 DOSAssume CS,,"BufSec" 224 ASSUME ES:NOTHING 225 226 Assert ISDPB,,"BufSec" 0 00005302 8B16[0000] MOV DX,[CLUSNUM] 0 00005306 8A1E[0000] MOV BL,[SECCLUSPOS] 229 allowed_FAIL equ Allowed_FAIL ; NASM port equate 230 allowed_RETRY equ Allowed_RETRY ; NASM port equate 231 allowed_IGNORE equ Allowed_IGNORE ; NASM port equate 0 0000530A C606[0000]38 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY + allowed_IGNORE 0 0000530F E8EA01 CALL FIGREC 0 00005312 E8[0000] invoke GETBUFFR 0 00005315 72DC retc 0 00005317 C606[0000]01 MOV BYTE PTR [TRANS],1 ; A transfer is taking place 0 0000531C 8B36[0000] MOV SI,[NEXTADD] 0 00005320 89F7 MOV DI,SI 0 00005322 8B0E[0000] MOV CX,[BYTCNT1] 0 00005326 01CF ADD DI,CX 0 00005328 893E[0000] MOV [NEXTADD],DI 0 0000532C C43E[0000] LES DI,[CURBUF] 243 Assert ISBUF,,"BufSec" 0 00005330 26804D0508 OR byte [ES:DI + buf_flags],buf_isDATA 0 00005335 8D7D10 LEA DI,[DI + BUFINSIZ] ; Point to buffer 0 00005338 033E[0000] ADD DI,[BYTSECPOS] 0 0000533C F8 CLC 0 0000533D C3 return 249 EndProc BUFSEC 250 251 Break 252 253 ; Do a partial sector read via one of the system buffers 254 ; ES:BP Points to DPB 255 ; Carry set if error (currently user FAILed to I 24) 256 257 procedure BUFRD,NEAR 257 ****************** warning: proc BUFRD... [-w+user] 258 DOSAssume CS,,"BufRd" 259 ASSUME ES:NOTHING 260 261 Assert ISDPB,,"BufRd" 0 0000533E 06 PUSH ES 0 0000533F B80000 MOV AX,0 0 00005342 E8BDFF CALL BUFSEC 0 00005345 7303 JNC BUF_OK 266 BUF_IO_FAIL: 0 00005347 07 POP ES 268 assume es:nothing 0 00005348 EB29 JMP SHORT RBUFPLACED 270 271 BUF_OK: 0 0000534A 8CC3 MOV BX,ES 0 0000534C 8E06[0200] MOV ES,[DMAADD+2] 274 assume es:nothing 0 00005350 8EDB MOV DS,BX 276 ASSUME DS:NOTHING 0 00005352 87FE XCHG DI,SI 0 00005354 D1E9 SHR CX,1 0 00005356 7301 JNC EVENRD 0 00005358 A4 MOVSB 281 EVENRD: 0 00005359 F3A5 REP MOVSW 0 0000535B 07 POP ES 284 assume es:DPB 0 0000535C 36C53E[0000] LDS DI,[ss:CURBUF] 286 assume ds:nothing 287 Assert ISBUF,,"BufRD/EvenRD" 288 BufInSiz equ BUFINSIZ ; NASM port equate 0 00005361 8D5D10 LEA BX,[DI + BufInSiz] 0 00005364 29DE SUB SI,BX ; Position in buffer 0 00005366 E8[0000] invoke PLACEBUF 292 Assert ISDPB,,"BufRD/EvenRD" 0 00005369 263B7602 CMP SI,[ES:BP + dpb_sector_size] ; Read Last byte? 0 0000536D 7203 JB RBUFPLACEDC ; No, leave buf where it is 0 0000536F E8[0000] invoke PLACEHEAD ; Make it prime candidate for chucking 296 ; even though it is MRU. 297 RBUFPLACEDC: 0 00005372 F8 CLC 299 RBUFPLACED: 0 00005373 16 PUSH SS 0 00005374 1F POP DS 302 assume ds:DOSGROUP 0 00005375 C3 return 304 EndProc BUFRD 305 306 ; Do a partial sector write via one of the system buffers 307 ; ES:BP Points to DPB 308 ; Carry set if error (currently user FAILed to I 24) 309 310 procedure BUFWRT,NEAR 310 ****************** warning: proc BUFWRT... [-w+user] 311 DOSAssume CS,,"BufWrt" 312 ASSUME ES:NOTHING 313 314 Assert ISDPB,,"BufWrt" 0 00005376 A1[0000] MOV AX,WORD PTR [SECPOS] 0 00005379 83C001 ADD AX,1 ; Set for next sector 0 0000537C A3[0000] MOV WORD PTR [SECPOS],AX ;F.C. >32mb ;AN000; 0 0000537F 8316[0200]00 ADC WORD PTR [SECPOS+2],0 ;F.C. >32mb ;AN000; 0 00005384 A1[0200] MOV AX,WORD PTR [SECPOS+2] ;F.C. >32mb ;AN000; 0 00005387 3B06[0200] CMP AX,WORD PTR [VALSEC+2] ;F.C. >32mb ;AN000; 0 0000538B B001 MOV AL,1 ;F.C. >32mb ;AN000; 0 0000538D 770F JA NOREAD ;F.C. >32mb ;AN000; 0 0000538F 720B JB doread ;F.C. >32mb ;AN000; 0 00005391 A1[0000] MOV AX,WORD PTR [SECPOS] ;F.C. >32mb ;AN000; 0 00005394 3B06[0000] CMP AX,WORD PTR [VALSEC] ; Has sector been written before? 0 00005398 B001 MOV AL,1 0 0000539A 7702 JA NOREAD ; Skip preread if SECPOS>VALSEC 328 doread: 0 0000539C 30C0 XOR AL,AL 330 NOREAD: 0 0000539E 06 PUSH ES 0 0000539F E860FF CALL BUFSEC 0 000053A2 72A3 JC BUF_IO_FAIL 0 000053A4 8E1E[0200] MOV DS,[DMAADD+2] 335 ASSUME DS:NOTHING 0 000053A8 D1E9 SHR CX,1 0 000053AA 7301 JNC EVENWRT 0 000053AC A4 MOVSB 339 EVENWRT: 0 000053AD F3A5 REP MOVSW 0 000053AF 07 POP ES 342 assume es:nothing 0 000053B0 36C51E[0000] LDS BX,[ss:CURBUF] 344 Assert ISBUF,,"BufWrt/EvenWrt" 345 0 000053B5 F6470540 TEST byte [BX + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 000053B9 7507 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 000053BB E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 000053BE 804F0540 OR byte [BX + buf_flags],buf_dirty 350 yesdirty: 0 000053C2 8D7710 LEA SI,[BX + BufInSiz] 0 000053C5 29F7 SUB DI,SI ; Position in buffer 0 000053C7 89FE MOV SI,DI 0 000053C9 89DF MOV DI,BX 0 000053CB E8[0000] invoke PLACEBUF 356 Assert ISDPB,,"BufWrt/EvenWrt" 0 000053CE 263B7602 CMP SI,[ES:BP + dpb_sector_size] ; Written last byte? 0 000053D2 7203 JB WBUFPLACED ; No, leave buf where it is 0 000053D4 E8[0000] invoke PLACEHEAD ; Make it prime candidate for chucking 360 ; even though it is MRU. 361 WBUFPLACED: 0 000053D7 F8 CLC 0 000053D8 16 PUSH SS 0 000053D9 1F POP DS 365 assume ds:DOSGROUP 0 000053DA C3 return 367 EndProc BUFWRT 368 369 Break 370 371 ; Compute the next sector to read or write 372 ; ES:BP Points to DPB 373 374 procedure NEXTSEC,NEAR 374 ****************** warning: proc NEXTSEC... [-w+user] 375 DOSAssume CS,,"NextSec" 376 ASSUME ES:NOTHING 377 378 Assert ISDPB,,"NextSec" 0 000053DB F606[0000]FF TEST BYTE PTR [TRANS],-1 0 000053E0 7467 JZ CLRET 0 000053E2 A0[0000] MOV AL,[SECCLUSPOS] 0 000053E5 FEC0 inc al 0 000053E7 7406 jz @F 0 000053E9 263A4604 CMP AL,[ES:BP + dpb_cluster_mask] 0 000053ED 7657 JBE SAVPOS 386 @@: 0 000053EF 8B1E[0000] MOV BX,[CLUSNUM] 0 000053F3 E8[0000] Invoke IsEOF 0 000053F6 7353 JAE NONEXT 390 ;; 11/5/86 FastSeek 0 000053F8 F606[0000]80 TEST byte [FastSeekflg],Fast_yes ; fastseek installed? ;AN000; 0 000053FD 7430 JZ do_norm2 ; no ;AN000; 0 000053FF FF36[0000] PUSH word [LASTPOS] ; save logical cluster # ;AN000; 0 00005403 8F06[0000] POP word [FSeek_logclus] ;AN000; 0 00005407 FF06[0000] INC word [FSeek_logclus] ; get next cluster ;AN000; 396 ;AN000; 0 0000540B F606[0000]01 TEST byte [FastSeekflg],FS_begin ; from R/W ;AN000; 0 00005410 741D JZ do_norm2 ; no ;AN000; 399 look2: ;AN000; 0 00005412 E8[0000] invoke FastSeek_Lookup ; call lookup ;AN000; 0 00005415 7325 JNC clusgot ; found one ;AN000; 402 0 00005417 83FF01 CMP DI,1 ; valid drive ,e.g. C,D... ;AN000; 0 0000541A 7507 JNZ parfound2 ; yes, ;AN000; 0 0000541C 8026[0000]80 AND byte [FastSeekflg],Fast_yes ; no more, fastseek ;AN000; 0 00005421 EB0C JMP SHORT do_norm2 ;AN000; 407 parfound2: 0 00005423 E80E02 CALL FS_TRUNC_EOF ; check EOF ;AN000; 0 00005426 8B1E[0000] MOV BX,[CLUSNUM] ; don't need partially found cluster 0 0000542A 800E[0000]02 OR byte [FastSeekflg],FS_insert ; prepared for cluster insertion ;AN000; 411 ; use the old bx ;AN000; 412 ;AN000; 413 do_norm2: 0 0000542F E8[0000] invoke UNPACK 0 00005432 7217 JC NONEXT 0 00005434 E8[0000] invoke FastSeek_Insert ; call insert ;AN000; 0 00005437 8026[0000]FD AND byte [FastSeekflg],FS_no_insert ; clear insert flag ;AN000; 418 ;AN000; 419 clusgot: 420 ;; 11/5/86 FastSeek 0 0000543C 893E[0000] MOV [CLUSNUM],DI 0 00005440 FF06[0000] INC word [LASTPOS] 0 00005444 B000 MOV AL,0 424 SAVPOS: 0 00005446 A2[0000] MOV [SECCLUSPOS],AL 426 CLRET: 0 00005449 F8 CLC 0 0000544A C3 return 429 NONEXT: 0 0000544B F9 STC 0 0000544C C3 return 432 EndProc NEXTSEC 433 434 Break 435 436 ; Inputs: 437 ; BX = Physical cluster 438 ; CX = No. of records 439 ; DL = sector within cluster 440 ; ES:BP = Base of drives parameters 441 ; [NEXTADD] = transfer address 442 ; Outputs: 443 ; AX = No. of records remaining 444 ; BX = Transfer address 445 ; CX = No. or records to be transferred 446 ; DX = Physical sector address (LOW) 447 ; [HIGH_SECTOR] = Physical sector address (HIGH) 448 ; DI = Next cluster 449 ; [CLUSNUM] = Last cluster accessed 450 ; [NEXTADD] updated 451 ; Carry set if error (currently user FAILed to I 24) 452 ; ES:BP unchanged. Note that segment of transfer not set. 453 454 procedure OPTIMIZE,NEAR 454 ****************** warning: proc OPTIMIZE... [-w+user] 455 DOSAssume CS,,"Optimize" 456 ASSUME ES:NOTHING 457 458 Assert ISDPB,,"Optimize" 0 0000544D 52 PUSH DX 0 0000544E 53 PUSH BX 0 0000544F B400 mov ah, 0 0 00005451 268A4604 mov al, [ES:BP + dpb_cluster_mask] 0 00005455 40 inc ax ; Number of sectors per cluster 0 00005456 A3[0000] mov word ptr [Cluster_Next_EDR], ax 0 00005459 B600 mov dh, 0 0 0000545B 29D0 sub ax, dx ; ax = Number of sectors left in first cluster 0 0000545D 89CA MOV DX,CX 0 0000545F 31C9 xor cx, cx 469 ;;; 11/5/86 FastSeek 0 00005461 FF36[0000] PUSH word [LASTPOS] ; save logical cluster # ;AN000; 0 00005465 8F06[0000] POP word [FSeek_logclus] ;AN000; 0 00005469 FF06[0000] INC word [FSeek_logclus] ; get next cluster ;AN000; 473 ;AN000; 474 OPTCLUS: 475 ; lDOS obsolete: 476 ; AL has number of sectors available in current cluster 477 ; AH has number of sectors available in next cluster 478 ; lDOS update: 479 ; ax = number of sectors available in current cluster 480 ; [Cluster_Next_EDR] = number of sectors available in next cluster 481 482 ; BX has current physical cluster 483 ; CX has number of sequential sectors found so far 484 ; DX has number of sectors left to transfer 485 ; ES:BP Points to DPB 486 ; ES:SI has FAT pointer 487 0 0000546D F606[0000]80 TEST byte [FastSeekflg],Fast_yes ; fastseek installed? ;AN000; 0 00005472 7429 JZ do_norm3 ; no ;AN000; 0 00005474 F606[0000]01 TEST byte [FastSeekflg],FS_begin ; from R/W ;AN000; 0 00005479 7422 JZ do_norm3 ; no ;AN000; 0 0000547B F606[0000]02 TEST byte [FastSeekflg],FS_insert ; is in insert mode ? ;AN000; 0 00005480 751B JNZ do_norm3 ; yes ;AN000; 0 00005482 E8[0000] invoke FastSeek_Lookup ; call lookup ;AN000; 0 00005485 731B JNC clusgot2 ; found one ;AN000; 496 0 00005487 83FF01 CMP DI,1 ; valid drive ,e.g. C,D... ;AN000; 0 0000548A 7507 JNZ par_found3 ; yes, ;AN000; 0 0000548C 8026[0000]80 AND byte [FastSeekflg],Fast_yes ; no more, fastseek ;AN000; 0 00005491 EB0A JMP SHORT do_norm3 ;AN000; 501 par_found3: 0 00005493 53 PUSH BX 0 00005494 E89D01 CALL FS_TRUNC_EOF ; file entry not existing ;AN000; 0 00005497 5B POP BX ;AN000; 0 00005498 800E[0000]02 OR byte [FastSeekflg],FS_insert ; prepare for insertion ;AN000; 506 ; use old bx ;AN000; 507 do_norm3: 0 0000549D E8[0000] invoke UNPACK 0 000054A0 7241 JC OP_ERR 510 clusgot2: 0 000054A2 E8[0000] invoke FastSeek_Insert ; call insert ;AN000; 0 000054A5 FF06[0000] INC word [FSeek_logclus] ; insert to next position ;AN000; 513 ;;; 11/5/86 FastSeek ;AN000; 0 000054A9 01C1 add cx, ax 0 000054AB 39D1 CMP CX,DX 0 000054AD 733E JAE BLKDON 0 000054AF A1[0000] MOV ax, word ptr [Cluster_Next_EDR] 0 000054B2 43 INC BX 0 000054B3 39DF CMP DI,BX 0 000054B5 74B6 JZ OPTCLUS 0 000054B7 4B DEC BX 522 FINCLUS: 0 000054B8 891E[0000] MOV [CLUSNUM],BX ; Last cluster accessed 0 000054BC 29CA SUB DX,CX ; Number of sectors still needed 0 000054BE 52 PUSH DX 0 000054BF 89C8 MOV AX,CX 0 000054C1 26F76602 MUL word [ES:BP + dpb_sector_size] ; Number of sectors times sector size 0 000054C5 8B36[0000] MOV SI,[NEXTADD] 0 000054C9 01F0 ADD AX,SI ; Adjust by size of transfer 0 000054CB A3[0000] MOV [NEXTADD],AX 0 000054CE 58 POP AX ; Number of sectors still needed 0 000054CF 5A POP DX ; Starting cluster 0 000054D0 29D3 SUB BX,DX ; Number of new clusters accessed 0 000054D2 011E[0000] ADD [LASTPOS],BX 0 000054D6 5B POP BX ; BL = sector postion within cluster 0 000054D7 E82200 invoke FIGREC 0 000054DA 89F3 MOV BX,SI 0 000054DC 8026[0000]FD AND byte [FastSeekflg],FS_no_insert ; clear insert flag 0 000054E1 F8 CLC 0 000054E2 C3 return 541 542 OP_ERR: 0 000054E3 83C404 ADD SP,4 0 000054E6 8026[0000]FD AND byte [FastSeekflg],FS_no_insert ; clear insert flag 0 000054EB F9 STC 0 000054EC C3 return 547 548 BLKDON: 0 000054ED 29D1 SUB CX,DX ; Number of sectors in cluster we don't want 0 000054EF A1[0000] mov ax, word ptr [Cluster_Next_EDR] 0 000054F2 29C8 sub ax, cx ; Number of sectors in cluster we accepted 0 000054F4 48 dec ax ; Adjust to mean position within cluster 0 000054F5 A2[0000] MOV [SECCLUSPOS], al 0 000054F8 89D1 MOV CX,DX ; Anyway, make the total equal to the request 0 000054FA EBBC JMP SHORT FINCLUS 556 EndProc OPTIMIZE 557 558 Break 559 560 ; Inputs: 561 ; DX = Physical cluster number 562 ; BL = Sector postion within cluster 563 ; ES:BP = Base of drive parameters 564 ; Outputs: 565 ; DX = physical sector number (LOW) 566 ; [HIGH_SECTOR] Physical sector address (HIGH) 567 ; No other registers affected. 568 569 procedure FIGREC,NEAR 569 ****************** warning: proc FIGREC... [-w+user] 570 ASSUME DS:NOTHING,ES:NOTHING 571 572 Assert ISDPB,,"FigRec" 0 000054FC 51 PUSH CX 0 000054FD 31C9 xor cx, cx 0 000054FF 268A4E05 MOV CL,[ES:BP + dpb_cluster_shift] 0 00005503 4A DEC DX 0 00005504 4A DEC DX 0 00005505 36C706[0000]0000 MOV word [ss:HIGH_SECTOR],0 ;F.C. >32mb 0 0000550C E309 jcxz noshift ;F.C. >32mb 580 rotleft: ;F.C. >32mb 0 0000550E D1E2 shl DX,1 ;F.C. >32mb 0 00005510 36D116[0000] RCL word [ss:HIGH_SECTOR],1 ;F.C. >32mb 0 00005515 E2F7 LOOP rotleft ;F.C. >32mb 584 noshift: 585 586 ; SHL DX,CL 0 00005517 08DA OR DL,BL 0 00005519 2603560B ADD DX,[ES:BP + dpb_first_sector] 0 0000551D 368316[0000]00 ADC word [ss:HIGH_SECTOR],0 ;F.C. >32mb 0 00005523 59 POP CX 0 00005524 C3 return 592 EndProc FIGREC 593 594 Break 595 596 ;*** ALLOCATE - Allocate Disk Space 597 ; 598 ; ALLOCATE is called to allocate disk clusters. The new clusters are 599 ; FAT-chained onto the end of the existing file. 600 ; 601 ; The DPB contains the cluster # of the last free cluster allocated 602 ; (dpb_next_free). We start at this cluster and scan towards higher 603 ; numbered clusters, looking for the necessary free blocks. 604 ; 605 ; Once again, fancy terminology gets in the way of corrct coding. When 606 ; using next_free, start scanning AT THAT POINT and not the one following it. 607 ; This fixes the boundary condition bug when only free = next_free = 2. 608 ; 609 ; If we get to the end of the disk without satisfaction: 610 ; 611 ; if (dpb_next_free == 2) then we've scanned the whole disk. 612 ; return (insufficient_disk_space) 613 ; ELSE 614 ; dpb_next_free = 2; start scan over from the beginning. 615 ; 616 ; Note that there is no multitasking interlock. There is no race when 617 ; examining the entrys in an in-core FAT block since there will be no 618 ; context switch. When UNPACK context switches while waiting for a FAT read 619 ; we are done with any in-core FAT blocks, so again there is no race. The 620 ; only special concern is that V2 and V3 MSDOS left the last allocated 621 ; cluster as "00"; marking it EOF only when the entire alloc request was 622 ; satisfied. We can't allow another activation to think this cluster is 623 ; free, so we give it a special temporary mark to show that it is, indeed, 624 ; allocated. 625 ; 626 ; Note that when we run out of space this algorithem will scan from 627 ; dpb_next_free to the end, then scan from cluster 2 through the end, 628 ; redundantly scanning the later part of the disk. This only happens when 629 ; we run out of space, so sue me. 630 ; 631 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 632 ; C A V E A T P A T T E R S O N ; 633 ; ; 634 ; The use of FATBYT and RESTFATBYT is somewhat mysterious. Here is the 635 ; explanation: 636 ; 637 ; In the NUL file case (sf_firclus currently 0) ALLOCATE is called with 638 ; entry BX = 0. What needs to be done in this case is to stuff the cluster 639 ; number of the first cluster allocated in sf_firclus when the ALLOCATE is 640 ; complete. THIS VALUE IS SAVED TEMPORARILY IN CLUSTER 0, HENCE THE CURRENT 641 ; VALUE IN CLUSTER 0 MUST BE SAVED AND RESTORED. This is a side effect of 642 ; the fact that PACK and UNPACK don't treat requests for clusters 0 and 1 as 643 ; errors. This "stuff" is done by the call to PACK which is right before 644 ; the 645 ; LOOP findfre ; alloc more if needed 646 ; instruction when the first cluster is allocated to the nul file. The 647 ; value is recalled from cluster 0 and stored at sf_firclus at ads4: 648 ; 649 ; This method is obviously useless (because it is non-reentrant) for 650 ; multitasking, and will have to be changed. Storing the required value on 651 ; the stack is recommended. Setting sf_firclus at the PACK of cluster 0 652 ; (instead of actually doing the PACK) is BAD because it doesn't handle 653 ; problems with INT 24 well. 654 ; 655 ; C A V E A T P A T T E R S O N ; 656 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----; 657 ; ; 658 ; ENTRY BX = Last cluster of file (0 if null file) 659 ; CX = No. of clusters to allocate 660 ; ES:BP = Base of drive parameters 661 ; [THISSFT] = Points to SFT 662 ; 663 ; EXIT 'C' set if insufficient space 664 ; [FAILERR] can be tested to see the reason for failure 665 ; CX = max. no. of clusters that could be added to file 666 ; 'C' clear if space allocated 667 ; BX = First cluster allocated 668 ; FAT is fully updated 669 ; sf_FIRCLUS field of SFT set if file was null 670 ; 671 ; USES ALL but SI, BP 672 673 PROCEDURE ALLOCATE,NEAR 673 ****************** warning: proc ALLOCATE... [-w+user] 674 675 DOSAssume CS,,"Allocate" 676 ASSUME ES:NOTHING 677 678 Assert ISDPB,,"Allocate" 0 00005525 53 PUSH BX ; save (bx) 0 00005526 31DB XOR BX,BX 0 00005528 E8[0000] invoke UNPACK 0 0000552B 893E[0000] MOV [FATBYT],DI ; save correct cluster 0 value 0 0000552F 5B POP BX 0 00005530 72F2 retc ; abort if error [INTERR?] 685 0 00005532 51 PUSH CX 0 00005533 53 PUSH BX 688 0 00005534 89DA MOV DX,BX 690 Assert ISDPB,,"Allocate/Unpack" 0 00005536 268B5E1D mov bx,[es:bp + dpb_next_free] 0 0000553A 83FB02 cmp bx,2 693 findfre equ FINDFRE ; NASM port label 0 0000553D 7709 ja findfre 695 696 ; couldn't find enough free space beyond dpb_next_free, or dpb_next_free is 697 ; <2 or >dpb_max_clus. Reset it and restart the scan 698 699 ads1: 700 Assert ISDPB,,"Alloc/ads1" 0 0000553F 26C7461D0200 mov word [es:bp + dpb_next_free],2 0 00005545 BB0100 mov bx,1 ; Counter next instruction so first 703 ; cluster examined is 2 704 705 ; Scanning both forwards and backwards for a free cluster 706 ; 707 ; (BX) = forwards scan pointer 708 ; (CX) = clusters remaining to be allocated 709 ; (DX) = current last cluster in file 710 ; (TOS) = last cluster of file 711 712 FINDFRE: 0 00005548 43 INC BX 714 Assert ISDPB,,"Alloc/findfre" 0 00005549 263B5E0D CMP BX,[ES:BP + dpb_max_cluster] 0 0000554D 7603 JBE aupk 0 0000554F EB77 jmp ads7 ; at end of disk 0 00005551 90 nop ; identicalise 719 aupk: 0 00005552 E8[0000] invoke UNPACK ; check out this cluster 0 00005555 722F jc ads4 ; FAT error [INTERR?] 0 00005557 75EF jnz findfre ; not free, keep on truckin 723 724 ; Have found a free cluster. Chain it to the file 725 ; 726 ; (BX) = found free cluster # 727 ; (DX) = current last cluster in file 728 0 00005559 26895E1D mov [es:bp + dpb_next_free],bx ; next time start search here 0 0000555D 92 xchg ax,dx ; save (dx) in ax 0 0000555E BA0100 mov dx,1 ; mark this free guy as "1" 0 00005561 E8[0000] invoke PACK ; set special "temporary" mark 0 00005564 7220 jc ads4 ; FAT error [INTERR?] 0 00005566 26837E1FFF CMP word [ES:BP + dpb_free_cnt],-1 ; Free count valid? 0 0000556B 7404 JZ NO_ALLOC ; No 0 0000556D 26FF4E1F DEC word [ES:BP + dpb_free_cnt] ; Reduce free count by 1 737 NO_ALLOC: 0 00005571 92 xchg ax,dx ; (dx) = current last cluster in file 0 00005572 87DA XCHG BX,DX 0 00005574 89D0 MOV AX,DX 0 00005576 E8[0000] invoke PACK ; link free cluster onto file 742 ; CAVEAT.. On Nul file, first pass stuffs 743 ; cluster 0 with FIRCLUS value. 0 00005579 720B jc ads4 ; FAT error [INTERR?] 0 0000557B 93 xchg BX,AX ; (BX) = last one we looked at 0 0000557C 89DA mov dx,bx ; (dx) = current end of file 0 0000557E E2C8 LOOP findfre ; alloc more if needed 748 749 ; We've successfully extended the file. Clean up and exit 750 ; 751 ; (BX) = last cluster in file 752 0 00005580 BAFFFF MOV DX,0FFFFH 0 00005583 E8[0000] invoke PACK ; mark last cluster EOF 755 756 ; Note that FAT errors jump here to clean the stack and exit. this saves us 757 ; 2 whole bytes. Hope its worth it... 758 ; 759 ; 'C' set iff error 760 ; calling (BX) and (CX) pushed on stack 761 0 00005586 5B ads4: POP BX 0 00005587 59 POP CX ; Don't need this stuff since we're successful 0 00005588 729A retc 0 0000558A E8[0000] invoke UNPACK ; Get first cluster allocated for return 766 ; CAVEAT... In nul file case, UNPACKs cluster 0. 0 0000558D 7295 retc 0 0000558F E85400 invoke RESTFATBYT ; Restore correct cluster 0 value 0 00005592 7290 retc 0 00005594 87DF XCHG BX,DI ; (DI) = last cluster in file upon our entry 0 00005596 09FF OR DI,DI ; clear 'C' 0 00005598 758A retnz ; we were extending an existing file 773 774 ; We were doing the first allocation for a new file. Update the SFT cluster 775 ; info 776 ;; Extended Attributes 777 ; TEST [XA_condition],XA_No_SFT ;FT. don't update SFT when from ;AN000; 778 ; JZ dofastk ;FT. GetSet_XA ;AN000; 779 ; AND [XA_condition],not XA_No_SFT ;FT. clear the bit ;AN000; 780 ; CLC ;FT. ;AN000; 781 ; ret ;FT. ;AN000; 782 ;; 11/6/86 FastSeek 783 dofastk: 0 0000559A 52 PUSH DX 0 0000559B 268A5600 MOV DL,[ES:BP + dpb_drive] ; get drive # 786 0 0000559F 06 PUSH ES 0 000055A0 C43E[0000] LES DI,[THISSFT] 789 Assert ISSFT,,"Allocate/ads4" 0 000055A4 26895D0B MOV [ES:DI + sf_firclus],BX 0 000055A8 26895D35 MOV [ES:DI + sf_lstclus],BX 792 0 000055AC F606[0000]80 TEST byte [FastSeekflg],Fast_yes ; fastseek installed 0 000055B1 7412 JZ do_norm5 ; no 0 000055B3 F606[0000]01 TEST byte [FastSeekflg],FS_begin ; do fastseek 0 000055B8 740B JZ do_norm5 ; no 0 000055BA 51 PUSH CX 0 000055BB 89D9 MOV CX,BX ; set up firclus # 0 000055BD 891E[0000] MOV [FSeek_firclus],BX ; update firclus varible 0 000055C1 E8[0000] invoke FastSeek_Open ; create this file entry 0 000055C4 59 POP CX 802 do_norm5: 0 000055C5 07 POP ES 804 assume es:nothing 805 ;; 11/6/86 FastSeek 0 000055C6 5A POP DX 0 000055C7 C3 return 808 809 810 ;** we're at the end of the disk, and not satisfied. See if we've scanned ALL 811 ; of the disk... 812 0 000055C8 26837E1D02 ads7: cmp word [es:bp + dpb_next_free],2 814 %ifn debug 0 000055CD 7403 jz tmplab2 ; 0 000055CF E96DFF jmp ads1 ; start scan from front of disk 817 tmplab2: 818 %else 819 jz tmplab 820 jmp ads1 821 tmplab: 822 %endif 823 824 ; Sorry, we've gone over the whole disk, with insufficient luck. Lets give 825 ; the space back to the free list and tell the caller how much he could have 826 ; had. We have to make sure we remove the "special mark" we put on the last 827 ; cluster we were able to allocate, so it doesn't become orphaned. 828 ; 829 ; (CX) = clusters remaining to be allocated 830 ; (TOS) = last cluster of file (before call to ALLOCATE) 831 ; (TOS+1) = # of clusters wanted to allocate 832 833 0 000055D2 5B POP BX ; (BX) = last cluster of file 0 000055D3 BAFFFF MOV DX,0FFFFH 0 000055D6 E81F00 invoke RELBLKS ; give back any clusters just alloced 0 000055D9 58 POP AX ; No. of clusters requested 838 ; Don't "retc". We are setting Carry anyway, 839 ; Alloc failed, so proceed with return CX 840 ; setup. 0 000055DA 29C8 SUB AX,CX ; AX=No. of clusters allocated 0 000055DC E80700 invoke RESTFATBYT ; Don't "retc". We are setting Carry anyway, 843 ; Alloc failed. 844 ; fmt <>,<>,<"$p: disk full in allocate\n"> 0 000055DF C606[0000]01 MOV byte [DISK_FULL],1 ;MS. indicating disk full 0 000055E4 F9 STC 0 000055E5 C3 return 848 849 EndProc ALLOCATE 850 851 ; SEE ALLOCATE CAVEAT 852 ; Carry set if error (currently user FAILed to I 24) 853 854 procedure RESTFATBYT,NEAR 854 ****************** warning: proc RESTFATBYT... [-w+user] 855 DOSAssume CS,,"RestFATByt" 856 ASSUME ES:NOTHING 857 0 000055E6 53 PUSH BX 0 000055E7 52 PUSH DX 0 000055E8 57 PUSH DI 0 000055E9 31DB XOR BX,BX 0 000055EB 8B16[0000] MOV DX,[FATBYT] 0 000055EF E8[0000] invoke PACK 0 000055F2 5F POP DI 0 000055F3 5A POP DX 0 000055F4 5B POP BX 0 000055F5 C3 return 868 EndProc RESTFATBYT 869 870 Break 871 872 ; Inputs: 873 ; BX = Cluster in file 874 ; ES:BP = Base of drive parameters 875 ; Function: 876 ; Frees cluster chain starting with [BX] 877 ; Carry set if error (currently user FAILed to I 24) 878 ; AX,BX,DX,DI all destroyed. Other registers unchanged. 879 880 procedure RELEASE,NEAR 880 ****************** warning: proc RELEASE... [-w+user] 881 DOSAssume CS,,"Release" 882 ASSUME ES:NOTHING 883 0 000055F6 31D2 XOR DX,DX 885 entry RELBLKS 886 DOSAssume CS,,"RelBlks" 887 Assert ISDPB,,"RelBlks" 888 889 ; Enter here with DX=0FFFFH to put an end-of-file mark in the first cluster 890 ; and free the rest in the chain. 891 0 000055F8 E8[0000] invoke UNPACK 0 000055FB 72F8 retc 0 000055FD 74F6 retz 0 000055FF 89F8 MOV AX,DI 0 00005601 52 PUSH DX 0 00005602 E8[0000] invoke PACK 0 00005605 5A POP DX 0 00005606 72ED retc 0 00005608 09D2 OR DX,DX 0 0000560A 750B JNZ NO_DEALLOC ; Was putting EOF mark 0 0000560C 26837E1FFF CMP word [ES:BP + dpb_free_cnt],-1 ; Free count valid? 0 00005611 7404 JZ NO_DEALLOC ; No 0 00005613 26FF461F INC word [ES:BP + dpb_free_cnt] ; Increase free count by 1 905 NO_DEALLOC: 0 00005617 89C3 MOV BX,AX 0 00005619 48 dec ax ; check for "1" 0 0000561A 74D9 retz ; is last cluster of incomplete chain 0 0000561C E8[0000] Invoke IsEOF 0 0000561F 72D5 JB RELEASE ; Carry clear if JMP not taken 0 00005621 C3 ret12: return 912 EndProc RELEASE 913 914 Break 915 916 ; Inputs: 917 ; ES:BP Points to DPB 918 ; BX = Cluster in a file 919 ; DS = CS 920 ; Outputs: 921 ; BX = Last cluster in the file 922 ; Carry set if error (currently user FAILed to I 24) 923 ; DI destroyed. No other registers affected. 924 925 procedure GETEOF,NEAR 925 ****************** warning: proc GETEOF... [-w+user] 926 DOSAssume CS,,"GetEOF" 927 ASSUME ES:NOTHING 928 929 Assert ISDPB,,"GetEof" 0 00005622 E8[0000] invoke UNPACK 0 00005625 72FA retc 0 00005627 53 PUSH BX 0 00005628 89FB MOV BX,DI 0 0000562A E8[0000] Invoke IsEOF 0 0000562D 5B POP BX 936 RET12 equ ret12 ; NASM port label 0 0000562E 73F1 JAE RET12 ; Carry clear if jmp 0 00005630 89FB MOV BX,DI 0 00005632 EBEE JMP GETEOF 940 EndProc GETEOF 941 942 Break 943 944 ; Inputs: 945 ; ES:BP Points to DPB 946 ; BX = Cluster in a file 947 ; Functions: if BX=EOF then truncate it from Fastseek Cache 948 ; Outputs: 949 ; carry set: not EOF 950 ; carry clear: EOF and do truncate 951 952 procedure FS_TRUNC_EOF,NEAR 952 ****************** warning: proc FS_TRUNC_EOF... [-w+user] 953 ASSUME ES:NOTHING,DS:NOTHING 954 0 00005634 89FB MOV BX,DI ; get beginning physical# ;AN000; 0 00005636 E8[0000] invoke IsEOF ; is EOF ;AN000; 0 00005639 7218 JB noteof2 ; no ;AN000; 0 0000563B 36FF36[0000] PUSH word [ss:FSeek_logclus] ; ;AN000; 0 00005640 36FF36[0000] PUSH word [ss:FSeek_logsave] ; logclus=logsave ;AN000; 0 00005645 368F06[0000] POP word [ss:FSeek_logclus] ; delete EOF ;AN000; 0 0000564A E8[0000] invoke FastSeek_Truncate ; ;AN000; 0 0000564D 368F06[0000] POP word [ss:FSeek_logclus] ; redo the look up ;AN000; 0 00005652 F8 CLC ;AN000; 964 noteof2: ;AN000; 0 00005653 C3 return ;AN000; 966 EndProc FS_TRUNC_EOF ;AN000; 967 968 END 969 970 === Trace listing source: ../DOS/fcb.lst 1 ; SCCSID = @(#)fcb.asm 1.2 85/07/23 2 ; SCCSID = @(#)fcb.asm 1.2 85/07/23 3 ;TITLE FCB - FCB parse calls for MSDOS 4 ;NAME FCB 5 ; Low level routines for parsing names into FCBs and analyzing 6 ; filename characters 7 ; 8 ; MakeFcb 9 ; NameTrans 10 ; PATHCHRCMP 11 ; GetLet 12 ; TESTKANJ 13 ; NORMSCAN 14 ; DELIM_DOS 15 ; 16 ; Revision history: 17 ; 18 ; A000 version 4.00 Jan. 1988 19 ; 20 21 ; 22 ; get the appropriate segment definitions 23 ; 24 [list -] 24 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 26 27 28 TableLook equ -1 29 30 [list +] === Switch to base=002450h -> "DOSCODECODE" 31 section DOSCODECODE 32 [list -] 32 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 32 ****************** warning: out: BPB.INC... [-w+user] 32 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 32 ****************** warning: out: DEVSYM.INC... [-w+user] 40 41 i_need Name1,BYTE 42 i_need Creating,BYTE 43 i_need Attrib,BYTE 44 i_need SpaceFlag,BYTE 45 i_need FILE_UCASE_TAB,byte ;DOS 3.3 46 i_need COUNTRY_CDPG,byte ;AN000; 2/12/KK 47 i_need DrvErr,BYTE ;AN000; 2/12/KK 48 i_need DOS34_FLAG,WORD ;AN000; 2/12/KK 49 50 assume nocheck, ss:DOSGROUP 51 52 procedure MakeFcb,NEAR 52 ****************** warning: proc MakeFcb... [-w+user] 53 ScanSeparator equ 1 54 DRVBIT EQU 2 55 NAMBIT EQU 4 56 EXTBIT EQU 8 0 00005654 36C606[0000]00 MOV BYTE PTR [ss:SpaceFlag],0 0 0000565A 30D2 XOR DL,DL ; Flag--not ambiguous file name 0 0000565C A802 TEST AL,DRVBIT ; Use current drive field if default? 0 0000565E 7504 JNZ DEFDRV 0 00005660 26C60500 MOV BYTE PTR [ES:DI],0 ; No - use default drive 62 DEFDRV: 0 00005664 47 INC DI 0 00005665 B90800 MOV CX,8 0 00005668 A804 TEST AL,NAMBIT ; Use current name fields as defualt? 0 0000566A 93 XCHG AX,BX ; Save bits in BX 0 0000566B B020 MOV AL," " 0 0000566D 7404 JZ FILLB ; If not, go fill with blanks 0 0000566F 01CF ADD DI,CX 0 00005671 31C9 XOR CX,CX ; Don't fill any 71 FILLB: 0 00005673 F3AA REP STOSB 0 00005675 B103 MOV CL,3 0 00005677 F6C308 TEST BL,EXTBIT ; Use current extension as default 0 0000567A 7404 JZ FILLB2 0 0000567C 01CF ADD DI,CX 0 0000567E 31C9 XOR CX,CX 78 FILLB2: 0 00005680 F3AA REP STOSB 0 00005682 91 XCHG AX,CX ; Put zero in AX 0 00005683 AB STOSW 0 00005684 AB STOSW ; Initialize two words after to zero 0 00005685 83EF10 SUB DI,16 ; Point back at start 0 00005688 F6C301 TEST BL,ScanSeparator; Scan off separators if not zero 0 0000568B 7409 JZ SKPSPC 0 0000568D E88A00 CALL SCANB ; Peel off blanks and tabs 0 00005690 E8E200 CALL DELIM_DOS ; Is it a one-time-only delimiter? 0 00005693 7504 JNZ NOSCAN 0 00005695 46 INC SI ; Skip over the delimiter 90 SKPSPC: 0 00005696 E88100 CALL SCANB ; Always kill preceding blanks and tabs 92 NOSCAN: 93 GETLET equ GetLet ; NASM port label 0 00005699 E8B300 CALL GETLET 0 0000569C 761E JBE NODRV ; Quit if termination character 96 %IF DBCS ;AN000; 97 CALL TESTKANJ ;AN000;; 2/18/KK 98 JNE NODRV ;AN000;; 2/18/KK 99 %ENDIF ;AN000; 0 0000569E 803C3A CMP BYTE PTR [SI],":" ; Check for potential drive specifier 0 000056A1 7519 JNZ NODRV 0 000056A3 46 INC SI ; Skip over colon 0 000056A4 2C40 SUB AL,"@" ; Convert drive letter to drive number (A=1) 0 000056A6 760F JBE BADDRV ; Drive letter out of range 105 0 000056A8 50 PUSH AX 0 000056A9 E8[0000] Invoke GetVisDrv 0 000056AC 58 POP AX 109 HavDrv equ HAVDRV ; NASM port label 0 000056AD 730A JNC HavDrv 0 000056AF 36803E[0000]1A CMP byte [ss:DrvErr],error_not_DOS_disk ; if not FAt drive ;AN000; 0 000056B5 7402 JZ HavDrv ; assume ok ;AN000; 113 BADDRV: 0 000056B7 B2FF MOV DL,-1 115 HAVDRV: 0 000056B9 AA STOSB ; Put drive specifier in first byte 0 000056BA 46 INC SI 0 000056BB 4F DEC DI ; Counteract next two instructions 119 NODRV: 0 000056BC 4E DEC SI ; Back up 0 000056BD 47 INC DI ; Skip drive byte 122 123 entry NORMSCAN 124 0 000056BE B90800 MOV CX,8 0 000056C1 E82200 CALL GETWORD ; Get 8-letter file name 0 000056C4 803C2E CMP BYTE PTR [SI],"." 0 000056C7 7516 JNZ NODOT 0 000056C9 46 INC SI ; Skip over dot if present 0 000056CA 36F706[0000]0001 TEST word [ss:DOS34_FLAG],DBCS_VOLID2 ;AN000; 0 000056D1 7406 JZ VOLOK ;AN000; 0 000056D3 A4 MOVSB ; 2nd byte of DBCS ;AN000; 0 000056D4 B90200 MOV CX,2 ;AN000; 0 000056D7 EB03 JMP SHORT contvol ;AN000; 135 VOLOK: 0 000056D9 B90300 MOV CX,3 ; Get 3-letter extension 137 contvol: 0 000056DC E80D00 CALL MUSTGETWORD 139 NODOT: 0 000056DF 88D0 MOV AL,DL 0 000056E1 C3 return 142 143 NONAM: 0 000056E2 01CF ADD DI,CX 0 000056E4 4E DEC SI 0 000056E5 C3 return 147 148 GETWORD: 0 000056E6 E86600 CALL GETLET 0 000056E9 76F7 JBE NONAM ; Exit if invalid character 0 000056EB 4E DEC SI 152 ; 153 ; UGH!!! Horrible bug here that should be fixed at some point: 154 ; If the name we are scanning is longer than CX, we keep on reading! 155 ; 156 MUSTGETWORD: 0 000056EC E86000 CALL GETLET 158 ; 159 ; If spaceFlag is set then we allow spaces in a pathname 160 ; 0 000056EF 7223 JB FILLNAM 0 000056F1 750C JNZ MustCheckCX 0 000056F3 36F606[0000]FF TEST BYTE PTR [ss:SpaceFlag],0FFh 0 000056F9 7419 JZ FILLNAM 0 000056FB 3C20 CMP AL," " 0 000056FD 7515 JNZ FILLNAM 167 168 MustCheckCX: 0 000056FF E3EB JCXZ MUSTGETWORD 0 00005701 49 DEC CX 0 00005702 3C2A CMP AL,"*" ; Check for ambiguous file specifier 0 00005704 7504 JNZ NOSTAR 0 00005706 B03F MOV AL,"?" 0 00005708 F3AA REP STOSB 175 NOSTAR: 0 0000570A AA STOSB 177 178 %IF DBCS ;AN000; 179 CALL TESTKANJ ;AN000; 180 JZ NOTDUAL3 ;AN000; 181 JCXZ BNDERR ; Attempt to straddle boundry ;AN000; 182 MOVSB ; Transfer second byte ;AN000; 183 DEC CX ;AN000; 184 JMP MUSTGETWORD ;AN000; 185 BNDERR: ;AN000; 186 TEST word [ss:DOS34_FLAG],DBCS_VOLID ;AN000; 187 JZ notvolumeid ;AN000; 188 TEST word [ss:DOS34_FLAG],DBCS_VOLID2 ;AN000; 189 JNZ notvolumeid ;AN000; 190 OR word [ss:DOS34_FLAG],DBCS_VOLID2 ;AN000; 191 JMP MUSTGETWORD ;AN000; 192 193 notvolumeid: 194 ;; INC CX ; Undo the store of the first byte 195 DEC DI 196 MOV AL," " ;PTM. ;AN000; 197 STOSB ;PTM. ;AN000; 198 INC SI ;PTM. ;AN000; 199 JMP MUSTGETWORD ;PTM. ;AN000; 200 201 NOTDUAL3: ;AN000; 202 %ENDIF ;AN000; 203 0 0000570B 3C3F CMP AL,"?" 0 0000570D 75DD JNZ MUSTGETWORD 0 0000570F 80CA01 OR DL,1 ; Flag ambiguous file name 0 00005712 EBD8 JMP MUSTGETWORD 208 FILLNAM: 0 00005714 B020 MOV AL," " 0 00005716 F3AA REP STOSB 0 00005718 4E DEC SI 0 00005719 C3 return 213 214 SCANB: 0 0000571A AC LODSB 0 0000571B E86300 CALL SPCHK 0 0000571E 74FA JZ SCANB 218 %IF DBCS ;AN000; ;AN000; 219 CMP AL,81H ;AN000;; 1ST BYTE OF DBCS BLANK 2/18/KK ;AN000; 220 JNE SCANB_EXIT ;AN000;; 2/18/KK 3/31/KK revoved ;AN000; 221 CALL TESTKANJ ;AN000;; 2/23/KK 3/31/KK revoved ;AN000; 222 JE SCANB_EXIT ;AN000;; 2/18/KK 3/31/KK revoved ;AN000; 223 CMP BYTE PTR [SI],40H;AN000;H ; 2ND BYTE OF DBCS BLANK 2/18/KK 3/31/KK revove;AN000; 224 JNE SCANB_EXIT ;AN000;; 2/18/KK 3/31/KK revoved ;AN000; 225 INC SI ;AN000;; 2/18/KK 3/31/KK revoved ;AN000; 226 JMP SCANB ;AN000;; 2/18/KK 3/31/KK revoved ;AN000; 227 SCANB_EXIT: ;AN000;; 2/18/KK 3/31/KK revoved ;AN000; 228 %ENDIF ;AN000; 0 00005720 4E DEC SI 0 00005721 C3 return 231 EndProc MakeFCB 232 233 ; 234 ; NameTrans is used by FindPath to scan off an element of a path. We must 235 ; allow spaces in pathnames 236 ; 237 ; Inputs: DS:SI points to start of path element 238 ; Outputs: Name1 has unpacked name, uppercased 239 ; ES = DOSGroup 240 ; DS:SI advanced after name 241 ; Registers modified: DI,AX,DX,CX 242 procedure NameTrans,near 242 ****************** warning: proc NameTrans... [-w+user] 243 ASSUME DS:NOTHING,ES:NOTHING 0 00005722 36C606[0000]01 MOV BYTE PTR [ss:SpaceFlag],1 0 00005728 1607 context ES 246 NAME1 equ Name1 ; NASM port label 0 0000572A BF[0000] MOV DI,OFFSET NAME1 wrt DOSGROUP 0 0000572D 57 PUSH DI 0 0000572E B82020 MOV AX,' ' 0 00005731 B90500 MOV CX,5 0 00005734 AA STOSB 0 00005735 F3AB REP STOSW ; Fill "FCB" at NAME1 with spaces 0 00005737 30C0 XOR AL,AL ; Set stuff for NORMSCAN 0 00005739 88C2 MOV DL,AL 0 0000573B AA STOSB 0 0000573C 5F POP DI 257 0 0000573D E87EFF CALL NORMSCAN 259 %IF DBCS ;AN000;;KK. 260 MOV AL,[ss:NAME1] ;AN000;;KK. check 1st char 261 testkanj equ TESTKANJ ; NASM port label 262 invoke testkanj ;AN000;;KK. dbcs ? 263 JZ notdbcs ;AN000;;KK. no 264 return ;AN000;;KK. yes 265 notdbcs: ;AN000; 266 %ENDIF ;AN000; 0 00005740 36803E[0000]E5 CMP byte [ss:NAME1],0E5H 0 00005746 75D9 retnz 0 00005748 36C606[0000]05 MOV byte [ss:NAME1],5 ; Magic name translation 0 0000574E C3 return 271 272 EndProc nametrans 273 274 Break 275 276 %If TableLook 277 278 ; NASM original macros 279 280 %push 281 282 %macro ChType 2.nolist 283 %assign %%index %1 284 detectstripangles %%token, %%opening, %%closing, %2 285 %assign tableentry%[%%index] ? %+ %%token 286 %endmacro 287 288 ChType ".", <255 & (~ ( fChk))> 289 ChType '"', <255 & (~ (fFCB+fChk))> 290 ChType "/", <255 & (~ (fFCB+fChk))> 291 ChType "\", <255 & (~ (fFCB+fChk))> 292 ChType "[", <255 & (~ (fFCB+fChk))> 293 ChType "]", <255 & (~ (fFCB+fChk))> 294 ChType ":", <255 & (~ (fFCB+fChk+fDelim))> 295 ChType "<", <255 & (~ (fFCB+fChk+fDelim))> 296 ChType "|", <255 & (~ (fFCB+fChk+fDelim))> 297 ChType ">", <255 & (~ (fFCB+fChk+fDelim))> 298 ChType "+", <255 & (~ (fFCB+fChk+fDelim))> 299 ChType "=", <255 & (~ (fFCB+fChk+fDelim))> 300 ChType ";", <255 & (~ (fFCB+fChk+fDelim))> 301 ChType ",", <255 & (~ (fFCB+fChk+fDelim))> 302 ChType 0, <255 & (~ (fFCB+fChk))> ; NUL 303 ChType 1, <255 & (~ (fFCB+fChk))> ; ^A 304 ChType 2, <255 & (~ (fFCB+fChk))> ; ^b 305 ChType 3, <255 & (~ (fFCB+fChk))> ; ^c 306 ChType 4, <255 & (~ (fFCB+fChk))> ; ^d 307 ChType 5, <255 & (~ (fFCB+fChk))> ; ^e 308 ChType 6, <255 & (~ (fFCB+fChk))> ; ^f 309 ChType 7, <255 & (~ (fFCB+fChk))> ; ^g 310 ChType 8, <255 & (~ (fFCB+fChk))> ; ^h 311 ChType 9, <255 & (~ (fFCB+fChk+fDelim+fSpChk))> ; Tab 312 ChType 10, <255 & (~ (fFCB+fChk))> ; ^j 313 ChType 11, <255 & (~ (fFCB+fChk))> ; ^k 314 ChType 12, <255 & (~ (fFCB+fChk))> ; ^l 315 ChType 13, <255 & (~ (fFCB+fChk))> ; ^m 316 ChType 14, <255 & (~ (fFCB+fChk))> ; ^n 317 ChType 15, <255 & (~ (fFCB+fChk))> ; ^o 318 ChType 16, <255 & (~ (fFCB+fChk))> ; ^p 319 ChType 17, <255 & (~ (fFCB+fChk))> ; ^q 320 ChType 18, <255 & (~ (fFCB+fChk))> ; ^r 321 ChType 19, <255 & (~ (fFCB+fChk))> ; ^s 322 ChType 20, <255 & (~ (fFCB+fChk))> ; ^t 323 ChType 21, <255 & (~ (fFCB+fChk))> ; ^u 324 ChType 22, <255 & (~ (fFCB+fChk))> ; ^v 325 ChType 23, <255 & (~ (fFCB+fChk))> ; ^w 326 ChType 24, <255 & (~ (fFCB+fChk))> ; ^x 327 ChType 25, <255 & (~ (fFCB+fChk))> ; ^y 328 ChType 26, <255 & (~ (fFCB+fChk))> ; ^z 329 ChType 27, <255 & (~ (fFCB+fChk))> ; ^[ 330 ChType 28, <255 & (~ (fFCB+fChk))> ; ^\. 331 ChType 29, <255 & (~ (fFCB+fChk))> ; ^] 332 ChType 30, <255 & (~ (fFCB+fChk))> ; ^^ 333 ChType 31, <255 & (~ (fFCB+fChk))> ; ^_ 334 ChType " ", <255 & (~ ( fChk+fDelim+fSpChk))> 335 ChType 255, -1 336 === Switch to base=002450h -> "DOSCODETABLE" 337 section DOSCODETABLE 338 PUBLIC CharType 339 Public FCB001S,FCB001E 340 FCB001S label byte 341 CharType label byte 342 343 %assign %$index 0 344 %rep 256 345 %ifndef tableentry%[%$index] 346 %assign tableentry%[%$index] 255 347 %endif 348 %assign %$index %$index + 1 349 %endrep 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 345 <1> %ifndef tableentry%[%$index] 346 <1> %assign tableentry%[%$index] 255 347 <1> %endif 348 <1> %assign %$index %$index + 1 350 351 %assign %$index 0 352 %rep 256 353 db tableentry%[%$index] 354 %assign %$index %$index + 1 355 %endrep 0 000006E8 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006E9 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006EA F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006EB F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006EC F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006ED F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006EE F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006EF F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F0 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F1 F0 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F2 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F3 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F4 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F5 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F6 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F7 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F8 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006F9 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006FA F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006FB F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006FC F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006FD F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006FE F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000006FF F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000700 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000701 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000702 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000703 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000704 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000705 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000706 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000707 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000708 F8 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000709 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000070A F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000070B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000070C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000070D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000070E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000070F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000710 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000711 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000712 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000713 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000714 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000715 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000716 FE db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000717 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000718 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000719 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000071A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000071B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000071C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000071D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000071E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000071F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000720 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000721 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000722 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000723 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000724 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000725 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000726 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000727 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000728 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000729 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000072A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000072B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000072C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000072D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000072E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000072F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000730 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000731 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000732 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000733 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000734 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000735 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000736 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000737 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000738 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000739 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000073A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000073B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000073C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000073D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000073E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000073F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000740 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000741 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000742 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000743 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000744 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000745 F6 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000746 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000747 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000748 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000749 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000074A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000074B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000074C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000074D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000074E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000074F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000750 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000751 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000752 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000753 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000754 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000755 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000756 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000757 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000758 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000759 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000075A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000075B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000075C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000075D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000075E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000075F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000760 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000761 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000762 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000763 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000764 F4 db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000765 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000766 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000767 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000768 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000769 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000076A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000076B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000076C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000076D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000076E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000076F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000770 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000771 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000772 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000773 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000774 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000775 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000776 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000777 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000778 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000779 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000077A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000077B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000077C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000077D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000077E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000077F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000780 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000781 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000782 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000783 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000784 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000785 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000786 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000787 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000788 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000789 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000078A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000078B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000078C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000078D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000078E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000078F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000790 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000791 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000792 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000793 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000794 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000795 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000796 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000797 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000798 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 00000799 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000079A FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000079B FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000079C FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000079D FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000079E FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 0000079F FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A0 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A1 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A2 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A3 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A4 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A5 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A6 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A7 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A8 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007A9 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007AA FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007AB FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007AC FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007AD FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007AE FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007AF FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B0 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B1 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B2 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B3 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B4 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B5 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B6 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B7 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B8 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007B9 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007BA FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007BB FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007BC FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007BD FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007BE FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007BF FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C0 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C1 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C2 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C3 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C4 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C5 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C6 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C7 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C8 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007C9 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007CA FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007CB FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007CC FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007CD FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007CE FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007CF FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D0 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D1 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D2 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D3 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D4 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D5 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D6 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D7 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D8 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007D9 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007DA FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007DB FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007DC FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007DD FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007DE FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007DF FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E0 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E1 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E2 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E3 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E4 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E5 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E6 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 0 000007E7 FF db tableentry%[%$index] 354 <1> %assign %$index %$index + 1 356 FCB001E label byte 357 %pop 358 === Switch to base=002450h -> "DOSCODECODE" 359 section DOSCODECODE 360 361 ; end of NASM original macros 362 %ENDIF 363 ; 364 ; Get a byte from [SI], convert it to upper case, and compare for delimiter. 365 ; ZF set if a delimiter, CY set if a control character (other than TAB). 366 ; 367 ; DOS 3.3 modification for file char upper case. F.C. 5/29/86 368 procedure GetLet,NEAR 368 ****************** warning: proc GetLet... [-w+user] 0 0000574F AC LODSB 370 entry GetLet2 ;AN000;; called by uCase 0 00005750 53 PUSH BX 0 00005751 BB[0200] MOV BX,OFFSET FILE_UCASE_TAB+2 wrt DOSGROUP 373 getget: 0 00005754 3C61 CMP AL,"a" 0 00005756 7206 JB CHK1 0 00005758 3C7A CMP AL,"z" 0 0000575A 7702 JA CHK1 0 0000575C 2C20 SUB AL,20H ; Convert to upper case 379 CHK1: 0 0000575E 3C80 CMP AL,80H ; DOS 3.3 0 00005760 7205 JB GOTIT ; DOS 3.3 0 00005762 2C80 SUB AL,80H ;translate to upper case with this index 383 ; 0 00005764 E82600 call xlatb_in_dosdata 385 %If TableLook 386 GOTIT: 0 00005767 50 PUSH AX 0 00005768 BB[0000] MOV BX,OFFSET CharType 0 0000576B 2ED7 cs xlatb 390 0 0000576D A801 TEST AL,fChk 0 0000576F 58 POP AX 0 00005770 5B POP BX 0 00005771 C3 RET 395 entry GetLet3 ;AN000; called by uCase 0 00005772 53 PUSH BX ;AN000; 0 00005773 EBDF JMP getget ;AN000; 398 399 %ELSE 400 GOTIT: 401 POP BX 402 CMP AL,"." 403 retz 404 CMP AL,'"' 405 retz 406 CALL PATHCHRCMP 407 retz 408 CMP AL,"[" 409 retz 410 CMP AL,"]" 411 retz 412 %ENDIF 413 414 entry DELIM_DOS 415 416 %IF TableLook 0 00005775 50 PUSH AX 0 00005776 53 PUSH BX 419 DOSGroup equ DOSGROUP ; NASM port equate 0 00005777 BB[0000] MOV BX,OFFSET CharType 0 0000577A 2ED7 cs xlatb 0 0000577C A802 TEST AL,fDelim 0 0000577E 5B POP BX 0 0000577F 58 POP AX 0 00005780 C3 RET 426 %ELSE 427 CMP AL,":" 428 retz 429 430 CMP AL,"<" 431 retz 432 CMP AL,"|" 433 retz 434 CMP AL,">" 435 retz 436 437 CMP AL,"+" 438 retz 439 CMP AL,"=" 440 retz 441 CMP AL,";" 442 retz 443 CMP AL,"," 444 retz 445 %ENDIF 446 entry SPCHK 447 %IF TableLook 0 00005781 50 PUSH AX 0 00005782 53 PUSH BX 0 00005783 BB[0000] MOV BX,OFFSET CharType 0 00005786 2ED7 CS xlatb 0 00005788 A804 TEST AL,fSpChk 0 0000578A 5B POP BX 0 0000578B 58 POP AX 0 0000578C C3 RET 456 %ELSE 457 CMP AL,9 ; Filter out tabs too 458 retz 459 ; WARNING! " " MUST be the last compare 460 CMP AL," " 461 return 462 %ENDIF 463 EndProc GetLet 464 465 466 xlatb_in_dosdata: 467 assume ds:nothing 0 0000578D 1E push ds 469 extern doscode_getdosdata 470 0 0000578E 50 push ax 0 0000578F E8[0000] call doscode_getdosdata 0 00005792 8ED8 mov ds, ax 474 assume ds:DOSGROUP 0 00005794 58 pop ax 476 0 00005795 D7 xlatb 0 00005796 1F pop ds 479 assume ds:nothing 0 00005797 C3 retn 481 482 483 Procedure PATHCHRCMP,NEAR 483 ****************** warning: proc PATHCHRCMP... [-w+user] 0 00005798 3C2F CMP AL,'/' 0 0000579A 7606 JBE PathRet 0 0000579C 3C5C CMP AL,'\' 0 0000579E C3 return 488 GotFor: 0 0000579F B05C MOV AL,'\' 0 000057A1 C3 return 491 PathRet: 0 000057A2 74FB JZ GotFor 0 000057A4 C3 return 494 EndProc PathChrCMP 495 496 497 %IF DBCS 498 ;--------------------- 2/12/KK 499 ; Function: Check if an input byte is in the ranges of DBCS vectors. 500 ; 501 ; Input: AL ; Code to be examined 502 ; 503 ; Output: ZF = 1 : AL is SBCS ZF = 0 : AL is a DBCS leading byte 504 ; 505 ; Register: All registers are unchanged except FL 506 ; 507 procedure TESTKANJ,NEAR ;AN000; 508 call Chk_DBCS ;AN000; 509 jc TK_DBCS ;AN000; 510 cmp AL,AL ; set ZF ;AN000; 511 return ;AN000; 512 TK_DBCS: 513 PUSH AX ;AN000; 514 XOR AX,AX ;Set ZF ;AN000; 515 INC AX ;Reset ZF ;AN000; 516 POP AX ;AN000; 517 return ;AN000; 518 EndProc TESTKANJ ;AN000; 519 ; 520 Chk_DBCS PROC ;AN000; 521 PUSH DS ;AN000; 522 PUSH SI ;AN000; 523 PUSH BX ;AN000; 524 Context DS ;AN000; 525 MOV BX,offset COUNTRY_CDPG + ccSetDBCS wrt DOSGROUP ;AN000; 526 LDS SI,[BX+1] ; set EV address to DS:SI ;AN000; 527 ADD SI,2 ; Skip length ;AN000; 528 DBCS_LOOP: 529 CMP WORD PTR [SI],0 ; terminator ? ;AN000; 530 JE NON_DBCS ; if yes, no DBCS ;AN000; 531 CMP AL,[SI] ; else ;AN000; 532 JB DBCS01 ; check if AL is ;AN000; 533 CMP AL,[SI+1] ; in a range of Ev ;AN000; 534 JA DBCS01 ; if yes, DBCS ;AN000; 535 STC ; else ;AN000; 536 JMP DBCS_EXIT ; try next DBCS Ev ;AN000; 537 DBCS01: 538 ADD SI,2 ;AN000; 539 JMP DBCS_LOOP ;AN000; 540 NON_DBCS: 541 CLC ;AN000; 542 DBCS_EXIT: 543 POP BX ;AN000; 544 POP SI ;AN000; 545 POP DS ;AN000; 546 RET ;AN000; 547 Chk_DBCS ENDP ;AN000; 548 %ENDIF ;AN000; 549 END 550 ;AN000; === Trace listing source: ../DOS/msctrlc.lst 1 ; SCCSID = @(#)ibmctrlc.asm 1.1 85/04/10 2 ; 3 ; ^C and error handler for MSDOS 4 ; 5 6 [list -] 6 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 13 14 ;TITLE Control C detection, Hard error and EXIT routines 15 ;NAME IBMCTRLC 16 17 ;=== Push trace listing source: ctrlc.nas 18 %include "ctrlc.nas" ; NASM included file 1 <1> ; SCCSID = @(#)ctrlc.asm 1.4 85/08/16 2 <1> ; Low level routines for detecting special characters on CON input, 3 <1> ; the ^C exit/int code, the Hard error INT 24 code, the 4 <1> ; process termination code, and the INT 0 divide overflow handler. 5 <1> ; 6 <1> ; FATAL 7 <1> ; FATAL1 8 <1> ; reset_environment 9 <1> ; DSKSTATCHK 10 <1> ; SPOOLINT 11 <1> ; STATCHK 12 <1> ; CNTCHAND 13 <1> ; DIVOV 14 <1> ; CHARHARD 15 <1> ; HardErr_DOS 16 <1> ; 17 <1> ; Revision history: 18 <1> ; 19 <1> ; AN000 version 4.0 Jan 1988 20 <1> ; A002 PTM -- dir >lpt3 hangs 21 <1> ; A003 PTM 3957- fake version for IBMCAHE.COM 22 <1> 23 <1> ; 24 <1> ; get the appropriate segment definitions 25 <1> ; 26 <1> [list -] 26 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <5> [list -] 14 <4> [list -] 3 <3> === Switch to base=000E10h -> "DOSSTART" 4 <3> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <3> ; (no prior section) ; DOSSTART ENDS 6 <3> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <3> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <3> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <3> === Switch to base=000E10h -> "CONSTANTS" 10 <3> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <3> ; (no prior section) ; CONSTANTS ENDS 12 <3> === Switch to base=000E10h -> "DATA" 13 <3> addsection DATA, align=2 PUBLIC class=DATA 14 <3> ; (no prior section) ; DATA ENDS 15 <3> === Switch to base=000E10h -> "TABLE" 16 <3> addsection TABLE, align=2 PUBLIC class=TABLE 17 <3> ; (no prior section) ; TABLE ENDS 18 <3> === Switch to base=000E10h -> "DOSDATATABLE" 19 <3> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <3> ; (no prior section) ; DOSDATATABLE ENDS 21 <3> === Switch to base=000E10h -> "DOSDATACODE" 22 <3> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <3> ; (no prior section) ; DOSDATACODE ENDS 24 <3> === Switch to base=000E10h -> "DOSBIODATA" 25 <3> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <3> === Switch to base=000E10h -> "LAST" 27 <3> addsection LAST, align=16 PUBLIC class=LAST 28 <3> ; (no prior section) ; LAST ENDS 29 <3> 30 <3> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <3> 32 <3> %include "entryseg.nas" 1 <4> 2 <4> %ifndef ENTRYSEGNAS 3 <4> %define ENTRYSEGNAS 1 4 <4> 5 <4> %include "lmacros3.mac" 1 <5> [list -] 6 <4> === Switch to base=000000h -> "DOSENTRY" 7 <4> addsection DOSENTRY, class=%[DOSENTRY] 8 <4> 9 <4> group DOSENTRYGROUP DOSENTRY 10 <4> 11 <4> %endif 8 <2> 9 <2> %include "dcodeseg.nas" 1 <3> 2 <3> %ifndef DCODESEGNAS 3 <3> %assign DCODESEGNAS 1 4 <3> === Switch to base=002450h -> "DOSCODETABLE" 5 <3> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <3> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <3> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <3> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <3> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <3> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <3> 12 <3> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <3> 14 <3> %endif 10 <2> === Switch to base=000E10h -> "LAST" 11 <2> section LAST 12 <2> ; (no prior section) ; LAST ENDS 28 <1> 29 <1> [list +] === Switch to base=002450h -> "DOSCODECODE" 30 <1> section DOSCODECODE 31 <1> [list -] 31 ****************** <1> warning: out: ... for DOS Version 4.00 ... [-w+user] 31 ****************** <1> warning: out: BPB.INC... [-w+user] 31 ****************** <1> warning: out: ... CLONE version build switch on ... [-w+user] 31 ****************** <1> warning: out: DEVSYM.INC... [-w+user] 31 ****************** <1> warning: out: ... CLONE version build switch on ... [-w+user] 39 <1> 40 <1> I_need SFN,WORD 41 <1> I_NEED pJFN,DWORD 42 <1> i_need DevIOBuf,BYTE 43 <1> i_need DidCTRLC,BYTE 44 <1> i_need INDOS,BYTE 45 <1> i_need DSKSTCOM,BYTE 46 <1> i_need DSKSTCALL,BYTE 47 <1> i_need DSKSTST,WORD 48 <1> i_need BCON,DWORD 49 <1> i_need DSKCHRET,BYTE 50 <1> i_need DSKSTCNT,WORD 51 <1> i_need IDLEINT,BYTE 52 <1> i_need CONSWAP,BYTE 53 <1> i_need user_SS,WORD 54 <1> i_need user_SP,WORD 55 <1> i_need User_In_AX,WORD 56 <1> i_need ERRORMODE,BYTE 57 <1> i_need ConC_spsave,WORD 58 <1> i_need Exit_type,BYTE 59 <1> i_need PFLAG,BYTE 60 <1> i_need ExitHold,DWORD 61 <1> i_need WPErr,BYTE 62 <1> i_need ReadOp,BYTE 63 <1> i_need CONTSTK,WORD 64 <1> i_need Exit_Code,WORD 65 <1> i_need CurrentPDB,WORD 66 <1> i_need DIVMES,BYTE 67 <1> i_need DivMesLen,WORD 68 <1> i_need ALLOWED,BYTE 69 <1> i_need FAILERR,BYTE 70 <1> i_need EXTERR,WORD 71 <1> i_need ERR_TABLE_24,BYTE 72 <1> I_need ErrMap24,BYTE 73 <1> I_need ErrMap24End,BYTE 74 <1> I_need fAborting,BYTE 75 <1> I_need AUXStack,BYTE 76 <1> I_need SCAN_FLAG,BYTE 77 <1> I_need EXTOPEN_ON,BYTE ;AN000; DOS 4.0 78 <1> I_need InterCon,BYTE ;AN000; DOS 4.0 79 <1> I_need DOS34_FLAG,WORD ;AN000; DOS 4.0 80 <1> %ifndef BUF2 81 <1> I_need ACT_PAGE,WORD ;AN000; DOS 4.0 82 <1> %endif 83 <1> I_need Special_Version,WORD ;AN007; DOS 4.0 84 <1> %if debug 85 <1> I_need BugLev,WORD 86 <1> I_need BugTyp,WORD 87 <1> %include "bugtyp.nas" 88 <1> %endif 89 <1> %ifndef BUF2 90 <1> %IF BUFFERFLAG 91 <1> extrn restore_user_map:near 92 <1> %ENDIF 93 <1> %endif 94 <1> 95 <1> assume nocheck, ss:DOSGROUP 96 <1> 97 <1> Break 98 <1> 99 <1> procedure DSKSTATCHK,NEAR ; Check for ^C if only one level in 99 ****************** <1> warning: proc DSKSTATCHK... [-w+user] 100 <1> ASSUME DS:NOTHING, ES:NOTHING 0 000057A5 36803E[0000]01 CMP BYTE PTR [ss:INDOS],1 0 000057AB 7401C3 retnz ; Do NOTHING 0 000057AE 51 PUSH CX 0 000057AF 06 PUSH ES 0 000057B0 53 PUSH BX 0 000057B1 1E PUSH DS 0 000057B2 56 PUSH SI 0 000057B3 16 PUSH ss 0 000057B4 07 POP ES 110 <1> assume es:DOSGROUP 0 000057B5 161F Context DS 112 <1> DOSAssume CS,,"DskStatChk" 0 000057B7 C606[0000]05 MOV BYTE PTR [DSKSTCOM],DEVRDND 0 000057BC C606[0000]0E MOV BYTE PTR [DSKSTCALL],DRDNDHL 0 000057C1 C706[0000]0000 MOV word [DSKSTST],0 116 <1> %IF DBCS ;AN000; 117 <1> MOV AL, [InterCon] ;AN000;get type of status read 2/13/KK 118 <1> MOV BYTE PTR [DSKCHRET],AL ;AN000; load interim flag into packet 119 <1> %ENDIF ;AN000; 0 000057C7 BB[0000] MOV BX,OFFSET DSKSTCALL wrt DOSGROUP 0 000057CA C536[0000] LDS SI,[BCON] 122 <1> ASSUME DS:NOTHING 0 000057CE E8[0000] invoke DEVIOCALL2 0 000057D1 36F706[0000]0002 TEST word [ss:DSKSTST],STBUI 0 000057D8 7408 JZ GotCh ; No characters available 0 000057DA 30C0 XOR AL,AL ; Set zero 127 <1> RET36: 0 000057DC 5E POP SI 0 000057DD 1F POP DS 130 <1> assume ds:nothing 0 000057DE 5B POP BX 0 000057DF 07 POP ES 133 <1> assume es:nothing 0 000057E0 59 POP CX 0 000057E1 C3 return 136 <1> 137 <1> GotCh: 0 000057E2 36A0[0000] MOV AL,BYTE PTR [ss:DSKCHRET] 139 <1> DSK1: 0 000057E6 3C03 CMP AL,"C"-"@" 0 000057E8 75F2 JNZ RET36 0 000057EA 36C606[0000]04 MOV BYTE PTR [ss:DSKSTCOM],DEVRD 0 000057F0 36C606[0000]16 MOV BYTE PTR [ss:DSKSTCALL],DRDWRHL 0 000057F6 36880E[0000] MOV BYTE PTR [ss:DSKCHRET],CL 0 000057FB 36C706[0000]0000 MOV word [ss:DSKSTST],0 0 00005802 36C706[0000]0100 MOV word [ss:DSKSTCNT],1 0 00005809 E8[0000] invoke DEVIOCALL2 ; Eat the ^C 0 0000580C 5E POP SI 0 0000580D 1F POP DS 150 <1> assume ds:nothing 0 0000580E 5B POP BX ; Clean stack 0 0000580F 07 POP ES 153 <1> assume es:nothing 0 00005810 59 POP CX 0 00005811 E9C200 JMP CNTCHAND 156 <1> 157 <1> NOSTOP: 0 00005814 3C10 CMP AL,"P"-"@" 0 00005816 7509 JNZ .check_next 0 00005818 36803E[0000]00 CMP BYTE PTR [ss:SCAN_FLAG],0 ; ALT_Q ? 0 0000581E 7406 JZ INCHKJ ; no 0 00005820 C3 return 163 <1> .check_next: 164 <1> %IFN TOGLPRN 165 <1> CMP AL,"N"-"@" 166 <1> JZ INCHKJ 167 <1> %ENDIF 168 <1> 0 00005821 3C03 CMP AL,"C"-"@" 0 00005823 7401 JZ INCHKJ 171 <1> check_end: 0 00005825 C3 return 173 <1> 174 <1> INCHKJ: 0 00005826 E99700 JMP INCHK 176 <1> 177 <1> EndProc DSKSTATCHK 178 <1> 179 <1> ; 180 <1> ; SpoolInt - signal processes that the DOS is truly idle. We are allowed to 181 <1> ; do this ONLY if we are working on a 1-12 system call AND if we are not in 182 <1> ; the middle of an INT 24. 183 <1> ; 184 <1> procedure SPOOLINT,NEAR 184 ****************** <1> warning: proc SPOOLINT... [-w+user] 0 00005829 9C PUSHF 186 <1> IdleInt equ IDLEINT ; NASM port label 0 0000582A 36F606[0000]FF test byte [ss:IdleInt],-1 188 <1> POPFRet equ POPFRET ; NASM port label 0 00005830 7414 jz POPFRet 190 <1> ErrorMode equ ERRORMODE ; NASM port label 0 00005832 36F606[0000]FF test byte [ss:ErrorMode],-1 0 00005838 750C jnz POPFRet 193 <1> ; 194 <1> ; Note that we are going to allow an external program to issue system calls 195 <1> ; at this time. We MUST preserve IdleInt across this. 196 <1> ; 0 0000583A 36FF36[0000] PUSH WORD [ss:IdleInt] 0 0000583F CD28 INT int_spooler 0 00005841 368F06[0000] POP WORD [ss:IdleInt] 200 <1> POPFRET: 0 00005846 9D POPF 0 00005847 C3 return 203 <1> EndProc SPOOLINT 204 <1> 205 <1> procedure STATCHK,NEAR 205 ****************** <1> warning: proc STATCHK... [-w+user] 206 <1> 0 00005848 E85AFF invoke DSKSTATCHK ; Allows ^C to be detected under 208 <1> ; input redirection 0 0000584B 53 PUSH BX 0 0000584C 31DB XOR BX,BX 0 0000584E E8[0000] invoke GET_IO_SFT 0 00005851 5B POP BX 0 00005852 72F3 retc 0 00005854 B401 MOV AH,1 0 00005856 E8[0000] invoke IOFUNC 0 00005859 74CE JZ SPOOLINT 0 0000585B 3C13 CMP AL,"S"-"@" 0 0000585D 75B5 JNZ NOSTOP 219 <1> 0 0000585F 36803E[0000]00 CMP BYTE PTR [ss:SCAN_FLAG],0 ;AN000; ALT_R ? 0 00005865 75BE JNZ check_end ;AN000; yes 0 00005867 30E4 XOR AH,AH 0 00005869 E8[0000] invoke IOFUNC ; Eat Cntrl-S 0 0000586C EB4B JMP SHORT PAUSOSTRT 225 <1> PRINTOFF: 226 <1> PRINTON: 0 0000586E 36F616[0000] NOT BYTE PTR [ss:PFLAG] 0 00005873 53 PUSH BX 0 00005874 BB0400 MOV BX,4 0 00005877 E8[0000] invoke GET_IO_SFT 0 0000587A 5B POP BX 0 0000587B 72CA retc 0 0000587D 06 PUSH ES 0 0000587E 57 PUSH DI 0 0000587F 1E PUSH DS 0 00005880 07 POP ES 237 <1> assume es:nothing 0 00005881 89F7 MOV DI,SI ; ES:DI -> SFT 0 00005883 26F745050008 TEST word [ES:DI + sf_flags],sf_net_spool 0 00005889 7418 JZ NORM_PR ; Not redirected, echo is OK 241 <1> MultNet equ MultNET ; NASM port equate 0 0000588B 50B82611CD2F58 Callinstall NetSpoolEchoCheck,MultNet,38,, ; See if allowed 0 00005892 730F JNC NORM_PR ; Echo is OK 0 00005894 36C606[0000]00 MOV BYTE PTR [ss:PFLAG],0 ; If not allowed, disable echo 0 0000589A 50B82411CD2F58 Callinstall NetSpoolClose,MultNet,36,, ; and close 0 000058A1 EB10 JMP SHORT RETP6 247 <1> 248 <1> NORM_PR: 0 000058A3 36803E[0000]00 CMP BYTE PTR [ss:PFLAG],0 0 000058A9 7505 JNZ PRNOPN 0 000058AB E8[0000] invoke DEV_CLOSE_SFT 0 000058AE EB03 JMP SHORT RETP6 253 <1> 254 <1> PRNOPN: 0 000058B0 E8[0000] invoke DEV_OPEN_SFT 256 <1> RETP6: 0 000058B3 5F POP DI 0 000058B4 07 POP ES 259 <1> assume es:nothing 0 000058B5 C3 return 261 <1> 262 <1> PAUSOLP: 0 000058B6 E870FF CALL SPOOLINT 264 <1> PAUSOSTRT: 0 000058B9 B401 MOV AH,1 0 000058BB E8[0000] invoke IOFUNC 0 000058BE 74F6 JZ PAUSOLP 268 <1> INCHK: 0 000058C0 53 PUSH BX 0 000058C1 31DB XOR BX,BX 0 000058C3 E8[0000] invoke GET_IO_SFT 0 000058C6 5B POP BX 0 000058C7 72EC retc 0 000058C9 30E4 XOR AH,AH 0 000058CB E8[0000] invoke IOFUNC 0 000058CE 3C10 CMP AL,"P"-"@" 277 <1> ;;;;; 7/14/86 ALT_Q key fix 278 <1> 0 000058D0 749C JZ PRINTON ; no! must be CTRL_P 280 <1> 281 <1> NOPRINT: 282 <1> ;;;;; 7/14/86 ALT_Q key fix 283 <1> %IFN TOGLPRN 284 <1> CMP AL,"N"-"@" 285 <1> JZ PRINTOFF 286 <1> %ENDIF 0 000058D2 3C03 CMP AL,"C"-"@" 0 000058D4 75DF retnz 289 <1> EndProc STATCHK 290 <1> 291 <1> procedure CNTCHAND,NEAR 291 ****************** <1> warning: proc CNTCHAND... [-w+user] 292 <1> ; Ctrl-C handler. 293 <1> ; "^C" and CR/LF is printed. Then the user registers are restored and the 294 <1> ; user CTRL-C handler is executed. At this point the top of the stack has 1) 295 <1> ; the interrupt return address should the user CTRL-C handler wish to allow 296 <1> ; processing to continue; 2) the original interrupt return address to the code 297 <1> ; that performed the function call in the first place. If the user CTRL-C 298 <1> ; handler wishes to continue, it must leave all registers unchanged and RET 299 <1> ; (not IRET) with carry CLEAR. If carry is SET then an terminate system call 300 <1> ; is simulated. 0 000058D6 36F706[0000]0002 TEST word [ss:DOS34_FLAG],CTRL_BREAK_FLAG ;AN002; from RAWOUT 0 000058DD 7508 JNZ around_deadlock ;AN002; 0 000058DF B003 MOV AL,3 ; Display "^C" 0 000058E1 E8[0000] invoke BUFOUT 0 000058E4 E8[0000] invoke CRLF 306 <1> around_deadlock: ;AN002; 0 000058E7 161F Context DS 0 000058E9 803E[0000]00 CMP BYTE PTR [CONSWAP],0 0 000058EE 7403 JZ NOSWAP 0 000058F0 E8[0000] invoke SWAPBACK 311 <1> NOSWAP: 0 000058F3 FA CLI ; Prepare to play with stack 0 000058F4 8E16[0000] MOV SS,[user_SS] ; User stack now restored 314 <1> ASSUME SS:NOTHING 0 000058F8 8B26[0000] MOV SP,[user_SP] 0 000058FC E8[0000] invoke restore_world ; User registers now restored 317 <1> ASSUME DS:NOTHING 0 000058FF 53 push bx 0 00005900 53 push bx 0 00005901 BB[0000] mov bx, .next 321 <1> extern transfer_doscode_to_dosdata 0 00005904 E9[0000] jmp transfer_doscode_to_dosdata 323 <1> === Switch to base=000E10h -> "DOSDATACODE" 324 <1> section DOSDATACODE ; in DOSDATA 325 <1> .next: 0 0000127F 83C406 add sp, 6 ; discard retn & retf addresses 327 <1> 0 00001282 2EC606[0000]00 MOV BYTE PTR [cs:INDOS],0 ; Go to known state 0 00001288 2EC606[0000]00 MOV BYTE PTR [cs:ERRORMODE],0 0 0000128E 2E8926[0000] MOV [cs:ConC_spsave],SP ; save his SP 0 00001293 F8 CLC 0 00001294 CD23 INT int_ctrl_c ; Execute user Ctrl-C handler 333 <1> ; 334 <1> ; The user has returned to us. The circumstances we allow are: 335 <1> ; 336 <1> ; IRET We retry the operation by redispatching the system call 337 <1> ; CLC/RETF POP the stack and retry 338 <1> ; ... Exit the current process with ^C exit 339 <1> ; 340 <1> ; User's may RETURN to us and leave interrupts on. Turn 'em off just to be 341 <1> ; sure 342 <1> ; 0 00001296 FA CLI 344 <1> user_IN_AX equ User_In_AX ; NASM port label 0 00001297 2EA3[0000] MOV [cs:user_IN_AX],ax ; save the AX 0 0000129B 9C PUSHF ; and the flags (maybe new call) 0 0000129C 58 POP AX 348 <1> ; 349 <1> ; See if the input stack is identical to the output stack 350 <1> ; 0 0000129D 2E3B26[0000] CMP SP,[cs:ConC_spsave] 0 000012A2 7506 JNZ ctrlc_try_new ; current SP not the same as saved SP 353 <1> ; 354 <1> ; Repeat the operation by redispatching the system call. 355 <1> ; 356 <1> ctrlc_repeat: 0 000012A4 2EA1[0000] MOV AX,[cs:User_In_AX] 0 000012A8 EB11 jmp ctrlc_transfer_COMMAND 359 <1> ; 360 <1> ; The current SP is NOT the same as the input SP. Presume that he RETF'd 361 <1> ; leaving some flags on the stack and examine the input 362 <1> ; 363 <1> ctrlc_try_new: 0 000012AA 83C402 ADD SP,2 ; pop those flags 365 <1> f_carry equ f_Carry ; NASM port equate 0 000012AD A90100 TEST AX,f_carry ; did he return with carry? 367 <1> Ctrlc_Repeat equ ctrlc_repeat ; NASM port label 0 000012B0 74F2 JZ Ctrlc_Repeat ; no carry set, just retry 369 <1> ; 370 <1> ; Well... time to abort the user. Signal a ^C exit and use the EXIT system 371 <1> ; call.. 372 <1> ; 373 <1> ctrlc_abort: 374 <1> EXIT equ Exit ; NASM port equate 0 000012B2 B8004C MOV AX,(EXIT << 8) + 0 0 000012B5 2EC606[0000]FF MOV byte [cs:DidCTRLC],-1 377 <1> ; give up by faking $EXIT 378 <1> 379 <1> extern dosdata_to_doscode 380 <1> 381 <1> ctrlc_transfer_COMMAND: 0 000012BB 50 push ax 0 000012BC 2EFF36[0000] push word [cs:dosdata_to_doscode] 0 000012C1 B8[6201] mov ax, .next 0 000012C4 50 push ax 0 000012C5 CB retf 387 <1> === Switch to base=002450h -> "DOSCODECODE" 388 <1> section DOSCODECODE 389 <1> 390 <1> .next: 0 00005907 58 pop ax 0 00005908 E9[0000] transfer COMMAND 393 <1> 394 <1> EndProc CNTCHAND 395 <1> 396 <1> === Switch to base=002450h -> "DOSCODECODE" 397 <1> section DOSCODECODE 398 <1> 399 <1> extern doscode_getdosdata 400 <1> 401 <1> extern relocatedi19 402 <1> relocated _i00_i19 0 0000590B 7303E9[0000] jc relocatedi19 404 <1> relocated i00 0 00005910 50 push ax 0 00005911 E8[0000] call doscode_getdosdata 0 00005914 50 push ax 0 00005915 B8[4700] mov ax, DIVOV 0 00005918 50 push ax 0 00005919 CB retf 411 <1> 412 <1> === Switch to base=000E10h -> "DOSDATACODE" 413 <1> section DOSDATACODE ; in DOSDATA 414 <1> 415 <1> Break 416 <1> 417 <1> ; Default handler for division overflow trap 418 <1> procedure DIVOV,NEAR 418 ****************** <1> warning: proc DIVOV... [-w+user] 419 <1> ASSUME cs:DOSGROUP, DS:NOTHING,ES:NOTHING,SS:NOTHING 0 000012C6 2E8E06[0000] mov es, [cs:dosdata_to_doscode] 421 <1> assume es:DOSCODEGROUP 0 000012CB BE[0000] MOV SI,OFFSET DIVMES ; access with es 0 000012CE 268B1E[0000] MOV BX,[es:DivMesLen] 0 000012D3 8CC8 MOV AX,CS 425 <1> AUXSTACK equ AUXStack ; NASM port label 0 000012D5 8ED0 MOV SS,AX 0 000012D7 BC[0000] MOV SP,OFFSET AUXSTACK wrt DOSGROUP ; Enough stack for interrupts 428 <1> assume ss:DOSGROUP 0 000012DA E80200 CALL OutMes 0 000012DD EBD3 JMP ctrlc_abort ; Use Ctrl-C abort on divide overflow 431 <1> EndProc DIVOV 432 <1> 433 <1> ; 434 <1> ; OutMes: perform message output 435 <1> ; Inputs: SS:SI points to message 436 <1> ; BX has message length 437 <1> ; Outputs: message to BCON 438 <1> ; 439 <1> procedure OutMes,NEAR 439 ****************** <1> warning: proc OutMes... [-w+user] 440 <1> assume ss:DOSGROUP, es:DOSCODEGROUP 0 000012DF 161F Context DS ; get DS addressability 442 <1> 443 <1> DskStCom equ DSKSTCOM ; NASM port label 444 <1> DevWrt equ DEVWRT ; NASM port equate 0 000012E1 C606[0000]08 MOV BYTE PTR [DskStCom],DevWrt 446 <1> DskStCall equ DSKSTCALL ; NASM port label 447 <1> DRdWrHL equ DRDWRHL ; NASM port equate 0 000012E6 C606[0000]16 MOV BYTE PTR [DskStCall],DRdWrHL 449 <1> DskSTST equ DSKSTST ; NASM port label 0 000012EB C706[0000]0000 MOV word [DskSTST],0 451 <1> DskStCnt equ DSKSTCNT ; NASM port label 0 000012F1 891E[0000] MOV [DskStCnt],BX 0 000012F5 BB[0000] MOV BX,OFFSET DskStCall wrt DOSGROUP 454 <1> DskChRet equ DSKCHRET ; NASM port label 0 000012F8 8936[0100] MOV WORD PTR [DskChRet+1],SI ; transfer address (need an EQU) 0 000012FC 8C06[0300] MOV WORD PTR [DskChRet+3], es 0 00001300 C536[0000] LDS SI,[BCON] 458 <1> ASSUME DS:NOTHING 0 00001304 0E push cs ; allow far return 0 00001305 E81400 call int0_transfer_deviocall2 461 <1> assume ss:DOSGROUP, es:DOSGROUP 0 00001308 36C706[0100][0000] MOV WORD PTR [ss:DskChRet+1], OFFSET DevIOBuf wrt DOSGROUP 0 0000130F 368C16[0300] MOV WORD PTR [ss:DskChRet+3], ss 0 00001314 36C706[0000]0100 MOV word [ss:DskStCnt],1 0 0000131B C3 return 466 <1> EndProc OutMes 467 <1> 468 <1> 469 <1> int0_transfer_deviocall2: 470 <1> assume ss:DOSGROUP, es:DOSCODEGROUP 0 0000131C 06 push es 0 0000131D B8[7501] mov ax, .next ; access with es 0 00001320 50 push ax 0 00001321 1607 Context ES ; get ES addressability 0 00001323 CB retf ; branch into DOSCODE 476 <1> === Switch to base=002450h -> "DOSCODECODE" 477 <1> section DOSCODECODE 478 <1> 479 <1> .next: 480 <1> assume ss:DOSGROUP, es:DOSGROUP 0 0000591A E8[0000] invoke DEVIOCALL2 ; call routine 0 0000591D CB retf ; return back to code in DOSDATA 483 <1> 484 <1> 485 <1> Break 486 <1> 487 <1> procedure CHARHARD,NEAR 487 ****************** <1> warning: proc CHARHARD... [-w+user] 488 <1> ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 489 <1> 490 <1> ; Character device error handler 491 <1> ; Same function as HARDERR_DOS 492 <1> 493 <1> allowed_FAIL equ Allowed_FAIL ; NASM port equate 494 <1> allowed_IGNORE equ Allowed_IGNORE ; NASM port equate 495 <1> allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 0000591E 80CC38 OR AH,allowed_FAIL + allowed_IGNORE + allowed_RETRY 497 <1> Allowed equ ALLOWED ; NASM port label 0 00005921 368826[0000] MOV [ss:Allowed],AH 499 <1> EXITHOLD equ ExitHold ; NASM port label 0 00005926 368C06[0200] MOV WORD PTR [ss:EXITHOLD+2],ES 0 0000592B 36892E[0000] MOV WORD PTR [ss:EXITHOLD],BP 0 00005930 56 PUSH SI 0 00005931 81E7FF00 AND DI,STECODE 0 00005935 8CDD MOV BP,DS ; Device pointer is BP:SI 0 00005937 E86400 CALL FATALC 0 0000593A 5E POP SI 0 0000593B C3 return 508 <1> EndProc CHARHARD 509 <1> 510 <1> ; Hard disk error handler. Entry conditions: 511 <1> ; DS:BX = Original disk transfer address 512 <1> ; DX = Original logical sector number 513 <1> ; CX = Number of sectors to go (first one gave the error) 514 <1> ; AX = Hardware error code 515 <1> ; DI = Original sector transfer count 516 <1> ; ES:BP = Base of drive parameters 517 <1> ; [READOP] = 0 for read, 1 for write 518 <1> ; [ALLOWED] Set with allowed responses to this error (other bits MUST BE 0) 519 <1> ; Output: 520 <1> ; [FAILERR] will be set if user responded FAIL 521 <1> 522 <1> procedure HardErr_DOS,NEAR 522 ****************** <1> warning: proc HardErr_DOS... [-w+user] 523 <1> ASSUME DS:NOTHING,ES:NOTHING 524 <1> 0 0000593C 97 XCHG AX,DI ; Error code in DI, count in AX 0 0000593D 81E7FF00 AND DI,STECODE ; And off status bits 0 00005941 83FF00 CMP DI,error_I24_write_protect ; Write Protect Error? 0 00005944 750A JNZ NOSETWRPERR 0 00005946 50 PUSH AX 0 00005947 268A4600 MOV AL,[ES:BP + dpb_drive] 531 <1> WPERR equ WPErr ; NASM port label 0 0000594B 36A2[0000] MOV BYTE PTR [ss:WPERR],AL ; Flag drive with WP error 0 0000594F 58 POP AX 534 <1> NOSETWRPERR: 0 00005950 29C8 SUB AX,CX ; Number of sectors successfully transferred 0 00005952 01C2 ADD DX,AX ; First sector number to retry 0 00005954 52 PUSH DX 0 00005955 26F76602 MUL word [ES:BP + dpb_sector_size] ; Number of bytes transferred 0 00005959 5A POP DX 0 0000595A 01C3 ADD BX,AX ; First address for retry 0 0000595C 30E4 XOR AH,AH ; Flag disk section in error 0 0000595E 263B5606 CMP DX,[ES:BP + dpb_first_FAT] ; In reserved area? 0 00005962 721A JB ERRINT 0 00005964 FEC4 INC AH ; Flag for FAT 0 00005966 263B5611 CMP DX,[ES:BP + dpb_dir_sector] ; In FAT? 0 0000596A 7308 JAE TESTDIR ; No 0 0000596C 26C7461FFFFF MOV word [ES:BP + dpb_free_cnt],-1 ; Err in FAT must force recomp of freespace 0 00005972 EB0A JMP SHORT ERRINT 549 <1> 550 <1> TESTDIR: 0 00005974 FEC4 INC AH 0 00005976 263B560B CMP DX,[ES:BP + dpb_first_sector] ; In directory? 0 0000597A 7202 JB ERRINT 0 0000597C FEC4 INC AH ; Must be in data area 555 <1> ERRINT: 0 0000597E D0E4 SHL AH,1 ; Make room for read/write bit 557 <1> READOP equ ReadOp ; NASM port label 0 00005980 360A26[0000] OR AH,BYTE PTR [ss:READOP] ; Set bit 0 559 <1> ; If we have a write protect error when writing on a critical area on disk, 560 <1> ; do not allow a retry as this may write out garbage on any subsequent disk. 561 <1> ;test ah,1 562 <1> ;jz Not_Crit 563 <1> ;cmp ah,5 564 <1> ;ja Not_Crit 565 <1> ;and [ALLOWED],NOT Allowed_RETRY 566 <1> Not_Crit: 0 00005985 360A26[0000] OR AH,[ss:ALLOWED] ; Set the allowed_ bits 568 <1> entry FATAL 0 0000598A 268A4600 MOV AL,[ES:BP + dpb_drive] ; Get drive number 570 <1> entry FATAL1 0 0000598E 368C06[0200] MOV WORD PTR [ss:EXITHOLD+2],ES 0 00005993 36892E[0000] MOV WORD PTR [ss:EXITHOLD],BP ; The only things we preserve 0 00005998 26C47613 LES SI,[ES:BP + dpb_driver_addr] 0 0000599C 8CC5 MOV BP,ES ; BP:SI points to the device involved 575 <1> ; 576 <1> ; DI has the INT-24-style extended error. We now map the error code for this 577 <1> ; into the normalized get extended error set by using the ErrMap24 table as an 578 <1> ; translate table. Note that we translate ONLY the device returned codes and 579 <1> ; leave all others beyond the look up table alone. 580 <1> ; 581 <1> FATALC: 0 0000599E E88F01 call SET_I24_EXTENDED_ERROR 0 000059A1 83FF0C CMP DI,error_I24_gen_failure 0 000059A4 7603 JBE GOT_RIGHT_CODE ; Error codes above gen_failure get 0 000059A6 BF0C00 MOV DI,error_I24_gen_failure ; mapped to gen_failure. Real codes 586 <1> ; Only come via GetExtendedError 587 <1> 588 <1> entry NET_I24_ENTRY 589 <1> ; Entry point used by REDIRector on Network I 24 errors. 590 <1> ; 591 <1> ASSUME DS:NOTHING, ES:NOTHING, SS:DOSGROUP 592 <1> ; 593 <1> ; ALL I 24 regs set up. ALL Extended error info SET. ALLOWED Set. 594 <1> ; EXITHOLD set for restore of ES:BP. 595 <1> 596 <1> GOT_RIGHT_CODE: 0 000059A9 36803E[0000]00 CMP BYTE PTR [ss:ERRORMODE],0 ; No INT 24s if already INT 24 0 000059AF 7405 JZ NoSetFail 0 000059B1 B003 MOV AL,3 600 <1> FailRet equ FAILRET ; NASM port label 0 000059B3 EB67 JMP FailRet 0 000059B5 90 nop ; identicalise 603 <1> NoSetFail: 0 000059B6 368926[0000] MOV [ss:CONTSTK],SP 0 000059BB 1607 Context ES 606 <1> fmt TypINT24,LevLog,<"INT 24: AX = $x DI = $x\n">, 607 <1> ; 608 <1> ; Wango!!! We may need to free some user state info... In particular, we 609 <1> ; may have locked down a JFN for a user and he may NEVER return to us. Thus, 610 <1> ; we need to free it here and then reallocate it when we come back. 611 <1> ; 0 000059BD 36833E[0000]FF CMP word [ss:SFN],-1 0 000059C3 740C JZ NoFree 0 000059C5 1E56 SaveReg 0 000059C7 36C536[0000] LDS SI,[ss:pJFN] 0 000059CC C604FF MOV BYTE PTR [SI],0FFH 0 000059CF 5E1F RestoreReg 618 <1> NoFree: 0 000059D1 FA CLI ; Prepare to play with stack 0 000059D2 36FE06[0000] INC BYTE PTR [ss:ERRORMODE] ; Flag INT 24 in progress 621 <1> ;; Extended Open hooks 0 000059D7 36F706[0000]2000 TEST word [ss:DOS34_FLAG],Force_I24_Fail ;AN000;IFS. form IFS Call Back ;AN000; 0 000059DE 7508 JNZ faili24 ;AN000;IFS. ;AN000; 624 <1> EXT_OPEN_I24_OFF equ ext_open_I24_off ; NASM port equate 0 000059E0 36F606[0000]02 TEST byte [ss:EXTOPEN_ON],EXT_OPEN_I24_OFF ;AN000;IFS.I24 error disabled ;AN000; 0 000059E6 7404 JZ i24yes ;AN000;IFS.no ;AN000; 627 <1> faili24: ;AN000; 0 000059E8 B003 MOV AL,3 ;AN000;IFS.fake fail ;AN000; 0 000059EA EB24 JMP passi24 ;AN000;IFS.exit ;AN000; 630 <1> i24yes: ;AN000; 631 <1> 632 <1> ;; Extended Open hooks 0 000059EC 368E16[0000] MOV SS,[ss:user_SS] 0 000059F1 268B26[0000] MOV SP,[ES:user_SP] ; User stack pointer restored 635 <1> ASSUME SS:NOTHING 0 000059F6 26FE0E[0000] DEC BYTE PTR [es:INDOS] ; INT 24 handler might not return 0 000059FB CD24 INT int_fatal_abort ; Fatal error interrupt vector, must preserve ES 0 000059FD 26FE06[0000] INC BYTE PTR [es:INDOS] ; Back in the DOS 0 00005A02 268926[0000] MOV [ES:user_SP],SP ; restore our stack 0 00005A07 268C16[0000] MOV [ES:user_SS],SS 0 00005A0C 8CC5 MOV BP,ES 0 00005A0E 8ED5 MOV SS,BP 643 <1> passi24: ;AN000; 644 <1> assume nocheck, ss:DOSGROUP 0 00005A10 368B26[0000] MOV SP,[ss:CONTSTK] 646 <1> ASSUME SS:DOSGROUP 0 00005A15 36C606[0000]00 MOV BYTE PTR [ss:ERRORMODE],0 ; Back from INT 24 0 00005A1B FB STI 649 <1> ;; MOV [ACT_PAGE],-1 ;LB. invalidate DOS active page ;AN000; 650 <1> ;; invoke SAVE_MAP ;LB. save user's EMS map ;AN000; 651 <1> fmt TypINT24,LevLog,<"INT 24: User reply = $x\n">, 652 <1> FAILRET: 0 00005A1C 36C42E[0000] LES BP,[ss:EXITHOLD] 654 <1> ASSUME ES:NOTHING 655 <1> ; 656 <1> ; Triage the user's reply. 657 <1> ; 0 00005A21 3C01 CMP AL,1 0 00005A23 723E JB CheckIgnore ; 0 => ignore 0 00005A25 7446 JZ CheckRetry ; 1 => retry 0 00005A27 3C03 CMP AL,3 ; 3 => fail 0 00005A29 754C JNZ DoAbort ; 2, invalid => abort 663 <1> ; 664 <1> ; The reply was fail. See if we are allowed to fail. 665 <1> ; 0 00005A2B 36F606[0000]08 TEST byte [ss:ALLOWED],allowed_FAIL ; Can we? 0 00005A31 7444 JZ DoAbort ; No, do abort 668 <1> DoFail: 0 00005A33 B003 MOV AL,3 ; just in case... 0 00005A35 36F606[0000]02 TEST byte [ss:EXTOPEN_ON],EXT_OPEN_I24_OFF ;AN000;EO. I24 error disabled 671 <1> cleanup equ CleanUp ; NASM port label 0 00005A3B 7505 JNZ cleanup ;AN000;EO. no 0 00005A3D 36FE06[0000] INC byte [ss:FAILERR] ; Tell everybody 674 <1> CleanUp: 675 <1> WpErr equ WPErr ; NASM port label 0 00005A42 36C606[0000]FF MOV byte [ss:WpErr],-1 0 00005A48 36833E[0000]FF CMP word [ss:SFN],-1 0 00005A4E 7501C3 retz 0 00005A51 1E5650 SaveReg 0 00005A54 36A1[0000] MOV AX,[ss:SFN] 0 00005A58 36C536[0000] LDS SI,[ss:pJFN] 0 00005A5D 8804 MOV [SI],AL 0 00005A5F 585E1F RestoreReg 0 00005A62 C3 return 685 <1> ; 686 <1> ; The reply was IGNORE. See if we are allowed to ignore. 687 <1> ; 688 <1> CheckIgnore: 0 00005A63 36F606[0000]20 TEST byte [ss:ALLOWED],allowed_IGNORE ; Can we? 0 00005A69 74C8 JZ DoFail ; No, do fail 0 00005A6B EBD5 JMP CleanUp 692 <1> ; 693 <1> ; The reply was RETRY. See if we are allowed to retry. 694 <1> ; 695 <1> CheckRetry: 0 00005A6D 36F606[0000]10 TEST byte [ss:ALLOWED],allowed_RETRY ; Can we? 0 00005A73 74BE JZ DoFail ; No, do fail 0 00005A75 EBCB JMP CleanUp 699 <1> ; 700 <1> ; The reply was ABORT. 701 <1> ; 702 <1> DoAbort: 0 00005A77 161F Context DS 0 00005A79 803E[0000]00 CMP BYTE PTR [CONSWAP],0 0 00005A7E 7403 JZ NOSWAP2 0 00005A80 E8[0000] invoke SWAPBACK 707 <1> NOSWAP2: 708 <1> ; 709 <1> ; See if we are to truly abort. If we are in the process of aborting, turn 710 <1> ; this abort into a fail. 711 <1> ; 0 00005A83 F606[0000]FF TEST byte [fAborting],-1 0 00005A88 75A9 JNZ DoFail 714 <1> ; 715 <1> ; Set return code 716 <1> ; 717 <1> exit_Type equ Exit_type ; NASM port label 718 <1> Exit_hard_error equ Exit_Hard_Error ; NASM port equate 0 00005A8A C606[0000]02 MOV BYTE PTR [exit_Type],Exit_hard_error 0 00005A8F 30C0 XOR AL,AL 721 <1> ; 722 <1> ; we are truly aborting the process. Go restore information from the PDB as 723 <1> ; necessary. 724 <1> ; 0 00005A91 E9[0000] Transfer exit_inner 726 <1> ; 727 <1> ; reset_environment checks the DS value against the CurrentPDB. If they are 728 <1> ; different, then an old-style return is performed. If they are the same, 729 <1> ; then we release jfns and restore to parent. We still use the PDB at DS:0 as 730 <1> ; the source of the terminate addresses. 731 <1> ; 732 <1> ; Some subtlety: We are about to issue a bunch of calls that *may* generate 733 <1> ; INT 24s. We *cannot* allow the user to restart the abort process; we may 734 <1> ; end up aborting the wrong process or turn a terminate/stay/resident into a 735 <1> ; normal abort and leave interrupt handlers around. What we do is to set a 736 <1> ; flag that will indicate that if any abort code is seen, we just continue the 737 <1> ; operation. In essence, we dis-allow the abort response. 738 <1> ; 739 <1> ; output: none. 740 <1> ; 741 <1> entry reset_environment 742 <1> ASSUME DS:NOTHING,ES:NOTHING 743 <1> 0 00005A94 E8[0000] invoke Reset_Version ;AN007;MS. reset version number 0 00005A97 1E PUSH DS ; save PDB of process 746 <1> 747 <1> ; 748 <1> ; There are no critical sections in force. Although we may enter here with 749 <1> ; critical sections locked down, they are no longer relevant. We may safely 750 <1> ; free all allocated resources. 751 <1> ; 0 00005A98 B482 MOV AH,82h 0 00005A9A CD2A INT int_IBM 754 <1> 0 00005A9C 36C606[0000]FF MOV byte [ss:fAborting],-1 ; signal abort in progress 756 <1> 757 <1> multNet equ MultNET ; NASM port equate 0 00005AA2 B82211CD2F CallInstall NetResetEnvironment, multNet, 34 ;DOS 4.00 doesn't need it 759 <1> ; Allow REDIR to clear some stuff 760 <1> ; On process exit. 761 <1> int_Terminate equ int_terminate ; NASM port equate 0 00005AA7 B022 MOV AL,int_Terminate 0 00005AA9 E8[0000] invoke D_Get_interrupt_vector ; and who to go to 764 <1> 0 00005AAC 59 POP CX ; get ThisPDB 0 00005AAD 0653 SaveReg ; save return address 767 <1> 0 00005AAF 368B1E[0000] MOV BX,[ss:CurrentPDB] ; get currentPDB 0 00005AB4 8EDB MOV DS,BX 770 <1> assume ds:PSP 0 00005AB6 A11600 MOV AX,[PDB_Parent_PID] ; get parentPDB 772 <1> 773 <1> ; 774 <1> ; AX = parentPDB, BX = CurrentPDB, CX = ThisPDB 775 <1> ; Only free handles if AX <> BX and BX = CX and [exit_code].upper is not 776 <1> ; Exit_keep_process 777 <1> ; 0 00005AB9 39D8 CMP AX,BX 0 00005ABB 7420 JZ reset_return ; parentPDB = CurrentPDB 0 00005ABD 39CB CMP BX,CX 0 00005ABF 751C JNZ reset_return ; CurrentPDB <> ThisPDB 0 00005AC1 50 PUSH AX ; save parent 783 <1> exit_type equ Exit_type ; NASM port label 784 <1> Exit_keep_process equ Exit_Keep_process ; NASM port equate 0 00005AC2 36803E[0000]03 CMP BYTE PTR [ss:exit_type],Exit_keep_process 0 00005AC8 740E JZ reset_to_parent ; keeping this process 787 <1> ; 788 <1> ; Kill off remainder of this process. Close file handles and signal to 789 <1> ; relevant network folks that this process is dead. Remember that CurrentPDB 790 <1> ; is STILL the current process! 791 <1> ; 0 00005ACA 53 push bx 0 00005ACB E8[0000] invoke DOS_ABORT 0 00005ACE 5B pop bx 795 <1> 796 <1> ; lDOS: Free memory last, we don't want to operate on freed memory 797 <1> ; in DOS_ABORT. It needs to access the old Process Handle Table. 798 <1> ; (FreeDOS does close the handles before freeing memory too.) 799 <1> ; We are truly removing a process. Free all allocation blocks belonging to 800 <1> ; this PDB 0 00005ACF E8[0000] EnterCrit critMem 0 00005AD2 E8[0000] invoke arena_free_process 0 00005AD5 E8[0000] LeaveCrit critMem 804 <1> 805 <1> reset_to_parent: 0 00005AD8 368F06[0000] POP word [ss:CurrentPDB] ; set up process as parent 807 <1> 808 <1> reset_return: ; come here for normal return 0 00005ADD 16 PUSH ss 0 00005ADE 1F POP DS 811 <1> ASSUME DS:DOSGROUP 0 00005ADF B0FF MOV AL,-1 813 <1> ; 814 <1> ; make sure that everything is clean In this case ignore any errors, we cannot 815 <1> ; "FAIL" the abort, the program being aborted is dead. 816 <1> ; 0 00005AE1 E8[0000] EnterCrit critDisk 0 00005AE4 E8[0000] invoke FLUSHBUF 0 00005AE7 E8[0000] LeaveCrit critDisk 820 <1> ; 821 <1> ; Decrement open ref. count if we had done a virtual open earlier. 822 <1> ; 0 00005AEA E8[0000] invoke CHECK_VIRT_OPEN 824 <1> %ifndef BUF2 825 <1> %IF BUFFERFLAG 826 <1> RESTORE_USER_MAP equ restore_user_map ; NASM port label 827 <1> invoke RESTORE_USER_MAP ;AN000;LB. restore user's EMS map 828 <1> %ENDIF 829 <1> %endif 0 00005AED FA CLI 0 00005AEE C606[0000]FF MOV BYTE PTR [WPERR],-1 ; Forget about WP error 0 00005AF3 C606[0000]00 MOV byte [fAborting],0 ; let aborts occur 833 <1> 834 <1> %if 1 0 00005AF8 8E06[0000] mov es, [CurrentPDB] ; => PSP 836 <1> assume es:PSP 0 00005AFC 26C43E2E00 les di, [es:PDB_User_stack] ; -> user stack we'll restore 838 <1> assume es:nothing 0 00005B01 83C712 add di, user_IP ; -> ip, cs, fl on stack 0 00005B04 58 pop ax 0 00005B05 AB stosw ; user_IP = ri22o (PRA) 0 00005B06 A3[0000] mov word [ExitHold], ax ; set compat variable 0 00005B09 58 pop ax 0 00005B0A AB stosw ; user_CS = ri22s (PRA) 0 00005B0B A3[0200] mov word [ExitHold + 2], ax ; set compat variable 0 00005B0E B802F2 MOV AX,0F202h ; STI, NC 0 00005B11 AB stosw ; user_F = flags 848 <1> 0 00005B12 268B45E8 mov ax, [es:di - (user_F + 2) + user_AX] 850 <1> ; get user ax 851 <1> User_SP equ user_SP ; NASM port label 0 00005B16 A3[0000] mov [User_SP], ax ; set compat variable 853 <1> 0 00005B19 8E06[0000] MOV es,[CurrentPDB] 855 <1> ASSUME es:NOTHING 856 <1> PDB_user_stack equ PDB_User_stack ; NASM port equate 0 00005B1D 268E163000 MOV SS,WORD PTR [es:PDB_user_stack+2] 0 00005B22 268B262E00 MOV SP,WORD PTR [es:PDB_user_stack] 859 <1> ; restore stack for PRA entry 860 <1> ASSUME SS:NOTHING 0 00005B27 C606[0000]00 MOV BYTE PTR [INDOS],0 ; Go to known state 0 00005B2C E8[0000] invoke restore_world ; pop our stack frame 863 <1> ASSUME ES:NOTHING, ds:nothing 864 <1> 0 00005B2F CF iret ; iret to PRA 866 <1> %else 867 <1> assume ds:DOSGROUP, ss:DOSGROUP 868 <1> POP WORD [ExitHold] 869 <1> POP WORD [ExitHold+2] 870 <1> 871 <1> ; 872 <1> ; Snake into multitasking... Get stack from CurrentPDB person 873 <1> ; 874 <1> MOV DS,[CurrentPDB] 875 <1> ASSUME DS:NOTHING 876 <1> PDB_user_stack equ PDB_User_stack ; NASM port equate 877 <1> MOV SS,WORD PTR [PDB_user_stack+2] 878 <1> MOV SP,WORD PTR [PDB_user_stack] 879 <1> 880 <1> ASSUME SS:NOTHING 881 <1> invoke restore_world 882 <1> ASSUME ES:NOTHING 883 <1> 884 <1> push bx 885 <1> push bx 886 <1> mov bx, .next 887 <1> jmp transfer_doscode_to_dosdata 888 <1> === Switch to base=000E10h -> "DOSDATACODE" 889 <1> section DOSDATACODE ; in DOSDATA 890 <1> .next: 891 <1> add sp, 6 ; discard retn & retf addresses 892 <1> 893 <1> User_SP equ user_SP ; NASM port label 894 <1> MOV [cs:User_SP],AX 895 <1> POP AX ; suck off CS:IP of interrupt... 896 <1> POP AX 897 <1> POP AX 898 <1> MOV AX,0F202h ; STI 899 <1> PUSH AX 900 <1> PUSH WORD PTR [cs:EXITHOLD+2] 901 <1> PUSH WORD PTR [cs:EXITHOLD] 902 <1> MOV AX,[cs:User_SP] 903 <1> MOV BYTE PTR [cs:INDOS], 0 ; Go to known state 904 <1> IRET ; Long return back to user terminate address 905 <1> %endif 906 <1> 907 <1> 908 <1> EndProc HardErr_DOS 908 ****************** <1> warning: ***** Possible stack size error in HardErr_DOS ***** [-w+user] 909 <1> 910 <1> === Switch to base=002450h -> "DOSCODECODE" 911 <1> section DOSCODECODE 912 <1> 913 <1> ; 914 <1> ; This routine handles extended error codes. 915 <1> ; Input : DI = error code from device 916 <1> ; Output: All EXTERR fields are set 917 <1> ; 918 <1> Procedure SET_I24_EXTENDED_ERROR,NEAR 918 ****************** <1> warning: proc SET_I24_EXTENDED_ERROR... [-w+user] 919 <1> assume ss:DOSGROUP 0 00005B30 50 PUSH AX 921 <1> DOSGroup equ DOSGROUP ; NASM port equate 0 00005B31 B8[0000] MOV AX,OFFSET ErrMap24End 0 00005B34 2D[0000] SUB AX,OFFSET ErrMap24 924 <1> ; 925 <1> ; AX is the index of the first unavailable error. Do not translate if 926 <1> ; greater or equal to AX. 927 <1> ; 0 00005B37 39C7 CMP DI,AX 0 00005B39 89F8 MOV AX,DI 0 00005B3B 7307 JAE NoTrans 0 00005B3D 2E8A85[0000] MOV AL,[cs:ErrMap24 + DI] 0 00005B42 30E4 XOR AH,AH 933 <1> NoTrans: 0 00005B44 36A3[0000] MOV [ss:EXTERR],AX 0 00005B48 58 POP AX 936 <1> ; 937 <1> ; Now Extended error is set correctly. Translate it to get correct error 938 <1> ; locus class and recommended action. 939 <1> ; 0 00005B49 56 PUSH SI 0 00005B4A BE[0000] MOV SI,OFFSET ERR_TABLE_24 0 00005B4D E8[0000] invoke CAL_LK ; Set other extended error fields 0 00005B50 5E POP SI 0 00005B51 C3 ret 945 <1> EndProc SET_I24_EXTENDED_ERROR 946 <1> 947 <1> END 948 <1> 949 <1> 19 ;=== Pop trace listing source 20 === Trace listing source: ../DOS/fat.lst 1 ; SCCSID = @(#)fat.asm 1.3 85/08/15 2 ; SCCSID = @(#)fat.asm 1.3 85/08/15 3 ;TITLE FAT - FAT maintenance routines 4 ;NAME FAT 5 ; Low level local device routines for performing disk change sequence, 6 ; setting cluster validity, and manipulating the FAT 7 ; 8 ; IsEof 9 ; UNPACK 10 ; PACK 11 ; MAPCLUSTER 12 ; FATREAD_SFT 13 ; FATREAD_CDS 14 ; FAT_operation 15 ; 16 ; Revision history: 17 ; 18 ; AN000 version Jan. 1988 19 ; A001 PTM -- disk changed for look ahead buffers 20 ; 21 22 ; 23 ; get the appropriate segment definitions 24 ; 25 [list -] 25 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 27 28 [list +] === Switch to base=002450h -> "DOSCODECODE" 29 section DOSCODECODE 30 [list -] 30 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 30 ****************** warning: out: BPB.INC... [-w+user] 30 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 30 ****************** warning: out: DEVSYM.INC... [-w+user] 37 38 FastDiv equ TRUE 39 40 i_need CURBUF,DWORD 41 i_need CLUSSPLIT,BYTE 42 i_need CLUSSAVE,WORD 43 i_need CLUSSEC,DWORD ;F.C. >32mb ;AN000; 44 i_need THISDRV,BYTE 45 i_need THISDPB,DWORD 46 i_need DEVCALL,BYTE 47 i_need CALLMED,BYTE 48 i_need CALLRBYT,BYTE 49 i_need BUFFHEAD,DWORD 50 i_need CALLXAD,DWORD 51 i_need CALLBPB,DWORD 52 i_need CDSADDR,DWORD 53 i_need CDSCOUNT,BYTE 54 i_need EXTERR,WORD 55 i_need EXTERRPT,DWORD 56 i_need CALLVIDM,DWORD 57 i_need ReadOp,BYTE 58 i_need FAILERR,BYTE 59 i_need ALLOWED,BYTE 60 i_need VOLCHNG_FLAG,BYTE 61 i_need HIGH_SECTOR,WORD 62 %ifdef BUF2 63 i_need BUF2_Dirty_Count,WORD 64 %else 65 i_need BUF_HASH_COUNT,WORD 66 i_need BUF_HASH_PTR,DWORD 67 i_need FIRST_BUFF_ADDR,WORD 68 i_need SC_CACHE_COUNT,WORD ;AN001; 69 %endif 70 i_need CURSC_DRIVE,BYTE ;AN001; 71 72 73 Break 74 75 ; 76 ; IsEOF - check the fat value in BX for eof. 77 ; 78 ; Inputs: ES:BP point to DPB 79 ; BX has fat value 80 ; Outputs: JAE eof 81 ; Registers modified: none 82 Procedure IsEof,NEAR 82 ****************** warning: proc IsEof... [-w+user] 83 ASSUME SS:DOSGROUP,DS:NOTHING,ES:NOTHING 84 Assert ISDPB,,"IsEOF" 0 00005B52 26817E0DF60F CMP word [ES:BP + dpb_max_cluster],4096-10 ; is this 16 bit fat? 0 00005B58 730B JAE EOF16 ; yes, check for eof there 87 ;J.K. 8/27/86 88 ;Modified to accept 0FF0h as an eof. This is to handle the diskfull case 89 ;of any media that has "F0"(Other) as a MediaByte. 90 ;Hopely, this does not create any side effect for those who may use any value 91 ;other than "FF8-FFF" as an Eof for their own file. 0 00005B5A 81FBF00F cmp bx,0FF0h 0 00005B5E 7404 je IsEOF_other 0 00005B60 81FBF80F CMP BX,0FF8h ; do the 12 bit compare 95 IsEOF_other: 0 00005B64 C3 return 97 EOF16: 0 00005B65 83FBF8 CMP BX,0FFF8h ; 16 bit compare 0 00005B68 C3 return 100 EndProc IsEof 101 102 Break 103 104 ; Inputs: 105 ; BX = Cluster number (may be full 16-bit quantity) 106 ; ES:BP = Base of drive parameters 107 ; Outputs: 108 ; DI = Contents of FAT for given cluster (may be full 16-bit quantity) 109 ; Zero set means DI=0 (free cluster) 110 ; Carry set means error (currently user FAILed to I 24) 111 ; SI Destroyed, No other registers affected. Fatal error if cluster too big. 112 113 procedure UNPACK,NEAR 113 ****************** warning: proc UNPACK... [-w+user] 114 DOSAssume CS,,"UnPack" 115 ASSUME ES:NOTHING 116 117 Assert ISDPB,,"Unpack" 0 00005B69 263B5E0D CMP BX,[ES:BP + dpb_max_cluster] 0 00005B6D 7726 JA HURTFAT 0 00005B6F E8D300 CALL MAPCLUSTER 121 ASSUME DS:NOTHING 0 00005B72 721E jc DoContext 0 00005B74 8B3D MOV DI,[DI] 0 00005B76 750E JNZ High12 ; MZ if high 12 bits, go get 'em 0 00005B78 268B760D MOV SI,[ES:BP + dpb_max_cluster] ; MZ is this 16-bit fat? 0 00005B7C 81FEF60F CMP SI,4096-10 0 00005B80 720C JB Unpack12 ; MZ No, go 'AND' off bits 0 00005B82 85FF test DI,DI ; MZ set zero condition code, clears carry 0 00005B84 EB0C JMP SHORT DoContext ; MZ go do context 130 131 High12: 0 00005B86 D1EF SHR DI,1 0 00005B88 D1EF SHR DI,1 0 00005B8A D1EF SHR DI,1 0 00005B8C D1EF SHR DI,1 136 Unpack12: 0 00005B8E 81E7FF0F AND DI,0FFFH ; Clears carry 138 DoContext: 0 00005B92 16 PUSH SS 0 00005B93 1F POP DS 141 assume ds:DOSGROUP 0 00005B94 C3 return 143 144 HURTFAT: 0 00005B95 26C7461FFFFF MOV word [ES:BP + dpb_free_cnt],-1 ; Err in FAT must force recomp of freespace 0 00005B9B 50 PUSH AX 147 allowed_fail equ Allowed_FAIL ; NASM port equate 0 00005B9C B488 MOV AH,allowed_fail + 80h 149 Allowed equ ALLOWED ; NASM port label 0 00005B9E 36C606[0000]08 MOV byte [ss:Allowed],allowed_fail 151 ; 152 ; Signal Bad FAT to INT int_fatal_abort handler. We have an invalid cluster. 153 ; 0 00005BA4 BFFF0F MOV DI,0FFFH ; In case INT int_fatal_abort returns (it shouldn't) 0 00005BA7 E8[0000] invoke FATAL 0 00005BAA 3C03 CMP AL,3 0 00005BAC F8 CLC 0 00005BAD 7501 JNZ OKU_RET ; Try to ignore bad FAT 0 00005BAF F9 STC ; User said FAIL 160 OKU_RET: 0 00005BB0 58 POP AX 0 00005BB1 C3 return 163 EndProc UNPACK 164 165 Break 166 167 ; Inputs: 168 ; BX = Cluster number 169 ; DX = Data 170 ; ES:BP = Pointer to drive DPB 171 ; Outputs: 172 ; The data is stored in the FAT at the given cluster. 173 ; SI,DX,DI all destroyed 174 ; Carry set means error (currently user FAILed to I 24) 175 ; No other registers affected 176 177 procedure PACK,NEAR 177 ****************** warning: proc PACK... [-w+user] 178 DOSAssume CS,,"Pack" 179 ASSUME ES:NOTHING 180 181 Assert ISDPB,,"Pack" 0 00005BB2 E89000 CALL MAPCLUSTER 183 ASSUME DS:NOTHING 0 00005BB5 72DB JC DoContext 0 00005BB7 8B35 MOV SI,[DI] 186 Aligned equ ALIGNED ; NASM port label 0 00005BB9 740B JZ Aligned ; byte (not nibble) aligned 0 00005BBB 51 PUSH CX ; move data to upper 12 bits 0 00005BBC B104 MOV CL,4 0 00005BBE D3E2 SHL DX,CL 0 00005BC0 59 POP CX 0 00005BC1 83E60F AND SI,0FH ; leave in original low 4 bits 0 00005BC4 EB14 JMP SHORT PACKIN 194 ALIGNED: 0 00005BC6 26817E0DF60F CMP word [ES:BP + dpb_max_cluster],4096-10 ; MZ 16 bit fats? 0 00005BCC 730A JAE Pack16 ; MZ yes, go clobber original data 0 00005BCE 81E600F0 AND SI,0F000H ; MZ leave in upper 4 bits of original 0 00005BD2 81E2FF0F AND DX,0FFFh ; MZ store only 12 bits 199 PackIn equ PACKIN ; NASM port label 0 00005BD6 EB02 JMP SHORT PackIn ; MZ go store 201 Pack16: 0 00005BD8 31F6 XOR SI,SI ; MZ no original data 203 PACKIN: 0 00005BDA 09D6 OR SI,DX 0 00005BDC 8935 MOV [DI],SI 0 00005BDE 36C536[0000] LDS SI,[ss:CURBUF] 0 00005BE3 F6440540 TEST byte [SI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00005BE7 7507 JNZ yesdirty ;LB. don't increment dirty count ;AN000; 0 00005BE9 E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00005BEC 804C0540 OR byte [SI + buf_flags],buf_dirty ;LB. ;AN000; 211 yesdirty: ;LB. ;AN000; 0 00005BF0 36803E[0000]00 CMP BYTE PTR [ss:CLUSSPLIT],0 0 00005BF6 161F Context DS 0 00005BF8 74B7 retz ; Carry clear 0 00005BFA 50 PUSH AX 0 00005BFB 53 PUSH BX 0 00005BFC 51 PUSH CX 0 00005BFD A1[0000] MOV AX,[CLUSSAVE] 0 00005C00 8E1E[0200] MOV DS,WORD PTR [CURBUF+2] 220 ASSUME DS:NOTHING 0 00005C04 83C610 ADD SI,BUFINSIZ 0 00005C07 8824 MOV [SI],AH 0 00005C09 161F Context DS 0 00005C0B 50 PUSH AX 0 00005C0C 8B16[0200] MOV DX,WORD PTR [CLUSSEC+2] ;F.C. >32mb ;AN000; 0 00005C10 8916[0000] MOV WORD PTR [HIGH_SECTOR],DX ;F.C. >32mb ;AN000; 227 0 00005C14 8B16[0000] MOV DX,WORD PTR [CLUSSEC] 0 00005C18 BE0100 MOV SI,1 0 00005C1B 30C0 XOR AL,AL 0 00005C1D E8[0000] invoke GETBUFFRB 0 00005C20 58 POP AX 0 00005C21 721C JC POPP_RET 0 00005C23 C53E[0000] LDS DI,[CURBUF] 235 ASSUME DS:NOTHING 0 00005C27 F6450540 TEST byte [DI + buf_flags],buf_dirty ;LB. if already dirty ;AN000; 0 00005C2B 7507 JNZ yesdirty2 ;LB. don't increment dirty count ;AN000; 0 00005C2D E8[0000] invoke INC_DIRTY_COUNT ;LB. ;AN000; 0 00005C30 804D0540 OR byte [DI + buf_flags],buf_dirty 240 yesdirty2: 0 00005C34 83C710 ADD DI,BUFINSIZ 0 00005C37 4F DEC DI 0 00005C38 26037E02 ADD DI,[ES:BP + dpb_sector_size] 0 00005C3C 8805 MOV [DI],AL 0 00005C3E F8 CLC 246 POPP_RET: 0 00005C3F 16 PUSH SS 0 00005C40 1F POP DS 249 assume ds:DOSGROUP 0 00005C41 59 POP CX 0 00005C42 5B POP BX 0 00005C43 58 POP AX 0 00005C44 C3 return 254 255 EndProc PACK 256 257 Break 258 259 ; Inputs: 260 ; ES:BP Points to DPB 261 ; BX Is cluster number 262 ; Function: 263 ; Get a pointer to the cluster 264 ; Outputs: 265 ; DS:DI Points to contents of FAT for given cluster 266 ; DS:SI Points to start of buffer 267 ; Zero Not set if cluster data is in high 12 bits of word 268 ; Zero set if cluster data is in low 12 or 16 bits 269 ; Carry set if failed. 270 ; SI is destroyed. 271 272 procedure MAPCLUSTER,NEAR 272 ****************** warning: proc MAPCLUSTER... [-w+user] 273 DOSAssume CS,,"MapCluster" 274 ASSUME ES:NOTHING 275 276 Assert ISDPB,,"MapCluster" 0 00005C45 C606[0000]00 MOV BYTE PTR [CLUSSPLIT],0 0 00005C4A 50535152 SaveReg 0 00005C4E 89D8 MOV AX,BX ; AX = BX 0 00005C50 B9F60F MOV CX,4096-10 0 00005C53 26394E0D CMP [ES:BP + dpb_max_cluster],CX ; MZ 16 bit fat? 0 00005C57 7302 JAE Map16 ; MZ yes, do 16 bit algorithm 0 00005C59 D1E8 SHR AX,1 ; AX = BX/2 284 Map16: ; MZ skip prev => AX=2*BX 0 00005C5B 31FF XOR DI,DI ; >32mb fat ;AN000; 0 00005C5D 01D8 ADD AX,BX ; AX = 1.5*fat = byte offset in fat 0 00005C5F 83D700 ADC DI,0 ; >32mb fat ;AN000; 288 DoConvert: 0 00005C62 268B4E02 MOV CX,[ES:BP + dpb_sector_size] 290 %IF FastDiv 291 ; 292 ; Gross hack: 99% of all disks have 512 bytes per sector. We test for this 293 ; case and apply a really fast algorithm to get the desired results 294 ; 295 ; Divide method takes 158 (XOR and DIV) 296 ; Fast method takes 20 297 ; 298 ; This saves a bunch. 299 ; 0 00005C66 81F90002 CMP CX,512 ; 4 Is this 512 byte sector? 0 00005C6A 7403 JZ Nodiv ;F.C. >32mb ;AN000; 0 00005C6C E98B00 JMP DoDiv ; 4/16 No, go do divide 303 Nodiv: ;F.C. >32mb ;AN000; 0 00005C6F 89C2 MOV DX,AX ; 2 get set for remainder 0 00005C71 81E2FF01 AND DX,512-1 ; 4 Form remainder 0 00005C75 88E0 MOV AL,AH ; 2 0 00005C77 D0E8 SHR AL,1 ; 2 0 00005C79 98 CBW ; 2 Fast divide by 512 0 00005C7A 09FF OR DI,DI ;>32mb >64k ? ;AN000; 0 00005C7C 7403 JZ g64k ;>32mb no ;AN000; 0 00005C7E 0D8000 OR AX,80H ;>32mb ;AN000; 312 g64k: 313 %ELSE 314 XOR DX,DX ; 3 315 DIV CX ; 155 AX is FAT sector # DX is sector index 316 %ENDIF 317 DivDone: 0 00005C81 26034606 ADD AX,[ES:BP + dpb_first_FAT] 0 00005C85 49 DEC CX ; CX is sector size - 1 0 00005C86 505251 SaveReg 0 00005C89 89C2 MOV DX,AX 0 00005C8B C706[0000]0000 MOV word [HIGH_SECTOR],0 ;F.C. >32mb low sector # 0 00005C91 30C0 XOR AL,AL 0 00005C93 BE0100 MOV SI,1 0 00005C96 E8[0000] invoke GETBUFFRB 0 00005C99 59585A RestoreReg ; CX is sec siz-1, AX is offset in sec 0 00005C9C 7257 JC MAP_POP 0 00005C9E C536[0000] LDS SI,[CURBUF] 329 ASSUME DS:NOTHING 330 BufInSiz equ BUFINSIZ ; NASM port equate 0 00005CA2 8D7C10 LEA DI,[SI + BufInSiz] 0 00005CA5 01C7 ADD DI,AX 0 00005CA7 39C8 CMP AX,CX 0 00005CA9 7537 JNZ MAPRET 0 00005CAB 8A05 MOV AL,[DI] 0 00005CAD 161F Context DS 0 00005CAF FE06[0000] INC BYTE PTR [CLUSSPLIT] 0 00005CB3 A2[0000] MOV BYTE PTR [CLUSSAVE],AL 0 00005CB6 8916[0000] MOV WORD PTR [CLUSSEC],DX 0 00005CBA C706[0200]0000 MOV WORD PTR [CLUSSEC+2],0 ;F.C. >32mb ;AN000; 0 00005CC0 42 INC DX 0 00005CC1 C706[0000]0000 MOV word [HIGH_SECTOR],0 ;F.C. >32mb FAT sector <32mb ;AN000; 0 00005CC7 30C0 XOR AL,AL 0 00005CC9 BE0100 MOV SI,1 0 00005CCC E8[0000] invoke GETBUFFRB 0 00005CCF 7224 JC MAP_POP 0 00005CD1 C536[0000] LDS SI,[CURBUF] 348 ASSUME DS:NOTHING 0 00005CD5 8D7C10 LEA DI,[SI + BufInSiz] 0 00005CD8 8A05 MOV AL,[DI] 0 00005CDA 161F Context DS 0 00005CDC A2[0100] MOV BYTE PTR [CLUSSAVE+1],AL 0 00005CDF BF[0000] MOV DI,OFFSET CLUSSAVE wrt DOSGROUP 354 MAPRET: 0 00005CE2 5A595B RestoreReg 0 00005CE5 31C0 XOR AX,AX ; MZ allow shift to clear carry 0 00005CE7 26817E0DF60F CMP word [ES:BP + dpb_max_cluster],4096-10 ; MZ is this 16-bit fat? 0 00005CED 7302 JAE MapSet ; MZ no, set flags 0 00005CEF 89D8 MOV AX,BX 360 MapSet: 0 00005CF1 A801 TEST AL,1 ; set zero flag if not on boundary 0 00005CF3 58 RestoreReg 0 00005CF4 C3 return 364 365 MAP_POP: 0 00005CF5 5A595B58 RestoreReg 0 00005CF9 C3 return 368 %IF FastDiv 369 DoDiv: 0 00005CFA 31D2 XOR DX,DX ; 3 0 00005CFC F7F1 DIV CX ; 155 AX is FAT sector # DX is sector index 0 00005CFE EB81 JMP DivDone ;15 total=35 373 %ENDIF 374 375 EndProc MAPCLUSTER 375 ****************** warning: ***** Possible stack size error in MAPCLUSTER ***** [-w+user] 376 377 Break 378 379 ; Inputs: 380 ; ES:DI points to an SFT for the drive of intrest (local only, 381 ; giving a NET SFT will produce system crashing results). 382 ; DS DOSGROUP 383 ; Function: 384 ; Can be used by an SFT routine (like CLOSE) to invalidate buffers 385 ; if disk changed. 386 ; In other respects, same as FATREAD_CDS. 387 ; (note ES:DI destroyed!) 388 ; Outputs: 389 ; Carry set if error (currently user FAILed to I 24) 390 ; NOTE: This routine may cause FATREAD_CDS to "miss" a disk change 391 ; as far as invalidating curdir_ID is concerned. 392 ; Since getting a true disk changed on this call is a screw up 393 ; anyway, that's the way it goes. 394 395 procedure FATREAD_SFT,NEAR 395 ****************** warning: proc FATREAD_SFT... [-w+user] 396 DOSAssume CS,,"FATRead_SFT" 397 ASSUME ES:NOTHING 398 0 00005D00 26C46D07 LES BP,[ES:DI + sf_devptr] 400 Assert ISDPB,,"FatReadSFT" 0 00005D04 268A4600 MOV AL,[ES:BP + dpb_drive] 0 00005D08 A2[0000] MOV [THISDRV],AL 0 00005D0B E8[0000] invoke GOTDPB ;Set THISDPB 0 00005D0E E87900 CALL FAT_GOT_DPB 0 00005D11 C3 return 406 EndProc FATREAD_SFT 407 408 ; Inputs: 409 ; DS:DOSGROUP 410 ; ES:DI points to an CDS for the drive of intrest (local only, 411 ; giving a NET or NUL CDS will produce system crashing results). 412 ; Function: 413 ; If disk may have been changed, media is determined and buffers are 414 ; flagged invalid. If not, no action is taken. 415 ; Outputs: 416 ; ES:BP = Drive parameter block 417 ; [THISDPB] = ES:BP 418 ; [THISDRV] set 419 ; Carry set if error (currently user FAILed to I 24) 420 ; DS preserved , all other registers destroyed 421 422 procedure FATREAD_CDS,NEAR 422 ****************** warning: proc FATREAD_CDS... [-w+user] 423 DOSAssume CS,,"FATRead_CDS" 424 ASSUME ES:NOTHING 425 0 00005D12 06 PUSH ES 0 00005D13 57 PUSH DI 0 00005D14 26C46D45 LES BP,[ES:DI + curdir_devptr] 429 assume es:DPB 430 Assert ISDPB,,"FatReadCDS" 0 00005D18 268A4600 MOV AL,[ES:BP + dpb_drive] 0 00005D1C A2[0000] MOV [THISDRV],AL 0 00005D1F E8[0000] invoke GOTDPB ;Set THISDPB 0 00005D22 E86500 CALL FAT_GOT_DPB 0 00005D25 5F POP DI ;Get back CDS pointer 0 00005D26 07 POP ES 437 assume es:nothing 0 00005D27 72E8 retc 0 00005D29 7538 JNZ NO_CHANGE ;Media NOT changed 440 ; Media changed. We now need to find all CDS structures which use this 441 ; DPB and invalidate their ID pointers. 442 MED_CHANGE: 0 00005D2B 31C0 XOR AX,AX 0 00005D2D 48 DEC AX ;AX = -1 0 00005D2E 1E PUSH DS 0 00005D2F 8A0E[0000] MOV CL,[CDSCOUNT] 0 00005D33 30ED XOR CH,CH ; CX is number of structures 0 00005D35 26C57545 LDS SI,[ES:DI + curdir_devptr] ; Find all CDS with this devptr 449 assume ds:DPB 0 00005D39 36C43E[0000] LES DI,[ss:CDSADDR] ; Start here 451 assume es:nothing 452 CHECK_CDS: 0 00005D3E 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 00005D44 7517 JNZ NEXTCDS ; Leave NET guys alone!! 0 00005D46 06 PUSH ES 0 00005D47 57 PUSH DI 0 00005D48 26C47D45 LES DI,[ES:DI + curdir_devptr] 458 assume es:DPB 0 00005D4C E8[0000] invoke POINTCOMP 0 00005D4F 5F POP DI 0 00005D50 07 POP ES 462 assume es:nothing 0 00005D51 750A JNZ NEXTCDS ; CDS not for this drive 0 00005D53 26854549 TEST [ES:DI + curdir_ID],AX 0 00005D57 7404 JZ NEXTCDS ; If root, leave root 0 00005D59 26894549 MOV [ES:DI + curdir_ID],AX ; else invalid 467 NEXTCDS: 0 00005D5D 83C758 ADD DI,curdir_list_struc_size ; Point to next CDS 0 00005D60 E2DC LOOP CHECK_CDS 0 00005D62 1F POP DS 471 DOSAssume CS,,"FAT/NextCDS" 472 NO_CHANGE: 0 00005D63 C42E[0000] LES BP,[THISDPB] 474 assume es:DPB 0 00005D67 F8 CLC 0 00005D68 C3 return 477 EndProc FATREAD_CDS 478 479 Break 480 481 procedure FAT_operation,NEAR 481 ****************** warning: proc FAT_operation... [-w+user] 482 FATERR: 483 DOSAssume CS,,"FATERR" 0 00005D69 26C7461FFFFF MOV word [ES:BP + dpb_free_cnt],-1 ; Err in FAT must force recomp of freespace 0 00005D6F 81E7FF00 AND DI,STECODE ; Put error code in DI 486 allowed_FAIL equ Allowed_FAIL ; NASM port equate 487 allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 00005D73 C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00005D78 B41A MOV AH,2 + allowed_FAIL + allowed_RETRY ; While trying to read FAT 0 00005D7A A0[0000] MOV AL,BYTE PTR [THISDRV] ; Tell which drive 0 00005D7D E8[0000] invoke FATAL1 0 00005D80 C42E[0000] LES BP,[THISDPB] 493 assume es:DPB 0 00005D84 3C03 CMP AL,3 0 00005D86 7502 JNZ FAT_GOT_DPB ; User said retry 0 00005D88 F9 STC ; User said FAIL 0 00005D89 C3 return 498 499 FAT_GOT_DPB: 0 00005D8A 161F Context DS 0 00005D8C B00F MOV AL,DMEDHL 0 00005D8E 268A6601 MOV AH,[ES:BP + dpb_UNIT] 0 00005D92 A3[0000] MOV WORD PTR [DEVCALL],AX 0 00005D95 C606[0200]01 MOV BYTE PTR [DEVCALL + REQFUNC],DEVMDCH 0 00005D9A C706[0300]0000 MOV word [DEVCALL + REQSTAT],0 0 00005DA0 268A4617 MOV AL,[ES:BP + dpb_media] 0 00005DA4 A2[0000] MOV BYTE PTR [CALLMED],AL 0 00005DA7 06 PUSH ES 0 00005DA8 1E PUSH DS 0 00005DA9 BB[0000] MOV BX,OFFSET DEVCALL wrt DOSGROUP 0 00005DAC 26C57613 LDS SI,[ES:BP + dpb_driver_addr] ; DS:SI Points to device header 512 ASSUME DS:NOTHING 0 00005DB0 07 POP ES ; ES:BX Points to call header 514 assume es:nothing 0 00005DB1 E8[0000] invoke DEVIOCALL2 0 00005DB4 161F Context DS 0 00005DB6 07 POP ES ; Restore ES:BP 518 assume es:DPB 0 00005DB7 8B3E[0300] MOV DI,[DEVCALL + REQSTAT] 0 00005DBB F7C70080 TEST DI,STERR 0 00005DBF 75A8 JNZ FATERR 0 00005DC1 30E4 XOR AH,AH 0 00005DC3 26866618 XCHG AH,[ES:BP + dpb_first_access] ; Reset dpb_first_access 0 00005DC7 A0[0000] MOV AL,BYTE PTR [THISDRV] ; Use physical unit number 525 ; See if we had changed volume id by creating one on the diskette 0 00005DCA 3806[0000] cmp [VOLCHNG_FLAG],AL 0 00005DCE 7508 jnz CHECK_BYT 0 00005DD0 C606[0000]FF mov byte [VOLCHNG_FLAG],-1 0 00005DD5 E99700 jmp GOGETBPB ; Need to get device driver to read in 530 ; new volume label. 531 CHECK_BYT: 0 00005DD8 0A26[0000] OR AH,BYTE PTR [CALLRBYT] 0 00005DDC 7903 JNS CHECK_ZR ; ns = 0 or 1 0 00005DDE EB66 JMP NEWDSK 0 00005DE0 90 nop ; identicalise 536 537 CHECK_ZR: 0 00005DE1 743D JZ CHKBUFFDIRT ; jump if I don't know 0 00005DE3 F8 CLC 0 00005DE4 C3 return ; If Media not changed (NZ) 541 542 DISK_CHNG_ERR: 543 ASSUME DS:NOTHING 544 assume es:DPB 0 00005DE5 06 PUSH ES 0 00005DE6 55 PUSH BP 0 00005DE7 26C46E13 LES BP,[ES:BP + dpb_driver_addr] ; Get device pointer 548 assume es:nothing 0 00005DEB 26F746040008 TEST word [ES:BP + SDEVATT],DEVOPCL ; Did it set vol id? 0 00005DF1 5D POP BP 0 00005DF2 07 POP ES 552 assume es:DPB 0 00005DF3 7426 JZ FAIL_OPJ2 ; Nope, FAIL 0 00005DF5 1E PUSH DS ; Save buffer pointer for ignore 0 00005DF6 57 PUSH DI 0 00005DF7 161F Context DS 0 00005DF9 C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00005DFE 06 PUSH ES 0 00005DFF C43E[0000] LES DI,[CALLVIDM] ; Get volume ID pointer 560 assume es:nothing 0 00005E03 8C06[0200] MOV WORD PTR [EXTERRPT+2],ES 0 00005E07 07 POP ES 563 assume es:DPB 0 00005E08 893E[0000] MOV WORD PTR [EXTERRPT],DI 0 00005E0C B80F00 MOV AX,error_I24_wrong_disk 566 READOP equ ReadOp ; NASM port label 0 00005E0F C606[0000]01 MOV byte [READOP],1 ; Write 0 00005E14 E8[0000] invoke HARDERR_DOS 0 00005E17 5F POP DI ; Get back buffer for ignore 0 00005E18 1F POP DS 571 ASSUME DS:NOTHING 0 00005E19 3C03 CMP AL,3 573 FAIL_OPJ2: 0 00005E1B 741E JZ FAIL_OP 0 00005E1D E96AFF JMP FAT_GOT_DPB ; Retry 576 577 CHKBUFFDIRT: 578 DOSAssume CS,,"FAT/ChkBuffDirt" 579 %ifdef BUF2 0 00005E20 C53E[0000] LDS DI,[BUFFHEAD] 581 ASSUME DS:NOTHING 0 00005E24 36833E[0000]00 CMP word [ss:BUF2_Dirty_Count], 0 ;LB. if not dirty ;AN000; 0 00005E2A 741A je NEWDSK 584 %else 585 XOR DX,DX ;LB. ;AN000; 586 LDS DI,[ss:BUF_HASH_PTR] ;LB. scan from 1st entry ;AN000; 587 MOV CX,[ss:BUF_HASH_COUNT] ;LB. get Hash entry count ;AN000; 588 589 scan_dirty: 590 Dirty_Count equ DIRTY_COUNT ; NASM port equate 591 CMP byte [DI + Dirty_Count],0 ;LB. if not dirty ;AN000; 592 JZ GETNEXT ;LB. get next hash entry ;AN000; 593 PUSH DS ;LB. save hash entry addr ;AN000; 594 PUSH DI ;LB. ;AN000; 595 invoke Map_Entry ;LB. ;AN000; 596 %endif 597 NBUFFER: ; Look for dirty buffers 0 00005E2C 3A4504 CMP AL,[DI + buf_ID] 0 00005E2F 750E JNZ LFNXT ; Not for this unit 0 00005E31 F6450540 TEST byte [DI + buf_flags],buf_dirty 0 00005E35 7408 JZ LFNXT 602 %ifndef BUF2 603 POP DI ;LB. restore regs ;AN000; 604 POP DS ;LB. ;AN000; 605 %endif 0 00005E37 161F Context DS 0 00005E39 F8 CLC 0 00005E3A C3 return ; There is a dirty buffer, assume Media OK (NZ) 609 610 FAIL_OP: 0 00005E3B 161F Context DS 0 00005E3D F9 STC 0 00005E3E C3 return 614 615 ASSUME DS:NOTHING 616 LFNXT: 617 %ifdef BUF2 0 00005E3F C53D lds di, [di + NEXTBUF] 0 00005E41 83FFFF cmp di, -1 620 %else 621 mov DI,[DI + buf_next] ;; 1/19/88 622 CMP DI,[ss:FIRST_BUFF_ADDR] ;; 1/19/88 623 %endif 0 00005E44 75E6 JNZ NBUFFER 625 %ifndef BUF2 626 POP DI ;LB. restore regs ;AN000; 627 POP DS ;LB. ;AN000; 628 GETNEXT: 629 ADD DI,BUFFER_HASH_ENTRY_struc_size ;LB. next entry ;AN000; 630 LOOP scan_dirty ;LB. scan next entry ;AN000; 631 %endif 632 ; If no dirty buffers, assume Media changed 633 NEWDSK: 0 00005E46 26C7461FFFFF MOV word [ES:BP + dpb_free_cnt],-1 ; Media changed, must re-compute 635 ; NOTE: It is TECHNICALLY more correct 636 ASSUME DS:NOTHING 637 %ifdef BUF2 0 00005E4C 36C53E[0000] lds di, [ss:BUFFHEAD] 639 %else 640 XOR DX,DX ;LB. ;AN000; 641 MOV [ss:HIGH_SECTOR],DX ;LB. scan from 1st entry ;AN000; 642 MOV CX,[ss:BUF_HASH_COUNT] ;LB. get Hash entry count ;AN000; 643 644 NxtHash: 645 invoke GETCURHEAD ;LB. get Hash entry buffer header ;AN000; 646 ; to do this AFTER the check for 647 %endif 648 ASSUME DS:NOTHING 649 NXBUFFER: 0 00005E51 3A4504 CMP AL,[DI + buf_ID] ; For this drive? 0 00005E54 7404 JZ OLDDRV2 ;LB. yes ;AN000; 652 %ifdef BUF2 0 00005E56 C53D lds di, [di + NEXTBUF] 654 %else 655 mov DI,[DI + buf_next] ;LB. get next buffer 1/19/88 ;AN000; 656 %endif 0 00005E58 EB10 JMP SHORT SKPBUFF ;LB. ;AN000; 658 OLDDRV2: 0 00005E5A F6450540 TEST byte [DI + buf_flags],buf_dirty 660 OldDrv equ OLDDRV ; NASM port label 0 00005E5E 7402 JZ OldDrv 662 Disk_Chng_Err equ DISK_CHNG_ERR ; NASM port label 0 00005E60 EB83 JMP Disk_Chng_Err ; Disk changed but dirty buffers 664 OLDDRV: 665 %ifdef BUF2 0 00005E62 C74504FF00 MOV WORD PTR [DI + BUFDRV], 00FFH 667 %else 668 MOV WORD PTR [DI + buf_ID], 00FFH ; Free up buffer 669 %endif 0 00005E67 E8[0000] invoke SCANPLACE 671 SKPBUFF: 672 %ifdef BUF2 0 00005E6A 83FFFF cmp di, -1 674 %else 675 CMP DI,[ss:FIRST_BUFF_ADDR] ;LB. end of chain 1/19/88 ;AN000; 676 %endif 0 00005E6D 75E2 JNZ NXBUFFER ;LB. no ;AN000; 678 %ifndef BUF2 679 INC DX ;LB. ;AN000; 680 LOOP NxtHash ;LB. ;AN000; 681 CMP word [ss:SC_CACHE_COUNT],0 ;LB. look ahead buffers ? ;AN001; 682 JZ GOGETBPB ;LB. no ;AN001; 683 CMP AL,[ss:CURSC_DRIVE] ;LB. same as changed drive ;AN001; 684 JNZ GOGETBPB ;LB. no ;AN001; 685 MOV byte [ss:CURSC_DRIVE],-1 ;LB. invalidate look ahead buffers ;AN000; 686 %endif 687 GOGETBPB: 0 00005E6F 26C57E13 LDS DI,[ES:BP + dpb_driver_addr] 689 assume ds:nothing 0 00005E73 F745040020 TEST word [DI + SDEVATT],ISFATBYDEV 0 00005E78 7510 JNZ GETFREEBUF 0 00005E7A 161F context DS 0 00005E7C BB0200 MOV BX,2 0 00005E7F E8E7FC CALL UNPACK ; Read the first FAT sector into CURBUF 695 FAIL_OPJ: 0 00005E82 72B7 JC FAIL_OP 0 00005E84 C53E[0000] LDS DI,[CURBUF] 698 ASSUME DS:NOTHING 0 00005E88 EB15 JMP SHORT GOTGETBUF 700 701 GETFREEBUF: 702 ASSUME DS:NOTHING 0 00005E8A 06 PUSH ES ; Get a free buffer for BIOS to use 0 00005E8B 55 PUSH BP 0 00005E8C 31D2 XOR DX,DX ;LB. fake to get 1st ;AN000; 0 00005E8E 368916[0000] MOV [ss:HIGH_SECTOR],DX ;LB. buffer addr ;AN000; 707 %ifdef BUF2 0 00005E93 36C53E[0000] lds di, [ss:BUFFHEAD] 709 %else 710 invoke GETCURHEAD ;LB. ;AN000; 711 %endif 712 0 00005E98 E8[0000] invoke BUFWRITE 0 00005E9B 5D POP BP 0 00005E9C 07 POP ES 716 assume es:DPB 0 00005E9D 72E3 JC FAIL_OPJ 718 GOTGETBUF: 0 00005E9F 83C710 ADD DI,BUFINSIZ 0 00005EA2 368C1E[0200] MOV WORD PTR [ss:CALLXAD+2],DS 0 00005EA7 161F Context DS 0 00005EA9 893E[0000] MOV WORD PTR [CALLXAD],DI 0 00005EAD B016 MOV AL,DBPBHL 0 00005EAF 268A6601 MOV AH,BYTE PTR [ES:BP + dpb_UNIT] 0 00005EB3 A3[0000] MOV WORD PTR [DEVCALL],AX 0 00005EB6 C606[0200]02 MOV BYTE PTR [DEVCALL + REQFUNC],DEVBPB 0 00005EBB C706[0300]0000 MOV word [DEVCALL + REQSTAT],0 0 00005EC1 268A4617 MOV AL,BYTE PTR [ES:BP + dpb_media] 0 00005EC5 A2[0000] MOV [CALLMED],AL 0 00005EC8 06 PUSH ES 0 00005EC9 1E PUSH DS 0 00005ECA 26FF7615 PUSH WORD PTR [ES:BP + dpb_driver_addr+2] 0 00005ECE 26FF7613 PUSH WORD PTR [ES:BP + dpb_driver_addr] 0 00005ED2 BB[0000] MOV BX,OFFSET DEVCALL wrt DOSGROUP 0 00005ED5 5E POP SI 0 00005ED6 1F POP DS ; DS:SI Points to device header 737 ASSUME DS:NOTHING 0 00005ED7 07 POP ES ; ES:BX Points to call header 739 assume es:nothing 0 00005ED8 E8[0000] invoke DEVIOCALL2 0 00005EDB 07 POP ES ; Restore ES:BP 742 assume es:DPB 0 00005EDC 161F Context DS 0 00005EDE 8B3E[0300] MOV DI,[DEVCALL + REQSTAT] 0 00005EE2 F7C70080 TEST DI,STERR 0 00005EE6 751F JNZ FATERRJ 0 00005EE8 268A4617 MOV AL,BYTE PTR [ES:BP + dpb_media] 0 00005EEC C536[0000] LDS SI,[CALLBPB] 749 ASSUME DS:NOTHING 750 DPB_next_free equ dpb_next_free ; NASM port equate 0 00005EF0 26C7461D0000 MOV word [ES:BP + DPB_next_free],0 ; recycle scanning pointer 0 00005EF6 E8[0000] invoke D_SETDPB 0 00005EF9 36C53E[0000] LDS DI,[ss:CALLXAD] ; Get back buffer pointer 754 %ifdef BUF2 0 00005EFE 804DF502 or byte [di - BUFINSIZ + buf_flags], buf_isFAT 756 %else 757 MOV AL,BYTE PTR [ES:BP + dpb_FAT_count] 758 MOV [DI + buf_wrtcnt-BUFINSIZ],AL ;>32mb ;AN000; 759 MOV AX,[ES:BP + dpb_FAT_size] ;>32mb ;AC000; 760 MOV [DI + buf_wrtcntinc-BUFINSIZ],AX ;>32mb Correct buffer info ;AC000; 761 %endif 762 0 00005F02 161F Context DS 0 00005F04 30C0 XOR AL,AL ;Media changed (Z), Carry clear 0 00005F06 C3 return 766 0 00005F07 E95FFE FATERRJ: JMP FATERR 768 769 EndProc FAT_operation 770 771 END === Trace listing source: ../DOS/buf.lst 1 ; SCCSID = @(#)buf.asm 1.1 85/04/09 2 ;TITLE BUF - MSDOS buffer management 3 ;NAME BUF 4 ; Low level routines for buffer cache management 5 ; 6 ; GETCURHEAD 7 ; SET_MAP_PAGE 8 ; SAVE_MAP 9 ; RESTORE_MAP 10 ; SETVISIT 11 ; ScanPlace 12 ; PLACEBUF 13 ; PLACEHEAD 14 ; PointComp 15 ; GETBUFFR 16 ; GETBUFFRB 17 ; FlushBuf 18 ; BufWrite 19 ; SKIPVISIT 20 ; SET_RQ_SC_PARMS 21 ; 22 ; Revision history: 23 ; 24 ; AN000 version 4.00 Jan. 1988 25 ; A004 PTM 3765 -- Disk reset failed 26 27 ; NEW PROCS FOR BUFFERS FIX: 28 29 ; SAVE_USER_MAP 30 ; RESTORE_USER_MAP 31 ; DETECT_COLLISION 32 ; SETUP_EMS_BUFFERS 33 ; 34 35 36 ; 37 ; get the appropriate segment definitions 38 ; 39 [list -] 39 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 41 42 [list +] === Switch to base=002450h -> "DOSCODECODE" 43 section DOSCODECODE 44 [list -] 44 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 44 ****************** warning: out: BPB.INC... [-w+user] 44 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 44 ****************** warning: out: DEVSYM.INC... [-w+user] 44 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 52 53 %ifdef BUF2 54 %define FROMBUFNAS 55 %include "buf2.nas" 1 <1> %ifdef FROMBUFNAS 2 <1> [list -] 6 <1> %else 7 <1> ; 8 <1> ; buffer management for MSDOS 9 <1> ; 10 <1> 11 <1> %include "dosseg.nas" 12 <1> === Switch to base=002450h -> "DOSCODECODE" 13 <1> section DOSCODECODE 14 <1> 15 <1> [list -] 16 <1> ;.xcref 17 <1> %define BUF2 1 18 <1> %include "dossym.mac" 19 <1> %include "devsym.mac" 20 <1> %include "dosmac.mac" 21 <1> ;.cref 22 <1> [list +] 23 <1> %endif 24 <1> 25 <1> i_need BuffHead,DWORD 26 <1> i_need BuffFree,DWORD 27 <1> i_need PreRead,WORD 28 <1> i_need LastBuffer,DWORD 29 <1> i_need CurBuf,DWORD 30 <1> i_need WPErr,BYTE 31 <1> i_need ALLOWED,BYTE 32 <1> i_need FAILERR,BYTE 33 <1> i_need HIGH_SECTOR,WORD ; DOS 4.00 >32mb ;AN000; 34 <1> i_need DOS34_FLAG,WORD ; DOS 4.00 common flag ;AN000; 35 <1> i_need BUF2_Dirty_Count,WORD 36 <1> 37 <1> 38 <1> BUFFHEAD equ BuffHead ; NASM port label 39 <1> 40 <1> ;SUBTTL SCANPLACE, PLACEBUF -- PUT A BUFFER BACK IN THE POOL 41 <1> ;PAGE 42 <1> procedure ScanPlace,near 42 ****************** <1> warning: proc ScanPlace... [-w+user] 43 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 44 <1> 45 <1> ; Inputs: 46 <1> ; Same as PLACEBUF 47 <1> ; Function: 48 <1> ; Save scan location and call PLACEBUF 49 <1> ; Outputs: 50 <1> ; DS:DI Points to saved scan location 51 <1> ; SI destroyed, other registers unchanged 52 <1> 0 00005F0A 06 PUSH ES 0 00005F0B C435 LES SI,[DI + NEXTBUF] ; Save scan location 55 <1> assume es:nothing 0 00005F0D E80800 CALL PLACEBUF 0 00005F10 06 PUSH ES 0 00005F11 1F POP DS ; Restore scan location 59 <1> assume ds:nothing 0 00005F12 89F7 MOV DI,SI 0 00005F14 07 POP ES 62 <1> assume es:nothing 0 00005F15 C3 return 64 <1> ScanPlace ENDP 65 <1> 0 00005F16 EB57 NRETJ: JMP SHORT NRET 67 <1> 68 <1> procedure PLACEBUF,NEAR 68 ****************** <1> warning: proc PLACEBUF... [-w+user] 69 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 70 <1> 71 <1> ; Input: 72 <1> ; DS:DI points to buffer 73 <1> ; Function: 74 <1> ; Remove buffer from queue and re-insert it in proper place. 75 <1> ; If buffer doesn't go at end, and isn't free, decrement 76 <1> ; priorities. 77 <1> ; NO registers altered 78 <1> ; 79 <1> ; DS:SI -- Curbuf, current buffer in list 80 <1> ; ES:DI -- Buf, buffer passed as argument 81 <1> ; BP:CX -- Pointsave, saved Buf.nextbuf 82 <1> ; DX:BX -- Lastbuf, previous buffer in list 83 <1> ; AL -- Inserted, Buf has been inserted 84 <1> ; AH -- Removed, Buf has been removed 85 <1> 86 <1> %IF IBM 87 <1> %IFN IBM 88 <1> invoke save_world 89 <1> XOR AX,AX ; Inserted = Removed = FALSE 90 <1> LES CX,[DI + NEXTBUF] 91 <1> MOV BP,ES ; Pointsave = Buf.nextbuf 92 <1> MOV SI,DS 93 <1> MOV ES,SI ; Buf is ES:DI 94 <1> LDS SI,[ss:BUFFHEAD] ; Curbuf = HEAD 95 <1> CALL POINTCOMP ; Buf == HEAD? 96 <1> JNZ TNEWHEAD 97 <1> CMP CX,-1 ; Buf is LAST? 98 <1> JZ NRETJ ; Only one buffer, nothing to do 99 <1> MOV WORD PTR [ss:BUFFHEAD],CX 100 <1> MOV WORD PTR [ss:BUFFHEAD+2],BP ; HEAD = Pointsave 101 <1> INC AH ; Removed = TRUE 102 <1> MOV DS,BP 103 <1> MOV SI,CX ; Curbuf = HEAD 104 <1> TNEWHEAD: 105 <1> MOV BL,[ES:DI + BUFPRI] 106 <1> CMP BL,[SI + BUFPRI] 107 <1> JGE BUFLOOP 108 <1> NEWHEAD: ; If Buf.pri < HEAD.pri 109 <1> MOV WORD PTR [ES:DI + NEXTBUF],SI 110 <1> MOV WORD PTR [ES:DI + NEXTBUF+2],DS ; Buf.nextbuf = HEAD 111 <1> MOV WORD PTR [ss:BUFFHEAD],DI 112 <1> MOV WORD PTR [ss:BUFFHEAD+2],ES ; HEAD = Buf 113 <1> INC AL ; Inserted = TRUE 114 <1> OR AH,AH 115 <1> JNZ NRET ; If Removed == TRUE 116 <1> BUFLOOP: 117 <1> PUSH DS 118 <1> PUSH SI 119 <1> LDS SI,[SI + NEXTBUF] 120 <1> CALL POINTCOMP 121 <1> POP SI 122 <1> POP DS 123 <1> JNZ TESTINS 124 <1> MOV WORD PTR [SI + NEXTBUF],CX ; If Curbuf.nextbuf == buf 125 <1> MOV WORD PTR [SI + NEXTBUF+2],BP ; Curbuf.nextbuf = Pointsave 126 <1> INC AH ; Removed = TRUE 127 <1> OR AL,AL 128 <1> JNZ SHUFFLE ; If Inserted == TRUE 129 <1> TESTINS: 130 <1> OR AL,AL 131 <1> JNZ LOOKBUF 132 <1> PUSH CX ; If NOT Inserted 133 <1> MOV CL,[ES:DI + BUFPRI] 134 <1> CMP CL,[SI + BUFPRI] 135 <1> POP CX 136 <1> JGE LOOKBUF 137 <1> PUSH DS ; If Buf.pri < Curbuf.pri 138 <1> MOV DS,DX 139 <1> MOV WORD PTR [BX + NEXTBUF],DI 140 <1> MOV WORD PTR [BX + NEXTBUF+2],ES ; Lastbuf.nextbuf = Buf 141 <1> POP DS 142 <1> MOV WORD PTR [ES:DI + NEXTBUF],SI 143 <1> MOV WORD PTR [ES:DI + NEXTBUF+2],DS ; Buf.nextbuf = Curbuf 144 <1> INC AL ; Inserted = TRUE 145 <1> OR AH,AH 146 <1> JNZ SHUFFLE ; If Removed == TRUE 147 <1> LOOKBUF: 148 <1> MOV BX,SI 149 <1> MOV DX,DS ; Lastbuf = Curbuf 150 <1> CMP WORD PTR [SI + NEXTBUF],-1 151 <1> JZ ISLAST 152 <1> LDS SI,[SI + NEXTBUF] ; Curbuf = Curbuf.nextbuf 153 <1> JMP SHORT BUFLOOP 154 <1> ISLAST: ; If Curbuf is LAST 155 <1> MOV WORD PTR [SI + NEXTBUF],DI 156 <1> MOV WORD PTR [SI + NEXTBUF+2],ES ; Curbuf.nextbuf = Buf 157 <1> MOV WORD PTR [ES:DI + NEXTBUF],-1 158 <1> MOV WORD PTR [ES:DI + NEXTBUF+2],-1 ; Buf is LAST 159 <1> NRET: 160 <1> invoke restore_world 161 <1> return 162 <1> 163 <1> SHUFFLE: 164 <1> LDS DI,[ss:BUFFHEAD] 165 <1> DECLOOP: 166 <1> CMP byte [DI + BUFPRI],FREEPRI 167 <1> JZ NODEC 168 <1> DEC byte [DI + BUFPRI] 169 <1> NODEC: 170 <1> LDS DI,[DI + NEXTBUF] 171 <1> assume ds:nothing 172 <1> CMP DI,-1 173 <1> JNZ DECLOOP 174 <1> JMP SHORT NRET 175 <1> %ENDIF 176 <1> %ENDIF 177 <1> 0 00005F18 E8[0000] invoke save_world 0 00005F1B C40D LES CX,[DI + NEXTBUF] 0 00005F1D 83F9FF CMP CX,-1 ; Buf is LAST? 0 00005F20 744D JZ NRET ; Buffer already last 0 00005F22 8CC5 MOV BP,ES ; Pointsave = Buf.nextbuf 0 00005F24 1E PUSH DS 0 00005F25 07 POP ES ; Buf is ES:DI 185 <1> assume es:nothing 0 00005F26 36C536[0000] LDS SI,[ss:BUFFHEAD] ; Curbuf = HEAD 187 <1> assume ds:nothing 188 <1> POINTCOMP equ PointComp ; NASM port label 0 00005F2B E87A00 CALL POINTCOMP ; Buf == HEAD? 0 00005F2E 750C JNZ BUFLOOP 0 00005F30 36890E[0000] MOV WORD PTR [ss:BUFFHEAD],CX 0 00005F35 36892E[0200] MOV WORD PTR [ss:BUFFHEAD+2],BP ; HEAD = Pointsave 0 00005F3A EB14 JMP SHORT LOOKEND 194 <1> 195 <1> BUFLOOP: 0 00005F3C 1E PUSH DS 0 00005F3D 56 PUSH SI 0 00005F3E C534 LDS SI,[SI + NEXTBUF] 199 <1> assume ds:nothing 0 00005F40 E86500 CALL POINTCOMP 0 00005F43 7404 JZ GOTTHEBUF 0 00005F45 58 POP AX 0 00005F46 58 POP AX 0 00005F47 EBF3 JMP SHORT BUFLOOP 205 <1> 206 <1> GOTTHEBUF: 0 00005F49 5E POP SI 0 00005F4A 1F POP DS 209 <1> assume ds:nothing 0 00005F4B 890C MOV WORD PTR [SI + NEXTBUF],CX ; If Curbuf.nextbuf == buf 0 00005F4D 896C02 MOV WORD PTR [SI + NEXTBUF+2],BP ; Curbuf.nextbuf = Pointsave 212 <1> LOOKEND: 0 00005F50 1E PUSH DS 0 00005F51 56 PUSH SI 0 00005F52 C534 LDS SI,[SI + NEXTBUF] 0 00005F54 83FEFF CMP SI,-1 0 00005F57 7404 JZ GOTHEEND 0 00005F59 58 POP AX 0 00005F5A 58 POP AX 0 00005F5B EBF3 JMP SHORT LOOKEND 221 <1> 222 <1> GOTHEEND: 0 00005F5D 5E POP SI 0 00005F5E 1F POP DS 225 <1> assume ds:nothing 0 00005F5F 893C MOV WORD PTR [SI + NEXTBUF],DI 0 00005F61 8C4402 MOV WORD PTR [SI + NEXTBUF+2],ES ; Curbuf.nextbuf = Buf 0 00005F64 26C705FFFF MOV WORD PTR [ES:DI + NEXTBUF],-1 0 00005F69 26C74502FFFF MOV WORD PTR [ES:DI + NEXTBUF+2],-1 ; Buf is LAST 230 <1> NRET: 0 00005F6F E8[0000] invoke restore_world 0 00005F72 C3 return 233 <1> 234 <1> PLACEBUF ENDP 235 <1> 236 <1> procedure PLACEHEAD,NEAR 236 ****************** <1> warning: proc PLACEHEAD... [-w+user] 237 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 238 <1> 239 <1> ; SAME AS PLACEBUF except places buffer at head 240 <1> 0 00005F73 E8[0000] invoke save_world 0 00005F76 1E PUSH DS 0 00005F77 07 POP ES 244 <1> assume es:nothing 0 00005F78 36C536[0000] LDS SI,[ss:BUFFHEAD] 246 <1> assume ds:nothing 0 00005F7D 36893E[0000] MOV WORD PTR [ss:BUFFHEAD],DI 0 00005F82 368C06[0200] MOV WORD PTR [ss:BUFFHEAD+2],ES 0 00005F87 268935 MOV WORD PTR [ES:DI + NEXTBUF],SI 0 00005F8A 268C5D02 MOV WORD PTR [ES:DI + NEXTBUF+2],DS 251 <1> LOOKEND2: 0 00005F8E 1E PUSH DS 0 00005F8F 56 PUSH SI 0 00005F90 C534 LDS SI,[SI + NEXTBUF] 255 <1> assume ds:nothing 0 00005F92 E81300 CALL POINTCOMP 0 00005F95 7404 JZ GOTHEEND2 0 00005F97 58 POP AX 0 00005F98 58 POP AX 0 00005F99 EBF3 JMP SHORT LOOKEND2 261 <1> 262 <1> GOTHEEND2: 0 00005F9B 5E POP SI 0 00005F9C 1F POP DS 265 <1> assume ds:nothing 0 00005F9D C704FFFF MOV WORD PTR [SI + NEXTBUF],-1 0 00005FA1 C74402FFFF MOV WORD PTR [SI + NEXTBUF+2],-1 ; Buf is LAST 0 00005FA6 EBC7 JMP SHORT NRET 269 <1> 270 <1> PLACEHEAD ENDP 271 <1> 272 <1> ;SUBTTL POINTCOMP -- 20 BIT POINTER COMPARE 273 <1> ;PAGE 274 <1> procedure PointComp,NEAR 274 ****************** <1> warning: proc PointComp... [-w+user] 275 <1> assume ds:nothing, es:nothing, ss:nothing 276 <1> 277 <1> ; Compare DS:SI to ES:DI (or DS:DI to ES:SI) for equality 278 <1> ; DO NOT USE FOR < or > 279 <1> ; No Registers altered 280 <1> 0 00005FA8 39FE CMP SI,DI 0 00005FAA 75C6 retnz 0 00005FAC 51 PUSH CX 0 00005FAD 52 PUSH DX 0 00005FAE 8CD9 MOV CX,DS 0 00005FB0 8CC2 MOV DX,ES 0 00005FB2 39D1 CMP CX,DX 0 00005FB4 5A POP DX 0 00005FB5 59 POP CX 0 00005FB6 C3 return 291 <1> PointComp ENDP 292 <1> 293 <1> ;SUBTTL GETBUFFR -- GET A SECTOR INTO A BUFFER 294 <1> ;PAGE 295 <1> procedure GETBUFFR,NEAR 295 ****************** <1> warning: proc GETBUFFR... [-w+user] 296 <1> assume ds:nothing, es:DPB, ss:DOSGROUP 297 <1> 298 <1> ; Input: 299 <1> ; AH = Priority buffer is to have 300 <1> ; AL = 0 means sector must be pre-read 301 <1> ; ELSE no pre-read 302 <1> ; DX = Desired physical sector number 303 <1> ; ES:BP = Pointer to drive parameters 304 <1> ; Function: 305 <1> ; Get the specified sector into one of the I/O buffers 306 <1> ; And shuffle the queue 307 <1> ; Output: 308 <1> ; [CURBUF] Points to the Buffer for the sector 309 <1> ; CY iff error (user selected FAIL on int 24h) 310 <1> ; DX,ES:BP unchanged, all other registers destroyed 311 <1> 0 00005FB7 31F6 XOR SI,SI 313 <1> entry GETBUFFRB 314 <1> assume ds:DOSGROUP 315 <1> PREREAD equ PreRead ; NASM port label 0 00005FB9 A3[0000] MOV [PREREAD],AX 0 00005FBC 268A4600 MOV AL,[ES:BP + dpb_drive] 0 00005FC0 830E[0000]FF or word [BuffFree], -1 319 <1> LASTBUFFER equ LastBuffer ; NASM port label 0 00005FC5 C53E[0000] LDS DI,[LASTBUFFER] 321 <1> ASSUME DS:NOTHING 0 00005FC9 368B0E[0000] MOV CX,[ss:HIGH_SECTOR] ; F.C. >32mb ;AN000; 0 00005FCE 83FFFF CMP DI,-1 ; Recency pointer valid? 0 00005FD1 7412 JZ SKBUF ; No 0 00005FD3 3B5508 CMP DX,WORD PTR [DI + BUFSECNO] 0 00005FD6 750D JNZ SKBUF ; Wrong sector 0 00005FD8 3B4D0A CMP CX,WORD PTR [DI + BUFSECNO+2] ; F.C. >32mb ;AN000; 0 00005FDB 7508 JNZ SKBUF ; F.C. >32mb ;AN000; 0 00005FDD 3A4504 CMP AL,[DI + BUFDRV] 0 00005FE0 7503E99200 jz JUSTBUF ; Just asked for same buffer 331 <1> ; Wrong Drive 332 <1> SKBUF: 0 00005FE5 36C53E[0000] LDS DI,[ss:BUFFHEAD] 334 <1> assume ds:nothing 335 <1> NXTBFF: 0 00005FEA 807D04FF cmp byte [di + BUFDRV], 0FFh 0 00005FEE 750A jne .notfree 0 00005FF0 36893E[0000] mov word [ss:BuffFree], di 0 00005FF5 368C1E[0200] mov word [ss:BuffFree + 2], ds 340 <1> .notfree: 0 00005FFA 3B5508 CMP DX,WORD PTR [DI + BUFSECNO] ; F.C. >32mb ;AN000; 0 00005FFD 750A jne BUMP 0 00005FFF 3B4D0A CMP CX,WORD PTR [DI + BUFSECNO+2] ; F.C. >32mb ;AN000; 0 00006002 7505 jne BUMP ; F.C. >32mb ;AN000; 0 00006004 3A4504 CMP AL,[DI + BUFDRV] 0 00006007 746B je SETINF 347 <1> BUMP: 0 00006009 C53D LDS DI,[DI + NEXTBUF] 349 <1> assume ds:nothing 0 0000600B 83FFFF CMP DI,-1 0 0000600E 75DA JNZ NXTBFF 0 00006010 36C53E[0000] lds di, [ss:BuffFree] 353 <1> assume ds:nothing 0 00006015 83FFFF cmp di, -1 0 00006018 7505 jne .gotfree 0 0000601A 36C53E[0000] LDS DI,[ss:BUFFHEAD] 357 <1> assume ds:nothing 358 <1> .gotfree: 0 0000601F 36FF36[0000] PUSH word [ss:HIGH_SECTOR] ;F.C. >32mb ;AN000; 0 00006024 56 PUSH SI 0 00006025 52 PUSH DX 0 00006026 55 PUSH BP 0 00006027 06 PUSH ES 364 <1> BUFWRITE equ BufWrite ; NASM port label 0 00006028 E8BF00 CALL BUFWRITE ; Write out the dirty buffer 0 0000602B 07 POP ES 367 <1> assume es:DPB 0 0000602C 5D POP BP 0 0000602D 5A POP DX 0 0000602E 5E POP SI 0 0000602F 368F06[0000] POP word [ss:HIGH_SECTOR] ;F.C. >32mb ;AN000; 372 <1> RDSEC: ; Read in the new sector 0 00006034 7255 JC GETBERR 0 00006036 36F606[0000]FF TEST BYTE PTR [ss:PREREAD],-1 0 0000603C 751E JNZ SETBUF 376 <1> BufInSiz equ BUFINSIZ ; NASM port equate 0 0000603E 8D5D10 LEA BX,[DI + BufInSiz] ; Point at buffer 0 00006041 B90100 MOV CX,1 0 00006044 56 PUSH SI 0 00006045 57 PUSH DI 0 00006046 52 PUSH DX 0 00006047 85F6 test SI,SI 0 00006049 7407 JZ NORMSEC 0 0000604B E8[0000] invoke FATSECRD 0 0000604E B402 MOV AH,buf_isFAT ; Set buf_flags 0 00006050 EB05 JMP SHORT GOTTHESEC ; Buffer is marked free if read barfs 387 <1> NORMSEC: 0 00006052 E8[0000] invoke DREAD ; Buffer is marked free if read barfs 0 00006055 B400 MOV AH,0 ; Set buf_flags to no type, DO NOT XOR! 390 <1> GOTTHESEC: ; Carry set by either FATSECRD or DREAD 0 00006057 5A POP DX 0 00006058 5F POP DI 0 00006059 5E POP SI 0 0000605A 722F jc GETBERR 395 <1> SETBUF: 0 0000605C 368B0E[0000] MOV CX,[ss:HIGH_SECTOR] ; F.C. >32mb ;AN000; 0 00006061 894D0A MOV WORD PTR [DI + BUFSECNO+2],CX ; F.C. >32mb ;AN000; 0 00006064 895508 MOV WORD PTR [DI + BUFSECNO],DX ; F.C. >32mb ;AN000; 0 00006067 896D0C MOV WORD PTR [DI + BUFDRVDP],BP 0 0000606A 8C450E MOV WORD PTR [DI + BUFDRVDP+2],ES 0 0000606D 268A4600 MOV AL,[ES:BP + dpb_drive] 0 00006071 894504 MOV WORD PTR [DI + BUFDRV],AX ; set buf_flags too 403 <1> SETINF: 0 00006074 E8A1FE CALL PLACEBUF 405 <1> JUSTBUF: 406 <1> CURBUF equ CurBuf ; NASM port label 0 00006077 368C1E[0200] MOV WORD PTR [ss:CURBUF+2],DS 0 0000607C 368C1E[0200] MOV WORD PTR [ss:LASTBUFFER+2],DS 0 00006081 16 PUSH SS 0 00006082 1F POP DS 411 <1> ASSUME DS:DOSGROUP 0 00006083 893E[0000] MOV WORD PTR [CURBUF],DI 0 00006087 893E[0000] MOV WORD PTR [LASTBUFFER],DI 414 <1> GETBERR: 0 0000608B 16 PUSH SS 0 0000608C 1F POP DS 417 <1> ASSUME DS:DOSGROUP 0 0000608D C3 return 419 <1> GETBUFFR ENDP 420 <1> 421 <1> 422 <1> ;SUBTTL FLUSHBUF -- WRITE OUT DIRTY BUFFERS 423 <1> ;PAGE 424 <1> procedure FlushBuf,NEAR 424 ****************** <1> warning: proc FlushBuf... [-w+user] 425 <1> assume ds:DOSGROUP, es:nothing, ss:DOSGROUP 426 <1> 427 <1> ; Input: 428 <1> ; DS = DOSGROUP 429 <1> ; AL = Physical unit number 430 <1> ; = -1 for all units 431 <1> ; Function: 432 <1> ; Write out all dirty buffers for unit, and flag them as clean 433 <1> ; DS Preserved, all others destroyed (ES too) 434 <1> 0 0000608E C53E[0000] LDS DI,[BUFFHEAD] 436 <1> ASSUME DS:NOTHING 0 00006092 B4FF MOV AH,-1 438 <1> NXTBUFF: 0 00006094 E82C00 CALL CHECKFLUSH ; Ignore Carry return from CHECKFLUSH. 440 <1> ; FAILERR is set if user FAILed. 0 00006097 50 PUSH AX 0 00006098 8A4504 MOV AL,[DI + BUFDRV] 443 <1> WPERR equ WPErr ; NASM port label 0 0000609B 363A06[0000] CMP AL,BYTE PTR [ss:WPERR] 445 <1> ZAP equ Zap ; NASM port label 0 000060A0 7409 JZ ZAP 0 000060A2 36F706[0000]0400 TEST word [ss:DOS34_FLAG],FROM_DISK_RESET ;MS. from disk reset ? 0 000060A9 7405 jz NOZAP 449 <1> Zap: 0 000060AB C74504FF00 MOV WORD PTR [DI + BUFDRV], 00FFh 451 <1> ; (clears buf_flags as well) 452 <1> ; Invalidate buffer, it is inconsistent 453 <1> NOZAP: 0 000060B0 58 POP AX 0 000060B1 C53D LDS DI,[DI + NEXTBUF] 0 000060B3 83FFFF CMP DI,-1 0 000060B6 75DC JNZ NXTBUFF 0 000060B8 16 PUSH SS 0 000060B9 1F POP DS 460 <1> assume ds:DOSGROUP 0 000060BA 803E[0000]00 CMP byte [FAILERR],0 0 000060BF 7401 je .good ; if no int 24h fail --> (NC) 0 000060C1 F9 STC ; Return error if user FAILed (CY) 464 <1> .good: 0 000060C2 C3 return 466 <1> FlushBuf ENDP 467 <1> 468 <1> 469 <1> procedure CHECKFLUSH,NEAR 469 ****************** <1> warning: proc CHECKFLUSH... [-w+user] 470 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 471 <1> ; Carry set if problem (currently user FAILed to I 24) 472 <1> 473 <1> Assert ISBUF,,"CheckFlush" 0 000060C3 386504 CMP [DI + BUFDRV],AH 0 000060C6 74FA retz ; Skip free buffers, carry clear 0 000060C8 38C4 CMP AH,AL 0 000060CA 7406 JZ DOBUFFER ; Do all dirty buffers 0 000060CC 3A4504 CMP AL,[DI + BUFDRV] 0 000060CF F8 CLC 0 000060D0 75F0 retnz ; Buffer not for this unit or SFT 481 <1> DOBUFFER: 0 000060D2 F6450540 TEST byte [DI + buf_flags],buf_dirty 0 000060D6 74EA retz ; Buffer not dirty, carry clear by TEST 0 000060D8 50 PUSH AX 0 000060D9 FF7504 PUSH WORD PTR [DI + BUFDRV] ; (reads buf_flags as well) 0 000060DC E80B00 CALL BUFWRITE 0 000060DF 58 POP AX 0 000060E0 7206 JC LEAVE_BUF ; Leave buffer marked free (lost). 0 000060E2 80E4BF and ah, ~ buf_dirty ; Buffer is clean 0 000060E5 894504 MOV WORD PTR [DI + BUFDRV],AX 491 <1> ; (sets buf_flags as well) 492 <1> LEAVE_BUF: 0 000060E8 58 POP AX ; Search info 0 000060E9 C3 return 495 <1> EndProc CHECKFLUSH 496 <1> 497 <1> 498 <1> ;SUBTTL BUFWRITE -- WRITE OUT A BUFFER IF DIRTY 499 <1> ;PAGE 500 <1> procedure BufWrite,NEAR 500 ****************** <1> warning: proc BufWrite... [-w+user] 501 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 502 <1> 503 <1> ; Input: 504 <1> ; DS:DI Points to the buffer 505 <1> ; Function: 506 <1> ; Write out all the buffer if dirty. 507 <1> ; Output: 508 <1> ; Buffer marked free 509 <1> ; Carry set if error (currently user FAILed to I 24) 510 <1> ; DS:DI Preserved, ALL others destroyed (ES too) 511 <1> 0 000060EA B8FF00 MOV AX,00FFH 0 000060ED 874504 XCHG AX,WORD PTR [DI + BUFDRV] ; Free, in case write barfs 514 <1> ; (sets buf_flags as well) 0 000060F0 3CFF CMP AL,0FFH 0 000060F2 74F5 retz ; Buffer is free. (NC) 0 000060F4 F6C440 test ah, buf_dirty 0 000060F7 74F0 retz ; Buffer is clean. (NC) 0 000060F9 E86400 invoke DEC_DIRTY_COUNT ; LB. decrement dirty count 0 000060FC 363A06[0000] CMP AL,BYTE PTR [ss:WPERR] 0 00006101 74E6 retz ; If in WP error zap buffer 0 00006103 C46D0C LES BP,[DI + BUFDRVDP] 0 00006106 8D5D10 LEA BX,[DI + BufInSiz] ; Point at buffer 0 00006109 8B5508 MOV DX,WORD PTR [DI + BUFSECNO] ;F.C. >32mb ;AN000; 0 0000610C 8B4D0A MOV CX,WORD PTR [DI + BUFSECNO+2] ;F.C. >32mb ;AN000; 0 0000610F 36890E[0000] MOV [ss:HIGH_SECTOR],CX ;F.C. >32mb ;AN000; 527 <1> 0 00006114 B90100 mov cx, 1 ; Default to not a FAT sector 0 00006117 F6450502 test byte [di + buf_flags], buf_isFAT 0 0000611B 7408 jz .notfat 0 0000611D 268B460F mov ax, [es:bp + dpb_FAT_size] 0 00006121 268A4E08 mov cl, [es:bp + dpb_FAT_count] 533 <1> .notfat: 534 <1> 535 <1> allowed_RETRY equ Allowed_RETRY ; NASM port equate 536 <1> allowed_FAIL equ Allowed_FAIL ; NASM port equate 0 00006125 36C606[0000]18 MOV byte [ss:ALLOWED],allowed_RETRY + allowed_FAIL 0 0000612B F6450508 TEST byte [DI + buf_flags],buf_isDATA 0 0000612F 7406 JZ NO_IGNORE 540 <1> allowed_IGNORE equ Allowed_IGNORE ; NASM port equate 0 00006131 36800E[0000]20 OR byte [ss:ALLOWED],allowed_IGNORE 542 <1> NO_IGNORE: 0 00006137 57 PUSH DI ; Save buffer pointer 0 00006138 31FF XOR DI,DI ; Indicate failure 545 <1> WRTAGAIN: 0 0000613A 575150 SaveReg 0 0000613D B90100 MOV CX,1 0 00006140 53521E SaveReg 549 <1> 0 00006143 E8[0000] invoke DWRITE ; Write out the dirty buffer 551 <1> 0 00006146 1F5A5B RestoreReg 0 00006149 58595F RestoreReg 0 0000614C 7201 JC NOSET 0 0000614E 47 INC DI ; If at least ONE write succeedes, the operation 556 <1> NOSET: ; succeedes. 0 0000614F 01C2 ADD DX,AX 0 00006151 E2E7 LOOP WRTAGAIN 0 00006153 85FF test DI,DI ; Clears carry 0 00006155 7501 JNZ BWROK ; At least one write worked --> (NC) 0 00006157 F9 STC ; DI never got INCed, all writes failed. 562 <1> BWROK: 0 00006158 5F POP DI 0 00006159 C3 return 565 <1> BufWrite ENDP 566 <1> 567 <1> Break 568 <1> 569 <1> ; Input: 570 <1> ; none 571 <1> ; Function: 572 <1> ; increment dirty buffers count 573 <1> ; Output: 574 <1> ; dirty buffers count in the current hash entry is incremented 575 <1> ; 576 <1> ; All registers preserved 577 <1> 578 <1> procedure INC_DIRTY_COUNT,NEAR 578 ****************** <1> warning: proc INC_DIRTY_COUNT... [-w+user] 579 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 0000615A 36FF06[0000] INC word [ss:BUF2_Dirty_Count] ;LB. add 1 ;AN000; 0 0000615F C3 return 582 <1> EndProc INC_DIRTY_COUNT ;LB. return ;AN000; 583 <1> 584 <1> Break 585 <1> 586 <1> ; Input: 587 <1> ; none 588 <1> ; Function: 589 <1> ; decrement dirty buffers count 590 <1> ; Output: 591 <1> ; dirty buffers count in the current hash entry is decremented 592 <1> ; 593 <1> ; All registers preserved 594 <1> 595 <1> procedure DEC_DIRTY_COUNT,NEAR 595 ****************** <1> warning: proc DEC_DIRTY_COUNT... [-w+user] 596 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006160 36833E[0000]00 CMP word [ss:BUF2_Dirty_Count],0 ;LB. in case if 0 ;AN000; 0 00006166 7405 je nodec ;LB. do nothing ;AN000; 0 00006168 36FF0E[0000] DEC word [ss:BUF2_Dirty_Count] ;LB. sub 1 ;AN000; 600 <1> nodec: 0 0000616D C3 return 602 <1> EndProc DEC_DIRTY_COUNT ;LB. return ;AN000; 603 <1> 604 <1> END 56 %else 57 58 %iassign Installed TRUE 59 60 i_need BuffHead,DWORD 61 i_need PreRead,WORD 62 i_need LastBuffer,DWORD 63 i_need CurBuf,DWORD 64 i_need WPErr,BYTE 65 i_need ALLOWED,BYTE 66 i_need FAILERR,BYTE 67 i_need HIGH_SECTOR,WORD ; DOS 4.00 >32mb ;AN000; 68 i_need CurHashEntry,DWORD ; DOS 4.00 current Hash entry ;AN000; 69 i_need BUF_HASH_PTR,DWORD ; DOS 4.00 Hash table pointer ;AN000; 70 i_need BUF_HASH_COUNT,WORD ; DOS 4.00 Hash table entries ;AN000; 71 i_need SC_CACHE_PTR,DWORD ; DOS 4.00 seconadary cache table ;AN000; 72 i_need SC_CACHE_COUNT,WORD ; DOS 4.00 secondary cache entries ;AN000; 73 i_need BUF_EMS_MODE,BYTE ; DOS 4.00 EMS mode ;AN000; 74 i_need BUF_EMS_HANDLE,WORD ; DOS 4.00 buffer EMS handle ;AN000; 75 i_need SC_SECTOR_SIZE,WORD ; DOS 4.00 sector size ;AN000; 76 i_need SC_DRIVE,BYTE ; DOS 4.00 drive ;AN000; 77 i_need ACT_PAGE,WORD ; DOS 4.00 active logical EMS page ;AN000; 78 i_need DOS34_FLAG,WORD ; DOS 4.00 common flag ;AN000; 79 i_need BUF_EMS_SEG_CNT,WORD ; DOS 4.00 EMS seg count ;AN000; 80 i_need BUF_EMS_MAP_BUFF,BYTE ; DOS 4.00 EMS map buffer ;AN000; 81 i_need FIRST_BUFF_ADDR,WORD ; DOS 4.00 beginning of the chain ;AN000; 82 i_need BUF_EMS_PAGE_FRAME,WORD ; DOS 4.00 EMS page frame ;AN000; 83 84 %IF BUFFERFLAG 85 i_need BUF_EMS_PFRAME,WORD 86 i_need BUF_EMS_LAST_PAGE,WORD 87 i_need BUF_EMS_FIRST_PAGE,WORD 88 i_need BUF_EMS_SAFE_FLAG,byte 89 i_need BUF_EMS_NPA640,WORD 90 i_need NEXTADD,WORD 91 i_need DMAADD,DWORD 92 i_need BYTCNT1,WORD 93 i_am BUF_EMS_MAP_BUF,12,<0,0,0,0,0,0,0,0,0,0,0,0> 94 i_am CURADD,WORD 95 i_am low_ems_buf,512 96 extrn SAVE_USER_MAP:near 97 extrn RESTORE_USER_MAP:near 98 %ENDIF 99 100 101 Break 102 103 ; Inputs: 104 ; DX= sector number (LOW) 105 ; [HIGH_SECTOR]= sector number (HIGH) 106 ; Function: 107 ; Hash into a buffer group and activate the extended memory if 108 ; necessary 109 ; Outputs: 110 ; [CurHashEntry] = current Hash entry addr 111 ; DS:DI = 1st buffer addr of the current Hash entry 112 ; No other registers altered 113 114 procedure GETCURHEAD,NEAR 115 assume ds:nothing, es:nothing, ss:DOSGROUP 116 117 PUSH DX ;LB. save regs ;AN000; 118 PUSH AX ;LB. ;AN000; 119 PUSH BX ;LB. ;AN000; 120 MOV AX,DX ;LB. ;AN000; 121 ; MOV DX,[HIGH_SECTOR] ;LB. HASH(sector#) and get entry # ;AN000; 122 XOR DX,DX ;LB. to avoid divide overflow ;AN000; 123 DIV word [ss:BUF_HASH_COUNT] ;LB. get remainder ;AN000; 124 ADD DX,DX ;LB. 8 bytes per entry ;AN000; 125 ADD DX,DX ;LB. ;AN000; 126 ADD DX,DX ;LB. times 8 ;AN000; 127 128 LDS DI,[ss:BUF_HASH_PTR] ;LB. get Hash Table addr ;AN000; 129 ADD DI,DX ;LB position to entry ;AN000; 130 Map_Entry2: 131 MOV WORD PTR [ss:CurHashEntry+2],DS ;LB. update current Hash entry ptr ;AN000; 132 MOV WORD PTR [ss:CurHashEntry],DI ;LB. ;AN000; 133 LASTBUFFER equ LastBuffer ; NASM port label 134 MOV WORD PTR [ss:LASTBUFFER],-1 ;LB. invalidate last buffer ;AN000; 135 MOV BX,[DI + EMS_PAGE_NUM] ;LB. logical page ;AN000; 136 137 %IFN BUFFERFLAG 138 LDS DI,[DI + BUFFER_BUCKET] ;LB. ds:di is 1st buffer addr ;AN000; 139 MOV [ss:FIRST_BUFF_ADDR],DI ;LB. 1/19/88 save first buffer addr ;AN000; 140 CALL SET_MAP_PAGE ;LB. activate handle if EMS there ;AN000; 141 %ELSE 142 push ax 143 mov ax, [ss:NEXTADD] 144 mov [ss:CURADD], ax 145 pop ax 146 CALL SET_MAP_PAGE ;LB. activate handle if EMS there ;AN000; 147 LDS DI,[DI + BUFFER_BUCKET] ;LB. ds:di is 1st buffer addr ;AN000; 148 MOV [ss:FIRST_BUFF_ADDR],DI ;LB. 1/19/88 save first buffer addr ;AN000; 149 %ENDIF 150 151 ;AN000; 152 POP BX ;LB. ;AN000; 153 POP AX ;LB. ;AN000; 154 POP DX ;LB. ;AN000; 155 return ;LB. ;AN000; 156 EndProc GETCURHEAD ;AN000; 157 158 ;AN000; 159 Break ;AN000; 160 ; Inputs: ;AN000; 161 ; BX= logical page ;AN000; 162 ; Function: ;AN000; 163 ; Map handle and logical page to frame 0 page 0 ;AN000; 164 ; Outputs: ;AN000; 165 ; AH=0 success ;AN000; 166 ; No other registers altered ;AN000; 167 ;AN000; 168 Procedure SET_MAP_PAGE,NEAR ;AN000; 169 assume ds:nothing, es:nothing, ss:DOSGROUP 170 171 ; int 3 172 ;AN000; 173 CMP byte [ss:BUF_EMS_MODE],-1 ;LB. EMS support ;AN000; 174 JZ No_map ;LB. no ;AN000; 175 176 %IFN BUFFERFLAG 177 CMP [ss:ACT_PAGE],BX ;LB. already mapped ? ;AN000; 178 JZ No_map ;LB. yes ;AN000; 179 %ENDIF 180 MOV [ss:ACT_PAGE],BX ;LB. save active page mapped ;AN000; 181 182 %IF BUFFERFLAG 183 cmp byte [ss:BUF_EMS_SAFE_FLAG], 1 184 je no_coll 185 ; int 3 186 call detect_collision 187 no_coll: 188 %ENDIF 189 190 MOV DX,[ss:BUF_EMS_HANDLE] ;LB. ;AN000; 191 MOV AH,44H ;LB. activate current handle ;AN000; 192 MOV AL,BYTE PTR [ss:BUF_EMS_PAGE_FRAME] ;LB. page frame number ;AN000; 193 INT 67H ;LB. ;AN000; 194 No_map: ;AN000; 195 return ;AN000; 196 EndProc SET_MAP_PAGE ;AN000; 197 ;AN000; 198 199 %IF BUFFERFLAG 200 201 Break ;AN000; 202 ; Inputs: ;AN000; 203 ; none ;AN000; 204 ; Function: ;AN000; 205 ; save map ;AN000; 206 ; Outputs: ;AN000; 207 ; none ;AN000; 208 ; No other registers altered ;AN000; 209 ;AN000; 210 Procedure SAVE_MAP,NEAR ;AN000; 211 assume ds:nothing, es:nothing, ss:DOSGROUP 212 ;AN000; 213 CMP byte [ss:BUF_EMS_MODE],-1 ;LB. EMS support ;AN000; 214 JZ No_save ;LB. no ;AN000; 215 MOV word [ss:ACT_PAGE],-1 ;LB. invalidate active page ;AN000; 216 MOV WORD PTR [ss:LASTBUFFER],-1 ;LB. and last buffer pointer ;AN000; 217 PUSH AX ;LB. save regs ;AN000; 218 PUSH DS ;LB. save regs ;AN000; 219 PUSH ES ;LB. ;AN000; 220 PUSH SI ;LB. ;AN000; 221 PUSH DI ;LB. ;AN000; 222 MOV SI,OFFSET BUF_EMS_SEG_CNT wrt DOSGROUP ;LB. ;AN000; 223 MOV DI,OFFSET BUF_EMS_MAP_BUF wrt DOSGROUP ;LB. ;AN000; 224 225 PUSH ss 226 POP ES 227 PUSH ss ;LB. ;AN000; 228 POP DS ;LB. ds:si -> ems seg count ;AN000; 229 230 MOV AX,4F00H ;LB. save map ;AN000; 231 EnterCrit critDisk ;LB. enter critical section ;AN000; 232 INT 67H ;LB. ;AN000; 233 LeaveCrit critDisk ;LB. leave critical section ;AN000; 234 POP DI ;LB. ;AN000; 235 POP SI ;LB. restore regs ;AN000; 236 POP ES ;LB. ;AN000; 237 POP DS ;LB. ;AN000; 238 POP AX ;LB. restore ;AN000; 239 No_save: ;AN000; 240 return ;AN000; 241 EndProc SAVE_MAP ;AN000; 242 ;AN000; 243 244 Break ;AN000; 245 ; Inputs: ;AN000; 246 ; none ;AN000; 247 ; Function: ;AN000; 248 ; restore_map ;AN000; 249 ; Outputs: ;AN000; 250 ; none ;AN000; 251 ; No other registers altered ;AN000; 252 ;AN000; 253 Procedure RESTORE_MAP,NEAR ;AN000; 254 assume ds:nothing, es:nothing, ss:DOSGROUP 255 ;AN000; 256 CMP byte [ss:BUF_EMS_MODE],-1 ;LB. EMS support ;AN000; 257 JZ No_restore ;LB. no ;AN000; 258 PUSH AX ;LB. save regs ;AN000; 259 PUSH DS ;LB. save regs ;AN000; 260 PUSH SI ;LB. ;AN000; 261 MOV SI,OFFSET BUF_EMS_MAP_BUF wrt DOSGROUP ;LB. ;AN000; 262 263 PUSH ss 264 POP DS 265 MOV AX,4F01H ;LB. restore map ;AN000; 266 EnterCrit critDisk ;LB. enter critical section ;AN000; 267 INT 67H ;LB. ;AN000; 268 LeaveCrit critDisk ;LB. leave critical section ;AN000; 269 POP SI ;LB. restore regs ;AN000; 270 POP DS ;LB. ;AN000; 271 POP AX ;LB. ;AN000; 272 No_restore: ;AN000; 273 return ;AN000; 274 EndProc RESTORE_MAP ;AN000; 275 276 %ENDIF 277 ;AN000; 278 ;AN000; 279 280 Break 281 282 ; Inputs: 283 ; Same as PLACEBUF 284 ; Function: 285 ; Save scan location and call PLACEBUF 286 ; Outputs: 287 ; DS:DI Points to saved scan location 288 ; SI destroyed, other registers unchanged 289 290 procedure ScanPlace,near 291 assume ds:nothing, es:nothing, ss:DOSGROUP 292 293 ;; PUSH ES 294 ;; LES SI,[DI.buf_link] ; Save scan location 295 MOV SI,[DI + buf_next] ; Save scan location 296 CALL PLACEBUF 297 ;; PUSH ES 298 ;; POP DS ; Restore scan location 299 MOV DI,SI 300 ;; POP ES 301 return 302 EndProc ScanPlace 303 304 ; Rewritten PLACEBUF (LKR), eliminates loops 305 ; 306 ; Input: 307 ; DS:DI points to buffer (DS->BUFFINFO array, DI=offset in array) 308 ; Function: 309 ; Remove buffer from queue and re-insert it in proper place. 310 ; NO registers altered 311 312 procedure PLACEBUF,NEAR 313 assume ds:nothing, es:nothing, ss:DOSGROUP 314 315 ; invoke save_world 316 push AX ;Save only regs we modify ;AN000; 317 push BX ;AN000; 318 push SI ;AN000; 319 push ES ;AN000; 320 321 les SI,[ss:CurHashEntry] ;ES:SI -> Current Hash entry ;AN000; 322 mov BX,word ptr [ES:SI + BUFFER_BUCKET] ;BX = offset of head of list ;AN000; 323 324 cmp [DI + buf_next],BX ;Buf = last? ;AN000; 325 je nret ;Yes, special case ;AN000; 326 cmp DI,BX ;Buf = first? ;AN000; 327 je bufloop ;Yes, special case ;AN000; 328 mov SI,[DI + buf_prev] ;No, SI = prior Buf ;AN000; 329 mov AX,[DI + buf_next] ;Now delete Buf from list ;AN000; 330 mov [SI + buf_next],AX ;AN000; 331 push SI ;Save si ;AN000; 332 mov SI,[DI + buf_next] ;Update backward pointer ;AN000; 333 mov AX,[DI + buf_prev] ; ;AN000; 334 mov [SI + buf_prev],AX ; ;AN000; 335 pop si ;Restore si ;AN000; 336 lookend: ;(label is now a misnomer) ;AN000; 337 mov SI,[BX + buf_prev] ;SI-> last buffer ;AN000; 338 mov [SI + buf_next],DI ;Add Buf to end of list ;AN000; 339 mov [BX + buf_prev],DI ;AN000; 340 mov [DI + buf_prev],SI ;Update linkage in Buf too ;AN000; 341 mov [DI + buf_next],BX ;AN000; 342 nret: ;AN000; 343 ;AN000; 344 ; invoke restore_world ;AN000; 345 pop ES ;Restore regs we modified ;AN000; 346 pop SI ;AN000; 347 pop BX ;AN000; 348 pop AX ;AN000; 349 ;AN000; 350 cmp byte [DI + buf_ID],-1 ; Buffer FREE? ;AN000; 351 retnz ; No ;AN000; 352 invoke PLACEHEAD ; Buffer is free, belongs at hea;AN000; 353 return ;AN000; 354 bufloop: ;(label is now a misnomer) ;AN000; 355 mov BX,[DI + buf_next] ;Set new head position ;AN000; 356 mov word ptr [ES:SI + BUFFER_BUCKET],BX ;AN000; 357 jmp nret ;Continue with repositioning ;AN000; 358 359 EndProc PLACEBUF 360 361 ; SAME AS PLACEBUF except places buffer at head 362 ; NOTE:::::: ASSUMES THAT BUFFER IS CURRENTLY THE LAST 363 ; ONE IN THE LIST!!!!!!! 364 ; Rewritten PLACEBUF, takes buffer from end of list to head of list 365 366 procedure PLACEHEAD,NEAR ;AN000; 367 assume ds:nothing, es:nothing, ss:DOSGROUP 368 push ES ;AN000; 369 push SI ;AN000; 370 les SI,[ss:CurHashEntry] ;AN000; 371 mov word ptr [ES:SI + BUFFER_BUCKET],DI ;AN000; 372 pop SI ;AN000; 373 pop ES ;AN000; 374 return ;AN000; 375 EndProc PLACEHEAD ;AN000; 376 377 378 Break 379 380 ; Compare DS:SI to ES:DI (or DS:DI to ES:SI) for equality 381 ; DO NOT USE FOR < or > 382 ; No Registers altered 383 384 procedure PointComp,NEAR 385 assume ds:nothing, es:nothing, ss:nothing 386 387 CMP SI,DI 388 retnz 389 PUSH CX 390 PUSH DX 391 MOV CX,DS 392 MOV DX,ES 393 CMP CX,DX 394 POP DX 395 POP CX 396 return 397 EndProc PointComp 398 399 Break 400 401 ; Input: 402 ; AL = 0 means sector must be pre-read 403 ; ELSE no pre-read 404 ; DX = Desired physical sector number (LOW) 405 ; [HIGH_SECTOR]= Desired physical sector number (HIGH) 406 ; ES:BP = Pointer to drive parameters 407 ; [ALLOWED] set in case of INT 24 408 ; Function: 409 ; Get the specified local sector into one of the I/O buffers 410 ; And shuffle the queue 411 ; Output: 412 ; [CURBUF] Points to the Buffer for the sector 413 ; THE BUFFER TYPE FIELD OF buf_flags = 0, caller must set it 414 ; Carry set if error (currently user FAILed to INT 24) 415 ; DS,DX,ES:BP unchanged, all other registers destroyed 416 417 procedure GETBUFFR,NEAR 418 assume ds:DOSGROUP, es:nothing, ss:DOSGROUP 419 420 XOR SI,SI 421 422 entry GETBUFFRB 423 assume ds:DOSGROUP, es:nothing, ss:DOSGROUP 424 425 Assert ISDPB,,"GetBuffr" 426 PREREAD equ PreRead ; NASM port label 427 MOV [PREREAD],AX 428 MOV AL,[ES:BP + dpb_drive] 429 LDS DI,[LASTBUFFER] 430 ASSUME DS:NOTHING 431 MOV CX,[ss:HIGH_SECTOR] ; F.C. >32mb ;AN000; 432 CMP DI,-1 ; Recency pointer valid? 433 JZ SKBUF ; No 434 435 CMP DX,WORD PTR [DI + buf_sector] 436 JNZ SKBUF ; Wrong sector 437 CMP CX,WORD PTR [DI + buf_sector+2] ; F.C. >32mb ;AN000; 438 JNZ SKBUF ; F.C. >32mb ;AN000; 439 CMP AL,[DI + buf_ID] 440 JNZ SKBUF ; Wrong Drive 441 442 JMP JUSTBUF ; Just asked for same buffer 443 SKBUF: 444 CALL GETCURHEAD ;LB. get cuurent Hash entry ;AN000; 445 ; LDS DI,[BUFFHEAD] 446 NXTBFF: 447 CMP DX,WORD PTR [DI + buf_sector] ; F.C. >32mb ;AN000; 448 JNZ BUMP 449 CMP CX,WORD PTR [DI + buf_sector+2] ; F.C. >32mb ;AN000; 450 JNZ BUMP ; F.C. >32mb ;AN000; 451 CMP AL,[DI + buf_ID] 452 %ifn BUFFERFLAG 453 JZ SETINF 454 %else 455 bump equ BUMP ; NASM port label 456 jnz bump 457 setinf equ SETINF ; NASM port label 458 jmp setinf 459 %endif 460 BUMP: 461 mov DI,[DI + buf_next] ;;;;;;1/19/88 ;AN000; 462 cmp DI,[ss:FIRST_BUFF_ADDR] ;;;;;;1/19/88 ;AN000; 463 JNZ NXTBFF 464 ;;;; LDS DI,[CurHashEntry] ;LB. secondary cache's use ;AN000; 465 ;;;; LDS DI,[DI.BUFFER_BUCKET] ;LB. ;AN000; 466 ; LDS DI,[BUFFHEAD] 467 PUSH word [ss:HIGH_SECTOR] ;F.C. >32mb ;AN000; 468 PUSH SI 469 PUSH DX 470 PUSH BP 471 PUSH ES 472 BUFWRITE equ BufWrite ; NASM port label 473 CALL BUFWRITE ; Write out the dirty buffer 474 POP ES 475 POP BP 476 POP DX 477 POP SI 478 POP word [ss:HIGH_SECTOR] ;F.C. >32mb ;AN000; 479 %ifn BUFFERFLAG 480 JC GETBERR 481 %else 482 jnc skip_getberr 483 getberr equ GETBERR ; NASM port label 484 jmp getberr 485 skip_getberr: 486 %endif 487 CALL SET_RQ_SC_PARMS ;LB. set parms ;AN000; 488 XOR AH,AH ; initial flags 489 TEST BYTE PTR [ss:PREREAD],-1 ; Read in the new sector 490 JNZ SETBUF 491 BufInSiz equ BUFINSIZ ; NASM port equate 492 LEA BX,[DI + BufInSiz] ; Point at buffer 493 MOV CX,1 494 PUSH SI 495 PUSH DI 496 PUSH DX 497 ; Note: As far as I can tell, all disk reads into buffers go through this point. -mrw 10/88 498 %if BUFFERFLAG 499 ; int 3 500 buf_ems_mode equ BUF_EMS_MODE ; NASM port label 501 cmp byte [ss:buf_ems_mode], -1 502 jz normread 503 push bx 504 push ds ; save ds:bx --> ems_buffer 505 push ss 506 pop ds 507 dosgroup equ DOSGROUP ; NASM port equate 508 mov bx, offset low_ems_buf wrt dosgroup ; ds:bx --> low_ems_buffer 509 normread: 510 %endif 511 OR SI,SI 512 JZ NORMSEC 513 invoke FATSECRD 514 MOV AH,buf_isFAT ; Set buf_flags 515 JMP SHORT GOTTHESEC ; Buffer is marked free if read barfs 516 NORMSEC: 517 invoke DREAD ; Buffer is marked free if read barfs 518 MOV AH,0 ; Set buf_flags to no type, DO NOT XOR! 519 GOTTHESEC: ; Carry set by either FATSECRD or DREAD 520 %if BUFFERFLAG 521 pushf 522 jc skipreadtrans 523 cmp byte [ss:buf_ems_mode], -1 524 je skipreadtrans 525 526 popf 527 pop ds 528 pop bx ; restore ems_buffer pointer 529 pushf 530 531 push cx ; save regs to be used by rep mov 532 push ds 533 push es 534 535 mov di, bx 536 push ds 537 pop es ; es:di --> ems_buf 538 mov si, offset low_ems_buf wrt dosgroup 539 push ss 540 pop ds ; ds:si --> low_ems_buf 541 mov cx, 512/2 542 rep movsw 543 544 pop es ; restore regs. 545 pop ds 546 pop cx 547 skipreadtrans: 548 popf 549 %endif 550 POP DX 551 POP DI 552 POP SI 553 JC GETBERR 554 SETBUF: 555 MOV CX,[ss:HIGH_SECTOR] ; F.C. >32mb ;AN000; 556 MOV WORD PTR [DI + buf_sector+2],CX ; F.C. >32mb ;AN000; 557 MOV WORD PTR [DI + buf_sector],DX ; F.C. >32mb ;AN000; 558 MOV WORD PTR [DI + buf_DPB],BP 559 MOV WORD PTR [DI + buf_DPB+2],ES 560 MOV AL,[ES:BP + dpb_drive] 561 MOV WORD PTR [DI + buf_ID],AX ; Sets buf_flags too, to AH 562 SETINF: 563 MOV byte [DI + buf_wrtcnt],1 ; Default to not a FAT sector ;AC000; 564 XOR AX,AX ;>32mb ;AN000; 565 OR SI,SI 566 JZ SETSTUFFOK 567 MOV AL,[ES:BP + dpb_FAT_count] 568 MOV [DI + buf_wrtcnt],AL ;>32mb ;AN000; 569 MOV AX,[ES:BP + dpb_FAT_size] 570 SETSTUFFOK: 571 MOV [DI + buf_wrtcntinc],AX ;>32mb ;AC000; 572 CALL PLACEBUF 573 JUSTBUF: 574 CURBUF equ CurBuf ; NASM port label 575 MOV WORD PTR [ss:CURBUF+2],DS 576 MOV WORD PTR [ss:LASTBUFFER+2],DS 577 MOV WORD PTR [ss:CURBUF],DI 578 MOV WORD PTR [ss:LASTBUFFER],DI 579 CLC 580 GETBERR: 581 Context DS 582 return 583 EndProc GETBUFFR 584 585 Break 586 587 ; Input: 588 ; DS = DOSGROUP 589 ; AL = Physical unit number local buffers only 590 ; = -1 for all units and all remote buffers 591 ; Function: 592 ; Write out all dirty buffers for unit, and flag them as clean 593 ; Carry set if error (user FAILed to I 24) 594 ; Flush operation completed. 595 ; DS Preserved, all others destroyed (ES too) 596 597 procedure FlushBuf,NEAR 598 assume ds:DOSGROUP, es:nothing, ss:DOSGROUP 599 600 MOV AH,-1 601 ; LDS DI,[BUFFHEAD] 602 ASSUME DS:NOTHING 603 604 LDS DI,[ss:BUF_HASH_PTR] ;LB. get Hash Table addr ;AN000; 605 MOV CX,[ss:BUF_HASH_COUNT] ;LB. get Hash entry count ;AN000; 606 XOR DX,DX ;LB. set initial index to 0 ;AN000; 607 608 NXTBUFF2: 609 PUSH CX ;LB. save Hash entry count ;AN000; 610 TEST word [ss:DOS34_FLAG],FROM_DISK_RESET ;MS. from disk reset ;AN004; 611 JNZ Zapzap ;MS. yes ;AN004; 612 Dirty_Count equ DIRTY_COUNT ; NASM port equate 613 CMP byte [DI + Dirty_Count],0 ;LB. dirty entry ? ;AN000; 614 JZ getnext ;LB. no ;AN000; 615 Zapzap: ;AN004; 616 PUSH DS ;LB. save regs ;AN000; 617 PUSH DI ;LB. ;AN000; 618 invoke Map_Entry ;LB. ds:di -> first buffer addr ;AN000; 619 NXTBUFF: 620 CALL CHECKFLUSH ; Ignore Carry return from CHECKFLUSH. 621 ; FAILERR is set if user FAILed. 622 PUSH AX 623 MOV AL,[DI + buf_ID] 624 WPERR equ WPErr ; NASM port label 625 CMP AL,BYTE PTR [ss:WPERR] 626 ZAP equ Zap ; NASM port label 627 JZ ZAP 628 TEST word [ss:DOS34_FLAG],FROM_DISK_RESET ;MS. from disk reset ;AN000; 629 JNZ Zap ;MS. yes ;AN000; 630 631 NOZAP: 632 POP AX 633 mov DI,[DI + buf_next] ;;;;1/19/88 ;AN000; 634 CMP DI,[ss:FIRST_BUFF_ADDR] ;;;;1/19/88 ;AN000; 635 JNZ NXTBUFF 636 637 POP DI ;LB. ;AN000; 638 POP DS ;LB. ;AN000; 639 getnext: 640 ADD DI,BUFFER_HASH_ENTRY_struc_size ;LB. position to next entry ;AN000; 641 POP CX ;LB. restore entry count ;AN000; 642 LOOP NXTBUFF2 ;LB. get next entry buffer ;AN000; 643 Context DS 644 CMP byte [FAILERR],0 645 FLSHBad equ FlshBad ; NASM port label 646 JNZ FLSHBad ; Carry clear if JMP 647 return 648 FlshBad: 649 STC ; Return error if user FAILed 650 return 651 Zap: 652 MOV WORD PTR [DI + buf_ID],00FFH ; Invalidate buffer, it is inconsistent 653 NoZap equ NOZAP ; NASM port label 654 JMP NoZap 655 656 EndProc FlushBuf 657 658 procedure CHECKFLUSH,NEAR 659 assume ds:nothing, es:nothing, ss:DOSGROUP 660 ; Carry set if problem (currently user FAILed to I 24) 661 662 Assert ISBUF,,"CheckFlush" 663 CMP [DI + buf_ID],AH 664 retz ; Skip free buffers, carry clear 665 CMP AH,AL 666 JZ DOBUFFER ; Do all dirty buffers 667 CMP AL,[DI + buf_ID] 668 CLC 669 retnz ; Buffer not for this unit or SFT 670 DOBUFFER: 671 TEST byte [DI + buf_flags],buf_dirty 672 retz ; Buffer not dirty, carry clear by TEST 673 PUSH AX 674 PUSH WORD PTR [DI + buf_ID] 675 CALL BUFWRITE 676 POP AX 677 JC LEAVE_BUF ; Leave buffer marked free (lost). 678 AND AH,~ buf_dirty ; Buffer is clean, clears carry 679 MOV WORD PTR [DI + buf_ID],AX 680 LEAVE_BUF: 681 POP AX ; Search info 682 return 683 EndProc CHECKFLUSH 684 685 Break 686 687 ; Input: 688 ; DS:DI Points to the buffer 689 ; Function: 690 ; Write out all the buffer if dirty. 691 ; Output: 692 ; Buffer marked free 693 ; Carry set if error (currently user FAILed to I 24) 694 ; DS:DI Preserved, ALL others destroyed (ES too) 695 696 procedure BufWrite,NEAR 697 assume ds:nothing, es:nothing, ss:DOSGROUP 698 699 Assert ISBUF,,"BufWrite" 700 MOV AX,00FFH 701 XCHG AX,WORD PTR [DI + buf_ID] ; Free, in case write barfs 702 CMP AL,0FFH 703 retz ; Buffer is free, carry clear. 704 TEST AH,buf_dirty 705 retz ; Buffer is clean, carry clear. 706 invoke DEC_DIRTY_COUNT ; LB. decrement dirty count 707 CMP AL,BYTE PTR [ss:WPERR] 708 retz ; If in WP error zap buffer 709 MOV [ss:SC_DRIVE],AL ;LB. set it for invalidation ;AN000; 710 LES BP,[DI + buf_DPB] 711 LEA BX,[DI + BufInSiz] ; Point at buffer 712 MOV DX,WORD PTR [DI + buf_sector] ;F.C. >32mb ;AN000; 713 MOV CX,WORD PTR [DI + buf_sector+2] ;F.C. >32mb ;AN000; 714 MOV [ss:HIGH_SECTOR],CX ;F.C. >32mb ;AN000; 715 MOV CL,[DI + buf_wrtcnt] ;>32mb ;AC000; 716 ; MOV AL,CH ; [DI.buf_wrtcntinc] 717 XOR CH,CH 718 MOV AX,[DI + buf_wrtcntinc] ;>32mb ;AC000; 719 allowed_RETRY equ Allowed_RETRY ; NASM port equate 720 allowed_FAIL equ Allowed_FAIL ; NASM port equate 721 MOV byte [ss:ALLOWED],allowed_RETRY + allowed_FAIL 722 TEST byte [DI + buf_flags],buf_isDATA 723 JZ NO_IGNORE 724 allowed_IGNORE equ Allowed_IGNORE ; NASM port equate 725 OR byte [ss:ALLOWED],allowed_IGNORE 726 NO_IGNORE: 727 PUSH DI ; Save buffer pointer 728 XOR DI,DI ; Indicate failure 729 WRTAGAIN: 730 SaveReg 731 MOV CX,1 732 SaveReg 733 ; Note: As far as I can tell, all disk reads into buffers go through this point. -mrw 10/88 734 735 %if BUFFERFLAG 736 ; int 3 737 cmp byte [ss:buf_ems_mode], -1 738 jz skipwritetrans 739 740 push es 741 push di 742 push si 743 push cx 744 745 mov si, bx ; ds:si --> ems_buffer 746 mov di, offset low_ems_buf wrt dosgroup 747 push ss 748 pop es ; es:di --> low_ems_buffer 749 mov cx, 512/2 750 rep movsw 751 752 pop cx 753 pop si 754 pop di 755 pop es 756 757 push ds 758 push bx 759 mov bx, offset low_ems_buf wrt dosgroup 760 push ss 761 pop ds ; ds:bx --> low_ems_buffer 762 skipwritetrans: 763 %endif 764 765 invoke DWRITE ; Write out the dirty buffer 766 767 %if BUFFERFLAG 768 pushf ; save carry flag from DWRITE 769 cmp byte [ss:buf_ems_mode], -1 770 jz normwrite 771 popf ; need to get at stack 772 pop bx ; ds:bx --> ems_buffer 773 pop ds 774 pushf ; put it back, so we can pop it 775 normwrite: 776 popf ; restore carry flag 777 %endif 778 779 RestoreReg 780 RestoreReg 781 JC NOSET 782 INC DI ; If at least ONE write succeedes, the operation 783 NOSET: ; succeedes. 784 ADD DX,AX 785 LOOP WRTAGAIN 786 OR DI,DI ; Clears carry 787 JNZ BWROK ; At least one write worked 788 STC ; DI never got INCed, all writes failed. 789 BWROK: 790 POP DI 791 return 792 EndProc BufWrite 793 794 Break 795 796 ; Input: 797 ; ES:BP = drive parameter block 798 ; Function: 799 ; Set requesting drive, and sector size 800 ; Output: 801 ; [SC_SECTOR_SIZE]= drive sector size 802 ; [SC_DRIVE]= drive # 803 ; 804 ; All registers preserved 805 806 procedure SET_RQ_SC_PARMS,NEAR 807 assume ds:nothing, es:nothing, ss:DOSGROUP 808 809 CMP word [ss:SC_CACHE_COUNT],0 ;LB. do it only secondary cache exists ;AN000; 810 JZ nosec ;LB. ;AN000; 811 PUSH DX ;LB. save dx ;AN000; 812 MOV DX,[ES:BP + dpb_sector_size] ;LB. save sector size ;AN000; 813 MOV [ss:SC_SECTOR_SIZE],DX ;LB. ;AN000; 814 MOV DL,[ES:BP + dpb_drive] ;LB. save drive # ;AN000; 815 MOV [ss:SC_DRIVE],DL ;LB. ;AN000; 816 ;AN000; 817 POP DX ;LB. restore dx ;AN000; 818 819 nosec: 820 return 821 EndProc SET_RQ_SC_PARMS ;LB. return ;AN000; 822 823 Break 824 825 ; Input: 826 ; none 827 ; Function: 828 ; increment dirty buffers count 829 ; Output: 830 ; dirty buffers count in the current hash entry is incremented 831 ; 832 ; All registers preserved 833 834 procedure INC_DIRTY_COUNT,NEAR 835 assume ds:nothing, es:nothing, ss:DOSGROUP 836 837 PUSH DS ;LB. save regs ;AN000; 838 PUSH SI ;LB. ;AN000; 839 LDS SI,[ss:CurHashEntry] ;LB. get current hash entry ;AN000; 840 INC byte [SI + Dirty_Count] ;LB. add 1 ;AN000; 841 POP SI ;LB. restore regs ;AN000; 842 POP DS ;LB. ;AN000; 843 return 844 EndProc INC_DIRTY_COUNT ;LB. return ;AN000; 845 846 Break 847 848 ; Input: 849 ; none 850 ; Function: 851 ; decrement dirty buffers count 852 ; Output: 853 ; dirty buffers count in the current hash entry is decremented 854 ; 855 ; All registers preserved 856 857 procedure DEC_DIRTY_COUNT,NEAR 858 assume ds:nothing, es:nothing, ss:DOSGROUP 859 860 PUSH DS ;LB. save regs ;AN000; 861 PUSH SI ;LB. ;AN000; 862 LDS SI,[ss:CurHashEntry] ;LB. get current hash entry ;AN000; 863 CMP byte [SI + Dirty_Count],0 ;LB. in case if 0 ;AN000; 864 JZ nodec ;LB. do nothing ;AN000; 865 DEC byte [SI + Dirty_Count] ;LB. sub 1 ;AN000; 866 nodec: 867 POP SI ;LB. restore regs ;AN000; 868 POP DS ;LB. ;AN000; 869 return 870 EndProc DEC_DIRTY_COUNT ;LB. return ;AN000; 871 872 873 Break 874 875 ; Input: 876 ; DS:DI ponits to hash entry 877 ; Function: 878 ; map the buferrs of this entry 879 ; Output: 880 ; the buffers are mapped 881 ; 882 ; All registers preserved 883 884 procedure Map_Entry,NEAR 885 assume ds:nothing, es:nothing, ss:DOSGROUP 886 887 PUSH DX ;LB. save regs ;AN000; 888 PUSH AX ;LB. ;AN000; 889 PUSH BX ;LB. ;AN000; 890 JMP Map_Entry2 ;LB. ;AN000; 891 EndProc Map_Entry ;LB. ;AN000; 892 893 894 %IF BUFFERFLAG 895 896 ;------------------------------------------------------------------------- 897 ; Procedure name : detect collision 898 ; Inputs : [DMAADD] - user Xaddr 899 ; [CURADD] - current offset 900 ; [BYTCNT1] - for partial sector read 901 ; SAFE_FLAG - cleared - indicating that the 902 ; current page is unsafe. 903 ; 904 ; Outputs : es - physical page segment to use 905 ; di - corresponding page number 906 ; SAFE_FLAG is set is a collision is detected 907 ; and the current page is switched form 908 ; LAST_PAGE to FIRST_PAGE. 909 ;--------------------------------------------------------------------------- 910 ; 911 912 Procedure detect_collision, near 913 assume ds:nothing, es:nothing, ss:DOSGROUP 914 915 push ax 916 push bx 917 push cx 918 919 cmp byte [ss:BUF_EMS_MODE], -1 920 jz fin_detect_coll 921 922 mov ax, [ss:CURADD] ; current offset 923 924 cmp word [ss:BYTCNT1], 0 925 je no_partial_sector 926 add ax, [ss:BYTCNT1] 927 928 no_partial_sector: 929 mov cl, 4 930 shr ax, cl ; convert to paragraphs 931 mov bx, word ptr [ss:DMAADD+2] ; get original segment 932 add ax, bx ; get current segment 933 934 and ax, 0fc00h ; get ems page of current segment 935 cmp ax, [ss:BUF_EMS_LAST_PAGE] ; is the current segment = last segment 936 jne fin_detect_coll ; page is still safe 937 938 ; int 3 939 push ax 940 mov ax, word ptr [ss:DMAADD] 941 mov ax, [ss:NEXTADD] 942 mov ax, [ss:CURADD] 943 mov ax, [ss:BYTCNT1] 944 pop ax 945 946 restore_user_map equ RESTORE_USER_MAP ; NASM port label 947 call restore_user_map 948 mov word ptr [ss:LASTBUFFER], -1 949 mov ax, [ss:BUF_EMS_FIRST_PAGE] 950 mov [ss:BUF_EMS_PFRAME], ax 951 mov ax, [ss:BUF_EMS_FIRST_PAGE+2] 952 mov [ss:BUF_EMS_PAGE_FRAME], ax 953 mov byte [ss:BUF_EMS_SAFE_FLAG], 1 954 Setup_EMS_buffers equ Setup_EMS_Buffers ; NASM port label 955 call Setup_EMS_buffers 956 save_user_map equ SAVE_USER_MAP ; NASM port label 957 call save_user_map 958 959 fin_detect_coll: 960 pop cx 961 pop bx 962 pop ax 963 ret 964 965 EndProc detect_collision 966 967 Procedure Setup_EMS_Buffers,Near 968 assume ds:nothing, es:nothing, ss:DOSGROUP 969 970 cmp byte [ss:BUF_EMS_MODE], -1 971 jz setup_ems_ret 972 973 push bx 974 push cx 975 push ax 976 push ds 977 push di 978 979 mov bx, [ss:BUF_HASH_COUNT] ; # of hash table entries 980 lds di, [ss:BUF_HASH_PTR] ; ds:di -> hash table 981 982 xor cx, cx 983 984 next_bucket: 985 mov ax, [ss:BUF_EMS_PFRAME] 986 mov word ptr [di + BUFFER_BUCKET+2], ax 987 add di, 8 ; next has entry. 988 inc cx 989 cmp cx, bx 990 jne next_bucket 991 992 pop di 993 pop ds 994 pop ax 995 pop cx 996 pop bx 997 998 setup_ems_ret: 999 ret 1000 1001 EndProc Setup_EMS_Buffers 1002 1003 %ENDIF 1004 1005 END 1006 1007 %endif ; BUF2 === Trace listing source: ../DOS/proc.lst 1 ; SCCSID = @(#)proc.asm 1.1 85/04/10 2 ;TITLE IBMPROC - process maintenance 3 ;NAME IBMPROC 4 5 ; 6 ; Process related system calls and low level routines for DOS 2.X. 7 ; I/O specs are defined in DISPATCH. 8 ; 9 ; $WAIT 10 ; $EXEC 11 ; $Keep_process 12 ; Stay_resident 13 ; $EXIT 14 ; $ABORT 15 ; abort_inner 16 ; 17 ; Modification history: 18 ; 19 ; Created: ARR 30 March 1983 20 ; 21 22 [list -] 22 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 27 28 [list +] === Switch to base=002450h -> "DOSCODECODE" 29 section DOSCODECODE 30 [list -] 30 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 30 ****************** warning: out: BPB.INC... [-w+user] 30 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 30 ****************** warning: out: DEVSYM.INC... [-w+user] 37 38 SAVEXIT EQU 10 39 40 i_need CurrentPDB,WORD 41 i_need CreatePDB,BYTE 42 i_need Exit_type,BYTE 43 i_need INDOS,BYTE 44 i_need DMAADD,DWORD 45 i_need DidCTRLC,BYTE 46 i_need exit_type,BYTE 47 i_need exit_code,WORD 48 i_need OpenBuf,128 49 I_need EXTERR_LOCUS,BYTE ; Extended Error Locus 50 51 ;SUBTTL $WAIT - return previous process error code 52 ;PAGE 53 ; 54 ; process control data 55 ; 56 i_need exit_code,WORD ; code of exit 57 58 assume nocheck, ss:DOSGROUP 59 60 ; 61 ; Assembler usage: 62 ; MOV AH, WaitProcess 63 ; INT int_command 64 ; AX has the exit code 65 procedure D_WAIT,NEAR 65 ****************** warning: proc D_WAIT... [-w+user] 66 ASSUME DS:NOTHING,ES:NOTHING 0 0000616E 31C0 XOR AX,AX 0 00006170 368706[0000] XCHG AX,[ss:exit_code] 0 00006175 E9[0000] transfer SYS_RET_OK 70 EndProc D_WAIT 71 72 ;=== Push trace listing source: exec.nas 73 %include "exec.nas" ; NASM included file 1 <1> ; SCCSID = @(#)exec.asm 1.3 85/08/13 2 <1> ; SCCSID = @(#)exec.asm 1.3 85/08/13 3 <1> ; AN000 version 4.0 jan. 1988 4 <1> ; A007 PTM 3957 - fake vesrion for IBMCACHE.COM 5 <1> ; A008 PTM 4070 - fake version for MS WINDOWS 6 <1> 7 <1> ;SUBTTL $exec - load/go a program 8 <1> ;PAGE 9 <1> ; 10 <1> ; Assembler usage: 11 <1> ; LDS DX, name 12 <1> ; LES BX, blk 13 <1> ; MOV AH, Exec 14 <1> ; MOV AL, func 15 <1> ; INT int_command 16 <1> ; 17 <1> ; AL Function 18 <1> ; -- -------- 19 <1> ; 0 Load and execute the program. 20 <1> ; 1 Load, create the program header but do not 21 <1> ; begin execution. 22 <1> ; 3 Load overlay. No header created. 23 <1> ; 24 <1> ; AL = 0 -> load/execute program 25 <1> ; 26 <1> ; +---------------------------+ 27 <1> ; | WORD segment address of | 28 <1> ; | environment. | 29 <1> ; +---------------------------+ 30 <1> ; | DWORD pointer to ASCIZ | 31 <1> ; | command line at 80h | 32 <1> ; +---------------------------+ 33 <1> ; | DWORD pointer to default | 34 <1> ; | FCB to be passed at 5Ch | 35 <1> ; +---------------------------+ 36 <1> ; | DWORD pointer to default | 37 <1> ; | FCB to be passed at 6Ch | 38 <1> ; +---------------------------+ 39 <1> ; 40 <1> ; AL = 1 -> load program 41 <1> ; 42 <1> ; +---------------------------+ 43 <1> ; | WORD segment address of | 44 <1> ; | environment. | 45 <1> ; +---------------------------+ 46 <1> ; | DWORD pointer to ASCIZ | 47 <1> ; | command line at 80h | 48 <1> ; +---------------------------+ 49 <1> ; | DWORD pointer to default | 50 <1> ; | FCB to be passed at 5Ch | 51 <1> ; +---------------------------+ 52 <1> ; | DWORD pointer to default | 53 <1> ; | FCB to be passed at 6Ch | 54 <1> ; +---------------------------+ 55 <1> ; | DWORD returned value of | 56 <1> ; | CS:IP | 57 <1> ; +---------------------------+ 58 <1> ; | DWORD returned value of | 59 <1> ; | SS:IP | 60 <1> ; +---------------------------+ 61 <1> ; 62 <1> ; AL = 3 -> load overlay 63 <1> ; 64 <1> ; +---------------------------+ 65 <1> ; | WORD segment address where| 66 <1> ; | file will be loaded. | 67 <1> ; +---------------------------+ 68 <1> ; | WORD relocation factor to | 69 <1> ; | be applied to the image. | 70 <1> ; +---------------------------+ 71 <1> ; 72 <1> ; Returns: 73 <1> ; AX = error_invalid_function 74 <1> ; = error_bad_format 75 <1> ; = error_bad_environment 76 <1> ; = error_not_enough_memory 77 <1> ; = error_file_not_found 78 <1> ; 79 <1> ; Revision history: 80 <1> ; 81 <1> ; A000 version 4.00 Jan. 1988 82 <1> ; 83 <1> %include "ea.mac" 1 <2> 2 <2> ;Get/Set Extended Attrbute Equates 3 <2> 4 <2> ;The following equates are for EA types 5 <2> 6 <2> EAISUNDEF equ 00H ; undefined 7 <2> EAISLOGICAL equ 01H ; logical (0 or 1), 1 byte 8 <2> EAISBINARY equ 02H ; binary integer 1, 2, or 4 bytes 9 <2> EAISASCII equ 03H ; ASCII , 0 to 128 bytes 10 <2> EAISDATE equ 04H ; DOS file date format, 2 bytes 11 <2> EAISTIME equ 05H ; DOS file time format, 2 bytes 12 <2> 13 <2> ;The following equates are for EA flags 14 <2> 15 <2> EASYSTEM equ 8000H ; system defined, bultin 16 <2> EAREADONLY equ 4000H ; read-only , cannot be changed 17 <2> EAHIDDEN equ 2000H ; hidden from ATTRIB 18 <2> EACREATEONLY equ 1000H ; settable only at create time 19 <2> 20 <2> ;The following equates are for EA failure reason code (set by DOS) 21 <2> 22 <2> EARCSUCCESS equ 00H ; success 23 <2> EARCNOTFOUND equ 01H ; name not found 24 <2> EARCNOSPACE equ 02H ; no space to hold name or value 25 <2> EARCNOTNOW equ 03H ; name can't be set on this function 26 <2> EARCNOTEVER equ 04H ; name can't be set 27 <2> EARCUNDEF equ 05H ; name known to IFS but not supported 28 <2> EARCDEFBAD equ 06H ; EA definition bad (type,length, etc) 29 <2> EARCACCESS equ 07H ; EA access denied 30 <2> EARCBADVAL equ 08H ; bad value 31 <2> EARCDEVERROR equ 09H ; device error 32 <2> EARCUNKNOWN equ 0FFFFH ; unknown cause 33 <2> 34 <2> 35 <2> ;The following equates are for EA file type 36 <2> 37 <2> EAEXISTING equ 00H ; existing file 38 <2> EARTL equ 02H ; right to left 39 <2> EAEXECUTABLE equ 03H ; executable program 40 <2> EAINSTALLABLE equ 04H ; installable executable program 41 <2> EAOVERLAY equ 05H ; program overlay 42 <2> EADEV_DRIVER equ 06H ; device driver 43 <2> EAIFS_DRIVER equ 07H ; ifs deriver 44 <2> 45 <2> 46 <2> 47 <2> 48 <2> By_Create equ 0000010B ; set by Extended Open (create) 49 <2> BY_XA equ 0000100B ; set by Get/Set XA by Handle 50 <2> 51 <2> ;Extended Attribute Structure 52 <2> 53 <2> EA STRUC ; extended attribute list 0 0000616E ?? EA_TYPE DB ? ; type 0 0000616F ???? EA_FLAGS DW ? ; flags 0 00006171 ?? EA_RC DB ? ; reason code 0 00006172 ?? EA_NAMELEN DB ? ; name length 0 00006173 ???? EA_VALLEN DW ? ; value length 0 00006175 ?? EA_NAME DB ? ; name 60 <2> EA ENDS 61 <2> 62 <2> 63 <2> ;Query Extended Attribute list 64 <2> 65 <2> QEA STRUC ; extended attribute list 0 0000616E ?? QEA_TYPE DB ? ; type 0 0000616F ???? QEA_FLAGS DW ? ; flags 0 00006171 ?? QEA_NAMELEN DB ? ; name length 0 00006172 ?? QEA_NAME DB ? ; name 70 <2> QEA ENDS 71 <2> 84 <1> %include "version.mac" 1 <2> ; Some modules really want TRUE to be 0FFH. Best to let them have their way. 2 <2> TRUE EQU 0FFFFh 3 <2> TRUEBYTE EQU 0FFh 4 <2> FALSE EQU 0 5 <2> 6 <2> ; 7 <2> ; Use the following switches to control cmacros.inc 8 <2> ; 9 <2> ?PLM equ 0 10 <2> ?WIN equ 0 11 <2> 12 <2> memS EQU 1 ; Small model 13 <2> ; 14 <2> ; Use the switches below to produce the standard Microsoft version or the IBM 15 <2> ; version of the operating system 16 <2> ; 17 <2> ; The below chart will indicate how to set the switches to build the various 18 <2> ; versions 19 <2> ; 20 <2> ; IBMVER IBMCOPYRIGHT 21 <2> ; -------------------------------------------------------- 22 <2> ; IBM Version | TRUE TRUE 23 <2> ; -------------------------------------------------------- 24 <2> ; MS Version | FALSE FALSE 25 <2> ; -------------------------------------------------------- 26 <2> ; Clone Version | TRUE FALSE 27 <2> ; 28 <2> IBMVER EQU TRUE 29 <2> IBMCOPYRIGHT EQU FALSE 30 <2> 31 <2> BUFFERFLAG EQU ~ IBMCOPYRIGHT 32 <2> 33 <2> %ifndef MSVER 34 <2> MSVER EQU ~ IBMVER 35 <2> %endif 36 <2> IBM EQU IBMVER 37 <2> ; 38 <2> ; 39 <2> %IF IBMVER 40 <2> %IF IBMCOPYRIGHT 41 <2> %warning out: ... IBM version build switch on ... 42 <2> %ELSE 43 <2> %warning out: ... CLONE version build switch on ... 43 ****************** <2> warning: out: ... CLONE version build switch on ... [-w+user] 44 <2> %ENDIF 45 <2> %ELSE 46 <2> %IFN IBMCOPYRIGHT 47 <2> %warning out: ... MS version build switch on ... 48 <2> %ELSE 49 <2> %warning out: !!!!!!!!! VERSION SWITCHES SET INCORECTLY !!!!!!!!! 50 <2> %warning out: !!!!!!!!! CHECK SETTINGS IN INC\VERSION.INC !!!!!!!!! 51 <2> %ENDIF 52 <2> %ENDIF 53 <2> ; 54 <2> ; 55 <2> ;*************************************************************************** 56 <2> ;* The following switches are for DBCS or SBCS support * 57 <2> ;* * 58 <2> ;* Set INTERNAT EQU TRUE FOR DBCS * 59 <2> ;* Set INTERNAT EQU FALSE FOR SBCS * 60 <2> ;* * 61 <2> ;*************************************************************************** 62 <2> ; 63 <2> IBMJAPVER EQU FALSE ;If TRUE set KANJI true also 64 <2> 65 <2> ; 66 <2> ; Switch INTERNAT for DBCS support 67 <2> ; 68 <2> INTERNAT EQU FALSE 69 <2> ; 70 <2> %IF INTERNAT 71 <2> %ifndef KANJI 72 <2> KANJI EQU TRUE 73 <2> %endif 74 <2> IBMJAPAN EQU TRUE 75 <2> %ELSE 76 <2> %ifndef KANJI 77 <2> KANJI EQU FALSE 78 <2> %endif 79 <2> IBMJAPAN EQU FALSE 80 <2> %ENDIF 81 <2> 82 <2> %ifndef altvect ; avoid jerking off vector.inc 83 <2> ALTVECT EQU FALSE ;Switch to build ALTVECT version 84 <2> %endif 85 <2> 86 <2> ; 87 <2> ; Country code switches 88 <2> ; The default contry code is assumed as USA. 89 <2> ; 90 <2> %IF INTERNAT 91 <2> KOREA EQU TRUE 92 <2> JAPAN EQU FALSE 93 <2> %ELSE 94 <2> KOREA EQU FALSE 95 <2> JAPAN EQU FALSE 96 <2> %ENDIF 97 <2> ; 98 <2> %IF INTERNAT 99 <2> %warning out: Internat(ECS) version build switch on 100 <2> %ENDIF 85 <1> %include "lmacros2.mac" 1 <2> [list -] 86 <1> %include "memsw.mac" 1 <2> %define LDOSMEM 1 87 <1> %include "entryseg.nas" 1 <2> 2 <2> %ifndef ENTRYSEGNAS 3 <2> %define ENTRYSEGNAS 1 4 <2> 5 <2> %include "lmacros3.mac" 6 <2> === Switch to base=000000h -> "DOSENTRY" 7 <2> addsection DOSENTRY, class=%[DOSENTRY] 8 <2> 9 <2> group DOSENTRYGROUP DOSENTRY 10 <2> 11 <2> %endif 88 <1> 89 <1> I_Need Temp_Var2,WORD ;AN000;file type from $open 90 <1> I_Need Special_Entries,WORD ;AN007;address of special entries 91 <1> I_Need Special_Version,WORD ;AN007;special version number 92 <1> I_Need Fake_Count,BYTE ;AN008;fake version count 93 <1> I_need User_SS,WORD 94 <1> I_need User_SP,WORD 95 <1> I_need NSS,WORD 96 <1> I_need NSP,WORD 97 <1> extern restore_world 98 <1> 99 <1> %ifndef BUF2 100 <1> %IF BUFFERFLAG 101 <1> extrn restore_user_map:near 102 <1> %ENDIF 103 <1> %endif 104 <1> === Switch to base=000E10h -> "DOSDATATABLE" 105 <1> section DOSDATATABLE ; in DOSDATA 106 <1> 107 <1> align 2, db ? 0 00001218 ???? exec_init_SP DW ? 0 0000121A ???? exec_init_SS DW ? 0 0000121C ???? exec_init_IP DW ? 0 0000121E ???? exec_init_CS DW ? 112 <1> 113 <1> exec_internal_buffer EQU OpenBuf 114 <1> 0 00001220 ???? exec_signature DW ? ; must contain 4D5A (yay zibo!) 0 00001222 ???? exec_len_mod_512 DW ? ; low 9 bits of length 0 00001224 ???? exec_pages DW ? ; number of 512b pages in file 0 00001226 ???? exec_rle_count DW ? ; count of reloc entries 0 00001228 ???? exec_par_dir DW ? ; number of paragraphs before image 0 0000122A ???? exec_min_BSS DW ? ; minimum number of para of BSS 0 0000122C ???? exec_max_BSS DW ? ; max number of para of BSS 0 0000122E ???? exec_SS DW ? ; stack of image 0 00001230 ???? exec_SP DW ? ; SP of image 0 00001232 ???? exec_chksum DW ? ; checksum of file (ignored) 0 00001234 ???? exec_IP DW ? ; IP of entry 0 00001236 ???? exec_CS DW ? ; CS of entry 0 00001238 ???? exec_rle_table DW ? ; byte offset of reloc table 128 <1> Exec_Signature equ exec_signature ; NASM port label 129 <1> Exec_header_len EQU $-Exec_Signature 130 <1> 131 <1> curdirLEN equ curdirLen ; NASM port equate 132 <1> exec_internal_buffer_size EQU (128+128+53+curdirLEN) 133 <1> %warning out: Please make sure that the following are contiguous and of the 133 ****************** <1> warning: out: Please make sure that the following are contiguous and of the [-w+user] 134 <1> %warning out: following sizes: 134 ****************** <1> warning: out: following sizes: [-w+user] 135 <1> %warning out: 135 ****************** <1> warning: out: [-w+user] 136 <1> %warning out: OpenBuf 128 136 ****************** <1> warning: out: OpenBuf 128 [-w+user] 137 <1> %warning out: RenBuf 128 137 ****************** <1> warning: out: RenBuf 128 [-w+user] 138 <1> %warning out: SearchBuf 53 138 ****************** <1> warning: out: SearchBuf 53 [-w+user] 139 <1> %warning out: DummyCDS CurDirLen 139 ****************** <1> warning: out: DummyCDS CurDirLen [-w+user] 140 <1> === Switch to base=002450h -> "DOSCODECODE" 141 <1> section DOSCODECODE ; TABLE ENDS 142 <1> 143 <1> ;.sall 144 <1> 145 <1> assume nocheck, ss:DOSGROUP 146 <1> 147 <1> procedure D_Exec,NEAR 147 ****************** <1> warning: proc D_Exec... [-w+user] 0 00006178 3C85 cmp al, 85h 0 0000617A 7404 je .state 0 0000617C 3C05 cmp al, 5 0 0000617E 752C jne @F 152 <1> .state: 0 00006180 E8[0000] call SYS_RET_OK ; NC in iret fl 154 <1> 155 <1> ; the following copied from disp.nas 0 00006183 FA CLI 0 00006184 16 push ss 0 00006185 1F pop ds ; ds => DOSDATA, overwritten soon 159 <1> assume ds:DOSGROUP 160 <1> user_SP equ User_SP ; NASM port label 161 <1> user_SS equ User_SS ; NASM port label 0 00006186 8B2E[0000] MOV BP, [user_SP] ; -> user stack 0 0000618A 8E16[0000] MOV SS, [user_SS] 0 0000618E 89EC MOV SP, bp ; restore user stack 165 <1> assume ss:nothing 0 00006190 884600 MOV BYTE PTR [BP + user_AX],AL 0 00006193 A1[0000] MOV AX, [NSP] 0 00006196 A3[0000] MOV [user_SP], AX 0 00006199 A1[0000] MOV AX, [NSS] 0 0000619C A3[0000] MOV [user_SS], AX 0 0000619F FE0E[0000] DEC byte [INDOS] 0 000061A3 E8[0000] CALL restore_world ; restore all registers 173 <1> assume ds:nothing, es:nothing 0 000061A6 31C0 xor ax, ax 0 000061A8 50 push ax 0 000061A9 E9B204 jmp do_a20_off_ax_on_stack 177 <1> 178 <1> @@: 179 <1> assume ss:DOSGROUP 180 <1> ASSUME DS:NOTHING, ES:NOTHING 181 <1> PUBLIC EXEC001S,EXEC001E 182 <1> EXEC001S: 183 <1> LocalVar exec_blk,DWORD 184 <1> LocalVar exec_func,BYTE 185 <1> LocalVar exec_load_high,BYTE 186 <1> LocalVar exec_fh,WORD 187 <1> LocalVar exec_rel_fac,WORD 188 <1> LocalVar exec_res_len_para,WORD 189 <1> LocalVar exec_environ,WORD 190 <1> LocalVar exec_size,WORD 191 <1> LocalVar exec_load_block,WORD 192 <1> LocalVar exec_dma,WORD 193 <1> LocalVar execNameLen,WORD 194 <1> LocalVar execName,DWORD 195 <1> EXEC001E: 0 000061AC 5589E583EC1A Enter 197 <1> ; 198 <1> ; validate function 199 <1> ; 200 <1> 0 000061B2 8846FB MOV [exec_func],AL 202 <1> 0 000061B5 247F and al, 7Fh ; normalise from FreeDOS extension 0 000061B7 3C03 CMP AL,3 ; only 0, 1 or 3 are allowed 0 000061B9 760E Jbe exec_check_2 206 <1> 207 <1> exec_bad_fun: 0 000061BB 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLOC_Unk ; Extended Error Locus 0 000061C1 B001 mov al,error_invalid_function 210 <1> 211 <1> exec_ret_err: 0 000061C3 89EC5D Leave 0 000061C6 E9[0000] transfer SYS_RET_ERR 214 <1> 215 <1> exec_check_2: 0 000061C9 3C02 CMP AL,2 0 000061CB 74EE je exec_bad_fun 218 <1> 0 000061CD 895EFC MOV [exec_blkL],BX ; stash args 0 000061D0 8C46FE MOV [exec_blkH],ES 0 000061D3 C646FA00 MOV byte [exec_load_high],0 222 <1> ; 223 <1> ; set up length of exec name 224 <1> ; 0 000061D7 8956E6 MOV [execNameL],DX 0 000061DA 8C5EE8 MOV [execNameH],DS 0 000061DD 89D6 MOV SI,DX ; move pointer to convenient place 0 000061DF E8[0000] invoke DStrLen 0 000061E2 894EEA MOV [ExecNameLen],CX ; save length 230 <1> 0 000061E5 30C0 XOR AL,AL ; open for reading 0 000061E7 55 PUSH BP 0 000061E8 E8[0000] invoke D_OPEN ; is the file there? 0 000061EB 5D POP BP 0 000061EC 72D5 JC exec_ret_err 236 <1> ;File Type Checking 237 <1> ; CMP BYTE PTR [Temp_Var2],EAEXISTING ;AN000;;FT. old file ? 238 <1> ; JZ oldexf ;AN000;;FT. yes 239 <1> ; TEST BYTE PTR EXEC_FUNC,EXEC_FUNC_OVERLAY ;AN000;;FT. exec overlay? 240 <1> ; JNZ exovrly ;AN000;;FT. yes 241 <1> ; CMP BYTE PTR [Temp_Var2],EAEXECUTABLE ;AN000;;FT. only file type 242 <1> ; JZ oldexf ;AN000;;FT. 3 & 4 will pass 243 <1> ; CMP BYTE PTR [Temp_Var2],EAINSTALLABLE ;AN000;;FT. 244 <1> ; JZ oldexf ;AN000;;FT. 245 <1> ;exerr: ;AN000;;FT. 246 <1> ; MOV AL,error_access_denied ;AN000;;FT. error 247 <1> ; JMP exec_ret_err ;AN000;;FT. 248 <1> ;exovrly: ;AN000;;FT. 249 <1> ; CMP BYTE PTR [Temp_Var2],EAOVERLAY ;AN000;;FT. only 5,6,7 pass 250 <1> ; JZ oldexf ;AN000;;FT. 251 <1> ; CMP BYTE PTR [Temp_Var2],EADEV_DRIVER ;AN000;;FT. 252 <1> ; JZ oldexf ;AN000;;FT. 253 <1> ; CMP BYTE PTR [Temp_Var2],EAIFS_DRIVER ;AN000;;FT. 254 <1> ; JNZ exerr ;AN000;;FT. 255 <1> ; 256 <1> ;oldexf: ;AN000; 257 <1> ;File Type Checking 258 <1> 0 000061EE 8946F8 MOV [exec_fh],AX 0 000061F1 89C3 MOV BX,AX 0 000061F3 30C0 XOR AL,AL 0 000061F5 E8[0000] invoke D_IOCTL 0 000061F8 7207 JC Exec_bombJ 0 000061FA F6C280 TEST DL,devid_ISDEV 0 000061FD 740A JZ exec_check_environ 0 000061FF B002 MOV AL,error_file_not_found 267 <1> Exec_bombJ: 268 <1> Exec_Bomb equ exec_bomb ; NASM port label 0 00006201 E9D800 JMP Exec_Bomb 270 <1> 271 <1> BadEnv: 0 00006204 B00A MOV AL,error_bad_environment 0 00006206 E9D300 JMP exec_bomb 274 <1> 275 <1> exec_check_environ: 0 00006209 8366EE00 and word [exec_load_block],0 0 0000620D 8366F200 and word [exec_environ],0 278 <1> 0 00006211 F646FB02 TEST BYTE [exec_func],exec_func_overlay ; overlays... no environment 0 00006215 7561 JNZ exec_read_header 0 00006217 C576FC LDS SI,[exec_blk] ; get block 282 <1> assume ds:nothing 0 0000621A 8B04 MOV AX,[SI + Exec1_environ] ; address of environ 0 0000621C 09C0 OR AX,AX 0 0000621E 750F JNZ exec_scan_env 0 00006220 368E1E[0000] MOV DS,[ss:CurrentPDB] 287 <1> assume ds:PSP 0 00006225 A12C00 MOV AX,[PDB_environ] 0 00006228 8946F2 MOV [exec_environ],AX 0 0000622B 09C0 OR AX,AX 0 0000622D 7449 JZ exec_read_header 292 <1> 293 <1> exec_scan_env: 0 0000622F 8EC0 MOV ES,AX 295 <1> assume es:nothing 0 00006231 31FF XOR DI,DI 0 00006233 B9FF7F MOV CX,07FFFh ; at most 32k of environment 0 00006236 30C0 XOR AL,AL 299 <1> 300 <1> exec_get_environ_len: 0 00006238 F2AE REPNZ SCASB ; find that nul byte 0 0000623A 75C8 JNZ BadEnv 0 0000623C 49 DEC CX ; Dec CX for the next nul byte test 0 0000623D 74C5 jz BadEnv ; gone beyond the end of the environment 0 0000623F AE SCASB ; is there another nul byte? 0 00006240 75F6 JNZ exec_get_environ_len ; no, scan some more 0 00006242 57 PUSH DI 0 00006243 8D5D11 LEA BX,[DI+0Fh+2] 0 00006246 035EEA ADD BX,[ExecNameLen] ; BX <- length of environment 310 <1> ; remember argv[0] length 311 <1> ; round up and remember argc 0 00006249 B104 MOV CL,4 0 0000624B D3EB SHR BX,CL ; number of paragraphs needed 0 0000624D 06 PUSH ES 315 <1> %ifdef LDOSMEM 0 0000624E E8[0000] EnterCrit critMem 0 00006251 E8AF00 call get_flags 0 00006254 E8[0000] call AllocateMCBCompatible.flags_cx 0 00006257 E8[0000] LeaveCrit critMem 320 <1> %else 321 <1> invoke D_ALLOC ; can we get the space? 322 <1> %endif 0 0000625A 1F POP DS 324 <1> assume ds:nothing 0 0000625B 59 POP CX 0 0000625C 7303 JNC exec_save_environ 0 0000625E EB76 JMP exec_no_mem ; nope... cry and sob 0 00006260 90 nop ; identicalise 329 <1> 330 <1> exec_save_environ: 0 00006261 8EC0 MOV ES,AX 332 <1> assume es:nothing 0 00006263 8946F2 MOV [exec_environ],AX ; save him for a rainy day 0 00006266 31F6 XOR SI,SI 0 00006268 89F7 MOV DI,SI 0 0000626A F3A4 REP MOVSB ; copy the environment 0 0000626C B80100 MOV AX,1 0 0000626F AB STOSW 0 00006270 C576E6 LDS SI,[execName] 0 00006273 8B4EEA MOV CX,[execNameLen] 0 00006276 F3A4 REP MOVSB 342 <1> 343 <1> exec_read_header: 344 <1> ; 345 <1> ; We read in the program header into the above data area and determine 346 <1> ; where in this memory the image will be located. 347 <1> ; 0 00006278 161F Context DS 349 <1> exec_header_len equ Exec_header_len ; NASM port equate 0 0000627A B91A00 MOV CX,exec_header_len ; header size 0 0000627D BA[0800] MOV DX,OFFSET exec_signature wrt DOSGROUP 0 00006280 06 PUSH ES 0 00006281 1E PUSH DS 0 00006282 E8DF03 CALL ExecRead 0 00006285 1F POP DS 0 00006286 07 POP ES 357 <1> assume ds:DOSGROUP, es:nothing 0 00006287 7251 JC exec_bad_file 0 00006289 85C0 test AX,AX 0 0000628B 744D JZ exec_bad_file 0 0000628D 83F81A CMP AX,exec_header_len ; did we read the right number? 0 00006290 7519 JNZ exec_com_filej ; yep... continue 0 00006292 F706[1400]FFFF TEST word [exec_max_BSS],-1 ; indicate load high? 0 00006298 7504 JNZ exec_check_sig 0 0000629A C646FAFF MOV byte [exec_load_high],-1 366 <1> exec_check_sig: 0 0000629E A1[0800] MOV AX,[exec_signature] 0 000062A1 3D4D5A CMP AX,exe_valid_signature ; zibo arises! 0 000062A4 7408 JZ exec_save_start ; assume com file if no signature 0 000062A6 3D5A4D CMP AX,exe_valid_old_signature ; zibo arises! 0 000062A9 7403 JZ exec_save_start ; assume com file if no signature 372 <1> 373 <1> exec_com_filej: 0 000062AB E9AC01 JMP exec_com_file 375 <1> 376 <1> ; 377 <1> ; We have the program header... determine memory requirements 378 <1> ; 379 <1> exec_save_start: 0 000062AE A1[0C00] MOV AX,[exec_pages] ; get 512-byte pages 0 000062B1 B105 MOV CL,5 ; convert to paragraphs 0 000062B3 D3E0 SHL AX,CL 0 000062B5 2B06[1000] SUB AX,[exec_par_dir] ; AX = size in paragraphs 0 000062B9 8946F4 MOV [exec_res_len_para],AX 385 <1> 386 <1> ; 387 <1> ; Do we need to allocate memory? Yes if function is not load-overlay 388 <1> ; 0 000062BC F646FB02 TEST BYTE [exec_func],exec_func_overlay 0 000062C0 7452 JZ exec_allocate ; allocation of space 391 <1> ; 392 <1> ; get load address from block 393 <1> ; 0 000062C2 C47EFC LES DI,[exec_blk] 395 <1> exec3_load_addr equ Exec3_load_addr ; NASM port equate 0 000062C5 268B05 MOV AX,[ES:DI + exec3_load_addr] 0 000062C8 8946EC MOV [exec_dma],AX 398 <1> exec3_reloc_fac equ Exec3_reloc_fac ; NASM port equate 0 000062CB 268B4502 MOV AX,[ES:DI + exec3_reloc_fac] 0 000062CF 8946F6 MOV [exec_rel_fac],AX 0 000062D2 E9BC00 JMP exec_find_res 402 <1> 403 <1> exec_no_mem_pop: 0 000062D5 58 pop ax 405 <1> exec_no_mem: 0 000062D6 B008 MOV AL,error_not_enough_memory 0 000062D8 EB02 JMP SHORT exec_bomb 408 <1> 409 <1> exec_bad_file: 0 000062DA B00B MOV AL,error_bad_format 411 <1> 412 <1> exec_bomb: 413 <1> ASSUME DS:NOTHING,ES:NOTHING 0 000062DC 8B5EF8 MOV BX,[exec_fh] 0 000062DF E89103 CALL exec_dealloc 0 000062E2 E8[0000] LeaveCrit CritMem 0 000062E5 5055 SaveReg 0 000062E7 E8[0000] invoke D_CLOSE 0 000062EA 5D58 RestoreReg 420 <1> Exec_Ret_Err equ exec_ret_err ; NASM port label 0 000062EC E9D4FE JMP Exec_Ret_Err 422 <1> 423 <1> %ifdef LDOSMEM 424 <1> extern GetMCBOwner, GetMCBFlags, AllocateLargestMCBRandom, GetRawMCBFlags 425 <1> extern AllocateMCBCompatible.flags_cx 426 <1> 427 <1> allocate_largest: 0 000062EF E8[0000] EnterCrit critMem 0 000062F2 51 push cx 0 000062F3 52 push dx 0 000062F4 E8[0000] call GetMCBOwner ; dx = owner 0 000062F7 E80900 call get_flags 0 000062FA E8[0000] call AllocateLargestMCBRandom ; call two-area allocation 0 000062FD 5A pop dx 0 000062FE 59 pop cx 0 000062FF E8[0000] LeaveCrit critMem 0 00006302 C3 retn 438 <1> 439 <1> get_flags: 0 00006303 E8[0000] call GetMCBFlags ; cx = fixed flags 0 00006306 F646FB80 test byte [exec_func], 80h ; FreeDOS extension to use UMA ? 0 0000630A 7407 jz .not_force_uma ; no, use current flags --> 0 0000630C E8[0000] call GetRawMCBFlags 0 0000630F 81C98001 or cx, 180h ; 100h = ignore UMB link status, 445 <1> ; 80h = UMA then LMA, dual areas 446 <1> ; (80h overrides all lesser areas) 447 <1> .not_force_uma: 0 00006313 C3 retn 449 <1> %endif 450 <1> 451 <1> exec_allocate: 452 <1> DOSAssume CS,,"EXEC/exec_allocate" 453 <1> %ifdef LDOSMEM 0 00006314 50 push ax 0 00006315 83C010 add ax, 10h 0 00006318 89C3 mov bx, ax 0 0000631A 720C jc .max_ffff 0 0000631C F646FAFF TEST byte [exec_load_high],-1 ; if load high, use max 0 00006320 7506 JNZ .max_ffff ; use max 0 00006322 0306[1400] add ax, [exec_max_BSS] 0 00006326 7303 jnc @F 462 <1> .max_ffff: 0 00006328 B8FFFF mov ax, -1 464 <1> @@: 0 0000632B 031E[1200] add bx, [exec_min_BSS] 0 0000632F 7303 jnc @F 0 00006331 BBFFFF mov bx, -1 468 <1> @@: 0 00006334 1E push ds 0 00006335 E8B7FF call allocate_largest 0 00006338 1F pop ds 472 <1> assume ds:DOSGROUP 0 00006339 729A jc exec_no_mem_pop 0 0000633B 8946EE MOV [exec_load_block],AX 0 0000633E 58 pop ax 476 <1> %else 477 <1> PUSH AX 478 <1> MOV BX,0FFFFh ; see how much room in arena 479 <1> PUSH DS 480 <1> invoke D_ALLOC ; should have carry set and BX has max 481 <1> POP DS 482 <1> assume ds:DOSGROUP 483 <1> POP AX 484 <1> %endif 0 0000633F 83C010 ADD AX,10h ; room for header 0 00006342 83FB11 CMP BX,11h ; enough room for a header 0 00006345 728F JB exec_no_mem 0 00006347 39D8 CMP AX,BX ; is there enough for bare image? 0 00006349 778B JA exec_no_mem 0 0000634B F646FAFF TEST byte [exec_load_high],-1 ; if load high, use max 0 0000634F 751E JNZ exec_BX_max ; use max 0 00006351 0306[1200] ADD AX,[exec_min_BSS] ; go for min allocation 0 00006355 7303E97CFF JC exec_no_mem ; oops! carry 0 0000635A 39D8 CMP AX,BX ; enough space? 0 0000635C 7603E975FF JA exec_no_mem ; nope... 0 00006361 2B06[1200] SUB AX,[exec_min_BSS] 0 00006365 0306[1400] ADD AX,[exec_max_BSS] ; go for the MAX 0 00006369 7204 JC exec_BX_max 0 0000636B 39D8 CMP AX,BX 0 0000636D 7602 JBE exec_got_block 501 <1> 502 <1> exec_BX_max: 0 0000636F 89D8 MOV AX,BX 504 <1> 505 <1> exec_got_block: 0 00006371 89C3 MOV BX,AX 0 00006373 895EF0 MOV [exec_size],BX 508 <1> %ifdef LDOSMEM 0 00006376 8B46EE MOV ax, [exec_load_block] 510 <1> %else 511 <1> PUSH DS 512 <1> invoke D_ALLOC ; get the space 513 <1> POP DS 514 <1> JC exec_no_mem 515 <1> MOV [exec_load_block],AX 516 <1> %endif 0 00006379 83C010 ADD AX,10h 0 0000637C F646FAFF TEST byte [exec_load_high],-1 0 00006380 7409 JZ exec_use_ax ; use ax for load info 0 00006382 0346F0 ADD AX,[exec_size] ; go to end 0 00006385 2B46F4 SUB AX,[exec_res_len_para] ; drop off header 0 00006388 83E810 SUB AX,10h ; drop off pdb 523 <1> exec_use_ax: 0 0000638B 8946F6 MOV [exec_rel_fac],AX ; new segment 0 0000638E 8946EC MOV [exec_dma],AX ; beginning of dma 526 <1> 527 <1> ; 528 <1> ; Determine the location in the file of the beginning of the resident 529 <1> ; 530 <1> exec_find_res: 0 00006391 8B16[1000] MOV DX,[exec_par_dir] 0 00006395 52 PUSH DX 0 00006396 B104 MOV CL,4 0 00006398 D3E2 SHL DX,CL ; low word of location 0 0000639A 58 POP AX 0 0000639B B10C MOV CL,12 0 0000639D D3E8 SHR AX,CL ; high word of location 0 0000639F 89C1 MOV CX,AX ; CX <- high 539 <1> 540 <1> ; 541 <1> ; Read in the resident image (first, seek to it) 542 <1> ; 0 000063A1 8B5EF8 MOV BX,[exec_fh] 0 000063A4 1E PUSH DS 0 000063A5 30C0 XOR AL,AL 0 000063A7 E8[0000] invoke D_LSEEK ; seek to resident 0 000063AA 1F POP DS 548 <1> assume ds:DOSGROUP 0 000063AB 7303 jnc exec_big_read 0 000063AD E92CFF jmp exec_bomb 551 <1> 552 <1> exec_big_read: ; Read resident into memory 0 000063B0 8B5EF4 MOV BX,[exec_res_len_para] 0 000063B3 81FB0010 CMP BX,1000h ; too many bytes to read? 0 000063B7 7203 JB exec_read_ok 0 000063B9 BBE00F MOV BX,0FE0h ; max in one chunk FE00 bytes 557 <1> 558 <1> exec_read_ok: 0 000063BC 295EF4 SUB [exec_res_len_para],BX ; we read (soon) this many 0 000063BF 53 PUSH BX 0 000063C0 B104 MOV CL,4 0 000063C2 D3E3 SHL BX,CL ; get count in bytes from paras 0 000063C4 89D9 MOV CX,BX ; count in correct register 0 000063C6 1E PUSH DS 0 000063C7 8E5EEC MOV DS,[exec_dma] ; Set up read buffer 566 <1> ASSUME DS:NOTHING 0 000063CA 31D2 XOR DX,DX 0 000063CC 51 PUSH CX ; save our count 0 000063CD E89402 CALL ExecRead 0 000063D0 59 POP CX ; get old count to verify 0 000063D1 1F POP DS 572 <1> assume ds:DOSGROUP 573 <1> exec_bad_fileJ equ exec_bad_filej ; NASM port label 0 000063D2 7248 JC exec_bad_fileJ 575 <1> DOSAssume CS,,"EXEC/exec_read_ok" 0 000063D4 39C1 CMP CX,AX ; did we read enough? 0 000063D6 5B POP BX ; get paragraph count back 578 <1> execCheckEnd equ ExecCheckEnd ; NASM port label 0 000063D7 7408 JZ execCheckEnd ; and do reloc if no more to read 580 <1> ; 581 <1> ; The read did not match the request. If we are off by 512 bytes or more 582 <1> ; then the header lied and we have an error. 583 <1> ; 0 000063D9 29C1 SUB CX,AX 0 000063DB 81F90002 CMP CX,512 586 <1> Exec_Bad_fileJ equ exec_bad_filej ; NASM port label 0 000063DF 733B JAE Exec_Bad_fileJ 588 <1> ; 589 <1> ; We've read in CX bytes... bump DTA location 590 <1> ; 591 <1> ExecCheckEnd: 0 000063E1 015EEC ADD [exec_dma],BX ; bump dma address 0 000063E4 F746F4FFFF TEST word [exec_res_len_para],-1 0 000063E9 75C5 JNZ exec_big_read 595 <1> ; 596 <1> ; The image has now been read in. We must perform relocation to 597 <1> ; the current location. 598 <1> ; 599 <1> exec_do_reloc: 0 000063EB 8B4EF6 MOV CX,[exec_rel_fac] 0 000063EE A1[1600] MOV AX,[exec_SS] ; get initial SS 0 000063F1 01C8 ADD AX,CX ; and relocate him 0 000063F3 A3[0200] MOV [exec_init_SS],AX 604 <1> 0 000063F6 A1[1800] MOV AX,[exec_SP] ; initial SP 0 000063F9 A3[0000] MOV [exec_init_SP],AX 607 <1> 0 000063FC C406[1C00] LES AX,[exec_IP] 609 <1> assume es:nothing 0 00006400 A3[0400] MOV [exec_init_IP],AX 0 00006403 8CC0 MOV AX,ES 0 00006405 01C8 ADD AX,CX ; relocated... 0 00006407 A3[0600] MOV [exec_init_CS],AX 614 <1> 0 0000640A 31C9 XOR CX,CX 0 0000640C 8B16[2000] MOV DX,[exec_rle_table] 0 00006410 8B5EF8 MOV BX,[exec_fh] 0 00006413 1E PUSH DS 0 00006414 31C0 XOR AX,AX 0 00006416 E8[0000] invoke D_LSEEK 0 00006419 1F POP DS 622 <1> assume ds:DOSGROUP 623 <1> 0 0000641A 7303 JNC exec_get_entries 625 <1> exec_bad_filej: 0 0000641C E9BBFE JMP exec_bad_file 627 <1> 628 <1> exec_get_entries: 0 0000641F 8B16[0E00] MOV DX,[exec_rle_count] ; Number of entries left 630 <1> 631 <1> exec_read_reloc: 632 <1> ASSUME DS:NOTHING 0 00006423 52 PUSH DX 0 00006424 BA[0000] MOV DX,OFFSET exec_internal_buffer wrt DOSGROUP 0 00006427 B98C01 MOV CX,((exec_internal_buffer_size)/4)*4 0 0000642A 1E PUSH DS 0 0000642B E83602 CALL ExecRead 0 0000642E 07 POP ES 639 <1> assume es:nothing 0 0000642F 5A POP DX 0 00006430 72EA JC exec_bad_filej 0 00006432 B96300 MOV CX,(exec_internal_buffer_size)/4 0 00006435 BF[0000] MOV DI,OFFSET exec_internal_buffer wrt DOSGROUP ; Pointer to byte location in header 644 <1> ; 645 <1> ; Relocate a single address 646 <1> ; 0 00006438 8B76F6 MOV SI,[exec_rel_fac] 648 <1> 649 <1> exec_reloc_one: 0 0000643B 85D2 test DX,DX ; Any more entries? 0 0000643D 7415 JE exec_set_PDBJ 652 <1> 653 <1> exec_get_addr: 0 0000643F 26C51D LDS BX,[ES:DI] ; Get ra/sa of entry 655 <1> assume ds:nothing 0 00006442 8CD8 MOV AX,DS ; Relocate address of item 0 00006444 01F0 ADD AX,SI 0 00006446 8ED8 MOV DS,AX 659 <1> assume ds:nothing 0 00006448 0137 ADD [BX],SI 0 0000644A 83C704 ADD DI,4 0 0000644D 4A DEC DX 0 0000644E E2EB LOOP exec_reloc_one ; End of internal buffer? 664 <1> 665 <1> ; 666 <1> ; We've exhausted a single buffer's worth. Read in the next piece 667 <1> ; of the relocation table. 668 <1> ; 669 <1> 0 00006450 06 PUSH ES 0 00006451 1F POP DS 672 <1> assume ds:nothing 0 00006452 EBCF JMP exec_read_reloc 674 <1> 675 <1> exec_set_PDBJ: 0 00006454 E9A600 JMP exec_set_PDB 677 <1> 678 <1> exec_no_memj: 0 00006457 E97CFE JMP exec_no_mem 680 <1> 681 <1> ; 682 <1> ; we have a .COM file. First, determine if we are merely loading an overlay. 683 <1> ; 684 <1> exec_com_file: 0 0000645A F646FB02 TEST BYTE [exec_func],exec_func_overlay 0 0000645E 740C JZ exec_alloc_com_file 0 00006460 C576FC LDS SI,[exec_blk] ; get arg block 0 00006463 AD LODSW ; get load address 0 00006464 8946EC MOV [exec_dma],AX 0 00006467 B8FFFF MOV AX,0FFFFh 0 0000646A EB46 JMP SHORT exec_read_block ; read it all! 692 <1> 693 <1> ; We must allocate the max possible size block (ick!) and set up 694 <1> ; CS=DS=ES=SS=PDB pointer, IP=100, SP=max size of block. 695 <1> ; 696 <1> exec_alloc_com_file: 697 <1> %ifdef LDOSMEM 0 0000646C 8B5EF8 mov bx, [exec_fh] 0 0000646F 31C9 xor cx, cx 0 00006471 31D2 xor dx, dx 0 00006473 B80200 mov ax, 2 ; seek to EOF 0 00006476 E8[0000] invoke D_LSEEK ; get file size 0 00006479 85D2 test dx, dx ; >= 64 KiB ? 0 0000647B 75DA jnz exec_no_memj ; yes, too much --> 0 0000647D 3D00FF cmp ax, 0FF00h ; >= 0FF00h ? 0 00006480 73D5 jae exec_no_memj ; too much --> 0 00006482 83C00F add ax, 15 ; round up 0 00006485 B104 mov cl, 4 0 00006487 D3E8 shr ax, cl ; to paragraphs 0 00006489 83C010 add ax, 10h ; add in PSP size 0 0000648C 93 xchg bx, ax ; bx = minimum size 0 0000648D B8FFFF mov ax, -1 ; maximum size = largest 0 00006490 E85CFE call allocate_largest 0 00006493 72C2 jc exec_no_memj 0 00006495 895EF0 MOV [exec_size],BX ; save size of allocation block 716 <1> %else 717 <1> MOV BX,0FFFFh 718 <1> invoke D_ALLOC ; largest piece available as error 719 <1> OR BX,BX 720 <1> JZ exec_no_memj 721 <1> MOV [exec_size],BX ; save size of allocation block 722 <1> PUSH BX 723 <1> invoke D_ALLOC ; largest piece available as error 724 <1> POP BX ; get size of block... 725 <1> %endif 0 00006498 8946EE MOV [exec_load_block],AX 0 0000649B 83C010 ADD AX,10h ; increment for header 0 0000649E 8946EC MOV [exec_dma],AX 0 000064A1 31C0 XOR AX,AX ; presume 64K read... 0 000064A3 81FB0010 CMP BX,1000h ; 64k or more in block? 0 000064A7 7306 JAE exec_read_com ; yes, read only 64k 0 000064A9 89D8 MOV AX,BX ; convert size to bytes 0 000064AB B104 MOV CL,4 0 000064AD D3E0 SHL AX,CL 735 <1> exec_read_com: 0 000064AF 2D0001 SUB AX,100h ; remember size of psp 737 <1> exec_read_block: 0 000064B2 50 PUSH AX ; save number to read 0 000064B3 8B5EF8 MOV BX,[exec_fh] ; of com file 0 000064B6 31C9 XOR CX,CX ; but seek to 0:0 0 000064B8 89CA MOV DX,CX 0 000064BA 31C0 XOR AX,AX ; seek relative to beginning 0 000064BC E8[0000] invoke D_LSEEK ; back to beginning of file 0 000064BF 59 POP CX ; number to read 0 000064C0 8E5EEC MOV DS,[exec_dma] 746 <1> assume ds:nothing 0 000064C3 31D2 XOR DX,DX 0 000064C5 51 PUSH CX 0 000064C6 E89B01 CALL ExecRead 0 000064C9 5E POP SI ; get number of bytes to read 0 000064CA 7303 jnc OkRead 0 000064CC E90BFE jmp exec_bad_file 753 <1> OkRead: 0 000064CF 39F0 CMP AX,SI ; did we read them all? 0 000064D1 7484 JZ exec_no_memj ; exactly the wrong number... no memory 0 000064D3 F646FB02 TEST BYTE [exec_func],exec_func_overlay 0 000064D7 7524 JNZ exec_set_PDB ; no starto, chumo! 0 000064D9 8B46EC MOV AX,[exec_DMA] 0 000064DC 83E810 SUB AX,10h 0 000064DF 36A3[0600] MOV [ss:exec_init_CS],AX 0 000064E3 36C706[0400]0001 MOV word [ss:exec_init_IP],100h ; initial IP is 100 762 <1> ; 763 <1> ; SI is at most FF00h. Add FE to account for PSP - word of 0 on stack. 764 <1> ; 0 000064EA 81C6FE00 ADD SI,0FEh ; make room for stack 0 000064EE 368936[0000] MOV [ss:exec_init_SP],SI ; max value for read is also SP! 0 000064F3 36A3[0200] MOV [ss:exec_init_SS],AX 0 000064F7 8ED8 MOV DS,AX 769 <1> assume ds:nothing 0 000064F9 C7040000 MOV WORD PTR [SI],0 ; 0 for return 771 <1> 772 <1> exec_set_PDB: 0 000064FD 8B5EF8 MOV BX,[exec_fh] ; we are finished with the file. 0 00006500 E87001 CALL exec_dealloc 0 00006503 55 PUSH BP 0 00006504 E8[0000] invoke D_CLOSE ; release the jfn 0 00006507 5D POP BP 0 00006508 E87401 CALL exec_alloc 0 0000650B F646FB02 TEST BYTE [exec_func],exec_func_overlay 0 0000650F 740C JZ exec_build_header 0 00006511 E89801 CALL Scan_Execname ;MS.;AN007; 0 00006514 E8AC01 CALL Scan_Special_Entries ;MS.;AN007; 0 00006517 89EC5D Leave 0 0000651A E9[0000] transfer SYS_RET_OK ; overlay load -> done 785 <1> 786 <1> exec_build_header: 0 0000651D 8B56EE MOV DX,[exec_load_block] 788 <1> ; 789 <1> ; assign the space to the process 790 <1> ; 791 <1> 0 00006520 BE0100 MOV SI,arena_owner ; pointer to owner field 793 <1> 0 00006523 8B46F2 MOV AX,[exec_environ] ; get environ pointer 0 00006526 09C0 OR AX,AX 0 00006528 7405 JZ NO_OWNER ; no environment 0 0000652A 48 DEC AX ; point to header 0 0000652B 8ED8 MOV DS,AX 799 <1> assume ds:MCB 0 0000652D 8914 MOV [SI],DX ; assign ownership 801 <1> NO_OWNER: 0 0000652F 8B46EE MOV AX,[exec_load_block] ; get load block pointer 0 00006532 48 DEC AX 0 00006533 8ED8 MOV DS,AX ; point to header 805 <1> assume ds:MCB 0 00006535 8914 MOV [SI],DX ; assign ownership 807 <1> 0 00006537 1E PUSH DS ;AN000;MS. make ES=DS 0 00006538 07 POP ES ;AN000;MS. 810 <1> assume es:MCB 811 <1> ARENA_NAME equ arena_name ; NASM port equate 0 00006539 BF0800 MOV DI,ARENA_NAME ;AN000;MS. ES:DI points to destination 0 0000653C E86D01 CALL Scan_Execname ;AN007;MS. parse execname 814 <1> ; ds:si->name, cx=name length 0 0000653F 51 PUSH CX ;AN007;;MS. save for fake version 0 00006540 56 PUSH SI ;AN007;;MS. save for fake version 817 <1> 818 <1> movename: ;AN000; 0 00006541 AC LODSB ;AN000;;MS. get char 0 00006542 3C2E CMP AL,'.' ;AN000;;MS. is '.' ,may be name.exe 0 00006544 7403 JZ mem_done ;AN000;;MS. no, move to header 822 <1> ;AN000; 0 00006546 AA STOSB ;AN000;;MS. move char 0 00006547 E2F8 LOOP movename ;AN000;;MS. continue 825 <1> mem_done: ;AN000; 0 00006549 30C0 XOR AL,AL ;AN000;;MS. make ASCIIZ 827 <1> ARENA_struc_size equ arena_struc_size ; NASM port equate 0 0000654B 83FF10 CMP DI,ARENA_struc_size ;AN000;MS. if not all filled 0 0000654E 7301 JAE fill8 ;AN000;MS. 0 00006550 AA STOSB ;AN000;MS. 831 <1> fill8: ;AN000; 0 00006551 5E POP SI ;AN007;MS. ds:si -> file name 0 00006552 59 POP CX ;AN007;MS. 834 <1> 0 00006553 E86D01 CALL Scan_Special_Entries ;AN007;MS. 836 <1> 0 00006556 52 PUSH DX 0 00006557 8B76F0 MOV SI,[exec_size] 0 0000655A 01D6 ADD SI,DX 0 0000655C E8[0000] invoke D_Dup_PDB ; ES is now PDB 0 0000655F 5A POP DX 842 <1> 0 00006560 FF76F2 PUSH word [exec_environ] 0 00006563 268F062C00 POP word [ES:PDB_environ] 845 <1> ; 846 <1> ; set up proper command line stuff 847 <1> ; 0 00006568 C576FC LDS SI,[exec_blk] ; get the block 849 <1> assume ds:nothing 0 0000656B 1E PUSH DS ; save its location 0 0000656C 56 PUSH SI 852 <1> exec0_5C_FCB equ Exec0_5C_FCB ; NASM port equate 0 0000656D C57406 LDS SI,[SI + exec0_5C_FCB] ; get the 5c fcb 854 <1> assume ds:nothing 855 <1> ; 856 <1> ; DS points to user space 5C FCB 857 <1> ; 0 00006570 B90C00 MOV CX,12 ; copy drive, name and ext 0 00006573 51 PUSH CX 0 00006574 BF5C00 MOV DI,5Ch 0 00006577 8A1C MOV BL,[SI] 0 00006579 F3A4 REP MOVSB 863 <1> ; 864 <1> ; DI = 5Ch + 12 = 5Ch + 0Ch = 68h 865 <1> ; 0 0000657B 31C0 XOR AX,AX ; zero extent, etc for CPM 0 0000657D AB STOSW 0 0000657E AB STOSW 869 <1> ; 870 <1> ; DI = 5Ch + 12 + 4 = 5Ch + 10h = 6Ch 871 <1> ; 0 0000657F 59 POP CX 0 00006580 5E POP SI ; get block 0 00006581 1F POP DS 875 <1> assume ds:nothing 0 00006582 1E PUSH DS ; save (again) 0 00006583 56 PUSH SI 878 <1> exec0_6C_FCB equ Exec0_6C_FCB ; NASM port equate 0 00006584 C5740A LDS SI,[SI + exec0_6C_FCB] ; get 6C FCB 880 <1> assume ds:nothing 881 <1> ; 882 <1> ; DS points to user space 6C FCB 883 <1> ; 0 00006587 8A3C MOV BH,[SI] ; do same as above 0 00006589 F3A4 REP MOVSB 0 0000658B AB STOSW 0 0000658C AB STOSW 0 0000658D 5E POP SI ; get block (last time) 0 0000658E 1F POP DS 890 <1> assume ds:nothing 891 <1> exec0_com_line equ Exec0_com_line ; NASM port equate 0 0000658F C57402 LDS SI,[SI + exec0_com_line] ; command line 893 <1> assume ds:nothing 894 <1> ; 895 <1> ; DS points to user space 80 command line 896 <1> ; 0 00006592 80C980 OR CL,80h 0 00006595 89CF MOV DI,CX 0 00006597 F3A4 REP MOVSB ; Wham! 900 <1> ; 901 <1> ; Process BX into default AX (validity of drive specs on args). We no longer 902 <1> ; care about DS:SI. 903 <1> ; 0 00006599 FEC9 DEC CL ; get 0FFh in CL 0 0000659B 88F8 MOV AL,BH 0 0000659D 30FF XOR BH,BH 0 0000659F E8[0000] invoke GetVisDrv 0 000065A2 7302 JNC exec_BL 0 000065A4 88CF MOV BH,CL 910 <1> exec_BL: 0 000065A6 88D8 MOV AL,BL 0 000065A8 30DB XOR BL,BL 0 000065AA E8[0000] invoke GetVisDrv 914 <1> exec_Set_Return equ exec_set_return ; NASM port label 0 000065AD 7302 JNC exec_Set_Return 0 000065AF 88CB MOV BL,CL 917 <1> exec_set_return: 0 000065B1 E8[0000] invoke get_user_stack ; get his return address 0 000065B4 FF7414 PUSH word [SI + user_CS] ; suck out the CS and IP 0 000065B7 FF7412 PUSH word [SI + user_IP] 0 000065BA FF7414 PUSH word [SI + user_CS] ; suck out the CS and IP 0 000065BD FF7412 PUSH word [SI + user_IP] 0 000065C0 268F060A00 POP WORD PTR [ES:PDB_Exit] 0 000065C5 268F060C00 POP WORD PTR [ES:PDB_Exit+2] 0 000065CA 31C0 XOR AX,AX 0 000065CC 8ED8 MOV DS,AX 927 <1> assume ds:IVT 0 000065CE 8F068800 POP word [addr_int_terminate] ; save them where we can get them later 0 000065D2 8F068A00 POP word [addr_int_terminate+2] ; when the child exits. 0 000065D6 36C706[0000]8000 MOV WORD [ss:DMAADD],80h 0 000065DD 368E1E[0000] MOV DS,[ss:CurrentPDB] 932 <1> assume ds:PSP 0 000065E2 368C1E[0200] MOV WORD PTR [ss:DMAADD+2],DS 934 <1> 935 <1> extern ReleaseOwnersMCBs, backdoor_free_mcb_exec, backdoor_indicator 0 000065E7 53 push bx 0 000065E8 E8[0000] EnterCrit critMem 0 000065EB 31DB xor bx, bx 0 000065ED 36871E[0000] xchg bx, [ss:backdoor_free_mcb_exec] ; get backdoor owner 0 000065F2 E8[0000] call ReleaseOwnersMCBs ; exec success: free it 0 000065F5 E8[0000] LeaveCrit critMem 0 000065F8 1E push ds 0 000065F9 36C51E[0000] lds bx, [ss:backdoor_indicator] ; -> indicator 944 <1> assume ds:nothing 0 000065FE 83FBFF cmp bx, -1 ; invalid address ? 0 00006601 7409 je @F ; yes --> 0 00006603 C607FF mov byte [bx], -1 ; else, set the indicator 0 00006606 36830E[0000]FF or word [ss:backdoor_indicator], -1 ; and disable indicator after this 949 <1> @@: 0 0000660C 1F pop ds 951 <1> assume ds:PSP 0 0000660D 5B pop bx 953 <1> 0 0000660E F646FB01 TEST BYTE [exec_func],exec_func_no_execute 0 00006612 7427 JZ exec_go 956 <1> 0 00006614 36C536[0000] LDS SI,[ss:exec_init_SP] ; get stack 958 <1> assume ds:nothing 0 00006619 C47EFC LES DI,[exec_blk] ; and block for return 960 <1> assume es:nothing 961 <1> exec1_SS equ Exec1_SS ; NASM port equate 0 0000661C 268C5D10 MOV [ES:DI + exec1_SS],DS ; return SS 963 <1> 0 00006620 4E DEC SI ; 'push' default AX 0 00006621 4E DEC SI 0 00006622 891C MOV [SI],BX ; save default AX reg 967 <1> exec1_SP equ Exec1_SP ; NASM port equate 0 00006624 2689750E MOV [ES:DI + exec1_SP],SI ; return 'SP' 969 <1> 0 00006628 36C506[0400] LDS AX,[ss:exec_init_IP] 971 <1> assume ds:nothing 972 <1> exec1_CS equ Exec1_CS ; NASM port equate 0 0000662D 268C5D14 MOV [ES:DI + exec1_CS],DS ; initial entry stuff 974 <1> 975 <1> exec1_IP equ Exec1_IP ; NASM port equate 0 00006631 26894512 MOV [ES:DI + exec1_IP],AX 0 00006635 89EC5D Leave 0 00006638 E9[0000] transfer SYS_RET_OK 979 <1> 980 <1> exec_go: 0 0000663B 36C536[0400] LDS SI,[ss:exec_init_IP] ; get entry point 982 <1> assume ds:nothing 0 00006640 36C43E[0000] LES DI,[ss:exec_init_SP] ; new stack 984 <1> assume es:nothing 0 00006645 8CC0 MOV AX,ES 986 <1> ; 987 <1> ; DS:SI points to entry point 988 <1> ; AX:DI points to initial stack 989 <1> ; DX has PDB pointer 990 <1> ; BX has initial AX value 991 <1> ; 0 00006647 1607 context es 0 00006649 FA CLI 0 0000664A 8ED0 MOV SS,AX ; set up user's stack 0 0000664C 89FC MOV SP,DI ; and SP 996 <1> ASSUME SS:NOTHING 0 0000664E FB STI 0 0000664F 90 nop 0 00006650 9C pushf ; iret frame 0 00006651 1E PUSH DS ; fake long call to entry 0 00006652 56 PUSH SI 0 00006653 26C606[0000]00 mov byte [es:INDOS], 0 ; clear InDOS upon DOS stack unused 0 00006659 8EC2 MOV ES,DX ; set up proper seg registers 1004 <1> assume es:nothing 0 0000665B 8EDA MOV DS,DX 1006 <1> assume ds:nothing 0 0000665D 53 push bx ; = ax = bx on stack 1008 <1> do_a20_off_ax_on_stack: 0 0000665E 53 push bx ; for both registers 1010 <1> %ifndef BUF2 1011 <1> %IF BUFFERFLAG 1012 <1> invoke restore_user_map 1013 <1> %ENDIF 1014 <1> %endif 1015 <1> extern a20off_entry 1016 <1> 0 0000665F EA[0000][0000] jmp DOSENTRY:a20off_entry ; must address XMS entry variable with cs 1018 <1> 1019 <1> EndProc D_Exec 1020 <1> 1021 <1> Procedure ExecRead,NEAR 1021 ****************** <1> warning: proc ExecRead... [-w+user] 1022 <1> assume ss:DOSGROUP 0 00006664 E80C00 CALL exec_dealloc 0 00006667 8B5EF8 MOV bx,[exec_fh] 0 0000666A 55 PUSH BP 0 0000666B E8[0000] invoke D_READ 0 0000666E 5D POP BP 0 0000666F E80D00 CALL exec_alloc 0 00006672 C3 return 1030 <1> EndProc ExecRead 1031 <1> 1032 <1> procedure exec_dealloc,near 1032 ****************** <1> warning: proc exec_dealloc... [-w+user] 1033 <1> assume ss:DOSGROUP 1034 <1> ASSUME DS:NOTHING,ES:NOTHING 0 00006673 53 PUSH BX 0 00006674 BB0000 MOV BX,arena_owner_system 0 00006677 E8[0000] EnterCrit CritMEM 0 0000667A E81000 CALL ChangeOwners 0 0000667D 5B POP BX 0 0000667E C3 return 1041 <1> EndProc exec_dealloc 1042 <1> 1043 <1> procedure exec_alloc,near 1043 ****************** <1> warning: proc exec_alloc... [-w+user] 1044 <1> assume ss:DOSGROUP 0 0000667F 53 PUSH BX 0 00006680 368B1E[0000] MOV BX,[ss:CurrentPDB] 0 00006685 E80500 CALL ChangeOwners 0 00006688 E8[0000] LeaveCrit CritMEM 0 0000668B 5B POP BX 0 0000668C C3 return 1051 <1> EndProc exec_alloc 1052 <1> 1053 <1> procedure ChangeOwners,NEAR 1053 ****************** <1> warning: proc ChangeOwners... [-w+user] 1054 <1> assume ss:DOSGROUP 0 0000668D 9C pushf 0 0000668E 50 PUSH AX 0 0000668F 8B46F2 MOV AX,[exec_environ] 0 00006692 E80900 CALL ChangeOwner 0 00006695 8B46EE MOV AX,[exec_load_block] 0 00006698 E80300 Call ChangeOwner 0 0000669B 58 POP AX 0 0000669C 9D popf 0 0000669D C3 return 1064 <1> EndProc ChangeOwners 1065 <1> 1066 <1> Procedure ChangeOwner,near 1066 ****************** <1> warning: proc ChangeOwner... [-w+user] 1067 <1> assume ss:DOSGROUP 0 0000669E 09C0 OR AX,AX ; is area allocated? 0 000066A0 74FB retz ; no, do nothing 0 000066A2 48 DEC AX 0 000066A3 1E PUSH DS 0 000066A4 8ED8 MOV DS,AX 1073 <1> assume ds:MCB 0 000066A6 891E0100 MOV [arena_owner],BX 0 000066AA 1F POP DS 1076 <1> assume ds:nothing 0 000066AB C3 return 1078 <1> EndProc ChangeOwner 1079 <1> 1080 <1> Procedure Scan_Execname,near ;AN000;MS. 1080 ****************** <1> warning: proc Scan_Execname... [-w+user] 1081 <1> 0 000066AC C576E6 LDS SI,[execName] ;AN000;MS. DS:SI points to name 1083 <1> save_begin: ;AN000; 0 000066AF 89F1 MOV CX,SI ;AN000;MS. CX= starting addr 1085 <1> scan0: ;AN000; 0 000066B1 AC LODSB ;AN000;MS. get char 0 000066B2 3C3A CMP AL,':' ;AN000;;MS. is ':' , may be A:name 0 000066B4 74F9 JZ save_begin ;AN000;;MS. yes, save si 0 000066B6 3C5C CMP AL,'\' ;AN000;;MS. is '\', may be A:\name 0 000066B8 74F5 JZ save_begin ;AN000;;MS. yes, save si 0 000066BA 3C00 CMP AL,0 ;AN000;;MS. is end of name 0 000066BC 75F3 JNZ scan0 ;AN000;;MS. no, continue scanning 0 000066BE 29CE SUB SI,CX ;AN000;;MS. get name's length 0 000066C0 87F1 XCHG SI,CX ;AN000;;MS. cx= length, si= starting addr 1095 <1> 0 000066C2 C3 return ;AN000;;MS. 1097 <1> EndProc Scan_Execname ;AN000;;MS. 1098 <1> 1099 <1> 1100 <1> Procedure Scan_Special_Entries,near ;AN000;MS. 1100 ****************** <1> warning: proc Scan_Special_Entries... [-w+user] 1101 <1> assume ss:DOSGROUP 1102 <1> 0 000066C3 49 DEC CX ;AN007;MS. cx= name length 0 000066C4 368B3E[0000] MOV DI,[ss:Special_Entries] ;AN007;MS. es:di -> addr of special entries 0 000066C9 E83D00 CALL Reset_Version ;AN008;MS. 0 000066CC 16 PUSH ss ;AN007;MS. 0 000066CD 07 POP ES ;AN007;MS. 1108 <1> assume es:DOSGROUP 1109 <1> Getentries: ;AN007;MS. 0 000066CE 268A05 MOV AL,[ES:DI] ;AN007;MS. end of list 0 000066D1 08C0 OR AL,AL ;AN007;MS. 0 000066D3 7433 JZ end_list ;AN007;MS. yes 0 000066D5 36893E[0000] MOV [ss:Temp_Var2],DI ;AN007;MS. save di 0 000066DA 38C8 CMP AL,CL ;AN007;MS. same length ? 0 000066DC 751C JNZ skipone ;AN007;MS. no 0 000066DE 47 INC DI ;AN007;MS. es:di -> special name 0 000066DF 51 PUSH CX ;AN007;MS. save length and name addr 0 000066E0 56 PUSH SI ;AN007;MS. 0 000066E1 F3A6 REPZ CMPSB ;AN007;MS. same name ? 0 000066E3 7513 JNZ not_matched ;AN007;MS. no 0 000066E5 268B05 MOV AX,[ES:DI] ;AN007;MS. get special version 0 000066E8 36A3[0000] MOV [ss:Special_Version],AX ;AN007;MS. save it 0 000066EC 268A4502 MOV AL,[ES:DI+2] ;AN008;MS. get fake count 0 000066F0 36A2[0000] MOV [ss:Fake_Count],AL ;AN007;MS. save it 0 000066F4 5E POP SI ;AN007;MS. 0 000066F5 59 POP CX ;AN007;MS. 0 000066F6 EB10 JMP SHORT end_list ;AN007;MS. 1128 <1> not_matched: ;AN007;MS. 0 000066F8 5E POP SI ;AN007;MS. restore si,cx 0 000066F9 59 POP CX ;AN007;MS. 1131 <1> skipone: ;AN007;MS. 0 000066FA 368B3E[0000] MOV DI,[ss:Temp_Var2] ;AN007;MS. restore old di 0 000066FF 30E4 XOR AH,AH ;AN007;MS. position to next entry 0 00006701 01C7 ADD DI,AX ;AN007;MS. 0 00006703 83C704 ADD DI,4 ;AN007;MS. 0 00006706 EBC6 JMP Getentries ;AN007;MS. 1137 <1> 1138 <1> 1139 <1> end_list: ;AN007;MS. 0 00006708 C3 return 1141 <1> EndProc Scan_Special_Entries ;AN000;;MS. 1142 <1> 1143 <1> Procedure Reset_Version,near ;AN008;MS. 1143 ****************** <1> warning: proc Reset_Version... [-w+user] 1144 <1> 0 00006709 36803E[0000]FF CMP byte [ss:Fake_Count],0FFH ;AN008;MS. 0 0000670F 7507 JNZ dont_reset ;AN008;MS. 0 00006711 36C706[0000]0000 MOV word [ss:Special_Version],0 ;AN008;MS. reset to current version 1148 <1> dont_reset: 0 00006718 C3 return 1150 <1> EndProc Reset_Version,near ;AN008;;MS. 1151 <1> 1152 <1> 74 ;=== Pop trace listing source 75 76 ;SUBTTL Terminate and stay resident handler 77 ;PAGE 78 ; 79 ; Input: DX is an offset from CurrentPDB at which to 80 ; truncate the current block. 81 ; 82 ; output: The current block is truncated (expanded) to be [DX+15]/16 83 ; paragraphs long. An exit is simulated via resetting CurrentPDB 84 ; and restoring the vectors. 85 ; 86 procedure D_Keep_process,NEAR 86 ****************** warning: proc D_Keep_process... [-w+user] 87 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 88 0 00006719 50 PUSH AX ; keep exit code around 90 Exit_keep_process equ Exit_Keep_process ; NASM port equate 0 0000671A 36C606[0000]03 MOV BYTE PTR [ss:Exit_type],Exit_keep_process 0 00006720 368E06[0000] MOV ES,[ss:CurrentPDB] 93 assume es:PSP 0 00006725 83FA06 CMP DX,6h ; keep enough space around for system 95 Keep_shrink equ keep_shrink ; NASM port label 0 00006728 7303 JAE Keep_shrink ; info 0 0000672A BA0600 MOV DX,6h 98 keep_shrink: 0 0000672D 89D3 MOV BX,DX 0 0000672F 53 PUSH BX 0 00006730 06 PUSH ES 0 00006731 E8[0000] invoke D_SETBLOCK ; ignore return codes. 0 00006734 1F POP DS 104 assume ds:PSP 0 00006735 5B POP BX 0 00006736 7207 JC keep_done ; failed on modification 0 00006738 8CD8 MOV AX,DS 0 0000673A 01D8 ADD AX,BX 0 0000673C A30200 MOV [PDB_block_len],AX 110 111 keep_done: 0 0000673F 58 POP AX 113 exit_inner equ Exit_inner ; NASM port label 0 00006740 EB26 JMP SHORT exit_inner ; and let abort take care of the rest 115 116 EndProc D_Keep_process 117 118 relocated i27 119 procedure Stay_resident,NEAR 119 ****************** warning: proc Stay_resident... [-w+user] 120 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 121 Keep_process equ Keep_Process ; NASM port equate 0 00006742 B80031 MOV AX,(Keep_process << 8) + 0 ; Lower part is return code 0 00006745 83C20F ADD DX,15 0 00006748 D1DA RCR DX,1 0 0000674A B103 MOV CL,3 0 0000674C D3EA SHR DX,CL 127 0 0000674E E9[0000] transfer COMMAND 129 EndProc Stay_resident 130 131 ;SUBTTL $EXIT - return to parent process 132 ;PAGE 133 ; 134 ; Assembler usage: 135 ; MOV AL, code 136 ; MOV AH, Exit 137 ; INT int_command 138 ; Error return: 139 ; None. 140 ; 141 procedure D_EXIT,NEAR 141 ****************** warning: proc D_EXIT... [-w+user] 142 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006751 30E4 XOR AH,AH 0 00006753 368626[0000] XCHG AH,BYTE PTR [ss:DidCTRLC] 0 00006758 08E4 OR AH,AH 146 exit_terminate equ Exit_terminate ; NASM port equate 0 0000675A 36C606[0000]00 MOV BYTE PTR [ss:Exit_type],exit_terminate 0 00006760 7406 JZ exit_inner 149 exit_ctrl_c equ Exit_Ctrl_C ; NASM port equate 0 00006762 36C606[0000]01 MOV BYTE PTR [ss:Exit_type],exit_ctrl_c 151 152 entry Exit_inner 153 0 00006768 E8[0000] invoke get_user_stack 0 0000676B 36FF36[0000] PUSH word [ss:CurrentPDB] 0 00006770 8F4414 POP word [SI + user_CS] 0 00006773 EB08 JMP SHORT abort_inner 158 EndProc D_EXIT 159 160 BREAK <$ABORT -- Terminate a process> 161 162 ; Inputs: 163 ; user_CS:00 must point to valid program header block 164 ; Function: 165 ; Restore terminate and Cntrl-C addresses, flush buffers and transfer to 166 ; the terminate address 167 ; Returns: 168 ; TO THE TERMINATE ADDRESS 169 170 procedure D_ABORT,NEAR 170 ****************** warning: proc D_ABORT... [-w+user] 171 ASSUME DS:NOTHING,ES:NOTHING, ss:DOSGROUP 172 0 00006775 30C0 XOR AL,AL 174 exit_abort equ Exit_abort ; NASM port equate 0 00006777 36C606[0000]00 MOV byte [ss:exit_type],exit_abort 176 177 ; 178 ; abort_inner must have AL set as the exit code! The exit type is retrieved 179 ; from exit_type. Also, the PDB at user_CS needs to be correct as the one 180 ; that is terminating. 181 ; 182 entry abort_inner 183 0 0000677D 368A26[0000] MOV AH,[ss:exit_type] 0 00006782 36A3[0000] MOV [ss:exit_code],AX 0 00006786 E8[0000] invoke Get_user_stack 0 00006789 8E5C14 MOV DS,[SI + user_CS] ; set up old interrupts 188 assume ds:PSP 0 0000678C 31C0 XOR AX,AX 0 0000678E 8EC0 MOV ES,AX 191 assume es:IVT 0 00006790 BE0A00 MOV SI,SAVEXIT 0 00006793 BF8800 MOV DI,addr_int_terminate 0 00006796 A5 MOVSW 0 00006797 A5 MOVSW 0 00006798 A5 MOVSW 0 00006799 A5 MOVSW 0 0000679A A5 MOVSW 0 0000679B A5 MOVSW 0 0000679C E9[0000] transfer $reset_environment 201 EndProc D_ABORT 202 203 END === Trace listing source: ../DOS/alloc.lst 1 ; SCCSID = @(#)alloc.asm 1.1 85/04/09 2 ;TITLE ALLOC.ASM - memory arena manager 3 ;NAME Alloc 4 ; 5 ; Memory related system calls and low level routines for MSDOS 2.X. 6 ; I/O specs are defined in DISPATCH. 7 ; 8 ; $ALLOC 9 ; $SETBLOCK 10 ; $DEALLOC 11 ; $AllocOper 12 ; arena_free_process 13 ; arena_next 14 ; check_signature 15 ; Coalesce 16 ; 17 ; Modification history: 18 ; 19 ; Created: ARR 30 March 1983 20 ; 21 22 [list -] 22 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 27 28 [list +] === Switch to base=002450h -> "DOSCODECODE" 29 section DOSCODECODE 30 [list -] 30 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 30 ****************** warning: out: BPB.INC... [-w+user] 30 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 30 ****************** warning: out: DEVSYM.INC... [-w+user] 36 %include "memsw.mac" 1 <1> %define LDOSMEM 1 37 ;.cref 38 [list +] 39 40 ;.lall 41 42 ;SUBTTL memory allocation utility routines 43 ;PAGE 44 ; 45 ; arena data 46 ; 47 i_need arena_head,WORD ; seg address of start of arena 48 first_mcb equ arena_head 49 I_need first_umcb, word 50 i_need CurrentPDB,WORD ; current process data block addr 51 i_need FirstArena,WORD ; first free block found 52 i_need BestArena,WORD ; best free block found 53 i_need LastArena,WORD ; last free block found 54 i_need AllocMethod,BYTE ; how to alloc first(best)last 55 I_need alloc_strategy_ext, byte 56 I_need enable_uma, byte 57 I_need EXTERR_LOCUS,BYTE ; Extended Error Locus 58 59 %ifdef LDOSMEM 60 getpsp: 61 assume ds:nothing, es:nothing, ss:DOSGROUP 0 0000679F 368B1E[0000] mov bx, word [ss:CurrentPDB] 0 000067A4 C3 retn 64 65 %assign _UMA 1 66 %assign _ERRORFLAGS 0 67 68 %include "memory.asm" 1 <1> 2 <1> %if 0 3 <1> 4 <1> lDOS memory handling 5 <1> by E. C. Masloch, 2018--2025 6 <1> 7 <1> Usage of the works is permitted provided that this 8 <1> instrument is retained with the works, so that any entity 9 <1> that uses the works is notified of this instrument. 10 <1> 11 <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 12 <1> 13 <1> %endif 14 <1> 15 <1> %if 0 16 <1> 17 <1> Inside most functions, di is set to zero and used as index register to access 18 <1> MCB fields (this allows the assembler to use byte offsets resulting in smaller 19 <1> instructions). It's also used whenever a register with the value zero is handy, 20 <1> for example, when ClearMCB wants to free the MCB by setting the owner word to 21 <1> zero. 22 <1> 23 <1> Most functions access the current working MCB with ds. CollectNextFreeMCB 24 <1> accesses the secondary MCB (which is to be removed) with es. 25 <1> 26 <1> -- 27 <1> 28 <1> The separate CheckMCBs function has been removed. To check the MCB chain, call 29 <1> ReleaseOwnersMCBs with bx set to zero. The returned status indicates whether 30 <1> the MCB chain is invalid. (This also resets the mcbName field of all already 31 <1> free MCBs, but that shouldn't be an issue.) 32 <1> 33 <1> -- 34 <1> 35 <1> As you may note, the functions are mostly ordered from those performing simple 36 <1> or preparatory tasks to those more complex, calling the simpler ones. The last 37 <1> functions are ModifyMCBRandom (which takes an address and resizes that MCB as 38 <1> requested) and AllocateMCBRandom (which searches through the MCBs and decides 39 <1> which one to reserve depending on the requested allocation strategy). 40 <1> 41 <1> -- 42 <1> 43 <1> Note that the MS-DOS-compatible UMB link and memory allocation strategies 44 <1> for allocation behave as follows: 45 <1> 46 <1> UMB link? --> Off On 47 <1> v Strategy area 48 <1> 00h LMA only LMA then UMA, as one area 49 <1> 40h LMA only UMA only, as one area 50 <1> 80h LMA only UMA as one area, then LMA as one area 51 <1> 52 <1> In particular, "UMA then LMA" (80h) treats the two areas as distinct areas 53 <1> for the search; if a UMA block is found that satisfies the search, it is 54 <1> used, even if a better (best-fit) or later (last-fit) block would be found 55 <1> in the LMA. (For first-fit, there is no difference.) 56 <1> 57 <1> Our original implementation treated the "UMA then LMA" (80h) strategy area 58 <1> as one area for the search, which for best-fit and last-fit differs. 59 <1> 60 <1> -- 61 <1> 62 <1> The default now is to behave compatible to MS-DOS, that is, UMA then LMA 63 <1> is handled as two areas, while LMA then UMA is handled as one area. 64 <1> Setting the flag 2 in the high byte of the allocation strategy (stored 65 <1> in alloc_strategy_ext) handles both cases in the original lDOS meaning, 66 <1> that is, as one area. Setting the flag 4 instead handles both cases as 67 <1> two areas. Flag 2 takes precedence if both are set. (This is handled in 68 <1> AllocateMCBCompatible, which calls AllocateLargestMCBRandom for the two 69 <1> area cases.) 70 <1> 71 <1> -- 72 <1> 73 <1> When flag 1 of alloc_strategy_ext is set, the UMB link status (which 74 <1> here includes whether the last LMCB has an M or a Z) is ignored and 75 <1> the area flags of the allocation strategy are used exclusively. 76 <1> 77 <1> %endif 78 <1> 79 <1> %include "lmacros2.mac" 1 <2> [list -] 80 <1> %include "lstruct.mac" 1 <2> [list -] 13 <2> [list -] 81 <1> 82 <1> 83 <1> global GetMCBOwner, GetMCBFlags, GetRawMCBFlags, AllocateLargestMCBRandom 84 <1> global AllocateMCBCompatible.flags_cx 85 <1> global SplitMCB, ClearMCB 86 <1> 87 <1> 88 <1> ; INP: cx = user-requested flags 89 <1> ; OUT: cx = internally usable flags 90 <1> ; (only one bit of bits 4..7 set, low nibble contains 0..2, high byte always clear) 91 <1> ; word [ss:error_flags] updated 92 <1> ; CHG: - 93 <1> ; STK: 4 word 94 <1> ; 95 <1> ; The user-requested flags are parsed to these internally used: 96 <1> ; area: 10h LMA only 97 <1> ; 20h LMA then UMA 98 <1> ; 40h UMA only 99 <1> ; 80h UMA then LMA 100 <1> ; (for the non-UMA build, all area flags are ignored and cleared) 101 <1> ; mode: 00h First fit 102 <1> ; 01h Best fit 103 <1> ; 02h Last fit 104 <1> %ifn _UMA 105 <1> FixMCBFlags: 106 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 107 <1> test ch, ~(1 | 2 | 4) ; invalid flags set ? 108 <1> jz .validhigh 109 <1> and ch, (1 | 2 | 4) 110 <1> %if _ERRORFLAGS 111 <1> or byte [ss:error_flags], EF_InvalidAllocStrategy 112 <1> %endif 113 <1> .validhigh: 114 <1> ; The problem arises that MS-DOS 5+ always supports 115 <1> ; UMBs. Older versions allowed any value as strategy 116 <1> ; using anything above 2 as "Last fit" too. Instead 117 <1> ; of reproducing this behaviour, builds without UMA 118 <1> ; fake that they actually support UMA but that there 119 <1> ; was none installed. (After all, we use the DOS 5+ 120 <1> ; internal data layout.) Programs can check for this 121 <1> ; fake support by calling 21.5802 and 21.5803. If UMA 122 <1> ; is actually supported, 21.5802 always returns NC. If 123 <1> ; UMA is not supported, it returns CY (ax = 0001h). If 124 <1> ; UMA is supported, but not installed, 21.5803 still 125 <1> ; returns CY (ax = 0001h). 126 <1> and cl, 0Fh ; clear area flags (we don't check these either) 127 <1> cmp cl, 3 ; valid strategy ? 128 <1> jb .validstrategy ; yes --> 129 <1> xor cl, cl ; force first fit 130 <1> %if _ERRORFLAGS 131 <1> or byte [ss:error_flags], EF_InvalidAllocStrategy ; report invalid strategy 132 <1> %endif 133 <1> .validstrategy: 134 <1> retn 135 <1> %else 136 <1> FixMCBFlags: 137 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 000067A5 F6C5F8 test ch, ~(1 | 2 | 4) ; invalid flags set ? 0 000067A8 7403 jz .validhigh 0 000067AA 80E507 and ch, (1 | 2 | 4) 141 <1> %if _ERRORFLAGS 142 <1> or byte [ss:error_flags], EF_InvalidAllocStrategy 143 <1> %endif 144 <1> .validhigh: 0 000067AD 50 push ax 0 000067AE 51 push cx 0 000067AF F6C1F0 test cl, ~0Fh ; test whether any flag set 0 000067B2 7503 jnz .gotflag 0 000067B4 80C920 or cl, 20h ; "LMA then UMA" (if UMA enabled) 150 <1> .gotflag: 0 000067B7 B580 mov ch, 80h 0 000067B9 F9 stc 0 000067BA E81A00 call .test 0 000067BD E81700 call .test 0 000067C0 E81400 call .test ; (after this call, 10h is the only flag left. it is set) 156 <1> 0 000067C3 30ED xor ch, ch ; insure high byte zero 0 000067C5 51 push cx 0 000067C6 80E10F and cl, 0Fh ; clear flags 0 000067C9 80F903 cmp cl, 3 ; valid strategy ? 161 <1> ; (0 = first fit, 1 = best fit, 2 = last fit) 0 000067CC 59 pop cx 0 000067CD 7203 jb .validstrategy ; yes --> 0 000067CF 80E1F0 and cl, ~0Fh ; force first fit 165 <1> %if _ERRORFLAGS 166 <1> or byte [ss:error_flags], EF_InvalidAllocStrategy ; invalid low nibble 167 <1> %endif 168 <1> .validstrategy: 0 000067D2 58 pop ax ; restore ch from stack into ah 0 000067D3 88E5 mov ch, ah ; restore ch 0 000067D5 58 pop ax ; restore ax from stack 0 000067D6 C3 retn 173 <1> 174 <1> .test: 0 000067D7 7307 jnc .return ; previous call got flag 0 000067D9 84E9 test cl, ch ; current flag set ? 0 000067DB 7504 jnz .match ; yes --> 0 000067DD D0ED shr ch, 1 ; shift down 0 000067DF F9 stc ; signal next calls to pass 180 <1> .return: 0 000067E0 C3 retn 182 <1> .match: 0 000067E1 30E9 xor cl, ch ; clear flag itself 0 000067E3 F6C1F0 test cl, ~0Fh ; any of the lower flags set ? 0 000067E6 7403 jz .valid ; nope --> 0 000067E8 80E10F and cl, 0Fh ; clear lower flags 187 <1> %if _ERRORFLAGS 188 <1> or byte [ss:error_flags], EF_MultipleAllocAreas ; flag the error 189 <1> %endif 190 <1> .valid: 0 000067EB 30E9 xor cl, ch ; (NC) set flag again 0 000067ED C3 retn 193 <1> 194 <1> 195 <1> ; Compare ax to first UMCB 196 <1> ; 197 <1> ; INP: ax = MCB 198 <1> ; OUT: NZ if not first UMCB (or if there's no UMCB) 199 <1> ; ZR if first UMCB 200 <1> ; CHG: - 201 <1> ; STK: 1 word 202 <1> IsFirstUMCB?: 203 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 000067EE 36833E[0000]FE cmp word [ss:first_umcb], byte -2 0 000067F4 7705 ja .return ; (NZ if it jumps) --> 0 000067F6 363B06[0000] cmp ax, word [ss:first_umcb] 207 <1> .return: 0 000067FB C3 retn 209 <1> 210 <1> 211 <1> GetRawMCBFlags: 212 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 000067FC 368A2E[0000] mov ch, byte [ss:alloc_strategy_ext] 0 00006801 368A0E[0000] mov cl, byte [ss:AllocMethod] ; cx = flags 0 00006806 C3 retn 216 <1> 217 <1> 218 <1> ; Get current MCB flags 219 <1> ; 220 <1> ; INP: - 221 <1> ; OUT: cx = internally usable flags 222 <1> ; (only one bit of bits 4..7 set, low nibble contains 0..2, high byte always clear) 223 <1> ; error_flags updated 224 <1> ; CHG: - 225 <1> ; STK: 3 word 226 <1> GetMCBFlags: 227 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006807 E8F2FF call GetRawMCBFlags 0 0000680A E898FF call FixMCBFlags ; detect multiple area flags 230 <1> %if _ERRORFLAGS 231 <1> test byte [ss:enable_uma], ~1 232 <1> jz .validlink 233 <1> or byte [ss:error_flags], EF_InvalidUMBLink ; invalid UMB link bits set 234 <1> .validlink: 235 <1> %endif 0 0000680D F6C501 test ch, 1 ; use area flags and 237 <1> ; disregard UMB link ? 0 00006810 7516 jnz .return ; yes --> 0 00006812 36F606[0000]01 test byte [ss:enable_uma], 1 ; UMA enabled ? 0 00006818 7408 jz .lmaonly ; no, force LMA only --> (no error flag) 0 0000681A 36833E[0000]FF cmp word [ss:first_umcb], byte -1 ; UMA available ? 0 00006820 7506 jne .return 243 <1> %if _ERRORFLAGS 244 <1> or byte [ss:error_flags], EF_NoUMBsToLink ; UMB link enabled but none there 245 <1> %endif 246 <1> .lmaonly: ; change area to LMA only 0 00006822 80E10F and cl, 0Fh 0 00006825 80C910 or cl, 10h 249 <1> .return: 0 00006828 C3 retn 251 <1> %endif 252 <1> 253 <1> 254 <1> ; Set MCB flags for linear access 255 <1> ; ("LMA only" if no UMA available, else "LMA then UMA") 256 <1> ; 257 <1> ; INP: - 258 <1> ; OUT: ax = 0000h (to get first MCB on SNextMCB call) 259 <1> ; ss:sp-> flags (word 10h if no first UMCB, 20h else), 260 <1> ; loop detection counter (word initialised to 0), 261 <1> ; original si value 262 <1> ; ss:si-> flags (si = sp) 263 <1> ; NC, ZR 264 <1> ; CHG: - 265 <1> ; STK: 5 word 266 <1> SetLinearMCBFlags: 267 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006829 55 push bp 0 0000682A 89E5 mov bp, sp 0 0000682C B81000 mov ax, 10h ; if no UMCB, set to 10h ("LMA only") 271 <1> %if _UMA 0 0000682F 36833E[0000]FF cmp word [ss:first_umcb], -1 0 00006835 7402 je .nonuma 0 00006837 B020 mov al, 20h ; else set to 20h ("LMA then UMA") 275 <1> .nonuma: 276 <1> %endif 0 00006839 50 push ax ; flags word, at [bp - 2] 0 0000683A FF7602 push word [bp + 2] ; create return stack space, ip 0 0000683D FF7600 push word [bp] ; bp on stack 0 00006840 31C0 xor ax, ax 0 00006842 897602 mov word [bp + 2], si ; save si value on stack 0 00006845 894600 mov word [bp], ax ; loop detection counter 0 00006848 8D76FE lea si, [bp - 2] ; ss:si-> flags 0 0000684B 5D pop bp ; bp = [bp - 6] 0 0000684C C3 retn ; ip = [bp - 4] 286 <1> 287 <1> 288 <1> ; Get current MCB owner 289 <1> ; 290 <1> ; INP: - 291 <1> ; OUT: dx = PSP address or owner override value 292 <1> ; CHG: - 293 <1> ; STK: 2 word 294 <1> GetMCBOwner: 295 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 0000684D 87D3 xchg dx, bx 297 <1> %if 0 298 <1> mov bx, word [ss:current_driver] 299 <1> inc bx 300 <1> jz .usepsp ; was FFFFh, override inactive --> 301 <1> dec bx 302 <1> jnz .override ; was not 0000h, override active --> 303 <1> %endif 304 <1> .usepsp: 0 0000684F E84DFF call getpsp ; don't care which value returned 0 00006852 85DB test bx, bx 0 00006854 7501 jnz .return 0 00006856 43 inc bx ; except, not zero ! 309 <1> .override: 310 <1> .return: 0 00006857 87D3 xchg dx, bx 0 00006859 C3 retn 313 <1> 314 <1> 315 <1> ; Verify MCB 316 <1> ; 317 <1> ; INP: ax = MCB 318 <1> ; OUT: ds = MCB 319 <1> ; di = 0 320 <1> ; NZ, CY if invalid MCB, 321 <1> ; ax = error code 0007h (MCB chain corrupted) 322 <1> ; ZR, NC if valid MCB 323 <1> ; CHG: - 324 <1> ; STK: 1 word 325 <1> VerifyMCB: 326 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000685A 31FF xor di, di 0 0000685C 8ED8 mov ds, ax ; set up working registers 329 <1> assume ds:nothing 0 0000685E 40 inc ax 0 0000685F 83F802 cmp ax, byte 2 ; passed value FFFFh or 0000h ? 0 00006862 720B jb .invalid ; (NZ, CY) yes --> 0 00006864 48 dec ax 334 <1> assume ds:MCB 0 00006865 803D4D cmp byte [di+mcbSignature], 'M' ; valid 'M' signature ? 0 00006868 7409 je .return ; yes --> (ZR, NC) 0 0000686A 803D5A cmp byte [di+mcbSignature], 'Z' ; valid 'Z' signature ? 0 0000686D 7404 je .return ; yes --> (ZR, NC) 339 <1> .invalid: 0 0000686F F9 stc 0 00006870 B80700 mov ax, errorMCBDestroyed ; (CY, NZ) else invalid 342 <1> .return: 0 00006873 C3 retn 344 <1> 345 <1> 346 <1> ; INP: ax = memory block's segment 347 <1> ; OUT: di = 0 348 <1> ; NC if valid MCB, 349 <1> ; ds = ax = MCB address 350 <1> ; CY if invalid MCB, 351 <1> ; ax = error code 0009h (Invalid MCB) 352 <1> ; CHG: ds 353 <1> ; STK: 2 word 354 <1> GetMCBFromBlock: 355 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006874 48 dec ax 357 <1> 358 <1> ; Besides checking the signature, we don't do anything here. 359 <1> ; We could walk the actual chain to insure that MCB is on it, 360 <1> ; but that would prohibit freeing or resizing blocks in the 361 <1> ; excluded UMA sub-chains. (As I verified once with my 362 <1> ; horrible DEBUG preloading device driver hack, the usage of 363 <1> ; independant sub-chains isn't prohibited by MS-DOS.) 364 <1> 365 <1> ; Verify MCB, different error code 366 <1> ; 367 <1> ; INP: ax = MCB 368 <1> ; OUT: ds = MCB 369 <1> ; di = 0 370 <1> ; NZ, CY if invalid MCB, 371 <1> ; ax = error code 0009h (Invalid MCB) 372 <1> ; ZR, NC if valid MCB 373 <1> ; CHG: - 374 <1> ; STK: 2 word 375 <1> VerifySingleMCB: 376 <1> assume ds:nothing, es:nothing, ss:nothing 0 00006875 E8E2FF call VerifyMCB 0 00006878 7303 jnc .return 0 0000687A B80900 mov ax, errorMCBInvalid 380 <1> .return: 0 0000687D C3 retn 382 <1> 383 <1> 384 <1> ; Clear MCB owner and name, or name only 385 <1> ; 386 <1> ; INP: ds = MCB 387 <1> ; di = 0 388 <1> ; OUT: - 389 <1> ; CHG: - (CF is preserved too) 390 <1> ; STK: 1 word 391 <1> ; STT: ss need not equal DOSDATA 392 <1> ClearMCB: 393 <1> assume ds:MCB, es:nothing, ss:nothing 0 0000687E 897D01 mov word [di+mcbOwner], di ; free up block 395 <1> ClearMCBName: 396 <1> assume ds:MCB, es:nothing, ss:nothing 0 00006881 897D08 mov word [di+mcbName+0], di 0 00006884 897D0A mov word [di+mcbName+2], di 0 00006887 897D0C mov word [di+mcbName+4], di 0 0000688A 897D0E mov word [di+mcbName+6], di ; clear the name field 0 0000688D C3 retn 402 <1> 403 <1> 404 <1> ; Release MCB 405 <1> ; 406 <1> ; INP: ax = memory block's segment 407 <1> ; OUT: CY if invalid MCB, 408 <1> ; ax = error code 409 <1> ; NC if valid MCB, released, 410 <1> ; ax = MCB 411 <1> ; CHG: ax 412 <1> ; STK: 5 word 413 <1> ; 414 <1> ; DOS should not collect MCBs after freeing. This can 415 <1> ; break software which directly modifies MCBs because 416 <1> ; the software may think the MCB still exists there. 417 <1> ReleaseMCB: 418 <1> assume ds:nothing, es:nothing, ss:nothing 0 0000688E 1E push ds 0 0000688F 57 push di 0 00006890 E8E1FF call GetMCBFromBlock ; get MCB from block address 0 00006893 7203 jc .error ; invalid address or signature --> 423 <1> assume ds:MCB 0 00006895 E8E6FF call ClearMCB ; free it 425 <1> .error: 426 <1> assume ds:nothing 0 00006898 5F pop di 0 00006899 1F pop ds 429 <1> assume ds:nothing 0 0000689A C3 retn 431 <1> 432 <1> 433 <1> ; Get next MCB, insuring the chain doesn't loop 434 <1> ; 435 <1> ; INP: word [ss:si] = area flags and allocation strategy 436 <1> ; word [ss:si + 2] = loop detection counter, init to 0 437 <1> ; ax = former MCB (0000h to get first) 438 <1> ; OUT: CY if MCB chain corrupted or loops, 439 <1> ; ax = error code 440 <1> ; NC if MCB chain intact, 441 <1> ; NZ if no next MCB, 442 <1> ; ax = error code (0008h) 443 <1> ; ZR if next MCB available, 444 <1> ; ax = next MCB 445 <1> ; di = 0 446 <1> ; CHG: - 447 <1> ; STK: 8 word 448 <1> ; doscode_insure_low_byte_not_0CCh 449 <1> SNextMCB: 450 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 0000689B 31FF xor di, di 0 0000689D 36FF4C02 dec word [ss:si + 2] 0 000068A1 7505 jnz @F 454 <1> ; This doesn't branch if ZR, meaning if the 1_0000h iterations 455 <1> ; have run out (if counter was 1 prior to the dec). 0 000068A3 F9 stc 0 000068A4 B8FE00 mov ax, errorMCBLoops 0 000068A7 C3 retn 459 <1> 460 <1> @@: 461 <1> ; (fall through to NextMCB) 462 <1> 463 <1> 464 <1> ; Get next MCB 465 <1> ; 466 <1> ; INP: word [ss:si] = area flags and allocation strategy 467 <1> ; word [ss:si + 2] = loop detection counter 468 <1> ; ax = former MCB (0000h to get first) 469 <1> ; OUT: CY if MCB chain corrupted, 470 <1> ; ax = error code 471 <1> ; NC if MCB chain intact, 472 <1> ; NZ if no next MCB, 473 <1> ; ax = error code 0008h (Not enough memory) 474 <1> ; ZR if next MCB available, 475 <1> ; ax = next MCB 476 <1> ; di = 0 477 <1> ; CHG: - 478 <1> ; STK: 3 word 479 <1> ; 480 <1> ; An interesting effect of how this code handles the first UMCB 481 <1> ; is that it doesn't care whether the previous MCB contains an 482 <1> ; 'M' (normal MCB chain extended into UMA) or 'Z' (normal MCB 483 <1> ; chain limited to LMA). Also, the parsed area flags allow to 484 <1> ; ignore the actual requested UMB link: If it was zero, all 485 <1> ; area flags are cleared and forced to 10h (LMA only) instead. 486 <1> %ifn _UMA 487 <1> NextMCB: 488 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 489 <1> push ds 490 <1> test ax, ax ; request for first ? 491 <1> jz .first ; yes --> 492 <1> 493 <1> call VerifyMCB ; check input MCB first 494 <1> jc .return 495 <1> assume ds:MCB 496 <1> inc ax 497 <1> add ax, word [di+mcbSize] ; get address of next (if any) 498 <1> cmp byte [di+mcbSignature], 'M' ; current in-chain ? 499 <1> je .verify ; yes, verify it --> 500 <1> ; If this was NZ and didn't jump, then the mcbSignature 501 <1> ; contains the letter 'Z', which is above 'M'. Therefore, 502 <1> ; it is always true that it is NC at this point. 503 <1> mov ax, errorInsufficientMemory ; (NC, NZ) 504 <1> pop ds 505 <1> assume ds:nothing 506 <1> retn 507 <1> .first: 508 <1> mov ax, word [ss:first_mcb] 509 <1> .verify: 510 <1> assume ds:MCB 511 <1> call VerifyMCB ; NC, ZR if valid - CY if invalid 512 <1> .return: 513 <1> pop ds 514 <1> assume ds:nothing 515 <1> retn 516 <1> %else 517 <1> ; The UMA build has to evaluate the (parsed) area flags 518 <1> ; here to show the caller a continuous chain of MCBs. 519 <1> ; This requires special handling in two cases: If the 520 <1> ; caller's input was 0000h (to get the first MCB) or if 521 <1> ; it was the MCB before the first UMCB. Area flags of 522 <1> ; 80h and 40h want to start their search with the first 523 <1> ; UMCB instead. Flags 20h want to proceed at the first 524 <1> ; UMCB, all other flags want to stop there. The first 525 <1> ; UMCB's handling ignores whether the preceeding MCB 526 <1> ; contained 'M' or 'Z'. 527 <1> NextMCB: 528 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 000068A8 1E push ds 0 000068A9 85C0 test ax, ax ; request for first ? 0 000068AB 742E jz .first ; yes --> 532 <1> 0 000068AD E8AAFF call VerifyMCB ; check input MCB first 0 000068B0 723F jc .return 535 <1> assume ds:MCB 0 000068B2 40 inc ax 0 000068B3 034503 add ax, word [di+mcbSize] ; get address of next (whether current is 'M' or 'Z') 538 <1> 0 000068B6 E835FF call IsFirstUMCB? ; is the one behind this the first UMCB ? 0 000068B9 7508 jne .notfirstumcb ; nope, check if last --> 0 000068BB 36F604D0 test byte [ss:si], ~2Fh ; "LMA then UMA" ? 542 <1> ; x = D0h --> x & ~20h != 00h if area other than LMA-then-UMA, 543 <1> ; x = 20h --> x & ~20h = 00h if area is LMA-then-UMA 0 000068BF 742D jz .verify ; yes, proceed here --> 545 <1> ; After test, it is always NC here. 0 000068C1 EB13 jmp short .last ; (NC, NZ) else it's the last one (even if 'M') --> 547 <1> .notfirstumcb: 0 000068C3 803D4D cmp byte [di+mcbSignature], 'M' ; current in-chain ? 0 000068C6 7426 je .verify ; no --> 0 000068C8 36833E[0000]FE cmp word [ss:first_umcb], byte -2 ; any UMA ? 0 000068CE 7706 ja .last ; (NC, NZ) no, really last --> 0 000068D0 36F60470 test byte [ss:si], ~8Fh ; "UMA then LMA" ? 553 <1> ; x = 70h --> x & ~80h != 00h if area other than UMA-then-LMA, 554 <1> ; x = 80h --> x & ~80h = 00h if area is UMA-then-LMA 0 000068D4 7414 jz .firstlma ; yes, start to search LMA instead --> 556 <1> ; After test, it is always NC here. 557 <1> .last: 0 000068D6 B80800 mov ax, errorInsufficientMemory ; (NC, NZ) 0 000068D9 1F pop ds 560 <1> assume ds:nothing 0 000068DA C3 retn 562 <1> .first: 0 000068DB 36F604C0 test byte [ss:si], (80h|40h) ; "UMA then LMA" or "UMA only" ? 0 000068DF 7409 jz .firstlma ; no, start with LMA --> 0 000068E1 36A1[0000] mov ax, word [ss:first_umcb] ; yes, start with UMA 0 000068E5 83F8FF cmp ax, -1 ; UMA valid ? 0 000068E8 7504 jne .verify ; yes --> 568 <1> .firstlma: 0 000068EA 36A1[0000] mov ax, word [ss:first_mcb] ; start with LMA 570 <1> .verify: 571 <1> assume ds:MCB 0 000068EE E869FF call VerifyMCB ; NC, ZR if valid - CY if invalid 573 <1> .return: 0 000068F1 1F pop ds 575 <1> assume ds:nothing 0 000068F2 C3 retn 577 <1> %endif 578 <1> 579 <1> 580 <1> ; Release all memory of a specific owner 581 <1> ; 582 <1> ; INP: bx = MCB owner of which blocks are to be freed 583 <1> ; OUT: CY if MCB chain corrupted or loops, 584 <1> ; ax = error code 585 <1> ; NC if MCB chain valid 586 <1> ; CHG: ax 587 <1> ; STK: 13 word 588 <1> ReleaseOwnersMCBs: 589 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 000068F3 1E push ds 0 000068F4 57 push di 0 000068F5 E831FF call SetLinearMCBFlags ; set order for accessing all MCBs 593 <1> .loop: 594 <1> assume ds:nothing 0 000068F8 E8A0FF call SNextMCB ; ax = MCB 0 000068FB 720E jc .return 0 000068FD 750C jne .return 0 000068FF 8ED8 mov ds, ax ; ds = MCB 599 <1> assume ds:MCB 0 00006901 395D01 cmp word [di+mcbOwner], bx ; does block belong to owner ? 0 00006904 75F2 jne .loop ; no --> 0 00006906 E875FF call ClearMCB ; free up block 0 00006909 EBED jmp short .loop 604 <1> .return: 0 0000690B 5E pop si ; discard flags word 0 0000690C 5E pop si ; discard loop counter word 0 0000690D 5E pop si 0 0000690E 5F pop di 0 0000690F 1F pop ds 610 <1> assume ds:nothing 0 00006910 C3 retn 612 <1> 613 <1> 614 <1> ; Merge MCB with next one if possible 615 <1> ; 616 <1> ; INP: ds = ax = MCB 617 <1> ; word [ss:si] = 20h/10h (linear MCB flag setting) 618 <1> ; word [ss:si + 2] = loop detection counter 619 <1> ; OUT: CY if invalid MCB, 620 <1> ; ax = error code 621 <1> ; CY if no next MCB or next MCB is not free, 622 <1> ; ax = errorInsufficientMemory 623 <1> ; NC if valid next MCB was free, merged 624 <1> ; di = 0 625 <1> ; CHG: - 626 <1> ; STK: 10 word 627 <1> CollectNextFreeMCB: 628 <1> assume ds:MCB, es:nothing, ss:DOSGROUP 0 00006911 06 push es 0 00006912 E886FF call SNextMCB 0 00006915 721F jc .return 0 00006917 751F jne .notenough ; at last block, can't expand --> 633 <1> %if _UMA 0 00006919 E8D2FE call IsFirstUMCB? ; next is first UMCB ? 0 0000691C 741A je .notenough ; yes, can't expand --> 636 <1> %endif 0 0000691E 8EC0 mov es, ax ; address of next block 638 <1> assume es:MCB 0 00006920 26397D01 cmp word [es:di+mcbOwner], di ; is next block free ? 0 00006924 7512 jne .notenough ; no, can't expand --> 641 <1> 0 00006926 268A05 mov al, byte [es:di+mcbSignature] ; get letter of next MCB 0 00006929 8805 mov byte [di+mcbSignature], al ; adjust letter of MCB if next was 'Z' 0 0000692B 268B4503 mov ax, word [es:di+mcbSize] 0 0000692F 40 inc ax ; get size of next MCB (including the MCB) 0 00006930 014503 add word [di+mcbSize], ax ; expand MCB 647 <1> assume es:nothing 0 00006933 8CD8 mov ax, ds 0 00006935 F8 clc 650 <1> .return: 0 00006936 07 pop es 652 <1> assume es:nothing 0 00006937 C3 retn 654 <1> 655 <1> .notenough: 656 <1> assume es:nothing 0 00006938 F9 stc 0 00006939 B80800 mov ax, errorInsufficientMemory 0 0000693C 07 pop es 660 <1> assume es:nothing 0 0000693D C3 retn 662 <1> 663 <1> 664 <1> ; Collect free MCBs 665 <1> ; 666 <1> ; INP: - 667 <1> ; OUT: CY if MCB chain corrupted or loops, 668 <1> ; ax = error code 669 <1> ; NC if valid 670 <1> ; CHG: ax 671 <1> ; STK: 15 word 672 <1> ; 673 <1> ; Scans all MCBs and merges free ones together. 674 <1> CollectFreeMCBs: 675 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 0000693E 1E push ds 0 0000693F 57 push di 0 00006940 E8E6FE call SetLinearMCBFlags ; set order for accessing all MCBs 679 <1> .loop: 680 <1> assume ds:nothing 0 00006943 E855FF call SNextMCB ; ax = next MCB 0 00006946 7218 jc .return ; chain corrupted --> 0 00006948 7516 jne .return ; no next --> 684 <1> .check: 0 0000694A 8ED8 mov ds, ax ; ds = MCB 686 <1> assume ds:MCB 0 0000694C 397D01 cmp word [di+mcbOwner], di ; is block free ? 0 0000694F 75F2 jne .loop ; no, try next --> 689 <1> .again: 0 00006951 E8BDFF call CollectNextFreeMCB ; merge next with this one, if free 0 00006954 73FB jnc .again ; merged, check if next also free --> 0 00006956 83F808 cmp ax, errorInsufficientMemory ; was error "Not enough memory" ? 0 00006959 F9 stc 0 0000695A 7504 jne .return ; no, real error --> 0 0000695C 8CD8 mov ax, ds 0 0000695E EBE3 jmp short .loop ; try next block --> (SNextMCB reports if current was last) 697 <1> .return: 0 00006960 5E pop si ; discard flags word 0 00006961 5E pop si ; discard loop counter word 0 00006962 5E pop si 0 00006963 5F pop di 0 00006964 1F pop ds 703 <1> assume ds:nothing 0 00006965 C3 retn 705 <1> 706 <1> 707 <1> ; Split one MCB into two smaller MCBs 708 <1> ; 709 <1> ; INP: ds = ax = MCB 710 <1> ; di = 0 711 <1> ; cx = requested size of existing MCB 712 <1> ; (the MCB *MUST* be larger currently) 713 <1> ; dx = requested owner of new MCB 714 <1> ; OUT: dx = created new MCB (at ax+cx+1) 715 <1> ; NC if valid input 716 <1> ; CY if MCB size is smaller than or equal to cx, 717 <1> ; ax = error code (errorMCBDestroyed) 718 <1> ; CHG: cx 719 <1> ; STK: 5 word 720 <1> ; STT: ss need not equal DOSDATA 721 <1> ; 722 <1> ; Interestingly, this is the only code to create new MCBs. 723 <1> ; Functions not calling this code simply re-use existing MCBs. 724 <1> SplitMCB: 725 <1> assume ds:MCB, es:nothing, ss:nothing 0 00006966 50 push ax 0 00006967 51 push cx ; save new size of MCB 0 00006968 1E push ds 0 00006969 41 inc cx ; include size of the MCB itself 0 0000696A 01C8 add ax, cx ; ax = where to create new MCB 0 0000696C 50 push ax 0 0000696D 8B4503 mov ax, word [di+mcbSize] ; current size of MCB 0 00006970 29C8 sub ax, cx ; size of new MCB 0 00006972 7220 jc .internal_error 735 <1> ; CY here means MCB's size currently <= INP:cx. 736 <1> ; ax = 0 is valid, it means an MCB with size 0 is created. 737 <1> ; (The modified MCB is then shortened by 1 paragraph.) 0 00006974 8A0D mov cl, byte [di+mcbSignature] 0 00006976 1F pop ds ; ds = new MCB 740 <1> assume ds:MCB 0 00006977 E807FF call ClearMCBName ; clear name 0 0000697A 897D05 mov word [di+mcbReserved], di 0 0000697D 897D06 mov word [di+mcbReserved + 1], di ; clear reserved bytes 0 00006980 880D mov byte [di+mcbSignature], cl ; move letter of MCB to new one 0 00006982 894503 mov word [di+mcbSize], ax 0 00006985 895501 mov word [di+mcbOwner], dx ; set size and owner 0 00006988 8CDA mov dx, ds 0 0000698A 1F pop ds ; restore MCB's address 749 <1> assume ds:MCB 0 0000698B 8F4503 pop word [di+mcbSize] ; resize the existing MCB 0 0000698E C6054D mov byte [di+mcbSignature], 'M' ; link it to new one (if it was 'Z') 0 00006991 58 pop ax 0 00006992 F8 clc 0 00006993 C3 retn 755 <1> 756 <1> .internal_error: 0 00006994 58 pop ax 0 00006995 1F pop ds 759 <1> assume ds:MCB 0 00006996 58 pop ax 0 00006997 58 pop ax 0 00006998 31D2 xor dx, dx 0 0000699A B80700 mov ax, errorMCBDestroyed 0 0000699D F9 stc 0 0000699E C3 retn 766 <1> 767 <1> 768 <1> ; Modify MCB size 769 <1> ; 770 <1> ; INP: ax = memory block's segment 771 <1> ; bx = requested number of paragraphs 772 <1> ; OUT: bx = new size of block 773 <1> ; CY if error, 774 <1> ; ax = error code 775 <1> ; NC if successful, 776 <1> ; ax = memory block's segment 777 <1> ; CHG: - 778 <1> ; STK: 21 word 779 <1> ; 780 <1> ; Contraction involves splitting the block into two smaller 781 <1> ; portions. Expansion requires that the block which follows 782 <1> ; is empty. If it is, it is combined with the first block 783 <1> ; to create a huge block, which can then be split. 784 <1> ; 785 <1> ; As MS-DOS does, we'll extend the block to the maximum 786 <1> ; possible size if there's not enough free memory behind it 787 <1> ; to fulfill the request. Also copying MS-DOS's behaviour 788 <1> ; we'll set the owner of the resized MCB if it was resized 789 <1> ; successfully (NC). This allows to allocate specific MCBs, 790 <1> ; although I don't recommend to do so. 791 <1> ModifyMCB: 792 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 0000699F 52 push dx 0 000069A0 E8AAFE call GetMCBOwner ; dx = owner 0 000069A3 E80200 call ModifyMCBRandom 0 000069A6 5A pop dx 0 000069A7 C3 retn 798 <1> 799 <1> ; Modify MCB size with random owner 800 <1> ; 801 <1> ; INP: ax = memory block's segment 802 <1> ; bx = requested number of paragraphs 803 <1> ; dx = new owner 804 <1> ; OUT: bx = new size of block 805 <1> ; CY if error, 806 <1> ; ax = error code 807 <1> ; NC if successful, 808 <1> ; ax = memory block's segment 809 <1> ; CHG: - 810 <1> ; STK: 19 word 811 <1> ModifyMCBRandom: 812 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 813 <1> lframe near 0 000069A8 5589E5 lenter 815 <1> lvar word, alloc 0 000069AB 53 push bx 817 <1> lvar word, owner 0 000069AC 52 push dx 819 <1> 0 000069AD 52 push dx 0 000069AE 51 push cx 0 000069AF 57 push di 0 000069B0 1E push ds 0 000069B1 89C2 mov dx, ax 0 000069B3 E873FE call SetLinearMCBFlags ; set order for accessing all MCBs 0 000069B6 89D0 mov ax, dx ; (restore ax without push and pop) 0 000069B8 31DB xor bx, bx ; largest possible size of MCB, preset to zero 0 000069BA E8B7FE call GetMCBFromBlock ; get MCB from block address, ax = ds = MCB 829 <1> .compare_return_if_CY: 0 000069BD 721F jc .return ; invalid MCB --> 831 <1> .compare: 832 <1> assume ds:MCB 0 000069BF 8B5D03 mov bx, word [di+mcbSize] ; remember current size if request fails 0 000069C2 8B4EFE mov cx, word [bp + ?alloc] ; cx = requested size 0 000069C5 39D9 cmp cx, bx ; what action is required ? 0 000069C7 7207 jb .contract ; contraction --> 0 000069C9 740C je .success ; none, succeed --> 838 <1> .expand: 0 000069CB E843FF call CollectNextFreeMCB ; expansion, use next MCB if free 840 <1> ; jc .return ; not free, or MCB chain corrupted --> 0 000069CE EBED jmp short .compare_return_if_CY ; compare new size, expand again or contract --> 842 <1> .contract: 0 000069D0 31D2 xor dx, dx 0 000069D2 E891FF call SplitMCB ; free the unused high part of the MCB 0 000069D5 EBE6 jmp short .compare_return_if_CY ; set ?size and return (MCB size now equals _alloc) 846 <1> .success: 0 000069D7 40 inc ax ; point past MCB to actual allocation 0 000069D8 FF76FC push word [bp + ?owner] 0 000069DB 8F4501 pop word [di+mcbOwner] ; re-allocate MCB with requested owner 850 <1> 851 <1> ; Testing on MS-DOS 7.10 revealed that the owner is only 852 <1> ; set by 21.4A when the resizing was successful. A partial 853 <1> ; resize (that cannot be fulfilled entirely due to not 854 <1> ; enough free space) doesn't set the owner. 855 <1> .return: 856 <1> assume ds:nothing 0 000069DE 5E pop si ; discard flags word 0 000069DF 5E pop si ; discard loop counter word 0 000069E0 5E pop si 0 000069E1 1F pop ds 861 <1> assume ds:nothing 0 000069E2 5F pop di 0 000069E3 59 pop cx 0 000069E4 5A pop dx 0 000069E5 89EC5D lleave 0 000069E8 C3 lret 867 <1> 868 <1> 869 <1> %ifn _UMA ; (Currently only used in non-UMA build.) 870 <1> ; Allocate MCB 871 <1> ; 872 <1> ; INP: bx = requested number of paragraphs 873 <1> ; OUT: CY if error, 874 <1> ; ax = error code 875 <1> ; bx = paragraph size of largest available block (zero if not error 0008h) 876 <1> ; NC if successful, 877 <1> ; ax = segment address of allocation 878 <1> ; bx = paragraph size of allocation 879 <1> ; CHG: - 880 <1> ; STK: 23 word 881 <1> AllocateMCB: 882 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 883 <1> push cx 884 <1> %ifn _UMA 885 <1> mov ch, byte [ss:alloc_strategy_ext] 886 <1> mov cl, byte [ss:AllocMethod] ; cx = flags 887 <1> %else 888 <1> call GetMCBFlags ; cx = fixed flags 889 <1> %endif 890 <1> db __TEST_IMM8 ; (skip push) 891 <1> .flags_cx: 892 <1> push cx 893 <1> push dx 894 <1> call GetMCBOwner ; dx = owner 895 <1> call AllocateMCBRandom 896 <1> pop dx 897 <1> pop cx 898 <1> retn 899 <1> %endif 900 <1> 901 <1> 902 <1> ; Allocate MCB with random owner and flags 903 <1> ; 904 <1> ; INP: bx = requested number of paragraphs 905 <1> ; cx = allocation strategy 906 <1> ; dx = owner 907 <1> ; OUT: CY if error, 908 <1> ; ax = error code 909 <1> ; bx = paragraph size of largest available block (zero unless error 0008h) 910 <1> ; NC if successful, 911 <1> ; ax = segment address of allocation 912 <1> ; bx = paragraph size of allocation 913 <1> ; CHG: - 914 <1> ; STK: 20 word 915 <1> AllocateMCBRandom: 916 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 000069E9 E852FF call CollectFreeMCBs ; collect free blocks first 918 <1> ; CHG: ax 919 <1> ; We could jump here if CY was returned, indicating 920 <1> ; a corrupted MCB chain. However, if it is relevantly 921 <1> ; corrupted, this error will also occur later on. 922 <1> lframe near 923 <1> lvar word, loopcounter ; (immediately above ?flags) 924 <1> lvar word, flags 925 <1> lvar word, bestfit ; segment of best fit (if cx != FFFFh) 926 <1> lvar word, lastfit ; segment of last fit (if bx >= _alloc) 0 000069EC 5589E58D66F8 lenter 928 <1> lvar word, alloc 0 000069F2 53 push bx 930 <1> lvar word, owner 0 000069F3 52 push dx 932 <1> 0 000069F4 51 push cx 0 000069F5 52 push dx 0 000069F6 56 push si 0 000069F7 57 push di 0 000069F8 1E push ds 0 000069F9 8D76FC lea si, [bp + ?flags] ; ss:si-> flags 0 000069FC E8A6FD call FixMCBFlags ; fix flags to internally used ones 940 <1> %if _UMA 0 000069FF 36833E[0000]FF cmp word [ss:first_umcb], byte -1 ; UMA available ? 0 00006A05 7506 jne .umavalid 943 <1> %endif 0 00006A07 80E10F and cl, 0Fh 0 00006A0A 80C910 or cl, 10h ; force "LMA only" if no UMA available 946 <1> .umavalid: 0 00006A0D 36890C mov word [ss:si], cx ; store fixed flags 0 00006A10 31C0 xor ax, ax ; 0000h to get first MCB 0 00006A12 36894402 mov word [ss:si + 2], ax ; initialise loop counter 0 00006A16 31DB xor bx, bx 951 <1> ; variable: size of largest block available 0 00006A18 B9FFFF mov cx, 0FFFFh 953 <1> ; variable: best-fit excess size (excess size over requested) 954 <1> .loop: 955 <1> assume ds:nothing 0 00006A1B E87DFE call SNextMCB 0 00006A1E 727F jc .return ; chain corrupted --> 0 00006A20 7529 jne .end ; end of chain, look for best or last fit --> 0 00006A22 8ED8 mov ds, ax 960 <1> assume ds:MCB 0 00006A24 397D01 cmp word [di+mcbOwner], di ; free block ? 0 00006A27 75F2 jne .loop ; no, next --> 963 <1> 0 00006A29 8B5503 mov dx, word [di+mcbSize] ; get size 965 <1> 0 00006A2C 39D3 cmp bx, dx ; larger than previous largest ? 0 00006A2E 7302 jae .notlarger ; no --> 0 00006A30 89D3 mov bx, dx ; store as new largest 969 <1> .notlarger: 970 <1> 0 00006A32 2B56F6 sub dx, word [bp + ?alloc] ; large enough for request ? 0 00006A35 72E4 jb .loop ; no, next --> 0 00006A37 36F60403 test byte [ss:si], 03h ; strategy zero (first fit) ? 0 00006A3B 742C jz .alloc ; yes, allocate block now --> 975 <1> 0 00006A3D 8946F8 mov word [bp + ?lastfit], ax ; unconditionally store as last fit 977 <1> 0 00006A40 39D1 cmp cx, dx ; better than previous best ? 0 00006A42 7605 jbe .notbetter ; no --> (important: prefer previous if same) 0 00006A44 89D1 mov cx, dx 0 00006A46 8946FA mov word [bp + ?bestfit], ax ; store as new best 982 <1> .notbetter: 0 00006A49 EBD0 jmp short .loop 984 <1> 985 <1> ; ax = error code 0008h (errorInsufficientMemory) here 986 <1> .end: 987 <1> assume ds:nothing 0 00006A4B 36F60401 test byte [ss:si], 01h 0 00006A4F 7409 jz .notbestfit 0 00006A51 41 inc cx 0 00006A52 F9 stc 0 00006A53 744A jz .return ; (CY) no fit (cx was still FFFFh) --> 0 00006A55 8B46FA mov ax, word [bp + ?bestfit] 0 00006A58 EB0F jmp short .alloc 995 <1> .notbestfit: 0 00006A5A 36F60403 test byte [ss:si], 03h 0 00006A5E F9 stc 0 00006A5F 743E jz .return ; (CY) first fit requested but none found --> 0 00006A61 3B5EF6 cmp bx, word [bp + ?alloc] 0 00006A64 7239 jb .return ; (CY) no block large enough found --> 0 00006A66 8B46F8 mov ax, word [bp + ?lastfit] 1002 <1> .alloc: 0 00006A69 8ED8 mov ds, ax 1004 <1> assume ds:MCB 0 00006A6B 8B56F4 mov dx, word [bp + ?owner] 0 00006A6E 895501 mov word [di+mcbOwner], dx ; allocate it now 0 00006A71 E80DFE call ClearMCBName ; clear the name 0 00006A74 8B4D03 mov cx, word [di+mcbSize] ; get size of block 0 00006A77 2B4EF6 sub cx, word [bp + ?alloc] ; determine remaining block's size 0 00006A7A 741F je .done ; (NC) no remaining block --> 0 00006A7C 36F60402 test byte [ss:si], 02h ; last fit ? 0 00006A80 750C jnz .lastfit ; yes, use upper part --> 0 00006A82 8B4EF6 mov cx, word [bp + ?alloc] ; size of lower part (allocation) 0 00006A85 31D2 xor dx, dx ; free upper part 0 00006A87 E8DCFE call SplitMCB 0 00006A8A 7213 jc .return ; (else NC) 0 00006A8C EB0D jmp short .done 1018 <1> .lastfit: 0 00006A8E 49 dec cx 0 00006A8F E8D4FE call SplitMCB ; (dx = owner upper part, cx = size lower part) 0 00006A92 720B jc .return ; (else NC) 0 00006A94 897D01 mov word [di+mcbOwner], di ; free lower part 0 00006A97 89D0 mov ax, dx 0 00006A99 8EDA mov ds, dx ; set ds = ax = allocation 1025 <1> assume ds:MCB 1026 <1> .done: ; (NC) 1027 <1> assume ds:nothing 0 00006A9B 40 inc ax ; point past MCB 0 00006A9C 8B5D03 mov bx, word [di+mcbSize] ; allocated size 1030 <1> .return: 0 00006A9F 7308 jnc .noerror ; no error --> (actual allocation size) 0 00006AA1 83F808 cmp ax, errorInsufficientMemory ; "not enough memory" ? 0 00006AA4 7402 je .memerror ; bx set correctly --> (largest seen) 0 00006AA6 31DB xor bx, bx ; else report none free as largest 1035 <1> .memerror: 0 00006AA8 F9 stc ; set CY again 1037 <1> .noerror: 0 00006AA9 1F pop ds 1039 <1> assume ds:nothing 0 00006AAA 5F pop di 0 00006AAB 5E pop si 0 00006AAC 5A pop dx 0 00006AAD 59 pop cx 0 00006AAE 89EC5D lleave 0 00006AB1 C3 lret 1046 <1> 1047 <1> 1048 <1> ; Allocate largest MCB with random owner and flags 1049 <1> ; 1050 <1> ; INP: ax = requested maximal number of paragraphs (FFFFh for largest) 1051 <1> ; bx = requested minimal number of paragraphs 1052 <1> ; cx = allocation strategy 1053 <1> ; dx = owner 1054 <1> ; OUT: CY if error, 1055 <1> ; ax = error code 1056 <1> ; bx = paragraph size of largest available block (zero unless error 0008h) 1057 <1> ; NC if successful, 1058 <1> ; ax = segment address of allocation 1059 <1> ; bx = paragraph size of allocation 1060 <1> ; CHG: - 1061 <1> ; STK: 29 word 1062 <1> ; 1063 <1> ; If the requested maximal size is smaller than the requested minimal size, 1064 <1> ; the minimal size is forced to the requested maximal size. 1065 <1> AllocateLargestMCBRandom: 1066 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 1067 <1> .: 1068 <1> lframe near 0 00006AB2 5589E5 lenter 1070 <1> lvar word, min 0 00006AB5 53 push bx 1072 <1> 1073 <1> %if _UMA 0 00006AB6 36833E[0000]FF cmp word [ss:first_umcb], byte -1 ; UMA available ? 0 00006ABC 740F je .single ; nope, all area flags turn to "LMA only" anyway --> 0 00006ABE F6C180 test cl, 80h ; 80h "UMA then LMA" (top priority) ? 0 00006AC1 7523 jnz .dual ; yes, dual area --> 0 00006AC3 F6C140 test cl, 40h ; 40h "UMA only" (priority over 20h) ? 0 00006AC6 7505 jnz .single ; yes, single area --> 0 00006AC8 F6C120 test cl, 20h ; 20h "LMA then UMA" (priority over 10h) 0 00006ACB 7519 jnz .dual ; yes, dual area --> 1082 <1> .single: 1083 <1> %endif 0 00006ACD 89C3 mov bx, ax ; maximal size 0 00006ACF E817FF call AllocateMCBRandom ; request with maximal size 0 00006AD2 730E jnc .return ; if it succeeded --> 0 00006AD4 83F808 cmp ax, errorInsufficientMemory ; "not enough memory" error ? 0 00006AD7 F9 stc 0 00006AD8 7508 jne .return ; if not this error, invalid MCBs --> 0 00006ADA 3B5EFE cmp bx, word [bp + ?min] ; reported largest is large enough for request ? 0 00006ADD 7203 jb .return ; no, return the error as is --> (CY) 0 00006ADF E807FF call AllocateMCBRandom ; allocate the reported largest block, pass errors if any 1093 <1> .return: 1094 <1> %if _UMA 0 00006AE2 89EC5D lleave code 1096 <1> %else 1097 <1> lleave 1098 <1> %endif 0 00006AE5 C3 lret 1100 <1> 1101 <1> %if _UMA 1102 <1> ; Area flags involving two areas are split into two calls: 1103 <1> ; If the first area contains a block which is large enough, 1104 <1> ; it is preferred over a possibly larger block in the other 1105 <1> ; area and the other area won't be searched. The reported 1106 <1> ; largest block (if neither area contains one large enough) 1107 <1> ; is the larger one of these reported for both areas. 1108 <1> .dual: 1109 <1> lvar word, max 0 00006AE6 50 push ax 1111 <1> lvar word, flags 0 00006AE7 51 push cx 1113 <1> 0 00006AE8 51 push cx 0 00006AE9 E8B9FC call FixMCBFlags ; check whether multiple flags are set 0 00006AEC 80E10F and cl, 0Fh ; clear current flags 0 00006AEF 80C940 or cl, 40h ; second try "UMA only" 0 00006AF2 F646FA80 test byte [bp + ?flags], 80h ; requested "UMA then LMA" ? 0 00006AF6 7406 jz .dual_lmafirst ; no, must be "LMA then UMA" --> 1120 <1> %if _ERRORFLAGS 1121 <1> test byte [bp + ?flags], 40h|20h|10h ; either set ? (multiple) 1122 <1> jz .dual_validflags_umafirst 1123 <1> or byte [ss:error_flags], EF_MultipleAllocAreas ; yes, flag 1124 <1> .dual_validflags_umafirst: 1125 <1> %endif 0 00006AF8 80E10F and cl, 0Fh 0 00006AFB 80C910 or cl, 10h ; second try "LMA only" 1128 <1> .dual_lmafirst: 0 00006AFE 894EFA mov word [bp + ?flags], cx ; remember area for second try 0 00006B01 80F150 xor cl, 40h|10h ; set cx to the other one of the single areas 1131 <1> 0 00006B04 E8ABFF call . ; try to allocate in first area 0 00006B07 7321 jnc .dual_return ; (NC) success --> 0 00006B09 83F808 cmp ax, errorInsufficientMemory ; "not enough memory" error ? 0 00006B0C 751B jne .dual_error ; no, invalid MCB --> 0 00006B0E 8B4EFA mov cx, word [bp + ?flags] ; get other flags 0 00006B11 8B46FC mov ax, word [bp + ?max] ; restore maximal value 0 00006B14 875EFE xchg bx, word [bp + ?min] ; restore minimal value, save largest available 0 00006B17 E898FF call . ; try to allocate in second area instead 0 00006B1A 730E jnc .dual_return ; (NC) success --> 0 00006B1C 83F808 cmp ax, errorInsufficientMemory ; "not enough memory" error ? 0 00006B1F 7508 jne .dual_error ; no, invalid MCB --> 1143 <1> 0 00006B21 3B5EFE cmp bx, word [bp + ?min] ; second area contains larger free block ? 0 00006B24 7303 jae .dual_error ; yes --> 0 00006B26 8B5EFE mov bx, word [bp + ?min] ; return largest free block of first area instead 1147 <1> 1148 <1> .dual_error: 0 00006B29 F9 stc 1150 <1> .dual_return: 0 00006B2A 59 pop cx ; restore cx 0 00006B2B 89EC5D lleave 0 00006B2E C3 lret 1154 <1> %endif 1155 <1> 1156 <1> 1157 <1> ; Allocate MCB, compatible to MS-DOS 1158 <1> ; 1159 <1> ; INP: bx = requested number of paragraphs 1160 <1> ; OUT: CY if error, 1161 <1> ; ax = error code 1162 <1> ; bx = paragraph size of largest available block (zero if not error 0008h) 1163 <1> ; NC if successful, 1164 <1> ; ax = segment address of allocation 1165 <1> ; bx = paragraph size of allocation 1166 <1> ; CHG: - 1167 <1> ; 1168 <1> ; Note: This function implements the MS-DOS-compatible 1169 <1> ; handling where UMA-then-LMA is treated as two areas. 1170 <1> %if _UMA 1171 <1> AllocateMCBCompatible: 1172 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006B2F 51 push cx 0 00006B30 E8D4FC call GetMCBFlags ; cx = fixed flags 0 00006B33 A8 db __TEST_IMM8 ; (skip push) 1176 <1> .flags_cx: 0 00006B34 51 push cx 0 00006B35 52 push dx 0 00006B36 E814FD call GetMCBOwner ; dx = owner 0 00006B39 F6C502 test ch, 2 ; use lDOS meaning ? (one area) 0 00006B3C 750A jnz .default ; yes --> 0 00006B3E F6C504 test ch, 4 ; use two areas ? 0 00006B41 750B jnz @F ; yes --> 0 00006B43 F6C180 test cl, 80h ; is it UMA then LMA ? 0 00006B46 7506 jnz @F ; yes, use two areas--> 1186 <1> .default: 0 00006B48 E89EFE call AllocateMCBRandom ; else, simply use default 1188 <1> .end: 0 00006B4B 5A pop dx 0 00006B4C 59 pop cx 0 00006B4D C3 retn 1192 <1> 1193 <1> @@: 0 00006B4E 89D8 mov ax, bx ; set up maximum size = size 0 00006B50 E85FFF call AllocateLargestMCBRandom ; call two-area allocation 0 00006B53 EBF6 jmp .end 1197 <1> %else 1198 <1> AllocateMCBCompatible: equ AllocateMCB 1199 <1> AllocateMCBCompatible.flags_cx: equ AllocateMCB.flags_cx 1200 <1> %endif 1201 <1> 1202 <1> 1203 <1> %if 0 1204 <1> ; INP: dx = segment of which to get size 1205 <1> ; OUT: NC if not overlapping, 1206 <1> ; bx = size of that segment until next MCB 1207 <1> ; CY if overlapping (dx points to an MCB, 1208 <1> ; or not inside any of the MCBs, 1209 <1> ; or inside a free MCB), 1210 <1> ; bx = 0 1211 <1> ; ax = error code 1212 <1> ; CHG: ax 1213 <1> GetSizeInMCB: 1214 <1> assume ds:nothing, es:nothing, ss:DOSGROUP 1215 <1> xor bx, bx 1216 <1> push cx 1217 <1> push ds 1218 <1> push di 1219 <1> call SetLinearMCBFlags ; set order for accessing all MCBs 1220 <1> .loop: 1221 <1> call SNextMCB ; ax = next MCB 1222 <1> jc .return ; chain corrupted --> 1223 <1> jne .error ; no next --> 1224 <1> .check: 1225 <1> mov ds, ax ; ds = MCB 1226 <1> assume ds:MCB 1227 <1> cmp dx, ax 1228 <1> jbe .error 1229 <1> mov cx, ax 1230 <1> add cx, word [di+mcbSize] 1231 <1> inc cx ; => next MCB 1232 <1> cmp dx, cx ; is it equal-to-or-above the next MCB? 1233 <1> jae .loop ; yes, next --> 1234 <1> cmp word [di+mcbOwner], di ; is this block free ? 1235 <1> je .error ; yes --> 1236 <1> sub cx, dx ; (next MCB) - (block address) 1237 <1> mov bx, cx ; size 1238 <1> clc 1239 <1> jmp .return 1240 <1> 1241 <1> .error: 1242 <1> assume ds:nothing 1243 <1> xor bx, bx 1244 <1> mov ax, errorMCBInvalid 1245 <1> stc 1246 <1> .return: 1247 <1> assume ds:nothing 1248 <1> pop si ; discard flags word 1249 <1> pop si ; discard loop counter word 1250 <1> pop si 1251 <1> pop di 1252 <1> pop ds 1253 <1> assume ds:nothing 1254 <1> pop cx 1255 <1> retn 1256 <1> %endif 69 70 global ReleaseOwnersMCBs 71 global arena_free_process 72 arena_free_process equ ReleaseOwnersMCBs 73 74 75 procedure D_ALLOC,NEAR 75 ****************** warning: proc D_ALLOC... [-w+user] 76 assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006B55 E8[0000] EnterCrit critMem 0 00006B58 E8D4FF call AllocateMCBCompatible 79 return_CF_bx_crit: 0 00006B5B 7315 jnc return_CF_crit 0 00006B5D 83F808 cmp ax, errorInsufficientMemory 0 00006B60 751B jne return_CY_crit 0 00006B62 E8[0000] invoke get_user_stack 0 00006B65 895C02 mov [si + user_BX], bx 0 00006B68 EB13 jmp return_CY_crit 86 EndProc D_ALLOC 87 88 89 procedure D_DEALLOC,NEAR 89 ****************** warning: proc D_DEALLOC... [-w+user] 90 assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006B6A E8[0000] EnterCrit critMem 0 00006B6D 8CC0 mov ax, es 0 00006B6F E81CFD call ReleaseMCB 94 return_CF_crit: 0 00006B72 E8[0000] LeaveCrit critMem 96 return_CF: 0 00006B75 7203 jc .err 0 00006B77 E9[0000] transfer SYS_RET_OK 99 .err: 0 00006B7A E9[0000] transfer SYS_RET_ERR 101 EndProc D_DEALLOC 102 103 return_CY_crit: 0 00006B7D F9 stc 0 00006B7E EBF2 jmp return_CF_crit 106 107 108 procedure D_SETBLOCK,NEAR 108 ****************** warning: proc D_SETBLOCK... [-w+user] 109 assume ds:nothing, es:nothing, ss:DOSGROUP 0 00006B80 E8[0000] EnterCrit critMem 0 00006B83 8CC0 mov ax, es 0 00006B85 E817FE call ModifyMCB 0 00006B88 EBD1 jmp return_CF_bx_crit 114 EndProc D_SETBLOCK 115 116 117 %else 118 ; 119 ; arena_free_process 120 ; input: BX - PID of process 121 ; output: free all blocks allocated to that PID 122 ; 123 procedure arena_free_process,NEAR 124 ASSUME DS:NOTHING,ES:NOTHING 125 MOV DI,arena_signature 126 MOV AX,[ss:arena_head] 127 Check_Signature equ check_signature ; NASM port label 128 CALL Check_Signature ; ES <- AX, check for valid block 129 130 arena_free_process_loop: 131 retc 132 PUSH ES 133 POP DS 134 CMP [arena_owner],BX ; is block owned by pid? 135 JNZ arena_free_next ; no, skip to next 136 MOV [arena_owner],DI ; yes... free him 137 138 arena_free_next: 139 CMP BYTE PTR [DI],arena_signature_end 140 ; end of road, Jack? 141 retz ; never come back no more 142 CALL arena_next ; next item in ES/AX carry set if trash 143 JMP arena_free_process_loop 144 145 EndProc arena_free_process 146 147 ; 148 ; arena_next 149 ; input: DS - pointer to block head 150 ; output: AX,ES - pointers to next head 151 ; carry set if trashed arena 152 ; 153 procedure arena_next,NEAR 154 ASSUME DS:NOTHING,ES:NOTHING 155 MOV AX,DS ; AX <- current block 156 ADD AX,[arena_size] ; AX <- AX + current block length 157 INC AX ; remember that header! 158 ; 159 ; fall into check_signature and return 160 ; 161 ; CALL check_signature ; ES <- AX, carry set if error 162 ; RET 163 EndProc arena_next 164 165 ; 166 ; check_signature 167 ; input: AX - address of block header 168 ; output: ES=AX, carry set if signature is bad 169 ; 170 procedure check_signature,NEAR 171 ASSUME DS:NOTHING,ES:NOTHING 172 MOV ES,AX ; ES <- AX 173 CMP BYTE PTR [ES:DI],arena_signature_normal 174 ; IF next signature = not_end THEN 175 retz ; GOTO ok 176 CMP BYTE PTR [ES:DI],arena_signature_end 177 ; IF next signature = end then 178 retz ; GOTO ok 179 STC ; set error 180 return 181 182 EndProc Check_signature 183 184 ; 185 ; Coalesce - combine free blocks ahead with current block 186 ; input: DS - pointer to head of free block 187 ; output: updated head of block, AX is next block 188 ; carry set -> trashed arena 189 ; 190 procedure Coalesce,NEAR 191 ASSUME DS:NOTHING,ES:NOTHING 192 CMP BYTE PTR [DI],arena_signature_end 193 ; IF current signature = END THEN 194 retz ; GOTO ok 195 CALL arena_next ; ES, AX <- next block, Carry set if error 196 retc ; IF no error THEN GOTO check 197 198 coalesce_check: 199 CMP [ES:arena_owner],DI 200 retnz ; IF next block isnt free THEN return 201 MOV CX,[ES:arena_size] ; CX <- next block size 202 INC CX ; CX <- CX + 1 (for header size) 203 ADD [arena_size],CX ; current size <- current size + CX 204 MOV CL,[ES:DI] ; move up signature 205 MOV [DI],CL 206 coalesce equ Coalesce ; NASM port label 207 JMP coalesce ; try again 208 EndProc Coalesce 209 210 ;SUBTTL $Alloc - allocate space in memory 211 ;PAGE 212 ; 213 ; Assembler usage: 214 ; MOV BX,size 215 ; MOV AH,Alloc 216 ; INT 21h 217 ; AX:0 is pointer to allocated memory 218 ; BX is max size if not enough memory 219 ; 220 ; Description: 221 ; Alloc returns a pointer to a free block of 222 ; memory that has the requested size in paragraphs. 223 ; 224 ; Error return: 225 ; AX = error_not_enough_memory 226 ; = error_arena_trashed 227 ; 228 procedure D_ALLOC,NEAR 229 ASSUME DS:NOTHING,ES:NOTHING 230 231 EnterCrit critMem 232 XOR AX,AX 233 MOV DI,AX 234 235 MOV [ss:FirstArena],AX ; init the options 236 MOV [ss:BestArena],AX 237 MOV [ss:LastArena],AX 238 239 PUSH AX ; alloc_max <- 0 240 MOV AX,[ss:arena_head] ; AX <- beginning of arena 241 Check_signature equ check_signature ; NASM port label 242 CALL Check_signature ; ES <- AX, carry set if error 243 JC alloc_err ; IF error THEN GOTO err 244 245 alloc_scan: 246 PUSH ES 247 POP DS ; DS <- ES 248 CMP [arena_owner],DI 249 JZ alloc_free ; IF current block is free THEN examine 250 251 alloc_next: 252 CMP BYTE PTR [DI],arena_signature_end 253 ; IF current block is last THEN 254 JZ alloc_end ; GOTO end 255 CALL arena_next ; AX, ES <- next block, Carry set if error 256 JNC alloc_scan ; IF no error THEN GOTO scan 257 258 alloc_err: 259 POP AX 260 261 alloc_trashed: 262 LeaveCrit critMem 263 error error_arena_trashed 264 265 alloc_end: 266 CMP word [ss:FirstArena],0 267 JNZ alloc_do_split 268 269 alloc_fail: 270 invoke get_user_stack 271 POP BX 272 MOV [SI + user_BX],BX 273 LeaveCrit critMem 274 error error_not_enough_memory 275 276 alloc_free: 277 CALL coalesce ; add following free block to current 278 JC alloc_err ; IF error THEN GOTO err 279 MOV CX,[arena_size] 280 281 POP DX ; check for max found size 282 CMP CX,DX 283 JNA alloc_test 284 MOV DX,CX 285 286 alloc_test: 287 PUSH DX 288 CMP BX,CX ; IF BX > size of current block THEN 289 JA alloc_next ; GOTO next 290 291 CMP word [ss:FirstArena],0 292 JNZ alloc_best 293 MOV [ss:FirstArena],DS ; save first one found 294 alloc_best: 295 CMP word [ss:BestArena],0 296 JZ alloc_make_best ; initial best 297 PUSH ES 298 MOV ES,[ss:BestArena] 299 CMP [ES:arena_size],CX ; is size of best larger than found? 300 POP ES 301 JBE alloc_last 302 alloc_make_best: 303 MOV [ss:BestArena],DS ; assign best 304 alloc_last: 305 MOV [ss:LastArena],DS ; assign last 306 JMP alloc_next 307 308 ; 309 ; split the block high 310 ; 311 alloc_do_split_high: 312 MOV DS,[ss:LastArena] 313 MOV CX,[arena_size] 314 SUB CX,BX 315 MOV DX,DS 316 JE alloc_set_owner ; sizes are equal, no split 317 ADD DX,CX ; point to next block 318 MOV ES,DX ; no decrement! 319 DEC CX 320 XCHG BX,CX ; bx has size of lower block 321 JMP alloc_set_sizes ; cx has upper (requested) size 322 nop ; identicalise 323 324 ; 325 ; we have scanned memory and have found all appropriate blocks 326 ; check for the type of allocation desired; first and best are identical 327 ; last must be split high 328 ; 329 alloc_do_split: 330 CMP BYTE PTR [ss:AllocMethod], 1 331 JA alloc_do_split_high 332 MOV DS,[ss:FirstArena] 333 JB alloc_get_size 334 MOV DS,[ss:BestArena] 335 alloc_get_size: 336 MOV CX,[arena_size] 337 SUB CX,BX ; get room left over 338 MOV AX,DS 339 MOV DX,AX ; save for owner setting 340 JE alloc_set_owner ; IF BX = size THEN (don't split) 341 ADD AX,BX 342 INC AX ; remember the header 343 MOV ES,AX ; ES <- DS + BX (new header location) 344 DEC CX ; CX <- size of split block 345 alloc_set_sizes: 346 MOV [arena_size],BX ; current size <- BX 347 MOV [ES:arena_size],CX ; split size <- CX 348 MOV BL,arena_signature_normal 349 XCHG BL,[DI] ; current signature <- 4D 350 MOV [ES:DI],BL ; new block sig <- old block sig 351 MOV [ES:arena_owner],DI 352 353 alloc_set_owner: 354 MOV DS,DX 355 MOV AX,[ss:CurrentPDB] 356 MOV [arena_owner],AX 357 MOV AX,DS 358 INC AX 359 POP BX 360 LeaveCrit critMem 361 transfer SYS_RET_OK 362 363 EndProc D_alloc 364 365 ;SUBTTL $SETBLOCK - change size of an allocated block (if possible) 366 ;PAGE 367 ; 368 ; Assembler usage: 369 ; MOV ES,block 370 ; MOV BX,newsize 371 ; MOV AH,setblock 372 ; INT 21h 373 ; if setblock fails for growing, BX will have the maximum 374 ; size possible 375 ; Error return: 376 ; AX = error_invalid_block 377 ; = error_arena_trashed 378 ; = error_not_enough_memory 379 ; = error_invalid_function 380 ; 381 procedure D_SETBLOCK,NEAR 382 ASSUME DS:NOTHING,ES:NOTHING 383 EnterCrit critMem 384 MOV DI,arena_signature 385 MOV AX,ES 386 DEC AX 387 CALL check_signature 388 JNC setblock_grab 389 390 setblock_bad: 391 JMP alloc_trashed 392 393 setblock_grab: 394 MOV DS,AX 395 CALL coalesce 396 JC setblock_bad 397 MOV CX,[arena_size] 398 PUSH CX 399 CMP BX,CX 400 JBE alloc_get_size 401 JMP alloc_fail 402 EndProc D_setblock 403 404 ;SUBTTL $DEALLOC - free previously allocated piece of memory 405 ;PAGE 406 ; 407 ; Assembler usage: 408 ; MOV ES,block 409 ; MOV AH,dealloc 410 ; INT 21h 411 ; 412 ; Error return: 413 ; AX = error_invalid_block 414 ; = error_arena_trashed 415 ; 416 procedure D_DEALLOC,NEAR 417 ASSUME DS:NOTHING,ES:NOTHING 418 EnterCrit critMem 419 MOV DI,arena_signature 420 MOV AX,ES 421 DEC AX 422 CALL check_signature 423 JC dealloc_err 424 MOV [ES:arena_owner],DI 425 LeaveCrit critMem 426 transfer SYS_RET_OK 427 428 dealloc_err: 429 LeaveCrit critMem 430 error error_invalid_block 431 EndProc D_DEALLOC 432 %endif 433 434 ;SUBTTL $AllocOper - get/set allocation mechanism 435 ;PAGE 436 ; 437 ; Assembler usage: 438 ; MOV AH,AllocOper 439 ; MOV BX,method 440 ; MOV AL,func 441 ; INT 21h 442 ; 443 ; Error return: 444 ; AX = error_invalid_function 445 ; 446 procedure D_AllocOper,NEAR 446 ****************** warning: proc D_AllocOper... [-w+user] 447 assume ds:nothing, es:nothing, ss:DOSGROUP 448 %ifdef LDOSMEM 0 00006B8A 3C03 cmp al, 3 0 00006B8C 7767 ja alloc_oper_invalid 0 00006B8E 740E je set_umb_link 452 %endif 0 00006B90 3C01 CMP AL,1 0 00006B92 726B JB AllocOperGet 0 00006B94 7476 JZ AllocOperSet 456 %ifdef LDOSMEM 457 get_umb_link: 0 00006B96 31C0 xor ax, ax 0 00006B98 36A0[0000] mov al, byte [ss:enable_uma] ; get allow/disallow flag 0 00006B9C EBD9 transfer SYS_RET_OK 461 462 set_umb_link: 0 00006B9E 368B16[0000] mov dx, word [ss:first_umcb] ; any UMA ? 0 00006BA3 83FAFF cmp dx, -1 0 00006BA6 7507 jne .got 466 467 .none: 0 00006BA8 F6C301 test bl, 1 ; (NC) 0 00006BAB 7548 jnz alloc_oper_invalid 0 00006BAD EB41 jmp alloc_oper_CF 471 472 .got: 0 00006BAF E8[0000] EnterCrit critMem 0 00006BB2 50 push ax 0 00006BB3 E873FC call SetLinearMCBFlags ; ax = 0 = get first MCB 476 .next: 0 00006BB6 89C2 mov dx, ax ; remember MCB in case it is the target 0 00006BB8 E8E0FC call SNextMCB ; get next MCB 0 00006BBB 722D jc .end 0 00006BBD 7527 jnz .error ; end ? UMCB not found --> 0 00006BBF 363B06[0000] cmp ax, word [ss:first_umcb] ; this the first UMCB ? 0 00006BC4 75F0 jne .next ; no, loop --> 483 0 00006BC6 85D2 test dx, dx ; no previous ? 0 00006BC8 741C jz .error ; if so, error --> 0 00006BCA 8EC2 mov es, dx ; => MCB that points to first UMCB 487 assume es:MCB 0 00006BCC F6C301 test bl, 1 ; (NC) 0 00006BCF 7408 jz .set_Z ; 0, set to 'Z' --> 490 .set_M: 0 00006BD1 26C60600004D mov byte [es:mcbSignature], "M" ; nonzero, set to 'M' 0 00006BD7 EB06 jmp @F 493 .set_Z: 0 00006BD9 26C60600005A mov byte [es:mcbSignature], "Z" 495 @@: 496 %if _ERRORFLAGS 497 test bh, bh 498 jz @F 499 or byte [ss:error_flags], EF_InvalidUMBLink ; invalid UMB link bits set 500 @@: 501 %endif 0 00006BDF 36881E[0000] mov byte [ss:enable_uma], bl ; store UMB link 0 00006BE4 EB04 jmp .end 504 505 .error: 506 assume es:nothing 0 00006BE6 B80700 mov ax, errorMCBDestroyed 0 00006BE9 F9 stc 509 .end: 0 00006BEA 5E pop si ; discard flags word 0 00006BEB 5E pop si ; discard loop counter word 0 00006BEC 5E pop si 0 00006BED E8[0000] LeaveCrit critMem 514 alloc_oper_CF: 0 00006BF0 7317 jnc alloc_oper_ok_ax 0 00006BF2 5E pop si 0 00006BF3 EB85 transfer SYS_RET_ERR 518 %endif 519 520 alloc_oper_invalid: 521 errLoc_mem equ errLOC_Mem ; NASM port equate 0 00006BF5 36C606[0000]05 MOV byte [ss:EXTERR_LOCUS],errLoc_mem ; Extended Error Locus 0 00006BFB B001EBF4 error error_invalid_function 524 AllocOperGet: 0 00006BFF 36A0[0000] MOV AL,BYTE PTR [ss:AllocMethod] 526 %ifdef LDOSMEM 0 00006C03 368A26[0000] mov ah, [ss:alloc_strategy_ext] 528 529 alloc_oper_ok: 0 00006C08 A8 db __TEST_IMM8 ; (skip pop) 531 alloc_oper_ok_ax: 0 00006C09 58 pop ax 533 %else 534 mov ah, 0 535 %endif 0 00006C0A EB90 transfer SYS_RET_OK 537 AllocOperSet: 0 00006C0C 36881E[0000] MOV [ss:AllocMethod],BL 0 00006C11 36883E[0000] mov [ss:alloc_strategy_ext], bh 0 00006C16 EBF2 transfer SYS_RET_OK 541 EndProc D_AllocOper 542 543 END === Trace listing source: ../DOS/srvcall.lst 1 ; SCCSID = @(#)srvcall.asm 1.4 85/08/02 2 ;TITLE SRVCALL - Server DOS call 3 ;NAME SRVCALL 4 ; 5 ; Server DOS call functions 6 ; 7 ; 8 ; $ServerCall 9 ; 10 ; Modification history: 11 ; 12 ; Created: ARR 08 August 1983 13 ; 14 15 [list -] 15 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 20 21 [list +] === Switch to base=002450h -> "DOSCODECODE" 22 section DOSCODECODE 23 [list -] 23 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 23 ****************** warning: out: BPB.INC... [-w+user] 23 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 23 ****************** warning: out: DEVSYM.INC... [-w+user] 30 31 %ifndef Installed 32 %iassign Installed 0 33 %endif 34 35 %include "dpl.nas" 1 <1> ; SCCSID = @(#)dpl.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dpl.asm 1.1 85/04/10 3 <1> DPL STRUC 0 00006C18 ???? DPL_AX DW ? ; AX register 0 00006C1A ???? DPL_BX DW ? ; BX register 0 00006C1C ???? DPL_CX DW ? ; CX register 0 00006C1E ???? DPL_DX DW ? ; DX register 0 00006C20 ???? DPL_SI DW ? ; SI register 0 00006C22 ???? DPL_DI DW ? ; DI register 0 00006C24 ???? DPL_DS DW ? ; DS register 0 00006C26 ???? DPL_ES DW ? ; ES register 0 00006C28 ???? DPL_reserved DW ? ; Reserved 0 00006C2A ???? DPL_UID DW ? ; User (Machine) ID (0 = local macine) 0 00006C2C ???? DPL_PID DW ? ; Process ID (0 = local user PID) 15 <1> DPL ENDS 36 37 %iassign Installed TRUE 38 39 i_need USER_ID,WORD 40 i_need PROC_ID,WORD 41 i_need SaveBX,WORD 42 i_need SaveDS,WORD 43 i_need SWAP_START,BYTE 44 i_need SWAP_ALWAYS,BYTE 45 i_need SWAP_END,BYTE 46 I_Need ThisSFT,DWORD 47 I_need fSharing,BYTE 48 i_need OpenBuf,128 49 I_Need ExtErr,WORD 50 I_Need ExtErr_Action,BYTE 51 I_Need ExtErrPt,DWORD 52 I_Need EXTERR_LOCUS,BYTE ; Extended Error Locus 53 i_need JShare,DWORD 54 i_need SWAP_AREA_TABLE,BYTE 55 i_need SWAP_ALWAYS_AREA,DWORD 56 i_need SWAP_ALWAYS_AREA_LEN,WORD 57 i_need SWAP_AREA_LEN,WORD 58 59 BREAK 60 === Switch to base=002450h -> "DOSCODETABLE" 61 section DOSCODETABLE 62 Public SRVC001S,SRVC001E 63 SRVC001S label byte 64 65 align 2, db 0 66 DOSGroup equ DOSGROUP ; NASM port equate 67 Server_Disp equ SERVER_DISP ; NASM port label 0 000007E8 [0500] ServerTab DW Server_Disp 0 000007EA [4800] SERVERLEAVE DW ServerReturn 0 000007EC 00 db 0 0 000007ED 0B SERVER_DISP DB (SERVER_DISP_END-SERVER_DISP-1)/2 0 000007EE [AD00] DW OFFSET SRV_CALL ; 0 0 000007F0 [4900] DW OFFSET COMMIT_ALL ; 1 0 000007F2 [7C00] DW OFFSET CLOSE_NAME ; 2 0 000007F4 [8700] DW OFFSET CLOSE_UID ; 3 0 000007F6 [8E00] DW OFFSET CLOSE_UID_PID ; 4 0 000007F8 [9500] DW OFFSET GET_LIST ; 5 0 000007FA [EE00] DW OFFSET GET_DOS_DATA ; 6 0 000007FC [0F01] DW OFFSET SPOOL_OPER ; 7 0 000007FE [0F01] DW OFFSET SPOOL_OPER ; 8 0 00000800 [0F01] DW OFFSET SPOOL_OPER ; 9 82 D_setExtendedError equ D_SetExtendedError ; NASM port label 0 00000802 [1D01] DW OFFSET D_setExtendedError ; 10 84 SERVER_DISP_END LABEL BYTE 85 86 SRVC001E label byte 87 === Switch to base=002450h -> "DOSCODECODE" 88 section DOSCODECODE 89 90 assume nocheck, ss:DOSGROUP 91 92 ; Inputs: 93 ; DS:DX -> DPL (except calls 7,8,9) 94 ; Function: 95 ; AL=0 Server DOS call 96 ; AL=1 Commit All files 97 ; AL=2 Close file by name (SHARING LOADED ONLY) DS:DX in DPL -> name 98 ; AL=3 Close all files for DPL_UID 99 ; AL=4 Close all files for DPL_UID/PID_PID 100 ; AL=5 Get open file list entry 101 ; IN: BX File Index 102 ; CX User Index 103 ; OUT:ES:DI -> Name 104 ; BX = UID 105 ; CX = # locked blocks held by this UID 106 ; AL=6 Get DOS data area 107 ; OUT: DS:SI -> Start 108 ; CX size in bytes of swap if indos 109 ; DX size in bytes of swap always 110 ; AL=7 Get truncate flag 111 ; AL=8 Set truncate flag 112 ; AL=9 Close all spool files 113 ; AL=10 SetExtendedError 114 ; AL=11 DOS4.00 Get DOS data area 115 ; DS:SI -> swap table 116 117 procedure D_ServerCall,NEAR 117 ****************** warning: proc D_ServerCall... [-w+user] 118 ASSUME DS:NOTHING,ES:NOTHING 0 00006C18 3C07 CMP AL,7 0 00006C1A 7219 JB SET_STUFF 0 00006C1C 3C09 CMP AL,9 0 00006C1E 7627 JBE NO_SET_ID ; No DPL on calls 7,8,9 0 00006C20 3C0B CMP AL,11 ;IFS. ;AN000; 0 00006C22 7511 JNZ SET_STUFF ;IFS. ;AN000; 0 00006C24 BF[0000] MOV DI,OFFSET SWAP_AREA_TABLE wrt DOSGROUP ;IFS. ;AN000; 0 00006C27 16 PUSH SS ;IFS. ;AN000; 0 00006C28 07 POP ES ;IFS. ;AN000; 128 assume es:DOSGROUP 0 00006C29 E8[0000] invoke GET_USER_STACK ;IFS. ;AN000; 0 00006C2C 8C440E MOV [SI + user_DS],ES ;IFS. ds:si -> swap tab ;AN000; 0 00006C2F 897C08 MOV [SI + user_SI],DI ;IFS. ;AN000; 0 00006C32 E9[0000] transfer SYS_RET_OK ;IFS. ;AN000; 133 SET_STUFF: 0 00006C35 89D6 MOV SI,DX ; Point to DPL with DS:SI 0 00006C37 8B5C12 MOV BX,[SI + DPL_UID] 0 00006C3A 36891E[0000] MOV [ss:USER_ID],BX ; Set UID 0 00006C3F 8B5C14 MOV BX,[SI + DPL_PID] 0 00006C42 36891E[0000] MOV [ss:PROC_ID],BX ; Set process ID 139 NO_SET_ID: 0 00006C47 2EFF36[0200] PUSH word [cs:SERVERLEAVE] ; push return address 0 00006C4C 2EFF36[0000] PUSH word [cs:ServerTab] ; push table address 0 00006C51 50 PUSH AX 0 00006C52 E8[0000] Invoke TableDispatch 144 errLoc_Unk equ errLOC_Unk ; NASM port equate 0 00006C55 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLoc_Unk ; Extended Error Locus 0 00006C5B B001E9[0000] error error_invalid_function 147 ServerReturn: 0 00006C60 C3 return 149 150 ; Commit - iterate through the open file list and make sure that the 151 ; directory entries are correctly updated. 152 153 COMMIT_ALL: 154 ASSUME DS:NOTHING,ES:NOTHING 0 00006C61 31DB XOR BX,BX ; for (i=0; ThisSFT=getSFT(i); i++) 0 00006C63 161F Context DS 0 00006C65 E8[0000] EnterCrit critSFT ; Gonna scan SFT cache, lock it down 158 CommitLoop: 0 00006C68 53 SaveReg 0 00006C69 E8[0000] Invoke SFFromSFN 0 00006C6C 7220 JC CommitDone 162 sf_Ref_Count equ sf_ref_count ; NASM port equate 0 00006C6E 26833D00 CMP word [ES:DI + sf_Ref_Count],0 ; if (ThisSFT->refcount != 0) 0 00006C72 7416 JZ CommitNext 0 00006C74 26833DFF CMP word [ES:DI + sf_Ref_Count],sf_busy ; BUSY SFTs have god knows what 0 00006C78 7410 JZ CommitNext ; in them. 167 ; TEST [ES:DI].sf_flags,sf_isnet 0 00006C7A E8[0000] invoke Test_IFS_Remote ;IFS. ;AN000; 0 00006C7D 750B JNZ CommitNext ; Skip Network SFTs so the SERVER 170 ; doesn't deadlock 0 00006C7F 893E[0000] MOV WORD PTR [ThisSFT],DI 0 00006C83 8C06[0200] MOV WORD PTR [ThisSFT+2],ES 0 00006C87 E8[0000] Invoke DOS_Commit ; DOSCommit (); 174 CommitNext: 0 00006C8A 5B RestoreReg 0 00006C8B 43 INC BX 0 00006C8C EBDA JMP CommitLoop 178 CommitDone: 0 00006C8E E8[0000] LeaveCrit critSFT 0 00006C91 5B RestoreReg 0 00006C92 EB9E transfer Sys_Ret_OK 182 183 CLOSE_NAME: 184 ASSUME DS:NOTHING,ES:NOTHING 185 186 %if installed 0 00006C94 36FF1E[1400] Call far [ss:JShare + 5 * 4] 188 %else 189 Call MFTcloN 190 %endif 191 CheckReturns: 0 00006C99 7202 JC func_err 0 00006C9B EBF5 transfer SYS_RET_OK 194 func_err: 0 00006C9D EBBE transfer SYS_RET_ERR 196 197 CLOSE_UID: 198 ASSUME DS:NOTHING,ES:NOTHING 199 200 %if installed 0 00006C9F 36FF1E[0C00] Call far [ss:JShare + 3 * 4] 202 %else 203 Call MFTclU 204 %endif 0 00006CA4 EBF3 JMP CheckReturns 206 207 CLOSE_UID_PID: 208 ASSUME DS:NOTHING,ES:NOTHING 209 210 %if installed 0 00006CA6 36FF1E[1000] Call far [ss:JShare + 4 * 4] 212 %else 213 Call MFTCloseP 214 %endif 0 00006CAB EBEC JMP CheckReturns 216 217 GET_LIST: 218 ASSUME DS:NOTHING,ES:NOTHING 219 %if installed 0 00006CAD 36FF1E[2400] Call far [ss:JShare + 9 * 4] 221 %else 222 Call MFT_get 223 %endif 0 00006CB2 72E9 JC func_err 0 00006CB4 E8[0000] invoke get_user_stack 0 00006CB7 895C02 MOV [SI + user_BX],BX 0 00006CBA 897C0A MOV [SI + user_DI],DI 0 00006CBD 8C4410 MOV [SI + user_ES],ES 229 SetCXOK: 0 00006CC0 894C04 MOV [SI + user_CX],CX 0 00006CC3 EBD6 transfer SYS_RET_OK 232 233 SRV_CALL: 234 ASSUME DS:NOTHING,ES:NOTHING 0 00006CC5 58 POP AX ; get rid of call to $srvcall 0 00006CC6 1E56 SaveReg 0 00006CC8 E8[0000] invoke GET_USER_STACK 0 00006CCB 5F07 RestoreReg 239 assume es:nothing 240 ; 241 ; DS:SI point to stack 242 ; ES:DI point to DPL 243 ; 0 00006CCD E8[0000] invoke XCHGP 245 ; 246 ; DS:SI point to DPL 247 ; ES:DI point to stack 248 ; 249 ; We now copy the registers from DPL to save stack 250 ; 0 00006CD0 56 SaveReg 0 00006CD1 B90600 MOV CX,6 0 00006CD4 F3A5 REP MOVSW ; Put in AX,BX,CX,DX,SI,DI 0 00006CD6 47 INC DI 0 00006CD7 47 INC DI ; Skip user_BP 0 00006CD8 A5 MOVSW ; DS 0 00006CD9 A5 MOVSW ; ES 0 00006CDA 5E RestoreReg ; DS:SI -> DPL 0 00006CDB 8B04 MOV AX,[SI + DPL_AX] 0 00006CDD 8B5C02 MOV BX,[SI + DPL_BX] 0 00006CE0 8B4C04 MOV CX,[SI + DPL_CX] 0 00006CE3 8B5406 MOV DX,[SI + DPL_DX] 0 00006CE6 8B7C0A MOV DI,[SI + DPL_DI] 0 00006CE9 8E440E MOV ES,[SI + DPL_ES] 265 assume es:nothing 0 00006CEC FF7408 PUSH word [SI + DPL_SI] 0 00006CEF 8E5C0C MOV DS,[SI + DPL_DS] 268 assume ds:nothing 0 00006CF2 5E POP SI 0 00006CF3 368C1E[0000] MOV [ss:SaveDS],DS 0 00006CF8 36891E[0000] MOV [ss:SaveBX],BX 0 00006CFD 36C606[0000]FF MOV byte [ss:fSharing],-1 ; set no redirect flag 0 00006D03 E9[0000] transfer REDISP 274 275 GET_DOS_DATA: 276 ASSUME DS:NOTHING,ES:NOTHING 0 00006D06 36C43E[0000] LES DI,[ss:SWAP_ALWAYS_AREA] ;IFS. get beginning addr of swap ;AC000; 0 00006D0B 368B16[0000] MOV DX,[ss:SWAP_ALWAYS_AREA_LEN] ;IFS. get swap always area len ;AC000; 0 00006D10 81E2FF7F AND DX,7FFFH ;IFS. clear high bit ;AC000; 0 00006D14 368B0E[0000] MOV CX,[ss:SWAP_AREA_LEN] ;IFS. get swap len ;AC000; 0 00006D19 E8[0000] invoke GET_USER_STACK 0 00006D1C 8C440E MOV [SI + user_DS],ES ; set user regs 0 00006D1F 897C08 MOV [SI + user_SI],DI ; 0 00006D22 895406 MOV [SI + user_DX],DX ; 0 00006D25 EB99 JMP SetCXOK ; ;AN000; 286 287 SPOOL_OPER: 288 ASSUME DS:NOTHING,ES:NOTHING 289 multNet equ MultNET ; NASM port equate 0 00006D27 50B82511CD2F5B CallInstall NETSpoolOper,multNet,37,AX,BX 0 00006D2E 7202 JC func_err2 0 00006D30 EB91 transfer SYS_RET_OK 293 func_err2: 0 00006D32 E9[0000] transfer SYS_RET_ERR 295 296 Break <$SetExtendedError - set extended error for later retrieval> 297 298 ; 299 ; $SetExtendedError takes extended error information and loads it up for the 300 ; next extended error call. This is used by interrupt-level proccessors to 301 ; mask their actions. 302 ; 303 ; Inputs: DS:SI points to DPL which contains all registers 304 ; Outputs: none 305 ; 306 307 D_SetExtendedError: 308 ASSUME DS:NOTHING,ES:NOTHING 309 dpl_AX equ DPL_AX ; NASM port equate 0 00006D35 8B04 MOV AX,[SI + dpl_AX] 311 EXTERR equ ExtErr ; NASM port label 0 00006D37 36A3[0000] MOV [ss:EXTERR],AX 313 dpL_di equ DPL_DI ; NASM port equate 0 00006D3B 8B440A MOV AX,[SI + dpL_di] 0 00006D3E 36A3[0000] MOV WORD PTR [ss:ExtErrPt],AX 316 dpL_ES equ DPL_ES ; NASM port equate 0 00006D42 8B440E MOV AX,[SI + dpL_ES] 0 00006D45 36A3[0200] MOV WORD PTR [ss:ExtErrPt+2],AX 319 dpL_BX equ DPL_BX ; NASM port equate 0 00006D49 8B4402 MOV AX,[SI + dpL_BX] 321 EXTERR_ACTION equ ExtErr_Action ; NASM port label 0 00006D4C 36A3[0000] MOV WORD PTR [ss:EXTERR_ACTION],AX 323 dpL_CX equ DPL_CX ; NASM port equate 0 00006D50 8B4404 MOV AX,[SI + dpL_CX] 0 00006D53 368826[0000] MOV [ss:EXTERR_LOCUS],AH 0 00006D58 C3 return 327 EndProc D_ServerCall 327 ****************** warning: ***** Possible stack size error in D_ServerCall ***** [-w+user] 328 329 END === Trace listing source: ../DOS/util.lst 1 ; SCCSID = @(#)util.asm 1.1 85/04/10 2 ;TITLE UTIL - Handle utilities 3 ;NAME UTIL 4 ; 5 ; Handle related utilities for MSDOS 2.X. 6 ; 7 ; pJFNFromHandle written 8 ; SFFromHandle written 9 ; SFFromSFN written 10 ; JFNFree written 11 ; SFNFree written 12 ; 13 ; Modification history: 14 ; 15 ; Created: MZ 1 April 1983 16 ; 17 18 [list -] 18 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 23 24 [list +] === Switch to base=002450h -> "DOSCODECODE" 25 section DOSCODECODE 26 [list -] 26 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 26 ****************** warning: out: BPB.INC... [-w+user] 26 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 26 ****************** warning: out: DEVSYM.INC... [-w+user] 33 ;.sall 34 35 I_need CurrentPDB,WORD ; current process data block location 36 I_need SFT_Addr,DWORD ; pointer to beginning of table 37 I_Need PROC_ID,WORD ; current process ID 38 I_Need USER_ID,WORD ; current user ID 39 %if debug 40 I_need BugLev,WORD 41 I_need BugTyp,WORD 42 %include "bugtyp.nas" 43 %endif 44 45 BREAK 46 47 ; 48 ; pJFNFromHandle - Given a handle, return the pointer to the JFN location 49 ; in the user's data space 50 ; Inputs: BX - Handle 51 ; Outputs: Carry Set 52 ; AX has error code 53 ; Carry reset 54 ; ES:DI point to the handle spot 55 ; Registers modified: 56 ; If no error, ES:DI, else AX,ES 57 procedure pJFNFromHandle,NEAR 57 ****************** warning: proc pJFNFromHandle... [-w+user] 58 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006D59 368E06[0000] MOV ES,[ss:CurrentPDB] ; get user process data block 60 assume es:PSP 0 00006D5E 263B1E3200 CMP BX,[ES:PDB_JFN_Length] ; is handle greater than allocated 0 00006D63 7204 JB JFNAdd ; no, get offset 63 fmt TypAccess,LevSFN,<"$p: Illegal JFN %x\n">, 0 00006D65 B006 MOV AL,error_invalid_handle ; appropriate error 65 ReturnCarry: 0 00006D67 F9 STC ; signal error 0 00006D68 C3 return ; go back 0 00006D69 26C43E3400 JFNAdd: LES DI,[ES:PDB_JFN_Pointer] ; get pointer to beginning of table 69 assume es:nothing 0 00006D6E 01DF ADD DI,BX ; add in offset 71 ReturnNoCarry: 0 00006D70 F8 CLC ; no holes 0 00006D71 C3 return ; bye! 74 EndProc pJFNFromHandle 75 76 BREAK 77 78 ; 79 ; SFFromHandle - Given a handle, get JFN and then index into SF table 80 ; 81 ; Input: BX has handle 82 ; Output: Carry Set 83 ; AX has error code 84 ; Carry Reset 85 ; ES:DI has pointer to SF entry 86 ; Registers modified: If error, AX,ES, else ES:DI 87 procedure SFFromHandle,NEAR 87 ****************** warning: proc SFFromHandle... [-w+user] 88 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006D72 E8E4FF CALL pJFNFromHandle ; get jfn pointer 0 00006D75 72FA retc ; return if error 0 00006D77 26803DFF CMP BYTE PTR [ES:DI],-1 ; unused handle 0 00006D7B 7504 JNZ GetSF ; nope, suck out SF 93 fmt TypAccess,LevSFN,<"$p: Illegal SFN $x:$x\n">, 0 00006D7D B006 MOV AL,error_invalid_handle ; appropriate error 0 00006D7F EBE6 jump ReturnCarry ; signal it 96 GetSF: 0 00006D81 53 SaveReg ; save handle 0 00006D82 268A1D MOV BL,BYTE PTR [ES:DI] ; get SFN 0 00006D85 30FF XOR BH,BH ; ignore upper half 0 00006D87 E80200 CALL SFFromSFN ; get real sf spot 0 00006D8A 5B RestoreReg ; restore 0 00006D8B C3 return ; say goodbye 103 EndProc SFFromHandle 104 105 BREAK 106 107 ; 108 ; SFFromSFN - index into SF tables for SFN. 109 ; 110 ; Input: BX has SF index 111 ; Output: ES:DI points to SF entry 112 ; Registers modified: ES:DI, BX only 113 procedure SFFromSFN,NEAR 113 ****************** warning: proc SFFromSFN... [-w+user] 114 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006D8C 36C43E[0000] LES DI,[ss:SFT_Addr] ; get pointer to beginning of table 116 ScanLoop: 0 00006D91 263B5D04 CMP BX,[ES:DI + SFCount] ; is handle in this table? 0 00006D95 720F JB GetOffset ; yes, go grab it 0 00006D97 262B5D04 SUB BX,[ES:DI + SFCount] 0 00006D9B 26C43D LES DI,[ES:DI + SFLink] ; get next table segment 0 00006D9E 83FFFF CMP DI,-1 ; end of tables? 0 00006DA1 75EE JNZ ScanLoop ; no, try again 0 00006DA3 F9 STC ; error... 0 00006DA4 EB0D JMP SHORT Restore ; go restore 125 GetOffset: 0 00006DA6 50 SaveReg ; save AX 127 SF_Entry_struc_size equ sf_entry_struc_size ; NASM port equate 0 00006DA7 B83B00 MOV AX,SF_Entry_struc_size ; put it in a nice place 0 00006DAA F6E3 MUL BL ; times size 0 00006DAC 01C7 ADD DI,AX ; offset by size 0 00006DAE 58 RestoreReg ; get world back 0 00006DAF 83C706 ADD DI,SFTable ; offset into structure 0 00006DB2 F8 CLC ; no holes 134 Restore: 0 00006DB3 C3 return ; bye! 136 EndProc SFFromSFN 137 138 BREAK 139 140 ; 141 ; JFNFree - scan through the JFN table and return a pointer to a free slot 142 ; 143 ; Input: None. 144 ; Output: Carry Set 145 ; AX has error code, BX,ES,DI garbage 146 ; Carry Reset 147 ; BX has new handle, ES:DI is pointer to JFN slot 148 ; Registers modified: As above only. 149 procedure JFNFree,NEAR 149 ****************** warning: proc JFNFree... [-w+user] 150 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006DB4 31DB XOR BX,BX ; try starting low 152 JFNScan: 0 00006DB6 E8A0FF CALL pJFNFromHandle ; get the appropriate handle 0 00006DB9 7209 JC JFNNone ; no more handles 0 00006DBB 26803DFF CMP BYTE PTR [ES:DI],-1 ; free? 0 00006DBF 7405 JZ JFNFound ; yes, carry is clear 0 00006DC1 43 INC BX ; no, next handle 0 00006DC2 EBF2 JMP JFNScan ; and try again 159 JFNNone: 0 00006DC4 B004 MOV AL,error_too_many_open_files 161 JFNFound: 0 00006DC6 C3 return ; bye 163 EndProc JFNFree 164 165 BREAK 166 167 ; 168 ; SFNFree - scan through the sf table looking for free entries 169 ; Inputs: none 170 ; Outputs: Carry Set - AX has error code, BX destroyed 171 ; Carry Clear - BX has SFN 172 ; ES:DI - pointer to SFT 173 ; SFT_ref_count is set to 1 174 ; Registers modified: none 175 176 Procedure SFNFree,NEAR 176 ****************** warning: proc SFNFree... [-w+user] 177 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006DC7 31DB XOR BX,BX ; start at beginning 179 SFNFreeLoop: 0 00006DC9 53 SaveReg ; Next call zaps BX 0 00006DCA E8BFFF CALL SFFromSFN ; get the potential handle 0 00006DCD 5B RestoreReg 0 00006DCE 7305 JNC SFNCheck ; no carry, check to see if its free 0 00006DD0 B004 MOV AL,error_too_many_open_files ; appropriate error 0 00006DD2 EB42 JMP SFNDone 0 00006DD4 90 nop ; identicalise 187 SFNCheck: 188 sf_Ref_Count equ sf_ref_count ; NASM port equate 0 00006DD5 26833D00 CMP word [ES:DI + sf_Ref_Count],0 ; free? 190 %IFN DEBUG 0 00006DD9 7421 JZ SFNGot ; yep, got return him 192 %ELSE 193 JNZ NoGot 194 JMP SFNGot 195 NoGot: 196 %ENDIF 0 00006DDB 26833DFF CMP word [ES:DI + sf_ref_count],sf_busy 0 00006DDF 7518 JNZ SFNNext ; not marked busy... 199 fmt TypAccess,LevSFN,<"$p: SFT $x:$x($x)is busy, owner $x:$x\n">, 0 00006DE1 53 SaveReg 201 User_ID equ USER_ID ; NASM port label 0 00006DE2 368B1E[0000] MOV BX,[ss:User_ID] 0 00006DE7 26395D2F CMP [ES:DI + sf_UID],BX 0 00006DEB 750B JNZ SFNNextP 205 Proc_ID equ PROC_ID ; NASM port label 0 00006DED 368B1E[0000] MOV BX,[ss:Proc_ID] 0 00006DF2 26395D31 CMP [ES:DI + sf_PID],BX 0 00006DF6 7405 JZ SFNGotP 209 SFNNextP: 210 fmt TypAccess,LevSFN,<"$p: SFT unusable\n"> 0 00006DF8 5B RestoreReg 212 SFNNext: 0 00006DF9 43 INC BX ; no, try next sf number 0 00006DFA EBCD JMP SFNFreeLoop ; and go until it fails 215 SFNGot: 0 00006DFC 53 SaveReg 217 SFNGotP: 0 00006DFD F8 CLC ; no error 219 fmt TypAccess,LevSFN,<"$p: SFT $x:$x($x) marked busy\n">, 0 00006DFE 26C705FFFF MOV word [ES:DI + sf_ref_count],sf_busy ; make sure that this is allocated 0 00006E03 368B1E[0000] MOV BX,[ss:User_ID] 0 00006E08 26895D2F MOV [ES:DI + sf_UID],BX 0 00006E0C 368B1E[0000] MOV BX,[ss:Proc_ID] 0 00006E11 26895D31 MOV [ES:DI + sf_PID],BX 0 00006E15 5B RestoreReg 226 SFNDone: 0 00006E16 C3 return ; bye 228 EndProc SFNFree 229 230 END === Trace listing source: ../DOS/handle.lst 1 ; SCCSID = @(#)handle.asm 1.1 85/04/10 2 ;TITLE HANDLE - Handle-related system calls 3 ;NAME HANDLE 4 ; 5 ; Handle related system calls for MSDOS 2.X. Only top-level system calls 6 ; are present. I/O specs are defined in DISPATCH. The system calls are: 7 ; 8 ; $Close written 9 ; $Commit written DOS 3.3 F.C. 6/4/86 10 ; $ExtHandle written DOS 3.3 F.C. 6/4/86 11 ; $Read written 12 ; Align_Buffer DOS 4.00 13 ; $Write written 14 ; $LSeek written 15 ; $FileTimes written 16 ; $Dup written 17 ; $Dup2 written 18 ; 19 ; Revision history: 20 ; 21 ; Created: MZ 28 March 1983 22 ; MZ 15 Dec 1982 Jeff Harbers and Multiplan hard disk copy 23 ; rely on certain values in AX when $CLOSE 24 ; succeeds even though we document it as 25 ; always trashing AX. 26 ; 27 ; A000 version 4.00 Jan. 1988 28 ; 29 30 [list -] 30 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 35 36 [list +] === Switch to base=002450h -> "DOSCODECODE" 37 section DOSCODECODE 38 [list -] 38 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 38 ****************** warning: out: BPB.INC... [-w+user] 38 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 38 ****************** warning: out: DEVSYM.INC... [-w+user] 38 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 47 ;.sall 48 49 EXTRN DOS_Read:NEAR, DOS_Write:NEAR 50 51 %ifndef BUF2 52 %IF BUFFERFLAG 53 extrn save_user_map:near 54 extrn restore_user_map:near 55 extrn Setup_EMS_Buffers:near 56 %ENDIF 57 %endif 58 59 I_need ThisSFT,DWORD ; pointer to SFT entry 60 I_need DMAAdd,DWORD ; old-style DMA address 61 I_Need EXTERR_LOCUS,byte ; Extended Error Locus 62 I_need FailErr,BYTE ; failed error flag 63 I_need User_ID,WORD ; current effective user_id 64 i_need JShare,DWORD ; jump table 65 I_need CurrentPDB,WORD ; current process data block 66 I_need EXTOPEN_ON,BYTE ;AN000;FT. flag for extended open 67 ; I_need XA_device,BYTE ;AN000; XA device 68 I_need XA_type,BYTE ;AN000; extended open subfunction 69 ; I_need XA_handle,WORD ;AN000; handle 70 I_need THISCDS,DWORD ;AN000; 71 I_need DUMMYCDS,128 ;AN000; 72 I_need SAVE_ES,WORD ;AN000; saved ES 73 I_need SAVE_DI,WORD ;AN000; saved DI 74 I_need SAVE_DS,WORD ;AN000; saved DS 75 I_need SAVE_SI,WORD ;AN000; saved SI 76 I_need SAVE_CX,WORD ;AN000; saved CX 77 78 %ifndef BUF2 79 %IF BUFFERFLAG 80 I_need BUF_EMS_MODE,BYTE 81 I_need BUF_EMS_LAST_PAGE,DWORD 82 I_need BUF_EMS_FIRST_PAGE,DWORD 83 I_need BUF_EMS_SAFE_FLAG,BYTE 84 I_need BUF_EMS_NPA640,WORD 85 I_need BUF_EMS_PAGE_FRAME,WORD 86 I_need BUF_EMS_PFRAME,WORD 87 I_need LASTBUFFER,DWORD 88 %ENDIF 89 %endif 90 91 ; I_need XA_ES,WORD ;AN000; extended find 92 ; I_need XA_BP,WORD ;AN000; extended find 93 ; I_need XA_from,BYTE ;AN000; for filetimes 94 %if debug 95 I_need BugLev,WORD 96 I_need BugTyp,WORD 97 %include "bugtyp.nas" 98 %endif 99 100 BREAK <$Close - return a handle to the system> 101 102 ; 103 ; Assembler usage: 104 ; MOV BX, handle 105 ; MOV AH, Close 106 ; INT int_command 107 ; 108 ; Error return: 109 ; AX = error_invalid_handle 110 ; 111 ; No registers returned 112 113 Procedure D_Close,NEAR 113 ****************** warning: proc D_Close... [-w+user] 114 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 115 fmt TypSysCall,LevLog,<"$p Close\n"> 116 fmt TypSysCall,LevArgs,<"$p Handle = $x\n">, 117 ; 118 ; Grab the SFT pointer from the JFN. 119 ; 0 00006E17 E8D202 call CheckOwner ; get system file entry 0 00006E1A 722B JC CloseError ; error return 122 fmt TypAccess,LevSFN,<"$p Close SFT $x:$x\n">, 0 00006E1C 161F context DS ; For DOS_CLOSE 0 00006E1E 893E[0000] MOV WORD PTR [ThisSFT],DI ; save offset of pointer 0 00006E22 8C06[0200] MOV WORD PTR [ThisSFT+2],ES ; save segment value 126 ; 127 ; DS:SI point to JFN table entry. 128 ; ES:DI point to SFT 129 ; 130 ; We now examine the user's JFN entry; If the file was a 70-mode file (network 131 ; FCB, we examine the ref count on the SFT; if it was 1, we free the JFN. 132 ; If the file was not a net FCB, we free the JFN too. 133 ; 0 00006E26 26833D01 CMP word [ES:DI + sf_ref_count],1 ; will the SFT become free? 0 00006E2A 740A JZ FreeJFN ; yes, free JFN anyway. 0 00006E2C 268A4502 MOV AL,BYTE PTR [ES:DI + sf_mode] 0 00006E30 24F0 AND AL,sharing_mask 138 sharing_net_fcb equ sharing_net_FCB ; NASM port equate 0 00006E32 3C70 CMP AL,sharing_net_fcb 0 00006E34 7407 JZ PostFree ; 70-mode and big ref count => free it 141 ; 142 ; The JFN must be freed. Get the pointer to it and replace the contents with 143 ; -1. 144 ; 145 FreeJFN: 0 00006E36 E8[0000] Invoke pJFNFromHandle ; d = pJFN (handle); 147 fmt TypAccess,LevSFN,<"$p Close jfn pointer $x:$x\n">, 0 00006E39 26C605FF MOV BYTE PTR [ES:DI],0FFh ; release the JFN 149 PostFree: 150 ; 151 ; ThisSFT is correctly set, we have DS = DOSGROUP. Looks OK for a DOS_CLOSE! 152 ; 0 00006E3D E8[0000] invoke DOS_Close 154 ; 155 ; DOS_Close may return an error. If we see such an error, we report it but 156 ; the JFN stays closed because DOS_Close always frees the SFT! 157 ; 0 00006E40 7205 JC CloseError 159 fmt TypSysCall,LevLog,<"$p: Close ok\n"> 160 close equ Close ; NASM port equate 0 00006E42 B43E MOV AH,close ; MZ Bogus multiplan fix 0 00006E44 E9[0000] transfer Sys_Ret_OK 163 CloseError: 164 ASSUME DS:NOTHING 165 fmt TypSysCall,LevLog,<"$p: Close error $x\n">, 0 00006E47 E9[0000] transfer Sys_Ret_Err 167 EndProc D_Close 168 169 BREAK <$Commit - commit the file> 170 171 ; 172 ; Assembler usage: 173 ; MOV BX, handle 174 ; MOV AH, Commit 175 ; INT int_command 176 ; 177 ; Error return: 178 ; AX = error_invalid_handle 179 ; 180 ; No registers returned 181 182 Procedure D_Commit,NEAR 182 ****************** warning: proc D_Commit... [-w+user] 183 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 184 ; 185 ; Grab the SFT pointer from the JFN. 186 ; 0 00006E4A E89F02 call CheckOwner ; get system file entry 0 00006E4D 7213 JC Commiterror ; error return 0 00006E4F 161F context DS ; For DOS_COMMIT 0 00006E51 893E[0000] MOV WORD PTR [ThisSFT],DI ; save offset of pointer 0 00006E55 8C06[0200] MOV WORD PTR [ThisSFT+2],ES ; save segment value 192 ; 193 ; ES:DI point to SFT 194 ; 195 ; 196 ; ThisSFT is correctly set, we have DS = DOSGROUP. Looks OK for a DOS_COMMIT 197 ; 0 00006E59 E8[0000] invoke DOS_COMMIT 199 ; 200 ; 0 00006E5C 7204 JC Commiterror 0 00006E5E B468 MOV AH,Commit ; 0 00006E60 EBE2 transfer Sys_Ret_OK 204 Commiterror: 205 ASSUME DS:NOTHING 0 00006E62 EBE3 transfer Sys_Ret_Err 207 EndProc D_Commit 208 209 210 BREAK <$ExtHandle - extend handle count> 211 212 ; 213 ; Assembler usage: 214 ; MOV BX, Number of Opens Allowed (MAX=65534;66535 is 215 ; MOV AX, 6700H reserved to mark SFT 216 ; INT int_command busy ) 217 ; 218 ; Error return: 219 ; AX = error_not_enough_memory 220 ; or error_too_many_open_files 221 ; No registers returned 222 223 Procedure D_ExtHandle,NEAR 223 ****************** warning: proc D_ExtHandle... [-w+user] 224 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 225 ; 226 ; 227 ; 0 00006E64 31ED XOR BP,BP ; 0: enlarge 1: shrink 2:psp 0 00006E66 83FB14 CMP BX,FilPerProc ; < 20 0 00006E69 7303 JAE getpdb ; no 0 00006E6B BB1400 MOV BX,FilPerProc ; bx = 20 232 233 getpdb: 0 00006E6E 368E06[0000] MOV ES,[ss:CurrentPDB] ; get user process data block 235 assume es:PSP 0 00006E73 268B0E3200 MOV CX,[ES:PDB_JFN_Length] ; get number of handle allowed 0 00006E78 39CB CMP BX,CX ; the requested == current 0 00006E7A 7452 JE ok_done ; yes and exit 0 00006E7C 7723 JA larger ; go allocate new table 240 0 00006E7E BD0100 MOV BP,1 ; shrink 0 00006E81 268E1E3600 MOV DS,WORD PTR [ES:PDB_JFN_Pointer+2] ; 243 assume ds:nothing 0 00006E86 89DE MOV SI,BX ; 0 00006E88 29D9 SUB CX,BX ; get difference 246 chck_handles: 0 00006E8A 803CFF CMP BYTE PTR [SI],-1 ; scan through handles to ensure close 0 00006E8D 7541 JNZ too_many_files ; status 0 00006E8F 46 INC SI 0 00006E90 E2F8 LOOP chck_handles 0 00006E92 83FB14 CMP BX,FilPerProc ; = 20 0 00006E95 770A JA larger ; no 253 0 00006E97 BD0200 MOV BP,2 ; psp 0 00006E9A BF1800 MOV DI,PDB_JFN_Table ; es:di -> jfn table in psp 0 00006E9D 53 PUSH BX 0 00006E9E EB1E JMP movhandl 0 00006EA0 90 nop ; identicalise 259 260 larger: 0 00006EA1 83FBFF CMP BX,-1 ; 65535 is not allowed 0 00006EA4 747F JZ invalid_func 0 00006EA6 F8 CLC 0 00006EA7 53 PUSH BX ; save requested number 0 00006EA8 83C30F ADD BX,0FH ; adjust to paragraph boundary 0 00006EAB B104 MOV CL,4 0 00006EAD D3DB RCR BX,CL ; DOS 4.00 fix ;AC000; 0 00006EAF 81E3FF1F AND BX,1FFFH ; clear most 3 bits 269 0 00006EB3 55 PUSH BP 0 00006EB4 E8[0000] invoke D_ALLOC ; allocate memory 0 00006EB7 5D POP BP 0 00006EB8 7266 JC no_memory ; not enough meory 274 0 00006EBA 8EC0 MOV ES,AX ; es:di points to new table memory 276 assume es:nothing 0 00006EBC 31FF XOR DI,DI 278 movhandl: 0 00006EBE 368E1E[0000] MOV DS,[ss:CurrentPDB] ; get user PDB address 280 assume ds:PSP 281 0 00006EC3 F7C50300 TEST BP,3 ; enlarge ? 0 00006EC7 740B JZ enlarge ; yes 0 00006EC9 59 POP CX ; cx = the amount you shrink 0 00006ECA 51 PUSH CX 0 00006ECB EB0B JMP copy_hand 0 00006ECD 90 nop ; identicalise 288 ok_done: 0 00006ECE EB90 transfer Sys_Ret_OK 290 too_many_files: 0 00006ED0 B004 MOV AL,error_too_many_open_files 0 00006ED2 EB8E transfer Sys_Ret_Err 293 enlarge: 0 00006ED4 8B0E3200 MOV CX,[PDB_JFN_Length] ; get number of old handles 295 copy_hand: 0 00006ED8 89CA MOV DX,CX 0 00006EDA C5363400 LDS SI,[PDB_JFN_Pointer] ; get old table pointer 298 ASSUME DS:NOTHING 0 00006EDE F3A4 REP MOVSB ; copy infomation to new table 300 0 00006EE0 59 POP CX ; get new number of handles 0 00006EE1 51 PUSH CX ; save it again 0 00006EE2 29D1 SUB CX,DX ; get the difference 0 00006EE4 B0FF MOV AL,-1 ; set availability to handles 0 00006EE6 F3AA REP STOSB 306 0 00006EE8 368E1E[0000] MOV DS,[ss:CurrentPDB] ; get user process data block 308 assume ds:PSP 0 00006EED 833E340000 CMP WORD PTR [PDB_JFN_Pointer],0 ; check if original table pointer 0 00006EF2 750D JNZ update_info ; yes, go update PDB entries 0 00006EF4 55 PUSH BP 0 00006EF5 1E PUSH DS ; save old table segment 0 00006EF6 06 PUSH ES ; save new table segment 0 00006EF7 8E063600 MOV ES,WORD PTR [PDB_JFN_Pointer+2] ; get old table segment 315 assume es:nothing 0 00006EFB E8[0000] invoke D_DEALLOC ; deallocate old table meomory 0 00006EFE 07 POP ES ; restore new table segment 318 assume es:nothing 0 00006EFF 1F POP DS ; restore old table segment 320 assume ds:nothing 0 00006F00 5D POP BP 322 323 update_info: 0 00006F01 F7C50200 TEST BP,2 ; psp? 0 00006F05 7409 JZ non_psp ; no 0 00006F07 C70634001800 MOV WORD PTR [PDB_JFN_Pointer],PDB_JFN_Table ; restore 0 00006F0D EB07 JMP final 0 00006F0F 90 nop ; identicalise 329 non_psp: 0 00006F10 C70634000000 MOV WORD PTR [PDB_JFN_Pointer],0 ; new table pointer offset always 0 331 final: 0 00006F16 8C063600 MOV WORD PTR [PDB_JFN_Pointer+2],ES ; update table pointer segment 0 00006F1A 8F063200 POP word [PDB_JFN_Length] ; restore new number of handles 0 00006F1E EBAE transfer Sys_Ret_Ok 335 no_memory: 0 00006F20 5B POP BX ; clean stack 0 00006F21 B008 MOV AL,error_not_enough_memory 0 00006F23 EBAD transfer Sys_Ret_Err 339 invalid_func: 0 00006F25 B001 MOV AL,error_invalid_function 0 00006F27 EBFA transfer Sys_Ret_Err 342 EndProc D_ExtHandle 343 344 BREAK <$READ - Read from a file handle> 345 ; 346 ; Assembler usage: 347 ; LDS DX, buf 348 ; MOV CX, count 349 ; MOV BX, handle 350 ; MOV AH, Read 351 ; INT int_command 352 ; AX has number of bytes read 353 ; Errors: 354 ; AX = read_invalid_handle 355 ; = read_access_denied 356 ; 357 ; Returns in register AX 358 359 procedure D_READ,NEAR 359 ****************** warning: proc D_READ... [-w+user] 360 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 361 fmt TypSysCall,LevLog,<"Read\n"> 362 fmt TypSysCall,LevArgs,<" Handle $x Cnt $x Buf $x:$x\n">, 0 00006F29 BE[0000] MOV SI,OFFSET DOS_Read 364 ReadDo: 0 00006F2C E8[0000] invoke pJFNFromHandle 0 00006F2F 7208 JC ReadError 0 00006F31 268A05 MOV AL,[ES:DI] 0 00006F34 E8B501 call CheckOwner ; get the handle 0 00006F37 7302 JNC ReadSetup ; no errors do the operation 370 ReadError: 371 fmt TypSysCall,LevLog,<"Read/Write error $x\n">, 0 00006F39 EBEC transfer SYS_RET_ERR ; go to error traps 373 ReadSetup: 0 00006F3B 36893E[0000] MOV WORD PTR [ss:ThisSFT],DI ; save offset of pointer 0 00006F40 368C06[0200] MOV WORD PTR [ss:ThisSFT+2],ES ; save segment value 376 ;; Extended Open 377 INT_24_ERROR equ int_24_error ; NASM port equate 0 00006F45 26F745020020 TEST word [ES:DI + sf_mode],INT_24_ERROR ;AN000;;EO. need i24 0 00006F4B 7406 JZ needi24 ;AN000;;EO. yes 380 EXT_OPEN_I24_OFF equ ext_open_I24_off ; NASM port equate 0 00006F4D 36800E[0000]02 OR byte [ss:EXTOPEN_ON],EXT_OPEN_I24_OFF ;AN000;;EO. set it off 382 needi24: ;AN000; 383 384 ;; Extended Open 0 00006F53 36FF36[0000]36FF36 SaveReg <, > 0 00006F5B [0200] 386 ;;;;; BAD SPOT FOR 286!!! SEGMENT ARITHMETIC!!! 0 00006F5D E81500 CALL Align_Buffer ;AN000;MS. align user's buffer 388 ;;;;; END BAD SPOT FOR 286!!! SEGMENT ARITHMETIC!!! 389 390 %ifndef BUF2 391 %IF BUFFERFLAG 392 ; int 3 393 ; cmp [BUF_EMS_MODE], -1 394 ; jz dos_call 395 ; call choose_buf_page 396 ; jc ReadError 397 ; call save_user_map 398 ;dos_call: 399 %ENDIF 400 %endif 401 0 00006F60 161F context DS ; go for DOS addressability 0 00006F62 FFD6 CALL SI ; indirect call to operation 0 00006F64 8F06[0200]8F06 RestoreReg <, > 0 00006F6A [0000] 405 406 %ifndef BUF2 407 %IF BUFFERFLAG 408 pushf 409 push ax 410 push bx 411 412 cmp byte [ss:BUF_EMS_MODE], -1 413 jz dos_call_done 414 call restore_user_map 415 mov ax, word ptr [ss:BUF_EMS_LAST_PAGE] 416 cmp [ss:BUF_EMS_PFRAME], ax 417 je dos_call_done 418 mov word ptr [ss:LASTBUFFER], -1 419 mov [ss:BUF_EMS_PFRAME], ax 420 mov ax, word ptr [ss:BUF_EMS_LAST_PAGE+2] 421 mov [ss:BUF_EMS_PAGE_FRAME], ax 422 mov byte [ss:BUF_EMS_SAFE_FLAG], 1 423 call Setup_EMS_Buffers 424 425 dos_call_done: 426 pop bx 427 pop ax 428 popf 429 %ENDIF 430 %endif 431 432 %IFN BUFFERFLAG 433 JC ReadError ; if error, say bye bye 434 %ELSE 0 00006F6C EB01 jmp tmp_rerr 0 00006F6E 90 nop ; identicalise 437 tmp_rerr: 0 00006F6F 72C8 jc ReadError 439 %ENDIF 440 0 00006F71 89C8 MOV AX,CX ; get correct return in correct reg 442 fmt TypSysCall,LevLog,<"Read/Write cnt done $x\n">, 0 00006F73 EBA9 transfer sys_ret_ok ; successful return 444 EndProc D_READ 445 446 ; 447 ; Input: DS:DX points to user's buffer addr 448 ; Function: rearrange segment and offset for READ/WRITE buffer 449 ; Output: [DMAADD] set 450 ; 451 ; 452 453 procedure Align_Buffer,NEAR ;AN000; 453 ****************** warning: proc Align_Buffer... [-w+user] 454 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 0 00006F75 51 push cx 0 00006F76 B104 mov cl, 4 0 00006F78 8CD8 mov ax, ds 0 00006F7A 89D3 mov bx, dx 459 ; cmp bx, 15 460 ; jbe .end 0 00006F7C 83E20F and dx, 15 ; mask off full paragraphs 0 00006F7F D3EB shr bx, cl ; how much can at most be added to ds 0 00006F81 01D8 add ax, bx ; => candidate segment, 464 ; CY if > 0FFFFh (must be in HMA) 0 00006F83 7308 jnc .simple 466 ; ffff:20 ds:dx (want ffff:20) -> 2 ax -> 2+ffff = 1000_1 467 ; fffe:20 ds:dx (want ffff:10) -> 2 ax -> 2+fffe = 1000_0 468 ; fffe:30 ds:dx (want ffff:20) -> 3 ax -> 3+fffe = 1000_1 469 ; fffe:40 ds:dx (want ffff:30) -> 4 ax -> 4+fffe = 1000_2 470 ; fffe:80 ds:dx (want ffff:70) -> 8 ax -> 8+fffe = 1000_6 471 ; fffe:0 ds:dx (want fffe:0) -> 0 ax -> 0+fffe = fff_e jnc 472 ; fff0:0 ds:dx (want fff0:0) -> 0 ax -> 0+fff0 = fff_0 jnc 473 ; fff0:80 ds:dx (want fff8:0) -> 8 ax -> 8+fff0 = fff_8 jnc 474 ; fff0:180 ds:dx (want ffff:90) -> 18 ax -> 18+fff0 = 1000_8 0 00006F85 40 inc ax ; adjust, gives offset high 12 bits 0 00006F86 D3E0 shl ax, cl ; shift the 12 bits up 0 00006F88 09C2 or dx, ax ; get final offset 0 00006F8A B8FFFF mov ax, -1 ; final segment is always 0FFFFh if in HMA 479 .simple: 0 00006F8D 8ED8 mov ds, ax 481 assume ds:nothing 482 .end: 0 00006F8F 59 pop cx 0 00006F90 368916[0000] MOV WORD PTR [ss:DMAAdd],DX ; use user DX as offset 0 00006F95 368C1E[0200] MOV WORD PTR [ss:DMAAdd+2],DS ; use user DS as segment for DMA 0 00006F9A C3 return ;AN000; 487 EndProc Align_Buffer ;AN000; 488 489 BREAK <$WRITE - write to a file handle> 490 491 ; 492 ; Assembler usage: 493 ; LDS DX, buf 494 ; MOV CX, count 495 ; MOV BX, handle 496 ; MOV AH, Write 497 ; INT int_command 498 ; AX has number of bytes written 499 ; Errors: 500 ; AX = write_invalid_handle 501 ; = write_access_denied 502 ; 503 ; Returns in register AX 504 505 procedure D_WRITE,NEAR 505 ****************** warning: proc D_WRITE... [-w+user] 506 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 507 fmt TypSysCall,LevLog,<"Write\n"> 508 fmt TypSysCall,LevArgs,<" Handle $x Cnt $x Buf $x:$x\n">, 0 00006F9B BE[0000] MOV SI,OFFSET DOS_Write 0 00006F9E EB8C JMP ReadDo 511 EndProc D_Write 512 513 BREAK <$LSEEK - move r/w pointer> 514 515 ; 516 ; Assembler usage: 517 ; MOV DX, offsetlow 518 ; MOV CX, offsethigh 519 ; MOV BX, handle 520 ; MOV AL, method 521 ; MOV AH, LSeek 522 ; INT int_command 523 ; DX:AX has the new location of the pointer 524 ; Error returns: 525 ; AX = error_invalid_handle 526 ; = error_invalid_function 527 ; Returns in registers DX:AX 528 529 procedure D_LSEEK,NEAR 529 ****************** warning: proc D_LSEEK... [-w+user] 530 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00006FA0 E84901 call CheckOwner ; get system file entry 532 LSeekError: 533 534 %IF BUFFERFLAG 535 TMP_RERR equ tmp_rerr ; NASM port label 0 00006FA3 72CA JC TMP_RERR 537 %ELSE 538 JC ReadError ; error return 539 %ENDIF 0 00006FA5 3C02 CMP AL,2 ; is the seek value correct? 0 00006FA7 760A JBE LSeekDisp ; yes, go dispatch 542 errLoc_Unk equ errLOC_Unk ; NASM port equate 0 00006FA9 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLoc_Unk ; Extended Error Locus 0 00006FAF B001EB86 error error_invalid_function ; invalid method 545 LSeekDisp: 0 00006FB3 3C01 CMP AL,1 ; best way to dispatch; check middle 0 00006FB5 720A JB LSeekStore ; just store CX:DX 0 00006FB7 771B JA LSeekEOF ; seek from end of file 549 SF_Position equ sf_position ; NASM port equate 0 00006FB9 26035515 ADD DX,WORD PTR [ES:DI + SF_Position] 0 00006FBD 26134D17 ADC CX,WORD PTR [ES:DI + SF_Position+2] 552 LSeekStore: 0 00006FC1 89C8 MOV AX,CX ; AX:DX 0 00006FC3 92 XCHG AX,DX ; DX:AX is the correct value 555 LSeekSetpos: 0 00006FC4 26894515 MOV WORD PTR [ES:DI + SF_Position],AX 0 00006FC8 26895517 MOV WORD PTR [ES:DI + SF_Position+2],DX 0 00006FCC E8[0000] invoke Get_user_stack 559 User_DX equ user_DX ; NASM port equate 0 00006FCF 895406 MOV [SI + User_DX],DX ; return DX:AX 0 00006FD2 EB9F transfer SYS_RET_OK ; successful return 562 563 LSeekEOF: 0 00006FD4 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet 0 00006FDA 750A JNZ Check_LSeek_Mode ; Is Net 566 LOCAL_LSeek: 567 SF_Size equ sf_size ; NASM port equate 0 00006FDC 26035511 ADD DX,WORD PTR [ES:DI + SF_Size] 0 00006FE0 26134D13 ADC CX,WORD PTR [ES:DI + SF_Size+2] 0 00006FE4 EBDB JMP LSeekStore ; go and set the position 571 572 Check_LSeek_Mode: 0 00006FE6 26F745020080 TEST word [ES:DI + sf_mode],sf_isfcb 0 00006FEC 75EE JNZ LOCAL_LSeek ; FCB treated like local file 0 00006FEE 268B4502 MOV AX,[ES:DI + sf_mode] 0 00006FF2 25F000 AND AX,sharing_mask 0 00006FF5 83F840 CMP AX,sharing_deny_none 0 00006FF8 7405 JZ NET_LSEEK ; LSEEK exported in this mode 0 00006FFA 83F830 CMP AX,sharing_deny_read 0 00006FFD 75DD JNZ LOCAL_LSeek ; Treated like local Lseek 581 NET_LSEEK: 582 ; JMP LOCAL_LSeek 583 ; REMOVE ABOVE INSTRUCTION TO ENABLE DCR 142 584 Net_Lseek equ NET_LSEEK ; NASM port label 585 multNet equ MultNET ; NASM port equate 0 00006FFF B82111CD2F CallInstall Net_Lseek,multNet,33 587 LSeekSetPos equ LSeekSetpos ; NASM port label 0 00007004 73BE JNC LSeekSetPos 0 00007006 EBA9 transfer SYS_RET_ERR 590 591 EndProc D_LSeek 592 593 BREAK 594 595 ; 596 ; Assembler usage: 597 ; MOV AH, FileTimes (57H) 598 ; MOV AL, func 599 ; MOV BX, handle 600 ; ; if AL = 1 then then next two are mandatory 601 ; MOV CX, time 602 ; MOV DX, date 603 ; INT 21h 604 ; ; if AL = 0 then CX/DX has the last write time/date 605 ; ; for the handle. 606 ; 607 ; AL=02 get extended attributes 608 ; BX=handle 609 ; CX=size of buffer (0, return max size ) 610 ; DS:SI query list (si=-1, selects all EA) 611 ; ES:DI buffer to hold EA list 612 ; 613 ; AL=03 get EA name list 614 ; BX=handle 615 ; CX=size of buffer (0, return max size ) 616 ; ES:DI buffer to hold name list 617 ; 618 ; AL=04 set extended attributes 619 ; BX=handle 620 ; ES:DI buffer of EA list 621 ; 622 ; 623 ; 624 ; 625 ; Error returns: 626 ; AX = error_invalid_function 627 ; = error_invalid_handle 628 ; 629 630 procedure D_File_Times,NEAR 630 ****************** warning: proc D_File_Times... [-w+user] 631 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 00007008 3C02 CMP AL,2 ; correct subfunction? 0 0000700A 7303 JAE gsetxa 0 0000700C EB6D JMP filetimes_ok ; Yes, continue 0 0000700E 90 nop ; identicalise 636 ;;;; DOS 4.00 ;AN000; 637 gsetxa: ;AN000; 0 0000700F E8[0000] EnterCrit critSFT ;AN000;;FT. enter critical section 0 00007012 3C04 CMP AL,4 ;AN000;;FT. =4 0 00007014 7603 JBE gshandle ;AN000;;FT. 2,3,4 do get/set by handle 641 funcerr: ;AN000; 0 00007016 EB59 JMP inval_func ;AN000;;FT. invalid function 0 00007018 90 nop ; identicalise 644 ;AN000; 645 gshandle: ;AN000; 0 00007019 368C06[0000] MOV [ss:SAVE_ES],ES ;AN000;;FT. save regs 0 0000701E 36893E[0000] MOV [ss:SAVE_DI],DI ;AN000;;FT. 0 00007023 368C1E[0000] MOV [ss:SAVE_DS],DS ;AN000;;FT. save regs 0 00007028 368936[0000] MOV [ss:SAVE_SI],SI ;AN000;;FT. 0 0000702D 36890E[0000] MOV [ss:SAVE_CX],CX ;AN000;;FT. 651 XA_TYPE equ XA_type ; NASM port label 0 00007032 36A2[0000] MOV [ss:XA_TYPE],AL ;AN000;;FT. 653 ;AN000; 654 ; MOV [XA_handle],BX ;AN000; ;FT. save handle 0 00007036 E8B300 CALL CheckOwner ;AN000; ;FT. get sf pointer 0 00007039 7306 JNC getsetit ;AN000; ;FT. good handle 0 0000703B E8[0000] LeaveCrit critSFT ;AN000; ;FT. leave critical section 0 0000703E E962FF JMP LSeekError ;AN000; ;FT. turkey handle 659 ;AN000; 660 getsetit: ;AN000; 0 00007041 36893E[0000] MOV WORD PTR [ss:ThisSFT],DI ;AN000; ;FT. set ThisSFT 0 00007046 368C06[0200] MOV WORD PTR [ss:ThisSFT+2],ES ;AN000; ;FT. set ThisSFT 663 ; TEST [ES:DI.sf_mode],INT_24_ERROR ;AN000;;FT. mask INT 24 664 ; JZ nomask ;AN000;;FT. no 665 ; OR [EXTOPEN_ON],EXT_OPEN_I24_OFF ;AN000;;FT. set bit for I24 handler 666 nomask: ;AN000; 0 0000704B 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet ;AN000;;FT. remote handle 0 00007051 7412 JZ localhandle ;AN000;;FT. no 0 00007053 E8[0000] LeaveCrit critSFT ;AN000;;FT. doesn't support Network 670 0 00007056 368A1E[0000] MOV BL,[ss:XA_TYPE] ;AN000;;FT. 672 IFSsearch: ;AN000; 673 multNET equ MultNET ; NASM port equate 0 0000705B B82D11 MOV AX,(multNET << 8) | 45 ;AN000;;FT. Get/Set XA support 0 0000705E CD2F INT 2FH ;AN000; 0 00007060 720D JC getseterror ;AN000;;FT. error 0 00007062 E9[0000] transfer SYS_RET_OK ;AN000;;FT. 678 localhandle: ;AN000; 679 ; TEST [ES:DI.sf_flags],devid_device ;AN000;;FT. device 680 ; JZ getsetfile8 ;AN000;;FT. no 681 ; MOV [XA_device],1 ;AN000;;FT. indicating device 682 ; JMP SHORT doXA ;AN000;;FT. do XA 683 getsetfile8: ;AN000; 684 ; MOV [XA_device],0 ;AN000;;FT. indicating File 685 ; LES BP,[ES:DI.sf_devptr] ;AN000;;FT. ES:BP -> DPB 686 687 doXA: ;AN000; 688 ; MOV [XA_from],By_XA ;AN000;;FT. from get/set XA 689 ; PUSH [SAVE_ES] ;AN000;;FT. save XA list 690 ; PUSH [SAVE_DI] ;AN000;;FT. save XA list 691 0 00007065 E8[0000] invoke GetSet_XA ;AN000;;FT. issue Get/Set XA 693 ; POP SI ;AN000;;FT. DS:SI -> XA list 694 ; POP DS ;AN000; 0 00007068 7202 JC getexit ;AN000;;FT. error 696 ; CMP [XA_device],0 ;AN000;;FT. device ? 697 ; JNZ ftok ;AN000;;FT. yes, exit 698 ; MOV AX,4 ;AN000;;FT. function 4 for ShSU 699 ; CMP [XA_type],4 ;AN000;;FT. set XA 700 ; JNZ ftok ;AN000;;FT. no 701 ; 702 ; 703 ; LES DI,[ThisSFT] ;AN000;;FT. es:di -> sft 704 ; CMP WORD PTR [SI],0 ;AN000;;FT. null list ? 705 ; JNZ do_share ;AN000;;FT. no 0 0000706A EB4D JMP SHORT ftok ;AN000;;FT. return 707 getexit: ;AN000;;FT. 0 0000706C E8[0000] LeaveCrit critSFT ;AN000;;FT. leave critical section 709 710 711 getseterror: ;AN000; 0 0000706F EB95 transfer SYS_RET_ERR ;AN000;;FT. mark file as dirty 713 inval_func: 714 715 ;;;;; DOS 4.00 0 00007071 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLoc_Unk ; Extended Error Locus 0 00007077 B001EBF4 error error_invalid_function ; give bad return 718 filetimes_ok: 0 0000707B E86E00 call CheckOwner ; get sf pointer 0 0000707E 7303 JNC gsdt 0 00007080 E920FF JMP LSeekError ; turkey handle 722 gsdt: 0 00007083 08C0 OR AL,AL ; is it Get? 0 00007085 7515 JNZ filetimes_set ; no, go set the time 0 00007087 FA CLI 726 sf_Time equ sf_time ; NASM port equate 0 00007088 268B4D0D MOV CX,[ES:DI + sf_Time] ; suck out time 728 sf_Date equ sf_date ; NASM port equate 0 0000708C 268B550F MOV DX,[ES:DI + sf_Date] ; and date 0 00007090 FB STI 0 00007091 E8[0000] invoke Get_user_stack ; obtain place to return it 0 00007094 894C04 MOV [SI + user_CX],CX ; and stash in time 0 00007097 895406 MOV [SI + user_DX],DX ; and stask in date 734 ext_done: 0 0000709A EBC6 transfer SYS_RET_OK ; and say goodnight 736 filetimes_set: 0 0000709C E8[0000] EnterCrit critSFT 0 0000709F 26894D0D MOV [ES:DI + sf_Time],CX ; drop in new time 0 000070A3 2689550F MOV [ES:DI + sf_Date],DX ; and date 0 000070A7 31C0 XOR AX,AX 741 do_share: 742 %if installed 0 000070A9 36FF1E[3800] Call far [ss:JShare + 14 * 4] 744 %else 745 Call ShSU 746 %endif 747 datetimeflg: 748 sf_Flags equ sf_flags ; NASM port equate 0 000070AE 26836505BF AND word [ES:DI + sf_Flags],~ devid_file_clean 0 000070B3 26814D050040 OR word [ES:DI + sf_Flags],sf_close_nodate 751 ftok: 0 000070B9 E8[0000] LeaveCrit critSFT 0 000070BC EBDC transfer SYS_RET_OK ; mark file as dirty and return 754 EndProc D_File_Times 755 756 BREAK <$DUP - duplicate a jfn> 757 ; 758 ; Assembler usage: 759 ; MOV BX, fh 760 ; MOV AH, Dup 761 ; INT int_command 762 ; AX has the returned handle 763 ; Errors: 764 ; AX = dup_invalid_handle 765 ; = dup_too_many_open_files 766 Procedure D_DUP,NEAR 766 ****************** warning: proc D_DUP... [-w+user] 767 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 000070BE 89D8 MOV AX,BX ; save away old handle in AX 0 000070C0 E8[0000] invoke JFNFree ; free handle? into ES:DI, new in BX 770 DupErrorCheck: 0 000070C3 7217 JC DupErr ; nope, bye 0 000070C5 0657 SaveReg ; save away SFT 0 000070C7 5E1F RestoreReg ; into convenient place DS:SI 0 000070C9 93 XCHG AX,BX ; get back old handle 0 000070CA E81F00 call CheckOwner ; get sft in ES:DI 0 000070CD 720D JC DupErr ; errors go home 0 000070CF E8[0000] invoke DOS_Dup_Direct 0 000070D2 E8[0000] invoke pJFNFromHandle ; get pointer 0 000070D5 268A1D MOV BL,[ES:DI] ; get SFT number 0 000070D8 881C MOV [SI],BL ; stuff in new SFT 0 000070DA EBE0 transfer SYS_RET_OK ; and go home 0 000070DC EB9B DupErr: transfer SYS_RET_ERR 783 784 EndProc D_Dup 785 786 BREAK <$DUP2 - force a dup on a particular jfn> 787 ; 788 ; Assembler usage: 789 ; MOV BX, fh 790 ; MOV CX, newfh 791 ; MOV AH, Dup2 792 ; INT int_command 793 ; Error returns: 794 ; AX = error_invalid_handle 795 ; 796 Procedure D_Dup2,NEAR 796 ****************** warning: proc D_Dup2... [-w+user] 797 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 000070DE 5351 SaveReg ; save source 0 000070E0 89CB MOV BX,CX ; get one to close 0 000070E2 E832FD invoke D_Close ; close destination handle 0 000070E5 5B58 RestoreReg ; old in AX, new in BX 0 000070E7 E8[0000] invoke pJFNFromHandle ; get pointer 0 000070EA EBD7 JMP DupErrorCheck ; check error and do dup 804 EndProc D_Dup2 805 806 Break 807 808 ; 809 ; CheckOwner - Due to the ability of the server to close file handles for a 810 ; process without the process knowing it (delete/rename of open files, for 811 ; example), it is possible for the redirector to issue a call to a handle 812 ; that it soes not rightfully own. We check here to make sure that the 813 ; issuing process is the owner of the SFT. At the same time, we do a 814 ; SFFromHandle to really make sure that the SFT is good. 815 ; 816 ; Inputs: BX has the handle 817 ; User_ID is the current user 818 ; Output: Carry Clear => ES:DI points to SFT 819 ; Carry Set => AX has error code 820 ; Registers modified: none 821 ; 822 823 Procedure CheckOwner,NEAR 823 ****************** warning: proc CheckOwner... [-w+user] 824 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 0 000070EC E8[0000] invoke SFFromHandle 0 000070EF 7301C3 retc 0 000070F2 50 push ax 828 user_id equ User_ID ; NASM port label 0 000070F3 36A1[0000] mov ax,[ss:user_id] 0 000070F7 263B452F cmp ax,[es:di + sf_UID] 0 000070FB 58 pop ax 0 000070FC 74F3 retz 0 000070FE B006 mov al,error_invalid_handle 0 00007100 F9 stc 0 00007101 C3 return 836 EndProc CheckOwner 837 838 ;------------------------------------------------------------------------- 839 ; Function name : choose_buf_page 840 ; Inputs : DMAADD = Xaddr 841 ; cx = # of bytes to transfer 842 ; Outputs : if NC 843 ; 844 ; SAFE_FLAG - 0 ==> page is safe. no need to 845 ; detect collision between 846 ; user & system buffer. 847 ; SAFE_FLAG - 1 ==> page is unsafe. Must check 848 ; for collision 849 ; 850 ; CY - error 851 ; 852 ; 853 ; High Level Alogrithm: 854 ; 855 ; 1. If Xaddr. is above the first physical page above 640K 856 ; 2. choose that page 857 ; 3. set safe flag 858 ; 4. else 859 ; 5. choose highest page above 640K 860 ; 6. If 6 or more pages above 640k 861 ; 7. Set safe flag 862 ; 8. else 863 ; 9. if Xaddr. + # of bytes to transfer does not spill into the 864 ; chosen page 865 ; 10. set safe flag 866 ; 11.else 867 ; 12. clear safe flag 868 ; 13.endif 869 ; 14.endif 870 ; 15.endif 871 ; 872 ;---------------------------------------------------------------------------- 873 ;Procedure choose_buf_page,near 874 ; 875 ; ASSUME ds:nothing, es:nothing, ss:dosgroup 876 ; 877 ; push cx 878 ; push bx 879 ; push dx 880 ; push si 881 ; push ds 882 ; push ax 883 ; 884 ; mov ax, word ptr [DMAADD+2] 885 ; and ax, 0fc00h ; page segment of transfer segment 886 ; 887 ; cmp ax, word ptr [BUF_EMS_FIRST_PAGE] 888 ; ja pick_first 889 ; 890 ; cmp [BUF_EMS_NPA640], 6 891 ; jae safe_pick_last 892 ; 893 ; add cx, word ptr [DMAADD] ; get final offset 894 ; mov bx, cx 895 ; 896 ; mov cl, 4 897 ; shr bx, cl ; get # of paragraphs 898 ; mov ax, word ptr [DMAADD+2] ; get initial segment 899 ; add ax, bx ; get final segment 900 ; 901 ; and ax, 0fc00h 902 ; cmp ax, word ptr [BUF_EMS_LAST_PAGE] 903 ; jne safe_pick_last 904 ; 905 ; mov [BUF_EMS_SAFE_FLAG], 0 906 ; jmp fin_choose_page 907 ; 908 ;safe_pick_last: 909 ; mov [BUF_EMS_SAFE_FLAG], 1 910 ; jmp fin_choose_page 911 ; 912 ;;pick_last: 913 ;; mov ax, word ptr [BUF_EMS_LAST_PAGE] 914 ;; mov [BUF_EMS_PFRAME], ax 915 ;; mov ax, word ptr [BUF_EMS_LAST_PAGE+2] 916 ;; mov [BUF_EMS_PAGE_FRAME], ax 917 ;; xor ax, ax 918 ;; jmp fin_choose_page 919 ; 920 ;pick_first: 921 ; mov ax, word ptr [BUF_EMS_FIRST_PAGE] 922 ; cmp [BUF_EMS_PFRAME], ax 923 ; je fin_choose_page 924 ; mov word ptr [LASTBUFFER], -1 925 ; mov [BUF_EMS_PFRAME], ax 926 ; mov ax, word ptr [BUF_EMS_FIRST_PAGE+2] 927 ; mov [BUF_EMS_PAGE_FRAME], ax 928 ; mov [BUF_EMS_SAFE_FLAG], 1 929 ; call Setup_EMS_Buffers 930 ; jmp fin_choose_page 931 ; 932 ;err_choose_page: 933 ; stc 934 ; 935 ;fin_choose_page: 936 ; clc 937 ; 938 ; pop ax 939 ; pop ds 940 ; pop si 941 ; pop dx 942 ; pop bx 943 ; pop cx 944 ; return 945 ; 946 ;EndProc choose_buf_page 947 ; 948 949 END 950 951 === Trace listing source: ../DOS/macro.lst 1 ; SCCSID = @(#)macro.asm 1.2 85/07/11 2 ;TITLE MACRO - Pathname and macro related internal routines 3 ;NAME MACRO 4 ; 5 ; $AssignOper written 6 ; FIND_DPB written 7 ; InitCDS written 8 ; $UserOper written 9 ; GetVisDrv written 10 ; GetThisDrv written 11 ; GetCDSFromDrv written 12 ; 13 ; Revision history: 14 ; 15 ; Created: MZ 4 April 1983 16 ; MZ 18 April 1983 Make TransFCB handle extended FCBs 17 ; AR 2 June 1983 Define/Delete macro for NET redir. 18 ; MZ 3 Nov 83 Fix InitCDS to reset length to 2 19 ; MZ 4 Nov 83 Fix NetAssign to use STRLEN only 20 ; MZ 18 Nov 83 Rewrite string processing for subtree 21 ; aliasing. 22 ; 23 ; MSDOS performs several types of name translation. First, we maintain for 24 ; each valid drive letter the text of the current directory on that drive. 25 ; For invalid drive letters, there is no current directory so we pretend to 26 ; be at the root. A current directory is either the raw local directory 27 ; (consisting of drive:\path) or a local network directory (consisting of 28 ; \\machine\path. There is a limit on the point to which a .. is allowed. 29 ; 30 ; Given a path, MSDOS will transform this into a real from-the-root path 31 ; without . or .. entries. Any component that is > 8.3 is truncated to 32 ; this and all * are expanded into ?'s. 33 ; 34 ; The second part of name translation involves subtree aliasing. A list of 35 ; subtree pairs is maintained by the external utility SUBST. The results of 36 ; the previous 'canonicalization' are then examined to see if any of the 37 ; subtree pairs is a prefix of the user path. If so, then this prefix is 38 ; replaced with the other subtree in the pair. 39 ; 40 ; A third part involves mapping this "real" path into a "physical" path. A 41 ; list of drive/subtree pairs are maintained by the external utility JOIN. 42 ; The output of the previous translation is examined to see if any of the 43 ; subtrees in this list are a prefix of the string. If so, then the prefix 44 ; is replaced by the appropriate drive letter. In this manner, we can 45 ; 'mount' one device under another. 46 ; 47 ; The final form of name translation involves the mapping of a user's 48 ; logical drive number into the internal physical drive. This is 49 ; accomplished by converting the drive number into letter:CON, performing 50 ; the above translation and then converting the character back into a drive 51 ; number. 52 ; 53 ; curdir_list STRUC 54 ; curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 55 ; curdir_flags DW ? ; various flags 56 ; curdir_devptr DD ? ; local pointer to DPB or net device 57 ; curdir_ID DW ? ; cluster of current dir (net ID) 58 ; DW ? 59 ; curdir_end DW ? ; end of assignment 60 ; curdir_list ENDS 61 ; curdir_netID EQU DWORD PTR curdir_ID 62 ; ;Flag word masks 63 ; curdir_isnet EQU 1000000000000000B 64 ; curdir_inuse EQU 0100000000000000B 65 ; 66 ; There are two main entry points: TransPath and TransFCB. TransPath will 67 ; take a path and form the real text of the pathname with all . and .. 68 ; removed. TransFCB will translate an FCB into a path and then invoke 69 ; TransPath. 70 ; 71 ; Implementation note: CURDIR_End field points to the point in the text 72 ; string where the user may back up to via .. It is the location of a 73 ; separator character. For the root, it points at the leading /. For net 74 ; assignments it points at the end (nul) of the initial assignment: 75 ; A:/ \\foo\bar \\foo\bar\blech\bozo 76 ; ^ ^ ^ 77 ; A: -> d: /path/ path/ text 78 ; 79 ; A000 version 4.00 Jan. 1988 80 81 [list -] 81 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 86 87 [list +] === Switch to base=002450h -> "DOSCODECODE" 88 section DOSCODECODE 89 [list -] 89 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 89 ****************** warning: out: BPB.INC... [-w+user] 89 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 89 ****************** warning: out: DEVSYM.INC... [-w+user] 96 ;.sall 97 98 %iassign Installed TRUE 99 100 I_need ThisCDS,DWORD ; pointer to CDS used 101 I_need CDSAddr,DWORD ; pointer to CDS table 102 I_need CDSCount,BYTE ; number of CDS entries 103 I_need CurDrv,BYTE ; current macro assignment (old 104 ; current drive) 105 I_need NUMIO,BYTE ; Number of physical drives 106 I_need fSharing,BYTE ; TRUE => no redirection allowed 107 I_need DummyCDS,80h ; buffer for dummy cds 108 I_need DIFFNAM,BYTE ; flag for MyName being set 109 I_need MYNAME,16 ; machine name 110 I_need MYNUM,WORD ; machine number 111 I_need DPBHEAD,DWORD ; beginning of DPB chain 112 I_need EXTERR_LOCUS,BYTE ; Extended Error Locus 113 I_need DrvErr,BYTE ; drive error 114 115 assume nocheck, ss:DOSGROUP 116 117 BREAK <$AssignOper -- Set up a Macro> 118 119 ; Inputs: 120 ; AL = 00 get assign mode (ReturnMode) 121 ; AL = 01 set assign mode (SetMode) 122 ; AL = 02 get attach list entry (GetAsgList) 123 ; AL = 03 Define Macro (attch start) 124 ; BL = Macro type 125 ; = 0 alias 126 ; = 1 file/device 127 ; = 2 drive 128 ; = 3 Char device -> network 129 ; = 4 File device -> network 130 ; DS:SI -> ASCIZ source name 131 ; ES:DI -> ASCIZ destination name 132 ; AL = 04 Cancel Macro 133 ; DS:SI -> ASCIZ source name 134 ; AL = 05 Modified get attach list entry 135 ; AL = 06 Get ifsfunc item 136 ; AL = 07 set in_use of a drive's CDS 137 ; DL = drive number, 0=default 0=A,, 138 ; AL = 08 reset in_use of a drive's CDS 139 ; DL = drive number, 0=A, 1=B,,, 140 ; Function: 141 ; Do macro stuff 142 ; Returns: 143 ; Std Xenix style error return 144 145 procedure D_AssignOper,NEAR 145 ****************** warning: proc D_AssignOper... [-w+user] 146 ASSUME DS:NOTHING,ES:NOTHING 147 0 00007102 3C07 CMP AL,7 ; set in_use ? ;AN000; 0 00007104 7526 JNZ chk08 ; no ;AN000; 150 srinuse: ;AN000; 0 00007106 50 PUSH AX ; save al ;AN000; 0 00007107 88D0 MOV AL,DL ; AL= drive id ;AN000; 0 00007109 E86F01 CALL GetCDSFromDrv ; ds:si -> cds ;AN000; 0 0000710C 58 POP AX ; ;AN000; 0 0000710D 7218 JC baddrv ; bad drive ;AN000; 0 0000710F 837C4500 CMP WORD PTR [SI + curdir_devptr],0 ; dpb ptr =0 ? ;AN000; 0 00007113 7412 JZ baddrv ; no ;AN000; 0 00007115 3C07 CMP AL,7 ; set ? ;AN000; 0 00007117 7507 JNZ resetdrv ; no ;AN000; 0 00007119 814C430040 OR word [SI + curdir_flags],curdir_inuse ; set in_use ;AN000; 0 0000711E EB19 JMP SHORT okdone ; ;AN000; 162 resetdrv: ;AN000; 0 00007120 816443FFBF AND word [SI + curdir_flags],~ curdir_inuse ; reset in_use ;AN000; 0 00007125 EB12 JMP SHORT okdone ; ;AN000; 165 baddrv: ;AN000; 0 00007127 B80F00 MOV AX,error_invalid_drive ; error ;AN000; 0 0000712A EB10 JMP SHORT ASS_ERR ; ;AN000; 168 chk08: ;AN000; 0 0000712C 3C08 CMP AL,8 ; reset inuse ? ;AN000; 0 0000712E 74D6 JZ srinuse ; yes ;AN000; 171 172 %IFN INSTALLED 173 transfer NET_ASSOPER 174 %ELSE 0 00007130 50 PUSH AX 176 multnet equ MultNET ; NASM port equate 0 00007131 B81E11 MOV AX,(multnet << 8) | 30 0 00007134 CD2F INT 2FH 0 00007136 5B POP BX ; Don't zap error code in AX 0 00007137 7203 JC ASS_ERR 181 okdone: 0 00007139 E9[0000] transfer SYS_RET_OK 183 184 ASS_ERR: 0 0000713C E9[0000] transfer SYS_RET_ERR 186 %ENDIF 187 188 EndProc D_AssignOper 189 190 Break 191 192 ; Inputs: AL has drive number A = 0 193 ; Outputs: Carry Set 194 ; No DPB for this drive number 195 ; Carry Clear 196 ; DS:SI points to DPB for drive 197 ; registers modified: DS,SI 198 Procedure FIND_DPB,NEAR 198 ****************** warning: proc FIND_DPB... [-w+user] 199 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000713F 36C536[0000] LDS SI,[ss:DPBHEAD] 201 DPB_LOOP: 0 00007144 83FEFF CMP SI,-1 0 00007147 740A JZ NO_DPB 0 00007149 3A04 CMP AL,[SI + dpb_drive] 0 0000714B 7501C3 retz ; Carry clear 0 0000714E C57419 LDS SI,[SI + dpb_next_dpb] 0 00007151 EBF1 JMP DPB_LOOP 208 209 NO_DPB: 0 00007153 F9 STC 0 00007154 C3 return 212 EndProc FIND_DPB 213 214 Break 215 216 ; Inputs: ThisCDS points to CDS 217 ; AL has uppercase drive letter 218 ; Outputs: ThisCDS is now empty 219 ; ES:DI point to CDS 220 ; Carry set if no DPB associated with drive 221 ; registers modified: AH,ES,DI 222 Procedure InitCDS,NEAR 222 ****************** warning: proc InitCDS... [-w+user] 223 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00007155 B43A MOV AH,':' 0 00007157 50 PUSH AX 0 00007158 2C40 SUB AL,"A"-1 ; A = 1 0 0000715A 363806[0000] CMP [ss:NUMIO],AL 0 0000715F 58 POP AX 229 THISCDS equ ThisCDS ; NASM port label 0 00007160 36C43E[0000] LES DI,[ss:THISCDS] 0 00007165 26C745430000 MOV word [ES:DI + curdir_flags],0 ; "free" CDS 0 0000716B 7239 JB RET_OK ; Drive does not map a physical drive 0 0000716D 268905 MOV WORD PTR [ES:DI + curdir_text],AX 0 00007170 50 PUSH AX 0 00007171 B85C00 MOV AX,"\" 0 00007174 26894502 MOV WORD PTR [ES:DI + curdir_text+2],AX ; NUL terminate 0 00007178 58 POP AX 0 00007179 26814D430040 OR word [ES:DI + curdir_flags],curdir_inuse 239 curdir_END equ curdir_end ; NASM port equate 0 0000717F 26C7454F0200 MOV word [ES:DI + curdir_END],2 ; MZ 3 Nov 83 0 00007185 26C745490000 MOV word [ES:DI + curdir_ID],0 0 0000718B 26C7454B0000 MOV word [ES:DI + curdir_ID+2],0 0 00007191 50 PUSH AX 0 00007192 1E PUSH DS 0 00007193 56 PUSH SI 0 00007194 2C41 SUB AL,"A" ; A = 0 0 00007196 E8A6FF invoke FIND_DPB 0 00007199 7208 JC PRET ; OOOOPPPPPSSSS!!!! 0 0000719B 26897545 MOV WORD PTR [ES:DI + curdir_devptr],SI 0 0000719F 268C5D47 MOV WORD PTR [ES:DI + curdir_devptr+2],DS 251 PRET: 0 000071A3 5E POP SI 0 000071A4 1F POP DS 254 assume ds:nothing 0 000071A5 58 POP AX 0 000071A6 C3 RET_OK: return 257 EndProc InitCDS 258 259 Break <$UserOper - get/set current user ID (for net)> 260 261 ; 262 ; $UserOper - retrieve or initiate a user id string. MSDOS will only 263 ; maintain this string and do no verifications. 264 ; 265 ; Inputs: AL has function type (0-get 1-set 2-printer-set 3-printer-get 266 ; 4-printer-set-flags,5-printer-get-flags) 267 ; DS:DX is user string pointer (calls 1,2) 268 ; ES:DI is user buffer (call 3) 269 ; BX is assign index (calls 2,3,4,5) 270 ; CX is user number (call 1) 271 ; DX is flag word (call 4) 272 ; Outputs: If AL = 0 then the current user string is written to DS:DX 273 ; and user CX is set to the user number 274 ; If AL = 3 then CX bytes have been put at input ES:DI 275 ; If AL = 5 then DX is flag word 276 277 Procedure D_UserOper,NEAR 277 ****************** warning: proc D_UserOper... [-w+user] 278 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000071A7 50 PUSH AX 0 000071A8 2C01 SUB AL,1 ; quick dispatch on 0,1 0 000071AA 58 POP AX 0 000071AB 7211 JB UserGet ; return to user the string 0 000071AD 742E JZ UserSet ; set the current user 0 000071AF 3C05 CMP AL,5 ; test for 2,3,4 or 5 0 000071B1 763D JBE UserPrint ; yep 286 errLoc_Unk equ errLOC_Unk ; NASM port equate 0 000071B3 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLoc_Unk ; Extended Error Locus 288 error_Invalid_Function equ error_invalid_function ; NASM port equate 0 000071B9 B001E9[0000] error error_Invalid_Function ; not 0,1,2,3 290 291 UserGet: 292 ; Transfer MYNAME to DS:DX 293 ; Set Return CX to MYNUM 0 000071BE 1E PUSH DS ; switch registers 0 000071BF 07 POP ES 296 assume es:nothing 0 000071C0 89D7 MOV DI,DX ; destination 0 000071C2 368B0E[0000] MOV CX,[ss:MYNUM] ; Get number 0 000071C7 E8[0000] invoke get_user_stack 300 User_CX equ user_CX ; NASM port equate 0 000071CA 894C04 MOV [SI + User_CX],CX ; Set number return 0 000071CD 161F Context DS ; point to DOSGroup 303 ASSUME DS:DOSGROUP 304 DOSGroup equ DOSGROUP ; NASM port equate 305 MyName equ MYNAME ; NASM port label 0 000071CF BE[0000] MOV SI,OFFSET MyName wrt DOSGroup ; point source to user string 307 UserMove: 308 ASSUME DS:NOTHING 0 000071D2 B90F00 MOV CX,15 0 000071D5 F3A4 REP MOVSB ; blam. 0 000071D7 31C0 XOR AX,AX ; 16th byte is 0 0 000071D9 AA STOSB 313 UserBye: 0 000071DA E9[0000] transfer sys_ret_ok ; no errors here 315 316 UserSet: 317 ASSUME DS:NOTHING 318 ; Transfer DS:DX to MYNAME 319 ; CX to MYNUM 0 000071DD 36890E[0000] MOV [ss:MYNUM],CX 0 000071E2 89D6 MOV SI,DX ; user space has source 0 000071E4 1607 Context ES 0 000071E6 BF[0000] MOV DI,OFFSET MyName wrt DOSGroup ; point dest to user string 324 DiffNam equ DIFFNAM ; NASM port label 0 000071E9 36FE06[0000] INC byte [ss:DiffNam] ; signal change 0 000071EE EBE2 JMP UserMove 327 328 UserPrint: 329 ASSUME ES:NOTHING 330 %IFN Installed 331 transfer PRINTER_GETSET_STRING 332 %ELSE 0 000071F0 50 PUSH AX 334 multNET equ MultNET ; NASM port equate 0 000071F1 B81F11 MOV AX,(multNET << 8) | 31 0 000071F4 CD2F INT 2FH 0 000071F6 5A POP DX ; Clean stack 0 000071F7 7302 JNC OKPA 0 000071F9 EBC0 transfer SYS_RET_ERR 340 341 OKPA: 0 000071FB EBDD transfer SYS_RET_OK 343 %ENDIF 344 345 EndProc D_UserOper 346 347 Break 348 349 ; 350 ; GetVisDrv - correctly map non-spliced inuse drives 351 ; 352 ; Inputs: AL has drive identifier (0=default) 353 ; Outputs: Carry Set - invalid drive/macro 354 ; Carry Clear - AL has physical drive (0=A) 355 ; ThisCDS points to CDS 356 ; Registers modified: AL 357 358 Procedure GetVisDrv,NEAR 358 ****************** warning: proc GetVisDrv... [-w+user] 359 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000071FD E81A00 CALL GetThisDrv ; get inuse drive 0 00007200 72A4 retc 0 00007202 1E56 SaveReg 0 00007204 36C536[0000] LDS SI,[ss:ThisCDS] 0 00007209 F744430020 TEST word [SI + curdir_flags],curdir_splice 0 0000720E 5E1F RestoreReg 0 00007210 7494 retz ; if not spliced, return OK 0 00007212 36C606[0000]0F MOV byte [ss:DrvErr],error_invalid_drive ;IFS. ;AN000; 0 00007218 F9 STC ; signal error 0 00007219 C3 return 370 EndProc GetVisDrv 371 372 Break 373 374 ; 375 ; GetThisDrv - look through a set of macros and return the current drive and 376 ; macro pointer 377 ; 378 ; Inputs: AL has drive identifier (1=A, 0=default) 379 ; Outputs: 380 ; Carry Set - invalid drive/macro 381 ; Carry Clear - AL has physical drive (0=A) 382 ; ThisCDS points to macro 383 ; Registers modified: AL 384 385 Procedure GetThisDrv,NEAR 385 ****************** warning: proc GetThisDrv... [-w+user] 386 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000721A 08C0 OR AL,AL ; are we using default drive? 0 0000721C 7506 JNZ GetMap ; no, go get the CDS pointers 0 0000721E 36A0[0000] MOV AL,[ss:CurDrv] ; get the current drive 0 00007222 FEC0 INC AL ; Counteract next instruction 391 GetMap: 0 00007224 FEC8 DEC AL ; 0 = A 0 00007226 1E56 SaveReg ; save world 0 00007228 36C606[0000]02 mov byte [ss:EXTERR_LOCUS],errLOC_Disk 0 0000722E 36F606[0000]FF TEST byte [ss:fSharing],-1 ; Logical or Physical? 0 00007234 7421 JZ Not_SRVC ; Logical 0 00007236 500657 SaveReg 0 00007239 36C706[0000][0000] MOV WORD [ss:ThisCDS],OFFSET DummyCDS wrt DOSGroup 0 00007240 368C16[0200] MOV WORD PTR [ss:ThisCDS+2], ss ; ThisCDS = &DummyCDS; 0 00007245 0441 ADD AL,'A' 0 00007247 E80BFF CALL InitCDS ; InitCDS(c); 0 0000724A 26F745430040 TEST word [ES:DI + curdir_flags],curdir_inuse ; Clears carry 0 00007250 5F0758 RestoreReg 0 00007253 740E JZ GetBerr ; Not a physical drive. 0 00007255 EB21 JMP SHORT GetBye ; carry clear 406 407 Not_SRVC: 0 00007257 E82100 invoke GetCDSFromDrv 0 0000725A 720F JC GetBerr2 ; Unassigned CDS -> return error already set 0 0000725C F744430040 TEST word [SI + curdir_flags],curdir_inuse ; Clears Carry 0 00007261 7515 JNZ GetBye ; carry clear 412 GetBerr: 0 00007263 B01A MOV AL,error_not_DOS_disk ;AN000;IFS. Formatted IFS drive 0 00007265 837C4500 CMP WORD PTR [SI + curdir_devptr],0 ;AN000;IFS. dpb ptr =0 ? 0 00007269 7502 JNZ notfat ;AN000;IFS. no 416 GetBerr2: 0 0000726B B00F MOV AL,error_invalid_drive ;AN000;;IFS. invalid FAT drive 418 notfat: ;AN000; 0 0000726D 36A2[0000] MOV [ss:DrvErr],AL ;AN000;;IFS. save this for IOCTL 420 errLOC_UNK equ errLOC_Unk ; NASM port equate 0 00007271 36C606[0000]01 mov byte [ss:EXTERR_LOCUS],errLOC_UNK 0 00007277 F9 STC 0 00007278 5E1F GetBye: RestoreReg ; restore world 0 0000727A C3 return 425 EndProc GetThisDrv 426 427 Break 428 429 ; 430 ; GetCDSFromDrv - given a physical drive number, convert it to a CDS 431 ; pointer, returning an error if the drive number is greater than the 432 ; number of CDS's 433 ; 434 ; Inputs: AL is physical unit # A=0... 435 ; Outputs: Carry Set if Bad Drive 436 ; Carry Clear 437 ; DS:SI -> CDS 438 ; [THISCDS] = DS:SI 439 ; Registers modified: DS,SI 440 441 Procedure GetCDSFromDrv,NEAR 441 ****************** warning: proc GetCDSFromDrv... [-w+user] 442 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000727B 363A06[0000] CMP AL,[ss:CDSCount] ; is this a valid designator 0 00007280 7202 JB GetCDS ; yes, go get the macro 0 00007282 F9 STC ; signal error 0 00007283 C3 return ; bye 447 GetCDS: 0 00007284 5350 SaveReg 0 00007286 36C536[0000] LDS SI,[ss:CDSAddr] ; get pointer to table 450 CurDir_list_struc_size equ curdir_list_struc_size ; NASM port equate 0 0000728B B358 MOV BL,CurDir_list_struc_size ; size in convenient spot 0 0000728D F6E3 MUL BL ; get net offset 0 0000728F 01C6 ADD SI,AX ; convert to true pointer 0 00007291 368936[0000] MOV WORD PTR [ss:ThisCDS],SI ; store convenient offset 0 00007296 368C1E[0200] MOV WORD PTR [ss:ThisCDS+2],DS ; store convenient segment 0 0000729B 585B RestoreReg 0 0000729D F8 CLC ; no error 0 0000729E C3 return ; bye! 459 EndProc GetCDSFromDrv 460 461 END === Trace listing source: ../DOS/macro2.lst 1 ; SCCSID = @(#)macro2.asm 1.2 85/07/23 2 ;TITLE MACRO2 - Pathname and macro related internal routines 3 ;NAME MACRO2 4 ; 5 ; TransFCB written 6 ; TransPath written 7 ; TransPathSet written 8 ; TransPathNoSet Written 9 ; Canonicalize written 10 ; PathSep written 11 ; SkipBack written 12 ; CopyComponent written 13 ; Splice written 14 ; $NameTrans written 15 ; DriveFromText 16 ; TextFromDrive 17 ; PathPref 18 ; ScanPathChar 19 ; 20 ; Revision history: 21 ; 22 ; Created: MZ 4 April 1983 23 ; MZ 18 April 1983 Make TransFCB handle extended FCBs 24 ; AR 2 June 1983 Define/Delete macro for NET redir. 25 ; MZ 3 Nov 83 Fix InitCDS to reset length to 2 26 ; MZ 4 Nov 83 Fix NetAssign to use STRLEN only 27 ; MZ 18 Nov 83 Rewrite string processing for subtree 28 ; aliasing. 29 ; BAS 3 Jan 85 ScanPathChar to search for path separator 30 ; in null terminated string. 31 ; 32 ; MSDOS performs several types of name translation. First, we maintain for 33 ; each valid drive letter the text of the current directory on that drive. 34 ; For invalid drive letters, there is no current directory so we pretend to 35 ; be at the root. A current directory is either the raw local directory 36 ; (consisting of drive:\path) or a local network directory (consisting of 37 ; \\machine\path. There is a limit on the point to which a .. is allowed. 38 ; 39 ; Given a path, MSDOS will transform this into a real from-the-root path 40 ; without . or .. entries. Any component that is > 8.3 is truncated to 41 ; this and all * are expanded into ?'s. 42 ; 43 ; The second part of name translation involves subtree aliasing. A list of 44 ; subtree pairs is maintained by the external utility SUBST. The results of 45 ; the previous 'canonicalization' are then examined to see if any of the 46 ; subtree pairs is a prefix of the user path. If so, then this prefix is 47 ; replaced with the other subtree in the pair. 48 ; 49 ; A third part involves mapping this "real" path into a "physical" path. A 50 ; list of drive/subtree pairs are maintained by the external utility JOIN. 51 ; The output of the previous translation is examined to see if any of the 52 ; subtrees in this list are a prefix of the string. If so, then the prefix 53 ; is replaced by the appropriate drive letter. In this manner, we can 54 ; 'mount' one device under another. 55 ; 56 ; The final form of name translation involves the mapping of a user's 57 ; logical drive number into the internal physical drive. This is 58 ; accomplished by converting the drive number into letter:CON, performing 59 ; the above translation and then converting the character back into a drive 60 ; number. 61 ; 62 ; curdir_list STRUC 63 ; curdir_text DB DIRSTRLEN DUP (?) ; text of assignment and curdir 64 ; curdir_flags DW ? ; various flags 65 ; curdir_devptr DD ? ; local pointer to DPB or net device 66 ; curdir_ID DW ? ; cluster of current dir (net ID) 67 ; DW ? 68 ; curdir_end DW ? ; end of assignment 69 ; curdir_list ENDS 70 ; curdir_netID EQU DWORD PTR curdir_ID 71 ; ;Flag word masks 72 ; curdir_isnet EQU 1000000000000000B 73 ; curdir_inuse EQU 0100000000000000B 74 ; 75 ; 76 ; There are two main entry points: TransPath and TransFCB. TransPath will 77 ; take a path and form the real text of the pathname with all . and .. 78 ; removed. TransFCB will translate an FCB into a path and then invoke 79 ; TransPath. 80 ; 81 ; Implementation note: CURDIR_End field points to the point in the text 82 ; string where the user may back up to via .. It is the location of a 83 ; separator character. For the root, it points at the leading /. For net 84 ; assignments it points at the end (nul) of the initial assignment: 85 ; A:/ \\foo\bar \\foo\bar\blech\bozo 86 ; ^ ^ ^ 87 ; A: -> d: /path/ path/ text 88 ; 89 ; A000 version 4.00 Jan. 1988 90 91 [list -] 91 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 96 97 [list +] === Switch to base=002450h -> "DOSCODECODE" 98 section DOSCODECODE 99 [list -] 99 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 99 ****************** warning: out: BPB.INC... [-w+user] 99 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 99 ****************** warning: out: DEVSYM.INC... [-w+user] 106 ;.sall 107 108 %iassign Installed TRUE 109 110 I_need Splices,BYTE ; TRUE => splices are being done. 111 I_need WFP_Start,WORD ; pointer to beginning of expansion 112 I_need Curr_Dir_End,WORD ; offset to end of current dir 113 I_need ThisCDS,DWORD ; pointer to CDS used 114 I_need ThisDPB,DWORD ; pointer to DPB used 115 I_need NAME1,11 ; Parse output of NameTrans 116 I_need OpenBuf,128 ; ususal destination of strings 117 I_need ExtFCB,BYTE ; flag for extended FCBs 118 I_need Sattrib,BYTE ; attribute of search 119 I_need fSplice,BYTE ; TRUE => do splice after canonicalize 120 I_need fSharing,BYTE ; TRUE => no redirection allowed 121 I_Need NoSetDir,BYTE ; TRUE => syscall is interested in 122 ; entry, not contents. We splice only 123 ; inexact matches 124 I_Need cMeta,BYTE ; count of meta chars in path 125 I_Need Temp_Var,WORD ;AN000; variable for temporary use 3/31/KK 126 I_Need DOS34_FLAG,WORD ;AN000; variable for dos34 127 I_Need NO_FILTER_PATH,DWORD ;AN000; pointer to orignal path === Switch to base=002450h -> "DOSCODETABLE" 128 section DOSCODETABLE 129 EXTRN CharType:BYTE === Switch to base=002450h -> "DOSCODECODE" 130 section DOSCODECODE 131 132 BREAK 133 134 ; 135 ; TransFCB - Copy an FCB from DS:DX into a reserved area doing all of the 136 ; gritty substitution. 137 ; 138 ; Inputs: DS:DX - pointer to FCB 139 ; ES:DI - point to destination 140 ; Outputs: Carry Set - invalid path in final map 141 ; Carry Clear - FCB has been mapped into ES:DI 142 ; Sattrib is set from possibly extended FCB 143 ; ExtFCB set if extended FCB found 144 ; Registers modified: most 145 146 Procedure TransFCB,NEAR 146 ****************** warning: proc TransFCB... [-w+user] 147 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 148 PUBLIC MACRO001S,MACRO001E 149 MACRO001S: 150 LocalVar FCBTmp,16 151 MACRO001E: 0 0000729F 5589E583EC10 Enter 0 000072A5 1607 Context ES ; get DOSGroup addressability 0 000072A7 0657 SaveReg ; save away final destination 0 000072A9 8D7EF0 LEA DI,[FCBTmp] ; point to FCB temp area 0 000072AC 368326[0000]00 and word [ss:ExtFCB], 0 ; clear ExtFCB and Sattrib 157 ; MOV byte [ss:ExtFCB],0 ; no extended FCB found 158 ; MOV byte [ss:Sattrib],0 ; default search attributes 0 000072B2 E8[0000] invoke GetExtended ; get FCB, extended or not 0 000072B5 740C JZ GetDrive ; not an extended FCB, get drive 0 000072B7 8A44FF MOV AL,[SI-1] ; get attributes 162 SAttrib equ Sattrib ; NASM port label 0 000072BA 36A2[0000] MOV [ss:SAttrib],AL ; store search attributes 0 000072BE 36FE0E[0000] dec byte [ss:ExtFCB] ; = 255, signal extended FCB 165 GetDrive: 0 000072C3 AC LODSB ; get drive byte 0 000072C4 E8[0000] invoke GetThisDrv 0 000072C7 722C jc BadPack 0 000072C9 E87D03 CALL TextFromDrive ; convert 0-based drive to text 170 ; 171 ; Scan the source to see if there are any illegal chars 172 ; 173 DOSGroup equ DOSGROUP ; NASM port equate 0 000072CC BB[0000] MOV BX,OFFSET CharType 175 %IF DBCS ;AN000; 176 ;----------------------------- Start of DBCS 2/13/KK 177 SaveReg ;AN000;; back over name, ext 178 MOV CX,8 ;AN000;; 8 chars in main part of name 179 FCBScan:LODSB ;AN000;; get a byte 180 invoke testkanj ;AN000; 181 jz notkanj2 ;AN000; 182 DEC CX ;AN000; 183 JCXZ VolidChck ;AN000;; Kanji half char screw up 184 LODSB ;AN000;; second kanji byte 185 Nextch equ NextCh ; NASM port label 186 jmp short Nextch ;AN000; 187 VolidChck: ;AN000; 188 TEST byte [ss:SAttrib],attr_volume_id ;AN000;; volume id ? 189 Badpack equ BadPack ; NASM port label 190 JZ Badpack ;AN000;; no, error 191 OR word [ss:DOS34_FLAG],DBCS_VOLID ;AN000;; no, error 192 DEC CX ;AN000;; cx=-1 193 INC SI ;AN000;; next char 194 JMP SHORT FCBScango ;AN000; 195 notkanj2: ;AN000; 196 cs xlatb ;AN000;;get bits 197 TEST AL,fFCB ;AN000; 198 JZ BadPack ;AN000; 199 NextCh: ;AN000; 200 LOOP FCBScan ;AN000; 201 FCBScango: ;AN000; 202 ADD CX,3 ;AN000;; Three chars in extension 203 FCBScanE: ;AN000; 204 LODSB ;AN000; 205 invoke testkanj ;AN000; 206 jz notkanj3 ;AN000; 207 DEC CX ;AN000; 208 JCXZ BadPack ;AN000;; Kanji half char problem 209 LODSB ;AN000;; second kanji byte 210 jmp short NextChE ;AN000; 211 notkanj3: ;AN000; 212 cs xlatb ;AN000;; get bits 213 TEST AL,fFCB ;AN000; 214 JZ BadPack ;AN000; 215 NextChE: ;AN000; 216 LOOP FCBScanE ;AN000; 217 ;----------------------------- End of DBCS 2/13/KK 218 %ELSE 219 0 000072CF B90B00 MOV CX,11 0 000072D2 56 SaveReg ; back over name, ext 0 000072D3 AC FCBScan:LODSB ; get a byte 0 000072D4 2ED7 cs xlatb ; get bits 0 000072D6 A808 TEST AL,fFCB 0 000072D8 741B JZ BadPack 0 000072DA E2F7 NextCh: LOOP FCBScan 227 %ENDIF 0 000072DC 5E RestoreReg 0 000072DD 89FB MOV BX,DI 0 000072DF E8[0000] invoke PackName ; crunch the path 0 000072E2 5F07 RestoreReg ; get original destination 0 000072E4 161F Context DS ; get DS addressability 0 000072E6 8D76F0 LEA SI,[FCBTmp] ; point at new pathname 0 000072E9 803F00 CMP BYTE PTR [BX],0 0 000072EC 7407 JZ BadPack 0 000072EE 55 SaveReg 0 000072EF E80D00 CALL TransPathSet ; convert the path 0 000072F2 5D RestoreReg 0 000072F3 7303 JNC FCBRet ; bye with transPath error code 240 BadPack: 0 000072F5 F9 STC 0 000072F6 B003 MOV AL,error_path_not_found 0 000072F8 89EC5D FCBRet: Leave 0 000072FB C3 return 245 EndProc TransFCB,NoCheck 246 247 BREAK 248 249 ; 250 ; TransPath - copy a path from DS:SI to ES:DI, performing component string 251 ; substitution, insertion of current directory and fixing . and .. 252 ; entries. Perform splicing. Allow input string to match splice 253 ; exactly. 254 ; 255 ; TransPathSet - Same as above except No splicing is performed if input path 256 ; matches splice. 257 ; 258 ; TransPathNoSet - No splicing/local using is performed at all. 259 ; 260 ; The following anomalous behaviour is required: 261 ; 262 ; Drive letters on devices are ignored. (set up DummyCDS) 263 ; Paths on devices are ignored. (truncate to 0-length) 264 ; Raw net I/O sets ThisCDS => NULL. 265 ; fSharing => dummyCDS and no subst/splice. Only canonicalize. 266 ; 267 ; Other behaviour: 268 ; 269 ; ThisCDS set up. 270 ; FatRead done on local CDS. 271 ; ValidateCDS done on local CDS. 272 ; 273 ; Brief flowchart: 274 ; 275 ; if fSharing then 276 ; set up DummyCDS (ThisCDS) 277 ; canonicalize (sets cMeta) 278 ; splice 279 ; fatRead 280 ; return 281 ; if \\ or d:\\ lead then 282 ; set up null CDS (ThisCDS) 283 ; canonicalize (sets cMeta) 284 ; return 285 ; if device then 286 ; set up dummyCDS (ThisCDS) 287 ; canonicalize (sets cMeta) 288 ; return 289 ; if file then 290 ; getCDS (sets (ThisCDS) from name) 291 ; validateCDS (may reset current dir) 292 ; Copy current dir 293 ; canonicalize (set cMeta) 294 ; splice 295 ; generate correct CDS (ThisCDS) 296 ; if local then 297 ; fatread 298 ; return 299 ; 300 ; Inputs: DS:SI - point to ASCIZ string path 301 ; DI - point to buffer in DOSGroup 302 ; Outputs: Carry Set - invalid path specification: too many .., bad 303 ; syntax, etc. or user FAILed to I 24. 304 ; WFP_Start - points to beginning of buffer 305 ; Curr_Dir_End - points to end of current dir in path 306 ; DS - DOSGroup 307 ; Registers modified: most 308 309 Procedure TransPath,NEAR 309 ****************** warning: proc TransPath... [-w+user] 310 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000072FC 30C0 XOR AL,AL 0 000072FE A9 db 0A9h ; test ax, imm16 - skip mov al, -1 313 Entry TransPathSet 0 000072FF B0FF MOV AL,-1 315 SetSplice: 0 00007301 36A2[0000] MOV [ss:NoSetDir],AL ; NoSetDir = !fExact; 0 00007305 B0FF MOV AL,-1 318 Entry TransPathNoSet 0 00007307 368936[0000] MOV WORD PTR [ss:NO_FILTER_PATH],SI ;AN000;;IFS. save old path for IFS 0 0000730C 368C1E[0200] MOV WORD PTR [ss:NO_FILTER_PATH+2],DS ;AN000;;IFS. 321 0 00007311 36A2[0000] MOV [ss:fSplice],AL ; fSplice = TRUE; 0 00007315 36C606[0000]FF MOV byte [ss:cMeta],-1 0 0000731B 36893E[0000] MOV [ss:WFP_Start],DI 0 00007320 36C706[0000]FFFF MOV word [ss:Curr_Dir_End],-1 ; crack from start 0 00007327 1607 Context ES 0 00007329 8DAD8600 LEA BP,[DI+TEMPLEN] ; end of buffer 328 ; 329 ; if this is through the server dos call, fsharing is set. We set up a 330 ; dummy cds and let the operation go. 331 ; 0 0000732D 36F606[0000]FF TEST byte [ss:fSharing],-1 ; if no sharing 333 CheckUNC equ CheckUnc ; NASM port label 0 00007333 7435 JZ CheckUNC ; skip to UNC check 335 ; 336 ; ES:DI point to buffer 337 ; 0 00007335 E8FA02 CALL DriveFromText ; get drive and advance DS:SI 0 00007338 E8[0000] invoke GetThisDrv ; Set ThisCDS and convert to 0-based 0 0000733B 722A jc NoPath 0 0000733D E80903 CALL TextFromDrive ; drop in new 0 00007340 8D5D01 LEA BX,[DI+1] ; backup limit 0 00007343 E83601 CALL Canonicalize ; copy and canonicalize 0 00007346 72B3 retc ; errors 345 ; 346 ; Perform splices for net guys. 347 ; 0 00007348 161F Context DS 349 wfp_Start equ WFP_Start ; NASM port label 0 0000734A 8B36[0000] MOV SI,[wfp_Start] ; point to name 0 0000734E F606[0000]FF TEST byte [fSplice],-1 0 00007353 7403 JZ NoServerSplice 0 00007355 E83502 CALL Splice 354 NoServerSplice: 0 00007358 161F Context DS ; for FATREAD 0 0000735A C43E[0000] LES DI,[ThisCDS] ; for fatread 0 0000735E E8[0000] EnterCrit critDisk 0 00007361 E8[0000] Invoke FatRead_CDS 0 00007364 E8[0000] LeaveCrit critDisk 360 NoPath: 0 00007367 B003 MOV AL,error_path_not_found ; Set up for possible bad path error 0 00007369 C3 return ; any errors are in Carry flag 363 ASSUME DS:NOTHING 364 ; 365 ; Let the network decide if the name is for a spooled device. It will map 366 ; the name if so. 367 ; 368 CheckUnc: 0 0000736A 36C706[0000]FFFF MOV WORD [ss:ThisCDS],-1 ; NULL thisCDS 370 multNet equ MultNET ; NASM port equate 0 00007371 B82311CD2F CallInstall NetSpoolCheck,multNet,35 0 00007376 7329 JNC UNCDone 373 ; 374 ; At this point the name is either a UNC-style name (prefixed with two leading 375 ; \\s) or is a local file/device. Remember that if a net-spooled device was 376 ; input, then the name has been changed to the remote spooler by the above net 377 ; call. Also, there may be a drive in front of the \\. 378 ; 379 NO_CHECK: 0 00007378 E8B702 CALL DriveFromText ; eat drive letter 0 0000737B 50 PUSH AX ; save it 0 0000737C 8B04 MOV AX,WORD PTR [SI] ; get first two bytes of path 0 0000737E E8[0000] Invoke PathChrCmp ; convert to normal form 0 00007381 86E0 XCHG AH,AL ; swap for second byte 0 00007383 E8[0000] Invoke PathChrCmp ; convert to normal form 0 00007386 751F JNZ CheckDevice ; not a path char 0 00007388 38C4 CMP AH,AL ; are they same? 0 0000738A 751B JNZ CheckDevice ; nope 389 ; 390 ; We have a UNC request. We must copy the string up to the beginning of the 391 ; local machine root path 392 ; 393 0 0000738C 58 POP AX 0 0000738D A5 MOVSW ; get the lead \\. 0 0000738E AC UNCCpy: LODSB ; get a byte 397 %IF DBCS ;AN000; 398 ;----------------------------- Start of DBCS 2/23/KK 399 invoke testkanj ;AN000; 400 jz notkanj1 ;AN000; 401 STOSB ;AN000; 402 LODSB ;AN000; 403 OR AL,AL ;AN000; 404 JZ UNCTerm ;AN000;; Ignore half kanji error for now 405 STOSB ;AN000; 406 jmp UNCCpy ;AN000; 407 notkanj1: ;AN000; 408 ;----------------------------- End of DBCS 2/23/KK 409 %ENDIF ;AN000; 0 0000738F E8[0000] invoke UCase ;AN000;; convert the char 0 00007392 08C0 OR AL,AL 0 00007394 740E JZ UNCTerm ; end of string. All done. 0 00007396 E8[0000] Invoke PathChrCmp ; is it a path char? 0 00007399 89FB MOV BX,DI ; backup position 0 0000739B AA STOSB 0 0000739C 75F0 JNZ UNCCpy ; no, go copy 0 0000739E E8DB00 CALL Canonicalize ; wham (and set cMeta) 418 UNCDone: 0 000073A1 161F Context DS 420 %IF DBCS 421 ;----------------------------- Start of DBCS 2/23/KK 422 retc ;AN000; Return if error from Canonicalize 423 424 ; Although Cononicalize has done lots of good things for us it may also have 425 ; done e5 to 05 conversion on the fisrt char following a path sep char which is 426 ; not wanted on a UNC request as this should be left for the remote station. 427 ; The simplest thing to do is check for such conversions and convert them back 428 ; again. 429 ; This check loop is also called from the DoFile section of TransPath if the 430 ; file is a remote file. Entry point when called is TP_check05 with the 431 ; inputs/outputs as follows; 432 ; Inputs : ES:DI = Buffer to check for re-conversion 433 ; Outputs: None 434 ; Used : DI,AX 435 436 437 WFP_start equ WFP_Start ; NASM port label 438 MOV DI,[WFP_start] ;AN000;; ES:DI points to converted string 439 TP_check05: ;AN000; 440 MOV AL,BYTE PTR [ES:DI] ;AN000;; Get character from path 441 OR AL,AL ;AN000;; End of null terminated path? 442 JZ TP_end05 ;AN000;; Finished, CF =0 from OR (ret success) 443 invoke testkanj ;AN000;; Kanji lead character? 444 JZ TP_notK ;AN000;; Check for path seperator if not 445 INC DI ;AN000;; Bypass Kanji second byte 446 JMP TP_nxt05 ;AN000;; Go to check next character 447 TP_notK: ;AN000; 448 invoke PathChrCmp ;AN000;; Is it a path seperator char? 449 JNZ TP_nxt05 ;AN000;; Check next character if not 450 CMP BYTE PTR [ES:DI+1],05 ;AN000;; 05 following path sep char? 451 JNZ TP_nxt05 ;AN000;; Check next character if not 452 MOV BYTE PTR [ES:DI+1],0E5h ;AN000;; Convert 05 back to E5 453 TP_nxt05: ;AN000; 454 INC DI ;AN000;; Point to next char in path 455 JMP TP_check05 ;AN000;; Test all chars in path 456 TP_end05: 457 ;----------------------------- End of DBCS 2/23/KK 458 %ENDIF ;AN000; 0 000073A3 C3 return ; return error code 460 461 ASSUME DS:NOTHING 462 UNCTerm: 0 000073A4 AA STOSB ;AN000; 0 000073A5 EBFA JMP UNCDone ;AN000; 465 466 CheckDevice: 467 ; 468 ; Check DS:SI for device. First eat any path stuff 469 ; 0 000073A7 58 POP AX ; retrieve drive info 0 000073A8 803C00 CMP BYTE PTR [SI],0 ; check for null file 0 000073AB 7504 JNZ CheckPath 0 000073AD B002 MOV AL,error_file_not_found ; bad file error 0 000073AF F9 STC ; signal error on null input 0 000073B0 C3 RETURN ; bye! 476 CheckPath: 0 000073B1 5055 SaveReg ; save drive number 0 000073B3 E8[0000] Invoke CheckThisDevice ; snoop for device 0 000073B6 5D58 RestoreReg ; get drive letter back 0 000073B8 731C JNC DoFile ; yes we have a file. 481 ; 482 ; We have a device. AX has drive letter. At this point we may fake a CDS ala 483 ; sharing DOS call. We know by getting here that we are NOT in a sharing DOS 484 ; call. 485 ; 0 000073BA 36C606[0000]FF MOV byte [ss:fSharing],-1 ; simulate sharing dos call 0 000073C0 E8[0000] invoke GetThisDrv ; set ThisCDS and init DUMMYCDS 0 000073C3 36C606[0000]00 MOV byte [ss:fSharing],0 ; 489 ; 490 ; Now that we have noted that we have a device, we put it into a form that 491 ; getpath can understand. Normally getpath requires d:\ to begin the input 492 ; string. We relax this to state that if the d:\ is present then the path 493 ; may be a file. If D:/ (note the forward slash) is present then we have 494 ; a device. 495 ; 0 000073C9 E87D02 CALL TextFromDrive 0 000073CC B02F MOV AL,'/' ; path sep. 0 000073CE AA STOSB 0 000073CF E8[0000] invoke StrCpy ; move remainder of string 0 000073D2 F8 CLC ; everything OK. 0 000073D3 161F Context DS ; remainder of OK stuff 0 000073D5 C3 return 503 ; 504 ; We have a file. Get the raw CDS. 505 ; 506 DoFile: 507 ASSUME DS:NOTHING 0 000073D6 E8[0000] invoke GetVisDrv ; get proper CDS 0 000073D9 B003 MOV AL,error_path_not_found ; Set up for possible bad file error 0 000073DB 72F8 retc ; CARRY set -> bogus drive/spliced 511 ; 512 ; ThisCDS has correct CDS. DS:SI advanced to point to beginning of path/file. 513 ; Make sure that CDS has valid directory; ValidateCDS requires a temp buffer 514 ; Use the one that we are going to use (ES:DI). 515 ; 0 000073DD 1E560657 SaveReg ; save all string pointers. 0 000073E1 E8[0000] invoke ValidateCDS ; poke CDS amd make everything OK 0 000073E4 5F075E1F RestoreReg ; get back pointers 0 000073E8 B003 MOV AL,error_path_not_found ; Set up for possible bad path error 0 000073EA 72E9 retc ; someone failed an operation 521 ; 522 ; ThisCDS points to correct CDS. It contains the correct text of the 523 ; current directory. Copy it in. 524 ; 0 000073EC 1E56 SaveReg 0 000073EE 36C536[0000] LDS SI,[ss:ThisCDS] ; point to CDS 0 000073F3 89FB MOV BX,DI ; point to destination 0 000073F5 035C4F ADD BX,[SI + curdir_end] ; point to backup limit 529 ; LEA SI,[SI].curdir_text ; point to text 0 000073F8 8DAD8600 LEA BP,[DI+TEMPLEN] ; regenerate end of buffer 531 %IF DBCS ;AN000; 532 ;------------------------ Start of DBCS 2/13/KK 533 Kcpylp: ;AN000; 534 LODSB ;AN000; 535 invoke TestKanj ;AN000; 536 jz Notkanjf ;AN000; 537 STOSB ;AN000; 538 MOVSB ;AN000; 539 CMP BYTE PTR [SI],0 ;AN000; 540 JNZ Kcpylp ;AN000; 541 MOV AL, '\' ;AN000; 542 STOSB ;AN000; 543 JMP SHORT GetOrig ;AN000; 544 Notkanjf: ;AN000; 545 STOSB ;AN000; 546 OR AL,AL ;AN000; 547 JNZ Kcpylp ;AN000; 548 DEC DI ;AN000;; point to NUL byte 549 550 ;------------------------ End of DBCS 2/13/KK 551 %ELSE ;AN000; 0 000073FC E8[0000] invoke FStrCpy ; copy string. ES:DI point to end 0 000073FF 4F DEC DI ; point to NUL byte 554 %ENDIF ;AN000; 555 ; 556 ; Make sure that there is a path char at end. 557 ; 0 00007400 B05C MOV AL,'\' 0 00007402 263845FF CMP [ES:DI-1],AL 0 00007406 7401 JZ GetOrig 0 00007408 AA STOSB 562 ; 563 ; Now get original string. 564 ; 565 GetOrig: 0 00007409 4F DEC DI ; point to path char 0 0000740A 5E1F RestoreReg 568 ; 569 ; BX points to the end of the root part of the CDS (at where a path char 570 ; should be) . Now, we decide whether we use this root or extend it with the 571 ; current directory. See if the input string begins with a leading \. 572 ; 0 0000740C E8D300 CALL PathSep ; is DS:SI a path sep? 0 0000740F 7511 JNZ PathAssure ; no, DI is correct. Assure a path char 0 00007411 08C0 OR AL,AL ; end of string? 0 00007413 7410 JZ DoCanon ; yes, skip. 577 ; 578 ; The string does begin with a \. Reset the beginning of the canonicalization 579 ; to this root. Make sure that there is a path char there and advance the 580 ; source string over all leading \'s. 581 ; 0 00007415 89DF MOV DI,BX ; back up to root point. 583 SkipPath: 0 00007417 AC LODSB 0 00007418 E8[0000] invoke PathChrCmp 0 0000741B 74FA JZ SkipPath 0 0000741D 4E DEC SI 0 0000741E 08C0 OR AL,AL 0 00007420 7403 JZ DoCanon 590 ; 591 ; DS:SI start at some file name. ES:DI points at some path char. Drop one in 592 ; for yucks. 593 ; 594 PathAssure: 0 00007422 B05C MOV AL,'\' 0 00007424 AA STOSB 597 ; 598 ; ES:DI point to the correct spot for canonicalization to begin. 599 ; BP is the max extent to advance DI 600 ; BX is the backup limit for .. 601 ; 602 DoCanon: 0 00007425 E85400 CALL Canonicalize ; wham. 0 00007428 72AB retc ; badly formatted path. 605 %IF DBCS ;AN000; 606 ;--------------------- Start of DBCS 2/13/KK 607 ; Although Cononicalize has done lots of good things for us it may also have 608 ; done e5 to 05 conversion on the fisrt char following a path sep char which is 609 ; not wanted if this a remote file as this should be left for the remote 610 ; station. Check for a leading \\ in the path buffer and call TP_check05 to 611 ; reconvert if found. 612 613 MOV DI,[ss:WFP_start] ;AN000;; ES:DI points to string 614 MOV AX,WORD PTR [ES:DI] ;AN000;; Get leading 2 chars from path buffer 615 invoke PathChrCmp ;AN000;; First char a path char? 616 JNZ TP_notremote ;AN000;; Not remote if not. 617 invoke PathChrCmp ;AN000;; Second char a path char? 618 JNZ TP_notremote ;AN000;; Not remote if not 619 CALL TP_check05 ;AN000;; Remote so convert 05 back to e5 620 TP_notremote: ;AN000; 621 ;--------------------- End of DBCS 2/13/KK 622 %ENDIF 623 ; 624 ; The string has been moved to ES:DI. Reset world to DOS context, pointers 625 ; to wfp_start and do string substitution. BP is still the max position in 626 ; buffer. 627 ; 0 0000742A 161F Context DS 629 wfp_start equ WFP_Start ; NASM port label 0 0000742C 8B3E[0000] MOV DI,[wfp_start] ; DS:SI point to string 0 00007430 C536[0000] LDS SI,[ThisCDS] ; point to CDS 632 ASSUME DS:NOTHING 633 ; LEA SI,[SI].curdir_text ; point to text 0 00007434 E81A02 CALL PathPref ; is there a prefix? 0 00007437 7514 JNZ DoSplice ; no, do splice 636 ; 637 ; We have a match. Check to see if we ended in a path char. 638 ; 639 %IF DBCS ;AN000; 640 ;---------------------------- Start of DBCS 2/13/KK 641 PUSH BX ;AN000; 642 MOV BX,SI ;AN000; 643 MOV SI,WORD PTR [ss:ThisCDS] ;AN000;; point to CDS 644 LOOKDUAL: ;AN000; 645 MOV AL,BYTE PTR [SI] ;AN000; 646 invoke TESTKANJ ;AN000; 647 JZ ONEINC ;AN000; 648 INC SI ;AN000; 649 INC SI ;AN000; 650 CMP SI,BX ;AN000; 651 JB LOOKDUAL ;AN000; 652 POP BX ;AN000;; Last char was KANJI, don't look back 653 JMP SHORT Pathline ;AN000;; for path sep, there isn't one. 654 ;AN000; 655 ONEINC: ;AN000; 656 INC SI ;AN000; 657 CMP SI,BX ;AN000; 658 JB LOOKDUAL ;AN000; 659 POP BX ;AN000; 660 ;------------------------ End of DBCS 2/13/KK 661 %ENDIF ;AN000; 0 00007439 8A44FF MOV AL,[SI-1] ; last char to match 0 0000743C E8[0000] Invoke PathChrCmp ; did we end on a path char? (root) 0 0000743F 740C JZ DoSplice ; yes, no current dir here. 665 Pathline: ; 2/13/KK 0 00007441 26803D00 CMP BYTE PTR [ES:DI],0 ; end at NUL? 0 00007445 7406 JZ DoSplice 0 00007447 47 INC DI ; point to after current path char 0 00007448 36893E[0000] MOV [ss:Curr_Dir_End],DI ; point to correct spot 670 ; 671 ; Splice the result. 672 ; 673 DoSplice: 0 0000744D 161F Context DS ; back to DOSGROUP 0 0000744F 8B36[0000] MOV SI,[wfp_Start] ; point to beginning of string 0 00007453 31C9 XOR CX,CX 0 00007455 F606[0000]FF TEST byte [fSplice],-1 0 0000745A 7403 JZ SkipSplice 0 0000745C E82E01 CALL Splice ; replaces in place. 680 SkipSplice: 681 ASSUME DS:NOTHING 682 ; 683 ; The final thing is to assure ourselves that a FATREAD is done on the local 684 ; device. 685 ; 0 0000745F 161F Context DS 0 00007461 C43E[0000] LES DI,[ThisCDS] ; point to correct drive 0 00007465 26F745430080 TEST word [ES:DI + curdir_flags],curdir_isnet 0 0000746B 7401C3 retnz ; net, no fatread necessary 0 0000746E E30B JCXZ Done 0 00007470 E8[0000] EnterCrit critDisk 0 00007473 E8[0000] invoke FatRead_CDS 0 00007476 E8[0000] LeaveCrit critDisk 0 00007479 B003 MOV AL,error_path_not_found ; Set up for possible bad path error 0 0000747B C3 Done: return ; any errors in carry flag. 696 EndProc TransPath 697 698 BREAK 699 700 ; 701 ; Canonicalize - copy path removing . and .. entries. 702 ; 703 ; Inputs: DS:SI - point to ASCIZ string path 704 ; ES:DI - point to buffer 705 ; BX - backup limit (offset from ES) points to slash 706 ; BP - end of buffer 707 ; Outputs: Carry Set - invalid path specification: too many .., bad 708 ; syntax, etc. 709 ; Carry Clear - 710 ; DS:DI - advanced to end of string 711 ; ES:DI - advanced to end of canonicalized form after nul 712 ; Registers modified: AX CX DX (in addition to those above) 713 714 Procedure Canonicalize,NEAR 714 ****************** warning: proc Canonicalize... [-w+user] 715 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 716 ; 717 ; We copy all leading path separators. 718 ; 0 0000747C AC LODSB ; while (PathChr (*s)) 0 0000747D E8[0000] Invoke PathChrCmp 721 %IF DBCS 722 JNZ CanonDec0 ; 2/19/KK 723 %ELSE 0 00007480 7507 JNZ CanonDec 725 %ENDIF 0 00007482 39EF CMP DI,BP ; if (d > dlim) 0 00007484 7319 JAE CanonBad ; goto error; 0 00007486 AA STOSB 0 00007487 EBF3 JMP Canonicalize ; *d++ = *s++; 730 %IF DBCS ;AN000; 731 CanonDec0: ;AN000; 2/19/KK 732 ; mov cs:Temp_Var,di ;AN000; 3/31/KK 733 %ENDIF ;AN000; 734 CanonDec: 0 00007489 4E DEC SI 736 ; 737 ; Main canonicalization loop. We come here with DS:SI pointing to a textual 738 ; component (no leading path separators) and ES:DI being the destination 739 ; buffer. 740 ; 741 CanonLoop: 742 ; 743 ; If we are at the end of the source string, then we need to check to see that 744 ; a potential drive specifier is correctly terminated with a path sep char. 745 ; Otherwise, do nothing 746 ; 0 0000748A 31C0 XOR AX,AX 0 0000748C 3804 CMP [SI],AL ; if (*s == 0) { 0 0000748E 751A JNZ DoComponent 750 %IF DBCS ;AN000; 751 call chk_last_colon ;AN000; 2/18/KK 752 %ELSE ;AN000; 0 00007490 26807DFF3A CMP BYTE PTR [ES:DI-1],':' ; if (d[-1] == ':') 754 %ENDIF ;AN000; 0 00007495 7505 JNZ DoTerminate 0 00007497 B05C MOV AL,'\' ; *d++ = '\'; 0 00007499 AA STOSB 0 0000749A 88E0 MOV AL,AH 759 DoTerminate: 0 0000749C AA STOSB ; *d++ = 0; 0 0000749D F8 CLC ; return (0); 0 0000749E C3 return 763 %IF DBCS ;AN000; 764 ;---------------- Start of DBCS 2/18/KK 765 chk_last_colon proc ;AN000; 766 push si ;AN000; 767 push ax ;AN000; 768 push bx ;AN000; 769 WFP_START equ WFP_Start ; NASM port label 770 mov si,[ss:WFP_START] ;AN000;;PTM. for cd .. use beginning of buf 771 cmp si,di ;AN000;; no data stored ? 772 jb CLC02 ;AN000;;PTM. for cd .. 773 inc si ;AN000;; make NZ flag 774 JMP SHORT CLC09 ;AN000; 775 CLC02: ;AN000; 776 mov bx,di ;AN000; 777 dec bx ;AN000; 778 CLC_lop: ;AN000; 779 cmp si,bx ;AN000; 780 jb CLC00 ;AN000; 781 jne CLC09 ;AN000; 782 CLC01: ;AN000; 783 CMP BYTE PTR [ES:DI-1],':' ;AN000;; if (d[-1] == ':') 784 jmp CLC09 ;AN000; 785 CLC00: ;AN000; 786 mov al,[es:si] ;AN000; 787 inc si ;AN000; 788 invoke testkanj ;AN000; 789 je CLC_lop ;AN000; 790 inc si ;AN000; 791 jmp CLC_lop ;AN000; 792 CLC09: ;AN000; 793 pop bx ;AN000; 794 pop ax ;AN000; 795 pop si ;AN000; 796 ret ;AN000; 797 chk_last_colon endp ;AN000; 798 ;---------------- Endt of DBCS 2/18/KK 799 %ENDIF ;AN000; 800 801 CanonBad: 0 0000749F E8C801 CALL ScanPathChar ; check for path chars in rest of string 0 000074A2 B003 MOV AL,error_path_not_found ; Set up for bad path error 0 000074A4 7402 JZ PathEnc ; path character encountered in string 0 000074A6 B002 MOV AL,error_file_not_found ; Set bad file error 806 PathEnc: 0 000074A8 F9 STC 0 000074A9 C3 return 809 ; 810 ; We have a textual component that we must copy. We uppercase it and truncate 811 ; it to 8.3 812 ; 813 DoComponent: ; } 0 000074AA E85200 CALL CopyComponent ; if (!CopyComponent (s, d)) 0 000074AD 72FA retc ; return (-1); 816 ; 817 ; We special case the . and .. cases. These will be backed up. 818 ; 0 000074AF 26833D2E CMP WORD PTR [ES:DI],'.' + (0 << 8) 0 000074B3 7408 JZ Skip1 0 000074B5 26813D2E2E CMP WORD PTR [ES:DI],'..' 0 000074BA 750B JNZ CanonNormal 0 000074BC 4F DEC DI ; d--; 0 000074BD E82C00 Skip1: CALL SkipBack ; SkipBack (); 0 000074C0 B003 MOV AL,error_path_not_found ; Set up for possible bad path error 0 000074C2 72E5 retc 0 000074C4 EB03 JMP CanonPath ; } 0 000074C6 90 nop ; identicalise 829 ; 830 ; We have a normal path. Advance destination pointer over it. 831 ; 832 CanonNormal: ; else 0 000074C7 01CF ADD DI,CX ; d += ct; 834 ; 835 ; We have successfully copied a component. We are now pointing at a path 836 ; sep char or are pointing at a nul or are pointing at something else. 837 ; If we point at something else, then we have an error. 838 ; 839 CanonPath: 0 000074C9 E81600 CALL PathSep 0 000074CC 75D1 JNZ CanonBad ; something else... 842 ; 843 ; Copy the first path char we see. 844 ; 0 000074CE AC LODSB ; get the char 0 000074CF E8[0000] Invoke PathChrCmp ; is it path char? 0 000074D2 75B5 JNZ CanonDec ; no, go test for nul 0 000074D4 39EF CMP DI,BP ; beyond buffer end? 0 000074D6 73C7 JAE CanonBad ; yep, error. 0 000074D8 AA STOSB ; copy the one byte 851 ; 852 ; Skip all remaining path chars 853 ; 854 CanonPathLoop: 0 000074D9 AC LODSB ; get next byte 0 000074DA E8[0000] Invoke PathChrCmp ; path char again? 0 000074DD 74FA JZ CanonPathLoop ; yep, grab another 0 000074DF 4E DEC SI ; back up 0 000074E0 EBA8 JMP CanonLoop ; go copy component 860 EndProc Canonicalize 861 862 BREAK 863 864 ; 865 ; PathSep - look at DS:SI and see if char is / \ or NUL 866 ; Inputs: DS:SI - point to a char 867 ; Outputs: AL has char from DS:SI (/ => \) 868 ; Zero set if AL is / \ or NUL 869 ; Zero reset otherwise 870 ; Registers modified: AL 871 872 Procedure PathSep,NEAR 872 ****************** warning: proc PathSep... [-w+user] 873 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000074E2 8A04 MOV AL,[SI] ; get the character 875 entry PathSepGotCh ; already have character 0 000074E4 08C0 OR AL,AL ; test for zero 0 000074E6 74C1 retz ; return if equal to zero (NUL) 0 000074E8 E8[0000] invoke PathChrCmp ; check for path character 0 000074EB C3 return ; and return HIS determination 880 EndProc PathSep 881 882 BREAK 883 884 ; 885 ; SkipBack - look at ES:DI and backup until it points to a / \. 886 ; Inputs: ES:DI - point to a char 887 ; BX has current directory back up limit (point to a / \) 888 ; Outputs: ES:DI backed up to point to a path char 889 ; AL has char from output ES:DI (path sep if carry clear) 890 ; Carry set if illegal backup 891 ; Carry Clear if ok 892 ; Registers modified: DI,AL 893 894 Procedure SkipBack,NEAR 894 ****************** warning: proc SkipBack... [-w+user] 895 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 896 %IF DBCS ;AN000; 897 ;-------------------------- Start of DBCS 2/13/KK 898 PUSH DS ;AN000; 899 PUSH SI ;AN000; 900 PUSH CX ;AN000; 901 PUSH ES ;AN000; 902 POP DS ;AN000; 903 MOV SI,BX ;AN000;; DS:SI -> start of ES:DI string 904 MOV CX,DI ;AN000;; Limit of forward scan is input DI 905 MOV AL,[SI] ;AN000; 906 invoke PathChrCmp ;AN000; 907 JNZ SkipBadP ;AN000;; Backup limit MUST be path char 908 CMP DI,BX ;AN000; 909 JBE SkipBadP ;AN000; 910 MOV DI,BX ;AN000;; Init backup point to backup limit 911 Skiplp: ;AN000; 912 CMP SI,CX ;AN000; 913 JAE SkipOK ;AN000;; Done, DI is correct backup point 914 LODSB ;AN000; 915 invoke Testkanj ;AN000; 916 Notkanjv equ NotKanjv ; NASM port label 917 jz Notkanjv ;AN000; 918 lodsb ;AN000;; Skip over second kanji byte 919 JMP Skiplp ;AN000; 920 NotKanjv: ;AN000; 921 invoke PathChrCmp ;AN000; 922 JNZ Skiplp ;AN000;; New backup point 923 MOV DI,SI ;AN000;; DI point to path sep 924 DEC DI ;AN000; 925 jmp Skiplp ;AN000; 926 SkipOK: ;AN000; 927 MOV AL,[ES:DI] ;AN000;; Set output AL 928 CLC ;AN000;; return (0); 929 POP CX ;AN000; 930 POP SI ;AN000; 931 POP DS ;AN000; 932 return ;AN000; 933 ;AN000; 934 SkipBadP: ;AN000; 935 POP CX ;AN000; 936 POP SI ;AN000; 937 POP DS ;AN000; 938 ;-------------------------- End of DBCS 2/13/KK 939 %ELSE ;AN000; 0 000074EC 39DF CMP DI,BX ; while (TRUE) { 0 000074EE 720B JB SkipBad ; if (d < dlim) 0 000074F0 4F DEC DI ; goto err; 0 000074F1 268A05 MOV AL,[ES:DI] ; if (pathchr (*--d)) 0 000074F4 E8[0000] invoke PathChrCmp ; break; 0 000074F7 75F3 JNZ SkipBack ; } 0 000074F9 F8 CLC ; return (0); 0 000074FA C3 return ; 948 %ENDIF ;AN000; 949 SkipBad: ;err: 0 000074FB B003 MOV AL,error_path_not_found ; bad path error 0 000074FD F9 STC ; return (-1); 0 000074FE C3 return ; 953 EndProc SkipBack 954 955 Break 956 957 ; 958 ; CopyComponent - copy a file component from a path string (DS:SI) into ES:DI 959 ; 960 ; Inputs: DS:SI - source path 961 ; ES:DI - destination 962 ; ES:BP - end of buffer 963 ; Outputs: Carry Set - too long 964 ; Carry Clear - DS:SI moved past component 965 ; CX has length of destination 966 ; Registers modified: AX,CX,DX 967 968 Procedure CopyComponent,NEAR 968 ****************** warning: proc CopyComponent... [-w+user] 969 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 970 labelsize CopyBP, word, BP 971 labelsize CopyD, dword, BP+2 972 labelsize CopyDoff, word, BP+2 973 labelsize CopyS, dword, BP+6 974 labelsize CopySoff, word, BP+6 975 labelsize CopyTemp, byte, BP+10 0 000074FF 83EC0E SUB SP,14 ; room for temp buffer 0 00007502 1E56065755 SaveReg 0 00007507 89E5 MOV BP,SP 0 00007509 B42E MOV AH,'.' 0 0000750B AC LODSB 0 0000750C AA STOSB 0 0000750D 38E0 CMP AL,AH ; if ((*d++=*s++) == '.') { 0 0000750F 7518 JNZ NormalComp 0 00007511 E8CEFF CALL PathSep ; if (!pathsep(*s)) 0 00007514 740B JZ NulTerm 986 TryTwoDot: 0 00007516 AC LODSB ; if ((*d++=*s++) != '.' 0 00007517 AA STOSB 0 00007518 38E0 CMP AL,AH 0 0000751A 7557 JNZ CopyBad 0 0000751C E8C3FF CALL PathSep 0 0000751F 7552 JNZ CopyBad ; || !pathsep (*s)) 993 NulTerm: ; return -1; 0 00007521 30C0 XOR AL,AL ; *d++ = 0; 0 00007523 AA STOSB 0 00007524 897606 MOV [CopySoff],SI 0 00007527 EB47 JMP SHORT GoodRet ; } 998 NormalComp: ; else { 0 00007529 8B7606 MOV SI,[CopySoff] 0 0000752C E8[0000] Invoke NameTrans ; s = NameTrans (s, Name1); 0 0000752F 3B7606 CMP SI,[CopySOff] ; if (s == CopySOff) 0 00007532 743F JZ CopyBad ; return (-1); 0 00007534 36F606[0000]FF TEST byte [ss:fSharing],-1 ; if (!fSharing) { 0 0000753A 7510 JNZ DoPack 0 0000753C 80E201 AND DL,1 ; cMeta += fMeta; 0 0000753F 360016[0000] ADD [ss:cMeta],DL ; if (cMeta > 0) 0 00007544 7F2D JG CopyBad ; return (-1); 0 00007546 7504 JNZ DoPack ; else 0 00007548 08D2 OR DL,DL ; if (cMeta == 0 && fMeta == 0) 0 0000754A 742F JZ CopyBadPath ; return (-1); 1011 DoPack: ; } 0 0000754C 897606 MOV [CopySoff],SI 0 0000754F 161F Context DS 0 00007551 BE[0000] MOV SI,OFFSET NAME1 wrt DOSGroup 0 00007554 8D7E0A LEA DI,[CopyTemp] 0 00007557 57 SaveReg 0 00007558 E8[0000] Invoke PackName ; PackName (Name1, temp); 0 0000755B 5F RestoreReg 0 0000755C E8[0000] Invoke StrLen ; if (strlen(temp)+d > bp) 0 0000755F 49 DEC CX 0 00007560 034E02 ADD CX,[CopyDoff] 0 00007563 3B4E00 CMP CX,[CopyBP] 0 00007566 730B JAE CopyBad ; return (-1); 0 00007568 89FE MOV SI,DI ; strcpy (d, temp); 0 0000756A C47E02 LES DI,[CopyD] 0 0000756D E8[0000] Invoke FStrCpy 1027 GoodRet: ; } 0 00007570 F8 CLC 0 00007571 EB0B JMP SHORT CopyEnd ; return 0; 1030 CopyBad: 0 00007573 F9 STC 0 00007574 E8F300 CALL ScanPathChar ; check for path chars in rest of string 0 00007577 B002 MOV AL,error_file_not_found ; Set up for bad file error 0 00007579 7503 JNZ CopyEnd 1035 CopyBadPath: 0 0000757B F9 STC 0 0000757C B003 MOV AL,error_path_not_found ; Set bad path error 1038 CopyEnd: 0 0000757E 5D5F075E1F RestoreReg 0 00007583 9F LAHF 0 00007584 83C40E ADD SP,14 ; reclaim temp buffer 0 00007587 E8[0000] Invoke Strlen 0 0000758A 49 DEC CX 0 0000758B 9E SAHF 0 0000758C C3 return 1046 EndProc CopyComponent,NoCheck 1047 1048 Break 1049 1050 ; 1051 ; Splice - take a string and substitute a prefix if one exists. Change 1052 ; ThisCDS to point to physical drive CDS. 1053 ; Inputs: DS:SI point to string 1054 ; NoSetDir = TRUE => exact matches with splice fail 1055 ; Outputs: DS:SI points to thisCDS 1056 ; ES:DI points to DPB 1057 ; String at DS:SI may be reduced in length by removing prefix 1058 ; and substituting drive letter. 1059 ; CX = 0 If no splice done 1060 ; CX <> 0 otherwise 1061 ; ThisCDS points to proper CDS if spliced, otherwise it is 1062 ; left alone 1063 ; ThisDPB points to proper DPB 1064 ; Registers modified: DS:SI, ES:DI, BX,AX,CX 1065 1066 Procedure Splice,NEAR 1066 ****************** warning: proc Splice... [-w+user] 1067 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000758D 36F606[0000]FF TEST byte [ss:Splices],-1 0 00007593 746A JZ AllDone 0 00007595 36FF36[0000]36FF36 SaveReg <,> ; TmpCDS = ThisCDS 0 0000759D [0200] 0 0000759F 1E56 SaveReg 0 000075A1 5F07 RestoreReg 0 000075A3 31C0 XOR AX,AX ; for (i=1; s = GetCDSFromDrv (i); i++) 1074 SpliceScan: 0 000075A5 E8[0000] invoke GetCDSFromDrv 0 000075A8 724B JC SpliceDone 0 000075AA FEC0 INC AL 0 000075AC F744430020 TEST word [SI + curdir_flags],curdir_splice 0 000075B1 74F2 JZ SpliceScan ; if ( Spliced (i) ) { 0 000075B3 57 SaveReg 0 000075B4 E89A00 CALL PathPref ; if (!PathPref (s, d)) 0 000075B7 7403 JZ SpliceFound ; 1083 SpliceSkip: 0 000075B9 5F RestoreReg 0 000075BA EBE9 JMP SpliceScan ; continue; 1086 SpliceFound: 0 000075BC 26803D00 CMP BYTE PTR [ES:DI],0 ; if (*s || NoSetDir) { 0 000075C0 7508 JNZ SpliceDo 0 000075C2 36F606[0000]FF TEST byte [ss:NoSetDir],-1 0 000075C8 75EF JNZ SpliceSkip 1091 SpliceDo: 0 000075CA 89FE MOV SI,DI ; p = src + strlen (p); 0 000075CC 06 SaveReg 0 000075CD 1F5F RestoreReg 0 000075CF E87900 CALL TextFromDrive1 ; src = TextFromDrive1(src,i); 0 000075D2 36A1[0000] MOV AX,[ss:Curr_Dir_End] 0 000075D6 09C0 OR AX,AX 0 000075D8 7808 JS NoPoke 0 000075DA 01F8 ADD AX,DI ; curdirend += src-p; 0 000075DC 29F0 SUB AX,SI 0 000075DE 36A3[0000] MOV [ss:Curr_Dir_End],AX 1102 NoPoke: 0 000075E2 803C00 CMP BYTE PTR [SI],0 ; if (*p) 0 000075E5 7503 JNZ SpliceCopy ; *src++ = '\\'; 0 000075E7 B05C MOV AL,"\" 0 000075E9 AA STOSB 1107 SpliceCopy: ; strcpy (src, p); 0 000075EA E8[0000] invoke FStrCpy 0 000075ED 83C404 ADD SP,4 ; throw away saved stuff 0 000075F0 80C901 OR CL,1 ; signal splice done. 0 000075F3 EB0C JMP SHORT DoSet ; return; 1112 SpliceDone: ; } 1113 ASSUME DS:NOTHING ; ThisCDS = TmpCDS; 0 000075F5 368F06[0200]368F06 RestoreReg <,> 0 000075FD [0000] 1115 AllDone: 0 000075FF 31C9 XOR CX,CX 1117 DoSet: 0 00007601 36C536[0000] LDS SI,[ss:ThisCDS] ; ThisDPB = ThisCDS->devptr; 0 00007606 C47C45 LES DI,[SI + curdir_devptr] 0 00007609 36893E[0000] MOV WORD PTR [ss:ThisDPB],DI 0 0000760E 368C06[0200] MOV WORD PTR [ss:ThisDPB+2],ES 0 00007613 C3 return 1123 EndProc Splice 1123 ****************** warning: ***** Possible stack size error in Splice ***** [-w+user] 1124 1125 Break <$NameTrans - partially process a name> 1126 1127 ; 1128 ; $NameTrans - allow users to see what names get mapped to. This call 1129 ; performs only string substitution and canonicalization, not splicing. Due 1130 ; to Transpath playing games with devices, we need to insure that the output 1131 ; has drive letter and : in it. 1132 ; 1133 ; Inputs: DS:SI - source string for translation 1134 ; ES:DI - pointer to buffer 1135 ; Outputs: 1136 ; Carry Clear 1137 ; Buffer at ES:DI is filled in with data 1138 ; ES:DI point byte after nul byte at end of dest string in buffer 1139 ; Carry Set 1140 ; AX = error_path_not_found 1141 ; Registers modified: all 1142 1143 Procedure D_NameTrans,Near 1143 ****************** warning: proc D_NameTrans... [-w+user] 1144 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 00007614 1E560657 SaveReg 0 00007618 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup 0 0000761B E8DEFC CALL TransPath ; to translation (everything) 0 0000761E 5F075E1F RestoreReg 0 00007622 7303 JNC TransOK 0 00007624 E9[0000] transfer SYS_Ret_Err 1151 TransOK: 0 00007627 BE[0000] MOV SI,OFFSET OpenBuf wrt DOSGroup 0 0000762A 161F Context DS 1154 GotText: 0 0000762C E8[0000] Invoke FStrCpy 0 0000762F E9[0000] Transfer SYS_Ret_OK 1157 EndProc D_NameTrans 1158 1159 Break 1160 1161 ; 1162 ; DriveFromText - examine DS:SI and remove a drive letter, advancing the 1163 ; pointer. 1164 ; 1165 ; Inputs: DS:SI point to a text string 1166 ; Outputs: AL has drive number 1167 ; DS:SI advanced 1168 ; Registers modified: AX,SI. 1169 1170 Procedure DriveFromText,NEAR 1170 ****************** warning: proc DriveFromText... [-w+user] 1171 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00007632 30C0 XOR AL,AL ; drive = 0; 0 00007634 803C00 CMP BYTE PTR [SI],0 ; if (*s && 0 00007637 74DA retz 0 00007639 807C013A CMP BYTE PTR [SI+1],':' ; s[1] == ':') { 0 0000763D 75D4 retnz 1177 %IF DBCS ;AN000; 1178 ;--------------------- Start of DBCS 2/18/KK 1179 push ax ;AN000; 1180 mov al,[si] ;AN000; 1181 invoke testkanj ;AN000; 1182 pop ax ;AN000; 1183 retnz ;AN000; 1184 ;--------------------- End of DBCS 2/18/KK 1185 %ENDIF ;AN000; 0 0000763F AD LODSW ; drive = (*s | 020) - 'a'+1; 0 00007640 0C20 OR AL,020h 0 00007642 2C60 SUB AL,'a'-1 ; s += 2; 0 00007644 75CD retnz 0 00007646 B0FF MOV AL,-1 ; nuke AL... 0 00007648 C3 return ; } 1192 EndProc DriveFromText 1193 1194 Break 1195 1196 ; 1197 ; TextFromDrive - turn AL into a drive letter: and put it at es:di with 1198 ; trailing :. TextFromDrive1 takes a 1-based number. 1199 ; 1200 ; Inputs: AL has 0-based drive number 1201 ; Outputs: ES:DI advanced 1202 ; Registers modified: AX 1203 1204 Procedure TextFromDrive,NEAR 1204 ****************** warning: proc TextFromDrive... [-w+user] 1205 ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING 0 00007649 FEC0 INC AL 1207 Entry TextFromDrive1 0 0000764B 0440 ADD AL,'A'-1 ; *d++ = drive-1+'A'; 0 0000764D B43A MOV AH,":" ; strcat (d, ":"); 0 0000764F AB STOSW 0 00007650 C3 return 1212 EndProc TextFromDrive 1213 1214 Break 1215 1216 ; 1217 ; PathPref - compare DS:SI with ES:DI to see if one is the prefix of the 1218 ; other. Remember that only at a pathchar break are we allowed to have a 1219 ; prefix: A:\ and A:\FOO 1220 ; 1221 ; Inputs: DS:SI potential prefix 1222 ; ES:DI string 1223 ; Outputs: Zero set => prefix found 1224 ; DI/SI advanced past matching part 1225 ; Zero reset => no prefix, DS/SI garbage 1226 ; Registers modified: CX 1227 1228 Procedure PathPref,NEAR 1228 ****************** warning: proc PathPref... [-w+user] 0 00007651 E8[0000] Invoke DStrLen ; get length 0 00007654 49 DEC CX ; do not include nul byte 1231 %IF DBCS ;AN000; 1232 ;----------------------- Start of DBCS 2/13/KK 1233 SaveReg ;AN000;; save char register 1234 CmpLp: ;AN000; 1235 MOV AL,[SI] ;AN000; 1236 invoke Testkanj ;AN000; 1237 jz NotKanj9 ;AN000; 1238 CMPSW ;AN000; 1239 JNZ Prefix ;AN000; 1240 DEC CX ;AN000; 1241 LOOP CmpLp ;AN000; 1242 JMP SHORT NotSep ;AN000; 1243 NotKanj9: ;AN000; 1244 CMPSB ;AN000; 1245 JNZ Prefix ;AN000; 1246 LOOP CmpLp ;AN000; 1247 ;----------------------- End of DBCS 2/13/KK 1248 %ELSE ;AN000; 0 00007655 F3A6 REPZ CMPSB ; compare 0 00007657 75F7 retnz ; if NZ then return NZ 0 00007659 50 SaveReg ; save char register 1252 %ENDIF ;AN000; 0 0000765A 8A44FF MOV AL,[SI-1] ; get last byte to match 0 0000765D E8[0000] Invoke PathChrCmp ; is it a path char (Root!) 0 00007660 7406 JZ Prefix ; yes, match root (I hope) 1256 NotSep: ; 2/13/KK 0 00007662 268A05 MOV AL,[ES:DI] ; get next char to match 0 00007665 E87CFE CALL PathSepGotCh ; was it a pathchar? 1259 Prefix: 0 00007668 58 RestoreReg ; get back original 0 00007669 C3 return 1262 EndProc PathPref 1263 1264 Break 1265 1266 ; 1267 ; ScanPathChar - search through the string (pointed to by DS:SI) for 1268 ; a path separator. 1269 ; 1270 ; Input: DS:SI target string (null terminated) 1271 ; Output: Zero set => path separator encountered in string 1272 ; Zero clear => null encountered 1273 ; Registers modified: SI 1274 1275 Procedure ScanPathChar,NEAR 1275 ****************** warning: proc ScanPathChar... [-w+user] 0 0000766A AC LODSB ; fetch a character 1277 %IF DBCS ;AN000; 1278 invoke TestKanj ;AN000;; 2/13/KK 1279 jz NotKanjr ;AN000;; 2/13/KK 1280 LODSB ;AN000;; 2/13/KK 1281 OR AL,AL ;AN000;; 2/13/KK 3/31/removed 1282 JNZ ScanPathChar ;AN000;; 2/13/KK 3/31/removed 1283 INC AL ;AN000;; 2/13/KK 1284 return ;AN000;; 2/13/KK 1285 ;AN000; 1286 NotKanjr: ;AN000;; 2/13/KK 1287 %ENDIF ;AN000; 0 0000766B E876FE call PathSepGotCh 0 0000766E 75FA JNZ ScanPathChar ; not \, / or NUL => go back for more 0 00007670 E8[0000] invoke PathChrCmp ; path separator? 0 00007673 C3 return 1292 EndProc ScanPathChar 1293 1294 END === Trace listing source: ../DOS/file.lst 1 ; SCCSID = @(#)file.asm 1.2 85/07/23 2 ; SCCSID = @(#)file.asm 1.2 85/07/23 3 ;TITLE FILE - Pathname related system calls 4 ;NAME FILE 5 6 ; 7 ; Pathname related system calls. These will be passed direct text of the 8 ; pathname from the user. They will need to be passed through the macro 9 ; expander prior to being sent through the low-level stuff. I/O specs are 10 ; defined in DISPATCH. The system calls are: 11 ; 12 ; $Open written 13 ; $Creat written 14 ; $ChMod written 15 ; $Unlink written 16 ; $Rename written 17 ; $CreateTempFile written 18 ; $CreateNewFile written 19 ; $Extended_Open written DOS 4.00 20 ; GetIOParms written DOS 4.00 21 ; 22 ; Revision history: 23 ; 24 ; Created: MZ 4 April 1983 25 ; A000 version 4.00 Jan. 1988 26 27 [list -] 27 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 32 33 [list +] === Switch to base=002450h -> "DOSCODECODE" 34 section DOSCODECODE 35 [list -] 35 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 35 ****************** warning: out: BPB.INC... [-w+user] 35 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 35 ****************** warning: out: DEVSYM.INC... [-w+user] 35 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 45 ;.sall 46 47 EXTRN DOS_OPEN:NEAR,DOS_CREATE:NEAR,DOS_Create_New:NEAR 48 49 %IFN IBMCOPYRIGHT 50 extrn Set_EXT_mode:near 51 %ENDIF 52 53 I_need WFP_Start,WORD ; pointer to beginning of expansion 54 I_Need ThisCDS,DWORD ; pointer to curdir in use 55 I_need ThisSft,DWORD ; SFT pointer for DOS_Open 56 I_need pJFN,DWORD ; temporary spot for pointer to JFN 57 I_need JFN,WORD ; word JFN for process 58 I_need SFN,WORD ; word SFN for process 59 I_Need OpenBuf,128 ; buffer for filename 60 I_Need RenBuf,128 ; buffer for filename in rename 61 I_need Sattrib,BYTE ; byte attribute to search for 62 I_need Ren_WFP,WORD ; pointer to real path 63 I_need cMeta,BYTE 64 I_need EXTERR,WORD ; extended error code 65 I_need EXTERR_LOCUS,BYTE ; Extended Error Locus 66 i_need JShare,DWORD ; share jump table 67 I_need fSharing,BYTE ; TRUE => via ServerDOSCall 68 I_need FastOpenTable,BYTE 69 I_need CPSWFLAG,BYTE ;AN000;FT. cpsw falg 70 I_need EXTOPEN_FLAG,WORD ;AN000;FT. extended file open flag 71 I_need EXTOPEN_ON,BYTE ;AN000;FT. extended open flag 72 I_need EXTOPEN_IO_MODE,WORD ;AN000;FT. IO mode 73 I_need XA_from,BYTE ;AN000;;FT. for get/set XA 74 I_need SAVE_ES,WORD ;AN000;;FT. for get/set XA 75 I_need SAVE_DI,WORD ;AN000;;FT. for get/set XA 76 I_need SAVE_DS,WORD ;AN000;;FT. for get/set XA 77 I_need SAVE_SI,WORD ;AN000;;FT. for get/set XA 78 I_need SAVE_DX,WORD ;AN000;;FT. for get/set XA 79 I_need SAVE_BX,WORD ;AN000;;FT. for get/set XA 80 I_need SAVE_CX,WORD ;AN000;;FT. for get/set XA 81 I_need NO_FILTER_DPATH,DWORD ;AN000;; pointer to original path of dest 82 I_need Temp_Var,WORD ;AN000;; 83 I_need DOS34_FLAG,WORD ;AN000;; 84 I_need Temp_Var2,WORD ;AN000;; 85 %if debug 86 I_need BugLev,WORD 87 I_need BugTyp,WORD 88 %include "bugtyp.nas" 89 %endif 90 91 BREAK <$Open - open a file from a path string> 92 93 ; 94 ; $Open - given a path name in DS:DX and an open mode in AL, access the file 95 ; and return a handle 96 ; Inputs: DS:DX - pointer to asciz name 97 ; AL - open mode 98 ; Outputs: Carry Set - AX has error code for invalid open 99 ; Carry Clear - AX has per process handle number 100 ; Registers modified: most 101 102 Procedure D_Open,NEAR 102 ****************** warning: proc D_Open... [-w+user] 103 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 104 fmt TypSysCall,LevLog,<"Open\n"> 105 fmt TypSysCall,LevArgs,<" Mode = $x file = '$S'\n">, 0 00007674 30E4 XOR AH,AH 107 Entry D_Open2 ;AN000; 0 00007676 B516 mov ch,attr_hidden+attr_system+attr_directory 0 00007678 E86802 call SetAttrib 110 DOSGroup equ DOSGROUP ; NASM port equate 111 DOS_Open equ DOS_OPEN ; NASM port label 0 0000767B B9[0000] MOV CX,OFFSET DOS_Open ; address of routine to call 0 0000767E 50 SaveReg ; Save mode on stack 114 %IF DBCS ;AN000; 115 MOV word [ss:Temp_Var],0 ;AN000;KK. set variable with 0 116 %ENDIF ;AN000; 117 118 AccessFile: 119 ; 120 ; Grab a free SFT. 121 ; 122 %IF DBCS ;AN000; 123 TEST word [ss:Temp_Var],8 ;AN000;;KK. volume id bit set ;AN000; 124 JZ novol ;AN000;;KK. no ;AN000; 125 OR word [ss:DOS34_FLAG],DBCS_VOLID ;AN000;;KK. set bit for transpath ;AN000; 126 novol: ;AN000; 127 %ENDIF ;AN000; 0 0000767F E8[0000] EnterCrit critSFT 0 00007682 E8[0000] invoke SFNFree ; get a free sfn 0 00007685 E8[0000] LeaveCrit critSFT 0 00007688 7214 JC OpenFailJ ; oops, no free sft's 0 0000768A 36891E[0000] MOV [ss:SFN],BX ; save the SFN for later 133 fmt TypAccess,LevSFN,<"AccessFile setting SFN to $x\n">, 134 ThisSFT equ ThisSft ; NASM port label 0 0000768F 36893E[0000] MOV WORD PTR [ss:ThisSFT],DI ; save the SF offset 0 00007694 368C06[0200] MOV WORD PTR [ss:ThisSFT+2],ES ; save the SF segment 137 ; 138 ; Find a free area in the user's JFN table. 139 ; 0 00007699 E8[0000] invoke JFNFree ; get a free jfn 0 0000769C 7303 JNC SaveJFN 142 OpenFailJ: 0 0000769E E99900 JMP OpenFail ; there were free JFNs... try SFN 144 SaveJFN: 0 000076A1 36893E[0000] MOV WORD PTR [ss:pJFN],DI ; save the jfn offset 0 000076A6 368C06[0200] MOV WORD PTR [ss:pJFN+2],ES ; save the jfn segment 0 000076AB 36891E[0000] MOV [ss:JFN],BX ; save the jfn itself 148 ; 149 ; We have been given an JFN. We lock it down to prevent other tasks from 150 ; reusing the same JFN. 151 ; 0 000076B0 368B1E[0000] MOV BX,[ss:SFN] 0 000076B5 26881D MOV [ES:DI],BL ; assign the JFN 0 000076B8 89D6 MOV SI,DX ; get name in appropriate place 0 000076BA BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate buffer 0 000076BD 51 SaveReg ; save routine to call 0 000076BE E8[0000] invoke TransPath ; convert the path 0 000076C1 5B RestoreReg ; restore routine to call 0 000076C2 36C536[0000] LDS SI,[ss:ThisSFT] 160 ASSUME DS:NOTHING 0 000076C7 720A JC OpenCleanJ ; no error, go and open file 0 000076C9 36803E[0000]FF CMP byte [ss:cMeta],-1 0 000076CF 7405 JZ SetSearch 0 000076D1 B002 MOV AL,error_file_not_found ; no meta chars allowed 165 OpenCleanJ: 0 000076D3 EB56 JMP OpenClean 0 000076D5 90 nop ; identicalise 168 SetSearch: 0 000076D6 58 RestoreReg ; Mode (Open), Attributes (Create) 170 ; 171 ; We need to get the new inheritance bits. 172 ; 0 000076D7 31C9 xor cx,cx 0 000076D9 81FB[0000] CMP BX,OFFSET DOS_OPEN 0 000076DD 7509 JNZ DoOper 0 000076DF A880 TEST AL,sharing_no_inherit ; look for no inher 0 000076E1 7405 JZ DoOper 0 000076E3 247F AND AL,07Fh ; mask off inherit bit 0 000076E5 B90010 MOV CX,sf_no_inherit 180 DoOper: 0 000076E8 C744020000 MOV word [SI + sf_mode],0 ; initialize mode field to 0 182 SF_mft equ sf_MFT ; NASM port equate 0 000076ED C744330000 MOV word [SI + SF_mft],0 ; clean out sharing info 184 ; 185 ;------------------------------------------------------------HKN 8/7/88 186 ; Check if this is an extended open. If so you must set the 187 ; modes in sf_mode. Call Set_EXT_mode to do all this. See 188 ; Set_EXT_mode in creat.asm 189 ; 190 %IFN IBMCOPYRIGHT 191 0 000076F2 06 push es ; set up es:di to point to SFT 0 000076F3 57 push di 0 000076F4 1E push ds 0 000076F5 07 pop es 196 assume es:nothing 0 000076F6 56 push si 0 000076F7 5F pop di 0 000076F8 E8[0000] call Set_EXT_mode 0 000076FB 5F pop di 0 000076FC 07 pop es 202 assume es:nothing 203 204 %ENDIF 205 206 ;----------------------------------------------------------------------- 207 0 000076FD 161F Context DS 0 000076FF 51 SaveReg 0 00007700 FFD3 CALL BX ; blam! 0 00007702 59 RestoreReg 0 00007703 C536[0000] LDS SI,[ThisSFT] 213 ASSUME DS:NOTHING 0 00007707 721A JC OpenE2 ;AN000;FT. chek extended open hooks first 215 ; 216 ; The SFT was successfully opened. Remove busy mark. 217 ; 218 OpenOK: 219 ASSUME DS:NOTHING 220 ; MOV AL,[SI].sf_attr_hi ;AN000;FT. save file type for EXEC 221 ; MOV BYTE PTR [Temp_Var2],AL ;AN000;FT. 0 00007709 C7040100 MOV word [SI + sf_ref_count],1 0 0000770D 094C05 OR [SI + sf_flags],CX ; set no inherit bit if necessary 224 ; 225 ; If the open mode is 70, we scan the system for other SFT's with the same 226 ; contents. If we find one, then we can 'collapse' thissft onto the already 227 ; opened one. Otherwise we use this new one. We compare uid/pid/mode/mft 228 ; 229 ; Since this is only relevant on sharer systems, we stick this code into the 230 ; sharer. 231 ; 0 00007710 36A1[0000] MOV AX,[ss:JFN] 233 %if installed 0 00007714 36FF1E[3000] Call far [ss:JShare + 12 * 4] 235 %else 236 Call ShCol 237 %endif 238 fmt TypAccess,LevSFN,<"AccessFile setting SFN to -1\n"> 0 00007719 36C706[0000]FFFF MOV word [ss:SFN],-1 ; clear out sfn pointer 240 fmt TypSysCall,LevLog,<"Open/CreateXX: return $x\n">, 0 00007720 E9[0000] transfer Sys_Ret_OK ; bye with no errors 242 ;Extended Open hooks check 243 OpenE2: ;AN000;;EO. 0 00007723 83F857 CMP AX,error_invalid_parameter ;AN000;;EO. IFS extended open ? 0 00007726 7504 JNZ OpenE ;AN000;;EO. no. 0 00007728 EB12 JMP OpenCritLeave ;AN000;;EO. keep handle 0 0000772A 90 nop ; identicalise 248 249 ;Extended Open hooks check 250 ; 251 ; AL has error code. Stack has argument to dos_open/dos_create. 252 ; 253 OpenClean: 254 fmt TypSysCall,LevLog,<"Return value from transpath $x\n">, 0 0000772B 5B RestoreReg ; clean off stack 256 OpenE: 257 SF_Ref_Count equ sf_ref_count ; NASM port equate 0 0000772C C7040000 MOV word [SI + SF_Ref_Count],0 ; release SFT 0 00007730 36C536[0000] LDS SI,[ss:pJFN] 0 00007735 C604FF MOV BYTE PTR [SI],0FFh ; free the SFN... 0 00007738 EB02 JMP SHORT OpenCritLeave 262 263 OpenFail: 0 0000773A FB STI 0 0000773B 59 RestoreReg ; Clean stack 266 OpenCritLeave: 0 0000773C 36C706[0000]FFFF MOV word [ss:SFN],-1 ; remove mark. 268 fmt TypSysCall,LevLog,<"Open/CreateXX: error $x\n">, 269 ;; File Tagging DOS 4.00 0 00007743 36833E[0000]25 CMP word [ss:EXTERR],error_Code_Page_Mismatched ;AN000;;FT. code page mismatch 0 00007749 7503 JNZ NORERR ;AN000;;FT. no 0 0000774B E9[0000] transfer From_GetSet ;AN000;;FT. yes 273 NORERR: ;AN000; 274 275 ;; File Tagging DOS 4.00 0 0000774E E9[0000] transfer Sys_Ret_Err ; no free, return error 277 278 EndProc D_Open 278 ****************** warning: ***** Possible stack size error in D_Open ***** [-w+user] 279 280 BREAK <$Creat - create a brand-new file> 281 282 ; 283 ; $Creat - create the directory entry specified in DS:DX and give it the 284 ; initial attributes contained in CX 285 ; Inputs: DS:DX - ASCIZ path name 286 ; CX - initial attributes 287 ; Outputs: Carry set - AX has error code 288 ; Carry reset - AX has handle 289 ; Registers modified: all 290 291 Procedure D_Creat,NEAR 291 ****************** warning: proc D_Creat... [-w+user] 292 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 293 fmt TypSysCall,LevLog,<"Create\n"> 294 fmt TypSysCall,LevArgs,<" Att = $x file = '$S'\n">, 295 %IF DBCS ;AN000; 296 MOV [ss:Temp_Var],CX ;AN000;KK. set variable with attribute ;AN000; 297 %ENDIF ;AN000; 0 00007751 51 SaveReg ; Save attributes on stack 299 DOS_Create equ DOS_CREATE ; NASM port label 0 00007752 B9[0000] MOV CX,OFFSET DOS_Create ; routine to call 301 AccessSet: 302 SAttrib equ Sattrib ; NASM port label 0 00007755 36C606[0000]06 mov byte [ss:SAttrib],attr_hidden+attr_system 0 0000775B E921FF JMP AccessFile ; use good ol' open 305 EndProc D_Creat 305 ****************** warning: ***** Possible stack size error in D_Creat ***** [-w+user] 306 307 BREAK <$CHMOD - change file attributes> 308 ; 309 ; Assembler usage: 310 ; LDS DX, name 311 ; MOV CX, attributes 312 ; MOV AL,func (0=get, 1=set) 313 ; INT 21h 314 ; Error returns: 315 ; AX = error_path_not_found 316 ; AX = error_access_denied 317 ; 318 319 procedure D_CHMOD,NEAR 319 ****************** warning: proc D_CHMOD... [-w+user] 320 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 0000775E BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate buffer 0 00007761 5051 SaveReg ; save function and attributes 0 00007763 89D6 MOV SI,DX ; get things in appropriate places 0 00007765 E8[0000] invoke TransPathSet ; get correct path 0 00007768 5958 RestoreReg ; and get function and attrs back 0 0000776A 7233 JC ChModErr ; errors get mapped to path not found 0 0000776C 161F Context DS ; set up for later possible calls 0 0000776E 803E[0000]FF CMP byte [cMeta],-1 0 00007773 752A JNZ ChModErr 0 00007775 C606[0000]16 MOV byte [SAttrib],attr_hidden+attr_system+attr_directory 0 0000777A 2C01 SUB AL,1 ; fast way to discriminate 0 0000777C 720B JB ChModGet ; 0 -> go get value 0 0000777E 7416 JZ ChModSet ; 1 -> go set value 334 errLoc_Unk equ errLOC_Unk ; NASM port equate 0 00007780 C606[0000]01 MOV byte [EXTERR_LOCUS],errLoc_Unk ; Extended Error Locus 0 00007785 B001EBC5 error error_invalid_function ; bad value 337 ChModGet: 0 00007789 E8[0000] invoke Get_File_Info ; suck out the ol' info 339 ChModE equ ChmodE ; NASM port label 0 0000778C 7213 JC ChModE ; error codes are already set for ret 0 0000778E E8[0000] invoke Get_User_stack ; point to user saved vaiables 342 User_CX equ user_CX ; NASM port equate 0 00007791 894404 MOV [SI + User_CX],AX ; return the attributes 0 00007794 EB8A transfer Sys_Ret_OK ; say sayonara 345 ChModSet: 0 00007796 89C8 MOV AX,CX ; get attrs in position 0 00007798 E8[0000] invoke Set_File_Attribute ; go set 0 0000779B 7204 JC ChModE ; errors are set 0 0000779D EBF5 transfer Sys_Ret_OK 350 ChModErr: 0 0000779F B003 mov al,error_path_not_found 352 ChmodE: 0 000077A1 EBE4 Transfer SYS_RET_ERR 354 EndProc D_ChMod 355 356 BREAK <$UNLINK - delete a file entry> 357 ; 358 ; Assembler usage: 359 ; LDS DX, name 360 ; IF VIA SERVER DOS CALL 361 ; MOV CX,SEARCH_ATTRIB 362 ; MOV AH, Unlink 363 ; INT 21h 364 ; 365 ; Error returns: 366 ; AX = error_file_not_found 367 ; = error_access_denied 368 ; 369 370 procedure D_UNLINK,NEAR 370 ****************** warning: proc D_UNLINK... [-w+user] 371 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000077A3 51 SaveReg ; Save possible CX input parm 0 000077A4 89D6 MOV SI,DX ; Point at input string 0 000077A6 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; temp spot for path 0 000077A9 E8[0000] invoke TransPathSet ; go get normalized path 0 000077AC 59 RestoreReg 0 000077AD 72F0 JC ChModErr ; badly formed path 0 000077AF 36803E[0000]FF CMP byte [ss:cMeta],-1 ; meta chars? 0 000077B5 750E JNZ NotFound 0 000077B7 161F Context DS 0 000077B9 B506 mov ch,attr_hidden+attr_system ; unlink appropriate files 0 000077BB E82501 call SetAttrib 0 000077BE E8[0000] invoke DOS_Delete ; remove that file 0 000077C1 7204 JC UnlinkE ; error is there 385 386 0 000077C3 EBD8 transfer Sys_Ret_OK ; okey doksy 388 NotFound: 0 000077C5 B003 MOV AL,error_path_not_found 390 UnlinkE: 0 000077C7 EBD8 transfer Sys_Ret_Err ; bye 392 EndProc D_UnLink 393 394 BREAK <$RENAME - move directory entries around> 395 ; 396 ; Assembler usage: 397 ; LDS DX, source 398 ; LES DI, dest 399 ; IF VIA SERVER DOS CALL 400 ; MOV CX,SEARCH_ATTRIB 401 ; MOV AH, Rename 402 ; INT 21h 403 ; 404 ; Error returns: 405 ; AX = error_file_not_found 406 ; = error_not_same_device 407 ; = error_access_denied 408 409 procedure D_RENAME,NEAR 409 ****************** warning: proc D_RENAME... [-w+user] 410 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 0 000077C9 511E52 SaveReg ; save source and possible CX arg 0 000077CC 06 PUSH ES 0 000077CD 1F POP DS ; move dest to source 414 assume ds:nothing 0 000077CE 89FE MOV SI,DI ; save for offsets 0 000077D0 BF[0000] MOV DI,OFFSET RenBuf wrt DOSGroup 417 0 000077D3 368936[0000] MOV WORD PTR [ss:NO_FILTER_DPATH],SI ;AN000;;IFS. save them for IFS 0 000077D8 368C1E[0200] MOV WORD PTR [ss:NO_FILTER_DPATH+2],DS ;AN000;;IFS. 420 0 000077DD E8[0000] invoke TransPathSet ; munge the paths 0 000077E0 36FF36[0000] PUSH word [ss:WFP_Start] ; get pointer 0 000077E5 368F06[0000] POP word [ss:Ren_WFP] ; stash it 0 000077EA 5E1F59 RestoreReg ; get back source and possible CX arg 425 assume ds:nothing 0 000077ED 72B0 epjc2: JC ChModErr ; get old error 0 000077EF 36803E[0000]FF CMP byte [ss:cMeta],-1 0 000077F5 75CE JNZ NotFound 0 000077F7 51 SaveReg ; Save possible CX arg 0 000077F8 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGroup ; appropriate buffer 0 000077FB E8[0000] invoke TransPathSet ; wham 0 000077FE 59 RestoreReg 433 EPJC2 equ epjc2 ; NASM port label 0 000077FF 72EC JC EPJC2 0 00007801 161F Context DS 0 00007803 803E[0000]FF CMP byte [cMeta],-1 0 00007808 72BB JB NotFound 438 439 THISCDS equ ThisCDS ; NASM port label 0 0000780A FF36[0000] PUSH WORD PTR [THISCDS] ;AN000;;MS.save thiscds 0 0000780E FF36[0200] PUSH WORD PTR [THISCDS+2] ;AN000;;MS. 0 00007812 BF[0000] MOV DI,OFFSET OpenBuf wrt DOSGROUP ;AN000;;MS. 0 00007815 16 PUSH SS ;AN000;;MS. 0 00007816 07 POP ES ;AN000;;MS.es:di-> source 445 assume es:DOSGROUP 0 00007817 30C0 XOR AL,AL ;AN000;;MS.scan all CDS 447 rnloop: ;AN000; 0 00007819 E8[0000] invoke GetCDSFromDrv ;AN000;;MS. 0 0000781C 7210 JC dorn ;AN000;;MS. end of CDS 0 0000781E E8[0000] invoke StrCmp ;AN000;;MS. current dir ? 0 00007821 7404 JZ rnerr ;AN000;;MS. yes 0 00007823 FEC0 INC AL ;AN000;;MS. next 0 00007825 EBF2 JMP rnloop ;AN000;;MS. 454 rnerr: ;AN000; 0 00007827 83C404 ADD SP,4 ;AN000;;MS. pop thiscds 0 0000782A B010EB99 error error_current_directory ;AN000;;MS. 457 dorn: ;AN000; 0 0000782E 368F06[0200] POP WORD PTR [SS:THISCDS+2] ;AN000;;MS. 0 00007833 368F06[0000] POP WORD PTR [SS:THISCDS] ;AN000;;MS. 0 00007838 161F Context DS 0 0000783A B516 mov ch,attr_directory+attr_hidden+attr_system; rename appropriate files 0 0000783C E8A400 call SetAttrib 0 0000783F E8[0000] invoke DOS_Rename ; do the deed 0 00007842 7283 JC UnlinkE ; errors 465 466 0 00007844 E9[0000] transfer Sys_Ret_OK 468 EndProc D_Rename 469 470 Break <$CreateNewFile - Create a new directory entry> 471 472 ; 473 ; CreateNew - Create a new directory entry. Return a file handle if there 474 ; was no previous directory entry, and fail if a directory entry with 475 ; the same name existed previously. 476 ; 477 ; Inputs: DS:DX point to an ASCIZ file name 478 ; CX contains default file attributes 479 ; Outputs: Carry Clear: 480 ; AX has file handle opened for read/write 481 ; Carry Set: 482 ; AX has error code 483 ; Registers modified: All 484 485 Procedure D_CreateNewFile,NEAR 485 ****************** warning: proc D_CreateNewFile... [-w+user] 486 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 487 fmt TypSysCall,LevLog,<"CreateNew\n"> 488 fmt TypSysCall,LevArgs,<" Att = $x file = '$S'\n">, 489 %IF DBCS ;AN000; 490 MOV [ss:Temp_Var],CX ;AN000;KK. set variable with attribute 491 %ENDIF ;AN000; 0 00007847 51 SaveReg ; Save attributes on stack 0 00007848 B9[0000] MOV CX,OFFSET DOS_Create_New; routine to call 0 0000784B E907FF JMP AccessSet ; use good ol' open 495 EndProc D_CreateNewFile 495 ****************** warning: ***** Possible stack size error in D_CreateNewFile ***** [-w+user] 496 497 Break 498 499 ; 500 ; HexToAsciz - used to convert register into a hex number. 501 ; 502 ; Inputs: AX contains the number 503 ; ES:DI point to destination 504 ; Outputs: ES:DI updated 505 ; Registers modified: DI,CX 506 507 Procedure HexToAsciz,NEAR 507 ****************** warning: proc HexToAsciz... [-w+user] 0 0000784E B90400 mov cx,4 ; 4 digits in AX 509 GetDigit: 0 00007851 51 SaveReg ; preserve count 0 00007852 B104 mov cl,4 0 00007854 D3C0 ROL AX,CL ; move leftmost nibble into rightmost 0 00007856 50 SaveReg ; preserve remainder of digits 0 00007857 240F AND AL,0Fh ; grab low nibble 0 00007859 0430 ADD AL,'0' ; turn into digit 0 0000785B 3C39 CMP AL,'9' ; bigger than 9 0 0000785D 7602 JBE DoStore ; no, stash it 0 0000785F 0407 ADD AL,'A'-'0'-10 ; convert into uppercase letter 519 DoStore: 0 00007861 AA STOSB ; drop in the character 0 00007862 5859 RestoreReg ; regain the number and count 0 00007864 E2EB loop GetDigit ; while there's more digits, go do 'em 0 00007866 C3 return 524 EndProc HexToAsciz 525 526 Break <$CreateTempFile - create a unique name> 527 528 ; 529 ; $CreateTemp - given a directory, create a unique name in that directory. 530 ; Method used is to get the current time, convert to a name and attempt 531 ; a create new. Repeat until create new succeeds. 532 ; 533 ; Inputs: DS:DX point to a null terminated directory name. 534 ; CX contains default attributes 535 ; Outputs: Unique name is appended to DS:DX directory. 536 ; AX has handle 537 ; Registers modified: all 538 539 Procedure D_CreateTempFile,NEAR 539 ****************** warning: proc D_CreateTempFile... [-w+user] 540 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGroup 541 fmt TypSysCall,LevLog,<"CreateTmp\n"> 542 fmt TypSysCall,LevArgs,<" Att = $x dir = '$S'\n">, 543 PUBLIC FILE001S,FILE001E 544 FILE001S: 545 LocalVar EndPtr,DWORD 546 LocalVar FilPtr,DWORD 547 LocalVar Attr,WORD 548 FILE001E: 0 00007867 5589E583EC0A Enter 0 0000786D F7C1D8FF TEST CX,~ attr_changeable 0 00007871 7405 JZ OKatts ; Ok if no non-changeable bits set 552 ; 553 ; We need this "hook" here to detect these cases (like user sets one both of 554 ; vol_id and dir bits) because of the structure of the or $CreateNewFile loop 555 ; below. The code loops on error_access_denied, but if one of the non 556 ; changeable attributes is specified, the loop COULD be infinite or WILL be 557 ; infinite because CreateNewFile will fail with access_denied always. Thus we 558 ; need to detect these cases before getting to the loop. 559 ; 0 00007873 B80500 MOV AX,error_access_denied 0 00007876 EB5F JMP SHORT SETTMPERR 562 563 OKatts: 0 00007878 894EF6 MOV [attr],CX ; save attribute 0 0000787B 8956F8 MOV [FilPtrL],DX ; pointer to file 0 0000787E 8C5EFA MOV [FilPtrH],DS 0 00007881 8C5EFE MOV [EndPtrH],DS ; seg pointer to end of dir 0 00007884 1E PUSH DS 0 00007885 07 POP ES ; destination for nul search 570 assume es:nothing 0 00007886 89D7 MOV DI,DX 0 00007888 89F9 MOV CX,DI 0 0000788A F7D9 NEG CX ; number of bytes remaining in segment 574 %IF DBCS ;AN000; 575 Kloop: ;AN000;; 2/13/KK 576 MOV AL, BYTE PTR [ES:DI] ;AN000;; 2/13/KK 577 INC DI ;AN000;; 2/13/KK 578 OR AL,AL ;AN000;; 2/13/KK 579 JZ GOTEND ;AN000;; 2/13/KK 580 invoke testkanj ;AN000;; 2/13/KK 581 jz Kloop ;AN000;; 2/13/KK 582 inc di ;AN000;; Skip over second kanji byte 2/13/KK 583 CMP BYTE PTR [ES:DI],0 ;AN000;; 2/13/KK 584 JZ STOREPTH ;AN000; When char before NUL is sec Kanji byte 585 ;AN000; do not look for path char. 2/13/KK 586 jmp Kloop ;AN000; 2/13/KK 587 GOTEND: ;AN000; 2/13/KK 588 %ELSE ;AN000; 0 0000788C 09C9 OR CX,CX ;AN000;MS. cx=0 ? ds:dx on segment boundary 0 0000788E 7503 JNZ okok ;AN000;MS. no 0 00007890 B9FFFF MOV CX,-1 ;AN000;MS. 592 okok: ;AN000; 0 00007893 31C0 XOR AX,AX ;AN000; 0 00007895 F2AE REPNZ SCASB ;AN000; 595 %ENDIF ;AN000; 0 00007897 4F DEC DI ; point back to the null 0 00007898 268A45FF MOV AL,[ES:DI-1] ; Get char before the NUL 0 0000789C E8[0000] invoke PathChrCmp ; Is it a path separator? 0 0000789F 7403 JZ SETENDPTR ; Yes 600 STOREPTH: 0 000078A1 B05C MOV AL,'\' 0 000078A3 AA STOSB ; Add a path separator (and INC DI) 603 SETENDPTR: 0 000078A4 897EFC MOV [EndPtrL],DI ; pointer to the tail 605 CreateLoop: 0 000078A7 161F Context DS ; let ReadTime see variables 0 000078A9 55 SaveReg 0 000078AA E8[0000] invoke ReadTime ; go get time 0 000078AD 5D RestoreReg 610 ; 611 ; Time is in CX:DX. Go drop it into the string. 612 ; 0 000078AE C47EFC les di,[EndPtr] ; point to the string 0 000078B1 89C8 mov ax,cx 0 000078B3 E898FF call HexToAsciz ; store upper word 0 000078B6 89D0 mov ax,dx 0 000078B8 E893FF call HexToAsciz ; store lower word 0 000078BB 30C0 xor al,al 0 000078BD AA STOSB ; nul terminate 0 000078BE C556F8 LDS DX,[FilPtr] ; get name 621 ASSUME DS:NOTHING 0 000078C1 8B4EF6 MOV CX,[Attr] ; get attr 0 000078C4 55 SaveReg 0 000078C5 E87FFF CALL D_CreateNewFile ; try to create a new file 0 000078C8 5D RestoreReg 0 000078C9 730D JNC CreateDone ; failed, go try again 627 ; 628 ; The operation failed and the error has been mapped in AX. Grab the extended 629 ; error and figure out what to do. 630 ; 631 ExtErr equ EXTERR ; NASM port label 0 000078CB 36A1[0000] mov ax,[ss:ExtErr] 0 000078CF 3C50 cmp al,error_file_exists 0 000078D1 74D4 jz CreateLoop ; file existed => try with new name 0 000078D3 3C05 cmp al,error_access_denied 0 000078D5 74D0 jz CreateLoop ; access denied (attr mismatch) 637 638 ; CMP AL,error_file_exists ; certain errors cause failure 639 ; JZ CreateLoop 640 ; CMP AL,error_access_denied 641 ; JNZ SETTMPERR ; Error out 642 ; CMP [EXTERR],error_cannot_make ; See if it's REALLY an att mismatch 643 ; JNZ CreateLoop ; It was, try again 644 ; MOV AL,error_cannot_make ; Return this "extended" error 645 646 SETTMPERR: 0 000078D7 F9 STC 648 CreateDone: 0 000078D8 89EC5D Leave 0 000078DB 7203 JC CreateFail 0 000078DD E9[0000] transfer Sys_Ret_OK ; success! 652 CreateFail: 0 000078E0 E9[0000] transfer Sys_Ret_Err 654 EndProc D_CreateTempFile 655 656 Break 657 658 ; 659 ; SetAttrib will set the search attribute (SAttrib) either to the normal 660 ; (CH) or to the value in CL if the current system call is through 661 ; serverdoscall. 662 ; 663 ; Inputs: fSharing == FALSE => set sattrib to CH 664 ; fSharing == TRUE => set sattrib to CL 665 ; Outputs: none 666 ; Registers changed: CX 667 668 procedure SetAttrib,NEAR 668 ****************** warning: proc SetAttrib... [-w+user] 669 assume ds:nothing,es:nothing 0 000078E3 36F606[0000]FF test byte [ss:fSharing],-1 0 000078E9 7502 jnz Set 0 000078EB 88E9 mov cl,ch 673 Set: 0 000078ED 36880E[0000] mov [ss:SAttrib],cl 0 000078F2 C3 return 676 EndProc SetAttrib 677 678 679 Break 680 681 ; Input: AL= 0 reserved AH=6CH 682 ; BX= mode 683 ; CL= create attribute CH=search attribute (from server) 684 ; DX= flag 685 ; DS:SI = file name 686 ; ES:DI = parm list 687 ; DD SET EA list (-1) null 688 ; DW n parameters 689 ; DB type (TTTTTTLL) 690 ; DW IOMODE 691 ; Function: Extended Open 692 ; Output: carry clear 693 ; AX= handle 694 ; CX=1 file opened 695 ; 2 file created/opened 696 ; 3 file replaced/opened 697 ; carry set: AX has error code 698 ; 699 700 701 procedure D_Extended_Open,NEAR ;AN000; 701 ****************** warning: proc D_Extended_Open... [-w+user] 702 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 703 0 000078F3 36C606[0000]00 MOV byte [ss:XA_from],0 ;AN000;EO. init for set XA 0 000078F9 368916[0000] MOV [ss:EXTOPEN_FLAG],DX ;AN000;EO. save ext. open flag 0 000078FE 36C706[0000]0000 MOV word [ss:EXTOPEN_IO_MODE],0 ;AN000;EO. initialize IO mode 0 00007905 F7C200FE TEST DX,reserved_bits_mask ;AN000;EO. reserved bits 0 ? 0 00007909 7545 JNZ ext_inval2 ;AN000;EO. no 0 0000790B 88D4 MOV AH,DL ;AN000;EO. make sure flag is right 0 0000790D 80FA00 CMP DL,0 ;AN000;EO. all fail ? 0 00007910 743E JZ ext_inval2 ;AN000;EO. yes, error 0 00007912 80E20F AND DL,exists_mask ;AN000;EO. get exists action byte 0 00007915 80FA02 CMP DL,2 ;AN000;EO, > 02 0 00007918 7736 JA ext_inval2 ;AN000;EO. yes ,error 0 0000791A 80E4F0 AND AH,not_exists_mask ;AN000;EO. get no exists action byte 0 0000791D 80FC10 CMP AH,10H ;AN000;EO. > 10 0 00007920 772E JA ext_inval2 ;AN000;EO. yes error 718 719 ; CMP DI,-1 ;AN000;EO. null parm list 720 ; JZ no_parm ;AN000;EO. yes 721 ; ;AN000;EO 722 ; PUSH CX ;AN000;EO. 723 ; ;AN000;EO. 724 ; MOV CX,[ES:DI.EXT_NUM_OF_PARM];AN000;EO. get number of parms 725 ; OR CX,CX ;AN000;EO. 0 pamrs ? 726 ; JZ parmend ;AN000;EO. yes 727 ; PUSH SI ;AN000;EO. 728 ; PUSH DS ;AN000;EO. 729 ; MOV SI,DI ;AN000;EO. 730 ; ADD SI,size EXT_OPEN_PARM ;AN000;EO. position to 1st parm 731 ; PUSH ES ;AN000;EO. 732 ; POP DS ;AN000;EO. ds:si -> parm list 733 ; CALL GetIOParms ;AN000;EO. 734 ; POP DS ;AN000;EO. 735 ; POP SI ;AN000;EO. 736 ;parmend: ;AN000;EO 737 ; POP CX ;AN000;EO. restore CX 738 ;no_parm: ;AN000;EO. 0 00007922 368C06[0000] MOV [ss:SAVE_ES],ES ;AN000;EO. save API parms 0 00007927 36893E[0000] MOV [ss:SAVE_DI],DI ;AN000;EO. 0 0000792C 36FF36[0000] PUSH word [ss:EXTOPEN_FLAG] ;AN000;EO. 0 00007931 368F06[0000] POP word [ss:SAVE_DX] ;AN000;EO. 0 00007936 36890E[0000] MOV [ss:SAVE_CX],CX ;AN000;EO. 0 0000793B 36891E[0000] MOV [ss:SAVE_BX],BX ;AN000;EO. 0 00007940 368C1E[0000] MOV [ss:SAVE_DS],DS ;AN000;EO. 0 00007945 368936[0000] MOV [ss:SAVE_SI],SI ;AN000;EO. 0 0000794A 89F2 MOV DX,SI ;AN000;EO. ds:dx points to file name 0 0000794C 89D8 MOV AX,BX ;AN000;EO. ax= mode 749 750 ; TEST [EXTOPEN_FLAG],no_code_page_check ;AN000;EO. check no code page 751 ; JNZ no_cdpg_chk ;AN000;;EO. no 0 0000794E EB0B JMP SHORT goopen2 ;AN000;;EO. do nromal 753 ext_inval2: ;AN000;;EO. 754 error_Invalid_Function equ error_invalid_function ; NASM port equate 0 00007950 B001EB8C error error_Invalid_Function ;AN000;EO.. invalid function 756 ext_inval_parm: ;AN000;EO.. 0 00007954 59 POP CX ;AN000;EO.. pop up satck 0 00007955 5E POP SI ;AN000;EO.. 759 error_Invalid_data equ error_invalid_data ; NASM port equate 0 00007956 B00DEBF8 error error_Invalid_data ;AN000;EO.. invalid parms 761 error_return: ;AN000;EO. 0 0000795A C3 ret ;AN000;EO.. return with error 763 ;no_cdpg_chk: EO. 764 ; MOV [CPSWFLAG],0 ;AN000;EO.. set CPSW flag off 765 goopen2: ;AN000; 0 0000795B F7C30020 TEST BX,int_24_error ;AN000;EO.. disable INT 24 error ? 0 0000795F 7406 JZ goopen ;AN000;EO.. no 768 EXT_OPEN_I24_OFF equ ext_open_I24_off ; NASM port equate 0 00007961 36800E[0000]02 OR byte [ss:EXTOPEN_ON],EXT_OPEN_I24_OFF ;AN000;EO.. set bit to disable 770 771 goopen: ;AN000; 772 EXT_OPEN_ON equ ext_open_on ; NASM port equate 0 00007967 36800E[0000]01 OR byte [ss:EXTOPEN_ON],EXT_OPEN_ON ;AN000;EO.. set Extended Open active 0 0000796D 368126[0000]FF00 AND word [ss:EXTOPEN_FLAG],0FFH ;AN000;EO.create new ? 0 00007974 36833E[0000]10 CMP word [ss:EXTOPEN_FLAG],ext_exists_fail + ext_nexists_create ;AN000;FT. 0 0000797A 7520 JNZ chknext ;AN000;;EO. no 0 0000797C E8C8FE invoke D_CreateNewFile ;AN000;;EO. yes 0 0000797F 72D9 JC error_return ;AN000;;EO. error 0 00007981 36803E[0000]00 CMP byte [ss:EXTOPEN_ON],0 ;AN000;;EO. IFS does it 0 00007987 7410 JZ ok_return2 ;AN000;;EO. yes 0 00007989 36C706[0000]0200 MOV word [ss:EXTOPEN_FLAG],action_created_opened ;AN000;EO. creted/opened 0 00007990 36C606[0000]02 MOV byte [ss:XA_from],By_Create ;AN000;;EO. for set xa 0 00007996 E99500 JMP setXAttr ;AN000;;EO. set XAs 784 ok_return2: 0 00007999 E9[0000] transfer SYS_RET_OK ;AN000;;EO. 786 chknext: 0 0000799C 36F706[0000]0100 TEST word [ss:EXTOPEN_FLAG],ext_exists_open ;AN000;;EO. exists open 0 000079A3 7532 JNZ exist_open ;AN000;;EO. yes 0 000079A5 E8A9FD invoke D_Creat ;AN000;;EO. must be replace open 0 000079A8 72B0 JC error_return ;AN000;;EO. return with error 0 000079AA 36803E[0000]00 CMP byte [ss:EXTOPEN_ON],0 ;AN000;;EO. IFS does it 0 000079B0 74E7 JZ ok_return2 ;AN000;;EO. yes 0 000079B2 36C706[0000]0200 MOV word [ss:EXTOPEN_FLAG],action_created_opened ;AN000;EO. prsume create/open 0 000079B9 36C606[0000]02 MOV byte [ss:XA_from],By_Create ;AN000;EO. for set xa 0 000079BF 36F606[0000]04 TEST byte [ss:EXTOPEN_ON],ext_file_not_exists ;AN000;;EO. file not exists ? 0 000079C5 7567 JNZ setXAttr ;AN000;;EO. no 0 000079C7 36C706[0000]0300 MOV word [ss:EXTOPEN_FLAG],action_replaced_opened ;AN000;;EO. replaced/opened 0 000079CE 36C606[0000]00 MOV byte [ss:XA_from],0 ;AN000;EO. for set xa 0 000079D4 EB58 JMP SHORT setXAttr ;AN000;;EO. set XAs 800 error_return2: 0 000079D6 C3 ret ;AN000;;EO. return with error 802 ;AN000; 803 exist_open: ;AN000; 0 000079D7 36F606[0000]FF test byte [ss:fSharing],-1 ;AN000;;EO. server doscall? 0 000079DD 7402 jz noserver ;AN000;;EO. no 0 000079DF 88E9 MOV CL,CH ;AN000;;EO. cl=search attribute 807 808 noserver: 0 000079E1 E892FC invoke D_Open2 ;AN000;;EO. do open 0 000079E4 7339 JNC ext_ok ;AN000;;EO. 0 000079E6 36803E[0000]00 CMP byte [ss:EXTOPEN_ON],0 ;AN000;;EO. error and IFS call 0 000079EC 74E8 JZ error_return2 ;AN000;;EO. return with error 813 local_extopen: 814 0 000079EE 83F802 CMP AX,error_file_not_found ;AN000;;EO. file not found error 0 000079F1 75E3 JNZ error_return2 ;AN000;;EO. no, 0 000079F3 36F706[0000]1000 TEST word [ss:EXTOPEN_FLAG],ext_nexists_create;AN000;;EO. want to fail 0 000079FA 7503 JNZ do_creat ;AN000;;EO. yes 0 000079FC EB65 JMP extexit ;AN000;;EO. yes 0 000079FE 90 nop ; identicalise 821 do_creat: 0 000079FF 36C606[0000]02 MOV byte [ss:XA_from],By_Create ;AN000;;EO. for set xa 0 00007A05 368B0E[0000] MOV CX,[ss:SAVE_CX] ;AN000;;EO. get ds:dx for file name 0 00007A0A 36C536[0000] LDS SI,[ss:SAVE_SI] ;AN000;;EO. cx = attribute 0 00007A0F 89F2 MOV DX,SI ;AN000;;EO. 0 00007A11 E83DFD invoke D_Creat ;AN000;;EO. do create 0 00007A14 724D JC extexit ;AN000;;EO. error 0 00007A16 36C706[0000]0200 MOV word [ss:EXTOPEN_FLAG],action_created_opened ;AN000;;EO. is created/opened 0 00007A1D EB0F JMP SHORT setXAttr ;AN000;;EO. set XAs 830 831 ext_ok: 0 00007A1F 36803E[0000]00 CMP byte [ss:EXTOPEN_ON],0 ;AN000;;EO. IFS call ? 0 00007A25 7415 JZ ok_return ;AN000;;EO. yes 0 00007A27 36C706[0000]0100 MOV word [ss:EXTOPEN_FLAG],action_opened ;AN000;;EO. opened 835 setXAttr: 836 ; LES DI,DWORD PTR [SAVE_DI] ;AN000;EO. 0 00007A2E 50 PUSH AX ;AN000;;EO. save handle for final 838 ; MOV BX,AX ;AN000;;EO. bx= handle 839 ; MOV AX,04H ;AN000;;EO. set extended attr by handle 840 ; PUSH DS ;AN000;;EO. save file name addr 841 ; PUSH DX ;AN000;;EO. 842 ; CMP DI,-1 ;AN000;;EO. null parm list 843 ; JZ nosetea ;AN000;;EO. yes 844 ; CMP WORD PTR [ES:DI],-1 ;AN000;;EO. null set list 845 ; JZ nosetea ;AN000;;EO. yes 846 ; LES DI,DWORD PTR [ES:DI] ;AN000;;EO. es:di -> set list 847 ; invoke $File_times ;AN000;;EO. 848 ;nosetea: ;AN000; EO 849 ; POP DX ;AN000;;EO. restore file name addr 850 ; POP DS ;AN000;;EO. 851 ; JC extexit2 ;AN000;;EO. 0 00007A2F E8[0000] invoke get_user_stack ;AN000;;EO. 0 00007A32 36A1[0000] MOV AX,[ss:EXTOPEN_FLAG] ;AN000;;EO. 854 USER_CX equ user_CX ; NASM port equate 0 00007A36 894404 MOV [SI + USER_CX],AX ;AN000;;EO. set action code for cx 0 00007A39 58 POP AX ;AN000;;EO. 857 USER_AX equ user_AX ; NASM port equate 0 00007A3A 8904 MOV [SI + USER_AX],AX ;AN000;;EO. set handle for ax 859 860 ok_return: ;AN000; 0 00007A3C E9[0000] transfer SYS_RET_OK ;AN000;;EO. 862 863 extexit2: ;AN000; ERROR RECOVERY 864 0 00007A3F 5B POP BX ;AN000;EO. close the handle 0 00007A40 50 PUSH AX ;AN000;EO. save error code from set XA 0 00007A41 36833E[0000]02 CMP word [ss:EXTOPEN_FLAG],action_created_opened ;AN000;EO. from create 0 00007A47 750C JNZ justopen ;AN000;EO. 0 00007A49 36C536[0000] LDS SI,[ss:SAVE_SI] ;AN000;EO. cx = attribute 0 00007A4E C514 LDS DX,[SI] ;AN000;EO. 0 00007A50 E850FD invoke D_UNLINK ;AN000;EO. delete the file 0 00007A53 EB03 JMP SHORT reserror ;AN000;EO. 873 874 justopen: ;AN000; 0 00007A55 E8[0000] invoke D_close ;AN000;EO. pretend never happend 876 reserror: ;AN000; 0 00007A58 58 POP AX ;AN000;EO. retore error code from set XA 0 00007A59 EB08 JMP SHORT extexit ;AN000;EO. 879 880 881 ext_file_unfound: ;AN000; 0 00007A5B B80200 MOV AX,error_file_not_found ;AN000;EO. 0 00007A5E EB03 JMP SHORT extexit ;AN000;EO. 884 ext_inval: ;AN000; 0 00007A60 B80100 MOV AX,error_invalid_function;AN000;EO. 886 extexit: 0 00007A63 E9[0000] transfer SYS_RET_ERR ;AN000;EO. 888 889 EndProc D_Extended_Open ;AN000; 890 891 892 Break 893 894 ; 895 ; 896 ; Inputs: DS:SI -> IO parm list 897 ; CX= number of parms 898 ; Function: get IO parms from parm list 899 ; Outputs: [EXT_IOMODE]= IO mode parm 900 901 ;procedure GetIOParms,NEAR 902 ; assume ds:nothing,es:nothing 903 ; 904 ; LODSB ; get parm type ;AN000; 905 ; CMP AL,0*100B+10B ; have IOMODE ;AN000; 906 ; JE SET_IOMODE ;AN000; 907 ; AND AL,00000011B ; decode it ;AN000; 908 ; JZ SKIP_ASCIIZ ;AN000; 909 ; DEC AL ;AN000; 910 ; JZ SKIP_LEN ;AN000; 911 ;; DEC AL ;AN000; 912 ; JZ SKIP_WORD ;AN000; 913 ;SKIP_DWORD: ; copy DWORD parm ;AN000; 914 ; LODSW ;AN000; 915 ;SKIP_WORD: ; copy WORD parm ;AN000; 916 ; LODSW ;AN000; 917 ; JMP SHORT NEXT_PARM ;AN000; 918 ;SET_IOMODE: ; copy IOMODE ;AN000; 919 ; LODSW ;AN000; 920 ; MOV [EXTOPEN_IO_MODE],AX ;AN000; 921 ; JMP SHORT NEXT_PARM ;AN000; 922 ;SKIP_LEN: ; copy LENGTH parm ;AN000; 923 ; LODSW ;AN000; 924 ; ADD SI,AX ;AN000; 925 ; JMP SHORT NEXT_PARM ;AN000; 926 ;SKIP_ASCIIZ: ; copy ASCIIZ parm ;AN000; 927 ; LODSB ;AN000; 928 ; OR AL,AL ;AN000; 929 ; JNE SKIP_ASCIIZ ;AN000; 930 ;NEXT_PARM: ;AN000; 931 ; LOOP GetIOParms ;AN000; 932 ; return ;AN000; 933 ;EndProc GetIOParms ;AN000; 934 935 END 936 937 === Trace listing source: ../DOS/lock.lst 1 ; SCCSID = @(#)lock.asm 1.1 85/04/10 2 ;TITLE LOCK ROUTINES - Routines for file locking 3 ;NAME LOCK 4 5 ; 6 ; LOCK_CHECK 7 ; LOCK_VIOLATION 8 ; $LockOper 9 ; 10 ; Revision history: 11 ; A000 version 4.00 Jan. 1988 12 ; 13 %include "dosseg.nas" 1 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 3 <1> ; 4 <1> ; segment ordering for MSDOS 5 <1> ; 6 <1> 7 <1> %include "ddataseg.nas" 1 <2> 2 <2> %include "lmacros3.mac" 1 <3> [list -] 1 ****************** <3> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 14 === Switch to base=002450h -> "DOSCODECODE" 15 section DOSCODECODE 16 17 [list -] 17 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 17 ****************** warning: out: BPB.INC... [-w+user] 17 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 17 ****************** warning: out: DEVSYM.INC... [-w+user] 24 25 %ifndef IBM 26 %iassign IBM 0 27 %endif 28 %ifndef Installed 29 %iassign Installed 0 30 %endif 31 32 %iassign Installed TRUE 33 34 i_need THISSFT,DWORD 35 i_need THISDPB,DWORD 36 i_need EXTERR,WORD 37 i_need ALLOWED,BYTE 38 i_need RetryCount,WORD 39 I_need fShare,BYTE 40 I_Need EXTERR_LOCUS,BYTE ; Extended Error Locus 41 i_need JShare,DWORD 42 i_need Lock_Buffer,DWORD ;AN000; DOS 4.00 43 i_need Temp_Var,WORD ;AN000; DOS 4.00 44 45 assume nocheck, ss:DOSGROUP 46 47 BREAK <$LockOper - Lock Calls> 48 49 ; 50 ; Assembler usage: 51 ; MOV BX, Handle (DOS 3.3) 52 ; MOV CX, OffsetHigh 53 ; MOV DX, OffsetLow 54 ; MOV SI, LengthHigh 55 ; MOV DI, LengthLow 56 ; MOV AH, LockOper 57 ; MOV AL, Request 58 ; INT 21h 59 ; 60 ; Error returns: 61 ; AX = error_invalid_handle 62 ; = error_invalid_function 63 ; = error_lock_violation 64 ; 65 ; Assembler usage: 66 ; MOV AX, 5C?? (DOS 4.00) 67 ; 68 ; 0? lock all 69 ; 8? lock write 70 ; ?2 lock multiple 71 ; ?3 unlock multiple 72 ; ?4 lock/read 73 ; ?5 write/unlock 74 ; ?6 add (lseek EOF/lock/write/unlock) 75 ; MOV BX, Handle 76 ; MOV CX, count or size 77 ; LDS DX, buffer 78 ; INT 21h 79 ; 80 ; Error returns: 81 ; AX = error_invalid_handle 82 ; = error_invalid_function 83 ; = error_lock_violation 84 85 procedure D_LockOper,NEAR 85 ****************** warning: proc D_LockOper... [-w+user] 86 ASSUME DS:NOTHING,ES:NOTHING 87 ; MOV BP,AX ;MS. BP=AX ;AN000; 88 ; AND BP,7FH ;MS. clear bit 7 ;AN000; 89 ; CMP BP,Lock_add ;MS. supported function ? ;AN000; 90 ; JA lock_bad_func ;MS. no, ;AN000; 91 0 00007A66 3C01 CMP AL,1 ;AN000;;MS. no, 0 00007A68 770C JA lock_bad_func ;AN000;;MS. no, 94 0 00007A6A 57 PUSH DI ; Save LengthLow 0 00007A6B E8[0000] invoke SFFromHandle ; ES:DI -> SFT 0 00007A6E 7310 JNC lock_do ; have valid handle 0 00007A70 5F POP DI ; Clean stack 0 00007A71 B006E9[0000] error error_invalid_handle 100 lock_bad_func: 101 errLoc_Unk equ errLOC_Unk ; NASM port equate 0 00007A76 36C606[0000]01 MOV byte [ss:EXTERR_LOCUS],errLoc_Unk ; Extended Error Locus 0 00007A7C B001EBF3 error error_invalid_function 104 105 ; Align_buffer call has been deleted, since it corrupts the DTA (6/5/88) P5013 106 107 lock_do: 108 ; PUSH AX ;AN000;;MS. save ax 109 ; PUSH BX ;AN000;;MS. save handle 110 ; MOV [Temp_Var],DX ;AN000;;MS. save DX 111 ; invoke Align_Buffer ;AN000;;MS. align ds:dx and set DMAADD 112 ; POP BX ;AN000;;MS. restore handle 113 ; POP AX ;AN000;;MS. save ax 114 ;AN000; 115 ; CMP BP,Unlock_all ;AN000;;MS. old function 0 or 1 ? 116 ; JA chk_lock_mul ;AN000;;MS. no, new function 117 ; TEST AL,80H ;AN000;;MS. 80H bit on ? 118 ; JZ old_33 ;AN000;;MS. no, old DOS 3.3 interface 119 ; MOV CX,1 ;AN000;;MS. adjust for new interface 120 ; ADD BP,2 ;AN000;;MS. 121 ; JMP SHORT chk_lock_mul ;AN000;;MS. 122 old_33: 0 00007A80 89C3 MOV BX,AX ;AN000;;MS. save AX 124 ;AN000; 125 ;; MOV DX,[Temp_Var] ;AN000;;MS. retore DX (P5013) 6/5/88 126 0 00007A82 BD[0000] MOV BP, OFFSET Lock_Buffer wrt DOSGROUP ;AN000;;MS. get DOS LOCK buffer 0 00007A85 895600 MOV WORD PTR [BP + Lock_position],DX ;AN000;;MS. set low offset 0 00007A88 894E02 MOV WORD PTR [BP + Lock_position+2],CX;AN000;;MS. set high offset 0 00007A8B 59 POP CX ;AN000;;MS. get low length 0 00007A8C 894E04 MOV WORD PTR [BP + Lock_length],CX ;AN000;;MS. set low length 0 00007A8F 897606 MOV WORD PTR [BP + Lock_length+2],SI ;AN000;;MS. set high length 0 00007A92 B90100 MOV CX,1 ;AN000;;MS. one range 0 00007A95 16 PUSH ss ;AN000;;MS. 0 00007A96 1F POP DS ;AN000;;MS. DS:DX points to 136 assume ds:DOSGROUP 0 00007A97 89EA MOV DX,BP ;AN000;;MS. Lock_Buffer 0 00007A99 A801 TEST AL,Unlock_all ;AN000;;MS. function 1 0 00007A9B 7503 JNZ DOS_Unlock ;AN000;;MS. yes 0 00007A9D EB20 JMP DOS_Lock ;AN000;;MS. function 0 0 00007A9F 90 nop ; identicalise 142 ;;chk_lock_mul: ;AN000; 143 ; POP SI ;AN000;;MS. pop low length 144 ; TEST [ES:DI.sf_flags],sf_isnet ;AN000;;MS. net handle? 145 ; JZ LOCAL_DOS_LOCK ;AN000;;MS. no 146 ; invoke OWN_SHARE ;AN000;;MS. IFS owns share ? 147 ; JNZ LOCAL_DOS_LOCK ;AN000;;MS. no 148 ; MOV BX,AX ;AN000;;MS. BX=AX 149 ; CallInstall NET_XLock,multNet,10 ;AN000;;MS. issue Net Extended Lock 150 ; MOV [Temp_Var],CX ;AN000;;MS. cx= retuened from IFS 151 ; JMP ValChk ;AN000;;MS. check return 152 ;LOCAL_DOS_LOCK: ;AN000; 153 ; CMP BP,Lock_mul_range ;AN000;;MS. lock mul range? 154 ; JNZ unmul ;AN000;;MS. lock mul range? 155 ; JMP LOCAL_LOCK ;AN000;;MS. yes 156 ;unmul: 157 ; CMP BP,Unlock_mul_range ;AN000;;MS. unlock mul range? 158 ; JZ LOCAL_UNLOCK ;AN000;;MS. yes 159 ; CMP BP,Lock_read ;AN000;;MS. lock read? 160 ; JNZ chk_write_unlock ;AN000;;MS. no 161 ; CALL Set_Lock_Buffer ;AN000;;MS. set DOS lock buffer 162 ; CALL Set_Lock ;AN000;;MS. set the lock 163 ; JC lockerror ;AN000;;MS. error 164 ; invoke $READ ;AN000;;MS. do read 165 ; JC lockerror ;AN000;;MS. error 166 ;lockend: ;AN000; 167 ; transfer SYS_RET_OK ;AN000;;MS. return 168 ;chk_write_unlock: ;AN000; 169 ; CMP BP,Write_unlock ;AN000;;MS. write unlock ? 170 ; JNZ Lock_addf ;AN000;;MS. no 171 ; CALL Set_Lock_Buffer ;AN000;;MS. set DOS lock buffer 172 ;WriteUnlock: ;AN000; 173 ; PUSH AX ;AN000;;MS. save AX for unlock 174 ; invoke $WRITE ;AN000;;MS. do write 175 ; MOV [Temp_Var],AX ;AN000;;MS. save number of bytes writ 176 ; POP AX ;AN000;;MS. restore AX 177 ; JC lockerror ;AN000;;MS. error 178 ; MOV CX,1 ;AN000;;MS. one range unlock 179 ; PUSH ss ;AN000;;MS. 180 ; POP DS ;AN000;;MS. DS:DX points to 181 ; MOV DX,OFFSET Lock_Buffer wrt DOSGROUP ;AN000;;MS. Lock_BUffer 182 ; JMP LOCAL_UNLOCK ;AN000;;MS. do unlock 183 ;Lock_addf: ;AN000; 184 ; MOV SI,WORD PTR [ES:DI.SF_Size] ;AN000;;MS. must be lock add 185 ; MOV WORD PTR [ES:DI.SF_Position],SI ;AN000;;MS. set file position to 186 ; MOV SI,WORD PTR [ES:DI.SF_Size+2] ;AN000;;MS. EOF 187 ; MOV WORD PTR [ES:DI.SF_Position+2],SI;AN000;;MS. 188 ; CALL Set_Lock_Buffer ;AN000;;MS. set DOS lock buffer 189 ; CALL Set_Lock ;AN000;;MS. set the lock 190 ; JC lockerror ;AN000;;MS. error 191 ; JMP WriteUnlock ;AN000;;MS. do write unlock 192 ;AN000;;MS. 193 DOS_Unlock: 0 00007AA0 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet 0 00007AA6 7407 JZ LOCAL_UNLOCK 196 ;; invoke OWN_SHARE ;AN000;;MS. IFS owns share ? 197 ;; JNZ LOCAL_UNLOCK ;AN000;;MS. no 198 199 multNet equ MultNET ; NASM port equate 0 00007AA8 B80A11CD2F CallInstall Net_Xlock,multNet,10 0 00007AAD EB05 JMP SHORT ValChk 202 LOCAL_UNLOCK: 203 %if installed 0 00007AAF 36FF1E[1C00] Call far [ss:JShare + 7 * 4] 205 %else 206 Call clr_block 207 %endif 208 ValChk: 0 00007AB4 7302 JNC Lock_OK 210 lockerror: 0 00007AB6 EBC6 transfer SYS_RET_ERR 212 Lock_OK: 213 Temp_VAR equ Temp_Var ; NASM port label 0 00007AB8 36A1[0000] MOV AX,[ss:Temp_VAR] ;AN000;;MS. AX= number of bytes 0 00007ABC E9[0000] transfer SYS_Ret_OK 216 DOS_Lock: 0 00007ABF 26F745050080 TEST word [ES:DI + sf_flags],sf_isnet 0 00007AC5 7407 JZ LOCAL_LOCK 219 ;; invoke OWN_SHARE ;AN000;;MS. IFS owns share ? 220 ;; JNZ LOCAL_LOCK ;AN000;;MS. no 0 00007AC7 B80A11CD2F CallInstall NET_XLock,multNet,10 0 00007ACC EBE6 JMP ValChk 223 LOCAL_LOCK: 224 %if installed 0 00007ACE 36FF1E[1800] Call far [ss:JShare + 6 * 4] 226 %else 227 Call Set_Block 228 %endif 0 00007AD3 EBDF JMP ValChk 230 231 EndProc D_LockOper 232 233 BREAK 234 235 ; Input: 236 ; BP = Lock_Buffer addr 237 ; CX = lock length 238 ; Function: 239 ; set the lock 240 ; Output: 241 ; carry clear ,Lock is set 242 ; DS:DX = addr of 243 ; carry set Lock is not set 244 ; DS,DX,CX preserved 245 246 ; procedure Set_Lock,NEAR ;AN000; 247 ;ASSUME DS:NOTHING,ES:NOTHING ;AN000; 248 ;AN000; 249 ; PUSH DS ;MS. save regs ;AN000; 250 ; PUSH DX ;MS. ;AN000; 251 ; PUSH CX ;MS. ;AN000; 252 ; ;AN000; 253 ; PUSH ss ;MS. ;AN000; 254 ; POP DS ;MS. DS:DX poits to Lock_Buffer ;AN000; 255 ; MOV DX,BP ;MS. ;AN000; 256 ; PUSH BX ;MS. save handle ;AN000; 257 ; PUSH AX ;MS. save functions ;AN000; 258 ; MOV CX,1 ;MS. set one lock ;AN000; 259 ;if installed ;AN000; 260 ; Call JShare + 6 * 4 ;MS. call share set block ;AN000; 261 ;else ;AN000; 262 ; Call Set_Block ;MS. ;AN000; 263 ;endif ;AN000; 264 ; POP AX ;MS. restore regs ;AN000; 265 ; POP BX ;MS. ;AN000; 266 ; POP CX ;MS. ;AN000; 267 ; POP DX ;MS. ;AN000; 268 ; POP DS ;MS. ;AN000; 269 ; return ;MS. ;AN000; 270 ; ;AN000; 271 ;EndProc Set_Lock ;AN000; 272 273 BREAK 274 275 ; Input: 276 ; ES:DI = addr of SFT 277 ; CX = lock length 278 ; Function: 279 ; set up the lock buffer 280 ; Output: 281 ; Lock_Buffer is filled with position and lock length 282 ; BP = Lock_Buffer addr 283 ; 284 285 ; procedure Set_Lock_Buffer,NEAR 286 ;ASSUME DS:NOTHING,ES:NOTHING 287 ; 288 ; MOV BP, OFFSET Lock_Buffer wrt DOSGROUP ;MS. move file position ;AN000; 289 ; MOV SI,WORD PTR [ES:DI.sf_position] ;MS. to DOS lock_buffer ;AN000; 290 ; MOV WORD PTR [BP.Lock_position],SI ;MS. ;AN000; 291 ; MOV SI,WORD PTR [ES:DI.sf_position+2] ;MS. ;AN000; 292 ; MOV WORD PTR [BP.Lock_position+2],SI ;MS. ;AN000; 293 ; MOV WORD PTR [BP.Lock_length],CX ;MS. move cx to lock_buffer ;AN000; 294 ; MOV WORD PTR [BP.Lock_length+2],0 ;MS. ;AN000; 295 ; return ;MS. ;AN000; 296 ; 297 ;EndProc Set_Lock_Buffer 298 299 ; Inputs: 300 ; Outputs of SETUP 301 ; [USER_ID] Set 302 ; [PROC_ID] Set 303 ; Function: 304 ; Check for lock violations on local I/O 305 ; Retries are attempted with sleeps in between 306 ; Outputs: 307 ; Carry clear 308 ; Operation is OK 309 ; Carry set 310 ; A lock violation detected 311 ; Outputs of SETUP preserved 312 313 procedure LOCK_CHECK,NEAR 313 ****************** warning: proc LOCK_CHECK... [-w+user] 314 DOSAssume CS,,"Lock_Check" 315 ASSUME ES:NOTHING 316 0 00007AD5 8B1E[0000] MOV BX,[RetryCount] ; Number retries 318 LockRetry: 0 00007AD9 5350 SaveReg ; MS. save regs ;AN000; 320 %if installed 0 00007ADB FF1E[2000] call far [JShare + 8 * 4] 322 %else 323 Call chk_block 324 %endif 0 00007ADF 585B RestoreReg ; MS. restrore regs ;AN000; 0 00007AE1 7201C3 retnc ; There are no locks 0 00007AE4 E8[0000] Invoke Idle ; wait a while 0 00007AE7 4B DEC BX ; remember a retry 0 00007AE8 75EF JNZ LockRetry ; more retries left... 0 00007AEA F9 STC 0 00007AEB C3 return 332 EndProc LOCK_CHECK 333 334 ; Inputs: 335 ; [THISDPB] set 336 ; [READOP] indicates whether error on read or write 337 ; Function: 338 ; Handle Lock violation on compatibility (FCB) mode SFTs 339 ; Outputs: 340 ; Carry set if user says FAIL, causes error_lock_violation 341 ; Carry clear if user wants a retry 342 ; 343 ; DS, ES, DI, CX preserved, others destroyed 344 345 procedure LOCK_VIOLATION,NEAR 345 ****************** warning: proc LOCK_VIOLATION... [-w+user] 346 DOSAssume CS,,"Lock_Violation" 347 ASSUME ES:NOTHING 348 0 00007AEC 1E PUSH DS 0 00007AED 06 PUSH ES 0 00007AEE 57 PUSH DI 0 00007AEF 51 PUSH CX 0 00007AF0 B82100 MOV AX,error_lock_violation 354 allowed_FAIL equ Allowed_FAIL ; NASM port equate 355 allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 00007AF3 C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00007AF8 C42E[0000] LES BP,[THISDPB] 0 00007AFC BF0100 MOV DI,1 ; Fake some registers 0 00007AFF 89F9 MOV CX,DI 0 00007B01 268B560B MOV DX,[ES:BP + dpb_first_sector] 0 00007B05 E8[0000] invoke HARDERR_DOS 0 00007B08 59 POP CX 0 00007B09 5F POP DI 0 00007B0A 07 POP ES 365 assume es:nothing 0 00007B0B 1F POP DS 367 assume ds:DOSGROUP 0 00007B0C 3C01 CMP AL,1 0 00007B0E 74DB retz ; 1 = retry, carry clear 0 00007B10 F9 STC 0 00007B11 C3 return 372 373 EndProc LOCK_VIOLATION 374 375 %IF INSTALLED 376 ; 377 ; do a retz to return error 378 ; 379 Procedure CheckShare,NEAR 379 ****************** warning: proc CheckShare... [-w+user] 380 ASSUME ES:NOTHING,DS:NOTHING,SS:DOSGROUP 0 00007B12 36803E[0000]00 CMP byte [ss:fShare],0 0 00007B18 C3 return 383 EndProc CheckShare 384 %ENDIF 385 386 END === Trace listing source: ../DOS/share.lst 1 ; SCCSID = @(#)share.asm 1.1 85/04/10 2 ;TITLE SHARING ROUTINES - Routines for file Sharing 3 ;NAME SHARE 4 5 %include "dosseg.nas" 1 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 2 <1> ; SCCSID = @(#)dosseg.asm 1.1 85/04/10 3 <1> ; 4 <1> ; segment ordering for MSDOS 5 <1> ; 6 <1> 7 <1> %include "ddataseg.nas" 1 <2> 2 <2> %include "lmacros3.mac" 1 <3> [list -] 1 ****************** <3> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 6 === Switch to base=002450h -> "DOSCODECODE" 7 section DOSCODECODE 8 9 [list -] 9 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 9 ****************** warning: out: BPB.INC... [-w+user] 9 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 9 ****************** warning: out: DEVSYM.INC... [-w+user] 15 16 %ifndef IBM 17 %iassign IBM 0 18 %endif 19 %ifndef Installed 20 %iassign Installed 0 21 %endif 22 23 True equ TRUE ; NASM port equate 24 %iassign Installed True 25 26 i_need THISDPB,DWORD 27 i_need EXTERR,WORD 28 i_need ReadOp,BYTE 29 i_need ThisSFT,DWORD 30 i_need ALLOWED,BYTE 31 I_need RetryCount,WORD 32 i_need JShare,DWORD 33 34 assume nocheck, ss:DOSGROUP 35 36 ; Inputs: 37 ; [THISSFT] Points to filled in local file/device SFT for new 38 ; instance of file sf_mode ALWAYS has mode (even on FCB SFTs) 39 ; [WFP_START] has full path of name 40 ; [USER_ID] Set 41 ; [PROC_ID] Set 42 ; Function: 43 ; Check for sharing violations on local file/device access 44 ; Outputs: 45 ; Carry clear 46 ; Sharing approved 47 ; Carry set 48 ; A sharing violation detected 49 ; AX is error code 50 ; USES ALL but DS 51 52 procedure SHARE_CHECK,NEAR 52 ****************** warning: proc SHARE_CHECK... [-w+user] 53 DOSAssume CS,,"Share_Check" 54 ASSUME ES:NOTHING 55 56 %if installed 0 00007B19 FF1E[0400] call far [JShare + 1 * 4] 58 %else 59 Call MFT_Enter 60 %endif 0 00007B1D C3 return 62 63 EndProc SHARE_CHECK 64 65 ; Inputs: 66 ; [THISDPB] Set 67 ; AX has error code 68 ; Function: 69 ; Handle Sharing errors 70 ; Outputs: 71 ; Carry set if user says FAIL, causes error_sharing_violation 72 ; Carry clear if user wants a retry 73 ; 74 ; DS, ES, DI preserved, others destroyed 75 76 procedure SHARE_VIOLATION,NEAR 76 ****************** warning: proc SHARE_VIOLATION... [-w+user] 77 DOSAssume CS,,"Share_Violation" 78 ASSUME ES:NOTHING 79 0 00007B1E 1E PUSH DS 0 00007B1F 06 PUSH ES 0 00007B20 57 PUSH DI 83 READOP equ ReadOp ; NASM port label 0 00007B21 C606[0000]00 MOV byte [READOP],0 ; All share errors are reading 85 allowed_FAIL equ Allowed_FAIL ; NASM port equate 86 allowed_RETRY equ Allowed_RETRY ; NASM port equate 0 00007B26 C606[0000]18 MOV byte [ALLOWED],allowed_FAIL + allowed_RETRY 0 00007B2B C42E[0000] LES BP,[THISDPB] 0 00007B2F BF0100 MOV DI,1 ; Fake some registers 0 00007B32 89F9 MOV CX,DI 0 00007B34 268B5611 MOV DX,[ES:BP + dpb_dir_sector] 0 00007B38 E8[0000] invoke HARDERR_DOS 0 00007B3B 5F POP DI 0 00007B3C 07 POP ES 95 assume es:nothing 0 00007B3D 1F POP DS 97 assume ds:DOSGROUP 0 00007B3E 3C01 CMP AL,1 0 00007B40 74DB retz ; 1 = retry, carry clear 0 00007B42 F9 STC 0 00007B43 C3 return 102 103 EndProc SHARE_VIOLATION 104 105 ; ShareEnd - terminate sharing info on a particular SFT/UID/PID. This does 106 ; NOT perform a close, it merely asserts that the sharing information 107 ; for the SFT/UID/PID may be safely released. 108 ; 109 ; Inputs: ES:DI points to an SFT 110 ; Outputs: None 111 ; Registers modified: all except DS,ES,DI 112 113 procedure ShareEnd,Near 113 ****************** warning: proc ShareEnd... [-w+user] 114 DOSAssume CS,,"ShareEnd" 115 ASSUME ES:NOTHING 116 117 %if installed 0 00007B44 FF1E[0800] Call far [JShare + 2 * 4] 119 %else 120 Call MFTClose 121 %endif 0 00007B48 C3 return 123 124 EndProc ShareEnd 125 126 break 127 128 ; 129 ; ShareEnter - perform a retried entry of a nodde into the sharing set. If 130 ; the max number of retries is exceeded, we notify the user via int 24. 131 ; 132 ; Inputs: ThisSFT points to the SFT 133 ; WFP_Start points to the WFP 134 ; Outputs: Carry clear => successful entry 135 ; Carry set => failed system call 136 ; Registers modified: all 137 138 Procedure ShareEnter,NEAR 138 ****************** warning: proc ShareEnter... [-w+user] 139 DOSAssume CS,,"ShareEnter" 140 assume es:nothing 141 0 00007B49 51 SaveReg 143 .retry: 0 00007B4A 8B0E[0000] mov cx,[RetryCount] 145 .attempt: 0 00007B4E C43E[0000] les di,[ThisSFT] ; grab sft 0 00007B52 31C0 XOR AX,AX 0 00007B54 26894533 MOV [ES:DI + sf_MFT],AX ; indicate free SFT 0 00007B58 51 SaveReg 150 Share_Check equ SHARE_CHECK ; NASM port label 0 00007B59 E8BDFF call Share_Check ; attempt to enter into the sharing set 0 00007B5C 59 RestoreReg 0 00007B5D 730A jnc .done ; success, let the user see this 0 00007B5F E8[0000] invoke Idle ; wait a while 0 00007B62 E2EA loop .attempt ; go back for another attempt 156 Share_violation equ SHARE_VIOLATION ; NASM port label 0 00007B64 E8B7FF call Share_violation ; signal the problem to the user 0 00007B67 73E1 jnc .retry ; user said to retry, go do it 159 .done: 0 00007B69 59 RestoreReg 0 00007B6A C3 return 162 EndProc ShareEnter 163 164 END === Trace listing source: ../DOS/extattr.lst 1 ;TITLE EXTATTR- Extended Attributes 2 ;NAME EXTATTR 3 ; 4 ; Get or Set Extended Attributes by handle 5 ; 6 ; 7 ; GetSetEA 8 ; Set_Output 9 ; Search_EA 10 ; Copy_QEA 11 ; Set_one_EA 12 ; Get_one_EA 13 ; Get_Value 14 ; GSetDevCdpg 15 ; Get_max_EA_size 16 ; 17 ; Revision history 18 ; 19 ; A000 version 4.00 Jan. 1988 20 ; 21 ; 22 ; 23 ; 24 ; 25 ; 26 ; 27 28 [list -] 28 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 34 35 [list +] === Switch to base=002450h -> "DOSCODECODE" 36 section DOSCODECODE 37 [list -] 37 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 37 ****************** warning: out: BPB.INC... [-w+user] 37 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 37 ****************** warning: out: DEVSYM.INC... [-w+user] 45 ;.sall 46 47 48 ; I_need XA_from,BYTE ;AN000; 49 50 ; I_need XA_TABLE,BYTE ;AN000; 51 ; I_need XA_TEMP,WORD ;AN000; 52 ; I_need XA_COUNT,WORD ;AN000; 53 ; I_need XA_DEVICE,BYTE ;AN000; 54 I_need XA_TYPE,BYTE ;AN000; 55 I_need SAVE_ES,WORD ;AN000; 56 I_need SAVE_DI,WORD ;AN000; 57 I_need SAVE_DS,WORD ;AN000; 58 I_need SAVE_SI,WORD ;AN000; 59 I_need SAVE_CX,WORD ;AN000; 60 I_need SAVE_BX,WORD ;AN000; 61 ; I_need XA_handle,WORD ;AN000; 62 ; I_need CPSWFLAG,BYTE ;AN000; 63 ; I_need XA_PACKET,BYTE ;AN000; 64 ; I_need MAX_EA_SIZE,WORD ;AN000; 65 ; I_need MAX_EANAME_SIZE,WORD ;AN000; 66 ; I_need THISSFT,DWORD ;AN000; 67 ;IF DBCS ;AN000; 68 ; I_need DBCS_PACKET,BYTE ;AN000; ;AN000; 69 ;ENDIF ;AN000; ;AN000; 70 ;AN000; 71 ;AN000; 72 ;AN000; 73 ;AN000; 74 ;AN000; 75 BREAK ;AN000; 76 ;AN000; 77 ; Input: [XA_type] = function code, (e.g., get,set) ;AN000; 78 ; [ThisSFT] points to SFT ;AN000; 79 ; ES:BP points to drive parameter block ;AN000; 80 ; [XA_from] = By_Create or By_EA ;AN000; 81 ; [SAVE_ES]:[SAVE_DI] points to get/set list ;AN000; 82 ; [SAVE_DS]:[SAVE_SI] points to get query list ;AN000; 83 ; [SAVE_CX] = size of buffer 84 ; [XA_device]= 1 device, 0 file ;AN000; 85 ; [XA_handle] for device ;AN000; 86 ; Function: Get or Set extended attributes by handle ;AN000; 87 ; Output: carry set: error ;AN000; 88 ; carry clear: extended attributes are successfully get/set ;AN000; 89 ; extended attribute cluster may be created ;AN000; 90 ; ;AN000; 91 ; ;AN000; 92 ; ;AN000; 93 ;AN000; 94 ;AN000; 95 procedure GetSet_XA,near ;AN000; 95 ****************** warning: proc GetSet_XA... [-w+user] 96 ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP 97 98 0 00007B6B 36C43E[0000] LES DI,[ss:SAVE_DI] ;AN000;;FT. ES:DI -> query list 100 ;; MOV [SAVE_BX],2 ;AN000;;FT. size returned 101 ;; XOR DX,DX ;AN000;;FT. dx=0, codepage id 102 103 XA_type equ XA_TYPE ; NASM port label 0 00007B70 36803E[0000]02 CMP byte [ss:XA_type],2 ;AN000;;FT. get EA ? 0 00007B76 7526 JNZ eaname ;AN000;;FT. no 106 getEAs: ;AN000; 0 00007B78 36833E[0000]00 CMP word [ss:SAVE_CX],0 ;AN000;;FT. get max data size 0 00007B7E 7508 JNZ notmax ;AN000;;FT. no 109 ;; CALL Get_max_EA_size ;AN000;;FT. 110 0 00007B80 B90200 MOV CX,2 ;AN000;;FT. FAKE FAKE.............. 0 00007B83 732F JNC set_user_cx ;AN000;;FT. 0 00007B85 EB39 JMP OKexit ;AN000;;FT. error 0 00007B87 90 nop ; identicalise 115 notmax: 0 00007B88 36833E[0000]01 CMP word [ss:SAVE_CX],1 ;AN000;;FT. buffer size =1 ? 0 00007B8E 7503 JNZ goodsiz ;AN000;;FT. no 118 extattr_errout: ;AN000; 0 00007B90 EB2E JMP insuff_space ;AN000;;FT. no error 0 00007B92 90 nop ; identicalise 121 goodsiz: ;AN000; 0 00007B93 26C7050000 MOV WORD PTR [ES:DI],0 ;AN000;FT. FAKE FAKE ............... 0 00007B98 B90200 MOV CX,2 ;AN000;FT. FAKE FAKE ............... 0 00007B9B EB17 JMP set_user_cx ;AN000;FT. FAKE FAKE ............... 0 00007B9D 90 nop ; identicalise 126 127 ; SUB [SAVE_CX],2 ;AN000;;FT. minus count size 128 ; CMP [SAVE_SI],-1 ;AN000;;FT. get all ? 129 ; JNZ getsome ;AN000;;FT. no 130 ; PUSH CS ;AN000;;FT. ds:si-> EA entry addr 131 ; POP DS ;AN000;;FT. 132 ; INC DI ;AN000;;FT. 133 ; INC DI ;AN000;;FT. es:di -> address after count 134 ; MOV SI,OFFSET XA_TABLE wrt DOSGROUP ;AN000;FT. 135 ; MOV CX,XA_COUNT ;AN000;;FT. cx= number of EA entries 136 ;;;;;; 137 ;getone: 138 ; CALL GET_ONE_EA ;AN000;;FT. get EA 139 ; JC setout ;AN000;;FT. insufficient memory 140 ; INC DX ;AN000;;FT. next EA ID 141 ; LOOP getone ;AN000;;FT. next one 142 ;setout: ;AN000; 143 ; CALL Set_Output ;AN000;;FT. 144 ; OR CX,CX ;AN000;;FT. 145 ; JNZ extattr_errout ;AN000;;FT. 146 ; 147 ; JMP OKexit ;AN000;;FT. 148 eaname: 0 00007B9E 36803E[0000]03 CMP byte [ss:XA_type],3 ;AN000;;FT. get EA name?` 0 00007BA4 7403 JZ geteaname ;AN000;;FT. yes 0 00007BA6 EB15 JMP setea ;AN000;;FT. 0 00007BA8 90 nop ; identicalise 153 geteaname: 154 ; MOV [SAVE_SI],-1 ;AN000;;FT. make get all 0 00007BA9 36833E[0000]00 CMP word [ss:SAVE_CX],0 ;AN000;;FT. get max data size 0 00007BAF 75D7 JNZ notmax ;AN000;;FT. no 0 00007BB1 B90200 MOV CX,2 ;AN000;;FT. FAKE FAKE ...................... 158 ;; MOV CX,[MAX_EANAME_SIZE] ;AN000;;FT. get name size 159 set_user_cx: ;AN000; 0 00007BB4 E8[0000] invoke get_user_stack ;AN000;;FT. get user stack 0 00007BB7 894C04 MOV [SI + user_CX],CX ;AN000;;FT. 0 00007BBA EB04 JMP OKexit ;AN000;;FT. exit 0 00007BBC 90 nop ; identicalise 164 165 getsome: ;AN000; 166 ; LDS SI,DWORD PTR [SAVE_SI] ;AN000;;FT. 167 ; LODSW ;AN000;;FT. 168 ; MOV CX,AX ;AN000;;FT. cx=number of query entries 169 ; JCXZ setout ;AN000;;FT. yes 170 ; STOSW ;AN000;;FT. es:di -> EA 171 ;get_next_EA: ;AN000; 172 ; PUSH DS ;AN000;;FT. save ds:si 173 ; PUSH SI ;AN000;;FT. es:di 174 ; PUSH ES ;AN000;;FT. 175 ; PUSH DI ;AN000;;FT. 176 ; CALL Search_EA ;AN000;;FT. search query EA from table 177 ; JC EAnotFound ;AN000;;FT. EA not found 178 ; PUSH ES ;AN000;;FT. 179 ; POP DS ;AN000;;FT. 180 ; MOV SI,DI ;AN000;;FT. ds:si -> found EA 181 ; POP DI ;AN000;;FT. es:di -> buffer 182 ; POP ES ;AN000;;FT. 183 ; CALL GET_ONE_EA ;AN000;;FT. copy to buffer 184 ; POP SI ;AN000;;FT. 185 ; POP DS ;AN000;;FT. 186 ; JC setfinal ;AN000;;FT. memory not enough 187 ; MOV AL,[SI.QEA_NAMELEN] ;AN000;;FT. 188 ; XOR AH,AH ;AN000;;FT. 189 ; ADD AX,QEA_NAME ;AN000;;FT. 190 ; ADD SI,AX ;AN000;;FT. ds:si -> next query entry 191 ;testend: ;AN000; 192 ; LOOP get_next_EA ;AN000;;FT. do next 193 ;setfinal: ;AN000; 194 ; LDS SI,DWORD PTR [SAVE_SI] ;AN000;;FT. 195 ; MOV DX,[SI] ;AN000;;FT. 196 ; SUB DX,CX ;AN000;;FT. dx= returned count 197 ; JMP setout ;AN000;;FT. 198 ;EAnotFound: ;AN000; 199 ; POP DI ;AN000;;FT. restore regs 200 ; POP ES ;AN000;;FT. 201 ; POP SI ;AN000;;FT. 202 ; POP DS ;AN000;;FT. 203 ; 204 ; CALL COPY_QEA ;AN000;;FT. copy query EA to buffer 205 ; JC setfinal ;AN000;;FT. not enough memory 206 ; JMP testend ;AN000;;FT. 207 setea: ;AN000; 0 00007BBD EB01 JMP OKexit ;AN000;;FT. FAKE FAKE .......... 0 00007BBF 90 nop ; identicalise 210 ; LDS SI,DWORD PTR [SAVE_DI] ;AN000;;FT. 211 ; LODSW ;AN000;;FT. 212 ; MOV CX,AX ;AN000;;FT. cx=number of query entries 213 ; OR CX,CX ;AN000;;FT. cx=0 ? 214 ; JZ OKexit ;AN000;;FT. yes 215 ;set_next: ;AN000; 216 ; CALL Search_EA ;AN000;;FT. 217 ; JNC toset ;AN000;;FT. 218 ;set_reason: ;AN000; 219 ; CLC ;AN000;;FT. clear acrry 220 ; MOV [SI.EA_RC],AL ;AN000;;FT. set reason code 221 ; DEC CX ;AN000;;FT. end of set ? 222 ; JZ OKexit ;AN000;;FT. yes 223 224 ; MOV AL,[SI.EA_NAMELEN] ;AN000;;FT. 225 ; XOR AH,AH ;AN000;;FT. 226 ; ADD AX,[SI.EA_VALLEN] ;AN000;;FT. 227 ; ADD SI,EA_NAME ;AN000;;FT. 228 ; ADD SI,AX ;AN000;;FT. es:di -> next EA entry 229 ; JMP set_next ;AN000;;FT. 230 ;toset: ;AN000; 231 ; CALL SET_ONE_EA ;AN000;;FT. set it 232 ; JMP set_reason ;AN000;;FT. 233 insuff_space: ;AN000;;FT. 234 ; MOV AX,error_not_enough_memory ;AN000;FT. insufficient memory err 235 ; STC ;AN000; 236 OKexit: ;AN000; 0 00007BC0 C3 return ;AN000; 238 239 EndProc GetSet_XA ;AN000; 240 241 242 ; Input: [SAVE_ES]:[SAVE_DI] points to buffer 243 ; [SAVE_BX]= returned size 244 ; DX= returned count 245 ; Function: set returned size and count ;AN000; 246 ; Output: none 247 ;AN000; 248 ;procedure Set_Output,NEAR ;AN000; 249 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 250 ; ;AN000; 251 ; LES DI,DWORD PTR [SAVE_DI] ;FT. es:di -> count ;AN000; 252 ; MOV [ES:DI],DX ;FT. ;AN000; 253 ; MOV BX,[SAVE_BX] ;FT. cx=size returned ;AN000; 254 ; invoke get_user_stack ;FT. get user stack ;AN000; 255 ; MOV [SI.user_CX],BX ;FT. ;AN000; 256 ; return ;FT. ;AN000; 257 ; ;AN000; 258 ;EndProc Set_Output ;AN000; 259 260 261 ; Input: DS:SI= query EA addr ;AN000; 262 ; Function: search the EA ;AN000; 263 ; Output: carry clear 264 ; DX= EA ID (0 codpage, 1 Filetype, etc.) 265 ; ES:DI points to found entry 266 ; carry set, not found, AL= reason code ;AN000; 267 ;AN000; 268 ;procedure Search_EA,NEAR ;AN000; 269 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 270 ; ;AN000; 271 ; PUSH CX ;FT. save entry count ;AN000; 272 ; MOV AL,EARCNOTFOUND ;FT. preset error code ;AN000; 273 ; MOV BL,[SI.QEA_NAMELEN] ;FT. ? ;AN000; 274 ; CMP [XA_TYPE],4 ;FT. set ? ;AN000; 275 ; JNZ gettyp ;FT. no ;AN000; 276 ; MOV BL,[SI.EA_NAMELEN] ;FT. ? ;AN000; 277 ;gettyp: 278 ; OR BL,BL ;FT. ;AN000; 279 ; JZ not_found ;FT. ;AN000; 280 ; PUSH CS ;FT. ds:si-> EA entry addr ;AN000; 281 ; POP ES ;FT. ;AN000; 282 ; MOV DI,OFFSET XA_TABLE wrt DOSGROUP ;FT. ;AN000; 283 ; MOV CX,XA_COUNT ;FT. cx= number of EA entries ;AN000; 284 ; XOR DX,DX ;FT. dx=0, codepage id ;AN000; 285 ; 286 ;start_find: 287 ; PUSH CX ;FT. save entry count ;AN000; 288 ; MOV CL,BL ;FT. ;AN000; 289 ; XOR CH,CH ;FT. get name len ;AN000; 290 ; PUSH SI ;FT. ;AN000; 291 ; PUSH DI ;FT. ;AN000; 292 ; CMP [XA_TYPE],4 ;FT. set ? ;AN000; 293 ; JNZ gettyp2 ;FT. no ;AN000; 294 ; ADD SI,EA_NAME ;FT. ;AN000; 295 ; JMP short updi ;FT. ;AN000; 296 ;gettyp2: 297 ; ADD SI,QEA_NAME ;FT. compare EA names ;AN000; 298 ;updi: 299 ; ADD DI,EA_NAME ;FT. ;AN000; 300 ; REP CMPSB ;FT. ;AN000; 301 ; POP DI ;FT. ;AN000; 302 ; POP SI ;FT. ;AN000; 303 ; POP CX ;FT. ;AN000; 304 ; JNZ not_matched ;FT. name not matched ;AN000; 305 ; MOV AL,EARCDEFBAD ;FT. preset error code ;AN000; 306 ; PUSH SI ;FT. ;AN000; 307 ; PUSH DI ;FT. ;AN000; 308 ; CMPSB ;FT. compare type ;AN000; 309 ; JNZ not_matched2 ;FT. type not matched ;AN000; 310 ; CMPSW ;FT. compare flags ;AN000; 311 ; JNZ not_matched2 ;FT. flag not matched ;AN000; 312 ; POP DI ;FT. ;AN000; 313 ; POP SI ;FT. found one ;AN000; 314 ; JMP SHORT found_one ;FT. ;AN000; 315 ;not_matched: 316 ; DEC CX ;FT. end of table ;AN000; 317 ; JZ not_found ;FT. yes ;AN000; 318 ; MOV AL,[ES:DI.EA_NAMELEN] ;FT. ;AN000; 319 ; XOR AH,AH ;FT. ;AN000; 320 ; 321 ; ADD DI,EA_NAME ;FT. ;AN000; 322 ; ADD DI,AX ;FT. es:di -> next EA entry ;AN000; 323 ; INC DX ;FT. increment EA ID ;AN000; 324 ; JMP start_find ;FT. ;AN000; 325 ;not_matched2: 326 ; POP DI ;FT. ;AN000; 327 ; POP SI ;FT. ;AN000; 328 ; JMP not_matched ;FT. ;AN000; 329 ;not_found: 330 ; STC ;FT. ;AN000; 331 ;found_one: 332 ; POP CX ;FT. ;AN000; 333 ; return ;FT. ;AN000; 334 ;AN000; 335 ;EndProc Search_EA ;AN000; 336 ;AN000; 337 ; Input: ES:DI= buffer address ;AN000; 338 ; DS:SI= EA entry address 339 ; [SAVE_CX]= buffer size 340 ; AL = reason code 341 ; Function: move one query entry to buffer ;AN000; 342 ; Output: carry clear 343 ; DS:SI points to next entry 344 ; ES:DI points to next entry 345 ; [SAVE_CX],[SAVE_BX], updated ;AN000; 346 ; carry set, insufficient memory error ;AN000; 347 ;AN000; 348 ;procedure COPY_QEA,NEAR ;AN000; 349 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 350 ; ;AN000; 351 ; PUSH CX ;FT. ;AN000; 352 ; MOV DL,AL ;FT. ;AN000; 353 ; MOV CX,EA_NAME -EA_TYPE ;FT. ;AN000; 354 ; 355 ; MOV BL,[SI.QEA_NAMELEN] ;FT. ;AN000; 356 ; XOR BH,BH ;FT. ;AN000; 357 ; ADD CX,BX ;FT. cx= query EA size ;AN000; 358 ; CMP CX,[SAVE_CX] ;FT. > buffer size ;AN000; 359 ; JA sizeshort2 ;FT. yes ;AN000; 360 ; PUSH CX ;FT. ;AN000; 361 ; LODSB ;FT. move type ;AN000; 362 ; STOSB ;FT. ;AN000; 363 ; LODSW ;FT. ;AN000; 364 ; STOSW ;FT. move flag ;AN000; 365 ; MOV AL,DL ;FT. move RC ;AN000; 366 ; STOSB ;FT. ;AN000; 367 ; 368 ; LODSB ;FT. move name len ;AN000; 369 ; MOV CL,AL ;FT. ;AN000; 370 ; STOSB ;FT. ;AN000; 371 ; XOR AX,AX ;FT. zero value length ;AN000; 372 ; STOSW ;FT. ;AN000; 373 ; OR CL,CL ;FT. ;AN000; 374 ; JZ zeroname ;FT. ;AN000; 375 ; XOR CH,CH ;FT. ;AN000; 376 ; 377 ; REP MOVSB ;FT. move EA to buffer ;AN000; 378 ;zeroname: 379 ; POP CX ;FT. ;AN000; 380 ; ADD [SAVE_BX],CX ;FT. bx=bx+entry size ;AN000; 381 ; SUB [SAVE_CX],CX ;FT. update buffer size ;AN000; 382 ; CLC ;FT. ;AN000; 383 ; JMP SHORT okget2 ;FT. ;AN000; 384 ; 385 ;sizeshort2: 386 ; MOV AX,error_not_enough_memory ;FT. error ;AN000; 387 ; STC ;FT. ;AN000; 388 ;okget2: 389 ; POP CX ;FT. ;AN000; 390 ; return ;FT. ;AN000; 391 ; ;AN000; 392 ;EndProc COPY_QEA ;AN000; 393 ;AN000; 394 ; Input: ES:DI= found EA entry addr ;AN000; 395 ; DS:SI= source EA entry address 396 ; DX= EA ID (0 codpage, 1 Filetype, etc.) 397 ; Function: set one EA ;AN000; 398 ; Output: carry clear 399 ; EA set 400 ; carry set, AL= reason code ;AN000; 401 ;AN000; 402 ;procedure SET_ONE_EA,NEAR ;AN000; 403 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 404 ; ;AN000; 405 ; PUSH CX ;FT. ;AN000; 406 ; MOV AL,EARCDEFBAD ;FT. prseet error code ;AN000; 407 ; MOV BX,[SI.EA_VALLEN] ;FT. ;AN000; 408 ; CMP BX,[ES:DI.EA_VALLEN] ;FT. length equal ? ;AN000; 409 ; JNZ notset ;FT. no ;AN000; 410 ; PUSH DS ;FT. ;AN000; 411 ; PUSH SI ;FT. ;AN000; 412 ; MOV AL,[SI.EA_NAMELEN] ;FT. ;AN000; 413 ; XOR AH,AH ;FT. ;AN000; 414 ; ADD SI,EA_NAME ;FT. ;AN000; 415 ; ADD SI,AX ;FT. ;AN000; 416 ; CMP DX,0 ;FT. ;AN000; 417 ; JNZ set_filetyp ;FT. ;AN000; 418 ; LODSW ;FT. ;AN000; 419 ; CMP [XA_DEVICE],0 ;FT. device ? ;AN000; 420 ; JZ notdevice ;FT. no ;AN000; 421 ; OR AX,AX ;FT. code page 0 ? ;AN000; 422 ; JZ NORM0 ;FT. yes ;AN000; 423 ; 424 ; CALL GSetDevCdPg ;FT. ;AN000; 425 ; JNC welldone ;FT. ;AN000; 426 ; CMP [CPSWFLAG],0 ;FT. code page matching on ;AN000; 427 ; JZ NORM0 ;FT. no ;AN000; 428 ; invoke SAVE_WORLD ;FT. save all regs ;AN000; 429 ; LDS SI,[THISSFT] ;FT. ds:si -> sft ;AN000; 430 ; LDS SI,[SI.sf_devptr] ;FT. ds:si -> device header ;AN000; 431 ; MOV BP,DS ;FT. save all regs ;AN000; 432 ; invoke Code_Page_Mismatched_Error ;FT. ;AN000; 433 ; CMP AL,0 ;FT. ignore ? ;AN000; 434 ; JZ NORM1 ;FT. ;AN000; 435 ; invoke RESTORE_WORLD ;FT. save all regs ;AN000; 436 ;NORM0: 437 ; MOV AL,EARCDEVERROR ;FT. ;AN000; 438 ; STC ;FT. ;AN000; 439 ; JMP SHORT sdone ;FT. ;AN000; 440 ;NORM1: 441 ; invoke RESTORE_WORLD ;FT. save all regs ;AN000; 442 ; JMP SHORT welldone ;FT. ;AN000; 443 ;notdevice: 444 ; LDS SI,[THISSFT] ;FT. ;AN000; 445 ; MOV [SI.sf_CodePage],AX ;FT. set codepege ;AN000; 446 ; JMP SHORT welldone ;FT. 447 ;set_filetyp: 448 ; LODSB ;FT. ;AN000; 449 ; LDS SI,[THISSFT] ;FT. set filtype ;AN000; 450 ; MOV [SI.sf_ATTR_HI],AL ;FT. ;AN000; 451 ; 452 ;welldone: 453 ; XOR AL,AL ;FT. success ;AN000; 454 ;sdone: 455 ; POP SI ;FT. ;AN000; 456 ; POP DS ;FT. ;AN000; 457 ;notset: 458 ; POP CX ;FT. ;AN000; 459 ; return ;FT. ;AN000; 460 ;AN000; 461 ;EndProc SET_ONE_EA ;AN000; 462 ;AN000; 463 ; Input: ES:DI= buffer address ;AN000; 464 ; DS:SI= EA entry address 465 ; [SAVE_CX]= buffer size available 466 ; [SAVE_BX]= size returned 467 ; DX= EA ID (0 codpage, 1 Filetype, etc.) 468 ; Function: move one EA entry to the buffer ;AN000; 469 ; Output: carry clear 470 ; DS:SI points to next entry 471 ; ES:DI points to next entry 472 ; [SAVE_CX],BX, updated ;AN000; 473 ; carry set, insufficient memory error ;AN000; 474 ;AN000; 475 ;procedure GET_ONE_EA,NEAR ;AN000; 476 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 477 ; ;AN000; 478 ; PUSH CX ;FT. ;AN000; 479 ; CMP [XA_TYPE],2 ;FT. type 2 ? ;AN000; 480 ; JZ gtyp2 ;FT. yes ;AN000; 481 ; MOV CX,QEA_NAME - QEA_TYPE ;FT. ;AN000; 482 ; JMP SHORT addnmlen ;FT. 483 ;gtyp2: 484 ; MOV CX,EA_NAME - EA_TYPE ;FT. cx = EA entry size ;AN000; 485 ; ADD CX,[SI.EA_VALLEN] ;FT. ;AN000; 486 ;addnmlen: 487 ; MOV AL,[SI.EA_NAMELEN] ;FT. 488 ; XOR AH,AH ;FT. ;AN000; 489 ; ADD CX,AX ;FT. ;AN000; 490 ; CMP CX,[SAVE_CX] ;FT. > buffer size ;AN000; 491 ; JA sizeshort ;FT. yes ;AN000; 492 ; PUSH CX ;FT. ;AN000; 493 ; LODSB ;FT. move type ;AN000; 494 ; STOSB ;FT. ;AN000; 495 ; LODSW ;FT. ;AN000; 496 ; STOSW ;FT. move flag ;AN000; 497 ; LODSB ;FT. EA list need RC ;AN000; 498 ; CMP [XA_TYPE],2 ;FT. ;AN000; 499 ; JNZ norc ;FT. ;AN000; 500 ; STOSB ;FT. ;AN000; 501 ;norc: 502 ; LODSB ;FT. move name len ;AN000; 503 ; STOSB ;FT. ;AN000; 504 ; MOV CL,AL ;FT. ;AN000; 505 ; XOR CH,CH ;FT. ;AN000; 506 ; LODSW ;FT. EA list need value len ;AN000; 507 ; CMP [XA_TYPE],2 ;FT. ;AN000; 508 ; JNZ novalen ;FT. ;AN000; 509 ; STOSW ;FT. ;AN000; 510 ;novalen: 511 ; 512 ; REP MOVSB ;FT. move EA to buffer ;AN000; 513 ; CMP [XA_TYPE],2 ;FT. ;AN000; 514 ; JNZ novalue ;FT. ;AN000; 515 ; CALL GET_VALUE ;FT. get value for type 2 ;AN000; 516 ;novalue: 517 ; POP CX ;FT. ;AN000; 518 ; ADD [SAVE_BX],CX ;FT. add entry size ;AN000; 519 ; LES DI,DWORD PTR [SAVE_DI] ;FT. ;AN000; 520 ; ADD DI,[SAVE_BX] ;FT. es:di -> next entry ;AN000; 521 ; SUB [SAVE_CX],CX ;FT. update buffer size ;AN000; 522 ; CLC ;FT. ;AN000; 523 ; JMP SHORT okget ;FT. ;AN000; 524 ; 525 ;sizeshort: 526 ; MOV AX,error_not_enough_memory ;FT. error ;AN000; 527 ; STC ;FT. ;AN000; 528 ;okget: 529 ; POP CX ;FT. ;AN000; 530 ; return ;FT. ;AN000; 531 ; ;AN000; 532 ;EndProc GET_ONE_EA ;AN000; 533 ;AN000; 534 ;AN000; 535 ; Input: DX= EA ID (0 codpage, 1 Filetype, etc.) 536 ; [THISSFT]= points to SFT 537 ; ES:DI= buffer address of EA value 538 ; [XA_DEVICE]=0 file, 1 device 539 ; Function: get attribute ;AN000; 540 ; Output: none ;AN000; 541 ; ;AN000; 542 ;AN000; 543 ;procedure GET_VALUE,NEAR ;AN000; 544 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 545 ; ;AN000; 546 ; PUSH DS ;FT. save ds:si ;AN000; 547 ; PUSH SI ;FT. ;AN000; 548 ; LDS SI,[ThisSFT] ;FT. ds:si -> SFT ;AN000; 549 ; 550 ; CMP DX,0 ;FT. code page ? ;AN000; 551 ; JNZ eafiltyp ;FT. no ;AN000; 552 ; CMP [XA_DEVICE],0 ;FT. device ? ;AN000; 553 ; JZ notdev ;FT. no ;AN000; 554 ; CALL GSetDevCdPg ;FT. do ioctl invoke ;AN000; 555 ; JNC okcdpg ;FT. error ? ;AN000; 556 ; PUSH DI ;FT. ;AN000; 557 ; XOR AX,AX ;FT. make code page 0 ;AN000; 558 ; LES DI,DWORD PTR [SAVE_DI] ;FT. ;AN000; 559 ; ADD DI,[SAVE_BX] ;FT. es:di -> beginning of entry ;AN000; 560 ; MOV [ES:DI.EA_RC],EARCNOTFOUND ;FT. ;AN000; 561 ; POP DI ;FT. ;AN000; 562 ; JMP SHORT okcdpg ;FT. ;AN000; 563 ;notdev: 564 ; MOV AX,[SI.sf_CodePage] ;FT. get code page from sft ;AN000; 565 ;okcdpg: 566 ; STOSW ;FT. put in buffer ;AN000; 567 ; JMP SHORT gotea ;FT. ;AN000; 568 ;eafiltyp: 569 ; MOV AL,[SI.sf_ATTR_HI] ;FT. get high attribute ;AN000; 570 ; STOSB ;FT. put in buffer ;AN000; 571 ; 572 ;gotea: 573 ; POP SI ;FT. retore regs ;AN000; 574 ; POP DS ;FT. ;AN000; 575 ; return ;FT. ;AN000; 576 ;EndProc GET_VALUE ;AN000; 577 ;AN000; 578 ;AN000; 579 ; Input: [XA_handle] = device handle ;AN000; 580 ; [XA_type] = 4 , set ;AN000; 581 ; AX= code page (set) 582 ; 2,3 get ;AN000; 583 ; Function: get or set device code page ;AN000; 584 ; Output: carry clear, AX= device code page (get) ;AN000; 585 ; carry set, error ;AN000; 586 ;AN000; 587 ;procedure GSetDevCdPg,near ;AN000; 588 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 589 ; ;AN000; 590 ; invoke SAVE_WORLD ;FT. save all regs ;AN000; 591 ; CMP [XA_type],4 ;FT. set ? ;AN000; 592 ; JZ setpg ;FT. yes ;AN000; 593 ; MOV CX,6AH ;FT. get selected code page ;AN000; 594 ; JMP SHORT dogset ;FT. ;AN000; 595 ;setpg: ;AN000; 596 ; MOV CX,4AH ;FT. set code page ;AN000; 597 ;IF DBCS 598 ; 599 ; invoke Save_World ;FT. save all regs ;AN000; 600 ; MOV BX,AX ;FT. bx= code page id ;AN000; 601 ; MOV AL,7 ;FT. get DBCS vectors ;AN000; 602 ; MOV DX,-1 ;FT. get current country ;AN000; 603 ; MOV CX,5 ;FT. minimum size ;AN000; 604 ; MOV DI,OFFSET DBCS_PACKET wrt DOSGROUP ;FT. ;AN000; 605 ; PUSH CS ;FT. ;AN000; 606 ; POP ES ;FT. ;AN000; 607 ; invoke $GetExtCntry ;FT. get DBCS vectors ;AN000; 608 ; JC nlsfunc_err ;FT. error ;AN000; 609 ; LDS SI,DWORD PTR DBCS_PACKET+1 ;FT. ;AN000; 610 ; LODSW ;FT. get vector length ;AN000; 611 ; MOV CX,AX ;FT. cx=length ;AN000; 612 ; 613 ; MOV DI,OFFSET XA_PACKET+4 wrt DOSGROUP ;FT. ;AN000; 614 ; PUSH CS ;FT. ;AN000; 615 ; POP ES ;FT. ;AN000; 616 ; REP MOVSB ;FT. ;AN000; 617 ; CLC ;FT. ;AN000; 618 ;nlsfunc_err: 619 ; invoke RESTORE_WORLD ;FT. restore all regs ;AN000; 620 ; JC deverr ;FT. ;AN000; 621 ; 622 ;ENDIF 623 ; MOV WORD PTR [XA_PACKET+2],AX ;FT. ;AN000; 624 ;dogset: ;AN000; 625 ; MOV BX,[XA_handle] ;FT. set up handle ;AN000; 626 ; PUSH CS ;FT. ds:dx -> packet ;AN000; 627 ; POP DS ;FT. ;AN000; 628 ; MOV DX,OFFSET XA_PACKET wrt DOSGROUP ;FT. ;AN000; 629 ; MOV AX,440CH ;FT. IOCTL to char device by handle ;AN000; 630 ; invoke $IOCTL ;FT. issue get code page ;AN000; 631 ; JC deverr ;FT. error ;AN000; 632 ; invoke RESTORE_WORLD ;FT. restore all regs ;AN000; 633 ; MOV AX,WORD PTR [XA_PACKET+2] ;FT. get code page ;AN000; 634 ; return ;FT. ;AN000; 635 ;deverr: ;AN000; 636 ; invoke RESTORE_WORLD ;FT. restore all regs ;AN000; 637 ; return ;FT. exit ;AN000; 638 ; ;AN000; 639 ;EndProc GSetDevCdPg ;AN000; 640 ;AN000; 641 642 ; Input: DS:SI -> query list 643 ; 644 ; Function: get max size ;AN000; 645 ; Output: CX= size 646 ; carry set error 647 ;AN000; 648 ;procedure Get_max_EA_size,NEAR ;AN000; 649 ; ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:DOSGROUP ;AN000; 650 ; ;AN000; 651 ; CMP [SAVE_SI],0FFFFH ;FT. get all ? ;AN000; 652 ; JNZ scan_query ;FT. no ;AN000; 653 ; MOV CX,[MAX_EA_SIZE] ;FT. get max EA size ;AN000; 654 ; JMP SHORT gotit ;FT. 655 ;scan_query: 656 ; LDS SI,DWORD PTR [SAVE_SI] ;FT. ds:si -> query list ;AN000; 657 ; LODSW ;FT. ax= number of entries ;AN000; 658 ; MOV [SAVE_CX],AX ;FT. ;AN000; 659 ; XOR CX,CX ;FT. set initial size to 0 ;AN000; 660 ; OR AX,AX ;FT. if no entris ;AN000; 661 ; JZ gotit ;FT. then return ;AN000; 662 ; MOV CX,2 ;FT. at lesat 2 ;AN000; 663 ;NEXT_QEA: 664 ; CALL Search_EA ;FT. search EA ;AN000; 665 ; JC serror ;FT. wrong EA ;AN000; 666 ; ADD CX,size EA ;FT. get EA size ;AN000; 667 ; ADD CL,[ES:DI.EA_NAMELEN] ;FT. ;AN000; 668 ; ADC CH,0 ;FT. ;AN000; 669 ; ADD CX,[ES:DI.EA_VALLEN] ;FT. ;AN000; 670 ; DEC CX ;FT. ;AN000; 671 ; DEC [SAVE_CX] ;FT. end of entris ;AN000; 672 ; JZ gotit ;FT. no ;AN000; 673 ; MOV AL,[SI.QEA_NAMELEN] ;FT. update to next QEA ;AN000; 674 ; XOR AH,AH ;FT. update to next QEA ;AN000; 675 ; ADD SI,AX ;FT. update to next QEA ;AN000; 676 ; ADD SI,size QEA ;FT. ;AN000; 677 ; DEC SI ;FT. ;AN000; 678 ; JMP next_QEA ;FT. do next ;AN000; 679 ;serror: 680 ; MOV AX,error_invalid_data ;FT. set initial size to 0 ;AN000; 681 ;gotit: ;FT. ;AN000; 682 ; return ;FT. exit ;AN000;;FT. exit ;AN000; 683 ; 684 ;EndProc Get_max_EA_size ;FT. exit ;AN000; ;AN000; 685 ;AN000; 686 END ;AN000; === Trace listing source: ../DOS/ifs.lst 1 2 3 4 [list -] ;AN000; 4 ****************** warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <4> [list -] 14 <3> [list -] 3 <2> === Switch to base=000E10h -> "DOSSTART" 4 <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART 5 <2> ; (no prior section) ; DOSSTART ENDS 6 <2> === Switch to base=000E10h -> "DOSSTARTJUMP" 7 <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START 8 <2> ; (no prior section) ; DOSSTARTJUMP ENDS 9 <2> === Switch to base=000E10h -> "CONSTANTS" 10 <2> addsection CONSTANTS, align=2 PUBLIC class=CONST 11 <2> ; (no prior section) ; CONSTANTS ENDS 12 <2> === Switch to base=000E10h -> "DATA" 13 <2> addsection DATA, align=2 PUBLIC class=DATA 14 <2> ; (no prior section) ; DATA ENDS 15 <2> === Switch to base=000E10h -> "TABLE" 16 <2> addsection TABLE, align=2 PUBLIC class=TABLE 17 <2> ; (no prior section) ; TABLE ENDS 18 <2> === Switch to base=000E10h -> "DOSDATATABLE" 19 <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE 20 <2> ; (no prior section) ; DOSDATATABLE ENDS 21 <2> === Switch to base=000E10h -> "DOSDATACODE" 22 <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE 23 <2> ; (no prior section) ; DOSDATACODE ENDS 24 <2> === Switch to base=000E10h -> "DOSBIODATA" 25 <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA 26 <2> === Switch to base=000E10h -> "LAST" 27 <2> addsection LAST, align=16 PUBLIC class=LAST 28 <2> ; (no prior section) ; LAST ENDS 29 <2> 30 <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST 31 <2> 32 <2> %include "entryseg.nas" 1 <3> 2 <3> %ifndef ENTRYSEGNAS 3 <3> %define ENTRYSEGNAS 1 4 <3> 5 <3> %include "lmacros3.mac" 1 <4> [list -] 6 <3> === Switch to base=000000h -> "DOSENTRY" 7 <3> addsection DOSENTRY, class=%[DOSENTRY] 8 <3> 9 <3> group DOSENTRYGROUP DOSENTRY 10 <3> 11 <3> %endif 8 <1> 9 <1> %include "dcodeseg.nas" 1 <2> 2 <2> %ifndef DCODESEGNAS 3 <2> %assign DCODESEGNAS 1 4 <2> === Switch to base=002450h -> "DOSCODETABLE" 5 <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE 6 <2> ; (no prior section) ; DOSCODETABLE ENDS === Switch to base=002450h -> "DOSCODECODE" 7 <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE 8 <2> ; (no prior section) ; DOSCODECODE ENDS === Switch to base=002450h -> "DOSBIOCODE" 9 <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE === Switch to base=002450h -> "BIOCODE" 10 <2> section BIOCODE align=2 PUBLIC class=DOSCODE 11 <2> 12 <2> group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE 13 <2> 14 <2> %endif 10 <1> === Switch to base=000E10h -> "LAST" 11 <1> section LAST 12 <1> ; (no prior section) ; LAST ENDS 6 7 [list +] === Switch to base=002450h -> "DOSCODECODE" 8 section DOSCODECODE 9 [list -] 9 ****************** warning: out: ... for DOS Version 4.00 ... [-w+user] 9 ****************** warning: out: BPB.INC... [-w+user] 9 ****************** warning: out: ... CLONE version build switch on ... [-w+user] 9 ****************** warning: out: DEVSYM.INC... [-w+user] 16 StackSize equ 180h ; gross but effective 17 18 i_need VERFLG ; verify status flag ;AN000; 19 i_need CNTCFLAG ; break status flag ;AN000; 20 i_need CPSWFLAG ; CP switch logic ON/OFF ;AN000; 21 I_need CURRENTPDB,WORD ; Current process identifier ;AN000; 22 I_need HIGH_SECTOR,WORD ;AN000; 23 I_need BUF_HASH_COUNT,WORD ;AN000; 24 I_need FAILERR,WORD ;AN000; 25 I_need USER_ID,WORD ;AN000; 26 I_need CALLDEVAD,DWORD ; ;AN000; 27 I_need SYSINITVAR,WORD ;AN000; 28 I_need MYNAME,16 ; NetBIOS name ;AN000; 29 I_need RETRYCOUNT,WORD ; retry count ;AN000; 30 I_need COUNTRY_CDPG,BYTE ;AN000; 31 i_need DAY,BYTE ; date ;AN000; 32 i_need MONTH,BYTE ;AN000; 33 i_need YEAR,WORD ;AN000; 34 i_need CURBUF,DWORD ;AN000; 35 i_need IFS_DRIVER_ERR,WORD ;AN000; 36 i_need DOS34_FLAG,WORD ; IFS function Read/Write flag ;AN000; 37 i_need Callback_SS,WORD ; ;AN000; 38 i_need Callback_SP,WORD ;AN000; 39 i_need SaveBX,WORD ;AN000; 40 i_need Temp_Var,WORD ;AN000; 41 i_need INDOS,BYTE ;AN000; 42 i_need DskStack,BYTE ;AN000; 43 i_need IOStack,BYTE ;AN000; 44 i_need Callback_flag,BYTE ;AN000; 45 46 DOSINFO STRUC ;AN000; 0 00007BC1 ???? bsize dw ? ;AN000; 0 00007BC3 ???? files dw ? ;AN000; 0 00007BC5 ???? fcbs1 dw ? ;AN000; 0 00007BC7 ???? fcbs2 dw ? ;AN000; 0 00007BC9 ???? buffers dw ? ;AN000; 0 00007BCB ???? dw ? ;AN000; 0 00007BCD ???? lastdrv dw ? ;AN000; 0 00007BCF ???? secsize dw ? ;AN000; 55 DOSINFO ENDS ;AN000; 56 57 58 59 extrn ABSDRD:NEAR ;AN000; 60 extrn ABSDWRT:NEAR ;AN000; 61 extrn READTIME:NEAR ;AN000; 62 extrn CHECKFLUSH:NEAR ;AN000; 63 extrn GETCURHEAD:NEAR ;AN000; 64 65 66 ;****************************************************************************** 67 ; * 68 ; * MODULE: IFS_DOSCALL 69 ; * 70 ; * FUNCTION: IFS to DOS function request dispatcher 71 ; * 72 ; * FUNCTION: This procedure dispatches the IFS DOS service requests 73 ; * by calling various DOS service routines 74 ; * 75 ; * CALLING SEQUENCE: 76 ; * 77 ; * CALL DWORD PTR IFS_DOSCALL@ 78 ; * 79 ; * 80 ; * RETURN SEQUENCE: 81 ; * 82 ; * If AX = 0 No error 83 ; * 84 ; * If AX <> 0 Error 85 ; * AX = Error Code: 86 ; * 87 ; * 88 ; * INTERNAL REFERENCES: None 89 ; * 90 ; * 91 ; * EXTERNAL REFERENCES: STRATEGY, INTERRUPT, ABSDRD, ABSDWRT, 92 ; * FIND_SECTOR, MARK_SECTOR, WRITE_BUFFR, 93 ; * READ_BUFFR, WRITE_BUFFR, FREE_BUFFR, 94 ; * GET_DOS_INFO, FLUSH_BUFF 95 ; * 96 ; * NOTES: None 97 ; * 98 ; * REVISION HISTORY: New 99 ; * 100 ; * COPYRIGHT: "MS DOS IFS Function" 101 ; * "Version 1.00 (C) Copyright 1988 Microsoft Corporation" 102 ; * "Licensed Material - Program Property of Microsoft" 103 ; * 104 ; ************************************************************************* 105 106 107 relocated ifsentry 108 PROCEDURE IFS_DOSCALL,FAR ;AN000; 108 ****************** warning: proc IFS_DOSCALL... [-w+user] 109 assume DS:NOTHING,ES:NOTHING, ss:nothing 110 0 00007BC1 FA CLI ; ;AN000; 112 113 extern doscode_getdosdata 114 0 00007BC2 1E push ds 0 00007BC3 50 push ax 0 00007BC4 E8[0000] call doscode_getdosdata 0 00007BC7 8ED8 mov ds, ax 119 assume ds:DOSGROUP 0 00007BC9 58 pop ax 121 0 00007BCA 80FC27 CMP AH,39 ; ;AN000; 0 00007BCD 7507 JNZ others ; ;AN000; 0 00007BCF FE06[0000] INC byte [INDOS] ; in DOS ;AN000; 0 00007BD3 E9AC00 JMP Dosend_ds ; ;AN000; 126 others: 0 00007BD6 80FC28 CMP AH,40 ; ;AN000; 0 00007BD9 7507 JNZ others2 ; ;AN000; 0 00007BDB FE0E[0000] DEC byte [INDOS] ; out DOS ;AN000; 0 00007BDF E9A000 JMP Dosend_ds ; ;AN000; 131 others2: 0 00007BE2 80FC26 CMP AH,38 ; ;AN000; 0 00007BE5 750D JNZ not_stack ; ;AN000; 0 00007BE7 83C402 add sp, 2 0 00007BEA 1E push ds 136 IOSTACK equ IOStack ; NASM port label 0 00007BEB BE[0000] MOV SI,OFFSET IOSTACK wrt DOSGROUP ;AN000; 138 stacksize equ StackSize ; NASM port equate 0 00007BEE B98001 MOV CX,stacksize ;AN000; 0 00007BF1 E98E00 JMP Dosend_ds ; ;AN000; 141 ; ;AN000; 142 not_stack: ; ;AN000; 0 00007BF4 8F06[0000] pop word [Temp_Var] ; save ds for strcmp strcpy ;AN000; 144 assume DS:DOSGROUP ;AN000; 0 00007BF8 FE06[0000] INC byte [INDOS] ; in DOS ;AN000; 0 00007BFC 51 PUSH CX ; save cx ;AN000; 0 00007BFD 52 PUSH DX ; save cx ;AN000; 0 00007BFE 8CD1 MOV CX,SS ; cx=stack ;AN000; 0 00007C00 8CDA MOV DX,ds ; cx=stack ;AN000; 0 00007C02 39D1 CMP CX,DX ; dosgroup stack ? ;AN000; 0 00007C04 5A POP DX ; save cx ;AN000; 0 00007C05 59 POP CX ; restore cx ;AN000; 0 00007C06 741C JZ withSS_SP ; yes ;AN000; 0 00007C08 8C16[0000] MOV [Callback_SS],SS ;save SS:SP ;AN000; 0 00007C0C 8926[0000] MOV [Callback_SP],SP ;AN000; 0 00007C10 891E[0000] MOV [SaveBX],BX ; ;AN000; 0 00007C14 8CDB MOV BX,ds ; prepare system stack ;AN000; 158 DSKSTACK equ DskStack ; NASM port label 0 00007C16 8ED3 MOV SS,BX ; ;AN000; 0 00007C18 BC[0000] MOV SP,OFFSET DSKSTACK wrt DOSGROUP ;AN000; 161 assume ss:DOSGROUP 0 00007C1B 8B1E[0000] MOV BX,[SaveBX] ; ;AN000; 0 00007C1F C606[0000]01 MOV byte [Callback_flag],1 ;set flag ;AN000; 164 withSS_SP: ; ;AN000; 0 00007C24 FB STI ;AN000; 166 ASSUME DS:NOTHING ;AN000; 167 ; OR [DOS34_FLAG],Force_I24_Fail ;AN000; 168 ; ;AN000; 169 ; cmp ah,0 ; call Strategy routine ?? ;AN000; 170 ; jne dos_chk_ah1 ; jump if not ;AN000; 171 ; CALL STRATEGY ; else call strategy routine ;AN000; 172 ; jmp dos_exit ; then exit ;AN000; 173 ;AN000; 174 ;Dos_Chk_Ah1: ;AN000; 175 ; cmp ah,1 ; call interrupt routine ;AN000; 176 ; jne dos_chk_ah2 ; jump if not ;AN000; 177 ; CALL INTERRUPT ; else call interrupt routine ;AN000; 178 ; jmp dos_exit ; then exit ;AN000; 179 ;AN000; 180 ;Dos_Chk_Ah2: ;AN000; 181 ; cmp ah,4 ;AN000; 182 ; jae Dos_Chk_Ah8 ;AN000; 183 ; mov High_Sector,si ; save HI sector word ;AN000; 184 ; mov dx,di ; save low sector ;AN000; 185 ; push es ;AN000; 186 ; invoke FIND_DPB ; ds:si -> DPB ;AN000; 187 ; mov bp,si ;AN000; 188 ; push ds ;AN000; 189 ; pop es ; es:bp -> DPB ;AN000; 190 ; pop ds ; DS:BX-->Input buffer ;AN000; 191 ; 192 ; cmp ah,2 ; absolute read ?? ;AN000; 193 ; jne dos_chk_ah3 ; jump if not ;AN000; 194 ; 195 ; invoke DSKREAD ; else do absolute read ;AN000; 196 ; jmp dos_exit ; then return ;AN000; 197 198 ;Dos_Chk_Ah3: ;AN000; 199 ; invoke DSKWRITE ; do absolute write ;AN000; 200 ; jmp dos_exit ; then exit ;AN000; 201 202 203 204 Dos_chk_ah32: ;AN000; 0 00007C25 80FC20 cmp ah,32 0 00007C28 7505 jne str_cmp ;AN000; 0 00007C2A E85B00 CALL GET_DOS_INFO ; else get DOS information ;AN000; 208 dos_exit equ Dos_Exit ; NASM port label 0 00007C2D EB1A jmp SHORT dos_exit ;AN000; ;AN000; 210 str_cmp: ;AN000; 0 00007C2F 368E1E[0000] mov DS,[ss:Temp_Var] ; restore DS ;AN000; 212 assume ds:nothing 0 00007C34 80FC24 cmp ah,36 ;AN000; 0 00007C37 7505 jne str_cpy ;AN000; 0 00007C39 E8[0000] invoke strcmp ; string compare ;AN000; 0 00007C3C EB0B jmp SHORT dos_exit ;AN000; 217 str_cpy: ;AN000; 0 00007C3E 80FC25 cmp ah,37 ;AN000; 219 dos_error equ Dos_Error ; NASM port label 0 00007C41 7505 jne dos_error ;AN000; 0 00007C43 E8[0000] invoke strcpy ; string copy ;AN000; 0 00007C46 EB01 jmp SHORT dos_exit ;AN000; 223 224 Dos_Error: ;AN000; 0 00007C48 F9 stc 226 ;AN000; 227 Dos_Exit: ;AN000; 0 00007C49 FA CLI ;AN000; 0 00007C4A 9C PUSHF ;AN000; 230 No_Force_I24_Fail equ NO_Force_I24_Fail ; NASM port equate 0 00007C4B 368326[0000]DF AND word [ss:DOS34_FLAG],No_Force_I24_Fail ;AN000; 0 00007C51 36FE0E[0000] DEC byte [ss:INDOS] ; exit DOS ;AN000; 0 00007C56 36803E[0000]00 CMP byte [ss:Callback_flag],0 ;from dosgroup 0 00007C5C 7427 JZ noSS_SP ;yes ;AN000; 0 00007C5E 36C606[0000]00 MOV byte [ss:Callback_flag],0 ; ;AN000; 236 ; fl on stack 0 00007C64 56 push si 0 00007C65 1E push ds 0 00007C66 368E1E[0000] mov ds, [ss:Callback_SS] 240 assume ds:nothing 0 00007C6B 368B36[0000] mov si, [ss:Callback_SP] ; ds:si -> user stack 0 00007C70 4E dec si 0 00007C71 4E dec si ; make space for another word 0 00007C72 8F04 pop word [si] ; ds 0 00007C74 4E dec si 0 00007C75 4E dec si 0 00007C76 8F04 pop word [si] ; si 0 00007C78 4E dec si 0 00007C79 4E dec si 0 00007C7A 8F04 pop word [si] ; fl 0 00007C7C 1E push ds 0 00007C7D 17 pop ss ; switch stacks 0 00007C7E 89F4 mov sp, si 254 assume ss:nothing 0 00007C80 9D popf ; fl 0 00007C81 5E pop si ; si 257 ; ds left on stack 258 Dosend_ds: 0 00007C82 1F pop ds 260 assume ds:nothing, ss:nothing 0 00007C83 FB STI ; ;AN000; 0 00007C84 CB retf ;return ;AN000; 263 264 noSS_SP: ;AN000; 0 00007C85 9D POPF 0 00007C86 FB sti 0 00007C87 CB retf 268 269 270 ENDPROC IFS_DOSCALL ;AN000; 271 272 273 274 275 276 ; **************************************************************************** 277 ; * 278 ; * MODULE: STRATEGY 279 ; * 280 ; * FUNCTION: Call Strategy Routine 281 ; * 282 ; * FUNCTION: This procedure dispatches the IFS DOS service requests 283 ; * by calling various DOS service functions 284 ; * 285 ; * INPUT: ES:BX ---> Device Request Header 286 ; * AL = Drive # 287 ; * 288 ; * CALL STRATEGY 289 ; * 290 ; * OUTPUT: output of driver 291 ; * 292 ; * INTERNAL REFERENCES: None 293 ; * 294 ; * 295 ; * EXTERNAL REFERENCES: GETTHISDRV 296 ; * 297 ; * NOTES: None 298 ; * 299 ; * REVISION HISTORY: New 300 ; * 301 ; ************************************************************************* 302 303 ;PROCEDURE STRATEGY,NEAR ;AN000; 304 305 ; INVOKE FIND_DPB ; get DPB from drive number ;AN000; 306 ; ; DS:SI-->DPB for drive ;AN000; 307 ; LDS DI,[DS:SI.DPB_Driver_Addr] ; get driver addres from DPB ;AN000; 308 ; MOV DX,WORD PTR [DI.SDEVSTRAT] ;get strategy routine address;AN000; 309 ;Driver_Call: ;AN000; 310 ; MOV WORD PTR [CALLDEVAD],DX ; save it ;AN000; 311 ; MOV WORD PTR [CALLDEVAD+2],DS ; ;AN000; 312 ; CALL DWORD PTR [CALLDEVAD] ; call strategy routine ;AN000; 313 ;STRAT_Exit: ;AN000; 314 ; RET ; return ;AN000; 315 316 ;ENDPROC STRATEGY ;AN000; 317 318 319 320 321 322 323 324 325 ; **************************************************************************** 326 ; * 327 ; * MODULE: INTERRUPT 328 ; * 329 ; * FUNCTION: This procedure calls the interrupt routine of the drive 330 ; * specified in the drive#. 331 ; * 332 ; * INPUT: AL = Drive # 333 ; * 334 ; * 335 ; * OUTPUT: output of driver 336 ; * 337 ; * 338 ; * INTERNAL REFERENCES: None 339 ; * 340 ; * 341 ; * EXTERNAL REFERENCES: FIND_DPB 342 ; * 343 ; * NOTES: None 344 ; * 345 ; * REVISION HISTORY: New 346 ; * 347 ; ************************************************************************* 348 349 ;PROCEDURE INTERRUPT,NEAR ;AN000; 350 351 ; INVOKE FIND_DPB ; get DPB from drive number ;AN000; 352 ; LDS DI,[DS:SI.DPB_Driver_Addr] ; get driver addres from DPB ;AN000; 353 ; MOV DX,WORD PTR [DI.SDEVINT] ; get interrupt routine addrs;AN000; 354 ; JMP Driver_Call ;AN000; 355 356 ;ENDPROC INTERRUPT ;AN000; 357 358 359 360 361 362 363 364 365 ; ************************************************************************* * 366 ; * 367 ; * MODULE: Get_Dos_Info 368 ; * 369 ; * FUNCTION: Get DOS information 370 ; * 371 ; * INPUT: AL = Dos info code 372 ; * 373 ; * OUTPUT: Dos Information in registers 374 ; * 375 ; * INTERNAL REFERENCES: None 376 ; * 377 ; * 378 ; * EXTERNAL REFERENCES: READTIME, $GETEXTCNTRY 379 ; * 380 ; * NOTES: None 381 ; * 382 ; * REVISION HISTORY: New 383 ; * 384 ; ************************************************************************* 385 386 PROCEDURE GET_DOS_INFO,NEAR ;AN000; 386 ****************** warning: proc GET_DOS_INFO... [-w+user] 387 assume ss:DOSGROUP 388 0 00007C88 3C00 cmp al,0 ; TIME and DATE ?? ;AN000; 0 00007C8A 7518 jne chk_al1 ;AN000; 391 392 ReadTime equ READTIME ; NASM port label 0 00007C8C E8[0000] Invoke ReadTime ; get time in CX:DX ;AN000; 394 0 00007C8F 51 push cx ; save time ;AN000; 0 00007C90 52 push dx ;AN000; 397 0 00007C91 368B0E[0000] MOV CX,[ss:YEAR] ;AN000; 0 00007C96 81C1BC07 ADD CX,1980 ;AN000; 0 00007C9A 368B16[0000] MOV DX,WORD PTR [ss:DAY] ; fetch both day and month ;AN000; 401 0 00007C9F 5B pop bx ; bh = seconds bl = hundredths ;AN000; 0 00007CA0 58 pop ax ; ah = hour al = minutes ;AN000; 404 ; cx = year dh = month ;AN000; 405 get_info_exit equ Get_Info_Exit ; NASM port label 0 00007CA1 EB6E jmp get_info_exit ;AN000; 0 00007CA3 90 nop ; identicalise 408 409 410 chk_al1: ; Active process info ?? ;AN000; 0 00007CA4 3C01 cmp al,1 ;AN000; 0 00007CA6 750D jne chk_al2 ; no, try next ;AN000; 413 CurrentPDB equ CURRENTPDB ; NASM port label 0 00007CA8 368B1E[0000] MOV BX,[ss:CurrentPDB] ; BX = active process ID ;AN000; 415 User_ID equ USER_ID ; NASM port label 0 00007CAD 368B16[0000] mov DX,[ss:User_ID] ; User ID ;AN000; 0 00007CB2 EB5D jmp get_info_exit ; exit ;AN000; 0 00007CB4 90 nop ; identicalise 419 420 421 chk_al2: ;AN000; 422 ; cmp al,2 ; get CPSW info ?? ;AN000; 423 ; jne chk_al3 ; jump if not ;AN000; 424 ; MOV SI,OFFSET COUNTRY_CDPG wrt DOSGROUP ;AN000; 425 ; MOV BX,[SI.ccDosCodePage] ; get dos code page id in BX ;AN000; 426 ; MOV DL,CPSWFLAG ; get CP Switch status ;AN000; 427 ; jmp get_info_exit ; exit ;AN000; 428 429 430 chk_al3: 431 ; cmp al,3 ; get CTRL BRK status ?? ;AN000; 432 ; jne chk_al4 ;AN000; 433 ; mov dl,CNTCFLAG ; DL = break status flag ;AN000; 434 ; jmp get_info_exit ; exit ;AN000; 435 436 437 chk_al4: 438 ; cmp al,4 ; get Verify status ?? ;AN000; 439 ; jne chk_al5 440 ; mov dl,VERFLG ; DL = verify status flag ;AN000; 441 ; jmp get_info_exit ; exit ;AN000; 442 443 444 chk_al5: 0 00007CB5 3C05 cmp al,5 ; Config.sys info ?? ;AN000; 0 00007CB7 7536 jne chk_al6 ;AN000; 447 0 00007CB9 BE[0000] mov si,OFFSET SYSINITVAR wrt DOSGROUP ; DS:SI-->SysInitVar ;AN000; 0 00007CBC 1E push ds ;AN000; 0 00007CBD 56 push si ;AN000; 451 Sysi_SFT equ SYSI_SFT ; NASM port equate 0 00007CBE C57404 lds si,[si + Sysi_SFT] ; get SFT address ;AN000; 0 00007CC1 8B4404 mov ax,[si + SFCount] ; get number of files ;AN000; 454 SFlink equ SFLink ; NASM port equate 0 00007CC4 C534 lds si,[si + SFlink] ; get next SFT table ;AN000; 0 00007CC6 83FEFF cmp si,-1 ; end of table ;AN000; 0 00007CC9 7403 jz nomore ; ;AN000; 0 00007CCB 034404 add ax,[si + SFCount] ; ;AN000; 459 nomore: ; ;AN000; 0 00007CCE 26894502 mov [es:di + files],ax ; save files= value ;AN000; 0 00007CD2 5E pop si ;AN000; 0 00007CD3 1F pop ds ;AN000; 463 assume ds:DOSGROUP 464 Sysi_MaxSec equ SYSI_MAXSEC ; NASM port equate 0 00007CD4 8B4410 mov ax,[si + Sysi_MaxSec] ; get maximum sector size ;AN000; 0 00007CD7 2689450E mov [es:di + secsize],ax ; save files= value ;AN000; 467 Sysi_Keep equ SYSI_Keep ; NASM port equate 0 00007CDB 8B441E mov ax,[si + Sysi_Keep] ; ;AN000; 0 00007CDE 26894506 mov [es:di + fcbs2],ax ; ;AN000; 470 Sysi_FCB equ SYSI_FCB ; NASM port equate 0 00007CE2 C5741A lds si,[si + Sysi_FCB] ; get FCB address ;AN000; 0 00007CE5 8B4404 mov ax,[si + SFCount] ; get number of fcbs ;AN000; 0 00007CE8 26894504 mov [es:di + fcbs1],ax ; save fcbs= value ;AN000; 0 00007CEC EB23 jmp get_info_exit ;AN000; 0 00007CEE 90 nop ; identicalise 476 477 478 479 chk_al6: ;AN000; 0 00007CEF 3C06 cmp al,6 ; get machine name ?? ;AN000; 481 chk_al7 equ Chk_Al7 ; NASM port label 0 00007CF1 7513 jne chk_al7 ; no, check next function ;AN000; 0 00007CF3 161F context DS ;AN000; 484 DOSGroup equ DOSGROUP ; NASM port equate 485 MyName equ MYNAME ; NASM port label 0 00007CF5 BE[0000] mov si,offset MyName wrt DOSGroup ; DS:SI-->name string ;AN000; 487 ; ES:DI-->return buffer ;AN000; 0 00007CF8 83C702 add di,2 ; skip max return size ;AN000; 0 00007CFB B90F00 mov cx,15 ; name size ;AN000; 490 Chk6_Loop: ;AN000; 0 00007CFE F3A4 rep movsb ; copy machine name to return buffer;AN000; 0 00007D00 30C0 xor al,al ; set 16th byte is 0 ;AN000; 0 00007D02 AA stosb ;AN000; 0 00007D03 EB0C jmp get_info_exit ; return ;AN000; 0 00007D05 90 nop ; identicalise 496 ;AN000; 497 ;AN000; 498 Chk_Al7: ;AN000; 499 ; cmp al,7 ; get country information ?? ;AN000; 500 ; jne chk_al8 ; no, try next function ;AN000; 501 ; mov al,dl ; AL = info ID ;AN000; 502 ; mov bx,-1 ; select active code page ;AN000; 503 ; mov dx,-1 ; select active country ;AN000; 504 ; mov cx,-1 ; get all ;AN000; 505 ; INVOKE $getExtCntry ; get country info ;AN000; 506 ; jmp SHORT Get_Info_Exit ; exit ;AN000; 507 508 509 Chk_Al8: ;AN000; 0 00007D06 3C08 cmp al,8 ; get share retry count ?? ;AN000; 511 bad_param equ Bad_Param ; NASM port label 0 00007D08 7506 jne bad_param ; no, Bad parameter ;AN000; 513 RetryCount equ RETRYCOUNT ; NASM port label 0 00007D0A 8B1E[0000] mov bx,[RetryCount] ; BX = Share retry count ;AN000; 0 00007D0E EB01 jmp SHORT Get_Info_Exit ; exit ;AN000; 516 517 Bad_Param: ; Bad parameter ;AN000; 0 00007D10 F9 stc ; ;AN000; 519 520 Get_Info_Exit: ; exit ;AN000; 521 0 00007D11 C3 ret ;AN000; 523 524 525 ENDPROC GET_DOS_INFO ;AN000; 526 527 528 529 530 531 532 533 534 ; ************************************************************************* * 535 ; * 536 ; * MODULE: $IFS_IOCTL 537 ; * 538 ; * FUNCTION: Handle IFS Driver IOCTL calls 539 ; * 540 ; * INPUT: AH = 6B function code 541 ; * AL = XX 00 = Drive IOCTL, 01 = Psudo device IOCTL 542 ; * CX = 00 Reserved 543 ; * BL = XX Device Number 544 ; * DS:DX Pointer to Buffer 545 ; * 546 ; * OUTPUT: 547 ; * IF CARRY = 0 No Error 548 ; * IF CARRY = 1 Error 549 ; * AX = ERROR CODE 550 ; * 551 ; * INTERNAL REFERENCES: None 552 ; * 553 ; * 554 ; * EXTERNAL REFERENCES: INT 2F 555 ; * 556 ; * NOTES: None 557 ; * 558 ; * REVISION HISTORY: New 559 ; ************************************************************************* 560 561 PROCEDURE D_IFS_IOCTL,NEAR ;AN000; 561 ****************** warning: proc D_IFS_IOCTL... [-w+user] 562 assume ss:DOSGROUP 563 0 00007D12 50 PUSH AX ;AN000; 565 multnet equ MultNET ; NASM port equate 0 00007D13 B82F11 MOV AX,(multnet << 8) | 47 ; pass control to IFS Func ;AN000; 0 00007D16 CD2F INT 2FH ;AN000; 0 00007D18 5B POP BX ;AN000; 0 00007D19 7203 JC ABB_ERR ;AN000; 0 00007D1B E9[0000] TRANSFER SYS_RET_OK ; return ;AN000; 571 572 ABB_ERR: ;AN000; 0 00007D1E E9[0000] transfer SYS_RET_ERR ; error return ;AN000; 574 575 ENDPROC D_IFS_IOCTL ;AN000; 576 577 END ;AN000; 578 579