=== Trace listing source: apisupt.lst 1 ; File: 2 ; apisupt.asm 3 ; Description: 4 ; Assembly support routines for stack manipulation, etc. 5 ; 6 ; Copyright (c) 1995, 1998 7 ; Pasquale J. Villani 8 ; All Rights Reserved 9 ; 10 ; This file is part of DOS-C. 11 ; 12 ; DOS-C is free software; you can redistribute it and/or 13 ; modify it under the terms of the GNU General Public License 14 ; as published by the Free Software Foundation; either version 15 ; 2, or (at your option) any later version. 16 ; 17 ; DOS-C is distributed in the hope that it will be useful, but 18 ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 ; the GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public 23 ; License along with DOS-C; see the file COPYING. If not, 24 ; write to the Free Software Foundation, 675 Mass Ave, 25 ; Cambridge, MA 02139, USA. 26 ; 27 ; $Id: apisupt.asm 538 2003-03-12 22:43:53Z bartoldeman $ 28 ; 29 30 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 31 === Switch to base=002270h -> "HMA_TEXT" 32 segment HMA_TEXT 33 %if 0 34 35 extern _api_sp:wrt DGROUP ; api stacks - for context 36 extern _api_ss:wrt DGROUP ; switching 37 extern _usr_sp:wrt DGROUP ; user stacks 38 extern _usr_ss:wrt DGROUP 39 40 global _set_stack 41 ; 42 ; void set_stack(void) - 43 ; save current stack and setup our local stack 44 ; 45 _set_stack: 46 47 ; save foreground stack 48 49 ; we need to get the return values from the stack 50 ; since the current stack will change 51 pop ax ;get return offset 52 53 ; Save the flags so that we can restore correct interrupt 54 ; state later. We need to disable interrupts so that we 55 ; don't trash memory with new sp-old ss combination 56 pushf 57 pop dx 58 cli 59 60 ; save bp 61 push bp 62 63 mov cx, sp 64 neg cx 65 66 ; save away foreground process' stack 67 push word [_usr_ss] 68 push word [_usr_sp] 69 70 mov word [_usr_ss],ss 71 mov word [_usr_sp],sp 72 73 ; setup our local stack 74 mov ss,word [_api_ss] 75 mov sp,word [_api_sp] 76 77 add cx, sp 78 add bp, cx 79 80 ; setup for ret 81 push ax 82 83 ; now restore interrupt state 84 push dx 85 popf 86 87 ret 88 89 ; 90 ; void restore_stack(void) - 91 ; restore foreground stack, throw ours away 92 ; 93 global _restore_stack 94 _restore_stack: 95 96 ; we need to get the return values from the stack 97 ; since the current stack will change 98 pop cx ;get return offset 99 100 ; Save the flags so that we can restore correct interrupt 101 ; state later. We need to disable interrupts so that we 102 ; don't trash memory with new sp-old ss combination 103 pushf 104 pop dx 105 cli 106 107 ; save background stack 108 mov word [_api_ss],ss 109 mov word [_api_sp],sp 110 111 ; restore foreground stack here 112 mov ss,word [_usr_ss] 113 mov sp,word [_usr_sp] 114 115 pop word [_usr_sp] 116 pop word [_usr_ss] 117 118 ; make bp relative to our stack frame 119 pop bp 120 ;mov bp,sp 121 122 ; setup for ret 123 push cx 124 125 ; now restore interrupt state 126 push dx 127 popf 128 129 ret 130 %endif === Trace listing source: asmsupt.lst 1 ; File: 2 ; asmsupt.asm 3 ; Description: 4 ; Assembly support routines for miscellaneous functions 5 ; 6 ; Copyright (c) 1995, 1998 7 ; Pasquale J. Villani 8 ; All Rights Reserved 9 ; 10 ; This file is part of DOS-C. 11 ; 12 ; DOS-C is free software; you can redistribute it and/or 13 ; modify it under the terms of the GNU General Public License 14 ; as published by the Free Software Foundation; either version 15 ; 2, or (at your option) any later version. 16 ; 17 ; DOS-C is distributed in the hope that it will be useful, but 18 ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 ; the GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public 23 ; License along with DOS-C; see the file COPYING. If not, 24 ; write to the Free Software Foundation, 675 Mass Ave, 25 ; Cambridge, MA 02139, USA. 26 ; 27 ; version 1.4 by tom.ehlert@ginko.de 28 ; added some more functions 29 ; changed bcopy, scopy, sncopy,... 30 ; to memcpy, strcpy, strncpy 31 ; Bart Oldeman: optimized a bit: see /usr/include/bits/string.h from 32 ; glibc 2.2 33 ; 34 ; $Id: asmsupt.asm 1568 2011-04-09 02:42:51Z bartoldeman $ 35 ; 36 37 ; for OW on Linux: 38 %ifdef owlinux 39 %define WATCOM 40 %endif 41 42 %ifdef WATCOM 43 %ifdef _INIT 44 %define WATCOM_INIT ; no seperate init segment for watcom. 45 %endif 46 %endif 47 48 %ifndef WATCOM_INIT 49 50 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 51 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 52 53 %ifdef _INIT 54 === Switch to base=00E150h -> "INIT_TEXT" 55 segment INIT_TEXT 56 %define FMEMCPYBACK INIT_FMEMCPYBACK 57 %define MEMCPY INIT_MEMCPY 58 %define FMEMCPY INIT_FMEMCPY 59 %define MEMSET INIT_MEMSET 60 %define FMEMSET INIT_FMEMSET 61 %define STRCPY INIT_STRCPY 62 %define FSTRCPY INIT_FSTRCPY 63 %define STRLEN INIT_STRLEN 64 %define FSTRLEN INIT_FSTRLEN 65 %define FMEMCHR INIT_FMEMCHR 66 %define FSTRCHR INIT_FSTRCHR 67 %define STRCHR INIT_STRCHR 68 %define FSTRCMP INIT_FSTRCMP 69 %define STRCMP INIT_STRCMP 70 %define FSTRNCMP INIT_FSTRNCMP 71 %define STRNCMP INIT_STRNCMP 72 %define FMEMCMP INIT_FMEMCMP 73 %define MEMCMP INIT_MEMCMP 74 75 %else 76 === Switch to base=002270h -> "HMA_TEXT" 77 segment HMA_TEXT 78 79 %endif 80 81 ;********************************************************************* 82 ; this implements some of the common string handling functions 83 ; 84 ; every function has 1 entry 85 ; 86 ; NEAR FUNC() 87 ; 88 ; currently done: 89 ; 90 ; fmemcpyBack(void FAR *dest, void FAR *src, int count) 91 ; memcpy(void *dest, void *src, int count) 92 ; fmemcpy(void FAR *dest, void FAR *src, int count) 93 ; memset(void *dest, int ch, int count); 94 ; fmemset(void FAR *dest, int ch, int count); 95 ; strcpy (void *dest, void *src); 96 ; fstrcpy (void FAR*dest, void FAR *src); 97 ; strlen (void *dest); 98 ; fstrlen (void FAR*dest); 99 ; fmemchr (BYTE FAR *src , int ch); 100 ; fstrchr (BYTE FAR *src , int ch); 101 ; strchr (BYTE *src , int ch); 102 ; fstrcmp (BYTE FAR *s1 , BYTE FAR *s2); 103 ; strcmp (BYTE *s1 , BYTE *s2); 104 ; fstrncmp(BYTE FAR *s1 , BYTE FAR *s2, int count); 105 ; strncmp(BYTE *s1 , BYTE *s2, int count); 106 ; fmemcmp(BYTE FAR *s1 , BYTE FAR *s2, int count); 107 ; memcmp(BYTE *s1 , BYTE *s2, int count); 108 109 ;*********************************************** 110 ; pascal_setup - set up the standard calling frame for C-functions 111 ; and save registers needed later 112 ; also preload the args for the near functions 113 ; di=arg1 114 ; si=arg2 115 ; cx=arg3 116 ; 117 pascal_setup: 0 000003BB 58 pop ax ; get return address 119 0 000003BC 55 push bp ; Standard C entry 0 000003BD 89E5 mov bp,sp 122 %ifdef WATCOM 123 push bx 124 push cx 125 push es 126 %endif 0 000003BF 56 push si 0 000003C0 57 push di 0 000003C1 1E push ds 130 ; Set both ds and es to same segment (for near copy) 0 000003C2 1E push ds 0 000003C3 07 pop es 133 134 ; Set direction to autoincrement 0 000003C4 FC cld 136 0 000003C5 B306 mov bl,6 ; majority (4) wants that 138 arg arg1, arg2, arg3 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 0 000003C7 8B4E08 mov cx,[.arg3] ; majority (8) wants that (near and far) 0 000003CA 8B7606 mov si,[.arg2] ; majority (3) wants that (near) 0 000003CD 8B7E04 mov di,[.arg1] ; majority (3) wants that (near) 142 0 000003D0 FFE0 jmp ax 144 145 146 147 148 ;*********************************************** 149 ; 150 ; VOID memcpy(REG BYTE *s, REG BYTE *d, REG COUNT n); 151 ; 152 global MEMCPY 153 MEMCPY: 0 000003D2 E8E6FF call pascal_setup 155 156 ;mov cx,[4+bp] - preset above 157 ;mov si,[6+bp] - preset above 158 ;mov di,[8+bp] - preset above 159 160 ;mov bl,6 - preset above 161 162 163 domemcpy: 164 ; And do the built-in byte copy, but do a 16-bit transfer 165 ; whenever possible. 0 000003D5 D1E9 shr cx,1 0 000003D7 F3A5 rep movsw 0 000003D9 7301 jnc memcpy_return 0 000003DB A4 movsb 170 memcpy_return: 171 %if 0 ; only needed for fmemcpyback 172 cld 173 %endif 174 175 ; 176 ; pascal_return - pop saved registers and do return 177 ; 178 0 000003DC EB31 jmp short pascal_return 180 181 182 183 ;************************************************************ 184 ; 185 ; VOID fmemcpy(REG BYTE FAR *d, REG BYTE FAR *s,REG COUNT n); 186 ; VOID fmemcpyBack(REG BYTE FAR *d, REG BYTE FAR *s,REG COUNT n); 187 ; 188 global FMEMCPY 189 %if 0 190 global FMEMCPYBACK 191 FMEMCPYBACK: 192 std ; force to copy the string in reverse order 193 %endif 194 FMEMCPY: 0 000003DE E8DAFF call pascal_setup 196 197 arg {d,4}, {s,4}, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 198 ; Get the repetition count, n preset above 199 %ifdef STDCALL 0 000003E1 8B4E0C mov cx,[.n] 201 %endif 202 203 ; Get the far source pointer, s 0 000003E4 C57608 lds si,[.s] 205 206 ; Get the far destination pointer d 0 000003E7 C47E04 les di,[.d] 0 000003EA B30A mov bl,10 209 0 000003EC EBE7 jmp short domemcpy 211 212 ;*************************************************************** 213 ; 214 ; VOID fmemset(REG VOID FAR *d, REG BYTE ch, REG COUNT n); 215 ; 216 global FMEMSET 217 FMEMSET: 0 000003EE E8CAFF call pascal_setup 219 220 arg {d,4}, ch, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 221 ; Get the repetition count, n - preset above 222 %ifdef STDCALL 0 000003F1 8B4E0A mov cx,[.n] 224 %endif 225 226 ; Get the fill byte ch 0 000003F4 8B4608 mov ax,[.ch] 228 229 ; Get the far source pointer, s 0 000003F7 C47E04 les di,[.d] 0 000003FA B308 mov bl,8 232 233 domemset: 0 000003FC 88C4 mov ah, al 235 0 000003FE D1E9 shr cx,1 0 00000400 F3AB rep stosw 0 00000402 730B jnc pascal_return 0 00000404 AA stosb 240 0 00000405 EB08 jmp short pascal_return 242 243 ;*************************************************************** 244 ; 245 ; VOID memset(REG VOID *d, REG BYTE ch, REG COUNT n); 246 ; 247 global MEMSET 248 MEMSET: 0 00000407 E8B1FF call pascal_setup 250 251 arg d, ch, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 252 ; Get the repitition count, n - preset above 253 ; mov cx,[bp+4] 254 255 ; Get the char ch 0 0000040A 8B4606 mov ax, [.ch] 257 258 ; Get the far source pointer, d - preset above 259 ; mov di,[bp+8] 260 261 ;mov bl, 6 ; preset above 262 0 0000040D EBED jmp short domemset 264 265 ;***** 266 pascal_return: 0 0000040F C57E00 lds di, [bp] ; return address in ds, saved bp in di 0 00000412 B700 mov bh, 0 0 00000414 01DD add bp, bx ; point bp to "as if there were 0 args" 0 00000416 8C5E02 mov [bp+2], ds ; put return address at first arg 0 00000419 897E00 mov [bp], di ; saved bp below that one 272 0 0000041C 1F pop ds 0 0000041D 5F pop di 0 0000041E 5E pop si 276 %ifdef WATCOM 277 pop es 278 pop cx 279 pop bx 280 %endif 0 0000041F 89EC mov sp,bp 0 00000421 5D pop bp 0 00000422 C3 ret 284 285 ;***************************************************************** 286 287 ; fstrcpy (void FAR*dest, void FAR *src); 288 289 global FSTRCPY 290 FSTRCPY: 0 00000423 E895FF call pascal_setup 292 293 arg {dest,4}, {src,4} 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 294 ; Get the source pointer, ss 0 00000426 C57608 lds si,[.src] 296 297 ; and the destination pointer, d 0 00000429 C47E04 les di,[.dest] 299 0 0000042C B308 mov bl,8 301 0 0000042E EB05 jmp short dostrcpy 303 304 ;****** 305 global STRCPY 306 STRCPY: 0 00000430 E888FF call pascal_setup 308 309 310 %ifdef PASCAL 311 ; Get the source pointer, ss 312 mov si,[bp+4] 313 314 ; and the destination pointer, d 315 mov di,[bp+6] 316 %endif 0 00000433 B304 mov bl,4 318 319 dostrcpy: 320 321 strcpy_loop: 0 00000435 AC lodsb 0 00000436 AA stosb 0 00000437 84C0 test al,al 0 00000439 75FA jne strcpy_loop 326 0 0000043B EBD2 jmp short pascal_return 328 329 ;****************************************************************** 330 global FSTRLEN 331 FSTRLEN: 0 0000043D E87BFF call pascal_setup 333 334 ; Get the source pointer, ss 0 00000440 C47E04 les di,[bp+4] 0 00000443 B304 mov bl,4 337 0 00000445 EB05 jmp short dostrlen 339 340 ;********************************************** 341 global STRLEN 342 STRLEN: 0 00000447 E871FF call pascal_setup 344 ; Get the source pointer, ss 345 %ifdef PASCAL 346 mov di,[bp+4] 347 %endif 0 0000044A B302 mov bl,2 349 350 dostrlen: 0 0000044C B000 mov al,0 0 0000044E B9FFFF mov cx,0xffff 0 00000451 F2AE repne scasb 354 0 00000453 89C8 mov ax,cx 0 00000455 F7D0 not ax 0 00000457 48 dec ax 358 0 00000458 EBB5 jmp short pascal_return 360 361 ;************************************************************ 362 ; strchr (BYTE *src , int ch); 363 364 global STRCHR 365 STRCHR: 0 0000045A E85EFF call pascal_setup 367 368 ; Get the source pointer, ss 369 arg src, ch 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 370 %ifdef STDCALL ; preset above for PASCAL 0 0000045D 8B4E06 mov cx,[.ch] 0 00000460 8B7604 mov si,[.src] 373 %endif 0 00000463 B304 mov bl,4 375 376 strchr_loop: 0 00000465 AC lodsb 0 00000466 38C8 cmp al,cl 0 00000468 740A je strchr_found 0 0000046A 84C0 test al,al 0 0000046C 75F7 jne strchr_loop 382 383 strchr_retzero: 0 0000046E 31C0 xor ax, ax ; return NULL if not found 0 00000470 89C2 mov dx, ax ; for fstrchr() 0 00000472 EB9B jmp short pascal_return 387 388 strchr_found: 0 00000474 89F0 mov ax, si 0 00000476 8CDA mov dx, ds ; for fstrchr() 391 strchr_found1: 0 00000478 48 dec ax 393 0 00000479 EB94 jmp short pascal_return 395 396 %ifndef _INIT 397 398 ;***** 399 ; fstrchr (BYTE far *src , int ch); 400 global FSTRCHR 401 FSTRCHR: 0 0000047B E83DFF call pascal_setup 403 404 arg {src,4}, ch 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 405 ; Get ch (preset above) 406 ;mov cx, [bp+4] 407 408 ;and the source pointer, src 0 0000047E C57604 lds si, [.src] 410 411 ;mov bl, 6 - preset above 412 0 00000481 EBE2 jmp short strchr_loop 414 415 ;****** 416 global FMEMCHR 417 FMEMCHR: 0 00000483 E835FF call pascal_setup 419 420 arg {src,4}, ch, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 421 ; Get the length - preset above 422 %ifdef STDCALL 0 00000486 8B4E0A mov cx, [.n] 424 %endif 425 426 ; and the search value 0 00000489 8B4608 mov ax, [.ch] 428 429 ; and the source pointer, ss 0 0000048C C47E04 les di, [.src] 431 0 0000048F B308 mov bl, 8 433 0 00000491 E3DB jcxz strchr_retzero 0 00000493 F2AE repne scasb 0 00000495 75D7 jne strchr_retzero 0 00000497 8CC2 mov dx, es 0 00000499 89F8 mov ax, di 0 0000049B EBDB jmp short strchr_found1 440 441 ;********************************************************************** 442 global FSTRCMP 443 FSTRCMP: 0 0000049D E81BFF call pascal_setup 445 446 arg {dest,4}, {src,4} 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 447 ; Get the source pointer, ss 0 000004A0 C57608 lds si,[.src] 449 450 ; and the destination pointer, d 0 000004A3 C47E04 les di,[.dest] 452 0 000004A6 B308 mov bl,8 454 455 %if 0 456 jmp short dostrcmp 457 458 ;****** 459 global STRCMP 460 STRCMP: 461 call pascal_setup 462 463 mov bl,4 464 465 ; Get the source pointer, ss 466 ; mov si,[bp+4] 467 468 ; and the destination pointer, d 469 ; mov di,[bp+6] 470 xchg si,di 471 472 dostrcmp: 473 %endif 474 ; replace strncmp(s1,s2)--> 475 ; strncmp(s1,s2,0xffff) 0 000004A8 B9FFFF mov cx,0xffff 477 %if 0 478 jmp short dostrncmp 479 480 481 ;********************************************************************** 482 global FSTRNCMP 483 FSTRNCMP: 484 call pascal_setup 485 486 ; Get the source pointer, ss 487 lds si,[bp+4] 488 489 ; and the destination pointer, d 490 les di,[bp+8] 491 mov cx,[bp+12] 492 mov bl,10 493 494 jmp short dostrncmp 495 496 ;****** 497 global _strncmp 498 _strncmp: 499 call pascal_setup 500 501 ; Get the source pointer, ss 502 ;mov si,[bp+4] 503 504 ; and the destination pointer, d 505 ;mov di,[bp+6] 506 ;mov cx,[bp+8] 507 xchg si,di 508 509 dostrncmp: 510 %endif 0 000004AB E325 jcxz strncmp_retzero 512 513 strncmp_loop: 0 000004AD AC lodsb 0 000004AE AE scasb 0 000004AF 7525 jne strncmp_done 0 000004B1 84C0 test al,al 0 000004B3 E0F8 loopne strncmp_loop 0 000004B5 EB1B jmp short strncmp_retzero 520 %endif 521 522 ;********************************************************************** 523 ; fmemcmp(BYTE FAR *s1 , BYTE FAR *s2, int count); 524 global FMEMCMP 525 FMEMCMP: 0 000004B7 E801FF call pascal_setup 527 528 arg {dest,4}, {src,4}, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 529 ; the length - preset above 530 %ifdef STDCALL 0 000004BA 8B4E0C mov cx, [.n] 532 %endif 533 534 ; Get the source pointer, ss 0 000004BD C47E08 les di,[.src] 536 537 ; and the destination pointer, d 0 000004C0 C57604 lds si,[.dest] 539 0 000004C3 B30A mov bl,10 541 0 000004C5 EB05 jmp short domemcmp 543 544 ;****** 545 ; memcmp(BYTE *s1 , BYTE *s2, int count); 546 global MEMCMP 547 MEMCMP: 0 000004C7 E8F1FE call pascal_setup 549 550 ; all preset: Get the source pointer, ss 551 ;mov si,[bp+6] 552 553 ; and the destination pointer, d 554 ;mov di,[bp+8] 555 ;mov cx,[bp+4] 556 ;mov bl,6 0 000004CA 87F7 xchg si,di 558 559 domemcmp: 0 000004CC E304 jcxz strncmp_retzero 0 000004CE F3A6 repe cmpsb 0 000004D0 7504 jne strncmp_done 563 strncmp_retzero: 0 000004D2 31C0 xor ax, ax 0 000004D4 EB03 jmp short strncmp_done2 566 strncmp_done: 0 000004D6 9F lahf 0 000004D7 D0CC ror ah,1 0 000004D9 E933FF strncmp_done2: jmp pascal_return 570 571 %endif === Trace listing source: blockio.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=blockio.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc62XKBh.s output file : blockio.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:52.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _move_buffer, @function 8 _move_buffer: 9 _.LFB4: 10 .file 1 "blockio.c" 1:blockio.c **** /****************************************************************/ 2:blockio.c **** /* */ 3:blockio.c **** /* blockio.c */ 4:blockio.c **** /* DOS-C */ 5:blockio.c **** /* */ 6:blockio.c **** /* Block cache functions and device driver interface */ 7:blockio.c **** /* */ 8:blockio.c **** /* Copyright (c) 1995 */ 9:blockio.c **** /* Pasquale J. Villani */ 10:blockio.c **** /* All Rights Reserved */ 11:blockio.c **** /* */ 12:blockio.c **** /* This file is part of DOS-C. */ 13:blockio.c **** /* */ 14:blockio.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:blockio.c **** /* modify it under the terms of the GNU General Public License */ 16:blockio.c **** /* as published by the Free Software Foundation; either version */ 17:blockio.c **** /* 2, or (at your option) any later version. */ 18:blockio.c **** /* */ 19:blockio.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:blockio.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:blockio.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:blockio.c **** /* the GNU General Public License for more details. */ 23:blockio.c **** /* */ 24:blockio.c **** /* You should have received a copy of the GNU General Public */ 25:blockio.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:blockio.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:blockio.c **** /* Cambridge, MA 02139, USA. */ 28:blockio.c **** /* */ 29:blockio.c **** /****************************************************************/ 30:blockio.c **** 31:blockio.c **** #include "portab.h" 32:blockio.c **** #include "globals.h" 33:blockio.c **** 34:blockio.c **** #ifdef VERSION_STRINGS 35:blockio.c **** static BYTE *blockioRcsId = 36:blockio.c **** "$Id: blockio.c 1702 2012-02-04 08:46:16Z perditionc $"; 37:blockio.c **** #endif 38:blockio.c **** 39:blockio.c **** #define b_next(bp) ((struct buffer FAR *)(MK_FP(FP_SEG(bp), bp->b_next))) 40:blockio.c **** #define b_prev(bp) ((struct buffer FAR *)(MK_FP(FP_SEG(bp), bp->b_prev))) 41:blockio.c **** #define bufptr(fbp) ((struct buffer FAR *)(MK_FP(FP_SEG(bp), fbp))) 42:blockio.c **** 43:blockio.c **** /************************************************************************/ 44:blockio.c **** /* */ 45:blockio.c **** /* block cache routines */ 46:blockio.c **** /* */ 47:blockio.c **** /************************************************************************/ 48:blockio.c **** /* #define DISPLAY_GETBLOCK */ 49:blockio.c **** 50:blockio.c **** STATIC BOOL flush1(struct buffer FAR * bp); 51:blockio.c **** 52:blockio.c **** /* 53:blockio.c **** this searches the buffer list for the given disk/block. 54:blockio.c **** 55:blockio.c **** returns: 56:blockio.c **** a far pointer to the buffer. 57:blockio.c **** 58:blockio.c **** If the buffer is found the UNCACHE bit is not set and else it is set. 59:blockio.c **** 60:blockio.c **** new: 61:blockio.c **** upper layer may set UNCACHE attribute 62:blockio.c **** UNCACHE buffers are recycled first. 63:blockio.c **** intended to be used for full sector reads into application buffer 64:blockio.c **** resets UNCACHE upon a "HIT" -- so then this buffer will not be 65:blockio.c **** recycled anymore. 66:blockio.c **** */ 67:blockio.c **** 68:blockio.c **** STATIC void move_buffer(struct buffer FAR *bp, size_t firstbp) 69:blockio.c **** { 11 .loc 1 69 0 12 _.LVL0: 0 00001BC5 56 push si 0 00001BC6 57 push di 0 00001BC7 55 push bp 16 _.LCFI0: 0 00001BC8 89E5 mov bp, sp 18 _.LCFI1: 0 00001BCA 1E push ds 0 00001BCB 8B5E08 mov bx, word ptr [bp+8] 0 00001BCE 8B460A mov ax, word ptr [bp+10] 0 00001BD1 8B760C mov si, word ptr [bp+12] 70:blockio.c **** /* connect bp->b_prev and bp->b_next */ 71:blockio.c **** b_next(bp)->b_prev = bp->b_prev; 23 .loc 1 71 0 0 00001BD4 8EC0 mov es, ax 0 00001BD6 268B5702 mov dx, word ptr es:[bx+2] 0 00001BDA 268B3F mov di, word ptr es:[bx] 0 00001BDD 26895502 mov word ptr es:[di+2], dx 28 _.LVL1: 72:blockio.c **** b_prev(bp)->b_next = bp->b_next; 29 .loc 1 72 0 0 00001BE1 268B17 mov dx, word ptr es:[bx] 0 00001BE4 268B4F02 mov cx, word ptr es:[bx+2] 0 00001BE8 894EFE mov word ptr [bp-2], cx 0 00001BEB 89CF mov di, cx 0 00001BED 268915 mov word ptr es:[di], dx 73:blockio.c **** 74:blockio.c **** /* insert bp between firstbp and firstbp->b_prev */ 75:blockio.c **** bp->b_prev = bufptr(firstbp)->b_prev; 35 .loc 1 75 0 0 00001BF0 268B5402 mov dx, word ptr es:[si+2] 0 00001BF4 26895702 mov word ptr es:[bx+2], dx 76:blockio.c **** bp->b_next = firstbp; 38 .loc 1 76 0 0 00001BF8 268937 mov word ptr es:[bx], si 77:blockio.c **** b_next(bp)->b_prev = FP_OFF(bp); 40 .loc 1 77 0 0 00001BFB 26895C02 mov word ptr es:[si+2], bx 78:blockio.c **** b_prev(bp)->b_next = FP_OFF(bp); 42 .loc 1 78 0 0 00001BFF 268B5702 mov dx, word ptr es:[bx+2] 0 00001C03 89D7 mov di, dx 0 00001C05 26891D mov word ptr es:[di], bx 79:blockio.c **** } 46 .loc 1 79 0 0 00001C08 89EC mov sp, bp 0 00001C0A 5D pop bp 0 00001C0B 5F pop di 0 00001C0C 5E pop si 0 00001C0D C20600 ret 6 52 _.LFE4: 53 .size _move_buffer, .-_move_buffer 54 .global _setinvld 55 .type _setinvld, @function 56 _setinvld: 57 _.LFB8: 80:blockio.c **** 81:blockio.c **** STATIC struct buffer FAR *searchblock(ULONG blkno, COUNT dsk) 82:blockio.c **** { 83:blockio.c **** int fat_count = 0; 84:blockio.c **** struct buffer FAR *bp; 85:blockio.c **** size_t lastNonFat = 0; 86:blockio.c **** size_t uncacheBuf = 0; 87:blockio.c **** seg bufseg = FP_SEG(firstbuf); 88:blockio.c **** size_t firstbp = FP_OFF(firstbuf); 89:blockio.c **** 90:blockio.c **** #ifdef DISPLAY_GETBLOCK 91:blockio.c **** printf("[searchblock %d, blk %ld, buf ", dsk, blkno); 92:blockio.c **** #endif 93:blockio.c **** 94:blockio.c **** /* Search through buffers to see if the required block */ 95:blockio.c **** /* is already in a buffer */ 96:blockio.c **** 97:blockio.c **** bp = MK_FP(bufseg, firstbp); 98:blockio.c **** do 99:blockio.c **** { 100:blockio.c **** if ((bp->b_blkno == blkno) && 101:blockio.c **** (bp->b_flag & BFR_VALID) && (bp->b_unit == dsk)) 102:blockio.c **** { 103:blockio.c **** /* found it -- rearrange LRU links */ 104:blockio.c **** #ifdef DISPLAY_GETBLOCK 105:blockio.c **** printf("HIT %04x:%04x]\n", FP_SEG(bp), FP_OFF(bp)); 106:blockio.c **** #endif 107:blockio.c **** bp->b_flag &= ~BFR_UNCACHE; /* reset uncache attribute */ 108:blockio.c **** if (FP_OFF(bp) != firstbp) 109:blockio.c **** { 110:blockio.c **** *(UWORD *)&firstbuf = FP_OFF(bp); 111:blockio.c **** move_buffer(bp, firstbp); 112:blockio.c **** } 113:blockio.c **** return bp; 114:blockio.c **** } 115:blockio.c **** 116:blockio.c **** if (bp->b_flag & BFR_UNCACHE) 117:blockio.c **** uncacheBuf = FP_OFF(bp); 118:blockio.c **** 119:blockio.c **** if (bp->b_flag & BFR_FAT) 120:blockio.c **** fat_count++; 121:blockio.c **** else 122:blockio.c **** lastNonFat = FP_OFF(bp); 123:blockio.c **** bp = b_next(bp); 124:blockio.c **** } while (FP_OFF(bp) != firstbp); 125:blockio.c **** 126:blockio.c **** /* 127:blockio.c **** now take either the last buffer in chain (not used recently) 128:blockio.c **** or, if we are low on FAT buffers, the last non FAT buffer 129:blockio.c **** */ 130:blockio.c **** 131:blockio.c **** if (uncacheBuf) 132:blockio.c **** { 133:blockio.c **** bp = bufptr(uncacheBuf); 134:blockio.c **** } 135:blockio.c **** else if (bp->b_flag & BFR_FAT && fat_count < 3 && lastNonFat) 136:blockio.c **** { 137:blockio.c **** bp = bufptr(lastNonFat); 138:blockio.c **** } 139:blockio.c **** else 140:blockio.c **** { 141:blockio.c **** bp = b_prev(bufptr(firstbp)); 142:blockio.c **** } 143:blockio.c **** 144:blockio.c **** bp->b_flag |= BFR_UNCACHE; /* set uncache attribute */ 145:blockio.c **** 146:blockio.c **** #ifdef DISPLAY_GETBLOCK 147:blockio.c **** printf("MISS, replace %04x:%04x]\n", FP_SEG(bp), FP_OFF(bp)); 148:blockio.c **** #endif 149:blockio.c **** 150:blockio.c **** if (FP_OFF(bp) != firstbp) /* move to front */ 151:blockio.c **** { 152:blockio.c **** move_buffer(bp, firstbp); 153:blockio.c **** *(UWORD *)&firstbuf = FP_OFF(bp); 154:blockio.c **** } 155:blockio.c **** return bp; 156:blockio.c **** } 157:blockio.c **** 158:blockio.c **** BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk, int mode) 159:blockio.c **** { 160:blockio.c **** struct buffer FAR *bp = firstbuf; 161:blockio.c **** 162:blockio.c **** /* Search through buffers to see if the required block */ 163:blockio.c **** /* is already in a buffer */ 164:blockio.c **** 165:blockio.c **** do 166:blockio.c **** { 167:blockio.c **** if (blknolow <= bp->b_blkno && 168:blockio.c **** bp->b_blkno <= blknohigh && 169:blockio.c **** (bp->b_flag & BFR_VALID) && (bp->b_unit == dsk)) 170:blockio.c **** { 171:blockio.c **** if (mode == XFR_READ) 172:blockio.c **** flush1(bp); 173:blockio.c **** else 174:blockio.c **** bp->b_flag = 0; 175:blockio.c **** } 176:blockio.c **** bp = b_next(bp); 177:blockio.c **** } 178:blockio.c **** while (FP_OFF(bp) != FP_OFF(firstbuf)); 179:blockio.c **** 180:blockio.c **** return FALSE; 181:blockio.c **** } 182:blockio.c **** 183:blockio.c **** #if TOM 184:blockio.c **** void dumpBufferCache(void) 185:blockio.c **** { 186:blockio.c **** struct buffer FAR *bp = firstbuf; 187:blockio.c **** int printed = 0; 188:blockio.c **** 189:blockio.c **** /* Search through buffers to see if the required block */ 190:blockio.c **** /* is already in a buffer */ 191:blockio.c **** 192:blockio.c **** do 193:blockio.c **** { 194:blockio.c **** printf("%8lx %02x ", bp->b_blkno, bp->b_flag); 195:blockio.c **** if (++printed % 6 == 0) 196:blockio.c **** printf("\n"); 197:blockio.c **** bp = b_next(bp); 198:blockio.c **** } 199:blockio.c **** while (FP_OFF(bp) != FP_OFF(firstbuf)); 200:blockio.c **** printf("\n"); 201:blockio.c **** } 202:blockio.c **** #endif 203:blockio.c **** /* */ 204:blockio.c **** /* Return the address of a buffer structure containing the */ 205:blockio.c **** /* requested block. */ 206:blockio.c **** /* if overwrite is set, then no need to read first */ 207:blockio.c **** /* */ 208:blockio.c **** /* returns: */ 209:blockio.c **** /* requested block with data */ 210:blockio.c **** /* failure: */ 211:blockio.c **** /* returns NULL */ 212:blockio.c **** /* */ 213:blockio.c **** struct buffer FAR *getblk(ULONG blkno, COUNT dsk, BOOL overwrite) 214:blockio.c **** { 215:blockio.c **** /* Search through buffers to see if the required block */ 216:blockio.c **** /* is already in a buffer */ 217:blockio.c **** 218:blockio.c **** struct buffer FAR *bp = searchblock(blkno, dsk); 219:blockio.c **** 220:blockio.c **** if (!(bp->b_flag & BFR_UNCACHE)) 221:blockio.c **** { 222:blockio.c **** return bp; 223:blockio.c **** } 224:blockio.c **** 225:blockio.c **** /* The block we need is not in a buffer, we must make a buffer */ 226:blockio.c **** /* available, and fill it with the desired block */ 227:blockio.c **** 228:blockio.c **** /* take the buffer that lbp points to and flush it, then read new block. */ 229:blockio.c **** if (!flush1(bp)) 230:blockio.c **** return NULL; 231:blockio.c **** 232:blockio.c **** /* Fill the indicated disk buffer with the current track and sector */ 233:blockio.c **** 234:blockio.c **** if (!overwrite && dskxfer(dsk, blkno, bp->b_buffer, 1, DSKREAD)) 235:blockio.c **** { 236:blockio.c **** return NULL; 237:blockio.c **** } 238:blockio.c **** 239:blockio.c **** bp->b_flag = BFR_VALID | BFR_DATA; 240:blockio.c **** bp->b_unit = dsk; 241:blockio.c **** bp->b_blkno = blkno; 242:blockio.c **** 243:blockio.c **** return bp; 244:blockio.c **** } 245:blockio.c **** 246:blockio.c **** /* */ 247:blockio.c **** /* Mark all buffers for a disk as not valid */ 248:blockio.c **** /* */ 249:blockio.c **** VOID setinvld(REG COUNT dsk) 250:blockio.c **** { 58 .loc 1 250 0 59 _.LVL2: 0 00001C10 55 push bp 61 _.LCFI2: 0 00001C11 89E5 mov bp, sp 63 _.LCFI3: 251:blockio.c **** struct buffer FAR *bp = firstbuf; 64 .loc 1 251 0 0 00001C13 8B1E[0000] mov bx, word ptr [_firstbuf] 0 00001C17 8B16[0200] mov dx, word ptr [_firstbuf+2] 67 _.LVL3: 252:blockio.c **** 253:blockio.c **** do 254:blockio.c **** { 255:blockio.c **** if (bp->b_unit == dsk) 256:blockio.c **** bp->b_flag = 0; 257:blockio.c **** bp = b_next(bp); 258:blockio.c **** } 259:blockio.c **** while (FP_OFF(bp) != FP_OFF(firstbuf)); 68 .loc 1 259 0 0 00001C1B 89D9 mov cx, bx 70 _.LVL4: 71 _.L5: 255:blockio.c **** bp->b_flag = 0; 72 .loc 1 255 0 0 00001C1D 8EC2 mov es, dx 0 00001C1F 268A4704 mov al, byte ptr es:[bx+4] 0 00001C23 98 cbw 0 00001C24 3B4604 cmp ax, word ptr [bp+4] 0 00001C27 7505 jne _.L4 256:blockio.c **** bp = b_next(bp); 78 .loc 1 256 0 0 00001C29 26C6470500 mov byte ptr es:[bx+5], 0 80 _.L4: 257:blockio.c **** } 81 .loc 1 257 0 0 00001C2E 8EC2 mov es, dx 0 00001C30 268B1F mov bx, word ptr es:[bx] 84 _.LVL5: 85 .loc 1 259 0 0 00001C33 39CB cmp bx, cx 0 00001C35 75E6 jne _.L5 88 _.LVL6: 260:blockio.c **** } 89 .loc 1 260 0 0 00001C37 5D pop bp 0 00001C38 C20200 ret 2 92 _.LFE8: 93 .size _setinvld, .-_setinvld 94 .global _dirty_buffers 95 .type _dirty_buffers, @function 96 _dirty_buffers: 97 _.LFB9: 261:blockio.c **** 262:blockio.c **** /* Check if there is at least one dirty buffer */ 263:blockio.c **** /* */ 264:blockio.c **** BOOL dirty_buffers(REG COUNT dsk) 265:blockio.c **** { 98 .loc 1 265 0 99 _.LVL7: 0 00001C3B 55 push bp 101 _.LCFI4: 0 00001C3C 89E5 mov bp, sp 103 _.LCFI5: 0 00001C3E 1E push ds 266:blockio.c **** struct buffer FAR *bp = firstbuf; 105 .loc 1 266 0 0 00001C3F 8B0E[0000] mov cx, word ptr [_firstbuf] 0 00001C43 8B16[0200] mov dx, word ptr [_firstbuf+2] 108 _.LVL8: 0 00001C47 89CB mov bx, cx 110 _.LVL9: 111 _.L11: 267:blockio.c **** 268:blockio.c **** do 269:blockio.c **** { 270:blockio.c **** if (bp->b_unit == dsk && 112 .loc 1 270 0 0 00001C49 8EC2 mov es, dx 0 00001C4B 268A4704 mov al, byte ptr es:[bx+4] 0 00001C4F 98 cbw 0 00001C50 3B4604 cmp ax, word ptr [bp+4] 0 00001C53 750D jne _.L9 118 .loc 1 270 0 is_stmt 0 discriminator 1 0 00001C55 268A4705 mov al, byte ptr es:[bx+5] 0 00001C59 8846FF mov byte ptr [bp-1], al 0 00001C5C 2460 and al, 96 0 00001C5E 3C60 cmp al, 96 0 00001C60 7411 je _.L12 124 _.L9: 271:blockio.c **** (bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY)) 272:blockio.c **** return TRUE; 273:blockio.c **** bp = b_next(bp); 125 .loc 1 273 0 is_stmt 1 0 00001C62 8EC2 mov es, dx 0 00001C64 268B1F mov bx, word ptr es:[bx] 128 _.LVL10: 274:blockio.c **** } 275:blockio.c **** while (FP_OFF(bp) != FP_OFF(firstbuf)); 129 .loc 1 275 0 0 00001C67 39CB cmp bx, cx 0 00001C69 75DE jne _.L11 132 _.LVL11: 276:blockio.c **** return FALSE; 133 .loc 1 276 0 0 00001C6B 31C0 xor ax, ax 135 _.LVL12: 136 _.L8: 277:blockio.c **** } 137 .loc 1 277 0 0 00001C6D 89EC mov sp, bp 0 00001C6F 5D pop bp 0 00001C70 C20200 ret 2 141 _.LVL13: 142 _.L12: 272:blockio.c **** bp = b_next(bp); 143 .loc 1 272 0 0 00001C73 B80100 mov ax, 1 0 00001C76 EBF5 jmp _.L8 146 _.LFE9: 147 .size _dirty_buffers, .-_dirty_buffers 148 .global _dskxfer 149 .type _dskxfer, @function 150 _dskxfer: 151 _.LFB13: 278:blockio.c **** 279:blockio.c **** /* */ 280:blockio.c **** /* */ 281:blockio.c **** /* Flush all buffers for a disk */ 282:blockio.c **** /* */ 283:blockio.c **** /* returns: */ 284:blockio.c **** /* TRUE on success */ 285:blockio.c **** /* */ 286:blockio.c **** BOOL flush_buffers(REG COUNT dsk) 287:blockio.c **** { 288:blockio.c **** struct buffer FAR *bp = firstbuf; 289:blockio.c **** REG BOOL ok = TRUE; 290:blockio.c **** 291:blockio.c **** bp = firstbuf; 292:blockio.c **** do 293:blockio.c **** { 294:blockio.c **** if (bp->b_unit == dsk) 295:blockio.c **** if (!flush1(bp)) 296:blockio.c **** ok = FALSE; 297:blockio.c **** bp = b_next(bp); 298:blockio.c **** } 299:blockio.c **** while (FP_OFF(bp) != FP_OFF(firstbuf)); 300:blockio.c **** return ok; 301:blockio.c **** } 302:blockio.c **** 303:blockio.c **** /* */ 304:blockio.c **** /* Write one disk buffer */ 305:blockio.c **** /* */ 306:blockio.c **** STATIC BOOL flush1(struct buffer FAR * bp) 307:blockio.c **** { 308:blockio.c **** BOOL ok = TRUE; 309:blockio.c **** 310:blockio.c **** if ((bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY)) 311:blockio.c **** { 312:blockio.c **** #ifdef WITHFAT32 313:blockio.c **** ULONG b_offset = 0; 314:blockio.c **** #else 315:blockio.c **** UWORD b_offset = 0; 316:blockio.c **** #endif 317:blockio.c **** UBYTE b_copies = 1; 318:blockio.c **** ULONG blkno = bp->b_blkno; 319:blockio.c **** if (bp->b_flag & BFR_FAT) 320:blockio.c **** { 321:blockio.c **** b_copies = bp->b_copies; 322:blockio.c **** b_offset = bp->b_offset; 323:blockio.c **** #ifdef WITHFAT32 324:blockio.c **** if (b_offset == 0) /* FAT32 FS */ 325:blockio.c **** b_offset = bp->b_dpbp->dpb_xfatsize; 326:blockio.c **** #endif 327:blockio.c **** } 328:blockio.c **** while (b_copies--) 329:blockio.c **** { 330:blockio.c **** if (dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE)) 331:blockio.c **** ok = FALSE; 332:blockio.c **** blkno += b_offset; 333:blockio.c **** } 334:blockio.c **** } 335:blockio.c **** bp->b_flag &= ~BFR_DIRTY; /* even if error, mark not dirty */ 336:blockio.c **** if (!ok) /* otherwise system has trouble */ 337:blockio.c **** bp->b_flag &= ~BFR_VALID; /* continuing. */ 338:blockio.c **** return ok; 339:blockio.c **** } 340:blockio.c **** 341:blockio.c **** /* */ 342:blockio.c **** /* Write all disk buffers */ 343:blockio.c **** /* */ 344:blockio.c **** BOOL flush(void) 345:blockio.c **** { 346:blockio.c **** REG struct buffer FAR *bp = firstbuf; 347:blockio.c **** REG BOOL ok; 348:blockio.c **** 349:blockio.c **** ok = TRUE; 350:blockio.c **** do 351:blockio.c **** { 352:blockio.c **** if (!flush1(bp)) 353:blockio.c **** ok = FALSE; 354:blockio.c **** bp->b_flag &= ~BFR_VALID; 355:blockio.c **** bp = b_next(bp); 356:blockio.c **** } 357:blockio.c **** while (FP_OFF(bp) != FP_OFF(firstbuf)); 358:blockio.c **** 359:blockio.c **** network_redirector(REM_FLUSHALL); 360:blockio.c **** 361:blockio.c **** return (ok); 362:blockio.c **** } 363:blockio.c **** 364:blockio.c **** /************************************************************************/ 365:blockio.c **** /* */ 366:blockio.c **** /* Device Driver Interface Functions */ 367:blockio.c **** /* */ 368:blockio.c **** /************************************************************************/ 369:blockio.c **** /* */ 370:blockio.c **** /* Transfer one or more blocks to/from disk */ 371:blockio.c **** /* */ 372:blockio.c **** 373:blockio.c **** UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, 374:blockio.c **** COUNT mode) 375:blockio.c **** { 152 .loc 1 375 0 153 _.LVL14: 0 00001C78 56 push si 0 00001C79 57 push di 0 00001C7A 55 push bp 157 _.LCFI6: 0 00001C7B 89E5 mov bp, sp 159 _.LCFI7: 0 00001C7D 83EC0E sub sp, 14 0 00001C80 C4460A les ax, dword ptr [bp+10] 0 00001C83 8946FA mov word ptr [bp-6], ax 0 00001C86 8C46F6 mov word ptr [bp-10], es 0 00001C89 C4460E les ax, dword ptr [bp+14] 0 00001C8C 8946F8 mov word ptr [bp-8], ax 0 00001C8F 8C46FC mov word ptr [bp-4], es 376:blockio.c **** register struct dpb FAR *dpbp = get_dpb(dsk); 167 .loc 1 376 0 0 00001C92 FF7608 push word ptr [bp+8] 0 00001C95 E8[FEFF] call _get_dpb 170 _.LVL15: 0 00001C98 89C6 mov si, ax 0 00001C9A 8956FE mov word ptr [bp-2], dx 173 _.LVL16: 377:blockio.c **** if (dpbp == NULL) 174 .loc 1 377 0 0 00001C9D 09D0 or ax, dx 176 _.LVL17: 0 00001C9F 85C0 test ax, ax 0 00001CA1 7503E9B401 je _.L35 378:blockio.c **** { 379:blockio.c **** return 0x0201; /* illegal command */ 380:blockio.c **** } 381:blockio.c **** 382:blockio.c **** #if TOM 383:blockio.c **** #define KeyboardShiftState() (*(BYTE FAR *)(MK_FP(0x40,0x17))) 384:blockio.c **** 385:blockio.c **** if (KeyboardShiftState() & 0x01) 386:blockio.c **** { 387:blockio.c **** printf("dskxfer:%s %x - %lx %u\n", mode == DSKWRITE ? "write" : "read", 388:blockio.c **** dsk, blkno, numblocks); 389:blockio.c **** if ((KeyboardShiftState() & 0x03) == 3) 390:blockio.c **** dumpBufferCache(); 391:blockio.c **** } 392:blockio.c **** #endif 393:blockio.c **** 394:blockio.c **** for (;;) 395:blockio.c **** { 396:blockio.c **** IoReqHdr.r_length = sizeof(request); 397:blockio.c **** IoReqHdr.r_unit = dpbp->dpb_subunit; 398:blockio.c **** 399:blockio.c **** switch (mode) 400:blockio.c **** { 401:blockio.c **** case DSKWRITE: 402:blockio.c **** if (verify_ena) 403:blockio.c **** { 404:blockio.c **** IoReqHdr.r_command = C_OUTVFY; 405:blockio.c **** break; 406:blockio.c **** } 407:blockio.c **** /* else fall through */ 408:blockio.c **** case DSKWRITEINT26: 409:blockio.c **** IoReqHdr.r_command = C_OUTPUT; 410:blockio.c **** break; 411:blockio.c **** 412:blockio.c **** case DSKREADINT25: 413:blockio.c **** case DSKREAD: 414:blockio.c **** IoReqHdr.r_command = C_INPUT; 415:blockio.c **** break; 416:blockio.c **** default: 417:blockio.c **** return 0x0100; /* illegal command */ 418:blockio.c **** } 419:blockio.c **** 420:blockio.c **** IoReqHdr.r_status = 0; 421:blockio.c **** IoReqHdr.r_meddesc = dpbp->dpb_mdb; 422:blockio.c **** IoReqHdr.r_count = numblocks; 423:blockio.c **** if ((dpbp->dpb_device->dh_attr & ATTR_HUGE) || blkno >= MAXSHORT) 424:blockio.c **** { 425:blockio.c **** IoReqHdr.r_start = HUGECOUNT; 426:blockio.c **** IoReqHdr.r_huge = blkno; 427:blockio.c **** } 428:blockio.c **** else 429:blockio.c **** IoReqHdr.r_start = (UWORD)blkno; 430:blockio.c **** /* 431:blockio.c **** * Some drivers normalise transfer address so HMA transfers are disastrous! 432:blockio.c **** * Then transfer block through xferbuf (DiskTransferBuffer doesn't work!) 433:blockio.c **** * (But this won't work for multi-block HMA transfers... are there any?) 434:blockio.c **** */ 435:blockio.c **** if (FP_SEG(buf) >= 0xa000 && numblocks == 1 && bufloc != LOC_CONV) 179 .loc 1 435 0 0 00001CA6 817EFC00A0 cmp word ptr [bp-4], -24577+1 0 00001CAB 18C9 sbb cl, cl 0 00001CAD FEC1 inc cl 0 00001CAF 837E1201 cmp word ptr [bp+18], 1 0 00001CB3 9F lahf 0 00001CB4 D0E4 shl ah, 1 0 00001CB6 99 cwd 187 _.LVL18: 0 00001CB7 88D0 mov al, dl 0 00001CB9 F6D8 neg al 0 00001CBB 88CC mov ah, cl 0 00001CBD 20C4 and ah, al 0 00001CBF 8866F5 mov byte ptr [bp-11], ah 193 _.L18: 396:blockio.c **** IoReqHdr.r_unit = dpbp->dpb_subunit; 194 .loc 1 396 0 0 00001CC2 BF[0000] mov di, offset _IoReqHdr 0 00001CC5 C606[0000]1E mov byte ptr [_IoReqHdr], 30 397:blockio.c **** 197 .loc 1 397 0 0 00001CCA 8E46FE mov es, word ptr [bp-2] 0 00001CCD 268A4401 mov al, byte ptr es:[si+1] 0 00001CD1 884501 mov byte ptr [di+1], al 399:blockio.c **** { 201 .loc 1 399 0 0 00001CD4 837E1402 cmp word ptr [bp+20], 2 0 00001CD8 741D je _.L19 0 00001CDA 7F0C jg _.L20 0 00001CDC 837E1401 cmp word ptr [bp+20], 1 0 00001CE0 741C je _.L21 207 _.L36: 417:blockio.c **** } 208 .loc 1 417 0 0 00001CE2 B80001 mov ax, 256 0 00001CE5 E91E01 jmp _.L15 211 _.L20: 399:blockio.c **** { 212 .loc 1 399 0 0 00001CE8 837E1403 cmp word ptr [bp+20], 3 0 00001CEC 7503E91D01 je _.L22 0 00001CF1 837E1404 cmp word ptr [bp+20], 4 0 00001CF5 75EB jne _.L36 217 _.L19: 414:blockio.c **** break; 218 .loc 1 414 0 0 00001CF7 C606[0200]04 mov byte ptr [_IoReqHdr+2], 4 415:blockio.c **** default: 220 .loc 1 415 0 0 00001CFC EB0F jmp _.L23 222 _.L21: 402:blockio.c **** { 223 .loc 1 402 0 0 00001CFE 803E[0000]00 cmp byte ptr [_verify_ena], 0 0 00001D03 7503E90601 je _.L22 404:blockio.c **** break; 226 .loc 1 404 0 0 00001D08 C606[0200]09 mov byte ptr [_IoReqHdr+2], 9 228 _.L23: 420:blockio.c **** IoReqHdr.r_meddesc = dpbp->dpb_mdb; 229 .loc 1 420 0 0 00001D0D C706[0300]0000 mov word ptr [_IoReqHdr+3], 0 421:blockio.c **** IoReqHdr.r_count = numblocks; 231 .loc 1 421 0 0 00001D13 8E46FE mov es, word ptr [bp-2] 0 00001D16 268A4417 mov al, byte ptr es:[si+23] 0 00001D1A 88450D mov byte ptr [di+13], al 422:blockio.c **** if ((dpbp->dpb_device->dh_attr & ATTR_HUGE) || blkno >= MAXSHORT) 235 .loc 1 422 0 0 00001D1D 8B4612 mov ax, word ptr [bp+18] 0 00001D20 894512 mov word ptr [di+18], ax 423:blockio.c **** { 238 .loc 1 423 0 0 00001D23 268B5C13 mov bx, word ptr es:[si+19] 0 00001D27 268B4415 mov ax, word ptr es:[si+21] 0 00001D2B 8946F2 mov word ptr [bp-14], ax 0 00001D2E 8EC0 mov es, ax 0 00001D30 268B4704 mov ax, word ptr es:[bx+4] 0 00001D34 D1E8 shr ax, 1 0 00001D36 83E001 and ax, 1 0 00001D39 8946F2 mov word ptr [bp-14], ax 0 00001D3C 807EF200 cmp byte ptr [bp-14], 0 0 00001D40 7403E9D100 jne _.L39 0 00001D45 837EF600 cmp word ptr [bp-10], 0 0 00001D49 7403E9C800 jne _.L39 0 00001D4E 837EFAFE cmp word ptr [bp-6], -2 0 00001D52 7603E9BF00 ja _.L39 429:blockio.c **** /* 253 .loc 1 429 0 0 00001D57 8B46FA mov ax, word ptr [bp-6] 0 00001D5A 894514 mov word ptr [di+20], ax 256 _.L28: 257 .loc 1 435 0 0 00001D5D 807EF500 cmp byte ptr [bp-11], 0 0 00001D61 7503E9C500 je _.L29 260 .loc 1 435 0 is_stmt 0 discriminator 2 0 00001D66 803E[0000]00 cmp byte ptr [_bufloc], 0 0 00001D6B 7503E9BB00 je _.L29 436:blockio.c **** { 437:blockio.c **** IoReqHdr.r_trans = deblock_buf; 263 .loc 1 437 0 is_stmt 1 0 00001D70 A1[0000] mov ax, word ptr [_deblock_buf] 0 00001D73 8B0E[0200] mov cx, word ptr [_deblock_buf+2] 0 00001D77 89450E mov word ptr [di+14], ax 0 00001D7A 894D10 mov word ptr [di+16], cx 438:blockio.c **** if (mode == DSKWRITE) 268 .loc 1 438 0 0 00001D7D 837E1401 cmp word ptr [bp+20], 1 0 00001D81 7512 jne _.L30 439:blockio.c **** fmemcpy(deblock_buf, buf, dpbp->dpb_secsize); 271 .loc 1 439 0 0 00001D83 8E46FE mov es, word ptr [bp-2] 0 00001D86 26FF7402 push word ptr es:[si+2] 0 00001D8A FF76FC push word ptr [bp-4] 0 00001D8D FF76F8 push word ptr [bp-8] 0 00001D90 51 push cx 0 00001D91 50 push ax 0 00001D92 E8[FEFF] call _fmemcpy 279 _.LVL19: 280 _.L30: 440:blockio.c **** execrh((request FAR *) & IoReqHdr, dpbp->dpb_device); 281 .loc 1 440 0 0 00001D95 8E46FE mov es, word ptr [bp-2] 0 00001D98 26FF7415 push word ptr es:[si+21] 0 00001D9C 26FF7413 push word ptr es:[si+19] 0 00001DA0 16 push ss 0 00001DA1 B8[0000] mov ax, offset _IoReqHdr 0 00001DA4 50 push ax 0 00001DA5 E8[FEFF] call _execrh 289 _.LVL20: 441:blockio.c **** if (mode == DSKREAD) 290 .loc 1 441 0 0 00001DA8 837E1402 cmp word ptr [bp+20], 2 0 00001DAC 7518 jne _.L31 442:blockio.c **** fmemcpy(buf, deblock_buf, dpbp->dpb_secsize); 293 .loc 1 442 0 0 00001DAE 8E46FE mov es, word ptr [bp-2] 0 00001DB1 26FF7402 push word ptr es:[si+2] 0 00001DB5 FF36[0200] push word ptr [_deblock_buf+2] 0 00001DB9 FF36[0000] push word ptr [_deblock_buf] 0 00001DBD FF76FC push word ptr [bp-4] 0 00001DC0 FF76F8 push word ptr [bp-8] 0 00001DC3 E8[FEFF] call _fmemcpy 301 _.LVL21: 302 _.L31: 443:blockio.c **** } 444:blockio.c **** else 445:blockio.c **** { 446:blockio.c **** IoReqHdr.r_trans = (BYTE FAR *) buf; 447:blockio.c **** execrh((request FAR *) & IoReqHdr, dpbp->dpb_device); 448:blockio.c **** } 449:blockio.c **** if ((IoReqHdr.r_status & (S_ERROR | S_DONE)) == S_DONE) 303 .loc 1 449 0 0 00001DC6 8B4503 mov ax, word ptr [di+3] 0 00001DC9 89C1 mov cx, ax 0 00001DCB 81E10081 and cx, -32512 0 00001DCF 81F90001 cmp cx, 256 0 00001DD3 7503E98700 je _.L37 450:blockio.c **** break; 451:blockio.c **** 452:blockio.c **** /* INT25/26 (_SEEMS_ TO) return immediately with 0x8002, 453:blockio.c **** if drive is not online,... 454:blockio.c **** 455:blockio.c **** normal operations (DIR) wait for ABORT/RETRY 456:blockio.c **** 457:blockio.c **** other condition codes not tested 458:blockio.c **** */ 459:blockio.c **** if (mode >= DSKWRITEINT26) 309 .loc 1 459 0 0 00001DD8 837E1402 cmp word ptr [bp+20], 2 0 00001DDC 7F28 jg _.L15 312 _.L51: 460:blockio.c **** return (IoReqHdr.r_status); 461:blockio.c **** 462:blockio.c **** loop: 463:blockio.c **** switch (block_error(&IoReqHdr, dpbp->dpb_unit, dpbp->dpb_device, mode)) 313 .loc 1 463 0 0 00001DDE FF7614 push word ptr [bp+20] 0 00001DE1 8E46FE mov es, word ptr [bp-2] 0 00001DE4 26FF7415 push word ptr es:[si+21] 0 00001DE8 26FF7413 push word ptr es:[si+19] 0 00001DEC 268A04 mov al, byte ptr es:[si] 0 00001DEF 98 cbw 0 00001DF0 50 push ax 0 00001DF1 B8[0000] mov ax, offset _IoReqHdr 0 00001DF4 50 push ax 0 00001DF5 E8[FEFF] call _block_error 324 _.LVL22: 0 00001DF8 83F801 cmp ax, 1 0 00001DFB 7503E9C2FE je _.L18 0 00001E00 7F4B jg _.L33 0 00001E02 85C0 test ax, ax 0 00001E04 75D8 jne _.L51 330 _.L15: 464:blockio.c **** { 465:blockio.c **** case ABORT: 466:blockio.c **** case FAIL: 467:blockio.c **** return (IoReqHdr.r_status); 468:blockio.c **** 469:blockio.c **** case RETRY: 470:blockio.c **** continue; 471:blockio.c **** 472:blockio.c **** case CONTINUE: 473:blockio.c **** break; 474:blockio.c **** 475:blockio.c **** default: 476:blockio.c **** goto loop; 477:blockio.c **** } 478:blockio.c **** break; 479:blockio.c **** } /* retry loop */ 480:blockio.c **** /* *** Changed 9/4/00 BER */ 481:blockio.c **** return 0; /* Success! Return 0 for a successful operation. */ 482:blockio.c **** /* End of change */ 483:blockio.c **** 484:blockio.c **** } 331 .loc 1 484 0 0 00001E06 89EC mov sp, bp 0 00001E08 5D pop bp 0 00001E09 5F pop di 0 00001E0A 5E pop si 336 _.LVL23: 0 00001E0B C20E00 ret 14 338 _.LVL24: 339 _.L22: 409:blockio.c **** break; 340 .loc 1 409 0 0 00001E0E C606[0200]08 mov byte ptr [_IoReqHdr+2], 8 410:blockio.c **** 342 .loc 1 410 0 0 00001E13 E9F7FE jmp _.L23 344 _.L39: 425:blockio.c **** IoReqHdr.r_huge = blkno; 345 .loc 1 425 0 0 00001E16 C706[1400]FFFF mov word ptr [_IoReqHdr+20], -1 426:blockio.c **** } 347 .loc 1 426 0 0 00001E1C 8B46FA mov ax, word ptr [bp-6] 0 00001E1F 89451A mov word ptr [di+26], ax 0 00001E22 8B46F6 mov ax, word ptr [bp-10] 0 00001E25 89451C mov word ptr [di+28], ax 0 00001E28 E932FF jmp _.L28 353 _.L29: 446:blockio.c **** execrh((request FAR *) & IoReqHdr, dpbp->dpb_device); 354 .loc 1 446 0 0 00001E2B 8B46F8 mov ax, word ptr [bp-8] 0 00001E2E 89450E mov word ptr [di+14], ax 0 00001E31 8B46FC mov ax, word ptr [bp-4] 0 00001E34 894510 mov word ptr [di+16], ax 447:blockio.c **** } 359 .loc 1 447 0 0 00001E37 8E46FE mov es, word ptr [bp-2] 0 00001E3A 26FF7415 push word ptr es:[si+21] 0 00001E3E 26FF7413 push word ptr es:[si+19] 0 00001E42 16 push ss 0 00001E43 B8[0000] mov ax, offset _IoReqHdr 0 00001E46 50 push ax 0 00001E47 E8[FEFF] call _execrh 367 _.LVL25: 0 00001E4A E979FF jmp _.L31 369 _.L33: 463:blockio.c **** { 370 .loc 1 463 0 0 00001E4D 83F803 cmp ax, 3 0 00001E50 7F8C jg _.L51 467:blockio.c **** 373 .loc 1 467 0 0 00001E52 BB[0000] mov bx, offset _IoReqHdr 0 00001E55 8B4703 mov ax, word ptr [bx+3] 0 00001E58 EBAC jmp _.L15 377 _.LVL26: 378 _.L35: 379:blockio.c **** } 379 .loc 1 379 0 0 00001E5A B80102 mov ax, 513 0 00001E5D EBA7 jmp _.L15 382 _.LVL27: 383 _.L37: 481:blockio.c **** /* End of change */ 384 .loc 1 481 0 0 00001E5F 31C0 xor ax, ax 0 00001E61 EBA3 jmp _.L15 387 _.LFE13: 388 .size _dskxfer, .-_dskxfer 389 .type _flush1, @function 390 _flush1: 391 _.LFB11: 307:blockio.c **** BOOL ok = TRUE; 392 .loc 1 307 0 393 _.LVL28: 0 00001E63 56 push si 0 00001E64 57 push di 0 00001E65 55 push bp 397 _.LCFI8: 0 00001E66 89E5 mov bp, sp 399 _.LCFI9: 0 00001E68 83EC0C sub sp, 12 0 00001E6B 8B5E08 mov bx, word ptr [bp+8] 0 00001E6E 8B460A mov ax, word ptr [bp+10] 0 00001E71 8946FE mov word ptr [bp-2], ax 404 _.LVL29: 310:blockio.c **** { 405 .loc 1 310 0 0 00001E74 8EC0 mov es, ax 0 00001E76 268A4705 mov al, byte ptr es:[bx+5] 0 00001E7A 8846F8 mov byte ptr [bp-8], al 0 00001E7D 2460 and al, 96 0 00001E7F 3C60 cmp al, 96 0 00001E81 7403E9A900 jne _.L66 412 _.LVL30: 413 _.LBB2: 318:blockio.c **** if (bp->b_flag & BFR_FAT) 414 .loc 1 318 0 0 00001E86 268B4706 mov ax, word ptr es:[bx+6] 0 00001E8A 8946FC mov word ptr [bp-4], ax 0 00001E8D 268B4708 mov ax, word ptr es:[bx+8] 0 00001E91 8946FA mov word ptr [bp-6], ax 419 _.LVL31: 319:blockio.c **** { 420 .loc 1 319 0 0 00001E94 F646F802 test byte ptr [bp-8], 2 0 00001E98 744D je _.L67 321:blockio.c **** b_offset = bp->b_offset; 423 .loc 1 321 0 0 00001E9A 268A570A mov dl, byte ptr es:[bx+10] 425 _.LVL32: 322:blockio.c **** #ifdef WITHFAT32 426 .loc 1 322 0 0 00001E9E 268B7F0B mov di, word ptr es:[bx+11] 0 00001EA2 31F6 xor si, si 429 _.LVL33: 324:blockio.c **** b_offset = bp->b_dpbp->dpb_xfatsize; 430 .loc 1 324 0 0 00001EA4 85FF test di, di 0 00001EA6 751E jne _.L60 325:blockio.c **** #endif 433 .loc 1 325 0 0 00001EA8 268B470D mov ax, word ptr es:[bx+13] 435 _.LVL34: 0 00001EAC 8946F8 mov word ptr [bp-8], ax 0 00001EAF 268B470F mov ax, word ptr es:[bx+15] 0 00001EB3 8946F6 mov word ptr [bp-10], ax 0 00001EB6 8EC0 mov es, ax 0 00001EB8 8B7EF8 mov di, word ptr [bp-8] 441 _.LVL35: 0 00001EBB 268B7D31 mov di, word ptr es:[di+49] 0 00001EBF 8B76F8 mov si, word ptr [bp-8] 0 00001EC2 268B7433 mov si, word ptr es:[si+51] 445 _.LVL36: 446 _.L60: 331:blockio.c **** blkno += b_offset; 447 .loc 1 331 0 0 00001EC6 B90100 mov cx, 1 449 _.LVL37: 450 _.L61: 328:blockio.c **** { 451 .loc 1 328 0 0 00001EC9 84D2 test dl, dl 0 00001ECB 7522 jne _.L63 454 _.LVL38: 455 _.L59: 456 _.LBE2: 335:blockio.c **** if (!ok) /* otherwise system has trouble */ 457 .loc 1 335 0 0 00001ECD 8E46FE mov es, word ptr [bp-2] 0 00001ED0 268A4705 mov al, byte ptr es:[bx+5] 336:blockio.c **** bp->b_flag &= ~BFR_VALID; /* continuing. */ 460 .loc 1 336 0 0 00001ED4 85C9 test cx, cx 0 00001ED6 745C je _.L64 335:blockio.c **** if (!ok) /* otherwise system has trouble */ 463 .loc 1 335 0 0 00001ED8 24BF and al, -65 465 _.L72: 337:blockio.c **** return ok; 466 .loc 1 337 0 0 00001EDA 26884705 mov byte ptr es:[bx+5], al 468 _.LVL39: 339:blockio.c **** 469 .loc 1 339 0 0 00001EDE 91 xchg cx, ax 0 00001EDF 89EC mov sp, bp 0 00001EE1 5D pop bp 0 00001EE2 5F pop di 0 00001EE3 5E pop si 0 00001EE4 C20400 ret 4 476 _.LVL40: 477 _.L67: 478 _.LBB3: 317:blockio.c **** ULONG blkno = bp->b_blkno; 479 .loc 1 317 0 0 00001EE7 B201 mov dl, 1 313:blockio.c **** #else 481 .loc 1 313 0 0 00001EE9 31FF xor di, di 0 00001EEB 89FE mov si, di 0 00001EED EBD7 jmp _.L60 485 _.LVL41: 486 _.L63: 0 00001EEF 894EF4 mov word ptr [bp-12], cx 0 00001EF2 8856F6 mov byte ptr [bp-10], dl 489 _.LVL42: 330:blockio.c **** ok = FALSE; 490 .loc 1 330 0 0 00001EF5 B80100 mov ax, 1 0 00001EF8 50 push ax 0 00001EF9 50 push ax 0 00001EFA 8D4714 lea ax, [20+bx] 0 00001EFD FF76FE push word ptr [bp-2] 0 00001F00 50 push ax 0 00001F01 FF76FA push word ptr [bp-6] 0 00001F04 FF76FC push word ptr [bp-4] 0 00001F07 8E46FE mov es, word ptr [bp-2] 0 00001F0A 268A4704 mov al, byte ptr es:[bx+4] 0 00001F0E 895EF8 mov word ptr [bp-8], bx 0 00001F11 98 cbw 0 00001F12 50 push ax 0 00001F13 E8[FEFF] call _dskxfer 505 _.LVL43: 0 00001F16 85C0 test ax, ax 0 00001F18 8B5EF8 mov bx, word ptr [bp-8] 0 00001F1B 8A56F6 mov dl, byte ptr [bp-10] 0 00001F1E 8B4EF4 mov cx, word ptr [bp-12] 0 00001F21 7402 je _.L62 331:blockio.c **** blkno += b_offset; 511 .loc 1 331 0 0 00001F23 31C9 xor cx, cx 513 _.L62: 514 _.LVL44: 332:blockio.c **** } 515 .loc 1 332 0 0 00001F25 017EFC add word ptr [bp-4], di 517 _.LVL45: 0 00001F28 1176FA adc word ptr [bp-6], si 519 _.LVL46: 0 00001F2B FECA dec dl 0 00001F2D EB9A jmp _.L61 522 _.LVL47: 523 _.L66: 524 _.LBE3: 308:blockio.c **** 525 .loc 1 308 0 0 00001F2F B90100 mov cx, 1 0 00001F32 EB99 jmp _.L59 528 _.LVL48: 529 _.L64: 337:blockio.c **** return ok; 530 .loc 1 337 0 0 00001F34 249F and al, -97 0 00001F36 8E46FE mov es, word ptr [bp-2] 0 00001F39 EB9F jmp _.L72 534 _.LFE11: 535 .size _flush1, .-_flush1 536 .global _DeleteBlockInBufferCache 537 .type _DeleteBlockInBufferCache, @function 538 _DeleteBlockInBufferCache: 539 _.LFB6: 159:blockio.c **** struct buffer FAR *bp = firstbuf; 540 .loc 1 159 0 541 _.LVL49: 0 00001F3B 56 push si 0 00001F3C 57 push di 0 00001F3D 55 push bp 545 _.LCFI10: 0 00001F3E 89E5 mov bp, sp 547 _.LCFI11: 0 00001F40 83EC08 sub sp, 8 0 00001F43 8B7E08 mov di, word ptr [bp+8] 0 00001F46 8B760A mov si, word ptr [bp+10] 0 00001F49 C4460C les ax, dword ptr [bp+12] 0 00001F4C 8946FC mov word ptr [bp-4], ax 0 00001F4F 8C46FA mov word ptr [bp-6], es 160:blockio.c **** 554 .loc 1 160 0 0 00001F52 8B1E[0000] mov bx, word ptr [_firstbuf] 0 00001F56 A1[0200] mov ax, word ptr [_firstbuf+2] 0 00001F59 8946FE mov word ptr [bp-2], ax 558 _.LVL50: 559 _.L80: 167:blockio.c **** bp->b_blkno <= blknohigh && 560 .loc 1 167 0 0 00001F5C 8E46FE mov es, word ptr [bp-2] 0 00001F5F 268B4706 mov ax, word ptr es:[bx+6] 0 00001F63 268B5708 mov dx, word ptr es:[bx+8] 0 00001F67 3B56FA cmp dx, word ptr [bp-6] 0 00001F6A 7736 ja _.L74 0 00001F6C 7505 jne _.L84 0 00001F6E 3B46FC cmp ax, word ptr [bp-4] 0 00001F71 772F ja _.L74 569 _.L84: 0 00001F73 39D6 cmp si, dx 0 00001F75 772B ja _.L74 0 00001F77 7504 jne _.L85 0 00001F79 39C7 cmp di, ax 0 00001F7B 7725 ja _.L74 575 _.L85: 168:blockio.c **** (bp->b_flag & BFR_VALID) && (bp->b_unit == dsk)) 576 .loc 1 168 0 0 00001F7D 8E46FE mov es, word ptr [bp-2] 0 00001F80 26F6470520 test byte ptr es:[bx+5], 32 0 00001F85 741B je _.L74 169:blockio.c **** { 580 .loc 1 169 0 0 00001F87 268A4704 mov al, byte ptr es:[bx+4] 0 00001F8B 98 cbw 0 00001F8C 3B4610 cmp ax, word ptr [bp+16] 0 00001F8F 7511 jne _.L74 171:blockio.c **** flush1(bp); 585 .loc 1 171 0 0 00001F91 837E1201 cmp word ptr [bp+18], 1 0 00001F95 7521 jne _.L79 172:blockio.c **** else 588 .loc 1 172 0 0 00001F97 06 push es 0 00001F98 53 push bx 0 00001F99 895EF8 mov word ptr [bp-8], bx 0 00001F9C E8C4FE call _flush1 593 _.LVL51: 0 00001F9F 8B5EF8 mov bx, word ptr [bp-8] 595 _.LVL52: 596 _.L74: 176:blockio.c **** } 597 .loc 1 176 0 0 00001FA2 8E46FE mov es, word ptr [bp-2] 0 00001FA5 268B1F mov bx, word ptr es:[bx] 600 _.LVL53: 178:blockio.c **** 601 .loc 1 178 0 0 00001FA8 391E[0000] cmp word ptr [_firstbuf], bx 0 00001FAC 75AE jne _.L80 181:blockio.c **** 604 .loc 1 181 0 0 00001FAE 31C0 xor ax, ax 0 00001FB0 89EC mov sp, bp 0 00001FB2 5D pop bp 0 00001FB3 5F pop di 0 00001FB4 5E pop si 0 00001FB5 C20C00 ret 12 611 _.LVL54: 612 _.L79: 174:blockio.c **** } 613 .loc 1 174 0 0 00001FB8 8E46FE mov es, word ptr [bp-2] 0 00001FBB 26C6470500 mov byte ptr es:[bx+5], 0 616 _.LVL55: 0 00001FC0 EBE0 jmp _.L74 618 _.LFE6: 619 .size _DeleteBlockInBufferCache, .-_DeleteBlockInBufferCache 620 .global _flush_buffers 621 .type _flush_buffers, @function 622 _flush_buffers: 623 _.LFB10: 287:blockio.c **** struct buffer FAR *bp = firstbuf; 624 .loc 1 287 0 625 _.LVL56: 0 00001FC2 56 push si 0 00001FC3 57 push di 0 00001FC4 55 push bp 629 _.LCFI12: 0 00001FC5 89E5 mov bp, sp 631 _.LCFI13: 0 00001FC7 1E push ds 288:blockio.c **** REG BOOL ok = TRUE; 633 .loc 1 288 0 0 00001FC8 8B1E[0000] mov bx, word ptr [_firstbuf] 0 00001FCC 8B36[0200] mov si, word ptr [_firstbuf+2] 636 _.LVL57: 289:blockio.c **** 637 .loc 1 289 0 0 00001FD0 BF0100 mov di, 1 639 _.LVL58: 640 _.L94: 294:blockio.c **** if (!flush1(bp)) 641 .loc 1 294 0 0 00001FD3 8EC6 mov es, si 0 00001FD5 268A4704 mov al, byte ptr es:[bx+4] 0 00001FD9 98 cbw 0 00001FDA 3B4608 cmp ax, word ptr [bp+8] 0 00001FDD 7510 jne _.L93 295:blockio.c **** ok = FALSE; 647 .loc 1 295 0 0 00001FDF 56 push si 0 00001FE0 53 push bx 0 00001FE1 895EFE mov word ptr [bp-2], bx 0 00001FE4 E87CFE call _flush1 652 _.LVL59: 0 00001FE7 85C0 test ax, ax 0 00001FE9 8B5EFE mov bx, word ptr [bp-2] 0 00001FEC 7501 jne _.L93 296:blockio.c **** bp = b_next(bp); 656 .loc 1 296 0 0 00001FEE 97 xchg di, ax 658 _.LVL60: 659 _.L93: 297:blockio.c **** } 660 .loc 1 297 0 0 00001FEF 8EC6 mov es, si 0 00001FF1 268B1F mov bx, word ptr es:[bx] 663 _.LVL61: 299:blockio.c **** return ok; 664 .loc 1 299 0 0 00001FF4 391E[0000] cmp word ptr [_firstbuf], bx 0 00001FF8 75D9 jne _.L94 667 _.LVL62: 301:blockio.c **** 668 .loc 1 301 0 0 00001FFA 97 xchg di, ax 0 00001FFB 89EC mov sp, bp 0 00001FFD 5D pop bp 0 00001FFE 5F pop di 673 _.LVL63: 0 00001FFF 5E pop si 675 _.LVL64: 0 00002000 C20200 ret 2 677 _.LFE10: 678 .size _flush_buffers, .-_flush_buffers 679 .global _flush 680 .type _flush, @function 681 _flush: 682 _.LFB12: 345:blockio.c **** REG struct buffer FAR *bp = firstbuf; 683 .loc 1 345 0 0 00002003 56 push si 0 00002004 57 push di 0 00002005 55 push bp 687 _.LCFI14: 0 00002006 89E5 mov bp, sp 689 _.LCFI15: 0 00002008 1E push ds 346:blockio.c **** REG BOOL ok; 691 .loc 1 346 0 0 00002009 8B1E[0000] mov bx, word ptr [_firstbuf] 0 0000200D 8B3E[0200] mov di, word ptr [_firstbuf+2] 694 _.LVL65: 349:blockio.c **** do 695 .loc 1 349 0 0 00002011 BE0100 mov si, 1 697 _.LVL66: 698 _.L99: 352:blockio.c **** ok = FALSE; 699 .loc 1 352 0 0 00002014 57 push di 0 00002015 53 push bx 0 00002016 895EFE mov word ptr [bp-2], bx 0 00002019 E847FE call _flush1 704 _.LVL67: 0 0000201C 85C0 test ax, ax 0 0000201E 8B5EFE mov bx, word ptr [bp-2] 0 00002021 7501 jne _.L98 353:blockio.c **** bp->b_flag &= ~BFR_VALID; 708 .loc 1 353 0 0 00002023 96 xchg si, ax 710 _.LVL68: 711 _.L98: 354:blockio.c **** bp = b_next(bp); 712 .loc 1 354 0 0 00002024 8EC7 mov es, di 0 00002026 26806705DF and byte ptr es:[bx+5], -33 715 _.LVL69: 355:blockio.c **** } 716 .loc 1 355 0 0 0000202B 268B1F mov bx, word ptr es:[bx] 718 _.LVL70: 357:blockio.c **** 719 .loc 1 357 0 0 0000202E 391E[0000] cmp word ptr [_firstbuf], bx 0 00002032 75E0 jne _.L99 722 _.LVL71: 359:blockio.c **** 723 .loc 1 359 0 0 00002034 B82011 mov ax, 4384 0 00002037 50 push ax 0 00002038 E8[FEFF] call _network_redirector 727 _.LVL72: 362:blockio.c **** 728 .loc 1 362 0 0 0000203B 96 xchg si, ax 0 0000203C 89EC mov sp, bp 0 0000203E 5D pop bp 0 0000203F 5F pop di 0 00002040 5E pop si 734 _.LVL73: 0 00002041 C3 ret 736 _.LFE12: 737 .size _flush, .-_flush 738 .global _getblk 739 .type _getblk, @function 740 _getblk: 741 _.LFB7: 214:blockio.c **** /* Search through buffers to see if the required block */ 742 .loc 1 214 0 743 _.LVL74: 0 00002042 56 push si 0 00002043 57 push di 0 00002044 55 push bp 747 _.LCFI16: 0 00002045 89E5 mov bp, sp 749 _.LCFI17: 0 00002047 83EC0A sub sp, 10 0 0000204A C44608 les ax, dword ptr [bp+8] 0 0000204D 8946FA mov word ptr [bp-6], ax 0 00002050 8C46F8 mov word ptr [bp-8], es 754 _.LVL75: 755 _.LBB6: 756 _.LBB7: 87:blockio.c **** size_t firstbp = FP_OFF(firstbuf); 757 .loc 1 87 0 0 00002053 8B1E[0000] mov bx, word ptr [_firstbuf] 0 00002057 8B3E[0200] mov di, word ptr [_firstbuf+2] 760 _.LVL76: 97:blockio.c **** do 761 .loc 1 97 0 0 0000205B 89DE mov si, bx 0 0000205D 89FA mov dx, di 764 _.LVL77: 86:blockio.c **** seg bufseg = FP_SEG(firstbuf); 765 .loc 1 86 0 0 0000205F 31C9 xor cx, cx 85:blockio.c **** size_t uncacheBuf = 0; 767 .loc 1 85 0 0 00002061 894EFC mov word ptr [bp-4], cx 83:blockio.c **** struct buffer FAR *bp; 769 .loc 1 83 0 0 00002064 894EF6 mov word ptr [bp-10], cx 771 _.LVL78: 772 _.L108: 100:blockio.c **** (bp->b_flag & BFR_VALID) && (bp->b_unit == dsk)) 773 .loc 1 100 0 0 00002067 8EC7 mov es, di 0 00002069 8B46FA mov ax, word ptr [bp-6] 0 0000206C 26394406 cmp word ptr es:[si+6], ax 0 00002070 268A4405 mov al, byte ptr es:[si+5] 0 00002074 8846FE mov byte ptr [bp-2], al 0 00002077 755B jne _.L103 780 _.LVL79: 0 00002079 8B46F8 mov ax, word ptr [bp-8] 0 0000207C 26394408 cmp word ptr es:[si+8], ax 0 00002080 7552 jne _.L103 0 00002082 F646FE20 test byte ptr [bp-2], 32 0 00002086 744C je _.L103 101:blockio.c **** { 786 .loc 1 101 0 0 00002088 268A4404 mov al, byte ptr es:[si+4] 0 0000208C 98 cbw 0 0000208D 39460C cmp word ptr [bp+12], ax 0 00002090 7542 jne _.L103 107:blockio.c **** if (FP_OFF(bp) != firstbp) 791 .loc 1 107 0 0 00002092 8A46FE mov al, byte ptr [bp-2] 0 00002095 24FE and al, -2 0 00002097 26884405 mov byte ptr es:[si+5], al 795 _.LVL80: 108:blockio.c **** { 796 .loc 1 108 0 0 0000209B 39F3 cmp bx, si 0 0000209D 7410 je _.L104 0 0000209F 8956FE mov word ptr [bp-2], dx 110:blockio.c **** move_buffer(bp, firstbp); 800 .loc 1 110 0 0 000020A2 8936[0000] mov word ptr [_firstbuf], si 111:blockio.c **** } 802 .loc 1 111 0 0 000020A6 53 push bx 0 000020A7 57 push di 0 000020A8 56 push si 0 000020A9 E819FB call _move_buffer 807 _.LVL81: 808 _.L139: 153:blockio.c **** } 809 .loc 1 153 0 0 000020AC 8B56FE mov dx, word ptr [bp-2] 811 _.L104: 812 _.LBE7: 813 _.LBE6: 220:blockio.c **** { 814 .loc 1 220 0 0 000020AF 8EC7 mov es, di 0 000020B1 26F6440501 test byte ptr es:[si+5], 1 0 000020B6 7413 je _.L102 0 000020B8 8956FE mov word ptr [bp-2], dx 229:blockio.c **** return NULL; 819 .loc 1 229 0 0 000020BB 57 push di 0 000020BC 56 push si 0 000020BD E8A3FD call _flush1 823 _.LVL82: 0 000020C0 85C0 test ax, ax 0 000020C2 8B56FE mov dx, word ptr [bp-2] 0 000020C5 7571 jne _.L114 827 _.L116: 230:blockio.c **** 828 .loc 1 230 0 0 000020C7 31F6 xor si, si 0 000020C9 89F2 mov dx, si 831 _.L102: 244:blockio.c **** 832 .loc 1 244 0 0 000020CB 96 xchg si, ax 0 000020CC 89EC mov sp, bp 0 000020CE 5D pop bp 0 000020CF 5F pop di 0 000020D0 5E pop si 0 000020D1 C20800 ret 8 839 _.LVL83: 840 _.L103: 841 _.LBB9: 842 _.LBB8: 116:blockio.c **** uncacheBuf = FP_OFF(bp); 843 .loc 1 116 0 0 000020D4 F646FE01 test byte ptr [bp-2], 1 0 000020D8 7402 je _.L105 846 _.LVL84: 117:blockio.c **** 847 .loc 1 117 0 0 000020DA 89F1 mov cx, si 849 _.LVL85: 850 _.L105: 119:blockio.c **** fat_count++; 851 .loc 1 119 0 0 000020DC F646FE02 test byte ptr [bp-2], 2 0 000020E0 7449 je _.L106 120:blockio.c **** else 854 .loc 1 120 0 0 000020E2 FF46F6 inc word ptr [bp-10] 856 _.LVL86: 857 _.L107: 123:blockio.c **** } while (FP_OFF(bp) != firstbp); 858 .loc 1 123 0 0 000020E5 8EC7 mov es, di 0 000020E7 268B34 mov si, word ptr es:[si] 861 _.LVL87: 124:blockio.c **** 862 .loc 1 124 0 0 000020EA 39F3 cmp bx, si 0 000020EC 7403E976FF jne _.L108 133:blockio.c **** } 865 .loc 1 133 0 0 000020F1 89CE mov si, cx 867 _.LVL88: 131:blockio.c **** { 868 .loc 1 131 0 0 000020F3 85C9 test cx, cx 0 000020F5 751A jne _.L110 135:blockio.c **** { 871 .loc 1 135 0 0 000020F7 8EC7 mov es, di 0 000020F9 26F6470502 test byte ptr es:[bx+5], 2 0 000020FE 7430 je _.L111 0 00002100 837EF602 cmp word ptr [bp-10], 2 0 00002104 7F2A jg _.L111 0 00002106 837EFC01 cmp word ptr [bp-4], 1 0 0000210A 7224 jc _.L111 137:blockio.c **** } 879 .loc 1 137 0 0 0000210C 8B76FC mov si, word ptr [bp-4] 881 _.L138: 141:blockio.c **** } 882 .loc 1 141 0 0 0000210F 89FA mov dx, di 884 _.LVL89: 885 _.L110: 144:blockio.c **** 886 .loc 1 144 0 0 00002111 8EC7 mov es, di 0 00002113 26804C0501 or byte ptr es:[si+5], 1 889 _.LVL90: 150:blockio.c **** { 890 .loc 1 150 0 0 00002118 39F3 cmp bx, si 0 0000211A 7493 je _.L104 0 0000211C 8956FE mov word ptr [bp-2], dx 152:blockio.c **** *(UWORD *)&firstbuf = FP_OFF(bp); 894 .loc 1 152 0 0 0000211F 53 push bx 0 00002120 57 push di 0 00002121 56 push si 0 00002122 E8A0FA call _move_buffer 899 _.LVL91: 153:blockio.c **** } 900 .loc 1 153 0 0 00002125 8936[0000] mov word ptr [_firstbuf], si 0 00002129 EB81 jmp _.L139 903 _.LVL92: 904 _.L106: 122:blockio.c **** bp = b_next(bp); 905 .loc 1 122 0 0 0000212B 8976FC mov word ptr [bp-4], si 0 0000212E EBB5 jmp _.L107 908 _.LVL93: 909 _.L111: 141:blockio.c **** } 910 .loc 1 141 0 0 00002130 8EC7 mov es, di 0 00002132 268B7702 mov si, word ptr es:[bx+2] 0 00002136 EBD7 jmp _.L138 914 _.LVL94: 915 _.L114: 916 _.LBE8: 917 _.LBE9: 234:blockio.c **** { 918 .loc 1 234 0 0 00002138 837E0E00 cmp word ptr [bp+14], 0 0 0000213C 741F je _.L115 921 _.L117: 239:blockio.c **** bp->b_unit = dsk; 922 .loc 1 239 0 0 0000213E 8EC7 mov es, di 0 00002140 26C6440528 mov byte ptr es:[si+5], 40 240:blockio.c **** bp->b_blkno = blkno; 925 .loc 1 240 0 0 00002145 8A460C mov al, byte ptr [bp+12] 0 00002148 26884404 mov byte ptr es:[si+4], al 241:blockio.c **** 928 .loc 1 241 0 0 0000214C 8B46FA mov ax, word ptr [bp-6] 0 0000214F 26894406 mov word ptr es:[si+6], ax 0 00002153 8B46F8 mov ax, word ptr [bp-8] 0 00002156 26894408 mov word ptr es:[si+8], ax 243:blockio.c **** } 933 .loc 1 243 0 0 0000215A E96EFF jmp _.L102 935 _.L115: 0 0000215D 8956FE mov word ptr [bp-2], dx 234:blockio.c **** { 937 .loc 1 234 0 discriminator 1 0 00002160 B80200 mov ax, 2 0 00002163 50 push ax 0 00002164 B80100 mov ax, 1 0 00002167 50 push ax 0 00002168 8D4414 lea ax, [20+si] 0 0000216B 57 push di 0 0000216C 50 push ax 0 0000216D FF76F8 push word ptr [bp-8] 0 00002170 FF76FA push word ptr [bp-6] 0 00002173 FF760C push word ptr [bp+12] 0 00002176 E8[FEFF] call _dskxfer 949 _.LVL95: 0 00002179 85C0 test ax, ax 0 0000217B 8B56FE mov dx, word ptr [bp-2] 0 0000217E 74BE je _.L117 0 00002180 E944FF jmp _.L116 954 _.LFE7: 955 .size _getblk, .-_getblk 956 .global _AllocateHMASpace 957 .type _AllocateHMASpace, @function 958 _AllocateHMASpace: 959 _.LFB14: 485:blockio.c **** 486:blockio.c **** /* 487:blockio.c **** this removes any (additionally allocated) buffers 488:blockio.c **** from the HMA buffer chain, because they get allocated to the 'user' 489:blockio.c **** */ 490:blockio.c **** 491:blockio.c **** void AllocateHMASpace (size_t lowbuffer, size_t highbuffer) 492:blockio.c **** { 960 .loc 1 492 0 961 _.LVL96: 0 00002183 56 push si 0 00002184 57 push di 0 00002185 55 push bp 965 _.LCFI18: 0 00002186 89E5 mov bp, sp 967 _.LCFI19: 0 00002188 1E push ds 0 00002189 1E push ds 493:blockio.c **** REG struct buffer FAR *bp = firstbuf; 970 .loc 1 493 0 0 0000218A 8B1E[0000] mov bx, word ptr [_firstbuf] 0 0000218E 8B36[0200] mov si, word ptr [_firstbuf+2] 973 _.LVL97: 494:blockio.c **** int n; 495:blockio.c **** 496:blockio.c **** if (FP_SEG(bp) != 0xffff) 974 .loc 1 496 0 0 00002192 83FEFF cmp si, -1 0 00002195 755B jne _.L140 497:blockio.c **** return; 498:blockio.c **** 499:blockio.c **** n = LoL_nbuffers; 977 .loc 1 499 0 0 00002197 8B16[0000] mov dx, word ptr [_LoL_nbuffers] 979 _.LVL98: 980 _.L144: 500:blockio.c **** do 501:blockio.c **** { 502:blockio.c **** /* check if buffer intersects with requested area */ 503:blockio.c **** if (FP_OFF(bp) <= highbuffer && FP_OFF(bp+1) > lowbuffer) 981 .loc 1 503 0 0 0000219B 3B5E0A cmp bx, word ptr [bp+10] 0 0000219E 774A ja _.L142 984 .loc 1 503 0 is_stmt 0 discriminator 1 0 000021A0 8D871402 lea ax, [532+bx] 0 000021A4 3B4608 cmp ax, word ptr [bp+8] 0 000021A7 7641 jbe _.L142 0 000021A9 8956FC mov word ptr [bp-4], dx 504:blockio.c **** { 505:blockio.c **** flush1(bp); 989 .loc 1 505 0 is_stmt 1 0 000021AC 56 push si 0 000021AD 53 push bx 0 000021AE 895EFE mov word ptr [bp-2], bx 0 000021B1 E8AFFC call _flush1 994 _.LVL99: 506:blockio.c **** /* unlink bp from buffer chain */ 507:blockio.c **** 508:blockio.c **** b_prev(bp)->b_next = bp->b_next; 995 .loc 1 508 0 0 000021B4 8EC6 mov es, si 0 000021B6 8B5EFE mov bx, word ptr [bp-2] 0 000021B9 268B07 mov ax, word ptr es:[bx] 0 000021BC 268B5702 mov dx, word ptr es:[bx+2] 0 000021C0 8956FE mov word ptr [bp-2], dx 1001 _.LVL100: 0 000021C3 89D7 mov di, dx 0 000021C5 268905 mov word ptr es:[di], ax 1004 _.LVL101: 509:blockio.c **** b_next(bp)->b_prev = bp->b_prev; 1005 .loc 1 509 0 0 000021C8 268B4702 mov ax, word ptr es:[bx+2] 0 000021CC 268B3F mov di, word ptr es:[bx] 0 000021CF 26894502 mov word ptr es:[di+2], ax 510:blockio.c **** if (FP_OFF(bp) == FP_OFF(firstbuf)) 1009 .loc 1 510 0 0 000021D3 391E[0000] cmp word ptr [_firstbuf], bx 0 000021D7 8B56FC mov dx, word ptr [bp-4] 0 000021DA 750A jne _.L143 511:blockio.c **** firstbuf = b_next(bp); 1013 .loc 1 511 0 0 000021DC 268B07 mov ax, word ptr es:[bx] 0 000021DF A3[0000] mov word ptr [_firstbuf], ax 0 000021E2 8936[0200] mov word ptr [_firstbuf+2], si 1017 _.L143: 512:blockio.c **** LoL_nbuffers--; 1018 .loc 1 512 0 0 000021E6 FF0E[0000] dec word ptr [_LoL_nbuffers] 1020 _.L142: 513:blockio.c **** } 514:blockio.c **** bp = b_next(bp); 1021 .loc 1 514 0 0 000021EA 8EC6 mov es, si 0 000021EC 268B1F mov bx, word ptr es:[bx] 1024 _.LVL102: 515:blockio.c **** } 516:blockio.c **** while (--n); 1025 .loc 1 516 0 0 000021EF 4A dec dx 1027 _.LVL103: 0 000021F0 75A9 jne _.L144 1029 _.LVL104: 1030 _.L140: 517:blockio.c **** } 1031 .loc 1 517 0 0 000021F2 89EC mov sp, bp 0 000021F4 5D pop bp 0 000021F5 5F pop di 0 000021F6 5E pop si 0 000021F7 C20400 ret 4 1037 _.LFE14: 1038 .size _AllocateHMASpace, .-_AllocateHMASpace === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: break.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=break.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccoCnbYO.s output file : break.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _ctrl_break_pressed 8 .type _ctrl_break_pressed, @function 9 _ctrl_break_pressed: 10 _.LFB4: 11 .file 1 "break.c" 1:break.c **** /****************************************************************/ 2:break.c **** /* */ 3:break.c **** /* break.c */ 4:break.c **** /* FreeDOS */ 5:break.c **** /* */ 6:break.c **** /* Control Break detection and handling */ 7:break.c **** /* */ 8:break.c **** /* Copyright (c) 1999 */ 9:break.c **** /* Steffen Kaiser */ 10:break.c **** /* All Rights Reserved */ 11:break.c **** /* */ 12:break.c **** /* This file is part of DOS-C. */ 13:break.c **** /* */ 14:break.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:break.c **** /* modify it under the terms of the GNU General Public License */ 16:break.c **** /* as published by the Free Software Foundation; either version */ 17:break.c **** /* 2, or (at your option) any later version. */ 18:break.c **** /* */ 19:break.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:break.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:break.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:break.c **** /* the GNU General Public License for more details. */ 23:break.c **** /* */ 24:break.c **** /* You should have received a copy of the GNU General Public */ 25:break.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:break.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:break.c **** /* Cambridge, MA 02139, USA. */ 28:break.c **** /****************************************************************/ 29:break.c **** 30:break.c **** #include "portab.h" 31:break.c **** #include "globals.h" 32:break.c **** #include "proto.h" 33:break.c **** 34:break.c **** #ifdef VERSION_STRINGS 35:break.c **** static BYTE *RcsId = 36:break.c **** "$Id: break.c 885 2004-04-14 15:40:51Z bartoldeman $"; 37:break.c **** #endif 38:break.c **** 39:break.c **** #define CB_FLG *(UBYTE FAR*)MK_FP(0x0, 0x471) 40:break.c **** #define CB_MSK 0x80 41:break.c **** 42:break.c **** /* Check for ^Break/^C. 43:break.c **** * Three sources are available: 44:break.c **** * 1) flag at 40:71 bit 7 45:break.c **** * 2) syscon stream (usually CON:) 46:break.c **** * 3) i/o stream (if unequal to syscon, e.g. AUX) 47:break.c **** */ 48:break.c **** 49:break.c **** unsigned char ctrl_break_pressed(void) 50:break.c **** { 12 .loc 1 50 0 51:break.c **** return CB_FLG & CB_MSK; 13 .loc 1 51 0 0 00002E70 31C0 xor ax, ax 0 00002E72 8EC0 mov es, ax 0 00002E74 26A07104 mov al, byte ptr es:[1137] 0 00002E78 2480 and al, -128 52:break.c **** } 18 .loc 1 52 0 0 00002E7A C3 ret 20 _.LFE4: 21 .size _ctrl_break_pressed, .-_ctrl_break_pressed === Switch to base=012BB0h -> ".RODATA.STR1.1" 22 .section .rodata.str1.1,"aMS",@progbits,1 23 _.LC0: 0 0000191A 5E430D0A00 .string "^C\r\n" === Switch to base=002270h -> ".TEXT" 25 .text 26 .global _handle_break 27 .type _handle_break, @function 28 _handle_break: 29 _.LFB6: 53:break.c **** 54:break.c **** unsigned char check_handle_break(struct dhdr FAR **pdev) 55:break.c **** { 56:break.c **** unsigned char c = CTL_C; 57:break.c **** if (!ctrl_break_pressed()) 58:break.c **** c = (unsigned char)ndread(&syscon); 59:break.c **** if (c != CTL_C && *pdev != syscon) 60:break.c **** c = (unsigned char)ndread(pdev); 61:break.c **** if (c == CTL_C) 62:break.c **** handle_break(pdev, -1); 63:break.c **** return c; 64:break.c **** } 65:break.c **** 66:break.c **** /* 67:break.c **** * Handles a ^Break state 68:break.c **** * 69:break.c **** * Actions: 70:break.c **** * 1) clear the ^Break flag 71:break.c **** * 2) clear the STDIN stream 72:break.c **** * 3) echo ^C to sft_out or pdev if sft_out==-1 73:break.c **** * 4) decrease the InDOS flag as the kernel drops back to user space 74:break.c **** * 5) invoke INT-23 and never come back 75:break.c **** */ 76:break.c **** 77:break.c **** void handle_break(struct dhdr FAR **pdev, int sft_out) 78:break.c **** { 30 .loc 1 78 0 31 _.LVL0: 0 00002E7B 56 push si 0 00002E7C 57 push di 0 00002E7D 55 push bp 35 _.LCFI0: 0 00002E7E 89E5 mov bp, sp 37 _.LCFI1: 0 00002E80 8B7E08 mov di, word ptr [bp+8] 0 00002E83 8B760A mov si, word ptr [bp+10] 40 _.LVL1: 79:break.c **** char *buf = "^C\r\n"; 80:break.c **** 81:break.c **** CB_FLG &= ~CB_MSK; /* reset the ^Break flag */ 41 .loc 1 81 0 0 00002E86 31C0 xor ax, ax 0 00002E88 8EC0 mov es, ax 0 00002E8A 26802671047F and byte ptr es:[1137], 127 45 _.LVL2: 82:break.c **** con_flush(pdev); 46 .loc 1 82 0 0 00002E90 57 push di 0 00002E91 E8[FEFF] call _con_flush 49 _.LVL3: 83:break.c **** if (sft_out == -1) 50 .loc 1 83 0 0 00002E94 83FEFF cmp si, -1 0 00002E97 BA[0000] mov dx, offset _.LC0 0 00002E9A B80400 mov ax, 4 0 00002E9D 7525 jne _.L3 84:break.c **** cooked_write(pdev, 4, buf); 55 .loc 1 84 0 0 00002E9F 16 push ss 0 00002EA0 52 push dx 0 00002EA1 50 push ax 0 00002EA2 57 push di 0 00002EA3 E8[FEFF] call _cooked_write 61 _.LVL4: 62 _.L4: 85:break.c **** else 86:break.c **** DosRWSft(sft_out, 4, buf, XFR_FORCE_WRITE); 87:break.c **** if (!ErrorMode) /* within int21_handler, InDOS is not incremented */ 63 .loc 1 87 0 0 00002EA6 803E[0000]00 cmp byte ptr [_ErrorMode], 0 0 00002EAB 750C jne _.L5 88:break.c **** if (InDOS) 66 .loc 1 88 0 0 00002EAD A0[0000] mov al, byte ptr [_InDOS] 0 00002EB0 84C0 test al, al 0 00002EB2 7405 je _.L5 89:break.c **** --InDOS; /* fail-safe */ 70 .loc 1 89 0 0 00002EB4 FEC8 dec al 0 00002EB6 A2[0000] mov byte ptr [_InDOS], al 73 _.L5: 90:break.c **** 91:break.c **** spawn_int23(); /* invoke user INT-23 and never come back */ 74 .loc 1 91 0 0 00002EB9 E8[FEFF] call _spawn_int23 76 _.LVL5: 92:break.c **** } 77 .loc 1 92 0 0 00002EBC 89EC mov sp, bp 0 00002EBE 5D pop bp 0 00002EBF 5F pop di 0 00002EC0 5E pop si 0 00002EC1 C20400 ret 4 83 _.L3: 86:break.c **** if (!ErrorMode) /* within int21_handler, InDOS is not incremented */ 84 .loc 1 86 0 0 00002EC4 B90300 mov cx, 3 0 00002EC7 51 push cx 0 00002EC8 16 push ss 0 00002EC9 52 push dx 0 00002ECA 50 push ax 0 00002ECB 56 push si 0 00002ECC E8[FEFF] call _DosRWSft 92 _.LVL6: 0 00002ECF EBD5 jmp _.L4 94 _.LFE6: 95 .size _handle_break, .-_handle_break 96 .global _check_handle_break 97 .type _check_handle_break, @function 98 _check_handle_break: 99 _.LFB5: 55:break.c **** unsigned char c = CTL_C; 100 .loc 1 55 0 101 _.LVL7: 0 00002ED1 56 push si 0 00002ED2 55 push bp 104 _.LCFI2: 0 00002ED3 89E5 mov bp, sp 106 _.LCFI3: 0 00002ED5 8B7606 mov si, word ptr [bp+6] 108 _.LVL8: 109 _.LBB4: 110 _.LBB5: 51:break.c **** } 111 .loc 1 51 0 0 00002ED8 31C0 xor ax, ax 113 _.LBE5: 114 _.LBE4: 57:break.c **** c = (unsigned char)ndread(&syscon); 115 .loc 1 57 0 0 00002EDA 8EC0 mov es, ax 0 00002EDC 26803E710400 cmp byte ptr es:[1137], 0 0 00002EE2 7911 jns _.L11 119 _.LVL9: 120 _.L13: 62:break.c **** return c; 121 .loc 1 62 0 0 00002EE4 B8FFFF mov ax, -1 0 00002EE7 50 push ax 0 00002EE8 56 push si 0 00002EE9 E8[FEFF] call _handle_break 126 _.LVL10: 0 00002EEC B003 mov al, 3 128 _.LVL11: 129 _.L10: 64:break.c **** 130 .loc 1 64 0 0 00002EEE 89EC mov sp, bp 0 00002EF0 5D pop bp 0 00002EF1 5E pop si 0 00002EF2 C20200 ret 2 135 _.LVL12: 136 _.L11: 58:break.c **** if (c != CTL_C && *pdev != syscon) 137 .loc 1 58 0 0 00002EF5 B8[0000] mov ax, offset _syscon 0 00002EF8 50 push ax 0 00002EF9 E8[FEFF] call _ndread 141 _.LVL13: 59:break.c **** c = (unsigned char)ndread(pdev); 142 .loc 1 59 0 0 00002EFC 3C03 cmp al, 3 0 00002EFE 74E4 je _.L13 59:break.c **** c = (unsigned char)ndread(pdev); 145 .loc 1 59 0 is_stmt 0 discriminator 1 0 00002F00 8B14 mov dx, word ptr [si] 0 00002F02 3B16[0000] cmp dx, word ptr [_syscon] 0 00002F06 7509 jne _.L15 0 00002F08 8B5402 mov dx, word ptr [si+2] 0 00002F0B 3B16[0200] cmp dx, word ptr [_syscon+2] 0 00002F0F 74DD je _.L10 152 _.L15: 60:break.c **** if (c == CTL_C) 153 .loc 1 60 0 is_stmt 1 0 00002F11 56 push si 0 00002F12 E8[FEFF] call _ndread 156 _.LVL14: 61:break.c **** handle_break(pdev, -1); 157 .loc 1 61 0 0 00002F15 3C03 cmp al, 3 0 00002F17 75D5 jne _.L10 0 00002F19 EBC9 jmp _.L13 161 _.LFE5: 162 .size _check_handle_break, .-_check_handle_break === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: chario.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=chario.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccQ67ZqE.s output file : chario.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _CharRequest.isra.0, @function 8 _CharRequest.isra.0: 9 _.LFB28: 10 .file 1 "chario.c" 1:chario.c **** /****************************************************************/ 2:chario.c **** /* */ 3:chario.c **** /* chario.c */ 4:chario.c **** /* DOS-C */ 5:chario.c **** /* */ 6:chario.c **** /* Character device functions and device driver interface */ 7:chario.c **** /* */ 8:chario.c **** /* Copyright (c) 1994 */ 9:chario.c **** /* Pasquale J. Villani */ 10:chario.c **** /* All Rights Reserved */ 11:chario.c **** /* */ 12:chario.c **** /* This file is part of DOS-C. */ 13:chario.c **** /* */ 14:chario.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:chario.c **** /* modify it under the terms of the GNU General Public License */ 16:chario.c **** /* as published by the Free Software Foundation; either version */ 17:chario.c **** /* 2, or (at your option) any later version. */ 18:chario.c **** /* */ 19:chario.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:chario.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:chario.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:chario.c **** /* the GNU General Public License for more details. */ 23:chario.c **** /* */ 24:chario.c **** /* You should have received a copy of the GNU General Public */ 25:chario.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:chario.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:chario.c **** /* Cambridge, MA 02139, USA. */ 28:chario.c **** /* */ 29:chario.c **** /****************************************************************/ 30:chario.c **** 31:chario.c **** #include "portab.h" 32:chario.c **** 33:chario.c **** #ifdef VERSION_STRINGS 34:chario.c **** static BYTE *charioRcsId = 35:chario.c **** "$Id: chario.c 1413 2009-06-01 13:41:03Z bartoldeman $"; 36:chario.c **** #endif 37:chario.c **** 38:chario.c **** #include "globals.h" 39:chario.c **** 40:chario.c **** STATIC int CharRequest(struct dhdr FAR **pdev, unsigned command) 11 .loc 1 40 0 12 _.LVL0: 0 000021FA 56 push si 0 000021FB 57 push di 0 000021FC 55 push bp 16 _.LCFI0: 0 000021FD 89E5 mov bp, sp 18 _.LCFI1: 0 000021FF 1E push ds 0 00002200 8B7E08 mov di, word ptr [bp+8] 0 00002203 8B760A mov si, word ptr [bp+10] 22 _.LVL1: 41:chario.c **** { 42:chario.c **** struct dhdr FAR *dev = *pdev; 43:chario.c **** CharReqHdr.r_command = command; 23 .loc 1 43 0 0 00002206 BB[0000] mov bx, offset _CharReqHdr 0 00002209 8B460C mov ax, word ptr [bp+12] 0 0000220C 884702 mov byte ptr [bx+2], al 44:chario.c **** CharReqHdr.r_unit = 0; 27 .loc 1 44 0 0 0000220F C606[0100]00 mov byte ptr [_CharReqHdr+1], 0 45:chario.c **** CharReqHdr.r_status = 0; 29 .loc 1 45 0 0 00002214 C706[0300]0000 mov word ptr [_CharReqHdr+3], 0 46:chario.c **** CharReqHdr.r_length = sizeof(request); 31 .loc 1 46 0 0 0000221A C606[0000]1E mov byte ptr [_CharReqHdr], 30 47:chario.c **** execrh(&CharReqHdr, dev); 33 .loc 1 47 0 0 0000221F 56 push si 0 00002220 57 push di 0 00002221 16 push ss 0 00002222 53 push bx 0 00002223 895EFE mov word ptr [bp-2], bx 0 00002226 E8[FEFF] call _execrh 40 _.LVL2: 48:chario.c **** if (CharReqHdr.r_status & S_ERROR) 41 .loc 1 48 0 0 00002229 8B5EFE mov bx, word ptr [bp-2] 0 0000222C 837F0300 cmp word ptr [bx+3], 0 0 00002230 7D2C jge _.L7 45 _.L11: 49:chario.c **** { 50:chario.c **** for (;;) { 51:chario.c **** switch (char_error(&CharReqHdr, dev)) 46 .loc 1 51 0 0 00002232 56 push si 0 00002233 57 push di 0 00002234 53 push bx 0 00002235 895EFE mov word ptr [bp-2], bx 0 00002238 E8[FEFF] call _char_error 52 _.LVL3: 0 0000223B 83F801 cmp ax, 1 0 0000223E 740C je _.L1 0 00002240 8B5EFE mov bx, word ptr [bp-2] 0 00002243 7F0F jg _.L5 0 00002245 85C0 test ax, ax 0 00002247 75E9 jne _.L11 52:chario.c **** { 53:chario.c **** case ABORT: 54:chario.c **** case FAIL: 55:chario.c **** return DE_INVLDACC; 56:chario.c **** case CONTINUE: 57:chario.c **** CharReqHdr.r_count = 0; 59 .loc 1 57 0 0 00002249 894712 mov word ptr [bx+18], ax 61 _.LVL4: 62 _.L1: 58:chario.c **** return 0; 59:chario.c **** case RETRY: 60:chario.c **** return 1; 61:chario.c **** } 62:chario.c **** } 63:chario.c **** } 64:chario.c **** return SUCCESS; 65:chario.c **** } 63 .loc 1 65 0 0 0000224C 89EC mov sp, bp 0 0000224E 5D pop bp 0 0000224F 5F pop di 67 _.LVL5: 0 00002250 5E pop si 69 _.LVL6: 0 00002251 C20600 ret 6 71 _.LVL7: 72 _.L5: 51:chario.c **** { 73 .loc 1 51 0 0 00002254 83F803 cmp ax, 3 0 00002257 7FD9 jg _.L11 55:chario.c **** case CONTINUE: 76 .loc 1 55 0 0 00002259 B8F4FF mov ax, -12 0 0000225C EBEE jmp _.L1 79 _.L7: 64:chario.c **** } 80 .loc 1 64 0 0 0000225E 31C0 xor ax, ax 0 00002260 EBEA jmp _.L1 83 _.LFE28: 84 .size _CharRequest.isra.0, .-_CharRequest.isra.0 85 .type _CharCmd, @function 86 _CharCmd: 87 _.LFB7: 66:chario.c **** 67:chario.c **** long BinaryCharIO(struct dhdr FAR **pdev, size_t n, void FAR * bp, 68:chario.c **** unsigned command) 69:chario.c **** { 70:chario.c **** int err; 71:chario.c **** do 72:chario.c **** { 73:chario.c **** CharReqHdr.r_count = n; 74:chario.c **** CharReqHdr.r_trans = bp; 75:chario.c **** err = CharRequest(pdev, command); 76:chario.c **** } while (err == 1); 77:chario.c **** return err == SUCCESS ? (long)CharReqHdr.r_count : err; 78:chario.c **** } 79:chario.c **** 80:chario.c **** STATIC int CharIO(struct dhdr FAR **pdev, unsigned char ch, unsigned command) 81:chario.c **** { 82:chario.c **** int err = (int)BinaryCharIO(pdev, 1, &ch, command); 83:chario.c **** if (err == 0) 84:chario.c **** return 256; 85:chario.c **** if (err < 0) 86:chario.c **** return err; 87:chario.c **** return ch; 88:chario.c **** } 89:chario.c **** 90:chario.c **** /* STATE FUNCTIONS */ 91:chario.c **** 92:chario.c **** STATIC void CharCmd(struct dhdr FAR **pdev, unsigned command) 93:chario.c **** { 88 .loc 1 93 0 89 _.LVL8: 0 00002262 56 push si 0 00002263 55 push bp 92 _.LCFI2: 0 00002264 89E5 mov bp, sp 94 _.LCFI3: 0 00002266 8B7606 mov si, word ptr [bp+6] 96 _.L16: 94:chario.c **** while (CharRequest(pdev, command) == 1); 97 .loc 1 94 0 discriminator 1 0 00002269 FF7608 push word ptr [bp+8] 0 0000226C FF7402 push word ptr [si+2] 0 0000226F FF34 push word ptr [si] 0 00002271 E886FF call _CharRequest.isra.0 102 _.LVL9: 0 00002274 83F801 cmp ax, 1 0 00002277 74F0 je _.L16 95:chario.c **** } 105 .loc 1 95 0 0 00002279 89EC mov sp, bp 0 0000227B 5D pop bp 0 0000227C 5E pop si 0 0000227D C20400 ret 4 110 _.LFE7: 111 .size _CharCmd, .-_CharCmd 112 .type _Busy, @function 113 _Busy: 114 _.LFB8: 96:chario.c **** 97:chario.c **** STATIC int Busy(struct dhdr FAR **pdev) 98:chario.c **** { 115 .loc 1 98 0 116 _.LVL10: 0 00002280 56 push si 0 00002281 57 push di 0 00002282 55 push bp 120 _.LCFI4: 0 00002283 89E5 mov bp, sp 122 _.LCFI5: 0 00002285 8B7E08 mov di, word ptr [bp+8] 99:chario.c **** CharCmd(pdev, C_NDREAD); 124 .loc 1 99 0 0 00002288 B80500 mov ax, 5 0 0000228B 50 push ax 0 0000228C 57 push di 0 0000228D E8D2FF call _CharCmd 129 _.LVL11: 100:chario.c **** if (CharReqHdr.r_status & S_ERROR) 130 .loc 1 100 0 0 00002290 BE[0000] mov si, offset _CharReqHdr 0 00002293 837C0300 cmp word ptr [si+3], 0 0 00002297 7D08 jge _.L21 101:chario.c **** CharCmd(pdev, C_ISTAT); 134 .loc 1 101 0 0 00002299 B80600 mov ax, 6 0 0000229C 50 push ax 0 0000229D 57 push di 0 0000229E E8C1FF call _CharCmd 139 _.LVL12: 140 _.L21: 102:chario.c **** return CharReqHdr.r_status & S_BUSY; 141 .loc 1 102 0 0 000022A1 8B4403 mov ax, word ptr [si+3] 0 000022A4 250002 and ax, 512 103:chario.c **** } 144 .loc 1 103 0 0 000022A7 89EC mov sp, bp 0 000022A9 5D pop bp 0 000022AA 5F pop di 0 000022AB 5E pop si 0 000022AC C20200 ret 2 150 _.LFE8: 151 .size _Busy, .-_Busy 152 .global _BinaryCharIO 153 .type _BinaryCharIO, @function 154 _BinaryCharIO: 155 _.LFB5: 69:chario.c **** int err; 156 .loc 1 69 0 157 _.LVL13: 0 000022AF 56 push si 0 000022B0 57 push di 0 000022B1 55 push bp 161 _.LCFI6: 0 000022B2 89E5 mov bp, sp 163 _.LCFI7: 0 000022B4 1E push ds 0 000022B5 8B560C mov dx, word ptr [bp+12] 0 000022B8 8B760E mov si, word ptr [bp+14] 167 _.L24: 73:chario.c **** CharReqHdr.r_trans = bp; 168 .loc 1 73 0 discriminator 1 0 000022BB BF[0000] mov di, offset _CharReqHdr 0 000022BE 8B460A mov ax, word ptr [bp+10] 0 000022C1 894512 mov word ptr [di+18], ax 74:chario.c **** err = CharRequest(pdev, command); 172 .loc 1 74 0 discriminator 1 0 000022C4 89550E mov word ptr [di+14], dx 0 000022C7 8956FE mov word ptr [bp-2], dx 0 000022CA 897510 mov word ptr [di+16], si 75:chario.c **** } while (err == 1); 176 .loc 1 75 0 discriminator 1 0 000022CD FF7610 push word ptr [bp+16] 0 000022D0 8B5E08 mov bx, word ptr [bp+8] 0 000022D3 FF7702 push word ptr [bx+2] 0 000022D6 FF37 push word ptr [bx] 0 000022D8 E81FFF call _CharRequest.isra.0 182 _.LVL14: 76:chario.c **** return err == SUCCESS ? (long)CharReqHdr.r_count : err; 183 .loc 1 76 0 discriminator 1 0 000022DB 83F801 cmp ax, 1 0 000022DE 8B56FE mov dx, word ptr [bp-2] 0 000022E1 74D8 je _.L24 77:chario.c **** } 187 .loc 1 77 0 0 000022E3 89C1 mov cx, ax 0 000022E5 99 cwd 0 000022E6 85C0 test ax, ax 0 000022E8 7504 jne _.L23 77:chario.c **** } 192 .loc 1 77 0 is_stmt 0 discriminator 1 0 000022EA 8B4D12 mov cx, word ptr [di+18] 0 000022ED 92 xchg dx, ax 195 _.L23: 78:chario.c **** 196 .loc 1 78 0 is_stmt 1 0 000022EE 91 xchg cx, ax 198 _.LVL15: 0 000022EF 89EC mov sp, bp 0 000022F1 5D pop bp 0 000022F2 5F pop di 0 000022F3 5E pop si 0 000022F4 C20A00 ret 10 204 _.LFE5: 205 .size _BinaryCharIO, .-_BinaryCharIO 206 .global _con_flush 207 .type _con_flush, @function 208 _con_flush: 209 _.LFB9: 104:chario.c **** 105:chario.c **** void con_flush(struct dhdr FAR **pdev) 106:chario.c **** { 210 .loc 1 106 0 211 _.LVL16: 0 000022F7 55 push bp 213 _.LCFI8: 0 000022F8 89E5 mov bp, sp 215 _.LCFI9: 107:chario.c **** CharCmd(pdev, C_IFLUSH); 216 .loc 1 107 0 0 000022FA B80700 mov ax, 7 0 000022FD 50 push ax 0 000022FE FF7604 push word ptr [bp+4] 0 00002301 E85EFF call _CharCmd 221 _.LVL17: 108:chario.c **** } 222 .loc 1 108 0 0 00002304 89EC mov sp, bp 0 00002306 5D pop bp 0 00002307 C20200 ret 2 226 _.LFE9: 227 .size _con_flush, .-_con_flush 228 .global _sft_to_dev 229 .type _sft_to_dev, @function 230 _sft_to_dev: 231 _.LFB10: 109:chario.c **** 110:chario.c **** /* if the sft is invalid, then we just monitor syscon */ 111:chario.c **** struct dhdr FAR *sft_to_dev(sft FAR *s) 112:chario.c **** { 232 .loc 1 112 0 233 _.LVL18: 0 0000230A 55 push bp 235 _.LCFI10: 0 0000230B 89E5 mov bp, sp 237 _.LCFI11: 0 0000230D 1E push ds 0 0000230E 8B5E04 mov bx, word ptr [bp+4] 0 00002311 8B5606 mov dx, word ptr [bp+6] 113:chario.c **** if (FP_OFF(s) == (size_t) -1) 241 .loc 1 113 0 0 00002314 83FBFF cmp bx, -1 0 00002317 750D jne _.L33 114:chario.c **** return syscon; 244 .loc 1 114 0 0 00002319 A1[0000] mov ax, word ptr [_syscon] 0 0000231C 8B16[0200] mov dx, word ptr [_syscon+2] 247 _.L32: 115:chario.c **** if (s->sft_flags & SFT_FDEVICE) 116:chario.c **** return s->sft_dev; 117:chario.c **** return NULL; 118:chario.c **** } 248 .loc 1 118 0 0 00002320 89EC mov sp, bp 0 00002322 5D pop bp 0 00002323 C20400 ret 4 252 _.L33: 115:chario.c **** if (s->sft_flags & SFT_FDEVICE) 253 .loc 1 115 0 0 00002326 8EC2 mov es, dx 0 00002328 268B4705 mov ax, word ptr es:[bx+5] 0 0000232C 8946FE mov word ptr [bp-2], ax 0 0000232F 258000 and ax, 128 0 00002332 740A je _.L35 116:chario.c **** return NULL; 259 .loc 1 116 0 0 00002334 268B4707 mov ax, word ptr es:[bx+7] 0 00002338 268B5709 mov dx, word ptr es:[bx+9] 0 0000233C EBE2 jmp _.L32 263 _.L35: 117:chario.c **** } 264 .loc 1 117 0 0 0000233E 89C2 mov dx, ax 0 00002340 EBDE jmp _.L32 267 _.LFE10: 268 .size _sft_to_dev, .-_sft_to_dev 269 .global _StdinBusy 270 .type _StdinBusy, @function 271 _StdinBusy: 272 _.LFB11: 119:chario.c **** 120:chario.c **** int StdinBusy(void) 121:chario.c **** { 273 .loc 1 121 0 0 00002342 56 push si 0 00002343 55 push bp 276 _.LCFI12: 0 00002344 89E5 mov bp, sp 278 _.LCFI13: 0 00002346 83EC06 sub sp, 6 122:chario.c **** sft FAR *s = get_sft(STDIN); 280 .loc 1 122 0 0 00002349 31C0 xor ax, ax 0 0000234B 50 push ax 0 0000234C E8[FEFF] call _get_sft 284 _.LVL19: 0 0000234F 89D6 mov si, dx 123:chario.c **** struct dhdr FAR *dev = sft_to_dev(s); 286 .loc 1 123 0 0 00002351 52 push dx 0 00002352 50 push ax 0 00002353 8946FA mov word ptr [bp-6], ax 0 00002356 E8[FEFF] call _sft_to_dev 291 _.LVL20: 0 00002359 8946FC mov word ptr [bp-4], ax 0 0000235C 8956FE mov word ptr [bp-2], dx 124:chario.c **** 125:chario.c **** if (dev) 294 .loc 1 125 0 0 0000235F 09D0 or ax, dx 0 00002361 8B5EFA mov bx, word ptr [bp-6] 0 00002364 740C je _.L38 126:chario.c **** return Busy(&dev); 298 .loc 1 126 0 0 00002366 8D46FC lea ax, [-4+bp] 0 00002369 50 push ax 0 0000236A E813FF call _Busy 302 _.LVL21: 303 _.L37: 127:chario.c **** 128:chario.c **** return s->sft_posit >= s->sft_size; 129:chario.c **** } 304 .loc 1 129 0 0 0000236D 89EC mov sp, bp 0 0000236F 5D pop bp 0 00002370 5E pop si 0 00002371 C3 ret 309 _.L38: 128:chario.c **** } 310 .loc 1 128 0 0 00002372 B80100 mov ax, 1 0 00002375 8EC6 mov es, si 0 00002377 268B5713 mov dx, word ptr es:[bx+19] 0 0000237B 263B5717 cmp dx, word ptr es:[bx+23] 0 0000237F 770C ja _.L42 0 00002381 75EA jne _.L37 0 00002383 268B5711 mov dx, word ptr es:[bx+17] 0 00002387 263B5715 cmp dx, word ptr es:[bx+21] 0 0000238B 76E0 jbe _.L37 320 _.L42: 0 0000238D 31C0 xor ax, ax 0 0000238F EBDC jmp _.L37 323 _.LFE11: 324 .size _StdinBusy, .-_StdinBusy 325 .global _ndread 326 .type _ndread, @function 327 _ndread: 328 _.LFB12: 130:chario.c **** 131:chario.c **** /* get character from the console - this is how DOS gets 132:chario.c **** CTL_C/CTL_S/CTL_P when outputting */ 133:chario.c **** int ndread(struct dhdr FAR **pdev) 134:chario.c **** { 329 .loc 1 134 0 330 _.LVL22: 0 00002391 55 push bp 332 _.LCFI14: 0 00002392 89E5 mov bp, sp 334 _.LCFI15: 135:chario.c **** CharCmd(pdev, C_NDREAD); 335 .loc 1 135 0 0 00002394 B80500 mov ax, 5 0 00002397 50 push ax 0 00002398 FF7604 push word ptr [bp+4] 0 0000239B E8C4FE call _CharCmd 340 _.LVL23: 136:chario.c **** if (CharReqHdr.r_status & S_BUSY) 341 .loc 1 136 0 0 0000239E BB[0000] mov bx, offset _CharReqHdr 0 000023A1 F6470402 test byte ptr [bx+4], 2 0 000023A5 750B jne _.L46 137:chario.c **** return -1; 138:chario.c **** return CharReqHdr.r_ndbyte; 345 .loc 1 138 0 0 000023A7 8A470D mov al, byte ptr [bx+13] 0 000023AA 30E4 xor ah, ah 348 _.L44: 139:chario.c **** } 349 .loc 1 139 0 0 000023AC 89EC mov sp, bp 0 000023AE 5D pop bp 0 000023AF C20200 ret 2 353 _.L46: 137:chario.c **** return -1; 354 .loc 1 137 0 0 000023B2 B8FFFF mov ax, -1 0 000023B5 EBF5 jmp _.L44 357 _.LFE12: 358 .size _ndread, .-_ndread 359 .global _update_scr_pos 360 .type _update_scr_pos, @function 361 _update_scr_pos: 362 _.LFB14: 140:chario.c **** 141:chario.c **** /* OUTPUT FUNCTIONS */ 142:chario.c **** 143:chario.c **** #ifdef __WATCOMC__ 144:chario.c **** void fast_put_char(char c); 145:chario.c **** #pragma aux fast_put_char = "int 29h" __parm[__al] __modify __exact [__bx] 146:chario.c **** #else 147:chario.c **** 148:chario.c **** /* writes a character in raw mode using int29 for speed */ 149:chario.c **** STATIC void fast_put_char(unsigned char chr) 150:chario.c **** { 151:chario.c **** #if defined(__TURBOC__) 152:chario.c **** _AL = chr; 153:chario.c **** __int__(0x29); 154:chario.c **** #elif defined(__GNUC__) 155:chario.c **** asm volatile("{ int $0x29 | int 0x29 }":: "a"(chr):"bx"); 156:chario.c **** #elif defined(I86) 157:chario.c **** asm 158:chario.c **** { 159:chario.c **** mov al, byte ptr chr; 160:chario.c **** int 0x29; 161:chario.c **** } 162:chario.c **** #endif 163:chario.c **** } 164:chario.c **** #endif 165:chario.c **** 166:chario.c **** void update_scr_pos(unsigned char c, unsigned char count) 167:chario.c **** { 363 .loc 1 167 0 364 _.LVL24: 0 000023B7 55 push bp 366 _.LCFI16: 0 000023B8 89E5 mov bp, sp 368 _.LCFI17: 168:chario.c **** unsigned char scrpos = scr_pos; 369 .loc 1 168 0 0 000023BA A0[0000] mov al, byte ptr [_scr_pos] 371 _.LVL25: 169:chario.c **** 170:chario.c **** if (c == CR) 372 .loc 1 170 0 0 000023BD 807E040D cmp byte ptr [bp+4], 13 0 000023C1 7425 je _.L51 171:chario.c **** scrpos = 0; 172:chario.c **** else if (c == BS) { 375 .loc 1 172 0 0 000023C3 807E0408 cmp byte ptr [bp+4], 8 0 000023C7 750E jne _.L50 173:chario.c **** if (scrpos > 0) 174:chario.c **** scrpos--; 378 .loc 1 174 0 0 000023C9 3C01 cmp al, 1 0 000023CB F5 cmc 0 000023CC 18E4 sbb ah, ah 0 000023CE 00E0 add al, ah 383 _.LVL26: 384 _.L49: 175:chario.c **** } else if (c != LF && c != BELL) { 176:chario.c **** scrpos += count; 177:chario.c **** } 178:chario.c **** scr_pos = scrpos; 385 .loc 1 178 0 0 000023D0 A2[0000] mov byte ptr [_scr_pos], al 179:chario.c **** } 387 .loc 1 179 0 0 000023D3 5D pop bp 0 000023D4 C20400 ret 4 390 _.L50: 175:chario.c **** } else if (c != LF && c != BELL) { 391 .loc 1 175 0 0 000023D7 807E040A cmp byte ptr [bp+4], 10 0 000023DB 74F3 je _.L49 0 000023DD 807E0407 cmp byte ptr [bp+4], 7 0 000023E1 74ED je _.L49 176:chario.c **** } 396 .loc 1 176 0 0 000023E3 024606 add al, byte ptr [bp+6] 398 _.LVL27: 0 000023E6 EBE8 jmp _.L49 400 _.L51: 171:chario.c **** else if (c == BS) { 401 .loc 1 171 0 0 000023E8 30C0 xor al, al 403 _.LVL28: 0 000023EA EBE4 jmp _.L49 405 _.LFE14: 406 .size _update_scr_pos, .-_update_scr_pos 407 .global _write_char 408 .type _write_char, @function 409 _write_char: 410 _.LFB16: 180:chario.c **** 181:chario.c **** STATIC int raw_get_char(struct dhdr FAR **pdev, BOOL check_break); 182:chario.c **** 183:chario.c **** long cooked_write(struct dhdr FAR **pdev, size_t n, char FAR *bp) 184:chario.c **** { 185:chario.c **** size_t xfer; 186:chario.c **** 187:chario.c **** /* bit 7 means fastcon; low 5 bits count number of characters */ 188:chario.c **** unsigned char fast_counter = ((*pdev)->dh_attr & ATTR_FASTCON) << 3; 189:chario.c **** 190:chario.c **** for (xfer = 0; xfer < n; xfer++) 191:chario.c **** { 192:chario.c **** int err; 193:chario.c **** unsigned char count = 1, c = *bp++; 194:chario.c **** 195:chario.c **** if (c == CTL_Z) 196:chario.c **** break; 197:chario.c **** 198:chario.c **** /* write a character in cooked mode; maybe with printer echo; 199:chario.c **** handles TAB expansion */ 200:chario.c **** if (c == HT) { 201:chario.c **** count = 8 - (scr_pos & 7); 202:chario.c **** c = ' '; 203:chario.c **** } 204:chario.c **** update_scr_pos(c, count); 205:chario.c **** do { 206:chario.c **** /* if not fast then < 0x80; always check 207:chario.c **** otherwise check every 32 characters */ 208:chario.c **** if (fast_counter <= 0x80 && check_handle_break(pdev) == CTL_S) 209:chario.c **** raw_get_char(pdev, TRUE); /* Test for hold char and ctl_c */ 210:chario.c **** fast_counter++; 211:chario.c **** fast_counter &= 0x9f; 212:chario.c **** if (PrinterEcho) 213:chario.c **** DosWrite(STDPRN, 1, &c); 214:chario.c **** if (fast_counter & 0x80) 215:chario.c **** fast_put_char(c); 216:chario.c **** else 217:chario.c **** { 218:chario.c **** err = CharIO(pdev, c, C_OUTPUT); 219:chario.c **** if (err < 0) 220:chario.c **** return err; 221:chario.c **** } 222:chario.c **** } while (--count != 0); 223:chario.c **** } 224:chario.c **** return xfer; 225:chario.c **** } 226:chario.c **** 227:chario.c **** /* writes character for disk file or device */ 228:chario.c **** void write_char(int c, int sft_idx) 229:chario.c **** { 411 .loc 1 229 0 412 _.LVL29: 0 000023EC 55 push bp 414 _.LCFI18: 0 000023ED 89E5 mov bp, sp 416 _.LCFI19: 0 000023EF 1E push ds 230:chario.c **** unsigned char ch = (unsigned char)c; 418 .loc 1 230 0 0 000023F0 8B4604 mov ax, word ptr [bp+4] 0 000023F3 8846FF mov byte ptr [bp-1], al 231:chario.c **** DosRWSft(sft_idx, 1, &ch, XFR_FORCE_WRITE); 421 .loc 1 231 0 0 000023F6 B80300 mov ax, 3 0 000023F9 50 push ax 0 000023FA 8D46FF lea ax, [-1+bp] 0 000023FD 16 push ss 0 000023FE 50 push ax 0 000023FF B80100 mov ax, 1 0 00002402 50 push ax 0 00002403 FF7606 push word ptr [bp+6] 0 00002406 E8[FEFF] call _DosRWSft 431 _.LVL30: 232:chario.c **** } 432 .loc 1 232 0 0 00002409 89EC mov sp, bp 0 0000240B 5D pop bp 0 0000240C C20400 ret 4 436 _.LFE16: 437 .size _write_char, .-_write_char 438 .type _destr_bs, @function 439 _destr_bs: 440 _.LFB19: 233:chario.c **** 234:chario.c **** void write_char_stdout(int c) 235:chario.c **** { 236:chario.c **** unsigned char count = 1; 237:chario.c **** unsigned flags = get_sft(STDOUT)->sft_flags; 238:chario.c **** 239:chario.c **** /* ah=2, ah=9 should expand tabs even for raw devices and disk files */ 240:chario.c **** if ((flags & (SFT_FDEVICE|SFT_FBINARY)) != SFT_FDEVICE) 241:chario.c **** { 242:chario.c **** if (c == HT) { 243:chario.c **** count = 8 - (scr_pos & 7); 244:chario.c **** c = ' '; 245:chario.c **** } 246:chario.c **** /* for raw CONOUT devices already updated in dosfns.c */ 247:chario.c **** if ((flags & (SFT_FDEVICE|SFT_FCONOUT)) != (SFT_FDEVICE|SFT_FCONOUT)) 248:chario.c **** update_scr_pos(c, count); 249:chario.c **** } 250:chario.c **** 251:chario.c **** do { 252:chario.c **** write_char(c, get_sft_idx(STDOUT)); 253:chario.c **** } while (--count != 0); 254:chario.c **** } 255:chario.c **** 256:chario.c **** #define iscntrl(c) ((unsigned char)(c) < ' ') 257:chario.c **** 258:chario.c **** /* this is for handling things like ^C, mostly used in echoed input */ 259:chario.c **** STATIC int echo_char(int c, int sft_idx) 260:chario.c **** { 261:chario.c **** int out = c; 262:chario.c **** if (iscntrl(c) && c != HT && c != LF && c != CR) 263:chario.c **** { 264:chario.c **** write_char('^', sft_idx); 265:chario.c **** out += '@'; 266:chario.c **** } 267:chario.c **** write_char(out, sft_idx); 268:chario.c **** return c; 269:chario.c **** } 270:chario.c **** 271:chario.c **** STATIC void destr_bs(int sft_idx) 272:chario.c **** { 441 .loc 1 272 0 442 _.LVL31: 0 0000240F 56 push si 0 00002410 57 push di 0 00002411 55 push bp 446 _.LCFI20: 0 00002412 89E5 mov bp, sp 448 _.LCFI21: 0 00002414 8B7608 mov si, word ptr [bp+8] 273:chario.c **** write_char(BS, sft_idx); 450 .loc 1 273 0 0 00002417 56 push si 0 00002418 BF0800 mov di, 8 0 0000241B 57 push di 0 0000241C E8[FEFF] call _write_char 455 _.LVL32: 274:chario.c **** write_char(' ', sft_idx); 456 .loc 1 274 0 0 0000241F 56 push si 0 00002420 B82000 mov ax, 32 0 00002423 50 push ax 0 00002424 E8[FEFF] call _write_char 461 _.LVL33: 275:chario.c **** write_char(BS, sft_idx); 462 .loc 1 275 0 0 00002427 56 push si 0 00002428 57 push di 0 00002429 E8[FEFF] call _write_char 466 _.LVL34: 276:chario.c **** } 467 .loc 1 276 0 0 0000242C 89EC mov sp, bp 0 0000242E 5D pop bp 0 0000242F 5F pop di 0 00002430 5E pop si 0 00002431 C20200 ret 2 473 _.LFE19: 474 .size _destr_bs, .-_destr_bs 475 .type _echo_char, @function 476 _echo_char: 477 _.LFB18: 260:chario.c **** int out = c; 478 .loc 1 260 0 479 _.LVL35: 0 00002434 56 push si 0 00002435 55 push bp 482 _.LCFI22: 0 00002436 89E5 mov bp, sp 484 _.LCFI23: 0 00002438 1E push ds 0 00002439 8B4606 mov ax, word ptr [bp+6] 0 0000243C 8B7608 mov si, word ptr [bp+8] 488 _.LVL36: 0 0000243F 89C2 mov dx, ax 262:chario.c **** { 490 .loc 1 262 0 0 00002441 3C1F cmp al, 31 0 00002443 7722 ja _.L66 262:chario.c **** { 493 .loc 1 262 0 is_stmt 0 discriminator 1 0 00002445 89C1 mov cx, ax 0 00002447 83C1F7 add cx, -9 0 0000244A 83F901 cmp cx, 1 0 0000244D 7618 jbe _.L66 262:chario.c **** { 498 .loc 1 262 0 discriminator 2 0 0000244F 83F80D cmp ax, 13 0 00002452 7413 je _.L66 0 00002454 8946FE mov word ptr [bp-2], ax 264:chario.c **** out += '@'; 502 .loc 1 264 0 is_stmt 1 0 00002457 56 push si 0 00002458 BA5E00 mov dx, 94 0 0000245B 52 push dx 0 0000245C E8[FEFF] call _write_char 507 _.LVL37: 265:chario.c **** } 508 .loc 1 265 0 0 0000245F 8B46FE mov ax, word ptr [bp-2] 0 00002462 89C2 mov dx, ax 0 00002464 83C240 add dx, 64 512 _.LVL38: 513 _.L66: 0 00002467 8946FE mov word ptr [bp-2], ax 267:chario.c **** return c; 515 .loc 1 267 0 0 0000246A 56 push si 0 0000246B 52 push dx 0 0000246C E8[FEFF] call _write_char 519 _.LVL39: 269:chario.c **** 520 .loc 1 269 0 0 0000246F 8B46FE mov ax, word ptr [bp-2] 0 00002472 89EC mov sp, bp 0 00002474 5D pop bp 0 00002475 5E pop si 0 00002476 C20400 ret 4 526 _.LFE18: 527 .size _echo_char, .-_echo_char 528 .global _write_char_stdout 529 .type _write_char_stdout, @function 530 _write_char_stdout: 531 _.LFB17: 235:chario.c **** unsigned char count = 1; 532 .loc 1 235 0 533 _.LVL40: 0 00002479 56 push si 0 0000247A 55 push bp 536 _.LCFI24: 0 0000247B 89E5 mov bp, sp 538 _.LCFI25: 0 0000247D 1E push ds 540 _.LVL41: 237:chario.c **** 541 .loc 1 237 0 0 0000247E BE0100 mov si, 1 0 00002481 56 push si 0 00002482 E8[FEFF] call _get_sft 545 _.LVL42: 0 00002485 8EC2 mov es, dx 0 00002487 93 xchg bx, ax 0 00002488 268B4705 mov ax, word ptr es:[bx+5] 549 _.LVL43: 240:chario.c **** { 550 .loc 1 240 0 0 0000248C 89C2 mov dx, ax 0 0000248E 81E2A000 and dx, 160 0 00002492 81FA8000 cmp dx, 128 0 00002496 744C je _.L72 236:chario.c **** unsigned flags = get_sft(STDOUT)->sft_flags; 555 .loc 1 236 0 0 00002498 B201 mov dl, 1 242:chario.c **** count = 8 - (scr_pos & 7); 557 .loc 1 242 0 0 0000249A 837E0609 cmp word ptr [bp+6], 9 0 0000249E 7510 jne _.L73 243:chario.c **** c = ' '; 560 .loc 1 243 0 0 000024A0 8A36[0000] mov dh, byte ptr [_scr_pos] 0 000024A4 80E607 and dh, 7 0 000024A7 B208 mov dl, 8 0 000024A9 28F2 sub dl, dh 565 _.LVL44: 244:chario.c **** } 566 .loc 1 244 0 0 000024AB C746062000 mov word ptr [bp+6], 32 568 _.LVL45: 569 _.L73: 247:chario.c **** update_scr_pos(c, count); 570 .loc 1 247 0 0 000024B0 258200 and ax, 130 572 _.LVL46: 0 000024B3 3D8200 cmp ax, 130 0 000024B6 740D je _.L75 248:chario.c **** } 575 .loc 1 248 0 0 000024B8 52 push dx 0 000024B9 8856FF mov byte ptr [bp-1], dl 0 000024BC FF7606 push word ptr [bp+6] 0 000024BF E8[FEFF] call _update_scr_pos 580 _.LVL47: 0 000024C2 8A56FF mov dl, byte ptr [bp-1] 582 _.LVL48: 583 _.L75: 0 000024C5 8856FF mov byte ptr [bp-1], dl 585 _.LVL49: 252:chario.c **** } while (--count != 0); 586 .loc 1 252 0 discriminator 1 0 000024C8 B80100 mov ax, 1 0 000024CB 50 push ax 0 000024CC E8[FEFF] call _get_sft_idx 590 _.LVL50: 0 000024CF 50 push ax 0 000024D0 FF7606 push word ptr [bp+6] 0 000024D3 E8[FEFF] call _write_char 594 _.LVL51: 253:chario.c **** } 595 .loc 1 253 0 discriminator 1 0 000024D6 8A56FF mov dl, byte ptr [bp-1] 0 000024D9 FECA dec dl 598 _.LVL52: 0 000024DB 75E8 jne _.L75 600 _.LVL53: 601 _.L71: 254:chario.c **** 602 .loc 1 254 0 0 000024DD 89EC mov sp, bp 0 000024DF 5D pop bp 0 000024E0 5E pop si 0 000024E1 C20200 ret 2 607 _.LVL54: 608 _.L72: 252:chario.c **** } while (--count != 0); 609 .loc 1 252 0 0 000024E4 56 push si 0 000024E5 E8[FEFF] call _get_sft_idx 612 _.LVL55: 0 000024E8 50 push ax 0 000024E9 FF7606 push word ptr [bp+6] 0 000024EC E8[FEFF] call _write_char 616 _.LVL56: 0 000024EF EBEC jmp _.L71 618 _.LFE17: 619 .size _write_char_stdout, .-_write_char_stdout 620 .global _read_char 621 .type _read_char, @function 622 _read_char: 623 _.LFB23: 277:chario.c **** 278:chario.c **** /* READ FUNCTIONS */ 279:chario.c **** 280:chario.c **** long cooked_read(struct dhdr FAR **pdev, size_t n, char FAR *bp) 281:chario.c **** { 282:chario.c **** unsigned xfer = 0; 283:chario.c **** int c; 284:chario.c **** while(n--) 285:chario.c **** { 286:chario.c **** c = raw_get_char(pdev, TRUE); 287:chario.c **** if (c < 0) 288:chario.c **** return c; 289:chario.c **** if (c == 256) 290:chario.c **** break; 291:chario.c **** *bp++ = c; 292:chario.c **** xfer++; 293:chario.c **** if ((unsigned char)c == CTL_Z) 294:chario.c **** break; 295:chario.c **** } 296:chario.c **** return xfer; 297:chario.c **** } 298:chario.c **** 299:chario.c **** STATIC unsigned read_char_sft_dev(int sft_in, int sft_out, 300:chario.c **** struct dhdr FAR **pdev, 301:chario.c **** BOOL check_break) 302:chario.c **** { 303:chario.c **** unsigned c; 304:chario.c **** 305:chario.c **** if (*pdev) 306:chario.c **** { 307:chario.c **** FOREVER 308:chario.c **** { 309:chario.c **** if (ctrl_break_pressed()) 310:chario.c **** { 311:chario.c **** c = CTL_C; 312:chario.c **** break; 313:chario.c **** } 314:chario.c **** if (!Busy(pdev)) 315:chario.c **** { 316:chario.c **** c = CharIO(pdev, 0, C_INPUT); 317:chario.c **** break; 318:chario.c **** } 319:chario.c **** if (check_break && *pdev != syscon) 320:chario.c **** check_handle_break(&syscon); 321:chario.c **** /* the idle int is only safe if we're using the character stack */ 322:chario.c **** if (user_r->AH < 0xd) 323:chario.c **** DosIdle_int(); 324:chario.c **** } 325:chario.c **** } 326:chario.c **** else 327:chario.c **** DosRWSft(sft_in, 1, &c, XFR_READ); 328:chario.c **** 329:chario.c **** /* check for break or stop on sft_in, echo to sft_out */ 330:chario.c **** if (check_break && (c == CTL_C || c == CTL_S)) 331:chario.c **** { 332:chario.c **** if (c == CTL_S) 333:chario.c **** c = read_char_sft_dev(sft_in, sft_out, pdev, FALSE); 334:chario.c **** if (c == CTL_C) 335:chario.c **** handle_break(pdev, sft_out); 336:chario.c **** /* DOS oddity: if you press ^S somekey ^C then ^C does not break */ 337:chario.c **** c = read_char(sft_in, sft_out, FALSE); 338:chario.c **** } 339:chario.c **** return c; 340:chario.c **** } 341:chario.c **** 342:chario.c **** STATIC int raw_get_char(struct dhdr FAR **pdev, BOOL check_break) 343:chario.c **** { 344:chario.c **** return read_char_sft_dev(-1, -1, pdev, check_break); 345:chario.c **** } 346:chario.c **** 347:chario.c **** unsigned char read_char(int sft_in, int sft_out, BOOL check_break) 348:chario.c **** { 624 .loc 1 348 0 625 _.LVL57: 0 000024F1 56 push si 0 000024F2 55 push bp 628 _.LCFI26: 0 000024F3 89E5 mov bp, sp 630 _.LCFI27: 0 000024F5 1E push ds 0 000024F6 1E push ds 0 000024F7 8B7606 mov si, word ptr [bp+6] 349:chario.c **** struct dhdr FAR *dev = sft_to_dev(idx_to_sft(sft_in)); 634 .loc 1 349 0 0 000024FA 56 push si 0 000024FB E8[FEFF] call _idx_to_sft 637 _.LVL58: 0 000024FE 52 push dx 0 000024FF 50 push ax 0 00002500 E8[FEFF] call _sft_to_dev 641 _.LVL59: 0 00002503 8946FC mov word ptr [bp-4], ax 0 00002506 8956FE mov word ptr [bp-2], dx 350:chario.c **** return read_char_sft_dev(sft_in, sft_out, &dev, check_break); 644 .loc 1 350 0 0 00002509 FF760A push word ptr [bp+10] 0 0000250C 8D46FC lea ax, [-4+bp] 0 0000250F 50 push ax 0 00002510 FF7608 push word ptr [bp+8] 0 00002513 56 push si 0 00002514 E80700 call _read_char_sft_dev 651 _.LVL60: 351:chario.c **** } 652 .loc 1 351 0 0 00002517 89EC mov sp, bp 0 00002519 5D pop bp 0 0000251A 5E pop si 0 0000251B C20600 ret 6 657 _.LFE23: 658 .size _read_char, .-_read_char 659 .type _read_char_sft_dev, @function 660 _read_char_sft_dev: 661 _.LFB21: 302:chario.c **** unsigned c; 662 .loc 1 302 0 663 _.LVL61: 0 0000251E 56 push si 0 0000251F 57 push di 0 00002520 55 push bp 667 _.LCFI28: 0 00002521 89E5 mov bp, sp 669 _.LCFI29: 0 00002523 1E push ds 0 00002524 1E push ds 0 00002525 8B7E0A mov di, word ptr [bp+10] 0 00002528 8B760C mov si, word ptr [bp+12] 305:chario.c **** { 674 .loc 1 305 0 0 0000252B 8B4402 mov ax, word ptr [si+2] 0 0000252E 0B04 or ax, word ptr [si] 0 00002530 7503E9C000 je _.L86 678 _.L96: 309:chario.c **** { 679 .loc 1 309 0 0 00002535 E8[FEFF] call _ctrl_break_pressed 681 _.LVL62: 0 00002538 84C0 test al, al 0 0000253A 7416 je _.L88 311:chario.c **** break; 684 .loc 1 311 0 0 0000253C C746FE0300 mov word ptr [bp-2], 3 330:chario.c **** { 686 .loc 1 330 0 0 00002541 837E0E00 cmp word ptr [bp+14], 0 0 00002545 755B jne _.L89 689 _.L90: 340:chario.c **** 690 .loc 1 340 0 0 00002547 8B46FE mov ax, word ptr [bp-2] 0 0000254A 89EC mov sp, bp 0 0000254C 5D pop bp 0 0000254D 5F pop di 0 0000254E 5E pop si 0 0000254F C20800 ret 8 697 _.L88: 314:chario.c **** { 698 .loc 1 314 0 0 00002552 56 push si 0 00002553 E82AFD call _Busy 701 _.LVL63: 0 00002556 85C0 test ax, ax 0 00002558 7569 jne _.L91 704 _.LVL64: 0 0000255A 8846FD mov byte ptr [bp-3], al 706 _.LVL65: 707 _.LBB7: 708 _.LBB8: 82:chario.c **** if (err == 0) 709 .loc 1 82 0 0 0000255D B80400 mov ax, 4 711 _.LVL66: 0 00002560 50 push ax 0 00002561 8D46FD lea ax, [-3+bp] 714 _.LVL67: 0 00002564 16 push ss 0 00002565 50 push ax 0 00002566 B80100 mov ax, 1 718 _.LVL68: 0 00002569 50 push ax 720 _.LVL69: 0 0000256A 56 push si 722 _.LVL70: 0 0000256B E8[FEFF] call _BinaryCharIO 724 _.LVL71: 83:chario.c **** return 256; 725 .loc 1 83 0 0 0000256E 85C0 test ax, ax 0 00002570 744C je _.L99 85:chario.c **** return err; 728 .loc 1 85 0 0 00002572 7C05 jl _.L92 87:chario.c **** } 730 .loc 1 87 0 0 00002574 8A46FD mov al, byte ptr [bp-3] 732 _.LVL72: 0 00002577 30E4 xor ah, ah 734 _.L92: 735 _.LVL73: 736 _.LBE8: 737 _.LBE7: 316:chario.c **** break; 738 .loc 1 316 0 0 00002579 8946FE mov word ptr [bp-2], ax 740 _.L93: 330:chario.c **** { 741 .loc 1 330 0 0 0000257C 837E0E00 cmp word ptr [bp+14], 0 0 00002580 74C5 je _.L90 330:chario.c **** { 744 .loc 1 330 0 is_stmt 0 discriminator 1 0 00002582 8B46FE mov ax, word ptr [bp-2] 0 00002585 89C2 mov dx, ax 0 00002587 83E2EF and dx, -17 0 0000258A 83FA03 cmp dx, 3 0 0000258D 75B8 jne _.L90 332:chario.c **** c = read_char_sft_dev(sft_in, sft_out, pdev, FALSE); 750 .loc 1 332 0 is_stmt 1 0 0000258F 83F813 cmp ax, 19 0 00002592 750E jne _.L89 333:chario.c **** if (c == CTL_C) 753 .loc 1 333 0 0 00002594 31C0 xor ax, ax 0 00002596 50 push ax 0 00002597 56 push si 0 00002598 57 push di 0 00002599 FF7608 push word ptr [bp+8] 0 0000259C E87FFF call _read_char_sft_dev 760 _.LVL74: 0 0000259F 8946FE mov word ptr [bp-2], ax 762 _.L89: 334:chario.c **** handle_break(pdev, sft_out); 763 .loc 1 334 0 0 000025A2 837EFE03 cmp word ptr [bp-2], 3 0 000025A6 7505 jne _.L98 335:chario.c **** /* DOS oddity: if you press ^S somekey ^C then ^C does not break */ 766 .loc 1 335 0 0 000025A8 57 push di 0 000025A9 56 push si 0 000025AA E8[FEFF] call _handle_break 770 _.LVL75: 771 _.L98: 337:chario.c **** } 772 .loc 1 337 0 0 000025AD 31C0 xor ax, ax 0 000025AF 50 push ax 0 000025B0 57 push di 0 000025B1 FF7608 push word ptr [bp+8] 0 000025B4 E8[FEFF] call _read_char 778 _.LVL76: 0 000025B7 B400 mov ah, 0 0 000025B9 8946FE mov word ptr [bp-2], ax 0 000025BC EB89 jmp _.L90 782 _.LVL77: 783 _.L99: 784 _.LBB10: 785 _.LBB9: 84:chario.c **** if (err < 0) 786 .loc 1 84 0 0 000025BE B80001 mov ax, 256 788 _.LVL78: 0 000025C1 EBB6 jmp _.L92 790 _.LVL79: 791 _.L91: 792 _.LBE9: 793 _.LBE10: 319:chario.c **** check_handle_break(&syscon); 794 .loc 1 319 0 0 000025C3 837E0E00 cmp word ptr [bp+14], 0 0 000025C7 7418 je _.L94 319:chario.c **** check_handle_break(&syscon); 797 .loc 1 319 0 is_stmt 0 discriminator 1 0 000025C9 8B04 mov ax, word ptr [si] 0 000025CB 3B06[0000] cmp ax, word ptr [_syscon] 0 000025CF 7509 jne _.L100 0 000025D1 8B4402 mov ax, word ptr [si+2] 0 000025D4 3B06[0200] cmp ax, word ptr [_syscon+2] 0 000025D8 7407 je _.L94 804 _.L100: 320:chario.c **** /* the idle int is only safe if we're using the character stack */ 805 .loc 1 320 0 is_stmt 1 0 000025DA B8[0000] mov ax, offset _syscon 0 000025DD 50 push ax 0 000025DE E8[FEFF] call _check_handle_break 809 _.LVL80: 810 _.L94: 322:chario.c **** DosIdle_int(); 811 .loc 1 322 0 0 000025E1 C41E[0000] les bx, dword ptr [_user_r] 0 000025E5 26807F010C cmp byte ptr es:[bx+1], 12 0 000025EA 7603E946FF ja _.L96 323:chario.c **** } 815 .loc 1 323 0 0 000025EF E8[FEFF] call _DosIdle_int 817 _.LVL81: 0 000025F2 E940FF jmp _.L96 819 _.LVL82: 820 _.L86: 327:chario.c **** 821 .loc 1 327 0 0 000025F5 B80100 mov ax, 1 0 000025F8 50 push ax 0 000025F9 8D56FE lea dx, [-2+bp] 0 000025FC 16 push ss 0 000025FD 52 push dx 0 000025FE 50 push ax 0 000025FF FF7608 push word ptr [bp+8] 0 00002602 E8[FEFF] call _DosRWSft 830 _.LVL83: 0 00002605 E974FF jmp _.L93 832 _.LFE21: 833 .size _read_char_sft_dev, .-_read_char_sft_dev 834 .global _cooked_write 835 .type _cooked_write, @function 836 _cooked_write: 837 _.LFB15: 184:chario.c **** size_t xfer; 838 .loc 1 184 0 839 _.LVL84: 0 00002608 56 push si 0 00002609 57 push di 0 0000260A 55 push bp 843 _.LCFI30: 0 0000260B 89E5 mov bp, sp 845 _.LCFI31: 0 0000260D 83EC0A sub sp, 10 0 00002610 8B7E08 mov di, word ptr [bp+8] 0 00002613 C4460C les ax, dword ptr [bp+12] 0 00002616 8946FA mov word ptr [bp-6], ax 0 00002619 8C46F8 mov word ptr [bp-8], es 188:chario.c **** 851 .loc 1 188 0 0 0000261C C41D les bx, dword ptr [di] 0 0000261E 268B4704 mov ax, word ptr es:[bx+4] 0 00002622 B103 mov cl, 3 0 00002624 D2E0 shl al, cl 0 00002626 2480 and al, -128 0 00002628 8846FD mov byte ptr [bp-3], al 858 _.LVL85: 190:chario.c **** { 859 .loc 1 190 0 0 0000262B 31F6 xor si, si 861 _.LVL86: 862 _.L110: 190:chario.c **** { 863 .loc 1 190 0 is_stmt 0 discriminator 1 0 0000262D 3B760A cmp si, word ptr [bp+10] 0 00002630 720D jc _.L122 866 _.LVL87: 867 _.L121: 224:chario.c **** } 868 .loc 1 224 0 is_stmt 1 0 00002632 89F1 mov cx, si 0 00002634 31D2 xor dx, dx 871 _.L109: 225:chario.c **** 872 .loc 1 225 0 0 00002636 91 xchg cx, ax 0 00002637 89EC mov sp, bp 0 00002639 5D pop bp 0 0000263A 5F pop di 0 0000263B 5E pop si 878 _.LVL88: 0 0000263C C20800 ret 8 880 _.LVL89: 881 _.L122: 882 _.LBB18: 193:chario.c **** 883 .loc 1 193 0 0 0000263F 8E46F8 mov es, word ptr [bp-8] 0 00002642 8B5EFA mov bx, word ptr [bp-6] 0 00002645 268A07 mov al, byte ptr es:[bx] 0 00002648 8846FE mov byte ptr [bp-2], al 195:chario.c **** break; 888 .loc 1 195 0 0 0000264B 3C1A cmp al, 26 0 0000264D 74E3 je _.L121 193:chario.c **** 891 .loc 1 193 0 0 0000264F C646FC01 mov byte ptr [bp-4], 1 200:chario.c **** count = 8 - (scr_pos & 7); 893 .loc 1 200 0 0 00002653 3C09 cmp al, 9 0 00002655 7510 jne _.L112 201:chario.c **** c = ' '; 896 .loc 1 201 0 0 00002657 A0[0000] mov al, byte ptr [_scr_pos] 0 0000265A 2407 and al, 7 0 0000265C B408 mov ah, 8 0 0000265E 28C4 sub ah, al 0 00002660 8866FC mov byte ptr [bp-4], ah 902 _.LVL90: 202:chario.c **** } 903 .loc 1 202 0 0 00002663 C646FE20 mov byte ptr [bp-2], 32 905 _.LVL91: 906 _.L112: 204:chario.c **** do { 907 .loc 1 204 0 0 00002667 FF76FC push word ptr [bp-4] 0 0000266A FF76FE push word ptr [bp-2] 0 0000266D E8[FEFF] call _update_scr_pos 911 _.LVL92: 912 _.L120: 208:chario.c **** raw_get_char(pdev, TRUE); /* Test for hold char and ctl_c */ 913 .loc 1 208 0 0 00002670 807EFD80 cmp byte ptr [bp-3], -128 0 00002674 7715 ja _.L114 208:chario.c **** raw_get_char(pdev, TRUE); /* Test for hold char and ctl_c */ 916 .loc 1 208 0 is_stmt 0 discriminator 1 0 00002676 57 push di 0 00002677 E8[FEFF] call _check_handle_break 919 _.LVL93: 0 0000267A 3C13 cmp al, 19 0 0000267C 750D jne _.L114 922 _.LVL94: 923 _.LBB19: 924 _.LBB20: 344:chario.c **** } 925 .loc 1 344 0 is_stmt 1 0 0000267E B80100 mov ax, 1 0 00002681 50 push ax 0 00002682 57 push di 0 00002683 B8FFFF mov ax, -1 0 00002686 50 push ax 0 00002687 50 push ax 0 00002688 E893FE call _read_char_sft_dev 933 _.LVL95: 934 _.L114: 935 _.LBE20: 936 _.LBE19: 210:chario.c **** fast_counter &= 0x9f; 937 .loc 1 210 0 0 0000268B 8A46FD mov al, byte ptr [bp-3] 0 0000268E FEC0 inc al 940 _.LVL96: 211:chario.c **** if (PrinterEcho) 941 .loc 1 211 0 0 00002690 249F and al, -97 943 _.LVL97: 0 00002692 8846FD mov byte ptr [bp-3], al 945 _.LVL98: 212:chario.c **** DosWrite(STDPRN, 1, &c); 946 .loc 1 212 0 0 00002695 803E[0000]00 cmp byte ptr [_PrinterEcho], 0 0 0000269A 741E je _.L116 213:chario.c **** if (fast_counter & 0x80) 949 .loc 1 213 0 0 0000269C B80400 mov ax, 4 951 _.LVL99: 0 0000269F 50 push ax 0 000026A0 8C56F6 mov word ptr [bp-10], ss 0 000026A3 E8[FEFF] call _get_sft_idx 955 _.LVL100: 0 000026A6 B90200 mov cx, 2 0 000026A9 51 push cx 0 000026AA 8B56F6 mov dx, word ptr [bp-10] 0 000026AD 52 push dx 0 000026AE 8D56FE lea dx, [-2+bp] 0 000026B1 52 push dx 0 000026B2 BA0100 mov dx, 1 0 000026B5 52 push dx 0 000026B6 50 push ax 0 000026B7 E8[FEFF] call _DosRWSft 966 _.LVL101: 967 _.L116: 214:chario.c **** fast_put_char(c); 968 .loc 1 214 0 0 000026BA 807EFD00 cmp byte ptr [bp-3], 0 0 000026BE 8A46FE mov al, byte ptr [bp-2] 0 000026C1 7D0E jge _.L117 972 _.LVL102: 973 _.LBB21: 974 _.LBB22: 155:chario.c **** #elif defined(I86) 975 .loc 1 155 0 976 #APP 977 ;# 155 "chario.c" 1 978 int 0x29 979 ;# 0 "" 2 980 _.LVL103: 981 #NO_APP 982 _.L118: 983 _.LBE22: 984 _.LBE21: 222:chario.c **** } 985 .loc 1 222 0 0 000026C5 FE4EFC dec byte ptr [bp-4] 987 _.LVL104: 0 000026C8 75A6 jne _.L120 193:chario.c **** 989 .loc 1 193 0 0 000026CA FF46FA inc word ptr [bp-6] 991 _.LVL105: 992 _.LBE18: 190:chario.c **** { 993 .loc 1 190 0 0 000026CD 46 inc si 995 _.LVL106: 0 000026CE E95CFF jmp _.L110 997 _.LVL107: 998 _.L117: 0 000026D1 8846FF mov byte ptr [bp-1], al 1000 _.LVL108: 1001 _.LBB25: 1002 _.LBB23: 1003 _.LBB24: 82:chario.c **** if (err == 0) 1004 .loc 1 82 0 0 000026D4 B80800 mov ax, 8 0 000026D7 50 push ax 0 000026D8 8D46FF lea ax, [-1+bp] 1008 _.LVL109: 0 000026DB 16 push ss 0 000026DC 50 push ax 0 000026DD B80100 mov ax, 1 1012 _.LVL110: 0 000026E0 50 push ax 1014 _.LVL111: 0 000026E1 57 push di 1016 _.LVL112: 0 000026E2 E8[FEFF] call _BinaryCharIO 1018 _.LVL113: 85:chario.c **** return err; 1019 .loc 1 85 0 0 000026E5 85C0 test ax, ax 0 000026E7 7DDC jge _.L118 1022 _.LVL114: 1023 _.LBE24: 1024 _.LBE23: 220:chario.c **** } 1025 .loc 1 220 0 0 000026E9 89C1 mov cx, ax 0 000026EB 99 cwd 0 000026EC E947FF jmp _.L109 1029 _.LBE25: 1030 _.LFE15: 1031 .size _cooked_write, .-_cooked_write 1032 .global _cooked_read 1033 .type _cooked_read, @function 1034 _cooked_read: 1035 _.LFB20: 281:chario.c **** unsigned xfer = 0; 1036 .loc 1 281 0 1037 _.LVL115: 0 000026EF 56 push si 0 000026F0 57 push di 0 000026F1 55 push bp 1041 _.LCFI32: 0 000026F2 89E5 mov bp, sp 1043 _.LCFI33: 0 000026F4 1E push ds 0 000026F5 1E push ds 0 000026F6 8B5E0A mov bx, word ptr [bp+10] 0 000026F9 8B7E0C mov di, word ptr [bp+12] 0 000026FC 8B460E mov ax, word ptr [bp+14] 0 000026FF 8946FC mov word ptr [bp-4], ax 1050 _.LVL116: 282:chario.c **** int c; 1051 .loc 1 282 0 0 00002702 31F6 xor si, si 1053 _.LVL117: 1054 _.L131: 284:chario.c **** { 1055 .loc 1 284 0 0 00002704 89D8 mov ax, bx 0 00002706 48 dec ax 0 00002707 8946FE mov word ptr [bp-2], ax 1059 _.LVL118: 0 0000270A 85DB test bx, bx 0 0000270C 7506 jne _.L135 1062 _.LVL119: 1063 _.L134: 296:chario.c **** } 1064 .loc 1 296 0 0 0000270E 89F3 mov bx, si 0 00002710 31D2 xor dx, dx 0 00002712 EB16 jmp _.L130 1068 _.LVL120: 1069 _.L135: 1070 _.LBB28: 1071 _.LBB29: 344:chario.c **** } 1072 .loc 1 344 0 0 00002714 B80100 mov ax, 1 1074 _.LVL121: 0 00002717 50 push ax 0 00002718 FF7608 push word ptr [bp+8] 0 0000271B B8FFFF mov ax, -1 0 0000271E 50 push ax 0 0000271F 50 push ax 0 00002720 E8FBFD call _read_char_sft_dev 1081 _.LVL122: 1082 _.LBE29: 1083 _.LBE28: 287:chario.c **** return c; 1084 .loc 1 287 0 0 00002723 85C0 test ax, ax 0 00002725 7D0C jge _.L132 288:chario.c **** if (c == 256) 1087 .loc 1 288 0 0 00002727 89C3 mov bx, ax 0 00002729 99 cwd 1090 _.LVL123: 1091 _.L130: 297:chario.c **** 1092 .loc 1 297 0 0 0000272A 93 xchg bx, ax 0 0000272B 89EC mov sp, bp 0 0000272D 5D pop bp 0 0000272E 5F pop di 0 0000272F 5E pop si 1098 _.LVL124: 0 00002730 C20800 ret 8 1100 _.LVL125: 1101 _.L132: 289:chario.c **** break; 1102 .loc 1 289 0 0 00002733 3D0001 cmp ax, 256 0 00002736 74D6 je _.L134 291:chario.c **** xfer++; 1105 .loc 1 291 0 0 00002738 8D5501 lea dx, [1+di] 1107 _.LVL126: 0 0000273B 8E46FC mov es, word ptr [bp-4] 0 0000273E 268805 mov byte ptr es:[di], al 1110 _.LVL127: 292:chario.c **** if ((unsigned char)c == CTL_Z) 1111 .loc 1 292 0 0 00002741 46 inc si 1113 _.LVL128: 0 00002742 8B5EFE mov bx, word ptr [bp-2] 293:chario.c **** break; 1115 .loc 1 293 0 0 00002745 3C1A cmp al, 26 0 00002747 74C5 je _.L134 291:chario.c **** xfer++; 1118 .loc 1 291 0 0 00002749 89D7 mov di, dx 0 0000274B EBB7 jmp _.L131 1121 _.LFE20: 1122 .size _cooked_read, .-_cooked_read 1123 .global _read_char_stdin 1124 .type _read_char_stdin, @function 1125 _read_char_stdin: 1126 _.LFB25: 352:chario.c **** 353:chario.c **** STATIC unsigned char read_char_check_break(int sft_in, int sft_out) 354:chario.c **** { 355:chario.c **** return read_char(sft_in, sft_out, TRUE); 356:chario.c **** } 357:chario.c **** 358:chario.c **** unsigned char read_char_stdin(BOOL check_break) 359:chario.c **** { 1127 .loc 1 359 0 1128 _.LVL129: 0 0000274D 56 push si 0 0000274E 55 push bp 1131 _.LCFI34: 0 0000274F 89E5 mov bp, sp 1133 _.LCFI35: 360:chario.c **** return read_char(get_sft_idx(STDIN), get_sft_idx(STDOUT), check_break); 1134 .loc 1 360 0 0 00002751 B80100 mov ax, 1 0 00002754 50 push ax 0 00002755 E8[FEFF] call _get_sft_idx 1138 _.LVL130: 0 00002758 96 xchg si, ax 0 00002759 31C0 xor ax, ax 0 0000275B 50 push ax 0 0000275C E8[FEFF] call _get_sft_idx 1143 _.LVL131: 0 0000275F FF7606 push word ptr [bp+6] 0 00002762 56 push si 0 00002763 50 push ax 0 00002764 E8[FEFF] call _read_char 1148 _.LVL132: 361:chario.c **** } 1149 .loc 1 361 0 0 00002767 89EC mov sp, bp 0 00002769 5D pop bp 0 0000276A 5E pop si 0 0000276B C20200 ret 2 1154 _.LFE25: 1155 .size _read_char_stdin, .-_read_char_stdin 1156 .global _read_line 1157 .type _read_line, @function 1158 _read_line: 1159 _.LFB26: 362:chario.c **** 363:chario.c **** /* reads a line (buffered, called by int21/ah=0ah, 3fh) */ 364:chario.c **** void read_line(int sft_in, int sft_out, keyboard FAR * kp) 365:chario.c **** { 1160 .loc 1 365 0 1161 _.LVL133: 0 0000276E 56 push si 0 0000276F 57 push di 0 00002770 55 push bp 1165 _.LCFI36: 0 00002771 89E5 mov bp, sp 1167 _.LCFI37: 0 00002773 83EC12 sub sp, 18 0 00002776 8B460C mov ax, word ptr [bp+12] 0 00002779 8946FA mov word ptr [bp-6], ax 0 0000277C 8B460E mov ax, word ptr [bp+14] 0 0000277F 8946F8 mov word ptr [bp-8], ax 1173 _.LVL134: 366:chario.c **** unsigned c; 367:chario.c **** unsigned cu_pos = scr_pos; 368:chario.c **** unsigned count = 0, stored_pos = 0; 369:chario.c **** unsigned size = kp->kb_size, stored_size = kp->kb_count; 1174 .loc 1 369 0 0 00002782 8EC0 mov es, ax 0 00002784 8B5EFA mov bx, word ptr [bp-6] 0 00002787 268A07 mov al, byte ptr es:[bx] 0 0000278A 8846F0 mov byte ptr [bp-16], al 1179 _.LVL135: 370:chario.c **** BOOL insert = FALSE, first = TRUE; 371:chario.c **** 372:chario.c **** if (size == 0) 1180 .loc 1 372 0 0 0000278D 8166F0FF00 and word ptr [bp-16], 255 1182 _.LVL136: 0 00002792 7503E96301 je _.L142 369:chario.c **** BOOL insert = FALSE, first = TRUE; 1184 .loc 1 369 0 0 00002797 268A4701 mov al, byte ptr es:[bx+1] 1186 _.LVL137: 0 0000279B 30E4 xor ah, ah 0 0000279D 8946F6 mov word ptr [bp-10], ax 373:chario.c **** return; 374:chario.c **** 375:chario.c **** /* the stored line is invalid unless it ends with a CR */ 376:chario.c **** if (kp->kb_buf[stored_size] != CR) 1189 .loc 1 376 0 0 000027A0 97 xchg di, ax 0 000027A1 268079020D cmp byte ptr es:[bx+di+2], 13 0 000027A6 7405 je _.L144 377:chario.c **** stored_size = 0; 1193 .loc 1 377 0 0 000027A8 C746F60000 mov word ptr [bp-10], 0 1195 _.L144: 367:chario.c **** unsigned count = 0, stored_pos = 0; 1196 .loc 1 367 0 0 000027AD A0[0000] mov al, byte ptr [_scr_pos] 0 000027B0 8846EE mov byte ptr [bp-18], al 0 000027B3 C646EF00 mov byte ptr [bp-17], 0 0 000027B7 BF0100 mov di, 1 0 000027BA C746F20000 mov word ptr [bp-14], 0 0 000027BF 31F6 xor si, si 0 000027C1 8976FC mov word ptr [bp-4], si 1204 _.LVL138: 1205 _.L145: 1206 _.LBB43: 1207 _.LBB44: 1208 _.LBB45: 355:chario.c **** } 1209 .loc 1 355 0 0 000027C4 B80100 mov ax, 1 0 000027C7 50 push ax 0 000027C8 FF760A push word ptr [bp+10] 0 000027CB FF7608 push word ptr [bp+8] 0 000027CE E8[FEFF] call _read_char 1215 _.LVL139: 1216 _.LBE45: 1217 _.LBE44: 378:chario.c **** 379:chario.c **** do 380:chario.c **** { 381:chario.c **** unsigned new_pos = stored_size; 382:chario.c **** 383:chario.c **** c = read_char_check_break(sft_in, sft_out); 1218 .loc 1 383 0 0 000027D1 88C2 mov dl, al 1220 _.LVL140: 384:chario.c **** if (c == 0) 1221 .loc 1 384 0 0 000027D3 81E2FF00 and dx, 255 1223 _.LVL141: 0 000027D7 8956FE mov word ptr [bp-2], dx 0 000027DA 7403E92B03 jne _.L147 1226 _.LVL142: 1227 _.LBB46: 1228 _.LBB47: 355:chario.c **** } 1229 .loc 1 355 0 0 000027DF B80100 mov ax, 1 0 000027E2 50 push ax 0 000027E3 FF760A push word ptr [bp+10] 0 000027E6 FF7608 push word ptr [bp+8] 0 000027E9 E8[FEFF] call _read_char 1235 _.LVL143: 1236 _.LBE47: 1237 _.LBE46: 385:chario.c **** c = (unsigned)read_char_check_break(sft_in, sft_out) << 8; 1238 .loc 1 385 0 0 000027EC B108 mov cl, 8 0 000027EE D3E0 shl ax, cl 0 000027F0 8946FE mov word ptr [bp-2], ax 1242 _.LVL144: 386:chario.c **** switch (c) 1243 .loc 1 386 0 0 000027F3 3D003D cmp ax, 15616 0 000027F6 7503E90B02 je _.L187 0 000027FB 7603E90201 ja _.L150 0 00002800 83F81B cmp ax, 27 0 00002803 7503E9D302 je _.L151 0 00002808 775B ja _.L152 0 0000280A 83F808 cmp ax, 8 0 0000280D 7470 je _.L153 0 0000280F 83F80A cmp ax, 10 0 00002812 7503E9AF01 je _.L154 0 00002817 83F806 cmp ax, 6 0 0000281A 7503E94901 je _.L146 1256 _.L148: 1257 _.LVL145: 387:chario.c **** { 388:chario.c **** case LF: 389:chario.c **** /* show LF if it's not the first character. Never store it */ 390:chario.c **** if (!first) 391:chario.c **** { 392:chario.c **** write_char(CR, sft_out); 393:chario.c **** write_char(LF, sft_out); 394:chario.c **** } 395:chario.c **** break; 396:chario.c **** 397:chario.c **** case CTL_F: 398:chario.c **** break; 399:chario.c **** 400:chario.c **** case RIGHT: 401:chario.c **** case F1: 402:chario.c **** if (stored_pos < stored_size && count < size - 1) 403:chario.c **** local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); 404:chario.c **** break; 405:chario.c **** 406:chario.c **** case F2: 407:chario.c **** case F4: 408:chario.c **** /* insert/delete up to character c */ 409:chario.c **** { 410:chario.c **** unsigned char c2 = read_char_check_break(sft_in, sft_out); 411:chario.c **** new_pos = stored_pos; 412:chario.c **** if (c2 == 0) 413:chario.c **** { 414:chario.c **** read_char_check_break(sft_in, sft_out); 415:chario.c **** } 416:chario.c **** else 417:chario.c **** { 418:chario.c **** char FAR *sp = fmemchr(&kp->kb_buf[stored_pos], 419:chario.c **** c2, stored_size - stored_pos); 420:chario.c **** if (sp != NULL) 421:chario.c **** new_pos = (FP_OFF(sp) - FP_OFF(&kp->kb_buf[stored_pos])) + 1; 422:chario.c **** } 423:chario.c **** } 424:chario.c **** /* fall through */ 425:chario.c **** case F3: 426:chario.c **** if (c != F4) /* not delete */ 427:chario.c **** { 428:chario.c **** while (stored_pos < new_pos && count < size - 1) 429:chario.c **** local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); 430:chario.c **** } 431:chario.c **** stored_pos = new_pos; 432:chario.c **** break; 433:chario.c **** 434:chario.c **** case F5: 435:chario.c **** fmemcpy(kp->kb_buf, local_buffer, count); 436:chario.c **** stored_size = count; 437:chario.c **** write_char('@', sft_out); 438:chario.c **** goto start_new_line; 439:chario.c **** 440:chario.c **** case INS: 441:chario.c **** insert = !insert; 442:chario.c **** break; 443:chario.c **** 444:chario.c **** case DEL: 445:chario.c **** stored_pos++; 446:chario.c **** break; 447:chario.c **** 448:chario.c **** case LEFT: 449:chario.c **** case CTL_BS: 450:chario.c **** case BS: 451:chario.c **** if (count > 0) 452:chario.c **** { 453:chario.c **** unsigned new_pos; 454:chario.c **** char c2 = local_buffer[--count]; 455:chario.c **** if (c2 == HT) 456:chario.c **** { 457:chario.c **** unsigned i; 458:chario.c **** new_pos = cu_pos; 459:chario.c **** for (i = 0; i < count; i++) 460:chario.c **** { 461:chario.c **** if (local_buffer[i] == HT) 462:chario.c **** new_pos = (new_pos + 8) & ~7; 463:chario.c **** else if (iscntrl(local_buffer[i])) 464:chario.c **** new_pos += 2; 465:chario.c **** else 466:chario.c **** new_pos++; 467:chario.c **** } 468:chario.c **** do 469:chario.c **** destr_bs(sft_out); 470:chario.c **** while (scr_pos > new_pos); 471:chario.c **** } 472:chario.c **** else 473:chario.c **** { 474:chario.c **** if (iscntrl(c2)) 475:chario.c **** destr_bs(sft_out); 476:chario.c **** destr_bs(sft_out); 477:chario.c **** } 478:chario.c **** } 479:chario.c **** if (stored_pos > 0) 480:chario.c **** stored_pos--; 481:chario.c **** break; 482:chario.c **** 483:chario.c **** case ESC: 484:chario.c **** write_char('\\', sft_out); 485:chario.c **** start_new_line: 486:chario.c **** write_char(CR, sft_out); 487:chario.c **** write_char(LF, sft_out); 488:chario.c **** for (count = 0; count < cu_pos; count++) 489:chario.c **** write_char(' ', sft_out); 490:chario.c **** count = 0; 491:chario.c **** stored_pos = 0; 492:chario.c **** insert = FALSE; 493:chario.c **** break; 494:chario.c **** 495:chario.c **** case F6: 496:chario.c **** c = CTL_Z; 497:chario.c **** /* fall through */ 498:chario.c **** 499:chario.c **** default: 500:chario.c **** if (c >= 256) 1258 .loc 1 500 0 0 0000281F 817EFEFF00 cmp word ptr [bp-2], 255 0 00002824 7603E93F01 ja _.L146 1261 _.LVL146: 1262 _.L159: 501:chario.c **** break; 502:chario.c **** if (count < size - 1 || c == CR) 1263 .loc 1 502 0 0 00002829 8B46F0 mov ax, word ptr [bp-16] 0 0000282C 48 dec ax 0 0000282D 3946FC cmp word ptr [bp-4], ax 0 00002830 7209 jc _.L191 0 00002832 837EFE0D cmp word ptr [bp-2], 13 0 00002836 7403E9C202 jne _.L181 1270 _.L191: 503:chario.c **** local_buffer[count++] = echo_char(c, sft_out); 1271 .loc 1 503 0 0 0000283B 8B7EFC mov di, word ptr [bp-4] 1273 _.LVL147: 0 0000283E 47 inc di 1275 _.LVL148: 0 0000283F FF760A push word ptr [bp+10] 0 00002842 FF76FE push word ptr [bp-2] 0 00002845 E8ECFB call _echo_char 1279 _.LVL149: 0 00002848 8B5EFC mov bx, word ptr [bp-4] 0 0000284B 8887[0000] mov byte ptr [bx+_local_buffer], al 0 0000284F 897EFC mov word ptr [bp-4], di 1283 _.LVL150: 1284 _.L183: 504:chario.c **** else 505:chario.c **** write_char(BELL, sft_out); 506:chario.c **** if (stored_pos < stored_size && !insert) 1285 .loc 1 506 0 0 00002852 3B76F6 cmp si, word ptr [bp-10] 0 00002855 736A jnc _.L178 0 00002857 F646F201 test byte ptr [bp-14], 1 0 0000285B 7564 jne _.L178 507:chario.c **** stored_pos++; 1290 .loc 1 507 0 0 0000285D 46 inc si 1292 _.LVL151: 0 0000285E C746F20000 mov word ptr [bp-14], 0 1294 _.LVL152: 0 00002863 EB5C jmp _.L178 1296 _.LVL153: 1297 _.L152: 386:chario.c **** { 1298 .loc 1 386 0 0 00002865 817EFE003B cmp word ptr [bp-2], 15104 0 0000286A 7503E91C01 je _.L155 0 0000286F 817EFE003C cmp word ptr [bp-2], 15360 0 00002874 7503E9B300 je _.L156 0 00002879 837EFE7F cmp word ptr [bp-2], 127 0 0000287D 75A0 jne _.L148 1305 _.LVL154: 1306 _.L153: 451:chario.c **** { 1307 .loc 1 451 0 0 0000287F 837EFC00 cmp word ptr [bp-4], 0 0 00002883 7434 je _.L169 1310 _.LBB48: 454:chario.c **** if (c2 == HT) 1311 .loc 1 454 0 0 00002885 FF4EFC dec word ptr [bp-4] 1313 _.LVL155: 0 00002888 BF[0000] mov di, offset _local_buffer 1315 _.LVL156: 0 0000288B 8B5EFC mov bx, word ptr [bp-4] 0 0000288E 8A01 mov al, byte ptr [bx+di] 1318 _.LVL157: 455:chario.c **** { 1319 .loc 1 455 0 0 00002890 3C09 cmp al, 9 0 00002892 8EC7 mov es, di 0 00002894 7403E92F02 jne _.L170 0 00002899 8B46EE mov ax, word ptr [bp-18] 1324 _.LVL158: 0 0000289C 8946F4 mov word ptr [bp-12], ax 0 0000289F 31C0 xor ax, ax 1327 _.LVL159: 1328 _.L171: 1329 _.LBB49: 459:chario.c **** { 1330 .loc 1 459 0 discriminator 1 0 000028A1 3B46FC cmp ax, word ptr [bp-4] 0 000028A4 7303E9EF01 jc _.L175 1333 _.LVL160: 1334 _.L232: 469:chario.c **** while (scr_pos > new_pos); 1335 .loc 1 469 0 discriminator 1 0 000028A9 FF760A push word ptr [bp+10] 0 000028AC E860FB call _destr_bs 1338 _.LVL161: 470:chario.c **** } 1339 .loc 1 470 0 discriminator 1 0 000028AF A0[0000] mov al, byte ptr [_scr_pos] 0 000028B2 30E4 xor ah, ah 0 000028B4 3946F4 cmp word ptr [bp-12], ax 0 000028B7 72F0 jc _.L232 1344 _.LVL162: 1345 _.L169: 1346 _.LBE49: 1347 _.LBE48: 480:chario.c **** break; 1348 .loc 1 480 0 0 000028B9 83FE01 cmp si, 1 0 000028BC F5 cmc 0 000028BD 19C0 sbb ax, ax 0 000028BF 01C6 add si, ax 1353 _.LVL163: 1354 _.L178: 1355 _.LBE43: 508:chario.c **** break; 509:chario.c **** } 510:chario.c **** first = FALSE; 511:chario.c **** } while (c != CR); 1356 .loc 1 511 0 0 000028C1 837EFE0D cmp word ptr [bp-2], 13 0 000028C5 7403E99E00 jne _.L146 512:chario.c **** fmemcpy(kp->kb_buf, local_buffer, count); 1359 .loc 1 512 0 0 000028CA FF76FC push word ptr [bp-4] 0 000028CD 16 push ss 0 000028CE B8[0000] mov ax, offset _local_buffer 0 000028D1 50 push ax 0 000028D2 8B46FA mov ax, word ptr [bp-6] 0 000028D5 83C002 add ax, 2 0 000028D8 FF76F8 push word ptr [bp-8] 0 000028DB 50 push ax 0 000028DC E8[FEFF] call _fmemcpy 1369 _.LVL164: 513:chario.c **** /* if local_buffer overflows into the CON default buffer we 514:chario.c **** must invalidate it */ 515:chario.c **** if (count > LINEBUFSIZECON) 1370 .loc 1 515 0 0 000028DF 817EFC8000 cmp word ptr [bp-4], 128 0 000028E4 7605 jbe _.L184 516:chario.c **** kb_buf.kb_size = 0; 1373 .loc 1 516 0 0 000028E6 C606[0000]00 mov byte ptr [_kb_buf], 0 1375 _.L184: 517:chario.c **** /* kb_count does not include the final CR */ 518:chario.c **** kp->kb_count = count - 1; 1376 .loc 1 518 0 0 000028EB 8A46FC mov al, byte ptr [bp-4] 0 000028EE FEC8 dec al 0 000028F0 8E46F8 mov es, word ptr [bp-8] 0 000028F3 8B5EFA mov bx, word ptr [bp-6] 0 000028F6 26884701 mov byte ptr es:[bx+1], al 1382 _.LVL165: 1383 _.L142: 519:chario.c **** } 1384 .loc 1 519 0 0 000028FA 89EC mov sp, bp 0 000028FC 5D pop bp 0 000028FD 5F pop di 0 000028FE 5E pop si 0 000028FF C20800 ret 8 1390 _.LVL166: 1391 _.L150: 1392 _.LBB59: 386:chario.c **** { 1393 .loc 1 386 0 0 00002902 817EFE004B cmp word ptr [bp-2], 19200 0 00002907 7503E973FF je _.L153 0 0000290C 775F ja _.L157 0 0000290E 817EFE003F cmp word ptr [bp-2], 16128 0 00002913 7503E92801 je _.L158 0 00002918 817EFE0040 cmp word ptr [bp-2], 16384 0 0000291D 7503E9D301 je _.L188 0 00002922 817EFE003E cmp word ptr [bp-2], 15872 0 00002927 7403E9F3FE jne _.L148 1403 _.L156: 1404 _.LVL167: 1405 _.LBB51: 1406 _.LBB52: 1407 _.LBB53: 355:chario.c **** } 1408 .loc 1 355 0 0 0000292C B80100 mov ax, 1 1410 _.LVL168: 0 0000292F 50 push ax 0 00002930 FF760A push word ptr [bp+10] 0 00002933 FF7608 push word ptr [bp+8] 0 00002936 E8[FEFF] call _read_char 1415 _.LVL169: 1416 _.LBE53: 1417 _.LBE52: 412:chario.c **** { 1418 .loc 1 412 0 0 00002939 84C0 test al, al 0 0000293B 7403E9A000 jne _.L162 1421 _.LVL170: 1422 _.LBB54: 1423 _.LBB55: 355:chario.c **** } 1424 .loc 1 355 0 0 00002940 B80100 mov ax, 1 0 00002943 50 push ax 0 00002944 FF760A push word ptr [bp+10] 0 00002947 FF7608 push word ptr [bp+8] 0 0000294A E8[FEFF] call _read_char 1430 _.LVL171: 0 0000294D 89F1 mov cx, si 1432 _.LVL172: 1433 _.L163: 1434 _.LBE55: 1435 _.LBE54: 1436 _.LBE51: 426:chario.c **** { 1437 .loc 1 426 0 0 0000294F 817EFE003E cmp word ptr [bp-2], 15872 0 00002954 7410 je _.L190 1440 _.LVL173: 1441 _.L165: 428:chario.c **** local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); 1442 .loc 1 428 0 0 00002956 39CE cmp si, cx 0 00002958 730C jnc _.L190 428:chario.c **** local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); 1445 .loc 1 428 0 is_stmt 0 discriminator 1 0 0000295A 8B46F0 mov ax, word ptr [bp-16] 0 0000295D 48 dec ax 0 0000295E 3946FC cmp word ptr [bp-4], ax 0 00002961 7303E9A600 jc _.L167 1450 _.LVL174: 1451 _.L190: 0 00002966 89CE mov si, cx 1453 _.L146: 0 00002968 31FF xor di, di 0 0000296A E957FE jmp _.L145 1456 _.LVL175: 1457 _.L157: 386:chario.c **** { 1458 .loc 1 386 0 is_stmt 1 0 0000296D 817EFE0052 cmp word ptr [bp-2], 20992 0 00002972 7503E91601 je _.L160 0 00002977 817EFE0053 cmp word ptr [bp-2], 21248 0 0000297C 7503E91301 je _.L161 0 00002981 817EFE004D cmp word ptr [bp-2], 19712 0 00002986 7403E994FE jne _.L148 1465 _.L155: 402:chario.c **** local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); 1466 .loc 1 402 0 0 0000298B 3B76F6 cmp si, word ptr [bp-10] 0 0000298E 73D8 jnc _.L146 402:chario.c **** local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); 1469 .loc 1 402 0 is_stmt 0 discriminator 1 0 00002990 8B46F0 mov ax, word ptr [bp-16] 1471 _.LVL176: 0 00002993 48 dec ax 0 00002994 3946FC cmp word ptr [bp-4], ax 0 00002997 73CF jnc _.L146 403:chario.c **** break; 1475 .loc 1 403 0 is_stmt 1 0 00002999 8B46FC mov ax, word ptr [bp-4] 0 0000299C 40 inc ax 0 0000299D 8946FE mov word ptr [bp-2], ax 1479 _.LVL177: 0 000029A0 8D7C01 lea di, [1+si] 1481 _.LVL178: 0 000029A3 FF760A push word ptr [bp+10] 0 000029A6 8E46F8 mov es, word ptr [bp-8] 0 000029A9 8B5EFA mov bx, word ptr [bp-6] 0 000029AC 268A4002 mov al, byte ptr es:[bx+si+2] 1486 _.LVL179: 0 000029B0 98 cbw 0 000029B1 50 push ax 0 000029B2 E87FFA call _echo_char 1490 _.LVL180: 0 000029B5 8B5EFC mov bx, word ptr [bp-4] 0 000029B8 8887[0000] mov byte ptr [bx+_local_buffer], al 0 000029BC 89FE mov si, di 0 000029BE 8B46FE mov ax, word ptr [bp-2] 0 000029C1 8946FC mov word ptr [bp-4], ax 0 000029C4 EBA2 jmp _.L146 1497 _.LVL181: 1498 _.L154: 390:chario.c **** { 1499 .loc 1 390 0 0 000029C6 85FF test di, di 0 000029C8 759E jne _.L146 392:chario.c **** write_char(LF, sft_out); 1502 .loc 1 392 0 0 000029CA FF760A push word ptr [bp+10] 0 000029CD B80D00 mov ax, 13 0 000029D0 50 push ax 0 000029D1 E8[FEFF] call _write_char 1507 _.LVL182: 393:chario.c **** } 1508 .loc 1 393 0 0 000029D4 FF760A push word ptr [bp+10] 0 000029D7 B80A00 mov ax, 10 0 000029DA 50 push ax 0 000029DB E8[FEFF] call _write_char 1513 _.LVL183: 0 000029DE EB88 jmp _.L146 1515 _.LVL184: 1516 _.L162: 1517 _.LBB57: 1518 _.LBB56: 418:chario.c **** c2, stored_size - stored_pos); 1519 .loc 1 418 0 0 000029E0 8B5EFA mov bx, word ptr [bp-6] 0 000029E3 8D7802 lea di, [2+bx+si] 1522 _.LVL185: 0 000029E6 8B56F6 mov dx, word ptr [bp-10] 0 000029E9 29F2 sub dx, si 0 000029EB 52 push dx 0 000029EC 30E4 xor ah, ah 0 000029EE 50 push ax 0 000029EF FF76F8 push word ptr [bp-8] 0 000029F2 57 push di 0 000029F3 E8[FEFF] call _fmemchr 1531 _.LVL186: 0 000029F6 89F1 mov cx, si 420:chario.c **** new_pos = (FP_OFF(sp) - FP_OFF(&kp->kb_buf[stored_pos])) + 1; 1533 .loc 1 420 0 0 000029F8 09C2 or dx, ax 1535 _.LVL187: 0 000029FA 7503E950FF je _.L163 1537 _.LVL188: 421:chario.c **** } 1538 .loc 1 421 0 0 000029FF 40 inc ax 0 00002A00 91 xchg cx, ax 1541 _.LVL189: 0 00002A01 29F9 sub cx, di 1543 _.LVL190: 0 00002A03 E949FF jmp _.L163 1545 _.LVL191: 1546 _.L187: 1547 _.LBE56: 1548 _.LBE57: 386:chario.c **** { 1549 .loc 1 386 0 0 00002A06 8B4EF6 mov cx, word ptr [bp-10] 1551 _.LVL192: 0 00002A09 E94AFF jmp _.L165 1553 _.LVL193: 1554 _.L167: 0 00002A0C 894EF4 mov word ptr [bp-12], cx 429:chario.c **** } 1556 .loc 1 429 0 0 00002A0F 8B46FC mov ax, word ptr [bp-4] 0 00002A12 40 inc ax 0 00002A13 8946FE mov word ptr [bp-2], ax 1560 _.LVL194: 0 00002A16 8D7C01 lea di, [1+si] 1562 _.LVL195: 0 00002A19 FF760A push word ptr [bp+10] 0 00002A1C 8E46F8 mov es, word ptr [bp-8] 0 00002A1F 8B5EFA mov bx, word ptr [bp-6] 0 00002A22 268A4002 mov al, byte ptr es:[bx+si+2] 1567 _.LVL196: 0 00002A26 98 cbw 0 00002A27 50 push ax 0 00002A28 E809FA call _echo_char 1571 _.LVL197: 0 00002A2B 8B5EFC mov bx, word ptr [bp-4] 0 00002A2E 8887[0000] mov byte ptr [bx+_local_buffer], al 0 00002A32 89FE mov si, di 0 00002A34 8B46FE mov ax, word ptr [bp-2] 0 00002A37 8946FC mov word ptr [bp-4], ax 0 00002A3A 8B4EF4 mov cx, word ptr [bp-12] 0 00002A3D E916FF jmp _.L165 1579 _.LVL198: 1580 _.L158: 435:chario.c **** stored_size = count; 1581 .loc 1 435 0 0 00002A40 FF76FC push word ptr [bp-4] 0 00002A43 16 push ss 0 00002A44 B8[0000] mov ax, offset _local_buffer 1585 _.LVL199: 0 00002A47 50 push ax 0 00002A48 8B46FA mov ax, word ptr [bp-6] 0 00002A4B 83C002 add ax, 2 0 00002A4E FF76F8 push word ptr [bp-8] 0 00002A51 50 push ax 0 00002A52 E8[FEFF] call _fmemcpy 1592 _.LVL200: 437:chario.c **** goto start_new_line; 1593 .loc 1 437 0 0 00002A55 FF760A push word ptr [bp+10] 0 00002A58 B84000 mov ax, 64 0 00002A5B 50 push ax 0 00002A5C E8[FEFF] call _write_char 1598 _.LVL201: 438:chario.c **** 1599 .loc 1 438 0 0 00002A5F 8B46FC mov ax, word ptr [bp-4] 0 00002A62 8946F6 mov word ptr [bp-10], ax 1602 _.LVL202: 1603 _.L168: 486:chario.c **** write_char(LF, sft_out); 1604 .loc 1 486 0 0 00002A65 FF760A push word ptr [bp+10] 0 00002A68 B80D00 mov ax, 13 0 00002A6B 50 push ax 0 00002A6C E8[FEFF] call _write_char 1609 _.LVL203: 487:chario.c **** for (count = 0; count < cu_pos; count++) 1610 .loc 1 487 0 0 00002A6F FF760A push word ptr [bp+10] 0 00002A72 B80A00 mov ax, 10 0 00002A75 50 push ax 0 00002A76 E8[FEFF] call _write_char 1615 _.LVL204: 488:chario.c **** write_char(' ', sft_out); 1616 .loc 1 488 0 0 00002A79 31F6 xor si, si 1618 _.LVL205: 1619 _.L179: 488:chario.c **** write_char(' ', sft_out); 1620 .loc 1 488 0 is_stmt 0 discriminator 1 0 00002A7B 3B76EE cmp si, word ptr [bp-18] 0 00002A7E 7268 jc _.L180 492:chario.c **** break; 1623 .loc 1 492 0 is_stmt 1 0 00002A80 C746F20000 mov word ptr [bp-14], 0 1625 _.LVL206: 491:chario.c **** insert = FALSE; 1626 .loc 1 491 0 0 00002A85 31C9 xor cx, cx 490:chario.c **** stored_pos = 0; 1628 .loc 1 490 0 0 00002A87 894EFC mov word ptr [bp-4], cx 0 00002A8A E9D9FE jmp _.L190 1631 _.LVL207: 1632 _.L160: 0 00002A8D 8076F201 xor byte ptr [bp-14], 1 1634 _.LVL208: 442:chario.c **** 1635 .loc 1 442 0 0 00002A91 E9D4FE jmp _.L146 1637 _.L161: 445:chario.c **** break; 1638 .loc 1 445 0 0 00002A94 46 inc si 1640 _.LVL209: 446:chario.c **** 1641 .loc 1 446 0 0 00002A95 E9D0FE jmp _.L146 1643 _.LVL210: 1644 _.L175: 1645 _.LBB58: 1646 _.LBB50: 461:chario.c **** new_pos = (new_pos + 8) & ~7; 1647 .loc 1 461 0 0 00002A98 8CC7 mov di, es 0 00002A9A 89C3 mov bx, ax 0 00002A9C 8A11 mov dl, byte ptr [bx+di] 0 00002A9E 80FA09 cmp dl, 9 0 00002AA1 7510 jne _.L172 1653 _.LVL211: 462:chario.c **** else if (iscntrl(local_buffer[i])) 1654 .loc 1 462 0 0 00002AA3 8B7EF4 mov di, word ptr [bp-12] 1656 _.LVL212: 0 00002AA6 83C708 add di, 8 0 00002AA9 83E7F8 and di, -8 0 00002AAC 897EF4 mov word ptr [bp-12], di 1660 _.LVL213: 1661 _.L173: 459:chario.c **** { 1662 .loc 1 459 0 discriminator 2 0 00002AAF 40 inc ax 1664 _.LVL214: 0 00002AB0 E9EEFD jmp _.L171 1666 _.LVL215: 1667 _.L172: 464:chario.c **** else 1668 .loc 1 464 0 0 00002AB3 8B4EF4 mov cx, word ptr [bp-12] 0 00002AB6 80FA20 cmp dl, 31+1 0 00002AB9 F5 cmc 0 00002ABA 19D2 sbb dx, dx 0 00002ABC 89CB mov bx, cx 0 00002ABE 89D7 mov di, dx 1675 _.LVL216: 0 00002AC0 8D5102 lea dx, [2+bx+di] 0 00002AC3 8956F4 mov word ptr [bp-12], dx 1678 _.LVL217: 0 00002AC6 EBE7 jmp _.L173 1680 _.LVL218: 1681 _.L170: 1682 _.LBE50: 474:chario.c **** destr_bs(sft_out); 1683 .loc 1 474 0 0 00002AC8 3C1F cmp al, 31 0 00002ACA 7706 ja _.L177 475:chario.c **** destr_bs(sft_out); 1686 .loc 1 475 0 0 00002ACC FF760A push word ptr [bp+10] 0 00002ACF E83DF9 call _destr_bs 1689 _.LVL219: 1690 _.L177: 476:chario.c **** } 1691 .loc 1 476 0 0 00002AD2 FF760A push word ptr [bp+10] 0 00002AD5 E837F9 call _destr_bs 1694 _.LVL220: 0 00002AD8 E9DEFD jmp _.L169 1696 _.LVL221: 1697 _.L151: 1698 _.LBE58: 484:chario.c **** start_new_line: 1699 .loc 1 484 0 0 00002ADB FF760A push word ptr [bp+10] 0 00002ADE B85C00 mov ax, 92 0 00002AE1 50 push ax 0 00002AE2 E8[FEFF] call _write_char 1704 _.LVL222: 0 00002AE5 E97DFF jmp _.L168 1706 _.LVL223: 1707 _.L180: 489:chario.c **** count = 0; 1708 .loc 1 489 0 discriminator 3 0 00002AE8 FF760A push word ptr [bp+10] 0 00002AEB B82000 mov ax, 32 0 00002AEE 50 push ax 0 00002AEF E8[FEFF] call _write_char 1713 _.LVL224: 488:chario.c **** write_char(' ', sft_out); 1714 .loc 1 488 0 discriminator 3 0 00002AF2 46 inc si 1716 _.LVL225: 0 00002AF3 EB86 jmp _.L179 1718 _.LVL226: 1719 _.L188: 386:chario.c **** { 1720 .loc 1 386 0 0 00002AF5 C746FE1A00 mov word ptr [bp-2], 26 0 00002AFA E92CFD jmp _.L159 1723 _.LVL227: 1724 _.L181: 505:chario.c **** if (stored_pos < stored_size && !insert) 1725 .loc 1 505 0 0 00002AFD FF760A push word ptr [bp+10] 0 00002B00 B80700 mov ax, 7 0 00002B03 50 push ax 0 00002B04 E8[FEFF] call _write_char 1730 _.LVL228: 0 00002B07 E948FD jmp _.L183 1732 _.LVL229: 1733 _.L147: 386:chario.c **** { 1734 .loc 1 386 0 0 00002B0A 3C0A cmp al, 10 0 00002B0C 7503E9B5FE je _.L154 0 00002B11 7711 ja _.L185 0 00002B13 3C06 cmp al, 6 0 00002B15 7503E94EFE je _.L146 0 00002B1A 3C08 cmp al, 8 1741 _.L254: 0 00002B1C 7503E95EFD je _.L153 0 00002B21 E905FD jmp _.L159 1744 _.L185: 0 00002B24 3C1B cmp al, 27 0 00002B26 74B3 je _.L151 0 00002B28 3C7F cmp al, 127 0 00002B2A EBF0 jmp _.L254 1749 _.LBE59: 1750 _.LFE26: 1751 .size _read_line, .-_read_line 1752 .global _read_line_handle 1753 .type _read_line_handle, @function 1754 _read_line_handle: 1755 _.LFB27: 520:chario.c **** 521:chario.c **** /* called by handle func READ (int21/ah=3f) */ 522:chario.c **** size_t read_line_handle(int sft_idx, size_t n, char FAR * bp) 523:chario.c **** { 1756 .loc 1 523 0 1757 _.LVL230: 0 00002B2C 56 push si 0 00002B2D 57 push di 0 00002B2E 55 push bp 1761 _.LCFI38: 0 00002B2F 89E5 mov bp, sp 1763 _.LCFI39: 0 00002B31 1E push ds 0 00002B32 1E push ds 0 00002B33 8B460C mov ax, word ptr [bp+12] 0 00002B36 8946FC mov word ptr [bp-4], ax 0 00002B39 8B7E0E mov di, word ptr [bp+14] 524:chario.c **** size_t chars_left; 525:chario.c **** 526:chario.c **** if (inputptr == NULL) 1769 .loc 1 526 0 0 00002B3C 833E[0000]00 cmp word ptr [_inputptr], 0 0 00002B41 BE[0000] mov si, offset _kb_buf 0 00002B44 754C jne _.L256 527:chario.c **** { 528:chario.c **** /* can we reuse kb_buf or was it overwritten? */ 529:chario.c **** if (kb_buf.kb_size != LINEBUFSIZECON) 1773 .loc 1 529 0 0 00002B46 803C80 cmp byte ptr [si], -128 0 00002B49 7406 je _.L257 530:chario.c **** { 531:chario.c **** kb_buf.kb_count = 0; 532:chario.c **** kb_buf.kb_size = LINEBUFSIZECON; 1776 .loc 1 532 0 0 00002B4B C706[0000]8000 mov word ptr [_kb_buf], 128 1778 _.L257: 533:chario.c **** } 534:chario.c **** read_line(sft_idx, sft_idx, &kb_buf); 1779 .loc 1 534 0 0 00002B51 16 push ss 0 00002B52 56 push si 0 00002B53 FF7608 push word ptr [bp+8] 0 00002B56 FF7608 push word ptr [bp+8] 0 00002B59 E8[FEFF] call _read_line 1785 _.LVL231: 535:chario.c **** kb_buf.kb_buf[kb_buf.kb_count + 1] = echo_char(LF, sft_idx); 1786 .loc 1 535 0 0 00002B5C 8A4401 mov al, byte ptr [si+1] 0 00002B5F 30E4 xor ah, ah 0 00002B61 40 inc ax 0 00002B62 8946FE mov word ptr [bp-2], ax 0 00002B65 FF7608 push word ptr [bp+8] 0 00002B68 B80A00 mov ax, 10 0 00002B6B 50 push ax 0 00002B6C E8C5F8 call _echo_char 1795 _.LVL232: 0 00002B6F 8B5EFE mov bx, word ptr [bp-2] 0 00002B72 8887[0200] mov byte ptr [bx+_kb_buf+2], al 536:chario.c **** inputptr = kb_buf.kb_buf; 1798 .loc 1 536 0 0 00002B76 C706[00000200] mov word ptr [_inputptr], offset _kb_buf+2 537:chario.c **** if (*inputptr == CTL_Z) 1800 .loc 1 537 0 0 00002B7C 807C021A cmp byte ptr [si+2], 26 0 00002B80 7510 jne _.L256 538:chario.c **** { 539:chario.c **** inputptr = NULL; 1803 .loc 1 539 0 0 00002B82 C706[0000]0000 mov word ptr [_inputptr], 0 540:chario.c **** return 0; 1805 .loc 1 540 0 0 00002B88 31C0 xor ax, ax 1807 _.LVL233: 1808 _.L255: 541:chario.c **** } 542:chario.c **** } 543:chario.c **** 544:chario.c **** chars_left = &kb_buf.kb_buf[kb_buf.kb_count + 2] - inputptr; 545:chario.c **** if (n > chars_left) 546:chario.c **** n = chars_left; 547:chario.c **** 548:chario.c **** fmemcpy(bp, inputptr, n); 549:chario.c **** inputptr += n; 550:chario.c **** if (n == chars_left) 551:chario.c **** inputptr = NULL; 552:chario.c **** return n; 553:chario.c **** } 1809 .loc 1 553 0 0 00002B8A 89EC mov sp, bp 0 00002B8C 5D pop bp 0 00002B8D 5F pop di 0 00002B8E 5E pop si 0 00002B8F C20800 ret 8 1815 _.LVL234: 1816 _.L256: 544:chario.c **** if (n > chars_left) 1817 .loc 1 544 0 0 00002B92 8B16[0000] mov dx, word ptr [_inputptr] 0 00002B96 8A4401 mov al, byte ptr [si+1] 0 00002B99 30E4 xor ah, ah 0 00002B9B 05[0400] add ax, offset _kb_buf+4 0 00002B9E 29D0 sub ax, dx 1823 _.LVL235: 0 00002BA0 89C6 mov si, ax 0 00002BA2 3B460A cmp ax, word ptr [bp+10] 0 00002BA5 7603 jbe _.L259 0 00002BA7 8B760A mov si, word ptr [bp+10] 1828 _.L259: 0 00002BAA 8946FE mov word ptr [bp-2], ax 1830 _.LVL236: 548:chario.c **** inputptr += n; 1831 .loc 1 548 0 0 00002BAD 56 push si 0 00002BAE 16 push ss 0 00002BAF 52 push dx 0 00002BB0 57 push di 0 00002BB1 FF76FC push word ptr [bp-4] 0 00002BB4 E8[FEFF] call _fmemcpy 1838 _.LVL237: 550:chario.c **** inputptr = NULL; 1839 .loc 1 550 0 0 00002BB7 8B46FE mov ax, word ptr [bp-2] 0 00002BBA 39F0 cmp ax, si 0 00002BBC 7407 je _.L260 549:chario.c **** if (n == chars_left) 1843 .loc 1 549 0 0 00002BBE 0136[0000] add word ptr [_inputptr], si 0 00002BC2 96 xchg si, ax 0 00002BC3 EBC5 jmp _.L255 1847 _.L260: 551:chario.c **** return n; 1848 .loc 1 551 0 0 00002BC5 C706[0000]0000 mov word ptr [_inputptr], 0 0 00002BCB EBBD jmp _.L255 1851 _.LFE27: 1852 .size _read_line_handle, .-_read_line_handle === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: config.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=config.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc8ZIHqd.s output file : config.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _SetAnyDos, @function 8 _SetAnyDos: 9 _.LFB62: 10 .file 1 "config.c" 1:config.c **** /****************************************************************/ 2:config.c **** /* */ 3:config.c **** /* config.c */ 4:config.c **** /* DOS-C */ 5:config.c **** /* */ 6:config.c **** /* config.sys Processing Functions */ 7:config.c **** /* */ 8:config.c **** /* Copyright (c) 1996 */ 9:config.c **** /* Pasquale J. Villani */ 10:config.c **** /* All Rights Reserved */ 11:config.c **** /* */ 12:config.c **** /* This file is part of DOS-C. */ 13:config.c **** /* */ 14:config.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:config.c **** /* modify it under the terms of the GNU General Public License */ 16:config.c **** /* as published by the Free Software Foundation; either version */ 17:config.c **** /* 2, or (at your option) any later version. */ 18:config.c **** /* */ 19:config.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:config.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:config.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:config.c **** /* the GNU General Public License for more details. */ 23:config.c **** /* */ 24:config.c **** /* You should have received a copy of the GNU General Public */ 25:config.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:config.c **** /* write to the Free Software Foundation, Inc., */ 27:config.c **** /* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ 28:config.c **** /****************************************************************/ 29:config.c **** 30:config.c **** #include "portab.h" 31:config.c **** #include "init-mod.h" 32:config.c **** #include "dyndata.h" 33:config.c **** #include "debug.h" 34:config.c **** 35:config.c **** 36:config.c **** #define para2far(seg) ((mcb FAR *)MK_FP((seg), 0)) 37:config.c **** 38:config.c **** /** 39:config.c **** Menu selection bar struct: 40:config.c **** x pos, ypos, string 41:config.c **** */ 42:config.c **** #define MENULINEMAX 80 43:config.c **** #define MENULINESMAX 10 44:config.c **** struct MenuSelector 45:config.c **** { 46:config.c **** int x; 47:config.c **** int y; 48:config.c **** BYTE bSelected; 49:config.c **** BYTE Text[MENULINEMAX]; 50:config.c **** }; 51:config.c **** 52:config.c **** /** Structure below holds the menu-strings */ 53:config.c **** STATIC struct MenuSelector MenuStruct[MENULINESMAX] BSS_INIT({0}); 54:config.c **** 55:config.c **** int nMenuLine BSS_INIT(0); 56:config.c **** int MenuColor = -1; 57:config.c **** extern char ASM kernel_command_line[256]; 58:config.c **** extern int kernel_command_line_length; 59:config.c **** 60:config.c **** STATIC void WriteMenuLine(struct MenuSelector *menu) 61:config.c **** { 62:config.c **** iregs r; 63:config.c **** unsigned char attr = (unsigned char)MenuColor; 64:config.c **** char *pText = menu->Text; 65:config.c **** 66:config.c **** if (pText[0] == 0) 67:config.c **** return; 68:config.c **** 69:config.c **** if(menu->bSelected) 70:config.c **** attr = ((attr << 4) | (attr >> 4)); 71:config.c **** 72:config.c **** /* clear line */ 73:config.c **** r.a.x = 0x0600; 74:config.c **** r.b.b.h = attr; 75:config.c **** r.c.b.l = r.d.b.l = menu->x; 76:config.c **** r.c.b.h = r.d.b.h = menu->y; 77:config.c **** r.d.b.l += strlen(pText) - 1; 78:config.c **** init_call_intr(0x10, &r); 79:config.c **** 80:config.c **** /* set cursor position: */ 81:config.c **** r.a.b.h = 0x02; 82:config.c **** r.b.b.h = 0; 83:config.c **** r.d.b.l = menu->x; 84:config.c **** r.d.b.h = menu->y; 85:config.c **** init_call_intr(0x10, &r); 86:config.c **** 87:config.c **** printf("%s", pText); 88:config.c **** } 89:config.c **** 90:config.c **** /* Deselect the previously selected line */ 91:config.c **** STATIC void DeselectLastLine(void) 92:config.c **** { 93:config.c **** struct MenuSelector *menu; 94:config.c **** for (menu = MenuStruct; menu < &MenuStruct[MENULINESMAX]; menu++) 95:config.c **** { 96:config.c **** if (menu->bSelected) 97:config.c **** { 98:config.c **** /* deselect it: */ 99:config.c **** menu->bSelected = 0; 100:config.c **** WriteMenuLine(menu); 101:config.c **** break; 102:config.c **** } 103:config.c **** } 104:config.c **** } 105:config.c **** 106:config.c **** STATIC void SelectLine(int MenuSelected) 107:config.c **** { 108:config.c **** struct MenuSelector *menu; 109:config.c **** 110:config.c **** DeselectLastLine(); /* clear previous selection */ 111:config.c **** menu = &MenuStruct[MenuSelected]; 112:config.c **** menu->bSelected = 1; /* set selection flag for this one */ 113:config.c **** WriteMenuLine(menu); 114:config.c **** } 115:config.c **** 116:config.c **** UWORD umb_start BSS_INIT(0), UMB_top BSS_INIT(0); 117:config.c **** UWORD ram_top BSS_INIT(0); /* How much ram in Kbytes */ 118:config.c **** size_t ebda_size BSS_INIT(0); 119:config.c **** 120:config.c **** static UBYTE ErrorAlreadyPrinted[128] BSS_INIT({0}); 121:config.c **** 122:config.c **** static char FAR *envp = master_env; 123:config.c **** 124:config.c **** struct config Config = { 125:config.c **** 0, 126:config.c **** NUMBUFF, 127:config.c **** NFILES, 128:config.c **** 0, 129:config.c **** NFCBS, 130:config.c **** 0, 131:config.c **** "command.com", 132:config.c **** " /P /E:256\r\n", 133:config.c **** NLAST, 134:config.c **** 0, 135:config.c **** NSTACKS, 136:config.c **** 0, 137:config.c **** STACKSIZE 138:config.c **** /* COUNTRY= is initialized within DoConfig() */ 139:config.c **** , 0 /* strategy for command.com is low by default */ 140:config.c **** , 0 /* default value for switches=/E:nnnn */ 141:config.c **** }; 142:config.c **** 143:config.c **** STATIC seg base_seg BSS_INIT(0); 144:config.c **** STATIC seg umb_base_seg BSS_INIT(0); 145:config.c **** BYTE FAR *lpTop BSS_INIT(0); 146:config.c **** STATIC unsigned nCfgLine BSS_INIT(0); 147:config.c **** COUNT UmbState BSS_INIT(0); 148:config.c **** STATIC BYTE szLine[256] BSS_INIT({0}); 149:config.c **** STATIC BYTE szBuf[256] BSS_INIT({0}); 150:config.c **** 151:config.c **** #define MAX_CHAINS 5 152:config.c **** struct CfgFile { 153:config.c **** COUNT nFileDesc; 154:config.c **** COUNT nCfgLine; 155:config.c **** } cfgFile[MAX_CHAINS] BSS_INIT({0}); 156:config.c **** COUNT nCurChain BSS_INIT(0); 157:config.c **** COUNT nFileDesc BSS_INIT(0); 158:config.c **** 159:config.c **** BYTE singleStep BSS_INIT(FALSE); /* F8 processing */ 160:config.c **** BYTE SkipAllConfig BSS_INIT(FALSE); /* F5 processing */ 161:config.c **** BYTE askThisSingleCommand BSS_INIT(FALSE); /* ?device= device?= */ 162:config.c **** BYTE DontAskThisSingleCommand BSS_INIT(FALSE); /* !files= */ 163:config.c **** 164:config.c **** COUNT MenuTimeout = -1; 165:config.c **** BYTE MenuSelected BSS_INIT(0); 166:config.c **** UCOUNT MenuLine BSS_INIT(0); 167:config.c **** UCOUNT Menus BSS_INIT(0); 168:config.c **** 169:config.c **** STATIC VOID CfgMenuColor(BYTE * pLine); 170:config.c **** 171:config.c **** STATIC VOID Config_Buffers(BYTE * pLine); 172:config.c **** STATIC VOID CfgBuffersHigh(BYTE * pLine); 173:config.c **** STATIC VOID sysScreenMode(BYTE * pLine); 174:config.c **** STATIC VOID sysVersion(BYTE * pLine); 175:config.c **** STATIC VOID CfgBreak(BYTE * pLine); 176:config.c **** STATIC VOID Device(BYTE * pLine); 177:config.c **** STATIC VOID DeviceHigh(BYTE * pLine); 178:config.c **** STATIC VOID Files(BYTE * pLine); 179:config.c **** STATIC VOID FilesHigh(BYTE * pLine); 180:config.c **** STATIC VOID Fcbs(BYTE * pLine); 181:config.c **** STATIC VOID CfgKeyBuf(BYTE * pLine); 182:config.c **** STATIC VOID CfgLastdrive(BYTE * pLine); 183:config.c **** STATIC VOID CfgLastdriveHigh(BYTE * pLine); 184:config.c **** STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode); 185:config.c **** STATIC VOID Dosmem(BYTE * pLine); 186:config.c **** STATIC VOID DosData(BYTE * pLine); 187:config.c **** STATIC VOID Country(BYTE * pLine); 188:config.c **** STATIC VOID InitPgm(BYTE * pLine); 189:config.c **** STATIC VOID InitPgmHigh(BYTE * pLine); 190:config.c **** STATIC VOID CmdInstall(BYTE * pLine); 191:config.c **** STATIC VOID CmdInstallHigh(BYTE * pLine); 192:config.c **** STATIC VOID CmdChain(BYTE * pLine); 193:config.c **** STATIC VOID CmdSet(BYTE * pLine); 194:config.c **** 195:config.c **** 196:config.c **** STATIC VOID CfgSwitchar(BYTE * pLine); 197:config.c **** STATIC VOID CfgSwitches(BYTE * pLine); 198:config.c **** STATIC VOID CfgFailure(BYTE * pLine); 199:config.c **** STATIC VOID CfgIgnore(BYTE * pLine); 200:config.c **** STATIC VOID CfgMenu(BYTE * pLine); 201:config.c **** 202:config.c **** STATIC VOID CfgMenuEsc(BYTE * pLine); 203:config.c **** 204:config.c **** STATIC VOID DoMenu(void); 205:config.c **** STATIC VOID CfgMenuDefault(BYTE * pLine); 206:config.c **** STATIC BYTE * skipwh(BYTE * s); 207:config.c **** STATIC int iswh(unsigned char c); 208:config.c **** STATIC BYTE * scan(BYTE * s, BYTE * d, int fMenuSelect); 209:config.c **** STATIC BOOL isnum(char ch); 210:config.c **** #if 0 211:config.c **** STATIC COUNT tolower(COUNT c); 212:config.c **** #endif 213:config.c **** STATIC char toupper(char c); 214:config.c **** STATIC VOID strupr(char *s); 215:config.c **** STATIC VOID mcb_init(UCOUNT seg, UWORD size, BYTE type); 216:config.c **** STATIC VOID mumcb_init(UCOUNT seg, UWORD size); 217:config.c **** 218:config.c **** STATIC VOID Stacks(BYTE * pLine); 219:config.c **** STATIC VOID StacksHigh(BYTE * pLine); 220:config.c **** 221:config.c **** STATIC VOID SetAnyDos(BYTE * pLine); 222:config.c **** STATIC VOID SetIdleHalt(BYTE * pLine); 223:config.c **** STATIC VOID Numlock(BYTE * pLine); 224:config.c **** STATIC BYTE * GetNumArg(BYTE * pLine, COUNT * pnArg); 225:config.c **** BYTE *GetStringArg(BYTE * pLine, BYTE * pszString); 226:config.c **** STATIC int SkipLine(char *pLine); 227:config.c **** #if 0 228:config.c **** STATIC char * stristr(char *s1, char *s2); 229:config.c **** #endif 230:config.c **** STATIC char strcaseequal(const char * d, const char * s); 231:config.c **** STATIC int LoadCountryInfoHardCoded(COUNT ctryCode); 232:config.c **** STATIC void umb_init(void); 233:config.c **** 234:config.c **** void HMAconfig(int finalize); 235:config.c **** STATIC void config_init_buffers(int anzBuffers); /* from BLOCKIO.C */ 236:config.c **** 237:config.c **** #ifdef I86 238:config.c **** STATIC VOID FAR * AlignParagraph(VOID FAR * lpPtr); 239:config.c **** #else 240:config.c **** #define AlignParagraph(x) ((VOID *)x) 241:config.c **** #endif 242:config.c **** 243:config.c **** #define EOF 0x1a 244:config.c **** 245:config.c **** STATIC struct table * LookUp(struct table *p, BYTE * token); 246:config.c **** 247:config.c **** typedef void config_sys_func_t(BYTE * pLine); 248:config.c **** 249:config.c **** struct table { 250:config.c **** BYTE *entry; 251:config.c **** signed char pass; 252:config.c **** config_sys_func_t *func; 253:config.c **** }; 254:config.c **** 255:config.c **** STATIC struct table commands[] = { 256:config.c **** /* first = switches! this one is special; some options will 257:config.c **** always be ran, others depends on F5/F8 and ? processing */ 258:config.c **** {"SWITCHES", 0, CfgSwitches}, 259:config.c **** 260:config.c **** /* rem is never executed by locking out pass */ 261:config.c **** {"REM", 0, CfgIgnore}, 262:config.c **** {";", 0, CfgIgnore}, 263:config.c **** 264:config.c **** {"MENUCOLOR",0,CfgMenuColor}, 265:config.c **** 266:config.c **** {"MENUDEFAULT", 0, CfgMenuDefault}, 267:config.c **** {"MENU", 0, CfgMenu}, /* lines to print in pass 0 */ 268:config.c **** {"ECHO", 2, CfgMenu}, /* lines to print in pass 2 - install(high) */ 269:config.c **** {"EECHO", 2, CfgMenuEsc}, /* modified ECHO (ea) */ 270:config.c **** 271:config.c **** {"BREAK", 1, CfgBreak}, 272:config.c **** {"BUFFERS", 1, Config_Buffers}, 273:config.c **** {"BUFFERSHIGH", 1, CfgBuffersHigh}, /* as BUFFERS - we use HMA anyway */ 274:config.c **** {"COMMAND", 1, InitPgm}, 275:config.c **** {"COUNTRY", 1, Country}, 276:config.c **** {"DOS", 1, Dosmem}, 277:config.c **** {"DOSDATA", 1, DosData}, 278:config.c **** {"FCBS", 1, Fcbs}, 279:config.c **** {"KEYBUF", 1, CfgKeyBuf}, /* ea */ 280:config.c **** {"FILES", 1, Files}, 281:config.c **** {"FILESHIGH", 1, FilesHigh}, 282:config.c **** {"LASTDRIVE", 1, CfgLastdrive}, 283:config.c **** {"LASTDRIVEHIGH", 1, CfgLastdriveHigh}, 284:config.c **** {"NUMLOCK", 1, Numlock}, 285:config.c **** {"SHELL", 1, InitPgm}, 286:config.c **** {"SHELLHIGH", 1, InitPgmHigh}, 287:config.c **** {"STACKS", 1, Stacks}, 288:config.c **** {"STACKSHIGH", 1, StacksHigh}, 289:config.c **** {"SWITCHAR", 1, CfgSwitchar}, 290:config.c **** {"SCREEN", 1, sysScreenMode}, /* JPP */ 291:config.c **** {"VERSION", 1, sysVersion}, /* JPP */ 292:config.c **** {"ANYDOS", 1, SetAnyDos}, /* tom */ 293:config.c **** {"IDLEHALT", 1, SetIdleHalt}, /* ea */ 294:config.c **** 295:config.c **** {"DEVICE", 2, Device}, 296:config.c **** {"DEVICEHIGH", 2, DeviceHigh}, 297:config.c **** {"INSTALL", 2, CmdInstall}, 298:config.c **** {"INSTALLHIGH", 2, CmdInstallHigh}, 299:config.c **** {"CHAIN", 2, CmdChain}, 300:config.c **** {"SET", 2, CmdSet}, 301:config.c **** 302:config.c **** /* default action */ 303:config.c **** {"", -1, CfgFailure} 304:config.c **** }; 305:config.c **** 306:config.c **** /* RE function for menu. */ 307:config.c **** int findend(BYTE * s) 308:config.c **** { 309:config.c **** int nLen = 0; 310:config.c **** /* 'marks' end if at least ten spaces, 0, or newline is found. */ 311:config.c **** while (*s && (*s != 0x0d || *s != 0x0a) ) 312:config.c **** { 313:config.c **** BYTE *p= skipwh(s); 314:config.c **** /* ah, more than 9 whitespaces ? We're done here (hrmph!) */ 315:config.c **** if(p - s >= 10) 316:config.c **** break; 317:config.c **** nLen++; 318:config.c **** ++s; 319:config.c **** } 320:config.c **** return nLen; 321:config.c **** } 322:config.c **** 323:config.c **** BYTE *pLineStart BSS_INIT(0); 324:config.c **** 325:config.c **** BYTE HMAState BSS_INIT(0); 326:config.c **** #define HMA_NONE 0 /* do nothing */ 327:config.c **** #define HMA_REQ 1 /* DOS = HIGH detected */ 328:config.c **** #define HMA_DONE 2 /* Moved kernel to HMA */ 329:config.c **** #define HMA_LOW 3 /* Definitely LOW */ 330:config.c **** 331:config.c **** /* Do first time initialization. Store last so that we can reset it */ 332:config.c **** /* later. */ 333:config.c **** void PreConfig(void) 334:config.c **** { 335:config.c **** /* Initialize the base memory pointers */ 336:config.c **** 337:config.c **** CfgDbgPrintf(("SDA located at 0x%p\n", internal_data)); 338:config.c **** /* Begin by initializing our system buffers */ 339:config.c **** /* DebugPrintf(("Preliminary %d buffers allocated at 0x%p\n", Config.cfgBuffers, buffers));*/ 340:config.c **** 341:config.c **** LoL->sfthead = MK_FP(FP_SEG(LoL), 0xcc); /* &(LoL->firstsftt) */ 342:config.c **** /* LoL->FCBp = (sfttbl FAR *)&FcbSft; */ 343:config.c **** /* LoL->FCBp = (sfttbl FAR *) 344:config.c **** KernelAlloc(sizeof(sftheader) 345:config.c **** + Config.cfgFiles * sizeof(sft)); */ 346:config.c **** 347:config.c **** config_init_buffers(Config.cfgBuffers); 348:config.c **** 349:config.c **** LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', 0); 350:config.c **** 351:config.c **** /* CfgDbgPrintf((" FCB table 0x%p\n",LoL->FCBp));*/ 352:config.c **** CfgDbgPrintf((" sft table 0x%p\n", LoL->sfthead)); 353:config.c **** CfgDbgPrintf((" CDS table 0x%p\n", LoL->CDSp)); 354:config.c **** CfgDbgPrintf((" DPB table 0x%p\n", LoL->DPBp)); 355:config.c **** 356:config.c **** /* Done. Now initialize the MCB structure */ 357:config.c **** /* This next line is 8086 and 80x86 real mode specific */ 358:config.c **** CfgDbgPrintf(("Preliminary allocation completed: top at %p\n", lpTop)); 359:config.c **** } 360:config.c **** 361:config.c **** /* Do second pass initialization: near allocation and MCBs */ 362:config.c **** void PreConfig2(void) 363:config.c **** { 364:config.c **** struct sfttbl FAR *sp; 365:config.c **** 366:config.c **** /* initialize NEAR allocated things */ 367:config.c **** 368:config.c **** /* Initialize the base memory pointers from last time. */ 369:config.c **** /* 370:config.c **** if the kernel could be moved to HMA, everything behind the dynamic 371:config.c **** near data is free. 372:config.c **** otherwise, the kernel is moved down - behind the dynamic allocated data, 373:config.c **** and allocation starts after the kernel. 374:config.c **** */ 375:config.c **** 376:config.c **** base_seg = LoL->first_mcb = FP_SEG(AlignParagraph((BYTE FAR *) DynLast() + 0x0f)); 377:config.c **** 378:config.c **** if (Config.ebda2move) 379:config.c **** { 380:config.c **** ebda_size = ebdasize(); 381:config.c **** if (ebda_size > Config.ebda2move) 382:config.c **** ebda_size = Config.ebda2move; 383:config.c **** ram_top += ebda_size / 1024; 384:config.c **** } 385:config.c **** 386:config.c **** /* We expect ram_top as Kbytes, so convert to paragraphs */ 387:config.c **** mcb_init(base_seg, ram_top * 64 - LoL->first_mcb - 1, MCB_LAST); 388:config.c **** 389:config.c **** sp = LoL->sfthead; 390:config.c **** sp = sp->sftt_next = KernelAlloc(sizeof(sftheader) + 3 * sizeof(sft), 'F', 0); 391:config.c **** sp->sftt_next = (sfttbl FAR *) - 1; 392:config.c **** sp->sftt_count = 3; 393:config.c **** 394:config.c **** if (ebda_size) /* move the Extended BIOS Data Area from top of RAM here */ 395:config.c **** movebda(ebda_size, FP_SEG(KernelAlloc(ebda_size, 'I', 0))); 396:config.c **** 397:config.c **** /* if (UmbState == 2) 398:config.c **** umb_init(); 399:config.c **** */ 400:config.c **** } 401:config.c **** 402:config.c **** /* Do third pass initialization. */ 403:config.c **** /* Also, run config.sys to load drivers. */ 404:config.c **** void PostConfig(void) 405:config.c **** { 406:config.c **** sfttbl FAR *sp; 407:config.c **** 408:config.c **** /* We could just have loaded FDXMS or HIMEM */ 409:config.c **** if (HMAState == HMA_REQ && MoveKernelToHMA()) 410:config.c **** HMAState = HMA_DONE; 411:config.c **** 412:config.c **** if (Config.cfgDosDataUmb) 413:config.c **** { 414:config.c **** Config.cfgFilesHigh = TRUE; 415:config.c **** Config.cfgLastdriveHigh = TRUE; 416:config.c **** Config.cfgStacksHigh = TRUE; 417:config.c **** } 418:config.c **** 419:config.c **** /* compute lastdrive ... */ 420:config.c **** LoL->lastdrive = Config.cfgLastdrive; 421:config.c **** if (LoL->lastdrive < LoL->nblkdev) 422:config.c **** LoL->lastdrive = LoL->nblkdev; 423:config.c **** 424:config.c **** CfgDbgPrintf(("starting FAR allocations at %x\n", base_seg)); 425:config.c **** 426:config.c **** /* Begin by initializing our system buffers */ 427:config.c **** /* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */ 428:config.c **** /* DebugPrintf(("DMA scratchpad allocated at 0x%p\n", dma_scratch)); */ 429:config.c **** 430:config.c **** config_init_buffers(Config.cfgBuffers); 431:config.c **** 432:config.c **** /* LoL->sfthead = (sfttbl FAR *)&basesft; */ 433:config.c **** /* LoL->FCBp = (sfttbl FAR *)&FcbSft; */ 434:config.c **** /* LoL->FCBp = KernelAlloc(sizeof(sftheader) 435:config.c **** + Config.cfgFiles * sizeof(sft)); */ 436:config.c **** sp = LoL->sfthead->sftt_next; 437:config.c **** sp = sp->sftt_next = (sfttbl FAR *) 438:config.c **** KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 8) * sizeof(sft), 'F', 439:config.c **** Config.cfgFilesHigh); 440:config.c **** sp->sftt_next = (sfttbl FAR *) - 1; 441:config.c **** sp->sftt_count = Config.cfgFiles - 8; 442:config.c **** 443:config.c **** LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', Config.cfgLastdriveHigh); 444:config.c **** 445:config.c **** /* CfgDbgPrintf((" FCB table 0x%p\n",LoL->FCBp));*/ 446:config.c **** CfgDbgPrintf((" sft table 0x%p\n", LoL->sfthead->sftt_next)); 447:config.c **** CfgDbgPrintf((" CDS table 0x%p\n", LoL->CDSp)); 448:config.c **** CfgDbgPrintf((" DPB table 0x%p\n", LoL->DPBp)); 449:config.c **** 450:config.c **** if (Config.cfgStacks) 451:config.c **** { 452:config.c **** VOID FAR *stackBase = 453:config.c **** KernelAlloc(Config.cfgStacks * Config.cfgStackSize, 'S', 454:config.c **** Config.cfgStacksHigh); 455:config.c **** init_stacks(stackBase, Config.cfgStacks, Config.cfgStackSize); 456:config.c **** 457:config.c **** CfgDbgPrintf(("Stacks allocated at %p\n", stackBase)); 458:config.c **** } 459:config.c **** CfgDbgPrintf(("Allocation completed: top at 0x%x\n", base_seg)); 460:config.c **** 461:config.c **** } 462:config.c **** 463:config.c **** /* This code must be executed after device drivers has been loaded */ 464:config.c **** VOID configDone(VOID) 465:config.c **** { 466:config.c **** if (UmbState == 1) 467:config.c **** para2far(base_seg)->m_type = MCB_LAST; 468:config.c **** 469:config.c **** if (HMAState != HMA_DONE) 470:config.c **** { 471:config.c **** mcb FAR *p; 472:config.c **** unsigned short kernel_seg; 473:config.c **** unsigned short hma_paras = (HMAFree+0xf)/16; 474:config.c **** 475:config.c **** kernel_seg = allocmem(hma_paras); 476:config.c **** p = para2far(kernel_seg - 1); 477:config.c **** 478:config.c **** p->m_name[0] = 'S'; 479:config.c **** p->m_name[1] = 'C'; 480:config.c **** p->m_psp = 8; 481:config.c **** 482:config.c **** CfgDbgPrintf(("HMA not available, moving text to %x\n", kernel_seg)); 483:config.c **** MoveKernel(kernel_seg); 484:config.c **** 485:config.c **** kernel_seg += hma_paras + 1; 486:config.c **** 487:config.c **** CfgDbgPrintf(("kernel is low, start alloc at %x\n", kernel_seg)); 488:config.c **** } 489:config.c **** 490:config.c **** /* The standard handles should be reopened here, because 491:config.c **** we may have loaded new console or printer drivers in CONFIG.SYS */ 492:config.c **** } 493:config.c **** 494:config.c **** STATIC seg prev_mcb(seg cur_mcb, seg start) 495:config.c **** { 496:config.c **** /* determine prev mcb */ 497:config.c **** seg mcb_prev, mcb_next; 498:config.c **** mcb_prev = mcb_next = start; 499:config.c **** while (mcb_next < cur_mcb && para2far(mcb_next)->m_type == MCB_NORMAL) 500:config.c **** { 501:config.c **** mcb_prev = mcb_next; 502:config.c **** mcb_next += para2far(mcb_prev)->m_size + 1; 503:config.c **** } 504:config.c **** return mcb_prev; 505:config.c **** } 506:config.c **** 507:config.c **** STATIC void umb_init(void) 508:config.c **** { 509:config.c **** UCOUNT umb_seg, umb_size; 510:config.c **** seg umb_max; 511:config.c **** void far *xms_addr; 512:config.c **** 513:config.c **** if ((xms_addr = DetectXMSDriver()) == NULL) 514:config.c **** return; 515:config.c **** 516:config.c **** if (UMB_get_largest(xms_addr, &umb_seg, &umb_size)) 517:config.c **** { 518:config.c **** UmbState = 1; 519:config.c **** 520:config.c **** /* reset root */ 521:config.c **** /* Note: since device drivers can change what is considered top of memory (e.g. move XBDA) we m 522:config.c **** ram_top = init_oem(); 523:config.c **** LoL->uppermem_root = ram_top * 64 - 1; 524:config.c **** 525:config.c **** /* create link mcb (below) */ 526:config.c **** para2far(base_seg)->m_type = MCB_NORMAL; 527:config.c **** para2far(base_seg)->m_size--; 528:config.c **** mumcb_init(LoL->uppermem_root, umb_seg - LoL->uppermem_root - 1); 529:config.c **** 530:config.c **** /* setup the real mcb for the devicehigh block */ 531:config.c **** mcb_init(umb_seg, umb_size - 2, MCB_NORMAL); 532:config.c **** 533:config.c **** umb_base_seg = umb_max = umb_start = umb_seg; 534:config.c **** UMB_top = umb_size; 535:config.c **** 536:config.c **** /* there can be more UMBs ! 537:config.c **** this happens, if memory mapped devces are in between 538:config.c **** like UMB memory c800..c8ff, d8ff..efff with device at d000..d7ff 539:config.c **** However some of the xxxHIGH commands still only work with 540:config.c **** the first UMB. 541:config.c **** */ 542:config.c **** 543:config.c **** while (UMB_get_largest(xms_addr, &umb_seg, &umb_size)) 544:config.c **** { 545:config.c **** seg umb_prev, umb_next; 546:config.c **** 547:config.c **** /* setup the real mcb for the devicehigh block */ 548:config.c **** mcb_init(umb_seg, umb_size - 2, MCB_NORMAL); 549:config.c **** 550:config.c **** /* determine prev and next umbs */ 551:config.c **** umb_prev = prev_mcb(umb_seg, LoL->uppermem_root); 552:config.c **** umb_next = umb_prev + para2far(umb_prev)->m_size + 1; 553:config.c **** 554:config.c **** if (umb_seg < umb_max) 555:config.c **** { 556:config.c **** if (umb_next - umb_seg - umb_size == 0) 557:config.c **** { 558:config.c **** /* should the UMB driver return 559:config.c **** adjacent memory in several pieces */ 560:config.c **** umb_size += para2far(umb_next)->m_size + 1; 561:config.c **** para2far(umb_seg)->m_size = umb_size; 562:config.c **** } 563:config.c **** else 564:config.c **** { 565:config.c **** /* create link mcb (above) */ 566:config.c **** mumcb_init(umb_seg + umb_size - 1, umb_next - umb_seg - umb_size); 567:config.c **** } 568:config.c **** } 569:config.c **** else /* umb_seg >= umb_max */ 570:config.c **** { 571:config.c **** umb_prev = umb_next; 572:config.c **** } 573:config.c **** 574:config.c **** if (umb_seg - umb_prev - 1 == 0) 575:config.c **** /* should the UMB driver return 576:config.c **** adjacent memory in several pieces */ 577:config.c **** para2far(prev_mcb(umb_prev, LoL->uppermem_root))->m_size += umb_size; 578:config.c **** else 579:config.c **** { 580:config.c **** /* create link mcb (below) */ 581:config.c **** mumcb_init(umb_prev, umb_seg - umb_prev - 1); 582:config.c **** } 583:config.c **** 584:config.c **** if (umb_seg > umb_max) 585:config.c **** umb_max = umb_seg; 586:config.c **** } 587:config.c **** para2far(umb_max)->m_size++; 588:config.c **** para2far(umb_max)->m_type = MCB_LAST; 589:config.c **** CfgDbgPrintf(("UMB Allocation completed: start at 0x%x\n", umb_base_seg)); 590:config.c **** } 591:config.c **** } 592:config.c **** 593:config.c **** #ifdef MEMDISK_ARGS 594:config.c **** struct memdiskinfo { 595:config.c **** UWORD bytes; /* Total size of this structure, value >= 26 */ 596:config.c **** UBYTE version_minor; /* Memdisk minor version */ 597:config.c **** UBYTE version; /* Memdisk major version */ 598:config.c **** UDWORD base; /* Pointer to disk data in high memory */ 599:config.c **** UDWORD size; /* Size of disk in 512 byte sectors */ 600:config.c **** char FAR * cmdline; /* Command line; currently <= 2047 chars */ 601:config.c **** ADDRESS oldint13; /* Old INT 13h */ 602:config.c **** ADDRESS oldint15; /* Old INT 15h */ 603:config.c **** UWORD olddosmem; /* Amount of DOS memory before Memdisk loaded */ 604:config.c **** UBYTE boot_id; /* major >= 3, boot loader ID */ 605:config.c **** UBYTE unused; 606:config.c **** UWORD DPT_offset; /* >= 3.71, ES based offset to installed DPT, +16 is Old INT 1Eh */ 607:config.c **** }; 608:config.c **** 609:config.c **** /* query_memdisk() based on similar subroutine in Eric Auer's public domain getargs.asm which is ba 610:config.c **** struct memdiskinfo FAR * ASMCFUNC query_memdisk(UBYTE drive); 611:config.c **** 612:config.c **** struct memdiskopt { 613:config.c **** BYTE * name; 614:config.c **** UWORD size; 615:config.c **** }; 616:config.c **** 617:config.c **** /* preprocesses memdisk command line to allow simpler handling 618:config.c **** { is replaced by unsigned offset to start of next config line 619:config.c **** e.g. "{{HI{HI}{HI{HI" --> "13HI4HI}3HI3HI" 620:config.c **** FreeDOS supports max 256 length config lines, memdisk 4 max command length 2047 621:config.c **** */ 622:config.c **** BYTE FAR * ProcessMemdiskLine(BYTE FAR *cLine) 623:config.c **** { 624:config.c **** BYTE FAR *ptr; 625:config.c **** BYTE FAR *sLine = cLine; 626:config.c **** 627:config.c **** /* skip everything until end of line or starting { */ 628:config.c **** for (; *cLine && (*cLine != '{'); ++cLine) 629:config.c **** ; 630:config.c **** sLine = cLine; 631:config.c **** 632:config.c **** for (ptr = cLine; *cLine; ptr = cLine) 633:config.c **** { 634:config.c **** /* skip everything until end of line or starting { */ 635:config.c **** for (++cLine; *cLine && (*cLine != '{'); ++cLine) 636:config.c **** ; 637:config.c **** 638:config.c **** /* calc offset from previous { to next { or eol and replace previous { with offset */ 639:config.c **** *ptr = (BYTE)(cLine - ptr); 640:config.c **** } 641:config.c **** 642:config.c **** return sLine; 643:config.c **** } 644:config.c **** 645:config.c **** /* Given a pointer to a memdisk command line and buffer will copy the next 646:config.c **** config.sys equivalent line to pLine and return updated cLine. 647:config.c **** Call repeatedly until end of string (*cLine == '\0'). 648:config.c **** Each simulated line is indicated be enclosing the line in curly braces {} 649:config.c **** with the end } optional - the next { will indicate end/beginning and 650:config.c **** end of line. MEMDISK options may appear nearly anywhere on line and are 651:config.c **** ignored - see memdisk_opts for list of recognized options. 652:config.c **** */ 653:config.c **** BYTE FAR * GetNextMemdiskLine(BYTE FAR *cLine, BYTE *pLine) 654:config.c **** { 655:config.c **** STATIC struct memdiskopt memdiskopts[] = { 656:config.c **** {"initrd", 6}, {"BOOT_IMAGE", 10}, 657:config.c **** {"floppy", 6}, {"harddisk", 8}, {"iso", 3}, 658:config.c **** {"nopass", 6}, {"nopassany", 9}, 659:config.c **** {"edd", 3}, {"noedd", 5} 660:config.c **** /* 661:config.c **** {"c", 1}, {"h", 1}, {"s", 1}, 662:config.c **** {"raw", 3}, {"bigraw", 6}, {"int", 3}, {"safeint", 7} 663:config.c **** */ 664:config.c **** }; 665:config.c **** 666:config.c **** int ws = TRUE; /* treat start of line same as if whitespace seen */ 667:config.c **** BYTE FAR * mf = NULL; /* where last line split by memdisk option */ 668:config.c **** BYTE FAR *ptr = cLine; /* start of current cfg line, where { was */ 669:config.c **** BYTE FAR *sLine = cLine; 670:config.c **** 671:config.c **** /* exit early if already at end of command line */ 672:config.c **** if (!*cLine) return cLine; 673:config.c **** 674:config.c **** /* point to start of next line; terminates current line if no } found before here */ 675:config.c **** cLine += *cLine; 676:config.c **** 677:config.c **** /* restore original character we overwrite with offset, for next iteration of cfg file */ 678:config.c **** *ptr = '{'; 679:config.c **** 680:config.c **** /* ASSERT ptr points to start of line { and cLine points to start of next line { (or eol)*/ 681:config.c **** 682:config.c **** /* copy chars to pLine buffer until } or start of next line */ 683:config.c **** for (++ptr; (*ptr != '}') && (ptr < cLine); ++ptr) 684:config.c **** { 685:config.c **** /* if not in last {} then simply copy chars up to } (or next {) */ 686:config.c **** if (*cLine) goto copy_char; 687:config.c **** 688:config.c **** /* otherwise if last character was whitespace (or start of line) check for memdisk option to sk 689:config.c **** if (ws) 690:config.c **** { 691:config.c **** int i; 692:config.c **** for (i = 0; i < 9; ++i) 693:config.c **** { 694:config.c **** /* compare with option */ 695:config.c **** if (fmemcmp(ptr, memdiskopts[i].name, memdiskopts[i].size) == 0) 696:config.c **** { 697:config.c **** BYTE c = *(ptr + memdiskopts[i].size); 698:config.c **** /* ensure character after is end of line, =, or whitespace */ 699:config.c **** if (!c || (c == '=') || iswh(c)) 700:config.c **** { 701:config.c **** /* flag this line split */ 702:config.c **** mf = ptr; 703:config.c **** 704:config.c **** /* matched option so point past it */ 705:config.c **** ptr += memdiskopts[i].size; 706:config.c **** 707:config.c **** /* allow extra whitespace between option and = by skipping it */ 708:config.c **** while (iswh(*ptr)) 709:config.c **** ++ptr; 710:config.c **** 711:config.c **** /* if option has = value then skip it as well */ 712:config.c **** if (*ptr == '=') 713:config.c **** { 714:config.c **** /* allow extra whitespace between = and value by skipping it */ 715:config.c **** while (iswh(*ptr)) 716:config.c **** ++ptr; 717:config.c **** 718:config.c **** /* skip past all characters after = */ 719:config.c **** for (; (*ptr != '}') && (ptr < cLine) && !iswh(*ptr); ++ptr) 720:config.c **** ; 721:config.c **** } 722:config.c **** 723:config.c **** break; /* memdisk option found, no need to keep check rest in list */ 724:config.c **** } 725:config.c **** } 726:config.c **** } 727:config.c **** } 728:config.c **** 729:config.c **** if (ptr < cLine) 730:config.c **** { 731:config.c **** ws = iswh(*ptr); 732:config.c **** 733:config.c **** /* allow replacing X=Y prior to memdisk options with X=Z after */ 734:config.c **** /* on 1st pass if find a match we overwrite it with spaces */ 735:config.c **** if (mf && (*ptr == '=')) 736:config.c **** { 737:config.c **** BYTE FAR *old=sLine, FAR *new; 738:config.c **** /* check for = in command line */ 739:config.c **** for (; old < mf; ++old) 740:config.c **** { 741:config.c **** for (; (*old != '=') && (old < mf); ++old) 742:config.c **** ; 743:config.c **** /* ASSERT ptr points to = after memdisk option and old points to = before memdisk option 744:config.c **** 745:config.c **** /* compare backwards to see if same option */ 746:config.c **** for (new = ptr; (old >= sLine) && ((*old & 0xCD) == (*new & 0xCD)); --old, --new) 747:config.c **** { 748:config.c **** if (iswh(*old) || iswh(*new)) break; 749:config.c **** } 750:config.c **** 751:config.c **** /* if match found then overwrite, otherwise skip past the = */ 752:config.c **** if (((old <= sLine) || iswh(*old)) && iswh(*new)) 753:config.c **** { 754:config.c **** /* match found so overwrite with spaces */ 755:config.c **** for(++old; !iswh(*old) && (old < mf); ++old) 756:config.c **** *old = ' '; 757:config.c **** } 758:config.c **** else 759:config.c **** { 760:config.c **** for (; (*old != '=') && (old < mf); ++old) 761:config.c **** ; 762:config.c **** } 763:config.c **** } 764:config.c **** } 765:config.c **** 766:config.c **** copy_char: 767:config.c **** *pLine = *ptr; 768:config.c **** ++pLine; 769:config.c **** } 770:config.c **** } 771:config.c **** *pLine = 0; 772:config.c **** 773:config.c **** /* return location to begin next scan from */ 774:config.c **** return cLine; 775:config.c **** } 776:config.c **** 777:config.c **** #endif 778:config.c **** 779:config.c **** 780:config.c **** static unsigned check_config_commandline(char ** pointer, char * cc, 781:config.c **** char const * commandbuffer, char const * command); 782:config.c **** static unsigned check_config_commandline(char ** pointer, char * cc, 783:config.c **** char const * commandbuffer, char const * command) { 784:config.c **** unsigned length = strlen(command); 785:config.c **** if (memcmp(commandbuffer, command, length) == 0 786:config.c **** && (commandbuffer[length] == '\t' 787:config.c **** || commandbuffer[length] == ' ' 788:config.c **** || commandbuffer[length] == '=' 789:config.c **** || commandbuffer[length] == 0)) { 790:config.c **** for (cc += length; *cc == '\t' || *cc == ' '; ++cc); 791:config.c **** if (*cc == '=') ++cc; 792:config.c **** for (; *cc == '\t' || *cc == ' '; ++cc); 793:config.c **** *pointer = cc; 794:config.c **** return 1; 795:config.c **** } 796:config.c **** return 0; 797:config.c **** } 798:config.c **** 799:config.c **** 800:config.c **** VOID DoConfig(int nPass) 801:config.c **** { 802:config.c **** BYTE *pLine; 803:config.c **** BOOL bEof = FALSE; 804:config.c **** 805:config.c **** #ifdef MEMDISK_ARGS 806:config.c **** /* check if MEMDISK used for LoL->BootDrive, if so check for special appended arguments */ 807:config.c **** struct memdiskinfo FAR *mdsk = NULL; 808:config.c **** BYTE FAR *cLine; 809:config.c **** /* memdisk check & usage requires 386+, DO NOT invoke if less than 386 */ 810:config.c **** if (LoL->cpu >= 3) 811:config.c **** { 812:config.c **** UBYTE drv = (LoL->BootDrive < 3)?0x0:0x80; /* 1=A,2=B,3=C */ 813:config.c **** mdsk = query_memdisk(drv); 814:config.c **** if (mdsk != NULL) 815:config.c **** { 816:config.c **** cLine = ProcessMemdiskLine(mdsk->cmdline); 817:config.c **** } 818:config.c **** } 819:config.c **** #endif 820:config.c **** 821:config.c **** if (nPass==0) 822:config.c **** { 823:config.c **** HaltCpuWhileIdle = 0; /* init to "no HLT while idle" */ 824:config.c **** 825:config.c **** #ifdef MEMDISK_ARGS 826:config.c **** if (mdsk != NULL) 827:config.c **** { 828:config.c **** printf("MEMDISK version %u.%02u (%lu sectors)\n", mdsk->version, mdsk->version_minor, mdsk-> 829:config.c **** CfgDbgPrintf(("MEMDISK args:{%S}\n", mdsk->cmdline)); 830:config.c **** } 831:config.c **** else 832:config.c **** { 833:config.c **** CfgDbgPrintf(("MEMDISK not detected!\n")); 834:config.c **** } 835:config.c **** #endif 836:config.c **** } 837:config.c **** 838:config.c **** { 839:config.c **** char * pp = kernel_command_line; 840:config.c **** char * cc; 841:config.c **** unsigned ii; 842:config.c **** static char commandbuffer[256]; 843:config.c **** char * end = &kernel_command_line[kernel_command_line_length]; 844:config.c **** static char * configfile = ""; 845:config.c **** static char * altconfigfile = "fdconfig.sys"; 846:config.c **** static char * oldconfigfile = "config.sys"; 847:config.c **** static struct { char ** pointer; char const * command; } 848:config.c **** configcommands[] = { 849:config.c **** { &configfile, "CONFIG" }, 850:config.c **** { &altconfigfile, "ALTCONFIG" }, 851:config.c **** { &oldconfigfile, "OLDCONFIG" }, 852:config.c **** { NULL, NULL } 853:config.c **** }; 854:config.c **** for (; pp < end; pp += strlen(pp) + 1) { 855:config.c **** for (cc = pp; *cc == '\t' || *cc == ' '; ++cc); 856:config.c **** strcpy(commandbuffer, cc); 857:config.c **** strupr(commandbuffer); 858:config.c **** for (ii = 0; configcommands[ii].pointer != NULL; ++ii) 859:config.c **** if (check_config_commandline(configcommands[ii].pointer, 860:config.c **** cc, commandbuffer, configcommands[ii].command)) 861:config.c **** break; 862:config.c **** } 863:config.c **** 864:config.c **** /* Check to see if we have a config.sys file. If not, just */ 865:config.c **** /* exit since we don't force the user to have one (but 1st */ 866:config.c **** /* also process MEMDISK passed config options if present). */ 867:config.c **** for (ii = 0; configcommands[ii].pointer != NULL; ++ii) { 868:config.c **** if (**configcommands[ii].pointer != '\0') { 869:config.c **** if ((nFileDesc = open(*configcommands[ii].pointer, 0)) >= 0) { 870:config.c **** CfgDbgPrintf(("Reading \"%s\"...\n", *configcommands[ii].pointer)); 871:config.c **** break; 872:config.c **** } else { 873:config.c **** CfgDbgPrintf(("\"%s\" not found\n", *configcommands[ii].pointer)); 874:config.c **** } 875:config.c **** } 876:config.c **** } 877:config.c **** if (configcommands[ii].pointer == NULL) { 878:config.c **** /* at this point no config file was found, may return early */ 879:config.c **** #ifdef MEMDISK_ARGS 880:config.c **** /* if memdisk in use then only assume end of file reached and proceed, else return early */ 881:config.c **** if (mdsk != NULL) 882:config.c **** bEof = TRUE; 883:config.c **** else 884:config.c **** #endif 885:config.c **** return; 886:config.c **** } 887:config.c **** } 888:config.c **** 889:config.c **** nCfgLine = 0; /* keep track of which line in file for errors */ 890:config.c **** 891:config.c **** /* Read each line into the buffer and then parse the line, */ 892:config.c **** /* do the table lookup and execute the handler for that */ 893:config.c **** /* function. */ 894:config.c **** 895:config.c **** #ifdef MEMDISK_ARGS 896:config.c **** for (; !bEof || (mdsk != NULL); nCfgLine++) 897:config.c **** #else 898:config.c **** for (; !bEof; nCfgLine++) 899:config.c **** #endif 900:config.c **** { 901:config.c **** struct table *pEntry; 902:config.c **** pLineStart = szLine; 903:config.c **** 904:config.c **** #ifdef MEMDISK_ARGS 905:config.c **** if (!bEof) 906:config.c **** { 907:config.c **** #endif 908:config.c **** 909:config.c **** /* read in a single line, \n or ^Z terminated */ 910:config.c **** 911:config.c **** for (pLine = szLine;;) 912:config.c **** { 913:config.c **** if (read(nFileDesc, pLine, 1) == 0) 914:config.c **** { 915:config.c **** bEof = TRUE; 916:config.c **** break; 917:config.c **** } 918:config.c **** 919:config.c **** if (pLine >= szLine + sizeof(szLine) - 3) 920:config.c **** { 921:config.c **** CfgFailure(pLine); 922:config.c **** printf("error - line overflow line %d \n", nCfgLine); 923:config.c **** break; 924:config.c **** } 925:config.c **** 926:config.c **** if (*pLine == '\n' || *pLine == EOF) /* end of line */ 927:config.c **** break; 928:config.c **** 929:config.c **** if (*pLine != '\r') /* ignore CR */ 930:config.c **** pLine++; 931:config.c **** } 932:config.c **** 933:config.c **** *pLine = 0; 934:config.c **** #ifdef MEMDISK_ARGS 935:config.c **** } 936:config.c **** else if (mdsk != NULL) 937:config.c **** { 938:config.c **** cLine = GetNextMemdiskLine(cLine, szLine); 939:config.c **** /* if end of memdisk command line reached, flag done */ 940:config.c **** if (!*cLine) 941:config.c **** mdsk = NULL; 942:config.c **** } 943:config.c **** #endif 944:config.c **** 945:config.c **** if (bEof && nCurChain) { 946:config.c **** struct CfgFile *cfg = &cfgFile[--nCurChain]; 947:config.c **** close(nFileDesc); 948:config.c **** bEof = FALSE; 949:config.c **** nFileDesc = cfg->nFileDesc; 950:config.c **** nCfgLine = cfg->nCfgLine; 951:config.c **** continue; 952:config.c **** } 953:config.c **** 954:config.c **** CfgDbgPrintf(("CONFIG=[%s]\n", szLine)); 955:config.c **** 956:config.c **** /* Skip leading white space and get verb. */ 957:config.c **** pLine = scan(szLine, szBuf, 1); 958:config.c **** 959:config.c **** /* If the line was blank, skip it. Otherwise, look up */ 960:config.c **** /* the verb and execute the appropriate function. */ 961:config.c **** if (*szBuf == '\0') 962:config.c **** continue; 963:config.c **** 964:config.c **** pEntry = LookUp(commands, szBuf); 965:config.c **** 966:config.c **** /* should config command be executed on this pass? */ 967:config.c **** if (pEntry->pass >= 0 && pEntry->pass != nPass) 968:config.c **** continue; 969:config.c **** 970:config.c **** /* pass 0 always executed (rem Menu prompt switches) */ 971:config.c **** if (nPass == 0) 972:config.c **** { 973:config.c **** pEntry->func(pLine); 974:config.c **** continue; 975:config.c **** } 976:config.c **** else 977:config.c **** { 978:config.c **** if (SkipLine(pLineStart)) /* F5/F8/?/! processing */ 979:config.c **** continue; 980:config.c **** } 981:config.c **** 982:config.c **** if ((pEntry->func != CfgMenu) && (pEntry->func != CfgMenuEsc)) 983:config.c **** { 984:config.c **** /* compatibility "device foo.sys" */ 985:config.c **** if (' ' != *pLine && '\t' != *pLine && '=' != *pLine) 986:config.c **** { 987:config.c **** CfgFailure(pLine); 988:config.c **** continue; 989:config.c **** } 990:config.c **** pLine = skipwh(pLine); 991:config.c **** } 992:config.c **** if ('=' == *pLine || pEntry->func == CfgMenu || pEntry->func == CfgMenuEsc) 993:config.c **** pLine = skipwh(pLine+1); 994:config.c **** 995:config.c **** /* YES. DO IT */ 996:config.c **** pEntry->func(pLine); 997:config.c **** } 998:config.c **** close(nFileDesc); 999:config.c **** 1000:config.c **** if (nPass == 0) 1001:config.c **** { 1002:config.c **** DoMenu(); 1003:config.c **** } 1004:config.c **** } 1005:config.c **** 1006:config.c **** STATIC struct table * LookUp(struct table *p, BYTE * token) 1007:config.c **** { 1008:config.c **** while (p->entry[0] != '\0' && !strcaseequal(p->entry, token)) 1009:config.c **** ++p; 1010:config.c **** return p; 1011:config.c **** } 1012:config.c **** 1013:config.c **** /* 1014:config.c **** get BIOS key with timeout: 1015:config.c **** 1016:config.c **** timeout < 0: no timeout 1017:config.c **** timeout = 0: poll only once 1018:config.c **** timeout > 0: timeout in seconds 1019:config.c **** 1020:config.c **** return 1021:config.c **** 0xffff : no key hit 1022:config.c **** 1023:config.c **** 0xHH.. : scancode in upper half 1024:config.c **** 0x..LL : asciicode in lower half 1025:config.c **** */ 1026:config.c **** #define GetBiosTime() peekl(0, 0x46c) 1027:config.c **** 1028:config.c **** UWORD GetBiosKey(int timeout) 1029:config.c **** { 1030:config.c **** iregs r; 1031:config.c **** 1032:config.c **** ULONG startTime = GetBiosTime(); 1033:config.c **** 1034:config.c **** if (timeout >= 0) 1035:config.c **** { 1036:config.c **** do 1037:config.c **** { 1038:config.c **** /* optionally HLT here - timer will IRQ even if no keypress */ 1039:config.c **** r.a.x = 0x0100; /* are there keys available ? */ 1040:config.c **** init_call_intr(0x16, &r); 1041:config.c **** if (!(r.flags & FLG_ZERO)) { 1042:config.c **** r.a.x = 0x0000; 1043:config.c **** init_call_intr(0x16, &r); /* there is a key, so better fetch it! */ 1044:config.c **** return r.a.x; 1045:config.c **** } 1046:config.c **** } while ((unsigned)(GetBiosTime() - startTime) < timeout * 18u); 1047:config.c **** return 0xffff; 1048:config.c **** } 1049:config.c **** 1050:config.c **** /* blocking wait (timeout < 0): fetch it */ 1051:config.c **** #if 0 1052:config.c **** do { 1053:config.c **** /* optionally HLT here */ 1054:config.c **** r.a.x = 0x0100; 1055:config.c **** init_call_intr(0x16, &r); 1056:config.c **** } while (r.flags & FLG_ZERO); 1057:config.c **** #endif 1058:config.c **** r.a.x = 0x0000; 1059:config.c **** init_call_intr(0x16, &r); 1060:config.c **** return r.a.x; 1061:config.c **** } 1062:config.c **** 1063:config.c **** STATIC BOOL SkipLine(char *pLine) 1064:config.c **** { 1065:config.c **** short key; 1066:config.c **** COUNT i; 1067:config.c **** signed char originalskipconfigseconds = InitKernelConfig.SkipConfigSeconds; 1068:config.c **** 1069:config.c **** if (originalskipconfigseconds >= 0) 1070:config.c **** { 1071:config.c **** 1072:config.c **** if (originalskipconfigseconds > 0) 1073:config.c **** printf("Press F8 to trace or F5 to skip CONFIG.SYS/AUTOEXEC.BAT"); 1074:config.c **** 1075:config.c **** key = GetBiosKey(originalskipconfigseconds); /* wait 2 seconds */ 1076:config.c **** 1077:config.c **** InitKernelConfig.SkipConfigSeconds = -1; 1078:config.c **** 1079:config.c **** if (key == 0x3f00) /* F5 */ 1080:config.c **** { 1081:config.c **** SkipAllConfig = TRUE; 1082:config.c **** } 1083:config.c **** else if (key == 0x4200) /* F8 */ 1084:config.c **** { 1085:config.c **** singleStep = TRUE; 1086:config.c **** } 1087:config.c **** 1088:config.c **** if (originalskipconfigseconds > 0) 1089:config.c **** printf("\r%79s\r", ""); /* clear line */ 1090:config.c **** 1091:config.c **** if (SkipAllConfig) 1092:config.c **** printf("Skipping CONFIG.SYS/AUTOEXEC.BAT\n"); 1093:config.c **** } 1094:config.c **** 1095:config.c **** if (SkipAllConfig) 1096:config.c **** return TRUE; 1097:config.c **** 1098:config.c **** /* 1?device=CDROM.SYS */ 1099:config.c **** /* 12?device=OAKROM.SYS */ 1100:config.c **** /* 123?device=EMM386.EXE NOEMS */ 1101:config.c **** if ( MenuLine != 0 && 1102:config.c **** (MenuLine & (1 << MenuSelected)) == 0) 1103:config.c **** return TRUE; 1104:config.c **** 1105:config.c **** if (DontAskThisSingleCommand) /* !files=30 */ 1106:config.c **** return FALSE; 1107:config.c **** 1108:config.c **** if (!askThisSingleCommand && !singleStep) 1109:config.c **** return FALSE; 1110:config.c **** 1111:config.c **** for (i = 0; i < nCurChain; i++) 1112:config.c **** printf(" "); 1113:config.c **** printf("%s[Y,N]?", pLine); 1114:config.c **** 1115:config.c **** for (;;) 1116:config.c **** { 1117:config.c **** key = GetBiosKey(-1); 1118:config.c **** 1119:config.c **** switch (toupper(key & 0x00ff)) 1120:config.c **** { 1121:config.c **** case 'N': 1122:config.c **** printf("N\n"); 1123:config.c **** return TRUE; 1124:config.c **** 1125:config.c **** case 0x1b: /* don't know where documented 1126:config.c **** ESCAPE answers all following questions 1127:config.c **** with YES 1128:config.c **** */ 1129:config.c **** singleStep = FALSE; /* and fall through */ 1130:config.c **** 1131:config.c **** case '\r': 1132:config.c **** case '\n': 1133:config.c **** case 'Y': 1134:config.c **** printf("Y\n"); 1135:config.c **** return FALSE; 1136:config.c **** 1137:config.c **** } 1138:config.c **** 1139:config.c **** if (key == 0x3f00) /* YES, you may hit F5 here, too */ 1140:config.c **** { 1141:config.c **** printf("N\n"); 1142:config.c **** SkipAllConfig = TRUE; 1143:config.c **** return TRUE; 1144:config.c **** } 1145:config.c **** } 1146:config.c **** 1147:config.c **** } 1148:config.c **** 1149:config.c **** /* JPP - changed so will accept hex number. */ 1150:config.c **** /* ea - changed to accept hex digits in hex numbers */ 1151:config.c **** STATIC char *GetNumArg(char *p, int *num) 1152:config.c **** { 1153:config.c **** static char digits[] = "0123456789ABCDEF"; 1154:config.c **** unsigned char base = 10; 1155:config.c **** int sign = 1; 1156:config.c **** int n = 0; 1157:config.c **** 1158:config.c **** /* look for NUMBER */ 1159:config.c **** p = skipwh(p); 1160:config.c **** if (*p == '-') 1161:config.c **** { 1162:config.c **** p++; 1163:config.c **** sign = -1; 1164:config.c **** } 1165:config.c **** else if (!isnum(*p)) 1166:config.c **** { 1167:config.c **** CfgFailure(p); 1168:config.c **** return NULL; 1169:config.c **** } 1170:config.c **** 1171:config.c **** for( ; *p; p++) 1172:config.c **** { 1173:config.c **** char ch = toupper(*p); 1174:config.c **** if (ch == 'X') 1175:config.c **** base = 16; 1176:config.c **** else 1177:config.c **** { 1178:config.c **** char *q = strchr(digits, ch); 1179:config.c **** if (q == NULL) 1180:config.c **** break; 1181:config.c **** n = n * base + (q - digits); 1182:config.c **** } 1183:config.c **** } 1184:config.c **** *num = n * sign; 1185:config.c **** return p; 1186:config.c **** } 1187:config.c **** 1188:config.c **** BYTE *GetStringArg(BYTE * pLine, BYTE * pszString) 1189:config.c **** { 1190:config.c **** /* just return whatever string is there, including null */ 1191:config.c **** return scan(pLine, pszString, 0); 1192:config.c **** } 1193:config.c **** 1194:config.c **** STATIC void Config_Buffers(BYTE * pLine) 1195:config.c **** { 1196:config.c **** COUNT nBuffers; 1197:config.c **** 1198:config.c **** /* Get the argument */ 1199:config.c **** if (GetNumArg(pLine, &nBuffers)) 1200:config.c **** Config.cfgBuffers = nBuffers; 1201:config.c **** } 1202:config.c **** 1203:config.c **** STATIC void CfgBuffersHigh(BYTE * pLine) 1204:config.c **** { 1205:config.c **** Config_Buffers(pLine); 1206:config.c **** if (InitKernelConfig.Verbose >= 0) printf("Note: BUFFERS will be in HMA or low RAM, not in UMB\n" 1207:config.c **** } 1208:config.c **** 1209:config.c **** /** 1210:config.c **** Set screen mode - rewritten to use init_call_intr() by RE / ICD 1211:config.c **** */ 1212:config.c **** STATIC VOID sysScreenMode(BYTE * pLine) 1213:config.c **** { 1214:config.c **** iregs r; 1215:config.c **** COUNT nMode; 1216:config.c **** COUNT nFunc = 0x11; 1217:config.c **** 1218:config.c **** /* Get the argument */ 1219:config.c **** if (GetNumArg(pLine, &nMode) == (BYTE *) 0) 1220:config.c **** return; 1221:config.c **** 1222:config.c **** if(nMode<0x10) 1223:config.c **** nFunc = 0; /* set lower screenmode */ 1224:config.c **** else if ((nMode != 0x11) && (nMode != 0x12) && (nMode != 0x14)) 1225:config.c **** return; /* do nothing; invalid screenmode */ 1226:config.c **** 1227:config.c **** /* Modes 1228:config.c **** 0x11 (17) 28 lines 1229:config.c **** 0x12 (18) 43/50 lines 1230:config.c **** 0x14 (20) 25 lines 1231:config.c **** */ 1232:config.c **** /* move cursor to pos 0,0: */ 1233:config.c **** r.a.b.h = nFunc; /* set videomode */ 1234:config.c **** r.a.b.l = nMode; 1235:config.c **** r.b.b.l = 0; 1236:config.c **** init_call_intr(0x10, &r); 1237:config.c **** } 1238:config.c **** 1239:config.c **** STATIC VOID sysVersion(BYTE * pLine) 1240:config.c **** { 1241:config.c **** COUNT major, minor; 1242:config.c **** char *p = strchr(pLine, '.'); 1243:config.c **** 1244:config.c **** if (p == NULL) 1245:config.c **** return; 1246:config.c **** 1247:config.c **** p++; 1248:config.c **** 1249:config.c **** /* Get major number */ 1250:config.c **** if (GetNumArg(pLine, &major) == (BYTE *) 0) 1251:config.c **** return; 1252:config.c **** 1253:config.c **** /* Get minor number */ 1254:config.c **** if (GetNumArg(p, &minor) == (BYTE *) 0) 1255:config.c **** return; 1256:config.c **** 1257:config.c **** if (InitKernelConfig.Verbose >= 0) printf("Changing reported version to %d.%d\n", major, minor); 1258:config.c **** 1259:config.c **** LoL->os_setver_major = major; /* not the internal os_major */ 1260:config.c **** LoL->os_setver_minor = minor; /* not the internal os_minor */ 1261:config.c **** ((psp far *)MK_FP(DOS_PSP, 0))->ps_retdosver = (minor << 8) + major; 1262:config.c **** } 1263:config.c **** 1264:config.c **** STATIC VOID Files(BYTE * pLine) 1265:config.c **** { 1266:config.c **** COUNT nFiles; 1267:config.c **** 1268:config.c **** /* Get the argument */ 1269:config.c **** if (GetNumArg(pLine, &nFiles) == (BYTE *) 0) 1270:config.c **** return; 1271:config.c **** 1272:config.c **** /* Got the value, assign either default or new value */ 1273:config.c **** Config.cfgFiles = max(Config.cfgFiles, nFiles); 1274:config.c **** Config.cfgFilesHigh = 0; 1275:config.c **** } 1276:config.c **** 1277:config.c **** STATIC VOID FilesHigh(BYTE * pLine) 1278:config.c **** { 1279:config.c **** Files(pLine); 1280:config.c **** Config.cfgFilesHigh = 1; 1281:config.c **** } 1282:config.c **** 1283:config.c **** STATIC VOID CfgLastdrive(BYTE * pLine) 1284:config.c **** { 1285:config.c **** /* Format: LASTDRIVE = letter */ 1286:config.c **** BYTE drv; 1287:config.c **** 1288:config.c **** pLine = skipwh(pLine); 1289:config.c **** drv = toupper(*pLine); 1290:config.c **** 1291:config.c **** if (drv < 'A' || drv > 'Z') 1292:config.c **** { 1293:config.c **** CfgFailure(pLine); 1294:config.c **** return; 1295:config.c **** } 1296:config.c **** drv -= 'A' - 1; /* Make real number */ 1297:config.c **** if (drv > Config.cfgLastdrive) 1298:config.c **** Config.cfgLastdrive = drv; 1299:config.c **** Config.cfgLastdriveHigh = 0; 1300:config.c **** } 1301:config.c **** 1302:config.c **** STATIC VOID CfgLastdriveHigh(BYTE * pLine) 1303:config.c **** { 1304:config.c **** /* Format: LASTDRIVEHIGH = letter */ 1305:config.c **** CfgLastdrive(pLine); 1306:config.c **** Config.cfgLastdriveHigh = 1; 1307:config.c **** } 1308:config.c **** 1309:config.c **** /* 1310:config.c **** UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way. 1311:config.c **** */ 1312:config.c **** 1313:config.c **** STATIC VOID Dosmem(BYTE * pLine) 1314:config.c **** { 1315:config.c **** BYTE *pTmp; 1316:config.c **** BYTE UMBwanted = FALSE; 1317:config.c **** 1318:config.c **** GetStringArg(pLine, szBuf); 1319:config.c **** strcpy(szBuf, pLine); 1320:config.c **** strupr(szBuf); 1321:config.c **** 1322:config.c **** /* printf("DOS called with %s\n", szBuf); */ 1323:config.c **** 1324:config.c **** for (pTmp = szBuf;;) 1325:config.c **** { 1326:config.c **** while (*pTmp == ' ' || *pTmp == '\t') 1327:config.c **** pTmp++; 1328:config.c **** 1329:config.c **** if (memcmp(pTmp, "UMB", 3) == 0) 1330:config.c **** { 1331:config.c **** UMBwanted = TRUE; 1332:config.c **** pTmp += 3; 1333:config.c **** } 1334:config.c **** if (memcmp(pTmp, "HIGH", 4) == 0) 1335:config.c **** { 1336:config.c **** HMAState = HMA_REQ; 1337:config.c **** pTmp += 4; 1338:config.c **** } 1339:config.c **** if (memcmp(pTmp, "LOW", 3) == 0) 1340:config.c **** { 1341:config.c **** HMAState = HMA_LOW; 1342:config.c **** pTmp += 3; 1343:config.c **** } 1344:config.c **** if (memcmp(pTmp, "NOUMB", 5) == 0) 1345:config.c **** { 1346:config.c **** UMBwanted = FALSE; 1347:config.c **** pTmp += 5; 1348:config.c **** } 1349:config.c **** /* if (memcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/ 1350:config.c **** pTmp = skipwh(pTmp); 1351:config.c **** 1352:config.c **** if (*pTmp == '\0') 1353:config.c **** break; 1354:config.c **** if (*pTmp != ',') 1355:config.c **** { 1356:config.c **** CfgFailure(pLine + (pTmp - szBuf)); 1357:config.c **** break; 1358:config.c **** } 1359:config.c **** pTmp++; 1360:config.c **** } 1361:config.c **** 1362:config.c **** if (UmbState == 0) 1363:config.c **** { 1364:config.c **** LoL->uppermem_link = 0; 1365:config.c **** LoL->uppermem_root = 0xffff; 1366:config.c **** UmbState = UMBwanted ? 2 : 0; 1367:config.c **** } 1368:config.c **** /* Check if HMA is available straight away */ 1369:config.c **** if (HMAState == HMA_REQ && MoveKernelToHMA()) 1370:config.c **** { 1371:config.c **** HMAState = HMA_DONE; 1372:config.c **** } 1373:config.c **** } 1374:config.c **** 1375:config.c **** STATIC VOID DosData(BYTE * pLine) 1376:config.c **** { 1377:config.c **** pLine = GetStringArg(pLine, szBuf); 1378:config.c **** strupr(szBuf); 1379:config.c **** 1380:config.c **** if (memcmp(szBuf, "UMB", 3) == 0) 1381:config.c **** Config.cfgDosDataUmb = TRUE; 1382:config.c **** } 1383:config.c **** 1384:config.c **** STATIC VOID CfgSwitchar(BYTE * pLine) 1385:config.c **** { 1386:config.c **** /* Format: SWITCHAR = character */ 1387:config.c **** 1388:config.c **** GetStringArg(pLine, szBuf); 1389:config.c **** init_switchar(*szBuf); 1390:config.c **** } 1391:config.c **** 1392:config.c **** STATIC VOID CfgSwitches(BYTE * pLine) 1393:config.c **** { 1394:config.c **** pLine = skipwh(pLine); 1395:config.c **** if (*pLine == '=') 1396:config.c **** { 1397:config.c **** pLine = skipwh(pLine + 1); 1398:config.c **** } 1399:config.c **** while (*pLine) 1400:config.c **** { 1401:config.c **** if (*pLine == '/') { 1402:config.c **** pLine++; 1403:config.c **** switch(toupper(*pLine)) { 1404:config.c **** case 'K': 1405:config.c **** if (commands[0].pass == 1) 1406:config.c **** kbdType = 0; /* force conv keyb */ 1407:config.c **** break; 1408:config.c **** case 'N': 1409:config.c **** InitKernelConfig.SkipConfigSeconds = -1; 1410:config.c **** break; 1411:config.c **** case 'F': 1412:config.c **** InitKernelConfig.SkipConfigSeconds = 0; 1413:config.c **** break; 1414:config.c **** case 'E': /* /E[[:]nnnn] Set the desired EBDA amount to move in bytes */ 1415:config.c **** { /* Note that if there is no EBDA, this will have no effect */ 1416:config.c **** int n = 0; 1417:config.c **** if (*++pLine == ':') 1418:config.c **** pLine++; /* skip optional separator */ 1419:config.c **** if (!(isnum(*pLine) || (*pLine == '-'))) 1420:config.c **** { 1421:config.c **** pLine--; 1422:config.c **** break; 1423:config.c **** } 1424:config.c **** pLine = GetNumArg(pLine, &n) - 1; 1425:config.c **** /* allowed values: [48..1024] bytes, multiples of 16 1426:config.c **** * e.g. AwardBIOS: 48, AMIBIOS: 1024 1427:config.c **** * (Phoenix, MRBIOS, Unicore = ????) 1428:config.c **** */ 1429:config.c **** if (n == -1) 1430:config.c **** { 1431:config.c **** Config.ebda2move = 0xffff; 1432:config.c **** break; 1433:config.c **** } 1434:config.c **** else if (n >= 48 && n <= 1024) 1435:config.c **** { 1436:config.c **** Config.ebda2move = (n + 15) & 0xfff0; 1437:config.c **** break; 1438:config.c **** } 1439:config.c **** /* else fall through (failure) */ 1440:config.c **** } 1441:config.c **** default: 1442:config.c **** CfgFailure(pLine); 1443:config.c **** } 1444:config.c **** } else { 1445:config.c **** CfgFailure(pLine); 1446:config.c **** } 1447:config.c **** pLine = skipwh(pLine+1); 1448:config.c **** } 1449:config.c **** commands[0].pass = 1; 1450:config.c **** } 1451:config.c **** 1452:config.c **** STATIC VOID Fcbs(BYTE * pLine) 1453:config.c **** { 1454:config.c **** /* Format: FCBS = totalFcbs [,protectedFcbs] */ 1455:config.c **** COUNT fcbs; 1456:config.c **** 1457:config.c **** if ((pLine = GetNumArg(pLine, &fcbs)) == 0) 1458:config.c **** return; 1459:config.c **** Config.cfgFcbs = fcbs; 1460:config.c **** 1461:config.c **** pLine = skipwh(pLine); 1462:config.c **** 1463:config.c **** if (*pLine == ',') 1464:config.c **** { 1465:config.c **** GetNumArg(++pLine, &fcbs); 1466:config.c **** Config.cfgProtFcbs = fcbs; 1467:config.c **** } 1468:config.c **** 1469:config.c **** if (Config.cfgProtFcbs > Config.cfgFcbs) 1470:config.c **** Config.cfgProtFcbs = Config.cfgFcbs; 1471:config.c **** } 1472:config.c **** 1473:config.c **** /* 1474:config.c **** Keyboard buffer relocation: KEYBUF=start[,end] 1475:config.c **** Select a new location for the keyboard buffer at 0x40:xx, 1476:config.c **** for example 0x40:0xac-0xff, but 0x50:5-0xff ("basica" only?) 1477:config.c **** feels safer? 0x60:0-0xff is scratch, we use it as SHELL PSP. 1478:config.c **** (sys / boot sector load_segment / LOADSEG, exeflat call in 1479:config.c **** makefile, DOS_PSP in mcb.h, main.c P_0, task.c, kernel.asm) 1480:config.c **** (50:e0..ff used as early kernel boot drive / config buffer) 1481:config.c **** */ 1482:config.c **** STATIC VOID CfgKeyBuf(BYTE * pLine) 1483:config.c **** { 1484:config.c **** /* Format: KEYBUF = startoffset [,endoffset] */ 1485:config.c **** UWORD FAR *keyfill = (UWORD FAR *) MK_FP(0x40, 0x1a); 1486:config.c **** UWORD FAR *keyrange = (UWORD FAR *) MK_FP(0x40, 0x80); 1487:config.c **** COUNT startbuf, endbuf; 1488:config.c **** 1489:config.c **** if ((pLine = GetNumArg(pLine, &startbuf)) == 0) 1490:config.c **** return; 1491:config.c **** pLine = skipwh(pLine); 1492:config.c **** endbuf = (startbuf | 0xff)+1; /* default end: end of the same "page" */ 1493:config.c **** if (*pLine == ',') 1494:config.c **** { 1495:config.c **** if ((pLine = GetNumArg(++pLine, &endbuf)) == 0) 1496:config.c **** return; 1497:config.c **** } 1498:config.c **** startbuf &= 0xfffe; 1499:config.c **** endbuf &= 0xfffe; 1500:config.c **** if (endbuf=0x100 && startbuf<0x105) || startbuf>0x1de) 1504:config.c **** { /* 50:0 / 50:4 are for prtscr / A:/B: DJ */ 1505:config.c **** printf("Must start at 0xac..0x1de, not 0x100..0x104\n"); 1506:config.c **** return; 1507:config.c **** } 1508:config.c **** keyfill[0] = startbuf; 1509:config.c **** keyfill[1] = startbuf; 1510:config.c **** keyrange[0] = startbuf; 1511:config.c **** keyrange[1] = endbuf; 1512:config.c **** keycheck(); 1513:config.c **** } 1514:config.c **** 1515:config.c **** /* LoadCountryInfo(): 1516:config.c **** * Searches a file in the COUNTRY.SYS format for an entry 1517:config.c **** * matching the specified code page and country code, and loads 1518:config.c **** * the corresponding information into memory. If code page is 0, 1519:config.c **** * the default code page for the country will be used. 1520:config.c **** * 1521:config.c **** * Returns TRUE if successful, FALSE if not. 1522:config.c **** */ 1523:config.c **** STATIC BOOL LoadCountryInfo(char *filenam, UWORD ctryCode, UWORD codePage) 1524:config.c **** { 1525:config.c **** /* COUNTRY.SYS file data structures - see RBIL tables 2619-2622 */ 1526:config.c **** 1527:config.c **** struct { /* file header */ 1528:config.c **** char name[8]; /* "\377COUNTRY.SYS" */ 1529:config.c **** char reserved[11]; 1530:config.c **** ULONG offset; /* offset of first entry in file */ 1531:config.c **** } header; 1532:config.c **** struct { /* entry */ 1533:config.c **** int length; /* length of entry, not counting this word, = 12 */ 1534:config.c **** int country; /* country ID */ 1535:config.c **** int codepage; /* codepage ID */ 1536:config.c **** int reserved[2]; 1537:config.c **** ULONG offset; /* offset of country-subfunction-header in file */ 1538:config.c **** } entry; 1539:config.c **** struct subf_hdr { /* subfunction header */ 1540:config.c **** int length; /* length of entry, not counting this word, = 6 */ 1541:config.c **** int id; /* subfunction ID */ 1542:config.c **** ULONG offset; /* offset within file of subfunction data entry */ 1543:config.c **** }; 1544:config.c **** static struct { /* subfunction data */ 1545:config.c **** char signature[8]; /* \377CTYINFO|UCASE|LCASE|FUCASE|FCHAR|COLLATE|DBCS|YESNO */ 1546:config.c **** int length; /* length of following table in bytes */ 1547:config.c **** UBYTE buffer[256]; 1548:config.c **** } subf_data; 1549:config.c **** struct subf_tbl { 1550:config.c **** char sig[8]; /* signature for each subfunction data */ 1551:config.c **** int idx; /* index of pointer in nls_hc.asm to be copied to */ 1552:config.c **** }; 1553:config.c **** static struct subf_tbl table[9] = { 1554:config.c **** {"\377 ", -1}, /* 0, unused */ 1555:config.c **** {"\377CTYINFO", 5}, /* 1 */ 1556:config.c **** {"\377UCASE ", 0}, /* 2 */ 1557:config.c **** {"\377LCASE ", -1}, /* 3, not supported [yet] */ 1558:config.c **** {"\377FUCASE ", 1}, /* 4 */ 1559:config.c **** {"\377FCHAR ", 2}, /* 5 */ 1560:config.c **** {"\377COLLATE", 3}, /* 6 */ 1561:config.c **** {"\377DBCS ", 4}, /* 7, not supported [yet] */ 1562:config.c **** {"\377YESNO ", -1} /* 35 */ 1563:config.c **** }; 1564:config.c **** static struct subf_hdr hdr[9]; 1565:config.c **** static int entries, count; 1566:config.c **** int fd, i, subf_tbl_ndx; 1567:config.c **** char *filename = filenam == NULL ? "\\COUNTRY.SYS" : filenam; 1568:config.c **** BOOL rc = FALSE; 1569:config.c **** BYTE FAR *ptable; 1570:config.c **** void FAR *CharMapFn; 1571:config.c **** 1572:config.c **** if ((fd = open(filename, 0)) < 0) 1573:config.c **** { 1574:config.c **** if (filenam == NULL) 1575:config.c **** return !LoadCountryInfoHardCoded(ctryCode); 1576:config.c **** printf("%s not found\n", filename); 1577:config.c **** return rc; 1578:config.c **** } 1579:config.c **** if (read(fd, &header, sizeof(header)) != sizeof(header)) 1580:config.c **** { 1581:config.c **** printf("Error reading %s\n", filename); 1582:config.c **** goto ret; 1583:config.c **** } 1584:config.c **** if (memcmp(header.name, "\377COUNTRY", sizeof(header.name))) 1585:config.c **** { 1586:config.c **** err:printf("%s has invalid format\n", filename); 1587:config.c **** goto ret; 1588:config.c **** } 1589:config.c **** if (lseek(fd, header.offset) == 0xffffffffL 1590:config.c **** || read(fd, &entries, sizeof(entries)) != sizeof(entries)) 1591:config.c **** goto err; 1592:config.c **** for (i = 0; i < entries; i++) 1593:config.c **** { 1594:config.c **** if (read(fd, &entry, sizeof(entry)) != sizeof(entry) || entry.length != 12) 1595:config.c **** goto err; 1596:config.c **** if (entry.country != ctryCode || entry.codepage != codePage && codePage) 1597:config.c **** continue; 1598:config.c **** if (lseek(fd, entry.offset) == 0xffffffffL 1599:config.c **** || read(fd, &count, sizeof(count)) != sizeof(count) 1600:config.c **** || count > LENGTH(hdr) 1601:config.c **** || read(fd, hdr, sizeof(struct subf_hdr) * count) 1602:config.c **** != sizeof(struct subf_hdr) * count) 1603:config.c **** goto err; 1604:config.c **** 1605:config.c **** /* Note: we reuse i here as we only process 1 entry, goto after inner for ends outer for */ 1606:config.c **** for (i = 0; i < count; i++) 1607:config.c **** { 1608:config.c **** if (hdr[i].length != 6) 1609:config.c **** goto err; 1610:config.c **** subf_tbl_ndx = hdr[i].id; 1611:config.c **** if (subf_tbl_ndx == 3 || ((subf_tbl_ndx < 1 || subf_tbl_ndx > 7) && subf_tbl_ndx != 35)) 1612:config.c **** continue; 1613:config.c **** if (subf_tbl_ndx == 35) 1614:config.c **** subf_tbl_ndx = 8; /* 0 through 7 match, but subfunction 35 is 9th entry in table[] */ 1615:config.c **** if (lseek(fd, hdr[i].offset) == 0xffffffffL 1616:config.c **** || read(fd, &subf_data, 10) != 10 1617:config.c **** || memcmp(subf_data.signature, table[subf_tbl_ndx].sig, 8) && (hdr[i].id !=4 1618:config.c **** || memcmp(subf_data.signature, table[2].sig, 8)) /* UCASE for FUCASE ^*/ 1619:config.c **** || read(fd, subf_data.buffer, subf_data.length) != subf_data.length) 1620:config.c **** goto err; 1621:config.c **** if (hdr[i].id == 1) 1622:config.c **** { 1623:config.c **** if (((struct CountrySpecificInfo *)subf_data.buffer)->CountryID 1624:config.c **** != entry.country 1625:config.c **** || ((struct CountrySpecificInfo *)subf_data.buffer)->CodePage 1626:config.c **** != entry.codepage 1627:config.c **** && codePage) 1628:config.c **** continue; 1629:config.c **** nlsPackageHardcoded.cntry = entry.country; 1630:config.c **** nlsPackageHardcoded.cp = entry.codepage; 1631:config.c **** subf_data.length = /* MS-DOS "CTYINFO" is up to 38 bytes */ 1632:config.c **** min(subf_data.length, sizeof(struct CountrySpecificInfo)); 1633:config.c **** CharMapFn = nlsCountryInfoHardcoded.C.CharMapFn; 1634:config.c **** } 1635:config.c **** if (hdr[i].id == 1) 1636:config.c **** ptable = (BYTE FAR *)&nlsPackageHardcoded.nlsExt.size; 1637:config.c **** else 1638:config.c **** ptable = nlsPackageHardcoded.nlsPointers[table[subf_tbl_ndx].idx].pointer; 1639:config.c **** if (hdr[i].id == 7) 1640:config.c **** { 1641:config.c **** if (subf_data.length == 0) 1642:config.c **** { 1643:config.c **** /* if DBCS table (in country.sys) is empty, clear internal table */ 1644:config.c **** *(DWORD *)(subf_data.buffer) = 0L; 1645:config.c **** fmemcpy(ptable, subf_data.buffer, 4); 1646:config.c **** } 1647:config.c **** else 1648:config.c **** { 1649:config.c **** fmemcpy(ptable + 2, subf_data.buffer, subf_data.length); 1650:config.c **** /* write length */ 1651:config.c **** *(UWORD *)(subf_data.buffer) = subf_data.length; 1652:config.c **** fmemcpy(ptable, subf_data.buffer, 2); 1653:config.c **** } 1654:config.c **** continue; 1655:config.c **** } 1656:config.c **** 1657:config.c **** /* for 0-7 we store COUNTRY.SYS data directly in buffer, but yes/no characters we store in nl 1658:config.c **** if (hdr[i].id == 35) 1659:config.c **** { 1660:config.c **** fmemcpy(&nlsPackageHardcoded.yeschar, subf_data.buffer, 2); 1661:config.c **** fmemcpy(&nlsPackageHardcoded.nochar, subf_data.buffer + 2, 2); 1662:config.c **** } else { 1663:config.c **** fmemcpy(ptable + 2, subf_data.buffer, 1664:config.c **** /* skip length ^*/ subf_data.length); 1665:config.c **** if (hdr[i].id == 1) { 1666:config.c **** /* fixup user callable address in case we overwrote it */ 1667:config.c **** ((struct CountrySpecificInfo *)ptable)->CharMapFn = CharMapFn; 1668:config.c **** } 1669:config.c **** } 1670:config.c **** } 1671:config.c **** rc = TRUE; 1672:config.c **** goto ret; 1673:config.c **** } 1674:config.c **** printf("could not find country info for country ID %u\n", ctryCode); 1675:config.c **** ret: 1676:config.c **** close(fd); 1677:config.c **** return rc; 1678:config.c **** } 1679:config.c **** 1680:config.c **** STATIC VOID Country(BYTE * pLine) 1681:config.c **** { 1682:config.c **** /* Format: COUNTRY = countryCode, [codePage], filename */ 1683:config.c **** COUNT ctryCode; 1684:config.c **** COUNT codePage = 0; 1685:config.c **** char *filename = NULL; 1686:config.c **** 1687:config.c **** if ((pLine = GetNumArg(pLine, &ctryCode)) == 0) 1688:config.c **** goto error; 1689:config.c **** 1690:config.c **** pLine = skipwh(pLine); 1691:config.c **** if (*pLine == ',') 1692:config.c **** { 1693:config.c **** pLine = skipwh(pLine + 1); 1694:config.c **** 1695:config.c **** if (*pLine != ',') 1696:config.c **** if ((pLine = GetNumArg(pLine, &codePage)) == 0) 1697:config.c **** goto error; 1698:config.c **** 1699:config.c **** pLine = skipwh(pLine); 1700:config.c **** if (*pLine == ',') 1701:config.c **** { 1702:config.c **** GetStringArg(++pLine, szBuf); 1703:config.c **** filename = szBuf; 1704:config.c **** } 1705:config.c **** } 1706:config.c **** 1707:config.c **** if (LoadCountryInfo(filename, ctryCode, codePage)) 1708:config.c **** return; 1709:config.c **** 1710:config.c **** error: 1711:config.c **** CfgFailure(pLine); 1712:config.c **** } 1713:config.c **** 1714:config.c **** STATIC VOID Stacks(BYTE * pLine) 1715:config.c **** { 1716:config.c **** COUNT stacks; 1717:config.c **** 1718:config.c **** /* Format: STACKS = stacks [, stackSize] */ 1719:config.c **** pLine = GetNumArg(pLine, &stacks); 1720:config.c **** Config.cfgStacks = stacks; 1721:config.c **** 1722:config.c **** pLine = skipwh(pLine); 1723:config.c **** 1724:config.c **** if (*pLine == ',') 1725:config.c **** { 1726:config.c **** GetNumArg(++pLine, &stacks); 1727:config.c **** Config.cfgStackSize = stacks; 1728:config.c **** } 1729:config.c **** 1730:config.c **** if (Config.cfgStacks) 1731:config.c **** { 1732:config.c **** if (Config.cfgStackSize < 32) 1733:config.c **** Config.cfgStackSize = 32; 1734:config.c **** if (Config.cfgStackSize > 512) 1735:config.c **** Config.cfgStackSize = 512; 1736:config.c **** if (Config.cfgStacks > 64) 1737:config.c **** Config.cfgStacks = 64; 1738:config.c **** } 1739:config.c **** Config.cfgStacksHigh = 0; 1740:config.c **** } 1741:config.c **** 1742:config.c **** STATIC VOID StacksHigh(BYTE * pLine) 1743:config.c **** { 1744:config.c **** Stacks(pLine); 1745:config.c **** Config.cfgStacksHigh = 1; 1746:config.c **** } 1747:config.c **** 1748:config.c **** STATIC VOID InitPgmHigh(BYTE * pLine) 1749:config.c **** { 1750:config.c **** InitPgm(pLine); 1751:config.c **** Config.cfgP_0_startmode = 0x80; 1752:config.c **** } 1753:config.c **** 1754:config.c **** STATIC VOID InitPgm(BYTE * pLine) 1755:config.c **** { 1756:config.c **** static char init[NAMEMAX]; 1757:config.c **** static char inittail[NAMEMAX]; 1758:config.c **** 1759:config.c **** Config.cfgInit = init; 1760:config.c **** Config.cfgInitTail = inittail; 1761:config.c **** 1762:config.c **** /* Get the string argument that represents the new init pgm */ 1763:config.c **** pLine = GetStringArg(pLine, Config.cfgInit); 1764:config.c **** 1765:config.c **** /* Now take whatever tail is left and add it on as a single */ 1766:config.c **** /* string. */ 1767:config.c **** strcpy(Config.cfgInitTail, pLine); 1768:config.c **** 1769:config.c **** /* and add a DOS new line just to be safe */ 1770:config.c **** strcat(Config.cfgInitTail, "\r\n"); 1771:config.c **** 1772:config.c **** Config.cfgP_0_startmode = 0; 1773:config.c **** } 1774:config.c **** 1775:config.c **** STATIC VOID CfgBreak(BYTE * pLine) 1776:config.c **** { 1777:config.c **** /* Format: BREAK = (ON | OFF) */ 1778:config.c **** GetStringArg(pLine, szBuf); 1779:config.c **** break_ena = strcaseequal(szBuf, "OFF") ? 0 : 1; 1780:config.c **** } 1781:config.c **** 1782:config.c **** STATIC VOID Numlock(BYTE * pLine) 1783:config.c **** { 1784:config.c **** /* Format: NUMLOCK = (ON | OFF) */ 1785:config.c **** BYTE FAR *keyflags = (BYTE FAR *) MK_FP(0x40, 0x17); 1786:config.c **** 1787:config.c **** GetStringArg(pLine, szBuf); 1788:config.c **** 1789:config.c **** *keyflags &= ~32; 1790:config.c **** if (!strcaseequal(szBuf, "OFF")) *keyflags |= 32; 1791:config.c **** keycheck(); 1792:config.c **** } 1793:config.c **** 1794:config.c **** STATIC VOID DeviceHigh(BYTE * pLine) 1795:config.c **** { 1796:config.c **** if (UmbState == 1) 1797:config.c **** { 1798:config.c **** if (LoadDevice(pLine, MK_FP(umb_start + UMB_top, 0), TRUE) == DE_NOMEM) 1799:config.c **** { 1800:config.c **** printf("Not enough free memory in UMBs: loading low\n"); 1801:config.c **** LoadDevice(pLine, lpTop, FALSE); 1802:config.c **** } 1803:config.c **** } 1804:config.c **** else 1805:config.c **** { 1806:config.c **** printf("UMBs unavailable!\n"); 1807:config.c **** LoadDevice(pLine, lpTop, FALSE); 1808:config.c **** } 1809:config.c **** } 1810:config.c **** 1811:config.c **** STATIC void Device(BYTE * pLine) 1812:config.c **** { 1813:config.c **** LoadDevice(pLine, lpTop, FALSE); 1814:config.c **** } 1815:config.c **** 1816:config.c **** STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode) 1817:config.c **** { 1818:config.c **** exec_blk eb; 1819:config.c **** struct dhdr FAR *dhp; 1820:config.c **** struct dhdr FAR *next_dhp; 1821:config.c **** BOOL result; 1822:config.c **** seg base, start; 1823:config.c **** 1824:config.c **** if (mode) 1825:config.c **** { 1826:config.c **** base = umb_base_seg; 1827:config.c **** start = umb_start; 1828:config.c **** } 1829:config.c **** else 1830:config.c **** { 1831:config.c **** base = base_seg; 1832:config.c **** start = LoL->first_mcb; 1833:config.c **** } 1834:config.c **** 1835:config.c **** if (base == start) 1836:config.c **** base++; 1837:config.c **** base++; 1838:config.c **** 1839:config.c **** /* Get the device driver name */ 1840:config.c **** GetStringArg(pLine, szBuf); 1841:config.c **** 1842:config.c **** /* The driver is loaded at the top of allocated memory. */ 1843:config.c **** /* The device driver is paragraph aligned. */ 1844:config.c **** eb.load.reloc = eb.load.load_seg = base; 1845:config.c **** 1846:config.c **** CfgDbgPrintf(("Loading device driver %s at segment %04x\n", szBuf, base)); 1847:config.c **** 1848:config.c **** if ((result = init_DosExec(3, &eb, szBuf)) != SUCCESS) 1849:config.c **** { 1850:config.c **** CfgFailure(pLine); 1851:config.c **** return result; 1852:config.c **** } 1853:config.c **** 1854:config.c **** strcpy(szBuf, pLine); 1855:config.c **** /* uppercase the device driver command */ 1856:config.c **** strupr(szBuf); 1857:config.c **** 1858:config.c **** /* TE this fixes the loading of devices drivers with 1859:config.c **** multiple devices in it. NUMEGA's SoftIce is such a beast 1860:config.c **** */ 1861:config.c **** 1862:config.c **** /* add \r\n to the command line */ 1863:config.c **** strcat(szBuf, " \r\n"); 1864:config.c **** 1865:config.c **** dhp = MK_FP(base, 0); 1866:config.c **** 1867:config.c **** /* NOTE - Modification for multisegmented device drivers: */ 1868:config.c **** /* In order to emulate the functionallity experienced with other */ 1869:config.c **** /* DOS operating systems, the original 'top' end address is */ 1870:config.c **** /* updated with the end address returned from the INIT request. */ 1871:config.c **** /* The updated end address is then used when issuing the next */ 1872:config.c **** /* INIT request for the following device driver within the file */ 1873:config.c **** 1874:config.c **** for (next_dhp = NULL; FP_OFF(next_dhp) != 0xffff && 1875:config.c **** (result = init_device(dhp, szBuf, mode, &top)) == SUCCESS; 1876:config.c **** dhp = next_dhp) 1877:config.c **** { 1878:config.c **** next_dhp = MK_FP(FP_SEG(dhp), FP_OFF(dhp->dh_next)); 1879:config.c **** /* Link in device driver and save LoL->nul_dev pointer to next */ 1880:config.c **** dhp->dh_next = LoL->nul_dev.dh_next; 1881:config.c **** LoL->nul_dev.dh_next = dhp; 1882:config.c **** } 1883:config.c **** 1884:config.c **** /* might have been the UMB driver or DOS=UMB */ 1885:config.c **** if (UmbState == 2) 1886:config.c **** umb_init(); 1887:config.c **** 1888:config.c **** return result; 1889:config.c **** } 1890:config.c **** 1891:config.c **** STATIC VOID CfgFailure(BYTE * pLine) 1892:config.c **** { 1893:config.c **** BYTE *pTmp = pLineStart; 1894:config.c **** 1895:config.c **** /* suppress multiple printing of same unrecognized lines */ 1896:config.c **** 1897:config.c **** if (nCfgLine < sizeof(ErrorAlreadyPrinted)*8) 1898:config.c **** { 1899:config.c **** if (ErrorAlreadyPrinted[nCfgLine/8] & (1 << (nCfgLine%8))) 1900:config.c **** return; 1901:config.c **** 1902:config.c **** ErrorAlreadyPrinted[nCfgLine/8] |= (1 << (nCfgLine%8)); 1903:config.c **** } 1904:config.c **** printf("CONFIG.SYS error in line %d\n", nCfgLine); 1905:config.c **** printf(">>>%s\n ", pTmp); 1906:config.c **** while (++pTmp != pLine) 1907:config.c **** printf(" "); 1908:config.c **** printf("^\n"); 1909:config.c **** } 1910:config.c **** 1911:config.c **** struct submcb 1912:config.c **** { 1913:config.c **** char type; 1914:config.c **** unsigned short start; 1915:config.c **** unsigned short size; 1916:config.c **** char unused[3]; 1917:config.c **** char name[8]; 1918:config.c **** }; 1919:config.c **** 1920:config.c **** void FAR * KernelAllocPara(size_t nPara, char type, char *name, int mode) 1921:config.c **** { 1922:config.c **** seg base, start; 1923:config.c **** struct submcb FAR *p; 1924:config.c **** 1925:config.c **** /* if no umb available force low allocation */ 1926:config.c **** if (UmbState != 1) 1927:config.c **** mode = 0; 1928:config.c **** 1929:config.c **** if (mode) 1930:config.c **** { 1931:config.c **** base = umb_base_seg; 1932:config.c **** start = umb_start; 1933:config.c **** } 1934:config.c **** else 1935:config.c **** { 1936:config.c **** base = base_seg; 1937:config.c **** start = LoL->first_mcb; 1938:config.c **** } 1939:config.c **** 1940:config.c **** /* create the special DOS data MCB if it doesn't exist yet */ 1941:config.c **** CfgDbgPrintf(("kernelallocpara: %x %x %x %c %d\n", start, base, nPara, type, mode)); 1942:config.c **** 1943:config.c **** if (base == start) 1944:config.c **** { 1945:config.c **** mcb FAR *p = para2far(base); 1946:config.c **** base++; 1947:config.c **** mcb_init(base, p->m_size - 1, p->m_type); 1948:config.c **** mumcb_init(FP_SEG(p), 0); 1949:config.c **** p->m_name[1] = 'D'; 1950:config.c **** } 1951:config.c **** 1952:config.c **** nPara++; 1953:config.c **** mcb_init(base + nPara, para2far(base)->m_size - nPara, para2far(base)->m_type); 1954:config.c **** para2far(start)->m_size += nPara; 1955:config.c **** 1956:config.c **** p = (struct submcb FAR *)para2far(base); 1957:config.c **** p->type = type; 1958:config.c **** p->start = FP_SEG(p)+1; 1959:config.c **** p->size = nPara-1; 1960:config.c **** if (name) 1961:config.c **** fmemcpy(p->name, name, 8); 1962:config.c **** base += nPara; 1963:config.c **** if (mode) 1964:config.c **** umb_base_seg = base; 1965:config.c **** else 1966:config.c **** base_seg = base; 1967:config.c **** return MK_FP(FP_SEG(p)+1, 0); 1968:config.c **** } 1969:config.c **** 1970:config.c **** void FAR * KernelAlloc(size_t nBytes, char type, int mode) 1971:config.c **** { 1972:config.c **** void FAR *p; 1973:config.c **** size_t nPara = (nBytes + 15)/16; 1974:config.c **** 1975:config.c **** if (LoL->first_mcb == 0) 1976:config.c **** { 1977:config.c **** /* prealloc */ 1978:config.c **** lpTop = MK_FP(FP_SEG(lpTop) - nPara, FP_OFF(lpTop)); 1979:config.c **** p = AlignParagraph(lpTop); 1980:config.c **** } 1981:config.c **** else 1982:config.c **** { 1983:config.c **** p = KernelAllocPara(nPara, type, NULL, mode); 1984:config.c **** } 1985:config.c **** fmemset(p, 0, nBytes); 1986:config.c **** return p; 1987:config.c **** } 1988:config.c **** 1989:config.c **** #ifdef I86 1990:config.c **** #if 0 1991:config.c **** STATIC BYTE FAR * KernelAllocDma(WORD bytes, char type) 1992:config.c **** { 1993:config.c **** if ((base_seg & 0x0fff) + (bytes >> 4) > 0x1000) { 1994:config.c **** KernelAllocPara((base_seg + 0x0fff) & 0xf000 - base_seg, type, NULL, 0); 1995:config.c **** } 1996:config.c **** return KernelAlloc(bytes, type); 1997:config.c **** } 1998:config.c **** #endif 1999:config.c **** 2000:config.c **** STATIC void FAR * AlignParagraph(VOID FAR * lpPtr) 2001:config.c **** { 2002:config.c **** UWORD uSegVal; 2003:config.c **** 2004:config.c **** /* First, convert the segmented pointer to linear address */ 2005:config.c **** uSegVal = FP_SEG(lpPtr); 2006:config.c **** uSegVal += (FP_OFF(lpPtr) + 0xf) >> 4; 2007:config.c **** if (FP_OFF(lpPtr) > 0xfff0) 2008:config.c **** uSegVal += 0x1000; /* handle overflow */ 2009:config.c **** 2010:config.c **** /* and return an adddress adjusted to the nearest paragraph */ 2011:config.c **** /* boundary. */ 2012:config.c **** return MK_FP(uSegVal, 0); 2013:config.c **** } 2014:config.c **** #endif 2015:config.c **** 2016:config.c **** STATIC int iswh(unsigned char c) 2017:config.c **** { 2018:config.c **** return (c == '\r' || c == '\n' || c == '\t' || c == ' '); 2019:config.c **** } 2020:config.c **** 2021:config.c **** STATIC BYTE * skipwh(BYTE * s) 2022:config.c **** { 2023:config.c **** while (iswh(*s)) 2024:config.c **** ++s; 2025:config.c **** return s; 2026:config.c **** } 2027:config.c **** 2028:config.c **** STATIC BYTE * scan(BYTE * s, BYTE * d, int fMenuSelect) 2029:config.c **** { 2030:config.c **** askThisSingleCommand = FALSE; 2031:config.c **** DontAskThisSingleCommand = FALSE; 2032:config.c **** 2033:config.c **** s = skipwh(s); 2034:config.c **** 2035:config.c **** MenuLine = 0; 2036:config.c **** 2037:config.c **** /* only check at beginning of line, ie when looking for 2038:config.c **** menu selection line applies to. Fixes issue where 2039:config.c **** value after = starts with number, eg shell=4dos */ 2040:config.c **** /* does the line start with "123?" */ 2041:config.c **** 2042:config.c **** if (fMenuSelect && isnum(*s)) 2043:config.c **** { 2044:config.c **** unsigned numbers = 0; 2045:config.c **** for ( ; isnum(*s); s++) 2046:config.c **** numbers |= 1 << (*s -'0'); 2047:config.c **** 2048:config.c **** if (*s == '?') 2049:config.c **** { 2050:config.c **** MenuLine = numbers; 2051:config.c **** Menus |= numbers; 2052:config.c **** s = skipwh(s+1); 2053:config.c **** } 2054:config.c **** } 2055:config.c **** 2056:config.c **** 2057:config.c **** /* !dos=high,umb ?? */ 2058:config.c **** if (*s == '!') 2059:config.c **** { 2060:config.c **** DontAskThisSingleCommand = TRUE; 2061:config.c **** s = skipwh(s+1); 2062:config.c **** } 2063:config.c **** 2064:config.c **** if (*s == ';') 2065:config.c **** { 2066:config.c **** /* semicolon is a synonym for rem */ 2067:config.c **** *d++ = *s++; 2068:config.c **** } 2069:config.c **** else 2070:config.c **** while (*s && !iswh(*s) && *s != '=') 2071:config.c **** { 2072:config.c **** if (*s == '?') 2073:config.c **** askThisSingleCommand = TRUE; 2074:config.c **** else 2075:config.c **** *d++ = *s; 2076:config.c **** s++; 2077:config.c **** } 2078:config.c **** *d = '\0'; 2079:config.c **** return s; 2080:config.c **** } 2081:config.c **** 2082:config.c **** STATIC BOOL isnum(char ch) 2083:config.c **** { 2084:config.c **** return (ch >= '0' && ch <= '9'); 2085:config.c **** } 2086:config.c **** 2087:config.c **** /* Yet another change for true portability (PJV) */ 2088:config.c **** STATIC char toupper(char c) 2089:config.c **** { 2090:config.c **** if (c >= 'a' && c <= 'z') 2091:config.c **** c -= 'a' - 'A'; 2092:config.c **** return c; 2093:config.c **** } 2094:config.c **** 2095:config.c **** /* Convert string s to uppercase */ 2096:config.c **** STATIC VOID strupr(char *s) 2097:config.c **** { 2098:config.c **** while (*s) { 2099:config.c **** *s = toupper(*s); 2100:config.c **** s++; 2101:config.c **** } 2102:config.c **** } 2103:config.c **** 2104:config.c **** /* The following code is 8086 dependant */ 2105:config.c **** 2106:config.c **** #if 1 /* ifdef KERNEL */ 2107:config.c **** STATIC VOID mcb_init_copy(UCOUNT seg, UWORD size, mcb *near_mcb) 2108:config.c **** { 2109:config.c **** near_mcb->m_size = size; 2110:config.c **** fmemcpy(MK_FP(seg, 0), near_mcb, sizeof(mcb)); 2111:config.c **** } 2112:config.c **** 2113:config.c **** STATIC VOID mcb_init(UCOUNT seg, UWORD size, BYTE type) 2114:config.c **** { 2115:config.c **** static mcb near_mcb BSS_INIT({0}); 2116:config.c **** near_mcb.m_type = type; 2117:config.c **** mcb_init_copy(seg, size, &near_mcb); 2118:config.c **** } 2119:config.c **** 2120:config.c **** STATIC VOID mumcb_init(UCOUNT seg, UWORD size) 2121:config.c **** { 2122:config.c **** static mcb near_mcb = { 2123:config.c **** MCB_NORMAL, 2124:config.c **** 8, 0, 2125:config.c **** {0,0,0}, 2126:config.c **** {"SC"} 2127:config.c **** }; 2128:config.c **** mcb_init_copy(seg, size, &near_mcb); 2129:config.c **** } 2130:config.c **** #endif 2131:config.c **** 2132:config.c **** char *strcat(register char * d, register const char * s) 2133:config.c **** { 2134:config.c **** strcpy(d + strlen(d), s); 2135:config.c **** return d; 2136:config.c **** } 2137:config.c **** 2138:config.c **** /* compare two ASCII strings ignoring case */ 2139:config.c **** STATIC char strcaseequal(const char * d, const char * s) 2140:config.c **** { 2141:config.c **** char ch; 2142:config.c **** while ((ch = toupper(*s++)) == toupper(*d++)) 2143:config.c **** if (ch == '\0') 2144:config.c **** return 1; 2145:config.c **** return 0; 2146:config.c **** } 2147:config.c **** 2148:config.c **** /* 2149:config.c **** moved from BLOCKIO.C here. 2150:config.c **** that saves some relocation problems 2151:config.c **** */ 2152:config.c **** 2153:config.c **** STATIC void config_init_buffers(int wantedbuffers) 2154:config.c **** { 2155:config.c **** struct buffer FAR *pbuffer; 2156:config.c **** unsigned buffers = 0; 2157:config.c **** 2158:config.c **** /* fill HMA with buffers if BUFFERS count >=0 and DOS in HMA */ 2159:config.c **** if (wantedbuffers < 0) 2160:config.c **** wantedbuffers = -wantedbuffers; 2161:config.c **** else if (HMAState == HMA_DONE) 2162:config.c **** buffers = (0xfff0 - HMAFree) / sizeof(struct buffer); 2163:config.c **** 2164:config.c **** if (wantedbuffers < 6) /* min 6 buffers */ 2165:config.c **** wantedbuffers = 6; 2166:config.c **** if (wantedbuffers > 99) /* max 99 buffers */ 2167:config.c **** { 2168:config.c **** printf("BUFFERS=%u not supported, reducing to 99\n", wantedbuffers); 2169:config.c **** wantedbuffers = 99; 2170:config.c **** } 2171:config.c **** if (wantedbuffers > buffers) /* more specified than available -> get em */ 2172:config.c **** buffers = wantedbuffers; 2173:config.c **** 2174:config.c **** LoL->nbuffers = buffers; 2175:config.c **** LoL->inforecptr = &LoL->firstbuf; 2176:config.c **** { 2177:config.c **** size_t bytes = sizeof(struct buffer) * buffers; 2178:config.c **** pbuffer = HMAalloc(bytes); 2179:config.c **** 2180:config.c **** if (pbuffer == NULL) 2181:config.c **** { 2182:config.c **** pbuffer = KernelAlloc(bytes, 'B', 0); 2183:config.c **** if (HMAState == HMA_DONE) 2184:config.c **** firstAvailableBuf = MK_FP(0xffff, HMAFree); 2185:config.c **** } 2186:config.c **** else 2187:config.c **** { 2188:config.c **** LoL->bufloc = LOC_HMA; 2189:config.c **** /* space in HMA beyond requested buffers available as user space */ 2190:config.c **** firstAvailableBuf = pbuffer + wantedbuffers; 2191:config.c **** } 2192:config.c **** } 2193:config.c **** LoL->deblock_buf = DiskTransferBuffer; 2194:config.c **** LoL->firstbuf = pbuffer; 2195:config.c **** 2196:config.c **** CfgDbgPrintf(("init_buffers (size %u) at", sizeof(struct buffer))); 2197:config.c **** CfgDbgPrintf((" (%p)", LoL->firstbuf)); 2198:config.c **** 2199:config.c **** buffers--; 2200:config.c **** pbuffer->b_prev = FP_OFF(pbuffer + buffers); 2201:config.c **** { 2202:config.c **** int i = buffers; 2203:config.c **** do 2204:config.c **** { 2205:config.c **** pbuffer->b_next = FP_OFF(pbuffer + 1); 2206:config.c **** pbuffer++; 2207:config.c **** pbuffer->b_prev = FP_OFF(pbuffer - 1); 2208:config.c **** } 2209:config.c **** while (--i); 2210:config.c **** } 2211:config.c **** pbuffer->b_next = FP_OFF(pbuffer - buffers); 2212:config.c **** 2213:config.c **** /* now, we can have quite some buffers in HMA 2214:config.c **** -- up to 50 for KE38616. 2215:config.c **** so we fill the HMA with buffers 2216:config.c **** but not if the BUFFERS count is negative ;-) 2217:config.c **** */ 2218:config.c **** 2219:config.c **** CfgDbgPrintf((" done\n")); 2220:config.c **** 2221:config.c **** if (FP_SEG(pbuffer) == 0xffff) 2222:config.c **** { 2223:config.c **** buffers++; 2224:config.c **** if (InitKernelConfig.Verbose >= 0) 2225:config.c **** { 2226:config.c **** printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n", 2227:config.c **** buffers, buffers * sizeof(struct buffer)); 2228:config.c **** } 2229:config.c **** } 2230:config.c **** } 2231:config.c **** 2232:config.c **** /* 2233:config.c **** Undocumented feature: ANYDOS 2234:config.c **** will report to MSDOS programs just the version number 2235:config.c **** they expect. be careful with it! 2236:config.c **** */ 2237:config.c **** STATIC VOID SetAnyDos(BYTE * pLine) 2238:config.c **** { 11 .loc 1 2238 0 12 _.LVL0: 2239:config.c **** UNREFERENCED_PARAMETER(pLine); 2240:config.c **** ReturnAnyDosVersionExpected = TRUE; 13 .loc 1 2240 0 0 00000EC3 B8[0000] mov ax, offset _ReturnAnyDosVersionExpected@OZSEG16 0 00000EC6 8EC0 mov es, ax 0 00000EC8 26C606[0000]01 mov byte ptr es:[_ReturnAnyDosVersionExpected], 1 17 _.LVL1: 2241:config.c **** } 18 .loc 1 2241 0 0 00000ECE C20200 ret 2 20 _.LFE62: 21 .size _SetAnyDos, .-_SetAnyDos 22 .type _CfgIgnore, @function 23 _CfgIgnore: 24 _.LFB64: 2242:config.c **** 2243:config.c **** /* 2244:config.c **** Kernel built-in energy saving: IDLEHALT=haltlevel 2245:config.c **** -1 max savings, 0 never HLT, 1 safe kernel only HLT, 2246:config.c **** 2 (3) also hooks int2f.1680 (and sets al=0) 2247:config.c **** */ 2248:config.c **** STATIC VOID SetIdleHalt(BYTE * pLine) 2249:config.c **** { 2250:config.c **** COUNT haltlevel; 2251:config.c **** if (GetNumArg(pLine, &haltlevel)) 2252:config.c **** HaltCpuWhileIdle = haltlevel; /* 0 for no HLT, 1..n more, -1 max */ 2253:config.c **** } 2254:config.c **** 2255:config.c **** STATIC VOID CfgIgnore(BYTE * pLine) 2256:config.c **** { 25 .loc 1 2256 0 26 _.LVL2: 2257:config.c **** UNREFERENCED_PARAMETER(pLine); 2258:config.c **** } 27 .loc 1 2258 0 0 00000ED1 C20200 ret 2 29 _.LFE64: 30 .size _CfgIgnore, .-_CfgIgnore === Switch to base=012BB0h -> ".RODATA.STR1.1" 31 .section .rodata.str1.1,"aMS",@progbits,1 32 _.LC0: 0 00000750 25730A00 .string "%s\n" === Switch to base=002270h -> ".TEXT" 34 .text 35 .type _CfgMenuEsc, @function 36 _CfgMenuEsc: 37 _.LFB66: 2259:config.c **** 2260:config.c **** /* 2261:config.c **** 'MENU'ing stuff 2262:config.c **** although it's worse then MSDOS's , its better then nothing 2263:config.c **** */ 2264:config.c **** 2265:config.c **** STATIC void ClearScreen(unsigned char attr); 2266:config.c **** STATIC VOID CfgMenu(BYTE * pLine) 2267:config.c **** { 2268:config.c **** int nLen; 2269:config.c **** BYTE *pNumber = pLine; 2270:config.c **** 2271:config.c **** printf("%s\n",pLine); 2272:config.c **** if (MenuColor == -1) 2273:config.c **** return; 2274:config.c **** 2275:config.c **** pLine = skipwh(pLine); 2276:config.c **** 2277:config.c **** /* skip drawing characters in cp437, which is what we'll have 2278:config.c **** just after booting! */ 2279:config.c **** while ((unsigned char)*pLine >= 0xb0 && (unsigned char)*pLine < 0xe0) 2280:config.c **** pLine++; 2281:config.c **** 2282:config.c **** pLine = skipwh(pLine); /* skip more whitespaces... */ 2283:config.c **** 2284:config.c **** /* now I'm expecting a number here if this is a menu-choice line. */ 2285:config.c **** if (isnum(pLine[0])) 2286:config.c **** { 2287:config.c **** struct MenuSelector *menu = &MenuStruct[pLine[0]-'0']; 2288:config.c **** 2289:config.c **** menu->x = (pLine-pNumber); /* xpos is at start of number */ 2290:config.c **** menu->y = nMenuLine; 2291:config.c **** /* copy menu text: */ 2292:config.c **** nLen = findend(pLine); /* length is until cr/lf, null or three spaces */ 2293:config.c **** 2294:config.c **** /* max 40 chars including nullterminator 2295:config.c **** (change struct at top of file if you want more...) */ 2296:config.c **** if (nLen > MENULINEMAX-1) 2297:config.c **** nLen = MENULINEMAX-1; 2298:config.c **** memcpy(menu->Text, pLine, nLen); 2299:config.c **** menu->Text[nLen] = 0; /* nullTerminate */ 2300:config.c **** } 2301:config.c **** nMenuLine++; 2302:config.c **** } 2303:config.c **** 2304:config.c **** STATIC VOID CfgMenuEsc(BYTE * pLine) 2305:config.c **** { 38 .loc 1 2305 0 39 _.LVL3: 0 00000ED4 55 push bp 41 _.LCFI0: 0 00000ED5 89E5 mov bp, sp 43 _.LCFI1: 0 00000ED7 8B4604 mov ax, word ptr [bp+4] 45 _.LVL4: 2306:config.c **** BYTE * check; 2307:config.c **** for (check = pLine; check[0]; check++) 46 .loc 1 2307 0 0 00000EDA 89C3 mov bx, ax 48 _.LVL5: 49 _.L6: 50 .loc 1 2307 0 is_stmt 0 discriminator 1 0 00000EDC 8A17 mov dl, byte ptr [bx] 0 00000EDE 84D2 test dl, dl 0 00000EE0 750E jne _.L8 2308:config.c **** if (check[0] == '$') check[0] = 27; /* translate $ to ESC */ 2309:config.c **** printf("%s\n",pLine); 54 .loc 1 2309 0 is_stmt 1 0 00000EE2 50 push ax 0 00000EE3 B8[0000] mov ax, offset _.LC0 57 _.LVL6: 0 00000EE6 50 push ax 0 00000EE7 E8[FEFF] call _init_printf 60 _.LVL7: 2310:config.c **** } 61 .loc 1 2310 0 0 00000EEA 89EC mov sp, bp 0 00000EEC 5D pop bp 0 00000EED C20200 ret 2 65 _.LVL8: 66 _.L8: 2308:config.c **** if (check[0] == '$') check[0] = 27; /* translate $ to ESC */ 67 .loc 1 2308 0 0 00000EF0 80FA24 cmp dl, 36 0 00000EF3 7503 jne _.L7 2308:config.c **** if (check[0] == '$') check[0] = 27; /* translate $ to ESC */ 70 .loc 1 2308 0 is_stmt 0 discriminator 1 0 00000EF5 C6071B mov byte ptr [bx], 27 72 _.L7: 2307:config.c **** if (check[0] == '$') check[0] = 27; /* translate $ to ESC */ 73 .loc 1 2307 0 is_stmt 1 discriminator 2 0 00000EF8 43 inc bx 75 _.LVL9: 0 00000EF9 EBE1 jmp _.L6 77 _.LFE66: 78 .size _CfgMenuEsc, .-_CfgMenuEsc === Switch to base=012BB0h -> ".RODATA.STR1.1" 79 .section .rodata.str1.1 80 _.LC1: 0 00000754 434F4E4649472E53 .string "CONFIG.SYS error in line %d\n" 0 0000075C 5953206572726F72 0 00000764 20696E206C696E65 0 0000076C 2025640A00 82 _.LC2: 0 00000771 3E3E3E25730A2020 .string ">>>%s\n " 0 00000779 2000 84 _.LC3: 0 0000077B 2000 .string " " 86 _.LC4: 0 0000077D 5E0A00 .string "^\n" === Switch to base=002270h -> ".TEXT" 88 .text 89 .type _CfgFailure, @function 90 _CfgFailure: 91 _.LFB46: 1892:config.c **** BYTE *pTmp = pLineStart; 92 .loc 1 1892 0 93 _.LVL10: 0 00000EFB 56 push si 0 00000EFC 57 push di 0 00000EFD 55 push bp 97 _.LCFI2: 0 00000EFE 89E5 mov bp, sp 99 _.LCFI3: 1893:config.c **** 100 .loc 1 1893 0 0 00000F00 8B36[0000] mov si, word ptr [_pLineStart] 102 _.LVL11: 1897:config.c **** { 103 .loc 1 1897 0 0 00000F04 8B16[380A] mov dx, word ptr [_nCfgLine] 0 00000F08 81FAFF03 cmp dx, 1023 0 00000F0C 7723 ja _.L11 1899:config.c **** return; 107 .loc 1 1899 0 0 00000F0E 89D3 mov bx, dx 0 00000F10 B103 mov cl, 3 0 00000F12 D3EB shr bx, cl 0 00000F14 BF[3E0A] mov di, offset _ErrorAlreadyPrinted 0 00000F17 8A29 mov ch, byte ptr [bx+di] 0 00000F19 88E8 mov al, ch 0 00000F1B 30E4 xor ah, ah 0 00000F1D 88D1 mov cl, dl 0 00000F1F 80E107 and cl, 7 0 00000F22 D3F8 sar ax, cl 0 00000F24 A801 test al, 1 0 00000F26 752C jne _.L10 1902:config.c **** } 120 .loc 1 1902 0 0 00000F28 B80100 mov ax, 1 0 00000F2B D3E0 shl ax, cl 0 00000F2D 08E8 or al, ch 0 00000F2F 8801 mov byte ptr [bx+di], al 125 _.L11: 1904:config.c **** printf(">>>%s\n ", pTmp); 126 .loc 1 1904 0 0 00000F31 52 push dx 0 00000F32 B8[0400] mov ax, offset _.LC1 0 00000F35 50 push ax 0 00000F36 E8[FEFF] call _init_printf 131 _.LVL12: 1905:config.c **** while (++pTmp != pLine) 132 .loc 1 1905 0 0 00000F39 56 push si 0 00000F3A B8[2100] mov ax, offset _.LC2 0 00000F3D 50 push ax 0 00000F3E E8[FEFF] call _init_printf 137 _.LVL13: 1906:config.c **** printf(" "); 138 .loc 1 1906 0 0 00000F41 83C408 add sp, 8 140 _.L13: 0 00000F44 46 inc si 142 _.LVL14: 0 00000F45 3B7608 cmp si, word ptr [bp+8] 0 00000F48 7512 jne _.L14 1908:config.c **** } 145 .loc 1 1908 0 0 00000F4A B8[2D00] mov ax, offset _.LC4 0 00000F4D 50 push ax 0 00000F4E E8[FEFF] call _init_printf 149 _.LVL15: 0 00000F51 83C402 add sp, 2 151 _.L10: 1909:config.c **** 152 .loc 1 1909 0 0 00000F54 89EC mov sp, bp 0 00000F56 5D pop bp 0 00000F57 5F pop di 0 00000F58 5E pop si 157 _.LVL16: 0 00000F59 C20200 ret 2 159 _.LVL17: 160 _.L14: 1907:config.c **** printf("^\n"); 161 .loc 1 1907 0 0 00000F5C B8[2B00] mov ax, offset _.LC3 0 00000F5F 50 push ax 0 00000F60 E8[FEFF] call _init_printf 165 _.LVL18: 0 00000F63 83C402 add sp, 2 0 00000F66 EBDC jmp _.L13 168 _.LFE46: 169 .size _CfgFailure, .-_CfgFailure 170 .type _mcb_init, @function 171 _mcb_init: 172 _.LFB57: 2114:config.c **** static mcb near_mcb BSS_INIT({0}); 173 .loc 1 2114 0 174 _.LVL19: 0 00000F68 55 push bp 176 _.LCFI4: 0 00000F69 89E5 mov bp, sp 178 _.LCFI5: 2116:config.c **** mcb_init_copy(seg, size, &near_mcb); 179 .loc 1 2116 0 0 00000F6B BB[2808] mov bx, offset _near_mcb.2441 0 00000F6E 8A4608 mov al, byte ptr [bp+8] 0 00000F71 8807 mov byte ptr [bx], al 183 _.LVL20: 184 _.LBB26: 185 _.LBB27: 2109:config.c **** fmemcpy(MK_FP(seg, 0), near_mcb, sizeof(mcb)); 186 .loc 1 2109 0 0 00000F73 8B4606 mov ax, word ptr [bp+6] 0 00000F76 894703 mov word ptr [bx+3], ax 2110:config.c **** } 189 .loc 1 2110 0 0 00000F79 B81000 mov ax, 16 0 00000F7C 50 push ax 0 00000F7D 16 push ss 0 00000F7E 53 push bx 0 00000F7F FF7604 push word ptr [bp+4] 0 00000F82 31C0 xor ax, ax 0 00000F84 50 push ax 0 00000F85 E8[FEFF] call _init_fmemcpy 198 _.LVL21: 199 _.LBE27: 200 _.LBE26: 2118:config.c **** 201 .loc 1 2118 0 0 00000F88 89EC mov sp, bp 0 00000F8A 5D pop bp 0 00000F8B C20600 ret 6 205 _.LFE57: 206 .size _mcb_init, .-_mcb_init 207 .type _deletevar, @function 208 _deletevar: 209 _.LFB81: 2311:config.c **** 2312:config.c **** STATIC VOID DoMenu(void) 2313:config.c **** { 2314:config.c **** iregs r; 2315:config.c **** int key = -1; 2316:config.c **** if (Menus == 0) 2317:config.c **** return; 2318:config.c **** 2319:config.c **** InitKernelConfig.SkipConfigSeconds = -1; 2320:config.c **** 2321:config.c **** if (MenuColor == -1) 2322:config.c **** Menus |= 1 << 0; /* '0' Menu always allowed */ 2323:config.c **** 2324:config.c **** nMenuLine+=2; /* use this to position "select menu" text (ypos): */ 2325:config.c **** 2326:config.c **** for (;;) 2327:config.c **** { 2328:config.c **** int i, j; 2329:config.c **** 2330:config.c **** RestartInput: 2331:config.c **** 2332:config.c **** if (MenuColor != -1) 2333:config.c **** { 2334:config.c **** SelectLine(MenuSelected); /* select current line. */ 2335:config.c **** 2336:config.c **** /* set new cursor position: */ 2337:config.c **** r.a.b.h = 0x02; 2338:config.c **** r.b.b.h = 0; 2339:config.c **** r.d.b.l = 3; 2340:config.c **** r.d.b.h = nMenuLine; 2341:config.c **** 2342:config.c **** init_call_intr(0x10, &r); /* set cursor pos */ 2343:config.c **** } 2344:config.c **** 2345:config.c **** printf("Select from Menu ["); 2346:config.c **** 2347:config.c **** for (i = 0, j = 1; i <= 9; i++, j<<=1) 2348:config.c **** if (Menus & j) 2349:config.c **** printf("%c", '0' + i); 2350:config.c **** printf("], or press [ENTER]"); 2351:config.c **** 2352:config.c **** if (MenuColor != -1) 2353:config.c **** printf(" (Selection=%d) ", MenuSelected); 2354:config.c **** 2355:config.c **** if (MenuTimeout >= 0) 2356:config.c **** printf("- %d \b", MenuTimeout); 2357:config.c **** else 2358:config.c **** printf(" \b\b\b\b\b"); 2359:config.c **** 2360:config.c **** if (MenuColor != -1) 2361:config.c **** printf("\r\n\n "); 2362:config.c **** else 2363:config.c **** printf(" -"); 2364:config.c **** 2365:config.c **** printf(" Singlestepping (F8) is: %s \r", singleStep ? "ON " : "OFF"); 2366:config.c **** 2367:config.c **** key = GetBiosKey(MenuTimeout >= 0 ? 1 : -1); 2368:config.c **** 2369:config.c **** if (key == -1) /* timeout, take default */ 2370:config.c **** { 2371:config.c **** if (MenuTimeout > 0) 2372:config.c **** { 2373:config.c **** MenuTimeout--; 2374:config.c **** goto RestartInput; 2375:config.c **** } 2376:config.c **** break; 2377:config.c **** } 2378:config.c **** else 2379:config.c **** MenuTimeout = -1; 2380:config.c **** 2381:config.c **** if (key == 0x3f00) /* F5 */ 2382:config.c **** { 2383:config.c **** SkipAllConfig = TRUE; 2384:config.c **** break; 2385:config.c **** } 2386:config.c **** if (key == 0x4200) /* F8 */ 2387:config.c **** { 2388:config.c **** singleStep = !singleStep; 2389:config.c **** } 2390:config.c **** else if(key == 0x4800 && MenuColor != -1) /* arrow up */ 2391:config.c **** { 2392:config.c **** if(MenuSelected>=1 && (Menus & (1 << (MenuSelected-1))) ) 2393:config.c **** { 2394:config.c **** MenuSelected--; 2395:config.c **** } 2396:config.c **** } 2397:config.c **** else if(key == 0x5000 && MenuColor != -1) /* arrow down */ 2398:config.c **** { 2399:config.c **** if(MenuSelectedCountryID == ctryCode) 2555:config.c **** { 2556:config.c **** nlsCountryInfoHardcoded.C.CountryID = country->CountryID; 2557:config.c **** nlsCountryInfoHardcoded.C.DateFormat = country->DateFormat; 2558:config.c **** nlsCountryInfoHardcoded.C.CurrencyString[0] = country->CurrencyString[0]; 2559:config.c **** nlsCountryInfoHardcoded.C.CurrencyString[1] = country->CurrencyString[1]; 2560:config.c **** nlsCountryInfoHardcoded.C.CurrencyString[2] = country->CurrencyString[2]; 2561:config.c **** nlsCountryInfoHardcoded.C.ThousandSeparator[0] = country->ThousandSeparator; 2562:config.c **** nlsCountryInfoHardcoded.C.DecimalPoint[0] = country->DecimalPoint; 2563:config.c **** nlsCountryInfoHardcoded.C.DateSeparator[0] = country->DateSeparator; 2564:config.c **** nlsCountryInfoHardcoded.C.TimeSeparator[0] = country->TimeSeparator; 2565:config.c **** nlsCountryInfoHardcoded.C.CurrencyFormat = country->CurrencyFormat; 2566:config.c **** nlsCountryInfoHardcoded.C.CurrencyPrecision = country->CurrencyPrecision; 2567:config.c **** nlsCountryInfoHardcoded.C.TimeFormat = country->TimeFormat; 2568:config.c **** return 0; 2569:config.c **** } 2570:config.c **** } 2571:config.c **** 2572:config.c **** printf("could not find country info for country ID %u\n", ctryCode); 2573:config.c **** printf("current supported countries are "); 2574:config.c **** 2575:config.c **** for (country = specificCountriesSupported; 2576:config.c **** country < specificCountriesSupported + LENGTH(specificCountriesSupported); 2577:config.c **** country++) 2578:config.c **** { 2579:config.c **** printf("%u ", country->CountryID); 2580:config.c **** } 2581:config.c **** printf("\n"); 2582:config.c **** 2583:config.c **** return 1; 2584:config.c **** } 2585:config.c **** 2586:config.c **** 2587:config.c **** /* **************************************************************** 2588:config.c **** ** implementation of INSTALL=NANSI.COM /P /X /BLA 2589:config.c **** */ 2590:config.c **** 2591:config.c **** int numInstallCmds BSS_INIT(0); 2592:config.c **** struct instCmds { 2593:config.c **** char buffer[128]; 2594:config.c **** int mode; 2595:config.c **** } InstallCommands[10] BSS_INIT({0}); 2596:config.c **** 2597:config.c **** #ifdef DEBUG 2598:config.c **** #define InstallPrintf(x) printf x 2599:config.c **** #else 2600:config.c **** #define InstallPrintf(x) 2601:config.c **** #endif 2602:config.c **** 2603:config.c **** STATIC VOID _CmdInstall(BYTE * pLine,int mode) 2604:config.c **** { 2605:config.c **** struct instCmds *cmd; 2606:config.c **** 2607:config.c **** InstallPrintf(("Installcmd %d:%s\n",numInstallCmds,pLine)); 2608:config.c **** 2609:config.c **** if (numInstallCmds > LENGTH(InstallCommands)) 2610:config.c **** { 2611:config.c **** printf("Too many Install commands given (%d max)\n",LENGTH(InstallCommands)); 2612:config.c **** CfgFailure(pLine); 2613:config.c **** return; 2614:config.c **** } 2615:config.c **** cmd = &InstallCommands[numInstallCmds]; 2616:config.c **** memcpy(cmd->buffer,pLine,127); 2617:config.c **** cmd->buffer[127] = 0; 2618:config.c **** cmd->mode = mode; 2619:config.c **** numInstallCmds++; 2620:config.c **** } 2621:config.c **** STATIC VOID CmdInstall(BYTE * pLine) 2622:config.c **** { 2623:config.c **** _CmdInstall(pLine,0); 2624:config.c **** } 2625:config.c **** STATIC VOID CmdInstallHigh(BYTE * pLine) 2626:config.c **** { 2627:config.c **** _CmdInstall(pLine,0x80); /* load high, if possible */ 2628:config.c **** } 2629:config.c **** STATIC VOID CmdChain(BYTE * pLine) 2630:config.c **** { 2631:config.c **** struct CfgFile *cfg; 2632:config.c **** int fd; 2633:config.c **** 2634:config.c **** InstallPrintf(("CHAIN: %s\n", pLine)); 2635:config.c **** if (nCurChain >= MAX_CHAINS) { 2636:config.c **** CfgFailure(pLine); 2637:config.c **** return; 2638:config.c **** } 2639:config.c **** if ((fd = open(pLine, 0)) < 0) { 2640:config.c **** CfgFailure(pLine); 2641:config.c **** return; 2642:config.c **** } 2643:config.c **** cfg = &cfgFile[nCurChain++]; 2644:config.c **** cfg->nFileDesc = nFileDesc; 2645:config.c **** cfg->nCfgLine = nCfgLine; 2646:config.c **** nFileDesc = fd; 2647:config.c **** nCfgLine = 0; 2648:config.c **** } 2649:config.c **** 2650:config.c **** STATIC VOID InstallExec(struct instCmds *icmd) 2651:config.c **** { 2652:config.c **** BYTE filename[128], *args, *d, *cmd = icmd->buffer; 2653:config.c **** exec_blk exb; 2654:config.c **** 2655:config.c **** InstallPrintf(("installing %s\n",cmd)); 2656:config.c **** 2657:config.c **** cmd=skipwh(cmd); 2658:config.c **** 2659:config.c **** for (args = cmd, d = filename; ;args++,d++) 2660:config.c **** { 2661:config.c **** *d = *args; 2662:config.c **** if (*d <= 0x020 || *d == '/') 2663:config.c **** break; 2664:config.c **** } 2665:config.c **** *d = 0; 2666:config.c **** 2667:config.c **** args--; 2668:config.c **** *args = strlen(&args[1]); 2669:config.c **** args[*args+1] = '\r'; 2670:config.c **** args[*args+2] = 0; 2671:config.c **** 2672:config.c **** exb.exec.env_seg = 0; 2673:config.c **** exb.exec.cmd_line = (CommandTail FAR *) args; 2674:config.c **** exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *) 0xfffffffful; 2675:config.c **** 2676:config.c **** 2677:config.c **** InstallPrintf(("cmd[%s] args [%u,%s]\n",filename,*args,args+1)); 2678:config.c **** 2679:config.c **** if (init_DosExec(icmd->mode, &exb, filename) != SUCCESS) 2680:config.c **** { 2681:config.c **** CfgFailure(cmd); 2682:config.c **** } 2683:config.c **** } 2684:config.c **** 2685:config.c **** STATIC void free(seg segment) 2686:config.c **** { 2687:config.c **** iregs r; 2688:config.c **** 2689:config.c **** r.a.b.h = 0x49; /* free memory */ 2690:config.c **** r.es = segment; 2691:config.c **** init_call_intr(0x21, &r); 2692:config.c **** } 2693:config.c **** 2694:config.c **** /* set memory allocation strategy */ 2695:config.c **** STATIC void set_strategy(unsigned char strat) 2696:config.c **** { 2697:config.c **** iregs r; 2698:config.c **** 2699:config.c **** r.a.x = 0x5801; 2700:config.c **** r.b.b.l = strat; 2701:config.c **** init_call_intr(0x21, &r); 2702:config.c **** } 2703:config.c **** 2704:config.c **** VOID DoInstall(void) 2705:config.c **** { 2706:config.c **** int i; 2707:config.c **** unsigned short installMemory; 2708:config.c **** struct instCmds *cmd; 2709:config.c **** 2710:config.c **** if (numInstallCmds == 0) 2711:config.c **** return; 2712:config.c **** 2713:config.c **** InstallPrintf(("Installing commands now\n")); 2714:config.c **** 2715:config.c **** /* grab memory for this install code 2716:config.c **** we KNOW, that we are executing somewhere at top of memory 2717:config.c **** we need to protect the INIT_CODE from other programs 2718:config.c **** that will be executing soon 2719:config.c **** */ 2720:config.c **** 2721:config.c **** set_strategy(LAST_FIT); 2722:config.c **** installMemory = ((unsigned)_init_end + ebda_size + 15) / 16; 2723:config.c **** #ifdef __WATCOMC__ 2724:config.c **** installMemory += (_InitTextEnd - _InitTextStart + 15) / 16; 2725:config.c **** #endif 2726:config.c **** installMemory = allocmem(installMemory); 2727:config.c **** 2728:config.c **** InstallPrintf(("allocated memory at %x\n",installMemory)); 2729:config.c **** 2730:config.c **** for (i = 0, cmd = InstallCommands; i < numInstallCmds; i++, cmd++) 2731:config.c **** { 2732:config.c **** InstallPrintf(("%d:%s\n",i,cmd->buffer)); 2733:config.c **** set_strategy(cmd->mode); 2734:config.c **** InstallExec(cmd); 2735:config.c **** } 2736:config.c **** set_strategy(FIRST_FIT); 2737:config.c **** free(installMemory); 2738:config.c **** 2739:config.c **** InstallPrintf(("Done with installing commands\n")); 2740:config.c **** return; 2741:config.c **** } 2742:config.c **** 2743:config.c **** STATIC BYTE far * searchvar(const BYTE * name, int length) 2744:config.c **** { 2745:config.c **** BYTE far * pp = master_env; 2746:config.c **** do { 2747:config.c **** if (!fmemcmp(name, pp, length + 1)) { 2748:config.c **** return pp; 2749:config.c **** } 2750:config.c **** pp += fstrlen(pp) + 1; 2751:config.c **** } while (*pp); 2752:config.c **** return NULL; 2753:config.c **** } 2754:config.c **** 2755:config.c **** STATIC void deletevar(BYTE far * pp) { 210 .loc 1 2755 0 211 _.LVL22: 0 00000F8E 56 push si 0 00000F8F 57 push di 0 00000F90 55 push bp 215 _.LCFI6: 0 00000F91 89E5 mov bp, sp 217 _.LCFI7: 0 00000F93 1E push ds 0 00000F94 8B7E08 mov di, word ptr [bp+8] 0 00000F97 8B560A mov dx, word ptr [bp+10] 2756:config.c **** int variablelength; 2757:config.c **** if (NULL == pp) 221 .loc 1 2757 0 0 00000F9A 89F8 mov ax, di 0 00000F9C 09D0 or ax, dx 0 00000F9E 742A je _.L18 2758:config.c **** return; 2759:config.c **** variablelength = fstrlen(pp) + 1; 225 .loc 1 2759 0 0 00000FA0 52 push dx 0 00000FA1 8956FE mov word ptr [bp-2], dx 0 00000FA4 57 push di 0 00000FA5 E8[FEFF] call _init_fstrlen 230 _.LVL23: 0 00000FA8 96 xchg si, ax 232 _.LVL24: 2760:config.c **** fmemcpy(pp, pp + variablelength, (unsigned)(envp + 3 - (pp + variablelength))); 233 .loc 1 2760 0 0 00000FA9 89F3 mov bx, si 0 00000FAB 8D4101 lea ax, [1+bx+di] 236 _.LVL25: 0 00000FAE 8B56FE mov dx, word ptr [bp-2] 0 00000FB1 89D1 mov cx, dx 0 00000FB3 8B16[B602] mov dx, word ptr [_envp] 0 00000FB7 83C203 add dx, 3 0 00000FBA 29C2 sub dx, ax 0 00000FBC 52 push dx 0 00000FBD 51 push cx 0 00000FBE 50 push ax 0 00000FBF 51 push cx 0 00000FC0 57 push di 0 00000FC1 E8[FEFF] call _init_fmemcpy 248 _.LVL26: 2761:config.c **** /* our fmemcpy always copies forwards */ 2762:config.c **** envp -= variablelength; 249 .loc 1 2762 0 0 00000FC4 F7D6 not si 251 _.LVL27: 0 00000FC6 0136[B602] add word ptr [_envp], si 253 _.LVL28: 254 _.L18: 2763:config.c **** return; 2764:config.c **** } 255 .loc 1 2764 0 0 00000FCA 89EC mov sp, bp 0 00000FCC 5D pop bp 0 00000FCD 5F pop di 0 00000FCE 5E pop si 0 00000FCF C20400 ret 4 261 _.LFE81: 262 .size _deletevar, .-_deletevar 263 .type _ClearScreen, @function 264 _ClearScreen: 265 _.LFB69: 2459:config.c **** /* scroll down (newlines): */ 266 .loc 1 2459 0 267 _.LVL29: 0 00000FD2 56 push si 0 00000FD3 57 push di 0 00000FD4 55 push bp 271 _.LCFI8: 0 00000FD5 89E5 mov bp, sp 273 _.LCFI9: 0 00000FD7 83EC18 sub sp, 24 2465:config.c **** r.b.b.h = attr; 275 .loc 1 2465 0 0 00000FDA C746E80006 mov word ptr [bp-24], 1536 2466:config.c **** r.c.x = 0; 277 .loc 1 2466 0 0 00000FDF 8A4608 mov al, byte ptr [bp+8] 0 00000FE2 8846EB mov byte ptr [bp-21], al 2467:config.c **** r.d.b.l = peekb(0x40, 0x4a) - 1; /* columns */ 280 .loc 1 2467 0 0 00000FE5 C746EC0000 mov word ptr [bp-20], 0 2468:config.c **** rows = peekb(0x40, 0x84); 282 .loc 1 2468 0 0 00000FEA BA4000 mov dx, 64 0 00000FED 8EC2 mov es, dx 0 00000FEF 26A04A00 mov al, byte ptr es:[74] 0 00000FF3 FEC8 dec al 0 00000FF5 8846EE mov byte ptr [bp-18], al 2469:config.c **** if (rows == 0) rows = 24; 288 .loc 1 2469 0 0 00000FF8 26A08400 mov al, byte ptr es:[132] 290 _.LVL30: 2470:config.c **** r.d.b.h = rows; 291 .loc 1 2470 0 0 00000FFC 84C0 test al, al 0 00000FFE 7502 jne _.L26 0 00001000 B018 mov al, 24 295 _.LVL31: 296 _.L26: 2471:config.c **** init_call_intr(0x10, &r); 297 .loc 1 2471 0 0 00001002 8846EF mov byte ptr [bp-17], al 2472:config.c **** 299 .loc 1 2472 0 0 00001005 8D7EE8 lea di, [-24+bp] 0 00001008 57 push di 0 00001009 BE1000 mov si, 16 0 0000100C 56 push si 0 0000100D E8[FEFF] call _init_call_intr 305 _.LVL32: 2475:config.c **** r.b.b.h = 0; /* displaypage: */ 306 .loc 1 2475 0 0 00001010 C646E902 mov byte ptr [bp-23], 2 2476:config.c **** r.d.x = 0; /* pos 0,0 */ 308 .loc 1 2476 0 0 00001014 C646EB00 mov byte ptr [bp-21], 0 2477:config.c **** init_call_intr(0x10, &r); 310 .loc 1 2477 0 0 00001018 C746EE0000 mov word ptr [bp-18], 0 2478:config.c **** MenuColor = attr; 312 .loc 1 2478 0 0 0000101D 57 push di 0 0000101E 56 push si 0 0000101F E8[FEFF] call _init_call_intr 316 _.LVL33: 2479:config.c **** } 317 .loc 1 2479 0 0 00001022 8A4608 mov al, byte ptr [bp+8] 0 00001025 B400 mov ah, 0 0 00001027 A3[0000] mov word ptr [_MenuColor], ax 2480:config.c **** 321 .loc 1 2480 0 0 0000102A 89EC mov sp, bp 0 0000102C 5D pop bp 0 0000102D 5F pop di 0 0000102E 5E pop si 0 0000102F C20200 ret 2 327 _.LFE69: 328 .size _ClearScreen, .-_ClearScreen === Switch to base=012BB0h -> ".RODATA.STR1.1" 329 .section .rodata.str1.1 330 _.LC5: 0 00000780 257300 .string "%s" === Switch to base=002270h -> ".TEXT" 332 .text 333 .type _WriteMenuLine, @function 334 _WriteMenuLine: 335 _.LFB4: 61:config.c **** iregs r; 336 .loc 1 61 0 337 _.LVL34: 0 00001032 56 push si 0 00001033 57 push di 0 00001034 55 push bp 341 _.LCFI10: 0 00001035 89E5 mov bp, sp 343 _.LCFI11: 0 00001037 83EC1C sub sp, 28 0 0000103A 8B7608 mov si, word ptr [bp+8] 346 _.LVL35: 66:config.c **** return; 347 .loc 1 66 0 0 0000103D 807C0500 cmp byte ptr [si+5], 0 0 00001041 7474 je _.L28 63:config.c **** char *pText = menu->Text; 350 .loc 1 63 0 0 00001043 A1[0000] mov ax, word ptr [_MenuColor] 0 00001046 88C2 mov dl, al 69:config.c **** attr = ((attr << 4) | (attr >> 4)); 353 .loc 1 69 0 0 00001048 807C0400 cmp byte ptr [si+4], 0 0 0000104C 740B je _.L30 70:config.c **** 356 .loc 1 70 0 0 0000104E B104 mov cl, 4 0 00001050 D3E0 shl ax, cl 0 00001052 25F00F and ax, 4080 0 00001055 D2EA shr dl, cl 0 00001057 08C2 or dl, al 362 _.LVL36: 363 _.L30: 64:config.c **** 364 .loc 1 64 0 0 00001059 8D7C05 lea di, [5+si] 366 _.LVL37: 73:config.c **** r.b.b.h = attr; 367 .loc 1 73 0 0 0000105C C746E80006 mov word ptr [bp-24], 1536 74:config.c **** r.c.b.l = r.d.b.l = menu->x; 369 .loc 1 74 0 0 00001061 8856EB mov byte ptr [bp-21], dl 75:config.c **** r.c.b.h = r.d.b.h = menu->y; 371 .loc 1 75 0 0 00001064 8B04 mov ax, word ptr [si] 0 00001066 8846EE mov byte ptr [bp-18], al 0 00001069 8846EC mov byte ptr [bp-20], al 76:config.c **** r.d.b.l += strlen(pText) - 1; 375 .loc 1 76 0 0 0000106C 8B4402 mov ax, word ptr [si+2] 0 0000106F 8846EF mov byte ptr [bp-17], al 0 00001072 8846ED mov byte ptr [bp-19], al 77:config.c **** init_call_intr(0x10, &r); 379 .loc 1 77 0 0 00001075 57 push di 0 00001076 E8[FEFF] call _init_strlen 382 _.LVL38: 0 00001079 48 dec ax 0 0000107A 0046EE add byte ptr [bp-18], al 78:config.c **** 385 .loc 1 78 0 0 0000107D 8D4EE8 lea cx, [-24+bp] 0 00001080 51 push cx 0 00001081 894EE4 mov word ptr [bp-28], cx 0 00001084 BA1000 mov dx, 16 0 00001087 52 push dx 0 00001088 8956E6 mov word ptr [bp-26], dx 0 0000108B E8[FEFF] call _init_call_intr 393 _.LVL39: 81:config.c **** r.b.b.h = 0; 394 .loc 1 81 0 0 0000108E C646E902 mov byte ptr [bp-23], 2 82:config.c **** r.d.b.l = menu->x; 396 .loc 1 82 0 0 00001092 C646EB00 mov byte ptr [bp-21], 0 83:config.c **** r.d.b.h = menu->y; 398 .loc 1 83 0 0 00001096 8B04 mov ax, word ptr [si] 0 00001098 8846EE mov byte ptr [bp-18], al 84:config.c **** init_call_intr(0x10, &r); 401 .loc 1 84 0 0 0000109B 8B4402 mov ax, word ptr [si+2] 0 0000109E 8846EF mov byte ptr [bp-17], al 85:config.c **** 404 .loc 1 85 0 0 000010A1 8B4EE4 mov cx, word ptr [bp-28] 0 000010A4 51 push cx 0 000010A5 8B56E6 mov dx, word ptr [bp-26] 0 000010A8 52 push dx 0 000010A9 E8[FEFF] call _init_call_intr 410 _.LVL40: 87:config.c **** } 411 .loc 1 87 0 0 000010AC 57 push di 0 000010AD B8[3000] mov ax, offset _.LC5 0 000010B0 50 push ax 0 000010B1 E8[FEFF] call _init_printf 416 _.LVL41: 0 000010B4 83C404 add sp, 4 418 _.L28: 88:config.c **** 419 .loc 1 88 0 0 000010B7 89EC mov sp, bp 0 000010B9 5D pop bp 0 000010BA 5F pop di 0 000010BB 5E pop si 424 _.LVL42: 0 000010BC C20200 ret 2 426 _.LFE4: 427 .size _WriteMenuLine, .-_WriteMenuLine 428 .type _set_strategy, @function 429 _set_strategy: 430 _.LFB78: 2696:config.c **** iregs r; 431 .loc 1 2696 0 432 _.LVL43: 0 000010BF 55 push bp 434 _.LCFI12: 0 000010C0 89E5 mov bp, sp 436 _.LCFI13: 0 000010C2 83EC18 sub sp, 24 2699:config.c **** r.b.b.l = strat; 438 .loc 1 2699 0 0 000010C5 C746E80158 mov word ptr [bp-24], 22529 2700:config.c **** init_call_intr(0x21, &r); 440 .loc 1 2700 0 0 000010CA 8A4604 mov al, byte ptr [bp+4] 0 000010CD 8846EA mov byte ptr [bp-22], al 2701:config.c **** } 443 .loc 1 2701 0 0 000010D0 8D46E8 lea ax, [-24+bp] 0 000010D3 50 push ax 0 000010D4 B82100 mov ax, 33 0 000010D7 50 push ax 0 000010D8 E8[FEFF] call _init_call_intr 449 _.LVL44: 2702:config.c **** 450 .loc 1 2702 0 0 000010DB 89EC mov sp, bp 0 000010DD 5D pop bp 0 000010DE C20200 ret 2 454 _.LFE78: 455 .size _set_strategy, .-_set_strategy 456 .type _CmdChain, @function 457 _CmdChain: 458 _.LFB75: 2630:config.c **** struct CfgFile *cfg; 459 .loc 1 2630 0 460 _.LVL45: 0 000010E1 56 push si 0 000010E2 57 push di 0 000010E3 55 push bp 464 _.LCFI14: 0 000010E4 89E5 mov bp, sp 466 _.LCFI15: 0 000010E6 8B7E08 mov di, word ptr [bp+8] 2635:config.c **** CfgFailure(pLine); 468 .loc 1 2635 0 0 000010E9 833E[0000]04 cmp word ptr [_nCurChain], 4 0 000010EE 7E0B jle _.L36 471 _.L37: 2636:config.c **** return; 472 .loc 1 2636 0 0 000010F0 897E08 mov word ptr [bp+8], di 2648:config.c **** 474 .loc 1 2648 0 0 000010F3 89EC mov sp, bp 0 000010F5 5D pop bp 0 000010F6 5F pop di 0 000010F7 5E pop si 2636:config.c **** return; 479 .loc 1 2636 0 0 000010F8 E900FE jmp _CfgFailure 481 _.LVL46: 482 _.L36: 483 _.LBB30: 484 _.LBB31: 2639:config.c **** CfgFailure(pLine); 485 .loc 1 2639 0 0 000010FB 31F6 xor si, si 0 000010FD 56 push si 0 000010FE 57 push di 0 000010FF E8[FEFF] call _init_DosOpen 490 _.LVL47: 0 00001102 39F0 cmp ax, si 0 00001104 7CEA jl _.L37 2643:config.c **** cfg->nFileDesc = nFileDesc; 493 .loc 1 2643 0 0 00001106 8B1E[0000] mov bx, word ptr [_nCurChain] 0 0000110A 8D5701 lea dx, [1+bx] 0 0000110D 8916[0000] mov word ptr [_nCurChain], dx 497 _.LVL48: 2644:config.c **** cfg->nCfgLine = nCfgLine; 498 .loc 1 2644 0 0 00001111 BF[0000] mov di, offset _cfgFile 500 _.LVL49: 0 00001114 B102 mov cl, 2 0 00001116 D3E3 shl bx, cl 503 _.LVL50: 0 00001118 8B16[0000] mov dx, word ptr [_nFileDesc] 505 _.LVL51: 0 0000111C 8911 mov word ptr [bx+di], dx 2645:config.c **** nFileDesc = fd; 507 .loc 1 2645 0 0 0000111E 8B16[380A] mov dx, word ptr [_nCfgLine] 0 00001122 895102 mov word ptr [bx+di+2], dx 2646:config.c **** nCfgLine = 0; 510 .loc 1 2646 0 0 00001125 A3[0000] mov word ptr [_nFileDesc], ax 2647:config.c **** } 512 .loc 1 2647 0 0 00001128 8936[380A] mov word ptr [_nCfgLine], si 514 _.LBE31: 515 _.LBE30: 2648:config.c **** 516 .loc 1 2648 0 0 0000112C 89EC mov sp, bp 0 0000112E 5D pop bp 0 0000112F 5F pop di 0 00001130 5E pop si 0 00001131 C20200 ret 2 522 _.LFE75: 523 .size _CmdChain, .-_CmdChain === Switch to base=012BB0h -> ".RODATA.STR1.1" 524 .section .rodata.str1.1 525 _.LC6: 0 00000783 546F6F206D616E79 .string "Too many Install commands given (%d max)\n" 0 0000078B 20496E7374616C6C 0 00000793 20636F6D6D616E64 0 0000079B 7320676976656E20 0 000007A3 282564206D617829 0 000007AB 0A00 === Switch to base=002270h -> ".TEXT" 527 .text 528 .type __CmdInstall, @function 529 __CmdInstall: 530 _.LFB72: 2604:config.c **** struct instCmds *cmd; 531 .loc 1 2604 0 532 _.LVL52: 0 00001134 56 push si 0 00001135 55 push bp 535 _.LCFI16: 0 00001136 89E5 mov bp, sp 537 _.LCFI17: 0 00001138 8B7606 mov si, word ptr [bp+6] 2609:config.c **** { 539 .loc 1 2609 0 0 0000113B A1[0000] mov ax, word ptr [_numInstallCmds] 0 0000113E 83F80A cmp ax, 10 0 00001141 7619 jbe _.L40 543 _.LVL53: 544 _.LBB34: 545 _.LBB35: 2611:config.c **** CfgFailure(pLine); 546 .loc 1 2611 0 0 00001143 B80A00 mov ax, 10 0 00001146 50 push ax 0 00001147 B8[3300] mov ax, offset _.LC6 0 0000114A 50 push ax 0 0000114B E8[FEFF] call _init_printf 552 _.LVL54: 2612:config.c **** return; 553 .loc 1 2612 0 0 0000114E 56 push si 0 0000114F E8A9FD call _CfgFailure 556 _.LVL55: 0 00001152 83C404 add sp, 4 558 _.LVL56: 559 _.L39: 560 _.LBE35: 561 _.LBE34: 2620:config.c **** STATIC VOID CmdInstall(BYTE * pLine) 562 .loc 1 2620 0 0 00001155 89EC mov sp, bp 0 00001157 5D pop bp 0 00001158 5E pop si 0 00001159 C20400 ret 4 567 _.LVL57: 568 _.L40: 2616:config.c **** cmd->buffer[127] = 0; 569 .loc 1 2616 0 0 0000115C BA7F00 mov dx, 127 0 0000115F 52 push dx 0 00001160 56 push si 0 00001161 BA8200 mov dx, 130 0 00001164 F7E2 mul dx 575 _.LVL58: 0 00001166 05[0000] add ax, offset _InstallCommands 577 _.LVL59: 0 00001169 89C6 mov si, ax 579 _.LVL60: 0 0000116B 50 push ax 0 0000116C E8[FEFF] call _init_memcpy 582 _.LVL61: 2617:config.c **** cmd->mode = mode; 583 .loc 1 2617 0 0 0000116F C6447F00 mov byte ptr [si+127], 0 2618:config.c **** numInstallCmds++; 585 .loc 1 2618 0 0 00001173 8B4608 mov ax, word ptr [bp+8] 0 00001176 89848000 mov word ptr [si+128], ax 2619:config.c **** } 588 .loc 1 2619 0 0 0000117A FF06[0000] inc word ptr [_numInstallCmds] 0 0000117E EBD5 jmp _.L39 591 _.LFE72: 592 .size __CmdInstall, .-__CmdInstall 593 .type _CmdInstallHigh, @function 594 _CmdInstallHigh: 595 _.LFB74: 2626:config.c **** _CmdInstall(pLine,0x80); /* load high, if possible */ 596 .loc 1 2626 0 597 _.LVL62: 0 00001180 55 push bp 599 _.LCFI18: 0 00001181 89E5 mov bp, sp 601 _.LCFI19: 2627:config.c **** } 602 .loc 1 2627 0 0 00001183 B88000 mov ax, 128 0 00001186 50 push ax 0 00001187 FF7604 push word ptr [bp+4] 0 0000118A E8A7FF call __CmdInstall 607 _.LVL63: 2628:config.c **** STATIC VOID CmdChain(BYTE * pLine) 608 .loc 1 2628 0 0 0000118D 89EC mov sp, bp 0 0000118F 5D pop bp 0 00001190 C20200 ret 2 612 _.LFE74: 613 .size _CmdInstallHigh, .-_CmdInstallHigh 614 .type _CmdInstall, @function 615 _CmdInstall: 616 _.LFB73: 2622:config.c **** _CmdInstall(pLine,0); 617 .loc 1 2622 0 618 _.LVL64: 0 00001193 55 push bp 620 _.LCFI20: 0 00001194 89E5 mov bp, sp 622 _.LCFI21: 2623:config.c **** } 623 .loc 1 2623 0 0 00001196 31C0 xor ax, ax 0 00001198 50 push ax 0 00001199 FF7604 push word ptr [bp+4] 0 0000119C E895FF call __CmdInstall 628 _.LVL65: 2624:config.c **** STATIC VOID CmdInstallHigh(BYTE * pLine) 629 .loc 1 2624 0 0 0000119F 89EC mov sp, bp 0 000011A1 5D pop bp 0 000011A2 C20200 ret 2 633 _.LFE73: 634 .size _CmdInstall, .-_CmdInstall 635 .type _strupr, @function 636 _strupr: 637 _.LFB55: 2097:config.c **** while (*s) { 638 .loc 1 2097 0 639 _.LVL66: 0 000011A5 89E3 mov bx, sp 641 _.LCFI22: 0 000011A7 8B5F02 mov bx, word ptr [bx+2] 643 _.LVL67: 644 _.L48: 2098:config.c **** *s = toupper(*s); 645 .loc 1 2098 0 0 000011AA 8A07 mov al, byte ptr [bx] 0 000011AC 84C0 test al, al 0 000011AE 7503 jne _.L50 2102:config.c **** 649 .loc 1 2102 0 0 000011B0 C20200 ret 2 651 _.L50: 652 _.LVL68: 653 _.LBB38: 654 _.LBB39: 2090:config.c **** c -= 'a' - 'A'; 655 .loc 1 2090 0 0 000011B3 88C4 mov ah, al 0 000011B5 80C49F add ah, -97 0 000011B8 80FC19 cmp ah, 25 0 000011BB 7702 ja _.L49 2091:config.c **** return c; 660 .loc 1 2091 0 0 000011BD 04E0 add al, -32 662 _.LVL69: 663 _.L49: 664 _.LBE39: 665 _.LBE38: 2099:config.c **** s++; 666 .loc 1 2099 0 0 000011BF 8807 mov byte ptr [bx], al 2100:config.c **** } 668 .loc 1 2100 0 0 000011C1 43 inc bx 670 _.LVL70: 0 000011C2 EBE6 jmp _.L48 672 _.LFE55: 673 .size _strupr, .-_strupr 674 .type _strcaseequal, @function 675 _strcaseequal: 676 _.LFB60: 2140:config.c **** char ch; 677 .loc 1 2140 0 678 _.LVL71: 0 000011C4 57 push di 0 000011C5 55 push bp 681 _.LCFI23: 0 000011C6 89E5 mov bp, sp 683 _.LCFI24: 2142:config.c **** if (ch == '\0') 684 .loc 1 2142 0 0 000011C8 31DB xor bx, bx 686 _.LVL72: 687 _.L53: 0 000011CA 8B7E08 mov di, word ptr [bp+8] 0 000011CD 8A01 mov al, byte ptr [bx+di] 690 _.LVL73: 691 _.LBB44: 692 _.LBB45: 2090:config.c **** c -= 'a' - 'A'; 693 .loc 1 2090 0 0 000011CF 88C4 mov ah, al 0 000011D1 80C49F add ah, -97 0 000011D4 80FC19 cmp ah, 25 0 000011D7 7702 ja _.L55 2091:config.c **** return c; 698 .loc 1 2091 0 0 000011D9 04E0 add al, -32 700 _.LVL74: 701 _.L55: 702 _.LBE45: 703 _.LBE44: 2142:config.c **** if (ch == '\0') 704 .loc 1 2142 0 0 000011DB 8B7E06 mov di, word ptr [bp+6] 0 000011DE 8A21 mov ah, byte ptr [bx+di] 707 _.LVL75: 708 _.LBB46: 709 _.LBB47: 2090:config.c **** c -= 'a' - 'A'; 710 .loc 1 2090 0 0 000011E0 88E2 mov dl, ah 0 000011E2 80C29F add dl, -97 0 000011E5 80FA19 cmp dl, 25 0 000011E8 770E ja _.L56 715 _.LVL76: 2091:config.c **** return c; 716 .loc 1 2091 0 0 000011EA 80C4E0 add ah, -32 718 _.LBE47: 719 _.LBE46: 2142:config.c **** if (ch == '\0') 720 .loc 1 2142 0 0 000011ED 38C4 cmp ah, al 0 000011EF 7414 je _.L57 723 _.L62: 2145:config.c **** } 724 .loc 1 2145 0 0 000011F1 30C0 xor al, al 726 _.LVL77: 727 _.L52: 2146:config.c **** 728 .loc 1 2146 0 0 000011F3 5D pop bp 0 000011F4 5F pop di 0 000011F5 C20400 ret 4 732 _.LVL78: 733 _.L56: 2142:config.c **** if (ch == '\0') 734 .loc 1 2142 0 0 000011F8 38C4 cmp ah, al 0 000011FA 75F5 jne _.L62 0 000011FC 43 inc bx 738 _.LVL79: 2143:config.c **** return 1; 739 .loc 1 2143 0 0 000011FD 84C0 test al, al 0 000011FF 75C9 jne _.L53 2144:config.c **** return 0; 742 .loc 1 2144 0 0 00001201 B001 mov al, 1 0 00001203 EBEE jmp _.L52 745 _.LVL80: 746 _.L57: 0 00001205 43 inc bx 748 _.LVL81: 0 00001206 EBC2 jmp _.L53 750 _.LFE60: 751 .size _strcaseequal, .-_strcaseequal 752 .type _skipwh, @function 753 _skipwh: 754 _.LFB51: 2022:config.c **** while (iswh(*s)) 755 .loc 1 2022 0 756 _.LVL82: 0 00001208 55 push bp 758 _.LCFI25: 0 00001209 89E5 mov bp, sp 760 _.LCFI26: 2023:config.c **** ++s; 761 .loc 1 2023 0 0 0000120B 8B4604 mov ax, word ptr [bp+4] 763 _.LVL83: 764 _.L65: 0 0000120E 89C3 mov bx, ax 0 00001210 8A17 mov dl, byte ptr [bx] 767 _.LVL84: 768 _.LBB52: 769 _.LBB53: 2018:config.c **** } 770 .loc 1 2018 0 0 00001212 80FA0D cmp dl, 13 0 00001215 740F je _.L64 773 _.LVL85: 774 _.LBB54: 775 _.LBB55: 0 00001217 88D6 mov dh, dl 0 00001219 80C6F7 add dh, -9 0 0000121C 80FE02 cmp dh, 1+1 0 0000121F 7205 jc _.L64 0 00001221 80FA20 cmp dl, 32 0 00001224 7503 jne _.L69 782 _.LVL86: 783 _.L64: 784 _.LBE55: 785 _.LBE54: 786 _.LBE53: 787 _.LBE52: 2024:config.c **** return s; 788 .loc 1 2024 0 0 00001226 40 inc ax 790 _.LVL87: 0 00001227 EBE5 jmp _.L65 792 _.LVL88: 793 _.L69: 2026:config.c **** 794 .loc 1 2026 0 0 00001229 5D pop bp 0 0000122A C20200 ret 2 797 _.LFE51: 798 .size _skipwh, .-_skipwh 799 .type _scan, @function 800 _scan: 801 _.LFB52: 2029:config.c **** askThisSingleCommand = FALSE; 802 .loc 1 2029 0 803 _.LVL89: 0 0000122D 56 push si 0 0000122E 57 push di 0 0000122F 55 push bp 807 _.LCFI27: 0 00001230 89E5 mov bp, sp 809 _.LCFI28: 0 00001232 8B7E0A mov di, word ptr [bp+10] 2030:config.c **** DontAskThisSingleCommand = FALSE; 811 .loc 1 2030 0 0 00001235 C606[0000]00 mov byte ptr [_askThisSingleCommand], 0 2031:config.c **** 813 .loc 1 2031 0 0 0000123A C606[0000]00 mov byte ptr [_DontAskThisSingleCommand], 0 2033:config.c **** 815 .loc 1 2033 0 0 0000123F FF7608 push word ptr [bp+8] 0 00001242 E8C3FF call _skipwh 818 _.LVL90: 0 00001245 93 xchg bx, ax 820 _.LVL91: 2035:config.c **** 821 .loc 1 2035 0 0 00001246 C706[0000]0000 mov word ptr [_MenuLine], 0 2042:config.c **** { 823 .loc 1 2042 0 0 0000124C 837E0C00 cmp word ptr [bp+12], 0 0 00001250 742B je _.L72 826 _.LBB65: 827 _.LBB66: 2084:config.c **** } 828 .loc 1 2084 0 discriminator 1 0 00001252 8A07 mov al, byte ptr [bx] 830 _.LVL92: 0 00001254 04D0 add al, -48 832 _.LBE66: 833 _.LBE65: 2042:config.c **** { 834 .loc 1 2042 0 discriminator 1 0 00001256 3C09 cmp al, 9 0 00001258 7723 ja _.L72 0 0000125A 31C0 xor ax, ax 838 _.LBB67: 2046:config.c **** 839 .loc 1 2046 0 discriminator 1 0 0000125C BA0100 mov dx, 1 841 _.L73: 842 _.LVL93: 2045:config.c **** numbers |= 1 << (*s -'0'); 843 .loc 1 2045 0 discriminator 1 0 0000125F 8A0F mov cl, byte ptr [bx] 845 _.LBB68: 846 _.LBB69: 2084:config.c **** } 847 .loc 1 2084 0 discriminator 1 0 00001261 88CD mov ch, cl 0 00001263 80C5D0 add ch, -48 850 _.LBE69: 851 _.LBE68: 2045:config.c **** numbers |= 1 << (*s -'0'); 852 .loc 1 2045 0 discriminator 1 0 00001266 80FD09 cmp ch, 9 0 00001269 7665 jbe _.L74 2048:config.c **** { 855 .loc 1 2048 0 0 0000126B 80F93F cmp cl, 63 0 0000126E 750D jne _.L72 2050:config.c **** Menus |= numbers; 858 .loc 1 2050 0 0 00001270 A3[0000] mov word ptr [_MenuLine], ax 2051:config.c **** s = skipwh(s+1); 860 .loc 1 2051 0 0 00001273 0906[0000] or word ptr [_Menus], ax 2052:config.c **** } 862 .loc 1 2052 0 0 00001277 43 inc bx 864 _.LVL94: 0 00001278 53 push bx 0 00001279 E88CFF call _skipwh 867 _.LVL95: 0 0000127C 93 xchg bx, ax 869 _.LVL96: 870 _.L72: 871 _.LBE67: 2058:config.c **** { 872 .loc 1 2058 0 0 0000127D 803F21 cmp byte ptr [bx], 33 0 00001280 750B jne _.L75 2060:config.c **** s = skipwh(s+1); 875 .loc 1 2060 0 0 00001282 C606[0000]01 mov byte ptr [_DontAskThisSingleCommand], 1 2061:config.c **** } 877 .loc 1 2061 0 0 00001287 43 inc bx 879 _.LVL97: 0 00001288 53 push bx 0 00001289 E87CFF call _skipwh 882 _.LVL98: 0 0000128C 93 xchg bx, ax 884 _.LVL99: 885 _.L75: 2064:config.c **** { 886 .loc 1 2064 0 0 0000128D 803F3B cmp byte ptr [bx], 59 0 00001290 744A je _.L76 0 00001292 89FE mov si, di 2073:config.c **** else 890 .loc 1 2073 0 0 00001294 B501 mov ch, 1 892 _.LVL100: 893 _.L77: 2070:config.c **** { 894 .loc 1 2070 0 0 00001296 8A07 mov al, byte ptr [bx] 0 00001298 84C0 test al, al 0 0000129A 7447 je _.L78 898 _.LVL101: 899 _.LBB70: 900 _.LBB71: 2018:config.c **** } 901 .loc 1 2018 0 discriminator 1 0 0000129C 3C0D cmp al, 13 0 0000129E 7443 je _.L78 0 000012A0 3C0A cmp al, 10 0 000012A2 743F je _.L78 906 _.LVL102: 907 _.LBB72: 908 _.LBB73: 2018:config.c **** } 909 .loc 1 2018 0 is_stmt 0 0 000012A4 3C09 cmp al, 9 0 000012A6 9F lahf 0 000012A7 D0E4 shl ah, 1 0 000012A9 99 cwd 0 000012AA F6DA neg dl 0 000012AC 88D1 mov cl, dl 0 000012AE 3C20 cmp al, 32 0 000012B0 9F lahf 0 000012B1 D0E4 shl ah, 1 0 000012B3 99 cwd 0 000012B4 88D6 mov dh, dl 0 000012B6 F6DE neg dh 0 000012B8 88CA mov dl, cl 0 000012BA 08F2 or dl, dh 924 _.LBE73: 925 _.LBE72: 926 _.LBE71: 927 _.LBE70: 2070:config.c **** { 928 .loc 1 2070 0 is_stmt 1 0 000012BC 80FA01 cmp dl, 1 0 000012BF 7422 je _.L78 0 000012C1 3C3D cmp al, 61 0 000012C3 741E je _.L78 2072:config.c **** askThisSingleCommand = TRUE; 933 .loc 1 2072 0 0 000012C5 3C3F cmp al, 63 0 000012C7 7526 jne _.L79 2073:config.c **** else 936 .loc 1 2073 0 0 000012C9 882E[0000] mov byte ptr [_askThisSingleCommand], ch 938 _.L80: 2076:config.c **** } 939 .loc 1 2076 0 0 000012CD 43 inc bx 941 _.LVL103: 0 000012CE EBC6 jmp _.L77 943 _.LVL104: 944 _.L74: 945 _.LBB74: 2046:config.c **** 946 .loc 1 2046 0 discriminator 2 0 000012D0 80C1D0 add cl, -48 0 000012D3 89D6 mov si, dx 0 000012D5 D3E6 shl si, cl 0 000012D7 09F0 or ax, si 951 _.LVL105: 2045:config.c **** numbers |= 1 << (*s -'0'); 952 .loc 1 2045 0 discriminator 2 0 000012D9 43 inc bx 954 _.LVL106: 0 000012DA EB83 jmp _.L73 956 _.LVL107: 957 _.L76: 958 _.LBE74: 2067:config.c **** } 959 .loc 1 2067 0 0 000012DC 8D7501 lea si, [1+di] 961 _.LVL108: 0 000012DF 43 inc bx 963 _.LVL109: 0 000012E0 C6053B mov byte ptr [di], 59 965 _.L78: 2078:config.c **** return s; 966 .loc 1 2078 0 0 000012E3 C60400 mov byte ptr [si], 0 2080:config.c **** 968 .loc 1 2080 0 0 000012E6 93 xchg bx, ax 0 000012E7 89EC mov sp, bp 0 000012E9 5D pop bp 0 000012EA 5F pop di 0 000012EB 5E pop si 974 _.LVL110: 0 000012EC C20600 ret 6 976 _.LVL111: 977 _.L79: 2075:config.c **** s++; 978 .loc 1 2075 0 0 000012EF 8804 mov byte ptr [si], al 0 000012F1 46 inc si 981 _.LVL112: 0 000012F2 EBD9 jmp _.L80 983 _.LFE52: 984 .size _scan, .-_scan 985 .type _GetNumArg, @function 986 _GetNumArg: 987 _.LFB19: 1152:config.c **** static char digits[] = "0123456789ABCDEF"; 988 .loc 1 1152 0 989 _.LVL113: 0 000012F4 56 push si 0 000012F5 57 push di 0 000012F6 55 push bp 993 _.LCFI29: 0 000012F7 89E5 mov bp, sp 995 _.LCFI30: 0 000012F9 83EC06 sub sp, 6 997 _.LVL114: 1159:config.c **** if (*p == '-') 998 .loc 1 1159 0 0 000012FC FF7608 push word ptr [bp+8] 0 000012FF E806FF call _skipwh 1001 _.LVL115: 0 00001302 93 xchg bx, ax 1003 _.LVL116: 1160:config.c **** { 1004 .loc 1 1160 0 0 00001303 8A07 mov al, byte ptr [bx] 1006 _.LVL117: 0 00001305 3C2D cmp al, 45 0 00001307 7544 jne _.L94 1162:config.c **** sign = -1; 1009 .loc 1 1162 0 0 00001309 43 inc bx 1011 _.LVL118: 1163:config.c **** } 1012 .loc 1 1163 0 0 0000130A BFFFFF mov di, -1 1014 _.LVL119: 1015 _.L96: 1016 _.LBB81: 1175:config.c **** else 1017 .loc 1 1175 0 discriminator 1 0 0000130D 31F6 xor si, si 0 0000130F B10A mov cl, 10 1020 _.LVL120: 1021 _.L95: 1022 _.LBE81: 1171:config.c **** { 1023 .loc 1 1171 0 discriminator 1 0 00001311 8A07 mov al, byte ptr [bx] 0 00001313 84C0 test al, al 0 00001315 742C je _.L102 1027 _.LVL121: 1028 _.LBB86: 1029 _.LBB82: 1030 _.LBB83: 2090:config.c **** c -= 'a' - 'A'; 1031 .loc 1 2090 0 0 00001317 88C4 mov ah, al 0 00001319 80C49F add ah, -97 0 0000131C 80FC19 cmp ah, 25 0 0000131F 7702 ja _.L98 2091:config.c **** return c; 1036 .loc 1 2091 0 0 00001321 04E0 add al, -32 1038 _.LVL122: 1039 _.L98: 0 00001323 884EFB mov byte ptr [bp-5], cl 1041 _.LVL123: 1042 _.LBE83: 1043 _.LBE82: 1174:config.c **** base = 16; 1044 .loc 1 1174 0 0 00001326 3C58 cmp al, 88 0 00001328 744D je _.L104 0 0000132A 895EFC mov word ptr [bp-4], bx 1048 _.LBB84: 1178:config.c **** if (q == NULL) 1049 .loc 1 1178 0 0 0000132D 98 cbw 0 0000132E 50 push ax 0 0000132F B8[5A00] mov ax, offset _digits.2179 0 00001332 50 push ax 0 00001333 E8[FEFF] call _init_strchr 1055 _.LVL124: 0 00001336 8946FE mov word ptr [bp-2], ax 1057 _.LVL125: 1179:config.c **** break; 1058 .loc 1 1179 0 0 00001339 85C0 test ax, ax 0 0000133B 8B5EFC mov bx, word ptr [bp-4] 0 0000133E 8A4EFB mov cl, byte ptr [bp-5] 0 00001341 7522 jne _.L100 1063 _.LVL126: 1064 _.L102: 1065 _.LBE84: 1066 _.LBE86: 1184:config.c **** return p; 1067 .loc 1 1184 0 0 00001343 96 xchg si, ax 0 00001344 F7E7 mul di 0 00001346 8B760A mov si, word ptr [bp+10] 1071 _.LVL127: 0 00001349 8904 mov word ptr [si], ax 1185:config.c **** } 1073 .loc 1 1185 0 0 0000134B EB0F jmp _.L93 1075 _.LVL128: 1076 _.L94: 1077 _.LBB87: 1078 _.LBB88: 2084:config.c **** } 1079 .loc 1 2084 0 0 0000134D 04D0 add al, -48 1081 _.LBE88: 1082 _.LBE87: 1155:config.c **** int n = 0; 1083 .loc 1 1155 0 0 0000134F BF0100 mov di, 1 1165:config.c **** { 1085 .loc 1 1165 0 0 00001352 3C09 cmp al, 9 0 00001354 76B7 jbe _.L96 1167:config.c **** return NULL; 1088 .loc 1 1167 0 0 00001356 53 push bx 0 00001357 E8A1FB call _CfgFailure 1091 _.LVL129: 1168:config.c **** } 1092 .loc 1 1168 0 0 0000135A 31DB xor bx, bx 1094 _.LVL130: 1095 _.L93: 1186:config.c **** 1096 .loc 1 1186 0 0 0000135C 93 xchg bx, ax 0 0000135D 89EC mov sp, bp 0 0000135F 5D pop bp 0 00001360 5F pop di 0 00001361 5E pop si 0 00001362 C20400 ret 4 1103 _.LVL131: 1104 _.L100: 1105 _.LBB89: 1106 _.LBB85: 1181:config.c **** } 1107 .loc 1 1181 0 0 00001365 88C8 mov al, cl 1109 _.LVL132: 0 00001367 30E4 xor ah, ah 0 00001369 F7E6 mul si 0 0000136B 96 xchg si, ax 1113 _.LVL133: 0 0000136C 8B46FE mov ax, word ptr [bp-2] 0 0000136F 2D[5A00] sub ax, offset _digits.2179 0 00001372 01C6 add si, ax 1117 _.LVL134: 1118 _.L99: 1119 _.LBE85: 1120 _.LBE89: 1171:config.c **** { 1121 .loc 1 1171 0 0 00001374 43 inc bx 1123 _.LVL135: 0 00001375 EB9A jmp _.L95 1125 _.L104: 1126 _.LBB90: 1175:config.c **** else 1127 .loc 1 1175 0 0 00001377 B110 mov cl, 16 1129 _.LVL136: 0 00001379 EBF9 jmp _.L99 1131 _.LBE90: 1132 _.LFE19: 1133 .size _GetNumArg, .-_GetNumArg 1134 .type _SetIdleHalt, @function 1135 _SetIdleHalt: 1136 _.LFB63: 2249:config.c **** COUNT haltlevel; 1137 .loc 1 2249 0 1138 _.LVL137: 0 0000137B 55 push bp 1140 _.LCFI31: 0 0000137C 89E5 mov bp, sp 1142 _.LCFI32: 0 0000137E 1E push ds 2251:config.c **** HaltCpuWhileIdle = haltlevel; /* 0 for no HLT, 1..n more, -1 max */ 1144 .loc 1 2251 0 0 0000137F 8D46FE lea ax, [-2+bp] 0 00001382 50 push ax 0 00001383 FF7604 push word ptr [bp+4] 0 00001386 E86BFF call _GetNumArg 1149 _.LVL138: 0 00001389 85C0 test ax, ax 0 0000138B 740C je _.L106 2252:config.c **** } 1152 .loc 1 2252 0 0 0000138D 8B46FE mov ax, word ptr [bp-2] 0 00001390 BA[0000] mov dx, offset _HaltCpuWhileIdle@OZSEG16 0 00001393 8EC2 mov es, dx 0 00001395 26A2[0000] mov byte ptr es:[_HaltCpuWhileIdle], al 1157 _.LVL139: 1158 _.L106: 2253:config.c **** 1159 .loc 1 2253 0 0 00001399 89EC mov sp, bp 0 0000139B 5D pop bp 0 0000139C C20200 ret 2 1163 _.LFE63: 1164 .size _SetIdleHalt, .-_SetIdleHalt 1165 .type _Files, @function 1166 _Files: 1167 _.LFB25: 1265:config.c **** COUNT nFiles; 1168 .loc 1 1265 0 1169 _.LVL140: 0 0000139F 55 push bp 1171 _.LCFI33: 0 000013A0 89E5 mov bp, sp 1173 _.LCFI34: 0 000013A2 1E push ds 1269:config.c **** return; 1175 .loc 1 1269 0 0 000013A3 8D46FE lea ax, [-2+bp] 0 000013A6 50 push ax 0 000013A7 FF7604 push word ptr [bp+4] 0 000013AA E847FF call _GetNumArg 1180 _.LVL141: 0 000013AD 85C0 test ax, ax 0 000013AF 7418 je _.L112 1273:config.c **** Config.cfgFilesHigh = 0; 1183 .loc 1 1273 0 0 000013B1 BB[0000] mov bx, offset _Config 0 000013B4 8A4702 mov al, byte ptr [bx+2] 0 000013B7 8B56FE mov dx, word ptr [bp-2] 0 000013BA 30E4 xor ah, ah 0 000013BC 39D0 cmp ax, dx 0 000013BE 7D01 jge _.L114 0 000013C0 92 xchg dx, ax 1191 _.L114: 0 000013C1 884702 mov byte ptr [bx+2], al 1274:config.c **** } 1193 .loc 1 1274 0 0 000013C4 C606[0300]00 mov byte ptr [_Config+3], 0 1195 _.L112: 1275:config.c **** 1196 .loc 1 1275 0 0 000013C9 89EC mov sp, bp 0 000013CB 5D pop bp 0 000013CC C20200 ret 2 1200 _.LFE25: 1201 .size _Files, .-_Files 1202 .type _FilesHigh, @function 1203 _FilesHigh: 1204 _.LFB26: 1278:config.c **** Files(pLine); 1205 .loc 1 1278 0 1206 _.LVL142: 0 000013CF 55 push bp 1208 _.LCFI35: 0 000013D0 89E5 mov bp, sp 1210 _.LCFI36: 1279:config.c **** Config.cfgFilesHigh = 1; 1211 .loc 1 1279 0 0 000013D2 FF7604 push word ptr [bp+4] 0 000013D5 E8C7FF call _Files 1214 _.LVL143: 1280:config.c **** } 1215 .loc 1 1280 0 0 000013D8 C606[0300]01 mov byte ptr [_Config+3], 1 1281:config.c **** 1217 .loc 1 1281 0 0 000013DD 89EC mov sp, bp 0 000013DF 5D pop bp 0 000013E0 C20200 ret 2 1221 _.LFE26: 1222 .size _FilesHigh, .-_FilesHigh 1223 .type _Config_Buffers, @function 1224 _Config_Buffers: 1225 _.LFB21: 1195:config.c **** COUNT nBuffers; 1226 .loc 1 1195 0 1227 _.LVL144: 0 000013E3 55 push bp 1229 _.LCFI37: 0 000013E4 89E5 mov bp, sp 1231 _.LCFI38: 0 000013E6 1E push ds 1199:config.c **** Config.cfgBuffers = nBuffers; 1233 .loc 1 1199 0 0 000013E7 8D46FE lea ax, [-2+bp] 0 000013EA 50 push ax 0 000013EB FF7604 push word ptr [bp+4] 0 000013EE E803FF call _GetNumArg 1238 _.LVL145: 0 000013F1 85C0 test ax, ax 0 000013F3 7406 je _.L122 1200:config.c **** } 1241 .loc 1 1200 0 0 000013F5 8B46FE mov ax, word ptr [bp-2] 0 000013F8 A2[0100] mov byte ptr [_Config+1], al 1244 _.L122: 1201:config.c **** 1245 .loc 1 1201 0 0 000013FB 89EC mov sp, bp 0 000013FD 5D pop bp 0 000013FE C20200 ret 2 1249 _.LFE21: 1250 .size _Config_Buffers, .-_Config_Buffers === Switch to base=012BB0h -> ".RODATA.STR1.1" 1251 .section .rodata.str1.1 1252 _.LC7: 0 000007AD 4E6F74653A204255 .string "Note: BUFFERS will be in HMA or low RAM, not in UMB\n" 0 000007B5 4646455253207769 0 000007BD 6C6C20626520696E 0 000007C5 20484D41206F7220 0 000007CD 6C6F772052414D2C 0 000007D5 206E6F7420696E20 0 000007DD 554D420A00 === Switch to base=002270h -> ".TEXT" 1254 .text 1255 .type _CfgBuffersHigh, @function 1256 _CfgBuffersHigh: 1257 _.LFB22: 1204:config.c **** Config_Buffers(pLine); 1258 .loc 1 1204 0 1259 _.LVL146: 0 00001401 55 push bp 1261 _.LCFI39: 0 00001402 89E5 mov bp, sp 1263 _.LCFI40: 1205:config.c **** if (InitKernelConfig.Verbose >= 0) printf("Note: BUFFERS will be in HMA or low RAM, not in UMB\n" 1264 .loc 1 1205 0 0 00001404 FF7604 push word ptr [bp+4] 0 00001407 E8D9FF call _Config_Buffers 1267 _.LVL147: 1206:config.c **** } 1268 .loc 1 1206 0 0 0000140A 803E[1500]00 cmp byte ptr [_InitKernelConfig+21], 0 0 0000140F 780A js _.L128 1206:config.c **** } 1271 .loc 1 1206 0 is_stmt 0 discriminator 1 0 00001411 B8[5D00] mov ax, offset _.LC7 0 00001414 50 push ax 0 00001415 E8[FEFF] call _init_printf 1275 _.LVL148: 0 00001418 83C402 add sp, 2 1277 _.L128: 1207:config.c **** 1278 .loc 1 1207 0 is_stmt 1 0 0000141B 89EC mov sp, bp 0 0000141D 5D pop bp 0 0000141E C20200 ret 2 1282 _.LFE22: 1283 .size _CfgBuffersHigh, .-_CfgBuffersHigh === Switch to base=012BB0h -> ".RODATA.STR1.1" 1284 .section .rodata.str1.1 1285 _.LC8: 0 000007E2 4368616E67696E67 .string "Changing reported version to %d.%d\n" 0 000007EA 207265706F727465 0 000007F2 642076657273696F 0 000007FA 6E20746F2025642E 0 00000802 25640A00 === Switch to base=002270h -> ".TEXT" 1287 .text 1288 .type _sysVersion, @function 1289 _sysVersion: 1290 _.LFB24: 1240:config.c **** COUNT major, minor; 1291 .loc 1 1240 0 1292 _.LVL149: 0 00001421 56 push si 0 00001422 57 push di 0 00001423 55 push bp 1296 _.LCFI41: 0 00001424 89E5 mov bp, sp 1298 _.LCFI42: 0 00001426 1E push ds 0 00001427 1E push ds 0 00001428 8B7608 mov si, word ptr [bp+8] 1242:config.c **** 1302 .loc 1 1242 0 0 0000142B B82E00 mov ax, 46 0 0000142E 50 push ax 0 0000142F 56 push si 0 00001430 E8[FEFF] call _init_strchr 1307 _.LVL150: 1244:config.c **** return; 1308 .loc 1 1244 0 0 00001433 85C0 test ax, ax 0 00001435 745C je _.L131 0 00001437 97 xchg di, ax 1312 _.LVL151: 1250:config.c **** return; 1313 .loc 1 1250 0 0 00001438 8D46FC lea ax, [-4+bp] 1315 _.LVL152: 0 0000143B 50 push ax 0 0000143C 56 push si 0 0000143D E8B4FE call _GetNumArg 1319 _.LVL153: 0 00001440 85C0 test ax, ax 0 00001442 744F je _.L131 1254:config.c **** return; 1322 .loc 1 1254 0 0 00001444 8D46FE lea ax, [-2+bp] 0 00001447 50 push ax 1247:config.c **** 1325 .loc 1 1247 0 0 00001448 8D4501 lea ax, [1+di] 1327 _.LVL154: 1254:config.c **** return; 1328 .loc 1 1254 0 0 0000144B 50 push ax 0 0000144C E8A5FE call _GetNumArg 1331 _.LVL155: 0 0000144F 85C0 test ax, ax 0 00001451 7440 je _.L131 1257:config.c **** 1334 .loc 1 1257 0 0 00001453 803E[1500]00 cmp byte ptr [_InitKernelConfig+21], 0 0 00001458 7810 js _.L133 1257:config.c **** 1337 .loc 1 1257 0 is_stmt 0 discriminator 1 0 0000145A FF76FE push word ptr [bp-2] 0 0000145D FF76FC push word ptr [bp-4] 0 00001460 B8[9200] mov ax, offset _.LC8 0 00001463 50 push ax 0 00001464 E8[FEFF] call _init_printf 1343 _.LVL156: 0 00001467 83C406 add sp, 6 1345 _.L133: 1259:config.c **** LoL->os_setver_minor = minor; /* not the internal os_minor */ 1346 .loc 1 1259 0 is_stmt 1 0 0000146A 8B1E[0000] mov bx, word ptr [_LoL] 0 0000146E 8B0E[0200] mov cx, word ptr [_LoL+2] 0 00001472 8B56FC mov dx, word ptr [bp-4] 0 00001475 8EC1 mov es, cx 0 00001477 2688979100 mov byte ptr es:[bx+145], dl 1352 _.LVL157: 1260:config.c **** ((psp far *)MK_FP(DOS_PSP, 0))->ps_retdosver = (minor << 8) + major; 1353 .loc 1 1260 0 0 0000147C 8B46FE mov ax, word ptr [bp-2] 0 0000147F 2688879000 mov byte ptr es:[bx+144], al 1261:config.c **** } 1356 .loc 1 1261 0 0 00001484 B108 mov cl, 8 0 00001486 D3E0 shl ax, cl 0 00001488 01D0 add ax, dx 0 0000148A BA6000 mov dx, 96 0 0000148D 8EC2 mov es, dx 0 0000148F 26A34000 mov word ptr es:[64], ax 1363 _.LVL158: 1364 _.L131: 1262:config.c **** 1365 .loc 1 1262 0 0 00001493 89EC mov sp, bp 0 00001495 5D pop bp 0 00001496 5F pop di 0 00001497 5E pop si 0 00001498 C20200 ret 2 1371 _.LFE24: 1372 .size _sysVersion, .-_sysVersion 1373 .type _sysScreenMode, @function 1374 _sysScreenMode: 1375 _.LFB23: 1213:config.c **** iregs r; 1376 .loc 1 1213 0 1377 _.LVL159: 0 0000149B 55 push bp 1379 _.LCFI43: 0 0000149C 89E5 mov bp, sp 1381 _.LCFI44: 0 0000149E 83EC1A sub sp, 26 1383 _.LVL160: 1219:config.c **** return; 1384 .loc 1 1219 0 0 000014A1 8D46E6 lea ax, [-26+bp] 0 000014A4 50 push ax 0 000014A5 FF7604 push word ptr [bp+4] 0 000014A8 E849FE call _GetNumArg 1389 _.LVL161: 0 000014AB 85C0 test ax, ax 0 000014AD 742F je _.L145 1222:config.c **** nFunc = 0; /* set lower screenmode */ 1392 .loc 1 1222 0 0 000014AF 8B46E6 mov ax, word ptr [bp-26] 0 000014B2 83F80F cmp ax, 15 0 000014B5 7E2D jle _.L150 1224:config.c **** return; /* do nothing; invalid screenmode */ 1396 .loc 1 1224 0 0 000014B7 89C2 mov dx, ax 0 000014B9 83C2EF add dx, -17 0 000014BC 83FA02 cmp dx, 1+1 0 000014BF 7205 jc _.L151 0 000014C1 83F814 cmp ax, 20 0 000014C4 7518 jne _.L145 1403 _.L151: 1216:config.c **** 1404 .loc 1 1216 0 0 000014C6 BA1100 mov dx, 17 1406 _.L147: 1407 _.LVL162: 1233:config.c **** r.a.b.l = nMode; 1408 .loc 1 1233 0 0 000014C9 8856E9 mov byte ptr [bp-23], dl 1234:config.c **** r.b.b.l = 0; 1410 .loc 1 1234 0 0 000014CC 8846E8 mov byte ptr [bp-24], al 1235:config.c **** init_call_intr(0x10, &r); 1412 .loc 1 1235 0 0 000014CF C646EA00 mov byte ptr [bp-22], 0 1236:config.c **** } 1414 .loc 1 1236 0 0 000014D3 8D46E8 lea ax, [-24+bp] 0 000014D6 50 push ax 0 000014D7 B81000 mov ax, 16 0 000014DA 50 push ax 0 000014DB E8[FEFF] call _init_call_intr 1420 _.LVL163: 1421 _.L145: 1237:config.c **** 1422 .loc 1 1237 0 0 000014DE 89EC mov sp, bp 0 000014E0 5D pop bp 0 000014E1 C20200 ret 2 1426 _.LVL164: 1427 _.L150: 1223:config.c **** else if ((nMode != 0x11) && (nMode != 0x12) && (nMode != 0x14)) 1428 .loc 1 1223 0 0 000014E4 31D2 xor dx, dx 0 000014E6 EBE1 jmp _.L147 1431 _.LFE23: 1432 .size _sysScreenMode, .-_sysScreenMode 1433 .type _Stacks, @function 1434 _Stacks: 1435 _.LFB37: 1715:config.c **** COUNT stacks; 1436 .loc 1 1715 0 1437 _.LVL165: 0 000014E8 56 push si 0 000014E9 57 push di 0 000014EA 55 push bp 1441 _.LCFI45: 0 000014EB 89E5 mov bp, sp 1443 _.LCFI46: 0 000014ED 1E push ds 1719:config.c **** Config.cfgStacks = stacks; 1445 .loc 1 1719 0 0 000014EE 8D7EFE lea di, [-2+bp] 0 000014F1 57 push di 0 000014F2 FF7608 push word ptr [bp+8] 0 000014F5 E8FCFD call _GetNumArg 1450 _.LVL166: 1720:config.c **** 1451 .loc 1 1720 0 0 000014F8 BE[0000] mov si, offset _Config 0 000014FB 8B56FE mov dx, word ptr [bp-2] 0 000014FE 88540C mov byte ptr [si+12], dl 1722:config.c **** 1455 .loc 1 1722 0 0 00001501 50 push ax 0 00001502 E803FD call _skipwh 1458 _.LVL167: 0 00001505 93 xchg bx, ax 1460 _.LVL168: 1724:config.c **** { 1461 .loc 1 1724 0 0 00001506 803F2C cmp byte ptr [bx], 44 0 00001509 750C jne _.L160 1464 _.LVL169: 1726:config.c **** Config.cfgStackSize = stacks; 1465 .loc 1 1726 0 0 0000150B 57 push di 0 0000150C 43 inc bx 1468 _.LVL170: 0 0000150D 53 push bx 0 0000150E E8E3FD call _GetNumArg 1471 _.LVL171: 1727:config.c **** } 1472 .loc 1 1727 0 0 00001511 8B46FE mov ax, word ptr [bp-2] 0 00001514 89440E mov word ptr [si+14], ax 1475 _.L160: 1730:config.c **** { 1476 .loc 1 1730 0 0 00001517 8A440C mov al, byte ptr [si+12] 0 0000151A 84C0 test al, al 0 0000151C 7422 je _.L162 1732:config.c **** Config.cfgStackSize = 32; 1480 .loc 1 1732 0 0 0000151E 837C0E1F cmp word ptr [si+14], 31 0 00001522 7706 ja _.L163 1733:config.c **** if (Config.cfgStackSize > 512) 1483 .loc 1 1733 0 0 00001524 C706[0E00]2000 mov word ptr [_Config+14], 32 1485 _.L163: 1734:config.c **** Config.cfgStackSize = 512; 1486 .loc 1 1734 0 0 0000152A 817C0E0002 cmp word ptr [si+14], 512 0 0000152F 7606 jbe _.L164 1735:config.c **** if (Config.cfgStacks > 64) 1489 .loc 1 1735 0 0 00001531 C706[0E00]0002 mov word ptr [_Config+14], 512 1491 _.L164: 1736:config.c **** Config.cfgStacks = 64; 1492 .loc 1 1736 0 0 00001537 3C40 cmp al, 64 0 00001539 7E05 jle _.L162 1737:config.c **** } 1495 .loc 1 1737 0 0 0000153B C606[0C00]40 mov byte ptr [_Config+12], 64 1497 _.L162: 1739:config.c **** } 1498 .loc 1 1739 0 0 00001540 C606[0D00]00 mov byte ptr [_Config+13], 0 1740:config.c **** 1500 .loc 1 1740 0 0 00001545 89EC mov sp, bp 0 00001547 5D pop bp 0 00001548 5F pop di 0 00001549 5E pop si 0 0000154A C20200 ret 2 1506 _.LFE37: 1507 .size _Stacks, .-_Stacks 1508 .type _StacksHigh, @function 1509 _StacksHigh: 1510 _.LFB38: 1743:config.c **** Stacks(pLine); 1511 .loc 1 1743 0 1512 _.LVL172: 0 0000154D 55 push bp 1514 _.LCFI47: 0 0000154E 89E5 mov bp, sp 1516 _.LCFI48: 1744:config.c **** Config.cfgStacksHigh = 1; 1517 .loc 1 1744 0 0 00001550 FF7604 push word ptr [bp+4] 0 00001553 E892FF call _Stacks 1520 _.LVL173: 1745:config.c **** } 1521 .loc 1 1745 0 0 00001556 C606[0D00]01 mov byte ptr [_Config+13], 1 1746:config.c **** 1523 .loc 1 1746 0 0 0000155B 89EC mov sp, bp 0 0000155D 5D pop bp 0 0000155E C20200 ret 2 1527 _.LFE38: 1528 .size _StacksHigh, .-_StacksHigh 1529 .type _Fcbs, @function 1530 _Fcbs: 1531 _.LFB33: 1453:config.c **** /* Format: FCBS = totalFcbs [,protectedFcbs] */ 1532 .loc 1 1453 0 1533 _.LVL174: 0 00001561 56 push si 0 00001562 57 push di 0 00001563 55 push bp 1537 _.LCFI49: 0 00001564 89E5 mov bp, sp 1539 _.LCFI50: 0 00001566 1E push ds 1457:config.c **** return; 1541 .loc 1 1457 0 0 00001567 8D7EFE lea di, [-2+bp] 0 0000156A 57 push di 0 0000156B FF7608 push word ptr [bp+8] 0 0000156E E883FD call _GetNumArg 1546 _.LVL175: 0 00001571 85C0 test ax, ax 0 00001573 742A je _.L169 1459:config.c **** 1549 .loc 1 1459 0 0 00001575 BE[0000] mov si, offset _Config 0 00001578 8B56FE mov dx, word ptr [bp-2] 0 0000157B 885404 mov byte ptr [si+4], dl 1461:config.c **** 1553 .loc 1 1461 0 0 0000157E 50 push ax 0 0000157F E886FC call _skipwh 1556 _.LVL176: 0 00001582 93 xchg bx, ax 1558 _.LVL177: 1463:config.c **** { 1559 .loc 1 1463 0 0 00001583 803F2C cmp byte ptr [bx], 44 0 00001586 750C jne _.L171 1562 _.LVL178: 1465:config.c **** Config.cfgProtFcbs = fcbs; 1563 .loc 1 1465 0 0 00001588 57 push di 0 00001589 43 inc bx 1566 _.LVL179: 0 0000158A 53 push bx 0 0000158B E866FD call _GetNumArg 1569 _.LVL180: 1466:config.c **** } 1570 .loc 1 1466 0 0 0000158E 8B46FE mov ax, word ptr [bp-2] 0 00001591 884405 mov byte ptr [si+5], al 1573 _.L171: 1574 _.LVL181: 1575 _.LBB93: 1576 _.LBB94: 1469:config.c **** Config.cfgProtFcbs = Config.cfgFcbs; 1577 .loc 1 1469 0 0 00001594 8A4404 mov al, byte ptr [si+4] 0 00001597 384405 cmp byte ptr [si+5], al 0 0000159A 7603 jbe _.L169 1470:config.c **** } 1581 .loc 1 1470 0 0 0000159C 884405 mov byte ptr [si+5], al 1583 _.LVL182: 1584 _.L169: 1585 _.LBE94: 1586 _.LBE93: 1471:config.c **** 1587 .loc 1 1471 0 0 0000159F 89EC mov sp, bp 0 000015A1 5D pop bp 0 000015A2 5F pop di 0 000015A3 5E pop si 0 000015A4 C20200 ret 2 1593 _.LFE33: 1594 .size _Fcbs, .-_Fcbs 1595 .type _CfgMenuDefault, @function 1596 _CfgMenuDefault: 1597 _.LFB68: 2435:config.c **** COUNT num = 0; 1598 .loc 1 2435 0 1599 _.LVL183: 0 000015A7 55 push bp 1601 _.LCFI51: 0 000015A8 89E5 mov bp, sp 1603 _.LCFI52: 0 000015AA 1E push ds 2436:config.c **** 1605 .loc 1 2436 0 0 000015AB C746FE0000 mov word ptr [bp-2], 0 2438:config.c **** 1607 .loc 1 2438 0 0 000015B0 FF7604 push word ptr [bp+4] 0 000015B3 E852FC call _skipwh 1610 _.LVL184: 0 000015B6 89C3 mov bx, ax 1612 _.LVL185: 2440:config.c **** { 1613 .loc 1 2440 0 0 000015B8 803F3D cmp byte ptr [bx], 61 0 000015BB 740A je _.L178 2442:config.c **** return; 1616 .loc 1 2442 0 0 000015BD 50 push ax 0 000015BE E83AF9 call _CfgFailure 1619 _.LVL186: 1620 _.L177: 2456:config.c **** 1621 .loc 1 2456 0 0 000015C1 89EC mov sp, bp 0 000015C3 5D pop bp 0 000015C4 C20200 ret 2 1625 _.LVL187: 1626 _.L178: 2445:config.c **** 1627 .loc 1 2445 0 0 000015C7 43 inc bx 0 000015C8 53 push bx 0 000015C9 E83CFC call _skipwh 1631 _.LVL188: 2448:config.c **** MenuSelected = num; 1632 .loc 1 2448 0 0 000015CC 8D56FE lea dx, [-2+bp] 0 000015CF 52 push dx 0 000015D0 50 push ax 0 000015D1 E820FD call _GetNumArg 1637 _.LVL189: 2449:config.c **** pLine = skipwh(pLine); 1638 .loc 1 2449 0 0 000015D4 8B56FE mov dx, word ptr [bp-2] 0 000015D7 8816[0000] mov byte ptr [_MenuSelected], dl 2450:config.c **** 1641 .loc 1 2450 0 0 000015DB 50 push ax 0 000015DC E829FC call _skipwh 1644 _.LVL190: 0 000015DF 93 xchg bx, ax 1646 _.LVL191: 2452:config.c **** { 1647 .loc 1 2452 0 0 000015E0 803F2C cmp byte ptr [bx], 44 0 000015E3 75DC jne _.L177 1650 _.LVL192: 2454:config.c **** } 1651 .loc 1 2454 0 0 000015E5 B8[0000] mov ax, offset _MenuTimeout 1653 _.LVL193: 0 000015E8 50 push ax 0 000015E9 43 inc bx 1656 _.LVL194: 0 000015EA 53 push bx 0 000015EB E806FD call _GetNumArg 1659 _.LVL195: 0 000015EE EBD1 jmp _.L177 1661 _.LFE68: 1662 .size _CfgMenuDefault, .-_CfgMenuDefault 1663 .type _CfgMenuColor, @function 1664 _CfgMenuColor: 1665 _.LFB70: 2486:config.c **** int num = 0; 1666 .loc 1 2486 0 1667 _.LVL196: 0 000015F0 56 push si 0 000015F1 55 push bp 1670 _.LCFI53: 0 000015F2 89E5 mov bp, sp 1672 _.LCFI54: 0 000015F4 1E push ds 0 000015F5 1E push ds 2487:config.c **** unsigned char fg, bg = 0; 1675 .loc 1 2487 0 0 000015F6 C746FE0000 mov word ptr [bp-2], 0 1677 _.LVL197: 2490:config.c **** 1678 .loc 1 2490 0 0 000015FB FF7606 push word ptr [bp+6] 0 000015FE E807FC call _skipwh 1681 _.LVL198: 2492:config.c **** pLine = skipwh(pLine + 1); 1682 .loc 1 2492 0 0 00001601 89C3 mov bx, ax 0 00001603 803F3D cmp byte ptr [bx], 61 0 00001606 7505 jne _.L183 2493:config.c **** 1686 .loc 1 2493 0 0 00001608 40 inc ax 1688 _.LVL199: 0 00001609 50 push ax 0 0000160A E8FBFB call _skipwh 1691 _.LVL200: 1692 _.L183: 2495:config.c **** if (pLine == 0) 1693 .loc 1 2495 0 0 0000160D 8D76FE lea si, [-2+bp] 0 00001610 56 push si 0 00001611 50 push ax 0 00001612 E8DFFC call _GetNumArg 1698 _.LVL201: 2496:config.c **** return; 1699 .loc 1 2496 0 0 00001615 85C0 test ax, ax 0 00001617 742E je _.L182 2498:config.c **** 1702 .loc 1 2498 0 0 00001619 8B56FE mov dx, word ptr [bp-2] 0 0000161C 8956FC mov word ptr [bp-4], dx 1705 _.LVL202: 2500:config.c **** 1706 .loc 1 2500 0 0 0000161F 50 push ax 0 00001620 E8E5FB call _skipwh 1709 _.LVL203: 0 00001623 93 xchg bx, ax 1711 _.LVL204: 2488:config.c **** 1712 .loc 1 2488 0 0 00001624 30C0 xor al, al 1714 _.LVL205: 2502:config.c **** { 1715 .loc 1 2502 0 0 00001626 803F2C cmp byte ptr [bx], 44 0 00001629 7511 jne _.L185 2504:config.c **** if (pLine == 0) 1718 .loc 1 2504 0 0 0000162B 43 inc bx 1720 _.LVL206: 0 0000162C 53 push bx 0 0000162D E8D8FB call _skipwh 1723 _.LVL207: 0 00001630 56 push si 0 00001631 50 push ax 0 00001632 E8BFFC call _GetNumArg 1727 _.LVL208: 2505:config.c **** return; 1728 .loc 1 2505 0 0 00001635 85C0 test ax, ax 0 00001637 740E je _.L182 2507:config.c **** } 1731 .loc 1 2507 0 0 00001639 8A46FE mov al, byte ptr [bp-2] 1733 _.LVL209: 1734 _.L185: 2509:config.c **** } 1735 .loc 1 2509 0 0 0000163C B104 mov cl, 4 0 0000163E D2E0 shl al, cl 1738 _.LVL210: 0 00001640 0A46FC or al, byte ptr [bp-4] 0 00001643 50 push ax 0 00001644 E88BF9 call _ClearScreen 1742 _.LVL211: 1743 _.L182: 2510:config.c **** 1744 .loc 1 2510 0 0 00001647 89EC mov sp, bp 0 00001649 5D pop bp 0 0000164A 5E pop si 0 0000164B C20200 ret 2 1749 _.LFE70: 1750 .size _CfgMenuColor, .-_CfgMenuColor === Switch to base=012BB0h -> ".RODATA.STR1.1" 1751 .section .rodata.str1.1 1752 _.LC9: 0 00000806 4D75737420737461 .string "Must start at 0xac..0x1de, not 0x100..0x104\n" 0 0000080E 7274206174203078 0 00000816 61632E2E30783164 0 0000081E 652C206E6F742030 0 00000826 783130302E2E3078 0 0000082E 3130340A00 === Switch to base=002270h -> ".TEXT" 1754 .text 1755 .type _CfgKeyBuf, @function 1756 _CfgKeyBuf: 1757 _.LFB34: 1483:config.c **** /* Format: KEYBUF = startoffset [,endoffset] */ 1758 .loc 1 1483 0 1759 _.LVL212: 0 0000164E 55 push bp 1761 _.LCFI55: 0 0000164F 89E5 mov bp, sp 1763 _.LCFI56: 0 00001651 1E push ds 0 00001652 1E push ds 1766 _.LVL213: 1489:config.c **** return; 1767 .loc 1 1489 0 0 00001653 8D46FC lea ax, [-4+bp] 0 00001656 50 push ax 0 00001657 FF7604 push word ptr [bp+4] 0 0000165A E897FC call _GetNumArg 1772 _.LVL214: 0 0000165D 85C0 test ax, ax 0 0000165F 746E je _.L195 1491:config.c **** endbuf = (startbuf | 0xff)+1; /* default end: end of the same "page" */ 1775 .loc 1 1491 0 0 00001661 50 push ax 0 00001662 E8A3FB call _skipwh 1778 _.LVL215: 0 00001665 93 xchg bx, ax 1780 _.LVL216: 1492:config.c **** if (*pLine == ',') 1781 .loc 1 1492 0 0 00001666 8B46FC mov ax, word ptr [bp-4] 1783 _.LVL217: 0 00001669 B0FF mov al, 255 0 0000166B 40 inc ax 0 0000166C 8946FE mov word ptr [bp-2], ax 1493:config.c **** { 1787 .loc 1 1493 0 0 0000166F 803F2C cmp byte ptr [bx], 44 0 00001672 744E je _.L197 1790 _.LVL218: 1791 _.L200: 1498:config.c **** endbuf &= 0xfffe; 1792 .loc 1 1498 0 0 00001674 8B56FC mov dx, word ptr [bp-4] 0 00001677 83E2FE and dx, -2 0 0000167A 8956FC mov word ptr [bp-4], dx 1499:config.c **** if (endbuf=0x100 && startbuf<0x105) || startbuf>0x1de) 1815 .loc 1 1502 0 0 0000169B C746FC0000 mov word ptr [bp-4], 0 1817 _.L201: 1503:config.c **** { /* 50:0 / 50:4 are for prtscr / A:/B: DJ */ 1818 .loc 1 1503 0 0 000016A0 8B56FC mov dx, word ptr [bp-4] 0 000016A3 89D0 mov ax, dx 0 000016A5 FECC dec ah 0 000016A7 83F805 cmp ax, 4+1 0 000016AA 720A jc _.L206 0 000016AC 89D0 mov ax, dx 0 000016AE 0554FF add ax, -172 0 000016B1 3D3301 cmp ax, 306+1 0 000016B4 721F jc _.L202 1828 _.L206: 1505:config.c **** return; 1829 .loc 1 1505 0 0 000016B6 B8[B600] mov ax, offset _.LC9 0 000016B9 50 push ax 0 000016BA E8[FEFF] call _init_printf 1833 _.LVL219: 1506:config.c **** } 1834 .loc 1 1506 0 0 000016BD 83C402 add sp, 2 0 000016C0 EB0D jmp _.L195 1837 _.LVL220: 1838 _.L197: 1495:config.c **** return; 1839 .loc 1 1495 0 0 000016C2 43 inc bx 1841 _.LVL221: 0 000016C3 8D46FE lea ax, [-2+bp] 0 000016C6 50 push ax 0 000016C7 53 push bx 0 000016C8 E829FC call _GetNumArg 1846 _.LVL222: 0 000016CB 85C0 test ax, ax 0 000016CD 75A5 jne _.L200 1849 _.LVL223: 1850 _.L195: 1513:config.c **** 1851 .loc 1 1513 0 0 000016CF 89EC mov sp, bp 0 000016D1 5D pop bp 0 000016D2 C20200 ret 2 1855 _.L202: 1508:config.c **** keyfill[1] = startbuf; 1856 .loc 1 1508 0 0 000016D5 B84000 mov ax, 64 0 000016D8 8EC0 mov es, ax 0 000016DA 2689161A00 mov word ptr es:[26], dx 1509:config.c **** keyrange[0] = startbuf; 1860 .loc 1 1509 0 0 000016DF 8B56FC mov dx, word ptr [bp-4] 0 000016E2 2689161C00 mov word ptr es:[28], dx 1510:config.c **** keyrange[1] = endbuf; 1863 .loc 1 1510 0 0 000016E7 8B56FC mov dx, word ptr [bp-4] 0 000016EA 2689168000 mov word ptr es:[128], dx 1511:config.c **** keycheck(); 1866 .loc 1 1511 0 0 000016EF 8B56FE mov dx, word ptr [bp-2] 0 000016F2 2689168200 mov word ptr es:[130], dx 1512:config.c **** } 1869 .loc 1 1512 0 0 000016F7 E8[FEFF] call _keycheck 1871 _.LVL224: 0 000016FA EBD3 jmp _.L195 1873 _.LFE34: 1874 .size _CfgKeyBuf, .-_CfgKeyBuf 1875 .type _CfgSwitches, @function 1876 _CfgSwitches: 1877 _.LFB32: 1393:config.c **** pLine = skipwh(pLine); 1878 .loc 1 1393 0 1879 _.LVL225: 0 000016FC 56 push si 0 000016FD 57 push di 0 000016FE 55 push bp 1883 _.LCFI57: 0 000016FF 89E5 mov bp, sp 1885 _.LCFI58: 0 00001701 1E push ds 1394:config.c **** if (*pLine == '=') 1887 .loc 1 1394 0 0 00001702 FF7608 push word ptr [bp+8] 0 00001705 E800FB call _skipwh 1890 _.LVL226: 0 00001708 96 xchg si, ax 1892 _.LVL227: 1395:config.c **** { 1893 .loc 1 1395 0 0 00001709 803C3D cmp byte ptr [si], 61 0 0000170C 7506 jne _.L220 1397:config.c **** } 1896 .loc 1 1397 0 0 0000170E 46 inc si 0 0000170F 56 push si 1899 _.LVL228: 1900 _.L245: 1447:config.c **** } 1901 .loc 1 1447 0 0 00001710 E8F5FA call _skipwh 1903 _.LVL229: 0 00001713 96 xchg si, ax 1905 _.LVL230: 1906 _.L220: 1399:config.c **** { 1907 .loc 1 1399 0 0 00001714 8A04 mov al, byte ptr [si] 1909 _.LVL231: 0 00001716 84C0 test al, al 0 00001718 750D jne _.L236 1449:config.c **** } 1912 .loc 1 1449 0 0 0000171A C606[E301]01 mov byte ptr [_commands+2], 1 1450:config.c **** 1914 .loc 1 1450 0 0 0000171F 89EC mov sp, bp 0 00001721 5D pop bp 0 00001722 5F pop di 0 00001723 5E pop si 1919 _.LVL232: 0 00001724 C20200 ret 2 1921 _.LVL233: 1922 _.L236: 1401:config.c **** pLine++; 1923 .loc 1 1401 0 0 00001727 3C2F cmp al, 47 0 00001729 7403E9AD00 jne _.L221 1402:config.c **** switch(toupper(*pLine)) { 1926 .loc 1 1402 0 0 0000172E 8D7C01 lea di, [1+si] 1928 _.LVL234: 1403:config.c **** case 'K': 1929 .loc 1 1403 0 0 00001731 8A5401 mov dl, byte ptr [si+1] 1931 _.LVL235: 1932 _.LBB100: 1933 _.LBB101: 2090:config.c **** c -= 'a' - 'A'; 1934 .loc 1 2090 0 0 00001734 88D6 mov dh, dl 0 00001736 80C69F add dh, -97 0 00001739 80FE19 cmp dh, 25 0 0000173C 7703 ja _.L222 2091:config.c **** return c; 1939 .loc 1 2091 0 0 0000173E 80C2E0 add dl, -32 1941 _.LVL236: 1942 _.L222: 1943 _.LBE101: 1944 _.LBE100: 1403:config.c **** case 'K': 1945 .loc 1 1403 0 0 00001741 80FA46 cmp dl, 70 0 00001744 7436 je _.L224 0 00001746 7F0B jg _.L225 0 00001748 80FA45 cmp dl, 69 0 0000174B 7436 je _.L226 1951 _.L223: 1442:config.c **** } 1952 .loc 1 1442 0 0 0000174D 57 push di 0 0000174E E8AAF7 call _CfgFailure 1955 _.LVL237: 0 00001751 EB23 jmp _.L229 1957 _.L225: 1403:config.c **** case 'K': 1958 .loc 1 1403 0 0 00001753 80FA4B cmp dl, 75 0 00001756 740C je _.L227 0 00001758 80FA4E cmp dl, 78 0 0000175B 75F0 jne _.L223 1409:config.c **** break; 1963 .loc 1 1409 0 0 0000175D C606[0A00]FF mov byte ptr [_InitKernelConfig+10], -1 1410:config.c **** case 'F': 1965 .loc 1 1410 0 0 00001762 EB12 jmp _.L229 1967 _.L227: 1405:config.c **** kbdType = 0; /* force conv keyb */ 1968 .loc 1 1405 0 0 00001764 803E[E301]01 cmp byte ptr [_commands+2], 1 0 00001769 750B jne _.L229 1406:config.c **** break; 1971 .loc 1 1406 0 0 0000176B BA[0000] mov dx, offset _kbdType@OZSEG16 0 0000176E 8EC2 mov es, dx 0 00001770 26C606[0000]00 mov byte ptr es:[_kbdType], 0 1975 _.L229: 1447:config.c **** } 1976 .loc 1 1447 0 0 00001776 8D4501 lea ax, [1+di] 0 00001779 50 push ax 0 0000177A EB94 jmp _.L245 1980 _.L224: 1412:config.c **** break; 1981 .loc 1 1412 0 0 0000177C C606[0A00]00 mov byte ptr [_InitKernelConfig+10], 0 1413:config.c **** case 'E': /* /E[[:]nnnn] Set the desired EBDA amount to move in bytes */ 1983 .loc 1 1413 0 0 00001781 EBF3 jmp _.L229 1985 _.L226: 1986 _.LBB102: 1416:config.c **** if (*++pLine == ':') 1987 .loc 1 1416 0 0 00001783 C746FE0000 mov word ptr [bp-2], 0 1989 _.LVL238: 1417:config.c **** pLine++; /* skip optional separator */ 1990 .loc 1 1417 0 0 00001788 8A6402 mov ah, byte ptr [si+2] 0 0000178B 80FC3A cmp ah, 58 0 0000178E 7415 je _.L230 0 00001790 8D5402 lea dx, [2+si] 1995 _.LVL239: 1996 _.L231: 1997 _.LBB103: 1998 _.LBB104: 2084:config.c **** } 1999 .loc 1 2084 0 0 00001793 88E0 mov al, ah 0 00001795 04D0 add al, -48 2002 _.LBE104: 2003 _.LBE103: 1419:config.c **** { 2004 .loc 1 1419 0 0 00001797 3C0A cmp al, 9+1 0 00001799 7212 jc _.L232 0 0000179B 80FC2D cmp ah, 45 0 0000179E 740D je _.L232 1421:config.c **** break; 2009 .loc 1 1421 0 0 000017A0 4A dec dx 2011 _.LVL240: 0 000017A1 89D7 mov di, dx 2013 _.LVL241: 1422:config.c **** } 2014 .loc 1 1422 0 0 000017A3 EBD1 jmp _.L229 2016 _.LVL242: 2017 _.L230: 1418:config.c **** if (!(isnum(*pLine) || (*pLine == '-'))) 2018 .loc 1 1418 0 0 000017A5 8D5403 lea dx, [3+si] 2020 _.LVL243: 0 000017A8 8A6403 mov ah, byte ptr [si+3] 0 000017AB EBE6 jmp _.L231 2023 _.L232: 1424:config.c **** /* allowed values: [48..1024] bytes, multiples of 16 2024 .loc 1 1424 0 0 000017AD 8D46FE lea ax, [-2+bp] 0 000017B0 50 push ax 0 000017B1 52 push dx 0 000017B2 E83FFB call _GetNumArg 2029 _.LVL244: 0 000017B5 48 dec ax 0 000017B6 97 xchg di, ax 2032 _.LVL245: 1429:config.c **** { 2033 .loc 1 1429 0 0 000017B7 8B56FE mov dx, word ptr [bp-2] 0 000017BA 83FAFF cmp dx, -1 0 000017BD 7506 jne _.L234 2037 _.L244: 1436:config.c **** break; 2038 .loc 1 1436 0 0 000017BF 8916[1100] mov word ptr [_Config+17], dx 1437:config.c **** } 2040 .loc 1 1437 0 0 000017C3 EBB1 jmp _.L229 2042 _.L234: 1434:config.c **** { 2043 .loc 1 1434 0 0 000017C5 89D1 mov cx, dx 0 000017C7 83C1D0 add cx, -48 0 000017CA 81F9D003 cmp cx, 976 0 000017CE 7603E97AFF ja _.L223 1436:config.c **** break; 2048 .loc 1 1436 0 0 000017D3 83C20F add dx, 15 0 000017D6 83E2F0 and dx, -16 0 000017D9 EBE4 jmp _.L244 2052 _.LVL246: 2053 _.L221: 2054 _.LBE102: 1445:config.c **** } 2055 .loc 1 1445 0 0 000017DB 56 push si 0 000017DC E81CF7 call _CfgFailure 2058 _.LVL247: 0 000017DF 89F7 mov di, si 0 000017E1 EB93 jmp _.L229 2061 _.LFE32: 2062 .size _CfgSwitches, .-_CfgSwitches 2063 .type _CfgLastdrive, @function 2064 _CfgLastdrive: 2065 _.LFB27: 1284:config.c **** /* Format: LASTDRIVE = letter */ 2066 .loc 1 1284 0 2067 _.LVL248: 0 000017E3 55 push bp 2069 _.LCFI59: 0 000017E4 89E5 mov bp, sp 2071 _.LCFI60: 1288:config.c **** drv = toupper(*pLine); 2072 .loc 1 1288 0 0 000017E6 FF7604 push word ptr [bp+4] 0 000017E9 E81CFA call _skipwh 2075 _.LVL249: 1289:config.c **** 2076 .loc 1 1289 0 0 000017EC 89C3 mov bx, ax 0 000017EE 8A37 mov dh, byte ptr [bx] 2079 _.LVL250: 2080 _.LBB107: 2081 _.LBB108: 2090:config.c **** c -= 'a' - 'A'; 2082 .loc 1 2090 0 0 000017F0 88F2 mov dl, dh 0 000017F2 80C29F add dl, -97 0 000017F5 80FA19 cmp dl, 25 0 000017F8 7703 ja _.L247 2091:config.c **** return c; 2087 .loc 1 2091 0 0 000017FA 80C6E0 add dh, -32 2089 _.LVL251: 2090 _.L247: 2091 _.LBE108: 2092 _.LBE107: 1291:config.c **** { 2093 .loc 1 1291 0 0 000017FD 88F2 mov dl, dh 0 000017FF 80C2BF add dl, -65 0 00001802 80FA19 cmp dl, 25 0 00001805 7609 jbe _.L248 1293:config.c **** return; 2098 .loc 1 1293 0 0 00001807 894604 mov word ptr [bp+4], ax 1300:config.c **** 2100 .loc 1 1300 0 0 0000180A 89EC mov sp, bp 0 0000180C 5D pop bp 1293:config.c **** return; 2103 .loc 1 1293 0 0 0000180D E9EBF6 jmp _CfgFailure 2105 _.LVL252: 2106 _.L248: 1296:config.c **** if (drv > Config.cfgLastdrive) 2107 .loc 1 1296 0 0 00001810 80C6C0 add dh, -64 2109 _.LVL253: 1297:config.c **** Config.cfgLastdrive = drv; 2110 .loc 1 1297 0 0 00001813 BB[0000] mov bx, offset _Config 0 00001816 8A570A mov dl, byte ptr [bx+10] 0 00001819 38F2 cmp dl, dh 0 0000181B 7303 jnc _.L249 1298:config.c **** Config.cfgLastdriveHigh = 0; 2115 .loc 1 1298 0 0 0000181D 88770A mov byte ptr [bx+10], dh 2117 _.L249: 1299:config.c **** } 2118 .loc 1 1299 0 0 00001820 C606[0B00]00 mov byte ptr [_Config+11], 0 1300:config.c **** 2120 .loc 1 1300 0 0 00001825 89EC mov sp, bp 0 00001827 5D pop bp 0 00001828 C20200 ret 2 2124 _.LFE27: 2125 .size _CfgLastdrive, .-_CfgLastdrive 2126 .type _CfgLastdriveHigh, @function 2127 _CfgLastdriveHigh: 2128 _.LFB28: 1303:config.c **** /* Format: LASTDRIVEHIGH = letter */ 2129 .loc 1 1303 0 2130 _.LVL254: 0 0000182B 55 push bp 2132 _.LCFI61: 0 0000182C 89E5 mov bp, sp 2134 _.LCFI62: 1305:config.c **** Config.cfgLastdriveHigh = 1; 2135 .loc 1 1305 0 0 0000182E FF7604 push word ptr [bp+4] 0 00001831 E8AFFF call _CfgLastdrive 2138 _.LVL255: 1306:config.c **** } 2139 .loc 1 1306 0 0 00001834 C606[0B00]01 mov byte ptr [_Config+11], 1 1307:config.c **** 2141 .loc 1 1307 0 0 00001839 89EC mov sp, bp 0 0000183B 5D pop bp 0 0000183C C20200 ret 2 2145 _.LFE28: 2146 .size _CfgLastdriveHigh, .-_CfgLastdriveHigh 2147 .type _mumcb_init, @function 2148 _mumcb_init: 2149 _.LFB58: 2121:config.c **** static mcb near_mcb = { 2150 .loc 1 2121 0 2151 _.LVL256: 0 0000183F 55 push bp 2153 _.LCFI63: 0 00001840 89E5 mov bp, sp 2155 _.LCFI64: 2156 _.LVL257: 2157 _.LBB111: 2158 _.LBB112: 2109:config.c **** fmemcpy(MK_FP(seg, 0), near_mcb, sizeof(mcb)); 2159 .loc 1 2109 0 0 00001842 BB[6B00] mov bx, offset _near_mcb.2446 0 00001845 8B4606 mov ax, word ptr [bp+6] 0 00001848 894703 mov word ptr [bx+3], ax 2110:config.c **** } 2163 .loc 1 2110 0 0 0000184B B81000 mov ax, 16 0 0000184E 50 push ax 0 0000184F 16 push ss 0 00001850 53 push bx 0 00001851 FF7604 push word ptr [bp+4] 0 00001854 31C0 xor ax, ax 0 00001856 50 push ax 0 00001857 E8[FEFF] call _init_fmemcpy 2172 _.LVL258: 2173 _.LBE112: 2174 _.LBE111: 2129:config.c **** #endif 2175 .loc 1 2129 0 0 0000185A 89EC mov sp, bp 0 0000185C 5D pop bp 0 0000185D C20400 ret 4 2179 _.LFE58: 2180 .size _mumcb_init, .-_mumcb_init 2181 .global _findend 2182 .type _findend, @function 2183 _findend: 2184 _.LFB7: 308:config.c **** int nLen = 0; 2185 .loc 1 308 0 2186 _.LVL259: 0 00001860 56 push si 0 00001861 57 push di 0 00001862 55 push bp 2190 _.LCFI65: 0 00001863 89E5 mov bp, sp 2192 _.LCFI66: 2193 _.LVL260: 311:config.c **** { 2194 .loc 1 311 0 0 00001865 8B7E08 mov di, word ptr [bp+8] 2196 _.LVL261: 2197 _.L256: 0 00001868 89FE mov si, di 0 0000186A 2B7608 sub si, word ptr [bp+8] 2200 _.LVL262: 0 0000186D 803D00 cmp byte ptr [di], 0 0 00001870 7509 jne _.L258 2203 _.L255: 321:config.c **** 2204 .loc 1 321 0 0 00001872 96 xchg si, ax 0 00001873 89EC mov sp, bp 0 00001875 5D pop bp 0 00001876 5F pop di 2209 _.LVL263: 0 00001877 5E pop si 2211 _.LVL264: 0 00001878 C20200 ret 2 2213 _.LVL265: 2214 _.L258: 2215 _.LBB113: 313:config.c **** /* ah, more than 9 whitespaces ? We're done here (hrmph!) */ 2216 .loc 1 313 0 0 0000187B 57 push di 0 0000187C E889F9 call _skipwh 2219 _.LVL266: 315:config.c **** break; 2220 .loc 1 315 0 0 0000187F 29F8 sub ax, di 2222 _.LVL267: 0 00001881 83F809 cmp ax, 9 0 00001884 7FEC jg _.L255 2225 _.LVL268: 318:config.c **** } 2226 .loc 1 318 0 0 00001886 47 inc di 2228 _.LVL269: 0 00001887 EBDF jmp _.L256 2230 _.LBE113: 2231 _.LFE7: 2232 .size _findend, .-_findend 2233 .type _CfgMenu, @function 2234 _CfgMenu: 2235 _.LFB65: 2267:config.c **** int nLen; 2236 .loc 1 2267 0 2237 _.LVL270: 0 00001889 56 push si 0 0000188A 57 push di 0 0000188B 55 push bp 2241 _.LCFI67: 0 0000188C 89E5 mov bp, sp 2243 _.LCFI68: 0 0000188E 1E push ds 0 0000188F 1E push ds 2246 _.LVL271: 2271:config.c **** if (MenuColor == -1) 2247 .loc 1 2271 0 0 00001890 FF7608 push word ptr [bp+8] 0 00001893 B8[0000] mov ax, offset _.LC0 0 00001896 50 push ax 0 00001897 E8[FEFF] call _init_printf 2252 _.LVL272: 2272:config.c **** return; 2253 .loc 1 2272 0 0 0000189A 83C404 add sp, 4 0 0000189D 833E[0000]FF cmp word ptr [_MenuColor], -1 0 000018A2 7472 je _.L261 2257 _.LVL273: 2258 _.LBB119: 2259 _.LBB120: 2275:config.c **** 2260 .loc 1 2275 0 0 000018A4 FF7608 push word ptr [bp+8] 0 000018A7 E85EF9 call _skipwh 2263 _.LVL274: 0 000018AA 93 xchg bx, ax 2265 _.LVL275: 2266 _.L263: 2279:config.c **** pLine++; 2267 .loc 1 2279 0 0 000018AB 8A07 mov al, byte ptr [bx] 0 000018AD 0450 add al, 80 0 000018AF 3C2F cmp al, 47 0 000018B1 766B jbe _.L264 2282:config.c **** 2272 .loc 1 2282 0 0 000018B3 53 push bx 0 000018B4 E851F9 call _skipwh 2275 _.LVL276: 0 000018B7 96 xchg si, ax 2277 _.LVL277: 2285:config.c **** { 2278 .loc 1 2285 0 0 000018B8 8A04 mov al, byte ptr [si] 2280 _.LVL278: 2281 _.LBB121: 2282 _.LBB122: 2084:config.c **** } 2283 .loc 1 2084 0 0 000018BA 88C4 mov ah, al 0 000018BC 80C4D0 add ah, -48 2286 _.LBE122: 2287 _.LBE121: 2285:config.c **** { 2288 .loc 1 2285 0 0 000018BF 80FC09 cmp ah, 9 0 000018C2 774E ja _.L265 2291 _.LBB123: 2287:config.c **** 2292 .loc 1 2287 0 0 000018C4 98 cbw 0 000018C5 83C0D0 add ax, -48 0 000018C8 8946FE mov word ptr [bp-2], ax 2296 _.LVL279: 2289:config.c **** menu->y = nMenuLine; 2297 .loc 1 2289 0 0 000018CB B8[BE0A] mov ax, offset _MenuStruct 2299 _.LVL280: 0 000018CE 8EC0 mov es, ax 0 000018D0 B85500 mov ax, 85 0 000018D3 F766FE mul word ptr [bp-2] 0 000018D6 93 xchg bx, ax 0 000018D7 89F2 mov dx, si 0 000018D9 2B5608 sub dx, word ptr [bp+8] 0 000018DC 8CC7 mov di, es 0 000018DE 8911 mov word ptr [bx+di], dx 2290:config.c **** /* copy menu text: */ 2308 .loc 1 2290 0 0 000018E0 8B16[0000] mov dx, word ptr [_nMenuLine] 0 000018E4 895102 mov word ptr [bx+di+2], dx 2292:config.c **** 2311 .loc 1 2292 0 0 000018E7 56 push si 0 000018E8 E8[FEFF] call _findend 2314 _.LVL281: 0 000018EB 83F84F cmp ax, 79 0 000018EE 7E03 jle _.L266 0 000018F0 B84F00 mov ax, 79 2318 _.L266: 2319 _.LVL282: 2298:config.c **** menu->Text[nLen] = 0; /* nullTerminate */ 2320 .loc 1 2298 0 0 000018F3 50 push ax 0 000018F4 8946FC mov word ptr [bp-4], ax 0 000018F7 56 push si 0 000018F8 B85500 mov ax, 85 2325 _.LVL283: 0 000018FB F766FE mul word ptr [bp-2] 0 000018FE 97 xchg di, ax 0 000018FF 8D95[C30A] lea dx, [_MenuStruct+5+di] 0 00001903 52 push dx 2330 _.LVL284: 0 00001904 E8[FEFF] call _init_memcpy 2332 _.LVL285: 2299:config.c **** } 2333 .loc 1 2299 0 0 00001907 8B46FC mov ax, word ptr [bp-4] 0 0000190A 96 xchg si, ax 2336 _.LVL286: 0 0000190B 89FB mov bx, di 0 0000190D C680[C30A]00 mov byte ptr [bx+si+_MenuStruct+5], 0 2339 _.LVL287: 2340 _.L265: 2341 _.LBE123: 2301:config.c **** } 2342 .loc 1 2301 0 0 00001912 FF06[0000] inc word ptr [_nMenuLine] 2344 _.L261: 2345 _.LBE120: 2346 _.LBE119: 2302:config.c **** 2347 .loc 1 2302 0 0 00001916 89EC mov sp, bp 0 00001918 5D pop bp 0 00001919 5F pop di 0 0000191A 5E pop si 0 0000191B C20200 ret 2 2353 _.LVL288: 2354 _.L264: 2355 _.LBB125: 2356 _.LBB124: 2280:config.c **** 2357 .loc 1 2280 0 0 0000191E 43 inc bx 2359 _.LVL289: 0 0000191F EB8A jmp _.L263 2361 _.LBE124: 2362 _.LBE125: 2363 _.LFE65: 2364 .size _CfgMenu, .-_CfgMenu 2365 .global _configDone 2366 .type _configDone, @function 2367 _configDone: 2368 _.LFB11: 465:config.c **** if (UmbState == 1) 2369 .loc 1 465 0 466:config.c **** para2far(base_seg)->m_type = MCB_LAST; 2370 .loc 1 466 0 0 00001921 833E[0000]01 cmp word ptr [_UmbState], 1 0 00001926 750A jne _.L269 467:config.c **** 2373 .loc 1 467 0 0 00001928 8E06[3C0A] mov es, word ptr [_base_seg] 0 0000192C 26C60600005A mov byte ptr es:[0], 90 2376 _.L269: 469:config.c **** { 2377 .loc 1 469 0 0 00001932 803E[0000]02 cmp byte ptr [_HMAState], 2 0 00001937 7425 je _.L268 2380 _.LVL290: 2381 _.LBB126: 473:config.c **** 2382 .loc 1 473 0 0 00001939 A1[0000] mov ax, word ptr [_HMAFree] 0 0000193C 83C00F add ax, 15 0 0000193F B104 mov cl, 4 0 00001941 D3E8 shr ax, cl 2387 _.LVL291: 475:config.c **** p = para2far(kernel_seg - 1); 2388 .loc 1 475 0 0 00001943 50 push ax 2390 _.LCFI69: 0 00001944 E8[FEFF] call _allocmem 2392 _.LCFI70: 2393 _.LVL292: 476:config.c **** 2394 .loc 1 476 0 0 00001947 89C2 mov dx, ax 0 00001949 4A dec dx 2397 _.LVL293: 478:config.c **** p->m_name[1] = 'C'; 2398 .loc 1 478 0 0 0000194A 8EC2 mov es, dx 479:config.c **** p->m_psp = 8; 2400 .loc 1 479 0 0 0000194C 26C70608005343 mov word ptr es:[8], 17235 480:config.c **** 2402 .loc 1 480 0 0 00001953 26C70601000800 mov word ptr es:[1], 8 483:config.c **** 2404 .loc 1 483 0 0 0000195A 50 push ax 2406 _.LCFI71: 0 0000195B E8[FEFF] call _MoveKernel 2408 _.LCFI72: 2409 _.LVL294: 2410 _.L268: 2411 _.LBE126: 492:config.c **** 2412 .loc 1 492 0 0 0000195E C3 ret 2414 _.LFE11: 2415 .size _configDone, .-_configDone 2416 .global _GetBiosKey 2417 .type _GetBiosKey, @function 2418 _GetBiosKey: 2419 _.LFB17: 1029:config.c **** iregs r; 2420 .loc 1 1029 0 2421 _.LVL295: 0 0000195F 56 push si 0 00001960 57 push di 0 00001961 55 push bp 2425 _.LCFI73: 0 00001962 89E5 mov bp, sp 2427 _.LCFI74: 0 00001964 83EC1E sub sp, 30 0 00001967 8B4608 mov ax, word ptr [bp+8] 1032:config.c **** 2430 .loc 1 1032 0 0 0000196A BE6C04 mov si, 1132 0 0000196D 31D2 xor dx, dx 0 0000196F 8EC2 mov es, dx 0 00001971 268B3C mov di, word ptr es:[si] 2435 _.LVL296: 1034:config.c **** { 2436 .loc 1 1034 0 0 00001974 39D0 cmp ax, dx 0 00001976 B91600 mov cx, 22 0 00001979 7C4F jl _.L272 1046:config.c **** return 0xffff; 2440 .loc 1 1046 0 0 0000197B BA1200 mov dx, 18 0 0000197E F7E2 mul dx 0 00001980 8946E6 mov word ptr [bp-26], ax 2444 _.LVL297: 2445 _.L275: 1039:config.c **** init_call_intr(0x16, &r); 2446 .loc 1 1039 0 0 00001983 C746E80001 mov word ptr [bp-24], 256 1040:config.c **** if (!(r.flags & FLG_ZERO)) { 2448 .loc 1 1040 0 0 00001988 8D56E8 lea dx, [-24+bp] 0 0000198B 52 push dx 0 0000198C 8956E2 mov word ptr [bp-30], dx 0 0000198F 51 push cx 0 00001990 894EE4 mov word ptr [bp-28], cx 0 00001993 E8[FEFF] call _init_call_intr 2455 _.LVL298: 1041:config.c **** r.a.x = 0x0000; 2456 .loc 1 1041 0 0 00001996 8B46FE mov ax, word ptr [bp-2] 0 00001999 83E040 and ax, 64 0 0000199C 8B4EE4 mov cx, word ptr [bp-28] 0 0000199F 8B56E2 mov dx, word ptr [bp-30] 0 000019A2 750D jne _.L273 1042:config.c **** init_call_intr(0x16, &r); /* there is a key, so better fetch it! */ 2462 .loc 1 1042 0 0 000019A4 8946E8 mov word ptr [bp-24], ax 1043:config.c **** return r.a.x; 2464 .loc 1 1043 0 0 000019A7 52 push dx 2466 _.L278: 2467 _.LBB129: 2468 _.LBB130: 1059:config.c **** return r.a.x; 2469 .loc 1 1059 0 0 000019A8 51 push cx 0 000019A9 E8[FEFF] call _init_call_intr 2472 _.LVL299: 1060:config.c **** } 2473 .loc 1 1060 0 0 000019AC 8B46E8 mov ax, word ptr [bp-24] 0 000019AF EB11 jmp _.L271 2476 _.L273: 2477 _.LBE130: 2478 _.LBE129: 1046:config.c **** return 0xffff; 2479 .loc 1 1046 0 0 000019B1 31C0 xor ax, ax 0 000019B3 8EC0 mov es, ax 0 000019B5 268B04 mov ax, word ptr es:[si] 0 000019B8 29F8 sub ax, di 0 000019BA 3B46E6 cmp ax, word ptr [bp-26] 0 000019BD 72C4 jc _.L275 1047:config.c **** } 2486 .loc 1 1047 0 0 000019BF B8FFFF mov ax, -1 2488 _.L271: 1061:config.c **** 2489 .loc 1 1061 0 0 000019C2 89EC mov sp, bp 0 000019C4 5D pop bp 0 000019C5 5F pop di 0 000019C6 5E pop si 0 000019C7 C20200 ret 2 2495 _.LVL300: 2496 _.L272: 2497 _.LBB132: 2498 _.LBB131: 1058:config.c **** init_call_intr(0x16, &r); 2499 .loc 1 1058 0 0 000019CA 8956E8 mov word ptr [bp-24], dx 2501 _.LVL301: 1059:config.c **** return r.a.x; 2502 .loc 1 1059 0 0 000019CD 8D46E8 lea ax, [-24+bp] 2504 _.LVL302: 0 000019D0 50 push ax 0 000019D1 EBD5 jmp _.L278 2507 _.LBE131: 2508 _.LBE132: 2509 _.LFE17: 2510 .size _GetBiosKey, .-_GetBiosKey === Switch to base=012BB0h -> ".RODATA.STR1.1" 2511 .section .rodata.str1.1 2512 _.LC10: 0 00000833 4F4E2000 .string "ON " 2514 _.LC11: 0 00000837 4F464600 .string "OFF" 2516 _.LC12: 0 0000083B 6572726F72202D20 .string "error - line overflow line %d \n" 0 00000843 6C696E65206F7665 0 0000084B 72666C6F77206C69 0 00000853 6E65202564200A00 2518 _.LC13: 0 0000085B 5072657373204638 .string "Press F8 to trace or F5 to skip CONFIG.SYS/AUTOEXEC.BAT" 0 00000863 20746F2074726163 0 0000086B 65206F7220463520 0 00000873 746F20736B697020 0 0000087B 434F4E4649472E53 0 00000883 59532F4155544F45 0 0000088B 5845432E42415400 2520 _.LC14: 0 00000893 536B697070696E67 .string "Skipping CONFIG.SYS/AUTOEXEC.BAT\n" 0 0000089B 20434F4E4649472E 0 000008A3 5359532F4155544F 0 000008AB 455845432E424154 0 000008B3 0A00 2522 _.LC15: 0 000008B5 00 .string "" 2524 _.LC16: 0 000008B6 0D253739730D00 .string "\r%79s\r" 2526 _.LC17: 0 000008BD 25735B592C4E5D3F .string "%s[Y,N]?" 0 000008C5 00 2528 _.LC18: 0 000008C6 4E0A00 .string "N\n" 2530 _.LC19: 0 000008C9 590A00 .string "Y\n" 2532 _.LC20: 0 000008CC 53656C6563742066 .string "Select from Menu [" 0 000008D4 726F6D204D656E75 0 000008DC 205B00 2534 _.LC21: 0 000008DF 256300 .string "%c" 2536 _.LC22: 0 000008E2 5D2C206F72207072 .string "], or press [ENTER]" 0 000008EA 657373205B454E54 0 000008F2 45525D00 2538 _.LC23: 0 000008F6 202853656C656374 .string " (Selection=%d) " 0 000008FE 696F6E3D25642920 0 00000906 00 2540 _.LC24: 0 00000907 2D202564200800 .string "- %d \b" 2542 _.LC25: 0 0000090E 2020202008080808 .string " \b\b\b\b\b" 0 00000916 0800 2544 _.LC26: 0 00000918 0D0A0A202000 .string "\r\n\n " 2546 _.LC27: 0 0000091E 202D00 .string " -" 2548 _.LC28: 0 00000921 2053696E676C6573 .string " Singlestepping (F8) is: %s \r" 0 00000929 74657070696E6720 0 00000931 284638292069733A 0 00000939 202573200D00 2550 _.LC29: 0 0000093F 0A00 .string "\n" 2552 _.LC30: 0 00000941 434F4E4649473D25 .string "CONFIG=%c" 0 00000949 6300 === Switch to base=002270h -> ".TEXT" 2554 .text 2555 .global _DoConfig 2556 .type _DoConfig, @function 2557 _DoConfig: 2558 _.LFB15: 801:config.c **** BYTE *pLine; 2559 .loc 1 801 0 2560 _.LVL303: 0 000019D3 56 push si 0 000019D4 57 push di 0 000019D5 55 push bp 2564 _.LCFI75: 0 000019D6 89E5 mov bp, sp 2566 _.LCFI76: 0 000019D8 83EC2E sub sp, 46 2568 _.LVL304: 821:config.c **** { 2569 .loc 1 821 0 0 000019DB 837E0800 cmp word ptr [bp+8], 0 0 000019DF 750C jne _.L280 823:config.c **** 2572 .loc 1 823 0 0 000019E1 B8[0000] mov ax, offset _HaltCpuWhileIdle@OZSEG16 0 000019E4 8EC0 mov es, ax 0 000019E6 8A4608 mov al, byte ptr [bp+8] 0 000019E9 26A2[0000] mov byte ptr es:[_HaltCpuWhileIdle], al 2577 _.LVL305: 2578 _.L280: 2579 _.LBB154: 843:config.c **** static char * configfile = ""; 2580 .loc 1 843 0 0 000019ED A1[0000] mov ax, word ptr [_kernel_command_line_length] 0 000019F0 05[0000] add ax, offset _kernel_command_line 0 000019F3 8946D8 mov word ptr [bp-40], ax 2584 _.LVL306: 839:config.c **** char * cc; 2585 .loc 1 839 0 0 000019F6 BE[0000] mov si, offset _kernel_command_line 2587 _.LVL307: 2588 _.L281: 854:config.c **** for (cc = pp; *cc == '\t' || *cc == ' '; ++cc); 2589 .loc 1 854 0 discriminator 1 0 000019F9 3B76D8 cmp si, word ptr [bp-40] 0 000019FC 7203E9B000 jnc _.L293 0 00001A01 89F1 mov cx, si 0 00001A03 EB01 jmp _.L294 2594 _.LVL308: 2595 _.L282: 855:config.c **** strcpy(commandbuffer, cc); 2596 .loc 1 855 0 discriminator 3 0 00001A05 41 inc cx 2598 _.LVL309: 2599 _.L294: 855:config.c **** strcpy(commandbuffer, cc); 2600 .loc 1 855 0 is_stmt 0 discriminator 1 0 00001A06 89CB mov bx, cx 0 00001A08 8A07 mov al, byte ptr [bx] 0 00001A0A 3C09 cmp al, 9 0 00001A0C 74F7 je _.L282 0 00001A0E 3C20 cmp al, 32 0 00001A10 74F3 je _.L282 856:config.c **** strupr(commandbuffer); 2607 .loc 1 856 0 is_stmt 1 0 00001A12 51 push cx 0 00001A13 894EDA mov word ptr [bp-38], cx 0 00001A16 BF[2807] mov di, offset _commandbuffer.2117 0 00001A19 57 push di 0 00001A1A E8[FEFF] call _init_strcpy 2613 _.LVL310: 857:config.c **** for (ii = 0; configcommands[ii].pointer != NULL; ++ii) 2614 .loc 1 857 0 0 00001A1D 57 push di 0 00001A1E E884F7 call _strupr 2617 _.LVL311: 0 00001A21 C746DC[0000] mov word ptr [bp-36], offset _configcommands.2125 858:config.c **** if (check_config_commandline(configcommands[ii].pointer, 2619 .loc 1 858 0 0 00001A26 8B4EDA mov cx, word ptr [bp-38] 2621 _.LVL312: 2622 _.L283: 858:config.c **** if (check_config_commandline(configcommands[ii].pointer, 2623 .loc 1 858 0 is_stmt 0 discriminator 1 0 00001A29 8B5EDC mov bx, word ptr [bp-36] 0 00001A2C 8B07 mov ax, word ptr [bx] 0 00001A2E 8946DA mov word ptr [bp-38], ax 0 00001A31 85C0 test ax, ax 0 00001A33 746E je _.L291 0 00001A35 894ED2 mov word ptr [bp-46], cx 859:config.c **** cc, commandbuffer, configcommands[ii].command)) 2630 .loc 1 859 0 is_stmt 1 0 00001A38 8B5EDC mov bx, word ptr [bp-36] 0 00001A3B 8B5702 mov dx, word ptr [bx+2] 2633 _.LVL313: 2634 _.LBB155: 2635 _.LBB156: 784:config.c **** if (memcmp(commandbuffer, command, length) == 0 2636 .loc 1 784 0 0 00001A3E 52 push dx 0 00001A3F 8956D4 mov word ptr [bp-44], dx 0 00001A42 E8[FEFF] call _init_strlen 2640 _.LVL314: 785:config.c **** && (commandbuffer[length] == '\t' 2641 .loc 1 785 0 0 00001A45 50 push ax 0 00001A46 8946D6 mov word ptr [bp-42], ax 0 00001A49 8B56D4 mov dx, word ptr [bp-44] 0 00001A4C 52 push dx 0 00001A4D 57 push di 0 00001A4E E8[FEFF] call _init_memcmp 2648 _.LVL315: 0 00001A51 85C0 test ax, ax 0 00001A53 8B4ED2 mov cx, word ptr [bp-46] 0 00001A56 7403E98A05 jne _.L284 786:config.c **** || commandbuffer[length] == ' ' 2652 .loc 1 786 0 0 00001A5B 8B5ED6 mov bx, word ptr [bp-42] 0 00001A5E 8A01 mov al, byte ptr [bx+di] 788:config.c **** || commandbuffer[length] == 0)) { 2655 .loc 1 788 0 0 00001A60 3C3D cmp al, 61 0 00001A62 9F lahf 0 00001A63 D0E4 shl ah, 1 0 00001A65 99 cwd 0 00001A66 88D4 mov ah, dl 0 00001A68 F6DC neg ah 0 00001A6A 8866D6 mov byte ptr [bp-42], ah 2663 _.LVL316: 787:config.c **** || commandbuffer[length] == '=' 2664 .loc 1 787 0 0 00001A6D 3C09 cmp al, 9 0 00001A6F 9F lahf 0 00001A70 D0E4 shl ah, 1 0 00001A72 99 cwd 0 00001A73 F6DA neg dl 789:config.c **** for (cc += length; *cc == '\t' || *cc == ' '; ++cc); 2670 .loc 1 789 0 0 00001A75 8A66D6 mov ah, byte ptr [bp-42] 0 00001A78 08D4 or ah, dl 0 00001A7A 7507 jne _.L371 0 00001A7C A8DF test al, -33 0 00001A7E 7403E96205 jne _.L284 2676 _.L371: 790:config.c **** if (*cc == '=') ++cc; 2677 .loc 1 790 0 0 00001A83 01CB add bx, cx 2679 _.LVL317: 2680 _.L286: 0 00001A85 8A07 mov al, byte ptr [bx] 0 00001A87 3C09 cmp al, 9 0 00001A89 7423 je _.L287 0 00001A8B 3C20 cmp al, 32 0 00001A8D 741F je _.L287 791:config.c **** for (; *cc == '\t' || *cc == ' '; ++cc); 2686 .loc 1 791 0 0 00001A8F 3C3D cmp al, 61 0 00001A91 750B jne _.L288 2689 _.L290: 792:config.c **** *pointer = cc; 2690 .loc 1 792 0 0 00001A93 43 inc bx 2692 _.LVL318: 0 00001A94 8A07 mov al, byte ptr [bx] 0 00001A96 3C09 cmp al, 9 0 00001A98 74F9 je _.L290 0 00001A9A 3C20 cmp al, 32 0 00001A9C 74F5 je _.L290 2698 _.L288: 793:config.c **** return 1; 2699 .loc 1 793 0 0 00001A9E 8B7EDA mov di, word ptr [bp-38] 0 00001AA1 891D mov word ptr [di], bx 2702 _.LVL319: 2703 _.L291: 2704 _.LBE156: 2705 _.LBE155: 854:config.c **** for (cc = pp; *cc == '\t' || *cc == ' '; ++cc); 2706 .loc 1 854 0 0 00001AA3 56 push si 0 00001AA4 E8[FEFF] call _init_strlen 2709 _.LVL320: 0 00001AA7 93 xchg bx, ax 0 00001AA8 8D7001 lea si, [1+bx+si] 2712 _.LVL321: 0 00001AAB E94BFF jmp _.L281 2714 _.LVL322: 2715 _.L287: 2716 _.LBB158: 2717 _.LBB157: 790:config.c **** if (*cc == '=') ++cc; 2718 .loc 1 790 0 0 00001AAE 43 inc bx 2720 _.LVL323: 0 00001AAF EBD4 jmp _.L286 2722 _.LVL324: 2723 _.L293: 0 00001AB1 BE[0000] mov si, offset _configcommands.2125 2725 _.LVL325: 2726 _.L295: 2727 _.LBE157: 2728 _.LBE158: 867:config.c **** if (**configcommands[ii].pointer != '\0') { 2729 .loc 1 867 0 discriminator 1 0 00001AB4 8B1C mov bx, word ptr [si] 0 00001AB6 85DB test bx, bx 0 00001AB8 7508 jne _.L299 2733 _.LVL326: 2734 _.L279: 2735 _.LBE154: 1004:config.c **** 2736 .loc 1 1004 0 0 00001ABA 89EC mov sp, bp 0 00001ABC 5D pop bp 0 00001ABD 5F pop di 0 00001ABE 5E pop si 0 00001ABF C20200 ret 2 2742 _.LVL327: 2743 _.L299: 2744 _.LBB159: 868:config.c **** if ((nFileDesc = open(*configcommands[ii].pointer, 0)) >= 0) { 2745 .loc 1 868 0 0 00001AC2 8B1F mov bx, word ptr [bx] 0 00001AC4 803F00 cmp byte ptr [bx], 0 0 00001AC7 7505 jne _.L296 2749 _.L298: 0 00001AC9 83C604 add si, 4 0 00001ACC EBE6 jmp _.L295 2752 _.L296: 869:config.c **** CfgDbgPrintf(("Reading \"%s\"...\n", *configcommands[ii].pointer)); 2753 .loc 1 869 0 0 00001ACE 31FF xor di, di 0 00001AD0 57 push di 0 00001AD1 53 push bx 0 00001AD2 E8[FEFF] call _init_DosOpen 2758 _.LVL328: 0 00001AD5 A3[0000] mov word ptr [_nFileDesc], ax 0 00001AD8 39F8 cmp ax, di 0 00001ADA 7CED jl _.L298 2762 _.LBE159: 889:config.c **** 2763 .loc 1 889 0 0 00001ADC 893E[380A] mov word ptr [_nCfgLine], di 2765 _.LVL329: 2766 _.L336: 2767 _.LBB160: 902:config.c **** 2768 .loc 1 902 0 0 00001AE0 C706[00003809] mov word ptr [_pLineStart], offset _szLine 2770 _.LVL330: 911:config.c **** { 2771 .loc 1 911 0 0 00001AE6 BF[3809] mov di, offset _szLine 2773 _.LVL331: 2774 _.L301: 913:config.c **** { 2775 .loc 1 913 0 0 00001AE9 BE0100 mov si, 1 0 00001AEC 56 push si 0 00001AED 57 push di 0 00001AEE FF36[0000] push word ptr [_nFileDesc] 0 00001AF2 E8[FEFF] call _read 2781 _.LVL332: 0 00001AF5 85C0 test ax, ax 0 00001AF7 8976DA mov word ptr [bp-38], si 0 00001AFA 7432 je _.L366 919:config.c **** { 2785 .loc 1 919 0 0 00001AFC 81FF[350A] cmp di, offset _szLine+253 0 00001B00 7219 jc _.L303 921:config.c **** printf("error - line overflow line %d \n", nCfgLine); 2788 .loc 1 921 0 0 00001B02 57 push di 0 00001B03 E8F5F3 call _CfgFailure 2791 _.LVL333: 922:config.c **** break; 2792 .loc 1 922 0 0 00001B06 FF36[380A] push word ptr [_nCfgLine] 0 00001B0A B8[EB00] mov ax, offset _.LC12 0 00001B0D 50 push ax 0 00001B0E E8[FEFF] call _init_printf 2797 _.LVL334: 923:config.c **** } 2798 .loc 1 923 0 0 00001B11 83C404 add sp, 4 2800 _.L367: 0 00001B14 C746D80000 mov word ptr [bp-40], 0 0 00001B19 EB19 jmp _.L302 2803 _.L303: 926:config.c **** break; 2804 .loc 1 926 0 0 00001B1B 8A05 mov al, byte ptr [di] 0 00001B1D 88C4 mov ah, al 0 00001B1F 80E4EF and ah, -17 0 00001B22 80FC0A cmp ah, 10 0 00001B25 74ED je _.L367 929:config.c **** pLine++; 2810 .loc 1 929 0 0 00001B27 3C0D cmp al, 13 0 00001B29 74BE je _.L301 930:config.c **** } 2813 .loc 1 930 0 0 00001B2B 47 inc di 2815 _.LVL335: 0 00001B2C EBBB jmp _.L301 2817 _.L366: 915:config.c **** break; 2818 .loc 1 915 0 0 00001B2E 8B46DA mov ax, word ptr [bp-38] 0 00001B31 8946D8 mov word ptr [bp-40], ax 2821 _.L302: 2822 _.LVL336: 933:config.c **** #ifdef MEMDISK_ARGS 2823 .loc 1 933 0 0 00001B34 C60500 mov byte ptr [di], 0 945:config.c **** struct CfgFile *cfg = &cfgFile[--nCurChain]; 2825 .loc 1 945 0 0 00001B37 837ED800 cmp word ptr [bp-40], 0 0 00001B3B 7503E97401 je _.L305 2828 _.LVL337: 945:config.c **** struct CfgFile *cfg = &cfgFile[--nCurChain]; 2829 .loc 1 945 0 is_stmt 0 discriminator 1 0 00001B40 8B1E[0000] mov bx, word ptr [_nCurChain] 0 00001B44 85DB test bx, bx 0 00001B46 7503E96901 je _.L305 2833 _.LBB161: 946:config.c **** close(nFileDesc); 2834 .loc 1 946 0 is_stmt 1 0 00001B4B 8D77FF lea si, [-1+bx] 0 00001B4E 8936[0000] mov word ptr [_nCurChain], si 2837 _.LVL338: 947:config.c **** bEof = FALSE; 2838 .loc 1 947 0 0 00001B52 FF36[0000] push word ptr [_nFileDesc] 0 00001B56 E8[FEFF] call _close 2841 _.LVL339: 949:config.c **** nCfgLine = cfg->nCfgLine; 2842 .loc 1 949 0 0 00001B59 BF[0000] mov di, offset _cfgFile 2844 _.LVL340: 0 00001B5C 89F3 mov bx, si 0 00001B5E B102 mov cl, 2 0 00001B60 D3E3 shl bx, cl 950:config.c **** continue; 2848 .loc 1 950 0 0 00001B62 C401 les ax, dword ptr [bx+di] 0 00001B64 A3[0000] mov word ptr [_nFileDesc], ax 0 00001B67 8C06[380A] mov word ptr [_nCfgLine], es 948:config.c **** nFileDesc = cfg->nFileDesc; 2852 .loc 1 948 0 0 00001B6B C746D80000 mov word ptr [bp-40], 0 2854 _.LVL341: 2855 _.L306: 2856 _.LBE161: 2857 _.LBE160: 898:config.c **** #endif 2858 .loc 1 898 0 0 00001B70 FF06[380A] inc word ptr [_nCfgLine] 0 00001B74 837ED800 cmp word ptr [bp-40], 0 0 00001B78 7503E963FF je _.L336 2862 _.LVL342: 998:config.c **** 2863 .loc 1 998 0 0 00001B7D FF36[0000] push word ptr [_nFileDesc] 0 00001B81 E8[FEFF] call _close 2866 _.LVL343: 1000:config.c **** { 2867 .loc 1 1000 0 0 00001B84 837E0800 cmp word ptr [bp+8], 0 0 00001B88 7403E92DFF jne _.L279 2870 _.LVL344: 2871 _.LBB172: 2872 _.LBB173: 2316:config.c **** return; 2873 .loc 1 2316 0 0 00001B8D A1[0000] mov ax, word ptr [_Menus] 0 00001B90 85C0 test ax, ax 0 00001B92 7503E923FF je _.L279 2319:config.c **** 2877 .loc 1 2319 0 0 00001B97 C606[0A00]FF mov byte ptr [_InitKernelConfig+10], -1 2321:config.c **** Menus |= 1 << 0; /* '0' Menu always allowed */ 2879 .loc 1 2321 0 0 00001B9C 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001BA1 7506 jne _.L339 2322:config.c **** 2882 .loc 1 2322 0 0 00001BA3 83C801 or ax, 1 0 00001BA6 A3[0000] mov word ptr [_Menus], ax 2885 _.L339: 2324:config.c **** 2886 .loc 1 2324 0 0 00001BA9 8306[0000]02 add word ptr [_nMenuLine], 2 2888 _.LVL345: 2889 _.L340: 2890 _.LBB174: 2332:config.c **** { 2891 .loc 1 2332 0 0 00001BAE 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001BB3 7451 je _.L341 2334:config.c **** 2894 .loc 1 2334 0 0 00001BB5 A0[0000] mov al, byte ptr [_MenuSelected] 0 00001BB8 8846DC mov byte ptr [bp-36], al 0 00001BBB 98 cbw 0 00001BBC 96 xchg si, ax 2899 _.LVL346: 2900 _.LBB175: 2901 _.LBB176: 2902 _.LBB177: 2903 _.LBB178: 94:config.c **** { 2904 .loc 1 94 0 0 00001BBD BB[BE0A] mov bx, offset _MenuStruct 0 00001BC0 89DF mov di, bx 2907 _.LVL347: 2908 _.L344: 96:config.c **** { 2909 .loc 1 96 0 0 00001BC2 807F0400 cmp byte ptr [bx+4], 0 0 00001BC6 7503E9E402 je _.L342 99:config.c **** WriteMenuLine(menu); 2912 .loc 1 99 0 0 00001BCB C6470400 mov byte ptr [bx+4], 0 100:config.c **** break; 2914 .loc 1 100 0 0 00001BCF 53 push bx 0 00001BD0 E85FF4 call _WriteMenuLine 2917 _.LVL348: 2918 _.L343: 2919 _.LBE178: 2920 _.LBE177: 112:config.c **** WriteMenuLine(menu); 2921 .loc 1 112 0 0 00001BD3 B85500 mov ax, 85 0 00001BD6 F7E6 mul si 0 00001BD8 93 xchg bx, ax 0 00001BD9 C6410401 mov byte ptr [bx+di+4], 1 111:config.c **** menu->bSelected = 1; /* set selection flag for this one */ 2926 .loc 1 111 0 0 00001BDD B055 mov al, 85 0 00001BDF F66EDC imul byte ptr [bp-36] 0 00001BE2 05[BE0A] add ax, offset _MenuStruct 113:config.c **** } 2930 .loc 1 113 0 0 00001BE5 50 push ax 0 00001BE6 E849F4 call _WriteMenuLine 2933 _.LVL349: 2934 _.LBE176: 2935 _.LBE175: 2337:config.c **** r.b.b.h = 0; 2936 .loc 1 2337 0 0 00001BE9 C646E902 mov byte ptr [bp-23], 2 2338:config.c **** r.d.b.l = 3; 2938 .loc 1 2338 0 0 00001BED C646EB00 mov byte ptr [bp-21], 0 2339:config.c **** r.d.b.h = nMenuLine; 2940 .loc 1 2339 0 0 00001BF1 C646EE03 mov byte ptr [bp-18], 3 2340:config.c **** 2942 .loc 1 2340 0 0 00001BF5 A1[0000] mov ax, word ptr [_nMenuLine] 0 00001BF8 8846EF mov byte ptr [bp-17], al 2342:config.c **** } 2945 .loc 1 2342 0 0 00001BFB 8D46E8 lea ax, [-24+bp] 0 00001BFE 50 push ax 0 00001BFF B81000 mov ax, 16 0 00001C02 50 push ax 0 00001C03 E8[FEFF] call _init_call_intr 2951 _.LVL350: 2952 _.L341: 2345:config.c **** 2953 .loc 1 2345 0 0 00001C06 B8[7C01] mov ax, offset _.LC20 0 00001C09 50 push ax 0 00001C0A E8[FEFF] call _init_printf 2957 _.LVL351: 2958 _.LVL352: 0 00001C0D 83C402 add sp, 2 0 00001C10 BE3000 mov si, 48 2347:config.c **** if (Menus & j) 2961 .loc 1 2347 0 0 00001C13 BF0100 mov di, 1 2963 _.LVL353: 2964 _.L346: 2348:config.c **** printf("%c", '0' + i); 2965 .loc 1 2348 0 0 00001C16 853E[0000] test di, word ptr [_Menus] 0 00001C1A 740B je _.L345 2349:config.c **** printf("], or press [ENTER]"); 2968 .loc 1 2349 0 0 00001C1C 56 push si 0 00001C1D B8[8F01] mov ax, offset _.LC21 0 00001C20 50 push ax 0 00001C21 E8[FEFF] call _init_printf 2973 _.LVL354: 0 00001C24 83C404 add sp, 4 2975 _.L345: 2976 _.LVL355: 2347:config.c **** if (Menus & j) 2977 .loc 1 2347 0 0 00001C27 D1E7 shl di, 1 2979 _.LVL356: 0 00001C29 46 inc si 2981 _.LVL357: 0 00001C2A 83FE3A cmp si, 58 0 00001C2D 75E7 jne _.L346 2350:config.c **** 2984 .loc 1 2350 0 0 00001C2F B8[9201] mov ax, offset _.LC22 0 00001C32 50 push ax 0 00001C33 E8[FEFF] call _init_printf 2988 _.LVL358: 2352:config.c **** printf(" (Selection=%d) ", MenuSelected); 2989 .loc 1 2352 0 0 00001C36 83C402 add sp, 2 0 00001C39 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001C3E 740F je _.L347 2353:config.c **** 2993 .loc 1 2353 0 0 00001C40 A0[0000] mov al, byte ptr [_MenuSelected] 0 00001C43 98 cbw 0 00001C44 50 push ax 0 00001C45 B8[A601] mov ax, offset _.LC23 0 00001C48 50 push ax 0 00001C49 E8[FEFF] call _init_printf 3000 _.LVL359: 0 00001C4C 83C404 add sp, 4 3002 _.L347: 2355:config.c **** printf("- %d \b", MenuTimeout); 3003 .loc 1 2355 0 0 00001C4F A1[0000] mov ax, word ptr [_MenuTimeout] 0 00001C52 85C0 test ax, ax 0 00001C54 7D03E96502 jl _.L348 2356:config.c **** else 3007 .loc 1 2356 0 0 00001C59 50 push ax 0 00001C5A B8[B701] mov ax, offset _.LC24 0 00001C5D 50 push ax 0 00001C5E E8[FEFF] call _init_printf 3012 _.LVL360: 0 00001C61 83C404 add sp, 4 3014 _.L349: 2360:config.c **** printf("\r\n\n "); 3015 .loc 1 2360 0 0 00001C64 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001C69 7503E95D02 je _.L350 2361:config.c **** else 3018 .loc 1 2361 0 0 00001C6E B8[C801] mov ax, offset _.LC26 3020 _.L439: 2363:config.c **** 3021 .loc 1 2363 0 0 00001C71 50 push ax 0 00001C72 E8[FEFF] call _init_printf 3024 _.LVL361: 0 00001C75 83C402 add sp, 2 2365:config.c **** 3026 .loc 1 2365 0 0 00001C78 803E[0000]00 cmp byte ptr [_singleStep], 0 0 00001C7D 7503E94F02 je _.L369 0 00001C82 B8[E300] mov ax, offset _.LC10 3030 _.L352: 0 00001C85 50 push ax 0 00001C86 B8[D101] mov ax, offset _.LC28 0 00001C89 50 push ax 0 00001C8A E8[FEFF] call _init_printf 3035 _.LVL362: 2367:config.c **** 3036 .loc 1 2367 0 0 00001C8D 83C404 add sp, 4 0 00001C90 A1[0000] mov ax, word ptr [_MenuTimeout] 0 00001C93 99 cwd 0 00001C94 83CA01 or dx, 1 0 00001C97 52 push dx 0 00001C98 E8[FEFF] call _GetBiosKey 3043 _.LVL363: 2369:config.c **** { 3044 .loc 1 2369 0 0 00001C9B 83F8FF cmp ax, -1 0 00001C9E 7403E93402 jne _.L354 2371:config.c **** { 3047 .loc 1 2371 0 0 00001CA3 A1[0000] mov ax, word ptr [_MenuTimeout] 3049 _.LVL364: 0 00001CA6 85C0 test ax, ax 0 00001CA8 7F03E93A02 jle _.L356 2373:config.c **** goto RestartInput; 3052 .loc 1 2373 0 0 00001CAD 48 dec ax 0 00001CAE A3[0000] mov word ptr [_MenuTimeout], ax 0 00001CB1 E9FAFE jmp _.L340 3056 _.LVL365: 3057 _.L305: 3058 _.LBE174: 3059 _.LBE173: 3060 _.LBE172: 3061 _.LBB189: 957:config.c **** 3062 .loc 1 957 0 0 00001CB4 FF76DA push word ptr [bp-38] 0 00001CB7 BF[3808] mov di, offset _szBuf 3065 _.LVL366: 0 00001CBA 57 push di 0 00001CBB B8[3809] mov ax, offset _szLine 0 00001CBE 50 push ax 0 00001CBF E86BF5 call _scan 3070 _.LVL367: 0 00001CC2 8946DC mov word ptr [bp-36], ax 3072 _.LVL368: 961:config.c **** continue; 3073 .loc 1 961 0 0 00001CC5 803D00 cmp byte ptr [di], 0 0 00001CC8 7503E9A3FE je _.L306 0 00001CCD BE[E101] mov si, offset _commands 3077 _.LVL369: 3078 _.L307: 3079 _.LBB162: 3080 _.LBB163: 1008:config.c **** ++p; 3081 .loc 1 1008 0 0 00001CD0 8B1C mov bx, word ptr [si] 0 00001CD2 803F00 cmp byte ptr [bx], 0 0 00001CD5 7409 je _.L308 0 00001CD7 57 push di 0 00001CD8 53 push bx 0 00001CD9 E8E8F4 call _strcaseequal 3088 _.LVL370: 0 00001CDC 84C0 test al, al 0 00001CDE 741F je _.L309 3091 _.L308: 3092 _.LVL371: 3093 _.LBE163: 3094 _.LBE162: 967:config.c **** continue; 3095 .loc 1 967 0 0 00001CE0 8A4402 mov al, byte ptr [si+2] 0 00001CE3 84C0 test al, al 0 00001CE5 7C09 jl _.L310 967:config.c **** continue; 3099 .loc 1 967 0 is_stmt 0 discriminator 1 0 00001CE7 98 cbw 0 00001CE8 394608 cmp word ptr [bp+8], ax 0 00001CEB 7403E980FE jne _.L306 3103 _.L310: 971:config.c **** { 3104 .loc 1 971 0 is_stmt 1 0 00001CF0 837E0800 cmp word ptr [bp+8], 0 0 00001CF4 750E jne _.L311 973:config.c **** continue; 3107 .loc 1 973 0 0 00001CF6 FF76DC push word ptr [bp-36] 0 00001CF9 FF5403 call word ptr [si+3] 3110 _.LVL372: 974:config.c **** } 3111 .loc 1 974 0 0 00001CFC E971FE jmp _.L306 3113 _.LVL373: 3114 _.L309: 3115 _.LBB165: 3116 _.LBB164: 1009:config.c **** return p; 3117 .loc 1 1009 0 0 00001CFF 83C605 add si, 5 3119 _.LVL374: 0 00001D02 EBCC jmp _.L307 3121 _.LVL375: 3122 _.L311: 3123 _.LBE164: 3124 _.LBE165: 978:config.c **** continue; 3125 .loc 1 978 0 0 00001D04 8B3E[0000] mov di, word ptr [_pLineStart] 3127 _.LVL376: 3128 _.LBB166: 3129 _.LBB167: 1067:config.c **** 3130 .loc 1 1067 0 0 00001D08 8A16[0A00] mov dl, byte ptr [_InitKernelConfig+10] 3132 _.LVL377: 1069:config.c **** { 3133 .loc 1 1069 0 0 00001D0C 84D2 test dl, dl 0 00001D0E 7C3C jl _.L312 1072:config.c **** printf("Press F8 to trace or F5 to skip CONFIG.SYS/AUTOEXEC.BAT"); 3136 .loc 1 1072 0 0 00001D10 7410 je _.L313 0 00001D12 8856D6 mov byte ptr [bp-42], dl 1073:config.c **** 3139 .loc 1 1073 0 0 00001D15 B8[0B01] mov ax, offset _.LC13 0 00001D18 50 push ax 0 00001D19 E8[FEFF] call _init_printf 3143 _.LVL378: 0 00001D1C 83C402 add sp, 2 0 00001D1F 8A56D6 mov dl, byte ptr [bp-42] 3146 _.LVL379: 3147 _.L313: 1075:config.c **** 3148 .loc 1 1075 0 0 00001D22 88D0 mov al, dl 0 00001D24 8856D6 mov byte ptr [bp-42], dl 0 00001D27 98 cbw 0 00001D28 50 push ax 0 00001D29 E8[FEFF] call _GetBiosKey 3154 _.LVL380: 1077:config.c **** 3155 .loc 1 1077 0 0 00001D2C C606[0A00]FF mov byte ptr [_InitKernelConfig+10], -1 1079:config.c **** { 3157 .loc 1 1079 0 0 00001D31 3D003F cmp ax, 16128 0 00001D34 8A56D6 mov dl, byte ptr [bp-42] 0 00001D37 751F jne _.L314 1081:config.c **** } 3161 .loc 1 1081 0 0 00001D39 C606[0000]01 mov byte ptr [_SkipAllConfig], 1 1088:config.c **** printf("\r%79s\r", ""); /* clear line */ 3163 .loc 1 1088 0 0 00001D3E 84D2 test dl, dl 0 00001D40 7524 jne _.L315 3166 _.LVL381: 3167 _.L318: 1092:config.c **** } 3168 .loc 1 1092 0 0 00001D42 B8[4301] mov ax, offset _.LC14 0 00001D45 50 push ax 0 00001D46 E8[FEFF] call _init_printf 3172 _.LVL382: 0 00001D49 83C402 add sp, 2 3174 _.L312: 1095:config.c **** return TRUE; 3175 .loc 1 1095 0 0 00001D4C 803E[0000]00 cmp byte ptr [_SkipAllConfig], 0 0 00001D51 7403E91AFE jne _.L306 0 00001D56 EB23 jmp _.L319 3179 _.LVL383: 3180 _.L314: 1083:config.c **** { 3181 .loc 1 1083 0 0 00001D58 3D0042 cmp ax, 16896 0 00001D5B 7505 jne _.L317 1085:config.c **** } 3184 .loc 1 1085 0 0 00001D5D C606[0000]01 mov byte ptr [_singleStep], 1 3186 _.L317: 1088:config.c **** printf("\r%79s\r", ""); /* clear line */ 3187 .loc 1 1088 0 0 00001D62 84D2 test dl, dl 0 00001D64 740E je _.L316 3190 _.L315: 1089:config.c **** 3191 .loc 1 1089 0 0 00001D66 B8[6501] mov ax, offset _.LC15 3193 _.LVL384: 0 00001D69 50 push ax 0 00001D6A B8[6601] mov ax, offset _.LC16 0 00001D6D 50 push ax 0 00001D6E E8[FEFF] call _init_printf 3198 _.LVL385: 0 00001D71 83C404 add sp, 4 3200 _.L316: 1091:config.c **** printf("Skipping CONFIG.SYS/AUTOEXEC.BAT\n"); 3201 .loc 1 1091 0 0 00001D74 803E[0000]00 cmp byte ptr [_SkipAllConfig], 0 0 00001D79 75C7 jne _.L318 3204 _.L319: 1101:config.c **** (MenuLine & (1 << MenuSelected)) == 0) 3205 .loc 1 1101 0 0 00001D7B A1[0000] mov ax, word ptr [_MenuLine] 0 00001D7E 85C0 test ax, ax 0 00001D80 7410 je _.L320 1102:config.c **** return TRUE; 3209 .loc 1 1102 0 0 00001D82 8A0E[0000] mov cl, byte ptr [_MenuSelected] 0 00001D86 8B56DA mov dx, word ptr [bp-38] 0 00001D89 D3E2 shl dx, cl 1101:config.c **** (MenuLine & (1 << MenuSelected)) == 0) 3213 .loc 1 1101 0 0 00001D8B 85C2 test dx, ax 0 00001D8D 7503E9DEFD je _.L306 3216 _.L320: 1105:config.c **** return FALSE; 3217 .loc 1 1105 0 0 00001D92 803E[0000]00 cmp byte ptr [_DontAskThisSingleCommand], 0 0 00001D97 7552 jne _.L321 1108:config.c **** return FALSE; 3220 .loc 1 1108 0 0 00001D99 803E[0000]00 cmp byte ptr [_askThisSingleCommand], 0 0 00001D9E 7507 jne _.L368 0 00001DA0 803E[0000]00 cmp byte ptr [_singleStep], 0 0 00001DA5 7444 je _.L321 3225 _.L368: 0 00001DA7 31D2 xor dx, dx 3227 _.L323: 3228 _.LVL386: 1111:config.c **** printf(" "); 3229 .loc 1 1111 0 0 00001DA9 3B16[0000] cmp dx, word ptr [_nCurChain] 0 00001DAD 7C7A jl _.L324 1113:config.c **** 3232 .loc 1 1113 0 0 00001DAF 57 push di 0 00001DB0 B8[6D01] mov ax, offset _.LC17 0 00001DB3 50 push ax 0 00001DB4 E8[FEFF] call _init_printf 3237 _.LVL387: 0 00001DB7 83C404 add sp, 4 3239 _.L332: 1117:config.c **** 3240 .loc 1 1117 0 0 00001DBA B8FFFF mov ax, -1 0 00001DBD 50 push ax 0 00001DBE E8[FEFF] call _GetBiosKey 3244 _.LVL388: 3245 _.LBB168: 3246 _.LBB169: 2090:config.c **** c -= 'a' - 'A'; 3247 .loc 1 2090 0 0 00001DC1 88C2 mov dl, al 0 00001DC3 88C6 mov dh, al 0 00001DC5 80C69F add dh, -97 0 00001DC8 80FE19 cmp dh, 25 0 00001DCB 7703 ja _.L326 2091:config.c **** return c; 3253 .loc 1 2091 0 0 00001DCD 80C2E0 add dl, -32 3255 _.LVL389: 3256 _.L326: 3257 _.LBE169: 3258 _.LBE168: 1119:config.c **** { 3259 .loc 1 1119 0 0 00001DD0 80FA1B cmp dl, 27 0 00001DD3 747F je _.L328 0 00001DD5 7F66 jg _.L329 0 00001DD7 80FA0A cmp dl, 10 0 00001DDA 7405 je _.L330 0 00001DDC 80FA0D cmp dl, 13 3266 _.L437: 0 00001DDF 757A jne _.L327 3268 _.L330: 1134:config.c **** return FALSE; 3269 .loc 1 1134 0 0 00001DE1 B8[7901] mov ax, offset _.LC19 3271 _.LVL390: 0 00001DE4 50 push ax 0 00001DE5 E8[FEFF] call _init_printf 3274 _.LVL391: 0 00001DE8 83C402 add sp, 2 3276 _.L321: 3277 _.LVL392: 3278 _.LBE167: 3279 _.LBE166: 982:config.c **** { 3280 .loc 1 982 0 0 00001DEB 8B7403 mov si, word ptr [si+3] 0 00001DEE 81FE[1100] cmp si, offset _CfgMenuEsc 0 00001DF2 7503E98300 je _.L365 0 00001DF7 81FE[C609] cmp si, offset _CfgMenu 0 00001DFB 747D je _.L365 985:config.c **** { 3286 .loc 1 985 0 0 00001DFD 8B5EDC mov bx, word ptr [bp-36] 0 00001E00 8A07 mov al, byte ptr [bx] 0 00001E02 88C4 mov ah, al 0 00001E04 80F420 xor ah, 32 0 00001E07 80FC01 cmp ah, 1 0 00001E0A 18D2 sbb dl, dl 0 00001E0C FEC2 inc dl 0 00001E0E 88C4 mov ah, al 0 00001E10 80F409 xor ah, 9 0 00001E13 80FC01 cmp ah, 1 0 00001E16 18E4 sbb ah, ah 0 00001E18 FEC4 inc ah 0 00001E1A 84E2 test dl, ah 0 00001E1C 7453 je _.L333 0 00001E1E 3C3D cmp al, 61 0 00001E20 744F je _.L333 987:config.c **** continue; 3303 .loc 1 987 0 0 00001E22 53 push bx 0 00001E23 E8D5F0 call _CfgFailure 3306 _.LVL393: 988:config.c **** } 3307 .loc 1 988 0 0 00001E26 E947FD jmp _.L306 3309 _.LVL394: 3310 _.L324: 0 00001E29 8956D6 mov word ptr [bp-42], dx 3312 _.LBB171: 3313 _.LBB170: 1112:config.c **** printf("%s[Y,N]?", pLine); 3314 .loc 1 1112 0 0 00001E2C B8[2B00] mov ax, offset _.LC3 0 00001E2F 50 push ax 0 00001E30 E8[FEFF] call _init_printf 3318 _.LVL395: 1111:config.c **** printf(" "); 3319 .loc 1 1111 0 0 00001E33 8B56D6 mov dx, word ptr [bp-42] 0 00001E36 42 inc dx 3322 _.LVL396: 0 00001E37 83C402 add sp, 2 0 00001E3A E96CFF jmp _.L323 3325 _.LVL397: 3326 _.L329: 1119:config.c **** { 3327 .loc 1 1119 0 0 00001E3D 80FA4E cmp dl, 78 0 00001E40 7405 je _.L331 0 00001E42 80FA59 cmp dl, 89 0 00001E45 EB98 jmp _.L437 3332 _.L331: 1122:config.c **** return TRUE; 3333 .loc 1 1122 0 0 00001E47 B8[7601] mov ax, offset _.LC18 3335 _.LVL398: 0 00001E4A 50 push ax 0 00001E4B E8[FEFF] call _init_printf 3338 _.LVL399: 3339 _.L438: 1142:config.c **** return TRUE; 3340 .loc 1 1142 0 0 00001E4E 83C402 add sp, 2 0 00001E51 E91CFD jmp _.L306 3343 _.LVL400: 3344 _.L328: 1129:config.c **** 3345 .loc 1 1129 0 0 00001E54 C606[0000]00 mov byte ptr [_singleStep], 0 0 00001E59 EB86 jmp _.L330 3348 _.L327: 1139:config.c **** { 3349 .loc 1 1139 0 0 00001E5B 3D003F cmp ax, 16128 0 00001E5E 7403E957FF jne _.L332 1141:config.c **** SkipAllConfig = TRUE; 3352 .loc 1 1141 0 0 00001E63 B8[7601] mov ax, offset _.LC18 3354 _.LVL401: 0 00001E66 50 push ax 0 00001E67 E8[FEFF] call _init_printf 3357 _.LVL402: 1142:config.c **** return TRUE; 3358 .loc 1 1142 0 0 00001E6A C606[0000]01 mov byte ptr [_SkipAllConfig], 1 0 00001E6F EBDD jmp _.L438 3361 _.LVL403: 3362 _.L333: 3363 _.LBE170: 3364 _.LBE171: 990:config.c **** } 3365 .loc 1 990 0 0 00001E71 FF76DC push word ptr [bp-36] 0 00001E74 E891F3 call _skipwh 3368 _.LVL404: 0 00001E77 8946DC mov word ptr [bp-36], ax 3370 _.LVL405: 3371 _.L365: 992:config.c **** pLine = skipwh(pLine+1); 3372 .loc 1 992 0 0 00001E7A 81FE[C609] cmp si, offset _CfgMenu 0 00001E7E 9F lahf 0 00001E7F D0E4 shl ah, 1 0 00001E81 99 cwd 0 00001E82 88D0 mov al, dl 0 00001E84 F6D8 neg al 0 00001E86 81FE[1100] cmp si, offset _CfgMenuEsc 0 00001E8A 9F lahf 0 00001E8B D0E4 shl ah, 1 0 00001E8D 99 cwd 0 00001E8E F6DA neg dl 0 00001E90 08D0 or al, dl 0 00001E92 7508 jne _.L372 0 00001E94 8B5EDC mov bx, word ptr [bp-36] 0 00001E97 803F3D cmp byte ptr [bx], 61 0 00001E9A 750B jne _.L334 3389 _.L372: 993:config.c **** 3390 .loc 1 993 0 0 00001E9C 8B46DC mov ax, word ptr [bp-36] 0 00001E9F 40 inc ax 0 00001EA0 50 push ax 0 00001EA1 E864F3 call _skipwh 3395 _.LVL406: 0 00001EA4 8946DC mov word ptr [bp-36], ax 3397 _.LVL407: 3398 _.L334: 996:config.c **** } 3399 .loc 1 996 0 0 00001EA7 FF76DC push word ptr [bp-36] 0 00001EAA FFD6 call si 3402 _.LVL408: 0 00001EAC E9C1FC jmp _.L306 3404 _.LVL409: 3405 _.L342: 3406 _.LBE189: 3407 _.LBB190: 3408 _.LBB188: 3409 _.LBB185: 3410 _.LBB182: 3411 _.LBB181: 3412 _.LBB180: 3413 _.LBB179: 94:config.c **** { 3414 .loc 1 94 0 0 00001EAF 83C355 add bx, 85 3416 _.LVL410: 0 00001EB2 81FB[100E] cmp bx, offset _MenuStruct+850 0 00001EB6 7303E907FD jc _.L344 0 00001EBB E915FD jmp _.L343 3420 _.LVL411: 3421 _.L348: 3422 _.LBE179: 3423 _.LBE180: 3424 _.LBE181: 3425 _.LBE182: 2358:config.c **** 3426 .loc 1 2358 0 0 00001EBE B8[BE01] mov ax, offset _.LC25 0 00001EC1 50 push ax 0 00001EC2 E8[FEFF] call _init_printf 3430 _.LVL412: 0 00001EC5 83C402 add sp, 2 0 00001EC8 E999FD jmp _.L349 3433 _.L350: 2363:config.c **** 3434 .loc 1 2363 0 0 00001ECB B8[CE01] mov ax, offset _.LC27 0 00001ECE E9A0FD jmp _.L439 3437 _.L369: 2365:config.c **** 3438 .loc 1 2365 0 0 00001ED1 B8[E700] mov ax, offset _.LC11 0 00001ED4 E9AEFD jmp _.L352 3441 _.LVL413: 3442 _.L354: 2379:config.c **** 3443 .loc 1 2379 0 0 00001ED7 C706[0000]FFFF mov word ptr [_MenuTimeout], -1 2381:config.c **** { 3445 .loc 1 2381 0 0 00001EDD 3D003F cmp ax, 16128 0 00001EE0 7568 jne _.L358 2383:config.c **** break; 3448 .loc 1 2383 0 0 00001EE2 C606[0000]01 mov byte ptr [_SkipAllConfig], 1 3450 _.LVL414: 3451 _.L356: 3452 _.LBE185: 2416:config.c **** 3453 .loc 1 2416 0 0 00001EE7 B8[EF01] mov ax, offset _.LC29 0 00001EEA 50 push ax 0 00001EEB E8[FEFF] call _init_printf 3457 _.LVL415: 3458 _.LBB186: 2422:config.c **** len = strlen(buffer); 3459 .loc 1 2422 0 0 00001EEE A0[0000] mov al, byte ptr [_MenuSelected] 0 00001EF1 98 cbw 0 00001EF2 83C030 add ax, 48 0 00001EF5 50 push ax 0 00001EF6 B8[F101] mov ax, offset _.LC30 0 00001EF9 50 push ax 0 00001EFA 8D76DE lea si, [-34+bp] 3467 _.LVL416: 0 00001EFD 56 push si 0 00001EFE E8[FEFF] call _init_sprintf 3470 _.LVL417: 2423:config.c **** fstrcpy(envp, buffer); 3471 .loc 1 2423 0 0 00001F01 56 push si 0 00001F02 E8[FEFF] call _init_strlen 3474 _.LVL418: 0 00001F05 8946DC mov word ptr [bp-36], ax 3476 _.LVL419: 2424:config.c **** envp += len + 1; 3477 .loc 1 2424 0 0 00001F08 16 push ss 0 00001F09 56 push si 0 00001F0A FF36[B802] push word ptr [_envp+2] 0 00001F0E FF36[B602] push word ptr [_envp] 0 00001F12 E8[FEFF] call _init_fstrcpy 3483 _.LVL420: 2425:config.c **** *envp = 0; 3484 .loc 1 2425 0 0 00001F15 8B16[B802] mov dx, word ptr [_envp+2] 0 00001F19 8B1E[B602] mov bx, word ptr [_envp] 0 00001F1D 8B46DC mov ax, word ptr [bp-36] 0 00001F20 97 xchg di, ax 3489 _.LVL421: 0 00001F21 8D5901 lea bx, [1+bx+di] 0 00001F24 891E[B602] mov word ptr [_envp], bx 2426:config.c **** envp[1] = 0; 3492 .loc 1 2426 0 0 00001F28 8EC2 mov es, dx 2427:config.c **** envp[2] = 0; 3494 .loc 1 2427 0 0 00001F2A 26C7070000 mov word ptr es:[bx], 0 3496 _.LVL422: 2428:config.c **** } 3497 .loc 1 2428 0 0 00001F2F 26C6470200 mov byte ptr es:[bx+2], 0 3499 _.LBE186: 2430:config.c **** ClearScreen(0x7); 3500 .loc 1 2430 0 0 00001F34 83C408 add sp, 8 0 00001F37 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001F3C 7503E979FB je _.L279 2431:config.c **** } 3504 .loc 1 2431 0 0 00001F41 B007 mov al, 7 0 00001F43 50 push ax 0 00001F44 E88BF0 call _ClearScreen 3508 _.LVL423: 0 00001F47 E970FB jmp _.L279 3510 _.LVL424: 3511 _.L358: 3512 _.LBB187: 2386:config.c **** { 3513 .loc 1 2386 0 0 00001F4A 3D0042 cmp ax, 16896 0 00001F4D 7540 jne _.L359 2388:config.c **** } 3516 .loc 1 2388 0 0 00001F4F 803E[0000]01 cmp byte ptr [_singleStep], 1 0 00001F54 18D2 sbb dl, dl 0 00001F56 F6DA neg dl 0 00001F58 8816[0000] mov byte ptr [_singleStep], dl 3521 _.L360: 2405:config.c **** 3522 .loc 1 2405 0 0 00001F5C 89C2 mov dx, ax 0 00001F5E 30F6 xor dh, dh 3525 _.LVL425: 2407:config.c **** break; 3526 .loc 1 2407 0 0 00001F60 83FA0D cmp dx, 13 0 00001F63 7482 je _.L356 0 00001F65 83FA1B cmp dx, 27 0 00001F68 7503E97AFF je _.L356 3531 _.LVL426: 3532 _.LBB183: 3533 _.LBB184: 2084:config.c **** } 3534 .loc 1 2084 0 0 00001F6D 04D0 add al, -48 3536 _.LVL427: 3537 _.LBE184: 3538 _.LBE183: 2410:config.c **** { 3539 .loc 1 2410 0 0 00001F6F 3C09 cmp al, 9 0 00001F71 7603E938FC ja _.L340 0 00001F76 80C2D0 add dl, -48 0 00001F79 8B5EDA mov bx, word ptr [bp-38] 0 00001F7C 88D1 mov cl, dl 0 00001F7E D3E3 shl bx, cl 0 00001F80 851E[0000] test bx, word ptr [_Menus] 0 00001F84 7503E925FC je _.L340 2412:config.c **** break; 3548 .loc 1 2412 0 0 00001F89 A2[0000] mov byte ptr [_MenuSelected], al 0 00001F8C E958FF jmp _.L356 3551 _.LVL428: 3552 _.L359: 2390:config.c **** { 3553 .loc 1 2390 0 0 00001F8F 3D0048 cmp ax, 18432 0 00001F92 7526 jne _.L361 0 00001F94 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001F99 74C1 je _.L360 2392:config.c **** { 3558 .loc 1 2392 0 0 00001F9B 8A16[0000] mov dl, byte ptr [_MenuSelected] 0 00001F9F 84D2 test dl, dl 0 00001FA1 7EB9 jle _.L360 0 00001FA3 88D1 mov cl, dl 0 00001FA5 FEC9 dec cl 0 00001FA7 8B5EDA mov bx, word ptr [bp-38] 0 00001FAA D3E3 shl bx, cl 2394:config.c **** } 3566 .loc 1 2394 0 0 00001FAC FECA dec dl 2392:config.c **** { 3568 .loc 1 2392 0 0 00001FAE 851E[0000] test bx, word ptr [_Menus] 0 00001FB2 74A8 je _.L360 3571 _.L440: 2401:config.c **** } 3572 .loc 1 2401 0 0 00001FB4 8816[0000] mov byte ptr [_MenuSelected], dl 0 00001FB8 EBA2 jmp _.L360 3575 _.L361: 2397:config.c **** { 3576 .loc 1 2397 0 0 00001FBA 3D0050 cmp ax, 20480 0 00001FBD 759D jne _.L360 0 00001FBF 833E[0000]FF cmp word ptr [_MenuColor], -1 0 00001FC4 7496 je _.L360 2399:config.c **** { 3581 .loc 1 2399 0 0 00001FC6 8A16[0000] mov dl, byte ptr [_MenuSelected] 0 00001FCA 80FA08 cmp dl, 8 0 00001FCD 7F8D jg _.L360 0 00001FCF 88D1 mov cl, dl 0 00001FD1 FEC1 inc cl 0 00001FD3 8B5EDA mov bx, word ptr [bp-38] 0 00001FD6 D3E3 shl bx, cl 0 00001FD8 851E[0000] test bx, word ptr [_Menus] 0 00001FDC 7503E97BFF je _.L360 2401:config.c **** } 3591 .loc 1 2401 0 0 00001FE1 FEC2 inc dl 0 00001FE3 EBCF jmp _.L440 3594 _.LVL429: 3595 _.L284: 0 00001FE5 8346DC04 add word ptr [bp-36], 4 0 00001FE9 E93DFA jmp _.L283 3598 _.LBE187: 3599 _.LBE188: 3600 _.LBE190: 3601 _.LFE15: 3602 .size _DoConfig, .-_DoConfig 3603 .global _GetStringArg 3604 .type _GetStringArg, @function 3605 _GetStringArg: 3606 _.LFB20: 1189:config.c **** /* just return whatever string is there, including null */ 3607 .loc 1 1189 0 3608 _.LVL430: 0 00001FEC 55 push bp 3610 _.LCFI77: 0 00001FED 89E5 mov bp, sp 3612 _.LCFI78: 1191:config.c **** } 3613 .loc 1 1191 0 0 00001FEF 31C0 xor ax, ax 0 00001FF1 50 push ax 0 00001FF2 FF7606 push word ptr [bp+6] 0 00001FF5 FF7604 push word ptr [bp+4] 0 00001FF8 E832F2 call _scan 3619 _.LVL431: 1192:config.c **** 3620 .loc 1 1192 0 0 00001FFB 89EC mov sp, bp 0 00001FFD 5D pop bp 0 00001FFE C20400 ret 4 3624 _.LFE20: 3625 .size _GetStringArg, .-_GetStringArg 3626 .type _CfgSwitchar, @function 3627 _CfgSwitchar: 3628 _.LFB31: 1385:config.c **** /* Format: SWITCHAR = character */ 3629 .loc 1 1385 0 3630 _.LVL432: 0 00002001 56 push si 0 00002002 55 push bp 3633 _.LCFI79: 0 00002003 89E5 mov bp, sp 3635 _.LCFI80: 1388:config.c **** init_switchar(*szBuf); 3636 .loc 1 1388 0 0 00002005 BE[3808] mov si, offset _szBuf 0 00002008 56 push si 0 00002009 FF7606 push word ptr [bp+6] 0 0000200C E8[FEFF] call _GetStringArg 3641 _.LVL433: 1389:config.c **** } 3642 .loc 1 1389 0 0 0000200F 8A04 mov al, byte ptr [si] 0 00002011 98 cbw 0 00002012 894606 mov word ptr [bp+6], ax 1390:config.c **** 3646 .loc 1 1390 0 0 00002015 89EC mov sp, bp 0 00002017 5D pop bp 0 00002018 5E pop si 1389:config.c **** } 3650 .loc 1 1389 0 0 00002019 E9[FEFF] jmp _init_switchar 3652 _.LVL434: 3653 _.LFE31: 3654 .size _CfgSwitchar, .-_CfgSwitchar 3655 .type _Numlock, @function 3656 _Numlock: 3657 _.LFB42: 1783:config.c **** /* Format: NUMLOCK = (ON | OFF) */ 3658 .loc 1 1783 0 3659 _.LVL435: 0 0000201C 56 push si 0 0000201D 57 push di 0 0000201E 55 push bp 3663 _.LCFI81: 0 0000201F 89E5 mov bp, sp 3665 _.LCFI82: 0 00002021 1E push ds 0 00002022 1E push ds 3668 _.LVL436: 1787:config.c **** 3669 .loc 1 1787 0 0 00002023 BF[3808] mov di, offset _szBuf 0 00002026 57 push di 0 00002027 FF7608 push word ptr [bp+8] 0 0000202A E8[FEFF] call _GetStringArg 3674 _.LVL437: 1789:config.c **** if (!strcaseequal(szBuf, "OFF")) *keyflags |= 32; 3675 .loc 1 1789 0 0 0000202D BB1700 mov bx, 23 0 00002030 BE4000 mov si, 64 0 00002033 8EC6 mov es, si 0 00002035 268A27 mov ah, byte ptr es:[bx] 0 00002038 80E4DF and ah, -33 0 0000203B 268827 mov byte ptr es:[bx], ah 3682 _.LVL438: 0 0000203E 8866FD mov byte ptr [bp-3], ah 0 00002041 895EFE mov word ptr [bp-2], bx 1790:config.c **** keycheck(); 3685 .loc 1 1790 0 0 00002044 BA[E700] mov dx, offset _.LC11 0 00002047 52 push dx 0 00002048 57 push di 0 00002049 E878F1 call _strcaseequal 3690 _.LVL439: 0 0000204C 84C0 test al, al 0 0000204E 750E jne _.L446 1790:config.c **** keycheck(); 3693 .loc 1 1790 0 is_stmt 0 discriminator 1 0 00002050 8A66FD mov ah, byte ptr [bp-3] 0 00002053 80CC20 or ah, 32 0 00002056 8EC6 mov es, si 0 00002058 8B5EFE mov bx, word ptr [bp-2] 0 0000205B 268827 mov byte ptr es:[bx], ah 3699 _.L446: 1791:config.c **** } 3700 .loc 1 1791 0 is_stmt 1 0 0000205E E8[FEFF] call _keycheck 3702 _.LVL440: 1792:config.c **** 3703 .loc 1 1792 0 0 00002061 89EC mov sp, bp 0 00002063 5D pop bp 0 00002064 5F pop di 0 00002065 5E pop si 0 00002066 C20200 ret 2 3709 _.LFE42: 3710 .size _Numlock, .-_Numlock === Switch to base=012BB0h -> ".RODATA.STR1.1" 3711 .section .rodata.str1.1 3712 _.LC31: 0 0000094B 554D4200 .string "UMB" === Switch to base=002270h -> ".TEXT" 3714 .text 3715 .type _DosData, @function 3716 _DosData: 3717 _.LFB30: 1376:config.c **** pLine = GetStringArg(pLine, szBuf); 3718 .loc 1 1376 0 3719 _.LVL441: 0 00002069 56 push si 0 0000206A 55 push bp 3722 _.LCFI83: 0 0000206B 89E5 mov bp, sp 3724 _.LCFI84: 1377:config.c **** strupr(szBuf); 3725 .loc 1 1377 0 0 0000206D BE[3808] mov si, offset _szBuf 0 00002070 56 push si 0 00002071 FF7606 push word ptr [bp+6] 0 00002074 E8[FEFF] call _GetStringArg 3730 _.LVL442: 1378:config.c **** 3731 .loc 1 1378 0 0 00002077 56 push si 0 00002078 E82AF1 call _strupr 3734 _.LVL443: 1380:config.c **** Config.cfgDosDataUmb = TRUE; 3735 .loc 1 1380 0 0 0000207B B80300 mov ax, 3 0 0000207E 50 push ax 0 0000207F B8[FB01] mov ax, offset _.LC31 0 00002082 50 push ax 0 00002083 56 push si 0 00002084 E8[FEFF] call _init_memcmp 3742 _.LVL444: 0 00002087 85C0 test ax, ax 0 00002089 7505 jne _.L448 1381:config.c **** } 3745 .loc 1 1381 0 0 0000208B C606[0000]01 mov byte ptr [_Config], 1 3747 _.L448: 1382:config.c **** 3748 .loc 1 1382 0 0 00002090 89EC mov sp, bp 0 00002092 5D pop bp 0 00002093 5E pop si 0 00002094 C20200 ret 2 3753 _.LFE30: 3754 .size _DosData, .-_DosData === Switch to base=012BB0h -> ".RODATA.STR1.1" 3755 .section .rodata.str1.1 3756 _.LC32: 0 0000094F 4849474800 .string "HIGH" 3758 _.LC33: 0 00000954 4C4F5700 .string "LOW" 3760 _.LC34: 0 00000958 4E4F554D4200 .string "NOUMB" === Switch to base=002270h -> ".TEXT" 3762 .text 3763 .type _Dosmem, @function 3764 _Dosmem: 3765 _.LFB29: 1314:config.c **** BYTE *pTmp; 3766 .loc 1 1314 0 3767 _.LVL445: 0 00002097 56 push si 0 00002098 57 push di 0 00002099 55 push bp 3771 _.LCFI85: 0 0000209A 89E5 mov bp, sp 3773 _.LCFI86: 0 0000209C 1E push ds 3775 _.LVL446: 1318:config.c **** strcpy(szBuf, pLine); 3776 .loc 1 1318 0 0 0000209D BE[3808] mov si, offset _szBuf 0 000020A0 56 push si 0 000020A1 FF7608 push word ptr [bp+8] 0 000020A4 E8[FEFF] call _GetStringArg 3781 _.LVL447: 1319:config.c **** strupr(szBuf); 3782 .loc 1 1319 0 0 000020A7 FF7608 push word ptr [bp+8] 0 000020AA 56 push si 0 000020AB E8[FEFF] call _init_strcpy 3786 _.LVL448: 1320:config.c **** 3787 .loc 1 1320 0 0 000020AE 56 push si 0 000020AF E8F3F0 call _strupr 3790 _.LVL449: 1316:config.c **** 3791 .loc 1 1316 0 0 000020B2 C646FF00 mov byte ptr [bp-1], 0 3793 _.LVL450: 3794 _.L452: 1326:config.c **** pTmp++; 3795 .loc 1 1326 0 0 000020B6 8A04 mov al, byte ptr [si] 0 000020B8 3C20 cmp al, 32 0 000020BA 7503E9B900 je _.L453 0 000020BF 3C09 cmp al, 9 0 000020C1 7503E9B200 je _.L453 1329:config.c **** { 3801 .loc 1 1329 0 0 000020C6 BF0300 mov di, 3 0 000020C9 57 push di 0 000020CA B8[FB01] mov ax, offset _.LC31 0 000020CD 50 push ax 0 000020CE 56 push si 0 000020CF E8[FEFF] call _init_memcmp 3808 _.LVL451: 0 000020D2 85C0 test ax, ax 0 000020D4 7506 jne _.L454 3811 _.LVL452: 1332:config.c **** } 3812 .loc 1 1332 0 0 000020D6 01FE add si, di 3814 _.LVL453: 1331:config.c **** pTmp += 3; 3815 .loc 1 1331 0 0 000020D8 C646FF01 mov byte ptr [bp-1], 1 3817 _.LVL454: 3818 _.L454: 1334:config.c **** { 3819 .loc 1 1334 0 0 000020DC B80400 mov ax, 4 0 000020DF 50 push ax 0 000020E0 B8[FF01] mov ax, offset _.LC32 0 000020E3 50 push ax 0 000020E4 56 push si 0 000020E5 E8[FEFF] call _init_memcmp 3826 _.LVL455: 0 000020E8 85C0 test ax, ax 0 000020EA 7508 jne _.L455 1336:config.c **** pTmp += 4; 3829 .loc 1 1336 0 0 000020EC C606[0000]01 mov byte ptr [_HMAState], 1 1337:config.c **** } 3831 .loc 1 1337 0 0 000020F1 83C604 add si, 4 3833 _.LVL456: 3834 _.L455: 1339:config.c **** { 3835 .loc 1 1339 0 0 000020F4 57 push di 0 000020F5 B8[0402] mov ax, offset _.LC33 0 000020F8 50 push ax 0 000020F9 56 push si 0 000020FA E8[FEFF] call _init_memcmp 3841 _.LVL457: 0 000020FD 85C0 test ax, ax 0 000020FF 7508 jne _.L456 1341:config.c **** pTmp += 3; 3844 .loc 1 1341 0 0 00002101 C606[0000]03 mov byte ptr [_HMAState], 3 1342:config.c **** } 3846 .loc 1 1342 0 0 00002106 83C603 add si, 3 3848 _.LVL458: 3849 _.L456: 1344:config.c **** { 3850 .loc 1 1344 0 0 00002109 B80500 mov ax, 5 0 0000210C 50 push ax 0 0000210D B8[0802] mov ax, offset _.LC34 0 00002110 50 push ax 0 00002111 56 push si 0 00002112 E8[FEFF] call _init_memcmp 3857 _.LVL459: 0 00002115 85C0 test ax, ax 0 00002117 7506 jne _.L457 3860 _.LVL460: 1347:config.c **** } 3861 .loc 1 1347 0 0 00002119 83C605 add si, 5 3863 _.LVL461: 1346:config.c **** pTmp += 5; 3864 .loc 1 1346 0 0 0000211C 8846FF mov byte ptr [bp-1], al 3866 _.LVL462: 3867 _.L457: 1350:config.c **** 3868 .loc 1 1350 0 0 0000211F 56 push si 0 00002120 E8E5F0 call _skipwh 3871 _.LVL463: 0 00002123 96 xchg si, ax 3873 _.LVL464: 1352:config.c **** break; 3874 .loc 1 1352 0 0 00002124 8A04 mov al, byte ptr [si] 3876 _.LVL465: 0 00002126 84C0 test al, al 0 00002128 740F je _.L458 1354:config.c **** { 3879 .loc 1 1354 0 0 0000212A 3C2C cmp al, 44 0 0000212C 744A je _.L453 1356:config.c **** break; 3882 .loc 1 1356 0 0 0000212E 81EE[3808] sub si, offset _szBuf 3884 _.LVL466: 0 00002132 037608 add si, word ptr [bp+8] 3886 _.LVL467: 0 00002135 56 push si 0 00002136 E8C2ED call _CfgFailure 3889 _.LVL468: 3890 _.L458: 1362:config.c **** { 3891 .loc 1 1362 0 0 00002139 833E[0000]00 cmp word ptr [_UmbState], 0 0 0000213E 751D jne _.L461 1364:config.c **** LoL->uppermem_root = 0xffff; 3894 .loc 1 1364 0 0 00002140 C41E[0000] les bx, dword ptr [_LoL] 0 00002144 26C687890000 mov byte ptr es:[bx+137], 0 3897 _.LVL469: 1365:config.c **** UmbState = UMBwanted ? 2 : 0; 3898 .loc 1 1365 0 0 0000214A 26C7878C00FFFF mov word ptr es:[bx+140], -1 1366:config.c **** } 3900 .loc 1 1366 0 0 00002151 807EFF01 cmp byte ptr [bp-1], 1 0 00002155 19C0 sbb ax, ax 0 00002157 40 inc ax 0 00002158 D1E0 shl ax, 1 0 0000215A A3[0000] mov word ptr [_UmbState], ax 3906 _.L461: 1369:config.c **** { 3907 .loc 1 1369 0 0 0000215D 803E[0000]01 cmp byte ptr [_HMAState], 1 0 00002162 750C jne _.L451 1369:config.c **** { 3910 .loc 1 1369 0 is_stmt 0 discriminator 1 0 00002164 E8[FEFF] call _MoveKernelToHMA 3912 _.LVL470: 0 00002167 85C0 test ax, ax 0 00002169 7405 je _.L451 1371:config.c **** } 3915 .loc 1 1371 0 is_stmt 1 0 0000216B C606[0000]02 mov byte ptr [_HMAState], 2 3917 _.L451: 1373:config.c **** 3918 .loc 1 1373 0 0 00002170 89EC mov sp, bp 0 00002172 5D pop bp 0 00002173 5F pop di 0 00002174 5E pop si 0 00002175 C20200 ret 2 3924 _.LVL471: 3925 _.L453: 1327:config.c **** 3926 .loc 1 1327 0 0 00002178 46 inc si 3928 _.LVL472: 0 00002179 E93AFF jmp _.L452 3930 _.LFE29: 3931 .size _Dosmem, .-_Dosmem === Switch to base=012BB0h -> ".RODATA.STR1.1" 3932 .section .rodata.str1.1 3933 _.LC35: 0 0000095E 5C434F554E545259 .string "\\COUNTRY.SYS" 0 00000966 2E53595300 3935 _.LC36: 0 0000096B 636F756C64206E6F .string "could not find country info for country ID %u\n" 0 00000973 742066696E642063 0 0000097B 6F756E7472792069 0 00000983 6E666F20666F7220 0 0000098B 636F756E74727920 0 00000993 49442025750A00 3937 _.LC37: 0 0000099A 63757272656E7420 .string "current supported countries are " 0 000009A2 737570706F727465 0 000009AA 6420636F756E7472 0 000009B2 6965732061726520 0 000009BA 00 3939 _.LC38: 0 000009BB 25752000 .string "%u " 3941 _.LC39: 0 000009BF 2573206E6F742066 .string "%s not found\n" 0 000009C7 6F756E640A00 3943 _.LC40: 0 000009CD 4572726F72207265 .string "Error reading %s\n" 0 000009D5 6164696E67202573 0 000009DD 0A00 3945 _.LC41: 0 000009DF FF434F554E545259 .string "\377COUNTRY" 0 000009E7 00 3947 _.LC42: 0 000009E8 2573206861732069 .string "%s has invalid format\n" 0 000009F0 6E76616C69642066 0 000009F8 6F726D61740A00 === Switch to base=002270h -> ".TEXT" 3949 .text 3950 .type _Country, @function 3951 _Country: 3952 _.LFB36: 1681:config.c **** /* Format: COUNTRY = countryCode, [codePage], filename */ 3953 .loc 1 1681 0 3954 _.LVL473: 0 0000217C 56 push si 0 0000217D 57 push di 0 0000217E 55 push bp 3958 _.LCFI87: 0 0000217F 89E5 mov bp, sp 3960 _.LCFI88: 0 00002181 83EC44 sub sp, 68 1684:config.c **** char *filename = NULL; 3962 .loc 1 1684 0 0 00002184 C746D80000 mov word ptr [bp-40], 0 3964 _.LVL474: 1687:config.c **** goto error; 3965 .loc 1 1687 0 0 00002189 8D46D6 lea ax, [-42+bp] 0 0000218C 50 push ax 0 0000218D FF7608 push word ptr [bp+8] 0 00002190 E861F1 call _GetNumArg 3970 _.LVL475: 0 00002193 85C0 test ax, ax 0 00002195 750E jne _.L475 3973 _.L479: 3974 _.LBB195: 3975 _.LBB196: 1671:config.c **** goto ret; 3976 .loc 1 1671 0 0 00002197 C746D00000 mov word ptr [bp-48], 0 3978 _.LVL476: 3979 _.L476: 3980 _.LBE196: 3981 _.LBE195: 1711:config.c **** } 3982 .loc 1 1711 0 0 0000219C FF76D0 push word ptr [bp-48] 0 0000219F E859ED call _CfgFailure 3985 _.LVL477: 0 000021A2 E9F200 jmp _.L474 3987 _.LVL478: 3988 _.L475: 0 000021A5 31F6 xor si, si 1690:config.c **** if (*pLine == ',') 3990 .loc 1 1690 0 0 000021A7 50 push ax 0 000021A8 E85DF0 call _skipwh 3993 _.LVL479: 0 000021AB 8946D0 mov word ptr [bp-48], ax 3995 _.LVL480: 1685:config.c **** 3996 .loc 1 1685 0 0 000021AE 89F2 mov dx, si 1691:config.c **** { 3998 .loc 1 1691 0 0 000021B0 89C3 mov bx, ax 0 000021B2 36803F2C cmp byte ptr ss:[bx], 44 0 000021B6 753D jne _.L477 1693:config.c **** 4002 .loc 1 1693 0 0 000021B8 40 inc ax 4004 _.LVL481: 0 000021B9 50 push ax 0 000021BA E84BF0 call _skipwh 4007 _.LVL482: 1695:config.c **** if ((pLine = GetNumArg(pLine, &codePage)) == 0) 4008 .loc 1 1695 0 0 000021BD 89C3 mov bx, ax 0 000021BF 36803F2C cmp byte ptr ss:[bx], 44 0 000021C3 740C je _.L478 1696:config.c **** goto error; 4012 .loc 1 1696 0 0 000021C5 8D56D8 lea dx, [-40+bp] 0 000021C8 52 push dx 0 000021C9 50 push ax 0 000021CA E827F1 call _GetNumArg 4017 _.LVL483: 0 000021CD 85C0 test ax, ax 0 000021CF 74C6 je _.L479 4020 _.L478: 1699:config.c **** if (*pLine == ',') 4021 .loc 1 1699 0 0 000021D1 50 push ax 0 000021D2 E833F0 call _skipwh 4024 _.LVL484: 0 000021D5 8946D0 mov word ptr [bp-48], ax 4026 _.LVL485: 1700:config.c **** { 4027 .loc 1 1700 0 0 000021D8 93 xchg bx, ax 0 000021D9 36803F2C cmp byte ptr ss:[bx], 44 0 000021DD 7403E9BD00 jne _.L517 1702:config.c **** filename = szBuf; 4031 .loc 1 1702 0 0 000021E2 FF46D0 inc word ptr [bp-48] 4033 _.LVL486: 0 000021E5 BA[3808] mov dx, offset _szBuf 0 000021E8 52 push dx 0 000021E9 8956D4 mov word ptr [bp-44], dx 0 000021EC FF76D0 push word ptr [bp-48] 0 000021EF E8[FEFF] call _GetStringArg 4039 _.LVL487: 1703:config.c **** } 4040 .loc 1 1703 0 0 000021F2 8B56D4 mov dx, word ptr [bp-44] 4042 _.LVL488: 4043 _.L477: 1707:config.c **** return; 4044 .loc 1 1707 0 0 000021F5 8B46D8 mov ax, word ptr [bp-40] 0 000021F8 8946CE mov word ptr [bp-50], ax 0 000021FB 8B7ED6 mov di, word ptr [bp-42] 4048 _.LVL489: 4049 _.LBB204: 4050 _.LBB201: 1567:config.c **** BOOL rc = FALSE; 4051 .loc 1 1567 0 0 000021FE 85D2 test dx, dx 0 00002200 7503E99F00 je _.L518 0 00002205 8956CC mov word ptr [bp-52], dx 4055 _.L480: 0 00002208 8956D2 mov word ptr [bp-46], dx 4057 _.LVL490: 1572:config.c **** { 4058 .loc 1 1572 0 0 0000220B 56 push si 0 0000220C FF76CC push word ptr [bp-52] 0 0000220F E8[FEFF] call _init_DosOpen 4062 _.LVL491: 0 00002212 8946D4 mov word ptr [bp-44], ax 4064 _.LVL492: 0 00002215 85C0 test ax, ax 0 00002217 7C03E9E600 jge _.L481 1574:config.c **** return !LoadCountryInfoHardCoded(ctryCode); 4067 .loc 1 1574 0 0 0000221C 8B56D2 mov dx, word ptr [bp-46] 0 0000221F 85D2 test dx, dx 0 00002221 7403E9CC00 jne _.L482 0 00002226 BB[0000] mov bx, offset _specificCountriesSupported 4072 _.L485: 4073 _.LVL493: 4074 _.LBB197: 4075 _.LBB198: 2554:config.c **** { 4076 .loc 1 2554 0 0 00002229 363B3F cmp di, word ptr ss:[bx] 0 0000222C 757E jne _.L483 2556:config.c **** nlsCountryInfoHardcoded.C.DateFormat = country->DateFormat; 4079 .loc 1 2556 0 0 0000222E BA[0000] mov dx, offset _nlsCountryInfoHardcoded@OZSEG16 0 00002231 8EC2 mov es, dx 0 00002233 26893E[0300] mov word ptr es:[_nlsCountryInfoHardcoded+3], di 4083 _.LVL494: 2557:config.c **** nlsCountryInfoHardcoded.C.CurrencyString[0] = country->CurrencyString[0]; 4084 .loc 1 2557 0 0 00002238 8A4702 mov al, byte ptr [bx+2] 4086 _.LVL495: 0 0000223B 98 cbw 0 0000223C 26A3[0700] mov word ptr es:[_nlsCountryInfoHardcoded+7], ax 2558:config.c **** nlsCountryInfoHardcoded.C.CurrencyString[1] = country->CurrencyString[1]; 4089 .loc 1 2558 0 0 00002240 8A4703 mov al, byte ptr [bx+3] 0 00002243 26A2[0900] mov byte ptr es:[_nlsCountryInfoHardcoded+9], al 2559:config.c **** nlsCountryInfoHardcoded.C.CurrencyString[2] = country->CurrencyString[2]; 4092 .loc 1 2559 0 0 00002247 8A4704 mov al, byte ptr [bx+4] 0 0000224A 26A2[0A00] mov byte ptr es:[_nlsCountryInfoHardcoded+10], al 2560:config.c **** nlsCountryInfoHardcoded.C.ThousandSeparator[0] = country->ThousandSeparator; 4095 .loc 1 2560 0 0 0000224E 8A4705 mov al, byte ptr [bx+5] 0 00002251 26A2[0B00] mov byte ptr es:[_nlsCountryInfoHardcoded+11], al 2561:config.c **** nlsCountryInfoHardcoded.C.DecimalPoint[0] = country->DecimalPoint; 4098 .loc 1 2561 0 0 00002255 8A4706 mov al, byte ptr [bx+6] 0 00002258 26A2[0E00] mov byte ptr es:[_nlsCountryInfoHardcoded+14], al 2562:config.c **** nlsCountryInfoHardcoded.C.DateSeparator[0] = country->DateSeparator; 4101 .loc 1 2562 0 0 0000225C 8A4707 mov al, byte ptr [bx+7] 0 0000225F 26A2[1000] mov byte ptr es:[_nlsCountryInfoHardcoded+16], al 2563:config.c **** nlsCountryInfoHardcoded.C.TimeSeparator[0] = country->TimeSeparator; 4104 .loc 1 2563 0 0 00002263 8A4708 mov al, byte ptr [bx+8] 0 00002266 26A2[1200] mov byte ptr es:[_nlsCountryInfoHardcoded+18], al 2564:config.c **** nlsCountryInfoHardcoded.C.CurrencyFormat = country->CurrencyFormat; 4107 .loc 1 2564 0 0 0000226A 8A4709 mov al, byte ptr [bx+9] 0 0000226D 26A2[1400] mov byte ptr es:[_nlsCountryInfoHardcoded+20], al 2565:config.c **** nlsCountryInfoHardcoded.C.CurrencyPrecision = country->CurrencyPrecision; 4110 .loc 1 2565 0 0 00002271 8A470A mov al, byte ptr [bx+10] 0 00002274 26A2[1600] mov byte ptr es:[_nlsCountryInfoHardcoded+22], al 2566:config.c **** nlsCountryInfoHardcoded.C.TimeFormat = country->TimeFormat; 4113 .loc 1 2566 0 0 00002278 8A470B mov al, byte ptr [bx+11] 0 0000227B 26A2[1700] mov byte ptr es:[_nlsCountryInfoHardcoded+23], al 2567:config.c **** return 0; 4116 .loc 1 2567 0 0 0000227F 8A470C mov al, byte ptr [bx+12] 0 00002282 26A2[1800] mov byte ptr es:[_nlsCountryInfoHardcoded+24], al 2568:config.c **** } 4119 .loc 1 2568 0 0 00002286 31C0 xor ax, ax 4121 _.LVL496: 4122 _.L484: 0 00002288 83F001 xor ax, 1 0 0000228B 8946D2 mov word ptr [bp-46], ax 4125 _.LVL497: 4126 _.L487: 4127 _.LBE198: 4128 _.LBE197: 4129 _.LBE201: 4130 _.LBE204: 1707:config.c **** return; 4131 .loc 1 1707 0 0 0000228E 837ED200 cmp word ptr [bp-46], 0 0 00002292 7503E905FF je _.L476 4134 _.L474: 1712:config.c **** 4135 .loc 1 1712 0 0 00002297 89EC mov sp, bp 0 00002299 5D pop bp 0 0000229A 5F pop di 0 0000229B 5E pop si 0 0000229C C20200 ret 2 4141 _.LVL498: 4142 _.L517: 1685:config.c **** 4143 .loc 1 1685 0 0 0000229F 31D2 xor dx, dx 0 000022A1 E951FF jmp _.L477 4146 _.LVL499: 4147 _.L518: 4148 _.LBB205: 4149 _.LBB202: 1567:config.c **** BOOL rc = FALSE; 4150 .loc 1 1567 0 0 000022A4 C746CC[0E02] mov word ptr [bp-52], offset _.LC35 0 000022A9 E95CFF jmp _.L480 4153 _.LVL500: 4154 _.L483: 4155 _.LBB200: 4156 _.LBB199: 2552:config.c **** { 4157 .loc 1 2552 0 0 000022AC 83C30D add bx, 13 4159 _.LVL501: 2550:config.c **** country < specificCountriesSupported + LENGTH(specificCountriesSupported); 4160 .loc 1 2550 0 0 000022AF 81FB[5F01] cmp bx, offset _specificCountriesSupported+351 0 000022B3 7303E971FF jc _.L485 2572:config.c **** printf("current supported countries are "); 4163 .loc 1 2572 0 0 000022B8 57 push di 0 000022B9 B8[1B02] mov ax, offset _.LC36 4166 _.LVL502: 0 000022BC 50 push ax 0 000022BD E8[FEFF] call _init_printf 4169 _.LVL503: 2573:config.c **** 4170 .loc 1 2573 0 0 000022C0 B8[4A02] mov ax, offset _.LC37 0 000022C3 50 push ax 0 000022C4 E8[FEFF] call _init_printf 4174 _.LVL504: 4175 _.LVL505: 0 000022C7 83C406 add sp, 6 2575:config.c **** country < specificCountriesSupported + LENGTH(specificCountriesSupported); 4177 .loc 1 2575 0 0 000022CA BE[0000] mov si, offset _specificCountriesSupported 4179 _.LVL506: 4180 _.L486: 2579:config.c **** } 4181 .loc 1 2579 0 0 000022CD 36FF34 push word ptr ss:[si] 0 000022D0 B8[6B02] mov ax, offset _.LC38 0 000022D3 50 push ax 0 000022D4 E8[FEFF] call _init_printf 4186 _.LVL507: 2577:config.c **** { 4187 .loc 1 2577 0 0 000022D7 83C60D add si, 13 4189 _.LVL508: 2575:config.c **** country < specificCountriesSupported + LENGTH(specificCountriesSupported); 4190 .loc 1 2575 0 0 000022DA 83C404 add sp, 4 0 000022DD 81FE[5F01] cmp si, offset _specificCountriesSupported+351 0 000022E1 72EA jc _.L486 2581:config.c **** 4194 .loc 1 2581 0 0 000022E3 B8[EF01] mov ax, offset _.LC29 0 000022E6 50 push ax 0 000022E7 E8[FEFF] call _init_printf 4198 _.LVL509: 0 000022EA 83C402 add sp, 2 2583:config.c **** } 4200 .loc 1 2583 0 0 000022ED B80100 mov ax, 1 0 000022F0 EB96 jmp _.L484 4203 _.LVL510: 4204 _.L482: 4205 _.LBE199: 4206 _.LBE200: 1576:config.c **** return rc; 4207 .loc 1 1576 0 0 000022F2 FF76CC push word ptr [bp-52] 0 000022F5 B8[6F02] mov ax, offset _.LC39 4210 _.LVL511: 0 000022F8 50 push ax 0 000022F9 E8[FEFF] call _init_printf 4213 _.LVL512: 4214 _.LVL513: 0 000022FC 83C404 add sp, 4 0 000022FF E99AFE jmp _.L476 4217 _.LVL514: 4218 _.L481: 1579:config.c **** { 4219 .loc 1 1579 0 0 00002302 B81700 mov ax, 23 4221 _.LVL515: 0 00002305 50 push ax 0 00002306 8D56E9 lea dx, [-23+bp] 0 00002309 52 push dx 0 0000230A 8956D2 mov word ptr [bp-46], dx 4226 _.LVL516: 0 0000230D FF76D4 push word ptr [bp-44] 0 00002310 E8[FEFF] call _read 4229 _.LVL517: 0 00002313 83F817 cmp ax, 23 0 00002316 8B56D2 mov dx, word ptr [bp-46] 0 00002319 741B je _.L488 1581:config.c **** goto ret; 4233 .loc 1 1581 0 0 0000231B FF76CC push word ptr [bp-52] 0 0000231E B8[7D02] mov ax, offset _.LC40 4236 _.LVL518: 4237 _.L551: 1586:config.c **** goto ret; 4238 .loc 1 1586 0 0 00002321 50 push ax 0 00002322 E8[FEFF] call _init_printf 4241 _.LVL519: 0 00002325 83C404 add sp, 4 1568:config.c **** BYTE FAR *ptable; 4243 .loc 1 1568 0 0 00002328 C746D20000 mov word ptr [bp-46], 0 4245 _.L489: 4246 _.LVL520: 1676:config.c **** return rc; 4247 .loc 1 1676 0 0 0000232D FF76D4 push word ptr [bp-44] 0 00002330 E8[FEFF] call _close 4250 _.LVL521: 0 00002333 E958FF jmp _.L487 4252 _.LVL522: 4253 _.L488: 1584:config.c **** { 4254 .loc 1 1584 0 0 00002336 BE0800 mov si, 8 0 00002339 56 push si 0 0000233A B8[8F02] mov ax, offset _.LC41 0 0000233D 50 push ax 0 0000233E 52 push dx 0 0000233F E8[FEFF] call _init_memcmp 4261 _.LVL523: 0 00002342 8946D2 mov word ptr [bp-46], ax 0 00002345 85C0 test ax, ax 0 00002347 8976C4 mov word ptr [bp-60], si 0 0000234A 7408 je _.L490 4266 _.LVL524: 4267 _.L491: 4268 _.LDL1: 1586:config.c **** goto ret; 4269 .loc 1 1586 0 0 0000234C FF76CC push word ptr [bp-52] 0 0000234F B8[9802] mov ax, offset _.LC42 0 00002352 EBCD jmp _.L551 4273 _.LVL525: 4274 _.L490: 1589:config.c **** || read(fd, &entries, sizeof(entries)) != sizeof(entries)) 4275 .loc 1 1589 0 0 00002354 FF76FE push word ptr [bp-2] 0 00002357 FF76FC push word ptr [bp-4] 0 0000235A FF76D4 push word ptr [bp-44] 0 0000235D E8[FEFF] call _lseek 4280 _.LVL526: 0 00002360 83F8FF cmp ax, -1 0 00002363 7505 jne _.L520 0 00002365 83FAFF cmp dx, -1 0 00002368 74E2 je _.L491 4285 _.L520: 1590:config.c **** goto err; 4286 .loc 1 1590 0 0 0000236A BE0200 mov si, 2 0 0000236D 56 push si 0 0000236E B8[2607] mov ax, offset _entries.2296 0 00002371 50 push ax 0 00002372 FF76D4 push word ptr [bp-44] 0 00002375 E8[FEFF] call _read 4293 _.LVL527: 0 00002378 39F0 cmp ax, si 0 0000237A 8976CA mov word ptr [bp-54], si 0 0000237D 75CD jne _.L491 4297 _.LBE202: 4298 _.LBE205: 1707:config.c **** return; 4299 .loc 1 1707 0 0 0000237F 8B76D2 mov si, word ptr [bp-46] 4301 _.L493: 4302 _.LVL528: 4303 _.LBB206: 4304 _.LBB203: 1592:config.c **** { 4305 .loc 1 1592 0 0 00002382 363B36[2607] cmp si, word ptr ss:[_entries.2296] 0 00002387 7C0D jl _.L511 1674:config.c **** ret: 4308 .loc 1 1674 0 0 00002389 57 push di 0 0000238A B8[1B02] mov ax, offset _.LC36 0 0000238D 50 push ax 0 0000238E E8[FEFF] call _init_printf 4313 _.LVL529: 0 00002391 83C404 add sp, 4 0 00002394 EB97 jmp _.L489 4316 _.L511: 1594:config.c **** goto err; 4317 .loc 1 1594 0 0 00002396 B80E00 mov ax, 14 0 00002399 50 push ax 0 0000239A 8D46DB lea ax, [-37+bp] 0 0000239D 50 push ax 0 0000239E FF76D4 push word ptr [bp-44] 0 000023A1 E8[FEFF] call _read 4324 _.LVL530: 0 000023A4 83F80E cmp ax, 14 0 000023A7 75A3 jne _.L491 0 000023A9 837EDB0C cmp word ptr [bp-37], 12 0 000023AD 759D jne _.L491 1596:config.c **** continue; 4329 .loc 1 1596 0 0 000023AF 3B7EDD cmp di, word ptr [bp-35] 0 000023B2 751A jne _.L494 0 000023B4 837ECE01 cmp word ptr [bp-50], 1 0 000023B8 18C0 sbb al, al 0 000023BA 8846C9 mov byte ptr [bp-55], al 0 000023BD FE46C9 inc byte ptr [bp-55] 0 000023C0 8B46CE mov ax, word ptr [bp-50] 0 000023C3 3B46DF cmp ax, word ptr [bp-33] 0 000023C6 7409 je _.L495 0 000023C8 807EC900 cmp byte ptr [bp-55], 0 0 000023CC 7403 je _.L495 4341 _.L494: 1592:config.c **** { 4342 .loc 1 1592 0 0 000023CE 46 inc si 4344 _.LVL531: 0 000023CF EBB1 jmp _.L493 4346 _.L495: 1598:config.c **** || read(fd, &count, sizeof(count)) != sizeof(count) 4347 .loc 1 1598 0 0 000023D1 FF76E7 push word ptr [bp-25] 0 000023D4 FF76E5 push word ptr [bp-27] 0 000023D7 FF76D4 push word ptr [bp-44] 0 000023DA E8[FEFF] call _lseek 4352 _.LVL532: 0 000023DD 83F8FF cmp ax, -1 0 000023E0 7508 jne _.L521 0 000023E2 83FAFF cmp dx, -1 0 000023E5 7503E962FF je _.L491 4357 _.L521: 1599:config.c **** || count > LENGTH(hdr) 4358 .loc 1 1599 0 0 000023EA FF76CA push word ptr [bp-54] 0 000023ED B8[2407] mov ax, offset _count.2297 0 000023F0 50 push ax 0 000023F1 FF76D4 push word ptr [bp-44] 0 000023F4 E8[FEFF] call _read 4364 _.LVL533: 0 000023F7 83F802 cmp ax, 2 0 000023FA 7403E94DFF jne _.L491 1600:config.c **** || read(fd, hdr, sizeof(struct subf_hdr) * count) 4367 .loc 1 1600 0 0 000023FF A1[2407] mov ax, word ptr [_count.2297] 0 00002402 83F809 cmp ax, 9 0 00002405 7603E942FF ja _.L491 1601:config.c **** != sizeof(struct subf_hdr) * count) 4371 .loc 1 1601 0 0 0000240A B103 mov cl, 3 0 0000240C D3E0 shl ax, cl 0 0000240E 884ECE mov byte ptr [bp-50], cl 4375 _.LVL534: 0 00002411 50 push ax 0 00002412 BE[DC06] mov si, offset _hdr.2295 4378 _.LVL535: 0 00002415 56 push si 0 00002416 FF76D4 push word ptr [bp-44] 0 00002419 E8[FEFF] call _read 4382 _.LVL536: 1602:config.c **** goto err; 4383 .loc 1 1602 0 0 0000241C 8B16[2407] mov dx, word ptr [_count.2297] 0 00002420 8A4ECE mov cl, byte ptr [bp-50] 0 00002423 D3E2 shl dx, cl 1601:config.c **** != sizeof(struct subf_hdr) * count) 4387 .loc 1 1601 0 0 00002425 39D0 cmp ax, dx 0 00002427 8976BE mov word ptr [bp-66], si 0 0000242A 7403E91DFF jne _.L491 4391 _.LVL537: 4392 _.L497: 1606:config.c **** { 4393 .loc 1 1606 0 0 0000242F 8B46D2 mov ax, word ptr [bp-46] 0 00002432 363B06[2407] cmp ax, word ptr ss:[_count.2297] 0 00002437 7C08 jl _.L510 1671:config.c **** goto ret; 4397 .loc 1 1671 0 0 00002439 C746D20100 mov word ptr [bp-46], 1 4399 _.LVL538: 0 0000243E E9ECFE jmp _.L489 4401 _.L510: 0 00002441 8B46D2 mov ax, word ptr [bp-46] 4403 _.LVL539: 0 00002444 B103 mov cl, 3 0 00002446 D3E0 shl ax, cl 0 00002448 8946CE mov word ptr [bp-50], ax 1608:config.c **** goto err; 4407 .loc 1 1608 0 0 0000244B 8B7EBE mov di, word ptr [bp-66] 0 0000244E 93 xchg bx, ax 0 0000244F 36833906 cmp word ptr ss:[bx+di], 6 0 00002453 7403E9F4FE jne _.L491 1610:config.c **** if (subf_tbl_ndx == 3 || ((subf_tbl_ndx < 1 || subf_tbl_ndx > 7) && subf_tbl_ndx != 35)) 4412 .loc 1 1610 0 0 00002458 BF[DE06] mov di, offset _hdr.2295+2 0 0000245B 8B31 mov si, word ptr [bx+di] 4415 _.LVL540: 1611:config.c **** continue; 4416 .loc 1 1611 0 0 0000245D 83FE03 cmp si, 3 0 00002460 7503E9EF01 je _.L498 0 00002465 8D44FF lea ax, [-1+si] 0 00002468 83F807 cmp ax, 6+1 0 0000246B 7208 jc _.L522 0 0000246D 83FE23 cmp si, 35 0 00002470 7403E9DF01 jne _.L498 4424 _.L522: 1613:config.c **** subf_tbl_ndx = 8; /* 0 through 7 match, but subfunction 35 is 9th entry in table[] */ 4425 .loc 1 1613 0 0 00002475 83FE23 cmp si, 35 0 00002478 7503 jne _.L500 1614:config.c **** if (lseek(fd, hdr[i].offset) == 0xffffffffL 4428 .loc 1 1614 0 0 0000247A BE0800 mov si, 8 4430 _.LVL541: 4431 _.L500: 1615:config.c **** || read(fd, &subf_data, 10) != 10 4432 .loc 1 1615 0 0 0000247D 8B5ECE mov bx, word ptr [bp-50] 0 00002480 36FFB7[E206] push word ptr ss:[bx+_hdr.2295+6] 0 00002485 36FFB7[E006] push word ptr ss:[bx+_hdr.2295+4] 0 0000248A FF76D4 push word ptr [bp-44] 0 0000248D E8[FEFF] call _lseek 4438 _.LVL542: 0 00002490 83F8FF cmp ax, -1 0 00002493 7508 jne _.L523 0 00002495 83FAFF cmp dx, -1 0 00002498 7503E9AFFE je _.L491 4443 _.L523: 1616:config.c **** || memcmp(subf_data.signature, table[subf_tbl_ndx].sig, 8) && (hdr[i].id !=4 4444 .loc 1 1616 0 0 0000249D B80A00 mov ax, 10 0 000024A0 50 push ax 0 000024A1 B8[D205] mov ax, offset _subf_data.2290 0 000024A4 50 push ax 0 000024A5 FF76D4 push word ptr [bp-44] 0 000024A8 E8[FEFF] call _read 4451 _.LVL543: 0 000024AB 83F80A cmp ax, 10 0 000024AE B9[D205] mov cx, offset _subf_data.2290 0 000024B1 7403E996FE jne _.L491 1617:config.c **** || memcmp(subf_data.signature, table[2].sig, 8)) /* UCASE for FUCASE ^*/ 4455 .loc 1 1617 0 0 000024B6 FF76C4 push word ptr [bp-60] 0 000024B9 B80A00 mov ax, 10 0 000024BC F7E6 mul si 0 000024BE 05[0000] add ax, offset _table.2294 0 000024C1 50 push ax 0 000024C2 51 push cx 0 000024C3 894EC6 mov word ptr [bp-58], cx 0 000024C6 E8[FEFF] call _init_memcmp 4464 _.LVL544: 0 000024C9 85C0 test ax, ax 0 000024CB 8B4EC6 mov cx, word ptr [bp-58] 0 000024CE 7403E9BD00 jne _.L502 4468 _.L504: 1619:config.c **** goto err; 4469 .loc 1 1619 0 0 000024D3 36FF36[DA05] push word ptr ss:[_subf_data.2290+8] 0 000024D8 B8[DC05] mov ax, offset _subf_data.2290+10 0 000024DB 50 push ax 0 000024DC 8946BC mov word ptr [bp-68], ax 0 000024DF FF76D4 push word ptr [bp-44] 0 000024E2 E8[FEFF] call _read 4476 _.LVL545: 0 000024E5 BB[D205] mov bx, offset _subf_data.2290 0 000024E8 8B5708 mov dx, word ptr [bx+8] 0 000024EB 8956C6 mov word ptr [bp-58], dx 0 000024EE 39D0 cmp ax, dx 0 000024F0 8E46BC mov es, word ptr [bp-68] 0 000024F3 7403E954FE jne _.L491 1621:config.c **** { 4483 .loc 1 1621 0 0 000024F8 BF[DE06] mov di, offset _hdr.2295+2 0 000024FB 8B5ECE mov bx, word ptr [bp-50] 0 000024FE 8B09 mov cx, word ptr [bx+di] 0 00002500 83F901 cmp cx, 1 0 00002503 7403E90101 jne _.L505 1623:config.c **** != entry.country 4489 .loc 1 1623 0 0 00002508 BB[D205] mov bx, offset _subf_data.2290 0 0000250B 8B4F0A mov cx, word ptr [bx+10] 0 0000250E 3B4EDD cmp cx, word ptr [bp-35] 0 00002511 7403E93E01 jne _.L498 1626:config.c **** && codePage) 4494 .loc 1 1626 0 0 00002516 8B46DF mov ax, word ptr [bp-33] 1627:config.c **** continue; 4496 .loc 1 1627 0 0 00002519 363B470C cmp ax, word ptr ss:[bx+12] 0 0000251D 7409 je _.L524 0 0000251F 807EC900 cmp byte ptr [bp-55], 0 0 00002523 7403E92C01 jne _.L498 4501 _.L524: 1629:config.c **** nlsPackageHardcoded.cp = entry.codepage; 4502 .loc 1 1629 0 0 00002528 BA[0000] mov dx, offset _nlsPackageHardcoded@OZSEG16 0 0000252B 8EC2 mov es, dx 0 0000252D 26890E[0400] mov word ptr es:[_nlsPackageHardcoded+4], cx 4506 _.LVL546: 1630:config.c **** subf_data.length = /* MS-DOS "CTYINFO" is up to 38 bytes */ 4507 .loc 1 1630 0 0 00002532 26A3[0600] mov word ptr es:[_nlsPackageHardcoded+6], ax 1632:config.c **** CharMapFn = nlsCountryInfoHardcoded.C.CharMapFn; 4509 .loc 1 1632 0 0 00002536 8B5EC6 mov bx, word ptr [bp-58] 0 00002539 83FB1C cmp bx, 28 0 0000253C 7603 jbe _.L507 0 0000253E BB1C00 mov bx, 28 4514 _.L507: 1631:config.c **** min(subf_data.length, sizeof(struct CountrySpecificInfo)); 4515 .loc 1 1631 0 0 00002541 BF[D205] mov di, offset _subf_data.2290 0 00002544 895D08 mov word ptr [di+8], bx 1633:config.c **** } 4518 .loc 1 1633 0 0 00002547 B8[0000] mov ax, offset _nlsCountryInfoHardcoded@OZSEG16 0 0000254A 8EC0 mov es, ax 0 0000254C 268B0E[1900] mov cx, word ptr es:[_nlsCountryInfoHardcoded+25] 0 00002551 894EC2 mov word ptr [bp-62], cx 0 00002554 26A1[1B00] mov ax, word ptr es:[_nlsCountryInfoHardcoded+27] 0 00002558 8946C0 mov word ptr [bp-64], ax 4525 _.LVL547: 1636:config.c **** else 4526 .loc 1 1636 0 0 0000255B BE[2A00] mov si, offset _nlsPackageHardcoded+42 4528 _.LVL548: 4529 _.L508: 1663:config.c **** /* skip length ^*/ subf_data.length); 4530 .loc 1 1663 0 0 0000255E 36FF36[DA05] push word ptr ss:[_subf_data.2290+8] 0 00002563 16 push ss 0 00002564 B8[DC05] mov ax, offset _subf_data.2290+10 0 00002567 50 push ax 0 00002568 8D4402 lea ax, [2+si] 0 0000256B 52 push dx 0 0000256C 50 push ax 0 0000256D 16 push ss 0 0000256E 1F pop ds 0 0000256F E8[FEFF] call _init_fmemcpy 4541 _.LVL549: 1665:config.c **** /* fixup user callable address in case we overwrote it */ 4542 .loc 1 1665 0 0 00002572 BF[DE06] mov di, offset _hdr.2295+2 0 00002575 8B5ECE mov bx, word ptr [bp-50] 0 00002578 36833901 cmp word ptr ss:[bx+di], 1 0 0000257C 7403E9D300 jne _.L498 1667:config.c **** } 4547 .loc 1 1667 0 0 00002581 8B46C2 mov ax, word ptr [bp-62] 0 00002584 894416 mov word ptr [si+22], ax 0 00002587 8B46C0 mov ax, word ptr [bp-64] 0 0000258A 894418 mov word ptr [si+24], ax 0 0000258D E9C400 jmp _.L498 4553 _.LVL550: 4554 _.L502: 1617:config.c **** || memcmp(subf_data.signature, table[2].sig, 8)) /* UCASE for FUCASE ^*/ 4555 .loc 1 1617 0 0 00002590 BF[DE06] mov di, offset _hdr.2295+2 0 00002593 8B5ECE mov bx, word ptr [bp-50] 0 00002596 36833904 cmp word ptr ss:[bx+di], 4 0 0000259A 7403E9ADFD jne _.L491 1618:config.c **** || read(fd, subf_data.buffer, subf_data.length) != subf_data.length) 4560 .loc 1 1618 0 0 0000259F FF76C4 push word ptr [bp-60] 0 000025A2 B8[1400] mov ax, offset _table.2294+20 0 000025A5 50 push ax 0 000025A6 51 push cx 0 000025A7 E8[FEFF] call _init_memcmp 4566 _.LVL551: 0 000025AA 85C0 test ax, ax 0 000025AC 7503E922FF je _.L504 0 000025B1 E998FD jmp _.L491 4570 _.LVL552: 4571 _.L509: 1649:config.c **** /* write length */ 4572 .loc 1 1649 0 0 000025B4 50 push ax 0 000025B5 16 push ss 0 000025B6 06 push es 0 000025B7 8C46BC mov word ptr [bp-68], es 0 000025BA 8D4402 lea ax, [2+si] 0 000025BD 52 push dx 0 000025BE 8956C6 mov word ptr [bp-58], dx 0 000025C1 50 push ax 0 000025C2 16 push ss 0 000025C3 1F pop ds 0 000025C4 8C56CE mov word ptr [bp-50], ss 0 000025C7 E8[FEFF] call _init_fmemcpy 4585 _.LVL553: 1651:config.c **** fmemcpy(ptable, subf_data.buffer, 2); 4586 .loc 1 1651 0 0 000025CA BB[D205] mov bx, offset _subf_data.2290 0 000025CD 8B4708 mov ax, word ptr [bx+8] 0 000025D0 89470A mov word ptr [bx+10], ax 1652:config.c **** } 4590 .loc 1 1652 0 0 000025D3 FF76CA push word ptr [bp-54] 0 000025D6 8B4ECE mov cx, word ptr [bp-50] 0 000025D9 51 push cx 0 000025DA 8E46BC mov es, word ptr [bp-68] 0 000025DD 06 push es 0 000025DE 8B56C6 mov dx, word ptr [bp-58] 0 000025E1 EB6A jmp _.L549 4598 _.LVL554: 4599 _.L546: 1658:config.c **** { 4600 .loc 1 1658 0 0 000025E3 83F923 cmp cx, 35 0 000025E6 7403E973FF jne _.L508 1660:config.c **** fmemcpy(&nlsPackageHardcoded.nochar, subf_data.buffer + 2, 2); 4603 .loc 1 1660 0 0 000025EB FF76CA push word ptr [bp-54] 0 000025EE 16 push ss 0 000025EF 06 push es 0 000025F0 57 push di 0 000025F1 B8[0A00] mov ax, offset _nlsPackageHardcoded+10 0 000025F4 50 push ax 0 000025F5 16 push ss 0 000025F6 1F pop ds 0 000025F7 E8[FEFF] call _init_fmemcpy 4613 _.LVL555: 1661:config.c **** } else { 4614 .loc 1 1661 0 0 000025FA FF76CA push word ptr [bp-54] 0 000025FD 16 push ss 0 000025FE B8[DE05] mov ax, offset _subf_data.2290+12 0 00002601 50 push ax 0 00002602 57 push di 0 00002603 B8[0C00] mov ax, offset _nlsPackageHardcoded+12 0 00002606 50 push ax 0 00002607 EB46 jmp _.L550 4623 _.LVL556: 4624 _.L505: 0 00002609 8946C6 mov word ptr [bp-58], ax 1638:config.c **** if (hdr[i].id == 7) 4626 .loc 1 1638 0 0 0000260C BA[0000] mov dx, offset _nlsPackageHardcoded@OZSEG16 0 0000260F 89D7 mov di, dx 0 00002611 B80A00 mov ax, 10 0 00002614 F7E6 mul si 0 00002616 96 xchg si, ax 4632 _.LVL557: 0 00002617 8B9C[0800] mov bx, word ptr [si+_table.2294+8] 0 0000261B B80500 mov ax, 5 0 0000261E F7E3 mul bx 0 00002620 93 xchg bx, ax 0 00002621 81C3[0000] add bx, offset _nlsPackageHardcoded 0 00002625 8EDF mov ds, di 0 00002627 8B7711 mov si, word ptr [bx+17] 0 0000262A 8B5713 mov dx, word ptr [bx+19] 4641 _.LVL558: 1639:config.c **** { 4642 .loc 1 1639 0 0 0000262D 83F907 cmp cx, 7 0 00002630 75B1 jne _.L546 0 00002632 8B46C6 mov ax, word ptr [bp-58] 1641:config.c **** { 4646 .loc 1 1641 0 0 00002635 85C0 test ax, ax 0 00002637 7403E978FF jne _.L509 1644:config.c **** fmemcpy(ptable, subf_data.buffer, 4); 4649 .loc 1 1644 0 0 0000263C BB[D205] mov bx, offset _subf_data.2290 0 0000263F 3689470A mov word ptr ss:[bx+10], ax 0 00002643 3689470C mov word ptr ss:[bx+12], ax 1645:config.c **** } 4653 .loc 1 1645 0 0 00002647 B80400 mov ax, 4 0 0000264A 50 push ax 0 0000264B 16 push ss 0 0000264C 06 push es 4658 _.LVL559: 4659 _.L549: 1652:config.c **** } 4660 .loc 1 1652 0 0 0000264D 52 push dx 0 0000264E 56 push si 4663 _.L550: 0 0000264F 16 push ss 0 00002650 1F pop ds 0 00002651 E8[FEFF] call _init_fmemcpy 4667 _.LVL560: 4668 _.L498: 1606:config.c **** { 4669 .loc 1 1606 0 0 00002654 FF46D2 inc word ptr [bp-46] 4671 _.LVL561: 0 00002657 E9D5FD jmp _.L497 4673 _.LBE203: 4674 _.LBE206: 4675 _.LFE36: 4676 .size _Country, .-_Country 4677 .type _CfgBreak, @function 4678 _CfgBreak: 4679 _.LFB41: 1776:config.c **** /* Format: BREAK = (ON | OFF) */ 4680 .loc 1 1776 0 4681 _.LVL562: 0 0000265A 56 push si 0 0000265B 55 push bp 4684 _.LCFI89: 0 0000265C 89E5 mov bp, sp 4686 _.LCFI90: 1778:config.c **** break_ena = strcaseequal(szBuf, "OFF") ? 0 : 1; 4687 .loc 1 1778 0 0 0000265E BE[3808] mov si, offset _szBuf 0 00002661 56 push si 0 00002662 FF7606 push word ptr [bp+6] 0 00002665 E8[FEFF] call _GetStringArg 4692 _.LVL563: 1779:config.c **** } 4693 .loc 1 1779 0 0 00002668 B8[E700] mov ax, offset _.LC11 0 0000266B 50 push ax 0 0000266C 56 push si 0 0000266D E854EB call _strcaseequal 4698 _.LVL564: 0 00002670 3C01 cmp al, 1 0 00002672 18C0 sbb al, al 0 00002674 F6D8 neg al 0 00002676 BA[0000] mov dx, offset _break_ena@OZSEG16 0 00002679 8EC2 mov es, dx 0 0000267B 26A2[0000] mov byte ptr es:[_break_ena], al 4705 _.LVL565: 1780:config.c **** 4706 .loc 1 1780 0 0 0000267F 89EC mov sp, bp 0 00002681 5D pop bp 0 00002682 5E pop si 0 00002683 C20200 ret 2 4711 _.LFE41: 4712 .size _CfgBreak, .-_CfgBreak 4713 .global _KernelAllocPara 4714 .type _KernelAllocPara, @function 4715 _KernelAllocPara: 4716 _.LFB47: 1921:config.c **** seg base, start; 4717 .loc 1 1921 0 4718 _.LVL566: 0 00002686 56 push si 0 00002687 57 push di 0 00002688 55 push bp 4722 _.LCFI91: 0 00002689 89E5 mov bp, sp 4724 _.LCFI92: 0 0000268B 1E push ds 0 0000268C 1E push ds 1926:config.c **** mode = 0; 4727 .loc 1 1926 0 0 0000268D 833E[0000]01 cmp word ptr [_UmbState], 1 0 00002692 7403E9A900 jne _.L555 4730 _.LVL567: 1929:config.c **** { 4731 .loc 1 1929 0 0 00002697 837E0E00 cmp word ptr [bp+14], 0 0 0000269B 7503E9A000 je _.L555 1931:config.c **** start = umb_start; 4734 .loc 1 1931 0 0 000026A0 8B3E[3A0A] mov di, word ptr [_umb_base_seg] 4736 _.LVL568: 1932:config.c **** } 4737 .loc 1 1932 0 0 000026A4 A1[0000] mov ax, word ptr [_umb_start] 0 000026A7 8946FE mov word ptr [bp-2], ax 4740 _.LVL569: 4741 _.L556: 1943:config.c **** { 4742 .loc 1 1943 0 0 000026AA 3B7EFE cmp di, word ptr [bp-2] 0 000026AD 7526 jne _.L557 4745 _.LVL570: 4746 _.LBB207: 1946:config.c **** mcb_init(base, p->m_size - 1, p->m_type); 4747 .loc 1 1946 0 0 000026AF 8D7501 lea si, [1+di] 4749 _.LVL571: 1947:config.c **** mumcb_init(FP_SEG(p), 0); 4750 .loc 1 1947 0 0 000026B2 8EC7 mov es, di 0 000026B4 26FF360000 push word ptr es:[0] 0 000026B9 268B160300 mov dx, word ptr es:[3] 0 000026BE 4A dec dx 0 000026BF 52 push dx 0 000026C0 56 push si 0 000026C1 E8A4E8 call _mcb_init 4758 _.LVL572: 1948:config.c **** p->m_name[1] = 'D'; 4759 .loc 1 1948 0 0 000026C4 31C0 xor ax, ax 0 000026C6 50 push ax 0 000026C7 57 push di 0 000026C8 E874F1 call _mumcb_init 4764 _.LVL573: 1949:config.c **** } 4765 .loc 1 1949 0 0 000026CB 8EC7 mov es, di 0 000026CD 26C606090044 mov byte ptr es:[9], 68 4768 _.LVL574: 1946:config.c **** mcb_init(base, p->m_size - 1, p->m_type); 4769 .loc 1 1946 0 0 000026D3 89F7 mov di, si 4771 _.LVL575: 4772 _.L557: 4773 _.LBE207: 1952:config.c **** mcb_init(base + nPara, para2far(base)->m_size - nPara, para2far(base)->m_type); 4774 .loc 1 1952 0 0 000026D5 8B5608 mov dx, word ptr [bp+8] 0 000026D8 42 inc dx 4777 _.LVL576: 1953:config.c **** para2far(start)->m_size += nPara; 4778 .loc 1 1953 0 0 000026D9 89FE mov si, di 0 000026DB 01D6 add si, dx 0 000026DD 8EC7 mov es, di 0 000026DF 26FF360000 push word ptr es:[0] 0 000026E4 268B0E0300 mov cx, word ptr es:[3] 0 000026E9 29D1 sub cx, dx 0 000026EB 8956FC mov word ptr [bp-4], dx 0 000026EE 51 push cx 0 000026EF 56 push si 0 000026F0 E875E8 call _mcb_init 4789 _.LVL577: 1954:config.c **** 4790 .loc 1 1954 0 0 000026F3 C456FC les dx, dword ptr [bp-4] 0 000026F6 2601160300 add word ptr es:[3], dx 4793 _.LVL578: 1957:config.c **** p->start = FP_SEG(p)+1; 4794 .loc 1 1957 0 0 000026FB 8A560A mov dl, byte ptr [bp+10] 0 000026FE 8EC7 mov es, di 0 00002700 31DB xor bx, bx 0 00002702 268817 mov byte ptr es:[bx], dl 1958:config.c **** p->size = nPara-1; 4799 .loc 1 1958 0 0 00002705 8D5501 lea dx, [1+di] 0 00002708 2689160100 mov word ptr es:[1], dx 1959:config.c **** if (name) 4802 .loc 1 1959 0 0 0000270D 8B4608 mov ax, word ptr [bp+8] 0 00002710 26A30300 mov word ptr es:[3], ax 1960:config.c **** fmemcpy(p->name, name, 8); 4805 .loc 1 1960 0 0 00002714 395E0C cmp word ptr [bp+12], bx 0 00002717 7413 je _.L558 0 00002719 8956FE mov word ptr [bp-2], dx 1961:config.c **** base += nPara; 4809 .loc 1 1961 0 0 0000271C B90800 mov cx, 8 0 0000271F 51 push cx 0 00002720 16 push ss 0 00002721 FF760C push word ptr [bp+12] 0 00002724 57 push di 0 00002725 51 push cx 0 00002726 E8[FEFF] call _init_fmemcpy 4817 _.LVL579: 0 00002729 8B56FE mov dx, word ptr [bp-2] 4819 _.L558: 4820 _.LVL580: 1963:config.c **** umb_base_seg = base; 4821 .loc 1 1963 0 0 0000272C 837E0E00 cmp word ptr [bp+14], 0 0 00002730 7425 je _.L559 1964:config.c **** else 4824 .loc 1 1964 0 0 00002732 8936[3A0A] mov word ptr [_umb_base_seg], si 4826 _.L560: 1968:config.c **** 4827 .loc 1 1968 0 0 00002736 31C0 xor ax, ax 0 00002738 89EC mov sp, bp 0 0000273A 5D pop bp 0 0000273B 5F pop di 4832 _.LVL581: 0 0000273C 5E pop si 4834 _.LVL582: 0 0000273D C20800 ret 8 4836 _.LVL583: 4837 _.L555: 1936:config.c **** start = LoL->first_mcb; 4838 .loc 1 1936 0 0 00002740 8B3E[3C0A] mov di, word ptr [_base_seg] 4840 _.LVL584: 1937:config.c **** } 4841 .loc 1 1937 0 0 00002744 C41E[0000] les bx, dword ptr [_LoL] 0 00002748 268B4724 mov ax, word ptr es:[bx+36] 0 0000274C 8946FE mov word ptr [bp-2], ax 4845 _.LVL585: 0 0000274F C7460E0000 mov word ptr [bp+14], 0 0 00002754 E953FF jmp _.L556 4848 _.LVL586: 4849 _.L559: 1966:config.c **** return MK_FP(FP_SEG(p)+1, 0); 4850 .loc 1 1966 0 0 00002757 8936[3C0A] mov word ptr [_base_seg], si 0 0000275B EBD9 jmp _.L560 4853 _.LFE47: 4854 .size _KernelAllocPara, .-_KernelAllocPara 4855 .global _KernelAlloc 4856 .type _KernelAlloc, @function 4857 _KernelAlloc: 4858 _.LFB48: 1971:config.c **** void FAR *p; 4859 .loc 1 1971 0 4860 _.LVL587: 0 0000275D 56 push si 0 0000275E 57 push di 0 0000275F 55 push bp 4864 _.LCFI93: 0 00002760 89E5 mov bp, sp 4866 _.LCFI94: 0 00002762 1E push ds 0 00002763 1E push ds 0 00002764 8B7E08 mov di, word ptr [bp+8] 1973:config.c **** 4870 .loc 1 1973 0 0 00002767 8D450F lea ax, [15+di] 0 0000276A B104 mov cl, 4 0 0000276C D3E8 shr ax, cl 4874 _.LVL588: 1975:config.c **** { 4875 .loc 1 1975 0 0 0000276E C41E[0000] les bx, dword ptr [_LoL] 0 00002772 26837F2400 cmp word ptr es:[bx+36], 0 0 00002777 BE0000 mov si, 0 0 0000277A 753C jne _.L569 1978:config.c **** p = AlignParagraph(lpTop); 4880 .loc 1 1978 0 0 0000277C 8B1E[0000] mov bx, word ptr [_lpTop] 0 00002780 8B16[0200] mov dx, word ptr [_lpTop+2] 0 00002784 29C2 sub dx, ax 0 00002786 89D0 mov ax, dx 4885 _.LVL589: 0 00002788 8916[0200] mov word ptr [_lpTop+2], dx 4887 _.LVL590: 4888 _.LBB210: 4889 _.LBB211: 2006:config.c **** if (FP_OFF(lpPtr) > 0xfff0) 4890 .loc 1 2006 0 0 0000278C 8D570F lea dx, [15+bx] 0 0000278F D3EA shr dx, cl 0 00002791 01C2 add dx, ax 4894 _.LVL591: 2007:config.c **** uSegVal += 0x1000; /* handle overflow */ 4895 .loc 1 2007 0 0 00002793 83FBF0 cmp bx, -16 0 00002796 7603 jbe _.L570 2008:config.c **** 4898 .loc 1 2008 0 0 00002798 80C610 add dh, 16 4900 _.LVL592: 4901 _.L570: 2012:config.c **** } 4902 .loc 1 2012 0 0 0000279B 31C0 xor ax, ax 4904 _.LVL593: 4905 _.L571: 4906 _.LBE211: 4907 _.LBE210: 1985:config.c **** return p; 4908 .loc 1 1985 0 0 0000279D 57 push di 0 0000279E 56 push si 0 0000279F 52 push dx 0 000027A0 8956FC mov word ptr [bp-4], dx 0 000027A3 50 push ax 0 000027A4 8946FE mov word ptr [bp-2], ax 0 000027A7 E8[FEFF] call _init_fmemset 4916 _.LVL594: 1987:config.c **** 4917 .loc 1 1987 0 0 000027AA 8B46FE mov ax, word ptr [bp-2] 0 000027AD 8B56FC mov dx, word ptr [bp-4] 0 000027B0 89EC mov sp, bp 0 000027B2 5D pop bp 0 000027B3 5F pop di 0 000027B4 5E pop si 0 000027B5 C20600 ret 6 4925 _.LVL595: 4926 _.L569: 1983:config.c **** } 4927 .loc 1 1983 0 0 000027B8 FF760C push word ptr [bp+12] 0 000027BB 56 push si 0 000027BC FF760A push word ptr [bp+10] 0 000027BF 50 push ax 0 000027C0 E8[FEFF] call _KernelAllocPara 4933 _.LVL596: 0 000027C3 EBD8 jmp _.L571 4935 _.LFE48: 4936 .size _KernelAlloc, .-_KernelAlloc === Switch to base=012BB0h -> ".RODATA.STR1.1" 4937 .section .rodata.str1.1 4938 _.LC43: 0 000009FF 425546464552533D .string "BUFFERS=%u not supported, reducing to 99\n" 0 00000A07 2575206E6F742073 0 00000A0F 7570706F72746564 0 00000A17 2C20726564756369 0 00000A1F 6E6720746F203939 0 00000A27 0A00 4940 _.LC44: 0 00000A29 4B65726E656C3A20 .string "Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n" 0 00000A31 616C6C6F63617465 0 00000A39 6420256420446973 0 00000A41 6B62756666657273 0 00000A49 203D202575204279 0 00000A51 74657320696E2048 0 00000A59 4D410A00 === Switch to base=002270h -> ".TEXT" 4942 .text 4943 .type _config_init_buffers, @function 4944 _config_init_buffers: 4945 _.LFB61: 2154:config.c **** struct buffer FAR *pbuffer; 4946 .loc 1 2154 0 4947 _.LVL597: 0 000027C5 56 push si 0 000027C6 57 push di 0 000027C7 55 push bp 4951 _.LCFI95: 0 000027C8 89E5 mov bp, sp 4953 _.LCFI96: 0 000027CA 83EC06 sub sp, 6 0 000027CD 8B7E08 mov di, word ptr [bp+8] 4956 _.LVL598: 2159:config.c **** wantedbuffers = -wantedbuffers; 4957 .loc 1 2159 0 0 000027D0 85FF test di, di 0 000027D2 7D06 jge _.L574 2160:config.c **** else if (HMAState == HMA_DONE) 4960 .loc 1 2160 0 0 000027D4 F7DF neg di 4962 _.LVL599: 4963 _.L582: 2156:config.c **** 4964 .loc 1 2156 0 0 000027D6 31C9 xor cx, cx 0 000027D8 EB17 jmp _.L575 4967 _.LVL600: 4968 _.L574: 2161:config.c **** buffers = (0xfff0 - HMAFree) / sizeof(struct buffer); 4969 .loc 1 2161 0 0 000027DA 803E[0000]02 cmp byte ptr [_HMAState], 2 0 000027DF 75F5 jne _.L582 2162:config.c **** 4972 .loc 1 2162 0 0 000027E1 B9F0FF mov cx, -16 0 000027E4 2B0E[0000] sub cx, word ptr [_HMAFree] 0 000027E8 BB1402 mov bx, 532 0 000027EB 91 xchg cx, ax 0 000027EC 31D2 xor dx, dx 0 000027EE F7F3 div bx 0 000027F0 91 xchg cx, ax 4980 _.LVL601: 4981 _.L575: 2164:config.c **** wantedbuffers = 6; 4982 .loc 1 2164 0 0 000027F1 83FF05 cmp di, 5 0 000027F4 7F03E9F400 jle _.L583 2166:config.c **** { 4985 .loc 1 2166 0 0 000027F9 83FF63 cmp di, 99 0 000027FC 7E14 jle _.L576 0 000027FE 894EFE mov word ptr [bp-2], cx 2168:config.c **** wantedbuffers = 99; 4989 .loc 1 2168 0 0 00002801 57 push di 0 00002802 B8[AF02] mov ax, offset _.LC43 0 00002805 50 push ax 0 00002806 E8[FEFF] call _init_printf 4994 _.LVL602: 4995 _.LVL603: 0 00002809 83C404 add sp, 4 2169:config.c **** } 4997 .loc 1 2169 0 0 0000280C BF6300 mov di, 99 0 0000280F 8B4EFE mov cx, word ptr [bp-2] 5000 _.LVL604: 5001 _.L576: 0 00002812 39F9 cmp cx, di 0 00002814 7302 jnc _.L577 0 00002816 89F9 mov cx, di 5005 _.L577: 5006 _.LVL605: 2174:config.c **** LoL->inforecptr = &LoL->firstbuf; 5007 .loc 1 2174 0 0 00002818 C41E[0000] les bx, dword ptr [_LoL] 0 0000281C 26894F65 mov word ptr es:[bx+101], cx 2175:config.c **** { 5010 .loc 1 2175 0 0 00002820 8D576D lea dx, [109+bx] 0 00002823 26895738 mov word ptr es:[bx+56], dx 0 00002827 268C473A mov word ptr es:[bx+58], es 5014 _.LBB212: 2177:config.c **** pbuffer = HMAalloc(bytes); 5015 .loc 1 2177 0 0 0000282B B81402 mov ax, 532 0 0000282E F7E1 mul cx 0 00002830 894EFA mov word ptr [bp-6], cx 0 00002833 8946FC mov word ptr [bp-4], ax 5020 _.LVL606: 2178:config.c **** 5021 .loc 1 2178 0 0 00002836 50 push ax 0 00002837 E8[FEFF] call _HMAalloc 5024 _.LVL607: 0 0000283A 96 xchg si, ax 0 0000283B 8956FE mov word ptr [bp-2], dx 5027 _.LVL608: 2180:config.c **** { 5028 .loc 1 2180 0 0 0000283E 92 xchg dx, ax 5030 _.LVL609: 0 0000283F 09F0 or ax, si 0 00002841 8B4EFA mov cx, word ptr [bp-6] 0 00002844 7403E9AA00 jne _.L578 2182:config.c **** if (HMAState == HMA_DONE) 5034 .loc 1 2182 0 0 00002849 50 push ax 0 0000284A B042 mov al, 66 0 0000284C 50 push ax 0 0000284D FF76FC push word ptr [bp-4] 0 00002850 E8[FEFF] call _KernelAlloc 5040 _.LVL610: 0 00002853 96 xchg si, ax 5042 _.LVL611: 0 00002854 8956FE mov word ptr [bp-2], dx 5044 _.LVL612: 2183:config.c **** firstAvailableBuf = MK_FP(0xffff, HMAFree); 5045 .loc 1 2183 0 0 00002857 803E[0000]02 cmp byte ptr [_HMAState], 2 0 0000285C 8B4EFA mov cx, word ptr [bp-6] 0 0000285F 7515 jne _.L579 2184:config.c **** } 5049 .loc 1 2184 0 0 00002861 B8[0000] mov ax, offset _firstAvailableBuf@OZSEG16 5051 _.LVL613: 0 00002864 8B16[0000] mov dx, word ptr [_HMAFree] 5053 _.LVL614: 0 00002868 8EC0 mov es, ax 0 0000286A 268916[0000] mov word ptr es:[_firstAvailableBuf], dx 5056 _.LVL615: 0 0000286F 26C706[0200]FFFF mov word ptr es:[_firstAvailableBuf+2], -1 5058 _.L579: 5059 _.LVL616: 5060 _.LBE212: 2193:config.c **** LoL->firstbuf = pbuffer; 5061 .loc 1 2193 0 0 00002876 C41E[0000] les bx, dword ptr [_LoL] 0 0000287A 26C7477A[0000] mov word ptr es:[bx+122], offset _DiskTransferBuffer 5064 _.LVL617: 0 00002880 B8[0000] mov ax, offset _DiskTransferBuffer@OZSEG16 0 00002883 2689477C mov word ptr es:[bx+124], ax 2194:config.c **** 5067 .loc 1 2194 0 0 00002887 2689776D mov word ptr es:[bx+109], si 0 0000288B 8B46FE mov ax, word ptr [bp-2] 0 0000288E 2689476F mov word ptr es:[bx+111], ax 5071 _.LVL618: 2200:config.c **** { 5072 .loc 1 2200 0 0 00002892 8B5EFC mov bx, word ptr [bp-4] 0 00002895 8D80ECFD lea ax, [-532+bx+si] 0 00002899 8E46FE mov es, word ptr [bp-2] 0 0000289C 26894402 mov word ptr es:[si+2], ax 2199:config.c **** pbuffer->b_prev = FP_OFF(pbuffer + buffers); 5077 .loc 1 2199 0 0 000028A0 89C8 mov ax, cx 0 000028A2 48 dec ax 5080 _.LVL619: 5081 _.LBB213: 2202:config.c **** do 5082 .loc 1 2202 0 0 000028A3 89F3 mov bx, si 5084 _.LVL620: 5085 _.L580: 2205:config.c **** pbuffer++; 5086 .loc 1 2205 0 discriminator 1 0 000028A5 8D971402 lea dx, [532+bx] 0 000028A9 8E46FE mov es, word ptr [bp-2] 0 000028AC 268917 mov word ptr es:[bx], dx 5090 _.LVL621: 2207:config.c **** } 5091 .loc 1 2207 0 discriminator 1 0 000028AF 8E46FE mov es, word ptr [bp-2] 0 000028B2 89D7 mov di, dx 0 000028B4 26895D02 mov word ptr es:[di+2], bx 5095 _.LVL622: 2205:config.c **** pbuffer++; 5096 .loc 1 2205 0 discriminator 1 0 000028B8 89D3 mov bx, dx 2209:config.c **** } 5098 .loc 1 2209 0 discriminator 1 0 000028BA 48 dec ax 5100 _.LVL623: 0 000028BB 75E8 jne _.L580 5102 _.LBE213: 2211:config.c **** 5103 .loc 1 2211 0 0 000028BD 8B5EFC mov bx, word ptr [bp-4] 0 000028C0 8D98ECFD lea bx, [-532+bx+si] 0 000028C4 8E46FE mov es, word ptr [bp-2] 5107 _.LVL624: 0 000028C7 268937 mov word ptr es:[bx], si 2221:config.c **** { 5109 .loc 1 2221 0 0 000028CA 837EFEFF cmp word ptr [bp-2], -1 0 000028CE 7515 jne _.L573 5112 _.LVL625: 2224:config.c **** { 5113 .loc 1 2224 0 0 000028D0 803E[1500]00 cmp byte ptr [_InitKernelConfig+21], 0 0 000028D5 780E js _.L573 2226:config.c **** buffers, buffers * sizeof(struct buffer)); 5116 .loc 1 2226 0 0 000028D7 FF76FC push word ptr [bp-4] 0 000028DA 51 push cx 0 000028DB B8[D902] mov ax, offset _.LC44 5120 _.LVL626: 0 000028DE 50 push ax 0 000028DF E8[FEFF] call _init_printf 5123 _.LVL627: 0 000028E2 83C406 add sp, 6 5125 _.L573: 2230:config.c **** 5126 .loc 1 2230 0 0 000028E5 89EC mov sp, bp 0 000028E7 5D pop bp 0 000028E8 5F pop di 0 000028E9 5E pop si 0 000028EA C20200 ret 2 5132 _.LVL628: 5133 _.L583: 2165:config.c **** if (wantedbuffers > 99) /* max 99 buffers */ 5134 .loc 1 2165 0 0 000028ED BF0600 mov di, 6 5136 _.LVL629: 0 000028F0 E91FFF jmp _.L576 5138 _.LVL630: 5139 _.L578: 5140 _.LBB214: 2188:config.c **** /* space in HMA beyond requested buffers available as user space */ 5141 .loc 1 2188 0 0 000028F3 C41E[0000] les bx, dword ptr [_LoL] 0 000028F7 26C6477901 mov byte ptr es:[bx+121], 1 5144 _.LVL631: 2190:config.c **** } 5145 .loc 1 2190 0 0 000028FC BB[0000] mov bx, offset _firstAvailableBuf@OZSEG16 0 000028FF B81402 mov ax, 532 0 00002902 F7E7 mul di 5149 _.LVL632: 0 00002904 01F0 add ax, si 0 00002906 8EC3 mov es, bx 0 00002908 26A3[0000] mov word ptr es:[_firstAvailableBuf], ax 0 0000290C 8B46FE mov ax, word ptr [bp-2] 0 0000290F 26A3[0200] mov word ptr es:[_firstAvailableBuf+2], ax 0 00002913 E960FF jmp _.L579 5156 _.LBE214: 5157 _.LFE61: 5158 .size _config_init_buffers, .-_config_init_buffers 5159 .global _PreConfig 5160 .type _PreConfig, @function 5161 _PreConfig: 5162 _.LFB8: 334:config.c **** /* Initialize the base memory pointers */ 5163 .loc 1 334 0 0 00002916 56 push si 0 00002917 57 push di 0 00002918 55 push bp 5167 _.LCFI97: 0 00002919 89E5 mov bp, sp 5169 _.LCFI98: 0 0000291B 1E push ds 0 0000291C 1E push ds 341:config.c **** /* LoL->FCBp = (sfttbl FAR *)&FcbSft; */ 5172 .loc 1 341 0 0 0000291D 8B1E[0000] mov bx, word ptr [_LoL] 0 00002921 A1[0200] mov ax, word ptr [_LoL+2] 0 00002924 31F6 xor si, si 0 00002926 8EC0 mov es, ax 0 00002928 26C7472ACC00 mov word ptr es:[bx+42], 204 0 0000292E 2689472C mov word ptr es:[bx+44], ax 347:config.c **** 5179 .loc 1 347 0 0 00002932 A0[0100] mov al, byte ptr [_Config+1] 0 00002935 98 cbw 0 00002936 50 push ax 0 00002937 E88BFE call _config_init_buffers 5184 _.LVL633: 349:config.c **** 5185 .loc 1 349 0 0 0000293A 8B1E[0000] mov bx, word ptr [_LoL] 0 0000293E 8B3E[0200] mov di, word ptr [_LoL+2] 0 00002942 56 push si 0 00002943 B04C mov al, 76 0 00002945 50 push ax 0 00002946 8EC7 mov es, di 0 00002948 268A4747 mov al, byte ptr es:[bx+71] 0 0000294C 895EFE mov word ptr [bp-2], bx 0 0000294F B258 mov dl, 88 0 00002951 F6E2 mul dl 0 00002953 50 push ax 0 00002954 E8[FEFF] call _KernelAlloc 5198 _.LVL634: 0 00002957 8EC7 mov es, di 0 00002959 8B5EFE mov bx, word ptr [bp-2] 0 0000295C 2689473C mov word ptr es:[bx+60], ax 0 00002960 2689573E mov word ptr es:[bx+62], dx 359:config.c **** 5203 .loc 1 359 0 0 00002964 89EC mov sp, bp 0 00002966 5D pop bp 0 00002967 5F pop di 0 00002968 5E pop si 0 00002969 C3 ret 5209 _.LFE8: 5210 .size _PreConfig, .-_PreConfig 5211 .global _PreConfig2 5212 .type _PreConfig2, @function 5213 _PreConfig2: 5214 _.LFB9: 363:config.c **** struct sfttbl FAR *sp; 5215 .loc 1 363 0 0 0000296A 56 push si 0 0000296B 57 push di 0 0000296C 55 push bp 5219 _.LCFI99: 0 0000296D 89E5 mov bp, sp 5221 _.LCFI100: 0 0000296F 1E push ds 376:config.c **** 5223 .loc 1 376 0 0 00002970 8B36[0000] mov si, word ptr [_LoL] 0 00002974 8B3E[0200] mov di, word ptr [_LoL+2] 0 00002978 E8[FEFF] call _DynLast 5227 _.LVL635: 0 0000297B 89C1 mov cx, ax 0 0000297D 83C10F add cx, 15 0 00002980 89CB mov bx, cx 5231 _.LVL636: 5232 _.LBB217: 5233 _.LBB218: 2006:config.c **** if (FP_OFF(lpPtr) > 0xfff0) 5234 .loc 1 2006 0 0 00002982 83C01E add ax, 30 0 00002985 B104 mov cl, 4 5237 _.LVL637: 0 00002987 D3E8 shr ax, cl 0 00002989 01C2 add dx, ax 5240 _.LVL638: 2007:config.c **** uSegVal += 0x1000; /* handle overflow */ 5241 .loc 1 2007 0 0 0000298B 83FBF0 cmp bx, -16 0 0000298E 7603 jbe _.L589 2008:config.c **** 5244 .loc 1 2008 0 0 00002990 80C610 add dh, 16 5246 _.LVL639: 5247 _.L589: 5248 _.LBE218: 5249 _.LBE217: 376:config.c **** 5250 .loc 1 376 0 0 00002993 8EC7 mov es, di 0 00002995 26895424 mov word ptr es:[si+36], dx 0 00002999 8916[3C0A] mov word ptr [_base_seg], dx 378:config.c **** { 5254 .loc 1 378 0 0 0000299D BE[0000] mov si, offset _Config 0 000029A0 837C1100 cmp word ptr [si+17], 0 0 000029A4 741C je _.L590 380:config.c **** if (ebda_size > Config.ebda2move) 5258 .loc 1 380 0 0 000029A6 E8[FEFF] call _ebdasize 5260 _.LVL640: 0 000029A9 A3[0000] mov word ptr [_ebda_size], ax 381:config.c **** ebda_size = Config.ebda2move; 5262 .loc 1 381 0 0 000029AC 8B5411 mov dx, word ptr [si+17] 0 000029AF 39D0 cmp ax, dx 0 000029B1 7604 jbe _.L591 382:config.c **** ram_top += ebda_size / 1024; 5266 .loc 1 382 0 0 000029B3 8916[0000] mov word ptr [_ebda_size], dx 5268 _.L591: 383:config.c **** } 5269 .loc 1 383 0 0 000029B7 A1[0000] mov ax, word ptr [_ebda_size] 0 000029BA B10A mov cl, 10 0 000029BC D3E8 shr ax, cl 0 000029BE 0106[0000] add word ptr [_ram_top], ax 5274 _.L590: 387:config.c **** 5275 .loc 1 387 0 0 000029C2 B05A mov al, 90 0 000029C4 50 push ax 0 000029C5 A1[0000] mov ax, word ptr [_ram_top] 0 000029C8 B106 mov cl, 6 0 000029CA D3E0 shl ax, cl 0 000029CC 48 dec ax 0 000029CD C41E[0000] les bx, dword ptr [_LoL] 0 000029D1 262B4724 sub ax, word ptr es:[bx+36] 0 000029D5 50 push ax 0 000029D6 FF36[3C0A] push word ptr [_base_seg] 0 000029DA E88BE5 call _mcb_init 5287 _.LVL641: 389:config.c **** sp = sp->sftt_next = KernelAlloc(sizeof(sftheader) + 3 * sizeof(sft), 'F', 0); 5288 .loc 1 389 0 0 000029DD C41E[0000] les bx, dword ptr [_LoL] 0 000029E1 268B7F2A mov di, word ptr es:[bx+42] 0 000029E5 268B472C mov ax, word ptr es:[bx+44] 0 000029E9 8946FE mov word ptr [bp-2], ax 5293 _.LVL642: 390:config.c **** sp->sftt_next = (sfttbl FAR *) - 1; 5294 .loc 1 390 0 0 000029EC 31F6 xor si, si 0 000029EE 56 push si 0 000029EF B046 mov al, 70 5298 _.LVL643: 0 000029F1 50 push ax 0 000029F2 B8B700 mov ax, 183 0 000029F5 50 push ax 0 000029F6 E8[FEFF] call _KernelAlloc 5303 _.LVL644: 0 000029F9 8E46FE mov es, word ptr [bp-2] 0 000029FC 268905 mov word ptr es:[di], ax 5306 _.LVL645: 0 000029FF 8E46FE mov es, word ptr [bp-2] 0 00002A02 26895502 mov word ptr es:[di+2], dx 5309 _.LVL646: 391:config.c **** sp->sftt_count = 3; 5310 .loc 1 391 0 0 00002A06 8EC2 mov es, dx 0 00002A08 93 xchg bx, ax 0 00002A09 26C707FFFF mov word ptr es:[bx], -1 0 00002A0E 26C74702FFFF mov word ptr es:[bx+2], -1 392:config.c **** 5315 .loc 1 392 0 0 00002A14 26C747040300 mov word ptr es:[bx+4], 3 394:config.c **** movebda(ebda_size, FP_SEG(KernelAlloc(ebda_size, 'I', 0))); 5317 .loc 1 394 0 0 00002A1A A1[0000] mov ax, word ptr [_ebda_size] 5319 _.LVL647: 0 00002A1D 39F0 cmp ax, si 0 00002A1F 7410 je _.L588 395:config.c **** 5322 .loc 1 395 0 0 00002A21 56 push si 0 00002A22 B249 mov dl, 73 5325 _.LVL648: 0 00002A24 52 push dx 0 00002A25 50 push ax 0 00002A26 E8[FEFF] call _KernelAlloc 5329 _.LVL649: 0 00002A29 52 push dx 0 00002A2A FF36[0000] push word ptr [_ebda_size] 0 00002A2E E8[FEFF] call _movebda 5333 _.LVL650: 5334 _.L588: 400:config.c **** 5335 .loc 1 400 0 0 00002A31 89EC mov sp, bp 0 00002A33 5D pop bp 0 00002A34 5F pop di 0 00002A35 5E pop si 0 00002A36 C3 ret 5341 _.LFE9: 5342 .size _PreConfig2, .-_PreConfig2 5343 .global _PostConfig 5344 .type _PostConfig, @function 5345 _PostConfig: 5346 _.LFB10: 405:config.c **** sfttbl FAR *sp; 5347 .loc 1 405 0 0 00002A37 56 push si 0 00002A38 57 push di 0 00002A39 55 push bp 5351 _.LCFI101: 0 00002A3A 89E5 mov bp, sp 5353 _.LCFI102: 0 00002A3C 1E push ds 0 00002A3D 1E push ds 409:config.c **** HMAState = HMA_DONE; 5356 .loc 1 409 0 0 00002A3E 803E[0000]01 cmp byte ptr [_HMAState], 1 0 00002A43 750C jne _.L599 409:config.c **** HMAState = HMA_DONE; 5359 .loc 1 409 0 is_stmt 0 discriminator 1 0 00002A45 E8[FEFF] call _MoveKernelToHMA 5361 _.LVL651: 0 00002A48 85C0 test ax, ax 0 00002A4A 7405 je _.L599 410:config.c **** 5364 .loc 1 410 0 is_stmt 1 0 00002A4C C606[0000]02 mov byte ptr [_HMAState], 2 5366 _.L599: 412:config.c **** { 5367 .loc 1 412 0 0 00002A51 BE[0000] mov si, offset _Config 0 00002A54 803C00 cmp byte ptr [si], 0 0 00002A57 740F je _.L601 414:config.c **** Config.cfgLastdriveHigh = TRUE; 5371 .loc 1 414 0 0 00002A59 C606[0300]01 mov byte ptr [_Config+3], 1 415:config.c **** Config.cfgStacksHigh = TRUE; 5373 .loc 1 415 0 0 00002A5E C606[0B00]01 mov byte ptr [_Config+11], 1 416:config.c **** } 5375 .loc 1 416 0 0 00002A63 C606[0D00]01 mov byte ptr [_Config+13], 1 5377 _.L601: 420:config.c **** if (LoL->lastdrive < LoL->nblkdev) 5378 .loc 1 420 0 0 00002A68 8B1E[0000] mov bx, word ptr [_LoL] 0 00002A6C A1[0200] mov ax, word ptr [_LoL+2] 0 00002A6F 8A740A mov dh, byte ptr [si+10] 0 00002A72 8EC0 mov es, ax 0 00002A74 26887747 mov byte ptr es:[bx+71], dh 421:config.c **** LoL->lastdrive = LoL->nblkdev; 5384 .loc 1 421 0 0 00002A78 268A5746 mov dl, byte ptr es:[bx+70] 0 00002A7C 38D6 cmp dh, dl 0 00002A7E 7304 jnc _.L602 422:config.c **** 5388 .loc 1 422 0 0 00002A80 26885747 mov byte ptr es:[bx+71], dl 5390 _.L602: 430:config.c **** 5391 .loc 1 430 0 0 00002A84 8A4401 mov al, byte ptr [si+1] 0 00002A87 98 cbw 0 00002A88 50 push ax 0 00002A89 E839FD call _config_init_buffers 5396 _.LVL652: 436:config.c **** sp = sp->sftt_next = (sfttbl FAR *) 5397 .loc 1 436 0 0 00002A8C C43E[0000] les di, dword ptr [_LoL] 0 00002A90 26C45D2A les bx, dword ptr es:[di+42] 0 00002A94 268B3F mov di, word ptr es:[bx] 0 00002A97 268B4702 mov ax, word ptr es:[bx+2] 0 00002A9B 8946FC mov word ptr [bp-4], ax 5403 _.LVL653: 438:config.c **** Config.cfgFilesHigh); 5404 .loc 1 438 0 0 00002A9E 8A4403 mov al, byte ptr [si+3] 5406 _.LVL654: 0 00002AA1 30E4 xor ah, ah 0 00002AA3 50 push ax 0 00002AA4 B046 mov al, 70 0 00002AA6 50 push ax 0 00002AA7 8A4402 mov al, byte ptr [si+2] 0 00002AAA 30E4 xor ah, ah 0 00002AAC BA3B00 mov dx, 59 0 00002AAF F7E2 mul dx 0 00002AB1 052EFE add ax, -466 0 00002AB4 50 push ax 0 00002AB5 E8[FEFF] call _KernelAlloc 5418 _.LVL655: 437:config.c **** KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 8) * sizeof(sft), 'F', 5419 .loc 1 437 0 0 00002AB8 8E46FC mov es, word ptr [bp-4] 0 00002ABB 268905 mov word ptr es:[di], ax 5422 _.LVL656: 0 00002ABE 8E46FC mov es, word ptr [bp-4] 0 00002AC1 26895502 mov word ptr es:[di+2], dx 5425 _.LVL657: 440:config.c **** sp->sftt_count = Config.cfgFiles - 8; 5426 .loc 1 440 0 0 00002AC5 8EC2 mov es, dx 0 00002AC7 89C3 mov bx, ax 0 00002AC9 26C707FFFF mov word ptr es:[bx], -1 0 00002ACE 26C74702FFFF mov word ptr es:[bx+2], -1 441:config.c **** 5431 .loc 1 441 0 0 00002AD4 8A4C02 mov cl, byte ptr [si+2] 0 00002AD7 884EFC mov byte ptr [bp-4], cl 0 00002ADA C646FD00 mov byte ptr [bp-3], 0 0 00002ADE 8B4EFC mov cx, word ptr [bp-4] 0 00002AE1 83C1F8 add cx, -8 0 00002AE4 26894F04 mov word ptr es:[bx+4], cx 443:config.c **** 5438 .loc 1 443 0 0 00002AE8 8B1E[0000] mov bx, word ptr [_LoL] 0 00002AEC 8B3E[0200] mov di, word ptr [_LoL+2] 0 00002AF0 8A440B mov al, byte ptr [si+11] 5442 _.LVL658: 0 00002AF3 30E4 xor ah, ah 0 00002AF5 50 push ax 0 00002AF6 B04C mov al, 76 0 00002AF8 50 push ax 0 00002AF9 8EC7 mov es, di 0 00002AFB 268A4747 mov al, byte ptr es:[bx+71] 0 00002AFF 895EFE mov word ptr [bp-2], bx 0 00002B02 B258 mov dl, 88 0 00002B04 F6E2 mul dl 0 00002B06 50 push ax 0 00002B07 E8[FEFF] call _KernelAlloc 5454 _.LVL659: 0 00002B0A 8EC7 mov es, di 0 00002B0C 8B5EFE mov bx, word ptr [bp-2] 0 00002B0F 2689473C mov word ptr es:[bx+60], ax 0 00002B13 2689573E mov word ptr es:[bx+62], dx 450:config.c **** { 5459 .loc 1 450 0 0 00002B17 8A540C mov dl, byte ptr [si+12] 0 00002B1A 84D2 test dl, dl 0 00002B1C 7424 je _.L597 5463 _.LBB219: 453:config.c **** Config.cfgStacksHigh); 5464 .loc 1 453 0 0 00002B1E 8A440D mov al, byte ptr [si+13] 0 00002B21 98 cbw 452:config.c **** KernelAlloc(Config.cfgStacks * Config.cfgStackSize, 'S', 5467 .loc 1 452 0 0 00002B22 50 push ax 0 00002B23 B053 mov al, 83 0 00002B25 50 push ax 453:config.c **** Config.cfgStacksHigh); 5471 .loc 1 453 0 0 00002B26 88D0 mov al, dl 0 00002B28 98 cbw 0 00002B29 F7640E mul word ptr [si+14] 452:config.c **** KernelAlloc(Config.cfgStacks * Config.cfgStackSize, 'S', 5475 .loc 1 452 0 0 00002B2C 50 push ax 0 00002B2D E8[FEFF] call _KernelAlloc 5478 _.LVL660: 0 00002B30 91 xchg cx, ax 5480 _.LVL661: 455:config.c **** 5481 .loc 1 455 0 0 00002B31 FF36[0E00] push word ptr [_Config+14] 0 00002B35 8A440C mov al, byte ptr [si+12] 0 00002B38 98 cbw 0 00002B39 50 push ax 0 00002B3A 52 push dx 0 00002B3B 51 push cx 0 00002B3C E8[FEFF] call _init_stacks 5489 _.LVL662: 0 00002B3F 83C408 add sp, 8 5491 _.L597: 5492 _.LBE219: 461:config.c **** 5493 .loc 1 461 0 0 00002B42 89EC mov sp, bp 0 00002B44 5D pop bp 0 00002B45 5F pop di 0 00002B46 5E pop si 0 00002B47 C3 ret 5499 _.LFE10: 5500 .size _PostConfig, .-_PostConfig 5501 .global _strcat 5502 .type _strcat, @function 5503 _strcat: 5504 _.LFB59: 2133:config.c **** strcpy(d + strlen(d), s); 5505 .loc 1 2133 0 5506 _.LVL663: 0 00002B48 56 push si 0 00002B49 55 push bp 5509 _.LCFI103: 0 00002B4A 89E5 mov bp, sp 5511 _.LCFI104: 0 00002B4C 8B7606 mov si, word ptr [bp+6] 2134:config.c **** return d; 5513 .loc 1 2134 0 0 00002B4F 56 push si 0 00002B50 E8[FEFF] call _init_strlen 5516 _.LVL664: 0 00002B53 FF7608 push word ptr [bp+8] 0 00002B56 01F0 add ax, si 0 00002B58 50 push ax 0 00002B59 E8[FEFF] call _init_strcpy 5521 _.LVL665: 2136:config.c **** 5522 .loc 1 2136 0 0 00002B5C 96 xchg si, ax 0 00002B5D 89EC mov sp, bp 0 00002B5F 5D pop bp 0 00002B60 5E pop si 0 00002B61 C20400 ret 4 5528 _.LFE59: 5529 .size _strcat, .-_strcat === Switch to base=012BB0h -> ".RODATA.STR1.1" 5530 .section .rodata.str1.1 5531 _.LC45: 0 00000A5D 3D00 .string "=" 5533 _.LC46: 0 00000A5F 4D61737465722065 .string "Master environment is full - can't add \"%s\"\n" 0 00000A67 6E7669726F6E6D65 0 00000A6F 6E74206973206675 0 00000A77 6C6C202D2063616E 0 00000A7F 2774206164642022 0 00000A87 2573220A00 5535 _.LC47: 0 00000A8C 496E76616C696420 .string "Invalid SET command: \"%s\"\n" 0 00000A94 53455420636F6D6D 0 00000A9C 616E643A20222573 0 00000AA4 220A00 === Switch to base=002270h -> ".TEXT" 5537 .text 5538 .type _CmdSet, @function 5539 _CmdSet: 5540 _.LFB82: 2765:config.c **** 2766:config.c **** STATIC VOID CmdSet(BYTE *pLine) 2767:config.c **** { 5541 .loc 1 2767 0 5542 _.LVL666: 0 00002B64 56 push si 0 00002B65 57 push di 0 00002B66 55 push bp 5546 _.LCFI105: 0 00002B67 89E5 mov bp, sp 5548 _.LCFI106: 0 00002B69 83EC0E sub sp, 14 2768:config.c **** pLine = GetStringArg(pLine, szBuf); 5550 .loc 1 2768 0 0 00002B6C BA[3808] mov dx, offset _szBuf 0 00002B6F 52 push dx 0 00002B70 8956FE mov word ptr [bp-2], dx 0 00002B73 FF7608 push word ptr [bp+8] 0 00002B76 E8[FEFF] call _GetStringArg 5556 _.LVL667: 2769:config.c **** pLine = skipwh(pLine); /* scan() stops at the equal sign or space */ 5557 .loc 1 2769 0 0 00002B79 50 push ax 0 00002B7A E88BE6 call _skipwh 5560 _.LVL668: 0 00002B7D 8946F8 mov word ptr [bp-8], ax 5562 _.LVL669: 2770:config.c **** if (*pLine == '=') /* equal sign is required */ 5563 .loc 1 2770 0 0 00002B80 93 xchg bx, ax 0 00002B81 803F3D cmp byte ptr [bx], 61 0 00002B84 8B56FE mov dx, word ptr [bp-2] 0 00002B87 7403E9F100 jne _.L614 0 00002B8C 89D7 mov di, dx 5569 _.LBB223: 2771:config.c **** { 2772:config.c **** int size, oldsize, namesize; 2773:config.c **** BYTE far * pp; 2774:config.c **** strupr(szBuf); /* all environment variables must be uppercase */ 5570 .loc 1 2774 0 0 00002B8E 52 push dx 0 00002B8F E813E6 call _strupr 5573 _.LVL670: 2775:config.c **** namesize = strlen(szBuf); 5574 .loc 1 2775 0 0 00002B92 57 push di 0 00002B93 E8[FEFF] call _init_strlen 5577 _.LVL671: 0 00002B96 8946F4 mov word ptr [bp-12], ax 5579 _.LVL672: 2776:config.c **** strcat(szBuf, "="); 5580 .loc 1 2776 0 0 00002B99 B8[0D03] mov ax, offset _.LC45 5582 _.LVL673: 0 00002B9C 50 push ax 0 00002B9D 57 push di 0 00002B9E E8[FEFF] call _strcat 5586 _.LVL674: 5587 _.LBB224: 5588 _.LBB225: 2745:config.c **** do { 5589 .loc 1 2745 0 0 00002BA1 B8[0000] mov ax, offset _master_env@OZSEG16 0 00002BA4 8946FC mov word ptr [bp-4], ax 0 00002BA7 BB[0000] mov bx, offset _master_env 0 00002BAA 8946FE mov word ptr [bp-2], ax 5594 _.L616: 5595 _.LVL675: 2747:config.c **** return pp; 5596 .loc 1 2747 0 0 00002BAD 8B46F4 mov ax, word ptr [bp-12] 0 00002BB0 40 inc ax 0 00002BB1 8946F6 mov word ptr [bp-10], ax 0 00002BB4 8C56FA mov word ptr [bp-6], ss 0 00002BB7 50 push ax 0 00002BB8 FF76FC push word ptr [bp-4] 0 00002BBB 53 push bx 0 00002BBC 895EF2 mov word ptr [bp-14], bx 0 00002BBF 16 push ss 0 00002BC0 57 push di 0 00002BC1 E8[FEFF] call _init_fmemcmp 5608 _.LVL676: 0 00002BC4 85C0 test ax, ax 0 00002BC6 8B5EF2 mov bx, word ptr [bp-14] 0 00002BC9 741C je _.L615 2750:config.c **** } while (*pp); 5612 .loc 1 2750 0 0 00002BCB FF76FC push word ptr [bp-4] 0 00002BCE 53 push bx 0 00002BCF E8[FEFF] call _init_fstrlen 5616 _.LVL677: 0 00002BD2 96 xchg si, ax 0 00002BD3 8B5EF2 mov bx, word ptr [bp-14] 0 00002BD6 8D5801 lea bx, [1+bx+si] 5620 _.LVL678: 2751:config.c **** return NULL; 5621 .loc 1 2751 0 0 00002BD9 8E46FC mov es, word ptr [bp-4] 0 00002BDC 26803F00 cmp byte ptr es:[bx], 0 0 00002BE0 75CB jne _.L616 2752:config.c **** } 5625 .loc 1 2752 0 0 00002BE2 31DB xor bx, bx 5627 _.LVL679: 0 00002BE4 895EFE mov word ptr [bp-2], bx 5629 _.LVL680: 5630 _.L615: 0 00002BE7 895EFC mov word ptr [bp-4], bx 5632 _.LVL681: 5633 _.LBE225: 5634 _.LBE224: 2777:config.c **** pp = searchvar(szBuf, namesize); 2778:config.c **** pLine = skipwh(++pLine); 5635 .loc 1 2778 0 0 00002BEA 8B76F8 mov si, word ptr [bp-8] 0 00002BED 46 inc si 5638 _.LVL682: 0 00002BEE 56 push si 0 00002BEF E816E6 call _skipwh 5641 _.LVL683: 2779:config.c **** strcat(szBuf, pLine); /* append the variable value (may include spaces) */ 5642 .loc 1 2779 0 0 00002BF2 50 push ax 0 00002BF3 57 push di 0 00002BF4 E8[FEFF] call _strcat 5646 _.LVL684: 2780:config.c **** size = strlen(szBuf); 5647 .loc 1 2780 0 0 00002BF7 57 push di 0 00002BF8 E8[FEFF] call _init_strlen 5650 _.LVL685: 0 00002BFB 89C6 mov si, ax 5652 _.LVL686: 2781:config.c **** if (size == namesize + 1) { 5653 .loc 1 2781 0 0 00002BFD 3B46F6 cmp ax, word ptr [bp-10] 0 00002C00 8B5EFC mov bx, word ptr [bp-4] 0 00002C03 750F jne _.L617 2782:config.c **** /* empty variable ? then just delete. (cannot fail) */ 2783:config.c **** deletevar(pp); 5657 .loc 1 2783 0 0 00002C05 FF76FE push word ptr [bp-2] 0 00002C08 53 push bx 0 00002C09 E882E3 call _deletevar 5661 _.LVL687: 5662 _.L613: 5663 _.LBE223: 2784:config.c **** return; 2785:config.c **** } 2786:config.c **** if (pp) { 2787:config.c **** oldsize = fstrlen(pp) + 1; 2788:config.c **** } else { 2789:config.c **** oldsize = 0; 2790:config.c **** } 2791:config.c **** if (size < master_env + sizeof(master_env) - (envp - oldsize) - 1 - 2) 2792:config.c **** { /* must end with two consequtive zeros */ 2793:config.c **** deletevar(pp); /* now that there's enough space, actually delete */ 2794:config.c **** fstrcpy(envp, szBuf); 2795:config.c **** envp += size + 1; /* add next variables starting at the second zero */ 2796:config.c **** *envp = 0; 2797:config.c **** envp[1] = 0; 2798:config.c **** envp[2] = 0; 2799:config.c **** /* The word marker after last variable should not equal 1, 2800:config.c **** to indicate that there is no executable pathname following. */ 2801:config.c **** } 2802:config.c **** else 2803:config.c **** printf("Master environment is full - can't add \"%s\"\n", szBuf); 2804:config.c **** } 2805:config.c **** else 2806:config.c **** printf("Invalid SET command: \"%s\"\n", szBuf); 2807:config.c **** } 5664 .loc 1 2807 0 0 00002C0C 89EC mov sp, bp 0 00002C0E 5D pop bp 0 00002C0F 5F pop di 0 00002C10 5E pop si 0 00002C11 C20200 ret 2 5670 _.LVL688: 5671 _.L617: 5672 _.LBB226: 2786:config.c **** oldsize = fstrlen(pp) + 1; 5673 .loc 1 2786 0 0 00002C14 8B46FE mov ax, word ptr [bp-2] 5675 _.LVL689: 0 00002C17 09D8 or ax, bx 0 00002C19 740E je _.L619 2787:config.c **** } else { 5678 .loc 1 2787 0 0 00002C1B FF76FE push word ptr [bp-2] 0 00002C1E 53 push bx 0 00002C1F 895EFC mov word ptr [bp-4], bx 0 00002C22 E8[FEFF] call _init_fstrlen 5683 _.LVL690: 0 00002C25 40 inc ax 5685 _.LVL691: 0 00002C26 8B5EFC mov bx, word ptr [bp-4] 5687 _.LVL692: 5688 _.L619: 2791:config.c **** { /* must end with two consequtive zeros */ 5689 .loc 1 2791 0 0 00002C29 B9[8000] mov cx, offset _master_env+128 0 00002C2C 8B16[B602] mov dx, word ptr [_envp] 0 00002C30 29C2 sub dx, ax 0 00002C32 29D1 sub cx, dx 0 00002C34 83C1FD add cx, -3 0 00002C37 39CE cmp si, cx 0 00002C39 7D35 jge _.L621 2793:config.c **** fstrcpy(envp, szBuf); 5697 .loc 1 2793 0 0 00002C3B FF76FE push word ptr [bp-2] 0 00002C3E 53 push bx 0 00002C3F E84CE3 call _deletevar 5701 _.LVL693: 2794:config.c **** envp += size + 1; /* add next variables starting at the second zero */ 5702 .loc 1 2794 0 0 00002C42 FF76FA push word ptr [bp-6] 0 00002C45 B8[3808] mov ax, offset _szBuf 0 00002C48 50 push ax 0 00002C49 FF36[B802] push word ptr [_envp+2] 0 00002C4D FF36[B602] push word ptr [_envp] 0 00002C51 E8[FEFF] call _init_fstrcpy 5709 _.LVL694: 2795:config.c **** *envp = 0; 5710 .loc 1 2795 0 0 00002C54 A1[B802] mov ax, word ptr [_envp+2] 0 00002C57 8B1E[B602] mov bx, word ptr [_envp] 0 00002C5B 8D5801 lea bx, [1+bx+si] 0 00002C5E 891E[B602] mov word ptr [_envp], bx 2796:config.c **** envp[1] = 0; 5715 .loc 1 2796 0 0 00002C62 8EC0 mov es, ax 2797:config.c **** envp[2] = 0; 5717 .loc 1 2797 0 0 00002C64 26C7070000 mov word ptr es:[bx], 0 5719 _.LVL695: 2798:config.c **** /* The word marker after last variable should not equal 1, 5720 .loc 1 2798 0 0 00002C69 26C6470200 mov byte ptr es:[bx+2], 0 0 00002C6E EB9C jmp _.L613 5723 _.LVL696: 5724 _.L621: 2803:config.c **** } 5725 .loc 1 2803 0 0 00002C70 57 push di 0 00002C71 B8[0F03] mov ax, offset _.LC46 5728 _.LVL697: 5729 _.L628: 5730 _.LBE226: 2806:config.c **** } 5731 .loc 1 2806 0 0 00002C74 50 push ax 0 00002C75 E8[FEFF] call _init_printf 5734 _.LVL698: 0 00002C78 83C404 add sp, 4 0 00002C7B EB8F jmp _.L613 5737 _.LVL699: 5738 _.L614: 0 00002C7D 52 push dx 0 00002C7E B8[3C03] mov ax, offset _.LC47 5741 _.LVL700: 0 00002C81 EBF1 jmp _.L628 5743 _.LFE82: 5744 .size _CmdSet, .-_CmdSet === Switch to base=012BB0h -> ".RODATA.STR1.1" 5745 .section .rodata.str1.1 5746 _.LC48: 0 00000AA7 200D0A00 .string " \r\n" === Switch to base=002270h -> ".TEXT" 5748 .text 5749 .type _LoadDevice, @function 5750 _LoadDevice: 5751 _.LFB45: 1817:config.c **** exec_blk eb; 5752 .loc 1 1817 0 5753 _.LVL701: 0 00002C83 56 push si 0 00002C84 57 push di 0 00002C85 55 push bp 5757 _.LCFI107: 0 00002C86 89E5 mov bp, sp 5759 _.LCFI108: 0 00002C88 83EC24 sub sp, 36 0 00002C8B 8B7E08 mov di, word ptr [bp+8] 1824:config.c **** { 5762 .loc 1 1824 0 0 00002C8E 837E0E00 cmp word ptr [bp+14], 0 0 00002C92 7446 je _.L630 1826:config.c **** start = umb_start; 5765 .loc 1 1826 0 0 00002C94 8B0E[3A0A] mov cx, word ptr [_umb_base_seg] 5767 _.LVL702: 1827:config.c **** } 5768 .loc 1 1827 0 0 00002C98 A1[0000] mov ax, word ptr [_umb_start] 5770 _.LVL703: 5771 _.L631: 1836:config.c **** base++; 5772 .loc 1 1836 0 0 00002C9B 39C1 cmp cx, ax 0 00002C9D 9F lahf 0 00002C9E D0E4 shl ah, 1 0 00002CA0 99 cwd 0 00002CA1 29D1 sub cx, dx 5778 _.LVL704: 1837:config.c **** 5779 .loc 1 1837 0 0 00002CA3 41 inc cx 5781 _.LVL705: 0 00002CA4 894EE4 mov word ptr [bp-28], cx 5783 _.LVL706: 1840:config.c **** 5784 .loc 1 1840 0 0 00002CA7 BE[3808] mov si, offset _szBuf 0 00002CAA 56 push si 0 00002CAB 57 push di 0 00002CAC E8[FEFF] call _GetStringArg 5789 _.LVL707: 1844:config.c **** 5790 .loc 1 1844 0 0 00002CAF 8B46E4 mov ax, word ptr [bp-28] 0 00002CB2 8946EA mov word ptr [bp-22], ax 0 00002CB5 8946EC mov word ptr [bp-20], ax 1848:config.c **** { 5794 .loc 1 1848 0 0 00002CB8 56 push si 0 00002CB9 8D46EA lea ax, [-22+bp] 0 00002CBC 50 push ax 0 00002CBD B80300 mov ax, 3 0 00002CC0 50 push ax 0 00002CC1 E8[FEFF] call _init_DosExec 5801 _.LVL708: 0 00002CC4 8946E0 mov word ptr [bp-32], ax 5803 _.LVL709: 0 00002CC7 85C0 test ax, ax 0 00002CC9 741D je _.L633 1850:config.c **** return result; 5806 .loc 1 1850 0 0 00002CCB 57 push di 0 00002CCC E82CE2 call _CfgFailure 5809 _.LVL710: 5810 _.L629: 1889:config.c **** 5811 .loc 1 1889 0 0 00002CCF 8B46E0 mov ax, word ptr [bp-32] 0 00002CD2 89EC mov sp, bp 0 00002CD4 5D pop bp 0 00002CD5 5F pop di 0 00002CD6 5E pop si 0 00002CD7 C20800 ret 8 5818 _.LVL711: 5819 _.L630: 1831:config.c **** start = LoL->first_mcb; 5820 .loc 1 1831 0 0 00002CDA 8B0E[3C0A] mov cx, word ptr [_base_seg] 5822 _.LVL712: 1832:config.c **** } 5823 .loc 1 1832 0 0 00002CDE C41E[0000] les bx, dword ptr [_LoL] 0 00002CE2 268B4724 mov ax, word ptr es:[bx+36] 5826 _.LVL713: 0 00002CE6 EBB3 jmp _.L631 5828 _.LVL714: 5829 _.L633: 1854:config.c **** /* uppercase the device driver command */ 5830 .loc 1 1854 0 0 00002CE8 57 push di 0 00002CE9 56 push si 0 00002CEA E8[FEFF] call _init_strcpy 5834 _.LVL715: 1856:config.c **** 5835 .loc 1 1856 0 0 00002CED 56 push si 0 00002CEE E8B4E4 call _strupr 5838 _.LVL716: 1863:config.c **** 5839 .loc 1 1863 0 0 00002CF1 B8[5703] mov ax, offset _.LC48 0 00002CF4 50 push ax 0 00002CF5 56 push si 0 00002CF6 E8[FEFF] call _strcat 5844 _.LVL717: 1865:config.c **** 5845 .loc 1 1865 0 0 00002CF9 8B7EE0 mov di, word ptr [bp-32] 5847 _.LVL718: 1874:config.c **** (result = init_device(dhp, szBuf, mode, &top)) == SUCCESS; 5848 .loc 1 1874 0 0 00002CFC 89FA mov dx, di 5850 _.LVL719: 5851 _.L635: 1874:config.c **** (result = init_device(dhp, szBuf, mode, &top)) == SUCCESS; 5852 .loc 1 1874 0 is_stmt 0 discriminator 1 0 00002CFE 83FAFF cmp dx, -1 0 00002D01 7419 je _.L636 1874:config.c **** (result = init_device(dhp, szBuf, mode, &top)) == SUCCESS; 5855 .loc 1 1874 0 discriminator 2 0 00002D03 8D460A lea ax, [10+bp] 0 00002D06 50 push ax 0 00002D07 FF760E push word ptr [bp+14] 0 00002D0A 56 push si 0 00002D0B FF76E4 push word ptr [bp-28] 0 00002D0E 57 push di 0 00002D0F E8[FEFF] call _init_device 5863 _.LVL720: 0 00002D12 85C0 test ax, ax 0 00002D14 7503E9BC00 je _.L637 1874:config.c **** (result = init_device(dhp, szBuf, mode, &top)) == SUCCESS; 5866 .loc 1 1874 0 0 00002D19 8946E0 mov word ptr [bp-32], ax 5868 _.LVL721: 5869 _.L636: 1885:config.c **** umb_init(); 5870 .loc 1 1885 0 is_stmt 1 0 00002D1C 833E[0000]02 cmp word ptr [_UmbState], 2 0 00002D21 75AC jne _.L629 5873 _.LBB234: 5874 _.LBB235: 513:config.c **** return; 5875 .loc 1 513 0 0 00002D23 E8[FEFF] call _DetectXMSDriver 5877 _.LVL722: 0 00002D26 8946DE mov word ptr [bp-34], ax 5879 _.LVL723: 0 00002D29 09D0 or ax, dx 5881 _.LVL724: 0 00002D2B 74A2 je _.L629 516:config.c **** { 5883 .loc 1 516 0 0 00002D2D 8D46E8 lea ax, [-24+bp] 0 00002D30 50 push ax 0 00002D31 8D46E6 lea ax, [-26+bp] 0 00002D34 50 push ax 0 00002D35 52 push dx 0 00002D36 8956E4 mov word ptr [bp-28], dx 5890 _.LVL725: 0 00002D39 FF76DE push word ptr [bp-34] 0 00002D3C E8[FEFF] call _UMB_get_largest 5893 _.LVL726: 0 00002D3F 85C0 test ax, ax 0 00002D41 748C je _.L629 518:config.c **** 5896 .loc 1 518 0 0 00002D43 C706[0000]0100 mov word ptr [_UmbState], 1 522:config.c **** LoL->uppermem_root = ram_top * 64 - 1; 5898 .loc 1 522 0 0 00002D49 E8[FEFF] call _init_oem 5900 _.LVL727: 0 00002D4C A3[0000] mov word ptr [_ram_top], ax 523:config.c **** 5902 .loc 1 523 0 0 00002D4F B106 mov cl, 6 0 00002D51 D3E0 shl ax, cl 0 00002D53 48 dec ax 0 00002D54 C41E[0000] les bx, dword ptr [_LoL] 0 00002D58 2689878C00 mov word ptr es:[bx+140], ax 5908 _.LVL728: 526:config.c **** para2far(base_seg)->m_size--; 5909 .loc 1 526 0 0 00002D5D A1[3C0A] mov ax, word ptr [_base_seg] 0 00002D60 8EC0 mov es, ax 0 00002D62 26C60600004D mov byte ptr es:[0], 77 527:config.c **** mumcb_init(LoL->uppermem_root, umb_seg - LoL->uppermem_root - 1); 5913 .loc 1 527 0 0 00002D68 26FF0E0300 dec word ptr es:[3] 528:config.c **** 5915 .loc 1 528 0 0 00002D6D C41E[0000] les bx, dword ptr [_LoL] 0 00002D71 268B8F8C00 mov cx, word ptr es:[bx+140] 0 00002D76 89C8 mov ax, cx 0 00002D78 F7D0 not ax 0 00002D7A 0346E6 add ax, word ptr [bp-26] 0 00002D7D 50 push ax 0 00002D7E 51 push cx 0 00002D7F E8BDEA call _mumcb_init 5924 _.LVL729: 531:config.c **** 5925 .loc 1 531 0 0 00002D82 B04D mov al, 77 0 00002D84 50 push ax 0 00002D85 8B46E8 mov ax, word ptr [bp-24] 0 00002D88 83C0FE add ax, -2 0 00002D8B 50 push ax 0 00002D8C FF76E6 push word ptr [bp-26] 0 00002D8F E8D6E1 call _mcb_init 5933 _.LVL730: 533:config.c **** UMB_top = umb_size; 5934 .loc 1 533 0 0 00002D92 8B46E6 mov ax, word ptr [bp-26] 0 00002D95 A3[0000] mov word ptr [_umb_start], ax 5937 _.LVL731: 0 00002D98 A3[3A0A] mov word ptr [_umb_base_seg], ax 534:config.c **** 5939 .loc 1 534 0 0 00002D9B 8B4EE8 mov cx, word ptr [bp-24] 0 00002D9E 890E[0000] mov word ptr [_UMB_top], cx 533:config.c **** UMB_top = umb_size; 5942 .loc 1 533 0 0 00002DA2 8946E2 mov word ptr [bp-30], ax 0 00002DA5 8B56E4 mov dx, word ptr [bp-28] 5945 _.LVL732: 5946 _.L641: 543:config.c **** { 5947 .loc 1 543 0 0 00002DA8 8D46E8 lea ax, [-24+bp] 0 00002DAB 50 push ax 0 00002DAC 8D46E6 lea ax, [-26+bp] 0 00002DAF 50 push ax 0 00002DB0 52 push dx 0 00002DB1 8956E4 mov word ptr [bp-28], dx 0 00002DB4 FF76DE push word ptr [bp-34] 0 00002DB7 E8[FEFF] call _UMB_get_largest 5956 _.LVL733: 0 00002DBA 85C0 test ax, ax 0 00002DBC 8B56E4 mov dx, word ptr [bp-28] 0 00002DBF 7547 jne _.L656 587:config.c **** para2far(umb_max)->m_type = MCB_LAST; 5960 .loc 1 587 0 0 00002DC1 8E46E2 mov es, word ptr [bp-30] 0 00002DC4 26FF060300 inc word ptr es:[3] 5963 _.LVL734: 588:config.c **** CfgDbgPrintf(("UMB Allocation completed: start at 0x%x\n", umb_base_seg)); 5964 .loc 1 588 0 0 00002DC9 8E46E2 mov es, word ptr [bp-30] 0 00002DCC 26C60600005A mov byte ptr es:[0], 90 0 00002DD2 E9FAFE jmp _.L629 5968 _.LVL735: 5969 _.L637: 5970 _.LBE235: 5971 _.LBE234: 1878:config.c **** /* Link in device driver and save LoL->nul_dev pointer to next */ 5972 .loc 1 1878 0 0 00002DD5 8E46E4 mov es, word ptr [bp-28] 0 00002DD8 268B15 mov dx, word ptr es:[di] 5975 _.LVL736: 1880:config.c **** LoL->nul_dev.dh_next = dhp; 5976 .loc 1 1880 0 0 00002DDB C41E[0000] les bx, dword ptr [_LoL] 5978 _.LVL737: 0 00002DDF 268B4F48 mov cx, word ptr es:[bx+72] 0 00002DE3 268B474A mov ax, word ptr es:[bx+74] 5981 _.LVL738: 0 00002DE7 8E46E4 mov es, word ptr [bp-28] 0 00002DEA 26890D mov word ptr es:[di], cx 5984 _.LVL739: 0 00002DED 8E46E4 mov es, word ptr [bp-28] 0 00002DF0 26894502 mov word ptr es:[di+2], ax 1881:config.c **** } 5987 .loc 1 1881 0 0 00002DF4 C41E[0000] les bx, dword ptr [_LoL] 0 00002DF8 26897F48 mov word ptr es:[bx+72], di 0 00002DFC 8B46E4 mov ax, word ptr [bp-28] 0 00002DFF 2689474A mov word ptr es:[bx+74], ax 1876:config.c **** { 5992 .loc 1 1876 0 0 00002E03 89D7 mov di, dx 0 00002E05 E9F6FE jmp _.L635 5995 _.LVL740: 5996 _.L656: 0 00002E08 8956E4 mov word ptr [bp-28], dx 5998 _.LBB246: 5999 _.LBB245: 6000 _.LBB236: 548:config.c **** 6001 .loc 1 548 0 0 00002E0B B04D mov al, 77 0 00002E0D 50 push ax 0 00002E0E 8B46E8 mov ax, word ptr [bp-24] 0 00002E11 83C0FE add ax, -2 0 00002E14 50 push ax 0 00002E15 FF76E6 push word ptr [bp-26] 0 00002E18 E84DE1 call _mcb_init 6009 _.LVL741: 551:config.c **** umb_next = umb_prev + para2far(umb_prev)->m_size + 1; 6010 .loc 1 551 0 0 00002E1B C41E[0000] les bx, dword ptr [_LoL] 0 00002E1F 268BBF8C00 mov di, word ptr es:[bx+140] 0 00002E24 8B4EE6 mov cx, word ptr [bp-26] 6014 _.LVL742: 6015 _.LBB237: 6016 _.LBB238: 498:config.c **** while (mcb_next < cur_mcb && para2far(mcb_next)->m_type == MCB_NORMAL) 6017 .loc 1 498 0 0 00002E27 89FE mov si, di 0 00002E29 8B56E4 mov dx, word ptr [bp-28] 6020 _.LVL743: 6021 _.L642: 499:config.c **** { 6022 .loc 1 499 0 0 00002E2C 39F1 cmp cx, si 0 00002E2E 774B ja _.L643 6025 _.L647: 6026 _.LVL744: 6027 _.LBE238: 6028 _.LBE237: 552:config.c **** 6029 .loc 1 552 0 0 00002E30 8EC7 mov es, di 0 00002E32 268B1E0300 mov bx, word ptr es:[3] 0 00002E37 8D4101 lea ax, [1+bx+di] 0 00002E3A 8946E4 mov word ptr [bp-28], ax 6034 _.LVL745: 554:config.c **** { 6035 .loc 1 554 0 0 00002E3D 3B4EE2 cmp cx, word ptr [bp-30] 0 00002E40 7251 jc _.L644 6038 _.LVL746: 6039 _.L645: 574:config.c **** /* should the UMB driver return 6040 .loc 1 574 0 0 00002E42 8B46E6 mov ax, word ptr [bp-26] 0 00002E45 2B46E4 sub ax, word ptr [bp-28] 0 00002E48 83F801 cmp ax, 1 0 00002E4B 7403E99A00 jne _.L649 577:config.c **** else 6045 .loc 1 577 0 0 00002E50 C41E[0000] les bx, dword ptr [_LoL] 0 00002E54 268B8F8C00 mov cx, word ptr es:[bx+140] 6048 _.LVL747: 6049 _.LBB240: 6050 _.LBB241: 498:config.c **** while (mcb_next < cur_mcb && para2far(mcb_next)->m_type == MCB_NORMAL) 6051 .loc 1 498 0 0 00002E59 89CE mov si, cx 6053 _.LVL748: 6054 _.L650: 499:config.c **** { 6055 .loc 1 499 0 0 00002E5B 3976E4 cmp word ptr [bp-28], si 0 00002E5E 7771 ja _.L651 6058 _.L654: 6059 _.LVL749: 6060 _.LBE241: 6061 _.LBE240: 577:config.c **** else 6062 .loc 1 577 0 0 00002E60 8B46E8 mov ax, word ptr [bp-24] 0 00002E63 8EC1 mov es, cx 0 00002E65 2601060300 add word ptr es:[3], ax 6066 _.LVL750: 6067 _.L652: 0 00002E6A 8B46E6 mov ax, word ptr [bp-26] 0 00002E6D 3946E2 cmp word ptr [bp-30], ax 0 00002E70 7203E933FF jnc _.L641 0 00002E75 8946E2 mov word ptr [bp-30], ax 0 00002E78 E92DFF jmp _.L641 6073 _.LVL751: 6074 _.L643: 6075 _.LBB243: 6076 _.LBB239: 499:config.c **** { 6077 .loc 1 499 0 0 00002E7B 8EC6 mov es, si 0 00002E7D 31DB xor bx, bx 0 00002E7F 26803F4D cmp byte ptr es:[bx], 77 0 00002E83 75AB jne _.L647 6082 _.LVL752: 502:config.c **** } 6083 .loc 1 502 0 0 00002E85 8EC6 mov es, si 0 00002E87 268B1E0300 mov bx, word ptr es:[3] 6086 _.LVL753: 0 00002E8C 89F7 mov di, si 0 00002E8E 8D7001 lea si, [1+bx+si] 6089 _.LVL754: 0 00002E91 EB99 jmp _.L642 6091 _.LVL755: 6092 _.L644: 6093 _.LBE239: 6094 _.LBE243: 556:config.c **** { 6095 .loc 1 556 0 0 00002E93 8B46E4 mov ax, word ptr [bp-28] 6097 _.LVL756: 0 00002E96 29C8 sub ax, cx 0 00002E98 8B76E8 mov si, word ptr [bp-24] 0 00002E9B 39F0 cmp ax, si 0 00002E9D 751A jne _.L648 560:config.c **** para2far(umb_seg)->m_size = umb_size; 6102 .loc 1 560 0 0 00002E9F 8E46E4 mov es, word ptr [bp-28] 0 00002EA2 268B1E0300 mov bx, word ptr es:[3] 0 00002EA7 96 xchg si, ax 0 00002EA8 8D4001 lea ax, [1+bx+si] 0 00002EAB 8946E8 mov word ptr [bp-24], ax 561:config.c **** } 6108 .loc 1 561 0 0 00002EAE 8EC1 mov es, cx 0 00002EB0 26A30300 mov word ptr es:[3], ax 6111 _.LVL757: 0 00002EB4 897EE4 mov word ptr [bp-28], di 0 00002EB7 EB89 jmp _.L645 6114 _.LVL758: 6115 _.L648: 0 00002EB9 8956DC mov word ptr [bp-36], dx 566:config.c **** } 6117 .loc 1 566 0 0 00002EBC 29F0 sub ax, si 0 00002EBE 50 push ax 0 00002EBF 89CB mov bx, cx 0 00002EC1 8D48FF lea cx, [-1+bx+si] 0 00002EC4 51 push cx 0 00002EC5 E877E9 call _mumcb_init 6124 _.LVL759: 0 00002EC8 897EE4 mov word ptr [bp-28], di 6126 _.LVL760: 0 00002ECB 8B56DC mov dx, word ptr [bp-36] 0 00002ECE E971FF jmp _.L645 6129 _.LVL761: 6130 _.L651: 6131 _.LBB244: 6132 _.LBB242: 499:config.c **** { 6133 .loc 1 499 0 0 00002ED1 8EC6 mov es, si 0 00002ED3 31DB xor bx, bx 0 00002ED5 26803F4D cmp byte ptr es:[bx], 77 0 00002ED9 7585 jne _.L654 6138 _.LVL762: 502:config.c **** } 6139 .loc 1 502 0 0 00002EDB 89F1 mov cx, si 0 00002EDD 8EC6 mov es, si 0 00002EDF 268B1E0300 mov bx, word ptr es:[3] 0 00002EE4 8D7001 lea si, [1+bx+si] 6144 _.LVL763: 0 00002EE7 E971FF jmp _.L650 6146 _.LVL764: 6147 _.L649: 0 00002EEA 8956DC mov word ptr [bp-36], dx 6149 _.LBE242: 6150 _.LBE244: 581:config.c **** } 6151 .loc 1 581 0 0 00002EED 48 dec ax 0 00002EEE 50 push ax 0 00002EEF FF76E4 push word ptr [bp-28] 0 00002EF2 E84AE9 call _mumcb_init 6156 _.LVL765: 0 00002EF5 8B56DC mov dx, word ptr [bp-36] 0 00002EF8 E96FFF jmp _.L652 6159 _.LBE236: 6160 _.LBE245: 6161 _.LBE246: 6162 _.LFE45: 6163 .size _LoadDevice, .-_LoadDevice === Switch to base=012BB0h -> ".RODATA.STR1.1" 6164 .section .rodata.str1.1 6165 _.LC49: 0 00000AAB 4E6F7420656E6F75 .string "Not enough free memory in UMBs: loading low\n" 0 00000AB3 6768206672656520 0 00000ABB 6D656D6F72792069 0 00000AC3 6E20554D42733A20 0 00000ACB 6C6F6164696E6720 0 00000AD3 6C6F770A00 6167 _.LC50: 0 00000AD8 554D427320756E61 .string "UMBs unavailable!\n" 0 00000AE0 7661696C61626C65 0 00000AE8 210A00 === Switch to base=002270h -> ".TEXT" 6169 .text 6170 .type _DeviceHigh, @function 6171 _DeviceHigh: 6172 _.LFB43: 1795:config.c **** if (UmbState == 1) 6173 .loc 1 1795 0 6174 _.LVL766: 0 00002EFB 56 push si 0 00002EFC 57 push di 0 00002EFD 55 push bp 6178 _.LCFI109: 0 00002EFE 89E5 mov bp, sp 6180 _.LCFI110: 0 00002F00 8B7E08 mov di, word ptr [bp+8] 1796:config.c **** { 6182 .loc 1 1796 0 0 00002F03 833E[0000]01 cmp word ptr [_UmbState], 1 0 00002F08 BE0000 mov si, 0 0 00002F0B 7535 jne _.L668 1798:config.c **** { 6186 .loc 1 1798 0 0 00002F0D B80100 mov ax, 1 0 00002F10 50 push ax 0 00002F11 A1[0000] mov ax, word ptr [_UMB_top] 0 00002F14 0306[0000] add ax, word ptr [_umb_start] 0 00002F18 50 push ax 0 00002F19 56 push si 0 00002F1A 57 push di 0 00002F1B E865FD call _LoadDevice 6195 _.LVL767: 0 00002F1E 83F8F8 cmp ax, -8 0 00002F21 7517 jne _.L667 6198 _.LVL768: 6199 _.LBB249: 6200 _.LBB250: 1800:config.c **** LoadDevice(pLine, lpTop, FALSE); 6201 .loc 1 1800 0 0 00002F23 B8[5B03] mov ax, offset _.LC49 6203 _.LVL769: 6204 _.L671: 6205 _.LBE250: 6206 _.LBE249: 1806:config.c **** LoadDevice(pLine, lpTop, FALSE); 6207 .loc 1 1806 0 0 00002F26 50 push ax 0 00002F27 E8[FEFF] call _init_printf 6210 _.LVL770: 1807:config.c **** } 6211 .loc 1 1807 0 0 00002F2A 56 push si 0 00002F2B FF36[0200] push word ptr [_lpTop+2] 0 00002F2F FF36[0000] push word ptr [_lpTop] 0 00002F33 57 push di 0 00002F34 E84CFD call _LoadDevice 6217 _.LVL771: 0 00002F37 83C402 add sp, 2 6219 _.L667: 1809:config.c **** 6220 .loc 1 1809 0 0 00002F3A 89EC mov sp, bp 0 00002F3C 5D pop bp 0 00002F3D 5F pop di 0 00002F3E 5E pop si 0 00002F3F C20200 ret 2 6226 _.L668: 1806:config.c **** LoadDevice(pLine, lpTop, FALSE); 6227 .loc 1 1806 0 0 00002F42 B8[8803] mov ax, offset _.LC50 0 00002F45 EBDF jmp _.L671 6230 _.LFE43: 6231 .size _DeviceHigh, .-_DeviceHigh 6232 .type _Device, @function 6233 _Device: 6234 _.LFB44: 1812:config.c **** LoadDevice(pLine, lpTop, FALSE); 6235 .loc 1 1812 0 6236 _.LVL772: 0 00002F47 55 push bp 6238 _.LCFI111: 0 00002F48 89E5 mov bp, sp 6240 _.LCFI112: 1813:config.c **** } 6241 .loc 1 1813 0 0 00002F4A 31C0 xor ax, ax 0 00002F4C 50 push ax 0 00002F4D FF36[0200] push word ptr [_lpTop+2] 0 00002F51 FF36[0000] push word ptr [_lpTop] 0 00002F55 FF7604 push word ptr [bp+4] 0 00002F58 E828FD call _LoadDevice 6248 _.LVL773: 1814:config.c **** 6249 .loc 1 1814 0 0 00002F5B 89EC mov sp, bp 0 00002F5D 5D pop bp 0 00002F5E C20200 ret 2 6253 _.LFE44: 6254 .size _Device, .-_Device === Switch to base=012BB0h -> ".RODATA.STR1.1" 6255 .section .rodata.str1.1 6256 _.LC51: 0 00000AEB 0D0A00 .string "\r\n" === Switch to base=002270h -> ".TEXT" 6258 .text 6259 .type _InitPgm, @function 6260 _InitPgm: 6261 _.LFB40: 1755:config.c **** static char init[NAMEMAX]; 6262 .loc 1 1755 0 6263 _.LVL774: 0 00002F61 56 push si 0 00002F62 55 push bp 6266 _.LCFI113: 0 00002F63 89E5 mov bp, sp 6268 _.LCFI114: 1759:config.c **** Config.cfgInitTail = inittail; 6269 .loc 1 1759 0 0 00002F65 BE[0000] mov si, offset _Config 0 00002F68 C74406[8F05] mov word ptr [si+6], offset _init.2335 1760:config.c **** 6272 .loc 1 1760 0 0 00002F6D C74408[4C05] mov word ptr [si+8], offset _inittail.2336 1763:config.c **** 6274 .loc 1 1763 0 0 00002F72 B8[8F05] mov ax, offset _init.2335 0 00002F75 50 push ax 0 00002F76 FF7606 push word ptr [bp+6] 0 00002F79 E8[FEFF] call _GetStringArg 6279 _.LVL775: 1767:config.c **** 6280 .loc 1 1767 0 0 00002F7C 50 push ax 0 00002F7D FF7408 push word ptr [si+8] 0 00002F80 E8[FEFF] call _init_strcpy 6284 _.LVL776: 1770:config.c **** 6285 .loc 1 1770 0 0 00002F83 B8[9B03] mov ax, offset _.LC51 0 00002F86 50 push ax 0 00002F87 FF7408 push word ptr [si+8] 0 00002F8A E8[FEFF] call _strcat 6290 _.LVL777: 1772:config.c **** } 6291 .loc 1 1772 0 0 00002F8D C6441000 mov byte ptr [si+16], 0 1773:config.c **** 6293 .loc 1 1773 0 0 00002F91 89EC mov sp, bp 0 00002F93 5D pop bp 0 00002F94 5E pop si 0 00002F95 C20200 ret 2 6298 _.LFE40: 6299 .size _InitPgm, .-_InitPgm 6300 .type _InitPgmHigh, @function 6301 _InitPgmHigh: 6302 _.LFB39: 1749:config.c **** InitPgm(pLine); 6303 .loc 1 1749 0 6304 _.LVL778: 0 00002F98 55 push bp 6306 _.LCFI115: 0 00002F99 89E5 mov bp, sp 6308 _.LCFI116: 1750:config.c **** Config.cfgP_0_startmode = 0x80; 6309 .loc 1 1750 0 0 00002F9B FF7604 push word ptr [bp+4] 0 00002F9E E8C0FF call _InitPgm 6312 _.LVL779: 1751:config.c **** } 6313 .loc 1 1751 0 0 00002FA1 C606[1000]80 mov byte ptr [_Config+16], -128 1752:config.c **** 6315 .loc 1 1752 0 0 00002FA6 89EC mov sp, bp 0 00002FA8 5D pop bp 0 00002FA9 C20200 ret 2 6319 _.LFE39: 6320 .size _InitPgmHigh, .-_InitPgmHigh 6321 .global _DoInstall 6322 .type _DoInstall, @function 6323 _DoInstall: 6324 _.LFB79: 2705:config.c **** int i; 6325 .loc 1 2705 0 2710:config.c **** return; 6326 .loc 1 2710 0 0 00002FAC 833E[0000]00 cmp word ptr [_numInstallCmds], 0 0 00002FB1 7455 je _.L691 2705:config.c **** int i; 6329 .loc 1 2705 0 0 00002FB3 56 push si 0 00002FB4 57 push di 0 00002FB5 55 push bp 6333 _.LCFI117: 0 00002FB6 89E5 mov bp, sp 6335 _.LCFI118: 0 00002FB8 81EC9E00 sub sp, 158 2721:config.c **** installMemory = ((unsigned)_init_end + ebda_size + 15) / 16; 6337 .loc 1 2721 0 0 00002FBC B002 mov al, 2 0 00002FBE 50 push ax 0 00002FBF E8FDE0 call _set_strategy 6341 _.LVL780: 2722:config.c **** #ifdef __WATCOMC__ 6342 .loc 1 2722 0 0 00002FC2 A1[0000] mov ax, word ptr [_ebda_size] 0 00002FC5 05[0F00] add ax, offset __init_end+15 0 00002FC8 B104 mov cl, 4 0 00002FCA D3E8 shr ax, cl 6347 _.LVL781: 2726:config.c **** 6348 .loc 1 2726 0 0 00002FCC 50 push ax 0 00002FCD E8[FEFF] call _allocmem 6351 _.LVL782: 0 00002FD0 898664FF mov word ptr [bp-156], ax 6353 _.LVL783: 2730:config.c **** { 6354 .loc 1 2730 0 0 00002FD4 BE[0000] mov si, offset _InstallCommands 0 00002FD7 C78668FF0000 mov word ptr [bp-152], 0 6357 _.LVL784: 6358 _.L680: 2730:config.c **** { 6359 .loc 1 2730 0 is_stmt 0 discriminator 1 0 00002FDD 8B8668FF mov ax, word ptr [bp-152] 0 00002FE1 3B06[0000] cmp ax, word ptr [_numInstallCmds] 0 00002FE5 7C22 jl _.L685 2736:config.c **** free(installMemory); 6363 .loc 1 2736 0 is_stmt 1 0 00002FE7 30C0 xor al, al 0 00002FE9 50 push ax 0 00002FEA E8D2E0 call _set_strategy 6367 _.LVL785: 6368 _.LBB255: 6369 _.LBB256: 2689:config.c **** r.es = segment; 6370 .loc 1 2689 0 0 00002FED C6468149 mov byte ptr [bp-127], 73 2690:config.c **** init_call_intr(0x21, &r); 6372 .loc 1 2690 0 0 00002FF1 8B8664FF mov ax, word ptr [bp-156] 0 00002FF5 894690 mov word ptr [bp-112], ax 2691:config.c **** } 6375 .loc 1 2691 0 0 00002FF8 8D4680 lea ax, [-128+bp] 0 00002FFB 50 push ax 0 00002FFC B82100 mov ax, 33 0 00002FFF 50 push ax 0 00003000 E8[FEFF] call _init_call_intr 6381 _.LVL786: 6382 _.LBE256: 6383 _.LBE255: 2741:config.c **** 6384 .loc 1 2741 0 0 00003003 89EC mov sp, bp 0 00003005 5D pop bp 6387 _.LVL787: 0 00003006 5F pop di 0 00003007 5E pop si 6390 _.LVL788: 6391 _.L691: 6392 _.LCFI119: 0 00003008 C3 ret 6394 _.LVL789: 6395 _.L685: 6396 _.LCFI120: 2733:config.c **** InstallExec(cmd); 6397 .loc 1 2733 0 discriminator 3 0 00003009 FFB48000 push word ptr [si+128] 0 0000300D E8AFE0 call _set_strategy 6400 _.LVL790: 6401 _.LBB257: 6402 _.LBB258: 2657:config.c **** 6403 .loc 1 2657 0 discriminator 3 0 00003010 56 push si 0 00003011 E8F4E1 call _skipwh 6406 _.LVL791: 0 00003014 89C2 mov dx, ax 6408 _.LVL792: 2659:config.c **** { 6409 .loc 1 2659 0 discriminator 3 0 00003016 97 xchg di, ax 0 00003017 8D5E80 lea bx, [-128+bp] 6412 _.LVL793: 6413 _.L683: 2661:config.c **** if (*d <= 0x020 || *d == '/') 6414 .loc 1 2661 0 0 0000301A 8A05 mov al, byte ptr [di] 0 0000301C 8807 mov byte ptr [bx], al 2662:config.c **** break; 6417 .loc 1 2662 0 0 0000301E 3C20 cmp al, 32 0 00003020 7E08 jle _.L681 0 00003022 3C2F cmp al, 47 0 00003024 7404 je _.L681 2659:config.c **** { 6422 .loc 1 2659 0 0 00003026 47 inc di 6424 _.LVL794: 0 00003027 43 inc bx 6426 _.LVL795: 0 00003028 EBF0 jmp _.L683 6428 _.L681: 0 0000302A 899662FF mov word ptr [bp-158], dx 2665:config.c **** 6430 .loc 1 2665 0 0 0000302E C60700 mov byte ptr [bx], 0 2667:config.c **** *args = strlen(&args[1]); 6432 .loc 1 2667 0 0 00003031 89F8 mov ax, di 0 00003033 48 dec ax 0 00003034 898666FF mov word ptr [bp-154], ax 6436 _.LVL796: 2668:config.c **** args[*args+1] = '\r'; 6437 .loc 1 2668 0 0 00003038 57 push di 0 00003039 E8[FEFF] call _init_strlen 6440 _.LVL797: 0 0000303C 8845FF mov byte ptr [di-1], al 2669:config.c **** args[*args+2] = 0; 6442 .loc 1 2669 0 0 0000303F 98 cbw 0 00003040 93 xchg bx, ax 0 00003041 C6010D mov byte ptr [bx+di], 13 2670:config.c **** 6446 .loc 1 2670 0 0 00003044 8A45FF mov al, byte ptr [di-1] 0 00003047 98 cbw 0 00003048 8BBE66FF mov di, word ptr [bp-154] 0 0000304C 93 xchg bx, ax 0 0000304D C6410200 mov byte ptr [bx+di+2], 0 2672:config.c **** exb.exec.cmd_line = (CommandTail FAR *) args; 6452 .loc 1 2672 0 0 00003051 C7866AFF0000 mov word ptr [bp-150], 0 2673:config.c **** exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *) 0xfffffffful; 6454 .loc 1 2673 0 0 00003057 89BE6CFF mov word ptr [bp-148], di 0 0000305B 8C966EFF mov word ptr [bp-146], ss 2674:config.c **** 6457 .loc 1 2674 0 0 0000305F C78674FFFFFF mov word ptr [bp-140], -1 0 00003065 C78676FFFFFF mov word ptr [bp-138], -1 0 0000306B C78670FFFFFF mov word ptr [bp-144], -1 0 00003071 C78672FFFFFF mov word ptr [bp-142], -1 2679:config.c **** { 6462 .loc 1 2679 0 0 00003077 8D4680 lea ax, [-128+bp] 0 0000307A 50 push ax 0 0000307B 8D866AFF lea ax, [-150+bp] 0 0000307F 50 push ax 0 00003080 FFB48000 push word ptr [si+128] 0 00003084 E8[FEFF] call _init_DosExec 6469 _.LVL798: 0 00003087 85C0 test ax, ax 0 00003089 8B9662FF mov dx, word ptr [bp-158] 0 0000308D 7404 je _.L684 2681:config.c **** } 6473 .loc 1 2681 0 0 0000308F 52 push dx 0 00003090 E868DE call _CfgFailure 6476 _.LVL799: 6477 _.L684: 6478 _.LBE258: 6479 _.LBE257: 2730:config.c **** { 6480 .loc 1 2730 0 0 00003093 FF8668FF inc word ptr [bp-152] 6482 _.LVL800: 0 00003097 81C68200 add si, 130 6484 _.LVL801: 0 0000309B E93FFF jmp _.L680 6486 _.LFE79: 6487 .size _DoInstall, .-_DoInstall 6488 .local _inittail.2336 6489 .comm _inittail.2336,67,1 6490 .local _init.2335 6491 .comm _init.2335,67,1 === Switch to base=000790h -> ".DATA" 6492 .data 6493 .type _table.2294, @object 6494 .size _table.2294, 90 6495 _table.2294: 0 000002B2 FF20202020202020 .ascii "\377 " 0 000002BA FFFF .hword -1 0 000002BC FF435459494E464F .ascii "\377CTYINFO" 0 000002C4 0500 .hword 5 0 000002C6 FF55434153452020 .ascii "\377UCASE " 0 000002CE 0000 .hword 0 0 000002D0 FF4C434153452020 .ascii "\377LCASE " 0 000002D8 FFFF .hword -1 0 000002DA FF46554341534520 .ascii "\377FUCASE " 0 000002E2 0100 .hword 1 0 000002E4 FF46434841522020 .ascii "\377FCHAR " 0 000002EC 0200 .hword 2 0 000002EE FF434F4C4C415445 .ascii "\377COLLATE" 0 000002F6 0300 .hword 3 0 000002F8 FF44424353202020 .ascii "\377DBCS " 0 00000300 0400 .hword 4 0 00000302 FF5945534E4F2020 .ascii "\377YESNO " 0 0000030A FFFF .hword -1 6514 .local _subf_data.2290 6515 .comm _subf_data.2290,266,1 6516 .local _hdr.2295 6517 .comm _hdr.2295,72,1 6518 .local _count.2297 6519 .comm _count.2297,2,2 6520 .local _entries.2296 6521 .comm _entries.2296,2,2 6522 .type _digits.2179, @object 6523 .size _digits.2179, 17 6524 _digits.2179: 0 0000030C 3031323334353637 .string "0123456789ABCDEF" 0 00000314 3839414243444546 0 0000031C 00 6526 .type _near_mcb.2446, @object 6527 .size _near_mcb.2446, 16 6528 _near_mcb.2446: 0 0000031D 4D .byte 77 0 0000031E 0800 .hword 8 0 00000320 0000 .hword 0 0 00000322 00 .byte 0 0 00000323 00 .byte 0 0 00000324 00 .byte 0 0 00000325 534300 .string "SC" 0 00000328 0000000000 .skip 5,0 0 0000032D 00 .p2align 1 6538 .type _configfile.2119, @object 6539 .size _configfile.2119, 2 6540 _configfile.2119: 0 0000032E [6501] .hword _.LC15 === Switch to base=012BB0h -> ".RODATA.STR1.1" 6542 .section .rodata.str1.1 6543 _.LC52: 0 00000AEE 6664636F6E666967 .string "fdconfig.sys" 0 00000AF6 2E73797300 === Switch to base=000790h -> ".DATA" 6545 .data 6546 .p2align 1 6547 .type _altconfigfile.2120, @object 6548 .size _altconfigfile.2120, 2 6549 _altconfigfile.2120: 0 00000330 [9E03] .hword _.LC52 === Switch to base=012BB0h -> ".RODATA.STR1.1" 6551 .section .rodata.str1.1 6552 _.LC53: 0 00000AFB 636F6E6669672E73 .string "config.sys" 0 00000B03 797300 === Switch to base=000790h -> ".DATA" 6554 .data 6555 .p2align 1 6556 .type _oldconfigfile.2121, @object 6557 .size _oldconfigfile.2121, 2 6558 _oldconfigfile.2121: 0 00000332 [AB03] .hword _.LC53 === Switch to base=012BB0h -> ".RODATA.STR1.1" 6560 .section .rodata.str1.1 6561 _.LC54: 0 00000B06 434F4E46494700 .string "CONFIG" 6563 _.LC55: 0 00000B0D 414C54434F4E4649 .string "ALTCONFIG" 0 00000B15 4700 6565 _.LC56: 0 00000B17 4F4C44434F4E4649 .string "OLDCONFIG" 0 00000B1F 4700 === Switch to base=012BB0h -> ".RODATA" 6567 .section .rodata 6568 .type _configcommands.2125, @object 6569 .size _configcommands.2125, 16 6570 _configcommands.2125: 0 00000629 [7C00] .hword _configfile.2119 0 0000062B [B603] .hword _.LC54 0 0000062D [7E00] .hword _altconfigfile.2120 0 0000062F [BD03] .hword _.LC55 0 00000631 [8000] .hword _oldconfigfile.2121 0 00000633 [C703] .hword _.LC56 0 00000635 0000 .hword 0 0 00000637 0000 .hword 0 6579 .local _commandbuffer.2117 6580 .comm _commandbuffer.2117,256,1 6581 .local _near_mcb.2441 6582 .comm _near_mcb.2441,16,1 6583 .global _InstallCommands === Switch to base=012BB0h -> ".BSS" 6584 .bss 6585 .p2align 0 6586 .type _InstallCommands, @object 6587 .size _InstallCommands, 1300 6588 _InstallCommands: 0 00001226 0000000000000000 .skip 1300,0 0 0000122E 0000000000000000 0 00001236 0000000000000000 0 0000123E 0000000000000000 0 00001246 0000000000000000 0 0000124E 0000000000000000 0 00001256 0000000000000000 0 0000125E 0000000000000000 0 00001266 0000000000000000 0 0000126E 0000000000000000 0 00001276 0000000000000000 0 0000127E 0000000000000000 0 00001286 0000000000000000 0 0000128E 0000000000000000 0 00001296 0000000000000000 0 0000129E 0000000000000000 0 000012A6 0000000000000000 0 000012AE 0000000000000000 0 000012B6 0000000000000000 0 000012BE 0000000000000000 0 000012C6 0000000000000000 0 000012CE 0000000000000000 0 000012D6 0000000000000000 0 000012DE 0000000000000000 0 000012E6 0000000000000000 0 000012EE 0000000000000000 0 000012F6 0000000000000000 0 000012FE 0000000000000000 0 00001306 0000000000000000 0 0000130E 0000000000000000 0 00001316 0000000000000000 0 0000131E 0000000000000000 0 00001326 0000000000000000 0 0000132E 0000000000000000 0 00001336 0000000000000000 0 0000133E 0000000000000000 0 00001346 0000000000000000 0 0000134E 0000000000000000 0 00001356 0000000000000000 0 0000135E 0000000000000000 0 00001366 0000000000000000 0 0000136E 0000000000000000 0 00001376 0000000000000000 0 0000137E 0000000000000000 0 00001386 0000000000000000 0 0000138E 0000000000000000 0 00001396 0000000000000000 0 0000139E 0000000000000000 0 000013A6 0000000000000000 0 000013AE 0000000000000000 0 000013B6 0000000000000000 0 000013BE 0000000000000000 0 000013C6 0000000000000000 0 000013CE 0000000000000000 0 000013D6 0000000000000000 0 000013DE 0000000000000000 0 000013E6 0000000000000000 0 000013EE 0000000000000000 0 000013F6 0000000000000000 0 000013FE 0000000000000000 0 00001406 0000000000000000 0 0000140E 0000000000000000 0 00001416 0000000000000000 0 0000141E 0000000000000000 0 00001426 0000000000000000 0 0000142E 0000000000000000 0 00001436 0000000000000000 0 0000143E 0000000000000000 0 00001446 0000000000000000 0 0000144E 0000000000000000 0 00001456 0000000000000000 0 0000145E 0000000000000000 0 00001466 0000000000000000 0 0000146E 0000000000000000 0 00001476 0000000000000000 0 0000147E 0000000000000000 0 00001486 0000000000000000 0 0000148E 0000000000000000 0 00001496 0000000000000000 0 0000149E 0000000000000000 0 000014A6 0000000000000000 0 000014AE 0000000000000000 0 000014B6 0000000000000000 0 000014BE 0000000000000000 0 000014C6 0000000000000000 0 000014CE 0000000000000000 0 000014D6 0000000000000000 0 000014DE 0000000000000000 0 000014E6 0000000000000000 0 000014EE 0000000000000000 0 000014F6 0000000000000000 0 000014FE 0000000000000000 0 00001506 0000000000000000 0 0000150E 0000000000000000 0 00001516 0000000000000000 0 0000151E 0000000000000000 0 00001526 0000000000000000 0 0000152E 0000000000000000 0 00001536 0000000000000000 0 0000153E 0000000000000000 0 00001546 0000000000000000 0 0000154E 0000000000000000 0 00001556 0000000000000000 0 0000155E 0000000000000000 0 00001566 0000000000000000 0 0000156E 0000000000000000 0 00001576 0000000000000000 0 0000157E 0000000000000000 0 00001586 0000000000000000 0 0000158E 0000000000000000 0 00001596 0000000000000000 0 0000159E 0000000000000000 0 000015A6 0000000000000000 0 000015AE 0000000000000000 0 000015B6 0000000000000000 0 000015BE 0000000000000000 0 000015C6 0000000000000000 0 000015CE 0000000000000000 0 000015D6 0000000000000000 0 000015DE 0000000000000000 0 000015E6 0000000000000000 0 000015EE 0000000000000000 0 000015F6 0000000000000000 0 000015FE 0000000000000000 0 00001606 0000000000000000 0 0000160E 0000000000000000 0 00001616 0000000000000000 0 0000161E 0000000000000000 0 00001626 0000000000000000 0 0000162E 0000000000000000 0 00001636 0000000000000000 0 0000163E 0000000000000000 0 00001646 0000000000000000 0 0000164E 0000000000000000 0 00001656 0000000000000000 0 0000165E 0000000000000000 0 00001666 0000000000000000 0 0000166E 0000000000000000 0 00001676 0000000000000000 0 0000167E 0000000000000000 0 00001686 0000000000000000 0 0000168E 0000000000000000 0 00001696 0000000000000000 0 0000169E 0000000000000000 0 000016A6 0000000000000000 0 000016AE 0000000000000000 0 000016B6 0000000000000000 0 000016BE 0000000000000000 0 000016C6 0000000000000000 0 000016CE 0000000000000000 0 000016D6 0000000000000000 0 000016DE 0000000000000000 0 000016E6 0000000000000000 0 000016EE 0000000000000000 0 000016F6 0000000000000000 0 000016FE 0000000000000000 0 00001706 0000000000000000 0 0000170E 0000000000000000 0 00001716 0000000000000000 0 0000171E 0000000000000000 0 00001726 0000000000000000 0 0000172E 0000000000000000 0 00001736 00000000 6590 .global _numInstallCmds 6591 .p2align 1 6592 .type _numInstallCmds, @object 6593 .size _numInstallCmds, 2 6594 _numInstallCmds: 0 0000173A 0000 .skip 2,0 6596 .global _specificCountriesSupported === Switch to base=000790h -> ".DATA" 6597 .data 6598 .type _specificCountriesSupported, @object 6599 .size _specificCountriesSupported, 351 6600 _specificCountriesSupported: 0 00000334 0100 .hword 1 0 00000336 00 .byte 0 0 00000337 2400 .string "$" 0 00000339 00 .skip 1,0 0 0000033A 2C .byte 44 0 0000033B 2E .byte 46 0 0000033C 2F .byte 47 0 0000033D 3A .byte 58 0 0000033E 00 .byte 0 0 0000033F 02 .byte 2 0 00000340 00 .byte 0 0 00000341 0200 .hword 2 0 00000343 02 .byte 2 0 00000344 2400 .string "$" 0 00000346 00 .skip 1,0 0 00000347 2C .byte 44 0 00000348 2E .byte 46 0 00000349 2D .byte 45 0 0000034A 3A .byte 58 0 0000034B 00 .byte 0 0 0000034C 02 .byte 2 0 0000034D 01 .byte 1 0 0000034E 0300 .hword 3 0 00000350 00 .byte 0 0 00000351 2400 .string "$" 0 00000353 00 .skip 1,0 0 00000354 2C .byte 44 0 00000355 2E .byte 46 0 00000356 2F .byte 47 0 00000357 3A .byte 58 0 00000358 00 .byte 0 0 00000359 02 .byte 2 0 0000035A 00 .byte 0 0 0000035B 0700 .hword 7 0 0000035D 01 .byte 1 0 0000035E 525542 .ascii "RUB" 0 00000361 20 .byte 32 0 00000362 2C .byte 44 0 00000363 2E .byte 46 0 00000364 3A .byte 58 0 00000365 03 .byte 3 0 00000366 02 .byte 2 0 00000367 01 .byte 1 0 00000368 1F00 .hword 31 0 0000036A 01 .byte 1 0 0000036B 455552 .ascii "EUR" 0 0000036E 2E .byte 46 0 0000036F 2C .byte 44 0 00000370 2D .byte 45 0 00000371 3A .byte 58 0 00000372 00 .byte 0 0 00000373 02 .byte 2 0 00000374 01 .byte 1 0 00000375 2000 .hword 32 0 00000377 01 .byte 1 0 00000378 455552 .ascii "EUR" 0 0000037B 2E .byte 46 0 0000037C 2C .byte 44 0 0000037D 2D .byte 45 0 0000037E 3A .byte 58 0 0000037F 00 .byte 0 0 00000380 02 .byte 2 0 00000381 01 .byte 1 0 00000382 2100 .hword 33 0 00000384 01 .byte 1 0 00000385 455552 .ascii "EUR" 0 00000388 2E .byte 46 0 00000389 2C .byte 44 0 0000038A 2D .byte 45 0 0000038B 3A .byte 58 0 0000038C 00 .byte 0 0 0000038D 02 .byte 2 0 0000038E 01 .byte 1 0 0000038F 2200 .hword 34 0 00000391 01 .byte 1 0 00000392 455552 .ascii "EUR" 0 00000395 2E .byte 46 0 00000396 27 .byte 39 0 00000397 2D .byte 45 0 00000398 3A .byte 58 0 00000399 00 .byte 0 0 0000039A 02 .byte 2 0 0000039B 01 .byte 1 0 0000039C 2400 .hword 36 0 0000039E 01 .byte 1 0 0000039F 244855 .ascii "$HU" 0 000003A2 2E .byte 46 0 000003A3 2C .byte 44 0 000003A4 2D .byte 45 0 000003A5 3A .byte 58 0 000003A6 00 .byte 0 0 000003A7 02 .byte 2 0 000003A8 01 .byte 1 0 000003A9 2600 .hword 38 0 000003AB 01 .byte 1 0 000003AC 245955 .ascii "$YU" 0 000003AF 2E .byte 46 0 000003B0 2C .byte 44 0 000003B1 2D .byte 45 0 000003B2 3A .byte 58 0 000003B3 00 .byte 0 0 000003B4 02 .byte 2 0 000003B5 01 .byte 1 0 000003B6 2700 .hword 39 0 000003B8 01 .byte 1 0 000003B9 455552 .ascii "EUR" 0 000003BC 2E .byte 46 0 000003BD 2C .byte 44 0 000003BE 2D .byte 45 0 000003BF 3A .byte 58 0 000003C0 00 .byte 0 0 000003C1 02 .byte 2 0 000003C2 01 .byte 1 0 000003C3 2900 .hword 41 0 000003C5 01 .byte 1 0 000003C6 534600 .string "SF" 0 000003C9 2E .byte 46 0 000003CA 2C .byte 44 0 000003CB 2E .byte 46 0 000003CC 3A .byte 58 0 000003CD 00 .byte 0 0 000003CE 02 .byte 2 0 000003CF 01 .byte 1 0 000003D0 2A00 .hword 42 0 000003D2 01 .byte 1 0 000003D3 245955 .ascii "$YU" 0 000003D6 2E .byte 46 0 000003D7 2C .byte 44 0 000003D8 2E .byte 46 0 000003D9 3A .byte 58 0 000003DA 00 .byte 0 0 000003DB 02 .byte 2 0 000003DC 01 .byte 1 0 000003DD 2C00 .hword 44 0 000003DF 01 .byte 1 0 000003E0 9C00 .string "\234" 0 000003E2 00 .skip 1,0 0 000003E3 2E .byte 46 0 000003E4 2C .byte 44 0 000003E5 2F .byte 47 0 000003E6 3A .byte 58 0 000003E7 00 .byte 0 0 000003E8 02 .byte 2 0 000003E9 01 .byte 1 0 000003EA 2D00 .hword 45 0 000003EC 01 .byte 1 0 000003ED 444B4B .ascii "DKK" 0 000003F0 2E .byte 46 0 000003F1 2C .byte 44 0 000003F2 2D .byte 45 0 000003F3 3A .byte 58 0 000003F4 00 .byte 0 0 000003F5 02 .byte 2 0 000003F6 01 .byte 1 0 000003F7 2E00 .hword 46 0 000003F9 02 .byte 2 0 000003FA 53454B .ascii "SEK" 0 000003FD 2C .byte 44 0 000003FE 2E .byte 46 0 000003FF 2D .byte 45 0 00000400 3A .byte 58 0 00000401 00 .byte 0 0 00000402 02 .byte 2 0 00000403 01 .byte 1 0 00000404 2F00 .hword 47 0 00000406 01 .byte 1 0 00000407 4E4F4B .ascii "NOK" 0 0000040A 2C .byte 44 0 0000040B 2E .byte 46 0 0000040C 2E .byte 46 0 0000040D 3A .byte 58 0 0000040E 00 .byte 0 0 0000040F 02 .byte 2 0 00000410 01 .byte 1 0 00000411 3000 .hword 48 0 00000413 02 .byte 2 0 00000414 504C4E .ascii "PLN" 0 00000417 2C .byte 44 0 00000418 2E .byte 46 0 00000419 2E .byte 46 0 0000041A 3A .byte 58 0 0000041B 00 .byte 0 0 0000041C 02 .byte 2 0 0000041D 01 .byte 1 0 0000041E 3100 .hword 49 0 00000420 01 .byte 1 0 00000421 455552 .ascii "EUR" 0 00000424 2E .byte 46 0 00000425 2C .byte 44 0 00000426 2E .byte 46 0 00000427 3A .byte 58 0 00000428 03 .byte 3 0 00000429 02 .byte 2 0 0000042A 01 .byte 1 0 0000042B 3600 .hword 54 0 0000042D 01 .byte 1 0 0000042E 246172 .ascii "$ar" 0 00000431 2E .byte 46 0 00000432 2C .byte 44 0 00000433 2F .byte 47 0 00000434 3A .byte 58 0 00000435 01 .byte 1 0 00000436 02 .byte 2 0 00000437 00 .byte 0 0 00000438 3700 .hword 55 0 0000043A 01 .byte 1 0 0000043B 246172 .ascii "$ar" 0 0000043E 2E .byte 46 0 0000043F 2C .byte 44 0 00000440 2F .byte 47 0 00000441 3A .byte 58 0 00000442 01 .byte 1 0 00000443 02 .byte 2 0 00000444 01 .byte 1 0 00000445 3D00 .hword 61 0 00000447 00 .byte 0 0 00000448 2400 .string "$" 0 0000044A 00 .skip 1,0 0 0000044B 2E .byte 46 0 0000044C 2C .byte 44 0 0000044D 2F .byte 47 0 0000044E 3A .byte 58 0 0000044F 00 .byte 0 0 00000450 02 .byte 2 0 00000451 01 .byte 1 0 00000452 5100 .hword 81 0 00000454 02 .byte 2 0 00000455 818F00 .string "\201\217" 0 00000458 2C .byte 44 0 00000459 2E .byte 46 0 0000045A 2F .byte 47 0 0000045B 3A .byte 58 0 0000045C 00 .byte 0 0 0000045D 02 .byte 2 0 0000045E 00 .byte 0 0 0000045F 5F01 .hword 351 0 00000461 01 .byte 1 0 00000462 455552 .ascii "EUR" 0 00000465 2E .byte 46 0 00000466 2C .byte 44 0 00000467 2D .byte 45 0 00000468 3A .byte 58 0 00000469 00 .byte 0 0 0000046A 02 .byte 2 0 0000046B 01 .byte 1 0 0000046C 6601 .hword 358 0 0000046E 01 .byte 1 0 0000046F 455552 .ascii "EUR" 0 00000472 20 .byte 32 0 00000473 2C .byte 44 0 00000474 2E .byte 46 0 00000475 3A .byte 58 0 00000476 03 .byte 3 0 00000477 02 .byte 2 0 00000478 01 .byte 1 0 00000479 6701 .hword 359 0 0000047B 01 .byte 1 0 0000047C 42474C .ascii "BGL" 0 0000047F 20 .byte 32 0 00000480 2C .byte 44 0 00000481 2E .byte 46 0 00000482 3A .byte 58 0 00000483 03 .byte 3 0 00000484 02 .byte 2 0 00000485 01 .byte 1 0 00000486 7C01 .hword 380 0 00000488 01 .byte 1 0 00000489 554148 .ascii "UAH" 0 0000048C 20 .byte 32 0 0000048D 2C .byte 44 0 0000048E 2E .byte 46 0 0000048F 3A .byte 58 0 00000490 03 .byte 3 0 00000491 02 .byte 2 0 00000492 01 .byte 1 6876 .global _HMAState === Switch to base=012BB0h -> ".BSS" 6877 .bss 6878 .p2align 0 6879 .type _HMAState, @object 6880 .size _HMAState, 1 6881 _HMAState: 0 0000173C 00 .skip 1,0 6883 .global _pLineStart 0 0000173D 00 .p2align 1 6885 .type _pLineStart, @object 6886 .size _pLineStart, 2 6887 _pLineStart: 0 0000173E 0000 .skip 2,0 === Switch to base=012BB0h -> ".RODATA.STR1.1" 6889 .section .rodata.str1.1 6890 _.LC57: 0 00000B21 5357495443484553 .string "SWITCHES" 0 00000B29 00 6892 _.LC58: 0 00000B2A 52454D00 .string "REM" 6894 _.LC59: 0 00000B2E 3B00 .string ";" 6896 _.LC60: 0 00000B30 4D454E55434F4C4F .string "MENUCOLOR" 0 00000B38 5200 6898 _.LC61: 0 00000B3A 4D454E5544454641 .string "MENUDEFAULT" 0 00000B42 554C5400 6900 _.LC62: 0 00000B46 4D454E5500 .string "MENU" 6902 _.LC63: 0 00000B4B 4543484F00 .string "ECHO" 6904 _.LC64: 0 00000B50 454543484F00 .string "EECHO" 6906 _.LC65: 0 00000B56 425245414B00 .string "BREAK" 6908 _.LC66: 0 00000B5C 4255464645525300 .string "BUFFERS" 6910 _.LC67: 0 00000B64 4255464645525348 .string "BUFFERSHIGH" 0 00000B6C 49474800 6912 _.LC68: 0 00000B70 434F4D4D414E4400 .string "COMMAND" 6914 _.LC69: 0 00000B78 434F554E54525900 .string "COUNTRY" 6916 _.LC70: 0 00000B80 444F5300 .string "DOS" 6918 _.LC71: 0 00000B84 444F534441544100 .string "DOSDATA" 6920 _.LC72: 0 00000B8C 4643425300 .string "FCBS" 6922 _.LC73: 0 00000B91 4B455942554600 .string "KEYBUF" 6924 _.LC74: 0 00000B98 46494C455300 .string "FILES" 6926 _.LC75: 0 00000B9E 46494C4553484947 .string "FILESHIGH" 0 00000BA6 4800 6928 _.LC76: 0 00000BA8 4C41535444524956 .string "LASTDRIVE" 0 00000BB0 4500 6930 _.LC77: 0 00000BB2 4C41535444524956 .string "LASTDRIVEHIGH" 0 00000BBA 454849474800 6932 _.LC78: 0 00000BC0 4E554D4C4F434B00 .string "NUMLOCK" 6934 _.LC79: 0 00000BC8 5348454C4C00 .string "SHELL" 6936 _.LC80: 0 00000BCE 5348454C4C484947 .string "SHELLHIGH" 0 00000BD6 4800 6938 _.LC81: 0 00000BD8 535441434B5300 .string "STACKS" 6940 _.LC82: 0 00000BDF 535441434B534849 .string "STACKSHIGH" 0 00000BE7 474800 6942 _.LC83: 0 00000BEA 5357495443484152 .string "SWITCHAR" 0 00000BF2 00 6944 _.LC84: 0 00000BF3 53435245454E00 .string "SCREEN" 6946 _.LC85: 0 00000BFA 56455253494F4E00 .string "VERSION" 6948 _.LC86: 0 00000C02 414E59444F5300 .string "ANYDOS" 6950 _.LC87: 0 00000C09 49444C4548414C54 .string "IDLEHALT" 0 00000C11 00 6952 _.LC88: 0 00000C12 44455649434500 .string "DEVICE" 6954 _.LC89: 0 00000C19 4445564943454849 .string "DEVICEHIGH" 0 00000C21 474800 6956 _.LC90: 0 00000C24 494E5354414C4C00 .string "INSTALL" 6958 _.LC91: 0 00000C2C 494E5354414C4C48 .string "INSTALLHIGH" 0 00000C34 49474800 6960 _.LC92: 0 00000C38 434841494E00 .string "CHAIN" 6962 _.LC93: 0 00000C3E 53455400 .string "SET" === Switch to base=000790h -> ".DATA" 6964 .data 6965 .type _commands, @object 6966 .size _commands, 190 6967 _commands: 0 00000493 [D103] .hword _.LC57 0 00000495 00 .byte 0 0 00000496 [3908] .hword _CfgSwitches 0 00000498 [DA03] .hword _.LC58 0 0000049A 00 .byte 0 0 0000049B [0E00] .hword _CfgIgnore 0 0000049D [DE03] .hword _.LC59 0 0000049F 00 .byte 0 0 000004A0 [0E00] .hword _CfgIgnore 0 000004A2 [E003] .hword _.LC60 0 000004A4 00 .byte 0 0 000004A5 [2D07] .hword _CfgMenuColor 0 000004A7 [EA03] .hword _.LC61 0 000004A9 00 .byte 0 0 000004AA [E406] .hword _CfgMenuDefault 0 000004AC [F603] .hword _.LC62 0 000004AE 00 .byte 0 0 000004AF [C609] .hword _CfgMenu 0 000004B1 [FB03] .hword _.LC63 0 000004B3 02 .byte 2 0 000004B4 [C609] .hword _CfgMenu 0 000004B6 [0004] .hword _.LC64 0 000004B8 02 .byte 2 0 000004B9 [1100] .hword _CfgMenuEsc 0 000004BB [0604] .hword _.LC65 0 000004BD 01 .byte 1 0 000004BE [9717] .hword _CfgBreak 0 000004C0 [0C04] .hword _.LC66 0 000004C2 01 .byte 1 0 000004C3 [2005] .hword _Config_Buffers 0 000004C5 [1404] .hword _.LC67 0 000004C7 01 .byte 1 0 000004C8 [3E05] .hword _CfgBuffersHigh 0 000004CA [2004] .hword _.LC68 0 000004CC 01 .byte 1 0 000004CD [9E20] .hword _InitPgm 0 000004CF [2804] .hword _.LC69 0 000004D1 01 .byte 1 0 000004D2 [B912] .hword _Country 0 000004D4 [3004] .hword _.LC70 0 000004D6 01 .byte 1 0 000004D7 [D411] .hword _Dosmem 0 000004D9 [3404] .hword _.LC71 0 000004DB 01 .byte 1 0 000004DC [A611] .hword _DosData 0 000004DE [3C04] .hword _.LC72 0 000004E0 01 .byte 1 0 000004E1 [9E06] .hword _Fcbs 0 000004E3 [4104] .hword _.LC73 0 000004E5 01 .byte 1 0 000004E6 [8B07] .hword _CfgKeyBuf 0 000004E8 [4804] .hword _.LC74 0 000004EA 01 .byte 1 0 000004EB [DC04] .hword _Files 0 000004ED [4E04] .hword _.LC75 0 000004EF 01 .byte 1 0 000004F0 [0C05] .hword _FilesHigh 0 000004F2 [5804] .hword _.LC76 0 000004F4 01 .byte 1 0 000004F5 [2009] .hword _CfgLastdrive 0 000004F7 [6204] .hword _.LC77 0 000004F9 01 .byte 1 0 000004FA [6809] .hword _CfgLastdriveHigh 0 000004FC [7004] .hword _.LC78 0 000004FE 01 .byte 1 0 000004FF [5911] .hword _Numlock 0 00000501 [7804] .hword _.LC79 0 00000503 01 .byte 1 0 00000504 [9E20] .hword _InitPgm 0 00000506 [7E04] .hword _.LC80 0 00000508 01 .byte 1 0 00000509 [D520] .hword _InitPgmHigh 0 0000050B [8804] .hword _.LC81 0 0000050D 01 .byte 1 0 0000050E [2506] .hword _Stacks 0 00000510 [8F04] .hword _.LC82 0 00000512 01 .byte 1 0 00000513 [8A06] .hword _StacksHigh 0 00000515 [9A04] .hword _.LC83 0 00000517 01 .byte 1 0 00000518 [3E11] .hword _CfgSwitchar 0 0000051A [A304] .hword _.LC84 0 0000051C 01 .byte 1 0 0000051D [D805] .hword _sysScreenMode 0 0000051F [AA04] .hword _.LC85 0 00000521 01 .byte 1 0 00000522 [5E05] .hword _sysVersion 0 00000524 [B204] .hword _.LC86 0 00000526 01 .byte 1 0 00000527 [0000] .hword _SetAnyDos 0 00000529 [B904] .hword _.LC87 0 0000052B 01 .byte 1 0 0000052C [B804] .hword _SetIdleHalt 0 0000052E [C204] .hword _.LC88 0 00000530 02 .byte 2 0 00000531 [8420] .hword _Device 0 00000533 [C904] .hword _.LC89 0 00000535 02 .byte 2 0 00000536 [3820] .hword _DeviceHigh 0 00000538 [D404] .hword _.LC90 0 0000053A 02 .byte 2 0 0000053B [D002] .hword _CmdInstall 0 0000053D [DC04] .hword _.LC91 0 0000053F 02 .byte 2 0 00000540 [BD02] .hword _CmdInstallHigh 0 00000542 [E804] .hword _.LC92 0 00000544 02 .byte 2 0 00000545 [1E02] .hword _CmdChain 0 00000547 [EE04] .hword _.LC93 0 00000549 02 .byte 2 0 0000054A [A11C] .hword _CmdSet 0 0000054C [6501] .hword _.LC15 0 0000054E FF .byte -1 0 0000054F [3800] .hword _CfgFailure 7082 .global _Menus === Switch to base=012BB0h -> ".BSS" 7083 .bss 7084 .p2align 1 7085 .type _Menus, @object 7086 .size _Menus, 2 7087 _Menus: 0 00001740 0000 .skip 2,0 7089 .global _MenuLine 7090 .p2align 1 7091 .type _MenuLine, @object 7092 .size _MenuLine, 2 7093 _MenuLine: 0 00001742 0000 .skip 2,0 7095 .global _MenuSelected 7096 .p2align 0 7097 .type _MenuSelected, @object 7098 .size _MenuSelected, 1 7099 _MenuSelected: 0 00001744 00 .skip 1,0 7101 .global _MenuTimeout === Switch to base=000790h -> ".DATA" 7102 .data 0 00000551 00 .p2align 1 7104 .type _MenuTimeout, @object 7105 .size _MenuTimeout, 2 7106 _MenuTimeout: 0 00000552 FFFF .hword -1 7108 .global _DontAskThisSingleCommand === Switch to base=012BB0h -> ".BSS" 7109 .bss 7110 .p2align 0 7111 .type _DontAskThisSingleCommand, @object 7112 .size _DontAskThisSingleCommand, 1 7113 _DontAskThisSingleCommand: 0 00001745 00 .skip 1,0 7115 .global _askThisSingleCommand 7116 .p2align 0 7117 .type _askThisSingleCommand, @object 7118 .size _askThisSingleCommand, 1 7119 _askThisSingleCommand: 0 00001746 00 .skip 1,0 7121 .global _SkipAllConfig 7122 .p2align 0 7123 .type _SkipAllConfig, @object 7124 .size _SkipAllConfig, 1 7125 _SkipAllConfig: 0 00001747 00 .skip 1,0 7127 .global _singleStep 7128 .p2align 0 7129 .type _singleStep, @object 7130 .size _singleStep, 1 7131 _singleStep: 0 00001748 00 .skip 1,0 7133 .global _nFileDesc 0 00001749 00 .p2align 1 7135 .type _nFileDesc, @object 7136 .size _nFileDesc, 2 7137 _nFileDesc: 0 0000174A 0000 .skip 2,0 7139 .global _nCurChain 7140 .p2align 1 7141 .type _nCurChain, @object 7142 .size _nCurChain, 2 7143 _nCurChain: 0 0000174C 0000 .skip 2,0 7145 .global _cfgFile 7146 .p2align 0 7147 .type _cfgFile, @object 7148 .size _cfgFile, 20 7149 _cfgFile: 0 0000174E 0000000000000000 .skip 20,0 0 00001756 0000000000000000 0 0000175E 00000000 7151 .local _szBuf 7152 .comm _szBuf,256,1 7153 .local _szLine 7154 .comm _szLine,256,1 7155 .global _UmbState 7156 .p2align 1 7157 .type _UmbState, @object 7158 .size _UmbState, 2 7159 _UmbState: 0 00001762 0000 .skip 2,0 7161 .local _nCfgLine 7162 .comm _nCfgLine,2,2 7163 .global _lpTop 7164 .p2align 1 7165 .type _lpTop, @object 7166 .size _lpTop, 4 7167 _lpTop: 0 00001764 00000000 .skip 4,0 7169 .local _umb_base_seg 7170 .comm _umb_base_seg,2,2 7171 .local _base_seg 7172 .comm _base_seg,2,2 7173 .global _Config === Switch to base=012BB0h -> ".RODATA.STR1.1" 7174 .section .rodata.str1.1 7175 _.LC94: 0 00000C42 636F6D6D616E642E .string "command.com" 0 00000C4A 636F6D00 7177 _.LC95: 0 00000C4E 202F50202F453A32 .string " /P /E:256\r\n" 0 00000C56 35360D0A00 === Switch to base=000790h -> ".DATA" 7179 .data 7180 .type _Config, @object 7181 .size _Config, 19 7182 _Config: 0 00000554 00 .byte 0 0 00000555 14 .byte 20 0 00000556 10 .byte 16 0 00000557 00 .byte 0 0 00000558 10 .byte 16 0 00000559 00 .byte 0 0 0000055A [F204] .hword _.LC94 0 0000055C [FE04] .hword _.LC95 0 0000055E 05 .byte 5 0 0000055F 00 .byte 0 0 00000560 08 .byte 8 0 00000561 00 .byte 0 0 00000562 0001 .hword 256 0 00000564 00 .byte 0 0 00000565 0000 .hword 0 0 00000567 00 .p2align 1 7199 .type _envp, @object 7200 .size _envp, 4 7201 _envp: 0 00000568 [0000] .hword _master_env 7203 .reloc ., R_386_OZSEG16, _master_env 0 0000056A [0000] .hword 0 7205 .local _ErrorAlreadyPrinted 7206 .comm _ErrorAlreadyPrinted,128,1 7207 .global _ebda_size === Switch to base=012BB0h -> ".BSS" 7208 .bss 7209 .p2align 1 7210 .type _ebda_size, @object 7211 .size _ebda_size, 2 7212 _ebda_size: 0 00001768 0000 .skip 2,0 7214 .global _ram_top 7215 .p2align 1 7216 .type _ram_top, @object 7217 .size _ram_top, 2 7218 _ram_top: 0 0000176A 0000 .skip 2,0 7220 .global _UMB_top 7221 .p2align 1 7222 .type _UMB_top, @object 7223 .size _UMB_top, 2 7224 _UMB_top: 0 0000176C 0000 .skip 2,0 7226 .global _umb_start 7227 .p2align 1 7228 .type _umb_start, @object 7229 .size _umb_start, 2 7230 _umb_start: 0 0000176E 0000 .skip 2,0 7232 .global _MenuColor === Switch to base=000790h -> ".DATA" 7233 .data 7234 .p2align 1 7235 .type _MenuColor, @object 7236 .size _MenuColor, 2 7237 _MenuColor: 0 0000056C FFFF .hword -1 7239 .global _nMenuLine === Switch to base=012BB0h -> ".BSS" 7240 .bss 7241 .p2align 1 7242 .type _nMenuLine, @object 7243 .size _nMenuLine, 2 7244 _nMenuLine: 0 00001770 0000 .skip 2,0 7246 .local _MenuStruct 7247 .comm _MenuStruct,850,1 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: console.lst 1 ; 2 ; File: 3 ; console.asm 4 ; Description: 5 ; Console device driver 6 ; 7 ; Copyright (c) 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Header$ 29 ; 30 31 %include "io.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; io.inc 4 <1> ; Description: 5 <1> ; Segments and external common routines used by various device drivers 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Header$ 29 <1> ; 30 <1> 31 <1> %include "segs.inc" 1 <2> ; File: 2 <2> ; segs.inc 3 <2> ; Description: 4 <2> ; Segment definitions for the kernel 5 <2> ; 6 <2> ; Copyright (c) 1998 7 <2> ; Pasquale J. Villani 8 <2> ; All Rights Reserved 9 <2> ; 10 <2> ; This file is part of DOS-C. 11 <2> ; 12 <2> ; DOS-C is free software; you can redistribute it and/or 13 <2> ; modify it under the terms of the GNU General Public License 14 <2> ; as published by the Free Software Foundation; either version 15 <2> ; 2, or (at your option) any later version. 16 <2> ; 17 <2> ; DOS-C is distributed in the hope that it will be useful, but 18 <2> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <2> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <2> ; the GNU General Public License for more details. 21 <2> ; 22 <2> ; You should have received a copy of the GNU General Public 23 <2> ; License along with DOS-C; see the file COPYING. If not, 24 <2> ; write to the Free Software Foundation, 675 Mass Ave, 25 <2> ; Cambridge, MA 02139, USA. 26 <2> ; 27 <2> ; $Header$ 28 <2> ; 29 <2> 30 <2> ; CPU specification -- putting it here because all .asm files include this 31 <2> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <2> ; understand it 33 <2> %ifdef __NASM_VER__ 34 <2> %if XCPU == 86 35 <2> CPU 8086 36 <2> %else 37 <2> CPU XCPU 38 <2> %endif 39 <2> %endif 40 <2> 41 <2> ; for OW on Linux: 42 <2> %ifdef owlinux 43 <2> %define WATCOM 44 <2> %endif 45 <2> 46 <2> %ifidn __OUTPUT_FORMAT__, obj 47 <2> group PGROUP PSP 48 <2> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <2> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <2> %ifdef WATCOM 51 <2> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <2> %define IGROUP TGROUP 53 <2> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <2> %else 55 <2> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <2> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <2> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <2> %endif 59 <2> %define class(x) class=x 60 <2> %define nobits 61 <2> %define exec 62 <2> %define INITSIZE init_end wrt INIT_TEXT 63 <2> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <2> 65 <2> %else ; using ELF 66 <2> 67 <2> BITS 16 68 <2> ; groups are defined in the linker script kernel.ld 69 <2> extern PGROUP 70 <2> extern DGROUP 71 <2> extern LGROUP 72 <2> extern TGROUP 73 <2> extern IGROUP 74 <2> extern I_GROUP 75 <2> %define class(x) 76 <2> %define stack 77 <2> extern INITSIZE 78 <2> %define INITTEXTSIZE __InitTextEnd 79 <2> 80 <2> %endif 81 <2> === Switch to base=000000h -> "PSP" 82 <2> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <2> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <2> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <2> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <2> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <2> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <2> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <2> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <2> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <2> segment _DATAEND class(DATA) align=1 92 <2> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <2> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <2> segment CONST2 class(DATA) align=2 95 <2> ;for MSC === Switch to base=000000h -> "DCONST" 96 <2> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <2> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <2> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <2> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <2> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <2> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <2> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <2> segment INIT_TEXT_END class(CODE) align=16 104 <2> 105 <2> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <2> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <2> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <2> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <2> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <2> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <2> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <2> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <2> segment IB_E class(FAR_DATA) align=2 114 <2> %else === Switch to base=012BB0h -> "ID_B" 115 <2> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <2> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <2> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <2> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <2> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <2> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <2> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <2> segment IB_E class(IB) align=2 nobits 123 <2> %endif 32 <1> 33 <1> ; 34 <1> ; Error Return Codes 35 <1> ; 36 <1> 37 <1> %define E_WRPRT 0 ; Write Protect 38 <1> %define E_UNIT 1 ; Unknown Unit 39 <1> %define E_NOTRDY 2 ; Device Not Ready 40 <1> %define E_CMD 3 ; Unknown Command 41 <1> %define E_CRC 4 ; Crc Error 42 <1> %define E_LENGTH 5 ; Bad Length 43 <1> %define E_SEEK 6 ; Seek Error 44 <1> %define E_MEDIA 7 ; Unknown MEDIA 45 <1> %define E_NOTFND 8 ; Sector Not Found 46 <1> %define E_PAPER 9 ; No Paper 47 <1> %define E_WRITE 10 ; Write Fault 48 <1> %define E_READ 11 ; Read Fault 49 <1> %define E_FAILURE 12 ; General Failure 50 <1> 51 <1> 52 <1> extern _IOExit 53 <1> extern _IOSuccess 54 <1> extern _IOErrorExit 55 <1> extern _IOErrCnt 56 <1> extern _IODone 57 <1> extern _IOCommandError 58 <1> extern GetUnitNum 59 <1> extern _ReqPktPtr 60 <1> 32 33 === Switch to base=000100h -> "_IO_FIXED_DATA" 34 segment _IO_FIXED_DATA 35 36 global ConTable 0 00000624 0A ConTable db 0Ah 0 00000625 [0200] dw ConInit 0 00000627 [0000] dw _IOExit 0 00000629 [0000] dw _IOExit 0 0000062B [0000] dw _IOCommandError 0 0000062D [1200] dw ConRead 0 0000062F [5200] dw CommonNdRdExit 0 00000631 [5200] dw CommonNdRdExit 0 00000633 [9000] dw ConInpFlush 0 00000635 [AF00] dw ConWrite 0 00000637 [AF00] dw ConWrite 0 00000639 [0000] dw _IOExit 49 50 CTL_PRT_SCREEN equ 7200h 51 CTL_P equ 10h 52 === Switch to base=000100h -> "_LOWTEXT" 53 segment _LOWTEXT 54 0 0000012E 00 uScanCode db 0 ; Scan code for con: device 56 57 global _kbdType 0 0000012F 00 _kbdType db 0 ; 00 for 84key, 10h for 102key 59 60 %IFDEF DEBUG_PRINT_COMPORT 61 ASYNC_NEED_INIT db 1 62 %ENDIF 63 64 65 global ConInit 66 ConInit: 0 00000130 31C0 xor ax,ax 0 00000132 8ED8 mov ds,ax 0 00000134 A09604 mov al,[496h] 0 00000137 2410 and al,10h 0 00000139 2EA2[0100] mov byte[cs:_kbdType],al ; enhanced keyboard if bit 4 set 0 0000013D E9[0000] jmp _IOExit 73 74 ; 75 ; Name: 76 ; ConRead 77 ; 78 ; Function: 79 ; Read to address in es:di characters from the keyboard. Cx contains 80 ; a count of how many characters are to be transferred. 81 ; 82 ; Description: 83 ; Calls KbdRdChar to read the characters. Destroys ax. 84 ; 85 global ConRead 86 ConRead: 0 00000140 E306 jcxz ConRead2 ; Exit if read of zero 88 89 ConRead1: 0 00000142 E81800 call KbdRdChar ; Get a char from kbd in al 0 00000145 AA stosb ; Store al to es:[di] 0 00000146 E2FA loop ConRead1 ; Loop until all are read 93 94 ConRead2: 0 00000148 E9[0000] jmp _IOExit 96 97 98 readkey: 0 0000014B 2E8A26[0100] mov ah,[cs:_kbdType] 0 00000150 CD16 int 16h 0 00000152 3CE0 checke0: cmp al,0xe0 ; must check for 0xe0 scan code 0 00000154 7506 jne .ret 0 00000156 08E4 or ah,ah ; check for Greek alpha 0 00000158 7402 jz .ret 0 0000015A B000 mov al,0 ; otherwise destroy the 0xe0 0 0000015C C3 .ret: retn 107 108 ; 109 ; Name: 110 ; KbdRdChar 111 ; 112 ; Function: 113 ; Read a character from the keyboard. 114 ; 115 ; Description: 116 ; This subroutine reads a character from the keyboard. It also handles 117 ; a couple of special functions. 118 ; It converts ctrl-printscreen to a control-P. 119 ; It also accounts for extended scan codes by saving off 120 ; the high byte of the return and returning it if it was non-zero on 121 ; the previous read. 122 ; 123 global KbdRdChar 124 KbdRdChar: 0 0000015D 31C0 xor ax,ax ; Zero the scratch register 0 0000015F 2E8606[0000] xchg [cs:uScanCode],al ; and swap with scan code 127 ; now AL is set if previous key was extended, 128 ; and previous is erased in any case 0 00000164 08C0 or al,al ; Test to see if it was set 0 00000166 7517 jnz KbdRdRtn ; Exit if it was, returning it 0 00000168 E8E0FF call readkey ; get keybd char in al, ah=scan 0 0000016B 09C0 or ax,ax ; Zero ? 0 0000016D 74EE jz KbdRdChar ; Loop if it is 0 0000016F 3D0072 cmp ax,CTL_PRT_SCREEN ; Ctrl-Print screen? 0 00000172 7502 jne KbdRd1 ; Nope, keep going 0 00000174 B010 mov al,CTL_P ; Yep, make it ^P 137 KbdRd1: 0 00000176 08C0 or al,al ; Extended key? 0 00000178 7505 jnz KbdRdRtn ; Nope, just exit 0 0000017A 2E8826[0000] mov [cs:uScanCode],ah ; Yep, save the scan code 141 KbdRdRtn: 0 0000017F C3 retn 143 144 ; 145 ; Name: 146 ; CommonNdRdExit 147 ; 148 ; Function: 149 ; Checks the keyboard input buffer. 150 ; 151 ; Description: 152 ; Calls int 16 (get status). Sets Busy-Flag in status field. Destroys ax. 153 ; 154 global CommonNdRdExit 155 CommonNdRdExit: ; *** tell if key waiting and return its ASCII if yes 0 00000180 2EA0[0000] mov al,[cs:uScanCode] ; Test for last scan code 157 ; now AL is set if previous key was extended, 0 00000184 08C0 or al,al ; Was it zero ? 0 00000186 7522 jnz ConNdRd2 ; Jump if there's a char waiting 0 00000188 B401 mov ah,1 0 0000018A 2E0226[0100] add ah,[cs:_kbdType] 0 0000018F CD16 int 16h ; Get status, if zf=0 al=char 0 00000191 7428 jz ConNdRd4 ; Jump if no char available 0 00000193 09C0 or ax,ax ; Also check for ax=0 as apparently some 0 00000195 7424 jz ConNdRd4 ; int16h handlers set ax=0 to indicate unsupported function 0 00000197 E8B8FF call checke0 ; check for e0 scancode 0 0000019A 09C0 or ax,ax ; Zero ? 0 0000019C 7505 jnz ConNdRd1 ; Jump if not zero 0 0000019E E8AAFF call readkey 0 000001A1 EBDD jmp short CommonNdRdExit 171 ; if char was there but 0, fetch and retry... 172 ; (why do we check uScanCode here?) 173 174 ConNdRd1: 0 000001A3 3D0072 cmp ax,CTL_PRT_SCREEN ; Was ctl+prntscrn key pressed? 0 000001A6 7502 jne ConNdRd2 ; Jump if not 0 000001A8 B010 mov al,CTL_P 178 179 ConNdRd2: 0 000001AA 2EC51E[0000] lds bx,[cs:_ReqPktPtr] ; Set the status 0 000001AF 807F0206 cmp byte[bx+2],6 ; input status call? 0 000001B3 7403 je ConNdRd3 0 000001B5 88470D mov [bx+0Dh],al ; return the ASCII of that key 184 185 ConNdRd3: 0 000001B8 E9[0000] jmp _IOExit 187 188 ConNdRd4: 0 000001BB E9[0000] jmp _IODone 190 191 192 193 global ConInpFlush 194 ConInpFlush: ; *** flush that keyboard queue 0 000001BE E80300 call KbdInpChar ; get all available keys 0 000001C1 E9[0000] jmp _IOExit ; do not even remember the last one 197 198 199 200 KbdInpChar: ; *** get ??00 or the last waiting key after flushing the queue 0 000001C4 31C0 xor ax,ax 0 000001C6 2EA2[0000] mov byte [cs:uScanCode],al 203 KbdInpCh1: 0 000001CA B401 mov ah,1 0 000001CC 2E0226[0100] add ah,[cs:_kbdType] 0 000001D1 CD16 int 16h ; get status, if zf=0 al=char 0 000001D3 7405 jz KbdInpRtnZero ; Jump if zero 208 ; returns 0 or the last key that was waiting in AL 0 000001D5 E873FF call readkey 0 000001D8 EBF0 jmp short KbdInpCh1 211 ; just read any key that is waiting, then check if 212 ; more keys are waiting. if not, return AL of this 213 ; key (which is its ASCII). AH (scan) discarded! 0 000001DA B401 KbdInpRtnZero: mov ah,1 ; if anybody wants "1 if no key was waiting"! 215 KbdInpRtn: 0 000001DC C3 retn 217 218 219 global ConWrite 220 ConWrite: 0 000001DD E3D9 jcxz ConNdRd3 ; Exit if nothing to write 222 ConWr1: 0 000001DF 268A05 mov al,[es:di] 0 000001E2 47 inc di 0 000001E3 CD29 int 29h ; Do fast output call 0 000001E5 E2F8 loop ConWr1 ; Loop if more to output 0 000001E7 E9[0000] jmp _IOExit 228 229 CBreak: 0 000001EA 2EC606[0000]03 mov byte [cs:uScanCode],3 ; Put a ^C into the buffer 231 IntRetn: 0 000001F0 CF iret 233 234 235 ; global _cso 236 ;_cso 237 ; push bp 238 ; mov bp,sp 239 ; push ax 240 ; mov ax,[bp+4] 241 ; int 29h 242 ; pop ax 243 ; pop bp 244 ; retn 245 246 global _int29_handler 247 _int29_handler: 0 000001F1 50 push ax 0 000001F2 56 push si 0 000001F3 57 push di 0 000001F4 55 push bp 0 000001F5 53 push bx 253 %IFDEF DEBUG_PRINT_COMPORT 254 cmp bx, 0xFD05 ; magic value for COM print routine 255 je .comprint 256 %ENDIF 0 000001F6 B40E mov ah,0Eh 0 000001F8 BB0700 mov bx,7 0 000001FB CD10 int 10h ; write char al, teletype mode 260 .int29hndlr_ret: 0 000001FD 5B pop bx 0 000001FE 5D pop bp 0 000001FF 5F pop di 0 00000200 5E pop si 0 00000201 58 pop ax 0 00000202 CF iret 267 %IFDEF DEBUG_PRINT_COMPORT 268 %ifnum DEBUG_PRINT_COMPORT 269 %define DEBUG_USE_COMPORT DEBUG_PRINT_COMPORT 270 %else 271 %define DEBUG_USE_COMPORT 1 ; default to COM2 if not specified 272 %endif 273 .comprint: 274 push dx 275 mov dx, DEBUG_USE_COMPORT ; 0=COM1,1=COM2,2=COM3,3=COM4 276 277 mov ah, [cs:ASYNC_NEED_INIT] 278 or ah,ah 279 jz .skip_init 280 push ax ; preserve char (AL) to print 281 282 ; initialize serial port using BIOS to DOS default 283 ; of 2400 bps, 8 data bits, 1 stop bit, and no parity 284 mov ax, 0x00A3 285 int 14h ; BIOS initialize serial port 286 287 mov ax, 0x011B ; clear the remote screen (ESC[2J) 288 int 14h ; BIOS write character to serial port 289 mov ax, 0x015B ; '[' 290 int 14h ; BIOS write character to serial port 291 mov ax, 0x0132 ; '2' 292 int 14h ; BIOS write character to serial port 293 mov ax, 0x014A ; 'J' 294 int 14h ; BIOS write character to serial port 295 296 ; mark initialization complete 297 mov byte [cs:ASYNC_NEED_INIT], 0 298 299 pop ax ; restore char to print 300 .skip_init: 301 cmp al, 0x0A ; do we need to add a carriage return? 302 jne .print_it 303 mov ax, 0x010D ; print as \r\n 304 int 14h 305 mov al, 0x0A 306 .print_it: 307 mov ah, 0x01 308 int 14h ; BIOS write character to serial port 309 310 pop dx 311 jmp .int29hndlr_ret 312 %ENDIF ; DEBUG_PRINT_COMPORT === Trace listing source: cpu.lst 1 ; File: 2 ; cpu.asm 3 ; Description: 4 ; Query basic CPU running on 5 ; 6 ; DOS-C 7 ; Copyright (c) 2012 8 ; FreeDOS 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; 24 25 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif === Switch to base=00E150h -> "INIT_TEXT" 26 segment INIT_TEXT 27 28 CPU 386 29 ;********************************************************************* 30 ; 31 ; UWORD query_cpu() based on Eric Auer's public domain cpulevel.asm 32 ; input: none 33 ; output: ax = cpu, 0=8086/8088, 1=186/188, 2=286, 3=386+ 34 global _query_cpu 35 _query_cpu: 36 ; save registers, assumes enough space on stack & valid stack frame setup 37 ;push ax - no need to save, return value saved here 0 0000049D 53 push bx 0 0000049E 51 push cx 0 0000049F 9C pushf ; save flags 41 42 ; begin check, assume x86 unless later family detected 0 000004A0 31DB xor bx, bx ; 808x or 186 highest detected family stored in bx 0 000004A2 53 push bx 0 000004A3 9D popf ; try to clear all flag bits 0 000004A4 9C pushf ; copy flags to ax so we can test if clear succeeded 0 000004A5 58 pop ax 0 000004A6 2500F0 and ax, 0f000h 0 000004A9 3D00F0 cmp ax, 0f000h 0 000004AC 7523 jnz is286 ; no the 4 msb stuck set to 1, so is a 808x or 8018x 51 ; NEC V20/V30 support 186 instructions but 52 ; do not mask the shift count like a 186. 53 ; based on https://hg.pushbx.org/ecm/ldebug/file/7f3440d5824d/source/init.asm#l3071 54 ; which is based on http://www.textfiles.com/hamradio/v20_bug.txt 0 000004AE 89E0 mov ax, sp ; we use stack to do test 0 000004B0 B90000 mov cx, 0 ; after pop still 0 if 8088/8086 0 000004B3 51 push cx 0 000004B4 41 inc cx ; after pop still 1 if NEC V20/V30 59 ; next instructions may lock system if breakpoint or trace flag set 0 000004B5 8FC1 db 8Fh, 0C1h; pop r/m16 with operand cx on 808x, nop on NEC V20/V30 0 000004B7 89C4 mov sp, ax ; reset stack to known good state (pre push, optional pop) 0 000004B9 09C9 or cx, cx ; cx is 0 if 808x, 1 if NEC 0 000004BB 7404 jz is808x ; if not NEC then goto test for 808x vs 8018x 0 000004BD 89CB mov bx, cx ; treat NEC V20/V30 as 8018x, i.e. return 1 0 000004BF EB22 jmp short cleanup 66 is808x: 0 000004C1 B80100 mov ax,1 ; determine if 8086 or 186 0 000004C4 B140 mov cl,64 ; try to shift further than size of ax 0 000004C6 D3E8 shr ax,cl 0 000004C8 09C0 or ax,ax 0 000004CA 7403 jz is086 ; 186 ignores the upper bits of cl 0 000004CC BB0100 mov bx, 1 ; 186: above 808x, below 286 0 000004CF EB12 is086: jmp short cleanup 0 000004D1 BB0200 is286: mov bx, 2 ; at least 286 0 000004D4 B800F0 mov ax, 0f000h 0 000004D7 50 push ax 0 000004D8 9D popf ; try to set 4 msb of flags 0 000004D9 9C pushf ; copy flags to ax so we can test if clear succeeded 0 000004DA 58 pop ax 0 000004DB A900F0 test ax, 0f000h 0 000004DE 7403 jz cleanup ; 4 msb stuck to 0: 80286 0 000004E0 BB0300 mov bx, 3 ; at least 386 83 84 cleanup: 0 000004E3 89D8 mov ax, bx ; return CPU family 0 000004E5 9D popf 0 000004E6 59 pop cx 0 000004E7 5B pop bx 0 000004E8 C3 retn 90 === Trace listing source: dosfns.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=dosfns.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccbJLSGc.s output file : dosfns.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _get_free_hndl, @function 8 _get_free_hndl: 9 _.LFB16: 10 .file 1 "dosfns.c" 1:dosfns.c **** /****************************************************************/ 2:dosfns.c **** /* */ 3:dosfns.c **** /* dosfns.c */ 4:dosfns.c **** /* */ 5:dosfns.c **** /* DOS functions */ 6:dosfns.c **** /* */ 7:dosfns.c **** /* Copyright (c) 1995 */ 8:dosfns.c **** /* Pasquale J. Villani */ 9:dosfns.c **** /* All Rights Reserved */ 10:dosfns.c **** /* */ 11:dosfns.c **** /* This file is part of DOS-C. */ 12:dosfns.c **** /* */ 13:dosfns.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:dosfns.c **** /* modify it under the terms of the GNU General Public License */ 15:dosfns.c **** /* as published by the Free Software Foundation; either version */ 16:dosfns.c **** /* 2, or (at your option) any later version. */ 17:dosfns.c **** /* */ 18:dosfns.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:dosfns.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:dosfns.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:dosfns.c **** /* the GNU General Public License for more details. */ 22:dosfns.c **** /* */ 23:dosfns.c **** /* You should have received a copy of the GNU General Public */ 24:dosfns.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:dosfns.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:dosfns.c **** /* Cambridge, MA 02139, USA. */ 27:dosfns.c **** /****************************************************************/ 28:dosfns.c **** 29:dosfns.c **** #include "portab.h" 30:dosfns.c **** 31:dosfns.c **** #ifdef VERSION_STRINGS 32:dosfns.c **** static BYTE *dosfnsRcsId = 33:dosfns.c **** "$Id: dosfns.c 1564 2011-04-08 18:27:48Z bartoldeman $"; 34:dosfns.c **** #endif 35:dosfns.c **** 36:dosfns.c **** #include "globals.h" 37:dosfns.c **** #include "debug.h" 38:dosfns.c **** 39:dosfns.c **** /* /// Added for SHARE. - Ron Cemer */ 40:dosfns.c **** 41:dosfns.c **** BYTE share_installed = 0; 42:dosfns.c **** 43:dosfns.c **** /* DOS calls this to see if it's okay to open the file. 44:dosfns.c **** Returns a file_table entry number to use (>= 0) if okay 45:dosfns.c **** to open. Otherwise returns < 0 and may generate a critical 46:dosfns.c **** error. If < 0 is returned, it is the negated error return 47:dosfns.c **** code, so DOS simply negates this value and returns it in 48:dosfns.c **** AX. */ 49:dosfns.c **** extern int ASMPASCAL 50:dosfns.c **** share_open_check(const char FAR * filename, /* pointer to fully qualified filename */ 51:dosfns.c **** unsigned short pspseg, /* psp segment address of owner process */ 52:dosfns.c **** int openmode, /* 0=read-only, 1=write-only, 2=read-write */ 53:dosfns.c **** int sharemode); /* SHARE_COMPAT, etc... */ 54:dosfns.c **** 55:dosfns.c **** /* DOS calls this to record the fact that it has successfully 56:dosfns.c **** closed a file, or the fact that the open for this file failed. */ 57:dosfns.c **** extern void ASMPASCAL 58:dosfns.c **** share_close_file(int fileno); /* file_table entry number */ 59:dosfns.c **** 60:dosfns.c **** /* DOS calls this to determine whether it can access (read or 61:dosfns.c **** write) a specific section of a file. We call it internally 62:dosfns.c **** from lock_unlock (only when locking) to see if any portion 63:dosfns.c **** of the requested region is already locked. If pspseg is zero, 64:dosfns.c **** then it matches any pspseg in the lock table. Otherwise, only 65:dosfns.c **** locks which DO NOT belong to pspseg will be considered. 66:dosfns.c **** Returns zero if okay to access or lock (no portion of the 67:dosfns.c **** region is already locked). Otherwise returns non-zero and 68:dosfns.c **** generates a critical error (if allowcriter is non-zero). 69:dosfns.c **** If non-zero is returned, it is the negated return value for 70:dosfns.c **** the DOS call. */ 71:dosfns.c **** extern int ASMPASCAL 72:dosfns.c **** share_access_check(unsigned short pspseg, /* psp segment address of owner process */ 73:dosfns.c **** int fileno, /* file_table entry number */ 74:dosfns.c **** unsigned long ofs, /* offset into file */ 75:dosfns.c **** unsigned long len, /* length (in bytes) of region to access */ 76:dosfns.c **** int allowcriter); /* allow a critical error to be generated */ 77:dosfns.c **** 78:dosfns.c **** /* DOS calls this to lock or unlock a specific section of a file. 79:dosfns.c **** Returns zero if successfully locked or unlocked. Otherwise 80:dosfns.c **** returns non-zero. 81:dosfns.c **** If the return value is non-zero, it is the negated error 82:dosfns.c **** return code for the DOS 0x5c call. */ 83:dosfns.c **** extern int ASMPASCAL 84:dosfns.c **** share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */ 85:dosfns.c **** int fileno, /* file_table entry number */ 86:dosfns.c **** unsigned long ofs, /* offset into file */ 87:dosfns.c **** unsigned long len, /* length (in bytes) of region to lock or unlock */ 88:dosfns.c **** int unlock); /* one to unlock; zero to lock */ 89:dosfns.c **** 90:dosfns.c **** /* DOS calls this to see if share already has the file marked as open. 91:dosfns.c **** Returns: 92:dosfns.c **** 1 if open 93:dosfns.c **** 0 if not */ 94:dosfns.c **** extern int ASMPASCAL 95:dosfns.c **** share_is_file_open(const char far * filename); 96:dosfns.c **** 97:dosfns.c **** /* /// End of additions for SHARE. - Ron Cemer */ 98:dosfns.c **** 99:dosfns.c **** STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */ 100:dosfns.c **** unsigned long ofs, /* offset into file */ 101:dosfns.c **** unsigned long len, /* length (in bytes) of region to lock or unlock */ 102:dosfns.c **** int unlock); /* one to unlock; zero to lock */ 103:dosfns.c **** 104:dosfns.c **** struct cds FAR *get_cds_unvalidated(unsigned drive) 105:dosfns.c **** { 106:dosfns.c **** if (drive >= lastdrive) 107:dosfns.c **** return NULL; 108:dosfns.c **** return &CDSp[drive]; 109:dosfns.c **** } 110:dosfns.c **** 111:dosfns.c **** /* get current directory structure for drive 112:dosfns.c **** return NULL if the CDS is not valid or the 113:dosfns.c **** drive is not within range */ 114:dosfns.c **** struct cds FAR *get_cds(unsigned drive) 115:dosfns.c **** { 116:dosfns.c **** struct cds FAR *cdsp; 117:dosfns.c **** unsigned flags; 118:dosfns.c **** 119:dosfns.c **** if (drive >= lastdrive) 120:dosfns.c **** return NULL; 121:dosfns.c **** cdsp = &CDSp[drive]; 122:dosfns.c **** flags = cdsp->cdsFlags; 123:dosfns.c **** /* Entry is disabled or JOINed drives are accessable by the path only */ 124:dosfns.c **** if (!(flags & CDSVALID) || (flags & CDSJOINED) != 0) 125:dosfns.c **** return NULL; 126:dosfns.c **** if (!(flags & CDSNETWDRV) && cdsp->cdsDpb == NULL) 127:dosfns.c **** return NULL; 128:dosfns.c **** return cdsp; 129:dosfns.c **** } 130:dosfns.c **** 131:dosfns.c **** /* same, but on input drv is 0 for default or 1=A, 2=B, etc. */ 132:dosfns.c **** struct cds FAR *get_cds1(unsigned drv) 133:dosfns.c **** { 134:dosfns.c **** if (drv-- == 0) /* get default drive or convert to 0 = A:, 1 = B:, ... */ 135:dosfns.c **** drv = default_drive; 136:dosfns.c **** return get_cds(drv); 137:dosfns.c **** } 138:dosfns.c **** 139:dosfns.c **** #ifdef WITHFAT32 140:dosfns.c **** struct dpb FAR * GetDriveDPB(UBYTE drive, COUNT * rc) 141:dosfns.c **** { 142:dosfns.c **** struct dpb FAR *dpb; 143:dosfns.c **** struct cds FAR *cdsp; 144:dosfns.c **** 145:dosfns.c **** cdsp = get_cds1(drive); 146:dosfns.c **** 147:dosfns.c **** if (cdsp == NULL) 148:dosfns.c **** { 149:dosfns.c **** *rc = DE_INVLDDRV; 150:dosfns.c **** return 0; 151:dosfns.c **** } 152:dosfns.c **** dpb = cdsp->cdsDpb; 153:dosfns.c **** if (dpb == 0 || cdsp->cdsFlags & CDSNETWDRV) 154:dosfns.c **** { 155:dosfns.c **** *rc = DE_INVLDDRV; 156:dosfns.c **** return 0; 157:dosfns.c **** } 158:dosfns.c **** 159:dosfns.c **** *rc = SUCCESS; 160:dosfns.c **** return dpb; 161:dosfns.c **** } 162:dosfns.c **** #endif 163:dosfns.c **** 164:dosfns.c **** int idx_to_sft_(int SftIndex) 165:dosfns.c **** { 166:dosfns.c **** /*called from below and int2f/ax=1216*/ 167:dosfns.c **** sfttbl FAR *sp; 168:dosfns.c **** 169:dosfns.c **** lpCurSft = (sft FAR *) - 1; 170:dosfns.c **** if (SftIndex < 0) 171:dosfns.c **** return -1; 172:dosfns.c **** 173:dosfns.c **** /* Get the SFT block that contains the SFT */ 174:dosfns.c **** for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next) 175:dosfns.c **** { 176:dosfns.c **** if (SftIndex < sp->sftt_count) 177:dosfns.c **** { 178:dosfns.c **** /* finally, point to the right entry */ 179:dosfns.c **** lpCurSft = (sft FAR *) & (sp->sftt_table[SftIndex]); 180:dosfns.c **** return SftIndex; 181:dosfns.c **** } 182:dosfns.c **** SftIndex -= sp->sftt_count; 183:dosfns.c **** } 184:dosfns.c **** 185:dosfns.c **** /* If not found, return an error */ 186:dosfns.c **** return -1; 187:dosfns.c **** } 188:dosfns.c **** 189:dosfns.c **** sft FAR * idx_to_sft(int SftIndex) 190:dosfns.c **** { 191:dosfns.c **** /* called internally only */ 192:dosfns.c **** SftIndex = idx_to_sft_(SftIndex); 193:dosfns.c **** /* if not opened, the SFT is useless */ 194:dosfns.c **** if (SftIndex == -1 || lpCurSft->sft_count == 0) 195:dosfns.c **** return (sft FAR *) - 1; 196:dosfns.c **** return lpCurSft; 197:dosfns.c **** } 198:dosfns.c **** 199:dosfns.c **** int get_sft_idx(unsigned hndl) 200:dosfns.c **** { 201:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 202:dosfns.c **** int idx; 203:dosfns.c **** 204:dosfns.c **** if (hndl >= p->ps_maxfiles) 205:dosfns.c **** return DE_INVLDHNDL; 206:dosfns.c **** 207:dosfns.c **** idx = p->ps_filetab[hndl]; 208:dosfns.c **** return idx == 0xff ? DE_INVLDHNDL : idx; 209:dosfns.c **** } 210:dosfns.c **** 211:dosfns.c **** sft FAR *get_sft(UCOUNT hndl) 212:dosfns.c **** { 213:dosfns.c **** /* Get the SFT block that contains the SFT */ 214:dosfns.c **** return idx_to_sft(get_sft_idx(hndl)); 215:dosfns.c **** } 216:dosfns.c **** 217:dosfns.c **** long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode) 218:dosfns.c **** { 219:dosfns.c **** /* Get the SFT block that contains the SFT */ 220:dosfns.c **** sft FAR *s = idx_to_sft(sft_idx); 221:dosfns.c **** 222:dosfns.c **** if (FP_OFF(s) == (size_t) - 1) 223:dosfns.c **** { 224:dosfns.c **** return DE_INVLDHNDL; 225:dosfns.c **** } 226:dosfns.c **** /* If for read and write-only or for write and read-only then exit */ 227:dosfns.c **** if((mode == XFR_READ && (s->sft_mode & O_WRONLY)) || 228:dosfns.c **** (mode == XFR_WRITE && (s->sft_mode & O_ACCMODE) == O_RDONLY)) 229:dosfns.c **** { 230:dosfns.c **** return DE_ACCESS; 231:dosfns.c **** } 232:dosfns.c **** if (mode == XFR_FORCE_WRITE) 233:dosfns.c **** mode = XFR_WRITE; 234:dosfns.c **** 235:dosfns.c **** /* 236:dosfns.c **** * Do remote first or return error. 237:dosfns.c **** * must have been opened from remote. 238:dosfns.c **** */ 239:dosfns.c **** if (s->sft_flags & SFT_FSHARED) 240:dosfns.c **** { 241:dosfns.c **** long XferCount; 242:dosfns.c **** VOID FAR *save_dta; 243:dosfns.c **** 244:dosfns.c **** save_dta = dta; 245:dosfns.c **** lpCurSft = s; 246:dosfns.c **** current_filepos = s->sft_posit; /* needed for MSCDEX */ 247:dosfns.c **** dta = bp; 248:dosfns.c **** XferCount = remote_rw(mode == XFR_READ ? REM_READ : REM_WRITE, s, n); 249:dosfns.c **** dta = save_dta; 250:dosfns.c **** return XferCount; 251:dosfns.c **** } 252:dosfns.c **** 253:dosfns.c **** /* Do a device transfer if device */ 254:dosfns.c **** if (s->sft_flags & SFT_FDEVICE) 255:dosfns.c **** { 256:dosfns.c **** struct dhdr FAR *dev = s->sft_dev; 257:dosfns.c **** 258:dosfns.c **** /* Now handle raw and cooked modes */ 259:dosfns.c **** if (s->sft_flags & SFT_FBINARY) 260:dosfns.c **** { 261:dosfns.c **** long rc = BinaryCharIO(&dev, n, bp, 262:dosfns.c **** mode == XFR_READ ? C_INPUT : C_OUTPUT); 263:dosfns.c **** if (mode == XFR_WRITE && rc > 0 && (s->sft_flags & SFT_FCONOUT)) 264:dosfns.c **** { 265:dosfns.c **** size_t cnt = (size_t)rc; 266:dosfns.c **** const char FAR *p = bp; 267:dosfns.c **** while (cnt--) 268:dosfns.c **** update_scr_pos(*p++, 1); 269:dosfns.c **** } 270:dosfns.c **** return rc; 271:dosfns.c **** } 272:dosfns.c **** 273:dosfns.c **** /* cooked mode */ 274:dosfns.c **** if (mode==XFR_READ) 275:dosfns.c **** { 276:dosfns.c **** long rc; 277:dosfns.c **** 278:dosfns.c **** /* Test for eof and exit */ 279:dosfns.c **** /* immediately if it is */ 280:dosfns.c **** if (!(s->sft_flags & SFT_FEOF)) 281:dosfns.c **** return 0; 282:dosfns.c **** 283:dosfns.c **** if (s->sft_flags & SFT_FCONIN) 284:dosfns.c **** rc = read_line_handle(sft_idx, n, bp); 285:dosfns.c **** else 286:dosfns.c **** rc = cooked_read(&dev, n, bp); 287:dosfns.c **** if (*(char *)bp == CTL_Z) 288:dosfns.c **** s->sft_flags &= ~SFT_FEOF; 289:dosfns.c **** return rc; 290:dosfns.c **** } 291:dosfns.c **** else 292:dosfns.c **** { 293:dosfns.c **** /* reset EOF state (set to no EOF) */ 294:dosfns.c **** s->sft_flags |= SFT_FEOF; 295:dosfns.c **** 296:dosfns.c **** /* if null just report full transfer */ 297:dosfns.c **** if (s->sft_flags & SFT_FNUL) 298:dosfns.c **** return n; 299:dosfns.c **** else 300:dosfns.c **** return cooked_write(&dev, n, bp); 301:dosfns.c **** } 302:dosfns.c **** } 303:dosfns.c **** 304:dosfns.c **** /* a block transfer */ 305:dosfns.c **** /* /// Added for SHARE - Ron Cemer */ 306:dosfns.c **** if (IsShareInstalled(FALSE) && (s->sft_shroff >= 0)) 307:dosfns.c **** { 308:dosfns.c **** /* sft_shroff is file_table index in share */ 309:dosfns.c **** int rc = share_access_check(cu_psp, s->sft_shroff, s->sft_posit, 310:dosfns.c **** (unsigned long)n, 1); 311:dosfns.c **** if (rc != SUCCESS) 312:dosfns.c **** return rc; 313:dosfns.c **** } 314:dosfns.c **** /* /// End of additions for SHARE - Ron Cemer */ 315:dosfns.c **** return rwblock(sft_idx, bp, n, mode); 316:dosfns.c **** } 317:dosfns.c **** 318:dosfns.c **** COUNT SftSeek2(int sft_idx, LONG new_pos, unsigned mode, UDWORD * p_result) 319:dosfns.c **** { 320:dosfns.c **** sft FAR *s = idx_to_sft(sft_idx); 321:dosfns.c **** if (FP_OFF(s) == (size_t) -1) 322:dosfns.c **** return DE_INVLDHNDL; 323:dosfns.c **** 324:dosfns.c **** /* Test for invalid mode */ 325:dosfns.c **** if (mode > SEEK_END) 326:dosfns.c **** return DE_INVLDFUNC; 327:dosfns.c **** 328:dosfns.c **** lpCurSft = s; 329:dosfns.c **** 330:dosfns.c **** /* Do special return for character devices */ 331:dosfns.c **** if (s->sft_flags & SFT_FDEVICE) 332:dosfns.c **** { 333:dosfns.c **** new_pos = 0; 334:dosfns.c **** } 335:dosfns.c **** else if (mode == SEEK_CUR) 336:dosfns.c **** { 337:dosfns.c **** new_pos += s->sft_posit; 338:dosfns.c **** } 339:dosfns.c **** else if (mode == SEEK_END) /* seek from end of file */ 340:dosfns.c **** { 341:dosfns.c **** /* 342:dosfns.c **** * RB list has it as Note: 343:dosfns.c **** * this function is called by the DOS 3.1+ kernel, but only when seeking 344:dosfns.c **** * from the end of a file opened with sharing modes set in such a manner 345:dosfns.c **** * that another process is able to change the size of the file while it 346:dosfns.c **** * is already open 347:dosfns.c **** * Tested this with Shsucdx ver 0.06 and 1.0. Both now work. 348:dosfns.c **** * Lredir via mfs.c from DosEMU works when writing appended files. 349:dosfns.c **** * Mfs.c looks for these mode bits set, so here is my best guess.;^) 350:dosfns.c **** */ 351:dosfns.c **** if ((s->sft_flags & SFT_FSHARED) && 352:dosfns.c **** (s->sft_mode & (O_DENYREAD | O_DENYNONE))) 353:dosfns.c **** new_pos = remote_lseek(s, new_pos); 354:dosfns.c **** else 355:dosfns.c **** new_pos += s->sft_size; 356:dosfns.c **** } 357:dosfns.c **** 358:dosfns.c **** s->sft_posit = new_pos; 359:dosfns.c **** *p_result = new_pos; 360:dosfns.c **** return SUCCESS; 361:dosfns.c **** } 362:dosfns.c **** 363:dosfns.c **** COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode) 364:dosfns.c **** { 365:dosfns.c **** UDWORD result; 366:dosfns.c **** return SftSeek2(sft_idx, new_pos, mode, &result); 367:dosfns.c **** } 368:dosfns.c **** 369:dosfns.c **** ULONG DosSeek(unsigned hndl, LONG new_pos, COUNT mode, int *rc) 370:dosfns.c **** { 371:dosfns.c **** int sft_idx = get_sft_idx(hndl); 372:dosfns.c **** UDWORD result; 373:dosfns.c **** 374:dosfns.c **** /* Get the SFT block that contains the SFT */ 375:dosfns.c **** *rc = SftSeek2(sft_idx, new_pos, mode, &result); 376:dosfns.c **** if (*rc == SUCCESS) 377:dosfns.c **** return result; 378:dosfns.c **** return *rc; 379:dosfns.c **** } 380:dosfns.c **** 381:dosfns.c **** STATIC long get_free_hndl(void) 382:dosfns.c **** { 11 .loc 1 382 0 0 00002F1B 56 push si 13 _.LCFI0: 14 _.LVL0: 383:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 384:dosfns.c **** UBYTE FAR *q = p->ps_filetab; 15 .loc 1 384 0 0 00002F1C 8E06[0000] mov es, word ptr [_cu_psp] 0 00002F20 268B363400 mov si, word ptr es:[52] 0 00002F25 26A13600 mov ax, word ptr es:[54] 19 _.LVL1: 385:dosfns.c **** UBYTE FAR *r = fmemchr(q, 0xff, p->ps_maxfiles); 20 .loc 1 385 0 0 00002F29 26FF363200 push word ptr es:[50] 22 _.LCFI1: 0 00002F2E BAFF00 mov dx, 255 0 00002F31 52 push dx 25 _.LCFI2: 0 00002F32 50 push ax 27 _.LCFI3: 0 00002F33 56 push si 29 _.LCFI4: 0 00002F34 E8[FEFF] call _fmemchr 31 _.LCFI5: 32 _.LVL2: 386:dosfns.c **** if (FP_SEG(r) == 0) return DE_TOOMANY; 33 .loc 1 386 0 0 00002F37 85D2 test dx, dx 0 00002F39 7406 je _.L3 0 00002F3B 29F0 sub ax, si 0 00002F3D 31D2 xor dx, dx 38 _.L1: 387:dosfns.c **** return (unsigned)(r - q); 388:dosfns.c **** } 39 .loc 1 388 0 0 00002F3F 5E pop si 0 00002F40 C3 ret 42 _.L3: 386:dosfns.c **** if (FP_SEG(r) == 0) return DE_TOOMANY; 43 .loc 1 386 0 0 00002F41 B8FCFF mov ax, -4 0 00002F44 BAFFFF mov dx, -1 0 00002F47 EBF6 jmp _.L1 47 _.LFE16: 48 .size _get_free_hndl, .-_get_free_hndl 49 .type _pop_dmp.part.0, @function 50 _pop_dmp.part.0: 51 _.LFB50: 389:dosfns.c **** 390:dosfns.c **** STATIC sft FAR *get_free_sft(COUNT * sft_idx) 391:dosfns.c **** { 392:dosfns.c **** COUNT sys_idx = 0; 393:dosfns.c **** sfttbl FAR *sp; 394:dosfns.c **** 395:dosfns.c **** /* Get the SFT block that contains the SFT */ 396:dosfns.c **** for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next) 397:dosfns.c **** { 398:dosfns.c **** REG COUNT i = sp->sftt_count; 399:dosfns.c **** sft FAR *sfti = sp->sftt_table; 400:dosfns.c **** 401:dosfns.c **** for (; --i >= 0; sys_idx++, sfti++) 402:dosfns.c **** { 403:dosfns.c **** if (sfti->sft_count == 0) 404:dosfns.c **** { 405:dosfns.c **** *sft_idx = sys_idx; 406:dosfns.c **** 407:dosfns.c **** /* MS NET uses this on open/creat TE */ 408:dosfns.c **** { 409:dosfns.c **** extern WORD ASM current_sft_idx; 410:dosfns.c **** current_sft_idx = sys_idx; 411:dosfns.c **** } 412:dosfns.c **** 413:dosfns.c **** return sfti; 414:dosfns.c **** } 415:dosfns.c **** } 416:dosfns.c **** } 417:dosfns.c **** /* If not found, return an error */ 418:dosfns.c **** return (sft FAR *) - 1; 419:dosfns.c **** } 420:dosfns.c **** 421:dosfns.c **** const char FAR *get_root(const char FAR * fname) 422:dosfns.c **** { 423:dosfns.c **** /* find the end */ 424:dosfns.c **** register unsigned length = fstrlen(fname); 425:dosfns.c **** char c; 426:dosfns.c **** 427:dosfns.c **** /* now back up to first path seperator or start */ 428:dosfns.c **** fname += length; 429:dosfns.c **** while (length) 430:dosfns.c **** { 431:dosfns.c **** length--; 432:dosfns.c **** c = *--fname; 433:dosfns.c **** if (c == '/' || c == '\\' || c == ':') { 434:dosfns.c **** fname++; 435:dosfns.c **** break; 436:dosfns.c **** } 437:dosfns.c **** } 438:dosfns.c **** return fname; 439:dosfns.c **** } 440:dosfns.c **** 441:dosfns.c **** STATIC void ConvertPathNameToFCBName(char *FCBName, const char *PathName) 442:dosfns.c **** { 443:dosfns.c **** ConvertNameSZToName83(FCBName, (char *)FP_OFF(get_root(PathName))); 444:dosfns.c **** FCBName[FNAME_SIZE + FEXT_SIZE] = '\0'; 445:dosfns.c **** } 446:dosfns.c **** 447:dosfns.c **** STATIC void set_fcbname(void) 448:dosfns.c **** { 449:dosfns.c **** ConvertPathNameToFCBName(DirEntBuffer.dir_name, PriPathName); 450:dosfns.c **** } 451:dosfns.c **** 452:dosfns.c **** /* initialize SFT fields (for open/creat) for character devices */ 453:dosfns.c **** STATIC int DeviceOpenSft(struct dhdr FAR *dhp, sft FAR *sftp) 454:dosfns.c **** { 455:dosfns.c **** int i; 456:dosfns.c **** 457:dosfns.c **** sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */ 458:dosfns.c **** sftp->sft_count += 1; 459:dosfns.c **** sftp->sft_flags = 460:dosfns.c **** (dhp->dh_attr & ~(SFT_MASK | SFT_FSHARED)) | SFT_FDEVICE | SFT_FEOF; 461:dosfns.c **** fmemcpy(sftp->sft_name, dhp->dh_name, FNAME_SIZE); 462:dosfns.c **** 463:dosfns.c **** /* pad with spaces */ 464:dosfns.c **** for (i = FNAME_SIZE + FEXT_SIZE - 1; sftp->sft_name[i] == '\0'; i--) 465:dosfns.c **** sftp->sft_name[i] = ' '; 466:dosfns.c **** /* and uppercase */ 467:dosfns.c **** DosUpFMem(sftp->sft_name, FNAME_SIZE + FEXT_SIZE); 468:dosfns.c **** 469:dosfns.c **** sftp->sft_dev = dhp; 470:dosfns.c **** sftp->sft_date = dos_getdate(); 471:dosfns.c **** sftp->sft_time = dos_gettime(); 472:dosfns.c **** sftp->sft_attrib = D_DEVICE; 473:dosfns.c **** 474:dosfns.c **** if (sftp->sft_dev->dh_attr & SFT_FOCRM) 475:dosfns.c **** { 476:dosfns.c **** /* if Open/Close/RM bit in driver's attribute is set 477:dosfns.c **** * then issue an Open request to the driver 478:dosfns.c **** */ 479:dosfns.c **** struct dhdr FAR *dev = sftp->sft_dev; 480:dosfns.c **** if (BinaryCharIO(&dev, 0, MK_FP(0x0000, 0x0000), C_OPEN) != SUCCESS) 481:dosfns.c **** return DE_ACCESS; 482:dosfns.c **** } 483:dosfns.c **** return SUCCESS; 484:dosfns.c **** } 485:dosfns.c **** 486:dosfns.c **** /* 487:dosfns.c **** extended open codes 488:dosfns.c **** 0000 0000 always fail 489:dosfns.c **** 0000 0001 open O_OPEN 490:dosfns.c **** 0000 0010 replace O_TRUNC 491:dosfns.c **** 492:dosfns.c **** 0001 0000 create new file O_CREAT 493:dosfns.c **** 0001 0001 create if not exists, open if exists O_CREAT | O_OPEN 494:dosfns.c **** 0001 0010 create O_CREAT | O_TRUNC 495:dosfns.c **** 496:dosfns.c **** bits for flags (bits 11-8 are internal FreeDOS bits only) 497:dosfns.c **** 15 O_FCB called from FCB open 498:dosfns.c **** 14 O_SYNC commit for each write (not implemented yet) 499:dosfns.c **** 13 O_NOCRIT do not invoke int23 (not implemented yet) 500:dosfns.c **** 12 O_LARGEFILE allow files >= 2gb but < 4gb (not implemented yet) 501:dosfns.c **** 11 O_LEGACY not called from int21/ah=6c: find right fn for redirector 502:dosfns.c **** 10 O_CREAT if file does not exist, create it 503:dosfns.c **** 9 O_TRUNC if file exists, truncate and open it \ not both 504:dosfns.c **** 8 O_OPEN if file exists, open it / 505:dosfns.c **** 7 O_NOINHERIT do not inherit handle on exec 506:dosfns.c **** 6 \ 507:dosfns.c **** 5 - sharing modes 508:dosfns.c **** 4 / 509:dosfns.c **** 3 reserved 510:dosfns.c **** 2 bits 2,1,0 = 100: RDONLY and do not modify file's last access time 511:dosfns.c **** (not implemented yet) 512:dosfns.c **** 1 \ 0=O_RDONLY, 1=O_WRONLY, 513:dosfns.c **** 0 / 2=O_RDWR, 3=O_EXECCASE (preserve case for redirector EXEC, 514:dosfns.c **** (not implemented yet)) 515:dosfns.c **** */ 516:dosfns.c **** 517:dosfns.c **** long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib) 518:dosfns.c **** { 519:dosfns.c **** COUNT sft_idx; 520:dosfns.c **** sft FAR *sftp; 521:dosfns.c **** struct dhdr FAR *dhp; 522:dosfns.c **** long result; 523:dosfns.c **** 524:dosfns.c **** result = truename(fname, PriPathName, CDS_MODE_CHECK_DEV_PATH); 525:dosfns.c **** if (result < SUCCESS) 526:dosfns.c **** return result; 527:dosfns.c **** 528:dosfns.c **** set_fcbname(); 529:dosfns.c **** 530:dosfns.c **** /* now get a free system file table entry */ 531:dosfns.c **** if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1) 532:dosfns.c **** return DE_TOOMANY; 533:dosfns.c **** 534:dosfns.c **** fmemset(sftp, 0, sizeof(sft)); 535:dosfns.c **** 536:dosfns.c **** sftp->sft_psp = cu_psp; 537:dosfns.c **** sftp->sft_mode = flags & 0xf0ff; 538:dosfns.c **** OpenMode = (BYTE) flags; 539:dosfns.c **** 540:dosfns.c **** sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */ 541:dosfns.c **** sftp->sft_attrib = attrib = attrib | D_ARCHIVE; 542:dosfns.c **** 543:dosfns.c **** /* check for a device */ 544:dosfns.c **** if ((result & IS_DEVICE) && (dhp = IsDevice(fname)) != NULL) 545:dosfns.c **** { 546:dosfns.c **** int rc = DeviceOpenSft(dhp, sftp); 547:dosfns.c **** /* check the status code returned by the 548:dosfns.c **** * driver when we tried to open it 549:dosfns.c **** */ 550:dosfns.c **** if (rc < SUCCESS) 551:dosfns.c **** return rc; 552:dosfns.c **** return sft_idx; 553:dosfns.c **** } 554:dosfns.c **** 555:dosfns.c **** if (result & IS_NETWORK) 556:dosfns.c **** { 557:dosfns.c **** int status; 558:dosfns.c **** unsigned cmd; 559:dosfns.c **** if ((flags & (O_TRUNC | O_CREAT)) == O_CREAT) 560:dosfns.c **** attrib |= 0x100; 561:dosfns.c **** 562:dosfns.c **** lpCurSft = sftp; 563:dosfns.c **** cmd = REM_CREATE; 564:dosfns.c **** if (!(flags & O_LEGACY)) 565:dosfns.c **** { 566:dosfns.c **** extern UWORD ASM ext_open_mode, ASM ext_open_attrib, ASM ext_open_action; 567:dosfns.c **** ext_open_mode = flags & 0x70ff; 568:dosfns.c **** ext_open_attrib = attrib & 0xff; 569:dosfns.c **** ext_open_action = ((flags & 0x0300) >> 8) | ((flags & O_CREAT) >> 6); 570:dosfns.c **** cmd = REM_EXTOC; 571:dosfns.c **** } 572:dosfns.c **** else if (!(flags & O_CREAT)) 573:dosfns.c **** { 574:dosfns.c **** cmd = REM_OPEN; 575:dosfns.c **** attrib = (BYTE)flags; 576:dosfns.c **** } 577:dosfns.c **** status = (int)network_redirector_mx(cmd, sftp, (void *)attrib); 578:dosfns.c **** if (status >= SUCCESS) 579:dosfns.c **** { 580:dosfns.c **** if (sftp->sft_count == 0) 581:dosfns.c **** sftp->sft_count++; 582:dosfns.c **** return sft_idx | ((long)status << 16); 583:dosfns.c **** } 584:dosfns.c **** return status; 585:dosfns.c **** } 586:dosfns.c **** 587:dosfns.c **** /* First test the flags to see if the user has passed a valid */ 588:dosfns.c **** /* file mode... */ 589:dosfns.c **** if ((flags & O_ACCMODE) > 2) 590:dosfns.c **** return DE_INVLDACC; 591:dosfns.c **** 592:dosfns.c **** /* NEVER EVER allow directories to be created */ 593:dosfns.c **** /* ... though FCBs are weird :) */ 594:dosfns.c **** if (!(flags & O_FCB) && 595:dosfns.c **** (attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE | D_VOLID))) 596:dosfns.c **** return DE_ACCESS; 597:dosfns.c **** 598:dosfns.c **** /* /// Added for SHARE. - Ron Cemer */ 599:dosfns.c **** if (IsShareInstalled(TRUE)) 600:dosfns.c **** { 601:dosfns.c **** DebugPrintf(("Share installed - open_check(%s)\n", PriPathName)); 602:dosfns.c **** if ((sftp->sft_shroff = 603:dosfns.c **** share_open_check(PriPathName, cu_psp, 604:dosfns.c **** flags & 0x03, (flags >> 4) & 0x07)) < 0) 605:dosfns.c **** return sftp->sft_shroff; 606:dosfns.c **** } 607:dosfns.c **** else 608:dosfns.c **** { 609:dosfns.c **** DebugPrintf(("Share NOT installed - open_check(%s)\n", PriPathName)); 610:dosfns.c **** } 611:dosfns.c **** 612:dosfns.c **** /* /// End of additions for SHARE. - Ron Cemer */ 613:dosfns.c **** 614:dosfns.c **** sftp->sft_count++; 615:dosfns.c **** sftp->sft_flags = PriPathName[0] - 'A'; 616:dosfns.c **** result = dos_open(PriPathName, flags, attrib, sft_idx); 617:dosfns.c **** DebugPrintf(("dos_open(%s) returned %i\n", PriPathName, result)); 618:dosfns.c **** if (result < 0) 619:dosfns.c **** { 620:dosfns.c **** /* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */ 621:dosfns.c **** /* if we allocated a share slot above, but open failed, free slot */ 622:dosfns.c **** if (sftp->sft_shroff >= 0) /* SHARE installed status can't change since check above */ 623:dosfns.c **** { 624:dosfns.c **** share_close_file(sftp->sft_shroff); 625:dosfns.c **** sftp->sft_shroff = -1; 626:dosfns.c **** } 627:dosfns.c **** /* /// End of additions for SHARE. - Ron Cemer */ 628:dosfns.c **** sftp->sft_count--; 629:dosfns.c **** return result; 630:dosfns.c **** } 631:dosfns.c **** return sft_idx | ((long)result << 16); 632:dosfns.c **** } 633:dosfns.c **** 634:dosfns.c **** long DosOpen(char FAR * fname, unsigned mode, unsigned attrib) 635:dosfns.c **** { 636:dosfns.c **** long result; 637:dosfns.c **** unsigned hndl; 638:dosfns.c **** 639:dosfns.c **** /* test if mode is in range */ 640:dosfns.c **** if ((mode & ~O_VALIDMASK) != 0) 641:dosfns.c **** return DE_INVLDACC; 642:dosfns.c **** 643:dosfns.c **** /* get a free handle */ 644:dosfns.c **** if ((result = get_free_hndl()) < 0) 645:dosfns.c **** return result; 646:dosfns.c **** hndl = (unsigned)result; 647:dosfns.c **** 648:dosfns.c **** result = DosOpenSft(fname, mode, attrib); 649:dosfns.c **** if (result < SUCCESS) 650:dosfns.c **** return result; 651:dosfns.c **** 652:dosfns.c **** ((psp FAR *)MK_FP(cu_psp, 0))->ps_filetab[hndl] = (UBYTE)result; 653:dosfns.c **** return hndl | (result & 0xffff0000l); 654:dosfns.c **** } 655:dosfns.c **** 656:dosfns.c **** COUNT CloneHandle(unsigned hndl) 657:dosfns.c **** { 658:dosfns.c **** /* now get the system file table entry */ 659:dosfns.c **** sft FAR *sftp = get_sft(hndl); 660:dosfns.c **** 661:dosfns.c **** if (sftp == (sft FAR *) -1 || (sftp->sft_mode & O_NOINHERIT)) 662:dosfns.c **** return DE_INVLDHNDL; 663:dosfns.c **** 664:dosfns.c **** /* now that we have the system file table entry, get the fnode */ 665:dosfns.c **** /* index, and increment the count, so that we've effectively */ 666:dosfns.c **** /* cloned the file. */ 667:dosfns.c **** sftp->sft_count += 1; 668:dosfns.c **** return SUCCESS; 669:dosfns.c **** } 670:dosfns.c **** 671:dosfns.c **** long DosDup(unsigned Handle) 672:dosfns.c **** { 673:dosfns.c **** long NewHandle; 674:dosfns.c **** 675:dosfns.c **** if ((NewHandle = get_free_hndl()) < 0) 676:dosfns.c **** return NewHandle; 677:dosfns.c **** 678:dosfns.c **** if (DosForceDup(Handle, (unsigned)NewHandle) < 0) 679:dosfns.c **** return DE_INVLDHNDL; 680:dosfns.c **** else 681:dosfns.c **** return NewHandle; 682:dosfns.c **** } 683:dosfns.c **** 684:dosfns.c **** COUNT DosForceDup(unsigned OldHandle, unsigned NewHandle) 685:dosfns.c **** { 686:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 687:dosfns.c **** sft FAR *Sftp; 688:dosfns.c **** 689:dosfns.c **** /* Get the SFT block that contains the SFT */ 690:dosfns.c **** if ((Sftp = get_sft(OldHandle)) == (sft FAR *) - 1) 691:dosfns.c **** return DE_INVLDHNDL; 692:dosfns.c **** 693:dosfns.c **** /* now close the new handle if it's open */ 694:dosfns.c **** if ((UBYTE) p->ps_filetab[NewHandle] != 0xff) 695:dosfns.c **** { 696:dosfns.c **** COUNT ret; 697:dosfns.c **** 698:dosfns.c **** if ((ret = DosClose(NewHandle)) != SUCCESS) 699:dosfns.c **** return ret; 700:dosfns.c **** } 701:dosfns.c **** 702:dosfns.c **** /* If everything looks ok, bump it up. */ 703:dosfns.c **** p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle]; 704:dosfns.c **** /* possible hazard: integer overflow ska*/ 705:dosfns.c **** Sftp->sft_count += 1; 706:dosfns.c **** return SUCCESS; 707:dosfns.c **** } 708:dosfns.c **** 709:dosfns.c **** COUNT DosCloseSft(int sft_idx, BOOL commitonly) 710:dosfns.c **** { 711:dosfns.c **** sft FAR *sftp = idx_to_sft(sft_idx); 712:dosfns.c **** int result; 713:dosfns.c **** 714:dosfns.c **** if (FP_OFF(sftp) == (size_t) - 1) 715:dosfns.c **** return DE_INVLDHNDL; 716:dosfns.c **** 717:dosfns.c **** lpCurSft = sftp; 718:dosfns.c **** /* 719:dosfns.c **** remote sub sft_count. 720:dosfns.c **** */ 721:dosfns.c **** if (sftp->sft_flags & SFT_FSHARED) 722:dosfns.c **** { 723:dosfns.c **** /* DebugPrintf(("closing SFT %d = %p\n",sft_idx,sftp)); */ 724:dosfns.c **** return network_redirector_fp(commitonly ? REM_FLUSH: REM_CLOSE, sftp); 725:dosfns.c **** } 726:dosfns.c **** 727:dosfns.c **** if (sftp->sft_flags & SFT_FDEVICE) 728:dosfns.c **** { 729:dosfns.c **** if (sftp->sft_dev->dh_attr & SFT_FOCRM) 730:dosfns.c **** { 731:dosfns.c **** /* if Open/Close/RM bit in driver's attribute is set 732:dosfns.c **** * then issue a Close request to the driver 733:dosfns.c **** */ 734:dosfns.c **** struct dhdr FAR *dev = sftp->sft_dev; 735:dosfns.c **** if (BinaryCharIO(&dev, 0, MK_FP(0x0000, 0x0000), C_CLOSE) != SUCCESS) 736:dosfns.c **** return DE_INVLDHNDL; 737:dosfns.c **** } 738:dosfns.c **** /* now just drop the count if a device */ 739:dosfns.c **** if (!commitonly) 740:dosfns.c **** sftp->sft_count -= 1; 741:dosfns.c **** return SUCCESS; 742:dosfns.c **** } 743:dosfns.c **** 744:dosfns.c **** /* else call file system handler */ 745:dosfns.c **** result = dos_close(sft_idx); 746:dosfns.c **** if (commitonly || result != SUCCESS) 747:dosfns.c **** return result; 748:dosfns.c **** 749:dosfns.c **** /* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */ 750:dosfns.c **** if (sftp->sft_count == 1 && IsShareInstalled(TRUE)) 751:dosfns.c **** { 752:dosfns.c **** if (sftp->sft_shroff >= 0) 753:dosfns.c **** share_close_file(sftp->sft_shroff); 754:dosfns.c **** sftp->sft_shroff = -1; 755:dosfns.c **** } 756:dosfns.c **** /* /// End of additions for SHARE. - Ron Cemer */ 757:dosfns.c **** sftp->sft_count -= 1; 758:dosfns.c **** return SUCCESS; 759:dosfns.c **** } 760:dosfns.c **** 761:dosfns.c **** COUNT DosClose(COUNT hndl) 762:dosfns.c **** { 763:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 764:dosfns.c **** int sft_idx = get_sft_idx(hndl); 765:dosfns.c **** 766:dosfns.c **** if (FP_OFF(idx_to_sft(sft_idx)) == (size_t) - 1) 767:dosfns.c **** return DE_INVLDHNDL; 768:dosfns.c **** 769:dosfns.c **** /* We must close the (valid) file handle before any critical error */ 770:dosfns.c **** /* may occur, else e.g. ABORT will try to close the file twice, */ 771:dosfns.c **** /* the second time after stdout is already closed */ 772:dosfns.c **** p->ps_filetab[hndl] = 0xff; 773:dosfns.c **** 774:dosfns.c **** /* Get the SFT block that contains the SFT */ 775:dosfns.c **** return DosCloseSft(sft_idx, FALSE); 776:dosfns.c **** } 777:dosfns.c **** 778:dosfns.c **** UWORD DosGetFree(UBYTE drive, UWORD * navc, UWORD * bps, UWORD * nc) 779:dosfns.c **** { 780:dosfns.c **** /* navc==NULL means: called from FatGetDrvData, fcbfns.c */ 781:dosfns.c **** struct dpb FAR *dpbp; 782:dosfns.c **** struct cds FAR *cdsp; 783:dosfns.c **** COUNT rg[5]; /* add space for SI, although it's unused here */ 784:dosfns.c **** UWORD spc; 785:dosfns.c **** 786:dosfns.c **** /* first check for valid drive */ 787:dosfns.c **** spc = -1; 788:dosfns.c **** cdsp = get_cds1(drive); 789:dosfns.c **** 790:dosfns.c **** if (cdsp == NULL) 791:dosfns.c **** return spc; 792:dosfns.c **** 793:dosfns.c **** current_ldt = cdsp; 794:dosfns.c **** if (cdsp->cdsFlags & CDSNETWDRV) 795:dosfns.c **** { 796:dosfns.c **** if (remote_getfree(cdsp, rg) != SUCCESS) 797:dosfns.c **** return spc; 798:dosfns.c **** 799:dosfns.c **** /* for int21/ah=1c: 800:dosfns.c **** Undoc DOS says, its not supported for 801:dosfns.c **** network drives. so it's probably OK */ 802:dosfns.c **** /* some programs such as RHIDE want it though and 803:dosfns.c **** the redirector can provide all info 804:dosfns.c **** - Bart, 2002 Apr 1 */ 805:dosfns.c **** 806:dosfns.c **** spc = rg[0]; 807:dosfns.c **** if (navc != NULL) 808:dosfns.c **** { 809:dosfns.c **** *navc = (COUNT) rg[3]; 810:dosfns.c **** spc &= 0xff; /* zero out media ID byte */ 811:dosfns.c **** } 812:dosfns.c **** 813:dosfns.c **** *nc = (COUNT) rg[1]; 814:dosfns.c **** *bps = (COUNT) rg[2]; 815:dosfns.c **** return spc; 816:dosfns.c **** } 817:dosfns.c **** 818:dosfns.c **** dpbp = cdsp->cdsDpb; 819:dosfns.c **** if (dpbp == NULL) 820:dosfns.c **** return spc; 821:dosfns.c **** 822:dosfns.c **** if (navc == NULL) 823:dosfns.c **** { 824:dosfns.c **** /* hazard: no error checking! */ 825:dosfns.c **** flush_buffers(dpbp->dpb_unit); 826:dosfns.c **** dpbp->dpb_flags = M_CHANGED; 827:dosfns.c **** } 828:dosfns.c **** 829:dosfns.c **** if (media_check(dpbp) < 0) 830:dosfns.c **** return spc; 831:dosfns.c **** /* get the data available from dpb */ 832:dosfns.c **** spc = (dpbp->dpb_clsmask + 1); 833:dosfns.c **** *bps = dpbp->dpb_secsize; 834:dosfns.c **** 835:dosfns.c **** /* now tell fs to give us free cluster */ 836:dosfns.c **** /* count */ 837:dosfns.c **** #ifdef WITHFAT32 838:dosfns.c **** if (ISFAT32(dpbp)) 839:dosfns.c **** { 840:dosfns.c **** ULONG cluster_size, ntotal, nfree; 841:dosfns.c **** 842:dosfns.c **** /* we shift ntotal until it is equal to or below 0xfff6 */ 843:dosfns.c **** cluster_size = (ULONG) dpbp->dpb_secsize << dpbp->dpb_shftcnt; 844:dosfns.c **** ntotal = dpbp->dpb_xsize - 1; 845:dosfns.c **** if (navc != NULL) 846:dosfns.c **** nfree = dos_free(dpbp); 847:dosfns.c **** while (ntotal > FAT_MAGIC16 && cluster_size < 0x8000) 848:dosfns.c **** { 849:dosfns.c **** cluster_size <<= 1; 850:dosfns.c **** spc <<= 1; 851:dosfns.c **** ntotal >>= 1; 852:dosfns.c **** nfree >>= 1; 853:dosfns.c **** } 854:dosfns.c **** /* get the data available from dpb */ 855:dosfns.c **** *nc = ntotal > FAT_MAGIC16 ? FAT_MAGIC16 : (UCOUNT) ntotal; 856:dosfns.c **** 857:dosfns.c **** /* now tell fs to give us free cluster */ 858:dosfns.c **** /* count */ 859:dosfns.c **** if (navc != NULL) 860:dosfns.c **** *navc = nfree > FAT_MAGIC16 ? FAT_MAGIC16 : (UCOUNT) nfree; 861:dosfns.c **** return spc; 862:dosfns.c **** } 863:dosfns.c **** #endif 864:dosfns.c **** /* a passed navc of NULL means: skip free; see FatGetDrvData 865:dosfns.c **** fcbfns.c */ 866:dosfns.c **** if (navc != NULL) 867:dosfns.c **** *navc = (COUNT) dos_free(dpbp); 868:dosfns.c **** *nc = dpbp->dpb_size - 1; 869:dosfns.c **** if (spc > 64) 870:dosfns.c **** { 871:dosfns.c **** /* fake for 64k clusters do confuse some DOS programs, but let 872:dosfns.c **** others work without overflowing */ 873:dosfns.c **** spc >>= 1; 874:dosfns.c **** if (navc != NULL) 875:dosfns.c **** *navc = ((unsigned)*navc < FAT_MAGIC16 / 2) ? 876:dosfns.c **** ((unsigned)*navc << 1) : FAT_MAGIC16; 877:dosfns.c **** *nc = ((unsigned)*nc < FAT_MAGIC16 / 2) ? ((unsigned)*nc << 1) : FAT_MAGIC16; 878:dosfns.c **** } 879:dosfns.c **** return spc; 880:dosfns.c **** } 881:dosfns.c **** 882:dosfns.c **** #ifdef WITHFAT32 883:dosfns.c **** #define IS_SLASH(ch) (ch == '\\' || ch == '/') 884:dosfns.c **** COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp) 885:dosfns.c **** { 886:dosfns.c **** struct dpb FAR *dpbp; 887:dosfns.c **** struct cds FAR *cdsp; 888:dosfns.c **** UCOUNT rg[5]; 889:dosfns.c **** 890:dosfns.c **** /* ensure all fields known value - clear reserved bytes & set xfs_version.actual to 0 */ 891:dosfns.c **** fmemset(xfsp, 0, sizeof(struct xfreespace)); 892:dosfns.c **** xfsp->xfs_datasize = sizeof(struct xfreespace); 893:dosfns.c **** 894:dosfns.c **** /* 895:dosfns.c **** DriveString should be in form of "C:", "C:\", "\", "", ., or .\ 896:dosfns.c **** where missing drive is treated as a request for the current drive, 897:dosfns.c **** or network name in form "\\SERVER\share" 898:dosfns.c **** however, network names like \\SERVER\C aren't supported yet 899:dosfns.c **** */ 900:dosfns.c **** cdsp = NULL; 901:dosfns.c **** if ( !*DriveString || (*DriveString == '.') || (IS_SLASH(DriveString[0]) && !IS_SLASH(DriveString 902:dosfns.c **** cdsp = get_cds(default_drive); /* if "" or .[\] or \[path] then use current drive */ 903:dosfns.c **** else if (DriveString[1] == ':') 904:dosfns.c **** cdsp = get_cds(DosUpFChar(*DriveString) - 'A'); /* assume drive specified */ 905:dosfns.c **** 906:dosfns.c **** if (cdsp == NULL) /* either error, really bad string, or network name */ 907:dosfns.c **** return DE_INVLDDRV; 908:dosfns.c **** 909:dosfns.c **** if (cdsp->cdsFlags & CDSNETWDRV) 910:dosfns.c **** { 911:dosfns.c **** /* Try redirector extension */ 912:dosfns.c **** if (remote_getfree_11a3(cdsp, rg) != SUCCESS) 913:dosfns.c **** { 914:dosfns.c **** /* Fallback */ 915:dosfns.c **** if (remote_getfree(cdsp, rg) != SUCCESS) 916:dosfns.c **** return DE_INVLDDRV; 917:dosfns.c **** 918:dosfns.c **** xfsp->xfs_clussize = rg[0]; 919:dosfns.c **** xfsp->xfs_totalclusters = rg[1]; 920:dosfns.c **** xfsp->xfs_secsize = rg[2]; 921:dosfns.c **** xfsp->xfs_freeclusters = rg[3]; 922:dosfns.c **** } 923:dosfns.c **** else /* Supports extension */ 924:dosfns.c **** { 925:dosfns.c **** UDWORD total, avail; 926:dosfns.c **** UDWORD bps, spc; 927:dosfns.c **** 928:dosfns.c **** bps = rg[4]; 929:dosfns.c **** spc = 1; 930:dosfns.c **** total = (((UDWORD)rg[0] << 16UL) | rg[1]); 931:dosfns.c **** avail = (((UDWORD)rg[2] << 16UL) | rg[3]); 932:dosfns.c **** 933:dosfns.c **** while (total > 0x00ffffffUL && spc < 128) { 934:dosfns.c **** spc *= 2; 935:dosfns.c **** avail /= 2; 936:dosfns.c **** total /= 2; 937:dosfns.c **** } 938:dosfns.c **** while (total > 0x00ffffffUL && bps < 32768UL) { 939:dosfns.c **** bps *= 2; 940:dosfns.c **** avail /= 2; 941:dosfns.c **** total /= 2; 942:dosfns.c **** } 943:dosfns.c **** 944:dosfns.c **** xfsp->xfs_secsize = bps; 945:dosfns.c **** xfsp->xfs_clussize = spc; 946:dosfns.c **** xfsp->xfs_totalclusters = total; 947:dosfns.c **** xfsp->xfs_freeclusters = avail; 948:dosfns.c **** } 949:dosfns.c **** } 950:dosfns.c **** else 951:dosfns.c **** { 952:dosfns.c **** dpbp = cdsp->cdsDpb; 953:dosfns.c **** if (dpbp == NULL || media_check(dpbp) < 0) 954:dosfns.c **** return DE_INVLDDRV; 955:dosfns.c **** xfsp->xfs_secsize = dpbp->dpb_secsize; 956:dosfns.c **** xfsp->xfs_totalclusters = 957:dosfns.c **** (ISFAT32(dpbp) ? dpbp->dpb_xsize : dpbp->dpb_size) - 1; 958:dosfns.c **** xfsp->xfs_freeclusters = dos_free(dpbp); 959:dosfns.c **** xfsp->xfs_clussize = dpbp->dpb_clsmask + 1; 960:dosfns.c **** } 961:dosfns.c **** xfsp->xfs_totalunits = xfsp->xfs_totalclusters; 962:dosfns.c **** xfsp->xfs_freeunits = xfsp->xfs_freeclusters; 963:dosfns.c **** xfsp->xfs_totalsectors = xfsp->xfs_totalclusters * xfsp->xfs_clussize; 964:dosfns.c **** xfsp->xfs_freesectors = xfsp->xfs_freeclusters * xfsp->xfs_clussize; 965:dosfns.c **** xfsp->xfs_datasize = sizeof(struct xfreespace); 966:dosfns.c **** 967:dosfns.c **** return SUCCESS; 968:dosfns.c **** } 969:dosfns.c **** #endif 970:dosfns.c **** 971:dosfns.c **** COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s) 972:dosfns.c **** { 973:dosfns.c **** char path[3]; 974:dosfns.c **** 975:dosfns.c **** if (drive-- == 0) /* get default drive or convert to 0 = A:, 1 = B:, ... */ 976:dosfns.c **** drive = default_drive; 977:dosfns.c **** path[0] = 'A' + (drive & 0x1f); 978:dosfns.c **** path[1] = ':'; 979:dosfns.c **** path[2] = '\0'; 980:dosfns.c **** 981:dosfns.c **** if (truename(path, PriPathName, CDS_MODE_SKIP_PHYSICAL) < SUCCESS) 982:dosfns.c **** return DE_INVLDDRV; 983:dosfns.c **** 984:dosfns.c **** /* skip d:\ */ 985:dosfns.c **** fstrcpy(s, PriPathName + 3); 986:dosfns.c **** return SUCCESS; 987:dosfns.c **** } 988:dosfns.c **** 989:dosfns.c **** #undef CHDIR_DEBUG 990:dosfns.c **** COUNT DosChangeDir(BYTE FAR * s) 991:dosfns.c **** { 992:dosfns.c **** COUNT result; 993:dosfns.c **** 994:dosfns.c **** result = truename(s, PriPathName, CDS_MODE_CHECK_DEV_PATH); 995:dosfns.c **** if (result < SUCCESS) 996:dosfns.c **** return DE_PATHNOTFND; 997:dosfns.c **** 998:dosfns.c **** set_fcbname(); 999:dosfns.c **** 1000:dosfns.c **** if ((FP_OFF(current_ldt) != 0xFFFF) && 1001:dosfns.c **** (strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath))) 1002:dosfns.c **** return DE_PATHNOTFND; 1003:dosfns.c **** 1004:dosfns.c **** #if defined(CHDIR_DEBUG) 1005:dosfns.c **** DebugPrintf(("Remote Chdir: n='%Fs' p='%Fs\n", s, PriPathName)); 1006:dosfns.c **** #endif 1007:dosfns.c **** /* now get fs to change to new */ 1008:dosfns.c **** /* directory */ 1009:dosfns.c **** result = (result & IS_NETWORK ? network_redirector(REM_CHDIR) : 1010:dosfns.c **** dos_cd(PriPathName)); 1011:dosfns.c **** #if defined(CHDIR_DEBUG) 1012:dosfns.c **** DebugPrintf(("status = %04x, new_path='%Fs'\n", result, cdsd->cdsCurrentPath)); 1013:dosfns.c **** #endif 1014:dosfns.c **** if (result != SUCCESS) 1015:dosfns.c **** return result; 1016:dosfns.c **** /* 1017:dosfns.c **** Copy the path to the current directory 1018:dosfns.c **** structure. 1019:dosfns.c **** 1020:dosfns.c **** Some redirectors do not write back to the CDS. 1021:dosfns.c **** SHSUCdX needs this. jt 1022:dosfns.c **** */ 1023:dosfns.c **** if (FP_OFF(current_ldt) != 0xFFFF) 1024:dosfns.c **** { 1025:dosfns.c **** fstrcpy(current_ldt->cdsCurrentPath, PriPathName); 1026:dosfns.c **** if (PriPathName[7] == 0) 1027:dosfns.c **** current_ldt->cdsCurrentPath[8] = 0; /* Need two Zeros at the end */ 1028:dosfns.c **** } 1029:dosfns.c **** return SUCCESS; 1030:dosfns.c **** } 1031:dosfns.c **** 1032:dosfns.c **** STATIC int pop_dmp(int rc, dmatch FAR * dmp) 52 .loc 1 1032 0 53 _.LVL3: 0 00002F49 56 push si 0 00002F4A 57 push di 0 00002F4B 55 push bp 57 _.LCFI6: 0 00002F4C 89E5 mov bp, sp 59 _.LCFI7: 0 00002F4E 1E push ds 0 00002F4F 8B5E08 mov bx, word ptr [bp+8] 0 00002F52 8B760A mov si, word ptr [bp+10] 63 _.LVL4: 1033:dosfns.c **** { 1034:dosfns.c **** dta = dmp; 1035:dosfns.c **** if (rc == SUCCESS) 1036:dosfns.c **** { 1037:dosfns.c **** fmemcpy(dta, &sda_tmp_dm, 21); 64 .loc 1 1037 0 0 00002F55 B81500 mov ax, 21 0 00002F58 50 push ax 0 00002F59 16 push ss 0 00002F5A B8[0000] mov ax, offset _sda_tmp_dm 0 00002F5D 50 push ax 0 00002F5E 56 push si 0 00002F5F 53 push bx 0 00002F60 895EFE mov word ptr [bp-2], bx 0 00002F63 E8[FEFF] call _fmemcpy 74 _.LVL5: 1038:dosfns.c **** dmp->dm_attr_fnd = (BYTE) SearchDir.dir_attrib; 75 .loc 1 1038 0 0 00002F66 BF[0000] mov di, offset _SearchDir 0 00002F69 8A450B mov al, byte ptr [di+11] 0 00002F6C 8EC6 mov es, si 0 00002F6E 8B5EFE mov bx, word ptr [bp-2] 0 00002F71 26884715 mov byte ptr es:[bx+21], al 81 _.LVL6: 1039:dosfns.c **** dmp->dm_time = SearchDir.dir_time; 82 .loc 1 1039 0 0 00002F75 8B4516 mov ax, word ptr [di+22] 0 00002F78 26894716 mov word ptr es:[bx+22], ax 1040:dosfns.c **** dmp->dm_date = SearchDir.dir_date; 85 .loc 1 1040 0 0 00002F7C 8B4518 mov ax, word ptr [di+24] 0 00002F7F 26894718 mov word ptr es:[bx+24], ax 1041:dosfns.c **** dmp->dm_size = (LONG) SearchDir.dir_size; 88 .loc 1 1041 0 0 00002F83 8B451C mov ax, word ptr [di+28] 0 00002F86 8B551E mov dx, word ptr [di+30] 0 00002F89 2689471A mov word ptr es:[bx+26], ax 0 00002F8D 2689571C mov word ptr es:[bx+28], dx 1042:dosfns.c **** ConvertName83ToNameSZ(dmp->dm_name, (BYTE FAR *) SearchDir.dir_name); 93 .loc 1 1042 0 0 00002F91 16 push ss 0 00002F92 57 push di 0 00002F93 83C31E add bx, 30 0 00002F96 56 push si 0 00002F97 53 push bx 0 00002F98 E8[FEFF] call _ConvertName83ToNameSZ 100 _.LVL7: 1043:dosfns.c **** } 1044:dosfns.c **** return rc; 1045:dosfns.c **** } 101 .loc 1 1045 0 0 00002F9B 89EC mov sp, bp 0 00002F9D 5D pop bp 0 00002F9E 5F pop di 0 00002F9F 5E pop si 0 00002FA0 C20400 ret 4 107 _.LFE50: 108 .size _pop_dmp.part.0, .-_pop_dmp.part.0 109 .type _IsShareInstalled.part.1, @function 110 _IsShareInstalled.part.1: 111 _.LFB51: 1046:dosfns.c **** 1047:dosfns.c **** COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name) 1048:dosfns.c **** { 1049:dosfns.c **** int rc; 1050:dosfns.c **** register dmatch FAR *dmp = dta; 1051:dosfns.c **** 1052:dosfns.c **** rc = truename(name, PriPathName, 1053:dosfns.c **** CDS_MODE_CHECK_DEV_PATH | CDS_MODE_ALLOW_WILDCARDS); 1054:dosfns.c **** if (rc < SUCCESS) 1055:dosfns.c **** return rc; 1056:dosfns.c **** 1057:dosfns.c **** set_fcbname(); 1058:dosfns.c **** 1059:dosfns.c **** /* /// Added code here to do matching against device names. 1060:dosfns.c **** DOS findfirst will match exact device names if the 1061:dosfns.c **** filename portion (excluding the extension) contains 1062:dosfns.c **** a valid device name. 1063:dosfns.c **** Credits: some of this code was ripped off from truename() 1064:dosfns.c **** in newstuff.c. 1065:dosfns.c **** - Ron Cemer */ 1066:dosfns.c **** 1067:dosfns.c **** SAttr = (BYTE) attr; 1068:dosfns.c **** 1069:dosfns.c **** #if defined(FIND_DEBUG) 1070:dosfns.c **** DebugPrintf(("Remote Find: n='%Fs\n", PriPathName)); 1071:dosfns.c **** #endif 1072:dosfns.c **** 1073:dosfns.c **** dta = &sda_tmp_dm; 1074:dosfns.c **** memset(&sda_tmp_dm, 0, sizeof(dmatch)+sizeof(struct dirent)); 1075:dosfns.c **** 1076:dosfns.c **** if (rc & IS_NETWORK) 1077:dosfns.c **** rc = network_redirector_fp(REM_FINDFIRST, current_ldt); 1078:dosfns.c **** else if (rc & IS_DEVICE) 1079:dosfns.c **** { 1080:dosfns.c **** const char *p; 1081:dosfns.c **** COUNT i; 1082:dosfns.c **** 1083:dosfns.c **** /* make sure the next search fails */ 1084:dosfns.c **** sda_tmp_dm.dm_entry = 0xffff; 1085:dosfns.c **** /* Found a matching device. Hence there cannot be wildcards. */ 1086:dosfns.c **** SearchDir.dir_attrib = D_DEVICE; 1087:dosfns.c **** SearchDir.dir_time = dos_gettime(); 1088:dosfns.c **** SearchDir.dir_date = dos_getdate(); 1089:dosfns.c **** p = (char *)FP_OFF(get_root(PriPathName)); 1090:dosfns.c **** memset(SearchDir.dir_name, ' ', FNAME_SIZE + FEXT_SIZE); 1091:dosfns.c **** for (i = 0; i < FNAME_SIZE && *p && *p != '.'; i++) 1092:dosfns.c **** SearchDir.dir_name[i] = *p++; 1093:dosfns.c **** rc = SUCCESS; 1094:dosfns.c **** /* /// End of additions. - Ron Cemer ; heavily edited - Bart Oldeman */ 1095:dosfns.c **** } 1096:dosfns.c **** else 1097:dosfns.c **** rc = dos_findfirst(attr, PriPathName); 1098:dosfns.c **** 1099:dosfns.c **** return pop_dmp(rc, dmp); 1100:dosfns.c **** } 1101:dosfns.c **** 1102:dosfns.c **** COUNT DosFindNext(void) 1103:dosfns.c **** { 1104:dosfns.c **** COUNT rc; 1105:dosfns.c **** register dmatch FAR *dmp = dta; 1106:dosfns.c **** 1107:dosfns.c **** /* 1108:dosfns.c **** * The new version of SHSUCDX 1.0 looks at the dm_drive byte to 1109:dosfns.c **** * test 40h. I used RamView to see location MSD 116:04be and 1110:dosfns.c **** * FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4. 1111:dosfns.c **** * Ralf Brown docs for dos 4eh say bit 7 set == remote so what is 1112:dosfns.c **** * bit 6 for? 1113:dosfns.c **** * SHSUCDX Mod info say "test redir not network bit". 1114:dosfns.c **** * Just to confuse the rest, MSCDEX sets bit 5 too. 1115:dosfns.c **** * 1116:dosfns.c **** * So, assume bit 6 is redirector and bit 7 is network. 1117:dosfns.c **** * jt 1118:dosfns.c **** * Bart: dm_drive can be the drive _letter_. 1119:dosfns.c **** * but better just stay independent of it: we only use 1120:dosfns.c **** * bit 7 to detect a network drive; the rest untouched. 1121:dosfns.c **** * RBIL says that findnext can only return one error type anyway 1122:dosfns.c **** * (12h, DE_NFILES) 1123:dosfns.c **** */ 1124:dosfns.c **** #if 0 1125:dosfns.c **** DebugPrintf(("findnext: %d\n", dmp->dm_drive)); 1126:dosfns.c **** #endif 1127:dosfns.c **** fmemcpy(&sda_tmp_dm, dmp, 21); 1128:dosfns.c **** 1129:dosfns.c **** /* findnext will always fail on a volume id search or device name */ 1130:dosfns.c **** if ((sda_tmp_dm.dm_attr_srch & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID 1131:dosfns.c **** || (!(sda_tmp_dm.dm_drive & 0x80) && sda_tmp_dm.dm_entry == 0xffff)) 1132:dosfns.c **** return DE_NFILES; 1133:dosfns.c **** 1134:dosfns.c **** memset(&SearchDir, 0, sizeof(struct dirent)); 1135:dosfns.c **** dta = &sda_tmp_dm; 1136:dosfns.c **** rc = (sda_tmp_dm.dm_drive & 0x80) ? 1137:dosfns.c **** network_redirector_fp(REM_FINDNEXT, &sda_tmp_dm) : dos_findnext(); 1138:dosfns.c **** 1139:dosfns.c **** return pop_dmp(rc, dmp); 1140:dosfns.c **** } 1141:dosfns.c **** 1142:dosfns.c **** COUNT DosGetFtime(COUNT hndl, ddate * dp, dtime * tp) 1143:dosfns.c **** { 1144:dosfns.c **** sft FAR *s; 1145:dosfns.c **** /*sfttbl FAR *sp;*/ 1146:dosfns.c **** 1147:dosfns.c **** /* Get the SFT block that contains the SFT */ 1148:dosfns.c **** if (FP_OFF(s = get_sft(hndl)) == (size_t) - 1) 1149:dosfns.c **** return DE_INVLDHNDL; 1150:dosfns.c **** 1151:dosfns.c **** *dp = s->sft_date; 1152:dosfns.c **** *tp = s->sft_time; 1153:dosfns.c **** return SUCCESS; 1154:dosfns.c **** } 1155:dosfns.c **** 1156:dosfns.c **** COUNT DosSetFtimeSft(int sft_idx, ddate dp, dtime tp) 1157:dosfns.c **** { 1158:dosfns.c **** /* Get the SFT block that contains the SFT */ 1159:dosfns.c **** sft FAR *s = idx_to_sft(sft_idx); 1160:dosfns.c **** 1161:dosfns.c **** if (FP_OFF(s) == (size_t) - 1) 1162:dosfns.c **** return DE_INVLDHNDL; 1163:dosfns.c **** 1164:dosfns.c **** /* If SFT entry refers to a device, do nothing */ 1165:dosfns.c **** if (s->sft_flags & SFT_FDEVICE) 1166:dosfns.c **** return SUCCESS; 1167:dosfns.c **** 1168:dosfns.c **** s->sft_flags |= SFT_FDATE; 1169:dosfns.c **** s->sft_date = dp; 1170:dosfns.c **** s->sft_time = tp; 1171:dosfns.c **** 1172:dosfns.c **** return SUCCESS; 1173:dosfns.c **** } 1174:dosfns.c **** 1175:dosfns.c **** COUNT DosGetFattr(BYTE FAR * name) 1176:dosfns.c **** { 1177:dosfns.c **** COUNT result; 1178:dosfns.c **** 1179:dosfns.c **** result = truename(name, PriPathName, CDS_MODE_CHECK_DEV_PATH); 1180:dosfns.c **** if (result < SUCCESS) 1181:dosfns.c **** return result; 1182:dosfns.c **** 1183:dosfns.c **** /* /// Added check for "d:\", which returns 0x10 (subdirectory) under DOS. 1184:dosfns.c **** - Ron Cemer */ 1185:dosfns.c **** /* Theoretically: If the redirectory's qualify function 1186:dosfns.c **** doesn't return nonsense this check can be reduced to 1187:dosfns.c **** PriPathname[3] == 0, because local path names always 1188:dosfns.c **** have the three-byte string ?:\ and UNC path shouldn't 1189:dosfns.c **** validy consist of just two slashes. 1190:dosfns.c **** -- 2001/09/03 ska*/ 1191:dosfns.c **** 1192:dosfns.c **** if (PriPathName[3] == '\0') 1193:dosfns.c **** return 0x10; 1194:dosfns.c **** 1195:dosfns.c **** set_fcbname(); 1196:dosfns.c **** 1197:dosfns.c **** if (result & IS_NETWORK) 1198:dosfns.c **** return network_redirector(REM_GETATTRZ); 1199:dosfns.c **** 1200:dosfns.c **** if (result & IS_DEVICE) 1201:dosfns.c **** return DE_FILENOTFND; 1202:dosfns.c **** 1203:dosfns.c **** return dos_getfattr(PriPathName); 1204:dosfns.c **** } 1205:dosfns.c **** 1206:dosfns.c **** /* This function is almost identical to DosGetFattr(). 1207:dosfns.c **** Maybe it is nice to join both functions. 1208:dosfns.c **** -- 2001/09/03 ska*/ 1209:dosfns.c **** COUNT DosSetFattr(BYTE FAR * name, UWORD attrp) 1210:dosfns.c **** { 1211:dosfns.c **** COUNT result; 1212:dosfns.c **** 1213:dosfns.c **** result = truename(name, PriPathName, CDS_MODE_CHECK_DEV_PATH); 1214:dosfns.c **** if (result < SUCCESS) 1215:dosfns.c **** return result; 1216:dosfns.c **** 1217:dosfns.c **** set_fcbname(); 1218:dosfns.c **** 1219:dosfns.c **** if (result & IS_NETWORK) 1220:dosfns.c **** return remote_setfattr(attrp); 1221:dosfns.c **** 1222:dosfns.c **** if (result & IS_DEVICE) 1223:dosfns.c **** return DE_FILENOTFND; 1224:dosfns.c **** 1225:dosfns.c **** DebugPrintf(("DosSetFattr(%s)\n", name)); 1226:dosfns.c **** if (IsShareInstalled(TRUE)) 1227:dosfns.c **** { 1228:dosfns.c **** /* SHARE closes the file if it is opened in 1229:dosfns.c **** * compatibility mode, else generate a critical error. 1230:dosfns.c **** * Here generate a critical error by opening in "rw compat" mode */ 1231:dosfns.c **** if ((result = share_open_check(PriPathName, cu_psp, O_RDWR, 0)) < 0) 1232:dosfns.c **** return result; 1233:dosfns.c **** /* else dos_setfattr will close the file */ 1234:dosfns.c **** share_close_file(result); 1235:dosfns.c **** } 1236:dosfns.c **** return dos_setfattr(PriPathName, attrp); 1237:dosfns.c **** } 1238:dosfns.c **** 1239:dosfns.c **** UBYTE DosSelectDrv(UBYTE drv) 1240:dosfns.c **** { 1241:dosfns.c **** current_ldt = get_cds(drv); 1242:dosfns.c **** 1243:dosfns.c **** if (current_ldt != NULL) 1244:dosfns.c **** default_drive = drv; 1245:dosfns.c **** 1246:dosfns.c **** return lastdrive; 1247:dosfns.c **** } 1248:dosfns.c **** 1249:dosfns.c **** COUNT DosDelete(BYTE FAR * path, int attrib) 1250:dosfns.c **** { 1251:dosfns.c **** COUNT result; 1252:dosfns.c **** 1253:dosfns.c **** result = truename(path, PriPathName, CDS_MODE_CHECK_DEV_PATH); 1254:dosfns.c **** if (result < SUCCESS) 1255:dosfns.c **** return result; 1256:dosfns.c **** 1257:dosfns.c **** set_fcbname(); 1258:dosfns.c **** 1259:dosfns.c **** if (result & IS_NETWORK) 1260:dosfns.c **** return network_redirector(REM_DELETE); 1261:dosfns.c **** 1262:dosfns.c **** if (result & IS_DEVICE) 1263:dosfns.c **** return DE_FILENOTFND; 1264:dosfns.c **** 1265:dosfns.c **** if (IsShareInstalled(TRUE) && share_is_file_open(PriPathName)) 1266:dosfns.c **** return DE_ACCESS; 1267:dosfns.c **** 1268:dosfns.c **** return dos_delete(PriPathName, attrib); 1269:dosfns.c **** } 1270:dosfns.c **** 1271:dosfns.c **** COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib) 1272:dosfns.c **** { 1273:dosfns.c **** if (path1[0] != path2[0]) 1274:dosfns.c **** { 1275:dosfns.c **** return DE_DEVICE; /* not same device */ 1276:dosfns.c **** } 1277:dosfns.c **** if (FP_OFF(current_ldt) == 0xFFFF || (current_ldt->cdsFlags & CDSNETWDRV)) 1278:dosfns.c **** return network_redirector(REM_RENAME); 1279:dosfns.c **** 1280:dosfns.c **** if (IsShareInstalled(TRUE) && share_is_file_open(path1)) 1281:dosfns.c **** return DE_ACCESS; 1282:dosfns.c **** 1283:dosfns.c **** return dos_rename(path1, path2, attrib); 1284:dosfns.c **** } 1285:dosfns.c **** 1286:dosfns.c **** COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2) 1287:dosfns.c **** { 1288:dosfns.c **** COUNT result; 1289:dosfns.c **** 1290:dosfns.c **** result = truename(path2, SecPathName, CDS_MODE_CHECK_DEV_PATH); 1291:dosfns.c **** if (result < SUCCESS) 1292:dosfns.c **** return result; 1293:dosfns.c **** 1294:dosfns.c **** if ((result & (IS_NETWORK | IS_DEVICE)) == IS_DEVICE) 1295:dosfns.c **** return DE_FILENOTFND; 1296:dosfns.c **** 1297:dosfns.c **** result = truename(path1, PriPathName, CDS_MODE_CHECK_DEV_PATH); 1298:dosfns.c **** if (result < SUCCESS) 1299:dosfns.c **** return result; 1300:dosfns.c **** 1301:dosfns.c **** set_fcbname(); 1302:dosfns.c **** 1303:dosfns.c **** if ((result & (IS_NETWORK | IS_DEVICE)) == IS_DEVICE) 1304:dosfns.c **** return DE_FILENOTFND; 1305:dosfns.c **** 1306:dosfns.c **** return DosRenameTrue(PriPathName, SecPathName, D_ALL); 1307:dosfns.c **** } 1308:dosfns.c **** 1309:dosfns.c **** COUNT DosMkRmdir(const char FAR * dir, int action) 1310:dosfns.c **** { 1311:dosfns.c **** COUNT result; 1312:dosfns.c **** 1313:dosfns.c **** result = truename(dir, PriPathName, CDS_MODE_CHECK_DEV_PATH); 1314:dosfns.c **** if (result < SUCCESS) 1315:dosfns.c **** return result; 1316:dosfns.c **** 1317:dosfns.c **** set_fcbname(); 1318:dosfns.c **** 1319:dosfns.c **** if (result & IS_NETWORK) 1320:dosfns.c **** return network_redirector(action == 0x39 ? REM_MKDIR : REM_RMDIR); 1321:dosfns.c **** 1322:dosfns.c **** if (result & IS_DEVICE) 1323:dosfns.c **** return DE_ACCESS; 1324:dosfns.c **** 1325:dosfns.c **** return (action == 0x39 ? dos_mkdir : dos_rmdir)(PriPathName); 1326:dosfns.c **** } 1327:dosfns.c **** 1328:dosfns.c **** /* /// Added for SHARE. - Ron Cemer */ 1329:dosfns.c **** 1330:dosfns.c **** COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock) 1331:dosfns.c **** { 1332:dosfns.c **** sft FAR *s; 1333:dosfns.c **** 1334:dosfns.c **** /* Get the SFT block that contains the SFT */ 1335:dosfns.c **** if (FP_OFF(s = get_sft(hndl)) == (size_t) - 1) 1336:dosfns.c **** return DE_INVLDHNDL; 1337:dosfns.c **** 1338:dosfns.c **** if (s->sft_flags & SFT_FSHARED) 1339:dosfns.c **** return remote_lock_unlock(s, pos, len, unlock); 1340:dosfns.c **** 1341:dosfns.c **** /* Invalid function unless SHARE is installed or remote. */ 1342:dosfns.c **** if (!IsShareInstalled(FALSE)) 1343:dosfns.c **** return DE_INVLDFUNC; 1344:dosfns.c **** 1345:dosfns.c **** /* Lock violation if this SFT entry does not support locking. */ 1346:dosfns.c **** if (s->sft_shroff < 0) 1347:dosfns.c **** return DE_LOCK; 1348:dosfns.c **** 1349:dosfns.c **** /* Let SHARE do the work. */ 1350:dosfns.c **** return share_lock_unlock(cu_psp, s->sft_shroff, pos, len, unlock); 1351:dosfns.c **** } 1352:dosfns.c **** 1353:dosfns.c **** /* /// End of additions for SHARE. - Ron Cemer */ 1354:dosfns.c **** 1355:dosfns.c **** /* 1356:dosfns.c **** * This seems to work well. 1357:dosfns.c **** */ 1358:dosfns.c **** 1359:dosfns.c **** /* check for a device 1360:dosfns.c **** returns device header if match, else returns NULL 1361:dosfns.c **** can only match character devices (as only they have names) 1362:dosfns.c **** */ 1363:dosfns.c **** struct dhdr FAR *IsDevice(const char FAR * fname) 1364:dosfns.c **** { 1365:dosfns.c **** struct dhdr FAR *dhp; 1366:dosfns.c **** const char FAR *froot = get_root(fname); 1367:dosfns.c **** int i; 1368:dosfns.c **** 1369:dosfns.c **** /* /// BUG!!! This is absolutely wrong. A filename of "NUL.LST" must be 1370:dosfns.c **** treated EXACTLY the same as a filename of "NUL". The existence or 1371:dosfns.c **** content of the extension is irrelevent in determining whether a 1372:dosfns.c **** filename refers to a device. 1373:dosfns.c **** - Ron Cemer 1374:dosfns.c **** // if we have an extension, can't be a device <--- WRONG. 1375:dosfns.c **** if (*froot != '.') 1376:dosfns.c **** { 1377:dosfns.c **** */ 1378:dosfns.c **** 1379:dosfns.c **** /* BUGFIX: MSCD000<00> should be handled like MSCD000<20> TE 1380:dosfns.c **** ie the 8 character device name may be padded with spaces ' ' or NULs '\0' 1381:dosfns.c **** 1382:dosfns.c **** Note: fname is assumed an ASCIIZ string (ie not padded, unknown length) 1383:dosfns.c **** but the name in the device header is assumed FNAME_SIZE and padded. KJD 1384:dosfns.c **** */ 1385:dosfns.c **** 1386:dosfns.c **** 1387:dosfns.c **** /* check for names that will never be devices to avoid checking all device headers. 1388:dosfns.c **** only the file name (not path nor extension) need be checked, "" == root or empty name 1389:dosfns.c **** */ 1390:dosfns.c **** if ( (*froot == '\0') || 1391:dosfns.c **** ((*froot=='.') && ((*(froot+1)=='\0') || (*(froot+2)=='\0' && *(froot+1)=='.'))) 1392:dosfns.c **** ) 1393:dosfns.c **** { 1394:dosfns.c **** return NULL; 1395:dosfns.c **** } 1396:dosfns.c **** 1397:dosfns.c **** /* cycle through all device headers checking for match */ 1398:dosfns.c **** for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; 1399:dosfns.c **** dhp = dhp->dh_next) 1400:dosfns.c **** { 1401:dosfns.c **** if (!(dhp->dh_attr & ATTR_CHAR)) /* if this is block device, skip */ 1402:dosfns.c **** continue; 1403:dosfns.c **** 1404:dosfns.c **** for (i = 0; i < FNAME_SIZE; i++) 1405:dosfns.c **** { 1406:dosfns.c **** unsigned char c1 = (unsigned char)froot[i]; 1407:dosfns.c **** /* ignore extensions and handle filenames shorter than FNAME_SIZE */ 1408:dosfns.c **** if (c1 == '.' || c1 == '\0') 1409:dosfns.c **** { 1410:dosfns.c **** /* check if remainder of device name consists of spaces or nulls */ 1411:dosfns.c **** for (; i < FNAME_SIZE; i++) 1412:dosfns.c **** { 1413:dosfns.c **** unsigned char c2 = dhp->dh_name[i]; 1414:dosfns.c **** if (c2 != ' ' && c2 != '\0') 1415:dosfns.c **** break; 1416:dosfns.c **** } 1417:dosfns.c **** break; 1418:dosfns.c **** } 1419:dosfns.c **** if (DosUpFChar(c1) != DosUpFChar(dhp->dh_name[i])) 1420:dosfns.c **** break; 1421:dosfns.c **** } 1422:dosfns.c **** 1423:dosfns.c **** /* if found a match then return device header */ 1424:dosfns.c **** if (i == FNAME_SIZE) 1425:dosfns.c **** return dhp; 1426:dosfns.c **** } 1427:dosfns.c **** 1428:dosfns.c **** return NULL; 1429:dosfns.c **** } 1430:dosfns.c **** 1431:dosfns.c **** /* /// Added for SHARE. - Ron Cemer */ 1432:dosfns.c **** /* Eric 8/2008: only re-check (2f.1000) on open/close, not on each access */ 1433:dosfns.c **** 1434:dosfns.c **** BOOL IsShareInstalled(BOOL recheck) 112 .loc 1 1434 0 113 _.LVL8: 1435:dosfns.c **** { 1436:dosfns.c **** extern unsigned char ASMPASCAL share_check(void); 1437:dosfns.c **** /*DebugPrintf(("Share_check at %p and share_installed at %p\n", (void far *)&share_check, (void f 1438:dosfns.c **** if (recheck == FALSE) 1439:dosfns.c **** return share_installed; 1440:dosfns.c **** if (share_check() == 0xff) 114 .loc 1 1440 0 0 00002FA3 E8[FEFF] call _share_check 116 _.LVL9: 1441:dosfns.c **** share_installed = TRUE; 117 .loc 1 1441 0 0 00002FA6 3CFF cmp al, -1 0 00002FA8 18C0 sbb al, al 0 00002FAA FEC0 inc al 0 00002FAC A2[0000] mov byte ptr [_share_installed], al 1442:dosfns.c **** else 1443:dosfns.c **** share_installed = FALSE; 1444:dosfns.c **** return share_installed; 122 .loc 1 1444 0 0 00002FAF 98 cbw 1445:dosfns.c **** } 124 .loc 1 1445 0 0 00002FB0 C3 ret 126 _.LFE51: 127 .size _IsShareInstalled.part.1, .-_IsShareInstalled.part.1 128 .global _get_cds_unvalidated 129 .type _get_cds_unvalidated, @function 130 _get_cds_unvalidated: 131 _.LFB4: 105:dosfns.c **** if (drive >= lastdrive) 132 .loc 1 105 0 133 _.LVL10: 0 00002FB1 89E3 mov bx, sp 135 _.LCFI8: 0 00002FB3 8B4702 mov ax, word ptr [bx+2] 106:dosfns.c **** return NULL; 137 .loc 1 106 0 0 00002FB6 8A16[0000] mov dl, byte ptr [_lastdrive] 0 00002FBA 30F6 xor dh, dh 0 00002FBC 39C2 cmp dx, ax 0 00002FBE 7610 jbe _.L12 108:dosfns.c **** } 142 .loc 1 108 0 0 00002FC0 BA5800 mov dx, 88 0 00002FC3 F7E2 mul dx 0 00002FC5 0306[0000] add ax, word ptr [_CDSp] 0 00002FC9 8B16[0200] mov dx, word ptr [_CDSp+2] 147 _.L10: 109:dosfns.c **** 148 .loc 1 109 0 0 00002FCD C20200 ret 2 150 _.LVL11: 151 _.L12: 107:dosfns.c **** return &CDSp[drive]; 152 .loc 1 107 0 0 00002FD0 31C0 xor ax, ax 154 _.LVL12: 0 00002FD2 89C2 mov dx, ax 0 00002FD4 EBF7 jmp _.L10 157 _.LFE4: 158 .size _get_cds_unvalidated, .-_get_cds_unvalidated 159 .global _get_cds 160 .type _get_cds, @function 161 _get_cds: 162 _.LFB5: 115:dosfns.c **** struct cds FAR *cdsp; 163 .loc 1 115 0 164 _.LVL13: 0 00002FD6 55 push bp 166 _.LCFI9: 0 00002FD7 89E5 mov bp, sp 168 _.LCFI10: 0 00002FD9 8B4604 mov ax, word ptr [bp+4] 119:dosfns.c **** return NULL; 170 .loc 1 119 0 0 00002FDC 8A16[0000] mov dl, byte ptr [_lastdrive] 0 00002FE0 30F6 xor dh, dh 0 00002FE2 39C2 cmp dx, ax 0 00002FE4 7632 jbe _.L18 121:dosfns.c **** flags = cdsp->cdsFlags; 175 .loc 1 121 0 0 00002FE6 BA5800 mov dx, 88 0 00002FE9 F7E2 mul dx 0 00002FEB 0306[0000] add ax, word ptr [_CDSp] 0 00002FEF 8B16[0200] mov dx, word ptr [_CDSp+2] 180 _.LVL14: 122:dosfns.c **** /* Entry is disabled or JOINed drives are accessable by the path only */ 181 .loc 1 122 0 0 00002FF3 8EC2 mov es, dx 0 00002FF5 89C3 mov bx, ax 0 00002FF7 268B4F43 mov cx, word ptr es:[bx+67] 185 _.LVL15: 124:dosfns.c **** return NULL; 186 .loc 1 124 0 0 00002FFB 89CB mov bx, cx 0 00002FFD 81E300C0 and bx, -16384 0 00003001 7415 je _.L18 124:dosfns.c **** return NULL; 190 .loc 1 124 0 is_stmt 0 discriminator 1 0 00003003 F6C520 test ch, 32 0 00003006 7510 jne _.L18 126:dosfns.c **** return NULL; 193 .loc 1 126 0 is_stmt 1 0 00003008 85C9 test cx, cx 0 0000300A 7C10 jl _.L14 126:dosfns.c **** return NULL; 196 .loc 1 126 0 is_stmt 0 discriminator 1 0 0000300C 89C3 mov bx, ax 0 0000300E 268B4F47 mov cx, word ptr es:[bx+71] 199 _.LVL16: 0 00003012 260B4F45 or cx, word ptr es:[bx+69] 0 00003016 7504 jne _.L14 202 _.LVL17: 203 _.L18: 120:dosfns.c **** cdsp = &CDSp[drive]; 204 .loc 1 120 0 is_stmt 1 0 00003018 31C0 xor ax, ax 0 0000301A 89C2 mov dx, ax 207 _.L14: 129:dosfns.c **** 208 .loc 1 129 0 0 0000301C 5D pop bp 0 0000301D C20200 ret 2 211 _.LFE5: 212 .size _get_cds, .-_get_cds 213 .global _get_cds1 214 .type _get_cds1, @function 215 _get_cds1: 216 _.LFB6: 133:dosfns.c **** if (drv-- == 0) /* get default drive or convert to 0 = A:, 1 = B:, ... */ 217 .loc 1 133 0 218 _.LVL18: 0 00003020 89E3 mov bx, sp 220 _.LCFI11: 0 00003022 8B4702 mov ax, word ptr [bx+2] 222 _.LVL19: 134:dosfns.c **** drv = default_drive; 223 .loc 1 134 0 0 00003025 85C0 test ax, ax 0 00003027 7406 je _.L21 0 00003029 48 dec ax 227 _.LVL20: 228 _.L22: 136:dosfns.c **** } 229 .loc 1 136 0 0 0000302A 894702 mov word ptr [bx+2], ax 0 0000302D EBA7 jmp _get_cds 232 _.LVL21: 233 _.L21: 135:dosfns.c **** return get_cds(drv); 234 .loc 1 135 0 0 0000302F A0[0000] mov al, byte ptr [_default_drive] 236 _.LVL22: 0 00003032 98 cbw 238 _.LVL23: 0 00003033 EBF5 jmp _.L22 240 _.LFE6: 241 .size _get_cds1, .-_get_cds1 242 .global _GetDriveDPB 243 .type _GetDriveDPB, @function 244 _GetDriveDPB: 245 _.LFB7: 141:dosfns.c **** struct dpb FAR *dpb; 246 .loc 1 141 0 247 _.LVL24: 0 00003035 56 push si 0 00003036 57 push di 0 00003037 55 push bp 251 _.LCFI12: 0 00003038 89E5 mov bp, sp 253 _.LCFI13: 0 0000303A 8B760A mov si, word ptr [bp+10] 145:dosfns.c **** 255 .loc 1 145 0 0 0000303D 8A4608 mov al, byte ptr [bp+8] 0 00003040 30E4 xor ah, ah 0 00003042 50 push ax 0 00003043 E8[FEFF] call _get_cds1 260 _.LVL25: 0 00003046 89C3 mov bx, ax 262 _.LVL26: 147:dosfns.c **** { 263 .loc 1 147 0 0 00003048 09D0 or ax, dx 265 _.LVL27: 0 0000304A 7512 jne _.L25 267 _.L27: 149:dosfns.c **** return 0; 268 .loc 1 149 0 0 0000304C C704F1FF mov word ptr [si], -15 150:dosfns.c **** } 270 .loc 1 150 0 0 00003050 31C0 xor ax, ax 0 00003052 89C1 mov cx, ax 273 _.L24: 161:dosfns.c **** #endif 274 .loc 1 161 0 0 00003054 89CA mov dx, cx 276 _.LVL28: 0 00003056 89EC mov sp, bp 0 00003058 5D pop bp 0 00003059 5F pop di 0 0000305A 5E pop si 0 0000305B C20400 ret 4 282 _.LVL29: 283 _.L25: 152:dosfns.c **** if (dpb == 0 || cdsp->cdsFlags & CDSNETWDRV) 284 .loc 1 152 0 0 0000305E 8EC2 mov es, dx 0 00003060 268B4745 mov ax, word ptr es:[bx+69] 0 00003064 268B4F47 mov cx, word ptr es:[bx+71] 288 _.LVL30: 153:dosfns.c **** { 289 .loc 1 153 0 0 00003068 89C7 mov di, ax 0 0000306A 09CF or di, cx 0 0000306C 74DE je _.L27 0 0000306E 26837F4300 cmp word ptr es:[bx+67], 0 0 00003073 7CD7 jl _.L27 159:dosfns.c **** return dpb; 295 .loc 1 159 0 0 00003075 C7040000 mov word ptr [si], 0 160:dosfns.c **** } 297 .loc 1 160 0 0 00003079 EBD9 jmp _.L24 299 _.LFE7: 300 .size _GetDriveDPB, .-_GetDriveDPB 301 .global _idx_to_sft_ 302 .type _idx_to_sft_, @function 303 _idx_to_sft_: 304 _.LFB8: 165:dosfns.c **** /*called from below and int2f/ax=1216*/ 305 .loc 1 165 0 306 _.LVL31: 0 0000307B 56 push si 0 0000307C 57 push di 0 0000307D 55 push bp 310 _.LCFI14: 0 0000307E 89E5 mov bp, sp 312 _.LCFI15: 0 00003080 8B7E08 mov di, word ptr [bp+8] 169:dosfns.c **** if (SftIndex < 0) 314 .loc 1 169 0 0 00003083 C706[0000]FFFF mov word ptr [_lpCurSft], -1 0 00003089 C706[0200]FFFF mov word ptr [_lpCurSft+2], -1 170:dosfns.c **** return -1; 317 .loc 1 170 0 0 0000308F 85FF test di, di 0 00003091 7C12 jl _.L38 174:dosfns.c **** { 320 .loc 1 174 0 0 00003093 8B1E[0000] mov bx, word ptr [_sfthead] 0 00003097 8B0E[0200] mov cx, word ptr [_sfthead+2] 323 _.LVL32: 324 _.L35: 174:dosfns.c **** { 325 .loc 1 174 0 is_stmt 0 discriminator 1 0 0000309B 83FBFF cmp bx, -1 0 0000309E 750A jne _.L37 0 000030A0 83F9FF cmp cx, -1 0 000030A3 7505 jne _.L37 330 _.LVL33: 331 _.L38: 171:dosfns.c **** 332 .loc 1 171 0 is_stmt 1 0 000030A5 BFFFFF mov di, -1 0 000030A8 EB1D jmp _.L34 335 _.LVL34: 336 _.L37: 176:dosfns.c **** { 337 .loc 1 176 0 0 000030AA 89DE mov si, bx 0 000030AC 8EC1 mov es, cx 0 000030AE 268B5704 mov dx, word ptr es:[bx+4] 0 000030B2 39D7 cmp di, dx 0 000030B4 7D18 jge _.L36 179:dosfns.c **** return SftIndex; 343 .loc 1 179 0 0 000030B6 B83B00 mov ax, 59 0 000030B9 F7E7 mul di 0 000030BB 96 xchg si, ax 0 000030BC 8D7006 lea si, [6+bx+si] 0 000030BF 8936[0000] mov word ptr [_lpCurSft], si 0 000030C3 890E[0200] mov word ptr [_lpCurSft+2], cx 350 _.LVL35: 351 _.L34: 187:dosfns.c **** 352 .loc 1 187 0 0 000030C7 97 xchg di, ax 0 000030C8 5D pop bp 0 000030C9 5F pop di 0 000030CA 5E pop si 0 000030CB C20200 ret 2 358 _.LVL36: 359 _.L36: 182:dosfns.c **** } 360 .loc 1 182 0 discriminator 2 0 000030CE 29D7 sub di, dx 362 _.LVL37: 174:dosfns.c **** { 363 .loc 1 174 0 discriminator 2 0 000030D0 8EC1 mov es, cx 0 000030D2 268B1F mov bx, word ptr es:[bx] 366 _.LVL38: 0 000030D5 268B4C02 mov cx, word ptr es:[si+2] 368 _.LVL39: 0 000030D9 EBC0 jmp _.L35 370 _.LFE8: 371 .size _idx_to_sft_, .-_idx_to_sft_ 372 .global _idx_to_sft 373 .type _idx_to_sft, @function 374 _idx_to_sft: 375 _.LFB9: 190:dosfns.c **** /* called internally only */ 376 .loc 1 190 0 377 _.LVL40: 0 000030DB 55 push bp 379 _.LCFI16: 0 000030DC 89E5 mov bp, sp 381 _.LCFI17: 192:dosfns.c **** /* if not opened, the SFT is useless */ 382 .loc 1 192 0 0 000030DE FF7604 push word ptr [bp+4] 0 000030E1 E8[FEFF] call _idx_to_sft_ 385 _.LVL41: 195:dosfns.c **** return lpCurSft; 386 .loc 1 195 0 0 000030E4 89C3 mov bx, ax 0 000030E6 89C2 mov dx, ax 194:dosfns.c **** return (sft FAR *) - 1; 389 .loc 1 194 0 0 000030E8 83F8FF cmp ax, -1 0 000030EB 7411 je _.L40 194:dosfns.c **** return (sft FAR *) - 1; 392 .loc 1 194 0 is_stmt 0 discriminator 1 0 000030ED C41E[0000] les bx, dword ptr [_lpCurSft] 0 000030F1 8CC2 mov dx, es 0 000030F3 26833F00 cmp word ptr es:[bx], 0 0 000030F7 7505 jne _.L40 195:dosfns.c **** return lpCurSft; 397 .loc 1 195 0 is_stmt 1 0 000030F9 BBFFFF mov bx, -1 0 000030FC 89DA mov dx, bx 400 _.L40: 197:dosfns.c **** 401 .loc 1 197 0 0 000030FE 93 xchg bx, ax 403 _.LVL42: 0 000030FF 89EC mov sp, bp 0 00003101 5D pop bp 0 00003102 C20200 ret 2 407 _.LFE9: 408 .size _idx_to_sft, .-_idx_to_sft 409 .global _get_sft_idx 410 .type _get_sft_idx, @function 411 _get_sft_idx: 412 _.LFB10: 200:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 413 .loc 1 200 0 414 _.LVL43: 0 00003105 89E3 mov bx, sp 416 _.LCFI18: 0 00003107 8B5F02 mov bx, word ptr [bx+2] 201:dosfns.c **** int idx; 418 .loc 1 201 0 0 0000310A 8B16[0000] mov dx, word ptr [_cu_psp] 420 _.LVL44: 204:dosfns.c **** return DE_INVLDHNDL; 421 .loc 1 204 0 0 0000310E 8EC2 mov es, dx 0 00003110 26391E3200 cmp word ptr es:[50], bx 0 00003115 7616 jbe _.L47 207:dosfns.c **** return idx == 0xff ? DE_INVLDHNDL : idx; 425 .loc 1 207 0 0 00003117 268B0E3600 mov cx, word ptr es:[54] 0 0000311C 26031E3400 add bx, word ptr es:[52] 0 00003121 8EC1 mov es, cx 0 00003123 268A07 mov al, byte ptr es:[bx] 0 00003126 30E4 xor ah, ah 431 _.LVL45: 208:dosfns.c **** } 432 .loc 1 208 0 0 00003128 3DFF00 cmp ax, 255 0 0000312B 7503 jne _.L45 435 _.LVL46: 436 _.L47: 0 0000312D B8FAFF mov ax, -6 438 _.L45: 209:dosfns.c **** 439 .loc 1 209 0 0 00003130 C20200 ret 2 441 _.LFE10: 442 .size _get_sft_idx, .-_get_sft_idx 443 .global _get_sft 444 .type _get_sft, @function 445 _get_sft: 446 _.LFB11: 212:dosfns.c **** /* Get the SFT block that contains the SFT */ 447 .loc 1 212 0 448 _.LVL47: 0 00003133 55 push bp 450 _.LCFI19: 0 00003134 89E5 mov bp, sp 452 _.LCFI20: 214:dosfns.c **** } 453 .loc 1 214 0 0 00003136 FF7604 push word ptr [bp+4] 0 00003139 E8[FEFF] call _get_sft_idx 456 _.LVL48: 0 0000313C 894604 mov word ptr [bp+4], ax 458 _.LVL49: 215:dosfns.c **** 459 .loc 1 215 0 0 0000313F 89EC mov sp, bp 0 00003141 5D pop bp 214:dosfns.c **** } 462 .loc 1 214 0 0 00003142 EB97 jmp _idx_to_sft 464 _.LVL50: 465 _.LFE11: 466 .size _get_sft, .-_get_sft 467 .global _DosRWSft 468 .type _DosRWSft, @function 469 _DosRWSft: 470 _.LFB12: 218:dosfns.c **** /* Get the SFT block that contains the SFT */ 471 .loc 1 218 0 472 _.LVL51: 0 00003144 56 push si 0 00003145 57 push di 0 00003146 55 push bp 476 _.LCFI21: 0 00003147 89E5 mov bp, sp 478 _.LCFI22: 0 00003149 83EC0C sub sp, 12 0 0000314C C47608 les si, dword ptr [bp+8] 0 0000314F 8C46F6 mov word ptr [bp-10], es 0 00003152 8B7E0C mov di, word ptr [bp+12] 0 00003155 8B460E mov ax, word ptr [bp+14] 0 00003158 8946F8 mov word ptr [bp-8], ax 220:dosfns.c **** 485 .loc 1 220 0 0 0000315B 56 push si 0 0000315C E8[FEFF] call _idx_to_sft 488 _.LVL52: 0 0000315F 89C3 mov bx, ax 0 00003161 8956FA mov word ptr [bp-6], dx 491 _.LVL53: 222:dosfns.c **** { 492 .loc 1 222 0 0 00003164 83F8FF cmp ax, -1 0 00003167 7503E90E02 je _.L69 227:dosfns.c **** (mode == XFR_WRITE && (s->sft_mode & O_ACCMODE) == O_RDONLY)) 495 .loc 1 227 0 0 0000316C 837E1001 cmp word ptr [bp+16], 1 0 00003170 8E46F6 mov es, word ptr [bp-10] 0 00003173 7510 jne _.L53 227:dosfns.c **** (mode == XFR_WRITE && (s->sft_mode & O_ACCMODE) == O_RDONLY)) 499 .loc 1 227 0 is_stmt 0 discriminator 1 0 00003175 8EDA mov ds, dx 0 00003177 F6470201 test byte ptr [bx+2], 1 0 0000317B 7417 je _.L54 503 _.L71: 230:dosfns.c **** } 504 .loc 1 230 0 is_stmt 1 0 0000317D B9FBFF mov cx, -5 0 00003180 BEFFFF mov si, -1 0 00003183 EB6F jmp _.L51 508 _.L53: 227:dosfns.c **** (mode == XFR_WRITE && (s->sft_mode & O_ACCMODE) == O_RDONLY)) 509 .loc 1 227 0 discriminator 3 0 00003185 837E1002 cmp word ptr [bp+16], 2 0 00003189 7576 jne _.L55 228:dosfns.c **** { 512 .loc 1 228 0 0 0000318B 8E5EFA mov ds, word ptr [bp-6] 0 0000318E F6470203 test byte ptr [bx+2], 3 0 00003192 74E9 je _.L71 516 _.L54: 517 _.LVL54: 239:dosfns.c **** { 518 .loc 1 239 0 0 00003194 8E5EFA mov ds, word ptr [bp-6] 0 00003197 8B5705 mov dx, word ptr [bx+5] 521 _.LVL55: 0 0000319A 85D2 test dx, dx 0 0000319C 7D70 jge _.L56 524 _.LBB28: 244:dosfns.c **** lpCurSft = s; 525 .loc 1 244 0 0 0000319E 36A1[0000] mov ax, word ptr ss:[_dta] 527 _.LVL56: 0 000031A2 8946F6 mov word ptr [bp-10], ax 0 000031A5 36A1[0200] mov ax, word ptr ss:[_dta+2] 0 000031A9 8946F4 mov word ptr [bp-12], ax 531 _.LVL57: 245:dosfns.c **** current_filepos = s->sft_posit; /* needed for MSCDEX */ 532 .loc 1 245 0 0 000031AC 36891E[0000] mov word ptr ss:[_lpCurSft], bx 0 000031B1 368C1E[0200] mov word ptr ss:[_lpCurSft+2], ds 246:dosfns.c **** dta = bp; 535 .loc 1 246 0 0 000031B6 8B4715 mov ax, word ptr [bx+21] 537 _.LVL58: 0 000031B9 36A3[0000] mov word ptr ss:[_current_filepos], ax 0 000031BD 8B4717 mov ax, word ptr [bx+23] 0 000031C0 36A3[0200] mov word ptr ss:[_current_filepos+2], ax 247:dosfns.c **** XferCount = remote_rw(mode == XFR_READ ? REM_READ : REM_WRITE, s, n); 541 .loc 1 247 0 0 000031C4 36893E[0000] mov word ptr ss:[_dta], di 0 000031C9 8B46F8 mov ax, word ptr [bp-8] 0 000031CC 36A3[0200] mov word ptr ss:[_dta+2], ax 545 _.LVL59: 248:dosfns.c **** dta = save_dta; 546 .loc 1 248 0 0 000031D0 837E1001 cmp word ptr [bp+16], 1 0 000031D4 9F lahf 0 000031D5 D0E4 shl ah, 1 0 000031D7 99 cwd 0 000031D8 81C20911 add dx, 4361 0 000031DC 06 push es 0 000031DD 1E push ds 0 000031DE 53 push bx 0 000031DF 52 push dx 0 000031E0 16 push ss 0 000031E1 1F pop ds 0 000031E2 E8[FEFF] call _network_redirector_mx 559 _.LVL60: 0 000031E5 91 xchg cx, ax 0 000031E6 89D6 mov si, dx 562 _.LVL61: 249:dosfns.c **** return XferCount; 563 .loc 1 249 0 0 000031E8 8B46F6 mov ax, word ptr [bp-10] 0 000031EB A3[0000] mov word ptr [_dta], ax 0 000031EE 8B46F4 mov ax, word ptr [bp-12] 0 000031F1 A3[0200] mov word ptr [_dta+2], ax 568 _.LVL62: 569 _.L51: 570 _.LBE28: 316:dosfns.c **** 571 .loc 1 316 0 0 000031F4 91 xchg cx, ax 0 000031F5 89F2 mov dx, si 0 000031F7 89EC mov sp, bp 0 000031F9 5D pop bp 0 000031FA 5F pop di 0 000031FB 5E pop si 0 000031FC 16 push ss 0 000031FD 1F pop ds 0 000031FE C20A00 ret 10 581 _.LVL63: 582 _.L55: 232:dosfns.c **** mode = XFR_WRITE; 583 .loc 1 232 0 0 00003201 837E1003 cmp word ptr [bp+16], 3 0 00003205 758D jne _.L54 233:dosfns.c **** 586 .loc 1 233 0 0 00003207 C746100200 mov word ptr [bp+16], 2 0 0000320C EB86 jmp _.L54 589 _.LVL64: 590 _.L56: 254:dosfns.c **** { 591 .loc 1 254 0 0 0000320E 89D0 mov ax, dx 593 _.LVL65: 0 00003210 258000 and ax, 128 0 00003213 7503E91301 je _.L58 596 _.LBB29: 256:dosfns.c **** 597 .loc 1 256 0 0 00003218 8E5EFA mov ds, word ptr [bp-6] 0 0000321B 8B4707 mov ax, word ptr [bx+7] 0 0000321E 8946FC mov word ptr [bp-4], ax 0 00003221 8B4709 mov ax, word ptr [bx+9] 0 00003224 8946FE mov word ptr [bp-2], ax 259:dosfns.c **** { 603 .loc 1 259 0 0 00003227 89D0 mov ax, dx 0 00003229 83E020 and ax, 32 0 0000322C 8946F6 mov word ptr [bp-10], ax 0 0000322F 7479 je _.L59 608 _.LBB30: 261:dosfns.c **** mode == XFR_READ ? C_INPUT : C_OUTPUT); 609 .loc 1 261 0 0 00003231 837E1001 cmp word ptr [bp+16], 1 0 00003235 746E je _.L74 0 00003237 B80800 mov ax, 8 613 _.L60: 0 0000323A 895EF4 mov word ptr [bp-12], bx 261:dosfns.c **** mode == XFR_READ ? C_INPUT : C_OUTPUT); 615 .loc 1 261 0 is_stmt 0 discriminator 4 0 0000323D 50 push ax 0 0000323E FF76F8 push word ptr [bp-8] 0 00003241 57 push di 0 00003242 06 push es 0 00003243 8D46FC lea ax, [-4+bp] 0 00003246 50 push ax 0 00003247 16 push ss 0 00003248 1F pop ds 0 00003249 E8[FEFF] call _BinaryCharIO 625 _.LVL66: 0 0000324C 91 xchg cx, ax 0 0000324D 89D6 mov si, dx 628 _.LVL67: 263:dosfns.c **** { 629 .loc 1 263 0 is_stmt 1 discriminator 4 0 0000324F 837E1002 cmp word ptr [bp+16], 2 0 00003253 759F jne _.L51 0 00003255 92 xchg dx, ax 0 00003256 99 cwd 634 _.LVL68: 0 00003257 89D0 mov ax, dx 636 _.LVL69: 0 00003259 29CA sub dx, cx 0 0000325B 19F0 sbb ax, si 0 0000325D 99 cwd 0 0000325E F7DA neg dx 0 00003260 8956F6 mov word ptr [bp-10], dx 0 00003263 807EF600 cmp byte ptr [bp-10], 0 0 00003267 748B je _.L51 263:dosfns.c **** { 644 .loc 1 263 0 is_stmt 0 discriminator 1 0 00003269 8E46FA mov es, word ptr [bp-6] 0 0000326C 8B5EF4 mov bx, word ptr [bp-12] 0 0000326F 26F6470502 test byte ptr es:[bx+5], 2 0 00003274 7503E97BFF je _.L51 649 _.LBB31: 265:dosfns.c **** const char FAR *p = bp; 650 .loc 1 265 0 is_stmt 1 0 00003279 89C8 mov ax, cx 652 _.LVL70: 266:dosfns.c **** while (cnt--) 653 .loc 1 266 0 0 0000327B 89FB mov bx, di 655 _.LVL71: 656 _.L62: 267:dosfns.c **** update_scr_pos(*p++, 1); 657 .loc 1 267 0 0 0000327D 89C7 mov di, ax 0 0000327F 4F dec di 660 _.LVL72: 0 00003280 85C0 test ax, ax 0 00003282 7503E96DFF je _.L51 0 00003287 894EF6 mov word ptr [bp-10], cx 268:dosfns.c **** } 664 .loc 1 268 0 0 0000328A 89D8 mov ax, bx 0 0000328C 40 inc ax 0 0000328D 8946FA mov word ptr [bp-6], ax 668 _.LVL73: 0 00003290 B001 mov al, 1 670 _.LVL74: 0 00003292 50 push ax 0 00003293 8E46F8 mov es, word ptr [bp-8] 0 00003296 26FF37 push word ptr es:[bx] 0 00003299 E8[FEFF] call _update_scr_pos 675 _.LVL75: 0 0000329C 8B5EFA mov bx, word ptr [bp-6] 0 0000329F 97 xchg di, ax 0 000032A0 8B4EF6 mov cx, word ptr [bp-10] 0 000032A3 EBD8 jmp _.L62 680 _.LVL76: 681 _.L74: 682 _.LBE31: 261:dosfns.c **** mode == XFR_READ ? C_INPUT : C_OUTPUT); 683 .loc 1 261 0 0 000032A5 B80400 mov ax, 4 0 000032A8 EB90 jmp _.L60 686 _.L59: 687 _.LBE30: 688 _.LBB32: 280:dosfns.c **** return 0; 689 .loc 1 280 0 0 000032AA 89D0 mov ax, dx 691 _.LBE32: 274:dosfns.c **** { 692 .loc 1 274 0 0 000032AC 837E1001 cmp word ptr [bp+16], 1 0 000032B0 754C jne _.L64 695 _.LBB33: 280:dosfns.c **** return 0; 696 .loc 1 280 0 0 000032B2 83E040 and ax, 64 0 000032B5 746E je _.L75 283:dosfns.c **** rc = read_line_handle(sft_idx, n, bp); 699 .loc 1 283 0 0 000032B7 F6C201 test dl, 1 0 000032BA 7429 je _.L65 0 000032BC 895EF4 mov word ptr [bp-12], bx 284:dosfns.c **** else 703 .loc 1 284 0 0 000032BF FF76F8 push word ptr [bp-8] 0 000032C2 57 push di 0 000032C3 06 push es 0 000032C4 56 push si 0 000032C5 16 push ss 0 000032C6 1F pop ds 0 000032C7 E8[FEFF] call _read_line_handle 711 _.LVL77: 0 000032CA 91 xchg cx, ax 0 000032CB 8B76F6 mov si, word ptr [bp-10] 714 _.LVL78: 0 000032CE 8B5EF4 mov bx, word ptr [bp-12] 716 _.LVL79: 717 _.L66: 287:dosfns.c **** s->sft_flags &= ~SFT_FEOF; 718 .loc 1 287 0 0 000032D1 36803D1A cmp byte ptr ss:[di], 26 0 000032D5 7403E91AFF jne _.L51 288:dosfns.c **** return rc; 721 .loc 1 288 0 0 000032DA 8E46FA mov es, word ptr [bp-6] 0 000032DD 26806705BF and byte ptr es:[bx+5], -65 724 _.LVL80: 0 000032E2 E90FFF jmp _.L51 726 _.LVL81: 727 _.L65: 0 000032E5 895EF6 mov word ptr [bp-10], bx 286:dosfns.c **** if (*(char *)bp == CTL_Z) 729 .loc 1 286 0 0 000032E8 FF76F8 push word ptr [bp-8] 0 000032EB 57 push di 0 000032EC 06 push es 0 000032ED 8D46FC lea ax, [-4+bp] 0 000032F0 50 push ax 0 000032F1 16 push ss 0 000032F2 1F pop ds 0 000032F3 E8[FEFF] call _cooked_read 738 _.LVL82: 0 000032F6 91 xchg cx, ax 0 000032F7 89D6 mov si, dx 0 000032F9 8B5EF6 mov bx, word ptr [bp-10] 742 _.LVL83: 0 000032FC EBD3 jmp _.L66 744 _.LVL84: 745 _.L64: 746 _.LBE33: 294:dosfns.c **** 747 .loc 1 294 0 0 000032FE 83C840 or ax, 64 0 00003301 8E5EFA mov ds, word ptr [bp-6] 0 00003304 894705 mov word ptr [bx+5], ax 751 _.LVL85: 297:dosfns.c **** return n; 752 .loc 1 297 0 0 00003307 F6C204 test dl, 4 0 0000330A 7408 je _.L67 298:dosfns.c **** else 755 .loc 1 298 0 0 0000330C 8CC1 mov cx, es 0 0000330E 8B76F6 mov si, word ptr [bp-10] 0 00003311 E9E0FE jmp _.L51 759 _.L67: 300:dosfns.c **** } 760 .loc 1 300 0 0 00003314 FF76F8 push word ptr [bp-8] 0 00003317 57 push di 0 00003318 06 push es 0 00003319 8D46FC lea ax, [-4+bp] 0 0000331C 50 push ax 0 0000331D 16 push ss 0 0000331E 1F pop ds 0 0000331F E8[FEFF] call _cooked_write 769 _.LVL86: 770 _.L90: 771 _.LBE29: 315:dosfns.c **** } 772 .loc 1 315 0 0 00003322 91 xchg cx, ax 0 00003323 EB40 jmp _.L89 775 _.LVL87: 776 _.L75: 777 _.LBB35: 778 _.LBB34: 281:dosfns.c **** 779 .loc 1 281 0 0 00003325 89C1 mov cx, ax 0 00003327 96 xchg si, ax 0 00003328 E9C9FE jmp _.L51 783 _.L58: 784 _.LBE34: 785 _.LBE35: 306:dosfns.c **** { 786 .loc 1 306 0 0 0000332B 36803E[0000]00 cmp byte ptr ss:[_share_installed], 0 0 00003331 7437 je _.L68 306:dosfns.c **** { 789 .loc 1 306 0 is_stmt 0 discriminator 1 0 00003333 8E5EFA mov ds, word ptr [bp-6] 0 00003336 8B5733 mov dx, word ptr [bx+51] 0 00003339 85D2 test dx, dx 0 0000333B 7C2D jl _.L68 794 _.LBB36: 309:dosfns.c **** (unsigned long)n, 1); 795 .loc 1 309 0 is_stmt 1 0 0000333D B90100 mov cx, 1 0 00003340 51 push cx 0 00003341 50 push ax 0 00003342 06 push es 0 00003343 8C46F6 mov word ptr [bp-10], es 0 00003346 1E push ds 0 00003347 07 pop es 0 00003348 26FF7717 push word ptr es:[bx+23] 0 0000334C 26FF7715 push word ptr es:[bx+21] 0 00003350 52 push dx 0 00003351 36FF36[0000] push word ptr ss:[_cu_psp] 0 00003356 16 push ss 0 00003357 1F pop ds 0 00003358 E8[FEFF] call _share_access_check 810 _.LVL88: 311:dosfns.c **** return rc; 811 .loc 1 311 0 0 0000335B 85C0 test ax, ax 0 0000335D 8E46F6 mov es, word ptr [bp-10] 0 00003360 7408 je _.L68 312:dosfns.c **** } 815 .loc 1 312 0 0 00003362 89C1 mov cx, ax 0 00003364 99 cwd 818 _.LVL89: 819 _.L89: 0 00003365 89D6 mov si, dx 0 00003367 E98AFE jmp _.L51 822 _.LVL90: 823 _.L68: 824 _.LBE36: 315:dosfns.c **** } 825 .loc 1 315 0 0 0000336A FF7610 push word ptr [bp+16] 0 0000336D 06 push es 0 0000336E FF76F8 push word ptr [bp-8] 0 00003371 57 push di 0 00003372 56 push si 0 00003373 16 push ss 0 00003374 1F pop ds 0 00003375 E8[FEFF] call _rwblock 834 _.LVL91: 0 00003378 EBA8 jmp _.L90 836 _.LVL92: 837 _.L69: 224:dosfns.c **** } 838 .loc 1 224 0 0 0000337A B9FAFF mov cx, -6 0 0000337D 96 xchg si, ax 0 0000337E E973FE jmp _.L51 842 _.LFE12: 843 .size _DosRWSft, .-_DosRWSft 844 .global _SftSeek2 845 .type _SftSeek2, @function 846 _SftSeek2: 847 _.LFB13: 319:dosfns.c **** sft FAR *s = idx_to_sft(sft_idx); 848 .loc 1 319 0 849 _.LVL93: 0 00003381 56 push si 0 00003382 57 push di 0 00003383 55 push bp 853 _.LCFI23: 0 00003384 89E5 mov bp, sp 855 _.LCFI24: 0 00003386 1E push ds 320:dosfns.c **** if (FP_OFF(s) == (size_t) -1) 857 .loc 1 320 0 0 00003387 FF7608 push word ptr [bp+8] 0 0000338A E8[FEFF] call _idx_to_sft 860 _.LVL94: 321:dosfns.c **** return DE_INVLDHNDL; 861 .loc 1 321 0 0 0000338D 83F8FF cmp ax, -1 0 00003390 7503E9A600 je _.L97 325:dosfns.c **** return DE_INVLDFUNC; 864 .loc 1 325 0 0 00003395 837E0E02 cmp word ptr [bp+14], 2 0 00003399 7603E9A200 ja _.L98 0 0000339E 89C3 mov bx, ax 0 000033A0 89D6 mov si, dx 328:dosfns.c **** 869 .loc 1 328 0 0 000033A2 A3[0000] mov word ptr [_lpCurSft], ax 0 000033A5 8916[0200] mov word ptr [_lpCurSft+2], dx 331:dosfns.c **** { 872 .loc 1 331 0 0 000033A9 8EC2 mov es, dx 0 000033AB 268B4705 mov ax, word ptr es:[bx+5] 875 _.LVL95: 0 000033AF A880 test al, -128 0 000033B1 742C je _.L93 333:dosfns.c **** } 878 .loc 1 333 0 0 000033B3 C7460A0000 mov word ptr [bp+10], 0 880 _.LVL96: 0 000033B8 C7460C0000 mov word ptr [bp+12], 0 882 _.LVL97: 883 _.L94: 358:dosfns.c **** *p_result = new_pos; 884 .loc 1 358 0 0 000033BD 8B560A mov dx, word ptr [bp+10] 0 000033C0 8B460C mov ax, word ptr [bp+12] 0 000033C3 8EC6 mov es, si 0 000033C5 26895715 mov word ptr es:[bx+21], dx 889 _.LVL98: 0 000033C9 26894717 mov word ptr es:[bx+23], ax 359:dosfns.c **** return SUCCESS; 891 .loc 1 359 0 0 000033CD 8B5E10 mov bx, word ptr [bp+16] 0 000033D0 8917 mov word ptr [bx], dx 0 000033D2 894702 mov word ptr [bx+2], ax 360:dosfns.c **** } 895 .loc 1 360 0 0 000033D5 31C0 xor ax, ax 897 _.L91: 361:dosfns.c **** 898 .loc 1 361 0 0 000033D7 89EC mov sp, bp 0 000033D9 5D pop bp 0 000033DA 5F pop di 0 000033DB 5E pop si 0 000033DC C20A00 ret 10 904 _.LVL99: 905 _.L93: 335:dosfns.c **** { 906 .loc 1 335 0 0 000033DF 837E0E01 cmp word ptr [bp+14], 1 0 000033E3 751C jne _.L95 337:dosfns.c **** } 909 .loc 1 337 0 0 000033E5 8EC2 mov es, dx 0 000033E7 268B4715 mov ax, word ptr es:[bx+21] 0 000033EB 268B5717 mov dx, word ptr es:[bx+23] 913 _.LVL100: 914 _.L103: 355:dosfns.c **** } 915 .loc 1 355 0 0 000033EF 8B4E0A mov cx, word ptr [bp+10] 0 000033F2 8B7E0C mov di, word ptr [bp+12] 0 000033F5 01C8 add ax, cx 0 000033F7 11FA adc dx, di 0 000033F9 89460A mov word ptr [bp+10], ax 921 _.LVL101: 0 000033FC 89560C mov word ptr [bp+12], dx 923 _.LVL102: 0 000033FF EBBC jmp _.L94 925 _.LVL103: 926 _.L95: 339:dosfns.c **** { 927 .loc 1 339 0 0 00003401 837E0E02 cmp word ptr [bp+14], 2 0 00003405 75B6 jne _.L94 351:dosfns.c **** (s->sft_mode & (O_DENYREAD | O_DENYNONE))) 930 .loc 1 351 0 0 00003407 85C0 test ax, ax 0 00003409 7D24 jge _.L96 351:dosfns.c **** (s->sft_mode & (O_DENYREAD | O_DENYNONE))) 933 .loc 1 351 0 is_stmt 0 discriminator 1 0 0000340B 8EC2 mov es, dx 0 0000340D 26F6470270 test byte ptr es:[bx+2], 112 0 00003412 741B je _.L96 353:dosfns.c **** else 937 .loc 1 353 0 is_stmt 1 0 00003414 8D460A lea ax, [10+bp] 939 _.LVL104: 0 00003417 50 push ax 0 00003418 52 push dx 0 00003419 53 push bx 0 0000341A 895EFE mov word ptr [bp-2], bx 0 0000341D B82111 mov ax, 4385 945 _.LVL105: 0 00003420 50 push ax 947 _.LVL106: 0 00003421 E8[FEFF] call _network_redirector_mx 949 _.LVL107: 0 00003424 89460A mov word ptr [bp+10], ax 951 _.LVL108: 0 00003427 89560C mov word ptr [bp+12], dx 953 _.LVL109: 0 0000342A 8B5EFE mov bx, word ptr [bp-2] 0 0000342D EB8E jmp _.L94 956 _.LVL110: 957 _.L96: 355:dosfns.c **** } 958 .loc 1 355 0 0 0000342F 8EC6 mov es, si 0 00003431 268B4711 mov ax, word ptr es:[bx+17] 0 00003435 268B5713 mov dx, word ptr es:[bx+19] 962 _.LVL111: 0 00003439 EBB4 jmp _.L103 964 _.LVL112: 965 _.L97: 322:dosfns.c **** 966 .loc 1 322 0 0 0000343B B8FAFF mov ax, -6 968 _.LVL113: 0 0000343E EB97 jmp _.L91 970 _.LVL114: 971 _.L98: 326:dosfns.c **** 972 .loc 1 326 0 0 00003440 B8FFFF mov ax, -1 974 _.LVL115: 0 00003443 EB92 jmp _.L91 976 _.LFE13: 977 .size _SftSeek2, .-_SftSeek2 978 .global _SftSeek 979 .type _SftSeek, @function 980 _SftSeek: 981 _.LFB14: 364:dosfns.c **** UDWORD result; 982 .loc 1 364 0 983 _.LVL116: 0 00003445 55 push bp 985 _.LCFI25: 0 00003446 89E5 mov bp, sp 987 _.LCFI26: 0 00003448 1E push ds 0 00003449 1E push ds 366:dosfns.c **** } 990 .loc 1 366 0 0 0000344A 8D46FC lea ax, [-4+bp] 0 0000344D 50 push ax 0 0000344E FF760A push word ptr [bp+10] 0 00003451 FF7608 push word ptr [bp+8] 0 00003454 FF7606 push word ptr [bp+6] 0 00003457 FF7604 push word ptr [bp+4] 0 0000345A E8[FEFF] call _SftSeek2 998 _.LVL117: 367:dosfns.c **** 999 .loc 1 367 0 0 0000345D 89EC mov sp, bp 0 0000345F 5D pop bp 0 00003460 C20800 ret 8 1003 _.LFE14: 1004 .size _SftSeek, .-_SftSeek 1005 .global _DosSeek 1006 .type _DosSeek, @function 1007 _DosSeek: 1008 _.LFB15: 370:dosfns.c **** int sft_idx = get_sft_idx(hndl); 1009 .loc 1 370 0 1010 _.LVL118: 0 00003463 56 push si 0 00003464 57 push di 0 00003465 55 push bp 1014 _.LCFI27: 0 00003466 89E5 mov bp, sp 1016 _.LCFI28: 0 00003468 1E push ds 0 00003469 1E push ds 0 0000346A 8B7E0A mov di, word ptr [bp+10] 0 0000346D 8B760C mov si, word ptr [bp+12] 371:dosfns.c **** UDWORD result; 1021 .loc 1 371 0 0 00003470 FF7608 push word ptr [bp+8] 0 00003473 E8[FEFF] call _get_sft_idx 1024 _.LVL119: 375:dosfns.c **** if (*rc == SUCCESS) 1025 .loc 1 375 0 0 00003476 8D56FC lea dx, [-4+bp] 0 00003479 52 push dx 0 0000347A FF760E push word ptr [bp+14] 0 0000347D 56 push si 0 0000347E 57 push di 0 0000347F 50 push ax 0 00003480 E8[FEFF] call _SftSeek2 1033 _.LVL120: 0 00003483 8B5E10 mov bx, word ptr [bp+16] 0 00003486 8907 mov word ptr [bx], ax 0 00003488 99 cwd 376:dosfns.c **** return result; 1037 .loc 1 376 0 0 00003489 85C0 test ax, ax 0 0000348B 7506 jne _.L106 377:dosfns.c **** return *rc; 1040 .loc 1 377 0 0 0000348D 8B46FC mov ax, word ptr [bp-4] 0 00003490 8B56FE mov dx, word ptr [bp-2] 1043 _.L106: 379:dosfns.c **** 1044 .loc 1 379 0 0 00003493 89EC mov sp, bp 0 00003495 5D pop bp 0 00003496 5F pop di 0 00003497 5E pop si 0 00003498 C20A00 ret 10 1050 _.LFE15: 1051 .size _DosSeek, .-_DosSeek 1052 .global _get_root 1053 .type _get_root, @function 1054 _get_root: 1055 _.LFB18: 422:dosfns.c **** /* find the end */ 1056 .loc 1 422 0 1057 _.LVL121: 0 0000349B 56 push si 0 0000349C 57 push di 0 0000349D 55 push bp 1061 _.LCFI29: 0 0000349E 89E5 mov bp, sp 1063 _.LCFI30: 0 000034A0 1E push ds 0 000034A1 8B7608 mov si, word ptr [bp+8] 0 000034A4 8B560A mov dx, word ptr [bp+10] 424:dosfns.c **** char c; 1067 .loc 1 424 0 0 000034A7 52 push dx 0 000034A8 8956FE mov word ptr [bp-2], dx 0 000034AB 56 push si 0 000034AC E8[FEFF] call _fstrlen 1072 _.LVL122: 428:dosfns.c **** while (length) 1073 .loc 1 428 0 0 000034AF 89F1 mov cx, si 0 000034B1 01C1 add cx, ax 1076 _.LVL123: 429:dosfns.c **** { 1077 .loc 1 429 0 0 000034B3 8B56FE mov dx, word ptr [bp-2] 1079 _.LVL124: 1080 _.L112: 0 000034B6 85C0 test ax, ax 0 000034B8 7509 jne _.L114 1083 _.LVL125: 1084 _.L111: 439:dosfns.c **** 1085 .loc 1 439 0 0 000034BA 91 xchg cx, ax 0 000034BB 89EC mov sp, bp 0 000034BD 5D pop bp 0 000034BE 5F pop di 0 000034BF 5E pop si 0 000034C0 C20400 ret 4 1092 _.LVL126: 1093 _.L114: 431:dosfns.c **** c = *--fname; 1094 .loc 1 431 0 0 000034C3 48 dec ax 1096 _.LVL127: 0 000034C4 97 xchg di, ax 1098 _.LVL128: 432:dosfns.c **** if (c == '/' || c == '\\' || c == ':') { 1099 .loc 1 432 0 0 000034C5 89CE mov si, cx 0 000034C7 4E dec si 1102 _.LVL129: 0 000034C8 8EC2 mov es, dx 0 000034CA 268A1C mov bl, byte ptr es:[si] 1105 _.LVL130: 433:dosfns.c **** fname++; 1106 .loc 1 433 0 0 000034CD 80FB2F cmp bl, 47 0 000034D0 9F lahf 0 000034D1 D0E4 shl ah, 1 0 000034D3 99 cwd 1111 _.LVL131: 0 000034D4 88D7 mov bh, dl 0 000034D6 F6DF neg bh 0 000034D8 88F8 mov al, bh 1115 _.LVL132: 0 000034DA 80FB5C cmp bl, 92 0 000034DD 9F lahf 0 000034DE D0E4 shl ah, 1 0 000034E0 99 cwd 0 000034E1 88D7 mov bh, dl 0 000034E3 F6DF neg bh 0 000034E5 88C4 mov ah, al 0 000034E7 08FC or ah, bh 0 000034E9 8CC2 mov dx, es 0 000034EB 75CD jne _.L111 1126 _.LVL133: 0 000034ED 80FB3A cmp bl, 58 0 000034F0 74C8 je _.L111 432:dosfns.c **** if (c == '/' || c == '\\' || c == ':') { 1129 .loc 1 432 0 0 000034F2 89F1 mov cx, si 0 000034F4 97 xchg di, ax 0 000034F5 EBBF jmp _.L112 1133 _.LFE18: 1134 .size _get_root, .-_get_root 1135 .type _set_fcbname, @function 1136 _set_fcbname: 1137 _.LFB20: 448:dosfns.c **** ConvertPathNameToFCBName(DirEntBuffer.dir_name, PriPathName); 1138 .loc 1 448 0 0 000034F7 56 push si 1140 _.LCFI31: 1141 _.LVL134: 1142 _.LBB39: 1143 _.LBB40: 443:dosfns.c **** FCBName[FNAME_SIZE + FEXT_SIZE] = '\0'; 1144 .loc 1 443 0 0 000034F8 16 push ss 1146 _.LCFI32: 0 000034F9 B8[0000] mov ax, offset __PriPathBuffer 0 000034FC 50 push ax 1149 _.LCFI33: 0 000034FD E8[FEFF] call _get_root 1151 _.LCFI34: 1152 _.LVL135: 0 00003500 50 push ax 1154 _.LCFI35: 0 00003501 BE[0000] mov si, offset _DirEntBuffer 0 00003504 56 push si 1157 _.LCFI36: 0 00003505 E8[FEFF] call _ConvertNameSZToName83 1159 _.LCFI37: 1160 _.LVL136: 444:dosfns.c **** } 1161 .loc 1 444 0 0 00003508 C6440B00 mov byte ptr [si+11], 0 1163 _.LVL137: 1164 _.LBE40: 1165 _.LBE39: 450:dosfns.c **** 1166 .loc 1 450 0 0 0000350C 5E pop si 0 0000350D C3 ret 1169 _.LFE20: 1170 .size _set_fcbname, .-_set_fcbname 1171 .global _CloneHandle 1172 .type _CloneHandle, @function 1173 _CloneHandle: 1174 _.LFB24: 657:dosfns.c **** /* now get the system file table entry */ 1175 .loc 1 657 0 1176 _.LVL138: 0 0000350E 55 push bp 1178 _.LCFI38: 0 0000350F 89E5 mov bp, sp 1180 _.LCFI39: 0 00003511 1E push ds 659:dosfns.c **** 1182 .loc 1 659 0 0 00003512 FF7604 push word ptr [bp+4] 0 00003515 E8[FEFF] call _get_sft 1185 _.LVL139: 0 00003518 89C3 mov bx, ax 1187 _.LVL140: 661:dosfns.c **** return DE_INVLDHNDL; 1188 .loc 1 661 0 0 0000351A 83F8FF cmp ax, -1 0 0000351D 7505 jne _.L125 0 0000351F 83FAFF cmp dx, -1 0 00003522 7417 je _.L124 1193 _.L125: 661:dosfns.c **** return DE_INVLDHNDL; 1194 .loc 1 661 0 is_stmt 0 discriminator 1 0 00003524 8EC2 mov es, dx 0 00003526 268B4702 mov ax, word ptr es:[bx+2] 1197 _.LVL141: 0 0000352A 8946FE mov word ptr [bp-2], ax 0 0000352D 258000 and ax, 128 0 00003530 7509 jne _.L124 667:dosfns.c **** return SUCCESS; 1201 .loc 1 667 0 is_stmt 1 0 00003532 26FF07 inc word ptr es:[bx] 1203 _.LVL142: 1204 _.L120: 669:dosfns.c **** 1205 .loc 1 669 0 0 00003535 89EC mov sp, bp 0 00003537 5D pop bp 0 00003538 C20200 ret 2 1209 _.LVL143: 1210 _.L124: 662:dosfns.c **** 1211 .loc 1 662 0 0 0000353B B8FAFF mov ax, -6 0 0000353E EBF5 jmp _.L120 1214 _.LFE24: 1215 .size _CloneHandle, .-_CloneHandle 1216 .global _DosCloseSft 1217 .type _DosCloseSft, @function 1218 _DosCloseSft: 1219 _.LFB27: 710:dosfns.c **** sft FAR *sftp = idx_to_sft(sft_idx); 1220 .loc 1 710 0 1221 _.LVL144: 0 00003540 56 push si 0 00003541 57 push di 0 00003542 55 push bp 1225 _.LCFI40: 0 00003543 89E5 mov bp, sp 1227 _.LCFI41: 0 00003545 83EC06 sub sp, 6 0 00003548 8B7E0A mov di, word ptr [bp+10] 711:dosfns.c **** int result; 1230 .loc 1 711 0 0 0000354B FF7608 push word ptr [bp+8] 0 0000354E E8[FEFF] call _idx_to_sft 1233 _.LVL145: 0 00003551 8956FA mov word ptr [bp-6], dx 1235 _.LVL146: 714:dosfns.c **** return DE_INVLDHNDL; 1236 .loc 1 714 0 0 00003554 83F8FF cmp ax, -1 0 00003557 7456 je _.L140 0 00003559 89C6 mov si, ax 717:dosfns.c **** /* 1240 .loc 1 717 0 0 0000355B A3[0000] mov word ptr [_lpCurSft], ax 0 0000355E 8916[0200] mov word ptr [_lpCurSft+2], dx 721:dosfns.c **** { 1243 .loc 1 721 0 0 00003562 8EC2 mov es, dx 0 00003564 268B4405 mov ax, word ptr es:[si+5] 1246 _.LVL147: 0 00003568 85C0 test ax, ax 0 0000356A 7D16 jge _.L130 724:dosfns.c **** } 1249 .loc 1 724 0 0 0000356C 83FF01 cmp di, 1 0 0000356F 19C0 sbb ax, ax 0 00003571 050711 add ax, 4359 0 00003574 52 push dx 0 00003575 56 push si 0 00003576 50 push ax 0 00003577 E8[FEFF] call _network_redirector_fp 1257 _.LVL148: 1258 _.L128: 759:dosfns.c **** 1259 .loc 1 759 0 0 0000357A 89EC mov sp, bp 0 0000357C 5D pop bp 0 0000357D 5F pop di 0 0000357E 5E pop si 0 0000357F C20400 ret 4 1265 _.LVL149: 1266 _.L130: 727:dosfns.c **** { 1267 .loc 1 727 0 0 00003582 A880 test al, -128 0 00003584 743C je _.L132 729:dosfns.c **** { 1270 .loc 1 729 0 0 00003586 8E46FA mov es, word ptr [bp-6] 0 00003589 26C45C07 les bx, dword ptr es:[si+7] 0 0000358D 26F6470508 test byte ptr es:[bx+5], 8 0 00003592 B80000 mov ax, 0 0 00003595 741D je _.L133 1276 _.LBB41: 734:dosfns.c **** if (BinaryCharIO(&dev, 0, MK_FP(0x0000, 0x0000), C_CLOSE) != SUCCESS) 1277 .loc 1 734 0 0 00003597 895EFC mov word ptr [bp-4], bx 0 0000359A 8C46FE mov word ptr [bp-2], es 735:dosfns.c **** return DE_INVLDHNDL; 1280 .loc 1 735 0 0 0000359D BA0E00 mov dx, 14 1282 _.LVL150: 0 000035A0 52 push dx 0 000035A1 50 push ax 0 000035A2 50 push ax 0 000035A3 50 push ax 0 000035A4 8D46FC lea ax, [-4+bp] 0 000035A7 50 push ax 0 000035A8 E8[FEFF] call _BinaryCharIO 1290 _.LVL151: 0 000035AB 09D0 or ax, dx 0 000035AD 7405 je _.L133 1293 _.LVL152: 1294 _.L140: 1295 _.LBE41: 715:dosfns.c **** 1296 .loc 1 715 0 0 000035AF B8FAFF mov ax, -6 0 000035B2 EBC6 jmp _.L128 1299 _.LVL153: 1300 _.L133: 739:dosfns.c **** sftp->sft_count -= 1; 1301 .loc 1 739 0 0 000035B4 85FF test di, di 0 000035B6 7506 jne _.L142 1304 _.LVL154: 1305 _.L137: 757:dosfns.c **** return SUCCESS; 1306 .loc 1 757 0 0 000035B8 8E46FA mov es, word ptr [bp-6] 0 000035BB 26FF0C dec word ptr es:[si] 1309 _.L142: 741:dosfns.c **** } 1310 .loc 1 741 0 0 000035BE 31C0 xor ax, ax 0 000035C0 EBB8 jmp _.L128 1313 _.LVL155: 1314 _.L132: 745:dosfns.c **** if (commitonly || result != SUCCESS) 1315 .loc 1 745 0 0 000035C2 FF7608 push word ptr [bp+8] 0 000035C5 E8[FEFF] call _dos_close 1318 _.LVL156: 746:dosfns.c **** return result; 1319 .loc 1 746 0 0 000035C8 85FF test di, di 0 000035CA 75AE jne _.L128 0 000035CC 85C0 test ax, ax 0 000035CE 75AA jne _.L128 750:dosfns.c **** { 1324 .loc 1 750 0 0 000035D0 8E46FA mov es, word ptr [bp-6] 0 000035D3 26833C01 cmp word ptr es:[si], 1 0 000035D7 75DF jne _.L137 1328 _.LVL157: 1329 _.LBB42: 1330 _.LBB43: 0 000035D9 E8C7F9 call _IsShareInstalled.part.1 1332 _.LVL158: 1333 _.LVL159: 1334 _.LBE43: 1335 _.LBE42: 0 000035DC 85C0 test ax, ax 0 000035DE 74D8 je _.L137 752:dosfns.c **** share_close_file(sftp->sft_shroff); 1338 .loc 1 752 0 0 000035E0 8E46FA mov es, word ptr [bp-6] 0 000035E3 268B4433 mov ax, word ptr es:[si+51] 0 000035E7 85C0 test ax, ax 0 000035E9 7C04 jl _.L139 753:dosfns.c **** sftp->sft_shroff = -1; 1343 .loc 1 753 0 0 000035EB 50 push ax 0 000035EC E8[FEFF] call _share_close_file 1346 _.LVL160: 1347 _.L139: 754:dosfns.c **** } 1348 .loc 1 754 0 0 000035EF 8E46FA mov es, word ptr [bp-6] 0 000035F2 26C74433FFFF mov word ptr es:[si+51], -1 1351 _.LVL161: 0 000035F8 EBBE jmp _.L137 1353 _.LFE27: 1354 .size _DosCloseSft, .-_DosCloseSft 1355 .global _DosClose 1356 .type _DosClose, @function 1357 _DosClose: 1358 _.LFB28: 762:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 1359 .loc 1 762 0 1360 _.LVL162: 0 000035FA 56 push si 0 000035FB 57 push di 0 000035FC 55 push bp 1364 _.LCFI42: 0 000035FD 89E5 mov bp, sp 1366 _.LCFI43: 763:dosfns.c **** int sft_idx = get_sft_idx(hndl); 1367 .loc 1 763 0 0 000035FF 8B36[0000] mov si, word ptr [_cu_psp] 1369 _.LVL163: 764:dosfns.c **** 1370 .loc 1 764 0 0 00003603 FF7608 push word ptr [bp+8] 0 00003606 E8[FEFF] call _get_sft_idx 1373 _.LVL164: 0 00003609 89C7 mov di, ax 1375 _.LVL165: 766:dosfns.c **** return DE_INVLDHNDL; 1376 .loc 1 766 0 0 0000360B 50 push ax 0 0000360C E8[FEFF] call _idx_to_sft 1379 _.LVL166: 0 0000360F 83F8FF cmp ax, -1 0 00003612 7423 je _.L155 772:dosfns.c **** 1382 .loc 1 772 0 0 00003614 8EC6 mov es, si 0 00003616 26A13600 mov ax, word ptr es:[54] 0 0000361A 8B5E08 mov bx, word ptr [bp+8] 0 0000361D 26031E3400 add bx, word ptr es:[52] 0 00003622 8EC0 mov es, ax 0 00003624 26C607FF mov byte ptr es:[bx], -1 1389 _.LVL167: 775:dosfns.c **** } 1390 .loc 1 775 0 0 00003628 31C0 xor ax, ax 0 0000362A 50 push ax 0 0000362B 57 push di 0 0000362C E8[FEFF] call _DosCloseSft 1395 _.LVL168: 1396 _.L153: 776:dosfns.c **** 1397 .loc 1 776 0 0 0000362F 89EC mov sp, bp 0 00003631 5D pop bp 0 00003632 5F pop di 1401 _.LVL169: 0 00003633 5E pop si 1403 _.LVL170: 0 00003634 C20200 ret 2 1405 _.LVL171: 1406 _.L155: 767:dosfns.c **** 1407 .loc 1 767 0 0 00003637 B8FAFF mov ax, -6 0 0000363A EBF3 jmp _.L153 1410 _.LFE28: 1411 .size _DosClose, .-_DosClose 1412 .global _DosForceDup 1413 .type _DosForceDup, @function 1414 _DosForceDup: 1415 _.LFB26: 685:dosfns.c **** psp FAR *p = MK_FP(cu_psp, 0); 1416 .loc 1 685 0 1417 _.LVL172: 0 0000363C 56 push si 0 0000363D 57 push di 0 0000363E 55 push bp 1421 _.LCFI44: 0 0000363F 89E5 mov bp, sp 1423 _.LCFI45: 0 00003641 1E push ds 0 00003642 1E push ds 0 00003643 8B7E0A mov di, word ptr [bp+10] 686:dosfns.c **** sft FAR *Sftp; 1427 .loc 1 686 0 0 00003646 A1[0000] mov ax, word ptr [_cu_psp] 0 00003649 8946FE mov word ptr [bp-2], ax 1430 _.LVL173: 690:dosfns.c **** return DE_INVLDHNDL; 1431 .loc 1 690 0 0 0000364C FF7608 push word ptr [bp+8] 0 0000364F E8[FEFF] call _get_sft 1434 _.LVL174: 0 00003652 89C6 mov si, ax 1436 _.LVL175: 0 00003654 83F8FF cmp ax, -1 0 00003657 7505 jne _.L163 0 00003659 83FAFF cmp dx, -1 0 0000365C 744F je _.L167 1441 _.L163: 694:dosfns.c **** { 1442 .loc 1 694 0 0 0000365E 8E46FE mov es, word ptr [bp-2] 0 00003661 26A13600 mov ax, word ptr es:[54] 1445 _.LVL176: 0 00003665 8946FC mov word ptr [bp-4], ax 0 00003668 89FB mov bx, di 0 0000366A 26031E3400 add bx, word ptr es:[52] 0 0000366F 8EC0 mov es, ax 0 00003671 26803FFF cmp byte ptr es:[bx], -1 0 00003675 7526 jne _.L160 1452 _.LVL177: 1453 _.L161: 703:dosfns.c **** /* possible hazard: integer overflow ska*/ 1454 .loc 1 703 0 0 00003677 8E46FE mov es, word ptr [bp-2] 0 0000367A 26C5063400 lds ax, dword ptr es:[52] 0 0000367F 89C3 mov bx, ax 0 00003681 035E08 add bx, word ptr [bp+8] 0 00003684 8A0F mov cl, byte ptr [bx] 0 00003686 89FB mov bx, di 0 00003688 01C3 add bx, ax 0 0000368A 880F mov byte ptr [bx], cl 1463 _.LVL178: 705:dosfns.c **** return SUCCESS; 1464 .loc 1 705 0 0 0000368C 8EC2 mov es, dx 0 0000368E 26FF04 inc word ptr es:[si] 706:dosfns.c **** } 1467 .loc 1 706 0 0 00003691 31C0 xor ax, ax 1469 _.L157: 707:dosfns.c **** 1470 .loc 1 707 0 0 00003693 89EC mov sp, bp 0 00003695 5D pop bp 0 00003696 5F pop di 0 00003697 5E pop si 0 00003698 16 push ss 0 00003699 1F pop ds 0 0000369A C20400 ret 4 1478 _.LVL179: 1479 _.L160: 0 0000369D 8956FC mov word ptr [bp-4], dx 1481 _.LBB44: 698:dosfns.c **** return ret; 1482 .loc 1 698 0 0 000036A0 57 push di 0 000036A1 E8[FEFF] call _DosClose 1485 _.LVL180: 0 000036A4 85C0 test ax, ax 0 000036A6 8B56FC mov dx, word ptr [bp-4] 0 000036A9 74CC je _.L161 0 000036AB EBE6 jmp _.L157 1490 _.LVL181: 1491 _.L167: 1492 _.LBE44: 691:dosfns.c **** 1493 .loc 1 691 0 0 000036AD B8FAFF mov ax, -6 1495 _.LVL182: 0 000036B0 EBE1 jmp _.L157 1497 _.LFE26: 1498 .size _DosForceDup, .-_DosForceDup 1499 .global _DosDup 1500 .type _DosDup, @function 1501 _DosDup: 1502 _.LFB25: 672:dosfns.c **** long NewHandle; 1503 .loc 1 672 0 1504 _.LVL183: 0 000036B2 56 push si 0 000036B3 55 push bp 1507 _.LCFI46: 0 000036B4 89E5 mov bp, sp 1509 _.LCFI47: 0 000036B6 1E push ds 675:dosfns.c **** return NewHandle; 1511 .loc 1 675 0 0 000036B7 E861F8 call _get_free_hndl 1513 _.LVL184: 0 000036BA 89C6 mov si, ax 1515 _.LVL185: 0 000036BC 85D2 test dx, dx 0 000036BE 7C17 jl _.L169 0 000036C0 8956FE mov word ptr [bp-2], dx 678:dosfns.c **** return DE_INVLDHNDL; 1519 .loc 1 678 0 0 000036C3 50 push ax 0 000036C4 FF7606 push word ptr [bp+6] 0 000036C7 E8[FEFF] call _DosForceDup 1523 _.LVL186: 0 000036CA 85C0 test ax, ax 0 000036CC 8B56FE mov dx, word ptr [bp-2] 0 000036CF 7D06 jge _.L169 679:dosfns.c **** else 1527 .loc 1 679 0 0 000036D1 BEFAFF mov si, -6 1529 _.LVL187: 0 000036D4 BAFFFF mov dx, -1 1531 _.L169: 682:dosfns.c **** 1532 .loc 1 682 0 0 000036D7 96 xchg si, ax 0 000036D8 89EC mov sp, bp 0 000036DA 5D pop bp 0 000036DB 5E pop si 0 000036DC C20200 ret 2 1538 _.LFE25: 1539 .size _DosDup, .-_DosDup 1540 .global _DosGetFree 1541 .type _DosGetFree, @function 1542 _DosGetFree: 1543 _.LFB29: 779:dosfns.c **** /* navc==NULL means: called from FatGetDrvData, fcbfns.c */ 1544 .loc 1 779 0 1545 _.LVL188: 0 000036DF 56 push si 0 000036E0 57 push di 0 000036E1 55 push bp 1549 _.LCFI48: 0 000036E2 89E5 mov bp, sp 1551 _.LCFI49: 0 000036E4 83EC1A sub sp, 26 0 000036E7 8B760A mov si, word ptr [bp+10] 1554 _.LVL189: 788:dosfns.c **** 1555 .loc 1 788 0 0 000036EA 8A4608 mov al, byte ptr [bp+8] 0 000036ED 30E4 xor ah, ah 0 000036EF 50 push ax 0 000036F0 E8[FEFF] call _get_cds1 1560 _.LVL190: 0 000036F3 89C3 mov bx, ax 1562 _.LVL191: 790:dosfns.c **** return spc; 1563 .loc 1 790 0 0 000036F5 09D0 or ax, dx 1565 _.LVL192: 0 000036F7 750C jne _.L175 1567 _.LVL193: 1568 _.L178: 791:dosfns.c **** 1569 .loc 1 791 0 0 000036F9 BAFFFF mov dx, -1 1571 _.LVL194: 1572 _.L174: 880:dosfns.c **** 1573 .loc 1 880 0 0 000036FC 92 xchg dx, ax 0 000036FD 89EC mov sp, bp 0 000036FF 5D pop bp 0 00003700 5F pop di 0 00003701 5E pop si 0 00003702 C20800 ret 8 1580 _.LVL195: 1581 _.L175: 793:dosfns.c **** if (cdsp->cdsFlags & CDSNETWDRV) 1582 .loc 1 793 0 0 00003705 891E[0000] mov word ptr [_current_ldt], bx 0 00003709 8916[0200] mov word ptr [_current_ldt+2], dx 794:dosfns.c **** { 1585 .loc 1 794 0 0 0000370D 8EC2 mov es, dx 0 0000370F 26837F4300 cmp word ptr es:[bx+67], 0 0 00003714 7D31 jge _.L177 796:dosfns.c **** return spc; 1589 .loc 1 796 0 0 00003716 8D46F6 lea ax, [-10+bp] 0 00003719 50 push ax 0 0000371A 52 push dx 0 0000371B 53 push bx 0 0000371C B80C11 mov ax, 4364 0 0000371F 50 push ax 0 00003720 E8[FEFF] call _network_redirector_mx 1597 _.LVL196: 0 00003723 85C0 test ax, ax 0 00003725 75D2 jne _.L178 806:dosfns.c **** if (navc != NULL) 1600 .loc 1 806 0 0 00003727 8B56F6 mov dx, word ptr [bp-10] 1602 _.LVL197: 807:dosfns.c **** { 1603 .loc 1 807 0 0 0000372A 85F6 test si, si 0 0000372C 7407 je _.L179 809:dosfns.c **** spc &= 0xff; /* zero out media ID byte */ 1606 .loc 1 809 0 0 0000372E 8B46FC mov ax, word ptr [bp-4] 0 00003731 8904 mov word ptr [si], ax 810:dosfns.c **** } 1609 .loc 1 810 0 0 00003733 30F6 xor dh, dh 1611 _.LVL198: 1612 _.L179: 813:dosfns.c **** *bps = (COUNT) rg[2]; 1613 .loc 1 813 0 0 00003735 8B46F8 mov ax, word ptr [bp-8] 0 00003738 8B7E0E mov di, word ptr [bp+14] 0 0000373B 8905 mov word ptr [di], ax 814:dosfns.c **** return spc; 1617 .loc 1 814 0 0 0000373D 8B46FA mov ax, word ptr [bp-6] 0 00003740 8B7E0C mov di, word ptr [bp+12] 0 00003743 8905 mov word ptr [di], ax 815:dosfns.c **** } 1621 .loc 1 815 0 0 00003745 EBB5 jmp _.L174 1623 _.LVL199: 1624 _.L177: 818:dosfns.c **** if (dpbp == NULL) 1625 .loc 1 818 0 0 00003747 8EC2 mov es, dx 0 00003749 268B4747 mov ax, word ptr es:[bx+71] 0 0000374D 8946F4 mov word ptr [bp-12], ax 819:dosfns.c **** return spc; 1629 .loc 1 819 0 0 00003750 268B4745 mov ax, word ptr es:[bx+69] 0 00003754 8946F2 mov word ptr [bp-14], ax 0 00003757 8B46F4 mov ax, word ptr [bp-12] 0 0000375A 260B4745 or ax, word ptr es:[bx+69] 0 0000375E 7499 je _.L178 822:dosfns.c **** { 1635 .loc 1 822 0 0 00003760 85F6 test si, si 0 00003762 7513 jne _.L181 825:dosfns.c **** dpbp->dpb_flags = M_CHANGED; 1638 .loc 1 825 0 0 00003764 C45EF2 les bx, dword ptr [bp-14] 1640 _.LVL200: 0 00003767 268A07 mov al, byte ptr es:[bx] 0 0000376A 98 cbw 0 0000376B 50 push ax 0 0000376C E8[FEFF] call _flush_buffers 1645 _.LVL201: 826:dosfns.c **** } 1646 .loc 1 826 0 0 0000376F C45EF2 les bx, dword ptr [bp-14] 0 00003772 26C64718FF mov byte ptr es:[bx+24], -1 1649 _.LVL202: 1650 _.L181: 829:dosfns.c **** return spc; 1651 .loc 1 829 0 0 00003777 FF76F4 push word ptr [bp-12] 0 0000377A FF76F2 push word ptr [bp-14] 0 0000377D E8[FEFF] call _media_check 1655 _.LVL203: 0 00003780 85C0 test ax, ax 0 00003782 7D03E972FF jl _.L178 832:dosfns.c **** *bps = dpbp->dpb_secsize; 1658 .loc 1 832 0 0 00003787 C45EF2 les bx, dword ptr [bp-14] 0 0000378A 268A4704 mov al, byte ptr es:[bx+4] 0 0000378E 30E4 xor ah, ah 0 00003790 40 inc ax 0 00003791 8946F0 mov word ptr [bp-16], ax 0 00003794 92 xchg dx, ax 1665 _.LVL204: 833:dosfns.c **** 1666 .loc 1 833 0 0 00003795 268B4702 mov ax, word ptr es:[bx+2] 1668 _.LVL205: 0 00003799 8B7E0C mov di, word ptr [bp+12] 0 0000379C 8905 mov word ptr [di], ax 838:dosfns.c **** { 1671 .loc 1 838 0 0 0000379E 26837F0F00 cmp word ptr es:[bx+15], 0 0 000037A3 7403E99F00 jne _.L182 0 000037A8 8956E8 mov word ptr [bp-24], dx 1675 _.LBB45: 843:dosfns.c **** ntotal = dpbp->dpb_xsize - 1; 1676 .loc 1 843 0 0 000037AB 268B5702 mov dx, word ptr es:[bx+2] 1678 _.LVL206: 0 000037AF 268A4705 mov al, byte ptr es:[bx+5] 0 000037B3 30E4 xor ah, ah 0 000037B5 50 push ax 0 000037B6 31C0 xor ax, ax 0 000037B8 50 push ax 0 000037B9 52 push dx 0 000037BA E8[FEFF] call ___ashlsi3 1686 _.LVL207: 0 000037BD 8946F0 mov word ptr [bp-16], ax 1688 _.LVL208: 0 000037C0 8956EE mov word ptr [bp-18], dx 1690 _.LVL209: 844:dosfns.c **** if (navc != NULL) 1691 .loc 1 844 0 0 000037C3 C45EF2 les bx, dword ptr [bp-14] 0 000037C6 268B7F2D mov di, word ptr es:[bx+45] 0 000037CA 268B4F2F mov cx, word ptr es:[bx+47] 0 000037CE 83C7FF add di, -1 0 000037D1 83D1FF adc cx, -1 1697 _.LVL210: 845:dosfns.c **** nfree = dos_free(dpbp); 1698 .loc 1 845 0 0 000037D4 85F6 test si, si 0 000037D6 8B56E8 mov dx, word ptr [bp-24] 1701 _.LVL211: 0 000037D9 7414 je _.L184 0 000037DB 894EE6 mov word ptr [bp-26], cx 846:dosfns.c **** while (ntotal > FAT_MAGIC16 && cluster_size < 0x8000) 1704 .loc 1 846 0 0 000037DE 06 push es 0 000037DF 53 push bx 0 000037E0 E8[FEFF] call _dos_free 1708 _.LVL212: 0 000037E3 8946EC mov word ptr [bp-20], ax 0 000037E6 8956EA mov word ptr [bp-22], dx 1711 _.LVL213: 0 000037E9 8B56E8 mov dx, word ptr [bp-24] 1713 _.LVL214: 0 000037EC 8B4EE6 mov cx, word ptr [bp-26] 1715 _.LVL215: 1716 _.L184: 847:dosfns.c **** { 1717 .loc 1 847 0 0 000037EF 85C9 test cx, cx 0 000037F1 7505 jne _.L209 0 000037F3 83FFF5 cmp di, -11 0 000037F6 760D jbe _.L201 1722 _.L209: 0 000037F8 837EEE00 cmp word ptr [bp-18], 0 0 000037FC 7507 jne _.L201 0 000037FE 817EF0FF7F cmp word ptr [bp-16], 32767 0 00003803 762E jbe _.L224 1727 _.L201: 855:dosfns.c **** 1728 .loc 1 855 0 0 00003805 85C9 test cx, cx 0 00003807 7505 jne _.L192 0 00003809 83FFF5 cmp di, -11 0 0000380C 7603 jbe _.L191 1733 _.L192: 0 0000380E BFF5FF mov di, -11 1735 _.LVL216: 1736 _.L191: 0 00003811 8B5E0E mov bx, word ptr [bp+14] 0 00003814 893F mov word ptr [bx], di 859:dosfns.c **** *navc = nfree > FAT_MAGIC16 ? FAT_MAGIC16 : (UCOUNT) nfree; 1739 .loc 1 859 0 0 00003816 85F6 test si, si 0 00003818 7503E9DFFE je _.L174 860:dosfns.c **** return spc; 1742 .loc 1 860 0 0 0000381D 8B46EC mov ax, word ptr [bp-20] 0 00003820 837EEA00 cmp word ptr [bp-22], 0 0 00003824 7505 jne _.L194 0 00003826 83F8F5 cmp ax, -11 0 00003829 7603 jbe _.L193 1748 _.L194: 0 0000382B B8F5FF mov ax, -11 1750 _.L193: 0 0000382E 8904 mov word ptr [si], ax 0 00003830 E9C9FE jmp _.L174 1753 _.LVL217: 1754 _.L224: 849:dosfns.c **** spc <<= 1; 1755 .loc 1 849 0 0 00003833 D166F0 shl word ptr [bp-16], 1 1757 _.LVL218: 0 00003836 D156EE rcl word ptr [bp-18], 1 1759 _.LVL219: 850:dosfns.c **** ntotal >>= 1; 1760 .loc 1 850 0 0 00003839 D1E2 shl dx, 1 1762 _.LVL220: 851:dosfns.c **** nfree >>= 1; 1763 .loc 1 851 0 0 0000383B D1E9 shr cx, 1 1765 _.LVL221: 0 0000383D D1DF rcr di, 1 1767 _.LVL222: 852:dosfns.c **** } 1768 .loc 1 852 0 0 0000383F D16EEA shr word ptr [bp-22], 1 1770 _.LVL223: 0 00003842 D15EEC rcr word ptr [bp-20], 1 1772 _.LVL224: 0 00003845 EBA8 jmp _.L184 1774 _.LVL225: 1775 _.L182: 1776 _.LBE45: 866:dosfns.c **** *navc = (COUNT) dos_free(dpbp); 1777 .loc 1 866 0 0 00003847 85F6 test si, si 0 00003849 7411 je _.L195 0 0000384B 8956EE mov word ptr [bp-18], dx 867:dosfns.c **** *nc = dpbp->dpb_size - 1; 1781 .loc 1 867 0 0 0000384E FF76F4 push word ptr [bp-12] 0 00003851 FF76F2 push word ptr [bp-14] 0 00003854 E8[FEFF] call _dos_free 1785 _.LVL226: 0 00003857 8904 mov word ptr [si], ax 0 00003859 8B56EE mov dx, word ptr [bp-18] 1788 _.L195: 868:dosfns.c **** if (spc > 64) 1789 .loc 1 868 0 0 0000385C C45EF2 les bx, dword ptr [bp-14] 0 0000385F 268B470D mov ax, word ptr es:[bx+13] 0 00003863 48 dec ax 0 00003864 8B5E0E mov bx, word ptr [bp+14] 0 00003867 8907 mov word ptr [bx], ax 869:dosfns.c **** { 1795 .loc 1 869 0 0 00003869 837EF040 cmp word ptr [bp-16], 64 0 0000386D 7F03E98AFE jle _.L174 873:dosfns.c **** if (navc != NULL) 1798 .loc 1 873 0 0 00003872 8B5EF0 mov bx, word ptr [bp-16] 0 00003875 D1EB shr bx, 1 0 00003877 89DA mov dx, bx 1802 _.LVL227: 874:dosfns.c **** *navc = ((unsigned)*navc < FAT_MAGIC16 / 2) ? 1803 .loc 1 874 0 0 00003879 85F6 test si, si 0 0000387B 740B je _.L196 875:dosfns.c **** ((unsigned)*navc << 1) : FAT_MAGIC16; 1806 .loc 1 875 0 0 0000387D 8B04 mov ax, word ptr [si] 876:dosfns.c **** *nc = ((unsigned)*nc < FAT_MAGIC16 / 2) ? ((unsigned)*nc << 1) : FAT_MAGIC16; 1808 .loc 1 876 0 0 0000387F 3DF97F cmp ax, 32761 0 00003882 7718 ja _.L199 876:dosfns.c **** *nc = ((unsigned)*nc < FAT_MAGIC16 / 2) ? ((unsigned)*nc << 1) : FAT_MAGIC16; 1811 .loc 1 876 0 is_stmt 0 discriminator 1 0 00003884 D1E0 shl ax, 1 1813 _.L197: 875:dosfns.c **** ((unsigned)*navc << 1) : FAT_MAGIC16; 1814 .loc 1 875 0 is_stmt 1 0 00003886 8904 mov word ptr [si], ax 1816 _.L196: 877:dosfns.c **** } 1817 .loc 1 877 0 0 00003888 8B5E0E mov bx, word ptr [bp+14] 0 0000388B 8B07 mov ax, word ptr [bx] 0 0000388D 3DF97F cmp ax, 32761 0 00003890 770F ja _.L200 877:dosfns.c **** } 1822 .loc 1 877 0 is_stmt 0 discriminator 1 0 00003892 D1E0 shl ax, 1 1824 _.L198: 877:dosfns.c **** } 1825 .loc 1 877 0 discriminator 4 0 00003894 8B5E0E mov bx, word ptr [bp+14] 0 00003897 8907 mov word ptr [bx], ax 0 00003899 E960FE jmp _.L174 1829 _.L199: 876:dosfns.c **** *nc = ((unsigned)*nc < FAT_MAGIC16 / 2) ? ((unsigned)*nc << 1) : FAT_MAGIC16; 1830 .loc 1 876 0 is_stmt 1 0 0000389C B8F5FF mov ax, -11 0 0000389F EBE5 jmp _.L197 1833 _.L200: 877:dosfns.c **** } 1834 .loc 1 877 0 0 000038A1 B8F5FF mov ax, -11 0 000038A4 EBEE jmp _.L198 1837 _.LFE29: 1838 .size _DosGetFree, .-_DosGetFree 1839 .global _DosGetExtFree 1840 .type _DosGetExtFree, @function 1841 _DosGetExtFree: 1842 _.LFB30: 885:dosfns.c **** struct dpb FAR *dpbp; 1843 .loc 1 885 0 1844 _.LVL228: 0 000038A6 56 push si 0 000038A7 57 push di 0 000038A8 55 push bp 1848 _.LCFI50: 0 000038A9 89E5 mov bp, sp 1850 _.LCFI51: 0 000038AB 83EC16 sub sp, 22 0 000038AE 8B7608 mov si, word ptr [bp+8] 0 000038B1 C4460A les ax, dword ptr [bp+10] 0 000038B4 8946EE mov word ptr [bp-18], ax 0 000038B7 8C46F4 mov word ptr [bp-12], es 0 000038BA 8B460E mov ax, word ptr [bp+14] 0 000038BD 8946F2 mov word ptr [bp-14], ax 891:dosfns.c **** xfsp->xfs_datasize = sizeof(struct xfreespace); 1858 .loc 1 891 0 0 000038C0 BA2C00 mov dx, 44 0 000038C3 52 push dx 0 000038C4 8956EC mov word ptr [bp-20], dx 0 000038C7 31FF xor di, di 0 000038C9 57 push di 0 000038CA 50 push ax 0 000038CB FF76F4 push word ptr [bp-12] 0 000038CE E8[FEFF] call _fmemset 1867 _.LVL229: 892:dosfns.c **** 1868 .loc 1 892 0 0 000038D1 8E46F2 mov es, word ptr [bp-14] 0 000038D4 8B5EF4 mov bx, word ptr [bp-12] 0 000038D7 8B56EC mov dx, word ptr [bp-20] 0 000038DA 268917 mov word ptr es:[bx], dx 1873 _.LVL230: 901:dosfns.c **** cdsp = get_cds(default_drive); /* if "" or .[\] or \[path] then use current drive */ 1874 .loc 1 901 0 0 000038DD 8E46EE mov es, word ptr [bp-18] 0 000038E0 268A04 mov al, byte ptr es:[si] 0 000038E3 3C01 cmp al, 1 0 000038E5 897EEC mov word ptr [bp-20], di 0 000038E8 7226 jc _.L227 0 000038EA 3C2E cmp al, 46 0 000038EC 7422 je _.L227 901:dosfns.c **** cdsp = get_cds(default_drive); /* if "" or .[\] or \[path] then use current drive */ 1882 .loc 1 901 0 is_stmt 0 discriminator 1 0 000038EE 3C5C cmp al, 92 0 000038F0 7407 je _.L255 0 000038F2 3C2F cmp al, 47 0 000038F4 7403E96401 jne _.L228 1887 _.L255: 901:dosfns.c **** cdsp = get_cds(default_drive); /* if "" or .[\] or \[path] then use current drive */ 1888 .loc 1 901 0 discriminator 2 0 000038F9 8E46EE mov es, word ptr [bp-18] 0 000038FC 268A6401 mov ah, byte ptr es:[si+1] 0 00003900 80FC5C cmp ah, 92 0 00003903 7503E95501 je _.L228 0 00003908 80FC2F cmp ah, 47 0 0000390B 7503E94D01 je _.L228 1895 _.L227: 902:dosfns.c **** else if (DriveString[1] == ':') 1896 .loc 1 902 0 is_stmt 1 0 00003910 A0[0000] mov al, byte ptr [_default_drive] 0 00003913 98 cbw 1899 _.L282: 904:dosfns.c **** 1900 .loc 1 904 0 0 00003914 50 push ax 0 00003915 E8[FEFF] call _get_cds 1903 _.LVL231: 0 00003918 89C6 mov si, ax 1905 _.LVL232: 906:dosfns.c **** return DE_INVLDDRV; 1906 .loc 1 906 0 0 0000391A 09D0 or ax, dx 1908 _.LVL233: 0 0000391C 7503E94601 je _.L233 909:dosfns.c **** { 1910 .loc 1 909 0 0 00003921 8EC2 mov es, dx 0 00003923 26837C4300 cmp word ptr es:[si+67], 0 0 00003928 7C03E90B02 jge _.L235 912:dosfns.c **** { 1914 .loc 1 912 0 0 0000392D 8D7EF6 lea di, [-10+bp] 0 00003930 57 push di 0 00003931 52 push dx 0 00003932 8956EE mov word ptr [bp-18], dx 0 00003935 56 push si 0 00003936 B8A311 mov ax, 4515 0 00003939 50 push ax 0 0000393A E8[FEFF] call _network_redirector_mx 1923 _.LVL234: 0 0000393D 85C0 test ax, ax 0 0000393F 8B4EEE mov cx, word ptr [bp-18] 0 00003942 7503E93901 je _.L236 915:dosfns.c **** return DE_INVLDDRV; 1927 .loc 1 915 0 0 00003947 57 push di 0 00003948 51 push cx 0 00003949 56 push si 0 0000394A B80C11 mov ax, 4364 0 0000394D 50 push ax 0 0000394E E8[FEFF] call _network_redirector_mx 1934 _.LVL235: 0 00003951 85C0 test ax, ax 0 00003953 7403E90F01 jne _.L233 918:dosfns.c **** xfsp->xfs_totalclusters = rg[1]; 1937 .loc 1 918 0 0 00003958 8B56F6 mov dx, word ptr [bp-10] 0 0000395B 8E46F2 mov es, word ptr [bp-14] 0 0000395E 8B5EF4 mov bx, word ptr [bp-12] 0 00003961 26895704 mov word ptr es:[bx+4], dx 1942 _.LVL236: 0 00003965 8E46F2 mov es, word ptr [bp-14] 0 00003968 8B5EF4 mov bx, word ptr [bp-12] 0 0000396B 26894706 mov word ptr es:[bx+6], ax 919:dosfns.c **** xfsp->xfs_secsize = rg[2]; 1946 .loc 1 919 0 0 0000396F 8B56F8 mov dx, word ptr [bp-8] 0 00003972 8E46F2 mov es, word ptr [bp-14] 0 00003975 8B5EF4 mov bx, word ptr [bp-12] 0 00003978 26895710 mov word ptr es:[bx+16], dx 0 0000397C 8E46F2 mov es, word ptr [bp-14] 0 0000397F 8B5EF4 mov bx, word ptr [bp-12] 0 00003982 26894712 mov word ptr es:[bx+18], ax 920:dosfns.c **** xfsp->xfs_freeclusters = rg[3]; 1954 .loc 1 920 0 0 00003986 8B56FA mov dx, word ptr [bp-6] 0 00003989 8E46F2 mov es, word ptr [bp-14] 0 0000398C 8B5EF4 mov bx, word ptr [bp-12] 0 0000398F 26895708 mov word ptr es:[bx+8], dx 0 00003993 8E46F2 mov es, word ptr [bp-14] 0 00003996 8B5EF4 mov bx, word ptr [bp-12] 0 00003999 2689470A mov word ptr es:[bx+10], ax 921:dosfns.c **** } 1962 .loc 1 921 0 0 0000399D 8B56FC mov dx, word ptr [bp-4] 0 000039A0 8E46F2 mov es, word ptr [bp-14] 0 000039A3 8B5EF4 mov bx, word ptr [bp-12] 0 000039A6 2689570C mov word ptr es:[bx+12], dx 0 000039AA 8E46F2 mov es, word ptr [bp-14] 0 000039AD 8B5EF4 mov bx, word ptr [bp-12] 0 000039B0 2689470E mov word ptr es:[bx+14], ax 1970 _.L237: 961:dosfns.c **** xfsp->xfs_freeunits = xfsp->xfs_freeclusters; 1971 .loc 1 961 0 0 000039B4 8E46F2 mov es, word ptr [bp-14] 0 000039B7 8B5EF4 mov bx, word ptr [bp-12] 0 000039BA 268B5F10 mov bx, word ptr es:[bx+16] 0 000039BE 8B7EF4 mov di, word ptr [bp-12] 0 000039C1 268B4512 mov ax, word ptr es:[di+18] 0 000039C5 26895D20 mov word ptr es:[di+32], bx 0 000039C9 8E46F2 mov es, word ptr [bp-14] 0 000039CC 8B7EF4 mov di, word ptr [bp-12] 0 000039CF 26894522 mov word ptr es:[di+34], ax 962:dosfns.c **** xfsp->xfs_totalsectors = xfsp->xfs_totalclusters * xfsp->xfs_clussize; 1981 .loc 1 962 0 0 000039D3 8E46F2 mov es, word ptr [bp-14] 0 000039D6 8B7EF4 mov di, word ptr [bp-12] 0 000039D9 268B7D0C mov di, word ptr es:[di+12] 0 000039DD 8B76F4 mov si, word ptr [bp-12] 0 000039E0 268E5C0E mov ds, word ptr es:[si+14] 0 000039E4 26897C1C mov word ptr es:[si+28], di 0 000039E8 8E46F2 mov es, word ptr [bp-14] 0 000039EB 8B76F4 mov si, word ptr [bp-12] 0 000039EE 268C5C1E mov word ptr es:[si+30], ds 963:dosfns.c **** xfsp->xfs_freesectors = xfsp->xfs_freeclusters * xfsp->xfs_clussize; 1991 .loc 1 963 0 0 000039F2 8E46F2 mov es, word ptr [bp-14] 0 000039F5 8B76F4 mov si, word ptr [bp-12] 0 000039F8 268B5404 mov dx, word ptr es:[si+4] 0 000039FC 8956EC mov word ptr [bp-20], dx 0 000039FF 268B4C06 mov cx, word ptr es:[si+6] 0 00003A03 F7E2 mul dx 0 00003A05 8946EE mov word ptr [bp-18], ax 0 00003A08 89C8 mov ax, cx 0 00003A0A F7E3 mul bx 0 00003A0C 96 xchg si, ax 0 00003A0D 0376EE add si, word ptr [bp-18] 0 00003A10 93 xchg bx, ax 0 00003A11 F766EC mul word ptr [bp-20] 0 00003A14 01D6 add si, dx 0 00003A16 8B5EF4 mov bx, word ptr [bp-12] 0 00003A19 26894718 mov word ptr es:[bx+24], ax 0 00003A1D 8E46F2 mov es, word ptr [bp-14] 0 00003A20 8B5EF4 mov bx, word ptr [bp-12] 0 00003A23 2689771A mov word ptr es:[bx+26], si 964:dosfns.c **** xfsp->xfs_datasize = sizeof(struct xfreespace); 2011 .loc 1 964 0 0 00003A27 8CD8 mov ax, ds 0 00003A29 F766EC mul word ptr [bp-20] 0 00003A2C 93 xchg bx, ax 0 00003A2D 91 xchg cx, ax 0 00003A2E F7E7 mul di 0 00003A30 91 xchg cx, ax 0 00003A31 01D9 add cx, bx 0 00003A33 8B46EC mov ax, word ptr [bp-20] 0 00003A36 F7E7 mul di 0 00003A38 01D1 add cx, dx 0 00003A3A 8E46F2 mov es, word ptr [bp-14] 0 00003A3D 8B5EF4 mov bx, word ptr [bp-12] 0 00003A40 26894714 mov word ptr es:[bx+20], ax 0 00003A44 8E46F2 mov es, word ptr [bp-14] 0 00003A47 8B5EF4 mov bx, word ptr [bp-12] 0 00003A4A 26894F16 mov word ptr es:[bx+22], cx 965:dosfns.c **** 2028 .loc 1 965 0 0 00003A4E 8E46F2 mov es, word ptr [bp-14] 0 00003A51 8B5EF4 mov bx, word ptr [bp-12] 0 00003A54 26C7072C00 mov word ptr es:[bx], 44 967:dosfns.c **** } 2032 .loc 1 967 0 0 00003A59 31C0 xor ax, ax 0 00003A5B EB0D jmp _.L226 2035 _.LVL237: 2036 _.L228: 903:dosfns.c **** cdsp = get_cds(DosUpFChar(*DriveString) - 'A'); /* assume drive specified */ 2037 .loc 1 903 0 0 00003A5D 8E46EE mov es, word ptr [bp-18] 0 00003A60 26807C013A cmp byte ptr es:[si+1], 58 0 00003A65 740D je _.L231 2041 _.LVL238: 2042 _.L233: 907:dosfns.c **** 2043 .loc 1 907 0 0 00003A67 B8F1FF mov ax, -15 2045 _.L226: 968:dosfns.c **** #endif 2046 .loc 1 968 0 0 00003A6A 89EC mov sp, bp 0 00003A6C 5D pop bp 0 00003A6D 5F pop di 0 00003A6E 5E pop si 0 00003A6F 16 push ss 0 00003A70 1F pop ds 0 00003A71 C20800 ret 8 2054 _.LVL239: 2055 _.L231: 904:dosfns.c **** 2056 .loc 1 904 0 0 00003A74 50 push ax 0 00003A75 E8[FEFF] call _DosUpFChar 2059 _.LVL240: 0 00003A78 30E4 xor ah, ah 0 00003A7A 83C0BF add ax, -65 0 00003A7D E994FE jmp _.L282 2063 _.LVL241: 2064 _.L236: 2065 _.LBB46: 928:dosfns.c **** spc = 1; 2066 .loc 1 928 0 0 00003A80 8B7EFE mov di, word ptr [bp-2] 0 00003A83 8946EE mov word ptr [bp-18], ax 2069 _.LVL242: 930:dosfns.c **** avail = (((UDWORD)rg[2] << 16UL) | rg[3]); 2070 .loc 1 930 0 0 00003A86 8B4EF8 mov cx, word ptr [bp-8] 0 00003A89 8B46F6 mov ax, word ptr [bp-10] 2073 _.LVL243: 931:dosfns.c **** 2074 .loc 1 931 0 0 00003A8C 8B56FC mov dx, word ptr [bp-4] 0 00003A8F 8B76FA mov si, word ptr [bp-6] 2077 _.LVL244: 929:dosfns.c **** total = (((UDWORD)rg[0] << 16UL) | rg[1]); 2078 .loc 1 929 0 0 00003A92 C746EC0100 mov word ptr [bp-20], 1 0 00003A97 8B5EEE mov bx, word ptr [bp-18] 0 00003A9A 895EEA mov word ptr [bp-22], bx 2082 _.LVL245: 2083 _.L238: 933:dosfns.c **** spc *= 2; 2084 .loc 1 933 0 0 00003A9D 3DFF00 cmp ax, 255 0 00003AA0 7629 jbe _.L245 0 00003AA2 837EEA00 cmp word ptr [bp-22], 0 0 00003AA6 7523 jne _.L245 0 00003AA8 837EEC7F cmp word ptr [bp-20], 127 0 00003AAC 771D ja _.L245 934:dosfns.c **** avail /= 2; 2091 .loc 1 934 0 0 00003AAE D166EC shl word ptr [bp-20], 1 2093 _.LVL246: 0 00003AB1 D156EA rcl word ptr [bp-22], 1 2095 _.LVL247: 935:dosfns.c **** total /= 2; 2096 .loc 1 935 0 0 00003AB4 D1EE shr si, 1 2098 _.LVL248: 0 00003AB6 D1DA rcr dx, 1 2100 _.LVL249: 936:dosfns.c **** } 2101 .loc 1 936 0 0 00003AB8 D1E8 shr ax, 1 2103 _.LVL250: 0 00003ABA D1D9 rcr cx, 1 2105 _.LVL251: 0 00003ABC EBDF jmp _.L238 2107 _.LVL252: 2108 _.L280: 939:dosfns.c **** avail /= 2; 2109 .loc 1 939 0 0 00003ABE D1E7 shl di, 1 2111 _.LVL253: 0 00003AC0 D156EE rcl word ptr [bp-18], 1 2113 _.LVL254: 940:dosfns.c **** total /= 2; 2114 .loc 1 940 0 0 00003AC3 D1EE shr si, 1 2116 _.LVL255: 0 00003AC5 D1DA rcr dx, 1 2118 _.LVL256: 941:dosfns.c **** } 2119 .loc 1 941 0 0 00003AC7 D1E8 shr ax, 1 2121 _.LVL257: 0 00003AC9 D1D9 rcr cx, 1 2123 _.LVL258: 2124 _.L245: 938:dosfns.c **** bps *= 2; 2125 .loc 1 938 0 0 00003ACB 3DFF00 cmp ax, 255 0 00003ACE 760C jbe _.L257 0 00003AD0 837EEE00 cmp word ptr [bp-18], 0 0 00003AD4 7506 jne _.L257 0 00003AD6 81FFFF7F cmp di, 32767 0 00003ADA 76E2 jbe _.L280 2132 _.L257: 944:dosfns.c **** xfsp->xfs_clussize = spc; 2133 .loc 1 944 0 0 00003ADC 8E46F2 mov es, word ptr [bp-14] 0 00003ADF 8B5EF4 mov bx, word ptr [bp-12] 0 00003AE2 26897F08 mov word ptr es:[bx+8], di 2137 _.LVL259: 0 00003AE6 8E46F2 mov es, word ptr [bp-14] 0 00003AE9 8B5EF4 mov bx, word ptr [bp-12] 0 00003AEC 8B7EEE mov di, word ptr [bp-18] 0 00003AEF 26897F0A mov word ptr es:[bx+10], di 945:dosfns.c **** xfsp->xfs_totalclusters = total; 2142 .loc 1 945 0 0 00003AF3 8E46F2 mov es, word ptr [bp-14] 0 00003AF6 8B5EF4 mov bx, word ptr [bp-12] 0 00003AF9 8B7EEC mov di, word ptr [bp-20] 0 00003AFC 26897F04 mov word ptr es:[bx+4], di 0 00003B00 8E46F2 mov es, word ptr [bp-14] 0 00003B03 8B5EF4 mov bx, word ptr [bp-12] 0 00003B06 8B7EEA mov di, word ptr [bp-22] 0 00003B09 26897F06 mov word ptr es:[bx+6], di 946:dosfns.c **** xfsp->xfs_freeclusters = avail; 2151 .loc 1 946 0 0 00003B0D 8E46F2 mov es, word ptr [bp-14] 0 00003B10 8B5EF4 mov bx, word ptr [bp-12] 0 00003B13 26894F10 mov word ptr es:[bx+16], cx 0 00003B17 8E46F2 mov es, word ptr [bp-14] 0 00003B1A 8B5EF4 mov bx, word ptr [bp-12] 0 00003B1D 26894712 mov word ptr es:[bx+18], ax 947:dosfns.c **** } 2158 .loc 1 947 0 0 00003B21 8E46F2 mov es, word ptr [bp-14] 0 00003B24 8B5EF4 mov bx, word ptr [bp-12] 0 00003B27 2689570C mov word ptr es:[bx+12], dx 0 00003B2B 8E46F2 mov es, word ptr [bp-14] 0 00003B2E 8B5EF4 mov bx, word ptr [bp-12] 0 00003B31 2689770E mov word ptr es:[bx+14], si 0 00003B35 E97CFE jmp _.L237 2166 _.LVL260: 2167 _.L235: 2168 _.LBE46: 952:dosfns.c **** if (dpbp == NULL || media_check(dpbp) < 0) 2169 .loc 1 952 0 0 00003B38 8EC2 mov es, dx 0 00003B3A 268B5C45 mov bx, word ptr es:[si+69] 0 00003B3E 268B7447 mov si, word ptr es:[si+71] 2173 _.LVL261: 953:dosfns.c **** return DE_INVLDDRV; 2174 .loc 1 953 0 0 00003B42 89D8 mov ax, bx 0 00003B44 09F0 or ax, si 0 00003B46 7503E91CFF je _.L233 0 00003B4B 56 push si 0 00003B4C 53 push bx 0 00003B4D 895EEE mov word ptr [bp-18], bx 0 00003B50 E8[FEFF] call _media_check 2182 _.LVL262: 0 00003B53 85C0 test ax, ax 0 00003B55 7D03E90DFF jl _.L233 955:dosfns.c **** xfsp->xfs_totalclusters = 2185 .loc 1 955 0 0 00003B5A 8EC6 mov es, si 0 00003B5C 8B5EEE mov bx, word ptr [bp-18] 0 00003B5F 268B4702 mov ax, word ptr es:[bx+2] 0 00003B63 8E46F2 mov es, word ptr [bp-14] 0 00003B66 8B7EF4 mov di, word ptr [bp-12] 0 00003B69 26894508 mov word ptr es:[di+8], ax 2192 _.LVL263: 0 00003B6D 8E46F2 mov es, word ptr [bp-14] 0 00003B70 8B7EF4 mov di, word ptr [bp-12] 0 00003B73 8B46EC mov ax, word ptr [bp-20] 0 00003B76 2689450A mov word ptr es:[di+10], ax 957:dosfns.c **** xfsp->xfs_freeclusters = dos_free(dpbp); 2197 .loc 1 957 0 0 00003B7A 8EC6 mov es, si 0 00003B7C 26837F0F00 cmp word ptr es:[bx+15], 0 0 00003B81 7562 jne _.L253 957:dosfns.c **** xfsp->xfs_freeclusters = dos_free(dpbp); 2201 .loc 1 957 0 is_stmt 0 discriminator 1 0 00003B83 268B472D mov ax, word ptr es:[bx+45] 0 00003B87 268B572F mov dx, word ptr es:[bx+47] 2204 _.L283: 957:dosfns.c **** xfsp->xfs_freeclusters = dos_free(dpbp); 2205 .loc 1 957 0 discriminator 2 0 00003B8B 83C0FF add ax, -1 0 00003B8E 83D2FF adc dx, -1 956:dosfns.c **** (ISFAT32(dpbp) ? dpbp->dpb_xsize : dpbp->dpb_size) - 1; 2208 .loc 1 956 0 is_stmt 1 discriminator 2 0 00003B91 8E46F2 mov es, word ptr [bp-14] 0 00003B94 8B7EF4 mov di, word ptr [bp-12] 0 00003B97 26894510 mov word ptr es:[di+16], ax 0 00003B9B 8E46F2 mov es, word ptr [bp-14] 0 00003B9E 8B7EF4 mov di, word ptr [bp-12] 0 00003BA1 26895512 mov word ptr es:[di+18], dx 958:dosfns.c **** xfsp->xfs_clussize = dpbp->dpb_clsmask + 1; 2215 .loc 1 958 0 discriminator 2 0 00003BA5 56 push si 0 00003BA6 53 push bx 0 00003BA7 895EEE mov word ptr [bp-18], bx 0 00003BAA E8[FEFF] call _dos_free 2220 _.LVL264: 0 00003BAD 8E46F2 mov es, word ptr [bp-14] 0 00003BB0 8B5EF4 mov bx, word ptr [bp-12] 0 00003BB3 2689470C mov word ptr es:[bx+12], ax 0 00003BB7 8E46F2 mov es, word ptr [bp-14] 0 00003BBA 8B5EF4 mov bx, word ptr [bp-12] 0 00003BBD 2689570E mov word ptr es:[bx+14], dx 959:dosfns.c **** } 2227 .loc 1 959 0 discriminator 2 0 00003BC1 8EC6 mov es, si 0 00003BC3 8B5EEE mov bx, word ptr [bp-18] 0 00003BC6 268A4704 mov al, byte ptr es:[bx+4] 0 00003BCA 30E4 xor ah, ah 0 00003BCC 40 inc ax 0 00003BCD 99 cwd 0 00003BCE 8E46F2 mov es, word ptr [bp-14] 0 00003BD1 8B5EF4 mov bx, word ptr [bp-12] 0 00003BD4 26894704 mov word ptr es:[bx+4], ax 0 00003BD8 8E46F2 mov es, word ptr [bp-14] 0 00003BDB 8B5EF4 mov bx, word ptr [bp-12] 0 00003BDE 26895706 mov word ptr es:[bx+6], dx 0 00003BE2 E9CFFD jmp _.L237 2241 _.L253: 957:dosfns.c **** xfsp->xfs_freeclusters = dos_free(dpbp); 2242 .loc 1 957 0 discriminator 2 0 00003BE5 8EC6 mov es, si 0 00003BE7 268B470D mov ax, word ptr es:[bx+13] 0 00003BEB 8B56EC mov dx, word ptr [bp-20] 0 00003BEE EB9B jmp _.L283 2247 _.LFE30: 2248 .size _DosGetExtFree, .-_DosGetExtFree 2249 .global _DosGetCuDir 2250 .type _DosGetCuDir, @function 2251 _DosGetCuDir: 2252 _.LFB31: 972:dosfns.c **** char path[3]; 2253 .loc 1 972 0 2254 _.LVL265: 0 00003BF0 56 push si 0 00003BF1 57 push di 0 00003BF2 55 push bp 2258 _.LCFI52: 0 00003BF3 89E5 mov bp, sp 2260 _.LCFI53: 0 00003BF5 1E push ds 0 00003BF6 1E push ds 0 00003BF7 8B7E0A mov di, word ptr [bp+10] 0 00003BFA 8B760C mov si, word ptr [bp+12] 2265 _.LVL266: 975:dosfns.c **** drive = default_drive; 2266 .loc 1 975 0 0 00003BFD 807E0800 cmp byte ptr [bp+8], 0 0 00003C01 7439 je _.L285 0 00003C03 8A4608 mov al, byte ptr [bp+8] 0 00003C06 FEC8 dec al 2271 _.LVL267: 2272 _.L286: 977:dosfns.c **** path[1] = ':'; 2273 .loc 1 977 0 0 00003C08 241F and al, 31 2275 _.LVL268: 0 00003C0A 0441 add al, 65 0 00003C0C 8846FD mov byte ptr [bp-3], al 979:dosfns.c **** 2278 .loc 1 979 0 0 00003C0F C746FE3A00 mov word ptr [bp-2], 58 981:dosfns.c **** return DE_INVLDDRV; 2280 .loc 1 981 0 0 00003C14 B80100 mov ax, 1 0 00003C17 50 push ax 0 00003C18 B8[0000] mov ax, offset __PriPathBuffer 0 00003C1B 50 push ax 0 00003C1C 8D46FD lea ax, [-3+bp] 0 00003C1F 16 push ss 0 00003C20 50 push ax 0 00003C21 E8[FEFF] call _truename 2289 _.LVL269: 0 00003C24 85C0 test ax, ax 0 00003C26 7C19 jl _.L288 985:dosfns.c **** return SUCCESS; 2292 .loc 1 985 0 0 00003C28 16 push ss 0 00003C29 B8[0300] mov ax, offset __PriPathBuffer+3 0 00003C2C 50 push ax 0 00003C2D 56 push si 0 00003C2E 57 push di 0 00003C2F E8[FEFF] call _fstrcpy 2299 _.LVL270: 986:dosfns.c **** } 2300 .loc 1 986 0 0 00003C32 31C0 xor ax, ax 2302 _.L284: 987:dosfns.c **** 2303 .loc 1 987 0 0 00003C34 89EC mov sp, bp 0 00003C36 5D pop bp 0 00003C37 5F pop di 0 00003C38 5E pop si 0 00003C39 C20600 ret 6 2309 _.LVL271: 2310 _.L285: 976:dosfns.c **** path[0] = 'A' + (drive & 0x1f); 2311 .loc 1 976 0 0 00003C3C A0[0000] mov al, byte ptr [_default_drive] 2313 _.LVL272: 0 00003C3F EBC7 jmp _.L286 2315 _.LVL273: 2316 _.L288: 982:dosfns.c **** 2317 .loc 1 982 0 0 00003C41 B8F1FF mov ax, -15 0 00003C44 EBEE jmp _.L284 2320 _.LFE31: 2321 .size _DosGetCuDir, .-_DosGetCuDir 2322 .global _DosChangeDir 2323 .type _DosChangeDir, @function 2324 _DosChangeDir: 2325 _.LFB32: 991:dosfns.c **** COUNT result; 2326 .loc 1 991 0 2327 _.LVL274: 0 00003C46 56 push si 0 00003C47 57 push di 0 00003C48 55 push bp 2331 _.LCFI54: 0 00003C49 89E5 mov bp, sp 2333 _.LCFI55: 0 00003C4B 1E push ds 994:dosfns.c **** if (result < SUCCESS) 2335 .loc 1 994 0 0 00003C4C B80200 mov ax, 2 0 00003C4F 50 push ax 0 00003C50 BE[0000] mov si, offset __PriPathBuffer 0 00003C53 56 push si 0 00003C54 FF760A push word ptr [bp+10] 0 00003C57 FF7608 push word ptr [bp+8] 0 00003C5A E8[FEFF] call _truename 2343 _.LVL275: 995:dosfns.c **** return DE_PATHNOTFND; 2344 .loc 1 995 0 0 00003C5D 85C0 test ax, ax 0 00003C5F 7D0B jge _.L291 2347 _.LVL276: 2348 _.L296: 996:dosfns.c **** 2349 .loc 1 996 0 0 00003C61 B8FDFF mov ax, -3 2351 _.LVL277: 2352 _.L290: 1030:dosfns.c **** 2353 .loc 1 1030 0 0 00003C64 89EC mov sp, bp 0 00003C66 5D pop bp 0 00003C67 5F pop di 0 00003C68 5E pop si 0 00003C69 C20400 ret 4 2359 _.LVL278: 2360 _.L291: 0 00003C6C 97 xchg di, ax 998:dosfns.c **** 2362 .loc 1 998 0 0 00003C6D E887F8 call _set_fcbname 2364 _.LVL279: 1000:dosfns.c **** (strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath))) 2365 .loc 1 1000 0 0 00003C70 833E[0000]FF cmp word ptr [_current_ldt], -1 0 00003C75 720C jc _.L293 2368 _.L297: 1009:dosfns.c **** dos_cd(PriPathName)); 2369 .loc 1 1009 0 0 00003C77 F7C74000 test di, 64 0 00003C7B 7511 jne _.L294 1009:dosfns.c **** dos_cd(PriPathName)); 2372 .loc 1 1009 0 is_stmt 0 discriminator 2 0 00003C7D 56 push si 0 00003C7E E8[FEFF] call _dos_cd 2375 _.LVL280: 0 00003C81 EB12 jmp _.L298 2377 _.L293: 1001:dosfns.c **** return DE_PATHNOTFND; 2378 .loc 1 1001 0 is_stmt 1 discriminator 1 0 00003C83 56 push si 0 00003C84 E8[FEFF] call _strlen 2381 _.LVL281: 1000:dosfns.c **** (strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath))) 2382 .loc 1 1000 0 discriminator 1 0 00003C87 83F842 cmp ax, 66 0 00003C8A 76EB jbe _.L297 0 00003C8C EBD3 jmp _.L296 2386 _.L294: 1009:dosfns.c **** dos_cd(PriPathName)); 2387 .loc 1 1009 0 discriminator 1 0 00003C8E B80511 mov ax, 4357 0 00003C91 50 push ax 0 00003C92 E8[FEFF] call _network_redirector 2391 _.LVL282: 2392 _.L298: 1014:dosfns.c **** return result; 2393 .loc 1 1014 0 discriminator 4 0 00003C95 85C0 test ax, ax 0 00003C97 75CB jne _.L290 1023:dosfns.c **** { 2396 .loc 1 1023 0 0 00003C99 8B16[0000] mov dx, word ptr [_current_ldt] 0 00003C9D 8B0E[0200] mov cx, word ptr [_current_ldt+2] 0 00003CA1 83FAFF cmp dx, -1 0 00003CA4 74BE je _.L290 0 00003CA6 8946FE mov word ptr [bp-2], ax 1025:dosfns.c **** if (PriPathName[7] == 0) 2402 .loc 1 1025 0 0 00003CA9 16 push ss 0 00003CAA 56 push si 0 00003CAB 51 push cx 0 00003CAC 52 push dx 0 00003CAD E8[FEFF] call _fstrcpy 2408 _.LVL283: 1026:dosfns.c **** current_ldt->cdsCurrentPath[8] = 0; /* Need two Zeros at the end */ 2409 .loc 1 1026 0 0 00003CB0 807C0700 cmp byte ptr [si+7], 0 0 00003CB4 8B46FE mov ax, word ptr [bp-2] 0 00003CB7 75AB jne _.L290 1027:dosfns.c **** } 2413 .loc 1 1027 0 0 00003CB9 C41E[0000] les bx, dword ptr [_current_ldt] 0 00003CBD 26884708 mov byte ptr es:[bx+8], al 2416 _.LVL284: 0 00003CC1 EBA1 jmp _.L290 2418 _.LFE32: 2419 .size _DosChangeDir, .-_DosChangeDir 2420 .global _DosFindFirst 2421 .type _DosFindFirst, @function 2422 _DosFindFirst: 2423 _.LFB34: 1048:dosfns.c **** int rc; 2424 .loc 1 1048 0 2425 _.LVL285: 0 00003CC3 56 push si 0 00003CC4 57 push di 0 00003CC5 55 push bp 2429 _.LCFI56: 0 00003CC6 89E5 mov bp, sp 2431 _.LCFI57: 0 00003CC8 83EC06 sub sp, 6 1050:dosfns.c **** 2433 .loc 1 1050 0 0 00003CCB C406[0000] les ax, dword ptr [_dta] 0 00003CCF 8946FC mov word ptr [bp-4], ax 0 00003CD2 8C46FA mov word ptr [bp-6], es 2437 _.LVL286: 1052:dosfns.c **** CDS_MODE_CHECK_DEV_PATH | CDS_MODE_ALLOW_WILDCARDS); 2438 .loc 1 1052 0 0 00003CD5 B80600 mov ax, 6 2440 _.LVL287: 0 00003CD8 50 push ax 0 00003CD9 BF[0000] mov di, offset __PriPathBuffer 0 00003CDC 57 push di 0 00003CDD FF760C push word ptr [bp+12] 0 00003CE0 FF760A push word ptr [bp+10] 0 00003CE3 E8[FEFF] call _truename 2447 _.LVL288: 0 00003CE6 89C6 mov si, ax 2449 _.LVL289: 1054:dosfns.c **** return rc; 2450 .loc 1 1054 0 0 00003CE8 85C0 test ax, ax 0 00003CEA 7D03E9A900 jl _.L303 1057:dosfns.c **** 2453 .loc 1 1057 0 0 00003CEF E805F8 call _set_fcbname 2455 _.LVL290: 1067:dosfns.c **** 2456 .loc 1 1067 0 0 00003CF2 8A4608 mov al, byte ptr [bp+8] 0 00003CF5 A2[0000] mov byte ptr [_SAttr], al 1073:dosfns.c **** memset(&sda_tmp_dm, 0, sizeof(dmatch)+sizeof(struct dirent)); 2459 .loc 1 1073 0 0 00003CF8 B8[0000] mov ax, offset _sda_tmp_dm 0 00003CFB A3[0000] mov word ptr [_dta], ax 0 00003CFE 8C16[0200] mov word ptr [_dta+2], ss 1074:dosfns.c **** 2463 .loc 1 1074 0 0 00003D02 BA4B00 mov dx, 75 0 00003D05 52 push dx 0 00003D06 31D2 xor dx, dx 0 00003D08 52 push dx 0 00003D09 50 push ax 0 00003D0A E8[FEFF] call _memset 2470 _.LVL291: 1076:dosfns.c **** rc = network_redirector_fp(REM_FINDFIRST, current_ldt); 2471 .loc 1 1076 0 0 00003D0D 89F1 mov cx, si 0 00003D0F 83E140 and cx, 64 0 00003D12 7412 je _.L305 1077:dosfns.c **** else if (rc & IS_DEVICE) 2475 .loc 1 1077 0 0 00003D14 FF36[0200] push word ptr [_current_ldt+2] 0 00003D18 FF36[0000] push word ptr [_current_ldt] 0 00003D1C B81B11 mov ax, 4379 0 00003D1F 50 push ax 0 00003D20 E8[FEFF] call _network_redirector_fp 2481 _.LVL292: 2482 _.L317: 1097:dosfns.c **** 2483 .loc 1 1097 0 0 00003D23 96 xchg si, ax 2485 _.LVL293: 0 00003D24 EB5B jmp _.L306 2487 _.LVL294: 2488 _.L305: 0 00003D26 894EFE mov word ptr [bp-2], cx 1078:dosfns.c **** { 2490 .loc 1 1078 0 0 00003D29 F7C62000 test si, 32 0 00003D2D 7472 je _.L307 2493 _.LBB50: 1084:dosfns.c **** /* Found a matching device. Hence there cannot be wildcards. */ 2494 .loc 1 1084 0 0 00003D2F C706[0D00]FFFF mov word ptr [_sda_tmp_dm+13], -1 1086:dosfns.c **** SearchDir.dir_time = dos_gettime(); 2496 .loc 1 1086 0 0 00003D35 BE[0000] mov si, offset _SearchDir 2498 _.LVL295: 0 00003D38 C606[0B00]40 mov byte ptr [_SearchDir+11], 64 1087:dosfns.c **** SearchDir.dir_date = dos_getdate(); 2500 .loc 1 1087 0 0 00003D3D E8[FEFF] call _dos_gettime 2502 _.LVL296: 0 00003D40 894416 mov word ptr [si+22], ax 1088:dosfns.c **** p = (char *)FP_OFF(get_root(PriPathName)); 2504 .loc 1 1088 0 0 00003D43 E8[FEFF] call _dos_getdate 2506 _.LVL297: 0 00003D46 894418 mov word ptr [si+24], ax 1089:dosfns.c **** memset(SearchDir.dir_name, ' ', FNAME_SIZE + FEXT_SIZE); 2508 .loc 1 1089 0 0 00003D49 16 push ss 0 00003D4A 57 push di 0 00003D4B E8[FEFF] call _get_root 2512 _.LVL298: 0 00003D4E 97 xchg di, ax 2514 _.LVL299: 1090:dosfns.c **** for (i = 0; i < FNAME_SIZE && *p && *p != '.'; i++) 2515 .loc 1 1090 0 0 00003D4F B80B00 mov ax, 11 2517 _.LVL300: 0 00003D52 50 push ax 0 00003D53 B82000 mov ax, 32 0 00003D56 50 push ax 0 00003D57 56 push si 0 00003D58 E8[FEFF] call _memset 2523 _.LVL301: 1091:dosfns.c **** SearchDir.dir_name[i] = *p++; 2524 .loc 1 1091 0 0 00003D5B 8B4EFE mov cx, word ptr [bp-2] 0 00003D5E 8EC6 mov es, si 2527 _.LVL302: 2528 _.L308: 1091:dosfns.c **** SearchDir.dir_name[i] = *p++; 2529 .loc 1 1091 0 is_stmt 0 discriminator 3 0 00003D60 8B76FE mov si, word ptr [bp-2] 0 00003D63 89FB mov bx, di 0 00003D65 8A00 mov al, byte ptr [bx+si] 0 00003D67 84C0 test al, al 0 00003D69 7414 je _.L311 2535 _.LVL303: 0 00003D6B 3C2E cmp al, 46 0 00003D6D 7410 je _.L311 2538 _.LVL304: 1092:dosfns.c **** rc = SUCCESS; 2539 .loc 1 1092 0 is_stmt 1 discriminator 5 0 00003D6F 8CC6 mov si, es 0 00003D71 8B5EFE mov bx, word ptr [bp-2] 2542 _.LVL305: 0 00003D74 8800 mov byte ptr [bx+si], al 1091:dosfns.c **** SearchDir.dir_name[i] = *p++; 2544 .loc 1 1091 0 discriminator 5 0 00003D76 FF46FE inc word ptr [bp-2] 2546 _.LVL306: 0 00003D79 837EFE08 cmp word ptr [bp-2], 8 0 00003D7D 75E1 jne _.L308 2549 _.LVL307: 2550 _.L311: 1093:dosfns.c **** /* /// End of additions. - Ron Cemer ; heavily edited - Bart Oldeman */ 2551 .loc 1 1093 0 0 00003D7F 89CE mov si, cx 2553 _.LVL308: 2554 _.L306: 2555 _.LBE50: 2556 _.LBB51: 2557 _.LBB52: 1034:dosfns.c **** if (rc == SUCCESS) 2558 .loc 1 1034 0 0 00003D81 8B46FC mov ax, word ptr [bp-4] 0 00003D84 A3[0000] mov word ptr [_dta], ax 0 00003D87 8B46FA mov ax, word ptr [bp-6] 0 00003D8A A3[0200] mov word ptr [_dta+2], ax 1035:dosfns.c **** { 2563 .loc 1 1035 0 0 00003D8D 85F6 test si, si 0 00003D8F 7507 jne _.L303 2566 _.LVL309: 0 00003D91 50 push ax 0 00003D92 FF76FC push word ptr [bp-4] 0 00003D95 E8B1F1 call _pop_dmp.part.0 2570 _.LVL310: 2571 _.L303: 2572 _.LBE52: 2573 _.LBE51: 1100:dosfns.c **** 2574 .loc 1 1100 0 0 00003D98 96 xchg si, ax 0 00003D99 89EC mov sp, bp 0 00003D9B 5D pop bp 0 00003D9C 5F pop di 0 00003D9D 5E pop si 0 00003D9E C20600 ret 6 2581 _.LVL311: 2582 _.L307: 1097:dosfns.c **** 2583 .loc 1 1097 0 0 00003DA1 57 push di 0 00003DA2 FF7608 push word ptr [bp+8] 0 00003DA5 E8[FEFF] call _dos_findfirst 2587 _.LVL312: 0 00003DA8 E978FF jmp _.L317 2589 _.LFE34: 2590 .size _DosFindFirst, .-_DosFindFirst 2591 .global _DosFindNext 2592 .type _DosFindNext, @function 2593 _DosFindNext: 2594 _.LFB35: 1103:dosfns.c **** COUNT rc; 2595 .loc 1 1103 0 0 00003DAB 56 push si 0 00003DAC 57 push di 0 00003DAD 55 push bp 2599 _.LCFI58: 0 00003DAE 89E5 mov bp, sp 2601 _.LCFI59: 0 00003DB0 1E push ds 0 00003DB1 1E push ds 1105:dosfns.c **** 2604 .loc 1 1105 0 0 00003DB2 8B3E[0000] mov di, word ptr [_dta] 0 00003DB6 A1[0200] mov ax, word ptr [_dta+2] 0 00003DB9 8946FC mov word ptr [bp-4], ax 2608 _.LVL313: 1127:dosfns.c **** 2609 .loc 1 1127 0 0 00003DBC BB[0000] mov bx, offset _sda_tmp_dm 0 00003DBF 8CD6 mov si, ss 0 00003DC1 B81500 mov ax, 21 2613 _.LVL314: 0 00003DC4 50 push ax 0 00003DC5 FF76FC push word ptr [bp-4] 0 00003DC8 57 push di 0 00003DC9 16 push ss 0 00003DCA 53 push bx 0 00003DCB 895EFE mov word ptr [bp-2], bx 0 00003DCE E8[FEFF] call _fmemcpy 2621 _.LVL315: 1130:dosfns.c **** || (!(sda_tmp_dm.dm_drive & 0x80) && sda_tmp_dm.dm_entry == 0xffff)) 2622 .loc 1 1130 0 0 00003DD1 8B5EFE mov bx, word ptr [bp-2] 0 00003DD4 8A470C mov al, byte ptr [bx+12] 0 00003DD7 259E00 and ax, 158 0 00003DDA 83F808 cmp ax, 8 0 00003DDD 745D je _.L324 1131:dosfns.c **** return DE_NFILES; 2628 .loc 1 1131 0 0 00003DDF 803F00 cmp byte ptr [bx], 0 0 00003DE2 7C06 jl _.L320 1131:dosfns.c **** return DE_NFILES; 2631 .loc 1 1131 0 is_stmt 0 discriminator 1 0 00003DE4 837F0DFF cmp word ptr [bx+13], -1 0 00003DE8 7452 je _.L324 2634 _.L320: 0 00003DEA 895EFE mov word ptr [bp-2], bx 1134:dosfns.c **** dta = &sda_tmp_dm; 2636 .loc 1 1134 0 is_stmt 1 0 00003DED B82000 mov ax, 32 0 00003DF0 50 push ax 0 00003DF1 31C0 xor ax, ax 0 00003DF3 50 push ax 0 00003DF4 B8[0000] mov ax, offset _SearchDir 0 00003DF7 50 push ax 0 00003DF8 E8[FEFF] call _memset 2644 _.LVL316: 1135:dosfns.c **** rc = (sda_tmp_dm.dm_drive & 0x80) ? 2645 .loc 1 1135 0 0 00003DFB 8B5EFE mov bx, word ptr [bp-2] 0 00003DFE 891E[0000] mov word ptr [_dta], bx 0 00003E02 8936[0200] mov word ptr [_dta+2], si 1137:dosfns.c **** 2649 .loc 1 1137 0 0 00003E06 BB[0000] mov bx, offset _sda_tmp_dm 0 00003E09 803F00 cmp byte ptr [bx], 0 0 00003E0C 7D29 jge _.L321 1137:dosfns.c **** 2653 .loc 1 1137 0 is_stmt 0 discriminator 1 0 00003E0E 56 push si 0 00003E0F 53 push bx 0 00003E10 B81C11 mov ax, 4380 0 00003E13 50 push ax 0 00003E14 E8[FEFF] call _network_redirector_fp 2659 _.LVL317: 2660 _.L322: 2661 _.LBB55: 2662 _.LBB56: 1034:dosfns.c **** if (rc == SUCCESS) 2663 .loc 1 1034 0 is_stmt 1 0 00003E17 893E[0000] mov word ptr [_dta], di 0 00003E1B 8B56FC mov dx, word ptr [bp-4] 0 00003E1E 8916[0200] mov word ptr [_dta+2], dx 1035:dosfns.c **** { 2667 .loc 1 1035 0 0 00003E22 85C0 test ax, ax 0 00003E24 750B jne _.L318 0 00003E26 8946FE mov word ptr [bp-2], ax 0 00003E29 52 push dx 0 00003E2A 57 push di 0 00003E2B E81BF1 call _pop_dmp.part.0 2674 _.LVL318: 0 00003E2E 8B46FE mov ax, word ptr [bp-2] 2676 _.LVL319: 2677 _.L318: 2678 _.LBE56: 2679 _.LBE55: 1140:dosfns.c **** 2680 .loc 1 1140 0 0 00003E31 89EC mov sp, bp 0 00003E33 5D pop bp 2683 _.LVL320: 0 00003E34 5F pop di 2685 _.LVL321: 0 00003E35 5E pop si 0 00003E36 C3 ret 2688 _.LVL322: 2689 _.L321: 1137:dosfns.c **** 2690 .loc 1 1137 0 discriminator 2 0 00003E37 E8[FEFF] call _dos_findnext 2692 _.LVL323: 0 00003E3A EBDB jmp _.L322 2694 _.L324: 1132:dosfns.c **** 2695 .loc 1 1132 0 0 00003E3C B8EEFF mov ax, -18 0 00003E3F EBF0 jmp _.L318 2698 _.LFE35: 2699 .size _DosFindNext, .-_DosFindNext 2700 .global _DosGetFtime 2701 .type _DosGetFtime, @function 2702 _DosGetFtime: 2703 _.LFB36: 1143:dosfns.c **** sft FAR *s; 2704 .loc 1 1143 0 2705 _.LVL324: 0 00003E41 56 push si 0 00003E42 55 push bp 2708 _.LCFI60: 0 00003E43 89E5 mov bp, sp 2710 _.LCFI61: 1148:dosfns.c **** return DE_INVLDHNDL; 2711 .loc 1 1148 0 0 00003E45 FF7606 push word ptr [bp+6] 0 00003E48 E8[FEFF] call _get_sft 2714 _.LVL325: 0 00003E4B 83F8FF cmp ax, -1 0 00003E4E 741E je _.L328 0 00003E50 93 xchg bx, ax 1151:dosfns.c **** *tp = s->sft_time; 2718 .loc 1 1151 0 0 00003E51 8EC2 mov es, dx 0 00003E53 268B470F mov ax, word ptr es:[bx+15] 2721 _.LVL326: 0 00003E57 8B7608 mov si, word ptr [bp+8] 0 00003E5A 8904 mov word ptr [si], ax 1152:dosfns.c **** return SUCCESS; 2724 .loc 1 1152 0 0 00003E5C 268B470D mov ax, word ptr es:[bx+13] 0 00003E60 8B5E0A mov bx, word ptr [bp+10] 2727 _.LVL327: 0 00003E63 8907 mov word ptr [bx], ax 1153:dosfns.c **** } 2729 .loc 1 1153 0 0 00003E65 31C0 xor ax, ax 2731 _.L326: 1154:dosfns.c **** 2732 .loc 1 1154 0 0 00003E67 89EC mov sp, bp 0 00003E69 5D pop bp 0 00003E6A 5E pop si 0 00003E6B C20600 ret 6 2737 _.LVL328: 2738 _.L328: 1149:dosfns.c **** 2739 .loc 1 1149 0 0 00003E6E B8FAFF mov ax, -6 2741 _.LVL329: 0 00003E71 EBF4 jmp _.L326 2743 _.LFE36: 2744 .size _DosGetFtime, .-_DosGetFtime 2745 .global _DosSetFtimeSft 2746 .type _DosSetFtimeSft, @function 2747 _DosSetFtimeSft: 2748 _.LFB37: 1157:dosfns.c **** /* Get the SFT block that contains the SFT */ 2749 .loc 1 1157 0 2750 _.LVL330: 0 00003E73 55 push bp 2752 _.LCFI62: 0 00003E74 89E5 mov bp, sp 2754 _.LCFI63: 1159:dosfns.c **** 2755 .loc 1 1159 0 0 00003E76 FF7604 push word ptr [bp+4] 0 00003E79 E8[FEFF] call _idx_to_sft 2758 _.LVL331: 1161:dosfns.c **** return DE_INVLDHNDL; 2759 .loc 1 1161 0 0 00003E7C 83F8FF cmp ax, -1 0 00003E7F 7429 je _.L332 0 00003E81 93 xchg bx, ax 1165:dosfns.c **** return SUCCESS; 2763 .loc 1 1165 0 0 00003E82 8EC2 mov es, dx 0 00003E84 268B4F05 mov cx, word ptr es:[bx+5] 0 00003E88 89C8 mov ax, cx 2767 _.LVL332: 0 00003E8A 258000 and ax, 128 0 00003E8D 7520 jne _.L333 1168:dosfns.c **** s->sft_date = dp; 2770 .loc 1 1168 0 0 00003E8F 80CD40 or ch, 64 0 00003E92 26894F05 mov word ptr es:[bx+5], cx 2773 _.LVL333: 1169:dosfns.c **** s->sft_time = tp; 2774 .loc 1 1169 0 0 00003E96 8B4E06 mov cx, word ptr [bp+6] 0 00003E99 26894F0F mov word ptr es:[bx+15], cx 1170:dosfns.c **** 2777 .loc 1 1170 0 0 00003E9D 8B4E08 mov cx, word ptr [bp+8] 0 00003EA0 26894F0D mov word ptr es:[bx+13], cx 2780 _.LVL334: 2781 _.L330: 1173:dosfns.c **** 2782 .loc 1 1173 0 0 00003EA4 89EC mov sp, bp 0 00003EA6 5D pop bp 0 00003EA7 C20600 ret 6 2786 _.LVL335: 2787 _.L332: 1162:dosfns.c **** 2788 .loc 1 1162 0 0 00003EAA B8FAFF mov ax, -6 2790 _.LVL336: 0 00003EAD EBF5 jmp _.L330 2792 _.LVL337: 2793 _.L333: 1166:dosfns.c **** 2794 .loc 1 1166 0 0 00003EAF 31C0 xor ax, ax 0 00003EB1 EBF1 jmp _.L330 2797 _.LFE37: 2798 .size _DosSetFtimeSft, .-_DosSetFtimeSft 2799 .global _DosGetFattr 2800 .type _DosGetFattr, @function 2801 _DosGetFattr: 2802 _.LFB38: 1176:dosfns.c **** COUNT result; 2803 .loc 1 1176 0 2804 _.LVL338: 0 00003EB3 56 push si 0 00003EB4 55 push bp 2807 _.LCFI64: 0 00003EB5 89E5 mov bp, sp 2809 _.LCFI65: 0 00003EB7 1E push ds 1179:dosfns.c **** if (result < SUCCESS) 2811 .loc 1 1179 0 0 00003EB8 B80200 mov ax, 2 0 00003EBB 50 push ax 0 00003EBC BE[0000] mov si, offset __PriPathBuffer 0 00003EBF 56 push si 0 00003EC0 FF7608 push word ptr [bp+8] 0 00003EC3 FF7606 push word ptr [bp+6] 0 00003EC6 E8[FEFF] call _truename 2819 _.LVL339: 1180:dosfns.c **** return result; 2820 .loc 1 1180 0 0 00003EC9 85C0 test ax, ax 0 00003ECB 7C1A jl _.L335 1192:dosfns.c **** return 0x10; 2823 .loc 1 1192 0 0 00003ECD 807C0300 cmp byte ptr [si+3], 0 0 00003ED1 7425 je _.L338 0 00003ED3 8946FE mov word ptr [bp-2], ax 1195:dosfns.c **** 2827 .loc 1 1195 0 0 00003ED6 E81EF6 call _set_fcbname 2829 _.LVL340: 1197:dosfns.c **** return network_redirector(REM_GETATTRZ); 2830 .loc 1 1197 0 0 00003ED9 8B46FE mov ax, word ptr [bp-2] 0 00003EDC A840 test al, 64 0 00003EDE 740E je _.L337 1198:dosfns.c **** 2834 .loc 1 1198 0 0 00003EE0 B80F11 mov ax, 4367 0 00003EE3 50 push ax 0 00003EE4 E8[FEFF] call _network_redirector 2838 _.LVL341: 2839 _.L335: 1204:dosfns.c **** 2840 .loc 1 1204 0 0 00003EE7 89EC mov sp, bp 0 00003EE9 5D pop bp 0 00003EEA 5E pop si 0 00003EEB C20400 ret 4 2845 _.LVL342: 2846 _.L337: 1200:dosfns.c **** return DE_FILENOTFND; 2847 .loc 1 1200 0 0 00003EEE A820 test al, 32 0 00003EF0 750B jne _.L339 1203:dosfns.c **** } 2850 .loc 1 1203 0 0 00003EF2 56 push si 0 00003EF3 E8[FEFF] call _dos_getfattr 2853 _.LVL343: 0 00003EF6 EBEF jmp _.L335 2855 _.LVL344: 2856 _.L338: 1193:dosfns.c **** 2857 .loc 1 1193 0 0 00003EF8 B81000 mov ax, 16 2859 _.LVL345: 0 00003EFB EBEA jmp _.L335 2861 _.LVL346: 2862 _.L339: 1201:dosfns.c **** 2863 .loc 1 1201 0 0 00003EFD B8FEFF mov ax, -2 0 00003F00 EBE5 jmp _.L335 2866 _.LFE38: 2867 .size _DosGetFattr, .-_DosGetFattr 2868 .global _DosSetFattr 2869 .type _DosSetFattr, @function 2870 _DosSetFattr: 2871 _.LFB39: 1210:dosfns.c **** COUNT result; 2872 .loc 1 1210 0 2873 _.LVL347: 0 00003F02 56 push si 0 00003F03 57 push di 0 00003F04 55 push bp 2877 _.LCFI66: 0 00003F05 89E5 mov bp, sp 2879 _.LCFI67: 0 00003F07 1E push ds 1213:dosfns.c **** if (result < SUCCESS) 2881 .loc 1 1213 0 0 00003F08 BE0200 mov si, 2 0 00003F0B 56 push si 0 00003F0C BF[0000] mov di, offset __PriPathBuffer 0 00003F0F 57 push di 0 00003F10 FF760A push word ptr [bp+10] 0 00003F13 FF7608 push word ptr [bp+8] 0 00003F16 E8[FEFF] call _truename 2889 _.LVL348: 1214:dosfns.c **** return result; 2890 .loc 1 1214 0 0 00003F19 85C0 test ax, ax 0 00003F1B 7C1B jl _.L341 0 00003F1D 8946FE mov word ptr [bp-2], ax 1217:dosfns.c **** 2894 .loc 1 1217 0 0 00003F20 E8D4F5 call _set_fcbname 2896 _.LVL349: 1219:dosfns.c **** return remote_setfattr(attrp); 2897 .loc 1 1219 0 0 00003F23 8B46FE mov ax, word ptr [bp-2] 0 00003F26 A840 test al, 64 0 00003F28 7416 je _.L343 1220:dosfns.c **** 2901 .loc 1 1220 0 0 00003F2A FF760C push word ptr [bp+12] 0 00003F2D 31C0 xor ax, ax 0 00003F2F 50 push ax 0 00003F30 50 push ax 0 00003F31 B80E11 mov ax, 4366 0 00003F34 50 push ax 0 00003F35 E8[FEFF] call _network_redirector_mx 2909 _.LVL350: 2910 _.L341: 1237:dosfns.c **** 2911 .loc 1 1237 0 0 00003F38 89EC mov sp, bp 0 00003F3A 5D pop bp 0 00003F3B 5F pop di 0 00003F3C 5E pop si 0 00003F3D C20600 ret 6 2917 _.LVL351: 2918 _.L343: 1222:dosfns.c **** return DE_FILENOTFND; 2919 .loc 1 1222 0 0 00003F40 83E020 and ax, 32 0 00003F43 8946FE mov word ptr [bp-2], ax 2922 _.LVL352: 0 00003F46 7525 jne _.L345 2924 _.LVL353: 2925 _.LBB57: 2926 _.LBB58: 0 00003F48 E858F0 call _IsShareInstalled.part.1 2928 _.LVL354: 2929 _.LVL355: 2930 _.LBE58: 2931 _.LBE57: 1226:dosfns.c **** { 2932 .loc 1 1226 0 0 00003F4B 85C0 test ax, ax 0 00003F4D 7415 je _.L344 1231:dosfns.c **** return result; 2935 .loc 1 1231 0 0 00003F4F FF76FE push word ptr [bp-2] 0 00003F52 56 push si 0 00003F53 FF36[0000] push word ptr [_cu_psp] 0 00003F57 16 push ss 0 00003F58 57 push di 0 00003F59 E8[FEFF] call _share_open_check 2942 _.LVL356: 0 00003F5C 85C0 test ax, ax 0 00003F5E 7CD8 jl _.L341 1234:dosfns.c **** } 2945 .loc 1 1234 0 0 00003F60 50 push ax 0 00003F61 E8[FEFF] call _share_close_file 2948 _.LVL357: 2949 _.L344: 1236:dosfns.c **** } 2950 .loc 1 1236 0 0 00003F64 FF760C push word ptr [bp+12] 0 00003F67 57 push di 0 00003F68 E8[FEFF] call _dos_setfattr 2954 _.LVL358: 0 00003F6B EBCB jmp _.L341 2956 _.L345: 1223:dosfns.c **** 2957 .loc 1 1223 0 0 00003F6D B8FEFF mov ax, -2 0 00003F70 EBC6 jmp _.L341 2960 _.LFE39: 2961 .size _DosSetFattr, .-_DosSetFattr 2962 .global _DosSelectDrv 2963 .type _DosSelectDrv, @function 2964 _DosSelectDrv: 2965 _.LFB40: 1240:dosfns.c **** current_ldt = get_cds(drv); 2966 .loc 1 1240 0 2967 _.LVL359: 0 00003F72 55 push bp 2969 _.LCFI68: 0 00003F73 89E5 mov bp, sp 2971 _.LCFI69: 1241:dosfns.c **** 2972 .loc 1 1241 0 0 00003F75 8A4604 mov al, byte ptr [bp+4] 0 00003F78 30E4 xor ah, ah 0 00003F7A 50 push ax 0 00003F7B E8[FEFF] call _get_cds 2977 _.LVL360: 0 00003F7E A3[0000] mov word ptr [_current_ldt], ax 0 00003F81 8916[0200] mov word ptr [_current_ldt+2], dx 1243:dosfns.c **** default_drive = drv; 2980 .loc 1 1243 0 0 00003F85 09D0 or ax, dx 0 00003F87 85C0 test ax, ax 0 00003F89 7406 je _.L351 1244:dosfns.c **** 2984 .loc 1 1244 0 0 00003F8B 8A4604 mov al, byte ptr [bp+4] 0 00003F8E A2[0000] mov byte ptr [_default_drive], al 2987 _.L351: 1247:dosfns.c **** 2988 .loc 1 1247 0 0 00003F91 A0[0000] mov al, byte ptr [_lastdrive] 0 00003F94 89EC mov sp, bp 0 00003F96 5D pop bp 0 00003F97 C20200 ret 2 2993 _.LFE40: 2994 .size _DosSelectDrv, .-_DosSelectDrv 2995 .global _DosDelete 2996 .type _DosDelete, @function 2997 _DosDelete: 2998 _.LFB41: 1250:dosfns.c **** COUNT result; 2999 .loc 1 1250 0 3000 _.LVL361: 0 00003F9A 56 push si 0 00003F9B 57 push di 0 00003F9C 55 push bp 3004 _.LCFI70: 0 00003F9D 89E5 mov bp, sp 3006 _.LCFI71: 0 00003F9F 1E push ds 1253:dosfns.c **** if (result < SUCCESS) 3008 .loc 1 1253 0 0 00003FA0 B80200 mov ax, 2 0 00003FA3 50 push ax 0 00003FA4 BE[0000] mov si, offset __PriPathBuffer 0 00003FA7 56 push si 0 00003FA8 FF760A push word ptr [bp+10] 0 00003FAB FF7608 push word ptr [bp+8] 0 00003FAE E8[FEFF] call _truename 3016 _.LVL362: 1254:dosfns.c **** return result; 3017 .loc 1 1254 0 0 00003FB1 85C0 test ax, ax 0 00003FB3 7C14 jl _.L357 0 00003FB5 8946FE mov word ptr [bp-2], ax 1257:dosfns.c **** 3021 .loc 1 1257 0 0 00003FB8 E83CF5 call _set_fcbname 3023 _.LVL363: 1259:dosfns.c **** return network_redirector(REM_DELETE); 3024 .loc 1 1259 0 0 00003FBB 8B46FE mov ax, word ptr [bp-2] 0 00003FBE A840 test al, 64 0 00003FC0 740F je _.L359 1260:dosfns.c **** 3028 .loc 1 1260 0 0 00003FC2 B81311 mov ax, 4371 0 00003FC5 50 push ax 0 00003FC6 E8[FEFF] call _network_redirector 3032 _.LVL364: 3033 _.L357: 1269:dosfns.c **** 3034 .loc 1 1269 0 0 00003FC9 89EC mov sp, bp 0 00003FCB 5D pop bp 0 00003FCC 5F pop di 0 00003FCD 5E pop si 0 00003FCE C20600 ret 6 3040 _.LVL365: 3041 _.L359: 1262:dosfns.c **** return DE_FILENOTFND; 3042 .loc 1 1262 0 0 00003FD1 A820 test al, 32 0 00003FD3 7520 jne _.L362 0 00003FD5 89F7 mov di, si 3046 _.LVL366: 3047 _.LBB59: 3048 _.LBB60: 0 00003FD7 E8C9EF call _IsShareInstalled.part.1 3050 _.LVL367: 3051 _.LVL368: 3052 _.LBE60: 3053 _.LBE59: 1265:dosfns.c **** return DE_ACCESS; 3054 .loc 1 1265 0 0 00003FDA 85C0 test ax, ax 0 00003FDC 7509 jne _.L360 3057 _.L361: 1268:dosfns.c **** } 3058 .loc 1 1268 0 0 00003FDE FF760C push word ptr [bp+12] 0 00003FE1 57 push di 0 00003FE2 E8[FEFF] call _dos_delete 3062 _.LVL369: 0 00003FE5 EBE2 jmp _.L357 3064 _.L360: 1265:dosfns.c **** return DE_ACCESS; 3065 .loc 1 1265 0 discriminator 1 0 00003FE7 16 push ss 0 00003FE8 56 push si 0 00003FE9 E8[FEFF] call _share_is_file_open 3069 _.LVL370: 0 00003FEC 85C0 test ax, ax 0 00003FEE 74EE je _.L361 1266:dosfns.c **** 3072 .loc 1 1266 0 0 00003FF0 B8FBFF mov ax, -5 0 00003FF3 EBD4 jmp _.L357 3075 _.L362: 1263:dosfns.c **** 3076 .loc 1 1263 0 0 00003FF5 B8FEFF mov ax, -2 0 00003FF8 EBCF jmp _.L357 3079 _.LFE41: 3080 .size _DosDelete, .-_DosDelete 3081 .global _DosRenameTrue 3082 .type _DosRenameTrue, @function 3083 _DosRenameTrue: 3084 _.LFB42: 1272:dosfns.c **** if (path1[0] != path2[0]) 3085 .loc 1 1272 0 3086 _.LVL371: 0 00003FFA 56 push si 0 00003FFB 57 push di 0 00003FFC 55 push bp 3090 _.LCFI72: 0 00003FFD 89E5 mov bp, sp 3092 _.LCFI73: 0 00003FFF 1E push ds 0 00004000 8B7E08 mov di, word ptr [bp+8] 0 00004003 8B760A mov si, word ptr [bp+10] 0 00004006 8B460C mov ax, word ptr [bp+12] 0 00004009 8946FE mov word ptr [bp-2], ax 1273:dosfns.c **** { 3098 .loc 1 1273 0 0 0000400C 8A05 mov al, byte ptr [di] 0 0000400E 3A04 cmp al, byte ptr [si] 0 00004010 754E jne _.L373 1277:dosfns.c **** return network_redirector(REM_RENAME); 3102 .loc 1 1277 0 0 00004012 8B1E[0000] mov bx, word ptr [_current_ldt] 0 00004016 8B16[0200] mov dx, word ptr [_current_ldt+2] 0 0000401A 83FBFF cmp bx, -1 0 0000401D 7409 je _.L369 1277:dosfns.c **** return network_redirector(REM_RENAME); 3107 .loc 1 1277 0 is_stmt 0 discriminator 1 0 0000401F 8EC2 mov es, dx 0 00004021 26837F4300 cmp word ptr es:[bx+67], 0 0 00004026 7D0F jge _.L370 3111 _.L369: 3112 _.LVL372: 3113 _.LBB67: 3114 _.LBB68: 1278:dosfns.c **** 3115 .loc 1 1278 0 is_stmt 1 0 00004028 B81111 mov ax, 4369 0 0000402B 50 push ax 0 0000402C E8[FEFF] call _network_redirector 3119 _.LVL373: 3120 _.L367: 3121 _.LBE68: 3122 _.LBE67: 1284:dosfns.c **** 3123 .loc 1 1284 0 0 0000402F 89EC mov sp, bp 0 00004031 5D pop bp 0 00004032 5F pop di 0 00004033 5E pop si 0 00004034 C20600 ret 6 3129 _.LVL374: 3130 _.L370: 3131 _.LBB69: 3132 _.LBB70: 0 00004037 E869EF call _IsShareInstalled.part.1 3134 _.LVL375: 3135 _.LVL376: 3136 _.LBE70: 3137 _.LBE69: 1280:dosfns.c **** return DE_ACCESS; 3138 .loc 1 1280 0 0 0000403A 85C0 test ax, ax 0 0000403C 7514 jne _.L371 3141 _.L372: 1283:dosfns.c **** } 3142 .loc 1 1283 0 0 0000403E 8B46FE mov ax, word ptr [bp-2] 0 00004041 89460C mov word ptr [bp+12], ax 0 00004044 89760A mov word ptr [bp+10], si 0 00004047 897E08 mov word ptr [bp+8], di 3147 _.LVL377: 1284:dosfns.c **** 3148 .loc 1 1284 0 0 0000404A 89EC mov sp, bp 0 0000404C 5D pop bp 0 0000404D 5F pop di 0 0000404E 5E pop si 1283:dosfns.c **** } 3153 .loc 1 1283 0 0 0000404F E9[FEFF] jmp _dos_rename 3155 _.LVL378: 3156 _.L371: 1280:dosfns.c **** return DE_ACCESS; 3157 .loc 1 1280 0 discriminator 1 0 00004052 16 push ss 0 00004053 57 push di 0 00004054 E8[FEFF] call _share_is_file_open 3161 _.LVL379: 0 00004057 85C0 test ax, ax 0 00004059 74E3 je _.L372 1281:dosfns.c **** 3164 .loc 1 1281 0 0 0000405B B8FBFF mov ax, -5 0 0000405E EBCF jmp _.L367 3167 _.LVL380: 3168 _.L373: 1275:dosfns.c **** } 3169 .loc 1 1275 0 0 00004060 B8EFFF mov ax, -17 0 00004063 EBCA jmp _.L367 3172 _.LFE42: 3173 .size _DosRenameTrue, .-_DosRenameTrue 3174 .global _DosRename 3175 .type _DosRename, @function 3176 _DosRename: 3177 _.LFB43: 1287:dosfns.c **** COUNT result; 3178 .loc 1 1287 0 3179 _.LVL381: 0 00004065 56 push si 0 00004066 57 push di 0 00004067 55 push bp 3183 _.LCFI74: 0 00004068 89E5 mov bp, sp 3185 _.LCFI75: 0 0000406A 1E push ds 0 0000406B 1E push ds 0 0000406C C44608 les ax, dword ptr [bp+8] 0 0000406F 8946FE mov word ptr [bp-2], ax 0 00004072 8C46FC mov word ptr [bp-4], es 1290:dosfns.c **** if (result < SUCCESS) 3191 .loc 1 1290 0 0 00004075 BF0200 mov di, 2 0 00004078 57 push di 0 00004079 BE[0000] mov si, offset __SecPathBuffer 0 0000407C 56 push si 0 0000407D FF760E push word ptr [bp+14] 0 00004080 FF760C push word ptr [bp+12] 0 00004083 E8[FEFF] call _truename 3199 _.LVL382: 1291:dosfns.c **** return result; 3200 .loc 1 1291 0 0 00004086 85C0 test ax, ax 0 00004088 7C0B jl _.L381 1294:dosfns.c **** return DE_FILENOTFND; 3203 .loc 1 1294 0 0 0000408A 83E060 and ax, 96 3205 _.LVL383: 0 0000408D 83F820 cmp ax, 32 0 00004090 750B jne _.L383 3208 _.L384: 1295:dosfns.c **** 3209 .loc 1 1295 0 0 00004092 B8FEFF mov ax, -2 3211 _.L381: 1307:dosfns.c **** 3212 .loc 1 1307 0 0 00004095 89EC mov sp, bp 0 00004097 5D pop bp 0 00004098 5F pop di 0 00004099 5E pop si 0 0000409A C20800 ret 8 3218 _.L383: 1297:dosfns.c **** if (result < SUCCESS) 3219 .loc 1 1297 0 0 0000409D 57 push di 0 0000409E BF[0000] mov di, offset __PriPathBuffer 0 000040A1 57 push di 0 000040A2 FF76FC push word ptr [bp-4] 0 000040A5 FF76FE push word ptr [bp-2] 0 000040A8 E8[FEFF] call _truename 3226 _.LVL384: 1298:dosfns.c **** return result; 3227 .loc 1 1298 0 0 000040AB 85C0 test ax, ax 0 000040AD 7CE6 jl _.L381 0 000040AF 8946FE mov word ptr [bp-2], ax 1301:dosfns.c **** 3231 .loc 1 1301 0 0 000040B2 E842F4 call _set_fcbname 3233 _.LVL385: 1303:dosfns.c **** return DE_FILENOTFND; 3234 .loc 1 1303 0 0 000040B5 8A46FE mov al, byte ptr [bp-2] 0 000040B8 83E060 and ax, 96 0 000040BB 83F820 cmp ax, 32 0 000040BE 74D2 je _.L384 1306:dosfns.c **** } 3239 .loc 1 1306 0 0 000040C0 B83700 mov ax, 55 0 000040C3 50 push ax 0 000040C4 56 push si 0 000040C5 57 push di 0 000040C6 E8[FEFF] call _DosRenameTrue 3245 _.LVL386: 0 000040C9 EBCA jmp _.L381 3247 _.LFE43: 3248 .size _DosRename, .-_DosRename 3249 .global _DosMkRmdir 3250 .type _DosMkRmdir, @function 3251 _DosMkRmdir: 3252 _.LFB44: 1310:dosfns.c **** COUNT result; 3253 .loc 1 1310 0 3254 _.LVL387: 0 000040CB 56 push si 0 000040CC 55 push bp 3257 _.LCFI76: 0 000040CD 89E5 mov bp, sp 3259 _.LCFI77: 0 000040CF 1E push ds 1313:dosfns.c **** if (result < SUCCESS) 3261 .loc 1 1313 0 0 000040D0 B80200 mov ax, 2 0 000040D3 50 push ax 0 000040D4 BE[0000] mov si, offset __PriPathBuffer 0 000040D7 56 push si 0 000040D8 FF7608 push word ptr [bp+8] 0 000040DB FF7606 push word ptr [bp+6] 0 000040DE E8[FEFF] call _truename 3269 _.LVL388: 1314:dosfns.c **** return result; 3270 .loc 1 1314 0 0 000040E1 85C0 test ax, ax 0 000040E3 7C1A jl _.L389 0 000040E5 8946FE mov word ptr [bp-2], ax 1317:dosfns.c **** 3274 .loc 1 1317 0 0 000040E8 E80CF4 call _set_fcbname 3276 _.LVL389: 1319:dosfns.c **** return network_redirector(action == 0x39 ? REM_MKDIR : REM_RMDIR); 3277 .loc 1 1319 0 0 000040EB 8B46FE mov ax, word ptr [bp-2] 0 000040EE A840 test al, 64 0 000040F0 7419 je _.L391 1320:dosfns.c **** 3281 .loc 1 1320 0 0 000040F2 837E0A39 cmp word ptr [bp+10], 57 0 000040F6 740E je _.L394 0 000040F8 B80111 mov ax, 4353 3285 _.L392: 1320:dosfns.c **** 3286 .loc 1 1320 0 is_stmt 0 discriminator 4 0 000040FB 50 push ax 0 000040FC E8[FEFF] call _network_redirector 3289 _.LVL390: 3290 _.L389: 1326:dosfns.c **** 3291 .loc 1 1326 0 is_stmt 1 0 000040FF 89EC mov sp, bp 0 00004101 5D pop bp 0 00004102 5E pop si 0 00004103 C20600 ret 6 3296 _.LVL391: 3297 _.L394: 1320:dosfns.c **** 3298 .loc 1 1320 0 0 00004106 B80311 mov ax, 4355 0 00004109 EBF0 jmp _.L392 3301 _.L391: 1322:dosfns.c **** return DE_ACCESS; 3302 .loc 1 1322 0 0 0000410B A820 test al, 32 0 0000410D 7513 jne _.L395 1325:dosfns.c **** } 3305 .loc 1 1325 0 0 0000410F 837E0A39 cmp word ptr [bp+10], 57 0 00004113 7408 je _.L396 0 00004115 B8[0000] mov ax, offset _dos_rmdir 3309 _.L393: 1325:dosfns.c **** } 3310 .loc 1 1325 0 is_stmt 0 discriminator 4 0 00004118 56 push si 0 00004119 FFD0 call ax 3313 _.LVL392: 0 0000411B EBE2 jmp _.L389 3315 _.L396: 1325:dosfns.c **** } 3316 .loc 1 1325 0 0 0000411D B8[0000] mov ax, offset _dos_mkdir 0 00004120 EBF6 jmp _.L393 3319 _.L395: 1323:dosfns.c **** 3320 .loc 1 1323 0 is_stmt 1 0 00004122 B8FBFF mov ax, -5 0 00004125 EBD8 jmp _.L389 3323 _.LFE44: 3324 .size _DosMkRmdir, .-_DosMkRmdir 3325 .global _DosLockUnlock 3326 .type _DosLockUnlock, @function 3327 _DosLockUnlock: 3328 _.LFB45: 1331:dosfns.c **** sft FAR *s; 3329 .loc 1 1331 0 3330 _.LVL393: 0 00004127 56 push si 0 00004128 57 push di 0 00004129 55 push bp 3334 _.LCFI78: 0 0000412A 89E5 mov bp, sp 3336 _.LCFI79: 0 0000412C 83EC10 sub sp, 16 0 0000412F 8B5E0A mov bx, word ptr [bp+10] 0 00004132 895EF0 mov word ptr [bp-16], bx 0 00004135 8B760C mov si, word ptr [bp+12] 0 00004138 C4460E les ax, dword ptr [bp+14] 0 0000413B 8946F4 mov word ptr [bp-12], ax 0 0000413E 8C46F2 mov word ptr [bp-14], es 1335:dosfns.c **** return DE_INVLDHNDL; 3344 .loc 1 1335 0 0 00004141 FF7608 push word ptr [bp+8] 0 00004144 E8[FEFF] call _get_sft 3347 _.LVL394: 0 00004147 83F8FF cmp ax, -1 0 0000414A 7460 je _.L401 1338:dosfns.c **** return remote_lock_unlock(s, pos, len, unlock); 3350 .loc 1 1338 0 0 0000414C 8EC2 mov es, dx 0 0000414E 89C3 mov bx, ax 0 00004150 26837F0500 cmp word ptr es:[bx+5], 0 0 00004155 8B4EF2 mov cx, word ptr [bp-14] 0 00004158 8B5EF0 mov bx, word ptr [bp-16] 0 0000415B 7D2A jge _.L400 3357 _.LVL395: 3358 _.LBB75: 3359 _.LBB76: 1446:dosfns.c **** 1447:dosfns.c **** /* /// End of additions for SHARE. - Ron Cemer */ 1448:dosfns.c **** 1449:dosfns.c **** COUNT DosTruename(const char FAR *src, char FAR *dest) 1450:dosfns.c **** { 1451:dosfns.c **** /* RBIL: The buffer has be unchanged, if the call fails. 1452:dosfns.c **** Therefore, the name is created in an internal buffer 1453:dosfns.c **** and copied into the user buffer only on success. 1454:dosfns.c **** */ 1455:dosfns.c **** COUNT rc = truename(src, PriPathName, CDS_MODE_ALLOW_WILDCARDS); 1456:dosfns.c **** if (rc >= SUCCESS) 1457:dosfns.c **** { 1458:dosfns.c **** fstrcpy(dest, PriPathName); 1459:dosfns.c **** set_fcbname(); 1460:dosfns.c **** } 1461:dosfns.c **** return rc; 1462:dosfns.c **** } 1463:dosfns.c **** 1464:dosfns.c **** STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */ 1465:dosfns.c **** unsigned long ofs, /* offset into file */ 1466:dosfns.c **** unsigned long len, /* length (in bytes) of region to lock or unlock * 1467:dosfns.c **** int unlock) 1468:dosfns.c **** /* one to unlock; zero to lock */ 1469:dosfns.c **** { 1470:dosfns.c **** struct 1471:dosfns.c **** { 1472:dosfns.c **** unsigned long ofs, len; 1473:dosfns.c **** int unlock; 1474:dosfns.c **** } param_block; 1475:dosfns.c **** param_block.ofs = ofs; 3360 .loc 1 1475 0 0 0000415D 895EF6 mov word ptr [bp-10], bx 0 00004160 8976F8 mov word ptr [bp-8], si 1476:dosfns.c **** param_block.len = len; 3363 .loc 1 1476 0 0 00004163 8B5EF4 mov bx, word ptr [bp-12] 3365 _.LVL396: 0 00004166 895EFA mov word ptr [bp-6], bx 0 00004169 894EFC mov word ptr [bp-4], cx 1477:dosfns.c **** param_block.unlock = unlock; 3368 .loc 1 1477 0 0 0000416C 8B4E12 mov cx, word ptr [bp+18] 3370 _.LVL397: 0 0000416F 894EFE mov word ptr [bp-2], cx 1478:dosfns.c **** return (int)network_redirector_mx(REM_LOCK, sftp, ¶m_block); 3372 .loc 1 1478 0 0 00004172 8D4EF6 lea cx, [-10+bp] 0 00004175 51 push cx 0 00004176 52 push dx 0 00004177 50 push ax 0 00004178 B80A11 mov ax, 4362 3378 _.LVL398: 0 0000417B 50 push ax 3380 _.LVL399: 0 0000417C E8[FEFF] call _network_redirector_mx 3382 _.LVL400: 3383 _.L398: 3384 _.LBE76: 3385 _.LBE75: 1351:dosfns.c **** 3386 .loc 1 1351 0 0 0000417F 89EC mov sp, bp 0 00004181 5D pop bp 0 00004182 5F pop di 0 00004183 5E pop si 0 00004184 C20C00 ret 12 3392 _.LVL401: 3393 _.L400: 1342:dosfns.c **** return DE_INVLDFUNC; 3394 .loc 1 1342 0 0 00004187 803E[0000]00 cmp byte ptr [_share_installed], 0 0 0000418C 7423 je _.L402 1346:dosfns.c **** return DE_LOCK; 3397 .loc 1 1346 0 0 0000418E 8EC2 mov es, dx 0 00004190 97 xchg di, ax 0 00004191 268B4533 mov ax, word ptr es:[di+51] 3401 _.LVL402: 0 00004195 85C0 test ax, ax 0 00004197 7C1D jl _.L403 1350:dosfns.c **** } 3404 .loc 1 1350 0 0 00004199 FF7612 push word ptr [bp+18] 0 0000419C 51 push cx 0 0000419D FF76F4 push word ptr [bp-12] 0 000041A0 56 push si 0 000041A1 53 push bx 0 000041A2 50 push ax 0 000041A3 FF36[0000] push word ptr [_cu_psp] 0 000041A7 E8[FEFF] call _share_lock_unlock 3413 _.LVL403: 0 000041AA EBD3 jmp _.L398 3415 _.LVL404: 3416 _.L401: 1336:dosfns.c **** 3417 .loc 1 1336 0 0 000041AC B8FAFF mov ax, -6 3419 _.LVL405: 0 000041AF EBCE jmp _.L398 3421 _.LVL406: 3422 _.L402: 1343:dosfns.c **** 3423 .loc 1 1343 0 0 000041B1 B8FFFF mov ax, -1 3425 _.LVL407: 0 000041B4 EBC9 jmp _.L398 3427 _.LVL408: 3428 _.L403: 1347:dosfns.c **** 3429 .loc 1 1347 0 0 000041B6 B8D9FF mov ax, -39 0 000041B9 EBC4 jmp _.L398 3432 _.LFE45: 3433 .size _DosLockUnlock, .-_DosLockUnlock 3434 .global _IsDevice 3435 .type _IsDevice, @function 3436 _IsDevice: 3437 _.LFB46: 1364:dosfns.c **** struct dhdr FAR *dhp; 3438 .loc 1 1364 0 3439 _.LVL409: 0 000041BB 56 push si 0 000041BC 57 push di 0 000041BD 55 push bp 3443 _.LCFI80: 0 000041BE 89E5 mov bp, sp 3445 _.LCFI81: 0 000041C0 83EC0A sub sp, 10 1366:dosfns.c **** int i; 3447 .loc 1 1366 0 0 000041C3 FF760A push word ptr [bp+10] 0 000041C6 FF7608 push word ptr [bp+8] 0 000041C9 E8[FEFF] call _get_root 3451 _.LVL410: 0 000041CC 8946FE mov word ptr [bp-2], ax 0 000041CF 8956FC mov word ptr [bp-4], dx 3454 _.LVL411: 1390:dosfns.c **** ((*froot=='.') && ((*(froot+1)=='\0') || (*(froot+2)=='\0' && *(froot+1)=='.'))) 3455 .loc 1 1390 0 0 000041D2 8EC2 mov es, dx 0 000041D4 93 xchg bx, ax 0 000041D5 268A07 mov al, byte ptr es:[bx] 3459 _.LVL412: 0 000041D8 84C0 test al, al 0 000041DA 750D jne _.L406 3462 _.LVL413: 3463 _.L409: 1394:dosfns.c **** } 3464 .loc 1 1394 0 0 000041DC 31F6 xor si, si 0 000041DE 89F2 mov dx, si 3467 _.L405: 1429:dosfns.c **** 3468 .loc 1 1429 0 0 000041E0 96 xchg si, ax 0 000041E1 89EC mov sp, bp 0 000041E3 5D pop bp 0 000041E4 5F pop di 0 000041E5 5E pop si 0 000041E6 C20400 ret 4 3475 _.LVL414: 3476 _.L406: 1390:dosfns.c **** ((*froot=='.') && ((*(froot+1)=='\0') || (*(froot+2)=='\0' && *(froot+1)=='.'))) 3477 .loc 1 1390 0 discriminator 1 0 000041E9 3C2E cmp al, 46 0 000041EB 7519 jne _.L408 1391:dosfns.c **** ) 3480 .loc 1 1391 0 0 000041ED 8E46FC mov es, word ptr [bp-4] 0 000041F0 8B5EFE mov bx, word ptr [bp-2] 3483 _.LVL415: 0 000041F3 268A4701 mov al, byte ptr es:[bx+1] 0 000041F7 84C0 test al, al 0 000041F9 74E1 je _.L409 1391:dosfns.c **** ) 3487 .loc 1 1391 0 is_stmt 0 discriminator 1 0 000041FB 26807F0201 cmp byte ptr es:[bx+2], 1 0 00004200 7304 jnc _.L408 0 00004202 3C2E cmp al, 46 0 00004204 74D6 je _.L409 3492 _.L408: 1398:dosfns.c **** dhp = dhp->dh_next) 3493 .loc 1 1398 0 is_stmt 1 0 00004206 BE[0000] mov si, offset _nul_dev 0 00004209 8CD2 mov dx, ss 3496 _.LVL416: 3497 _.L411: 1398:dosfns.c **** dhp = dhp->dh_next) 3498 .loc 1 1398 0 is_stmt 0 discriminator 1 0 0000420B 83FEFF cmp si, -1 0 0000420E 7505 jne _.L418 0 00004210 83FAFF cmp dx, -1 0 00004213 74C7 je _.L409 3503 _.L418: 1401:dosfns.c **** continue; 3504 .loc 1 1401 0 is_stmt 1 0 00004215 8EC2 mov es, dx 0 00004217 26837C0400 cmp word ptr es:[si+4], 0 0 0000421C 7C0D jl _.L412 3508 _.LVL417: 3509 _.L415: 1399:dosfns.c **** { 3510 .loc 1 1399 0 0 0000421E 89F3 mov bx, si 0 00004220 8EC2 mov es, dx 0 00004222 268B34 mov si, word ptr es:[si] 0 00004225 268B5702 mov dx, word ptr es:[bx+2] 3515 _.LVL418: 0 00004229 EBE0 jmp _.L411 3517 _.L412: 0 0000422B B90800 mov cx, 8 0 0000422E 31FF xor di, di 3520 _.LVL419: 3521 _.L417: 3522 _.LBB77: 1406:dosfns.c **** /* ignore extensions and handle filenames shorter than FNAME_SIZE */ 3523 .loc 1 1406 0 0 00004230 8B5EFE mov bx, word ptr [bp-2] 0 00004233 01FB add bx, di 0 00004235 8E46FC mov es, word ptr [bp-4] 0 00004238 268A07 mov al, byte ptr es:[bx] 3528 _.LVL420: 1408:dosfns.c **** { 3529 .loc 1 1408 0 0 0000423B 3C2E cmp al, 46 0 0000423D 7404 je _.L416 0 0000423F 84C0 test al, al 0 00004241 7517 jne _.L413 3534 _.LVL421: 3535 _.L416: 3536 _.LBB78: 1414:dosfns.c **** break; 3537 .loc 1 1414 0 0 00004243 8EC2 mov es, dx 0 00004245 89F3 mov bx, si 0 00004247 268A410A mov al, byte ptr es:[bx+di+10] 0 0000424B 8846FA mov byte ptr [bp-6], al 3542 _.LVL422: 0 0000424E A8DF test al, -33 0 00004250 75CC jne _.L415 3545 _.LBE78: 1411:dosfns.c **** { 3546 .loc 1 1411 0 0 00004252 47 inc di 3548 _.LVL423: 0 00004253 83FF08 cmp di, 8 0 00004256 75EB jne _.L416 0 00004258 EB86 jmp _.L405 3552 _.LVL424: 3553 _.L413: 0 0000425A 8956FA mov word ptr [bp-6], dx 0 0000425D 894EF6 mov word ptr [bp-10], cx 1419:dosfns.c **** break; 3556 .loc 1 1419 0 0 00004260 50 push ax 0 00004261 E8[FEFF] call _DosUpFChar 3559 _.LVL425: 0 00004264 8846F9 mov byte ptr [bp-7], al 0 00004267 8B56FA mov dx, word ptr [bp-6] 0 0000426A 8EC2 mov es, dx 0 0000426C 89F3 mov bx, si 0 0000426E 26FF710A push word ptr es:[bx+di+10] 0 00004272 E8[FEFF] call _DosUpFChar 3566 _.LVL426: 0 00004275 8A66F9 mov ah, byte ptr [bp-7] 0 00004278 38C4 cmp ah, al 0 0000427A 8B56FA mov dx, word ptr [bp-6] 0 0000427D 759F jne _.L415 3571 _.LBE77: 1404:dosfns.c **** { 3572 .loc 1 1404 0 discriminator 2 0 0000427F 47 inc di 3574 _.LVL427: 0 00004280 8B4EF6 mov cx, word ptr [bp-10] 0 00004283 49 dec cx 0 00004284 75AA jne _.L417 0 00004286 E957FF jmp _.L405 3579 _.LFE46: 3580 .size _IsDevice, .-_IsDevice 3581 .global _DosOpenSft 3582 .type _DosOpenSft, @function 3583 _DosOpenSft: 3584 _.LFB22: 518:dosfns.c **** COUNT sft_idx; 3585 .loc 1 518 0 3586 _.LVL428: 0 00004289 56 push si 0 0000428A 57 push di 0 0000428B 55 push bp 3590 _.LCFI82: 0 0000428C 89E5 mov bp, sp 3592 _.LCFI83: 0 0000428E 83EC12 sub sp, 18 0 00004291 C44608 les ax, dword ptr [bp+8] 0 00004294 8946F4 mov word ptr [bp-12], ax 0 00004297 8C46F0 mov word ptr [bp-16], es 524:dosfns.c **** if (result < SUCCESS) 3597 .loc 1 524 0 0 0000429A B80200 mov ax, 2 0 0000429D 50 push ax 0 0000429E BE[0000] mov si, offset __PriPathBuffer 0 000042A1 56 push si 0 000042A2 FF76F0 push word ptr [bp-16] 0 000042A5 FF76F4 push word ptr [bp-12] 0 000042A8 E8[FEFF] call _truename 3605 _.LVL429: 0 000042AB 89C7 mov di, ax 0 000042AD 89C1 mov cx, ax 0 000042AF 99 cwd 3609 _.LVL430: 525:dosfns.c **** return result; 3610 .loc 1 525 0 0 000042B0 85D2 test dx, dx 0 000042B2 8976F2 mov word ptr [bp-14], si 0 000042B5 7D03E9E602 jl _.L429 528:dosfns.c **** 3614 .loc 1 528 0 0 000042BA E83AF2 call _set_fcbname 3616 _.LVL431: 3617 _.LVL432: 3618 _.LBB91: 3619 _.LBB92: 396:dosfns.c **** { 3620 .loc 1 396 0 0 000042BD 8B1E[0000] mov bx, word ptr [_sfthead] 0 000042C1 A1[0200] mov ax, word ptr [_sfthead+2] 0 000042C4 8946FA mov word ptr [bp-6], ax 3624 _.LVL433: 392:dosfns.c **** sfttbl FAR *sp; 3625 .loc 1 392 0 0 000042C7 C746F80000 mov word ptr [bp-8], 0 3627 _.LVL434: 3628 _.L432: 396:dosfns.c **** { 3629 .loc 1 396 0 0 000042CC 83FBFF cmp bx, -1 0 000042CF 7506 jne _.L437 0 000042D1 837EFAFF cmp word ptr [bp-6], -1 0 000042D5 7438 je _.L438 3634 _.L437: 3635 _.LBB93: 398:dosfns.c **** sft FAR *sfti = sp->sftt_table; 3636 .loc 1 398 0 0 000042D7 8E46FA mov es, word ptr [bp-6] 0 000042DA 268B4704 mov ax, word ptr es:[bx+4] 3639 _.LVL435: 399:dosfns.c **** 3640 .loc 1 399 0 0 000042DE 8D7706 lea si, [6+bx] 3642 _.LVL436: 3643 _.L433: 401:dosfns.c **** { 3644 .loc 1 401 0 0 000042E1 48 dec ax 3646 _.LVL437: 0 000042E2 7911 jns _.L436 3648 _.LBE93: 396:dosfns.c **** { 3649 .loc 1 396 0 0 000042E4 89DE mov si, bx 3651 _.LVL438: 0 000042E6 8E46FA mov es, word ptr [bp-6] 0 000042E9 268B1F mov bx, word ptr es:[bx] 3654 _.LVL439: 0 000042EC 268B4402 mov ax, word ptr es:[si+2] 3656 _.LVL440: 0 000042F0 8946FA mov word ptr [bp-6], ax 3658 _.LVL441: 0 000042F3 EBD7 jmp _.L432 3660 _.LVL442: 3661 _.L436: 3662 _.LBB95: 403:dosfns.c **** { 3663 .loc 1 403 0 0 000042F5 8E46FA mov es, word ptr [bp-6] 0 000042F8 26833C00 cmp word ptr es:[si], 0 0 000042FC 751A jne _.L434 3667 _.LVL443: 3668 _.LBB94: 410:dosfns.c **** } 3669 .loc 1 410 0 0 000042FE 8B46F8 mov ax, word ptr [bp-8] 3671 _.LVL444: 0 00004301 A3[0000] mov word ptr [_current_sft_idx], ax 3673 _.LVL445: 3674 _.LBE94: 3675 _.LBE95: 3676 _.LBE92: 3677 _.LBE91: 531:dosfns.c **** return DE_TOOMANY; 3678 .loc 1 531 0 0 00004304 83FEFF cmp si, -1 0 00004307 7517 jne _.L435 0 00004309 837EFAFF cmp word ptr [bp-6], -1 0 0000430D 7511 jne _.L435 3683 _.LVL446: 3684 _.L438: 532:dosfns.c **** 3685 .loc 1 532 0 0 0000430F B9FCFF mov cx, -4 3687 _.LVL447: 3688 _.L476: 596:dosfns.c **** 3689 .loc 1 596 0 0 00004312 BAFFFF mov dx, -1 0 00004315 E98802 jmp _.L429 3692 _.LVL448: 3693 _.L434: 3694 _.LBB98: 3695 _.LBB97: 3696 _.LBB96: 401:dosfns.c **** { 3697 .loc 1 401 0 0 00004318 FF46F8 inc word ptr [bp-8] 3699 _.LVL449: 0 0000431B 83C63B add si, 59 3701 _.LVL450: 0 0000431E EBC1 jmp _.L433 3703 _.LVL451: 3704 _.L435: 3705 _.LBE96: 3706 _.LBE97: 3707 _.LBE98: 534:dosfns.c **** 3708 .loc 1 534 0 0 00004320 B83B00 mov ax, 59 3710 _.LVL452: 0 00004323 50 push ax 0 00004324 31C0 xor ax, ax 0 00004326 50 push ax 0 00004327 FF76FA push word ptr [bp-6] 0 0000432A 56 push si 0 0000432B E8[FEFF] call _fmemset 3717 _.LVL453: 536:dosfns.c **** sftp->sft_mode = flags & 0xf0ff; 3718 .loc 1 536 0 0 0000432E A1[0000] mov ax, word ptr [_cu_psp] 0 00004331 8E46FA mov es, word ptr [bp-6] 0 00004334 26894431 mov word ptr es:[si+49], ax 3722 _.LVL454: 537:dosfns.c **** OpenMode = (BYTE) flags; 3723 .loc 1 537 0 0 00004338 8B460C mov ax, word ptr [bp+12] 0 0000433B 80E4F0 and ah, -16 0 0000433E 8E46FA mov es, word ptr [bp-6] 0 00004341 26894402 mov word ptr es:[si+2], ax 538:dosfns.c **** 3728 .loc 1 538 0 0 00004345 8A460C mov al, byte ptr [bp+12] 0 00004348 8846EF mov byte ptr [bp-17], al 0 0000434B A2[0000] mov byte ptr [_OpenMode], al 540:dosfns.c **** sftp->sft_attrib = attrib = attrib | D_ARCHIVE; 3732 .loc 1 540 0 0 0000434E 8E46FA mov es, word ptr [bp-6] 0 00004351 26C74433FFFF mov word ptr es:[si+51], -1 541:dosfns.c **** 3735 .loc 1 541 0 0 00004357 8B460E mov ax, word ptr [bp+14] 0 0000435A 83C820 or ax, 32 0 0000435D 8946F6 mov word ptr [bp-10], ax 3739 _.LVL455: 0 00004360 8E46FA mov es, word ptr [bp-6] 0 00004363 8A46F6 mov al, byte ptr [bp-10] 3742 _.LVL456: 0 00004366 26884404 mov byte ptr es:[si+4], al 3744 _.LVL457: 544:dosfns.c **** { 3745 .loc 1 544 0 0 0000436A 89F8 mov ax, di 0 0000436C A820 test al, 32 0 0000436E 7503E9E600 je _.L439 3749 _.LVL458: 544:dosfns.c **** { 3750 .loc 1 544 0 is_stmt 0 discriminator 1 0 00004373 FF76F0 push word ptr [bp-16] 0 00004376 FF76F4 push word ptr [bp-12] 0 00004379 E8[FEFF] call _IsDevice 3754 _.LVL459: 0 0000437C 8946F4 mov word ptr [bp-12], ax 3756 _.LVL460: 0 0000437F 09D0 or ax, dx 3758 _.LVL461: 0 00004381 7503E9D300 je _.L439 3760 _.LVL462: 3761 _.LBB99: 3762 _.LBB100: 3763 _.LBB101: 457:dosfns.c **** sftp->sft_count += 1; 3764 .loc 1 457 0 is_stmt 1 discriminator 1 0 00004386 8E46FA mov es, word ptr [bp-6] 0 00004389 26C74433FFFF mov word ptr es:[si+51], -1 3767 _.LVL463: 458:dosfns.c **** sftp->sft_flags = 3768 .loc 1 458 0 discriminator 1 0 0000438F 8E46FA mov es, word ptr [bp-6] 3770 _.LVL464: 0 00004392 26FF04 inc word ptr es:[si] 460:dosfns.c **** fmemcpy(sftp->sft_name, dhp->dh_name, FNAME_SIZE); 3772 .loc 1 460 0 discriminator 1 0 00004395 8EC2 mov es, dx 0 00004397 8B5EF4 mov bx, word ptr [bp-12] 0 0000439A 268B4704 mov ax, word ptr es:[bx+4] 0 0000439E 251F7F and ax, 32543 0 000043A1 0CC0 or al, -64 0 000043A3 8E46FA mov es, word ptr [bp-6] 0 000043A6 26894405 mov word ptr es:[si+5], ax 461:dosfns.c **** 3780 .loc 1 461 0 discriminator 1 0 000043AA 8D4420 lea ax, [32+si] 0 000043AD B90800 mov cx, 8 0 000043B0 51 push cx 0 000043B1 8B4EF4 mov cx, word ptr [bp-12] 0 000043B4 83C10A add cx, 10 0 000043B7 52 push dx 0 000043B8 8956F2 mov word ptr [bp-14], dx 0 000043BB 51 push cx 0 000043BC FF76FA push word ptr [bp-6] 0 000043BF 50 push ax 0 000043C0 8946F6 mov word ptr [bp-10], ax 0 000043C3 E8[FEFF] call _fmemcpy 3793 _.LVL465: 464:dosfns.c **** sftp->sft_name[i] = ' '; 3794 .loc 1 464 0 discriminator 1 0 000043C6 BF0A00 mov di, 10 3796 _.LVL466: 0 000043C9 8B46F6 mov ax, word ptr [bp-10] 0 000043CC 8B56F2 mov dx, word ptr [bp-14] 3799 _.LVL467: 3800 _.L441: 464:dosfns.c **** sftp->sft_name[i] = ' '; 3801 .loc 1 464 0 is_stmt 0 0 000043CF 8E46FA mov es, word ptr [bp-6] 0 000043D2 89F3 mov bx, si 0 000043D4 2680792000 cmp byte ptr es:[bx+di+32], 0 0 000043D9 7470 je _.L442 0 000043DB 8956F6 mov word ptr [bp-10], dx 467:dosfns.c **** 3807 .loc 1 467 0 is_stmt 1 0 000043DE B90B00 mov cx, 11 0 000043E1 51 push cx 0 000043E2 06 push es 0 000043E3 50 push ax 0 000043E4 E8[FEFF] call _DosUpFMem 3813 _.LVL468: 469:dosfns.c **** sftp->sft_date = dos_getdate(); 3814 .loc 1 469 0 0 000043E7 8E46FA mov es, word ptr [bp-6] 0 000043EA 8B46F4 mov ax, word ptr [bp-12] 0 000043ED 26894407 mov word ptr es:[si+7], ax 0 000043F1 8E46FA mov es, word ptr [bp-6] 0 000043F4 8B56F6 mov dx, word ptr [bp-10] 0 000043F7 26895409 mov word ptr es:[si+9], dx 470:dosfns.c **** sftp->sft_time = dos_gettime(); 3821 .loc 1 470 0 0 000043FB E8[FEFF] call _dos_getdate 3823 _.LVL469: 0 000043FE 8E46FA mov es, word ptr [bp-6] 0 00004401 2689440F mov word ptr es:[si+15], ax 471:dosfns.c **** sftp->sft_attrib = D_DEVICE; 3826 .loc 1 471 0 0 00004405 E8[FEFF] call _dos_gettime 3828 _.LVL470: 0 00004408 8E46FA mov es, word ptr [bp-6] 0 0000440B 2689440D mov word ptr es:[si+13], ax 472:dosfns.c **** 3831 .loc 1 472 0 0 0000440F 8E46FA mov es, word ptr [bp-6] 0 00004412 26C6440440 mov byte ptr es:[si+4], 64 474:dosfns.c **** { 3834 .loc 1 474 0 0 00004417 8E46FA mov es, word ptr [bp-6] 0 0000441A 26C45C07 les bx, dword ptr es:[si+7] 0 0000441E 26F6470508 test byte ptr es:[bx+5], 8 0 00004423 7503E98701 je _.L443 3839 _.LBB102: 479:dosfns.c **** if (BinaryCharIO(&dev, 0, MK_FP(0x0000, 0x0000), C_OPEN) != SUCCESS) 3840 .loc 1 479 0 0 00004428 895EFC mov word ptr [bp-4], bx 0 0000442B 8C46FE mov word ptr [bp-2], es 480:dosfns.c **** return DE_ACCESS; 3843 .loc 1 480 0 0 0000442E B80D00 mov ax, 13 0 00004431 50 push ax 0 00004432 31C0 xor ax, ax 0 00004434 50 push ax 0 00004435 50 push ax 0 00004436 50 push ax 0 00004437 8D46FC lea ax, [-4+bp] 0 0000443A 50 push ax 0 0000443B E8[FEFF] call _BinaryCharIO 3853 _.LVL471: 0 0000443E 09D0 or ax, dx 0 00004440 7503E96A01 je _.L443 3856 _.LVL472: 3857 _.L459: 3858 _.LBE102: 3859 _.LBE101: 3860 _.LBE100: 3861 _.LBE99: 596:dosfns.c **** 3862 .loc 1 596 0 0 00004445 B9FBFF mov cx, -5 0 00004448 E9C7FE jmp _.L476 3865 _.LVL473: 3866 _.L442: 3867 _.LBB105: 3868 _.LBB104: 3869 _.LBB103: 465:dosfns.c **** /* and uppercase */ 3870 .loc 1 465 0 0 0000444B 8E46FA mov es, word ptr [bp-6] 0 0000444E 89F3 mov bx, si 0 00004450 26C6412020 mov byte ptr es:[bx+di+32], 32 464:dosfns.c **** sftp->sft_name[i] = ' '; 3874 .loc 1 464 0 0 00004455 4F dec di 3876 _.LVL474: 0 00004456 E976FF jmp _.L441 3878 _.LVL475: 3879 _.L439: 3880 _.LBE103: 3881 _.LBE104: 3882 _.LBE105: 555:dosfns.c **** { 3883 .loc 1 555 0 0 00004459 97 xchg di, ax 0 0000445A A840 test al, 64 3886 _.LBB106: 559:dosfns.c **** attrib |= 0x100; 3887 .loc 1 559 0 0 0000445C 8B460C mov ax, word ptr [bp+12] 3889 _.LBE106: 555:dosfns.c **** { 3890 .loc 1 555 0 0 0000445F 7503E99500 je _.L446 3892 _.LBB108: 559:dosfns.c **** attrib |= 0x100; 3893 .loc 1 559 0 0 00004464 250006 and ax, 1536 0 00004467 3D0004 cmp ax, 1024 0 0000446A 7509 jne _.L447 560:dosfns.c **** 3897 .loc 1 560 0 0 0000446C 8B460E mov ax, word ptr [bp+14] 0 0000446F 0D2001 or ax, 288 0 00004472 8946F6 mov word ptr [bp-10], ax 3901 _.LVL476: 3902 _.L447: 562:dosfns.c **** cmd = REM_CREATE; 3903 .loc 1 562 0 0 00004475 8936[0000] mov word ptr [_lpCurSft], si 0 00004479 8B46FA mov ax, word ptr [bp-6] 0 0000447C A3[0200] mov word ptr [_lpCurSft+2], ax 3907 _.LVL477: 564:dosfns.c **** { 3908 .loc 1 564 0 0 0000447F F6460D08 test byte ptr [bp+13], 8 0 00004483 7557 jne _.L448 3911 _.LBB107: 567:dosfns.c **** ext_open_attrib = attrib & 0xff; 3912 .loc 1 567 0 0 00004485 8B460C mov ax, word ptr [bp+12] 0 00004488 80E470 and ah, 112 0 0000448B A3[0000] mov word ptr [_ext_open_mode], ax 568:dosfns.c **** ext_open_action = ((flags & 0x0300) >> 8) | ((flags & O_CREAT) >> 6); 3916 .loc 1 568 0 0 0000448E 8B46F6 mov ax, word ptr [bp-10] 0 00004491 B400 mov ah, 0 0 00004493 A3[0000] mov word ptr [_ext_open_attrib], ax 569:dosfns.c **** cmd = REM_EXTOC; 3920 .loc 1 569 0 0 00004496 8B460C mov ax, word ptr [bp+12] 0 00004499 B108 mov cl, 8 0 0000449B D3E8 shr ax, cl 0 0000449D 83E003 and ax, 3 0 000044A0 8B560C mov dx, word ptr [bp+12] 0 000044A3 B106 mov cl, 6 0 000044A5 D3EA shr dx, cl 0 000044A7 83E210 and dx, 16 0 000044AA 09D0 or ax, dx 0 000044AC A3[0000] mov word ptr [_ext_open_action], ax 3931 _.LVL478: 570:dosfns.c **** } 3932 .loc 1 570 0 0 000044AF B82E11 mov ax, 4398 3934 _.LVL479: 3935 _.L449: 3936 _.LBE107: 577:dosfns.c **** if (status >= SUCCESS) 3937 .loc 1 577 0 0 000044B2 FF76F6 push word ptr [bp-10] 0 000044B5 FF76FA push word ptr [bp-6] 0 000044B8 56 push si 0 000044B9 50 push ax 0 000044BA E8[FEFF] call _network_redirector_mx 3943 _.LVL480: 0 000044BD 89C3 mov bx, ax 3945 _.LVL481: 578:dosfns.c **** { 3946 .loc 1 578 0 0 000044BF 85C0 test ax, ax 0 000044C1 7C30 jl _.L450 580:dosfns.c **** sftp->sft_count++; 3949 .loc 1 580 0 0 000044C3 8E46FA mov es, word ptr [bp-6] 0 000044C6 26833C00 cmp word ptr es:[si], 0 0 000044CA 7505 jne _.L454 581:dosfns.c **** return sft_idx | ((long)status << 16); 3953 .loc 1 581 0 0 000044CC 26C7040100 mov word ptr es:[si], 1 3955 _.LVL482: 3956 _.L454: 3957 _.LBE108: 631:dosfns.c **** } 3958 .loc 1 631 0 0 000044D1 8B4EF8 mov cx, word ptr [bp-8] 0 000044D4 89C8 mov ax, cx 0 000044D6 99 cwd 0 000044D7 09DA or dx, bx 0 000044D9 E9C400 jmp _.L429 3964 _.LVL483: 3965 _.L448: 3966 _.LBB109: 572:dosfns.c **** { 3967 .loc 1 572 0 0 000044DC F6460D04 test byte ptr [bp+13], 4 0 000044E0 750C jne _.L457 3970 _.LVL484: 575:dosfns.c **** } 3971 .loc 1 575 0 0 000044E2 8A46EF mov al, byte ptr [bp-17] 0 000044E5 98 cbw 0 000044E6 8946F6 mov word ptr [bp-10], ax 3975 _.LVL485: 574:dosfns.c **** attrib = (BYTE)flags; 3976 .loc 1 574 0 0 000044E9 B81611 mov ax, 4374 3978 _.LVL486: 0 000044EC EBC4 jmp _.L449 3980 _.LVL487: 3981 _.L457: 563:dosfns.c **** if (!(flags & O_LEGACY)) 3982 .loc 1 563 0 0 000044EE B81711 mov ax, 4375 0 000044F1 EBBF jmp _.L449 3985 _.LVL488: 3986 _.L450: 584:dosfns.c **** } 3987 .loc 1 584 0 0 000044F3 89C1 mov cx, ax 3989 _.LVL489: 3990 _.L477: 3991 _.LBE109: 3992 _.LBB110: 552:dosfns.c **** } 3993 .loc 1 552 0 0 000044F5 99 cwd 0 000044F6 E9A700 jmp _.L429 3996 _.LVL490: 3997 _.L446: 3998 _.LBE110: 589:dosfns.c **** return DE_INVLDACC; 3999 .loc 1 589 0 0 000044F9 83E003 and ax, 3 0 000044FC 83F803 cmp ax, 3 0 000044FF 7503E9A500 je _.L458 594:dosfns.c **** (attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE | D_VOLID))) 4003 .loc 1 594 0 0 00004504 837E0C00 cmp word ptr [bp+12], 0 0 00004508 7C0A jl _.L452 594:dosfns.c **** (attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE | D_VOLID))) 4006 .loc 1 594 0 is_stmt 0 discriminator 1 0 0000450A F7460ED0FF test word ptr [bp+14], -48 0 0000450F 7403E931FF jne _.L459 4009 _.L452: 4010 _.LVL491: 4011 _.LBB111: 4012 _.LBB112: 0 00004514 E88CEA call _IsShareInstalled.part.1 4014 _.LVL492: 4015 _.LVL493: 4016 _.LBE112: 4017 _.LBE111: 599:dosfns.c **** { 4018 .loc 1 599 0 is_stmt 1 0 00004517 85C0 test ax, ax 0 00004519 742A je _.L453 604:dosfns.c **** return sftp->sft_shroff; 4021 .loc 1 604 0 0 0000451B 8B460C mov ax, word ptr [bp+12] 0 0000451E B104 mov cl, 4 0 00004520 D3E8 shr ax, cl 603:dosfns.c **** flags & 0x03, (flags >> 4) & 0x07)) < 0) 4025 .loc 1 603 0 0 00004522 83E007 and ax, 7 0 00004525 50 push ax 0 00004526 8A460C mov al, byte ptr [bp+12] 0 00004529 83E003 and ax, 3 0 0000452C 50 push ax 0 0000452D FF36[0000] push word ptr [_cu_psp] 0 00004531 16 push ss 0 00004532 FF76F2 push word ptr [bp-14] 0 00004535 E8[FEFF] call _share_open_check 4035 _.LVL494: 602:dosfns.c **** share_open_check(PriPathName, cu_psp, 4036 .loc 1 602 0 0 00004538 8E46FA mov es, word ptr [bp-6] 0 0000453B 26894433 mov word ptr es:[si+51], ax 605:dosfns.c **** } 4039 .loc 1 605 0 0 0000453F 89C1 mov cx, ax 602:dosfns.c **** share_open_check(PriPathName, cu_psp, 4041 .loc 1 602 0 0 00004541 85C0 test ax, ax 0 00004543 7CB0 jl _.L477 4044 _.L453: 614:dosfns.c **** sftp->sft_flags = PriPathName[0] - 'A'; 4045 .loc 1 614 0 0 00004545 8E46FA mov es, word ptr [bp-6] 0 00004548 26FF04 inc word ptr es:[si] 615:dosfns.c **** result = dos_open(PriPathName, flags, attrib, sft_idx); 4048 .loc 1 615 0 0 0000454B 8B5EF2 mov bx, word ptr [bp-14] 0 0000454E 8A07 mov al, byte ptr [bx] 0 00004550 98 cbw 0 00004551 83C0BF add ax, -65 0 00004554 8E46FA mov es, word ptr [bp-6] 0 00004557 26894405 mov word ptr es:[si+5], ax 616:dosfns.c **** DebugPrintf(("dos_open(%s) returned %i\n", PriPathName, result)); 4055 .loc 1 616 0 0 0000455B FF76F8 push word ptr [bp-8] 0 0000455E FF76F6 push word ptr [bp-10] 0 00004561 FF760C push word ptr [bp+12] 0 00004564 FF76F2 push word ptr [bp-14] 0 00004567 E8[FEFF] call _dos_open 4061 _.LVL495: 0 0000456A 89C3 mov bx, ax 0 0000456C 89C1 mov cx, ax 0 0000456E 99 cwd 4065 _.LVL496: 618:dosfns.c **** { 4066 .loc 1 618 0 0 0000456F 85D2 test dx, dx 0 00004571 7C03E95BFF jge _.L454 622:dosfns.c **** { 4069 .loc 1 622 0 0 00004576 8E46FA mov es, word ptr [bp-6] 0 00004579 268B4433 mov ax, word ptr es:[si+51] 0 0000457D 85C0 test ax, ax 0 0000457F 7C19 jl _.L456 0 00004581 8956F6 mov word ptr [bp-10], dx 0 00004584 895EF8 mov word ptr [bp-8], bx 624:dosfns.c **** sftp->sft_shroff = -1; 4076 .loc 1 624 0 0 00004587 50 push ax 0 00004588 E8[FEFF] call _share_close_file 4079 _.LVL497: 625:dosfns.c **** } 4080 .loc 1 625 0 0 0000458B 8E46FA mov es, word ptr [bp-6] 0 0000458E 26C74433FFFF mov word ptr es:[si+51], -1 4083 _.LVL498: 0 00004594 8B56F6 mov dx, word ptr [bp-10] 0 00004597 8B4EF8 mov cx, word ptr [bp-8] 4086 _.L456: 628:dosfns.c **** return result; 4087 .loc 1 628 0 0 0000459A 8E46FA mov es, word ptr [bp-6] 0 0000459D 26FF0C dec word ptr es:[si] 4090 _.L429: 632:dosfns.c **** 4091 .loc 1 632 0 0 000045A0 91 xchg cx, ax 0 000045A1 89EC mov sp, bp 0 000045A3 5D pop bp 0 000045A4 5F pop di 0 000045A5 5E pop si 0 000045A6 C20800 ret 8 4098 _.LVL499: 4099 _.L458: 590:dosfns.c **** 4100 .loc 1 590 0 0 000045A9 B9F4FF mov cx, -12 0 000045AC E963FD jmp _.L476 4103 _.LVL500: 4104 _.L443: 4105 _.LBB113: 552:dosfns.c **** } 4106 .loc 1 552 0 0 000045AF 8B4EF8 mov cx, word ptr [bp-8] 0 000045B2 89C8 mov ax, cx 0 000045B4 E93EFF jmp _.L477 4110 _.LBE113: 4111 _.LFE22: 4112 .size _DosOpenSft, .-_DosOpenSft 4113 .global _DosOpen 4114 .type _DosOpen, @function 4115 _DosOpen: 4116 _.LFB23: 635:dosfns.c **** long result; 4117 .loc 1 635 0 4118 _.LVL501: 0 000045B7 56 push si 0 000045B8 57 push di 0 000045B9 55 push bp 4122 _.LCFI84: 0 000045BA 89E5 mov bp, sp 4124 _.LCFI85: 0 000045BC 1E push ds 0 000045BD 8B7E08 mov di, word ptr [bp+8] 0 000045C0 8B760A mov si, word ptr [bp+10] 640:dosfns.c **** return DE_INVLDACC; 4128 .loc 1 640 0 0 000045C3 F6460C0C test byte ptr [bp+12], 12 0 000045C7 753E jne _.L482 644:dosfns.c **** return result; 4131 .loc 1 644 0 0 000045C9 E84FE9 call _get_free_hndl 4133 _.LVL502: 0 000045CC 89C1 mov cx, ax 4135 _.LVL503: 0 000045CE 85D2 test dx, dx 0 000045D0 7C2C jl _.L478 0 000045D2 8946FE mov word ptr [bp-2], ax 4139 _.LVL504: 648:dosfns.c **** if (result < SUCCESS) 4140 .loc 1 648 0 0 000045D5 FF760E push word ptr [bp+14] 0 000045D8 FF760C push word ptr [bp+12] 0 000045DB 56 push si 0 000045DC 57 push di 0 000045DD E8[FEFF] call _DosOpenSft 4146 _.LVL505: 0 000045E0 89C1 mov cx, ax 649:dosfns.c **** return result; 4148 .loc 1 649 0 0 000045E2 85D2 test dx, dx 0 000045E4 7C18 jl _.L478 652:dosfns.c **** return hndl | (result & 0xffff0000l); 4151 .loc 1 652 0 0 000045E6 8E06[0000] mov es, word ptr [_cu_psp] 0 000045EA 268B363600 mov si, word ptr es:[54] 0 000045EF 8B4EFE mov cx, word ptr [bp-2] 0 000045F2 89CB mov bx, cx 0 000045F4 26031E3400 add bx, word ptr es:[52] 0 000045F9 8EC6 mov es, si 0 000045FB 268807 mov byte ptr es:[bx], al 4159 _.LVL506: 4160 _.L478: 654:dosfns.c **** 4161 .loc 1 654 0 0 000045FE 91 xchg cx, ax 0 000045FF 89EC mov sp, bp 0 00004601 5D pop bp 0 00004602 5F pop di 0 00004603 5E pop si 0 00004604 C20800 ret 8 4168 _.LVL507: 4169 _.L482: 641:dosfns.c **** 4170 .loc 1 641 0 0 00004607 B9F4FF mov cx, -12 0 0000460A BAFFFF mov dx, -1 0 0000460D EBEF jmp _.L478 4174 _.LFE23: 4175 .size _DosOpen, .-_DosOpen 4176 .global _IsShareInstalled 4177 .type _IsShareInstalled, @function 4178 _IsShareInstalled: 4179 _.LFB47: 1435:dosfns.c **** extern unsigned char ASMPASCAL share_check(void); 4180 .loc 1 1435 0 4181 _.LVL508: 0 0000460F 55 push bp 4183 _.LCFI86: 0 00004610 89E5 mov bp, sp 4185 _.LCFI87: 1438:dosfns.c **** return share_installed; 4186 .loc 1 1438 0 0 00004612 837E0401 cmp word ptr [bp+4], 1 0 00004616 7308 jnc _.L486 1439:dosfns.c **** if (share_check() == 0xff) 4189 .loc 1 1439 0 0 00004618 A0[0000] mov al, byte ptr [_share_installed] 0 0000461B 98 cbw 4192 _.L485: 1445:dosfns.c **** 4193 .loc 1 1445 0 0 0000461C 5D pop bp 0 0000461D C20200 ret 2 4196 _.L486: 0 00004620 E880E9 call _IsShareInstalled.part.1 4198 _.LVL509: 0 00004623 EBF7 jmp _.L485 4200 _.LFE47: 4201 .size _IsShareInstalled, .-_IsShareInstalled 4202 .global _DosTruename 4203 .type _DosTruename, @function 4204 _DosTruename: 4205 _.LFB48: 1450:dosfns.c **** /* RBIL: The buffer has be unchanged, if the call fails. 4206 .loc 1 1450 0 4207 _.LVL510: 0 00004625 56 push si 0 00004626 57 push di 0 00004627 55 push bp 4211 _.LCFI88: 0 00004628 89E5 mov bp, sp 4213 _.LCFI89: 0 0000462A 1E push ds 0 0000462B 1E push ds 0 0000462C 8B7E0C mov di, word ptr [bp+12] 0 0000462F 8B460E mov ax, word ptr [bp+14] 0 00004632 8946FE mov word ptr [bp-2], ax 1455:dosfns.c **** if (rc >= SUCCESS) 4219 .loc 1 1455 0 0 00004635 B80400 mov ax, 4 0 00004638 50 push ax 0 00004639 BE[0000] mov si, offset __PriPathBuffer 0 0000463C 56 push si 0 0000463D FF760A push word ptr [bp+10] 0 00004640 FF7608 push word ptr [bp+8] 0 00004643 E8[FEFF] call _truename 4227 _.LVL511: 1456:dosfns.c **** { 4228 .loc 1 1456 0 0 00004646 85C0 test ax, ax 0 00004648 7C12 jl _.L489 0 0000464A 8946FC mov word ptr [bp-4], ax 1458:dosfns.c **** set_fcbname(); 4232 .loc 1 1458 0 0 0000464D 16 push ss 0 0000464E 56 push si 0 0000464F FF76FE push word ptr [bp-2] 0 00004652 57 push di 0 00004653 E8[FEFF] call _fstrcpy 4238 _.LVL512: 1459:dosfns.c **** } 4239 .loc 1 1459 0 0 00004656 E89EEE call _set_fcbname 4241 _.LVL513: 0 00004659 8B46FC mov ax, word ptr [bp-4] 4243 _.LVL514: 4244 _.L489: 1462:dosfns.c **** 4245 .loc 1 1462 0 0 0000465C 89EC mov sp, bp 0 0000465E 5D pop bp 0 0000465F 5F pop di 0 00004660 5E pop si 0 00004661 C20800 ret 8 4251 _.LFE48: 4252 .size _DosTruename, .-_DosTruename 4253 .global _share_installed === Switch to base=012BB0h -> ".BSS" 4254 .bss 4255 .p2align 0 4256 .type _share_installed, @object 4257 .size _share_installed, 1 4258 _share_installed: 0 00000D02 00 .skip 1,0 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: dosidle.lst 1 ; File: 2 ; DosIdle.asm 3 ; Description: 4 ; Dos Idle Interrupt Call 5 ; 6 ; DOS-C 7 ; Copyright (c) 1995, 1999 8 ; James B. Tabor 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; 29 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 30 31 PSP_USERSP equ 2eh 32 PSP_USERSS equ 30h 33 === Switch to base=002270h -> "HMA_TEXT" 34 segment HMA_TEXT 35 36 global _DosIdle_int 37 global _DosIdle_hlt 38 39 extern _InDOS 40 extern _cu_psp 41 extern _MachineId 42 extern critical_sp 43 extern _user_r 44 ; variables as the following are "part of" module inthndlr.c 45 ; because of the define MAIN before include globals.h there! 46 extern _HaltCpuWhileIdle 47 extern _DGROUP_ 48 ; 49 _DosIdle_hlt: 0 000005C6 1E push ds 0 000005C7 2E8E1E[0000] mov ds, [cs:_DGROUP_] 0 000005CC 803E[0000]01 cmp byte [_HaltCpuWhileIdle],1 0 000005D1 7204 jb DosId0 0 000005D3 9C pushf 0 000005D4 FB sti 0 000005D5 F4 hlt ; save some energy :-) 0 000005D6 9D popf 0 000005D7 1F DosId0: pop ds 0 000005D8 C3 retn 60 ; 61 _DosIdle_int: 0 000005D9 E8EAFF call _DosIdle_hlt 0 000005DC 1E push ds 0 000005DD 2E8E1E[0000] mov ds, [cs:_DGROUP_] 0 000005E2 803E[0000]01 cmp byte [_InDOS],1 0 000005E7 7703 ja DosId1 0 000005E9 E80200 call Do_DosI 68 DosId1: 0 000005EC 1F pop ds 0 000005ED C3 retn 71 72 Do_DosI: 0 000005EE 50 push ax 0 000005EF 06 push es 0 000005F0 FF36[0000] push word [_MachineId] 0 000005F4 FF36[0000] push word [_user_r] 0 000005F8 FF36[0200] push word [_user_r+2] 0 000005FC 8E06[0000] mov es,word [_cu_psp] 0 00000600 26FF363000 push word [es:PSP_USERSS] 0 00000605 26FF362E00 push word [es:PSP_USERSP] 81 0 0000060A CD28 int 28h 83 0 0000060C 8E06[0000] mov es,word [_cu_psp] 0 00000610 268F062E00 pop word [es:PSP_USERSP] 0 00000615 268F063000 pop word [es:PSP_USERSS] 0 0000061A 8F06[0200] pop word [_user_r+2] 0 0000061E 8F06[0000] pop word [_user_r] 0 00000622 8F06[0000] pop word [_MachineId] 0 00000626 07 pop es 0 00000627 58 pop ax 0 00000628 C3 ret 93 94 ; segment _DATA ; belongs to DGROUP 95 ; whatever db whatever 96 === Trace listing source: dsk.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=dsk.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccaEbIdN.s output file : dsk.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:52.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _blk_Open, @function 8 _blk_Open: 9 _.LFB14: 10 .file 1 "dsk.c" 1:dsk.c **** /****************************************************************/ 2:dsk.c **** /* */ 3:dsk.c **** /* dsk.c */ 4:dsk.c **** /* */ 5:dsk.c **** /* Copyright (c) 1995 */ 6:dsk.c **** /* Pasquale J. Villani */ 7:dsk.c **** /* All Rights Reserved */ 8:dsk.c **** /* */ 9:dsk.c **** /* This file is part of DOS-C. */ 10:dsk.c **** /* */ 11:dsk.c **** /* DOS-C is free software; you can redistribute it and/or */ 12:dsk.c **** /* modify it under the terms of the GNU General Public License */ 13:dsk.c **** /* as published by the Free Software Foundation; either version */ 14:dsk.c **** /* 2, or (at your option) any later version. */ 15:dsk.c **** /* */ 16:dsk.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 17:dsk.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 18:dsk.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 19:dsk.c **** /* the GNU General Public License for more details. */ 20:dsk.c **** /* */ 21:dsk.c **** /* You should have received a copy of the GNU General Public */ 22:dsk.c **** /* License along with DOS-C; see the file COPYING. If not, */ 23:dsk.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 24:dsk.c **** /* Cambridge, MA 02139, USA. */ 25:dsk.c **** /****************************************************************/ 26:dsk.c **** 27:dsk.c **** #include "portab.h" 28:dsk.c **** #include "globals.h" 29:dsk.c **** #include "dyndata.h" 30:dsk.c **** 31:dsk.c **** #ifdef VERSION_STRINGS 32:dsk.c **** static BYTE *dskRcsId = 33:dsk.c **** "$Id: dsk.c 1702 2012-02-04 08:46:16Z perditionc $"; 34:dsk.c **** #endif 35:dsk.c **** 36:dsk.c **** #if defined(DEBUG) 37:dsk.c **** #define DebugPrintf(x) printf x 38:dsk.c **** #else 39:dsk.c **** #define DebugPrintf(x) 40:dsk.c **** #endif 41:dsk.c **** 42:dsk.c **** /* #define STATIC */ 43:dsk.c **** 44:dsk.c **** BOOL ASMPASCAL fl_reset(WORD); 45:dsk.c **** COUNT ASMPASCAL fl_diskchanged(WORD); 46:dsk.c **** 47:dsk.c **** COUNT ASMPASCAL fl_format(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *); 48:dsk.c **** COUNT ASMPASCAL fl_read(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *); 49:dsk.c **** COUNT ASMPASCAL fl_write(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *); 50:dsk.c **** COUNT ASMPASCAL fl_verify(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *); 51:dsk.c **** COUNT ASMPASCAL fl_setdisktype(WORD, WORD); 52:dsk.c **** COUNT ASMPASCAL fl_setmediatype(WORD, WORD, WORD); 53:dsk.c **** VOID ASMPASCAL fl_readkey(VOID); 54:dsk.c **** extern COUNT ASMPASCAL fl_lba_ReadWrite(BYTE drive, WORD mode, 55:dsk.c **** struct _bios_LBA_address_packet FAR 56:dsk.c **** * dap_p); 57:dsk.c **** UWORD ASMPASCAL floppy_change(UWORD); 58:dsk.c **** #ifdef __WATCOMC__ 59:dsk.c **** #pragma aux (__pascal) fl_reset __modify __exact [__ax __dx] 60:dsk.c **** #pragma aux (__pascal) fl_diskchanged __modify __exact [__ax __dx] 61:dsk.c **** #pragma aux (__pascal) fl_setdisktype __modify __exact [__ax __bx __dx] 62:dsk.c **** #pragma aux (__pascal) fl_readkey __modify __exact [__ax] 63:dsk.c **** #pragma aux (__pascal) fl_lba_ReadWrite __modify __exact [__ax __dx] 64:dsk.c **** #pragma aux (__pascal) floppy_change __modify __exact [__ax __cx __dx] 65:dsk.c **** #endif 66:dsk.c **** 67:dsk.c **** STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, 68:dsk.c **** ULONG LBA_address, unsigned total, UWORD * transferred); 69:dsk.c **** 70:dsk.c **** #define NENTRY 26 /* total size of dispatch table */ 71:dsk.c **** 72:dsk.c **** #define LBA_READ 0x4200 73:dsk.c **** #define LBA_WRITE 0x4300 74:dsk.c **** UWORD LBA_WRITE_VERIFY = 0x4302; 75:dsk.c **** #define LBA_VERIFY 0x4400 76:dsk.c **** #define LBA_FORMAT 0xffff /* fake number for FORMAT track 77:dsk.c **** (only for NON-LBA floppies now!) */ 78:dsk.c **** 79:dsk.c **** /* this buffer must not overlap a 64K boundary 80:dsk.c **** due to DMA transfers 81:dsk.c **** this is certainly true, if located somewhere 82:dsk.c **** at 0xf+1000 and must hold already during BOOT time 83:dsk.c **** */ 84:dsk.c **** UBYTE DiskTransferBuffer[MAX_SEC_SIZE]; 85:dsk.c **** 86:dsk.c **** struct FS_info { 87:dsk.c **** ULONG serialno; 88:dsk.c **** BYTE volume[11]; 89:dsk.c **** BYTE fstype[8]; 90:dsk.c **** }; 91:dsk.c **** 92:dsk.c **** extern struct DynS ASM Dyn; 93:dsk.c **** 94:dsk.c **** /*TE - array access functions */ 95:dsk.c **** ddt *getddt(int dev) 96:dsk.c **** { 97:dsk.c **** return &(((ddt *) Dyn.Buffer)[dev]); 98:dsk.c **** } 99:dsk.c **** 100:dsk.c **** STATIC VOID tmark(ddt *pddt) 101:dsk.c **** { 102:dsk.c **** pddt->ddt_fh.ddt_lasttime = ReadPCClock(); 103:dsk.c **** } 104:dsk.c **** 105:dsk.c **** STATIC BOOL tdelay(ddt *pddt, ULONG ticks) 106:dsk.c **** { 107:dsk.c **** return ReadPCClock() - pddt->ddt_fh.ddt_lasttime >= ticks; 108:dsk.c **** } 109:dsk.c **** 110:dsk.c **** #define N_PART 4 /* number of partitions per 111:dsk.c **** table partition */ 112:dsk.c **** 113:dsk.c **** #define PARTOFF 0x1be 114:dsk.c **** 115:dsk.c **** #ifdef PROTO 116:dsk.c **** typedef WORD dsk_proc(rqptr rq, ddt * pddt); 117:dsk.c **** #else 118:dsk.c **** typedef WORD dsk_proc(); 119:dsk.c **** #endif 120:dsk.c **** 121:dsk.c **** STATIC dsk_proc mediachk, bldbpb, blockio, IoctlQueblk, 122:dsk.c **** Genblkdev, Getlogdev, Setlogdev, blk_Open, blk_Close, 123:dsk.c **** blk_Media, blk_noerr, blk_nondr, blk_error; 124:dsk.c **** 125:dsk.c **** STATIC WORD getbpb(ddt * pddt); 126:dsk.c **** #ifdef PROTO 127:dsk.c **** STATIC WORD dskerr(COUNT); 128:dsk.c **** #else 129:dsk.c **** STATIC WORD dskerr(); 130:dsk.c **** #endif 131:dsk.c **** 132:dsk.c **** /* */ 133:dsk.c **** /* the function dispatch table */ 134:dsk.c **** /* */ 135:dsk.c **** 136:dsk.c **** static dsk_proc * const dispatch[NENTRY] = 137:dsk.c **** { 138:dsk.c **** /* disk init is done in diskinit.c, so this should never be called */ 139:dsk.c **** blk_error, /* Initialize */ 140:dsk.c **** mediachk, /* Media Check */ 141:dsk.c **** bldbpb, /* Build BPB */ 142:dsk.c **** blk_error, /* Ioctl In */ 143:dsk.c **** blockio, /* Input (Read) */ 144:dsk.c **** blk_nondr, /* Non-destructive Read */ 145:dsk.c **** blk_noerr, /* Input Status */ 146:dsk.c **** blk_noerr, /* Input Flush */ 147:dsk.c **** blockio, /* Output (Write) */ 148:dsk.c **** blockio, /* Output with verify */ 149:dsk.c **** blk_noerr, /* Output Status */ 150:dsk.c **** blk_noerr, /* Output Flush */ 151:dsk.c **** blk_error, /* Ioctl Out */ 152:dsk.c **** blk_Open, /* Device Open */ 153:dsk.c **** blk_Close, /* Device Close */ 154:dsk.c **** blk_Media, /* Removable Media */ 155:dsk.c **** blk_noerr, /* Output till busy */ 156:dsk.c **** blk_error, /* undefined */ 157:dsk.c **** blk_error, /* undefined */ 158:dsk.c **** Genblkdev, /* Generic Ioctl Call */ 159:dsk.c **** blk_error, /* undefined */ 160:dsk.c **** blk_error, /* undefined */ 161:dsk.c **** blk_error, /* undefined */ 162:dsk.c **** Getlogdev, /* Get Logical Device */ 163:dsk.c **** Setlogdev, /* Set Logical Device */ 164:dsk.c **** IoctlQueblk /* Ioctl Query */ 165:dsk.c **** }; 166:dsk.c **** 167:dsk.c **** #define hd(x) ((x) & DF_FIXED) 168:dsk.c **** 169:dsk.c **** /* ----------------------------------------------------------------------- */ 170:dsk.c **** /* F U N C T I O N S --------------------------------------------------- */ 171:dsk.c **** /* ----------------------------------------------------------------------- */ 172:dsk.c **** 173:dsk.c **** COUNT ASMCFUNC FAR blk_driver(rqptr rp) 174:dsk.c **** { 175:dsk.c **** if (rp->r_unit >= blk_dev.dh_name[0] && rp->r_command != C_INIT) 176:dsk.c **** return failure(E_UNIT); 177:dsk.c **** if (rp->r_command > NENTRY) 178:dsk.c **** { 179:dsk.c **** return failure(E_FAILURE); /* general failure */ 180:dsk.c **** } 181:dsk.c **** else 182:dsk.c **** return ((*dispatch[rp->r_command]) (rp, getddt(rp->r_unit))); 183:dsk.c **** } 184:dsk.c **** 185:dsk.c **** STATIC char template_string[] = "Remove diskette in drive X:\n"; 186:dsk.c **** #define DRIVE_POS (sizeof(template_string) - 4) 187:dsk.c **** 188:dsk.c **** STATIC WORD play_dj(ddt * pddt) 189:dsk.c **** { 190:dsk.c **** /* play the DJ ... */ 191:dsk.c **** if ((pddt->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == DF_MULTLOG) 192:dsk.c **** { 193:dsk.c **** int i; 194:dsk.c **** ddt *pddt2 = getddt(0); 195:dsk.c **** for (i = 0; i < blk_dev.dh_name[0]; i++, pddt2++) 196:dsk.c **** { 197:dsk.c **** if (pddt->ddt_driveno == pddt2->ddt_driveno && 198:dsk.c **** (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == 199:dsk.c **** (DF_MULTLOG | DF_CURLOG)) 200:dsk.c **** break; 201:dsk.c **** } 202:dsk.c **** if (i == blk_dev.dh_name[0]) 203:dsk.c **** { 204:dsk.c **** put_string("Error in the DJ mechanism!\n"); /* should not happen! */ 205:dsk.c **** } 206:dsk.c **** else 207:dsk.c **** { 208:dsk.c **** xreg dx; 209:dsk.c **** dx.b.l = pddt->ddt_logdriveno; 210:dsk.c **** dx.b.h = pddt2->ddt_logdriveno; 211:dsk.c **** /* call int2f/ax=4a00 */ 212:dsk.c **** if (floppy_change(dx.x) != 0xffff) { 213:dsk.c **** /* if someone else does not make a nice dialog... */ 214:dsk.c **** template_string[DRIVE_POS] = 'A' + pddt2->ddt_logdriveno; 215:dsk.c **** put_string(template_string); 216:dsk.c **** put_string("Insert"); 217:dsk.c **** template_string[DRIVE_POS] = 'A' + pddt->ddt_logdriveno; 218:dsk.c **** put_string(template_string + 6); 219:dsk.c **** put_string("Press any key to continue ... \n"); 220:dsk.c **** fl_readkey(); 221:dsk.c **** } 222:dsk.c **** pddt2->ddt_descflags &= ~DF_CURLOG; 223:dsk.c **** pddt->ddt_descflags |= DF_CURLOG; 224:dsk.c **** pokeb(0, 0x504, pddt->ddt_logdriveno); 225:dsk.c **** } 226:dsk.c **** return M_CHANGED; 227:dsk.c **** } 228:dsk.c **** return M_NOT_CHANGED; 229:dsk.c **** } 230:dsk.c **** 231:dsk.c **** STATIC WORD diskchange(ddt * pddt) 232:dsk.c **** { 233:dsk.c **** COUNT result; 234:dsk.c **** 235:dsk.c **** /* if it's a hard drive, media never changes */ 236:dsk.c **** if (hd(pddt->ddt_descflags)) 237:dsk.c **** return M_NOT_CHANGED; 238:dsk.c **** 239:dsk.c **** if (play_dj(pddt) == M_CHANGED) 240:dsk.c **** return M_CHANGED; 241:dsk.c **** 242:dsk.c **** if (pddt->ddt_descflags & DF_CHANGELINE) /* if we can detect a change ... */ 243:dsk.c **** { 244:dsk.c **** if ((result = fl_diskchanged(pddt->ddt_driveno)) == 1) 245:dsk.c **** /* check if it has changed... */ 246:dsk.c **** return M_CHANGED; 247:dsk.c **** else if (result == 0) 248:dsk.c **** return M_NOT_CHANGED; 249:dsk.c **** } 250:dsk.c **** 251:dsk.c **** /* can not detect or error... */ 252:dsk.c **** return tdelay(pddt, 37ul) ? M_DONT_KNOW : M_NOT_CHANGED; 253:dsk.c **** } 254:dsk.c **** 255:dsk.c **** STATIC WORD mediachk(rqptr rp, ddt * pddt) 256:dsk.c **** { 257:dsk.c **** /* check floppy status */ 258:dsk.c **** if (pddt->ddt_descflags & DF_REFORMAT) 259:dsk.c **** { 260:dsk.c **** pddt->ddt_descflags &= ~DF_REFORMAT; 261:dsk.c **** rp->r_mcretcode = M_CHANGED; 262:dsk.c **** } 263:dsk.c **** else if (pddt->ddt_descflags & DF_DISKCHANGE) 264:dsk.c **** { 265:dsk.c **** pddt->ddt_descflags &= ~DF_DISKCHANGE; 266:dsk.c **** rp->r_mcretcode = M_DONT_KNOW; 267:dsk.c **** } 268:dsk.c **** else 269:dsk.c **** { 270:dsk.c **** rp->r_mcretcode = diskchange(pddt); 271:dsk.c **** if (rp->r_mcretcode == M_DONT_KNOW) 272:dsk.c **** { 273:dsk.c **** /* don't know but can check serial number ... */ 274:dsk.c **** ULONG serialno = pddt->ddt_serialno; 275:dsk.c **** COUNT result = getbpb(pddt); 276:dsk.c **** if (result != 0) 277:dsk.c **** return (result); 278:dsk.c **** if (serialno != pddt->ddt_serialno) 279:dsk.c **** rp->r_mcretcode = M_CHANGED; 280:dsk.c **** } 281:dsk.c **** } 282:dsk.c **** return S_DONE; 283:dsk.c **** } 284:dsk.c **** 285:dsk.c **** /* 286:dsk.c **** * Read Write Sector Zero or Hard Drive Dos Bpb 287:dsk.c **** */ 288:dsk.c **** STATIC WORD RWzero(ddt * pddt, UWORD mode) 289:dsk.c **** { 290:dsk.c **** UWORD done; 291:dsk.c **** 292:dsk.c **** return LBA_Transfer(pddt, mode, 293:dsk.c **** (UBYTE FAR *) DiskTransferBuffer, 294:dsk.c **** pddt->ddt_offset, 1, &done); 295:dsk.c **** } 296:dsk.c **** 297:dsk.c **** /* 298:dsk.c **** 0 if not set, 1 = a, 2 = b, etc, assume set. 299:dsk.c **** page 424 MS Programmer's Ref. 300:dsk.c **** */ 301:dsk.c **** STATIC WORD Getlogdev(rqptr rp, ddt * pddt) 302:dsk.c **** { 303:dsk.c **** int i; 304:dsk.c **** ddt *pddt2; 305:dsk.c **** 306:dsk.c **** if (!(pddt->ddt_descflags & DF_MULTLOG)) { 307:dsk.c **** rp->r_unit = 0; 308:dsk.c **** return S_DONE; 309:dsk.c **** } 310:dsk.c **** 311:dsk.c **** pddt2 = getddt(0); 312:dsk.c **** for (i = 0; i < blk_dev.dh_name[0]; i++, pddt2++) 313:dsk.c **** { 314:dsk.c **** if (pddt->ddt_driveno == pddt2->ddt_driveno && 315:dsk.c **** (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == 316:dsk.c **** (DF_MULTLOG | DF_CURLOG)) 317:dsk.c **** break; 318:dsk.c **** } 319:dsk.c **** 320:dsk.c **** rp->r_unit = i+1; 321:dsk.c **** return S_DONE; 322:dsk.c **** } 323:dsk.c **** 324:dsk.c **** STATIC WORD Setlogdev(rqptr rp, ddt * pddt) 325:dsk.c **** { 326:dsk.c **** unsigned char unit = rp->r_unit; 327:dsk.c **** Getlogdev(rp, pddt); 328:dsk.c **** if (rp->r_unit == 0) 329:dsk.c **** return S_DONE; 330:dsk.c **** getddt(rp->r_unit - 1)->ddt_descflags &= ~DF_CURLOG; 331:dsk.c **** pddt->ddt_descflags |= DF_CURLOG; 332:dsk.c **** rp->r_unit = unit + 1; 333:dsk.c **** return S_DONE; 334:dsk.c **** } 335:dsk.c **** 336:dsk.c **** STATIC WORD blk_Open(rqptr rp, ddt * pddt) 337:dsk.c **** { 11 .loc 1 337 0 12 _.LVL0: 0 000009EC 89E3 mov bx, sp 14 _.LCFI0: 0 000009EE 8B5F06 mov bx, word ptr [bx+6] 338:dsk.c **** UNREFERENCED_PARAMETER(rp); 339:dsk.c **** 340:dsk.c **** pddt->ddt_FileOC++; 16 .loc 1 340 0 0 000009F1 FF4730 inc word ptr [bx+48] 341:dsk.c **** return S_DONE; 342:dsk.c **** } 18 .loc 1 342 0 0 000009F4 B80001 mov ax, 256 0 000009F7 C20600 ret 6 21 _.LFE14: 22 .size _blk_Open, .-_blk_Open 23 .type _blk_Close, @function 24 _blk_Close: 25 _.LFB15: 343:dsk.c **** 344:dsk.c **** STATIC WORD blk_Close(rqptr rp, ddt * pddt) 345:dsk.c **** { 26 .loc 1 345 0 27 _.LVL1: 0 000009FA 89E3 mov bx, sp 29 _.LCFI1: 0 000009FC 8B5F06 mov bx, word ptr [bx+6] 346:dsk.c **** UNREFERENCED_PARAMETER(rp); 347:dsk.c **** 348:dsk.c **** pddt->ddt_FileOC--; 31 .loc 1 348 0 0 000009FF FF4F30 dec word ptr [bx+48] 349:dsk.c **** return S_DONE; 350:dsk.c **** } 33 .loc 1 350 0 0 00000A02 B80001 mov ax, 256 0 00000A05 C20600 ret 6 36 _.LFE15: 37 .size _blk_Close, .-_blk_Close 38 .type _blk_nondr, @function 39 _blk_nondr: 40 _.LFB16: 351:dsk.c **** 352:dsk.c **** STATIC WORD blk_nondr(rqptr rp, ddt * pddt) 353:dsk.c **** { 41 .loc 1 353 0 42 _.LVL2: 354:dsk.c **** UNREFERENCED_PARAMETER(rp); 355:dsk.c **** UNREFERENCED_PARAMETER(pddt); 356:dsk.c **** 357:dsk.c **** return S_BUSY | S_DONE; 358:dsk.c **** } 43 .loc 1 358 0 0 00000A08 B80003 mov ax, 768 0 00000A0B C20600 ret 6 46 _.LFE16: 47 .size _blk_nondr, .-_blk_nondr 48 .type _blk_Media, @function 49 _blk_Media: 50 _.LFB17: 359:dsk.c **** 360:dsk.c **** STATIC WORD blk_Media(rqptr rp, ddt * pddt) 361:dsk.c **** { 51 .loc 1 361 0 52 _.LVL3: 0 00000A0E 89E3 mov bx, sp 54 _.LCFI2: 362:dsk.c **** UNREFERENCED_PARAMETER(rp); 363:dsk.c **** 364:dsk.c **** if (hd(pddt->ddt_descflags)) 55 .loc 1 364 0 0 00000A10 8B5F06 mov bx, word ptr [bx+6] 0 00000A13 F6473301 test byte ptr [bx+51], 1 0 00000A17 7506 jne _.L9 365:dsk.c **** return S_BUSY | S_DONE; /* Hard Drive */ 366:dsk.c **** else 367:dsk.c **** return S_DONE; /* Floppy */ 59 .loc 1 367 0 0 00000A19 B80001 mov ax, 256 61 _.L7: 368:dsk.c **** } 62 .loc 1 368 0 0 00000A1C C20600 ret 6 64 _.L9: 365:dsk.c **** return S_BUSY | S_DONE; /* Hard Drive */ 65 .loc 1 365 0 0 00000A1F B80003 mov ax, 768 0 00000A22 EBF8 jmp _.L7 68 _.LFE17: 69 .size _blk_Media, .-_blk_Media 70 .type _IoctlQueblk, @function 71 _IoctlQueblk: 72 _.LFB20: 369:dsk.c **** 370:dsk.c **** STATIC WORD getbpb(ddt * pddt) 371:dsk.c **** { 372:dsk.c **** ULONG count; 373:dsk.c **** bpb *pbpbarray = &pddt->ddt_bpb; 374:dsk.c **** unsigned secs_per_cyl; 375:dsk.c **** WORD ret; 376:dsk.c **** 377:dsk.c **** /* pddt->ddt_descflags |= DF_NOACCESS; 378:dsk.c **** * disabled for now - problems with FORMAT ?? */ 379:dsk.c **** 380:dsk.c **** /* set drive to not accessible and changed */ 381:dsk.c **** if (diskchange(pddt) != M_NOT_CHANGED) 382:dsk.c **** pddt->ddt_descflags |= DF_DISKCHANGE; 383:dsk.c **** 384:dsk.c **** ret = RWzero(pddt, LBA_READ); 385:dsk.c **** if (ret != 0) 386:dsk.c **** return (dskerr(ret)); 387:dsk.c **** 388:dsk.c **** pbpbarray->bpb_nbyte = getword(&DiskTransferBuffer[BT_BPB]); 389:dsk.c **** 390:dsk.c **** if (DiskTransferBuffer[0x1fe] != 0x55 391:dsk.c **** || DiskTransferBuffer[0x1ff] != 0xaa || pbpbarray->bpb_nbyte % 512) 392:dsk.c **** { 393:dsk.c **** /* copy default bpb to be sure that there is no bogus data */ 394:dsk.c **** memcpy(pbpbarray, &pddt->ddt_defbpb, sizeof(bpb)); 395:dsk.c **** return 0; 396:dsk.c **** } 397:dsk.c **** 398:dsk.c **** pddt->ddt_descflags &= ~DF_NOACCESS; /* set drive to accessible */ 399:dsk.c **** 400:dsk.c **** /*TE ~ 200 bytes*/ 401:dsk.c **** 402:dsk.c **** memcpy(pbpbarray, &DiskTransferBuffer[BT_BPB], sizeof(bpb)); 403:dsk.c **** 404:dsk.c **** /*?? */ 405:dsk.c **** /* 2b is fat16 volume label. if memcmp, then offset 0x36. 406:dsk.c **** if (fstrncmp((BYTE *) & DiskTransferBuffer[0x36], "FAT16",5) == 0 || 407:dsk.c **** fstrncmp((BYTE *) & DiskTransferBuffer[0x36], "FAT12",5) == 0) { 408:dsk.c **** TE: I'm not sure, what the _real_ decision point is, however MSDN 409:dsk.c **** 'A_BF_BPB_SectorsPerFAT 410:dsk.c **** The number of sectors per FAT. 411:dsk.c **** Note: This member will always be zero in a FAT32 BPB. 412:dsk.c **** Use the values from A_BF_BPB_BigSectorsPerFat... 413:dsk.c **** */ 414:dsk.c **** { 415:dsk.c **** struct FS_info *fs = (struct FS_info *)&DiskTransferBuffer[0x27]; 416:dsk.c **** register BYTE extended_BPB_signature; 417:dsk.c **** #ifdef WITHFAT32 418:dsk.c **** if (pbpbarray->bpb_nfsect == 0) 419:dsk.c **** { 420:dsk.c **** /* FAT32 boot sector */ 421:dsk.c **** fs = (struct FS_info *)&DiskTransferBuffer[0x43]; 422:dsk.c **** /* Extended BPB signature, offset differs for FAT32 vs FAT12/16 */ 423:dsk.c **** extended_BPB_signature = DiskTransferBuffer[0x42]; 424:dsk.c **** } 425:dsk.c **** else 426:dsk.c **** #endif 427:dsk.c **** extended_BPB_signature = DiskTransferBuffer[0x26]; 428:dsk.c **** 429:dsk.c **** /* 0x29 is usual signature value for serial#,vol label,& fstype; 430:dsk.c **** 0x28 older EBPB signature indicating only serial# is valid */ 431:dsk.c **** if ((extended_BPB_signature == 0x29) || (extended_BPB_signature == 0x28)) 432:dsk.c **** { 433:dsk.c **** pddt->ddt_serialno = getlong(&fs->serialno); 434:dsk.c **** } else { 435:dsk.c **** /* short BPB, no serial # available */ 436:dsk.c **** pddt->ddt_serialno = 0; 437:dsk.c **** } 438:dsk.c **** if (extended_BPB_signature == 0x29) 439:dsk.c **** { 440:dsk.c **** fmemcpy(pddt->ddt_volume, fs->volume, sizeof fs->volume); 441:dsk.c **** fmemcpy(pddt->ddt_fstype, fs->fstype, sizeof fs->fstype); 442:dsk.c **** } else { 443:dsk.c **** /* earlier extended BPB or short BPB, fields not available */ 444:dsk.c **** fmemcpy(pddt->ddt_volume, "NO NAME ", 11); 445:dsk.c **** fmemcpy(pddt->ddt_fstype, "FAT?? ", 8); 446:dsk.c **** } 447:dsk.c **** } 448:dsk.c **** 449:dsk.c **** #ifdef DSK_DEBUG 450:dsk.c **** printf("BPB_NBYTE = %04x\n", pbpbarray->bpb_nbyte); 451:dsk.c **** printf("BPB_NSECTOR = %02x\n", pbpbarray->bpb_nsector); 452:dsk.c **** printf("BPB_NRESERVED = %04x\n", pbpbarray->bpb_nreserved); 453:dsk.c **** printf("BPB_NFAT = %02x\n", pbpbarray->bpb_nfat); 454:dsk.c **** printf("BPB_NDIRENT = %04x\n", pbpbarray->bpb_ndirent); 455:dsk.c **** printf("BPB_NSIZE = %04x\n", pbpbarray->bpb_nsize); 456:dsk.c **** printf("BPB_MDESC = %02x\n", pbpbarray->bpb_mdesc); 457:dsk.c **** printf("BPB_NFSECT = %04x\n", pbpbarray->bpb_nfsect); 458:dsk.c **** #endif 459:dsk.c **** 460:dsk.c **** count = 461:dsk.c **** pbpbarray->bpb_nsize == 0 ? 462:dsk.c **** pbpbarray->bpb_huge : pbpbarray->bpb_nsize; 463:dsk.c **** secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; 464:dsk.c **** 465:dsk.c **** if (secs_per_cyl == 0) 466:dsk.c **** { 467:dsk.c **** tmark(pddt); 468:dsk.c **** return failure(E_FAILURE); 469:dsk.c **** } 470:dsk.c **** /* this field is problematic for partitions > 65535 cylinders, 471:dsk.c **** in general > 512 GiB. However: we are not using it ourselves. */ 472:dsk.c **** pddt->ddt_ncyl = (UWORD)((count + (secs_per_cyl - 1)) / secs_per_cyl); 473:dsk.c **** 474:dsk.c **** tmark(pddt); 475:dsk.c **** 476:dsk.c **** #ifdef DSK_DEBUG 477:dsk.c **** printf("BPB_NSECS = %04x\n", pbpbarray->bpb_nsecs); 478:dsk.c **** printf("BPB_NHEADS = %04x\n", pbpbarray->bpb_nheads); 479:dsk.c **** printf("BPB_HIDDEN = %08lx\n", pbpbarray->bpb_hidden); 480:dsk.c **** printf("BPB_HUGE = %08lx\n", pbpbarray->bpb_huge); 481:dsk.c **** #endif 482:dsk.c **** 483:dsk.c **** return 0; 484:dsk.c **** } 485:dsk.c **** 486:dsk.c **** STATIC WORD bldbpb(rqptr rp, ddt * pddt) 487:dsk.c **** { 488:dsk.c **** WORD result; 489:dsk.c **** 490:dsk.c **** if ((result = getbpb(pddt)) != 0) 491:dsk.c **** return result; 492:dsk.c **** 493:dsk.c **** rp->r_bpptr = &pddt->ddt_bpb; 494:dsk.c **** return S_DONE; 495:dsk.c **** } 496:dsk.c **** 497:dsk.c **** STATIC WORD IoctlQueblk(rqptr rp, ddt * pddt) 498:dsk.c **** { 73 .loc 1 498 0 74 _.LVL4: 0 00000A24 55 push bp 76 _.LCFI3: 0 00000A25 89E5 mov bp, sp 78 _.LCFI4: 0 00000A27 1E push ds 499:dsk.c **** UNREFERENCED_PARAMETER(pddt); 500:dsk.c **** 501:dsk.c **** #ifdef WITHFAT32 502:dsk.c **** if (rp->r_cat == 8 || rp->r_cat == 0x48) 80 .loc 1 502 0 0 00000A28 C45E04 les bx, dword ptr [bp+4] 0 00000A2B 268A470D mov al, byte ptr es:[bx+13] 0 00000A2F 8846FF mov byte ptr [bp-1], al 0 00000A32 24BF and al, -65 0 00000A34 3C08 cmp al, 8 0 00000A36 7510 jne _.L15 503:dsk.c **** #else 504:dsk.c **** if (rp->r_cat == 8) 505:dsk.c **** #endif 506:dsk.c **** { 507:dsk.c **** switch (rp->r_fun) 87 .loc 1 507 0 0 00000A38 268A470E mov al, byte ptr es:[bx+14] 0 00000A3C 3C60 cmp al, 96 0 00000A3E 7415 je _.L16 0 00000A40 770F ja _.L14 0 00000A42 04BA add al, -70 93 _.L22: 0 00000A44 3C01 cmp al, 1 0 00000A46 760D jbe _.L16 96 _.L15: 508:dsk.c **** { 509:dsk.c **** case 0x46: 510:dsk.c **** case 0x47: 511:dsk.c **** case 0x60: 512:dsk.c **** case 0x66: 513:dsk.c **** case 0x67: 514:dsk.c **** return S_DONE; 515:dsk.c **** } 516:dsk.c **** } 517:dsk.c **** return failure(E_CMD); 97 .loc 1 517 0 0 00000A48 B80381 mov ax, -32509 99 _.L11: 518:dsk.c **** } 100 .loc 1 518 0 0 00000A4B 89EC mov sp, bp 0 00000A4D 5D pop bp 0 00000A4E C20600 ret 6 104 _.L14: 507:dsk.c **** { 105 .loc 1 507 0 0 00000A51 049A add al, -102 0 00000A53 EBEF jmp _.L22 108 _.L16: 514:dsk.c **** } 109 .loc 1 514 0 0 00000A55 B80001 mov ax, 256 0 00000A58 EBF1 jmp _.L11 112 _.LFE20: 113 .size _IoctlQueblk, .-_IoctlQueblk 114 .type _blk_error, @function 115 _blk_error: 116 _.LFB25: 519:dsk.c **** 520:dsk.c **** /* read/write block with CHS based off start of drive's partition */ 521:dsk.c **** STATIC COUNT Genblockio(ddt * pddt, UWORD mode, WORD head, WORD track, 522:dsk.c **** WORD sector, WORD count, VOID FAR * buffer) 523:dsk.c **** { 524:dsk.c **** UWORD transferred; 525:dsk.c **** 526:dsk.c **** /* apparently sector is ZERO, not ONE based !!! */ 527:dsk.c **** return LBA_Transfer(pddt, mode, buffer, 528:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 529:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 530:dsk.c **** pddt->ddt_offset + sector, count, &transferred); 531:dsk.c **** } 532:dsk.c **** 533:dsk.c **** /* read/write block with CHS based off start of disk drive is on */ 534:dsk.c **** STATIC COUNT GenblockioAbs(ddt * pddt, UWORD mode, WORD head, WORD track, 535:dsk.c **** WORD sector, WORD count, VOID FAR * buffer) 536:dsk.c **** { 537:dsk.c **** UWORD transferred; 538:dsk.c **** 539:dsk.c **** /* apparently sector is ZERO, not ONE based !!! */ 540:dsk.c **** return LBA_Transfer(pddt, mode, buffer, 541:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 542:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 543:dsk.c **** sector, count, &transferred); 544:dsk.c **** } 545:dsk.c **** 546:dsk.c **** STATIC WORD Genblkdev(rqptr rp, ddt * pddt) 547:dsk.c **** { 548:dsk.c **** int ret; 549:dsk.c **** unsigned descflags = pddt->ddt_descflags; 550:dsk.c **** #ifdef WITHFAT32 551:dsk.c **** int extended = 0; 552:dsk.c **** 553:dsk.c **** if (rp->r_cat == 0x48) 554:dsk.c **** extended = 1; 555:dsk.c **** else 556:dsk.c **** #endif 557:dsk.c **** if (rp->r_cat != 8) 558:dsk.c **** return failure(E_CMD); 559:dsk.c **** 560:dsk.c **** switch (rp->r_fun) 561:dsk.c **** { 562:dsk.c **** case 0x40: /* set device parameters */ 563:dsk.c **** { 564:dsk.c **** struct gblkio FAR *gblp = rp->r_io; 565:dsk.c **** bpb *pbpb; 566:dsk.c **** 567:dsk.c **** pddt->ddt_type = gblp->gbio_devtype; 568:dsk.c **** pddt->ddt_descflags = (descflags & ~3) | (gblp->gbio_devattrib & 3) 569:dsk.c **** | (DF_DPCHANGED | DF_REFORMAT); 570:dsk.c **** pddt->ddt_ncyl = gblp->gbio_ncyl; 571:dsk.c **** /* use default dpb or current bpb? */ 572:dsk.c **** pbpb = 573:dsk.c **** (gblp->gbio_spcfunbit & 0x01) == 574:dsk.c **** 0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 575:dsk.c **** #ifdef WITHFAT32 576:dsk.c **** fmemcpy(pbpb, &gblp->gbio_bpb, 577:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 578:dsk.c **** #else 579:dsk.c **** fmemcpy(pbpb, &gblp->gbio_bpb, sizeof(gblp->gbio_bpb)); 580:dsk.c **** #endif 581:dsk.c **** /*pbpb->bpb_nsector = gblp->gbio_nsecs; */ 582:dsk.c **** break; 583:dsk.c **** } 584:dsk.c **** case 0x41: /* write track - CHS is absolute not relative to partition start */ 585:dsk.c **** { 586:dsk.c **** struct gblkrw FAR *rw = rp->r_rw; 587:dsk.c **** ret = GenblockioAbs(pddt, LBA_WRITE, rw->gbrw_head, rw->gbrw_cyl, 588:dsk.c **** rw->gbrw_sector, rw->gbrw_nsecs, rw->gbrw_buffer); 589:dsk.c **** if (ret != 0) 590:dsk.c **** return dskerr(ret); 591:dsk.c **** } 592:dsk.c **** break; 593:dsk.c **** case 0x42: /* format/verify track */ 594:dsk.c **** { 595:dsk.c **** struct gblkfv FAR *fv = rp->r_fv; 596:dsk.c **** COUNT tracks; 597:dsk.c **** struct thst { 598:dsk.c **** UBYTE track, head, sector, type; 599:dsk.c **** } *addrfield, afentry; 600:dsk.c **** 601:dsk.c **** pddt->ddt_descflags &= ~DF_DPCHANGED; 602:dsk.c **** if (hd(descflags)) 603:dsk.c **** { 604:dsk.c **** /* XXX no low-level formatting for hard disks implemented */ 605:dsk.c **** fv->gbfv_spcfunbit = 1; /* "not supported by bios" */ 606:dsk.c **** return S_DONE; 607:dsk.c **** } 608:dsk.c **** if (descflags & DF_DPCHANGED) 609:dsk.c **** { 610:dsk.c **** /* first try newer setmediatype function */ 611:dsk.c **** ret = fl_setmediatype(pddt->ddt_driveno, pddt->ddt_ncyl, 612:dsk.c **** pddt->ddt_bpb.bpb_nsecs); 613:dsk.c **** if (ret == 0xc) 614:dsk.c **** { 615:dsk.c **** /* specified tracks, sectors/track not allowed for drive */ 616:dsk.c **** fv->gbfv_spcfunbit = 2; 617:dsk.c **** return dskerr(ret); 618:dsk.c **** } 619:dsk.c **** else if (ret == 0x80) 620:dsk.c **** { 621:dsk.c **** fv->gbfv_spcfunbit = 3; /* no disk in drive */ 622:dsk.c **** return dskerr(ret); 623:dsk.c **** } 624:dsk.c **** else if (ret != 0) 625:dsk.c **** /* otherwise, setdisktype */ 626:dsk.c **** { 627:dsk.c **** unsigned char type; 628:dsk.c **** unsigned tracks, secs; 629:dsk.c **** if ((fv->gbfv_spcfunbit & 1) && 630:dsk.c **** (ret = 631:dsk.c **** fl_read(pddt->ddt_driveno, 0, 0, 1, 1, 632:dsk.c **** DiskTransferBuffer)) != 0) 633:dsk.c **** { 634:dsk.c **** fv->gbfv_spcfunbit = 3; /* no disk in drive */ 635:dsk.c **** return dskerr(ret); 636:dsk.c **** } 637:dsk.c **** /* type 1: 320/360K disk in 360K drive */ 638:dsk.c **** /* type 2: 320/360K disk in 1.2M drive */ 639:dsk.c **** tracks = pddt->ddt_ncyl; 640:dsk.c **** secs = pddt->ddt_bpb.bpb_nsecs; 641:dsk.c **** type = pddt->ddt_type + 1; 642:dsk.c **** if (!(tracks == 40 && (secs == 9 || secs == 8) && type < 3)) 643:dsk.c **** { 644:dsk.c **** /* type 3: 1.2M disk in 1.2M drive */ 645:dsk.c **** /* type 4: 720kb disk in 1.44M or 720kb drive */ 646:dsk.c **** type++; 647:dsk.c **** if (type == 9) /* 1.44M drive */ 648:dsk.c **** type = 4; 649:dsk.c **** if (!(tracks == 80 && ((secs == 15 && type == 3) || 650:dsk.c **** (secs == 9 && type == 4)))) 651:dsk.c **** { 652:dsk.c **** /* specified tracks, sectors/track not allowed for drive */ 653:dsk.c **** fv->gbfv_spcfunbit = 2; 654:dsk.c **** return dskerr(0xc); 655:dsk.c **** } 656:dsk.c **** } 657:dsk.c **** fl_setdisktype(pddt->ddt_driveno, type); 658:dsk.c **** } 659:dsk.c **** } 660:dsk.c **** if (fv->gbfv_spcfunbit & 1) 661:dsk.c **** return S_DONE; 662:dsk.c **** 663:dsk.c **** afentry.type = 2; /* 512 byte sectors */ 664:dsk.c **** afentry.track = fv->gbfv_cyl; 665:dsk.c **** afentry.head = fv->gbfv_head; 666:dsk.c **** 667:dsk.c **** for (tracks = fv->gbfv_spcfunbit & 2 ? fv->gbfv_ntracks : 1; 668:dsk.c **** tracks > 0; tracks--) 669:dsk.c **** { 670:dsk.c **** addrfield = (struct thst *)DiskTransferBuffer; 671:dsk.c **** 672:dsk.c **** if (afentry.track > pddt->ddt_ncyl) 673:dsk.c **** return failure(E_FAILURE); 674:dsk.c **** 675:dsk.c **** for (afentry.sector = 1; 676:dsk.c **** afentry.sector <= pddt->ddt_bpb.bpb_nsecs; afentry.sector++) 677:dsk.c **** memcpy(addrfield++, &afentry, sizeof(afentry)); 678:dsk.c **** 679:dsk.c **** ret = 680:dsk.c **** Genblockio(pddt, LBA_FORMAT, afentry.head, afentry.track, 0, 681:dsk.c **** pddt->ddt_bpb.bpb_nsecs, DiskTransferBuffer); 682:dsk.c **** if (ret != 0) 683:dsk.c **** return dskerr(ret); 684:dsk.c **** } 685:dsk.c **** afentry.head++; 686:dsk.c **** if (afentry.head >= pddt->ddt_bpb.bpb_nheads) 687:dsk.c **** { 688:dsk.c **** afentry.head = 0; 689:dsk.c **** afentry.track++; 690:dsk.c **** } 691:dsk.c **** } 692:dsk.c **** 693:dsk.c **** /* fall through to verify */ 694:dsk.c **** 695:dsk.c **** case 0x62: /* verify track */ 696:dsk.c **** { 697:dsk.c **** struct gblkfv FAR *fv = rp->r_fv; 698:dsk.c **** 699:dsk.c **** ret = Genblockio(pddt, LBA_VERIFY, fv->gbfv_head, fv->gbfv_cyl, 0, 700:dsk.c **** (fv->gbfv_spcfunbit ? 701:dsk.c **** fv->gbfv_ntracks * pddt->ddt_defbpb.bpb_nsecs : 702:dsk.c **** pddt->ddt_defbpb.bpb_nsecs), DiskTransferBuffer); 703:dsk.c **** if (ret != 0) 704:dsk.c **** return dskerr(ret); 705:dsk.c **** fv->gbfv_spcfunbit = 0; /* success */ 706:dsk.c **** } 707:dsk.c **** break; 708:dsk.c **** case 0x46: /* set volume serial number */ 709:dsk.c **** { 710:dsk.c **** struct Gioc_media FAR *gioc = rp->r_gioc; 711:dsk.c **** struct FS_info *fs; 712:dsk.c **** BYTE extended_BPB_signature; 713:dsk.c **** 714:dsk.c **** ret = getbpb(pddt); 715:dsk.c **** if (ret != 0) 716:dsk.c **** return (ret); 717:dsk.c **** 718:dsk.c **** extended_BPB_signature = 719:dsk.c **** DiskTransferBuffer[(pddt->ddt_bpb.bpb_nfsect != 0 ? 0x26 : 0x42)]; 720:dsk.c **** /* return error if media lacks extended BPB with serial # */ 721:dsk.c **** if ((extended_BPB_signature != 0x29) && (extended_BPB_signature != 0x28)) 722:dsk.c **** return failure(E_MEDIA); 723:dsk.c **** 724:dsk.c **** /* otherwise, store serial # in extended BPB */ 725:dsk.c **** fs = (struct FS_info *)&DiskTransferBuffer 726:dsk.c **** [(pddt->ddt_bpb.bpb_nfsect != 0 ? 0x27 : 0x43)]; 727:dsk.c **** fs->serialno = gioc->ioc_serialno; 728:dsk.c **** pddt->ddt_serialno = fs->serialno; 729:dsk.c **** 730:dsk.c **** /* And volume name if BPB supports it */ 731:dsk.c **** if (extended_BPB_signature == 0x29) 732:dsk.c **** { 733:dsk.c **** fmemcpy(fs->volume, gioc->ioc_volume, 11); 734:dsk.c **** fmemcpy(pddt->ddt_volume, fs->volume, 11); 735:dsk.c **** } 736:dsk.c **** 737:dsk.c **** ret = RWzero(pddt, LBA_WRITE); 738:dsk.c **** if (ret != 0) 739:dsk.c **** return (dskerr(ret)); 740:dsk.c **** } 741:dsk.c **** break; 742:dsk.c **** case 0x47: /* set access flag */ 743:dsk.c **** { 744:dsk.c **** struct Access_info FAR *ai = rp->r_ai; 745:dsk.c **** pddt->ddt_descflags = (descflags & ~DF_NOACCESS) | 746:dsk.c **** (ai->AI_Flag ? 0 : DF_NOACCESS); 747:dsk.c **** } 748:dsk.c **** break; 749:dsk.c **** case 0x60: /* get device parameters */ 750:dsk.c **** { 751:dsk.c **** struct gblkio FAR *gblp = rp->r_io; 752:dsk.c **** bpb *pbpb; 753:dsk.c **** 754:dsk.c **** gblp->gbio_devtype = pddt->ddt_type; 755:dsk.c **** gblp->gbio_devattrib = descflags & 3; 756:dsk.c **** /* 360 kb disk in 1.2 MB drive */ 757:dsk.c **** gblp->gbio_media = (pddt->ddt_type == 1) && (pddt->ddt_ncyl == 40); 758:dsk.c **** gblp->gbio_ncyl = pddt->ddt_ncyl; 759:dsk.c **** /* use default dpb or current bpb? */ 760:dsk.c **** pbpb = 761:dsk.c **** (gblp->gbio_spcfunbit & 0x01) == 762:dsk.c **** 0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 763:dsk.c **** #ifdef WITHFAT32 764:dsk.c **** fmemcpy(&gblp->gbio_bpb, pbpb, 765:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 766:dsk.c **** #else 767:dsk.c **** fmemcpy(&gblp->gbio_bpb, pbpb, sizeof(gblp->gbio_bpb)); 768:dsk.c **** #endif 769:dsk.c **** /*gblp->gbio_nsecs = pbpb->bpb_nsector; */ 770:dsk.c **** break; 771:dsk.c **** } 772:dsk.c **** case 0x61: /* read track - CHS is absolute on disk not relative to start of par 773:dsk.c **** { 774:dsk.c **** struct gblkrw FAR *rw = rp->r_rw; 775:dsk.c **** ret = GenblockioAbs(pddt, LBA_READ, rw->gbrw_head, rw->gbrw_cyl, 776:dsk.c **** rw->gbrw_sector, rw->gbrw_nsecs, rw->gbrw_buffer); 777:dsk.c **** if (ret != 0) 778:dsk.c **** return dskerr(ret); 779:dsk.c **** } 780:dsk.c **** break; 781:dsk.c **** case 0x66: /* get volume serial number */ 782:dsk.c **** { 783:dsk.c **** struct Gioc_media FAR *gioc = rp->r_gioc; 784:dsk.c **** 785:dsk.c **** ret = getbpb(pddt); 786:dsk.c **** if (ret != 0) 787:dsk.c **** return (ret); 788:dsk.c **** 789:dsk.c **** /* Note: getbpb() will initialize extended BPB fields with default values */ 790:dsk.c **** gioc->ioc_serialno = pddt->ddt_serialno; 791:dsk.c **** fmemcpy(gioc->ioc_volume, pddt->ddt_volume, 11); 792:dsk.c **** fmemcpy(gioc->ioc_fstype, pddt->ddt_fstype, 8); 793:dsk.c **** } 794:dsk.c **** break; 795:dsk.c **** case 0x67: /* get access flag */ 796:dsk.c **** { 797:dsk.c **** struct Access_info FAR *ai = rp->r_ai; 798:dsk.c **** ai->AI_Flag = descflags & DF_NOACCESS ? 0 : 1; /* bit 9 */ 799:dsk.c **** } 800:dsk.c **** break; 801:dsk.c **** default: 802:dsk.c **** return failure(E_CMD); 803:dsk.c **** } 804:dsk.c **** return S_DONE; 805:dsk.c **** } 806:dsk.c **** 807:dsk.c **** STATIC WORD blockio(rqptr rp, ddt * pddt) 808:dsk.c **** { 809:dsk.c **** ULONG start, size; 810:dsk.c **** WORD ret; 811:dsk.c **** UWORD done; 812:dsk.c **** 813:dsk.c **** int action; 814:dsk.c **** bpb *pbpb; 815:dsk.c **** 816:dsk.c **** switch (rp->r_command) 817:dsk.c **** { 818:dsk.c **** case C_INPUT: 819:dsk.c **** action = LBA_READ; 820:dsk.c **** break; 821:dsk.c **** case C_OUTPUT: 822:dsk.c **** action = LBA_WRITE; 823:dsk.c **** break; 824:dsk.c **** case C_OUTVFY: 825:dsk.c **** action = LBA_WRITE_VERIFY; 826:dsk.c **** break; 827:dsk.c **** default: 828:dsk.c **** return failure(E_FAILURE); 829:dsk.c **** } 830:dsk.c **** 831:dsk.c **** if (pddt->ddt_descflags & DF_NOACCESS) /* drive inaccessible */ 832:dsk.c **** return failure(E_FAILURE); 833:dsk.c **** 834:dsk.c **** tmark(pddt); 835:dsk.c **** start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge); 836:dsk.c **** pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 837:dsk.c **** size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge); 838:dsk.c **** 839:dsk.c **** if (start >= size || start + rp->r_count > size) 840:dsk.c **** { 841:dsk.c **** return 0x0408; 842:dsk.c **** } 843:dsk.c **** start += pddt->ddt_offset; 844:dsk.c **** 845:dsk.c **** ret = LBA_Transfer(pddt, action, 846:dsk.c **** rp->r_trans, 847:dsk.c **** start, rp->r_count, &done); 848:dsk.c **** rp->r_count = done; 849:dsk.c **** 850:dsk.c **** if (ret != 0) 851:dsk.c **** { 852:dsk.c **** return dskerr(ret); 853:dsk.c **** } 854:dsk.c **** return S_DONE; 855:dsk.c **** } 856:dsk.c **** 857:dsk.c **** STATIC WORD blk_error(rqptr rp, ddt * pddt) 858:dsk.c **** { 117 .loc 1 858 0 118 _.LVL5: 0 00000A5A 55 push bp 120 _.LCFI5: 0 00000A5B 89E5 mov bp, sp 122 _.LCFI6: 859:dsk.c **** UNREFERENCED_PARAMETER(pddt); 860:dsk.c **** 861:dsk.c **** rp->r_count = 0; 123 .loc 1 861 0 0 00000A5D C45E04 les bx, dword ptr [bp+4] 0 00000A60 26C747120000 mov word ptr es:[bx+18], 0 126 _.LVL6: 862:dsk.c **** return failure(E_FAILURE); /* general failure */ 863:dsk.c **** } 127 .loc 1 863 0 0 00000A66 B80C81 mov ax, -32500 0 00000A69 5D pop bp 0 00000A6A C20600 ret 6 131 _.LFE25: 132 .size _blk_error, .-_blk_error 133 .type _blk_noerr, @function 134 _blk_noerr: 135 _.LFB26: 864:dsk.c **** 865:dsk.c **** STATIC WORD blk_noerr(rqptr rp, ddt * pddt) 866:dsk.c **** { 136 .loc 1 866 0 137 _.LVL7: 867:dsk.c **** UNREFERENCED_PARAMETER(rp); 868:dsk.c **** UNREFERENCED_PARAMETER(pddt); 869:dsk.c **** 870:dsk.c **** return S_DONE; 871:dsk.c **** } 138 .loc 1 871 0 0 00000A6D B80001 mov ax, 256 0 00000A70 C20600 ret 6 141 _.LFE26: 142 .size _blk_noerr, .-_blk_noerr 143 .type _dskerr, @function 144 _dskerr: 145 _.LFB27: 872:dsk.c **** 873:dsk.c **** STATIC WORD dskerr(COUNT code) 874:dsk.c **** { 146 .loc 1 874 0 147 _.LVL8: 0 00000A73 55 push bp 149 _.LCFI7: 0 00000A74 89E5 mov bp, sp 151 _.LCFI8: 875:dsk.c **** /* printf("diskette error:\nhead = %d\ntrack = %d\nsector = %d\ncount = %d\n", 876:dsk.c **** head, track, sector, count); */ 877:dsk.c **** switch (code & 0x03) 152 .loc 1 877 0 0 00000A76 8A4604 mov al, byte ptr [bp+4] 0 00000A79 83E003 and ax, 3 0 00000A7C 83F802 cmp ax, 2 0 00000A7F 7434 je _.L32 0 00000A81 83F803 cmp ax, 3 0 00000A84 7410 je _.L30 0 00000A86 83F801 cmp ax, 1 0 00000A89 7512 jne _.L38 878:dsk.c **** { 879:dsk.c **** case 1: /* invalid command - general failure */ 880:dsk.c **** if (code & 0x08) 161 .loc 1 880 0 0 00000A8B F6460408 test byte ptr [bp+4], 8 0 00000A8F 7529 jne _.L33 881:dsk.c **** return S_ERROR | E_NOTRDY; /* failure(E_NOTRDY); at least on yhe INT25 route, 882:dsk.c **** 0x8002 is returned */ 883:dsk.c **** else 884:dsk.c **** return failure(E_CMD); 164 .loc 1 884 0 0 00000A91 B80381 mov ax, -32509 0 00000A94 EB03 jmp _.L27 167 _.L30: 885:dsk.c **** 886:dsk.c **** case 2: /* address mark not found - general failure */ 887:dsk.c **** return failure(E_FAILURE); 888:dsk.c **** 889:dsk.c **** case 3: /* write protect */ 890:dsk.c **** return failure(E_WRPRT); 168 .loc 1 890 0 0 00000A96 B80081 mov ax, -32512 170 _.L27: 891:dsk.c **** 892:dsk.c **** default: 893:dsk.c **** if (code & 0x80) /* time-out */ 894:dsk.c **** return failure(E_NOTRDY); 895:dsk.c **** else if (code & 0x40) /* seek error */ 896:dsk.c **** return failure(E_SEEK); 897:dsk.c **** else if (code & 0x10) /* CRC error */ 898:dsk.c **** return failure(E_CRC); 899:dsk.c **** else if (code & 0x04) 900:dsk.c **** return failure(E_NOTFND); 901:dsk.c **** else 902:dsk.c **** return failure(E_FAILURE); 903:dsk.c **** } 904:dsk.c **** } 171 .loc 1 904 0 0 00000A99 5D pop bp 0 00000A9A C20200 ret 2 174 _.L38: 893:dsk.c **** return failure(E_NOTRDY); 175 .loc 1 893 0 0 00000A9D F6460480 test byte ptr [bp+4], -128 0 00000AA1 751C jne _.L34 895:dsk.c **** return failure(E_SEEK); 178 .loc 1 895 0 0 00000AA3 F6460440 test byte ptr [bp+4], 64 0 00000AA7 751B jne _.L35 181 _.LVL9: 182 _.LBB34: 183 _.LBB35: 897:dsk.c **** return failure(E_CRC); 184 .loc 1 897 0 0 00000AA9 F6460410 test byte ptr [bp+4], 16 0 00000AAD 751A jne _.L36 899:dsk.c **** return failure(E_NOTFND); 187 .loc 1 899 0 0 00000AAF F6460404 test byte ptr [bp+4], 4 0 00000AB3 7519 jne _.L37 190 _.LVL10: 191 _.L32: 192 _.LBE35: 193 _.LBE34: 887:dsk.c **** 194 .loc 1 887 0 0 00000AB5 B80C81 mov ax, -32500 0 00000AB8 EBDF jmp _.L27 197 _.L33: 881:dsk.c **** 0x8002 is returned */ 198 .loc 1 881 0 0 00000ABA B80280 mov ax, -32766 0 00000ABD EBDA jmp _.L27 201 _.L34: 894:dsk.c **** else if (code & 0x40) /* seek error */ 202 .loc 1 894 0 0 00000ABF B80281 mov ax, -32510 0 00000AC2 EBD5 jmp _.L27 205 _.L35: 896:dsk.c **** else if (code & 0x10) /* CRC error */ 206 .loc 1 896 0 0 00000AC4 B80681 mov ax, -32506 0 00000AC7 EBD0 jmp _.L27 209 _.LVL11: 210 _.L36: 211 _.LBB37: 212 _.LBB36: 898:dsk.c **** else if (code & 0x04) 213 .loc 1 898 0 0 00000AC9 B80481 mov ax, -32508 0 00000ACC EBCB jmp _.L27 216 _.L37: 900:dsk.c **** else 217 .loc 1 900 0 0 00000ACE B80881 mov ax, -32504 0 00000AD1 EBC6 jmp _.L27 220 _.LBE36: 221 _.LBE37: 222 _.LFE27: 223 .size _dskerr, .-_dskerr 224 .type _Getlogdev, @function 225 _Getlogdev: 226 _.LFB12: 302:dsk.c **** int i; 227 .loc 1 302 0 228 _.LVL12: 0 00000AD3 56 push si 0 00000AD4 57 push di 0 00000AD5 55 push bp 232 _.LCFI9: 0 00000AD6 89E5 mov bp, sp 234 _.LCFI10: 0 00000AD8 1E push ds 0 00000AD9 1E push ds 0 00000ADA C54E08 lds cx, dword ptr [bp+8] 0 00000ADD 8B760C mov si, word ptr [bp+12] 306:dsk.c **** rp->r_unit = 0; 239 .loc 1 306 0 0 00000AE0 368B4433 mov ax, word ptr ss:[si+51] 0 00000AE4 83E010 and ax, 16 0 00000AE7 7447 je _.L41 243 _.LBB43: 244 _.LBB44: 312:dsk.c **** { 245 .loc 1 312 0 0 00000AE9 B8[0000] mov ax, offset _blk_dev@OZSEG16 0 00000AEC 8EC0 mov es, ax 0 00000AEE 26A0[0A00] mov al, byte ptr es:[_blk_dev+10] 0 00000AF2 8846FC mov byte ptr [bp-4], al 0 00000AF5 C646FD00 mov byte ptr [bp-3], 0 0 00000AF9 C746FE0000 mov word ptr [bp-2], 0 315:dsk.c **** (DF_MULTLOG | DF_CURLOG)) 252 .loc 1 315 0 0 00000AFE B8[3500] mov ax, offset _Dyn+53 0 00000B01 8EC0 mov es, ax 255 _.L42: 256 _.LVL13: 312:dsk.c **** { 257 .loc 1 312 0 0 00000B03 8B46FE mov ax, word ptr [bp-2] 0 00000B06 3B46FC cmp ax, word ptr [bp-4] 0 00000B09 7D20 jge _.L46 0 00000B0B B88800 mov ax, 136 0 00000B0E F766FE mul word ptr [bp-2] 0 00000B11 93 xchg bx, ax 314:dsk.c **** (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == 264 .loc 1 314 0 0 00000B12 368A5404 mov dl, byte ptr ss:[si+4] 0 00000B16 BF[0600] mov di, offset _Dyn+6 0 00000B19 363A11 cmp dl, byte ptr ss:[bx+di] 0 00000B1C 7524 jne _.L43 315:dsk.c **** (DF_MULTLOG | DF_CURLOG)) 269 .loc 1 315 0 0 00000B1E 8CC7 mov di, es 0 00000B20 368A11 mov dl, byte ptr ss:[bx+di] 0 00000B23 83E230 and dx, 48 314:dsk.c **** (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == 273 .loc 1 314 0 0 00000B26 83FA30 cmp dx, 48 0 00000B29 7517 jne _.L43 276 _.L46: 320:dsk.c **** return S_DONE; 277 .loc 1 320 0 0 00000B2B 8A46FE mov al, byte ptr [bp-2] 0 00000B2E FEC0 inc al 280 _.LVL14: 281 _.L41: 282 _.LBE44: 283 _.LBE43: 307:dsk.c **** return S_DONE; 284 .loc 1 307 0 0 00000B30 89CB mov bx, cx 0 00000B32 884701 mov byte ptr [bx+1], al 287 _.LVL15: 322:dsk.c **** 288 .loc 1 322 0 0 00000B35 B80001 mov ax, 256 0 00000B38 89EC mov sp, bp 0 00000B3A 5D pop bp 0 00000B3B 5F pop di 0 00000B3C 5E pop si 0 00000B3D 16 push ss 0 00000B3E 1F pop ds 0 00000B3F C20600 ret 6 297 _.LVL16: 298 _.L43: 299 _.LBB46: 300 _.LBB45: 312:dsk.c **** { 301 .loc 1 312 0 0 00000B42 FF46FE inc word ptr [bp-2] 303 _.LVL17: 0 00000B45 EBBC jmp _.L42 305 _.LBE45: 306 _.LBE46: 307 _.LFE12: 308 .size _Getlogdev, .-_Getlogdev 309 .type _Setlogdev, @function 310 _Setlogdev: 311 _.LFB13: 325:dsk.c **** unsigned char unit = rp->r_unit; 312 .loc 1 325 0 313 _.LVL18: 0 00000B47 56 push si 0 00000B48 57 push di 0 00000B49 55 push bp 317 _.LCFI11: 0 00000B4A 89E5 mov bp, sp 319 _.LCFI12: 0 00000B4C 83EC06 sub sp, 6 0 00000B4F 8B5E08 mov bx, word ptr [bp+8] 0 00000B52 8B7E0A mov di, word ptr [bp+10] 0 00000B55 8B460C mov ax, word ptr [bp+12] 0 00000B58 8946FE mov word ptr [bp-2], ax 326:dsk.c **** Getlogdev(rp, pddt); 325 .loc 1 326 0 0 00000B5B 8EC7 mov es, di 0 00000B5D 268A4701 mov al, byte ptr es:[bx+1] 0 00000B61 8846FD mov byte ptr [bp-3], al 329 _.LVL19: 327:dsk.c **** if (rp->r_unit == 0) 330 .loc 1 327 0 0 00000B64 FF76FE push word ptr [bp-2] 0 00000B67 57 push di 0 00000B68 53 push bx 0 00000B69 895EFA mov word ptr [bp-6], bx 0 00000B6C E864FF call _Getlogdev 336 _.LVL20: 328:dsk.c **** return S_DONE; 337 .loc 1 328 0 0 00000B6F 8EC7 mov es, di 0 00000B71 8B5EFA mov bx, word ptr [bp-6] 0 00000B74 268A5701 mov dl, byte ptr es:[bx+1] 0 00000B78 84D2 test dl, dl 0 00000B7A 741F je _.L49 343 _.LVL21: 330:dsk.c **** pddt->ddt_descflags |= DF_CURLOG; 344 .loc 1 330 0 0 00000B7C 30F6 xor dh, dh 346 _.LVL22: 0 00000B7E 92 xchg dx, ax 0 00000B7F 48 dec ax 349 _.LBB47: 350 _.LBB48: 97:dsk.c **** } 351 .loc 1 97 0 0 00000B80 BA8800 mov dx, 136 0 00000B83 F7E2 mul dx 354 _.LVL23: 355 _.LBE48: 356 _.LBE47: 330:dsk.c **** pddt->ddt_descflags |= DF_CURLOG; 357 .loc 1 330 0 0 00000B85 96 xchg si, ax 0 00000B86 80A4[3500]DF and byte ptr [si+_Dyn+53], -33 331:dsk.c **** rp->r_unit = unit + 1; 360 .loc 1 331 0 0 00000B8B 8B76FE mov si, word ptr [bp-2] 0 00000B8E 804C3320 or byte ptr [si+51], 32 332:dsk.c **** return S_DONE; 363 .loc 1 332 0 0 00000B92 8A46FD mov al, byte ptr [bp-3] 0 00000B95 FEC0 inc al 0 00000B97 26884701 mov byte ptr es:[bx+1], al 367 _.LVL24: 368 _.L49: 334:dsk.c **** 369 .loc 1 334 0 0 00000B9B B80001 mov ax, 256 0 00000B9E 89EC mov sp, bp 0 00000BA0 5D pop bp 0 00000BA1 5F pop di 0 00000BA2 5E pop si 0 00000BA3 C20600 ret 6 376 _.LFE13: 377 .size _Setlogdev, .-_Setlogdev === Switch to base=012BB0h -> ".RODATA.STR1.1" 378 .section .rodata.str1.1,"aMS",@progbits,1 379 _.LC0: 0 00001884 4572726F7220696E .string "Error in the DJ mechanism!\n" 0 0000188C 2074686520444A20 0 00001894 6D656368616E6973 0 0000189C 6D210A00 381 _.LC1: 0 000018A0 496E7365727400 .string "Insert" 383 _.LC2: 0 000018A7 507265737320616E .string "Press any key to continue ... \n" 0 000018AF 79206B657920746F 0 000018B7 20636F6E74696E75 0 000018BF 65202E2E2E200A00 === Switch to base=002270h -> ".TEXT" 385 .text 386 .type _play_dj.part.2, @function 387 _play_dj.part.2: 388 _.LFB33: 188:dsk.c **** { 389 .loc 1 188 0 390 _.LVL25: 0 00000BA6 56 push si 0 00000BA7 57 push di 0 00000BA8 55 push bp 394 _.LCFI13: 0 00000BA9 89E5 mov bp, sp 396 _.LCFI14: 0 00000BAB 1E push ds 0 00000BAC 8B7E08 mov di, word ptr [bp+8] 399 _.LBB49: 195:dsk.c **** { 400 .loc 1 195 0 0 00000BAF B8[0000] mov ax, offset _blk_dev@OZSEG16 0 00000BB2 8EC0 mov es, ax 0 00000BB4 268A16[0A00] mov dl, byte ptr es:[_blk_dev+10] 0 00000BB9 30F6 xor dh, dh 0 00000BBB BE[0200] mov si, offset _Dyn+2 0 00000BBE 31C0 xor ax, ax 407 _.L55: 408 _.LVL26: 0 00000BC0 39D0 cmp ax, dx 0 00000BC2 7C14 jl _.L58 202:dsk.c **** { 411 .loc 1 202 0 0 00000BC4 752C jne _.L57 204:dsk.c **** } 413 .loc 1 204 0 0 00000BC6 B8[0000] mov ax, offset _.LC0 415 _.LVL27: 0 00000BC9 50 push ax 0 00000BCA E8[FEFF] call _put_string 418 _.LVL28: 419 _.L59: 420 _.LBE49: 229:dsk.c **** 421 .loc 1 229 0 0 00000BCD B8FFFF mov ax, -1 0 00000BD0 89EC mov sp, bp 0 00000BD2 5D pop bp 0 00000BD3 5F pop di 0 00000BD4 5E pop si 427 _.LVL29: 0 00000BD5 C20200 ret 2 429 _.LVL30: 430 _.L58: 431 _.LBB51: 197:dsk.c **** (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == 432 .loc 1 197 0 0 00000BD8 8A4D04 mov cl, byte ptr [di+4] 0 00000BDB 3A4C04 cmp cl, byte ptr [si+4] 0 00000BDE 750B jne _.L56 198:dsk.c **** (DF_MULTLOG | DF_CURLOG)) 436 .loc 1 198 0 0 00000BE0 8A4C33 mov cl, byte ptr [si+51] 0 00000BE3 83E130 and cx, 48 197:dsk.c **** (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == 439 .loc 1 197 0 0 00000BE6 83F930 cmp cx, 48 0 00000BE9 7407 je _.L57 442 _.L56: 195:dsk.c **** { 443 .loc 1 195 0 0 00000BEB 40 inc ax 445 _.LVL31: 0 00000BEC 81C68800 add si, 136 447 _.LVL32: 0 00000BF0 EBCE jmp _.L55 449 _.L57: 450 _.LBB50: 210:dsk.c **** /* call int2f/ax=4a00 */ 451 .loc 1 210 0 0 00000BF2 8A4405 mov al, byte ptr [si+5] 453 _.LVL33: 0 00000BF5 B108 mov cl, 8 0 00000BF7 D3E0 shl ax, cl 0 00000BF9 0A4505 or al, byte ptr [di+5] 212:dsk.c **** /* if someone else does not make a nice dialog... */ 457 .loc 1 212 0 0 00000BFC 50 push ax 0 00000BFD E8[FEFF] call _floppy_change 460 _.LVL34: 0 00000C00 83F8FF cmp ax, -1 0 00000C03 7435 je _.L60 214:dsk.c **** put_string(template_string); 463 .loc 1 214 0 0 00000C05 BB[1000] mov bx, offset _template_string 0 00000C08 8A4405 mov al, byte ptr [si+5] 0 00000C0B 0441 add al, 65 0 00000C0D 884719 mov byte ptr [bx+25], al 215:dsk.c **** put_string("Insert"); 468 .loc 1 215 0 0 00000C10 53 push bx 0 00000C11 895EFE mov word ptr [bp-2], bx 0 00000C14 E8[FEFF] call _put_string 472 _.LVL35: 216:dsk.c **** template_string[DRIVE_POS] = 'A' + pddt->ddt_logdriveno; 473 .loc 1 216 0 0 00000C17 B8[1C00] mov ax, offset _.LC1 0 00000C1A 50 push ax 0 00000C1B E8[FEFF] call _put_string 477 _.LVL36: 217:dsk.c **** put_string(template_string + 6); 478 .loc 1 217 0 0 00000C1E 8A4505 mov al, byte ptr [di+5] 0 00000C21 0441 add al, 65 0 00000C23 8B5EFE mov bx, word ptr [bp-2] 0 00000C26 884719 mov byte ptr [bx+25], al 218:dsk.c **** put_string("Press any key to continue ... \n"); 483 .loc 1 218 0 0 00000C29 B8[1600] mov ax, offset _template_string+6 0 00000C2C 50 push ax 0 00000C2D E8[FEFF] call _put_string 487 _.LVL37: 219:dsk.c **** fl_readkey(); 488 .loc 1 219 0 0 00000C30 B8[2300] mov ax, offset _.LC2 0 00000C33 50 push ax 0 00000C34 E8[FEFF] call _put_string 492 _.LVL38: 220:dsk.c **** } 493 .loc 1 220 0 0 00000C37 E8[FEFF] call _fl_readkey 495 _.LVL39: 496 _.L60: 222:dsk.c **** pddt->ddt_descflags |= DF_CURLOG; 497 .loc 1 222 0 0 00000C3A 806433DF and byte ptr [si+51], -33 223:dsk.c **** pokeb(0, 0x504, pddt->ddt_logdriveno); 499 .loc 1 223 0 0 00000C3E 804D3320 or byte ptr [di+51], 32 224:dsk.c **** } 501 .loc 1 224 0 0 00000C42 8A4505 mov al, byte ptr [di+5] 0 00000C45 31D2 xor dx, dx 0 00000C47 8EC2 mov es, dx 0 00000C49 26A20405 mov byte ptr es:[1284], al 506 _.LVL40: 0 00000C4D E97DFF jmp _.L59 508 _.LBE50: 509 _.LBE51: 510 _.LFE33: 511 .size _play_dj.part.2, .-_play_dj.part.2 === Switch to base=012BB0h -> ".RODATA.STR1.1" 512 .section .rodata.str1.1 513 _.LC3: 0 000018C7 4C42412D5472616E .string "LBA-Transfer error : cylinder > 1023\n" 0 000018CF 7366657220657272 0 000018D7 6F72203A2063796C 0 000018DF 696E646572203E20 0 000018E7 313032330A00 === Switch to base=002270h -> ".TEXT" 515 .text 516 .type _LBA_Transfer, @function 517 _LBA_Transfer: 518 _.LFB30: 905:dsk.c **** 906:dsk.c **** /* 907:dsk.c **** translate LBA sectors into CHS addressing 908:dsk.c **** */ 909:dsk.c **** 910:dsk.c **** STATIC int LBA_to_CHS(ULONG LBA_address, struct CHS *chs, const ddt * pddt, 911:dsk.c **** const bpb ** ppbpb) 912:dsk.c **** { 913:dsk.c **** /* we need the defbpb values since those are taken from the 914:dsk.c **** BIOS, not from some random boot sector, except when 915:dsk.c **** we're dealing with a floppy */ 916:dsk.c **** 917:dsk.c **** const bpb *pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 918:dsk.c **** unsigned hs = pbpb->bpb_nsecs * pbpb->bpb_nheads; 919:dsk.c **** unsigned hsrem = (unsigned)(LBA_address % hs); 920:dsk.c **** 921:dsk.c **** LBA_address /= hs; 922:dsk.c **** 923:dsk.c **** if (LBA_address > 1023ul) 924:dsk.c **** { 925:dsk.c **** #ifdef DEBUG 926:dsk.c **** printf("LBA-Transfer error : cylinder %lu > 1023\n", LBA_address); 927:dsk.c **** #else 928:dsk.c **** put_string("LBA-Transfer error : cylinder > 1023\n"); 929:dsk.c **** #endif 930:dsk.c **** return 1; 931:dsk.c **** } 932:dsk.c **** 933:dsk.c **** chs->Cylinder = (UWORD)LBA_address; 934:dsk.c **** chs->Head = hsrem / pbpb->bpb_nsecs; 935:dsk.c **** chs->Sector = hsrem % pbpb->bpb_nsecs + 1; 936:dsk.c **** *ppbpb = pbpb; 937:dsk.c **** return 0; 938:dsk.c **** } 939:dsk.c **** 940:dsk.c **** /* Test for 64K boundary crossing and return count small */ 941:dsk.c **** /* enough not to exceed the threshold. */ 942:dsk.c **** 943:dsk.c **** STATIC unsigned DMA_max_transfer(void FAR * buffer, unsigned count) 944:dsk.c **** { 945:dsk.c **** unsigned dma_off = (UWORD)((FP_SEG(buffer) << 4) + FP_OFF(buffer)); 946:dsk.c **** unsigned sectors_to_dma_boundary = (dma_off == 0 ? 947:dsk.c **** 0xffff / maxsecsize : 948:dsk.c **** (UWORD)(-dma_off) / maxsecsize); 949:dsk.c **** 950:dsk.c **** return min(count, sectors_to_dma_boundary); 951:dsk.c **** } 952:dsk.c **** 953:dsk.c **** /* 954:dsk.c **** int LBA_Transfer( 955:dsk.c **** ddt *pddt, physical characteristics of drive 956:dsk.c **** UWORD mode, LBA_READ/WRITE/WRITE_VERIFY/VERIFY 957:dsk.c **** VOID FAR *buffer, user buffer 958:dsk.c **** ULONG LBA_address, absolute sector address 959:dsk.c **** unsigned totaltodo, number of sectors to transfer 960:dsk.c **** UWORD *transferred sectors actually transferred 961:dsk.c **** 962:dsk.c **** Read/Write/Write+verify some sectors, using LBA addressing. 963:dsk.c **** 964:dsk.c **** 965:dsk.c **** This function handles all the minor details, including: 966:dsk.c **** 967:dsk.c **** retry in case of errors 968:dsk.c **** 969:dsk.c **** crossing the 64K DMA boundary 970:dsk.c **** 971:dsk.c **** translation to CHS addressing if necessary 972:dsk.c **** 973:dsk.c **** crossing track boundaries (necessary for some BIOSes 974:dsk.c **** 975:dsk.c **** High memory doesn't work very well, use internal buffer 976:dsk.c **** 977:dsk.c **** write with verify details for LBA 978:dsk.c **** 979:dsk.c **** */ 980:dsk.c **** 981:dsk.c **** STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, 982:dsk.c **** ULONG LBA_address, unsigned totaltodo, 983:dsk.c **** UWORD * transferred) 984:dsk.c **** { 519 .loc 1 984 0 520 _.LVL41: 0 00000C50 56 push si 0 00000C51 57 push di 0 00000C52 55 push bp 524 _.LCFI15: 0 00000C53 89E5 mov bp, sp 526 _.LCFI16: 0 00000C55 83EC1A sub sp, 26 0 00000C58 8B7E0C mov di, word ptr [bp+12] 0 00000C5B 8B760E mov si, word ptr [bp+14] 0 00000C5E C44610 les ax, dword ptr [bp+16] 0 00000C61 8946F2 mov word ptr [bp-14], ax 0 00000C64 8C46F0 mov word ptr [bp-16], es 533 _.LVL42: 985:dsk.c **** static struct _bios_LBA_address_packet dap = { 986:dsk.c **** 16, 0, 0, 0, 0, 0, 0 987:dsk.c **** }; 988:dsk.c **** 989:dsk.c **** unsigned count; 990:dsk.c **** unsigned error_code = 0; 991:dsk.c **** struct CHS chs; 992:dsk.c **** void FAR *transfer_address; 993:dsk.c **** unsigned char driveno = pddt->ddt_driveno; 534 .loc 1 993 0 0 00000C67 8B5E08 mov bx, word ptr [bp+8] 0 00000C6A 8A4704 mov al, byte ptr [bx+4] 0 00000C6D 8846F9 mov byte ptr [bp-7], al 538 _.LVL43: 994:dsk.c **** 995:dsk.c **** int num_retries; 996:dsk.c **** 997:dsk.c **** UWORD bytes_sector = pddt->ddt_bpb.bpb_nbyte; /* bytes per sector, usually 512 */ 539 .loc 1 997 0 0 00000C70 8B4706 mov ax, word ptr [bx+6] 541 _.LVL44: 0 00000C73 8946EE mov word ptr [bp-18], ax 543 _.LVL45: 998:dsk.c **** *transferred = 0; 544 .loc 1 998 0 0 00000C76 8B5E16 mov bx, word ptr [bp+22] 546 _.LVL46: 0 00000C79 C7070000 mov word ptr [bx], 0 548 _.LVL47: 999:dsk.c **** 1000:dsk.c **** /* only low-level format floppies for now ! */ 1001:dsk.c **** if (mode == LBA_FORMAT && hd(pddt->ddt_descflags)) 549 .loc 1 1001 0 0 00000C7D 837E0AFF cmp word ptr [bp+10], -1 0 00000C81 8B5E08 mov bx, word ptr [bp+8] 0 00000C84 8B4733 mov ax, word ptr [bx+51] 553 _.LVL48: 0 00000C87 750E jne _.L69 555 .loc 1 1001 0 is_stmt 0 discriminator 1 0 00000C89 A801 test al, 1 0 00000C8B 740A je _.L69 558 _.LVL49: 559 _.L97: 1002:dsk.c **** return 0; 560 .loc 1 1002 0 is_stmt 1 0 00000C8D 31C0 xor ax, ax 562 _.LVL50: 563 _.L68: 1003:dsk.c **** 1004:dsk.c **** /* optionally change from A: to B: or back */ 1005:dsk.c **** play_dj(pddt); 1006:dsk.c **** 1007:dsk.c **** if (!hd(pddt->ddt_descflags)) 1008:dsk.c **** { 1009:dsk.c **** UBYTE FAR *int1e_ptr = (UBYTE FAR *)getvec(0x1e); 1010:dsk.c **** unsigned char nsecs = (unsigned char)(pddt->ddt_bpb.bpb_nsecs); 1011:dsk.c **** 1012:dsk.c **** if (int1e_ptr[4] != nsecs) 1013:dsk.c **** { 1014:dsk.c **** int1e_ptr[4] = nsecs; 1015:dsk.c **** fl_reset(driveno); 1016:dsk.c **** } 1017:dsk.c **** } 1018:dsk.c **** 1019:dsk.c **** /* 1020:dsk.c **** if (LBA_address+totaltodo > pddt->total_sectors) 1021:dsk.c **** { 1022:dsk.c **** printf("LBA-Transfer error : address overflow = %lu > %lu max\n",LBA_address+totaltodo,driv 1023:dsk.c **** return 1; 1024:dsk.c **** } 1025:dsk.c **** */ 1026:dsk.c **** 1027:dsk.c **** buffer = adjust_far(buffer); 1028:dsk.c **** for (; totaltodo != 0;) 1029:dsk.c **** { 1030:dsk.c **** count = totaltodo; 1031:dsk.c **** if ((pddt->ddt_descflags & DF_DMA_TRANSPARENT) == 0) 1032:dsk.c **** { 1033:dsk.c **** /* avoid overflowing 64K DMA boundary 1034:dsk.c **** for drives that don't handle this transparently */ 1035:dsk.c **** count = DMA_max_transfer(buffer, totaltodo); 1036:dsk.c **** } 1037:dsk.c **** 1038:dsk.c **** if (FP_SEG(buffer) >= 0xa000 || count == 0) 1039:dsk.c **** { 1040:dsk.c **** transfer_address = DiskTransferBuffer; 1041:dsk.c **** count = 1; 1042:dsk.c **** 1043:dsk.c **** if ((mode & 0xff00) == (LBA_WRITE & 0xff00)) 1044:dsk.c **** { 1045:dsk.c **** fmemcpy(DiskTransferBuffer, buffer, bytes_sector); 1046:dsk.c **** } 1047:dsk.c **** } 1048:dsk.c **** else 1049:dsk.c **** { 1050:dsk.c **** transfer_address = buffer; 1051:dsk.c **** } 1052:dsk.c **** 1053:dsk.c **** for (num_retries = 0; num_retries < N_RETRY; num_retries++) 1054:dsk.c **** { 1055:dsk.c **** if ((pddt->ddt_descflags & DF_LBA) && mode != LBA_FORMAT) 1056:dsk.c **** { 1057:dsk.c **** dap.number_of_blocks = count; 1058:dsk.c **** 1059:dsk.c **** dap.buffer_address = transfer_address; 1060:dsk.c **** 1061:dsk.c **** dap.block_address_high = 0; /* clear high part */ 1062:dsk.c **** dap.block_address = LBA_address; /* clear high part */ 1063:dsk.c **** 1064:dsk.c **** /* Load the registers and call the interrupt. */ 1065:dsk.c **** 1066:dsk.c **** if ((pddt->ddt_descflags & DF_WRTVERIFY) || mode != LBA_WRITE_VERIFY) 1067:dsk.c **** { 1068:dsk.c **** error_code = fl_lba_ReadWrite(driveno, mode, &dap); 1069:dsk.c **** } 1070:dsk.c **** else 1071:dsk.c **** { 1072:dsk.c **** /* verify requested, but not supported */ 1073:dsk.c **** error_code = 1074:dsk.c **** fl_lba_ReadWrite(driveno, LBA_WRITE, &dap); 1075:dsk.c **** 1076:dsk.c **** if (error_code == 0) 1077:dsk.c **** { 1078:dsk.c **** error_code = 1079:dsk.c **** fl_lba_ReadWrite(driveno, LBA_VERIFY, &dap); 1080:dsk.c **** } 1081:dsk.c **** } 1082:dsk.c **** } 1083:dsk.c **** else 1084:dsk.c **** { /* transfer data, using old bios functions */ 1085:dsk.c **** const bpb *pbpb; 1086:dsk.c **** if (LBA_to_CHS(LBA_address, &chs, pddt, &pbpb)) 1087:dsk.c **** return 1; 1088:dsk.c **** 1089:dsk.c **** /* avoid overflow at end of track */ 1090:dsk.c **** 1091:dsk.c **** if (chs.Sector + count > (unsigned)pbpb->bpb_nsecs + 1) 1092:dsk.c **** { 1093:dsk.c **** count = pbpb->bpb_nsecs + 1 - chs.Sector; 1094:dsk.c **** } 1095:dsk.c **** 1096:dsk.c **** error_code = (mode == LBA_READ ? fl_read : 1097:dsk.c **** mode == LBA_VERIFY ? fl_verify : 1098:dsk.c **** mode == 1099:dsk.c **** LBA_FORMAT ? fl_format : fl_write) (driveno, 1100:dsk.c **** chs.Head, 1101:dsk.c **** chs.Cylinder, 1102:dsk.c **** chs.Sector, 1103:dsk.c **** count, 1104:dsk.c **** transfer_address); 1105:dsk.c **** 1106:dsk.c **** if (error_code == 0 && mode == LBA_WRITE_VERIFY) 1107:dsk.c **** { 1108:dsk.c **** error_code = fl_verify(driveno, chs.Head, chs.Cylinder, 1109:dsk.c **** chs.Sector, count, transfer_address); 1110:dsk.c **** } 1111:dsk.c **** } 1112:dsk.c **** if (error_code == 0) 1113:dsk.c **** break; 1114:dsk.c **** 1115:dsk.c **** fl_reset(driveno); 1116:dsk.c **** 1117:dsk.c **** } /* end of retries */ 1118:dsk.c **** 1119:dsk.c **** if (error_code) 1120:dsk.c **** { 1121:dsk.c **** return error_code; 1122:dsk.c **** } 1123:dsk.c **** 1124:dsk.c **** /* copy to user buffer if nesessary */ 1125:dsk.c **** if (transfer_address == DiskTransferBuffer && 1126:dsk.c **** (mode & 0xff00) == (LBA_READ & 0xff00)) 1127:dsk.c **** { 1128:dsk.c **** fmemcpy(buffer, DiskTransferBuffer, bytes_sector); 1129:dsk.c **** } 1130:dsk.c **** 1131:dsk.c **** *transferred += count; 1132:dsk.c **** LBA_address += count; 1133:dsk.c **** totaltodo -= count; 1134:dsk.c **** 1135:dsk.c **** buffer = adjust_far((char FAR *)buffer + count * bytes_sector); 1136:dsk.c **** } 1137:dsk.c **** 1138:dsk.c **** return (error_code); 1139:dsk.c **** } 564 .loc 1 1139 0 0 00000C8F 89EC mov sp, bp 0 00000C91 5D pop bp 0 00000C92 5F pop di 0 00000C93 5E pop si 0 00000C94 C21000 ret 16 570 _.LVL51: 571 _.L69: 572 _.LBB62: 573 _.LBB63: 191:dsk.c **** { 574 .loc 1 191 0 0 00000C97 83E030 and ax, 48 0 00000C9A 83F810 cmp ax, 16 0 00000C9D 7506 jne _.L71 0 00000C9F FF7608 push word ptr [bp+8] 0 00000CA2 E801FF call _play_dj.part.2 580 _.LVL52: 581 _.L71: 582 _.LBE63: 583 _.LBE62: 1007:dsk.c **** { 584 .loc 1 1007 0 0 00000CA5 8B5E08 mov bx, word ptr [bp+8] 0 00000CA8 F6473301 test byte ptr [bx+51], 1 0 00000CAC 7529 jne _.L73 588 _.LBB64: 1009:dsk.c **** unsigned char nsecs = (unsigned char)(pddt->ddt_bpb.bpb_nsecs); 589 .loc 1 1009 0 0 00000CAE B01E mov al, 30 0 00000CB0 50 push ax 0 00000CB1 E8[FEFF] call _getvec 593 _.LVL53: 1010:dsk.c **** 594 .loc 1 1010 0 0 00000CB4 8B5E08 mov bx, word ptr [bp+8] 0 00000CB7 8B4F13 mov cx, word ptr [bx+19] 0 00000CBA 894EFE mov word ptr [bp-2], cx 0 00000CBD 8A4EFE mov cl, byte ptr [bp-2] 599 _.LVL54: 1012:dsk.c **** { 600 .loc 1 1012 0 0 00000CC0 8EC2 mov es, dx 0 00000CC2 89C3 mov bx, ax 0 00000CC4 263A4F04 cmp cl, byte ptr es:[bx+4] 0 00000CC8 740D je _.L73 1014:dsk.c **** fl_reset(driveno); 605 .loc 1 1014 0 0 00000CCA 26884F04 mov byte ptr es:[bx+4], cl 607 _.LVL55: 1015:dsk.c **** } 608 .loc 1 1015 0 0 00000CCE 8A46F9 mov al, byte ptr [bp-7] 610 _.LVL56: 0 00000CD1 30E4 xor ah, ah 0 00000CD3 50 push ax 0 00000CD4 E8[FEFF] call _fl_reset 614 _.LVL57: 615 _.L73: 616 _.LBE64: 1027:dsk.c **** for (; totaltodo != 0;) 617 .loc 1 1027 0 0 00000CD7 56 push si 0 00000CD8 57 push di 620 _.LVL58: 621 _.L124: 1135:dsk.c **** } 622 .loc 1 1135 0 0 00000CD9 E8[FEFF] call _adjust_far 624 _.LVL59: 0 00000CDC 8946F6 mov word ptr [bp-10], ax 0 00000CDF 8956FC mov word ptr [bp-4], dx 627 _.LVL60: 1028:dsk.c **** { 628 .loc 1 1028 0 0 00000CE2 837E1400 cmp word ptr [bp+20], 0 0 00000CE6 74A5 je _.L97 631 _.LVL61: 0 00000CE8 8B4614 mov ax, word ptr [bp+20] 633 _.LVL62: 0 00000CEB 8946FE mov word ptr [bp-2], ax 1031:dsk.c **** { 635 .loc 1 1031 0 0 00000CEE 8B5E08 mov bx, word ptr [bp+8] 0 00000CF1 F6473410 test byte ptr [bx+52], 16 0 00000CF5 7525 jne _.L76 639 _.LVL63: 640 _.LBB65: 641 _.LBB66: 945:dsk.c **** unsigned sectors_to_dma_boundary = (dma_off == 0 ? 642 .loc 1 945 0 0 00000CF7 8B46FC mov ax, word ptr [bp-4] 0 00000CFA B104 mov cl, 4 0 00000CFC D3E0 shl ax, cl 646 _.LVL64: 947:dsk.c **** (UWORD)(-dma_off) / maxsecsize); 647 .loc 1 947 0 0 00000CFE 0346F6 add ax, word ptr [bp-10] 649 _.LVL65: 0 00000D01 7403E9D500 jne _.L77 0 00000D06 B8FFFF mov ax, -1 652 _.LVL66: 653 _.L122: 0 00000D09 31D2 xor dx, dx 0 00000D0B F736[0000] div word ptr [_maxsecsize] 656 _.LVL67: 950:dsk.c **** } 657 .loc 1 950 0 0 00000D0F 8B5614 mov dx, word ptr [bp+20] 0 00000D12 8956FE mov word ptr [bp-2], dx 0 00000D15 39C2 cmp dx, ax 0 00000D17 7603 jbe _.L76 0 00000D19 8946FE mov word ptr [bp-2], ax 663 _.LVL68: 664 _.L76: 665 _.LBE66: 666 _.LBE65: 1038:dsk.c **** { 667 .loc 1 1038 0 0 00000D1C 817EFC00A0 cmp word ptr [bp-4], -24577+1 0 00000D21 7312 jnc _.L104 1050:dsk.c **** } 670 .loc 1 1050 0 0 00000D23 8B46F6 mov ax, word ptr [bp-10] 0 00000D26 8946FA mov word ptr [bp-6], ax 0 00000D29 8B46FC mov ax, word ptr [bp-4] 0 00000D2C 8946F4 mov word ptr [bp-12], ax 1038:dsk.c **** { 675 .loc 1 1038 0 0 00000D2F 837EFE01 cmp word ptr [bp-2], 1 0 00000D33 7327 jnc _.L80 678 _.L104: 1040:dsk.c **** count = 1; 679 .loc 1 1040 0 0 00000D35 C746FA[0000] mov word ptr [bp-6], offset _DiskTransferBuffer 0 00000D3A 8C56F4 mov word ptr [bp-12], ss 682 _.LVL69: 1043:dsk.c **** { 683 .loc 1 1043 0 0 00000D3D 8B460A mov ax, word ptr [bp+10] 0 00000D40 30C0 xor al, al 0 00000D42 3D0043 cmp ax, 17152 0 00000D45 7510 jne _.L100 1045:dsk.c **** } 688 .loc 1 1045 0 0 00000D47 FF76EE push word ptr [bp-18] 0 00000D4A FF76FC push word ptr [bp-4] 0 00000D4D FF76F6 push word ptr [bp-10] 0 00000D50 16 push ss 0 00000D51 FF76FA push word ptr [bp-6] 0 00000D54 E8[FEFF] call _fmemcpy 695 _.LVL70: 696 _.L100: 1041:dsk.c **** 697 .loc 1 1041 0 0 00000D57 C746FE0100 mov word ptr [bp-2], 1 699 _.LVL71: 700 _.L80: 0 00000D5C C746E80500 mov word ptr [bp-24], 5 702 _.LVL72: 703 _.L94: 1055:dsk.c **** { 704 .loc 1 1055 0 0 00000D61 8B5E08 mov bx, word ptr [bp+8] 0 00000D64 8B4733 mov ax, word ptr [bx+51] 0 00000D67 F6C404 test ah, 4 0 00000D6A 7503E99100 je _.L82 0 00000D6F 837E0AFF cmp word ptr [bp+10], -1 0 00000D73 7203E98800 jnc _.L82 1057:dsk.c **** 711 .loc 1 1057 0 0 00000D78 BE[0000] mov si, offset _dap.2610 0 00000D7B 8A56FE mov dl, byte ptr [bp-2] 0 00000D7E 885402 mov byte ptr [si+2], dl 1059:dsk.c **** 715 .loc 1 1059 0 0 00000D81 8B56FA mov dx, word ptr [bp-6] 0 00000D84 895404 mov word ptr [si+4], dx 0 00000D87 8B56F4 mov dx, word ptr [bp-12] 0 00000D8A 895406 mov word ptr [si+6], dx 1061:dsk.c **** dap.block_address = LBA_address; /* clear high part */ 720 .loc 1 1061 0 0 00000D8D C706[0C00]0000 mov word ptr [_dap.2610+12], 0 0 00000D93 C706[0E00]0000 mov word ptr [_dap.2610+14], 0 1062:dsk.c **** 723 .loc 1 1062 0 0 00000D99 8B56F2 mov dx, word ptr [bp-14] 0 00000D9C 895408 mov word ptr [si+8], dx 0 00000D9F 8B56F0 mov dx, word ptr [bp-16] 0 00000DA2 89540A mov word ptr [si+10], dx 1066:dsk.c **** { 728 .loc 1 1066 0 0 00000DA5 F6C408 test ah, 8 0 00000DA8 89F0 mov ax, si 0 00000DAA 7509 jne _.L83 1066:dsk.c **** { 732 .loc 1 1066 0 is_stmt 0 discriminator 1 0 00000DAC 8B560A mov dx, word ptr [bp+10] 0 00000DAF 3B16[0000] cmp dx, word ptr [_LBA_WRITE_VERIFY] 0 00000DB3 742B je _.L84 736 _.L83: 1068:dsk.c **** } 737 .loc 1 1068 0 is_stmt 1 0 00000DB5 16 push ss 0 00000DB6 50 push ax 0 00000DB7 FF760A push word ptr [bp+10] 741 _.LVL73: 742 _.L125: 1079:dsk.c **** } 743 .loc 1 1079 0 0 00000DBA FF76F9 push word ptr [bp-7] 0 00000DBD E8[FEFF] call _fl_lba_ReadWrite 746 _.LVL74: 747 _.L123: 748 _.LBB68: 1108:dsk.c **** chs.Sector, count, transfer_address); 749 .loc 1 1108 0 0 00000DC0 89C7 mov di, ax 751 _.LVL75: 752 _.LBE68: 1112:dsk.c **** break; 753 .loc 1 1112 0 0 00000DC2 85C0 test ax, ax 0 00000DC4 7503E91401 je _.L93 756 _.L86: 1115:dsk.c **** 757 .loc 1 1115 0 discriminator 2 0 00000DC9 8A46F9 mov al, byte ptr [bp-7] 759 _.LVL76: 0 00000DCC 30E4 xor ah, ah 0 00000DCE 50 push ax 0 00000DCF E8[FEFF] call _fl_reset 763 _.LVL77: 1053:dsk.c **** { 764 .loc 1 1053 0 discriminator 2 0 00000DD2 FF4EE8 dec word ptr [bp-24] 766 _.LVL78: 0 00000DD5 758A jne _.L94 1121:dsk.c **** } 768 .loc 1 1121 0 0 00000DD7 97 xchg di, ax 0 00000DD8 E9B4FE jmp _.L68 771 _.LVL79: 772 _.L77: 773 _.LBB73: 774 _.LBB67: 948:dsk.c **** 775 .loc 1 948 0 0 00000DDB F7D8 neg ax 777 _.LVL80: 0 00000DDD E929FF jmp _.L122 779 _.LVL81: 780 _.L84: 781 _.LBE67: 782 _.LBE73: 1074:dsk.c **** 783 .loc 1 1074 0 0 00000DE0 16 push ss 0 00000DE1 56 push si 0 00000DE2 B80043 mov ax, 17152 0 00000DE5 50 push ax 0 00000DE6 FF76F9 push word ptr [bp-7] 0 00000DE9 8C56EC mov word ptr [bp-20], ss 0 00000DEC E8[FEFF] call _fl_lba_ReadWrite 791 _.LVL82: 0 00000DEF 89C7 mov di, ax 793 _.LVL83: 1076:dsk.c **** { 794 .loc 1 1076 0 0 00000DF1 85C0 test ax, ax 0 00000DF3 8B56EC mov dx, word ptr [bp-20] 0 00000DF6 75D1 jne _.L86 1079:dsk.c **** } 798 .loc 1 1079 0 0 00000DF8 52 push dx 0 00000DF9 56 push si 0 00000DFA B80044 mov ax, 17408 802 _.LVL84: 0 00000DFD 50 push ax 0 00000DFE EBBA jmp _.L125 805 _.LVL85: 806 _.L82: 807 _.LBB74: 808 _.LBB69: 809 _.LBB70: 917:dsk.c **** unsigned hs = pbpb->bpb_nsecs * pbpb->bpb_nheads; 810 .loc 1 917 0 0 00000E00 8B5E08 mov bx, word ptr [bp+8] 0 00000E03 A801 test al, 1 0 00000E05 7443 je _.L87 0 00000E07 83C337 add bx, 55 815 _.L88: 816 _.LVL86: 918:dsk.c **** unsigned hsrem = (unsigned)(LBA_address % hs); 817 .loc 1 918 0 0 00000E0A 8B7F0D mov di, word ptr [bx+13] 819 _.LVL87: 0 00000E0D 89F8 mov ax, di 0 00000E0F F7670F mul word ptr [bx+15] 0 00000E12 8946EC mov word ptr [bp-20], ax 919:dsk.c **** 823 .loc 1 919 0 0 00000E15 31F6 xor si, si 0 00000E17 56 push si 0 00000E18 50 push ax 0 00000E19 FF76F0 push word ptr [bp-16] 0 00000E1C FF76F2 push word ptr [bp-14] 0 00000E1F E8[FEFF] call ___umodsi3 830 _.LVL88: 0 00000E22 8946EA mov word ptr [bp-22], ax 832 _.LVL89: 921:dsk.c **** 833 .loc 1 921 0 0 00000E25 56 push si 0 00000E26 FF76EC push word ptr [bp-20] 0 00000E29 FF76F0 push word ptr [bp-16] 0 00000E2C FF76F2 push word ptr [bp-14] 0 00000E2F E8[FEFF] call ___udivsi3 839 _.LVL90: 0 00000E32 89C6 mov si, ax 841 _.LVL91: 923:dsk.c **** { 842 .loc 1 923 0 0 00000E34 85D2 test dx, dx 0 00000E36 7505 jne _.L105 0 00000E38 3DFF03 cmp ax, 1023 0 00000E3B 7612 jbe _.L120 847 _.L105: 928:dsk.c **** #endif 848 .loc 1 928 0 0 00000E3D B8[4300] mov ax, offset _.LC3 850 _.LVL92: 0 00000E40 50 push ax 0 00000E41 E8[FEFF] call _put_string 853 _.LVL93: 854 _.LBE70: 855 _.LBE69: 1087:dsk.c **** 856 .loc 1 1087 0 0 00000E44 B80100 mov ax, 1 0 00000E47 E945FE jmp _.L68 859 _.LVL94: 860 _.L87: 861 _.LBB72: 862 _.LBB71: 917:dsk.c **** unsigned hs = pbpb->bpb_nsecs * pbpb->bpb_nheads; 863 .loc 1 917 0 0 00000E4A 83C306 add bx, 6 865 _.LVL95: 0 00000E4D EBBB jmp _.L88 867 _.LVL96: 868 _.L120: 934:dsk.c **** chs->Sector = hsrem % pbpb->bpb_nsecs + 1; 869 .loc 1 934 0 0 00000E4F 8B46EA mov ax, word ptr [bp-22] 871 _.LVL97: 0 00000E52 31D2 xor dx, dx 0 00000E54 F7F7 div di 874 _.LVL98: 0 00000E56 8946EA mov word ptr [bp-22], ax 876 _.LVL99: 935:dsk.c **** *ppbpb = pbpb; 877 .loc 1 935 0 0 00000E59 42 inc dx 879 _.LVL100: 880 _.LBE71: 881 _.LBE72: 1091:dsk.c **** { 882 .loc 1 1091 0 0 00000E5A 8D4D01 lea cx, [1+di] 0 00000E5D 8B46FE mov ax, word ptr [bp-2] 885 _.LVL101: 0 00000E60 01D0 add ax, dx 0 00000E62 39C8 cmp ax, cx 0 00000E64 7605 jbe _.L91 889 _.LVL102: 1093:dsk.c **** } 890 .loc 1 1093 0 0 00000E66 29D1 sub cx, dx 892 _.LVL103: 0 00000E68 894EFE mov word ptr [bp-2], cx 894 _.LVL104: 895 _.L91: 1096:dsk.c **** mode == LBA_VERIFY ? fl_verify : 896 .loc 1 1096 0 0 00000E6B 817E0A0042 cmp word ptr [bp+10], 16896 0 00000E70 745C je _.L101 1097:dsk.c **** mode == 899 .loc 1 1097 0 0 00000E72 817E0A0044 cmp word ptr [bp+10], 17408 0 00000E77 745A je _.L102 1099:dsk.c **** chs.Head, 902 .loc 1 1099 0 0 00000E79 837E0AFF cmp word ptr [bp+10], -1 0 00000E7D 7559 jne _.L103 0 00000E7F B8[0000] mov ax, offset _fl_format 906 _.L92: 1096:dsk.c **** mode == LBA_VERIFY ? fl_verify : 907 .loc 1 1096 0 discriminator 3 0 00000E82 8A4EF9 mov cl, byte ptr [bp-7] 0 00000E85 884EEC mov byte ptr [bp-20], cl 0 00000E88 C646ED00 mov byte ptr [bp-19], 0 0 00000E8C FF76F4 push word ptr [bp-12] 0 00000E8F FF76FA push word ptr [bp-6] 0 00000E92 FF76FE push word ptr [bp-2] 0 00000E95 52 push dx 0 00000E96 8956E6 mov word ptr [bp-26], dx 0 00000E99 56 push si 0 00000E9A FF76EA push word ptr [bp-22] 0 00000E9D FF76EC push word ptr [bp-20] 0 00000EA0 FFD0 call ax 920 _.LVL105: 0 00000EA2 89C7 mov di, ax 922 _.LVL106: 1106:dsk.c **** { 923 .loc 1 1106 0 discriminator 3 0 00000EA4 85C0 test ax, ax 0 00000EA6 7403E91EFF jne _.L86 1106:dsk.c **** { 926 .loc 1 1106 0 is_stmt 0 discriminator 1 0 00000EAB 8B460A mov ax, word ptr [bp+10] 928 _.LVL107: 0 00000EAE 3B06[0000] cmp ax, word ptr [_LBA_WRITE_VERIFY] 0 00000EB2 8B56E6 mov dx, word ptr [bp-26] 0 00000EB5 7526 jne _.L93 1108:dsk.c **** chs.Sector, count, transfer_address); 932 .loc 1 1108 0 is_stmt 1 0 00000EB7 FF76F4 push word ptr [bp-12] 0 00000EBA FF76FA push word ptr [bp-6] 0 00000EBD FF76FE push word ptr [bp-2] 0 00000EC0 52 push dx 0 00000EC1 56 push si 0 00000EC2 FF76EA push word ptr [bp-22] 0 00000EC5 FF76EC push word ptr [bp-20] 0 00000EC8 E8[FEFF] call _fl_verify 941 _.LVL108: 0 00000ECB E9F2FE jmp _.L123 943 _.LVL109: 944 _.L101: 1096:dsk.c **** mode == LBA_VERIFY ? fl_verify : 945 .loc 1 1096 0 0 00000ECE B8[0000] mov ax, offset _fl_read 0 00000ED1 EBAF jmp _.L92 948 _.L102: 1097:dsk.c **** mode == 949 .loc 1 1097 0 0 00000ED3 B8[0000] mov ax, offset _fl_verify 0 00000ED6 EBAA jmp _.L92 952 _.L103: 1099:dsk.c **** chs.Head, 953 .loc 1 1099 0 0 00000ED8 B8[0000] mov ax, offset _fl_write 0 00000EDB EBA5 jmp _.L92 956 _.LVL110: 957 _.L93: 958 _.LBE74: 1125:dsk.c **** (mode & 0xff00) == (LBA_READ & 0xff00)) 959 .loc 1 1125 0 0 00000EDD 817EFA[0000] cmp word ptr [bp-6], offset _DiskTransferBuffer 0 00000EE2 7521 jne _.L95 0 00000EE4 8CD0 mov ax, ss 0 00000EE6 3946F4 cmp word ptr [bp-12], ax 0 00000EE9 751A jne _.L95 1126:dsk.c **** { 965 .loc 1 1126 0 discriminator 1 0 00000EEB 8B460A mov ax, word ptr [bp+10] 0 00000EEE 30C0 xor al, al 1125:dsk.c **** (mode & 0xff00) == (LBA_READ & 0xff00)) 968 .loc 1 1125 0 discriminator 1 0 00000EF0 3D0042 cmp ax, 16896 0 00000EF3 7510 jne _.L95 1128:dsk.c **** } 971 .loc 1 1128 0 0 00000EF5 FF76EE push word ptr [bp-18] 0 00000EF8 16 push ss 0 00000EF9 FF76FA push word ptr [bp-6] 0 00000EFC FF76FC push word ptr [bp-4] 0 00000EFF FF76F6 push word ptr [bp-10] 0 00000F02 E8[FEFF] call _fmemcpy 978 _.LVL111: 979 _.L95: 1131:dsk.c **** LBA_address += count; 980 .loc 1 1131 0 0 00000F05 8B5E16 mov bx, word ptr [bp+22] 0 00000F08 8B46FE mov ax, word ptr [bp-2] 0 00000F0B 0107 add word ptr [bx], ax 1132:dsk.c **** totaltodo -= count; 984 .loc 1 1132 0 0 00000F0D 0146F2 add word ptr [bp-14], ax 986 _.LVL112: 0 00000F10 8356F000 adc word ptr [bp-16], 0 988 _.LVL113: 1133:dsk.c **** 989 .loc 1 1133 0 0 00000F14 294614 sub word ptr [bp+20], ax 991 _.LVL114: 1135:dsk.c **** } 992 .loc 1 1135 0 0 00000F17 F766EE mul word ptr [bp-18] 0 00000F1A 0346F6 add ax, word ptr [bp-10] 0 00000F1D FF76FC push word ptr [bp-4] 0 00000F20 50 push ax 0 00000F21 E9B5FD jmp _.L124 998 _.LFE30: 999 .size _LBA_Transfer, .-_LBA_Transfer 1000 .type _blockio, @function 1001 _blockio: 1002 _.LFB24: 808:dsk.c **** ULONG start, size; 1003 .loc 1 808 0 1004 _.LVL115: 0 00000F24 56 push si 0 00000F25 57 push di 0 00000F26 55 push bp 1008 _.LCFI17: 0 00000F27 89E5 mov bp, sp 1010 _.LCFI18: 0 00000F29 83EC0A sub sp, 10 0 00000F2C 8B4608 mov ax, word ptr [bp+8] 0 00000F2F 8946FC mov word ptr [bp-4], ax 0 00000F32 8B460A mov ax, word ptr [bp+10] 0 00000F35 8946FA mov word ptr [bp-6], ax 0 00000F38 8B7E0C mov di, word ptr [bp+12] 816:dsk.c **** { 1017 .loc 1 816 0 0 00000F3B 8EC0 mov es, ax 0 00000F3D 8B5EFC mov bx, word ptr [bp-4] 0 00000F40 268A4702 mov al, byte ptr es:[bx+2] 0 00000F44 3C08 cmp al, 8 0 00000F46 7410 je _.L128 0 00000F48 3C09 cmp al, 9 0 00000F4A 7413 je _.L129 0 00000F4C 3C04 cmp al, 4 0 00000F4E 7403E9F200 jne _.L141 819:dsk.c **** break; 1027 .loc 1 819 0 0 00000F53 B80042 mov ax, 16896 0 00000F56 EB03 jmp _.L150 1030 _.L128: 822:dsk.c **** break; 1031 .loc 1 822 0 0 00000F58 B80043 mov ax, 17152 1033 _.L150: 819:dsk.c **** break; 1034 .loc 1 819 0 0 00000F5B 8EC0 mov es, ax 0 00000F5D EB04 jmp _.L130 1037 _.L129: 825:dsk.c **** break; 1038 .loc 1 825 0 0 00000F5F 8E06[0000] mov es, word ptr [_LBA_WRITE_VERIFY] 1040 _.LVL116: 1041 _.L130: 0 00000F63 8C46F8 mov word ptr [bp-8], es 1043 _.LVL117: 831:dsk.c **** return failure(E_FAILURE); 1044 .loc 1 831 0 0 00000F66 8B7533 mov si, word ptr [di+51] 0 00000F69 81E60002 and si, 512 0 00000F6D 7403E9D300 jne _.L141 1048 _.LVL118: 1049 _.LBB77: 1050 _.LBB78: 102:dsk.c **** } 1051 .loc 1 102 0 0 00000F72 E8[FEFF] call _ReadPCClock 1053 _.LVL119: 0 00000F75 894567 mov word ptr [di+103], ax 0 00000F78 895569 mov word ptr [di+105], dx 1056 _.LVL120: 1057 _.LBE78: 1058 _.LBE77: 835:dsk.c **** pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 1059 .loc 1 835 0 0 00000F7B 8E46FA mov es, word ptr [bp-6] 0 00000F7E 8B5EFC mov bx, word ptr [bp-4] 0 00000F81 268B4714 mov ax, word ptr es:[bx+20] 0 00000F85 83F8FF cmp ax, -1 0 00000F88 8E46F8 mov es, word ptr [bp-8] 0 00000F8B 742E je _.L131 835:dsk.c **** pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 1066 .loc 1 835 0 is_stmt 0 discriminator 1 0 00000F8D 8946F8 mov word ptr [bp-8], ax 1068 _.LVL121: 0 00000F90 89F1 mov cx, si 1070 _.L132: 1071 _.LVL122: 836:dsk.c **** size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge); 1072 .loc 1 836 0 is_stmt 1 discriminator 4 0 00000F92 36F6453301 test byte ptr ss:[di+51], 1 0 00000F97 7433 je _.L133 836:dsk.c **** size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge); 1075 .loc 1 836 0 is_stmt 0 discriminator 1 0 00000F99 8D5D37 lea bx, [55+di] 1077 _.L134: 1078 _.LVL123: 837:dsk.c **** 1079 .loc 1 837 0 is_stmt 1 discriminator 4 0 00000F9C 368B7708 mov si, word ptr ss:[bx+8] 0 00000FA0 85F6 test si, si 0 00000FA2 742D je _.L135 837:dsk.c **** 1083 .loc 1 837 0 is_stmt 0 discriminator 1 0 00000FA4 8976F6 mov word ptr [bp-10], si 0 00000FA7 31DB xor bx, bx 1086 _.LVL124: 1087 _.L148: 839:dsk.c **** { 1088 .loc 1 839 0 is_stmt 1 discriminator 4 0 00000FA9 39CB cmp bx, cx 0 00000FAB 7508 jne _.L143 0 00000FAD 8B46F6 mov ax, word ptr [bp-10] 0 00000FB0 3B46F8 cmp ax, word ptr [bp-8] 0 00000FB3 772B ja _.L145 1094 _.L143: 841:dsk.c **** } 1095 .loc 1 841 0 0 00000FB5 B80804 mov ax, 1032 0 00000FB8 E98000 jmp _.L126 1098 _.LVL125: 1099 _.L131: 835:dsk.c **** pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb; 1100 .loc 1 835 0 discriminator 2 0 00000FBB 8E5EFA mov ds, word ptr [bp-6] 0 00000FBE 8B5EFC mov bx, word ptr [bp-4] 0 00000FC1 8B471A mov ax, word ptr [bx+26] 0 00000FC4 8946F8 mov word ptr [bp-8], ax 1105 _.LVL126: 0 00000FC7 8B4F1C mov cx, word ptr [bx+28] 0 00000FCA EBC6 jmp _.L132 1108 _.LVL127: 1109 _.L133: 836:dsk.c **** size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge); 1110 .loc 1 836 0 discriminator 2 0 00000FCC 8D5D06 lea bx, [6+di] 0 00000FCF EBCB jmp _.L134 1113 _.LVL128: 1114 _.L135: 837:dsk.c **** 1115 .loc 1 837 0 discriminator 2 0 00000FD1 368B4715 mov ax, word ptr ss:[bx+21] 0 00000FD5 8946F6 mov word ptr [bp-10], ax 0 00000FD8 368B5F17 mov bx, word ptr ss:[bx+23] 1119 _.LVL129: 839:dsk.c **** { 1120 .loc 1 839 0 discriminator 2 0 00000FDC 39CB cmp bx, cx 0 00000FDE 76C9 jbe _.L148 1123 _.LVL130: 1124 _.L145: 839:dsk.c **** { 1125 .loc 1 839 0 is_stmt 0 discriminator 1 0 00000FE0 8E5EFA mov ds, word ptr [bp-6] 0 00000FE3 8B76FC mov si, word ptr [bp-4] 0 00000FE6 8E5C12 mov ds, word ptr [si+18] 0 00000FE9 8CD8 mov ax, ds 0 00000FEB 31D2 xor dx, dx 0 00000FED 0346F8 add ax, word ptr [bp-8] 0 00000FF0 11CA adc dx, cx 0 00000FF2 39DA cmp dx, bx 0 00000FF4 77BF ja _.L143 0 00000FF6 7505 jne _.L146 0 00000FF8 3B46F6 cmp ax, word ptr [bp-10] 0 00000FFB 77B8 ja _.L143 1138 _.L146: 1139 _.LVL131: 845:dsk.c **** rp->r_trans, 1140 .loc 1 845 0 is_stmt 1 0 00000FFD 8D46FE lea ax, [-2+bp] 0 00001000 50 push ax 1143 _.LVL132: 0 00001001 1E push ds 843:dsk.c **** 1145 .loc 1 843 0 0 00001002 368B858400 mov ax, word ptr ss:[di+132] 0 00001007 368B958600 mov dx, word ptr ss:[di+134] 0 0000100C 0346F8 add ax, word ptr [bp-8] 0 0000100F 11CA adc dx, cx 845:dsk.c **** rp->r_trans, 1150 .loc 1 845 0 0 00001011 52 push dx 0 00001012 50 push ax 0 00001013 8E5EFA mov ds, word ptr [bp-6] 0 00001016 8B5EFC mov bx, word ptr [bp-4] 0 00001019 FF7710 push word ptr [bx+16] 0 0000101C FF770E push word ptr [bx+14] 0 0000101F 06 push es 0 00001020 57 push di 0 00001021 16 push ss 0 00001022 1F pop ds 0 00001023 E82AFC call _LBA_Transfer 1162 _.LVL133: 848:dsk.c **** 1163 .loc 1 848 0 0 00001026 8B56FE mov dx, word ptr [bp-2] 0 00001029 8E46FA mov es, word ptr [bp-6] 0 0000102C 8B5EFC mov bx, word ptr [bp-4] 0 0000102F 26895712 mov word ptr es:[bx+18], dx 1168 _.LVL134: 850:dsk.c **** { 1169 .loc 1 850 0 0 00001033 85C0 test ax, ax 0 00001035 7413 je _.L144 852:dsk.c **** } 1172 .loc 1 852 0 0 00001037 50 push ax 0 00001038 E838FA call _dskerr 1175 _.LVL135: 1176 _.L126: 855:dsk.c **** 1177 .loc 1 855 0 0 0000103B 89EC mov sp, bp 0 0000103D 5D pop bp 0 0000103E 5F pop di 0 0000103F 5E pop si 0 00001040 16 push ss 0 00001041 1F pop ds 0 00001042 C20600 ret 6 1185 _.LVL136: 1186 _.L141: 832:dsk.c **** 1187 .loc 1 832 0 0 00001045 B80C81 mov ax, -32500 0 00001048 EBF1 jmp _.L126 1190 _.LVL137: 1191 _.L144: 854:dsk.c **** } 1192 .loc 1 854 0 0 0000104A B80001 mov ax, 256 1194 _.LVL138: 0 0000104D EBEC jmp _.L126 1196 _.LFE24: 1197 .size _blockio, .-_blockio 1198 .type _diskchange, @function 1199 _diskchange: 1200 _.LFB9: 232:dsk.c **** COUNT result; 1201 .loc 1 232 0 1202 _.LVL139: 0 0000104F 56 push si 0 00001050 55 push bp 1205 _.LCFI19: 0 00001051 89E5 mov bp, sp 1207 _.LCFI20: 0 00001053 8B7606 mov si, word ptr [bp+6] 236:dsk.c **** return M_NOT_CHANGED; 1209 .loc 1 236 0 0 00001056 8B4433 mov ax, word ptr [si+51] 0 00001059 A801 test al, 1 0 0000105B 740A je _.L152 1213 _.L161: 237:dsk.c **** 1214 .loc 1 237 0 0 0000105D B80100 mov ax, 1 1216 _.L151: 253:dsk.c **** 1217 .loc 1 253 0 0 00001060 89EC mov sp, bp 0 00001062 5D pop bp 0 00001063 5E pop si 0 00001064 C20200 ret 2 1222 _.L152: 1223 _.LVL140: 1224 _.LBB87: 1225 _.LBB88: 191:dsk.c **** { 1226 .loc 1 191 0 0 00001067 83E030 and ax, 48 0 0000106A 83F810 cmp ax, 16 0 0000106D 7426 je _.L154 1230 _.LVL141: 1231 _.L157: 1232 _.LBE88: 1233 _.LBE87: 242:dsk.c **** { 1234 .loc 1 242 0 0 0000106F F6443302 test byte ptr [si+51], 2 0 00001073 752E jne _.L155 1237 _.L156: 1238 _.LVL142: 1239 _.LBB90: 1240 _.LBB91: 1241 _.LBB92: 1242 _.LBB93: 107:dsk.c **** } 1243 .loc 1 107 0 0 00001075 E8[FEFF] call _ReadPCClock 1245 _.LVL143: 0 00001078 91 xchg cx, ax 0 00001079 89D3 mov bx, dx 1248 _.LVL144: 0 0000107B 8B5467 mov dx, word ptr [si+103] 0 0000107E 8B4469 mov ax, word ptr [si+105] 0 00001081 29D1 sub cx, dx 0 00001083 19C3 sbb bx, ax 1253 _.LBE93: 1254 _.LBE92: 252:dsk.c **** } 1255 .loc 1 252 0 0 00001085 B80100 mov ax, 1 0 00001088 85DB test bx, bx 0 0000108A 7505 jne _.L159 0 0000108C 83F924 cmp cx, 36 0 0000108F 76CF jbe _.L151 1261 _.L159: 0 00001091 31C0 xor ax, ax 1263 _.LVL145: 0 00001093 EBCB jmp _.L151 1265 _.LVL146: 1266 _.L154: 1267 _.LBE91: 1268 _.LBE90: 1269 _.LBB94: 1270 _.LBB89: 0 00001095 56 push si 0 00001096 E80DFB call _play_dj.part.2 1273 _.LVL147: 1274 _.LBE89: 1275 _.LBE94: 239:dsk.c **** return M_CHANGED; 1276 .loc 1 239 0 0 00001099 83F8FF cmp ax, -1 0 0000109C 75D1 jne _.L157 1279 _.L160: 240:dsk.c **** 1280 .loc 1 240 0 0 0000109E B8FFFF mov ax, -1 0 000010A1 EBBD jmp _.L151 1283 _.L155: 244:dsk.c **** /* check if it has changed... */ 1284 .loc 1 244 0 0 000010A3 8A4404 mov al, byte ptr [si+4] 0 000010A6 30E4 xor ah, ah 0 000010A8 50 push ax 0 000010A9 E8[FEFF] call _fl_diskchanged 1289 _.LVL148: 0 000010AC 83F801 cmp ax, 1 0 000010AF 74ED je _.L160 247:dsk.c **** return M_NOT_CHANGED; 1292 .loc 1 247 0 0 000010B1 85C0 test ax, ax 0 000010B3 75C0 jne _.L156 0 000010B5 EBA6 jmp _.L161 1296 _.LFE9: 1297 .size _diskchange, .-_diskchange === Switch to base=012BB0h -> ".RODATA.STR1.1" 1298 .section .rodata.str1.1 1299 _.LC4: 0 000018ED 4E4F204E414D4520 .string "NO NAME " 0 000018F5 20202000 1301 _.LC5: 0 000018F9 4641543F3F202020 .string "FAT?? " 0 00001901 00 === Switch to base=002270h -> ".TEXT" 1303 .text 1304 .type _getbpb, @function 1305 _getbpb: 1306 _.LFB18: 371:dsk.c **** ULONG count; 1307 .loc 1 371 0 1308 _.LVL149: 0 000010B7 56 push si 0 000010B8 57 push di 0 000010B9 55 push bp 1312 _.LCFI21: 0 000010BA 89E5 mov bp, sp 1314 _.LCFI22: 0 000010BC 1E push ds 0 000010BD 1E push ds 0 000010BE 8B7608 mov si, word ptr [bp+8] 1318 _.LVL150: 381:dsk.c **** pddt->ddt_descflags |= DF_DISKCHANGE; 1319 .loc 1 381 0 0 000010C1 56 push si 0 000010C2 E88AFF call _diskchange 1322 _.LVL151: 0 000010C5 83F801 cmp ax, 1 0 000010C8 7404 je _.L170 382:dsk.c **** 1325 .loc 1 382 0 0 000010CA 804C3340 or byte ptr [si+51], 64 1327 _.L170: 1328 _.LVL152: 1329 _.LBB102: 1330 _.LBB103: 292:dsk.c **** (UBYTE FAR *) DiskTransferBuffer, 1331 .loc 1 292 0 0 000010CE 8D46FE lea ax, [-2+bp] 0 000010D1 50 push ax 0 000010D2 B80100 mov ax, 1 0 000010D5 50 push ax 0 000010D6 FFB48600 push word ptr [si+134] 0 000010DA FFB48400 push word ptr [si+132] 293:dsk.c **** pddt->ddt_offset, 1, &done); 1338 .loc 1 293 0 0 000010DE BF[0000] mov di, offset _DiskTransferBuffer 292:dsk.c **** (UBYTE FAR *) DiskTransferBuffer, 1340 .loc 1 292 0 0 000010E1 16 push ss 0 000010E2 57 push di 0 000010E3 B80042 mov ax, 16896 0 000010E6 50 push ax 0 000010E7 56 push si 0 000010E8 E865FB call _LBA_Transfer 1347 _.LVL153: 0 000010EB 8946FC mov word ptr [bp-4], ax 1349 _.LVL154: 1350 _.LBE103: 1351 _.LBE102: 385:dsk.c **** return (dskerr(ret)); 1352 .loc 1 385 0 0 000010EE 85C0 test ax, ax 0 000010F0 740B je _.L171 386:dsk.c **** 1355 .loc 1 386 0 0 000010F2 894608 mov word ptr [bp+8], ax 484:dsk.c **** 1357 .loc 1 484 0 0 000010F5 89EC mov sp, bp 0 000010F7 5D pop bp 0 000010F8 5F pop di 0 000010F9 5E pop si 1362 _.LVL155: 386:dsk.c **** 1363 .loc 1 386 0 0 000010FA E976F9 jmp _dskerr 1365 _.LVL156: 1366 _.L171: 373:dsk.c **** unsigned secs_per_cyl; 1367 .loc 1 373 0 0 000010FD 8D4406 lea ax, [6+si] 388:dsk.c **** 1369 .loc 1 388 0 0 00001100 8B4D0B mov cx, word ptr [di+11] 0 00001103 894C06 mov word ptr [si+6], cx 390:dsk.c **** || DiskTransferBuffer[0x1ff] != 0xaa || pbpbarray->bpb_nbyte % 512) 1372 .loc 1 390 0 0 00001106 803E[FE01]55 cmp byte ptr [_DiskTransferBuffer+510], 85 0 0000110B BA2900 mov dx, 41 0 0000110E 750D jne _.L172 391:dsk.c **** { 1376 .loc 1 391 0 0 00001110 803E[FF01]AA cmp byte ptr [_DiskTransferBuffer+511], -86 0 00001115 7506 jne _.L172 391:dsk.c **** { 1379 .loc 1 391 0 is_stmt 0 discriminator 1 0 00001117 F7C1FF01 test cx, 511 0 0000111B 7414 je _.L173 1382 _.L172: 394:dsk.c **** return 0; 1383 .loc 1 394 0 is_stmt 1 0 0000111D 52 push dx 0 0000111E 83C637 add si, 55 1386 _.LVL157: 0 00001121 56 push si 0 00001122 50 push ax 0 00001123 E8[FEFF] call _memcpy 1390 _.LVL158: 1391 _.L169: 484:dsk.c **** 1392 .loc 1 484 0 0 00001126 8B46FC mov ax, word ptr [bp-4] 0 00001129 89EC mov sp, bp 0 0000112B 5D pop bp 0 0000112C 5F pop di 0 0000112D 5E pop si 0 0000112E C20200 ret 2 1399 _.LVL159: 1400 _.L173: 398:dsk.c **** 1401 .loc 1 398 0 0 00001131 806434FD and byte ptr [si+52], -3 402:dsk.c **** 1403 .loc 1 402 0 0 00001135 52 push dx 0 00001136 BA[0B00] mov dx, offset _DiskTransferBuffer+11 0 00001139 52 push dx 0 0000113A 50 push ax 0 0000113B E8[FEFF] call _memcpy 1409 _.LVL160: 1410 _.LBB104: 418:dsk.c **** { 1411 .loc 1 418 0 0 0000113E 837C1100 cmp word ptr [si+17], 0 0 00001142 753A jne _.L175 1414 _.LVL161: 423:dsk.c **** } 1415 .loc 1 423 0 0 00001144 8A4542 mov al, byte ptr [di+66] 1417 _.LVL162: 421:dsk.c **** /* Extended BPB signature, offset differs for FAT32 vs FAT12/16 */ 1418 .loc 1 421 0 0 00001147 BF[4300] mov di, offset _DiskTransferBuffer+67 1420 _.LVL163: 1421 _.L176: 431:dsk.c **** { 1422 .loc 1 431 0 0 0000114A 88C4 mov ah, al 0 0000114C 80C4D8 add ah, -40 0 0000114F 80FC01 cmp ah, 1 0 00001152 B90B00 mov cx, 11 0 00001155 772F ja _.L177 433:dsk.c **** } else { 1428 .loc 1 433 0 0 00001157 8B15 mov dx, word ptr [di] 0 00001159 8B5D02 mov bx, word ptr [di+2] 0 0000115C 895477 mov word ptr [si+119], dx 0 0000115F 895C79 mov word ptr [si+121], bx 438:dsk.c **** { 1433 .loc 1 438 0 0 00001162 3C29 cmp al, 41 0 00001164 742C je _.L178 1436 _.L179: 444:dsk.c **** fmemcpy(pddt->ddt_fstype, "FAT?? ", 8); 1437 .loc 1 444 0 0 00001166 51 push cx 0 00001167 16 push ss 0 00001168 B8[6900] mov ax, offset _.LC4 1441 _.LVL164: 0 0000116B 50 push ax 0 0000116C 8D446B lea ax, [107+si] 0 0000116F 16 push ss 0 00001170 50 push ax 0 00001171 E8[FEFF] call _fmemcpy 1447 _.LVL165: 445:dsk.c **** } 1448 .loc 1 445 0 0 00001174 B80800 mov ax, 8 0 00001177 50 push ax 0 00001178 16 push ss 0 00001179 B8[7500] mov ax, offset _.LC5 0 0000117C EB2A jmp _.L188 1454 _.LVL166: 1455 _.L175: 427:dsk.c **** 1456 .loc 1 427 0 0 0000117E 8A4526 mov al, byte ptr [di+38] 1458 _.LVL167: 415:dsk.c **** register BYTE extended_BPB_signature; 1459 .loc 1 415 0 0 00001181 BF[2700] mov di, offset _DiskTransferBuffer+39 1461 _.LVL168: 0 00001184 EBC4 jmp _.L176 1463 _.L177: 436:dsk.c **** } 1464 .loc 1 436 0 0 00001186 C744770000 mov word ptr [si+119], 0 0 0000118B C744790000 mov word ptr [si+121], 0 0 00001190 EBD4 jmp _.L179 1468 _.L178: 440:dsk.c **** fmemcpy(pddt->ddt_fstype, fs->fstype, sizeof fs->fstype); 1469 .loc 1 440 0 0 00001192 51 push cx 0 00001193 8D4504 lea ax, [4+di] 1472 _.LVL169: 0 00001196 16 push ss 0 00001197 50 push ax 0 00001198 8D446B lea ax, [107+si] 0 0000119B 16 push ss 0 0000119C 50 push ax 0 0000119D E8[FEFF] call _fmemcpy 1479 _.LVL170: 441:dsk.c **** } else { 1480 .loc 1 441 0 0 000011A0 B80800 mov ax, 8 0 000011A3 50 push ax 0 000011A4 8D450F lea ax, [15+di] 0 000011A7 16 push ss 1485 _.L188: 445:dsk.c **** } 1486 .loc 1 445 0 0 000011A8 50 push ax 0 000011A9 8D447B lea ax, [123+si] 0 000011AC 16 push ss 0 000011AD 50 push ax 0 000011AE E8[FEFF] call _fmemcpy 1492 _.LVL171: 1493 _.LBE104: 461:dsk.c **** pbpbarray->bpb_huge : pbpbarray->bpb_nsize; 1494 .loc 1 461 0 0 000011B1 8B440E mov ax, word ptr [si+14] 462:dsk.c **** secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; 1496 .loc 1 462 0 0 000011B4 85C0 test ax, ax 0 000011B6 7521 jne _.L181 462:dsk.c **** secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; 1499 .loc 1 462 0 is_stmt 0 discriminator 1 0 000011B8 8B4C1B mov cx, word ptr [si+27] 0 000011BB 8B5C1D mov bx, word ptr [si+29] 1502 _.L182: 1503 _.LVL172: 463:dsk.c **** 1504 .loc 1 463 0 is_stmt 1 0 000011BE 8B4415 mov ax, word ptr [si+21] 0 000011C1 F76413 mul word ptr [si+19] 1507 _.LVL173: 465:dsk.c **** { 1508 .loc 1 465 0 0 000011C4 85C0 test ax, ax 0 000011C6 7516 jne _.L183 1511 _.LVL174: 1512 _.LBB105: 1513 _.LBB106: 102:dsk.c **** } 1514 .loc 1 102 0 0 000011C8 E8[FEFF] call _ReadPCClock 1516 _.LVL175: 0 000011CB 894467 mov word ptr [si+103], ax 0 000011CE 895469 mov word ptr [si+105], dx 1519 _.LBE106: 1520 _.LBE105: 468:dsk.c **** } 1521 .loc 1 468 0 0 000011D1 C746FC0C81 mov word ptr [bp-4], -32500 0 000011D6 E94DFF jmp _.L169 1524 _.LVL176: 1525 _.L181: 462:dsk.c **** secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; 1526 .loc 1 462 0 discriminator 2 0 000011D9 91 xchg cx, ax 0 000011DA 31DB xor bx, bx 0 000011DC EBE0 jmp _.L182 1530 _.LVL177: 1531 _.L183: 472:dsk.c **** 1532 .loc 1 472 0 0 000011DE 89C7 mov di, ax 1534 _.LVL178: 0 000011E0 4F dec di 0 000011E1 31D2 xor dx, dx 0 000011E3 01F9 add cx, di 1538 _.LVL179: 0 000011E5 11D3 adc bx, dx 0 000011E7 52 push dx 0 000011E8 50 push ax 0 000011E9 53 push bx 0 000011EA 51 push cx 0 000011EB E8[FEFF] call ___udivsi3 1545 _.LVL180: 0 000011EE 894435 mov word ptr [si+53], ax 1547 _.LVL181: 1548 _.LBB107: 1549 _.LBB108: 102:dsk.c **** } 1550 .loc 1 102 0 0 000011F1 E8[FEFF] call _ReadPCClock 1552 _.LVL182: 0 000011F4 894467 mov word ptr [si+103], ax 0 000011F7 895469 mov word ptr [si+105], dx 0 000011FA E929FF jmp _.L169 1556 _.LBE108: 1557 _.LBE107: 1558 _.LFE18: 1559 .size _getbpb, .-_getbpb 1560 .type _bldbpb, @function 1561 _bldbpb: 1562 _.LFB19: 487:dsk.c **** WORD result; 1563 .loc 1 487 0 1564 _.LVL183: 0 000011FD 56 push si 0 000011FE 57 push di 0 000011FF 55 push bp 1568 _.LCFI23: 0 00001200 89E5 mov bp, sp 1570 _.LCFI24: 0 00001202 1E push ds 0 00001203 8B5E08 mov bx, word ptr [bp+8] 0 00001206 895EFE mov word ptr [bp-2], bx 0 00001209 8B760A mov si, word ptr [bp+10] 0 0000120C 8B7E0C mov di, word ptr [bp+12] 490:dsk.c **** return result; 1576 .loc 1 490 0 0 0000120F 57 push di 0 00001210 E8A4FE call _getbpb 1579 _.LVL184: 0 00001213 85C0 test ax, ax 0 00001215 7513 jne _.L189 493:dsk.c **** return S_DONE; 1582 .loc 1 493 0 0 00001217 8D4506 lea ax, [6+di] 1584 _.LVL185: 0 0000121A 8EC6 mov es, si 0 0000121C 8B5EFE mov bx, word ptr [bp-2] 0 0000121F 26894712 mov word ptr es:[bx+18], ax 1588 _.LVL186: 0 00001223 268C5714 mov word ptr es:[bx+20], ss 494:dsk.c **** } 1590 .loc 1 494 0 0 00001227 B80001 mov ax, 256 1592 _.L189: 495:dsk.c **** 1593 .loc 1 495 0 0 0000122A 89EC mov sp, bp 0 0000122C 5D pop bp 0 0000122D 5F pop di 0 0000122E 5E pop si 0 0000122F C20600 ret 6 1599 _.LFE19: 1600 .size _bldbpb, .-_bldbpb 1601 .type _mediachk, @function 1602 _mediachk: 1603 _.LFB10: 256:dsk.c **** /* check floppy status */ 1604 .loc 1 256 0 1605 _.LVL187: 0 00001232 56 push si 0 00001233 57 push di 0 00001234 55 push bp 1609 _.LCFI25: 0 00001235 89E5 mov bp, sp 1611 _.LCFI26: 0 00001237 83EC06 sub sp, 6 0 0000123A 8B7E08 mov di, word ptr [bp+8] 0 0000123D 8B460A mov ax, word ptr [bp+10] 0 00001240 8946FE mov word ptr [bp-2], ax 0 00001243 8B760C mov si, word ptr [bp+12] 258:dsk.c **** { 1617 .loc 1 258 0 0 00001246 8B4433 mov ax, word ptr [si+51] 0 00001249 89C2 mov dx, ax 0 0000124B 81E20001 and dx, 256 0 0000124F 7410 je _.L193 260:dsk.c **** rp->r_mcretcode = M_CHANGED; 1622 .loc 1 260 0 0 00001251 80E4FE and ah, -2 0 00001254 894433 mov word ptr [si+51], ax 1625 _.LVL188: 1626 _.L200: 1627 _.LBB113: 1628 _.LBB114: 1629 _.LBB115: 279:dsk.c **** } 1630 .loc 1 279 0 0 00001257 8E46FE mov es, word ptr [bp-2] 0 0000125A 26C6450EFF mov byte ptr es:[di+14], -1 0 0000125F EB11 jmp _.L202 1634 _.LVL189: 1635 _.L193: 1636 _.LBE115: 1637 _.LBE114: 1638 _.LBE113: 263:dsk.c **** { 1639 .loc 1 263 0 0 00001261 A840 test al, 64 0 00001263 7418 je _.L195 265:dsk.c **** rp->r_mcretcode = M_DONT_KNOW; 1642 .loc 1 265 0 0 00001265 83E0BF and ax, -65 0 00001268 894433 mov word ptr [si+51], ax 266:dsk.c **** } 1645 .loc 1 266 0 0 0000126B 8E46FE mov es, word ptr [bp-2] 0 0000126E 2688550E mov byte ptr es:[di+14], dl 1648 _.LVL190: 1649 _.L202: 1650 _.LBB119: 1651 _.LBB117: 282:dsk.c **** } 1652 .loc 1 282 0 0 00001272 B80001 mov ax, 256 1654 _.L192: 1655 _.LBE117: 1656 _.LBE119: 283:dsk.c **** 1657 .loc 1 283 0 0 00001275 89EC mov sp, bp 0 00001277 5D pop bp 0 00001278 5F pop di 0 00001279 5E pop si 0 0000127A C20600 ret 6 1663 _.LVL191: 1664 _.L195: 270:dsk.c **** if (rp->r_mcretcode == M_DONT_KNOW) 1665 .loc 1 270 0 0 0000127D 56 push si 0 0000127E E8CEFD call _diskchange 1668 _.LVL192: 0 00001281 8E46FE mov es, word ptr [bp-2] 0 00001284 2688450E mov byte ptr es:[di+14], al 1671 _.LVL193: 271:dsk.c **** { 1672 .loc 1 271 0 0 00001288 84C0 test al, al 0 0000128A 75E6 jne _.L202 1675 _.LVL194: 1676 _.LBB120: 1677 _.LBB118: 1678 _.LBB116: 274:dsk.c **** COUNT result = getbpb(pddt); 1679 .loc 1 274 0 0 0000128C C45477 les dx, dword ptr [si+119] 0 0000128F 8956FA mov word ptr [bp-6], dx 0 00001292 8C46FC mov word ptr [bp-4], es 1683 _.LVL195: 275:dsk.c **** if (result != 0) 1684 .loc 1 275 0 0 00001295 56 push si 0 00001296 E81EFE call _getbpb 1687 _.LVL196: 276:dsk.c **** return (result); 1688 .loc 1 276 0 0 00001299 85C0 test ax, ax 0 0000129B 75D8 jne _.L192 278:dsk.c **** rp->r_mcretcode = M_CHANGED; 1691 .loc 1 278 0 0 0000129D 8B56FA mov dx, word ptr [bp-6] 0 000012A0 395477 cmp word ptr [si+119], dx 0 000012A3 8B4EFC mov cx, word ptr [bp-4] 0 000012A6 75AF jne _.L200 0 000012A8 394C79 cmp word ptr [si+121], cx 0 000012AB 75AA jne _.L200 0 000012AD EBC3 jmp _.L202 1699 _.LBE116: 1700 _.LBE118: 1701 _.LBE120: 1702 _.LFE10: 1703 .size _mediachk, .-_mediachk 1704 .type _Genblkdev, @function 1705 _Genblkdev: 1706 _.LFB23: 547:dsk.c **** int ret; 1707 .loc 1 547 0 1708 _.LVL197: 0 000012AF 56 push si 0 000012B0 57 push di 0 000012B1 55 push bp 1712 _.LCFI27: 0 000012B2 89E5 mov bp, sp 1714 _.LCFI28: 0 000012B4 83EC12 sub sp, 18 0 000012B7 C44608 les ax, dword ptr [bp+8] 0 000012BA 8946F6 mov word ptr [bp-10], ax 0 000012BD 8C46F4 mov word ptr [bp-12], es 0 000012C0 8B7E0C mov di, word ptr [bp+12] 549:dsk.c **** #ifdef WITHFAT32 1720 .loc 1 549 0 0 000012C3 8B4533 mov ax, word ptr [di+51] 1722 _.LVL198: 553:dsk.c **** extended = 1; 1723 .loc 1 553 0 0 000012C6 8E46F4 mov es, word ptr [bp-12] 0 000012C9 8B5EF6 mov bx, word ptr [bp-10] 0 000012CC 268A570D mov dl, byte ptr es:[bx+13] 0 000012D0 80FA48 cmp dl, 72 0 000012D3 7436 je _.L257 557:dsk.c **** return failure(E_CMD); 1729 .loc 1 557 0 0 000012D5 80FA08 cmp dl, 8 0 000012D8 752B jne _.L259 551:dsk.c **** 1732 .loc 1 551 0 0 000012DA 31C9 xor cx, cx 1734 _.L204: 1735 _.LVL199: 560:dsk.c **** { 1736 .loc 1 560 0 0 000012DC 8E46F4 mov es, word ptr [bp-12] 0 000012DF 8B5EF6 mov bx, word ptr [bp-10] 0 000012E2 268A570E mov dl, byte ptr es:[bx+14] 0 000012E6 80FA47 cmp dl, 71 0 000012E9 7503E92D05 je _.L206 0 000012EE 7603E9F100 ja _.L207 0 000012F3 80FA41 cmp dl, 65 0 000012F6 7503E90E02 je _.L208 0 000012FB 7713 ja _.L209 0 000012FD 80FA40 cmp dl, 64 0 00001300 7503E9A901 je _.L210 1748 _.LVL200: 1749 _.L259: 802:dsk.c **** } 1750 .loc 1 802 0 0 00001305 B80381 mov ax, -32509 1752 _.LVL201: 0 00001308 E9A702 jmp _.L203 1754 _.LVL202: 1755 _.L257: 554:dsk.c **** else 1756 .loc 1 554 0 0 0000130B B90100 mov cx, 1 0 0000130E EBCC jmp _.L204 1759 _.LVL203: 1760 _.L209: 560:dsk.c **** { 1761 .loc 1 560 0 0 00001310 80FA42 cmp dl, 66 0 00001313 7503E96F02 je _.L211 0 00001318 80FA46 cmp dl, 70 0 0000131B 75E8 jne _.L259 1766 _.LBB146: 710:dsk.c **** struct FS_info *fs; 1767 .loc 1 710 0 0 0000131D 8E46F4 mov es, word ptr [bp-12] 0 00001320 8B5EF6 mov bx, word ptr [bp-10] 0 00001323 268B4713 mov ax, word ptr es:[bx+19] 1771 _.LVL204: 0 00001327 8946F0 mov word ptr [bp-16], ax 0 0000132A 268B4715 mov ax, word ptr es:[bx+21] 0 0000132E 8946F6 mov word ptr [bp-10], ax 1775 _.LVL205: 714:dsk.c **** if (ret != 0) 1776 .loc 1 714 0 0 00001331 57 push di 1778 _.LVL206: 0 00001332 E882FD call _getbpb 1780 _.LVL207: 715:dsk.c **** return (ret); 1781 .loc 1 715 0 0 00001335 85C0 test ax, ax 0 00001337 7403E97602 jne _.L203 719:dsk.c **** /* return error if media lacks extended BPB with serial # */ 1784 .loc 1 719 0 0 0000133C 8B5511 mov dx, word ptr [di+17] 0 0000133F 85D2 test dx, dx 0 00001341 7403E9C904 jne _.L267 0 00001346 BB4200 mov bx, 66 1789 _.L247: 719:dsk.c **** /* return error if media lacks extended BPB with serial # */ 1790 .loc 1 719 0 is_stmt 0 discriminator 4 0 00001349 B8[0000] mov ax, offset _DiskTransferBuffer 1792 _.LVL208: 0 0000134C 8EC0 mov es, ax 0 0000134E 96 xchg si, ax 0 0000134F 8A00 mov al, byte ptr [bx+si] 1796 _.LVL209: 721:dsk.c **** return failure(E_MEDIA); 1797 .loc 1 721 0 is_stmt 1 discriminator 4 0 00001351 88C4 mov ah, al 0 00001353 80C4D8 add ah, -40 0 00001356 80FC01 cmp ah, 1 0 00001359 8C46F4 mov word ptr [bp-12], es 0 0000135C 7603E9A405 ja _.L268 726:dsk.c **** fs->serialno = gioc->ioc_serialno; 1803 .loc 1 726 0 0 00001361 85D2 test dx, dx 0 00001363 7403E9AD04 jne _.L269 0 00001368 BB4300 mov bx, 67 1807 _.L248: 725:dsk.c **** [(pddt->ddt_bpb.bpb_nfsect != 0 ? 0x27 : 0x43)]; 1808 .loc 1 725 0 0 0000136B 81C3[0000] add bx, offset _DiskTransferBuffer 1810 _.LVL210: 727:dsk.c **** pddt->ddt_serialno = fs->serialno; 1811 .loc 1 727 0 0 0000136F 8E46F6 mov es, word ptr [bp-10] 0 00001372 8B76F0 mov si, word ptr [bp-16] 0 00001375 268B4C02 mov cx, word ptr es:[si+2] 0 00001379 268B5404 mov dx, word ptr es:[si+4] 0 0000137D 890F mov word ptr [bx], cx 0 0000137F 895702 mov word ptr [bx+2], dx 728:dsk.c **** 1818 .loc 1 728 0 0 00001382 894D77 mov word ptr [di+119], cx 0 00001385 895579 mov word ptr [di+121], dx 731:dsk.c **** { 1821 .loc 1 731 0 0 00001388 3C29 cmp al, 41 0 0000138A 752E jne _.L249 733:dsk.c **** fmemcpy(pddt->ddt_volume, fs->volume, 11); 1824 .loc 1 733 0 0 0000138C 83C304 add bx, 4 1826 _.LVL211: 0 0000138F B80B00 mov ax, 11 1828 _.LVL212: 0 00001392 50 push ax 0 00001393 8946EE mov word ptr [bp-18], ax 0 00001396 8D7406 lea si, [6+si] 0 00001399 06 push es 0 0000139A 56 push si 0 0000139B 16 push ss 0 0000139C 53 push bx 0 0000139D 895EF0 mov word ptr [bp-16], bx 1837 _.LVL213: 0 000013A0 8C56F6 mov word ptr [bp-10], ss 0 000013A3 E8[FEFF] call _fmemcpy 1840 _.LVL214: 734:dsk.c **** } 1841 .loc 1 734 0 0 000013A6 8B46EE mov ax, word ptr [bp-18] 0 000013A9 50 push ax 0 000013AA 8B56F6 mov dx, word ptr [bp-10] 0 000013AD 52 push dx 0 000013AE 8B5EF0 mov bx, word ptr [bp-16] 0 000013B1 53 push bx 0 000013B2 8D456B lea ax, [107+di] 0 000013B5 16 push ss 0 000013B6 50 push ax 0 000013B7 E8[FEFF] call _fmemcpy 1852 _.LVL215: 1853 _.L249: 1854 _.LBB147: 1855 _.LBB148: 292:dsk.c **** (UBYTE FAR *) DiskTransferBuffer, 1856 .loc 1 292 0 0 000013BA 8D46FC lea ax, [-4+bp] 0 000013BD 50 push ax 0 000013BE B80100 mov ax, 1 0 000013C1 50 push ax 0 000013C2 36FFB58600 push word ptr ss:[di+134] 0 000013C7 36FFB58400 push word ptr ss:[di+132] 0 000013CC 16 push ss 0 000013CD FF76F4 push word ptr [bp-12] 0 000013D0 B80043 mov ax, 17152 0 000013D3 50 push ax 1867 _.LVL216: 1868 _.L306: 1869 _.LBE148: 1870 _.LBE147: 1871 _.LBE146: 1872 _.LBB149: 1873 _.LBB150: 1874 _.LBB151: 540:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 1875 .loc 1 540 0 0 000013D4 57 push di 0 000013D5 16 push ss 0 000013D6 1F pop ds 0 000013D7 E876F8 call _LBA_Transfer 1880 _.LVL217: 1881 _.LBE151: 1882 _.LBE150: 777:dsk.c **** return dskerr(ret); 1883 .loc 1 777 0 0 000013DA 85C0 test ax, ax 0 000013DC 7503E9CE01 je _.L298 0 000013E1 E90002 jmp _.L299 1887 _.LVL218: 1888 _.L207: 1889 _.LBE149: 560:dsk.c **** { 1890 .loc 1 560 0 0 000013E4 80FA62 cmp dl, 98 0 000013E7 7503E9D702 je _.L213 0 000013EC 7603E98A00 ja _.L214 0 000013F1 80FA60 cmp dl, 96 0 000013F4 7503E94D04 je _.L215 0 000013F9 80FA61 cmp dl, 97 0 000013FC 7403E904FF jne _.L259 1898 _.LBB156: 774:dsk.c **** ret = GenblockioAbs(pddt, LBA_READ, rw->gbrw_head, rw->gbrw_cyl, 1899 .loc 1 774 0 0 00001401 8E46F4 mov es, word ptr [bp-12] 0 00001404 8B5EF6 mov bx, word ptr [bp-10] 0 00001407 268E4713 mov es, word ptr es:[bx+19] 0 0000140B 8E5EF4 mov ds, word ptr [bp-12] 0 0000140E 8E5F15 mov ds, word ptr [bx+21] 1905 _.LVL219: 1906 _.LBB154: 1907 _.LBB152: 540:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 1908 .loc 1 540 0 0 00001411 8D46FC lea ax, [-4+bp] 1910 _.LVL220: 0 00001414 50 push ax 1912 _.LVL221: 0 00001415 8CC3 mov bx, es 0 00001417 FF7707 push word ptr [bx+7] 541:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 1915 .loc 1 541 0 0 0000141A 8B4703 mov ax, word ptr [bx+3] 0 0000141D 89C3 mov bx, ax 0 0000141F 99 cwd 0 00001420 368B4515 mov ax, word ptr ss:[di+21] 0 00001424 8946F6 mov word ptr [bp-10], ax 0 00001427 897EF4 mov word ptr [bp-12], di 0 0000142A 92 xchg dx, ax 0 0000142B F766F6 mul word ptr [bp-10] 0 0000142E 91 xchg cx, ax 1925 _.LVL222: 0 0000142F 8B46F6 mov ax, word ptr [bp-10] 0 00001432 F7E3 mul bx 0 00001434 93 xchg bx, ax 0 00001435 89D6 mov si, dx 0 00001437 01CE add si, cx 0 00001439 8CC7 mov di, es 1932 _.LVL223: 0 0000143B 8B4501 mov ax, word ptr [di+1] 0 0000143E 99 cwd 0 0000143F 89D1 mov cx, dx 0 00001441 01D8 add ax, bx 0 00001443 8946F6 mov word ptr [bp-10], ax 0 00001446 11F1 adc cx, si 542:dsk.c **** sector, count, &transferred); 1939 .loc 1 542 0 0 00001448 8B7EF4 mov di, word ptr [bp-12] 0 0000144B 368B7513 mov si, word ptr ss:[di+19] 541:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 1942 .loc 1 541 0 0 0000144F 91 xchg cx, ax 0 00001450 F7E6 mul si 0 00001452 91 xchg cx, ax 0 00001453 8B5EF6 mov bx, word ptr [bp-10] 0 00001456 96 xchg si, ax 0 00001457 F7E3 mul bx 0 00001459 93 xchg bx, ax 0 0000145A 89D6 mov si, dx 0 0000145C 01CE add si, cx 540:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 1952 .loc 1 540 0 0 0000145E 8CC7 mov di, es 0 00001460 8B4505 mov ax, word ptr [di+5] 0 00001463 89C1 mov cx, ax 0 00001465 99 cwd 0 00001466 92 xchg dx, ax 0 00001467 01D9 add cx, bx 0 00001469 11F0 adc ax, si 0 0000146B 50 push ax 0 0000146C 51 push cx 0 0000146D 8CC3 mov bx, es 0 0000146F FF770B push word ptr [bx+11] 0 00001472 FF7709 push word ptr [bx+9] 0 00001475 B80042 mov ax, 16896 0 00001478 E90501 jmp _.L307 1967 _.LVL224: 1968 _.L214: 1969 _.LBE152: 1970 _.LBE154: 1971 _.LBE156: 560:dsk.c **** { 1972 .loc 1 560 0 0 0000147B 80FA66 cmp dl, 102 0 0000147E 7503E92D04 je _.L217 0 00001483 80FA67 cmp dl, 103 0 00001486 7403E97AFE jne _.L259 1977 _.LBB157: 797:dsk.c **** ai->AI_Flag = descflags & DF_NOACCESS ? 0 : 1; /* bit 9 */ 1978 .loc 1 797 0 0 0000148B 8E46F4 mov es, word ptr [bp-12] 0 0000148E 8B5EF6 mov bx, word ptr [bp-10] 0 00001491 268B5F13 mov bx, word ptr es:[bx+19] 0 00001495 8B7EF6 mov di, word ptr [bp-10] 0 00001498 268B5515 mov dx, word ptr es:[di+21] 1984 _.LVL225: 798:dsk.c **** } 1985 .loc 1 798 0 0 0000149C B109 mov cl, 9 1987 _.LVL226: 0 0000149E D3E8 shr ax, cl 1989 _.LVL227: 0 000014A0 83F001 xor ax, 1 0 000014A3 2401 and al, 1 0 000014A5 8EC2 mov es, dx 0 000014A7 26884701 mov byte ptr es:[bx+1], al 1994 _.LVL228: 0 000014AB E90101 jmp _.L298 1996 _.LVL229: 1997 _.L210: 1998 _.LBE157: 1999 _.LBB158: 564:dsk.c **** bpb *pbpb; 2000 .loc 1 564 0 0 000014AE 8E46F4 mov es, word ptr [bp-12] 0 000014B1 8B5EF6 mov bx, word ptr [bp-10] 0 000014B4 268B5F13 mov bx, word ptr es:[bx+19] 0 000014B8 8B76F6 mov si, word ptr [bp-10] 0 000014BB 268B7415 mov si, word ptr es:[si+21] 2006 _.LVL230: 567:dsk.c **** pddt->ddt_descflags = (descflags & ~3) | (gblp->gbio_devattrib & 3) 2007 .loc 1 567 0 0 000014BF 8EC6 mov es, si 0 000014C1 268A5701 mov dl, byte ptr es:[bx+1] 0 000014C5 885532 mov byte ptr [di+50], dl 568:dsk.c **** | (DF_DPCHANGED | DF_REFORMAT); 2011 .loc 1 568 0 0 000014C8 268B5702 mov dx, word ptr es:[bx+2] 0 000014CC 8956F6 mov word ptr [bp-10], dx 0 000014CF 83E203 and dx, 3 0 000014D2 83E0FC and ax, -4 2016 _.LVL231: 0 000014D5 09D0 or ax, dx 569:dsk.c **** pddt->ddt_ncyl = gblp->gbio_ncyl; 2018 .loc 1 569 0 0 000014D7 0D8001 or ax, 384 0 000014DA 894533 mov word ptr [di+51], ax 2021 _.LVL232: 570:dsk.c **** /* use default dpb or current bpb? */ 2022 .loc 1 570 0 0 000014DD 268B4704 mov ax, word ptr es:[bx+4] 0 000014E1 894535 mov word ptr [di+53], ax 574:dsk.c **** #ifdef WITHFAT32 2025 .loc 1 574 0 0 000014E4 26F60701 test byte ptr es:[bx], 1 0 000014E8 7515 jne _.L219 574:dsk.c **** #ifdef WITHFAT32 2028 .loc 1 574 0 is_stmt 0 discriminator 1 0 000014EA 8D4537 lea ax, [55+di] 2030 _.L220: 2031 _.LVL233: 576:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 2032 .loc 1 576 0 is_stmt 1 0 000014ED 85C9 test cx, cx 0 000014EF 7513 jne _.L260 0 000014F1 BA1F00 mov dx, 31 2036 _.L221: 576:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 2037 .loc 1 576 0 is_stmt 0 discriminator 4 0 000014F4 52 push dx 0 000014F5 83C307 add bx, 7 2040 _.LVL234: 0 000014F8 56 push si 0 000014F9 53 push bx 0 000014FA 16 push ss 2044 _.LVL235: 2045 _.L301: 2046 _.LBE158: 2047 _.LBB159: 792:dsk.c **** } 2048 .loc 1 792 0 is_stmt 1 0 000014FB 50 push ax 0 000014FC E9A103 jmp _.L300 2051 _.LVL236: 2052 _.L219: 2053 _.LBE159: 2054 _.LBB160: 574:dsk.c **** #ifdef WITHFAT32 2055 .loc 1 574 0 discriminator 2 0 000014FF 8D4506 lea ax, [6+di] 0 00001502 EBE9 jmp _.L220 2058 _.LVL237: 2059 _.L260: 576:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 2060 .loc 1 576 0 0 00001504 BA2900 mov dx, 41 0 00001507 EBEB jmp _.L221 2063 _.LVL238: 2064 _.L208: 2065 _.LBE160: 2066 _.LBB161: 586:dsk.c **** ret = GenblockioAbs(pddt, LBA_WRITE, rw->gbrw_head, rw->gbrw_cyl, 2067 .loc 1 586 0 0 00001509 8E46F4 mov es, word ptr [bp-12] 0 0000150C 8B5EF6 mov bx, word ptr [bp-10] 0 0000150F 268E4713 mov es, word ptr es:[bx+19] 0 00001513 8E5EF4 mov ds, word ptr [bp-12] 0 00001516 8E5F15 mov ds, word ptr [bx+21] 2073 _.LVL239: 2074 _.LBB162: 2075 _.LBB163: 540:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 2076 .loc 1 540 0 0 00001519 8D46FC lea ax, [-4+bp] 2078 _.LVL240: 0 0000151C 50 push ax 2080 _.LVL241: 0 0000151D 8CC3 mov bx, es 0 0000151F FF7707 push word ptr [bx+7] 541:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 2083 .loc 1 541 0 0 00001522 8B4703 mov ax, word ptr [bx+3] 0 00001525 89C3 mov bx, ax 0 00001527 99 cwd 0 00001528 368B4515 mov ax, word ptr ss:[di+21] 0 0000152C 8946F6 mov word ptr [bp-10], ax 0 0000152F 897EF4 mov word ptr [bp-12], di 0 00001532 92 xchg dx, ax 0 00001533 F766F6 mul word ptr [bp-10] 0 00001536 91 xchg cx, ax 2093 _.LVL242: 0 00001537 8B46F6 mov ax, word ptr [bp-10] 0 0000153A F7E3 mul bx 0 0000153C 93 xchg bx, ax 0 0000153D 89D6 mov si, dx 0 0000153F 01CE add si, cx 0 00001541 8CC7 mov di, es 2100 _.LVL243: 0 00001543 8B4501 mov ax, word ptr [di+1] 0 00001546 99 cwd 0 00001547 89D1 mov cx, dx 0 00001549 01D8 add ax, bx 0 0000154B 8946F6 mov word ptr [bp-10], ax 0 0000154E 11F1 adc cx, si 542:dsk.c **** sector, count, &transferred); 2107 .loc 1 542 0 0 00001550 8B7EF4 mov di, word ptr [bp-12] 0 00001553 368B7513 mov si, word ptr ss:[di+19] 541:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 2110 .loc 1 541 0 0 00001557 91 xchg cx, ax 0 00001558 F7E6 mul si 0 0000155A 91 xchg cx, ax 0 0000155B 8B5EF6 mov bx, word ptr [bp-10] 0 0000155E 96 xchg si, ax 0 0000155F F7E3 mul bx 0 00001561 93 xchg bx, ax 0 00001562 89D6 mov si, dx 0 00001564 01CE add si, cx 540:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 2120 .loc 1 540 0 0 00001566 8CC7 mov di, es 0 00001568 8B4505 mov ax, word ptr [di+5] 0 0000156B 89C1 mov cx, ax 0 0000156D 99 cwd 0 0000156E 92 xchg dx, ax 0 0000156F 01D9 add cx, bx 0 00001571 11F0 adc ax, si 0 00001573 50 push ax 0 00001574 51 push cx 0 00001575 8CC3 mov bx, es 0 00001577 FF770B push word ptr [bx+11] 0 0000157A FF7709 push word ptr [bx+9] 0 0000157D B80043 mov ax, 17152 2134 _.LVL244: 2135 _.L307: 2136 _.LBE163: 2137 _.LBE162: 2138 _.LBE161: 2139 _.LBB164: 2140 _.LBB155: 2141 _.LBB153: 0 00001580 50 push ax 0 00001581 8B7EF4 mov di, word ptr [bp-12] 0 00001584 E94DFE jmp _.L306 2145 _.LVL245: 2146 _.L211: 2147 _.LBE153: 2148 _.LBE155: 2149 _.LBE164: 2150 _.LBB165: 595:dsk.c **** COUNT tracks; 2151 .loc 1 595 0 0 00001587 8E46F4 mov es, word ptr [bp-12] 0 0000158A 8B5EF6 mov bx, word ptr [bp-10] 0 0000158D 268B5F13 mov bx, word ptr es:[bx+19] 0 00001591 8B76F6 mov si, word ptr [bp-10] 0 00001594 268B5415 mov dx, word ptr es:[si+21] 0 00001598 8956F0 mov word ptr [bp-16], dx 2158 _.LVL246: 601:dsk.c **** if (hd(descflags)) 2159 .loc 1 601 0 0 0000159B 89C2 mov dx, ax 2161 _.LVL247: 0 0000159D 81E27FFF and dx, -129 0 000015A1 895533 mov word ptr [di+51], dx 602:dsk.c **** { 2164 .loc 1 602 0 0 000015A4 A801 test al, 1 0 000015A6 7412 je _.L223 605:dsk.c **** return S_DONE; 2167 .loc 1 605 0 0 000015A8 8E46F0 mov es, word ptr [bp-16] 0 000015AB 26C60701 mov byte ptr es:[bx], 1 2170 _.LVL248: 2171 _.L298: 606:dsk.c **** } 2172 .loc 1 606 0 0 000015AF B80001 mov ax, 256 2174 _.L203: 2175 _.LBE165: 805:dsk.c **** 2176 .loc 1 805 0 0 000015B2 89EC mov sp, bp 0 000015B4 5D pop bp 0 000015B5 5F pop di 0 000015B6 5E pop si 0 000015B7 C20600 ret 6 2182 _.LVL249: 2183 _.L223: 2184 _.LBB171: 608:dsk.c **** { 2185 .loc 1 608 0 0 000015BA A880 test al, -128 0 000015BC 7503E9CB00 je _.L226 0 000015C1 895EEE mov word ptr [bp-18], bx 611:dsk.c **** pddt->ddt_bpb.bpb_nsecs); 2189 .loc 1 611 0 0 000015C4 36FF7513 push word ptr ss:[di+19] 0 000015C8 36FF7535 push word ptr ss:[di+53] 0 000015CC 8A4504 mov al, byte ptr [di+4] 2193 _.LVL250: 0 000015CF 30E4 xor ah, ah 0 000015D1 50 push ax 0 000015D2 E8[FEFF] call _fl_setmediatype 2197 _.LVL251: 613:dsk.c **** { 2198 .loc 1 613 0 0 000015D5 83F80C cmp ax, 12 0 000015D8 8B5EEE mov bx, word ptr [bp-18] 0 000015DB 750D jne _.L227 616:dsk.c **** return dskerr(ret); 2202 .loc 1 616 0 0 000015DD 8E46F0 mov es, word ptr [bp-16] 0 000015E0 26C60702 mov byte ptr es:[bx], 2 2205 _.LVL252: 2206 _.L299: 617:dsk.c **** } 2207 .loc 1 617 0 0 000015E4 50 push ax 0 000015E5 E88BF4 call _dskerr 2210 _.LVL253: 0 000015E8 EBC8 jmp _.L203 2212 _.LVL254: 2213 _.L227: 619:dsk.c **** { 2214 .loc 1 619 0 0 000015EA 3D8000 cmp ax, 128 0 000015ED 7509 jne _.L228 2217 _.LVL255: 2218 _.L302: 2219 _.LBB166: 634:dsk.c **** return dskerr(ret); 2220 .loc 1 634 0 0 000015EF 8E46F0 mov es, word ptr [bp-16] 0 000015F2 26C60703 mov byte ptr es:[bx], 3 2223 _.LVL256: 0 000015F6 EBEC jmp _.L299 2225 _.LVL257: 2226 _.L228: 2227 _.LBE166: 624:dsk.c **** /* otherwise, setdisktype */ 2228 .loc 1 624 0 0 000015F8 85C0 test ax, ax 0 000015FA 7503E98D00 je _.L226 2231 _.LBB167: 629:dsk.c **** (ret = 2232 .loc 1 629 0 0 000015FF 8E46F0 mov es, word ptr [bp-16] 0 00001602 26F60701 test byte ptr es:[bx], 1 0 00001606 7421 je _.L230 0 00001608 895EEE mov word ptr [bp-18], bx 2237 _.LVL258: 629:dsk.c **** (ret = 2238 .loc 1 629 0 is_stmt 0 discriminator 1 0 0000160B 16 push ss 0 0000160C B8[0000] mov ax, offset _DiskTransferBuffer 2241 _.LVL259: 0 0000160F 50 push ax 0 00001610 B80100 mov ax, 1 0 00001613 50 push ax 0 00001614 50 push ax 0 00001615 31C0 xor ax, ax 0 00001617 50 push ax 0 00001618 50 push ax 631:dsk.c **** DiskTransferBuffer)) != 0) 2249 .loc 1 631 0 is_stmt 1 discriminator 1 0 00001619 8A4504 mov al, byte ptr [di+4] 0 0000161C 30E4 xor ah, ah 629:dsk.c **** (ret = 2252 .loc 1 629 0 discriminator 1 0 0000161E 50 push ax 0 0000161F E8[FEFF] call _fl_read 2255 _.LVL260: 0 00001622 85C0 test ax, ax 0 00001624 8B5EEE mov bx, word ptr [bp-18] 0 00001627 75C6 jne _.L302 2259 _.L230: 639:dsk.c **** secs = pddt->ddt_bpb.bpb_nsecs; 2260 .loc 1 639 0 0 00001629 8B5535 mov dx, word ptr [di+53] 2262 _.LVL261: 640:dsk.c **** type = pddt->ddt_type + 1; 2263 .loc 1 640 0 0 0000162C 8B7513 mov si, word ptr [di+19] 2265 _.LVL262: 641:dsk.c **** if (!(tracks == 40 && (secs == 9 || secs == 8) && type < 3)) 2266 .loc 1 641 0 0 0000162F 8A6532 mov ah, byte ptr [di+50] 2268 _.LVL263: 642:dsk.c **** { 2269 .loc 1 642 0 0 00001632 83FA28 cmp dx, 40 0 00001635 7510 jne _.L231 641:dsk.c **** if (!(tracks == 40 && (secs == 9 || secs == 8) && type < 3)) 2272 .loc 1 641 0 discriminator 1 0 00001637 88E0 mov al, ah 2274 _.LVL264: 0 00001639 FEC0 inc al 2276 _.LVL265: 642:dsk.c **** { 2277 .loc 1 642 0 discriminator 1 0 0000163B 8D4CF8 lea cx, [-8+si] 0 0000163E 83F902 cmp cx, 1+1 0 00001641 7304 jnc _.L231 0 00001643 3C03 cmp al, 2+1 0 00001645 7233 jc _.L232 2283 _.LVL266: 2284 _.L231: 646:dsk.c **** if (type == 9) /* 1.44M drive */ 2285 .loc 1 646 0 0 00001647 80C402 add ah, 2 2287 _.LVL267: 647:dsk.c **** type = 4; 2288 .loc 1 647 0 0 0000164A 80FC09 cmp ah, 9 0 0000164D 7503E9B902 je _.L234 649:dsk.c **** (secs == 9 && type == 4)))) 2291 .loc 1 649 0 0 00001652 83FA50 cmp dx, 80 0 00001655 7516 jne _.L235 649:dsk.c **** (secs == 9 && type == 4)))) 2294 .loc 1 649 0 is_stmt 0 discriminator 1 0 00001657 83FE0F cmp si, 15 0 0000165A 7506 jne _.L256 0 0000165C B003 mov al, 3 0 0000165E 38C4 cmp ah, al 0 00001660 7418 je _.L232 2300 _.LVL268: 2301 _.L256: 649:dsk.c **** (secs == 9 && type == 4)))) 2302 .loc 1 649 0 discriminator 2 0 00001662 83FE09 cmp si, 9 0 00001665 7506 jne _.L235 0 00001667 B004 mov al, 4 0 00001669 38C4 cmp ah, al 0 0000166B 740D je _.L232 2308 _.L235: 653:dsk.c **** return dskerr(0xc); 2309 .loc 1 653 0 is_stmt 1 0 0000166D 8E46F0 mov es, word ptr [bp-16] 0 00001670 26C60702 mov byte ptr es:[bx], 2 2312 _.LVL269: 654:dsk.c **** } 2313 .loc 1 654 0 0 00001674 B80881 mov ax, -32504 0 00001677 E938FF jmp _.L203 2316 _.LVL270: 2317 _.L232: 0 0000167A 895EEE mov word ptr [bp-18], bx 2319 _.LVL271: 657:dsk.c **** } 2320 .loc 1 657 0 0 0000167D 30E4 xor ah, ah 2322 _.LVL272: 0 0000167F 50 push ax 0 00001680 8A4504 mov al, byte ptr [di+4] 0 00001683 30E4 xor ah, ah 0 00001685 50 push ax 0 00001686 E8[FEFF] call _fl_setdisktype 2328 _.LVL273: 0 00001689 8B5EEE mov bx, word ptr [bp-18] 2330 _.LVL274: 2331 _.L226: 2332 _.LBE167: 660:dsk.c **** return S_DONE; 2333 .loc 1 660 0 0 0000168C 8E46F0 mov es, word ptr [bp-16] 0 0000168F 26F60701 test byte ptr es:[bx], 1 0 00001693 7403E917FF jne _.L298 663:dsk.c **** afentry.track = fv->gbfv_cyl; 2337 .loc 1 663 0 0 00001698 C646FF02 mov byte ptr [bp-1], 2 664:dsk.c **** afentry.head = fv->gbfv_head; 2339 .loc 1 664 0 0 0000169C 268B4703 mov ax, word ptr es:[bx+3] 0 000016A0 8846FC mov byte ptr [bp-4], al 665:dsk.c **** 2342 .loc 1 665 0 0 000016A3 268B4701 mov ax, word ptr es:[bx+1] 0 000016A7 8846FD mov byte ptr [bp-3], al 667:dsk.c **** tracks > 0; tracks--) 2345 .loc 1 667 0 0 000016AA 26F60702 test byte ptr es:[bx], 2 0 000016AE 7503E9B700 je _.L264 667:dsk.c **** tracks > 0; tracks--) 2348 .loc 1 667 0 is_stmt 0 discriminator 1 0 000016B3 268B4705 mov ax, word ptr es:[bx+5] 2350 _.L238: 0 000016B7 8946EE mov word ptr [bp-18], ax 2352 _.L239: 2353 _.LVL275: 667:dsk.c **** tracks > 0; tracks--) 2354 .loc 1 667 0 discriminator 5 0 000016BA 837EEE00 cmp word ptr [bp-18], 0 0 000016BE 7E03E9AD00 jg _.L243 2357 _.LVL276: 2358 _.L213: 2359 _.LBE171: 2360 _.LBB172: 697:dsk.c **** 2361 .loc 1 697 0 is_stmt 1 0 000016C3 8E46F4 mov es, word ptr [bp-12] 0 000016C6 8B5EF6 mov bx, word ptr [bp-10] 0 000016C9 268B4713 mov ax, word ptr es:[bx+19] 0 000016CD 8946F0 mov word ptr [bp-16], ax 0 000016D0 268B4715 mov ax, word ptr es:[bx+21] 0 000016D4 8946F4 mov word ptr [bp-12], ax 2368 _.LVL277: 699:dsk.c **** (fv->gbfv_spcfunbit ? 2369 .loc 1 699 0 0 000016D7 8EC0 mov es, ax 0 000016D9 8B5EF0 mov bx, word ptr [bp-16] 0 000016DC 26803F00 cmp byte ptr es:[bx], 0 0 000016E0 7503E92401 je _.L244 701:dsk.c **** pddt->ddt_defbpb.bpb_nsecs), DiskTransferBuffer); 2374 .loc 1 701 0 discriminator 1 0 000016E5 268B4705 mov ax, word ptr es:[bx+5] 2376 _.LVL278: 0 000016E9 36F76544 mul word ptr ss:[di+68] 2378 _.L245: 2379 _.LVL279: 2380 _.LBB173: 2381 _.LBB174: 527:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 2382 .loc 1 527 0 discriminator 4 0 000016ED 8D56FC lea dx, [-4+bp] 0 000016F0 52 push dx 2385 _.LVL280: 0 000016F1 50 push ax 528:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 2387 .loc 1 528 0 discriminator 4 0 000016F2 8E46F4 mov es, word ptr [bp-12] 2389 _.LVL281: 0 000016F5 8B5EF0 mov bx, word ptr [bp-16] 0 000016F8 268B4703 mov ax, word ptr es:[bx+3] 2392 _.LVL282: 0 000016FC 89C3 mov bx, ax 0 000016FE 99 cwd 0 000016FF 8B4515 mov ax, word ptr [di+21] 0 00001702 8946F6 mov word ptr [bp-10], ax 0 00001705 897EEE mov word ptr [bp-18], di 0 00001708 92 xchg dx, ax 0 00001709 F766F6 mul word ptr [bp-10] 0 0000170C 91 xchg cx, ax 0 0000170D 8B46F6 mov ax, word ptr [bp-10] 0 00001710 F7E3 mul bx 0 00001712 93 xchg bx, ax 0 00001713 89D6 mov si, dx 0 00001715 01CE add si, cx 0 00001717 8B7EF0 mov di, word ptr [bp-16] 2407 _.LVL283: 0 0000171A 268B4501 mov ax, word ptr es:[di+1] 0 0000171E 89C1 mov cx, ax 0 00001720 99 cwd 0 00001721 92 xchg dx, ax 0 00001722 01D9 add cx, bx 0 00001724 11F0 adc ax, si 529:dsk.c **** pddt->ddt_offset + sector, count, &transferred); 2414 .loc 1 529 0 discriminator 4 0 00001726 8B7EEE mov di, word ptr [bp-18] 0 00001729 8B7513 mov si, word ptr [di+19] 528:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 2417 .loc 1 528 0 discriminator 4 0 0000172C F7E6 mul si 0 0000172E 93 xchg bx, ax 0 0000172F 91 xchg cx, ax 0 00001730 F7E6 mul si 0 00001732 8946F6 mov word ptr [bp-10], ax 0 00001735 8956F8 mov word ptr [bp-8], dx 0 00001738 015EF8 add word ptr [bp-8], bx 529:dsk.c **** pddt->ddt_offset + sector, count, &transferred); 2425 .loc 1 529 0 discriminator 4 0 0000173B 8B958400 mov dx, word ptr [di+132] 0 0000173F 8B9D8600 mov bx, word ptr [di+134] 0 00001743 01C2 add dx, ax 0 00001745 135EF8 adc bx, word ptr [bp-8] 527:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 2430 .loc 1 527 0 discriminator 4 0 00001748 53 push bx 2432 _.LVL284: 0 00001749 52 push dx 2434 _.LVL285: 0 0000174A 1E push ds 2436 _.LVL286: 0 0000174B B8[0000] mov ax, offset _DiskTransferBuffer 0 0000174E 50 push ax 2439 _.LVL287: 0 0000174F B80044 mov ax, 17408 0 00001752 50 push ax 2442 _.LVL288: 0 00001753 57 push di 2444 _.LVL289: 2445 _.LVL290: 0 00001754 E8F9F4 call _LBA_Transfer 2447 _.LVL291: 2448 _.LBE174: 2449 _.LBE173: 703:dsk.c **** return dskerr(ret); 2450 .loc 1 703 0 discriminator 4 0 00001757 85C0 test ax, ax 0 00001759 7403E986FE jne _.L299 705:dsk.c **** } 2453 .loc 1 705 0 0 0000175E 8E46F4 mov es, word ptr [bp-12] 0 00001761 8B5EF0 mov bx, word ptr [bp-16] 0 00001764 268807 mov byte ptr es:[bx], al 2457 _.LVL292: 0 00001767 E945FE jmp _.L298 2459 _.LVL293: 2460 _.L264: 2461 _.LBE172: 2462 _.LBB175: 0 0000176A B80100 mov ax, 1 0 0000176D E947FF jmp _.L238 2465 _.LVL294: 2466 _.L243: 672:dsk.c **** return failure(E_FAILURE); 2467 .loc 1 672 0 0 00001770 8A46FC mov al, byte ptr [bp-4] 0 00001773 30E4 xor ah, ah 0 00001775 363B4535 cmp ax, word ptr ss:[di+53] 0 00001779 7603E98500 ja _.L265 675:dsk.c **** afentry.sector <= pddt->ddt_bpb.bpb_nsecs; afentry.sector++) 2472 .loc 1 675 0 0 0000177E C646FE01 mov byte ptr [bp-2], 1 670:dsk.c **** 2474 .loc 1 670 0 0 00001782 B8[0000] mov ax, offset _DiskTransferBuffer 2476 _.LVL295: 2477 _.L240: 676:dsk.c **** memcpy(addrfield++, &afentry, sizeof(afentry)); 2478 .loc 1 676 0 discriminator 1 0 00001785 8B7513 mov si, word ptr [di+19] 0 00001788 8A56FE mov dl, byte ptr [bp-2] 0 0000178B 30F6 xor dh, dh 675:dsk.c **** afentry.sector <= pddt->ddt_bpb.bpb_nsecs; afentry.sector++) 2482 .loc 1 675 0 discriminator 1 0 0000178D 39F2 cmp dx, si 0 0000178F 765B jbe _.L241 2485 _.LVL296: 2486 _.LBB168: 2487 _.LBB169: 527:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 2488 .loc 1 527 0 0 00001791 8D46FA lea ax, [-6+bp] 2490 _.LVL297: 0 00001794 50 push ax 0 00001795 56 push si 528:dsk.c **** (ULONG) pddt->ddt_bpb.bpb_nsecs + 2493 .loc 1 528 0 0 00001796 8A46FC mov al, byte ptr [bp-4] 0 00001799 8846F0 mov byte ptr [bp-16], al 0 0000179C C646F100 mov byte ptr [bp-15], 0 0 000017A0 8B46F0 mov ax, word ptr [bp-16] 0 000017A3 36F76515 mul word ptr ss:[di+21] 0 000017A7 8946F0 mov word ptr [bp-16], ax 0 000017AA 8956F2 mov word ptr [bp-14], dx 0 000017AD 8A46FD mov al, byte ptr [bp-3] 0 000017B0 30E4 xor ah, ah 0 000017B2 0346F0 add ax, word ptr [bp-16] 0 000017B5 93 xchg bx, ax 0 000017B6 89D1 mov cx, dx 0 000017B8 83D100 adc cx, 0 0 000017BB 91 xchg cx, ax 0 000017BC F7E6 mul si 0 000017BE 91 xchg cx, ax 0 000017BF 93 xchg bx, ax 0 000017C0 F7E6 mul si 0 000017C2 01CA add dx, cx 529:dsk.c **** pddt->ddt_offset + sector, count, &transferred); 2513 .loc 1 529 0 0 000017C4 8B8D8400 mov cx, word ptr [di+132] 0 000017C8 8B9D8600 mov bx, word ptr [di+134] 0 000017CC 01C1 add cx, ax 0 000017CE 11D3 adc bx, dx 527:dsk.c **** ((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) * 2518 .loc 1 527 0 0 000017D0 53 push bx 0 000017D1 51 push cx 0 000017D2 16 push ss 0 000017D3 B8[0000] mov ax, offset _DiskTransferBuffer 0 000017D6 50 push ax 0 000017D7 B8FFFF mov ax, -1 0 000017DA 50 push ax 0 000017DB 57 push di 0 000017DC E871F4 call _LBA_Transfer 2528 _.LVL298: 2529 _.LBE169: 2530 _.LBE168: 682:dsk.c **** return dskerr(ret); 2531 .loc 1 682 0 0 000017DF 85C0 test ax, ax 0 000017E1 7403E9FEFD jne _.L299 668:dsk.c **** { 2534 .loc 1 668 0 0 000017E6 FF4EEE dec word ptr [bp-18] 2536 _.LVL299: 0 000017E9 E9CEFE jmp _.L239 2538 _.LVL300: 2539 _.L241: 677:dsk.c **** 2540 .loc 1 677 0 discriminator 1 0 000017EC 89C6 mov si, ax 0 000017EE 83C604 add si, 4 2543 _.LVL301: 0 000017F1 BA0400 mov dx, 4 0 000017F4 52 push dx 0 000017F5 8D56FC lea dx, [-4+bp] 0 000017F8 52 push dx 0 000017F9 50 push ax 0 000017FA E8[FEFF] call _memcpy 2550 _.LVL302: 676:dsk.c **** memcpy(addrfield++, &afentry, sizeof(afentry)); 2551 .loc 1 676 0 discriminator 1 0 000017FD FE46FE inc byte ptr [bp-2] 677:dsk.c **** 2553 .loc 1 677 0 discriminator 1 0 00001800 96 xchg si, ax 0 00001801 EB82 jmp _.L240 2556 _.LVL303: 2557 _.L265: 673:dsk.c **** 2558 .loc 1 673 0 0 00001803 B80C81 mov ax, -32500 0 00001806 E9A9FD jmp _.L203 2561 _.LVL304: 2562 _.L244: 2563 _.LBE175: 2564 _.LBB176: 699:dsk.c **** (fv->gbfv_spcfunbit ? 2565 .loc 1 699 0 discriminator 2 0 00001809 8B4544 mov ax, word ptr [di+68] 2567 _.LVL305: 0 0000180C E9DEFE jmp _.L245 2569 _.LVL306: 2570 _.L267: 2571 _.LBE176: 2572 _.LBB177: 719:dsk.c **** /* return error if media lacks extended BPB with serial # */ 2573 .loc 1 719 0 0 0000180F BB2600 mov bx, 38 0 00001812 E934FB jmp _.L247 2576 _.LVL307: 2577 _.L269: 726:dsk.c **** fs->serialno = gioc->ioc_serialno; 2578 .loc 1 726 0 0 00001815 BB2700 mov bx, 39 0 00001818 E950FB jmp _.L248 2581 _.LVL308: 2582 _.L206: 2583 _.LBE177: 2584 _.LBB178: 745:dsk.c **** (ai->AI_Flag ? 0 : DF_NOACCESS); 2585 .loc 1 745 0 0 0000181B 80E4FD and ah, -3 2587 _.LVL309: 746:dsk.c **** } 2588 .loc 1 746 0 0 0000181E 8E46F4 mov es, word ptr [bp-12] 0 00001821 8B5EF6 mov bx, word ptr [bp-10] 0 00001824 268B5F13 mov bx, word ptr es:[bx+19] 0 00001828 8B76F6 mov si, word ptr [bp-10] 0 0000182B 268B5415 mov dx, word ptr es:[si+21] 0 0000182F 8EC2 mov es, dx 0 00001831 26807F0101 cmp byte ptr es:[bx+1], 1 0 00001836 19D2 sbb dx, dx 0 00001838 F7DA neg dx 0 0000183A B109 mov cl, 9 2599 _.LVL310: 0 0000183C D3E2 shl dx, cl 745:dsk.c **** (ai->AI_Flag ? 0 : DF_NOACCESS); 2601 .loc 1 745 0 0 0000183E 09D0 or ax, dx 0 00001840 894533 mov word ptr [di+51], ax 2604 _.LVL311: 0 00001843 E969FD jmp _.L298 2606 _.LVL312: 2607 _.L215: 2608 _.LBE178: 2609 _.LBB179: 751:dsk.c **** bpb *pbpb; 2610 .loc 1 751 0 0 00001846 8E46F4 mov es, word ptr [bp-12] 0 00001849 8B5EF6 mov bx, word ptr [bp-10] 0 0000184C 268B5F13 mov bx, word ptr es:[bx+19] 0 00001850 8B76F6 mov si, word ptr [bp-10] 0 00001853 268B7415 mov si, word ptr es:[si+21] 2616 _.LVL313: 754:dsk.c **** gblp->gbio_devattrib = descflags & 3; 2617 .loc 1 754 0 0 00001857 8A5532 mov dl, byte ptr [di+50] 0 0000185A 8EC6 mov es, si 0 0000185C 26885701 mov byte ptr es:[bx+1], dl 2621 _.LVL314: 755:dsk.c **** /* 360 kb disk in 1.2 MB drive */ 2622 .loc 1 755 0 0 00001860 83E003 and ax, 3 2624 _.LVL315: 0 00001863 26894702 mov word ptr es:[bx+2], ax 0 00001867 30D2 xor dl, dl 757:dsk.c **** gblp->gbio_ncyl = pddt->ddt_ncyl; 2627 .loc 1 757 0 0 00001869 36807D3201 cmp byte ptr ss:[di+50], 1 0 0000186E 750B jne _.L252 757:dsk.c **** gblp->gbio_ncyl = pddt->ddt_ncyl; 2630 .loc 1 757 0 is_stmt 0 discriminator 1 0 00001870 36837D3528 cmp word ptr ss:[di+53], 40 0 00001875 9F lahf 0 00001876 D0E4 shl ah, 1 0 00001878 99 cwd 0 00001879 F6DA neg dl 2636 _.L252: 757:dsk.c **** gblp->gbio_ncyl = pddt->ddt_ncyl; 2637 .loc 1 757 0 discriminator 6 0 0000187B 8EC6 mov es, si 0 0000187D 26885706 mov byte ptr es:[bx+6], dl 758:dsk.c **** /* use default dpb or current bpb? */ 2640 .loc 1 758 0 is_stmt 1 discriminator 6 0 00001881 8B4535 mov ax, word ptr [di+53] 0 00001884 26894704 mov word ptr es:[bx+4], ax 762:dsk.c **** #ifdef WITHFAT32 2643 .loc 1 762 0 discriminator 6 0 00001888 26F60701 test byte ptr es:[bx], 1 0 0000188C 7518 jne _.L253 762:dsk.c **** #ifdef WITHFAT32 2646 .loc 1 762 0 is_stmt 0 discriminator 1 0 0000188E 8D4537 lea ax, [55+di] 2648 _.L254: 2649 _.LVL316: 764:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 2650 .loc 1 764 0 is_stmt 1 0 00001891 85C9 test cx, cx 0 00001893 7516 jne _.L272 0 00001895 BA1F00 mov dx, 31 2654 _.L255: 764:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 2655 .loc 1 764 0 is_stmt 0 discriminator 4 0 00001898 52 push dx 0 00001899 16 push ss 0 0000189A 50 push ax 0 0000189B 83C307 add bx, 7 2660 _.LVL317: 0 0000189E 56 push si 0 0000189F 53 push bx 2663 _.LVL318: 2664 _.L300: 2665 _.LBE179: 2666 _.LBB180: 792:dsk.c **** } 2667 .loc 1 792 0 is_stmt 1 0 000018A0 E8[FEFF] call _fmemcpy 2669 _.LVL319: 0 000018A3 E909FD jmp _.L298 2671 _.LVL320: 2672 _.L253: 2673 _.LBE180: 2674 _.LBB181: 762:dsk.c **** #ifdef WITHFAT32 2675 .loc 1 762 0 discriminator 2 0 000018A6 8D4506 lea ax, [6+di] 0 000018A9 EBE6 jmp _.L254 2678 _.LVL321: 2679 _.L272: 764:dsk.c **** extended ? sizeof(gblp->gbio_bpb) : BPB_SIZEOF); 2680 .loc 1 764 0 0 000018AB BA2900 mov dx, 41 0 000018AE EBE8 jmp _.L255 2683 _.LVL322: 2684 _.L217: 2685 _.LBE181: 2686 _.LBB182: 783:dsk.c **** 2687 .loc 1 783 0 0 000018B0 8E46F4 mov es, word ptr [bp-12] 0 000018B3 8B5EF6 mov bx, word ptr [bp-10] 0 000018B6 268B7713 mov si, word ptr es:[bx+19] 0 000018BA 268B4715 mov ax, word ptr es:[bx+21] 2692 _.LVL323: 0 000018BE 8946F6 mov word ptr [bp-10], ax 2694 _.LVL324: 785:dsk.c **** if (ret != 0) 2695 .loc 1 785 0 0 000018C1 57 push di 2697 _.LVL325: 0 000018C2 E8F2F7 call _getbpb 2699 _.LVL326: 786:dsk.c **** return (ret); 2700 .loc 1 786 0 0 000018C5 85C0 test ax, ax 0 000018C7 7403E9E6FC jne _.L203 790:dsk.c **** fmemcpy(gioc->ioc_volume, pddt->ddt_volume, 11); 2703 .loc 1 790 0 0 000018CC 8B5577 mov dx, word ptr [di+119] 0 000018CF 8B4579 mov ax, word ptr [di+121] 2706 _.LVL327: 0 000018D2 8E46F6 mov es, word ptr [bp-10] 0 000018D5 26895402 mov word ptr es:[si+2], dx 2709 _.LVL328: 0 000018D9 8E46F6 mov es, word ptr [bp-10] 0 000018DC 26894404 mov word ptr es:[si+4], ax 791:dsk.c **** fmemcpy(gioc->ioc_fstype, pddt->ddt_fstype, 8); 2712 .loc 1 791 0 0 000018E0 B80B00 mov ax, 11 0 000018E3 50 push ax 0 000018E4 8D456B lea ax, [107+di] 0 000018E7 16 push ss 0 000018E8 50 push ax 0 000018E9 8D4406 lea ax, [6+si] 0 000018EC FF76F6 push word ptr [bp-10] 0 000018EF 50 push ax 0 000018F0 E8[FEFF] call _fmemcpy 2722 _.LVL329: 792:dsk.c **** } 2723 .loc 1 792 0 0 000018F3 B80800 mov ax, 8 0 000018F6 50 push ax 0 000018F7 8D457B lea ax, [123+di] 0 000018FA 16 push ss 0 000018FB 50 push ax 0 000018FC 8D4411 lea ax, [17+si] 0 000018FF FF76F6 push word ptr [bp-10] 0 00001902 E9F6FB jmp _.L301 2732 _.LVL330: 2733 _.L268: 2734 _.LBE182: 2735 _.LBB183: 722:dsk.c **** 2736 .loc 1 722 0 0 00001905 B80781 mov ax, -32505 2738 _.LVL331: 0 00001908 E9A7FC jmp _.L203 2740 _.LVL332: 2741 _.L234: 2742 _.LBE183: 2743 _.LBB184: 2744 _.LBB170: 648:dsk.c **** if (!(tracks == 80 && ((secs == 15 && type == 3) || 2745 .loc 1 648 0 0 0000190B B404 mov ah, 4 649:dsk.c **** (secs == 9 && type == 4)))) 2747 .loc 1 649 0 0 0000190D 83FA50 cmp dx, 80 0 00001910 7403E958FD jne _.L235 0 00001915 E94AFD jmp _.L256 2751 _.LBE170: 2752 _.LBE184: 2753 _.LFE23: 2754 .size _Genblkdev, .-_Genblkdev 2755 .global _getddt 2756 .type _getddt, @function 2757 _getddt: 2758 _.LFB4: 96:dsk.c **** return &(((ddt *) Dyn.Buffer)[dev]); 2759 .loc 1 96 0 2760 _.LVL333: 0 00001918 55 push bp 2762 _.LCFI29: 0 00001919 89E5 mov bp, sp 2764 _.LCFI30: 97:dsk.c **** } 2765 .loc 1 97 0 0 0000191B B88800 mov ax, 136 0 0000191E F76604 mul word ptr [bp+4] 0 00001921 05[0200] add ax, offset _Dyn+2 98:dsk.c **** 2769 .loc 1 98 0 0 00001924 5D pop bp 0 00001925 C20200 ret 2 2772 _.LFE4: 2773 .size _getddt, .-_getddt 2774 .global _blk_driver 2775 .type _blk_driver, @function 2776 _blk_driver: 2777 _.LFB7: 174:dsk.c **** if (rp->r_unit >= blk_dev.dh_name[0] && rp->r_command != C_INIT) 2778 .loc 1 174 0 2779 _.LVL334: 0 00001928 56 push si 0 00001929 55 push bp 2782 _.LCFI31: 0 0000192A 89E5 mov bp, sp 2784 _.LCFI32: 175:dsk.c **** return failure(E_UNIT); 2785 .loc 1 175 0 0 0000192C C47608 les si, dword ptr [bp+8] 0 0000192F 8CC1 mov cx, es 0 00001931 268A4401 mov al, byte ptr es:[si+1] 0 00001935 BA[0000] mov dx, offset _blk_dev@OZSEG16 0 00001938 8EC2 mov es, dx 0 0000193A 263A06[0A00] cmp al, byte ptr es:[_blk_dev+10] 0 0000193F 7209 jc _.L311 175:dsk.c **** return failure(E_UNIT); 2793 .loc 1 175 0 is_stmt 0 discriminator 1 0 00001941 8EC1 mov es, cx 0 00001943 26807C0200 cmp byte ptr es:[si+2], 0 0 00001948 7524 jne _.L313 2797 _.L311: 177:dsk.c **** { 2798 .loc 1 177 0 is_stmt 1 0 0000194A 8EC1 mov es, cx 0 0000194C 268A5402 mov dl, byte ptr es:[si+2] 0 00001950 80FA1A cmp dl, 26 0 00001953 771E ja _.L314 182:dsk.c **** } 2803 .loc 1 182 0 0 00001955 30F6 xor dh, dh 0 00001957 D1E2 shl dx, 1 0 00001959 89D3 mov bx, dx 2807 _.LBB185: 2808 _.LBB186: 97:dsk.c **** } 2809 .loc 1 97 0 0 0000195B B488 mov ah, -120 0 0000195D F6E4 mul ah 0 0000195F 05[0200] add ax, offset _Dyn+2 2813 _.LBE186: 2814 _.LBE185: 182:dsk.c **** } 2815 .loc 1 182 0 0 00001962 50 push ax 0 00001963 51 push cx 0 00001964 56 push si 0 00001965 FF97[0000] call word ptr [bx+_dispatch] 2820 _.LVL335: 2821 _.L310: 183:dsk.c **** 2822 .loc 1 183 0 0 00001969 89EC mov sp, bp 0 0000196B 5D pop bp 0 0000196C 5E pop si 0 0000196D CB retf 2827 _.L313: 176:dsk.c **** if (rp->r_command > NENTRY) 2828 .loc 1 176 0 0 0000196E B80181 mov ax, -32511 0 00001971 EBF6 jmp _.L310 2831 _.L314: 179:dsk.c **** } 2832 .loc 1 179 0 0 00001973 B80C81 mov ax, -32500 0 00001976 EBF1 jmp _.L310 2835 _.LFE7: 2836 .size _blk_driver, .-_blk_driver === Switch to base=000790h -> ".DATA" 2837 .data 2838 .type _dap.2610, @object 2839 .size _dap.2610, 16 2840 _dap.2610: 0 000011B2 10 .byte 16 0 000011B3 00 .byte 0 0 000011B4 00 .byte 0 0 000011B5 00 .byte 0 0 000011B6 0000 .hword 0 0 000011B8 0000 .hword 0 0 000011BA 0000 .hword 0 0 000011BC 0000 .hword 0 0 000011BE 0000 .hword 0 0 000011C0 0000 .hword 0 2851 .type _template_string, @object 2852 .size _template_string, 29 2853 _template_string: 0 000011C2 52656D6F76652064 .string "Remove diskette in drive X:\n" 0 000011CA 69736B6574746520 0 000011D2 696E206472697665 0 000011DA 20583A0A00 === Switch to base=012BB0h -> ".RODATA" 2855 .section .rodata 2856 .p2align 1 2857 .type _dispatch, @object 2858 .size _dispatch, 52 2859 _dispatch: 0 00001600 [6E00] .hword _blk_error 0 00001602 [4608] .hword _mediachk 0 00001604 [1108] .hword _bldbpb 0 00001606 [6E00] .hword _blk_error 0 00001608 [3805] .hword _blockio 0 0000160A [1C00] .hword _blk_nondr 0 0000160C [8100] .hword _blk_noerr 0 0000160E [8100] .hword _blk_noerr 0 00001610 [3805] .hword _blockio 0 00001612 [3805] .hword _blockio 0 00001614 [8100] .hword _blk_noerr 0 00001616 [8100] .hword _blk_noerr 0 00001618 [6E00] .hword _blk_error 0 0000161A [0000] .hword _blk_Open 0 0000161C [0E00] .hword _blk_Close 0 0000161E [2200] .hword _blk_Media 0 00001620 [8100] .hword _blk_noerr 0 00001622 [6E00] .hword _blk_error 0 00001624 [6E00] .hword _blk_error 0 00001626 [C308] .hword _Genblkdev 0 00001628 [6E00] .hword _blk_error 0 0000162A [6E00] .hword _blk_error 0 0000162C [6E00] .hword _blk_error 0 0000162E [E700] .hword _Getlogdev 0 00001630 [5B01] .hword _Setlogdev 0 00001632 [3800] .hword _IoctlQueblk 2886 .global _DiskTransferBuffer === Switch to base=012BB0h -> ".BSS" 2887 .bss 2888 .p2align 0 2889 .type _DiskTransferBuffer, @object 2890 .size _DiskTransferBuffer, 512 2891 _DiskTransferBuffer: 0 00000B00 0000000000000000 .skip 512,0 0 00000B08 0000000000000000 0 00000B10 0000000000000000 0 00000B18 0000000000000000 0 00000B20 0000000000000000 0 00000B28 0000000000000000 0 00000B30 0000000000000000 0 00000B38 0000000000000000 0 00000B40 0000000000000000 0 00000B48 0000000000000000 0 00000B50 0000000000000000 0 00000B58 0000000000000000 0 00000B60 0000000000000000 0 00000B68 0000000000000000 0 00000B70 0000000000000000 0 00000B78 0000000000000000 0 00000B80 0000000000000000 0 00000B88 0000000000000000 0 00000B90 0000000000000000 0 00000B98 0000000000000000 0 00000BA0 0000000000000000 0 00000BA8 0000000000000000 0 00000BB0 0000000000000000 0 00000BB8 0000000000000000 0 00000BC0 0000000000000000 0 00000BC8 0000000000000000 0 00000BD0 0000000000000000 0 00000BD8 0000000000000000 0 00000BE0 0000000000000000 0 00000BE8 0000000000000000 0 00000BF0 0000000000000000 0 00000BF8 0000000000000000 0 00000C00 0000000000000000 0 00000C08 0000000000000000 0 00000C10 0000000000000000 0 00000C18 0000000000000000 0 00000C20 0000000000000000 0 00000C28 0000000000000000 0 00000C30 0000000000000000 0 00000C38 0000000000000000 0 00000C40 0000000000000000 0 00000C48 0000000000000000 0 00000C50 0000000000000000 0 00000C58 0000000000000000 0 00000C60 0000000000000000 0 00000C68 0000000000000000 0 00000C70 0000000000000000 0 00000C78 0000000000000000 0 00000C80 0000000000000000 0 00000C88 0000000000000000 0 00000C90 0000000000000000 0 00000C98 0000000000000000 0 00000CA0 0000000000000000 0 00000CA8 0000000000000000 0 00000CB0 0000000000000000 0 00000CB8 0000000000000000 0 00000CC0 0000000000000000 0 00000CC8 0000000000000000 0 00000CD0 0000000000000000 0 00000CD8 0000000000000000 0 00000CE0 0000000000000000 0 00000CE8 0000000000000000 0 00000CF0 0000000000000000 0 00000CF8 0000000000000000 2893 .global _LBA_WRITE_VERIFY === Switch to base=000790h -> ".DATA" 2894 .data 0 000011DF 00 .p2align 1 2896 .type _LBA_WRITE_VERIFY, @object 2897 .size _LBA_WRITE_VERIFY, 2 2898 _LBA_WRITE_VERIFY: 0 000011E0 0243 .hword 17154 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: dyninit.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=dyninit.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccacgfwz.s output file : dyninit.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:56.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: === Switch to base=012BB0h -> ".RODATA.STR1.1" 7 .section .rodata.str1.1,"aMS",@progbits,1 8 _.LC0: 0 00000D0A 50414E49433A4479 .string "PANIC:Dyn %lu\n" 0 00000D12 6E20256C750A00 === Switch to base=002270h -> ".TEXT" 10 .text 11 .global _DynAlloc 12 .type _DynAlloc, @function 13 _DynAlloc: 14 _.LFB4: 15 .file 1 "dyninit.c" 1:dyninit.c **** /* 2:dyninit.c **** DYNINIT.C 3:dyninit.c **** 4:dyninit.c **** this serves requests from the INIT modules to 5:dyninit.c **** allocate dynamic data. 6:dyninit.c **** 7:dyninit.c **** kernel layout: 8:dyninit.c **** 00000H 000FFH 00100H PSP PSP 9:dyninit.c **** 00100H 004E1H 003E2H _TEXT CODE 10:dyninit.c **** 004E2H 007A7H 002C6H _IO_TEXT CODE 11:dyninit.c **** 007A8H 008E5H 0013EH _IO_FIXED_DATA CODE 12:dyninit.c **** 008F0H 0139FH 00AB0H _FIXED_DATA DATA 13:dyninit.c **** 013A0H 019F3H 00654H _DATA DATA 14:dyninit.c **** 019F4H 0240DH 00A1AH _BSS BSS 15:dyninit.c **** 16:dyninit.c **** additionally: 17:dyninit.c **** DYN_DATA DYN 18:dyninit.c **** 19:dyninit.c **** 20:dyninit.c **** 02610H 0F40EH 0CDFFH HMA_TEXT HMA 21:dyninit.c **** 22:dyninit.c **** FCBs, f_nodes, buffers,... 23:dyninit.c **** drivers 24:dyninit.c **** 25:dyninit.c **** 26:dyninit.c **** 0F410H 122DFH 02ED0H INIT_TEXT INIT 27:dyninit.c **** 122E0H 12AA5H 007C6H ID ID 28:dyninit.c **** 12AA6H 12CBFH 0021AH IB IB 29:dyninit.c **** 30:dyninit.c **** purpose is to move the HMA_TEXT = resident kernel 31:dyninit.c **** around, so that below it - after BSS, there is data 32:dyninit.c **** addressable near by the kernel, to hold some arrays 33:dyninit.c **** like f_nodes 34:dyninit.c **** 35:dyninit.c **** making f_nodes near saves ~2.150 code in HMA 36:dyninit.c **** 37:dyninit.c **** */ 38:dyninit.c **** #include "portab.h" 39:dyninit.c **** #include "init-mod.h" 40:dyninit.c **** #include "dyndata.h" 41:dyninit.c **** 42:dyninit.c **** #if defined(DEBUG) 43:dyninit.c **** #define DebugPrintf(x) printf x 44:dyninit.c **** #else 45:dyninit.c **** #define DebugPrintf(x) 46:dyninit.c **** #endif 47:dyninit.c **** 48:dyninit.c **** /*extern struct DynS FAR Dyn;*/ 49:dyninit.c **** 50:dyninit.c **** #ifndef __TURBOC__ 51:dyninit.c **** extern struct DynS DOSFAR ASM Dyn; 52:dyninit.c **** #else 53:dyninit.c **** extern struct DynS FAR ASM Dyn; 54:dyninit.c **** #endif 55:dyninit.c **** 56:dyninit.c **** void far *DynAlloc(char *what, unsigned num, unsigned size) 57:dyninit.c **** { 16 .loc 1 57 0 17 _.LVL0: 0 000033D9 56 push si 0 000033DA 57 push di 0 000033DB 55 push bp 21 _.LCFI0: 0 000033DC 89E5 mov bp, sp 23 _.LCFI1: 0 000033DE 83EC06 sub sp, 6 58:dyninit.c **** void far *now; 59:dyninit.c **** unsigned total = num * size; 25 .loc 1 59 0 0 000033E1 8B460A mov ax, word ptr [bp+10] 0 000033E4 F7660C mul word ptr [bp+12] 0 000033E7 8946FE mov word ptr [bp-2], ax 29 _.LVL1: 60:dyninit.c **** struct DynS far *Dynp = MK_FP(FP_SEG(LoL), FP_OFF(&Dyn)); 30 .loc 1 60 0 0 000033EA 31C9 xor cx, cx 0 000033EC 8B16[0200] mov dx, word ptr [_LoL+2] 0 000033F0 BE[0000] mov si, offset ___ia16_near_alias.0 34 _.LVL2: 61:dyninit.c **** 62:dyninit.c **** #ifndef DEBUG 63:dyninit.c **** UNREFERENCED_PARAMETER(what); 64:dyninit.c **** #endif 65:dyninit.c **** 66:dyninit.c **** if ((ULONG) total + Dynp->Allocated > 0xffff) 35 .loc 1 66 0 0 000033F3 8EC2 mov es, dx 0 000033F5 268E1C mov ds, word ptr es:[si] 0 000033F8 8B46FE mov ax, word ptr [bp-2] 0 000033FB 89CF mov di, cx 0 000033FD 8CD9 mov cx, ds 0 000033FF 89FB mov bx, di 0 00003401 01C1 add cx, ax 0 00003403 11FF adc di, di 0 00003405 39DF cmp di, bx 0 00003407 7410 je _.L6 67:dyninit.c **** { 68:dyninit.c **** printf("PANIC:Dyn %lu\n", (ULONG) total + Dynp->Allocated); 46 .loc 1 68 0 0 00003409 57 push di 0 0000340A 51 push cx 0 0000340B B8[0000] mov ax, offset _.LC0 50 _.LVL3: 0 0000340E 50 push ax 0 0000340F 16 push ss 0 00003410 1F pop ds 0 00003411 E8[FEFF] call _init_printf 55 _.LVL4: 0 00003414 83C406 add sp, 6 57 _.L4: 0 00003417 EBFE jmp _.L4 59 _.LVL5: 60 _.L6: 69:dyninit.c **** for (;;) ; 70:dyninit.c **** } 71:dyninit.c **** 72:dyninit.c **** DebugPrintf(("DYNDATA:allocating %s - %u * %u bytes, total %u, %u..%u\n", 73:dyninit.c **** what, num, size, total, Dynp->Allocated, 74:dyninit.c **** Dynp->Allocated + total)); 75:dyninit.c **** 76:dyninit.c **** now = (void far *)&Dynp->Buffer[Dynp->Allocated]; 61 .loc 1 76 0 0 00003419 8CDB mov bx, ds 0 0000341B 8D4002 lea ax, [2+bx+si] 64 _.LVL6: 77:dyninit.c **** fmemset(now, 0, total); 65 .loc 1 77 0 0 0000341E FF76FE push word ptr [bp-2] 0 00003421 57 push di 0 00003422 52 push dx 0 00003423 8956FA mov word ptr [bp-6], dx 0 00003426 50 push ax 0 00003427 8946FC mov word ptr [bp-4], ax 0 0000342A 16 push ss 0 0000342B 1F pop ds 0 0000342C E8[FEFF] call _init_fmemset 75 _.LVL7: 78:dyninit.c **** 79:dyninit.c **** Dynp->Allocated += total; 76 .loc 1 79 0 0 0000342F 8B56FA mov dx, word ptr [bp-6] 0 00003432 8EC2 mov es, dx 0 00003434 8B4EFE mov cx, word ptr [bp-2] 0 00003437 26030C add cx, word ptr es:[si] 0 0000343A 26890C mov word ptr es:[si], cx 82 _.LVL8: 80:dyninit.c **** 81:dyninit.c **** return now; 82:dyninit.c **** } 83 .loc 1 82 0 0 0000343D 8B46FC mov ax, word ptr [bp-4] 0 00003440 89EC mov sp, bp 0 00003442 5D pop bp 0 00003443 5F pop di 0 00003444 5E pop si 0 00003445 C20600 ret 6 90 _.LFE4: 91 .size _DynAlloc, .-_DynAlloc 92 .global _DynFree 93 .type _DynFree, @function 94 _DynFree: 95 _.LFB5: 83:dyninit.c **** 84:dyninit.c **** void DynFree(void *ptr) 85:dyninit.c **** { 96 .loc 1 85 0 97 _.LVL9: 0 00003448 89E3 mov bx, sp 99 _.LCFI2: 100 _.LVL10: 86:dyninit.c **** struct DynS far *Dynp = MK_FP(FP_SEG(LoL), FP_OFF(&Dyn)); 87:dyninit.c **** Dynp->Allocated = (char *)ptr - (char *)Dynp->Buffer; 101 .loc 1 87 0 0 0000344A 8B4702 mov ax, word ptr [bx+2] 0 0000344D 2D[0200] sub ax, offset ___ia16_near_alias.1+2 0 00003450 8E06[0200] mov es, word ptr [_LoL+2] 0 00003454 26A3[0000] mov word ptr es:[___ia16_near_alias.1], ax 106 _.LVL11: 88:dyninit.c **** } 107 .loc 1 88 0 0 00003458 C20200 ret 2 109 _.LFE5: 110 .size _DynFree, .-_DynFree 111 .global _DynLast 112 .type _DynLast, @function 113 _DynLast: 114 _.LFB6: 89:dyninit.c **** 90:dyninit.c **** void FAR * DynLast() 91:dyninit.c **** { 115 .loc 1 91 0 92:dyninit.c **** struct DynS far *Dynp = MK_FP(FP_SEG(LoL), FP_OFF(&Dyn)); 116 .loc 1 92 0 0 0000345B 8B16[0200] mov dx, word ptr [_LoL+2] 118 _.LVL12: 93:dyninit.c **** DebugPrintf(("dynamic data end at %p\n", 94:dyninit.c **** (void FAR *)(Dynp->Buffer + Dynp->Allocated))); 95:dyninit.c **** 96:dyninit.c **** return Dynp->Buffer + Dynp->Allocated; 119 .loc 1 96 0 0 0000345F 8EC2 mov es, dx 0 00003461 26A1[0000] mov ax, word ptr es:[___ia16_near_alias.2] 0 00003465 05[0200] add ax, offset ___ia16_near_alias.2+2 97:dyninit.c **** } 123 .loc 1 97 0 0 00003468 C3 ret 125 _.LFE6: 126 .size _DynLast, .-_DynLast 127 .weakref ___ia16_near_alias.2,_Dyn 128 .weakref ___ia16_near_alias.1,_Dyn 129 .weakref ___ia16_near_alias.0,_Dyn === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: entry.lst 1 ; 2 ; File: 3 ; entry.asm 4 ; Description: 5 ; System call entry code 6 ; 7 ; Copyright (c) 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Id: entry.asm 1701 2012-01-16 22:06:21Z perditionc $ 29 ; 30 31 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 32 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 33 === Switch to base=002270h -> "HMA_TEXT" 34 segment HMA_TEXT 35 extern _int21_syscall 36 extern _int21_service 37 extern _int2526_handler 38 extern _error_tos 39 extern _char_api_tos 40 extern _disk_api_tos 41 extern _user_r 42 extern _ErrorMode 43 extern _InDOS 44 extern _term_type 45 extern _abort_progress 46 %IFDEF WIN31SUPPORT 47 extern _winInstanced 48 %ENDIF ; WIN31SUPPORT 49 extern _cu_psp 50 extern _MachineId 51 extern critical_sp 52 53 extern int21regs_seg 54 extern int21regs_off 55 56 extern _Int21AX 57 58 extern _DGROUP_ 59 60 global reloc_call_cpm_entry 61 global reloc_call_int20_handler 62 global reloc_call_int21_handler 63 global reloc_call_low_int25_handler 64 global reloc_call_low_int26_handler 65 global reloc_call_int27_handler 66 67 ; 68 ; MS-DOS CP/M style entry point 69 ; 70 ; VOID FAR 71 ; cpm_entry(iregs UserRegs) 72 ; 73 ; For CP/M compatibility allow a program to invoke any DOS API function 74 ; between 0 and 24h by doing a near call to psp:0005h which embeds a far call 75 ; to absolute address 0:00C0h (int vector 30h & 31h) or FFFF:00D0 (hma). 76 ; 0:00C0h contains the jmp instruction to reloc_call_cpm_entry which should 77 ; be duplicated in hma to ensure correct operation with either state of A20 line. 78 ; Note: int 31h is also used for DPMI but only in protected mode. 79 ; Upon entry the stack has a near return offset (desired return address offset) 80 ; and far return seg:offset (desired return segment of PSP, and useless offset 81 ; which if used will return to the data, not code, at offset 0ah after far call 82 ; in psp). We convert it to a normal call and correct the stack to appear same 83 ; as if invoked via an int 21h call including proper return address. 84 ; 85 reloc_call_cpm_entry: 86 ; Stack is: 87 ; return offset 88 ; psp seg 89 ; 000ah 90 ; 0 000000D5 83C402 add sp, byte 2 ; remove unneeded far return offset 0ah 0 000000D8 9C pushf ; start setting up int 21h stack 93 ; 94 ; now stack is 95 ; return offset 96 ; psp seg 97 ; flags 98 ; 0 000000D9 55 push bp 0 000000DA 89E5 mov bp,sp ; set up reference frame 101 ; 102 ; reference frame stack is 103 ; return offset bp + 6 104 ; psp seg bp + 4 105 ; flags bp + 2 106 ; bp <--- bp 107 ; 0 000000DC 50 push ax 0 000000DD 8B4602 mov ax,[2+bp] ; get the flags 0 000000E0 874606 xchg ax,[6+bp] ; swap with return address 0 000000E3 894602 mov [2+bp],ax 0 000000E6 58 pop ax ; restore working registers 0 000000E7 5D pop bp 114 ; 115 ; Done. Stack is 116 ; flags 117 ; psp seg (alias .COM cs) 118 ; return offset 119 ; 0 000000E8 80F924 cmp cl,024h ; restrict calls to functions 0-24h 0 000000EB 7705 ja cpm_error 0 000000ED 88CC mov ah,cl ; get the call # from cl to ah 0 000000EF E9B400 jmp reloc_call_int21_handler ; do the system call 0 000000F2 B000 cpm_error: mov al,0 0 000000F4 CF iret ; cleanup stack and return to caller 126 127 ; 128 ; interrupt zero divide handler: 129 ; print a message 'Interrupt divide by zero' 130 ; Terminate the current process 131 ; 132 ; VOID INRPT far 133 ; int20_handler(iregs UserRegs) 134 ; 135 0 000000F5 B10C print_hex: mov cl, 12 137 hex_loop: 0 000000F7 89D0 mov ax, dx 0 000000F9 D3E8 shr ax, cl 0 000000FB 240F and al, 0fh 0 000000FD 3C0A cmp al, 10 0 000000FF 1C69 sbb al, 69h 0 00000101 2F das 0 00000102 BB7000 mov bx, 0070h 0 00000105 B40E mov ah, 0eh 0 00000107 CD10 int 10h 0 00000109 80E904 sub cl, 4 0 0000010C 73E9 jae hex_loop 0 0000010E C3 ret 150 0 0000010F 0D0A496E7465727275 divide_by_zero_message db 0dh,0ah,'Interrupt divide by zero, stack:',0dh,0ah,0 0 00000118 707420646976696465 0 00000121 206279207A65726F2C 0 0000012A 20737461636B3A0D0A 0 00000133 00 152 153 global reloc_call_int0_handler 154 reloc_call_int0_handler: 155 0 00000134 BE[3A00] mov si,divide_by_zero_message 157 158 zero_message_loop: 0 00000137 2E8A04 mov al, [cs:si] 0 0000013A 84C0 test al,al 0 0000013C 740A je zero_done 162 0 0000013E 46 inc si 0 0000013F BB7000 mov bx, 0070h 0 00000142 B40E mov ah, 0eh 166 0 00000144 CD10 int 10h 168 0 00000146 EBEF jmp short zero_message_loop 170 171 zero_done: 0 00000148 89E5 mov bp, sp 0 0000014A 31F6 xor si, si ; print 13 words of stack for debugging LUDIV etc. 174 stack_loop: 0 0000014C 8B12 mov dx, [bp+si] 0 0000014E E8A4FF call print_hex 0 00000151 B020 mov al, ' ' 0 00000153 CD10 int 10h 0 00000155 46 inc si 0 00000156 46 inc si 0 00000157 83FE1A cmp si, byte 13*2 0 0000015A 72F0 jb stack_loop 0 0000015C B00D mov al, 0dh 0 0000015E CD10 int 10h 0 00000160 B00A mov al, 0ah 0 00000162 CD10 int 10h 187 0 00000164 B87F4C mov ax,04c7fh ; terminate with errorlevel 127 0 00000167 CD21 int 21h 0 00000169 FB sti 0 0000016A F4 thats_it: hlt 0 0000016B EBFD jmp short thats_it ; it might be command.com that nukes 193 0 0000016D 0D0A496E76616C6964 invalid_opcode_message db 0dh,0ah,'Invalid Opcode at ',0 0 00000176 204F70636F64652061 0 0000017F 742000 195 196 global reloc_call_int6_handler 197 reloc_call_int6_handler: 198 0 00000182 BE[9800] mov si,invalid_opcode_message 0 00000185 EBB0 jmp short zero_message_loop 201 202 global reloc_call_int19_handler 203 reloc_call_int19_handler: 204 ; from Japheth's public domain code (JEMFBHLP.ASM) 205 ; restores int 10,13,15,19,1b and then calls the original int 19. 0 00000187 FC cld 0 00000188 31C0 xor ax,ax 0 0000018A 8EC0 mov es,ax 0 0000018C B070 mov al,70h 0 0000018E 8ED8 mov ds,ax 0 00000190 BE0001 mov si,100h 0 00000193 B90500 mov cx,5 0 00000196 FA cli 0 00000197 AC nextitem: lodsb 0 00000198 89C7 mov di,ax 216 %if XCPU >= 186 217 shl di,2 218 %else 0 0000019A D1E7 shl di,1 0 0000019C D1E7 shl di,1 221 %endif 0 0000019E A5 movsw 0 0000019F A5 movsw 0 000001A0 E2F5 loop nextitem 0 000001A2 CD19 int 19h 226 227 ; 228 ; Terminate the current process 229 ; 230 ; VOID INRPT far 231 ; int20_handler(iregs UserRegs) 232 ; 233 reloc_call_int20_handler: 0 000001A4 B400 mov ah,0 ; terminate through int 21h 235 236 237 ; 238 ; MS-DOS system call entry point 239 ; 240 ; VOID INRPT far 241 ; int21_handler(iregs UserRegs) 242 ; 243 reloc_call_int21_handler: 0 000001A6 80FC25 cmp ah,25h 0 000001A9 743D je int21_func25 0 000001AB 80FC35 cmp ah,35h 0 000001AE 744E je int21_func35 248 ; 249 ; Create the stack frame for C call. This is done to 250 ; preserve machine state and provide a C structure for 251 ; access to registers. 252 ; 253 ; Since this is an interrupt routine, CS, IP and flags were 254 ; pushed onto the stack by the processor, completing the 255 ; stack frame. 256 ; 257 ; NB: stack frame is MS-DOS dependent and not compatible 258 ; with compiler interrupt stack frames. 259 ; 0 000001B0 FB sti 261 PUSH$ALL 0 000001B1 06 push es 0 000001B2 1E push ds 0 000001B3 55 push bp 0 000001B4 57 push di 0 000001B5 56 push si 0 000001B6 52 push dx 0 000001B7 51 push cx 0 000001B8 53 push bx 0 000001B9 50 push ax 0 000001BA 89E5 mov bp,sp 263 ; 264 ; Create kernel reference frame. 265 ; 266 ; NB: At this point, SS != DS and won't be set that way 267 ; until later when which stack to run on is determined. 268 ; 0 000001BC 2E8B16[0000] mov dx,[cs:_DGROUP_] 0 000001C1 8EDA mov ds,dx 0 000001C3 C606[0000]00 mov byte [_term_type], 0 ; reset termination type 272 int21_reentry: ; entered here from int 24h abort, ds = dx => DGROUP 273 Protect386Registers 0 000001C8 80FC33 cmp ah,33h 0 000001CB 740F je int21_user 0 000001CD 80FC50 cmp ah,50h 0 000001D0 740A je int21_user 0 000001D2 80FC51 cmp ah,51h 0 000001D5 7405 je int21_user 0 000001D7 80FC62 cmp ah,62h 0 000001DA 7530 jne int21_1 282 283 int21_user: 284 %IFNDEF WIN31SUPPORT 0 000001DC E88500 call end_dos_crit_sect 286 %ENDIF ; NOT WIN31SUPPORT 287 0 000001DF 16 push ss 0 000001E0 55 push bp 0 000001E1 E8[0000] call _int21_syscall 0 000001E4 59 pop cx 0 000001E5 59 pop cx 0 000001E6 EB72 jmp short int21_ret 294 295 int21_func25: 0 000001E8 06 push es 0 000001E9 53 push bx 0 000001EA 31DB xor bx,bx 0 000001EC 8EC3 mov es,bx 0 000001EE 88C3 mov bl,al 0 000001F0 D1E3 shl bx,1 0 000001F2 D1E3 shl bx,1 0 000001F4 268917 mov [es:bx],dx 0 000001F7 268C5F02 mov [es:bx+2],ds 0 000001FB 5B pop bx 0 000001FC 07 pop es 0 000001FD CF iret 308 309 int21_func35: 0 000001FE 31DB xor bx,bx 0 00000200 8EC3 mov es,bx 0 00000202 88C3 mov bl,al 0 00000204 D1E3 shl bx,1 0 00000206 D1E3 shl bx,1 0 00000208 26C41F les bx,[es:bx] 0 0000020B CF iret 317 318 ; 319 ; normal entry, use one of our 4 stacks 320 ; 321 ; DX=DGROUP 322 ; CX=STACK 323 ; SI=userSS 324 ; BX=userSP 325 326 327 int21_1: 0 0000020C 8CD6 mov si,ss ; save user stack, to be retored later 329 330 331 ; 332 ; Now DS is set, let's save our stack for rentry (???TE) 333 ; 334 ; I don't know who needs that, but ... (TE) 335 ; 0 0000020E 8C16[0200] mov word [_user_r+2],ss 0 00000212 892E[0000] mov word [_user_r],bp ; store and init 338 339 ; 340 ; Decide which stack to run on. 341 ; 342 ; Unlike previous versions of DOS-C, we need to do this here 343 ; to guarantee the user stack for critical error handling. 344 ; We need to do the int 24h from this stack location. 345 ; 346 ; There are actually four stacks to run on. The first is the 347 ; user stack which is determined by system call number in 348 ; AH. The next is the error stack determined by _ErrorMode. 349 ; Then there's the character stack also determined by system 350 ; call number. Finally, all others run on the disk stack. 351 ; They are evaluated in that order. 352 0 00000216 803E[0000]00 cmp byte [_ErrorMode],0 0 0000021B 7410 je int21_2 355 356 int21_onerrorstack: 0 0000021D B9[0000] mov cx,_error_tos 358 359 0 00000220 FA cli 0 00000221 8ED2 mov ss,dx 0 00000223 89CC mov sp,cx 0 00000225 FB sti 364 0 00000226 56 push si ; user SS:SP 0 00000227 55 push bp 367 0 00000228 E8[0000] call _int21_service 0 0000022B EB26 jmp short int21_exit_nodec 370 371 372 int21_2: 373 %IFDEF WIN31SUPPORT ; begin critical section 374 ; should be called as needed, but we just 375 ; mark the whole int21 api as critical 376 call begin_dos_crit_sect 377 %ENDIF ; WIN31SUPPORT 0 0000022D FE06[0000] inc byte [_InDOS] 0 00000231 B9[0000] mov cx,_char_api_tos 0 00000234 08E4 or ah,ah 0 00000236 7405 jz int21_3 382 %IFDEF WIN31SUPPORT ; testing, this function call crashes 383 cmp ah,06h 384 je int21_3 385 %ENDIF ; WIN31SUPPORT 0 00000238 80FC0C cmp ah,0ch 0 0000023B 7606 jbe int21_normalentry 388 389 int21_3: 390 %IFNDEF WIN31SUPPORT 0 0000023D E82400 call end_dos_crit_sect 392 %ENDIF ; NOT WIN31SUPPORT 0 00000240 B9[0000] mov cx,_disk_api_tos 394 395 int21_normalentry: 396 0 00000243 FA cli 0 00000244 8ED2 mov ss,dx 0 00000246 89CC mov sp,cx 0 00000248 FB sti 401 402 ; 403 ; Push the far pointer to the register frame for 404 ; int21_syscall and remainder of kernel. 405 ; 406 0 00000249 56 push si ; user SS:SP 0 0000024A 55 push bp 0 0000024B E8[0000] call _int21_service 410 411 int21_exit: 412 %IFDEF WIN31SUPPORT 413 call end_dos_crit_sect ; release all critical sections 414 %if 0 415 push ax 416 mov ax, 8101h ; Leave Critical Section 417 int 2ah 418 pop ax 419 %endif 420 %ENDIF ; WIN31SUPPORT 421 422 ; tiny chance DOS re-entered between clearing InDOS and restoring user stack, 423 ; so we disable interrupts until user stack restored; see SF bug# 215 0 0000024E FA cli 0 0000024F FE0E[0000] dec byte [_InDOS] 426 ; 427 ; Recover registers from system call. Registers and flags 428 ; were modified by the system call. 429 ; 430 431 432 int21_exit_nodec: 0 00000253 5D pop bp ; get back user stack 0 00000254 5E pop si 435 436 global _int21_iret 437 _int21_iret: 0 00000255 FA cli 0 00000256 8ED6 mov ss,si 440 RestoreSP 0 00000258 89EC mov sp, bp 441 442 int21_ret: 443 Restore386Registers 444 POP$ALL 0 0000025A 58 pop ax 0 0000025B 5B pop bx 0 0000025C 59 pop cx 0 0000025D 5A pop dx 0 0000025E 5E pop si 0 0000025F 5F pop di 0 00000260 5D pop bp 0 00000261 1F pop ds 0 00000262 07 pop es 445 446 ; 447 ; ... and return. 448 ; 0 00000263 CF iret 450 %IFDEF WIN31SUPPORT 451 ; 452 ; begin DOS Critical Section 1 453 ; 454 ; 455 begin_dos_crit_sect: 456 ; we only enable critical sections if Windows is active 457 ; we currently use winInstanced, but may need to use separate patchable location 458 cmp word [_winInstanced], 0 459 jz skip_crit_sect 460 push ax 461 mov ax, 8001h ; Enter Critical Section 462 int 2ah 463 pop ax 464 skip_crit_sect: 465 ret 466 %ENDIF ; WIN31SUPPORT 467 ; 468 ; end Dos Critical Section 0 thur 7 469 ; 470 ; 471 end_dos_crit_sect: 0 00000264 A3[0000] mov [_Int21AX],ax ; needed! 0 00000267 50 push ax ; This must be here!!! 0 00000268 B482 mov ah,82h ; re-enrty sake before disk stack 0 0000026A CD2A int 2ah ; Calling Server Hook! 0 0000026C 58 pop ax 0 0000026D C3 ret 478 479 ; 480 ; Terminate the current process 481 ; 482 ; VOID INRPT far 483 ; int27_handler(iregs UserRegs) 484 ; 485 reloc_call_int27_handler: 486 ; 487 ; First convert the memory to paragraphs 488 ; 0 0000026E 83C20F add dx,byte 0fh ; round up 0 00000271 D1DA rcr dx,1 0 00000273 D1EA shr dx,1 0 00000275 D1EA shr dx,1 0 00000277 D1EA shr dx,1 494 ; 495 ; ... then use the standard system call 496 ; 0 00000279 B80031 mov ax,3100h 0 0000027C E927FF jmp reloc_call_int21_handler ; terminate through int 21h 499 500 ; 501 ; 502 503 reloc_call_low_int26_handler: 0 0000027F FB sti 0 00000280 9C pushf 0 00000281 50 push ax 0 00000282 B82600 mov ax,026h 0 00000285 EB06 jmp short int2526 509 reloc_call_low_int25_handler: 0 00000287 FB sti 0 00000288 9C pushf 0 00000289 50 push ax 0 0000028A B82500 mov ax,025h 514 int2526: 0 0000028D 51 push cx 0 0000028E 52 push dx 0 0000028F 53 push bx 0 00000290 54 push sp 0 00000291 55 push bp 0 00000292 56 push si 0 00000293 57 push di 0 00000294 1E push ds 0 00000295 06 push es 524 0 00000296 89E1 mov cx, sp ; save stack frame 0 00000298 8CD2 mov dx, ss 527 0 0000029A FC cld 0 0000029B 2E8B1E[0000] mov bx, [cs:_DGROUP_] 0 000002A0 8EDB mov ds, bx 531 532 ; setup our local stack 0 000002A2 FA cli 0 000002A3 8ED3 mov ss,bx 0 000002A5 BC[0000] mov sp,_disk_api_tos 0 000002A8 FB sti 537 538 Protect386Registers 539 0 000002A9 52 push dx 0 000002AA 51 push cx ; save user stack 542 0 000002AB 52 push dx ; SS:SP -> user stack 0 000002AC 51 push cx 0 000002AD 50 push ax ; was set on entry = 25,26 0 000002AE E8[0000] call _int2526_handler 0 000002B1 83C406 add sp, byte 6 548 0 000002B4 59 pop cx 0 000002B5 5A pop dx ; restore user stack 551 552 Restore386Registers 553 554 ; restore foreground stack here 0 000002B6 FA cli 0 000002B7 8ED2 mov ss, dx 0 000002B9 89CC mov sp, cx 558 0 000002BB 07 pop es 0 000002BC 1F pop ds 0 000002BD 5F pop di 0 000002BE 5E pop si 0 000002BF 5D pop bp 0 000002C0 5B pop bx ; pop off sp value 0 000002C1 5B pop bx 0 000002C2 5A pop dx 0 000002C3 59 pop cx 0 000002C4 58 pop ax 0 000002C5 9D popf 0 000002C6 CB retf ; Bug-compatiblity with MS-DOS. 571 ; This function is supposed to leave the original 572 ; flag image on the stack. 573 574 575 576 CONTINUE equ 00h 577 RETRY equ 01h 578 ABORT equ 02h 579 FAIL equ 03h 580 581 OK_IGNORE equ 20h 582 OK_RETRY equ 10h 583 OK_FAIL equ 08h 584 585 PSP_PARENT equ 16h 586 PSP_USERSP equ 2eh 587 PSP_USERSS equ 30h 588 589 590 591 ; 592 ; COUNT 593 ; CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError, struct dhdr FAR *lpDevice); 594 ; 595 global _CriticalError 596 _CriticalError: 597 ; 598 ; Skip critical error routine if handler is active 599 ; 0 000002C7 803E[0000]00 cmp byte [_ErrorMode],0 0 000002CC 7404 je CritErr05 ; Jump if equal 602 0 000002CE B80300 mov ax,FAIL 0 000002D1 C3 retn 605 ; 606 ; Do local error processing 607 ; 608 CritErr05: 609 ; 610 ; C Entry 611 ; 0 000002D2 55 push bp 0 000002D3 89E5 mov bp,sp 0 000002D5 56 push si 0 000002D6 57 push di 616 Protect386Registers 617 618 ; 619 ; Get parameters 620 ; 0 000002D7 8A6604 mov ah,byte [bp+4] ; nFlags 0 000002DA 8A4606 mov al,byte [bp+6] ; nDrive 0 000002DD 8B7E08 mov di,word [bp+8] ; nError 624 ; 625 ; make cx:si point to dev header 626 ; after registers restored use bp:si 627 ; 0 000002E0 8B760A mov si,word [bp+10] ; lpDevice Offset 0 000002E3 8B4E0C mov cx,word [bp+12] ; lpDevice segment 630 ; 631 ; Now save real ss:sp and retry info in internal stack 632 ; 0 000002E6 FA cli 0 000002E7 8E06[0000] mov es,[_cu_psp] 0 000002EB 26FF363000 push word [es:PSP_USERSS] 0 000002F0 26FF362E00 push word [es:PSP_USERSP] 0 000002F5 FF36[0000] push word [_MachineId] 0 000002F9 FF36[0000] push word [int21regs_seg] 0 000002FD FF36[0000] push word [int21regs_off] 0 00000301 FF36[0200] push word [_user_r+2] 0 00000305 FF36[0000] push word [_user_r] 0 00000309 8926[0000] mov [critical_sp],sp 643 ; 644 ; do some clean up because user may never return 645 ; 0 0000030D FE06[0000] inc byte [_ErrorMode] 0 00000311 FE0E[0000] dec byte [_InDOS] 648 ; 649 ; switch to user's stack 650 ; 0 00000315 268B2E2E00 mov bp,[es:PSP_USERSP] 0 0000031A 268E163000 mov ss,[es:PSP_USERSS] 653 RestoreSP 0 0000031F 89EC mov sp, bp 654 Restore386Registers 0 00000321 89CD mov bp,cx 656 ; 657 ; and call critical error handler 658 ; 0 00000323 CD24 int 24h ; DOS Critical error handler 660 661 ; 662 ; recover context 663 ; 0 00000325 FC cld 0 00000326 FA cli 666 Protect386Registers 667 ; ecm: The extended stack frame must be restored here 668 ; in case the response isn't Abort. The int 21h handler 669 ; will expect the extended stack frame to be still 670 ; intact, but the stack written by the int 24h (even 671 ; only the int instruction) will have overwritten it. 672 0 00000327 2E8B2E[0000] mov bp, [cs:_DGROUP_] 0 0000032C 8EDD mov ds,bp 0 0000032E 8ED5 mov ss,bp 0 00000330 8B26[0000] mov sp,[critical_sp] 0 00000334 8F06[0000] pop word [_user_r] 0 00000338 8F06[0200] pop word [_user_r+2] 0 0000033C 8F06[0000] pop word [int21regs_off] 0 00000340 8F06[0000] pop word [int21regs_seg] 0 00000344 8F06[0000] pop word [_MachineId] 0 00000348 8E06[0000] mov es,[_cu_psp] 0 0000034C 268F062E00 pop word [es:PSP_USERSP] 0 00000351 268F063000 pop word [es:PSP_USERSS] 0 00000356 89E5 mov bp, sp 0 00000358 8A6608 mov ah, byte [bp + 4 + 4 + Size386Registers] 687 ; restore old AH from nFlags 688 ; ecm: One 4 is the displacement of nFlags from the 689 ; usual bp, the other 4 accounts for the si and di 690 ; on the stack, the Size386Registers is added to 691 ; skip the fs and gs (OpenWatcom 386 build) or high 692 ; words that are a part of the stack frame, if any. 0 0000035B FB sti ; Enable interrupts 694 ; 695 ; clear flags 696 ; 0 0000035C C606[0000]00 mov byte [_ErrorMode],0 0 00000361 FE06[0000] inc byte [_InDOS] 699 ; 700 ; Check for ignore and force fail if not ok 0 00000365 3C00 cmp al,CONTINUE 0 00000367 7507 jne CritErr10 ; not ignore, keep testing 0 00000369 F6C420 test ah,OK_IGNORE 0 0000036C 7502 jnz CritErr10 0 0000036E B003 mov al,FAIL 706 ; 707 ; Check for retry and force fail if not ok 708 ; 709 CritErr10: 0 00000370 3C01 cmp al,RETRY 0 00000372 7507 jne CritErr20 ; not retry, keep testing 0 00000374 F6C410 test ah,OK_RETRY 0 00000377 7502 jnz CritErr20 0 00000379 B003 mov al,FAIL 715 ; 716 ; You know the drill, but now it's different. 717 ; check for fail and force abort if not ok 718 ; 719 CritErr20: 0 0000037B 3C03 cmp al,FAIL 0 0000037D 7507 jne CritErr30 ; not fail, do exit processing 0 0000037F F6C408 test ah,OK_FAIL 0 00000382 7502 jnz CritErr30 0 00000384 B002 mov al,ABORT 725 ; 726 ; OK, if it's abort we do extra processing. Otherwise just 727 ; exit. 728 ; 729 CritErr30: 0 00000386 3C02 cmp al,ABORT 0 00000388 7406 je CritErrAbort ; process abort 732 733 CritErrExit: 0 0000038A 30E4 xor ah,ah ; clear out top for return 735 736 Restore386Registers 0 0000038C 5F pop di 0 0000038D 5E pop si 0 0000038E 5D pop bp 0 0000038F C3 ret 741 742 ; 743 ; Abort processing. 744 ; 745 CritErrAbort: 0 00000390 F606[0000]FF test byte [_abort_progress], -1 0 00000395 B003 mov al, FAIL 0 00000397 75F1 jnz CritErrExit 749 %if 0 750 mov ax,[_cu_psp] 751 mov es,ax 752 cmp ax,[es:PSP_PARENT] 753 mov al,FAIL 754 jz CritErrExit 755 ; ecm: This check is done by (E)DR-DOS, but not MS-DOS. 756 ; Therefore, disable it and terminate the self-parented 757 ; process here like any other. 758 %endif 0 00000399 FA cli 0 0000039A A1[0200] mov ax,word [_user_r+2] ;Get frame 0 0000039D 8B2E[0000] mov bp,word [_user_r] 0 000003A1 8ED0 mov ss,ax 0 000003A3 89EC mov sp,bp 0 000003A5 C606[0000]01 mov byte [_ErrorMode],1 ; flag abort 0 000003AA B8004C mov ax,4C00h 0 000003AD 894600 mov [bp+reg_ax],ax 0 000003B0 FB sti 0 000003B1 C606[0000]02 mov byte [_term_type], 2 ; set int 24h abort error 0 000003B6 8CDA mov dx, ds 0 000003B8 E90DFE jmp int21_reentry ; restart the system call === Trace listing source: error.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=error.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccWZ12Wr.s output file : error.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: === Switch to base=012BB0h -> ".RODATA.STR1.1" 7 .section .rodata.str1.1,"aMS",@progbits,1 8 _.LC0: 0 00001902 0A50414E49433A20 .string "\nPANIC: " 0 0000190A 00 10 _.LC1: 0 0000190B 0A53797374656D20 .string "\nSystem halted" 0 00001913 68616C74656400 === Switch to base=002270h -> ".TEXT" 12 .text 13 .global _panic 14 .type _panic, @function 15 _panic: 16 _.LFB4: 17 .file 1 "error.c" 1:error.c **** /****************************************************************/ 2:error.c **** /* */ 3:error.c **** /* error.c */ 4:error.c **** /* */ 5:error.c **** /* Main Kernel Error Handler Functions */ 6:error.c **** /* */ 7:error.c **** /* Copyright (c) 1995 */ 8:error.c **** /* Pasquale J. Villani */ 9:error.c **** /* All Rights Reserved */ 10:error.c **** /* */ 11:error.c **** /* This file is part of DOS-C. */ 12:error.c **** /* */ 13:error.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:error.c **** /* modify it under the terms of the GNU General Public License */ 15:error.c **** /* as published by the Free Software Foundation; either version */ 16:error.c **** /* 2, or (at your option) any later version. */ 17:error.c **** /* */ 18:error.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:error.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:error.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:error.c **** /* the GNU General Public License for more details. */ 22:error.c **** /* */ 23:error.c **** /* You should have received a copy of the GNU General Public */ 24:error.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:error.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:error.c **** /* Cambridge, MA 02139, USA. */ 27:error.c **** /****************************************************************/ 28:error.c **** 29:error.c **** #include "portab.h" 30:error.c **** #include "globals.h" 31:error.c **** #include "debug.h" 32:error.c **** 33:error.c **** 34:error.c **** #ifdef DEBUG 35:error.c **** /* error registers */ 36:error.c **** VOID dump(void) 37:error.c **** { 38:error.c **** DebugPrintf(("Register Dump [AH = %02x CS:IP = %04x:%04x FLAGS = %04x]\n", 39:error.c **** error_regs.AH, error_regs.CS, error_regs.IP, error_regs.FLAGS)); 40:error.c **** DebugPrintf(("AX:%04x BX:%04x CX:%04x DX:%04x\n", 41:error.c **** error_regs.AX, error_regs.BX, error_regs.CX, error_regs.DX)); 42:error.c **** DebugPrintf(("SI:%04x DI:%04x DS:%04x ES:%04x\n", 43:error.c **** error_regs.SI, error_regs.DI, error_regs.DS, error_regs.ES)); 44:error.c **** } 45:error.c **** #endif 46:error.c **** 47:error.c **** /* issue a panic message for corrupted data structures */ 48:error.c **** VOID panic(BYTE * s) 49:error.c **** { 18 .loc 1 49 0 19 _.LVL0: 0 00002DF3 55 push bp 21 _.LCFI0: 0 00002DF4 89E5 mov bp, sp 23 _.LCFI1: 50:error.c **** put_string("\nPANIC: "); 24 .loc 1 50 0 0 00002DF6 B8[0000] mov ax, offset _.LC0 0 00002DF9 50 push ax 0 00002DFA E8[FEFF] call _put_string 28 _.LVL1: 51:error.c **** put_string(s); 29 .loc 1 51 0 0 00002DFD FF7604 push word ptr [bp+4] 0 00002E00 E8[FEFF] call _put_string 32 _.LVL2: 52:error.c **** put_string("\nSystem halted"); 33 .loc 1 52 0 0 00002E03 B8[0900] mov ax, offset _.LC1 0 00002E06 50 push ax 0 00002E07 E8[FEFF] call _put_string 37 _.LVL3: 38 _.L2: 0 00002E0A EBFE jmp _.L2 40 _.LFE4: 41 .size _panic, .-_panic 42 .global _char_error 43 .type _char_error, @function 44 _char_error: 45 _.LFB5: 53:error.c **** for (;;) ; 54:error.c **** } 55:error.c **** 56:error.c **** #ifdef IPL 57:error.c **** /* issue an internal error message */ 58:error.c **** VOID fatal(BYTE * err_msg) 59:error.c **** { 60:error.c **** printf("\nInternal IPL error - %s\nSystem halted\n", err_msg); 61:error.c **** exit(-1); 62:error.c **** } 63:error.c **** #else 64:error.c **** /* issue an internal error message */ 65:error.c **** #if 0 66:error.c **** VOID fatal(BYTE * err_msg) 67:error.c **** { 68:error.c **** printf("\nInternal kernel error - \n"); 69:error.c **** panic(err_msg); 70:error.c **** } 71:error.c **** #endif 72:error.c **** #endif 73:error.c **** 74:error.c **** /* Abort, retry or fail for character devices */ 75:error.c **** COUNT char_error(request * rq, struct dhdr FAR * lpDevice) 76:error.c **** { 46 .loc 1 76 0 47 _.LVL4: 0 00002E0C 55 push bp 49 _.LCFI2: 0 00002E0D 89E5 mov bp, sp 51 _.LCFI3: 77:error.c **** CritErrCode = (rq->r_status & S_MASK) + 0x13; 52 .loc 1 77 0 0 00002E0F 8B5E04 mov bx, word ptr [bp+4] 0 00002E12 8A4703 mov al, byte ptr [bx+3] 0 00002E15 30E4 xor ah, ah 0 00002E17 89C2 mov dx, ax 0 00002E19 83C213 add dx, 19 0 00002E1C 8916[0000] mov word ptr [_CritErrCode], dx 78:error.c **** return CriticalError(EFLG_CHAR | EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE, 59 .loc 1 78 0 0 00002E20 FF7608 push word ptr [bp+8] 0 00002E23 FF7606 push word ptr [bp+6] 0 00002E26 50 push ax 0 00002E27 31C0 xor ax, ax 0 00002E29 50 push ax 0 00002E2A B8B800 mov ax, 184 0 00002E2D 50 push ax 0 00002E2E E8[FEFF] call _CriticalError 68 _.LVL5: 79:error.c **** 0, rq->r_status & S_MASK, lpDevice); 80:error.c **** } 69 .loc 1 80 0 0 00002E31 89EC mov sp, bp 0 00002E33 5D pop bp 0 00002E34 C20600 ret 6 73 _.LFE5: 74 .size _char_error, .-_char_error 75 .global _block_error 76 .type _block_error, @function 77 _block_error: 78 _.LFB6: 81:error.c **** 82:error.c **** /* Abort, retry or fail for block devices */ 83:error.c **** COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice, 84:error.c **** int mode) 85:error.c **** { 79 .loc 1 85 0 80 _.LVL6: 0 00002E37 55 push bp 82 _.LCFI4: 0 00002E38 89E5 mov bp, sp 84 _.LCFI5: 0 00002E3A C54E08 lds cx, dword ptr [bp+8] 86:error.c **** CritErrCode = (rq->r_status & S_MASK) + 0x13; 86 .loc 1 86 0 0 00002E3D 8B5E04 mov bx, word ptr [bp+4] 0 00002E40 368A4703 mov al, byte ptr ss:[bx+3] 0 00002E44 30E4 xor ah, ah 0 00002E46 89C2 mov dx, ax 0 00002E48 83C213 add dx, 19 0 00002E4B 368916[0000] mov word ptr ss:[_CritErrCode], dx 87:error.c **** return CriticalError(EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE | 93 .loc 1 87 0 0 00002E50 837E0C01 cmp word ptr [bp+12], 1 0 00002E54 7415 je _.L8 0 00002E56 BA3800 mov dx, 56 97 _.L7: 98 .loc 1 87 0 is_stmt 0 discriminator 4 0 00002E59 1E push ds 0 00002E5A 51 push cx 0 00002E5B 50 push ax 0 00002E5C FF7606 push word ptr [bp+6] 0 00002E5F 52 push dx 0 00002E60 16 push ss 0 00002E61 1F pop ds 0 00002E62 E8[FEFF] call _CriticalError 107 _.LVL7: 88:error.c **** (mode == DSKWRITE ? EFLG_WRITE : 0), 89:error.c **** nDrive, rq->r_status & S_MASK, lpDevice); 90:error.c **** } 108 .loc 1 90 0 is_stmt 1 discriminator 4 0 00002E65 89EC mov sp, bp 0 00002E67 5D pop bp 0 00002E68 C20A00 ret 10 112 _.LVL8: 113 _.L8: 87:error.c **** return CriticalError(EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE | 114 .loc 1 87 0 0 00002E6B BA3900 mov dx, 57 0 00002E6E EBE9 jmp _.L7 117 _.LFE6: 118 .size _block_error, .-_block_error === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: execrh.lst 1 ; 2 ; File: 3 ; execrh.asm 4 ; Description: 5 ; request handler for calling device drivers 6 ; 7 ; Copyright (c) 1995, 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Id: execrh.asm 1184 2006-05-20 20:49:59Z mceric $ 29 ; 30 31 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 32 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 33 === Switch to base=002270h -> "HMA_TEXT" 34 segment HMA_TEXT 35 ; EXECRH 36 ; Execute Device Request 37 ; 38 ; execrh(rhp, dhp) 39 ; request far *rhp; 40 ; struct dhdr far *dhp; 41 ; 42 ; 43 ; The stack is very critical in here. 44 ; 45 global EXECRH 46 global INIT_EXECRH 47 48 %macro EXECRHM 0 49 push bp ; perform c entry 50 mov bp,sp 51 push si 52 push ds ; sp=bp-8 53 54 arg {rhp,4}, {dhp,4} 55 lds si,[.dhp] ; ds:si = device header 56 les bx,[.rhp] ; es:bx = request header 57 58 59 mov ax, [si+6] ; construct strategy address 60 mov [.dhp], ax 61 62 push si ; the bloody fucking RTSND.DOS 63 push di ; driver destroys SI,DI (tom 14.2.03) 64 65 call far[.dhp] ; call far the strategy 66 67 pop di 68 pop si 69 70 ; Protect386Registers ; old free-EMM386 versions destroy regs in their INIT method 71 72 mov ax,[si+8] ; construct 'interrupt' address 73 mov [.dhp],ax ; construct interrupt address 74 call far[.dhp] ; call far the interrupt 75 76 ; Restore386Registers ; less stack load and better performance... 77 78 sti ; damm driver turn off ints 79 cld ; has gone backwards 80 pop ds 81 pop si 82 pop bp 83 ret 8 84 %endmacro 85 86 EXECRH: 87 EXECRHM 0 000004DC 55 push bp 0 000004DD 89E5 mov bp,sp 0 000004DF 56 push si 0 000004E0 1E push ds 53 <1> 54 <1> arg {rhp,4}, {dhp,4} 229 <2> %assign .argloc 4 230 <2> %rep %0 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 238 <2> %endrep 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 0 000004E1 C57608 lds si,[.dhp] 0 000004E4 C45E04 les bx,[.rhp] 57 <1> 58 <1> 0 000004E7 8B4406 mov ax, [si+6] 0 000004EA 894608 mov [.dhp], ax 61 <1> 0 000004ED 56 push si 0 000004EE 57 push di 64 <1> 0 000004EF FF5E08 call far[.dhp] 66 <1> 0 000004F2 5F pop di 0 000004F3 5E pop si 69 <1> 70 <1> 71 <1> 0 000004F4 8B4408 mov ax,[si+8] 0 000004F7 894608 mov [.dhp],ax 0 000004FA FF5E08 call far[.dhp] 75 <1> 76 <1> 77 <1> 0 000004FD FB sti 0 000004FE FC cld 0 000004FF 1F pop ds 0 00000500 5E pop si 0 00000501 5D pop bp 0 00000502 C20800 ret 8 88 89 %ifndef WATCOM 90 === Switch to base=00E150h -> "INIT_TEXT" 91 segment INIT_TEXT 92 93 INIT_EXECRH: 94 EXECRHM 0 00000176 55 push bp 0 00000177 89E5 mov bp,sp 0 00000179 56 push si 0 0000017A 1E push ds 53 <1> 54 <1> arg {rhp,4}, {dhp,4} 229 <2> %assign .argloc 4 230 <2> %rep %0 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 238 <2> %endrep 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 0 0000017B C57608 lds si,[.dhp] 0 0000017E C45E04 les bx,[.rhp] 57 <1> 58 <1> 0 00000181 8B4406 mov ax, [si+6] 0 00000184 894608 mov [.dhp], ax 61 <1> 0 00000187 56 push si 0 00000188 57 push di 64 <1> 0 00000189 FF5E08 call far[.dhp] 66 <1> 0 0000018C 5F pop di 0 0000018D 5E pop si 69 <1> 70 <1> 71 <1> 0 0000018E 8B4408 mov ax,[si+8] 0 00000191 894608 mov [.dhp],ax 0 00000194 FF5E08 call far[.dhp] 75 <1> 76 <1> 77 <1> 0 00000197 FB sti 0 00000198 FC cld 0 00000199 1F pop ds 0 0000019A 5E pop si 0 0000019B 5D pop bp 0 0000019C C20800 ret 8 95 96 %endif === Trace listing source: fatdir.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=fatdir.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc2tr37y.s output file : fatdir.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _swap_deleted, @function 8 _swap_deleted: 9 _.LFB6: 10 .file 1 "fatdir.c" 1:fatdir.c **** /****************************************************************/ 2:fatdir.c **** /* */ 3:fatdir.c **** /* fatdir.c */ 4:fatdir.c **** /* DOS-C */ 5:fatdir.c **** /* */ 6:fatdir.c **** /* FAT File System dir Functions */ 7:fatdir.c **** /* */ 8:fatdir.c **** /* Copyright (c) 1995 */ 9:fatdir.c **** /* Pasquale J. Villani */ 10:fatdir.c **** /* All Rights Reserved */ 11:fatdir.c **** /* */ 12:fatdir.c **** /* This file is part of DOS-C. */ 13:fatdir.c **** /* */ 14:fatdir.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:fatdir.c **** /* modify it under the terms of the GNU General Public License */ 16:fatdir.c **** /* as published by the Free Software Foundation; either version */ 17:fatdir.c **** /* 2, or (at your option) any later version. */ 18:fatdir.c **** /* */ 19:fatdir.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:fatdir.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:fatdir.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:fatdir.c **** /* the GNU General Public License for more details. */ 23:fatdir.c **** /* */ 24:fatdir.c **** /* You should have received a copy of the GNU General Public */ 25:fatdir.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:fatdir.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:fatdir.c **** /* Cambridge, MA 02139, USA. */ 28:fatdir.c **** /****************************************************************/ 29:fatdir.c **** 30:fatdir.c **** #include "portab.h" 31:fatdir.c **** #include "globals.h" 32:fatdir.c **** 33:fatdir.c **** #ifdef VERSION_STRINGS 34:fatdir.c **** static BYTE *fatdirRcsId = 35:fatdir.c **** "$Id: fatdir.c 1561 2011-04-08 15:35:23Z bartoldeman $"; 36:fatdir.c **** #endif 37:fatdir.c **** 38:fatdir.c **** /* Description. 39:fatdir.c **** * Initialize a fnode so that it will point to the directory with 40:fatdir.c **** * dirstart starting cluster; in case of passing dirstart == 0 41:fatdir.c **** * fnode will point to the start of a root directory */ 42:fatdir.c **** VOID dir_init_fnode(f_node_ptr fnp, CLUSTER dirstart) 43:fatdir.c **** { 44:fatdir.c **** /* reset the directory flags */ 45:fatdir.c **** fnp->f_sft_idx = 0xff; 46:fatdir.c **** fnp->f_dmp = &sda_tmp_dm; 47:fatdir.c **** if (fnp == &fnode[1]) 48:fatdir.c **** fnp->f_dmp = &sda_tmp_dm_ren; 49:fatdir.c **** fnp->f_offset = 0l; 50:fatdir.c **** fnp->f_cluster_offset = 0; 51:fatdir.c **** 52:fatdir.c **** /* root directory */ 53:fatdir.c **** #ifdef WITHFAT32 54:fatdir.c **** if (dirstart == 0) 55:fatdir.c **** if (ISFAT32(fnp->f_dpb)) 56:fatdir.c **** dirstart = fnp->f_dpb->dpb_xrootclst; 57:fatdir.c **** #endif 58:fatdir.c **** fnp->f_cluster = fnp->f_dmp->dm_dircluster = dirstart; 59:fatdir.c **** } 60:fatdir.c **** 61:fatdir.c **** f_node_ptr dir_open(register const char *dirname, BOOL split, f_node_ptr fnp) 62:fatdir.c **** { 63:fatdir.c **** int i; 64:fatdir.c **** char *fcbname; 65:fatdir.c **** 66:fatdir.c **** /* determine what drive and dpb we are using... */ 67:fatdir.c **** fnp->f_dpb = get_dpb(dirname[0]-'A'); 68:fatdir.c **** /* Perform all directory common handling after all special */ 69:fatdir.c **** /* handling has been performed. */ 70:fatdir.c **** 71:fatdir.c **** /* truename() already did a media check() */ 72:fatdir.c **** 73:fatdir.c **** /* Walk the directory tree to find the starting cluster */ 74:fatdir.c **** /* */ 75:fatdir.c **** /* Start from the root directory (dirstart = 0) */ 76:fatdir.c **** 77:fatdir.c **** /* The CDS's cdsStartCls may be used to shorten the search 78:fatdir.c **** beginning at the CWD, see mapPath() and CDS.H in order 79:fatdir.c **** to enable this behaviour there. 80:fatdir.c **** -- 2001/09/04 ska*/ 81:fatdir.c **** 82:fatdir.c **** dir_init_fnode(fnp, 0); 83:fatdir.c **** fnp->f_dmp->dm_entry = 0; 84:fatdir.c **** 85:fatdir.c **** dirname += 2; /* Assume FAT style drive */ 86:fatdir.c **** fcbname = fnp->f_dmp->dm_name_pat; 87:fatdir.c **** while(*dirname != '\0') 88:fatdir.c **** { 89:fatdir.c **** /* skip the path seperator */ 90:fatdir.c **** ++dirname; 91:fatdir.c **** 92:fatdir.c **** /* don't continue if we're at the end: this check is */ 93:fatdir.c **** /* for root directories, the only fully-qualified path */ 94:fatdir.c **** /* names that end in a \ */ 95:fatdir.c **** if (*dirname == '\0') 96:fatdir.c **** break; 97:fatdir.c **** 98:fatdir.c **** /* Convert the name into an absolute name for */ 99:fatdir.c **** /* comparison... */ 100:fatdir.c **** 101:fatdir.c **** dirname = ConvertNameSZToName83(fcbname, dirname); 102:fatdir.c **** 103:fatdir.c **** /* do not continue if we split the filename off and are */ 104:fatdir.c **** /* at the end */ 105:fatdir.c **** if (split && *dirname == '\0') 106:fatdir.c **** break; 107:fatdir.c **** 108:fatdir.c **** /* Now search through the directory to */ 109:fatdir.c **** /* find the entry... */ 110:fatdir.c **** i = FALSE; 111:fatdir.c **** 112:fatdir.c **** while (dir_read(fnp) == 1) 113:fatdir.c **** { 114:fatdir.c **** if (!(fnp->f_dir.dir_attrib & D_VOLID) && 115:fatdir.c **** fcbmatch(fcbname, fnp->f_dir.dir_name)) 116:fatdir.c **** { 117:fatdir.c **** i = TRUE; 118:fatdir.c **** break; 119:fatdir.c **** } 120:fatdir.c **** fnp->f_dmp->dm_entry++; 121:fatdir.c **** } 122:fatdir.c **** 123:fatdir.c **** if (!i || !(fnp->f_dir.dir_attrib & D_DIR)) 124:fatdir.c **** { 125:fatdir.c **** return (f_node_ptr) 0; 126:fatdir.c **** } 127:fatdir.c **** else 128:fatdir.c **** { 129:fatdir.c **** /* make certain we've moved off */ 130:fatdir.c **** /* root */ 131:fatdir.c **** dir_init_fnode(fnp, getdstart(fnp->f_dpb, &fnp->f_dir)); 132:fatdir.c **** fnp->f_dmp->dm_entry = 0; 133:fatdir.c **** } 134:fatdir.c **** } 135:fatdir.c **** return fnp; 136:fatdir.c **** } 137:fatdir.c **** 138:fatdir.c **** /* swap internal and external delete flags */ 139:fatdir.c **** STATIC void swap_deleted(char *name) 140:fatdir.c **** { 11 .loc 1 140 0 12 _.LVL0: 0 00004664 89E3 mov bx, sp 14 _.LCFI0: 0 00004666 8B5F02 mov bx, word ptr [bx+2] 141:fatdir.c **** if (name[0] == DELETED || name[0] == EXT_DELETED) 16 .loc 1 141 0 0 00004669 8A07 mov al, byte ptr [bx] 0 0000466B 88C4 mov ah, al 0 0000466D 80C41B add ah, 27 0 00004670 F6C4DF test ah, -33 0 00004673 7504 jne _.L1 142:fatdir.c **** name[0] ^= EXT_DELETED - DELETED; /* 0xe0 */ 22 .loc 1 142 0 0 00004675 34E0 xor al, -32 0 00004677 8807 mov byte ptr [bx], al 25 _.L1: 143:fatdir.c **** } 26 .loc 1 143 0 0 00004679 C20200 ret 2 28 _.LFE6: 29 .size _swap_deleted, .-_swap_deleted 30 .global _dir_init_fnode 31 .type _dir_init_fnode, @function 32 _dir_init_fnode: 33 _.LFB4: 43:fatdir.c **** /* reset the directory flags */ 34 .loc 1 43 0 35 _.LVL1: 0 0000467C 56 push si 0 0000467D 55 push bp 38 _.LCFI1: 0 0000467E 89E5 mov bp, sp 40 _.LCFI2: 0 00004680 8B5E06 mov bx, word ptr [bp+6] 0 00004683 8B5608 mov dx, word ptr [bp+8] 0 00004686 8B460A mov ax, word ptr [bp+10] 45:fatdir.c **** fnp->f_dmp = &sda_tmp_dm; 44 .loc 1 45 0 0 00004689 C64739FF mov byte ptr [bx+57], -1 46:fatdir.c **** if (fnp == &fnode[1]) 46 .loc 1 46 0 0 0000468D C74702[0000] mov word ptr [bx+2], offset _sda_tmp_dm 47:fatdir.c **** fnp->f_dmp = &sda_tmp_dm_ren; 48 .loc 1 47 0 0 00004692 81FB[3A00] cmp bx, offset _fnode+58 0 00004696 7506 jne _.L5 48:fatdir.c **** fnp->f_offset = 0l; 51 .loc 1 48 0 0 00004698 C706[3C000000] mov word ptr [_fnode+60], offset _sda_tmp_dm_ren 53 _.L5: 49:fatdir.c **** fnp->f_cluster_offset = 0; 54 .loc 1 49 0 0 0000469E C7472D0000 mov word ptr [bx+45], 0 0 000046A3 C7472F0000 mov word ptr [bx+47], 0 50:fatdir.c **** 57 .loc 1 50 0 0 000046A8 C747310000 mov word ptr [bx+49], 0 0 000046AD C747330000 mov word ptr [bx+51], 0 54:fatdir.c **** if (ISFAT32(fnp->f_dpb)) 60 .loc 1 54 0 0 000046B2 89D1 mov cx, dx 0 000046B4 09C1 or cx, ax 0 000046B6 7512 jne _.L6 55:fatdir.c **** dirstart = fnp->f_dpb->dpb_xrootclst; 64 .loc 1 55 0 0 000046B8 C47729 les si, dword ptr [bx+41] 0 000046BB 26837C0F00 cmp word ptr es:[si+15], 0 0 000046C0 7508 jne _.L6 56:fatdir.c **** #endif 68 .loc 1 56 0 0 000046C2 268B5435 mov dx, word ptr es:[si+53] 0 000046C6 268B4437 mov ax, word ptr es:[si+55] 71 _.LVL2: 72 _.L6: 58:fatdir.c **** } 73 .loc 1 58 0 0 000046CA 8B7702 mov si, word ptr [bx+2] 0 000046CD 89540F mov word ptr [si+15], dx 0 000046D0 894411 mov word ptr [si+17], ax 0 000046D3 895735 mov word ptr [bx+53], dx 0 000046D6 894737 mov word ptr [bx+55], ax 59:fatdir.c **** 79 .loc 1 59 0 0 000046D9 5D pop bp 0 000046DA 5E pop si 0 000046DB C20600 ret 6 83 _.LFE4: 84 .size _dir_init_fnode, .-_dir_init_fnode 85 .global _dir_read 86 .type _dir_read, @function 87 _dir_read: 88 _.LFB7: 144:fatdir.c **** 145:fatdir.c **** /* Description. 146:fatdir.c **** * Read next consequitive directory entry, pointed by fnp. 147:fatdir.c **** * If some error occures the other critical 148:fatdir.c **** * fields aren't changed, except those used for caching. 149:fatdir.c **** * The fnp->f_dmp->dm_entry always corresponds to the directory entry 150:fatdir.c **** * which has been read. 151:fatdir.c **** * Return value. 152:fatdir.c **** * 1 - all OK, directory entry having been read is not empty. 153:fatdir.c **** * 0 - Directory entry is empty. 154:fatdir.c **** * DE_SEEK - Attempt to read beyound the end of the directory. 155:fatdir.c **** * DE_BLKINVLD - Invalid block. 156:fatdir.c **** * Note. Empty directory entries always resides at the end of the directory. */ 157:fatdir.c **** COUNT dir_read(REG f_node_ptr fnp) 158:fatdir.c **** { 89 .loc 1 158 0 90 _.LVL3: 0 000046DE 56 push si 0 000046DF 57 push di 0 000046E0 55 push bp 94 _.LCFI3: 0 000046E1 89E5 mov bp, sp 96 _.LCFI4: 0 000046E3 83EC08 sub sp, 8 0 000046E6 8B7608 mov si, word ptr [bp+8] 159:fatdir.c **** struct buffer FAR *bp; 160:fatdir.c **** REG UWORD secsize = fnp->f_dpb->dpb_secsize; 99 .loc 1 160 0 0 000046E9 36C55C29 lds bx, dword ptr ss:[si+41] 0 000046ED 8B4702 mov ax, word ptr [bx+2] 0 000046F0 8946FA mov word ptr [bp-6], ax 103 _.LVL4: 161:fatdir.c **** unsigned sector; 162:fatdir.c **** unsigned entry = fnp->f_dmp->dm_entry; 104 .loc 1 162 0 0 000046F3 368B7C02 mov di, word ptr ss:[si+2] 0 000046F7 368B450D mov ax, word ptr ss:[di+13] 107 _.LVL5: 0 000046FB 8946FE mov word ptr [bp-2], ax 109 _.LVL6: 163:fatdir.c **** 164:fatdir.c **** /* can't have more than 65535 directory entries */ 165:fatdir.c **** if (entry >= 65535U) 110 .loc 1 165 0 0 000046FE 83F8FF cmp ax, -1 0 00004701 750D jne _.L9 113 _.LVL7: 114 _.L12: 166:fatdir.c **** return DE_SEEK; 115 .loc 1 166 0 0 00004703 B8E7FF mov ax, -25 117 _.LVL8: 118 _.L8: 167:fatdir.c **** 168:fatdir.c **** /* Determine if we hit the end of the directory. If we have, */ 169:fatdir.c **** /* bump the offset back to the end and exit. If not, fill the */ 170:fatdir.c **** /* dirent portion of the fnode, set the SFT_FCLEAN bit and leave,*/ 171:fatdir.c **** /* but only for root directories */ 172:fatdir.c **** 173:fatdir.c **** if (fnp->f_dmp->dm_dircluster == 0) 174:fatdir.c **** { 175:fatdir.c **** if (entry >= fnp->f_dpb->dpb_dirents) 176:fatdir.c **** return DE_SEEK; 177:fatdir.c **** 178:fatdir.c **** fnp->f_dirsector = entry / (secsize / DIRENT_SIZE) + 179:fatdir.c **** fnp->f_dpb->dpb_dirstrt; 180:fatdir.c **** } 181:fatdir.c **** else 182:fatdir.c **** { 183:fatdir.c **** /* Do a "seek" to the directory position */ 184:fatdir.c **** fnp->f_offset = entry * (ULONG)DIRENT_SIZE; 185:fatdir.c **** 186:fatdir.c **** /* Search through the FAT to find the block */ 187:fatdir.c **** /* that this entry is in. */ 188:fatdir.c **** if (map_cluster(fnp, XFR_READ) != SUCCESS) 189:fatdir.c **** return DE_SEEK; 190:fatdir.c **** 191:fatdir.c **** /* Compute the block within the cluster and the */ 192:fatdir.c **** /* offset within the block. */ 193:fatdir.c **** sector = (UBYTE)(fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask; 194:fatdir.c **** 195:fatdir.c **** fnp->f_dirsector = clus2phys(fnp->f_cluster, fnp->f_dpb) + sector; 196:fatdir.c **** /* Get the block we need from cache */ 197:fatdir.c **** } 198:fatdir.c **** 199:fatdir.c **** bp = getblock(fnp->f_dirsector, fnp->f_dpb->dpb_unit); 200:fatdir.c **** 201:fatdir.c **** #ifdef DISPLAY_GETBLOCK 202:fatdir.c **** printf("DIR (dir_read)\n"); 203:fatdir.c **** #endif 204:fatdir.c **** 205:fatdir.c **** /* Now that we have the block for our entry, get the */ 206:fatdir.c **** /* directory entry. */ 207:fatdir.c **** if (bp == NULL) 208:fatdir.c **** return DE_BLKINVLD; 209:fatdir.c **** 210:fatdir.c **** bp->b_flag &= ~(BFR_DATA | BFR_FAT); 211:fatdir.c **** bp->b_flag |= BFR_DIR | BFR_VALID; 212:fatdir.c **** 213:fatdir.c **** fnp->f_diridx = entry % (secsize / DIRENT_SIZE); 214:fatdir.c **** getdirent(&bp->b_buffer[fnp->f_diridx * DIRENT_SIZE], &fnp->f_dir); 215:fatdir.c **** 216:fatdir.c **** swap_deleted(fnp->f_dir.dir_name); 217:fatdir.c **** 218:fatdir.c **** /* and for efficiency, stop when we hit the first */ 219:fatdir.c **** /* unused entry. */ 220:fatdir.c **** /* either returns 1 or 0 */ 221:fatdir.c **** return (fnp->f_dir.dir_name[0] != '\0'); 222:fatdir.c **** } 119 .loc 1 222 0 0 00004706 89EC mov sp, bp 0 00004708 5D pop bp 0 00004709 5F pop di 0 0000470A 5E pop si 0 0000470B 16 push ss 0 0000470C 1F pop ds 0 0000470D C20200 ret 2 127 _.LVL9: 128 _.L9: 173:fatdir.c **** { 129 .loc 1 173 0 0 00004710 368B4511 mov ax, word ptr ss:[di+17] 131 _.LVL10: 0 00004714 360B450F or ax, word ptr ss:[di+15] 0 00004718 97 xchg di, ax 134 _.LVL11: 175:fatdir.c **** return DE_SEEK; 135 .loc 1 175 0 0 00004719 8B46FE mov ax, word ptr [bp-2] 173:fatdir.c **** { 137 .loc 1 173 0 0 0000471C 7403E99800 jne _.L11 175:fatdir.c **** return DE_SEEK; 139 .loc 1 175 0 0 00004721 3B4709 cmp ax, word ptr [bx+9] 0 00004724 73DD jnc _.L12 178:fatdir.c **** fnp->f_dpb->dpb_dirstrt; 142 .loc 1 178 0 0 00004726 8B46FA mov ax, word ptr [bp-6] 0 00004729 B105 mov cl, 5 0 0000472B D3E8 shr ax, cl 0 0000472D 91 xchg cx, ax 0 0000472E 8B46FE mov ax, word ptr [bp-2] 0 00004731 31D2 xor dx, dx 0 00004733 F7F1 div cx 0 00004735 034711 add ax, word ptr [bx+17] 0 00004738 36894424 mov word ptr ss:[si+36], ax 152 _.LVL12: 0 0000473C 36897C26 mov word ptr ss:[si+38], di 154 _.L13: 199:fatdir.c **** 155 .loc 1 199 0 0 00004740 31C0 xor ax, ax 0 00004742 50 push ax 0 00004743 36C45C29 les bx, dword ptr ss:[si+41] 0 00004747 268A07 mov al, byte ptr es:[bx] 0 0000474A 98 cbw 0 0000474B 50 push ax 0 0000474C 36FF7426 push word ptr ss:[si+38] 0 00004750 36FF7424 push word ptr ss:[si+36] 0 00004754 16 push ss 0 00004755 1F pop ds 0 00004756 E8[FEFF] call _getblk 167 _.LVL13: 0 00004759 93 xchg bx, ax 0 0000475A 8956FC mov word ptr [bp-4], dx 170 _.LVL14: 207:fatdir.c **** return DE_BLKINVLD; 171 .loc 1 207 0 0 0000475D 89D0 mov ax, dx 173 _.LVL15: 0 0000475F 09D8 or ax, bx 0 00004761 7503E9C900 je _.L15 210:fatdir.c **** bp->b_flag |= BFR_DIR | BFR_VALID; 176 .loc 1 210 0 0 00004766 8EC2 mov es, dx 0 00004768 268A4705 mov al, byte ptr es:[bx+5] 0 0000476C 8846F8 mov byte ptr [bp-8], al 0 0000476F 24F5 and al, -11 211:fatdir.c **** 181 .loc 1 211 0 0 00004771 0C24 or al, 36 0 00004773 26884705 mov byte ptr es:[bx+5], al 184 _.LVL16: 213:fatdir.c **** getdirent(&bp->b_buffer[fnp->f_diridx * DIRENT_SIZE], &fnp->f_dir); 185 .loc 1 213 0 0 00004777 B105 mov cl, 5 0 00004779 8B7EFA mov di, word ptr [bp-6] 0 0000477C D3EF shr di, cl 0 0000477E 8B46FE mov ax, word ptr [bp-2] 0 00004781 31D2 xor dx, dx 0 00004783 F7F7 div di 192 _.LVL17: 0 00004785 885428 mov byte ptr [si+40], dl 214:fatdir.c **** 194 .loc 1 214 0 0 00004788 89F0 mov ax, si 0 0000478A 83C004 add ax, 4 0 0000478D 8946FE mov word ptr [bp-2], ax 0 00004790 B82000 mov ax, 32 0 00004793 50 push ax 0 00004794 30F6 xor dh, dh 0 00004796 89D7 mov di, dx 0 00004798 D3E7 shl di, cl 0 0000479A 8D5914 lea bx, [20+bx+di] 204 _.LVL18: 0 0000479D FF76FC push word ptr [bp-4] 0 000047A0 53 push bx 0 000047A1 16 push ss 0 000047A2 FF76FE push word ptr [bp-2] 0 000047A5 E8[FEFF] call _fmemcpy 210 _.LVL19: 216:fatdir.c **** 211 .loc 1 216 0 0 000047A8 FF76FE push word ptr [bp-2] 0 000047AB E8B6FE call _swap_deleted 214 _.LVL20: 221:fatdir.c **** } 215 .loc 1 221 0 0 000047AE 36807C0401 cmp byte ptr ss:[si+4], 1 0 000047B3 19C0 sbb ax, ax 0 000047B5 40 inc ax 0 000047B6 E94DFF jmp _.L8 220 _.LVL21: 221 _.L11: 184:fatdir.c **** 222 .loc 1 184 0 0 000047B9 B10B mov cl, 11 0 000047BB D3E8 shr ax, cl 0 000047BD 8B56FE mov dx, word ptr [bp-2] 0 000047C0 B105 mov cl, 5 0 000047C2 D3E2 shl dx, cl 0 000047C4 3689542D mov word ptr ss:[si+45], dx 229 _.LVL22: 0 000047C8 3689442F mov word ptr ss:[si+47], ax 188:fatdir.c **** return DE_SEEK; 231 .loc 1 188 0 0 000047CC B80100 mov ax, 1 0 000047CF 50 push ax 0 000047D0 56 push si 0 000047D1 16 push ss 0 000047D2 1F pop ds 0 000047D3 E8[FEFF] call _map_cluster 238 _.LVL23: 0 000047D6 89C7 mov di, ax 0 000047D8 85C0 test ax, ax 0 000047DA 7403E924FF jne _.L12 193:fatdir.c **** 242 .loc 1 193 0 0 000047DF 36C45C29 les bx, dword ptr ss:[si+41] 0 000047E3 895EF8 mov word ptr [bp-8], bx 0 000047E6 8C46FC mov word ptr [bp-4], es 0 000047E9 50 push ax 0 000047EA FF76FA push word ptr [bp-6] 0 000047ED 36FF742F push word ptr ss:[si+47] 0 000047F1 36FF742D push word ptr ss:[si+45] 0 000047F5 E8[FEFF] call ___udivsi3 251 _.LVL24: 0 000047F8 8E46FC mov es, word ptr [bp-4] 0 000047FB 8B5EF8 mov bx, word ptr [bp-8] 0 000047FE 26224704 and al, byte ptr es:[bx+4] 0 00004802 8846F8 mov byte ptr [bp-8], al 256 _.LVL25: 195:fatdir.c **** /* Get the block we need from cache */ 257 .loc 1 195 0 0 00004805 06 push es 0 00004806 53 push bx 0 00004807 36FF7437 push word ptr ss:[si+55] 0 0000480B 36FF7435 push word ptr ss:[si+53] 0 0000480F E8[FEFF] call _clus2phys 263 _.LVL26: 0 00004812 91 xchg cx, ax 0 00004813 89D3 mov bx, dx 0 00004815 8A46F8 mov al, byte ptr [bp-8] 0 00004818 8846FC mov byte ptr [bp-4], al 0 0000481B 8A46FC mov al, byte ptr [bp-4] 0 0000481E 30E4 xor ah, ah 0 00004820 89FA mov dx, di 0 00004822 01C1 add cx, ax 0 00004824 11DA adc dx, bx 0 00004826 894C24 mov word ptr [si+36], cx 0 00004829 895426 mov word ptr [si+38], dx 0 0000482C E911FF jmp _.L13 276 _.LVL27: 277 _.L15: 208:fatdir.c **** 278 .loc 1 208 0 0 0000482F B8ECFF mov ax, -20 0 00004832 E9D1FE jmp _.L8 281 _.LFE7: 282 .size _dir_read, .-_dir_read 283 .global _dir_write_update 284 .type _dir_write_update, @function 285 _dir_write_update: 286 _.LFB8: 223:fatdir.c **** 224:fatdir.c **** /* Description. 225:fatdir.c **** * Writes directory entry pointed by fnp to disk. In case of erroneous 226:fatdir.c **** * situation fnode is released. 227:fatdir.c **** * The caller should set 228:fatdir.c **** * 1. F_DMOD flag if original directory entry was modified. 229:fatdir.c **** * Return value. 230:fatdir.c **** * TRUE - all OK. 231:fatdir.c **** * FALSE - error occured (fnode is released). 232:fatdir.c **** */ 233:fatdir.c **** BOOL dir_write_update(REG f_node_ptr fnp, BOOL update) 234:fatdir.c **** { 287 .loc 1 234 0 288 _.LVL28: 0 00004835 56 push si 0 00004836 57 push di 0 00004837 55 push bp 292 _.LCFI5: 0 00004838 89E5 mov bp, sp 294 _.LCFI6: 0 0000483A 83EC08 sub sp, 8 0 0000483D 8B7E08 mov di, word ptr [bp+8] 235:fatdir.c **** struct buffer FAR *bp; 236:fatdir.c **** UBYTE FAR *vp; 237:fatdir.c **** 238:fatdir.c **** /* Update the entry if it was modified by a write or create... */ 239:fatdir.c **** if (!update || (fnp->f_flags & (SFT_FCLEAN|SFT_FDATE)) != SFT_FCLEAN) 297 .loc 1 239 0 0 00004840 837E0A00 cmp word ptr [bp+10], 0 0 00004844 740D je _.L18 300 .loc 1 239 0 is_stmt 0 discriminator 1 0 00004846 8B05 mov ax, word ptr [di] 0 00004848 254040 and ax, 16448 0 0000484B 83F840 cmp ax, 64 0 0000484E 7503E9C300 je _.L19 305 _.L18: 240:fatdir.c **** { 241:fatdir.c **** bp = getblock(fnp->f_dirsector, fnp->f_dpb->dpb_unit); 306 .loc 1 241 0 is_stmt 1 0 00004853 31C0 xor ax, ax 0 00004855 50 push ax 0 00004856 C45D29 les bx, dword ptr [di+41] 0 00004859 268A07 mov al, byte ptr es:[bx] 0 0000485C 98 cbw 0 0000485D 50 push ax 0 0000485E FF7526 push word ptr [di+38] 0 00004861 FF7524 push word ptr [di+36] 0 00004864 E8[FEFF] call _getblk 316 _.LVL29: 0 00004867 8946FC mov word ptr [bp-4], ax 318 _.LVL30: 242:fatdir.c **** 243:fatdir.c **** /* Now that we have a block, transfer the directory */ 244:fatdir.c **** /* entry into the block. */ 245:fatdir.c **** if (bp == NULL) 319 .loc 1 245 0 0 0000486A 09D0 or ax, dx 321 _.LVL31: 0 0000486C 8956FA mov word ptr [bp-6], dx 0 0000486F 7503E9AD00 je _.L17 246:fatdir.c **** return FALSE; 247:fatdir.c **** 248:fatdir.c **** #ifdef DISPLAY_GETBLOCK 249:fatdir.c **** printf("DIR (dir_write)\n"); 250:fatdir.c **** #endif 251:fatdir.c **** 252:fatdir.c **** swap_deleted(fnp->f_dir.dir_name); 324 .loc 1 252 0 0 00004874 89F8 mov ax, di 0 00004876 83C004 add ax, 4 0 00004879 8946FE mov word ptr [bp-2], ax 0 0000487C 50 push ax 0 0000487D E8E4FD call _swap_deleted 330 _.LVL32: 253:fatdir.c **** 254:fatdir.c **** vp = &bp->b_buffer[fnp->f_diridx * DIRENT_SIZE]; 331 .loc 1 254 0 0 00004880 8A4528 mov al, byte ptr [di+40] 0 00004883 30E4 xor ah, ah 0 00004885 B105 mov cl, 5 0 00004887 D3E0 shl ax, cl 0 00004889 93 xchg bx, ax 0 0000488A 8B76FC mov si, word ptr [bp-4] 0 0000488D 8D5814 lea bx, [20+bx+si] 339 _.LVL33: 255:fatdir.c **** 256:fatdir.c **** if (update) 340 .loc 1 256 0 0 00004890 837E0A00 cmp word ptr [bp+10], 0 0 00004894 8B56FA mov dx, word ptr [bp-6] 0 00004897 7503E98D00 je _.L22 257:fatdir.c **** { 258:fatdir.c **** /* only update fields that are also in the SFT, for dos_close/commit */ 259:fatdir.c **** fmemcpy(&vp[DIR_NAME], fnp->f_dir.dir_name, FNAME_SIZE + FEXT_SIZE); 344 .loc 1 259 0 0 0000489C B80B00 mov ax, 11 0 0000489F 50 push ax 0 000048A0 16 push ss 0 000048A1 FF76FE push word ptr [bp-2] 0 000048A4 52 push dx 0 000048A5 8956F8 mov word ptr [bp-8], dx 0 000048A8 53 push bx 0 000048A9 895EFA mov word ptr [bp-6], bx 353 _.LVL34: 0 000048AC E8[FEFF] call _fmemcpy 355 _.LVL35: 260:fatdir.c **** fputbyte(&vp[DIR_ATTRIB], fnp->f_dir.dir_attrib); 356 .loc 1 260 0 0 000048AF 8A450F mov al, byte ptr [di+15] 0 000048B2 8B56F8 mov dx, word ptr [bp-8] 0 000048B5 8EC2 mov es, dx 0 000048B7 8B5EFA mov bx, word ptr [bp-6] 0 000048BA 2688470B mov byte ptr es:[bx+11], al 362 _.LVL36: 261:fatdir.c **** fputword(&vp[DIR_TIME], fnp->f_dir.dir_time); 363 .loc 1 261 0 0 000048BE 8B451A mov ax, word ptr [di+26] 0 000048C1 26894716 mov word ptr es:[bx+22], ax 262:fatdir.c **** fputword(&vp[DIR_DATE], fnp->f_dir.dir_date); 366 .loc 1 262 0 0 000048C5 8B451C mov ax, word ptr [di+28] 0 000048C8 26894718 mov word ptr es:[bx+24], ax 263:fatdir.c **** fputword(&vp[DIR_START], fnp->f_dir.dir_start); 369 .loc 1 263 0 0 000048CC 8B451E mov ax, word ptr [di+30] 0 000048CF 2689471A mov word ptr es:[bx+26], ax 264:fatdir.c **** #ifdef WITHFAT32 265:fatdir.c **** if (ISFAT32(fnp->f_dpb)) 372 .loc 1 265 0 0 000048D3 C47529 les si, dword ptr [di+41] 0 000048D6 26837C0F00 cmp word ptr es:[si+15], 0 0 000048DB 7509 jne _.L23 266:fatdir.c **** fputword(&vp[DIR_START_HIGH], fnp->f_dir.dir_start_high); 376 .loc 1 266 0 0 000048DD 8B4518 mov ax, word ptr [di+24] 0 000048E0 8EC2 mov es, dx 0 000048E2 26894714 mov word ptr es:[bx+20], ax 380 _.L23: 267:fatdir.c **** #endif 268:fatdir.c **** fputlong(&vp[DIR_SIZE], fnp->f_dir.dir_size); 381 .loc 1 268 0 0 000048E6 8B4520 mov ax, word ptr [di+32] 0 000048E9 8B4D22 mov cx, word ptr [di+34] 0 000048EC 8EC2 mov es, dx 0 000048EE 2689471C mov word ptr es:[bx+28], ax 0 000048F2 26894F1E mov word ptr es:[bx+30], cx 387 _.L24: 0 000048F6 8956FA mov word ptr [bp-6], dx 269:fatdir.c **** } 270:fatdir.c **** else 271:fatdir.c **** { 272:fatdir.c **** putdirent(&fnp->f_dir, vp); 273:fatdir.c **** } 274:fatdir.c **** 275:fatdir.c **** swap_deleted(fnp->f_dir.dir_name); 389 .loc 1 275 0 0 000048F9 FF76FE push word ptr [bp-2] 0 000048FC E865FD call _swap_deleted 392 _.LVL37: 276:fatdir.c **** 277:fatdir.c **** bp->b_flag &= ~(BFR_DATA | BFR_FAT); 393 .loc 1 277 0 0 000048FF 8B56FA mov dx, word ptr [bp-6] 0 00004902 8EC2 mov es, dx 0 00004904 8B5EFC mov bx, word ptr [bp-4] 0 00004907 268A4705 mov al, byte ptr es:[bx+5] 0 0000490B 8846FE mov byte ptr [bp-2], al 0 0000490E 24F5 and al, -11 278:fatdir.c **** bp->b_flag |= BFR_DIR | BFR_DIRTY | BFR_VALID; 400 .loc 1 278 0 0 00004910 0C64 or al, 100 0 00004912 26884705 mov byte ptr es:[bx+5], al 403 _.L19: 279:fatdir.c **** } 280:fatdir.c **** /* Clear buffers after directory write or DOS close */ 281:fatdir.c **** return flush_buffers(fnp->f_dpb->dpb_unit); 404 .loc 1 281 0 0 00004916 C45D29 les bx, dword ptr [di+41] 0 00004919 268A07 mov al, byte ptr es:[bx] 0 0000491C 98 cbw 0 0000491D 50 push ax 0 0000491E E8[FEFF] call _flush_buffers 410 _.LVL38: 411 _.L17: 282:fatdir.c **** } 412 .loc 1 282 0 0 00004921 89EC mov sp, bp 0 00004923 5D pop bp 0 00004924 5F pop di 0 00004925 5E pop si 0 00004926 C20400 ret 4 418 _.LVL39: 419 _.L22: 272:fatdir.c **** } 420 .loc 1 272 0 0 00004929 B82000 mov ax, 32 0 0000492C 50 push ax 0 0000492D 16 push ss 0 0000492E FF76FE push word ptr [bp-2] 0 00004931 52 push dx 0 00004932 8956FA mov word ptr [bp-6], dx 427 _.LVL40: 0 00004935 53 push bx 0 00004936 E8[FEFF] call _fmemcpy 430 _.LVL41: 0 00004939 8B56FA mov dx, word ptr [bp-6] 0 0000493C EBB8 jmp _.L24 433 _.LFE8: 434 .size _dir_write_update, .-_dir_write_update 435 .global _dos_findnext 436 .type _dos_findnext, @function 437 _dos_findnext: 438 _.LFB10: 283:fatdir.c **** 284:fatdir.c **** #ifndef IPL 285:fatdir.c **** COUNT dos_findfirst(UCOUNT attr, BYTE * name) 286:fatdir.c **** { 287:fatdir.c **** REG f_node_ptr fnp; 288:fatdir.c **** REG dmatch *dmp = &sda_tmp_dm; 289:fatdir.c **** 290:fatdir.c **** /* printf("ff %Fs\n", name);*/ 291:fatdir.c **** 292:fatdir.c **** /* The findfirst/findnext calls are probably the worst of the */ 293:fatdir.c **** /* DOS calls. They must work somewhat on the fly (i.e. - open */ 294:fatdir.c **** /* but never close). The near fnodes now work this way. Every */ 295:fatdir.c **** /* time a directory is searched, we will initialize the DOS */ 296:fatdir.c **** /* dirmatch structure and then for every find, we will open the */ 297:fatdir.c **** /* current directory, do a seek and read. */ 298:fatdir.c **** 299:fatdir.c **** /* first: findfirst("D:\\") returns DE_NFILES */ 300:fatdir.c **** if (name[3] == '\0') 301:fatdir.c **** return DE_NFILES; 302:fatdir.c **** 303:fatdir.c **** /* Now open this directory so that we can read the */ 304:fatdir.c **** /* fnode entry and do a match on it. */ 305:fatdir.c **** if ((fnp = split_path(name, &fnode[0])) == NULL) 306:fatdir.c **** return DE_PATHNOTFND; 307:fatdir.c **** 308:fatdir.c **** /* Now search through the directory to find the entry... */ 309:fatdir.c **** 310:fatdir.c **** /* Special handling - the volume id is only in the root */ 311:fatdir.c **** /* directory and only searched for once. So we need to open */ 312:fatdir.c **** /* the root and return only the first entry that contains the */ 313:fatdir.c **** /* volume id bit set (while ignoring LFN entries). */ 314:fatdir.c **** /* RBIL: ignore ReaDONLY and ARCHIVE bits but DEVICE ignored too*/ 315:fatdir.c **** /* For compatibility with bad search requests, only treat as */ 316:fatdir.c **** /* volume search if only volume bit set, else ignore it. */ 317:fatdir.c **** if ((attr & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID) 318:fatdir.c **** /* if ONLY label wanted redirect search to root dir */ 319:fatdir.c **** dir_init_fnode(fnp, 0); 320:fatdir.c **** 321:fatdir.c **** /* Now further initialize the dirmatch structure. */ 322:fatdir.c **** dmp->dm_drive = name[0] - 'A'; 323:fatdir.c **** dmp->dm_attr_srch = attr; 324:fatdir.c **** 325:fatdir.c **** return dos_findnext(); 326:fatdir.c **** } 327:fatdir.c **** 328:fatdir.c **** /* 329:fatdir.c **** BUGFIX TE 06/28/01 330:fatdir.c **** 331:fatdir.c **** when using FcbFindXxx, the only information available is 332:fatdir.c **** the cluster number + entrycount. everything else MUST\ 333:fatdir.c **** be recalculated. 334:fatdir.c **** a good test for this is MSDOS CHKDSK, which now (seems too) work 335:fatdir.c **** */ 336:fatdir.c **** 337:fatdir.c **** COUNT dos_findnext(void) 338:fatdir.c **** { 439 .loc 1 338 0 0 0000493E 56 push si 0 0000493F 57 push di 0 00004940 55 push bp 443 _.LCFI7: 0 00004941 89E5 mov bp, sp 445 _.LCFI8: 0 00004943 1E push ds 447 _.LVL42: 339:fatdir.c **** REG f_node_ptr fnp; 340:fatdir.c **** REG dmatch *dmp; 341:fatdir.c **** 342:fatdir.c **** /* Select the default to help non-drive specified path */ 343:fatdir.c **** /* searches... */ 344:fatdir.c **** fnp = &fnode[0]; 345:fatdir.c **** dmp = &sda_tmp_dm; 346:fatdir.c **** fnp->f_dpb = get_dpb(dmp->dm_drive); 448 .loc 1 346 0 0 00004944 BF[0000] mov di, offset _sda_tmp_dm 0 00004947 8A05 mov al, byte ptr [di] 0 00004949 30E4 xor ah, ah 0 0000494B 50 push ax 0 0000494C E8[FEFF] call _get_dpb 454 _.LVL43: 0 0000494F BE[0000] mov si, offset _fnode 0 00004952 894429 mov word ptr [si+41], ax 0 00004955 89542B mov word ptr [si+43], dx 347:fatdir.c **** if (media_check(fnp->f_dpb) < 0) 458 .loc 1 347 0 0 00004958 52 push dx 0 00004959 50 push ax 0 0000495A E8[FEFF] call _media_check 462 _.LVL44: 0 0000495D 85C0 test ax, ax 0 0000495F 7D09 jge _.L34 465 _.L41: 348:fatdir.c **** return DE_NFILES; 466 .loc 1 348 0 0 00004961 B8EEFF mov ax, -18 468 _.L33: 349:fatdir.c **** 350:fatdir.c **** dir_init_fnode(fnp, dmp->dm_dircluster); 351:fatdir.c **** 352:fatdir.c **** /* Search through the directory to find the entry, but do a */ 353:fatdir.c **** /* seek first. */ 354:fatdir.c **** /* Loop through the directory */ 355:fatdir.c **** while (dir_read(fnp) == 1) 356:fatdir.c **** { 357:fatdir.c **** ++dmp->dm_entry; 358:fatdir.c **** if (fnp->f_dir.dir_name[0] != DELETED 359:fatdir.c **** && (fnp->f_dir.dir_attrib & D_LFN) != D_LFN) 360:fatdir.c **** { 361:fatdir.c **** if (fcmp_wild(dmp->dm_name_pat, fnp->f_dir.dir_name, FNAME_SIZE + FEXT_SIZE)) 362:fatdir.c **** { 363:fatdir.c **** /* 364:fatdir.c **** MSD Command.com uses FCB FN 11 & 12 with attrib set to 0x16. 365:fatdir.c **** Bits 0x21 seem to get set some where in MSD so Rd and Arc 366:fatdir.c **** files are returned. 367:fatdir.c **** RdOnly + Archive bits are ignored 368:fatdir.c **** */ 369:fatdir.c **** 370:fatdir.c **** /* Test the attribute as the final step */ 371:fatdir.c **** /* It's either a special volume label search or an */ 372:fatdir.c **** /* attribute inclusive search. The attribute inclusive search */ 373:fatdir.c **** /* can also find volume labels if you set e.g. D_DIR|D_VOLUME */ 374:fatdir.c **** UBYTE attr_srch; 375:fatdir.c **** attr_srch = dmp->dm_attr_srch & ~(D_RDONLY | D_ARCHIVE | D_DEVICE); 376:fatdir.c **** if (attr_srch == D_VOLID) 377:fatdir.c **** { 378:fatdir.c **** if (!(fnp->f_dir.dir_attrib & D_VOLID)) 379:fatdir.c **** continue; 380:fatdir.c **** } 381:fatdir.c **** else if (~attr_srch & (D_DIR | D_SYSTEM | D_HIDDEN | D_VOLID) & 382:fatdir.c **** fnp->f_dir.dir_attrib) 383:fatdir.c **** continue; 384:fatdir.c **** /* If found, transfer it to the dmatch structure */ 385:fatdir.c **** memcpy(&SearchDir, &fnp->f_dir, sizeof(struct dirent)); 386:fatdir.c **** /* return the result */ 387:fatdir.c **** return SUCCESS; 388:fatdir.c **** } 389:fatdir.c **** } 390:fatdir.c **** } 391:fatdir.c **** 392:fatdir.c **** 393:fatdir.c **** #ifdef DEBUG 394:fatdir.c **** printf("dos_findnext: %11s\n", fnp->f_dir.dir_name); 395:fatdir.c **** #endif 396:fatdir.c **** /* return the result */ 397:fatdir.c **** return DE_NFILES; 398:fatdir.c **** } 469 .loc 1 398 0 0 00004964 89EC mov sp, bp 0 00004966 5D pop bp 0 00004967 5F pop di 0 00004968 5E pop si 0 00004969 C3 ret 475 _.L34: 350:fatdir.c **** 476 .loc 1 350 0 0 0000496A FF36[1100] push word ptr [_sda_tmp_dm+17] 0 0000496E FF36[0F00] push word ptr [_sda_tmp_dm+15] 0 00004972 56 push si 0 00004973 E8[FEFF] call _dir_init_fnode 481 _.LVL45: 482 _.L36: 483 _.LBB6: 484 _.LBB7: 355:fatdir.c **** { 485 .loc 1 355 0 0 00004976 56 push si 0 00004977 E8[FEFF] call _dir_read 488 _.LVL46: 0 0000497A 83F801 cmp ax, 1 0 0000497D 75E2 jne _.L41 357:fatdir.c **** if (fnp->f_dir.dir_name[0] != DELETED 491 .loc 1 357 0 0 0000497F FF450D inc word ptr [di+13] 358:fatdir.c **** && (fnp->f_dir.dir_attrib & D_LFN) != D_LFN) 493 .loc 1 358 0 0 00004982 807C0405 cmp byte ptr [si+4], 5 0 00004986 74EE je _.L36 359:fatdir.c **** { 496 .loc 1 359 0 0 00004988 8B440F mov ax, word ptr [si+15] 0 0000498B F7D0 not ax 0 0000498D A80F test al, 15 0 0000498F 74E5 je _.L36 361:fatdir.c **** { 501 .loc 1 361 0 0 00004991 B80B00 mov ax, 11 0 00004994 50 push ax 0 00004995 BA[0400] mov dx, offset _fnode+4 0 00004998 52 push dx 0 00004999 8956FE mov word ptr [bp-2], dx 0 0000499C B8[0100] mov ax, offset _sda_tmp_dm+1 0 0000499F 50 push ax 0 000049A0 E8[FEFF] call _fcmp_wild 510 _.LVL47: 0 000049A3 85C0 test ax, ax 0 000049A5 8B56FE mov dx, word ptr [bp-2] 0 000049A8 74CC je _.L36 514 _.LBB8: 375:fatdir.c **** if (attr_srch == D_VOLID) 515 .loc 1 375 0 0 000049AA 8A450C mov al, byte ptr [di+12] 0 000049AD 249E and al, -98 518 _.LVL48: 376:fatdir.c **** { 519 .loc 1 376 0 0 000049AF 3C08 cmp al, 8 0 000049B1 8A640F mov ah, byte ptr [si+15] 0 000049B4 8866FE mov byte ptr [bp-2], ah 0 000049B7 7516 jne _.L38 378:fatdir.c **** continue; 524 .loc 1 378 0 0 000049B9 F646FE08 test byte ptr [bp-2], 8 0 000049BD 74B7 je _.L36 527 _.LVL49: 528 _.L39: 385:fatdir.c **** /* return the result */ 529 .loc 1 385 0 0 000049BF B82000 mov ax, 32 0 000049C2 50 push ax 0 000049C3 52 push dx 0 000049C4 B8[0000] mov ax, offset _SearchDir 0 000049C7 50 push ax 0 000049C8 E8[FEFF] call _memcpy 536 _.LVL50: 387:fatdir.c **** } 537 .loc 1 387 0 0 000049CB 31C0 xor ax, ax 0 000049CD EB95 jmp _.L33 540 _.LVL51: 541 _.L38: 381:fatdir.c **** fnp->f_dir.dir_attrib) 542 .loc 1 381 0 0 000049CF 8A66FE mov ah, byte ptr [bp-2] 0 000049D2 80E41E and ah, 30 0 000049D5 8866FE mov byte ptr [bp-2], ah 0 000049D8 C646FF00 mov byte ptr [bp-1], 0 0 000049DC 30E4 xor ah, ah 548 _.LVL52: 0 000049DE F7D0 not ax 0 000049E0 8546FE test ax, word ptr [bp-2] 0 000049E3 7591 jne _.L36 0 000049E5 EBD8 jmp _.L39 553 _.LBE8: 554 _.LBE7: 555 _.LBE6: 556 _.LFE10: 557 .size _dos_findnext, .-_dos_findnext 558 .global _dos_findfirst 559 .type _dos_findfirst, @function 560 _dos_findfirst: 561 _.LFB9: 286:fatdir.c **** REG f_node_ptr fnp; 562 .loc 1 286 0 563 _.LVL53: 0 000049E7 56 push si 0 000049E8 55 push bp 566 _.LCFI9: 0 000049E9 89E5 mov bp, sp 568 _.LCFI10: 0 000049EB 8B7608 mov si, word ptr [bp+8] 570 _.LVL54: 300:fatdir.c **** return DE_NFILES; 571 .loc 1 300 0 0 000049EE 807C0300 cmp byte ptr [si+3], 0 0 000049F2 7438 je _.L55 305:fatdir.c **** return DE_PATHNOTFND; 574 .loc 1 305 0 0 000049F4 B8[0000] mov ax, offset _fnode 0 000049F7 50 push ax 0 000049F8 56 push si 0 000049F9 E8[FEFF] call _split_path 579 _.LVL55: 0 000049FC 85C0 test ax, ax 0 000049FE 7431 je _.L56 317:fatdir.c **** /* if ONLY label wanted redirect search to root dir */ 582 .loc 1 317 0 0 00004A00 8B5606 mov dx, word ptr [bp+6] 0 00004A03 83E29E and dx, -98 0 00004A06 83FA08 cmp dx, 8 0 00004A09 7508 jne _.L54 319:fatdir.c **** 587 .loc 1 319 0 0 00004A0B 31D2 xor dx, dx 0 00004A0D 52 push dx 0 00004A0E 52 push dx 0 00004A0F 50 push ax 0 00004A10 E8[FEFF] call _dir_init_fnode 593 _.LVL56: 594 _.L54: 322:fatdir.c **** dmp->dm_attr_srch = attr; 595 .loc 1 322 0 0 00004A13 BB[0000] mov bx, offset _sda_tmp_dm 0 00004A16 8A04 mov al, byte ptr [si] 0 00004A18 04BF add al, -65 0 00004A1A 8807 mov byte ptr [bx], al 323:fatdir.c **** 600 .loc 1 323 0 0 00004A1C 8A4606 mov al, byte ptr [bp+6] 0 00004A1F 88470C mov byte ptr [bx+12], al 325:fatdir.c **** } 603 .loc 1 325 0 0 00004A22 E8[FEFF] call _dos_findnext 605 _.LVL57: 606 _.L52: 326:fatdir.c **** 607 .loc 1 326 0 0 00004A25 89EC mov sp, bp 0 00004A27 5D pop bp 0 00004A28 5E pop si 0 00004A29 C20400 ret 4 612 _.L55: 301:fatdir.c **** 613 .loc 1 301 0 0 00004A2C B8EEFF mov ax, -18 0 00004A2F EBF4 jmp _.L52 616 _.LVL58: 617 _.L56: 306:fatdir.c **** 618 .loc 1 306 0 0 00004A31 B8FDFF mov ax, -3 620 _.LVL59: 0 00004A34 EBEF jmp _.L52 622 _.LFE9: 623 .size _dos_findfirst, .-_dos_findfirst 624 .global _ConvertName83ToNameSZ 625 .type _ConvertName83ToNameSZ, @function 626 _ConvertName83ToNameSZ: 627 _.LFB11: 399:fatdir.c **** #endif 400:fatdir.c **** /* 401:fatdir.c **** this receives a name in 11 char field NAME+EXT and builds 402:fatdir.c **** a zeroterminated string 403:fatdir.c **** 404:fatdir.c **** unfortunately, blanks are allowed in filenames. like 405:fatdir.c **** "test e", " test .y z",... 406:fatdir.c **** 407:fatdir.c **** so we have to work from the last blank backward 408:fatdir.c **** */ 409:fatdir.c **** void ConvertName83ToNameSZ(BYTE FAR * destSZ, BYTE FAR * srcFCBName) 410:fatdir.c **** { 628 .loc 1 410 0 629 _.LVL60: 0 00004A36 56 push si 0 00004A37 57 push di 0 00004A38 55 push bp 633 _.LCFI11: 0 00004A39 89E5 mov bp, sp 635 _.LCFI12: 0 00004A3B 83EC08 sub sp, 8 0 00004A3E 8B7608 mov si, word ptr [bp+8] 0 00004A41 8B460A mov ax, word ptr [bp+10] 0 00004A44 8946FE mov word ptr [bp-2], ax 0 00004A47 C47E0C les di, dword ptr [bp+12] 641 _.LVL61: 411:fatdir.c **** int loop; 412:fatdir.c **** int noExtension = FALSE; 413:fatdir.c **** 414:fatdir.c **** if (*srcFCBName == '.') 642 .loc 1 414 0 0 00004A4A 268A0D mov cl, byte ptr es:[di] 0 00004A4D 884EF9 mov byte ptr [bp-7], cl 645 _.LVL62: 415:fatdir.c **** { 416:fatdir.c **** noExtension = TRUE; 417:fatdir.c **** } 418:fatdir.c **** 419:fatdir.c **** fmemcpy(destSZ, srcFCBName, FNAME_SIZE); 646 .loc 1 419 0 0 00004A50 B80800 mov ax, 8 0 00004A53 50 push ax 0 00004A54 8946FA mov word ptr [bp-6], ax 0 00004A57 06 push es 0 00004A58 8C46FC mov word ptr [bp-4], es 0 00004A5B 57 push di 0 00004A5C FF76FE push word ptr [bp-2] 0 00004A5F 56 push si 0 00004A60 E8[FEFF] call _fmemcpy 656 _.LVL63: 420:fatdir.c **** 421:fatdir.c **** srcFCBName += FNAME_SIZE; 422:fatdir.c **** 423:fatdir.c **** for (loop = FNAME_SIZE; --loop >= 0;) 657 .loc 1 423 0 0 00004A63 BA0900 mov dx, 9 0 00004A66 C446FA les ax, dword ptr [bp-6] 0 00004A69 8A4EF9 mov cl, byte ptr [bp-7] 661 _.LVL64: 662 _.L59: 663 .loc 1 423 0 is_stmt 0 discriminator 1 0 00004A6C 48 dec ax 665 _.LVL65: 0 00004A6D 4A dec dx 0 00004A6E 7505 jne _.L61 0 00004A70 B8FFFF mov ax, -1 669 _.LVL66: 0 00004A73 EB0C jmp _.L60 671 _.LVL67: 672 _.L61: 424:fatdir.c **** { 425:fatdir.c **** if (destSZ[loop] != ' ') 673 .loc 1 425 0 is_stmt 1 0 00004A75 89C3 mov bx, ax 0 00004A77 01F3 add bx, si 0 00004A79 8E5EFE mov ds, word ptr [bp-2] 0 00004A7C 803F20 cmp byte ptr [bx], 32 0 00004A7F 74EB je _.L59 679 _.LVL68: 680 _.L60: 426:fatdir.c **** break; 427:fatdir.c **** } 428:fatdir.c **** destSZ += loop + 1; 681 .loc 1 428 0 0 00004A81 93 xchg bx, ax 0 00004A82 8D5801 lea bx, [1+bx+si] 0 00004A85 89DE mov si, bx 685 _.LVL69: 429:fatdir.c **** 430:fatdir.c **** if (!noExtension) /* not for ".", ".." */ 686 .loc 1 430 0 0 00004A87 80F92E cmp cl, 46 0 00004A8A 7412 je _.L62 421:fatdir.c **** 689 .loc 1 421 0 0 00004A8C 83C708 add di, 8 691 _.LVL70: 0 00004A8F 897EFC mov word ptr [bp-4], di 693 _.LVL71: 0 00004A92 B90400 mov cx, 4 0 00004A95 B80300 mov ax, 3 696 _.L63: 697 _.LVL72: 431:fatdir.c **** { 432:fatdir.c **** 433:fatdir.c **** for (loop = FEXT_SIZE; --loop >= 0;) 698 .loc 1 433 0 discriminator 1 0 00004A98 89C2 mov dx, ax 0 00004A9A 4A dec dx 701 _.LVL73: 0 00004A9B 49 dec cx 0 00004A9C 7511 jne _.L65 704 _.LVL74: 705 _.L62: 434:fatdir.c **** { 435:fatdir.c **** if (srcFCBName[loop] != ' ') 436:fatdir.c **** break; 437:fatdir.c **** } 438:fatdir.c **** if (loop >= 0) 439:fatdir.c **** { 440:fatdir.c **** *destSZ++ = '.'; 441:fatdir.c **** fmemcpy(destSZ, srcFCBName, loop + 1); 442:fatdir.c **** destSZ += loop + 1; 443:fatdir.c **** } 444:fatdir.c **** } 445:fatdir.c **** *destSZ = '\0'; 706 .loc 1 445 0 0 00004A9E 8E46FE mov es, word ptr [bp-2] 0 00004AA1 26C60400 mov byte ptr es:[si], 0 709 _.LVL75: 446:fatdir.c **** } 710 .loc 1 446 0 0 00004AA5 89EC mov sp, bp 0 00004AA7 5D pop bp 0 00004AA8 5F pop di 0 00004AA9 5E pop si 715 _.LVL76: 0 00004AAA 16 push ss 0 00004AAB 1F pop ds 0 00004AAC C20800 ret 8 719 _.LVL77: 720 _.L65: 435:fatdir.c **** break; 721 .loc 1 435 0 0 00004AAF 89D7 mov di, dx 0 00004AB1 037EFC add di, word ptr [bp-4] 0 00004AB4 26803D20 cmp byte ptr es:[di], 32 0 00004AB8 7503 jne _.L64 0 00004ABA 92 xchg dx, ax 0 00004ABB EBDB jmp _.L63 728 _.L64: 440:fatdir.c **** fmemcpy(destSZ, srcFCBName, loop + 1); 729 .loc 1 440 0 0 00004ABD 8D7701 lea si, [1+bx] 731 _.LVL78: 0 00004AC0 8E5EFE mov ds, word ptr [bp-2] 0 00004AC3 C6072E mov byte ptr [bx], 46 734 _.LVL79: 441:fatdir.c **** destSZ += loop + 1; 735 .loc 1 441 0 0 00004AC6 50 push ax 0 00004AC7 8946FA mov word ptr [bp-6], ax 0 00004ACA 06 push es 0 00004ACB FF76FC push word ptr [bp-4] 0 00004ACE FF76FE push word ptr [bp-2] 0 00004AD1 56 push si 0 00004AD2 16 push ss 0 00004AD3 1F pop ds 744 _.LVL80: 0 00004AD4 E8[FEFF] call _fmemcpy 746 _.LVL81: 442:fatdir.c **** } 747 .loc 1 442 0 0 00004AD7 8B46FA mov ax, word ptr [bp-6] 0 00004ADA 01C6 add si, ax 0 00004ADC EBC0 jmp _.L62 751 _.LFE11: 752 .size _ConvertName83ToNameSZ, .-_ConvertName83ToNameSZ 753 .global _ConvertNameSZToName83 754 .type _ConvertNameSZToName83, @function 755 _ConvertNameSZToName83: 756 _.LFB12: 447:fatdir.c **** 448:fatdir.c **** #if 0 449:fatdir.c **** /* 450:fatdir.c **** returns the asciiSZ length of a 8.3 filename 451:fatdir.c **** */ 452:fatdir.c **** 453:fatdir.c **** int FileName83Length(BYTE * filename83) 454:fatdir.c **** { 455:fatdir.c **** BYTE buff[13]; 456:fatdir.c **** 457:fatdir.c **** ConvertName83ToNameSZ(buff, filename83); 458:fatdir.c **** 459:fatdir.c **** return strlen(buff); 460:fatdir.c **** } 461:fatdir.c **** #endif 462:fatdir.c **** 463:fatdir.c **** /* this routine converts a name portion of a fully qualified path */ 464:fatdir.c **** /* name, so . and .. are not allowed, only straightforward 8+3 names */ 465:fatdir.c **** const char *ConvertNameSZToName83(char *fcbname, const char *dirname) 466:fatdir.c **** { 757 .loc 1 466 0 758 _.LVL82: 0 00004ADE 56 push si 0 00004ADF 57 push di 0 00004AE0 55 push bp 762 _.LCFI13: 0 00004AE1 89E5 mov bp, sp 764 _.LCFI14: 0 00004AE3 8B7E08 mov di, word ptr [bp+8] 467:fatdir.c **** int i; 468:fatdir.c **** memset(fcbname, ' ', FNAME_SIZE + FEXT_SIZE); 766 .loc 1 468 0 0 00004AE6 B80B00 mov ax, 11 0 00004AE9 50 push ax 0 00004AEA B82000 mov ax, 32 0 00004AED 50 push ax 0 00004AEE 57 push di 0 00004AEF E8[FEFF] call _memset 773 _.LVL83: 0 00004AF2 8B460A mov ax, word ptr [bp+10] 469:fatdir.c **** 470:fatdir.c **** for (i = 0; i < FNAME_SIZE + FEXT_SIZE; i++, dirname++) 775 .loc 1 470 0 0 00004AF5 31DB xor bx, bx 777 _.LVL84: 778 _.L74: 779 _.LBB9: 471:fatdir.c **** { 472:fatdir.c **** char c = *dirname; 780 .loc 1 472 0 0 00004AF7 89C6 mov si, ax 0 00004AF9 8A14 mov dl, byte ptr [si] 783 _.LVL85: 473:fatdir.c **** if (c == '.') 784 .loc 1 473 0 0 00004AFB 80FA2E cmp dl, 46 0 00004AFE 741A je _.L75 474:fatdir.c **** i = FNAME_SIZE - 1; 475:fatdir.c **** else if (c != '\0' && c != '\\') 787 .loc 1 475 0 0 00004B00 84D2 test dl, dl 0 00004B02 740E je _.L71 0 00004B04 80FA5C cmp dl, 92 0 00004B07 7409 je _.L71 476:fatdir.c **** fcbname[i] = c; 792 .loc 1 476 0 0 00004B09 8811 mov byte ptr [bx+di], dl 794 _.LVL86: 795 _.L72: 796 _.LBE9: 470:fatdir.c **** { 797 .loc 1 470 0 discriminator 2 0 00004B0B 43 inc bx 799 _.LVL87: 0 00004B0C 40 inc ax 801 _.LVL88: 0 00004B0D 83FB0A cmp bx, 10 0 00004B10 7EE5 jle _.L74 804 _.L71: 477:fatdir.c **** else 478:fatdir.c **** break; 479:fatdir.c **** } 480:fatdir.c **** return dirname; 481:fatdir.c **** } 805 .loc 1 481 0 0 00004B12 89EC mov sp, bp 0 00004B14 5D pop bp 0 00004B15 5F pop di 0 00004B16 5E pop si 0 00004B17 C20400 ret 4 811 _.L75: 812 _.LBB10: 474:fatdir.c **** else if (c != '\0' && c != '\\') 813 .loc 1 474 0 0 00004B1A BB0700 mov bx, 7 815 _.LVL89: 0 00004B1D EBEC jmp _.L72 817 _.LBE10: 818 _.LFE12: 819 .size _ConvertNameSZToName83, .-_ConvertNameSZToName83 820 .global _dir_open 821 .type _dir_open, @function 822 _dir_open: 823 _.LFB5: 62:fatdir.c **** int i; 824 .loc 1 62 0 825 _.LVL90: 0 00004B1F 56 push si 0 00004B20 57 push di 0 00004B21 55 push bp 829 _.LCFI15: 0 00004B22 89E5 mov bp, sp 831 _.LCFI16: 0 00004B24 1E push ds 0 00004B25 1E push ds 0 00004B26 8B7E08 mov di, word ptr [bp+8] 0 00004B29 8B760C mov si, word ptr [bp+12] 67:fatdir.c **** /* Perform all directory common handling after all special */ 836 .loc 1 67 0 0 00004B2C 8A05 mov al, byte ptr [di] 0 00004B2E 98 cbw 0 00004B2F 83C0BF add ax, -65 0 00004B32 50 push ax 0 00004B33 E8[FEFF] call _get_dpb 842 _.LVL91: 0 00004B36 894429 mov word ptr [si+41], ax 0 00004B39 89542B mov word ptr [si+43], dx 82:fatdir.c **** fnp->f_dmp->dm_entry = 0; 845 .loc 1 82 0 0 00004B3C 31C0 xor ax, ax 0 00004B3E 50 push ax 0 00004B3F 50 push ax 0 00004B40 8946FE mov word ptr [bp-2], ax 0 00004B43 56 push si 0 00004B44 E8[FEFF] call _dir_init_fnode 852 _.LVL92: 83:fatdir.c **** 853 .loc 1 83 0 0 00004B47 8B5C02 mov bx, word ptr [si+2] 0 00004B4A 8B46FE mov ax, word ptr [bp-2] 0 00004B4D 89470D mov word ptr [bx+13], ax 85:fatdir.c **** fcbname = fnp->f_dmp->dm_name_pat; 857 .loc 1 85 0 0 00004B50 83C702 add di, 2 859 _.LVL93: 86:fatdir.c **** while(*dirname != '\0') 860 .loc 1 86 0 0 00004B53 8B4402 mov ax, word ptr [si+2] 0 00004B56 40 inc ax 0 00004B57 8946FE mov word ptr [bp-2], ax 864 _.LVL94: 865 _.L85: 87:fatdir.c **** { 866 .loc 1 87 0 0 00004B5A 803D00 cmp byte ptr [di], 0 0 00004B5D 741C je _.L99 90:fatdir.c **** 869 .loc 1 90 0 0 00004B5F 8D4501 lea ax, [1+di] 871 _.LVL95: 95:fatdir.c **** break; 872 .loc 1 95 0 0 00004B62 807D0100 cmp byte ptr [di+1], 0 0 00004B66 7413 je _.L99 101:fatdir.c **** 875 .loc 1 101 0 0 00004B68 50 push ax 0 00004B69 FF76FE push word ptr [bp-2] 0 00004B6C E8[FEFF] call _ConvertNameSZToName83 879 _.LVL96: 0 00004B6F 97 xchg di, ax 881 _.LVL97: 105:fatdir.c **** break; 882 .loc 1 105 0 0 00004B70 837E0A00 cmp word ptr [bp+10], 0 0 00004B74 741A je _.L101 105:fatdir.c **** break; 885 .loc 1 105 0 is_stmt 0 discriminator 1 0 00004B76 803D00 cmp byte ptr [di], 0 0 00004B79 7515 jne _.L101 888 _.LVL98: 889 _.L99: 136:fatdir.c **** 890 .loc 1 136 0 is_stmt 1 0 00004B7B 96 xchg si, ax 0 00004B7C 89EC mov sp, bp 0 00004B7E 5D pop bp 0 00004B7F 5F pop di 0 00004B80 5E pop si 0 00004B81 C20600 ret 6 897 _.LVL99: 898 _.L93: 114:fatdir.c **** fcbmatch(fcbname, fnp->f_dir.dir_name)) 899 .loc 1 114 0 0 00004B84 F6440F08 test byte ptr [si+15], 8 0 00004B88 7413 je _.L90 902 _.L92: 120:fatdir.c **** } 903 .loc 1 120 0 0 00004B8A 8B5C02 mov bx, word ptr [si+2] 0 00004B8D FF470D inc word ptr [bx+13] 906 _.L101: 112:fatdir.c **** { 907 .loc 1 112 0 0 00004B90 56 push si 0 00004B91 E8[FEFF] call _dir_read 910 _.LVL100: 0 00004B94 83F801 cmp ax, 1 0 00004B97 74EB je _.L93 913 _.L95: 125:fatdir.c **** } 914 .loc 1 125 0 0 00004B99 31F6 xor si, si 0 00004B9B EBDE jmp _.L99 917 _.L90: 115:fatdir.c **** { 918 .loc 1 115 0 discriminator 1 0 00004B9D 8D5404 lea dx, [4+si] 0 00004BA0 52 push dx 0 00004BA1 8956FC mov word ptr [bp-4], dx 0 00004BA4 FF76FE push word ptr [bp-2] 0 00004BA7 E8[FEFF] call _fcbmatch 924 _.LVL101: 114:fatdir.c **** fcbmatch(fcbname, fnp->f_dir.dir_name)) 925 .loc 1 114 0 discriminator 1 0 00004BAA 85C0 test ax, ax 0 00004BAC 8B56FC mov dx, word ptr [bp-4] 0 00004BAF 74D9 je _.L92 929 _.LVL102: 123:fatdir.c **** { 930 .loc 1 123 0 0 00004BB1 F6440F10 test byte ptr [si+15], 16 0 00004BB5 74E2 je _.L95 131:fatdir.c **** fnp->f_dmp->dm_entry = 0; 933 .loc 1 131 0 0 00004BB7 52 push dx 0 00004BB8 FF742B push word ptr [si+43] 0 00004BBB FF7429 push word ptr [si+41] 0 00004BBE E8[FEFF] call _getdstart 938 _.LVL103: 0 00004BC1 52 push dx 0 00004BC2 50 push ax 0 00004BC3 56 push si 0 00004BC4 E8[FEFF] call _dir_init_fnode 943 _.LVL104: 132:fatdir.c **** } 944 .loc 1 132 0 0 00004BC7 8B5C02 mov bx, word ptr [si+2] 0 00004BCA C7470D0000 mov word ptr [bx+13], 0 0 00004BCF EB89 jmp _.L85 948 _.LFE5: 949 .size _dir_open, .-_dir_open === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: fatfs.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=fatfs.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccowGYfX.s output file : fatfs.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _sft_to_fnode, @function 8 _sft_to_fnode: 9 _.LFB46: 10 .file 1 "fatfs.c" 1:fatfs.c **** /****************************************************************/ 2:fatfs.c **** /* */ 3:fatfs.c **** /* fatfs.c */ 4:fatfs.c **** /* DOS-C */ 5:fatfs.c **** /* */ 6:fatfs.c **** /* FAT File System I/O Functions */ 7:fatfs.c **** /* */ 8:fatfs.c **** /* Copyright (c) 1995,1998 */ 9:fatfs.c **** /* Pasquale J. Villani */ 10:fatfs.c **** /* All Rights Reserved */ 11:fatfs.c **** /* */ 12:fatfs.c **** /* This file is part of DOS-C. */ 13:fatfs.c **** /* */ 14:fatfs.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:fatfs.c **** /* modify it under the terms of the GNU General Public License */ 16:fatfs.c **** /* as published by the Free Software Foundation; either version */ 17:fatfs.c **** /* 2, or (at your option) any later version. */ 18:fatfs.c **** /* */ 19:fatfs.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:fatfs.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:fatfs.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:fatfs.c **** /* the GNU General Public License for more details. */ 23:fatfs.c **** /* */ 24:fatfs.c **** /* You should have received a copy of the GNU General Public */ 25:fatfs.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:fatfs.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:fatfs.c **** /* Cambridge, MA 02139, USA. */ 28:fatfs.c **** /****************************************************************/ 29:fatfs.c **** 30:fatfs.c **** #include "portab.h" 31:fatfs.c **** #include "globals.h" 32:fatfs.c **** #include "debug.h" 33:fatfs.c **** 34:fatfs.c **** 35:fatfs.c **** /* */ 36:fatfs.c **** /* function prototypes */ 37:fatfs.c **** /* */ 38:fatfs.c **** STATIC f_node_ptr sft_to_fnode(int fd); 39:fatfs.c **** STATIC void fnode_to_sft(f_node_ptr fnp); 40:fatfs.c **** STATIC int find_fname(const char *path, int attr, f_node_ptr fnp); 41:fatfs.c **** /* /// Added - Ron Cemer */ 42:fatfs.c **** STATIC int merge_file_changes(f_node_ptr fnp, int collect); 43:fatfs.c **** STATIC BOOL find_free(f_node_ptr); 44:fatfs.c **** STATIC int alloc_find_free(f_node_ptr fnp, char *path); 45:fatfs.c **** STATIC VOID wipe_out(f_node_ptr); 46:fatfs.c **** STATIC CLUSTER extend(f_node_ptr); 47:fatfs.c **** STATIC COUNT extend_dir(f_node_ptr); 48:fatfs.c **** CLUSTER first_fat(f_node_ptr); 49:fatfs.c **** COUNT map_cluster(f_node_ptr, COUNT); 50:fatfs.c **** STATIC int shrink_file(f_node_ptr fnp); 51:fatfs.c **** 52:fatfs.c **** /* FAT time notation in the form of hhhh hmmm mmmd dddd (d = double second) */ 53:fatfs.c **** STATIC dtime time_encode(struct dostime *t) 54:fatfs.c **** { 55:fatfs.c **** return (t->hour << 11) | (t->minute << 5) | (t->second >> 1); 56:fatfs.c **** } 57:fatfs.c **** 58:fatfs.c **** #ifdef WITHFAT32 59:fatfs.c **** CLUSTER getdstart(struct dpb FAR *dpbp, struct dirent *dentry) 60:fatfs.c **** { 61:fatfs.c **** if (!ISFAT32(dpbp)) 62:fatfs.c **** return dentry->dir_start; 63:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 64:fatfs.c **** } 65:fatfs.c **** 66:fatfs.c **** void setdstart(struct dpb FAR *dpbp, struct dirent *dentry, CLUSTER value) 67:fatfs.c **** { 68:fatfs.c **** dentry->dir_start = (UWORD)value; 69:fatfs.c **** if (ISFAT32(dpbp)) 70:fatfs.c **** dentry->dir_start_high = (UWORD)(value >> 16); 71:fatfs.c **** } 72:fatfs.c **** #endif 73:fatfs.c **** 74:fatfs.c **** ULONG clus2phys(CLUSTER cl_no, struct dpb FAR * dpbp) 75:fatfs.c **** { 76:fatfs.c **** CLUSTER data = 77:fatfs.c **** #ifdef WITHFAT32 78:fatfs.c **** ISFAT32(dpbp) ? dpbp->dpb_xdata : 79:fatfs.c **** #endif 80:fatfs.c **** dpbp->dpb_data; 81:fatfs.c **** return ((ULONG) (cl_no - 2) << dpbp->dpb_shftcnt) + data; 82:fatfs.c **** } 83:fatfs.c **** 84:fatfs.c **** struct dpb FAR *get_dpb(COUNT dsk) 85:fatfs.c **** { 86:fatfs.c **** register struct cds FAR *cdsp = get_cds(dsk); 87:fatfs.c **** 88:fatfs.c **** if (cdsp == NULL || cdsp->cdsFlags & CDSNETWDRV) 89:fatfs.c **** return NULL; 90:fatfs.c **** return cdsp->cdsDpb; 91:fatfs.c **** } 92:fatfs.c **** 93:fatfs.c **** /* initialize directory entry (creation/access stamps 0 as per MS-DOS 7.10) */ 94:fatfs.c **** STATIC void init_direntry(struct dirent *dentry, unsigned attrib, 95:fatfs.c **** CLUSTER cluster, char *name) 96:fatfs.c **** { 97:fatfs.c **** memset(dentry, 0, sizeof(struct dirent)); 98:fatfs.c **** memcpy(dentry->dir_name, name, FNAME_SIZE + FEXT_SIZE); 99:fatfs.c **** #ifdef WITHFAT32 100:fatfs.c **** dentry->dir_start_high = (UWORD)(cluster >> 16); 101:fatfs.c **** #endif 102:fatfs.c **** dentry->dir_start = (UWORD)cluster; 103:fatfs.c **** dentry->dir_attrib = (UBYTE)attrib; 104:fatfs.c **** /* set create and last modified time & date */ 105:fatfs.c **** dentry->dir_crtime = dentry->dir_time = dos_gettime(); 106:fatfs.c **** dentry->dir_crdate = dentry->dir_date = dos_getdate(); 107:fatfs.c **** } 108:fatfs.c **** 109:fatfs.c **** /************************************************************************/ 110:fatfs.c **** /* */ 111:fatfs.c **** /* Internal file handlers - open, create, read, write, close, etc. */ 112:fatfs.c **** /* */ 113:fatfs.c **** /************************************************************************/ 114:fatfs.c **** 115:fatfs.c **** /* Open a file given the path. Flags is 0 for read, 1 for write and 2 */ 116:fatfs.c **** /* for update. */ 117:fatfs.c **** /* Returns an long where the high word is a status code and the low */ 118:fatfs.c **** /* word is an integer file descriptor or a negative error code */ 119:fatfs.c **** /* see DosOpenSft(), dosfns.c for an explanation of the flags bits */ 120:fatfs.c **** /* directory opens are allowed here; these are not allowed by DosOpenSft*/ 121:fatfs.c **** 122:fatfs.c **** int dos_open(char *path, unsigned flags, unsigned attrib, int fd) 123:fatfs.c **** { 124:fatfs.c **** REG f_node_ptr fnp = sft_to_fnode(fd); 125:fatfs.c **** int status = find_fname(path, D_ALL | attrib, fnp); 126:fatfs.c **** 127:fatfs.c **** /* Check that we don't have a duplicate name, so if we */ 128:fatfs.c **** /* find one, truncate it (O_CREAT). */ 129:fatfs.c **** if (status == SUCCESS) 130:fatfs.c **** { 131:fatfs.c **** unsigned char dir_attrib = fnp->f_dir.dir_attrib; 132:fatfs.c **** if (flags & O_TRUNC) 133:fatfs.c **** { 134:fatfs.c **** /* The only permissable attribute is archive, */ 135:fatfs.c **** /* check for any other bit set. If it is, give */ 136:fatfs.c **** /* an access error. */ 137:fatfs.c **** if ((dir_attrib & (D_RDONLY | D_DIR | D_VOLID)) 138:fatfs.c **** || (dir_attrib & ~D_ARCHIVE & ~attrib)) 139:fatfs.c **** return DE_ACCESS; 140:fatfs.c **** 141:fatfs.c **** /* Release the existing files FAT and set the */ 142:fatfs.c **** /* length to zero, effectively truncating the */ 143:fatfs.c **** /* file to zero. */ 144:fatfs.c **** wipe_out(fnp); 145:fatfs.c **** status = S_REPLACED; 146:fatfs.c **** } 147:fatfs.c **** else if (flags & O_OPEN) 148:fatfs.c **** { 149:fatfs.c **** /* force r/o open for FCB if the file is read-only */ 150:fatfs.c **** if ((flags & O_FCB) && (dir_attrib & D_RDONLY)) 151:fatfs.c **** flags = (flags & ~3) | O_RDONLY; 152:fatfs.c **** 153:fatfs.c **** /* Check permissions. -- JPP 154:fatfs.c **** (do not allow to open volume labels/directories, 155:fatfs.c **** and do not allow writing to r/o files) */ 156:fatfs.c **** if ((dir_attrib & (D_DIR | D_VOLID)) || 157:fatfs.c **** ((dir_attrib & D_RDONLY) && ((flags & O_ACCMODE) != O_RDONLY))) 158:fatfs.c **** return DE_ACCESS; 159:fatfs.c **** status = S_OPENED; 160:fatfs.c **** } 161:fatfs.c **** else 162:fatfs.c **** { 163:fatfs.c **** return DE_FILEEXISTS; 164:fatfs.c **** } 165:fatfs.c **** } 166:fatfs.c **** else if (status == DE_FILENOTFND && (flags & O_CREAT)) 167:fatfs.c **** { 168:fatfs.c **** int ret = alloc_find_free(fnp, path); 169:fatfs.c **** if (ret != SUCCESS) 170:fatfs.c **** return ret; 171:fatfs.c **** status = S_CREATED; 172:fatfs.c **** } 173:fatfs.c **** else 174:fatfs.c **** { 175:fatfs.c **** /* open: If we can't find the file, just return a not */ 176:fatfs.c **** /* found error. */ 177:fatfs.c **** return status; 178:fatfs.c **** } 179:fatfs.c **** 180:fatfs.c **** /* Now change to file */ 181:fatfs.c **** fnp->f_sft_idx = fd; 182:fatfs.c **** fnp->f_offset = 0l; 183:fatfs.c **** fnp->f_cluster_offset = 0; 184:fatfs.c **** 185:fatfs.c **** fnp->f_flags &= ~SFT_FDATE; 186:fatfs.c **** /* use FCLEAN even on replaced/created files: the bit is reset */ 187:fatfs.c **** /* if the file is written to later */ 188:fatfs.c **** fnp->f_flags |= SFT_FCLEAN; 189:fatfs.c **** if (status != S_OPENED) 190:fatfs.c **** { 191:fatfs.c **** init_direntry(&fnp->f_dir, attrib, FREE, fnp->f_dmp->dm_name_pat); 192:fatfs.c **** if (!dir_write(fnp)) 193:fatfs.c **** return DE_ACCESS; 194:fatfs.c **** } 195:fatfs.c **** 196:fatfs.c **** merge_file_changes(fnp, status == S_OPENED); /* /// Added - Ron Cemer */ 197:fatfs.c **** /* /// Moved from above. - Ron Cemer */ 198:fatfs.c **** fnp->f_cluster = getdstart(fnp->f_dpb, &fnp->f_dir); 199:fatfs.c **** 200:fatfs.c **** fnode_to_sft(fnp); 201:fatfs.c **** return status; 202:fatfs.c **** } 203:fatfs.c **** 204:fatfs.c **** BOOL fcmp_wild(const char * s1, const char * s2, unsigned n) 205:fatfs.c **** { 206:fatfs.c **** for ( ; n--; ++s1, ++s2) 207:fatfs.c **** if (*s1 != '?' && *s1 != *s2) 208:fatfs.c **** return FALSE; 209:fatfs.c **** return TRUE; 210:fatfs.c **** } 211:fatfs.c **** 212:fatfs.c **** COUNT dos_close(COUNT fd) 213:fatfs.c **** { 214:fatfs.c **** /* Translate the fd into a useful pointer */ 215:fatfs.c **** f_node_ptr fnp = sft_to_fnode(fd); 216:fatfs.c **** 217:fatfs.c **** if (!(fnp->f_flags & SFT_FCLEAN)) 218:fatfs.c **** { 219:fatfs.c **** if (!(fnp->f_flags & SFT_FDATE)) 220:fatfs.c **** { 221:fatfs.c **** fnp->f_dir.dir_time = dos_gettime(); 222:fatfs.c **** fnp->f_dir.dir_date = dos_getdate(); 223:fatfs.c **** } 224:fatfs.c **** 225:fatfs.c **** merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */ 226:fatfs.c **** } 227:fatfs.c **** fnp->f_sft_idx = 0xff; 228:fatfs.c **** 229:fatfs.c **** return dir_write_update(fnp, TRUE) ? SUCCESS : DE_INVLDHNDL; 230:fatfs.c **** } 231:fatfs.c **** 232:fatfs.c **** /* */ 233:fatfs.c **** /* split a path into it's component directory and file name */ 234:fatfs.c **** /* */ 235:fatfs.c **** f_node_ptr split_path(const char * path, f_node_ptr fnp) 236:fatfs.c **** { 237:fatfs.c **** /* check if the path ends in a backslash */ 238:fatfs.c **** if (path[strlen(path) - 1] == '\\') 239:fatfs.c **** return (f_node_ptr) 0; 240:fatfs.c **** 241:fatfs.c **** /* 11/29/99 jt 242:fatfs.c **** * Networking and Cdroms. You can put in here a return. 243:fatfs.c **** * Maybe a return of 0xDEADBEEF or something for Split or Dir_open. 244:fatfs.c **** * Just to let upper level Fdos know its a sft, CDS function. 245:fatfs.c **** * Right now for Networking there is no support for Rename, MkDir 246:fatfs.c **** * RmDir & Delete. 247:fatfs.c **** 248:fatfs.c **** 250:fatfs.c **** 251:fatfs.c **** */ 252:fatfs.c **** #ifdef DEBUG 253:fatfs.c **** if (get_cds(path[0]-'A')->cdsFlags & CDSNETWDRV) 254:fatfs.c **** { 255:fatfs.c **** printf("split path called for redirected file: `%s'\n", path); 256:fatfs.c **** return (f_node_ptr) 0; 257:fatfs.c **** } 258:fatfs.c **** #endif 259:fatfs.c **** 260:fatfs.c **** /* Translate the path into a useful pointer */ 261:fatfs.c **** return dir_open(path, TRUE, fnp); 262:fatfs.c **** } 263:fatfs.c **** 264:fatfs.c **** /* checks whether directory part of path exists */ 265:fatfs.c **** BOOL dir_exists(char * path) 266:fatfs.c **** { 267:fatfs.c **** return split_path(path, &fnode[0]) != NULL; 268:fatfs.c **** } 269:fatfs.c **** 270:fatfs.c **** BOOL fcbmatch(const char *fcbname1, const char *fcbname2) 271:fatfs.c **** { 272:fatfs.c **** return memcmp(fcbname1, fcbname2, FNAME_SIZE + FEXT_SIZE) == 0; 273:fatfs.c **** } 274:fatfs.c **** 275:fatfs.c **** STATIC int find_fname(const char *path, int attr, f_node_ptr fnp) 276:fatfs.c **** { 277:fatfs.c **** /* check for leading backslash and open the directory given that */ 278:fatfs.c **** /* contains the file given by path. */ 279:fatfs.c **** if ((fnp = split_path(path, fnp)) == NULL) 280:fatfs.c **** return DE_PATHNOTFND; 281:fatfs.c **** 282:fatfs.c **** while (dir_read(fnp) == 1) 283:fatfs.c **** { 284:fatfs.c **** if (fcbmatch(fnp->f_dir.dir_name, fnp->f_dmp->dm_name_pat) 285:fatfs.c **** && (fnp->f_dir.dir_attrib & ~(D_RDONLY | D_ARCHIVE | attr)) == 0) 286:fatfs.c **** { 287:fatfs.c **** return SUCCESS; 288:fatfs.c **** } 289:fatfs.c **** fnp->f_dmp->dm_entry++; 290:fatfs.c **** } 291:fatfs.c **** return DE_FILENOTFND; 292:fatfs.c **** } 293:fatfs.c **** 294:fatfs.c **** /* Description. 295:fatfs.c **** * Remove entries with D_LFN attribute preceeding the directory entry 296:fatfs.c **** * pointed by fnp, fnode isn't modified (I hope). 297:fatfs.c **** * Return value. 298:fatfs.c **** * SUCCESS - completed successfully. 299:fatfs.c **** * DE_ACCESS - error occurred, fnode is released. 300:fatfs.c **** * input: fnp with valid non-LFN directory entry, not equal to '..' or 301:fatfs.c **** * '.' 302:fatfs.c **** */ 303:fatfs.c **** COUNT remove_lfn_entries(f_node_ptr fnp) 304:fatfs.c **** { 305:fatfs.c **** unsigned original_diroff = fnp->f_dmp->dm_entry; 306:fatfs.c **** 307:fatfs.c **** while (TRUE) 308:fatfs.c **** { 309:fatfs.c **** if (fnp->f_dmp->dm_entry == 0) 310:fatfs.c **** break; 311:fatfs.c **** fnp->f_dmp->dm_entry--; 312:fatfs.c **** if (dir_read(fnp) <= 0) 313:fatfs.c **** return DE_ACCESS; 314:fatfs.c **** if (fnp->f_dir.dir_attrib != D_LFN) 315:fatfs.c **** break; 316:fatfs.c **** fnp->f_dir.dir_name[0] = DELETED; 317:fatfs.c **** if (!dir_write(fnp)) return DE_ACCESS; 318:fatfs.c **** } 319:fatfs.c **** fnp->f_dmp->dm_entry = original_diroff; 320:fatfs.c **** if (dir_read(fnp) <= 0) 321:fatfs.c **** return DE_ACCESS; 322:fatfs.c **** 323:fatfs.c **** return SUCCESS; 324:fatfs.c **** } 325:fatfs.c **** 326:fatfs.c **** /* /// Added - Ron Cemer */ 327:fatfs.c **** /* If more than one SFT has a file open, and a write 328:fatfs.c **** occurs, this function must be called to propagate the 329:fatfs.c **** results of that write to the other f_nodes which have 330:fatfs.c **** that file open. Note that this function only has an 331:fatfs.c **** effect if SHARE is installed. This is for compatibility 332:fatfs.c **** reasons, since DOS without SHARE does not share changes 333:fatfs.c **** between two or more open instances of the same file 334:fatfs.c **** unless these instances were generated by dup() or dup2(). */ 335:fatfs.c **** STATIC int merge_file_changes(f_node_ptr fnp, int collect) 336:fatfs.c **** { 337:fatfs.c **** int i, j; 338:fatfs.c **** sft FAR *sftp; 339:fatfs.c **** sfttbl FAR *sp; 340:fatfs.c **** 341:fatfs.c **** if (!IsShareInstalled(FALSE)) 342:fatfs.c **** return SUCCESS; 343:fatfs.c **** 344:fatfs.c **** i = 0; 345:fatfs.c **** for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next) 346:fatfs.c **** { 347:fatfs.c **** for(j = sp->sftt_count, sftp = sp->sftt_table; --j >= 0; sftp++, i++) 348:fatfs.c **** { 349:fatfs.c **** if (i != fnp->f_sft_idx && sftp->sft_count != 0 350:fatfs.c **** && fnp->f_dpb == sftp->sft_dcb 351:fatfs.c **** && (fnp->f_dir.dir_attrib & D_VOLID) == 0 352:fatfs.c **** && (sftp->sft_attrib & D_VOLID) == 0 353:fatfs.c **** && fnp->f_diridx == sftp->sft_diridx 354:fatfs.c **** && fnp->f_dirsector == sftp->sft_dirsector 355:fatfs.c **** ) /* same file, but different FD */ 356:fatfs.c **** { 357:fatfs.c **** if (collect == -1) 358:fatfs.c **** { 359:fatfs.c **** /* set attrib: close open files */ 360:fatfs.c **** int rc = DosCloseSft(i, FALSE); 361:fatfs.c **** if (rc != SUCCESS) 362:fatfs.c **** return rc; 363:fatfs.c **** } 364:fatfs.c **** else if (collect) 365:fatfs.c **** { 366:fatfs.c **** /* We're collecting file changes from any other 367:fatfs.c **** SFT which refers to this file. */ 368:fatfs.c **** if ((sftp->sft_mode & O_ACCMODE) != RDONLY) 369:fatfs.c **** { 370:fatfs.c **** setdstart(fnp->f_dpb, &fnp->f_dir, sftp->sft_stclust); 371:fatfs.c **** fnp->f_dir.dir_size = sftp->sft_size; 372:fatfs.c **** fnp->f_dir.dir_date = sftp->sft_date; 373:fatfs.c **** fnp->f_dir.dir_time = sftp->sft_time; 374:fatfs.c **** return SUCCESS; 375:fatfs.c **** } 376:fatfs.c **** } 377:fatfs.c **** else 378:fatfs.c **** { 379:fatfs.c **** /* We just made changes to this file, so we are 380:fatfs.c **** distributing these changes to the other f_nodes 381:fatfs.c **** which refer to this file. */ 382:fatfs.c **** sftp->sft_stclust = getdstart(fnp->f_dpb, &fnp->f_dir); 383:fatfs.c **** sftp->sft_size = fnp->f_dir.dir_size; 384:fatfs.c **** sftp->sft_date = fnp->f_dir.dir_date; 385:fatfs.c **** sftp->sft_time = fnp->f_dir.dir_time; 386:fatfs.c **** } 387:fatfs.c **** } 388:fatfs.c **** } 389:fatfs.c **** } 390:fatfs.c **** return SUCCESS; 391:fatfs.c **** } 392:fatfs.c **** 393:fatfs.c **** void dos_merge_file_changes(int fd) 394:fatfs.c **** { 395:fatfs.c **** merge_file_changes(sft_to_fnode(fd), FALSE); 396:fatfs.c **** } 397:fatfs.c **** 398:fatfs.c **** STATIC COUNT delete_dir_entry(f_node_ptr fnp) 399:fatfs.c **** { 400:fatfs.c **** COUNT rc; 401:fatfs.c **** 402:fatfs.c **** /* Ok, so we can delete. Start out by */ 403:fatfs.c **** /* clobbering all FAT entries for this file */ 404:fatfs.c **** /* (or, in English, truncate the FAT). */ 405:fatfs.c **** if ((rc = remove_lfn_entries(fnp)) < 0) 406:fatfs.c **** return rc; 407:fatfs.c **** 408:fatfs.c **** wipe_out(fnp); 409:fatfs.c **** *(fnp->f_dir.dir_name) = DELETED; 410:fatfs.c **** 411:fatfs.c **** /* The directory has been modified, so set the */ 412:fatfs.c **** /* bit before closing it, allowing it to be */ 413:fatfs.c **** /* updated */ 414:fatfs.c **** if (!dir_write(fnp)) 415:fatfs.c **** return DE_ACCESS; 416:fatfs.c **** 417:fatfs.c **** /* SUCCESSful completion, return it */ 418:fatfs.c **** return SUCCESS; 419:fatfs.c **** } 420:fatfs.c **** 421:fatfs.c **** COUNT dos_delete(BYTE * path, int attrib) 422:fatfs.c **** { 423:fatfs.c **** REG f_node_ptr fnp = &fnode[0]; 424:fatfs.c **** 425:fatfs.c **** /* Check that we don't have a duplicate name, so if we */ 426:fatfs.c **** /* find one, it's an error. */ 427:fatfs.c **** int ret = find_fname(path, attrib, fnp); 428:fatfs.c **** if (ret == SUCCESS) 429:fatfs.c **** { 430:fatfs.c **** /* Do not delete directories or r/o files */ 431:fatfs.c **** /* lfn entries and volume labels are only found */ 432:fatfs.c **** /* by find_fname() if attrib is set to a */ 433:fatfs.c **** /* special value */ 434:fatfs.c **** if (fnp->f_dir.dir_attrib & (D_RDONLY | D_DIR)) 435:fatfs.c **** return DE_ACCESS; 436:fatfs.c **** 437:fatfs.c **** return delete_dir_entry(fnp); 438:fatfs.c **** } 439:fatfs.c **** else 440:fatfs.c **** /* No such file, return the error */ 441:fatfs.c **** return ret; 442:fatfs.c **** } 443:fatfs.c **** 444:fatfs.c **** COUNT dos_rmdir(BYTE * path) 445:fatfs.c **** { 446:fatfs.c **** REG f_node_ptr fnp; 447:fatfs.c **** 448:fatfs.c **** /* prevent removal of the current directory of that drive */ 449:fatfs.c **** register struct cds FAR *cdsp = get_cds(path[0] - 'A'); 450:fatfs.c **** if (!fstrcmp(path, cdsp->cdsCurrentPath)) 451:fatfs.c **** return DE_RMVCUDIR; 452:fatfs.c **** 453:fatfs.c **** /* Check that we're not trying to remove the root! */ 454:fatfs.c **** if (path[2] == '\\' && path[3] == '\0') 455:fatfs.c **** return DE_ACCESS; 456:fatfs.c **** 457:fatfs.c **** /* Check that the directory is empty. Only the */ 458:fatfs.c **** /* "." and ".." are permissable. */ 459:fatfs.c **** fnp = dir_open(path, FALSE, &fnode[0]); 460:fatfs.c **** if (fnp == NULL) 461:fatfs.c **** return DE_PATHNOTFND; 462:fatfs.c **** 463:fatfs.c **** /* Directories may have attributes, but if other than 'archive' */ 464:fatfs.c **** /* or 'read only' then deny i.e. do not allow (SYSTEM|HIDDEN) */ 465:fatfs.c **** /* directory to be deleted. */ 466:fatfs.c **** if (fnp->f_dir.dir_attrib & ~(D_DIR | D_RDONLY | D_ARCHIVE)) 467:fatfs.c **** return DE_ACCESS; 468:fatfs.c **** 469:fatfs.c **** dir_read(fnp); 470:fatfs.c **** /* 1st entry should be ".", else directory corrupt or not empty */ 471:fatfs.c **** if (fnp->f_dir.dir_name[0] != '.' || fnp->f_dir.dir_name[1] != ' ') 472:fatfs.c **** return DE_ACCESS; 473:fatfs.c **** 474:fatfs.c **** fnp->f_dmp->dm_entry++; 475:fatfs.c **** dir_read(fnp); 476:fatfs.c **** /* second entry should be ".." */ 477:fatfs.c **** if (fnp->f_dir.dir_name[0] != '.' || fnp->f_dir.dir_name[1] != '.') 478:fatfs.c **** return DE_ACCESS; 479:fatfs.c **** 480:fatfs.c **** /* Now search through the directory and make certain */ 481:fatfs.c **** /* that there are no entries */ 482:fatfs.c **** fnp->f_dmp->dm_entry++; 483:fatfs.c **** while (dir_read(fnp) == 1) 484:fatfs.c **** { 485:fatfs.c **** /* If anything was found, exit with an error. */ 486:fatfs.c **** if (fnp->f_dir.dir_name[0] != DELETED && fnp->f_dir.dir_attrib != D_LFN) 487:fatfs.c **** return DE_ACCESS; 488:fatfs.c **** fnp->f_dmp->dm_entry++; 489:fatfs.c **** } 490:fatfs.c **** 491:fatfs.c **** /* next, split the passed dir into components (i.e. - */ 492:fatfs.c **** /* path to new directory and name of new directory */ 493:fatfs.c **** if (find_fname(path, D_ALL, fnp) != SUCCESS) 494:fatfs.c **** /* this error should not happen because dir_open() succeeded above */ 495:fatfs.c **** return DE_PATHNOTFND; 496:fatfs.c **** 497:fatfs.c **** return delete_dir_entry(fnp); 498:fatfs.c **** } 499:fatfs.c **** 500:fatfs.c **** COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib) 501:fatfs.c **** { 502:fatfs.c **** REG f_node_ptr fnp1; 503:fatfs.c **** REG f_node_ptr fnp2; 504:fatfs.c **** COUNT ret; 505:fatfs.c **** char *fcbname; 506:fatfs.c **** 507:fatfs.c **** /* prevent renaming of the current directory of that drive */ 508:fatfs.c **** register struct cds FAR *cdsp = get_cds(path1[0] - 'A'); 509:fatfs.c **** if (!fstrcmp(path1, cdsp->cdsCurrentPath)) 510:fatfs.c **** return DE_RMVCUDIR; 511:fatfs.c **** 512:fatfs.c **** /* first check if the source file exists */ 513:fatfs.c **** fnp1 = &fnode[0]; 514:fatfs.c **** ret = find_fname(path1, attrib, fnp1); 515:fatfs.c **** if (ret != SUCCESS) 516:fatfs.c **** return ret; 517:fatfs.c **** 518:fatfs.c **** /* Check that we don't have a duplicate name, so if we find */ 519:fatfs.c **** /* one, it's an error. */ 520:fatfs.c **** fnp2 = &fnode[1]; 521:fatfs.c **** ret = find_fname(path2, attrib, fnp2); 522:fatfs.c **** if (ret != DE_FILENOTFND) 523:fatfs.c **** return ret == SUCCESS ? DE_ACCESS : ret; 524:fatfs.c **** 525:fatfs.c **** fcbname = fnp2->f_dmp->dm_name_pat; 526:fatfs.c **** if (fnp1->f_dmp->dm_dircluster == fnp2->f_dmp->dm_dircluster) 527:fatfs.c **** { 528:fatfs.c **** /* rename in the same directory: change the directory entry in-place */ 529:fatfs.c **** fnp2 = fnp1; 530:fatfs.c **** if ((ret = remove_lfn_entries(fnp1)) < 0) 531:fatfs.c **** return ret; 532:fatfs.c **** } 533:fatfs.c **** else 534:fatfs.c **** { 535:fatfs.c **** /* do not allow to rename directories between different directories */ 536:fatfs.c **** if (fnp1->f_dir.dir_attrib & D_DIR) 537:fatfs.c **** return DE_ACCESS; 538:fatfs.c **** 539:fatfs.c **** /* create new entry in other directory */ 540:fatfs.c **** ret = alloc_find_free(fnp2, path2); 541:fatfs.c **** if (ret != SUCCESS) 542:fatfs.c **** return ret; 543:fatfs.c **** 544:fatfs.c **** if ((ret = remove_lfn_entries(fnp1)) < 0) 545:fatfs.c **** return ret; 546:fatfs.c **** 547:fatfs.c **** /* init fnode for new file name to match old file name */ 548:fatfs.c **** memcpy(&fnp2->f_dir, &fnp1->f_dir, sizeof(struct dirent)); 549:fatfs.c **** 550:fatfs.c **** /* Ok, so we can delete this one. Save the file info. */ 551:fatfs.c **** *(fnp1->f_dir.dir_name) = DELETED; 552:fatfs.c **** 553:fatfs.c **** if (!dir_write(fnp1)) 554:fatfs.c **** return DE_ACCESS; 555:fatfs.c **** } 556:fatfs.c **** 557:fatfs.c **** /* put the fnode's name into the directory. */ 558:fatfs.c **** memcpy(fnp2->f_dir.dir_name, fcbname, FNAME_SIZE + FEXT_SIZE); 559:fatfs.c **** 560:fatfs.c **** /* SUCCESSful completion, return it */ 561:fatfs.c **** return dir_write(fnp2) ? SUCCESS : DE_ACCESS; 562:fatfs.c **** } 563:fatfs.c **** 564:fatfs.c **** /* */ 565:fatfs.c **** /* wipe out all FAT entries starting from st for create, delete, etc. */ 566:fatfs.c **** /* */ 567:fatfs.c **** STATIC VOID wipe_out_clusters(struct dpb FAR * dpbp, CLUSTER st) 568:fatfs.c **** { 569:fatfs.c **** REG CLUSTER next; 570:fatfs.c **** 571:fatfs.c **** /* Loop from start until either a FREE entry is */ 572:fatfs.c **** /* encountered (due to a fractured file system) of the */ 573:fatfs.c **** /* last cluster is encountered. */ 574:fatfs.c **** while (st != LONG_LAST_CLUSTER) /* remove clusters at start until empty */ 575:fatfs.c **** { 576:fatfs.c **** /* get the next cluster pointed to */ 577:fatfs.c **** next = next_cluster(dpbp, st); 578:fatfs.c **** 579:fatfs.c **** /* just exit if a damaged file system exists */ 580:fatfs.c **** if (next <= 1) 581:fatfs.c **** return; 582:fatfs.c **** 583:fatfs.c **** /* zap the FAT pointed to */ 584:fatfs.c **** if (link_fat(dpbp, st, FREE) != SUCCESS) /* nonfree->free */ 585:fatfs.c **** return; /* better abort on error */ 586:fatfs.c **** 587:fatfs.c **** /* and the start of free space pointer */ 588:fatfs.c **** #ifdef WITHFAT32 589:fatfs.c **** if (ISFAT32(dpbp)) 590:fatfs.c **** { 591:fatfs.c **** if ((dpbp->dpb_xcluster == UNKNCLUSTER) || (dpbp->dpb_xcluster > st)) 592:fatfs.c **** dpbp->dpb_xcluster = st; 593:fatfs.c **** } 594:fatfs.c **** else 595:fatfs.c **** #endif 596:fatfs.c **** if ((dpbp->dpb_cluster == UNKNCLUSTER) || (dpbp->dpb_cluster > (UWORD)st)) 597:fatfs.c **** dpbp->dpb_cluster = (UWORD)st; 598:fatfs.c **** 599:fatfs.c **** /* and just follow the linked list */ 600:fatfs.c **** st = next; 601:fatfs.c **** } 602:fatfs.c **** #ifdef WITHFAT32 603:fatfs.c **** if (ISFAT32(dpbp)) 604:fatfs.c **** write_fsinfo(dpbp); 605:fatfs.c **** #endif 606:fatfs.c **** } 607:fatfs.c **** 608:fatfs.c **** /* wipe out all FAT entries for create, delete, etc. */ 609:fatfs.c **** /* called by delete_dir_entry and dos_open open in O_TRUNC mode */ 610:fatfs.c **** STATIC VOID wipe_out(f_node_ptr fnp) 611:fatfs.c **** { 612:fatfs.c **** /* if not already free and valid file, do it */ 613:fatfs.c **** CLUSTER cluster = getdstart(fnp->f_dpb, &fnp->f_dir); 614:fatfs.c **** if (cluster != FREE) 615:fatfs.c **** wipe_out_clusters(fnp->f_dpb, cluster); 616:fatfs.c **** /* no flushing here: could get lost chain or "crosslink seed" but */ 617:fatfs.c **** /* it would be annoying if mass-deletes could not use BUFFERS... */ 618:fatfs.c **** } 619:fatfs.c **** 620:fatfs.c **** STATIC BOOL find_free(f_node_ptr fnp) 621:fatfs.c **** { 622:fatfs.c **** COUNT rc; 623:fatfs.c **** 624:fatfs.c **** while ((rc = dir_read(fnp)) == 1) 625:fatfs.c **** { 626:fatfs.c **** if (fnp->f_dir.dir_name[0] == DELETED) 627:fatfs.c **** return TRUE; 628:fatfs.c **** fnp->f_dmp->dm_entry++; 629:fatfs.c **** } 630:fatfs.c **** return rc >= 0; 631:fatfs.c **** } 632:fatfs.c **** 633:fatfs.c **** /* alloc_find_free: resets the directory */ 634:fatfs.c **** /* Then finds a spare directory entry and if not */ 635:fatfs.c **** /* available, tries to extend the directory. */ 636:fatfs.c **** STATIC int alloc_find_free(f_node_ptr fnp, char *path) 637:fatfs.c **** { 638:fatfs.c **** fnp = split_path(path, fnp); 639:fatfs.c **** 640:fatfs.c **** /* Get a free f_node pointer so that we can use */ 641:fatfs.c **** /* it in building the new file. */ 642:fatfs.c **** /* Note that if we're in the root and we don't */ 643:fatfs.c **** /* find an empty slot, we need to abort. */ 644:fatfs.c **** if (find_free(fnp) == 0) 645:fatfs.c **** { 646:fatfs.c **** if (fnp->f_dmp->dm_dircluster == 0) 647:fatfs.c **** { 648:fatfs.c **** return DE_TOOMANY; 649:fatfs.c **** } 650:fatfs.c **** else 651:fatfs.c **** { 652:fatfs.c **** /* Otherwise just expand the directory */ 653:fatfs.c **** int ret; 654:fatfs.c **** 655:fatfs.c **** if ((ret = extend_dir(fnp)) != SUCCESS) 656:fatfs.c **** /* fnp already closed in extend_dir */ 657:fatfs.c **** return ret; 658:fatfs.c **** } 659:fatfs.c **** } 660:fatfs.c **** return SUCCESS; 661:fatfs.c **** } 662:fatfs.c **** 663:fatfs.c **** 664:fatfs.c **** /* */ 665:fatfs.c **** /* dos_getdate for the file date */ 666:fatfs.c **** /* */ 667:fatfs.c **** ddate dos_getdate(void) 668:fatfs.c **** { 669:fatfs.c **** struct dosdate dd; 670:fatfs.c **** 671:fatfs.c **** /* First - get the system date set by either the user */ 672:fatfs.c **** /* on start-up or the CMOS clock */ 673:fatfs.c **** DosGetDate(&dd); 674:fatfs.c **** return DT_ENCODE(dd.month, dd.monthday, dd.year - EPOCH_YEAR); 675:fatfs.c **** } 676:fatfs.c **** 677:fatfs.c **** /* */ 678:fatfs.c **** /* dos_gettime for the file time */ 679:fatfs.c **** /* */ 680:fatfs.c **** dtime dos_gettime(void) 681:fatfs.c **** { 682:fatfs.c **** struct dostime dt; 683:fatfs.c **** 684:fatfs.c **** /* First - get the system time set by either the user */ 685:fatfs.c **** /* on start-up or the CMOS clock */ 686:fatfs.c **** DosGetTime(&dt); 687:fatfs.c **** return time_encode(&dt); 688:fatfs.c **** } 689:fatfs.c **** 690:fatfs.c **** /* */ 691:fatfs.c **** /* Find free cluster in disk FAT table */ 692:fatfs.c **** /* */ 693:fatfs.c **** STATIC CLUSTER find_fat_free(f_node_ptr fnp) 694:fatfs.c **** { 695:fatfs.c **** REG CLUSTER idx, size, cluster; 696:fatfs.c **** struct dpb FAR *dpbp = fnp->f_dpb; 697:fatfs.c **** 698:fatfs.c **** #ifdef DISPLAY_GETBLOCK 699:fatfs.c **** printf("[find_fat_free]\n"); 700:fatfs.c **** #endif 701:fatfs.c **** 702:fatfs.c **** /* Start from optimized lookup point for start of FAT */ 703:fatfs.c **** idx = 2; 704:fatfs.c **** size = dpbp->dpb_size; 705:fatfs.c **** 706:fatfs.c **** #ifdef WITHFAT32 707:fatfs.c **** if (ISFAT32(dpbp)) 708:fatfs.c **** { 709:fatfs.c **** if (dpbp->dpb_xcluster != UNKNCLUSTER) 710:fatfs.c **** idx = dpbp->dpb_xcluster; 711:fatfs.c **** size = dpbp->dpb_xsize; 712:fatfs.c **** } 713:fatfs.c **** else 714:fatfs.c **** #endif 715:fatfs.c **** if (dpbp->dpb_cluster != UNKNCLUSTER) 716:fatfs.c **** idx = dpbp->dpb_cluster; 717:fatfs.c **** 718:fatfs.c **** /* Search the FAT table looking for the first free */ 719:fatfs.c **** /* entry. */ 720:fatfs.c **** cluster = idx; 721:fatfs.c **** for (;;) 722:fatfs.c **** { 723:fatfs.c **** #ifdef CHECK_FAT_DURING_CLUSTER_ALLOC /* slower but nice side effect ;-) */ 724:fatfs.c **** if (next_cluster(dpbp, idx) == FREE) 725:fatfs.c **** #else 726:fatfs.c **** if (is_free_cluster(dpbp, idx)) 727:fatfs.c **** #endif 728:fatfs.c **** { 729:fatfs.c **** cluster = idx; 730:fatfs.c **** break; 731:fatfs.c **** } 732:fatfs.c **** idx++; 733:fatfs.c **** /* wrap the search just in case there are free clusters before */ 734:fatfs.c **** /* dpbp->dpb_(x)cluster (the fsinfo entry is just a hint!) */ 735:fatfs.c **** if (idx > size) idx = 2; 736:fatfs.c **** if (idx == cluster) { 737:fatfs.c **** /* No empty clusters, disk is FULL! */ 738:fatfs.c **** cluster = UNKNCLUSTER; 739:fatfs.c **** idx = LONG_LAST_CLUSTER; 740:fatfs.c **** break; 741:fatfs.c **** } 742:fatfs.c **** } 743:fatfs.c **** 744:fatfs.c **** #ifdef WITHFAT32 745:fatfs.c **** if (ISFAT32(dpbp)) 746:fatfs.c **** { 747:fatfs.c **** dpbp->dpb_xcluster = cluster; 748:fatfs.c **** /* return the free entry */ 749:fatfs.c **** write_fsinfo(dpbp); 750:fatfs.c **** return idx; 751:fatfs.c **** } 752:fatfs.c **** #endif 753:fatfs.c **** 754:fatfs.c **** dpbp->dpb_cluster = (UWORD)cluster; 755:fatfs.c **** /* return the free entry */ 756:fatfs.c **** return idx; 757:fatfs.c **** } 758:fatfs.c **** 759:fatfs.c **** /* clear out the blocks in the cluster for a directory */ 760:fatfs.c **** STATIC int clear_dir(f_node_ptr fnp, CLUSTER cluster) 761:fatfs.c **** { 762:fatfs.c **** int idx; 763:fatfs.c **** for (idx = 0; idx <= fnp->f_dpb->dpb_clsmask; idx++) 764:fatfs.c **** { 765:fatfs.c **** struct buffer FAR *bp; 766:fatfs.c **** 767:fatfs.c **** /* as we are overwriting it completely, don't read first */ 768:fatfs.c **** bp = getblockOver(clus2phys(cluster, fnp->f_dpb) + idx, 769:fatfs.c **** fnp->f_dpb->dpb_unit); 770:fatfs.c **** #ifdef DISPLAY_GETBLOCK 771:fatfs.c **** printf("DIR (clear_dir)\n"); 772:fatfs.c **** #endif 773:fatfs.c **** if (bp == NULL) 774:fatfs.c **** return DE_ACCESS; 775:fatfs.c **** fmemset(bp->b_buffer, 0, BUFFERSIZE); 776:fatfs.c **** bp->b_flag |= BFR_DIRTY | BFR_VALID; 777:fatfs.c **** 778:fatfs.c **** if (idx != 0) 779:fatfs.c **** bp->b_flag |= BFR_UNCACHE; /* needs not be cached */ 780:fatfs.c **** } 781:fatfs.c **** return SUCCESS; 782:fatfs.c **** } 783:fatfs.c **** 784:fatfs.c **** /* */ 785:fatfs.c **** /* create a directory - returns success or a negative error */ 786:fatfs.c **** /* number */ 787:fatfs.c **** /* */ 788:fatfs.c **** COUNT dos_mkdir(BYTE * dir) 789:fatfs.c **** { 790:fatfs.c **** REG f_node_ptr fnp; 791:fatfs.c **** CLUSTER free_fat, parent; 792:fatfs.c **** COUNT ret; 793:fatfs.c **** 794:fatfs.c **** /* check that the resulting combined path does not exceed 795:fatfs.c **** the 67 MAX_CDSPATH limit. this leads to problems: 796:fatfs.c **** A) you can't CD to this directory later 797:fatfs.c **** B) you can't create files in this subdirectory 798:fatfs.c **** C) the created dir will not be found later, so you 799:fatfs.c **** can create an unlimited amount of same dirs. this space 800:fatfs.c **** is lost forever 801:fatfs.c **** */ 802:fatfs.c **** if (strlen(dir) >= MAX_CDSPATH) /* dir is already output of "truename" */ 803:fatfs.c **** return DE_PATHNOTFND; 804:fatfs.c **** 805:fatfs.c **** /* Check that we don't have a duplicate name, so if we */ 806:fatfs.c **** /* find one, it's an error. */ 807:fatfs.c **** fnp = &fnode[0]; 808:fatfs.c **** ret = find_fname(dir, D_ALL, fnp); 809:fatfs.c **** if (ret != DE_FILENOTFND) 810:fatfs.c **** return ret == SUCCESS ? DE_ACCESS : ret; 811:fatfs.c **** 812:fatfs.c **** parent = fnp->f_dmp->dm_dircluster; 813:fatfs.c **** 814:fatfs.c **** ret = alloc_find_free(fnp, dir); 815:fatfs.c **** if (ret != SUCCESS) 816:fatfs.c **** return ret; 817:fatfs.c **** 818:fatfs.c **** /* get an empty cluster, so that we make it into a */ 819:fatfs.c **** /* directory. */ 820:fatfs.c **** /* TE this has to be done (and failed) BEFORE the dir entry */ 821:fatfs.c **** /* is changed */ 822:fatfs.c **** free_fat = find_fat_free(fnp); 823:fatfs.c **** 824:fatfs.c **** /* No empty clusters, disk is FULL! Translate into a */ 825:fatfs.c **** /* useful error message. */ 826:fatfs.c **** if (free_fat == LONG_LAST_CLUSTER) 827:fatfs.c **** return DE_HNDLDSKFULL; 828:fatfs.c **** 829:fatfs.c **** init_direntry(&fnp->f_dir, D_DIR, free_fat, fnp->f_dmp->dm_name_pat); 830:fatfs.c **** 831:fatfs.c **** /* Mark the cluster in the FAT as used and create new dir there */ 832:fatfs.c **** if (link_fat(fnp->f_dpb, free_fat, LONG_LAST_CLUSTER) != SUCCESS) /* free->last */ 833:fatfs.c **** return DE_HNDLDSKFULL; /* should never happen */ 834:fatfs.c **** 835:fatfs.c **** /* clean out the new directory */ 836:fatfs.c **** ret = clear_dir(fnp, free_fat); 837:fatfs.c **** if (ret != SUCCESS) 838:fatfs.c **** return ret; 839:fatfs.c **** 840:fatfs.c **** /* Write the new directory entry */ 841:fatfs.c **** if (!dir_write(fnp)) 842:fatfs.c **** return DE_ACCESS; 843:fatfs.c **** 844:fatfs.c **** /* Craft the new directory. Note that if we're in a new */ 845:fatfs.c **** /* directory just under the root, ".." pointer is 0. */ 846:fatfs.c **** 847:fatfs.c **** dir_init_fnode(fnp, free_fat); 848:fatfs.c **** fnp->f_dmp->dm_entry = 0; 849:fatfs.c **** find_free(fnp); 850:fatfs.c **** 851:fatfs.c **** /* Create the "." entry */ 852:fatfs.c **** init_direntry(&fnp->f_dir, D_DIR, free_fat, ". "); 853:fatfs.c **** 854:fatfs.c **** /* And put it out */ 855:fatfs.c **** if (!dir_write(fnp)) 856:fatfs.c **** return DE_ACCESS; 857:fatfs.c **** 858:fatfs.c **** /* create the ".." entry */ 859:fatfs.c **** if (!find_free(fnp) && ((ret = extend_dir(fnp)) != SUCCESS)) 860:fatfs.c **** return ret; 861:fatfs.c **** #ifdef WITHFAT32 862:fatfs.c **** if (ISFAT32(fnp->f_dpb) && parent == fnp->f_dpb->dpb_xrootclst) 863:fatfs.c **** { 864:fatfs.c **** parent = 0; 865:fatfs.c **** } 866:fatfs.c **** #endif 867:fatfs.c **** /* use . to allow the compiler to merge duplicate strings */ 868:fatfs.c **** init_direntry(&fnp->f_dir, D_DIR, parent, ". "); 869:fatfs.c **** fnp->f_dir.dir_name[1] = '.'; 870:fatfs.c **** 871:fatfs.c **** /* and put it out */ 872:fatfs.c **** if (!dir_write(fnp)) 873:fatfs.c **** return DE_ACCESS; 874:fatfs.c **** 875:fatfs.c **** return SUCCESS; 876:fatfs.c **** } 877:fatfs.c **** 878:fatfs.c **** /* extend a directory or file by exactly one cluster */ 879:fatfs.c **** /* only map_cluster calls this in a loop (for files) */ 880:fatfs.c **** STATIC CLUSTER extend(f_node_ptr fnp) 881:fatfs.c **** { 882:fatfs.c **** CLUSTER free_fat; 883:fatfs.c **** 884:fatfs.c **** /* get an empty cluster, so that we use it to extend the file. */ 885:fatfs.c **** free_fat = find_fat_free(fnp); 886:fatfs.c **** 887:fatfs.c **** /* No empty clusters, disk is FULL! Translate into a useful */ 888:fatfs.c **** /* error message. */ 889:fatfs.c **** if (free_fat == LONG_LAST_CLUSTER) 890:fatfs.c **** return free_fat; 891:fatfs.c **** 892:fatfs.c **** /* if 1a or 1b works but 2 fails, we get a pointer into an wrong FAT entry */ 893:fatfs.c **** /* our new fattab.c checks should be able to trap the bad pointers for now */ 894:fatfs.c **** if (link_fat(fnp->f_dpb, free_fat, LONG_LAST_CLUSTER) != SUCCESS) /* 2 */ /* free->last */ 895:fatfs.c **** return LONG_LAST_CLUSTER; /* do not try 1a/1b if 2 did not work out */ 896:fatfs.c **** /* if 2 works but 1a/1b fails, we only get a harmless lost cluster here */ 897:fatfs.c **** 898:fatfs.c **** /* Now that we have found a free FAT entry, mark it as the last entry of */ 899:fatfs.c **** /* the chain and save (note: BUFFERS cause nondeterministic write order) */ 900:fatfs.c **** if (fnp->f_cluster == FREE) /* if the file leaves the empty state */ 901:fatfs.c **** setdstart(fnp->f_dpb, &fnp->f_dir, free_fat); /* 1a */ 902:fatfs.c **** else 903:fatfs.c **** { 904:fatfs.c **** /* let previously last chain element chain to newly allocated cluster! */ 905:fatfs.c **** if (next_cluster(fnp->f_dpb, fnp->f_cluster) != LONG_LAST_CLUSTER) 906:fatfs.c **** { 907:fatfs.c **** /* we tried to "grow a file in the middle", f_node or FAT messed up? */ 908:fatfs.c **** put_string("FAT chain size bad!\n"); 909:fatfs.c **** return LONG_LAST_CLUSTER; 910:fatfs.c **** } 911:fatfs.c **** if (link_fat(fnp->f_dpb, fnp->f_cluster, free_fat) != SUCCESS) /* 1b */ /* last->used */ 912:fatfs.c **** return LONG_LAST_CLUSTER; /* should never happen */ 913:fatfs.c **** } 914:fatfs.c **** 915:fatfs.c **** return free_fat; 916:fatfs.c **** } 917:fatfs.c **** 918:fatfs.c **** STATIC COUNT extend_dir(f_node_ptr fnp) 919:fatfs.c **** { 920:fatfs.c **** int ret; 921:fatfs.c **** CLUSTER cluster = extend(fnp); 922:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 923:fatfs.c **** return DE_HNDLDSKFULL; 924:fatfs.c **** 925:fatfs.c **** ret = clear_dir(fnp, cluster); 926:fatfs.c **** if (ret != SUCCESS) 927:fatfs.c **** return ret; 928:fatfs.c **** 929:fatfs.c **** if (!find_free(fnp)) 930:fatfs.c **** return DE_HNDLDSKFULL; 931:fatfs.c **** 932:fatfs.c **** /* flush the drive buffers so that all info is written */ 933:fatfs.c **** if (!flush_buffers(fnp->f_dpb->dpb_unit)) 934:fatfs.c **** return DE_ACCESS; 935:fatfs.c **** 936:fatfs.c **** return SUCCESS; 937:fatfs.c **** 938:fatfs.c **** } 939:fatfs.c **** 940:fatfs.c **** /* Description. 941:fatfs.c **** * Finds the cluster which contains byte at the fnp->f_offset offset and 942:fatfs.c **** * stores its number to the fnp->f_cluster. The search begins from the start of 943:fatfs.c **** * a file or a directory depending on whether the SFT index is valid 944:fatfs.c **** * and continues through the FAT chain until the target cluster is found. 945:fatfs.c **** * The mode can have only XFR_READ or XFR_WRITE values. 946:fatfs.c **** * In the XFR_WRITE mode map_cluster extends the FAT chain by creating 947:fatfs.c **** * new clusters upon necessity. 948:fatfs.c **** * Return value. 949:fatfs.c **** * DE_HNDLDSKFULL - [XFR_WRITE mode only] unable to find free cluster 950:fatfs.c **** * for extending the FAT chain, the disk is full. 951:fatfs.c **** * The fnode is released from memory. 952:fatfs.c **** * DE_SEEK - [XFR_READ mode only] byte at f_offset lies outside of 953:fatfs.c **** * the FAT chain. The fnode is not released. 954:fatfs.c **** * Notes. 955:fatfs.c **** * If we are moving forward, then use the relative cluster number offset 956:fatfs.c **** * that we are at now (f_cluster_offset) to start, instead of starting 957:fatfs.c **** * at the beginning. */ 958:fatfs.c **** 959:fatfs.c **** COUNT map_cluster(REG f_node_ptr fnp, COUNT mode) 960:fatfs.c **** { 961:fatfs.c **** CLUSTER relcluster, cluster; 962:fatfs.c **** 963:fatfs.c **** #ifdef DISPLAY_GETBLOCK 964:fatfs.c **** printf("map_cluster: current %lu, offset %lu, diff=%lu ", 965:fatfs.c **** (ULONG)fnp->f_cluster_offset, fnp->f_offset, 966:fatfs.c **** fnp->f_offset - fnp->f_cluster_offset); 967:fatfs.c **** #endif 968:fatfs.c **** 969:fatfs.c **** if (fnp->f_cluster == FREE) 970:fatfs.c **** { 971:fatfs.c **** /* If this is a read but the file still has zero bytes return */ 972:fatfs.c **** /* immediately.... */ 973:fatfs.c **** if (mode == XFR_READ) 974:fatfs.c **** return DE_SEEK; 975:fatfs.c **** 976:fatfs.c **** /* If someone did a seek, but no writes have occured, we will */ 977:fatfs.c **** /* need to initialize the fnode. */ 978:fatfs.c **** /* (mode == XFR_WRITE) */ 979:fatfs.c **** /* If there are no more free fat entries, then we are full! */ 980:fatfs.c **** cluster = extend(fnp); 981:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 982:fatfs.c **** { 983:fatfs.c **** return DE_HNDLDSKFULL; 984:fatfs.c **** } 985:fatfs.c **** fnp->f_cluster = cluster; 986:fatfs.c **** } 987:fatfs.c **** 988:fatfs.c **** relcluster = (CLUSTER)((fnp->f_offset / fnp->f_dpb->dpb_secsize) >> 989:fatfs.c **** fnp->f_dpb->dpb_shftcnt); 990:fatfs.c **** if (relcluster < fnp->f_cluster_offset) 991:fatfs.c **** { 992:fatfs.c **** /* If seek is to earlier in file than current position, */ 993:fatfs.c **** /* we have to follow chain from the beginning again... */ 994:fatfs.c **** /* Set internal index and cluster size. */ 995:fatfs.c **** fnp->f_cluster = fnp->f_sft_idx == 0xff ? fnp->f_dmp->dm_dircluster : 996:fatfs.c **** getdstart(fnp->f_dpb, &fnp->f_dir); 997:fatfs.c **** fnp->f_cluster_offset = 0; 998:fatfs.c **** } 999:fatfs.c **** 1000:fatfs.c **** /* Now begin the linear search. The relative cluster is */ 1001:fatfs.c **** /* maintained as part of the set of physical indices. It is */ 1002:fatfs.c **** /* also the highest order index and is mapped directly into */ 1003:fatfs.c **** /* physical cluster. Our search is performed by pacing an index */ 1004:fatfs.c **** /* up to the relative cluster position where the index falls */ 1005:fatfs.c **** /* within the cluster. */ 1006:fatfs.c **** 1007:fatfs.c **** while (fnp->f_cluster_offset != relcluster) 1008:fatfs.c **** { 1009:fatfs.c **** /* get next cluster in the chain */ 1010:fatfs.c **** cluster = next_cluster(fnp->f_dpb, fnp->f_cluster); 1011:fatfs.c **** if (cluster <= 1) /* 1/error or 0/FREE chain into the void */ 1012:fatfs.c **** return DE_SEEK; 1013:fatfs.c **** 1014:fatfs.c **** /* If this is a read and the next is a LAST_CLUSTER, */ 1015:fatfs.c **** /* then we are going to read past EOF, return zero read */ 1016:fatfs.c **** /* or expand the list if we're going to write and have run into */ 1017:fatfs.c **** /* the last cluster marker. */ 1018:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 1019:fatfs.c **** { 1020:fatfs.c **** if (mode == XFR_READ) 1021:fatfs.c **** return DE_SEEK; 1022:fatfs.c **** 1023:fatfs.c **** /* mode == XFR_WRITE */ 1024:fatfs.c **** cluster = extend(fnp); 1025:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 1026:fatfs.c **** return DE_HNDLDSKFULL; 1027:fatfs.c **** } 1028:fatfs.c **** 1029:fatfs.c **** fnp->f_cluster = cluster; 1030:fatfs.c **** fnp->f_cluster_offset++; 1031:fatfs.c **** } 1032:fatfs.c **** 1033:fatfs.c **** #ifdef DISPLAY_GETBLOCK 1034:fatfs.c **** printf("done.\n"); 1035:fatfs.c **** #endif 1036:fatfs.c **** 1037:fatfs.c **** return SUCCESS; 1038:fatfs.c **** } 1039:fatfs.c **** 1040:fatfs.c **** /* extends a file from f_dir.dir_size to f_offset */ 1041:fatfs.c **** /* Proper OSes write zeros in between, but DOS just adds */ 1042:fatfs.c **** /* garbage sectors, and lets the caller do the zero filling */ 1043:fatfs.c **** /* if you prefer you can have this enabled using */ 1044:fatfs.c **** /* #define WRITEZEROS 1 */ 1045:fatfs.c **** /* but because we want to be compatible, we don't do this by */ 1046:fatfs.c **** /* default */ 1047:fatfs.c **** STATIC COUNT dos_extend(f_node_ptr fnp, BOOL emptywrite) 1048:fatfs.c **** { 1049:fatfs.c **** #ifdef WRITEZEROS 1050:fatfs.c **** struct buffer FAR *bp; 1051:fatfs.c **** UCOUNT xfr_cnt = 0; 1052:fatfs.c **** /* The variable secsize will be used later. */ 1053:fatfs.c **** UWORD secsize = fnp->f_dpb->dpb_secsize; 1054:fatfs.c **** ULONG count; 1055:fatfs.c **** unsigned sector, boff; 1056:fatfs.c **** #endif 1057:fatfs.c **** 1058:fatfs.c **** if (fnp->f_offset <= fnp->f_dir.dir_size) 1059:fatfs.c **** return SUCCESS; 1060:fatfs.c **** 1061:fatfs.c **** #ifdef WRITEZEROS 1062:fatfs.c **** count = fnp->f_offset - fnp->f_dir.dir_size; 1063:fatfs.c **** fnp->f_offset = fnp->f_dir.dir_size; 1064:fatfs.c **** while (count > 0) 1065:fatfs.c **** #endif 1066:fatfs.c **** { 1067:fatfs.c **** BOOL special = 0; 1068:fatfs.c **** if (emptywrite 1069:fatfs.c **** #ifdef WRITEZEROS 1070:fatfs.c **** && fnp->f_offset != 0 1071:fatfs.c **** #else 1072:fatfs.c **** /* f_offset != 0 always true here */ 1073:fatfs.c **** #endif 1074:fatfs.c **** && ((fnp->f_offset & 1075:fatfs.c **** (((ULONG)fnp->f_dpb->dpb_secsize 1076:fatfs.c **** << fnp->f_dpb->dpb_shftcnt) - 1) 1077:fatfs.c **** ) 1078:fatfs.c **** == 0) 1079:fatfs.c **** ) { 1080:fatfs.c **** special = 1; 1081:fatfs.c **** -- fnp->f_offset; 1082:fatfs.c **** } 1083:fatfs.c **** if (map_cluster(fnp, XFR_WRITE) != SUCCESS) { 1084:fatfs.c **** if (special) ++ fnp->f_offset; 1085:fatfs.c **** if (fnp->f_cluster != FREE) { 1086:fatfs.c **** /* ecm: write size if couldn't satisfy full request, 1087:fatfs.c **** but at least one cluster is allocated. */ 1088:fatfs.c **** fnp->f_dir.dir_size = 1089:fatfs.c **** (((ULONG)fnp->f_cluster_offset + 1) 1090:fatfs.c **** /* at 0 we have incremented to 1, having allocated the second 1091:fatfs.c **** cluster, so + 1 for the then-total size. */ 1092:fatfs.c **** * (ULONG)fnp->f_dpb->dpb_secsize) 1093:fatfs.c **** << 1094:fatfs.c **** fnp->f_dpb->dpb_shftcnt; 1095:fatfs.c **** merge_file_changes(fnp, FALSE); 1096:fatfs.c **** } 1097:fatfs.c **** return DE_HNDLDSKFULL; 1098:fatfs.c **** } 1099:fatfs.c **** if (special) ++ fnp->f_offset; 1100:fatfs.c **** 1101:fatfs.c **** #ifdef WRITEZEROS 1102:fatfs.c **** /* Compute the block within the cluster and the offset */ 1103:fatfs.c **** /* within the block. */ 1104:fatfs.c **** sector = (UBYTE)(fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask; 1105:fatfs.c **** boff = (UWORD)(fnp->f_offset % secsize); 1106:fatfs.c **** 1107:fatfs.c **** #ifdef DSK_DEBUG 1108:fatfs.c **** printf("write %d links; dir offset %ld, cluster %d\n", 1109:fatfs.c **** fnp->f_count, fnp->f_dmp->dm_entry, fnp->f_cluster); 1110:fatfs.c **** #endif 1111:fatfs.c **** 1112:fatfs.c **** xfr_cnt = count < (ULONG) secsize - boff ? 1113:fatfs.c **** (UWORD) count : secsize - boff; 1114:fatfs.c **** 1115:fatfs.c **** /* get a buffer to store the block in */ 1116:fatfs.c **** if ((boff == 0) && (xfr_cnt == secsize)) 1117:fatfs.c **** { 1118:fatfs.c **** bp = getblockOver(clus2phys(fnp->f_cluster, fnp->f_dpb) + 1119:fatfs.c **** sector, fnp->f_dpb->dpb_unit); 1120:fatfs.c **** 1121:fatfs.c **** } 1122:fatfs.c **** else 1123:fatfs.c **** { 1124:fatfs.c **** bp = getblock(clus2phys(fnp->f_cluster, fnp->f_dpb) + sector, 1125:fatfs.c **** fnp->f_dpb->dpb_unit); 1126:fatfs.c **** } 1127:fatfs.c **** if (bp == NULL) 1128:fatfs.c **** { 1129:fatfs.c **** if (fnp->f_cluster != FREE) { 1130:fatfs.c **** /* ecm: write size if couldn't satisfy full request, 1131:fatfs.c **** but at least one cluster is allocated. */ 1132:fatfs.c **** fnp->f_dir.dir_size = 1133:fatfs.c **** (((ULONG)fnp->f_cluster_offset + 1) 1134:fatfs.c **** /* at 0 we have incremented to 1, having allocated the second 1135:fatfs.c **** cluster, so + 1 for the then-total size. */ 1136:fatfs.c **** * (ULONG)fnp->f_dpb->dpb_secsize) 1137:fatfs.c **** << 1138:fatfs.c **** fnp->f_dpb->dpb_shftcnt; 1139:fatfs.c **** merge_file_changes(fnp, FALSE); 1140:fatfs.c **** } 1141:fatfs.c **** return DE_ACCESS; 1142:fatfs.c **** } 1143:fatfs.c **** 1144:fatfs.c **** /* set a block to zero */ 1145:fatfs.c **** fmemset((BYTE FAR *) & bp->b_buffer[boff], 0, xfr_cnt); 1146:fatfs.c **** bp->b_flag |= BFR_DIRTY | BFR_VALID; 1147:fatfs.c **** 1148:fatfs.c **** if (xfr_cnt == sizeof(bp->b_buffer)) /* probably not used later */ 1149:fatfs.c **** { 1150:fatfs.c **** bp->b_flag |= BFR_UNCACHE; 1151:fatfs.c **** } 1152:fatfs.c **** 1153:fatfs.c **** /* update pointers and counters */ 1154:fatfs.c **** count -= xfr_cnt; 1155:fatfs.c **** fnp->f_offset += xfr_cnt; 1156:fatfs.c **** #endif 1157:fatfs.c **** fnp->f_dir.dir_size = fnp->f_offset; 1158:fatfs.c **** merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */ 1159:fatfs.c **** } 1160:fatfs.c **** return SUCCESS; 1161:fatfs.c **** } 1162:fatfs.c **** 1163:fatfs.c **** /* 1164:fatfs.c **** comments read optimization for large reads: read total clusters in one piece 1165:fatfs.c **** 1166:fatfs.c **** running a program like 1167:fatfs.c **** 1168:fatfs.c **** while (1) { 1169:fatfs.c **** read(fd, header, sizeof(header)); // small read 1170:fatfs.c **** read(fd, buffer, header.size); // where size is large, up to 63K 1171:fatfs.c **** // with average ~32K 1172:fatfs.c **** } 1173:fatfs.c **** 1174:fatfs.c **** FreeDOS 2025 is really slow. 1175:fatfs.c **** on a P200 with modern 30GB harddisk, doing above for a 14.5 MB file 1176:fatfs.c **** 1177:fatfs.c **** MSDOS 6.22 clustersize 8K ~2.5 sec (accumulates over clusters, reads for 63 sectors seen), 1178:fatfs.c **** IBM PCDOS 7.0 8K ~4.3 1179:fatfs.c **** IBM PCDOS 7.0 16K ~2.8 1180:fatfs.c **** FreeDOS ke2025 ~17.5 1181:fatfs.c **** 1182:fatfs.c **** with the read optimization (ke2025a), 1183:fatfs.c **** 1184:fatfs.c **** clustersize 8K ~6.5 sec 1185:fatfs.c **** clustersize 16K ~4.2 sec 1186:fatfs.c **** 1187:fatfs.c **** it was verified with IBM feature tool, 1188:fatfs.c **** that the drive read ahead cache (says it) is on. still this huge difference ;-) 1189:fatfs.c **** 1190:fatfs.c **** 1191:fatfs.c **** it's coded pretty conservative to avoid all special cases, 1192:fatfs.c **** so it shouldn't break anything :-) 1193:fatfs.c **** 1194:fatfs.c **** possible further optimization: 1195:fatfs.c **** 1196:fatfs.c **** collect read across clusters (if file is not fragmented). 1197:fatfs.c **** MSDOS does this (as readcounts up to 63 sectors where seen) 1198:fatfs.c **** specially important for diskettes, where clustersize is 1 sector 1199:fatfs.c **** 1200:fatfs.c **** the same should be done for writes as well 1201:fatfs.c **** 1202:fatfs.c **** the time to compile the complete kernel (on some P200) is 1203:fatfs.c **** reduced from 67 to 56 seconds - in an otherwise identical configuration. 1204:fatfs.c **** 1205:fatfs.c **** it's not clear if this improvement shows up elsewhere, but it shouldn't harm either 1206:fatfs.c **** 1207:fatfs.c **** 1208:fatfs.c **** TE 10/18/01 14:00 1209:fatfs.c **** 1210:fatfs.c **** collect read across clusters (if file is not fragmented) done. 1211:fatfs.c **** 1212:fatfs.c **** seems still to work :-)) 1213:fatfs.c **** 1214:fatfs.c **** no large performance gains visible, but should now work _much_ 1215:fatfs.c **** better for the people, that complain about slow floppy access 1216:fatfs.c **** 1217:fatfs.c **** the 1218:fatfs.c **** fnp->f_offset +to_xfer < fnp->f_dir.dir_size && avoid EOF problems 1219:fatfs.c **** 1220:fatfs.c **** condition can probably _carefully_ be dropped 1221:fatfs.c **** 1222:fatfs.c **** 1223:fatfs.c **** TE 10/18/01 19:00 1224:fatfs.c **** 1225:fatfs.c **** */ 1226:fatfs.c **** 1227:fatfs.c **** /* Read/write block from disk */ 1228:fatfs.c **** /* checking for valid access was already done by the functions in 1229:fatfs.c **** dosfns.c */ 1230:fatfs.c **** long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) 1231:fatfs.c **** { 1232:fatfs.c **** /* Translate the fd into an fnode pointer, since all internal */ 1233:fatfs.c **** /* operations are achieved through fnodes. */ 1234:fatfs.c **** REG f_node_ptr fnp = sft_to_fnode(fd); 1235:fatfs.c **** REG struct buffer FAR *bp; 1236:fatfs.c **** UCOUNT xfr_cnt = 0; 1237:fatfs.c **** UCOUNT ret_cnt = 0; 1238:fatfs.c **** unsigned secsize; 1239:fatfs.c **** unsigned to_xfer = count; 1240:fatfs.c **** ULONG currentblock; 1241:fatfs.c **** 1242:fatfs.c **** #if 0 /*DSK_DEBUG*/ 1243:fatfs.c **** if (bDumpRdWrParms) 1244:fatfs.c **** { 1245:fatfs.c **** printf("rwblock:fd %02x buffer %04x:%04x count %x\n", 1246:fatfs.c **** fd, FP_SEG(buffer), FP_OFF(buffer), count); 1247:fatfs.c **** } 1248:fatfs.c **** #endif 1249:fatfs.c **** 1250:fatfs.c **** if (mode==XFR_WRITE) 1251:fatfs.c **** { 1252:fatfs.c **** fnp->f_dir.dir_attrib |= D_ARCHIVE; 1253:fatfs.c **** /* mark file as modified and set date not valid any more */ 1254:fatfs.c **** fnp->f_flags &= ~(SFT_FCLEAN|SFT_FDATE); 1255:fatfs.c **** 1256:fatfs.c **** if (dos_extend(fnp, count == 0) != SUCCESS) 1257:fatfs.c **** { 1258:fatfs.c **** /* ecm: control flow may end up here if CX = 0000h and 1259:fatfs.c **** the extending failed to allocate a cluster 1260:fatfs.c **** behind the last needed. in this case, our 1261:fatfs.c **** return here of 0 happens to be correct and 1262:fatfs.c **** indicates the extension succeeded. */ 1263:fatfs.c **** fnode_to_sft(fnp); 1264:fatfs.c **** return 0; 1265:fatfs.c **** } 1266:fatfs.c **** /* ecm: if CX = 0000h and seek was on a cluster boundary > size, 1267:fatfs.c **** the dos_extend call will have allocated one cluster 1268:fatfs.c **** too many. this is truncated later without problems. 1269:fatfs.c **** but does this aid fragmentation maybe ? 1270:fatfs.c **** if CX > 0000h then we want to write to the cluster 1271:fatfs.c **** anyway, so extending to the cluster that starts at 1272:fatfs.c **** the boundary is desired. */ 1273:fatfs.c **** } 1274:fatfs.c **** 1275:fatfs.c **** /* Test that we are really about to do a data transfer. If the */ 1276:fatfs.c **** /* count is zero and the mode is XFR_READ, just exit. (Any */ 1277:fatfs.c **** /* read with a count of zero is a nop). */ 1278:fatfs.c **** /* */ 1279:fatfs.c **** /* A write (mode is XFR_WRITE) is a special case. It sets the */ 1280:fatfs.c **** /* file length to the current length (truncates it). */ 1281:fatfs.c **** /* */ 1282:fatfs.c **** /* NOTE: doing this up front saves a lot of headaches later. */ 1283:fatfs.c **** 1284:fatfs.c **** if (count == 0) 1285:fatfs.c **** { 1286:fatfs.c **** /* NOTE: doing this up front made a lot of headaches later :-( TE */ 1287:fatfs.c **** /* FAT allocation has to be extended if necessary TE */ 1288:fatfs.c **** /* Now done in dos_extend BO */ 1289:fatfs.c **** /* remove all the following allocated clusters in shrink_file */ 1290:fatfs.c **** if (mode == XFR_WRITE) 1291:fatfs.c **** { 1292:fatfs.c **** fnp->f_dir.dir_size = fnp->f_offset; 1293:fatfs.c **** if (shrink_file(fnp) < 0) /* this is the only call to shrink_file... */ 1294:fatfs.c **** return DE_ACCESS; 1295:fatfs.c **** /* why does empty write -always- truncate to current offset? */ 1296:fatfs.c **** } 1297:fatfs.c **** fnode_to_sft(fnp); 1298:fatfs.c **** return 0; 1299:fatfs.c **** } 1300:fatfs.c **** 1301:fatfs.c **** /* prevent overwriting beginning of file when write exceeds 4GB, 1302:fatfs.c **** i.e. when overflow of offset occurs, return error on write */ 1303:fatfs.c **** if (fnp->f_offset + count < fnp->f_offset) /* unsigned overflow */ 1304:fatfs.c **** { 1305:fatfs.c **** if (mode == XFR_WRITE) 1306:fatfs.c **** { 1307:fatfs.c **** #if 1 /* we fail write call even if could partially succeed */ 1308:fatfs.c **** /* can't extend beyond 4G so return '0 byte written, DISK_FULL */ 1309:fatfs.c **** return DE_HNDLDSKFULL; 1310:fatfs.c **** #else 1311:fatfs.c **** /* truncate request to max size can write */ 1312:fatfs.c **** ULONG max_count = (ULONG)-1 - fnp->f_offset; 1313:fatfs.c **** count = (max_count >= (UCOUNT)-1)?(UCOUNT)-1:(UCOUNT)max_count; 1314:fatfs.c **** #endif 1315:fatfs.c **** } 1316:fatfs.c **** /* else XFR_READ should end automatically at EOF */ 1317:fatfs.c **** } 1318:fatfs.c **** 1319:fatfs.c **** /* The variable secsize will be used later. */ 1320:fatfs.c **** secsize = fnp->f_dpb->dpb_secsize; 1321:fatfs.c **** 1322:fatfs.c **** /* Adjust the far pointer from user space to supervisor space */ 1323:fatfs.c **** buffer = adjust_far(buffer); 1324:fatfs.c **** 1325:fatfs.c **** /* Do the data transfer. Use block transfer methods so that we */ 1326:fatfs.c **** /* can utilize memory management in future DOS-C versions. */ 1327:fatfs.c **** while (ret_cnt < count) 1328:fatfs.c **** { 1329:fatfs.c **** unsigned sector, boff; 1330:fatfs.c **** 1331:fatfs.c **** /* Do an EOF test and return whatever was transferred */ 1332:fatfs.c **** if (mode == XFR_READ && fnp->f_offset >= fnp->f_dir.dir_size) 1333:fatfs.c **** { 1334:fatfs.c **** fnode_to_sft(fnp); 1335:fatfs.c **** return ret_cnt; 1336:fatfs.c **** } 1337:fatfs.c **** 1338:fatfs.c **** /* Position the file to the fnode's pointer position. This is */ 1339:fatfs.c **** /* done by updating the fnode's cluster, block (sector) and */ 1340:fatfs.c **** /* byte offset so that read or write becomes a simple data move */ 1341:fatfs.c **** /* into or out of the block data buffer. */ 1342:fatfs.c **** 1343:fatfs.c **** /* The more difficult scenario is the (more common) */ 1344:fatfs.c **** /* file offset case. Here, we need to take the fnode's */ 1345:fatfs.c **** /* offset pointer (f_offset) and translate it into a */ 1346:fatfs.c **** /* relative cluster position, cluster block (sector) */ 1347:fatfs.c **** /* offset (sector) and byte offset (boff). Once we */ 1348:fatfs.c **** /* have this information, we need to translate the */ 1349:fatfs.c **** /* relative cluster position into an absolute cluster */ 1350:fatfs.c **** /* position (f_cluster). This is unfortunate because it */ 1351:fatfs.c **** /* requires a linear search through the file's FAT */ 1352:fatfs.c **** /* entries. It made sense when DOS was originally */ 1353:fatfs.c **** /* designed as a simple floppy disk operating system */ 1354:fatfs.c **** /* where the FAT was contained in core, but now */ 1355:fatfs.c **** /* requires a search through the FAT blocks. */ 1356:fatfs.c **** /* */ 1357:fatfs.c **** /* The algorithm in this function takes advantage of */ 1358:fatfs.c **** /* the blockio block buffering scheme to simplify the */ 1359:fatfs.c **** /* task. */ 1360:fatfs.c **** #ifdef DISPLAY_GETBLOCK 1361:fatfs.c **** printf("rwblock: "); 1362:fatfs.c **** #endif 1363:fatfs.c **** if (map_cluster(fnp, mode) != SUCCESS) 1364:fatfs.c **** { 1365:fatfs.c **** fnode_to_sft(fnp); 1366:fatfs.c **** return ret_cnt; 1367:fatfs.c **** } 1368:fatfs.c **** if (mode == XFR_WRITE) 1369:fatfs.c **** { 1370:fatfs.c **** merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */ 1371:fatfs.c **** } 1372:fatfs.c **** 1373:fatfs.c **** /* Compute the block within the cluster and the offset */ 1374:fatfs.c **** /* within the block. */ 1375:fatfs.c **** sector = (UBYTE)(fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask; 1376:fatfs.c **** boff = (UWORD)(fnp->f_offset % secsize); 1377:fatfs.c **** 1378:fatfs.c **** currentblock = clus2phys(fnp->f_cluster, fnp->f_dpb) + sector; 1379:fatfs.c **** 1380:fatfs.c **** /* see comments above */ 1381:fatfs.c **** 1382:fatfs.c **** if (boff == 0) /* complete sectors only */ 1383:fatfs.c **** { 1384:fatfs.c **** static ULONG startoffset; 1385:fatfs.c **** UCOUNT sectors_to_xfer, sectors_wanted; 1386:fatfs.c **** 1387:fatfs.c **** startoffset = fnp->f_offset; 1388:fatfs.c **** sectors_wanted = to_xfer; 1389:fatfs.c **** 1390:fatfs.c **** /* avoid EOF problems */ 1391:fatfs.c **** if (mode == XFR_READ && to_xfer > fnp->f_dir.dir_size - fnp->f_offset) 1392:fatfs.c **** sectors_wanted = (UCOUNT)(fnp->f_dir.dir_size - fnp->f_offset); 1393:fatfs.c **** 1394:fatfs.c **** sectors_wanted /= secsize; 1395:fatfs.c **** 1396:fatfs.c **** if (sectors_wanted == 0) 1397:fatfs.c **** goto normal_xfer; 1398:fatfs.c **** 1399:fatfs.c **** sectors_to_xfer = fnp->f_dpb->dpb_clsmask + 1 - sector; 1400:fatfs.c **** 1401:fatfs.c **** sectors_to_xfer = min(sectors_to_xfer, sectors_wanted); 1402:fatfs.c **** 1403:fatfs.c **** fnp->f_offset += sectors_to_xfer * secsize; 1404:fatfs.c **** 1405:fatfs.c **** while (sectors_to_xfer < sectors_wanted) 1406:fatfs.c **** { 1407:fatfs.c **** if (map_cluster(fnp, mode) != SUCCESS) 1408:fatfs.c **** break; 1409:fatfs.c **** 1410:fatfs.c **** if (clus2phys(fnp->f_cluster, fnp->f_dpb) != 1411:fatfs.c **** currentblock + sectors_to_xfer) 1412:fatfs.c **** break; 1413:fatfs.c **** 1414:fatfs.c **** sectors_to_xfer += fnp->f_dpb->dpb_clsmask + 1; 1415:fatfs.c **** 1416:fatfs.c **** sectors_to_xfer = min(sectors_to_xfer, sectors_wanted); 1417:fatfs.c **** 1418:fatfs.c **** fnp->f_offset = startoffset + sectors_to_xfer * secsize; 1419:fatfs.c **** 1420:fatfs.c **** } 1421:fatfs.c **** 1422:fatfs.c **** xfr_cnt = sectors_to_xfer * secsize; 1423:fatfs.c **** 1424:fatfs.c **** /* avoid caching trouble */ 1425:fatfs.c **** 1426:fatfs.c **** DeleteBlockInBufferCache(currentblock, 1427:fatfs.c **** currentblock + sectors_to_xfer - 1, 1428:fatfs.c **** fnp->f_dpb->dpb_unit, mode); 1429:fatfs.c **** 1430:fatfs.c **** if (dskxfer(fnp->f_dpb->dpb_unit, 1431:fatfs.c **** currentblock, 1432:fatfs.c **** (VOID FAR *) buffer, sectors_to_xfer, 1433:fatfs.c **** mode == XFR_READ ? DSKREAD : DSKWRITE)) 1434:fatfs.c **** { 1435:fatfs.c **** fnp->f_offset = startoffset; 1436:fatfs.c **** fnode_to_sft(fnp); 1437:fatfs.c **** return DE_ACCESS; 1438:fatfs.c **** } 1439:fatfs.c **** 1440:fatfs.c **** goto update_pointers; 1441:fatfs.c **** } 1442:fatfs.c **** 1443:fatfs.c **** /* normal read: just the old, buffer = sector based read */ 1444:fatfs.c **** normal_xfer: 1445:fatfs.c **** 1446:fatfs.c **** #ifdef DSK_DEBUG 1447:fatfs.c **** printf("r/w %d links; dir offset %d, cluster %d, mode %x\n", 1448:fatfs.c **** fnp->f_count, fnp->f_dmp->dm_entry, fnp->f_cluster, mode); 1449:fatfs.c **** #endif 1450:fatfs.c **** 1451:fatfs.c **** /* Get the block we need from cache */ 1452:fatfs.c **** bp = getblock(currentblock 1453:fatfs.c **** /*clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector */ 1454:fatfs.c **** , fnp->f_dpb->dpb_unit); 1455:fatfs.c **** 1456:fatfs.c **** #ifdef DISPLAY_GETBLOCK 1457:fatfs.c **** printf("DATA (rwblock)\n"); 1458:fatfs.c **** #endif 1459:fatfs.c **** if (bp == NULL) /* (struct buffer *)0 --> DS:0 !! */ 1460:fatfs.c **** { 1461:fatfs.c **** fnode_to_sft(fnp); 1462:fatfs.c **** return ret_cnt; 1463:fatfs.c **** } 1464:fatfs.c **** 1465:fatfs.c **** /* transfer a block */ 1466:fatfs.c **** /* Transfer size as either a full block size, or the */ 1467:fatfs.c **** /* requested transfer size, whichever is smaller. */ 1468:fatfs.c **** /* Then compare to what is left, since we can transfer */ 1469:fatfs.c **** /* a maximum of what is left. */ 1470:fatfs.c **** xfr_cnt = min(to_xfer, secsize - boff); 1471:fatfs.c **** if (mode == XFR_READ) 1472:fatfs.c **** xfr_cnt = (UWORD) min(xfr_cnt, fnp->f_dir.dir_size - fnp->f_offset); 1473:fatfs.c **** 1474:fatfs.c **** /* transfer a block */ 1475:fatfs.c **** /* Transfer size as either a full block size, or the */ 1476:fatfs.c **** /* requested transfer size, whichever is smaller. */ 1477:fatfs.c **** /* Then compare to what is left, since we can transfer */ 1478:fatfs.c **** /* a maximum of what is left. */ 1479:fatfs.c **** if (mode == XFR_WRITE) 1480:fatfs.c **** { 1481:fatfs.c **** fmemcpy(&bp->b_buffer[boff], buffer, xfr_cnt); 1482:fatfs.c **** bp->b_flag |= BFR_DIRTY | BFR_VALID; 1483:fatfs.c **** } 1484:fatfs.c **** else 1485:fatfs.c **** { 1486:fatfs.c **** fmemcpy(buffer, &bp->b_buffer[boff], xfr_cnt); 1487:fatfs.c **** } 1488:fatfs.c **** 1489:fatfs.c **** /* complete buffer transferred ? 1490:fatfs.c **** probably not reused later 1491:fatfs.c **** */ 1492:fatfs.c **** if (xfr_cnt == sizeof(bp->b_buffer) || 1493:fatfs.c **** (mode == XFR_READ && fnp->f_offset + xfr_cnt == fnp->f_dir.dir_size)) 1494:fatfs.c **** { 1495:fatfs.c **** bp->b_flag |= BFR_UNCACHE; 1496:fatfs.c **** } 1497:fatfs.c **** 1498:fatfs.c **** /* update pointers and counters */ 1499:fatfs.c **** fnp->f_offset += xfr_cnt; 1500:fatfs.c **** 1501:fatfs.c **** update_pointers: 1502:fatfs.c **** ret_cnt += xfr_cnt; 1503:fatfs.c **** to_xfer -= xfr_cnt; 1504:fatfs.c **** buffer = adjust_far((char FAR *)buffer + xfr_cnt); 1505:fatfs.c **** if (mode == XFR_WRITE) 1506:fatfs.c **** { 1507:fatfs.c **** if (fnp->f_offset > fnp->f_dir.dir_size) 1508:fatfs.c **** { 1509:fatfs.c **** fnp->f_dir.dir_size = fnp->f_offset; 1510:fatfs.c **** } 1511:fatfs.c **** merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */ 1512:fatfs.c **** } 1513:fatfs.c **** } 1514:fatfs.c **** fnode_to_sft(fnp); 1515:fatfs.c **** return ret_cnt; 1516:fatfs.c **** } 1517:fatfs.c **** 1518:fatfs.c **** /* returns the number of unused clusters */ 1519:fatfs.c **** CLUSTER dos_free(struct dpb FAR * dpbp) 1520:fatfs.c **** { 1521:fatfs.c **** /* There's an unwritten rule here. All fs */ 1522:fatfs.c **** /* cluster start at 2 and run to max_cluster+2 */ 1523:fatfs.c **** REG CLUSTER i; 1524:fatfs.c **** REG CLUSTER cnt; 1525:fatfs.c **** CLUSTER max_cluster = dpbp->dpb_size; 1526:fatfs.c **** 1527:fatfs.c **** #ifdef WITHFAT32 1528:fatfs.c **** if (ISFAT32(dpbp)) 1529:fatfs.c **** { 1530:fatfs.c **** if (dpbp->dpb_xnfreeclst != XUNKNCLSTFREE) 1531:fatfs.c **** return dpbp->dpb_xnfreeclst; 1532:fatfs.c **** max_cluster = dpbp->dpb_xsize; 1533:fatfs.c **** } 1534:fatfs.c **** else 1535:fatfs.c **** #endif 1536:fatfs.c **** if (dpbp->dpb_nfreeclst != UNKNCLSTFREE) 1537:fatfs.c **** return dpbp->dpb_nfreeclst; 1538:fatfs.c **** 1539:fatfs.c **** cnt = 0; 1540:fatfs.c **** for (i = 2; i <= max_cluster; i++) 1541:fatfs.c **** { 1542:fatfs.c **** #ifdef CHECK_FAT_DURING_SPACE_CHECK /* slower but nice side effect ;-) */ 1543:fatfs.c **** if (next_cluster(dpbp, i) == FREE) 1544:fatfs.c **** #else 1545:fatfs.c **** if (is_free_cluster(dpbp, i)) 1546:fatfs.c **** #endif 1547:fatfs.c **** { 1548:fatfs.c **** if (cnt == 0) 1549:fatfs.c **** { 1550:fatfs.c **** /* update first free cluster number */ 1551:fatfs.c **** #ifdef WITHFAT32 1552:fatfs.c **** if (ISFAT32(dpbp)) 1553:fatfs.c **** dpbp->dpb_xcluster = i; 1554:fatfs.c **** else 1555:fatfs.c **** #endif 1556:fatfs.c **** dpbp->dpb_cluster = (UWORD)i; 1557:fatfs.c **** } 1558:fatfs.c **** ++cnt; 1559:fatfs.c **** } 1560:fatfs.c **** } 1561:fatfs.c **** #ifdef WITHFAT32 1562:fatfs.c **** if (ISFAT32(dpbp)) 1563:fatfs.c **** { 1564:fatfs.c **** dpbp->dpb_xnfreeclst = cnt; 1565:fatfs.c **** write_fsinfo(dpbp); 1566:fatfs.c **** return cnt; 1567:fatfs.c **** } 1568:fatfs.c **** #endif 1569:fatfs.c **** dpbp->dpb_nfreeclst = (UWORD)cnt; 1570:fatfs.c **** return cnt; 1571:fatfs.c **** } 1572:fatfs.c **** 1573:fatfs.c **** #ifndef IPL 1574:fatfs.c **** int dos_cd(char * PathName) 1575:fatfs.c **** { 1576:fatfs.c **** f_node_ptr fnp; 1577:fatfs.c **** struct cds FAR *cdsp; 1578:fatfs.c **** 1579:fatfs.c **** /* now test for its existance. If it doesn't, return an error. */ 1580:fatfs.c **** if ((fnp = dir_open(PathName, FALSE, &fnode[0])) == NULL) 1581:fatfs.c **** return DE_PATHNOTFND; 1582:fatfs.c **** 1583:fatfs.c **** /* problem: RBIL table 01643 does not give a FAT32 field for the 1584:fatfs.c **** CDS start cluster. But we are not using this field ourselves */ 1585:fatfs.c **** cdsp = get_cds(PathName[0] - 'A'); 1586:fatfs.c **** cdsp->cdsStrtClst = (UWORD)fnp->f_dmp->dm_dircluster; 1587:fatfs.c **** return SUCCESS; 1588:fatfs.c **** } 1589:fatfs.c **** #endif 1590:fatfs.c **** 1591:fatfs.c **** #ifndef IPL 1592:fatfs.c **** COUNT dos_getfattr(BYTE * name) 1593:fatfs.c **** { 1594:fatfs.c **** f_node_ptr fnp = &fnode[0]; 1595:fatfs.c **** int ret = find_fname(name, D_ALL, fnp); 1596:fatfs.c **** return ret == SUCCESS ? fnp->f_dir.dir_attrib : ret; 1597:fatfs.c **** } 1598:fatfs.c **** 1599:fatfs.c **** COUNT dos_setfattr(BYTE * name, UWORD attrp) 1600:fatfs.c **** { 1601:fatfs.c **** f_node_ptr fnp; 1602:fatfs.c **** int rc; 1603:fatfs.c **** 1604:fatfs.c **** /* JPP-If user tries to set VOLID or RESERVED bits, return error. 1605:fatfs.c **** We used to also check for D_DIR here, but causes issues with deltree 1606:fatfs.c **** which is trying to work around another issue. So now we check 1607:fatfs.c **** these here, and only report DE_ACCESS if user tries to set directory 1608:fatfs.c **** bit on a non-directory entry. 1609:fatfs.c **** */ 1610:fatfs.c **** if ((attrp & (D_VOLID | 0xC0)) != 0) 1611:fatfs.c **** return DE_ACCESS; 1612:fatfs.c **** 1613:fatfs.c **** fnp = &fnode[0]; 1614:fatfs.c **** rc = find_fname(name, D_ALL, fnp); 1615:fatfs.c **** if (rc != SUCCESS) 1616:fatfs.c **** return rc; 1617:fatfs.c **** 1618:fatfs.c **** /* if caller tries to set DIR on non-directory, return error */ 1619:fatfs.c **** if ((attrp & D_DIR) && !(fnp->f_dir.dir_attrib & D_DIR)) 1620:fatfs.c **** return DE_ACCESS; 1621:fatfs.c **** 1622:fatfs.c **** /* Set the attribute from the fnode and return */ 1623:fatfs.c **** /* clear all attributes but DIR and VOLID */ 1624:fatfs.c **** fnp->f_dir.dir_attrib &= (D_VOLID | D_DIR); /* JPP */ 1625:fatfs.c **** 1626:fatfs.c **** /* set attributes that user requested */ 1627:fatfs.c **** fnp->f_dir.dir_attrib |= attrp; /* JPP */ 1628:fatfs.c **** 1629:fatfs.c **** /* close open files in compat mode, otherwise there was a critical error */ 1630:fatfs.c **** rc = merge_file_changes(fnp, -1); 1631:fatfs.c **** if (rc == SUCCESS && !dir_write(fnp)) 1632:fatfs.c **** rc = DE_ACCESS; 1633:fatfs.c **** return rc; 1634:fatfs.c **** } 1635:fatfs.c **** #endif 1636:fatfs.c **** 1637:fatfs.c **** #ifdef WITHFAT32 1638:fatfs.c **** VOID dpb16to32(struct dpb FAR *dpbp) 1639:fatfs.c **** { 1640:fatfs.c **** dpbp->dpb_xflags = 0; 1641:fatfs.c **** dpbp->dpb_xfsinfosec = 0xffff; 1642:fatfs.c **** dpbp->dpb_xbackupsec = 0xffff; 1643:fatfs.c **** dpbp->dpb_xrootclst = 0; 1644:fatfs.c **** dpbp->dpb_xdata = dpbp->dpb_data; 1645:fatfs.c **** dpbp->dpb_xsize = dpbp->dpb_size; 1646:fatfs.c **** } 1647:fatfs.c **** 1648:fatfs.c **** VOID bpb_to_dpb(bpb FAR * bpbp, REG struct dpb FAR * dpbp, BOOL extended) 1649:fatfs.c **** #else 1650:fatfs.c **** VOID bpb_to_dpb(bpb FAR * bpbp, REG struct dpb FAR * dpbp) 1651:fatfs.c **** #endif 1652:fatfs.c **** { 1653:fatfs.c **** ULONG size; 1654:fatfs.c **** REG UWORD shftcnt; 1655:fatfs.c **** bpb sbpb; 1656:fatfs.c **** 1657:fatfs.c **** fmemcpy(&sbpb, bpbp, sizeof(sbpb)); 1658:fatfs.c **** if (sbpb.bpb_nsector == 0) { 1659:fatfs.c **** shftcnt = 8; 1660:fatfs.c **** } else { 1661:fatfs.c **** for (shftcnt = 0; (sbpb.bpb_nsector >> shftcnt) > 1; shftcnt++) 1662:fatfs.c **** ; 1663:fatfs.c **** } 1664:fatfs.c **** dpbp->dpb_shftcnt = shftcnt; 1665:fatfs.c **** 1666:fatfs.c **** dpbp->dpb_mdb = sbpb.bpb_mdesc; 1667:fatfs.c **** dpbp->dpb_secsize = sbpb.bpb_nbyte; 1668:fatfs.c **** dpbp->dpb_clsmask = (sbpb.bpb_nsector - 1) & 0xFF; 1669:fatfs.c **** dpbp->dpb_fatstrt = sbpb.bpb_nreserved; 1670:fatfs.c **** dpbp->dpb_fats = sbpb.bpb_nfat; 1671:fatfs.c **** dpbp->dpb_dirents = sbpb.bpb_ndirent; 1672:fatfs.c **** size = sbpb.bpb_nsize == 0 ? sbpb.bpb_huge : (ULONG) sbpb.bpb_nsize; 1673:fatfs.c **** dpbp->dpb_fatsize = sbpb.bpb_nfsect; 1674:fatfs.c **** dpbp->dpb_dirstrt = dpbp->dpb_fatstrt + dpbp->dpb_fats * dpbp->dpb_fatsize; 1675:fatfs.c **** dpbp->dpb_data = dpbp->dpb_dirstrt 1676:fatfs.c **** + (dpbp->dpb_dirents + dpbp->dpb_secsize/DIRENT_SIZE - 1) / 1677:fatfs.c **** (dpbp->dpb_secsize/DIRENT_SIZE); 1678:fatfs.c **** dpbp->dpb_size = (UWORD)((size - dpbp->dpb_data) >> shftcnt) + 1; 1679:fatfs.c **** { /* Make sure the number of FAT sectors is actually enough to hold that */ 1680:fatfs.c **** /* many clusters. Otherwise back the number of clusters down (LG & AB) */ 1681:fatfs.c **** unsigned fatsiz; 1682:fatfs.c **** ULONG tmp = dpbp->dpb_fatsize * (ULONG)(dpbp->dpb_secsize / 2);/* entries/2 */ 1683:fatfs.c **** if (tmp >= 0x10000UL) 1684:fatfs.c **** goto ckok; 1685:fatfs.c **** fatsiz = (unsigned) tmp; 1686:fatfs.c **** if (dpbp->dpb_size > FAT_MAGIC) {/* FAT16 */ 1687:fatfs.c **** if (fatsiz <= FAT_MAGIC) /* FAT12 - let it pass through rather */ 1688:fatfs.c **** goto ckok; /* than lose data correcting FAT type */ 1689:fatfs.c **** } else { /* FAT12 */ 1690:fatfs.c **** if (fatsiz >= 0x4000) 1691:fatfs.c **** goto ckok; 1692:fatfs.c **** fatsiz = fatsiz * 4 / 3; 1693:fatfs.c **** } 1694:fatfs.c **** if (dpbp->dpb_size >= fatsiz) /* FAT too short */ 1695:fatfs.c **** dpbp->dpb_size = fatsiz - 1; /* - 2 reserved entries + 1 */ 1696:fatfs.c **** ckok:; 1697:fatfs.c **** } 1698:fatfs.c **** dpbp->dpb_flags = 0; 1699:fatfs.c **** dpbp->dpb_cluster = UNKNCLUSTER; 1700:fatfs.c **** /* number of free clusters */ 1701:fatfs.c **** dpbp->dpb_nfreeclst = UNKNCLSTFREE; 1702:fatfs.c **** 1703:fatfs.c **** #ifdef WITHFAT32 1704:fatfs.c **** if (extended) 1705:fatfs.c **** { 1706:fatfs.c **** dpbp->dpb_xfatsize = sbpb.bpb_nfsect == 0 ? sbpb.bpb_xnfsect 1707:fatfs.c **** : sbpb.bpb_nfsect; 1708:fatfs.c **** dpbp->dpb_xcluster = UNKNCLUSTER; 1709:fatfs.c **** dpbp->dpb_xnfreeclst = XUNKNCLSTFREE; /* number of free clusters */ 1710:fatfs.c **** 1711:fatfs.c **** dpb16to32(dpbp); 1712:fatfs.c **** 1713:fatfs.c **** if (ISFAT32(dpbp)) 1714:fatfs.c **** { 1715:fatfs.c **** dpbp->dpb_xflags = sbpb.bpb_xflags; 1716:fatfs.c **** dpbp->dpb_xfsinfosec = sbpb.bpb_xfsinfosec; 1717:fatfs.c **** dpbp->dpb_xbackupsec = sbpb.bpb_xbackupsec; 1718:fatfs.c **** dpbp->dpb_dirents = 0; 1719:fatfs.c **** dpbp->dpb_dirstrt = 0xffff; 1720:fatfs.c **** dpbp->dpb_size = 0; 1721:fatfs.c **** dpbp->dpb_xdata = 1722:fatfs.c **** dpbp->dpb_fatstrt + dpbp->dpb_fats * dpbp->dpb_xfatsize; 1723:fatfs.c **** dpbp->dpb_xsize = ((size - dpbp->dpb_xdata) >> shftcnt) + 1; 1724:fatfs.c **** dpbp->dpb_xrootclst = sbpb.bpb_xrootclst; 1725:fatfs.c **** read_fsinfo(dpbp); 1726:fatfs.c **** } 1727:fatfs.c **** } 1728:fatfs.c **** #endif 1729:fatfs.c **** } 1730:fatfs.c **** 1731:fatfs.c **** STATIC int rqblockio(unsigned char command, struct dpb FAR * dpbp) 1732:fatfs.c **** { 1733:fatfs.c **** retry: 1734:fatfs.c **** MediaReqHdr.r_length = sizeof(request); 1735:fatfs.c **** MediaReqHdr.r_unit = dpbp->dpb_subunit; 1736:fatfs.c **** MediaReqHdr.r_command = command; 1737:fatfs.c **** MediaReqHdr.r_mcmdesc = dpbp->dpb_mdb; 1738:fatfs.c **** MediaReqHdr.r_status = 0; 1739:fatfs.c **** 1740:fatfs.c **** if (command == C_BLDBPB) /* help USBASPI.SYS & DI1000DD.SYS (TE) */ 1741:fatfs.c **** MediaReqHdr.r_bpfat = (boot FAR *)DiskTransferBuffer; 1742:fatfs.c **** execrh((request FAR *) & MediaReqHdr, dpbp->dpb_device); 1743:fatfs.c **** if ((MediaReqHdr.r_status & S_ERROR) || !(MediaReqHdr.r_status & S_DONE)) 1744:fatfs.c **** { 1745:fatfs.c **** FOREVER 1746:fatfs.c **** { 1747:fatfs.c **** switch (block_error(&MediaReqHdr, dpbp->dpb_unit, dpbp->dpb_device, 0)) 1748:fatfs.c **** { 1749:fatfs.c **** case ABORT: 1750:fatfs.c **** case FAIL: 1751:fatfs.c **** return DE_INVLDDRV; 1752:fatfs.c **** 1753:fatfs.c **** case RETRY: 1754:fatfs.c **** goto retry; 1755:fatfs.c **** 1756:fatfs.c **** case CONTINUE: 1757:fatfs.c **** return SUCCESS; 1758:fatfs.c **** } 1759:fatfs.c **** } 1760:fatfs.c **** } 1761:fatfs.c **** return SUCCESS; 1762:fatfs.c **** } 1763:fatfs.c **** 1764:fatfs.c **** COUNT media_check(REG struct dpb FAR * dpbp) 1765:fatfs.c **** { 1766:fatfs.c **** int ret; 1767:fatfs.c **** if (dpbp == NULL) 1768:fatfs.c **** return DE_INVLDDRV; 1769:fatfs.c **** 1770:fatfs.c **** /* First test if anyone has changed the removable media */ 1771:fatfs.c **** ret = rqblockio(C_MEDIACHK, dpbp); 1772:fatfs.c **** if (ret < SUCCESS) 1773:fatfs.c **** return ret; 1774:fatfs.c **** 1775:fatfs.c **** switch (MediaReqHdr.r_mcretcode | dpbp->dpb_flags) 1776:fatfs.c **** { 1777:fatfs.c **** case M_NOT_CHANGED: 1778:fatfs.c **** /* It was definitely not changed, so ignore it */ 1779:fatfs.c **** return SUCCESS; 1780:fatfs.c **** 1781:fatfs.c **** /* If it is forced or the media may have changed, */ 1782:fatfs.c **** /* rebuild the bpb */ 1783:fatfs.c **** case M_DONT_KNOW: 1784:fatfs.c **** /* IBM PCDOS technical reference says to call BLDBPB if */ 1785:fatfs.c **** /* there are no used buffers */ 1786:fatfs.c **** if (dirty_buffers(dpbp->dpb_unit)) 1787:fatfs.c **** return SUCCESS; 1788:fatfs.c **** 1789:fatfs.c **** /* If it definitely changed, don't know (falls through) */ 1790:fatfs.c **** /* or has been changed, rebuild the bpb. */ 1791:fatfs.c **** /* case M_CHANGED: */ 1792:fatfs.c **** default: 1793:fatfs.c **** setinvld(dpbp->dpb_unit); 1794:fatfs.c **** ret = rqblockio(C_BLDBPB, dpbp); 1795:fatfs.c **** if (ret < SUCCESS) 1796:fatfs.c **** return ret; 1797:fatfs.c **** #ifdef WITHFAT32 1798:fatfs.c **** /* extend dpb only for internal or FAT32 devices */ 1799:fatfs.c **** bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp, 1800:fatfs.c **** MediaReqHdr.r_bpptr->bpb_nfsect == 0 || 1801:fatfs.c **** FP_SEG(dpbp) == FP_SEG(&os_major)); 1802:fatfs.c **** #else 1803:fatfs.c **** bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp); 1804:fatfs.c **** #endif 1805:fatfs.c **** return SUCCESS; 1806:fatfs.c **** } 1807:fatfs.c **** } 1808:fatfs.c **** 1809:fatfs.c **** /* copy the SFT fd into the first near fnode */ 1810:fatfs.c **** STATIC f_node_ptr sft_to_fnode(int fd) 1811:fatfs.c **** { 11 .loc 1 1811 0 12 _.LVL0: 0 00004BD1 56 push si 0 00004BD2 57 push di 0 00004BD3 55 push bp 16 _.LCFI0: 0 00004BD4 89E5 mov bp, sp 18 _.LCFI1: 0 00004BD6 1E push ds 0 00004BD7 1E push ds 1812:fatfs.c **** sft FAR *sftp = idx_to_sft(fd); 21 .loc 1 1812 0 0 00004BD8 FF7608 push word ptr [bp+8] 0 00004BDB E8[FEFF] call _idx_to_sft 24 _.LVL1: 0 00004BDE 93 xchg bx, ax 26 _.LVL2: 1813:fatfs.c **** f_node_ptr fnp = &fnode[0]; 1814:fatfs.c **** 1815:fatfs.c **** fnp->f_sft_idx = fd; 27 .loc 1 1815 0 0 00004BDF BE[0000] mov si, offset _fnode 0 00004BE2 8A4608 mov al, byte ptr [bp+8] 30 _.LVL3: 0 00004BE5 884439 mov byte ptr [si+57], al 1816:fatfs.c **** 1817:fatfs.c **** fnp->f_flags = sftp->sft_flags; 32 .loc 1 1817 0 0 00004BE8 8EC2 mov es, dx 0 00004BEA 268B4705 mov ax, word ptr es:[bx+5] 0 00004BEE 8904 mov word ptr [si], ax 1818:fatfs.c **** 1819:fatfs.c **** fnp->f_dir.dir_attrib = sftp->sft_attrib; 36 .loc 1 1819 0 0 00004BF0 268A4704 mov al, byte ptr es:[bx+4] 0 00004BF4 88440F mov byte ptr [si+15], al 1820:fatfs.c **** fmemcpy(fnp->f_dir.dir_name, sftp->sft_name, FNAME_SIZE + FEXT_SIZE); 39 .loc 1 1820 0 0 00004BF7 B80B00 mov ax, 11 0 00004BFA 50 push ax 0 00004BFB 8D4720 lea ax, [32+bx] 0 00004BFE 895EFC mov word ptr [bp-4], bx 0 00004C01 52 push dx 0 00004C02 8956FE mov word ptr [bp-2], dx 0 00004C05 50 push ax 0 00004C06 16 push ss 0 00004C07 B8[0400] mov ax, offset _fnode+4 0 00004C0A 50 push ax 0 00004C0B E8[FEFF] call _fmemcpy 51 _.LVL4: 1821:fatfs.c **** fnp->f_dir.dir_time = sftp->sft_time; 52 .loc 1 1821 0 0 00004C0E 8B56FE mov dx, word ptr [bp-2] 0 00004C11 8EC2 mov es, dx 0 00004C13 8B5EFC mov bx, word ptr [bp-4] 0 00004C16 268B470D mov ax, word ptr es:[bx+13] 0 00004C1A 89441A mov word ptr [si+26], ax 1822:fatfs.c **** fnp->f_dir.dir_date = sftp->sft_date; 58 .loc 1 1822 0 0 00004C1D 268B470F mov ax, word ptr es:[bx+15] 0 00004C21 89441C mov word ptr [si+28], ax 1823:fatfs.c **** fnp->f_dir.dir_size = sftp->sft_size; 61 .loc 1 1823 0 0 00004C24 268B4711 mov ax, word ptr es:[bx+17] 0 00004C28 268B4F13 mov cx, word ptr es:[bx+19] 0 00004C2C 894420 mov word ptr [si+32], ax 0 00004C2F 894C22 mov word ptr [si+34], cx 1824:fatfs.c **** fnp->f_dpb = sftp->sft_dcb; 66 .loc 1 1824 0 0 00004C32 268B7F07 mov di, word ptr es:[bx+7] 0 00004C36 268B4709 mov ax, word ptr es:[bx+9] 0 00004C3A 897C29 mov word ptr [si+41], di 0 00004C3D 89442B mov word ptr [si+43], ax 1825:fatfs.c **** setdstart(fnp->f_dpb, &fnp->f_dir, sftp->sft_stclust); 71 .loc 1 1825 0 0 00004C40 268E5F2B mov ds, word ptr es:[bx+43] 0 00004C44 268B4F2D mov cx, word ptr es:[bx+45] 74 _.LVL5: 75 _.LBB14: 76 _.LBB15: 68:fatfs.c **** if (ISFAT32(dpbp)) 77 .loc 1 68 0 0 00004C48 368C5C1E mov word ptr ss:[si+30], ds 69:fatfs.c **** dentry->dir_start_high = (UWORD)(value >> 16); 79 .loc 1 69 0 0 00004C4C 8EC0 mov es, ax 0 00004C4E 26837D0F00 cmp word ptr es:[di+15], 0 0 00004C53 7504 jne _.L2 70:fatfs.c **** } 83 .loc 1 70 0 0 00004C55 36894C18 mov word ptr ss:[si+24], cx 85 _.L2: 86 _.LVL6: 87 _.LBE15: 88 _.LBE14: 1826:fatfs.c **** 1827:fatfs.c **** fnp->f_diridx = sftp->sft_diridx; 89 .loc 1 1827 0 0 00004C59 8EC2 mov es, dx 0 00004C5B 268A471F mov al, byte ptr es:[bx+31] 0 00004C5F 36884428 mov byte ptr ss:[si+40], al 1828:fatfs.c **** fnp->f_dirsector = sftp->sft_dirsector; 93 .loc 1 1828 0 0 00004C63 268B471B mov ax, word ptr es:[bx+27] 0 00004C67 268B4F1D mov cx, word ptr es:[bx+29] 0 00004C6B 36894424 mov word ptr ss:[si+36], ax 0 00004C6F 36894C26 mov word ptr ss:[si+38], cx 1829:fatfs.c **** fnp->f_offset = sftp->sft_posit; 98 .loc 1 1829 0 0 00004C73 268B4715 mov ax, word ptr es:[bx+21] 0 00004C77 268B4F17 mov cx, word ptr es:[bx+23] 0 00004C7B 3689442D mov word ptr ss:[si+45], ax 0 00004C7F 36894C2F mov word ptr ss:[si+47], cx 1830:fatfs.c **** fnp->f_cluster = sftp->sft_cuclust; 103 .loc 1 1830 0 0 00004C83 268B4735 mov ax, word ptr es:[bx+53] 0 00004C87 268B4F37 mov cx, word ptr es:[bx+55] 0 00004C8B 36894435 mov word ptr ss:[si+53], ax 0 00004C8F 36894C37 mov word ptr ss:[si+55], cx 1831:fatfs.c **** #ifdef WITHFAT32 1832:fatfs.c **** fnp->f_cluster_offset = sftp->sft_relclust | 1833:fatfs.c **** ((ULONG)sftp->sft_relclust_high << 16); 108 .loc 1 1833 0 0 00004C93 268B470B mov ax, word ptr es:[bx+11] 1832:fatfs.c **** ((ULONG)sftp->sft_relclust_high << 16); 110 .loc 1 1832 0 0 00004C97 268B5719 mov dx, word ptr es:[bx+25] 0 00004C9B 36895431 mov word ptr ss:[si+49], dx 0 00004C9F 36894433 mov word ptr ss:[si+51], ax 1834:fatfs.c **** #else 1835:fatfs.c **** fnp->f_cluster_offset = sftp->sft_relclust; 1836:fatfs.c **** #endif 1837:fatfs.c **** return fnp; 1838:fatfs.c **** } 114 .loc 1 1838 0 0 00004CA3 B8[0000] mov ax, offset _fnode 0 00004CA6 89EC mov sp, bp 0 00004CA8 5D pop bp 0 00004CA9 5F pop di 0 00004CAA 5E pop si 0 00004CAB 16 push ss 0 00004CAC 1F pop ds 0 00004CAD C20200 ret 2 123 _.LFE46: 124 .size _sft_to_fnode, .-_sft_to_fnode 125 .type _find_free, @function 126 _find_free: 127 _.LFB26: 621:fatfs.c **** COUNT rc; 128 .loc 1 621 0 129 _.LVL7: 0 00004CB0 56 push si 0 00004CB1 55 push bp 132 _.LCFI2: 0 00004CB2 89E5 mov bp, sp 134 _.LCFI3: 0 00004CB4 8B7606 mov si, word ptr [bp+6] 136 _.L5: 624:fatfs.c **** { 137 .loc 1 624 0 0 00004CB7 56 push si 0 00004CB8 E8[FEFF] call _dir_read 140 _.LVL8: 0 00004CBB 83F801 cmp ax, 1 0 00004CBE 740F je _.L7 630:fatfs.c **** } 143 .loc 1 630 0 0 00004CC0 F7D0 not ax 145 _.LVL9: 0 00004CC2 D1E0 shl ax, 1 0 00004CC4 19C0 sbb ax, ax 0 00004CC6 F7D8 neg ax 149 _.LVL10: 150 _.L4: 631:fatfs.c **** 151 .loc 1 631 0 0 00004CC8 89EC mov sp, bp 0 00004CCA 5D pop bp 0 00004CCB 5E pop si 0 00004CCC C20200 ret 2 156 _.LVL11: 157 _.L7: 626:fatfs.c **** return TRUE; 158 .loc 1 626 0 0 00004CCF 807C0405 cmp byte ptr [si+4], 5 0 00004CD3 74F3 je _.L4 628:fatfs.c **** } 161 .loc 1 628 0 0 00004CD5 8B5C02 mov bx, word ptr [si+2] 0 00004CD8 FF470D inc word ptr [bx+13] 0 00004CDB EBDA jmp _.L5 165 _.LFE26: 166 .size _find_free, .-_find_free 167 .type _wipe_out_clusters, @function 168 _wipe_out_clusters: 169 _.LFB24: 568:fatfs.c **** REG CLUSTER next; 170 .loc 1 568 0 171 _.LVL12: 0 00004CDD 56 push si 0 00004CDE 57 push di 0 00004CDF 55 push bp 175 _.LCFI4: 0 00004CE0 89E5 mov bp, sp 177 _.LCFI5: 0 00004CE2 83EC08 sub sp, 8 0 00004CE5 8B5E08 mov bx, word ptr [bp+8] 0 00004CE8 8B460A mov ax, word ptr [bp+10] 0 00004CEB 8946FE mov word ptr [bp-2], ax 0 00004CEE 8B760C mov si, word ptr [bp+12] 0 00004CF1 8B7E0E mov di, word ptr [bp+14] 184 _.LVL13: 185 _.L11: 574:fatfs.c **** { 186 .loc 1 574 0 0 00004CF4 83FEFF cmp si, -1 0 00004CF7 751D jne _.L22 0 00004CF9 81FFFF0F cmp di, 4095 0 00004CFD 7517 jne _.L22 603:fatfs.c **** write_fsinfo(dpbp); 191 .loc 1 603 0 0 00004CFF 8E46FE mov es, word ptr [bp-2] 0 00004D02 26837F0F00 cmp word ptr es:[bx+15], 0 0 00004D07 7505 jne _.L10 604:fatfs.c **** #endif 195 .loc 1 604 0 0 00004D09 06 push es 0 00004D0A 53 push bx 0 00004D0B E8[FEFF] call _write_fsinfo 199 _.LVL14: 200 _.L10: 606:fatfs.c **** 201 .loc 1 606 0 0 00004D0E 89EC mov sp, bp 0 00004D10 5D pop bp 0 00004D11 5F pop di 205 _.LVL15: 0 00004D12 5E pop si 0 00004D13 C20800 ret 8 208 _.LVL16: 209 _.L22: 577:fatfs.c **** 210 .loc 1 577 0 0 00004D16 57 push di 0 00004D17 56 push si 0 00004D18 FF76FE push word ptr [bp-2] 0 00004D1B 53 push bx 0 00004D1C 895EFA mov word ptr [bp-6], bx 0 00004D1F E8[FEFF] call _next_cluster 217 _.LVL17: 0 00004D22 89C1 mov cx, ax 0 00004D24 8956FC mov word ptr [bp-4], dx 220 _.LVL18: 580:fatfs.c **** return; 221 .loc 1 580 0 0 00004D27 85D2 test dx, dx 0 00004D29 8B5EFA mov bx, word ptr [bp-6] 0 00004D2C 7505 jne _.L12 0 00004D2E 83F801 cmp ax, 1 0 00004D31 76DB jbe _.L10 227 _.L12: 0 00004D33 894EF8 mov word ptr [bp-8], cx 584:fatfs.c **** return; /* better abort on error */ 229 .loc 1 584 0 0 00004D36 31C0 xor ax, ax 0 00004D38 50 push ax 0 00004D39 50 push ax 0 00004D3A 57 push di 0 00004D3B 56 push si 0 00004D3C FF76FE push word ptr [bp-2] 0 00004D3F 53 push bx 0 00004D40 895EFA mov word ptr [bp-6], bx 0 00004D43 E8[FEFF] call _link_fat 239 _.LVL19: 0 00004D46 09D0 or ax, dx 0 00004D48 75C4 jne _.L10 589:fatfs.c **** { 242 .loc 1 589 0 0 00004D4A 8E46FE mov es, word ptr [bp-2] 0 00004D4D 8B5EFA mov bx, word ptr [bp-6] 0 00004D50 26837F0F00 cmp word ptr es:[bx+15], 0 0 00004D55 8B4EF8 mov cx, word ptr [bp-8] 0 00004D58 752C jne _.L16 591:fatfs.c **** dpbp->dpb_xcluster = st; 248 .loc 1 591 0 0 00004D5A 268B5739 mov dx, word ptr es:[bx+57] 0 00004D5E 268B473B mov ax, word ptr es:[bx+59] 0 00004D62 39F8 cmp ax, di 0 00004D64 770A ja _.L23 0 00004D66 7504 jne _.L20 0 00004D68 39F2 cmp dx, si 0 00004D6A 7704 ja _.L23 256 _.L20: 0 00004D6C 09C2 or dx, ax 0 00004D6E 750E jne _.L17 259 _.L23: 592:fatfs.c **** } 260 .loc 1 592 0 0 00004D70 8E46FE mov es, word ptr [bp-2] 0 00004D73 26897739 mov word ptr es:[bx+57], si 263 _.LVL20: 0 00004D77 8E46FE mov es, word ptr [bp-2] 0 00004D7A 26897F3B mov word ptr es:[bx+59], di 266 _.L17: 568:fatfs.c **** REG CLUSTER next; 267 .loc 1 568 0 0 00004D7E 89CE mov si, cx 269 _.LVL21: 0 00004D80 8B7EFC mov di, word ptr [bp-4] 0 00004D83 E96EFF jmp _.L11 272 _.LVL22: 273 _.L16: 596:fatfs.c **** dpbp->dpb_cluster = (UWORD)st; 274 .loc 1 596 0 0 00004D86 8E46FE mov es, word ptr [bp-2] 0 00004D89 268B471D mov ax, word ptr es:[bx+29] 0 00004D8D 85C0 test ax, ax 0 00004D8F 7404 je _.L21 596:fatfs.c **** dpbp->dpb_cluster = (UWORD)st; 279 .loc 1 596 0 is_stmt 0 discriminator 1 0 00004D91 39F0 cmp ax, si 0 00004D93 76E9 jbe _.L17 282 _.L21: 597:fatfs.c **** 283 .loc 1 597 0 is_stmt 1 0 00004D95 8E46FE mov es, word ptr [bp-2] 0 00004D98 2689771D mov word ptr es:[bx+29], si 286 _.LVL23: 0 00004D9C EBE0 jmp _.L17 288 _.LFE24: 289 .size _wipe_out_clusters, .-_wipe_out_clusters 290 .type _find_fat_free, @function 291 _find_fat_free: 292 _.LFB30: 694:fatfs.c **** REG CLUSTER idx, size, cluster; 293 .loc 1 694 0 294 _.LVL24: 0 00004D9E 56 push si 0 00004D9F 57 push di 0 00004DA0 55 push bp 298 _.LCFI6: 0 00004DA1 89E5 mov bp, sp 300 _.LCFI7: 0 00004DA3 83EC0C sub sp, 12 0 00004DA6 8B7608 mov si, word ptr [bp+8] 696:fatfs.c **** 303 .loc 1 696 0 0 00004DA9 8B5C29 mov bx, word ptr [si+41] 0 00004DAC 8B442B mov ax, word ptr [si+43] 0 00004DAF 8946FE mov word ptr [bp-2], ax 307 _.LVL25: 704:fatfs.c **** 308 .loc 1 704 0 0 00004DB2 8EC0 mov es, ax 0 00004DB4 268B470D mov ax, word ptr es:[bx+13] 311 _.LVL26: 0 00004DB8 8946FC mov word ptr [bp-4], ax 0 00004DBB C746FA0000 mov word ptr [bp-6], 0 314 _.LVL27: 707:fatfs.c **** { 315 .loc 1 707 0 0 00004DC0 26837F0F00 cmp word ptr es:[bx+15], 0 0 00004DC5 7403E99A00 jne _.L34 709:fatfs.c **** idx = dpbp->dpb_xcluster; 318 .loc 1 709 0 0 00004DCA 268B7F39 mov di, word ptr es:[bx+57] 0 00004DCE 268B4F3B mov cx, word ptr es:[bx+59] 0 00004DD2 89F8 mov ax, di 322 _.LVL28: 0 00004DD4 09C8 or ax, cx 0 00004DD6 7504 jne _.L35 703:fatfs.c **** size = dpbp->dpb_size; 325 .loc 1 703 0 0 00004DD8 BF0200 mov di, 2 0 00004DDB 91 xchg cx, ax 328 _.L35: 329 _.LVL29: 711:fatfs.c **** } 330 .loc 1 711 0 0 00004DDC 8E46FE mov es, word ptr [bp-2] 332 _.LVL30: 0 00004DDF 268B472D mov ax, word ptr es:[bx+45] 0 00004DE3 8946FC mov word ptr [bp-4], ax 335 _.LVL31: 0 00004DE6 268B472F mov ax, word ptr es:[bx+47] 0 00004DEA 8946FA mov word ptr [bp-6], ax 338 _.LVL32: 339 _.L37: 703:fatfs.c **** size = dpbp->dpb_size; 340 .loc 1 703 0 0 00004DED 89FE mov si, di 0 00004DEF 89CA mov dx, cx 343 _.LVL33: 344 _.L48: 0 00004DF1 894EF4 mov word ptr [bp-12], cx 346 _.LVL34: 726:fatfs.c **** #endif 347 .loc 1 726 0 0 00004DF4 52 push dx 0 00004DF5 8956F6 mov word ptr [bp-10], dx 0 00004DF8 56 push si 0 00004DF9 FF76FE push word ptr [bp-2] 0 00004DFC 53 push bx 0 00004DFD 895EF8 mov word ptr [bp-8], bx 0 00004E00 E8[FEFF] call _is_free_cluster 355 _.LVL35: 0 00004E03 85C0 test ax, ax 0 00004E05 8B5EF8 mov bx, word ptr [bp-8] 0 00004E08 8B56F6 mov dx, word ptr [bp-10] 0 00004E0B 756C jne _.L46 732:fatfs.c **** /* wrap the search just in case there are free clusters before */ 360 .loc 1 732 0 0 00004E0D 83C601 add si, 1 362 _.LVL36: 0 00004E10 83D200 adc dx, 0 364 _.LVL37: 735:fatfs.c **** if (idx == cluster) { 365 .loc 1 735 0 0 00004E13 3B56FA cmp dx, word ptr [bp-6] 0 00004E16 8B4EF4 mov cx, word ptr [bp-12] 0 00004E19 7707 ja _.L47 0 00004E1B 750A jne _.L39 0 00004E1D 3B76FC cmp si, word ptr [bp-4] 0 00004E20 7605 jbe _.L39 372 _.L47: 0 00004E22 BE0200 mov si, 2 374 _.LVL38: 0 00004E25 31D2 xor dx, dx 376 _.L39: 377 _.LVL39: 736:fatfs.c **** /* No empty clusters, disk is FULL! */ 378 .loc 1 736 0 0 00004E27 39F7 cmp di, si 0 00004E29 75C6 jne _.L48 0 00004E2B 39D1 cmp cx, dx 0 00004E2D 75C2 jne _.L48 738:fatfs.c **** idx = LONG_LAST_CLUSTER; 383 .loc 1 738 0 0 00004E2F 31C0 xor ax, ax 0 00004E31 89C1 mov cx, ax 739:fatfs.c **** break; 386 .loc 1 739 0 0 00004E33 BEFFFF mov si, -1 388 _.LVL40: 0 00004E36 BAFF0F mov dx, 4095 390 _.L38: 391 _.LVL41: 745:fatfs.c **** { 392 .loc 1 745 0 0 00004E39 8E46FE mov es, word ptr [bp-2] 0 00004E3C 26837F0F00 cmp word ptr es:[bx+15], 0 0 00004E41 753C jne _.L42 0 00004E43 8956FC mov word ptr [bp-4], dx 397 _.LVL42: 747:fatfs.c **** /* return the free entry */ 398 .loc 1 747 0 0 00004E46 26894739 mov word ptr es:[bx+57], ax 400 _.LVL43: 0 00004E4A 8E46FE mov es, word ptr [bp-2] 0 00004E4D 26894F3B mov word ptr es:[bx+59], cx 749:fatfs.c **** return idx; 403 .loc 1 749 0 0 00004E51 FF76FE push word ptr [bp-2] 0 00004E54 53 push bx 0 00004E55 E8[FEFF] call _write_fsinfo 407 _.LVL44: 750:fatfs.c **** } 408 .loc 1 750 0 0 00004E58 8B56FC mov dx, word ptr [bp-4] 410 _.L33: 757:fatfs.c **** 411 .loc 1 757 0 0 00004E5B 96 xchg si, ax 0 00004E5C 89EC mov sp, bp 0 00004E5E 5D pop bp 0 00004E5F 5F pop di 0 00004E60 5E pop si 0 00004E61 C20200 ret 2 418 _.LVL45: 419 _.L34: 715:fatfs.c **** idx = dpbp->dpb_cluster; 420 .loc 1 715 0 0 00004E64 8E46FE mov es, word ptr [bp-2] 422 _.LVL46: 0 00004E67 268B7F1D mov di, word ptr es:[bx+29] 0 00004E6B 85FF test di, di 0 00004E6D 7405 je _.L45 426 _.L50: 703:fatfs.c **** size = dpbp->dpb_size; 427 .loc 1 703 0 0 00004E6F 31C9 xor cx, cx 0 00004E71 E979FF jmp _.L37 430 _.L45: 0 00004E74 BF0200 mov di, 2 0 00004E77 EBF6 jmp _.L50 433 _.LVL47: 434 _.L46: 0 00004E79 89F0 mov ax, si 0 00004E7B 89D1 mov cx, dx 0 00004E7D EBBA jmp _.L38 438 _.LVL48: 439 _.L42: 754:fatfs.c **** /* return the free entry */ 440 .loc 1 754 0 0 00004E7F 8E46FE mov es, word ptr [bp-2] 0 00004E82 2689471D mov word ptr es:[bx+29], ax 443 _.LVL49: 756:fatfs.c **** } 444 .loc 1 756 0 0 00004E86 EBD3 jmp _.L33 446 _.LFE30: 447 .size _find_fat_free, .-_find_fat_free === Switch to base=012BB0h -> ".RODATA.STR1.1" 448 .section .rodata.str1.1,"aMS",@progbits,1 449 _.LC0: 0 0000191F 4641542063686169 .string "FAT chain size bad!\n" 0 00001927 6E2073697A652062 0 0000192F 6164210A00 === Switch to base=002270h -> ".TEXT" 451 .text 452 .type _extend, @function 453 _extend: 454 _.LFB33: 881:fatfs.c **** CLUSTER free_fat; 455 .loc 1 881 0 456 _.LVL50: 0 00004E88 56 push si 0 00004E89 57 push di 0 00004E8A 55 push bp 460 _.LCFI8: 0 00004E8B 89E5 mov bp, sp 462 _.LCFI9: 0 00004E8D 1E push ds 0 00004E8E 8B7608 mov si, word ptr [bp+8] 885:fatfs.c **** 465 .loc 1 885 0 0 00004E91 56 push si 0 00004E92 E809FF call _find_fat_free 468 _.LVL51: 0 00004E95 89C7 mov di, ax 0 00004E97 89D1 mov cx, dx 471 _.LVL52: 889:fatfs.c **** return free_fat; 472 .loc 1 889 0 0 00004E99 83F8FF cmp ax, -1 0 00004E9C 750E jne _.L52 0 00004E9E 81FAFF0F cmp dx, 4095 0 00004EA2 7508 jne _.L52 477 _.LVL53: 478 _.L61: 909:fatfs.c **** } 479 .loc 1 909 0 0 00004EA4 BFFFFF mov di, -1 0 00004EA7 B9FF0F mov cx, 4095 0 00004EAA EB39 jmp _.L51 483 _.LVL54: 484 _.L52: 894:fatfs.c **** return LONG_LAST_CLUSTER; /* do not try 1a/1b if 2 did not work out */ 485 .loc 1 894 0 0 00004EAC B8FF0F mov ax, 4095 487 _.LVL55: 0 00004EAF 50 push ax 0 00004EB0 B8FFFF mov ax, -1 0 00004EB3 50 push ax 0 00004EB4 51 push cx 0 00004EB5 894EFE mov word ptr [bp-2], cx 0 00004EB8 57 push di 0 00004EB9 FF742B push word ptr [si+43] 0 00004EBC FF7429 push word ptr [si+41] 0 00004EBF E8[FEFF] call _link_fat 497 _.LVL56: 0 00004EC2 09D0 or ax, dx 0 00004EC4 8B4EFE mov cx, word ptr [bp-2] 0 00004EC7 75DB jne _.L61 900:fatfs.c **** setdstart(fnp->f_dpb, &fnp->f_dir, free_fat); /* 1a */ 501 .loc 1 900 0 0 00004EC9 8B4435 mov ax, word ptr [si+53] 0 00004ECC 8B5437 mov dx, word ptr [si+55] 0 00004ECF 89C3 mov bx, ax 0 00004ED1 09D3 or bx, dx 0 00004ED3 751B jne _.L55 507 _.LBB16: 508 _.LBB17: 69:fatfs.c **** dentry->dir_start_high = (UWORD)(value >> 16); 509 .loc 1 69 0 0 00004ED5 C45C29 les bx, dword ptr [si+41] 0 00004ED8 897C1E mov word ptr [si+30], di 0 00004EDB 26837F0F00 cmp word ptr es:[bx+15], 0 0 00004EE0 7503 jne _.L51 70:fatfs.c **** } 514 .loc 1 70 0 0 00004EE2 894C18 mov word ptr [si+24], cx 516 _.LVL57: 517 _.L51: 518 _.LBE17: 519 _.LBE16: 916:fatfs.c **** 520 .loc 1 916 0 0 00004EE5 97 xchg di, ax 0 00004EE6 89CA mov dx, cx 0 00004EE8 89EC mov sp, bp 0 00004EEA 5D pop bp 0 00004EEB 5F pop di 0 00004EEC 5E pop si 0 00004EED C20200 ret 2 528 _.LVL58: 529 _.L55: 0 00004EF0 894EFE mov word ptr [bp-2], cx 531 _.LVL59: 905:fatfs.c **** { 532 .loc 1 905 0 0 00004EF3 52 push dx 0 00004EF4 50 push ax 0 00004EF5 FF742B push word ptr [si+43] 0 00004EF8 FF7429 push word ptr [si+41] 0 00004EFB E8[FEFF] call _next_cluster 538 _.LVL60: 0 00004EFE 83F8FF cmp ax, -1 0 00004F01 8B4EFE mov cx, word ptr [bp-2] 0 00004F04 7506 jne _.L58 0 00004F06 81FAFF0F cmp dx, 4095 0 00004F0A 7409 je _.L59 544 _.L58: 908:fatfs.c **** return LONG_LAST_CLUSTER; 545 .loc 1 908 0 0 00004F0C B8[0000] mov ax, offset _.LC0 0 00004F0F 50 push ax 0 00004F10 E8[FEFF] call _put_string 549 _.LVL61: 0 00004F13 EB8F jmp _.L61 551 _.L59: 911:fatfs.c **** return LONG_LAST_CLUSTER; /* should never happen */ 552 .loc 1 911 0 0 00004F15 51 push cx 0 00004F16 894EFE mov word ptr [bp-2], cx 0 00004F19 57 push di 0 00004F1A FF7437 push word ptr [si+55] 0 00004F1D FF7435 push word ptr [si+53] 0 00004F20 FF742B push word ptr [si+43] 0 00004F23 FF7429 push word ptr [si+41] 0 00004F26 E8[FEFF] call _link_fat 561 _.LVL62: 0 00004F29 09D0 or ax, dx 0 00004F2B 8B4EFE mov cx, word ptr [bp-2] 0 00004F2E 7403E971FF jne _.L61 0 00004F33 EBB0 jmp _.L51 566 _.LFE33: 567 .size _extend, .-_extend 568 .type _rqblockio, @function 569 _rqblockio: 570 _.LFB44: 1732:fatfs.c **** retry: 571 .loc 1 1732 0 572 _.LVL63: 0 00004F35 56 push si 0 00004F36 57 push di 0 00004F37 55 push bp 576 _.LCFI10: 0 00004F38 89E5 mov bp, sp 578 _.LCFI11: 0 00004F3A 1E push ds 0 00004F3B 1E push ds 0 00004F3C 8B5E0A mov bx, word ptr [bp+10] 0 00004F3F 8B460C mov ax, word ptr [bp+12] 0 00004F42 8946FE mov word ptr [bp-2], ax 1738:fatfs.c **** 584 .loc 1 1738 0 0 00004F45 31FF xor di, di 586 _.L63: 587 _.L64: 1734:fatfs.c **** MediaReqHdr.r_unit = dpbp->dpb_subunit; 588 .loc 1 1734 0 0 00004F47 BE[0000] mov si, offset _MediaReqHdr 0 00004F4A C606[0000]1E mov byte ptr [_MediaReqHdr], 30 1735:fatfs.c **** MediaReqHdr.r_command = command; 591 .loc 1 1735 0 0 00004F4F 8E46FE mov es, word ptr [bp-2] 0 00004F52 268A4701 mov al, byte ptr es:[bx+1] 0 00004F56 884401 mov byte ptr [si+1], al 1736:fatfs.c **** MediaReqHdr.r_mcmdesc = dpbp->dpb_mdb; 595 .loc 1 1736 0 0 00004F59 8A4608 mov al, byte ptr [bp+8] 0 00004F5C 884402 mov byte ptr [si+2], al 1737:fatfs.c **** MediaReqHdr.r_status = 0; 598 .loc 1 1737 0 0 00004F5F 268A4717 mov al, byte ptr es:[bx+23] 0 00004F63 88440D mov byte ptr [si+13], al 1738:fatfs.c **** 601 .loc 1 1738 0 0 00004F66 893E[0300] mov word ptr [_MediaReqHdr+3], di 1740:fatfs.c **** MediaReqHdr.r_bpfat = (boot FAR *)DiskTransferBuffer; 603 .loc 1 1740 0 0 00004F6A 807E0802 cmp byte ptr [bp+8], 2 0 00004F6E 7508 jne _.L65 1741:fatfs.c **** execrh((request FAR *) & MediaReqHdr, dpbp->dpb_device); 606 .loc 1 1741 0 0 00004F70 C7440E[0000] mov word ptr [si+14], offset _DiskTransferBuffer 0 00004F75 8C5410 mov word ptr [si+16], ss 609 _.L65: 1742:fatfs.c **** if ((MediaReqHdr.r_status & S_ERROR) || !(MediaReqHdr.r_status & S_DONE)) 610 .loc 1 1742 0 0 00004F78 8E46FE mov es, word ptr [bp-2] 0 00004F7B 26FF7715 push word ptr es:[bx+21] 0 00004F7F 26FF7713 push word ptr es:[bx+19] 0 00004F83 895EFC mov word ptr [bp-4], bx 0 00004F86 16 push ss 0 00004F87 B8[0000] mov ax, offset _MediaReqHdr 0 00004F8A 50 push ax 0 00004F8B E8[FEFF] call _execrh 619 _.LVL64: 1743:fatfs.c **** { 620 .loc 1 1743 0 0 00004F8E 8B4403 mov ax, word ptr [si+3] 0 00004F91 85C0 test ax, ax 0 00004F93 8B5EFC mov bx, word ptr [bp-4] 0 00004F96 7C05 jl _.L76 1743:fatfs.c **** { 625 .loc 1 1743 0 is_stmt 0 discriminator 1 0 00004F98 F6C401 test ah, 1 0 00004F9B 753B jne _.L70 628 _.L76: 1747:fatfs.c **** { 629 .loc 1 1747 0 is_stmt 1 0 00004F9D 57 push di 0 00004F9E 8E46FE mov es, word ptr [bp-2] 0 00004FA1 26FF7715 push word ptr es:[bx+21] 0 00004FA5 26FF7713 push word ptr es:[bx+19] 0 00004FA9 268A07 mov al, byte ptr es:[bx] 0 00004FAC 895EFC mov word ptr [bp-4], bx 0 00004FAF 98 cbw 0 00004FB0 50 push ax 0 00004FB1 B8[0000] mov ax, offset _MediaReqHdr 0 00004FB4 50 push ax 0 00004FB5 E8[FEFF] call _block_error 641 _.LVL65: 0 00004FB8 83F801 cmp ax, 1 0 00004FBB 8B5EFC mov bx, word ptr [bp-4] 0 00004FBE 7487 je _.L64 0 00004FC0 7F0C jg _.L68 0 00004FC2 85C0 test ax, ax 0 00004FC4 75D7 jne _.L76 648 _.L62: 1762:fatfs.c **** 649 .loc 1 1762 0 0 00004FC6 89EC mov sp, bp 0 00004FC8 5D pop bp 0 00004FC9 5F pop di 0 00004FCA 5E pop si 0 00004FCB C20600 ret 6 655 _.L68: 1747:fatfs.c **** { 656 .loc 1 1747 0 0 00004FCE 83F803 cmp ax, 3 0 00004FD1 7FCA jg _.L76 1751:fatfs.c **** 659 .loc 1 1751 0 0 00004FD3 B8F1FF mov ax, -15 0 00004FD6 EBEE jmp _.L62 662 _.L70: 1761:fatfs.c **** } 663 .loc 1 1761 0 0 00004FD8 31C0 xor ax, ax 0 00004FDA EBEA jmp _.L62 666 _.LFE44: 667 .size _rqblockio, .-_rqblockio 668 .type _wipe_out, @function 669 _wipe_out: 670 _.LFB25: 611:fatfs.c **** /* if not already free and valid file, do it */ 671 .loc 1 611 0 672 _.LVL66: 0 00004FDC 56 push si 0 00004FDD 55 push bp 675 _.LCFI12: 0 00004FDE 89E5 mov bp, sp 677 _.LCFI13: 0 00004FE0 8B5E06 mov bx, word ptr [bp+6] 679 _.LBB22: 680 _.LBB23: 61:fatfs.c **** return dentry->dir_start; 681 .loc 1 61 0 0 00004FE3 C47729 les si, dword ptr [bx+41] 0 00004FE6 8CC2 mov dx, es 0 00004FE8 26837C0F00 cmp word ptr es:[si+15], 0 0 00004FED 8B4F1E mov cx, word ptr [bx+30] 0 00004FF0 7418 je _.L82 62:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 687 .loc 1 62 0 0 00004FF2 31C0 xor ax, ax 689 _.L83: 690 _.LBE23: 691 _.LBE22: 614:fatfs.c **** wipe_out_clusters(fnp->f_dpb, cluster); 692 .loc 1 614 0 0 00004FF4 89CB mov bx, cx 0 00004FF6 09C3 or bx, ax 0 00004FF8 85DB test bx, bx 0 00004FFA 7407 je _.L81 615:fatfs.c **** /* no flushing here: could get lost chain or "crosslink seed" but */ 697 .loc 1 615 0 0 00004FFC 50 push ax 0 00004FFD 51 push cx 0 00004FFE 52 push dx 0 00004FFF 56 push si 0 00005000 E8DAFC call _wipe_out_clusters 703 _.LVL67: 704 _.L81: 618:fatfs.c **** 705 .loc 1 618 0 0 00005003 89EC mov sp, bp 0 00005005 5D pop bp 0 00005006 5E pop si 0 00005007 C20200 ret 2 710 _.L82: 711 _.LVL68: 712 _.LBB27: 713 _.LBB26: 714 _.LBB24: 715 _.LBB25: 63:fatfs.c **** } 716 .loc 1 63 0 0 0000500A 8B4718 mov ax, word ptr [bx+24] 718 _.LVL69: 0 0000500D EBE5 jmp _.L83 720 _.LBE25: 721 _.LBE24: 722 _.LBE26: 723 _.LBE27: 724 _.LFE25: 725 .size _wipe_out, .-_wipe_out 726 .type _fnode_to_sft, @function 727 _fnode_to_sft: 728 _.LFB47: 1839:fatfs.c **** 1840:fatfs.c **** STATIC void fnode_to_sft(f_node_ptr fnp) 1841:fatfs.c **** { 729 .loc 1 1841 0 730 _.LVL70: 0 0000500F 56 push si 0 00005010 57 push di 0 00005011 55 push bp 734 _.LCFI14: 0 00005012 89E5 mov bp, sp 736 _.LCFI15: 0 00005014 1E push ds 0 00005015 1E push ds 0 00005016 8B7608 mov si, word ptr [bp+8] 1842:fatfs.c **** sft FAR *sftp = idx_to_sft(fnp->f_sft_idx); 740 .loc 1 1842 0 0 00005019 8A4439 mov al, byte ptr [si+57] 0 0000501C 30E4 xor ah, ah 0 0000501E 50 push ax 0 0000501F E8[FEFF] call _idx_to_sft 745 _.LVL71: 0 00005022 93 xchg bx, ax 747 _.LVL72: 1843:fatfs.c **** 1844:fatfs.c **** sftp->sft_flags = fnp->f_flags; 748 .loc 1 1844 0 0 00005023 8B04 mov ax, word ptr [si] 750 _.LVL73: 0 00005025 8EC2 mov es, dx 0 00005027 26894705 mov word ptr es:[bx+5], ax 753 _.LVL74: 1845:fatfs.c **** 1846:fatfs.c **** sftp->sft_attrib = fnp->f_dir.dir_attrib; 754 .loc 1 1846 0 0 0000502B 8A440F mov al, byte ptr [si+15] 0 0000502E 26884704 mov byte ptr es:[bx+4], al 1847:fatfs.c **** fmemcpy(sftp->sft_name, fnp->f_dir.dir_name, FNAME_SIZE + FEXT_SIZE); 757 .loc 1 1847 0 0 00005032 B80B00 mov ax, 11 0 00005035 50 push ax 0 00005036 8D4404 lea ax, [4+si] 0 00005039 16 push ss 0 0000503A 50 push ax 0 0000503B 8D4720 lea ax, [32+bx] 0 0000503E 895EFC mov word ptr [bp-4], bx 0 00005041 52 push dx 0 00005042 8956FE mov word ptr [bp-2], dx 0 00005045 50 push ax 0 00005046 E8[FEFF] call _fmemcpy 769 _.LVL75: 1848:fatfs.c **** sftp->sft_time = fnp->f_dir.dir_time; 770 .loc 1 1848 0 0 00005049 8B441A mov ax, word ptr [si+26] 0 0000504C 8B56FE mov dx, word ptr [bp-2] 0 0000504F 8EC2 mov es, dx 0 00005051 8B5EFC mov bx, word ptr [bp-4] 0 00005054 2689470D mov word ptr es:[bx+13], ax 776 _.LVL76: 1849:fatfs.c **** sftp->sft_date = fnp->f_dir.dir_date; 777 .loc 1 1849 0 0 00005058 8B441C mov ax, word ptr [si+28] 0 0000505B 2689470F mov word ptr es:[bx+15], ax 1850:fatfs.c **** sftp->sft_size = fnp->f_dir.dir_size; 780 .loc 1 1850 0 0 0000505F 8B4420 mov ax, word ptr [si+32] 0 00005062 8B4C22 mov cx, word ptr [si+34] 0 00005065 26894711 mov word ptr es:[bx+17], ax 0 00005069 26894F13 mov word ptr es:[bx+19], cx 785 _.LVL77: 786 _.LBB32: 787 _.LBB33: 61:fatfs.c **** return dentry->dir_start; 788 .loc 1 61 0 0 0000506D C47C29 les di, dword ptr [si+41] 0 00005070 26837D0F00 cmp word ptr es:[di+15], 0 0 00005075 8B4C1E mov cx, word ptr [si+30] 0 00005078 7461 je _.L91 62:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 793 .loc 1 62 0 0 0000507A 31C0 xor ax, ax 795 _.L92: 796 _.LVL78: 797 _.LBE33: 798 _.LBE32: 1851:fatfs.c **** sftp->sft_stclust = getdstart(fnp->f_dpb, &fnp->f_dir); 799 .loc 1 1851 0 0 0000507C 8EC2 mov es, dx 0 0000507E 26894F2B mov word ptr es:[bx+43], cx 0 00005082 2689472D mov word ptr es:[bx+45], ax 1852:fatfs.c **** 1853:fatfs.c **** sftp->sft_diridx = fnp->f_diridx; 803 .loc 1 1853 0 0 00005086 8A4428 mov al, byte ptr [si+40] 0 00005089 2688471F mov byte ptr es:[bx+31], al 1854:fatfs.c **** sftp->sft_dirsector = fnp->f_dirsector; 806 .loc 1 1854 0 0 0000508D 8B4424 mov ax, word ptr [si+36] 0 00005090 8B4C26 mov cx, word ptr [si+38] 0 00005093 2689471B mov word ptr es:[bx+27], ax 0 00005097 26894F1D mov word ptr es:[bx+29], cx 1855:fatfs.c **** sftp->sft_dcb = fnp->f_dpb; 811 .loc 1 1855 0 0 0000509B 8B4429 mov ax, word ptr [si+41] 0 0000509E 8B4C2B mov cx, word ptr [si+43] 0 000050A1 26894707 mov word ptr es:[bx+7], ax 0 000050A5 26894F09 mov word ptr es:[bx+9], cx 1856:fatfs.c **** sftp->sft_posit = fnp->f_offset; 816 .loc 1 1856 0 0 000050A9 8B442D mov ax, word ptr [si+45] 0 000050AC 8B4C2F mov cx, word ptr [si+47] 0 000050AF 26894715 mov word ptr es:[bx+21], ax 0 000050B3 26894F17 mov word ptr es:[bx+23], cx 1857:fatfs.c **** sftp->sft_cuclust = fnp->f_cluster; 821 .loc 1 1857 0 0 000050B7 8B4435 mov ax, word ptr [si+53] 0 000050BA 8B4C37 mov cx, word ptr [si+55] 0 000050BD 26894735 mov word ptr es:[bx+53], ax 0 000050C1 26894F37 mov word ptr es:[bx+55], cx 1858:fatfs.c **** sftp->sft_relclust = (UWORD)fnp->f_cluster_offset; 826 .loc 1 1858 0 0 000050C5 8B4431 mov ax, word ptr [si+49] 0 000050C8 26894719 mov word ptr es:[bx+25], ax 1859:fatfs.c **** #ifdef WITHFAT32 1860:fatfs.c **** sftp->sft_relclust_high = (UWORD)(fnp->f_cluster_offset >> 16); 829 .loc 1 1860 0 0 000050CC 8B4433 mov ax, word ptr [si+51] 0 000050CF 2689470B mov word ptr es:[bx+11], ax 1861:fatfs.c **** #endif 1862:fatfs.c **** } 832 .loc 1 1862 0 0 000050D3 89EC mov sp, bp 0 000050D5 5D pop bp 0 000050D6 5F pop di 0 000050D7 5E pop si 0 000050D8 C20200 ret 2 838 _.LVL79: 839 _.L91: 840 _.LBB37: 841 _.LBB36: 842 _.LBB34: 843 _.LBB35: 63:fatfs.c **** } 844 .loc 1 63 0 0 000050DB 8B4418 mov ax, word ptr [si+24] 846 _.LVL80: 0 000050DE EB9C jmp _.L92 848 _.LBE35: 849 _.LBE34: 850 _.LBE36: 851 _.LBE37: 852 _.LFE47: 853 .size _fnode_to_sft, .-_fnode_to_sft 854 .type _merge_file_changes, @function 855 _merge_file_changes: 856 _.LFB18: 336:fatfs.c **** int i, j; 857 .loc 1 336 0 858 _.LVL81: 0 000050E0 56 push si 0 000050E1 57 push di 0 000050E2 55 push bp 862 _.LCFI16: 0 000050E3 89E5 mov bp, sp 864 _.LCFI17: 0 000050E5 83EC0C sub sp, 12 0 000050E8 8B7E08 mov di, word ptr [bp+8] 341:fatfs.c **** return SUCCESS; 867 .loc 1 341 0 0 000050EB 31F6 xor si, si 0 000050ED 56 push si 0 000050EE E8[FEFF] call _IsShareInstalled 871 _.LVL82: 0 000050F1 39F0 cmp ax, si 0 000050F3 7505 jne _.L95 874 _.LVL83: 875 _.L114: 876 _.LBB47: 877 _.LBB48: 374:fatfs.c **** } 878 .loc 1 374 0 0 000050F5 31C0 xor ax, ax 0 000050F7 E9D300 jmp _.L94 881 _.LVL84: 882 _.L95: 0 000050FA 8EC6 mov es, si 884 _.LVL85: 345:fatfs.c **** { 885 .loc 1 345 0 0 000050FC A1[0000] mov ax, word ptr [_sfthead] 0 000050FF 8946FE mov word ptr [bp-2], ax 0 00005102 8B16[0200] mov dx, word ptr [_sfthead+2] 889 _.LVL86: 344:fatfs.c **** for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next) 890 .loc 1 344 0 0 00005106 89F1 mov cx, si 892 _.LVL87: 893 _.L97: 345:fatfs.c **** { 894 .loc 1 345 0 0 00005108 837EFEFF cmp word ptr [bp-2], -1 0 0000510C 7505 jne _.L108 0 0000510E 83FAFF cmp dx, -1 0 00005111 74E2 je _.L114 899 _.L108: 347:fatfs.c **** { 900 .loc 1 347 0 0 00005113 8EDA mov ds, dx 0 00005115 8B5EFE mov bx, word ptr [bp-2] 0 00005118 8B4704 mov ax, word ptr [bx+4] 0 0000511B 8946FA mov word ptr [bp-6], ax 905 _.LVL88: 0 0000511E 83C306 add bx, 6 907 _.LVL89: 908 _.L98: 0 00005121 FF4EFA dec word ptr [bp-6] 910 _.LVL90: 0 00005124 790F jns _.L107 345:fatfs.c **** { 912 .loc 1 345 0 0 00005126 8B5EFE mov bx, word ptr [bp-2] 914 _.LVL91: 0 00005129 8EDA mov ds, dx 0 0000512B 8B07 mov ax, word ptr [bx] 0 0000512D 8946FE mov word ptr [bp-2], ax 0 00005130 8B5702 mov dx, word ptr [bx+2] 919 _.LVL92: 0 00005133 EBD3 jmp _.L97 921 _.LVL93: 922 _.L107: 349:fatfs.c **** && fnp->f_dpb == sftp->sft_dcb 923 .loc 1 349 0 0 00005135 368A4539 mov al, byte ptr ss:[di+57] 0 00005139 30E4 xor ah, ah 0 0000513B 39C8 cmp ax, cx 0 0000513D 7503E91E01 je _.L100 0 00005142 8EDA mov ds, dx 0 00005144 833F00 cmp word ptr [bx], 0 0 00005147 7503E91401 je _.L100 350:fatfs.c **** && (fnp->f_dir.dir_attrib & D_VOLID) == 0 931 .loc 1 350 0 0 0000514C 368B4529 mov ax, word ptr ss:[di+41] 0 00005150 96 xchg si, ax 0 00005151 368B452B mov ax, word ptr ss:[di+43] 0 00005155 8946FC mov word ptr [bp-4], ax 0 00005158 89F0 mov ax, si 0 0000515A 397707 cmp word ptr [bx+7], si 0 0000515D 7403E9FE00 jne _.L100 0 00005162 8B46FC mov ax, word ptr [bp-4] 0 00005165 394709 cmp word ptr [bx+9], ax 0 00005168 7403E9F300 jne _.L100 351:fatfs.c **** && (sftp->sft_attrib & D_VOLID) == 0 942 .loc 1 351 0 0 0000516D 36F6450F08 test byte ptr ss:[di+15], 8 0 00005172 7403E9E900 jne _.L100 352:fatfs.c **** && fnp->f_diridx == sftp->sft_diridx 945 .loc 1 352 0 0 00005177 F6470408 test byte ptr [bx+4], 8 0 0000517B 7403E9E000 jne _.L100 353:fatfs.c **** && fnp->f_dirsector == sftp->sft_dirsector 948 .loc 1 353 0 0 00005180 368A4528 mov al, byte ptr ss:[di+40] 0 00005184 3A471F cmp al, byte ptr [bx+31] 0 00005187 7403E9D400 jne _.L100 354:fatfs.c **** ) /* same file, but different FD */ 952 .loc 1 354 0 0 0000518C 368B4524 mov ax, word ptr ss:[di+36] 0 00005190 3B471B cmp ax, word ptr [bx+27] 0 00005193 7403E9C800 jne _.L100 0 00005198 368B4526 mov ax, word ptr ss:[di+38] 0 0000519C 3B471D cmp ax, word ptr [bx+29] 0 0000519F 7403E9BC00 jne _.L100 357:fatfs.c **** { 959 .loc 1 357 0 0 000051A4 837E0AFF cmp word ptr [bp+10], -1 0 000051A8 752D jne _.L102 0 000051AA 895EF4 mov word ptr [bp-12], bx 0 000051AD 8956F6 mov word ptr [bp-10], dx 964 _.LBB49: 360:fatfs.c **** if (rc != SUCCESS) 965 .loc 1 360 0 0 000051B0 06 push es 0 000051B1 8C46F8 mov word ptr [bp-8], es 0 000051B4 51 push cx 0 000051B5 894EFC mov word ptr [bp-4], cx 0 000051B8 16 push ss 0 000051B9 1F pop ds 0 000051BA E8[FEFF] call _DosCloseSft 973 _.LVL94: 361:fatfs.c **** return rc; 974 .loc 1 361 0 0 000051BD 85C0 test ax, ax 0 000051BF 8B4EFC mov cx, word ptr [bp-4] 0 000051C2 C456F6 les dx, dword ptr [bp-10] 0 000051C5 8B5EF4 mov bx, word ptr [bp-12] 0 000051C8 7503E99300 je _.L100 980 _.LVL95: 981 _.L94: 982 _.LBE49: 983 _.LBE48: 984 _.LBE47: 391:fatfs.c **** 985 .loc 1 391 0 0 000051CD 89EC mov sp, bp 0 000051CF 5D pop bp 0 000051D0 5F pop di 0 000051D1 5E pop si 0 000051D2 16 push ss 0 000051D3 1F pop ds 0 000051D4 C20400 ret 4 993 _.LVL96: 994 _.L102: 995 _.LBB59: 996 _.LBB58: 364:fatfs.c **** { 997 .loc 1 364 0 0 000051D7 837E0A00 cmp word ptr [bp+10], 0 0 000051DB 7445 je _.L103 368:fatfs.c **** { 1000 .loc 1 368 0 0 000051DD 8EDA mov ds, dx 0 000051DF F6470203 test byte ptr [bx+2], 3 0 000051E3 747B je _.L100 370:fatfs.c **** fnp->f_dir.dir_size = sftp->sft_size; 1004 .loc 1 370 0 0 000051E5 8EC2 mov es, dx 0 000051E7 26C54F2B lds cx, dword ptr es:[bx+43] 1007 _.LVL97: 1008 _.LBB50: 1009 _.LBB51: 68:fatfs.c **** if (ISFAT32(dpbp)) 1010 .loc 1 68 0 0 000051EB 36894D1E mov word ptr ss:[di+30], cx 69:fatfs.c **** dentry->dir_start_high = (UWORD)(value >> 16); 1012 .loc 1 69 0 0 000051EF 8E46FC mov es, word ptr [bp-4] 0 000051F2 26837C0F00 cmp word ptr es:[si+15], 0 0 000051F7 7504 jne _.L104 70:fatfs.c **** } 1016 .loc 1 70 0 0 000051F9 368C5D18 mov word ptr ss:[di+24], ds 1018 _.L104: 1019 _.LVL98: 1020 _.LBE51: 1021 _.LBE50: 371:fatfs.c **** fnp->f_dir.dir_date = sftp->sft_date; 1022 .loc 1 371 0 0 000051FD 8EC2 mov es, dx 0 000051FF 268B4711 mov ax, word ptr es:[bx+17] 0 00005203 268B4F13 mov cx, word ptr es:[bx+19] 0 00005207 36894520 mov word ptr ss:[di+32], ax 0 0000520B 36894D22 mov word ptr ss:[di+34], cx 372:fatfs.c **** fnp->f_dir.dir_time = sftp->sft_time; 1028 .loc 1 372 0 0 0000520F 268B470F mov ax, word ptr es:[bx+15] 0 00005213 3689451C mov word ptr ss:[di+28], ax 373:fatfs.c **** return SUCCESS; 1031 .loc 1 373 0 0 00005217 268B470D mov ax, word ptr es:[bx+13] 0 0000521B 3689451A mov word ptr ss:[di+26], ax 0 0000521F E9D3FE jmp _.L114 1035 _.LVL99: 1036 _.L103: 1037 _.LBB52: 1038 _.LBB53: 61:fatfs.c **** return dentry->dir_start; 1039 .loc 1 61 0 0 00005222 8E5EFC mov ds, word ptr [bp-4] 0 00005225 837C0F00 cmp word ptr [si+15], 0 0 00005229 368E5D1E mov ds, word ptr ss:[di+30] 0 0000522D 7438 je _.L105 62:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 1044 .loc 1 62 0 0 0000522F 8B460A mov ax, word ptr [bp+10] 1046 _.L106: 0 00005232 8CC6 mov si, es 1048 _.LVL100: 1049 _.LBE53: 1050 _.LBE52: 382:fatfs.c **** sftp->sft_size = fnp->f_dir.dir_size; 1051 .loc 1 382 0 0 00005234 8EC2 mov es, dx 0 00005236 268C5F2B mov word ptr es:[bx+43], ds 1054 _.LVL101: 0 0000523A 8EDA mov ds, dx 0 0000523C 89472D mov word ptr [bx+45], ax 383:fatfs.c **** sftp->sft_date = fnp->f_dir.dir_date; 1057 .loc 1 383 0 0 0000523F 368E5D20 mov ds, word ptr ss:[di+32] 0 00005243 368B4522 mov ax, word ptr ss:[di+34] 0 00005247 268C5F11 mov word ptr es:[bx+17], ds 0 0000524B 8EDA mov ds, dx 0 0000524D 894713 mov word ptr [bx+19], ax 384:fatfs.c **** sftp->sft_time = fnp->f_dir.dir_time; 1063 .loc 1 384 0 0 00005250 368B451C mov ax, word ptr ss:[di+28] 0 00005254 89470F mov word ptr [bx+15], ax 385:fatfs.c **** } 1066 .loc 1 385 0 0 00005257 368B451A mov ax, word ptr ss:[di+26] 0 0000525B 89470D mov word ptr [bx+13], ax 0 0000525E 8EC6 mov es, si 1070 _.LVL102: 1071 _.L100: 347:fatfs.c **** { 1072 .loc 1 347 0 0 00005260 83C33B add bx, 59 1074 _.LVL103: 0 00005263 41 inc cx 1076 _.LVL104: 0 00005264 E9BAFE jmp _.L98 1078 _.LVL105: 1079 _.L105: 1080 _.LBB57: 1081 _.LBB56: 1082 _.LBB54: 1083 _.LBB55: 63:fatfs.c **** } 1084 .loc 1 63 0 0 00005267 368B4518 mov ax, word ptr ss:[di+24] 1086 _.LVL106: 0 0000526B EBC5 jmp _.L106 1088 _.LBE55: 1089 _.LBE54: 1090 _.LBE56: 1091 _.LBE57: 1092 _.LBE58: 1093 _.LBE59: 1094 _.LFE18: 1095 .size _merge_file_changes, .-_merge_file_changes 1096 .global _getdstart 1097 .type _getdstart, @function 1098 _getdstart: 1099 _.LFB5: 60:fatfs.c **** if (!ISFAT32(dpbp)) 1100 .loc 1 60 0 1101 _.LVL107: 0 0000526D 56 push si 0 0000526E 55 push bp 1104 _.LCFI18: 0 0000526F 89E5 mov bp, sp 1106 _.LCFI19: 0 00005271 8B760A mov si, word ptr [bp+10] 61:fatfs.c **** return dentry->dir_start; 1108 .loc 1 61 0 0 00005274 C45E06 les bx, dword ptr [bp+6] 0 00005277 26837F0F00 cmp word ptr es:[bx+15], 0 0 0000527C 8B441A mov ax, word ptr [si+26] 0 0000527F 7407 je _.L116 62:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 1113 .loc 1 62 0 0 00005281 31D2 xor dx, dx 1115 _.L115: 64:fatfs.c **** 1116 .loc 1 64 0 0 00005283 5D pop bp 0 00005284 5E pop si 0 00005285 C20600 ret 6 1120 _.L116: 1121 _.LVL108: 1122 _.LBB62: 1123 _.LBB63: 63:fatfs.c **** } 1124 .loc 1 63 0 0 00005288 8B5414 mov dx, word ptr [si+20] 1126 _.LVL109: 0 0000528B EBF6 jmp _.L115 1128 _.LBE63: 1129 _.LBE62: 1130 _.LFE5: 1131 .size _getdstart, .-_getdstart 1132 .global _setdstart 1133 .type _setdstart, @function 1134 _setdstart: 1135 _.LFB6: 67:fatfs.c **** dentry->dir_start = (UWORD)value; 1136 .loc 1 67 0 1137 _.LVL110: 0 0000528D 56 push si 0 0000528E 55 push bp 1140 _.LCFI20: 0 0000528F 89E5 mov bp, sp 1142 _.LCFI21: 0 00005291 8B760A mov si, word ptr [bp+10] 0 00005294 8B460E mov ax, word ptr [bp+14] 68:fatfs.c **** if (ISFAT32(dpbp)) 1145 .loc 1 68 0 0 00005297 8B560C mov dx, word ptr [bp+12] 0 0000529A 89541A mov word ptr [si+26], dx 69:fatfs.c **** dentry->dir_start_high = (UWORD)(value >> 16); 1148 .loc 1 69 0 0 0000529D C45E06 les bx, dword ptr [bp+6] 0 000052A0 26837F0F00 cmp word ptr es:[bx+15], 0 0 000052A5 7503 jne _.L119 70:fatfs.c **** } 1152 .loc 1 70 0 0 000052A7 894414 mov word ptr [si+20], ax 1154 _.L119: 71:fatfs.c **** #endif 1155 .loc 1 71 0 0 000052AA 5D pop bp 0 000052AB 5E pop si 0 000052AC C20A00 ret 10 1159 _.LFE6: 1160 .size _setdstart, .-_setdstart 1161 .global _clus2phys 1162 .type _clus2phys, @function 1163 _clus2phys: 1164 _.LFB7: 75:fatfs.c **** CLUSTER data = 1165 .loc 1 75 0 1166 _.LVL111: 0 000052AF 56 push si 0 000052B0 57 push di 0 000052B1 55 push bp 1170 _.LCFI22: 0 000052B2 89E5 mov bp, sp 1172 _.LCFI23: 0 000052B4 8B4608 mov ax, word ptr [bp+8] 0 000052B7 8B4E0A mov cx, word ptr [bp+10] 78:fatfs.c **** #endif 1175 .loc 1 78 0 0 000052BA C45E0C les bx, dword ptr [bp+12] 0 000052BD 8CC2 mov dx, es 0 000052BF 26837F0F00 cmp word ptr es:[bx+15], 0 0 000052C4 7528 jne _.L123 78:fatfs.c **** #endif 1180 .loc 1 78 0 is_stmt 0 discriminator 1 0 000052C6 268B7729 mov si, word ptr es:[bx+41] 0 000052CA 268B7F2B mov di, word ptr es:[bx+43] 1183 _.L124: 1184 _.LVL112: 81:fatfs.c **** } 1185 .loc 1 81 0 is_stmt 1 0 000052CE 83C0FE add ax, -2 0 000052D1 83D1FF adc cx, -1 0 000052D4 8EC2 mov es, dx 0 000052D6 268A5705 mov dl, byte ptr es:[bx+5] 0 000052DA 30F6 xor dh, dh 0 000052DC 52 push dx 0 000052DD 51 push cx 0 000052DE 50 push ax 0 000052DF E8[FEFF] call ___ashlsi3 1195 _.LVL113: 0 000052E2 01F0 add ax, si 0 000052E4 11FA adc dx, di 82:fatfs.c **** 1198 .loc 1 82 0 0 000052E6 89EC mov sp, bp 0 000052E8 5D pop bp 0 000052E9 5F pop di 1202 _.LVL114: 0 000052EA 5E pop si 0 000052EB C20800 ret 8 1205 _.L123: 78:fatfs.c **** #endif 1206 .loc 1 78 0 discriminator 2 0 000052EE 268B770B mov si, word ptr es:[bx+11] 0 000052F2 31FF xor di, di 0 000052F4 EBD8 jmp _.L124 1210 _.LFE7: 1211 .size _clus2phys, .-_clus2phys 1212 .type _clear_dir, @function 1213 _clear_dir: 1214 _.LFB31: 761:fatfs.c **** int idx; 1215 .loc 1 761 0 1216 _.LVL115: 0 000052F6 56 push si 0 000052F7 57 push di 0 000052F8 55 push bp 1220 _.LCFI24: 0 000052F9 89E5 mov bp, sp 1222 _.LCFI25: 0 000052FB 83EC0A sub sp, 10 0 000052FE C4460A les ax, dword ptr [bp+10] 0 00005301 8946F8 mov word ptr [bp-8], ax 0 00005304 8C46F6 mov word ptr [bp-10], es 1227 _.LVL116: 763:fatfs.c **** { 1228 .loc 1 763 0 0 00005307 31FF xor di, di 0 00005309 897EFC mov word ptr [bp-4], di 1231 _.LVL117: 1232 _.L127: 0 0000530C 897EFA mov word ptr [bp-6], di 1234 _.LVL118: 763:fatfs.c **** { 1235 .loc 1 763 0 is_stmt 0 discriminator 1 0 0000530F 8B5E08 mov bx, word ptr [bp+8] 0 00005312 8B7729 mov si, word ptr [bx+41] 0 00005315 8B472B mov ax, word ptr [bx+43] 0 00005318 8946FE mov word ptr [bp-2], ax 0 0000531B 8EC0 mov es, ax 0 0000531D 268A4404 mov al, byte ptr es:[si+4] 0 00005321 30E4 xor ah, ah 0 00005323 39C7 cmp di, ax 0 00005325 7E0A jle _.L132 781:fatfs.c **** } 1245 .loc 1 781 0 is_stmt 1 0 00005327 31C0 xor ax, ax 1247 _.L126: 782:fatfs.c **** 1248 .loc 1 782 0 0 00005329 89EC mov sp, bp 0 0000532B 5D pop bp 0 0000532C 5F pop di 1252 _.LVL119: 0 0000532D 5E pop si 0 0000532E C20600 ret 6 1255 _.LVL120: 1256 _.L132: 1257 _.LBB64: 768:fatfs.c **** fnp->f_dpb->dpb_unit); 1258 .loc 1 768 0 0 00005331 FF76FE push word ptr [bp-2] 0 00005334 56 push si 0 00005335 FF76F6 push word ptr [bp-10] 0 00005338 FF76F8 push word ptr [bp-8] 0 0000533B E8[FEFF] call _clus2phys 1264 _.LVL121: 0 0000533E 91 xchg cx, ax 0 0000533F 89D3 mov bx, dx 0 00005341 B80100 mov ax, 1 0 00005344 50 push ax 0 00005345 8E46FE mov es, word ptr [bp-2] 0 00005348 268A04 mov al, byte ptr es:[si] 0 0000534B 98 cbw 0 0000534C 50 push ax 0 0000534D 01F9 add cx, di 0 0000534F 135EFC adc bx, word ptr [bp-4] 0 00005352 53 push bx 0 00005353 51 push cx 0 00005354 E8[FEFF] call _getblk 1278 _.LVL122: 773:fatfs.c **** return DE_ACCESS; 1279 .loc 1 773 0 0 00005357 89C6 mov si, ax 0 00005359 09D0 or ax, dx 0 0000535B 7437 je _.L133 775:fatfs.c **** bp->b_flag |= BFR_DIRTY | BFR_VALID; 1283 .loc 1 775 0 0 0000535D B80002 mov ax, 512 0 00005360 50 push ax 0 00005361 31C0 xor ax, ax 0 00005363 50 push ax 0 00005364 8D4414 lea ax, [20+si] 0 00005367 52 push dx 0 00005368 8956FE mov word ptr [bp-2], dx 0 0000536B 50 push ax 0 0000536C E8[FEFF] call _fmemset 1293 _.LVL123: 776:fatfs.c **** 1294 .loc 1 776 0 0 0000536F 8B56FE mov dx, word ptr [bp-2] 0 00005372 8EC2 mov es, dx 0 00005374 268A4405 mov al, byte ptr es:[si+5] 778:fatfs.c **** bp->b_flag |= BFR_UNCACHE; /* needs not be cached */ 1298 .loc 1 778 0 0 00005378 837EFA00 cmp word ptr [bp-6], 0 0 0000537C 7510 jne _.L130 776:fatfs.c **** 1301 .loc 1 776 0 0 0000537E 0C60 or al, 96 1303 _.L135: 779:fatfs.c **** } 1304 .loc 1 779 0 0 00005380 26884405 mov byte ptr es:[si+5], al 1306 _.LVL124: 0 00005384 83C701 add di, 1 1308 _.LVL125: 0 00005387 8356FC00 adc word ptr [bp-4], 0 0 0000538B E97EFF jmp _.L127 1311 _.L130: 0 0000538E 0C61 or al, 97 0 00005390 8EC2 mov es, dx 0 00005392 EBEC jmp _.L135 1315 _.L133: 774:fatfs.c **** fmemset(bp->b_buffer, 0, BUFFERSIZE); 1316 .loc 1 774 0 0 00005394 B8FBFF mov ax, -5 0 00005397 EB90 jmp _.L126 1319 _.LBE64: 1320 _.LFE31: 1321 .size _clear_dir, .-_clear_dir 1322 .type _extend_dir, @function 1323 _extend_dir: 1324 _.LFB34: 919:fatfs.c **** int ret; 1325 .loc 1 919 0 1326 _.LVL126: 0 00005399 56 push si 0 0000539A 57 push di 0 0000539B 55 push bp 1330 _.LCFI26: 0 0000539C 89E5 mov bp, sp 1332 _.LCFI27: 0 0000539E 8B7608 mov si, word ptr [bp+8] 921:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 1334 .loc 1 921 0 0 000053A1 56 push si 0 000053A2 E8E3FA call _extend 1337 _.LVL127: 922:fatfs.c **** return DE_HNDLDSKFULL; 1338 .loc 1 922 0 0 000053A5 83F8FF cmp ax, -1 0 000053A8 7512 jne _.L137 0 000053AA 81FAFF0F cmp dx, 4095 0 000053AE 750C jne _.L137 1343 _.LVL128: 1344 _.L139: 923:fatfs.c **** 1345 .loc 1 923 0 0 000053B0 BFE4FF mov di, -28 1347 _.L136: 938:fatfs.c **** 1348 .loc 1 938 0 0 000053B3 97 xchg di, ax 0 000053B4 89EC mov sp, bp 0 000053B6 5D pop bp 0 000053B7 5F pop di 0 000053B8 5E pop si 0 000053B9 C20200 ret 2 1355 _.LVL129: 1356 _.L137: 925:fatfs.c **** if (ret != SUCCESS) 1357 .loc 1 925 0 0 000053BC 52 push dx 0 000053BD 50 push ax 0 000053BE 56 push si 0 000053BF E834FF call _clear_dir 1362 _.LVL130: 0 000053C2 89C7 mov di, ax 1364 _.LVL131: 926:fatfs.c **** return ret; 1365 .loc 1 926 0 0 000053C4 85C0 test ax, ax 0 000053C6 75EB jne _.L136 929:fatfs.c **** return DE_HNDLDSKFULL; 1368 .loc 1 929 0 0 000053C8 56 push si 0 000053C9 E8E4F8 call _find_free 1371 _.LVL132: 0 000053CC 85C0 test ax, ax 0 000053CE 74E0 je _.L139 1374 _.LVL133: 1375 _.LBB67: 1376 _.LBB68: 933:fatfs.c **** return DE_ACCESS; 1377 .loc 1 933 0 0 000053D0 C45C29 les bx, dword ptr [si+41] 0 000053D3 268A07 mov al, byte ptr es:[bx] 0 000053D6 98 cbw 0 000053D7 50 push ax 0 000053D8 E8[FEFF] call _flush_buffers 1383 _.LVL134: 0 000053DB 85C0 test ax, ax 0 000053DD 75D4 jne _.L136 934:fatfs.c **** 1386 .loc 1 934 0 0 000053DF BFFBFF mov di, -5 1388 _.LVL135: 0 000053E2 EBCF jmp _.L136 1390 _.LBE68: 1391 _.LBE67: 1392 _.LFE34: 1393 .size _extend_dir, .-_extend_dir 1394 .global _get_dpb 1395 .type _get_dpb, @function 1396 _get_dpb: 1397 _.LFB8: 85:fatfs.c **** register struct cds FAR *cdsp = get_cds(dsk); 1398 .loc 1 85 0 1399 _.LVL136: 0 000053E4 55 push bp 1401 _.LCFI28: 0 000053E5 89E5 mov bp, sp 1403 _.LCFI29: 86:fatfs.c **** 1404 .loc 1 86 0 0 000053E7 FF7604 push word ptr [bp+4] 0 000053EA E8[FEFF] call _get_cds 1407 _.LVL137: 0 000053ED 89C3 mov bx, ax 1409 _.LVL138: 88:fatfs.c **** return NULL; 1410 .loc 1 88 0 0 000053EF 09D0 or ax, dx 1412 _.LVL139: 0 000053F1 7419 je _.L151 0 000053F3 8EC2 mov es, dx 0 000053F5 26837F4300 cmp word ptr es:[bx+67], 0 0 000053FA 7C0E jl _.L149 90:fatfs.c **** } 1417 .loc 1 90 0 0 000053FC 268B4745 mov ax, word ptr es:[bx+69] 0 00005400 268B5747 mov dx, word ptr es:[bx+71] 1420 _.LVL140: 1421 _.L145: 91:fatfs.c **** 1422 .loc 1 91 0 0 00005404 89EC mov sp, bp 0 00005406 5D pop bp 0 00005407 C20200 ret 2 1426 _.LVL141: 1427 _.L149: 89:fatfs.c **** return cdsp->cdsDpb; 1428 .loc 1 89 0 0 0000540A 31C0 xor ax, ax 1430 _.L151: 0 0000540C 89C2 mov dx, ax 1432 _.LVL142: 0 0000540E EBF4 jmp _.L145 1434 _.LFE8: 1435 .size _get_dpb, .-_get_dpb 1436 .global _fcmp_wild 1437 .type _fcmp_wild, @function 1438 _fcmp_wild: 1439 _.LFB11: 205:fatfs.c **** for ( ; n--; ++s1, ++s2) 1440 .loc 1 205 0 1441 _.LVL143: 0 00005410 57 push di 0 00005411 55 push bp 1444 _.LCFI30: 0 00005412 89E5 mov bp, sp 1446 _.LCFI31: 206:fatfs.c **** if (*s1 != '?' && *s1 != *s2) 1447 .loc 1 206 0 0 00005414 31DB xor bx, bx 1449 _.LVL144: 1450 _.L153: 206:fatfs.c **** if (*s1 != '?' && *s1 != *s2) 1451 .loc 1 206 0 is_stmt 0 discriminator 1 0 00005416 395E0A cmp word ptr [bp+10], bx 0 00005419 7508 jne _.L156 209:fatfs.c **** } 1454 .loc 1 209 0 is_stmt 1 0 0000541B B80100 mov ax, 1 1456 _.L152: 210:fatfs.c **** 1457 .loc 1 210 0 0 0000541E 5D pop bp 0 0000541F 5F pop di 0 00005420 C20600 ret 6 1461 _.L156: 207:fatfs.c **** return FALSE; 1462 .loc 1 207 0 0 00005423 8B7E06 mov di, word ptr [bp+6] 0 00005426 8A01 mov al, byte ptr [bx+di] 0 00005428 3C3F cmp al, 63 0 0000542A 7407 je _.L154 207:fatfs.c **** return FALSE; 1467 .loc 1 207 0 is_stmt 0 discriminator 1 0 0000542C 8B7E08 mov di, word ptr [bp+8] 0 0000542F 3A01 cmp al, byte ptr [bx+di] 0 00005431 7503 jne _.L157 1471 _.L154: 1472 _.LVL145: 0 00005433 43 inc bx 1474 _.LVL146: 0 00005434 EBE0 jmp _.L153 1476 _.LVL147: 1477 _.L157: 208:fatfs.c **** return TRUE; 1478 .loc 1 208 0 is_stmt 1 0 00005436 31C0 xor ax, ax 0 00005438 EBE4 jmp _.L152 1481 _.LFE11: 1482 .size _fcmp_wild, .-_fcmp_wild 1483 .global _split_path 1484 .type _split_path, @function 1485 _split_path: 1486 _.LFB13: 236:fatfs.c **** /* check if the path ends in a backslash */ 1487 .loc 1 236 0 1488 _.LVL148: 0 0000543A 57 push di 0 0000543B 55 push bp 1491 _.LCFI32: 0 0000543C 89E5 mov bp, sp 1493 _.LCFI33: 0 0000543E 8B7E06 mov di, word ptr [bp+6] 238:fatfs.c **** return (f_node_ptr) 0; 1495 .loc 1 238 0 0 00005441 57 push di 0 00005442 E8[FEFF] call _strlen 1498 _.LVL149: 0 00005445 93 xchg bx, ax 0 00005446 8079FF5C cmp byte ptr [bx+di-1], 92 0 0000544A 7412 je _.L164 261:fatfs.c **** } 1502 .loc 1 261 0 0 0000544C FF7608 push word ptr [bp+8] 0 0000544F B80100 mov ax, 1 0 00005452 50 push ax 0 00005453 57 push di 0 00005454 E8[FEFF] call _dir_open 1508 _.LVL150: 1509 _.L162: 262:fatfs.c **** 1510 .loc 1 262 0 0 00005457 89EC mov sp, bp 0 00005459 5D pop bp 0 0000545A 5F pop di 0 0000545B C20400 ret 4 1515 _.L164: 239:fatfs.c **** 1516 .loc 1 239 0 0 0000545E 31C0 xor ax, ax 0 00005460 EBF5 jmp _.L162 1519 _.LFE13: 1520 .size _split_path, .-_split_path 1521 .type _alloc_find_free, @function 1522 _alloc_find_free: 1523 _.LFB27: 637:fatfs.c **** fnp = split_path(path, fnp); 1524 .loc 1 637 0 1525 _.LVL151: 0 00005462 56 push si 0 00005463 55 push bp 1528 _.LCFI34: 0 00005464 89E5 mov bp, sp 1530 _.LCFI35: 638:fatfs.c **** 1531 .loc 1 638 0 0 00005466 FF7606 push word ptr [bp+6] 0 00005469 FF7608 push word ptr [bp+8] 0 0000546C E8[FEFF] call _split_path 1535 _.LVL152: 0 0000546F 89C6 mov si, ax 1537 _.LVL153: 644:fatfs.c **** { 1538 .loc 1 644 0 0 00005471 50 push ax 0 00005472 E83BF8 call _find_free 1541 _.LVL154: 0 00005475 85C0 test ax, ax 0 00005477 7516 jne _.L169 646:fatfs.c **** { 1544 .loc 1 646 0 0 00005479 8B5C02 mov bx, word ptr [si+2] 0 0000547C 8B4711 mov ax, word ptr [bx+17] 0 0000547F 0B470F or ax, word ptr [bx+15] 0 00005482 740F je _.L170 1549 _.LBB69: 655:fatfs.c **** /* fnp already closed in extend_dir */ 1550 .loc 1 655 0 0 00005484 56 push si 0 00005485 E811FF call _extend_dir 1553 _.LVL155: 1554 _.L166: 1555 _.LBE69: 661:fatfs.c **** 1556 .loc 1 661 0 0 00005488 89EC mov sp, bp 0 0000548A 5D pop bp 0 0000548B 5E pop si 1560 _.LVL156: 0 0000548C C20400 ret 4 1562 _.LVL157: 1563 _.L169: 660:fatfs.c **** } 1564 .loc 1 660 0 0 0000548F 31C0 xor ax, ax 0 00005491 EBF5 jmp _.L166 1567 _.L170: 648:fatfs.c **** } 1568 .loc 1 648 0 0 00005493 B8FCFF mov ax, -4 0 00005496 EBF0 jmp _.L166 1571 _.LFE27: 1572 .size _alloc_find_free, .-_alloc_find_free 1573 .global _dir_exists 1574 .type _dir_exists, @function 1575 _dir_exists: 1576 _.LFB14: 266:fatfs.c **** return split_path(path, &fnode[0]) != NULL; 1577 .loc 1 266 0 1578 _.LVL158: 0 00005498 55 push bp 1580 _.LCFI36: 0 00005499 89E5 mov bp, sp 1582 _.LCFI37: 267:fatfs.c **** } 1583 .loc 1 267 0 0 0000549B B8[0000] mov ax, offset _fnode 0 0000549E 50 push ax 0 0000549F FF7604 push word ptr [bp+4] 0 000054A2 E8[FEFF] call _split_path 1588 _.LVL159: 0 000054A5 83F801 cmp ax, 1 0 000054A8 19C0 sbb ax, ax 0 000054AA 40 inc ax 268:fatfs.c **** 1592 .loc 1 268 0 0 000054AB 89EC mov sp, bp 0 000054AD 5D pop bp 0 000054AE C20200 ret 2 1596 _.LFE14: 1597 .size _dir_exists, .-_dir_exists 1598 .global _fcbmatch 1599 .type _fcbmatch, @function 1600 _fcbmatch: 1601 _.LFB15: 271:fatfs.c **** return memcmp(fcbname1, fcbname2, FNAME_SIZE + FEXT_SIZE) == 0; 1602 .loc 1 271 0 1603 _.LVL160: 0 000054B1 55 push bp 1605 _.LCFI38: 0 000054B2 89E5 mov bp, sp 1607 _.LCFI39: 272:fatfs.c **** } 1608 .loc 1 272 0 0 000054B4 B80B00 mov ax, 11 0 000054B7 50 push ax 0 000054B8 FF7606 push word ptr [bp+6] 0 000054BB FF7604 push word ptr [bp+4] 0 000054BE E8[FEFF] call _memcmp 1614 _.LVL161: 0 000054C1 83F801 cmp ax, 1 0 000054C4 19C0 sbb ax, ax 0 000054C6 F7D8 neg ax 273:fatfs.c **** 1618 .loc 1 273 0 0 000054C8 89EC mov sp, bp 0 000054CA 5D pop bp 0 000054CB C20400 ret 4 1622 _.LFE15: 1623 .size _fcbmatch, .-_fcbmatch 1624 .type _find_fname, @function 1625 _find_fname: 1626 _.LFB16: 276:fatfs.c **** /* check for leading backslash and open the directory given that */ 1627 .loc 1 276 0 1628 _.LVL162: 0 000054CE 56 push si 0 000054CF 55 push bp 1631 _.LCFI40: 0 000054D0 89E5 mov bp, sp 1633 _.LCFI41: 279:fatfs.c **** return DE_PATHNOTFND; 1634 .loc 1 279 0 0 000054D2 FF760A push word ptr [bp+10] 0 000054D5 FF7606 push word ptr [bp+6] 0 000054D8 E8[FEFF] call _split_path 1638 _.LVL163: 0 000054DB 89C6 mov si, ax 0 000054DD 85C0 test ax, ax 0 000054DF 752C jne _.L178 280:fatfs.c **** 1642 .loc 1 280 0 0 000054E1 B8FDFF mov ax, -3 1644 _.LVL164: 0 000054E4 EB33 jmp _.L176 1646 _.L180: 284:fatfs.c **** && (fnp->f_dir.dir_attrib & ~(D_RDONLY | D_ARCHIVE | attr)) == 0) 1647 .loc 1 284 0 0 000054E6 8B4402 mov ax, word ptr [si+2] 0 000054E9 40 inc ax 0 000054EA 50 push ax 0 000054EB 8D4404 lea ax, [4+si] 0 000054EE 50 push ax 0 000054EF E8[FEFF] call _fcbmatch 1654 _.LVL165: 0 000054F2 85C0 test ax, ax 0 000054F4 7411 je _.L179 285:fatfs.c **** { 1657 .loc 1 285 0 0 000054F6 8B4608 mov ax, word ptr [bp+8] 0 000054F9 83C821 or ax, 33 0 000054FC F7D0 not ax 0 000054FE 8A540F mov dl, byte ptr [si+15] 0 00005501 30F6 xor dh, dh 0 00005503 21D0 and ax, dx 0 00005505 7412 je _.L176 1665 _.L179: 289:fatfs.c **** } 1666 .loc 1 289 0 0 00005507 8B5C02 mov bx, word ptr [si+2] 0 0000550A FF470D inc word ptr [bx+13] 1669 _.L178: 282:fatfs.c **** { 1670 .loc 1 282 0 0 0000550D 56 push si 0 0000550E E8[FEFF] call _dir_read 1673 _.LVL166: 0 00005511 83F801 cmp ax, 1 0 00005514 74D0 je _.L180 291:fatfs.c **** } 1676 .loc 1 291 0 0 00005516 B8FEFF mov ax, -2 1678 _.L176: 292:fatfs.c **** 1679 .loc 1 292 0 0 00005519 89EC mov sp, bp 0 0000551B 5D pop bp 0 0000551C 5E pop si 1683 _.LVL167: 0 0000551D C20600 ret 6 1685 _.LFE16: 1686 .size _find_fname, .-_find_fname 1687 .global _remove_lfn_entries 1688 .type _remove_lfn_entries, @function 1689 _remove_lfn_entries: 1690 _.LFB17: 304:fatfs.c **** unsigned original_diroff = fnp->f_dmp->dm_entry; 1691 .loc 1 304 0 1692 _.LVL168: 0 00005520 56 push si 0 00005521 57 push di 0 00005522 55 push bp 1696 _.LCFI42: 0 00005523 89E5 mov bp, sp 1698 _.LCFI43: 0 00005525 8B7608 mov si, word ptr [bp+8] 305:fatfs.c **** 1700 .loc 1 305 0 0 00005528 8B5C02 mov bx, word ptr [si+2] 0 0000552B 8B7F0D mov di, word ptr [bx+13] 1703 _.LVL169: 1704 _.L195: 309:fatfs.c **** break; 1705 .loc 1 309 0 0 0000552E 8B5C02 mov bx, word ptr [si+2] 0 00005531 8B470D mov ax, word ptr [bx+13] 0 00005534 85C0 test ax, ax 0 00005536 742E je _.L191 311:fatfs.c **** if (dir_read(fnp) <= 0) 1710 .loc 1 311 0 0 00005538 48 dec ax 0 00005539 89470D mov word ptr [bx+13], ax 312:fatfs.c **** return DE_ACCESS; 1713 .loc 1 312 0 0 0000553C 56 push si 0 0000553D E8[FEFF] call _dir_read 1716 _.LVL170: 0 00005540 85C0 test ax, ax 0 00005542 7F0B jg _.L192 1719 _.L194: 313:fatfs.c **** if (fnp->f_dir.dir_attrib != D_LFN) 1720 .loc 1 313 0 0 00005544 B8FBFF mov ax, -5 1722 _.L190: 324:fatfs.c **** 1723 .loc 1 324 0 0 00005547 89EC mov sp, bp 0 00005549 5D pop bp 0 0000554A 5F pop di 1727 _.LVL171: 0 0000554B 5E pop si 0 0000554C C20200 ret 2 1730 _.LVL172: 1731 _.L192: 314:fatfs.c **** break; 1732 .loc 1 314 0 0 0000554F 807C0F0F cmp byte ptr [si+15], 15 0 00005553 7511 jne _.L191 316:fatfs.c **** if (!dir_write(fnp)) return DE_ACCESS; 1735 .loc 1 316 0 0 00005555 C6440405 mov byte ptr [si+4], 5 317:fatfs.c **** } 1737 .loc 1 317 0 0 00005559 31C0 xor ax, ax 0 0000555B 50 push ax 0 0000555C 56 push si 0 0000555D E8[FEFF] call _dir_write_update 1742 _.LVL173: 0 00005560 85C0 test ax, ax 0 00005562 75CA jne _.L195 0 00005564 EBDE jmp _.L194 1746 _.L191: 319:fatfs.c **** if (dir_read(fnp) <= 0) 1747 .loc 1 319 0 0 00005566 8B5C02 mov bx, word ptr [si+2] 0 00005569 897F0D mov word ptr [bx+13], di 320:fatfs.c **** return DE_ACCESS; 1750 .loc 1 320 0 0 0000556C 56 push si 0 0000556D E8[FEFF] call _dir_read 1753 _.LVL174: 0 00005570 85C0 test ax, ax 0 00005572 7ED0 jle _.L194 323:fatfs.c **** } 1756 .loc 1 323 0 0 00005574 31C0 xor ax, ax 0 00005576 EBCF jmp _.L190 1759 _.LFE17: 1760 .size _remove_lfn_entries, .-_remove_lfn_entries 1761 .type _delete_dir_entry, @function 1762 _delete_dir_entry: 1763 _.LFB20: 399:fatfs.c **** COUNT rc; 1764 .loc 1 399 0 1765 _.LVL175: 0 00005578 56 push si 0 00005579 57 push di 0 0000557A 55 push bp 1769 _.LCFI44: 0 0000557B 89E5 mov bp, sp 1771 _.LCFI45: 0 0000557D 8B7608 mov si, word ptr [bp+8] 405:fatfs.c **** return rc; 1773 .loc 1 405 0 0 00005580 56 push si 0 00005581 E8[FEFF] call _remove_lfn_entries 1776 _.LVL176: 0 00005584 85C0 test ax, ax 0 00005586 7C14 jl _.L203 1779 _.LVL177: 1780 _.LBB72: 1781 _.LBB73: 408:fatfs.c **** *(fnp->f_dir.dir_name) = DELETED; 1782 .loc 1 408 0 0 00005588 56 push si 0 00005589 E850FA call _wipe_out 1785 _.LVL178: 409:fatfs.c **** 1786 .loc 1 409 0 0 0000558C C6440405 mov byte ptr [si+4], 5 414:fatfs.c **** return DE_ACCESS; 1788 .loc 1 414 0 0 00005590 31FF xor di, di 0 00005592 57 push di 0 00005593 56 push si 0 00005594 E8[FEFF] call _dir_write_update 1793 _.LVL179: 0 00005597 39F8 cmp ax, di 0 00005599 7409 je _.L205 418:fatfs.c **** } 1796 .loc 1 418 0 0 0000559B 97 xchg di, ax 1798 _.LVL180: 1799 _.L203: 1800 _.LBE73: 1801 _.LBE72: 419:fatfs.c **** 1802 .loc 1 419 0 0 0000559C 89EC mov sp, bp 0 0000559E 5D pop bp 0 0000559F 5F pop di 0 000055A0 5E pop si 0 000055A1 C20200 ret 2 1808 _.LVL181: 1809 _.L205: 1810 _.LBB75: 1811 _.LBB74: 415:fatfs.c **** 1812 .loc 1 415 0 0 000055A4 B8FBFF mov ax, -5 0 000055A7 EBF3 jmp _.L203 1815 _.LBE74: 1816 _.LBE75: 1817 _.LFE20: 1818 .size _delete_dir_entry, .-_delete_dir_entry 1819 .global _dos_merge_file_changes 1820 .type _dos_merge_file_changes, @function 1821 _dos_merge_file_changes: 1822 _.LFB19: 394:fatfs.c **** merge_file_changes(sft_to_fnode(fd), FALSE); 1823 .loc 1 394 0 1824 _.LVL182: 0 000055A9 55 push bp 1826 _.LCFI46: 0 000055AA 89E5 mov bp, sp 1828 _.LCFI47: 395:fatfs.c **** } 1829 .loc 1 395 0 0 000055AC FF7604 push word ptr [bp+4] 0 000055AF E81FF6 call _sft_to_fnode 1832 _.LVL183: 0 000055B2 31D2 xor dx, dx 0 000055B4 52 push dx 0 000055B5 50 push ax 0 000055B6 E827FB call _merge_file_changes 1837 _.LVL184: 396:fatfs.c **** 1838 .loc 1 396 0 0 000055B9 89EC mov sp, bp 0 000055BB 5D pop bp 0 000055BC C20200 ret 2 1842 _.LFE19: 1843 .size _dos_merge_file_changes, .-_dos_merge_file_changes 1844 .global _dos_delete 1845 .type _dos_delete, @function 1846 _dos_delete: 1847 _.LFB21: 422:fatfs.c **** REG f_node_ptr fnp = &fnode[0]; 1848 .loc 1 422 0 1849 _.LVL185: 0 000055BF 56 push si 0 000055C0 55 push bp 1852 _.LCFI48: 0 000055C1 89E5 mov bp, sp 1854 _.LCFI49: 1855 _.LVL186: 427:fatfs.c **** if (ret == SUCCESS) 1856 .loc 1 427 0 0 000055C3 BE[0000] mov si, offset _fnode 0 000055C6 56 push si 0 000055C7 FF7608 push word ptr [bp+8] 0 000055CA FF7606 push word ptr [bp+6] 0 000055CD E8FEFE call _find_fname 1862 _.LVL187: 428:fatfs.c **** { 1863 .loc 1 428 0 0 000055D0 85C0 test ax, ax 0 000055D2 750A jne _.L209 434:fatfs.c **** return DE_ACCESS; 1866 .loc 1 434 0 0 000055D4 F6440F11 test byte ptr [si+15], 17 0 000055D8 750B jne _.L211 437:fatfs.c **** } 1869 .loc 1 437 0 0 000055DA 56 push si 0 000055DB E89AFF call _delete_dir_entry 1872 _.LVL188: 1873 _.L209: 442:fatfs.c **** 1874 .loc 1 442 0 0 000055DE 89EC mov sp, bp 0 000055E0 5D pop bp 0 000055E1 5E pop si 0 000055E2 C20400 ret 4 1879 _.LVL189: 1880 _.L211: 435:fatfs.c **** 1881 .loc 1 435 0 0 000055E5 B8FBFF mov ax, -5 1883 _.LVL190: 0 000055E8 EBF4 jmp _.L209 1885 _.LFE21: 1886 .size _dos_delete, .-_dos_delete 1887 .global _dos_rmdir 1888 .type _dos_rmdir, @function 1889 _dos_rmdir: 1890 _.LFB22: 445:fatfs.c **** REG f_node_ptr fnp; 1891 .loc 1 445 0 1892 _.LVL191: 0 000055EA 56 push si 0 000055EB 57 push di 0 000055EC 55 push bp 1896 _.LCFI50: 0 000055ED 89E5 mov bp, sp 1898 _.LCFI51: 0 000055EF 8B7E08 mov di, word ptr [bp+8] 449:fatfs.c **** if (!fstrcmp(path, cdsp->cdsCurrentPath)) 1900 .loc 1 449 0 0 000055F2 8A05 mov al, byte ptr [di] 0 000055F4 98 cbw 0 000055F5 83C0BF add ax, -65 0 000055F8 50 push ax 0 000055F9 E8[FEFF] call _get_cds 1906 _.LVL192: 450:fatfs.c **** return DE_RMVCUDIR; 1907 .loc 1 450 0 0 000055FC 52 push dx 0 000055FD 50 push ax 0 000055FE 16 push ss 0 000055FF 57 push di 0 00005600 E8[FEFF] call _fstrcmp 1913 _.LVL193: 0 00005603 85C0 test ax, ax 0 00005605 7503E98D00 je _.L222 454:fatfs.c **** return DE_ACCESS; 1916 .loc 1 454 0 0 0000560A 807D025C cmp byte ptr [di+2], 92 0 0000560E 7511 jne _.L215 454:fatfs.c **** return DE_ACCESS; 1919 .loc 1 454 0 is_stmt 0 discriminator 1 0 00005610 807D0300 cmp byte ptr [di+3], 0 0 00005614 750B jne _.L215 1922 _.LVL194: 1923 _.L217: 455:fatfs.c **** 1924 .loc 1 455 0 is_stmt 1 0 00005616 B8FBFF mov ax, -5 1926 _.L213: 498:fatfs.c **** 1927 .loc 1 498 0 0 00005619 89EC mov sp, bp 0 0000561B 5D pop bp 0 0000561C 5F pop di 0 0000561D 5E pop si 0 0000561E C20200 ret 2 1933 _.LVL195: 1934 _.L215: 459:fatfs.c **** if (fnp == NULL) 1935 .loc 1 459 0 0 00005621 B8[0000] mov ax, offset _fnode 0 00005624 50 push ax 0 00005625 31C0 xor ax, ax 0 00005627 50 push ax 0 00005628 57 push di 0 00005629 E8[FEFF] call _dir_open 1942 _.LVL196: 0 0000562C 89C6 mov si, ax 1944 _.LVL197: 460:fatfs.c **** return DE_PATHNOTFND; 1945 .loc 1 460 0 0 0000562E 85C0 test ax, ax 0 00005630 7505 jne _.L216 1948 _.LVL198: 1949 _.L221: 461:fatfs.c **** 1950 .loc 1 461 0 0 00005632 B8FDFF mov ax, -3 0 00005635 EBE2 jmp _.L213 1953 _.LVL199: 1954 _.L216: 466:fatfs.c **** return DE_ACCESS; 1955 .loc 1 466 0 0 00005637 8A440F mov al, byte ptr [si+15] 1957 _.LVL200: 0 0000563A A8CE test al, -50 0 0000563C 75D8 jne _.L217 469:fatfs.c **** /* 1st entry should be ".", else directory corrupt or not empty */ 1960 .loc 1 469 0 0 0000563E 56 push si 0 0000563F E8[FEFF] call _dir_read 1963 _.LVL201: 471:fatfs.c **** return DE_ACCESS; 1964 .loc 1 471 0 0 00005642 807C042E cmp byte ptr [si+4], 46 0 00005646 75CE jne _.L217 471:fatfs.c **** return DE_ACCESS; 1967 .loc 1 471 0 is_stmt 0 discriminator 1 0 00005648 807C0520 cmp byte ptr [si+5], 32 0 0000564C 75C8 jne _.L217 474:fatfs.c **** dir_read(fnp); 1970 .loc 1 474 0 is_stmt 1 0 0000564E 8B5C02 mov bx, word ptr [si+2] 0 00005651 FF470D inc word ptr [bx+13] 475:fatfs.c **** /* second entry should be ".." */ 1973 .loc 1 475 0 0 00005654 56 push si 0 00005655 E8[FEFF] call _dir_read 1976 _.LVL202: 477:fatfs.c **** return DE_ACCESS; 1977 .loc 1 477 0 0 00005658 807C042E cmp byte ptr [si+4], 46 0 0000565C 75B8 jne _.L217 477:fatfs.c **** return DE_ACCESS; 1980 .loc 1 477 0 is_stmt 0 discriminator 1 0 0000565E 807C052E cmp byte ptr [si+5], 46 1982 _.LVL203: 1983 _.L225: 486:fatfs.c **** return DE_ACCESS; 1984 .loc 1 486 0 is_stmt 1 discriminator 1 0 00005662 75B2 jne _.L217 1986 _.L219: 488:fatfs.c **** } 1987 .loc 1 488 0 0 00005664 8B5C02 mov bx, word ptr [si+2] 0 00005667 FF470D inc word ptr [bx+13] 483:fatfs.c **** { 1990 .loc 1 483 0 0 0000566A 56 push si 0 0000566B E8[FEFF] call _dir_read 1993 _.LVL204: 0 0000566E 83F801 cmp ax, 1 0 00005671 7418 je _.L220 493:fatfs.c **** /* this error should not happen because dir_open() succeeded above */ 1996 .loc 1 493 0 0 00005673 56 push si 0 00005674 B83700 mov ax, 55 0 00005677 50 push ax 0 00005678 57 push di 0 00005679 E852FE call _find_fname 2002 _.LVL205: 0 0000567C 85C0 test ax, ax 0 0000567E 75B2 jne _.L221 497:fatfs.c **** } 2005 .loc 1 497 0 0 00005680 897608 mov word ptr [bp+8], si 498:fatfs.c **** 2007 .loc 1 498 0 0 00005683 89EC mov sp, bp 0 00005685 5D pop bp 0 00005686 5F pop di 0 00005687 5E pop si 2012 _.LVL206: 497:fatfs.c **** } 2013 .loc 1 497 0 0 00005688 E9EDFE jmp _delete_dir_entry 2015 _.LVL207: 2016 _.L220: 486:fatfs.c **** return DE_ACCESS; 2017 .loc 1 486 0 0 0000568B 807C0405 cmp byte ptr [si+4], 5 0 0000568F 74D3 je _.L219 486:fatfs.c **** return DE_ACCESS; 2020 .loc 1 486 0 is_stmt 0 discriminator 1 0 00005691 807C0F0F cmp byte ptr [si+15], 15 0 00005695 EBCB jmp _.L225 2023 _.LVL208: 2024 _.L222: 451:fatfs.c **** 2025 .loc 1 451 0 is_stmt 1 0 00005697 B8F0FF mov ax, -16 0 0000569A E97CFF jmp _.L213 2028 _.LFE22: 2029 .size _dos_rmdir, .-_dos_rmdir 2030 .global _dos_rename 2031 .type _dos_rename, @function 2032 _dos_rename: 2033 _.LFB23: 501:fatfs.c **** REG f_node_ptr fnp1; 2034 .loc 1 501 0 2035 _.LVL209: 0 0000569D 56 push si 0 0000569E 57 push di 0 0000569F 55 push bp 2039 _.LCFI52: 0 000056A0 89E5 mov bp, sp 2041 _.LCFI53: 0 000056A2 1E push ds 0 000056A3 8B7608 mov si, word ptr [bp+8] 508:fatfs.c **** if (!fstrcmp(path1, cdsp->cdsCurrentPath)) 2044 .loc 1 508 0 0 000056A6 8A04 mov al, byte ptr [si] 0 000056A8 98 cbw 0 000056A9 83C0BF add ax, -65 0 000056AC 50 push ax 0 000056AD E8[FEFF] call _get_cds 2050 _.LVL210: 509:fatfs.c **** return DE_RMVCUDIR; 2051 .loc 1 509 0 0 000056B0 52 push dx 0 000056B1 50 push ax 0 000056B2 16 push ss 0 000056B3 56 push si 0 000056B4 E8[FEFF] call _fstrcmp 2057 _.LVL211: 0 000056B7 85C0 test ax, ax 0 000056B9 7503E9CC00 je _.L232 2060 _.LVL212: 514:fatfs.c **** if (ret != SUCCESS) 2061 .loc 1 514 0 0 000056BE B8[0000] mov ax, offset _fnode 0 000056C1 50 push ax 0 000056C2 FF760C push word ptr [bp+12] 0 000056C5 56 push si 0 000056C6 E805FE call _find_fname 2067 _.LVL213: 0 000056C9 89C7 mov di, ax 2069 _.LVL214: 515:fatfs.c **** return ret; 2070 .loc 1 515 0 0 000056CB 85C0 test ax, ax 0 000056CD 7521 jne _.L226 2073 _.LVL215: 521:fatfs.c **** if (ret != DE_FILENOTFND) 2074 .loc 1 521 0 0 000056CF BA[3A00] mov dx, offset _fnode+58 2076 _.LVL216: 0 000056D2 52 push dx 0 000056D3 8956FE mov word ptr [bp-2], dx 0 000056D6 FF760C push word ptr [bp+12] 0 000056D9 FF760A push word ptr [bp+10] 0 000056DC E8EFFD call _find_fname 2082 _.LVL217: 522:fatfs.c **** return ret == SUCCESS ? DE_ACCESS : ret; 2083 .loc 1 522 0 0 000056DF 83F8FE cmp ax, -2 0 000056E2 8B56FE mov dx, word ptr [bp-2] 0 000056E5 7412 je _.L228 0 000056E7 89C7 mov di, ax 523:fatfs.c **** 2088 .loc 1 523 0 0 000056E9 85C0 test ax, ax 2090 _.LVL218: 2091 _.L242: 561:fatfs.c **** } 2092 .loc 1 561 0 0 000056EB 7503 jne _.L226 2094 _.LVL219: 2095 _.L229: 561:fatfs.c **** } 2096 .loc 1 561 0 is_stmt 0 discriminator 2 0 000056ED BFFBFF mov di, -5 2098 _.LVL220: 2099 _.L226: 562:fatfs.c **** 2100 .loc 1 562 0 is_stmt 1 0 000056F0 97 xchg di, ax 0 000056F1 89EC mov sp, bp 0 000056F3 5D pop bp 0 000056F4 5F pop di 0 000056F5 5E pop si 0 000056F6 C20600 ret 6 2107 _.LVL221: 2108 _.L228: 525:fatfs.c **** if (fnp1->f_dmp->dm_dircluster == fnp2->f_dmp->dm_dircluster) 2109 .loc 1 525 0 0 000056F9 BB[0000] mov bx, offset _fnode 0 000056FC 8B773C mov si, word ptr [bx+60] 2112 _.LVL222: 526:fatfs.c **** { 2113 .loc 1 526 0 0 000056FF 8B5F02 mov bx, word ptr [bx+2] 0 00005702 8B470F mov ax, word ptr [bx+15] 2116 _.LVL223: 0 00005705 3B440F cmp ax, word ptr [si+15] 0 00005708 7534 jne _.L230 0 0000570A 8B4711 mov ax, word ptr [bx+17] 0 0000570D 3B4411 cmp ax, word ptr [si+17] 0 00005710 752C jne _.L230 2122 _.LVL224: 530:fatfs.c **** return ret; 2123 .loc 1 530 0 0 00005712 B8[0000] mov ax, offset _fnode 0 00005715 50 push ax 0 00005716 E8[FEFF] call _remove_lfn_entries 2127 _.LVL225: 0 00005719 85C0 test ax, ax 0 0000571B 7C79 jl _.L236 529:fatfs.c **** if ((ret = remove_lfn_entries(fnp1)) < 0) 2130 .loc 1 529 0 0 0000571D BB[0000] mov bx, offset _fnode 2132 _.LVL226: 2133 _.L231: 558:fatfs.c **** 2134 .loc 1 558 0 0 00005720 B80B00 mov ax, 11 0 00005723 50 push ax 525:fatfs.c **** if (fnp1->f_dmp->dm_dircluster == fnp2->f_dmp->dm_dircluster) 2137 .loc 1 525 0 0 00005724 46 inc si 2139 _.LVL227: 558:fatfs.c **** 2140 .loc 1 558 0 0 00005725 56 push si 0 00005726 8D4704 lea ax, [4+bx] 0 00005729 895EFE mov word ptr [bp-2], bx 0 0000572C 50 push ax 0 0000572D E8[FEFF] call _memcpy 2146 _.LVL228: 561:fatfs.c **** } 2147 .loc 1 561 0 0 00005730 31C0 xor ax, ax 0 00005732 50 push ax 0 00005733 8B5EFE mov bx, word ptr [bp-2] 0 00005736 53 push bx 0 00005737 E8[FEFF] call _dir_write_update 2153 _.LVL229: 0 0000573A 85C0 test ax, ax 0 0000573C EBAD jmp _.L242 2156 _.LVL230: 2157 _.L230: 536:fatfs.c **** return DE_ACCESS; 2158 .loc 1 536 0 0 0000573E BB[0000] mov bx, offset _fnode 0 00005741 F6470F10 test byte ptr [bx+15], 16 0 00005745 75A6 jne _.L229 540:fatfs.c **** if (ret != SUCCESS) 2162 .loc 1 540 0 0 00005747 FF760A push word ptr [bp+10] 0 0000574A 52 push dx 0 0000574B E814FD call _alloc_find_free 2166 _.LVL231: 0 0000574E 8946FE mov word ptr [bp-2], ax 2168 _.LVL232: 541:fatfs.c **** return ret; 2169 .loc 1 541 0 0 00005751 85C0 test ax, ax 0 00005753 753B jne _.L235 544:fatfs.c **** return ret; 2172 .loc 1 544 0 0 00005755 B8[0000] mov ax, offset _fnode 2174 _.LVL233: 0 00005758 50 push ax 0 00005759 E8[FEFF] call _remove_lfn_entries 2177 _.LVL234: 0 0000575C 85C0 test ax, ax 0 0000575E 7C36 jl _.L236 548:fatfs.c **** 2180 .loc 1 548 0 0 00005760 B82000 mov ax, 32 2182 _.LVL235: 0 00005763 50 push ax 0 00005764 B8[0400] mov ax, offset _fnode+4 0 00005767 50 push ax 0 00005768 B8[3E00] mov ax, offset _fnode+62 0 0000576B 50 push ax 0 0000576C E8[FEFF] call _memcpy 2189 _.LVL236: 551:fatfs.c **** 2190 .loc 1 551 0 0 0000576F C606[0400]05 mov byte ptr [_fnode+4], 5 553:fatfs.c **** return DE_ACCESS; 2192 .loc 1 553 0 0 00005774 FF76FE push word ptr [bp-2] 0 00005777 B8[0000] mov ax, offset _fnode 0 0000577A 50 push ax 0 0000577B E8[FEFF] call _dir_write_update 2197 _.LVL237: 0 0000577E 85C0 test ax, ax 0 00005780 7503E968FF je _.L229 520:fatfs.c **** ret = find_fname(path2, attrib, fnp2); 2200 .loc 1 520 0 0 00005785 BB[3A00] mov bx, offset _fnode+58 2202 _.LVL238: 0 00005788 EB96 jmp _.L231 2204 _.LVL239: 2205 _.L232: 510:fatfs.c **** 2206 .loc 1 510 0 0 0000578A BFF0FF mov di, -16 0 0000578D E960FF jmp _.L226 2209 _.LVL240: 2210 _.L235: 0 00005790 8B7EFE mov di, word ptr [bp-2] 0 00005793 E95AFF jmp _.L226 2213 _.LVL241: 2214 _.L236: 0 00005796 97 xchg di, ax 0 00005797 E956FF jmp _.L226 2217 _.LFE23: 2218 .size _dos_rename, .-_dos_rename 2219 .global _dos_getdate 2220 .type _dos_getdate, @function 2221 _dos_getdate: 2222 _.LFB28: 668:fatfs.c **** struct dosdate dd; 2223 .loc 1 668 0 0 0000579A 55 push bp 2225 _.LCFI54: 0 0000579B 89E5 mov bp, sp 2227 _.LCFI55: 0 0000579D 1E push ds 0 0000579E 1E push ds 673:fatfs.c **** return DT_ENCODE(dd.month, dd.monthday, dd.year - EPOCH_YEAR); 2230 .loc 1 673 0 0 0000579F 8D46FC lea ax, [-4+bp] 0 000057A2 50 push ax 0 000057A3 E8[FEFF] call _DosGetDate 2234 _.LVL242: 674:fatfs.c **** } 2235 .loc 1 674 0 0 000057A6 8A46FF mov al, byte ptr [bp-1] 0 000057A9 B105 mov cl, 5 0 000057AB D3E0 shl ax, cl 0 000057AD 25E001 and ax, 480 0 000057B0 8A56FE mov dl, byte ptr [bp-2] 0 000057B3 80E21F and dl, 31 0 000057B6 08D0 or al, dl 0 000057B8 8B56FC mov dx, word ptr [bp-4] 0 000057BB 81C244F8 add dx, -1980 0 000057BF B109 mov cl, 9 0 000057C1 D3E2 shl dx, cl 0 000057C3 09D0 or ax, dx 675:fatfs.c **** 2248 .loc 1 675 0 0 000057C5 89EC mov sp, bp 0 000057C7 5D pop bp 0 000057C8 C3 ret 2252 _.LFE28: 2253 .size _dos_getdate, .-_dos_getdate 2254 .global _dos_gettime 2255 .type _dos_gettime, @function 2256 _dos_gettime: 2257 _.LFB29: 681:fatfs.c **** struct dostime dt; 2258 .loc 1 681 0 0 000057C9 55 push bp 2260 _.LCFI56: 0 000057CA 89E5 mov bp, sp 2262 _.LCFI57: 0 000057CC 1E push ds 0 000057CD 1E push ds 686:fatfs.c **** return time_encode(&dt); 2265 .loc 1 686 0 0 000057CE 8D46FC lea ax, [-4+bp] 0 000057D1 50 push ax 0 000057D2 E8[FEFF] call _DosGetTime 2269 _.LVL243: 2270 _.LBB78: 2271 _.LBB79: 55:fatfs.c **** } 2272 .loc 1 55 0 0 000057D5 8A46FD mov al, byte ptr [bp-3] 0 000057D8 B10B mov cl, 11 0 000057DA D3E0 shl ax, cl 0 000057DC 8A56FC mov dl, byte ptr [bp-4] 0 000057DF 30F6 xor dh, dh 0 000057E1 B105 mov cl, 5 0 000057E3 D3E2 shl dx, cl 0 000057E5 09D0 or ax, dx 0 000057E7 8A56FF mov dl, byte ptr [bp-1] 0 000057EA D0EA shr dl, 1 0 000057EC 08D0 or al, dl 2284 _.LVL244: 2285 _.LBE79: 2286 _.LBE78: 688:fatfs.c **** 2287 .loc 1 688 0 0 000057EE 89EC mov sp, bp 0 000057F0 5D pop bp 0 000057F1 C3 ret 2291 _.LFE29: 2292 .size _dos_gettime, .-_dos_gettime 2293 .type _init_direntry, @function 2294 _init_direntry: 2295 _.LFB9: 96:fatfs.c **** memset(dentry, 0, sizeof(struct dirent)); 2296 .loc 1 96 0 2297 _.LVL245: 0 000057F2 56 push si 0 000057F3 57 push di 0 000057F4 55 push bp 2301 _.LCFI58: 0 000057F5 89E5 mov bp, sp 2303 _.LCFI59: 0 000057F7 1E push ds 0 000057F8 8B7608 mov si, word ptr [bp+8] 0 000057FB 8B560C mov dx, word ptr [bp+12] 0 000057FE 8956FE mov word ptr [bp-2], dx 0 00005801 8B7E0E mov di, word ptr [bp+14] 97:fatfs.c **** memcpy(dentry->dir_name, name, FNAME_SIZE + FEXT_SIZE); 2309 .loc 1 97 0 0 00005804 B82000 mov ax, 32 0 00005807 50 push ax 0 00005808 31C0 xor ax, ax 0 0000580A 50 push ax 0 0000580B 56 push si 0 0000580C E8[FEFF] call _memset 2316 _.LVL246: 98:fatfs.c **** #ifdef WITHFAT32 2317 .loc 1 98 0 0 0000580F B80B00 mov ax, 11 0 00005812 50 push ax 0 00005813 FF7610 push word ptr [bp+16] 0 00005816 56 push si 0 00005817 E8[FEFF] call _memcpy 2323 _.LVL247: 100:fatfs.c **** #endif 2324 .loc 1 100 0 0 0000581A 897C14 mov word ptr [si+20], di 102:fatfs.c **** dentry->dir_attrib = (UBYTE)attrib; 2326 .loc 1 102 0 0 0000581D 8B56FE mov dx, word ptr [bp-2] 0 00005820 89541A mov word ptr [si+26], dx 103:fatfs.c **** /* set create and last modified time & date */ 2329 .loc 1 103 0 0 00005823 8B460A mov ax, word ptr [bp+10] 0 00005826 88440B mov byte ptr [si+11], al 105:fatfs.c **** dentry->dir_crdate = dentry->dir_date = dos_getdate(); 2332 .loc 1 105 0 0 00005829 E8[FEFF] call _dos_gettime 2334 _.LVL248: 0 0000582C 894416 mov word ptr [si+22], ax 0 0000582F 89440E mov word ptr [si+14], ax 106:fatfs.c **** } 2337 .loc 1 106 0 0 00005832 E8[FEFF] call _dos_getdate 2339 _.LVL249: 0 00005835 894418 mov word ptr [si+24], ax 0 00005838 894410 mov word ptr [si+16], ax 107:fatfs.c **** 2342 .loc 1 107 0 0 0000583B 89EC mov sp, bp 0 0000583D 5D pop bp 0 0000583E 5F pop di 0 0000583F 5E pop si 0 00005840 C20A00 ret 10 2348 _.LFE9: 2349 .size _init_direntry, .-_init_direntry 2350 .global _dos_open 2351 .type _dos_open, @function 2352 _dos_open: 2353 _.LFB10: 123:fatfs.c **** REG f_node_ptr fnp = sft_to_fnode(fd); 2354 .loc 1 123 0 2355 _.LVL250: 0 00005843 56 push si 0 00005844 57 push di 0 00005845 55 push bp 2359 _.LCFI60: 0 00005846 89E5 mov bp, sp 2361 _.LCFI61: 0 00005848 1E push ds 124:fatfs.c **** int status = find_fname(path, D_ALL | attrib, fnp); 2363 .loc 1 124 0 0 00005849 FF760E push word ptr [bp+14] 0 0000584C E882F3 call _sft_to_fnode 2366 _.LVL251: 0 0000584F 89C6 mov si, ax 2368 _.LVL252: 125:fatfs.c **** 2369 .loc 1 125 0 0 00005851 50 push ax 0 00005852 8B460C mov ax, word ptr [bp+12] 2372 _.LVL253: 0 00005855 83C837 or ax, 55 0 00005858 50 push ax 0 00005859 FF7608 push word ptr [bp+8] 0 0000585C E86FFC call _find_fname 2377 _.LVL254: 129:fatfs.c **** { 2378 .loc 1 129 0 0 0000585F 85C0 test ax, ax 0 00005861 7403E9C900 jne _.L250 2381 _.LBB86: 131:fatfs.c **** if (flags & O_TRUNC) 2382 .loc 1 131 0 0 00005866 8A440F mov al, byte ptr [si+15] 2384 _.LVL255: 0 00005869 8846FE mov byte ptr [bp-2], al 2386 _.LVL256: 132:fatfs.c **** { 2387 .loc 1 132 0 0 0000586C F6460B02 test byte ptr [bp+11], 2 0 00005870 7503E98300 je _.L251 137:fatfs.c **** || (dir_attrib & ~D_ARCHIVE & ~attrib)) 2390 .loc 1 137 0 0 00005875 A819 test al, 25 0 00005877 740C je _.L252 2393 _.LVL257: 2394 _.L254: 139:fatfs.c **** 2395 .loc 1 139 0 0 00005879 BFFBFF mov di, -5 2397 _.L249: 2398 _.LBE86: 202:fatfs.c **** 2399 .loc 1 202 0 0 0000587C 97 xchg di, ax 0 0000587D 89EC mov sp, bp 0 0000587F 5D pop bp 0 00005880 5F pop di 0 00005881 5E pop si 2405 _.LVL258: 0 00005882 C20800 ret 8 2407 _.LVL259: 2408 _.L252: 2409 _.LBB87: 138:fatfs.c **** return DE_ACCESS; 2410 .loc 1 138 0 0 00005885 8B560C mov dx, word ptr [bp+12] 0 00005888 F7D2 not dx 0 0000588A 83E2DF and dx, -33 0 0000588D 8A46FE mov al, byte ptr [bp-2] 2415 _.LVL260: 0 00005890 30E4 xor ah, ah 0 00005892 85C2 test dx, ax 0 00005894 75E3 jne _.L254 144:fatfs.c **** status = S_REPLACED; 2419 .loc 1 144 0 0 00005896 56 push si 2421 _.LVL261: 0 00005897 E842F7 call _wipe_out 2423 _.LVL262: 145:fatfs.c **** } 2424 .loc 1 145 0 0 0000589A BF0300 mov di, 3 2426 _.LVL263: 2427 _.L255: 2428 _.LBE87: 181:fatfs.c **** fnp->f_offset = 0l; 2429 .loc 1 181 0 0 0000589D 8A460E mov al, byte ptr [bp+14] 0 000058A0 884439 mov byte ptr [si+57], al 182:fatfs.c **** fnp->f_cluster_offset = 0; 2432 .loc 1 182 0 0 000058A3 C7442D0000 mov word ptr [si+45], 0 0 000058A8 C7442F0000 mov word ptr [si+47], 0 183:fatfs.c **** 2435 .loc 1 183 0 0 000058AD C744310000 mov word ptr [si+49], 0 0 000058B2 C744330000 mov word ptr [si+51], 0 185:fatfs.c **** /* use FCLEAN even on replaced/created files: the bit is reset */ 2438 .loc 1 185 0 0 000058B7 8B04 mov ax, word ptr [si] 0 000058B9 80E4BF and ah, -65 188:fatfs.c **** if (status != S_OPENED) 2441 .loc 1 188 0 0 000058BC 83C840 or ax, 64 0 000058BF 8904 mov word ptr [si], ax 189:fatfs.c **** { 2444 .loc 1 189 0 0 000058C1 83FF01 cmp di, 1 0 000058C4 B80000 mov ax, 0 0 000058C7 7403E98C00 jne _.L257 2448 _.L260: 196:fatfs.c **** /* /// Moved from above. - Ron Cemer */ 2449 .loc 1 196 0 0 000058CC 83FF01 cmp di, 1 0 000058CF 9F lahf 0 000058D0 D0E4 shl ah, 1 0 000058D2 99 cwd 0 000058D3 F7DA neg dx 0 000058D5 52 push dx 0 000058D6 56 push si 0 000058D7 E806F8 call _merge_file_changes 2458 _.LVL264: 2459 _.LBB88: 2460 _.LBB89: 61:fatfs.c **** return dentry->dir_start; 2461 .loc 1 61 0 0 000058DA C45C29 les bx, dword ptr [si+41] 0 000058DD 26837F0F00 cmp word ptr es:[bx+15], 0 0 000058E2 8B541E mov dx, word ptr [si+30] 0 000058E5 7503E99400 je _.L273 62:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 2466 .loc 1 62 0 0 000058EA 31C0 xor ax, ax 2468 _.L261: 2469 _.LVL265: 2470 _.LBE89: 2471 _.LBE88: 198:fatfs.c **** 2472 .loc 1 198 0 0 000058EC 895435 mov word ptr [si+53], dx 0 000058EF 894437 mov word ptr [si+55], ax 200:fatfs.c **** return status; 2475 .loc 1 200 0 0 000058F2 56 push si 0 000058F3 E819F7 call _fnode_to_sft 2478 _.LVL266: 201:fatfs.c **** } 2479 .loc 1 201 0 0 000058F6 EB84 jmp _.L249 2481 _.LVL267: 2482 _.L251: 2483 _.LBB93: 147:fatfs.c **** { 2484 .loc 1 147 0 0 000058F8 F6460B01 test byte ptr [bp+11], 1 0 000058FC 7503E98300 je _.L262 150:fatfs.c **** flags = (flags & ~3) | O_RDONLY; 2487 .loc 1 150 0 0 00005901 837E0A00 cmp word ptr [bp+10], 0 0 00005905 7D0A jge _.L256 150:fatfs.c **** flags = (flags & ~3) | O_RDONLY; 2490 .loc 1 150 0 is_stmt 0 discriminator 1 0 00005907 F646FE01 test byte ptr [bp-2], 1 0 0000590B 7404 je _.L256 151:fatfs.c **** 2493 .loc 1 151 0 is_stmt 1 0 0000590D 80660AFC and byte ptr [bp+10], -4 2495 _.LVL268: 2496 _.L256: 156:fatfs.c **** ((dir_attrib & D_RDONLY) && ((flags & O_ACCMODE) != O_RDONLY))) 2497 .loc 1 156 0 0 00005911 F646FE18 test byte ptr [bp-2], 24 0 00005915 7403E95FFF jne _.L254 156:fatfs.c **** ((dir_attrib & D_RDONLY) && ((flags & O_ACCMODE) != O_RDONLY))) 2500 .loc 1 156 0 is_stmt 0 discriminator 1 0 0000591A F646FE01 test byte ptr [bp-2], 1 0 0000591E 7409 je _.L263 157:fatfs.c **** return DE_ACCESS; 2503 .loc 1 157 0 is_stmt 1 0 00005920 F6460A03 test byte ptr [bp+10], 3 0 00005924 7403E950FF jne _.L254 2506 _.L263: 159:fatfs.c **** } 2507 .loc 1 159 0 0 00005929 BF0100 mov di, 1 0 0000592C E96EFF jmp _.L255 2510 _.LVL269: 2511 _.L250: 0 0000592F 89C7 mov di, ax 2513 _.LBE93: 166:fatfs.c **** { 2514 .loc 1 166 0 0 00005931 83F8FE cmp ax, -2 0 00005934 7403E943FF jne _.L249 166:fatfs.c **** { 2517 .loc 1 166 0 is_stmt 0 discriminator 1 0 00005939 F6460B04 test byte ptr [bp+11], 4 0 0000593D 7503E93AFF je _.L249 2520 _.LBB94: 168:fatfs.c **** if (ret != SUCCESS) 2521 .loc 1 168 0 is_stmt 1 0 00005942 FF7608 push word ptr [bp+8] 0 00005945 56 push si 0 00005946 E819FB call _alloc_find_free 2525 _.LVL270: 0 00005949 89C7 mov di, ax 2527 _.LVL271: 169:fatfs.c **** return ret; 2528 .loc 1 169 0 0 0000594B 85C0 test ax, ax 0 0000594D 7403E92AFF jne _.L249 171:fatfs.c **** } 2531 .loc 1 171 0 0 00005952 BF0200 mov di, 2 0 00005955 E945FF jmp _.L255 2534 _.LVL272: 2535 _.L257: 2536 _.LBE94: 191:fatfs.c **** if (!dir_write(fnp)) 2537 .loc 1 191 0 0 00005958 8B5402 mov dx, word ptr [si+2] 0 0000595B 42 inc dx 0 0000595C 52 push dx 0 0000595D 50 push ax 0 0000595E 50 push ax 0 0000595F 8946FE mov word ptr [bp-2], ax 0 00005962 FF760C push word ptr [bp+12] 0 00005965 8D5404 lea dx, [4+si] 0 00005968 52 push dx 0 00005969 E886FE call _init_direntry 2548 _.LVL273: 192:fatfs.c **** return DE_ACCESS; 2549 .loc 1 192 0 0 0000596C 8B46FE mov ax, word ptr [bp-2] 0 0000596F 50 push ax 0 00005970 56 push si 0 00005971 E8[FEFF] call _dir_write_update 2554 _.LVL274: 0 00005974 85C0 test ax, ax 0 00005976 7403E951FF jne _.L260 0 0000597B E9FBFE jmp _.L254 2558 _.LVL275: 2559 _.L273: 2560 _.LBB95: 2561 _.LBB92: 2562 _.LBB90: 2563 _.LBB91: 63:fatfs.c **** } 2564 .loc 1 63 0 0 0000597E 8B4418 mov ax, word ptr [si+24] 2566 _.LVL276: 0 00005981 E968FF jmp _.L261 2568 _.LVL277: 2569 _.L262: 2570 _.LBE91: 2571 _.LBE90: 2572 _.LBE92: 2573 _.LBE95: 2574 _.LBB96: 163:fatfs.c **** } 2575 .loc 1 163 0 0 00005984 BFB0FF mov di, -80 0 00005987 E9F2FE jmp _.L249 2578 _.LBE96: 2579 _.LFE10: 2580 .size _dos_open, .-_dos_open 2581 .global _dos_close 2582 .type _dos_close, @function 2583 _dos_close: 2584 _.LFB12: 213:fatfs.c **** /* Translate the fd into a useful pointer */ 2585 .loc 1 213 0 2586 _.LVL278: 0 0000598A 56 push si 0 0000598B 55 push bp 2589 _.LCFI62: 0 0000598C 89E5 mov bp, sp 2591 _.LCFI63: 215:fatfs.c **** 2592 .loc 1 215 0 0 0000598E FF7606 push word ptr [bp+6] 0 00005991 E83DF2 call _sft_to_fnode 2595 _.LVL279: 0 00005994 96 xchg si, ax 2597 _.LVL280: 217:fatfs.c **** { 2598 .loc 1 217 0 0 00005995 8B04 mov ax, word ptr [si] 2600 _.LVL281: 0 00005997 A840 test al, 64 0 00005999 7518 jne _.L276 219:fatfs.c **** { 2603 .loc 1 219 0 0 0000599B F6C440 test ah, 64 0 0000599E 750C jne _.L277 221:fatfs.c **** fnp->f_dir.dir_date = dos_getdate(); 2606 .loc 1 221 0 0 000059A0 E8[FEFF] call _dos_gettime 2608 _.LVL282: 0 000059A3 89441A mov word ptr [si+26], ax 222:fatfs.c **** } 2610 .loc 1 222 0 0 000059A6 E8[FEFF] call _dos_getdate 2612 _.LVL283: 0 000059A9 89441C mov word ptr [si+28], ax 2614 _.L277: 225:fatfs.c **** } 2615 .loc 1 225 0 0 000059AC 31C0 xor ax, ax 0 000059AE 50 push ax 0 000059AF 56 push si 0 000059B0 E82DF7 call _merge_file_changes 2620 _.LVL284: 2621 _.L276: 227:fatfs.c **** 2622 .loc 1 227 0 0 000059B3 C64439FF mov byte ptr [si+57], -1 229:fatfs.c **** } 2624 .loc 1 229 0 0 000059B7 B80100 mov ax, 1 0 000059BA 50 push ax 0 000059BB 56 push si 0 000059BC E8[FEFF] call _dir_write_update 2629 _.LVL285: 0 000059BF 31D2 xor dx, dx 0 000059C1 39D0 cmp ax, dx 0 000059C3 7503 jne _.L275 0 000059C5 BAFAFF mov dx, -6 2634 _.L275: 230:fatfs.c **** 2635 .loc 1 230 0 0 000059C8 92 xchg dx, ax 0 000059C9 89EC mov sp, bp 0 000059CB 5D pop bp 0 000059CC 5E pop si 2640 _.LVL286: 0 000059CD C20200 ret 2 2642 _.LFE12: 2643 .size _dos_close, .-_dos_close === Switch to base=012BB0h -> ".RODATA.STR1.1" 2644 .section .rodata.str1.1 2645 _.LC1: 0 00001934 2E20202020202020 .string ". " 0 0000193C 20202000 === Switch to base=002270h -> ".TEXT" 2647 .text 2648 .global _dos_mkdir 2649 .type _dos_mkdir, @function 2650 _dos_mkdir: 2651 _.LFB32: 789:fatfs.c **** REG f_node_ptr fnp; 2652 .loc 1 789 0 2653 _.LVL287: 0 000059D0 56 push si 0 000059D1 57 push di 0 000059D2 55 push bp 2657 _.LCFI64: 0 000059D3 89E5 mov bp, sp 2659 _.LCFI65: 0 000059D5 83EC0E sub sp, 14 802:fatfs.c **** return DE_PATHNOTFND; 2661 .loc 1 802 0 0 000059D8 FF7608 push word ptr [bp+8] 0 000059DB E8[FEFF] call _strlen 2664 _.LVL288: 0 000059DE 83F842 cmp ax, 66 0 000059E1 7603E95D01 ja _.L291 2667 _.LVL289: 808:fatfs.c **** if (ret != DE_FILENOTFND) 2668 .loc 1 808 0 0 000059E6 BE[0000] mov si, offset _fnode 0 000059E9 56 push si 0 000059EA B83700 mov ax, 55 0 000059ED 50 push ax 0 000059EE FF7608 push word ptr [bp+8] 0 000059F1 E8DAFA call _find_fname 2675 _.LVL290: 0 000059F4 89C7 mov di, ax 2677 _.LVL291: 809:fatfs.c **** return ret == SUCCESS ? DE_ACCESS : ret; 2678 .loc 1 809 0 0 000059F6 83F8FE cmp ax, -2 0 000059F9 7410 je _.L283 810:fatfs.c **** 2681 .loc 1 810 0 0 000059FB 85C0 test ax, ax 2683 _.LVL292: 2684 _.L304: 0 000059FD 7503 jne _.L281 2686 _.L286: 0 000059FF BFFBFF mov di, -5 2688 _.LVL293: 2689 _.L281: 876:fatfs.c **** 2690 .loc 1 876 0 0 00005A02 97 xchg di, ax 0 00005A03 89EC mov sp, bp 0 00005A05 5D pop bp 0 00005A06 5F pop di 0 00005A07 5E pop si 0 00005A08 C20200 ret 2 2697 _.LVL294: 2698 _.L283: 812:fatfs.c **** 2699 .loc 1 812 0 0 00005A0B 8B5C02 mov bx, word ptr [si+2] 0 00005A0E C4470F les ax, dword ptr [bx+15] 2702 _.LVL295: 0 00005A11 8946FA mov word ptr [bp-6], ax 0 00005A14 8C46F8 mov word ptr [bp-8], es 2705 _.LVL296: 814:fatfs.c **** if (ret != SUCCESS) 2706 .loc 1 814 0 0 00005A17 FF7608 push word ptr [bp+8] 0 00005A1A 56 push si 0 00005A1B E844FA call _alloc_find_free 2710 _.LVL297: 0 00005A1E 89C7 mov di, ax 2712 _.LVL298: 815:fatfs.c **** return ret; 2713 .loc 1 815 0 0 00005A20 85C0 test ax, ax 0 00005A22 75DE jne _.L281 822:fatfs.c **** 2716 .loc 1 822 0 0 00005A24 56 push si 0 00005A25 E876F3 call _find_fat_free 2719 _.LVL299: 0 00005A28 8946FE mov word ptr [bp-2], ax 0 00005A2B 8956FC mov word ptr [bp-4], dx 2722 _.LVL300: 826:fatfs.c **** return DE_HNDLDSKFULL; 2723 .loc 1 826 0 0 00005A2E 83F8FF cmp ax, -1 0 00005A31 750B jne _.L284 0 00005A33 81FAFF0F cmp dx, 4095 0 00005A37 7505 jne _.L284 2728 _.LVL301: 2729 _.L285: 827:fatfs.c **** 2730 .loc 1 827 0 0 00005A39 BFE4FF mov di, -28 2732 _.LVL302: 0 00005A3C EBC4 jmp _.L281 2734 _.LVL303: 2735 _.L284: 829:fatfs.c **** 2736 .loc 1 829 0 0 00005A3E 8B4402 mov ax, word ptr [si+2] 2738 _.LVL304: 0 00005A41 40 inc ax 0 00005A42 50 push ax 0 00005A43 FF76FC push word ptr [bp-4] 0 00005A46 FF76FE push word ptr [bp-2] 0 00005A49 B81000 mov ax, 16 0 00005A4C 50 push ax 0 00005A4D B8[0400] mov ax, offset _fnode+4 0 00005A50 50 push ax 0 00005A51 E89EFD call _init_direntry 2748 _.LVL305: 832:fatfs.c **** return DE_HNDLDSKFULL; /* should never happen */ 2749 .loc 1 832 0 0 00005A54 B8FF0F mov ax, 4095 0 00005A57 50 push ax 0 00005A58 B8FFFF mov ax, -1 0 00005A5B 50 push ax 0 00005A5C FF76FC push word ptr [bp-4] 0 00005A5F FF76FE push word ptr [bp-2] 0 00005A62 FF36[2B00] push word ptr [_fnode+43] 0 00005A66 FF36[2900] push word ptr [_fnode+41] 0 00005A6A E8[FEFF] call _link_fat 2759 _.LVL306: 0 00005A6D 8946F6 mov word ptr [bp-10], ax 0 00005A70 09D0 or ax, dx 0 00005A72 8956F4 mov word ptr [bp-12], dx 0 00005A75 75C2 jne _.L285 836:fatfs.c **** if (ret != SUCCESS) 2764 .loc 1 836 0 0 00005A77 FF76FC push word ptr [bp-4] 0 00005A7A FF76FE push word ptr [bp-2] 0 00005A7D 56 push si 0 00005A7E E875F8 call _clear_dir 2769 _.LVL307: 0 00005A81 89C7 mov di, ax 2771 _.LVL308: 837:fatfs.c **** return ret; 2772 .loc 1 837 0 0 00005A83 85C0 test ax, ax 0 00005A85 8B56F4 mov dx, word ptr [bp-12] 0 00005A88 7403E975FF jne _.L281 0 00005A8D 8956F2 mov word ptr [bp-14], dx 841:fatfs.c **** return DE_ACCESS; 2777 .loc 1 841 0 0 00005A90 50 push ax 0 00005A91 56 push si 0 00005A92 E8[FEFF] call _dir_write_update 2781 _.LVL309: 0 00005A95 85C0 test ax, ax 0 00005A97 7503E963FF je _.L286 847:fatfs.c **** fnp->f_dmp->dm_entry = 0; 2784 .loc 1 847 0 0 00005A9C FF76FC push word ptr [bp-4] 0 00005A9F FF76FE push word ptr [bp-2] 0 00005AA2 56 push si 0 00005AA3 E8[FEFF] call _dir_init_fnode 2789 _.LVL310: 848:fatfs.c **** find_free(fnp); 2790 .loc 1 848 0 0 00005AA6 8B5C02 mov bx, word ptr [si+2] 0 00005AA9 897F0D mov word ptr [bx+13], di 849:fatfs.c **** 2793 .loc 1 849 0 0 00005AAC 56 push si 0 00005AAD E800F2 call _find_free 2796 _.LVL311: 852:fatfs.c **** 2797 .loc 1 852 0 0 00005AB0 B9[1500] mov cx, offset _.LC1 0 00005AB3 51 push cx 0 00005AB4 894EF4 mov word ptr [bp-12], cx 0 00005AB7 FF76FC push word ptr [bp-4] 0 00005ABA FF76FE push word ptr [bp-2] 0 00005ABD B81000 mov ax, 16 0 00005AC0 50 push ax 0 00005AC1 B8[0400] mov ax, offset _fnode+4 0 00005AC4 50 push ax 0 00005AC5 E82AFD call _init_direntry 2808 _.LVL312: 855:fatfs.c **** return DE_ACCESS; 2809 .loc 1 855 0 0 00005AC8 57 push di 0 00005AC9 56 push si 0 00005ACA E8[FEFF] call _dir_write_update 2813 _.LVL313: 0 00005ACD 85C0 test ax, ax 0 00005ACF 8B4EF4 mov cx, word ptr [bp-12] 0 00005AD2 894EFE mov word ptr [bp-2], cx 2817 _.LVL314: 0 00005AD5 7503E925FF je _.L286 859:fatfs.c **** return ret; 2819 .loc 1 859 0 0 00005ADA 56 push si 0 00005ADB E8D2F1 call _find_free 2822 _.LVL315: 0 00005ADE 85C0 test ax, ax 0 00005AE0 8B56F2 mov dx, word ptr [bp-14] 0 00005AE3 742F je _.L287 2826 _.LVL316: 2827 _.L290: 862:fatfs.c **** { 2828 .loc 1 862 0 0 00005AE5 C45C29 les bx, dword ptr [si+41] 0 00005AE8 26837F0F00 cmp word ptr es:[bx+15], 0 0 00005AED 7437 je _.L288 2832 _.LVL317: 2833 _.L289: 868:fatfs.c **** fnp->f_dir.dir_name[1] = '.'; 2834 .loc 1 868 0 0 00005AEF FF76FE push word ptr [bp-2] 0 00005AF2 FF76F8 push word ptr [bp-8] 0 00005AF5 FF76FA push word ptr [bp-6] 0 00005AF8 B81000 mov ax, 16 0 00005AFB 50 push ax 0 00005AFC B8[0400] mov ax, offset _fnode+4 0 00005AFF 50 push ax 0 00005B00 E8EFFC call _init_direntry 2843 _.LVL318: 869:fatfs.c **** 2844 .loc 1 869 0 0 00005B03 C606[0500]2E mov byte ptr [_fnode+5], 46 872:fatfs.c **** return DE_ACCESS; 2846 .loc 1 872 0 0 00005B08 31C0 xor ax, ax 0 00005B0A 50 push ax 0 00005B0B 56 push si 0 00005B0C E8[FEFF] call _dir_write_update 2851 _.LVL319: 0 00005B0F 85C0 test ax, ax 0 00005B11 E9E9FE jmp _.L304 2854 _.LVL320: 2855 _.L287: 0 00005B14 8956FC mov word ptr [bp-4], dx 859:fatfs.c **** return ret; 2857 .loc 1 859 0 discriminator 1 0 00005B17 56 push si 0 00005B18 E87EF8 call _extend_dir 2860 _.LVL321: 0 00005B1B 85C0 test ax, ax 0 00005B1D 8B56FC mov dx, word ptr [bp-4] 0 00005B20 74C3 je _.L290 0 00005B22 97 xchg di, ax 0 00005B23 E9DCFE jmp _.L281 2866 _.LVL322: 2867 _.L288: 862:fatfs.c **** { 2868 .loc 1 862 0 discriminator 1 0 00005B26 8B4EFA mov cx, word ptr [bp-6] 0 00005B29 26394F35 cmp word ptr es:[bx+53], cx 0 00005B2D 75C0 jne _.L289 0 00005B2F 8B46F8 mov ax, word ptr [bp-8] 0 00005B32 26394737 cmp word ptr es:[bx+55], ax 0 00005B36 75B7 jne _.L289 864:fatfs.c **** } 2875 .loc 1 864 0 0 00005B38 8B46F6 mov ax, word ptr [bp-10] 0 00005B3B 8946FA mov word ptr [bp-6], ax 2878 _.LVL323: 0 00005B3E 8956F8 mov word ptr [bp-8], dx 0 00005B41 EBAC jmp _.L289 2881 _.LVL324: 2882 _.L291: 803:fatfs.c **** 2883 .loc 1 803 0 0 00005B43 BFFDFF mov di, -3 0 00005B46 E9B9FE jmp _.L281 2886 _.LFE32: 2887 .size _dos_mkdir, .-_dos_mkdir 2888 .global _map_cluster 2889 .type _map_cluster, @function 2890 _map_cluster: 2891 _.LFB35: 960:fatfs.c **** CLUSTER relcluster, cluster; 2892 .loc 1 960 0 2893 _.LVL325: 0 00005B49 56 push si 0 00005B4A 57 push di 0 00005B4B 55 push bp 2897 _.LCFI66: 0 00005B4C 89E5 mov bp, sp 2899 _.LCFI67: 0 00005B4E 83EC06 sub sp, 6 0 00005B51 8B7608 mov si, word ptr [bp+8] 969:fatfs.c **** { 2902 .loc 1 969 0 0 00005B54 8B4437 mov ax, word ptr [si+55] 0 00005B57 0B4435 or ax, word ptr [si+53] 0 00005B5A 752B jne _.L306 973:fatfs.c **** return DE_SEEK; 2906 .loc 1 973 0 0 00005B5C 837E0A01 cmp word ptr [bp+10], 1 0 00005B60 750B jne _.L307 2909 _.L316: 974:fatfs.c **** 2910 .loc 1 974 0 0 00005B62 B8E7FF mov ax, -25 2912 _.L305: 1038:fatfs.c **** 2913 .loc 1 1038 0 0 00005B65 89EC mov sp, bp 0 00005B67 5D pop bp 0 00005B68 5F pop di 0 00005B69 5E pop si 0 00005B6A C20400 ret 4 2919 _.L307: 980:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 2920 .loc 1 980 0 0 00005B6D 56 push si 0 00005B6E E817F3 call _extend 2923 _.LVL326: 981:fatfs.c **** { 2924 .loc 1 981 0 0 00005B71 83F8FF cmp ax, -1 0 00005B74 750B jne _.L309 0 00005B76 81FAFF0F cmp dx, 4095 0 00005B7A 7505 jne _.L309 2929 _.LVL327: 2930 _.L319: 983:fatfs.c **** } 2931 .loc 1 983 0 0 00005B7C B8E4FF mov ax, -28 0 00005B7F EBE4 jmp _.L305 2934 _.LVL328: 2935 _.L309: 985:fatfs.c **** } 2936 .loc 1 985 0 0 00005B81 894435 mov word ptr [si+53], ax 0 00005B84 895437 mov word ptr [si+55], dx 2939 _.LVL329: 2940 _.L306: 988:fatfs.c **** fnp->f_dpb->dpb_shftcnt); 2941 .loc 1 988 0 0 00005B87 8B5C29 mov bx, word ptr [si+41] 0 00005B8A 8B442B mov ax, word ptr [si+43] 0 00005B8D 8946FE mov word ptr [bp-2], ax 0 00005B90 8EC0 mov es, ax 0 00005B92 268B4702 mov ax, word ptr es:[bx+2] 0 00005B96 895EFC mov word ptr [bp-4], bx 0 00005B99 31D2 xor dx, dx 0 00005B9B 52 push dx 0 00005B9C 50 push ax 0 00005B9D FF742F push word ptr [si+47] 0 00005BA0 FF742D push word ptr [si+45] 0 00005BA3 E8[FEFF] call ___udivsi3 2954 _.LVL330: 989:fatfs.c **** if (relcluster < fnp->f_cluster_offset) 2955 .loc 1 989 0 0 00005BA6 C45EFC les bx, dword ptr [bp-4] 0 00005BA9 268A4F05 mov cl, byte ptr es:[bx+5] 0 00005BAD 895EFA mov word ptr [bp-6], bx 0 00005BB0 884EFC mov byte ptr [bp-4], cl 0 00005BB3 C646FD00 mov byte ptr [bp-3], 0 988:fatfs.c **** fnp->f_dpb->dpb_shftcnt); 2961 .loc 1 988 0 0 00005BB7 FF76FC push word ptr [bp-4] 0 00005BBA 52 push dx 0 00005BBB 50 push ax 0 00005BBC E8[FEFF] call ___lshrsi3 2966 _.LVL331: 0 00005BBF 97 xchg di, ax 0 00005BC0 8956FC mov word ptr [bp-4], dx 2969 _.LVL332: 990:fatfs.c **** { 2970 .loc 1 990 0 0 00005BC3 395433 cmp word ptr [si+51], dx 0 00005BC6 8B5EFA mov bx, word ptr [bp-6] 0 00005BC9 7707 ja _.L322 0 00005BCB 7524 jne _.L315 0 00005BCD 397C31 cmp word ptr [si+49], di 0 00005BD0 761F jbe _.L315 2977 _.L322: 995:fatfs.c **** getdstart(fnp->f_dpb, &fnp->f_dir); 2978 .loc 1 995 0 0 00005BD2 807C39FF cmp byte ptr [si+57], -1 0 00005BD6 752B jne _.L312 995:fatfs.c **** getdstart(fnp->f_dpb, &fnp->f_dir); 2981 .loc 1 995 0 is_stmt 0 discriminator 1 0 00005BD8 8B5C02 mov bx, word ptr [si+2] 0 00005BDB 8B470F mov ax, word ptr [bx+15] 2984 _.LVL333: 0 00005BDE 8B5711 mov dx, word ptr [bx+17] 2986 _.LVL334: 2987 _.L313: 995:fatfs.c **** getdstart(fnp->f_dpb, &fnp->f_dir); 2988 .loc 1 995 0 discriminator 4 0 00005BE1 894435 mov word ptr [si+53], ax 0 00005BE4 895437 mov word ptr [si+55], dx 997:fatfs.c **** } 2991 .loc 1 997 0 is_stmt 1 discriminator 4 0 00005BE7 C744310000 mov word ptr [si+49], 0 0 00005BEC C744330000 mov word ptr [si+51], 0 2994 _.L315: 1007:fatfs.c **** { 2995 .loc 1 1007 0 0 00005BF1 397C31 cmp word ptr [si+49], di 0 00005BF4 7523 jne _.L321 0 00005BF6 8B46FC mov ax, word ptr [bp-4] 0 00005BF9 394433 cmp word ptr [si+51], ax 0 00005BFC 751B jne _.L321 1037:fatfs.c **** } 3001 .loc 1 1037 0 0 00005BFE 31C0 xor ax, ax 0 00005C00 E962FF jmp _.L305 3004 _.LVL335: 3005 _.L312: 3006 _.LBB101: 3007 _.LBB102: 61:fatfs.c **** return dentry->dir_start; 3008 .loc 1 61 0 discriminator 2 0 00005C03 8E46FE mov es, word ptr [bp-2] 0 00005C06 26837F0F00 cmp word ptr es:[bx+15], 0 0 00005C0B 8B441E mov ax, word ptr [si+30] 3012 _.LVL336: 0 00005C0E 7404 je _.L314 62:fatfs.c **** return (((CLUSTER)dentry->dir_start_high << 16) | dentry->dir_start); 3014 .loc 1 62 0 0 00005C10 31D2 xor dx, dx 3016 _.LVL337: 0 00005C12 EBCD jmp _.L313 3018 _.LVL338: 3019 _.L314: 3020 _.LBB103: 3021 _.LBB104: 63:fatfs.c **** } 3022 .loc 1 63 0 0 00005C14 8B5418 mov dx, word ptr [si+24] 3024 _.LVL339: 0 00005C17 EBC8 jmp _.L313 3026 _.LVL340: 3027 _.L321: 3028 _.LBE104: 3029 _.LBE103: 3030 _.LBE102: 3031 _.LBE101: 1010:fatfs.c **** if (cluster <= 1) /* 1/error or 0/FREE chain into the void */ 3032 .loc 1 1010 0 0 00005C19 FF7437 push word ptr [si+55] 0 00005C1C FF7435 push word ptr [si+53] 0 00005C1F FF742B push word ptr [si+43] 0 00005C22 FF7429 push word ptr [si+41] 0 00005C25 E8[FEFF] call _next_cluster 3038 _.LVL341: 1011:fatfs.c **** return DE_SEEK; 3039 .loc 1 1011 0 0 00005C28 85D2 test dx, dx 0 00005C2A 7508 jne _.L323 0 00005C2C 83F801 cmp ax, 1 0 00005C2F 7703E92EFF jbe _.L316 3044 _.L323: 1018:fatfs.c **** { 3045 .loc 1 1018 0 0 00005C34 83F8FF cmp ax, -1 0 00005C37 7521 jne _.L318 0 00005C39 81FAFF0F cmp dx, 4095 0 00005C3D 751B jne _.L318 1020:fatfs.c **** return DE_SEEK; 3050 .loc 1 1020 0 0 00005C3F 837E0A01 cmp word ptr [bp+10], 1 0 00005C43 7503E91AFF je _.L316 1024:fatfs.c **** if (cluster == LONG_LAST_CLUSTER) 3053 .loc 1 1024 0 0 00005C48 56 push si 0 00005C49 E83CF2 call _extend 3056 _.LVL342: 1025:fatfs.c **** return DE_HNDLDSKFULL; 3057 .loc 1 1025 0 0 00005C4C 83F8FF cmp ax, -1 0 00005C4F 7509 jne _.L318 0 00005C51 81FAFF0F cmp dx, 4095 0 00005C55 7503E922FF je _.L319 3062 _.LVL343: 3063 _.L318: 1029:fatfs.c **** fnp->f_cluster_offset++; 3064 .loc 1 1029 0 0 00005C5A 894435 mov word ptr [si+53], ax 0 00005C5D 895437 mov word ptr [si+55], dx 1030:fatfs.c **** } 3067 .loc 1 1030 0 0 00005C60 8B4431 mov ax, word ptr [si+49] 3069 _.LVL344: 0 00005C63 8B5433 mov dx, word ptr [si+51] 3071 _.LVL345: 0 00005C66 83C001 add ax, 1 0 00005C69 83D200 adc dx, 0 0 00005C6C 894431 mov word ptr [si+49], ax 0 00005C6F 895433 mov word ptr [si+51], dx 0 00005C72 E97CFF jmp _.L315 3077 _.LFE35: 3078 .size _map_cluster, .-_map_cluster 3079 .global _rwblock 3080 .type _rwblock, @function 3081 _rwblock: 3082 _.LFB37: 1231:fatfs.c **** /* Translate the fd into an fnode pointer, since all internal */ 3083 .loc 1 1231 0 3084 _.LVL346: 0 00005C75 56 push si 0 00005C76 57 push di 0 00005C77 55 push bp 3088 _.LCFI68: 0 00005C78 89E5 mov bp, sp 3090 _.LCFI69: 0 00005C7A 83EC1E sub sp, 30 0 00005C7D C4460A les ax, dword ptr [bp+10] 0 00005C80 8946F8 mov word ptr [bp-8], ax 0 00005C83 8C46F6 mov word ptr [bp-10], es 1234:fatfs.c **** REG struct buffer FAR *bp; 3095 .loc 1 1234 0 0 00005C86 FF7608 push word ptr [bp+8] 0 00005C89 E845EF call _sft_to_fnode 3098 _.LVL347: 0 00005C8C 96 xchg si, ax 3100 _.LVL348: 1250:fatfs.c **** { 3101 .loc 1 1250 0 0 00005C8D 837E1002 cmp word ptr [bp+16], 2 0 00005C91 7403E9E905 jne _.L329 1252:fatfs.c **** /* mark file as modified and set date not valid any more */ 3104 .loc 1 1252 0 0 00005C96 36804C0F20 or byte ptr ss:[si+15], 32 1254:fatfs.c **** 3106 .loc 1 1254 0 0 00005C9B 368124BFBF and word ptr ss:[si], -16449 3108 _.LVL349: 3109 _.LBB114: 3110 _.LBB115: 1058:fatfs.c **** return SUCCESS; 3111 .loc 1 1058 0 0 00005CA0 8B442D mov ax, word ptr [si+45] 3113 _.LVL350: 0 00005CA3 8946FC mov word ptr [bp-4], ax 0 00005CA6 8B442F mov ax, word ptr [si+47] 0 00005CA9 8946FA mov word ptr [bp-6], ax 0 00005CAC 36394422 cmp word ptr ss:[si+34], ax 0 00005CB0 7211 jc _.L392 0 00005CB2 7403E9FA00 jne _.L330 0 00005CB7 8B46FC mov ax, word ptr [bp-4] 0 00005CBA 36394420 cmp word ptr ss:[si+32], ax 0 00005CBE 7203E9EE00 jnc _.L330 3123 _.L392: 3124 _.LVL351: 3125 _.LBB116: 1068:fatfs.c **** #ifdef WRITEZEROS 3126 .loc 1 1068 0 0 00005CC3 837E0E00 cmp word ptr [bp+14], 0 0 00005CC7 7403E9BA00 jne _.L385 1075:fatfs.c **** << fnp->f_dpb->dpb_shftcnt) - 1) 3129 .loc 1 1075 0 0 00005CCC 36C45C29 les bx, dword ptr ss:[si+41] 0 00005CD0 268B5702 mov dx, word ptr es:[bx+2] 1076:fatfs.c **** ) 3132 .loc 1 1076 0 0 00005CD4 268A4705 mov al, byte ptr es:[bx+5] 0 00005CD8 30E4 xor ah, ah 0 00005CDA 50 push ax 0 00005CDB FF760E push word ptr [bp+14] 0 00005CDE 52 push dx 0 00005CDF E8[FEFF] call ___ashlsi3 3139 _.LVL352: 0 00005CE2 91 xchg cx, ax 0 00005CE3 89D3 mov bx, dx 0 00005CE5 83C1FF add cx, -1 0 00005CE8 83D3FF adc bx, -1 1074:fatfs.c **** (((ULONG)fnp->f_dpb->dpb_secsize 3144 .loc 1 1074 0 0 00005CEB 234EFC and cx, word ptr [bp-4] 0 00005CEE 235EFA and bx, word ptr [bp-6] 1067:fatfs.c **** if (emptywrite 3147 .loc 1 1067 0 0 00005CF1 8B7E0E mov di, word ptr [bp+14] 1074:fatfs.c **** (((ULONG)fnp->f_dpb->dpb_secsize 3149 .loc 1 1074 0 0 00005CF4 09D9 or cx, bx 0 00005CF6 7515 jne _.L332 3152 _.LVL353: 1081:fatfs.c **** } 3153 .loc 1 1081 0 0 00005CF8 8B56FC mov dx, word ptr [bp-4] 0 00005CFB 83C2FF add dx, -1 0 00005CFE 8B46FA mov ax, word ptr [bp-6] 0 00005D01 83D0FF adc ax, -1 0 00005D04 89542D mov word ptr [si+45], dx 0 00005D07 89442F mov word ptr [si+47], ax 1080:fatfs.c **** -- fnp->f_offset; 3160 .loc 1 1080 0 0 00005D0A BF0100 mov di, 1 3162 _.LVL354: 3163 _.L332: 1083:fatfs.c **** if (special) ++ fnp->f_offset; 3164 .loc 1 1083 0 0 00005D0D B80200 mov ax, 2 0 00005D10 50 push ax 0 00005D11 56 push si 0 00005D12 E8[FEFF] call _map_cluster 3169 _.LVL355: 0 00005D15 85C0 test ax, ax 0 00005D17 7471 je _.L333 1084:fatfs.c **** if (fnp->f_cluster != FREE) { 3172 .loc 1 1084 0 0 00005D19 85FF test di, di 0 00005D1B 7412 je _.L334 0 00005D1D 8B442D mov ax, word ptr [si+45] 0 00005D20 8B542F mov dx, word ptr [si+47] 0 00005D23 83C001 add ax, 1 0 00005D26 83D200 adc dx, 0 0 00005D29 89442D mov word ptr [si+45], ax 0 00005D2C 89542F mov word ptr [si+47], dx 3181 _.L334: 1085:fatfs.c **** /* ecm: write size if couldn't satisfy full request, 3182 .loc 1 1085 0 0 00005D2F 8B4437 mov ax, word ptr [si+55] 0 00005D32 360B4435 or ax, word ptr ss:[si+53] 0 00005D36 7445 je _.L335 1092:fatfs.c **** << 3186 .loc 1 1092 0 0 00005D38 8B5C29 mov bx, word ptr [si+41] 1089:fatfs.c **** /* at 0 we have incremented to 1, having allocated the second 3188 .loc 1 1089 0 0 00005D3B 8B4C31 mov cx, word ptr [si+49] 0 00005D3E 8B4433 mov ax, word ptr [si+51] 0 00005D41 83C101 add cx, 1 0 00005D44 83D000 adc ax, 0 1092:fatfs.c **** << 3193 .loc 1 1092 0 0 00005D47 8E442B mov es, word ptr [si+43] 0 00005D4A 268B5702 mov dx, word ptr es:[bx+2] 0 00005D4E 8956FC mov word ptr [bp-4], dx 0 00005D51 F7E2 mul dx 0 00005D53 97 xchg di, ax 3199 _.LVL356: 0 00005D54 8B46FC mov ax, word ptr [bp-4] 0 00005D57 F7E1 mul cx 0 00005D59 8946FC mov word ptr [bp-4], ax 0 00005D5C 8956FE mov word ptr [bp-2], dx 0 00005D5F 01D7 add di, dx 1094:fatfs.c **** merge_file_changes(fnp, FALSE); 3205 .loc 1 1094 0 0 00005D61 8E442B mov es, word ptr [si+43] 0 00005D64 268A5705 mov dl, byte ptr es:[bx+5] 0 00005D68 30F6 xor dh, dh 1093:fatfs.c **** fnp->f_dpb->dpb_shftcnt; 3209 .loc 1 1093 0 0 00005D6A 52 push dx 0 00005D6B 57 push di 0 00005D6C 50 push ax 0 00005D6D E8[FEFF] call ___ashlsi3 3214 _.LVL357: 1088:fatfs.c **** (((ULONG)fnp->f_cluster_offset + 1) 3215 .loc 1 1088 0 0 00005D70 894420 mov word ptr [si+32], ax 0 00005D73 895422 mov word ptr [si+34], dx 1095:fatfs.c **** } 3218 .loc 1 1095 0 0 00005D76 31C0 xor ax, ax 0 00005D78 50 push ax 0 00005D79 56 push si 0 00005D7A E863F3 call _merge_file_changes 3223 _.LVL358: 3224 _.L335: 3225 _.LBE116: 3226 _.LBE115: 3227 _.LBE114: 1263:fatfs.c **** return 0; 3228 .loc 1 1263 0 0 00005D7D 56 push si 0 00005D7E E88EF2 call _fnode_to_sft 3231 _.LVL359: 1264:fatfs.c **** } 3232 .loc 1 1264 0 0 00005D81 31C0 xor ax, ax 0 00005D83 E9BC00 jmp _.L441 3235 _.LVL360: 3236 _.L385: 3237 _.LBB119: 3238 _.LBB118: 3239 _.LBB117: 1067:fatfs.c **** if (emptywrite 3240 .loc 1 1067 0 0 00005D86 31FF xor di, di 0 00005D88 EB83 jmp _.L332 3243 _.LVL361: 3244 _.L333: 1099:fatfs.c **** 3245 .loc 1 1099 0 0 00005D8A 85FF test di, di 0 00005D8C 7412 je _.L337 0 00005D8E 8B442D mov ax, word ptr [si+45] 0 00005D91 8B542F mov dx, word ptr [si+47] 0 00005D94 83C001 add ax, 1 0 00005D97 83D200 adc dx, 0 0 00005D9A 89442D mov word ptr [si+45], ax 0 00005D9D 89542F mov word ptr [si+47], dx 3254 _.L337: 1157:fatfs.c **** merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */ 3255 .loc 1 1157 0 0 00005DA0 36C4442D les ax, dword ptr ss:[si+45] 0 00005DA4 894420 mov word ptr [si+32], ax 0 00005DA7 8C4422 mov word ptr [si+34], es 1158:fatfs.c **** } 3259 .loc 1 1158 0 0 00005DAA 31C0 xor ax, ax 0 00005DAC 50 push ax 0 00005DAD 56 push si 0 00005DAE E82FF3 call _merge_file_changes 3264 _.LVL362: 3265 _.L330: 3266 _.LBE117: 3267 _.LBE118: 3268 _.LBE119: 1284:fatfs.c **** { 3269 .loc 1 1284 0 0 00005DB1 837E0E00 cmp word ptr [bp+14], 0 0 00005DB5 7503E99200 je _.L382 1303:fatfs.c **** { 3272 .loc 1 1303 0 0 00005DBA 8B4C2D mov cx, word ptr [si+45] 0 00005DBD 8B5C2F mov bx, word ptr [si+47] 0 00005DC0 8B460E mov ax, word ptr [bp+14] 0 00005DC3 31D2 xor dx, dx 0 00005DC5 01C8 add ax, cx 0 00005DC7 11DA adc dx, bx 1305:fatfs.c **** { 3279 .loc 1 1305 0 0 00005DC9 39D3 cmp bx, dx 0 00005DCB 7603E9A904 ja _.L389 0 00005DD0 7507 jne _.L395 0 00005DD2 39C1 cmp cx, ax 0 00005DD4 7603E9A004 ja _.L389 3285 _.L395: 0 00005DD9 C646E901 mov byte ptr [bp-23], 1 3287 _.LVL363: 3288 _.L384: 1320:fatfs.c **** 3289 .loc 1 1320 0 0 00005DDD 36C45C29 les bx, dword ptr ss:[si+41] 0 00005DE1 268B4702 mov ax, word ptr es:[bx+2] 0 00005DE5 8946FC mov word ptr [bp-4], ax 3293 _.LVL364: 1323:fatfs.c **** 3294 .loc 1 1323 0 0 00005DE8 FF76F6 push word ptr [bp-10] 0 00005DEB FF76F8 push word ptr [bp-8] 0 00005DEE E8[FEFF] call _adjust_far 3298 _.LVL365: 0 00005DF1 8946F0 mov word ptr [bp-16], ax 0 00005DF4 8956EE mov word ptr [bp-18], dx 3301 _.LVL366: 0 00005DF7 837E1001 cmp word ptr [bp+16], 1 0 00005DFB 7403E95D01 jne _.L353 0 00005E00 C746E20200 mov word ptr [bp-30], 2 3305 _.L354: 1327:fatfs.c **** { 3306 .loc 1 1327 0 0 00005E05 8B460E mov ax, word ptr [bp+14] 3308 _.LVL367: 0 00005E08 8946F8 mov word ptr [bp-8], ax 1237:fatfs.c **** unsigned secsize; 3310 .loc 1 1237 0 0 00005E0B C746FA0000 mov word ptr [bp-6], 0 3312 _.LVL368: 3313 _.L355: 1327:fatfs.c **** { 3314 .loc 1 1327 0 0 00005E10 8B46FA mov ax, word ptr [bp-6] 0 00005E13 3B460E cmp ax, word ptr [bp+14] 0 00005E16 7323 jnc _.L442 3318 _.LBB120: 1332:fatfs.c **** { 3319 .loc 1 1332 0 0 00005E18 837E1001 cmp word ptr [bp+16], 1 0 00005E1C 7403E94401 jne _.L356 1332:fatfs.c **** { 3322 .loc 1 1332 0 is_stmt 0 discriminator 1 0 00005E21 8B4422 mov ax, word ptr [si+34] 0 00005E24 363B442F cmp ax, word ptr ss:[si+47] 0 00005E28 7603E93801 ja _.L356 0 00005E2D 750C jne _.L442 0 00005E2F 8B4420 mov ax, word ptr [si+32] 0 00005E32 363B442D cmp ax, word ptr ss:[si+45] 0 00005E36 7603E92A01 ja _.L356 3330 _.L442: 3331 _.LBE120: 1514:fatfs.c **** return ret_cnt; 3332 .loc 1 1514 0 is_stmt 1 0 00005E3B 56 push si 0 00005E3C E8D0F1 call _fnode_to_sft 3335 _.LVL369: 1515:fatfs.c **** } 3336 .loc 1 1515 0 0 00005E3F 8B46FA mov ax, word ptr [bp-6] 3338 _.LVL370: 3339 _.L441: 0 00005E42 31D2 xor dx, dx 3341 _.L328: 1516:fatfs.c **** 3342 .loc 1 1516 0 0 00005E44 89EC mov sp, bp 0 00005E46 5D pop bp 0 00005E47 5F pop di 0 00005E48 5E pop si 3347 _.LVL371: 0 00005E49 C20A00 ret 10 3349 _.LVL372: 3350 _.L382: 1292:fatfs.c **** if (shrink_file(fnp) < 0) /* this is the only call to shrink_file... */ 3351 .loc 1 1292 0 0 00005E4C 8B442D mov ax, word ptr [si+45] 0 00005E4F 8946FC mov word ptr [bp-4], ax 0 00005E52 8B7C2F mov di, word ptr [si+47] 0 00005E55 894420 mov word ptr [si+32], ax 0 00005E58 897C22 mov word ptr [si+34], di 3357 _.LVL373: 3358 _.LBB123: 3359 _.LBB124: 1863:fatfs.c **** 1864:fatfs.c **** /* TE 1865:fatfs.c **** if the current filesize in FAT is larger then the dir_size 1866:fatfs.c **** it's truncated here. 1867:fatfs.c **** the BUG was: 1868:fatfs.c **** copy COMMAND.COM xxx 1869:fatfs.c **** echo >xxx 1870:fatfs.c **** 1871:fatfs.c **** then, the dirsize of xxx was set to ~20, but the allocated 1872:fatfs.c **** FAT entries not returned. 1873:fatfs.c **** this code corrects this 1874:fatfs.c **** 1875:fatfs.c **** Unfortunately, this code _nearly_ works, but fails one of the 1876:fatfs.c **** Apps tested (VB ISAM); BO: confirmation??? 1877:fatfs.c **** */ 1878:fatfs.c **** 1879:fatfs.c **** STATIC int shrink_file(f_node_ptr fnp) 1880:fatfs.c **** { 1881:fatfs.c **** 1882:fatfs.c **** ULONG lastoffset = fnp->f_offset; /* has to be saved */ 1883:fatfs.c **** CLUSTER last, next, st; 1884:fatfs.c **** struct dpb FAR *dpbp = fnp->f_dpb; 3360 .loc 1 1884 0 0 00005E5B 36C44429 les ax, dword ptr ss:[si+41] 3362 _.LVL374: 0 00005E5F 8946FA mov word ptr [bp-6], ax 0 00005E62 8C46F8 mov word ptr [bp-8], es 3365 _.LVL375: 1885:fatfs.c **** int ret = DE_ACCESS; 1886:fatfs.c **** 1887:fatfs.c **** if (fnp->f_offset) 3366 .loc 1 1887 0 0 00005E65 8B46FC mov ax, word ptr [bp-4] 3368 _.LVL376: 0 00005E68 09F8 or ax, di 0 00005E6A 7438 je _.L339 1888:fatfs.c **** fnp->f_offset--; /* last existing cluster */ 3371 .loc 1 1888 0 0 00005E6C 8B56FC mov dx, word ptr [bp-4] 0 00005E6F 83C2FF add dx, -1 0 00005E72 89F8 mov ax, di 0 00005E74 83D0FF adc ax, -1 0 00005E77 89542D mov word ptr [si+45], dx 0 00005E7A 89442F mov word ptr [si+47], ax 3378 _.L341: 1889:fatfs.c **** else if (fnp->f_cluster == FREE) 1890:fatfs.c **** /* zero offset, 0-byte file: nothing to do ! */ 1891:fatfs.c **** goto done_success; 1892:fatfs.c **** 1893:fatfs.c **** if (map_cluster(fnp, XFR_READ) != SUCCESS) /* error, don't truncate */ 3379 .loc 1 1893 0 0 00005E7D B80100 mov ax, 1 0 00005E80 50 push ax 0 00005E81 56 push si 0 00005E82 E8[FEFF] call _map_cluster 3384 _.LVL377: 0 00005E85 85C0 test ax, ax 0 00005E87 7428 je _.L344 3387 _.L346: 1885:fatfs.c **** 3388 .loc 1 1885 0 0 00005E89 B8FBFF mov ax, -5 3390 _.L345: 3391 _.LVL378: 1894:fatfs.c **** goto done; 1895:fatfs.c **** 1896:fatfs.c **** st = fnp->f_cluster; 1897:fatfs.c **** 1898:fatfs.c **** next = next_cluster(dpbp, st); /* return nr. of 1st cluster after new end */ 1899:fatfs.c **** 1900:fatfs.c **** if (next <= 1) /* 1/error or 0/FREE chain points into the void */ 1901:fatfs.c **** goto done; 1902:fatfs.c **** 1903:fatfs.c **** /* Loop from start until either a FREE entry is */ 1904:fatfs.c **** /* encountered (due to a damaged file system) or the */ 1905:fatfs.c **** /* last cluster is encountered. */ 1906:fatfs.c **** /* zap the FAT pointed to */ 1907:fatfs.c **** 1908:fatfs.c **** if (fnp->f_dir.dir_size == 0) /* file shrinks to size 0 */ 1909:fatfs.c **** { 1910:fatfs.c **** fnp->f_cluster = FREE; 1911:fatfs.c **** setdstart(dpbp, &fnp->f_dir, FREE); /* file no longer has start cluster */ 1912:fatfs.c **** last = FREE; 1913:fatfs.c **** } 1914:fatfs.c **** else 1915:fatfs.c **** { 1916:fatfs.c **** if (next == LONG_LAST_CLUSTER) /* nothing to do, file already ends here */ 1917:fatfs.c **** goto done_success; 1918:fatfs.c **** last = LONG_LAST_CLUSTER; /* make file end */ 1919:fatfs.c **** } 1920:fatfs.c **** if (link_fat(dpbp, st, last) != SUCCESS) 1921:fatfs.c **** goto done; /* do not wipe remainder of chain if FAT is broken */ 1922:fatfs.c **** 1923:fatfs.c **** wipe_out_clusters(dpbp, next); /* free clusters after the end */ 1924:fatfs.c **** /* flush buffers, make sure disk is updated */ 1925:fatfs.c **** if (!flush_buffers(fnp->f_dpb->dpb_unit)) 1926:fatfs.c **** goto done; 1927:fatfs.c **** 1928:fatfs.c **** done_success: 1929:fatfs.c **** ret = SUCCESS; 1930:fatfs.c **** 1931:fatfs.c **** done: 1932:fatfs.c **** fnp->f_offset = lastoffset; /* has to be restored */ 3392 .loc 1 1932 0 0 00005E8C 8B56FC mov dx, word ptr [bp-4] 0 00005E8F 89542D mov word ptr [si+45], dx 0 00005E92 897C2F mov word ptr [si+47], di 3396 _.LVL379: 3397 _.LBE124: 3398 _.LBE123: 1293:fatfs.c **** return DE_ACCESS; 3399 .loc 1 1293 0 0 00005E95 85C0 test ax, ax 0 00005E97 7503E9E1FE je _.L335 3402 _.LVL380: 3403 _.L388: 1294:fatfs.c **** /* why does empty write -always- truncate to current offset? */ 3404 .loc 1 1294 0 0 00005E9C B8FBFF mov ax, -5 3406 _.L440: 1309:fatfs.c **** #else 3407 .loc 1 1309 0 0 00005E9F BAFFFF mov dx, -1 0 00005EA2 EBA0 jmp _.L328 3410 _.LVL381: 3411 _.L339: 3412 _.LBB130: 3413 _.LBB129: 1889:fatfs.c **** /* zero offset, 0-byte file: nothing to do ! */ 3414 .loc 1 1889 0 0 00005EA4 8B4437 mov ax, word ptr [si+55] 0 00005EA7 360B4435 or ax, word ptr ss:[si+53] 0 00005EAB 75D0 jne _.L341 3418 _.LVL382: 3419 _.L342: 1929:fatfs.c **** 3420 .loc 1 1929 0 0 00005EAD 31C0 xor ax, ax 0 00005EAF EBDB jmp _.L345 3423 _.L344: 1896:fatfs.c **** 3424 .loc 1 1896 0 0 00005EB1 8B4435 mov ax, word ptr [si+53] 0 00005EB4 8946F2 mov word ptr [bp-14], ax 0 00005EB7 8E4437 mov es, word ptr [si+55] 3428 _.LVL383: 1898:fatfs.c **** 3429 .loc 1 1898 0 0 00005EBA 06 push es 0 00005EBB 8C46F4 mov word ptr [bp-12], es 0 00005EBE 50 push ax 0 00005EBF FF76F8 push word ptr [bp-8] 0 00005EC2 FF76FA push word ptr [bp-6] 0 00005EC5 E8[FEFF] call _next_cluster 3436 _.LVL384: 0 00005EC8 8946F6 mov word ptr [bp-10], ax 0 00005ECB 89D1 mov cx, dx 3439 _.LVL385: 1900:fatfs.c **** goto done; 3440 .loc 1 1900 0 0 00005ECD 85D2 test dx, dx 0 00005ECF 8E46F4 mov es, word ptr [bp-12] 0 00005ED2 7505 jne _.L393 0 00005ED4 83F801 cmp ax, 1 0 00005ED7 76B0 jbe _.L346 3446 _.L393: 1908:fatfs.c **** { 3447 .loc 1 1908 0 0 00005ED9 8B4422 mov ax, word ptr [si+34] 3449 _.LVL386: 0 00005EDC 360B4420 or ax, word ptr ss:[si+32] 0 00005EE0 7561 jne _.L348 1910:fatfs.c **** setdstart(dpbp, &fnp->f_dir, FREE); /* file no longer has start cluster */ 3452 .loc 1 1910 0 0 00005EE2 894435 mov word ptr [si+53], ax 0 00005EE5 894437 mov word ptr [si+55], ax 3455 _.LVL387: 3456 _.LBB125: 3457 _.LBB126: 68:fatfs.c **** if (ISFAT32(dpbp)) 3458 .loc 1 68 0 0 00005EE8 89441E mov word ptr [si+30], ax 3460 _.LBE126: 3461 _.LBE125: 1912:fatfs.c **** } 3462 .loc 1 1912 0 0 00005EEB 89C2 mov dx, ax 0 00005EED 8946F4 mov word ptr [bp-12], ax 3465 _.LVL388: 3466 _.LBB128: 3467 _.LBB127: 69:fatfs.c **** dentry->dir_start_high = (UWORD)(value >> 16); 3468 .loc 1 69 0 0 00005EF0 8E5EF8 mov ds, word ptr [bp-8] 0 00005EF3 8B5EFA mov bx, word ptr [bp-6] 0 00005EF6 837F0F00 cmp word ptr [bx+15], 0 0 00005EFA 7504 jne _.L349 70:fatfs.c **** } 3473 .loc 1 70 0 0 00005EFC 36894418 mov word ptr ss:[si+24], ax 3475 _.LVL389: 3476 _.L349: 0 00005F00 894EF0 mov word ptr [bp-16], cx 3478 _.LVL390: 3479 _.LBE127: 3480 _.LBE128: 1920:fatfs.c **** goto done; /* do not wipe remainder of chain if FAT is broken */ 3481 .loc 1 1920 0 0 00005F03 FF76F4 push word ptr [bp-12] 0 00005F06 52 push dx 0 00005F07 06 push es 0 00005F08 FF76F2 push word ptr [bp-14] 0 00005F0B FF76F8 push word ptr [bp-8] 0 00005F0E FF76FA push word ptr [bp-6] 0 00005F11 16 push ss 0 00005F12 1F pop ds 0 00005F13 E8[FEFF] call _link_fat 3491 _.LVL391: 0 00005F16 09D0 or ax, dx 0 00005F18 7403E96CFF jne _.L346 1923:fatfs.c **** /* flush buffers, make sure disk is updated */ 3494 .loc 1 1923 0 0 00005F1D 8B4EF0 mov cx, word ptr [bp-16] 0 00005F20 51 push cx 0 00005F21 FF76F6 push word ptr [bp-10] 0 00005F24 FF76F8 push word ptr [bp-8] 0 00005F27 FF76FA push word ptr [bp-6] 0 00005F2A E8B0ED call _wipe_out_clusters 3501 _.LVL392: 1925:fatfs.c **** goto done; 3502 .loc 1 1925 0 0 00005F2D 36C45C29 les bx, dword ptr ss:[si+41] 0 00005F31 268A07 mov al, byte ptr es:[bx] 0 00005F34 98 cbw 0 00005F35 50 push ax 0 00005F36 E8[FEFF] call _flush_buffers 3508 _.LVL393: 0 00005F39 85C0 test ax, ax 0 00005F3B 7403E96DFF jne _.L342 0 00005F40 E946FF jmp _.L346 3512 _.LVL394: 3513 _.L348: 1916:fatfs.c **** goto done_success; 3514 .loc 1 1916 0 0 00005F43 837EF6FF cmp word ptr [bp-10], -1 0 00005F47 7509 jne _.L394 0 00005F49 81F9FF0F cmp cx, 4095 0 00005F4D 7503E95BFF je _.L342 3519 _.L394: 1918:fatfs.c **** } 3520 .loc 1 1918 0 0 00005F52 BAFFFF mov dx, -1 0 00005F55 B8FF0F mov ax, 4095 0 00005F58 8946F4 mov word ptr [bp-12], ax 3524 _.LVL395: 0 00005F5B EBA3 jmp _.L349 3526 _.LVL396: 3527 _.L353: 0 00005F5D C746E20100 mov word ptr [bp-30], 1 0 00005F62 E9A0FE jmp _.L354 3530 _.LVL397: 3531 _.L356: 3532 _.LBE129: 3533 _.LBE130: 3534 _.LBB131: 1363:fatfs.c **** { 3535 .loc 1 1363 0 0 00005F65 FF7610 push word ptr [bp+16] 0 00005F68 56 push si 0 00005F69 E8[FEFF] call _map_cluster 3539 _.LVL398: 0 00005F6C 85C0 test ax, ax 0 00005F6E 7403E9C8FE jne _.L442 1368:fatfs.c **** { 3542 .loc 1 1368 0 0 00005F73 807EE900 cmp byte ptr [bp-23], 0 0 00005F77 7405 je _.L359 1370:fatfs.c **** } 3545 .loc 1 1370 0 0 00005F79 50 push ax 0 00005F7A 56 push si 0 00005F7B E862F1 call _merge_file_changes 3549 _.LVL399: 3550 _.L359: 1375:fatfs.c **** boff = (UWORD)(fnp->f_offset % secsize); 3551 .loc 1 1375 0 0 00005F7E 8B5C2D mov bx, word ptr [si+45] 0 00005F81 8B442F mov ax, word ptr [si+47] 0 00005F84 8946F4 mov word ptr [bp-12], ax 0 00005F87 8B7C29 mov di, word ptr [si+41] 0 00005F8A 8B442B mov ax, word ptr [si+43] 0 00005F8D 8946E6 mov word ptr [bp-26], ax 0 00005F90 8EC0 mov es, ax 0 00005F92 268A4504 mov al, byte ptr es:[di+4] 0 00005F96 8846E8 mov byte ptr [bp-24], al 0 00005F99 31C0 xor ax, ax 0 00005F9B 50 push ax 0 00005F9C FF76FC push word ptr [bp-4] 0 00005F9F FF76F4 push word ptr [bp-12] 0 00005FA2 53 push bx 0 00005FA3 895EF6 mov word ptr [bp-10], bx 0 00005FA6 E8[FEFF] call ___udivsi3 3568 _.LVL400: 0 00005FA9 2246E8 and al, byte ptr [bp-24] 0 00005FAC 8846E5 mov byte ptr [bp-27], al 3571 _.LVL401: 1376:fatfs.c **** 3572 .loc 1 1376 0 0 00005FAF 31C0 xor ax, ax 3574 _.LVL402: 0 00005FB1 50 push ax 0 00005FB2 FF76FC push word ptr [bp-4] 0 00005FB5 FF76F4 push word ptr [bp-12] 0 00005FB8 8B5EF6 mov bx, word ptr [bp-10] 0 00005FBB 53 push bx 0 00005FBC E8[FEFF] call ___umodsi3 3581 _.LVL403: 0 00005FBF 8946F2 mov word ptr [bp-14], ax 3583 _.LVL404: 1378:fatfs.c **** 3584 .loc 1 1378 0 0 00005FC2 FF76E6 push word ptr [bp-26] 0 00005FC5 57 push di 0 00005FC6 36FF7437 push word ptr ss:[si+55] 0 00005FCA 36FF7435 push word ptr ss:[si+53] 0 00005FCE E8[FEFF] call _clus2phys 3590 _.LVL405: 0 00005FD1 89C1 mov cx, ax 0 00005FD3 89D3 mov bx, dx 0 00005FD5 8A46E5 mov al, byte ptr [bp-27] 0 00005FD8 30E4 xor ah, ah 0 00005FDA 31D2 xor dx, dx 0 00005FDC 01C8 add ax, cx 0 00005FDE 8946EC mov word ptr [bp-20], ax 0 00005FE1 11DA adc dx, bx 0 00005FE3 8956EA mov word ptr [bp-22], dx 3600 _.LVL406: 1382:fatfs.c **** { 3601 .loc 1 1382 0 0 00005FE6 837EF200 cmp word ptr [bp-14], 0 0 00005FEA 7403E94C01 jne _.L360 3604 _.LBB121: 1387:fatfs.c **** sectors_wanted = to_xfer; 3605 .loc 1 1387 0 0 00005FEF 8B5EF6 mov bx, word ptr [bp-10] 0 00005FF2 891E[0000] mov word ptr [_startoffset.2547], bx 0 00005FF6 8B46F4 mov ax, word ptr [bp-12] 3609 _.LVL407: 0 00005FF9 A3[0200] mov word ptr [_startoffset.2547+2], ax 3611 _.LVL408: 1388:fatfs.c **** 3612 .loc 1 1388 0 0 00005FFC 8B46F8 mov ax, word ptr [bp-8] 1391:fatfs.c **** sectors_wanted = (UCOUNT)(fnp->f_dir.dir_size - fnp->f_offset); 3614 .loc 1 1391 0 0 00005FFF 837E1001 cmp word ptr [bp+16], 1 0 00006003 751B jne _.L361 1391:fatfs.c **** sectors_wanted = (UCOUNT)(fnp->f_dir.dir_size - fnp->f_offset); 3617 .loc 1 1391 0 is_stmt 0 discriminator 1 0 00006005 8B4420 mov ax, word ptr [si+32] 0 00006008 8B5422 mov dx, word ptr [si+34] 3620 _.LVL409: 0 0000600B 91 xchg cx, ax 0 0000600C 29D9 sub cx, bx 0 0000600E 1B56F4 sbb dx, word ptr [bp-12] 0 00006011 3956F2 cmp word ptr [bp-14], dx 0 00006014 7507 jne _.L391 1392:fatfs.c **** 3626 .loc 1 1392 0 is_stmt 1 discriminator 1 0 00006016 89C8 mov ax, cx 1391:fatfs.c **** sectors_wanted = (UCOUNT)(fnp->f_dir.dir_size - fnp->f_offset); 3628 .loc 1 1391 0 discriminator 1 0 00006018 394EF8 cmp word ptr [bp-8], cx 0 0000601B 7703 ja _.L361 3631 _.L391: 1388:fatfs.c **** 3632 .loc 1 1388 0 0 0000601D 8B46F8 mov ax, word ptr [bp-8] 3634 _.L361: 3635 _.LVL410: 1394:fatfs.c **** 3636 .loc 1 1394 0 0 00006020 31D2 xor dx, dx 0 00006022 F776FC div word ptr [bp-4] 3639 _.LVL411: 0 00006025 8946F6 mov word ptr [bp-10], ax 3641 _.LVL412: 1396:fatfs.c **** goto normal_xfer; 3642 .loc 1 1396 0 0 00006028 85C0 test ax, ax 0 0000602A 7503E90C01 je _.L360 1399:fatfs.c **** 3645 .loc 1 1399 0 0 0000602F 8A46E8 mov al, byte ptr [bp-24] 3647 _.LVL413: 0 00006032 30E4 xor ah, ah 0 00006034 40 inc ax 3650 _.LBE121: 1375:fatfs.c **** boff = (UWORD)(fnp->f_offset % secsize); 3651 .loc 1 1375 0 0 00006035 8A56E5 mov dl, byte ptr [bp-27] 0 00006038 30F6 xor dh, dh 3654 _.LBB122: 1399:fatfs.c **** 3655 .loc 1 1399 0 0 0000603A 29D0 sub ax, dx 3657 _.LVL414: 1401:fatfs.c **** 3658 .loc 1 1401 0 0 0000603C 8B7EF6 mov di, word ptr [bp-10] 0 0000603F 39C7 cmp di, ax 0 00006041 7601 jbe _.L363 0 00006043 97 xchg di, ax 3663 _.L363: 3664 _.LVL415: 1403:fatfs.c **** 3665 .loc 1 1403 0 0 00006044 8B46FC mov ax, word ptr [bp-4] 0 00006047 F7E7 mul di 0 00006049 01D8 add ax, bx 0 0000604B BA0000 mov dx, 0 0 0000604E 1356F4 adc dx, word ptr [bp-12] 0 00006051 89442D mov word ptr [si+45], ax 0 00006054 89542F mov word ptr [si+47], dx 3673 _.LVL416: 3674 _.L364: 1405:fatfs.c **** { 3675 .loc 1 1405 0 0 00006057 3B7EF6 cmp di, word ptr [bp-10] 0 0000605A 730B jnc _.L368 1407:fatfs.c **** break; 3678 .loc 1 1407 0 0 0000605C FF7610 push word ptr [bp+16] 0 0000605F 56 push si 0 00006060 E8[FEFF] call _map_cluster 3682 _.LVL417: 0 00006063 85C0 test ax, ax 0 00006065 7468 je _.L365 3685 _.L368: 1422:fatfs.c **** 3686 .loc 1 1422 0 0 00006067 8B46FC mov ax, word ptr [bp-4] 0 0000606A F7E7 mul di 0 0000606C 8946F6 mov word ptr [bp-10], ax 3690 _.LVL418: 1426:fatfs.c **** currentblock + sectors_to_xfer - 1, 3691 .loc 1 1426 0 0 0000606F FF7610 push word ptr [bp+16] 0 00006072 36C45C29 les bx, dword ptr ss:[si+41] 0 00006076 268A07 mov al, byte ptr es:[bx] 3695 _.LVL419: 0 00006079 98 cbw 0 0000607A 50 push ax 0 0000607B 8B46EC mov ax, word ptr [bp-20] 0 0000607E 83C0FF add ax, -1 0 00006081 8B56EA mov dx, word ptr [bp-22] 0 00006084 83D2FF adc dx, -1 0 00006087 01F8 add ax, di 0 00006089 83D200 adc dx, 0 0 0000608C 52 push dx 0 0000608D 50 push ax 0 0000608E FF76EA push word ptr [bp-22] 0 00006091 FF76EC push word ptr [bp-20] 0 00006094 E8[FEFF] call _DeleteBlockInBufferCache 3709 _.LVL420: 1430:fatfs.c **** currentblock, 3710 .loc 1 1430 0 0 00006097 FF76E2 push word ptr [bp-30] 0 0000609A 57 push di 0 0000609B FF76EE push word ptr [bp-18] 0 0000609E FF76F0 push word ptr [bp-16] 0 000060A1 FF76EA push word ptr [bp-22] 0 000060A4 FF76EC push word ptr [bp-20] 0 000060A7 36C45C29 les bx, dword ptr ss:[si+41] 0 000060AB 268A07 mov al, byte ptr es:[bx] 0 000060AE 98 cbw 0 000060AF 50 push ax 0 000060B0 E8[FEFF] call _dskxfer 3722 _.LVL421: 0 000060B3 85C0 test ax, ax 0 000060B5 8B5EF6 mov bx, word ptr [bp-10] 0 000060B8 7503E97701 je _.L367 1435:fatfs.c **** fnode_to_sft(fnp); 3726 .loc 1 1435 0 0 000060BD 36C406[0000] les ax, dword ptr ss:[_startoffset.2547] 0 000060C2 89442D mov word ptr [si+45], ax 0 000060C5 8C442F mov word ptr [si+47], es 1436:fatfs.c **** return DE_ACCESS; 3730 .loc 1 1436 0 0 000060C8 56 push si 0 000060C9 E843EF call _fnode_to_sft 3733 _.LVL422: 0 000060CC E9CDFD jmp _.L388 3735 _.LVL423: 3736 _.L365: 0 000060CF 8946E6 mov word ptr [bp-26], ax 1410:fatfs.c **** currentblock + sectors_to_xfer) 3738 .loc 1 1410 0 0 000060D2 8B4429 mov ax, word ptr [si+41] 0 000060D5 8946F4 mov word ptr [bp-12], ax 0 000060D8 8B442B mov ax, word ptr [si+43] 0 000060DB 8946F2 mov word ptr [bp-14], ax 0 000060DE 50 push ax 0 000060DF FF76F4 push word ptr [bp-12] 0 000060E2 36FF7437 push word ptr ss:[si+55] 0 000060E6 36FF7435 push word ptr ss:[si+53] 0 000060EA E8[FEFF] call _clus2phys 3748 _.LVL424: 1411:fatfs.c **** break; 3749 .loc 1 1411 0 0 000060ED 89F9 mov cx, di 0 000060EF 8B5EE6 mov bx, word ptr [bp-26] 0 000060F2 034EEC add cx, word ptr [bp-20] 0 000060F5 135EEA adc bx, word ptr [bp-22] 1410:fatfs.c **** currentblock + sectors_to_xfer) 3754 .loc 1 1410 0 0 000060F8 39C8 cmp ax, cx 0 000060FA 7403E968FF jne _.L368 0 000060FF 39DA cmp dx, bx 0 00006101 7403E961FF jne _.L368 1414:fatfs.c **** 3759 .loc 1 1414 0 0 00006106 8E46F2 mov es, word ptr [bp-14] 0 00006109 8B5EF4 mov bx, word ptr [bp-12] 0 0000610C 268A5F04 mov bl, byte ptr es:[bx+4] 0 00006110 30FF xor bh, bh 0 00006112 8D5901 lea bx, [1+bx+di] 3765 _.LVL425: 1416:fatfs.c **** 3766 .loc 1 1416 0 0 00006115 8B7EF6 mov di, word ptr [bp-10] 0 00006118 39DF cmp di, bx 0 0000611A 7602 jbe _.L369 0 0000611C 89DF mov di, bx 3771 _.L369: 3772 _.LVL426: 1418:fatfs.c **** 3773 .loc 1 1418 0 0 0000611E 8B46FC mov ax, word ptr [bp-4] 0 00006121 F7E7 mul di 0 00006123 8B16[0000] mov dx, word ptr [_startoffset.2547] 0 00006127 8B0E[0200] mov cx, word ptr [_startoffset.2547+2] 0 0000612B 01C2 add dx, ax 0 0000612D B80000 mov ax, 0 0 00006130 11C1 adc cx, ax 0 00006132 89542D mov word ptr [si+45], dx 0 00006135 894C2F mov word ptr [si+47], cx 0 00006138 E91CFF jmp _.L364 3784 _.LVL427: 3785 _.L360: 3786 _.LDL1: 3787 _.LBE122: 1452:fatfs.c **** /*clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector */ 3788 .loc 1 1452 0 0 0000613B 31C0 xor ax, ax 0 0000613D 50 push ax 0 0000613E 8E46E6 mov es, word ptr [bp-26] 0 00006141 268A05 mov al, byte ptr es:[di] 0 00006144 98 cbw 0 00006145 50 push ax 0 00006146 FF76EA push word ptr [bp-22] 0 00006149 FF76EC push word ptr [bp-20] 0 0000614C E8[FEFF] call _getblk 3798 _.LVL428: 1459:fatfs.c **** { 3799 .loc 1 1459 0 0 0000614F 89C7 mov di, ax 0 00006151 09D0 or ax, dx 0 00006153 8946F6 mov word ptr [bp-10], ax 0 00006156 7503E9E0FC je _.L442 1470:fatfs.c **** if (mode == XFR_READ) 3804 .loc 1 1470 0 0 0000615B 8B5EFC mov bx, word ptr [bp-4] 0 0000615E 2B5EF2 sub bx, word ptr [bp-14] 0 00006161 3B5EF8 cmp bx, word ptr [bp-8] 0 00006164 7603 jbe _.L372 0 00006166 8B5EF8 mov bx, word ptr [bp-8] 3810 _.L372: 3811 _.LVL429: 1471:fatfs.c **** xfr_cnt = (UWORD) min(xfr_cnt, fnp->f_dir.dir_size - fnp->f_offset); 3812 .loc 1 1471 0 0 00006169 837E1001 cmp word ptr [bp+16], 1 0 0000616D 7578 jne _.L373 1472:fatfs.c **** 3815 .loc 1 1472 0 0 0000616F 8B4C20 mov cx, word ptr [si+32] 0 00006172 8B4422 mov ax, word ptr [si+34] 0 00006175 8946F4 mov word ptr [bp-12], ax 0 00006178 36C4442D les ax, dword ptr ss:[si+45] 0 0000617C 8946F6 mov word ptr [bp-10], ax 0 0000617F 8C46EC mov word ptr [bp-20], es 3822 _.LVL430: 0 00006182 89C8 mov ax, cx 0 00006184 2B46F6 sub ax, word ptr [bp-10] 0 00006187 8946EA mov word ptr [bp-22], ax 0 0000618A 8B46F4 mov ax, word ptr [bp-12] 0 0000618D 1B46EC sbb ax, word ptr [bp-20] 0 00006190 85C0 test ax, ax 0 00006192 770C ja _.L374 0 00006194 7505 jne _.L398 0 00006196 395EEA cmp word ptr [bp-22], bx 0 00006199 7705 ja _.L374 3833 _.L398: 1472:fatfs.c **** 3834 .loc 1 1472 0 is_stmt 0 discriminator 1 0 0000619B 2B4EF6 sub cx, word ptr [bp-10] 0 0000619E 89CB mov bx, cx 3837 _.LVL431: 3838 _.L374: 1486:fatfs.c **** } 3839 .loc 1 1486 0 is_stmt 1 0 000061A0 53 push bx 0 000061A1 895EF4 mov word ptr [bp-12], bx 0 000061A4 8B5EF2 mov bx, word ptr [bp-14] 3843 _.LVL432: 0 000061A7 8D4114 lea ax, [20+bx+di] 0 000061AA 52 push dx 0 000061AB 8956F6 mov word ptr [bp-10], dx 0 000061AE 50 push ax 0 000061AF FF76EE push word ptr [bp-18] 0 000061B2 FF76F0 push word ptr [bp-16] 0 000061B5 E8[FEFF] call _fmemcpy 3851 _.LVL433: 1492:fatfs.c **** (mode == XFR_READ && fnp->f_offset + xfr_cnt == fnp->f_dir.dir_size)) 3852 .loc 1 1492 0 0 000061B8 8B5EF4 mov bx, word ptr [bp-12] 0 000061BB 81FB0002 cmp bx, 512 0 000061BF 8B56F6 mov dx, word ptr [bp-10] 0 000061C2 7454 je _.L376 1492:fatfs.c **** (mode == XFR_READ && fnp->f_offset + xfr_cnt == fnp->f_dir.dir_size)) 3857 .loc 1 1492 0 is_stmt 0 discriminator 1 0 000061C4 837E1001 cmp word ptr [bp+16], 1 0 000061C8 7555 jne _.L377 1493:fatfs.c **** { 3860 .loc 1 1493 0 is_stmt 1 0 000061CA 89D8 mov ax, bx 0 000061CC 8B4C2D mov cx, word ptr [si+45] 0 000061CF 894EF6 mov word ptr [bp-10], cx 0 000061D2 8B4C2F mov cx, word ptr [si+47] 0 000061D5 0346F6 add ax, word ptr [bp-10] 0 000061D8 83D100 adc cx, 0 0 000061DB 36394420 cmp word ptr ss:[si+32], ax 0 000061DF 753E jne _.L377 0 000061E1 36394C22 cmp word ptr ss:[si+34], cx 0 000061E5 EB2F jmp _.L439 3871 _.LVL434: 3872 _.L373: 1479:fatfs.c **** { 3873 .loc 1 1479 0 0 000061E7 807EE900 cmp byte ptr [bp-23], 0 0 000061EB 74B3 je _.L374 1481:fatfs.c **** bp->b_flag |= BFR_DIRTY | BFR_VALID; 3876 .loc 1 1481 0 0 000061ED 53 push bx 0 000061EE 895EF4 mov word ptr [bp-12], bx 0 000061F1 FF76EE push word ptr [bp-18] 0 000061F4 FF76F0 push word ptr [bp-16] 0 000061F7 8B5EF2 mov bx, word ptr [bp-14] 3882 _.LVL435: 0 000061FA 8D4114 lea ax, [20+bx+di] 0 000061FD 52 push dx 0 000061FE 8956F6 mov word ptr [bp-10], dx 0 00006201 50 push ax 0 00006202 E8[FEFF] call _fmemcpy 3888 _.LVL436: 1482:fatfs.c **** } 3889 .loc 1 1482 0 0 00006205 8B56F6 mov dx, word ptr [bp-10] 0 00006208 8EC2 mov es, dx 0 0000620A 26804D0560 or byte ptr es:[di+5], 96 3893 _.LVL437: 1492:fatfs.c **** (mode == XFR_READ && fnp->f_offset + xfr_cnt == fnp->f_dir.dir_size)) 3894 .loc 1 1492 0 0 0000620F 8B5EF4 mov bx, word ptr [bp-12] 0 00006212 81FB0002 cmp bx, 512 3897 _.L439: 1493:fatfs.c **** { 3898 .loc 1 1493 0 0 00006216 7507 jne _.L377 3900 _.L376: 1495:fatfs.c **** } 3901 .loc 1 1495 0 0 00006218 8EC2 mov es, dx 0 0000621A 26804D0501 or byte ptr es:[di+5], 1 3904 _.L377: 1499:fatfs.c **** 3905 .loc 1 1499 0 0 0000621F 89D8 mov ax, bx 0 00006221 8B4C2D mov cx, word ptr [si+45] 0 00006224 8B542F mov dx, word ptr [si+47] 0 00006227 01C8 add ax, cx 0 00006229 B90000 mov cx, 0 0 0000622C 11CA adc dx, cx 0 0000622E 89442D mov word ptr [si+45], ax 0 00006231 89542F mov word ptr [si+47], dx 3914 _.L367: 3915 _.LVL438: 1502:fatfs.c **** to_xfer -= xfr_cnt; 3916 .loc 1 1502 0 0 00006234 015EFA add word ptr [bp-6], bx 3918 _.LVL439: 1503:fatfs.c **** buffer = adjust_far((char FAR *)buffer + xfr_cnt); 3919 .loc 1 1503 0 0 00006237 295EF8 sub word ptr [bp-8], bx 3921 _.LVL440: 1504:fatfs.c **** if (mode == XFR_WRITE) 3922 .loc 1 1504 0 0 0000623A 8B46F0 mov ax, word ptr [bp-16] 0 0000623D 01D8 add ax, bx 0 0000623F FF76EE push word ptr [bp-18] 0 00006242 50 push ax 0 00006243 E8[FEFF] call _adjust_far 3928 _.LVL441: 0 00006246 8946F0 mov word ptr [bp-16], ax 0 00006249 8956EE mov word ptr [bp-18], dx 3931 _.LVL442: 1505:fatfs.c **** { 3932 .loc 1 1505 0 0 0000624C 807EE900 cmp byte ptr [bp-23], 0 0 00006250 7503E9BBFB je _.L355 1507:fatfs.c **** { 3935 .loc 1 1507 0 0 00006255 8B542D mov dx, word ptr [si+45] 3937 _.LVL443: 0 00006258 8B442F mov ax, word ptr [si+47] 3939 _.LVL444: 0 0000625B 36394422 cmp word ptr ss:[si+34], ax 0 0000625F 7208 jc _.L399 0 00006261 750C jne _.L379 0 00006263 36395420 cmp word ptr ss:[si+32], dx 0 00006267 7306 jnc _.L379 3945 _.L399: 1509:fatfs.c **** } 3946 .loc 1 1509 0 0 00006269 895420 mov word ptr [si+32], dx 0 0000626C 894422 mov word ptr [si+34], ax 3949 _.L379: 1511:fatfs.c **** } 3950 .loc 1 1511 0 0 0000626F 31C0 xor ax, ax 0 00006271 50 push ax 0 00006272 56 push si 0 00006273 E86AEE call _merge_file_changes 3955 _.LVL445: 0 00006276 E997FB jmp _.L355 3957 _.LVL446: 3958 _.L389: 3959 _.LBE131: 1309:fatfs.c **** #else 3960 .loc 1 1309 0 0 00006279 B8E4FF mov ax, -28 0 0000627C E920FC jmp _.L440 3963 _.LVL447: 3964 _.L329: 1284:fatfs.c **** { 3965 .loc 1 1284 0 0 0000627F 837E0E00 cmp word ptr [bp+14], 0 0 00006283 7503E9F5FA je _.L335 1305:fatfs.c **** { 3968 .loc 1 1305 0 0 00006288 C646E900 mov byte ptr [bp-23], 0 0 0000628C E94EFB jmp _.L384 3971 _.LFE37: 3972 .size _rwblock, .-_rwblock 3973 .global _dos_free 3974 .type _dos_free, @function 3975 _dos_free: 3976 _.LFB38: 1520:fatfs.c **** /* There's an unwritten rule here. All fs */ 3977 .loc 1 1520 0 3978 _.LVL448: 0 0000628F 56 push si 0 00006290 57 push di 0 00006291 55 push bp 3982 _.LCFI70: 0 00006292 89E5 mov bp, sp 3984 _.LCFI71: 0 00006294 83EC0C sub sp, 12 0 00006297 8B5E08 mov bx, word ptr [bp+8] 0 0000629A 8B460A mov ax, word ptr [bp+10] 0 0000629D 8946FE mov word ptr [bp-2], ax 3989 _.LVL449: 1528:fatfs.c **** { 3990 .loc 1 1528 0 0 000062A0 8EC0 mov es, ax 0 000062A2 26837F0F00 cmp word ptr es:[bx+15], 0 0 000062A7 755C jne _.L444 1530:fatfs.c **** return dpbp->dpb_xnfreeclst; 3994 .loc 1 1530 0 0 000062A9 268B771F mov si, word ptr es:[bx+31] 0 000062AD 268B5721 mov dx, word ptr es:[bx+33] 0 000062B1 83FEFF cmp si, -1 0 000062B4 7562 jne _.L443 0 000062B6 83FAFF cmp dx, -1 0 000062B9 755D jne _.L443 1532:fatfs.c **** } 4001 .loc 1 1532 0 0 000062BB 268B472D mov ax, word ptr es:[bx+45] 4003 _.LVL450: 0 000062BF 8946FC mov word ptr [bp-4], ax 4005 _.LVL451: 0 000062C2 268B472F mov ax, word ptr es:[bx+47] 0 000062C6 8946FA mov word ptr [bp-6], ax 4008 _.LVL452: 4009 _.L446: 1539:fatfs.c **** for (i = 2; i <= max_cluster; i++) 4010 .loc 1 1539 0 0 000062C9 31F6 xor si, si 0 000062CB 89F2 mov dx, si 1540:fatfs.c **** { 4013 .loc 1 1540 0 0 000062CD BF0200 mov di, 2 0 000062D0 89F1 mov cx, si 4016 _.LVL453: 4017 _.L448: 1540:fatfs.c **** { 4018 .loc 1 1540 0 is_stmt 0 discriminator 1 0 000062D2 3B4EFA cmp cx, word ptr [bp-6] 0 000062D5 7707 ja _.L455 0 000062D7 7552 jne _.L452 0 000062D9 3B7EFC cmp di, word ptr [bp-4] 0 000062DC 764D jbe _.L452 4024 _.L455: 1562:fatfs.c **** { 4025 .loc 1 1562 0 is_stmt 1 0 000062DE 8E46FE mov es, word ptr [bp-2] 0 000062E1 26837F0F00 cmp word ptr es:[bx+15], 0 0 000062E6 7403E99200 jne _.L454 1564:fatfs.c **** write_fsinfo(dpbp); 4029 .loc 1 1564 0 0 000062EB 2689771F mov word ptr es:[bx+31], si 0 000062EF 8E46FE mov es, word ptr [bp-2] 0 000062F2 26895721 mov word ptr es:[bx+33], dx 0 000062F6 8956FC mov word ptr [bp-4], dx 1565:fatfs.c **** return cnt; 4034 .loc 1 1565 0 0 000062F9 FF76FE push word ptr [bp-2] 0 000062FC 53 push bx 0 000062FD E8[FEFF] call _write_fsinfo 4038 _.LVL454: 1566:fatfs.c **** } 4039 .loc 1 1566 0 0 00006300 8B56FC mov dx, word ptr [bp-4] 0 00006303 EB13 jmp _.L443 4042 _.LVL455: 4043 _.L444: 1525:fatfs.c **** 4044 .loc 1 1525 0 0 00006305 8E46FE mov es, word ptr [bp-2] 0 00006308 268B570D mov dx, word ptr es:[bx+13] 1536:fatfs.c **** return dpbp->dpb_nfreeclst; 4047 .loc 1 1536 0 0 0000630C 268B471F mov ax, word ptr es:[bx+31] 4049 _.LVL456: 0 00006310 83F8FF cmp ax, -1 0 00006313 740C je _.L447 1537:fatfs.c **** 4052 .loc 1 1537 0 0 00006315 96 xchg si, ax 0 00006316 31D2 xor dx, dx 4055 _.LVL457: 4056 _.L443: 1571:fatfs.c **** 4057 .loc 1 1571 0 0 00006318 96 xchg si, ax 0 00006319 89EC mov sp, bp 0 0000631B 5D pop bp 0 0000631C 5F pop di 0 0000631D 5E pop si 0 0000631E C20400 ret 4 4064 _.LVL458: 4065 _.L447: 1525:fatfs.c **** 4066 .loc 1 1525 0 0 00006321 8956FC mov word ptr [bp-4], dx 4068 _.LVL459: 0 00006324 C746FA0000 mov word ptr [bp-6], 0 0 00006329 EB9E jmp _.L446 4071 _.LVL460: 4072 _.L452: 0 0000632B 8956F4 mov word ptr [bp-12], dx 1545:fatfs.c **** #endif 4074 .loc 1 1545 0 0 0000632E 51 push cx 0 0000632F 894EF6 mov word ptr [bp-10], cx 0 00006332 57 push di 0 00006333 FF76FE push word ptr [bp-2] 0 00006336 53 push bx 0 00006337 895EF8 mov word ptr [bp-8], bx 0 0000633A E8[FEFF] call _is_free_cluster 4082 _.LVL461: 0 0000633D 85C0 test ax, ax 0 0000633F 8B5EF8 mov bx, word ptr [bp-8] 0 00006342 8B4EF6 mov cx, word ptr [bp-10] 0 00006345 8B56F4 mov dx, word ptr [bp-12] 0 00006348 7421 je _.L449 1548:fatfs.c **** { 4088 .loc 1 1548 0 0 0000634A 89F0 mov ax, si 0 0000634C 09D0 or ax, dx 0 0000634E 7515 jne _.L450 1552:fatfs.c **** dpbp->dpb_xcluster = i; 4092 .loc 1 1552 0 0 00006350 8E46FE mov es, word ptr [bp-2] 0 00006353 26837F0F00 cmp word ptr es:[bx+15], 0 0 00006358 751A jne _.L451 1553:fatfs.c **** else 4096 .loc 1 1553 0 0 0000635A 26897F39 mov word ptr es:[bx+57], di 4098 _.LVL462: 0 0000635E 8E46FE mov es, word ptr [bp-2] 0 00006361 26894F3B mov word ptr es:[bx+59], cx 4101 _.L450: 1558:fatfs.c **** } 4102 .loc 1 1558 0 0 00006365 83C601 add si, 1 0 00006368 83D200 adc dx, 0 4105 _.LVL463: 4106 _.L449: 1540:fatfs.c **** { 4107 .loc 1 1540 0 discriminator 2 0 0000636B 83C701 add di, 1 0 0000636E 83D100 adc cx, 0 4110 _.LVL464: 0 00006371 E95EFF jmp _.L448 4112 _.LVL465: 4113 _.L451: 1556:fatfs.c **** } 4114 .loc 1 1556 0 0 00006374 8E46FE mov es, word ptr [bp-2] 0 00006377 26897F1D mov word ptr es:[bx+29], di 4117 _.LVL466: 0 0000637B EBE8 jmp _.L450 4119 _.LVL467: 4120 _.L454: 1569:fatfs.c **** return cnt; 4121 .loc 1 1569 0 0 0000637D 8E46FE mov es, word ptr [bp-2] 0 00006380 2689771F mov word ptr es:[bx+31], si 1570:fatfs.c **** } 4124 .loc 1 1570 0 0 00006384 EB92 jmp _.L443 4126 _.LFE38: 4127 .size _dos_free, .-_dos_free 4128 .global _dos_cd 4129 .type _dos_cd, @function 4130 _dos_cd: 4131 _.LFB39: 1575:fatfs.c **** f_node_ptr fnp; 4132 .loc 1 1575 0 4133 _.LVL468: 0 00006386 56 push si 0 00006387 57 push di 0 00006388 55 push bp 4137 _.LCFI72: 0 00006389 89E5 mov bp, sp 4139 _.LCFI73: 1580:fatfs.c **** return DE_PATHNOTFND; 4140 .loc 1 1580 0 0 0000638B B8[0000] mov ax, offset _fnode 0 0000638E 50 push ax 0 0000638F 31F6 xor si, si 0 00006391 56 push si 0 00006392 FF7608 push word ptr [bp+8] 0 00006395 E8[FEFF] call _dir_open 4147 _.LVL469: 0 00006398 39F0 cmp ax, si 0 0000639A 7424 je _.L462 0 0000639C 97 xchg di, ax 1585:fatfs.c **** cdsp->cdsStrtClst = (UWORD)fnp->f_dmp->dm_dircluster; 4151 .loc 1 1585 0 0 0000639D 8B5E08 mov bx, word ptr [bp+8] 0 000063A0 8A07 mov al, byte ptr [bx] 4154 _.LVL470: 0 000063A2 98 cbw 0 000063A3 83C0BF add ax, -65 0 000063A6 50 push ax 0 000063A7 E8[FEFF] call _get_cds 4159 _.LVL471: 1586:fatfs.c **** return SUCCESS; 4160 .loc 1 1586 0 0 000063AA 8B5D02 mov bx, word ptr [di+2] 0 000063AD 8B4F0F mov cx, word ptr [bx+15] 0 000063B0 8EC2 mov es, dx 0 000063B2 93 xchg bx, ax 0 000063B3 26894F49 mov word ptr es:[bx+73], cx 4166 _.LVL472: 1587:fatfs.c **** } 4167 .loc 1 1587 0 0 000063B7 96 xchg si, ax 4169 _.LVL473: 4170 _.L460: 1588:fatfs.c **** #endif 4171 .loc 1 1588 0 0 000063B8 89EC mov sp, bp 0 000063BA 5D pop bp 0 000063BB 5F pop di 0 000063BC 5E pop si 0 000063BD C20200 ret 2 4177 _.LVL474: 4178 _.L462: 1581:fatfs.c **** 4179 .loc 1 1581 0 0 000063C0 B8FDFF mov ax, -3 4181 _.LVL475: 0 000063C3 EBF3 jmp _.L460 4183 _.LFE39: 4184 .size _dos_cd, .-_dos_cd 4185 .global _dos_getfattr 4186 .type _dos_getfattr, @function 4187 _dos_getfattr: 4188 _.LFB40: 1593:fatfs.c **** f_node_ptr fnp = &fnode[0]; 4189 .loc 1 1593 0 4190 _.LVL476: 0 000063C5 56 push si 0 000063C6 55 push bp 4193 _.LCFI74: 0 000063C7 89E5 mov bp, sp 4195 _.LCFI75: 4196 _.LVL477: 1595:fatfs.c **** return ret == SUCCESS ? fnp->f_dir.dir_attrib : ret; 4197 .loc 1 1595 0 0 000063C9 BE[0000] mov si, offset _fnode 0 000063CC 56 push si 0 000063CD B83700 mov ax, 55 0 000063D0 50 push ax 0 000063D1 FF7606 push word ptr [bp+6] 0 000063D4 E8F7F0 call _find_fname 4204 _.LVL478: 1596:fatfs.c **** } 4205 .loc 1 1596 0 0 000063D7 85C0 test ax, ax 0 000063D9 7505 jne _.L464 1596:fatfs.c **** } 4208 .loc 1 1596 0 is_stmt 0 discriminator 1 0 000063DB 8A440F mov al, byte ptr [si+15] 4210 _.LVL479: 0 000063DE 30E4 xor ah, ah 4212 _.L464: 1597:fatfs.c **** 4213 .loc 1 1597 0 is_stmt 1 0 000063E0 89EC mov sp, bp 0 000063E2 5D pop bp 0 000063E3 5E pop si 0 000063E4 C20200 ret 2 4218 _.LFE40: 4219 .size _dos_getfattr, .-_dos_getfattr 4220 .global _dos_setfattr 4221 .type _dos_setfattr, @function 4222 _dos_setfattr: 4223 _.LFB41: 1600:fatfs.c **** f_node_ptr fnp; 4224 .loc 1 1600 0 4225 _.LVL480: 0 000063E7 56 push si 0 000063E8 57 push di 0 000063E9 55 push bp 4229 _.LCFI76: 0 000063EA 89E5 mov bp, sp 4231 _.LCFI77: 1610:fatfs.c **** return DE_ACCESS; 4232 .loc 1 1610 0 0 000063EC F6460AC8 test byte ptr [bp+10], -56 0 000063F0 7542 jne _.L468 4235 _.LVL481: 1614:fatfs.c **** if (rc != SUCCESS) 4236 .loc 1 1614 0 0 000063F2 BE[0000] mov si, offset _fnode 0 000063F5 56 push si 0 000063F6 B83700 mov ax, 55 0 000063F9 50 push ax 0 000063FA FF7608 push word ptr [bp+8] 0 000063FD E8CEF0 call _find_fname 4243 _.LVL482: 0 00006400 89C7 mov di, ax 4245 _.LVL483: 1615:fatfs.c **** return rc; 4246 .loc 1 1615 0 0 00006402 85C0 test ax, ax 0 00006404 7531 jne _.L467 1619:fatfs.c **** return DE_ACCESS; 4249 .loc 1 1619 0 0 00006406 F6460A10 test byte ptr [bp+10], 16 0 0000640A 7406 je _.L470 1619:fatfs.c **** return DE_ACCESS; 4252 .loc 1 1619 0 is_stmt 0 discriminator 1 0 0000640C F6440F10 test byte ptr [si+15], 16 0 00006410 7422 je _.L468 4255 _.L470: 1624:fatfs.c **** 4256 .loc 1 1624 0 is_stmt 1 0 00006412 8A440F mov al, byte ptr [si+15] 4258 _.LVL484: 0 00006415 2418 and al, 24 1627:fatfs.c **** 4260 .loc 1 1627 0 0 00006417 0A460A or al, byte ptr [bp+10] 0 0000641A 88440F mov byte ptr [si+15], al 1630:fatfs.c **** if (rc == SUCCESS && !dir_write(fnp)) 4263 .loc 1 1630 0 0 0000641D B8FFFF mov ax, -1 0 00006420 50 push ax 0 00006421 56 push si 0 00006422 E8BBEC call _merge_file_changes 4268 _.LVL485: 0 00006425 89C7 mov di, ax 4270 _.LVL486: 1631:fatfs.c **** rc = DE_ACCESS; 4271 .loc 1 1631 0 0 00006427 85C0 test ax, ax 0 00006429 750C jne _.L467 1631:fatfs.c **** rc = DE_ACCESS; 4274 .loc 1 1631 0 is_stmt 0 discriminator 1 0 0000642B 50 push ax 0 0000642C 56 push si 0 0000642D E8[FEFF] call _dir_write_update 4278 _.LVL487: 0 00006430 85C0 test ax, ax 0 00006432 7503 jne _.L467 4281 _.LVL488: 4282 _.L468: 1632:fatfs.c **** return rc; 4283 .loc 1 1632 0 is_stmt 1 0 00006434 BFFBFF mov di, -5 4285 _.LVL489: 4286 _.L467: 1634:fatfs.c **** #endif 4287 .loc 1 1634 0 0 00006437 97 xchg di, ax 0 00006438 89EC mov sp, bp 0 0000643A 5D pop bp 0 0000643B 5F pop di 0 0000643C 5E pop si 0 0000643D C20400 ret 4 4294 _.LFE41: 4295 .size _dos_setfattr, .-_dos_setfattr 4296 .global _dpb16to32 4297 .type _dpb16to32, @function 4298 _dpb16to32: 4299 _.LFB42: 1639:fatfs.c **** dpbp->dpb_xflags = 0; 4300 .loc 1 1639 0 4301 _.LVL490: 0 00006440 55 push bp 4303 _.LCFI78: 0 00006441 89E5 mov bp, sp 4305 _.LCFI79: 1640:fatfs.c **** dpbp->dpb_xfsinfosec = 0xffff; 4306 .loc 1 1640 0 0 00006443 C45E04 les bx, dword ptr [bp+4] 0 00006446 26C747230000 mov word ptr es:[bx+35], 0 4309 _.LVL491: 1641:fatfs.c **** dpbp->dpb_xbackupsec = 0xffff; 4310 .loc 1 1641 0 0 0000644C 26C74725FFFF mov word ptr es:[bx+37], -1 1642:fatfs.c **** dpbp->dpb_xrootclst = 0; 4312 .loc 1 1642 0 0 00006452 26C74727FFFF mov word ptr es:[bx+39], -1 1643:fatfs.c **** dpbp->dpb_xdata = dpbp->dpb_data; 4314 .loc 1 1643 0 0 00006458 26C747350000 mov word ptr es:[bx+53], 0 0 0000645E 26C747370000 mov word ptr es:[bx+55], 0 1644:fatfs.c **** dpbp->dpb_xsize = dpbp->dpb_size; 4317 .loc 1 1644 0 0 00006464 268B570B mov dx, word ptr es:[bx+11] 0 00006468 31C9 xor cx, cx 0 0000646A 26895729 mov word ptr es:[bx+41], dx 0 0000646E 26894F2B mov word ptr es:[bx+43], cx 1645:fatfs.c **** } 4322 .loc 1 1645 0 0 00006472 268B570D mov dx, word ptr es:[bx+13] 0 00006476 2689572D mov word ptr es:[bx+45], dx 0 0000647A 26894F2F mov word ptr es:[bx+47], cx 1646:fatfs.c **** 4326 .loc 1 1646 0 0 0000647E 5D pop bp 0 0000647F C20400 ret 4 4329 _.LFE42: 4330 .size _dpb16to32, .-_dpb16to32 4331 .global _bpb_to_dpb 4332 .type _bpb_to_dpb, @function 4333 _bpb_to_dpb: 4334 _.LFB43: 1652:fatfs.c **** ULONG size; 4335 .loc 1 1652 0 4336 _.LVL492: 0 00006482 56 push si 0 00006483 57 push di 0 00006484 55 push bp 4340 _.LCFI80: 0 00006485 89E5 mov bp, sp 4342 _.LCFI81: 0 00006487 83EC3C sub sp, 60 0 0000648A C4460C les ax, dword ptr [bp+12] 0 0000648D 8946D4 mov word ptr [bp-44], ax 0 00006490 8C46D2 mov word ptr [bp-46], es 1657:fatfs.c **** if (sbpb.bpb_nsector == 0) { 4347 .loc 1 1657 0 0 00006493 B82900 mov ax, 41 0 00006496 50 push ax 0 00006497 FF760A push word ptr [bp+10] 0 0000649A FF7608 push word ptr [bp+8] 0 0000649D 8D46D7 lea ax, [-41+bp] 0 000064A0 16 push ss 0 000064A1 50 push ax 0 000064A2 E8[FEFF] call _fmemcpy 4356 _.LVL493: 1658:fatfs.c **** shftcnt = 8; 4357 .loc 1 1658 0 0 000064A5 8A46D9 mov al, byte ptr [bp-39] 0 000064A8 84C0 test al, al 0 000064AA 7503E99B02 je _.L494 0 000064AF C746D00000 mov word ptr [bp-48], 0 4362 _.L482: 4363 _.LVL494: 1661:fatfs.c **** ; 4364 .loc 1 1661 0 discriminator 1 0 000064B4 88C2 mov dl, al 0 000064B6 30F6 xor dh, dh 0 000064B8 8A4ED0 mov cl, byte ptr [bp-48] 0 000064BB D3FA sar dx, cl 0 000064BD 83FA01 cmp dx, 1 0 000064C0 7E03E97F02 jg _.L483 4371 _.LVL495: 4372 _.L481: 1664:fatfs.c **** 4373 .loc 1 1664 0 0 000064C5 8E46D2 mov es, word ptr [bp-46] 0 000064C8 8A66D0 mov ah, byte ptr [bp-48] 0 000064CB 8B5ED4 mov bx, word ptr [bp-44] 0 000064CE 26886705 mov byte ptr es:[bx+5], ah 4378 _.LVL496: 1666:fatfs.c **** dpbp->dpb_secsize = sbpb.bpb_nbyte; 4379 .loc 1 1666 0 0 000064D2 8A66E1 mov ah, byte ptr [bp-31] 0 000064D5 8E46D2 mov es, word ptr [bp-46] 0 000064D8 8B5ED4 mov bx, word ptr [bp-44] 0 000064DB 26886717 mov byte ptr es:[bx+23], ah 1667:fatfs.c **** dpbp->dpb_clsmask = (sbpb.bpb_nsector - 1) & 0xFF; 4384 .loc 1 1667 0 0 000064DF 8B56D7 mov dx, word ptr [bp-41] 0 000064E2 8956C6 mov word ptr [bp-58], dx 0 000064E5 8E46D2 mov es, word ptr [bp-46] 0 000064E8 8B5ED4 mov bx, word ptr [bp-44] 0 000064EB 26895702 mov word ptr es:[bx+2], dx 1668:fatfs.c **** dpbp->dpb_fatstrt = sbpb.bpb_nreserved; 4390 .loc 1 1668 0 0 000064EF FEC8 dec al 0 000064F1 8E46D2 mov es, word ptr [bp-46] 0 000064F4 8B5ED4 mov bx, word ptr [bp-44] 0 000064F7 26884704 mov byte ptr es:[bx+4], al 1669:fatfs.c **** dpbp->dpb_fats = sbpb.bpb_nfat; 4395 .loc 1 1669 0 0 000064FB 8B4EDA mov cx, word ptr [bp-38] 0 000064FE 8E46D2 mov es, word ptr [bp-46] 0 00006501 8B5ED4 mov bx, word ptr [bp-44] 0 00006504 26894F06 mov word ptr es:[bx+6], cx 1670:fatfs.c **** dpbp->dpb_dirents = sbpb.bpb_ndirent; 4400 .loc 1 1670 0 0 00006508 8A46DC mov al, byte ptr [bp-36] 0 0000650B 8E46D2 mov es, word ptr [bp-46] 0 0000650E 8B5ED4 mov bx, word ptr [bp-44] 0 00006511 26884708 mov byte ptr es:[bx+8], al 1671:fatfs.c **** size = sbpb.bpb_nsize == 0 ? sbpb.bpb_huge : (ULONG) sbpb.bpb_nsize; 4405 .loc 1 1671 0 0 00006515 8B7EDD mov di, word ptr [bp-35] 0 00006518 8E46D2 mov es, word ptr [bp-46] 0 0000651B 8B5ED4 mov bx, word ptr [bp-44] 0 0000651E 26897F09 mov word ptr es:[bx+9], di 1672:fatfs.c **** dpbp->dpb_fatsize = sbpb.bpb_nfsect; 4410 .loc 1 1672 0 0 00006522 8B56DF mov dx, word ptr [bp-33] 0 00006525 85D2 test dx, dx 0 00006527 7403E92602 jne _.L484 1672:fatfs.c **** dpbp->dpb_fatsize = sbpb.bpb_nfsect; 4414 .loc 1 1672 0 is_stmt 0 discriminator 1 0 0000652C C456EC les dx, dword ptr [bp-20] 0 0000652F 8956CA mov word ptr [bp-54], dx 0 00006532 8C46C8 mov word ptr [bp-56], es 4418 _.L485: 4419 _.LVL497: 1673:fatfs.c **** dpbp->dpb_dirstrt = dpbp->dpb_fatstrt + dpbp->dpb_fats * dpbp->dpb_fatsize; 4420 .loc 1 1673 0 is_stmt 1 discriminator 4 0 00006535 8B56E2 mov dx, word ptr [bp-30] 0 00006538 8956CC mov word ptr [bp-52], dx 0 0000653B 8E46D2 mov es, word ptr [bp-46] 0 0000653E 8B5ED4 mov bx, word ptr [bp-44] 0 00006541 2689570F mov word ptr es:[bx+15], dx 4426 _.LVL498: 1674:fatfs.c **** dpbp->dpb_data = dpbp->dpb_dirstrt 4427 .loc 1 1674 0 discriminator 4 0 00006545 30E4 xor ah, ah 0 00006547 F766CC mul word ptr [bp-52] 0 0000654A 01C1 add cx, ax 0 0000654C 894EC4 mov word ptr [bp-60], cx 0 0000654F 8E46D2 mov es, word ptr [bp-46] 0 00006552 8B5ED4 mov bx, word ptr [bp-44] 0 00006555 26894F11 mov word ptr es:[bx+17], cx 1676:fatfs.c **** (dpbp->dpb_secsize/DIRENT_SIZE); 4435 .loc 1 1676 0 discriminator 4 0 00006559 8B76C6 mov si, word ptr [bp-58] 0 0000655C B105 mov cl, 5 0 0000655E D3EE shr si, cl 0 00006560 89F3 mov bx, si 0 00006562 8D41FF lea ax, [-1+bx+di] 0 00006565 31D2 xor dx, dx 0 00006567 F7F6 div si 0 00006569 0346C4 add ax, word ptr [bp-60] 1675:fatfs.c **** + (dpbp->dpb_dirents + dpbp->dpb_secsize/DIRENT_SIZE - 1) / 4444 .loc 1 1675 0 discriminator 4 0 0000656C 8E46D2 mov es, word ptr [bp-46] 0 0000656F 8B5ED4 mov bx, word ptr [bp-44] 0 00006572 2689470B mov word ptr es:[bx+11], ax 1678:fatfs.c **** { /* Make sure the number of FAT sectors is actually enough to hold that */ 4448 .loc 1 1678 0 discriminator 4 0 00006576 96 xchg si, ax 0 00006577 31FF xor di, di 0 00006579 8B46CA mov ax, word ptr [bp-54] 0 0000657C 29F0 sub ax, si 0 0000657E 8B56C8 mov dx, word ptr [bp-56] 0 00006581 19FA sbb dx, di 0 00006583 FF76D0 push word ptr [bp-48] 0 00006586 52 push dx 0 00006587 50 push ax 0 00006588 E8[FEFF] call ___lshrsi3 4459 _.LVL499: 0 0000658B 40 inc ax 0 0000658C 89C6 mov si, ax 0 0000658E 8E46D2 mov es, word ptr [bp-46] 0 00006591 8B5ED4 mov bx, word ptr [bp-44] 0 00006594 2689470D mov word ptr es:[bx+13], ax 4465 _.LBB132: 1682:fatfs.c **** if (tmp >= 0x10000UL) 4466 .loc 1 1682 0 discriminator 4 0 00006598 8B5ECC mov bx, word ptr [bp-52] 0 0000659B 8EDF mov ds, di 0 0000659D 8B46C6 mov ax, word ptr [bp-58] 0 000065A0 D1E8 shr ax, 1 0 000065A2 F7E3 mul bx 4472 _.LVL500: 1683:fatfs.c **** goto ckok; 4473 .loc 1 1683 0 discriminator 4 0 000065A4 39FA cmp dx, di 0 000065A6 751F jne _.L486 1685:fatfs.c **** if (dpbp->dpb_size > FAT_MAGIC) {/* FAT16 */ 4476 .loc 1 1685 0 discriminator 4 0 000065A8 89C1 mov cx, ax 4478 _.LVL501: 1686:fatfs.c **** if (fatsiz <= FAT_MAGIC) /* FAT12 - let it pass through rather */ 4479 .loc 1 1686 0 discriminator 4 0 000065AA 81FEF50F cmp si, 4085 0 000065AE 7703E9AA01 jbe _.L488 1687:fatfs.c **** goto ckok; /* than lose data correcting FAT type */ 4482 .loc 1 1687 0 0 000065B3 3DF50F cmp ax, 4085 0 000065B6 760F jbe _.L486 4485 _.LVL502: 4486 _.L489: 1694:fatfs.c **** dpbp->dpb_size = fatsiz - 1; /* - 2 reserved entries + 1 */ 4487 .loc 1 1694 0 0 000065B8 39F1 cmp cx, si 0 000065BA 770B ja _.L486 1695:fatfs.c **** ckok:; 4490 .loc 1 1695 0 0 000065BC 49 dec cx 4492 _.LVL503: 0 000065BD 8E46D2 mov es, word ptr [bp-46] 0 000065C0 8B7ED4 mov di, word ptr [bp-44] 0 000065C3 26894D0D mov word ptr es:[di+13], cx 4496 _.LVL504: 4497 _.L486: 4498 _.LBE132: 1698:fatfs.c **** dpbp->dpb_cluster = UNKNCLUSTER; 4499 .loc 1 1698 0 0 000065C7 8E46D2 mov es, word ptr [bp-46] 0 000065CA 8B7ED4 mov di, word ptr [bp-44] 0 000065CD 26C6451800 mov byte ptr es:[di+24], 0 1699:fatfs.c **** /* number of free clusters */ 4503 .loc 1 1699 0 0 000065D2 8E46D2 mov es, word ptr [bp-46] 0 000065D5 8B7ED4 mov di, word ptr [bp-44] 0 000065D8 26C7451D0000 mov word ptr es:[di+29], 0 1701:fatfs.c **** 4507 .loc 1 1701 0 0 000065DE 8E46D2 mov es, word ptr [bp-46] 0 000065E1 8B7ED4 mov di, word ptr [bp-44] 0 000065E4 26C7451FFFFF mov word ptr es:[di+31], -1 1704:fatfs.c **** { 4511 .loc 1 1704 0 0 000065EA 837E1000 cmp word ptr [bp+16], 0 0 000065EE 7503E94701 je _.L480 1707:fatfs.c **** dpbp->dpb_xcluster = UNKNCLUSTER; 4514 .loc 1 1707 0 0 000065F3 837ECC00 cmp word ptr [bp-52], 0 0 000065F7 7503 jne _.L492 1707:fatfs.c **** dpbp->dpb_xcluster = UNKNCLUSTER; 4517 .loc 1 1707 0 is_stmt 0 discriminator 1 0 000065F9 C55EF0 lds bx, dword ptr [bp-16] 4519 _.L492: 1706:fatfs.c **** : sbpb.bpb_nfsect; 4520 .loc 1 1706 0 is_stmt 1 0 000065FC 8E46D2 mov es, word ptr [bp-46] 0 000065FF 8B7ED4 mov di, word ptr [bp-44] 0 00006602 26895D31 mov word ptr es:[di+49], bx 0 00006606 8E46D2 mov es, word ptr [bp-46] 0 00006609 8B5ED4 mov bx, word ptr [bp-44] 0 0000660C 268C5F33 mov word ptr es:[bx+51], ds 1708:fatfs.c **** dpbp->dpb_xnfreeclst = XUNKNCLSTFREE; /* number of free clusters */ 4527 .loc 1 1708 0 0 00006610 8E46D2 mov es, word ptr [bp-46] 0 00006613 8B5ED4 mov bx, word ptr [bp-44] 0 00006616 26C747390000 mov word ptr es:[bx+57], 0 0 0000661C 8E46D2 mov es, word ptr [bp-46] 0 0000661F 8B5ED4 mov bx, word ptr [bp-44] 0 00006622 26C7473B0000 mov word ptr es:[bx+59], 0 1709:fatfs.c **** 4534 .loc 1 1709 0 0 00006628 8E46D2 mov es, word ptr [bp-46] 0 0000662B 8B5ED4 mov bx, word ptr [bp-44] 0 0000662E 26C7471FFFFF mov word ptr es:[bx+31], -1 0 00006634 8E46D2 mov es, word ptr [bp-46] 0 00006637 8B5ED4 mov bx, word ptr [bp-44] 0 0000663A 26C74721FFFF mov word ptr es:[bx+33], -1 1711:fatfs.c **** 4541 .loc 1 1711 0 0 00006640 FF76D2 push word ptr [bp-46] 0 00006643 FF76D4 push word ptr [bp-44] 0 00006646 16 push ss 0 00006647 1F pop ds 0 00006648 E8[FEFF] call _dpb16to32 4547 _.LVL505: 1713:fatfs.c **** { 4548 .loc 1 1713 0 0 0000664B 8E46D2 mov es, word ptr [bp-46] 0 0000664E 8B5ED4 mov bx, word ptr [bp-44] 0 00006651 26837F0F00 cmp word ptr es:[bx+15], 0 0 00006656 7403E9DF00 jne _.L480 1715:fatfs.c **** dpbp->dpb_xfsinfosec = sbpb.bpb_xfsinfosec; 4553 .loc 1 1715 0 0 0000665B 8B46F4 mov ax, word ptr [bp-12] 0 0000665E 26894723 mov word ptr es:[bx+35], ax 1716:fatfs.c **** dpbp->dpb_xbackupsec = sbpb.bpb_xbackupsec; 4556 .loc 1 1716 0 0 00006662 8B46FC mov ax, word ptr [bp-4] 0 00006665 8E46D2 mov es, word ptr [bp-46] 0 00006668 8B5ED4 mov bx, word ptr [bp-44] 0 0000666B 26894725 mov word ptr es:[bx+37], ax 1717:fatfs.c **** dpbp->dpb_dirents = 0; 4561 .loc 1 1717 0 0 0000666F 8B46FE mov ax, word ptr [bp-2] 0 00006672 8E46D2 mov es, word ptr [bp-46] 0 00006675 8B5ED4 mov bx, word ptr [bp-44] 0 00006678 26894727 mov word ptr es:[bx+39], ax 1718:fatfs.c **** dpbp->dpb_dirstrt = 0xffff; 4566 .loc 1 1718 0 0 0000667C 8E46D2 mov es, word ptr [bp-46] 0 0000667F 8B5ED4 mov bx, word ptr [bp-44] 0 00006682 26C747090000 mov word ptr es:[bx+9], 0 1719:fatfs.c **** dpbp->dpb_size = 0; 4570 .loc 1 1719 0 0 00006688 8E46D2 mov es, word ptr [bp-46] 0 0000668B 8B5ED4 mov bx, word ptr [bp-44] 0 0000668E 26C74711FFFF mov word ptr es:[bx+17], -1 1720:fatfs.c **** dpbp->dpb_xdata = 4574 .loc 1 1720 0 0 00006694 8E46D2 mov es, word ptr [bp-46] 0 00006697 8B5ED4 mov bx, word ptr [bp-44] 0 0000669A 26C7470D0000 mov word ptr es:[bx+13], 0 1722:fatfs.c **** dpbp->dpb_xsize = ((size - dpbp->dpb_xdata) >> shftcnt) + 1; 4578 .loc 1 1722 0 0 000066A0 8E46D2 mov es, word ptr [bp-46] 0 000066A3 8B5ED4 mov bx, word ptr [bp-44] 0 000066A6 268A4708 mov al, byte ptr es:[bx+8] 0 000066AA 8846CC mov byte ptr [bp-52], al 0 000066AD C646CD00 mov byte ptr [bp-51], 0 0 000066B1 268B4731 mov ax, word ptr es:[bx+49] 0 000066B5 8946C6 mov word ptr [bp-58], ax 0 000066B8 268B4733 mov ax, word ptr es:[bx+51] 0 000066BC F766CC mul word ptr [bp-52] 0 000066BF 91 xchg cx, ax 0 000066C0 8B46CC mov ax, word ptr [bp-52] 0 000066C3 F766C6 mul word ptr [bp-58] 0 000066C6 8946CC mov word ptr [bp-52], ax 0 000066C9 8956CE mov word ptr [bp-50], dx 0 000066CC 014ECE add word ptr [bp-50], cx 0 000066CF 268B4F06 mov cx, word ptr es:[bx+6] 0 000066D3 31F6 xor si, si 0 000066D5 01C1 add cx, ax 0 000066D7 1376CE adc si, word ptr [bp-50] 1721:fatfs.c **** dpbp->dpb_fatstrt + dpbp->dpb_fats * dpbp->dpb_xfatsize; 4598 .loc 1 1721 0 0 000066DA 26894F29 mov word ptr es:[bx+41], cx 0 000066DE 8E46D2 mov es, word ptr [bp-46] 0 000066E1 8B5ED4 mov bx, word ptr [bp-44] 0 000066E4 2689772B mov word ptr es:[bx+43], si 1723:fatfs.c **** dpbp->dpb_xrootclst = sbpb.bpb_xrootclst; 4603 .loc 1 1723 0 0 000066E8 8B46CA mov ax, word ptr [bp-54] 0 000066EB 29C8 sub ax, cx 0 000066ED 8B56C8 mov dx, word ptr [bp-56] 0 000066F0 19F2 sbb dx, si 0 000066F2 FF76D0 push word ptr [bp-48] 0 000066F5 52 push dx 0 000066F6 50 push ax 0 000066F7 E8[FEFF] call ___lshrsi3 4612 _.LVL506: 0 000066FA 91 xchg cx, ax 0 000066FB 89D6 mov si, dx 0 000066FD 83C101 add cx, 1 0 00006700 83D600 adc si, 0 0 00006703 8E46D2 mov es, word ptr [bp-46] 0 00006706 8B5ED4 mov bx, word ptr [bp-44] 0 00006709 26894F2D mov word ptr es:[bx+45], cx 0 0000670D 8E46D2 mov es, word ptr [bp-46] 0 00006710 8B5ED4 mov bx, word ptr [bp-44] 0 00006713 2689772F mov word ptr es:[bx+47], si 1724:fatfs.c **** read_fsinfo(dpbp); 4623 .loc 1 1724 0 0 00006717 8B46F8 mov ax, word ptr [bp-8] 0 0000671A 8E46D2 mov es, word ptr [bp-46] 0 0000671D 8B5ED4 mov bx, word ptr [bp-44] 0 00006720 26894735 mov word ptr es:[bx+53], ax 0 00006724 8B46FA mov ax, word ptr [bp-6] 0 00006727 8E46D2 mov es, word ptr [bp-46] 0 0000672A 8B5ED4 mov bx, word ptr [bp-44] 0 0000672D 26894737 mov word ptr es:[bx+55], ax 1725:fatfs.c **** } 4632 .loc 1 1725 0 0 00006731 FF76D2 push word ptr [bp-46] 0 00006734 FF76D4 push word ptr [bp-44] 0 00006737 E8[FEFF] call _read_fsinfo 4636 _.LVL507: 4637 _.L480: 1729:fatfs.c **** 4638 .loc 1 1729 0 0 0000673A 89EC mov sp, bp 0 0000673C 5D pop bp 0 0000673D 5F pop di 0 0000673E 5E pop si 0 0000673F 16 push ss 0 00006740 1F pop ds 0 00006741 C20A00 ret 10 4646 _.LVL508: 4647 _.L483: 1661:fatfs.c **** ; 4648 .loc 1 1661 0 discriminator 3 0 00006744 FF46D0 inc word ptr [bp-48] 4650 _.LVL509: 0 00006747 E96AFD jmp _.L482 4652 _.LVL510: 4653 _.L494: 1659:fatfs.c **** } else { 4654 .loc 1 1659 0 0 0000674A C746D00800 mov word ptr [bp-48], 8 0 0000674F E973FD jmp _.L481 4657 _.LVL511: 4658 _.L484: 1672:fatfs.c **** dpbp->dpb_fatsize = sbpb.bpb_nfsect; 4659 .loc 1 1672 0 discriminator 2 0 00006752 8956CA mov word ptr [bp-54], dx 0 00006755 C746C80000 mov word ptr [bp-56], 0 0 0000675A E9D8FD jmp _.L485 4663 _.LVL512: 4664 _.L488: 4665 _.LBB133: 1690:fatfs.c **** goto ckok; 4666 .loc 1 1690 0 0 0000675D 3DFF3F cmp ax, 16383 0 00006760 7603E962FE ja _.L486 1692:fatfs.c **** } 4669 .loc 1 1692 0 0 00006765 B102 mov cl, 2 4671 _.LVL513: 0 00006767 D3E0 shl ax, cl 4673 _.LVL514: 0 00006769 B90300 mov cx, 3 0 0000676C 31D2 xor dx, dx 0 0000676E F7F1 div cx 0 00006770 91 xchg cx, ax 4678 _.LVL515: 0 00006771 E944FE jmp _.L489 4680 _.LBE133: 4681 _.LFE43: 4682 .size _bpb_to_dpb, .-_bpb_to_dpb 4683 .global _media_check 4684 .type _media_check, @function 4685 _media_check: 4686 _.LFB45: 1765:fatfs.c **** int ret; 4687 .loc 1 1765 0 4688 _.LVL516: 0 00006774 56 push si 0 00006775 57 push di 0 00006776 55 push bp 4692 _.LCFI82: 0 00006777 89E5 mov bp, sp 4694 _.LCFI83: 0 00006779 1E push ds 0 0000677A 8B5E08 mov bx, word ptr [bp+8] 0 0000677D 8B760A mov si, word ptr [bp+10] 1767:fatfs.c **** return DE_INVLDDRV; 4698 .loc 1 1767 0 0 00006780 89D8 mov ax, bx 0 00006782 09F0 or ax, si 0 00006784 7503E98800 je _.L502 1771:fatfs.c **** if (ret < SUCCESS) 4702 .loc 1 1771 0 0 00006789 56 push si 0 0000678A 53 push bx 0 0000678B 895EFE mov word ptr [bp-2], bx 0 0000678E B001 mov al, 1 0 00006790 50 push ax 0 00006791 E8A1E7 call _rqblockio 4709 _.LVL517: 1772:fatfs.c **** return ret; 4710 .loc 1 1772 0 0 00006794 85C0 test ax, ax 0 00006796 7C7C jl _.L496 1775:fatfs.c **** { 4713 .loc 1 1775 0 0 00006798 BF[0000] mov di, offset _MediaReqHdr 0 0000679B 8EC6 mov es, si 0 0000679D 8B5EFE mov bx, word ptr [bp-2] 0 000067A0 268A4718 mov al, byte ptr es:[bx+24] 4718 _.LVL518: 0 000067A4 360A450E or al, byte ptr ss:[di+14] 0 000067A8 744F je _.L500 0 000067AA 3C01 cmp al, 1 0 000067AC 745F je _.L504 4723 _.L499: 1793:fatfs.c **** ret = rqblockio(C_BLDBPB, dpbp); 4724 .loc 1 1793 0 0 000067AE 8EC6 mov es, si 0 000067B0 268A07 mov al, byte ptr es:[bx] 0 000067B3 895EFE mov word ptr [bp-2], bx 0 000067B6 98 cbw 0 000067B7 50 push ax 0 000067B8 E8[FEFF] call _setinvld 4731 _.LVL519: 1794:fatfs.c **** if (ret < SUCCESS) 4732 .loc 1 1794 0 0 000067BB 56 push si 0 000067BC 8B5EFE mov bx, word ptr [bp-2] 0 000067BF 53 push bx 0 000067C0 B002 mov al, 2 0 000067C2 50 push ax 0 000067C3 E86FE7 call _rqblockio 4739 _.LVL520: 1795:fatfs.c **** return ret; 4740 .loc 1 1795 0 0 000067C6 85C0 test ax, ax 0 000067C8 7C4A jl _.L496 1800:fatfs.c **** FP_SEG(dpbp) == FP_SEG(&os_major)); 4743 .loc 1 1800 0 0 000067CA 8E5D12 mov ds, word ptr [di+18] 0 000067CD 368B4D14 mov cx, word ptr ss:[di+20] 0 000067D1 B201 mov dl, 1 1799:fatfs.c **** MediaReqHdr.r_bpptr->bpb_nfsect == 0 || 4747 .loc 1 1799 0 0 000067D3 8EC1 mov es, cx 0 000067D5 8CDB mov bx, ds 0 000067D7 26837F0B00 cmp word ptr es:[bx+11], 0 0 000067DC 8B5EFE mov bx, word ptr [bp-2] 0 000067DF 740A je _.L501 1799:fatfs.c **** MediaReqHdr.r_bpptr->bpb_nfsect == 0 || 4753 .loc 1 1799 0 is_stmt 0 discriminator 2 0 000067E1 8CD0 mov ax, ss 4755 _.LVL521: 0 000067E3 39F0 cmp ax, si 0 000067E5 9F lahf 0 000067E6 D0E4 shl ah, 1 0 000067E8 99 cwd 0 000067E9 F6DA neg dl 4761 _.L501: 1799:fatfs.c **** MediaReqHdr.r_bpptr->bpb_nfsect == 0 || 4762 .loc 1 1799 0 discriminator 6 0 000067EB 30F6 xor dh, dh 0 000067ED 52 push dx 0 000067EE 56 push si 0 000067EF 53 push bx 0 000067F0 51 push cx 0 000067F1 1E push ds 0 000067F2 16 push ss 0 000067F3 1F pop ds 0 000067F4 E8[FEFF] call _bpb_to_dpb 4772 _.LVL522: 0 000067F7 EB14 jmp _.L504 4774 _.L500: 1786:fatfs.c **** return SUCCESS; 4775 .loc 1 1786 0 is_stmt 1 0 000067F9 8EC6 mov es, si 0 000067FB 268A07 mov al, byte ptr es:[bx] 0 000067FE 895EFE mov word ptr [bp-2], bx 0 00006801 98 cbw 0 00006802 50 push ax 0 00006803 E8[FEFF] call _dirty_buffers 4782 _.LVL523: 0 00006806 85C0 test ax, ax 0 00006808 8B5EFE mov bx, word ptr [bp-2] 0 0000680B 74A1 je _.L499 4786 _.L504: 1787:fatfs.c **** 4787 .loc 1 1787 0 0 0000680D 31C0 xor ax, ax 0 0000680F EB03 jmp _.L496 4790 _.L502: 1768:fatfs.c **** 4791 .loc 1 1768 0 0 00006811 B8F1FF mov ax, -15 4793 _.L496: 1807:fatfs.c **** 4794 .loc 1 1807 0 0 00006814 89EC mov sp, bp 0 00006816 5D pop bp 0 00006817 5F pop di 0 00006818 5E pop si 0 00006819 C20400 ret 4 4800 _.LFE45: 4801 .size _media_check, .-_media_check 4802 .local _startoffset.2547 4803 .comm _startoffset.2547,4,2 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: fattab.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=fattab.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc8QxObi.s output file : fattab.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:54.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: === Switch to base=012BB0h -> ".RODATA.STR1.1" 7 .section .rodata.str1.1,"aMS",@progbits,1 8 _.LC0: 0 00001940 52756E2063686B64 .string "Run chkdsk: Bad FAT " 0 00001948 736B3A2042616420 0 00001950 4641542000 === Switch to base=002270h -> ".TEXT" 10 .text 11 .global _clusterMessage 12 .type _clusterMessage, @function 13 _clusterMessage: 14 _.LFB4: 15 .file 1 "fattab.c" 1:fattab.c **** /****************************************************************/ 2:fattab.c **** /* */ 3:fattab.c **** /* fattab.c */ 4:fattab.c **** /* */ 5:fattab.c **** /* FAT File System Table Functions */ 6:fattab.c **** /* */ 7:fattab.c **** /* Copyright (c) 1995 */ 8:fattab.c **** /* Pasquale J. Villani */ 9:fattab.c **** /* All Rights Reserved */ 10:fattab.c **** /* */ 11:fattab.c **** /* This file is part of DOS-C. */ 12:fattab.c **** /* */ 13:fattab.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:fattab.c **** /* modify it under the terms of the GNU General Public License */ 15:fattab.c **** /* as published by the Free Software Foundation; either version */ 16:fattab.c **** /* 2, or (at your option) any later version. */ 17:fattab.c **** /* */ 18:fattab.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:fattab.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:fattab.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:fattab.c **** /* the GNU General Public License for more details. */ 22:fattab.c **** /* */ 23:fattab.c **** /* You should have received a copy of the GNU General Public */ 24:fattab.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:fattab.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:fattab.c **** /* Cambridge, MA 02139, USA. */ 27:fattab.c **** /****************************************************************/ 28:fattab.c **** 29:fattab.c **** #include "portab.h" 30:fattab.c **** #include "globals.h" 31:fattab.c **** 32:fattab.c **** #ifdef VERSION_STRINGS 33:fattab.c **** static BYTE *RcsId = 34:fattab.c **** "$Id: fattab.c 1631 2011-06-13 16:27:34Z bartoldeman $"; 35:fattab.c **** #endif 36:fattab.c **** 37:fattab.c **** /************************************************************************/ 38:fattab.c **** /* */ 39:fattab.c **** /* cluster/sector routines */ 40:fattab.c **** /* */ 41:fattab.c **** /************************************************************************/ 42:fattab.c **** 43:fattab.c **** /* special "impossible" "Cluster2" value of 1 denotes reading the 44:fattab.c **** cluster number rather than overwriting it */ 45:fattab.c **** #define READ_CLUSTER 1 46:fattab.c **** 47:fattab.c **** #ifndef ISFAT32 48:fattab.c **** int ISFAT32(struct dpb FAR * dpbp) 49:fattab.c **** { 50:fattab.c **** return _ISFAT32(dpbp); 51:fattab.c **** } 52:fattab.c **** #endif 53:fattab.c **** 54:fattab.c **** void clusterMessage(const char * msg, CLUSTER clussec) 55:fattab.c **** { 16 .loc 1 55 0 17 _.LVL0: 0 0000681C 56 push si 0 0000681D 57 push di 0 0000681E 55 push bp 21 _.LCFI0: 0 0000681F 89E5 mov bp, sp 23 _.LCFI1: 0 00006821 1E push ds 0 00006822 1E push ds 0 00006823 8B7E0A mov di, word ptr [bp+10] 0 00006826 8B460C mov ax, word ptr [bp+12] 0 00006829 8946FE mov word ptr [bp-2], ax 56:fattab.c **** put_string("Run chkdsk: Bad FAT "); 29 .loc 1 56 0 0 0000682C B8[0000] mov ax, offset _.LC0 0 0000682F 50 push ax 0 00006830 E8[FEFF] call _put_string 33 _.LVL1: 57:fattab.c **** put_string(msg); 34 .loc 1 57 0 0 00006833 FF7608 push word ptr [bp+8] 0 00006836 E8[FEFF] call _put_string 37 _.LVL2: 58:fattab.c **** #ifdef WITHFAT32 59:fattab.c **** put_unsigned((unsigned)(clussec >> 16), 16, 4); 38 .loc 1 59 0 0 00006839 BA0400 mov dx, 4 0 0000683C 52 push dx 0 0000683D 8956FC mov word ptr [bp-4], dx 0 00006840 BE1000 mov si, 16 0 00006843 56 push si 0 00006844 FF76FE push word ptr [bp-2] 0 00006847 E8[FEFF] call _put_unsigned 46 _.LVL3: 60:fattab.c **** #endif 61:fattab.c **** put_unsigned((unsigned)(clussec & 0xffffu), 16, 4); 47 .loc 1 61 0 0 0000684A 8B56FC mov dx, word ptr [bp-4] 0 0000684D 52 push dx 0 0000684E 56 push si 0 0000684F 57 push di 0 00006850 E8[FEFF] call _put_unsigned 53 _.LVL4: 62:fattab.c **** put_console('\n'); 54 .loc 1 62 0 0 00006853 B80A00 mov ax, 10 0 00006856 50 push ax 0 00006857 E8[FEFF] call _put_console 58 _.LVL5: 63:fattab.c **** } 59 .loc 1 63 0 0 0000685A 89EC mov sp, bp 0 0000685C 5D pop bp 0 0000685D 5F pop di 0 0000685E 5E pop si 0 0000685F C20600 ret 6 65 _.LFE4: 66 .size _clusterMessage, .-_clusterMessage === Switch to base=012BB0h -> ".RODATA.STR1.1" 67 .section .rodata.str1.1 68 _.LC1: 0 00001955 492F4F3A20307800 .string "I/O: 0x" === Switch to base=002270h -> ".TEXT" 70 .text 71 .global _getFATblock 72 .type _getFATblock, @function 73 _getFATblock: 74 _.LFB5: 64:fattab.c **** 65:fattab.c **** struct buffer FAR *getFATblock(struct dpb FAR * dpbp, CLUSTER clussec) 66:fattab.c **** { 75 .loc 1 66 0 76 _.LVL6: 0 00006862 56 push si 0 00006863 57 push di 0 00006864 55 push bp 80 _.LCFI2: 0 00006865 89E5 mov bp, sp 82 _.LCFI3: 0 00006867 1E push ds 0 00006868 1E push ds 0 00006869 8B7608 mov si, word ptr [bp+8] 0 0000686C 8B460A mov ax, word ptr [bp+10] 0 0000686F 8946FE mov word ptr [bp-2], ax 0 00006872 8B4E0C mov cx, word ptr [bp+12] 0 00006875 8B7E0E mov di, word ptr [bp+14] 67:fattab.c **** /* *** why dpbp->dpb_unit? only useful to know in context of the dpbp...? *** */ 68:fattab.c **** struct buffer FAR *bp = getblock(clussec, dpbp->dpb_unit); 90 .loc 1 68 0 0 00006878 31C0 xor ax, ax 0 0000687A 50 push ax 0 0000687B 8E46FE mov es, word ptr [bp-2] 0 0000687E 268A04 mov al, byte ptr es:[si] 0 00006881 98 cbw 0 00006882 50 push ax 0 00006883 57 push di 0 00006884 51 push cx 0 00006885 894EFC mov word ptr [bp-4], cx 0 00006888 E8[FEFF] call _getblk 101 _.LVL7: 0 0000688B 89C3 mov bx, ax 103 _.LVL8: 69:fattab.c **** 70:fattab.c **** if (bp) 104 .loc 1 70 0 0 0000688D 09D0 or ax, dx 106 _.LVL9: 0 0000688F 8B4EFC mov cx, word ptr [bp-4] 0 00006892 7457 je _.L4 71:fattab.c **** { 72:fattab.c **** bp->b_flag &= ~(BFR_DATA | BFR_DIR); 109 .loc 1 72 0 0 00006894 8EC2 mov es, dx 0 00006896 268A4705 mov al, byte ptr es:[bx+5] 0 0000689A 8846FC mov byte ptr [bp-4], al 0 0000689D 24F3 and al, -13 73:fattab.c **** bp->b_flag |= BFR_FAT | BFR_VALID; 114 .loc 1 73 0 0 0000689F 0C22 or al, 34 0 000068A1 26884705 mov byte ptr es:[bx+5], al 117 _.LVL10: 74:fattab.c **** bp->b_dpbp = dpbp; 118 .loc 1 74 0 0 000068A5 2689770D mov word ptr es:[bx+13], si 0 000068A9 8B46FE mov ax, word ptr [bp-2] 0 000068AC 2689470F mov word ptr es:[bx+15], ax 75:fattab.c **** bp->b_copies = dpbp->dpb_fats; 122 .loc 1 75 0 0 000068B0 8E46FE mov es, word ptr [bp-2] 0 000068B3 268A4408 mov al, byte ptr es:[si+8] 0 000068B7 8EC2 mov es, dx 0 000068B9 2688470A mov byte ptr es:[bx+10], al 76:fattab.c **** bp->b_offset = dpbp->dpb_fatsize; /* 0 for FAT32 but blockio.c knows that */ 127 .loc 1 76 0 0 000068BD 8E46FE mov es, word ptr [bp-2] 0 000068C0 268B440F mov ax, word ptr es:[si+15] 0 000068C4 8EC2 mov es, dx 0 000068C6 2689470B mov word ptr es:[bx+11], ax 77:fattab.c **** #ifdef WITHFAT32 78:fattab.c **** if (ISFAT32(dpbp)) 132 .loc 1 78 0 0 000068CA 8E46FE mov es, word ptr [bp-2] 0 000068CD 26837C0F00 cmp word ptr es:[si+15], 0 0 000068D2 750E jne _.L3 79:fattab.c **** { 80:fattab.c **** if (dpbp->dpb_xflags & FAT_NO_MIRRORING) 136 .loc 1 80 0 0 000068D4 26F6442380 test byte ptr es:[si+35], -128 0 000068D9 7407 je _.L3 81:fattab.c **** bp->b_copies = 1; 139 .loc 1 81 0 0 000068DB 8EC2 mov es, dx 0 000068DD 26C6470A01 mov byte ptr es:[bx+10], 1 142 _.LVL11: 143 _.L3: 82:fattab.c **** } 83:fattab.c **** #endif 84:fattab.c **** } else { 85:fattab.c **** clusterMessage("I/O: 0x",clussec); 86:fattab.c **** } 87:fattab.c **** return bp; 88:fattab.c **** } 144 .loc 1 88 0 0 000068E2 93 xchg bx, ax 0 000068E3 89EC mov sp, bp 0 000068E5 5D pop bp 0 000068E6 5F pop di 0 000068E7 5E pop si 0 000068E8 C20800 ret 8 151 _.LVL12: 152 _.L4: 0 000068EB 8956FC mov word ptr [bp-4], dx 0 000068EE 895EFE mov word ptr [bp-2], bx 85:fattab.c **** } 155 .loc 1 85 0 0 000068F1 57 push di 0 000068F2 51 push cx 0 000068F3 B8[1500] mov ax, offset _.LC1 0 000068F6 50 push ax 0 000068F7 E8[FEFF] call _clusterMessage 161 _.LVL13: 0 000068FA 8B56FC mov dx, word ptr [bp-4] 0 000068FD 8B5EFE mov bx, word ptr [bp-2] 87:fattab.c **** } 164 .loc 1 87 0 0 00006900 EBE0 jmp _.L3 166 _.LFE5: 167 .size _getFATblock, .-_getFATblock 168 .global _read_fsinfo 169 .type _read_fsinfo, @function 170 _read_fsinfo: 171 _.LFB6: 89:fattab.c **** 90:fattab.c **** #ifdef WITHFAT32 91:fattab.c **** void read_fsinfo(struct dpb FAR * dpbp) 92:fattab.c **** { 172 .loc 1 92 0 173 _.LVL14: 0 00006902 56 push si 0 00006903 57 push di 0 00006904 55 push bp 177 _.LCFI4: 0 00006905 89E5 mov bp, sp 179 _.LCFI5: 0 00006907 83EC06 sub sp, 6 0 0000690A 8B5E08 mov bx, word ptr [bp+8] 0 0000690D 8B460A mov ax, word ptr [bp+10] 0 00006910 8946FE mov word ptr [bp-2], ax 93:fattab.c **** struct buffer FAR *bp; 94:fattab.c **** struct fsinfo FAR *fip; 95:fattab.c **** CLUSTER cluster; 96:fattab.c **** 97:fattab.c **** if (dpbp->dpb_xfsinfosec == 0xffff) 184 .loc 1 97 0 0 00006913 8EC0 mov es, ax 0 00006915 268B5725 mov dx, word ptr es:[bx+37] 0 00006919 83FAFF cmp dx, -1 0 0000691C 7503E99100 je _.L11 98:fattab.c **** return; 99:fattab.c **** 100:fattab.c **** bp = getblock(dpbp->dpb_xfsinfosec, dpbp->dpb_unit); 189 .loc 1 100 0 0 00006921 31C9 xor cx, cx 0 00006923 51 push cx 0 00006924 268A07 mov al, byte ptr es:[bx] 0 00006927 895EFA mov word ptr [bp-6], bx 0 0000692A 98 cbw 0 0000692B 50 push ax 0 0000692C 51 push cx 0 0000692D 52 push dx 0 0000692E E8[FEFF] call _getblk 199 _.LVL15: 101:fattab.c **** bp->b_flag &= ~(BFR_DATA | BFR_DIR | BFR_FAT | BFR_DIRTY); 200 .loc 1 101 0 0 00006931 8EC2 mov es, dx 0 00006933 89C3 mov bx, ax 0 00006935 268A4F05 mov cl, byte ptr es:[bx+5] 0 00006939 884EFC mov byte ptr [bp-4], cl 0 0000693C 80E1B1 and cl, -79 102:fattab.c **** bp->b_flag |= BFR_VALID; 206 .loc 1 102 0 0 0000693F 80C920 or cl, 32 0 00006942 26884F05 mov byte ptr es:[bx+5], cl 209 _.LVL16: 103:fattab.c **** 104:fattab.c **** fip = (struct fsinfo FAR *)&bp->b_buffer[0x1e4]; 105:fattab.c **** /* need to range check values because they may not be correct */ 106:fattab.c **** cluster = fip->fi_nfreeclst; 210 .loc 1 106 0 0 00006946 268B8FFC01 mov cx, word ptr es:[bx+508] 0 0000694B 268BB7FE01 mov si, word ptr es:[bx+510] 213 _.LVL17: 107:fattab.c **** if (cluster >= dpbp->dpb_xsize) 214 .loc 1 107 0 0 00006950 8E46FE mov es, word ptr [bp-2] 0 00006953 8B5EFA mov bx, word ptr [bp-6] 0 00006956 268B7F2D mov di, word ptr es:[bx+45] 0 0000695A 897EFC mov word ptr [bp-4], di 0 0000695D 268B7F2F mov di, word ptr es:[bx+47] 0 00006961 39F7 cmp di, si 0 00006963 770C ja _.L13 0 00006965 7505 jne _.L21 0 00006967 394EFC cmp word ptr [bp-4], cx 0 0000696A 7705 ja _.L13 225 _.L21: 108:fattab.c **** cluster = XUNKNCLSTFREE; 226 .loc 1 108 0 0 0000696C B9FFFF mov cx, -1 228 _.LVL18: 0 0000696F 89CE mov si, cx 230 _.L13: 231 _.LVL19: 109:fattab.c **** dpbp->dpb_xnfreeclst = cluster; 232 .loc 1 109 0 0 00006971 8E46FE mov es, word ptr [bp-2] 0 00006974 26894F1F mov word ptr es:[bx+31], cx 0 00006978 8E46FE mov es, word ptr [bp-2] 0 0000697B 26897721 mov word ptr es:[bx+33], si 110:fattab.c **** cluster = fip->fi_cluster; 237 .loc 1 110 0 0 0000697F 8EC2 mov es, dx 0 00006981 96 xchg si, ax 240 _.LVL20: 0 00006982 268B8C0002 mov cx, word ptr es:[si+512] 0 00006987 268B840202 mov ax, word ptr es:[si+514] 243 _.LVL21: 111:fattab.c **** if (cluster < 2 || cluster > dpbp->dpb_xsize) 244 .loc 1 111 0 0 0000698C 39F8 cmp ax, di 0 0000698E 7710 ja _.L22 0 00006990 7505 jne _.L18 0 00006992 3B4EFC cmp cx, word ptr [bp-4] 0 00006995 7709 ja _.L22 250 _.L18: 0 00006997 85C0 test ax, ax 0 00006999 7509 jne _.L15 0 0000699B 83F901 cmp cx, 1 0 0000699E 7704 ja _.L15 255 _.L22: 112:fattab.c **** cluster = UNKNCLUSTER; 256 .loc 1 112 0 0 000069A0 31C9 xor cx, cx 258 _.LVL22: 0 000069A2 89C8 mov ax, cx 260 _.LVL23: 261 _.L15: 113:fattab.c **** dpbp->dpb_xcluster = cluster; 262 .loc 1 113 0 0 000069A4 8E46FE mov es, word ptr [bp-2] 0 000069A7 26894F39 mov word ptr es:[bx+57], cx 0 000069AB 8E46FE mov es, word ptr [bp-2] 0 000069AE 2689473B mov word ptr es:[bx+59], ax 267 _.LVL24: 268 _.L11: 114:fattab.c **** } 269 .loc 1 114 0 0 000069B2 89EC mov sp, bp 0 000069B4 5D pop bp 0 000069B5 5F pop di 0 000069B6 5E pop si 0 000069B7 C20400 ret 4 275 _.LFE6: 276 .size _read_fsinfo, .-_read_fsinfo 277 .global _write_fsinfo 278 .type _write_fsinfo, @function 279 _write_fsinfo: 280 _.LFB7: 115:fattab.c **** 116:fattab.c **** void write_fsinfo(struct dpb FAR * dpbp) 117:fattab.c **** { 281 .loc 1 117 0 282 _.LVL25: 0 000069BA 56 push si 0 000069BB 57 push di 0 000069BC 55 push bp 286 _.LCFI6: 0 000069BD 89E5 mov bp, sp 288 _.LCFI7: 0 000069BF 1E push ds 0 000069C0 1E push ds 118:fattab.c **** struct buffer FAR *bp; 119:fattab.c **** struct fsinfo FAR *fip; 120:fattab.c **** 121:fattab.c **** if (dpbp->dpb_xfsinfosec == 0xffff) 291 .loc 1 121 0 0 000069C1 C45E08 les bx, dword ptr [bp+8] 0 000069C4 8CC6 mov si, es 0 000069C6 268B5725 mov dx, word ptr es:[bx+37] 0 000069CA 83FAFF cmp dx, -1 0 000069CD 7503E9AE00 je _.L30 122:fattab.c **** return; 123:fattab.c **** 124:fattab.c **** bp = getblock(dpbp->dpb_xfsinfosec, dpbp->dpb_unit); 297 .loc 1 124 0 0 000069D2 31C9 xor cx, cx 0 000069D4 51 push cx 0 000069D5 268A07 mov al, byte ptr es:[bx] 0 000069D8 895EFC mov word ptr [bp-4], bx 0 000069DB 98 cbw 0 000069DC 50 push ax 0 000069DD 51 push cx 0 000069DE 52 push dx 0 000069DF E8[FEFF] call _getblk 307 _.LVL26: 125:fattab.c **** bp->b_flag &= ~(BFR_DATA | BFR_DIR | BFR_FAT); 308 .loc 1 125 0 0 000069E2 8EC2 mov es, dx 0 000069E4 89C3 mov bx, ax 0 000069E6 268A4F05 mov cl, byte ptr es:[bx+5] 0 000069EA 884EFF mov byte ptr [bp-1], cl 0 000069ED 80E1F1 and cl, -15 126:fattab.c **** bp->b_flag |= BFR_VALID; 314 .loc 1 126 0 0 000069F0 88CD mov ch, cl 0 000069F2 80CD20 or ch, 32 0 000069F5 26886F05 mov byte ptr es:[bx+5], ch 318 _.LVL27: 127:fattab.c **** 128:fattab.c **** fip = (struct fsinfo FAR *)&bp->b_buffer[0x1e4]; 129:fattab.c **** 130:fattab.c **** if (fip->fi_nfreeclst != dpbp->dpb_xnfreeclst || 319 .loc 1 130 0 0 000069F9 268B9FFC01 mov bx, word ptr es:[bx+508] 0 000069FE 8EC6 mov es, si 0 00006A00 89DF mov di, bx 0 00006A02 8B5EFC mov bx, word ptr [bp-4] 0 00006A05 263B7F1F cmp di, word ptr es:[bx+31] 0 00006A09 7533 jne _.L32 0 00006A0B 8EC2 mov es, dx 0 00006A0D 89C7 mov di, ax 0 00006A0F 268BBDFE01 mov di, word ptr es:[di+510] 0 00006A14 8EC6 mov es, si 0 00006A16 263B7F21 cmp di, word ptr es:[bx+33] 0 00006A1A 7522 jne _.L32 332 .loc 1 130 0 is_stmt 0 discriminator 1 0 00006A1C 8EC2 mov es, dx 0 00006A1E 89C7 mov di, ax 0 00006A20 268BBD0002 mov di, word ptr es:[di+512] 0 00006A25 8EC6 mov es, si 0 00006A27 263B7F39 cmp di, word ptr es:[bx+57] 0 00006A2B 7511 jne _.L32 0 00006A2D 8EC2 mov es, dx 0 00006A2F 89C7 mov di, ax 0 00006A31 268BBD0202 mov di, word ptr es:[di+514] 0 00006A36 8EC6 mov es, si 0 00006A38 263B7F3B cmp di, word ptr es:[bx+59] 0 00006A3C 740B je _.L33 345 _.L32: 131:fattab.c **** fip->fi_cluster != dpbp->dpb_xcluster) 132:fattab.c **** bp->b_flag |= BFR_DIRTY; /* only flag for update if we had real news */ 346 .loc 1 132 0 is_stmt 1 0 00006A3E 80C960 or cl, 96 0 00006A41 8EC2 mov es, dx 0 00006A43 89C7 mov di, ax 0 00006A45 26884D05 mov byte ptr es:[di+5], cl 351 _.L33: 133:fattab.c **** 134:fattab.c **** fip->fi_nfreeclst = dpbp->dpb_xnfreeclst; 352 .loc 1 134 0 0 00006A49 8EC6 mov es, si 0 00006A4B 268B4F1F mov cx, word ptr es:[bx+31] 0 00006A4F 8EC2 mov es, dx 0 00006A51 89C7 mov di, ax 0 00006A53 26898DFC01 mov word ptr es:[di+508], cx 0 00006A58 8EC6 mov es, si 0 00006A5A 268B4F21 mov cx, word ptr es:[bx+33] 0 00006A5E 8EC2 mov es, dx 0 00006A60 26898DFE01 mov word ptr es:[di+510], cx 135:fattab.c **** fip->fi_cluster = dpbp->dpb_xcluster; 362 .loc 1 135 0 0 00006A65 8EC6 mov es, si 0 00006A67 268B4F39 mov cx, word ptr es:[bx+57] 0 00006A6B 8EC2 mov es, dx 0 00006A6D 26898D0002 mov word ptr es:[di+512], cx 0 00006A72 8EC6 mov es, si 0 00006A74 268B4F3B mov cx, word ptr es:[bx+59] 0 00006A78 8EC2 mov es, dx 0 00006A7A 93 xchg bx, ax 0 00006A7B 26898F0202 mov word ptr es:[bx+514], cx 372 _.LVL28: 373 _.L30: 136:fattab.c **** } 374 .loc 1 136 0 0 00006A80 89EC mov sp, bp 0 00006A82 5D pop bp 0 00006A83 5F pop di 0 00006A84 5E pop si 0 00006A85 C20400 ret 4 380 _.LFE7: 381 .size _write_fsinfo, .-_write_fsinfo === Switch to base=012BB0h -> ".RODATA.STR1.1" 382 .section .rodata.str1.1 383 _.LC2: 0 0000195D 696E6465783A2030 .string "index: 0x" 0 00001965 7800 385 _.LC3: 0 00001967 77726974653A2030 .string "write: 0x" 0 0000196F 7800 387 _.LC4: 0 00001971 4261642044504221 .string "Bad DPB!\n" 0 00001979 0A00 === Switch to base=002270h -> ".TEXT" 389 .text 390 .global _link_fat 391 .type _link_fat, @function 392 _link_fat: 393 _.LFB8: 137:fattab.c **** #endif 138:fattab.c **** 139:fattab.c **** /* */ 140:fattab.c **** /* The FAT file system is difficult to trace through FAT table. */ 141:fattab.c **** /* There are two kinds of FATs, 12 bit and 16 bit. The 16 bit */ 142:fattab.c **** /* FAT is the easiest, since it is nothing more than a series */ 143:fattab.c **** /* of UWORDs. The 12 bit FAT is difficult, because it packs 3 */ 144:fattab.c **** /* FAT entries into two BYTEs. These are packed as follows: */ 145:fattab.c **** /* */ 146:fattab.c **** /* 0x0003 0x0004 0x0005 0x0006 0x0007 0x0008 0x0009 ... */ 147:fattab.c **** /* */ 148:fattab.c **** /* are packed as */ 149:fattab.c **** /* */ 150:fattab.c **** /* 0x03 0x40 0x00 0x05 0x60 0x00 0x07 0x80 0x00 0x09 ... */ 151:fattab.c **** /* */ 152:fattab.c **** /* 12 bytes are compressed to 9 bytes */ 153:fattab.c **** /* */ 154:fattab.c **** 155:fattab.c **** /* either read the value at Cluster1 (if Cluster2 is READ_CLUSTER) */ 156:fattab.c **** /* or write the Cluster2 value to the FAT entry at Cluster1 */ 157:fattab.c **** /* Read is always via next_cluster wrapper which has extra checks */ 158:fattab.c **** /* It might make sense to manually check old values before a write */ 159:fattab.c **** /* returns: the cluster number (or 1 on error) for read mode */ 160:fattab.c **** /* returns: SUCCESS (or 1 on error) for write mode */ 161:fattab.c **** CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, 162:fattab.c **** REG CLUSTER Cluster2) 163:fattab.c **** { 394 .loc 1 163 0 395 _.LVL29: 0 00006A88 56 push si 0 00006A89 57 push di 0 00006A8A 55 push bp 399 _.LCFI8: 0 00006A8B 89E5 mov bp, sp 401 _.LCFI9: 0 00006A8D 83EC14 sub sp, 20 0 00006A90 C44608 les ax, dword ptr [bp+8] 0 00006A93 8946FE mov word ptr [bp-2], ax 0 00006A96 8C46FC mov word ptr [bp-4], es 0 00006A99 8B460C mov ax, word ptr [bp+12] 0 00006A9C 8946F4 mov word ptr [bp-12], ax 0 00006A9F 8B760E mov si, word ptr [bp+14] 0 00006AA2 C44610 les ax, dword ptr [bp+16] 0 00006AA5 8946FA mov word ptr [bp-6], ax 0 00006AA8 8C46F2 mov word ptr [bp-14], es 412 _.LVL30: 164:fattab.c **** struct buffer FAR *bp; 165:fattab.c **** unsigned idx; 166:fattab.c **** unsigned secdiv; /* FAT entries per sector; nibbles for FAT12! */ 167:fattab.c **** unsigned char wasfree; 168:fattab.c **** CLUSTER clussec = Cluster1; 169:fattab.c **** CLUSTER max_cluster = dpbp->dpb_size; 413 .loc 1 169 0 0 00006AAB 8E46FC mov es, word ptr [bp-4] 0 00006AAE 8B5EFE mov bx, word ptr [bp-2] 0 00006AB1 268B470D mov ax, word ptr es:[bx+13] 417 _.LVL31: 170:fattab.c **** 171:fattab.c **** #ifdef WITHFAT32 172:fattab.c **** if (ISFAT32(dpbp)) 418 .loc 1 172 0 0 00006AB5 268B5F0F mov bx, word ptr es:[bx+15] 0 00006AB9 85DB test bx, bx 0 00006ABB 7421 je _.L40 169:fattab.c **** 422 .loc 1 169 0 0 00006ABD 89C1 mov cx, ax 0 00006ABF 31D2 xor dx, dx 425 _.LVL32: 426 _.L41: 173:fattab.c **** max_cluster = dpbp->dpb_xsize; 174:fattab.c **** #endif 175:fattab.c **** 176:fattab.c **** if (clussec <= 1 || clussec > max_cluster) /* try to read out of range? */ 427 .loc 1 176 0 0 00006AC1 85F6 test si, si 0 00006AC3 7529 jne _.L45 0 00006AC5 837EF401 cmp word ptr [bp-12], 1 0 00006AC9 7727 ja _.L107 432 _.L88: 177:fattab.c **** { 178:fattab.c **** clusterMessage("index: 0x",clussec); /* bad array offset */ 433 .loc 1 178 0 0 00006ACB 56 push si 0 00006ACC FF76F4 push word ptr [bp-12] 0 00006ACF B8[1D00] mov ax, offset _.LC2 437 _.L121: 179:fattab.c **** return 1; 180:fattab.c **** } 181:fattab.c **** 182:fattab.c **** /* Cluster2 can 0 (FREE) or 1 (READ_CLUSTER), a cluster nr. >= 2, */ 183:fattab.c **** /* (range check this case!) LONG_LAST_CLUSTER or LONG_BAD here... */ 184:fattab.c **** if (Cluster2 < LONG_BAD && Cluster2 > max_cluster) /* writing bad value? */ 185:fattab.c **** { 186:fattab.c **** clusterMessage("write: 0x",Cluster2); /* refuse to write bad value */ 438 .loc 1 186 0 0 00006AD2 50 push ax 0 00006AD3 E8[FEFF] call _clusterMessage 441 _.LVL33: 442 _.L117: 187:fattab.c **** return 1; 188:fattab.c **** } 189:fattab.c **** 190:fattab.c **** secdiv = dpbp->dpb_secsize; 191:fattab.c **** if (ISFAT12(dpbp)) 192:fattab.c **** { 193:fattab.c **** clussec = (unsigned)clussec * 3; 194:fattab.c **** secdiv *= 2; 195:fattab.c **** } 196:fattab.c **** else /* FAT16 or FAT32 */ 197:fattab.c **** { 198:fattab.c **** secdiv /= 2; 199:fattab.c **** #ifdef WITHFAT32 200:fattab.c **** if (ISFAT32(dpbp)) 201:fattab.c **** secdiv /= 2; 202:fattab.c **** #endif 203:fattab.c **** } 204:fattab.c **** 205:fattab.c **** /* idx is a pointer to an index which is the nibble offset of the FAT 206:fattab.c **** entry within the sector for FAT12, or word offset for FAT16, or 207:fattab.c **** dword offset for FAT32 */ 208:fattab.c **** idx = (unsigned)(clussec % secdiv); 209:fattab.c **** clussec /= secdiv; 210:fattab.c **** clussec += dpbp->dpb_fatstrt; 211:fattab.c **** #ifdef WITHFAT32 212:fattab.c **** if (ISFAT32(dpbp) && (dpbp->dpb_xflags & FAT_NO_MIRRORING)) 213:fattab.c **** { 214:fattab.c **** /* we must modify the active fat, 215:fattab.c **** it's number is in the 0-3 bits of dpb_xflags */ 216:fattab.c **** clussec += (dpbp->dpb_xflags & 0xf) * dpbp->dpb_xfatsize; 217:fattab.c **** } 218:fattab.c **** #endif 219:fattab.c **** 220:fattab.c **** /* Get the block that this cluster is in */ 221:fattab.c **** bp = getFATblock(dpbp, clussec); 222:fattab.c **** 223:fattab.c **** if (bp == NULL) { 224:fattab.c **** return 1; /* the only error code possible here */ 225:fattab.c **** } 226:fattab.c **** 227:fattab.c **** if (ISFAT12(dpbp)) 228:fattab.c **** { 229:fattab.c **** REG UBYTE FAR *fbp0; REG UBYTE FAR * fbp1; 230:fattab.c **** struct buffer FAR * bp1; 231:fattab.c **** unsigned cluster, cluster2; 232:fattab.c **** 233:fattab.c **** /* form an index so that we can read the block as a */ 234:fattab.c **** /* byte array */ 235:fattab.c **** idx /= 2; 236:fattab.c **** 237:fattab.c **** /* Test to see if the cluster straddles the block. If */ 238:fattab.c **** /* it does, get the next block and use both to form the */ 239:fattab.c **** /* the FAT word. Otherwise, just point to the next */ 240:fattab.c **** /* block. */ 241:fattab.c **** fbp0 = &bp->b_buffer[idx]; 242:fattab.c **** 243:fattab.c **** /* pointer to next byte, will be overwritten, if not valid */ 244:fattab.c **** fbp1 = fbp0 + 1; 245:fattab.c **** 246:fattab.c **** if (idx >= (unsigned)dpbp->dpb_secsize - 1) 247:fattab.c **** { 248:fattab.c **** /* blockio.c LRU logic ensures that bp != bp1 */ 249:fattab.c **** bp1 = getFATblock(dpbp, (unsigned)clussec + 1); 250:fattab.c **** if (bp1 == 0) 251:fattab.c **** return 1; /* the only error code possible here */ 252:fattab.c **** 253:fattab.c **** if (Cluster2 != READ_CLUSTER) 254:fattab.c **** bp1->b_flag |= BFR_DIRTY | BFR_VALID; 255:fattab.c **** 256:fattab.c **** fbp1 = &bp1->b_buffer[0]; 257:fattab.c **** } 258:fattab.c **** 259:fattab.c **** cluster = *fbp0 | (*fbp1 << 8); 260:fattab.c **** { 261:fattab.c **** unsigned res = cluster; 262:fattab.c **** 263:fattab.c **** /* Now to unpack the contents of the FAT entry. Odd and */ 264:fattab.c **** /* even bytes are packed differently. */ 265:fattab.c **** 266:fattab.c **** if (Cluster1 & 0x01) 267:fattab.c **** cluster >>= 4; 268:fattab.c **** cluster &= 0x0fff; 269:fattab.c **** 270:fattab.c **** if ((unsigned)Cluster2 == READ_CLUSTER) 271:fattab.c **** { 272:fattab.c **** if (cluster >= MASK12) 273:fattab.c **** return LONG_LAST_CLUSTER; 274:fattab.c **** if (cluster == BAD12) 275:fattab.c **** return LONG_BAD; 276:fattab.c **** return cluster; 277:fattab.c **** } 278:fattab.c **** 279:fattab.c **** wasfree = 0; 280:fattab.c **** if (cluster == FREE) 281:fattab.c **** wasfree = 1; 282:fattab.c **** 283:fattab.c **** cluster = res; 284:fattab.c **** } 285:fattab.c **** 286:fattab.c **** /* Cluster2 may be set to LONG_LAST_CLUSTER == 0x0FFFFFFFUL or 0xFFFF */ 287:fattab.c **** /* -- please don't remove this mask! */ 288:fattab.c **** cluster2 = (unsigned)Cluster2 & 0x0fff; 289:fattab.c **** 290:fattab.c **** /* Now pack the value in */ 291:fattab.c **** if ((unsigned)Cluster1 & 0x01) 292:fattab.c **** { 293:fattab.c **** cluster &= 0x000f; 294:fattab.c **** cluster2 <<= 4; 295:fattab.c **** } 296:fattab.c **** else 297:fattab.c **** { 298:fattab.c **** cluster &= 0xf000; 299:fattab.c **** } 300:fattab.c **** cluster |= cluster2; 301:fattab.c **** *fbp0 = (UBYTE)cluster; 302:fattab.c **** *fbp1 = (UBYTE)(cluster >> 8); 303:fattab.c **** } 304:fattab.c **** else if (ISFAT16(dpbp)) 305:fattab.c **** { 306:fattab.c **** /* form an index so that we can read the block as a */ 307:fattab.c **** /* byte array */ 308:fattab.c **** /* and get the cluster number */ 309:fattab.c **** UWORD res = fgetword(&bp->b_buffer[idx * 2]); 310:fattab.c **** if ((unsigned)Cluster2 == READ_CLUSTER) 311:fattab.c **** { 312:fattab.c **** if (res >= MASK16) 313:fattab.c **** return LONG_LAST_CLUSTER; 314:fattab.c **** if (res == BAD16) 315:fattab.c **** return LONG_BAD; 316:fattab.c **** 317:fattab.c **** return res; 318:fattab.c **** } 319:fattab.c **** /* Finally, put the word into the buffer and mark the */ 320:fattab.c **** /* buffer as dirty. */ 321:fattab.c **** fputword(&bp->b_buffer[idx * 2], (UWORD)Cluster2); 322:fattab.c **** wasfree = 0; 323:fattab.c **** if (res == FREE) 324:fattab.c **** wasfree = 1; 325:fattab.c **** } 326:fattab.c **** #ifdef WITHFAT32 327:fattab.c **** else if (ISFAT32(dpbp)) 328:fattab.c **** { 329:fattab.c **** /* form an index so that we can read the block as a */ 330:fattab.c **** /* byte array */ 331:fattab.c **** UDWORD res = fgetlong(&bp->b_buffer[idx * 4]) & LONG_LAST_CLUSTER; 332:fattab.c **** if (Cluster2 == READ_CLUSTER) 333:fattab.c **** { 334:fattab.c **** if (res > LONG_BAD) 335:fattab.c **** return LONG_LAST_CLUSTER; 336:fattab.c **** 337:fattab.c **** return res; 338:fattab.c **** } 339:fattab.c **** /* Finally, put the word into the buffer and mark the */ 340:fattab.c **** /* buffer as dirty. */ 341:fattab.c **** fputlong(&bp->b_buffer[idx * 4], Cluster2 & LONG_LAST_CLUSTER); 342:fattab.c **** wasfree = 0; 343:fattab.c **** if (res == FREE) 344:fattab.c **** wasfree = 1; 345:fattab.c **** } 346:fattab.c **** #endif 347:fattab.c **** else { 348:fattab.c **** put_string("Bad DPB!\n"); /* FAT1x size field > 65525U (see fat.h) */ 349:fattab.c **** return 1; 443 .loc 1 349 0 0 00006AD6 B80100 mov ax, 1 445 _.LVL34: 446 _.L118: 0 00006AD9 31D2 xor dx, dx 0 00006ADB E95701 jmp _.L39 449 _.LVL35: 450 _.L40: 173:fattab.c **** #endif 451 .loc 1 173 0 0 00006ADE 8E46FC mov es, word ptr [bp-4] 0 00006AE1 8B7EFE mov di, word ptr [bp-2] 0 00006AE4 268B4D2D mov cx, word ptr es:[di+45] 0 00006AE8 268B552F mov dx, word ptr es:[di+47] 456 _.LVL36: 0 00006AEC EBD3 jmp _.L41 458 _.L45: 176:fattab.c **** { 459 .loc 1 176 0 0 00006AEE 39D6 cmp si, dx 0 00006AF0 77D9 ja _.L88 462 _.L107: 0 00006AF2 39D6 cmp si, dx 0 00006AF4 7505 jne _.L47 0 00006AF6 394EF4 cmp word ptr [bp-12], cx 0 00006AF9 77D0 ja _.L88 467 _.L47: 184:fattab.c **** { 468 .loc 1 184 0 0 00006AFB 817EF2FF0F cmp word ptr [bp-14], 4095 0 00006B00 771F ja _.L49 0 00006B02 7506 jne _.L97 0 00006B04 837EFAF6 cmp word ptr [bp-6], -10 0 00006B08 7717 ja _.L49 474 _.L97: 0 00006B0A 3956F2 cmp word ptr [bp-14], dx 0 00006B0D 7707 ja _.L98 0 00006B0F 7510 jne _.L49 0 00006B11 394EFA cmp word ptr [bp-6], cx 0 00006B14 760B jbe _.L49 480 _.L98: 186:fattab.c **** return 1; 481 .loc 1 186 0 0 00006B16 FF76F2 push word ptr [bp-14] 0 00006B19 FF76FA push word ptr [bp-6] 0 00006B1C B8[2700] mov ax, offset _.LC3 0 00006B1F EBB1 jmp _.L121 486 _.L49: 190:fattab.c **** if (ISFAT12(dpbp)) 487 .loc 1 190 0 0 00006B21 8E46FC mov es, word ptr [bp-4] 0 00006B24 8B7EFE mov di, word ptr [bp-2] 0 00006B27 268B7D02 mov di, word ptr es:[di+2] 491 _.LVL37: 191:fattab.c **** { 492 .loc 1 191 0 0 00006B2B 48 dec ax 0 00006B2C 3DF40F cmp ax, 4084 0 00006B2F 7603E90901 ja _.L54 193:fattab.c **** secdiv *= 2; 496 .loc 1 193 0 0 00006B34 8B4EF4 mov cx, word ptr [bp-12] 498 _.LVL38: 0 00006B37 D1E1 shl cx, 1 0 00006B39 034EF4 add cx, word ptr [bp-12] 0 00006B3C 31F6 xor si, si 502 _.LVL39: 194:fattab.c **** } 503 .loc 1 194 0 0 00006B3E D1E7 shl di, 1 505 _.LVL40: 506 _.L55: 0 00006B40 895EEE mov word ptr [bp-18], bx 508 _.LVL41: 208:fattab.c **** clussec /= secdiv; 509 .loc 1 208 0 0 00006B43 31C0 xor ax, ax 0 00006B45 50 push ax 0 00006B46 57 push di 0 00006B47 56 push si 0 00006B48 51 push cx 0 00006B49 894EF6 mov word ptr [bp-10], cx 0 00006B4C E8[FEFF] call ___umodsi3 517 _.LVL42: 0 00006B4F 8946F0 mov word ptr [bp-16], ax 519 _.LVL43: 209:fattab.c **** clussec += dpbp->dpb_fatstrt; 520 .loc 1 209 0 0 00006B52 31C0 xor ax, ax 522 _.LVL44: 0 00006B54 50 push ax 0 00006B55 57 push di 0 00006B56 56 push si 0 00006B57 8B4EF6 mov cx, word ptr [bp-10] 0 00006B5A 51 push cx 0 00006B5B E8[FEFF] call ___udivsi3 529 _.LVL45: 0 00006B5E 8946F6 mov word ptr [bp-10], ax 531 _.LVL46: 210:fattab.c **** #ifdef WITHFAT32 532 .loc 1 210 0 0 00006B61 8E46FC mov es, word ptr [bp-4] 0 00006B64 8B5EFE mov bx, word ptr [bp-2] 0 00006B67 268B7706 mov si, word ptr es:[bx+6] 0 00006B6B 31C9 xor cx, cx 0 00006B6D 01C6 add si, ax 0 00006B6F 11D1 adc cx, dx 539 _.LVL47: 212:fattab.c **** { 540 .loc 1 212 0 0 00006B71 8B5EEE mov bx, word ptr [bp-18] 0 00006B74 85DB test bx, bx 0 00006B76 752D jne _.L57 212:fattab.c **** { 544 .loc 1 212 0 is_stmt 0 discriminator 1 0 00006B78 8B5EFE mov bx, word ptr [bp-2] 0 00006B7B 268B4723 mov ax, word ptr es:[bx+35] 0 00006B7F A880 test al, -128 0 00006B81 7422 je _.L57 216:fattab.c **** } 549 .loc 1 216 0 is_stmt 1 0 00006B83 83E00F and ax, 15 0 00006B86 97 xchg di, ax 552 _.LVL48: 0 00006B87 268B4731 mov ax, word ptr es:[bx+49] 0 00006B8B 8946F6 mov word ptr [bp-10], ax 0 00006B8E 268B4733 mov ax, word ptr es:[bx+51] 0 00006B92 F7E7 mul di 0 00006B94 93 xchg bx, ax 0 00006B95 8B46F6 mov ax, word ptr [bp-10] 0 00006B98 F7E7 mul di 0 00006B9A 8956F8 mov word ptr [bp-8], dx 0 00006B9D 015EF8 add word ptr [bp-8], bx 0 00006BA0 01C6 add si, ax 563 _.LVL49: 0 00006BA2 134EF8 adc cx, word ptr [bp-8] 565 _.LVL50: 566 _.L57: 221:fattab.c **** 567 .loc 1 221 0 0 00006BA5 51 push cx 0 00006BA6 56 push si 0 00006BA7 FF76FC push word ptr [bp-4] 0 00006BAA FF76FE push word ptr [bp-2] 0 00006BAD E8[FEFF] call _getFATblock 573 _.LVL51: 0 00006BB0 97 xchg di, ax 0 00006BB1 8956F6 mov word ptr [bp-10], dx 576 _.LVL52: 223:fattab.c **** return 1; /* the only error code possible here */ 577 .loc 1 223 0 0 00006BB4 92 xchg dx, ax 579 _.LVL53: 0 00006BB5 09F8 or ax, di 0 00006BB7 7503E91AFF je _.L117 227:fattab.c **** { 582 .loc 1 227 0 0 00006BBC 8E46FC mov es, word ptr [bp-4] 0 00006BBF 8B5EFE mov bx, word ptr [bp-2] 0 00006BC2 268B470D mov ax, word ptr es:[bx+13] 0 00006BC6 89C2 mov dx, ax 587 _.LVL54: 0 00006BC8 4A dec dx 0 00006BC9 81FAF40F cmp dx, 4084 0 00006BCD 7603E97F01 ja _.L59 591 _.LBB2: 235:fattab.c **** 592 .loc 1 235 0 0 00006BD2 8B46F0 mov ax, word ptr [bp-16] 0 00006BD5 D1E8 shr ax, 1 0 00006BD7 8946EE mov word ptr [bp-18], ax 596 _.LVL55: 246:fattab.c **** { 597 .loc 1 246 0 0 00006BDA 268B4702 mov ax, word ptr es:[bx+2] 599 _.LVL56: 0 00006BDE 8946F0 mov word ptr [bp-16], ax 0 00006BE1 48 dec ax 0 00006BE2 3946EE cmp word ptr [bp-18], ax 0 00006BE5 7368 jnc _.L60 244:fattab.c **** 604 .loc 1 244 0 0 00006BE7 8B5EEE mov bx, word ptr [bp-18] 0 00006BEA 8D4115 lea ax, [21+bx+di] 0 00006BED 8946EC mov word ptr [bp-20], ax 0 00006BF0 8B56F6 mov dx, word ptr [bp-10] 609 _.LVL57: 610 _.L61: 259:fattab.c **** { 611 .loc 1 259 0 0 00006BF3 8EC2 mov es, dx 0 00006BF5 8B5EEC mov bx, word ptr [bp-20] 0 00006BF8 268A07 mov al, byte ptr es:[bx] 0 00006BFB B108 mov cl, 8 0 00006BFD D3E0 shl ax, cl 0 00006BFF 8E46F6 mov es, word ptr [bp-10] 0 00006C02 8B76EE mov si, word ptr [bp-18] 0 00006C05 89FB mov bx, di 0 00006C07 268A4814 mov cl, byte ptr es:[bx+si+20] 0 00006C0B 08C8 or al, cl 0 00006C0D 89C3 mov bx, ax 623 _.LVL58: 624 _.LBB3: 266:fattab.c **** cluster >>= 4; 625 .loc 1 266 0 0 00006C0F F646F401 test byte ptr [bp-12], 1 0 00006C13 7404 je _.L66 267:fattab.c **** cluster &= 0x0fff; 628 .loc 1 267 0 0 00006C15 B104 mov cl, 4 0 00006C17 D3E8 shr ax, cl 631 _.LVL59: 632 _.L66: 268:fattab.c **** 633 .loc 1 268 0 0 00006C19 80E40F and ah, 15 635 _.LVL60: 270:fattab.c **** { 636 .loc 1 270 0 0 00006C1C 837EFA01 cmp word ptr [bp-6], 1 0 00006C20 7560 jne _.L68 272:fattab.c **** return LONG_LAST_CLUSTER; 639 .loc 1 272 0 0 00006C22 3DF70F cmp ax, 4087 641 _.LVL61: 642 _.L123: 0 00006C25 7603E9A401 ja _.L69 274:fattab.c **** return LONG_BAD; 644 .loc 1 274 0 0 00006C2A 7403E9AAFE jne _.L118 275:fattab.c **** return cluster; 646 .loc 1 275 0 0 00006C2F B8F7FF mov ax, -9 648 _.L119: 649 _.LBE3: 650 _.LBE2: 651 _.LBB5: 335:fattab.c **** 652 .loc 1 335 0 0 00006C32 BAFF0F mov dx, 4095 654 _.L39: 655 _.LBE5: 350:fattab.c **** } 351:fattab.c **** 352:fattab.c **** /* update the free space count */ 353:fattab.c **** bp->b_flag |= BFR_DIRTY | BFR_VALID; 354:fattab.c **** if (Cluster2 == FREE || wasfree) 355:fattab.c **** { 356:fattab.c **** int adjust = 0; 357:fattab.c **** if (!wasfree) 358:fattab.c **** adjust = 1; 359:fattab.c **** else if (Cluster2 != FREE) 360:fattab.c **** adjust = -1; 361:fattab.c **** #ifdef WITHFAT32 362:fattab.c **** if (ISFAT32(dpbp) && dpbp->dpb_xnfreeclst != XUNKNCLSTFREE) 363:fattab.c **** { 364:fattab.c **** /* update the free space count for returned */ 365:fattab.c **** /* cluster */ 366:fattab.c **** dpbp->dpb_xnfreeclst += adjust; 367:fattab.c **** write_fsinfo(dpbp); 368:fattab.c **** } 369:fattab.c **** else 370:fattab.c **** #endif 371:fattab.c **** if (dpbp->dpb_nfreeclst != UNKNCLSTFREE) 372:fattab.c **** dpbp->dpb_nfreeclst += adjust; 373:fattab.c **** } 374:fattab.c **** return SUCCESS; 375:fattab.c **** } 656 .loc 1 375 0 0 00006C35 89EC mov sp, bp 0 00006C37 5D pop bp 0 00006C38 5F pop di 0 00006C39 5E pop si 0 00006C3A C20C00 ret 12 662 _.LVL62: 663 _.L54: 200:fattab.c **** secdiv /= 2; 664 .loc 1 200 0 0 00006C3D 85DB test bx, bx 0 00006C3F 7408 je _.L56 198:fattab.c **** #ifdef WITHFAT32 667 .loc 1 198 0 0 00006C41 D1EF shr di, 1 669 _.LVL63: 670 _.L115: 201:fattab.c **** #endif 671 .loc 1 201 0 0 00006C43 8B4EF4 mov cx, word ptr [bp-12] 0 00006C46 E9F7FE jmp _.L55 674 _.LVL64: 675 _.L56: 0 00006C49 B102 mov cl, 2 677 _.LVL65: 0 00006C4B D3EF shr di, cl 679 _.LVL66: 0 00006C4D EBF4 jmp _.L115 681 _.LVL67: 682 _.L60: 683 _.LBB6: 249:fattab.c **** if (bp1 == 0) 684 .loc 1 249 0 0 00006C4F 46 inc si 0 00006C50 31C0 xor ax, ax 0 00006C52 50 push ax 0 00006C53 56 push si 0 00006C54 FF76FC push word ptr [bp-4] 0 00006C57 FF76FE push word ptr [bp-2] 0 00006C5A E8[FEFF] call _getFATblock 692 _.LVL68: 250:fattab.c **** return 1; /* the only error code possible here */ 693 .loc 1 250 0 0 00006C5D 89C3 mov bx, ax 0 00006C5F 09D0 or ax, dx 0 00006C61 7503E970FE je _.L117 253:fattab.c **** bp1->b_flag |= BFR_DIRTY | BFR_VALID; 697 .loc 1 253 0 0 00006C66 837EFA01 cmp word ptr [bp-6], 1 0 00006C6A 7506 jne _.L89 0 00006C6C 837EF200 cmp word ptr [bp-14], 0 0 00006C70 7407 je _.L64 702 _.L89: 254:fattab.c **** 703 .loc 1 254 0 0 00006C72 8EC2 mov es, dx 0 00006C74 26804F0560 or byte ptr es:[bx+5], 96 706 _.LVL69: 707 _.L64: 256:fattab.c **** } 708 .loc 1 256 0 0 00006C79 83C314 add bx, 20 0 00006C7C 895EEC mov word ptr [bp-20], bx 0 00006C7F E971FF jmp _.L61 712 _.LVL70: 713 _.L68: 714 _.LBB4: 280:fattab.c **** wasfree = 1; 715 .loc 1 280 0 0 00006C82 83F801 cmp ax, 1 279:fattab.c **** if (cluster == FREE) 717 .loc 1 279 0 0 00006C85 18C0 sbb al, al 719 _.LVL71: 0 00006C87 8846F0 mov byte ptr [bp-16], al 0 00006C8A F65EF0 neg byte ptr [bp-16] 722 _.LVL72: 723 _.LBE4: 288:fattab.c **** 724 .loc 1 288 0 0 00006C8D 8B46FA mov ax, word ptr [bp-6] 0 00006C90 80E40F and ah, 15 727 _.LVL73: 293:fattab.c **** cluster2 <<= 4; 728 .loc 1 293 0 0 00006C93 89D9 mov cx, bx 291:fattab.c **** { 730 .loc 1 291 0 0 00006C95 F646F401 test byte ptr [bp-12], 1 0 00006C99 7503E9AA00 je _.L71 733 _.LVL74: 293:fattab.c **** cluster2 <<= 4; 734 .loc 1 293 0 0 00006C9E 83E10F and cx, 15 736 _.LVL75: 0 00006CA1 89CE mov si, cx 738 _.LVL76: 294:fattab.c **** } 739 .loc 1 294 0 0 00006CA3 B104 mov cl, 4 741 _.LVL77: 0 00006CA5 D3E0 shl ax, cl 743 _.LVL78: 744 _.L72: 300:fattab.c **** *fbp0 = (UBYTE)cluster; 745 .loc 1 300 0 0 00006CA7 09F0 or ax, si 747 _.LVL79: 301:fattab.c **** *fbp1 = (UBYTE)(cluster >> 8); 748 .loc 1 301 0 0 00006CA9 8E46F6 mov es, word ptr [bp-10] 0 00006CAC 8B76EE mov si, word ptr [bp-18] 0 00006CAF 89FB mov bx, di 752 _.LVL80: 0 00006CB1 26884014 mov byte ptr es:[bx+si+20], al 754 _.LVL81: 302:fattab.c **** } 755 .loc 1 302 0 0 00006CB5 B108 mov cl, 8 0 00006CB7 D3E8 shr ax, cl 758 _.LVL82: 0 00006CB9 8EC2 mov es, dx 0 00006CBB 8B5EEC mov bx, word ptr [bp-20] 0 00006CBE 268807 mov byte ptr es:[bx], al 762 _.L73: 763 _.LVL83: 764 _.LBE6: 353:fattab.c **** if (Cluster2 == FREE || wasfree) 765 .loc 1 353 0 0 00006CC1 8E46F6 mov es, word ptr [bp-10] 0 00006CC4 26804D0560 or byte ptr es:[di+5], 96 768 _.LVL84: 354:fattab.c **** { 769 .loc 1 354 0 0 00006CC9 8B46FA mov ax, word ptr [bp-6] 0 00006CCC 0B46F2 or ax, word ptr [bp-14] 0 00006CCF 7406 je _.L90 0 00006CD1 F646F001 test byte ptr [bp-16], 1 0 00006CD5 746A je _.L87 775 _.L90: 776 _.LVL85: 777 _.LBB7: 357:fattab.c **** adjust = 1; 778 .loc 1 357 0 0 00006CD7 807EF000 cmp byte ptr [bp-16], 0 0 00006CDB 7503E91C01 je _.L86 781 _.LVL86: 359:fattab.c **** adjust = -1; 782 .loc 1 359 0 0 00006CE0 8B46FA mov ax, word ptr [bp-6] 0 00006CE3 0B46F2 or ax, word ptr [bp-14] 0 00006CE6 83F801 cmp ax, 1 0 00006CE9 18C0 sbb al, al 0 00006CEB FEC0 inc al 0 00006CED 30E4 xor ah, ah 0 00006CEF F7D8 neg ax 790 _.LVL87: 791 _.L81: 362:fattab.c **** { 792 .loc 1 362 0 0 00006CF1 8E46FC mov es, word ptr [bp-4] 0 00006CF4 8B5EFE mov bx, word ptr [bp-2] 0 00006CF7 26837F0F00 cmp word ptr es:[bx+15], 0 0 00006CFC 7403E90101 jne _.L82 362:fattab.c **** { 797 .loc 1 362 0 is_stmt 0 discriminator 1 0 00006D01 8B5EFE mov bx, word ptr [bp-2] 0 00006D04 268B5F1F mov bx, word ptr es:[bx+31] 0 00006D08 8B7EFE mov di, word ptr [bp-2] 0 00006D0B 268B7521 mov si, word ptr es:[di+33] 0 00006D0F 83FBFF cmp bx, -1 0 00006D12 7508 jne _.L91 0 00006D14 83FEFF cmp si, -1 0 00006D17 7503E9E600 je _.L82 806 _.L91: 366:fattab.c **** write_fsinfo(dpbp); 807 .loc 1 366 0 is_stmt 1 0 00006D1C 89C1 mov cx, ax 0 00006D1E 99 cwd 0 00006D1F 92 xchg dx, ax 811 _.LVL88: 0 00006D20 01D9 add cx, bx 813 _.LVL89: 0 00006D22 11F0 adc ax, si 0 00006D24 8E46FC mov es, word ptr [bp-4] 0 00006D27 8B5EFE mov bx, word ptr [bp-2] 0 00006D2A 26894F1F mov word ptr es:[bx+31], cx 0 00006D2E 8E46FC mov es, word ptr [bp-4] 0 00006D31 8B5EFE mov bx, word ptr [bp-2] 0 00006D34 26894721 mov word ptr es:[bx+33], ax 367:fattab.c **** } 821 .loc 1 367 0 0 00006D38 FF76FC push word ptr [bp-4] 0 00006D3B FF76FE push word ptr [bp-2] 0 00006D3E E8[FEFF] call _write_fsinfo 825 _.LVL90: 826 _.L87: 827 _.LBE7: 374:fattab.c **** } 828 .loc 1 374 0 0 00006D41 31C0 xor ax, ax 0 00006D43 89C2 mov dx, ax 0 00006D45 E9EDFE jmp _.L39 832 _.LVL91: 833 _.L71: 834 _.LBB8: 298:fattab.c **** } 835 .loc 1 298 0 0 00006D48 81E100F0 and cx, -4096 837 _.LVL92: 0 00006D4C 89CE mov si, cx 839 _.LVL93: 0 00006D4E E956FF jmp _.L72 841 _.LVL94: 842 _.L59: 843 _.LBE8: 304:fattab.c **** { 844 .loc 1 304 0 0 00006D51 050AF0 add ax, -4086 0 00006D54 3DFFEF cmp ax, -4097 0 00006D57 7731 ja _.L74 848 _.LBB9: 309:fattab.c **** if ((unsigned)Cluster2 == READ_CLUSTER) 849 .loc 1 309 0 0 00006D59 8B5EF0 mov bx, word ptr [bp-16] 0 00006D5C D1E3 shl bx, 1 0 00006D5E 8D5914 lea bx, [20+bx+di] 0 00006D61 8E46F6 mov es, word ptr [bp-10] 0 00006D64 268B07 mov ax, word ptr es:[bx] 855 _.LVL95: 310:fattab.c **** { 856 .loc 1 310 0 0 00006D67 837EFA01 cmp word ptr [bp-6], 1 0 00006D6B 7506 jne _.L75 312:fattab.c **** return LONG_LAST_CLUSTER; 859 .loc 1 312 0 0 00006D6D 83F8F7 cmp ax, -9 0 00006D70 E9B2FE jmp _.L123 862 _.L75: 321:fattab.c **** wasfree = 0; 863 .loc 1 321 0 0 00006D73 8E46F6 mov es, word ptr [bp-10] 0 00006D76 8B56FA mov dx, word ptr [bp-6] 0 00006D79 268917 mov word ptr es:[bx], dx 867 _.LVL96: 323:fattab.c **** wasfree = 1; 868 .loc 1 323 0 0 00006D7C 83F801 cmp ax, 1 870 _.LVL97: 871 _.L116: 324:fattab.c **** } 872 .loc 1 324 0 0 00006D7F 18C0 sbb al, al 0 00006D81 8846F0 mov byte ptr [bp-16], al 0 00006D84 F65EF0 neg byte ptr [bp-16] 876 _.LBE9: 877 _.LBB10: 0 00006D87 E937FF jmp _.L73 879 _.LVL98: 880 _.L74: 881 _.LBE10: 327:fattab.c **** { 882 .loc 1 327 0 0 00006D8A 8E46FC mov es, word ptr [bp-4] 0 00006D8D 8B5EFE mov bx, word ptr [bp-2] 0 00006D90 26837F0F00 cmp word ptr es:[bx+15], 0 0 00006D95 755B jne _.L77 887 _.LBB11: 331:fattab.c **** if (Cluster2 == READ_CLUSTER) 888 .loc 1 331 0 0 00006D97 8B5EF0 mov bx, word ptr [bp-16] 0 00006D9A B102 mov cl, 2 0 00006D9C D3E3 shl bx, cl 0 00006D9E 8D5914 lea bx, [20+bx+di] 0 00006DA1 8E46F6 mov es, word ptr [bp-10] 0 00006DA4 268B07 mov ax, word ptr es:[bx] 0 00006DA7 268B5702 mov dx, word ptr es:[bx+2] 0 00006DAB 8956F4 mov word ptr [bp-12], dx 0 00006DAE 80E60F and dh, 15 898 _.LVL99: 332:fattab.c **** { 899 .loc 1 332 0 0 00006DB1 837EFA01 cmp word ptr [bp-6], 1 0 00006DB5 751D jne _.L78 0 00006DB7 837EF200 cmp word ptr [bp-14], 0 0 00006DBB 7517 jne _.L78 334:fattab.c **** return LONG_LAST_CLUSTER; 904 .loc 1 334 0 0 00006DBD 81FAFF0F cmp dx, 4095 0 00006DC1 7403E96FFE jne _.L39 0 00006DC6 83F8F7 cmp ax, -9 0 00006DC9 7703E967FE jbe _.L39 909 _.LVL100: 910 _.L69: 335:fattab.c **** 911 .loc 1 335 0 0 00006DCE B8FFFF mov ax, -1 0 00006DD1 E95EFE jmp _.L119 914 _.LVL101: 915 _.L78: 341:fattab.c **** wasfree = 0; 916 .loc 1 341 0 0 00006DD4 8E46F6 mov es, word ptr [bp-10] 0 00006DD7 8B4EFA mov cx, word ptr [bp-6] 0 00006DDA 26890F mov word ptr es:[bx], cx 920 _.LVL102: 0 00006DDD 8B76F2 mov si, word ptr [bp-14] 0 00006DE0 81E6FF0F and si, 4095 0 00006DE4 8E46F6 mov es, word ptr [bp-10] 0 00006DE7 26897702 mov word ptr es:[bx+2], si 925 _.LVL103: 343:fattab.c **** wasfree = 1; 926 .loc 1 343 0 0 00006DEB 09C2 or dx, ax 928 _.LVL104: 0 00006DED 83FA01 cmp dx, 1 0 00006DF0 EB8D jmp _.L116 931 _.LVL105: 932 _.L77: 933 _.LBE11: 348:fattab.c **** return 1; 934 .loc 1 348 0 0 00006DF2 B8[3100] mov ax, offset _.LC4 0 00006DF5 50 push ax 0 00006DF6 E8[FEFF] call _put_string 938 _.LVL106: 0 00006DF9 E9DAFC jmp _.L117 940 _.LVL107: 941 _.L86: 942 _.LBB12: 358:fattab.c **** else if (Cluster2 != FREE) 943 .loc 1 358 0 0 00006DFC B80100 mov ax, 1 0 00006DFF E9EFFE jmp _.L81 946 _.LVL108: 947 _.L82: 371:fattab.c **** dpbp->dpb_nfreeclst += adjust; 948 .loc 1 371 0 0 00006E02 8E46FC mov es, word ptr [bp-4] 0 00006E05 8B5EFE mov bx, word ptr [bp-2] 0 00006E08 268B571F mov dx, word ptr es:[bx+31] 0 00006E0C 83FAFF cmp dx, -1 0 00006E0F 7503E92DFF je _.L87 372:fattab.c **** } 954 .loc 1 372 0 0 00006E14 01D0 add ax, dx 956 _.LVL109: 0 00006E16 2689471F mov word ptr es:[bx+31], ax 0 00006E1A E924FF jmp _.L87 959 _.LBE12: 960 _.LFE8: 961 .size _link_fat, .-_link_fat === Switch to base=012BB0h -> ".RODATA.STR1.1" 962 .section .rodata.str1.1 963 _.LC5: 0 0000197B 76616C75653A2030 .string "value: 0x" 0 00001983 7800 === Switch to base=002270h -> ".TEXT" 965 .text 966 .global _next_cluster 967 .type _next_cluster, @function 968 _next_cluster: 969 _.LFB9: 376:fattab.c **** 377:fattab.c **** /* Given the disk parameters, and a cluster number, this function */ 378:fattab.c **** /* looks at the FAT, and returns the next cluster in the clain or */ 379:fattab.c **** /* 0 if there is no chain, 1 on error, LONG_LAST_CLUSTER at end. */ 380:fattab.c **** CLUSTER next_cluster(struct dpb FAR * dpbp, CLUSTER ClusterNum) 381:fattab.c **** { 970 .loc 1 381 0 971 _.LVL110: 0 00006E1D 56 push si 0 00006E1E 57 push di 0 00006E1F 55 push bp 975 _.LCFI10: 0 00006E20 89E5 mov bp, sp 977 _.LCFI11: 0 00006E22 83EC06 sub sp, 6 0 00006E25 8B5E08 mov bx, word ptr [bp+8] 0 00006E28 8B460A mov ax, word ptr [bp+10] 0 00006E2B 8946FE mov word ptr [bp-2], ax 382:fattab.c **** CLUSTER candidate, following, max_cluster; 383:fattab.c **** candidate = link_fat(dpbp, ClusterNum, READ_CLUSTER); 982 .loc 1 383 0 0 00006E2E 31FF xor di, di 0 00006E30 57 push di 0 00006E31 BE0100 mov si, 1 0 00006E34 56 push si 0 00006E35 FF760E push word ptr [bp+14] 0 00006E38 FF760C push word ptr [bp+12] 0 00006E3B 50 push ax 0 00006E3C 53 push bx 0 00006E3D 895EFA mov word ptr [bp-6], bx 0 00006E40 E8[FEFF] call _link_fat 993 _.LVL111: 0 00006E43 8946FC mov word ptr [bp-4], ax 0 00006E46 89D1 mov cx, dx 996 _.LVL112: 384:fattab.c **** /* empty (0) error (1) bad (LONG_BAD) last (>LONG_BAD) need no checks */ 385:fattab.c **** #if 0 386:fattab.c **** if (candidate == ClusterNum) 387:fattab.c **** return 1; /* chain has a tiny loop - easy but boring error check */ 388:fattab.c **** #endif 389:fattab.c **** if (candidate < 2 || candidate >= LONG_BAD) 997 .loc 1 389 0 0 00006E48 92 xchg dx, ax 0 00006E49 83C2FE add dx, -2 0 00006E4C 89C8 mov ax, cx 1001 _.LVL113: 0 00006E4E 83D0FF adc ax, -1 0 00006E51 3DFF0F cmp ax, 4095 0 00006E54 7773 ja _.L124 0 00006E56 8EDF mov ds, di 0 00006E58 96 xchg si, ax 0 00006E59 8B5EFA mov bx, word ptr [bp-6] 0 00006E5C 7505 jne _.L135 0 00006E5E 83FAF4 cmp dx, -12 0 00006E61 7766 ja _.L124 1011 _.L135: 390:fattab.c **** return candidate; 391:fattab.c **** max_cluster = dpbp->dpb_size; 1012 .loc 1 391 0 0 00006E63 8E46FE mov es, word ptr [bp-2] 0 00006E66 268B770D mov si, word ptr es:[bx+13] 1015 _.LVL114: 392:fattab.c **** #ifdef WITHFAT32 393:fattab.c **** if (ISFAT32(dpbp)) 1016 .loc 1 393 0 0 00006E6A 26837F0F00 cmp word ptr es:[bx+15], 0 0 00006E6F 7432 je _.L127 391:fattab.c **** #ifdef WITHFAT32 1019 .loc 1 391 0 0 00006E71 31FF xor di, di 1021 _.LVL115: 1022 _.L128: 394:fattab.c **** max_cluster = dpbp->dpb_xsize; 395:fattab.c **** #endif 396:fattab.c **** /* FAT entry points to a possibly invalid next cluster */ 397:fattab.c **** following = link_fat(dpbp, candidate, READ_CLUSTER); 1023 .loc 1 397 0 0 00006E73 1E push ds 0 00006E74 50 push ax 0 00006E75 51 push cx 0 00006E76 894EFA mov word ptr [bp-6], cx 0 00006E79 FF76FC push word ptr [bp-4] 0 00006E7C FF76FE push word ptr [bp-2] 0 00006E7F 53 push bx 0 00006E80 16 push ss 0 00006E81 1F pop ds 0 00006E82 E8[FEFF] call _link_fat 1034 _.LVL116: 398:fattab.c **** if (following<2 || (following < LONG_BAD && following > max_cluster)) 1035 .loc 1 398 0 0 00006E85 85D2 test dx, dx 0 00006E87 8B4EFA mov cx, word ptr [bp-6] 0 00006E8A 7524 jne _.L136 0 00006E8C 83F801 cmp ax, 1 0 00006E8F 7730 ja _.L145 1041 _.L129: 399:fattab.c **** { 400:fattab.c **** /* chain must not contain free or out of range clusters */ 401:fattab.c **** clusterMessage("value: 0x",following); /* read returned bad value */ 1042 .loc 1 401 0 0 00006E91 52 push dx 0 00006E92 50 push ax 0 00006E93 B8[3B00] mov ax, offset _.LC5 1046 _.LVL117: 0 00006E96 50 push ax 1048 _.LVL118: 0 00006E97 E8[FEFF] call _clusterMessage 1050 _.LVL119: 402:fattab.c **** return 1; /* only possible error code here */ 1051 .loc 1 402 0 0 00006E9A C746FC0100 mov word ptr [bp-4], 1 1053 _.LVL120: 0 00006E9F 31C9 xor cx, cx 0 00006EA1 EB26 jmp _.L124 1056 _.LVL121: 1057 _.L127: 394:fattab.c **** #endif 1058 .loc 1 394 0 0 00006EA3 8E46FE mov es, word ptr [bp-2] 0 00006EA6 268B772D mov si, word ptr es:[bx+45] 1061 _.LVL122: 0 00006EAA 268B7F2F mov di, word ptr es:[bx+47] 1063 _.LVL123: 0 00006EAE EBC3 jmp _.L128 1065 _.LVL124: 1066 _.L136: 398:fattab.c **** { 1067 .loc 1 398 0 discriminator 1 0 00006EB0 81FAFF0F cmp dx, 4095 0 00006EB4 7713 ja _.L124 0 00006EB6 7505 jne _.L139 0 00006EB8 83F8F6 cmp ax, -10 0 00006EBB 770C ja _.L124 1073 _.L139: 0 00006EBD 39FA cmp dx, di 0 00006EBF 77D0 ja _.L129 1076 _.L145: 0 00006EC1 39FA cmp dx, di 0 00006EC3 7504 jne _.L124 0 00006EC5 39F0 cmp ax, si 0 00006EC7 77C8 ja _.L129 1081 _.LVL125: 1082 _.L124: 403:fattab.c **** } 404:fattab.c **** /* without checking "following", a chain can dangle to a free cluster: */ 405:fattab.c **** /* if that cluster is later used by another chain, you get cross links */ 406:fattab.c **** return candidate; 407:fattab.c **** } 1083 .loc 1 407 0 0 00006EC9 8B46FC mov ax, word ptr [bp-4] 0 00006ECC 89CA mov dx, cx 0 00006ECE 89EC mov sp, bp 0 00006ED0 5D pop bp 0 00006ED1 5F pop di 0 00006ED2 5E pop si 0 00006ED3 16 push ss 0 00006ED4 1F pop ds 0 00006ED5 C20800 ret 8 1093 _.LFE9: 1094 .size _next_cluster, .-_next_cluster 1095 .global _is_free_cluster 1096 .type _is_free_cluster, @function 1097 _is_free_cluster: 1098 _.LFB10: 408:fattab.c **** 409:fattab.c **** /* check if the selected cluster is free (faster than next_cluster) */ 410:fattab.c **** BOOL is_free_cluster(struct dpb FAR * dpbp, CLUSTER ClusterNum) 411:fattab.c **** { 1099 .loc 1 411 0 1100 _.LVL126: 0 00006ED8 55 push bp 1102 _.LCFI12: 0 00006ED9 89E5 mov bp, sp 1104 _.LCFI13: 412:fattab.c **** return (link_fat(dpbp, ClusterNum, READ_CLUSTER) == FREE); 1105 .loc 1 412 0 0 00006EDB 31C0 xor ax, ax 0 00006EDD 50 push ax 0 00006EDE B80100 mov ax, 1 0 00006EE1 50 push ax 0 00006EE2 FF760A push word ptr [bp+10] 0 00006EE5 FF7608 push word ptr [bp+8] 0 00006EE8 FF7606 push word ptr [bp+6] 0 00006EEB FF7604 push word ptr [bp+4] 0 00006EEE E8[FEFF] call _link_fat 1115 _.LVL127: 0 00006EF1 09D0 or ax, dx 0 00006EF3 9F lahf 0 00006EF4 D0E4 shl ah, 1 0 00006EF6 99 cwd 0 00006EF7 30C0 xor al, al 0 00006EF9 28D0 sub al, dl 0 00006EFB 30E4 xor ah, ah 413:fattab.c **** } 1123 .loc 1 413 0 0 00006EFD 89EC mov sp, bp 0 00006EFF 5D pop bp 0 00006F00 C20800 ret 8 1127 _.LFE10: 1128 .size _is_free_cluster, .-_is_free_cluster === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: fcbfns.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=fcbfns.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccc17vxG.s output file : fcbfns.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:54.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _ExtFcbToFcb, @function 8 _ExtFcbToFcb: 9 _.LFB17: 10 .file 1 "fcbfns.c" 1:fcbfns.c **** /****************************************************************/ 2:fcbfns.c **** /* */ 3:fcbfns.c **** /* fcbfns.c */ 4:fcbfns.c **** /* */ 5:fcbfns.c **** /* Old CP/M Style Function Handlers for Kernel */ 6:fcbfns.c **** /* */ 7:fcbfns.c **** /* Copyright (c) 1995 */ 8:fcbfns.c **** /* Pasquale J. Villani */ 9:fcbfns.c **** /* All Rights Reserved */ 10:fcbfns.c **** /* */ 11:fcbfns.c **** /* This file is part of DOS-C. */ 12:fcbfns.c **** /* */ 13:fcbfns.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:fcbfns.c **** /* modify it under the terms of the GNU General Public License */ 15:fcbfns.c **** /* as published by the Free Software Foundation; either version */ 16:fcbfns.c **** /* 2, or (at your option) any later version. */ 17:fcbfns.c **** /* */ 18:fcbfns.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:fcbfns.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:fcbfns.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:fcbfns.c **** /* the GNU General Public License for more details. */ 22:fcbfns.c **** /* */ 23:fcbfns.c **** /* You should have received a copy of the GNU General Public */ 24:fcbfns.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:fcbfns.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:fcbfns.c **** /* Cambridge, MA 02139, USA. */ 27:fcbfns.c **** /****************************************************************/ 28:fcbfns.c **** 29:fcbfns.c **** #include "portab.h" 30:fcbfns.c **** #include "globals.h" 31:fcbfns.c **** 32:fcbfns.c **** #ifdef VERSION_STRINGS 33:fcbfns.c **** static BYTE *RcsId = 34:fcbfns.c **** "$Id: fcbfns.c 1405 2009-05-26 20:44:44Z bartoldeman $"; 35:fcbfns.c **** #endif 36:fcbfns.c **** 37:fcbfns.c **** #define FCB_SUCCESS 0 38:fcbfns.c **** #define FCB_ERR_NODATA 1 39:fcbfns.c **** #define FCB_ERR_SEGMENT_WRAP 2 40:fcbfns.c **** #define FCB_ERR_EOF 3 41:fcbfns.c **** #define FCB_ERROR 0xff 42:fcbfns.c **** 43:fcbfns.c **** STATIC fcb FAR *ExtFcbToFcb(xfcb FAR * lpExtFcb); 44:fcbfns.c **** STATIC fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer, 45:fcbfns.c **** COUNT * pCurDrive); 46:fcbfns.c **** STATIC void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive); 47:fcbfns.c **** STATIC void FcbNextRecord(fcb FAR * lpFcb); 48:fcbfns.c **** STATIC void FcbCalcRec(xfcb FAR * lpXfcb); 49:fcbfns.c **** 50:fcbfns.c **** #define TestCmnSeps(lpFileName) (*lpFileName && strchr(":;,=+ \t", *lpFileName) != NULL) 51:fcbfns.c **** #define TestFieldSeps(lpFileName) ((unsigned char)*lpFileName <= ' ' || strchr("/\\\"[]<>|.:;,=+\t" 52:fcbfns.c **** 53:fcbfns.c **** static dmatch Dmatch; 54:fcbfns.c **** 55:fcbfns.c **** BYTE FAR *FatGetDrvData(UBYTE drive, UBYTE * pspc, UWORD * bps, UWORD * nc) 56:fcbfns.c **** { 57:fcbfns.c **** static BYTE mdb; 58:fcbfns.c **** UWORD spc; 59:fcbfns.c **** 60:fcbfns.c **** /* get the data available from dpb */ 61:fcbfns.c **** spc = DosGetFree(drive, NULL, bps, nc); 62:fcbfns.c **** if (spc != 0xffff) 63:fcbfns.c **** { 64:fcbfns.c **** struct dpb FAR *dpbp = get_dpb(drive == 0 ? default_drive : drive - 1); 65:fcbfns.c **** /* Point to the media desctriptor for this drive */ 66:fcbfns.c **** *pspc = (UBYTE)spc; 67:fcbfns.c **** if (dpbp == NULL) 68:fcbfns.c **** { 69:fcbfns.c **** mdb = spc >> 8; 70:fcbfns.c **** spc &= 0xff; 71:fcbfns.c **** return &mdb; 72:fcbfns.c **** } 73:fcbfns.c **** else 74:fcbfns.c **** { 75:fcbfns.c **** return (BYTE FAR *) & (dpbp->dpb_mdb); 76:fcbfns.c **** } 77:fcbfns.c **** } 78:fcbfns.c **** return NULL; 79:fcbfns.c **** } 80:fcbfns.c **** 81:fcbfns.c **** #define PARSE_SKIP_LEAD_SEP 0x01 82:fcbfns.c **** #define PARSE_DFLT_DRIVE 0x02 83:fcbfns.c **** #define PARSE_BLNK_FNAME 0x04 84:fcbfns.c **** #define PARSE_BLNK_FEXT 0x08 85:fcbfns.c **** 86:fcbfns.c **** #define PARSE_RET_NOWILD 0 87:fcbfns.c **** #define PARSE_RET_WILD 1 88:fcbfns.c **** #define PARSE_RET_BADDRIVE 0xff 89:fcbfns.c **** 90:fcbfns.c **** #ifndef IPL 91:fcbfns.c **** UWORD FcbParseFname(UBYTE *wTestMode, const BYTE FAR * lpFileName, fcb FAR * lpFcb) 92:fcbfns.c **** { 93:fcbfns.c **** WORD wRetCodeDrive = FALSE, wRetCodeName = FALSE, wRetCodeExt = FALSE; 94:fcbfns.c **** 95:fcbfns.c **** /* pjv -- ExtFcbToFcb? */ 96:fcbfns.c **** 97:fcbfns.c **** /* skip leading separators if requested */ 98:fcbfns.c **** if (*wTestMode & PARSE_SKIP_LEAD_SEP) 99:fcbfns.c **** { 100:fcbfns.c **** while (TestCmnSeps(lpFileName)) 101:fcbfns.c **** ++lpFileName; 102:fcbfns.c **** } 103:fcbfns.c **** 104:fcbfns.c **** /* Undocumented "feature," we skip white space anyway */ 105:fcbfns.c **** lpFileName = ParseSkipWh(lpFileName); 106:fcbfns.c **** 107:fcbfns.c **** /* Now check for drive specification */ 108:fcbfns.c **** /* If drive specified, set to it otherwise */ 109:fcbfns.c **** /* set to default drive unless leave as-is requested */ 110:fcbfns.c **** 111:fcbfns.c **** /* Undocumented behavior: should keep parsing even if drive */ 112:fcbfns.c **** /* specification is invalid -- tkchia 20220715 */ 113:fcbfns.c **** /* drive specification can refer to an invalid drive, but must */ 114:fcbfns.c **** /* not itself be a file name delimiter! -- tkchia 20220716 */ 115:fcbfns.c **** if (!TestFieldSeps(lpFileName) && *(lpFileName + 1) == ':') 116:fcbfns.c **** { 117:fcbfns.c **** /* non-portable construct to be changed */ 118:fcbfns.c **** REG UBYTE Drive = DosUpFChar(*lpFileName) - 'A'; 119:fcbfns.c **** 120:fcbfns.c **** if (get_cds(Drive) == NULL) 121:fcbfns.c **** wRetCodeDrive = TRUE; 122:fcbfns.c **** 123:fcbfns.c **** lpFcb->fcb_drive = Drive + 1; 124:fcbfns.c **** lpFileName += 2; 125:fcbfns.c **** } else if (!(*wTestMode & PARSE_DFLT_DRIVE)) { 126:fcbfns.c **** lpFcb->fcb_drive = FDFLT_DRIVE; 127:fcbfns.c **** } 128:fcbfns.c **** 129:fcbfns.c **** /* Undocumented behavior, set record number & record size to 0 */ 130:fcbfns.c **** /* per MS-DOS Encyclopedia pp269 no other FCB fields modified */ 131:fcbfns.c **** /* except zeroing current block and record size fields */ 132:fcbfns.c **** lpFcb->fcb_cublock = lpFcb->fcb_recsiz = 0; 133:fcbfns.c **** 134:fcbfns.c **** if (!(*wTestMode & PARSE_BLNK_FNAME)) 135:fcbfns.c **** { 136:fcbfns.c **** fmemset(lpFcb->fcb_fname, ' ', FNAME_SIZE); 137:fcbfns.c **** } 138:fcbfns.c **** if (!(*wTestMode & PARSE_BLNK_FEXT)) 139:fcbfns.c **** { 140:fcbfns.c **** fmemset(lpFcb->fcb_fext, ' ', FEXT_SIZE); 141:fcbfns.c **** } 142:fcbfns.c **** 143:fcbfns.c **** /* special cases: '.' and '..' */ 144:fcbfns.c **** if (*lpFileName == '.') 145:fcbfns.c **** { 146:fcbfns.c **** lpFcb->fcb_fname[0] = '.'; 147:fcbfns.c **** ++lpFileName; 148:fcbfns.c **** if (*lpFileName == '.') 149:fcbfns.c **** { 150:fcbfns.c **** lpFcb->fcb_fname[1] = '.'; 151:fcbfns.c **** ++lpFileName; 152:fcbfns.c **** } 153:fcbfns.c **** *wTestMode = PARSE_RET_NOWILD; 154:fcbfns.c **** return FP_OFF(lpFileName); 155:fcbfns.c **** } 156:fcbfns.c **** 157:fcbfns.c **** /* Now to format the file name into the string */ 158:fcbfns.c **** lpFileName = 159:fcbfns.c **** GetNameField(lpFileName, (BYTE FAR *) lpFcb->fcb_fname, FNAME_SIZE, 160:fcbfns.c **** (BOOL *) & wRetCodeName); 161:fcbfns.c **** 162:fcbfns.c **** /* Do we have an extension? If do, format it else return */ 163:fcbfns.c **** if (*lpFileName == '.') 164:fcbfns.c **** lpFileName = 165:fcbfns.c **** GetNameField(++lpFileName, (BYTE FAR *) lpFcb->fcb_fext, 166:fcbfns.c **** FEXT_SIZE, (BOOL *) & wRetCodeExt); 167:fcbfns.c **** 168:fcbfns.c **** if (wRetCodeDrive) 169:fcbfns.c **** *wTestMode = PARSE_RET_BADDRIVE; 170:fcbfns.c **** else if (wRetCodeName | wRetCodeExt) 171:fcbfns.c **** *wTestMode = PARSE_RET_WILD; 172:fcbfns.c **** else 173:fcbfns.c **** *wTestMode = PARSE_RET_NOWILD; 174:fcbfns.c **** return FP_OFF(lpFileName); 175:fcbfns.c **** } 176:fcbfns.c **** 177:fcbfns.c **** const BYTE FAR * ParseSkipWh(const BYTE FAR * lpFileName) 178:fcbfns.c **** { 179:fcbfns.c **** while (*lpFileName == ' ' || *lpFileName == '\t') 180:fcbfns.c **** ++lpFileName; 181:fcbfns.c **** return lpFileName; 182:fcbfns.c **** } 183:fcbfns.c **** 184:fcbfns.c **** 185:fcbfns.c **** const BYTE FAR * GetNameField(const BYTE FAR * lpFileName, BYTE FAR * lpDestField, 186:fcbfns.c **** COUNT nFieldSize, BOOL * pbWildCard) 187:fcbfns.c **** { 188:fcbfns.c **** COUNT nIndex = 0; 189:fcbfns.c **** BYTE cFill = ' '; 190:fcbfns.c **** 191:fcbfns.c **** while (*lpFileName != '\0' && !TestFieldSeps(lpFileName) 192:fcbfns.c **** && nIndex < nFieldSize) 193:fcbfns.c **** { 194:fcbfns.c **** /* convert * into multiple ? for remaining length of field */ 195:fcbfns.c **** if (*lpFileName == '*') 196:fcbfns.c **** { 197:fcbfns.c **** *pbWildCard = TRUE; 198:fcbfns.c **** cFill = '?'; 199:fcbfns.c **** ++lpFileName; 200:fcbfns.c **** break; 201:fcbfns.c **** } 202:fcbfns.c **** /* include ? as-is but flag for return purposes wildcard used */ 203:fcbfns.c **** if (*lpFileName == '?') 204:fcbfns.c **** *pbWildCard = TRUE; 205:fcbfns.c **** 206:fcbfns.c **** /* store uppercased character, and advance to next char */ 207:fcbfns.c **** *lpDestField++ = DosUpFChar(*lpFileName++); 208:fcbfns.c **** ++nIndex; 209:fcbfns.c **** } 210:fcbfns.c **** 211:fcbfns.c **** /* Blank out remainder of field on exit */ 212:fcbfns.c **** fmemset(lpDestField, cFill, nFieldSize - nIndex); 213:fcbfns.c **** return lpFileName; 214:fcbfns.c **** } 215:fcbfns.c **** 216:fcbfns.c **** STATIC VOID FcbNextRecord(fcb FAR * lpFcb) 217:fcbfns.c **** { 218:fcbfns.c **** if (++lpFcb->fcb_curec >= 128) 219:fcbfns.c **** { 220:fcbfns.c **** lpFcb->fcb_curec = 0; 221:fcbfns.c **** ++lpFcb->fcb_cublock; 222:fcbfns.c **** } 223:fcbfns.c **** } 224:fcbfns.c **** 225:fcbfns.c **** STATIC ULONG FcbRec(fcb FAR *lpFcb) 226:fcbfns.c **** { 227:fcbfns.c **** return ((ULONG) lpFcb->fcb_cublock * 128) + lpFcb->fcb_curec; 228:fcbfns.c **** } 229:fcbfns.c **** 230:fcbfns.c **** UBYTE FcbReadWrite(xfcb FAR * lpXfcb, UCOUNT recno, int mode) 231:fcbfns.c **** { 232:fcbfns.c **** ULONG lPosit; 233:fcbfns.c **** long nTransfer; 234:fcbfns.c **** fcb FAR *lpFcb; 235:fcbfns.c **** unsigned size; 236:fcbfns.c **** unsigned long bigsize; 237:fcbfns.c **** unsigned recsiz; 238:fcbfns.c **** 239:fcbfns.c **** /* Convert to fcb if necessary */ 240:fcbfns.c **** lpFcb = ExtFcbToFcb(lpXfcb); 241:fcbfns.c **** 242:fcbfns.c **** recsiz = lpFcb->fcb_recsiz; 243:fcbfns.c **** bigsize = (ULONG)recsiz * recno; 244:fcbfns.c **** if (bigsize > 0xffff) 245:fcbfns.c **** return FCB_ERR_SEGMENT_WRAP; 246:fcbfns.c **** size = (unsigned)bigsize; 247:fcbfns.c **** 248:fcbfns.c **** if (FP_OFF(dta) + size < FP_OFF(dta)) 249:fcbfns.c **** return FCB_ERR_SEGMENT_WRAP; 250:fcbfns.c **** 251:fcbfns.c **** /* Now update the fcb and compute where we need to position */ 252:fcbfns.c **** /* to. */ 253:fcbfns.c **** lPosit = FcbRec(lpFcb) * recsiz; 254:fcbfns.c **** if ((CritErrCode = -SftSeek(lpFcb->fcb_sftno, lPosit, 0)) != SUCCESS) 255:fcbfns.c **** return FCB_ERR_NODATA; 256:fcbfns.c **** 257:fcbfns.c **** /* Do the read */ 258:fcbfns.c **** nTransfer = DosRWSft(lpFcb->fcb_sftno, size, dta, mode & ~XFR_FCB_RANDOM); 259:fcbfns.c **** if (nTransfer < 0) 260:fcbfns.c **** CritErrCode = -(int)nTransfer; 261:fcbfns.c **** 262:fcbfns.c **** /* Now find out how we will return and do it. */ 263:fcbfns.c **** if (mode & XFR_WRITE) 264:fcbfns.c **** lpFcb->fcb_fsize = SftGetFsize(lpFcb->fcb_sftno); 265:fcbfns.c **** 266:fcbfns.c **** /* if end-of-file, then partial read should count last record */ 267:fcbfns.c **** if (mode & XFR_FCB_RANDOM && recsiz > 0) 268:fcbfns.c **** lpFcb->fcb_rndm += ((unsigned)nTransfer + recsiz - 1) / recsiz; 269:fcbfns.c **** size -= (unsigned)nTransfer; 270:fcbfns.c **** if (size == 0) 271:fcbfns.c **** { 272:fcbfns.c **** FcbNextRecord(lpFcb); 273:fcbfns.c **** return FCB_SUCCESS; 274:fcbfns.c **** } 275:fcbfns.c **** size %= lpFcb->fcb_recsiz; 276:fcbfns.c **** if (mode & XFR_READ && size > 0) 277:fcbfns.c **** { 278:fcbfns.c **** fmemset((char FAR *)dta + (unsigned)nTransfer, 0, size); 279:fcbfns.c **** FcbNextRecord(lpFcb); 280:fcbfns.c **** return FCB_ERR_EOF; 281:fcbfns.c **** } 282:fcbfns.c **** return FCB_ERR_NODATA; 283:fcbfns.c **** } 284:fcbfns.c **** 285:fcbfns.c **** UBYTE FcbGetFileSize(xfcb FAR * lpXfcb) 286:fcbfns.c **** { 287:fcbfns.c **** int FcbDrive, sft_idx; 288:fcbfns.c **** unsigned recsiz; 289:fcbfns.c **** 290:fcbfns.c **** /* Build a traditional DOS file name */ 291:fcbfns.c **** fcb FAR *lpFcb = CommonFcbInit(lpXfcb, SecPathName, &FcbDrive); 292:fcbfns.c **** recsiz = lpFcb->fcb_recsiz; 293:fcbfns.c **** 294:fcbfns.c **** /* check for a device */ 295:fcbfns.c **** if (!lpFcb || IsDevice(SecPathName) || (recsiz == 0)) 296:fcbfns.c **** return FCB_ERROR; 297:fcbfns.c **** 298:fcbfns.c **** sft_idx = (short)DosOpenSft(SecPathName, O_LEGACY | O_RDONLY | O_OPEN, 0); 299:fcbfns.c **** if (sft_idx >= 0) 300:fcbfns.c **** { 301:fcbfns.c **** ULONG fsize; 302:fcbfns.c **** 303:fcbfns.c **** /* Get the size */ 304:fcbfns.c **** fsize = SftGetFsize(sft_idx); 305:fcbfns.c **** 306:fcbfns.c **** /* compute the size and update the fcb */ 307:fcbfns.c **** lpFcb->fcb_rndm = (fsize + (recsiz - 1)) / recsiz; 308:fcbfns.c **** 309:fcbfns.c **** /* close the file and leave */ 310:fcbfns.c **** if ((CritErrCode = -DosCloseSft(sft_idx, FALSE)) == SUCCESS) 311:fcbfns.c **** return FCB_SUCCESS; 312:fcbfns.c **** } 313:fcbfns.c **** else 314:fcbfns.c **** CritErrCode = -sft_idx; 315:fcbfns.c **** return FCB_ERROR; 316:fcbfns.c **** } 317:fcbfns.c **** 318:fcbfns.c **** void FcbSetRandom(xfcb FAR * lpXfcb) 319:fcbfns.c **** { 320:fcbfns.c **** /* Convert to fcb if necessary */ 321:fcbfns.c **** fcb FAR *lpFcb = ExtFcbToFcb(lpXfcb); 322:fcbfns.c **** 323:fcbfns.c **** /* Now update the fcb and compute where we need to position */ 324:fcbfns.c **** /* to. */ 325:fcbfns.c **** lpFcb->fcb_rndm = FcbRec(lpFcb); 326:fcbfns.c **** } 327:fcbfns.c **** 328:fcbfns.c **** void FcbCalcRec(xfcb FAR * lpXfcb) 329:fcbfns.c **** { 330:fcbfns.c **** 331:fcbfns.c **** /* Convert to fcb if necessary */ 332:fcbfns.c **** fcb FAR *lpFcb = ExtFcbToFcb(lpXfcb); 333:fcbfns.c **** 334:fcbfns.c **** /* Now update the fcb and compute where we need to position */ 335:fcbfns.c **** /* to. */ 336:fcbfns.c **** lpFcb->fcb_cublock = (UWORD)(lpFcb->fcb_rndm / 128); 337:fcbfns.c **** lpFcb->fcb_curec = (UBYTE)lpFcb->fcb_rndm & 127; 338:fcbfns.c **** } 339:fcbfns.c **** 340:fcbfns.c **** UBYTE FcbRandomBlockIO(xfcb FAR * lpXfcb, UWORD *nRecords, int mode) 341:fcbfns.c **** { 342:fcbfns.c **** UBYTE nErrorCode; 343:fcbfns.c **** fcb FAR *lpFcb; 344:fcbfns.c **** unsigned long old; 345:fcbfns.c **** 346:fcbfns.c **** FcbCalcRec(lpXfcb); 347:fcbfns.c **** 348:fcbfns.c **** /* Convert to fcb if necessary */ 349:fcbfns.c **** lpFcb = ExtFcbToFcb(lpXfcb); 350:fcbfns.c **** 351:fcbfns.c **** old = lpFcb->fcb_rndm; 352:fcbfns.c **** nErrorCode = FcbReadWrite(lpXfcb, *nRecords, mode); 353:fcbfns.c **** *nRecords = (UWORD)(lpFcb->fcb_rndm - old); 354:fcbfns.c **** 355:fcbfns.c **** /* Now update the fcb */ 356:fcbfns.c **** FcbCalcRec(lpXfcb); 357:fcbfns.c **** 358:fcbfns.c **** return nErrorCode; 359:fcbfns.c **** } 360:fcbfns.c **** 361:fcbfns.c **** UBYTE FcbRandomIO(xfcb FAR * lpXfcb, int mode) 362:fcbfns.c **** { 363:fcbfns.c **** UWORD uwCurrentBlock; 364:fcbfns.c **** UBYTE ucCurrentRecord; 365:fcbfns.c **** UBYTE nErrorCode; 366:fcbfns.c **** fcb FAR *lpFcb; 367:fcbfns.c **** 368:fcbfns.c **** FcbCalcRec(lpXfcb); 369:fcbfns.c **** 370:fcbfns.c **** /* Convert to fcb if necessary */ 371:fcbfns.c **** lpFcb = ExtFcbToFcb(lpXfcb); 372:fcbfns.c **** 373:fcbfns.c **** uwCurrentBlock = lpFcb->fcb_cublock; 374:fcbfns.c **** ucCurrentRecord = lpFcb->fcb_curec; 375:fcbfns.c **** 376:fcbfns.c **** nErrorCode = FcbReadWrite(lpXfcb, 1, mode); 377:fcbfns.c **** 378:fcbfns.c **** lpFcb->fcb_cublock = uwCurrentBlock; 379:fcbfns.c **** lpFcb->fcb_curec = ucCurrentRecord; 380:fcbfns.c **** return nErrorCode; 381:fcbfns.c **** } 382:fcbfns.c **** 383:fcbfns.c **** /* FcbOpen and FcbCreate 384:fcbfns.c **** Expects lpXfcb to point to a valid, unopened FCB, containing file name to open (create) 385:fcbfns.c **** Create will attempt to find the file name in the current directory, if found truncates 386:fcbfns.c **** setting file size to 0, otherwise if does not exist will create the new file; the 387:fcbfns.c **** FCB is filled in same as the open call. 388:fcbfns.c **** On any error returns FCB_ERROR 389:fcbfns.c **** On success returns FCB_SUCCESS, and sets the following fields (other non-system reserved ones le 390:fcbfns.c **** drive identifier (fcb_drive) set to actual drive (1=A, 2=B, ...; always >0 if not device) 391:fcbfns.c **** current block number (fcb_cublock) to 0 392:fcbfns.c **** file size (fcb_fsize) value from directory entry (0 if create) 393:fcbfns.c **** record size (fcb_recsiz) to 128; set to 0 for devices 394:fcbfns.c **** time & date (fcb_time & fcb_date) values from directory entry 395:fcbfns.c **** fcb_sftno, fcb_attrib_hi/_lo, fcb_strtclst, fcb_dirclst/off_unused are for internal use (syste 396:fcbfns.c **** */ 397:fcbfns.c **** UBYTE FcbOpen(xfcb FAR * lpXfcb, unsigned flags) 398:fcbfns.c **** { 399:fcbfns.c **** sft FAR *sftp; 400:fcbfns.c **** COUNT sft_idx, FcbDrive; 401:fcbfns.c **** unsigned attr = 0; 402:fcbfns.c **** 403:fcbfns.c **** /* Build a traditional DOS file name */ 404:fcbfns.c **** fcb FAR *lpFcb = CommonFcbInit(lpXfcb, SecPathName, &FcbDrive); 405:fcbfns.c **** if ((flags & O_CREAT) && lpXfcb->xfcb_flag == 0xff) 406:fcbfns.c **** /* pass attribute without constraints (dangerous for directories) */ 407:fcbfns.c **** attr = lpXfcb->xfcb_attrib; 408:fcbfns.c **** 409:fcbfns.c **** sft_idx = (short)DosOpenSft(SecPathName, flags, attr); 410:fcbfns.c **** if (sft_idx < 0) 411:fcbfns.c **** { 412:fcbfns.c **** CritErrCode = -sft_idx; 413:fcbfns.c **** return FCB_ERROR; 414:fcbfns.c **** } 415:fcbfns.c **** 416:fcbfns.c **** sftp = idx_to_sft(sft_idx); 417:fcbfns.c **** sftp->sft_mode |= O_FCB; 418:fcbfns.c **** 419:fcbfns.c **** lpFcb->fcb_sftno = sft_idx; 420:fcbfns.c **** lpFcb->fcb_cublock = 0; 421:fcbfns.c **** /* should not be cleared, programs e.g. GEM depend on these values remaining unchanged 422:fcbfns.c **** lpFcb->fcb_curec = 0; 423:fcbfns.c **** lpFcb->fcb_rndm = 0; 424:fcbfns.c **** */ 425:fcbfns.c **** 426:fcbfns.c **** lpFcb->fcb_recsiz = 0; /* true for devices */ 427:fcbfns.c **** if (!(sftp->sft_flags & SFT_FDEVICE)) /* check for a device */ 428:fcbfns.c **** { 429:fcbfns.c **** lpFcb->fcb_drive = FcbDrive; 430:fcbfns.c **** lpFcb->fcb_recsiz = 128; 431:fcbfns.c **** } 432:fcbfns.c **** lpFcb->fcb_fsize = sftp->sft_size; 433:fcbfns.c **** lpFcb->fcb_date = sftp->sft_date; 434:fcbfns.c **** lpFcb->fcb_time = sftp->sft_time; 435:fcbfns.c **** return FCB_SUCCESS; 436:fcbfns.c **** } 437:fcbfns.c **** 438:fcbfns.c **** 439:fcbfns.c **** STATIC fcb FAR *ExtFcbToFcb(xfcb FAR * lpExtFcb) 440:fcbfns.c **** { 11 .loc 1 440 0 12 _.LVL0: 0 00006F03 55 push bp 14 _.LCFI0: 0 00006F04 89E5 mov bp, sp 16 _.LCFI1: 441:fcbfns.c **** if (*((UBYTE FAR *) lpExtFcb) == 0xff) 17 .loc 1 441 0 0 00006F06 C45E04 les bx, dword ptr [bp+4] 0 00006F09 8CC0 mov ax, es 0 00006F0B 26803FFF cmp byte ptr es:[bx], -1 0 00006F0F 7503 jne _.L2 442:fcbfns.c **** sda_lpFcb = &lpExtFcb->xfcb_fcb; 22 .loc 1 442 0 0 00006F11 83C307 add bx, 7 24 _.L2: 443:fcbfns.c **** else 444:fcbfns.c **** sda_lpFcb = (fcb FAR *) lpExtFcb; 25 .loc 1 444 0 0 00006F14 891E[0000] mov word ptr [_sda_lpFcb], bx 0 00006F18 A3[0200] mov word ptr [_sda_lpFcb+2], ax 445:fcbfns.c **** return sda_lpFcb; 446:fcbfns.c **** } 28 .loc 1 446 0 0 00006F1B A1[0000] mov ax, word ptr [_sda_lpFcb] 0 00006F1E 8B16[0200] mov dx, word ptr [_sda_lpFcb+2] 0 00006F22 5D pop bp 0 00006F23 C20400 ret 4 33 _.LFE17: 34 .size _ExtFcbToFcb, .-_ExtFcbToFcb 35 .type _FcbCalcRec, @function 36 _FcbCalcRec: 37 _.LFB13: 329:fcbfns.c **** 38 .loc 1 329 0 39 _.LVL1: 0 00006F26 57 push di 0 00006F27 55 push bp 42 _.LCFI2: 0 00006F28 89E5 mov bp, sp 44 _.LCFI3: 0 00006F2A 1E push ds 0 00006F2B 1E push ds 332:fcbfns.c **** 47 .loc 1 332 0 0 00006F2C FF7608 push word ptr [bp+8] 0 00006F2F FF7606 push word ptr [bp+6] 0 00006F32 E8CEFF call _ExtFcbToFcb 51 _.LVL2: 336:fcbfns.c **** lpFcb->fcb_curec = (UBYTE)lpFcb->fcb_rndm & 127; 52 .loc 1 336 0 0 00006F35 8EC2 mov es, dx 0 00006F37 89C3 mov bx, ax 0 00006F39 268B4F21 mov cx, word ptr es:[bx+33] 0 00006F3D 894EFE mov word ptr [bp-2], cx 0 00006F40 268B4F23 mov cx, word ptr es:[bx+35] 0 00006F44 89CB mov bx, cx 0 00006F46 B109 mov cl, 9 0 00006F48 D3E3 shl bx, cl 0 00006F4A 8B7EFE mov di, word ptr [bp-2] 0 00006F4D B107 mov cl, 7 0 00006F4F D3EF shr di, cl 0 00006F51 89F9 mov cx, di 0 00006F53 09D9 or cx, bx 0 00006F55 93 xchg bx, ax 0 00006F56 26894F0C mov word ptr es:[bx+12], cx 68 _.LVL3: 337:fcbfns.c **** } 69 .loc 1 337 0 0 00006F5A 8A4EFE mov cl, byte ptr [bp-2] 0 00006F5D 80E17F and cl, 127 0 00006F60 26884F20 mov byte ptr es:[bx+32], cl 338:fcbfns.c **** 73 .loc 1 338 0 0 00006F64 89EC mov sp, bp 0 00006F66 5D pop bp 0 00006F67 5F pop di 0 00006F68 C20400 ret 4 78 _.LFE13: 79 .size _FcbCalcRec, .-_FcbCalcRec 80 .type _CommonFcbInit.constprop.0, @function 81 _CommonFcbInit.constprop.0: 82 _.LFB25: 447:fcbfns.c **** 448:fcbfns.c **** STATIC fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer, 83 .loc 1 448 0 84 _.LVL4: 0 00006F6B 56 push si 0 00006F6C 55 push bp 87 _.LCFI4: 0 00006F6D 89E5 mov bp, sp 89 _.LCFI5: 0 00006F6F 1E push ds 0 00006F70 1E push ds 0 00006F71 8B760A mov si, word ptr [bp+10] 93 _.LVL5: 449:fcbfns.c **** COUNT * pCurDrive) 450:fcbfns.c **** { 451:fcbfns.c **** fcb FAR *lpFcb; 452:fcbfns.c **** 453:fcbfns.c **** /* convert to fcb if needed first */ 454:fcbfns.c **** sda_lpFcb = lpFcb = ExtFcbToFcb(lpExtFcb); 94 .loc 1 454 0 0 00006F74 FF7608 push word ptr [bp+8] 0 00006F77 FF7606 push word ptr [bp+6] 0 00006F7A E886FF call _ExtFcbToFcb 98 _.LVL6: 0 00006F7D 89C3 mov bx, ax 100 _.LVL7: 0 00006F7F A3[0000] mov word ptr [_sda_lpFcb], ax 0 00006F82 8916[0200] mov word ptr [_sda_lpFcb+2], dx 103 _.LVL8: 104 _.LBB8: 105 _.LBB9: 455:fcbfns.c **** 456:fcbfns.c **** /* Build a traditional DOS file name */ 457:fcbfns.c **** FcbNameInit(lpFcb, pszBuffer, pCurDrive); 458:fcbfns.c **** /* and return the fcb pointer */ 459:fcbfns.c **** return lpFcb; 460:fcbfns.c **** } 461:fcbfns.c **** 462:fcbfns.c **** STATIC void FcbNameInit(fcb FAR * lpFcb, BYTE * szBuffer, COUNT * pCurDrive) 463:fcbfns.c **** { 464:fcbfns.c **** BYTE *pszBuffer = szBuffer; 465:fcbfns.c **** 466:fcbfns.c **** /* Build a traditional DOS file name */ 467:fcbfns.c **** *pCurDrive = default_drive + 1; 106 .loc 1 467 0 0 00006F86 A0[0000] mov al, byte ptr [_default_drive] 108 _.LVL9: 0 00006F89 98 cbw 0 00006F8A 40 inc ax 0 00006F8B 8904 mov word ptr [si], ax 468:fcbfns.c **** if (lpFcb->fcb_drive != 0) 112 .loc 1 468 0 0 00006F8D 8EC2 mov es, dx 0 00006F8F 268A0F mov cl, byte ptr es:[bx] 0 00006F92 84C9 test cl, cl 0 00006F94 B8[0000] mov ax, offset __SecPathBuffer 0 00006F97 741B je _.L8 469:fcbfns.c **** { 470:fcbfns.c **** *pCurDrive = lpFcb->fcb_drive; 118 .loc 1 470 0 0 00006F99 884EFE mov byte ptr [bp-2], cl 0 00006F9C 8B4EFE mov cx, word ptr [bp-2] 0 00006F9F B500 mov ch, 0 0 00006FA1 890C mov word ptr [si], cx 471:fcbfns.c **** pszBuffer[0] = 'A' + lpFcb->fcb_drive - 1; 123 .loc 1 471 0 0 00006FA3 268A0F mov cl, byte ptr es:[bx] 0 00006FA6 80C140 add cl, 64 0 00006FA9 96 xchg si, ax 127 _.LVL10: 0 00006FAA 880C mov byte ptr [si], cl 472:fcbfns.c **** pszBuffer[1] = ':'; 129 .loc 1 472 0 0 00006FAC C606[0100]3A mov byte ptr [__SecPathBuffer+1], 58 131 _.LVL11: 473:fcbfns.c **** pszBuffer += 2; 132 .loc 1 473 0 0 00006FB1 B8[0200] mov ax, offset __SecPathBuffer+2 134 _.LVL12: 135 _.L8: 474:fcbfns.c **** } 475:fcbfns.c **** ConvertName83ToNameSZ(pszBuffer, lpFcb->fcb_fname); 136 .loc 1 475 0 0 00006FB4 8D4F01 lea cx, [1+bx] 0 00006FB7 895EFC mov word ptr [bp-4], bx 0 00006FBA 52 push dx 0 00006FBB 8956FE mov word ptr [bp-2], dx 0 00006FBE 51 push cx 0 00006FBF 16 push ss 0 00006FC0 50 push ax 0 00006FC1 E8[FEFF] call _ConvertName83ToNameSZ 145 _.LVL13: 146 _.LBE9: 147 _.LBE8: 460:fcbfns.c **** 148 .loc 1 460 0 0 00006FC4 8B5EFC mov bx, word ptr [bp-4] 0 00006FC7 93 xchg bx, ax 0 00006FC8 8B56FE mov dx, word ptr [bp-2] 0 00006FCB 89EC mov sp, bp 0 00006FCD 5D pop bp 0 00006FCE 5E pop si 0 00006FCF C20600 ret 6 156 _.LFE25: 157 .size _CommonFcbInit.constprop.0, .-_CommonFcbInit.constprop.0 158 .global _FatGetDrvData 159 .type _FatGetDrvData, @function 160 _FatGetDrvData: 161 _.LFB4: 56:fcbfns.c **** static BYTE mdb; 162 .loc 1 56 0 163 _.LVL14: 0 00006FD2 56 push si 0 00006FD3 55 push bp 166 _.LCFI6: 0 00006FD4 89E5 mov bp, sp 168 _.LCFI7: 0 00006FD6 1E push ds 61:fcbfns.c **** if (spc != 0xffff) 170 .loc 1 61 0 0 00006FD7 FF760C push word ptr [bp+12] 0 00006FDA FF760A push word ptr [bp+10] 0 00006FDD 31F6 xor si, si 0 00006FDF 56 push si 0 00006FE0 FF7606 push word ptr [bp+6] 0 00006FE3 E8[FEFF] call _DosGetFree 177 _.LVL15: 0 00006FE6 8946FE mov word ptr [bp-2], ax 179 _.LVL16: 78:fcbfns.c **** } 180 .loc 1 78 0 0 00006FE9 89F0 mov ax, si 182 _.LVL17: 0 00006FEB 89F2 mov dx, si 62:fcbfns.c **** { 184 .loc 1 62 0 0 00006FED 837EFEFF cmp word ptr [bp-2], -1 0 00006FF1 742B je _.L11 187 _.LBB10: 64:fcbfns.c **** /* Point to the media desctriptor for this drive */ 188 .loc 1 64 0 0 00006FF3 807E0600 cmp byte ptr [bp+6], 0 0 00006FF7 752C jne _.L13 64:fcbfns.c **** /* Point to the media desctriptor for this drive */ 191 .loc 1 64 0 is_stmt 0 discriminator 1 0 00006FF9 A0[0000] mov al, byte ptr [_default_drive] 0 00006FFC 98 cbw 194 _.L14: 64:fcbfns.c **** /* Point to the media desctriptor for this drive */ 195 .loc 1 64 0 discriminator 4 0 00006FFD 50 push ax 0 00006FFE E8[FEFF] call _get_dpb 198 _.LVL18: 66:fcbfns.c **** if (dpbp == NULL) 199 .loc 1 66 0 is_stmt 1 discriminator 4 0 00007001 8B5E08 mov bx, word ptr [bp+8] 0 00007004 8A4EFE mov cl, byte ptr [bp-2] 0 00007007 880F mov byte ptr [bx], cl 67:fcbfns.c **** { 203 .loc 1 67 0 discriminator 4 0 00007009 89C1 mov cx, ax 0 0000700B 09D1 or cx, dx 0 0000700D 751E jne _.L15 69:fcbfns.c **** spc &= 0xff; 207 .loc 1 69 0 0 0000700F 8B46FE mov ax, word ptr [bp-2] 209 _.LVL19: 0 00007012 B108 mov cl, 8 0 00007014 D3E8 shr ax, cl 0 00007016 A2[0000] mov byte ptr [_mdb.2324], al 213 _.LVL20: 71:fcbfns.c **** } 214 .loc 1 71 0 0 00007019 B8[0000] mov ax, offset _mdb.2324 0 0000701C 8CD2 mov dx, ss 217 _.LVL21: 218 _.L11: 219 _.LBE10: 79:fcbfns.c **** 220 .loc 1 79 0 0 0000701E 89EC mov sp, bp 0 00007020 5D pop bp 0 00007021 5E pop si 0 00007022 C20800 ret 8 225 _.LVL22: 226 _.L13: 227 _.LBB11: 64:fcbfns.c **** /* Point to the media desctriptor for this drive */ 228 .loc 1 64 0 discriminator 2 0 00007025 8A4606 mov al, byte ptr [bp+6] 0 00007028 30E4 xor ah, ah 0 0000702A 48 dec ax 0 0000702B EBD0 jmp _.L14 233 _.LVL23: 234 _.L15: 75:fcbfns.c **** } 235 .loc 1 75 0 0 0000702D 83C017 add ax, 23 237 _.LVL24: 0 00007030 EBEC jmp _.L11 239 _.LBE11: 240 _.LFE4: 241 .size _FatGetDrvData, .-_FatGetDrvData 242 .global _ParseSkipWh 243 .type _ParseSkipWh, @function 244 _ParseSkipWh: 245 _.LFB6: 178:fcbfns.c **** while (*lpFileName == ' ' || *lpFileName == '\t') 246 .loc 1 178 0 247 _.LVL25: 0 00007032 55 push bp 249 _.LCFI8: 0 00007033 89E5 mov bp, sp 251 _.LCFI9: 0 00007035 8B5606 mov dx, word ptr [bp+6] 179:fcbfns.c **** ++lpFileName; 253 .loc 1 179 0 0 00007038 8B4604 mov ax, word ptr [bp+4] 255 _.LVL26: 256 _.L19: 0 0000703B 8EC2 mov es, dx 0 0000703D 89C3 mov bx, ax 0 0000703F 268A0F mov cl, byte ptr es:[bx] 0 00007042 80F920 cmp cl, 32 0 00007045 7409 je _.L20 0 00007047 80F909 cmp cl, 9 0 0000704A 7404 je _.L20 182:fcbfns.c **** 264 .loc 1 182 0 0 0000704C 5D pop bp 0 0000704D C20400 ret 4 267 _.L20: 180:fcbfns.c **** return lpFileName; 268 .loc 1 180 0 0 00007050 40 inc ax 270 _.LVL27: 0 00007051 EBE8 jmp _.L19 272 _.LFE6: 273 .size _ParseSkipWh, .-_ParseSkipWh === Switch to base=012BB0h -> ".RODATA.STR1.1" 274 .section .rodata.str1.1,"aMS",@progbits,1 275 _.LC0: 0 00001985 2F5C225B5D3C3E7C .string "/\\\"[]<>|.:;,=+\t" 0 0000198D 2E3A3B2C3D2B0900 === Switch to base=002270h -> ".TEXT" 277 .text 278 .global _GetNameField 279 .type _GetNameField, @function 280 _GetNameField: 281 _.LFB7: 187:fcbfns.c **** COUNT nIndex = 0; 282 .loc 1 187 0 283 _.LVL28: 0 00007053 56 push si 0 00007054 57 push di 0 00007055 55 push bp 287 _.LCFI10: 0 00007056 89E5 mov bp, sp 289 _.LCFI11: 0 00007058 83EC0A sub sp, 10 0 0000705B 8B560A mov dx, word ptr [bp+10] 0 0000705E 8B7E0C mov di, word ptr [bp+12] 0 00007061 8B460E mov ax, word ptr [bp+14] 0 00007064 8946FE mov word ptr [bp-2], ax 295 _.LVL29: 191:fcbfns.c **** && nIndex < nFieldSize) 296 .loc 1 191 0 0 00007067 8B7608 mov si, word ptr [bp+8] 188:fcbfns.c **** BYTE cFill = ' '; 298 .loc 1 188 0 0 0000706A 31C9 xor cx, cx 300 _.LVL30: 301 _.L23: 191:fcbfns.c **** && nIndex < nFieldSize) 302 .loc 1 191 0 0 0000706C 8EC2 mov es, dx 0 0000706E 268A04 mov al, byte ptr es:[si] 0 00007071 3C20 cmp al, 32 0 00007073 761E jbe _.L30 0 00007075 8956FA mov word ptr [bp-6], dx 0 00007078 894EFC mov word ptr [bp-4], cx 191:fcbfns.c **** && nIndex < nFieldSize) 309 .loc 1 191 0 is_stmt 0 discriminator 1 0 0000707B 98 cbw 0 0000707C 50 push ax 0 0000707D B8[0000] mov ax, offset _.LC0 0 00007080 50 push ax 0 00007081 E8[FEFF] call _strchr 315 _.LVL31: 192:fcbfns.c **** { 316 .loc 1 192 0 is_stmt 1 discriminator 1 0 00007084 8B4EFC mov cx, word ptr [bp-4] 0 00007087 3B4E10 cmp cx, word ptr [bp+16] 0 0000708A 8B56FA mov dx, word ptr [bp-6] 0 0000708D 7D04 jge _.L30 192:fcbfns.c **** { 321 .loc 1 192 0 is_stmt 0 0 0000708F 85C0 test ax, ax 0 00007091 7404 je _.L27 324 _.LVL32: 325 _.L30: 189:fcbfns.c **** 326 .loc 1 189 0 is_stmt 1 0 00007093 B020 mov al, 32 0 00007095 EB13 jmp _.L25 329 _.LVL33: 330 _.L27: 195:fcbfns.c **** { 331 .loc 1 195 0 0 00007097 8EC2 mov es, dx 0 00007099 268A04 mov al, byte ptr es:[si] 0 0000709C 3C2A cmp al, 42 0 0000709E 7528 jne _.L24 197:fcbfns.c **** cFill = '?'; 336 .loc 1 197 0 0 000070A0 8B5E12 mov bx, word ptr [bp+18] 0 000070A3 C7070100 mov word ptr [bx], 1 339 _.LVL34: 199:fcbfns.c **** break; 340 .loc 1 199 0 0 000070A7 46 inc si 342 _.LVL35: 198:fcbfns.c **** ++lpFileName; 343 .loc 1 198 0 0 000070A8 B03F mov al, 63 345 _.LVL36: 346 _.L25: 0 000070AA 8956FC mov word ptr [bp-4], dx 348 _.LVL37: 212:fcbfns.c **** return lpFileName; 349 .loc 1 212 0 0 000070AD 8B5610 mov dx, word ptr [bp+16] 351 _.LVL38: 0 000070B0 29CA sub dx, cx 0 000070B2 52 push dx 0 000070B3 98 cbw 0 000070B4 50 push ax 0 000070B5 FF76FE push word ptr [bp-2] 0 000070B8 57 push di 0 000070B9 E8[FEFF] call _fmemset 359 _.LVL39: 214:fcbfns.c **** 360 .loc 1 214 0 0 000070BC 96 xchg si, ax 0 000070BD 8B56FC mov dx, word ptr [bp-4] 0 000070C0 89EC mov sp, bp 0 000070C2 5D pop bp 0 000070C3 5F pop di 366 _.LVL40: 0 000070C4 5E pop si 368 _.LVL41: 0 000070C5 C20C00 ret 12 370 _.LVL42: 371 _.L24: 203:fcbfns.c **** *pbWildCard = TRUE; 372 .loc 1 203 0 0 000070C8 3C3F cmp al, 63 0 000070CA 7507 jne _.L26 204:fcbfns.c **** 375 .loc 1 204 0 0 000070CC 8B5E12 mov bx, word ptr [bp+18] 0 000070CF C7070100 mov word ptr [bx], 1 378 _.L26: 0 000070D3 894EF6 mov word ptr [bp-10], cx 207:fcbfns.c **** ++nIndex; 380 .loc 1 207 0 0 000070D6 89F8 mov ax, di 0 000070D8 40 inc ax 0 000070D9 8946FC mov word ptr [bp-4], ax 384 _.LVL43: 0 000070DC 89F0 mov ax, si 386 _.LVL44: 0 000070DE 40 inc ax 0 000070DF 8946FA mov word ptr [bp-6], ax 389 _.LVL45: 0 000070E2 8EC2 mov es, dx 0 000070E4 8956F8 mov word ptr [bp-8], dx 0 000070E7 26FF34 push word ptr es:[si] 0 000070EA E8[FEFF] call _DosUpFChar 394 _.LVL46: 0 000070ED 8E46FE mov es, word ptr [bp-2] 0 000070F0 268805 mov byte ptr es:[di], al 397 _.LVL47: 208:fcbfns.c **** } 398 .loc 1 208 0 0 000070F3 8B4EF6 mov cx, word ptr [bp-10] 0 000070F6 41 inc cx 401 _.LVL48: 207:fcbfns.c **** ++nIndex; 402 .loc 1 207 0 0 000070F7 8B7EFC mov di, word ptr [bp-4] 0 000070FA 8B76FA mov si, word ptr [bp-6] 0 000070FD 8B56F8 mov dx, word ptr [bp-8] 0 00007100 E969FF jmp _.L23 407 _.LFE7: 408 .size _GetNameField, .-_GetNameField === Switch to base=012BB0h -> ".RODATA.STR1.1" 409 .section .rodata.str1.1 410 _.LC1: 0 00001995 3A3B2C3D2B200900 .string ":;,=+ \t" === Switch to base=002270h -> ".TEXT" 412 .text 413 .global _FcbParseFname 414 .type _FcbParseFname, @function 415 _FcbParseFname: 416 _.LFB5: 92:fcbfns.c **** WORD wRetCodeDrive = FALSE, wRetCodeName = FALSE, wRetCodeExt = FALSE; 417 .loc 1 92 0 418 _.LVL49: 0 00007103 56 push si 0 00007104 57 push di 0 00007105 55 push bp 422 _.LCFI12: 0 00007106 89E5 mov bp, sp 424 _.LCFI13: 0 00007108 83EC0E sub sp, 14 0 0000710B 8B7608 mov si, word ptr [bp+8] 0 0000710E 8B5E0A mov bx, word ptr [bp+10] 0 00007111 8B460C mov ax, word ptr [bp+12] 0 00007114 8946F8 mov word ptr [bp-8], ax 0 00007117 8B7E0E mov di, word ptr [bp+14] 0 0000711A 8B4610 mov ax, word ptr [bp+16] 0 0000711D 8946FA mov word ptr [bp-6], ax 433 _.LVL50: 93:fcbfns.c **** 434 .loc 1 93 0 0 00007120 C746FC0000 mov word ptr [bp-4], 0 0 00007125 C746FE0000 mov word ptr [bp-2], 0 98:fcbfns.c **** { 437 .loc 1 98 0 0 0000712A F60401 test byte ptr [si], 1 0 0000712D 7420 je _.L37 440 _.LVL51: 441 _.L38: 100:fcbfns.c **** ++lpFileName; 442 .loc 1 100 0 0 0000712F 8E46F8 mov es, word ptr [bp-8] 0 00007132 268A07 mov al, byte ptr es:[bx] 0 00007135 84C0 test al, al 0 00007137 7416 je _.L37 0 00007139 895EF6 mov word ptr [bp-10], bx 100:fcbfns.c **** ++lpFileName; 448 .loc 1 100 0 is_stmt 0 discriminator 1 0 0000713C 98 cbw 0 0000713D 50 push ax 0 0000713E B8[1000] mov ax, offset _.LC1 0 00007141 50 push ax 0 00007142 E8[FEFF] call _strchr 454 _.LVL52: 0 00007145 85C0 test ax, ax 0 00007147 8B5EF6 mov bx, word ptr [bp-10] 0 0000714A 7403E9ED00 jne _.L39 458 _.LVL53: 459 _.L37: 105:fcbfns.c **** 460 .loc 1 105 0 is_stmt 1 0 0000714F FF76F8 push word ptr [bp-8] 0 00007152 53 push bx 0 00007153 E8[FEFF] call _ParseSkipWh 464 _.LVL54: 0 00007156 93 xchg bx, ax 0 00007157 8956F8 mov word ptr [bp-8], dx 467 _.LVL55: 115:fcbfns.c **** { 468 .loc 1 115 0 0 0000715A 8EC2 mov es, dx 0 0000715C 268A07 mov al, byte ptr es:[bx] 471 _.LVL56: 0 0000715F 3C20 cmp al, 32 0 00007161 7703E9DA00 jbe _.L40 0 00007166 895EF6 mov word ptr [bp-10], bx 115:fcbfns.c **** { 475 .loc 1 115 0 is_stmt 0 discriminator 1 0 00007169 98 cbw 0 0000716A 50 push ax 0 0000716B B8[0000] mov ax, offset _.LC0 0 0000716E 50 push ax 0 0000716F E8[FEFF] call _strchr 481 _.LVL57: 0 00007172 85C0 test ax, ax 0 00007174 8B5EF6 mov bx, word ptr [bp-10] 0 00007177 7403E9C400 jne _.L40 115:fcbfns.c **** { 485 .loc 1 115 0 discriminator 2 0 0000717C 8E46F8 mov es, word ptr [bp-8] 0 0000717F 26807F013A cmp byte ptr es:[bx+1], 58 0 00007184 7403E9B700 jne _.L40 489 _.LBB12: 118:fcbfns.c **** 490 .loc 1 118 0 is_stmt 1 0 00007189 26FF37 push word ptr es:[bx] 0 0000718C 895EF2 mov word ptr [bp-14], bx 0 0000718F E8[FEFF] call _DosUpFChar 494 _.LVL58: 120:fcbfns.c **** wRetCodeDrive = TRUE; 495 .loc 1 120 0 0 00007192 8846F4 mov byte ptr [bp-12], al 0 00007195 04BF add al, -65 0 00007197 30E4 xor ah, ah 0 00007199 50 push ax 0 0000719A E8[FEFF] call _get_cds 501 _.LVL59: 0 0000719D 09D0 or ax, dx 0 0000719F 9F lahf 0 000071A0 D0E4 shl ah, 1 0 000071A2 99 cwd 0 000071A3 F6DA neg dl 507 _.LBE12: 93:fcbfns.c **** 508 .loc 1 93 0 0 000071A5 30F6 xor dh, dh 0 000071A7 8956F6 mov word ptr [bp-10], dx 511 _.LVL60: 512 _.LBB13: 123:fcbfns.c **** lpFileName += 2; 513 .loc 1 123 0 0 000071AA 8A4EF4 mov cl, byte ptr [bp-12] 0 000071AD 80C1C0 add cl, -64 0 000071B0 8E46FA mov es, word ptr [bp-6] 0 000071B3 26880D mov byte ptr es:[di], cl 518 _.LVL61: 124:fcbfns.c **** } else if (!(*wTestMode & PARSE_DFLT_DRIVE)) { 519 .loc 1 124 0 0 000071B6 8B5EF2 mov bx, word ptr [bp-14] 0 000071B9 83C302 add bx, 2 522 _.L41: 523 _.LVL62: 524 _.LBE13: 132:fcbfns.c **** 525 .loc 1 132 0 0 000071BC 8E46FA mov es, word ptr [bp-6] 0 000071BF 26C7450E0000 mov word ptr es:[di+14], 0 528 _.LVL63: 0 000071C5 8E46FA mov es, word ptr [bp-6] 0 000071C8 26C7450C0000 mov word ptr es:[di+12], 0 134:fcbfns.c **** { 531 .loc 1 134 0 0 000071CE F60404 test byte ptr [si], 4 0 000071D1 7518 jne _.L42 0 000071D3 895EF4 mov word ptr [bp-12], bx 136:fcbfns.c **** } 535 .loc 1 136 0 0 000071D6 B80800 mov ax, 8 0 000071D9 50 push ax 0 000071DA B82000 mov ax, 32 0 000071DD 50 push ax 0 000071DE 8D4501 lea ax, [1+di] 0 000071E1 FF76FA push word ptr [bp-6] 0 000071E4 50 push ax 0 000071E5 E8[FEFF] call _fmemset 544 _.LVL64: 0 000071E8 8B5EF4 mov bx, word ptr [bp-12] 546 _.L42: 138:fcbfns.c **** { 547 .loc 1 138 0 0 000071EB F60408 test byte ptr [si], 8 0 000071EE 7518 jne _.L43 0 000071F0 895EF4 mov word ptr [bp-12], bx 140:fcbfns.c **** } 551 .loc 1 140 0 0 000071F3 B80300 mov ax, 3 0 000071F6 50 push ax 0 000071F7 B82000 mov ax, 32 0 000071FA 50 push ax 0 000071FB 8D4509 lea ax, [9+di] 0 000071FE FF76FA push word ptr [bp-6] 0 00007201 50 push ax 0 00007202 E8[FEFF] call _fmemset 560 _.LVL65: 0 00007205 8B5EF4 mov bx, word ptr [bp-12] 562 _.L43: 144:fcbfns.c **** { 563 .loc 1 144 0 0 00007208 8E46F8 mov es, word ptr [bp-8] 0 0000720B 26803F2E cmp byte ptr es:[bx], 46 0 0000720F 7543 jne _.L44 146:fcbfns.c **** ++lpFileName; 567 .loc 1 146 0 0 00007211 8E46FA mov es, word ptr [bp-6] 0 00007214 26C645012E mov byte ptr es:[di+1], 46 148:fcbfns.c **** { 570 .loc 1 148 0 0 00007219 8E46F8 mov es, word ptr [bp-8] 147:fcbfns.c **** if (*lpFileName == '.') 572 .loc 1 147 0 0 0000721C 8D4701 lea ax, [1+bx] 148:fcbfns.c **** { 574 .loc 1 148 0 0 0000721F 26807F012E cmp byte ptr es:[bx+1], 46 0 00007224 750B jne _.L46 150:fcbfns.c **** ++lpFileName; 577 .loc 1 150 0 0 00007226 8E46FA mov es, word ptr [bp-6] 0 00007229 26C645022E mov byte ptr es:[di+2], 46 151:fcbfns.c **** } 580 .loc 1 151 0 0 0000722E 8D4702 lea ax, [2+bx] 582 _.L46: 153:fcbfns.c **** return FP_OFF(lpFileName); 583 .loc 1 153 0 0 00007231 C60400 mov byte ptr [si], 0 585 _.L36: 175:fcbfns.c **** 586 .loc 1 175 0 0 00007234 89EC mov sp, bp 0 00007236 5D pop bp 0 00007237 5F pop di 0 00007238 5E pop si 0 00007239 C20A00 ret 10 592 _.LVL66: 593 _.L39: 101:fcbfns.c **** } 594 .loc 1 101 0 0 0000723C 43 inc bx 596 _.LVL67: 0 0000723D E9EFFE jmp _.L38 598 _.LVL68: 599 _.L40: 125:fcbfns.c **** lpFcb->fcb_drive = FDFLT_DRIVE; 600 .loc 1 125 0 0 00007240 8A04 mov al, byte ptr [si] 0 00007242 2402 and al, 2 0 00007244 7506 jne _.L52 126:fcbfns.c **** } 604 .loc 1 126 0 0 00007246 8E46FA mov es, word ptr [bp-6] 0 00007249 268805 mov byte ptr es:[di], al 607 _.LVL69: 608 _.L52: 93:fcbfns.c **** 609 .loc 1 93 0 0 0000724C C746F60000 mov word ptr [bp-10], 0 0 00007251 E968FF jmp _.L41 612 _.LVL70: 613 _.L44: 158:fcbfns.c **** GetNameField(lpFileName, (BYTE FAR *) lpFcb->fcb_fname, FNAME_SIZE, 614 .loc 1 158 0 0 00007254 8D46FC lea ax, [-4+bp] 0 00007257 50 push ax 0 00007258 B80800 mov ax, 8 0 0000725B 50 push ax 159:fcbfns.c **** (BOOL *) & wRetCodeName); 619 .loc 1 159 0 0 0000725C 8D4501 lea ax, [1+di] 158:fcbfns.c **** GetNameField(lpFileName, (BYTE FAR *) lpFcb->fcb_fname, FNAME_SIZE, 621 .loc 1 158 0 0 0000725F FF76FA push word ptr [bp-6] 0 00007262 50 push ax 0 00007263 FF76F8 push word ptr [bp-8] 0 00007266 53 push bx 0 00007267 E8[FEFF] call _GetNameField 627 _.LVL71: 0 0000726A 93 xchg bx, ax 629 _.LVL72: 163:fcbfns.c **** lpFileName = 630 .loc 1 163 0 0 0000726B 8EC2 mov es, dx 0 0000726D 26803F2E cmp byte ptr es:[bx], 46 0 00007271 7518 jne _.L48 164:fcbfns.c **** GetNameField(++lpFileName, (BYTE FAR *) lpFcb->fcb_fext, 634 .loc 1 164 0 0 00007273 8D4701 lea ax, [1+bx] 636 _.LVL73: 0 00007276 8D4EFE lea cx, [-2+bp] 0 00007279 51 push cx 0 0000727A B90300 mov cx, 3 0 0000727D 51 push cx 165:fcbfns.c **** FEXT_SIZE, (BOOL *) & wRetCodeExt); 641 .loc 1 165 0 0 0000727E 8D4D09 lea cx, [9+di] 164:fcbfns.c **** GetNameField(++lpFileName, (BYTE FAR *) lpFcb->fcb_fext, 643 .loc 1 164 0 0 00007281 FF76FA push word ptr [bp-6] 0 00007284 51 push cx 0 00007285 52 push dx 0 00007286 50 push ax 0 00007287 E8[FEFF] call _GetNameField 649 _.LVL74: 0 0000728A 93 xchg bx, ax 651 _.L48: 168:fcbfns.c **** *wTestMode = PARSE_RET_BADDRIVE; 652 .loc 1 168 0 0 0000728B 837EF600 cmp word ptr [bp-10], 0 0 0000728F 7406 je _.L49 169:fcbfns.c **** else if (wRetCodeName | wRetCodeExt) 655 .loc 1 169 0 0 00007291 C604FF mov byte ptr [si], -1 657 _.L50: 174:fcbfns.c **** } 658 .loc 1 174 0 0 00007294 93 xchg bx, ax 0 00007295 EB9D jmp _.L36 661 _.L49: 171:fcbfns.c **** else 662 .loc 1 171 0 0 00007297 8B56FE mov dx, word ptr [bp-2] 0 0000729A 0B56FC or dx, word ptr [bp-4] 0 0000729D 9F lahf 0 0000729E D0E4 shl ah, 1 0 000072A0 99 cwd 0 000072A1 FEC2 inc dl 0 000072A3 8814 mov byte ptr [si], dl 0 000072A5 EBED jmp _.L50 671 _.LFE5: 672 .size _FcbParseFname, .-_FcbParseFname 673 .global _FcbReadWrite 674 .type _FcbReadWrite, @function 675 _FcbReadWrite: 676 _.LFB10: 231:fcbfns.c **** ULONG lPosit; 677 .loc 1 231 0 678 _.LVL75: 0 000072A7 56 push si 0 000072A8 57 push di 0 000072A9 55 push bp 682 _.LCFI14: 0 000072AA 89E5 mov bp, sp 684 _.LCFI15: 0 000072AC 83EC0A sub sp, 10 240:fcbfns.c **** 686 .loc 1 240 0 0 000072AF FF760A push word ptr [bp+10] 0 000072B2 FF7608 push word ptr [bp+8] 0 000072B5 E84BFC call _ExtFcbToFcb 690 _.LVL76: 0 000072B8 8946FE mov word ptr [bp-2], ax 0 000072BB 8956FC mov word ptr [bp-4], dx 693 _.LVL77: 242:fcbfns.c **** bigsize = (ULONG)recsiz * recno; 694 .loc 1 242 0 0 000072BE 8EC2 mov es, dx 0 000072C0 93 xchg bx, ax 0 000072C1 268B7F0E mov di, word ptr es:[bx+14] 698 _.LVL78: 243:fcbfns.c **** if (bigsize > 0xffff) 699 .loc 1 243 0 0 000072C5 89F8 mov ax, di 701 _.LVL79: 0 000072C7 F7660C mul word ptr [bp+12] 0 000072CA 8946F8 mov word ptr [bp-8], ax 0 000072CD 8956FA mov word ptr [bp-6], dx 705 _.LVL80: 245:fcbfns.c **** size = (unsigned)bigsize; 706 .loc 1 245 0 0 000072D0 B002 mov al, 2 244:fcbfns.c **** return FCB_ERR_SEGMENT_WRAP; 708 .loc 1 244 0 0 000072D2 85D2 test dx, dx 0 000072D4 7554 jne _.L60 711 _.LVL81: 248:fcbfns.c **** return FCB_ERR_SEGMENT_WRAP; 712 .loc 1 248 0 0 000072D6 8B56F8 mov dx, word ptr [bp-8] 714 _.LVL82: 0 000072D9 0316[0000] add dx, word ptr [_dta] 0 000072DD 724B jc _.L60 717 _.LVL83: 254:fcbfns.c **** return FCB_ERR_NODATA; 718 .loc 1 254 0 0 000072DF FF76FA push word ptr [bp-6] 720 _.LVL84: 721 _.LBB20: 722 _.LBB21: 227:fcbfns.c **** } 723 .loc 1 227 0 0 000072E2 268B570C mov dx, word ptr es:[bx+12] 0 000072E6 89D0 mov ax, dx 0 000072E8 B109 mov cl, 9 0 000072EA D3E8 shr ax, cl 0 000072EC B107 mov cl, 7 0 000072EE D3E2 shl dx, cl 0 000072F0 89D6 mov si, dx 0 000072F2 268A5720 mov dl, byte ptr es:[bx+32] 0 000072F6 8856F6 mov byte ptr [bp-10], dl 0 000072F9 8A56F6 mov dl, byte ptr [bp-10] 0 000072FC 30F6 xor dh, dh 0 000072FE 8B4EFA mov cx, word ptr [bp-6] 0 00007301 01D6 add si, dx 0 00007303 11C1 adc cx, ax 738 _.LBE21: 739 _.LBE20: 253:fcbfns.c **** if ((CritErrCode = -SftSeek(lpFcb->fcb_sftno, lPosit, 0)) != SUCCESS) 740 .loc 1 253 0 0 00007305 91 xchg cx, ax 0 00007306 F7E7 mul di 0 00007308 91 xchg cx, ax 0 00007309 96 xchg si, ax 0 0000730A F7E7 mul di 0 0000730C 01D1 add cx, dx 254:fcbfns.c **** return FCB_ERR_NODATA; 747 .loc 1 254 0 0 0000730E 51 push cx 0 0000730F 50 push ax 0 00007310 8B5EFE mov bx, word ptr [bp-2] 0 00007313 268A4718 mov al, byte ptr es:[bx+24] 0 00007317 98 cbw 0 00007318 50 push ax 0 00007319 E8[FEFF] call _SftSeek 755 _.LVL85: 0 0000731C 89C2 mov dx, ax 0 0000731E F7DA neg dx 0 00007320 8916[0000] mov word ptr [_CritErrCode], dx 0 00007324 85C0 test ax, ax 0 00007326 740A je _.L63 761 _.LVL86: 762 _.L70: 255:fcbfns.c **** 763 .loc 1 255 0 0 00007328 B001 mov al, 1 765 _.L60: 283:fcbfns.c **** 766 .loc 1 283 0 0 0000732A 89EC mov sp, bp 0 0000732C 5D pop bp 0 0000732D 5F pop di 0 0000732E 5E pop si 0 0000732F C20800 ret 8 772 _.LVL87: 773 _.L63: 258:fcbfns.c **** if (nTransfer < 0) 774 .loc 1 258 0 0 00007332 8B460E mov ax, word ptr [bp+14] 0 00007335 83E0FB and ax, -5 0 00007338 50 push ax 0 00007339 FF36[0200] push word ptr [_dta+2] 0 0000733D FF36[0000] push word ptr [_dta] 0 00007341 FF76F8 push word ptr [bp-8] 0 00007344 8E46FC mov es, word ptr [bp-4] 0 00007347 8B5EFE mov bx, word ptr [bp-2] 0 0000734A 268A4718 mov al, byte ptr es:[bx+24] 0 0000734E 98 cbw 0 0000734F 50 push ax 0 00007350 E8[FEFF] call _DosRWSft 787 _.LVL88: 0 00007353 89C3 mov bx, ax 789 _.LVL89: 259:fcbfns.c **** CritErrCode = -(int)nTransfer; 790 .loc 1 259 0 0 00007355 85D2 test dx, dx 0 00007357 7D05 jge _.L64 260:fcbfns.c **** 793 .loc 1 260 0 0 00007359 F7D8 neg ax 795 _.LVL90: 0 0000735B A3[0000] mov word ptr [_CritErrCode], ax 797 _.L64: 263:fcbfns.c **** lpFcb->fcb_fsize = SftGetFsize(lpFcb->fcb_sftno); 798 .loc 1 263 0 0 0000735E F6460E02 test byte ptr [bp+14], 2 0 00007362 7429 je _.L66 0 00007364 895EF6 mov word ptr [bp-10], bx 264:fcbfns.c **** 802 .loc 1 264 0 0 00007367 8E46FC mov es, word ptr [bp-4] 0 0000736A 8B5EFE mov bx, word ptr [bp-2] 805 _.LVL91: 0 0000736D 268A4718 mov al, byte ptr es:[bx+24] 0 00007371 98 cbw 0 00007372 50 push ax 0 00007373 E8[FEFF] call _SftGetFsize 810 _.LVL92: 0 00007376 8E46FC mov es, word ptr [bp-4] 0 00007379 8B5EFE mov bx, word ptr [bp-2] 0 0000737C 26894710 mov word ptr es:[bx+16], ax 814 _.LVL93: 0 00007380 8E46FC mov es, word ptr [bp-4] 0 00007383 8B5EFE mov bx, word ptr [bp-2] 0 00007386 26895712 mov word ptr es:[bx+18], dx 0 0000738A 8B5EF6 mov bx, word ptr [bp-10] 819 _.L66: 267:fcbfns.c **** lpFcb->fcb_rndm += ((unsigned)nTransfer + recsiz - 1) / recsiz; 820 .loc 1 267 0 0 0000738D F6460E04 test byte ptr [bp+14], 4 0 00007391 742E je _.L67 0 00007393 85FF test di, di 0 00007395 742A je _.L67 268:fcbfns.c **** size -= (unsigned)nTransfer; 825 .loc 1 268 0 0 00007397 8D41FF lea ax, [-1+bx+di] 0 0000739A 31D2 xor dx, dx 0 0000739C F7F7 div di 0 0000739E 96 xchg si, ax 0 0000739F 31C9 xor cx, cx 0 000073A1 8E46FC mov es, word ptr [bp-4] 0 000073A4 8B7EFE mov di, word ptr [bp-2] 833 _.LVL94: 0 000073A7 268B4521 mov ax, word ptr es:[di+33] 0 000073AB 268B5523 mov dx, word ptr es:[di+35] 0 000073AF 01F0 add ax, si 0 000073B1 11D1 adc cx, dx 0 000073B3 26894521 mov word ptr es:[di+33], ax 0 000073B7 8E46FC mov es, word ptr [bp-4] 0 000073BA 8B7EFE mov di, word ptr [bp-2] 0 000073BD 26894D23 mov word ptr es:[di+35], cx 842 _.L67: 843 _.LVL95: 270:fcbfns.c **** { 844 .loc 1 270 0 0 000073C1 8B46F8 mov ax, word ptr [bp-8] 846 _.LBB22: 847 _.LBB23: 218:fcbfns.c **** { 848 .loc 1 218 0 0 000073C4 8E46FC mov es, word ptr [bp-4] 850 _.LBE23: 851 _.LBE22: 270:fcbfns.c **** { 852 .loc 1 270 0 0 000073C7 29D8 sub ax, bx 854 _.LVL96: 0 000073C9 752C jne _.L68 856 _.LVL97: 857 _.LBB25: 858 _.LBB24: 218:fcbfns.c **** { 859 .loc 1 218 0 0 000073CB 8B5EFE mov bx, word ptr [bp-2] 0 000073CE 268A5720 mov dl, byte ptr es:[bx+32] 0 000073D2 8856F8 mov byte ptr [bp-8], dl 0 000073D5 FEC2 inc dl 0 000073D7 7807 js _.L69 0 000073D9 26885720 mov byte ptr es:[bx+32], dl 866 _.LVL98: 0 000073DD E94AFF jmp _.L60 868 _.L69: 220:fcbfns.c **** ++lpFcb->fcb_cublock; 869 .loc 1 220 0 0 000073E0 8E46FC mov es, word ptr [bp-4] 871 _.LVL99: 0 000073E3 8B5EFE mov bx, word ptr [bp-2] 873 _.LVL100: 0 000073E6 26884720 mov byte ptr es:[bx+32], al 875 _.LVL101: 221:fcbfns.c **** } 876 .loc 1 221 0 0 000073EA 8E46FC mov es, word ptr [bp-4] 0 000073ED 8B5EFE mov bx, word ptr [bp-2] 0 000073F0 26FF470C inc word ptr es:[bx+12] 0 000073F4 E933FF jmp _.L60 881 _.L68: 882 _.LBE24: 883 _.LBE25: 275:fcbfns.c **** if (mode & XFR_READ && size > 0) 884 .loc 1 275 0 0 000073F7 8B7EFE mov di, word ptr [bp-2] 0 000073FA 31D2 xor dx, dx 0 000073FC 26F7750E div word ptr es:[di+14] 888 _.LVL102: 276:fcbfns.c **** { 889 .loc 1 276 0 0 00007400 85D2 test dx, dx 0 00007402 7503E921FF je _.L70 0 00007407 F6460E01 test byte ptr [bp+14], 1 0 0000740B 7503E918FF je _.L70 278:fcbfns.c **** FcbNextRecord(lpFcb); 894 .loc 1 278 0 0 00007410 52 push dx 0 00007411 31C0 xor ax, ax 0 00007413 50 push ax 0 00007414 93 xchg bx, ax 0 00007415 0306[0000] add ax, word ptr [_dta] 0 00007419 FF36[0200] push word ptr [_dta+2] 0 0000741D 50 push ax 0 0000741E E8[FEFF] call _fmemset 903 _.LVL103: 904 _.LBB26: 905 _.LBB27: 218:fcbfns.c **** { 906 .loc 1 218 0 0 00007421 8E46FC mov es, word ptr [bp-4] 0 00007424 8B5EFE mov bx, word ptr [bp-2] 0 00007427 268A4720 mov al, byte ptr es:[bx+32] 0 0000742B 8846F8 mov byte ptr [bp-8], al 0 0000742E FEC0 inc al 0 00007430 7809 js _.L71 0 00007432 26884720 mov byte ptr es:[bx+32], al 914 _.LVL104: 915 _.L90: 916 _.LBE27: 917 _.LBE26: 280:fcbfns.c **** } 918 .loc 1 280 0 0 00007436 B003 mov al, 3 0 00007438 E9EFFE jmp _.L60 921 _.LVL105: 922 _.L71: 923 _.LBB29: 924 _.LBB28: 220:fcbfns.c **** ++lpFcb->fcb_cublock; 925 .loc 1 220 0 0 0000743B 8E46FC mov es, word ptr [bp-4] 927 _.LVL106: 0 0000743E 8B5EFE mov bx, word ptr [bp-2] 929 _.LVL107: 0 00007441 26C6472000 mov byte ptr es:[bx+32], 0 931 _.LVL108: 221:fcbfns.c **** } 932 .loc 1 221 0 0 00007446 8E46FC mov es, word ptr [bp-4] 0 00007449 8B5EFE mov bx, word ptr [bp-2] 0 0000744C 26FF470C inc word ptr es:[bx+12] 0 00007450 EBE4 jmp _.L90 937 _.LBE28: 938 _.LBE29: 939 _.LFE10: 940 .size _FcbReadWrite, .-_FcbReadWrite 941 .global _FcbGetFileSize 942 .type _FcbGetFileSize, @function 943 _FcbGetFileSize: 944 _.LFB11: 286:fcbfns.c **** int FcbDrive, sft_idx; 945 .loc 1 286 0 946 _.LVL109: 0 00007452 56 push si 0 00007453 57 push di 0 00007454 55 push bp 950 _.LCFI16: 0 00007455 89E5 mov bp, sp 952 _.LCFI17: 0 00007457 83EC08 sub sp, 8 291:fcbfns.c **** recsiz = lpFcb->fcb_recsiz; 954 .loc 1 291 0 0 0000745A 8D46FE lea ax, [-2+bp] 0 0000745D 50 push ax 0 0000745E FF760A push word ptr [bp+10] 0 00007461 FF7608 push word ptr [bp+8] 0 00007464 E804FB call _CommonFcbInit.constprop.0 960 _.LVL110: 0 00007467 8946FC mov word ptr [bp-4], ax 0 0000746A 8956FA mov word ptr [bp-6], dx 963 _.LVL111: 295:fcbfns.c **** return FCB_ERROR; 964 .loc 1 295 0 0 0000746D 09D0 or ax, dx 966 _.LVL112: 0 0000746F 7504 jne _.L92 968 _.LVL113: 969 _.L97: 315:fcbfns.c **** } 970 .loc 1 315 0 0 00007471 B0FF mov al, -1 0 00007473 EB74 jmp _.L91 973 _.LVL114: 974 _.L92: 292:fcbfns.c **** 975 .loc 1 292 0 discriminator 1 0 00007475 8E46FA mov es, word ptr [bp-6] 0 00007478 8B5EFC mov bx, word ptr [bp-4] 0 0000747B 268B470E mov ax, word ptr es:[bx+14] 0 0000747F 8946F8 mov word ptr [bp-8], ax 980 _.LVL115: 295:fcbfns.c **** return FCB_ERROR; 981 .loc 1 295 0 discriminator 1 0 00007482 BE[0000] mov si, offset __SecPathBuffer 0 00007485 8CD7 mov di, ss 0 00007487 16 push ss 0 00007488 56 push si 0 00007489 E8[FEFF] call _IsDevice 987 _.LVL116: 0 0000748C 09D0 or ax, dx 0 0000748E 75E1 jne _.L97 0 00007490 837EF801 cmp word ptr [bp-8], 1 0 00007494 72DB jc _.L97 298:fcbfns.c **** if (sft_idx >= 0) 992 .loc 1 298 0 0 00007496 31C0 xor ax, ax 0 00007498 50 push ax 0 00007499 B80009 mov ax, 2304 0 0000749C 50 push ax 0 0000749D 57 push di 0 0000749E 56 push si 0 0000749F E8[FEFF] call _DosOpenSft 1000 _.LVL117: 0 000074A2 89C6 mov si, ax 1002 _.LVL118: 299:fcbfns.c **** { 1003 .loc 1 299 0 0 000074A4 85C0 test ax, ax 0 000074A6 7C49 jl _.L95 1006 _.LBB30: 304:fcbfns.c **** 1007 .loc 1 304 0 0 000074A8 50 push ax 0 000074A9 E8[FEFF] call _SftGetFsize 1010 _.LVL119: 0 000074AC 93 xchg bx, ax 0 000074AD 89D1 mov cx, dx 1013 _.LVL120: 307:fcbfns.c **** 1014 .loc 1 307 0 0 000074AF 8B46F8 mov ax, word ptr [bp-8] 1016 _.LVL121: 0 000074B2 48 dec ax 0 000074B3 31FF xor di, di 0 000074B5 01D8 add ax, bx 0 000074B7 11F9 adc cx, di 1021 _.LVL122: 0 000074B9 57 push di 0 000074BA FF76F8 push word ptr [bp-8] 0 000074BD 51 push cx 0 000074BE 50 push ax 0 000074BF E8[FEFF] call ___udivsi3 1027 _.LVL123: 0 000074C2 8E46FA mov es, word ptr [bp-6] 0 000074C5 8B5EFC mov bx, word ptr [bp-4] 0 000074C8 26894721 mov word ptr es:[bx+33], ax 1031 _.LVL124: 0 000074CC 8E46FA mov es, word ptr [bp-6] 0 000074CF 8B5EFC mov bx, word ptr [bp-4] 0 000074D2 26895723 mov word ptr es:[bx+35], dx 310:fcbfns.c **** return FCB_SUCCESS; 1035 .loc 1 310 0 0 000074D6 57 push di 0 000074D7 56 push si 0 000074D8 E8[FEFF] call _DosCloseSft 1039 _.LVL125: 0 000074DB 89C2 mov dx, ax 0 000074DD F7DA neg dx 0 000074DF 8916[0000] mov word ptr [_CritErrCode], dx 0 000074E3 83F801 cmp ax, 1 0 000074E6 F5 cmc 0 000074E7 18C0 sbb al, al 1046 _.LVL126: 1047 _.L91: 1048 _.LBE30: 316:fcbfns.c **** 1049 .loc 1 316 0 0 000074E9 89EC mov sp, bp 0 000074EB 5D pop bp 0 000074EC 5F pop di 0 000074ED 5E pop si 0 000074EE C20400 ret 4 1055 _.LVL127: 1056 _.L95: 314:fcbfns.c **** return FCB_ERROR; 1057 .loc 1 314 0 0 000074F1 F7D8 neg ax 1059 _.LVL128: 0 000074F3 A3[0000] mov word ptr [_CritErrCode], ax 0 000074F6 E978FF jmp _.L97 1062 _.LFE11: 1063 .size _FcbGetFileSize, .-_FcbGetFileSize 1064 .global _FcbSetRandom 1065 .type _FcbSetRandom, @function 1066 _FcbSetRandom: 1067 _.LFB12: 319:fcbfns.c **** /* Convert to fcb if necessary */ 1068 .loc 1 319 0 1069 _.LVL129: 0 000074F9 56 push si 0 000074FA 57 push di 0 000074FB 55 push bp 1073 _.LCFI18: 0 000074FC 89E5 mov bp, sp 1075 _.LCFI19: 0 000074FE 83EC06 sub sp, 6 321:fcbfns.c **** 1077 .loc 1 321 0 0 00007501 FF760A push word ptr [bp+10] 0 00007504 FF7608 push word ptr [bp+8] 0 00007507 E8F9F9 call _ExtFcbToFcb 1081 _.LVL130: 1082 _.LBB31: 1083 _.LBB32: 227:fcbfns.c **** } 1084 .loc 1 227 0 0 0000750A 8EC2 mov es, dx 0 0000750C 89C3 mov bx, ax 0 0000750E 268B5F0C mov bx, word ptr es:[bx+12] 0 00007512 31FF xor di, di 0 00007514 89DE mov si, bx 0 00007516 B109 mov cl, 9 0 00007518 D3EE shr si, cl 0 0000751A 8976FC mov word ptr [bp-4], si 0 0000751D B107 mov cl, 7 0 0000751F D3E3 shl bx, cl 0 00007521 895EFE mov word ptr [bp-2], bx 0 00007524 89C3 mov bx, ax 0 00007526 268A4F20 mov cl, byte ptr es:[bx+32] 0 0000752A 884EFA mov byte ptr [bp-6], cl 0 0000752D 8A5EFA mov bl, byte ptr [bp-6] 0 00007530 30FF xor bh, bh 0 00007532 035EFE add bx, word ptr [bp-2] 0 00007535 8B4EFC mov cx, word ptr [bp-4] 0 00007538 11F9 adc cx, di 1104 _.LBE32: 1105 _.LBE31: 325:fcbfns.c **** } 1106 .loc 1 325 0 0 0000753A 89C7 mov di, ax 0 0000753C 26895D21 mov word ptr es:[di+33], bx 1109 _.LVL131: 0 00007540 93 xchg bx, ax 0 00007541 26894F23 mov word ptr es:[bx+35], cx 326:fcbfns.c **** 1112 .loc 1 326 0 0 00007545 89EC mov sp, bp 0 00007547 5D pop bp 0 00007548 5F pop di 0 00007549 5E pop si 0 0000754A C20400 ret 4 1118 _.LFE12: 1119 .size _FcbSetRandom, .-_FcbSetRandom 1120 .global _FcbRandomBlockIO 1121 .type _FcbRandomBlockIO, @function 1122 _FcbRandomBlockIO: 1123 _.LFB14: 341:fcbfns.c **** UBYTE nErrorCode; 1124 .loc 1 341 0 1125 _.LVL132: 0 0000754D 56 push si 0 0000754E 57 push di 0 0000754F 55 push bp 1129 _.LCFI20: 0 00007550 89E5 mov bp, sp 1131 _.LCFI21: 0 00007552 83EC08 sub sp, 8 0 00007555 8B7608 mov si, word ptr [bp+8] 0 00007558 8B7E0A mov di, word ptr [bp+10] 346:fcbfns.c **** 1135 .loc 1 346 0 0 0000755B 57 push di 0 0000755C 56 push si 0 0000755D E8C6F9 call _FcbCalcRec 1139 _.LVL133: 349:fcbfns.c **** 1140 .loc 1 349 0 0 00007560 57 push di 0 00007561 56 push si 0 00007562 E89EF9 call _ExtFcbToFcb 1144 _.LVL134: 0 00007565 93 xchg bx, ax 1146 _.LVL135: 351:fcbfns.c **** nErrorCode = FcbReadWrite(lpXfcb, *nRecords, mode); 1147 .loc 1 351 0 0 00007566 8EC2 mov es, dx 0 00007568 8956F8 mov word ptr [bp-8], dx 0 0000756B 268B4721 mov ax, word ptr es:[bx+33] 1151 _.LVL136: 0 0000756F 895EFA mov word ptr [bp-6], bx 0 00007572 8946FE mov word ptr [bp-2], ax 1154 _.LVL137: 352:fcbfns.c **** *nRecords = (UWORD)(lpFcb->fcb_rndm - old); 1155 .loc 1 352 0 0 00007575 FF760E push word ptr [bp+14] 1157 _.LVL138: 0 00007578 8B5E0C mov bx, word ptr [bp+12] 1159 _.LVL139: 0 0000757B FF37 push word ptr [bx] 0 0000757D 57 push di 0 0000757E 56 push si 0 0000757F E8[FEFF] call _FcbReadWrite 1164 _.LVL140: 0 00007582 8846FD mov byte ptr [bp-3], al 1166 _.LVL141: 353:fcbfns.c **** 1167 .loc 1 353 0 0 00007585 8B56F8 mov dx, word ptr [bp-8] 0 00007588 8EC2 mov es, dx 0 0000758A 8B5EFA mov bx, word ptr [bp-6] 0 0000758D 268B5721 mov dx, word ptr es:[bx+33] 0 00007591 2B56FE sub dx, word ptr [bp-2] 0 00007594 8B5E0C mov bx, word ptr [bp+12] 0 00007597 8917 mov word ptr [bx], dx 356:fcbfns.c **** 1175 .loc 1 356 0 0 00007599 57 push di 0 0000759A 56 push si 0 0000759B E888F9 call _FcbCalcRec 1179 _.LVL142: 359:fcbfns.c **** 1180 .loc 1 359 0 0 0000759E 8A46FD mov al, byte ptr [bp-3] 0 000075A1 89EC mov sp, bp 0 000075A3 5D pop bp 0 000075A4 5F pop di 0 000075A5 5E pop si 0 000075A6 C20800 ret 8 1187 _.LFE14: 1188 .size _FcbRandomBlockIO, .-_FcbRandomBlockIO 1189 .global _FcbRandomIO 1190 .type _FcbRandomIO, @function 1191 _FcbRandomIO: 1192 _.LFB15: 362:fcbfns.c **** UWORD uwCurrentBlock; 1193 .loc 1 362 0 1194 _.LVL143: 0 000075A9 56 push si 0 000075AA 57 push di 0 000075AB 55 push bp 1198 _.LCFI22: 0 000075AC 89E5 mov bp, sp 1200 _.LCFI23: 0 000075AE 83EC08 sub sp, 8 0 000075B1 8B7E08 mov di, word ptr [bp+8] 0 000075B4 8B760A mov si, word ptr [bp+10] 368:fcbfns.c **** 1204 .loc 1 368 0 0 000075B7 56 push si 0 000075B8 57 push di 0 000075B9 E86AF9 call _FcbCalcRec 1208 _.LVL144: 371:fcbfns.c **** 1209 .loc 1 371 0 0 000075BC 56 push si 0 000075BD 57 push di 0 000075BE E842F9 call _ExtFcbToFcb 1213 _.LVL145: 0 000075C1 93 xchg bx, ax 1215 _.LVL146: 373:fcbfns.c **** ucCurrentRecord = lpFcb->fcb_curec; 1216 .loc 1 373 0 0 000075C2 8EC2 mov es, dx 0 000075C4 268B4F0C mov cx, word ptr es:[bx+12] 0 000075C8 894EF8 mov word ptr [bp-8], cx 1220 _.LVL147: 374:fcbfns.c **** 1221 .loc 1 374 0 0 000075CB 8956FA mov word ptr [bp-6], dx 0 000075CE 268A4720 mov al, byte ptr es:[bx+32] 1224 _.LVL148: 0 000075D2 895EFC mov word ptr [bp-4], bx 0 000075D5 8846FF mov byte ptr [bp-1], al 1227 _.LVL149: 376:fcbfns.c **** 1228 .loc 1 376 0 0 000075D8 FF760C push word ptr [bp+12] 0 000075DB B80100 mov ax, 1 1231 _.LVL150: 0 000075DE 50 push ax 0 000075DF 56 push si 0 000075E0 57 push di 0 000075E1 E8[FEFF] call _FcbReadWrite 1236 _.LVL151: 378:fcbfns.c **** lpFcb->fcb_curec = ucCurrentRecord; 1237 .loc 1 378 0 0 000075E4 8B56FA mov dx, word ptr [bp-6] 0 000075E7 8EC2 mov es, dx 0 000075E9 8B5EFC mov bx, word ptr [bp-4] 0 000075EC 8B4EF8 mov cx, word ptr [bp-8] 0 000075EF 26894F0C mov word ptr es:[bx+12], cx 1243 _.LVL152: 379:fcbfns.c **** return nErrorCode; 1244 .loc 1 379 0 0 000075F3 8A66FF mov ah, byte ptr [bp-1] 0 000075F6 26886720 mov byte ptr es:[bx+32], ah 381:fcbfns.c **** 1247 .loc 1 381 0 0 000075FA 89EC mov sp, bp 0 000075FC 5D pop bp 0 000075FD 5F pop di 0 000075FE 5E pop si 0 000075FF C20600 ret 6 1253 _.LFE15: 1254 .size _FcbRandomIO, .-_FcbRandomIO 1255 .global _FcbOpen 1256 .type _FcbOpen, @function 1257 _FcbOpen: 1258 _.LFB16: 398:fcbfns.c **** sft FAR *sftp; 1259 .loc 1 398 0 1260 _.LVL153: 0 00007602 56 push si 0 00007603 57 push di 0 00007604 55 push bp 1264 _.LCFI24: 0 00007605 89E5 mov bp, sp 1266 _.LCFI25: 0 00007607 83EC08 sub sp, 8 0 0000760A 8B7608 mov si, word ptr [bp+8] 0 0000760D 8B7E0A mov di, word ptr [bp+10] 1270 _.LVL154: 404:fcbfns.c **** if ((flags & O_CREAT) && lpXfcb->xfcb_flag == 0xff) 1271 .loc 1 404 0 0 00007610 8D46FE lea ax, [-2+bp] 0 00007613 50 push ax 0 00007614 57 push di 0 00007615 56 push si 0 00007616 E852F9 call _CommonFcbInit.constprop.0 1277 _.LVL155: 0 00007619 93 xchg bx, ax 0 0000761A 8956FC mov word ptr [bp-4], dx 1280 _.LVL156: 405:fcbfns.c **** /* pass attribute without constraints (dangerous for directories) */ 1281 .loc 1 405 0 0 0000761D 8B460C mov ax, word ptr [bp+12] 1283 _.LVL157: 0 00007620 250004 and ax, 1024 0 00007623 740E je _.L105 405:fcbfns.c **** /* pass attribute without constraints (dangerous for directories) */ 1286 .loc 1 405 0 is_stmt 0 discriminator 1 0 00007625 8EC7 mov es, di 0 00007627 26803CFF cmp byte ptr es:[si], -1 0 0000762B 752E jne _.L109 407:fcbfns.c **** 1290 .loc 1 407 0 is_stmt 1 0 0000762D 268A4406 mov al, byte ptr es:[si+6] 0 00007631 30E4 xor ah, ah 1293 _.LVL158: 1294 _.L105: 0 00007633 895EF8 mov word ptr [bp-8], bx 1296 _.LVL159: 409:fcbfns.c **** if (sft_idx < 0) 1297 .loc 1 409 0 0 00007636 50 push ax 0 00007637 FF760C push word ptr [bp+12] 0 0000763A 16 push ss 0 0000763B B8[0000] mov ax, offset __SecPathBuffer 1302 _.LVL160: 0 0000763E 50 push ax 1304 _.LVL161: 0 0000763F E8[FEFF] call _DosOpenSft 1306 _.LVL162: 0 00007642 8946FA mov word ptr [bp-6], ax 1308 _.LVL163: 410:fcbfns.c **** { 1309 .loc 1 410 0 0 00007645 85C0 test ax, ax 0 00007647 8B5EF8 mov bx, word ptr [bp-8] 0 0000764A 7D13 jge _.L106 412:fcbfns.c **** return FCB_ERROR; 1313 .loc 1 412 0 0 0000764C F7D8 neg ax 1315 _.LVL164: 0 0000764E A3[0000] mov word ptr [_CritErrCode], ax 413:fcbfns.c **** } 1317 .loc 1 413 0 0 00007651 B0FF mov al, -1 1319 _.LVL165: 1320 _.L104: 436:fcbfns.c **** 1321 .loc 1 436 0 0 00007653 89EC mov sp, bp 0 00007655 5D pop bp 0 00007656 5F pop di 0 00007657 5E pop si 0 00007658 C20600 ret 6 1327 _.LVL166: 1328 _.L109: 401:fcbfns.c **** 1329 .loc 1 401 0 0 0000765B 31C0 xor ax, ax 0 0000765D EBD4 jmp _.L105 1332 _.LVL167: 1333 _.L106: 0 0000765F 895EF8 mov word ptr [bp-8], bx 1335 _.LVL168: 416:fcbfns.c **** sftp->sft_mode |= O_FCB; 1336 .loc 1 416 0 0 00007662 FF76FA push word ptr [bp-6] 0 00007665 E8[FEFF] call _idx_to_sft 1339 _.LVL169: 417:fcbfns.c **** 1340 .loc 1 417 0 0 00007668 8EC2 mov es, dx 0 0000766A 89C3 mov bx, ax 0 0000766C 26804F0380 or byte ptr es:[bx+3], -128 1344 _.LVL170: 419:fcbfns.c **** lpFcb->fcb_cublock = 0; 1345 .loc 1 419 0 0 00007671 8E46FC mov es, word ptr [bp-4] 0 00007674 8A4EFA mov cl, byte ptr [bp-6] 0 00007677 8B5EF8 mov bx, word ptr [bp-8] 0 0000767A 26884F18 mov byte ptr es:[bx+24], cl 420:fcbfns.c **** /* should not be cleared, programs e.g. GEM depend on these values remaining unchanged 1350 .loc 1 420 0 0 0000767E 8E46FC mov es, word ptr [bp-4] 0 00007681 26C7470C0000 mov word ptr es:[bx+12], 0 426:fcbfns.c **** if (!(sftp->sft_flags & SFT_FDEVICE)) /* check for a device */ 1353 .loc 1 426 0 0 00007687 8E46FC mov es, word ptr [bp-4] 0 0000768A 26C7470E0000 mov word ptr es:[bx+14], 0 427:fcbfns.c **** { 1356 .loc 1 427 0 0 00007690 8EC2 mov es, dx 0 00007692 89C7 mov di, ax 0 00007694 26F6450580 test byte ptr es:[di+5], -128 0 00007699 7512 jne _.L108 429:fcbfns.c **** lpFcb->fcb_recsiz = 128; 1361 .loc 1 429 0 0 0000769B 8E46FC mov es, word ptr [bp-4] 0 0000769E 8A4EFE mov cl, byte ptr [bp-2] 0 000076A1 26880F mov byte ptr es:[bx], cl 430:fcbfns.c **** } 1365 .loc 1 430 0 0 000076A4 8E46FC mov es, word ptr [bp-4] 0 000076A7 26C7470E8000 mov word ptr es:[bx+14], 128 1368 _.L108: 432:fcbfns.c **** lpFcb->fcb_date = sftp->sft_date; 1369 .loc 1 432 0 0 000076AD 8EC2 mov es, dx 0 000076AF 97 xchg di, ax 0 000076B0 268B4D11 mov cx, word ptr es:[di+17] 0 000076B4 268B7513 mov si, word ptr es:[di+19] 0 000076B8 8E46FC mov es, word ptr [bp-4] 0 000076BB 26894F10 mov word ptr es:[bx+16], cx 0 000076BF 8E46FC mov es, word ptr [bp-4] 0 000076C2 26897712 mov word ptr es:[bx+18], si 433:fcbfns.c **** lpFcb->fcb_time = sftp->sft_time; 1378 .loc 1 433 0 0 000076C6 8EC2 mov es, dx 0 000076C8 268B4D0F mov cx, word ptr es:[di+15] 0 000076CC 8E46FC mov es, word ptr [bp-4] 0 000076CF 26894F14 mov word ptr es:[bx+20], cx 434:fcbfns.c **** return FCB_SUCCESS; 1383 .loc 1 434 0 0 000076D3 8EC2 mov es, dx 0 000076D5 268B450D mov ax, word ptr es:[di+13] 1386 _.LVL171: 0 000076D9 8E46FC mov es, word ptr [bp-4] 0 000076DC 26894716 mov word ptr es:[bx+22], ax 435:fcbfns.c **** } 1389 .loc 1 435 0 0 000076E0 30C0 xor al, al 0 000076E2 E96EFF jmp _.L104 1392 _.LFE16: 1393 .size _FcbOpen, .-_FcbOpen 1394 .global _FcbDelete 1395 .type _FcbDelete, @function 1396 _FcbDelete: 1397 _.LFB20: 476:fcbfns.c **** } 477:fcbfns.c **** 478:fcbfns.c **** UBYTE FcbDelete(xfcb FAR * lpXfcb) 479:fcbfns.c **** { 1398 .loc 1 479 0 1399 _.LVL172: 0 000076E5 56 push si 0 000076E6 57 push di 0 000076E7 55 push bp 1403 _.LCFI26: 0 000076E8 89E5 mov bp, sp 1405 _.LCFI27: 0 000076EA 83EC36 sub sp, 54 0 000076ED 8B5E08 mov bx, word ptr [bp+8] 0 000076F0 8B460A mov ax, word ptr [bp+10] 0 000076F3 8946CE mov word ptr [bp-50], ax 1410 _.LVL173: 480:fcbfns.c **** COUNT FcbDrive; 481:fcbfns.c **** UBYTE result = FCB_SUCCESS; 482:fcbfns.c **** void FAR *lpOldDta = dta; 1411 .loc 1 482 0 0 000076F6 C406[0000] les ax, dword ptr [_dta] 0 000076FA 8946CC mov word ptr [bp-52], ax 0 000076FD 8C46CA mov word ptr [bp-54], es 1415 _.LVL174: 483:fcbfns.c **** 484:fcbfns.c **** /* Build a traditional DOS file name */ 485:fcbfns.c **** CommonFcbInit(lpXfcb, SecPathName, &FcbDrive); 1416 .loc 1 485 0 0 00007700 8D46D2 lea ax, [-46+bp] 1418 _.LVL175: 0 00007703 50 push ax 0 00007704 FF76CE push word ptr [bp-50] 0 00007707 53 push bx 0 00007708 895ED0 mov word ptr [bp-48], bx 0 0000770B E85DF8 call _CommonFcbInit.constprop.0 1424 _.LVL176: 486:fcbfns.c **** /* check for a device */ 487:fcbfns.c **** if (IsDevice(SecPathName)) 1425 .loc 1 487 0 0 0000770E BE[0000] mov si, offset __SecPathBuffer 0 00007711 8CD7 mov di, ss 0 00007713 16 push ss 0 00007714 56 push si 0 00007715 E8[FEFF] call _IsDevice 1431 _.LVL177: 488:fcbfns.c **** { 489:fcbfns.c **** result = FCB_ERROR; 1432 .loc 1 489 0 0 00007718 B1FF mov cl, -1 487:fcbfns.c **** { 1434 .loc 1 487 0 0 0000771A 09D0 or ax, dx 0 0000771C 8B5ED0 mov bx, word ptr [bp-48] 0 0000771F 7536 jne _.L115 1438 _.LBB33: 0 00007721 C646D037 mov byte ptr [bp-48], 55 490:fcbfns.c **** } 491:fcbfns.c **** else 492:fcbfns.c **** { 493:fcbfns.c **** int attr = (lpXfcb->xfcb_flag == 0xff ? lpXfcb->xfcb_attrib : D_ALL); 1440 .loc 1 493 0 0 00007725 8E46CE mov es, word ptr [bp-50] 0 00007728 26380F cmp byte ptr es:[bx], cl 0 0000772B 7507 jne _.L116 1444 .loc 1 493 0 is_stmt 0 discriminator 1 0 0000772D 268A4706 mov al, byte ptr es:[bx+6] 0 00007731 8846D0 mov byte ptr [bp-48], al 1447 _.L116: 1448 _.LVL178: 494:fcbfns.c **** dmatch Dmatch; 495:fcbfns.c **** 496:fcbfns.c **** dta = &Dmatch; 1449 .loc 1 496 0 is_stmt 1 discriminator 4 0 00007734 8D46D5 lea ax, [-43+bp] 0 00007737 A3[0000] mov word ptr [_dta], ax 0 0000773A 8C16[0200] mov word ptr [_dta+2], ss 497:fcbfns.c **** if ((CritErrCode = -DosFindFirst(attr, SecPathName)) != SUCCESS) 1453 .loc 1 497 0 discriminator 4 0 0000773E 57 push di 0 0000773F 56 push si 0 00007740 8A46D0 mov al, byte ptr [bp-48] 0 00007743 30E4 xor ah, ah 0 00007745 50 push ax 0 00007746 E8[FEFF] call _DosFindFirst 1460 _.LVL179: 0 00007749 89C2 mov dx, ax 0 0000774B F7DA neg dx 0 0000774D 8916[0000] mov word ptr [_CritErrCode], dx 0 00007751 85C0 test ax, ax 0 00007753 7418 je _.L117 1466 _.L119: 498:fcbfns.c **** { 499:fcbfns.c **** result = FCB_ERROR; 1467 .loc 1 499 0 0 00007755 B1FF mov cl, -1 1469 _.LVL180: 1470 _.L115: 1471 _.LBE33: 500:fcbfns.c **** } 501:fcbfns.c **** else do 502:fcbfns.c **** { 503:fcbfns.c **** SecPathName[0] = 'A' + FcbDrive - 1; 504:fcbfns.c **** SecPathName[1] = ':'; 505:fcbfns.c **** strcpy(&SecPathName[2], Dmatch.dm_name); 506:fcbfns.c **** if (DosDelete(SecPathName, attr) != SUCCESS) 507:fcbfns.c **** { 508:fcbfns.c **** result = FCB_ERROR; 509:fcbfns.c **** break; 510:fcbfns.c **** } 511:fcbfns.c **** } 512:fcbfns.c **** while ((CritErrCode = -DosFindNext()) == SUCCESS); 513:fcbfns.c **** } 514:fcbfns.c **** dta = lpOldDta; 1472 .loc 1 514 0 0 00007757 8B46CC mov ax, word ptr [bp-52] 0 0000775A A3[0000] mov word ptr [_dta], ax 0 0000775D 8B46CA mov ax, word ptr [bp-54] 0 00007760 A3[0200] mov word ptr [_dta+2], ax 515:fcbfns.c **** return result; 516:fcbfns.c **** } 1477 .loc 1 516 0 0 00007763 88C8 mov al, cl 0 00007765 89EC mov sp, bp 0 00007767 5D pop bp 0 00007768 5F pop di 0 00007769 5E pop si 0 0000776A C20400 ret 4 1484 _.LVL181: 1485 _.L117: 1486 _.LBB34: 503:fcbfns.c **** SecPathName[1] = ':'; 1487 .loc 1 503 0 0 0000776D 8A46D2 mov al, byte ptr [bp-46] 0 00007770 0440 add al, 64 0 00007772 BB[0000] mov bx, offset __SecPathBuffer 0 00007775 8807 mov byte ptr [bx], al 504:fcbfns.c **** strcpy(&SecPathName[2], Dmatch.dm_name); 1492 .loc 1 504 0 0 00007777 C606[0100]3A mov byte ptr [__SecPathBuffer+1], 58 505:fcbfns.c **** if (DosDelete(SecPathName, attr) != SUCCESS) 1494 .loc 1 505 0 0 0000777C 8D46F3 lea ax, [-13+bp] 0 0000777F 50 push ax 0 00007780 B8[0200] mov ax, offset __SecPathBuffer+2 0 00007783 50 push ax 0 00007784 E8[FEFF] call _strcpy 1500 _.LVL182: 506:fcbfns.c **** { 1501 .loc 1 506 0 0 00007787 8A46D0 mov al, byte ptr [bp-48] 0 0000778A 30E4 xor ah, ah 0 0000778C 50 push ax 0 0000778D 57 push di 0 0000778E 56 push si 0 0000778F E8[FEFF] call _DosDelete 1508 _.LVL183: 0 00007792 85C0 test ax, ax 0 00007794 8946CE mov word ptr [bp-50], ax 0 00007797 75BC jne _.L119 512:fcbfns.c **** } 1512 .loc 1 512 0 0 00007799 E8[FEFF] call _DosFindNext 1514 _.LVL184: 0 0000779C 89C1 mov cx, ax 0 0000779E F7D9 neg cx 0 000077A0 890E[0000] mov word ptr [_CritErrCode], cx 0 000077A4 85C0 test ax, ax 0 000077A6 8B56CE mov dx, word ptr [bp-50] 0 000077A9 74C2 je _.L117 1521 _.LBE34: 481:fcbfns.c **** void FAR *lpOldDta = dta; 1522 .loc 1 481 0 0 000077AB 88D1 mov cl, dl 1524 _.LVL185: 0 000077AD EBA8 jmp _.L115 1526 _.LFE20: 1527 .size _FcbDelete, .-_FcbDelete 1528 .global _FcbRename 1529 .type _FcbRename, @function 1530 _FcbRename: 1531 _.LFB21: 517:fcbfns.c **** 518:fcbfns.c **** UBYTE FcbRename(xfcb FAR * lpXfcb) 519:fcbfns.c **** { 1532 .loc 1 519 0 1533 _.LVL186: 0 000077AF 56 push si 0 000077B0 57 push di 0 000077B1 55 push bp 1537 _.LCFI28: 0 000077B2 89E5 mov bp, sp 1539 _.LCFI29: 0 000077B4 83EC7A sub sp, 122 0 000077B7 8B5E08 mov bx, word ptr [bp+8] 0 000077BA 8B460A mov ax, word ptr [bp+10] 0 000077BD 89468C mov word ptr [bp-116], ax 1544 _.LVL187: 520:fcbfns.c **** BYTE buf[FNAME_SIZE + FEXT_SIZE]; 521:fcbfns.c **** BOOL bWildCard; 522:fcbfns.c **** rfcb FAR *lpRenameFcb; 523:fcbfns.c **** COUNT FcbDrive; 524:fcbfns.c **** UBYTE result = FCB_SUCCESS; 525:fcbfns.c **** void FAR *lpOldDta = dta; 1545 .loc 1 525 0 0 000077C0 C406[0000] les ax, dword ptr [_dta] 0 000077C4 89468A mov word ptr [bp-118], ax 0 000077C7 8C4688 mov word ptr [bp-120], es 1549 _.LVL188: 526:fcbfns.c **** 527:fcbfns.c **** /* Build a traditional DOS file name */ 528:fcbfns.c **** lpRenameFcb = (rfcb FAR *) CommonFcbInit(lpXfcb, SecPathName, &FcbDrive); 1550 .loc 1 528 0 0 000077CA 8D4694 lea ax, [-108+bp] 1552 _.LVL189: 0 000077CD 50 push ax 0 000077CE FF768C push word ptr [bp-116] 0 000077D1 53 push bx 0 000077D2 895E86 mov word ptr [bp-122], bx 0 000077D5 E893F7 call _CommonFcbInit.constprop.0 1558 _.LVL190: 0 000077D8 96 xchg si, ax 0 000077D9 89D7 mov di, dx 1561 _.LVL191: 529:fcbfns.c **** /* expand wildcards in dest */ 530:fcbfns.c **** GetNameField(lpRenameFcb->renNewName, buf, FNAME_SIZE, &bWildCard); 1562 .loc 1 530 0 0 000077DB 8D4E92 lea cx, [-110+bp] 0 000077DE 51 push cx 0 000077DF 894E8E mov word ptr [bp-114], cx 0 000077E2 B80800 mov ax, 8 1567 _.LVL192: 0 000077E5 50 push ax 0 000077E6 8D4696 lea ax, [-106+bp] 0 000077E9 16 push ss 0 000077EA 50 push ax 0 000077EB 8D4411 lea ax, [17+si] 0 000077EE 52 push dx 0 000077EF 50 push ax 0 000077F0 E8[FEFF] call _GetNameField 1576 _.LVL193: 531:fcbfns.c **** GetNameField(lpRenameFcb->renNewExtent, buf + FNAME_SIZE, FEXT_SIZE, &bWildCard); 1577 .loc 1 531 0 0 000077F3 8B4E8E mov cx, word ptr [bp-114] 0 000077F6 51 push cx 0 000077F7 B80300 mov ax, 3 0 000077FA 50 push ax 0 000077FB 8D469E lea ax, [-98+bp] 0 000077FE 16 push ss 0 000077FF 50 push ax 0 00007800 83C619 add si, 25 1586 _.LVL194: 0 00007803 57 push di 0 00007804 56 push si 0 00007805 E8[FEFF] call _GetNameField 1590 _.LVL195: 532:fcbfns.c **** 533:fcbfns.c **** /* check for a device */ 534:fcbfns.c **** if (IsDevice(SecPathName)) 1591 .loc 1 534 0 0 00007808 8C568E mov word ptr [bp-114], ss 0 0000780B 16 push ss 0 0000780C B8[0000] mov ax, offset __SecPathBuffer 0 0000780F 50 push ax 0 00007810 E8[FEFF] call _IsDevice 1597 _.LVL196: 535:fcbfns.c **** { 536:fcbfns.c **** result = FCB_ERROR; 1598 .loc 1 536 0 0 00007813 B1FF mov cl, -1 534:fcbfns.c **** { 1600 .loc 1 534 0 0 00007815 09D0 or ax, dx 0 00007817 8B5E86 mov bx, word ptr [bp-122] 0 0000781A 7403E92401 jne _.L128 1604 _.LBB39: 0 0000781F B037 mov al, 55 537:fcbfns.c **** } 538:fcbfns.c **** else 539:fcbfns.c **** { 540:fcbfns.c **** dmatch Dmatch; 541:fcbfns.c **** COUNT rc; 542:fcbfns.c **** 543:fcbfns.c **** wAttr = (lpXfcb->xfcb_flag == 0xff ? lpXfcb->xfcb_attrib : D_ALL); 1606 .loc 1 543 0 0 00007821 8E468C mov es, word ptr [bp-116] 0 00007824 26380F cmp byte ptr es:[bx], cl 0 00007827 7504 jne _.L129 1610 .loc 1 543 0 is_stmt 0 discriminator 1 0 00007829 268A4706 mov al, byte ptr es:[bx+6] 1612 _.L129: 0 0000782D 30E4 xor ah, ah 1614 .loc 1 543 0 discriminator 4 0 0000782F A3[0000] mov word ptr [_wAttr], ax 544:fcbfns.c **** dta = &Dmatch; 1616 .loc 1 544 0 is_stmt 1 discriminator 4 0 00007832 8D56D5 lea dx, [-43+bp] 0 00007835 8916[0000] mov word ptr [_dta], dx 0 00007839 8C16[0200] mov word ptr [_dta+2], ss 545:fcbfns.c **** if ((CritErrCode = -DosFindFirst(wAttr, SecPathName)) != SUCCESS) 1620 .loc 1 545 0 discriminator 4 0 0000783D FF768E push word ptr [bp-114] 0 00007840 BA[0000] mov dx, offset __SecPathBuffer 0 00007843 52 push dx 0 00007844 50 push ax 0 00007845 E8[FEFF] call _DosFindFirst 1626 _.LVL197: 0 00007848 89C2 mov dx, ax 0 0000784A F7DA neg dx 0 0000784C 8916[0000] mov word ptr [_CritErrCode], dx 546:fcbfns.c **** { 547:fcbfns.c **** result = FCB_ERROR; 1630 .loc 1 547 0 discriminator 4 0 00007850 B1FF mov cl, -1 545:fcbfns.c **** if ((CritErrCode = -DosFindFirst(wAttr, SecPathName)) != SUCCESS) 1632 .loc 1 545 0 discriminator 4 0 00007852 85C0 test ax, ax 0 00007854 7403E9EA00 jne _.L128 1635 _.LVL198: 1636 _.L135: 1637 _.LBB40: 548:fcbfns.c **** } 549:fcbfns.c **** else do 550:fcbfns.c **** { 551:fcbfns.c **** /* 'A:' + '.' + '\0' */ 552:fcbfns.c **** BYTE loc_szBuffer[2 + FNAME_SIZE + 1 + FEXT_SIZE + 1]; 553:fcbfns.c **** fcb LocalFcb; 554:fcbfns.c **** BYTE *pToName; 555:fcbfns.c **** const BYTE FAR *pFromPattern = Dmatch.dm_name; 556:fcbfns.c **** const char *pToPattern = buf; 557:fcbfns.c **** int i; 558:fcbfns.c **** UBYTE mode = 0; 1638 .loc 1 558 0 0 00007859 C6469100 mov byte ptr [bp-111], 0 559:fcbfns.c **** 560:fcbfns.c **** FcbParseFname(&mode, pFromPattern, &LocalFcb); 1640 .loc 1 560 0 0 0000785D 8CD6 mov si, ss 0 0000785F 16 push ss 0 00007860 8D46B0 lea ax, [-80+bp] 0 00007863 50 push ax 555:fcbfns.c **** const char *pToPattern = buf; 1645 .loc 1 555 0 0 00007864 8D46F3 lea ax, [-13+bp] 1647 .loc 1 560 0 0 00007867 16 push ss 0 00007868 50 push ax 0 00007869 8D4691 lea ax, [-111+bp] 0 0000786C 50 push ax 0 0000786D E8[FEFF] call _FcbParseFname 1653 _.LVL199: 561:fcbfns.c **** /* Overlay the pattern, skipping '?' */ 562:fcbfns.c **** /* I'm cheating because this assumes that the */ 563:fcbfns.c **** /* struct alignments are on byte boundaries */ 564:fcbfns.c **** pToName = LocalFcb.fcb_fname; 565:fcbfns.c **** for (i = 0; i < FNAME_SIZE + FEXT_SIZE; i++) 1654 .loc 1 565 0 0 00007870 31DB xor bx, bx 1656 _.LVL200: 1657 _.L132: 566:fcbfns.c **** { 567:fcbfns.c **** if (*pToPattern != '?') 1658 .loc 1 567 0 0 00007872 89EF mov di, bp 0 00007874 8A4196 mov al, byte ptr [bx+di-106] 0 00007877 3C3F cmp al, 63 0 00007879 7403 je _.L131 568:fcbfns.c **** *pToName = *pToPattern; 1663 .loc 1 568 0 0 0000787B 8841B1 mov byte ptr [bx+di-79], al 1665 _.L131: 1666 _.LVL201: 565:fcbfns.c **** { 1667 .loc 1 565 0 discriminator 2 0 0000787E 43 inc bx 1669 _.LVL202: 0 0000787F 83FB0B cmp bx, 11 0 00007882 75EE jne _.L132 569:fcbfns.c **** pToName++; 570:fcbfns.c **** pToPattern++; 571:fcbfns.c **** } 572:fcbfns.c **** 573:fcbfns.c **** SecPathName[0] = 'A' + FcbDrive - 1; 1672 .loc 1 573 0 0 00007884 8A4694 mov al, byte ptr [bp-108] 0 00007887 0440 add al, 64 0 00007889 BB[0000] mov bx, offset __SecPathBuffer 1676 _.LVL203: 0 0000788C 8807 mov byte ptr [bx], al 574:fcbfns.c **** SecPathName[1] = ':'; 1678 .loc 1 574 0 0 0000788E C606[0100]3A mov byte ptr [__SecPathBuffer+1], 58 575:fcbfns.c **** strcpy(&SecPathName[2], Dmatch.dm_name); 1680 .loc 1 575 0 0 00007893 8D46F3 lea ax, [-13+bp] 0 00007896 50 push ax 0 00007897 B8[0200] mov ax, offset __SecPathBuffer+2 0 0000789A 50 push ax 0 0000789B E8[FEFF] call _strcpy 1686 _.LVL204: 576:fcbfns.c **** rc = truename(SecPathName, PriPathName, 0); 1687 .loc 1 576 0 0 0000789E 31C0 xor ax, ax 0 000078A0 50 push ax 0 000078A1 BA[0000] mov dx, offset __PriPathBuffer 0 000078A4 52 push dx 0 000078A5 89568C mov word ptr [bp-116], dx 0 000078A8 FF768E push word ptr [bp-114] 0 000078AB B8[0000] mov ax, offset __SecPathBuffer 0 000078AE 50 push ax 0 000078AF E8[FEFF] call _truename 1697 _.LVL205: 577:fcbfns.c **** 578:fcbfns.c **** if (rc < SUCCESS || (rc & IS_DEVICE)) 1698 .loc 1 578 0 0 000078B2 85C0 test ax, ax 0 000078B4 8B568C mov dx, word ptr [bp-116] 0 000078B7 89D7 mov di, dx 0 000078B9 7D03E9A000 jl _.L133 1703 .loc 1 578 0 is_stmt 0 discriminator 1 0 000078BE A820 test al, 32 0 000078C0 7403E99900 jne _.L133 579:fcbfns.c **** { 580:fcbfns.c **** result = FCB_ERROR; 581:fcbfns.c **** break; 582:fcbfns.c **** } 583:fcbfns.c **** /* now to build a dos name again */ 584:fcbfns.c **** LocalFcb.fcb_drive = FcbDrive; 1706 .loc 1 584 0 is_stmt 1 0 000078C5 8B4694 mov ax, word ptr [bp-108] 1708 _.LVL206: 0 000078C8 8846B0 mov byte ptr [bp-80], al 1710 _.LVL207: 1711 _.LBB41: 1712 _.LBB42: 467:fcbfns.c **** if (lpFcb->fcb_drive != 0) 1713 .loc 1 467 0 0 000078CB A0[0000] mov al, byte ptr [_default_drive] 0 000078CE 98 cbw 0 000078CF 40 inc ax 0 000078D0 894694 mov word ptr [bp-108], ax 468:fcbfns.c **** { 1718 .loc 1 468 0 0 000078D3 8EC6 mov es, si 0 000078D5 8D5EB0 lea bx, [-80+bp] 0 000078D8 268A17 mov dl, byte ptr es:[bx] 0 000078DB 84D2 test dl, dl 0 000078DD 747A je _.L139 470:fcbfns.c **** pszBuffer[0] = 'A' + lpFcb->fcb_drive - 1; 1724 .loc 1 470 0 0 000078DF 88D0 mov al, dl 0 000078E1 B400 mov ah, 0 0 000078E3 894694 mov word ptr [bp-108], ax 471:fcbfns.c **** pszBuffer[1] = ':'; 1728 .loc 1 471 0 0 000078E6 80C240 add dl, 64 0 000078E9 8856A1 mov byte ptr [bp-95], dl 472:fcbfns.c **** pszBuffer += 2; 1731 .loc 1 472 0 0 000078EC C646A23A mov byte ptr [bp-94], 58 1733 _.LVL208: 473:fcbfns.c **** } 1734 .loc 1 473 0 0 000078F0 8D46A3 lea ax, [-93+bp] 1736 _.LVL209: 1737 _.L134: 475:fcbfns.c **** } 1738 .loc 1 475 0 0 000078F3 8D56B0 lea dx, [-80+bp] 0 000078F6 42 inc dx 0 000078F7 56 push si 0 000078F8 52 push dx 0 000078F9 16 push ss 0 000078FA 50 push ax 0 000078FB E8[FEFF] call _ConvertName83ToNameSZ 1746 _.LVL210: 1747 _.LBE42: 1748 _.LBE41: 585:fcbfns.c **** FcbNameInit(&LocalFcb, loc_szBuffer, &FcbDrive); 586:fcbfns.c **** rc = truename(loc_szBuffer, SecPathName, 0); 1749 .loc 1 586 0 0 000078FE 31C0 xor ax, ax 0 00007900 50 push ax 0 00007901 B8[0000] mov ax, offset __SecPathBuffer 0 00007904 50 push ax 0 00007905 8D46A1 lea ax, [-95+bp] 0 00007908 16 push ss 0 00007909 50 push ax 0 0000790A E8[FEFF] call _truename 1758 _.LVL211: 587:fcbfns.c **** if (rc < SUCCESS || (rc & (IS_NETWORK|IS_DEVICE)) == IS_DEVICE 1759 .loc 1 587 0 0 0000790D 85C0 test ax, ax 0 0000790F 7C4D jl _.L133 1762 .loc 1 587 0 is_stmt 0 discriminator 1 0 00007911 83E060 and ax, 96 1764 _.LVL212: 0 00007914 83F820 cmp ax, 32 0 00007917 7445 je _.L133 588:fcbfns.c **** || DosRenameTrue(PriPathName, SecPathName, wAttr) != SUCCESS) 1767 .loc 1 588 0 is_stmt 1 0 00007919 FF36[0000] push word ptr [_wAttr] 0 0000791D B8[0000] mov ax, offset __SecPathBuffer 0 00007920 50 push ax 0 00007921 57 push di 0 00007922 E8[FEFF] call _DosRenameTrue 1773 _.LVL213: 0 00007925 85C0 test ax, ax 0 00007927 89468C mov word ptr [bp-116], ax 0 0000792A 7532 jne _.L133 1777 _.LBE40: 589:fcbfns.c **** { 590:fcbfns.c **** result = FCB_ERROR; 591:fcbfns.c **** break; 592:fcbfns.c **** } 593:fcbfns.c **** } 594:fcbfns.c **** while ((CritErrCode = -DosFindNext()) == SUCCESS); 1778 .loc 1 594 0 0 0000792C E8[FEFF] call _DosFindNext 1780 _.LVL214: 0 0000792F 89C1 mov cx, ax 0 00007931 F7D9 neg cx 0 00007933 890E[0000] mov word ptr [_CritErrCode], cx 0 00007937 85C0 test ax, ax 0 00007939 8B568C mov dx, word ptr [bp-116] 0 0000793C 7503E918FF je _.L135 1787 _.LBE39: 524:fcbfns.c **** void FAR *lpOldDta = dta; 1788 .loc 1 524 0 0 00007941 88D1 mov cl, dl 1790 _.LVL215: 1791 _.L128: 595:fcbfns.c **** } 596:fcbfns.c **** dta = lpOldDta; 1792 .loc 1 596 0 0 00007943 8B468A mov ax, word ptr [bp-118] 0 00007946 A3[0000] mov word ptr [_dta], ax 0 00007949 8B4688 mov ax, word ptr [bp-120] 0 0000794C A3[0200] mov word ptr [_dta+2], ax 597:fcbfns.c **** return result; 598:fcbfns.c **** } 1797 .loc 1 598 0 0 0000794F 88C8 mov al, cl 0 00007951 89EC mov sp, bp 0 00007953 5D pop bp 0 00007954 5F pop di 0 00007955 5E pop si 0 00007956 C20400 ret 4 1804 _.LVL216: 1805 _.L139: 1806 _.LBB46: 1807 _.LBB45: 1808 _.LBB44: 1809 _.LBB43: 464:fcbfns.c **** 1810 .loc 1 464 0 0 00007959 8D46A1 lea ax, [-95+bp] 1812 _.LVL217: 0 0000795C EB95 jmp _.L134 1814 _.LVL218: 1815 _.L133: 1816 _.LBE43: 1817 _.LBE44: 581:fcbfns.c **** } 1818 .loc 1 581 0 0 0000795E B1FF mov cl, -1 0 00007960 EBE1 jmp _.L128 1821 _.LBE45: 1822 _.LBE46: 1823 _.LFE21: 1824 .size _FcbRename, .-_FcbRename 1825 .global _FcbClose 1826 .type _FcbClose, @function 1827 _FcbClose: 1828 _.LFB22: 599:fcbfns.c **** 600:fcbfns.c **** /* TE:the MoveDirInfo() is now done by simply copying the dirEntry into the FCB 601:fcbfns.c **** this prevents problems with ".", ".." and saves code 602:fcbfns.c **** BO:use global SearchDir, as produced by FindFirst/Next 603:fcbfns.c **** */ 604:fcbfns.c **** 605:fcbfns.c **** UBYTE FcbClose(xfcb FAR * lpXfcb) 606:fcbfns.c **** { 1829 .loc 1 606 0 1830 _.LVL219: 0 00007962 56 push si 0 00007963 57 push di 0 00007964 55 push bp 1834 _.LCFI30: 0 00007965 89E5 mov bp, sp 1836 _.LCFI31: 607:fcbfns.c **** sft FAR *s; 608:fcbfns.c **** 609:fcbfns.c **** /* Convert to fcb if necessary */ 610:fcbfns.c **** fcb FAR *lpFcb = ExtFcbToFcb(lpXfcb); 1837 .loc 1 610 0 0 00007967 FF760A push word ptr [bp+10] 0 0000796A FF7608 push word ptr [bp+8] 0 0000796D E893F5 call _ExtFcbToFcb 1841 _.LVL220: 0 00007970 96 xchg si, ax 1843 _.LVL221: 611:fcbfns.c **** 612:fcbfns.c **** /* An already closed FCB can be closed again without error */ 613:fcbfns.c **** if (lpFcb->fcb_sftno == (BYTE) 0xff) 1844 .loc 1 613 0 0 00007971 8EC2 mov es, dx 0 00007973 268A6418 mov ah, byte ptr es:[si+24] 614:fcbfns.c **** return FCB_SUCCESS; 1847 .loc 1 614 0 0 00007977 30C0 xor al, al 1849 _.LVL222: 613:fcbfns.c **** return FCB_SUCCESS; 1850 .loc 1 613 0 0 00007979 80FCFF cmp ah, -1 0 0000797C 7417 je _.L150 0 0000797E 89D7 mov di, dx 615:fcbfns.c **** 616:fcbfns.c **** /* Get the SFT block that contains the SFT */ 617:fcbfns.c **** if ((s = idx_to_sft(lpFcb->fcb_sftno)) == (sft FAR *) - 1) 1854 .loc 1 617 0 0 00007980 88E0 mov al, ah 0 00007982 98 cbw 0 00007983 50 push ax 0 00007984 E8[FEFF] call _idx_to_sft 1859 _.LVL223: 0 00007987 89C3 mov bx, ax 1861 _.LVL224: 0 00007989 83F8FF cmp ax, -1 0 0000798C 750F jne _.L152 0 0000798E 83FAFF cmp dx, -1 0 00007991 750A jne _.L152 1866 _.LVL225: 1867 _.L154: 618:fcbfns.c **** return FCB_ERROR; 1868 .loc 1 618 0 0 00007993 B0FF mov al, -1 1870 _.LVL226: 1871 _.L150: 619:fcbfns.c **** 620:fcbfns.c **** /* change time and set file size */ 621:fcbfns.c **** s->sft_size = lpFcb->fcb_fsize; 622:fcbfns.c **** if (!(s->sft_flags & SFT_FSHARED)) 623:fcbfns.c **** dos_merge_file_changes(lpFcb->fcb_sftno); 624:fcbfns.c **** DosSetFtimeSft(lpFcb->fcb_sftno, lpFcb->fcb_date, lpFcb->fcb_time); 625:fcbfns.c **** if ((CritErrCode = -DosCloseSft(lpFcb->fcb_sftno, FALSE)) == SUCCESS) 626:fcbfns.c **** { 627:fcbfns.c **** lpFcb->fcb_sftno = (BYTE) 0xff; 628:fcbfns.c **** return FCB_SUCCESS; 629:fcbfns.c **** } 630:fcbfns.c **** return FCB_ERROR; 631:fcbfns.c **** } 1872 .loc 1 631 0 0 00007995 89EC mov sp, bp 0 00007997 5D pop bp 0 00007998 5F pop di 0 00007999 5E pop si 0 0000799A C20400 ret 4 1878 _.LVL227: 1879 _.L152: 621:fcbfns.c **** if (!(s->sft_flags & SFT_FSHARED)) 1880 .loc 1 621 0 0 0000799D 8EC7 mov es, di 0 0000799F 268B4410 mov ax, word ptr es:[si+16] 1883 _.LVL228: 0 000079A3 268B4C12 mov cx, word ptr es:[si+18] 0 000079A7 8EC2 mov es, dx 0 000079A9 26894711 mov word ptr es:[bx+17], ax 1887 _.LVL229: 0 000079AD 26894F13 mov word ptr es:[bx+19], cx 622:fcbfns.c **** dos_merge_file_changes(lpFcb->fcb_sftno); 1889 .loc 1 622 0 0 000079B1 26837F0500 cmp word ptr es:[bx+5], 0 0 000079B6 7C0B jl _.L153 623:fcbfns.c **** DosSetFtimeSft(lpFcb->fcb_sftno, lpFcb->fcb_date, lpFcb->fcb_time); 1892 .loc 1 623 0 0 000079B8 8EC7 mov es, di 0 000079BA 268A4418 mov al, byte ptr es:[si+24] 0 000079BE 98 cbw 0 000079BF 50 push ax 0 000079C0 E8[FEFF] call _dos_merge_file_changes 1898 _.LVL230: 1899 _.L153: 624:fcbfns.c **** if ((CritErrCode = -DosCloseSft(lpFcb->fcb_sftno, FALSE)) == SUCCESS) 1900 .loc 1 624 0 0 000079C3 8EC7 mov es, di 0 000079C5 26FF7416 push word ptr es:[si+22] 0 000079C9 26FF7414 push word ptr es:[si+20] 0 000079CD 268A4418 mov al, byte ptr es:[si+24] 0 000079D1 98 cbw 0 000079D2 50 push ax 0 000079D3 E8[FEFF] call _DosSetFtimeSft 1908 _.LVL231: 625:fcbfns.c **** { 1909 .loc 1 625 0 0 000079D6 31C0 xor ax, ax 0 000079D8 50 push ax 0 000079D9 8EC7 mov es, di 0 000079DB 268A4418 mov al, byte ptr es:[si+24] 0 000079DF 98 cbw 0 000079E0 50 push ax 0 000079E1 E8[FEFF] call _DosCloseSft 1917 _.LVL232: 0 000079E4 89C2 mov dx, ax 0 000079E6 F7DA neg dx 0 000079E8 8916[0000] mov word ptr [_CritErrCode], dx 0 000079EC 85C0 test ax, ax 0 000079EE 75A3 jne _.L154 627:fcbfns.c **** return FCB_SUCCESS; 1923 .loc 1 627 0 0 000079F0 8EC7 mov es, di 0 000079F2 26C64418FF mov byte ptr es:[si+24], -1 628:fcbfns.c **** } 1926 .loc 1 628 0 0 000079F7 EB9C jmp _.L150 1928 _.LFE22: 1929 .size _FcbClose, .-_FcbClose 1930 .global _FcbCloseAll 1931 .type _FcbCloseAll, @function 1932 _FcbCloseAll: 1933 _.LFB23: 632:fcbfns.c **** 633:fcbfns.c **** /* close all files the current process opened by FCBs */ 634:fcbfns.c **** VOID FcbCloseAll() 635:fcbfns.c **** { 1934 .loc 1 635 0 0 000079F9 56 push si 0 000079FA 57 push di 1937 _.LCFI32: 1938 _.LVL233: 636:fcbfns.c **** COUNT idx = 0; 637:fcbfns.c **** sft FAR *sftp; 638:fcbfns.c **** 639:fcbfns.c **** for (idx = 0; (sftp = idx_to_sft(idx)) != (sft FAR *) - 1; idx++) 1939 .loc 1 639 0 0 000079FB 31FF xor di, di 0 000079FD 89FE mov si, di 1942 _.LVL234: 1943 _.L158: 1944 .loc 1 639 0 is_stmt 0 discriminator 1 0 000079FF 57 push di 1946 _.LCFI33: 0 00007A00 E8[FEFF] call _idx_to_sft 1948 _.LCFI34: 1949 _.LVL235: 0 00007A03 89C3 mov bx, ax 1951 _.LVL236: 0 00007A05 83F8FF cmp ax, -1 0 00007A08 7508 jne _.L160 0 00007A0A 83FAFF cmp dx, -1 0 00007A0D 7503 jne _.L160 640:fcbfns.c **** if ((sftp->sft_mode & O_FCB) && sftp->sft_psp == cu_psp) 641:fcbfns.c **** DosCloseSft(idx, FALSE); 642:fcbfns.c **** } 1956 .loc 1 642 0 is_stmt 1 0 00007A0F 5F pop di 1958 _.LVL237: 0 00007A10 5E pop si 0 00007A11 C3 ret 1961 _.LVL238: 1962 _.L160: 640:fcbfns.c **** if ((sftp->sft_mode & O_FCB) && sftp->sft_psp == cu_psp) 1963 .loc 1 640 0 0 00007A12 8EC2 mov es, dx 0 00007A14 26837F0200 cmp word ptr es:[bx+2], 0 0 00007A19 7D0F jge _.L159 640:fcbfns.c **** if ((sftp->sft_mode & O_FCB) && sftp->sft_psp == cu_psp) 1967 .loc 1 640 0 is_stmt 0 discriminator 1 0 00007A1B 268B4731 mov ax, word ptr es:[bx+49] 1969 _.LVL239: 0 00007A1F 3B06[0000] cmp ax, word ptr [_cu_psp] 0 00007A23 7505 jne _.L159 641:fcbfns.c **** } 1972 .loc 1 641 0 is_stmt 1 0 00007A25 56 push si 1974 _.LCFI35: 0 00007A26 57 push di 1976 _.LCFI36: 0 00007A27 E8[FEFF] call _DosCloseSft 1978 _.LCFI37: 1979 _.LVL240: 1980 _.L159: 639:fcbfns.c **** if ((sftp->sft_mode & O_FCB) && sftp->sft_psp == cu_psp) 1981 .loc 1 639 0 discriminator 2 0 00007A2A 47 inc di 1983 _.LVL241: 0 00007A2B EBD2 jmp _.L158 1985 _.LFE23: 1986 .size _FcbCloseAll, .-_FcbCloseAll 1987 .global _FcbFindFirstNext 1988 .type _FcbFindFirstNext, @function 1989 _FcbFindFirstNext: 1990 _.LFB24: 643:fcbfns.c **** 644:fcbfns.c **** UBYTE FcbFindFirstNext(xfcb FAR * lpXfcb, BOOL First) 645:fcbfns.c **** { 1991 .loc 1 645 0 1992 _.LVL242: 0 00007A2D 56 push si 0 00007A2E 57 push di 0 00007A2F 55 push bp 1996 _.LCFI38: 0 00007A30 89E5 mov bp, sp 1998 _.LCFI39: 0 00007A32 83EC10 sub sp, 16 0 00007A35 8B5E08 mov bx, word ptr [bp+8] 0 00007A38 8B460A mov ax, word ptr [bp+10] 0 00007A3B 8946F6 mov word ptr [bp-10], ax 646:fcbfns.c **** void FAR *orig_dta = dta; 2003 .loc 1 646 0 0 00007A3E C406[0000] les ax, dword ptr [_dta] 0 00007A42 8946FA mov word ptr [bp-6], ax 0 00007A45 8C46F8 mov word ptr [bp-8], es 2007 _.LVL243: 647:fcbfns.c **** BYTE FAR *lpDir; 648:fcbfns.c **** COUNT FcbDrive; 649:fcbfns.c **** fcb FAR *lpFcb; 650:fcbfns.c **** 651:fcbfns.c **** /* First, move the dta to a local and change it around to match */ 652:fcbfns.c **** /* our functions. */ 653:fcbfns.c **** lpDir = dta; 654:fcbfns.c **** dta = &Dmatch; 2008 .loc 1 654 0 0 00007A48 BE[0100] mov si, offset _Dmatch 0 00007A4B 8936[0000] mov word ptr [_dta], si 0 00007A4F 8C16[0200] mov word ptr [_dta+2], ss 655:fcbfns.c **** 656:fcbfns.c **** /* Next initialze local variables by moving them from the fcb */ 657:fcbfns.c **** lpFcb = CommonFcbInit(lpXfcb, SecPathName, &FcbDrive); 2012 .loc 1 657 0 0 00007A53 8D46FE lea ax, [-2+bp] 2014 _.LVL244: 0 00007A56 50 push ax 0 00007A57 FF76F6 push word ptr [bp-10] 0 00007A5A 53 push bx 0 00007A5B 895EF4 mov word ptr [bp-12], bx 0 00007A5E E80AF5 call _CommonFcbInit.constprop.0 2020 _.LVL245: 0 00007A61 8946FC mov word ptr [bp-4], ax 2022 _.LVL246: 658:fcbfns.c **** if (First) 2023 .loc 1 658 0 0 00007A64 837E0C00 cmp word ptr [bp+12], 0 0 00007A68 8B5EF4 mov bx, word ptr [bp-12] 0 00007A6B 7503E92301 je _.L163 0 00007A70 895EF0 mov word ptr [bp-16], bx 659:fcbfns.c **** { 660:fcbfns.c **** /* Reconstruct the dirmatch structure from the fcb */ 661:fcbfns.c **** Dmatch.dm_drive = lpFcb->fcb_sftno; 2028 .loc 1 661 0 0 00007A73 8EC2 mov es, dx 0 00007A75 93 xchg bx, ax 0 00007A76 268A4718 mov al, byte ptr es:[bx+24] 2032 _.LVL247: 0 00007A7A 8804 mov byte ptr [si], al 662:fcbfns.c **** 663:fcbfns.c **** fmemcpy(Dmatch.dm_name_pat, lpFcb->fcb_fname, FNAME_SIZE + FEXT_SIZE); 2034 .loc 1 663 0 0 00007A7C 8CD7 mov di, ss 0 00007A7E B80B00 mov ax, 11 0 00007A81 50 push ax 0 00007A82 8946F2 mov word ptr [bp-14], ax 0 00007A85 89D9 mov cx, bx 0 00007A87 41 inc cx 0 00007A88 52 push dx 0 00007A89 8956F4 mov word ptr [bp-12], dx 0 00007A8C 51 push cx 0 00007A8D 16 push ss 0 00007A8E 8D4401 lea ax, [1+si] 0 00007A91 50 push ax 0 00007A92 E8[FEFF] call _fmemcpy 2048 _.LVL248: 664:fcbfns.c **** DosUpFMem((BYTE FAR *) Dmatch.dm_name_pat, FNAME_SIZE + FEXT_SIZE); 2049 .loc 1 664 0 0 00007A95 8B46F2 mov ax, word ptr [bp-14] 0 00007A98 50 push ax 0 00007A99 57 push di 0 00007A9A 8D4401 lea ax, [1+si] 0 00007A9D 50 push ax 0 00007A9E E8[FEFF] call _DosUpFMem 2056 _.LVL249: 665:fcbfns.c **** 666:fcbfns.c **** Dmatch.dm_attr_srch = wAttr; 2057 .loc 1 666 0 0 00007AA1 A1[0000] mov ax, word ptr [_wAttr] 0 00007AA4 88440C mov byte ptr [si+12], al 667:fcbfns.c **** Dmatch.dm_entry = lpFcb->fcb_strtclst; 2060 .loc 1 667 0 0 00007AA7 8B56F4 mov dx, word ptr [bp-12] 0 00007AAA 8EC2 mov es, dx 0 00007AAC 8B5EFC mov bx, word ptr [bp-4] 0 00007AAF 268B471B mov ax, word ptr es:[bx+27] 0 00007AB3 89440D mov word ptr [si+13], ax 668:fcbfns.c **** Dmatch.dm_dircluster = lpFcb->fcb_dirclst; 2066 .loc 1 668 0 0 00007AB6 268B471D mov ax, word ptr es:[bx+29] 0 00007ABA 89440F mov word ptr [si+15], ax 0 00007ABD C744110000 mov word ptr [si+17], 0 669:fcbfns.c **** 670:fcbfns.c **** wAttr = D_ALL; 2070 .loc 1 670 0 0 00007AC2 C706[0000]3700 mov word ptr [_wAttr], 55 671:fcbfns.c **** } 672:fcbfns.c **** 673:fcbfns.c **** if ((xfcb FAR *) lpFcb != lpXfcb) 2072 .loc 1 673 0 0 00007AC8 8B5EF0 mov bx, word ptr [bp-16] 0 00007ACB 3B5EFC cmp bx, word ptr [bp-4] 0 00007ACE 7505 jne _.L170 0 00007AD0 3956F6 cmp word ptr [bp-10], dx 0 00007AD3 7435 je _.L175 2078 _.LVL250: 2079 _.L170: 0 00007AD5 8956F4 mov word ptr [bp-12], dx 674:fcbfns.c **** { 675:fcbfns.c **** wAttr = lpXfcb->xfcb_attrib; 2081 .loc 1 675 0 0 00007AD8 8E46F6 mov es, word ptr [bp-10] 0 00007ADB 268A4706 mov al, byte ptr es:[bx+6] 0 00007ADF B400 mov ah, 0 0 00007AE1 A3[0000] mov word ptr [_wAttr], ax 676:fcbfns.c **** fmemcpy(lpDir, lpXfcb, 7); 2086 .loc 1 676 0 0 00007AE4 B80700 mov ax, 7 0 00007AE7 50 push ax 0 00007AE8 06 push es 0 00007AE9 53 push bx 0 00007AEA FF76F8 push word ptr [bp-8] 0 00007AED FF76FA push word ptr [bp-6] 0 00007AF0 E8[FEFF] call _fmemcpy 2094 _.LVL251: 677:fcbfns.c **** lpDir += 7; 2095 .loc 1 677 0 0 00007AF3 8B7EFA mov di, word ptr [bp-6] 0 00007AF6 83C707 add di, 7 2098 _.LVL252: 678:fcbfns.c **** } 679:fcbfns.c **** 680:fcbfns.c **** CritErrCode = -(First ? DosFindFirst(wAttr, SecPathName) : DosFindNext()); 2099 .loc 1 680 0 0 00007AF9 837E0C00 cmp word ptr [bp+12], 0 0 00007AFD 8B56F4 mov dx, word ptr [bp-12] 0 00007B00 750B jne _.L164 2103 _.LVL253: 2104 _.L166: 0 00007B02 8956F6 mov word ptr [bp-10], dx 2106 _.LVL254: 2107 .loc 1 680 0 is_stmt 0 discriminator 2 0 00007B05 E8[FEFF] call _DosFindNext 2109 _.LVL255: 0 00007B08 EB12 jmp _.L177 2111 _.LVL256: 2112 _.L175: 653:fcbfns.c **** dta = &Dmatch; 2113 .loc 1 653 0 is_stmt 1 0 00007B0A 8B7EFA mov di, word ptr [bp-6] 2115 _.LVL257: 2116 _.L164: 0 00007B0D 8956F6 mov word ptr [bp-10], dx 2118 _.LVL258: 2119 .loc 1 680 0 discriminator 1 0 00007B10 16 push ss 0 00007B11 B8[0000] mov ax, offset __SecPathBuffer 0 00007B14 50 push ax 0 00007B15 FF36[0000] push word ptr [_wAttr] 0 00007B19 E8[FEFF] call _DosFindFirst 2125 _.LVL259: 2126 _.L177: 2127 .loc 1 680 0 is_stmt 0 discriminator 2 0 00007B1C F7D8 neg ax 0 00007B1E 8B56F6 mov dx, word ptr [bp-10] 0 00007B21 A3[0000] mov word ptr [_CritErrCode], ax 681:fcbfns.c **** if (CritErrCode != SUCCESS) 2131 .loc 1 681 0 is_stmt 1 discriminator 2 0 00007B24 85C0 test ax, ax 0 00007B26 7416 je _.L168 682:fcbfns.c **** { 683:fcbfns.c **** dta = orig_dta; 2134 .loc 1 683 0 0 00007B28 8B46FA mov ax, word ptr [bp-6] 0 00007B2B A3[0000] mov word ptr [_dta], ax 0 00007B2E 8B46F8 mov ax, word ptr [bp-8] 0 00007B31 A3[0200] mov word ptr [_dta+2], ax 684:fcbfns.c **** return FCB_ERROR; 2139 .loc 1 684 0 0 00007B34 B0FF mov al, -1 2141 _.LVL260: 2142 _.L162: 685:fcbfns.c **** } 686:fcbfns.c **** 687:fcbfns.c **** *lpDir++ = FcbDrive; 688:fcbfns.c **** fmemcpy(lpDir, &SearchDir, sizeof(struct dirent)); 689:fcbfns.c **** 690:fcbfns.c **** lpFcb->fcb_dirclst = (UWORD) Dmatch.dm_dircluster; 691:fcbfns.c **** lpFcb->fcb_strtclst = Dmatch.dm_entry; 692:fcbfns.c **** 693:fcbfns.c **** /* 694:fcbfns.c **** This is undocumented and seen using Pcwatch and Ramview. 695:fcbfns.c **** The First byte is the current directory count and the second seems 696:fcbfns.c **** to be the attribute byte. 697:fcbfns.c **** */ 698:fcbfns.c **** lpFcb->fcb_sftno = Dmatch.dm_drive; /* MSD seems to save this @ fcb_date. */ 699:fcbfns.c **** #if 0 700:fcbfns.c **** lpFcb->fcb_cublock = Dmatch.dm_entry; 701:fcbfns.c **** lpFcb->fcb_cublock *= 0x100; 702:fcbfns.c **** lpFcb->fcb_cublock += wAttr; 703:fcbfns.c **** #endif 704:fcbfns.c **** dta = orig_dta; 705:fcbfns.c **** return FCB_SUCCESS; 706:fcbfns.c **** } 2143 .loc 1 706 0 0 00007B36 89EC mov sp, bp 0 00007B38 5D pop bp 0 00007B39 5F pop di 0 00007B3A 5E pop si 0 00007B3B C20600 ret 6 2149 _.LVL261: 2150 _.L168: 0 00007B3E 8956F4 mov word ptr [bp-12], dx 0 00007B41 8946F6 mov word ptr [bp-10], ax 2153 _.LVL262: 687:fcbfns.c **** fmemcpy(lpDir, &SearchDir, sizeof(struct dirent)); 2154 .loc 1 687 0 0 00007B44 8E46F8 mov es, word ptr [bp-8] 0 00007B47 8A46FE mov al, byte ptr [bp-2] 0 00007B4A 268805 mov byte ptr es:[di], al 2158 _.LVL263: 688:fcbfns.c **** 2159 .loc 1 688 0 0 00007B4D B92000 mov cx, 32 0 00007B50 51 push cx 0 00007B51 16 push ss 0 00007B52 B9[0000] mov cx, offset _SearchDir 0 00007B55 51 push cx 687:fcbfns.c **** fmemcpy(lpDir, &SearchDir, sizeof(struct dirent)); 2165 .loc 1 687 0 0 00007B56 8D4D01 lea cx, [1+di] 688:fcbfns.c **** 2167 .loc 1 688 0 0 00007B59 FF76F8 push word ptr [bp-8] 0 00007B5C 51 push cx 0 00007B5D E8[FEFF] call _fmemcpy 2171 _.LVL264: 690:fcbfns.c **** lpFcb->fcb_strtclst = Dmatch.dm_entry; 2172 .loc 1 690 0 0 00007B60 8B4C0F mov cx, word ptr [si+15] 0 00007B63 8B56F4 mov dx, word ptr [bp-12] 0 00007B66 8EC2 mov es, dx 0 00007B68 8B5EFC mov bx, word ptr [bp-4] 0 00007B6B 26894F1D mov word ptr es:[bx+29], cx 691:fcbfns.c **** 2178 .loc 1 691 0 0 00007B6F 8B4C0D mov cx, word ptr [si+13] 0 00007B72 8B5EFC mov bx, word ptr [bp-4] 0 00007B75 26894F1B mov word ptr es:[bx+27], cx 698:fcbfns.c **** #if 0 2182 .loc 1 698 0 0 00007B79 8A0C mov cl, byte ptr [si] 0 00007B7B 8B5EFC mov bx, word ptr [bp-4] 0 00007B7E 26884F18 mov byte ptr es:[bx+24], cl 704:fcbfns.c **** return FCB_SUCCESS; 2186 .loc 1 704 0 0 00007B82 8B46FA mov ax, word ptr [bp-6] 0 00007B85 A3[0000] mov word ptr [_dta], ax 0 00007B88 8B46F8 mov ax, word ptr [bp-8] 0 00007B8B A3[0200] mov word ptr [_dta+2], ax 705:fcbfns.c **** } 2191 .loc 1 705 0 0 00007B8E 8B46F6 mov ax, word ptr [bp-10] 0 00007B91 EBA3 jmp _.L162 2194 _.LVL265: 2195 _.L163: 673:fcbfns.c **** { 2196 .loc 1 673 0 0 00007B93 3B5EFC cmp bx, word ptr [bp-4] 0 00007B96 7403E93AFF jne _.L170 0 00007B9B 3956F6 cmp word ptr [bp-10], dx 0 00007B9E 7403E932FF jne _.L170 653:fcbfns.c **** dta = &Dmatch; 2201 .loc 1 653 0 0 00007BA3 8B7EFA mov di, word ptr [bp-6] 0 00007BA6 E959FF jmp _.L166 2204 _.LFE24: 2205 .size _FcbFindFirstNext, .-_FcbFindFirstNext 2206 .local _mdb.2324 2207 .comm _mdb.2324,1,1 2208 .local _Dmatch 2209 .comm _Dmatch,43,1 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: iasmsupt.lst 1 ; File: 2 ; asmsupt.asm 3 ; Description: 4 ; Assembly support routines for miscellaneous functions 5 ; 6 ; Copyright (c) 1995, 1998 7 ; Pasquale J. Villani 8 ; All Rights Reserved 9 ; 10 ; This file is part of DOS-C. 11 ; 12 ; DOS-C is free software; you can redistribute it and/or 13 ; modify it under the terms of the GNU General Public License 14 ; as published by the Free Software Foundation; either version 15 ; 2, or (at your option) any later version. 16 ; 17 ; DOS-C is distributed in the hope that it will be useful, but 18 ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 ; the GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public 23 ; License along with DOS-C; see the file COPYING. If not, 24 ; write to the Free Software Foundation, 675 Mass Ave, 25 ; Cambridge, MA 02139, USA. 26 ; 27 ; version 1.4 by tom.ehlert@ginko.de 28 ; added some more functions 29 ; changed bcopy, scopy, sncopy,... 30 ; to memcpy, strcpy, strncpy 31 ; Bart Oldeman: optimized a bit: see /usr/include/bits/string.h from 32 ; glibc 2.2 33 ; 34 ; $Id: asmsupt.asm 1568 2011-04-09 02:42:51Z bartoldeman $ 35 ; 36 37 ; for OW on Linux: 38 %ifdef owlinux 39 %define WATCOM 40 %endif 41 42 %ifdef WATCOM 43 %ifdef _INIT 44 %define WATCOM_INIT ; no seperate init segment for watcom. 45 %endif 46 %endif 47 48 %ifndef WATCOM_INIT 49 50 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 51 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 52 53 %ifdef _INIT 54 === Switch to base=00E150h -> "INIT_TEXT" 55 segment INIT_TEXT 56 %define FMEMCPYBACK INIT_FMEMCPYBACK 57 %define MEMCPY INIT_MEMCPY 58 %define FMEMCPY INIT_FMEMCPY 59 %define MEMSET INIT_MEMSET 60 %define FMEMSET INIT_FMEMSET 61 %define STRCPY INIT_STRCPY 62 %define FSTRCPY INIT_FSTRCPY 63 %define STRLEN INIT_STRLEN 64 %define FSTRLEN INIT_FSTRLEN 65 %define FMEMCHR INIT_FMEMCHR 66 %define FSTRCHR INIT_FSTRCHR 67 %define STRCHR INIT_STRCHR 68 %define FSTRCMP INIT_FSTRCMP 69 %define STRCMP INIT_STRCMP 70 %define FSTRNCMP INIT_FSTRNCMP 71 %define STRNCMP INIT_STRNCMP 72 %define FMEMCMP INIT_FMEMCMP 73 %define MEMCMP INIT_MEMCMP 74 75 %else 76 === Switch to base=002270h -> "HMA_TEXT" 77 segment HMA_TEXT 78 79 %endif 80 81 ;********************************************************************* 82 ; this implements some of the common string handling functions 83 ; 84 ; every function has 1 entry 85 ; 86 ; NEAR FUNC() 87 ; 88 ; currently done: 89 ; 90 ; fmemcpyBack(void FAR *dest, void FAR *src, int count) 91 ; memcpy(void *dest, void *src, int count) 92 ; fmemcpy(void FAR *dest, void FAR *src, int count) 93 ; memset(void *dest, int ch, int count); 94 ; fmemset(void FAR *dest, int ch, int count); 95 ; strcpy (void *dest, void *src); 96 ; fstrcpy (void FAR*dest, void FAR *src); 97 ; strlen (void *dest); 98 ; fstrlen (void FAR*dest); 99 ; fmemchr (BYTE FAR *src , int ch); 100 ; fstrchr (BYTE FAR *src , int ch); 101 ; strchr (BYTE *src , int ch); 102 ; fstrcmp (BYTE FAR *s1 , BYTE FAR *s2); 103 ; strcmp (BYTE *s1 , BYTE *s2); 104 ; fstrncmp(BYTE FAR *s1 , BYTE FAR *s2, int count); 105 ; strncmp(BYTE *s1 , BYTE *s2, int count); 106 ; fmemcmp(BYTE FAR *s1 , BYTE FAR *s2, int count); 107 ; memcmp(BYTE *s1 , BYTE *s2, int count); 108 109 ;*********************************************** 110 ; pascal_setup - set up the standard calling frame for C-functions 111 ; and save registers needed later 112 ; also preload the args for the near functions 113 ; di=arg1 114 ; si=arg2 115 ; cx=arg3 116 ; 117 pascal_setup: 0 000008FD 58 pop ax ; get return address 119 0 000008FE 55 push bp ; Standard C entry 0 000008FF 89E5 mov bp,sp 122 %ifdef WATCOM 123 push bx 124 push cx 125 push es 126 %endif 0 00000901 56 push si 0 00000902 57 push di 0 00000903 1E push ds 130 ; Set both ds and es to same segment (for near copy) 0 00000904 1E push ds 0 00000905 07 pop es 133 134 ; Set direction to autoincrement 0 00000906 FC cld 136 0 00000907 B306 mov bl,6 ; majority (4) wants that 138 arg arg1, arg2, arg3 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 0 00000909 8B4E08 mov cx,[.arg3] ; majority (8) wants that (near and far) 0 0000090C 8B7606 mov si,[.arg2] ; majority (3) wants that (near) 0 0000090F 8B7E04 mov di,[.arg1] ; majority (3) wants that (near) 142 0 00000912 FFE0 jmp ax 144 145 146 147 148 ;*********************************************** 149 ; 150 ; VOID memcpy(REG BYTE *s, REG BYTE *d, REG COUNT n); 151 ; 152 global MEMCPY 153 MEMCPY: 0 00000914 E8E6FF call pascal_setup 155 156 ;mov cx,[4+bp] - preset above 157 ;mov si,[6+bp] - preset above 158 ;mov di,[8+bp] - preset above 159 160 ;mov bl,6 - preset above 161 162 163 domemcpy: 164 ; And do the built-in byte copy, but do a 16-bit transfer 165 ; whenever possible. 0 00000917 D1E9 shr cx,1 0 00000919 F3A5 rep movsw 0 0000091B 7301 jnc memcpy_return 0 0000091D A4 movsb 170 memcpy_return: 171 %if 0 ; only needed for fmemcpyback 172 cld 173 %endif 174 175 ; 176 ; pascal_return - pop saved registers and do return 177 ; 178 0 0000091E EB31 jmp short pascal_return 180 181 182 183 ;************************************************************ 184 ; 185 ; VOID fmemcpy(REG BYTE FAR *d, REG BYTE FAR *s,REG COUNT n); 186 ; VOID fmemcpyBack(REG BYTE FAR *d, REG BYTE FAR *s,REG COUNT n); 187 ; 188 global FMEMCPY 189 %if 0 190 global FMEMCPYBACK 191 FMEMCPYBACK: 192 std ; force to copy the string in reverse order 193 %endif 194 FMEMCPY: 0 00000920 E8DAFF call pascal_setup 196 197 arg {d,4}, {s,4}, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 198 ; Get the repetition count, n preset above 199 %ifdef STDCALL 0 00000923 8B4E0C mov cx,[.n] 201 %endif 202 203 ; Get the far source pointer, s 0 00000926 C57608 lds si,[.s] 205 206 ; Get the far destination pointer d 0 00000929 C47E04 les di,[.d] 0 0000092C B30A mov bl,10 209 0 0000092E EBE7 jmp short domemcpy 211 212 ;*************************************************************** 213 ; 214 ; VOID fmemset(REG VOID FAR *d, REG BYTE ch, REG COUNT n); 215 ; 216 global FMEMSET 217 FMEMSET: 0 00000930 E8CAFF call pascal_setup 219 220 arg {d,4}, ch, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 221 ; Get the repetition count, n - preset above 222 %ifdef STDCALL 0 00000933 8B4E0A mov cx,[.n] 224 %endif 225 226 ; Get the fill byte ch 0 00000936 8B4608 mov ax,[.ch] 228 229 ; Get the far source pointer, s 0 00000939 C47E04 les di,[.d] 0 0000093C B308 mov bl,8 232 233 domemset: 0 0000093E 88C4 mov ah, al 235 0 00000940 D1E9 shr cx,1 0 00000942 F3AB rep stosw 0 00000944 730B jnc pascal_return 0 00000946 AA stosb 240 0 00000947 EB08 jmp short pascal_return 242 243 ;*************************************************************** 244 ; 245 ; VOID memset(REG VOID *d, REG BYTE ch, REG COUNT n); 246 ; 247 global MEMSET 248 MEMSET: 0 00000949 E8B1FF call pascal_setup 250 251 arg d, ch, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 252 ; Get the repitition count, n - preset above 253 ; mov cx,[bp+4] 254 255 ; Get the char ch 0 0000094C 8B4606 mov ax, [.ch] 257 258 ; Get the far source pointer, d - preset above 259 ; mov di,[bp+8] 260 261 ;mov bl, 6 ; preset above 262 0 0000094F EBED jmp short domemset 264 265 ;***** 266 pascal_return: 0 00000951 C57E00 lds di, [bp] ; return address in ds, saved bp in di 0 00000954 B700 mov bh, 0 0 00000956 01DD add bp, bx ; point bp to "as if there were 0 args" 0 00000958 8C5E02 mov [bp+2], ds ; put return address at first arg 0 0000095B 897E00 mov [bp], di ; saved bp below that one 272 0 0000095E 1F pop ds 0 0000095F 5F pop di 0 00000960 5E pop si 276 %ifdef WATCOM 277 pop es 278 pop cx 279 pop bx 280 %endif 0 00000961 89EC mov sp,bp 0 00000963 5D pop bp 0 00000964 C3 ret 284 285 ;***************************************************************** 286 287 ; fstrcpy (void FAR*dest, void FAR *src); 288 289 global FSTRCPY 290 FSTRCPY: 0 00000965 E895FF call pascal_setup 292 293 arg {dest,4}, {src,4} 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 294 ; Get the source pointer, ss 0 00000968 C57608 lds si,[.src] 296 297 ; and the destination pointer, d 0 0000096B C47E04 les di,[.dest] 299 0 0000096E B308 mov bl,8 301 0 00000970 EB05 jmp short dostrcpy 303 304 ;****** 305 global STRCPY 306 STRCPY: 0 00000972 E888FF call pascal_setup 308 309 310 %ifdef PASCAL 311 ; Get the source pointer, ss 312 mov si,[bp+4] 313 314 ; and the destination pointer, d 315 mov di,[bp+6] 316 %endif 0 00000975 B304 mov bl,4 318 319 dostrcpy: 320 321 strcpy_loop: 0 00000977 AC lodsb 0 00000978 AA stosb 0 00000979 84C0 test al,al 0 0000097B 75FA jne strcpy_loop 326 0 0000097D EBD2 jmp short pascal_return 328 329 ;****************************************************************** 330 global FSTRLEN 331 FSTRLEN: 0 0000097F E87BFF call pascal_setup 333 334 ; Get the source pointer, ss 0 00000982 C47E04 les di,[bp+4] 0 00000985 B304 mov bl,4 337 0 00000987 EB05 jmp short dostrlen 339 340 ;********************************************** 341 global STRLEN 342 STRLEN: 0 00000989 E871FF call pascal_setup 344 ; Get the source pointer, ss 345 %ifdef PASCAL 346 mov di,[bp+4] 347 %endif 0 0000098C B302 mov bl,2 349 350 dostrlen: 0 0000098E B000 mov al,0 0 00000990 B9FFFF mov cx,0xffff 0 00000993 F2AE repne scasb 354 0 00000995 89C8 mov ax,cx 0 00000997 F7D0 not ax 0 00000999 48 dec ax 358 0 0000099A EBB5 jmp short pascal_return 360 361 ;************************************************************ 362 ; strchr (BYTE *src , int ch); 363 364 global STRCHR 365 STRCHR: 0 0000099C E85EFF call pascal_setup 367 368 ; Get the source pointer, ss 369 arg src, ch 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 370 %ifdef STDCALL ; preset above for PASCAL 0 0000099F 8B4E06 mov cx,[.ch] 0 000009A2 8B7604 mov si,[.src] 373 %endif 0 000009A5 B304 mov bl,4 375 376 strchr_loop: 0 000009A7 AC lodsb 0 000009A8 38C8 cmp al,cl 0 000009AA 740A je strchr_found 0 000009AC 84C0 test al,al 0 000009AE 75F7 jne strchr_loop 382 383 strchr_retzero: 0 000009B0 31C0 xor ax, ax ; return NULL if not found 0 000009B2 89C2 mov dx, ax ; for fstrchr() 0 000009B4 EB9B jmp short pascal_return 387 388 strchr_found: 0 000009B6 89F0 mov ax, si 0 000009B8 8CDA mov dx, ds ; for fstrchr() 391 strchr_found1: 0 000009BA 48 dec ax 393 0 000009BB EB94 jmp short pascal_return 395 396 %ifndef _INIT 397 398 ;***** 399 ; fstrchr (BYTE far *src , int ch); 400 global FSTRCHR 401 FSTRCHR: 402 call pascal_setup 403 404 arg {src,4}, ch 405 ; Get ch (preset above) 406 ;mov cx, [bp+4] 407 408 ;and the source pointer, src 409 lds si, [.src] 410 411 ;mov bl, 6 - preset above 412 413 jmp short strchr_loop 414 415 ;****** 416 global FMEMCHR 417 FMEMCHR: 418 call pascal_setup 419 420 arg {src,4}, ch, n 421 ; Get the length - preset above 422 %ifdef STDCALL 423 mov cx, [.n] 424 %endif 425 426 ; and the search value 427 mov ax, [.ch] 428 429 ; and the source pointer, ss 430 les di, [.src] 431 432 mov bl, 8 433 434 jcxz strchr_retzero 435 repne scasb 436 jne strchr_retzero 437 mov dx, es 438 mov ax, di 439 jmp short strchr_found1 440 441 ;********************************************************************** 442 global FSTRCMP 443 FSTRCMP: 444 call pascal_setup 445 446 arg {dest,4}, {src,4} 447 ; Get the source pointer, ss 448 lds si,[.src] 449 450 ; and the destination pointer, d 451 les di,[.dest] 452 453 mov bl,8 454 455 %if 0 456 jmp short dostrcmp 457 458 ;****** 459 global STRCMP 460 STRCMP: 461 call pascal_setup 462 463 mov bl,4 464 465 ; Get the source pointer, ss 466 ; mov si,[bp+4] 467 468 ; and the destination pointer, d 469 ; mov di,[bp+6] 470 xchg si,di 471 472 dostrcmp: 473 %endif 474 ; replace strncmp(s1,s2)--> 475 ; strncmp(s1,s2,0xffff) 476 mov cx,0xffff 477 %if 0 478 jmp short dostrncmp 479 480 481 ;********************************************************************** 482 global FSTRNCMP 483 FSTRNCMP: 484 call pascal_setup 485 486 ; Get the source pointer, ss 487 lds si,[bp+4] 488 489 ; and the destination pointer, d 490 les di,[bp+8] 491 mov cx,[bp+12] 492 mov bl,10 493 494 jmp short dostrncmp 495 496 ;****** 497 global _strncmp 498 _strncmp: 499 call pascal_setup 500 501 ; Get the source pointer, ss 502 ;mov si,[bp+4] 503 504 ; and the destination pointer, d 505 ;mov di,[bp+6] 506 ;mov cx,[bp+8] 507 xchg si,di 508 509 dostrncmp: 510 %endif 511 jcxz strncmp_retzero 512 513 strncmp_loop: 514 lodsb 515 scasb 516 jne strncmp_done 517 test al,al 518 loopne strncmp_loop 519 jmp short strncmp_retzero 520 %endif 521 522 ;********************************************************************** 523 ; fmemcmp(BYTE FAR *s1 , BYTE FAR *s2, int count); 524 global FMEMCMP 525 FMEMCMP: 0 000009BD E83DFF call pascal_setup 527 528 arg {dest,4}, {src,4}, n 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 529 ; the length - preset above 530 %ifdef STDCALL 0 000009C0 8B4E0C mov cx, [.n] 532 %endif 533 534 ; Get the source pointer, ss 0 000009C3 C47E08 les di,[.src] 536 537 ; and the destination pointer, d 0 000009C6 C57604 lds si,[.dest] 539 0 000009C9 B30A mov bl,10 541 0 000009CB EB05 jmp short domemcmp 543 544 ;****** 545 ; memcmp(BYTE *s1 , BYTE *s2, int count); 546 global MEMCMP 547 MEMCMP: 0 000009CD E82DFF call pascal_setup 549 550 ; all preset: Get the source pointer, ss 551 ;mov si,[bp+6] 552 553 ; and the destination pointer, d 554 ;mov di,[bp+8] 555 ;mov cx,[bp+4] 556 ;mov bl,6 0 000009D0 87F7 xchg si,di 558 559 domemcmp: 0 000009D2 E304 jcxz strncmp_retzero 0 000009D4 F3A6 repe cmpsb 0 000009D6 7504 jne strncmp_done 563 strncmp_retzero: 0 000009D8 31C0 xor ax, ax 0 000009DA EB03 jmp short strncmp_done2 566 strncmp_done: 0 000009DC 9F lahf 0 000009DD D0CC ror ah,1 0 000009DF E96FFF strncmp_done2: jmp pascal_return 570 571 %endif === Trace listing source: initclk.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=initclk.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccVbBgzV.s output file : initclk.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:56.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _InitBcdToByte, @function 8 _InitBcdToByte: 9 _.LFB4: 10 .file 1 "initclk.c" 1:initclk.c **** /****************************************************************/ 2:initclk.c **** /* */ 3:initclk.c **** /* initclk.c */ 4:initclk.c **** /* */ 5:initclk.c **** /* System Clock Driver - initialization */ 6:initclk.c **** /* */ 7:initclk.c **** /* Copyright (c) 1995 */ 8:initclk.c **** /* Pasquale J. Villani */ 9:initclk.c **** /* All Rights Reserved */ 10:initclk.c **** /* */ 11:initclk.c **** /* This file is part of DOS-C. */ 12:initclk.c **** /* */ 13:initclk.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:initclk.c **** /* modify it under the terms of the GNU General Public License */ 15:initclk.c **** /* as published by the Free Software Foundation; either version */ 16:initclk.c **** /* 2, or (at your option) any later version. */ 17:initclk.c **** /* */ 18:initclk.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:initclk.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:initclk.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:initclk.c **** /* the GNU General Public License for more details. */ 22:initclk.c **** /* */ 23:initclk.c **** /* You should have received a copy of the GNU General Public */ 24:initclk.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:initclk.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:initclk.c **** /* Cambridge, MA 02139, USA. */ 27:initclk.c **** /****************************************************************/ 28:initclk.c **** 29:initclk.c **** #include "portab.h" 30:initclk.c **** #include "init-mod.h" 31:initclk.c **** 32:initclk.c **** #ifdef VERSION_STRINGS 33:initclk.c **** static char *RcsId = 34:initclk.c **** "$Id: initclk.c 1359 2008-03-09 16:11:10Z mceric $"; 35:initclk.c **** #endif 36:initclk.c **** 37:initclk.c **** /* */ 38:initclk.c **** /* WARNING - THIS DRIVER IS NON-PORTABLE!!!! */ 39:initclk.c **** /* */ 40:initclk.c **** 41:initclk.c **** STATIC int InitBcdToByte(int x) 42:initclk.c **** { 11 .loc 1 42 0 12 _.LVL0: 0 00004984 89E3 mov bx, sp 14 _.LCFI0: 0 00004986 8B5F02 mov bx, word ptr [bx+2] 43:initclk.c **** return ((x >> 4) & 0xf) * 10 + (x & 0xf); 16 .loc 1 43 0 0 00004989 89D8 mov ax, bx 0 0000498B B104 mov cl, 4 0 0000498D D3F8 sar ax, cl 0 0000498F 83E00F and ax, 15 0 00004992 BA0A00 mov dx, 10 0 00004995 F7E2 mul dx 0 00004997 89D9 mov cx, bx 0 00004999 83E10F and cx, 15 0 0000499C 01C8 add ax, cx 44:initclk.c **** } 26 .loc 1 44 0 0 0000499E C20200 ret 2 28 _.LFE4: 29 .size _InitBcdToByte, .-_InitBcdToByte 30 .global _Init_clk_driver 31 .type _Init_clk_driver, @function 32 _Init_clk_driver: 33 _.LFB5: 45:initclk.c **** 46:initclk.c **** void Init_clk_driver(void) 47:initclk.c **** { 34 .loc 1 47 0 0 000049A1 56 push si 0 000049A2 57 push di 0 000049A3 55 push bp 38 _.LCFI1: 0 000049A4 89E5 mov bp, sp 40 _.LCFI2: 0 000049A6 83EC1A sub sp, 26 48:initclk.c **** static iregs regsT = {0x200}; /* ah=0x02 */ 49:initclk.c **** static iregs regsD = {0x400, 0, 0x1400, 0x101}; 50:initclk.c **** /* ah=4, ch=20^ ^cl=0, ^dh=dl=1 (2000/1/1) 51:initclk.c **** * (above date will be set on error) */ 52:initclk.c **** iregs dosregs; 53:initclk.c **** 54:initclk.c **** init_call_intr(0x1a, ®sT); /* get BIOS time */ 42 .loc 1 54 0 0 000049A9 B9[1800] mov cx, offset _regsT.1854 0 000049AC 51 push cx 0 000049AD 894EE6 mov word ptr [bp-26], cx 0 000049B0 BE1A00 mov si, 26 0 000049B3 56 push si 0 000049B4 E8[FEFF] call _init_call_intr 49 _.LVL1: 55:initclk.c **** init_call_intr(0x1a, ®sD); /* get BIOS date */ 50 .loc 1 55 0 0 000049B7 BF[0000] mov di, offset _regsD.1855 0 000049BA 57 push di 0 000049BB 56 push si 0 000049BC E8[FEFF] call _init_call_intr 55 _.LVL2: 56:initclk.c **** 57:initclk.c **** /* DosSetDate */ 58:initclk.c **** dosregs.a.b.h = 0x2b; 56 .loc 1 58 0 0 000049BF C646E92B mov byte ptr [bp-23], 43 59:initclk.c **** dosregs.c.x = 100 * InitBcdToByte(regsD.c.b.h) /* century */ 58 .loc 1 59 0 0 000049C3 8A4505 mov al, byte ptr [di+5] 0 000049C6 30E4 xor ah, ah 0 000049C8 50 push ax 0 000049C9 E8B8FF call _InitBcdToByte 63 _.LVL3: 0 000049CC 89C6 mov si, ax 60:initclk.c **** + InitBcdToByte(regsD.c.b.l);/* year */ 65 .loc 1 60 0 0 000049CE 8A4504 mov al, byte ptr [di+4] 0 000049D1 30E4 xor ah, ah 0 000049D3 50 push ax 0 000049D4 E8ADFF call _InitBcdToByte 70 _.LVL4: 0 000049D7 91 xchg cx, ax 59:initclk.c **** dosregs.c.x = 100 * InitBcdToByte(regsD.c.b.h) /* century */ 72 .loc 1 59 0 0 000049D8 B86400 mov ax, 100 0 000049DB F7E6 mul si 0 000049DD 96 xchg si, ax 76 .loc 1 60 0 0 000049DE 91 xchg cx, ax 0 000049DF 01F0 add ax, si 61:initclk.c **** /* A BIOS with y2k (year 2000) bug will always report year 19nn */ 62:initclk.c **** if ((dosregs.c.x >= 1900) && (dosregs.c.x < 1980)) dosregs.c.x += 100; 79 .loc 1 62 0 0 000049E1 89C2 mov dx, ax 0 000049E3 81C294F8 add dx, -1900 0 000049E7 83FA4F cmp dx, 79 0 000049EA 8B4EE6 mov cx, word ptr [bp-26] 0 000049ED 89CE mov si, cx 0 000049EF 7663 jbe _.L4 86 _.L7: 87 .loc 1 62 0 is_stmt 0 discriminator 1 0 000049F1 8946EC mov word ptr [bp-20], ax 63:initclk.c **** dosregs.d.b.h = InitBcdToByte(regsD.d.b.h); /* month */ 89 .loc 1 63 0 is_stmt 1 discriminator 1 0 000049F4 8A4507 mov al, byte ptr [di+7] 0 000049F7 30E4 xor ah, ah 0 000049F9 50 push ax 0 000049FA E887FF call _InitBcdToByte 94 _.LVL5: 0 000049FD 8846EF mov byte ptr [bp-17], al 64:initclk.c **** dosregs.d.b.l = InitBcdToByte(regsD.d.b.l); /* day */ 96 .loc 1 64 0 discriminator 1 0 00004A00 8A4506 mov al, byte ptr [di+6] 0 00004A03 30E4 xor ah, ah 0 00004A05 50 push ax 0 00004A06 E87BFF call _InitBcdToByte 101 _.LVL6: 0 00004A09 8846EE mov byte ptr [bp-18], al 65:initclk.c **** init_call_intr(0x21, &dosregs); 103 .loc 1 65 0 discriminator 1 0 00004A0C 8D56E8 lea dx, [-24+bp] 0 00004A0F 52 push dx 0 00004A10 8956E6 mov word ptr [bp-26], dx 0 00004A13 BF2100 mov di, 33 0 00004A16 57 push di 0 00004A17 E8[FEFF] call _init_call_intr 110 _.LVL7: 66:initclk.c **** 67:initclk.c **** /* DosSetTime */ 68:initclk.c **** dosregs.a.b.h = 0x2d; 111 .loc 1 68 0 discriminator 1 0 00004A1A C646E92D mov byte ptr [bp-23], 45 69:initclk.c **** dosregs.c.b.l = InitBcdToByte(regsT.c.b.l); /* minutes */ 113 .loc 1 69 0 discriminator 1 0 00004A1E 8A4404 mov al, byte ptr [si+4] 0 00004A21 30E4 xor ah, ah 0 00004A23 50 push ax 0 00004A24 E85DFF call _InitBcdToByte 118 _.LVL8: 0 00004A27 8846EC mov byte ptr [bp-20], al 70:initclk.c **** dosregs.c.b.h = InitBcdToByte(regsT.c.b.h); /* hours */ 120 .loc 1 70 0 discriminator 1 0 00004A2A 8A4405 mov al, byte ptr [si+5] 0 00004A2D 30E4 xor ah, ah 0 00004A2F 50 push ax 0 00004A30 E851FF call _InitBcdToByte 125 _.LVL9: 0 00004A33 8846ED mov byte ptr [bp-19], al 71:initclk.c **** dosregs.d.b.h = InitBcdToByte(regsT.d.b.h); /*seconds */ 127 .loc 1 71 0 discriminator 1 0 00004A36 8A4407 mov al, byte ptr [si+7] 0 00004A39 30E4 xor ah, ah 0 00004A3B 50 push ax 0 00004A3C E845FF call _InitBcdToByte 132 _.LVL10: 0 00004A3F 8846EF mov byte ptr [bp-17], al 72:initclk.c **** dosregs.d.b.l = 0; 134 .loc 1 72 0 discriminator 1 0 00004A42 C646EE00 mov byte ptr [bp-18], 0 73:initclk.c **** init_call_intr(0x21, &dosregs); 136 .loc 1 73 0 discriminator 1 0 00004A46 8B56E6 mov dx, word ptr [bp-26] 0 00004A49 52 push dx 0 00004A4A 57 push di 0 00004A4B E8[FEFF] call _init_call_intr 141 _.LVL11: 74:initclk.c **** } 142 .loc 1 74 0 discriminator 1 0 00004A4E 89EC mov sp, bp 0 00004A50 5D pop bp 0 00004A51 5F pop di 0 00004A52 5E pop si 0 00004A53 C3 ret 148 _.L4: 62:initclk.c **** dosregs.d.b.h = InitBcdToByte(regsD.d.b.h); /* month */ 149 .loc 1 62 0 discriminator 1 0 00004A54 83C064 add ax, 100 0 00004A57 EB98 jmp _.L7 152 _.LFE5: 153 .size _Init_clk_driver, .-_Init_clk_driver === Switch to base=000790h -> ".DATA" 154 .data 155 .type _regsD.1855, @object 156 .size _regsD.1855, 24 157 _regsD.1855: 0 000005E9 0004 .hword 1024 0 000005EB 0000 .hword 0 0 000005ED 0014 .hword 5120 0 000005EF 0101 .hword 257 0 000005F1 0000000000000000 .skip 16,0 0 000005F9 0000000000000000 163 .type _regsT.1854, @object 164 .size _regsT.1854, 24 165 _regsT.1854: 0 00000601 0002 .hword 512 0 00000603 0000000000000000 .skip 22,0 0 0000060B 0000000000000000 0 00000613 000000000000 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: initdisk.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=initdisk.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccLSE7Bs.s output file : initdisk.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:56.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: === Switch to base=012BB0h -> ".RODATA.STR1.1" 7 .section .rodata.str1.1,"aMS",@progbits,1 8 _.LC0: 0 00000D34 64647400 .string "ddt" === Switch to base=002270h -> ".TEXT" 10 .text 11 .type _push_ddt, @function 12 _push_ddt: 13 _.LFB9: 14 .file 1 "initdisk.c" 1:initdisk.c **** /****************************************************************/ 2:initdisk.c **** /* */ 3:initdisk.c **** /* initDISK.c */ 4:initdisk.c **** /* */ 5:initdisk.c **** /* Copyright (c) 2001 */ 6:initdisk.c **** /* tom ehlert */ 7:initdisk.c **** /* All Rights Reserved */ 8:initdisk.c **** /* */ 9:initdisk.c **** /* This file is part of DOS-C. */ 10:initdisk.c **** /* */ 11:initdisk.c **** /* DOS-C is free software; you can redistribute it and/or */ 12:initdisk.c **** /* modify it under the terms of the GNU General Public License */ 13:initdisk.c **** /* as published by the Free Software Foundation; either version */ 14:initdisk.c **** /* 2, or (at your option) any later version. */ 15:initdisk.c **** /* */ 16:initdisk.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 17:initdisk.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 18:initdisk.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 19:initdisk.c **** /* the GNU General Public License for more details. */ 20:initdisk.c **** /* */ 21:initdisk.c **** /* You should have received a copy of the GNU General Public */ 22:initdisk.c **** /* License along with DOS-C; see the file COPYING. If not, */ 23:initdisk.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 24:initdisk.c **** /* Cambridge, MA 02139, USA. */ 25:initdisk.c **** /****************************************************************/ 26:initdisk.c **** 27:initdisk.c **** #include "portab.h" 28:initdisk.c **** #include "debug.h" 29:initdisk.c **** #include "init-mod.h" 30:initdisk.c **** #include "dyndata.h" 31:initdisk.c **** 32:initdisk.c **** #define FLOPPY_SEC_SIZE 512u /* common sector size */ 33:initdisk.c **** 34:initdisk.c **** UBYTE InitDiskTransferBuffer[MAX_SEC_SIZE] BSS_INIT({0}); 35:initdisk.c **** COUNT nUnits BSS_INIT(0); 36:initdisk.c **** 37:initdisk.c **** /* 38:initdisk.c **** * Rev 1.0 13 May 2001 tom ehlert 39:initdisk.c **** * Initial revision. 40:initdisk.c **** * 41:initdisk.c **** * this module implements the disk scanning for DOS accesible partitions 42:initdisk.c **** * the drive letter ordering is somewhat chaotic, but like MSDOS does it. 43:initdisk.c **** * 44:initdisk.c **** * this module expects to run with CS = INIT_TEXT, like other init_code, 45:initdisk.c **** * but SS = DS = DATA = DOS_DS, unlike other init_code. 46:initdisk.c **** * 47:initdisk.c **** * history: 48:initdisk.c **** * 1.0 extracted the disk init code from DSK.C 49:initdisk.c **** * added LBA support 50:initdisk.c **** * moved code to INIT_TEXT 51:initdisk.c **** * done the funny code segment stuff to switch between INIT_TEXT and TEXT 52:initdisk.c **** * added a couple of snity checks for partitions 53:initdisk.c **** * 54:initdisk.c **** **************************************************************************** 55:initdisk.c **** * 56:initdisk.c **** * Implementation note: 57:initdisk.c **** * this module needs some interfacing to INT 13 58:initdisk.c **** * how to implement them 59:initdisk.c **** * 60:initdisk.c **** * a) using inline assembly 61:initdisk.c **** * _ASM mov ax,0x1314 62:initdisk.c **** * 63:initdisk.c **** * b) using assembly routines in some external FLOPPY.ASM 64:initdisk.c **** * 65:initdisk.c **** * c) using the funny TURBO-C style 66:initdisk.c **** * _AX = 0x1314 67:initdisk.c **** * 68:initdisk.c **** * d) using intr(intno, ®s) method. 69:initdisk.c **** * 70:initdisk.c **** * why not? 71:initdisk.c **** * 72:initdisk.c **** * a) this is my personal favorite, combining the best aof all worlds. 73:initdisk.c **** * TURBO-C does support inline assembly, but only by using TASM, 74:initdisk.c **** * which is not free. 75:initdisk.c **** * so - unfortunately- its excluded. 76:initdisk.c **** * 77:initdisk.c **** * b) keeping funny memory model in sync with external assembly 78:initdisk.c **** * routines is everything, but not fun 79:initdisk.c **** * 80:initdisk.c **** * c) you never know EXACT, what the compiler does, if its a bit 81:initdisk.c **** * more complicated. does 82:initdisk.c **** * _DL = drive & 0xff 83:initdisk.c **** * _BL = driveParam.chs.Sector; 84:initdisk.c **** * destroy any other register? sure? _really_ sure? 85:initdisk.c **** * at least, it has it's surprises. 86:initdisk.c **** * and - I found a couple of optimizer induced bugs (TC 2.01) 87:initdisk.c **** * believe me. 88:initdisk.c **** * it was coded - and operational that way. 89:initdisk.c **** * but - there are many surprises waiting there. so I opted against. 90:initdisk.c **** * 91:initdisk.c **** * 92:initdisk.c **** * d) this method is somewhat clumsy and certainly not the 93:initdisk.c **** * fastest way to do things. 94:initdisk.c **** * on the other hand, this is INIT code, executed once. 95:initdisk.c **** * and since it's the only portable method, I opted for it. 96:initdisk.c **** * 97:initdisk.c **** * e) and all this is my private opinion. tom ehlert. 98:initdisk.c **** * 99:initdisk.c **** * 100:initdisk.c **** * Some thoughts about LBA vs. CHS. by Bart Oldeman 2001/Nov/11 101:initdisk.c **** * Matthias Paul writes in www.freedos.org/freedos/news/technote/113.html: 102:initdisk.c **** * (...) MS-DOS 7.10+, which will always access logical drives in a type 103:initdisk.c **** * 05h extended partition via CHS, even if the individual logical drives 104:initdisk.c **** * in there are of LBA type, or go beyond 8 Gb... (Although this workaround 105:initdisk.c **** * is sometimes used in conjunction with OS/2, using a 05h partition going 106:initdisk.c **** * beyond 8 Gb may cause MS-DOS 7.10 to hang or corrupt your data...) (...) 107:initdisk.c **** * 108:initdisk.c **** * Also at http://www.win.tue.nl/~aeb/partitions/partition_types-1.html: 109:initdisk.c **** * (...) 5 DOS 3.3+ Extended Partition 110:initdisk.c **** * Supports at most 8.4 GB disks: with type 5 DOS/Windows will not use the 111:initdisk.c **** * extended BIOS call, even if it is available. (...) 112:initdisk.c **** * 113:initdisk.c **** * So MS-DOS 7.10+ is brain-dead in this respect, but we knew that ;-) 114:initdisk.c **** * However there is one reason to use old-style CHS calls: 115:initdisk.c **** * some programs intercept int 13 and do not support LBA addressing. So 116:initdisk.c **** * it is worth using CHS if possible, unless the user asks us not to, 117:initdisk.c **** * either by specifying a 0x0c/0x0e/0x0f partition type or enabling 118:initdisk.c **** * the ForceLBA setting in the fd kernel (sys) config. This will make 119:initdisk.c **** * multi-sector reads and BIOS computations more efficient, at the cost 120:initdisk.c **** * of some compatibility. 121:initdisk.c **** * 122:initdisk.c **** * However we need to be safe, and with varying CHS at different levels 123:initdisk.c **** * that might be difficult. Hence we _only_ trust the LBA values in the 124:initdisk.c **** * partition tables and the heads and sectors values the BIOS gives us. 125:initdisk.c **** * After all these are the values the BIOS uses to process our CHS values. 126:initdisk.c **** * So unless the BIOS is buggy, using CHS on one partition and LBA on another 127:initdisk.c **** * should be safe. The CHS values in the partition table are NOT trusted. 128:initdisk.c **** * We print a warning if there is a mismatch with the calculated values. 129:initdisk.c **** * 130:initdisk.c **** * The CHS values in the boot sector are used at a higher level. The CHS 131:initdisk.c **** * that DOS uses in various INT21/AH=44 IOCTL calls are converted to LBA 132:initdisk.c **** * using the boot sector values and then converted back to CHS using BIOS 133:initdisk.c **** * values if necessary. Internally we do LBA as much as possible. 134:initdisk.c **** * 135:initdisk.c **** * However if the partition extends beyond cylinder 1023 and is not labelled 136:initdisk.c **** * as one of the LBA types, we can't use CHS and print a warning, using LBA 137:initdisk.c **** * instead if possible, and otherwise refuse to use it. 138:initdisk.c **** * 139:initdisk.c **** * As for EXTENDED_LBA vs. EXTENDED, FreeDOS makes no difference. This is 140:initdisk.c **** * boot time - there is no reason not to use LBA for reading partition tables, 141:initdisk.c **** * and the MSDOS 7.10 behaviour is not desirable. 142:initdisk.c **** * 143:initdisk.c **** * Note: for floppies we need the boot sector values though and the boot sector 144:initdisk.c **** * code does not use LBA addressing yet. 145:initdisk.c **** * 146:initdisk.c **** * Conclusion: with all this implemented, FreeDOS should be able to gracefully 147:initdisk.c **** * handle and read foreign hard disks moved across computers, whether using 148:initdisk.c **** * CHS or LBA, strengthening its role as a rescue environment. 149:initdisk.c **** */ 150:initdisk.c **** 151:initdisk.c **** #define LBA_to_CHS init_LBA_to_CHS 152:initdisk.c **** 153:initdisk.c **** /* 154:initdisk.c **** interesting macros - used internally only 155:initdisk.c **** */ 156:initdisk.c **** 157:initdisk.c **** #define SCAN_PRIMARYBOOT 0x00 158:initdisk.c **** #define SCAN_PRIMARY 0x01 159:initdisk.c **** #define SCAN_EXTENDED 0x02 160:initdisk.c **** #define SCAN_PRIMARY2 0x03 161:initdisk.c **** 162:initdisk.c **** #define FAT12 0x01 163:initdisk.c **** #define FAT16SMALL 0x04 164:initdisk.c **** #define EXTENDED 0x05 165:initdisk.c **** #define FAT16LARGE 0x06 166:initdisk.c **** #define FAT32 0x0b /* FAT32 partition that ends before the 8.4 */ 167:initdisk.c **** /* GB boundary */ 168:initdisk.c **** #define FAT32_LBA 0x0c /* FAT32 partition that ends after the 8.4GB */ 169:initdisk.c **** /* boundary. LBA is needed to access this. */ 170:initdisk.c **** #define FAT16_LBA 0x0e /* like 0x06, but it is supposed to end past */ 171:initdisk.c **** /* the 8.4GB boundary */ 172:initdisk.c **** #define FAT12_LBA 0xff /* fake FAT12 LBA entry for internal use */ 173:initdisk.c **** #define EXTENDED_LBA 0x0f /* like 0x05, but it is supposed to end past */ 174:initdisk.c **** 175:initdisk.c **** /* Let's play it safe and do not allow partitions with clusters above * 176:initdisk.c **** * or equal to 0xff0/0xfff0/0xffffff0 to be created * 177:initdisk.c **** * the problem with fff0-fff6 is that they might be interpreted as BAD * 178:initdisk.c **** * even though the standard BAD value is ...ff7 */ 179:initdisk.c **** 180:initdisk.c **** #define FAT12MAX (FAT_MAGIC-6) 181:initdisk.c **** #define FAT16MAX (FAT_MAGIC16-6) 182:initdisk.c **** #define FAT32MAX (FAT_MAGIC32-6) 183:initdisk.c **** 184:initdisk.c **** #define IsExtPartition(parttyp) ((parttyp) == EXTENDED || \ 185:initdisk.c **** (parttyp) == EXTENDED_LBA ) 186:initdisk.c **** 187:initdisk.c **** #define IsLBAPartition(parttyp) ((parttyp) == FAT12_LBA || \ 188:initdisk.c **** (parttyp) == FAT16_LBA || \ 189:initdisk.c **** (parttyp) == FAT32_LBA) 190:initdisk.c **** 191:initdisk.c **** #ifdef WITHFAT32 192:initdisk.c **** #define IsFATPartition(parttyp) ((parttyp) == FAT12 || \ 193:initdisk.c **** (parttyp) == FAT16SMALL || \ 194:initdisk.c **** (parttyp) == FAT16LARGE || \ 195:initdisk.c **** (parttyp) == FAT16_LBA || \ 196:initdisk.c **** (parttyp) == FAT32 || \ 197:initdisk.c **** (parttyp) == FAT32_LBA) 198:initdisk.c **** #else 199:initdisk.c **** #define IsFATPartition(parttyp) ((parttyp) == FAT12 || \ 200:initdisk.c **** (parttyp) == FAT16SMALL || \ 201:initdisk.c **** (parttyp) == FAT16LARGE || \ 202:initdisk.c **** (parttyp) == FAT16_LBA) 203:initdisk.c **** #endif 204:initdisk.c **** 205:initdisk.c **** #define MSDOS_EXT_SIGN 0x29 /* extended boot sector signature */ 206:initdisk.c **** #define MSDOS_FAT12_SIGN "FAT12 " /* FAT12 filesystem signature */ 207:initdisk.c **** #define MSDOS_FAT16_SIGN "FAT16 " /* FAT16 filesystem signature */ 208:initdisk.c **** #define MSDOS_FAT32_SIGN "FAT32 " /* FAT32 filesystem signature */ 209:initdisk.c **** 210:initdisk.c **** /* local - returned and used for BIOS interface INT 13, AH=48*/ 211:initdisk.c **** struct _bios_LBA_disk_parameterS { 212:initdisk.c **** UWORD size; 213:initdisk.c **** UWORD information; 214:initdisk.c **** ULONG cylinders; 215:initdisk.c **** ULONG heads; 216:initdisk.c **** ULONG sectors; 217:initdisk.c **** 218:initdisk.c **** ULONG totalSect; 219:initdisk.c **** ULONG totalSectHigh; 220:initdisk.c **** UWORD BytesPerSector; 221:initdisk.c **** 222:initdisk.c **** ULONG eddparameters; 223:initdisk.c **** }; 224:initdisk.c **** 225:initdisk.c **** /* physical characteristics of a drive */ 226:initdisk.c **** 227:initdisk.c **** struct DriveParamS { 228:initdisk.c **** UBYTE driveno; /* = 0x8x */ 229:initdisk.c **** UWORD descflags; 230:initdisk.c **** ULONG total_sectors; 231:initdisk.c **** 232:initdisk.c **** struct CHS chs; /* for normal INT 13 */ 233:initdisk.c **** }; 234:initdisk.c **** 235:initdisk.c **** struct PartTableEntry /* INTERNAL representation of partition table entry */ 236:initdisk.c **** { 237:initdisk.c **** UBYTE Bootable; 238:initdisk.c **** UBYTE FileSystem; 239:initdisk.c **** struct CHS Begin; 240:initdisk.c **** struct CHS End; 241:initdisk.c **** ULONG RelSect; 242:initdisk.c **** ULONG NumSect; 243:initdisk.c **** }; 244:initdisk.c **** 245:initdisk.c **** /* 246:initdisk.c **** internal global data 247:initdisk.c **** */ 248:initdisk.c **** 249:initdisk.c **** BOOL ExtLBAForce = FALSE; 250:initdisk.c **** 251:initdisk.c **** COUNT init_readdasd(UBYTE drive) 252:initdisk.c **** { 253:initdisk.c **** static iregs regs; 254:initdisk.c **** 255:initdisk.c **** regs.a.b.h = 0x15; 256:initdisk.c **** regs.d.b.l = drive; 257:initdisk.c **** init_call_intr(0x13, ®s); 258:initdisk.c **** if ((regs.flags & 1) == 0) 259:initdisk.c **** switch (regs.a.b.h) 260:initdisk.c **** { 261:initdisk.c **** case 2: 262:initdisk.c **** return DF_CHANGELINE; 263:initdisk.c **** case 3: 264:initdisk.c **** return DF_FIXED; 265:initdisk.c **** } 266:initdisk.c **** return 0; 267:initdisk.c **** } 268:initdisk.c **** 269:initdisk.c **** typedef struct { 270:initdisk.c **** UWORD bpb_nbyte; /* Bytes per Sector */ 271:initdisk.c **** UBYTE bpb_nsector; /* Sectors per Allocation Unit */ 272:initdisk.c **** UWORD bpb_nreserved; /* # Reserved Sectors */ 273:initdisk.c **** UBYTE bpb_nfat; /* # FATs */ 274:initdisk.c **** UWORD bpb_ndirent; /* # Root Directory entries */ 275:initdisk.c **** UWORD bpb_nsize; /* Size in sectors */ 276:initdisk.c **** UBYTE bpb_mdesc; /* MEDIA Descriptor Byte */ 277:initdisk.c **** UWORD bpb_nfsect; /* FAT size in sectors */ 278:initdisk.c **** UWORD bpb_nsecs; /* Sectors per track */ 279:initdisk.c **** UWORD bpb_nheads; /* Number of heads */ 280:initdisk.c **** } floppy_bpb; 281:initdisk.c **** 282:initdisk.c **** floppy_bpb floppy_bpbs[5] = { 283:initdisk.c **** /* copied from Brian Reifsnyder's FORMAT, bpb.h */ 284:initdisk.c **** {FLOPPY_SEC_SIZE, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2}, /* FD360 5.25 DS */ 285:initdisk.c **** {FLOPPY_SEC_SIZE, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2}, /* FD1200 5.25 HD */ 286:initdisk.c **** {FLOPPY_SEC_SIZE, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2}, /* FD720 3.5 LD */ 287:initdisk.c **** {FLOPPY_SEC_SIZE, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2}, /* FD1440 3.5 HD */ 288:initdisk.c **** {FLOPPY_SEC_SIZE, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2} /* FD2880 3.5 ED */ 289:initdisk.c **** }; 290:initdisk.c **** 291:initdisk.c **** COUNT init_getdriveparm(UBYTE drive, bpb * pbpbarray) 292:initdisk.c **** { 293:initdisk.c **** static iregs regs; 294:initdisk.c **** REG UBYTE type; 295:initdisk.c **** 296:initdisk.c **** if (drive & 0x80) 297:initdisk.c **** return 5; 298:initdisk.c **** regs.a.b.h = 0x08; 299:initdisk.c **** regs.d.b.l = drive; 300:initdisk.c **** init_call_intr(0x13, ®s); 301:initdisk.c **** type = regs.b.b.l - 1; 302:initdisk.c **** if (regs.flags & 1) 303:initdisk.c **** type = 0; /* return 320-360 for XTs */ 304:initdisk.c **** else if (type > 6) 305:initdisk.c **** type = 8; /* any odd ball drives get 8&7=0: the 320-360 table */ 306:initdisk.c **** else if (type == 5) 307:initdisk.c **** type = 4; /* 5 and 4 are both 2.88 MB */ 308:initdisk.c **** 309:initdisk.c **** memcpy(pbpbarray, &floppy_bpbs[type & 7], sizeof(floppy_bpb)); 310:initdisk.c **** ((bpb *)pbpbarray)->bpb_hidden = 0; /* very important to init to 0, see bug#1789 */ 311:initdisk.c **** ((bpb *)pbpbarray)->bpb_huge = 0; 312:initdisk.c **** 313:initdisk.c **** if (type == 3) 314:initdisk.c **** return 7; /* 1.44 MB */ 315:initdisk.c **** 316:initdisk.c **** if (type == 4) 317:initdisk.c **** return 9; /* 2.88 almost forgot this one */ 318:initdisk.c **** 319:initdisk.c **** /* 0=320-360kB, 1=1.2MB, 2=720kB, 8=any odd ball drives */ 320:initdisk.c **** return type; 321:initdisk.c **** } 322:initdisk.c **** 323:initdisk.c **** /* 324:initdisk.c **** translate LBA sectors into CHS addressing 325:initdisk.c **** initially copied and pasted from dsk.c! 326:initdisk.c **** 327:initdisk.c **** LBA to/from CHS conversion - see http://www.ata-atapi.com/ How It Works section on CHSxlat - CH 328:initdisk.c **** LBA (logical block address) simple 0 to N-1 used internally and with extended int 13h (BIOS) 329:initdisk.c **** L-CHS (logical CHS) is the CHS view when using int 13h (BIOS) 330:initdisk.c **** P-CHS (physical CHS) is the CHS view when directly accessing disk, should not, but could be use 331:initdisk.c **** 332:initdisk.c **** LBA = ( (cylinder * heads_per_cylinder + heads ) * sectors_per_track ) + sector - 1 333:initdisk.c **** 334:initdisk.c **** cylinder = LBA / (heads_per_cylinder * sectors_per_track) 335:initdisk.c **** temp = LBA % (heads_per_cylinder * sectors_per_track) 336:initdisk.c **** head = temp / sectors_per_track 337:initdisk.c **** sector = temp % sectors_per_track + 1 338:initdisk.c **** 339:initdisk.c **** where heads_per_cylinder and sectors_per_track are the current translation mode values. 340:initdisk.c **** cyclinder and heads are 0 to N-1 based, sector is 1 to N based 341:initdisk.c **** */ 342:initdisk.c **** 343:initdisk.c **** void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address, 344:initdisk.c **** struct DriveParamS *driveparam) 345:initdisk.c **** { 346:initdisk.c **** unsigned hs = driveparam->chs.Sector * driveparam->chs.Head; 347:initdisk.c **** unsigned hsrem = (unsigned)(LBA_address % hs); 348:initdisk.c **** 349:initdisk.c **** LBA_address /= hs; 350:initdisk.c **** 351:initdisk.c **** chs->Cylinder = LBA_address >= 0x10000ul ? 0xffffu : (unsigned)LBA_address; 352:initdisk.c **** chs->Head = hsrem / driveparam->chs.Sector; 353:initdisk.c **** chs->Sector = hsrem % driveparam->chs.Sector + 1; 354:initdisk.c **** } 355:initdisk.c **** 356:initdisk.c **** void printCHS(char *title, struct CHS *chs) 357:initdisk.c **** { 358:initdisk.c **** /* has no fixed size for head/sect: is often 1/1 in our context */ 359:initdisk.c **** if (InitKernelConfig.Verbose >= 0) printf("%s%4u-%u-%u", title, chs->Cylinder, chs->Head, chs->Se 360:initdisk.c **** } 361:initdisk.c **** 362:initdisk.c **** /* 363:initdisk.c **** reason for this modules existence: 364:initdisk.c **** 365:initdisk.c **** we have found a partition, and add them to the global 366:initdisk.c **** partition structure. 367:initdisk.c **** 368:initdisk.c **** */ 369:initdisk.c **** 370:initdisk.c **** /* Compute ceil(a/b) */ 371:initdisk.c **** #define cdiv(a, b) (((a) + (b) - 1) / (b)) 372:initdisk.c **** 373:initdisk.c **** /* calculates FAT data: 374:initdisk.c **** code adapted by Bart Oldeman from mkdosfs from the Linux dosfstools: 375:initdisk.c **** Author: Dave Hudson 376:initdisk.c **** Updated by: Roman Hodek 377:initdisk.c **** Portions copyright 1992, 1993 Remy Card 378:initdisk.c **** and 1991 Linus Torvalds 379:initdisk.c **** */ 380:initdisk.c **** /* defaults: */ 381:initdisk.c **** #define MAXCLUSTSIZE 128 382:initdisk.c **** #define NSECTORFAT12 8 383:initdisk.c **** #define NFAT 2 384:initdisk.c **** 385:initdisk.c **** VOID CalculateFATData(ddt * pddt, ULONG NumSectors, UBYTE FileSystem) 386:initdisk.c **** { 387:initdisk.c **** ULONG fatdata; 388:initdisk.c **** 389:initdisk.c **** bpb *defbpb = &pddt->ddt_defbpb; 390:initdisk.c **** 391:initdisk.c **** /* FAT related items */ 392:initdisk.c **** defbpb->bpb_nfat = NFAT; 393:initdisk.c **** /* normal value of number of entries in root dir */ 394:initdisk.c **** defbpb->bpb_ndirent = 512; 395:initdisk.c **** defbpb->bpb_nreserved = 1; 396:initdisk.c **** /* SEC_SIZE * DIRENT_SIZE / defbpb->bpb_ndirent + defbpb->bpb_nreserved */ 397:initdisk.c **** fatdata = NumSectors - (DIRENT_SIZE + 1); 398:initdisk.c **** if (FileSystem == FAT12 || FileSystem == FAT12_LBA) 399:initdisk.c **** { 400:initdisk.c **** unsigned fatdat; 401:initdisk.c **** /* in DOS, FAT12 defaults to 4096kb (8 sector) - clusters. */ 402:initdisk.c **** defbpb->bpb_nsector = NSECTORFAT12; 403:initdisk.c **** /* Force maximal fatdata=32696 sectors since with our only possible sector 404:initdisk.c **** size (512 bytes) this is the maximum for 4k clusters. 405:initdisk.c **** #clus*secperclus+#fats*fatlength= 4077 * 8 + 2 * 12 = 32640. 406:initdisk.c **** max FAT12 size for FreeDOS = 16,728,064 bytes */ 407:initdisk.c **** fatdat = (unsigned)fatdata; 408:initdisk.c **** if (fatdata > 32640) 409:initdisk.c **** fatdat = 32640; 410:initdisk.c **** /* The "+2*NSECTORFAT12" is for the reserved first two FAT entries */ 411:initdisk.c **** defbpb->bpb_nfsect = (UWORD)cdiv((fatdat + 2 * NSECTORFAT12) * 3UL, 412:initdisk.c **** FLOPPY_SEC_SIZE * 2 * NSECTORFAT12 + NFAT*3); 413:initdisk.c **** #ifdef DEBUG 414:initdisk.c **** /* Need to calculate number of clusters, since the unused parts of the 415:initdisk.c **** * FATS and data area together could make up space for an additional, 416:initdisk.c **** * not really present cluster. 417:initdisk.c **** * (This is really done in fatfs.c, bpbtodpb) */ 418:initdisk.c **** { 419:initdisk.c **** unsigned clust = (fatdat - 2 * defbpb->bpb_nfsect) / NSECTORFAT12; 420:initdisk.c **** unsigned maxclust = (defbpb->bpb_nfsect * 2 * FLOPPY_SEC_SIZE) / 3; 421:initdisk.c **** if (maxclust > FAT12MAX) 422:initdisk.c **** maxclust = FAT12MAX; 423:initdisk.c **** printf("FAT12: #clu=%u, fatlength=%u, maxclu=%u, limit=%u\n", 424:initdisk.c **** clust, defbpb->bpb_nfsect, maxclust, FAT12MAX); 425:initdisk.c **** if (clust > maxclust - 2) 426:initdisk.c **** { 427:initdisk.c **** clust = maxclust - 2; 428:initdisk.c **** printf("FAT12: too many clusters: setting to maxclu-2\n"); 429:initdisk.c **** } 430:initdisk.c **** } 431:initdisk.c **** #endif 432:initdisk.c **** memcpy(pddt->ddt_fstype, MSDOS_FAT12_SIGN, 8); 433:initdisk.c **** } 434:initdisk.c **** else 435:initdisk.c **** { /* FAT16/FAT32 */ 436:initdisk.c **** CLUSTER fatlength, maxcl; 437:initdisk.c **** unsigned long clust, maxclust, rest; 438:initdisk.c **** unsigned fatentpersec; 439:initdisk.c **** unsigned divisor; 440:initdisk.c **** 441:initdisk.c **** #ifdef WITHFAT32 442:initdisk.c **** if (FileSystem == FAT32 || FileSystem == FAT32_LBA) 443:initdisk.c **** { 444:initdisk.c **** /* For FAT32, use the cluster size table described in the FAT spec: 445:initdisk.c **** * http://www.microsoft.com/hwdev/download/hardware/fatgen103.pdf 446:initdisk.c **** */ 447:initdisk.c **** unsigned sz_gb = (unsigned)(NumSectors / 2097152UL); 448:initdisk.c **** unsigned char nsector = 64; /* disks greater than 32 GB, 32K cluster */ 449:initdisk.c **** if (sz_gb <= 32) /* disks up to 32 GB, 16K cluster */ 450:initdisk.c **** nsector = 32; 451:initdisk.c **** if (sz_gb <= 16) /* disks up to 16 GB, 8K cluster */ 452:initdisk.c **** nsector = 16; 453:initdisk.c **** if (sz_gb <= 8) /* disks up to 8 GB, 4K cluster */ 454:initdisk.c **** nsector = 8; 455:initdisk.c **** if (NumSectors <= 532480UL) /* disks up to 260 MB, 0.5K cluster */ 456:initdisk.c **** nsector = 1; 457:initdisk.c **** defbpb->bpb_nsector = nsector; 458:initdisk.c **** defbpb->bpb_ndirent = 0; 459:initdisk.c **** defbpb->bpb_nreserved = 0x20; 460:initdisk.c **** fatdata = NumSectors - 0x20; 461:initdisk.c **** fatentpersec = FLOPPY_SEC_SIZE/4; /* how many 32bit FAT values fit in a default 512 byte sec 462:initdisk.c **** maxcl = FAT32MAX; 463:initdisk.c **** } 464:initdisk.c **** else 465:initdisk.c **** #endif 466:initdisk.c **** { 467:initdisk.c **** /* FAT16: start at 4 sectors per cluster */ 468:initdisk.c **** defbpb->bpb_nsector = 4; 469:initdisk.c **** /* Force maximal fatdata=8387584 sectors (NumSectors=8387617) 470:initdisk.c **** since with our only possible sectorsize (512 bytes) this is the 471:initdisk.c **** maximum we can address with 64k clusters 472:initdisk.c **** #clus*secperclus+#fats*fatlength=65517 * 128 + 2 * 256=8386688. 473:initdisk.c **** max FAT16 size for FreeDOS = 4,293,984,256 bytes = 4GiB-983,040 */ 474:initdisk.c **** if (fatdata > 8386688ul) 475:initdisk.c **** fatdata = 8386688ul; 476:initdisk.c **** fatentpersec = FLOPPY_SEC_SIZE/2; /* how many 16bit FAT values fit in a default 512 byte sect 477:initdisk.c **** maxcl = FAT16MAX; 478:initdisk.c **** } 479:initdisk.c **** 480:initdisk.c **** DebugPrintf(("%lu sectors for FAT+data, starting with %u sectors/cluster\n", fatdata, defbpb->b 481:initdisk.c **** do 482:initdisk.c **** { 483:initdisk.c **** DebugPrintf(("Trying with %u sectors/cluster:\n", defbpb->bpb_nsector)); 484:initdisk.c **** divisor = fatentpersec * defbpb->bpb_nsector + NFAT; /* # of fat entries per cluster + 2 */ 485:initdisk.c **** rest = (unsigned)(fatdata % divisor); 486:initdisk.c **** fatlength = (CLUSTER)(fatdata / divisor); 487:initdisk.c **** fatlength += (CLUSTER)((2 * defbpb->bpb_nsector + divisor + rest - 1) / divisor); 488:initdisk.c **** 489:initdisk.c **** /* Need to calculate number of clusters, since the unused parts of the 490:initdisk.c **** * FATS and data area together could make up space for an additional, 491:initdisk.c **** * not really present cluster. */ 492:initdisk.c **** clust = (fatdata - NFAT * fatlength) / defbpb->bpb_nsector; 493:initdisk.c **** maxclust = fatlength * fatentpersec; 494:initdisk.c **** if (maxclust > maxcl) 495:initdisk.c **** maxclust = maxcl; 496:initdisk.c **** DebugPrintf(("FAT: #clu=%lu, fatlen=%lu, maxclu=%lu, limit=%lu\n", 497:initdisk.c **** clust, (ULONG)fatlength, maxclust, (ULONG)maxcl)); 498:initdisk.c **** if (clust > maxclust - 2) 499:initdisk.c **** { 500:initdisk.c **** clust = 0; 501:initdisk.c **** DebugPrintf(("FAT: too many clusters\n")); 502:initdisk.c **** } 503:initdisk.c **** else if (clust <= FAT_MAGIC) 504:initdisk.c **** { 505:initdisk.c **** /* The <= 4086 avoids that the filesystem will be misdetected as having a 506:initdisk.c **** * 12 bit FAT. */ 507:initdisk.c **** DebugPrintf(("FAT: would be misdetected as FAT12\n")); 508:initdisk.c **** clust = 0; 509:initdisk.c **** } 510:initdisk.c **** if (clust) 511:initdisk.c **** break; 512:initdisk.c **** defbpb->bpb_nsector <<= 1; 513:initdisk.c **** } 514:initdisk.c **** while (defbpb->bpb_nsector && defbpb->bpb_nsector <= MAXCLUSTSIZE); 515:initdisk.c **** #ifdef WITHFAT32 516:initdisk.c **** if (FileSystem == FAT32 || FileSystem == FAT32_LBA) 517:initdisk.c **** { 518:initdisk.c **** defbpb->bpb_nfsect = 0; 519:initdisk.c **** defbpb->bpb_xnfsect = fatlength; 520:initdisk.c **** /* set up additional FAT32 fields */ 521:initdisk.c **** defbpb->bpb_xflags = 0; 522:initdisk.c **** defbpb->bpb_xfsversion = 0; 523:initdisk.c **** defbpb->bpb_xrootclst = 2; 524:initdisk.c **** defbpb->bpb_xfsinfosec = 1; 525:initdisk.c **** defbpb->bpb_xbackupsec = 6; 526:initdisk.c **** memcpy(pddt->ddt_fstype, MSDOS_FAT32_SIGN, 8); 527:initdisk.c **** } 528:initdisk.c **** else 529:initdisk.c **** #endif 530:initdisk.c **** { 531:initdisk.c **** defbpb->bpb_nfsect = (UWORD)fatlength; 532:initdisk.c **** memcpy(pddt->ddt_fstype, MSDOS_FAT16_SIGN, 8); 533:initdisk.c **** } 534:initdisk.c **** } 535:initdisk.c **** pddt->ddt_fstype[8] = '\0'; 536:initdisk.c **** } 537:initdisk.c **** 538:initdisk.c **** STATIC void push_ddt(ddt *pddt) 539:initdisk.c **** { 15 .loc 1 539 0 16 _.LVL0: 0 000037B5 56 push si 0 000037B6 57 push di 0 000037B7 55 push bp 20 _.LCFI0: 0 000037B8 89E5 mov bp, sp 22 _.LCFI1: 0 000037BA 1E push ds 0 000037BB 1E push ds 0 000037BC 8B7608 mov si, word ptr [bp+8] 540:initdisk.c **** ddt FAR *fddt = DynAlloc("ddt", 1, sizeof(ddt)); 26 .loc 1 540 0 0 000037BF BF8800 mov di, 136 0 000037C2 57 push di 0 000037C3 B80100 mov ax, 1 0 000037C6 50 push ax 0 000037C7 B8[0000] mov ax, offset _.LC0 0 000037CA 50 push ax 0 000037CB E8[FEFF] call _DynAlloc 34 _.LVL1: 541:initdisk.c **** fmemcpy(fddt, pddt, sizeof(ddt)); 35 .loc 1 541 0 0 000037CE 57 push di 0 000037CF 16 push ss 0 000037D0 56 push si 0 000037D1 52 push dx 0 000037D2 8956FC mov word ptr [bp-4], dx 0 000037D5 50 push ax 0 000037D6 8946FE mov word ptr [bp-2], ax 0 000037D9 E8[FEFF] call _init_fmemcpy 44 _.LVL2: 542:initdisk.c **** if (pddt->ddt_logdriveno != 0) { 45 .loc 1 542 0 0 000037DC 807C0500 cmp byte ptr [si+5], 0 0 000037E0 7425 je _.L1 543:initdisk.c **** (fddt - 1)->ddt_next = fddt; 48 .loc 1 543 0 0 000037E2 8B56FC mov dx, word ptr [bp-4] 0 000037E5 8EC2 mov es, dx 0 000037E7 8B46FE mov ax, word ptr [bp-2] 0 000037EA 89C3 mov bx, ax 0 000037EC 26898778FF mov word ptr es:[bx-136], ax 54 _.LVL3: 0 000037F1 2689977AFF mov word ptr es:[bx-134], dx 544:initdisk.c **** if (pddt->ddt_driveno == 0 && pddt->ddt_logdriveno == 1) 56 .loc 1 544 0 0 000037F6 807C0400 cmp byte ptr [si+4], 0 0 000037FA 750B jne _.L1 59 .loc 1 544 0 is_stmt 0 discriminator 1 0 000037FC 807C0501 cmp byte ptr [si+5], 1 0 00003800 7505 jne _.L1 545:initdisk.c **** (fddt - 1)->ddt_descflags |= DF_CURLOG | DF_MULTLOG; 62 .loc 1 545 0 is_stmt 1 0 00003802 26804FAB30 or byte ptr es:[bx-85], 48 64 _.L1: 546:initdisk.c **** } 547:initdisk.c **** } 65 .loc 1 547 0 0 00003807 89EC mov sp, bp 0 00003809 5D pop bp 0 0000380A 5F pop di 0 0000380B 5E pop si 0 0000380C C20200 ret 2 71 _.LFE9: 72 .size _push_ddt, .-_push_ddt === Switch to base=012BB0h -> ".RODATA.STR1.1" 73 .section .rodata.str1.1 74 _.LC1: 0 00000D38 436865636B696E67 .string "Checking for LBA support in BIOS for drive %02x\n" 0 00000D40 20666F72204C4241 0 00000D48 20737570706F7274 0 00000D50 20696E2042494F53 0 00000D58 20666F7220647269 0 00000D60 766520253032780A 0 00000D68 00 76 _.LC2: 0 00000D69 4C42412073757070 .string "LBA support disabled.\n" 0 00000D71 6F72742064697361 0 00000D79 626C65642E0A00 78 _.LC3: 0 00000D80 537573706963696F .string "Suspicious LBA disk parameters, reverting to CHS access:\n" 0 00000D88 7573204C42412064 0 00000D90 69736B2070617261 0 00000D98 6D65746572732C20 0 00000DA0 726576657274696E 0 00000DA8 6720746F20434853 0 00000DB0 206163636573733A 0 00000DB8 0A00 80 _.LC4: 0 00000DBA 2020647269766520 .string " drive %02x, heads=%lu, sectors=%lu, total=0x%lx-%08lx\n" 0 00000DC2 253032782C206865 0 00000DCA 6164733D256C752C 0 00000DD2 20736563746F7273 0 00000DDA 3D256C752C20746F 0 00000DE2 74616C3D3078256C 0 00000DEA 782D2530386C780A 0 00000DF2 00 82 _.LC5: 0 00000DF3 4472697665202530 .string "Drive %02x is too large to handle, restricted to 2TB\n" 0 00000DFB 327820697320746F 0 00000E03 6F206C6172676520 0 00000E0B 746F2068616E646C 0 00000E13 652C207265737472 0 00000E1B 696374656420746F 0 00000E23 203254420A00 84 _.LC6: 0 00000E29 5265747269657669 .string "Retrieving CHS values for drive\n" 0 00000E31 6E67204348532076 0 00000E39 616C75657320666F 0 00000E41 722064726976650A 0 00000E49 00 86 _.LC7: 0 00000E4A 42494F5320726570 .string "BIOS reported 0 sectors/track, assuming 63!\n" 0 00000E52 6F72746564203020 0 00000E5A 736563746F72732F 0 00000E62 747261636B2C2061 0 00000E6A 7373756D696E6720 0 00000E72 3633210A00 === Switch to base=002270h -> ".TEXT" 88 .text 89 .type _LBA_Get_Drive_Parameters, @function 90 _LBA_Get_Drive_Parameters: 91 _.LFB11: 548:initdisk.c **** 549:initdisk.c **** void DosDefinePartition(struct DriveParamS *driveParam, 550:initdisk.c **** ULONG StartSector, struct PartTableEntry *pEntry, 551:initdisk.c **** int extendedPartNo, int PrimaryNum) 552:initdisk.c **** { 553:initdisk.c **** ddt nddt; 554:initdisk.c **** ddt *pddt = &nddt; 555:initdisk.c **** struct CHS chs; 556:initdisk.c **** 557:initdisk.c **** if (nUnits >= NDEV) 558:initdisk.c **** { 559:initdisk.c **** printf("more Partitions detected then possible, max = %d\n", NDEV); 560:initdisk.c **** return; /* we are done */ 561:initdisk.c **** } 562:initdisk.c **** 563:initdisk.c **** pddt->ddt_next = MK_FP(0, 0xffff); 564:initdisk.c **** pddt->ddt_driveno = driveParam->driveno; 565:initdisk.c **** pddt->ddt_logdriveno = nUnits; 566:initdisk.c **** pddt->ddt_descflags = driveParam->descflags; 567:initdisk.c **** /* Turn off LBA if not forced and the partition is within 1023 cyls and of the right type */ 568:initdisk.c **** /* the FileSystem type was internally converted to LBA_xxxx if a non-LBA partition 569:initdisk.c **** above cylinder 1023 was found */ 570:initdisk.c **** if (!(InitKernelConfig.ForceLBA || IsLBAPartition(pEntry->FileSystem) || ExtLBAForce)) 571:initdisk.c **** pddt->ddt_descflags &= ~DF_LBA; 572:initdisk.c **** pddt->ddt_ncyl = driveParam->chs.Cylinder; 573:initdisk.c **** 574:initdisk.c **** DebugPrintf(("LBA %senabled for drive %c:\n", (pddt->ddt_descflags & DF_LBA)?"":"not ", 'A' + nUn 575:initdisk.c **** 576:initdisk.c **** pddt->ddt_offset = StartSector; 577:initdisk.c **** 578:initdisk.c **** pddt->ddt_defbpb.bpb_nbyte = FLOPPY_SEC_SIZE; 579:initdisk.c **** pddt->ddt_defbpb.bpb_mdesc = 0xf8; 580:initdisk.c **** pddt->ddt_defbpb.bpb_nheads = driveParam->chs.Head; 581:initdisk.c **** pddt->ddt_defbpb.bpb_nsecs = driveParam->chs.Sector; 582:initdisk.c **** pddt->ddt_defbpb.bpb_hidden = pEntry->RelSect; 583:initdisk.c **** 584:initdisk.c **** pddt->ddt_defbpb.bpb_nsize = 0; 585:initdisk.c **** pddt->ddt_defbpb.bpb_huge = pEntry->NumSect; 586:initdisk.c **** if (pEntry->NumSect <= 0xffff) 587:initdisk.c **** { 588:initdisk.c **** pddt->ddt_defbpb.bpb_nsize = (UWORD) (pEntry->NumSect); 589:initdisk.c **** pddt->ddt_defbpb.bpb_huge = 0; /* may still be set on Win95 */ 590:initdisk.c **** } 591:initdisk.c **** 592:initdisk.c **** /* sectors per cluster, sectors per FAT etc. */ 593:initdisk.c **** CalculateFATData(pddt, pEntry->NumSect, pEntry->FileSystem); 594:initdisk.c **** 595:initdisk.c **** pddt->ddt_serialno = 0x12345678l; 596:initdisk.c **** /* drive inaccessible until bldbpb successful */ 597:initdisk.c **** pddt->ddt_descflags |= init_readdasd(pddt->ddt_driveno) | DF_NOACCESS; 598:initdisk.c **** pddt->ddt_type = 5; 599:initdisk.c **** memcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb)); 600:initdisk.c **** 601:initdisk.c **** push_ddt(pddt); 602:initdisk.c **** 603:initdisk.c **** /* Alain whishes to keep this in later versions, too 604:initdisk.c **** Tom likes this too, so he made it configurable by SYS CONFIG ... 605:initdisk.c **** */ 606:initdisk.c **** 607:initdisk.c **** if (InitKernelConfig.InitDiskShowDriveAssignment) 608:initdisk.c **** { 609:initdisk.c **** char *ExtPri; 610:initdisk.c **** int num; 611:initdisk.c **** 612:initdisk.c **** LBA_to_CHS(&chs, StartSector, driveParam); 613:initdisk.c **** 614:initdisk.c **** ExtPri = "Pri"; 615:initdisk.c **** num = PrimaryNum + 1; 616:initdisk.c **** if (extendedPartNo) 617:initdisk.c **** { 618:initdisk.c **** ExtPri = "Ext"; 619:initdisk.c **** num = extendedPartNo; 620:initdisk.c **** } 621:initdisk.c **** printf("%c: HD%d, %s[%2d]", 'A' + nUnits, 622:initdisk.c **** (driveParam->driveno & 0x7f) + 1, ExtPri, num); 623:initdisk.c **** 624:initdisk.c **** printCHS(", CHS= ", &chs); 625:initdisk.c **** 626:initdisk.c **** printf(", start=%6lu MB, size=%6lu MB\n", 627:initdisk.c **** StartSector / 2048, pEntry->NumSect / 2048); 628:initdisk.c **** } 629:initdisk.c **** 630:initdisk.c **** nUnits++; 631:initdisk.c **** } 632:initdisk.c **** 633:initdisk.c **** /* Get the parameters of the hard disk */ 634:initdisk.c **** STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam, int firstPass) 635:initdisk.c **** { 92 .loc 1 635 0 93 _.LVL4: 0 0000380F 56 push si 0 00003810 57 push di 0 00003811 55 push bp 97 _.LCFI2: 0 00003812 89E5 mov bp, sp 99 _.LCFI3: 0 00003814 83EC40 sub sp, 64 0 00003817 8B760A mov si, word ptr [bp+10] 636:initdisk.c **** iregs regs; 637:initdisk.c **** struct _bios_LBA_disk_parameterS lba_bios_parameters; 638:initdisk.c **** 639:initdisk.c **** if (firstPass && (InitKernelConfig.Verbose >= 1)) 102 .loc 1 639 0 0 0000381A 837E0C00 cmp word ptr [bp+12], 0 0 0000381E BF[0000] mov di, offset _InitKernelConfig 0 00003821 7413 je _.L7 106 .loc 1 639 0 is_stmt 0 discriminator 1 0 00003823 807D1500 cmp byte ptr [di+21], 0 0 00003827 7E0D jle _.L7 640:initdisk.c **** printf("Checking for LBA support in BIOS for drive %02x\n", drive); 109 .loc 1 640 0 is_stmt 1 0 00003829 FF7608 push word ptr [bp+8] 0 0000382C B8[0400] mov ax, offset _.LC1 0 0000382F 50 push ax 0 00003830 E8[FEFF] call _init_printf 114 _.LVL5: 0 00003833 83C404 add sp, 4 116 _.L7: 641:initdisk.c **** 642:initdisk.c **** memset(driveParam, 0, sizeof *driveParam); 117 .loc 1 642 0 0 00003836 B80D00 mov ax, 13 0 00003839 50 push ax 0 0000383A 31C0 xor ax, ax 0 0000383C 50 push ax 0 0000383D 8946C4 mov word ptr [bp-60], ax 0 00003840 56 push si 0 00003841 E8[FEFF] call _init_memset 125 _.LVL6: 643:initdisk.c **** drive |= 0x80; 126 .loc 1 643 0 0 00003844 8B4608 mov ax, word ptr [bp+8] 0 00003847 0C80 or al, -128 0 00003849 8946C6 mov word ptr [bp-58], ax 130 _.LVL7: 644:initdisk.c **** 645:initdisk.c **** /* use CHS if LBA support is not enabled by kernel configuration */ 646:initdisk.c **** if (!InitKernelConfig.GlobalEnableLBAsupport) 131 .loc 1 646 0 0 0000384C 807D0C00 cmp byte ptr [di+12], 0 0 00003850 8B46C4 mov ax, word ptr [bp-60] 134 _.LVL8: 0 00003853 8946C2 mov word ptr [bp-62], ax 0 00003856 7532 jne _.L8 647:initdisk.c **** { 648:initdisk.c **** if (firstPass && (InitKernelConfig.Verbose >= 1)) printf("LBA support disabled.\n"); 137 .loc 1 648 0 0 00003858 837E0C00 cmp word ptr [bp+12], 0 0 0000385C 7503E94A01 je _.L10 140 .loc 1 648 0 is_stmt 0 discriminator 1 0 00003861 807D1500 cmp byte ptr [di+21], 0 0 00003865 7F03E94101 jle _.L10 143 .loc 1 648 0 discriminator 2 0 0000386A B8[3500] mov ax, offset _.LC2 0 0000386D 50 push ax 0 0000386E E8[FEFF] call _init_printf 147 _.LVL9: 0 00003871 83C402 add sp, 2 149 _.LVL10: 150 _.L12: 649:initdisk.c **** goto StandardBios; 650:initdisk.c **** } 651:initdisk.c **** /* check for LBA support */ 652:initdisk.c **** regs.b.x = 0x55aa; 653:initdisk.c **** regs.a.b.h = 0x41; 654:initdisk.c **** regs.d.b.l = drive; 655:initdisk.c **** regs.ds = 0x40; 656:initdisk.c **** /* ds = 40h is to work around a Xi8088 ROM-BIOS bug, 657:initdisk.c **** refer to https://github.com/FDOS/kernel/issues/156 658:initdisk.c **** and https://www.bttr-software.de/forum/forum_entry.php?id=21275 */ 659:initdisk.c **** regs.flags = FLG_CARRY; /* ensure carry is set to force error if unsupported */ 660:initdisk.c **** 661:initdisk.c **** init_call_intr(0x13, ®s); 662:initdisk.c **** 663:initdisk.c **** if ((regs.flags & FLG_CARRY) || regs.b.x != 0xaa55 || !(regs.c.x & 0x01)) 664:initdisk.c **** { 665:initdisk.c **** /* error conditions: 666:initdisk.c **** carry set or BX != 0xaa55 => no EDD spec compatible BIOS (LBA extensions not supported) 667:initdisk.c **** CX bit 1 is set if BIOS supports fixed disk subset (Disk Address Packet [DAP] subset), 668:initdisk.c **** or clear if fixed disk access subset not supported by LBA extensions 669:initdisk.c **** */ 670:initdisk.c **** goto StandardBios; 671:initdisk.c **** } 672:initdisk.c **** 673:initdisk.c **** /* version 1.0, 2.0 have different verify */ 674:initdisk.c **** if (regs.a.b.h < 0x21) 675:initdisk.c **** LBA_WRITE_VERIFY = 0x4301; /* may be problematic if INT13 is hooked by 676:initdisk.c **** different controllers / drivers */ 677:initdisk.c **** 678:initdisk.c **** /* query disk size and DMA handling, geometry is queried later by INT13,08 */ 679:initdisk.c **** memset(&lba_bios_parameters, 0, sizeof(lba_bios_parameters)); 680:initdisk.c **** lba_bios_parameters.size = sizeof(lba_bios_parameters); 681:initdisk.c **** 682:initdisk.c **** regs.si = FP_OFF(&lba_bios_parameters); 683:initdisk.c **** regs.ds = FP_SEG(&lba_bios_parameters); 684:initdisk.c **** regs.a.b.h = 0x48; 685:initdisk.c **** regs.d.b.l = drive; 686:initdisk.c **** init_call_intr(0x13, ®s); 687:initdisk.c **** 688:initdisk.c **** if (regs.flags & FLG_CARRY) 689:initdisk.c **** { 690:initdisk.c **** /* carry flag set indicates failed LBA disk parameter query */ 691:initdisk.c **** goto StandardBios; 692:initdisk.c **** } 693:initdisk.c **** 694:initdisk.c **** if (lba_bios_parameters.heads > 0xffff || 695:initdisk.c **** lba_bios_parameters.sectors > 0xffff || 696:initdisk.c **** (lba_bios_parameters.totalSect == 0 && 697:initdisk.c **** lba_bios_parameters.totalSectHigh == 0)) 698:initdisk.c **** { 699:initdisk.c **** if (firstPass) 700:initdisk.c **** { 701:initdisk.c **** printf("Suspicious LBA disk parameters, reverting to CHS access:\n"); 702:initdisk.c **** printf(" drive %02x, heads=%lu, sectors=%lu, total=0x%lx-%08lx\n", 703:initdisk.c **** drive, 704:initdisk.c **** (ULONG) lba_bios_parameters.heads, 705:initdisk.c **** (ULONG) lba_bios_parameters.sectors, 706:initdisk.c **** (ULONG) lba_bios_parameters.totalSect, 707:initdisk.c **** (ULONG) lba_bios_parameters.totalSectHigh); 708:initdisk.c **** } 709:initdisk.c **** 710:initdisk.c **** goto StandardBios; 711:initdisk.c **** } 712:initdisk.c **** 713:initdisk.c **** /* restrict disk size to 2TB, because we can not handle more */ 714:initdisk.c **** if (lba_bios_parameters.totalSectHigh == 0) 715:initdisk.c **** { 716:initdisk.c **** driveParam->total_sectors = lba_bios_parameters.totalSect; 717:initdisk.c **** } 718:initdisk.c **** else 719:initdisk.c **** { 720:initdisk.c **** if (firstPass) printf("Drive %02x is too large to handle, restricted to 2TB\n", drive); 721:initdisk.c **** driveParam->total_sectors = 0xffffffffUL; 722:initdisk.c **** } 723:initdisk.c **** 724:initdisk.c **** /* if we arrive here, mark drive as LBA capable */ 725:initdisk.c **** driveParam->descflags = DF_LBA; 726:initdisk.c **** if (lba_bios_parameters.information & 8) 727:initdisk.c **** driveParam->descflags |= DF_WRTVERIFY; 728:initdisk.c **** 729:initdisk.c **** if (lba_bios_parameters.information & 1) 730:initdisk.c **** { 731:initdisk.c **** /* DMA boundary errors are handled transparently */ 732:initdisk.c **** driveParam->descflags |= DF_DMA_TRANSPARENT; 733:initdisk.c **** } 734:initdisk.c **** 735:initdisk.c **** StandardBios: /* get disk geometry, and if LBA is not enabled, also size */ 736:initdisk.c **** if (firstPass && (InitKernelConfig.Verbose >= 1)) 151 .loc 1 736 0 is_stmt 1 discriminator 1 0 00003874 807D1500 cmp byte ptr [di+21], 0 0 00003878 7F03E92E01 jle _.L10 737:initdisk.c **** printf("Retrieving CHS values for drive\n"); 154 .loc 1 737 0 0 0000387D B8[F500] mov ax, offset _.LC6 0 00003880 50 push ax 0 00003881 E8[FEFF] call _init_printf 158 _.LVL11: 0 00003884 83C402 add sp, 2 0 00003887 E92101 jmp _.L10 161 _.LVL12: 162 _.L8: 652:initdisk.c **** regs.a.b.h = 0x41; 163 .loc 1 652 0 0 0000388A C746CCAA55 mov word ptr [bp-52], 21930 653:initdisk.c **** regs.d.b.l = drive; 165 .loc 1 653 0 0 0000388F C646CB41 mov byte ptr [bp-53], 65 654:initdisk.c **** regs.ds = 0x40; 167 .loc 1 654 0 0 00003893 8A46C6 mov al, byte ptr [bp-58] 0 00003896 8846C4 mov byte ptr [bp-60], al 0 00003899 8846D0 mov byte ptr [bp-48], al 655:initdisk.c **** /* ds = 40h is to work around a Xi8088 ROM-BIOS bug, 171 .loc 1 655 0 0 0000389C C746D84000 mov word ptr [bp-40], 64 659:initdisk.c **** 173 .loc 1 659 0 0 000038A1 C746E00100 mov word ptr [bp-32], 1 661:initdisk.c **** 175 .loc 1 661 0 0 000038A6 8D46CA lea ax, [-54+bp] 0 000038A9 50 push ax 0 000038AA B81300 mov ax, 19 0 000038AD 50 push ax 0 000038AE E8[FEFF] call _init_call_intr 181 _.LVL13: 663:initdisk.c **** { 182 .loc 1 663 0 0 000038B1 F646E001 test byte ptr [bp-32], 1 0 000038B5 7403E9E800 jne _.L14 663:initdisk.c **** { 185 .loc 1 663 0 is_stmt 0 discriminator 1 0 000038BA 817ECC55AA cmp word ptr [bp-52], -21931 0 000038BF 7403E9DE00 jne _.L14 663:initdisk.c **** { 188 .loc 1 663 0 discriminator 2 0 000038C4 F646CE01 test byte ptr [bp-50], 1 0 000038C8 7503E9D500 je _.L14 674:initdisk.c **** LBA_WRITE_VERIFY = 0x4301; /* may be problematic if INT13 is hooked by 191 .loc 1 674 0 is_stmt 1 0 000038CD 807ECB20 cmp byte ptr [bp-53], 32 0 000038D1 770C ja _.L16 675:initdisk.c **** different controllers / drivers */ 194 .loc 1 675 0 0 000038D3 B8[0000] mov ax, offset _LBA_WRITE_VERIFY@OZSEG16 0 000038D6 8EC0 mov es, ax 0 000038D8 26C706[0000]0143 mov word ptr es:[_LBA_WRITE_VERIFY], 17153 198 _.LVL14: 199 _.L16: 679:initdisk.c **** lba_bios_parameters.size = sizeof(lba_bios_parameters); 200 .loc 1 679 0 0 000038DF BA1E00 mov dx, 30 0 000038E2 52 push dx 0 000038E3 8956C0 mov word ptr [bp-64], dx 0 000038E6 FF76C2 push word ptr [bp-62] 0 000038E9 8D46E2 lea ax, [-30+bp] 0 000038EC 50 push ax 0 000038ED 8946C2 mov word ptr [bp-62], ax 0 000038F0 E8[FEFF] call _init_memset 209 _.LVL15: 682:initdisk.c **** regs.ds = FP_SEG(&lba_bios_parameters); 210 .loc 1 682 0 0 000038F3 C456C0 les dx, dword ptr [bp-64] 0 000038F6 8956E2 mov word ptr [bp-30], dx 0 000038F9 8C46D2 mov word ptr [bp-46], es 683:initdisk.c **** regs.a.b.h = 0x48; 214 .loc 1 683 0 0 000038FC 8C56D8 mov word ptr [bp-40], ss 684:initdisk.c **** regs.d.b.l = drive; 216 .loc 1 684 0 0 000038FF C646CB48 mov byte ptr [bp-53], 72 685:initdisk.c **** init_call_intr(0x13, ®s); 218 .loc 1 685 0 0 00003903 8A46C4 mov al, byte ptr [bp-60] 0 00003906 8846D0 mov byte ptr [bp-48], al 686:initdisk.c **** 221 .loc 1 686 0 0 00003909 8D46CA lea ax, [-54+bp] 0 0000390C 50 push ax 0 0000390D B81300 mov ax, 19 0 00003910 50 push ax 0 00003911 E8[FEFF] call _init_call_intr 227 _.LVL16: 688:initdisk.c **** { 228 .loc 1 688 0 0 00003914 F646E001 test byte ptr [bp-32], 1 0 00003918 7403E98500 jne _.L14 694:initdisk.c **** lba_bios_parameters.sectors > 0xffff || 231 .loc 1 694 0 0 0000391D 837EEC00 cmp word ptr [bp-20], 0 0 00003921 7521 jne _.L17 0 00003923 837EF000 cmp word ptr [bp-16], 0 0 00003927 751B jne _.L17 696:initdisk.c **** lba_bios_parameters.totalSectHigh == 0)) 236 .loc 1 696 0 discriminator 1 0 00003929 8B56F2 mov dx, word ptr [bp-14] 0 0000392C 8B46F4 mov ax, word ptr [bp-12] 0 0000392F 8946C4 mov word ptr [bp-60], ax 695:initdisk.c **** (lba_bios_parameters.totalSect == 0 && 240 .loc 1 695 0 discriminator 1 0 00003932 89D1 mov cx, dx 0 00003934 09C1 or cx, ax 0 00003936 8B5EF6 mov bx, word ptr [bp-10] 0 00003939 8B4EF8 mov cx, word ptr [bp-8] 0 0000393C 753B jne _.L20 696:initdisk.c **** lba_bios_parameters.totalSectHigh == 0)) 246 .loc 1 696 0 0 0000393E 89D8 mov ax, bx 0 00003940 09C8 or ax, cx 0 00003942 7535 jne _.L20 250 _.L17: 699:initdisk.c **** { 251 .loc 1 699 0 0 00003944 837E0C00 cmp word ptr [bp+12], 0 0 00003948 7461 je _.L10 701:initdisk.c **** printf(" drive %02x, heads=%lu, sectors=%lu, total=0x%lx-%08lx\n", 254 .loc 1 701 0 0 0000394A B8[4C00] mov ax, offset _.LC3 0 0000394D 50 push ax 0 0000394E E8[FEFF] call _init_printf 258 _.LVL17: 702:initdisk.c **** drive, 259 .loc 1 702 0 0 00003951 FF76F8 push word ptr [bp-8] 0 00003954 FF76F6 push word ptr [bp-10] 0 00003957 FF76F4 push word ptr [bp-12] 0 0000395A FF76F2 push word ptr [bp-14] 0 0000395D FF76F0 push word ptr [bp-16] 0 00003960 FF76EE push word ptr [bp-18] 0 00003963 FF76EC push word ptr [bp-20] 0 00003966 FF76EA push word ptr [bp-22] 0 00003969 FF76C6 push word ptr [bp-58] 0 0000396C B8[8600] mov ax, offset _.LC4 0 0000396F 50 push ax 0 00003970 E8[FEFF] call _init_printf 272 _.LVL18: 0 00003973 83C416 add sp, 22 0 00003976 E9FBFE jmp _.L12 275 _.L20: 714:initdisk.c **** { 276 .loc 1 714 0 0 00003979 09CB or bx, cx 0 0000397B 7403E9CE00 jne _.L21 716:initdisk.c **** } 279 .loc 1 716 0 0 00003980 895403 mov word ptr [si+3], dx 0 00003983 8B46C4 mov ax, word ptr [bp-60] 0 00003986 894405 mov word ptr [si+5], ax 283 _.L22: 725:initdisk.c **** if (lba_bios_parameters.information & 8) 284 .loc 1 725 0 0 00003989 C744010004 mov word ptr [si+1], 1024 726:initdisk.c **** driveParam->descflags |= DF_WRTVERIFY; 286 .loc 1 726 0 0 0000398E 8B46E4 mov ax, word ptr [bp-28] 0 00003991 A808 test al, 8 0 00003993 7405 je _.L24 727:initdisk.c **** 290 .loc 1 727 0 0 00003995 C74401000C mov word ptr [si+1], 3072 292 _.L24: 729:initdisk.c **** { 293 .loc 1 729 0 0 0000399A A801 test al, 1 0 0000399C 7404 je _.L14 732:initdisk.c **** } 296 .loc 1 732 0 0 0000399E 804C0210 or byte ptr [si+2], 16 298 _.L14: 736:initdisk.c **** printf("Retrieving CHS values for drive\n"); 299 .loc 1 736 0 0 000039A2 837E0C00 cmp word ptr [bp+12], 0 0 000039A6 7403E9C9FE jne _.L12 302 _.L10: 738:initdisk.c **** 739:initdisk.c **** regs.a.b.h = 0x08; 303 .loc 1 739 0 0 000039AB C646CB08 mov byte ptr [bp-53], 8 740:initdisk.c **** regs.d.b.l = drive; 305 .loc 1 740 0 0 000039AF 8A46C6 mov al, byte ptr [bp-58] 0 000039B2 8846C4 mov byte ptr [bp-60], al 0 000039B5 8846D0 mov byte ptr [bp-48], al 741:initdisk.c **** 742:initdisk.c **** init_call_intr(0x13, ®s); 309 .loc 1 742 0 0 000039B8 8D46CA lea ax, [-54+bp] 0 000039BB 50 push ax 0 000039BC B81300 mov ax, 19 0 000039BF 50 push ax 0 000039C0 E8[FEFF] call _init_call_intr 315 _.LVL19: 743:initdisk.c **** 744:initdisk.c **** if (regs.flags & 0x01) 316 .loc 1 744 0 0 000039C3 F646E001 test byte ptr [bp-32], 1 0 000039C7 7403E9A200 jne _.L25 745:initdisk.c **** { 746:initdisk.c **** goto ErrorReturn; 747:initdisk.c **** } 748:initdisk.c **** 749:initdisk.c **** /* int13h call returns max value, store as count (#) i.e. +1 for 0 based heads & cylinders */ 750:initdisk.c **** driveParam->chs.Head = (regs.d.x >> 8) + 1; /* DH = max head value = # of heads - 1 (0-255) */ 319 .loc 1 750 0 0 000039CC 8B46D0 mov ax, word ptr [bp-48] 0 000039CF B108 mov cl, 8 0 000039D1 D3E8 shr ax, cl 0 000039D3 40 inc ax 0 000039D4 894409 mov word ptr [si+9], ax 751:initdisk.c **** driveParam->chs.Sector = (regs.c.x & 0x3f); /* CL bits 0-5 = max sector value = # (sectors/track) 325 .loc 1 751 0 0 000039D7 8B56CE mov dx, word ptr [bp-50] 0 000039DA 89D1 mov cx, dx 0 000039DC 83E13F and cx, 63 0 000039DF 89CB mov bx, cx 0 000039E1 894C0B mov word ptr [si+11], cx 752:initdisk.c **** /* max cylinder value = # cylinders - 1 (0-1023) = [high two bits]CL7:6=cyls9:8, [low byte]CH=cyl 753:initdisk.c **** driveParam->chs.Cylinder = (regs.c.x >> 8) | ((regs.c.x & 0xc0) << 2) + 1; 331 .loc 1 753 0 0 000039E4 89D0 mov ax, dx 0 000039E6 B102 mov cl, 2 0 000039E8 D3E0 shl ax, cl 0 000039EA 250003 and ax, 768 0 000039ED 40 inc ax 0 000039EE 08F0 or al, dh 0 000039F0 894407 mov word ptr [si+7], ax 754:initdisk.c **** 755:initdisk.c **** if (driveParam->chs.Sector == 0) { 339 .loc 1 755 0 0 000039F3 85DB test bx, bx 0 000039F5 751B jne _.L27 756:initdisk.c **** /* happens e.g. with Bochs 1.x if no harddisk defined */ 757:initdisk.c **** driveParam->chs.Sector = 63; /* avoid division by zero...! */ 342 .loc 1 757 0 0 000039F7 C7440B3F00 mov word ptr [si+11], 63 758:initdisk.c **** if (firstPass && (InitKernelConfig.Verbose >= 0)) 344 .loc 1 758 0 0 000039FC 837E0C00 cmp word ptr [bp+12], 0 0 00003A00 7410 je _.L27 347 .loc 1 758 0 is_stmt 0 discriminator 1 0 00003A02 807D1500 cmp byte ptr [di+21], 0 0 00003A06 7C0A jl _.L27 759:initdisk.c **** printf("BIOS reported 0 sectors/track, assuming 63!\n"); 350 .loc 1 759 0 is_stmt 1 0 00003A08 B8[1601] mov ax, offset _.LC7 0 00003A0B 50 push ax 0 00003A0C E8[FEFF] call _init_printf 354 _.LVL20: 0 00003A0F 83C402 add sp, 2 356 _.L27: 760:initdisk.c **** } 761:initdisk.c **** 762:initdisk.c **** if (!(driveParam->descflags & DF_LBA)) 357 .loc 1 762 0 0 00003A12 F6440204 test byte ptr [si+2], 4 0 00003A16 7522 jne _.L29 763:initdisk.c **** { 764:initdisk.c **** driveParam->total_sectors = 765:initdisk.c **** (ULONG)driveParam->chs.Cylinder 766:initdisk.c **** * driveParam->chs.Head * driveParam->chs.Sector; 360 .loc 1 766 0 0 00003A18 8B4407 mov ax, word ptr [si+7] 0 00003A1B F76409 mul word ptr [si+9] 0 00003A1E 8EC0 mov es, ax 0 00003A20 8B5C0B mov bx, word ptr [si+11] 0 00003A23 89D8 mov ax, bx 0 00003A25 F7E2 mul dx 0 00003A27 97 xchg di, ax 0 00003A28 8CC0 mov ax, es 0 00003A2A F7E3 mul bx 0 00003A2C 8956C8 mov word ptr [bp-56], dx 0 00003A2F 89FA mov dx, di 0 00003A31 0356C8 add dx, word ptr [bp-56] 764:initdisk.c **** (ULONG)driveParam->chs.Cylinder 373 .loc 1 764 0 0 00003A34 894403 mov word ptr [si+3], ax 0 00003A37 895405 mov word ptr [si+5], dx 376 _.L29: 767:initdisk.c **** } 768:initdisk.c **** 769:initdisk.c **** driveParam->driveno = drive; 377 .loc 1 769 0 0 00003A3A 8A46C4 mov al, byte ptr [bp-60] 0 00003A3D 8804 mov byte ptr [si], al 0 00003A3F 8A4608 mov al, byte ptr [bp+8] 0 00003A42 30E4 xor ah, ah 0 00003A44 0C80 or al, -128 383 _.L6: 770:initdisk.c **** 771:initdisk.c **** DebugPrintf(("drive %02Xh total: C = %u, H = %u, S = %u,", 772:initdisk.c **** drive, 773:initdisk.c **** driveParam->chs.Cylinder, 774:initdisk.c **** driveParam->chs.Head, driveParam->chs.Sector)); 775:initdisk.c **** DebugPrintf((" total size %luMB\n\n", driveParam->total_sectors / 2048)); 776:initdisk.c **** 777:initdisk.c **** return driveParam->driveno; 778:initdisk.c **** 779:initdisk.c **** 780:initdisk.c **** ErrorReturn: 781:initdisk.c **** /* to avoid division by zero later, use some sane defaults */ 782:initdisk.c **** driveParam->total_sectors = 0; 783:initdisk.c **** driveParam->chs.Head = 16; 784:initdisk.c **** driveParam->chs.Sector = 63; 785:initdisk.c **** return 0; 786:initdisk.c **** } 384 .loc 1 786 0 0 00003A46 89EC mov sp, bp 0 00003A48 5D pop bp 0 00003A49 5F pop di 0 00003A4A 5E pop si 0 00003A4B C20600 ret 6 390 _.L21: 720:initdisk.c **** driveParam->total_sectors = 0xffffffffUL; 391 .loc 1 720 0 0 00003A4E 837E0C00 cmp word ptr [bp+12], 0 0 00003A52 740D je _.L23 720:initdisk.c **** driveParam->total_sectors = 0xffffffffUL; 394 .loc 1 720 0 is_stmt 0 discriminator 1 0 00003A54 FF76C6 push word ptr [bp-58] 0 00003A57 B8[BF00] mov ax, offset _.LC5 0 00003A5A 50 push ax 0 00003A5B E8[FEFF] call _init_printf 399 _.LVL21: 0 00003A5E 83C404 add sp, 4 401 _.L23: 721:initdisk.c **** } 402 .loc 1 721 0 is_stmt 1 0 00003A61 C74403FFFF mov word ptr [si+3], -1 0 00003A66 C74405FFFF mov word ptr [si+5], -1 0 00003A6B E91BFF jmp _.L22 406 _.L25: 782:initdisk.c **** driveParam->chs.Head = 16; 407 .loc 1 782 0 0 00003A6E C744030000 mov word ptr [si+3], 0 0 00003A73 C744050000 mov word ptr [si+5], 0 783:initdisk.c **** driveParam->chs.Sector = 63; 410 .loc 1 783 0 0 00003A78 C744091000 mov word ptr [si+9], 16 784:initdisk.c **** return 0; 412 .loc 1 784 0 0 00003A7D C7440B3F00 mov word ptr [si+11], 63 785:initdisk.c **** } 414 .loc 1 785 0 0 00003A82 31C0 xor ax, ax 0 00003A84 EBC0 jmp _.L6 417 _.LFE11: 418 .size _LBA_Get_Drive_Parameters, .-_LBA_Get_Drive_Parameters 419 .global _init_readdasd 420 .type _init_readdasd, @function 421 _init_readdasd: 422 _.LFB4: 252:initdisk.c **** static iregs regs; 423 .loc 1 252 0 424 _.LVL22: 0 00003A86 56 push si 0 00003A87 55 push bp 427 _.LCFI4: 0 00003A88 89E5 mov bp, sp 429 _.LCFI5: 255:initdisk.c **** regs.d.b.l = drive; 430 .loc 1 255 0 0 00003A8A BE[3402] mov si, offset _regs.1887 0 00003A8D C606[3502]15 mov byte ptr [_regs.1887+1], 21 256:initdisk.c **** init_call_intr(0x13, ®s); 433 .loc 1 256 0 0 00003A92 8A4606 mov al, byte ptr [bp+6] 0 00003A95 884406 mov byte ptr [si+6], al 257:initdisk.c **** if ((regs.flags & 1) == 0) 436 .loc 1 257 0 0 00003A98 56 push si 0 00003A99 B81300 mov ax, 19 0 00003A9C 50 push ax 0 00003A9D E8[FEFF] call _init_call_intr 441 _.LVL23: 258:initdisk.c **** switch (regs.a.b.h) 442 .loc 1 258 0 0 00003AA0 8B4416 mov ax, word ptr [si+22] 0 00003AA3 83E001 and ax, 1 0 00003AA6 7517 jne _.L60 259:initdisk.c **** { 446 .loc 1 259 0 0 00003AA8 8A5401 mov dl, byte ptr [si+1] 0 00003AAB 80FA02 cmp dl, 2 0 00003AAE 7413 je _.L61 0 00003AB0 80FA03 cmp dl, 3 0 00003AB3 7503 jne _.L56 264:initdisk.c **** } 452 .loc 1 264 0 0 00003AB5 B80100 mov ax, 1 454 _.L56: 267:initdisk.c **** 455 .loc 1 267 0 0 00003AB8 89EC mov sp, bp 0 00003ABA 5D pop bp 0 00003ABB 5E pop si 0 00003ABC C20200 ret 2 460 _.L60: 266:initdisk.c **** } 461 .loc 1 266 0 0 00003ABF 31C0 xor ax, ax 0 00003AC1 EBF5 jmp _.L56 464 _.L61: 262:initdisk.c **** case 3: 465 .loc 1 262 0 0 00003AC3 B80200 mov ax, 2 0 00003AC6 EBF0 jmp _.L56 468 _.LFE4: 469 .size _init_readdasd, .-_init_readdasd 470 .global _init_getdriveparm 471 .type _init_getdriveparm, @function 472 _init_getdriveparm: 473 _.LFB5: 292:initdisk.c **** static iregs regs; 474 .loc 1 292 0 475 _.LVL24: 0 00003AC8 56 push si 0 00003AC9 57 push di 0 00003ACA 55 push bp 479 _.LCFI6: 0 00003ACB 89E5 mov bp, sp 481 _.LCFI7: 0 00003ACD 1E push ds 0 00003ACE 8A4608 mov al, byte ptr [bp+8] 0 00003AD1 8B760A mov si, word ptr [bp+10] 296:initdisk.c **** return 5; 485 .loc 1 296 0 0 00003AD4 84C0 test al, al 0 00003AD6 7C78 jl _.L67 488 _.LVL25: 489 _.LBB4: 490 _.LBB5: 298:initdisk.c **** regs.d.b.l = drive; 491 .loc 1 298 0 0 00003AD8 BF[1C02] mov di, offset _regs.1907 0 00003ADB C606[1D02]08 mov byte ptr [_regs.1907+1], 8 299:initdisk.c **** init_call_intr(0x13, ®s); 494 .loc 1 299 0 0 00003AE0 884506 mov byte ptr [di+6], al 300:initdisk.c **** type = regs.b.b.l - 1; 496 .loc 1 300 0 0 00003AE3 57 push di 0 00003AE4 B81300 mov ax, 19 499 _.LVL26: 0 00003AE7 50 push ax 0 00003AE8 E8[FEFF] call _init_call_intr 502 _.LVL27: 301:initdisk.c **** if (regs.flags & 1) 503 .loc 1 301 0 0 00003AEB 8A6502 mov ah, byte ptr [di+2] 505 _.LVL28: 303:initdisk.c **** else if (type > 6) 506 .loc 1 303 0 0 00003AEE 30C0 xor al, al 302:initdisk.c **** type = 0; /* return 320-360 for XTs */ 508 .loc 1 302 0 0 00003AF0 F6451601 test byte ptr [di+22], 1 0 00003AF4 750E jne _.L66 301:initdisk.c **** if (regs.flags & 1) 511 .loc 1 301 0 0 00003AF6 88E0 mov al, ah 0 00003AF8 FEC8 dec al 514 _.LVL29: 304:initdisk.c **** type = 8; /* any odd ball drives get 8&7=0: the 320-360 table */ 515 .loc 1 304 0 0 00003AFA 3C06 cmp al, 6 0 00003AFC 774E ja _.L69 306:initdisk.c **** type = 4; /* 5 and 4 are both 2.88 MB */ 518 .loc 1 306 0 0 00003AFE 3C05 cmp al, 5 0 00003B00 7502 jne _.L66 307:initdisk.c **** 521 .loc 1 307 0 0 00003B02 B004 mov al, 4 523 _.LVL30: 524 _.L66: 309:initdisk.c **** ((bpb *)pbpbarray)->bpb_hidden = 0; /* very important to init to 0, see bug#1789 */ 525 .loc 1 309 0 0 00003B04 BA1100 mov dx, 17 0 00003B07 52 push dx 0 00003B08 88C4 mov ah, al 0 00003B0A 8846FF mov byte ptr [bp-1], al 0 00003B0D 80E407 and ah, 7 0 00003B10 88E2 mov dl, ah 0 00003B12 30F6 xor dh, dh 0 00003B14 B81100 mov ax, 17 534 _.LVL31: 0 00003B17 F7E2 mul dx 0 00003B19 92 xchg dx, ax 0 00003B1A 81C2[0000] add dx, offset _floppy_bpbs 0 00003B1E 52 push dx 0 00003B1F 56 push si 0 00003B20 E8[FEFF] call _init_memcpy 541 _.LVL32: 310:initdisk.c **** ((bpb *)pbpbarray)->bpb_huge = 0; 542 .loc 1 310 0 0 00003B23 C744110000 mov word ptr [si+17], 0 0 00003B28 C744130000 mov word ptr [si+19], 0 311:initdisk.c **** 545 .loc 1 311 0 0 00003B2D C744150000 mov word ptr [si+21], 0 0 00003B32 C744170000 mov word ptr [si+23], 0 313:initdisk.c **** return 7; /* 1.44 MB */ 548 .loc 1 313 0 0 00003B37 8A46FF mov al, byte ptr [bp-1] 0 00003B3A 3C03 cmp al, 3 0 00003B3C 7417 je _.L70 552 _.LVL33: 316:initdisk.c **** return 9; /* 2.88 almost forgot this one */ 553 .loc 1 316 0 0 00003B3E 3C04 cmp al, 4 0 00003B40 7418 je _.L71 309:initdisk.c **** ((bpb *)pbpbarray)->bpb_hidden = 0; /* very important to init to 0, see bug#1789 */ 556 .loc 1 309 0 0 00003B42 30E4 xor ah, ah 558 _.LVL34: 559 _.L64: 560 _.LBE5: 561 _.LBE4: 321:initdisk.c **** 562 .loc 1 321 0 0 00003B44 89EC mov sp, bp 0 00003B46 5D pop bp 0 00003B47 5F pop di 0 00003B48 5E pop si 0 00003B49 C20400 ret 4 568 _.LVL35: 569 _.L69: 570 _.LBB8: 571 _.LBB6: 305:initdisk.c **** else if (type == 5) 572 .loc 1 305 0 0 00003B4C B008 mov al, 8 574 _.LVL36: 0 00003B4E EBB4 jmp _.L66 576 _.LVL37: 577 _.L67: 578 _.LBE6: 579 _.LBE8: 297:initdisk.c **** regs.a.b.h = 0x08; 580 .loc 1 297 0 0 00003B50 B80500 mov ax, 5 0 00003B53 EBEF jmp _.L64 583 _.LVL38: 584 _.L70: 585 _.LBB9: 586 _.LBB7: 314:initdisk.c **** 587 .loc 1 314 0 0 00003B55 B80700 mov ax, 7 0 00003B58 EBEA jmp _.L64 590 _.LVL39: 591 _.L71: 317:initdisk.c **** 592 .loc 1 317 0 0 00003B5A B80900 mov ax, 9 594 _.LVL40: 0 00003B5D EBE5 jmp _.L64 596 _.LBE7: 597 _.LBE9: 598 _.LFE5: 599 .size _init_getdriveparm, .-_init_getdriveparm 600 .type _make_ddt, @function 601 _make_ddt: 602 _.LFB21: 787:initdisk.c **** 788:initdisk.c **** /* 789:initdisk.c **** converts physical into logical representation of partition entry 790:initdisk.c **** */ 791:initdisk.c **** 792:initdisk.c **** STATIC void ConvCHSToIntern(struct CHS *chs, UBYTE * pDisk) 793:initdisk.c **** { 794:initdisk.c **** chs->Head = pDisk[0]; 795:initdisk.c **** chs->Sector = pDisk[1] & 0x3f; 796:initdisk.c **** chs->Cylinder = pDisk[2] + ((pDisk[1] & 0xc0) << 2); 797:initdisk.c **** } 798:initdisk.c **** 799:initdisk.c **** BOOL ConvPartTableEntryToIntern(struct PartTableEntry * pEntry, 800:initdisk.c **** UBYTE * pDisk) 801:initdisk.c **** { 802:initdisk.c **** int i; 803:initdisk.c **** 804:initdisk.c **** if (pDisk[0x1fe] != 0x55 || pDisk[0x1ff] != 0xaa) 805:initdisk.c **** { 806:initdisk.c **** memset(pEntry, 0, 4 * sizeof(struct PartTableEntry)); 807:initdisk.c **** 808:initdisk.c **** return FALSE; 809:initdisk.c **** } 810:initdisk.c **** 811:initdisk.c **** pDisk += 0x1be; 812:initdisk.c **** 813:initdisk.c **** for (i = 0; i < 4; i++, pDisk += 16, pEntry++) 814:initdisk.c **** { 815:initdisk.c **** 816:initdisk.c **** pEntry->Bootable = pDisk[0]; 817:initdisk.c **** pEntry->FileSystem = pDisk[4]; 818:initdisk.c **** 819:initdisk.c **** ConvCHSToIntern(&pEntry->Begin, pDisk+1); 820:initdisk.c **** ConvCHSToIntern(&pEntry->End, pDisk+5); 821:initdisk.c **** 822:initdisk.c **** pEntry->RelSect = *(ULONG *) (pDisk + 8); 823:initdisk.c **** pEntry->NumSect = *(ULONG *) (pDisk + 12); 824:initdisk.c **** } 825:initdisk.c **** return TRUE; 826:initdisk.c **** } 827:initdisk.c **** 828:initdisk.c **** BOOL is_suspect(struct CHS *chs, struct CHS *pEntry_chs) 829:initdisk.c **** { 830:initdisk.c **** /* Valid entry: 831:initdisk.c **** entry == chs || // partition entry equal to computed values 832:initdisk.c **** (chs->Cylinder > 1023 && // or LBA partition 833:initdisk.c **** (entry->Cylinder == 1023 || 834:initdisk.c **** entry->Cylinder == (0x3FF & chs->Cylinder))) 835:initdisk.c **** */ 836:initdisk.c **** return !((pEntry_chs->Cylinder == chs->Cylinder && 837:initdisk.c **** pEntry_chs->Head == chs->Head && 838:initdisk.c **** pEntry_chs->Sector == chs->Sector) || 839:initdisk.c **** chs->Cylinder > 1023u && 840:initdisk.c **** (pEntry_chs->Cylinder == 1023 || 841:initdisk.c **** pEntry_chs->Cylinder == (0x3ff & chs->Cylinder))); 842:initdisk.c **** } 843:initdisk.c **** 844:initdisk.c **** void print_warning_suspect(char *partitionName, UBYTE fs, struct CHS *chs, 845:initdisk.c **** struct CHS *pEntry_chs) 846:initdisk.c **** { 847:initdisk.c **** if (!InitKernelConfig.ForceLBA) 848:initdisk.c **** { 849:initdisk.c **** if (InitKernelConfig.Verbose >= 0) 850:initdisk.c **** { 851:initdisk.c **** printf("WARNING: using suspect partition %s FS %02x:", partitionName, fs); 852:initdisk.c **** printCHS(" with calculated values ", chs); 853:initdisk.c **** printCHS(" instead of ", pEntry_chs); 854:initdisk.c **** printf("\n"); 855:initdisk.c **** } 856:initdisk.c **** } 857:initdisk.c **** memcpy(pEntry_chs, chs, sizeof(struct CHS)); 858:initdisk.c **** } 859:initdisk.c **** 860:initdisk.c **** BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type, 861:initdisk.c **** struct PartTableEntry * pEntry, ULONG startSector, 862:initdisk.c **** int partitionsToIgnore, int extendedPartNo) 863:initdisk.c **** { 864:initdisk.c **** int i; 865:initdisk.c **** struct CHS chs, end; 866:initdisk.c **** ULONG partitionStart; 867:initdisk.c **** char partitionName[12]; 868:initdisk.c **** 869:initdisk.c **** for (i = 0; i < 4; i++, pEntry++) 870:initdisk.c **** { 871:initdisk.c **** if (pEntry->FileSystem == 0) 872:initdisk.c **** continue; 873:initdisk.c **** 874:initdisk.c **** if (partitionsToIgnore & (1 << i)) 875:initdisk.c **** continue; 876:initdisk.c **** 877:initdisk.c **** if (IsExtPartition(pEntry->FileSystem)) 878:initdisk.c **** continue; 879:initdisk.c **** 880:initdisk.c **** if (scan_type == SCAN_PRIMARYBOOT && !pEntry->Bootable) 881:initdisk.c **** continue; 882:initdisk.c **** 883:initdisk.c **** partitionStart = startSector + pEntry->RelSect; 884:initdisk.c **** 885:initdisk.c **** if (!IsFATPartition(pEntry->FileSystem)) 886:initdisk.c **** { 887:initdisk.c **** continue; 888:initdisk.c **** } 889:initdisk.c **** 890:initdisk.c **** if (extendedPartNo) 891:initdisk.c **** sprintf(partitionName, "Ext:%d", extendedPartNo); 892:initdisk.c **** else 893:initdisk.c **** sprintf(partitionName, "Pri:%d", i + 1); 894:initdisk.c **** 895:initdisk.c **** /* 896:initdisk.c **** some sanity checks, that partition 897:initdisk.c **** structure is OK 898:initdisk.c **** */ 899:initdisk.c **** LBA_to_CHS(&chs, partitionStart, driveParam); 900:initdisk.c **** LBA_to_CHS(&end, partitionStart + pEntry->NumSect - 1, driveParam); 901:initdisk.c **** 902:initdisk.c **** /* some FDISKs enter for partitions 903:initdisk.c **** > 8 GB cyl = 1023, other (cyl&1023) 904:initdisk.c **** */ 905:initdisk.c **** 906:initdisk.c **** if (is_suspect(&chs, &pEntry->Begin)) 907:initdisk.c **** { 908:initdisk.c **** print_warning_suspect(partitionName, pEntry->FileSystem, &chs, 909:initdisk.c **** &pEntry->Begin); 910:initdisk.c **** } 911:initdisk.c **** 912:initdisk.c **** if (is_suspect(&end, &pEntry->End)) 913:initdisk.c **** { 914:initdisk.c **** if (pEntry->NumSect == 0) 915:initdisk.c **** { 916:initdisk.c **** printf("Not using partition %s with 0 sectors\n", partitionName); 917:initdisk.c **** continue; 918:initdisk.c **** } 919:initdisk.c **** print_warning_suspect(partitionName, pEntry->FileSystem, &end, 920:initdisk.c **** &pEntry->End); 921:initdisk.c **** } 922:initdisk.c **** 923:initdisk.c **** if (chs.Cylinder > 1023 || end.Cylinder > 1023) 924:initdisk.c **** { 925:initdisk.c **** 926:initdisk.c **** /* if partition exceeds bounds of CHS addressing but LBA is not supported then skip partition 927:initdisk.c **** if (!(driveParam->descflags & DF_LBA)) 928:initdisk.c **** { 929:initdisk.c **** printf 930:initdisk.c **** ("can't use LBA partition without LBA support - part %s FS %02x", 931:initdisk.c **** partitionName, pEntry->FileSystem); 932:initdisk.c **** 933:initdisk.c **** printCHS(" start ", &chs); 934:initdisk.c **** printCHS(", end ", &end); 935:initdisk.c **** printf("\n"); 936:initdisk.c **** 937:initdisk.c **** continue; 938:initdisk.c **** } 939:initdisk.c **** 940:initdisk.c **** /* if partition exceeds bounds of CHS addressing and we can use LBA 941:initdisk.c **** but partition type indicates to use CHS then print warning 942:initdisk.c **** and force internal filesystem indicator to enable LBA 943:initdisk.c **** */ 944:initdisk.c **** if (!(InitKernelConfig.ForceLBA || IsLBAPartition(pEntry->FileSystem) || ExtLBAForce)) 945:initdisk.c **** { 946:initdisk.c **** printf 947:initdisk.c **** ("WARNING: Partition ID does not suggest LBA - part %s FS %02x.\n" 948:initdisk.c **** "Please run FDISK to correct this - using LBA to access partition.\n", 949:initdisk.c **** partitionName, pEntry->FileSystem); 950:initdisk.c **** 951:initdisk.c **** printCHS(" start ", &chs); 952:initdisk.c **** printCHS(", end ", &end); 953:initdisk.c **** printf("\n"); 954:initdisk.c **** pEntry->FileSystem = (pEntry->FileSystem == FAT12 ? FAT12_LBA : 955:initdisk.c **** pEntry->FileSystem == FAT32 ? FAT32_LBA : 956:initdisk.c **** /* pEntry->FileSystem == FAT16 ? */ 957:initdisk.c **** FAT16_LBA); 958:initdisk.c **** } 959:initdisk.c **** 960:initdisk.c **** /* else its a diagnostic message only */ 961:initdisk.c **** #ifdef DEBUG 962:initdisk.c **** printf("found and using LBA partition %s FS %02x", 963:initdisk.c **** partitionName, pEntry->FileSystem); 964:initdisk.c **** printCHS(" start ", &chs); 965:initdisk.c **** printCHS(", end ", &end); 966:initdisk.c **** printf("\n"); 967:initdisk.c **** #endif 968:initdisk.c **** } 969:initdisk.c **** 970:initdisk.c **** /* 971:initdisk.c **** here we have a partition table in our hand !! 972:initdisk.c **** */ 973:initdisk.c **** 974:initdisk.c **** partitionsToIgnore |= 1 << i; 975:initdisk.c **** 976:initdisk.c **** DosDefinePartition(driveParam, partitionStart, pEntry, 977:initdisk.c **** extendedPartNo, i); 978:initdisk.c **** 979:initdisk.c **** if (scan_type == SCAN_PRIMARYBOOT || scan_type == SCAN_PRIMARY) 980:initdisk.c **** { 981:initdisk.c **** return partitionsToIgnore; 982:initdisk.c **** } 983:initdisk.c **** } 984:initdisk.c **** 985:initdisk.c **** return partitionsToIgnore; 986:initdisk.c **** } 987:initdisk.c **** 988:initdisk.c **** void BIOS_drive_reset(unsigned drive); 989:initdisk.c **** 990:initdisk.c **** int Read1LBASector(struct DriveParamS *driveParam, unsigned drive, 991:initdisk.c **** ULONG LBA_address, void * buffer) 992:initdisk.c **** { 993:initdisk.c **** static struct _bios_LBA_address_packet dap = { 994:initdisk.c **** 16, 0, 0, 0, 0, 0, 0 995:initdisk.c **** }; 996:initdisk.c **** 997:initdisk.c **** struct CHS chs; 998:initdisk.c **** iregs regs; 999:initdisk.c **** int num_retries; 1000:initdisk.c **** 1001:initdisk.c **** /* disabled because this should not happen and if it happens the BIOS 1002:initdisk.c **** should complain; also there are weird disks around with 1003:initdisk.c **** CMOS geometry < real geometry */ 1004:initdisk.c **** #if 0 1005:initdisk.c **** if (LBA_address >= driveParam->total_sectors) 1006:initdisk.c **** { 1007:initdisk.c **** printf("LBA-Transfer error : address overflow = %lu, > %lu total sectors\n", 1008:initdisk.c **** LBA_address, driveParam->total_sectors); 1009:initdisk.c **** return 1; 1010:initdisk.c **** } 1011:initdisk.c **** #endif 1012:initdisk.c **** 1013:initdisk.c **** for (num_retries = 0; num_retries < N_RETRY; num_retries++) 1014:initdisk.c **** { 1015:initdisk.c **** if (InitKernelConfig.Verbose >= 1) 1016:initdisk.c **** { 1017:initdisk.c **** printf("retry# %i sector %lu\n", num_retries, LBA_address); 1018:initdisk.c **** } 1019:initdisk.c **** 1020:initdisk.c **** regs.d.b.l = drive | 0x80; 1021:initdisk.c **** LBA_to_CHS(&chs, LBA_address, driveParam); 1022:initdisk.c **** /* Some old "security" software (PROT) traps int13 and assumes non 1023:initdisk.c **** LBA accesses. This statement causes partition tables to be read 1024:initdisk.c **** using CHS methods even if LBA is available unless CHS can't reach 1025:initdisk.c **** them. This can be overridden using kernel config parameters and 1026:initdisk.c **** the extended LBA partition type indicator. 1027:initdisk.c **** */ 1028:initdisk.c **** if ((driveParam->descflags & DF_LBA) && 1029:initdisk.c **** (InitKernelConfig.ForceLBA || ExtLBAForce || (chs.Cylinder > 1023))) 1030:initdisk.c **** { 1031:initdisk.c **** if (InitKernelConfig.Verbose >= 1) printf("LBA mode\n"); 1032:initdisk.c **** dap.number_of_blocks = 1; 1033:initdisk.c **** dap.buffer_address = buffer; 1034:initdisk.c **** dap.block_address_high = 0; /* clear high part */ 1035:initdisk.c **** dap.block_address = LBA_address; /* clear high part */ 1036:initdisk.c **** 1037:initdisk.c **** /* Load the registers and call the interrupt. */ 1038:initdisk.c **** regs.a.x = LBA_READ; 1039:initdisk.c **** regs.si = FP_OFF(&dap); 1040:initdisk.c **** regs.ds = FP_SEG(&dap); 1041:initdisk.c **** } 1042:initdisk.c **** else 1043:initdisk.c **** { /* transfer data, using old bios functions */ 1044:initdisk.c **** if (InitKernelConfig.Verbose >= 1) printf("CHS mode\n"); 1045:initdisk.c **** /* avoid overflow at end of track */ 1046:initdisk.c **** 1047:initdisk.c **** if (chs.Cylinder > 1023) 1048:initdisk.c **** { 1049:initdisk.c **** printf("LBA-Transfer error : address = %lu, cylinder %u > 1023\n", LBA_address, chs.Cylinde 1050:initdisk.c **** return 1; 1051:initdisk.c **** } 1052:initdisk.c **** 1053:initdisk.c **** regs.a.x = 0x0201; 1054:initdisk.c **** regs.b.x = FP_OFF(buffer); 1055:initdisk.c **** regs.c.x = 1056:initdisk.c **** ((chs.Cylinder & 0xff) << 8) + ((chs.Cylinder & 0x300) >> 2) + 1057:initdisk.c **** chs.Sector; 1058:initdisk.c **** regs.d.b.h = chs.Head; 1059:initdisk.c **** regs.es = FP_SEG(buffer); 1060:initdisk.c **** } /* end of retries */ 1061:initdisk.c **** init_call_intr(0x13, ®s); 1062:initdisk.c **** if ((regs.flags & FLG_CARRY) == 0) 1063:initdisk.c **** break; 1064:initdisk.c **** BIOS_drive_reset(driveParam->driveno); 1065:initdisk.c **** } 1066:initdisk.c **** 1067:initdisk.c **** return regs.flags & FLG_CARRY ? 1 : 0; 1068:initdisk.c **** } 1069:initdisk.c **** 1070:initdisk.c **** /* Load the Partition Tables and get information on all drives */ 1071:initdisk.c **** int ProcessDisk(int scanType, unsigned drive, int PartitionsToIgnore) 1072:initdisk.c **** { 1073:initdisk.c **** /* note: error messages are only printed on first call, where (scanType==SCAN_PRIMARYBOOT) */ 1074:initdisk.c **** 1075:initdisk.c **** struct PartTableEntry PTable[4]; 1076:initdisk.c **** ULONG RelSectorOffset; 1077:initdisk.c **** ULONG ExtendedPartitionOffset; 1078:initdisk.c **** int iPart; 1079:initdisk.c **** int strangeHardwareLoop; 1080:initdisk.c **** 1081:initdisk.c **** int num_extended_found = 0; 1082:initdisk.c **** 1083:initdisk.c **** struct DriveParamS driveParam; 1084:initdisk.c **** 1085:initdisk.c **** /* Get the hard drive parameters and ensure that the drive exists. */ 1086:initdisk.c **** /* If there was an error accessing the drive, skip that drive. */ 1087:initdisk.c **** 1088:initdisk.c **** if (!LBA_Get_Drive_Parameters(drive, &driveParam,(scanType==SCAN_PRIMARYBOOT))) 1089:initdisk.c **** { 1090:initdisk.c **** printf("can't get drive parameters for drive %02x\n", drive); 1091:initdisk.c **** return PartitionsToIgnore; 1092:initdisk.c **** } 1093:initdisk.c **** 1094:initdisk.c **** RelSectorOffset = 0; /* boot sector */ 1095:initdisk.c **** ExtendedPartitionOffset = 0; /* not found yet */ 1096:initdisk.c **** ExtLBAForce = 0; /* initially we are not dealing with partitions 1097:initdisk.c **** within a type 0x0E LBA extended partition, 1098:initdisk.c **** so we do not enforce LBA access by now */ 1099:initdisk.c **** 1100:initdisk.c **** /* Read the Primary Partition Table. */ 1101:initdisk.c **** 1102:initdisk.c **** ReadNextPartitionTable: 1103:initdisk.c **** 1104:initdisk.c **** strangeHardwareLoop = 0; 1105:initdisk.c **** strange_restart: 1106:initdisk.c **** 1107:initdisk.c **** if (Read1LBASector 1108:initdisk.c **** (&driveParam, drive, RelSectorOffset, InitDiskTransferBuffer)) 1109:initdisk.c **** { 1110:initdisk.c **** printf("Error reading partition table drive %02Xh sector %lu", drive, 1111:initdisk.c **** RelSectorOffset); 1112:initdisk.c **** return PartitionsToIgnore; 1113:initdisk.c **** } 1114:initdisk.c **** 1115:initdisk.c **** if (!ConvPartTableEntryToIntern(PTable, InitDiskTransferBuffer)) 1116:initdisk.c **** { 1117:initdisk.c **** /* there is some strange hardware out in the world, 1118:initdisk.c **** which returns OK on first read, but the data are 1119:initdisk.c **** rubbish. simply retrying works fine. 1120:initdisk.c **** there is no logic behind this, but it works TE */ 1121:initdisk.c **** 1122:initdisk.c **** if (++strangeHardwareLoop < 3) 1123:initdisk.c **** goto strange_restart; 1124:initdisk.c **** 1125:initdisk.c **** if (scanType==SCAN_PRIMARYBOOT) printf("illegal partition table - drive %02x sector %lu\n", dri 1126:initdisk.c **** RelSectorOffset); 1127:initdisk.c **** return PartitionsToIgnore; 1128:initdisk.c **** } 1129:initdisk.c **** 1130:initdisk.c **** if (scanType == SCAN_PRIMARYBOOT || 1131:initdisk.c **** scanType == SCAN_PRIMARY || 1132:initdisk.c **** scanType == SCAN_PRIMARY2 || num_extended_found != 0) 1133:initdisk.c **** { 1134:initdisk.c **** 1135:initdisk.c **** PartitionsToIgnore = ScanForPrimaryPartitions(&driveParam, scanType, 1136:initdisk.c **** PTable, RelSectorOffset, 1137:initdisk.c **** PartitionsToIgnore, 1138:initdisk.c **** num_extended_found); 1139:initdisk.c **** } 1140:initdisk.c **** 1141:initdisk.c **** if (scanType != SCAN_EXTENDED) 1142:initdisk.c **** { 1143:initdisk.c **** return PartitionsToIgnore; 1144:initdisk.c **** } 1145:initdisk.c **** 1146:initdisk.c **** /* scan for extended partitions now */ 1147:initdisk.c **** PartitionsToIgnore = 0; 1148:initdisk.c **** 1149:initdisk.c **** for (iPart = 0; iPart < 4; iPart++) 1150:initdisk.c **** { 1151:initdisk.c **** if (IsExtPartition(PTable[iPart].FileSystem)) 1152:initdisk.c **** { 1153:initdisk.c **** RelSectorOffset = ExtendedPartitionOffset + PTable[iPart].RelSect; 1154:initdisk.c **** 1155:initdisk.c **** if (ExtendedPartitionOffset == 0) /* first extended in chain? */ 1156:initdisk.c **** { 1157:initdisk.c **** ExtendedPartitionOffset = PTable[iPart].RelSect; 1158:initdisk.c **** /* grand parent LBA -> all children and grandchildren LBA */ 1159:initdisk.c **** ExtLBAForce = (PTable[iPart].FileSystem == EXTENDED_LBA); 1160:initdisk.c **** } 1161:initdisk.c **** 1162:initdisk.c **** num_extended_found++; 1163:initdisk.c **** 1164:initdisk.c **** if (num_extended_found > 30) 1165:initdisk.c **** { 1166:initdisk.c **** printf("found more then 30 extended partitions, terminated\n"); 1167:initdisk.c **** return 0; 1168:initdisk.c **** } 1169:initdisk.c **** 1170:initdisk.c **** goto ReadNextPartitionTable; 1171:initdisk.c **** } 1172:initdisk.c **** } 1173:initdisk.c **** 1174:initdisk.c **** return PartitionsToIgnore; 1175:initdisk.c **** } 1176:initdisk.c **** 1177:initdisk.c **** int BIOS_nrdrives(void) 1178:initdisk.c **** { 1179:initdisk.c **** iregs regs; 1180:initdisk.c **** 1181:initdisk.c **** regs.a.b.h = 0x08; 1182:initdisk.c **** regs.d.b.l = 0x80; 1183:initdisk.c **** init_call_intr(0x13, ®s); 1184:initdisk.c **** 1185:initdisk.c **** if (regs.flags & 1) 1186:initdisk.c **** { 1187:initdisk.c **** printf("no hard disks detected\n"); 1188:initdisk.c **** return 0; 1189:initdisk.c **** } 1190:initdisk.c **** 1191:initdisk.c **** return regs.d.b.l; 1192:initdisk.c **** } 1193:initdisk.c **** 1194:initdisk.c **** void BIOS_drive_reset(unsigned drive) 1195:initdisk.c **** { 1196:initdisk.c **** iregs regs; 1197:initdisk.c **** 1198:initdisk.c **** regs.d.b.l = drive | 0x80; 1199:initdisk.c **** regs.a.b.h = 0; 1200:initdisk.c **** 1201:initdisk.c **** init_call_intr(0x13, ®s); 1202:initdisk.c **** } 1203:initdisk.c **** 1204:initdisk.c **** /* 1205:initdisk.c **** thats what MSDN says: 1206:initdisk.c **** 1207:initdisk.c **** How Windows 2000 Assigns, Reserves, and Stores Drive Letters 1208:initdisk.c **** ID: q234048 1209:initdisk.c **** 1210:initdisk.c **** BASIC Disk - Drive Letter Assignment Rules 1211:initdisk.c **** The following are the basic disk drive letter assignment rules for Windows 2000: 1212:initdisk.c **** Scan all fixed hard disks as they are enumerated, assign drive letters 1213:initdisk.c **** starting with any active primary partitions (if there is one), otherwise, 1214:initdisk.c **** scan the first primary partition on each drive. Assign next available 1215:initdisk.c **** letter starting with C: 1216:initdisk.c **** 1217:initdisk.c **** Repeat scan for all fixed hard disks and removable (JAZ, MO) disks 1218:initdisk.c **** and assign drive letters to all logical drives in an extended partition, 1219:initdisk.c **** or the removable disk(s) as enumerated. Assign next available letter 1220:initdisk.c **** starting with C: 1221:initdisk.c **** 1222:initdisk.c **** Finally, repeat scan for all fixed hard disk drives, and assign drive 1223:initdisk.c **** letters to all remaining primary partitions. Assign next available letter 1224:initdisk.c **** starting with C: 1225:initdisk.c **** 1226:initdisk.c **** Floppy drives. Assign letter starting with A: 1227:initdisk.c **** 1228:initdisk.c **** CD-ROM drives. Assign next available letter starting with D: 1229:initdisk.c **** 1230:initdisk.c **** ************************************************************************* 1231:initdisk.c **** Order in Which MS-DOS and Windows Assign Drive Letters 1232:initdisk.c **** ID: q51978 1233:initdisk.c **** 1234:initdisk.c **** MORE INFORMATION 1235:initdisk.c **** The following occurs at startup: 1236:initdisk.c **** 1237:initdisk.c **** MS-DOS checks all installed disk devices, assigning the drive letter A 1238:initdisk.c **** to the first physical floppy disk drive that is found. 1239:initdisk.c **** 1240:initdisk.c **** If a second physical floppy disk drive is present, it is assigned drive letter B. If it is not pres 1241:initdisk.c **** 1242:initdisk.c **** Regardless of whether a second floppy disk drive is present, 1243:initdisk.c **** MS-DOS then assigns the drive letter C to the primary MS-DOS 1244:initdisk.c **** partition on the first physical hard disk, and then goes on 1245:initdisk.c **** to check for a second hard disk. 1246:initdisk.c **** 1247:initdisk.c **** If a second physical hard disk is found, and a primary partition exists 1248:initdisk.c **** on the second physical drive, the primary MS-DOS partition on the second 1249:initdisk.c **** physical hard drive is assigned the letter D. MS-DOS version 5.0, which 1250:initdisk.c **** supports up to eight physical drives, will continue to search for more 1251:initdisk.c **** physical hard disk drives at this point. For example, if a third physical 1252:initdisk.c **** hard disk is found, and a primary partition exists on the third physical 1253:initdisk.c **** drive, the primary MS-DOS partition on the third physical hard drive is 1254:initdisk.c **** assigned the letter E. 1255:initdisk.c **** 1256:initdisk.c **** MS-DOS returns to the first physical hard disk drive and assigns drive 1257:initdisk.c **** letters to any additional logical drives (in extended MS-DOS partitions) 1258:initdisk.c **** on that drive in sequence. 1259:initdisk.c **** 1260:initdisk.c **** MS-DOS repeats this process for the second physical hard disk drive, 1261:initdisk.c **** if present. MS-DOS 5.0 will repeat this process for up to eight physical 1262:initdisk.c **** hard drives, if present. After all logical drives (in extended MS-DOS 1263:initdisk.c **** partitions) have been assigned drive letters, MS-DOS 5.0 returns to 1264:initdisk.c **** the first physical drive and assigns drive letters to any other primary 1265:initdisk.c **** MS-DOS partitions that exist, then searches other physical drives for 1266:initdisk.c **** additional primary MS-DOS partitions. This support for multiple primary 1267:initdisk.c **** MS-DOS partitions was added to version 5.0 for backward compatibility 1268:initdisk.c **** with the previous OEM MS-DOS versions that support multiple primary partitions. 1269:initdisk.c **** 1270:initdisk.c **** After all logical drives on the hard disk(s) have been assigned drive 1271:initdisk.c **** letters, drive letters are assigned to drives installed using DRIVER.SYS 1272:initdisk.c **** or created using RAMDRIVE.SYS in the order in which the drivers are loaded 1273:initdisk.c **** in the CONFIG.SYS file. Which drive letters are assigned to which devices 1274:initdisk.c **** can be influenced by changing the order of the device drivers or, if necessary, 1275:initdisk.c **** by creating "dummy" drive letters with DRIVER.SYS. 1276:initdisk.c **** 1277:initdisk.c **** ******************************************************** 1278:initdisk.c **** 1279:initdisk.c **** or 1280:initdisk.c **** 1281:initdisk.c **** as rather well documented, DOS searches 1st) 1 primary patitions on 1282:initdisk.c **** all drives, 2nd) all extended partitions. that 1283:initdisk.c **** makes many people (including me) unhappy, as all DRIVES D:,E:... 1284:initdisk.c **** on 1st disk will move up/down, if other disk with 1285:initdisk.c **** primary partitions are added/removed, but 1286:initdisk.c **** thats the way it is (hope I got it right) 1287:initdisk.c **** TE (with a little help from my friends) 1288:initdisk.c **** see also above for WIN2000,DOS,MSDN 1289:initdisk.c **** 1290:initdisk.c **** I don't know, if I did it right, but I tried to do it that way. TE 1291:initdisk.c **** 1292:initdisk.c **** ***********************************************************************/ 1293:initdisk.c **** 1294:initdisk.c **** STATIC void make_ddt (ddt *pddt, int Unit, int driveno, int flags) 1295:initdisk.c **** { 603 .loc 1 1295 0 604 _.LVL41: 0 00003B5F 56 push si 0 00003B60 57 push di 0 00003B61 55 push bp 608 _.LCFI8: 0 00003B62 89E5 mov bp, sp 610 _.LCFI9: 0 00003B64 1E push ds 0 00003B65 8B7E08 mov di, word ptr [bp+8] 0 00003B68 8B560C mov dx, word ptr [bp+12] 1296:initdisk.c **** pddt->ddt_next = MK_FP(0, 0xffff); 614 .loc 1 1296 0 0 00003B6B C705FFFF mov word ptr [di], -1 0 00003B6F C745020000 mov word ptr [di+2], 0 1297:initdisk.c **** pddt->ddt_logdriveno = Unit; 617 .loc 1 1297 0 0 00003B74 8B460A mov ax, word ptr [bp+10] 0 00003B77 884505 mov byte ptr [di+5], al 1298:initdisk.c **** pddt->ddt_driveno = driveno; 620 .loc 1 1298 0 0 00003B7A 8856FF mov byte ptr [bp-1], dl 0 00003B7D 885504 mov byte ptr [di+4], dl 1299:initdisk.c **** pddt->ddt_type = init_getdriveparm(driveno, &pddt->ddt_defbpb); 623 .loc 1 1299 0 0 00003B80 8D7537 lea si, [55+di] 0 00003B83 56 push si 0 00003B84 52 push dx 0 00003B85 E8[FEFF] call _init_getdriveparm 628 _.LVL42: 0 00003B88 884532 mov byte ptr [di+50], al 1300:initdisk.c **** pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40; 630 .loc 1 1300 0 0 00003B8B A807 test al, 7 0 00003B8D 7540 jne _.L75 0 00003B8F B82800 mov ax, 40 634 _.L74: 635 .loc 1 1300 0 is_stmt 0 discriminator 4 0 00003B92 894535 mov word ptr [di+53], ax 1301:initdisk.c **** pddt->ddt_descflags = init_readdasd(driveno) | flags; 637 .loc 1 1301 0 is_stmt 1 discriminator 4 0 00003B95 FF76FF push word ptr [bp-1] 0 00003B98 E8[FEFF] call _init_readdasd 640 _.LVL43: 0 00003B9B 0B460E or ax, word ptr [bp+14] 0 00003B9E 894533 mov word ptr [di+51], ax 1302:initdisk.c **** 1303:initdisk.c **** pddt->ddt_offset = 0; 643 .loc 1 1303 0 discriminator 4 0 00003BA1 C78584000000 mov word ptr [di+132], 0 0 00003BA7 C78586000000 mov word ptr [di+134], 0 1304:initdisk.c **** pddt->ddt_serialno = 0x12345678l; 646 .loc 1 1304 0 discriminator 4 0 00003BAD C745777856 mov word ptr [di+119], 22136 0 00003BB2 C745793412 mov word ptr [di+121], 4660 1305:initdisk.c **** memcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb)); 649 .loc 1 1305 0 discriminator 4 0 00003BB7 B82900 mov ax, 41 0 00003BBA 50 push ax 0 00003BBB 56 push si 0 00003BBC 8D4506 lea ax, [6+di] 0 00003BBF 50 push ax 0 00003BC0 E8[FEFF] call _init_memcpy 656 _.LVL44: 1306:initdisk.c **** push_ddt(pddt); 657 .loc 1 1306 0 discriminator 4 0 00003BC3 57 push di 0 00003BC4 E8EEFB call _push_ddt 660 _.LVL45: 1307:initdisk.c **** } 661 .loc 1 1307 0 discriminator 4 0 00003BC7 89EC mov sp, bp 0 00003BC9 5D pop bp 0 00003BCA 5F pop di 0 00003BCB 5E pop si 0 00003BCC C20800 ret 8 667 _.L75: 1300:initdisk.c **** pddt->ddt_descflags = init_readdasd(driveno) | flags; 668 .loc 1 1300 0 0 00003BCF B85000 mov ax, 80 0 00003BD2 EBBE jmp _.L74 671 _.LFE21: 672 .size _make_ddt, .-_make_ddt 673 .global _init_LBA_to_CHS 674 .type _init_LBA_to_CHS, @function 675 _init_LBA_to_CHS: 676 _.LFB6: 345:initdisk.c **** unsigned hs = driveparam->chs.Sector * driveparam->chs.Head; 677 .loc 1 345 0 678 _.LVL46: 0 00003BD4 56 push si 0 00003BD5 57 push di 0 00003BD6 55 push bp 682 _.LCFI10: 0 00003BD7 89E5 mov bp, sp 684 _.LCFI11: 0 00003BD9 83EC08 sub sp, 8 0 00003BDC 8B5E0A mov bx, word ptr [bp+10] 0 00003BDF 8B4E0C mov cx, word ptr [bp+12] 0 00003BE2 8B7E0E mov di, word ptr [bp+14] 689 _.LVL47: 346:initdisk.c **** unsigned hsrem = (unsigned)(LBA_address % hs); 690 .loc 1 346 0 0 00003BE5 8B450B mov ax, word ptr [di+11] 0 00003BE8 F76509 mul word ptr [di+9] 693 _.LVL48: 0 00003BEB 8946FC mov word ptr [bp-4], ax 347:initdisk.c **** 695 .loc 1 347 0 0 00003BEE 31F6 xor si, si 0 00003BF0 56 push si 0 00003BF1 50 push ax 0 00003BF2 51 push cx 0 00003BF3 894EF8 mov word ptr [bp-8], cx 0 00003BF6 53 push bx 0 00003BF7 895EFA mov word ptr [bp-6], bx 0 00003BFA E8[FEFF] call ___umodsi3 704 _.LVL49: 0 00003BFD 8946FE mov word ptr [bp-2], ax 706 _.LVL50: 349:initdisk.c **** 707 .loc 1 349 0 0 00003C00 56 push si 0 00003C01 FF76FC push word ptr [bp-4] 0 00003C04 8B4EF8 mov cx, word ptr [bp-8] 0 00003C07 51 push cx 0 00003C08 8B5EFA mov bx, word ptr [bp-6] 0 00003C0B 53 push bx 0 00003C0C E8[FEFF] call ___udivsi3 715 _.LVL51: 351:initdisk.c **** chs->Head = hsrem / driveparam->chs.Sector; 716 .loc 1 351 0 0 00003C0F 39F2 cmp dx, si 0 00003C11 7403 je _.L78 0 00003C13 B8FFFF mov ax, -1 720 _.L78: 0 00003C16 8B5E08 mov bx, word ptr [bp+8] 0 00003C19 8907 mov word ptr [bx], ax 352:initdisk.c **** chs->Sector = hsrem % driveparam->chs.Sector + 1; 723 .loc 1 352 0 0 00003C1B 8B46FE mov ax, word ptr [bp-2] 0 00003C1E 31D2 xor dx, dx 0 00003C20 F7750B div word ptr [di+11] 0 00003C23 894702 mov word ptr [bx+2], ax 353:initdisk.c **** } 728 .loc 1 353 0 0 00003C26 8B46FE mov ax, word ptr [bp-2] 0 00003C29 31D2 xor dx, dx 0 00003C2B F7750B div word ptr [di+11] 0 00003C2E 42 inc dx 0 00003C2F 895704 mov word ptr [bx+4], dx 354:initdisk.c **** 734 .loc 1 354 0 0 00003C32 89EC mov sp, bp 0 00003C34 5D pop bp 0 00003C35 5F pop di 0 00003C36 5E pop si 739 _.LVL52: 0 00003C37 C20800 ret 8 741 _.LFE6: 742 .size _init_LBA_to_CHS, .-_init_LBA_to_CHS === Switch to base=012BB0h -> ".RODATA.STR1.1" 743 .section .rodata.str1.1 744 _.LC8: 0 00000E77 25732534752D2575 .string "%s%4u-%u-%u" 0 00000E7F 2D257500 === Switch to base=002270h -> ".TEXT" 746 .text 747 .global _printCHS 748 .type _printCHS, @function 749 _printCHS: 750 _.LFB7: 357:initdisk.c **** /* has no fixed size for head/sect: is often 1/1 in our context */ 751 .loc 1 357 0 752 _.LVL53: 0 00003C3A 55 push bp 754 _.LCFI12: 0 00003C3B 89E5 mov bp, sp 756 _.LCFI13: 0 00003C3D 8B5E06 mov bx, word ptr [bp+6] 359:initdisk.c **** } 758 .loc 1 359 0 0 00003C40 803E[1500]00 cmp byte ptr [_InitKernelConfig+21], 0 0 00003C45 7815 js _.L81 761 _.LVL54: 762 _.LBB12: 763 _.LBB13: 0 00003C47 FF7704 push word ptr [bx+4] 0 00003C4A FF7702 push word ptr [bx+2] 0 00003C4D FF37 push word ptr [bx] 0 00003C4F FF7604 push word ptr [bp+4] 0 00003C52 B8[4301] mov ax, offset _.LC8 0 00003C55 50 push ax 0 00003C56 E8[FEFF] call _init_printf 771 _.LVL55: 0 00003C59 83C40A add sp, 10 773 _.LVL56: 774 _.L81: 775 _.LBE13: 776 _.LBE12: 360:initdisk.c **** 777 .loc 1 360 0 0 00003C5C 89EC mov sp, bp 0 00003C5E 5D pop bp 0 00003C5F C20400 ret 4 781 _.LFE7: 782 .size _printCHS, .-_printCHS === Switch to base=012BB0h -> ".RODATA.STR1.1" 783 .section .rodata.str1.1 784 _.LC9: 0 00000E83 4641543132202020 .string "FAT12 " 0 00000E8B 00 786 _.LC10: 0 00000E8C 4641543332202020 .string "FAT32 " 0 00000E94 00 788 _.LC11: 0 00000E95 4641543136202020 .string "FAT16 " 0 00000E9D 00 === Switch to base=002270h -> ".TEXT" 790 .text 791 .global _CalculateFATData 792 .type _CalculateFATData, @function 793 _CalculateFATData: 794 _.LFB8: 386:initdisk.c **** ULONG fatdata; 795 .loc 1 386 0 796 _.LVL57: 0 00003C62 56 push si 0 00003C63 57 push di 0 00003C64 55 push bp 800 _.LCFI14: 0 00003C65 89E5 mov bp, sp 802 _.LCFI15: 0 00003C67 83EC12 sub sp, 18 0 00003C6A 8B460A mov ax, word ptr [bp+10] 0 00003C6D 8B560C mov dx, word ptr [bp+12] 0 00003C70 8A4E0E mov cl, byte ptr [bp+14] 807 _.LVL58: 392:initdisk.c **** /* normal value of number of entries in root dir */ 808 .loc 1 392 0 0 00003C73 8B5E08 mov bx, word ptr [bp+8] 0 00003C76 C6473C02 mov byte ptr [bx+60], 2 394:initdisk.c **** defbpb->bpb_nreserved = 1; 811 .loc 1 394 0 0 00003C7A C7473D0002 mov word ptr [bx+61], 512 395:initdisk.c **** /* SEC_SIZE * DIRENT_SIZE / defbpb->bpb_ndirent + defbpb->bpb_nreserved */ 813 .loc 1 395 0 0 00003C7F C7473A0100 mov word ptr [bx+58], 1 397:initdisk.c **** if (FileSystem == FAT12 || FileSystem == FAT12_LBA) 815 .loc 1 397 0 0 00003C84 89C3 mov bx, ax 0 00003C86 83C3DF add bx, -33 0 00003C89 89D6 mov si, dx 0 00003C8B 83D6FF adc si, -1 820 _.LVL59: 398:initdisk.c **** { 821 .loc 1 398 0 0 00003C8E 80F901 cmp cl, 1 0 00003C91 7405 je _.L110 0 00003C93 80F9FF cmp cl, -1 0 00003C96 725C jc _.L85 826 _.L110: 827 _.LBB14: 402:initdisk.c **** /* Force maximal fatdata=32696 sectors since with our only possible sector 828 .loc 1 402 0 0 00003C98 8B7E08 mov di, word ptr [bp+8] 0 00003C9B C6453908 mov byte ptr [di+57], 8 831 _.LVL60: 411:initdisk.c **** FLOPPY_SEC_SIZE * 2 * NSECTORFAT12 + NFAT*3); 832 .loc 1 411 0 0 00003C9F 89D8 mov ax, bx 0 00003CA1 85F6 test si, si 0 00003CA3 7506 jne _.L88 836 _.LVL61: 0 00003CA5 81FB807F cmp bx, 32640 0 00003CA9 7603 jbe _.L87 839 _.L88: 0 00003CAB B8807F mov ax, 32640 841 _.LVL62: 842 _.L87: 0 00003CAE 83C010 add ax, 16 0 00003CB1 89C3 mov bx, ax 845 _.LVL63: 0 00003CB3 31C9 xor cx, cx 0 00003CB5 89CA mov dx, cx 0 00003CB7 D1E0 shl ax, 1 0 00003CB9 D1D2 rcl dx, 1 0 00003CBB 01D8 add ax, bx 0 00003CBD 11CA adc dx, cx 0 00003CBF 050520 add ax, 8197 0 00003CC2 11CA adc dx, cx 0 00003CC4 51 push cx 0 00003CC5 B90620 mov cx, 8198 0 00003CC8 51 push cx 0 00003CC9 52 push dx 0 00003CCA 50 push ax 0 00003CCB E8[FEFF] call ___udivsi3 860 _.LVL64: 0 00003CCE 8B5E08 mov bx, word ptr [bp+8] 0 00003CD1 894742 mov word ptr [bx+66], ax 432:initdisk.c **** } 863 .loc 1 432 0 0 00003CD4 B80800 mov ax, 8 0 00003CD7 50 push ax 0 00003CD8 B8[4F01] mov ax, offset _.LC9 867 _.LVL65: 868 _.L117: 869 _.LBE14: 870 _.LBB15: 532:initdisk.c **** } 871 .loc 1 532 0 0 00003CDB 50 push ax 0 00003CDC 93 xchg bx, ax 0 00003CDD 83C07B add ax, 123 0 00003CE0 50 push ax 0 00003CE1 E8[FEFF] call _init_memcpy 877 _.LVL66: 878 _.LBE15: 535:initdisk.c **** } 879 .loc 1 535 0 0 00003CE4 8B5E08 mov bx, word ptr [bp+8] 0 00003CE7 C687830000 mov byte ptr [bx+131], 0 536:initdisk.c **** 882 .loc 1 536 0 0 00003CEC 89EC mov sp, bp 0 00003CEE 5D pop bp 0 00003CEF 5F pop di 0 00003CF0 5E pop si 0 00003CF1 C20800 ret 8 888 _.LVL67: 889 _.L85: 890 _.LBB17: 442:initdisk.c **** { 891 .loc 1 442 0 0 00003CF4 80C1F5 add cl, -11 0 00003CF7 884EFA mov byte ptr [bp-6], cl 0 00003CFA 80F901 cmp cl, 1 0 00003CFD 7603E96C01 ja _.L90 896 _.LBB16: 447:initdisk.c **** unsigned char nsector = 64; /* disks greater than 32 GB, 32K cluster */ 897 .loc 1 447 0 0 00003D02 89D3 mov bx, dx 899 _.LVL68: 0 00003D04 B105 mov cl, 5 0 00003D06 D3EB shr bx, cl 902 _.LVL69: 448:initdisk.c **** if (sz_gb <= 32) /* disks up to 32 GB, 16K cluster */ 903 .loc 1 448 0 0 00003D08 B140 mov cl, 64 449:initdisk.c **** nsector = 32; 905 .loc 1 449 0 0 00003D0A 83FB20 cmp bx, 32 0 00003D0D 7710 ja _.L91 908 _.LVL70: 450:initdisk.c **** if (sz_gb <= 16) /* disks up to 16 GB, 8K cluster */ 909 .loc 1 450 0 0 00003D0F B120 mov cl, 32 451:initdisk.c **** nsector = 16; 911 .loc 1 451 0 0 00003D11 83FB10 cmp bx, 16 0 00003D14 7709 ja _.L91 914 _.LVL71: 452:initdisk.c **** if (sz_gb <= 8) /* disks up to 8 GB, 4K cluster */ 915 .loc 1 452 0 0 00003D16 B110 mov cl, 16 453:initdisk.c **** nsector = 8; 917 .loc 1 453 0 0 00003D18 83FB08 cmp bx, 8 0 00003D1B 7702 ja _.L91 454:initdisk.c **** if (NumSectors <= 532480UL) /* disks up to 260 MB, 0.5K cluster */ 920 .loc 1 454 0 0 00003D1D B108 mov cl, 8 922 _.LVL72: 923 _.L91: 455:initdisk.c **** nsector = 1; 924 .loc 1 455 0 0 00003D1F 83FA08 cmp dx, 8 0 00003D22 7709 ja _.L92 0 00003D24 7505 jne _.L111 0 00003D26 3D0020 cmp ax, 8192 0 00003D29 7702 ja _.L92 930 _.L111: 456:initdisk.c **** defbpb->bpb_nsector = nsector; 931 .loc 1 456 0 0 00003D2B B101 mov cl, 1 933 _.LVL73: 934 _.L92: 457:initdisk.c **** defbpb->bpb_ndirent = 0; 935 .loc 1 457 0 0 00003D2D 8B5E08 mov bx, word ptr [bp+8] 937 _.LVL74: 0 00003D30 884F39 mov byte ptr [bx+57], cl 458:initdisk.c **** defbpb->bpb_nreserved = 0x20; 939 .loc 1 458 0 0 00003D33 C7473D0000 mov word ptr [bx+61], 0 459:initdisk.c **** fatdata = NumSectors - 0x20; 941 .loc 1 459 0 0 00003D38 C7473A2000 mov word ptr [bx+58], 32 460:initdisk.c **** fatentpersec = FLOPPY_SEC_SIZE/4; /* how many 32bit FAT values fit in a default 512 byte sec 943 .loc 1 460 0 0 00003D3D 83C0E0 add ax, -32 945 _.LVL75: 0 00003D40 8946FE mov word ptr [bp-2], ax 0 00003D43 83D2FF adc dx, -1 948 _.LVL76: 0 00003D46 8956FC mov word ptr [bp-4], dx 950 _.LVL77: 461:initdisk.c **** maxcl = FAT32MAX; 951 .loc 1 461 0 0 00003D49 C746F88000 mov word ptr [bp-8], 128 462:initdisk.c **** } 953 .loc 1 462 0 0 00003D4E C746F4F9FF mov word ptr [bp-12], -7 0 00003D53 C746F2FF0F mov word ptr [bp-14], 4095 956 _.LVL78: 957 _.L105: 958 _.LBE16: 484:initdisk.c **** rest = (unsigned)(fatdata % divisor); 959 .loc 1 484 0 0 00003D58 8B5E08 mov bx, word ptr [bp+8] 0 00003D5B 8A4739 mov al, byte ptr [bx+57] 0 00003D5E 8846FB mov byte ptr [bp-5], al 0 00003D61 30E4 xor ah, ah 0 00003D63 F766F8 mul word ptr [bp-8] 0 00003D66 83C002 add ax, 2 0 00003D69 96 xchg si, ax 967 _.LVL79: 486:initdisk.c **** fatlength += (CLUSTER)((2 * defbpb->bpb_nsector + divisor + rest - 1) / divisor); 968 .loc 1 486 0 0 00003D6A 31C0 xor ax, ax 970 _.LVL80: 0 00003D6C 50 push ax 0 00003D6D 56 push si 0 00003D6E FF76FC push word ptr [bp-4] 0 00003D71 FF76FE push word ptr [bp-2] 0 00003D74 E8[FEFF] call ___udivsi3 976 _.LVL81: 0 00003D77 8946F6 mov word ptr [bp-10], ax 0 00003D7A 8956F0 mov word ptr [bp-16], dx 979 _.LVL82: 487:initdisk.c **** 980 .loc 1 487 0 0 00003D7D 8A46FB mov al, byte ptr [bp-5] 982 _.LVL83: 0 00003D80 30E4 xor ah, ah 0 00003D82 D1E0 shl ax, 1 0 00003D84 01F0 add ax, si 0 00003D86 8946EE mov word ptr [bp-18], ax 0 00003D89 31FF xor di, di 485:initdisk.c **** fatlength = (CLUSTER)(fatdata / divisor); 988 .loc 1 485 0 0 00003D8B 57 push di 0 00003D8C 56 push si 0 00003D8D FF76FC push word ptr [bp-4] 0 00003D90 FF76FE push word ptr [bp-2] 0 00003D93 E8[FEFF] call ___umodsi3 994 _.LVL84: 0 00003D96 91 xchg cx, ax 487:initdisk.c **** 996 .loc 1 487 0 0 00003D97 034EEE add cx, word ptr [bp-18] 0 00003D9A 89F8 mov ax, di 0 00003D9C 11D0 adc ax, dx 0 00003D9E 83C1FF add cx, -1 0 00003DA1 83D0FF adc ax, -1 0 00003DA4 93 xchg bx, ax 0 00003DA5 57 push di 0 00003DA6 56 push si 0 00003DA7 53 push bx 0 00003DA8 51 push cx 0 00003DA9 E8[FEFF] call ___udivsi3 1008 _.LVL85: 0 00003DAC 93 xchg bx, ax 0 00003DAD 89D1 mov cx, dx 0 00003DAF 035EF6 add bx, word ptr [bp-10] 0 00003DB2 895EF6 mov word ptr [bp-10], bx 1013 _.LVL86: 0 00003DB5 134EF0 adc cx, word ptr [bp-16] 1015 _.LVL87: 492:initdisk.c **** maxclust = fatlength * fatentpersec; 1016 .loc 1 492 0 0 00003DB8 89DA mov dx, bx 0 00003DBA D1E2 shl dx, 1 0 00003DBC 89C8 mov ax, cx 0 00003DBE 894EEE mov word ptr [bp-18], cx 0 00003DC1 D1D0 rcl ax, 1 0 00003DC3 8B4EFE mov cx, word ptr [bp-2] 1023 _.LVL88: 0 00003DC6 29D1 sub cx, dx 0 00003DC8 89CA mov dx, cx 0 00003DCA 8B5EFC mov bx, word ptr [bp-4] 1027 _.LVL89: 0 00003DCD 19C3 sbb bx, ax 0 00003DCF 8A46FB mov al, byte ptr [bp-5] 0 00003DD2 30E4 xor ah, ah 0 00003DD4 57 push di 0 00003DD5 50 push ax 0 00003DD6 53 push bx 0 00003DD7 52 push dx 0 00003DD8 E8[FEFF] call ___udivsi3 1036 _.LVL90: 0 00003DDB 97 xchg di, ax 0 00003DDC 8956F0 mov word ptr [bp-16], dx 1039 _.LVL91: 493:initdisk.c **** if (maxclust > maxcl) 1040 .loc 1 493 0 0 00003DDF 8B46F8 mov ax, word ptr [bp-8] 1042 _.LVL92: 0 00003DE2 8B4EEE mov cx, word ptr [bp-18] 0 00003DE5 F7E1 mul cx 1045 _.LVL93: 0 00003DE7 8946EE mov word ptr [bp-18], ax 1047 _.LVL94: 0 00003DEA 8B46F8 mov ax, word ptr [bp-8] 0 00003DED F766F6 mul word ptr [bp-10] 0 00003DF0 93 xchg bx, ax 0 00003DF1 89D6 mov si, dx 1052 _.LVL95: 0 00003DF3 0376EE add si, word ptr [bp-18] 1054 _.LVL96: 498:initdisk.c **** { 1055 .loc 1 498 0 0 00003DF6 8B46F4 mov ax, word ptr [bp-12] 0 00003DF9 8B56F2 mov dx, word ptr [bp-14] 0 00003DFC 39F2 cmp dx, si 0 00003DFE 7706 ja _.L99 0 00003E00 7507 jne _.L98 0 00003E02 39D8 cmp ax, bx 0 00003E04 7603 jbe _.L98 1063 _.L99: 0 00003E06 93 xchg bx, ax 0 00003E07 89F2 mov dx, si 1066 _.L98: 0 00003E09 83C0FE add ax, -2 0 00003E0C 83D2FF adc dx, -1 0 00003E0F 3956F0 cmp word ptr [bp-16], dx 0 00003E12 7603E99A00 ja _.L97 0 00003E17 7507 jne _.L101 0 00003E19 39C7 cmp di, ax 0 00003E1B 7603E99100 ja _.L97 1074 _.L101: 503:initdisk.c **** { 1075 .loc 1 503 0 0 00003E20 837EF000 cmp word ptr [bp-16], 0 0 00003E24 7509 jne _.L106 0 00003E26 81FFF50F cmp di, 4085 0 00003E2A 7703E98200 jbe _.L97 1080 _.LVL97: 1081 _.L106: 518:initdisk.c **** defbpb->bpb_xnfsect = fatlength; 1082 .loc 1 518 0 0 00003E2F 8B5E08 mov bx, word ptr [bp+8] 516:initdisk.c **** { 1084 .loc 1 516 0 0 00003E32 807EFA01 cmp byte ptr [bp-6], 1 0 00003E36 B80800 mov ax, 8 0 00003E39 7769 ja _.L104 518:initdisk.c **** defbpb->bpb_xnfsect = fatlength; 1088 .loc 1 518 0 0 00003E3B C747420000 mov word ptr [bx+66], 0 519:initdisk.c **** /* set up additional FAT32 fields */ 1090 .loc 1 519 0 0 00003E40 8B56F6 mov dx, word ptr [bp-10] 0 00003E43 895750 mov word ptr [bx+80], dx 0 00003E46 894F52 mov word ptr [bx+82], cx 521:initdisk.c **** defbpb->bpb_xfsversion = 0; 1094 .loc 1 521 0 0 00003E49 C747540000 mov word ptr [bx+84], 0 522:initdisk.c **** defbpb->bpb_xrootclst = 2; 1096 .loc 1 522 0 0 00003E4E C747560000 mov word ptr [bx+86], 0 523:initdisk.c **** defbpb->bpb_xfsinfosec = 1; 1098 .loc 1 523 0 0 00003E53 C747580200 mov word ptr [bx+88], 2 0 00003E58 C7475A0000 mov word ptr [bx+90], 0 524:initdisk.c **** defbpb->bpb_xbackupsec = 6; 1101 .loc 1 524 0 0 00003E5D C7475C0100 mov word ptr [bx+92], 1 525:initdisk.c **** memcpy(pddt->ddt_fstype, MSDOS_FAT32_SIGN, 8); 1103 .loc 1 525 0 0 00003E62 C7475E0600 mov word ptr [bx+94], 6 526:initdisk.c **** } 1105 .loc 1 526 0 0 00003E67 50 push ax 0 00003E68 B8[5801] mov ax, offset _.LC10 0 00003E6B E96DFE jmp _.L117 1109 _.LVL98: 1110 _.L90: 468:initdisk.c **** /* Force maximal fatdata=8387584 sectors (NumSectors=8387617) 1111 .loc 1 468 0 0 00003E6E 8B7E08 mov di, word ptr [bp+8] 0 00003E71 C6453904 mov byte ptr [di+57], 4 0 00003E75 895EFE mov word ptr [bp-2], bx 0 00003E78 8976FC mov word ptr [bp-4], si 0 00003E7B 83FE7F cmp si, 127 0 00003E7E 7708 ja _.L96 0 00003E80 7510 jne _.L95 0 00003E82 81FB80F8 cmp bx, -1920 0 00003E86 760A jbe _.L95 1121 _.L96: 0 00003E88 C746FE80F8 mov word ptr [bp-2], -1920 0 00003E8D C746FC7F00 mov word ptr [bp-4], 127 1124 _.L95: 476:initdisk.c **** maxcl = FAT16MAX; 1125 .loc 1 476 0 0 00003E92 C746F80001 mov word ptr [bp-8], 256 477:initdisk.c **** } 1127 .loc 1 477 0 0 00003E97 C746F4EFFF mov word ptr [bp-12], -17 0 00003E9C C746F20000 mov word ptr [bp-14], 0 0 00003EA1 E9B4FE jmp _.L105 1131 _.LVL99: 1132 _.L104: 531:initdisk.c **** memcpy(pddt->ddt_fstype, MSDOS_FAT16_SIGN, 8); 1133 .loc 1 531 0 0 00003EA4 8B56F6 mov dx, word ptr [bp-10] 0 00003EA7 895742 mov word ptr [bx+66], dx 532:initdisk.c **** } 1136 .loc 1 532 0 0 00003EAA 50 push ax 0 00003EAB B8[6101] mov ax, offset _.LC11 0 00003EAE E92AFE jmp _.L117 1140 _.LVL100: 1141 _.L97: 512:initdisk.c **** } 1142 .loc 1 512 0 0 00003EB1 8A46FB mov al, byte ptr [bp-5] 0 00003EB4 D0E0 shl al, 1 0 00003EB6 8B5E08 mov bx, word ptr [bp+8] 1146 _.LVL101: 0 00003EB9 884739 mov byte ptr [bx+57], al 514:initdisk.c **** #ifdef WITHFAT32 1148 .loc 1 514 0 0 00003EBC FEC8 dec al 0 00003EBE 84C0 test al, al 0 00003EC0 7C03E993FE jge _.L105 0 00003EC5 E967FF jmp _.L106 1153 _.LBE17: 1154 _.LFE8: 1155 .size _CalculateFATData, .-_CalculateFATData === Switch to base=012BB0h -> ".RODATA.STR1.1" 1156 .section .rodata.str1.1 1157 _.LC12: 0 00000E9E 50726900 .string "Pri" 1159 _.LC13: 0 00000EA2 45787400 .string "Ext" 1161 _.LC14: 0 00000EA6 6D6F726520506172 .string "more Partitions detected then possible, max = %d\n" 0 00000EAE 746974696F6E7320 0 00000EB6 6465746563746564 0 00000EBE 207468656E20706F 0 00000EC6 737369626C652C20 0 00000ECE 6D6178203D202564 0 00000ED6 0A00 1163 _.LC15: 0 00000ED8 25633A2048442564 .string "%c: HD%d, %s[%2d]" 0 00000EE0 2C2025735B253264 0 00000EE8 5D00 1165 _.LC16: 0 00000EEA 2C204348533D2000 .string ", CHS= " 1167 _.LC17: 0 00000EF2 2C2073746172743D .string ", start=%6lu MB, size=%6lu MB\n" 0 00000EFA 25366C75204D422C 0 00000F02 2073697A653D2536 0 00000F0A 6C75204D420A00 === Switch to base=002270h -> ".TEXT" 1169 .text 1170 .global _DosDefinePartition 1171 .type _DosDefinePartition, @function 1172 _DosDefinePartition: 1173 _.LFB10: 552:initdisk.c **** ddt nddt; 1174 .loc 1 552 0 1175 _.LVL102: 0 00003EC8 56 push si 0 00003EC9 57 push di 0 00003ECA 55 push bp 1179 _.LCFI16: 0 00003ECB 89E5 mov bp, sp 1181 _.LCFI17: 0 00003ECD 81EC9400 sub sp, 148 0 00003ED1 8B7E08 mov di, word ptr [bp+8] 0 00003ED4 C4460A les ax, dword ptr [bp+10] 0 00003ED7 89866EFF mov word ptr [bp-146], ax 0 00003EDB 8C8670FF mov word ptr [bp-144], es 0 00003EDF 8B760E mov si, word ptr [bp+14] 1188 _.LVL103: 557:initdisk.c **** { 1189 .loc 1 557 0 0 00003EE2 A1[0000] mov ax, word ptr [_nUnits] 0 00003EE5 83F819 cmp ax, 25 0 00003EE8 7E16 jle _.L119 559:initdisk.c **** return; /* we are done */ 1193 .loc 1 559 0 0 00003EEA B81A00 mov ax, 26 0 00003EED 50 push ax 0 00003EEE B8[7201] mov ax, offset _.LC14 0 00003EF1 50 push ax 0 00003EF2 E8[FEFF] call _init_printf 1199 _.LVL104: 560:initdisk.c **** } 1200 .loc 1 560 0 0 00003EF5 83C404 add sp, 4 1202 _.L118: 631:initdisk.c **** 1203 .loc 1 631 0 0 00003EF8 89EC mov sp, bp 0 00003EFA 5D pop bp 0 00003EFB 5F pop di 0 00003EFC 5E pop si 0 00003EFD C20C00 ret 12 1209 _.LVL105: 1210 _.L119: 563:initdisk.c **** pddt->ddt_driveno = driveParam->driveno; 1211 .loc 1 563 0 0 00003F00 C78678FFFFFF mov word ptr [bp-136], -1 0 00003F06 C7867AFF0000 mov word ptr [bp-134], 0 564:initdisk.c **** pddt->ddt_logdriveno = nUnits; 1214 .loc 1 564 0 0 00003F0C 8A15 mov dl, byte ptr [di] 0 00003F0E 88967CFF mov byte ptr [bp-132], dl 565:initdisk.c **** pddt->ddt_descflags = driveParam->descflags; 1217 .loc 1 565 0 0 00003F12 88867DFF mov byte ptr [bp-131], al 566:initdisk.c **** /* Turn off LBA if not forced and the partition is within 1023 cyls and of the right type */ 1219 .loc 1 566 0 0 00003F16 8B4501 mov ax, word ptr [di+1] 0 00003F19 8946AB mov word ptr [bp-85], ax 570:initdisk.c **** pddt->ddt_descflags &= ~DF_LBA; 1222 .loc 1 570 0 0 00003F1C BB[0000] mov bx, offset _InitKernelConfig 0 00003F1F 807F0B00 cmp byte ptr [bx+11], 0 0 00003F23 899E6CFF mov word ptr [bp-148], bx 0 00003F27 751F jne _.L121 570:initdisk.c **** pddt->ddt_descflags &= ~DF_LBA; 1227 .loc 1 570 0 is_stmt 0 discriminator 1 0 00003F29 8A5401 mov dl, byte ptr [si+1] 0 00003F2C 88D6 mov dh, dl 0 00003F2E 80E6FD and dh, -3 0 00003F31 80FE0C cmp dh, 12 0 00003F34 7412 je _.L121 0 00003F36 80FAFF cmp dl, -1 0 00003F39 730D jnc _.L121 570:initdisk.c **** pddt->ddt_descflags &= ~DF_LBA; 1235 .loc 1 570 0 discriminator 3 0 00003F3B 833E[0000]00 cmp word ptr [_ExtLBAForce], 0 0 00003F40 7506 jne _.L121 571:initdisk.c **** pddt->ddt_ncyl = driveParam->chs.Cylinder; 1238 .loc 1 571 0 is_stmt 1 0 00003F42 80E4FB and ah, -5 0 00003F45 8946AB mov word ptr [bp-85], ax 1241 _.L121: 572:initdisk.c **** 1242 .loc 1 572 0 0 00003F48 8B4507 mov ax, word ptr [di+7] 0 00003F4B 8946AD mov word ptr [bp-83], ax 576:initdisk.c **** 1245 .loc 1 576 0 0 00003F4E C4866EFF les ax, dword ptr [bp-146] 1247 _.LVL106: 0 00003F52 8946FC mov word ptr [bp-4], ax 0 00003F55 8C46FE mov word ptr [bp-2], es 578:initdisk.c **** pddt->ddt_defbpb.bpb_mdesc = 0xf8; 1250 .loc 1 578 0 0 00003F58 C746AF0002 mov word ptr [bp-81], 512 579:initdisk.c **** pddt->ddt_defbpb.bpb_nheads = driveParam->chs.Head; 1252 .loc 1 579 0 0 00003F5D C646B9F8 mov byte ptr [bp-71], -8 581:initdisk.c **** pddt->ddt_defbpb.bpb_hidden = pEntry->RelSect; 1254 .loc 1 581 0 0 00003F61 C44509 les ax, dword ptr [di+9] 0 00003F64 8946BE mov word ptr [bp-66], ax 0 00003F67 8C46BC mov word ptr [bp-68], es 582:initdisk.c **** 1258 .loc 1 582 0 0 00003F6A C4440E les ax, dword ptr [si+14] 0 00003F6D 8946C0 mov word ptr [bp-64], ax 0 00003F70 8C46C2 mov word ptr [bp-62], es 584:initdisk.c **** pddt->ddt_defbpb.bpb_huge = pEntry->NumSect; 1262 .loc 1 584 0 0 00003F73 C746B70000 mov word ptr [bp-73], 0 585:initdisk.c **** if (pEntry->NumSect <= 0xffff) 1264 .loc 1 585 0 0 00003F78 8B5412 mov dx, word ptr [si+18] 0 00003F7B 8B4414 mov ax, word ptr [si+20] 0 00003F7E 8956C4 mov word ptr [bp-60], dx 0 00003F81 8946C6 mov word ptr [bp-58], ax 586:initdisk.c **** { 1269 .loc 1 586 0 0 00003F84 85C0 test ax, ax 0 00003F86 750B jne _.L122 588:initdisk.c **** pddt->ddt_defbpb.bpb_huge = 0; /* may still be set on Win95 */ 1272 .loc 1 588 0 0 00003F88 8956B7 mov word ptr [bp-73], dx 589:initdisk.c **** } 1274 .loc 1 589 0 0 00003F8B 8946C4 mov word ptr [bp-60], ax 0 00003F8E C746C60000 mov word ptr [bp-58], 0 1277 _.L122: 593:initdisk.c **** 1278 .loc 1 593 0 0 00003F93 FF7401 push word ptr [si+1] 0 00003F96 50 push ax 0 00003F97 52 push dx 0 00003F98 8D8678FF lea ax, [-136+bp] 1283 _.LVL107: 0 00003F9C 50 push ax 0 00003F9D E8[FEFF] call _CalculateFATData 1286 _.LVL108: 595:initdisk.c **** /* drive inaccessible until bldbpb successful */ 1287 .loc 1 595 0 0 00003FA0 C746EF7856 mov word ptr [bp-17], 22136 0 00003FA5 C746F13412 mov word ptr [bp-15], 4660 597:initdisk.c **** pddt->ddt_type = 5; 1290 .loc 1 597 0 0 00003FAA FFB67CFF push word ptr [bp-132] 0 00003FAE E8[FEFF] call _init_readdasd 1293 _.LVL109: 0 00003FB1 80CC02 or ah, 2 0 00003FB4 0946AB or word ptr [bp-85], ax 598:initdisk.c **** memcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb)); 1296 .loc 1 598 0 0 00003FB7 C646AA05 mov byte ptr [bp-86], 5 599:initdisk.c **** 1298 .loc 1 599 0 0 00003FBB B82900 mov ax, 41 0 00003FBE 50 push ax 0 00003FBF 8D46AF lea ax, [-81+bp] 0 00003FC2 50 push ax 0 00003FC3 8D8678FF lea ax, [-136+bp] 1304 _.LVL110: 0 00003FC7 83C006 add ax, 6 1306 _.LVL111: 0 00003FCA 50 push ax 0 00003FCB E8[FEFF] call _init_memcpy 1309 _.LVL112: 601:initdisk.c **** 1310 .loc 1 601 0 0 00003FCE 8D8678FF lea ax, [-136+bp] 1312 _.LVL113: 0 00003FD2 50 push ax 0 00003FD3 E8DFF7 call _push_ddt 1315 _.LVL114: 607:initdisk.c **** { 1316 .loc 1 607 0 0 00003FD6 8B9E6CFF mov bx, word ptr [bp-148] 0 00003FDA 807F0900 cmp byte ptr [bx+9], 0 0 00003FDE 7503E98500 je _.L124 1320 _.LBB18: 612:initdisk.c **** 1321 .loc 1 612 0 0 00003FE3 57 push di 0 00003FE4 FFB670FF push word ptr [bp-144] 0 00003FE8 FFB66EFF push word ptr [bp-146] 0 00003FEC 8D8672FF lea ax, [-142+bp] 0 00003FF0 50 push ax 0 00003FF1 E8[FEFF] call _init_LBA_to_CHS 1328 _.LVL115: 616:initdisk.c **** { 1329 .loc 1 616 0 0 00003FF4 837E1000 cmp word ptr [bp+16], 0 0 00003FF8 7575 jne _.L126 615:initdisk.c **** if (extendedPartNo) 1332 .loc 1 615 0 0 00003FFA 8B4612 mov ax, word ptr [bp+18] 0 00003FFD 40 inc ax 1335 _.LVL116: 0 00003FFE 894610 mov word ptr [bp+16], ax 614:initdisk.c **** num = PrimaryNum + 1; 1337 .loc 1 614 0 0 00004001 B8[6A01] mov ax, offset _.LC12 1339 _.LVL117: 1340 _.L125: 621:initdisk.c **** (driveParam->driveno & 0x7f) + 1, ExtPri, num); 1341 .loc 1 621 0 0 00004004 FF7610 push word ptr [bp+16] 0 00004007 50 push ax 622:initdisk.c **** 1344 .loc 1 622 0 0 00004008 8A05 mov al, byte ptr [di] 1346 _.LVL118: 0 0000400A 247F and al, 127 0 0000400C 30E4 xor ah, ah 621:initdisk.c **** (driveParam->driveno & 0x7f) + 1, ExtPri, num); 1349 .loc 1 621 0 0 0000400E 40 inc ax 0 0000400F 50 push ax 1352 _.LVL119: 0 00004010 A1[0000] mov ax, word ptr [_nUnits] 0 00004013 83C041 add ax, 65 0 00004016 50 push ax 1356 _.LVL120: 0 00004017 B8[A401] mov ax, offset _.LC15 0 0000401A 50 push ax 1359 _.LVL121: 0 0000401B E8[FEFF] call _init_printf 1361 _.LVL122: 624:initdisk.c **** 1362 .loc 1 624 0 0 0000401E 8D8672FF lea ax, [-142+bp] 0 00004022 50 push ax 0 00004023 B8[B601] mov ax, offset _.LC16 0 00004026 50 push ax 0 00004027 E8[FEFF] call _printCHS 1368 _.LVL123: 626:initdisk.c **** StartSector / 2048, pEntry->NumSect / 2048); 1369 .loc 1 626 0 0 0000402A 8B5414 mov dx, word ptr [si+20] 0 0000402D B405 mov ah, 5 0 0000402F 89D3 mov bx, dx 0 00004031 88E1 mov cl, ah 0 00004033 D3E3 shl bx, cl 0 00004035 8B7412 mov si, word ptr [si+18] 1376 _.LVL124: 0 00004038 B00B mov al, 11 0 0000403A 88C1 mov cl, al 0 0000403C D3EE shr si, cl 0 0000403E 09DE or si, bx 0 00004040 D3EA shr dx, cl 0 00004042 52 push dx 0 00004043 56 push si 0 00004044 8B9E70FF mov bx, word ptr [bp-144] 0 00004048 88E1 mov cl, ah 0 0000404A D3E3 shl bx, cl 0 0000404C 8B966EFF mov dx, word ptr [bp-146] 0 00004050 88C1 mov cl, al 0 00004052 D3EA shr dx, cl 0 00004054 09DA or dx, bx 0 00004056 8B9E70FF mov bx, word ptr [bp-144] 0 0000405A D3EB shr bx, cl 0 0000405C 53 push bx 0 0000405D 52 push dx 0 0000405E B8[BE01] mov ax, offset _.LC17 0 00004061 50 push ax 0 00004062 E8[FEFF] call _init_printf 1398 _.LVL125: 0 00004065 83C414 add sp, 20 1400 _.LVL126: 1401 _.L124: 1402 _.LBE18: 630:initdisk.c **** } 1403 .loc 1 630 0 0 00004068 FF06[0000] inc word ptr [_nUnits] 0 0000406C E989FE jmp _.L118 1406 _.LVL127: 1407 _.L126: 1408 _.LBB19: 618:initdisk.c **** num = extendedPartNo; 1409 .loc 1 618 0 0 0000406F B8[6E01] mov ax, offset _.LC13 0 00004072 EB90 jmp _.L125 1412 _.LBE19: 1413 _.LFE10: 1414 .size _DosDefinePartition, .-_DosDefinePartition 1415 .global _ConvPartTableEntryToIntern 1416 .type _ConvPartTableEntryToIntern, @function 1417 _ConvPartTableEntryToIntern: 1418 _.LFB13: 801:initdisk.c **** int i; 1419 .loc 1 801 0 1420 _.LVL128: 0 00004074 56 push si 0 00004075 57 push di 0 00004076 55 push bp 1424 _.LCFI18: 0 00004077 89E5 mov bp, sp 1426 _.LCFI19: 0 00004079 1E push ds 0 0000407A 8B7608 mov si, word ptr [bp+8] 0 0000407D 8B7E0A mov di, word ptr [bp+10] 804:initdisk.c **** { 1430 .loc 1 804 0 0 00004080 80BDFE0155 cmp byte ptr [di+510], 85 0 00004085 7507 jne _.L135 804:initdisk.c **** { 1433 .loc 1 804 0 is_stmt 0 discriminator 1 0 00004087 80BDFF01AA cmp byte ptr [di+511], -86 0 0000408C 7419 je _.L136 1436 _.L135: 806:initdisk.c **** 1437 .loc 1 806 0 is_stmt 1 0 0000408E B85800 mov ax, 88 0 00004091 50 push ax 0 00004092 31C0 xor ax, ax 0 00004094 50 push ax 0 00004095 8946FE mov word ptr [bp-2], ax 0 00004098 56 push si 0 00004099 E8[FEFF] call _init_memset 1445 _.LVL129: 808:initdisk.c **** } 1446 .loc 1 808 0 0 0000409C 8B46FE mov ax, word ptr [bp-2] 1448 _.L134: 826:initdisk.c **** 1449 .loc 1 826 0 0 0000409F 89EC mov sp, bp 0 000040A1 5D pop bp 0 000040A2 5F pop di 0 000040A3 5E pop si 0 000040A4 C20400 ret 4 1455 _.L136: 1456 _.LVL130: 1457 _.LBB26: 1458 _.LBB27: 811:initdisk.c **** 1459 .loc 1 811 0 0 000040A7 8D9DBE01 lea bx, [446+di] 1461 _.LVL131: 0 000040AB 81C7FE01 add di, 510 1463 _.LBB28: 1464 _.LBB29: 796:initdisk.c **** } 1465 .loc 1 796 0 0 000040AF B102 mov cl, 2 1467 _.LVL132: 1468 _.L138: 1469 _.LBE29: 1470 _.LBE28: 816:initdisk.c **** pEntry->FileSystem = pDisk[4]; 1471 .loc 1 816 0 0 000040B1 8A07 mov al, byte ptr [bx] 0 000040B3 8804 mov byte ptr [si], al 817:initdisk.c **** 1474 .loc 1 817 0 0 000040B5 8A4704 mov al, byte ptr [bx+4] 0 000040B8 884401 mov byte ptr [si+1], al 1477 _.LVL133: 1478 _.LBB31: 1479 _.LBB30: 794:initdisk.c **** chs->Sector = pDisk[1] & 0x3f; 1480 .loc 1 794 0 0 000040BB 8A4701 mov al, byte ptr [bx+1] 0 000040BE B400 mov ah, 0 0 000040C0 894404 mov word ptr [si+4], ax 795:initdisk.c **** chs->Cylinder = pDisk[2] + ((pDisk[1] & 0xc0) << 2); 1484 .loc 1 795 0 0 000040C3 8A4702 mov al, byte ptr [bx+2] 0 000040C6 243F and al, 63 0 000040C8 B400 mov ah, 0 0 000040CA 894406 mov word ptr [si+6], ax 796:initdisk.c **** } 1489 .loc 1 796 0 0 000040CD 8A4702 mov al, byte ptr [bx+2] 0 000040D0 30E4 xor ah, ah 0 000040D2 D3E0 shl ax, cl 0 000040D4 250003 and ax, 768 0 000040D7 8A5703 mov dl, byte ptr [bx+3] 0 000040DA 30F6 xor dh, dh 0 000040DC 01D0 add ax, dx 0 000040DE 894402 mov word ptr [si+2], ax 1498 _.LVL134: 1499 _.LBE30: 1500 _.LBE31: 1501 _.LBB32: 1502 _.LBB33: 794:initdisk.c **** chs->Sector = pDisk[1] & 0x3f; 1503 .loc 1 794 0 0 000040E1 8A4705 mov al, byte ptr [bx+5] 0 000040E4 B400 mov ah, 0 0 000040E6 89440A mov word ptr [si+10], ax 795:initdisk.c **** chs->Cylinder = pDisk[2] + ((pDisk[1] & 0xc0) << 2); 1507 .loc 1 795 0 0 000040E9 8A4706 mov al, byte ptr [bx+6] 0 000040EC 243F and al, 63 0 000040EE B400 mov ah, 0 0 000040F0 89440C mov word ptr [si+12], ax 796:initdisk.c **** } 1512 .loc 1 796 0 0 000040F3 8A4706 mov al, byte ptr [bx+6] 0 000040F6 30E4 xor ah, ah 0 000040F8 D3E0 shl ax, cl 0 000040FA 250003 and ax, 768 0 000040FD 8A5707 mov dl, byte ptr [bx+7] 0 00004100 30F6 xor dh, dh 0 00004102 01D0 add ax, dx 0 00004104 894408 mov word ptr [si+8], ax 1521 _.LVL135: 1522 _.LBE33: 1523 _.LBE32: 822:initdisk.c **** pEntry->NumSect = *(ULONG *) (pDisk + 12); 1524 .loc 1 822 0 0 00004107 8B4708 mov ax, word ptr [bx+8] 0 0000410A 8B570A mov dx, word ptr [bx+10] 0 0000410D 89440E mov word ptr [si+14], ax 0 00004110 895410 mov word ptr [si+16], dx 823:initdisk.c **** } 1529 .loc 1 823 0 0 00004113 8B470C mov ax, word ptr [bx+12] 0 00004116 8B570E mov dx, word ptr [bx+14] 0 00004119 894412 mov word ptr [si+18], ax 0 0000411C 895414 mov word ptr [si+20], dx 813:initdisk.c **** { 1534 .loc 1 813 0 0 0000411F 83C310 add bx, 16 1536 _.LVL136: 0 00004122 83C616 add si, 22 1538 _.LVL137: 0 00004125 39DF cmp di, bx 0 00004127 7588 jne _.L138 0 00004129 B80100 mov ax, 1 0 0000412C E970FF jmp _.L134 1543 _.LBE27: 1544 _.LBE26: 1545 _.LFE13: 1546 .size _ConvPartTableEntryToIntern, .-_ConvPartTableEntryToIntern 1547 .global _is_suspect 1548 .type _is_suspect, @function 1549 _is_suspect: 1550 _.LFB14: 829:initdisk.c **** /* Valid entry: 1551 .loc 1 829 0 1552 _.LVL138: 0 0000412F 56 push si 0 00004130 55 push bp 1555 _.LCFI20: 0 00004131 89E5 mov bp, sp 1557 _.LCFI21: 0 00004133 8B5E06 mov bx, word ptr [bp+6] 0 00004136 8B7608 mov si, word ptr [bp+8] 836:initdisk.c **** pEntry_chs->Head == chs->Head && 1560 .loc 1 836 0 0 00004139 8B0C mov cx, word ptr [si] 0 0000413B 8B17 mov dx, word ptr [bx] 0 0000413D 39D1 cmp cx, dx 0 0000413F 7510 jne _.L142 836:initdisk.c **** pEntry_chs->Head == chs->Head && 1565 .loc 1 836 0 is_stmt 0 discriminator 2 0 00004141 8B4402 mov ax, word ptr [si+2] 0 00004144 3B4702 cmp ax, word ptr [bx+2] 0 00004147 7508 jne _.L142 837:initdisk.c **** pEntry_chs->Sector == chs->Sector) || 1569 .loc 1 837 0 is_stmt 1 0 00004149 8B4404 mov ax, word ptr [si+4] 0 0000414C 3B4704 cmp ax, word ptr [bx+4] 0 0000414F 7421 je _.L146 1573 _.L142: 836:initdisk.c **** pEntry_chs->Head == chs->Head && 1574 .loc 1 836 0 discriminator 3 0 00004151 81FAFF03 cmp dx, 1023 0 00004155 7616 jbe _.L145 839:initdisk.c **** (pEntry_chs->Cylinder == 1023 || 1577 .loc 1 839 0 0 00004157 81F9FF03 cmp cx, 1023 0 0000415B 7415 je _.L146 841:initdisk.c **** } 1580 .loc 1 841 0 0 0000415D 80E603 and dh, 3 840:initdisk.c **** pEntry_chs->Cylinder == (0x3ff & chs->Cylinder))); 1582 .loc 1 840 0 0 00004160 31CA xor dx, cx 0 00004162 83FA01 cmp dx, 1 836:initdisk.c **** pEntry_chs->Head == chs->Head && 1585 .loc 1 836 0 0 00004165 19C0 sbb ax, ax 0 00004167 40 inc ax 1588 _.L141: 842:initdisk.c **** 1589 .loc 1 842 0 0 00004168 5D pop bp 0 00004169 5E pop si 0 0000416A C20400 ret 4 1593 _.L145: 836:initdisk.c **** pEntry_chs->Head == chs->Head && 1594 .loc 1 836 0 0 0000416D B80100 mov ax, 1 0 00004170 EBF6 jmp _.L141 1597 _.L146: 0 00004172 31C0 xor ax, ax 0 00004174 EBF2 jmp _.L141 1600 _.LFE14: 1601 .size _is_suspect, .-_is_suspect === Switch to base=012BB0h -> ".RODATA.STR1.1" 1602 .section .rodata.str1.1 1603 _.LC18: 0 00000F11 5741524E494E473A .string "WARNING: using suspect partition %s FS %02x:" 0 00000F19 207573696E672073 0 00000F21 7573706563742070 0 00000F29 6172746974696F6E 0 00000F31 2025732046532025 0 00000F39 3032783A00 1605 _.LC19: 0 00000F3E 2077697468206361 .string " with calculated values " 0 00000F46 6C63756C61746564 0 00000F4E 2076616C75657320 0 00000F56 00 1607 _.LC20: 0 00000F57 20696E7374656164 .string " instead of " 0 00000F5F 206F662000 1609 _.LC21: 0 00000F64 0A00 .string "\n" === Switch to base=002270h -> ".TEXT" 1611 .text 1612 .global _print_warning_suspect 1613 .type _print_warning_suspect, @function 1614 _print_warning_suspect: 1615 _.LFB15: 846:initdisk.c **** if (!InitKernelConfig.ForceLBA) 1616 .loc 1 846 0 1617 _.LVL139: 0 00004176 56 push si 0 00004177 57 push di 0 00004178 55 push bp 1621 _.LCFI22: 0 00004179 89E5 mov bp, sp 1623 _.LCFI23: 0 0000417B 8B760C mov si, word ptr [bp+12] 0 0000417E 8B7E0E mov di, word ptr [bp+14] 847:initdisk.c **** { 1626 .loc 1 847 0 0 00004181 BB[0000] mov bx, offset _InitKernelConfig 0 00004184 807F0B00 cmp byte ptr [bx+11], 0 0 00004188 7530 jne _.L149 849:initdisk.c **** { 1630 .loc 1 849 0 0 0000418A 807F1500 cmp byte ptr [bx+21], 0 0 0000418E 7C2A jl _.L149 851:initdisk.c **** printCHS(" with calculated values ", chs); 1633 .loc 1 851 0 0 00004190 8A460A mov al, byte ptr [bp+10] 0 00004193 30E4 xor ah, ah 0 00004195 50 push ax 0 00004196 FF7608 push word ptr [bp+8] 0 00004199 B8[DD01] mov ax, offset _.LC18 0 0000419C 50 push ax 0 0000419D E8[FEFF] call _init_printf 1641 _.LVL140: 852:initdisk.c **** printCHS(" instead of ", pEntry_chs); 1642 .loc 1 852 0 0 000041A0 56 push si 0 000041A1 B8[0A02] mov ax, offset _.LC19 0 000041A4 50 push ax 0 000041A5 E8[FEFF] call _printCHS 1647 _.LVL141: 853:initdisk.c **** printf("\n"); 1648 .loc 1 853 0 0 000041A8 57 push di 0 000041A9 B8[2302] mov ax, offset _.LC20 0 000041AC 50 push ax 0 000041AD E8[FEFF] call _printCHS 1653 _.LVL142: 854:initdisk.c **** } 1654 .loc 1 854 0 0 000041B0 B8[3002] mov ax, offset _.LC21 0 000041B3 50 push ax 0 000041B4 E8[FEFF] call _init_printf 1658 _.LVL143: 0 000041B7 83C408 add sp, 8 1660 _.L149: 857:initdisk.c **** } 1661 .loc 1 857 0 0 000041BA B80600 mov ax, 6 0 000041BD 50 push ax 0 000041BE 56 push si 0 000041BF 57 push di 0 000041C0 E8[FEFF] call _init_memcpy 1667 _.LVL144: 858:initdisk.c **** 1668 .loc 1 858 0 0 000041C3 89EC mov sp, bp 0 000041C5 5D pop bp 0 000041C6 5F pop di 0 000041C7 5E pop si 0 000041C8 C20800 ret 8 1674 _.LFE15: 1675 .size _print_warning_suspect, .-_print_warning_suspect === Switch to base=012BB0h -> ".RODATA.STR1.1" 1676 .section .rodata.str1.1 1677 _.LC22: 0 00000F66 4578743A256400 .string "Ext:%d" 1679 _.LC23: 0 00000F6D 5072693A256400 .string "Pri:%d" 1681 _.LC24: 0 00000F74 4E6F74207573696E .string "Not using partition %s with 0 sectors\n" 0 00000F7C 6720706172746974 0 00000F84 696F6E2025732077 0 00000F8C 6974682030207365 0 00000F94 63746F72730A00 1683 _.LC25: 0 00000F9B 63616E2774207573 .string "can't use LBA partition without LBA support - part %s FS %02x" 0 00000FA3 65204C4241207061 0 00000FAB 72746974696F6E20 0 00000FB3 776974686F757420 0 00000FBB 4C42412073757070 0 00000FC3 6F7274202D207061 0 00000FCB 7274202573204653 0 00000FD3 202530327800 1685 _.LC26: 0 00000FD9 2073746172742000 .string " start " 1687 _.LC27: 0 00000FE1 2C20656E642000 .string ", end " 1689 _.LC28: 0 00000FE8 5741524E494E473A .string "WARNING: Partition ID does not suggest LBA - part %s FS %02x.\nPlease run FDISK to correc 0 00000FF0 2050617274697469 0 00000FF8 6F6E20494420646F 0 00001000 6573206E6F742073 0 00001008 756767657374204C 0 00001010 4241202D20706172 0 00001018 7420257320465320 0 00001020 253032782E0A506C 0 00001028 656173652072756E 0 00001030 20464449534B2074 0 00001038 6F20636F72726563 0 00001040 742074686973202D 0 00001048 207573696E67204C 0 00001050 424120746F206163 0 00001058 6365737320706172 0 00001060 746974696F6E2E0A 0 00001068 00 === Switch to base=002270h -> ".TEXT" 1691 .text 1692 .global _ScanForPrimaryPartitions 1693 .type _ScanForPrimaryPartitions, @function 1694 _ScanForPrimaryPartitions: 1695 _.LFB16: 863:initdisk.c **** int i; 1696 .loc 1 863 0 1697 _.LVL145: 0 000041CB 56 push si 0 000041CC 57 push di 0 000041CD 55 push bp 1701 _.LCFI24: 0 000041CE 89E5 mov bp, sp 1703 _.LCFI25: 0 000041D0 83EC26 sub sp, 38 0 000041D3 8B760C mov si, word ptr [bp+12] 0 000041D6 C4460E les ax, dword ptr [bp+14] 0 000041D9 8946DE mov word ptr [bp-34], ax 0 000041DC 8C46DC mov word ptr [bp-36], es 1709 _.LVL146: 863:initdisk.c **** int i; 1710 .loc 1 863 0 0 000041DF 8B4612 mov ax, word ptr [bp+18] 0 000041E2 8946E4 mov word ptr [bp-28], ax 869:initdisk.c **** { 1713 .loc 1 869 0 0 000041E5 C746E60000 mov word ptr [bp-26], 0 1715 _.LVL147: 1716 _.L165: 871:initdisk.c **** continue; 1717 .loc 1 871 0 0 000041EA 8A4401 mov al, byte ptr [si+1] 0 000041ED 3C0F cmp al, 15 0 000041EF 770F ja _.L152 0 000041F1 88C1 mov cl, al 0 000041F3 BA2180 mov dx, -32735 0 000041F6 D3EA shr dx, cl 0 000041F8 F6C201 test dl, 1 0 000041FB 7403E9D700 jne _.L153 1726 _.L152: 874:initdisk.c **** continue; 1727 .loc 1 874 0 0 00004200 8A4EE6 mov cl, byte ptr [bp-26] 0 00004203 8B56E4 mov dx, word ptr [bp-28] 0 00004206 D3FA sar dx, cl 0 00004208 F6C201 test dl, 1 0 0000420B 7403E9C700 jne _.L153 880:initdisk.c **** continue; 1733 .loc 1 880 0 0 00004210 837E0A00 cmp word ptr [bp+10], 0 0 00004214 7508 jne _.L154 880:initdisk.c **** continue; 1736 .loc 1 880 0 is_stmt 0 discriminator 1 0 00004216 803C00 cmp byte ptr [si], 0 0 00004219 7503E9B900 je _.L153 1739 _.L154: 883:initdisk.c **** 1740 .loc 1 883 0 is_stmt 1 0 0000421E 8B540E mov dx, word ptr [si+14] 0 00004221 8B4C10 mov cx, word ptr [si+16] 0 00004224 0356DE add dx, word ptr [bp-34] 0 00004227 8956E2 mov word ptr [bp-30], dx 0 0000422A 134EDC adc cx, word ptr [bp-36] 0 0000422D 894EE0 mov word ptr [bp-32], cx 1747 _.LVL148: 885:initdisk.c **** { 1748 .loc 1 885 0 0 00004230 3C0E cmp al, 14 0 00004232 7603E9A000 ja _.L153 0 00004237 BA5258 mov dx, 22610 1752 _.LVL149: 0 0000423A 88C1 mov cl, al 1754 _.LVL150: 0 0000423C D3EA shr dx, cl 0 0000423E F6C201 test dl, 1 0 00004241 7503E99100 je _.L153 890:initdisk.c **** sprintf(partitionName, "Ext:%d", extendedPartNo); 1758 .loc 1 890 0 0 00004246 837E1400 cmp word ptr [bp+20], 0 0 0000424A 7503E99A00 je _.L155 891:initdisk.c **** else 1761 .loc 1 891 0 0 0000424F FF7614 push word ptr [bp+20] 0 00004252 B8[3202] mov ax, offset _.LC22 1764 _.L185: 893:initdisk.c **** 1765 .loc 1 893 0 0 00004255 50 push ax 0 00004256 8D46F4 lea ax, [-12+bp] 0 00004259 50 push ax 0 0000425A E8[FEFF] call _init_sprintf 1770 _.LVL151: 0 0000425D 83C406 add sp, 6 899:initdisk.c **** LBA_to_CHS(&end, partitionStart + pEntry->NumSect - 1, driveParam); 1772 .loc 1 899 0 0 00004260 FF7608 push word ptr [bp+8] 0 00004263 FF76E0 push word ptr [bp-32] 0 00004266 FF76E2 push word ptr [bp-30] 0 00004269 8D7EE8 lea di, [-24+bp] 0 0000426C 57 push di 0 0000426D E8[FEFF] call _init_LBA_to_CHS 1779 _.LVL152: 900:initdisk.c **** 1780 .loc 1 900 0 0 00004270 FF7608 push word ptr [bp+8] 0 00004273 8B4412 mov ax, word ptr [si+18] 0 00004276 8B5414 mov dx, word ptr [si+20] 0 00004279 83C0FF add ax, -1 0 0000427C 83D2FF adc dx, -1 0 0000427F 0346E2 add ax, word ptr [bp-30] 0 00004282 1356E0 adc dx, word ptr [bp-32] 0 00004285 52 push dx 0 00004286 50 push ax 0 00004287 8D46EE lea ax, [-18+bp] 0 0000428A 50 push ax 0 0000428B E8[FEFF] call _init_LBA_to_CHS 1793 _.LVL153: 0 0000428E 8D5402 lea dx, [2+si] 906:initdisk.c **** { 1795 .loc 1 906 0 0 00004291 52 push dx 0 00004292 8956DA mov word ptr [bp-38], dx 0 00004295 57 push di 0 00004296 E8[FEFF] call _is_suspect 1800 _.LVL154: 0 00004299 85C0 test ax, ax 0 0000429B 8B56DA mov dx, word ptr [bp-38] 0 0000429E 740C je _.L157 908:initdisk.c **** &pEntry->Begin); 1804 .loc 1 908 0 0 000042A0 52 push dx 0 000042A1 57 push di 0 000042A2 FF7401 push word ptr [si+1] 0 000042A5 8D46F4 lea ax, [-12+bp] 0 000042A8 50 push ax 0 000042A9 E8[FEFF] call _print_warning_suspect 1811 _.LVL155: 1812 _.L157: 0 000042AC 8D5408 lea dx, [8+si] 912:initdisk.c **** { 1814 .loc 1 912 0 0 000042AF 52 push dx 0 000042B0 8956DA mov word ptr [bp-38], dx 0 000042B3 8D7EEE lea di, [-18+bp] 0 000042B6 57 push di 0 000042B7 E8[FEFF] call _is_suspect 1820 _.LVL156: 0 000042BA 85C0 test ax, ax 0 000042BC 7442 je _.L158 914:initdisk.c **** { 1823 .loc 1 914 0 0 000042BE 8B4414 mov ax, word ptr [si+20] 0 000042C1 0B4412 or ax, word ptr [si+18] 0 000042C4 8B56DA mov dx, word ptr [bp-38] 0 000042C7 752B jne _.L159 916:initdisk.c **** continue; 1828 .loc 1 916 0 0 000042C9 8D46F4 lea ax, [-12+bp] 0 000042CC 50 push ax 0 000042CD B8[4002] mov ax, offset _.LC24 0 000042D0 50 push ax 0 000042D1 E8[FEFF] call _init_printf 1834 _.LVL157: 917:initdisk.c **** } 1835 .loc 1 917 0 0 000042D4 83C404 add sp, 4 1837 _.LVL158: 1838 _.L153: 869:initdisk.c **** { 1839 .loc 1 869 0 discriminator 2 0 000042D7 FF46E6 inc word ptr [bp-26] 1841 _.LVL159: 0 000042DA 83C616 add si, 22 1843 _.LVL160: 0 000042DD 837EE604 cmp word ptr [bp-26], 4 0 000042E1 7403E904FF jne _.L165 0 000042E6 E9EE00 jmp _.L151 1847 _.LVL161: 1848 _.L155: 893:initdisk.c **** 1849 .loc 1 893 0 0 000042E9 8B46E6 mov ax, word ptr [bp-26] 0 000042EC 40 inc ax 0 000042ED 50 push ax 0 000042EE B8[3902] mov ax, offset _.LC23 0 000042F1 E961FF jmp _.L185 1855 _.L159: 919:initdisk.c **** &pEntry->End); 1856 .loc 1 919 0 0 000042F4 52 push dx 0 000042F5 57 push di 0 000042F6 FF7401 push word ptr [si+1] 0 000042F9 8D46F4 lea ax, [-12+bp] 0 000042FC 50 push ax 0 000042FD E8[FEFF] call _print_warning_suspect 1863 _.LVL162: 1864 _.L158: 923:initdisk.c **** { 1865 .loc 1 923 0 0 00004300 817EE8FF03 cmp word ptr [bp-24], 1023 0 00004305 770A ja _.L160 923:initdisk.c **** { 1868 .loc 1 923 0 is_stmt 0 discriminator 1 0 00004307 817EEEFF03 cmp word ptr [bp-18], 1023 0 0000430C 7703E99F00 jbe _.L161 1871 _.L160: 927:initdisk.c **** { 1872 .loc 1 927 0 is_stmt 1 0 00004311 8B5E08 mov bx, word ptr [bp+8] 0 00004314 F6470204 test byte ptr [bx+2], 4 0 00004318 7533 jne _.L162 929:initdisk.c **** ("can't use LBA partition without LBA support - part %s FS %02x", 1876 .loc 1 929 0 0 0000431A 8A4401 mov al, byte ptr [si+1] 0 0000431D 30E4 xor ah, ah 0 0000431F 50 push ax 0 00004320 8D46F4 lea ax, [-12+bp] 0 00004323 50 push ax 0 00004324 B8[6702] mov ax, offset _.LC25 0 00004327 50 push ax 0 00004328 E8[FEFF] call _init_printf 1885 _.LVL163: 933:initdisk.c **** printCHS(", end ", &end); 1886 .loc 1 933 0 0 0000432B 8D46E8 lea ax, [-24+bp] 0 0000432E 50 push ax 0 0000432F B8[A502] mov ax, offset _.LC26 0 00004332 50 push ax 0 00004333 E8[FEFF] call _printCHS 1892 _.LVL164: 934:initdisk.c **** printf("\n"); 1893 .loc 1 934 0 0 00004336 8D46EE lea ax, [-18+bp] 0 00004339 50 push ax 0 0000433A B8[AD02] mov ax, offset _.LC27 0 0000433D 50 push ax 0 0000433E E8[FEFF] call _printCHS 1899 _.LVL165: 935:initdisk.c **** 1900 .loc 1 935 0 0 00004341 B8[3002] mov ax, offset _.LC21 0 00004344 50 push ax 0 00004345 E8[FEFF] call _init_printf 1904 _.LVL166: 937:initdisk.c **** } 1905 .loc 1 937 0 0 00004348 83C408 add sp, 8 0 0000434B EB8A jmp _.L153 1908 _.L162: 944:initdisk.c **** { 1909 .loc 1 944 0 0 0000434D 803E[0B00]01 cmp byte ptr [_InitKernelConfig+11], 1 0 00004352 735C jnc _.L161 944:initdisk.c **** { 1912 .loc 1 944 0 is_stmt 0 discriminator 1 0 00004354 8A4401 mov al, byte ptr [si+1] 0 00004357 88C4 mov ah, al 0 00004359 80E4FD and ah, -3 0 0000435C 80FC0C cmp ah, 12 0 0000435F 744F je _.L161 0 00004361 3CFF cmp al, -1 0 00004363 734B jnc _.L161 944:initdisk.c **** { 1920 .loc 1 944 0 discriminator 3 0 00004365 833E[0000]00 cmp word ptr [_ExtLBAForce], 0 0 0000436A 7544 jne _.L161 946:initdisk.c **** ("WARNING: Partition ID does not suggest LBA - part %s FS %02x.\n" 1923 .loc 1 946 0 is_stmt 1 0 0000436C 30E4 xor ah, ah 0 0000436E 50 push ax 0 0000436F 8D46F4 lea ax, [-12+bp] 0 00004372 50 push ax 0 00004373 B8[B402] mov ax, offset _.LC28 0 00004376 50 push ax 0 00004377 E8[FEFF] call _init_printf 1931 _.LVL167: 951:initdisk.c **** printCHS(", end ", &end); 1932 .loc 1 951 0 0 0000437A 8D46E8 lea ax, [-24+bp] 0 0000437D 50 push ax 0 0000437E B8[A502] mov ax, offset _.LC26 0 00004381 50 push ax 0 00004382 E8[FEFF] call _printCHS 1938 _.LVL168: 952:initdisk.c **** printf("\n"); 1939 .loc 1 952 0 0 00004385 8D46EE lea ax, [-18+bp] 0 00004388 50 push ax 0 00004389 B8[AD02] mov ax, offset _.LC27 0 0000438C 50 push ax 0 0000438D E8[FEFF] call _printCHS 1945 _.LVL169: 953:initdisk.c **** pEntry->FileSystem = (pEntry->FileSystem == FAT12 ? FAT12_LBA : 1946 .loc 1 953 0 0 00004390 B8[3002] mov ax, offset _.LC21 0 00004393 50 push ax 0 00004394 E8[FEFF] call _init_printf 1950 _.LVL170: 954:initdisk.c **** pEntry->FileSystem == FAT32 ? FAT32_LBA : 1951 .loc 1 954 0 0 00004397 8A6401 mov ah, byte ptr [si+1] 0 0000439A 83C408 add sp, 8 0 0000439D B0FF mov al, -1 0 0000439F 80FC01 cmp ah, 1 0 000043A2 7409 je _.L163 954:initdisk.c **** pEntry->FileSystem == FAT32 ? FAT32_LBA : 1957 .loc 1 954 0 is_stmt 0 discriminator 1 0 000043A4 B00C mov al, 12 0 000043A6 80FC0B cmp ah, 11 0 000043A9 7402 je _.L163 954:initdisk.c **** pEntry->FileSystem == FAT32 ? FAT32_LBA : 1961 .loc 1 954 0 0 000043AB B00E mov al, 14 1963 _.L163: 954:initdisk.c **** pEntry->FileSystem == FAT32 ? FAT32_LBA : 1964 .loc 1 954 0 discriminator 8 0 000043AD 884401 mov byte ptr [si+1], al 1966 _.L161: 974:initdisk.c **** 1967 .loc 1 974 0 is_stmt 1 0 000043B0 8A4EE6 mov cl, byte ptr [bp-26] 0 000043B3 B80100 mov ax, 1 0 000043B6 D3E0 shl ax, cl 0 000043B8 0946E4 or word ptr [bp-28], ax 1972 _.LVL171: 976:initdisk.c **** extendedPartNo, i); 1973 .loc 1 976 0 0 000043BB FF76E6 push word ptr [bp-26] 0 000043BE FF7614 push word ptr [bp+20] 0 000043C1 56 push si 0 000043C2 FF76E0 push word ptr [bp-32] 0 000043C5 FF76E2 push word ptr [bp-30] 0 000043C8 FF7608 push word ptr [bp+8] 0 000043CB E8[FEFF] call _DosDefinePartition 1981 _.LVL172: 979:initdisk.c **** { 1982 .loc 1 979 0 0 000043CE 837E0A01 cmp word ptr [bp+10], 1 0 000043D2 7603E900FF ja _.L153 1985 _.LVL173: 1986 _.L151: 986:initdisk.c **** 1987 .loc 1 986 0 0 000043D7 8B46E4 mov ax, word ptr [bp-28] 0 000043DA 89EC mov sp, bp 0 000043DC 5D pop bp 0 000043DD 5F pop di 0 000043DE 5E pop si 1993 _.LVL174: 0 000043DF C20E00 ret 14 1995 _.LFE16: 1996 .size _ScanForPrimaryPartitions, .-_ScanForPrimaryPartitions === Switch to base=012BB0h -> ".RODATA.STR1.1" 1997 .section .rodata.str1.1 1998 _.LC29: 0 00001069 6E6F206861726420 .string "no hard disks detected\n" 0 00001071 6469736B73206465 0 00001079 7465637465640A00 === Switch to base=002270h -> ".TEXT" 2000 .text 2001 .global _BIOS_nrdrives 2002 .type _BIOS_nrdrives, @function 2003 _BIOS_nrdrives: 2004 _.LFB19: 1178:initdisk.c **** iregs regs; 2005 .loc 1 1178 0 0 000043E2 55 push bp 2007 _.LCFI26: 0 000043E3 89E5 mov bp, sp 2009 _.LCFI27: 0 000043E5 83EC18 sub sp, 24 1181:initdisk.c **** regs.d.b.l = 0x80; 2011 .loc 1 1181 0 0 000043E8 C646E908 mov byte ptr [bp-23], 8 1182:initdisk.c **** init_call_intr(0x13, ®s); 2013 .loc 1 1182 0 0 000043EC C646EE80 mov byte ptr [bp-18], -128 1183:initdisk.c **** 2015 .loc 1 1183 0 0 000043F0 8D46E8 lea ax, [-24+bp] 0 000043F3 50 push ax 0 000043F4 B81300 mov ax, 19 0 000043F7 50 push ax 0 000043F8 E8[FEFF] call _init_call_intr 2021 _.LVL175: 1185:initdisk.c **** { 2022 .loc 1 1185 0 0 000043FB F646FE01 test byte ptr [bp-2], 1 0 000043FF 7410 je _.L187 1187:initdisk.c **** return 0; 2025 .loc 1 1187 0 0 00004401 B8[3503] mov ax, offset _.LC29 0 00004404 50 push ax 0 00004405 E8[FEFF] call _init_printf 2029 _.LVL176: 1188:initdisk.c **** } 2030 .loc 1 1188 0 0 00004408 83C402 add sp, 2 0 0000440B 31C0 xor ax, ax 2033 _.L186: 1192:initdisk.c **** 2034 .loc 1 1192 0 0 0000440D 89EC mov sp, bp 0 0000440F 5D pop bp 0 00004410 C3 ret 2038 _.L187: 1191:initdisk.c **** } 2039 .loc 1 1191 0 0 00004411 8A46EE mov al, byte ptr [bp-18] 0 00004414 30E4 xor ah, ah 0 00004416 EBF5 jmp _.L186 2043 _.LFE19: 2044 .size _BIOS_nrdrives, .-_BIOS_nrdrives 2045 .global _BIOS_drive_reset 2046 .type _BIOS_drive_reset, @function 2047 _BIOS_drive_reset: 2048 _.LFB20: 1195:initdisk.c **** iregs regs; 2049 .loc 1 1195 0 2050 _.LVL177: 0 00004418 55 push bp 2052 _.LCFI28: 0 00004419 89E5 mov bp, sp 2054 _.LCFI29: 0 0000441B 83EC18 sub sp, 24 1198:initdisk.c **** regs.a.b.h = 0; 2056 .loc 1 1198 0 0 0000441E 8A4604 mov al, byte ptr [bp+4] 0 00004421 0C80 or al, -128 0 00004423 8846EE mov byte ptr [bp-18], al 1199:initdisk.c **** 2060 .loc 1 1199 0 0 00004426 C646E900 mov byte ptr [bp-23], 0 1201:initdisk.c **** } 2062 .loc 1 1201 0 0 0000442A 8D46E8 lea ax, [-24+bp] 0 0000442D 50 push ax 0 0000442E B81300 mov ax, 19 0 00004431 50 push ax 0 00004432 E8[FEFF] call _init_call_intr 2068 _.LVL178: 1202:initdisk.c **** 2069 .loc 1 1202 0 0 00004435 89EC mov sp, bp 0 00004437 5D pop bp 0 00004438 C20200 ret 2 2073 _.LFE20: 2074 .size _BIOS_drive_reset, .-_BIOS_drive_reset === Switch to base=012BB0h -> ".RODATA.STR1.1" 2075 .section .rodata.str1.1 2076 _.LC30: 0 00001081 7265747279232025 .string "retry# %i sector %lu\n" 0 00001089 6920736563746F72 0 00001091 20256C750A00 2078 _.LC31: 0 00001097 4C4241206D6F6465 .string "LBA mode\n" 0 0000109F 0A00 2080 _.LC32: 0 000010A1 434853206D6F6465 .string "CHS mode\n" 0 000010A9 0A00 2082 _.LC33: 0 000010AB 4C42412D5472616E .string "LBA-Transfer error : address = %lu, cylinder %u > 1023\n" 0 000010B3 7366657220657272 0 000010BB 6F72203A20616464 0 000010C3 72657373203D2025 0 000010CB 6C752C2063796C69 0 000010D3 6E64657220257520 0 000010DB 3E20313032330A00 === Switch to base=002270h -> ".TEXT" 2084 .text 2085 .global _Read1LBASector 2086 .type _Read1LBASector, @function 2087 _Read1LBASector: 2088 _.LFB17: 992:initdisk.c **** static struct _bios_LBA_address_packet dap = { 2089 .loc 1 992 0 2090 _.LVL179: 0 0000443B 56 push si 0 0000443C 57 push di 0 0000443D 55 push bp 2094 _.LCFI30: 0 0000443E 89E5 mov bp, sp 2096 _.LCFI31: 0 00004440 83EC28 sub sp, 40 0 00004443 8B760C mov si, word ptr [bp+12] 0 00004446 8B460E mov ax, word ptr [bp+14] 0 00004449 8946E0 mov word ptr [bp-32], ax 2101 _.LVL180: 1054:initdisk.c **** regs.c.x = 2102 .loc 1 1054 0 0 0000444C 8C56DC mov word ptr [bp-36], ss 1013:initdisk.c **** { 2104 .loc 1 1013 0 0 0000444F C746DE0000 mov word ptr [bp-34], 0 0 00004454 BF[0000] mov di, offset _dap.2011 1020:initdisk.c **** LBA_to_CHS(&chs, LBA_address, driveParam); 2107 .loc 1 1020 0 0 00004457 8A460A mov al, byte ptr [bp+10] 0 0000445A 0C80 or al, -128 0 0000445C 8846DB mov byte ptr [bp-37], al 2111 _.LVL181: 2112 _.L202: 1015:initdisk.c **** { 2113 .loc 1 1015 0 0 0000445F BB[0000] mov bx, offset _InitKernelConfig 0 00004462 807F1500 cmp byte ptr [bx+21], 0 0 00004466 7E17 jle _.L193 0 00004468 895ED8 mov word ptr [bp-40], bx 1017:initdisk.c **** } 2118 .loc 1 1017 0 0 0000446B FF76E0 push word ptr [bp-32] 0 0000446E 56 push si 0 0000446F FF76DE push word ptr [bp-34] 0 00004472 B8[4D03] mov ax, offset _.LC30 0 00004475 50 push ax 0 00004476 E8[FEFF] call _init_printf 2125 _.LVL182: 0 00004479 83C408 add sp, 8 0 0000447C 8B5ED8 mov bx, word ptr [bp-40] 2128 _.L193: 0 0000447F 895ED8 mov word ptr [bp-40], bx 1020:initdisk.c **** LBA_to_CHS(&chs, LBA_address, driveParam); 2130 .loc 1 1020 0 0 00004482 8A46DB mov al, byte ptr [bp-37] 0 00004485 8846EE mov byte ptr [bp-18], al 1021:initdisk.c **** /* Some old "security" software (PROT) traps int13 and assumes non 2133 .loc 1 1021 0 0 00004488 FF7608 push word ptr [bp+8] 0 0000448B FF76E0 push word ptr [bp-32] 0 0000448E 56 push si 0 0000448F 8D46E2 lea ax, [-30+bp] 0 00004492 50 push ax 0 00004493 E8[FEFF] call _init_LBA_to_CHS 2140 _.LVL183: 1028:initdisk.c **** (InitKernelConfig.ForceLBA || ExtLBAForce || (chs.Cylinder > 1023))) 2141 .loc 1 1028 0 0 00004496 8B5E08 mov bx, word ptr [bp+8] 0 00004499 F6470204 test byte ptr [bx+2], 4 0 0000449D 8B5ED8 mov bx, word ptr [bp-40] 0 000044A0 7473 je _.L194 1028:initdisk.c **** (InitKernelConfig.ForceLBA || ExtLBAForce || (chs.Cylinder > 1023))) 2146 .loc 1 1028 0 is_stmt 0 discriminator 1 0 000044A2 807F0B00 cmp byte ptr [bx+11], 0 0 000044A6 750E jne _.L195 1029:initdisk.c **** { 2149 .loc 1 1029 0 is_stmt 1 0 000044A8 833E[0000]00 cmp word ptr [_ExtLBAForce], 0 0 000044AD 7507 jne _.L195 1029:initdisk.c **** { 2152 .loc 1 1029 0 is_stmt 0 discriminator 1 0 000044AF 817EE2FF03 cmp word ptr [bp-30], 1023 0 000044B4 765F jbe _.L194 2155 _.L195: 1031:initdisk.c **** dap.number_of_blocks = 1; 2156 .loc 1 1031 0 is_stmt 1 0 000044B6 807F1500 cmp byte ptr [bx+21], 0 0 000044BA 7E0A jle _.L196 1031:initdisk.c **** dap.number_of_blocks = 1; 2159 .loc 1 1031 0 is_stmt 0 discriminator 1 0 000044BC B8[6303] mov ax, offset _.LC31 0 000044BF 50 push ax 0 000044C0 E8[FEFF] call _init_printf 2163 _.LVL184: 0 000044C3 83C402 add sp, 2 2165 _.L196: 1032:initdisk.c **** dap.buffer_address = buffer; 2166 .loc 1 1032 0 is_stmt 1 0 000044C6 C606[0200]01 mov byte ptr [_dap.2011+2], 1 1033:initdisk.c **** dap.block_address_high = 0; /* clear high part */ 2168 .loc 1 1033 0 0 000044CB 8B4610 mov ax, word ptr [bp+16] 0 000044CE 894504 mov word ptr [di+4], ax 0 000044D1 8B46DC mov ax, word ptr [bp-36] 0 000044D4 894506 mov word ptr [di+6], ax 1034:initdisk.c **** dap.block_address = LBA_address; /* clear high part */ 2173 .loc 1 1034 0 0 000044D7 C706[0C00]0000 mov word ptr [_dap.2011+12], 0 0 000044DD C706[0E00]0000 mov word ptr [_dap.2011+14], 0 1035:initdisk.c **** 2176 .loc 1 1035 0 0 000044E3 897508 mov word ptr [di+8], si 0 000044E6 8B46E0 mov ax, word ptr [bp-32] 0 000044E9 89450A mov word ptr [di+10], ax 1038:initdisk.c **** regs.si = FP_OFF(&dap); 2180 .loc 1 1038 0 0 000044EC C746E80042 mov word ptr [bp-24], 16896 1039:initdisk.c **** regs.ds = FP_SEG(&dap); 2182 .loc 1 1039 0 0 000044F1 C746F0[0000] mov word ptr [bp-16], offset _dap.2011 1040:initdisk.c **** } 2184 .loc 1 1040 0 0 000044F6 8B46DC mov ax, word ptr [bp-36] 0 000044F9 8946F6 mov word ptr [bp-10], ax 2187 _.L197: 1061:initdisk.c **** if ((regs.flags & FLG_CARRY) == 0) 2188 .loc 1 1061 0 0 000044FC 8D46E8 lea ax, [-24+bp] 0 000044FF 50 push ax 0 00004500 B81300 mov ax, 19 0 00004503 50 push ax 0 00004504 E8[FEFF] call _init_call_intr 2194 _.LVL185: 1062:initdisk.c **** break; 2195 .loc 1 1062 0 0 00004507 F646FE01 test byte ptr [bp-2], 1 0 0000450B 7568 jne _.L201 2198 _.L203: 1067:initdisk.c **** } 2199 .loc 1 1067 0 0 0000450D 8A46FE mov al, byte ptr [bp-2] 0 00004510 83E001 and ax, 1 0 00004513 EB2A jmp _.L192 2203 _.L194: 1044:initdisk.c **** /* avoid overflow at end of track */ 2204 .loc 1 1044 0 0 00004515 807F1500 cmp byte ptr [bx+21], 0 0 00004519 7E0A jle _.L198 1044:initdisk.c **** /* avoid overflow at end of track */ 2207 .loc 1 1044 0 is_stmt 0 discriminator 1 0 0000451B B8[6D03] mov ax, offset _.LC32 0 0000451E 50 push ax 0 0000451F E8[FEFF] call _init_printf 2211 _.LVL186: 0 00004522 83C402 add sp, 2 2213 _.L198: 1047:initdisk.c **** { 2214 .loc 1 1047 0 is_stmt 1 0 00004525 8B46E2 mov ax, word ptr [bp-30] 0 00004528 3DFF03 cmp ax, 1023 0 0000452B 761A jbe _.L199 1049:initdisk.c **** return 1; 2218 .loc 1 1049 0 0 0000452D 50 push ax 0 0000452E FF76E0 push word ptr [bp-32] 0 00004531 56 push si 0 00004532 B8[7703] mov ax, offset _.LC33 0 00004535 50 push ax 0 00004536 E8[FEFF] call _init_printf 2225 _.LVL187: 1050:initdisk.c **** } 2226 .loc 1 1050 0 0 00004539 83C408 add sp, 8 0 0000453C B80100 mov ax, 1 2229 _.L192: 1068:initdisk.c **** 2230 .loc 1 1068 0 0 0000453F 89EC mov sp, bp 0 00004541 5D pop bp 0 00004542 5F pop di 0 00004543 5E pop si 0 00004544 C20A00 ret 10 2236 _.L199: 1053:initdisk.c **** regs.b.x = FP_OFF(buffer); 2237 .loc 1 1053 0 0 00004547 C746E80102 mov word ptr [bp-24], 513 1054:initdisk.c **** regs.c.x = 2239 .loc 1 1054 0 0 0000454C 8B5610 mov dx, word ptr [bp+16] 0 0000454F 8956EA mov word ptr [bp-22], dx 1056:initdisk.c **** chs.Sector; 2242 .loc 1 1056 0 0 00004552 89C2 mov dx, ax 0 00004554 B108 mov cl, 8 0 00004556 D3E2 shl dx, cl 0 00004558 0356E6 add dx, word ptr [bp-26] 0 0000455B B102 mov cl, 2 0 0000455D D3E8 shr ax, cl 0 0000455F 25C000 and ax, 192 0 00004562 01D0 add ax, dx 0 00004564 8946EC mov word ptr [bp-20], ax 1058:initdisk.c **** regs.es = FP_SEG(buffer); 2252 .loc 1 1058 0 0 00004567 8B46E4 mov ax, word ptr [bp-28] 0 0000456A 8846EF mov byte ptr [bp-17], al 1059:initdisk.c **** } /* end of retries */ 2255 .loc 1 1059 0 0 0000456D 8B46DC mov ax, word ptr [bp-36] 0 00004570 8946F8 mov word ptr [bp-8], ax 0 00004573 EB87 jmp _.L197 2259 _.L201: 1064:initdisk.c **** } 2260 .loc 1 1064 0 discriminator 2 0 00004575 8B5E08 mov bx, word ptr [bp+8] 0 00004578 8A07 mov al, byte ptr [bx] 0 0000457A 30E4 xor ah, ah 0 0000457C 50 push ax 0 0000457D E8[FEFF] call _BIOS_drive_reset 2266 _.LVL188: 1013:initdisk.c **** { 2267 .loc 1 1013 0 discriminator 2 0 00004580 FF46DE inc word ptr [bp-34] 2269 _.LVL189: 0 00004583 837EDE05 cmp word ptr [bp-34], 5 0 00004587 7403E9D3FE jne _.L202 0 0000458C E97EFF jmp _.L203 2273 _.LFE17: 2274 .size _Read1LBASector, .-_Read1LBASector === Switch to base=012BB0h -> ".RODATA.STR1.1" 2275 .section .rodata.str1.1 2276 _.LC34: 0 000010E3 63616E2774206765 .string "can't get drive parameters for drive %02x\n" 0 000010EB 7420647269766520 0 000010F3 706172616D657465 0 000010FB 727320666F722064 0 00001103 7269766520253032 0 0000110B 780A00 2278 _.LC35: 0 0000110E 4572726F72207265 .string "Error reading partition table drive %02Xh sector %lu" 0 00001116 6164696E67207061 0 0000111E 72746974696F6E20 0 00001126 7461626C65206472 0 0000112E 6976652025303258 0 00001136 6820736563746F72 0 0000113E 20256C7500 2280 _.LC36: 0 00001143 696C6C6567616C20 .string "illegal partition table - drive %02x sector %lu\n" 0 0000114B 706172746974696F 0 00001153 6E207461626C6520 0 0000115B 2D20647269766520 0 00001163 2530327820736563 0 0000116B 746F7220256C750A 0 00001173 00 2282 _.LC37: 0 00001174 666F756E64206D6F .string "found more then 30 extended partitions, terminated\n" 0 0000117C 7265207468656E20 0 00001184 333020657874656E 0 0000118C 6465642070617274 0 00001194 6974696F6E732C20 0 0000119C 7465726D696E6174 0 000011A4 65640A00 === Switch to base=002270h -> ".TEXT" 2284 .text 2285 .global _ProcessDisk 2286 .type _ProcessDisk, @function 2287 _ProcessDisk: 2288 _.LFB18: 1072:initdisk.c **** /* note: error messages are only printed on first call, where (scanType==SCAN_PRIMARYBOOT) */ 2289 .loc 1 1072 0 2290 _.LVL190: 0 0000458F 56 push si 0 00004590 57 push di 0 00004591 55 push bp 2294 _.LCFI32: 0 00004592 89E5 mov bp, sp 2296 _.LCFI33: 0 00004594 83EC74 sub sp, 116 0 00004597 8B760C mov si, word ptr [bp+12] 2299 _.LVL191: 1088:initdisk.c **** { 2300 .loc 1 1088 0 0 0000459A 837E0801 cmp word ptr [bp+8], 1 0 0000459E BF0000 mov di, 0 0 000045A1 19C0 sbb ax, ax 0 000045A3 F7D8 neg ax 0 000045A5 50 push ax 0 000045A6 8D469B lea ax, [-101+bp] 0 000045A9 50 push ax 0 000045AA FF760A push word ptr [bp+10] 0 000045AD E85FF2 call _LBA_Get_Drive_Parameters 2310 _.LVL192: 0 000045B0 39F8 cmp ax, di 0 000045B2 7516 jne _.L210 1090:initdisk.c **** return PartitionsToIgnore; 2313 .loc 1 1090 0 0 000045B4 FF760A push word ptr [bp+10] 0 000045B7 B8[AF03] mov ax, offset _.LC34 0 000045BA 50 push ax 0 000045BB E8[FEFF] call _init_printf 2318 _.LVL193: 1091:initdisk.c **** } 2319 .loc 1 1091 0 0 000045BE 83C404 add sp, 4 2321 _.LVL194: 2322 _.L211: 1175:initdisk.c **** 2323 .loc 1 1175 0 0 000045C1 96 xchg si, ax 0 000045C2 89EC mov sp, bp 0 000045C4 5D pop bp 0 000045C5 5F pop di 0 000045C6 5E pop si 0 000045C7 C20600 ret 6 2330 _.LVL195: 2331 _.L210: 1096:initdisk.c **** within a type 0x0E LBA extended partition, 2332 .loc 1 1096 0 0 000045CA 893E[0000] mov word ptr [_ExtLBAForce], di 1095:initdisk.c **** ExtLBAForce = 0; /* initially we are not dealing with partitions 2334 .loc 1 1095 0 0 000045CE 897E96 mov word ptr [bp-106], di 0 000045D1 897E94 mov word ptr [bp-108], di 1094:initdisk.c **** ExtendedPartitionOffset = 0; /* not found yet */ 2337 .loc 1 1094 0 0 000045D4 897E98 mov word ptr [bp-104], di 0 000045D7 89FB mov bx, di 2340 _.LVL196: 2341 _.L212: 0 000045D9 C746900300 mov word ptr [bp-112], 3 2343 _.LVL197: 2344 _.L213: 1107:initdisk.c **** (&driveParam, drive, RelSectorOffset, InitDiskTransferBuffer)) 2345 .loc 1 1107 0 0 000045DE BA[0000] mov dx, offset _InitDiskTransferBuffer 0 000045E1 52 push dx 0 000045E2 89568C mov word ptr [bp-116], dx 0 000045E5 53 push bx 0 000045E6 895E8E mov word ptr [bp-114], bx 0 000045E9 FF7698 push word ptr [bp-104] 0 000045EC FF760A push word ptr [bp+10] 0 000045EF 8D469B lea ax, [-101+bp] 0 000045F2 50 push ax 0 000045F3 E8[FEFF] call _Read1LBASector 2356 _.LVL198: 0 000045F6 894692 mov word ptr [bp-110], ax 0 000045F9 85C0 test ax, ax 0 000045FB 8B5E8E mov bx, word ptr [bp-114] 0 000045FE 8B568C mov dx, word ptr [bp-116] 0 00004601 7413 je _.L214 1110:initdisk.c **** RelSectorOffset); 2362 .loc 1 1110 0 0 00004603 53 push bx 0 00004604 FF7698 push word ptr [bp-104] 0 00004607 FF760A push word ptr [bp+10] 0 0000460A B8[DA03] mov ax, offset _.LC35 2367 _.LVL199: 2368 _.L231: 1125:initdisk.c **** RelSectorOffset); 2369 .loc 1 1125 0 discriminator 1 0 0000460D 50 push ax 0 0000460E E8[FEFF] call _init_printf 2372 _.LVL200: 0 00004611 83C408 add sp, 8 0 00004614 EBAB jmp _.L211 2375 _.LVL201: 2376 _.L214: 0 00004616 895E8E mov word ptr [bp-114], bx 1115:initdisk.c **** { 2378 .loc 1 1115 0 0 00004619 52 push dx 0 0000461A 8D46A8 lea ax, [-88+bp] 0 0000461D 50 push ax 0 0000461E E8[FEFF] call _ConvPartTableEntryToIntern 2383 _.LVL202: 0 00004621 85C0 test ax, ax 0 00004623 8B5E8E mov bx, word ptr [bp-114] 0 00004626 7517 jne _.L215 2387 _.LVL203: 1122:initdisk.c **** goto strange_restart; 2388 .loc 1 1122 0 0 00004628 FF4E90 dec word ptr [bp-112] 2390 _.LVL204: 0 0000462B 75B1 jne _.L213 1125:initdisk.c **** RelSectorOffset); 2392 .loc 1 1125 0 0 0000462D 837E0800 cmp word ptr [bp+8], 0 0 00004631 758E jne _.L211 1125:initdisk.c **** RelSectorOffset); 2395 .loc 1 1125 0 is_stmt 0 discriminator 1 0 00004633 53 push bx 0 00004634 FF7698 push word ptr [bp-104] 0 00004637 FF760A push word ptr [bp+10] 0 0000463A B8[0F04] mov ax, offset _.LC36 0 0000463D EBCE jmp _.L231 2401 _.LVL205: 2402 _.L215: 1130:initdisk.c **** scanType == SCAN_PRIMARY || 2403 .loc 1 1130 0 is_stmt 1 0 0000463F 837E0802 cmp word ptr [bp+8], 1+1 0 00004643 18C0 sbb al, al 0 00004645 F6D8 neg al 1132:initdisk.c **** { 2407 .loc 1 1132 0 0 00004647 837E0803 cmp word ptr [bp+8], 3 0 0000464B 9F lahf 0 0000464C D0E4 shl ah, 1 0 0000464E 99 cwd 0 0000464F F6DA neg dl 0 00004651 08D0 or al, dl 0 00004653 7504 jne _.L222 0 00004655 85FF test di, di 0 00004657 7415 je _.L216 2417 _.L222: 1135:initdisk.c **** PTable, RelSectorOffset, 2418 .loc 1 1135 0 0 00004659 57 push di 0 0000465A 56 push si 0 0000465B 53 push bx 0 0000465C FF7698 push word ptr [bp-104] 0 0000465F 8D46A8 lea ax, [-88+bp] 0 00004662 50 push ax 0 00004663 FF7608 push word ptr [bp+8] 0 00004666 8D469B lea ax, [-101+bp] 0 00004669 50 push ax 0 0000466A E8[FEFF] call _ScanForPrimaryPartitions 2429 _.LVL206: 0 0000466D 96 xchg si, ax 2431 _.LVL207: 2432 _.L216: 1141:initdisk.c **** { 2433 .loc 1 1141 0 0 0000466E 837E0802 cmp word ptr [bp+8], 2 0 00004672 7403E94AFF jne _.L211 0 00004677 8B4692 mov ax, word ptr [bp-110] 0 0000467A 894698 mov word ptr [bp-104], ax 2438 _.LVL208: 2439 _.L221: 1151:initdisk.c **** { 2440 .loc 1 1151 0 0 0000467D B81600 mov ax, 22 0 00004680 F76698 mul word ptr [bp-104] 0 00004683 93 xchg bx, ax 0 00004684 89EE mov si, bp 0 00004686 8A40A9 mov al, byte ptr [bx+si-87] 0 00004689 3C0F cmp al, 15 0 0000468B 9F lahf 0 0000468C D0E4 shl ah, 1 0 0000468E 99 cwd 0 0000468F F6DA neg dl 0 00004691 88D1 mov cl, dl 0 00004693 3C05 cmp al, 5 0 00004695 7404 je _.L223 0 00004697 84D2 test dl, dl 0 00004699 744B je _.L218 2456 _.L223: 1153:initdisk.c **** 2457 .loc 1 1153 0 0 0000469B B81600 mov ax, 22 0 0000469E F76698 mul word ptr [bp-104] 0 000046A1 96 xchg si, ax 0 000046A2 8D5AB6 lea bx, [-74+bp+si] 0 000046A5 8B07 mov ax, word ptr [bx] 0 000046A7 8B7702 mov si, word ptr [bx+2] 0 000046AA 8B5696 mov dx, word ptr [bp-106] 0 000046AD 01C2 add dx, ax 0 000046AF 895698 mov word ptr [bp-104], dx 2467 _.LVL209: 0 000046B2 8B5E94 mov bx, word ptr [bp-108] 0 000046B5 11F3 adc bx, si 2470 _.LVL210: 1155:initdisk.c **** { 2471 .loc 1 1155 0 0 000046B7 8B5696 mov dx, word ptr [bp-106] 2473 _.LVL211: 0 000046BA 0B5694 or dx, word ptr [bp-108] 0 000046BD 750E jne _.L220 2476 _.LVL212: 1159:initdisk.c **** } 2477 .loc 1 1159 0 0 000046BF 88CA mov dl, cl 0 000046C1 B600 mov dh, 0 0 000046C3 8916[0000] mov word ptr [_ExtLBAForce], dx 1157:initdisk.c **** /* grand parent LBA -> all children and grandchildren LBA */ 2481 .loc 1 1157 0 0 000046C7 894696 mov word ptr [bp-106], ax 0 000046CA 897694 mov word ptr [bp-108], si 2484 _.LVL213: 2485 _.L220: 1162:initdisk.c **** 2486 .loc 1 1162 0 0 000046CD 47 inc di 2488 _.LVL214: 1147:initdisk.c **** 2489 .loc 1 1147 0 0 000046CE 8B7692 mov si, word ptr [bp-110] 1164:initdisk.c **** { 2491 .loc 1 1164 0 0 000046D1 83FF1F cmp di, 31 0 000046D4 7403E900FF jne _.L212 1166:initdisk.c **** return 0; 2494 .loc 1 1166 0 0 000046D9 B8[4004] mov ax, offset _.LC37 0 000046DC 50 push ax 0 000046DD E8[FEFF] call _init_printf 2498 _.LVL215: 1167:initdisk.c **** } 2499 .loc 1 1167 0 0 000046E0 83C402 add sp, 2 0 000046E3 E9DBFE jmp _.L211 2502 _.LVL216: 2503 _.L218: 1149:initdisk.c **** { 2504 .loc 1 1149 0 discriminator 2 0 000046E6 FF4698 inc word ptr [bp-104] 2506 _.LVL217: 0 000046E9 837E9804 cmp word ptr [bp-104], 4 0 000046ED 758E jne _.L221 1174:initdisk.c **** } 2509 .loc 1 1174 0 0 000046EF 8B7692 mov si, word ptr [bp-110] 0 000046F2 E9CCFE jmp _.L211 2512 _.LFE18: 2513 .size _ProcessDisk, .-_ProcessDisk === Switch to base=012BB0h -> ".RODATA.STR1.1" 2514 .section .rodata.str1.1 2515 _.LC38: 0 000011A8 4472697665204C65 .string "Drive Letter Assignment - DOS order\n" 0 000011B0 7474657220417373 0 000011B8 69676E6D656E7420 0 000011C0 2D20444F53206F72 0 000011C8 6465720A00 2517 _.LC39: 0 000011CD 4472697665204C65 .string "Drive Letter Assignment - sorted by drive\n" 0 000011D5 7474657220417373 0 000011DD 69676E6D656E7420 0 000011E5 2D20736F72746564 0 000011ED 2062792064726976 0 000011F5 650A00 2519 _.LC40: 0 000011F8 4E6F20737570706F .string "No supported partitions found.\n" 0 00001200 7274656420706172 0 00001208 746974696F6E7320 0 00001210 666F756E642E0A00 === Switch to base=002270h -> ".TEXT" 2521 .text 2522 .global _ReadAllPartitionTables 2523 .type _ReadAllPartitionTables, @function 2524 _ReadAllPartitionTables: 2525 _.LFB22: 1308:initdisk.c **** 1309:initdisk.c **** void ReadAllPartitionTables(void) 1310:initdisk.c **** { 2526 .loc 1 1310 0 0 000046F5 56 push si 0 000046F6 57 push di 0 000046F7 55 push bp 2530 _.LCFI34: 0 000046F8 89E5 mov bp, sp 2532 _.LCFI35: 0 000046FA 81ECA600 sub sp, 166 1311:initdisk.c **** UBYTE foundPartitions[MAX_HARD_DRIVE]; 1312:initdisk.c **** 1313:initdisk.c **** int HardDrive; 1314:initdisk.c **** int nHardDisk; 1315:initdisk.c **** ddt nddt; 1316:initdisk.c **** static iregs regs; 1317:initdisk.c **** 1318:initdisk.c **** /* quick adjustment of diskette parameter table */ 1319:initdisk.c **** fmemcpy(int1e_table, *(char FAR * FAR *)MK_FP(0, 0x1e*4), sizeof(int1e_table)); 2534 .loc 1 1319 0 0 000046FE B80E00 mov ax, 14 0 00004701 50 push ax 0 00004702 31F6 xor si, si 0 00004704 8EC6 mov es, si 0 00004706 26FF367A00 push word ptr es:[122] 0 0000470B 26FF367800 push word ptr es:[120] 0 00004710 B8[0000] mov ax, offset _int1e_table 0 00004713 BF[0000] mov di, offset _int1e_table@OZSEG16 0 00004716 57 push di 0 00004717 50 push ax 0 00004718 898660FF mov word ptr [bp-160], ax 0 0000471C E8[FEFF] call _init_fmemcpy 2547 _.LVL218: 1320:initdisk.c **** /* currently only 512 bytes per sector floppies are supported, log2(512/128)=2 */ 1321:initdisk.c **** int1e_table[3] = 2; 2548 .loc 1 1321 0 0 0000471F 8EC7 mov es, di 0 00004721 26C606[0300]02 mov byte ptr es:[_int1e_table+3], 2 1322:initdisk.c **** /* enforce min. 9 sectors per track */ 1323:initdisk.c **** if (int1e_table[4] < 9) 2551 .loc 1 1323 0 0 00004727 26803E[0400]08 cmp byte ptr es:[_int1e_table+4], 8 0 0000472D 8B8660FF mov ax, word ptr [bp-160] 0 00004731 7706 ja _.L233 1324:initdisk.c **** int1e_table[4] = 9; 2555 .loc 1 1324 0 0 00004733 26C606[0400]09 mov byte ptr es:[_int1e_table+4], 9 2557 _.L233: 1325:initdisk.c **** /* and adjust int1e */ 1326:initdisk.c **** setvec(0x1e, (intvec)int1e_table); 2558 .loc 1 1326 0 0 00004739 57 push di 0 0000473A 50 push ax 0 0000473B B01E mov al, 30 0 0000473D 50 push ax 0 0000473E E8[FEFF] call _setvec 2564 _.LVL219: 1327:initdisk.c **** 1328:initdisk.c **** /* Setup media info and BPBs arrays for floppies */ 1329:initdisk.c **** make_ddt(&nddt, 0, 0, 0); 2565 .loc 1 1329 0 0 00004741 56 push si 0 00004742 56 push si 0 00004743 56 push si 0 00004744 8D9678FF lea dx, [-136+bp] 0 00004748 52 push dx 0 00004749 89965EFF mov word ptr [bp-162], dx 0 0000474D E80FF4 call _make_ddt 2573 _.LVL220: 1330:initdisk.c **** 1331:initdisk.c **** /* 1332:initdisk.c **** this is a quick patch - see if B: exists 1333:initdisk.c **** test for A: also, need not exist 1334:initdisk.c **** */ 1335:initdisk.c **** init_call_intr(0x11, ®s); /* get equipment list */ 2574 .loc 1 1335 0 0 00004750 BF[0402] mov di, offset _regs.2056 0 00004753 57 push di 0 00004754 B81100 mov ax, 17 0 00004757 50 push ax 0 00004758 E8[FEFF] call _init_call_intr 2580 _.LVL221: 1336:initdisk.c **** /*if ((regs.AL & 1)==0)*//* no floppy drives installed */ 1337:initdisk.c **** if ((regs.AL & 1) && (regs.AL & 0xc0)) 2581 .loc 1 1337 0 0 0000475B 8A05 mov al, byte ptr [di] 0 0000475D 888660FF mov byte ptr [bp-160], al 0 00004761 F68660FF01 test byte ptr [bp-160], 1 0 00004766 7503E99B00 je _.L234 2586 .loc 1 1337 0 is_stmt 0 discriminator 1 0 0000476B A8C0 test al, -64 0 0000476D 8B965EFF mov dx, word ptr [bp-162] 0 00004771 7503E99000 je _.L234 1338:initdisk.c **** { 1339:initdisk.c **** /* floppy drives installed and a B: drive */ 1340:initdisk.c **** make_ddt(&nddt, 1, 1, 0); 2590 .loc 1 1340 0 is_stmt 1 0 00004776 56 push si 0 00004777 B80100 mov ax, 1 0 0000477A 50 push ax 0 0000477B 50 push ax 0 0000477C 52 push dx 2596 _.L272: 1341:initdisk.c **** } 1342:initdisk.c **** else 1343:initdisk.c **** { 1344:initdisk.c **** /* set up the DJ method : multiple logical drives */ 1345:initdisk.c **** make_ddt(&nddt, 1, 0, DF_MULTLOG); 2597 .loc 1 1345 0 0 0000477D E8DFF3 call _make_ddt 2599 _.LVL222: 1346:initdisk.c **** } 1347:initdisk.c **** 1348:initdisk.c **** /* Initial number of disk units */ 1349:initdisk.c **** nUnits = 2; 2600 .loc 1 1349 0 0 00004780 C706[0000]0200 mov word ptr [_nUnits], 2 1350:initdisk.c **** 1351:initdisk.c **** nHardDisk = BIOS_nrdrives(); 2602 .loc 1 1351 0 0 00004786 E8[FEFF] call _BIOS_nrdrives 2604 _.LVL223: 2605 _.LVL224: 1352:initdisk.c **** if (nHardDisk > LENGTH(foundPartitions)) 2606 .loc 1 1352 0 0 00004789 83F808 cmp ax, 8 0 0000478C 7603 jbe _.L236 1353:initdisk.c **** nHardDisk = LENGTH(foundPartitions); 2609 .loc 1 1353 0 0 0000478E B80800 mov ax, 8 2611 _.LVL225: 2612 _.L236: 1354:initdisk.c **** 1355:initdisk.c **** DebugPrintf(("DSK init: found %d disk drives\n", nHardDisk)); 1356:initdisk.c **** 1357:initdisk.c **** /* Reset the drives */ 1358:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 2613 .loc 1 1358 0 0 00004791 C78660FF0000 mov word ptr [bp-160], 0 2615 _.LVL226: 2616 _.L237: 2617 .loc 1 1358 0 is_stmt 0 discriminator 1 0 00004797 398660FF cmp word ptr [bp-160], ax 0 0000479B 757A jne _.L238 1359:initdisk.c **** { 1360:initdisk.c **** BIOS_drive_reset(HardDrive); 1361:initdisk.c **** foundPartitions[HardDrive] = 0; 1362:initdisk.c **** } 1363:initdisk.c **** 1364:initdisk.c **** if (InitKernelConfig.DLASortByDriveNo == 0) 2620 .loc 1 1364 0 is_stmt 1 0 0000479D BB[0000] mov bx, offset _InitKernelConfig 0 000047A0 807F0800 cmp byte ptr [bx+8], 0 0 000047A4 899E5EFF mov word ptr [bp-162], bx 0 000047A8 7403E9E400 jne _.L239 1365:initdisk.c **** { 1366:initdisk.c **** if (InitKernelConfig.Verbose >= 1) printf("Drive Letter Assignment - DOS order\n"); 2625 .loc 1 1366 0 0 000047AD 807F1500 cmp byte ptr [bx+21], 0 0 000047B1 7E0A jle _.L240 2628 .loc 1 1366 0 is_stmt 0 discriminator 1 0 000047B3 B8[7404] mov ax, offset _.LC38 0 000047B6 50 push ax 0 000047B7 E8[FEFF] call _init_printf 2632 _.LVL227: 0 000047BA 83C402 add sp, 2 2634 _.L240: 1358:initdisk.c **** { 2635 .loc 1 1358 0 is_stmt 1 discriminator 1 0 000047BD 31DB xor bx, bx 2637 _.LVL228: 2638 _.L241: 1367:initdisk.c **** 1368:initdisk.c **** /* Process primary partition table 1 partition only */ 1369:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 2639 .loc 1 1369 0 discriminator 1 0 000047BF 399E60FF cmp word ptr [bp-160], bx 0 000047C3 7573 jne _.L243 0 000047C5 31D2 xor dx, dx 2643 _.LVL229: 2644 _.L244: 1370:initdisk.c **** { 1371:initdisk.c **** foundPartitions[HardDrive] = 1372:initdisk.c **** ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0); 1373:initdisk.c **** 1374:initdisk.c **** if (foundPartitions[HardDrive] == 0) 1375:initdisk.c **** foundPartitions[HardDrive] = 1376:initdisk.c **** ProcessDisk(SCAN_PRIMARY, HardDrive, 0); 1377:initdisk.c **** } 1378:initdisk.c **** 1379:initdisk.c **** /* Process extended partition table */ 1380:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 2645 .loc 1 1380 0 discriminator 1 0 000047C7 399660FF cmp word ptr [bp-160], dx 0 000047CB 7403E99500 jne _.L245 0 000047D0 31F6 xor si, si 2649 _.LVL230: 2650 _.L246: 1381:initdisk.c **** { 1382:initdisk.c **** ProcessDisk(SCAN_EXTENDED, HardDrive, 0); 1383:initdisk.c **** } 1384:initdisk.c **** 1385:initdisk.c **** /* Process primary a 2nd time */ 1386:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 2651 .loc 1 1386 0 discriminator 1 0 000047D2 39B660FF cmp word ptr [bp-160], si 0 000047D6 7403E99F00 jne _.L247 2654 _.LVL231: 2655 _.L260: 1387:initdisk.c **** { 1388:initdisk.c **** ProcessDisk(SCAN_PRIMARY2, HardDrive, foundPartitions[HardDrive]); 1389:initdisk.c **** } 1390:initdisk.c **** } 1391:initdisk.c **** else 1392:initdisk.c **** { 1393:initdisk.c **** UBYTE bootdrv = peekb(0,0x5e0); 1394:initdisk.c **** 1395:initdisk.c **** if (InitKernelConfig.Verbose >= 1) printf("Drive Letter Assignment - sorted by drive\n"); 1396:initdisk.c **** 1397:initdisk.c **** /* Process primary partition table 1 partition only */ 1398:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 1399:initdisk.c **** { 1400:initdisk.c **** struct DriveParamS driveParam; 1401:initdisk.c **** if (LBA_Get_Drive_Parameters(HardDrive, &driveParam, 0) && 1402:initdisk.c **** driveParam.driveno == bootdrv) 1403:initdisk.c **** { 1404:initdisk.c **** foundPartitions[HardDrive] = 1405:initdisk.c **** ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0); 1406:initdisk.c **** break; 1407:initdisk.c **** } 1408:initdisk.c **** } 1409:initdisk.c **** 1410:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 1411:initdisk.c **** { 1412:initdisk.c **** if (foundPartitions[HardDrive] == 0) 1413:initdisk.c **** { 1414:initdisk.c **** foundPartitions[HardDrive] = 1415:initdisk.c **** ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0); 1416:initdisk.c **** 1417:initdisk.c **** if (foundPartitions[HardDrive] == 0) 1418:initdisk.c **** foundPartitions[HardDrive] = 1419:initdisk.c **** ProcessDisk(SCAN_PRIMARY, HardDrive, 0); 1420:initdisk.c **** } 1421:initdisk.c **** 1422:initdisk.c **** /* Process extended partition table */ 1423:initdisk.c **** ProcessDisk(SCAN_EXTENDED, HardDrive, 0); 1424:initdisk.c **** 1425:initdisk.c **** /* Process primary a 2nd time */ 1426:initdisk.c **** ProcessDisk(SCAN_PRIMARY2, HardDrive, foundPartitions[HardDrive]); 1427:initdisk.c **** } 1428:initdisk.c **** } 1429:initdisk.c **** 1430:initdisk.c **** if (InitKernelConfig.Verbose >= 0) 2656 .loc 1 1430 0 0 000047DB 8B9E5EFF mov bx, word ptr [bp-162] 0 000047DF 807F1500 cmp byte ptr [bx+21], 0 0 000047E3 7C1B jl _.L232 0 000047E5 31C0 xor ax, ax 0 000047E7 89C3 mov bx, ax 2662 _.L249: 2663 _.LVL232: 2664 _.LBB34: 1431:initdisk.c **** { 1432:initdisk.c **** unsigned foundPartitionsCount = 0; 1433:initdisk.c **** /* Tell user if no valid partitions found on any hard drive */ 1434:initdisk.c **** for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++) 2665 .loc 1 1434 0 discriminator 1 0 000047E9 399E60FF cmp word ptr [bp-160], bx 0 000047ED 7403E96601 jne _.L261 1435:initdisk.c **** { 1436:initdisk.c **** foundPartitionsCount += foundPartitions[HardDrive]; 1437:initdisk.c **** } 1438:initdisk.c **** /* printf("Found %i partitions\n", foundPartitionsCount); */ 1439:initdisk.c **** if (!foundPartitionsCount) printf("No supported partitions found.\n"); 2668 .loc 1 1439 0 0 000047F2 85C0 test ax, ax 0 000047F4 750A jne _.L232 2671 .loc 1 1439 0 is_stmt 0 discriminator 1 0 000047F6 B8[C404] mov ax, offset _.LC40 2673 _.LVL233: 0 000047F9 50 push ax 0 000047FA E8[FEFF] call _init_printf 2676 _.LVL234: 0 000047FD 83C402 add sp, 2 2678 _.L232: 2679 _.LBE34: 1440:initdisk.c **** } 1441:initdisk.c **** } 2680 .loc 1 1441 0 is_stmt 1 0 00004800 89EC mov sp, bp 0 00004802 5D pop bp 0 00004803 5F pop di 0 00004804 5E pop si 0 00004805 C3 ret 2686 _.L234: 1345:initdisk.c **** } 2687 .loc 1 1345 0 0 00004806 B81000 mov ax, 16 0 00004809 50 push ax 0 0000480A 56 push si 0 0000480B B80100 mov ax, 1 0 0000480E 50 push ax 0 0000480F 8D8678FF lea ax, [-136+bp] 0 00004813 50 push ax 0 00004814 E966FF jmp _.L272 2696 _.LVL235: 2697 _.L238: 0 00004817 89865EFF mov word ptr [bp-162], ax 1360:initdisk.c **** foundPartitions[HardDrive] = 0; 2699 .loc 1 1360 0 discriminator 3 0 0000481B FFB660FF push word ptr [bp-160] 0 0000481F E8[FEFF] call _BIOS_drive_reset 2702 _.LVL236: 1361:initdisk.c **** } 2703 .loc 1 1361 0 discriminator 3 0 00004822 89EF mov di, bp 0 00004824 8B9E60FF mov bx, word ptr [bp-160] 0 00004828 C68163FF00 mov byte ptr [bx+di-157], 0 1358:initdisk.c **** { 2707 .loc 1 1358 0 discriminator 3 0 0000482D FF8660FF inc word ptr [bp-160] 2709 _.LVL237: 0 00004831 8B865EFF mov ax, word ptr [bp-162] 2711 _.LVL238: 0 00004835 E95FFF jmp _.L237 2713 _.LVL239: 2714 _.L243: 1372:initdisk.c **** 2715 .loc 1 1372 0 0 00004838 56 push si 0 00004839 53 push bx 0 0000483A 899E5CFF mov word ptr [bp-164], bx 0 0000483E 56 push si 0 0000483F E8[FEFF] call _ProcessDisk 2721 _.LVL240: 1371:initdisk.c **** ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0); 2722 .loc 1 1371 0 0 00004842 89EF mov di, bp 0 00004844 8B9E5CFF mov bx, word ptr [bp-164] 0 00004848 888163FF mov byte ptr [bx+di-157], al 1374:initdisk.c **** foundPartitions[HardDrive] = 2726 .loc 1 1374 0 0 0000484C 84C0 test al, al 0 0000484E 7511 jne _.L242 1376:initdisk.c **** } 2729 .loc 1 1376 0 0 00004850 56 push si 0 00004851 53 push bx 0 00004852 B80100 mov ax, 1 0 00004855 50 push ax 0 00004856 E8[FEFF] call _ProcessDisk 2735 _.LVL241: 1375:initdisk.c **** ProcessDisk(SCAN_PRIMARY, HardDrive, 0); 2736 .loc 1 1375 0 0 00004859 8B9E5CFF mov bx, word ptr [bp-164] 0 0000485D 888163FF mov byte ptr [bx+di-157], al 2739 _.L242: 1369:initdisk.c **** { 2740 .loc 1 1369 0 discriminator 2 0 00004861 43 inc bx 2742 _.LVL242: 0 00004862 E95AFF jmp _.L241 2744 _.LVL243: 2745 _.L245: 1382:initdisk.c **** } 2746 .loc 1 1382 0 discriminator 3 0 00004865 56 push si 0 00004866 52 push dx 0 00004867 89965CFF mov word ptr [bp-164], dx 0 0000486B B80200 mov ax, 2 0 0000486E 50 push ax 0 0000486F E8[FEFF] call _ProcessDisk 2753 _.LVL244: 1380:initdisk.c **** { 2754 .loc 1 1380 0 discriminator 3 0 00004872 8B965CFF mov dx, word ptr [bp-164] 0 00004876 42 inc dx 2757 _.LVL245: 0 00004877 E94DFF jmp _.L244 2759 _.LVL246: 2760 _.L247: 1388:initdisk.c **** } 2761 .loc 1 1388 0 discriminator 3 0 0000487A 89EF mov di, bp 0 0000487C 89F3 mov bx, si 0 0000487E 8A8163FF mov al, byte ptr [bx+di-157] 0 00004882 30E4 xor ah, ah 0 00004884 50 push ax 0 00004885 56 push si 0 00004886 B80300 mov ax, 3 0 00004889 50 push ax 0 0000488A E8[FEFF] call _ProcessDisk 2771 _.LVL247: 1386:initdisk.c **** { 2772 .loc 1 1386 0 discriminator 3 0 0000488D 46 inc si 2774 _.LVL248: 0 0000488E E941FF jmp _.L246 2776 _.LVL249: 2777 _.L239: 2778 _.LBB35: 1393:initdisk.c **** 2779 .loc 1 1393 0 0 00004891 8EC6 mov es, si 0 00004893 26A0E005 mov al, byte ptr es:[1504] 0 00004897 88865CFF mov byte ptr [bp-164], al 2783 _.LVL250: 1395:initdisk.c **** 2784 .loc 1 1395 0 0 0000489B 8B9E5EFF mov bx, word ptr [bp-162] 0 0000489F 807F1500 cmp byte ptr [bx+21], 0 0 000048A3 7E0A jle _.L250 1395:initdisk.c **** 2788 .loc 1 1395 0 is_stmt 0 discriminator 1 0 000048A5 B8[9904] mov ax, offset _.LC39 2790 _.LVL251: 0 000048A8 50 push ax 0 000048A9 E8[FEFF] call _init_printf 2793 _.LVL252: 0 000048AC 83C402 add sp, 2 2795 _.L250: 2796 _.LBE35: 0 000048AF 31D2 xor dx, dx 2798 _.LVL253: 2799 _.L251: 2800 _.LBB37: 1398:initdisk.c **** { 2801 .loc 1 1398 0 is_stmt 1 discriminator 1 0 000048B1 399660FF cmp word ptr [bp-160], dx 0 000048B5 7439 je _.L255 2804 _.LBB36: 1401:initdisk.c **** driveParam.driveno == bootdrv) 2805 .loc 1 1401 0 0 000048B7 56 push si 0 000048B8 8D866BFF lea ax, [-149+bp] 0 000048BC 50 push ax 0 000048BD 52 push dx 0 000048BE 89965AFF mov word ptr [bp-166], dx 0 000048C2 E84AEF call _LBA_Get_Drive_Parameters 2812 _.LVL254: 0 000048C5 85C0 test ax, ax 0 000048C7 8B965AFF mov dx, word ptr [bp-166] 0 000048CB 7503E98400 je _.L252 1401:initdisk.c **** driveParam.driveno == bootdrv) 2816 .loc 1 1401 0 is_stmt 0 discriminator 1 0 000048D0 8A865CFF mov al, byte ptr [bp-164] 0 000048D4 3A866BFF cmp al, byte ptr [bp-149] 0 000048D8 757A jne _.L252 1405:initdisk.c **** break; 2820 .loc 1 1405 0 is_stmt 1 0 000048DA 56 push si 0 000048DB 52 push dx 0 000048DC 89965CFF mov word ptr [bp-164], dx 2824 _.LVL255: 0 000048E0 56 push si 0 000048E1 E8[FEFF] call _ProcessDisk 2827 _.LVL256: 1404:initdisk.c **** ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0); 2828 .loc 1 1404 0 0 000048E4 89EF mov di, bp 0 000048E6 8B965CFF mov dx, word ptr [bp-164] 0 000048EA 89D3 mov bx, dx 0 000048EC 888163FF mov byte ptr [bx+di-157], al 2833 _.LVL257: 2834 _.L255: 2835 _.LBE36: 2836 _.LBE37: 0 000048F0 31DB xor bx, bx 2838 _.L253: 2839 _.LVL258: 2840 _.LBB38: 1410:initdisk.c **** { 2841 .loc 1 1410 0 discriminator 1 0 000048F2 399E60FF cmp word ptr [bp-160], bx 0 000048F6 7503E9E0FE je _.L260 1412:initdisk.c **** { 2844 .loc 1 1412 0 0 000048FB 89EF mov di, bp 0 000048FD 80B963FF00 cmp byte ptr [bx+di-157], 0 0 00004902 7527 jne _.L257 1415:initdisk.c **** 2848 .loc 1 1415 0 0 00004904 56 push si 0 00004905 53 push bx 0 00004906 899E5CFF mov word ptr [bp-164], bx 0 0000490A 56 push si 0 0000490B E8[FEFF] call _ProcessDisk 2854 _.LVL259: 1414:initdisk.c **** ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0); 2855 .loc 1 1414 0 0 0000490E 8B9E5CFF mov bx, word ptr [bp-164] 0 00004912 888163FF mov byte ptr [bx+di-157], al 1417:initdisk.c **** foundPartitions[HardDrive] = 2858 .loc 1 1417 0 0 00004916 84C0 test al, al 0 00004918 7511 jne _.L257 1419:initdisk.c **** } 2861 .loc 1 1419 0 0 0000491A 56 push si 0 0000491B 53 push bx 0 0000491C B80100 mov ax, 1 0 0000491F 50 push ax 0 00004920 E8[FEFF] call _ProcessDisk 2867 _.LVL260: 1418:initdisk.c **** ProcessDisk(SCAN_PRIMARY, HardDrive, 0); 2868 .loc 1 1418 0 0 00004923 8B9E5CFF mov bx, word ptr [bp-164] 0 00004927 888163FF mov byte ptr [bx+di-157], al 2871 _.LVL261: 2872 _.L257: 1423:initdisk.c **** 2873 .loc 1 1423 0 discriminator 2 0 0000492B 56 push si 0 0000492C 53 push bx 0 0000492D 899E5CFF mov word ptr [bp-164], bx 0 00004931 B80200 mov ax, 2 0 00004934 50 push ax 0 00004935 E8[FEFF] call _ProcessDisk 2880 _.LVL262: 1426:initdisk.c **** } 2881 .loc 1 1426 0 discriminator 2 0 00004938 89EF mov di, bp 0 0000493A 8B9E5CFF mov bx, word ptr [bp-164] 0 0000493E 8A8163FF mov al, byte ptr [bx+di-157] 0 00004942 30E4 xor ah, ah 0 00004944 50 push ax 0 00004945 53 push bx 0 00004946 B80300 mov ax, 3 0 00004949 50 push ax 0 0000494A E8[FEFF] call _ProcessDisk 2891 _.LVL263: 1410:initdisk.c **** { 2892 .loc 1 1410 0 discriminator 2 0 0000494D 8B9E5CFF mov bx, word ptr [bp-164] 0 00004951 43 inc bx 2895 _.LVL264: 0 00004952 EB9E jmp _.L253 2897 _.LVL265: 2898 _.L252: 1398:initdisk.c **** { 2899 .loc 1 1398 0 0 00004954 42 inc dx 2901 _.LVL266: 0 00004955 E959FF jmp _.L251 2903 _.LVL267: 2904 _.L261: 2905 _.LBE38: 2906 _.LBB39: 1436:initdisk.c **** } 2907 .loc 1 1436 0 discriminator 3 0 00004958 89EF mov di, bp 0 0000495A 8A9163FF mov dl, byte ptr [bx+di-157] 0 0000495E 30F6 xor dh, dh 0 00004960 01D0 add ax, dx 2912 _.LVL268: 1434:initdisk.c **** { 2913 .loc 1 1434 0 discriminator 3 0 00004962 43 inc bx 2915 _.LVL269: 0 00004963 E983FE jmp _.L249 2917 _.LBE39: 2918 _.LFE22: 2919 .size _ReadAllPartitionTables, .-_ReadAllPartitionTables === Switch to base=012BB0h -> ".RODATA.STR1.1" 2920 .section .rodata.str1.1 2921 _.LC41: 0 00001218 0A496E6974446973 .string "\nInitDisk\n" 0 00001220 6B0A00 === Switch to base=002270h -> ".TEXT" 2923 .text 2924 .global _dsk_init 2925 .type _dsk_init, @function 2926 _dsk_init: 2927 _.LFB23: 1442:initdisk.c **** 1443:initdisk.c **** /* disk initialization: returns number of units */ 1444:initdisk.c **** COUNT dsk_init() 1445:initdisk.c **** { 2928 .loc 1 1445 0 1446:initdisk.c **** if (InitKernelConfig.Verbose >= 1) printf("\nInitDisk\n"); 2929 .loc 1 1446 0 0 00004966 803E[1500]00 cmp byte ptr [_InitKernelConfig+21], 0 0 0000496B 7E0A jle _.L274 2932 .loc 1 1446 0 is_stmt 0 discriminator 1 0 0000496D B8[E404] mov ax, offset _.LC41 0 00004970 50 push ax 2935 _.LCFI36: 0 00004971 E8[FEFF] call _init_printf 2937 _.LVL270: 0 00004974 83C402 add sp, 2 2939 _.LCFI37: 2940 _.L274: 1447:initdisk.c **** 1448:initdisk.c **** #if defined(DEBUG) && !defined(DOSEMU) && !defined(DEBUG_PRINT_COMPORT) 1449:initdisk.c **** { 1450:initdisk.c **** iregs regs; 1451:initdisk.c **** regs.a.x = 0x1112; /* select 43 line mode - more space for partinfo */ 1452:initdisk.c **** regs.b.x = 0; 1453:initdisk.c **** init_call_intr(0x10, ®s); 1454:initdisk.c **** } 1455:initdisk.c **** #endif 1456:initdisk.c **** 1457:initdisk.c **** /* Reset the drives */ 1458:initdisk.c **** BIOS_drive_reset(0); 2941 .loc 1 1458 0 is_stmt 1 0 00004977 31C0 xor ax, ax 0 00004979 50 push ax 2944 _.LCFI38: 0 0000497A E8[FEFF] call _BIOS_drive_reset 2946 _.LCFI39: 2947 _.LVL271: 1459:initdisk.c **** 1460:initdisk.c **** ReadAllPartitionTables(); 2948 .loc 1 1460 0 0 0000497D E8[FEFF] call _ReadAllPartitionTables 2950 _.LVL272: 1461:initdisk.c **** 1462:initdisk.c **** return nUnits; 1463:initdisk.c **** } 2951 .loc 1 1463 0 0 00004980 A1[0000] mov ax, word ptr [_nUnits] 0 00004983 C3 ret 2954 _.LFE23: 2955 .size _dsk_init, .-_dsk_init 2956 .local _regs.2056 2957 .comm _regs.2056,24,1 === Switch to base=000790h -> ".DATA" 2958 .data 2959 .type _dap.2011, @object 2960 .size _dap.2011, 16 2961 _dap.2011: 0 00000584 10 .byte 16 0 00000585 00 .byte 0 0 00000586 00 .byte 0 0 00000587 00 .byte 0 0 00000588 0000 .hword 0 0 0000058A 0000 .hword 0 0 0000058C 0000 .hword 0 0 0000058E 0000 .hword 0 0 00000590 0000 .hword 0 0 00000592 0000 .hword 0 2972 .local _regs.1907 2973 .comm _regs.1907,24,1 2974 .local _regs.1887 2975 .comm _regs.1887,24,1 2976 .global _floppy_bpbs 2977 .type _floppy_bpbs, @object 2978 .size _floppy_bpbs, 85 2979 _floppy_bpbs: 0 00000594 0002 .hword 512 0 00000596 02 .byte 2 0 00000597 0100 .hword 1 0 00000599 02 .byte 2 0 0000059A 7000 .hword 112 0 0000059C D002 .hword 720 0 0000059E FD .byte -3 0 0000059F 0200 .hword 2 0 000005A1 0900 .hword 9 0 000005A3 0200 .hword 2 0 000005A5 0002 .hword 512 0 000005A7 01 .byte 1 0 000005A8 0100 .hword 1 0 000005AA 02 .byte 2 0 000005AB E000 .hword 224 0 000005AD 6009 .hword 2400 0 000005AF F9 .byte -7 0 000005B0 0700 .hword 7 0 000005B2 0F00 .hword 15 0 000005B4 0200 .hword 2 0 000005B6 0002 .hword 512 0 000005B8 02 .byte 2 0 000005B9 0100 .hword 1 0 000005BB 02 .byte 2 0 000005BC 7000 .hword 112 0 000005BE A005 .hword 1440 0 000005C0 F9 .byte -7 0 000005C1 0300 .hword 3 0 000005C3 0900 .hword 9 0 000005C5 0200 .hword 2 0 000005C7 0002 .hword 512 0 000005C9 01 .byte 1 0 000005CA 0100 .hword 1 0 000005CC 02 .byte 2 0 000005CD E000 .hword 224 0 000005CF 400B .hword 2880 0 000005D1 F0 .byte -16 0 000005D2 0900 .hword 9 0 000005D4 1200 .hword 18 0 000005D6 0200 .hword 2 0 000005D8 0002 .hword 512 0 000005DA 02 .byte 2 0 000005DB 0100 .hword 1 0 000005DD 02 .byte 2 0 000005DE F000 .hword 240 0 000005E0 8016 .hword 5760 0 000005E2 F0 .byte -16 0 000005E3 0900 .hword 9 0 000005E5 2400 .hword 36 0 000005E7 0200 .hword 2 3030 .global _ExtLBAForce === Switch to base=012BB0h -> ".BSS" 3031 .bss 3032 .p2align 1 3033 .type _ExtLBAForce, @object 3034 .size _ExtLBAForce, 2 3035 _ExtLBAForce: 0 0000203E 0000 .skip 2,0 3037 .global _nUnits 3038 .p2align 1 3039 .type _nUnits, @object 3040 .size _nUnits, 2 3041 _nUnits: 0 00002040 0000 .skip 2,0 3043 .global _InitDiskTransferBuffer 3044 .p2align 0 3045 .type _InitDiskTransferBuffer, @object 3046 .size _InitDiskTransferBuffer, 512 3047 _InitDiskTransferBuffer: 0 00002042 0000000000000000 .skip 512,0 0 0000204A 0000000000000000 0 00002052 0000000000000000 0 0000205A 0000000000000000 0 00002062 0000000000000000 0 0000206A 0000000000000000 0 00002072 0000000000000000 0 0000207A 0000000000000000 0 00002082 0000000000000000 0 0000208A 0000000000000000 0 00002092 0000000000000000 0 0000209A 0000000000000000 0 000020A2 0000000000000000 0 000020AA 0000000000000000 0 000020B2 0000000000000000 0 000020BA 0000000000000000 0 000020C2 0000000000000000 0 000020CA 0000000000000000 0 000020D2 0000000000000000 0 000020DA 0000000000000000 0 000020E2 0000000000000000 0 000020EA 0000000000000000 0 000020F2 0000000000000000 0 000020FA 0000000000000000 0 00002102 0000000000000000 0 0000210A 0000000000000000 0 00002112 0000000000000000 0 0000211A 0000000000000000 0 00002122 0000000000000000 0 0000212A 0000000000000000 0 00002132 0000000000000000 0 0000213A 0000000000000000 0 00002142 0000000000000000 0 0000214A 0000000000000000 0 00002152 0000000000000000 0 0000215A 0000000000000000 0 00002162 0000000000000000 0 0000216A 0000000000000000 0 00002172 0000000000000000 0 0000217A 0000000000000000 0 00002182 0000000000000000 0 0000218A 0000000000000000 0 00002192 0000000000000000 0 0000219A 0000000000000000 0 000021A2 0000000000000000 0 000021AA 0000000000000000 0 000021B2 0000000000000000 0 000021BA 0000000000000000 0 000021C2 0000000000000000 0 000021CA 0000000000000000 0 000021D2 0000000000000000 0 000021DA 0000000000000000 0 000021E2 0000000000000000 0 000021EA 0000000000000000 0 000021F2 0000000000000000 0 000021FA 0000000000000000 0 00002202 0000000000000000 0 0000220A 0000000000000000 0 00002212 0000000000000000 0 0000221A 0000000000000000 0 00002222 0000000000000000 0 0000222A 0000000000000000 0 00002232 0000000000000000 0 0000223A 0000000000000000 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: inithma.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=inithma.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccKEJTp7.s output file : inithma.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:56.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: === Switch to base=012BB0h -> ".RODATA.STR1.1" 7 .section .rodata.str1.1,"aMS",@progbits,1 8 _.LC0: 0 00000C5B 484D412063616E27 .string "HMA can't be enabled\n" 0 00000C63 7420626520656E61 0 00000C6B 626C65640A00 10 _.LC1: 0 00000C71 484D412063616E27 .string "HMA can't be enabled second time\n" 0 00000C79 7420626520656E61 0 00000C81 626C656420736563 0 00000C89 6F6E642074696D65 0 00000C91 0A00 === Switch to base=002270h -> ".TEXT" 12 .text 13 .global _EnableHMA 14 .type _EnableHMA, @function 15 _EnableHMA: 16 _.LFB5: 17 .file 1 "inithma.c" 1:inithma.c **** /****************************************************************/ 2:inithma.c **** /* */ 3:inithma.c **** /* initHMA.c */ 4:inithma.c **** /* DOS-C */ 5:inithma.c **** /* */ 6:inithma.c **** /* move kernel to HMA area */ 7:inithma.c **** /* */ 8:inithma.c **** /* Copyright (c) 2001 */ 9:inithma.c **** /* tom ehlert */ 10:inithma.c **** /* All Rights Reserved */ 11:inithma.c **** /* */ 12:inithma.c **** /* This file is part of DOS-C. */ 13:inithma.c **** /* */ 14:inithma.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:inithma.c **** /* modify it under the terms of the GNU General Public License */ 16:inithma.c **** /* as published by the Free Software Foundation; either version */ 17:inithma.c **** /* 2, or (at your option) any later version. */ 18:inithma.c **** /* */ 19:inithma.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:inithma.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:inithma.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:inithma.c **** /* the GNU General Public License for more details. */ 23:inithma.c **** /* */ 24:inithma.c **** /* You should have received a copy of the GNU General Public */ 25:inithma.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:inithma.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:inithma.c **** /* Cambridge, MA 02139, USA. */ 28:inithma.c **** /****************************************************************/ 29:inithma.c **** 30:inithma.c **** /* 31:inithma.c **** current status: 32:inithma.c **** 33:inithma.c **** load FreeDOS high, if DOS=HIGH detected 34:inithma.c **** 35:inithma.c **** suppress High Loading, if any SHIFT status detected (for debugging) 36:inithma.c **** 37:inithma.c **** if no XMS driver (HIMEM,FDXMS,...) loaded, should work 38:inithma.c **** 39:inithma.c **** cooperation with XMS drivers as follows: 40:inithma.c **** 41:inithma.c **** copy HMA_TEXT segment up. 42:inithma.c **** 43:inithma.c **** after each loaded DEVICE=SOMETHING.SYS, try to request the HMA 44:inithma.c **** (XMS function 0x01). 45:inithma.c **** if no XMS driver detected, during ONFIG.SYS processing, 46:inithma.c **** create a dummy VDISK entry in high memory 47:inithma.c **** 48:inithma.c **** this works with 49:inithma.c **** 50:inithma.c **** FD FDXMS - no problems detected 51:inithma.c **** 52:inithma.c **** 53:inithma.c **** MS HIMEM.SYS (from DOS 6.2, 9-30-93) 54:inithma.c **** 55:inithma.c **** works if and only if 56:inithma.c **** 57:inithma.c **** /TESTMEM:OFF 58:inithma.c **** 59:inithma.c **** is given 60:inithma.c **** 61:inithma.c **** otherwise HIMEM will TEST AND ZERO THE HIGH MEMORY+HMA. 62:inithma.c **** so, in CONFIG.C, if "HIMEM.SYS" is detected, a "/TESTMEM:OFF" 63:inithma.c **** parameter is forced. 64:inithma.c **** */ 65:inithma.c **** 66:inithma.c **** #include "portab.h" 67:inithma.c **** #include "init-mod.h" 68:inithma.c **** 69:inithma.c **** #ifdef VERSION_STRINGS 70:inithma.c **** static BYTE *RcsId = 71:inithma.c **** "$Id: inithma.c 956 2004-05-24 17:07:04Z bartoldeman $"; 72:inithma.c **** #endif 73:inithma.c **** 74:inithma.c **** BYTE DosLoadedInHMA BSS_INIT(FALSE); /* set to TRUE if loaded HIGH */ 75:inithma.c **** BYTE HMAclaimed BSS_INIT(0); /* set to TRUE if claimed from HIMEM */ 76:inithma.c **** UWORD HMAFree BSS_INIT(0); /* first byte in HMA not yet used */ 77:inithma.c **** 78:inithma.c **** STATIC void InstallVDISK(void); 79:inithma.c **** 80:inithma.c **** #ifdef DEBUG 81:inithma.c **** #if defined(__TURBOC__) || defined(__GNUC__) 82:inithma.c **** #define int3() __int__(3); 83:inithma.c **** #else 84:inithma.c **** void int3() 85:inithma.c **** { 86:inithma.c **** __asm int 3; 87:inithma.c **** } 88:inithma.c **** #endif 89:inithma.c **** #else 90:inithma.c **** #define int3() 91:inithma.c **** #endif 92:inithma.c **** 93:inithma.c **** #ifdef DEBUG 94:inithma.c **** #define HMAInitPrintf(x) printf x 95:inithma.c **** #else 96:inithma.c **** #define HMAInitPrintf(x) 97:inithma.c **** #endif 98:inithma.c **** 99:inithma.c **** #ifdef DEBUG 100:inithma.c **** VOID hdump(BYTE FAR * p) 101:inithma.c **** { 102:inithma.c **** int loop; 103:inithma.c **** HMAInitPrintf(("%p", p)); 104:inithma.c **** 105:inithma.c **** for (loop = 0; loop < 16; loop++) 106:inithma.c **** HMAInitPrintf(("%02x ", p[loop])); 107:inithma.c **** 108:inithma.c **** printf("\n"); 109:inithma.c **** } 110:inithma.c **** #else 111:inithma.c **** #define hdump(ptr) 112:inithma.c **** #endif 113:inithma.c **** 114:inithma.c **** #define KeyboardShiftState() (*(BYTE FAR *)(MK_FP(0x40,0x17))) 115:inithma.c **** 116:inithma.c **** /* 117:inithma.c **** this tests, if the HMA area can be enabled. 118:inithma.c **** if so, it simply leaves it on 119:inithma.c **** */ 120:inithma.c **** 121:inithma.c **** STATIC int EnabledA20(void) 122:inithma.c **** { 123:inithma.c **** return fmemcmp(MK_FP(0, 0), MK_FP(0xffff, 0x0010), 128); 124:inithma.c **** } 125:inithma.c **** 126:inithma.c **** int EnableHMA(VOID) 127:inithma.c **** { 18 .loc 1 127 0 0 0000313F 56 push si 0 00003140 57 push di 21 _.LCFI0: 128:inithma.c **** 129:inithma.c **** _EnableA20(); 22 .loc 1 129 0 0 00003141 9A[00000000] call (__EnableA20@OZSEG16):__EnableA20 24 _.LVL0: 25 _.LBB8: 26 _.LBB9: 123:inithma.c **** } 27 .loc 1 123 0 0 00003146 B88000 mov ax, 128 0 00003149 50 push ax 30 _.LCFI1: 0 0000314A B8FFFF mov ax, -1 0 0000314D 50 push ax 33 _.LCFI2: 0 0000314E B81000 mov ax, 16 0 00003151 50 push ax 36 _.LCFI3: 0 00003152 31FF xor di, di 0 00003154 57 push di 39 _.LCFI4: 0 00003155 57 push di 41 _.LCFI5: 0 00003156 E8[FEFF] call _init_fmemcmp 43 _.LCFI6: 44 _.LVL1: 45 _.LBE9: 46 _.LBE8: 130:inithma.c **** 131:inithma.c **** if (!EnabledA20()) 47 .loc 1 131 0 0 00003159 39F8 cmp ax, di 0 0000315B 750F jne _.L2 0 0000315D 96 xchg si, ax 132:inithma.c **** { 133:inithma.c **** printf("HMA can't be enabled\n"); 51 .loc 1 133 0 0 0000315E B8[0000] mov ax, offset _.LC0 53 _.L6: 54 _.LBB10: 55 _.LBB11: 134:inithma.c **** return FALSE; 135:inithma.c **** } 136:inithma.c **** 137:inithma.c **** _DisableA20(); 138:inithma.c **** 139:inithma.c **** #ifdef DEBUG 140:inithma.c **** if (EnabledA20()) 141:inithma.c **** { 142:inithma.c **** printf("HMA can't be disabled - no problem for us\n"); 143:inithma.c **** } 144:inithma.c **** #endif 145:inithma.c **** 146:inithma.c **** _EnableA20(); 147:inithma.c **** if (!EnabledA20()) 148:inithma.c **** { 149:inithma.c **** printf("HMA can't be enabled second time\n"); 56 .loc 1 149 0 0 00003161 50 push ax 58 _.LCFI7: 0 00003162 E8[FEFF] call _init_printf 60 _.LVL2: 0 00003165 83C402 add sp, 2 62 _.LCFI8: 63 _.L1: 64 _.LBE11: 65 _.LBE10: 150:inithma.c **** return FALSE; 151:inithma.c **** } 152:inithma.c **** 153:inithma.c **** HMAInitPrintf(("HMA success - leaving enabled\n")); 154:inithma.c **** 155:inithma.c **** return TRUE; 156:inithma.c **** 157:inithma.c **** } 66 .loc 1 157 0 0 00003168 96 xchg si, ax 0 00003169 5F pop di 0 0000316A 5E pop si 0 0000316B C3 ret 71 _.L2: 72 _.LBB15: 73 _.LBB14: 137:inithma.c **** 74 .loc 1 137 0 0 0000316C 9A[00000000] call (__DisableA20@OZSEG16):__DisableA20 76 _.LVL3: 146:inithma.c **** if (!EnabledA20()) 77 .loc 1 146 0 0 00003171 9A[00000000] call (__EnableA20@OZSEG16):__EnableA20 79 _.LVL4: 80 _.LBB12: 81 _.LBB13: 123:inithma.c **** } 82 .loc 1 123 0 0 00003176 B88000 mov ax, 128 0 00003179 50 push ax 85 _.LCFI9: 0 0000317A B8FFFF mov ax, -1 0 0000317D 50 push ax 88 _.LCFI10: 0 0000317E B81000 mov ax, 16 0 00003181 50 push ax 91 _.LCFI11: 0 00003182 57 push di 93 _.LCFI12: 0 00003183 57 push di 95 _.LCFI13: 0 00003184 E8[FEFF] call _init_fmemcmp 97 _.LCFI14: 98 _.LVL5: 0 00003187 89C6 mov si, ax 100 _.LBE13: 101 _.LBE12: 147:inithma.c **** { 102 .loc 1 147 0 0 00003189 85C0 test ax, ax 0 0000318B 7505 jne _.L4 149:inithma.c **** return FALSE; 105 .loc 1 149 0 0 0000318D B8[1600] mov ax, offset _.LC1 0 00003190 EBCF jmp _.L6 108 _.L4: 155:inithma.c **** 109 .loc 1 155 0 0 00003192 BE0100 mov si, 1 0 00003195 EBD1 jmp _.L1 112 _.LBE14: 113 _.LBE15: 114 _.LFE5: 115 .size _EnableHMA, .-_EnableHMA 116 .global _HMAalloc 117 .type _HMAalloc, @function 118 _HMAalloc: 119 _.LFB8: 158:inithma.c **** 159:inithma.c **** /* 160:inithma.c **** move the kernel up to high memory 161:inithma.c **** this is very unportable 162:inithma.c **** 163:inithma.c **** if we thin we succeeded, we return TRUE, else FALSE 164:inithma.c **** */ 165:inithma.c **** 166:inithma.c **** #define HMAOFFSET 0x20 167:inithma.c **** #define HMASEGMENT 0xffff 168:inithma.c **** 169:inithma.c **** int MoveKernelToHMA() 170:inithma.c **** { 171:inithma.c **** void far *xms_addr; 172:inithma.c **** 173:inithma.c **** if (DosLoadedInHMA) 174:inithma.c **** { 175:inithma.c **** return TRUE; 176:inithma.c **** } 177:inithma.c **** 178:inithma.c **** if ((xms_addr = DetectXMSDriver()) == NULL) 179:inithma.c **** return FALSE; 180:inithma.c **** 181:inithma.c **** XMSDriverAddress = xms_addr; 182:inithma.c **** XMS_Enable_Patch = 0x90; /* must be set after XMSDriverAddress */ 183:inithma.c **** 184:inithma.c **** #ifdef DEBUG 185:inithma.c **** /* A) for debugging purpose, suppress this, 186:inithma.c **** if any shift key is pressed 187:inithma.c **** */ 188:inithma.c **** if (KeyboardShiftState() & 0x0f) 189:inithma.c **** { 190:inithma.c **** printf("Keyboard state is %0x, NOT moving to HMA\n", 191:inithma.c **** KeyboardShiftState()); 192:inithma.c **** return FALSE; 193:inithma.c **** } 194:inithma.c **** #endif 195:inithma.c **** 196:inithma.c **** /* B) check out, if we can have HMA */ 197:inithma.c **** 198:inithma.c **** if (!EnableHMA()) 199:inithma.c **** { 200:inithma.c **** printf("Can't enable HMA area (the famous A20), NOT moving to HMA\n"); 201:inithma.c **** 202:inithma.c **** return FALSE; 203:inithma.c **** } 204:inithma.c **** 205:inithma.c **** /* allocate HMA through XMS driver */ 206:inithma.c **** 207:inithma.c **** if (HMAclaimed == 0 && 208:inithma.c **** (HMAclaimed = 209:inithma.c **** init_call_XMScall(xms_addr, 0x0100, 0xffff)) == 0) 210:inithma.c **** { 211:inithma.c **** printf("Can't reserve HMA area ??\n"); 212:inithma.c **** 213:inithma.c **** return FALSE; 214:inithma.c **** } 215:inithma.c **** 216:inithma.c **** MoveKernel(0xffff); 217:inithma.c **** 218:inithma.c **** { 219:inithma.c **** /* E) up to now, nothing really bad was done. 220:inithma.c **** but now, we reuse the HMA area. bad things will happen 221:inithma.c **** 222:inithma.c **** to find bugs early, 223:inithma.c **** cause INT 3 on all accesses to this area 224:inithma.c **** */ 225:inithma.c **** 226:inithma.c **** DosLoadedInHMA = TRUE; 227:inithma.c **** } 228:inithma.c **** 229:inithma.c **** /* 230:inithma.c **** on finalize, will install a VDISK 231:inithma.c **** */ 232:inithma.c **** 233:inithma.c **** InstallVDISK(); 234:inithma.c **** 235:inithma.c **** /* report the fact we are running high through int 21, ax=3306 */ 236:inithma.c **** LoL->version_flags |= 0x10; 237:inithma.c **** 238:inithma.c **** return TRUE; 239:inithma.c **** 240:inithma.c **** } 241:inithma.c **** 242:inithma.c **** /* 243:inithma.c **** now protect against HIMEM/FDXMS/... by simulating a VDISK 244:inithma.c **** FDXMS should detect us and not give HMA access to ohers 245:inithma.c **** unfortunately this also disables HIMEM completely 246:inithma.c **** 247:inithma.c **** so: we install this after all drivers have been loaded 248:inithma.c **** */ 249:inithma.c **** STATIC void InstallVDISK(void) 250:inithma.c **** { 251:inithma.c **** static struct { /* Boot-Sektor of a RAM-Disk */ 252:inithma.c **** UBYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */ 253:inithma.c **** char Name[5]; 254:inithma.c **** BYTE dummy2[3]; 255:inithma.c **** WORD BpS; 256:inithma.c **** BYTE dummy3[6]; 257:inithma.c **** WORD Sektoren; 258:inithma.c **** BYTE dummy4; 259:inithma.c **** } VDISK_BOOT_SEKTOR = { 260:inithma.c **** { 261:inithma.c **** 0xcf, ' ', ' '}, 262:inithma.c **** { 263:inithma.c **** 'V', 'D', 'I', 'S', 'K'}, 264:inithma.c **** { 265:inithma.c **** ' ', ' ', ' '}, 512, 266:inithma.c **** { 267:inithma.c **** 'F', 'D', 'O', 'S', ' ', ' '}, 128, /* 128*512 = 64K */ 268:inithma.c **** ' '}; 269:inithma.c **** 270:inithma.c **** if (!DosLoadedInHMA) 271:inithma.c **** return; 272:inithma.c **** 273:inithma.c **** fmemcpy(MK_FP(0xffff, 0x0010), &VDISK_BOOT_SEKTOR, 274:inithma.c **** sizeof(VDISK_BOOT_SEKTOR)); 275:inithma.c **** 276:inithma.c **** *(WORD FAR *) MK_FP(0xffff, 0x002e) = 1024 + 64; 277:inithma.c **** } 278:inithma.c **** 279:inithma.c **** /* 280:inithma.c **** this allocates some bytes from the HMA area 281:inithma.c **** only available if DOS=HIGH was successful 282:inithma.c **** */ 283:inithma.c **** 284:inithma.c **** VOID FAR * HMAalloc(COUNT bytesToAllocate) 285:inithma.c **** { 120 .loc 1 285 0 121 _.LVL6: 0 00003197 56 push si 0 00003198 55 push bp 124 _.LCFI15: 0 00003199 89E5 mov bp, sp 126 _.LCFI16: 0 0000319B 1E push ds 0 0000319C 1E push ds 0 0000319D 8B5E06 mov bx, word ptr [bp+6] 286:inithma.c **** VOID FAR *HMAptr; 287:inithma.c **** 288:inithma.c **** if (!DosLoadedInHMA) 130 .loc 1 288 0 0 000031A0 36803E[0000]00 cmp byte ptr ss:[_DosLoadedInHMA], 0 0 000031A6 B80000 mov ax, 0 0 000031A9 8ED8 mov ds, ax 0 000031AB 743C je _.L9 289:inithma.c **** return NULL; 290:inithma.c **** 291:inithma.c **** if (HMAFree > 0xfff0 - bytesToAllocate) 135 .loc 1 291 0 0 000031AD 368B36[0000] mov si, word ptr ss:[_HMAFree] 0 000031B2 B9F0FF mov cx, -16 0 000031B5 29D9 sub cx, bx 289:inithma.c **** return NULL; 139 .loc 1 289 0 0 000031B7 89C2 mov dx, ax 141 .loc 1 291 0 0 000031B9 39F1 cmp cx, si 0 000031BB 7223 jc _.L7 292:inithma.c **** return NULL; 293:inithma.c **** 294:inithma.c **** HMAptr = MK_FP(0xffff, HMAFree); 144 .loc 1 294 0 0 000031BD BAFFFF mov dx, -1 146 _.LVL7: 295:inithma.c **** 296:inithma.c **** /* align on 16 byte boundary */ 297:inithma.c **** HMAFree = (HMAFree + bytesToAllocate + 0xf) & 0xfff0; 147 .loc 1 297 0 0 000031C0 8D480F lea cx, [15+bx+si] 0 000031C3 83E1F0 and cx, -16 0 000031C6 36890E[0000] mov word ptr ss:[_HMAFree], cx 298:inithma.c **** 299:inithma.c **** /*printf("HMA allocated %d byte at %x\n", bytesToAllocate, HMAptr); */ 300:inithma.c **** 301:inithma.c **** fmemset(HMAptr, 0, bytesToAllocate); 151 .loc 1 301 0 0 000031CB 53 push bx 0 000031CC 1E push ds 0 000031CD 52 push dx 0 000031CE 8956FC mov word ptr [bp-4], dx 0 000031D1 56 push si 0 000031D2 8976FE mov word ptr [bp-2], si 0 000031D5 16 push ss 0 000031D6 1F pop ds 0 000031D7 E8[FEFF] call _init_fmemset 161 _.LVL8: 302:inithma.c **** 303:inithma.c **** return HMAptr; 162 .loc 1 303 0 0 000031DA 8B46FE mov ax, word ptr [bp-2] 0 000031DD 8B56FC mov dx, word ptr [bp-4] 165 _.LVL9: 166 _.L7: 304:inithma.c **** } 167 .loc 1 304 0 0 000031E0 89EC mov sp, bp 0 000031E2 5D pop bp 0 000031E3 5E pop si 0 000031E4 16 push ss 0 000031E5 1F pop ds 0 000031E6 C20200 ret 2 174 _.L9: 289:inithma.c **** 175 .loc 1 289 0 0 000031E9 89C0 mov ax, ax 0 000031EB 89C2 mov dx, ax 0 000031ED EBF1 jmp _.L7 179 _.LFE8: 180 .size _HMAalloc, .-_HMAalloc === Switch to base=012BB0h -> ".RODATA.STR1.1" 181 .section .rodata.str1.1 182 _.LC2: 0 00000C93 696C6C6567616C20 .string "illegal relocation entry # %d\n" 0 00000C9B 72656C6F63617469 0 00000CA3 6F6E20656E747279 0 00000CAB 20232025640A00 === Switch to base=012BB0h -> ".RODATA.CST2" 184 .section .rodata.cst2,"aM",@progbits,2 185 .p2align 1 186 _.LC3: 0 00000D08 [0000] .hword __HMARelocationTableEnd === Switch to base=002270h -> ".TEXT" 188 .text 189 .global _MoveKernel 190 .type _MoveKernel, @function 191 _MoveKernel: 192 _.LFB9: 305:inithma.c **** 306:inithma.c **** unsigned CurrentKernelSegment = 0; 307:inithma.c **** 308:inithma.c **** /* relocate segment with HMA_TEXT code group */ 309:inithma.c **** void MoveKernel(unsigned NewKernelSegment) 310:inithma.c **** { 193 .loc 1 310 0 194 _.LVL10: 0 000031EF 56 push si 0 000031F0 57 push di 0 000031F1 55 push bp 198 _.LCFI17: 0 000031F2 89E5 mov bp, sp 200 _.LCFI18: 0 000031F4 83EC0C sub sp, 12 0 000031F7 8B7E08 mov di, word ptr [bp+8] 311:inithma.c **** UBYTE FAR *HMADest; 312:inithma.c **** UBYTE FAR *HMASource; 313:inithma.c **** unsigned len; 314:inithma.c **** unsigned jmpseg = CurrentKernelSegment; 203 .loc 1 314 0 0 000031FA A1[0000] mov ax, word ptr [_CurrentKernelSegment] 0 000031FD 8946F6 mov word ptr [bp-10], ax 206 _.LVL11: 315:inithma.c **** 316:inithma.c **** /* if the first time called, initialize to end of HMA_TEXT code group segment */ 317:inithma.c **** if (CurrentKernelSegment == 0) 207 .loc 1 317 0 0 00003200 85C0 test ax, ax 0 00003202 7506 jne _.L13 318:inithma.c **** CurrentKernelSegment = FP_SEG(_HMATextEnd); 210 .loc 1 318 0 0 00003204 B8[0000] mov ax, offset __HMATextEnd@OZSEG16 212 _.LVL12: 0 00003207 A3[0000] mov word ptr [_CurrentKernelSegment], ax 214 _.LVL13: 215 _.L13: 319:inithma.c **** 320:inithma.c **** /* if already relocated into HMA, nothing to do */ 321:inithma.c **** if (CurrentKernelSegment == 0xffff) 216 .loc 1 321 0 0 0000320A 8B0E[0000] mov cx, word ptr [_CurrentKernelSegment] 0 0000320E 83F9FF cmp cx, -1 0 00003211 7503E98600 je _.L12 322:inithma.c **** return; 323:inithma.c **** 324:inithma.c **** HMASource = 325:inithma.c **** MK_FP(CurrentKernelSegment, (FP_OFF(_HMATextStart) & 0xfff0)); 220 .loc 1 325 0 0 00003216 BA[0000] mov dx, offset ___ia16_near_alias.0 0 00003219 83E2F0 and dx, -16 223 _.LVL14: 326:inithma.c **** HMADest = MK_FP(NewKernelSegment, 0x0000); 224 .loc 1 326 0 0 0000321C 31F6 xor si, si 226 _.LVL15: 327:inithma.c **** 328:inithma.c **** len = (FP_OFF(_HMATextEnd) | 0x000f) - (FP_OFF(_HMATextStart) & 0xfff0); 227 .loc 1 328 0 0 0000321E B8[0000] mov ax, offset ___ia16_near_alias.1 0 00003221 83C80F or ax, 15 0 00003224 BB[0000] mov bx, offset ___ia16_near_alias.2 0 00003227 83E3F0 and bx, -16 0 0000322A 29D8 sub ax, bx 233 _.LVL16: 329:inithma.c **** 330:inithma.c **** /* HMA doesn't start until a paragraph into 0xffff segment */ 331:inithma.c **** /* HMA begins with VDISK header to mark area is used */ 332:inithma.c **** if (NewKernelSegment == 0xffff) 234 .loc 1 332 0 0 0000322C 83FFFF cmp di, -1 0 0000322F 7519 jne _.L15 333:inithma.c **** { 334:inithma.c **** HMASource += HMAOFFSET; 237 .loc 1 334 0 0 00003231 83C220 add dx, 32 239 _.LVL17: 335:inithma.c **** HMADest += HMAOFFSET; 240 .loc 1 335 0 0 00003234 BE2000 mov si, 32 242 _.LVL18: 336:inithma.c **** len -= HMAOFFSET; 243 .loc 1 336 0 0 00003237 83C0E0 add ax, -32 245 _.LVL19: 246 _.L16: 337:inithma.c **** } 338:inithma.c **** 339:inithma.c **** HMAInitPrintf(("HMA moving %p up to %p for %04x bytes\n", 340:inithma.c **** HMASource, HMADest, len)); 341:inithma.c **** 342:inithma.c **** if (NewKernelSegment < CurrentKernelSegment || 343:inithma.c **** NewKernelSegment == 0xffff) 344:inithma.c **** fmemcpy(HMADest, HMASource, len); 247 .loc 1 344 0 0 0000323A 50 push ax 0 0000323B 8946F4 mov word ptr [bp-12], ax 0 0000323E 51 push cx 0 0000323F 52 push dx 0 00003240 57 push di 0 00003241 56 push si 0 00003242 E8[FEFF] call _init_fmemcpy 255 _.LVL20: 0 00003245 8B46F4 mov ax, word ptr [bp-12] 0 00003248 EB04 jmp _.L17 258 _.LVL21: 259 _.L15: 342:inithma.c **** NewKernelSegment == 0xffff) 260 .loc 1 342 0 0 0000324A 39F9 cmp cx, di 0 0000324C 77EC ja _.L16 263 _.LVL22: 264 _.L17: 345:inithma.c **** /* else it's the very first relocation: handled by kernel.asm */ 346:inithma.c **** 347:inithma.c **** HMAFree = (FP_OFF(HMADest) + len + 0xf) & 0xfff0; 265 .loc 1 347 0 0 0000324E 93 xchg bx, ax 0 0000324F 8D400F lea ax, [15+bx+si] 0 00003252 83E0F0 and ax, -16 0 00003255 A3[0000] mov word ptr [_HMAFree], ax 270 _.LVL23: 271 _.LBB16: 348:inithma.c **** /* first free byte after HMA_TEXT on 16 byte boundary */ 349:inithma.c **** 350:inithma.c **** { 351:inithma.c **** /* D) but it only makes sense, if we can relocate 352:inithma.c **** all our entries to make use of HMA 353:inithma.c **** */ 354:inithma.c **** 355:inithma.c **** /* this is for a 356:inithma.c **** call near enableA20 357:inithma.c **** jmp far kernelentry 358:inithma.c **** style table 359:inithma.c **** */ 360:inithma.c **** 361:inithma.c **** struct RelocationTable FAR *rp; 362:inithma.c **** struct RelocationTable rtemp; 363:inithma.c **** 364:inithma.c **** /* verify, that all entries are valid */ 365:inithma.c **** 366:inithma.c **** for (rp = _HMARelocationTableStart; rp < _HMARelocationTableEnd; rp++) 272 .loc 1 366 0 0 00003258 BE[0000] mov si, offset __HMARelocationTableStart@OZSEG16 0 0000325B BB[0000] mov bx, offset __HMARelocationTableStart 0 0000325E BA[0000] mov dx, offset __HMARelocationTableEnd 0 00003261 B8[0000] mov ax, offset __HMARelocationTableEnd@OZSEG16 277 _.L18: 278 _.LVL24: 279 .loc 1 366 0 is_stmt 0 discriminator 1 0 00003264 39F0 cmp ax, si 0 00003266 773C ja _.L22 0 00003268 7504 jne _.L30 0 0000326A 39DA cmp dx, bx 0 0000326C 7736 ja _.L22 285 _.L30: 0 0000326E BB[0000] mov bx, offset __HMARelocationTableStart 287 _.LVL25: 288 _.L24: 367:inithma.c **** { 368:inithma.c **** if (rp->jmpFar != 0xea || /* jmp FAR */ 369:inithma.c **** rp->jmpSegment != jmpseg || /* will only relocate HMA_TEXT */ 370:inithma.c **** rp->callNear != 0xe8 || /* call NEAR */ 371:inithma.c **** 0) 372:inithma.c **** { 373:inithma.c **** printf("illegal relocation entry # %d\n", 374:inithma.c **** (FP_OFF(rp) - 375:inithma.c **** FP_OFF(_HMARelocationTableStart)) / 376:inithma.c **** sizeof(struct RelocationTable)); 377:inithma.c **** int3(); 378:inithma.c **** goto errorReturn; 379:inithma.c **** } 380:inithma.c **** } 381:inithma.c **** 382:inithma.c **** /* OK, all valid, go to relocate */ 383:inithma.c **** 384:inithma.c **** for (rp = _HMARelocationTableStart; rp < _HMARelocationTableEnd; rp++) 289 .loc 1 384 0 is_stmt 1 discriminator 1 0 00003271 39F0 cmp ax, si 0 00003273 7763 ja _.L27 0 00003275 7506 jne _.L31 0 00003277 391E[0000] cmp word ptr [_.LC3], bx 0 0000327B 775B ja _.L27 295 _.L31: 385:inithma.c **** { 386:inithma.c **** if (NewKernelSegment == 0xffff) 387:inithma.c **** { 388:inithma.c **** struct RelocatedEntry FAR *rel = (struct RelocatedEntry FAR *)rp; 389:inithma.c **** 390:inithma.c **** fmemcpy(&rtemp, rp, sizeof(rtemp)); 391:inithma.c **** 392:inithma.c **** rel->jmpFar = rtemp.jmpFar; 393:inithma.c **** rel->jmpSegment = NewKernelSegment; 394:inithma.c **** rel->jmpOffset = rtemp.jmpOffset; 395:inithma.c **** rel->callNear = rtemp.callNear; 396:inithma.c **** rel->callOffset = rtemp.callOffset + 5; /* near calls are relative */ 397:inithma.c **** } 398:inithma.c **** else 399:inithma.c **** rp->jmpSegment = NewKernelSegment; 400:inithma.c **** 401:inithma.c **** } 402:inithma.c **** 403:inithma.c **** if (NewKernelSegment == 0xffff) 296 .loc 1 403 0 0 0000327D 83FFFF cmp di, -1 0 00003280 7516 jne _.L29 404:inithma.c **** { 405:inithma.c **** /* jmp far cpm_entry (copy from 0:c0) */ 406:inithma.c **** pokeb(0xffff, 0x30 * 4 + 0x10, 0xea); 299 .loc 1 406 0 0 00003282 8EC7 mov es, di 0 00003284 26C606D000EA mov byte ptr es:[208], -22 407:inithma.c **** pokel(0xffff, 0x30 * 4 + 0x11, (ULONG)cpm_entry); 302 .loc 1 407 0 0 0000328A 26C706D100[0000] mov word ptr es:[209], offset _cpm_entry 0 00003291 B8[0000] mov ax, offset _cpm_entry@OZSEG16 0 00003294 26A3D300 mov word ptr es:[211], ax 306 _.L29: 307 _.LBE16: 408:inithma.c **** } 409:inithma.c **** } 410:inithma.c **** 411:inithma.c **** CurrentKernelSegment = NewKernelSegment; 308 .loc 1 411 0 0 00003298 893E[0000] mov word ptr [_CurrentKernelSegment], di 310 _.LVL26: 311 _.L12: 412:inithma.c **** return; 413:inithma.c **** 414:inithma.c **** errorReturn: 415:inithma.c **** for (;;) ; 416:inithma.c **** } 312 .loc 1 416 0 0 0000329C 89EC mov sp, bp 0 0000329E 5D pop bp 0 0000329F 5F pop di 0 000032A0 5E pop si 0 000032A1 C20200 ret 2 318 _.LVL27: 319 _.L22: 320 _.LBB18: 368:inithma.c **** rp->jmpSegment != jmpseg || /* will only relocate HMA_TEXT */ 321 .loc 1 368 0 0 000032A4 8EC6 mov es, si 0 000032A6 26803FEA cmp byte ptr es:[bx], -22 0 000032AA 7415 je _.L19 325 _.L21: 374:inithma.c **** FP_OFF(_HMARelocationTableStart)) / 326 .loc 1 374 0 0 000032AC 81EB[0000] sub bx, offset ___ia16_near_alias.3 328 _.LVL28: 373:inithma.c **** (FP_OFF(rp) - 329 .loc 1 373 0 0 000032B0 B103 mov cl, 3 0 000032B2 D3EB shr bx, cl 332 _.LVL29: 0 000032B4 53 push bx 0 000032B5 B8[3800] mov ax, offset _.LC2 0 000032B8 50 push ax 0 000032B9 E8[FEFF] call _init_printf 337 _.LVL30: 378:inithma.c **** } 338 .loc 1 378 0 0 000032BC 83C404 add sp, 4 340 _.L20: 0 000032BF EBFE jmp _.L20 342 _.LVL31: 343 _.L19: 368:inithma.c **** rp->jmpSegment != jmpseg || /* will only relocate HMA_TEXT */ 344 .loc 1 368 0 discriminator 1 0 000032C1 8EC6 mov es, si 0 000032C3 8B4EF6 mov cx, word ptr [bp-10] 0 000032C6 263B4F03 cmp cx, word ptr es:[bx+3] 0 000032CA 75E0 jne _.L21 370:inithma.c **** 0) 349 .loc 1 370 0 0 000032CC 26807F05E8 cmp byte ptr es:[bx+5], -24 0 000032D1 75D9 jne _.L21 366:inithma.c **** { 352 .loc 1 366 0 discriminator 2 0 000032D3 83C308 add bx, 8 354 _.LVL32: 0 000032D6 EB8C jmp _.L18 356 _.LVL33: 357 _.L27: 386:inithma.c **** { 358 .loc 1 386 0 0 000032D8 83FFFF cmp di, -1 0 000032DB 7544 jne _.L25 0 000032DD 8946F4 mov word ptr [bp-12], ax 362 _.LVL34: 363 _.LBB17: 390:inithma.c **** 364 .loc 1 390 0 0 000032E0 BA0800 mov dx, 8 0 000032E3 52 push dx 0 000032E4 56 push si 0 000032E5 53 push bx 0 000032E6 895EF6 mov word ptr [bp-10], bx 0 000032E9 8D56F8 lea dx, [-8+bp] 0 000032EC 16 push ss 0 000032ED 52 push dx 0 000032EE E8[FEFF] call _init_fmemcpy 374 _.LVL35: 392:inithma.c **** rel->jmpSegment = NewKernelSegment; 375 .loc 1 392 0 0 000032F1 8A56F8 mov dl, byte ptr [bp-8] 0 000032F4 8EC6 mov es, si 0 000032F6 8B5EF6 mov bx, word ptr [bp-10] 0 000032F9 26885703 mov byte ptr es:[bx+3], dl 380 _.LVL36: 393:inithma.c **** rel->jmpOffset = rtemp.jmpOffset; 381 .loc 1 393 0 0 000032FD 26897F06 mov word ptr es:[bx+6], di 394:inithma.c **** rel->callNear = rtemp.callNear; 383 .loc 1 394 0 0 00003301 8B56F9 mov dx, word ptr [bp-7] 0 00003304 26895704 mov word ptr es:[bx+4], dx 395:inithma.c **** rel->callOffset = rtemp.callOffset + 5; /* near calls are relative */ 386 .loc 1 395 0 0 00003308 8A56FD mov dl, byte ptr [bp-3] 0 0000330B 268817 mov byte ptr es:[bx], dl 396:inithma.c **** } 389 .loc 1 396 0 0 0000330E 8B56FE mov dx, word ptr [bp-2] 0 00003311 83C205 add dx, 5 0 00003314 26895701 mov word ptr es:[bx+1], dx 393 _.LBE17: 0 00003318 8B46F4 mov ax, word ptr [bp-12] 395 _.L26: 384:inithma.c **** { 396 .loc 1 384 0 discriminator 2 0 0000331B 83C308 add bx, 8 398 _.LVL37: 0 0000331E E950FF jmp _.L24 400 _.L25: 399:inithma.c **** 401 .loc 1 399 0 0 00003321 8EC6 mov es, si 0 00003323 26897F03 mov word ptr es:[bx+3], di 0 00003327 EBF2 jmp _.L26 405 _.LBE18: 406 _.LFE9: 407 .size _MoveKernel, .-_MoveKernel === Switch to base=012BB0h -> ".RODATA.STR1.1" 408 .section .rodata.str1.1 409 _.LC4: 0 00000CB2 43616E277420656E .string "Can't enable HMA area (the famous A20), NOT moving to HMA\n" 0 00000CBA 61626C6520484D41 0 00000CC2 2061726561202874 0 00000CCA 68652066616D6F75 0 00000CD2 7320413230292C20 0 00000CDA 4E4F54206D6F7669 0 00000CE2 6E6720746F20484D 0 00000CEA 410A00 411 _.LC5: 0 00000CED 43616E2774207265 .string "Can't reserve HMA area ??\n" 0 00000CF5 736572766520484D 0 00000CFD 412061726561203F 0 00000D05 3F0A00 === Switch to base=002270h -> ".TEXT" 413 .text 414 .global _MoveKernelToHMA 415 .type _MoveKernelToHMA, @function 416 _MoveKernelToHMA: 417 _.LFB6: 170:inithma.c **** void far *xms_addr; 418 .loc 1 170 0 0 00003329 56 push si 0 0000332A 57 push di 0 0000332B 55 push bp 422 _.LCFI19: 0 0000332C 89E5 mov bp, sp 424 _.LCFI20: 0 0000332E 1E push ds 173:inithma.c **** { 426 .loc 1 173 0 0 0000332F 803E[0000]00 cmp byte ptr [_DosLoadedInHMA], 0 0 00003334 7403E99B00 jne _.L41 178:inithma.c **** return FALSE; 429 .loc 1 178 0 0 00003339 E8[FEFF] call _DetectXMSDriver 431 _.LVL38: 0 0000333C 89C7 mov di, ax 433 _.LVL39: 0 0000333E 96 xchg si, ax 0 0000333F 09D6 or si, dx 0 00003341 7433 je _.L36 181:inithma.c **** XMS_Enable_Patch = 0x90; /* must be set after XMSDriverAddress */ 437 .loc 1 181 0 0 00003343 B8[0000] mov ax, offset _XMSDriverAddress@OZSEG16 439 _.LVL40: 0 00003346 8EC0 mov es, ax 0 00003348 26893E[0000] mov word ptr es:[_XMSDriverAddress], di 0 0000334D 268916[0200] mov word ptr es:[_XMSDriverAddress+2], dx 0 00003352 8956FE mov word ptr [bp-2], dx 182:inithma.c **** 444 .loc 1 182 0 0 00003355 B8[0000] mov ax, offset _XMS_Enable_Patch@OZSEG16 0 00003358 8EC0 mov es, ax 0 0000335A 26C606[0000]90 mov byte ptr es:[_XMS_Enable_Patch], -112 198:inithma.c **** { 448 .loc 1 198 0 0 00003360 E8[FEFF] call _EnableHMA 450 _.LVL41: 0 00003363 89C6 mov si, ax 0 00003365 85C0 test ax, ax 0 00003367 8B56FE mov dx, word ptr [bp-2] 0 0000336A 7511 jne _.L39 200:inithma.c **** 455 .loc 1 200 0 0 0000336C B8[5700] mov ax, offset _.LC4 0 0000336F 50 push ax 0 00003370 E8[FEFF] call _init_printf 459 _.LVL42: 202:inithma.c **** } 460 .loc 1 202 0 0 00003373 83C402 add sp, 2 462 _.L36: 240:inithma.c **** 463 .loc 1 240 0 0 00003376 96 xchg si, ax 0 00003377 89EC mov sp, bp 0 00003379 5D pop bp 0 0000337A 5F pop di 0 0000337B 5E pop si 0 0000337C C3 ret 470 _.L39: 207:inithma.c **** (HMAclaimed = 471 .loc 1 207 0 0 0000337D 803E[0000]00 cmp byte ptr [_HMAclaimed], 0 0 00003382 BEFFFF mov si, -1 0 00003385 7520 jne _.L40 209:inithma.c **** { 475 .loc 1 209 0 discriminator 1 0 00003387 56 push si 0 00003388 B80001 mov ax, 256 0 0000338B 50 push ax 0 0000338C 52 push dx 0 0000338D 57 push di 0 0000338E E8[FEFF] call _init_call_XMScall 482 _.LVL43: 208:inithma.c **** init_call_XMScall(xms_addr, 0x0100, 0xffff)) == 0) 483 .loc 1 208 0 discriminator 1 0 00003391 A2[0000] mov byte ptr [_HMAclaimed], al 207:inithma.c **** (HMAclaimed = 485 .loc 1 207 0 discriminator 1 0 00003394 84C0 test al, al 0 00003396 750F jne _.L40 211:inithma.c **** 488 .loc 1 211 0 0 00003398 B8[9200] mov ax, offset _.LC5 0 0000339B 50 push ax 0 0000339C E8[FEFF] call _init_printf 492 _.LVL44: 213:inithma.c **** } 493 .loc 1 213 0 0 0000339F 83C402 add sp, 2 0 000033A2 8D7401 lea si, [1+si] 0 000033A5 EBCF jmp _.L36 497 _.L40: 216:inithma.c **** 498 .loc 1 216 0 0 000033A7 56 push si 0 000033A8 E8[FEFF] call _MoveKernel 501 _.LVL45: 226:inithma.c **** } 502 .loc 1 226 0 0 000033AB C606[0000]01 mov byte ptr [_DosLoadedInHMA], 1 504 _.LBB21: 505 _.LBB22: 273:inithma.c **** sizeof(VDISK_BOOT_SEKTOR)); 506 .loc 1 273 0 0 000033B0 B81600 mov ax, 22 0 000033B3 50 push ax 0 000033B4 16 push ss 0 000033B5 B8[0000] mov ax, offset _VDISK_BOOT_SEKTOR.1873 0 000033B8 50 push ax 0 000033B9 56 push si 0 000033BA B81000 mov ax, 16 0 000033BD 50 push ax 0 000033BE E8[FEFF] call _init_fmemcpy 516 _.LVL46: 276:inithma.c **** } 517 .loc 1 276 0 0 000033C1 8EC6 mov es, si 0 000033C3 26C7062E004004 mov word ptr es:[46], 1088 520 _.LBE22: 521 _.LBE21: 236:inithma.c **** 522 .loc 1 236 0 0 000033CA C41E[0000] les bx, dword ptr [_LoL] 0 000033CE 26808F950010 or byte ptr es:[bx+149], 16 525 _.L41: 175:inithma.c **** } 526 .loc 1 175 0 0 000033D4 BE0100 mov si, 1 0 000033D7 EB9D jmp _.L36 529 _.LFE6: 530 .size _MoveKernelToHMA, .-_MoveKernelToHMA === Switch to base=000790h -> ".DATA" 531 .data 532 .type _VDISK_BOOT_SEKTOR.1873, @object 533 .size _VDISK_BOOT_SEKTOR.1873, 22 534 _VDISK_BOOT_SEKTOR.1873: 0 0000056E CF .byte -49 0 0000056F 20 .byte 32 0 00000570 20 .byte 32 0 00000571 56 .byte 86 0 00000572 44 .byte 68 0 00000573 49 .byte 73 0 00000574 53 .byte 83 0 00000575 4B .byte 75 0 00000576 20 .byte 32 0 00000577 20 .byte 32 0 00000578 20 .byte 32 0 00000579 0002 .hword 512 0 0000057B 46 .byte 70 0 0000057C 44 .byte 68 0 0000057D 4F .byte 79 0 0000057E 53 .byte 83 0 0000057F 20 .byte 32 0 00000580 20 .byte 32 0 00000581 8000 .hword 128 0 00000583 20 .byte 32 555 .global _CurrentKernelSegment === Switch to base=012BB0h -> ".BSS" 556 .bss 557 .p2align 1 558 .type _CurrentKernelSegment, @object 559 .size _CurrentKernelSegment, 2 560 _CurrentKernelSegment: 0 00002036 0000 .skip 2,0 562 .global _HMAFree 563 .p2align 1 564 .type _HMAFree, @object 565 .size _HMAFree, 2 566 _HMAFree: 0 00002038 0000 .skip 2,0 568 .global _HMAclaimed 569 .p2align 0 570 .type _HMAclaimed, @object 571 .size _HMAclaimed, 1 572 _HMAclaimed: 0 0000203A 00 .skip 1,0 574 .global _DosLoadedInHMA 575 .p2align 0 576 .type _DosLoadedInHMA, @object 577 .size _DosLoadedInHMA, 1 578 _DosLoadedInHMA: 0 0000203B 00 .skip 1,0 580 .weakref ___ia16_near_alias.3,__HMARelocationTableStart 581 .weakref ___ia16_near_alias.2,__HMATextStart 582 .weakref ___ia16_near_alias.1,__HMATextEnd 583 .weakref ___ia16_near_alias.0,__HMATextStart === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: initoem.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=initoem.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccbrqFgD.s output file : initoem.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:56.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _init_oem 8 .type _init_oem, @function 9 _init_oem: 10 _.LFB4: 11 .file 1 "initoem.c" 1:initoem.c **** /****************************************************************/ 2:initoem.c **** /* */ 3:initoem.c **** /* initoem.c */ 4:initoem.c **** /* */ 5:initoem.c **** /* OEM Initializattion Functions */ 6:initoem.c **** /* */ 7:initoem.c **** /* Copyright (c) 1995 */ 8:initoem.c **** /* Pasquale J. Villani */ 9:initoem.c **** /* All Rights Reserved */ 10:initoem.c **** /* */ 11:initoem.c **** /* This file is part of DOS-C. */ 12:initoem.c **** /* */ 13:initoem.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:initoem.c **** /* modify it under the terms of the GNU General Public License */ 15:initoem.c **** /* as published by the Free Software Foundation; either version */ 16:initoem.c **** /* 2, or (at your option) any later version. */ 17:initoem.c **** /* */ 18:initoem.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:initoem.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:initoem.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:initoem.c **** /* the GNU General Public License for more details. */ 22:initoem.c **** /* */ 23:initoem.c **** /* You should have received a copy of the GNU General Public */ 24:initoem.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:initoem.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:initoem.c **** /* Cambridge, MA 02139, USA. */ 27:initoem.c **** /* */ 28:initoem.c **** /****************************************************************/ 29:initoem.c **** 30:initoem.c **** #include "portab.h" 31:initoem.c **** #include "init-mod.h" 32:initoem.c **** 33:initoem.c **** #ifdef VERSION_STRINGS 34:initoem.c **** static BYTE *RcsId = 35:initoem.c **** "$Id: initoem.c 1321 2007-05-21 02:16:36Z bartoldeman $"; 36:initoem.c **** #endif 37:initoem.c **** 38:initoem.c **** #define EBDASEG 0x40e 39:initoem.c **** #define RAMSIZE 0x413 40:initoem.c **** 41:initoem.c **** unsigned init_oem(void) 42:initoem.c **** { 12 .loc 1 42 0 0 0000309E 55 push bp 14 _.LCFI0: 0 0000309F 89E5 mov bp, sp 16 _.LCFI1: 0 000030A1 83EC18 sub sp, 24 43:initoem.c **** iregs r; 44:initoem.c **** init_call_intr(0x12, &r); 18 .loc 1 44 0 0 000030A4 8D46E8 lea ax, [-24+bp] 0 000030A7 50 push ax 0 000030A8 B81200 mov ax, 18 0 000030AB 50 push ax 0 000030AC E8[FEFF] call _init_call_intr 24 _.LVL0: 45:initoem.c **** return r.a.x; 46:initoem.c **** } 25 .loc 1 46 0 0 000030AF 8B46E8 mov ax, word ptr [bp-24] 0 000030B2 89EC mov sp, bp 0 000030B4 5D pop bp 0 000030B5 C3 ret 30 _.LFE4: 31 .size _init_oem, .-_init_oem 32 .global _movebda 33 .type _movebda, @function 34 _movebda: 35 _.LFB5: 47:initoem.c **** 48:initoem.c **** void movebda(size_t bytes, unsigned new_seg) 49:initoem.c **** { 36 .loc 1 49 0 37 _.LVL1: 0 000030B6 56 push si 0 000030B7 57 push di 0 000030B8 55 push bp 41 _.LCFI2: 0 000030B9 89E5 mov bp, sp 43 _.LCFI3: 44 _.LVL2: 50:initoem.c **** unsigned old_seg = peek(0, EBDASEG); 51:initoem.c **** fmemcpy(MK_FP(new_seg, 0), MK_FP(old_seg, 0), bytes); 45 .loc 1 51 0 0 000030BB FF7608 push word ptr [bp+8] 47 _.LVL3: 50:initoem.c **** unsigned old_seg = peek(0, EBDASEG); 48 .loc 1 50 0 0 000030BE BF0E04 mov di, 1038 0 000030C1 31F6 xor si, si 51 .loc 1 51 0 0 000030C3 8EC6 mov es, si 0 000030C5 26FF35 push word ptr es:[di] 0 000030C8 56 push si 0 000030C9 FF760A push word ptr [bp+10] 0 000030CC 56 push si 0 000030CD E8[FEFF] call _init_fmemcpy 58 _.LVL4: 52:initoem.c **** poke(0, EBDASEG, new_seg); 59 .loc 1 52 0 0 000030D0 8EC6 mov es, si 0 000030D2 8B460A mov ax, word ptr [bp+10] 0 000030D5 268905 mov word ptr es:[di], ax 63 _.LVL5: 53:initoem.c **** poke(0, RAMSIZE, ram_top); 64 .loc 1 53 0 0 000030D8 8B16[0000] mov dx, word ptr [_ram_top] 0 000030DC 2689161304 mov word ptr es:[1043], dx 54:initoem.c **** } 67 .loc 1 54 0 0 000030E1 89EC mov sp, bp 0 000030E3 5D pop bp 0 000030E4 5F pop di 0 000030E5 5E pop si 0 000030E6 C20400 ret 4 73 _.LFE5: 74 .size _movebda, .-_movebda 75 .global _ebdasize 76 .type _ebdasize, @function 77 _ebdasize: 78 _.LFB6: 55:initoem.c **** 56:initoem.c **** unsigned ebdasize(void) 57:initoem.c **** { 79 .loc 1 57 0 80 _.LVL6: 58:initoem.c **** unsigned ebdaseg = peek(0, EBDASEG); 59:initoem.c **** unsigned ramsize = ram_top; 81 .loc 1 59 0 0 000030E9 8B16[0000] mov dx, word ptr [_ram_top] 83 _.LVL7: 60:initoem.c **** 61:initoem.c **** if (ramsize == peek(0, RAMSIZE)) 84 .loc 1 61 0 0 000030ED 31DB xor bx, bx 62:initoem.c **** if (ramsize * 64 == ebdaseg && ramsize < 640 && peek(0, RAMSIZE) == ramsize) 63:initoem.c **** { 64:initoem.c **** unsigned ebdasz = peekb(ebdaseg, 0); 65:initoem.c **** 66:initoem.c **** /* sanity check: is there really no more than 63 KB? 67:initoem.c **** * must be at 640k (all other values never seen and are untested) 68:initoem.c **** */ 69:initoem.c **** if (ebdasz <= 63 && ramsize + ebdasz == 640) 70:initoem.c **** return ebdasz * 1024U; 71:initoem.c **** } 72:initoem.c **** return 0; 86 .loc 1 72 0 0 000030EF 89D8 mov ax, bx 61:initoem.c **** if (ramsize * 64 == ebdaseg && ramsize < 640 && peek(0, RAMSIZE) == ramsize) 88 .loc 1 61 0 0 000030F1 8EC3 mov es, bx 0 000030F3 263B161304 cmp dx, word ptr es:[1043] 0 000030F8 7540 jne _.L21 57:initoem.c **** unsigned ebdaseg = peek(0, EBDASEG); 92 .loc 1 57 0 0 000030FA 57 push di 94 _.LVL8: 0 000030FB 55 push bp 96 _.LCFI4: 0 000030FC 89E5 mov bp, sp 98 _.LCFI5: 0 000030FE 1E push ds 58:initoem.c **** unsigned ramsize = ram_top; 100 .loc 1 58 0 0 000030FF 26A10E04 mov ax, word ptr es:[1038] 62:initoem.c **** { 102 .loc 1 62 0 0 00003103 89D7 mov di, dx 0 00003105 B106 mov cl, 6 0 00003107 D3E7 shl di, cl 0 00003109 39C7 cmp di, ax 0 0000310B 752E jne _.L8 0 0000310D 81FA8002 cmp dx, 639+1 0 00003111 7328 jnc _.L8 110 _.LBB2: 64:initoem.c **** 111 .loc 1 64 0 0 00003113 8EC0 mov es, ax 0 00003115 268A07 mov al, byte ptr es:[bx] 0 00003118 8846FE mov byte ptr [bp-2], al 0 0000311B C646FF00 mov byte ptr [bp-1], 0 116 _.LVL9: 117 _.LBE2: 118 .loc 1 72 0 0 0000311F 93 xchg bx, ax 120 _.LBB3: 69:initoem.c **** return ebdasz * 1024U; 121 .loc 1 69 0 0 00003120 837EFE3F cmp word ptr [bp-2], 63 0 00003124 7710 ja _.L5 69:initoem.c **** return ebdasz * 1024U; 124 .loc 1 69 0 is_stmt 0 discriminator 1 0 00003126 0356FE add dx, word ptr [bp-2] 126 _.LVL10: 0 00003129 81FA8002 cmp dx, 640 0 0000312D 7507 jne _.L5 70:initoem.c **** } 129 .loc 1 70 0 is_stmt 1 0 0000312F 8B46FE mov ax, word ptr [bp-2] 0 00003132 B10A mov cl, 10 0 00003134 D3E0 shl ax, cl 133 _.LVL11: 134 _.L5: 135 _.LBE3: 73:initoem.c **** } 136 .loc 1 73 0 0 00003136 89EC mov sp, bp 0 00003138 5D pop bp 0 00003139 5F pop di 140 _.L21: 141 _.LCFI6: 0 0000313A C3 ret 143 _.LVL12: 144 _.L8: 145 _.LCFI7: 72:initoem.c **** } 146 .loc 1 72 0 0 0000313B 31C0 xor ax, ax 0 0000313D EBF7 jmp _.L5 149 _.LFE6: 150 .size _ebdasize, .-_ebdasize === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: int2f.lst 1 ; 2 ; File: 3 ; int2f.asm 4 ; Description: 5 ; multiplex interrupt support code 6 ; 7 ; Copyright (c) 1996, 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Id: int2f.asm 1591 2011-05-06 01:46:55Z bartoldeman $ 29 ; 30 31 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 32 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 33 34 ; macro to switch to an internal stack (if necessary), set DS == SS == DGROUP, 35 ; and push the old SS:SP onto the internal stack 36 ; 37 ; destroys AX, SI, BP; turns on IRQs 38 ; 39 ; int2f does not really need to switch to a separate stack for MS-DOS 40 ; compatibility; this is mainly to work around the C code's assumption 41 ; that SS == DGROUP 42 ; 43 ; TODO: remove the need for this hackery -- tkchia 44 %macro SwitchToInt2fStack 0 45 mov ax,[cs:_DGROUP_] 46 mov ds,ax 47 mov si,ss 48 mov bp,sp 49 cmp ax,si 50 jz %%already 51 cli 52 mov ss,ax 53 extern int2f_stk_top 54 mov sp,int2f_stk_top 55 sti 56 %%already: 57 ; well, GCC does not currently clobber function parameters passed on the 58 ; stack; but just in case it decides to do that in the future, we push _two_ 59 ; copies of the old SS:SP: 60 ; - the second copy can be passed as a pointer parameter to a C function 61 ; - the first copy is used to actually restore the user stack later 62 push si 63 push bp 64 push si 65 push bp 66 %endmacro 67 68 ; macro to switch back from an internal stack, i.e. undo SwitchToInt2fStack 69 ; 70 ; destroys BP; turns on IRQs -- tkchia 71 %macro DoneInt2fStack 0 72 pop bp 73 pop bp 74 pop bp 75 cli 76 pop ss 77 mov sp,bp 78 sti 79 %endmacro 80 === Switch to base=002270h -> "HMA_TEXT" 81 segment HMA_TEXT 82 extern _cu_psp 83 extern _HaltCpuWhileIdle 84 extern _syscall_MUX14 85 86 extern _DGROUP_ 87 88 global reloc_call_int2f_handler 89 reloc_call_int2f_handler: 0 00000629 FB sti ; Enable interrupts 0 0000062A 80FC11 cmp ah,11h ; Network interrupt? 0 0000062D 752F jne Int2f3 ; No, continue 93 Int2f1: 0 0000062F 08C0 or al,al ; Installation check? 0 00000631 7404 jz FarTabRetn ; yes, just return 96 Int2f2: 0 00000633 B80100 mov ax,1 ; TE 07/13/01 98 ; at least for redirected INT21/5F44 99 ; --> 2f/111e 100 ; the error code is AX=0001 = unknown function 0 00000636 F9 stc 102 FarTabRetn: 0 00000637 CA0200 retf 2 ; Return far 104 105 WinIdle: ; only HLT if at haltlevel 2+ 0 0000063A 1E push ds 0 0000063B 2E8E1E[0000] mov ds, [cs:_DGROUP_] 0 00000640 803E[0000]02 cmp byte [_HaltCpuWhileIdle],2 0 00000645 1F pop ds 0 00000646 72EF jb FarTabRetn 0 00000648 9C pushf 0 00000649 FB sti 0 0000064A F4 hlt ; save some energy :-) 0 0000064B 9D popf 0 0000064C 1E push ds 0 0000064D 2E8E1E[0000] mov ds, [cs:_DGROUP_] 0 00000652 803E[0000]03 cmp byte [_HaltCpuWhileIdle],3 0 00000657 1F pop ds 0 00000658 72DD jb FarTabRetn 0 0000065A B000 mov al,0 ; even admit we HLTed ;-) 0 0000065C EBD9 jmp short FarTabRetn 122 0 0000065E 3D8016 Int2f3: cmp ax,1680h ; Win "release time slice" 0 00000661 74D7 je WinIdle 0 00000663 80FC12 cmp ah,12h 0 00000666 7503E99100 je IntDosCal ; Dos Internal calls 0 0000066B 80FC13 cmp ah,13h 0 0000066E 7503E98900 je IntDosCal ; Install Int13h Hook 0 00000673 80FC16 cmp ah,16h 0 00000676 7503E98100 je IntDosCal ; Win (Multitasking) Hook 0 0000067B 80FC46 cmp ah,46h 0 0000067E 747C je IntDosCal ; Win Hook to avoid MCB corruption 133 0 00000680 3D014A cmp ax,4a01h 0 00000683 7477 je IntDosCal ; Dos Internal calls 0 00000685 3D024A cmp ax,4a02h 0 00000688 7472 je IntDosCal ; Dos Internal calls 138 %ifdef WITHFAT32 0 0000068A 3D334A cmp ax,4a33h ; Check DOS version 7 0 0000068D 7505 jne Check4Share 0 0000068F 31C0 xor ax,ax ; no undocumented shell strings 0 00000691 31DB xor bx,bx ; RBIL undoc BX = ?? (0h) 143 ; " DS:DX ASCIIZ shell exe name 144 ; " DS:SI SHELL= line 0 00000693 CF iret 146 Check4Share: 147 %endif 0 00000694 80FC10 cmp ah,10h ; SHARE.EXE interrupt? 0 00000697 7496 je Int2f1 ; yes, do installation check 0 00000699 80FC08 cmp ah,08h 0 0000069C 7450 je DriverSysCal ; DRIVER.SYS calls 0 0000069E 80FC14 cmp ah,14h ; NLSFUNC.EXE interrupt? 0 000006A1 754A jne Int2f?iret ; yes, do installation check 154 Int2f?14: ;; MUX-14 -- NLSFUNC API 155 ;; all functions are passed to syscall_MUX14 156 ;; Note: this is the kernel's default NLS handlers, if made it 157 ;; here then no other program (e.g. NLSFUNC) hooked int 2F/14 158 ;; and handled request (either none loaded or choose not to) 0 000006A3 55 push bp ; Preserve BP later on 160 Protect386Registers 161 PUSH$ALL 0 000006A4 06 push es 0 000006A5 1E push ds 0 000006A6 55 push bp 0 000006A7 57 push di 0 000006A8 56 push si 0 000006A9 52 push dx 0 000006AA 51 push cx 0 000006AB 53 push bx 0 000006AC 50 push ax 162 SwitchToInt2fStack 0 000006AD 2EA1[0000] mov ax,[cs:_DGROUP_] 0 000006B1 8ED8 mov ds,ax 0 000006B3 8CD6 mov si,ss 0 000006B5 89E5 mov bp,sp 0 000006B7 39F0 cmp ax,si 0 000006B9 7407 jz %%already 0 000006BB FA cli 0 000006BC 8ED0 mov ss,ax 53 <1> extern int2f_stk_top 0 000006BE BC[0000] mov sp,int2f_stk_top 0 000006C1 FB sti 56 <1> %%already: 57 <1> 58 <1> 59 <1> 60 <1> 61 <1> 0 000006C2 56 push si 0 000006C3 55 push bp 0 000006C4 56 push si 0 000006C5 55 push bp 0 000006C6 E8[0000] call _syscall_MUX14 164 DoneInt2fStack 0 000006C9 5D pop bp 0 000006CA 5D pop bp 0 000006CB 5D pop bp 0 000006CC FA cli 0 000006CD 17 pop ss 0 000006CE 89EC mov sp,bp 0 000006D0 FB sti 0 000006D1 5D pop bp ; Discard incoming AX 0 000006D2 50 push ax ; Correct stack for POP$ALL 167 POP$ALL 0 000006D3 58 pop ax 0 000006D4 5B pop bx 0 000006D5 59 pop cx 0 000006D6 5A pop dx 0 000006D7 5E pop si 0 000006D8 5F pop di 0 000006D9 5D pop bp 0 000006DA 1F pop ds 0 000006DB 07 pop es 168 Restore386Registers 0 000006DC 89E5 mov bp, sp 0 000006DE 09C0 or ax, ax 0 000006E0 7506 jnz Int2f?14?1 ; must return set carry 172 ;; -6 == -2 (CS), -2 (IP), -2 (flags) 173 ;; current SP = on old_BP 0 000006E2 8066FAFE and BYTE [bp-6], 0feh ; clear carry as no error condition 0 000006E6 5D pop bp 0 000006E7 CF iret 0 000006E8 804EFA01 Int2f?14?1: or BYTE [bp-6], 1 0 000006EC 5D pop bp 179 Int2f?iret: 0 000006ED CF iret 181 182 ; DRIVER.SYS calls - now only 0803. 183 DriverSysCal: 184 extern _Dyn 0 000006EE 3C03 cmp al, 3 0 000006F0 750A jne IntDosCal ; pass other calls through 0 000006F2 2E8E1E[0000] mov ds, [cs:_DGROUP_] 0 000006F7 BF[0200] mov di, _Dyn+2 0 000006FA EBF1 jmp short Int2f?iret 190 191 192 ;********************************************************************** 193 ; internal dos calls INT2F/12xx and INT2F/4A01,4A02 - handled through C 194 ;********************************************************************** 195 IntDosCal: 196 ; set up register structure 197 ;struct int2f12regs 198 ;{ 199 ; [space for 386 regs] 200 ; UWORD es,ds; 201 ; UWORD di,si,bp,bx,dx,cx,ax; 202 ; UWORD ip,cs,flags; 203 ; UWORD callerARG1; 204 ;} 0 000006FC 50 push ax 0 000006FD 51 push cx 0 000006FE 52 push dx 0 000006FF 53 push bx 0 00000700 55 push bp 0 00000701 56 push si 0 00000702 57 push di 0 00000703 1E push ds 0 00000704 06 push es 214 0 00000705 FC cld 216 217 %if XCPU >= 386 218 %ifdef WATCOM 219 mov si,fs 220 mov di,gs 221 %else 222 Protect386Registers 223 %endif 224 %endif 225 226 SwitchToInt2fStack 0 00000706 2EA1[0000] mov ax,[cs:_DGROUP_] 0 0000070A 8ED8 mov ds,ax 0 0000070C 8CD6 mov si,ss 0 0000070E 89E5 mov bp,sp 0 00000710 39F0 cmp ax,si 0 00000712 7407 jz %%already 0 00000714 FA cli 0 00000715 8ED0 mov ss,ax 53 <1> extern int2f_stk_top 0 00000717 BC[0000] mov sp,int2f_stk_top 0 0000071A FB sti 56 <1> %%already: 57 <1> 58 <1> 59 <1> 60 <1> 61 <1> 0 0000071B 56 push si 0 0000071C 55 push bp 0 0000071D 56 push si 0 0000071E 55 push bp 227 extern _int2F_12_handler 0 0000071F E8[0000] call _int2F_12_handler 229 DoneInt2fStack 0 00000722 5D pop bp 0 00000723 5D pop bp 0 00000724 5D pop bp 0 00000725 FA cli 0 00000726 17 pop ss 0 00000727 89EC mov sp,bp 0 00000729 FB sti 230 231 %if XCPU >= 386 232 %ifdef WATCOM 233 mov fs,si 234 mov gs,di 235 %else 236 Restore386Registers 237 %endif 238 %endif 239 0 0000072A 07 pop es 0 0000072B 1F pop ds 0 0000072C 5F pop di 0 0000072D 5E pop si 0 0000072E 5D pop bp 0 0000072F 5B pop bx 0 00000730 5A pop dx 0 00000731 59 pop cx 0 00000732 58 pop ax 249 0 00000733 CF iret 251 252 global SHARE_CHECK 253 SHARE_CHECK: 0 00000734 B80010 mov ax, 0x1000 0 00000737 CD2F int 0x2f 0 00000739 A95553 test ax, "US" ; Uninstallable SHARE signature 0 0000073C C3 ret 258 259 ; DOS calls this to see if it's okay to open the file. 260 ; Returns a file_table entry number to use (>= 0) if okay 261 ; to open. Otherwise returns < 0 and may generate a critical 262 ; error. If < 0 is returned, it is the negated error return 263 ; code, so DOS simply negates this value and returns it in 264 ; AX. 265 ; STATIC int share_open_check(const char FAR * filename, 266 ; /* pointer to fully qualified filename */ 267 ; unsigned short pspseg, 268 ; /* psp segment address of owner process */ 269 ; int openmode, 270 ; /* 0=read-only, 1=write-only, 2=read-write */ 271 ; int sharemode) /* SHARE_COMPAT, etc... */ 272 global SHARE_OPEN_CHECK 273 SHARE_OPEN_CHECK: 0 0000073D 1E push ds 0 0000073E 07 pop es ; save ds 0 0000073F 89F7 mov di, si ; save si 0 00000741 58 pop ax ; return address 278 popargs {ds,si},bx,cx,dx; filename,pspseg,openmode,sharemode; 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000742 5E pop %1 243 <4> %rotate -1 0 00000743 1F pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000744 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000745 59 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000746 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 00000747 50 push ax ; return address 0 00000748 B8A010 mov ax, 0x10a0 0 0000074B CD2F int 0x2f ; returns ax 0 0000074D 89FE mov si, di ; restore si 0 0000074F 06 push es 0 00000750 1F pop ds ; restore ds 0 00000751 C3 ret 286 287 ; DOS calls this to record the fact that it has successfully 288 ; closed a file, or the fact that the open for this file failed. 289 ; STATIC void share_close_file(int fileno) /* file_table entry number */ 290 291 global SHARE_CLOSE_FILE 292 SHARE_CLOSE_FILE: 0 00000752 58 pop ax 0 00000753 5B pop bx 0 00000754 50 push ax 0 00000755 B8A110 mov ax, 0x10a1 0 00000758 CD2F int 0x2f 0 0000075A C3 ret 299 300 ; DOS calls this to determine whether it can access (read or 301 ; write) a specific section of a file. We call it internally 302 ; from lock_unlock (only when locking) to see if any portion 303 ; of the requested region is already locked. If pspseg is zero, 304 ; then it matches any pspseg in the lock table. Otherwise, only 305 ; locks which DO NOT belong to pspseg will be considered. 306 ; Returns zero if okay to access or lock (no portion of the 307 ; region is already locked). Otherwise returns non-zero and 308 ; generates a critical error (if allowcriter is non-zero). 309 ; If non-zero is returned, it is the negated return value for 310 ; the DOS call. 311 ;STATIC int share_access_check(unsigned short pspseg, 312 ; /* psp segment address of owner process */ 313 ; int fileno, /* file_table entry number */ 314 ; unsigned long ofs, /* offset into file */ 315 ; unsigned long len, /* length (in bytes) of region to access */ 316 ; int allowcriter) /* allow a critical error to be generated */ 317 global SHARE_ACCESS_CHECK 318 SHARE_ACCESS_CHECK: 0 0000075B B8A210 mov ax, 0x10a2 320 share_common: 0 0000075E 55 push bp 0 0000075F 89E5 mov bp, sp 0 00000761 56 push si 0 00000762 57 push di 325 arg pspseg, fileno, {ofs,4}, {len,4}, allowcriter 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 0 00000763 8B5E04 mov bx, [.pspseg] ; pspseg 0 00000766 8B4E06 mov cx, [.fileno] ; fileno 0 00000769 8B760A mov si, [.ofs+2] ; high word of ofs 0 0000076C 8B7E08 mov di, [.ofs] ; low word of ofs 0 0000076F C4560C les dx, [.len] ; len 0 00000772 0B4610 or ax, [.allowcriter] ; allowcriter/unlock 0 00000775 CD2F int 0x2f 0 00000777 5F pop di 0 00000778 5E pop si 0 00000779 5D pop bp 0 0000077A C20E00 ret 14 ; returns ax 337 338 ; DOS calls this to lock or unlock a specific section of a file. 339 ; Returns zero if successfully locked or unlocked. Otherwise 340 ; returns non-zero. 341 ; If the return value is non-zero, it is the negated error 342 ; return code for the DOS 0x5c call. */ 343 ;STATIC int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */ 344 ; int fileno, /* file_table entry number */ 345 ; unsigned long ofs, /* offset into file */ 346 ; unsigned long len, /* length (in bytes) of region to lock or unlock */ 347 ; int unlock) /* one to unlock; zero to lock */ 348 global SHARE_LOCK_UNLOCK 349 SHARE_LOCK_UNLOCK: 0 0000077D B8A410 mov ax,0x10a4 0 00000780 EBDC jmp short share_common 352 353 ; DOS calls this to see if share already has the file marked as open. 354 ; Returns: 355 ; 1 if open 356 ; 0 if not 357 ; STATIC WORD share_is_file_open(const char far *filename) /* pointer to fully qualified filename */ 358 global SHARE_IS_FILE_OPEN 359 SHARE_IS_FILE_OPEN: 0 00000782 8CDE mov si, ds 0 00000784 8EC6 mov es, si ; save ds 0 00000786 58 pop ax ; save return address 0 00000787 5E pop si ; filename 0 00000788 1F pop ds ; SEG filename 0 00000789 50 push ax ; restore return address 0 0000078A B8A610 mov ax, 0x10a6 0 0000078D CD2F int 0x2f ; returns ax 0 0000078F 8CC6 mov si, es ; restore ds 0 00000791 8EDE mov ds, si 0 00000793 C3 ret 371 372 ; Int 2F Multipurpose Remote System Calls 373 ; 374 ; added by James Tabor jimtabor@infohwy.com 375 ; changed by Bart Oldeman 376 ; 377 ; assume ss == ds after setup of stack in entry 378 ; sumtimes return data *ptr is the push stack word 379 ; 380 381 remote_lseek: ; arg is a pointer to the long seek value 0 00000794 89CB mov bx, cx 0 00000796 8B17 mov dx, [bx] 0 00000798 8B4F02 mov cx, [bx+2] 385 ; "fall through" 386 387 remote_getfattr: 0 0000079B F8 clc ; set to succeed 0 0000079C CD2F int 2fh 0 0000079E 7253 jc ret_neg_ax 0 000007A0 EB53 jmp short ret_int2f 392 393 remote_lock_unlock: 0 000007A2 89CA mov dx, cx ; parameter block (dx) in arg 0 000007A4 89CB mov bx, cx 0 000007A6 8A5F08 mov bl, [bx + 8] ; unlock or not 0 000007A9 B90100 mov cx, 1 0 000007AC CD2F int 0x2f 0 000007AE 7366 jnc ret_set_ax_to_carry 0 000007B0 B400 mov ah, 0 0 000007B2 EB3F jmp short ret_neg_ax 402 403 ;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg) 404 global NETWORK_REDIRECTOR_MX 405 NETWORK_REDIRECTOR_MX: 0 000007B4 5B pop bx ; ret address 407 popargs ax,{es,dx},cx ; cmd (ax), seg:off s 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000007B5 58 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000007B6 5A pop %1 243 <4> %rotate -1 0 000007B7 07 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000007B8 59 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 408 ; stack value (arg); cx in remote_rw 0 000007B9 53 push bx ; ret address 410 call_int2f: 0 000007BA 55 push bp 0 000007BB 56 push si 0 000007BC 57 push di 0 000007BD 3C0F cmp al, 0fh 0 000007BF 74DA je remote_getfattr 416 0 000007C1 89D7 mov di, dx ; es:di -> s and dx is used for 1125! 0 000007C3 3C08 cmp al, 08h 0 000007C5 7469 je remote_rw 0 000007C7 3C09 cmp al, 09h 0 000007C9 7465 je remote_rw 0 000007CB 3C0A cmp al, 0ah 0 000007CD 74D3 je remote_lock_unlock 0 000007CF 3C21 cmp al, 21h 0 000007D1 74C1 je remote_lseek 0 000007D3 3C22 cmp al, 22h 0 000007D5 746D je remote_process_end 0 000007D7 3C23 cmp al, 23h 0 000007D9 7463 je qremote_fn 430 0 000007DB 51 push cx ; arg 0 000007DC 3C0C cmp al, 0ch 0 000007DE 743A je remote_getfree 0 000007E0 3CA3 cmp al, 0xa3 0 000007E2 7436 je remote_getfree 0 000007E4 3C1E cmp al, 1eh 0 000007E6 7414 je remote_print_doredir 0 000007E8 3C1F cmp al, 1fh 0 000007EA 7410 je remote_print_doredir 440 441 int2f_call: 0 000007EC 31C9 xor cx, cx ; set to succeed; clear carry and CX 0 000007EE CD2F int 2fh 0 000007F0 5B pop bx 0 000007F1 7306 jnc ret_set_ax_to_cx 446 ret_neg_ax: 0 000007F3 F7D8 neg ax 448 ret_int2f: 0 000007F5 5F pop di 0 000007F6 5E pop si 0 000007F7 5D pop bp 0 000007F8 C3 ret 453 454 ret_set_ax_to_cx: ; ext_open or rw -> status from CX in AX 455 ; otherwise CX was set to zero above 0 000007F9 91 xchg ax, cx ; set ax:=cx (one byte shorter than mov) 0 000007FA EBF9 jmp short ret_int2f 458 459 remote_print_doredir: ; di points to an lregs structure 0 000007FC 8E450E mov es,[di+0xe] 0 000007FF 8B5D02 mov bx,[di+2] 0 00000802 8B4D04 mov cx,[di+4] 0 00000805 8B5506 mov dx,[di+6] 0 00000808 8B7508 mov si,[di+8] 0 0000080B C57D0A lds di,[di+0xa] 466 0 0000080E F8 clc ; set to succeed 0 0000080F CD2F int 2fh 0 00000811 5B pop bx ; restore stack and ds=ss 0 00000812 16 push ss 0 00000813 1F pop ds 0 00000814 72DD jc ret_neg_ax 473 ret_set_ax_to_carry: ; carry => -1 else 0 (SUCCESS) 0 00000816 19C0 sbb ax, ax 0 00000818 EBDB jmp short ret_int2f 476 477 remote_getfree: 0 0000081A F8 clc ; set to succeed 0 0000081B CD2F int 2fh 0 0000081D 5F pop di ; retrieve pushed pointer arg 0 0000081E 72F6 jc ret_set_ax_to_carry 0 00000820 8905 mov [di],ax 0 00000822 895D02 mov [di+2],bx 0 00000825 894D04 mov [di+4],cx 0 00000828 895506 mov [di+6],dx 0 0000082B 897508 mov [di+8],si ; for REM_GETLARGEFREE, unused on REM_GETFREE 0 0000082E EBE6 jmp short ret_set_ax_to_carry 488 489 remote_rw: 0 00000830 F8 clc ; set to succeed 0 00000831 CD2F int 2fh 0 00000833 7204 jc ret_min_dx_ax 0 00000835 31D2 xor dx, dx ; dx:ax := dx:cx = bytes read 0 00000837 EBC0 jmp short ret_set_ax_to_cx 0 00000839 F7D8 ret_min_dx_ax: neg ax 0 0000083B 99 cwd 0 0000083C EBB7 jmp short ret_int2f 498 499 qremote_fn: 0 0000083E 89CB mov bx, cx 0 00000840 C537 lds si, [bx] 0 00000842 EB04 jmp short int2f_restore_ds 503 504 remote_process_end: ; Terminate process 0 00000844 8E1E[0000] mov ds, [_cu_psp] 506 int2f_restore_ds: 0 00000848 F8 clc 0 00000849 CD2F int 2fh 0 0000084B 16 push ss 0 0000084C 1F pop ds 0 0000084D EBC7 jmp short ret_set_ax_to_carry 512 513 ; extern UWORD ASMPASCAL call_nls(UWORD bp, UWORD FAR *buf, 514 ; UWORD subfct, UWORD cp, UWORD cntry, UWORD bufsize); 515 516 extern _nlsInfo 517 global CALL_NLS 518 CALL_NLS: 0 0000084F 07 pop es ; ret addr 0 00000850 59 pop cx ; bufsize 0 00000851 5A pop dx ; cntry 0 00000852 5B pop bx ; cp 0 00000853 58 pop ax ; sub fct 0 00000854 B414 mov ah, 0x14 0 00000856 06 push es ; ret addr 0 00000857 55 push bp 0 00000858 89E5 mov bp, sp 0 0000085A 56 push si 0 0000085B 57 push di 0 0000085C BE[0000] mov si, _nlsInfo ; nlsinfo 0 0000085F C47E04 les di, [bp + 4] ; buf 0 00000862 8B6E08 mov bp, [bp + 8] ; bp 0 00000865 CD2F int 0x2f 0 00000867 89DA mov dx, bx ; return id in high word 0 00000869 5F pop di 0 0000086A 5E pop si 0 0000086B 5D pop bp 0 0000086C C20600 ret 6 539 540 ; extern UWORD ASMPASCAL floppy_change(UWORD drives) 541 542 global FLOPPY_CHANGE 543 FLOPPY_CHANGE: 0 0000086F 59 pop cx ; ret addr 0 00000870 5A pop dx ; drives 0 00000871 51 push cx ; ret addr 0 00000872 B8004A mov ax, 0x4a00 0 00000875 31C9 xor cx, cx 0 00000877 CD2F int 0x2f 0 00000879 89C8 mov ax, cx ; return 0 0000087B C3 ret 552 553 ; 554 ; Test to see if a umb driver has been loaded. 555 ; if so, retrieve largest available block+size 556 ; 557 ; From RB list and Dosemu xms.c. 558 ; 559 ; Call the XMS driver "Request upper memory block" function with: 560 ; AH = 10h 561 ; DX = size of block in paragraphs 562 ; Return: AX = status 563 ; 0001h success 564 ; BX = segment address of UMB 565 ; DX = actual size of block 566 ; 0000h failure 567 ; BL = error code (80h,B0h,B1h) (see #02775) 568 ; DX = largest available block 569 ; 570 ; (Table 02775) 571 ; Values for XMS error code returned in BL: 572 ; 00h successful 573 ; 80h function not implemented 574 ; B0h only a smaller UMB is available 575 ; B1h no UMBs are available 576 ; B2h UMB segment number is invalid 577 ; 578 === Switch to base=00E150h -> "INIT_TEXT" 579 segment INIT_TEXT 580 ; int ASMPASCAL UMB_get_largest(void FAR * driverAddress, 581 ; UCOUNT * seg, UCOUNT * size); 582 arg {driverAddress,4}, argseg, size 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 224 <3> %xdefine .%1 bp+.argloc 225 <3> %assign .argloc .argloc+%2 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 583 global UMB_GET_LARGEST 584 585 UMB_GET_LARGEST: 0 0000019F 55 push bp 0 000001A0 89E5 mov bp,sp 588 0 000001A2 BAFFFF mov dx,0xffff ; go for broke! 0 000001A5 B80010 mov ax,1000h ; get the UMBs 0 000001A8 FF5E04 call far [.driverAddress] ; Call the driver 592 593 ; 594 ; bl = 0xB0 and ax = 0 so do it again. 595 ; 0 000001AB 80FBB0 cmp bl,0xb0 ; fail safe 0 000001AE 751F jne umbt_error 598 0 000001B0 21D2 and dx,dx ; if it returns a size of zero. 0 000001B2 741B je umbt_error 601 0 000001B4 B80010 mov ax,1000h ; dx set with largest size 0 000001B7 FF5E04 call far [.driverAddress] ; Call the driver 604 0 000001BA 83F801 cmp ax,1 0 000001BD 7510 jne umbt_error 607 ; now return the segment 608 ; and the size 609 0 000001BF 89D9 mov cx,bx ; *seg = segment 0 000001C1 8B5E08 mov bx, [.argseg] 0 000001C4 890F mov [bx],cx 613 0 000001C6 8B5E0A mov bx, [.size] ; *size = size 0 000001C9 8917 mov [bx],dx 616 617 umbt_ret: 0 000001CB 5D pop bp 0 000001CC C20800 ret 8 ; this was called NEAR!! 620 0 000001CF 31C0 umbt_error: xor ax,ax 0 000001D1 EBF8 jmp short umbt_ret === Trace listing source: inthndlr.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=inthndlr.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccOOduS2.s output file : inthndlr.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:54.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _int21_syscall 8 .type _int21_syscall, @function 9 _int21_syscall: 10 _.LFB4: 11 .file 1 "inthndlr.c" 1:inthndlr.c **** /****************************************************************/ 2:inthndlr.c **** /* */ 3:inthndlr.c **** /* inthndlr.c */ 4:inthndlr.c **** /* */ 5:inthndlr.c **** /* Interrupt Handler and Function dispatcher for Kernel */ 6:inthndlr.c **** /* */ 7:inthndlr.c **** /* Copyright (c) 1995 */ 8:inthndlr.c **** /* Pasquale J. Villani */ 9:inthndlr.c **** /* All Rights Reserved */ 10:inthndlr.c **** /* */ 11:inthndlr.c **** /* This file is part of DOS-C. */ 12:inthndlr.c **** /* */ 13:inthndlr.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:inthndlr.c **** /* modify it under the terms of the GNU General Public License */ 15:inthndlr.c **** /* as published by the Free Software Foundation; either version */ 16:inthndlr.c **** /* 2, or (at your option) any later version. */ 17:inthndlr.c **** /* */ 18:inthndlr.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:inthndlr.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:inthndlr.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:inthndlr.c **** /* the GNU General Public License for more details. */ 22:inthndlr.c **** /* */ 23:inthndlr.c **** /* You should have received a copy of the GNU General Public */ 24:inthndlr.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:inthndlr.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:inthndlr.c **** /* Cambridge, MA 02139, USA. */ 27:inthndlr.c **** /* */ 28:inthndlr.c **** /****************************************************************/ 29:inthndlr.c **** #define MAIN 30:inthndlr.c **** 31:inthndlr.c **** #include "portab.h" 32:inthndlr.c **** #include "globals.h" 33:inthndlr.c **** #include "nls.h" 34:inthndlr.c **** #include "win.h" 35:inthndlr.c **** #include "debug.h" 36:inthndlr.c **** 37:inthndlr.c **** #ifdef VERSION_STRINGS 38:inthndlr.c **** BYTE *RcsId = 39:inthndlr.c **** "$Id: inthndlr.c 1709 2012-02-08 02:13:49Z perditionc $"; 40:inthndlr.c **** #endif 41:inthndlr.c **** 42:inthndlr.c **** #ifdef TSC 43:inthndlr.c **** STATIC VOID StartTrace(VOID); 44:inthndlr.c **** STATIC bTraceNext = FALSE; 45:inthndlr.c **** #endif 46:inthndlr.c **** 47:inthndlr.c **** #if 0 /* Very suspicious, passing structure by value?? 48:inthndlr.c **** Deactivated -- 2000/06/16 ska */ 49:inthndlr.c **** /* Special entry for far call into the kernel */ 50:inthndlr.c **** #pragma argsused 51:inthndlr.c **** VOID FAR int21_entry(iregs UserRegs) 52:inthndlr.c **** { 53:inthndlr.c **** int21_handler(UserRegs); 54:inthndlr.c **** } 55:inthndlr.c **** #endif 56:inthndlr.c **** 57:inthndlr.c **** /* Structures needed for int 25 / int 26 */ 58:inthndlr.c **** struct HugeSectorBlock { 59:inthndlr.c **** ULONG blkno; 60:inthndlr.c **** WORD nblks; 61:inthndlr.c **** BYTE FAR *buf; 62:inthndlr.c **** }; 63:inthndlr.c **** 64:inthndlr.c **** /* Normal entry. This minimizes user stack usage by avoiding local */ 65:inthndlr.c **** /* variables needed for the rest of the handler. */ 66:inthndlr.c **** /* this here works on the users stack !! and only very few functions 67:inthndlr.c **** are allowed */ 68:inthndlr.c **** 69:inthndlr.c **** /* TODO: really, really make sure that this function works properly */ 70:inthndlr.c **** /* even when SS != DGROUP (some changes to the compiler (!) may be */ 71:inthndlr.c **** /* necessary). Currently, between Turbo C++, gcc-ia16, & Open Watcom, */ 72:inthndlr.c **** /* it seems only Watcom has explicit support for calling near-data */ 73:inthndlr.c **** /* functions with SS != DGROUP. The code for this function happens to */ 74:inthndlr.c **** /* to compile under gcc-ia16 to correctly-behaving code _for now_. But */ 75:inthndlr.c **** /* it will be better to be able to guarantee this. -- tkchia 20191207 */ 76:inthndlr.c **** 77:inthndlr.c **** /* Update: I added experimental SS != DGROUP support, and a __seg_ss */ 78:inthndlr.c **** /* address space qualifier, to gcc-ia16 around January 2020. This */ 79:inthndlr.c **** /* function now uses these if available. In particular, the iregs *irp */ 80:inthndlr.c **** /* structure will always be on the stack, so (as far as the calling */ 81:inthndlr.c **** /* convention permits) the function can treat the irp pointer as a */ 82:inthndlr.c **** /* 16-bit pointer relative to SS. -- tkchia 20200417 */ 83:inthndlr.c **** #if defined __GNUC__ && defined __IA16_FEATURE_ATTRIBUTE_NO_ASSUME_SS_DATA 84:inthndlr.c **** __attribute__((no_assume_ss_data)) 85:inthndlr.c **** VOID ASMCFUNC int21_syscall(iregs __seg_ss * irp, ...) 86:inthndlr.c **** #else 87:inthndlr.c **** VOID ASMCFUNC int21_syscall(iregs FAR * irp) 88:inthndlr.c **** #endif 89:inthndlr.c **** { 12 .loc 1 89 0 13 _.LVL0: 0 00007BA9 89E3 mov bx, sp 15 _.LCFI0: 0 00007BAB 1E push ds 0 00007BAC 07 pop es 0 00007BAD 368B5F02 mov bx, word ptr ss:[bx+2] 90:inthndlr.c **** Int21AX = irp->AX; 19 .loc 1 90 0 0 00007BB1 368B07 mov ax, word ptr ss:[bx] 0 00007BB4 26A3[0000] mov word ptr es:[_Int21AX], ax 22 _.LVL1: 91:inthndlr.c **** 92:inthndlr.c **** switch (irp->AH) 23 .loc 1 92 0 0 00007BB8 368A4701 mov al, byte ptr ss:[bx+1] 0 00007BBC 3C50 cmp al, 80 0 00007BBE 7503E9BD00 je _.L3 0 00007BC3 7707 ja _.L4 0 00007BC5 3C33 cmp al, 51 0 00007BC7 7415 je _.L5 30 _.L1: 0 00007BC9 06 push es 0 00007BCA 1F pop ds 93:inthndlr.c **** { 94:inthndlr.c **** /* Set Interrupt Vector - now implemented in entry.asm */ 95:inthndlr.c **** #if 0 96:inthndlr.c **** case 0x25: 97:inthndlr.c **** setvec(irp->AL, (intvec)MK_FP(irp->DS, irp->DX)); 98:inthndlr.c **** break; 99:inthndlr.c **** #endif 100:inthndlr.c **** 101:inthndlr.c **** /* DosVars - get/set dos variables */ 102:inthndlr.c **** case 0x33: 103:inthndlr.c **** switch (irp->AL) 104:inthndlr.c **** { 105:inthndlr.c **** /* Set Ctrl-C flag; returns dl = break_ena */ 106:inthndlr.c **** case 0x01: 107:inthndlr.c **** break_ena = irp->DL & 1; 108:inthndlr.c **** /* fall through so DL only low bit (as in MS-DOS) */ 109:inthndlr.c **** 110:inthndlr.c **** /* Get Ctrl-C flag */ 111:inthndlr.c **** case 0x00: 112:inthndlr.c **** irp->DL = break_ena; 113:inthndlr.c **** break; 114:inthndlr.c **** 115:inthndlr.c **** case 0x02: /* andrew schulman: get/set extended control break */ 116:inthndlr.c **** { 117:inthndlr.c **** UBYTE tmp = break_ena; 118:inthndlr.c **** break_ena = irp->DL & 1; 119:inthndlr.c **** irp->DL = tmp; 120:inthndlr.c **** } 121:inthndlr.c **** break; 122:inthndlr.c **** 123:inthndlr.c **** /* Get Boot Drive */ 124:inthndlr.c **** case 0x05: 125:inthndlr.c **** irp->DL = BootDrive; 126:inthndlr.c **** break; 127:inthndlr.c **** 128:inthndlr.c **** /* Get (real) DOS-C version */ 129:inthndlr.c **** case 0x06: 130:inthndlr.c **** irp->BL = os_major; 131:inthndlr.c **** irp->BH = os_minor; 132:inthndlr.c **** irp->DL = 0; /* lower 3 bits revision #, remaining should be 0 */ 133:inthndlr.c **** irp->DH = version_flags; /* bit3:runs in ROM,bit 4: runs in HMA */ 134:inthndlr.c **** break; 135:inthndlr.c **** 136:inthndlr.c **** /* case 0x03: */ /* DOS 7 does not set AL */ 137:inthndlr.c **** /* case 0x07: */ /* neither here */ 138:inthndlr.c **** 139:inthndlr.c **** default: /* set AL=0xFF as error, NOT carry */ 140:inthndlr.c **** irp->AL = 0xff; 141:inthndlr.c **** break; 142:inthndlr.c **** 143:inthndlr.c **** /* the remaining are FreeDOS extensions */ 144:inthndlr.c **** 145:inthndlr.c **** /* return CPU family */ 146:inthndlr.c **** case 0xfa: 147:inthndlr.c **** irp->AL = CPULevel; 148:inthndlr.c **** break; 149:inthndlr.c **** 150:inthndlr.c **** #if 0 /* unknown if used / usage */ 151:inthndlr.c **** case 0xfb: 152:inthndlr.c **** #endif 153:inthndlr.c **** 154:inthndlr.c **** #if 1 /* duplicates DOS 4 int 2F/122Fh, but used by CALLVER */ 155:inthndlr.c **** /* set FreeDOS returned version for int 21.30 from BX */ 156:inthndlr.c **** case 0xfc: 157:inthndlr.c **** os_setver_major = irp->BL; 158:inthndlr.c **** os_setver_minor = irp->BH; 159:inthndlr.c **** break; 160:inthndlr.c **** #endif 161:inthndlr.c **** 162:inthndlr.c **** /* Toggle DOS-C rdwrblock trace dump */ 163:inthndlr.c **** #ifdef DEBUG 164:inthndlr.c **** case 0xfd: 165:inthndlr.c **** bDumpRdWrParms = !bDumpRdWrParms; 166:inthndlr.c **** break; 167:inthndlr.c **** #endif 168:inthndlr.c **** 169:inthndlr.c **** /* Toggle DOS-C syscall trace dump */ 170:inthndlr.c **** #ifdef DEBUG 171:inthndlr.c **** case 0xfe: 172:inthndlr.c **** bDumpRegs = !bDumpRegs; 173:inthndlr.c **** break; 174:inthndlr.c **** #endif 175:inthndlr.c **** 176:inthndlr.c **** /* Get DOS-C release string pointer */ 177:inthndlr.c **** case 0xff: 178:inthndlr.c **** #if !defined __GNUC__ || defined __IA16_FEATURE_ATTRIBUTE_NO_ASSUME_SS_DATA 179:inthndlr.c **** irp->DX = FP_SEG(os_release); 180:inthndlr.c **** #else /* TODO: remove this hacky SS != DGROUP workaround --tkchia 20191207 */ 181:inthndlr.c **** asm volatile("{ movw %%ds, %0 | mov %0, ds }" : "=g" (irp->DX)); 182:inthndlr.c **** #endif 183:inthndlr.c **** irp->AX = FP_OFF(os_release); 184:inthndlr.c **** } 185:inthndlr.c **** break; 186:inthndlr.c **** 187:inthndlr.c **** /* Get Interrupt Vector - now implemented in entry.asm */ 188:inthndlr.c **** #if 0 189:inthndlr.c **** case 0x35: 190:inthndlr.c **** { 191:inthndlr.c **** intvec p = getvec(irp->AL); 192:inthndlr.c **** irp->ES = FP_SEG(p); 193:inthndlr.c **** irp->BX = FP_OFF(p); 194:inthndlr.c **** break; 195:inthndlr.c **** } 196:inthndlr.c **** #endif 197:inthndlr.c **** 198:inthndlr.c **** /* Set PSP */ 199:inthndlr.c **** case 0x50: 200:inthndlr.c **** cu_psp = irp->BX; 201:inthndlr.c **** break; 202:inthndlr.c **** 203:inthndlr.c **** /* Get PSP */ 204:inthndlr.c **** case 0x51: 205:inthndlr.c **** /* UNDOCUMENTED: return current psp */ 206:inthndlr.c **** case 0x62: 207:inthndlr.c **** irp->BX = cu_psp; 208:inthndlr.c **** 209:inthndlr.c **** /* Normal DOS function - DO NOT ARRIVE HERE */ 210:inthndlr.c **** /* default: */ 211:inthndlr.c **** } 212:inthndlr.c **** } 33 .loc 1 212 0 0 00007BCB C3 ret 35 _.L4: 92:inthndlr.c **** { 36 .loc 1 92 0 0 00007BCC 3C51 cmp al, 81 0 00007BCE 7404 je _.L6 0 00007BD0 3C62 cmp al, 98 0 00007BD2 75F5 jne _.L1 41 _.L6: 207:inthndlr.c **** 42 .loc 1 207 0 0 00007BD4 26A1[0000] mov ax, word ptr es:[_cu_psp] 0 00007BD8 36894702 mov word ptr ss:[bx+2], ax 45 .loc 1 212 0 0 00007BDC EBEB jmp _.L1 47 _.L5: 103:inthndlr.c **** { 48 .loc 1 103 0 0 00007BDE 368A07 mov al, byte ptr ss:[bx] 0 00007BE1 3C05 cmp al, 5 0 00007BE3 7478 je _.L8 0 00007BE5 7710 ja _.L9 0 00007BE7 3C01 cmp al, 1 0 00007BE9 7448 je _.L10 0 00007BEB 7250 jc _.L11 0 00007BED 3C02 cmp al, 2 0 00007BEF 7456 je _.L12 58 _.L7: 140:inthndlr.c **** break; 59 .loc 1 140 0 0 00007BF1 36C607FF mov byte ptr ss:[bx], -1 141:inthndlr.c **** 61 .loc 1 141 0 0 00007BF5 EBD2 jmp _.L1 63 _.L9: 103:inthndlr.c **** { 64 .loc 1 103 0 0 00007BF7 3CFA cmp al, -6 0 00007BF9 7468 je _.L13 0 00007BFB 7723 ja _.L14 0 00007BFD 3C06 cmp al, 6 0 00007BFF 75F0 jne _.L7 130:inthndlr.c **** irp->BH = os_minor; 70 .loc 1 130 0 0 00007C01 26A0[0000] mov al, byte ptr es:[_os_major] 0 00007C05 36884702 mov byte ptr ss:[bx+2], al 131:inthndlr.c **** irp->DL = 0; /* lower 3 bits revision #, remaining should be 0 */ 73 .loc 1 131 0 0 00007C09 26A0[0000] mov al, byte ptr es:[_os_minor] 0 00007C0D 36884703 mov byte ptr ss:[bx+3], al 132:inthndlr.c **** irp->DH = version_flags; /* bit3:runs in ROM,bit 4: runs in HMA */ 76 .loc 1 132 0 0 00007C11 36C6470600 mov byte ptr ss:[bx+6], 0 133:inthndlr.c **** break; 78 .loc 1 133 0 0 00007C16 26A0[0000] mov al, byte ptr es:[_version_flags] 0 00007C1A 36884707 mov byte ptr ss:[bx+7], al 134:inthndlr.c **** 81 .loc 1 134 0 0 00007C1E EBA9 jmp _.L1 83 _.L14: 103:inthndlr.c **** { 84 .loc 1 103 0 0 00007C20 3CFC cmp al, -4 0 00007C22 7449 je _.L16 0 00007C24 3CFF cmp al, -1 0 00007C26 75C9 jne _.L7 179:inthndlr.c **** #else /* TODO: remove this hacky SS != DGROUP workaround --tkchia 20191207 */ 89 .loc 1 179 0 0 00007C28 368C5F06 mov word ptr ss:[bx+6], ds 183:inthndlr.c **** } 91 .loc 1 183 0 0 00007C2C 36C707[0000] mov word ptr ss:[bx], offset _os_release 0 00007C31 EB96 jmp _.L1 94 _.L10: 107:inthndlr.c **** /* fall through so DL only low bit (as in MS-DOS) */ 95 .loc 1 107 0 0 00007C33 368A4706 mov al, byte ptr ss:[bx+6] 0 00007C37 2401 and al, 1 0 00007C39 26A2[0000] mov byte ptr es:[_break_ena], al 99 _.L11: 112:inthndlr.c **** break; 100 .loc 1 112 0 0 00007C3D 26A0[0000] mov al, byte ptr es:[_break_ena] 102 _.L25: 125:inthndlr.c **** break; 103 .loc 1 125 0 0 00007C41 36884706 mov byte ptr ss:[bx+6], al 126:inthndlr.c **** 105 .loc 1 126 0 0 00007C45 EB82 jmp _.L1 107 _.L12: 108 _.LBB2: 117:inthndlr.c **** break_ena = irp->DL & 1; 109 .loc 1 117 0 0 00007C47 268A26[0000] mov ah, byte ptr es:[_break_ena] 111 _.LVL2: 118:inthndlr.c **** irp->DL = tmp; 112 .loc 1 118 0 0 00007C4C 368A4706 mov al, byte ptr ss:[bx+6] 0 00007C50 2401 and al, 1 0 00007C52 26A2[0000] mov byte ptr es:[_break_ena], al 119:inthndlr.c **** } 116 .loc 1 119 0 0 00007C56 36886706 mov byte ptr ss:[bx+6], ah 118 _.LBE2: 121:inthndlr.c **** 119 .loc 1 121 0 0 00007C5A E96CFF jmp _.L1 121 _.LVL3: 122 _.L8: 125:inthndlr.c **** break; 123 .loc 1 125 0 0 00007C5D 26A0[0000] mov al, byte ptr es:[_BootDrive] 0 00007C61 EBDE jmp _.L25 126 _.L13: 147:inthndlr.c **** break; 127 .loc 1 147 0 0 00007C63 26A0[0000] mov al, byte ptr es:[_CPULevel] 0 00007C67 368807 mov byte ptr ss:[bx], al 148:inthndlr.c **** 130 .loc 1 148 0 0 00007C6A E95CFF jmp _.L1 132 _.L16: 157:inthndlr.c **** os_setver_minor = irp->BH; 133 .loc 1 157 0 0 00007C6D 368A4702 mov al, byte ptr ss:[bx+2] 0 00007C71 26A2[0000] mov byte ptr es:[_os_setver_major], al 158:inthndlr.c **** break; 136 .loc 1 158 0 0 00007C75 368A4703 mov al, byte ptr ss:[bx+3] 0 00007C79 26A2[0000] mov byte ptr es:[_os_setver_minor], al 159:inthndlr.c **** #endif 139 .loc 1 159 0 0 00007C7D E949FF jmp _.L1 141 _.L3: 200:inthndlr.c **** break; 142 .loc 1 200 0 0 00007C80 368B4702 mov ax, word ptr ss:[bx+2] 0 00007C84 26A3[0000] mov word ptr es:[_cu_psp], ax 201:inthndlr.c **** 145 .loc 1 201 0 0 00007C88 E93EFF jmp _.L1 147 _.LFE4: 148 .size _int21_syscall, .-_int21_syscall 149 .global _int21_fat32 150 .type _int21_fat32, @function 151 _int21_fat32: 152 _.LFB5: 213:inthndlr.c **** 214:inthndlr.c **** #ifdef WITHFAT32 215:inthndlr.c **** /* DOS 7.0+ FAT32 extended functions */ 216:inthndlr.c **** int int21_fat32(lregs *r) 217:inthndlr.c **** { 153 .loc 1 217 0 154 _.LVL4: 0 00007C8B 56 push si 0 00007C8C 57 push di 0 00007C8D 55 push bp 158 _.LCFI1: 0 00007C8E 89E5 mov bp, sp 160 _.LCFI2: 0 00007C90 83EC0E sub sp, 14 0 00007C93 8B7608 mov si, word ptr [bp+8] 218:inthndlr.c **** COUNT rc; 219:inthndlr.c **** 220:inthndlr.c **** switch (r->AL) 163 .loc 1 220 0 0 00007C96 8A04 mov al, byte ptr [si] 0 00007C98 3C03 cmp al, 3 0 00007C9A 7503E9A201 je _.L28 0 00007C9F 770D ja _.L29 0 00007CA1 3C02 cmp al, 2 0 00007CA3 7503E99100 je _.L30 170 _.LVL5: 171 _.L70: 172 _.LBB3: 221:inthndlr.c **** { 222:inthndlr.c **** /* Get extended drive parameter block */ 223:inthndlr.c **** case 0x02: 224:inthndlr.c **** { 225:inthndlr.c **** struct dpb FAR *dpb; 226:inthndlr.c **** struct xdpbdata FAR *xddp; 227:inthndlr.c **** 228:inthndlr.c **** if (r->CX < sizeof(struct xdpbdata)) 229:inthndlr.c **** return DE_INVLDBUF; 230:inthndlr.c **** 231:inthndlr.c **** dpb = GetDriveDPB(r->DL, &rc); 232:inthndlr.c **** if (rc != SUCCESS) 233:inthndlr.c **** return rc; 234:inthndlr.c **** 235:inthndlr.c **** /* hazard: no error checking! */ 236:inthndlr.c **** flush_buffers(dpb->dpb_unit); 237:inthndlr.c **** dpb->dpb_flags = M_CHANGED; /* force reread of drive BPB/DPB */ 238:inthndlr.c **** 239:inthndlr.c **** if (media_check(dpb) < 0) 240:inthndlr.c **** return DE_INVLDDRV; 241:inthndlr.c **** 242:inthndlr.c **** xddp = MK_FP(r->ES, r->DI); 243:inthndlr.c **** 244:inthndlr.c **** fmemcpy(&xddp->xdd_dpb, dpb, sizeof(struct dpb)); 245:inthndlr.c **** xddp->xdd_dpbsize = sizeof(struct dpb); 246:inthndlr.c **** 247:inthndlr.c **** /* if it doesn't look like an extended DPB, fill in those fields */ 248:inthndlr.c **** if (!ISFAT32(dpb) && dpb->dpb_xsize != dpb->dpb_size) 249:inthndlr.c **** { 250:inthndlr.c **** xddp->xdd_dpb.dpb_nfreeclst_un.dpb_nfreeclst_st.dpb_nfreeclst_hi = 251:inthndlr.c **** (dpb->dpb_nfreeclst == 0xFFFF ? 0xFFFF : 0); 252:inthndlr.c **** dpb16to32(&xddp->xdd_dpb); 253:inthndlr.c **** xddp->xdd_dpb.dpb_xfatsize = dpb->dpb_fatsize; 254:inthndlr.c **** xddp->xdd_dpb.dpb_xcluster = (dpb->dpb_cluster == 0xFFFF ? 255:inthndlr.c **** 0xFFFFFFFFuL : dpb->dpb_cluster); 256:inthndlr.c **** } 257:inthndlr.c **** break; 258:inthndlr.c **** } 259:inthndlr.c **** /* Get extended free drive space */ 260:inthndlr.c **** case 0x03: 261:inthndlr.c **** { 262:inthndlr.c **** struct xfreespace FAR *xfsp = MK_FP(r->ES, r->DI); 263:inthndlr.c **** 264:inthndlr.c **** if (r->CX < sizeof(struct xfreespace)) 265:inthndlr.c **** return DE_INVLDBUF; 266:inthndlr.c **** 267:inthndlr.c **** rc = DosGetExtFree(MK_FP(r->DS, r->DX), xfsp); 268:inthndlr.c **** if (rc != SUCCESS) 269:inthndlr.c **** return rc; 270:inthndlr.c **** break; 271:inthndlr.c **** } 272:inthndlr.c **** /* Set DPB to use for formatting */ 273:inthndlr.c **** case 0x04: 274:inthndlr.c **** { 275:inthndlr.c **** struct xdpbforformat FAR *xdffp = MK_FP(r->ES, r->DI); 276:inthndlr.c **** struct dpb FAR *dpb; 277:inthndlr.c **** if (r->CX < sizeof(struct xdpbforformat)) 278:inthndlr.c **** { 279:inthndlr.c **** return DE_INVLDBUF; 280:inthndlr.c **** } 281:inthndlr.c **** dpb = GetDriveDPB(r->DL, &rc); 282:inthndlr.c **** if (rc != SUCCESS) 283:inthndlr.c **** return rc; 284:inthndlr.c **** 285:inthndlr.c **** xdffp->xdff_datasize = sizeof(struct xdpbforformat); 286:inthndlr.c **** xdffp->xdff_version.actual = 0; 287:inthndlr.c **** 288:inthndlr.c **** switch ((UWORD) xdffp->xdff_function) 289:inthndlr.c **** { 290:inthndlr.c **** case 0x00: 291:inthndlr.c **** { 292:inthndlr.c **** ULONG nfreeclst = xdffp->xdff_f.setdpbcounts.nfreeclst; 293:inthndlr.c **** ULONG cluster = xdffp->xdff_f.setdpbcounts.cluster; 294:inthndlr.c **** if (ISFAT32(dpb)) 295:inthndlr.c **** { 296:inthndlr.c **** if ((dpb->dpb_xfsinfosec == 0xffff 297:inthndlr.c **** && (nfreeclst != 0 || cluster != 0)) 298:inthndlr.c **** || nfreeclst == 1 || nfreeclst > dpb->dpb_xsize 299:inthndlr.c **** || cluster == 1 || cluster > dpb->dpb_xsize) 300:inthndlr.c **** { 301:inthndlr.c **** return DE_INVLDPARM; 302:inthndlr.c **** } 303:inthndlr.c **** dpb->dpb_xnfreeclst = nfreeclst; 304:inthndlr.c **** dpb->dpb_xcluster = cluster; 305:inthndlr.c **** write_fsinfo(dpb); 306:inthndlr.c **** } 307:inthndlr.c **** else 308:inthndlr.c **** { 309:inthndlr.c **** if ((unsigned)nfreeclst == 1 || (unsigned)nfreeclst > dpb->dpb_size || 310:inthndlr.c **** (unsigned)cluster == 1 || (unsigned)cluster > dpb->dpb_size) 311:inthndlr.c **** { 312:inthndlr.c **** return DE_INVLDPARM; 313:inthndlr.c **** } 314:inthndlr.c **** dpb->dpb_nfreeclst = (UWORD)nfreeclst; 315:inthndlr.c **** dpb->dpb_cluster = (UWORD)cluster; 316:inthndlr.c **** } 317:inthndlr.c **** break; 318:inthndlr.c **** } 319:inthndlr.c **** case 0x01: 320:inthndlr.c **** { 321:inthndlr.c **** ddt *pddt = getddt(r->DL); 322:inthndlr.c **** fmemcpy(&pddt->ddt_bpb, xdffp->xdff_f.rebuilddpb.bpbp, 323:inthndlr.c **** sizeof(bpb)); 324:inthndlr.c **** } 325:inthndlr.c **** case 0x02: 326:inthndlr.c **** { 327:inthndlr.c **** rebuild_dpb: 328:inthndlr.c **** /* hazard: no error checking! */ 329:inthndlr.c **** flush_buffers(dpb->dpb_unit); 330:inthndlr.c **** dpb->dpb_flags = M_CHANGED; 331:inthndlr.c **** 332:inthndlr.c **** if (media_check(dpb) < 0) 333:inthndlr.c **** return DE_INVLDDRV; 334:inthndlr.c **** break; 335:inthndlr.c **** } 336:inthndlr.c **** case 0x03: 337:inthndlr.c **** case 0x04: 338:inthndlr.c **** { 339:inthndlr.c **** ULONG value; 340:inthndlr.c **** if (!ISFAT32(dpb)) 341:inthndlr.c **** return DE_INVLDPARM; 342:inthndlr.c **** 343:inthndlr.c **** value = xdffp->xdff_f.setget.new; 344:inthndlr.c **** if ((UWORD) xdffp->xdff_function == 0x03) 345:inthndlr.c **** { 346:inthndlr.c **** /* FAT mirroring */ 347:inthndlr.c **** if (value != 0xFFFFFFFFUL && (value & ~(0xf | 0x80))) 348:inthndlr.c **** return DE_INVLDPARM; 349:inthndlr.c **** xdffp->xdff_f.setget.old = dpb->dpb_xflags; 350:inthndlr.c **** } 351:inthndlr.c **** else 352:inthndlr.c **** { 353:inthndlr.c **** /* root cluster */ 354:inthndlr.c **** if (value != 0xFFFFFFFFUL && (value < 2 || value > dpb->dpb_xsize)) 355:inthndlr.c **** return DE_INVLDPARM; 356:inthndlr.c **** xdffp->xdff_f.setget.old = dpb->dpb_xrootclst; 357:inthndlr.c **** } 358:inthndlr.c **** if (value != 0xFFFFFFFFUL) 359:inthndlr.c **** { 360:inthndlr.c **** bpb FAR *bpbp; 361:inthndlr.c **** struct buffer FAR *bp = getblock(1, dpb->dpb_unit); 362:inthndlr.c **** bp->b_flag &= ~(BFR_DATA | BFR_DIR | BFR_FAT); 363:inthndlr.c **** bp->b_flag |= BFR_VALID | BFR_DIRTY; 364:inthndlr.c **** bpbp = (bpb FAR *) & bp->b_buffer[BT_BPB]; 365:inthndlr.c **** if ((UWORD) xdffp->xdff_function == 0x03) 366:inthndlr.c **** bpbp->bpb_xflags = (UWORD)value; 367:inthndlr.c **** else 368:inthndlr.c **** bpbp->bpb_xrootclst = value; 369:inthndlr.c **** } 370:inthndlr.c **** goto rebuild_dpb; 371:inthndlr.c **** } 372:inthndlr.c **** default: 373:inthndlr.c **** return DE_INVLDFUNC; 173 .loc 1 373 0 0 00007CA8 B9FFFF mov cx, -1 0 00007CAB E98A01 jmp _.L26 176 _.LVL6: 177 _.L29: 178 _.LBE3: 220:inthndlr.c **** { 179 .loc 1 220 0 0 00007CAE 3C04 cmp al, 4 0 00007CB0 7503E9AA01 je _.L31 0 00007CB5 3C05 cmp al, 5 0 00007CB7 75EF jne _.L70 184 _.LBB10: 374:inthndlr.c **** } 375:inthndlr.c **** 376:inthndlr.c **** break; 377:inthndlr.c **** } 378:inthndlr.c **** /* Extended absolute disk read/write */ 379:inthndlr.c **** /* TODO(vlp) consider using of the 13-14th bits of SI */ 380:inthndlr.c **** case 0x05: 381:inthndlr.c **** { 382:inthndlr.c **** struct HugeSectorBlock FAR *SectorBlock = 383:inthndlr.c **** (struct HugeSectorBlock FAR *)MK_FP(r->DS, r->BX); 185 .loc 1 383 0 0 00007CB9 8B4C0C mov cx, word ptr [si+12] 0 00007CBC 8B5C02 mov bx, word ptr [si+2] 188 _.LVL7: 384:inthndlr.c **** UBYTE mode; 385:inthndlr.c **** /* bit 0 of SI is 0 read / 1 write, bits 13/14 indicate a type: */ 386:inthndlr.c **** /* 0 any, 1 fat, 2 dir, 3 file. Type is mostly for "write hints" */ 387:inthndlr.c **** 388:inthndlr.c **** if (r->CX != 0xffff || (r->SI & ~0x6001)) 189 .loc 1 388 0 0 00007CBF 837C04FF cmp word ptr [si+4], -1 0 00007CC3 7403E91D02 jne _.L45 192 .loc 1 388 0 is_stmt 0 discriminator 1 0 00007CC8 8B5408 mov dx, word ptr [si+8] 0 00007CCB F7C2FE9F test dx, -24578 0 00007CCF 7403E91102 jne _.L45 389:inthndlr.c **** { 390:inthndlr.c **** return DE_INVLDPARM; 391:inthndlr.c **** } 392:inthndlr.c **** 393:inthndlr.c **** if (r->DL > lastdrive || r->DL == 0) 196 .loc 1 393 0 is_stmt 1 0 00007CD4 8A4406 mov al, byte ptr [si+6] 0 00007CD7 3A06[0000] cmp al, byte ptr [_lastdrive] 0 00007CDB 7603E9F503 ja _.L72 0 00007CE0 84C0 test al, al 0 00007CE2 7503E9EE03 je _.L72 394:inthndlr.c **** return -0x207; 395:inthndlr.c **** 396:inthndlr.c **** if ((r->SI & 1) == 0) /* while uncommon, reads CAN have type hints */ 202 .loc 1 396 0 0 00007CE7 83E201 and dx, 1 397:inthndlr.c **** mode = DSKREADINT25; 398:inthndlr.c **** else 399:inthndlr.c **** mode = DSKWRITEINT26; 204 .loc 1 399 0 0 00007CEA 83FA01 cmp dx, 1 0 00007CED F5 cmc 0 00007CEE 18D2 sbb dl, dl 0 00007CF0 80C204 add dl, 4 0 00007CF3 8856FC mov byte ptr [bp-4], dl 210 _.LVL8: 400:inthndlr.c **** 401:inthndlr.c **** r->AX = 402:inthndlr.c **** dskxfer(r->DL - 1, SectorBlock->blkno, SectorBlock->buf, 211 .loc 1 402 0 0 00007CF6 30F6 xor dh, dh 213 _.LVL9: 0 00007CF8 52 push dx 0 00007CF9 8EC1 mov es, cx 0 00007CFB 26FF7704 push word ptr es:[bx+4] 0 00007CFF 26FF7708 push word ptr es:[bx+8] 0 00007D03 26FF7706 push word ptr es:[bx+6] 0 00007D07 26FF7702 push word ptr es:[bx+2] 0 00007D0B 26FF37 push word ptr es:[bx] 0 00007D0E 30E4 xor ah, ah 0 00007D10 48 dec ax 0 00007D11 50 push ax 0 00007D12 E8[FEFF] call _dskxfer 225 _.LVL10: 401:inthndlr.c **** dskxfer(r->DL - 1, SectorBlock->blkno, SectorBlock->buf, 226 .loc 1 401 0 0 00007D15 8904 mov word ptr [si], ax 403:inthndlr.c **** SectorBlock->nblks, mode); 404:inthndlr.c **** 405:inthndlr.c **** if (mode == DSKWRITEINT26) 406:inthndlr.c **** if (r->AX == 0) 228 .loc 1 406 0 0 00007D17 85C0 test ax, ax 0 00007D19 7510 jne _.L63 0 00007D1B 807EFC03 cmp byte ptr [bp-4], 3 0 00007D1F 750A jne _.L63 407:inthndlr.c **** setinvld(r->DL - 1); 233 .loc 1 407 0 0 00007D21 8A4406 mov al, byte ptr [si+6] 0 00007D24 30E4 xor ah, ah 0 00007D26 48 dec ax 0 00007D27 50 push ax 0 00007D28 E8[FEFF] call _setinvld 239 _.LVL11: 240 _.L63: 408:inthndlr.c **** 409:inthndlr.c **** if (r->AX > 0) 241 .loc 1 409 0 0 00007D2B 833C00 cmp word ptr [si], 0 0 00007D2E 7503E92102 je _.L96 410:inthndlr.c **** return -0x20c; 244 .loc 1 410 0 0 00007D33 B9F4FD mov cx, -524 0 00007D36 E9FF00 jmp _.L26 247 _.LVL12: 248 _.L30: 249 _.LBE10: 250 _.LBB11: 228:inthndlr.c **** return DE_INVLDBUF; 251 .loc 1 228 0 0 00007D39 837C043E cmp word ptr [si+4], 62 0 00007D3D 7703E98D03 jbe _.L69 231:inthndlr.c **** if (rc != SUCCESS) 254 .loc 1 231 0 0 00007D42 8D46FE lea ax, [-2+bp] 0 00007D45 50 push ax 0 00007D46 FF7406 push word ptr [si+6] 0 00007D49 E8[FEFF] call _GetDriveDPB 259 _.LVL13: 0 00007D4C 93 xchg bx, ax 261 _.LVL14: 232:inthndlr.c **** return rc; 262 .loc 1 232 0 0 00007D4D 8B4EFE mov cx, word ptr [bp-2] 0 00007D50 85C9 test cx, cx 0 00007D52 7403E9E100 jne _.L26 0 00007D57 894EF4 mov word ptr [bp-12], cx 236:inthndlr.c **** dpb->dpb_flags = M_CHANGED; /* force reread of drive BPB/DPB */ 267 .loc 1 236 0 0 00007D5A 8EC2 mov es, dx 0 00007D5C 8956FA mov word ptr [bp-6], dx 0 00007D5F 268A07 mov al, byte ptr es:[bx] 271 _.LVL15: 0 00007D62 895EFC mov word ptr [bp-4], bx 0 00007D65 98 cbw 0 00007D66 50 push ax 0 00007D67 E8[FEFF] call _flush_buffers 276 _.LVL16: 237:inthndlr.c **** 277 .loc 1 237 0 0 00007D6A 8B56FA mov dx, word ptr [bp-6] 0 00007D6D 8EC2 mov es, dx 0 00007D6F 8B5EFC mov bx, word ptr [bp-4] 0 00007D72 26C64718FF mov byte ptr es:[bx+24], -1 282 _.LVL17: 239:inthndlr.c **** return DE_INVLDDRV; 283 .loc 1 239 0 0 00007D77 52 push dx 0 00007D78 8956F6 mov word ptr [bp-10], dx 0 00007D7B 53 push bx 0 00007D7C 895EF8 mov word ptr [bp-8], bx 0 00007D7F E8[FEFF] call _media_check 289 _.LVL18: 0 00007D82 85C0 test ax, ax 0 00007D84 7D03E94602 jl _.L71 242:inthndlr.c **** 292 .loc 1 242 0 0 00007D89 8B440E mov ax, word ptr [si+14] 0 00007D8C 8946FC mov word ptr [bp-4], ax 0 00007D8F 8B740A mov si, word ptr [si+10] 296 _.LVL19: 244:inthndlr.c **** xddp->xdd_dpbsize = sizeof(struct dpb); 297 .loc 1 244 0 0 00007D92 89F0 mov ax, si 299 _.LVL20: 0 00007D94 83C002 add ax, 2 0 00007D97 8946FA mov word ptr [bp-6], ax 0 00007D9A BF3D00 mov di, 61 0 00007D9D 57 push di 0 00007D9E 8B56F6 mov dx, word ptr [bp-10] 0 00007DA1 52 push dx 0 00007DA2 8B5EF8 mov bx, word ptr [bp-8] 0 00007DA5 53 push bx 0 00007DA6 FF76FC push word ptr [bp-4] 0 00007DA9 50 push ax 0 00007DAA E8[FEFF] call _fmemcpy 311 _.LVL21: 245:inthndlr.c **** 312 .loc 1 245 0 0 00007DAD 8E46FC mov es, word ptr [bp-4] 0 00007DB0 26893C mov word ptr es:[si], di 315 _.LVL22: 248:inthndlr.c **** { 316 .loc 1 248 0 0 00007DB3 8B56F6 mov dx, word ptr [bp-10] 0 00007DB6 8EC2 mov es, dx 0 00007DB8 8B5EF8 mov bx, word ptr [bp-8] 0 00007DBB 26837F0F00 cmp word ptr es:[bx+15], 0 0 00007DC0 7503E98F01 je _.L96 248:inthndlr.c **** { 322 .loc 1 248 0 is_stmt 0 discriminator 1 0 00007DC5 268B470D mov ax, word ptr es:[bx+13] 0 00007DC9 2639472D cmp word ptr es:[bx+45], ax 0 00007DCD 8B4EF4 mov cx, word ptr [bp-12] 0 00007DD0 7509 jne _.L75 0 00007DD2 26394F2F cmp word ptr es:[bx+47], cx 0 00007DD6 7503E97901 je _.L96 329 _.L75: 251:inthndlr.c **** dpb16to32(&xddp->xdd_dpb); 330 .loc 1 251 0 is_stmt 1 0 00007DDB 8EC2 mov es, dx 0 00007DDD 8956F4 mov word ptr [bp-12], dx 0 00007DE0 26837F1FFF cmp word ptr es:[bx+31], -1 0 00007DE5 895EF6 mov word ptr [bp-10], bx 0 00007DE8 B90000 mov cx, 0 0 00007DEB 894EF8 mov word ptr [bp-8], cx 0 00007DEE F5 cmc 0 00007DEF 19C0 sbb ax, ax 0 00007DF1 8E46FC mov es, word ptr [bp-4] 0 00007DF4 26894423 mov word ptr es:[si+35], ax 252:inthndlr.c **** xddp->xdd_dpb.dpb_xfatsize = dpb->dpb_fatsize; 341 .loc 1 252 0 0 00007DF8 FF76FC push word ptr [bp-4] 0 00007DFB FF76FA push word ptr [bp-6] 0 00007DFE E8[FEFF] call _dpb16to32 345 _.LVL23: 253:inthndlr.c **** xddp->xdd_dpb.dpb_xcluster = (dpb->dpb_cluster == 0xFFFF ? 346 .loc 1 253 0 0 00007E01 8B56F4 mov dx, word ptr [bp-12] 0 00007E04 8EC2 mov es, dx 0 00007E06 8B5EF6 mov bx, word ptr [bp-10] 0 00007E09 268B470F mov ax, word ptr es:[bx+15] 0 00007E0D 8E46FC mov es, word ptr [bp-4] 0 00007E10 26894433 mov word ptr es:[si+51], ax 0 00007E14 8E46FC mov es, word ptr [bp-4] 0 00007E17 8B4EF8 mov cx, word ptr [bp-8] 0 00007E1A 26894C35 mov word ptr es:[si+53], cx 254:inthndlr.c **** 0xFFFFFFFFuL : dpb->dpb_cluster); 356 .loc 1 254 0 0 00007E1E 8EC2 mov es, dx 0 00007E20 268B471D mov ax, word ptr es:[bx+29] 255:inthndlr.c **** } 359 .loc 1 255 0 0 00007E24 83F8FF cmp ax, -1 0 00007E27 F5 cmc 0 00007E28 19D2 sbb dx, dx 254:inthndlr.c **** 0xFFFFFFFFuL : dpb->dpb_cluster); 363 .loc 1 254 0 0 00007E2A 8E46FC mov es, word ptr [bp-4] 0 00007E2D 2689443B mov word ptr es:[si+59], ax 0 00007E31 8E46FC mov es, word ptr [bp-4] 0 00007E34 2689543D mov word ptr es:[si+61], dx 368 _.L26: 369 _.LBE11: 411:inthndlr.c **** break; 412:inthndlr.c **** } 413:inthndlr.c **** default: 414:inthndlr.c **** return DE_INVLDFUNC; 415:inthndlr.c **** } 416:inthndlr.c **** return SUCCESS; 417:inthndlr.c **** } 370 .loc 1 417 0 0 00007E38 91 xchg cx, ax 0 00007E39 89EC mov sp, bp 0 00007E3B 5D pop bp 0 00007E3C 5F pop di 0 00007E3D 5E pop si 0 00007E3E C20200 ret 2 377 _.LVL24: 378 _.L28: 379 _.LBB12: 262:inthndlr.c **** 380 .loc 1 262 0 0 00007E41 8B540E mov dx, word ptr [si+14] 0 00007E44 8B440A mov ax, word ptr [si+10] 383 _.LVL25: 264:inthndlr.c **** return DE_INVLDBUF; 384 .loc 1 264 0 0 00007E47 837C042B cmp word ptr [si+4], 43 0 00007E4B 7703E97F02 jbe _.L69 267:inthndlr.c **** if (rc != SUCCESS) 387 .loc 1 267 0 0 00007E50 52 push dx 0 00007E51 50 push ax 0 00007E52 8B4406 mov ax, word ptr [si+6] 391 _.LVL26: 0 00007E55 FF740C push word ptr [si+12] 393 _.LVL27: 0 00007E58 50 push ax 395 _.LVL28: 0 00007E59 E8[FEFF] call _DosGetExtFree 397 _.LVL29: 0 00007E5C 91 xchg cx, ax 0 00007E5D EBD9 jmp _.L26 400 _.L31: 401 _.LBE12: 402 _.LBB13: 275:inthndlr.c **** struct dpb FAR *dpb; 403 .loc 1 275 0 0 00007E5F 8B440E mov ax, word ptr [si+14] 0 00007E62 8946FA mov word ptr [bp-6], ax 0 00007E65 8B440A mov ax, word ptr [si+10] 0 00007E68 8946F8 mov word ptr [bp-8], ax 408 _.LVL30: 277:inthndlr.c **** { 409 .loc 1 277 0 0 00007E6B 837C0417 cmp word ptr [si+4], 23 0 00007E6F 7703E95B02 jbe _.L69 281:inthndlr.c **** if (rc != SUCCESS) 412 .loc 1 281 0 0 00007E74 8D46FE lea ax, [-2+bp] 414 _.LVL31: 0 00007E77 50 push ax 0 00007E78 FF7406 push word ptr [si+6] 0 00007E7B E8[FEFF] call _GetDriveDPB 418 _.LVL32: 0 00007E7E 93 xchg bx, ax 0 00007E7F 8956FC mov word ptr [bp-4], dx 421 _.LVL33: 282:inthndlr.c **** return rc; 422 .loc 1 282 0 0 00007E82 8B4EFE mov cx, word ptr [bp-2] 0 00007E85 85C9 test cx, cx 0 00007E87 75AF jne _.L26 285:inthndlr.c **** xdffp->xdff_version.actual = 0; 426 .loc 1 285 0 0 00007E89 C47EF8 les di, dword ptr [bp-8] 0 00007E8C 26C7051800 mov word ptr es:[di], 24 429 _.LVL34: 286:inthndlr.c **** 430 .loc 1 286 0 0 00007E91 C47EF8 les di, dword ptr [bp-8] 0 00007E94 26894D02 mov word ptr es:[di+2], cx 288:inthndlr.c **** { 433 .loc 1 288 0 0 00007E98 C47EF8 les di, dword ptr [bp-8] 0 00007E9B 268B4504 mov ax, word ptr es:[di+4] 436 _.LVL35: 0 00007E9F 83F804 cmp ax, 4 0 00007EA2 7603E901FE ja _.L70 0 00007EA7 89C2 mov dx, ax 440 _.LVL36: 0 00007EA9 D1E2 shl dx, 1 0 00007EAB 89D7 mov di, dx 0 00007EAD FFA5[0000] jmp word ptr [di+_.L37] === Switch to base=012BB0h -> ".RODATA" 444 .section .rodata 445 .p2align 1 446 .p2align 2 447 _.L37: 0 00001680 [0803] .hword _.L36 0 00001682 [DF03] .hword _.L38 0 00001684 [0504] .hword _.L39 0 00001686 [2C04] .hword _.L40 0 00001688 [2C04] .hword _.L40 === Switch to base=002270h -> ".TEXT" 453 .text 454 _.L36: 455 _.LBB4: 292:inthndlr.c **** ULONG cluster = xdffp->xdff_f.setdpbcounts.cluster; 456 .loc 1 292 0 0 00007EB1 C47EF8 les di, dword ptr [bp-8] 0 00007EB4 268B5508 mov dx, word ptr es:[di+8] 0 00007EB8 268B750A mov si, word ptr es:[di+10] 460 _.LVL37: 293:inthndlr.c **** if (ISFAT32(dpb)) 461 .loc 1 293 0 0 00007EBC 268B450C mov ax, word ptr es:[di+12] 0 00007EC0 268B4D0E mov cx, word ptr es:[di+14] 0 00007EC4 894EFA mov word ptr [bp-6], cx 465 _.LVL38: 294:inthndlr.c **** { 466 .loc 1 294 0 0 00007EC7 8E46FC mov es, word ptr [bp-4] 0 00007ECA 26837F0F00 cmp word ptr es:[bx+15], 0 0 00007ECF 7403E98500 jne _.L41 296:inthndlr.c **** && (nfreeclst != 0 || cluster != 0)) 470 .loc 1 296 0 0 00007ED4 26837F25FF cmp word ptr es:[bx+37], -1 0 00007ED9 7510 jne _.L42 297:inthndlr.c **** || nfreeclst == 1 || nfreeclst > dpb->dpb_xsize 473 .loc 1 297 0 0 00007EDB 89D7 mov di, dx 0 00007EDD 09C7 or di, ax 0 00007EDF 09F1 or cx, si 477 _.LVL39: 0 00007EE1 09CF or di, cx 0 00007EE3 740F je _.L43 480 _.LVL40: 481 _.L45: 301:inthndlr.c **** } 482 .loc 1 301 0 0 00007EE5 B9A9FF mov cx, -87 0 00007EE8 E94DFF jmp _.L26 485 _.LVL41: 486 _.L42: 298:inthndlr.c **** || cluster == 1 || cluster > dpb->dpb_xsize) 487 .loc 1 298 0 0 00007EEB 83FA01 cmp dx, 1 0 00007EEE 7504 jne _.L43 0 00007EF0 85F6 test si, si 0 00007EF2 74F1 je _.L45 492 _.LVL42: 493 _.L43: 298:inthndlr.c **** || cluster == 1 || cluster > dpb->dpb_xsize) 494 .loc 1 298 0 is_stmt 0 discriminator 1 0 00007EF4 8E46FC mov es, word ptr [bp-4] 0 00007EF7 268B4F2D mov cx, word ptr es:[bx+45] 0 00007EFB 894EF8 mov word ptr [bp-8], cx 0 00007EFE 268B4F2F mov cx, word ptr es:[bx+47] 0 00007F02 89CF mov di, cx 299:inthndlr.c **** { 500 .loc 1 299 0 is_stmt 1 discriminator 1 0 00007F04 B501 mov ch, 1 0 00007F06 397EFA cmp word ptr [bp-6], di 0 00007F09 7709 ja _.L47 0 00007F0B 7505 jne _.L48 0 00007F0D 3B46F8 cmp ax, word ptr [bp-8] 0 00007F10 7702 ja _.L47 507 _.L48: 0 00007F12 30ED xor ch, ch 509 _.L47: 298:inthndlr.c **** || cluster == 1 || cluster > dpb->dpb_xsize) 510 .loc 1 298 0 discriminator 1 0 00007F14 B101 mov cl, 1 0 00007F16 39FE cmp si, di 0 00007F18 7709 ja _.L49 0 00007F1A 7505 jne _.L50 0 00007F1C 3B56F8 cmp dx, word ptr [bp-8] 0 00007F1F 7702 ja _.L49 517 _.L50: 0 00007F21 30C9 xor cl, cl 519 _.L49: 299:inthndlr.c **** { 520 .loc 1 299 0 discriminator 1 0 00007F23 08CD or ch, cl 0 00007F25 75BE jne _.L45 0 00007F27 89C1 mov cx, ax 0 00007F29 83F101 xor cx, 1 0 00007F2C 0B4EFA or cx, word ptr [bp-6] 0 00007F2F 74B4 je _.L45 303:inthndlr.c **** dpb->dpb_xcluster = cluster; 527 .loc 1 303 0 0 00007F31 8E46FC mov es, word ptr [bp-4] 0 00007F34 2689571F mov word ptr es:[bx+31], dx 530 _.LVL43: 0 00007F38 8E46FC mov es, word ptr [bp-4] 0 00007F3B 26897721 mov word ptr es:[bx+33], si 304:inthndlr.c **** write_fsinfo(dpb); 533 .loc 1 304 0 0 00007F3F 8E46FC mov es, word ptr [bp-4] 0 00007F42 26894739 mov word ptr es:[bx+57], ax 0 00007F46 C446FA les ax, dword ptr [bp-6] 0 00007F49 2689473B mov word ptr es:[bx+59], ax 305:inthndlr.c **** } 538 .loc 1 305 0 0 00007F4D FF76FC push word ptr [bp-4] 0 00007F50 53 push bx 0 00007F51 E8[FEFF] call _write_fsinfo 542 _.LVL44: 543 _.L96: 544 _.LBE4: 545 _.LBE13: 416:inthndlr.c **** } 546 .loc 1 416 0 0 00007F54 31C9 xor cx, cx 0 00007F56 E9DFFE jmp _.L26 549 _.LVL45: 550 _.L41: 551 _.LBB14: 552 _.LBB5: 309:inthndlr.c **** (unsigned)cluster == 1 || (unsigned)cluster > dpb->dpb_size) 553 .loc 1 309 0 0 00007F59 83FA01 cmp dx, 1 0 00007F5C 7487 je _.L45 309:inthndlr.c **** (unsigned)cluster == 1 || (unsigned)cluster > dpb->dpb_size) 556 .loc 1 309 0 is_stmt 0 discriminator 1 0 00007F5E 8E46FC mov es, word ptr [bp-4] 0 00007F61 268B4F0D mov cx, word ptr es:[bx+13] 559 _.LVL46: 0 00007F65 39CA cmp dx, cx 0 00007F67 7603E979FF ja _.L45 310:inthndlr.c **** { 562 .loc 1 310 0 is_stmt 1 discriminator 2 0 00007F6C 39C1 cmp cx, ax 0 00007F6E 7303E972FF jc _.L45 0 00007F73 83F801 cmp ax, 1 0 00007F76 7503E96AFF je _.L45 314:inthndlr.c **** dpb->dpb_cluster = (UWORD)cluster; 567 .loc 1 314 0 0 00007F7B 2689571F mov word ptr es:[bx+31], dx 569 _.LVL47: 315:inthndlr.c **** } 570 .loc 1 315 0 0 00007F7F 8E46FC mov es, word ptr [bp-4] 0 00007F82 2689471D mov word ptr es:[bx+29], ax 0 00007F86 EBCC jmp _.L96 574 _.LVL48: 575 _.L38: 0 00007F88 895EF6 mov word ptr [bp-10], bx 577 _.LBE5: 578 _.LBB6: 321:inthndlr.c **** fmemcpy(&pddt->ddt_bpb, xdffp->xdff_f.rebuilddpb.bpbp, 579 .loc 1 321 0 0 00007F8B 8A4406 mov al, byte ptr [si+6] 0 00007F8E 30E4 xor ah, ah 0 00007F90 50 push ax 0 00007F91 E8[FEFF] call _getddt 584 _.LVL49: 322:inthndlr.c **** sizeof(bpb)); 585 .loc 1 322 0 0 00007F94 BA2900 mov dx, 41 0 00007F97 52 push dx 0 00007F98 C45EF8 les bx, dword ptr [bp-8] 0 00007F9B 26FF770E push word ptr es:[bx+14] 0 00007F9F 26FF770C push word ptr es:[bx+12] 0 00007FA3 83C006 add ax, 6 592 _.LVL50: 0 00007FA6 16 push ss 0 00007FA7 50 push ax 0 00007FA8 E8[FEFF] call _fmemcpy 596 _.LVL51: 0 00007FAB 8B5EF6 mov bx, word ptr [bp-10] 598 _.L39: 599 _.LBE6: 329:inthndlr.c **** dpb->dpb_flags = M_CHANGED; 600 .loc 1 329 0 0 00007FAE 8E46FC mov es, word ptr [bp-4] 0 00007FB1 268A07 mov al, byte ptr es:[bx] 0 00007FB4 895EFA mov word ptr [bp-6], bx 0 00007FB7 98 cbw 0 00007FB8 50 push ax 0 00007FB9 E8[FEFF] call _flush_buffers 607 _.LVL52: 330:inthndlr.c **** 608 .loc 1 330 0 0 00007FBC C45EFA les bx, dword ptr [bp-6] 0 00007FBF 26C64718FF mov byte ptr es:[bx+24], -1 332:inthndlr.c **** return DE_INVLDDRV; 611 .loc 1 332 0 0 00007FC4 FF76FC push word ptr [bp-4] 0 00007FC7 53 push bx 0 00007FC8 E8[FEFF] call _media_check 615 _.LVL53: 0 00007FCB 85C0 test ax, ax 0 00007FCD 7D85 jge _.L96 618 _.L71: 333:inthndlr.c **** break; 619 .loc 1 333 0 0 00007FCF B9F1FF mov cx, -15 0 00007FD2 E963FE jmp _.L26 622 _.L40: 623 _.LBB7: 340:inthndlr.c **** return DE_INVLDPARM; 624 .loc 1 340 0 0 00007FD5 8E46FC mov es, word ptr [bp-4] 0 00007FD8 26837F0F00 cmp word ptr es:[bx+15], 0 0 00007FDD 7403E903FF jne _.L45 343:inthndlr.c **** if ((UWORD) xdffp->xdff_function == 0x03) 628 .loc 1 343 0 0 00007FE2 C47EF8 les di, dword ptr [bp-8] 0 00007FE5 268B4D08 mov cx, word ptr es:[di+8] 0 00007FE9 268B750A mov si, word ptr es:[di+10] 632 _.LVL54: 344:inthndlr.c **** { 633 .loc 1 344 0 0 00007FED 83F803 cmp ax, 3 0 00007FF0 757F jne _.L51 347:inthndlr.c **** return DE_INVLDPARM; 636 .loc 1 347 0 0 00007FF2 83F9FF cmp cx, -1 0 00007FF5 7505 jne _.L76 0 00007FF7 83FEFF cmp si, -1 0 00007FFA 740C je _.L52 641 _.L76: 347:inthndlr.c **** return DE_INVLDPARM; 642 .loc 1 347 0 is_stmt 0 discriminator 1 0 00007FFC 89C8 mov ax, cx 0 00007FFE 2570FF and ax, -144 0 00008001 09F0 or ax, si 0 00008003 7403E9DDFE jne _.L45 647 _.L52: 349:inthndlr.c **** } 648 .loc 1 349 0 is_stmt 1 0 00008008 8E46FC mov es, word ptr [bp-4] 0 0000800B 268B4723 mov ax, word ptr es:[bx+35] 0 0000800F C47EF8 les di, dword ptr [bp-8] 0 00008012 2689450C mov word ptr es:[di+12], ax 0 00008016 C47EF8 les di, dword ptr [bp-8] 0 00008019 26C7450E0000 mov word ptr es:[di+14], 0 655 _.L54: 358:inthndlr.c **** { 656 .loc 1 358 0 0 0000801F 83F9FF cmp cx, -1 0 00008022 7505 jne _.L79 0 00008024 83FEFF cmp si, -1 0 00008027 7485 je _.L39 661 _.L79: 0 00008029 894EF2 mov word ptr [bp-14], cx 663 _.LBB8: 361:inthndlr.c **** bp->b_flag &= ~(BFR_DATA | BFR_DIR | BFR_FAT); 664 .loc 1 361 0 0 0000802C 31D2 xor dx, dx 0 0000802E 52 push dx 0 0000802F 8E46FC mov es, word ptr [bp-4] 0 00008032 268A07 mov al, byte ptr es:[bx] 0 00008035 895EF4 mov word ptr [bp-12], bx 0 00008038 98 cbw 0 00008039 50 push ax 0 0000803A 52 push dx 0 0000803B B80100 mov ax, 1 0 0000803E 50 push ax 0 0000803F E8[FEFF] call _getblk 676 _.LVL55: 362:inthndlr.c **** bp->b_flag |= BFR_VALID | BFR_DIRTY; 677 .loc 1 362 0 0 00008042 8EC2 mov es, dx 0 00008044 89C3 mov bx, ax 0 00008046 268A4F05 mov cl, byte ptr es:[bx+5] 0 0000804A 884EF6 mov byte ptr [bp-10], cl 0 0000804D 80E1F1 and cl, -15 363:inthndlr.c **** bpbp = (bpb FAR *) & bp->b_buffer[BT_BPB]; 683 .loc 1 363 0 0 00008050 80C960 or cl, 96 0 00008053 26884F05 mov byte ptr es:[bx+5], cl 686 _.LVL56: 365:inthndlr.c **** bpbp->bpb_xflags = (UWORD)value; 687 .loc 1 365 0 0 00008057 C45EF8 les bx, dword ptr [bp-8] 0 0000805A 26837F0403 cmp word ptr es:[bx+4], 3 0 0000805F 8B5EF4 mov bx, word ptr [bp-12] 0 00008062 8B4EF2 mov cx, word ptr [bp-14] 366:inthndlr.c **** else 692 .loc 1 366 0 0 00008065 8EC2 mov es, dx 0 00008067 97 xchg di, ax 365:inthndlr.c **** bpbp->bpb_xflags = (UWORD)value; 695 .loc 1 365 0 0 00008068 755A jne _.L60 366:inthndlr.c **** else 697 .loc 1 366 0 0 0000806A 26894D3C mov word ptr es:[di+60], cx 0 0000806E E93DFF jmp _.L39 700 _.LVL57: 701 _.L51: 702 _.LBE8: 354:inthndlr.c **** return DE_INVLDPARM; 703 .loc 1 354 0 0 00008071 83F9FF cmp cx, -1 0 00008074 7505 jne _.L77 0 00008076 83FEFF cmp si, -1 0 00008079 741E je _.L55 708 _.L77: 354:inthndlr.c **** return DE_INVLDPARM; 709 .loc 1 354 0 is_stmt 0 discriminator 1 0 0000807B 85F6 test si, si 0 0000807D 7539 jne _.L78 0 0000807F 83F901 cmp cx, 1 0 00008082 7703E95EFE jbe _.L45 714 _.L84: 354:inthndlr.c **** return DE_INVLDPARM; 715 .loc 1 354 0 discriminator 2 0 00008087 8E46FC mov es, word ptr [bp-4] 0 0000808A 2639772F cmp word ptr es:[bx+47], si 0 0000808E 7509 jne _.L55 0 00008090 26394F2D cmp word ptr es:[bx+45], cx 0 00008094 7303E94CFE jc _.L45 721 _.L55: 356:inthndlr.c **** } 722 .loc 1 356 0 is_stmt 1 0 00008099 8E46FC mov es, word ptr [bp-4] 0 0000809C 268B4735 mov ax, word ptr es:[bx+53] 0 000080A0 C47EF8 les di, dword ptr [bp-8] 0 000080A3 2689450C mov word ptr es:[di+12], ax 0 000080A7 8E46FC mov es, word ptr [bp-4] 0 000080AA 268B4737 mov ax, word ptr es:[bx+55] 0 000080AE C47EF8 les di, dword ptr [bp-8] 0 000080B1 2689450E mov word ptr es:[di+14], ax 0 000080B5 E967FF jmp _.L54 732 _.L78: 354:inthndlr.c **** return DE_INVLDPARM; 733 .loc 1 354 0 discriminator 2 0 000080B8 8E46FC mov es, word ptr [bp-4] 0 000080BB 2639772F cmp word ptr es:[bx+47], si 0 000080BF 73C6 jnc _.L84 0 000080C1 E921FE jmp _.L45 738 _.LVL58: 739 _.L60: 740 _.LBB9: 368:inthndlr.c **** } 741 .loc 1 368 0 0 000080C4 26894D40 mov word ptr es:[di+64], cx 0 000080C8 26897542 mov word ptr es:[di+66], si 0 000080CC E9DFFE jmp _.L39 745 _.LVL59: 746 _.L69: 747 _.LBE9: 748 _.LBE7: 749 _.LBE14: 750 _.LBB15: 229:inthndlr.c **** 751 .loc 1 229 0 0 000080CF B9E8FF mov cx, -24 0 000080D2 E963FD jmp _.L26 754 _.LVL60: 755 _.L72: 756 _.LBE15: 757 _.LBB16: 394:inthndlr.c **** 758 .loc 1 394 0 0 000080D5 B9F9FD mov cx, -519 760 _.LVL61: 0 000080D8 E95DFD jmp _.L26 762 _.LBE16: 763 _.LFE5: 764 .size _int21_fat32, .-_int21_fat32 === Switch to base=012BB0h -> ".RODATA.STR1.1" 765 .section .rodata.str1.1,"aMS",@progbits,1 766 _.LC0: 0 0000199D 4D43422063686169 .string "MCB chain corrupted" 0 000019A5 6E20636F72727570 0 000019AD 74656400 768 _.LC1: 0 000019B1 6265666F72652034 .string "before 4a: MCB chain corrupted" 0 000019B9 613A204D43422063 0 000019C1 6861696E20636F72 0 000019C9 72757074656400 770 _.LC2: 0 000019D0 6166746572203461 .string "after 4a: MCB chain corrupted" 0 000019D8 3A204D4342206368 0 000019E0 61696E20636F7272 0 000019E8 757074656400 === Switch to base=002270h -> ".TEXT" 772 .text 773 .global _int21_service 774 .type _int21_service, @function 775 _int21_service: 776 _.LFB6: 418:inthndlr.c **** #endif 419:inthndlr.c **** 420:inthndlr.c **** VOID ASMCFUNC int21_service(iregs FAR * r) 421:inthndlr.c **** { 777 .loc 1 421 0 778 _.LVL62: 0 000080DB 56 push si 0 000080DC 57 push di 0 000080DD 55 push bp 782 _.LCFI3: 0 000080DE 89E5 mov bp, sp 784 _.LCFI4: 0 000080E0 83EC36 sub sp, 54 0 000080E3 8B7E08 mov di, word ptr [bp+8] 0 000080E6 8B460A mov ax, word ptr [bp+10] 0 000080E9 8946D6 mov word ptr [bp-42], ax 422:inthndlr.c **** COUNT rc; 423:inthndlr.c **** long lrc; 424:inthndlr.c **** lregs lr; /* 8 local registers (ax, bx, cx, dx, si, di, ds, es) */ 425:inthndlr.c **** psp FAR *psp = MK_FP(cu_psp, 0); 789 .loc 1 425 0 0 000080EC A1[0000] mov ax, word ptr [_cu_psp] 0 000080EF 8946D4 mov word ptr [bp-44], ax 792 _.LVL63: 426:inthndlr.c **** 427:inthndlr.c **** #define FP_DS_DX (MK_FP(lr.DS, lr.DX)) 428:inthndlr.c **** #define FP_ES_DI (MK_FP(lr.ES, lr.DI)) 429:inthndlr.c **** 430:inthndlr.c **** #define CLEAR_CARRY_FLAG() r->FLAGS &= ~FLG_CARRY 431:inthndlr.c **** #define SET_CARRY_FLAG() r->FLAGS |= FLG_CARRY 432:inthndlr.c **** 433:inthndlr.c **** psp->ps_stack = (BYTE FAR *) r; 793 .loc 1 433 0 0 000080F2 8EC0 mov es, ax 0 000080F4 26893E2E00 mov word ptr es:[46], di 796 _.LVL64: 0 000080F9 8E46D4 mov es, word ptr [bp-44] 0 000080FC 8B46D6 mov ax, word ptr [bp-42] 799 _.LVL65: 0 000080FF 26A33000 mov word ptr es:[48], ax 434:inthndlr.c **** 435:inthndlr.c **** fmemcpy(&lr, r, sizeof(lregs) - 4); 801 .loc 1 435 0 0 00008103 8C56D2 mov word ptr [bp-46], ss 0 00008106 B80C00 mov ax, 12 0 00008109 50 push ax 0 0000810A 8946D0 mov word ptr [bp-48], ax 0 0000810D FF76D6 push word ptr [bp-42] 0 00008110 57 push di 0 00008111 16 push ss 0 00008112 8D46D8 lea ax, [-40+bp] 0 00008115 50 push ax 0 00008116 E8[FEFF] call _fmemcpy 812 _.LVL66: 436:inthndlr.c **** lr.DS = r->DS; 813 .loc 1 436 0 0 00008119 8E46D6 mov es, word ptr [bp-42] 0 0000811C 268B550E mov dx, word ptr es:[di+14] 0 00008120 8956E4 mov word ptr [bp-28], dx 437:inthndlr.c **** lr.ES = r->ES; 817 .loc 1 437 0 0 00008123 268B5510 mov dx, word ptr es:[di+16] 0 00008127 8956E6 mov word ptr [bp-26], dx 0 0000812A 31F6 xor si, si 0 0000812C 8B46D0 mov ax, word ptr [bp-48] 0 0000812F 8946CC mov word ptr [bp-52], ax 823 _.L98: 438:inthndlr.c **** 439:inthndlr.c **** dispatch: 440:inthndlr.c **** 441:inthndlr.c **** #ifdef DEBUG 442:inthndlr.c **** if (bDumpRegs) 443:inthndlr.c **** { 444:inthndlr.c **** fmemcpy(&error_regs, user_r, sizeof(iregs)); 445:inthndlr.c **** DebugPrintf(("System call (21h): %02x\n", user_r->AX)); 446:inthndlr.c **** dump_regs = TRUE; 447:inthndlr.c **** dump(); 448:inthndlr.c **** } 449:inthndlr.c **** #endif 450:inthndlr.c **** 451:inthndlr.c **** if ((lr.AH >= 0x38 && lr.AH <= 0x4F) || (lr.AH >= 0x56 && lr.AH <= 0x5c) || 824 .loc 1 451 0 0 00008132 8A46D9 mov al, byte ptr [bp-39] 0 00008135 88C4 mov ah, al 0 00008137 80C4C8 add ah, -56 0 0000813A 80FC18 cmp ah, 23+1 0 0000813D 7220 jc _.L99 0 0000813F 88C4 mov ah, al 0 00008141 80C4AA add ah, -86 0 00008144 80FC07 cmp ah, 6+1 0 00008147 7216 jc _.L99 834 .loc 1 451 0 is_stmt 0 discriminator 1 0 00008149 88C2 mov dl, al 0 0000814B 80C2A2 add dl, -94 0 0000814E 80FA0E cmp dl, 14 0 00008151 771E ja _.L100 0 00008153 BB875F mov bx, 24455 0 00008156 88D1 mov cl, dl 0 00008158 D3EB shr bx, cl 0 0000815A F6C301 test bl, 1 0 0000815D 7412 je _.L100 844 _.L99: 452:inthndlr.c **** (lr.AH >= 0x5e && lr.AH <= 0x60) || (lr.AH >= 0x65 && lr.AH <= 0x6a) || 453:inthndlr.c **** lr.AH == 0x6c) 454:inthndlr.c **** { 455:inthndlr.c **** CLEAR_CARRY_FLAG(); 845 .loc 1 455 0 is_stmt 1 0 0000815F 8E46D6 mov es, word ptr [bp-42] 0 00008162 26806516FE and byte ptr es:[di+22], -2 456:inthndlr.c **** if (lr.AH != 0x59) 848 .loc 1 456 0 0 00008167 3C59 cmp al, 89 0 00008169 7425 je _.L101 457:inthndlr.c **** CritErrCode = SUCCESS; 851 .loc 1 457 0 0 0000816B C706[0000]0000 mov word ptr [_CritErrCode], 0 853 _.L100: 458:inthndlr.c **** } 459:inthndlr.c **** /* Clear carry by default for these functions */ 460:inthndlr.c **** 461:inthndlr.c **** /* 462:inthndlr.c **** what happened: 463:inthndlr.c **** Application does FindFirst("I:\*.*"); 464:inthndlr.c **** this fails, and causes Int24 465:inthndlr.c **** this sets ErrorMode, and calls Int24 466:inthndlr.c **** Application decides NOT to return to DOS, 467:inthndlr.c **** but instead pop the stack and return to itself 468:inthndlr.c **** (this is legal; see RBIL/INT 24 description 469:inthndlr.c **** 470:inthndlr.c **** *) errormode NEVER gets set back to 0 until exit() 471:inthndlr.c **** 472:inthndlr.c **** I have NO idea how real DOS handles this; 473:inthndlr.c **** the appended patch cures the worst symptoms 474:inthndlr.c **** */ 475:inthndlr.c **** if (/*ErrorMode && */lr.AH > 0x0c && lr.AH != 0x30 && lr.AH != 0x59) 854 .loc 1 475 0 0 00008171 3C0D cmp al, 12+1 0 00008173 18D2 sbb dl, dl 0 00008175 FEC2 inc dl 0 00008177 88C4 mov ah, al 0 00008179 80F430 xor ah, 48 0 0000817C 80FC01 cmp ah, 1 0 0000817F 18E4 sbb ah, ah 0 00008181 FEC4 inc ah 0 00008183 84E2 test dl, ah 0 00008185 7409 je _.L101 0 00008187 3C59 cmp al, 89 0 00008189 7405 je _.L101 476:inthndlr.c **** { 477:inthndlr.c **** /*if (ErrorMode)*/ ErrorMode = 0; 867 .loc 1 477 0 0 0000818B C606[0000]00 mov byte ptr [_ErrorMode], 0 869 _.L101: 478:inthndlr.c **** } 479:inthndlr.c **** /* Check for Ctrl-Break */ 480:inthndlr.c **** if (break_ena || (lr.AH >= 1 && lr.AH <= 5) || (lr.AH >= 8 && lr.AH <= 0x0b)) 870 .loc 1 480 0 0 00008190 803E[0000]00 cmp byte ptr [_break_ena], 0 0 00008195 750F jne _.L102 873 .loc 1 480 0 is_stmt 0 discriminator 1 0 00008197 88C4 mov ah, al 0 00008199 FECC dec ah 0 0000819B 80FC04 cmp ah, 4 0 0000819E 7606 jbe _.L102 878 .loc 1 480 0 discriminator 2 0 000081A0 04F8 add al, -8 0 000081A2 3C03 cmp al, 3 0 000081A4 7707 ja _.L103 882 _.L102: 481:inthndlr.c **** check_handle_break(&syscon); 883 .loc 1 481 0 is_stmt 1 0 000081A6 B8[0000] mov ax, offset _syscon 0 000081A9 50 push ax 0 000081AA E8[FEFF] call _check_handle_break 887 _.LVL67: 888 _.L103: 482:inthndlr.c **** 483:inthndlr.c **** /* The dispatch handler */ 484:inthndlr.c **** switch (lr.AH) 889 .loc 1 484 0 0 000081AD 8A66D9 mov ah, byte ptr [bp-39] 0 000081B0 80FC73 cmp ah, 115 0 000081B3 7603E90001 ja _.L374 0 000081B8 88E2 mov dl, ah 0 000081BA 30F6 xor dh, dh 0 000081BC D1E2 shl dx, 1 0 000081BE 89D3 mov bx, dx 0 000081C0 FFA7[0C00] jmp word ptr [bx+_.L106] === Switch to base=012BB0h -> ".RODATA" 898 .section .rodata 899 .p2align 1 0 0000168A 0000 .p2align 2 901 _.L106: 0 0000168C [BC0C] .hword _.L105 0 0000168E [1B06] .hword _.L107 0 00001690 [5306] .hword _.L108 0 00001692 [5806] .hword _.L109 0 00001694 [6D06] .hword _.L110 0 00001696 [8006] .hword _.L111 0 00001698 [8506] .hword _.L112 0 0000169A [AB06] .hword _.L113 0 0000169C [B106] .hword _.L114 0 0000169E [B706] .hword _.L115 0 000016A0 [D706] .hword _.L116 0 000016A2 [0107] .hword _.L117 0 000016A4 [1607] .hword _.L118 0 000016A6 [4307] .hword _.L119 0 000016A8 [4907] .hword _.L120 0 000016AA [5207] .hword _.L121 0 000016AC [6207] .hword _.L122 0 000016AE [6E07] .hword _.L123 0 000016B0 [7E07] .hword _.L124 0 000016B2 [8107] .hword _.L125 0 000016B4 [8D07] .hword _.L126 0 000016B6 [9E07] .hword _.L127 0 000016B8 [A707] .hword _.L128 0 000016BA [AC07] .hword _.L129 0 000016BC [0F07] .hword _.L374 0 000016BE [B807] .hword _.L130 0 000016C0 [BE07] .hword _.L131 0 000016C2 [CD07] .hword _.L132 0 000016C4 [D107] .hword _.L133 0 000016C6 [0F07] .hword _.L374 0 000016C8 [0F07] .hword _.L374 0 000016CA [7309] .hword _.L134 0 000016CC [0F07] .hword _.L374 0 000016CE [F707] .hword _.L135 0 000016D0 [0708] .hword _.L136 0 000016D2 [0C08] .hword _.L137 0 000016D4 [1808] .hword _.L138 0 000016D6 [0F07] .hword _.L374 0 000016D8 [2408] .hword _.L139 0 000016DA [3408] .hword _.L140 0 000016DC [4808] .hword _.L141 0 000016DE [4D08] .hword _.L142 0 000016E0 [6608] .hword _.L143 0 000016E2 [7008] .hword _.L144 0 000016E4 [8008] .hword _.L145 0 000016E6 [8A08] .hword _.L146 0 000016E8 [9308] .hword _.L147 0 000016EA [9E08] .hword _.L148 0 000016EC [AD08] .hword _.L149 0 000016EE [4909] .hword _.L150 0 000016F0 [7309] .hword _.L134 0 000016F2 [0F07] .hword _.L374 0 000016F4 [E409] .hword _.L151 0 000016F6 [0F07] .hword _.L374 0 000016F8 [EF09] .hword _.L152 0 000016FA [070A] .hword _.L153 0 000016FC [2C0A] .hword _.L154 0 000016FE [7E0A] .hword _.L155 0 00001700 [7E0A] .hword _.L155 0 00001702 [8E0A] .hword _.L156 0 00001704 [990A] .hword _.L157 0 00001706 [B50A] .hword _.L158 0 00001708 [C00A] .hword _.L159 0 0000170A [C90A] .hword _.L160 0 0000170C [EF0A] .hword _.L161 0 0000170E [090B] .hword _.L162 0 00001710 [190B] .hword _.L163 0 00001712 [440B] .hword _.L164 0 00001714 [B40B] .hword _.L165 0 00001716 [E50B] .hword _.L166 0 00001718 [EE0B] .hword _.L167 0 0000171A [FA0B] .hword _.L168 0 0000171C [100C] .hword _.L169 0 0000171E [570C] .hword _.L170 0 00001720 [6B0C] .hword _.L171 0 00001722 [9F0C] .hword _.L172 0 00001724 [C10C] .hword _.L173 0 00001726 [F80C] .hword _.L174 0 00001728 [070D] .hword _.L175 0 0000172A [190D] .hword _.L176 0 0000172C [0F07] .hword _.L374 0 0000172E [0F07] .hword _.L374 0 00001730 [270D] .hword _.L177 0 00001732 [2F0D] .hword _.L178 0 00001734 [5D0D] .hword _.L179 0 00001736 [630D] .hword _.L180 0 00001738 [6C0B] .hword _.L181 0 0000173A [890D] .hword _.L182 0 0000173C [C20D] .hword _.L183 0 0000173E [190E] .hword _.L184 0 00001740 [3D0E] .hword _.L185 0 00001742 [4C0E] .hword _.L186 0 00001744 [550E] .hword _.L187 0 00001746 [7C0E] .hword _.L188 0 00001748 [230F] .hword _.L189 0 0000174A [610F] .hword _.L190 0 0000174C [E40F] .hword _.L191 0 0000174E [0F07] .hword _.L374 0 00001750 [0F07] .hword _.L374 0 00001752 [FE0F] .hword _.L192 0 00001754 [120A] .hword _.L193 0 00001756 [2010] .hword _.L194 0 00001758 [B810] .hword _.L195 0 0000175A [E610] .hword _.L196 0 0000175C [EF10] .hword _.L197 0 0000175E [0011] .hword _.L198 0 00001760 [EF10] .hword _.L197 0 00001762 [0F07] .hword _.L374 0 00001764 [5C11] .hword _.L199 0 00001766 [0F07] .hword _.L374 0 00001768 [0F07] .hword _.L374 0 0000176A [0F07] .hword _.L374 0 0000176C [0F07] .hword _.L374 0 0000176E [A611] .hword _.L200 0 00001770 [0F07] .hword _.L374 0 00001772 [7E12] .hword _.L201 === Switch to base=002270h -> ".TEXT" 1018 .text 1019 _.L107: 485:inthndlr.c **** { 486:inthndlr.c **** /* int 21h common error handler */ 487:inthndlr.c **** case 0x64: 488:inthndlr.c **** goto error_invalid; 489:inthndlr.c **** 490:inthndlr.c **** /* case 0x00: --> Simulate a DOS-4C-00 */ 491:inthndlr.c **** 492:inthndlr.c **** /* Read Keyboard with Echo */ 493:inthndlr.c **** case 0x01: 494:inthndlr.c **** DOS_01: 495:inthndlr.c **** lr.AL = read_char_stdin(TRUE); 1020 .loc 1 495 0 0 000081C4 B80100 mov ax, 1 0 000081C7 50 push ax 0 000081C8 E8[FEFF] call _read_char_stdin 1024 _.LVL68: 1025 _.L369: 496:inthndlr.c **** write_char_stdout(lr.AL); 497:inthndlr.c **** break; 498:inthndlr.c **** 499:inthndlr.c **** /* Display Character */ 500:inthndlr.c **** case 0x02: 501:inthndlr.c **** DOS_02: 502:inthndlr.c **** lr.AL = lr.DL; 1026 .loc 1 502 0 0 000081CB 8846D8 mov byte ptr [bp-40], al 503:inthndlr.c **** write_char_stdout(lr.AL); 1028 .loc 1 503 0 0 000081CE 30E4 xor ah, ah 0 000081D0 50 push ax 0 000081D1 E8[FEFF] call _write_char_stdout 1032 _.LVL69: 1033 _.L202: 504:inthndlr.c **** break; 505:inthndlr.c **** 506:inthndlr.c **** /* Auxiliary Input */ 507:inthndlr.c **** case 0x03: 508:inthndlr.c **** { 509:inthndlr.c **** int sft_idx = get_sft_idx(STDAUX); 510:inthndlr.c **** lr.AL = read_char(sft_idx, sft_idx, TRUE); 511:inthndlr.c **** break; 512:inthndlr.c **** } 513:inthndlr.c **** 514:inthndlr.c **** /* Auxiliary Output */ 515:inthndlr.c **** case 0x04: 516:inthndlr.c **** write_char(lr.DL, get_sft_idx(STDAUX)); 517:inthndlr.c **** break; 518:inthndlr.c **** /* Print Character */ 519:inthndlr.c **** case 0x05: 520:inthndlr.c **** write_char(lr.DL, get_sft_idx(STDPRN)); 521:inthndlr.c **** break; 522:inthndlr.c **** 523:inthndlr.c **** /* Direct Console I/O */ 524:inthndlr.c **** case 0x06: 525:inthndlr.c **** DOS_06: 526:inthndlr.c **** if (lr.DL != 0xff) 527:inthndlr.c **** goto DOS_02; 528:inthndlr.c **** 529:inthndlr.c **** lr.AL = 0x00; 530:inthndlr.c **** r->FLAGS |= FLG_ZERO; 531:inthndlr.c **** if (StdinBusy()) { 532:inthndlr.c **** DosIdle_int(); 533:inthndlr.c **** break; 534:inthndlr.c **** } 535:inthndlr.c **** 536:inthndlr.c **** r->FLAGS &= ~FLG_ZERO; 537:inthndlr.c **** /* fall through */ 538:inthndlr.c **** 539:inthndlr.c **** /* Direct Console Input */ 540:inthndlr.c **** case 0x07: 541:inthndlr.c **** DOS_07: 542:inthndlr.c **** lr.AL = read_char_stdin(FALSE); 543:inthndlr.c **** break; 544:inthndlr.c **** 545:inthndlr.c **** /* Read Keyboard Without Echo */ 546:inthndlr.c **** case 0x08: 547:inthndlr.c **** DOS_08: 548:inthndlr.c **** lr.AL = read_char_stdin(TRUE); 549:inthndlr.c **** break; 550:inthndlr.c **** 551:inthndlr.c **** /* Display String */ 552:inthndlr.c **** case 0x09: 553:inthndlr.c **** { 554:inthndlr.c **** unsigned char c; 555:inthndlr.c **** unsigned char FAR *bp = FP_DS_DX; 556:inthndlr.c **** 557:inthndlr.c **** while ((c = *bp++) != '$') 558:inthndlr.c **** write_char_stdout(c); 559:inthndlr.c **** 560:inthndlr.c **** lr.AL = c; 561:inthndlr.c **** } 562:inthndlr.c **** break; 563:inthndlr.c **** 564:inthndlr.c **** /* Buffered Keyboard Input */ 565:inthndlr.c **** case 0x0a: 566:inthndlr.c **** DOS_0A: 567:inthndlr.c **** read_line(get_sft_idx(STDIN), get_sft_idx(STDOUT), FP_DS_DX); 568:inthndlr.c **** break; 569:inthndlr.c **** 570:inthndlr.c **** /* Check Stdin Status */ 571:inthndlr.c **** case 0x0b: 572:inthndlr.c **** lr.AL = 0xFF; 573:inthndlr.c **** if (StdinBusy()) 574:inthndlr.c **** lr.AL = 0x00; 575:inthndlr.c **** break; 576:inthndlr.c **** 577:inthndlr.c **** /* Flush Buffer, Read Keyboard */ 578:inthndlr.c **** case 0x0c: 579:inthndlr.c **** { 580:inthndlr.c **** struct dhdr FAR *dev = sft_to_dev(get_sft(STDIN)); 581:inthndlr.c **** if (dev) 582:inthndlr.c **** con_flush(&dev); 583:inthndlr.c **** switch (lr.AL) 584:inthndlr.c **** { 585:inthndlr.c **** case 0x01: goto DOS_01; 586:inthndlr.c **** case 0x06: goto DOS_06; 587:inthndlr.c **** case 0x07: goto DOS_07; 588:inthndlr.c **** case 0x08: goto DOS_08; 589:inthndlr.c **** case 0x0a: goto DOS_0A; 590:inthndlr.c **** } 591:inthndlr.c **** lr.AL = 0x00; 592:inthndlr.c **** break; 593:inthndlr.c **** } 594:inthndlr.c **** 595:inthndlr.c **** /* Reset Drive */ 596:inthndlr.c **** case 0x0d: 597:inthndlr.c **** flush(); 598:inthndlr.c **** break; 599:inthndlr.c **** 600:inthndlr.c **** /* Set Default Drive */ 601:inthndlr.c **** case 0x0e: 602:inthndlr.c **** lr.AL = DosSelectDrv(lr.DL); 603:inthndlr.c **** break; 604:inthndlr.c **** 605:inthndlr.c **** case 0x0f: 606:inthndlr.c **** lr.AL = FcbOpen(FP_DS_DX, O_FCB | O_LEGACY | O_OPEN | O_RDWR); 607:inthndlr.c **** break; 608:inthndlr.c **** 609:inthndlr.c **** case 0x10: 610:inthndlr.c **** lr.AL = FcbClose(FP_DS_DX); 611:inthndlr.c **** break; 612:inthndlr.c **** 613:inthndlr.c **** case 0x11: 614:inthndlr.c **** lr.AL = FcbFindFirstNext(FP_DS_DX, TRUE); 615:inthndlr.c **** break; 616:inthndlr.c **** 617:inthndlr.c **** case 0x12: 618:inthndlr.c **** lr.AL = FcbFindFirstNext(FP_DS_DX, FALSE); 619:inthndlr.c **** break; 620:inthndlr.c **** 621:inthndlr.c **** case 0x13: 622:inthndlr.c **** lr.AL = FcbDelete(FP_DS_DX); 623:inthndlr.c **** break; 624:inthndlr.c **** 625:inthndlr.c **** case 0x14: 626:inthndlr.c **** /* FCB read */ 627:inthndlr.c **** lr.AL = FcbReadWrite(FP_DS_DX, 1, XFR_READ); 628:inthndlr.c **** break; 629:inthndlr.c **** 630:inthndlr.c **** case 0x15: 631:inthndlr.c **** /* FCB write */ 632:inthndlr.c **** lr.AL = FcbReadWrite(FP_DS_DX, 1, XFR_WRITE); 633:inthndlr.c **** break; 634:inthndlr.c **** 635:inthndlr.c **** case 0x16: 636:inthndlr.c **** lr.AL = FcbOpen(FP_DS_DX, O_FCB | O_LEGACY | O_CREAT | O_TRUNC | O_RDWR); 637:inthndlr.c **** break; 638:inthndlr.c **** 639:inthndlr.c **** case 0x17: 640:inthndlr.c **** lr.AL = FcbRename(FP_DS_DX); 641:inthndlr.c **** break; 642:inthndlr.c **** 643:inthndlr.c **** default: 644:inthndlr.c **** #ifdef DEBUG 645:inthndlr.c **** printf("Unsupported INT21 AH = 0x%x, AL = 0x%x.\n", lr.AH, lr.AL); 646:inthndlr.c **** #endif 647:inthndlr.c **** /* Fall through. */ 648:inthndlr.c **** 649:inthndlr.c **** /* CP/M compatibility functions */ 650:inthndlr.c **** case 0x18: 651:inthndlr.c **** case 0x1d: 652:inthndlr.c **** case 0x1e: 653:inthndlr.c **** case 0x20: 654:inthndlr.c **** #ifndef TSC 655:inthndlr.c **** case 0x61: 656:inthndlr.c **** #endif 657:inthndlr.c **** case 0x6b: 658:inthndlr.c **** lr.AL = 0; 659:inthndlr.c **** break; 660:inthndlr.c **** 661:inthndlr.c **** /* Get Default Drive */ 662:inthndlr.c **** case 0x19: 663:inthndlr.c **** lr.AL = default_drive; 664:inthndlr.c **** break; 665:inthndlr.c **** 666:inthndlr.c **** /* Set DTA */ 667:inthndlr.c **** case 0x1a: 668:inthndlr.c **** dta = FP_DS_DX; 669:inthndlr.c **** break; 670:inthndlr.c **** 671:inthndlr.c **** /* Get Default Drive Data */ 672:inthndlr.c **** case 0x1b: 673:inthndlr.c **** lr.DL = 0; 674:inthndlr.c **** /* fall through */ 675:inthndlr.c **** 676:inthndlr.c **** /* Get Drive Data */ 677:inthndlr.c **** case 0x1c: 678:inthndlr.c **** { 679:inthndlr.c **** BYTE FAR *p; 680:inthndlr.c **** 681:inthndlr.c **** if ((p = FatGetDrvData(lr.DL, &lr.AL, &lr.CX, &lr.DX)) != NULL) 682:inthndlr.c **** { 683:inthndlr.c **** lr.DS = FP_SEG(p); 684:inthndlr.c **** lr.BX = FP_OFF(p); 685:inthndlr.c **** } 686:inthndlr.c **** else 687:inthndlr.c **** lr.AL = 0xff; /* return 0xff on invalid drive */ 688:inthndlr.c **** } 689:inthndlr.c **** break; 690:inthndlr.c **** 691:inthndlr.c **** /* Get default DPB */ 692:inthndlr.c **** /* case 0x1f: see case 0x32 */ 693:inthndlr.c **** 694:inthndlr.c **** /* Random read using FCB: fields not updated 695:inthndlr.c **** (XFR_RANDOM should not be used here) */ 696:inthndlr.c **** case 0x21: 697:inthndlr.c **** lr.AL = FcbRandomIO(FP_DS_DX, XFR_READ); 698:inthndlr.c **** break; 699:inthndlr.c **** 700:inthndlr.c **** /* Random write using FCB */ 701:inthndlr.c **** case 0x22: 702:inthndlr.c **** lr.AL = FcbRandomIO(FP_DS_DX, XFR_WRITE); 703:inthndlr.c **** break; 704:inthndlr.c **** 705:inthndlr.c **** /* Get file size in records using FCB */ 706:inthndlr.c **** case 0x23: 707:inthndlr.c **** lr.AL = FcbGetFileSize(FP_DS_DX); 708:inthndlr.c **** break; 709:inthndlr.c **** 710:inthndlr.c **** /* Set random record field in FCB */ 711:inthndlr.c **** case 0x24: 712:inthndlr.c **** FcbSetRandom(FP_DS_DX); 713:inthndlr.c **** break; 714:inthndlr.c **** 715:inthndlr.c **** /* Set Interrupt Vector */ 716:inthndlr.c **** /* case 0x25: handled above (re-entrant) */ 717:inthndlr.c **** 718:inthndlr.c **** /* Dos Create New Psp */ 719:inthndlr.c **** case 0x26: 720:inthndlr.c **** new_psp(lr.DX, r->CS); 721:inthndlr.c **** break; 722:inthndlr.c **** 723:inthndlr.c **** /* Read random record(s) using FCB */ 724:inthndlr.c **** case 0x27: 725:inthndlr.c **** lr.AL = FcbRandomBlockIO(FP_DS_DX, &lr.CX, XFR_READ | XFR_FCB_RANDOM); 726:inthndlr.c **** break; 727:inthndlr.c **** 728:inthndlr.c **** /* Write random record(s) using FCB */ 729:inthndlr.c **** case 0x28: 730:inthndlr.c **** lr.AL = FcbRandomBlockIO(FP_DS_DX, &lr.CX, XFR_WRITE | XFR_FCB_RANDOM); 731:inthndlr.c **** break; 732:inthndlr.c **** 733:inthndlr.c **** /* Parse File Name */ 734:inthndlr.c **** case 0x29: 735:inthndlr.c **** lr.SI = FcbParseFname(&lr.AL, MK_FP(lr.DS, lr.SI), FP_ES_DI); 736:inthndlr.c **** break; 737:inthndlr.c **** 738:inthndlr.c **** /* Get Date */ 739:inthndlr.c **** case 0x2a: 740:inthndlr.c **** lr.AL = DosGetDate((struct dosdate *)&lr.CX); 741:inthndlr.c **** break; 742:inthndlr.c **** 743:inthndlr.c **** /* Set Date */ 744:inthndlr.c **** case 0x2b: 745:inthndlr.c **** lr.AL = DosSetDate ((struct dosdate*)&lr.CX) == SUCCESS ? 0 : 0xFF; 746:inthndlr.c **** break; 747:inthndlr.c **** 748:inthndlr.c **** /* Get Time */ 749:inthndlr.c **** case 0x2c: 750:inthndlr.c **** DosGetTime((struct dostime *)&lr.CL); 751:inthndlr.c **** break; 752:inthndlr.c **** 753:inthndlr.c **** /* Set Time */ 754:inthndlr.c **** case 0x2d: 755:inthndlr.c **** lr.AL = DosSetTime ((struct dostime*)&lr.CX) == SUCCESS ? 0 : 0xFF; 756:inthndlr.c **** break; 757:inthndlr.c **** 758:inthndlr.c **** /* Set verify flag */ 759:inthndlr.c **** case 0x2e: 760:inthndlr.c **** verify_ena = lr.AL & 1; 761:inthndlr.c **** break; 762:inthndlr.c **** 763:inthndlr.c **** /* Get DTA */ 764:inthndlr.c **** case 0x2f: 765:inthndlr.c **** lr.BX = FP_OFF(dta); 766:inthndlr.c **** lr.ES = FP_SEG(dta); 767:inthndlr.c **** break; 768:inthndlr.c **** 769:inthndlr.c **** /* Get (editable) DOS Version */ 770:inthndlr.c **** case 0x30: 771:inthndlr.c **** { 772:inthndlr.c **** if (lr.AL == 1) /* from RBIL, if AL=1 then return version_flags */ 773:inthndlr.c **** lr.BH = version_flags; 774:inthndlr.c **** else 775:inthndlr.c **** lr.BH = OEM_ID; 776:inthndlr.c **** lr.AX = psp->ps_retdosver; 777:inthndlr.c **** lr.BL = REVISION_SEQ; 778:inthndlr.c **** lr.CX = 0; /* do not set this to a serial number! 779:inthndlr.c **** 32RTM won't like non-zero values */ 780:inthndlr.c **** 781:inthndlr.c **** if (ReturnAnyDosVersionExpected) 782:inthndlr.c **** { 783:inthndlr.c **** /* TE for testing purpose only and NOT 784:inthndlr.c **** to be documented: 785:inthndlr.c **** return programs, who ask for version == XX.YY 786:inthndlr.c **** exactly this XX.YY. 787:inthndlr.c **** this makes most MS programs more happy. 788:inthndlr.c **** */ 789:inthndlr.c **** UBYTE FAR *retp = MK_FP(r->cs, r->ip); 790:inthndlr.c **** 791:inthndlr.c **** if (retp[0] == 0x3d && /* cmp ax, xxyy */ 792:inthndlr.c **** (retp[3] == 0x75 || retp[3] == 0x74)) /* je/jne error */ 793:inthndlr.c **** { 794:inthndlr.c **** lr.AL = retp[1]; 795:inthndlr.c **** lr.AH = retp[2]; 796:inthndlr.c **** } 797:inthndlr.c **** else if (retp[0] == 0x86 && /* xchg al,ah */ 798:inthndlr.c **** retp[1] == 0xc4 && retp[2] == 0x3d && /* cmp ax, xxyy */ 799:inthndlr.c **** (retp[5] == 0x75 || retp[5] == 0x74)) /* je/jne error */ 800:inthndlr.c **** { 801:inthndlr.c **** lr.AL = retp[4]; 802:inthndlr.c **** lr.AH = retp[3]; 803:inthndlr.c **** } 804:inthndlr.c **** 805:inthndlr.c **** } 806:inthndlr.c **** } 807:inthndlr.c **** 808:inthndlr.c **** break; 809:inthndlr.c **** 810:inthndlr.c **** /* Keep Program (Terminate and stay resident) */ 811:inthndlr.c **** case 0x31: 812:inthndlr.c **** DosMemChange(cu_psp, lr.DX < 6 ? 6 : lr.DX, 0); 813:inthndlr.c **** return_code = lr.AL | 0x300; 814:inthndlr.c **** term_type = 3; /* ecm: TSR terminate */ 815:inthndlr.c **** return_user(); 816:inthndlr.c **** break; 817:inthndlr.c **** 818:inthndlr.c **** /* Get default BPB */ 819:inthndlr.c **** case 0x1f: 820:inthndlr.c **** /* Get DPB */ 821:inthndlr.c **** case 0x32: 822:inthndlr.c **** /* r->DL is NOT changed by MS 6.22 */ 823:inthndlr.c **** /* INT21/32 is documented to reread the DPB */ 824:inthndlr.c **** { 825:inthndlr.c **** int drv = (lr.DL == 0 || lr.AH == 0x1f) ? default_drive : lr.DL - 1; 826:inthndlr.c **** struct dpb FAR *dpb = get_dpb(drv); 827:inthndlr.c **** 828:inthndlr.c **** if (dpb == NULL) 829:inthndlr.c **** { 830:inthndlr.c **** CritErrCode = -DE_INVLDDRV; 831:inthndlr.c **** lr.AL = 0xFF; 832:inthndlr.c **** break; 833:inthndlr.c **** } 834:inthndlr.c **** /* hazard: no error checking! */ 835:inthndlr.c **** flush_buffers(dpb->dpb_unit); 836:inthndlr.c **** dpb->dpb_flags = M_CHANGED; /* force flush and reread of drive BPB/DPB */ 837:inthndlr.c **** 838:inthndlr.c **** #ifdef WITHFAT32 839:inthndlr.c **** if (media_check(dpb) < 0 || ISFAT32(dpb)) 840:inthndlr.c **** #else 841:inthndlr.c **** if (media_check(dpb) < 0) 842:inthndlr.c **** #endif 843:inthndlr.c **** { 844:inthndlr.c **** lr.AL = 0xff; 845:inthndlr.c **** CritErrCode = -DE_INVLDDRV; 846:inthndlr.c **** break; 847:inthndlr.c **** } 848:inthndlr.c **** lr.DS = FP_SEG(dpb); 849:inthndlr.c **** lr.BX = FP_OFF(dpb); 850:inthndlr.c **** lr.AL = 0; 851:inthndlr.c **** } 852:inthndlr.c **** 853:inthndlr.c **** break; 854:inthndlr.c **** /* 855:inthndlr.c **** case 0x33: 856:inthndlr.c **** see int21_syscall 857:inthndlr.c **** */ 858:inthndlr.c **** /* Get InDOS flag */ 859:inthndlr.c **** case 0x34: 860:inthndlr.c **** lr.BX = FP_OFF(&InDOS); 861:inthndlr.c **** lr.ES = FP_SEG(&InDOS); 862:inthndlr.c **** break; 863:inthndlr.c **** 864:inthndlr.c **** /* Get Interrupt Vector */ 865:inthndlr.c **** /* case 0x35: handled above (reentrant) */ 866:inthndlr.c **** 867:inthndlr.c **** /* Dos Get Disk Free Space */ 868:inthndlr.c **** case 0x36: 869:inthndlr.c **** lr.AX = DosGetFree(lr.DL, &lr.BX, &lr.CX, &lr.DX); 870:inthndlr.c **** break; 871:inthndlr.c **** 872:inthndlr.c **** /* Undocumented Get/Set Switchar */ 873:inthndlr.c **** case 0x37: 874:inthndlr.c **** switch (lr.AL) 875:inthndlr.c **** { 876:inthndlr.c **** /* Get switch character */ 877:inthndlr.c **** case 0x00: 878:inthndlr.c **** lr.DL = switchar; 879:inthndlr.c **** lr.AL = 0x00; 880:inthndlr.c **** break; 881:inthndlr.c **** 882:inthndlr.c **** /* Set switch character */ 883:inthndlr.c **** case 0x01: 884:inthndlr.c **** switchar = lr.DL; 885:inthndlr.c **** lr.AL = 0x00; 886:inthndlr.c **** break; 887:inthndlr.c **** 888:inthndlr.c **** default: 889:inthndlr.c **** goto error_invalid; 890:inthndlr.c **** } 891:inthndlr.c **** break; 892:inthndlr.c **** 893:inthndlr.c **** /* Get/Set Country Info */ 894:inthndlr.c **** case 0x38: 895:inthndlr.c **** { 896:inthndlr.c **** UWORD cntry = lr.AL; 897:inthndlr.c **** 898:inthndlr.c **** if (cntry == 0xff) 899:inthndlr.c **** cntry = lr.BX; 900:inthndlr.c **** 901:inthndlr.c **** if (0xffff == lr.DX) 902:inthndlr.c **** { 903:inthndlr.c **** /* Set Country Code */ 904:inthndlr.c **** rc = DosSetCountry(cntry); 905:inthndlr.c **** } 906:inthndlr.c **** else 907:inthndlr.c **** { 908:inthndlr.c **** if (cntry == 0) 909:inthndlr.c **** cntry--; 910:inthndlr.c **** /* Get Country Information */ 911:inthndlr.c **** rc = DosGetCountryInformation(cntry, FP_DS_DX); 912:inthndlr.c **** if (rc >= SUCCESS) 913:inthndlr.c **** { 914:inthndlr.c **** if (cntry == (UWORD) - 1) 915:inthndlr.c **** cntry = nlsInfo.actPkg->cntry; 916:inthndlr.c **** lr.AX = lr.BX = cntry; 917:inthndlr.c **** } 918:inthndlr.c **** } 919:inthndlr.c **** goto short_check; 920:inthndlr.c **** } 921:inthndlr.c **** 922:inthndlr.c **** /* Dos Create Directory */ 923:inthndlr.c **** case 0x39: 924:inthndlr.c **** /* Dos Remove Directory */ 925:inthndlr.c **** case 0x3a: 926:inthndlr.c **** rc = DosMkRmdir(FP_DS_DX, lr.AH); 927:inthndlr.c **** goto short_check; 928:inthndlr.c **** 929:inthndlr.c **** /* Dos Change Directory */ 930:inthndlr.c **** case 0x3b: 931:inthndlr.c **** rc = DosChangeDir(FP_DS_DX); 932:inthndlr.c **** goto short_check; 933:inthndlr.c **** 934:inthndlr.c **** /* Dos Create File */ 935:inthndlr.c **** case 0x3c: 936:inthndlr.c **** lrc = DosOpen(FP_DS_DX, O_LEGACY | O_RDWR | O_CREAT | O_TRUNC, lr.CL); 937:inthndlr.c **** goto long_check; 938:inthndlr.c **** 939:inthndlr.c **** /* Dos Open */ 940:inthndlr.c **** case 0x3d: 941:inthndlr.c **** lrc = DosOpen(FP_DS_DX, O_LEGACY | O_OPEN | lr.AL, 0); 942:inthndlr.c **** goto long_check; 943:inthndlr.c **** 944:inthndlr.c **** /* Dos Close */ 945:inthndlr.c **** case 0x3e: 946:inthndlr.c **** rc = DosClose(lr.BX); 947:inthndlr.c **** goto short_check; 948:inthndlr.c **** 949:inthndlr.c **** /* Dos Read */ 950:inthndlr.c **** case 0x3f: 951:inthndlr.c **** lrc = DosRead(lr.BX, lr.CX, FP_DS_DX); 952:inthndlr.c **** goto long_check; 953:inthndlr.c **** 954:inthndlr.c **** /* Dos Write */ 955:inthndlr.c **** case 0x40: 956:inthndlr.c **** lrc = DosWrite(lr.BX, lr.CX, FP_DS_DX); 957:inthndlr.c **** goto long_check; 958:inthndlr.c **** 959:inthndlr.c **** /* Dos Delete File */ 960:inthndlr.c **** case 0x41: 961:inthndlr.c **** rc = DosDelete((BYTE FAR *) FP_DS_DX, D_ALL); 962:inthndlr.c **** goto short_check; 963:inthndlr.c **** 964:inthndlr.c **** /* Dos Seek */ 965:inthndlr.c **** case 0x42: 966:inthndlr.c **** if (lr.AL > 2) 967:inthndlr.c **** goto error_invalid; 968:inthndlr.c **** lrc = DosSeek(lr.BX, (LONG)MK_ULONG(lr.CX, lr.DX), lr.AL, &rc); 969:inthndlr.c **** if (rc == SUCCESS) 970:inthndlr.c **** { 971:inthndlr.c **** lr.DX = (UWORD)(lrc >> 16); 972:inthndlr.c **** lr.AX = (UWORD) lrc; 973:inthndlr.c **** } 974:inthndlr.c **** goto short_check; 975:inthndlr.c **** 976:inthndlr.c **** /* Get/Set File Attributes */ 977:inthndlr.c **** case 0x43: 978:inthndlr.c **** switch (lr.AL) 979:inthndlr.c **** { 980:inthndlr.c **** case 0x00: 981:inthndlr.c **** rc = DosGetFattr((BYTE FAR *) FP_DS_DX); 982:inthndlr.c **** if (rc >= SUCCESS) 983:inthndlr.c **** lr.CX = rc; 984:inthndlr.c **** break; 985:inthndlr.c **** 986:inthndlr.c **** case 0x01: 987:inthndlr.c **** rc = DosSetFattr((BYTE FAR *) FP_DS_DX, lr.CX); 988:inthndlr.c **** lr.AX = lr.CX; 989:inthndlr.c **** break; 990:inthndlr.c **** 991:inthndlr.c **** #if 0 992:inthndlr.c **** case 0x02: 993:inthndlr.c **** /* get compressed size -> compression not support returns size in clusters */ 994:inthndlr.c **** /* rc = DosGetClusterCnt((BYTE FAR *) FP_DS_DX); */ 995:inthndlr.c **** goto error_invalid; 996:inthndlr.c **** #endif 997:inthndlr.c **** 998:inthndlr.c **** case 0xff: /* DOS 7.20 (w98) extended name (128 char length) functions */ 999:inthndlr.c **** { 1000:inthndlr.c **** switch(lr.CL) 1001:inthndlr.c **** { 1002:inthndlr.c **** /* Dos Create Directory */ 1003:inthndlr.c **** case 0x39: 1004:inthndlr.c **** /* Dos Remove Directory */ 1005:inthndlr.c **** case 0x3a: 1006:inthndlr.c **** rc = DosMkRmdir(FP_DS_DX, lr.CL); 1007:inthndlr.c **** goto short_check; 1008:inthndlr.c **** 1009:inthndlr.c **** /* Dos rename file */ 1010:inthndlr.c **** case 0x56: 1011:inthndlr.c **** rc = DosRename(FP_DS_DX, FP_ES_DI); 1012:inthndlr.c **** goto short_check; 1013:inthndlr.c **** 1014:inthndlr.c **** /* fall through to goto error_invaid */ 1015:inthndlr.c **** } 1016:inthndlr.c **** } 1017:inthndlr.c **** 1018:inthndlr.c **** default: 1019:inthndlr.c **** goto error_invalid; 1020:inthndlr.c **** } 1021:inthndlr.c **** goto short_check; 1022:inthndlr.c **** 1023:inthndlr.c **** /* Device I/O Control */ 1024:inthndlr.c **** case 0x44: 1025:inthndlr.c **** rc = DosDevIOctl(&lr); /* can set critical error code! */ 1026:inthndlr.c **** 1027:inthndlr.c **** if (rc < SUCCESS) 1028:inthndlr.c **** { 1029:inthndlr.c **** lr.AX = -rc; 1030:inthndlr.c **** if (rc != DE_DEVICE && rc != DE_ACCESS) 1031:inthndlr.c **** CritErrCode = lr.AX; 1032:inthndlr.c **** goto error_carry; 1033:inthndlr.c **** } 1034:inthndlr.c **** break; 1035:inthndlr.c **** 1036:inthndlr.c **** /* Duplicate File Handle */ 1037:inthndlr.c **** case 0x45: 1038:inthndlr.c **** lrc = DosDup(lr.BX); 1039:inthndlr.c **** goto long_check; 1040:inthndlr.c **** 1041:inthndlr.c **** /* Force Duplicate File Handle */ 1042:inthndlr.c **** case 0x46: 1043:inthndlr.c **** rc = DosForceDup(lr.BX, lr.CX); 1044:inthndlr.c **** goto short_check; 1045:inthndlr.c **** 1046:inthndlr.c **** /* Get Current Directory */ 1047:inthndlr.c **** case 0x47: 1048:inthndlr.c **** rc = DosGetCuDir(lr.DL, MK_FP(lr.DS, lr.SI)); 1049:inthndlr.c **** lr.AX = 0x0100; /*jpp: from interrupt list */ 1050:inthndlr.c **** goto short_check; 1051:inthndlr.c **** 1052:inthndlr.c **** /* Allocate memory */ 1053:inthndlr.c **** case 0x48: 1054:inthndlr.c **** if ((rc = DosMemAlloc(lr.BX, mem_access_mode, &lr.AX, &lr.BX)) < 0) 1055:inthndlr.c **** { 1056:inthndlr.c **** DosMemLargest(&lr.BX); 1057:inthndlr.c **** if (DosMemCheck() != SUCCESS) 1058:inthndlr.c **** panic("MCB chain corrupted"); 1059:inthndlr.c **** goto error_exit; 1060:inthndlr.c **** } 1061:inthndlr.c **** lr.AX++; /* DosMemAlloc() returns seg of MCB rather than data */ 1062:inthndlr.c **** break; 1063:inthndlr.c **** 1064:inthndlr.c **** /* Free memory */ 1065:inthndlr.c **** case 0x49: 1066:inthndlr.c **** if ((rc = DosMemFree(lr.ES - 1)) < SUCCESS) 1067:inthndlr.c **** { 1068:inthndlr.c **** if (DosMemCheck() != SUCCESS) 1069:inthndlr.c **** panic("MCB chain corrupted"); 1070:inthndlr.c **** goto error_exit; 1071:inthndlr.c **** } 1072:inthndlr.c **** break; 1073:inthndlr.c **** 1074:inthndlr.c **** /* Set memory block size */ 1075:inthndlr.c **** case 0x4a: 1076:inthndlr.c **** if (DosMemCheck() != SUCCESS) 1077:inthndlr.c **** panic("before 4a: MCB chain corrupted"); 1078:inthndlr.c **** 1079:inthndlr.c **** if ((rc = DosMemChange(lr.ES, lr.BX, &lr.BX)) < 0) 1080:inthndlr.c **** { 1081:inthndlr.c **** #if 0 1082:inthndlr.c **** if (cu_psp == lr.ES) 1083:inthndlr.c **** { 1084:inthndlr.c **** psp->ps_size = lr.BX + cu_psp; 1085:inthndlr.c **** } 1086:inthndlr.c **** #endif 1087:inthndlr.c **** if (DosMemCheck() != SUCCESS) 1088:inthndlr.c **** panic("after 4a: MCB chain corrupted"); 1089:inthndlr.c **** goto error_exit; 1090:inthndlr.c **** } 1091:inthndlr.c **** lr.AX = lr.ES; /* Undocumented MS-DOS behaviour expected by BRUN45! */ 1092:inthndlr.c **** break; 1093:inthndlr.c **** 1094:inthndlr.c **** /* Load and Execute Program */ 1095:inthndlr.c **** case 0x4b: 1096:inthndlr.c **** break_flg = FALSE; 1097:inthndlr.c **** 1098:inthndlr.c **** rc = DosExec(lr.AL, MK_FP(lr.ES, lr.BX), FP_DS_DX); 1099:inthndlr.c **** goto short_check; 1100:inthndlr.c **** 1101:inthndlr.c **** /* Terminate Program */ 1102:inthndlr.c **** case 0x00: 1103:inthndlr.c **** lr.AX = 0x4c00; 1104:inthndlr.c **** 1105:inthndlr.c **** /* End Program */ 1106:inthndlr.c **** case 0x4c: 1107:inthndlr.c **** if (break_flg) { 1108:inthndlr.c **** break_flg = FALSE; 1109:inthndlr.c **** term_type = 1; 1110:inthndlr.c **** } 1111:inthndlr.c **** rc = term_type << 8; 1112:inthndlr.c **** return_code = lr.AL | rc; 1113:inthndlr.c **** if (DosMemCheck() != SUCCESS) 1114:inthndlr.c **** panic("MCB chain corrupted"); 1115:inthndlr.c **** #ifdef TSC 1116:inthndlr.c **** StartTrace(); 1117:inthndlr.c **** #endif 1118:inthndlr.c **** return_user(); 1119:inthndlr.c **** break; 1120:inthndlr.c **** 1121:inthndlr.c **** /* Get Child-program Return Value */ 1122:inthndlr.c **** case 0x4d: 1123:inthndlr.c **** lr.AX = return_code; 1124:inthndlr.c **** /* needs to be cleared (RBIL) */ 1125:inthndlr.c **** return_code = 0; 1126:inthndlr.c **** break; 1127:inthndlr.c **** 1128:inthndlr.c **** /* Dos Find First */ 1129:inthndlr.c **** case 0x4e: 1130:inthndlr.c **** /* dta for this call is set on entry. This */ 1131:inthndlr.c **** /* needs to be changed for new versions. */ 1132:inthndlr.c **** rc = DosFindFirst(lr.CX, FP_DS_DX); 1133:inthndlr.c **** lr.AX = 0; 1134:inthndlr.c **** goto short_check; 1135:inthndlr.c **** 1136:inthndlr.c **** /* Dos Find Next */ 1137:inthndlr.c **** case 0x4f: 1138:inthndlr.c **** /* dta for this call is set on entry. This */ 1139:inthndlr.c **** /* needs to be changed for new versions. */ 1140:inthndlr.c **** rc = DosFindNext(); 1141:inthndlr.c **** lr.AX = 0; 1142:inthndlr.c **** goto short_check; 1143:inthndlr.c **** /* 1144:inthndlr.c **** case 0x50: 1145:inthndlr.c **** case 0x51: 1146:inthndlr.c **** see int21_syscall 1147:inthndlr.c **** */ 1148:inthndlr.c **** /* ************UNDOCUMENTED************************************* */ 1149:inthndlr.c **** /* Get List of Lists */ 1150:inthndlr.c **** case 0x52: 1151:inthndlr.c **** lr.BX = FP_OFF(&DPBp); 1152:inthndlr.c **** lr.ES = FP_SEG(&DPBp); 1153:inthndlr.c **** break; 1154:inthndlr.c **** 1155:inthndlr.c **** case 0x53: 1156:inthndlr.c **** /* DOS 2+ internal - TRANSLATE BIOS PARAMETER BLOCK TO DRIVE PARAM BLOCK */ 1157:inthndlr.c **** bpb_to_dpb((bpb FAR *) MK_FP(lr.DS, lr.SI), 1158:inthndlr.c **** (struct dpb FAR *)MK_FP(lr.ES, r->BP) 1159:inthndlr.c **** #ifdef WITHFAT32 1160:inthndlr.c **** , (lr.CX == 0x4558 && lr.DX == 0x4152) 1161:inthndlr.c **** #endif 1162:inthndlr.c **** ); 1163:inthndlr.c **** break; 1164:inthndlr.c **** 1165:inthndlr.c **** /* Get verify state */ 1166:inthndlr.c **** case 0x54: 1167:inthndlr.c **** lr.AL = verify_ena; 1168:inthndlr.c **** break; 1169:inthndlr.c **** 1170:inthndlr.c **** /* ************UNDOCUMENTED************************************* */ 1171:inthndlr.c **** /* Dos Create New Psp & set p_size */ 1172:inthndlr.c **** case 0x55: 1173:inthndlr.c **** child_psp(lr.DX, cu_psp, lr.SI); 1174:inthndlr.c **** /* copy command line from the parent (required for some device loaders) */ 1175:inthndlr.c **** fmemcpy(MK_FP(lr.DX, 0x80), MK_FP(cu_psp, 0x80), 128); 1176:inthndlr.c **** cu_psp = lr.DX; 1177:inthndlr.c **** break; 1178:inthndlr.c **** 1179:inthndlr.c **** /* Dos Rename */ 1180:inthndlr.c **** case 0x56: 1181:inthndlr.c **** rc = DosRename(FP_DS_DX, FP_ES_DI); 1182:inthndlr.c **** goto short_check; 1183:inthndlr.c **** 1184:inthndlr.c **** /* Get/Set File Date and Time */ 1185:inthndlr.c **** case 0x57: 1186:inthndlr.c **** switch (lr.AL) 1187:inthndlr.c **** { 1188:inthndlr.c **** case 0x00: 1189:inthndlr.c **** rc = DosGetFtime((COUNT) lr.BX, /* Handle */ 1190:inthndlr.c **** &lr.DX, /* FileDate */ 1191:inthndlr.c **** &lr.CX); /* FileTime */ 1192:inthndlr.c **** break; 1193:inthndlr.c **** 1194:inthndlr.c **** case 0x01: 1195:inthndlr.c **** rc = DosSetFtime((COUNT) lr.BX, /* Handle */ 1196:inthndlr.c **** (ddate) lr.DX, /* FileDate */ 1197:inthndlr.c **** (dtime) lr.CX); /* FileTime */ 1198:inthndlr.c **** break; 1199:inthndlr.c **** 1200:inthndlr.c **** default: 1201:inthndlr.c **** goto error_invalid; 1202:inthndlr.c **** } 1203:inthndlr.c **** goto short_check; 1204:inthndlr.c **** 1205:inthndlr.c **** /* Get/Set Allocation Strategy */ 1206:inthndlr.c **** case 0x58: 1207:inthndlr.c **** switch (lr.AL) 1208:inthndlr.c **** { 1209:inthndlr.c **** case 0x00: 1210:inthndlr.c **** lr.AL = mem_access_mode; 1211:inthndlr.c **** lr.AH = 0; 1212:inthndlr.c **** break; 1213:inthndlr.c **** 1214:inthndlr.c **** case 0x01: 1215:inthndlr.c **** if (lr.BL > LAST_FIT_U || /* 0x82 */ 1216:inthndlr.c **** (lr.BL & FIT_MASK) > LAST_FIT) /* 0x3f, 0x02 */ 1217:inthndlr.c **** goto error_invalid; 1218:inthndlr.c **** mem_access_mode = lr.BL; 1219:inthndlr.c **** break; 1220:inthndlr.c **** 1221:inthndlr.c **** case 0x02: 1222:inthndlr.c **** lr.AL = uppermem_link; 1223:inthndlr.c **** break; 1224:inthndlr.c **** 1225:inthndlr.c **** case 0x03: 1226:inthndlr.c **** if (uppermem_root != 0xffff) /* always error if not exists */ 1227:inthndlr.c **** { 1228:inthndlr.c **** DosUmbLink(lr.BX); 1229:inthndlr.c **** break; 1230:inthndlr.c **** } 1231:inthndlr.c **** /* else fall through */ 1232:inthndlr.c **** 1233:inthndlr.c **** default: 1234:inthndlr.c **** goto error_invalid; 1235:inthndlr.c **** #ifdef DEBUG 1236:inthndlr.c **** case 0xff: 1237:inthndlr.c **** show_chain(); 1238:inthndlr.c **** break; 1239:inthndlr.c **** #endif 1240:inthndlr.c **** } 1241:inthndlr.c **** break; 1242:inthndlr.c **** 1243:inthndlr.c **** /* Get Extended Error */ 1244:inthndlr.c **** case 0x59: 1245:inthndlr.c **** lr.AX = CritErrCode; 1246:inthndlr.c **** lr.CH = CritErrLocus; 1247:inthndlr.c **** lr.BH = CritErrClass; 1248:inthndlr.c **** lr.BL = CritErrAction; 1249:inthndlr.c **** lr.DI = FP_OFF(CritErrDev); 1250:inthndlr.c **** lr.ES = FP_SEG(CritErrDev); 1251:inthndlr.c **** break; 1252:inthndlr.c **** 1253:inthndlr.c **** /* Create Temporary File */ 1254:inthndlr.c **** case 0x5a: 1255:inthndlr.c **** lrc = DosMkTmp(FP_DS_DX, lr.CX); 1256:inthndlr.c **** goto long_check; 1257:inthndlr.c **** 1258:inthndlr.c **** /* Create New File */ 1259:inthndlr.c **** case 0x5b: 1260:inthndlr.c **** lrc = DosOpen(FP_DS_DX, O_LEGACY | O_RDWR | O_CREAT, lr.CX); 1261:inthndlr.c **** goto long_check; 1262:inthndlr.c **** 1263:inthndlr.c **** /* /// Added for SHARE. - Ron Cemer */ 1264:inthndlr.c **** /* Lock/unlock file access */ 1265:inthndlr.c **** case 0x5c: 1266:inthndlr.c **** rc = DosLockUnlock 1267:inthndlr.c **** (lr.BX, ((unsigned long)lr.CX << 16) | lr.DX, 1268:inthndlr.c **** ((unsigned long)lr.SI << 16) | lr.DI, lr.AL != 0); 1269:inthndlr.c **** if (rc != SUCCESS) 1270:inthndlr.c **** goto error_exit; 1271:inthndlr.c **** break; 1272:inthndlr.c **** /* /// End of additions for SHARE. - Ron Cemer */ 1273:inthndlr.c **** 1274:inthndlr.c **** /* UNDOCUMENTED: server, share.exe and sda function */ 1275:inthndlr.c **** case 0x5d: 1276:inthndlr.c **** switch (lr.AL) 1277:inthndlr.c **** { 1278:inthndlr.c **** /* Remote Server Call */ 1279:inthndlr.c **** case 0x00: 1280:inthndlr.c **** fmemcpy(&lr, FP_DS_DX, sizeof(lr)); 1281:inthndlr.c **** goto dispatch; 1282:inthndlr.c **** 1283:inthndlr.c **** case 0x06: 1284:inthndlr.c **** lr.DS = FP_SEG(internal_data); 1285:inthndlr.c **** lr.SI = FP_OFF(internal_data); 1286:inthndlr.c **** lr.CX = swap_indos - internal_data; 1287:inthndlr.c **** lr.DX = swap_always - internal_data; 1288:inthndlr.c **** CLEAR_CARRY_FLAG(); 1289:inthndlr.c **** break; 1290:inthndlr.c **** 1291:inthndlr.c **** case 0x07: 1292:inthndlr.c **** case 0x08: 1293:inthndlr.c **** case 0x09: 1294:inthndlr.c **** rc = remote_printredir(lr.DX, Int21AX); 1295:inthndlr.c **** CLEAR_CARRY_FLAG(); 1296:inthndlr.c **** if (rc != SUCCESS) 1297:inthndlr.c **** goto error_exit; 1298:inthndlr.c **** break; 1299:inthndlr.c **** 1300:inthndlr.c **** /* Set Extended Error */ 1301:inthndlr.c **** case 0x0a: 1302:inthndlr.c **** { 1303:inthndlr.c **** lregs far *er = FP_DS_DX; 1304:inthndlr.c **** CritErrCode = er->AX; 1305:inthndlr.c **** CritErrDev = MK_FP(er->ES, er->DI); 1306:inthndlr.c **** CritErrLocus = er->CH; 1307:inthndlr.c **** CritErrClass = er->BH; 1308:inthndlr.c **** CritErrAction = er->BL; 1309:inthndlr.c **** CLEAR_CARRY_FLAG(); 1310:inthndlr.c **** break; 1311:inthndlr.c **** } 1312:inthndlr.c **** 1313:inthndlr.c **** default: 1314:inthndlr.c **** CritErrCode = SUCCESS; 1315:inthndlr.c **** goto error_invalid; 1316:inthndlr.c **** } 1317:inthndlr.c **** break; 1318:inthndlr.c **** 1319:inthndlr.c **** case 0x5e: 1320:inthndlr.c **** switch (lr.AL) 1321:inthndlr.c **** { 1322:inthndlr.c **** case 0x00: 1323:inthndlr.c **** lr.CX = get_machine_name(FP_DS_DX); 1324:inthndlr.c **** break; 1325:inthndlr.c **** 1326:inthndlr.c **** case 0x01: 1327:inthndlr.c **** set_machine_name(FP_DS_DX, lr.CX); 1328:inthndlr.c **** break; 1329:inthndlr.c **** 1330:inthndlr.c **** default: 1331:inthndlr.c **** rc = (int)network_redirector_mx(REM_PRINTSET, &lr, (void *)Int21AX); 1332:inthndlr.c **** goto short_check; 1333:inthndlr.c **** } 1334:inthndlr.c **** break; 1335:inthndlr.c **** 1336:inthndlr.c **** case 0x5f: 1337:inthndlr.c **** if (lr.AL == 7 || lr.AL == 8) 1338:inthndlr.c **** { 1339:inthndlr.c **** if (lr.DL < lastdrive) 1340:inthndlr.c **** { 1341:inthndlr.c **** struct cds FAR *cdsp = CDSp + lr.DL; 1342:inthndlr.c **** if (FP_OFF(cdsp->cdsDpb)) /* letter of physical drive? */ 1343:inthndlr.c **** { 1344:inthndlr.c **** cdsp->cdsFlags &= ~CDSPHYSDRV; 1345:inthndlr.c **** if (lr.AL == 7) 1346:inthndlr.c **** cdsp->cdsFlags |= CDSPHYSDRV; 1347:inthndlr.c **** break; 1348:inthndlr.c **** } 1349:inthndlr.c **** } 1350:inthndlr.c **** rc = DE_INVLDDRV; 1351:inthndlr.c **** goto error_exit; 1352:inthndlr.c **** } 1353:inthndlr.c **** else 1354:inthndlr.c **** { 1355:inthndlr.c **** rc = (int)network_redirector_mx(REM_DOREDIRECT, &lr, (void *)Int21AX); 1356:inthndlr.c **** /* the remote function manipulates *r directly !, 1357:inthndlr.c **** so we should not copy lr to r here */ 1358:inthndlr.c **** if (rc != SUCCESS) 1359:inthndlr.c **** { 1360:inthndlr.c **** CritErrCode = -rc; /* Maybe set */ 1361:inthndlr.c **** SET_CARRY_FLAG(); 1362:inthndlr.c **** } 1363:inthndlr.c **** r->AX = -rc; /* okay because we use real_exit */ 1364:inthndlr.c **** goto real_exit; 1365:inthndlr.c **** } 1366:inthndlr.c **** 1367:inthndlr.c **** case 0x60: /* TRUENAME */ 1368:inthndlr.c **** rc = DosTruename(MK_FP(lr.DS, lr.SI), adjust_far(FP_ES_DI)); 1369:inthndlr.c **** lr.AX = rc; 1370:inthndlr.c **** goto short_check; 1371:inthndlr.c **** 1372:inthndlr.c **** #ifdef TSC 1373:inthndlr.c **** /* UNDOCUMENTED: no-op */ 1374:inthndlr.c **** /* */ 1375:inthndlr.c **** /* DOS-C: tsc support */ 1376:inthndlr.c **** case 0x61: 1377:inthndlr.c **** #ifdef DEBUG 1378:inthndlr.c **** switch (lr.AL) 1379:inthndlr.c **** { 1380:inthndlr.c **** case 0x01: 1381:inthndlr.c **** bTraceNext = TRUE; 1382:inthndlr.c **** break; 1383:inthndlr.c **** 1384:inthndlr.c **** case 0x02: 1385:inthndlr.c **** bDumpRegs = FALSE; 1386:inthndlr.c **** break; 1387:inthndlr.c **** } 1388:inthndlr.c **** #endif 1389:inthndlr.c **** lr.AL = 0x00; 1390:inthndlr.c **** break; 1391:inthndlr.c **** #endif 1392:inthndlr.c **** 1393:inthndlr.c **** /* UNDOCUMENTED: return current psp 1394:inthndlr.c **** case 0x62: is in int21_syscall 1395:inthndlr.c **** lr.BX = cu_psp; 1396:inthndlr.c **** break; 1397:inthndlr.c **** */ 1398:inthndlr.c **** 1399:inthndlr.c **** /* UNDOCUMENTED: Double byte and korean tables */ 1400:inthndlr.c **** case 0x63: 1401:inthndlr.c **** { 1402:inthndlr.c **** VOID FAR *p; 1403:inthndlr.c **** #if 0 1404:inthndlr.c **** /* not really supported, but will pass. */ 1405:inthndlr.c **** lr.AL = 0x00; /*jpp: according to interrupt list */ 1406:inthndlr.c **** /*Bart: fails for PQDI and WATCOM utilities: 1407:inthndlr.c **** use the above again */ 1408:inthndlr.c **** #endif 1409:inthndlr.c **** switch (lr.AL) 1410:inthndlr.c **** { 1411:inthndlr.c **** case 0: 1412:inthndlr.c **** p = DosGetDBCS(); 1413:inthndlr.c **** lr.DS = FP_SEG(p); 1414:inthndlr.c **** lr.SI = FP_OFF(p) + 2; 1415:inthndlr.c **** break; 1416:inthndlr.c **** case 1: /* set Korean Hangul input method to DL 0/1 */ 1417:inthndlr.c **** lr.AL = 0xff; /* flag error (AL would be 0 if okay) */ 1418:inthndlr.c **** break; 1419:inthndlr.c **** case 2: /* get Korean Hangul input method setting to DL */ 1420:inthndlr.c **** lr.AL = 0xff; /* flag error, do not set DL */ 1421:inthndlr.c **** break; 1422:inthndlr.c **** default: /* is this the proper way to handle invalid AL? */ 1423:inthndlr.c **** rc = -1; 1424:inthndlr.c **** goto error_exit; 1425:inthndlr.c **** } 1426:inthndlr.c **** break; 1427:inthndlr.c **** } 1428:inthndlr.c **** /* 1429:inthndlr.c **** case 0x64: 1430:inthndlr.c **** see above (invalid) 1431:inthndlr.c **** */ 1432:inthndlr.c **** 1433:inthndlr.c **** /* Extended country info */ 1434:inthndlr.c **** case 0x65: 1435:inthndlr.c **** switch (lr.AL) 1436:inthndlr.c **** { 1437:inthndlr.c **** case 0x20: /* upcase single character */ 1438:inthndlr.c **** lr.DL = DosUpChar(lr.DL); 1439:inthndlr.c **** break; 1440:inthndlr.c **** case 0x21: /* upcase memory area */ 1441:inthndlr.c **** DosUpMem(FP_DS_DX, lr.CX); 1442:inthndlr.c **** break; 1443:inthndlr.c **** case 0x22: /* upcase ASCIZ */ 1444:inthndlr.c **** DosUpString(FP_DS_DX); 1445:inthndlr.c **** break; 1446:inthndlr.c **** case 0xA0: /* upcase single character of filenames */ 1447:inthndlr.c **** lr.DL = DosUpFChar(lr.DL); 1448:inthndlr.c **** break; 1449:inthndlr.c **** case 0xA1: /* upcase memory area of filenames */ 1450:inthndlr.c **** DosUpFMem(FP_DS_DX, lr.CX); 1451:inthndlr.c **** break; 1452:inthndlr.c **** case 0xA2: /* upcase ASCIZ of filenames */ 1453:inthndlr.c **** DosUpFString(FP_DS_DX); 1454:inthndlr.c **** break; 1455:inthndlr.c **** case 0x23: /* check Yes/No response */ 1456:inthndlr.c **** lr.AX = DosYesNo(lr.DL); 1457:inthndlr.c **** break; 1458:inthndlr.c **** default: 1459:inthndlr.c **** #ifdef NLS_DEBUG 1460:inthndlr.c **** if ((rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI)) < 0) 1461:inthndlr.c **** { 1462:inthndlr.c **** printf("DosGetData() := %d\n", rc); 1463:inthndlr.c **** goto error_exit; 1464:inthndlr.c **** } 1465:inthndlr.c **** printf("DosGetData() returned successfully\n"); 1466:inthndlr.c **** break; 1467:inthndlr.c **** #else 1468:inthndlr.c **** rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI); 1469:inthndlr.c **** goto short_check; 1470:inthndlr.c **** #endif 1471:inthndlr.c **** } 1472:inthndlr.c **** break; 1473:inthndlr.c **** 1474:inthndlr.c **** /* Code Page functions */ 1475:inthndlr.c **** case 0x66: 1476:inthndlr.c **** switch (lr.AL) 1477:inthndlr.c **** { 1478:inthndlr.c **** case 1: 1479:inthndlr.c **** rc = DosGetCodepage(&lr.BX, &lr.DX); 1480:inthndlr.c **** break; 1481:inthndlr.c **** case 2: 1482:inthndlr.c **** rc = DosSetCodepage(lr.BX, lr.DX); 1483:inthndlr.c **** break; 1484:inthndlr.c **** 1485:inthndlr.c **** default: 1486:inthndlr.c **** goto error_invalid; 1487:inthndlr.c **** } 1488:inthndlr.c **** if (rc != SUCCESS) 1489:inthndlr.c **** goto error_exit; 1490:inthndlr.c **** break; 1491:inthndlr.c **** 1492:inthndlr.c **** /* Set Max file handle count */ 1493:inthndlr.c **** case 0x67: 1494:inthndlr.c **** rc = SetJFTSize(lr.BX); 1495:inthndlr.c **** goto short_check; 1496:inthndlr.c **** 1497:inthndlr.c **** /* Flush file buffer -- COMMIT FILE. */ 1498:inthndlr.c **** case 0x68: 1499:inthndlr.c **** case 0x6a: 1500:inthndlr.c **** rc = DosCommit(lr.BX); 1501:inthndlr.c **** goto short_check; 1502:inthndlr.c **** 1503:inthndlr.c **** /* Get/Set Serial Number */ 1504:inthndlr.c **** case 0x69: 1505:inthndlr.c **** rc = (lr.BL == 0 ? default_drive : lr.BL - 1); 1506:inthndlr.c **** if (lr.AL < 2) 1507:inthndlr.c **** { 1508:inthndlr.c **** if (get_cds(rc) == NULL) 1509:inthndlr.c **** { 1510:inthndlr.c **** rc = DE_INVLDDRV; 1511:inthndlr.c **** goto error_exit; 1512:inthndlr.c **** } 1513:inthndlr.c **** if (get_dpb(rc) != NULL) 1514:inthndlr.c **** { 1515:inthndlr.c **** UWORD saveCX = lr.CX; 1516:inthndlr.c **** lr.CX = lr.AL == 0 ? 0x0866 : 0x0846; 1517:inthndlr.c **** lr.AL = 0x0d; 1518:inthndlr.c **** rc = DosDevIOctl(&lr); 1519:inthndlr.c **** lr.CX = saveCX; 1520:inthndlr.c **** goto short_check; 1521:inthndlr.c **** } 1522:inthndlr.c **** } 1523:inthndlr.c **** goto error_invalid; 1524:inthndlr.c **** /* 1525:inthndlr.c **** case 0x6a: see case 0x68 1526:inthndlr.c **** case 0x6b: dummy func: return AL=0 1527:inthndlr.c **** */ 1528:inthndlr.c **** /* Extended Open-Creat, not fully functional. (bits 4,5,6 of BH) */ 1529:inthndlr.c **** case 0x6c: 1530:inthndlr.c **** /* high nibble must be <= 1, low nibble must be <= 2 */ 1531:inthndlr.c **** if ((lr.DL & 0xef) > 0x2) 1532:inthndlr.c **** goto error_invalid; 1533:inthndlr.c **** lrc = DosOpen(MK_FP(lr.DS, lr.SI), 1534:inthndlr.c **** (lr.BX & 0x70ff) | ((lr.DL & 3) << 8) | 1535:inthndlr.c **** ((lr.DL & 0x10) << 6), lr.CL); 1536:inthndlr.c **** if (lrc >= SUCCESS) 1537:inthndlr.c **** /* action */ 1538:inthndlr.c **** lr.CX = (UWORD)(lrc >> 16); 1539:inthndlr.c **** goto long_check; 1540:inthndlr.c **** 1541:inthndlr.c **** /* case 0x6d and above not implemented : see default; return AL=0 */ 1542:inthndlr.c **** 1543:inthndlr.c **** #ifdef WITHFAT32 1544:inthndlr.c **** /* LFN API */ 1545:inthndlr.c **** case 0x71: 1546:inthndlr.c **** switch (lr.AL) 1547:inthndlr.c **** { 1548:inthndlr.c **** #ifdef WITHLFNAPI 1549:inthndlr.c **** /* Win95 LFN - reset drive */ 1550:inthndlr.c **** case 0x0d: 1551:inthndlr.c **** /* Win95 LFN - make directory */ 1552:inthndlr.c **** case 0x39: 1553:inthndlr.c **** /* Win95 LFN - remove directory */ 1554:inthndlr.c **** case 0x3a: 1555:inthndlr.c **** /* Win95 LFN - change directory */ 1556:inthndlr.c **** case 0x3b: 1557:inthndlr.c **** /* Win95 LFN - delete file */ 1558:inthndlr.c **** case 0x41: 1559:inthndlr.c **** /* Win95 LFN - extended get/set file attributes */ 1560:inthndlr.c **** case 0x43: 1561:inthndlr.c **** /* Win95 LFN - get current directory */ 1562:inthndlr.c **** case 0x47: 1563:inthndlr.c **** /* Win95 LFN - find first file */ 1564:inthndlr.c **** case 0x4e: 1565:inthndlr.c **** /* Win95 LFN - find next file */ 1566:inthndlr.c **** case 0xa2: /* internal - same as 0x4f */ 1567:inthndlr.c **** case 0x4f: { 1568:inthndlr.c **** goto unsupp; 1569:inthndlr.c **** } 1570:inthndlr.c **** /* Win95 LFN - rename file */ 1571:inthndlr.c **** case 0x56: 1572:inthndlr.c **** /* Win95 LFN - canonicalize file name/path */ 1573:inthndlr.c **** case 0x60: { 1574:inthndlr.c **** switch (lr.CL) 1575:inthndlr.c **** { 1576:inthndlr.c **** /* truename - canonicalize path, accepts short/long/or combination as input and may ret 1577:inthndlr.c **** case 0x00: { 1578:inthndlr.c **** } 1579:inthndlr.c **** /* get canonical short (8.3) name or path, truename that accepts long name and returns 1580:inthndlr.c **** case 0x01: { 1581:inthndlr.c **** } 1582:inthndlr.c **** /* get canonical long name or path, truename that accepts short name and returns long n 1583:inthndlr.c **** case 0x02: { 1584:inthndlr.c **** } 1585:inthndlr.c **** default: 1586:inthndlr.c **** goto unsupp; 1587:inthndlr.c **** } 1588:inthndlr.c **** } 1589:inthndlr.c **** /* Win95 LFN - create or open file */ 1590:inthndlr.c **** case 0xa9: /* for real-mode servers only, AX is _global_ file handle on return */ 1591:inthndlr.c **** case 0x6c: { 1592:inthndlr.c **** goto unsupp; 1593:inthndlr.c **** } 1594:inthndlr.c **** /* Win95 LFN - get volume information */ 1595:inthndlr.c **** case 0xa0: 1596:inthndlr.c **** /* Win95 LFN - find file close */ 1597:inthndlr.c **** case 0xa1: { 1598:inthndlr.c **** lfn_findclose: 1599:inthndlr.c **** goto unsupp; 1600:inthndlr.c **** } 1601:inthndlr.c **** #if 0 1602:inthndlr.c **** /* Win95 LFN - internal use ??? */ 1603:inthndlr.c **** case 0xa3: 1604:inthndlr.c **** case 0xa4: 1605:inthndlr.c **** case 0xa5: 1606:inthndlr.c **** goto unsupp; 1607:inthndlr.c **** #endif 1608:inthndlr.c **** #endif 1609:inthndlr.c **** /* EDR-DOS LFN - Long LSEEK - SET CURRENT 64-bit FILE POSITION */ 1610:inthndlr.c **** case 0x42: 1611:inthndlr.c **** /* Win95 LFN - get file info by handle */ 1612:inthndlr.c **** case 0xa6: { 1613:inthndlr.c **** /* only passed to redirector supported for now */ 1614:inthndlr.c **** iregs saved_r; 1615:inthndlr.c **** sft FAR *s; 1616:inthndlr.c **** unsigned char idx; 1617:inthndlr.c **** 1618:inthndlr.c **** if (lr.BX >= psp->ps_maxfiles) 1619:inthndlr.c **** { 1620:inthndlr.c **** rc = DE_INVLDHNDL; 1621:inthndlr.c **** goto error_exit; 1622:inthndlr.c **** } 1623:inthndlr.c **** idx = psp->ps_filetab[lr.BX]; 1624:inthndlr.c **** s = idx_to_sft(idx); 1625:inthndlr.c **** if (s == (sft FAR *)-1) 1626:inthndlr.c **** { 1627:inthndlr.c **** rc = DE_INVLDHNDL; 1628:inthndlr.c **** goto error_exit; 1629:inthndlr.c **** } 1630:inthndlr.c **** if (!(s->sft_flags & SFT_FSHARED)) { 1631:inthndlr.c **** if (lr.AL != 0x42) { 1632:inthndlr.c **** goto unsupp; /* unsupported on local fs yet */ 1633:inthndlr.c **** } 1634:inthndlr.c **** } 1635:inthndlr.c **** /* call to redirector */ 1636:inthndlr.c **** fmemcpy(&saved_r, r, sizeof(saved_r)); 1637:inthndlr.c **** r->ES = FP_SEG(s); 1638:inthndlr.c **** r->DI = FP_OFF(s); 1639:inthndlr.c **** r->flags |= FLG_CARRY; 1640:inthndlr.c **** r->AH = 0x11; 1641:inthndlr.c **** call_intr(0x2f, r); 1642:inthndlr.c **** if (!(r->flags & FLG_CARRY)) { 1643:inthndlr.c **** r->ES = saved_r.ES; 1644:inthndlr.c **** r->DI = saved_r.DI; 1645:inthndlr.c **** goto real_exit; 1646:inthndlr.c **** } 1647:inthndlr.c **** /* carry still set - unhandled */ 1648:inthndlr.c **** fmemcpy(r, &saved_r, sizeof(saved_r)); 1649:inthndlr.c **** goto unsupp; 1650:inthndlr.c **** } 1651:inthndlr.c **** #ifdef WITHLFNAPI 1652:inthndlr.c **** /* Win95 LFN - Win95 64 UTC file time to/from DOS date and time (local timezone) */ 1653:inthndlr.c **** case 0xa7: { 1654:inthndlr.c **** /* Note: valid input range limited to Jan 1, 1980 to Dec 31, 2107 */ 1655:inthndlr.c **** switch (lr.BL) 1656:inthndlr.c **** { 1657:inthndlr.c **** /* from Win95 UTC to DOS date/time */ 1658:inthndlr.c **** case 0x00: { 1659:inthndlr.c **** } 1660:inthndlr.c **** /* from DOS date/time to Win95 UTC */ 1661:inthndlr.c **** case 0x01: { 1662:inthndlr.c **** } 1663:inthndlr.c **** default: 1664:inthndlr.c **** goto unsupp; 1665:inthndlr.c **** } 1666:inthndlr.c **** } 1667:inthndlr.c **** /* Win95 LFN - generate short filename */ 1668:inthndlr.c **** case 0xa8: 1669:inthndlr.c **** /* Win95 LFN - subst */ 1670:inthndlr.c **** case 0xaa: { 1671:inthndlr.c **** goto unsupp; 1672:inthndlr.c **** } 1673:inthndlr.c **** #endif 1674:inthndlr.c **** default: 1675:inthndlr.c **** goto unsupp; 1676:inthndlr.c **** } 1677:inthndlr.c **** #ifdef WITHLFNAPI 1678:inthndlr.c **** /* Win95 beta LFN - find close */ 1679:inthndlr.c **** case 0x72: goto lfn_findclose; 1680:inthndlr.c **** #endif 1681:inthndlr.c **** 1682:inthndlr.c **** /* DOS 7.0+ FAT32 extended functions */ 1683:inthndlr.c **** case 0x73: 1684:inthndlr.c **** CLEAR_CARRY_FLAG(); 1685:inthndlr.c **** CritErrCode = SUCCESS; 1686:inthndlr.c **** rc = int21_fat32(&lr); 1687:inthndlr.c **** goto short_check; 1688:inthndlr.c **** #endif 1689:inthndlr.c **** 1690:inthndlr.c **** #ifdef WITHLFNAPI 1691:inthndlr.c **** /* FreeDOS LFN helper API functions */ 1692:inthndlr.c **** case 0x74: 1693:inthndlr.c **** { 1694:inthndlr.c **** switch (lr.AL) 1695:inthndlr.c **** { 1696:inthndlr.c **** /* Allocate LFN inode */ 1697:inthndlr.c **** case 0x01: 1698:inthndlr.c **** rc = lfn_allocate_inode(); 1699:inthndlr.c **** break; 1700:inthndlr.c **** /* Free LFN inode */ 1701:inthndlr.c **** case 0x02: 1702:inthndlr.c **** rc = lfn_free_inode(lr.BX); 1703:inthndlr.c **** break; 1704:inthndlr.c **** /* Setup LFN inode */ 1705:inthndlr.c **** case 0x03: 1706:inthndlr.c **** rc = lfn_setup_inode(lr.BX, MK_ULONG(lr.CX, lr.DX), MK_ULONG(lr.SI,lr.DI)); 1707:inthndlr.c **** break; 1708:inthndlr.c **** /* Create LFN entries */ 1709:inthndlr.c **** case 0x04: 1710:inthndlr.c **** rc = lfn_create_entries(lr.BX, (lfn_inode_ptr)FP_DS_DX); 1711:inthndlr.c **** break; 1712:inthndlr.c **** /* Read next LFN */ 1713:inthndlr.c **** case 0x05: 1714:inthndlr.c **** rc = lfn_dir_read(lr.BX, (lfn_inode_ptr)FP_DS_DX); 1715:inthndlr.c **** break; 1716:inthndlr.c **** /* Write SFN pointed by LFN inode */ 1717:inthndlr.c **** case 0x06: 1718:inthndlr.c **** rc = lfn_dir_write(lr.BX); 1719:inthndlr.c **** break; 1720:inthndlr.c **** default: 1721:inthndlr.c **** goto error_invalid; 1722:inthndlr.c **** } 1723:inthndlr.c **** lr.AX = rc; 1724:inthndlr.c **** CLEAR_CARRY_FLAG(); 1725:inthndlr.c **** goto short_check; 1726:inthndlr.c **** } 1727:inthndlr.c **** #endif 1728:inthndlr.c **** } 1729:inthndlr.c **** goto exit_dispatch; 1730:inthndlr.c **** #ifdef WITHFAT32 1731:inthndlr.c **** unsupp: 1732:inthndlr.c **** { 1733:inthndlr.c **** lr.AL = 00; 1734:inthndlr.c **** goto error_carry; 1735:inthndlr.c **** } 1736:inthndlr.c **** #endif 1737:inthndlr.c **** long_check: 1738:inthndlr.c **** if (lrc >= SUCCESS) 1739:inthndlr.c **** { 1740:inthndlr.c **** lr.AX = (UWORD)lrc; 1741:inthndlr.c **** goto exit_dispatch; 1742:inthndlr.c **** } 1743:inthndlr.c **** rc = (int)lrc; 1744:inthndlr.c **** short_check: 1745:inthndlr.c **** if (rc < SUCCESS) 1746:inthndlr.c **** goto error_exit; 1747:inthndlr.c **** goto exit_dispatch; 1748:inthndlr.c **** error_invalid: 1749:inthndlr.c **** rc = DE_INVLDFUNC; 1750:inthndlr.c **** error_exit: 1751:inthndlr.c **** lr.AX = -rc; 1752:inthndlr.c **** if (CritErrCode == SUCCESS) 1753:inthndlr.c **** CritErrCode = lr.AX; /* Maybe set */ 1754:inthndlr.c **** error_carry: 1755:inthndlr.c **** SET_CARRY_FLAG(); 1756:inthndlr.c **** exit_dispatch: 1757:inthndlr.c **** fmemcpy(r, &lr, sizeof(lregs) - 4); /* copy lr -> r but exclude flags */ 1034 .loc 1 1757 0 0 000081D4 FF76CC push word ptr [bp-52] 0 000081D7 FF76D2 push word ptr [bp-46] 0 000081DA 8D46D8 lea ax, [-40+bp] 0 000081DD 50 push ax 0 000081DE FF76D6 push word ptr [bp-42] 0 000081E1 57 push di 0 000081E2 E8[FEFF] call _fmemcpy 1042 _.LVL70: 1758:inthndlr.c **** r->DS = lr.DS; 1043 .loc 1 1758 0 0 000081E5 8B46E4 mov ax, word ptr [bp-28] 0 000081E8 8E46D6 mov es, word ptr [bp-42] 0 000081EB 2689450E mov word ptr es:[di+14], ax 1759:inthndlr.c **** r->ES = lr.ES; 1047 .loc 1 1759 0 0 000081EF 8B46E6 mov ax, word ptr [bp-26] 0 000081F2 8E46D6 mov es, word ptr [bp-42] 0 000081F5 26894510 mov word ptr es:[di+16], ax 1051 _.L276: 1760:inthndlr.c **** real_exit:; 1761:inthndlr.c **** 1762:inthndlr.c **** #ifdef DEBUG 1763:inthndlr.c **** if (bDumpRegs) 1764:inthndlr.c **** { 1765:inthndlr.c **** fmemcpy(&error_regs, user_r, sizeof(iregs)); 1766:inthndlr.c **** dump_regs = TRUE; 1767:inthndlr.c **** dump(); 1768:inthndlr.c **** } 1769:inthndlr.c **** #endif 1770:inthndlr.c **** } 1052 .loc 1 1770 0 0 000081F9 E98B09 jmp _.L97 1054 _.L108: 502:inthndlr.c **** write_char_stdout(lr.AL); 1055 .loc 1 502 0 0 000081FC 8A46DE mov al, byte ptr [bp-34] 0 000081FF EBCA jmp _.L369 1058 _.L109: 1059 _.LBB17: 509:inthndlr.c **** lr.AL = read_char(sft_idx, sft_idx, TRUE); 1060 .loc 1 509 0 0 00008201 B80300 mov ax, 3 0 00008204 50 push ax 0 00008205 E8[FEFF] call _get_sft_idx 1064 _.LVL71: 510:inthndlr.c **** break; 1065 .loc 1 510 0 0 00008208 BA0100 mov dx, 1 0 0000820B 52 push dx 0 0000820C 50 push ax 0 0000820D 50 push ax 0 0000820E E8[FEFF] call _read_char 1071 _.LVL72: 1072 _.L371: 1073 _.LBE17: 1222:inthndlr.c **** break; 1074 .loc 1 1222 0 0 00008211 8846D8 mov byte ptr [bp-40], al 1223:inthndlr.c **** 1076 .loc 1 1223 0 0 00008214 EBBE jmp _.L202 1078 _.L110: 516:inthndlr.c **** break; 1079 .loc 1 516 0 0 00008216 B80300 mov ax, 3 1081 _.L372: 520:inthndlr.c **** break; 1082 .loc 1 520 0 0 00008219 50 push ax 0 0000821A E8[FEFF] call _get_sft_idx 1085 _.LVL73: 0 0000821D 50 push ax 0 0000821E 8A46DE mov al, byte ptr [bp-34] 0 00008221 30E4 xor ah, ah 0 00008223 50 push ax 0 00008224 E8[FEFF] call _write_char 1091 _.LVL74: 521:inthndlr.c **** 1092 .loc 1 521 0 0 00008227 EBAB jmp _.L202 1094 _.L111: 520:inthndlr.c **** break; 1095 .loc 1 520 0 0 00008229 B80400 mov ax, 4 0 0000822C EBEB jmp _.L372 1098 _.L112: 526:inthndlr.c **** goto DOS_02; 1099 .loc 1 526 0 0 0000822E 807EDEFF cmp byte ptr [bp-34], -1 0 00008232 75C8 jne _.L108 529:inthndlr.c **** r->FLAGS |= FLG_ZERO; 1102 .loc 1 529 0 0 00008234 C646D800 mov byte ptr [bp-40], 0 530:inthndlr.c **** if (StdinBusy()) { 1104 .loc 1 530 0 0 00008238 8E46D6 mov es, word ptr [bp-42] 0 0000823B 26804D1640 or byte ptr es:[di+22], 64 531:inthndlr.c **** DosIdle_int(); 1107 .loc 1 531 0 0 00008240 E8[FEFF] call _StdinBusy 1109 _.LVL75: 0 00008243 85C0 test ax, ax 0 00008245 7405 je _.L203 532:inthndlr.c **** break; 1112 .loc 1 532 0 0 00008247 E8[FEFF] call _DosIdle_int 1114 _.LVL76: 533:inthndlr.c **** } 1115 .loc 1 533 0 0 0000824A EB88 jmp _.L202 1117 _.L203: 536:inthndlr.c **** /* fall through */ 1118 .loc 1 536 0 0 0000824C 8E46D6 mov es, word ptr [bp-42] 0 0000824F 26806516BF and byte ptr es:[di+22], -65 1121 _.L113: 542:inthndlr.c **** break; 1122 .loc 1 542 0 0 00008254 56 push si 1124 _.L385: 548:inthndlr.c **** break; 1125 .loc 1 548 0 0 00008255 E8[FEFF] call _read_char_stdin 1127 _.LVL77: 0 00008258 EBB7 jmp _.L371 1129 _.L114: 0 0000825A B80100 mov ax, 1 0 0000825D 50 push ax 0 0000825E EBF5 jmp _.L385 1133 _.L115: 1134 _.LBB18: 555:inthndlr.c **** 1135 .loc 1 555 0 0 00008260 8B46E4 mov ax, word ptr [bp-28] 0 00008263 8946D4 mov word ptr [bp-44], ax 0 00008266 8B5EDE mov bx, word ptr [bp-34] 1139 _.LVL78: 1140 _.L204: 557:inthndlr.c **** write_char_stdout(c); 1141 .loc 1 557 0 0 00008269 8D7701 lea si, [1+bx] 1143 _.LVL79: 0 0000826C 8E46D4 mov es, word ptr [bp-44] 0 0000826F 268A07 mov al, byte ptr es:[bx] 1146 _.LVL80: 0 00008272 3C24 cmp al, 36 0 00008274 749B je _.L371 558:inthndlr.c **** 1149 .loc 1 558 0 0 00008276 30E4 xor ah, ah 1151 _.LVL81: 0 00008278 50 push ax 1153 _.LVL82: 0 00008279 E8[FEFF] call _write_char_stdout 1155 _.LVL83: 557:inthndlr.c **** write_char_stdout(c); 1156 .loc 1 557 0 0 0000827C 89F3 mov bx, si 0 0000827E EBE9 jmp _.L204 1159 _.LVL84: 1160 _.L116: 1161 _.LBE18: 567:inthndlr.c **** break; 1162 .loc 1 567 0 0 00008280 8B46E4 mov ax, word ptr [bp-28] 0 00008283 8946D0 mov word ptr [bp-48], ax 0 00008286 8B46DE mov ax, word ptr [bp-34] 0 00008289 8946CE mov word ptr [bp-50], ax 0 0000828C B80100 mov ax, 1 0 0000828F 50 push ax 0 00008290 E8[FEFF] call _get_sft_idx 1170 _.LVL85: 0 00008293 8946D4 mov word ptr [bp-44], ax 0 00008296 56 push si 0 00008297 E8[FEFF] call _get_sft_idx 1174 _.LVL86: 0 0000829A FF76D0 push word ptr [bp-48] 0 0000829D FF76CE push word ptr [bp-50] 0 000082A0 FF76D4 push word ptr [bp-44] 0 000082A3 50 push ax 0 000082A4 E8[FEFF] call _read_line 1180 _.LVL87: 568:inthndlr.c **** 1181 .loc 1 568 0 0 000082A7 E92AFF jmp _.L202 1183 _.L117: 572:inthndlr.c **** if (StdinBusy()) 1184 .loc 1 572 0 0 000082AA C646D8FF mov byte ptr [bp-40], -1 573:inthndlr.c **** lr.AL = 0x00; 1186 .loc 1 573 0 0 000082AE E8[FEFF] call _StdinBusy 1188 _.LVL88: 0 000082B1 85C0 test ax, ax 0 000082B3 7503E91CFF je _.L202 1191 _.L374: 885:inthndlr.c **** break; 1192 .loc 1 885 0 0 000082B8 C646D800 mov byte ptr [bp-40], 0 886:inthndlr.c **** 1194 .loc 1 886 0 0 000082BC E915FF jmp _.L202 1196 _.L118: 1197 _.LBB19: 580:inthndlr.c **** if (dev) 1198 .loc 1 580 0 0 000082BF 56 push si 0 000082C0 E8[FEFF] call _get_sft 1201 _.LVL89: 0 000082C3 52 push dx 0 000082C4 50 push ax 0 000082C5 E8[FEFF] call _sft_to_dev 1205 _.LVL90: 0 000082C8 8946E8 mov word ptr [bp-24], ax 0 000082CB 8956EA mov word ptr [bp-22], dx 581:inthndlr.c **** con_flush(&dev); 1208 .loc 1 581 0 0 000082CE 09D0 or ax, dx 0 000082D0 7407 je _.L207 582:inthndlr.c **** switch (lr.AL) 1211 .loc 1 582 0 0 000082D2 8D46E8 lea ax, [-24+bp] 0 000082D5 50 push ax 0 000082D6 E8[FEFF] call _con_flush 1215 _.LVL91: 1216 _.L207: 583:inthndlr.c **** { 1217 .loc 1 583 0 0 000082D9 8A46D8 mov al, byte ptr [bp-40] 0 000082DC FEC8 dec al 0 000082DE 3C09 cmp al, 9 0 000082E0 77D6 ja _.L374 0 000082E2 30E4 xor ah, ah 0 000082E4 D1E0 shl ax, 1 0 000082E6 89C3 mov bx, ax 0 000082E8 FFA7[F400] jmp word ptr [bx+_.L211] === Switch to base=012BB0h -> ".RODATA" 1226 .section .rodata 1227 .p2align 1 1228 .p2align 2 1229 _.L211: 0 00001774 [1B06] .hword _.L107 0 00001776 [0F07] .hword _.L374 0 00001778 [0F07] .hword _.L374 0 0000177A [0F07] .hword _.L374 0 0000177C [0F07] .hword _.L374 0 0000177E [8506] .hword _.L112 0 00001780 [AB06] .hword _.L113 0 00001782 [B106] .hword _.L114 0 00001784 [0F07] .hword _.L374 0 00001786 [D706] .hword _.L116 === Switch to base=002270h -> ".TEXT" 1240 .text 1241 _.L119: 1242 _.LBE19: 597:inthndlr.c **** break; 1243 .loc 1 597 0 0 000082EC E8[FEFF] call _flush 1245 _.LVL92: 598:inthndlr.c **** 1246 .loc 1 598 0 0 000082EF E9E2FE jmp _.L202 1248 _.L120: 602:inthndlr.c **** break; 1249 .loc 1 602 0 0 000082F2 FF76DE push word ptr [bp-34] 0 000082F5 E8[FEFF] call _DosSelectDrv 1252 _.LVL93: 0 000082F8 E916FF jmp _.L371 1254 _.L121: 606:inthndlr.c **** break; 1255 .loc 1 606 0 0 000082FB B80289 mov ax, -30462 1257 _.L379: 636:inthndlr.c **** break; 1258 .loc 1 636 0 0 000082FE 50 push ax 0 000082FF FF76E4 push word ptr [bp-28] 0 00008302 FF76DE push word ptr [bp-34] 0 00008305 E8[FEFF] call _FcbOpen 1263 _.LVL94: 0 00008308 E906FF jmp _.L371 1265 _.L122: 610:inthndlr.c **** break; 1266 .loc 1 610 0 0 0000830B FF76E4 push word ptr [bp-28] 0 0000830E FF76DE push word ptr [bp-34] 0 00008311 E8[FEFF] call _FcbClose 1270 _.LVL95: 0 00008314 E9FAFE jmp _.L371 1272 _.L123: 614:inthndlr.c **** break; 1273 .loc 1 614 0 0 00008317 B80100 mov ax, 1 0 0000831A 50 push ax 1276 _.L380: 618:inthndlr.c **** break; 1277 .loc 1 618 0 0 0000831B FF76E4 push word ptr [bp-28] 0 0000831E FF76DE push word ptr [bp-34] 0 00008321 E8[FEFF] call _FcbFindFirstNext 1281 _.LVL96: 0 00008324 E9EAFE jmp _.L371 1283 _.L124: 0 00008327 56 push si 0 00008328 EBF1 jmp _.L380 1286 _.L125: 622:inthndlr.c **** break; 1287 .loc 1 622 0 0 0000832A FF76E4 push word ptr [bp-28] 0 0000832D FF76DE push word ptr [bp-34] 0 00008330 E8[FEFF] call _FcbDelete 1291 _.LVL97: 0 00008333 E9DBFE jmp _.L371 1293 _.L126: 627:inthndlr.c **** break; 1294 .loc 1 627 0 0 00008336 B80100 mov ax, 1 0 00008339 50 push ax 1297 _.L382: 632:inthndlr.c **** break; 1298 .loc 1 632 0 0 0000833A 50 push ax 0 0000833B FF76E4 push word ptr [bp-28] 0 0000833E FF76DE push word ptr [bp-34] 0 00008341 E8[FEFF] call _FcbReadWrite 1303 _.LVL98: 0 00008344 E9CAFE jmp _.L371 1305 _.L127: 0 00008347 B80200 mov ax, 2 0 0000834A 50 push ax 0 0000834B B80100 mov ax, 1 0 0000834E EBEA jmp _.L382 1310 _.L128: 636:inthndlr.c **** break; 1311 .loc 1 636 0 0 00008350 B8028E mov ax, -29182 0 00008353 EBA9 jmp _.L379 1314 _.L129: 640:inthndlr.c **** break; 1315 .loc 1 640 0 0 00008355 FF76E4 push word ptr [bp-28] 0 00008358 FF76DE push word ptr [bp-34] 0 0000835B E8[FEFF] call _FcbRename 1319 _.LVL99: 0 0000835E E9B0FE jmp _.L371 1321 _.L130: 663:inthndlr.c **** break; 1322 .loc 1 663 0 0 00008361 A0[0000] mov al, byte ptr [_default_drive] 0 00008364 E9AAFE jmp _.L371 1325 _.L131: 668:inthndlr.c **** break; 1326 .loc 1 668 0 0 00008367 8B46DE mov ax, word ptr [bp-34] 0 0000836A A3[0000] mov word ptr [_dta], ax 0 0000836D 8B46E4 mov ax, word ptr [bp-28] 0 00008370 A3[0200] mov word ptr [_dta+2], ax 669:inthndlr.c **** 1331 .loc 1 669 0 0 00008373 E95EFE jmp _.L202 1333 _.L132: 673:inthndlr.c **** /* fall through */ 1334 .loc 1 673 0 0 00008376 C646DE00 mov byte ptr [bp-34], 0 1336 _.L133: 1337 _.LBB20: 681:inthndlr.c **** { 1338 .loc 1 681 0 0 0000837A 8D46D8 lea ax, [-40+bp] 0 0000837D 8D56DE lea dx, [-34+bp] 0 00008380 52 push dx 0 00008381 8D56DC lea dx, [-36+bp] 0 00008384 52 push dx 0 00008385 50 push ax 0 00008386 FF76DE push word ptr [bp-34] 0 00008389 E8[FEFF] call _FatGetDrvData 1347 _.LVL100: 0 0000838C 89C1 mov cx, ax 0 0000838E 09D1 or cx, dx 0 00008390 85C9 test cx, cx 0 00008392 7503E9A501 je _.L280 683:inthndlr.c **** lr.BX = FP_OFF(p); 1352 .loc 1 683 0 0 00008397 8956E4 mov word ptr [bp-28], dx 684:inthndlr.c **** } 1354 .loc 1 684 0 0 0000839A 8946DA mov word ptr [bp-38], ax 0 0000839D E934FE jmp _.L202 1357 _.LVL101: 1358 _.L135: 1359 _.LBE20: 697:inthndlr.c **** break; 1360 .loc 1 697 0 0 000083A0 B80100 mov ax, 1 1362 _.L383: 702:inthndlr.c **** break; 1363 .loc 1 702 0 0 000083A3 50 push ax 0 000083A4 FF76E4 push word ptr [bp-28] 0 000083A7 FF76DE push word ptr [bp-34] 0 000083AA E8[FEFF] call _FcbRandomIO 1368 _.LVL102: 0 000083AD E961FE jmp _.L371 1370 _.L136: 0 000083B0 B80200 mov ax, 2 0 000083B3 EBEE jmp _.L383 1373 _.L137: 707:inthndlr.c **** break; 1374 .loc 1 707 0 0 000083B5 FF76E4 push word ptr [bp-28] 0 000083B8 FF76DE push word ptr [bp-34] 0 000083BB E8[FEFF] call _FcbGetFileSize 1378 _.LVL103: 0 000083BE E950FE jmp _.L371 1380 _.L138: 712:inthndlr.c **** break; 1381 .loc 1 712 0 0 000083C1 FF76E4 push word ptr [bp-28] 0 000083C4 FF76DE push word ptr [bp-34] 0 000083C7 E8[FEFF] call _FcbSetRandom 1385 _.LVL104: 713:inthndlr.c **** 1386 .loc 1 713 0 0 000083CA E907FE jmp _.L202 1388 _.L139: 720:inthndlr.c **** break; 1389 .loc 1 720 0 0 000083CD 8E46D6 mov es, word ptr [bp-42] 0 000083D0 26FF7514 push word ptr es:[di+20] 0 000083D4 FF76DE push word ptr [bp-34] 0 000083D7 E8[FEFF] call _new_psp 1394 _.LVL105: 721:inthndlr.c **** 1395 .loc 1 721 0 0 000083DA E9F7FD jmp _.L202 1397 _.L140: 725:inthndlr.c **** break; 1398 .loc 1 725 0 0 000083DD B80500 mov ax, 5 1400 _.L384: 730:inthndlr.c **** break; 1401 .loc 1 730 0 0 000083E0 50 push ax 0 000083E1 8D46DC lea ax, [-36+bp] 0 000083E4 50 push ax 0 000083E5 FF76E4 push word ptr [bp-28] 0 000083E8 FF76DE push word ptr [bp-34] 0 000083EB E8[FEFF] call _FcbRandomBlockIO 1408 _.LVL106: 0 000083EE E920FE jmp _.L371 1410 _.L141: 0 000083F1 B80600 mov ax, 6 0 000083F4 EBEA jmp _.L384 1413 _.L142: 735:inthndlr.c **** break; 1414 .loc 1 735 0 0 000083F6 FF76E6 push word ptr [bp-26] 0 000083F9 FF76E2 push word ptr [bp-30] 0 000083FC FF76E4 push word ptr [bp-28] 0 000083FF FF76E0 push word ptr [bp-32] 0 00008402 8D46D8 lea ax, [-40+bp] 0 00008405 50 push ax 0 00008406 E8[FEFF] call _FcbParseFname 1422 _.LVL107: 1423 _.L376: 1424 _.LBB21: 1414:inthndlr.c **** break; 1425 .loc 1 1414 0 0 00008409 8946E0 mov word ptr [bp-32], ax 1415:inthndlr.c **** case 1: /* set Korean Hangul input method to DL 0/1 */ 1427 .loc 1 1415 0 0 0000840C E9C5FD jmp _.L202 1429 _.L143: 1430 _.LBE21: 740:inthndlr.c **** break; 1431 .loc 1 740 0 0 0000840F 8D46DC lea ax, [-36+bp] 0 00008412 50 push ax 0 00008413 E8[FEFF] call _DosGetDate 1435 _.LVL108: 0 00008416 E9F8FD jmp _.L371 1437 _.L144: 745:inthndlr.c **** break; 1438 .loc 1 745 0 0 00008419 8D46DC lea ax, [-36+bp] 0 0000841C 50 push ax 0 0000841D E8[FEFF] call _DosSetDate 1442 _.LVL109: 1443 _.L381: 755:inthndlr.c **** break; 1444 .loc 1 755 0 0 00008420 83F801 cmp ax, 1 0 00008423 F5 cmc 0 00008424 18C0 sbb al, al 0 00008426 E9E8FD jmp _.L371 1449 _.L145: 750:inthndlr.c **** break; 1450 .loc 1 750 0 0 00008429 8D46DC lea ax, [-36+bp] 0 0000842C 50 push ax 0 0000842D E8[FEFF] call _DosGetTime 1454 _.LVL110: 751:inthndlr.c **** 1455 .loc 1 751 0 0 00008430 E9A1FD jmp _.L202 1457 _.L146: 755:inthndlr.c **** break; 1458 .loc 1 755 0 0 00008433 8D46DC lea ax, [-36+bp] 0 00008436 50 push ax 0 00008437 E8[FEFF] call _DosSetTime 1462 _.LVL111: 0 0000843A EBE4 jmp _.L381 1464 _.L147: 760:inthndlr.c **** break; 1465 .loc 1 760 0 0 0000843C 8A46D8 mov al, byte ptr [bp-40] 0 0000843F 2401 and al, 1 0 00008441 A2[0000] mov byte ptr [_verify_ena], al 761:inthndlr.c **** 1469 .loc 1 761 0 0 00008444 E98DFD jmp _.L202 1471 _.L148: 765:inthndlr.c **** lr.ES = FP_SEG(dta); 1472 .loc 1 765 0 0 00008447 A1[0000] mov ax, word ptr [_dta] 0 0000844A 8946DA mov word ptr [bp-38], ax 766:inthndlr.c **** break; 1475 .loc 1 766 0 0 0000844D A1[0200] mov ax, word ptr [_dta+2] 1477 _.L378: 1250:inthndlr.c **** break; 1478 .loc 1 1250 0 0 00008450 8946E6 mov word ptr [bp-26], ax 1251:inthndlr.c **** 1480 .loc 1 1251 0 0 00008453 E97EFD jmp _.L202 1482 _.L149: 772:inthndlr.c **** lr.BH = version_flags; 1483 .loc 1 772 0 0 00008456 807ED801 cmp byte ptr [bp-40], 1 0 0000845A 7555 jne _.L218 773:inthndlr.c **** else 1486 .loc 1 773 0 0 0000845C A0[0000] mov al, byte ptr [_version_flags] 0 0000845F 8846DB mov byte ptr [bp-37], al 1489 _.L219: 776:inthndlr.c **** lr.BL = REVISION_SEQ; 1490 .loc 1 776 0 0 00008462 8E46D4 mov es, word ptr [bp-44] 0 00008465 26A14000 mov ax, word ptr es:[64] 0 00008469 8946D8 mov word ptr [bp-40], ax 777:inthndlr.c **** lr.CX = 0; /* do not set this to a serial number! 1494 .loc 1 777 0 0 0000846C C646DA2C mov byte ptr [bp-38], 44 778:inthndlr.c **** 32RTM won't like non-zero values */ 1496 .loc 1 778 0 0 00008470 C746DC0000 mov word ptr [bp-36], 0 781:inthndlr.c **** { 1498 .loc 1 781 0 0 00008475 803E[0000]00 cmp byte ptr [_ReturnAnyDosVersionExpected], 0 0 0000847A 7503E955FD je _.L202 1501 _.LBB22: 789:inthndlr.c **** 1502 .loc 1 789 0 0 0000847F 8E46D6 mov es, word ptr [bp-42] 791:inthndlr.c **** (retp[3] == 0x75 || retp[3] == 0x74)) /* je/jne error */ 1504 .loc 1 791 0 0 00008482 26C45D12 les bx, dword ptr es:[di+18] 0 00008486 268A17 mov dl, byte ptr es:[bx] 0 00008489 80FA3D cmp dl, 61 0 0000848C 7529 jne _.L221 792:inthndlr.c **** { 1509 .loc 1 792 0 discriminator 1 0 0000848E 268A5703 mov dl, byte ptr es:[bx+3] 0 00008492 8856D4 mov byte ptr [bp-44], dl 0 00008495 80C28C add dl, -116 791:inthndlr.c **** (retp[3] == 0x75 || retp[3] == 0x74)) /* je/jne error */ 1513 .loc 1 791 0 discriminator 1 0 00008498 80FA01 cmp dl, 1 0 0000849B 7603E934FD ja _.L202 794:inthndlr.c **** lr.AH = retp[2]; 1516 .loc 1 794 0 0 000084A0 268A5701 mov dl, byte ptr es:[bx+1] 0 000084A4 8856D8 mov byte ptr [bp-40], dl 795:inthndlr.c **** } 1519 .loc 1 795 0 0 000084A7 268A4702 mov al, byte ptr es:[bx+2] 1521 _.L373: 802:inthndlr.c **** } 1522 .loc 1 802 0 0 000084AB 8846D9 mov byte ptr [bp-39], al 0 000084AE E923FD jmp _.L202 1525 _.L218: 1526 _.LBE22: 775:inthndlr.c **** lr.AX = psp->ps_retdosver; 1527 .loc 1 775 0 0 000084B1 C646DBFD mov byte ptr [bp-37], -3 0 000084B5 EBAB jmp _.L219 1530 _.L221: 1531 _.LBB23: 797:inthndlr.c **** retp[1] == 0xc4 && retp[2] == 0x3d && /* cmp ax, xxyy */ 1532 .loc 1 797 0 0 000084B7 80FA86 cmp dl, -122 0 000084BA 7403E915FD jne _.L202 797:inthndlr.c **** retp[1] == 0xc4 && retp[2] == 0x3d && /* cmp ax, xxyy */ 1535 .loc 1 797 0 is_stmt 0 discriminator 1 0 000084BF 26807F01C4 cmp byte ptr es:[bx+1], -60 0 000084C4 7403E90BFD jne _.L202 798:inthndlr.c **** (retp[5] == 0x75 || retp[5] == 0x74)) /* je/jne error */ 1538 .loc 1 798 0 is_stmt 1 0 000084C9 26807F023D cmp byte ptr es:[bx+2], 61 0 000084CE 7403E901FD jne _.L202 799:inthndlr.c **** { 1541 .loc 1 799 0 discriminator 1 0 000084D3 268A5705 mov dl, byte ptr es:[bx+5] 0 000084D7 8856D4 mov byte ptr [bp-44], dl 0 000084DA 80C28C add dl, -116 798:inthndlr.c **** (retp[5] == 0x75 || retp[5] == 0x74)) /* je/jne error */ 1545 .loc 1 798 0 discriminator 1 0 000084DD 80FA01 cmp dl, 1 0 000084E0 7603E9EFFC ja _.L202 801:inthndlr.c **** lr.AH = retp[3]; 1548 .loc 1 801 0 0 000084E5 268A5704 mov dl, byte ptr es:[bx+4] 0 000084E9 8856D8 mov byte ptr [bp-40], dl 802:inthndlr.c **** } 1551 .loc 1 802 0 0 000084EC 268A4703 mov al, byte ptr es:[bx+3] 0 000084F0 EBB9 jmp _.L373 1554 _.L150: 1555 _.LBE23: 812:inthndlr.c **** return_code = lr.AL | 0x300; 1556 .loc 1 812 0 0 000084F2 56 push si 0 000084F3 8B46DE mov ax, word ptr [bp-34] 0 000084F6 83F806 cmp ax, 6 0 000084F9 7303 jnc _.L222 0 000084FB B80600 mov ax, 6 1562 _.L222: 0 000084FE 50 push ax 0 000084FF FF36[0000] push word ptr [_cu_psp] 0 00008503 E8[FEFF] call _DosMemChange 1566 _.LVL112: 813:inthndlr.c **** term_type = 3; /* ecm: TSR terminate */ 1567 .loc 1 813 0 0 00008506 8A46D8 mov al, byte ptr [bp-40] 0 00008509 30E4 xor ah, ah 0 0000850B 80CC03 or ah, 3 0 0000850E A3[0000] mov word ptr [_return_code], ax 814:inthndlr.c **** return_user(); 1572 .loc 1 814 0 0 00008511 C606[0000]03 mov byte ptr [_term_type], 3 1574 _.L254: 1118:inthndlr.c **** break; 1575 .loc 1 1118 0 0 00008516 E8[FEFF] call _return_user 1577 _.LVL113: 1119:inthndlr.c **** 1578 .loc 1 1119 0 0 00008519 E9B8FC jmp _.L202 1580 _.L134: 1581 _.LBB24: 825:inthndlr.c **** struct dpb FAR *dpb = get_dpb(drv); 1582 .loc 1 825 0 0 0000851C 8A46DE mov al, byte ptr [bp-34] 0 0000851F 84C0 test al, al 0 00008521 7405 je _.L313 0 00008523 80FC1F cmp ah, 31 0 00008526 751B jne _.L223 1588 _.L313: 825:inthndlr.c **** struct dpb FAR *dpb = get_dpb(drv); 1589 .loc 1 825 0 is_stmt 0 discriminator 3 0 00008528 A0[0000] mov al, byte ptr [_default_drive] 0 0000852B 98 cbw 1592 _.L225: 1593 _.LVL114: 826:inthndlr.c **** 1594 .loc 1 826 0 is_stmt 1 discriminator 6 0 0000852C 50 push ax 0 0000852D E8[FEFF] call _get_dpb 1597 _.LVL115: 828:inthndlr.c **** { 1598 .loc 1 828 0 discriminator 6 0 00008530 89C6 mov si, ax 0 00008532 09D0 or ax, dx 0 00008534 7512 jne _.L226 830:inthndlr.c **** lr.AL = 0xFF; 1602 .loc 1 830 0 0 00008536 C706[0000]0F00 mov word ptr [_CritErrCode], 15 1604 _.L280: 1605 _.LBE24: 1606 _.LBB25: 1420:inthndlr.c **** break; 1607 .loc 1 1420 0 0 0000853C C646D8FF mov byte ptr [bp-40], -1 1421:inthndlr.c **** default: /* is this the proper way to handle invalid AL? */ 1609 .loc 1 1421 0 0 00008540 E991FC jmp _.L202 1611 _.L223: 1612 _.LBE25: 1613 _.LBB26: 825:inthndlr.c **** struct dpb FAR *dpb = get_dpb(drv); 1614 .loc 1 825 0 discriminator 4 0 00008543 30E4 xor ah, ah 0 00008545 48 dec ax 0 00008546 EBE4 jmp _.L225 1618 _.L226: 835:inthndlr.c **** dpb->dpb_flags = M_CHANGED; /* force flush and reread of drive BPB/DPB */ 1619 .loc 1 835 0 0 00008548 8EC2 mov es, dx 0 0000854A 8956D4 mov word ptr [bp-44], dx 0 0000854D 268A04 mov al, byte ptr es:[si] 0 00008550 98 cbw 0 00008551 50 push ax 0 00008552 E8[FEFF] call _flush_buffers 1626 _.LVL116: 836:inthndlr.c **** 1627 .loc 1 836 0 0 00008555 8B56D4 mov dx, word ptr [bp-44] 0 00008558 8EC2 mov es, dx 0 0000855A 26C64418FF mov byte ptr es:[si+24], -1 839:inthndlr.c **** #else 1631 .loc 1 839 0 0 0000855F 52 push dx 0 00008560 8956D4 mov word ptr [bp-44], dx 0 00008563 56 push si 0 00008564 E8[FEFF] call _media_check 1636 _.LVL117: 0 00008567 85C0 test ax, ax 0 00008569 7C0C jl _.L227 839:inthndlr.c **** #else 1639 .loc 1 839 0 is_stmt 0 discriminator 1 0 0000856B 8B56D4 mov dx, word ptr [bp-44] 0 0000856E 8EC2 mov es, dx 0 00008570 26837C0F00 cmp word ptr es:[si+15], 0 0 00008575 750D jne _.L228 1644 _.L227: 844:inthndlr.c **** CritErrCode = -DE_INVLDDRV; 1645 .loc 1 844 0 is_stmt 1 0 00008577 C646D8FF mov byte ptr [bp-40], -1 845:inthndlr.c **** break; 1647 .loc 1 845 0 0 0000857B C706[0000]0F00 mov word ptr [_CritErrCode], 15 846:inthndlr.c **** } 1649 .loc 1 846 0 0 00008581 E950FC jmp _.L202 1651 _.L228: 848:inthndlr.c **** lr.BX = FP_OFF(dpb); 1652 .loc 1 848 0 0 00008584 8956E4 mov word ptr [bp-28], dx 849:inthndlr.c **** lr.AL = 0; 1654 .loc 1 849 0 0 00008587 8976DA mov word ptr [bp-38], si 0 0000858A E92BFD jmp _.L374 1657 _.L151: 1658 _.LBE26: 860:inthndlr.c **** lr.ES = FP_SEG(&InDOS); 1659 .loc 1 860 0 0 0000858D C746DA[0000] mov word ptr [bp-38], offset _InDOS 1661 _.L377: 1152:inthndlr.c **** break; 1662 .loc 1 1152 0 0 00008592 8C56E6 mov word ptr [bp-26], ss 1153:inthndlr.c **** 1664 .loc 1 1153 0 0 00008595 E93CFC jmp _.L202 1666 _.L152: 869:inthndlr.c **** break; 1667 .loc 1 869 0 0 00008598 8D46DE lea ax, [-34+bp] 0 0000859B 50 push ax 0 0000859C 8D46DC lea ax, [-36+bp] 0 0000859F 50 push ax 0 000085A0 8D46DA lea ax, [-38+bp] 0 000085A3 50 push ax 0 000085A4 FF76DE push word ptr [bp-34] 0 000085A7 E8[FEFF] call _DosGetFree 1676 _.LVL118: 1677 _.L300: 1740:inthndlr.c **** goto exit_dispatch; 1678 .loc 1 1740 0 0 000085AA 8946D8 mov word ptr [bp-40], ax 1741:inthndlr.c **** } 1680 .loc 1 1741 0 0 000085AD E924FC jmp _.L202 1682 _.L153: 874:inthndlr.c **** { 1683 .loc 1 874 0 0 000085B0 8A46D8 mov al, byte ptr [bp-40] 0 000085B3 84C0 test al, al 0 000085B5 740C je _.L229 0 000085B7 3C01 cmp al, 1 0 000085B9 7411 je _.L230 1689 _.L193: 1749:inthndlr.c **** error_exit: 1690 .loc 1 1749 0 0 000085BB C746E8FFFF mov word ptr [bp-24], -1 0 000085C0 E92302 jmp _.L249 1693 _.L229: 878:inthndlr.c **** lr.AL = 0x00; 1694 .loc 1 878 0 0 000085C3 A0[0000] mov al, byte ptr [_switchar] 0 000085C6 8846DE mov byte ptr [bp-34], al 0 000085C9 E9ECFC jmp _.L374 1698 _.L230: 884:inthndlr.c **** lr.AL = 0x00; 1699 .loc 1 884 0 0 000085CC 8A46DE mov al, byte ptr [bp-34] 0 000085CF A2[0000] mov byte ptr [_switchar], al 0 000085D2 E9E3FC jmp _.L374 1703 _.L154: 1704 _.LBB27: 896:inthndlr.c **** 1705 .loc 1 896 0 0 000085D5 8A46D8 mov al, byte ptr [bp-40] 0 000085D8 30E4 xor ah, ah 0 000085DA 89C6 mov si, ax 1709 _.LVL119: 898:inthndlr.c **** cntry = lr.BX; 1710 .loc 1 898 0 0 000085DC 3DFF00 cmp ax, 255 0 000085DF 7503 jne _.L231 899:inthndlr.c **** 1713 .loc 1 899 0 0 000085E1 8B76DA mov si, word ptr [bp-38] 1715 _.LVL120: 1716 _.L231: 901:inthndlr.c **** { 1717 .loc 1 901 0 0 000085E4 8B46DE mov ax, word ptr [bp-34] 0 000085E7 83F8FF cmp ax, -1 0 000085EA 750A jne _.L232 904:inthndlr.c **** } 1721 .loc 1 904 0 0 000085EC 56 push si 0 000085ED E8[FEFF] call _DosSetCountry 1724 _.LVL121: 1725 _.L298: 1726 _.LBE27: 1743:inthndlr.c **** short_check: 1727 .loc 1 1743 0 0 000085F0 8946E8 mov word ptr [bp-24], ax 0 000085F3 E94701 jmp _.L233 1730 _.LVL122: 1731 _.L232: 1732 _.LBB28: 908:inthndlr.c **** cntry--; 1733 .loc 1 908 0 0 000085F6 85F6 test si, si 0 000085F8 7503 jne _.L234 909:inthndlr.c **** /* Get Country Information */ 1736 .loc 1 909 0 0 000085FA 8D74FF lea si, [-1+si] 1738 _.LVL123: 1739 _.L234: 911:inthndlr.c **** if (rc >= SUCCESS) 1740 .loc 1 911 0 0 000085FD FF76E4 push word ptr [bp-28] 0 00008600 50 push ax 0 00008601 56 push si 0 00008602 E8[FEFF] call _DosGetCountryInformation 1745 _.LVL124: 0 00008605 8946E8 mov word ptr [bp-24], ax 912:inthndlr.c **** { 1747 .loc 1 912 0 0 00008608 85C0 test ax, ax 0 0000860A 7D03E9D701 jl _.L249 914:inthndlr.c **** cntry = nlsInfo.actPkg->cntry; 1750 .loc 1 914 0 0 0000860F 83FEFF cmp si, -1 0 00008612 750A jne _.L236 915:inthndlr.c **** lr.AX = lr.BX = cntry; 1753 .loc 1 915 0 0 00008614 BB[0000] mov bx, offset _nlsInfo 0 00008617 C47708 les si, dword ptr [bx+8] 1756 _.LVL125: 0 0000861A 268B7404 mov si, word ptr es:[si+4] 1758 _.LVL126: 1759 _.L236: 916:inthndlr.c **** } 1760 .loc 1 916 0 0 0000861E 8976DA mov word ptr [bp-38], si 1762 _.LVL127: 1763 _.L365: 1764 _.LBE28: 1133:inthndlr.c **** goto short_check; 1765 .loc 1 1133 0 0 00008621 8976D8 mov word ptr [bp-40], si 1134:inthndlr.c **** 1767 .loc 1 1134 0 0 00008624 E91601 jmp _.L233 1769 _.L155: 484:inthndlr.c **** { 1770 .loc 1 484 0 0 00008627 88E0 mov al, ah 1772 _.L242: 1000:inthndlr.c **** { 1773 .loc 1 1000 0 0 00008629 30E4 xor ah, ah 1006:inthndlr.c **** goto short_check; 1775 .loc 1 1006 0 0 0000862B 50 push ax 0 0000862C FF76E4 push word ptr [bp-28] 0 0000862F FF76DE push word ptr [bp-34] 0 00008632 E8[FEFF] call _DosMkRmdir 1780 _.LVL128: 0 00008635 EBB9 jmp _.L298 1782 _.L156: 931:inthndlr.c **** goto short_check; 1783 .loc 1 931 0 0 00008637 FF76E4 push word ptr [bp-28] 0 0000863A FF76DE push word ptr [bp-34] 0 0000863D E8[FEFF] call _DosChangeDir 1787 _.LVL129: 0 00008640 EBAE jmp _.L298 1789 _.L157: 936:inthndlr.c **** goto long_check; 1790 .loc 1 936 0 0 00008642 8A46DC mov al, byte ptr [bp-36] 0 00008645 30E4 xor ah, ah 0 00008647 50 push ax 0 00008648 B8020E mov ax, 3586 1795 _.L363: 941:inthndlr.c **** goto long_check; 1796 .loc 1 941 0 0 0000864B 50 push ax 0 0000864C FF76E4 push word ptr [bp-28] 0 0000864F FF76DE push word ptr [bp-34] 0 00008652 E8[FEFF] call _DosOpen 1801 _.LVL130: 1802 _.L237: 1738:inthndlr.c **** { 1803 .loc 1 1738 0 0 00008655 85D2 test dx, dx 0 00008657 7C03E94EFF jge _.L300 0 0000865C EB92 jmp _.L298 1807 _.LVL131: 1808 _.L158: 941:inthndlr.c **** goto long_check; 1809 .loc 1 941 0 0 0000865E 56 push si 0 0000865F 8A46D8 mov al, byte ptr [bp-40] 0 00008662 30E4 xor ah, ah 0 00008664 80CC09 or ah, 9 0 00008667 EBE2 jmp _.L363 1815 _.L159: 946:inthndlr.c **** goto short_check; 1816 .loc 1 946 0 0 00008669 FF76DA push word ptr [bp-38] 0 0000866C E8[FEFF] call _DosClose 1819 _.LVL132: 0 0000866F E97EFF jmp _.L298 1821 _.L160: 951:inthndlr.c **** goto long_check; 1822 .loc 1 951 0 0 00008672 8B76E4 mov si, word ptr [bp-28] 0 00008675 8B46DE mov ax, word ptr [bp-34] 0 00008678 8946D0 mov word ptr [bp-48], ax 0 0000867B 8B46DC mov ax, word ptr [bp-36] 0 0000867E 8946D4 mov word ptr [bp-44], ax 0 00008681 FF76DA push word ptr [bp-38] 0 00008684 E8[FEFF] call _get_sft_idx 1830 _.LVL133: 0 00008687 BA0100 mov dx, 1 1832 _.L364: 956:inthndlr.c **** goto long_check; 1833 .loc 1 956 0 0 0000868A 52 push dx 0 0000868B 56 push si 0 0000868C FF76D0 push word ptr [bp-48] 0 0000868F FF76D4 push word ptr [bp-44] 0 00008692 50 push ax 0 00008693 E8[FEFF] call _DosRWSft 1840 _.LVL134: 957:inthndlr.c **** 1841 .loc 1 957 0 0 00008696 EBBD jmp _.L237 1843 _.LVL135: 1844 _.L161: 956:inthndlr.c **** goto long_check; 1845 .loc 1 956 0 0 00008698 8B76E4 mov si, word ptr [bp-28] 0 0000869B 8B46DE mov ax, word ptr [bp-34] 0 0000869E 8946D0 mov word ptr [bp-48], ax 0 000086A1 8B46DC mov ax, word ptr [bp-36] 0 000086A4 8946D4 mov word ptr [bp-44], ax 0 000086A7 FF76DA push word ptr [bp-38] 0 000086AA E8[FEFF] call _get_sft_idx 1853 _.LVL136: 0 000086AD BA0200 mov dx, 2 0 000086B0 EBD8 jmp _.L364 1856 _.L162: 961:inthndlr.c **** goto short_check; 1857 .loc 1 961 0 0 000086B2 B83700 mov ax, 55 0 000086B5 50 push ax 0 000086B6 FF76E4 push word ptr [bp-28] 0 000086B9 FF76DE push word ptr [bp-34] 0 000086BC E8[FEFF] call _DosDelete 1863 _.LVL137: 0 000086BF E92EFF jmp _.L298 1865 _.L163: 966:inthndlr.c **** goto error_invalid; 1866 .loc 1 966 0 0 000086C2 8A46D8 mov al, byte ptr [bp-40] 0 000086C5 3C02 cmp al, 2 0 000086C7 7603E9EFFE ja _.L193 968:inthndlr.c **** if (rc == SUCCESS) 1870 .loc 1 968 0 0 000086CC 8D56E8 lea dx, [-24+bp] 0 000086CF 52 push dx 0 000086D0 30E4 xor ah, ah 0 000086D2 50 push ax 0 000086D3 FF76DC push word ptr [bp-36] 0 000086D6 FF76DE push word ptr [bp-34] 0 000086D9 FF76DA push word ptr [bp-38] 0 000086DC E8[FEFF] call _DosSeek 1879 _.LVL138: 969:inthndlr.c **** { 1880 .loc 1 969 0 0 000086DF 837EE800 cmp word ptr [bp-24], 0 0 000086E3 7558 jne _.L233 971:inthndlr.c **** lr.AX = (UWORD) lrc; 1883 .loc 1 971 0 0 000086E5 8956DE mov word ptr [bp-34], dx 1885 _.LVL139: 1886 _.L366: 988:inthndlr.c **** break; 1887 .loc 1 988 0 0 000086E8 8946D8 mov word ptr [bp-40], ax 989:inthndlr.c **** 1889 .loc 1 989 0 0 000086EB EB50 jmp _.L233 1891 _.L164: 978:inthndlr.c **** { 1892 .loc 1 978 0 0 000086ED 8A46D8 mov al, byte ptr [bp-40] 0 000086F0 3C01 cmp al, 1 0 000086F2 7455 je _.L239 0 000086F4 7231 jc _.L240 0 000086F6 3CFF cmp al, -1 0 000086F8 7403E9BEFE jne _.L193 1000:inthndlr.c **** { 1899 .loc 1 1000 0 0 000086FD 8A46DC mov al, byte ptr [bp-36] 0 00008700 3C39 cmp al, 57 0 00008702 7303E9B4FE jc _.L193 0 00008707 3C3A cmp al, 58 0 00008709 7703E91BFF jbe _.L242 0 0000870E 3C56 cmp al, 86 0 00008710 7403E9A6FE jne _.L193 1907 _.L181: 1181:inthndlr.c **** goto short_check; 1908 .loc 1 1181 0 0 00008715 FF76E6 push word ptr [bp-26] 0 00008718 FF76E2 push word ptr [bp-30] 0 0000871B FF76E4 push word ptr [bp-28] 0 0000871E FF76DE push word ptr [bp-34] 0 00008721 E8[FEFF] call _DosRename 1914 _.LVL140: 0 00008724 E9C9FE jmp _.L298 1916 _.L240: 981:inthndlr.c **** if (rc >= SUCCESS) 1917 .loc 1 981 0 0 00008727 FF76E4 push word ptr [bp-28] 0 0000872A FF76DE push word ptr [bp-34] 0 0000872D E8[FEFF] call _DosGetFattr 1921 _.LVL141: 0 00008730 8946E8 mov word ptr [bp-24], ax 982:inthndlr.c **** lr.CX = rc; 1923 .loc 1 982 0 0 00008733 85C0 test ax, ax 0 00008735 7D03E9AC00 jl _.L249 983:inthndlr.c **** break; 1926 .loc 1 983 0 0 0000873A 8946DC mov word ptr [bp-36], ax 1928 _.L233: 1745:inthndlr.c **** goto error_exit; 1929 .loc 1 1745 0 0 0000873D 837EE800 cmp word ptr [bp-24], 0 0 00008741 7C03E98EFA jge _.L202 0 00008746 E99D00 jmp _.L249 1933 _.L239: 987:inthndlr.c **** lr.AX = lr.CX; 1934 .loc 1 987 0 0 00008749 FF76DC push word ptr [bp-36] 0 0000874C FF76E4 push word ptr [bp-28] 0 0000874F FF76DE push word ptr [bp-34] 0 00008752 E8[FEFF] call _DosSetFattr 1939 _.LVL142: 0 00008755 8946E8 mov word ptr [bp-24], ax 988:inthndlr.c **** break; 1941 .loc 1 988 0 0 00008758 8B46DC mov ax, word ptr [bp-36] 0 0000875B EB8B jmp _.L366 1944 _.L165: 1025:inthndlr.c **** 1945 .loc 1 1025 0 0 0000875D 8D46D8 lea ax, [-40+bp] 0 00008760 50 push ax 0 00008761 E8[FEFF] call _DosDevIOctl 1949 _.LVL143: 0 00008764 8946E8 mov word ptr [bp-24], ax 1027:inthndlr.c **** { 1951 .loc 1 1027 0 0 00008767 85C0 test ax, ax 0 00008769 7C03E966FA jge _.L202 1029:inthndlr.c **** if (rc != DE_DEVICE && rc != DE_ACCESS) 1954 .loc 1 1029 0 0 0000876E 89C2 mov dx, ax 0 00008770 F7DA neg dx 0 00008772 8956D8 mov word ptr [bp-40], dx 1030:inthndlr.c **** CritErrCode = lr.AX; 1958 .loc 1 1030 0 0 00008775 83F8EF cmp ax, -17 0 00008778 7409 je _.L246 0 0000877A 83F8FB cmp ax, -5 0 0000877D 7404 je _.L246 1031:inthndlr.c **** goto error_carry; 1963 .loc 1 1031 0 0 0000877F 8916[0000] mov word ptr [_CritErrCode], dx 1965 _.L246: 1755:inthndlr.c **** exit_dispatch: 1966 .loc 1 1755 0 0 00008783 8E46D6 mov es, word ptr [bp-42] 0 00008786 26804D1601 or byte ptr es:[di+22], 1 0 0000878B E946FA jmp _.L202 1970 _.L166: 1038:inthndlr.c **** goto long_check; 1971 .loc 1 1038 0 0 0000878E FF76DA push word ptr [bp-38] 0 00008791 E8[FEFF] call _DosDup 1974 _.LVL144: 1039:inthndlr.c **** 1975 .loc 1 1039 0 0 00008794 E9BEFE jmp _.L237 1977 _.LVL145: 1978 _.L167: 1043:inthndlr.c **** goto short_check; 1979 .loc 1 1043 0 0 00008797 FF76DC push word ptr [bp-36] 0 0000879A FF76DA push word ptr [bp-38] 0 0000879D E8[FEFF] call _DosForceDup 1983 _.LVL146: 0 000087A0 E94DFE jmp _.L298 1985 _.L168: 1048:inthndlr.c **** lr.AX = 0x0100; /*jpp: from interrupt list */ 1986 .loc 1 1048 0 0 000087A3 FF76E4 push word ptr [bp-28] 0 000087A6 FF76E0 push word ptr [bp-32] 0 000087A9 FF76DE push word ptr [bp-34] 0 000087AC E8[FEFF] call _DosGetCuDir 1991 _.LVL147: 0 000087AF 8946E8 mov word ptr [bp-24], ax 1049:inthndlr.c **** goto short_check; 1993 .loc 1 1049 0 0 000087B2 C746D80001 mov word ptr [bp-40], 256 1050:inthndlr.c **** 1995 .loc 1 1050 0 0 000087B7 EB84 jmp _.L233 1997 _.L169: 1054:inthndlr.c **** { 1998 .loc 1 1054 0 0 000087B9 8D46D8 lea ax, [-40+bp] 0 000087BC 8D76DA lea si, [-38+bp] 0 000087BF 56 push si 0 000087C0 50 push ax 0 000087C1 A0[0000] mov al, byte ptr [_mem_access_mode] 0 000087C4 30E4 xor ah, ah 0 000087C6 50 push ax 0 000087C7 FF76DA push word ptr [bp-38] 0 000087CA E8[FEFF] call _DosMemAlloc 2008 _.LVL148: 0 000087CD 8946E8 mov word ptr [bp-24], ax 0 000087D0 85C0 test ax, ax 0 000087D2 7D26 jge _.L247 1056:inthndlr.c **** if (DosMemCheck() != SUCCESS) 2012 .loc 1 1056 0 0 000087D4 56 push si 0 000087D5 E8[FEFF] call _DosMemLargest 2015 _.LVL149: 2016 _.L361: 1057:inthndlr.c **** panic("MCB chain corrupted"); 2017 .loc 1 1057 0 0 000087D8 E8[FEFF] call _DosMemCheck 2019 _.LVL150: 0 000087DB 85C0 test ax, ax 0 000087DD 7407 je _.L249 1058:inthndlr.c **** goto error_exit; 2022 .loc 1 1058 0 0 000087DF B8[0000] mov ax, offset _.LC0 2024 _.L367: 1088:inthndlr.c **** goto error_exit; 2025 .loc 1 1088 0 0 000087E2 50 push ax 0 000087E3 E8[FEFF] call _panic 2028 _.LVL151: 2029 _.L249: 1751:inthndlr.c **** if (CritErrCode == SUCCESS) 2030 .loc 1 1751 0 0 000087E6 8B46E8 mov ax, word ptr [bp-24] 0 000087E9 F7D8 neg ax 0 000087EB 8946D8 mov word ptr [bp-40], ax 1752:inthndlr.c **** CritErrCode = lr.AX; /* Maybe set */ 2034 .loc 1 1752 0 0 000087EE 833E[0000]00 cmp word ptr [_CritErrCode], 0 0 000087F3 758E jne _.L246 1753:inthndlr.c **** error_carry: 2037 .loc 1 1753 0 0 000087F5 A3[0000] mov word ptr [_CritErrCode], ax 0 000087F8 EB89 jmp _.L246 2040 _.L247: 1061:inthndlr.c **** break; 2041 .loc 1 1061 0 0 000087FA FF46D8 inc word ptr [bp-40] 1062:inthndlr.c **** 2043 .loc 1 1062 0 0 000087FD E9D4F9 jmp _.L202 2045 _.L170: 1066:inthndlr.c **** { 2046 .loc 1 1066 0 0 00008800 8B46E6 mov ax, word ptr [bp-26] 0 00008803 48 dec ax 0 00008804 50 push ax 0 00008805 E8[FEFF] call _DosMemFree 2051 _.LVL152: 0 00008808 8946E8 mov word ptr [bp-24], ax 0 0000880B 85C0 test ax, ax 0 0000880D 7C03E9C2F9 jge _.L202 0 00008812 EBC4 jmp _.L361 2056 _.L171: 1076:inthndlr.c **** panic("before 4a: MCB chain corrupted"); 2057 .loc 1 1076 0 0 00008814 E8[FEFF] call _DosMemCheck 2059 _.LVL153: 0 00008817 85C0 test ax, ax 0 00008819 7407 je _.L251 1077:inthndlr.c **** 2062 .loc 1 1077 0 0 0000881B B8[1400] mov ax, offset _.LC1 0 0000881E 50 push ax 0 0000881F E8[FEFF] call _panic 2066 _.LVL154: 2067 _.L251: 1079:inthndlr.c **** { 2068 .loc 1 1079 0 0 00008822 8D46DA lea ax, [-38+bp] 0 00008825 50 push ax 0 00008826 FF76DA push word ptr [bp-38] 0 00008829 FF76E6 push word ptr [bp-26] 0 0000882C E8[FEFF] call _DosMemChange 2074 _.LVL155: 0 0000882F 8946E8 mov word ptr [bp-24], ax 0 00008832 85C0 test ax, ax 0 00008834 7D0C jge _.L252 1087:inthndlr.c **** panic("after 4a: MCB chain corrupted"); 2078 .loc 1 1087 0 0 00008836 E8[FEFF] call _DosMemCheck 2080 _.LVL156: 0 00008839 85C0 test ax, ax 0 0000883B 74A9 je _.L249 1088:inthndlr.c **** goto error_exit; 2083 .loc 1 1088 0 0 0000883D B8[3300] mov ax, offset _.LC2 0 00008840 EBA0 jmp _.L367 2086 _.L252: 1091:inthndlr.c **** break; 2087 .loc 1 1091 0 0 00008842 8B46E6 mov ax, word ptr [bp-26] 0 00008845 E962FD jmp _.L300 2090 _.L172: 1096:inthndlr.c **** 2091 .loc 1 1096 0 0 00008848 C606[0000]00 mov byte ptr [_break_flg], 0 1098:inthndlr.c **** goto short_check; 2093 .loc 1 1098 0 0 0000884D FF76E4 push word ptr [bp-28] 0 00008850 FF76DE push word ptr [bp-34] 0 00008853 FF76E6 push word ptr [bp-26] 0 00008856 FF76DA push word ptr [bp-38] 0 00008859 8A46D8 mov al, byte ptr [bp-40] 0 0000885C 30E4 xor ah, ah 0 0000885E 50 push ax 0 0000885F E8[FEFF] call _DosExec 2102 _.LVL157: 0 00008862 E98BFD jmp _.L298 2104 _.L105: 1103:inthndlr.c **** 2105 .loc 1 1103 0 0 00008865 C746D8004C mov word ptr [bp-40], 19456 2107 _.L173: 1107:inthndlr.c **** break_flg = FALSE; 2108 .loc 1 1107 0 0 0000886A 803E[0000]00 cmp byte ptr [_break_flg], 0 0 0000886F 740A je _.L253 1108:inthndlr.c **** term_type = 1; 2111 .loc 1 1108 0 0 00008871 C606[0000]00 mov byte ptr [_break_flg], 0 1109:inthndlr.c **** } 2113 .loc 1 1109 0 0 00008876 C606[0000]01 mov byte ptr [_term_type], 1 2115 _.L253: 1111:inthndlr.c **** return_code = lr.AL | rc; 2116 .loc 1 1111 0 0 0000887B A1[0000] mov ax, word ptr [_term_type] 0 0000887E B108 mov cl, 8 0 00008880 D3E0 shl ax, cl 0 00008882 8946E8 mov word ptr [bp-24], ax 1112:inthndlr.c **** if (DosMemCheck() != SUCCESS) 2121 .loc 1 1112 0 0 00008885 8A56D8 mov dl, byte ptr [bp-40] 0 00008888 08D0 or al, dl 0 0000888A A3[0000] mov word ptr [_return_code], ax 1113:inthndlr.c **** panic("MCB chain corrupted"); 2125 .loc 1 1113 0 0 0000888D E8[FEFF] call _DosMemCheck 2127 _.LVL158: 0 00008890 85C0 test ax, ax 0 00008892 7503E97FFC je _.L254 1114:inthndlr.c **** #ifdef TSC 2130 .loc 1 1114 0 0 00008897 B8[0000] mov ax, offset _.LC0 0 0000889A 50 push ax 0 0000889B E8[FEFF] call _panic 2134 _.LVL159: 0 0000889E E975FC jmp _.L254 2136 _.L174: 1123:inthndlr.c **** /* needs to be cleared (RBIL) */ 2137 .loc 1 1123 0 0 000088A1 A1[0000] mov ax, word ptr [_return_code] 0 000088A4 8946D8 mov word ptr [bp-40], ax 1125:inthndlr.c **** break; 2140 .loc 1 1125 0 0 000088A7 C706[0000]0000 mov word ptr [_return_code], 0 1126:inthndlr.c **** 2142 .loc 1 1126 0 0 000088AD E924F9 jmp _.L202 2144 _.L175: 1132:inthndlr.c **** lr.AX = 0; 2145 .loc 1 1132 0 0 000088B0 FF76E4 push word ptr [bp-28] 0 000088B3 FF76DE push word ptr [bp-34] 0 000088B6 FF76DC push word ptr [bp-36] 0 000088B9 E8[FEFF] call _DosFindFirst 2150 _.LVL160: 0 000088BC 8946E8 mov word ptr [bp-24], ax 0 000088BF E95FFD jmp _.L365 2153 _.L176: 1140:inthndlr.c **** lr.AX = 0; 2154 .loc 1 1140 0 0 000088C2 E8[FEFF] call _DosFindNext 2156 _.LVL161: 0 000088C5 8946E8 mov word ptr [bp-24], ax 1141:inthndlr.c **** goto short_check; 2158 .loc 1 1141 0 0 000088C8 C746D80000 mov word ptr [bp-40], 0 1142:inthndlr.c **** /* 2160 .loc 1 1142 0 0 000088CD E96DFE jmp _.L233 2162 _.L177: 1151:inthndlr.c **** lr.ES = FP_SEG(&DPBp); 2163 .loc 1 1151 0 0 000088D0 C746DA[0000] mov word ptr [bp-38], offset _DPBp 0 000088D5 E9BAFC jmp _.L377 2166 _.L178: 0 000088D8 30D2 xor dl, dl 1157:inthndlr.c **** (struct dpb FAR *)MK_FP(lr.ES, r->BP) 2168 .loc 1 1157 0 0 000088DA 817EDC5845 cmp word ptr [bp-36], 17752 0 000088DF 750B jne _.L255 1157:inthndlr.c **** (struct dpb FAR *)MK_FP(lr.ES, r->BP) 2171 .loc 1 1157 0 is_stmt 0 discriminator 1 0 000088E1 817EDE5241 cmp word ptr [bp-34], 16722 0 000088E6 9F lahf 0 000088E7 D0E4 shl ah, 1 0 000088E9 99 cwd 0 000088EA F6DA neg dl 2177 _.L255: 1157:inthndlr.c **** (struct dpb FAR *)MK_FP(lr.ES, r->BP) 2178 .loc 1 1157 0 discriminator 6 0 000088EC 30F6 xor dh, dh 0 000088EE 52 push dx 1158:inthndlr.c **** #ifdef WITHFAT32 2181 .loc 1 1158 0 is_stmt 1 discriminator 6 0 000088EF 8E46D6 mov es, word ptr [bp-42] 0 000088F2 268B450C mov ax, word ptr es:[di+12] 1157:inthndlr.c **** (struct dpb FAR *)MK_FP(lr.ES, r->BP) 2184 .loc 1 1157 0 discriminator 6 0 000088F6 FF76E6 push word ptr [bp-26] 0 000088F9 50 push ax 0 000088FA FF76E4 push word ptr [bp-28] 0 000088FD FF76E0 push word ptr [bp-32] 0 00008900 E8[FEFF] call _bpb_to_dpb 2190 _.LVL162: 1163:inthndlr.c **** 2191 .loc 1 1163 0 discriminator 6 0 00008903 E9CEF8 jmp _.L202 2193 _.L179: 1167:inthndlr.c **** break; 2194 .loc 1 1167 0 0 00008906 A0[0000] mov al, byte ptr [_verify_ena] 0 00008909 E905F9 jmp _.L371 2197 _.L180: 1173:inthndlr.c **** /* copy command line from the parent (required for some device loaders) */ 2198 .loc 1 1173 0 0 0000890C FF76E0 push word ptr [bp-32] 0 0000890F FF36[0000] push word ptr [_cu_psp] 0 00008913 FF76DE push word ptr [bp-34] 0 00008916 E8[FEFF] call _child_psp 2203 _.LVL163: 1175:inthndlr.c **** cu_psp = lr.DX; 2204 .loc 1 1175 0 0 00008919 B88000 mov ax, 128 0 0000891C 50 push ax 0 0000891D FF36[0000] push word ptr [_cu_psp] 0 00008921 50 push ax 0 00008922 FF76DE push word ptr [bp-34] 0 00008925 50 push ax 0 00008926 E8[FEFF] call _fmemcpy 2212 _.LVL164: 1176:inthndlr.c **** break; 2213 .loc 1 1176 0 0 00008929 8B46DE mov ax, word ptr [bp-34] 0 0000892C A3[0000] mov word ptr [_cu_psp], ax 1177:inthndlr.c **** 2216 .loc 1 1177 0 0 0000892F E9A2F8 jmp _.L202 2218 _.L182: 1186:inthndlr.c **** { 2219 .loc 1 1186 0 0 00008932 8A46D8 mov al, byte ptr [bp-40] 0 00008935 84C0 test al, al 0 00008937 7421 je _.L256 0 00008939 3C01 cmp al, 1 0 0000893B 7403E97BFC jne _.L193 1195:inthndlr.c **** (ddate) lr.DX, /* FileDate */ 2225 .loc 1 1195 0 0 00008940 8B76DC mov si, word ptr [bp-36] 0 00008943 8B46DE mov ax, word ptr [bp-34] 0 00008946 8946D4 mov word ptr [bp-44], ax 0 00008949 FF76DA push word ptr [bp-38] 0 0000894C E8[FEFF] call _get_sft_idx 2231 _.LVL165: 0 0000894F 56 push si 0 00008950 FF76D4 push word ptr [bp-44] 0 00008953 50 push ax 0 00008954 E8[FEFF] call _DosSetFtimeSft 2236 _.LVL166: 0 00008957 E996FC jmp _.L298 2238 _.L256: 1189:inthndlr.c **** &lr.DX, /* FileDate */ 2239 .loc 1 1189 0 0 0000895A 8D46DC lea ax, [-36+bp] 0 0000895D 50 push ax 0 0000895E 8D46DE lea ax, [-34+bp] 0 00008961 50 push ax 0 00008962 FF76DA push word ptr [bp-38] 0 00008965 E8[FEFF] call _DosGetFtime 2246 _.LVL167: 0 00008968 E985FC jmp _.L298 2248 _.L183: 1207:inthndlr.c **** { 2249 .loc 1 1207 0 0 0000896B 8A46D8 mov al, byte ptr [bp-40] 0 0000896E 3C01 cmp al, 1 0 00008970 742D je _.L258 0 00008972 721E jc _.L259 0 00008974 3C02 cmp al, 2 0 00008976 7444 je _.L260 0 00008978 3C03 cmp al, 3 0 0000897A 7403E93CFC jne _.L193 1226:inthndlr.c **** { 2258 .loc 1 1226 0 0 0000897F 833E[0000]FF cmp word ptr [_uppermem_root], -1 0 00008984 7503E932FC je _.L193 1228:inthndlr.c **** break; 2261 .loc 1 1228 0 0 00008989 FF76DA push word ptr [bp-38] 0 0000898C E8[FEFF] call _DosUmbLink 2264 _.LVL168: 1229:inthndlr.c **** } 2265 .loc 1 1229 0 0 0000898F E942F8 jmp _.L202 2267 _.L259: 1210:inthndlr.c **** lr.AH = 0; 2268 .loc 1 1210 0 0 00008992 A0[0000] mov al, byte ptr [_mem_access_mode] 0 00008995 8846D8 mov byte ptr [bp-40], al 1211:inthndlr.c **** break; 2271 .loc 1 1211 0 0 00008998 C646D900 mov byte ptr [bp-39], 0 1212:inthndlr.c **** 2273 .loc 1 1212 0 0 0000899C E935F8 jmp _.L202 2275 _.L258: 1215:inthndlr.c **** (lr.BL & FIT_MASK) > LAST_FIT) /* 0x3f, 0x02 */ 2276 .loc 1 1215 0 0 0000899F 8A46DA mov al, byte ptr [bp-38] 0 000089A2 3C82 cmp al, -126 0 000089A4 7603E912FC ja _.L193 1215:inthndlr.c **** (lr.BL & FIT_MASK) > LAST_FIT) /* 0x3f, 0x02 */ 2280 .loc 1 1215 0 is_stmt 0 discriminator 1 0 000089A9 88C4 mov ah, al 0 000089AB 80E43F and ah, 63 0 000089AE 80FC02 cmp ah, 2 0 000089B1 7603E905FC ja _.L193 1218:inthndlr.c **** break; 2285 .loc 1 1218 0 is_stmt 1 0 000089B6 A2[0000] mov byte ptr [_mem_access_mode], al 1219:inthndlr.c **** 2287 .loc 1 1219 0 0 000089B9 E918F8 jmp _.L202 2289 _.L260: 1222:inthndlr.c **** break; 2290 .loc 1 1222 0 0 000089BC A0[0000] mov al, byte ptr [_uppermem_link] 0 000089BF E94FF8 jmp _.L371 2293 _.L184: 1245:inthndlr.c **** lr.CH = CritErrLocus; 2294 .loc 1 1245 0 0 000089C2 A1[0000] mov ax, word ptr [_CritErrCode] 0 000089C5 8946D8 mov word ptr [bp-40], ax 1246:inthndlr.c **** lr.BH = CritErrClass; 2297 .loc 1 1246 0 0 000089C8 A0[0000] mov al, byte ptr [_CritErrLocus] 0 000089CB 8846DD mov byte ptr [bp-35], al 1247:inthndlr.c **** lr.BL = CritErrAction; 2300 .loc 1 1247 0 0 000089CE A0[0000] mov al, byte ptr [_CritErrClass] 0 000089D1 8846DB mov byte ptr [bp-37], al 1248:inthndlr.c **** lr.DI = FP_OFF(CritErrDev); 2303 .loc 1 1248 0 0 000089D4 A0[0000] mov al, byte ptr [_CritErrAction] 0 000089D7 8846DA mov byte ptr [bp-38], al 1249:inthndlr.c **** lr.ES = FP_SEG(CritErrDev); 2306 .loc 1 1249 0 0 000089DA A1[0000] mov ax, word ptr [_CritErrDev] 0 000089DD 8946E2 mov word ptr [bp-30], ax 1250:inthndlr.c **** break; 2309 .loc 1 1250 0 0 000089E0 A1[0200] mov ax, word ptr [_CritErrDev+2] 0 000089E3 E96AFA jmp _.L378 2312 _.L185: 1255:inthndlr.c **** goto long_check; 2313 .loc 1 1255 0 0 000089E6 FF76DC push word ptr [bp-36] 0 000089E9 FF76E4 push word ptr [bp-28] 0 000089EC FF76DE push word ptr [bp-34] 0 000089EF E8[FEFF] call _DosMkTmp 2318 _.LVL169: 1256:inthndlr.c **** 2319 .loc 1 1256 0 0 000089F2 E960FC jmp _.L237 2321 _.LVL170: 2322 _.L186: 1260:inthndlr.c **** goto long_check; 2323 .loc 1 1260 0 0 000089F5 FF76DC push word ptr [bp-36] 0 000089F8 B8020C mov ax, 3074 0 000089FB E94DFC jmp _.L363 2327 _.L187: 1266:inthndlr.c **** (lr.BX, ((unsigned long)lr.CX << 16) | lr.DX, 2328 .loc 1 1266 0 0 000089FE 807ED801 cmp byte ptr [bp-40], 1 0 00008A02 19C0 sbb ax, ax 0 00008A04 40 inc ax 0 00008A05 50 push ax 0 00008A06 FF76E0 push word ptr [bp-32] 0 00008A09 FF76E2 push word ptr [bp-30] 0 00008A0C FF76DC push word ptr [bp-36] 0 00008A0F FF76DE push word ptr [bp-34] 0 00008A12 FF76DA push word ptr [bp-38] 0 00008A15 E8[FEFF] call _DosLockUnlock 2339 _.LVL171: 0 00008A18 8946E8 mov word ptr [bp-24], ax 2341 _.L386: 1296:inthndlr.c **** goto error_exit; 2342 .loc 1 1296 0 0 00008A1B 85C0 test ax, ax 2344 _.L368: 1488:inthndlr.c **** goto error_exit; 2345 .loc 1 1488 0 0 00008A1D 7403E9C4FD jne _.L249 0 00008A22 E9AFF7 jmp _.L202 2348 _.L188: 1276:inthndlr.c **** { 2349 .loc 1 1276 0 0 00008A25 807ED80A cmp byte ptr [bp-40], 10 0 00008A29 7603E99500 ja _.L263 0 00008A2E 8A46D8 mov al, byte ptr [bp-40] 0 00008A31 30E4 xor ah, ah 0 00008A33 D1E0 shl ax, 1 0 00008A35 93 xchg bx, ax 0 00008A36 FFA7[0801] jmp word ptr [bx+_.L265] === Switch to base=012BB0h -> ".RODATA" 2357 .section .rodata 2358 .p2align 1 2359 .p2align 2 2360 _.L265: 0 00001788 [910E] .hword _.L264 0 0000178A [1A0F] .hword _.L263 0 0000178C [1A0F] .hword _.L263 0 0000178E [1A0F] .hword _.L263 0 00001790 [1A0F] .hword _.L263 0 00001792 [1A0F] .hword _.L263 0 00001794 [A80E] .hword _.L266 0 00001796 [CC0E] .hword _.L267 0 00001798 [CC0E] .hword _.L267 0 0000179A [CC0E] .hword _.L267 0 0000179C [E80E] .hword _.L268 === Switch to base=002270h -> ".TEXT" 2372 .text 2373 _.L264: 1280:inthndlr.c **** goto dispatch; 2374 .loc 1 1280 0 0 00008A3A B81000 mov ax, 16 0 00008A3D 50 push ax 0 00008A3E FF76E4 push word ptr [bp-28] 0 00008A41 FF76DE push word ptr [bp-34] 0 00008A44 FF76D2 push word ptr [bp-46] 0 00008A47 8D46D8 lea ax, [-40+bp] 0 00008A4A 50 push ax 0 00008A4B E8[FEFF] call _fmemcpy 2383 _.LVL172: 1281:inthndlr.c **** 2384 .loc 1 1281 0 0 00008A4E E9E1F6 jmp _.L98 2386 _.L266: 1284:inthndlr.c **** lr.SI = FP_OFF(internal_data); 2387 .loc 1 1284 0 0 00008A51 BA[0000] mov dx, offset _internal_data 0 00008A54 8C56E4 mov word ptr [bp-28], ss 1285:inthndlr.c **** lr.CX = swap_indos - internal_data; 2390 .loc 1 1285 0 0 00008A57 8956E0 mov word ptr [bp-32], dx 1286:inthndlr.c **** lr.DX = swap_always - internal_data; 2392 .loc 1 1286 0 0 00008A5A B8[0000] mov ax, offset _swap_indos 0 00008A5D 29D0 sub ax, dx 0 00008A5F 8946DC mov word ptr [bp-36], ax 1287:inthndlr.c **** CLEAR_CARRY_FLAG(); 2396 .loc 1 1287 0 0 00008A62 B8[0000] mov ax, offset _swap_always 0 00008A65 29D0 sub ax, dx 0 00008A67 8946DE mov word ptr [bp-34], ax 2400 _.L370: 2401 _.LBB29: 1309:inthndlr.c **** break; 2402 .loc 1 1309 0 0 00008A6A 8E46D6 mov es, word ptr [bp-42] 0 00008A6D 26806516FE and byte ptr es:[di+22], -2 1310:inthndlr.c **** } 2405 .loc 1 1310 0 0 00008A72 E95FF7 jmp _.L202 2407 _.L267: 2408 _.LBE29: 1294:inthndlr.c **** CLEAR_CARRY_FLAG(); 2409 .loc 1 1294 0 0 00008A75 FF36[0000] push word ptr [_Int21AX] 0 00008A79 56 push si 0 00008A7A FF76DE push word ptr [bp-34] 0 00008A7D B82511 mov ax, 4389 0 00008A80 50 push ax 0 00008A81 E8[FEFF] call _network_redirector_mx 2416 _.LVL173: 0 00008A84 8946E8 mov word ptr [bp-24], ax 1295:inthndlr.c **** if (rc != SUCCESS) 2418 .loc 1 1295 0 0 00008A87 8E46D6 mov es, word ptr [bp-42] 0 00008A8A 26806516FE and byte ptr es:[di+22], -2 0 00008A8F EB8A jmp _.L386 2422 _.L268: 2423 _.LBB30: 1303:inthndlr.c **** CritErrCode = er->AX; 2424 .loc 1 1303 0 0 00008A91 8B5EDE mov bx, word ptr [bp-34] 2426 _.LVL174: 1304:inthndlr.c **** CritErrDev = MK_FP(er->ES, er->DI); 2427 .loc 1 1304 0 0 00008A94 8E46E4 mov es, word ptr [bp-28] 0 00008A97 268B07 mov ax, word ptr es:[bx] 0 00008A9A A3[0000] mov word ptr [_CritErrCode], ax 1305:inthndlr.c **** CritErrLocus = er->CH; 2431 .loc 1 1305 0 0 00008A9D 268B570E mov dx, word ptr es:[bx+14] 0 00008AA1 268B470A mov ax, word ptr es:[bx+10] 0 00008AA5 A3[0000] mov word ptr [_CritErrDev], ax 0 00008AA8 8916[0200] mov word ptr [_CritErrDev+2], dx 1306:inthndlr.c **** CritErrClass = er->BH; 2436 .loc 1 1306 0 0 00008AAC 268A4705 mov al, byte ptr es:[bx+5] 0 00008AB0 A2[0000] mov byte ptr [_CritErrLocus], al 1307:inthndlr.c **** CritErrAction = er->BL; 2439 .loc 1 1307 0 0 00008AB3 268A4703 mov al, byte ptr es:[bx+3] 0 00008AB7 A2[0000] mov byte ptr [_CritErrClass], al 1308:inthndlr.c **** CLEAR_CARRY_FLAG(); 2442 .loc 1 1308 0 0 00008ABA 268A4702 mov al, byte ptr es:[bx+2] 0 00008ABE A2[0000] mov byte ptr [_CritErrAction], al 0 00008AC1 EBA7 jmp _.L370 2446 _.LVL175: 2447 _.L263: 2448 _.LBE30: 1314:inthndlr.c **** goto error_invalid; 2449 .loc 1 1314 0 0 00008AC3 C706[0000]0000 mov word ptr [_CritErrCode], 0 1315:inthndlr.c **** } 2451 .loc 1 1315 0 0 00008AC9 E9EFFA jmp _.L193 2453 _.L189: 1320:inthndlr.c **** { 2454 .loc 1 1320 0 0 00008ACC 8A46D8 mov al, byte ptr [bp-40] 0 00008ACF 84C0 test al, al 0 00008AD1 7419 je _.L270 0 00008AD3 3C01 cmp al, 1 0 00008AD5 7424 je _.L271 1331:inthndlr.c **** goto short_check; 2460 .loc 1 1331 0 0 00008AD7 FF36[0000] push word ptr [_Int21AX] 0 00008ADB FF76D2 push word ptr [bp-46] 0 00008ADE 8D46D8 lea ax, [-40+bp] 0 00008AE1 50 push ax 0 00008AE2 B81F11 mov ax, 4383 0 00008AE5 50 push ax 0 00008AE6 E8[FEFF] call _network_redirector_mx 2468 _.LVL176: 0 00008AE9 E904FB jmp _.L298 2470 _.L270: 1323:inthndlr.c **** break; 2471 .loc 1 1323 0 0 00008AEC FF76E4 push word ptr [bp-28] 0 00008AEF FF76DE push word ptr [bp-34] 0 00008AF2 E8[FEFF] call _get_machine_name 2475 _.LVL177: 0 00008AF5 8946DC mov word ptr [bp-36], ax 1324:inthndlr.c **** 2477 .loc 1 1324 0 0 00008AF8 E9D9F6 jmp _.L202 2479 _.L271: 1327:inthndlr.c **** break; 2480 .loc 1 1327 0 0 00008AFB FF76DC push word ptr [bp-36] 0 00008AFE FF76E4 push word ptr [bp-28] 0 00008B01 FF76DE push word ptr [bp-34] 0 00008B04 E8[FEFF] call _set_machine_name 2485 _.LVL178: 1328:inthndlr.c **** 2486 .loc 1 1328 0 0 00008B07 E9CAF6 jmp _.L202 2488 _.L190: 1337:inthndlr.c **** { 2489 .loc 1 1337 0 0 00008B0A 8A56D8 mov dl, byte ptr [bp-40] 0 00008B0D 88D0 mov al, dl 0 00008B0F 04F9 add al, -7 0 00008B11 3C01 cmp al, 1 0 00008B13 7741 ja _.L272 1339:inthndlr.c **** { 2495 .loc 1 1339 0 0 00008B15 8A46DE mov al, byte ptr [bp-34] 0 00008B18 3A06[0000] cmp al, byte ptr [_lastdrive] 0 00008B1C 7330 jnc _.L273 2499 _.LBB31: 1341:inthndlr.c **** if (FP_OFF(cdsp->cdsDpb)) /* letter of physical drive? */ 2500 .loc 1 1341 0 0 00008B1E B358 mov bl, 88 0 00008B20 F6E3 mul bl 0 00008B22 8B0E[0200] mov cx, word ptr [_CDSp+2] 0 00008B26 0306[0000] add ax, word ptr [_CDSp] 0 00008B2A 93 xchg bx, ax 2506 _.LVL179: 1342:inthndlr.c **** { 2507 .loc 1 1342 0 0 00008B2B 8EC1 mov es, cx 0 00008B2D 26837F4501 cmp word ptr es:[bx+69], 1 0 00008B32 721A jc _.L273 1344:inthndlr.c **** if (lr.AL == 7) 2511 .loc 1 1344 0 0 00008B34 268B4743 mov ax, word ptr es:[bx+67] 2513 _.LVL180: 0 00008B38 80E4BF and ah, -65 1345:inthndlr.c **** cdsp->cdsFlags |= CDSPHYSDRV; 2515 .loc 1 1345 0 0 00008B3B 80FA07 cmp dl, 7 0 00008B3E 7407 je _.L274 2518 _.L375: 1346:inthndlr.c **** break; 2519 .loc 1 1346 0 0 00008B40 26894743 mov word ptr es:[bx+67], ax 0 00008B44 E98DF6 jmp _.L202 2522 _.L274: 0 00008B47 80CC40 or ah, 64 0 00008B4A 8EC1 mov es, cx 0 00008B4C EBF2 jmp _.L375 2526 _.LVL181: 2527 _.L273: 2528 _.LBE31: 1350:inthndlr.c **** goto error_exit; 2529 .loc 1 1350 0 0 00008B4E C746E8F1FF mov word ptr [bp-24], -15 1351:inthndlr.c **** } 2531 .loc 1 1351 0 0 00008B53 E990FC jmp _.L249 2533 _.L272: 1355:inthndlr.c **** /* the remote function manipulates *r directly !, 2534 .loc 1 1355 0 0 00008B56 FF36[0000] push word ptr [_Int21AX] 0 00008B5A FF76D2 push word ptr [bp-46] 0 00008B5D 8D46D8 lea ax, [-40+bp] 0 00008B60 50 push ax 0 00008B61 B81E11 mov ax, 4382 0 00008B64 50 push ax 0 00008B65 E8[FEFF] call _network_redirector_mx 2542 _.LVL182: 0 00008B68 8946E8 mov word ptr [bp-24], ax 1358:inthndlr.c **** { 2544 .loc 1 1358 0 0 00008B6B 85C0 test ax, ax 0 00008B6D 7410 je _.L275 1360:inthndlr.c **** SET_CARRY_FLAG(); 2547 .loc 1 1360 0 0 00008B6F 89C2 mov dx, ax 0 00008B71 F7DA neg dx 0 00008B73 8916[0000] mov word ptr [_CritErrCode], dx 1361:inthndlr.c **** } 2551 .loc 1 1361 0 0 00008B77 8E46D6 mov es, word ptr [bp-42] 0 00008B7A 26804D1601 or byte ptr es:[di+22], 1 2554 _.L275: 1363:inthndlr.c **** goto real_exit; 2555 .loc 1 1363 0 0 00008B7F F7D8 neg ax 0 00008B81 8E46D6 mov es, word ptr [bp-42] 0 00008B84 268905 mov word ptr es:[di], ax 2559 _.L97: 2560 .loc 1 1770 0 0 00008B87 89EC mov sp, bp 0 00008B89 5D pop bp 0 00008B8A 5F pop di 0 00008B8B 5E pop si 0 00008B8C C3 ret 2566 _.L191: 1368:inthndlr.c **** lr.AX = rc; 2567 .loc 1 1368 0 0 00008B8D FF76E6 push word ptr [bp-26] 0 00008B90 FF76E2 push word ptr [bp-30] 0 00008B93 E8[FEFF] call _adjust_far 2571 _.LVL183: 0 00008B96 52 push dx 0 00008B97 50 push ax 0 00008B98 FF76E4 push word ptr [bp-28] 0 00008B9B FF76E0 push word ptr [bp-32] 0 00008B9E E8[FEFF] call _DosTruename 2577 _.LVL184: 0 00008BA1 8946E8 mov word ptr [bp-24], ax 0 00008BA4 E941FB jmp _.L366 2580 _.L192: 2581 _.LBB32: 1409:inthndlr.c **** { 2582 .loc 1 1409 0 0 00008BA7 8A46D8 mov al, byte ptr [bp-40] 0 00008BAA 3C01 cmp al, 1 0 00008BAC 7503E98BF9 je _.L280 0 00008BB1 720A jc _.L279 0 00008BB3 3C02 cmp al, 2 0 00008BB5 7503E982F9 je _.L280 0 00008BBA E9FEF9 jmp _.L193 2590 _.L279: 1412:inthndlr.c **** lr.DS = FP_SEG(p); 2591 .loc 1 1412 0 0 00008BBD E8[FEFF] call _DosGetDBCS 2593 _.LVL185: 2594 _.LVL186: 1413:inthndlr.c **** lr.SI = FP_OFF(p) + 2; 2595 .loc 1 1413 0 0 00008BC0 8956E4 mov word ptr [bp-28], dx 1414:inthndlr.c **** break; 2597 .loc 1 1414 0 0 00008BC3 83C002 add ax, 2 2599 _.LVL187: 0 00008BC6 E940F8 jmp _.L376 2601 _.LVL188: 2602 _.L194: 2603 _.LBE32: 1435:inthndlr.c **** { 2604 .loc 1 1435 0 0 00008BC9 8A46D8 mov al, byte ptr [bp-40] 0 00008BCC 3C23 cmp al, 35 0 00008BCE 7503E98100 je _.L282 0 00008BD3 7722 ja _.L283 0 00008BD5 3C21 cmp al, 33 0 00008BD7 7445 je _.L284 0 00008BD9 7752 ja _.L285 0 00008BDB 3C20 cmp al, 32 0 00008BDD 7430 je _.L286 2614 _.L281: 1468:inthndlr.c **** goto short_check; 2615 .loc 1 1468 0 0 00008BDF FF76E6 push word ptr [bp-26] 0 00008BE2 FF76E2 push word ptr [bp-30] 0 00008BE5 FF76DC push word ptr [bp-36] 0 00008BE8 FF76DE push word ptr [bp-34] 0 00008BEB FF76DA push word ptr [bp-38] 1435:inthndlr.c **** { 2621 .loc 1 1435 0 0 00008BEE 30E4 xor ah, ah 1468:inthndlr.c **** goto short_check; 2623 .loc 1 1468 0 0 00008BF0 50 push ax 0 00008BF1 E8[FEFF] call _DosGetData 2626 _.LVL189: 0 00008BF4 E9F9F9 jmp _.L298 2628 _.L283: 1435:inthndlr.c **** { 2629 .loc 1 1435 0 0 00008BF7 3CA1 cmp al, -95 0 00008BF9 743E je _.L287 0 00008BFB 3CA2 cmp al, -94 0 00008BFD 7449 je _.L288 0 00008BFF 3CA0 cmp al, -96 0 00008C01 75DC jne _.L281 1447:inthndlr.c **** break; 2636 .loc 1 1447 0 0 00008C03 FF76DE push word ptr [bp-34] 0 00008C06 E8[FEFF] call _DosUpFChar 2639 _.LVL190: 0 00008C09 8846DE mov byte ptr [bp-34], al 1448:inthndlr.c **** case 0xA1: /* upcase memory area of filenames */ 2641 .loc 1 1448 0 0 00008C0C E9C5F5 jmp _.L202 2643 _.L286: 1438:inthndlr.c **** break; 2644 .loc 1 1438 0 0 00008C0F FF76DE push word ptr [bp-34] 0 00008C12 E8[FEFF] call _DosUpChar 2647 _.LVL191: 0 00008C15 8846DE mov byte ptr [bp-34], al 1439:inthndlr.c **** case 0x21: /* upcase memory area */ 2649 .loc 1 1439 0 0 00008C18 83C402 add sp, 2 0 00008C1B E9B6F5 jmp _.L202 2652 _.L284: 1441:inthndlr.c **** break; 2653 .loc 1 1441 0 0 00008C1E FF76DC push word ptr [bp-36] 0 00008C21 FF76E4 push word ptr [bp-28] 0 00008C24 FF76DE push word ptr [bp-34] 0 00008C27 E8[FEFF] call _DosUpMem 2658 _.LVL192: 1442:inthndlr.c **** case 0x22: /* upcase ASCIZ */ 2659 .loc 1 1442 0 0 00008C2A E9A7F5 jmp _.L202 2661 _.L285: 1444:inthndlr.c **** break; 2662 .loc 1 1444 0 0 00008C2D FF76E4 push word ptr [bp-28] 0 00008C30 FF76DE push word ptr [bp-34] 0 00008C33 E8[FEFF] call _DosUpString 2666 _.LVL193: 1445:inthndlr.c **** case 0xA0: /* upcase single character of filenames */ 2667 .loc 1 1445 0 0 00008C36 E99BF5 jmp _.L202 2669 _.L287: 1450:inthndlr.c **** break; 2670 .loc 1 1450 0 0 00008C39 FF76DC push word ptr [bp-36] 0 00008C3C FF76E4 push word ptr [bp-28] 0 00008C3F FF76DE push word ptr [bp-34] 0 00008C42 E8[FEFF] call _DosUpFMem 2675 _.LVL194: 1451:inthndlr.c **** case 0xA2: /* upcase ASCIZ of filenames */ 2676 .loc 1 1451 0 0 00008C45 E98CF5 jmp _.L202 2678 _.L288: 1453:inthndlr.c **** break; 2679 .loc 1 1453 0 0 00008C48 FF76E4 push word ptr [bp-28] 0 00008C4B FF76DE push word ptr [bp-34] 0 00008C4E E8[FEFF] call _DosUpFString 2683 _.LVL195: 1454:inthndlr.c **** case 0x23: /* check Yes/No response */ 2684 .loc 1 1454 0 0 00008C51 E980F5 jmp _.L202 2686 _.L282: 1456:inthndlr.c **** break; 2687 .loc 1 1456 0 0 00008C54 8A46DE mov al, byte ptr [bp-34] 0 00008C57 30E4 xor ah, ah 0 00008C59 50 push ax 0 00008C5A E8[FEFF] call _DosYesNo 2692 _.LVL196: 0 00008C5D 98 cbw 0 00008C5E E949F9 jmp _.L300 2695 _.L195: 1476:inthndlr.c **** { 2696 .loc 1 1476 0 0 00008C61 8A46D8 mov al, byte ptr [bp-40] 0 00008C64 3C01 cmp al, 1 0 00008C66 7412 je _.L290 0 00008C68 3C02 cmp al, 2 0 00008C6A 7403E94CF9 jne _.L193 1482:inthndlr.c **** break; 2702 .loc 1 1482 0 0 00008C6F FF76DE push word ptr [bp-34] 0 00008C72 FF76DA push word ptr [bp-38] 0 00008C75 E8[FEFF] call _DosSetCodepage 2706 _.LVL197: 0 00008C78 EB0B jmp _.L362 2708 _.L290: 1479:inthndlr.c **** break; 2709 .loc 1 1479 0 0 00008C7A 8D46DE lea ax, [-34+bp] 0 00008C7D 50 push ax 0 00008C7E 8D46DA lea ax, [-38+bp] 0 00008C81 50 push ax 0 00008C82 E8[FEFF] call _DosGetCodepage 2715 _.LVL198: 2716 _.L362: 1482:inthndlr.c **** break; 2717 .loc 1 1482 0 0 00008C85 8946E8 mov word ptr [bp-24], ax 1488:inthndlr.c **** goto error_exit; 2719 .loc 1 1488 0 0 00008C88 837EE800 cmp word ptr [bp-24], 0 0 00008C8C E98EFD jmp _.L368 2722 _.L196: 1494:inthndlr.c **** goto short_check; 2723 .loc 1 1494 0 0 00008C8F FF76DA push word ptr [bp-38] 0 00008C92 E8[FEFF] call _SetJFTSize 2726 _.LVL199: 0 00008C95 E958F9 jmp _.L298 2728 _.L197: 1500:inthndlr.c **** goto short_check; 2729 .loc 1 1500 0 0 00008C98 FF76DA push word ptr [bp-38] 0 00008C9B E8[FEFF] call _get_sft_idx 2732 _.LVL200: 0 00008C9E BA0100 mov dx, 1 0 00008CA1 52 push dx 0 00008CA2 50 push ax 0 00008CA3 E8[FEFF] call _DosCloseSft 2737 _.LVL201: 0 00008CA6 E947F9 jmp _.L298 2739 _.L198: 1505:inthndlr.c **** if (lr.AL < 2) 2740 .loc 1 1505 0 0 00008CA9 8A46DA mov al, byte ptr [bp-38] 0 00008CAC 84C0 test al, al 0 00008CAE 754B jne _.L293 1505:inthndlr.c **** if (lr.AL < 2) 2744 .loc 1 1505 0 is_stmt 0 discriminator 1 0 00008CB0 A0[0000] mov al, byte ptr [_default_drive] 0 00008CB3 98 cbw 2747 _.L294: 1505:inthndlr.c **** if (lr.AL < 2) 2748 .loc 1 1505 0 discriminator 4 0 00008CB4 8946E8 mov word ptr [bp-24], ax 1506:inthndlr.c **** { 2750 .loc 1 1506 0 is_stmt 1 discriminator 4 0 00008CB7 807ED801 cmp byte ptr [bp-40], 1 0 00008CBB 7603E9FBF8 ja _.L193 1508:inthndlr.c **** { 2753 .loc 1 1508 0 0 00008CC0 50 push ax 0 00008CC1 E8[FEFF] call _get_cds 2756 _.LVL202: 0 00008CC4 09D0 or ax, dx 0 00008CC6 7503E983FE je _.L273 1513:inthndlr.c **** { 2759 .loc 1 1513 0 0 00008CCB FF76E8 push word ptr [bp-24] 0 00008CCE E8[FEFF] call _get_dpb 2762 _.LVL203: 0 00008CD1 09D0 or ax, dx 0 00008CD3 7503E9E3F8 je _.L193 2765 _.LBB33: 1515:inthndlr.c **** lr.CX = lr.AL == 0 ? 0x0866 : 0x0846; 2766 .loc 1 1515 0 0 00008CD8 8B76DC mov si, word ptr [bp-36] 2768 _.LVL204: 1516:inthndlr.c **** lr.AL = 0x0d; 2769 .loc 1 1516 0 0 00008CDB 807ED800 cmp byte ptr [bp-40], 0 0 00008CDF 751F jne _.L312 0 00008CE1 B86608 mov ax, 2150 2773 _.L297: 1516:inthndlr.c **** lr.AL = 0x0d; 2774 .loc 1 1516 0 is_stmt 0 discriminator 4 0 00008CE4 8946DC mov word ptr [bp-36], ax 1517:inthndlr.c **** rc = DosDevIOctl(&lr); 2776 .loc 1 1517 0 is_stmt 1 discriminator 4 0 00008CE7 C646D80D mov byte ptr [bp-40], 13 1518:inthndlr.c **** lr.CX = saveCX; 2778 .loc 1 1518 0 discriminator 4 0 00008CEB 8D46D8 lea ax, [-40+bp] 0 00008CEE 50 push ax 0 00008CEF E8[FEFF] call _DosDevIOctl 2782 _.LVL205: 0 00008CF2 8946E8 mov word ptr [bp-24], ax 1519:inthndlr.c **** goto short_check; 2784 .loc 1 1519 0 discriminator 4 0 00008CF5 8976DC mov word ptr [bp-36], si 1520:inthndlr.c **** } 2786 .loc 1 1520 0 discriminator 4 0 00008CF8 E942FA jmp _.L233 2788 _.LVL206: 2789 _.L293: 2790 _.LBE33: 1505:inthndlr.c **** if (lr.AL < 2) 2791 .loc 1 1505 0 discriminator 2 0 00008CFB 30E4 xor ah, ah 0 00008CFD 48 dec ax 0 00008CFE EBB4 jmp _.L294 2795 _.LVL207: 2796 _.L312: 2797 _.LBB34: 1516:inthndlr.c **** lr.AL = 0x0d; 2798 .loc 1 1516 0 0 00008D00 B84608 mov ax, 2118 0 00008D03 EBDF jmp _.L297 2801 _.LVL208: 2802 _.L199: 2803 _.LBE34: 1531:inthndlr.c **** goto error_invalid; 2804 .loc 1 1531 0 0 00008D05 8A46DE mov al, byte ptr [bp-34] 0 00008D08 88C4 mov ah, al 0 00008D0A 80E4EF and ah, -17 0 00008D0D 80FC02 cmp ah, 2 0 00008D10 7603E9A6F8 ja _.L193 0 00008D15 30E4 xor ah, ah 1533:inthndlr.c **** (lr.BX & 0x70ff) | ((lr.DL & 3) << 8) | 2811 .loc 1 1533 0 0 00008D17 8A56DC mov dl, byte ptr [bp-36] 0 00008D1A 30F6 xor dh, dh 0 00008D1C 52 push dx 1534:inthndlr.c **** ((lr.DL & 0x10) << 6), lr.CL); 2815 .loc 1 1534 0 0 00008D1D 89C2 mov dx, ax 0 00008D1F B108 mov cl, 8 0 00008D21 D3E2 shl dx, cl 0 00008D23 81E20003 and dx, 768 1535:inthndlr.c **** if (lrc >= SUCCESS) 2820 .loc 1 1535 0 0 00008D27 B106 mov cl, 6 0 00008D29 D3E0 shl ax, cl 0 00008D2B 250004 and ax, 1024 1533:inthndlr.c **** (lr.BX & 0x70ff) | ((lr.DL & 3) << 8) | 2824 .loc 1 1533 0 0 00008D2E 09D0 or ax, dx 1534:inthndlr.c **** ((lr.DL & 0x10) << 6), lr.CL); 2826 .loc 1 1534 0 0 00008D30 8B56DA mov dx, word ptr [bp-38] 0 00008D33 80E670 and dh, 112 1533:inthndlr.c **** (lr.BX & 0x70ff) | ((lr.DL & 3) << 8) | 2829 .loc 1 1533 0 0 00008D36 09D0 or ax, dx 0 00008D38 50 push ax 0 00008D39 FF76E4 push word ptr [bp-28] 0 00008D3C FF76E0 push word ptr [bp-32] 0 00008D3F E8[FEFF] call _DosOpen 2835 _.LVL209: 1536:inthndlr.c **** /* action */ 2836 .loc 1 1536 0 0 00008D42 85D2 test dx, dx 0 00008D44 7D03E9A7F8 jl _.L298 1538:inthndlr.c **** goto long_check; 2839 .loc 1 1538 0 0 00008D49 8956DC mov word ptr [bp-36], dx 0 00008D4C E95BF8 jmp _.L300 2842 _.LVL210: 2843 _.L200: 1546:inthndlr.c **** { 2844 .loc 1 1546 0 0 00008D4F 8A46D8 mov al, byte ptr [bp-40] 0 00008D52 3C42 cmp al, 66 0 00008D54 7407 je _.L302 0 00008D56 3CA6 cmp al, -90 0 00008D58 7403E9C300 jne _.L301 2850 _.L302: 2851 _.LBB35: 1618:inthndlr.c **** { 2852 .loc 1 1618 0 0 00008D5D 8B5EDA mov bx, word ptr [bp-38] 0 00008D60 8E46D4 mov es, word ptr [bp-44] 0 00008D63 263B1E3200 cmp bx, word ptr es:[50] 0 00008D68 7208 jc _.L303 2857 _.L304: 1620:inthndlr.c **** goto error_exit; 2858 .loc 1 1620 0 0 00008D6A C746E8FAFF mov word ptr [bp-24], -6 0 00008D6F E974FA jmp _.L249 2861 _.L303: 2862 _.LVL211: 1623:inthndlr.c **** s = idx_to_sft(idx); 2863 .loc 1 1623 0 0 00008D72 8E46D4 mov es, word ptr [bp-44] 0 00008D75 268B163600 mov dx, word ptr es:[54] 0 00008D7A 26031E3400 add bx, word ptr es:[52] 2867 _.LVL212: 1624:inthndlr.c **** if (s == (sft FAR *)-1) 2868 .loc 1 1624 0 0 00008D7F 8EC2 mov es, dx 0 00008D81 268A07 mov al, byte ptr es:[bx] 0 00008D84 30E4 xor ah, ah 0 00008D86 50 push ax 2873 _.LVL213: 0 00008D87 E8[FEFF] call _idx_to_sft 2875 _.LVL214: 1625:inthndlr.c **** { 2876 .loc 1 1625 0 0 00008D8A 83F8FF cmp ax, -1 0 00008D8D 7505 jne _.L314 0 00008D8F 83FAFF cmp dx, -1 0 00008D92 74D6 je _.L304 2881 _.L314: 1630:inthndlr.c **** if (lr.AL != 0x42) { 2882 .loc 1 1630 0 0 00008D94 8EC2 mov es, dx 0 00008D96 89C3 mov bx, ax 0 00008D98 26837F0500 cmp word ptr es:[bx+5], 0 0 00008D9D 7C06 jl _.L306 1631:inthndlr.c **** goto unsupp; /* unsupported on local fs yet */ 2887 .loc 1 1631 0 0 00008D9F 807ED842 cmp byte ptr [bp-40], 66 0 00008DA3 757B jne _.L301 2890 _.L306: 0 00008DA5 8956CA mov word ptr [bp-54], dx 0 00008DA8 8946CE mov word ptr [bp-50], ax 1636:inthndlr.c **** r->ES = FP_SEG(s); 2893 .loc 1 1636 0 0 00008DAB 8D5EE8 lea bx, [-24+bp] 0 00008DAE 8CD6 mov si, ss 0 00008DB0 B91800 mov cx, 24 0 00008DB3 51 push cx 0 00008DB4 894ED0 mov word ptr [bp-48], cx 0 00008DB7 FF76D6 push word ptr [bp-42] 0 00008DBA 57 push di 0 00008DBB 16 push ss 0 00008DBC 53 push bx 0 00008DBD 895ED4 mov word ptr [bp-44], bx 0 00008DC0 E8[FEFF] call _fmemcpy 2905 _.LVL215: 1637:inthndlr.c **** r->DI = FP_OFF(s); 2906 .loc 1 1637 0 0 00008DC3 8E46D6 mov es, word ptr [bp-42] 0 00008DC6 8B56CA mov dx, word ptr [bp-54] 0 00008DC9 26895510 mov word ptr es:[di+16], dx 2910 _.LVL216: 1638:inthndlr.c **** r->flags |= FLG_CARRY; 2911 .loc 1 1638 0 0 00008DCD 8E46D6 mov es, word ptr [bp-42] 0 00008DD0 8B46CE mov ax, word ptr [bp-50] 0 00008DD3 2689450A mov word ptr es:[di+10], ax 1639:inthndlr.c **** r->AH = 0x11; 2915 .loc 1 1639 0 0 00008DD7 8E46D6 mov es, word ptr [bp-42] 0 00008DDA 26804D1601 or byte ptr es:[di+22], 1 1640:inthndlr.c **** call_intr(0x2f, r); 2918 .loc 1 1640 0 0 00008DDF 8E46D6 mov es, word ptr [bp-42] 0 00008DE2 26C6450111 mov byte ptr es:[di+1], 17 1641:inthndlr.c **** if (!(r->flags & FLG_CARRY)) { 2921 .loc 1 1641 0 0 00008DE7 FF76D6 push word ptr [bp-42] 0 00008DEA 57 push di 0 00008DEB B82F00 mov ax, 47 0 00008DEE 50 push ax 0 00008DEF E8[FEFF] call _call_intr 2927 _.LVL217: 1642:inthndlr.c **** r->ES = saved_r.ES; 2928 .loc 1 1642 0 0 00008DF2 8E46D6 mov es, word ptr [bp-42] 0 00008DF5 26F6451601 test byte ptr es:[di+22], 1 0 00008DFA 8B5ED4 mov bx, word ptr [bp-44] 0 00008DFD 8B4ED0 mov cx, word ptr [bp-48] 0 00008E00 7514 jne _.L308 1643:inthndlr.c **** r->DI = saved_r.DI; 2934 .loc 1 1643 0 0 00008E02 8B46F8 mov ax, word ptr [bp-8] 0 00008E05 26894510 mov word ptr es:[di+16], ax 1644:inthndlr.c **** goto real_exit; 2937 .loc 1 1644 0 0 00008E09 8B46F2 mov ax, word ptr [bp-14] 0 00008E0C 8E46D6 mov es, word ptr [bp-42] 0 00008E0F 2689450A mov word ptr es:[di+10], ax 0 00008E13 E971FD jmp _.L97 2942 _.L308: 1648:inthndlr.c **** goto unsupp; 2943 .loc 1 1648 0 0 00008E16 51 push cx 0 00008E17 56 push si 0 00008E18 53 push bx 0 00008E19 FF76D6 push word ptr [bp-42] 0 00008E1C 57 push di 0 00008E1D E8[FEFF] call _fmemcpy 2950 _.LVL218: 2951 _.L301: 2952 _.LBE35: 1733:inthndlr.c **** goto error_carry; 2953 .loc 1 1733 0 0 00008E20 C646D800 mov byte ptr [bp-40], 0 1734:inthndlr.c **** } 2955 .loc 1 1734 0 0 00008E24 E95CF9 jmp _.L246 2957 _.L201: 1684:inthndlr.c **** CritErrCode = SUCCESS; 2958 .loc 1 1684 0 0 00008E27 8E46D6 mov es, word ptr [bp-42] 0 00008E2A 26806516FE and byte ptr es:[di+22], -2 1685:inthndlr.c **** rc = int21_fat32(&lr); 2961 .loc 1 1685 0 0 00008E2F C706[0000]0000 mov word ptr [_CritErrCode], 0 1686:inthndlr.c **** goto short_check; 2963 .loc 1 1686 0 0 00008E35 8D46D8 lea ax, [-40+bp] 0 00008E38 50 push ax 0 00008E39 E8[FEFF] call _int21_fat32 2967 _.LVL219: 0 00008E3C E9B1F7 jmp _.L298 2969 _.LFE6: 2970 .size _int21_service, .-_int21_service 2971 .global _int2526_handler 2972 .type _int2526_handler, @function 2973 _int2526_handler: 2974 _.LFB7: 1771:inthndlr.c **** 1772:inthndlr.c **** #if 0 1773:inthndlr.c **** /* No kernel INT-23 handler required no longer -- 1999/04/15 ska */ 1774:inthndlr.c **** /* ctrl-Break handler */ 1775:inthndlr.c **** #pragma argsused 1776:inthndlr.c **** VOID INRPT FAR int23_handler(int es, int ds, int di, int si, int bp, 1777:inthndlr.c **** int sp, int bx, int dx, int cx, int ax, 1778:inthndlr.c **** int ip, int cs, int flags) 1779:inthndlr.c **** { 1780:inthndlr.c **** term_type = 1; 1781:inthndlr.c **** return_mode = 1; 1782:inthndlr.c **** return_code = -1; 1783:inthndlr.c **** mod_sto(CTL_C); 1784:inthndlr.c **** DosMemCheck(); 1785:inthndlr.c **** #ifdef TSC 1786:inthndlr.c **** StartTrace(); 1787:inthndlr.c **** #endif 1788:inthndlr.c **** return_user(); 1789:inthndlr.c **** } 1790:inthndlr.c **** #endif 1791:inthndlr.c **** 1792:inthndlr.c **** struct int25regs { 1793:inthndlr.c **** UWORD es, ds; 1794:inthndlr.c **** UWORD di, si, bp, sp; 1795:inthndlr.c **** UWORD bx, dx, cx, ax; 1796:inthndlr.c **** UWORD flags, ip, cs; 1797:inthndlr.c **** }; 1798:inthndlr.c **** 1799:inthndlr.c **** /* 1800:inthndlr.c **** this function is called from an assembler wrapper function 1801:inthndlr.c **** */ 1802:inthndlr.c **** VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r) 1803:inthndlr.c **** { 2975 .loc 1 1803 0 2976 _.LVL220: 0 00008E3F 56 push si 0 00008E40 57 push di 0 00008E41 55 push bp 2980 _.LCFI5: 0 00008E42 89E5 mov bp, sp 2982 _.LCFI6: 0 00008E44 83EC0E sub sp, 14 0 00008E47 8B5E0A mov bx, word ptr [bp+10] 0 00008E4A 8B460C mov ax, word ptr [bp+12] 0 00008E4D 8946FE mov word ptr [bp-2], ax 1804:inthndlr.c **** ULONG blkno; 1805:inthndlr.c **** UWORD nblks; 1806:inthndlr.c **** BYTE FAR *buf; 1807:inthndlr.c **** UBYTE drv; 1808:inthndlr.c **** struct dpb FAR *dpbp; 1809:inthndlr.c **** 1810:inthndlr.c **** if (mode == 0x26) 1811:inthndlr.c **** mode = DSKWRITEINT26; 1812:inthndlr.c **** else 1813:inthndlr.c **** mode = DSKREADINT25; 2987 .loc 1 1813 0 0 00008E50 837E0826 cmp word ptr [bp+8], 38 0 00008E54 9F lahf 0 00008E55 D0E4 shl ah, 1 0 00008E57 99 cwd 0 00008E58 8956FA mov word ptr [bp-6], dx 0 00008E5B 8346FA04 add word ptr [bp-6], 4 2994 _.LVL221: 1814:inthndlr.c **** 1815:inthndlr.c **** drv = r->ax & 0x7f; /* according to RBIL, some programs may try with */ 2995 .loc 1 1815 0 0 00008E5F 8E46FE mov es, word ptr [bp-2] 0 00008E62 268B4712 mov ax, word ptr es:[bx+18] 0 00008E66 895EF6 mov word ptr [bp-10], bx 0 00008E69 8946FC mov word ptr [bp-4], ax 0 00008E6C 8A4EFC mov cl, byte ptr [bp-4] 0 00008E6F 80E17F and cl, 127 3002 _.LVL222: 1816:inthndlr.c **** /* high bit of AL set, so mask it together with AH */ 1817:inthndlr.c **** /* otherwise we might access a non-existing unit */ 1818:inthndlr.c **** 1819:inthndlr.c **** dpbp = get_dpb(drv); 3003 .loc 1 1819 0 0 00008E72 884EFC mov byte ptr [bp-4], cl 0 00008E75 884EF8 mov byte ptr [bp-8], cl 0 00008E78 C646FD00 mov byte ptr [bp-3], 0 0 00008E7C FF76FC push word ptr [bp-4] 0 00008E7F E8[FEFF] call _get_dpb 3009 _.LVL223: 1820:inthndlr.c **** 1821:inthndlr.c **** if (drv >= lastdrive || dpbp == NULL) 3010 .loc 1 1821 0 0 00008E82 8A4EF8 mov cl, byte ptr [bp-8] 1822:inthndlr.c **** { 1823:inthndlr.c **** r->ax = 0x201; 1824:inthndlr.c **** SET_CARRY_FLAG(); 1825:inthndlr.c **** return; 1826:inthndlr.c **** } 1827:inthndlr.c **** 1828:inthndlr.c **** nblks = r->cx; 3012 .loc 1 1828 0 0 00008E85 8E46FE mov es, word ptr [bp-2] 1821:inthndlr.c **** { 3014 .loc 1 1821 0 0 00008E88 363A0E[0000] cmp cl, byte ptr ss:[_lastdrive] 0 00008E8D 8B5EF6 mov bx, word ptr [bp-10] 0 00008E90 7306 jnc _.L401 0 00008E92 89C6 mov si, ax 0 00008E94 09D0 or ax, dx 3020 _.LVL224: 0 00008E96 7514 jne _.L389 3022 _.LVL225: 3023 _.L401: 1823:inthndlr.c **** SET_CARRY_FLAG(); 3024 .loc 1 1823 0 0 00008E98 26C747120102 mov word ptr es:[bx+18], 513 3026 _.LVL226: 3027 _.L409: 1829:inthndlr.c **** blkno = r->dx; 1830:inthndlr.c **** 1831:inthndlr.c **** #ifdef WITHFAT32 1832:inthndlr.c **** { 1833:inthndlr.c **** /* if reading / writing block other than bootsecter, 1834:inthndlr.c **** prevent using INT25,26 on initialized FAT32 */ 1835:inthndlr.c **** if ((blkno != 0) && ISFAT32(dpbp) && (dpbp->dpb_xfatsize != 0)) 1836:inthndlr.c **** { 1837:inthndlr.c **** r->ax = 0x207; 1838:inthndlr.c **** SET_CARRY_FLAG(); 3028 .loc 1 1838 0 discriminator 2 0 00008E9E 8E46FE mov es, word ptr [bp-2] 0 00008EA1 26804F1401 or byte ptr es:[bx+20], 1 3031 _.L387: 1839:inthndlr.c **** return; 1840:inthndlr.c **** } 1841:inthndlr.c **** } 1842:inthndlr.c **** #endif 1843:inthndlr.c **** 1844:inthndlr.c **** buf = MK_FP(r->ds, r->bx); 1845:inthndlr.c **** 1846:inthndlr.c **** if (nblks == 0xFFFF) 1847:inthndlr.c **** { 1848:inthndlr.c **** /*struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx); */ 1849:inthndlr.c **** blkno = ((struct HugeSectorBlock FAR *)buf)->blkno; 1850:inthndlr.c **** nblks = ((struct HugeSectorBlock FAR *)buf)->nblks; 1851:inthndlr.c **** buf = ((struct HugeSectorBlock FAR *)buf)->buf; 1852:inthndlr.c **** } 1853:inthndlr.c **** 1854:inthndlr.c **** InDOS++; 1855:inthndlr.c **** 1856:inthndlr.c **** if (mode == DSKWRITEINT26) 1857:inthndlr.c **** DeleteBlockInBufferCache(blkno, blkno, drv, XFR_WRITE); 1858:inthndlr.c **** r->ax = dskxfer(drv, blkno, buf, nblks, mode); 1859:inthndlr.c **** 1860:inthndlr.c **** CLEAR_CARRY_FLAG(); 1861:inthndlr.c **** if (r->ax != 0) 1862:inthndlr.c **** { 1863:inthndlr.c **** SET_CARRY_FLAG(); 1864:inthndlr.c **** if (mode == DSKWRITEINT26) 1865:inthndlr.c **** setinvld(drv); 1866:inthndlr.c **** } 1867:inthndlr.c **** --InDOS; 1868:inthndlr.c **** } 3032 .loc 1 1868 0 0 00008EA6 89EC mov sp, bp 0 00008EA8 5D pop bp 0 00008EA9 5F pop di 0 00008EAA 5E pop si 0 00008EAB C3 ret 3038 _.LVL227: 3039 _.L389: 1828:inthndlr.c **** blkno = r->dx; 3040 .loc 1 1828 0 0 00008EAC 268B4710 mov ax, word ptr es:[bx+16] 0 00008EB0 8946F8 mov word ptr [bp-8], ax 3043 _.LVL228: 1829:inthndlr.c **** blkno = r->dx; 3044 .loc 1 1829 0 0 00008EB3 268B7F0E mov di, word ptr es:[bx+14] 0 00008EB7 31C9 xor cx, cx 3047 _.LVL229: 1835:inthndlr.c **** { 3048 .loc 1 1835 0 0 00008EB9 39CF cmp di, cx 0 00008EBB 741D je _.L392 0 00008EBD 8EC2 mov es, dx 0 00008EBF 26394C0F cmp word ptr es:[si+15], cx 0 00008EC3 7515 jne _.L392 1835:inthndlr.c **** { 3054 .loc 1 1835 0 is_stmt 0 discriminator 2 0 00008EC5 268B4433 mov ax, word ptr es:[si+51] 3056 _.LVL230: 0 00008EC9 260B4431 or ax, word ptr es:[si+49] 0 00008ECD 740B je _.L392 1837:inthndlr.c **** SET_CARRY_FLAG(); 3059 .loc 1 1837 0 is_stmt 1 discriminator 2 0 00008ECF 8E46FE mov es, word ptr [bp-2] 0 00008ED2 26C747120702 mov word ptr es:[bx+18], 519 3062 _.LVL231: 0 00008ED8 EBC4 jmp _.L409 3064 _.LVL232: 3065 _.L392: 1844:inthndlr.c **** 3066 .loc 1 1844 0 0 00008EDA 8E46FE mov es, word ptr [bp-2] 0 00008EDD 268B770C mov si, word ptr es:[bx+12] 3069 _.LVL233: 0 00008EE1 89F0 mov ax, si 0 00008EE3 268B5702 mov dx, word ptr es:[bx+2] 3072 _.LVL234: 1846:inthndlr.c **** { 3073 .loc 1 1846 0 0 00008EE7 837EF8FF cmp word ptr [bp-8], -1 0 00008EEB 751B jne _.L395 0 00008EED 8EDB mov ds, bx 1849:inthndlr.c **** nblks = ((struct HugeSectorBlock FAR *)buf)->nblks; 3077 .loc 1 1849 0 0 00008EEF 8EC2 mov es, dx 0 00008EF1 268B3C mov di, word ptr es:[si] 3080 _.LVL235: 1850:inthndlr.c **** buf = ((struct HugeSectorBlock FAR *)buf)->buf; 3081 .loc 1 1850 0 0 00008EF4 26C44C02 les cx, dword ptr es:[si+2] 3083 _.LVL236: 0 00008EF8 8C46F8 mov word ptr [bp-8], es 3085 _.LVL237: 1851:inthndlr.c **** } 3086 .loc 1 1851 0 0 00008EFB 8EC2 mov es, dx 3088 _.LVL238: 0 00008EFD 268B7406 mov si, word ptr es:[si+6] 0 00008F01 93 xchg bx, ax 0 00008F02 268B5708 mov dx, word ptr es:[bx+8] 3092 _.LVL239: 0 00008F06 8CDB mov bx, ds 3094 _.LVL240: 3095 _.L395: 1854:inthndlr.c **** 3096 .loc 1 1854 0 0 00008F08 36FE06[0000] inc byte ptr ss:[_InDOS] 1856:inthndlr.c **** DeleteBlockInBufferCache(blkno, blkno, drv, XFR_WRITE); 3098 .loc 1 1856 0 0 00008F0D 837EFA03 cmp word ptr [bp-6], 3 0 00008F11 7522 jne _.L396 0 00008F13 895EF2 mov word ptr [bp-14], bx 0 00008F16 8956F4 mov word ptr [bp-12], dx 1857:inthndlr.c **** r->ax = dskxfer(drv, blkno, buf, nblks, mode); 3103 .loc 1 1857 0 0 00008F19 B80200 mov ax, 2 0 00008F1C 50 push ax 0 00008F1D FF76FC push word ptr [bp-4] 0 00008F20 51 push cx 0 00008F21 57 push di 0 00008F22 51 push cx 0 00008F23 894EF6 mov word ptr [bp-10], cx 0 00008F26 57 push di 0 00008F27 16 push ss 0 00008F28 1F pop ds 0 00008F29 E8[FEFF] call _DeleteBlockInBufferCache 3115 _.LVL241: 0 00008F2C 8B5EF2 mov bx, word ptr [bp-14] 0 00008F2F 8B56F4 mov dx, word ptr [bp-12] 0 00008F32 8B4EF6 mov cx, word ptr [bp-10] 3119 _.LVL242: 3120 _.L396: 0 00008F35 895EF6 mov word ptr [bp-10], bx 1858:inthndlr.c **** 3122 .loc 1 1858 0 0 00008F38 FF76FA push word ptr [bp-6] 0 00008F3B FF76F8 push word ptr [bp-8] 0 00008F3E 52 push dx 0 00008F3F 56 push si 0 00008F40 51 push cx 0 00008F41 57 push di 0 00008F42 FF76FC push word ptr [bp-4] 0 00008F45 16 push ss 0 00008F46 1F pop ds 0 00008F47 E8[FEFF] call _dskxfer 3133 _.LVL243: 0 00008F4A 8E46FE mov es, word ptr [bp-2] 0 00008F4D 8B5EF6 mov bx, word ptr [bp-10] 0 00008F50 26894712 mov word ptr es:[bx+18], ax 3137 _.LVL244: 1860:inthndlr.c **** if (r->ax != 0) 3138 .loc 1 1860 0 0 00008F54 8E46FE mov es, word ptr [bp-2] 0 00008F57 268B5714 mov dx, word ptr es:[bx+20] 0 00008F5B 83E2FE and dx, -2 1861:inthndlr.c **** { 3142 .loc 1 1861 0 0 00008F5E 85C0 test ax, ax 0 00008F60 750C jne _.L397 1860:inthndlr.c **** if (r->ax != 0) 3145 .loc 1 1860 0 0 00008F62 26895714 mov word ptr es:[bx+20], dx 3147 _.L398: 1867:inthndlr.c **** } 3148 .loc 1 1867 0 0 00008F66 36FE0E[0000] dec byte ptr ss:[_InDOS] 0 00008F6B E938FF jmp _.L387 3151 _.L397: 1863:inthndlr.c **** if (mode == DSKWRITEINT26) 3152 .loc 1 1863 0 0 00008F6E 83CA01 or dx, 1 0 00008F71 8E46FE mov es, word ptr [bp-2] 0 00008F74 26895714 mov word ptr es:[bx+20], dx 1864:inthndlr.c **** setinvld(drv); 3156 .loc 1 1864 0 0 00008F78 837EFA03 cmp word ptr [bp-6], 3 0 00008F7C 75E8 jne _.L398 1865:inthndlr.c **** } 3159 .loc 1 1865 0 0 00008F7E FF76FC push word ptr [bp-4] 0 00008F81 E8[FEFF] call _setinvld 3162 _.LVL245: 0 00008F84 EBE0 jmp _.L398 3164 _.LFE7: 3165 .size _int2526_handler, .-_int2526_handler === Switch to base=012BB0h -> ".RODATA.STR1.1" 3166 .section .rodata.str1.1 3167 _.LC3: 0 000019EE 3F3A5C00 .string "?:\\" 3169 _.LC4: 0 000019F2 756E696D706C656D .string "unimplemented internal dos function INT2F/12" 0 000019FA 656E74656420696E 0 00001A02 7465726E616C2064 0 00001A0A 6F732066756E6374 0 00001A12 696F6E20494E5432 0 00001A1A 462F313200 3171 _.LC5: 0 00001A1F 0A00 .string "\n" === Switch to base=002270h -> ".TEXT" 3173 .text 3174 .global _int2F_12_handler 3175 .type _int2F_12_handler, @function 3176 _int2F_12_handler: 3177 _.LFB8: 1869:inthndlr.c **** 1870:inthndlr.c **** /* 1871:inthndlr.c **** VOID int25_handler(struct int25regs FAR * r) { int2526_handler(DSKREAD,r); } 1872:inthndlr.c **** VOID int26_handler(struct int25regs FAR * r) { int2526_handler(DSKWRITE,r); } 1873:inthndlr.c **** */ 1874:inthndlr.c **** 1875:inthndlr.c **** #ifdef TSC 1876:inthndlr.c **** STATIC VOID StartTrace(VOID) 1877:inthndlr.c **** { 1878:inthndlr.c **** if (bTraceNext) 1879:inthndlr.c **** { 1880:inthndlr.c **** #ifdef DEBUG 1881:inthndlr.c **** bDumpRegs = TRUE; 1882:inthndlr.c **** #endif 1883:inthndlr.c **** bTraceNext = FALSE; 1884:inthndlr.c **** } 1885:inthndlr.c **** #ifdef DEBUG 1886:inthndlr.c **** else 1887:inthndlr.c **** bDumpRegs = FALSE; 1888:inthndlr.c **** #endif 1889:inthndlr.c **** } 1890:inthndlr.c **** #endif 1891:inthndlr.c **** 1892:inthndlr.c **** /* this function is called from an assembler wrapper function 1893:inthndlr.c **** and serves the internal dos calls - int2f/12xx and int2f/4a01,4a02. 1894:inthndlr.c **** */ 1895:inthndlr.c **** struct int2f12regs { 1896:inthndlr.c **** #ifdef I386 1897:inthndlr.c **** #ifdef __WATCOMC__ 1898:inthndlr.c **** /* UWORD gs, fs; ** GS/FS are protected through SI/DI */ 1899:inthndlr.c **** #else 1900:inthndlr.c **** UWORD high_edx, 1901:inthndlr.c **** #ifdef _MSC_VER 1902:inthndlr.c **** high_ecx, 1903:inthndlr.c **** #else /* __BORLANDC__ */ 1904:inthndlr.c **** high_ebx, 1905:inthndlr.c **** #endif 1906:inthndlr.c **** high_eax; 1907:inthndlr.c **** #endif 1908:inthndlr.c **** #endif 1909:inthndlr.c **** UWORD es, ds; 1910:inthndlr.c **** UWORD di, si, bp; 1911:inthndlr.c **** xreg b, d, c, a; 1912:inthndlr.c **** UWORD ip, cs, flags; 1913:inthndlr.c **** UWORD callerARG1; /* used if called from INT2F/12 */ 1914:inthndlr.c **** }; 1915:inthndlr.c **** 1916:inthndlr.c **** extern intvec FAR ASM BIOSInt13; 1917:inthndlr.c **** extern intvec FAR ASM UserInt13; 1918:inthndlr.c **** extern intvec FAR ASM BIOSInt19; 1919:inthndlr.c **** 1920:inthndlr.c **** 1921:inthndlr.c **** /* WARNING: modifications in `r' are used outside of int2F_12_handler() 1922:inthndlr.c **** * On input r.AX==0x12xx, 0x4A01 or 0x4A02 1923:inthndlr.c **** * also handle Windows' DOS notification hooks, r.AH==0x16 and r.AH==0x13 1924:inthndlr.c **** * along with DRIVER.SYS/DRIVPARAM r.AH=0x08 calls 1925:inthndlr.c **** */ 1926:inthndlr.c **** VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr) 1927:inthndlr.c **** { 3178 .loc 1 1927 0 3179 _.LVL246: 0 00008F86 56 push si 0 00008F87 57 push di 0 00008F88 55 push bp 3183 _.LCFI7: 0 00008F89 89E5 mov bp, sp 3185 _.LCFI8: 0 00008F8B 83EC2A sub sp, 42 0 00008F8E 8B7608 mov si, word ptr [bp+8] 0 00008F91 8B460A mov ax, word ptr [bp+10] 0 00008F94 8946DE mov word ptr [bp-34], ax 1928:inthndlr.c **** COUNT rc; 1929:inthndlr.c **** long lrc; 1930:inthndlr.c **** UWORD requestedsize; 1931:inthndlr.c **** 1932:inthndlr.c **** #define r (*pr) 1933:inthndlr.c **** 1934:inthndlr.c **** if (r.AH == 0x4a) 3190 .loc 1 1934 0 0 00008F97 8EC0 mov es, ax 0 00008F99 268A4411 mov al, byte ptr es:[si+17] 0 00008F9D 3C4A cmp al, 74 0 00008F9F 7403E9B500 jne _.L411 3195 _.LVL247: 3196 _.LBB36: 1935:inthndlr.c **** { 1936:inthndlr.c **** size_t size = 0, offs = 0xffff, realoffs; /* defaults for no alloc */ 1937:inthndlr.c **** 1938:inthndlr.c **** r.ES = offs; 3197 .loc 1 1938 0 0 00008FA4 26C704FFFF mov word ptr es:[si], -1 3199 _.LVL248: 1939:inthndlr.c **** if (FP_SEG(firstAvailableBuf) == offs) /* HMA present? */ 3200 .loc 1 1939 0 0 00008FA9 A1[0000] mov ax, word ptr [_firstAvailableBuf] 0 00008FAC 8946DA mov word ptr [bp-38], ax 0 00008FAF A1[0200] mov ax, word ptr [_firstAvailableBuf+2] 0 00008FB2 8946DC mov word ptr [bp-36], ax 0 00008FB5 83F8FF cmp ax, -1 0 00008FB8 7403E98E00 jne _.L485 3207 _.LVL249: 1940:inthndlr.c **** { 1941:inthndlr.c **** realoffs = FP_OFF(firstAvailableBuf); 1942:inthndlr.c **** if (realoffs <= 0xFFF0) { /* if any free (not yet exthausted) */ 3208 .loc 1 1942 0 0 00008FBD 837EDAF0 cmp word ptr [bp-38], -16 0 00008FC1 7603E98A00 ja _.L488 3211 _.LVL250: 1943:inthndlr.c **** offs = realoffs; 1944:inthndlr.c **** offs += 15; 3212 .loc 1 1944 0 0 00008FC6 8B4EDA mov cx, word ptr [bp-38] 0 00008FC9 83C10F add cx, 15 3215 _.LVL251: 1945:inthndlr.c **** offs &= ~ 15; /* annoying: buffers may be unaligned */ 3216 .loc 1 1945 0 0 00008FCC 83E1F0 and cx, -16 3218 _.LVL252: 1946:inthndlr.c **** size = - offs; /* bx + di = 10000h */ 3219 .loc 1 1946 0 0 00008FCF 89C8 mov ax, cx 0 00008FD1 F7D8 neg ax 3222 _.LVL253: 1947:inthndlr.c **** if (r.AL == 0x02) /* allocate HMA space */ 3223 .loc 1 1947 0 0 00008FD3 8E46DE mov es, word ptr [bp-34] 0 00008FD6 26807C1002 cmp byte ptr es:[si+16], 2 0 00008FDB 7577 jne _.L487 1948:inthndlr.c **** { 1949:inthndlr.c **** requestedsize = (r.BX + 15) & ~ 15; /* align to paragraph */ 3227 .loc 1 1949 0 0 00008FDD 268B540A mov dx, word ptr es:[si+10] 0 00008FE1 89D3 mov bx, dx 0 00008FE3 83C30F add bx, 15 0 00008FE6 83E3F0 and bx, -16 3232 _.LVL254: 1950:inthndlr.c **** if (requestedsize < r.BX || 3233 .loc 1 1950 0 0 00008FE9 39DA cmp dx, bx 0 00008FEB 7763 ja _.L488 0 00008FED 39D8 cmp ax, bx 0 00008FEF 725F jc _.L488 3238 _.LVL255: 3239 _.LBB37: 1951:inthndlr.c **** requestedsize > size) { /* overflow or OOM */ 1952:inthndlr.c **** size = 0; 1953:inthndlr.c **** offs = 0xffff; /* requested more than we have */ 1954:inthndlr.c **** } else { 1955:inthndlr.c **** UWORD alignment = offs - realoffs; 1956:inthndlr.c **** size = (UWORD)requestedsize; /* return rounded size */ 1957:inthndlr.c **** AllocateHMASpace(realoffs, offs + size - 1); /* ! realoffs */ 3240 .loc 1 1957 0 0 00008FF1 89CF mov di, cx 0 00008FF3 894ED8 mov word ptr [bp-40], cx 0 00008FF6 8D41FF lea ax, [-1+bx+di] 0 00008FF9 895ED6 mov word ptr [bp-42], bx 0 00008FFC 50 push ax 0 00008FFD FF76DA push word ptr [bp-38] 0 00009000 E8[FEFF] call _AllocateHMASpace 3248 _.LVL256: 1958:inthndlr.c **** if ( ((UDWORD)offs + (UDWORD)size) == 0x10000UL ) { 3249 .loc 1 1958 0 0 00009003 8B4ED8 mov cx, word ptr [bp-40] 0 00009006 31C0 xor ax, ax 0 00009008 8B5ED6 mov bx, word ptr [bp-42] 0 0000900B 89DA mov dx, bx 0 0000900D 01CA add dx, cx 0 0000900F 11C0 adc ax, ax 0 00009011 85D2 test dx, dx 0 00009013 7528 jne _.L414 0 00009015 83F801 cmp ax, 1 0 00009018 7523 jne _.L414 1959:inthndlr.c **** firstAvailableBuf = MK_FP(0xFFFF, 0xFFFF); /* exhausted */ 3260 .loc 1 1959 0 0 0000901A 8B46DC mov ax, word ptr [bp-36] 0 0000901D A3[0000] mov word ptr [_firstAvailableBuf], ax 0 00009020 A3[0200] mov word ptr [_firstAvailableBuf+2], ax 3264 _.L504: 3265 _.LBE37: 1945:inthndlr.c **** size = - offs; /* bx + di = 10000h */ 3266 .loc 1 1945 0 0 00009023 894EDC mov word ptr [bp-36], cx 3268 _.LBB38: 1960:inthndlr.c **** } else { 1961:inthndlr.c **** firstAvailableBuf += size + alignment; /* advance free pointer */ 3269 .loc 1 1961 0 0 00009026 93 xchg bx, ax 3271 _.LVL257: 3272 _.L412: 3273 _.LBE38: 1962:inthndlr.c **** } 1963:inthndlr.c **** } 1964:inthndlr.c **** } 1965:inthndlr.c **** } 1966:inthndlr.c **** } 1967:inthndlr.c **** r.DI = offs; 3274 .loc 1 1967 0 0 00009027 C456DC les dx, dword ptr [bp-36] 0 0000902A 26895404 mov word ptr es:[si+4], dx 3277 _.LVL258: 1968:inthndlr.c **** r.BX = size; 3278 .loc 1 1968 0 0 0000902E 8E46DE mov es, word ptr [bp-34] 0 00009031 2689440A mov word ptr es:[si+10], ax 3281 _.LVL259: 3282 _.L410: 3283 _.LBE36: 1969:inthndlr.c **** return; 1970:inthndlr.c **** } 1971:inthndlr.c **** else if (r.AH == 0x13) /* set disk interrupt (13h) handler */ 1972:inthndlr.c **** { 1973:inthndlr.c **** /* set new values for int13h calls, and must return old values */ 1974:inthndlr.c **** register intvec tmp = UserInt13; 1975:inthndlr.c **** UserInt13 = MK_FP(r.ds, r.DX); /* int13h handler to use */ 1976:inthndlr.c **** r.ds = FP_SEG(tmp); r.DX = FP_OFF(tmp); 1977:inthndlr.c **** tmp = BIOSInt13; 1978:inthndlr.c **** BIOSInt13 = MK_FP(r.es, r.BX); /* int13h handler to restore on reboot */ 1979:inthndlr.c **** r.es = FP_SEG(tmp); r.BX = FP_OFF(tmp); 1980:inthndlr.c **** return; 1981:inthndlr.c **** } 1982:inthndlr.c **** else if (r.AH == 0x16) /* Window/Multitasking hooks */ 1983:inthndlr.c **** { 1984:inthndlr.c **** #ifdef WIN31SUPPORT /* See "DOS Internals" or RBIL under DOSMGR for details */ 1985:inthndlr.c **** switch (r.AL) 1986:inthndlr.c **** { 1987:inthndlr.c **** /* default: unhandled requests pass through unchanged */ 1988:inthndlr.c **** case 0x0: /* is Windows active */ 1989:inthndlr.c **** case 0x0A: /* identify Windows version */ 1990:inthndlr.c **** { 1991:inthndlr.c **** /* return AX unchanged if Windows not active */ 1992:inthndlr.c **** break; 1993:inthndlr.c **** } /* 0x0, 0x0A */ 1994:inthndlr.c **** case 0x03: /* Windows Get Instance Data */ 1995:inthndlr.c **** { 1996:inthndlr.c **** /* This should only be called if AX=1607h/BX=15h is not supported. */ 1997:inthndlr.c **** /* The data returned here corresponds directly with text entries that 1998:inthndlr.c **** can also be in INSTANCE.386 [which in theory means Windows could 1999:inthndlr.c **** be updated to support FD kernel without responding to these?]. 2000:inthndlr.c **** */ 2001:inthndlr.c **** DebugPrintf(("get instance data\n")); 2002:inthndlr.c **** break; 2003:inthndlr.c **** } /* 0x03 */ 2004:inthndlr.c **** case 0x05: /* Windows Startup Broadcast */ 2005:inthndlr.c **** { 2006:inthndlr.c **** /* After receiving this call we activate compatibility changes 2007:inthndlr.c **** as DOS 5 does, though can wait until 0x07 subfunc 0x01 2008:inthndlr.c **** */ 2009:inthndlr.c **** /* on entry: 2010:inthndlr.c **** DX flags, bit 0 is set(=1) for standard mode 2011:inthndlr.c **** DI Windows version#, major# in high byte 2012:inthndlr.c **** CX 0, set on exit to nonzero to fail load request 2013:inthndlr.c **** DS:SI is 0000:0000, for enhanced mode, at most 1 program can 2014:inthndlr.c **** set to memory manager calling point to disable V86 2015:inthndlr.c **** ES:BX is 0000:0000, set to startup structure 2016:inthndlr.c **** */ 2017:inthndlr.c **** /* r.CX = 0x0; ** redundant and could be set nonzero by another hooked program */ 2018:inthndlr.c **** r.es = FP_SEG(&winStartupInfo); 2019:inthndlr.c **** r.BX = FP_OFF(&winStartupInfo); 2020:inthndlr.c **** winStartupInfo.winver = r.di; /* match what caller says it is */ 2021:inthndlr.c **** #if defined __GNUC__ 2022:inthndlr.c **** winseg1 = FP_SEG(&winStartupInfo); 2023:inthndlr.c **** winseg2 = FP_SEG(&DATASTART); 2024:inthndlr.c **** winseg3 = FP_OFF(&markEndInstanceData); 2025:inthndlr.c **** #endif 2026:inthndlr.c **** winInstanced = 1; /* internal flag marking Windows is active */ 2027:inthndlr.c **** DebugPrintf(("Win startup\n")); 2028:inthndlr.c **** break; 2029:inthndlr.c **** } /* 0x05 */ 2030:inthndlr.c **** case 0x06: /* Windows Exit Broadcast */ 2031:inthndlr.c **** { 2032:inthndlr.c **** /* can do nothing or can remove any changes made 2033:inthndlr.c **** specifically for Windows, must preserve DS. 2034:inthndlr.c **** Note: If Windows fatally exits then may not be called. 2035:inthndlr.c **** */ 2036:inthndlr.c **** winInstanced = 0; /* internal flag marking Windows is NOT active */ 2037:inthndlr.c **** DebugPrintf(("Win exit\n")); 2038:inthndlr.c **** break; 2039:inthndlr.c **** } /* 0x06 */ 2040:inthndlr.c **** case 0x07: /* DOSMGR Virtual Device API */ 2041:inthndlr.c **** { 2042:inthndlr.c **** DebugPrintf(("Vxd:DOSMGR:%x:%x:%x:%x\n",r.AX,r.BX,r.CX,r.DX)); 2043:inthndlr.c **** if (r.BX == 0x15) /* VxD id of "DOSMGR" */ 2044:inthndlr.c **** { 2045:inthndlr.c **** switch (r.CX) 2046:inthndlr.c **** { 2047:inthndlr.c **** /* default: unhandled requests pass through unchanged */ 2048:inthndlr.c **** case 0x00: /* query if supported */ 2049:inthndlr.c **** { 2050:inthndlr.c **** r.CX = winInstanced; /* should always be nonzero if Win is active */ 2051:inthndlr.c **** r.DX = FP_SEG(&nul_dev); /* data segment / segment of DOS drivers */ 2052:inthndlr.c **** r.es = FP_SEG(&winPatchTable); /* es:bx points to table of offsets */ 2053:inthndlr.c **** r.BX = FP_OFF(&winPatchTable); 2054:inthndlr.c **** break; 2055:inthndlr.c **** } 2056:inthndlr.c **** case 0x01: /* enable Win support, ie patch DOS */ 2057:inthndlr.c **** { 2058:inthndlr.c **** /* DOS 5+ return with bitflags unchanged, Windows critical section 2059:inthndlr.c **** needs are handled without need to patch. If this 2060:inthndlr.c **** function does not return successfully windows will 2061:inthndlr.c **** attempt to do the patching itself (very bad idea). 2062:inthndlr.c **** On entry BX is bitflags describing support requested, 2063:inthndlr.c **** and on return DX is set to which we can support. 2064:inthndlr.c **** Note: any we report as unhandled Windows will attempt 2065:inthndlr.c **** to patch kernel to handle, probably not a good idea. 2066:inthndlr.c **** 0001h: enable critical section signals (int 2Ah functions 2067:inthndlr.c **** 80h/81h) to allow re-entering DOS while InDOS. 2068:inthndlr.c **** 0002h: allow nonzero local machine ID, ie different VMs 2069:inthndlr.c **** report different values. 2070:inthndlr.c **** FIXME: does this mean we need to set this or does Windows? 2071:inthndlr.c **** 0004h: split up binary reads to increase int 2Ah function 84h scheduling 2072:inthndlr.c **** / turn Int 21h function 3Fh on STDIN into polling loop 2073:inthndlr.c **** 0008h: notify Windows of halting due to internal stack errors 2074:inthndlr.c **** 0010h: notify Windows of logical drive map change ("Insert disk X:") 2075:inthndlr.c **** */ 2076:inthndlr.c **** r.BX = r.DX; /* sure we support everything asked for, ;-) */ 2077:inthndlr.c **** r.DX = 0xA2AB; /* on succes DX:AX set to A2AB:B97Ch */ 2078:inthndlr.c **** r.AX = 0xB97C; 2079:inthndlr.c **** /* FIXME: do we need to do anything special for FD kernel? */ 2080:inthndlr.c **** break; 2081:inthndlr.c **** } 2082:inthndlr.c **** case 0x02: /* disable Win support, ie remove patches */ 2083:inthndlr.c **** { 2084:inthndlr.c **** /* Note: if we do anything special in 'patch DOS', undo it here. 2085:inthndlr.c **** This is only called when Windows exits, can be ignored. 2086:inthndlr.c **** */ 2087:inthndlr.c **** r.CX = 0; /* for compatibility with MS-DOS 5/6 */ 2088:inthndlr.c **** break; 2089:inthndlr.c **** } 2090:inthndlr.c **** case 0x03: /* get internal structure sizes */ 2091:inthndlr.c **** { 2092:inthndlr.c **** if (r.CX & 0x01) /* size of Current Directory Structure in bytes */ 2093:inthndlr.c **** { 2094:inthndlr.c **** r.DX = 0xA2AB; /* on succes DS:AX set to A2AB:B97Ch */ 2095:inthndlr.c **** r.AX = 0xB97C; 2096:inthndlr.c **** r.CX = sizeof(struct cds); 2097:inthndlr.c **** } 2098:inthndlr.c **** else 2099:inthndlr.c **** r.CX = 0; /* unknown or unsupported structure requested */ 2100:inthndlr.c **** break; 2101:inthndlr.c **** } 2102:inthndlr.c **** case 0x04: /* Get Instancing Exemptions */ 2103:inthndlr.c **** { 2104:inthndlr.c **** /* On exit BX is bit flags denoting data that is instanced 2105:inthndlr.c **** so Windows need not instance it. DOS 5&6 fail with DX=CX=0. 2106:inthndlr.c **** 0001h: Current Directory Structure 2107:inthndlr.c **** 0002h: System File Table and device status of STDOUT 2108:inthndlr.c **** 0004h: device driver chain 2109:inthndlr.c **** 0008h: Swappable Data Area 2110:inthndlr.c **** */ 2111:inthndlr.c **** r.DX = 0xA2AB; /* on succes DX:AX set to A2AB:B97Ch */ 2112:inthndlr.c **** r.AX = 0xB97C; 2113:inthndlr.c **** r.BX = 0; /* a zero here tells Windows to instance everything */ 2114:inthndlr.c **** break; 2115:inthndlr.c **** } 2116:inthndlr.c **** case 0x05: /* get device driver size */ 2117:inthndlr.c **** { 2118:inthndlr.c **** /* On entry ES:DI points to possible device driver 2119:inthndlr.c **** if is not one return with AX=BX=CX=DX=0 2120:inthndlr.c **** else return BX:CX size in bytes allocated to driver 2121:inthndlr.c **** and DX:AX set to A2AB:B97Ch */ 2122:inthndlr.c **** mcb FAR *smcb = MK_PTR(mcb, (r.ES-1), 0); /* para before is possibly submcb segment * 2123:inthndlr.c **** /* drivers always start a seg:0 (DI==0), so if not then either 2124:inthndlr.c **** not device driver or duplicate (ie device driver file loaded 2125:inthndlr.c **** is of multi-driver variety; multiple device drivers in same file, 2126:inthndlr.c **** whose memory was allocated as a single chunk) 2127:inthndlr.c **** Drivers don't really have a MCB, instead the DOS MCB is broken 2128:inthndlr.c **** up into submcbs, which will have a type of 'D' (or 'E') 2129:inthndlr.c **** So we check that this is primary segment, a device driver, and owner. 2130:inthndlr.c **** */ 2131:inthndlr.c **** if (!r.DI && (smcb->m_type == 'D') && (smcb->m_psp == r.ES)) 2132:inthndlr.c **** { 2133:inthndlr.c **** ULONG size = smcb->m_size * 16ul; 2134:inthndlr.c **** r.BX = hiword(size); 2135:inthndlr.c **** r.CX = loword(size); 2136:inthndlr.c **** r.DX = 0xA2AB; /* on succes DX:AX set to A2AB:B97Ch */ 2137:inthndlr.c **** r.AX = 0xB97C; 2138:inthndlr.c **** break; 2139:inthndlr.c **** } 2140:inthndlr.c **** r.DX = 0; /* we aren't one so return unsupported */ 2141:inthndlr.c **** r.AX = 0; 2142:inthndlr.c **** r.BX = 0; 2143:inthndlr.c **** r.CX = 0; 2144:inthndlr.c **** break; 2145:inthndlr.c **** } 2146:inthndlr.c **** } 2147:inthndlr.c **** } 2148:inthndlr.c **** DebugPrintf(("Vxd:DOSMGR:%x:%x:%x:%x\n",r.AX,r.BX,r.CX,r.DX)); 2149:inthndlr.c **** break; 2150:inthndlr.c **** } /* 0x07 */ 2151:inthndlr.c **** case 0x08: /* Windows Init Complete Broadcast */ 2152:inthndlr.c **** { 2153:inthndlr.c **** DebugPrintf(("Init complete\n")); 2154:inthndlr.c **** break; 2155:inthndlr.c **** } /* 0x08 */ 2156:inthndlr.c **** case 0x09: /* Windows Begin Exit Broadcast */ 2157:inthndlr.c **** { 2158:inthndlr.c **** DebugPrintf(("Exit initiated\n")); 2159:inthndlr.c **** break; 2160:inthndlr.c **** } /* 0x09 */ 2161:inthndlr.c **** case 0x0B: /* Win TSR Identify */ 2162:inthndlr.c **** { 2163:inthndlr.c **** DebugPrintf(("TSR identify request.\n")); 2164:inthndlr.c **** break; 2165:inthndlr.c **** } /* 0x0B */ 2166:inthndlr.c **** case 0x80: /* Win Release Time-slice */ 2167:inthndlr.c **** { 2168:inthndlr.c **** /* This function is generally only called in idle loops */ 2169:inthndlr.c **** DosIdle_hlt(); 2170:inthndlr.c **** r.AX = 0; 2171:inthndlr.c **** /* DebugPrintf(("Release Time Slice\n")); */ 2172:inthndlr.c **** break; 2173:inthndlr.c **** } /* 0x80 */ 2174:inthndlr.c **** case 0x81: /* Win3 Begin Critical Section */ 2175:inthndlr.c **** { 2176:inthndlr.c **** DebugPrintf(("Begin CritSect\n")); 2177:inthndlr.c **** break; 2178:inthndlr.c **** } /* 0x81 */ 2179:inthndlr.c **** case 0x82: /* Win3 End Critical Section */ 2180:inthndlr.c **** { 2181:inthndlr.c **** DebugPrintf(("End CritSect\n")); 2182:inthndlr.c **** break; 2183:inthndlr.c **** } /* 0x82 */ 2184:inthndlr.c **** case 0x8F: /* Win4 Close Awareness */ 2185:inthndlr.c **** { 2186:inthndlr.c **** if (r.DH != 0x01) /* query close */ 2187:inthndlr.c **** r.AX = 0x0; 2188:inthndlr.c **** /* else r.AX = 0x168F; don't close -- continue execution */ 2189:inthndlr.c **** break; 2190:inthndlr.c **** } /* 0x8F */ 2191:inthndlr.c **** default: 2192:inthndlr.c **** DebugPrintf(("Win call (int 2Fh/16h): %04x %04x %04x %04x\n", r.AX, r.BX, r.CX, r.DX)); 2193:inthndlr.c **** break; 2194:inthndlr.c **** } 2195:inthndlr.c **** #endif 2196:inthndlr.c **** return; 2197:inthndlr.c **** } 2198:inthndlr.c **** else if (r.AH == 0x46) /* MS Windows WinOLDAP switching */ 2199:inthndlr.c **** { 2200:inthndlr.c **** #ifdef WIN31SUPPORT /* See "DOS Internals" under DOSMGR or RBIL for details */ 2201:inthndlr.c **** if (r.AL == 0x01) /* save MCB */ 2202:inthndlr.c **** { 2203:inthndlr.c **** /* To prevent corruption when dos=umb where Windows 3.0 standard 2204:inthndlr.c **** writes a sentinel at 9FFEh, DOS 5 will save the MCB marking 2205:inthndlr.c **** end of conventional memory (ie MCB following caller's PSP memory 2206:inthndlr.c **** block [which I assume occupies all of conventional memory] into 2207:inthndlr.c **** the DOS data segment. 2208:inthndlr.c **** Note: presumably Win3.1 uses the WinPatchTable.OffLastMCBSeg 2209:inthndlr.c **** when DOS ver > 5 to do this itself. 2210:inthndlr.c **** */ 2211:inthndlr.c **** /* FIXME: Implement this! */ 2212:inthndlr.c **** } 2213:inthndlr.c **** else if (r.AL == 0x02) /* restore MCB */ 2214:inthndlr.c **** { 2215:inthndlr.c **** /* Copy the MCB we previously saved back. */ 2216:inthndlr.c **** /* FIXME: Implement this! */ 2217:inthndlr.c **** } 2218:inthndlr.c **** #endif 2219:inthndlr.c **** return; 2220:inthndlr.c **** } 2221:inthndlr.c **** else if (r.AH == 0x08) /* DRIVER.SYS / DRIVPARAM */ 2222:inthndlr.c **** { 2223:inthndlr.c **** switch (r.AL) 2224:inthndlr.c **** { 2225:inthndlr.c **** case 0x00: /* installation check */ 2226:inthndlr.c **** r.AL = 0xff; /* installed, 0=not installed */ 2227:inthndlr.c **** break; 2228:inthndlr.c **** 2229:inthndlr.c **** case 0x01: /* add new block device */ 2230:inthndlr.c **** /* TODO, see push_ddt() */ 2231:inthndlr.c **** break; 2232:inthndlr.c **** 2233:inthndlr.c **** case 0x02: /* execute device driver request */ 2234:inthndlr.c **** /* TODO */ 2235:inthndlr.c **** break; 2236:inthndlr.c **** 2237:inthndlr.c **** /* Note: see in2f.asm where this is handled */ 2238:inthndlr.c **** case 0x03: /* get drive data table */ 2239:inthndlr.c **** r.DS = FP_SEG(&nul_dev); 2240:inthndlr.c **** r.DI = FP_OFF(getddt(0)); 2241:inthndlr.c **** break; 2242:inthndlr.c **** } 2243:inthndlr.c **** 2244:inthndlr.c **** return; 2245:inthndlr.c **** } 2246:inthndlr.c **** /* else (r.AH == 0x12) */ 2247:inthndlr.c **** 2248:inthndlr.c **** switch (r.AL) 2249:inthndlr.c **** { 2250:inthndlr.c **** case 0x00: /* installation check */ 2251:inthndlr.c **** r.AL = 0xff; 2252:inthndlr.c **** break; 2253:inthndlr.c **** 2254:inthndlr.c **** case 0x03: /* get DOS data segment */ 2255:inthndlr.c **** r.DS = FP_SEG(&nul_dev); 2256:inthndlr.c **** break; 2257:inthndlr.c **** 2258:inthndlr.c **** case 0x06: /* invoke critical error */ 2259:inthndlr.c **** 2260:inthndlr.c **** /* code, drive number, error, device header */ 2261:inthndlr.c **** r.AL = CriticalError(r.callerARG1 >> 8, 2262:inthndlr.c **** (r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : 2263:inthndlr.c **** r.callerARG1 & 0xff, r.DI, MK_FP(r.BP, r.SI)); 2264:inthndlr.c **** break; 2265:inthndlr.c **** 2266:inthndlr.c **** case 0x08: /* decrease SFT reference count */ 2267:inthndlr.c **** { 2268:inthndlr.c **** sft FAR *p = MK_FP(r.ES, r.DI); 2269:inthndlr.c **** 2270:inthndlr.c **** r.AX = p->sft_count; 2271:inthndlr.c **** 2272:inthndlr.c **** if (--p->sft_count == 0) 2273:inthndlr.c **** --p->sft_count; 2274:inthndlr.c **** } 2275:inthndlr.c **** break; 2276:inthndlr.c **** 2277:inthndlr.c **** case 0x0a: /* perform critical error */ 2278:inthndlr.c **** /* differs from 0x06 as uses current drive & error on stack */ 2279:inthndlr.c **** /* code, drive number, error, device header */ 2280:inthndlr.c **** r.AL = CriticalError(0x38, /* ignore/retry/fail - based on RBIL possible return values */ 2281:inthndlr.c **** default_drive, 2282:inthndlr.c **** r.callerARG1, /* error, from RBIL passed on stack */ 2283:inthndlr.c **** CDSp[(WORD)default_drive].cdsDpb->dpb_device); 2284:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2285:inthndlr.c **** if (r.AL == 1) r.FLAGS &= ~FLG_CARRY; /* carry clear if should retry */ 2286:inthndlr.c **** break; 2287:inthndlr.c **** 2288:inthndlr.c **** case 0x0b: /* sharing violation occurred */ 2289:inthndlr.c **** { 2290:inthndlr.c **** /* ES:DI = SFT for previous open of file */ 2291:inthndlr.c **** sft FAR *sftp = MK_FP(r.ES, r.DI); 2292:inthndlr.c **** /* default to don't retry, ie fail/abort/etc other than retry */ 2293:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2294:inthndlr.c **** /* from RBIL if SFT for FCB or compatibility mode without NOINHERIT call int24h */ 2295:inthndlr.c **** if ((sftp->sft_mode & O_FCB) || !(sftp->sft_mode & (O_SHAREMASK | O_NOINHERIT))) 2296:inthndlr.c **** { 2297:inthndlr.c **** r.AL = CriticalError(0x38, /* ignore/retry/fail - ??? */ 2298:inthndlr.c **** default_drive, 2299:inthndlr.c **** r.callerARG1, /* error, from RBIL passed on stack */ 2300:inthndlr.c **** CDSp[(WORD)default_drive].cdsDpb->dpb_device); 2301:inthndlr.c **** /* clear carry if should retry */ 2302:inthndlr.c **** if (r.AL == 1) r.FLAGS &= ~FLG_CARRY; 2303:inthndlr.c **** } 2304:inthndlr.c **** r.AX = 0x20; /* error sharing violation */ 2305:inthndlr.c **** } 2306:inthndlr.c **** break; 2307:inthndlr.c **** 2308:inthndlr.c **** case 0x0c: /* perform "device open" for device, set owner for FCB */ 2309:inthndlr.c **** 2310:inthndlr.c **** if (lpCurSft->sft_flags & SFT_FDEVICE) 2311:inthndlr.c **** { 2312:inthndlr.c **** request rq; 2313:inthndlr.c **** 2314:inthndlr.c **** rq.r_unit = 0; 2315:inthndlr.c **** rq.r_status = 0; 2316:inthndlr.c **** rq.r_command = C_OPEN; 2317:inthndlr.c **** rq.r_length = sizeof(request); 2318:inthndlr.c **** execrh((request FAR *) & rq, lpCurSft->sft_dev); 2319:inthndlr.c **** } 2320:inthndlr.c **** 2321:inthndlr.c **** /* just do it always, not just for FCBs */ 2322:inthndlr.c **** lpCurSft->sft_psp = cu_psp; 2323:inthndlr.c **** break; 2324:inthndlr.c **** 2325:inthndlr.c **** case 0x0d: /* get dos date/time */ 2326:inthndlr.c **** 2327:inthndlr.c **** r.AX = dos_getdate(); 2328:inthndlr.c **** r.DX = dos_gettime(); 2329:inthndlr.c **** break; 2330:inthndlr.c **** 2331:inthndlr.c **** case 0x11: /* normalise ASCIIZ filename */ 2332:inthndlr.c **** { 2333:inthndlr.c **** char c; 2334:inthndlr.c **** char FAR *s = MK_FP(r.DS, r.SI); 2335:inthndlr.c **** char FAR *t = MK_FP(r.ES, r.DI); 2336:inthndlr.c **** 2337:inthndlr.c **** do 2338:inthndlr.c **** { 2339:inthndlr.c **** c = *s++; 2340:inthndlr.c **** /* uppercase character */ 2341:inthndlr.c **** /* for now, ASCII only because nls.c cannot handle DS!=SS */ 2342:inthndlr.c **** if (c >= 'a' && c <= 'z') 2343:inthndlr.c **** c -= 'a' - 'A'; 2344:inthndlr.c **** else if (c == '/') 2345:inthndlr.c **** c = '\\'; 2346:inthndlr.c **** *t++ = c; 2347:inthndlr.c **** } 2348:inthndlr.c **** while (c); 2349:inthndlr.c **** break; 2350:inthndlr.c **** } 2351:inthndlr.c **** 2352:inthndlr.c **** case 0x12: /* get length of asciiz string */ 2353:inthndlr.c **** 2354:inthndlr.c **** r.CX = fstrlen(MK_FP(r.ES, r.DI)) + 1; 2355:inthndlr.c **** 2356:inthndlr.c **** break; 2357:inthndlr.c **** 2358:inthndlr.c **** case 0x13: 2359:inthndlr.c **** /* uppercase character */ 2360:inthndlr.c **** /* for now, ASCII only because nls.c cannot handle DS!=SS */ 2361:inthndlr.c **** r.AL = (unsigned char)r.callerARG1; 2362:inthndlr.c **** if (r.AL >= 'a' && r.AL <= 'z') 2363:inthndlr.c **** r.AL -= 'a' - 'A'; 2364:inthndlr.c **** break; 2365:inthndlr.c **** 2366:inthndlr.c **** case 0x16: 2367:inthndlr.c **** /* get address of system file table entry - used by NET.EXE 2368:inthndlr.c **** BX system file table entry number ( such as returned from 2F/1220) 2369:inthndlr.c **** returns 2370:inthndlr.c **** ES:DI pointer to SFT entry 2371:inthndlr.c **** BX relative entry number within SFT */ 2372:inthndlr.c **** { 2373:inthndlr.c **** int rel_idx = idx_to_sft_(r.BX); 2374:inthndlr.c **** 2375:inthndlr.c **** if (rel_idx == -1) 2376:inthndlr.c **** { 2377:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2378:inthndlr.c **** break; 2379:inthndlr.c **** } 2380:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2381:inthndlr.c **** r.BX = rel_idx; 2382:inthndlr.c **** r.ES = FP_SEG(lpCurSft); 2383:inthndlr.c **** r.DI = FP_OFF(lpCurSft); 2384:inthndlr.c **** break; 2385:inthndlr.c **** } 2386:inthndlr.c **** 2387:inthndlr.c **** case 0x17: /* get current directory structure for drive - used by NET.EXE 2388:inthndlr.c **** STACK: drive (0=A:,1=B,...) 2389:inthndlr.c **** ; returns 2390:inthndlr.c **** ; CF set if error 2391:inthndlr.c **** ; DS:SI pointer to CDS for drive 2392:inthndlr.c **** ; 2393:inthndlr.c **** ; called like 2394:inthndlr.c **** ; push 2 (c-drive) 2395:inthndlr.c **** ; mov ax,1217 2396:inthndlr.c **** ; int 2f 2397:inthndlr.c **** ; 2398:inthndlr.c **** ; probable use: get sizeof(CDSentry) 2399:inthndlr.c **** */ 2400:inthndlr.c **** { 2401:inthndlr.c **** struct cds FAR *cdsp = get_cds_unvalidated(r.callerARG1 & 0xff); 2402:inthndlr.c **** 2403:inthndlr.c **** if (cdsp == NULL) 2404:inthndlr.c **** { 2405:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2406:inthndlr.c **** break; 2407:inthndlr.c **** } 2408:inthndlr.c **** r.DS = FP_SEG(cdsp); 2409:inthndlr.c **** r.SI = FP_OFF(cdsp); 2410:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2411:inthndlr.c **** break; 2412:inthndlr.c **** } 2413:inthndlr.c **** 2414:inthndlr.c **** case 0x18: /* get caller's registers */ 2415:inthndlr.c **** 2416:inthndlr.c **** r.DS = FP_SEG(user_r); 2417:inthndlr.c **** r.SI = FP_OFF(user_r); 2418:inthndlr.c **** break; 2419:inthndlr.c **** 2420:inthndlr.c **** case 0x1b: /* #days in February - valid until 2099. */ 2421:inthndlr.c **** 2422:inthndlr.c **** r.AL = (r.CL & 3) ? 28 : 29; 2423:inthndlr.c **** break; 2424:inthndlr.c **** 2425:inthndlr.c **** case 0x1f: /* build current directory structure */ 2426:inthndlr.c **** { 2427:inthndlr.c **** /* this is similar to ARG1-'A', but case-insensitive. 2428:inthndlr.c **** * Note: the letter is passed here, not number! */ 2429:inthndlr.c **** int drv = (r.callerARG1 & 0x1f) - 1; 2430:inthndlr.c **** struct cds FAR *cdsp; 2431:inthndlr.c **** if (drv < 0 || r.callerARG1 < 'A' || r.callerARG1 > 'z') 2432:inthndlr.c **** { 2433:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2434:inthndlr.c **** break; 2435:inthndlr.c **** } 2436:inthndlr.c **** cdsp = get_cds_unvalidated(drv); 2437:inthndlr.c **** if (cdsp == NULL) 2438:inthndlr.c **** { 2439:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2440:inthndlr.c **** break; 2441:inthndlr.c **** } 2442:inthndlr.c **** strcpy(TempCDS.cdsCurrentPath, "?:\\"); 2443:inthndlr.c **** *TempCDS.cdsCurrentPath = (BYTE)(r.callerARG1 & 0xff); 2444:inthndlr.c **** TempCDS.cdsBackslashOffset = 2; 2445:inthndlr.c **** if (cdsp->cdsFlags) 2446:inthndlr.c **** { 2447:inthndlr.c **** TempCDS.cdsDpb = cdsp->cdsDpb; 2448:inthndlr.c **** TempCDS.cdsFlags = CDSPHYSDRV; /* don't inherit CDS flags */ 2449:inthndlr.c **** } 2450:inthndlr.c **** else 2451:inthndlr.c **** { 2452:inthndlr.c **** TempCDS.cdsDpb = NULL; 2453:inthndlr.c **** TempCDS.cdsFlags = 0; 2454:inthndlr.c **** } 2455:inthndlr.c **** TempCDS.cdsStrtClst = 0xffff; 2456:inthndlr.c **** TempCDS.cdsParam = 0xffff; 2457:inthndlr.c **** TempCDS.cdsStoreUData = 0xffff; 2458:inthndlr.c **** r.CX = sizeof(TempCDS); 2459:inthndlr.c **** r.ES = FP_SEG(&TempCDS); 2460:inthndlr.c **** r.DI = FP_OFF(&TempCDS); 2461:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2462:inthndlr.c **** break; 2463:inthndlr.c **** } 2464:inthndlr.c **** 2465:inthndlr.c **** case 0x20: /* get job file table entry */ 2466:inthndlr.c **** { 2467:inthndlr.c **** psp FAR *p = MK_FP(cu_psp, 0); 2468:inthndlr.c **** unsigned char FAR *idx; 2469:inthndlr.c **** 2470:inthndlr.c **** if (r.BX >= p->ps_maxfiles) 2471:inthndlr.c **** { 2472:inthndlr.c **** r.AL = -DE_INVLDHNDL; 2473:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2474:inthndlr.c **** break; 2475:inthndlr.c **** } 2476:inthndlr.c **** idx = &p->ps_filetab[r.BX]; 2477:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2478:inthndlr.c **** r.ES = FP_SEG(idx); 2479:inthndlr.c **** r.DI = FP_OFF(idx); 2480:inthndlr.c **** } 2481:inthndlr.c **** break; 2482:inthndlr.c **** 2483:inthndlr.c **** case 0x21: /* truename */ 2484:inthndlr.c **** 2485:inthndlr.c **** DosTruename(MK_FP(r.DS, r.SI), MK_FP(r.ES, r.DI)); 2486:inthndlr.c **** 2487:inthndlr.c **** break; 2488:inthndlr.c **** 2489:inthndlr.c **** case 0x23: /* check if character device */ 2490:inthndlr.c **** { 2491:inthndlr.c **** struct dhdr FAR *dhp; 2492:inthndlr.c **** 2493:inthndlr.c **** dhp = IsDevice((BYTE FAR *) DirEntBuffer.dir_name); 2494:inthndlr.c **** 2495:inthndlr.c **** if (dhp == NULL) 2496:inthndlr.c **** { 2497:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2498:inthndlr.c **** break; 2499:inthndlr.c **** } 2500:inthndlr.c **** r.BH = dhp->dh_attr; 2501:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2502:inthndlr.c **** } 2503:inthndlr.c **** break; 2504:inthndlr.c **** 2505:inthndlr.c **** case 0x25: /* get length of asciiz string */ 2506:inthndlr.c **** 2507:inthndlr.c **** r.CX = fstrlen(MK_FP(r.DS, r.SI)) + 1; 2508:inthndlr.c **** break; 2509:inthndlr.c **** 2510:inthndlr.c **** case 0x26: /* open file */ 2511:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2512:inthndlr.c **** CritErrCode = SUCCESS; 2513:inthndlr.c **** lrc = DosOpen(MK_FP(r.DS, r.DX), O_LEGACY | O_OPEN | r.CL, 0); 2514:inthndlr.c **** goto long_check; 2515:inthndlr.c **** 2516:inthndlr.c **** case 0x27: /* close file */ 2517:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2518:inthndlr.c **** CritErrCode = SUCCESS; 2519:inthndlr.c **** rc = DosClose(r.BX); 2520:inthndlr.c **** goto short_check; 2521:inthndlr.c **** 2522:inthndlr.c **** #ifdef WITHFAT32 2523:inthndlr.c **** #ifdef WITHLFNAPI 2524:inthndlr.c **** case 0x42: /* 64-bit move file pointer */ 2525:inthndlr.c **** { 2526:inthndlr.c **** /* r.(DS:DX) points to 64-bit file position instead of r.(CX:DX) being 32-bit file position * 2527:inthndlr.c **** UDWORD FAR *filepos = MK_FP(r.DS, r.DX); 2528:inthndlr.c **** if (*(filepos+1) != 0) /* we currently only handle lower 32 bits, upper 32 bits must be 0 */ 2529:inthndlr.c **** goto error_invalid; 2530:inthndlr.c **** r.BP = (UWORD)r.CL; 2531:inthndlr.c **** r.CX = hiword(*filepos); 2532:inthndlr.c **** r.DX = loword(*filepos); 2533:inthndlr.c **** /* fall through to 32-bit move file pointer (0x28) */ 2534:inthndlr.c **** } 2535:inthndlr.c **** #endif 2536:inthndlr.c **** #endif 2537:inthndlr.c **** case 0x28: /* move file pointer */ 2538:inthndlr.c **** /* 2539:inthndlr.c **** * RBIL says: "sets user stack frame pointer to dummy buffer, 2540:inthndlr.c **** * moves BP to AX, performs LSEEK, and restores frame pointer" 2541:inthndlr.c **** * We obviously don't do it like that. Does this do any harm?! --L.G. 2542:inthndlr.c **** */ 2543:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2544:inthndlr.c **** CritErrCode = SUCCESS; 2545:inthndlr.c **** if (r.BP < 0x4200 || r.BP > 0x4202) 2546:inthndlr.c **** goto error_invalid; 2547:inthndlr.c **** lrc = DosSeek(r.BX, MK_ULONG(r.CX, r.DX), r.BP & 0xff, &rc); 2548:inthndlr.c **** if (rc == SUCCESS) 2549:inthndlr.c **** { 2550:inthndlr.c **** r.DX = (UWORD)(lrc >> 16); 2551:inthndlr.c **** r.AX = (UWORD) lrc; 2552:inthndlr.c **** } 2553:inthndlr.c **** goto short_check; 2554:inthndlr.c **** 2555:inthndlr.c **** case 0x29: /* read from file */ 2556:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2557:inthndlr.c **** CritErrCode = SUCCESS; 2558:inthndlr.c **** lrc = DosRead(r.BX, r.CX, MK_FP(r.DS, r.DX)); 2559:inthndlr.c **** goto long_check; 2560:inthndlr.c **** 2561:inthndlr.c **** case 0x2a: /* Set FastOpen but does nothing. */ 2562:inthndlr.c **** 2563:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 2564:inthndlr.c **** break; 2565:inthndlr.c **** 2566:inthndlr.c **** case 0x2b: /* Device I/O Control */ 2567:inthndlr.c **** if (r.BP < 0x4400 || r.BP > 0x44ff) 2568:inthndlr.c **** goto error_invalid; 2569:inthndlr.c **** { 2570:inthndlr.c **** lregs lr; 2571:inthndlr.c **** lr.AX = r.BP; 2572:inthndlr.c **** lr.BX = r.BX; 2573:inthndlr.c **** lr.CX = r.CX; 2574:inthndlr.c **** lr.DX = r.DX; 2575:inthndlr.c **** lr.DI = r.DI; 2576:inthndlr.c **** lr.SI = r.SI; 2577:inthndlr.c **** lr.DS = r.DS; 2578:inthndlr.c **** rc = DosDevIOctl(&lr); /* can set critical error code! */ 2579:inthndlr.c **** } 2580:inthndlr.c **** 2581:inthndlr.c **** if (rc < SUCCESS) 2582:inthndlr.c **** { 2583:inthndlr.c **** r.AX = -rc; 2584:inthndlr.c **** if (rc != DE_DEVICE && rc != DE_ACCESS) 2585:inthndlr.c **** CritErrCode = r.AX; 2586:inthndlr.c **** goto error_carry; 2587:inthndlr.c **** } 2588:inthndlr.c **** break; 2589:inthndlr.c **** 2590:inthndlr.c **** case 0x2c: /* added by James Tabor For Zip Drives 2591:inthndlr.c **** Return Null Device Pointer */ 2592:inthndlr.c **** /* by UDOS+RBIL: get header of SECOND device driver in device chain, 2593:inthndlr.c **** omitting the NUL device TE */ 2594:inthndlr.c **** r.BX = FP_SEG(nul_dev.dh_next); 2595:inthndlr.c **** r.AX = FP_OFF(nul_dev.dh_next); 2596:inthndlr.c **** break; 2597:inthndlr.c **** 2598:inthndlr.c **** case 0x2d: /* Get Extended Error Code */ 2599:inthndlr.c **** r.AX = CritErrCode; 2600:inthndlr.c **** 2601:inthndlr.c **** break; 2602:inthndlr.c **** 2603:inthndlr.c **** case 0x2e: /* GET or SET error table addresse - ignored 2604:inthndlr.c **** called by MS debug with DS != DOSDS, printf 2605:inthndlr.c **** doesn't work!! */ 2606:inthndlr.c **** break; 2607:inthndlr.c **** 2608:inthndlr.c **** case 0x2f: /* updates version returned by int 21/30h for all processes */ 2609:inthndlr.c **** if (r.DX) /* set returned version from DX */ 2610:inthndlr.c **** { 2611:inthndlr.c **** os_setver_major = r.DL; 2612:inthndlr.c **** os_setver_minor = r.DH; 2613:inthndlr.c **** } 2614:inthndlr.c **** else /* set returned version from emulated true DOS version */ 2615:inthndlr.c **** { 2616:inthndlr.c **** os_setver_major = os_major; 2617:inthndlr.c **** os_setver_minor = os_minor; 2618:inthndlr.c **** } 2619:inthndlr.c **** break; 2620:inthndlr.c **** 2621:inthndlr.c **** default: 2622:inthndlr.c **** if (r.AL <= 0x31) 2623:inthndlr.c **** { 2624:inthndlr.c **** put_string("unimplemented internal dos function INT2F/12"); 2625:inthndlr.c **** put_unsigned(r.AL, 16, 2); 2626:inthndlr.c **** put_string("\n"); 2627:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2628:inthndlr.c **** } 2629:inthndlr.c **** } 2630:inthndlr.c **** return; 2631:inthndlr.c **** long_check: 2632:inthndlr.c **** if (lrc >= SUCCESS) 2633:inthndlr.c **** { 2634:inthndlr.c **** r.AX = (UWORD)lrc; 2635:inthndlr.c **** return; 2636:inthndlr.c **** } 2637:inthndlr.c **** rc = (int)lrc; 2638:inthndlr.c **** short_check: 2639:inthndlr.c **** if (rc < SUCCESS) 2640:inthndlr.c **** goto error_exit; 2641:inthndlr.c **** return; 2642:inthndlr.c **** error_invalid: 2643:inthndlr.c **** rc = DE_INVLDFUNC; 2644:inthndlr.c **** error_exit: 2645:inthndlr.c **** r.AX = -rc; 2646:inthndlr.c **** if (CritErrCode == SUCCESS) 2647:inthndlr.c **** CritErrCode = r.AX; /* Maybe set */ 2648:inthndlr.c **** error_carry: 2649:inthndlr.c **** r.FLAGS |= FLG_CARRY; 2650:inthndlr.c **** 2651:inthndlr.c **** #undef r 2652:inthndlr.c **** } 3284 .loc 1 2652 0 0 00009035 89EC mov sp, bp 0 00009037 5D pop bp 0 00009038 5F pop di 0 00009039 5E pop si 0 0000903A 16 push ss 0 0000903B 1F pop ds 0 0000903C C3 ret 3292 _.LVL260: 3293 _.L414: 3294 _.LBB40: 3295 _.LBB39: 1961:inthndlr.c **** } 3296 .loc 1 1961 0 0 0000903D 89D8 mov ax, bx 0 0000903F 2B46DA sub ax, word ptr [bp-38] 0 00009042 01C8 add ax, cx 0 00009044 360106[0000] add word ptr ss:[_firstAvailableBuf], ax 0 00009049 EBD8 jmp _.L504 3302 _.LVL261: 3303 _.L485: 3304 _.LBE39: 1936:inthndlr.c **** 3305 .loc 1 1936 0 0 0000904B C746DCFFFF mov word ptr [bp-36], -1 3307 _.LVL262: 3308 _.L488: 0 00009050 31C0 xor ax, ax 0 00009052 EBD3 jmp _.L412 3311 _.LVL263: 3312 _.L487: 1945:inthndlr.c **** size = - offs; /* bx + di = 10000h */ 3313 .loc 1 1945 0 0 00009054 894EDC mov word ptr [bp-36], cx 0 00009057 EBCE jmp _.L412 3316 _.LVL264: 3317 _.L411: 3318 _.LBE40: 1971:inthndlr.c **** { 3319 .loc 1 1971 0 0 00009059 3C13 cmp al, 19 0 0000905B 756B jne _.L416 3322 _.LBB41: 1974:inthndlr.c **** UserInt13 = MK_FP(r.ds, r.DX); /* int13h handler to use */ 3323 .loc 1 1974 0 0 0000905D BB[0000] mov bx, offset _UserInt13 0 00009060 B8[0000] mov ax, offset _UserInt13@OZSEG16 0 00009063 8EC0 mov es, ax 0 00009065 268B17 mov dx, word ptr es:[bx] 0 00009068 268B0E[0200] mov cx, word ptr es:[_UserInt13+2] 3329 _.LVL265: 1975:inthndlr.c **** r.ds = FP_SEG(tmp); r.DX = FP_OFF(tmp); 3330 .loc 1 1975 0 0 0000906D 8E5EDE mov ds, word ptr [bp-34] 0 00009070 8B7C02 mov di, word ptr [si+2] 0 00009073 26893E[0200] mov word ptr es:[_UserInt13+2], di 3334 _.LVL266: 0 00009078 8E46DE mov es, word ptr [bp-34] 0 0000907B 268E5C0C mov ds, word ptr es:[si+12] 0 0000907F 8EC0 mov es, ax 0 00009081 268C1F mov word ptr es:[bx], ds 1976:inthndlr.c **** tmp = BIOSInt13; 3339 .loc 1 1976 0 0 00009084 8E46DE mov es, word ptr [bp-34] 0 00009087 26894C02 mov word ptr es:[si+2], cx 0 0000908B 8E46DE mov es, word ptr [bp-34] 0 0000908E 2689540C mov word ptr es:[si+12], dx 1977:inthndlr.c **** BIOSInt13 = MK_FP(r.es, r.BX); /* int13h handler to restore on reboot */ 3344 .loc 1 1977 0 0 00009092 BB[0000] mov bx, offset _BIOSInt13 0 00009095 B8[0000] mov ax, offset _BIOSInt13@OZSEG16 0 00009098 8EC0 mov es, ax 0 0000909A 268B17 mov dx, word ptr es:[bx] 3349 _.LVL267: 0 0000909D 268B0E[0200] mov cx, word ptr es:[_BIOSInt13+2] 3351 _.LVL268: 1978:inthndlr.c **** r.es = FP_SEG(tmp); r.BX = FP_OFF(tmp); 3352 .loc 1 1978 0 0 000090A2 8E5EDE mov ds, word ptr [bp-34] 0 000090A5 8B3C mov di, word ptr [si] 0 000090A7 26893E[0200] mov word ptr es:[_BIOSInt13+2], di 0 000090AC 8E46DE mov es, word ptr [bp-34] 0 000090AF 268E5C0A mov ds, word ptr es:[si+10] 0 000090B3 8EC0 mov es, ax 0 000090B5 268C1F mov word ptr es:[bx], ds 1979:inthndlr.c **** return; 3360 .loc 1 1979 0 0 000090B8 8E46DE mov es, word ptr [bp-34] 0 000090BB 26890C mov word ptr es:[si], cx 0 000090BE 8E46DE mov es, word ptr [bp-34] 0 000090C1 2689540A mov word ptr es:[si+10], dx 1980:inthndlr.c **** } 3365 .loc 1 1980 0 0 000090C5 E96DFF jmp _.L410 3367 _.LVL269: 3368 _.L416: 3369 _.LBE41: 2198:inthndlr.c **** { 3370 .loc 1 2198 0 0 000090C8 3C46 cmp al, 70 0 000090CA 7503E966FF je _.L410 0 000090CF 3C16 cmp al, 22 0 000090D1 7503E95FFF je _.L410 2221:inthndlr.c **** { 3375 .loc 1 2221 0 0 000090D6 3C08 cmp al, 8 0 000090D8 8E46DE mov es, word ptr [bp-34] 0 000090DB 268A4410 mov al, byte ptr es:[si+16] 0 000090DF 7522 jne _.L418 2223:inthndlr.c **** { 3380 .loc 1 2223 0 0 000090E1 84C0 test al, al 0 000090E3 7432 je _.L422 0 000090E5 3C03 cmp al, 3 0 000090E7 7403E949FF jne _.L410 2239:inthndlr.c **** r.DI = FP_OFF(getddt(0)); 3385 .loc 1 2239 0 0 000090EC 8E46DE mov es, word ptr [bp-34] 0 000090EF 268C5402 mov word ptr es:[si+2], ss 3388 _.LVL270: 2240:inthndlr.c **** break; 3389 .loc 1 2240 0 0 000090F3 31C0 xor ax, ax 0 000090F5 50 push ax 0 000090F6 E8[FEFF] call _getddt 3393 _.LVL271: 3394 _.L505: 3395 _.LBB42: 2383:inthndlr.c **** break; 3396 .loc 1 2383 0 0 000090F9 8E46DE mov es, word ptr [bp-34] 0 000090FC 26894404 mov word ptr es:[si+4], ax 2384:inthndlr.c **** } 3399 .loc 1 2384 0 0 00009100 E932FF jmp _.L410 3401 _.LVL272: 3402 _.L418: 3403 _.LBE42: 2248:inthndlr.c **** { 3404 .loc 1 2248 0 0 00009103 3C2F cmp al, 47 0 00009105 7603E9E405 ja _.L421 0 0000910A 88C2 mov dl, al 0 0000910C 30F6 xor dh, dh 0 0000910E D1E2 shl dx, 1 0 00009110 89D3 mov bx, dx 0 00009112 36FFA7[2001] jmp word ptr ss:[bx+_.L423] === Switch to base=012BB0h -> ".RODATA" 3412 .section .rodata 3413 .p2align 1 0 0000179E 0000 .p2align 2 3415 _.L423: 0 000017A0 [6E15] .hword _.L422 0 000017A2 [451B] .hword _.L421 0 000017A4 [451B] .hword _.L421 0 000017A6 [7915] .hword _.L424 0 000017A8 [451B] .hword _.L421 0 000017AA [451B] .hword _.L421 0 000017AC [8315] .hword _.L425 0 000017AE [451B] .hword _.L421 0 000017B0 [B915] .hword _.L426 0 000017B2 [451B] .hword _.L421 0 000017B4 [EA15] .hword _.L427 0 000017B6 [3B16] .hword _.L428 0 000017B8 [AE16] .hword _.L429 0 000017BA [ED16] .hword _.L430 0 000017BC [451B] .hword _.L421 0 000017BE [451B] .hword _.L421 0 000017C0 [451B] .hword _.L421 0 000017C2 [0417] .hword _.L431 0 000017C4 [4417] .hword _.L432 0 000017C6 [5D17] .hword _.L433 0 000017C8 [451B] .hword _.L421 0 000017CA [451B] .hword _.L421 0 000017CC [8317] .hword _.L434 0 000017CE [C317] .hword _.L435 0 000017D0 [0018] .hword _.L436 0 000017D2 [451B] .hword _.L421 0 000017D4 [451B] .hword _.L421 0 000017D6 [1718] .hword _.L437 0 000017D8 [451B] .hword _.L421 0 000017DA [451B] .hword _.L421 0 000017DC [451B] .hword _.L421 0 000017DE [2A18] .hword _.L438 0 000017E0 [E918] .hword _.L439 0 000017E2 [3419] .hword _.L440 0 000017E4 [451B] .hword _.L421 0 000017E6 [4E19] .hword _.L441 0 000017E8 [451B] .hword _.L421 0 000017EA [8019] .hword _.L442 0 000017EC [8E19] .hword _.L443 0 000017EE [C119] .hword _.L444 0 000017F0 [DE19] .hword _.L445 0 000017F2 [501A] .hword _.L446 0 000017F4 [CA18] .hword _.L447 0 000017F6 [8C1A] .hword _.L448 0 000017F8 [011B] .hword _.L449 0 000017FA [1A1B] .hword _.L450 0 000017FC [8C14] .hword _.L410 0 000017FE [1F1B] .hword _.L451 === Switch to base=002270h -> ".TEXT" 3464 .text 3465 _.L422: 2251:inthndlr.c **** break; 3466 .loc 1 2251 0 0 00009117 8E46DE mov es, word ptr [bp-34] 0 0000911A 26C64410FF mov byte ptr es:[si+16], -1 3469 _.LVL273: 2252:inthndlr.c **** 3470 .loc 1 2252 0 0 0000911F E913FF jmp _.L410 3472 _.LVL274: 3473 _.L424: 2255:inthndlr.c **** break; 3474 .loc 1 2255 0 0 00009122 8E46DE mov es, word ptr [bp-34] 0 00009125 268C5402 mov word ptr es:[si+2], ss 3477 _.LVL275: 2256:inthndlr.c **** 3478 .loc 1 2256 0 0 00009129 E909FF jmp _.L410 3480 _.LVL276: 3481 _.L425: 2261:inthndlr.c **** (r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : 3482 .loc 1 2261 0 0 0000912C 8E46DE mov es, word ptr [bp-34] 0 0000912F 26C55C06 lds bx, dword ptr es:[si+6] 0 00009133 268B4C04 mov cx, word ptr es:[si+4] 2262:inthndlr.c **** r.callerARG1 & 0xff, r.DI, MK_FP(r.BP, r.SI)); 3486 .loc 1 2262 0 0 00009137 268B4418 mov ax, word ptr es:[si+24] 2261:inthndlr.c **** (r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : 3488 .loc 1 2261 0 0 0000913B 85C0 test ax, ax 0 0000913D 7C1F jl _.L489 2261:inthndlr.c **** (r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : 3491 .loc 1 2261 0 is_stmt 0 discriminator 1 0 0000913F 89C2 mov dx, ax 0 00009141 30F6 xor dh, dh 3494 _.L452: 2261:inthndlr.c **** (r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : 3495 .loc 1 2261 0 discriminator 4 0 00009143 1E push ds 0 00009144 53 push bx 0 00009145 51 push cx 0 00009146 52 push dx 0 00009147 B108 mov cl, 8 0 00009149 D3E8 shr ax, cl 0 0000914B 50 push ax 0 0000914C 16 push ss 0 0000914D 1F pop ds 0 0000914E E8[FEFF] call _CriticalError 3506 _.LVL277: 0 00009151 8E46DE mov es, word ptr [bp-34] 0 00009154 26884410 mov byte ptr es:[si+16], al 3509 _.LVL278: 2264:inthndlr.c **** 3510 .loc 1 2264 0 is_stmt 1 discriminator 4 0 00009158 83C40A add sp, 10 0 0000915B E9D7FE jmp _.L410 3513 _.LVL279: 3514 _.L489: 2261:inthndlr.c **** (r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : 3515 .loc 1 2261 0 0 0000915E 31D2 xor dx, dx 0 00009160 EBE1 jmp _.L452 3518 _.L426: 3519 _.LBB43: 2268:inthndlr.c **** 3520 .loc 1 2268 0 0 00009162 8E46DE mov es, word ptr [bp-34] 0 00009165 268B14 mov dx, word ptr es:[si] 0 00009168 268B5C04 mov bx, word ptr es:[si+4] 3524 _.LVL280: 2270:inthndlr.c **** 3525 .loc 1 2270 0 0 0000916C 8EC2 mov es, dx 0 0000916E 268B07 mov ax, word ptr es:[bx] 0 00009171 8E46DE mov es, word ptr [bp-34] 0 00009174 26894410 mov word ptr es:[si+16], ax 3530 _.LVL281: 2272:inthndlr.c **** --p->sft_count; 3531 .loc 1 2272 0 0 00009178 8EC2 mov es, dx 0 0000917A 268B07 mov ax, word ptr es:[bx] 0 0000917D 89C1 mov cx, ax 0 0000917F 49 dec cx 0 00009180 7406 je _.L453 0 00009182 26890F mov word ptr es:[bx], cx 0 00009185 E9ADFE jmp _.L410 3539 _.L453: 2273:inthndlr.c **** } 3540 .loc 1 2273 0 0 00009188 83C0FE add ax, -2 0 0000918B 8EC2 mov es, dx 0 0000918D 268907 mov word ptr es:[bx], ax 0 00009190 E9A2FE jmp _.L410 3545 _.LVL282: 3546 _.L427: 3547 _.LBE43: 2283:inthndlr.c **** r.FLAGS |= FLG_CARRY; 3548 .loc 1 2283 0 0 00009193 B058 mov al, 88 0 00009195 36F62E[0000] imul byte ptr ss:[_default_drive] 0 0000919A 360306[0000] add ax, word ptr ss:[_CDSp] 0 0000919F 93 xchg bx, ax 2280:inthndlr.c **** default_drive, 3553 .loc 1 2280 0 0 000091A0 8E06[0200] mov es, word ptr [_CDSp+2] 0 000091A4 26C47F45 les di, dword ptr es:[bx+69] 0 000091A8 26FF7515 push word ptr es:[di+21] 0 000091AC 26FF7513 push word ptr es:[di+19] 0 000091B0 8E46DE mov es, word ptr [bp-34] 0 000091B3 26FF7418 push word ptr es:[si+24] 0 000091B7 A0[0000] mov al, byte ptr [_default_drive] 0 000091BA 98 cbw 0 000091BB 50 push ax 0 000091BC B83800 mov ax, 56 0 000091BF 50 push ax 0 000091C0 E8[FEFF] call _CriticalError 3566 _.LVL283: 0 000091C3 88C2 mov dl, al 0 000091C5 8E46DE mov es, word ptr [bp-34] 0 000091C8 26884410 mov byte ptr es:[si+16], al 3570 _.LVL284: 2284:inthndlr.c **** if (r.AL == 1) r.FLAGS &= ~FLG_CARRY; /* carry clear if should retry */ 3571 .loc 1 2284 0 0 000091CC 8E46DE mov es, word ptr [bp-34] 0 000091CF 268B4416 mov ax, word ptr es:[si+22] 2285:inthndlr.c **** break; 3574 .loc 1 2285 0 0 000091D3 83C40A add sp, 10 0 000091D6 80FA01 cmp dl, 1 0 000091D9 7503E93E03 je _.L454 3578 _.L513: 3579 _.LBB44: 2497:inthndlr.c **** break; 3580 .loc 1 2497 0 0 000091DE 83C801 or ax, 1 0 000091E1 E93E03 jmp _.L506 3583 _.LVL285: 3584 _.L428: 3585 _.LBE44: 3586 _.LBB45: 2291:inthndlr.c **** /* default to don't retry, ie fail/abort/etc other than retry */ 3587 .loc 1 2291 0 0 000091E4 8E46DE mov es, word ptr [bp-34] 0 000091E7 268B04 mov ax, word ptr es:[si] 0 000091EA 8946DC mov word ptr [bp-36], ax 0 000091ED 268B5C04 mov bx, word ptr es:[si+4] 3592 _.LVL286: 2293:inthndlr.c **** /* from RBIL if SFT for FCB or compatibility mode without NOINHERIT call int24h */ 3593 .loc 1 2293 0 0 000091F1 26804C1601 or byte ptr es:[si+22], 1 3595 _.LVL287: 2295:inthndlr.c **** { 3596 .loc 1 2295 0 0 000091F6 8E46DC mov es, word ptr [bp-36] 0 000091F9 268B4702 mov ax, word ptr es:[bx+2] 3599 _.LVL288: 0 000091FD 85C0 test ax, ax 0 000091FF 7C04 jl _.L455 2295:inthndlr.c **** { 3602 .loc 1 2295 0 is_stmt 0 discriminator 1 0 00009201 A8F0 test al, -16 0 00009203 7546 jne _.L456 3605 _.L455: 2300:inthndlr.c **** /* clear carry if should retry */ 3606 .loc 1 2300 0 is_stmt 1 0 00009205 B058 mov al, 88 0 00009207 36F62E[0000] imul byte ptr ss:[_default_drive] 0 0000920C 360306[0000] add ax, word ptr ss:[_CDSp] 0 00009211 93 xchg bx, ax 2297:inthndlr.c **** default_drive, 3611 .loc 1 2297 0 0 00009212 8E06[0200] mov es, word ptr [_CDSp+2] 0 00009216 26C47F45 les di, dword ptr es:[bx+69] 0 0000921A 26FF7515 push word ptr es:[di+21] 0 0000921E 26FF7513 push word ptr es:[di+19] 0 00009222 8E46DE mov es, word ptr [bp-34] 0 00009225 26FF7418 push word ptr es:[si+24] 0 00009229 A0[0000] mov al, byte ptr [_default_drive] 0 0000922C 98 cbw 0 0000922D 50 push ax 0 0000922E B83800 mov ax, 56 0 00009231 50 push ax 0 00009232 E8[FEFF] call _CriticalError 3624 _.LVL289: 0 00009235 8E46DE mov es, word ptr [bp-34] 0 00009238 26884410 mov byte ptr es:[si+16], al 2302:inthndlr.c **** } 3627 .loc 1 2302 0 0 0000923C 83C40A add sp, 10 0 0000923F 3C01 cmp al, 1 0 00009241 7508 jne _.L456 2302:inthndlr.c **** } 3631 .loc 1 2302 0 is_stmt 0 discriminator 1 0 00009243 8E46DE mov es, word ptr [bp-34] 0 00009246 26806416FE and byte ptr es:[si+22], -2 3634 _.L456: 2304:inthndlr.c **** } 3635 .loc 1 2304 0 is_stmt 1 0 0000924B 8E46DE mov es, word ptr [bp-34] 0 0000924E 26C744102000 mov word ptr es:[si+16], 32 3638 _.LBE45: 2306:inthndlr.c **** 3639 .loc 1 2306 0 0 00009254 E9DEFD jmp _.L410 3641 _.LVL290: 3642 _.L429: 2310:inthndlr.c **** { 3643 .loc 1 2310 0 0 00009257 36C41E[0000] les bx, dword ptr ss:[_lpCurSft] 0 0000925C 26F6470580 test byte ptr es:[bx+5], -128 0 00009261 7421 je _.L458 3647 _.LBB46: 2314:inthndlr.c **** rq.r_status = 0; 3648 .loc 1 2314 0 0 00009263 C646E300 mov byte ptr [bp-29], 0 2315:inthndlr.c **** rq.r_command = C_OPEN; 3650 .loc 1 2315 0 0 00009267 C746E50000 mov word ptr [bp-27], 0 2316:inthndlr.c **** rq.r_length = sizeof(request); 3652 .loc 1 2316 0 0 0000926C C646E40D mov byte ptr [bp-28], 13 2317:inthndlr.c **** execrh((request FAR *) & rq, lpCurSft->sft_dev); 3654 .loc 1 2317 0 0 00009270 C646E21E mov byte ptr [bp-30], 30 2318:inthndlr.c **** } 3656 .loc 1 2318 0 0 00009274 26FF7709 push word ptr es:[bx+9] 0 00009278 26FF7707 push word ptr es:[bx+7] 0 0000927C 8D46E2 lea ax, [-30+bp] 0 0000927F 16 push ss 0 00009280 50 push ax 0 00009281 E8[FEFF] call _execrh 3663 _.LVL291: 3664 _.L458: 3665 _.LBE46: 2322:inthndlr.c **** break; 3666 .loc 1 2322 0 0 00009284 8B1E[0000] mov bx, word ptr [_lpCurSft] 0 00009288 A1[0000] mov ax, word ptr [_cu_psp] 0 0000928B 8E06[0200] mov es, word ptr [_lpCurSft+2] 0 0000928F 26894731 mov word ptr es:[bx+49], ax 3671 _.LVL292: 2323:inthndlr.c **** 3672 .loc 1 2323 0 0 00009293 E99FFD jmp _.L410 3674 _.LVL293: 3675 _.L430: 2327:inthndlr.c **** r.DX = dos_gettime(); 3676 .loc 1 2327 0 0 00009296 E8[FEFF] call _dos_getdate 3678 _.LVL294: 0 00009299 8E46DE mov es, word ptr [bp-34] 0 0000929C 26894410 mov word ptr es:[si+16], ax 3681 _.LVL295: 2328:inthndlr.c **** break; 3682 .loc 1 2328 0 0 000092A0 E8[FEFF] call _dos_gettime 3684 _.LVL296: 0 000092A3 8E46DE mov es, word ptr [bp-34] 0 000092A6 2689440C mov word ptr es:[si+12], ax 2329:inthndlr.c **** 3687 .loc 1 2329 0 0 000092AA E988FD jmp _.L410 3689 _.LVL297: 3690 _.L431: 3691 _.LBB47: 2334:inthndlr.c **** char FAR *t = MK_FP(r.ES, r.DI); 3692 .loc 1 2334 0 0 000092AD 8E46DE mov es, word ptr [bp-34] 0 000092B0 268E5C02 mov ds, word ptr es:[si+2] 0 000092B4 268B5C06 mov bx, word ptr es:[si+6] 3696 _.LVL298: 2335:inthndlr.c **** 3697 .loc 1 2335 0 0 000092B8 268B3C mov di, word ptr es:[si] 0 000092BB 268B7404 mov si, word ptr es:[si+4] 3700 _.LVL299: 3701 _.L461: 2339:inthndlr.c **** /* uppercase character */ 3702 .loc 1 2339 0 0 000092BF 8D5701 lea dx, [1+bx] 3704 _.LVL300: 0 000092C2 8A07 mov al, byte ptr [bx] 3706 _.LVL301: 2342:inthndlr.c **** c -= 'a' - 'A'; 3707 .loc 1 2342 0 0 000092C4 88C4 mov ah, al 0 000092C6 80C49F add ah, -97 0 000092C9 80FC19 cmp ah, 25 0 000092CC 7717 ja _.L459 2343:inthndlr.c **** else if (c == '/') 3712 .loc 1 2343 0 0 000092CE 04E0 add al, -32 3714 _.LVL302: 3715 _.L460: 2346:inthndlr.c **** } 3716 .loc 1 2346 0 0 000092D0 8D4C01 lea cx, [1+si] 3718 _.LVL303: 0 000092D3 8EC7 mov es, di 0 000092D5 268804 mov byte ptr es:[si], al 2339:inthndlr.c **** /* uppercase character */ 3721 .loc 1 2339 0 0 000092D8 89D3 mov bx, dx 2348:inthndlr.c **** break; 3723 .loc 1 2348 0 0 000092DA 84C0 test al, al 0 000092DC 7503E954FD je _.L410 2346:inthndlr.c **** } 3726 .loc 1 2346 0 0 000092E1 89CE mov si, cx 0 000092E3 EBDA jmp _.L461 3729 _.LVL304: 3730 _.L459: 2344:inthndlr.c **** c = '\\'; 3731 .loc 1 2344 0 0 000092E5 3C2F cmp al, 47 0 000092E7 75E7 jne _.L460 2345:inthndlr.c **** *t++ = c; 3734 .loc 1 2345 0 0 000092E9 B05C mov al, 92 3736 _.LVL305: 0 000092EB EBE3 jmp _.L460 3738 _.LVL306: 3739 _.L432: 3740 _.LBE47: 2354:inthndlr.c **** 3741 .loc 1 2354 0 0 000092ED 8E46DE mov es, word ptr [bp-34] 0 000092F0 268B4404 mov ax, word ptr es:[si+4] 0 000092F4 26FF34 push word ptr es:[si] 3745 _.L507: 2507:inthndlr.c **** break; 3746 .loc 1 2507 0 0 000092F7 50 push ax 0 000092F8 E8[FEFF] call _fstrlen 3749 _.LVL307: 0 000092FB 40 inc ax 0 000092FC 8E46DE mov es, word ptr [bp-34] 0 000092FF 2689440E mov word ptr es:[si+14], ax 3753 _.LVL308: 2508:inthndlr.c **** 3754 .loc 1 2508 0 0 00009303 E92FFD jmp _.L410 3756 _.LVL309: 3757 _.L433: 2361:inthndlr.c **** if (r.AL >= 'a' && r.AL <= 'z') 3758 .loc 1 2361 0 0 00009306 8E46DE mov es, word ptr [bp-34] 0 00009309 268B5418 mov dx, word ptr es:[si+24] 0 0000930D 88D0 mov al, dl 2362:inthndlr.c **** r.AL -= 'a' - 'A'; 3762 .loc 1 2362 0 0 0000930F 88D4 mov ah, dl 0 00009311 80C49F add ah, -97 0 00009314 80FC19 cmp ah, 25 0 00009317 7607 jbe _.L462 2361:inthndlr.c **** if (r.AL >= 'a' && r.AL <= 'z') 3767 .loc 1 2361 0 0 00009319 26885410 mov byte ptr es:[si+16], dl 3769 _.LVL310: 0 0000931D E915FD jmp _.L410 3771 _.LVL311: 3772 _.L462: 2363:inthndlr.c **** break; 3773 .loc 1 2363 0 0 00009320 04E0 add al, -32 0 00009322 8E46DE mov es, word ptr [bp-34] 3776 _.L510: 2422:inthndlr.c **** break; 3777 .loc 1 2422 0 0 00009325 26884410 mov byte ptr es:[si+16], al 3779 _.LVL312: 2423:inthndlr.c **** 3780 .loc 1 2423 0 0 00009329 E909FD jmp _.L410 3782 _.LVL313: 3783 _.L434: 3784 _.LBB48: 2373:inthndlr.c **** 3785 .loc 1 2373 0 0 0000932C 8E46DE mov es, word ptr [bp-34] 0 0000932F 26FF740A push word ptr es:[si+10] 0 00009333 E8[FEFF] call _idx_to_sft_ 3789 _.LVL314: 2375:inthndlr.c **** { 3790 .loc 1 2375 0 0 00009336 83F8FF cmp ax, -1 0 00009339 8E46DE mov es, word ptr [bp-34] 0 0000933C 268B5416 mov dx, word ptr es:[si+22] 0 00009340 750A jne _.L463 2377:inthndlr.c **** break; 3795 .loc 1 2377 0 0 00009342 83CA01 or dx, 1 0 00009345 26895416 mov word ptr es:[si+22], dx 3798 _.LVL315: 2378:inthndlr.c **** } 3799 .loc 1 2378 0 0 00009349 E9E9FC jmp _.L410 3801 _.LVL316: 3802 _.L463: 2380:inthndlr.c **** r.BX = rel_idx; 3803 .loc 1 2380 0 0 0000934C 83E2FE and dx, -2 0 0000934F 8E46DE mov es, word ptr [bp-34] 0 00009352 26895416 mov word ptr es:[si+22], dx 3807 _.LVL317: 2381:inthndlr.c **** r.ES = FP_SEG(lpCurSft); 3808 .loc 1 2381 0 0 00009356 8E46DE mov es, word ptr [bp-34] 0 00009359 2689440A mov word ptr es:[si+10], ax 2382:inthndlr.c **** r.DI = FP_OFF(lpCurSft); 3811 .loc 1 2382 0 0 0000935D A1[0200] mov ax, word ptr [_lpCurSft+2] 3813 _.LVL318: 0 00009360 8E46DE mov es, word ptr [bp-34] 3815 _.LVL319: 0 00009363 268904 mov word ptr es:[si], ax 2383:inthndlr.c **** break; 3817 .loc 1 2383 0 0 00009366 A1[0000] mov ax, word ptr [_lpCurSft] 0 00009369 E98DFD jmp _.L505 3820 _.LVL320: 3821 _.L435: 3822 _.LBE48: 3823 _.LBB49: 2401:inthndlr.c **** 3824 .loc 1 2401 0 0 0000936C 8E46DE mov es, word ptr [bp-34] 0 0000936F 268B4418 mov ax, word ptr es:[si+24] 0 00009373 8946DC mov word ptr [bp-36], ax 0 00009376 30E4 xor ah, ah 0 00009378 50 push ax 0 00009379 E8[FEFF] call _get_cds_unvalidated 3831 _.LVL321: 2403:inthndlr.c **** { 3832 .loc 1 2403 0 0 0000937C 89C1 mov cx, ax 0 0000937E 09D1 or cx, dx 0 00009380 8E46DE mov es, word ptr [bp-34] 0 00009383 268B4C16 mov cx, word ptr es:[si+22] 0 00009387 750A jne _.L464 2405:inthndlr.c **** break; 3838 .loc 1 2405 0 0 00009389 83C901 or cx, 1 3840 _.LVL322: 3841 _.L511: 2410:inthndlr.c **** break; 3842 .loc 1 2410 0 0 0000938C 26894C16 mov word ptr es:[si+22], cx 2411:inthndlr.c **** } 3844 .loc 1 2411 0 0 00009390 E9A2FC jmp _.L410 3846 _.LVL323: 3847 _.L464: 2408:inthndlr.c **** r.SI = FP_OFF(cdsp); 3848 .loc 1 2408 0 0 00009393 8E46DE mov es, word ptr [bp-34] 0 00009396 26895402 mov word ptr es:[si+2], dx 3851 _.LVL324: 2409:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 3852 .loc 1 2409 0 0 0000939A 8E46DE mov es, word ptr [bp-34] 0 0000939D 26894406 mov word ptr es:[si+6], ax 2410:inthndlr.c **** break; 3855 .loc 1 2410 0 0 000093A1 83E1FE and cx, -2 0 000093A4 8E46DE mov es, word ptr [bp-34] 0 000093A7 EBE3 jmp _.L511 3859 _.LVL325: 3860 _.L436: 3861 _.LBE49: 2416:inthndlr.c **** r.SI = FP_OFF(user_r); 3862 .loc 1 2416 0 0 000093A9 A1[0200] mov ax, word ptr [_user_r+2] 0 000093AC 8E46DE mov es, word ptr [bp-34] 0 000093AF 26894402 mov word ptr es:[si+2], ax 3866 _.LVL326: 2417:inthndlr.c **** break; 3867 .loc 1 2417 0 0 000093B3 A1[0000] mov ax, word ptr [_user_r] 0 000093B6 8E46DE mov es, word ptr [bp-34] 0 000093B9 26894406 mov word ptr es:[si+6], ax 2418:inthndlr.c **** 3871 .loc 1 2418 0 0 000093BD E975FC jmp _.L410 3873 _.LVL327: 3874 _.L437: 2422:inthndlr.c **** break; 3875 .loc 1 2422 0 0 000093C0 8E46DE mov es, word ptr [bp-34] 0 000093C3 268A440E mov al, byte ptr es:[si+14] 0 000093C7 2403 and al, 3 0 000093C9 3C01 cmp al, 1 0 000093CB F5 cmc 0 000093CC 18C0 sbb al, al 0 000093CE 041D add al, 29 0 000093D0 E952FF jmp _.L510 3884 _.L438: 3885 _.LBB50: 2429:inthndlr.c **** struct cds FAR *cdsp; 3886 .loc 1 2429 0 0 000093D3 8E46DE mov es, word ptr [bp-34] 0 000093D6 268B4418 mov ax, word ptr es:[si+24] 0 000093DA 8946DC mov word ptr [bp-36], ax 0 000093DD 83E01F and ax, 31 0 000093E0 48 dec ax 3892 _.LVL328: 2431:inthndlr.c **** { 3893 .loc 1 2431 0 0 000093E1 8B56DC mov dx, word ptr [bp-36] 0 000093E4 83C2BF add dx, -65 0 000093E7 83FA3A cmp dx, 57+1 0 000093EA 7305 jnc _.L478 0 000093EC 83F8FF cmp ax, -1 0 000093EF 720B jc _.L466 3900 _.LVL329: 3901 _.L478: 3902 _.LBE50: 2649:inthndlr.c **** 3903 .loc 1 2649 0 discriminator 7 0 000093F1 8E46DE mov es, word ptr [bp-34] 0 000093F4 26804C1601 or byte ptr es:[si+22], 1 0 000093F9 E939FC jmp _.L410 3907 _.LVL330: 3908 _.L466: 3909 _.LBB51: 2436:inthndlr.c **** if (cdsp == NULL) 3910 .loc 1 2436 0 0 000093FC 50 push ax 0 000093FD E8[FEFF] call _get_cds_unvalidated 3913 _.LVL331: 2437:inthndlr.c **** { 3914 .loc 1 2437 0 0 00009400 89C3 mov bx, ax 0 00009402 09D0 or ax, dx 0 00009404 85C0 test ax, ax 0 00009406 74E9 je _.L478 0 00009408 8956DA mov word ptr [bp-38], dx 0 0000940B 895EDC mov word ptr [bp-36], bx 3921 _.LVL332: 2442:inthndlr.c **** *TempCDS.cdsCurrentPath = (BYTE)(r.callerARG1 & 0xff); 3922 .loc 1 2442 0 0 0000940E B8[5100] mov ax, offset _.LC3 0 00009411 50 push ax 0 00009412 BF[0000] mov di, offset _TempCDS 0 00009415 57 push di 0 00009416 E8[FEFF] call _strcpy 3928 _.LVL333: 2443:inthndlr.c **** TempCDS.cdsBackslashOffset = 2; 3929 .loc 1 2443 0 0 00009419 8E46DE mov es, word ptr [bp-34] 0 0000941C 268B4418 mov ax, word ptr es:[si+24] 0 00009420 8805 mov byte ptr [di], al 2444:inthndlr.c **** if (cdsp->cdsFlags) 3933 .loc 1 2444 0 0 00009422 C706[4F00]0200 mov word ptr [_TempCDS+79], 2 2445:inthndlr.c **** { 3935 .loc 1 2445 0 0 00009428 8B56DA mov dx, word ptr [bp-38] 0 0000942B 8EC2 mov es, dx 0 0000942D 8B5EDC mov bx, word ptr [bp-36] 0 00009430 26837F4300 cmp word ptr es:[bx+67], 0 0 00009435 7447 je _.L469 2447:inthndlr.c **** TempCDS.cdsFlags = CDSPHYSDRV; /* don't inherit CDS flags */ 3941 .loc 1 2447 0 0 00009437 268B4F45 mov cx, word ptr es:[bx+69] 0 0000943B 268B4747 mov ax, word ptr es:[bx+71] 0 0000943F 894D45 mov word ptr [di+69], cx 0 00009442 894547 mov word ptr [di+71], ax 2448:inthndlr.c **** } 3946 .loc 1 2448 0 0 00009445 C706[4300]0040 mov word ptr [_TempCDS+67], 16384 3948 _.L470: 2455:inthndlr.c **** TempCDS.cdsParam = 0xffff; 3949 .loc 1 2455 0 0 0000944B C706[4900]FFFF mov word ptr [_TempCDS+73], -1 2456:inthndlr.c **** TempCDS.cdsStoreUData = 0xffff; 3951 .loc 1 2456 0 0 00009451 C706[4B00]FFFF mov word ptr [_TempCDS+75], -1 2457:inthndlr.c **** r.CX = sizeof(TempCDS); 3953 .loc 1 2457 0 0 00009457 C706[4D00]FFFF mov word ptr [_TempCDS+77], -1 2458:inthndlr.c **** r.ES = FP_SEG(&TempCDS); 3955 .loc 1 2458 0 0 0000945D 8E46DE mov es, word ptr [bp-34] 0 00009460 26C7440E5800 mov word ptr es:[si+14], 88 3958 _.LVL334: 2459:inthndlr.c **** r.DI = FP_OFF(&TempCDS); 3959 .loc 1 2459 0 0 00009466 8E46DE mov es, word ptr [bp-34] 0 00009469 268C14 mov word ptr es:[si], ss 2460:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 3962 .loc 1 2460 0 0 0000946C 8E46DE mov es, word ptr [bp-34] 0 0000946F 26897C04 mov word ptr es:[si+4], di 3965 _.L447: 3966 _.LBE51: 2563:inthndlr.c **** break; 3967 .loc 1 2563 0 0 00009473 8E46DE mov es, word ptr [bp-34] 0 00009476 26806416FE and byte ptr es:[si+22], -2 2564:inthndlr.c **** 3970 .loc 1 2564 0 0 0000947B E9B7FB jmp _.L410 3972 _.LVL335: 3973 _.L469: 3974 _.LBB52: 2452:inthndlr.c **** TempCDS.cdsFlags = 0; 3975 .loc 1 2452 0 0 0000947E C706[4500]0000 mov word ptr [_TempCDS+69], 0 0 00009484 C706[4700]0000 mov word ptr [_TempCDS+71], 0 2453:inthndlr.c **** } 3978 .loc 1 2453 0 0 0000948A C706[4300]0000 mov word ptr [_TempCDS+67], 0 0 00009490 EBB9 jmp _.L470 3981 _.L439: 3982 _.LBE52: 3983 _.LBB53: 2467:inthndlr.c **** unsigned char FAR *idx; 3984 .loc 1 2467 0 0 00009492 8B1E[0000] mov bx, word ptr [_cu_psp] 3986 _.LVL336: 2470:inthndlr.c **** { 3987 .loc 1 2470 0 0 00009496 8E46DE mov es, word ptr [bp-34] 0 00009499 268B540A mov dx, word ptr es:[si+10] 0 0000949D 8EC3 mov es, bx 0 0000949F 263B163200 cmp dx, word ptr es:[50] 0 000094A4 8E46DE mov es, word ptr [bp-34] 0 000094A7 268B4416 mov ax, word ptr es:[si+22] 0 000094AB 720A jc _.L471 2472:inthndlr.c **** r.FLAGS |= FLG_CARRY; 3995 .loc 1 2472 0 0 000094AD 26C6441006 mov byte ptr es:[si+16], 6 3997 _.LVL337: 2473:inthndlr.c **** break; 3998 .loc 1 2473 0 0 000094B2 83C801 or ax, 1 0 000094B5 EB68 jmp _.L512 4001 _.LVL338: 4002 _.L471: 2476:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 4003 .loc 1 2476 0 0 000094B7 8EC3 mov es, bx 0 000094B9 268B0E3600 mov cx, word ptr es:[54] 0 000094BE 2603163400 add dx, word ptr es:[52] 4007 _.LVL339: 2477:inthndlr.c **** r.ES = FP_SEG(idx); 4008 .loc 1 2477 0 0 000094C3 83E0FE and ax, -2 0 000094C6 8E46DE mov es, word ptr [bp-34] 0 000094C9 26894416 mov word ptr es:[si+22], ax 4012 _.LVL340: 2478:inthndlr.c **** r.DI = FP_OFF(idx); 4013 .loc 1 2478 0 0 000094CD 8E46DE mov es, word ptr [bp-34] 0 000094D0 26890C mov word ptr es:[si], cx 2479:inthndlr.c **** } 4016 .loc 1 2479 0 0 000094D3 8E46DE mov es, word ptr [bp-34] 0 000094D6 26895404 mov word ptr es:[si+4], dx 4019 _.LBE53: 2481:inthndlr.c **** 4020 .loc 1 2481 0 0 000094DA E958FB jmp _.L410 4022 _.LVL341: 4023 _.L440: 2485:inthndlr.c **** 4024 .loc 1 2485 0 0 000094DD 8E46DE mov es, word ptr [bp-34] 0 000094E0 268B4404 mov ax, word ptr es:[si+4] 0 000094E4 26FF34 push word ptr es:[si] 0 000094E7 50 push ax 0 000094E8 268B4406 mov ax, word ptr es:[si+6] 0 000094EC 26FF7402 push word ptr es:[si+2] 0 000094F0 50 push ax 0 000094F1 E8[FEFF] call _DosTruename 4033 _.LVL342: 2487:inthndlr.c **** 4034 .loc 1 2487 0 0 000094F4 E93EFB jmp _.L410 4036 _.L441: 4037 _.LBB54: 2493:inthndlr.c **** 4038 .loc 1 2493 0 0 000094F7 16 push ss 0 000094F8 B8[0000] mov ax, offset _DirEntBuffer 0 000094FB 50 push ax 0 000094FC E8[FEFF] call _IsDevice 4043 _.LVL343: 2495:inthndlr.c **** { 4044 .loc 1 2495 0 0 000094FF 89C3 mov bx, ax 0 00009501 09D0 or ax, dx 0 00009503 8E46DE mov es, word ptr [bp-34] 0 00009506 268B4416 mov ax, word ptr es:[si+22] 0 0000950A 7503E9CFFC je _.L513 2500:inthndlr.c **** r.FLAGS &= ~FLG_CARRY; 4050 .loc 1 2500 0 0 0000950F 8EC2 mov es, dx 0 00009511 268B5704 mov dx, word ptr es:[bx+4] 0 00009515 8E46DE mov es, word ptr [bp-34] 0 00009518 2688540B mov byte ptr es:[si+11], dl 4055 _.LVL344: 4056 _.L454: 4057 _.LBE54: 2285:inthndlr.c **** break; 4058 .loc 1 2285 0 discriminator 1 0 0000951C 83E0FE and ax, -2 4060 _.L512: 0 0000951F 8E46DE mov es, word ptr [bp-34] 4062 _.L506: 0 00009522 26894416 mov word ptr es:[si+22], ax 0 00009526 E90CFB jmp _.L410 4065 _.LVL345: 4066 _.L442: 2507:inthndlr.c **** break; 4067 .loc 1 2507 0 0 00009529 8E46DE mov es, word ptr [bp-34] 0 0000952C 268B4406 mov ax, word ptr es:[si+6] 0 00009530 26FF7402 push word ptr es:[si+2] 0 00009534 E9C0FD jmp _.L507 4072 _.L443: 2511:inthndlr.c **** CritErrCode = SUCCESS; 4073 .loc 1 2511 0 0 00009537 8E46DE mov es, word ptr [bp-34] 0 0000953A 26806416FE and byte ptr es:[si+22], -2 4076 _.LVL346: 2512:inthndlr.c **** lrc = DosOpen(MK_FP(r.DS, r.DX), O_LEGACY | O_OPEN | r.CL, 0); 4077 .loc 1 2512 0 0 0000953F C706[0000]0000 mov word ptr [_CritErrCode], 0 2513:inthndlr.c **** goto long_check; 4079 .loc 1 2513 0 0 00009545 31C0 xor ax, ax 0 00009547 50 push ax 0 00009548 8E46DE mov es, word ptr [bp-34] 0 0000954B 268A440E mov al, byte ptr es:[si+14] 0 0000954F 30E4 xor ah, ah 0 00009551 80CC09 or ah, 9 0 00009554 50 push ax 0 00009555 268B440C mov ax, word ptr es:[si+12] 0 00009559 26FF7402 push word ptr es:[si+2] 0 0000955D 50 push ax 0 0000955E E8[FEFF] call _DosOpen 4091 _.LVL347: 4092 _.L473: 2632:inthndlr.c **** { 4093 .loc 1 2632 0 0 00009561 85D2 test dx, dx 0 00009563 7C03E95101 jge _.L509 0 00009568 EB18 jmp _.L480 4097 _.LVL348: 4098 _.L444: 2517:inthndlr.c **** CritErrCode = SUCCESS; 4099 .loc 1 2517 0 0 0000956A 8E46DE mov es, word ptr [bp-34] 0 0000956D 26806416FE and byte ptr es:[si+22], -2 4102 _.LVL349: 2518:inthndlr.c **** rc = DosClose(r.BX); 4103 .loc 1 2518 0 0 00009572 C706[0000]0000 mov word ptr [_CritErrCode], 0 2519:inthndlr.c **** goto short_check; 4105 .loc 1 2519 0 0 00009578 8E46DE mov es, word ptr [bp-34] 0 0000957B 26FF740A push word ptr es:[si+10] 0 0000957F E8[FEFF] call _DosClose 4109 _.LVL350: 4110 _.L480: 2637:inthndlr.c **** short_check: 4111 .loc 1 2637 0 0 00009582 8946E0 mov word ptr [bp-32], ax 0 00009585 EB4C jmp _.L474 4114 _.LVL351: 4115 _.L445: 2543:inthndlr.c **** CritErrCode = SUCCESS; 4116 .loc 1 2543 0 0 00009587 8E46DE mov es, word ptr [bp-34] 0 0000958A 26806416FE and byte ptr es:[si+22], -2 4119 _.LVL352: 2544:inthndlr.c **** if (r.BP < 0x4200 || r.BP > 0x4202) 4120 .loc 1 2544 0 0 0000958F C706[0000]0000 mov word ptr [_CritErrCode], 0 2545:inthndlr.c **** goto error_invalid; 4122 .loc 1 2545 0 0 00009595 8E46DE mov es, word ptr [bp-34] 0 00009598 268B4408 mov ax, word ptr es:[si+8] 0 0000959C 89C2 mov dx, ax 0 0000959E 80C6BE add dh, -66 0 000095A1 83FA02 cmp dx, 2 0 000095A4 7603E97201 ja _.L475 2547:inthndlr.c **** if (rc == SUCCESS) 4129 .loc 1 2547 0 0 000095A9 8D56E0 lea dx, [-32+bp] 0 000095AC 52 push dx 0 000095AD 30E4 xor ah, ah 0 000095AF 50 push ax 0 000095B0 26FF740E push word ptr es:[si+14] 0 000095B4 26FF740C push word ptr es:[si+12] 0 000095B8 26FF740A push word ptr es:[si+10] 0 000095BC E8[FEFF] call _DosSeek 4138 _.LVL353: 2548:inthndlr.c **** { 4139 .loc 1 2548 0 0 000095BF 837EE000 cmp word ptr [bp-32], 0 0 000095C3 750E jne _.L474 2550:inthndlr.c **** r.AX = (UWORD) lrc; 4142 .loc 1 2550 0 0 000095C5 8E46DE mov es, word ptr [bp-34] 0 000095C8 2689540C mov word ptr es:[si+12], dx 2551:inthndlr.c **** } 4145 .loc 1 2551 0 0 000095CC 8E46DE mov es, word ptr [bp-34] 0 000095CF 26894410 mov word ptr es:[si+16], ax 4148 _.LVL354: 4149 _.L474: 2639:inthndlr.c **** goto error_exit; 4150 .loc 1 2639 0 0 000095D3 837EE000 cmp word ptr [bp-32], 0 0 000095D7 7C03E959FA jge _.L410 4153 _.L482: 2645:inthndlr.c **** if (CritErrCode == SUCCESS) 4154 .loc 1 2645 0 0 000095DC 8B46E0 mov ax, word ptr [bp-32] 0 000095DF F7D8 neg ax 0 000095E1 8E46DE mov es, word ptr [bp-34] 0 000095E4 26894410 mov word ptr es:[si+16], ax 2646:inthndlr.c **** CritErrCode = r.AX; /* Maybe set */ 4159 .loc 1 2646 0 0 000095E8 36833E[0000]00 cmp word ptr ss:[_CritErrCode], 0 0 000095EE 7403E9FEFD jne _.L478 2647:inthndlr.c **** error_carry: 4162 .loc 1 2647 0 0 000095F3 A3[0000] mov word ptr [_CritErrCode], ax 0 000095F6 E9F8FD jmp _.L478 4165 _.LVL355: 4166 _.L446: 2556:inthndlr.c **** CritErrCode = SUCCESS; 4167 .loc 1 2556 0 0 000095F9 8E46DE mov es, word ptr [bp-34] 0 000095FC 26806416FE and byte ptr es:[si+22], -2 4170 _.LVL356: 2557:inthndlr.c **** lrc = DosRead(r.BX, r.CX, MK_FP(r.DS, r.DX)); 4171 .loc 1 2557 0 0 00009601 C706[0000]0000 mov word ptr [_CritErrCode], 0 2558:inthndlr.c **** goto long_check; 4173 .loc 1 2558 0 0 00009607 8E46DE mov es, word ptr [bp-34] 0 0000960A 268B7C02 mov di, word ptr es:[si+2] 0 0000960E 268B440C mov ax, word ptr es:[si+12] 0 00009612 8946DA mov word ptr [bp-38], ax 0 00009615 268B440E mov ax, word ptr es:[si+14] 0 00009619 8946DC mov word ptr [bp-36], ax 0 0000961C 26FF740A push word ptr es:[si+10] 0 00009620 E8[FEFF] call _get_sft_idx 4182 _.LVL357: 0 00009623 BA0100 mov dx, 1 0 00009626 52 push dx 0 00009627 57 push di 0 00009628 FF76DA push word ptr [bp-38] 0 0000962B FF76DC push word ptr [bp-36] 0 0000962E 50 push ax 0 0000962F E8[FEFF] call _DosRWSft 4190 _.LVL358: 2559:inthndlr.c **** 4191 .loc 1 2559 0 0 00009632 E92CFF jmp _.L473 4193 _.LVL359: 4194 _.L448: 2567:inthndlr.c **** goto error_invalid; 4195 .loc 1 2567 0 0 00009635 8E46DE mov es, word ptr [bp-34] 0 00009638 268B4408 mov ax, word ptr es:[si+8] 0 0000963C 89C2 mov dx, ax 0 0000963E 80C6BC add dh, -68 0 00009641 81FAFF00 cmp dx, 255 0 00009645 7603E9D100 ja _.L475 4202 _.LBB55: 2571:inthndlr.c **** lr.BX = r.BX; 4203 .loc 1 2571 0 0 0000964A 8946E2 mov word ptr [bp-30], ax 2572:inthndlr.c **** lr.CX = r.CX; 4205 .loc 1 2572 0 0 0000964D 268B440A mov ax, word ptr es:[si+10] 0 00009651 8946E4 mov word ptr [bp-28], ax 2573:inthndlr.c **** lr.DX = r.DX; 4208 .loc 1 2573 0 0 00009654 268B440E mov ax, word ptr es:[si+14] 0 00009658 8946E6 mov word ptr [bp-26], ax 2574:inthndlr.c **** lr.DI = r.DI; 4211 .loc 1 2574 0 0 0000965B 268B440C mov ax, word ptr es:[si+12] 0 0000965F 8946E8 mov word ptr [bp-24], ax 2575:inthndlr.c **** lr.SI = r.SI; 4214 .loc 1 2575 0 0 00009662 268B4404 mov ax, word ptr es:[si+4] 0 00009666 8946EC mov word ptr [bp-20], ax 2576:inthndlr.c **** lr.DS = r.DS; 4217 .loc 1 2576 0 0 00009669 268B4406 mov ax, word ptr es:[si+6] 0 0000966D 8946EA mov word ptr [bp-22], ax 2577:inthndlr.c **** rc = DosDevIOctl(&lr); /* can set critical error code! */ 4220 .loc 1 2577 0 0 00009670 268B4402 mov ax, word ptr es:[si+2] 0 00009674 8946EE mov word ptr [bp-18], ax 2578:inthndlr.c **** } 4223 .loc 1 2578 0 0 00009677 8D46E2 lea ax, [-30+bp] 0 0000967A 50 push ax 0 0000967B E8[FEFF] call _DosDevIOctl 4227 _.LVL360: 0 0000967E 8946E0 mov word ptr [bp-32], ax 4229 _.LBE55: 2581:inthndlr.c **** { 4230 .loc 1 2581 0 0 00009681 85C0 test ax, ax 0 00009683 7C03E9ADF9 jge _.L410 2583:inthndlr.c **** if (rc != DE_DEVICE && rc != DE_ACCESS) 4233 .loc 1 2583 0 0 00009688 89C2 mov dx, ax 0 0000968A F7DA neg dx 0 0000968C 8E46DE mov es, word ptr [bp-34] 0 0000968F 26895410 mov word ptr es:[si+16], dx 4238 _.LVL361: 2584:inthndlr.c **** CritErrCode = r.AX; 4239 .loc 1 2584 0 0 00009693 83F8EF cmp ax, -17 0 00009696 7503E956FD je _.L478 0 0000969B 83F8FB cmp ax, -5 0 0000969E 7503E94EFD je _.L478 2585:inthndlr.c **** goto error_carry; 4244 .loc 1 2585 0 0 000096A3 8916[0000] mov word ptr [_CritErrCode], dx 0 000096A7 E947FD jmp _.L478 4247 _.LVL362: 4248 _.L449: 2594:inthndlr.c **** r.AX = FP_OFF(nul_dev.dh_next); 4249 .loc 1 2594 0 0 000096AA BB[0000] mov bx, offset _nul_dev 0 000096AD 8B07 mov ax, word ptr [bx] 0 000096AF 8B5702 mov dx, word ptr [bx+2] 0 000096B2 8E46DE mov es, word ptr [bp-34] 0 000096B5 2689540A mov word ptr es:[si+10], dx 4255 _.LVL363: 4256 _.L509: 2634:inthndlr.c **** return; 4257 .loc 1 2634 0 0 000096B9 8E46DE mov es, word ptr [bp-34] 0 000096BC 26894410 mov word ptr es:[si+16], ax 2635:inthndlr.c **** } 4260 .loc 1 2635 0 0 000096C0 E972F9 jmp _.L410 4262 _.LVL364: 4263 _.L450: 2599:inthndlr.c **** 4264 .loc 1 2599 0 0 000096C3 A1[0000] mov ax, word ptr [_CritErrCode] 0 000096C6 EBF1 jmp _.L509 4267 _.L451: 2609:inthndlr.c **** { 4268 .loc 1 2609 0 0 000096C8 8E46DE mov es, word ptr [bp-34] 0 000096CB 26837C0C00 cmp word ptr es:[si+12], 0 0 000096D0 7411 je _.L479 2611:inthndlr.c **** os_setver_minor = r.DH; 4272 .loc 1 2611 0 0 000096D2 268A440C mov al, byte ptr es:[si+12] 0 000096D6 A2[0000] mov byte ptr [_os_setver_major], al 2612:inthndlr.c **** } 4275 .loc 1 2612 0 0 000096D9 268A440D mov al, byte ptr es:[si+13] 4277 _.L508: 2617:inthndlr.c **** } 4278 .loc 1 2617 0 0 000096DD A2[0000] mov byte ptr [_os_setver_minor], al 0 000096E0 E952F9 jmp _.L410 4281 _.L479: 2616:inthndlr.c **** os_setver_minor = os_minor; 4282 .loc 1 2616 0 0 000096E3 A0[0000] mov al, byte ptr [_os_major] 0 000096E6 A2[0000] mov byte ptr [_os_setver_major], al 2617:inthndlr.c **** } 4285 .loc 1 2617 0 0 000096E9 A0[0000] mov al, byte ptr [_os_minor] 0 000096EC EBEF jmp _.L508 4288 _.L421: 2622:inthndlr.c **** { 4289 .loc 1 2622 0 0 000096EE 3C31 cmp al, 49 0 000096F0 7603E940F9 ja _.L410 2624:inthndlr.c **** put_unsigned(r.AL, 16, 2); 4292 .loc 1 2624 0 0 000096F5 B8[5500] mov ax, offset _.LC4 0 000096F8 50 push ax 0 000096F9 E8[FEFF] call _put_string 4296 _.LVL365: 2625:inthndlr.c **** put_string("\n"); 4297 .loc 1 2625 0 0 000096FC B80200 mov ax, 2 0 000096FF 50 push ax 0 00009700 B81000 mov ax, 16 0 00009703 50 push ax 0 00009704 8E46DE mov es, word ptr [bp-34] 0 00009707 268A4410 mov al, byte ptr es:[si+16] 0 0000970B 30E4 xor ah, ah 0 0000970D 50 push ax 0 0000970E E8[FEFF] call _put_unsigned 4307 _.LVL366: 2626:inthndlr.c **** r.FLAGS |= FLG_CARRY; 4308 .loc 1 2626 0 0 00009711 B8[8200] mov ax, offset _.LC5 0 00009714 50 push ax 0 00009715 E8[FEFF] call _put_string 4312 _.LVL367: 0 00009718 E9D6FC jmp _.L478 4314 _.LVL368: 4315 _.L475: 4316 _.LDL1: 2643:inthndlr.c **** error_exit: 4317 .loc 1 2643 0 0 0000971B C746E0FFFF mov word ptr [bp-32], -1 0 00009720 E9B9FE jmp _.L482 4320 _.LFE8: 4321 .size _int2F_12_handler, .-_int2F_12_handler 4322 .global _fnode === Switch to base=012BB0h -> ".BSS" 4323 .bss 4324 .p2align 0 4325 .type _fnode, @object 4326 .size _fnode, 116 4327 _fnode: 0 00000D34 0000000000000000 .skip 116,0 0 00000D3C 0000000000000000 0 00000D44 0000000000000000 0 00000D4C 0000000000000000 0 00000D54 0000000000000000 0 00000D5C 0000000000000000 0 00000D64 0000000000000000 0 00000D6C 0000000000000000 0 00000D74 0000000000000000 0 00000D7C 0000000000000000 0 00000D84 0000000000000000 0 00000D8C 0000000000000000 0 00000D94 0000000000000000 0 00000D9C 0000000000000000 0 00000DA4 00000000 4329 .global _HaltCpuWhileIdle 4330 .p2align 0 4331 .type _HaltCpuWhileIdle, @object 4332 .size _HaltCpuWhileIdle, 1 4333 _HaltCpuWhileIdle: 0 00000DA8 00 .skip 1,0 4335 .global _ReturnAnyDosVersionExpected 4336 .p2align 0 4337 .type _ReturnAnyDosVersionExpected, @object 4338 .size _ReturnAnyDosVersionExpected, 1 4339 _ReturnAnyDosVersionExpected: 0 00000DA9 00 .skip 1,0 4341 .global _firstAvailableBuf 4342 .p2align 1 4343 .type _firstAvailableBuf, @object 4344 .size _firstAvailableBuf, 4 4345 _firstAvailableBuf: 0 00000DAA 00000000 .skip 4,0 4347 .global _os_release === Switch to base=012BB0h -> ".RODATA" 4348 .section .rodata 4349 .type _os_release, @object 4350 .size _os_release, 67 4351 _os_release: 0 00001800 46726565444F5320 .string "FreeDOS kernel - GIT (build 2044 OEM:0xfd) [compiled Apr 23 2026]\n" 0 00001808 6B65726E656C202D 0 00001810 2047495420286275 0 00001818 696C642032303434 0 00001820 204F454D3A307866 0 00001828 6429205B636F6D70 0 00001830 696C656420417072 0 00001838 2032332032303236 0 00001840 5D0A00 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: intr.lst 1 ; File: 2 ; intr.asm 3 ; Description: 4 ; Assembly implementation of calling an interrupt 5 ; 6 ; Copyright (c) 2000 7 ; Steffen Kaiser 8 ; All Rights Reserved 9 ; 10 ; This file is part of FreeDOS. 11 ; 12 ; FreeDOS is free software; you can redistribute it and/or 13 ; modify it under the terms of the GNU General Public License 14 ; as published by the Free Software Foundation; either version 15 ; 2, or (at your option) any later version. 16 ; 17 ; DOS-C is distributed in the hope that it will be useful, but 18 ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 ; the GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public 23 ; License along with DOS-C; see the file COPYING. If not, 24 ; write to the Free Software Foundation, Inc., 25 ; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 26 ; 27 28 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 29 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 30 31 %macro INTR 1 32 33 push bp ; Standard C entry 34 mov bp,sp 35 push si 36 push di 37 %ifdef WATCOM 38 push bx 39 push cx 40 push dx 41 push es 42 %endif 43 push ds 44 pushf 45 46 arg nr, {rp,%1} 47 mov ax, [.nr] ; interrupt number 48 mov [cs:%%intr_1-1], al 49 jmp short %%intr_2 ; flush the instruction cache 50 %%intr_2: 51 %if %1 == 4 52 lds bx, [.rp] ; regpack structure FAR 53 %else 54 mov bx, [.rp] ; regpack structure 55 %endif 56 mov cx, [bx+4] 57 mov dx, [bx+6] 58 mov si, [bx+8] 59 mov di, [bx+10] 60 mov bp, [bx+12] 61 push word [bx+14] ; ds 62 mov es, [bx+16] 63 mov ah, byte [bx+22] ; flags 64 sahf 65 mov ax, [bx] 66 mov bx, [bx+2] 67 pop ds 68 int 0 69 %%intr_1: 70 71 pushf 72 push ds 73 push bx 74 mov bx, sp 75 %if %1 == 4 76 %ifdef WATCOM 77 lds bx, [ss:bx+(14+8)+4] ; FAR address of REGPACK, pascal convention 78 %else 79 lds bx, [ss:bx+14+.rp-bp] ; FAR address of REGPACK, SP=BX + skip saved registers (14) + 80 %endif 81 %else 82 mov ds, [ss:bx+8] 83 %ifdef WATCOM 84 mov bx, [ss:bx+26] ; NEAR address of REGPACK, pascal convention 85 %else 86 mov bx, [ss:bx+14+.rp-bp] ; NEAR address of REGPACK 87 %endif 88 %endif 89 mov [bx], ax 90 pop word [bx+2] ; bx 91 mov [bx+4], cx 92 mov [bx+6], dx 93 mov [bx+8], si 94 mov [bx+10], di 95 mov [bx+12], bp 96 pop word [bx+14] ; ds 97 mov [bx+16], es 98 pop word [bx+22] ; flags 99 100 ; restore all registers to values from INTR entry 101 popf 102 pop ds 103 %ifdef WATCOM 104 pop es 105 pop dx 106 pop cx 107 pop bx 108 %endif 109 pop di 110 pop si 111 pop bp 112 %endmacro 113 === Switch to base=002270h -> "HMA_TEXT" 114 segment HMA_TEXT 115 116 ; 117 ; void ASMPASCAL call_intr(WORD nr, struct REGPACK FAR *rp) 118 ; 119 global CALL_INTR 120 CALL_INTR: 121 INTR 4 ; rp is far, DWORD argument 32 <1> 0 0000087C 55 push bp 0 0000087D 89E5 mov bp,sp 0 0000087F 56 push si 0 00000880 57 push di 37 <1> %ifdef WATCOM 38 <1> push bx 39 <1> push cx 40 <1> push dx 41 <1> push es 42 <1> %endif 0 00000881 1E push ds 0 00000882 9C pushf 45 <1> 46 <1> arg nr, {rp,%1} 229 <2> %assign .argloc 4 230 <2> %rep %0 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 238 <2> %endrep 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 0 00000883 8B4604 mov ax, [.nr] 0 00000886 2EA2[3300] mov [cs:%%intr_1-1], al 0 0000088A EB00 jmp short %%intr_2 50 <1> %%intr_2: 51 <1> %if %1 == 4 0 0000088C C55E06 lds bx, [.rp] 53 <1> %else 54 <1> mov bx, [.rp] 55 <1> %endif 0 0000088F 8B4F04 mov cx, [bx+4] 0 00000892 8B5706 mov dx, [bx+6] 0 00000895 8B7708 mov si, [bx+8] 0 00000898 8B7F0A mov di, [bx+10] 0 0000089B 8B6F0C mov bp, [bx+12] 0 0000089E FF770E push word [bx+14] 0 000008A1 8E4710 mov es, [bx+16] 0 000008A4 8A6716 mov ah, byte [bx+22] 0 000008A7 9E sahf 0 000008A8 8B07 mov ax, [bx] 0 000008AA 8B5F02 mov bx, [bx+2] 0 000008AD 1F pop ds 0 000008AE CD00 int 0 69 <1> %%intr_1: 70 <1> 0 000008B0 9C pushf 0 000008B1 1E push ds 0 000008B2 53 push bx 0 000008B3 89E3 mov bx, sp 75 <1> %if %1 == 4 76 <1> %ifdef WATCOM 77 <1> lds bx, [ss:bx+(14+8)+4] 78 <1> %else 0 000008B5 36C55F14 lds bx, [ss:bx+14+.rp-bp] 80 <1> %endif 81 <1> %else 82 <1> mov ds, [ss:bx+8] 83 <1> %ifdef WATCOM 84 <1> mov bx, [ss:bx+26] 85 <1> %else 86 <1> mov bx, [ss:bx+14+.rp-bp] 87 <1> %endif 88 <1> %endif 0 000008B9 8907 mov [bx], ax 0 000008BB 8F4702 pop word [bx+2] 0 000008BE 894F04 mov [bx+4], cx 0 000008C1 895706 mov [bx+6], dx 0 000008C4 897708 mov [bx+8], si 0 000008C7 897F0A mov [bx+10], di 0 000008CA 896F0C mov [bx+12], bp 0 000008CD 8F470E pop word [bx+14] 0 000008D0 8C4710 mov [bx+16], es 0 000008D3 8F4716 pop word [bx+22] 99 <1> 100 <1> 0 000008D6 9D popf 0 000008D7 1F pop ds 103 <1> %ifdef WATCOM 104 <1> pop es 105 <1> pop dx 106 <1> pop cx 107 <1> pop bx 108 <1> %endif 0 000008D8 5F pop di 0 000008D9 5E pop si 0 000008DA 5D pop bp 0 000008DB C20600 ret 6 123 124 ;; COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp) 125 global RES_DOSEXEC 126 RES_DOSEXEC: 0 000008DE 07 pop es ; ret address 128 popargs ax,bx,dx ; mode, exec block, filename 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000008DF 58 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000008E0 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000008E1 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 000008E2 06 push es ; ret address 0 000008E3 B44B mov ah, 4bh 0 000008E5 1E push ds 0 000008E6 07 pop es ; es = ds 0 000008E7 CD21 int 21h 0 000008E9 7202 jc short no_exec_error 0 000008EB 31C0 xor ax, ax 136 no_exec_error: 0 000008ED C3 ret 138 139 ;; UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count); 140 global RES_READ 141 RES_READ: 0 000008EE 58 pop ax ; ret address 143 popargs bx,dx,cx ; fd, buf, count 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000008EF 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000008F0 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000008F1 59 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 000008F2 50 push ax ; ret address 0 000008F3 B43F mov ah, 3fh 0 000008F5 CD21 int 21h 0 000008F7 7303 jnc no_read_error 0 000008F9 B8FFFF mov ax, -1 149 no_read_error: 0 000008FC C3 ret 151 === Switch to base=00E150h -> "INIT_TEXT" 152 segment INIT_TEXT 153 ; 154 ; void init_call_intr(nr, rp) 155 ; REG int nr 156 ; REG struct REGPACK *rp 157 ; 158 global INIT_CALL_INTR 159 INIT_CALL_INTR: 160 INTR 2 ; rp is near, WORD argument 32 <1> 0 000001D3 55 push bp 0 000001D4 89E5 mov bp,sp 0 000001D6 56 push si 0 000001D7 57 push di 37 <1> %ifdef WATCOM 38 <1> push bx 39 <1> push cx 40 <1> push dx 41 <1> push es 42 <1> %endif 0 000001D8 1E push ds 0 000001D9 9C pushf 45 <1> 46 <1> arg nr, {rp,%1} 229 <2> %assign .argloc 4 230 <2> %rep %0 231 <2> %ifdef PASCAL 232 <2> %rotate -1 233 <2> %endif 234 <2> definearg %1 235 <2> %ifdef STDCALL 236 <2> %rotate 1 237 <2> %endif 238 <2> %endrep 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 231 <3> %ifdef PASCAL 232 <3> %rotate -1 233 <3> %endif 234 <3> definearg %1 224 <4> %xdefine .%1 bp+.argloc 225 <4> %assign .argloc .argloc+%2 235 <3> %ifdef STDCALL 236 <3> %rotate 1 237 <3> %endif 0 000001DA 8B4604 mov ax, [.nr] 0 000001DD 2EA2[3300] mov [cs:%%intr_1-1], al 0 000001E1 EB00 jmp short %%intr_2 50 <1> %%intr_2: 51 <1> %if %1 == 4 52 <1> lds bx, [.rp] 53 <1> %else 0 000001E3 8B5E06 mov bx, [.rp] 55 <1> %endif 0 000001E6 8B4F04 mov cx, [bx+4] 0 000001E9 8B5706 mov dx, [bx+6] 0 000001EC 8B7708 mov si, [bx+8] 0 000001EF 8B7F0A mov di, [bx+10] 0 000001F2 8B6F0C mov bp, [bx+12] 0 000001F5 FF770E push word [bx+14] 0 000001F8 8E4710 mov es, [bx+16] 0 000001FB 8A6716 mov ah, byte [bx+22] 0 000001FE 9E sahf 0 000001FF 8B07 mov ax, [bx] 0 00000201 8B5F02 mov bx, [bx+2] 0 00000204 1F pop ds 0 00000205 CD00 int 0 69 <1> %%intr_1: 70 <1> 0 00000207 9C pushf 0 00000208 1E push ds 0 00000209 53 push bx 0 0000020A 89E3 mov bx, sp 75 <1> %if %1 == 4 76 <1> %ifdef WATCOM 77 <1> lds bx, [ss:bx+(14+8)+4] 78 <1> %else 79 <1> lds bx, [ss:bx+14+.rp-bp] 80 <1> %endif 81 <1> %else 0 0000020C 368E5F08 mov ds, [ss:bx+8] 83 <1> %ifdef WATCOM 84 <1> mov bx, [ss:bx+26] 85 <1> %else 0 00000210 368B5F14 mov bx, [ss:bx+14+.rp-bp] 87 <1> %endif 88 <1> %endif 0 00000214 8907 mov [bx], ax 0 00000216 8F4702 pop word [bx+2] 0 00000219 894F04 mov [bx+4], cx 0 0000021C 895706 mov [bx+6], dx 0 0000021F 897708 mov [bx+8], si 0 00000222 897F0A mov [bx+10], di 0 00000225 896F0C mov [bx+12], bp 0 00000228 8F470E pop word [bx+14] 0 0000022B 8C4710 mov [bx+16], es 0 0000022E 8F4716 pop word [bx+22] 99 <1> 100 <1> 0 00000231 9D popf 0 00000232 1F pop ds 103 <1> %ifdef WATCOM 104 <1> pop es 105 <1> pop dx 106 <1> pop cx 107 <1> pop bx 108 <1> %endif 0 00000233 5F pop di 0 00000234 5E pop si 0 00000235 5D pop bp 0 00000236 C20400 ret 4 162 163 ; 164 ; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX) 165 ; 166 ; this calls HIMEM.SYS 167 ; 168 global INIT_CALL_XMSCALL 169 INIT_CALL_XMSCALL: 0 00000239 5B pop bx ; ret address 171 popargs {es,cx},ax,dx 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000023A 59 pop %1 243 <4> %rotate -1 0 0000023B 07 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000023C 58 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000023D 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 172 0 0000023E 0E push cs ; ret address 0 0000023F 53 push bx 0 00000240 06 push es ; driver address ("jmp es:cx") 0 00000241 51 push cx 0 00000242 CB retf 178 179 ; void FAR *DetectXMSDriver(VOID) 180 global DETECTXMSDRIVER 181 DETECTXMSDRIVER: 0 00000243 B80043 mov ax, 4300h 0 00000246 CD2F int 2fh ; XMS installation check 184 0 00000248 3C80 cmp al, 80h 0 0000024A 7405 je detected 0 0000024C 31C0 xor ax, ax 0 0000024E 31D2 xor dx, dx 0 00000250 C3 ret 190 191 detected: 0 00000251 06 push es 0 00000252 53 push bx 0 00000253 B81043 mov ax, 4310h ; XMS get driver address 0 00000256 CD2F int 2fh 196 0 00000258 89D8 mov ax, bx 0 0000025A 8CC2 mov dx, es 0 0000025C 5B pop bx 0 0000025D 07 pop es 0 0000025E C3 ret 202 203 global KEYCHECK 204 KEYCHECK: 0 0000025F B401 mov ah, 1 0 00000261 CD16 int 16h 0 00000263 C3 ret 208 209 ;; int open(const char *pathname, int flags); 210 global INIT_DOSOPEN 211 INIT_DOSOPEN: 212 ;; init calling DOS through ints: 0 00000264 5B pop bx ; ret address 214 popargs dx,ax ; pathname, flags 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000265 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000266 58 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 00000267 53 push bx ; ret address 0 00000268 B43D mov ah, 3dh 217 ;; AX will have the file handle 218 219 common_int21: 0 0000026A CD21 int 21h 0 0000026C 7303 jnc common_no_error 0 0000026E B8FFFF mov ax, -1 223 common_no_error: 0 00000271 C3 ret 225 226 ;; int close(int fd); 227 global CLOSE 228 CLOSE: 0 00000272 58 pop ax ; ret address 0 00000273 5B pop bx ; fd 0 00000274 50 push ax ; ret address 0 00000275 B43E mov ah, 3eh 0 00000277 EBF1 jmp short common_int21 234 235 ;; UCOUNT read(int fd, void *buf, UCOUNT count); 236 global READ 237 READ: 0 00000279 58 pop ax ; ret address 239 popargs bx,dx,cx ; fd,buf,count 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000027A 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000027B 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000027C 59 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 0000027D 50 push ax ; ret address 0 0000027E B43F mov ah, 3fh 0 00000280 EBE8 jmp short common_int21 243 244 ;; int dup2(int oldfd, int newfd); 245 global DUP2 246 DUP2: 0 00000282 58 pop ax ; ret address 248 popargs bx,cx ; oldfd,newfd 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000283 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 00000284 59 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 00000285 50 push ax ; ret address 0 00000286 B446 mov ah, 46h 0 00000288 EBE0 jmp short common_int21 252 253 ; 254 ; ULONG ASMPASCAL lseek(int fd, long position); 255 ; 256 global LSEEK 257 LSEEK: 0 0000028A 58 pop ax ; ret address 259 popargs bx,{cx,dx} ; fd, position high:low 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000028B 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 0000028C 5A pop %1 243 <4> %rotate -1 0 0000028D 59 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 0000028E 50 push ax ; ret address 0 0000028F B80042 mov ax,4200h ; origin: start of file 0 00000292 CD21 int 21h 0 00000294 7304 jnc seek_ret ; CF=1? 0 00000296 19C0 sbb ax,ax ; then dx:ax = -1, else unchanged 0 00000298 19D2 sbb dx,dx 266 seek_ret: 0 0000029A C3 ret 268 269 ;; VOID init_PSPSet(seg psp_seg) 270 global INIT_PSPSET 271 INIT_PSPSET: 0 0000029B 58 pop ax ; ret address 0 0000029C 5B pop bx ; psp_seg 0 0000029D 50 push ax ; ret_address 0 0000029E B450 mov ah, 50h 0 000002A0 CD21 int 21h 0 000002A2 C3 ret 278 279 ;; COUNT init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp) 280 global INIT_DOSEXEC 281 INIT_DOSEXEC: 0 000002A3 07 pop es ; ret address 283 popargs ax,bx,dx ; mode, exec block, filename 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000002A4 58 pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000002A5 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000002A6 5A pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 000002A7 06 push es ; ret address 0 000002A8 B44B mov ah, 4bh 0 000002AA 1E push ds 0 000002AB 07 pop es ; es = ds 0 000002AC CD21 int 21h 0 000002AE 7202 jc short exec_no_error 0 000002B0 31C0 xor ax, ax 291 exec_no_error: 0 000002B2 C3 ret 293 294 ;; int init_setdrive(int drive) 295 global INIT_SETDRIVE 296 INIT_SETDRIVE: 0 000002B3 B40E mov ah, 0x0e 298 common_dl_int21: 0 000002B5 5B pop bx ; ret address 0 000002B6 5A pop dx ; drive/char 0 000002B7 53 push bx 0 000002B8 CD21 int 21h 0 000002BA C3 ret 304 305 ;; int init_switchar(int char) 306 global INIT_SWITCHAR 307 INIT_SWITCHAR: 0 000002BB B80137 mov ax, 0x3701 0 000002BE EBF5 jmp short common_dl_int21 310 311 ; 312 ; seg ASMPASCAL allocmem(UWORD size); 313 ; 314 global ALLOCMEM 315 ALLOCMEM: 0 000002C0 58 pop ax ; ret address 0 000002C1 5B pop bx ; size 0 000002C2 50 push ax ; ret address 0 000002C3 B448 mov ah, 48h 0 000002C5 CD21 int 21h 0 000002C7 19DB sbb bx, bx ; carry=1 -> ax=-1 0 000002C9 09D8 or ax, bx ; segment 0 000002CB C3 ret 324 325 ;; void set_DTA(void far *dta) 326 global SET_DTA 327 SET_DTA: 0 000002CC 58 pop ax ; ret address 329 popargs {bx,dx} ; seg:off(dta) 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 250 <2> %ifdef PASCAL 251 <2> %rotate -1 252 <2> %endif 253 <2> multipop %1 242 <3> %rep %0 243 <3> %rotate -1 244 <3> pop %1 245 <3> %endrep 243 <4> %rotate -1 0 000002CD 5A pop %1 243 <4> %rotate -1 0 000002CE 5B pop %1 254 <2> %ifdef STDCALL 255 <2> %rotate 1 256 <2> %endif 0 000002CF 50 push ax ; ret address 0 000002D0 B41A mov ah, 1ah 0 000002D2 1E push ds 0 000002D3 8EDB mov ds, bx 0 000002D5 CD21 int 21h 0 000002D7 1F pop ds 0 000002D8 C3 ret === Trace listing source: ioctl.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=ioctl.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccmT2iKt.s output file : ioctl.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:54.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _DosDevIOctl 8 .type _DosDevIOctl, @function 9 _DosDevIOctl: 10 _.LFB4: 11 .file 1 "ioctl.c" 1:ioctl.c **** /****************************************************************/ 2:ioctl.c **** /* */ 3:ioctl.c **** /* ioctl.c */ 4:ioctl.c **** /* */ 5:ioctl.c **** /* DOS-C ioctl system call */ 6:ioctl.c **** /* */ 7:ioctl.c **** /* Copyright (c) 1995,1998 */ 8:ioctl.c **** /* Pasquale J. Villani */ 9:ioctl.c **** /* All Rights Reserved */ 10:ioctl.c **** /* */ 11:ioctl.c **** /* This file is part of DOS-C. */ 12:ioctl.c **** /* */ 13:ioctl.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:ioctl.c **** /* modify it under the terms of the GNU General Public License */ 15:ioctl.c **** /* as published by the Free Software Foundation; either version */ 16:ioctl.c **** /* 2, or (at your option) any later version. */ 17:ioctl.c **** /* */ 18:ioctl.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:ioctl.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:ioctl.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:ioctl.c **** /* the GNU General Public License for more details. */ 22:ioctl.c **** /* */ 23:ioctl.c **** /* You should have received a copy of the GNU General Public */ 24:ioctl.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:ioctl.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:ioctl.c **** /* Cambridge, MA 02139, USA. */ 27:ioctl.c **** /****************************************************************/ 28:ioctl.c **** 29:ioctl.c **** #include "portab.h" 30:ioctl.c **** #include "globals.h" 31:ioctl.c **** 32:ioctl.c **** #ifdef VERSION_STRINGS 33:ioctl.c **** static BYTE *RcsId = 34:ioctl.c **** "$Id: ioctl.c 1427 2009-06-09 12:23:14Z bartoldeman $"; 35:ioctl.c **** #endif 36:ioctl.c **** 37:ioctl.c **** /* 38:ioctl.c **** * WARNING: this code is non-portable (8086 specific). 39:ioctl.c **** */ 40:ioctl.c **** 41:ioctl.c **** /* TE 10/29/01 42:ioctl.c **** 43:ioctl.c **** although device drivers have only 20 pushes available for them, 44:ioctl.c **** MS NET plays by its own rules 45:ioctl.c **** 46:ioctl.c **** at least TE's network card driver DM9PCI (some 10$ NE2000 clone) does: 47:ioctl.c **** with SP=8DC before calling down to execrh, and SP=8CC when 48:ioctl.c **** callf [interrupt], DM9PCI touches DOSDS:792, 49:ioctl.c **** 14 bytes into error stack :-((( 50:ioctl.c **** 51:ioctl.c **** so some optimizations were made. 52:ioctl.c **** this uses the fact, that only CharReq device buffer is ever used. 53:ioctl.c **** fortunately, this saves some code as well :-) 54:ioctl.c **** 55:ioctl.c **** */ 56:ioctl.c **** 57:ioctl.c **** /* this is a file scope static because with Turbo C 2.01 "static const" does 58:ioctl.c **** * not work correctly inside the function */ 59:ioctl.c **** STATIC const UBYTE cmd [] = { 60:ioctl.c **** 0, 0, 61:ioctl.c **** /* 0x02 */ C_IOCTLIN, 62:ioctl.c **** /* 0x03 */ C_IOCTLOUT, 63:ioctl.c **** /* 0x04 */ C_IOCTLIN, 64:ioctl.c **** /* 0x05 */ C_IOCTLOUT, 65:ioctl.c **** /* 0x06 */ C_ISTAT, 66:ioctl.c **** /* 0x07 */ C_OSTAT, 67:ioctl.c **** /* 0x08 */ C_REMMEDIA, 68:ioctl.c **** 0, 0, 0, 69:ioctl.c **** /* 0x0c */ C_GENIOCTL, 70:ioctl.c **** /* 0x0d */ C_GENIOCTL, 71:ioctl.c **** /* 0x0e */ C_GETLDEV, 72:ioctl.c **** /* 0x0f */ C_SETLDEV, 73:ioctl.c **** /* 0x10 */ C_IOCTLQRY, 74:ioctl.c **** /* 0x11 */ C_IOCTLQRY, 75:ioctl.c **** }; 76:ioctl.c **** 77:ioctl.c **** int DosDevIOctl(lregs * r) 78:ioctl.c **** { 12 .loc 1 78 0 13 _.LVL0: 0 00009723 56 push si 0 00009724 57 push di 0 00009725 55 push bp 17 _.LCFI0: 0 00009726 89E5 mov bp, sp 19 _.LCFI1: 0 00009728 1E push ds 0 00009729 8B7608 mov si, word ptr [bp+8] 79:ioctl.c **** struct dhdr FAR *dev; 80:ioctl.c **** 81:ioctl.c **** if (r->AL > 0x11) 22 .loc 1 81 0 0 0000972C 8A04 mov al, byte ptr [si] 0 0000972E 3C11 cmp al, 17 0 00009730 760D jbe _.L2 26 _.L14: 82:ioctl.c **** return DE_INVLDFUNC; 27 .loc 1 82 0 0 00009732 B8FFFF mov ax, -1 29 _.LVL1: 30 _.L1: 83:ioctl.c **** 84:ioctl.c **** switch (r->AL) 85:ioctl.c **** { 86:ioctl.c **** case 0x0b: 87:ioctl.c **** /* skip, it's a special case. */ 88:ioctl.c **** NetDelay = r->CX; 89:ioctl.c **** if (r->DX) 90:ioctl.c **** NetRetry = r->DX; 91:ioctl.c **** return SUCCESS; 92:ioctl.c **** 93:ioctl.c **** case 0x00: 94:ioctl.c **** case 0x01: 95:ioctl.c **** case 0x02: 96:ioctl.c **** case 0x03: 97:ioctl.c **** case 0x06: 98:ioctl.c **** case 0x07: 99:ioctl.c **** case 0x0a: 100:ioctl.c **** case 0x0c: 101:ioctl.c **** case 0x10: 102:ioctl.c **** { 103:ioctl.c **** sft FAR *s; 104:ioctl.c **** unsigned flags; 105:ioctl.c **** 106:ioctl.c **** /* Test that the handle is valid and */ 107:ioctl.c **** /* get the SFT block that contains the SFT */ 108:ioctl.c **** if ((s = get_sft(r->BX)) == (sft FAR *) - 1) 109:ioctl.c **** return DE_INVLDHNDL; 110:ioctl.c **** 111:ioctl.c **** flags = s->sft_flags; 112:ioctl.c **** 113:ioctl.c **** switch (r->AL) 114:ioctl.c **** { 115:ioctl.c **** case 0x00: 116:ioctl.c **** /* Get the flags from the SFT */ 117:ioctl.c **** r->AX = flags & 0xff; 118:ioctl.c **** if (flags & SFT_FDEVICE) 119:ioctl.c **** r->AX |= (s->sft_dev->dh_attr & 0xff00); 120:ioctl.c **** /* else: files/networks return 0 in AH/DH */ 121:ioctl.c **** /* Undocumented result, Ax = Dx seen using Pcwatch */ 122:ioctl.c **** r->DX = r->AX; 123:ioctl.c **** return SUCCESS; 124:ioctl.c **** 125:ioctl.c **** case 0x01: 126:ioctl.c **** /* sft_flags is a file, return an error because you */ 127:ioctl.c **** /* can't set the status of a file. */ 128:ioctl.c **** if (!(flags & SFT_FDEVICE)) 129:ioctl.c **** return DE_INVLDFUNC; 130:ioctl.c **** /* RBIL says this is only for DOS < 6, but MSDOS 7.10 */ 131:ioctl.c **** /* returns this as well... and some buggy program relies*/ 132:ioctl.c **** /* on it :( */ 133:ioctl.c **** if (r->DH != 0) 134:ioctl.c **** return DE_INVLDDATA; 135:ioctl.c **** 136:ioctl.c **** /* Undocumented: AL should get the old value */ 137:ioctl.c **** r->AL = s->sft_flags_lo; 138:ioctl.c **** /* Set it to what we got in the DL register from the */ 139:ioctl.c **** /* user. */ 140:ioctl.c **** s->sft_flags_lo = SFT_FDEVICE | r->DL; 141:ioctl.c **** return SUCCESS; 142:ioctl.c **** 143:ioctl.c **** case 0x0a: 144:ioctl.c **** r->DX = flags; 145:ioctl.c **** r->AX = 0; 146:ioctl.c **** return SUCCESS; 147:ioctl.c **** } 148:ioctl.c **** if (!(flags & SFT_FDEVICE)) 149:ioctl.c **** { 150:ioctl.c **** if (r->AL == 0x06) 151:ioctl.c **** r->AL = s->sft_posit >= s->sft_size ? 0 : 0xFF; 152:ioctl.c **** else if (r->AL == 0x07) 153:ioctl.c **** r->AL = 0; 154:ioctl.c **** else 155:ioctl.c **** return DE_INVLDFUNC; 156:ioctl.c **** return SUCCESS; 157:ioctl.c **** } 158:ioctl.c **** dev = s->sft_dev; 159:ioctl.c **** CharReqHdr.r_unit = 0; 160:ioctl.c **** break; 161:ioctl.c **** } 162:ioctl.c **** 163:ioctl.c **** default: /* block IOCTL: 4, 5, 8, 9, d, e, f, 11 */ 164:ioctl.c **** { 165:ioctl.c **** struct dpb FAR *dpbp; 166:ioctl.c **** unsigned attr; 167:ioctl.c **** /* 168:ioctl.c **** This line previously returned the deviceheader at r->bl. But, 169:ioctl.c **** DOS numbers its drives starting at 1, not 0. A=1, B=2, and so 170:ioctl.c **** on. Changed this line so it is now zero-based. 171:ioctl.c **** 172:ioctl.c **** -SRM 173:ioctl.c **** */ 174:ioctl.c **** /* JPP - changed to use default drive if drive=0 */ 175:ioctl.c **** /* JT Fixed it */ 176:ioctl.c **** 177:ioctl.c **** /* NDN feeds the actual ASCII drive letter to this function */ 178:ioctl.c **** dpbp = get_dpb((r->BL & 0x1f) == 0 ? default_drive : (r->BL & 0x1f) - 1); 179:ioctl.c **** if (dpbp) 180:ioctl.c **** { 181:ioctl.c **** CharReqHdr.r_unit = dpbp->dpb_subunit; 182:ioctl.c **** dev = dpbp->dpb_device; 183:ioctl.c **** attr = dev->dh_attr; 184:ioctl.c **** } 185:ioctl.c **** else 186:ioctl.c **** { 187:ioctl.c **** if (r->AL != 8 && r->AL != 9) 188:ioctl.c **** return DE_INVLDDRV; 189:ioctl.c **** dev = NULL; 190:ioctl.c **** attr = ATTR_REMOTE; 191:ioctl.c **** } 192:ioctl.c **** 193:ioctl.c **** switch (r->AL) 194:ioctl.c **** { 195:ioctl.c **** case 0x08: 196:ioctl.c **** { 197:ioctl.c **** struct cds FAR *cdsp = get_cds1(r->BL & 0x1f); 198:ioctl.c **** if (cdsp == NULL) 199:ioctl.c **** return DE_INVLDDRV; 200:ioctl.c **** if (cdsp->cdsFlags & CDSNETWDRV) 201:ioctl.c **** return DE_INVLDFUNC; 202:ioctl.c **** r->AX = (dpbp->dpb_flags == M_DONT_KNOW); 203:ioctl.c **** return SUCCESS; 204:ioctl.c **** } 205:ioctl.c **** case 0x09: 206:ioctl.c **** { 207:ioctl.c **** /* note from get_dpb() */ 208:ioctl.c **** /* that if cdsp == NULL then dev must be NULL too */ 209:ioctl.c **** struct cds FAR *cdsp = get_cds1(r->BL & 0x1f); 210:ioctl.c **** if (cdsp == NULL) 211:ioctl.c **** return DE_INVLDDRV; 212:ioctl.c **** if (cdsp->cdsFlags & CDSSUBST) 213:ioctl.c **** attr |= ATTR_SUBST; 214:ioctl.c **** r->AX = S_DONE | S_BUSY; 215:ioctl.c **** r->DX = attr; 216:ioctl.c **** return SUCCESS; 217:ioctl.c **** } 218:ioctl.c **** case 0x0d: 219:ioctl.c **** if ((r->CX & ~(0x486B-0x084A)) == 0x084A) 220:ioctl.c **** { /* 084A/484A, 084B/484B, 086A/486A, 086B/486B */ 221:ioctl.c **** r->AX = 0; /* (lock/unlock logical/physical volume) */ 222:ioctl.c **** /* simulate success for MS-DOS 7+ SCANDISK etc. --LG */ 223:ioctl.c **** return SUCCESS; 224:ioctl.c **** } 225:ioctl.c **** /* fall through */ 226:ioctl.c **** default: /* 0x04, 0x05, 0x0e, 0x0f, 0x11 */ 227:ioctl.c **** break; 228:ioctl.c **** } 229:ioctl.c **** break; 230:ioctl.c **** } 231:ioctl.c **** } 232:ioctl.c **** 233:ioctl.c **** { 234:ioctl.c **** unsigned testattr = ATTR_QRYIOCTL; 235:ioctl.c **** if (r->AL<=0x0f) 236:ioctl.c **** testattr = ATTR_GENIOCTL; 237:ioctl.c **** if (r->AL<=0x08) 238:ioctl.c **** testattr = ATTR_EXCALLS; 239:ioctl.c **** if (r->AL<=0x07) 240:ioctl.c **** testattr = 0xffff; 241:ioctl.c **** if (r->AL<=0x05) 242:ioctl.c **** testattr = ATTR_IOCTL; 243:ioctl.c **** 244:ioctl.c **** if (!(dev->dh_attr & testattr)) 245:ioctl.c **** return DE_INVLDFUNC; 246:ioctl.c **** } 247:ioctl.c **** 248:ioctl.c **** CharReqHdr.r_command = cmd[r->AL]; 249:ioctl.c **** if (r->AL == 0x0C || r->AL == 0x0D || r->AL >= 0x10) /* generic or query */ 250:ioctl.c **** { 251:ioctl.c **** CharReqHdr.r_cat = r->CH; /* category (major) code */ 252:ioctl.c **** CharReqHdr.r_fun = r->CL; /* function (minor) code */ 253:ioctl.c **** CharReqHdr.r_si = r->SI; /* contents of SI and DI */ 254:ioctl.c **** CharReqHdr.r_di = r->DI; 255:ioctl.c **** CharReqHdr.r_io = MK_FP(r->DS, r->DX); /* parameter block */ 256:ioctl.c **** } 257:ioctl.c **** else 258:ioctl.c **** { 259:ioctl.c **** CharReqHdr.r_count = r->CX; 260:ioctl.c **** CharReqHdr.r_trans = MK_FP(r->DS, r->DX); 261:ioctl.c **** } 262:ioctl.c **** CharReqHdr.r_length = sizeof(request); 263:ioctl.c **** CharReqHdr.r_status = 0; 264:ioctl.c **** 265:ioctl.c **** execrh(&CharReqHdr, dev); 266:ioctl.c **** 267:ioctl.c **** if (CharReqHdr.r_status & S_ERROR) 268:ioctl.c **** { 269:ioctl.c **** CritErrCode = (CharReqHdr.r_status & S_MASK) + 0x13; 270:ioctl.c **** return DE_ACCESS; 271:ioctl.c **** } 272:ioctl.c **** 273:ioctl.c **** if (r->AL <= 0x05) /* 0x02, 0x03, 0x04, 0x05 */ 274:ioctl.c **** r->AX = CharReqHdr.r_count; 275:ioctl.c **** else if (r->AL <= 0x07) /* 0x06, 0x07 */ 276:ioctl.c **** r->AX = (CharReqHdr.r_status & S_BUSY) ? 0000 : 0x00ff; 277:ioctl.c **** else if (r->AL == 0x08) /* 0x08 */ 278:ioctl.c **** r->AX = (CharReqHdr.r_status & S_BUSY) ? 1 : 0; 279:ioctl.c **** else if (r->AL == 0x0e || r->AL == 0x0f) /* 0x0e, 0x0f */ 280:ioctl.c **** r->AL = CharReqHdr.r_unit; 281:ioctl.c **** else /* 0x0c, 0x0d, 0x10, 0x11 */ 282:ioctl.c **** r->AX = CharReqHdr.r_status; 283:ioctl.c **** return SUCCESS; 284:ioctl.c **** } 31 .loc 1 284 0 0 00009735 89EC mov sp, bp 0 00009737 5D pop bp 0 00009738 5F pop di 0 00009739 5E pop si 0 0000973A 16 push ss 0 0000973B 1F pop ds 0 0000973C C20200 ret 2 39 _.LVL2: 40 _.L2: 84:ioctl.c **** { 41 .loc 1 84 0 0 0000973F 3C10 cmp al, 16 0 00009741 7603E98E01 ja _.L4 0 00009746 30E4 xor ah, ah 0 00009748 D1E0 shl ax, 1 0 0000974A 89C3 mov bx, ax 0 0000974C 36FFA7[0000] jmp word ptr ss:[bx+_.L6] === Switch to base=012BB0h -> ".RODATA" 48 .section .rodata 49 .p2align 1 50 .p2align 2 51 _.L6: 0 00001844 [4500] .hword _.L5 0 00001846 [4500] .hword _.L5 0 00001848 [4500] .hword _.L5 0 0000184A [4500] .hword _.L5 0 0000184C [B101] .hword _.L4 0 0000184E [B101] .hword _.L4 0 00001850 [4500] .hword _.L5 0 00001852 [4500] .hword _.L5 0 00001854 [B101] .hword _.L4 0 00001856 [B101] .hword _.L4 0 00001858 [4500] .hword _.L5 0 0000185A [2E00] .hword _.L7 0 0000185C [4500] .hword _.L5 0 0000185E [B101] .hword _.L4 0 00001860 [B101] .hword _.L4 0 00001862 [B101] .hword _.L4 0 00001864 [4500] .hword _.L5 === Switch to base=002270h -> ".TEXT" 69 .text 70 _.L7: 88:ioctl.c **** if (r->DX) 71 .loc 1 88 0 0 00009751 8B4404 mov ax, word ptr [si+4] 0 00009754 A2[0000] mov byte ptr [_NetDelay], al 89:ioctl.c **** NetRetry = r->DX; 74 .loc 1 89 0 0 00009757 8B5406 mov dx, word ptr [si+6] 91:ioctl.c **** 76 .loc 1 91 0 0 0000975A 89D0 mov ax, dx 89:ioctl.c **** NetRetry = r->DX; 78 .loc 1 89 0 0 0000975C 85D2 test dx, dx 0 0000975E 74D5 je _.L1 90:ioctl.c **** return SUCCESS; 81 .loc 1 90 0 0 00009760 8816[0000] mov byte ptr [_NetRetry], dl 83 _.LVL3: 84 _.L74: 283:ioctl.c **** } 85 .loc 1 283 0 0 00009764 31C0 xor ax, ax 0 00009766 EBCD jmp _.L1 88 _.LVL4: 89 _.L5: 90 _.LBB2: 108:ioctl.c **** return DE_INVLDHNDL; 91 .loc 1 108 0 0 00009768 36FF7402 push word ptr ss:[si+2] 0 0000976C E8[FEFF] call _get_sft 94 _.LVL5: 0 0000976F 89C3 mov bx, ax 96 _.LVL6: 0 00009771 83F8FF cmp ax, -1 0 00009774 7508 jne _.L51 0 00009776 83FAFF cmp dx, -1 0 00009779 7503E99D02 je _.L71 101 _.L51: 111:ioctl.c **** 102 .loc 1 111 0 0 0000977E 8EC2 mov es, dx 0 00009780 268B4705 mov ax, word ptr es:[bx+5] 105 _.LVL7: 113:ioctl.c **** { 106 .loc 1 113 0 0 00009784 8A0C mov cl, byte ptr [si] 0 00009786 80F901 cmp cl, 1 0 00009789 7457 je _.L10 0 0000978B 7234 jc _.L11 0 0000978D 80F90A cmp cl, 10 0 00009790 7475 je _.L12 148:ioctl.c **** { 113 .loc 1 148 0 0 00009792 258000 and ax, 128 115 _.LVL8: 0 00009795 7403E98500 jne _.L15 150:ioctl.c **** r->AL = s->sft_posit >= s->sft_size ? 0 : 0xFF; 117 .loc 1 150 0 0 0000979A 80F906 cmp cl, 6 0 0000979D 7573 jne _.L16 151:ioctl.c **** else if (r->AL == 0x07) 120 .loc 1 151 0 0 0000979F B101 mov cl, 1 0 000097A1 8EC2 mov es, dx 0 000097A3 268B4713 mov ax, word ptr es:[bx+19] 0 000097A7 263B4717 cmp ax, word ptr es:[bx+23] 0 000097AB 770E ja _.L17 0 000097AD 750A jne _.L18 0 000097AF 268B4711 mov ax, word ptr es:[bx+17] 0 000097B3 263B4715 cmp ax, word ptr es:[bx+21] 0 000097B7 7702 ja _.L17 130 _.L18: 0 000097B9 30C9 xor cl, cl 132 _.L17: 0 000097BB F6D9 neg cl 0 000097BD 880C mov byte ptr [si], cl 135 _.LVL9: 0 000097BF EBA3 jmp _.L74 137 _.LVL10: 138 _.L11: 117:ioctl.c **** if (flags & SFT_FDEVICE) 139 .loc 1 117 0 0 000097C1 89C1 mov cx, ax 0 000097C3 30ED xor ch, ch 0 000097C5 890C mov word ptr [si], cx 118:ioctl.c **** r->AX |= (s->sft_dev->dh_attr & 0xff00); 143 .loc 1 118 0 0 000097C7 A880 test al, -128 0 000097C9 7410 je _.L13 119:ioctl.c **** /* else: files/networks return 0 in AH/DH */ 146 .loc 1 119 0 0 000097CB 8EC2 mov es, dx 0 000097CD 26C47F07 les di, dword ptr es:[bx+7] 0 000097D1 268B4504 mov ax, word ptr es:[di+4] 150 _.LVL11: 0 000097D5 30C0 xor al, al 0 000097D7 09C8 or ax, cx 0 000097D9 8904 mov word ptr [si], ax 154 _.L13: 122:ioctl.c **** return SUCCESS; 155 .loc 1 122 0 0 000097DB 8B04 mov ax, word ptr [si] 0 000097DD 894406 mov word ptr [si+6], ax 0 000097E0 EB82 jmp _.L74 159 _.LVL12: 160 _.L10: 128:ioctl.c **** return DE_INVLDFUNC; 161 .loc 1 128 0 0 000097E2 A880 test al, -128 0 000097E4 7503E949FF je _.L14 133:ioctl.c **** return DE_INVLDDATA; 164 .loc 1 133 0 0 000097E9 36807C0700 cmp byte ptr ss:[si+7], 0 0 000097EE 7403E92E02 jne _.L44 137:ioctl.c **** /* Set it to what we got in the DL register from the */ 167 .loc 1 137 0 0 000097F3 8EC2 mov es, dx 0 000097F5 268A4705 mov al, byte ptr es:[bx+5] 170 _.LVL13: 0 000097F9 8804 mov byte ptr [si], al 172 _.LVL14: 140:ioctl.c **** return SUCCESS; 173 .loc 1 140 0 0 000097FB 8A4406 mov al, byte ptr [si+6] 0 000097FE 0C80 or al, -128 0 00009800 26884705 mov byte ptr es:[bx+5], al 177 _.LVL15: 0 00009804 E95DFF jmp _.L74 179 _.LVL16: 180 _.L12: 144:ioctl.c **** r->AX = 0; 181 .loc 1 144 0 0 00009807 894406 mov word ptr [si+6], ax 183 _.LVL17: 184 _.L75: 185 _.LBE2: 186 _.LBB3: 221:ioctl.c **** /* simulate success for MS-DOS 7+ SCANDISK etc. --LG */ 187 .loc 1 221 0 0 0000980A 36C7040000 mov word ptr ss:[si], 0 0 0000980F E952FF jmp _.L74 190 _.LVL18: 191 _.L16: 192 _.LBE3: 193 _.LBB6: 152:ioctl.c **** r->AL = 0; 194 .loc 1 152 0 0 00009812 80F907 cmp cl, 7 0 00009815 7403E918FF jne _.L14 153:ioctl.c **** else 197 .loc 1 153 0 0 0000981A 8804 mov byte ptr [si], al 199 _.LVL19: 0 0000981C E916FF jmp _.L1 201 _.LVL20: 202 _.L15: 158:ioctl.c **** CharReqHdr.r_unit = 0; 203 .loc 1 158 0 0 0000981F 8EC2 mov es, dx 0 00009821 268E5F07 mov ds, word ptr es:[bx+7] 0 00009825 268B5709 mov dx, word ptr es:[bx+9] 207 _.LVL21: 159:ioctl.c **** break; 208 .loc 1 159 0 0 00009829 36C606[0100]00 mov byte ptr ss:[_CharReqHdr+1], 0 210 _.LVL22: 211 _.L19: 212 _.LBE6: 213 _.LBB7: 235:ioctl.c **** testattr = ATTR_GENIOCTL; 214 .loc 1 235 0 0 0000982F 368A04 mov al, byte ptr ss:[si] 0 00009832 3C0F cmp al, 15 0 00009834 7603E97101 ja _.L46 218 _.LVL23: 237:ioctl.c **** testattr = ATTR_EXCALLS; 219 .loc 1 237 0 0 00009839 3C08 cmp al, 8 0 0000983B 7603E97001 ja _.L47 222 _.LVL24: 239:ioctl.c **** testattr = 0xffff; 223 .loc 1 239 0 0 00009840 7503E97101 je _.L48 225 _.LVL25: 242:ioctl.c **** 226 .loc 1 242 0 0 00009845 3C06 cmp al, 5+1 0 00009847 F5 cmc 0 00009848 19C9 sbb cx, cx 0 0000984A 80CD40 or ch, 64 231 _.LVL26: 232 _.L32: 244:ioctl.c **** return DE_INVLDFUNC; 233 .loc 1 244 0 0 0000984D 8EC2 mov es, dx 0 0000984F 8CDB mov bx, ds 0 00009851 26854F04 test cx, word ptr es:[bx+4] 0 00009855 7503E9D8FE je _.L14 238 _.LVL27: 239 _.LBE7: 248:ioctl.c **** if (r->AL == 0x0C || r->AL == 0x0D || r->AL >= 0x10) /* generic or query */ 240 .loc 1 248 0 0 0000985A BF[0000] mov di, offset _CharReqHdr 0 0000985D BB[2200] mov bx, offset _cmd 243 _.LVL28: 0 00009860 36D7 xlat ss:[bx] 0 00009862 36884502 mov byte ptr ss:[di+2], al 249:ioctl.c **** { 246 .loc 1 249 0 0 00009866 368A04 mov al, byte ptr ss:[si] 0 00009869 88C4 mov ah, al 0 0000986B 80C4F4 add ah, -12 0 0000986E 80FC02 cmp ah, 1+1 0 00009871 7207 jc _.L52 0 00009873 3C10 cmp al, 15+1 0 00009875 7303E94201 jc _.L33 254 _.L52: 251:ioctl.c **** CharReqHdr.r_fun = r->CL; /* function (minor) code */ 255 .loc 1 251 0 0 0000987A 368A4405 mov al, byte ptr ss:[si+5] 0 0000987E 3688450D mov byte ptr ss:[di+13], al 252:ioctl.c **** CharReqHdr.r_si = r->SI; /* contents of SI and DI */ 258 .loc 1 252 0 0 00009882 368A4404 mov al, byte ptr ss:[si+4] 0 00009886 3688450E mov byte ptr ss:[di+14], al 254:ioctl.c **** CharReqHdr.r_io = MK_FP(r->DS, r->DX); /* parameter block */ 261 .loc 1 254 0 0 0000988A 36C44408 les ax, dword ptr ss:[si+8] 0 0000988E 3689450F mov word ptr ss:[di+15], ax 0 00009892 368C4511 mov word ptr ss:[di+17], es 255:ioctl.c **** } 265 .loc 1 255 0 0 00009896 368B4C0C mov cx, word ptr ss:[si+12] 267 _.LVL29: 0 0000989A 368B4406 mov ax, word ptr ss:[si+6] 0 0000989E 36894513 mov word ptr ss:[di+19], ax 0 000098A2 36894D15 mov word ptr ss:[di+21], cx 271 _.L35: 262:ioctl.c **** CharReqHdr.r_status = 0; 272 .loc 1 262 0 0 000098A6 36C606[0000]1E mov byte ptr ss:[_CharReqHdr], 30 263:ioctl.c **** 274 .loc 1 263 0 0 000098AC 36C706[0300]0000 mov word ptr ss:[_CharReqHdr+3], 0 265:ioctl.c **** 276 .loc 1 265 0 0 000098B3 52 push dx 0 000098B4 1E push ds 0 000098B5 16 push ss 0 000098B6 57 push di 0 000098B7 16 push ss 0 000098B8 1F pop ds 283 _.LVL30: 0 000098B9 E8[FEFF] call _execrh 285 _.LVL31: 267:ioctl.c **** { 286 .loc 1 267 0 0 000098BC 8B4503 mov ax, word ptr [di+3] 0 000098BF 85C0 test ax, ax 0 000098C1 7C03E91101 jge _.L36 269:ioctl.c **** return DE_ACCESS; 290 .loc 1 269 0 0 000098C6 30E4 xor ah, ah 0 000098C8 83C013 add ax, 19 0 000098CB A3[0000] mov word ptr [_CritErrCode], ax 270:ioctl.c **** } 294 .loc 1 270 0 0 000098CE B8FBFF mov ax, -5 0 000098D1 E961FE jmp _.L1 297 _.L4: 298 _.LBB8: 178:ioctl.c **** if (dpbp) 299 .loc 1 178 0 0 000098D4 8A4402 mov al, byte ptr [si+2] 0 000098D7 241F and al, 31 0 000098D9 7571 jne _.L20 178:ioctl.c **** if (dpbp) 303 .loc 1 178 0 is_stmt 0 discriminator 1 0 000098DB A0[0000] mov al, byte ptr [_default_drive] 0 000098DE 98 cbw 306 _.L21: 178:ioctl.c **** if (dpbp) 307 .loc 1 178 0 discriminator 4 0 000098DF 50 push ax 0 000098E0 E8[FEFF] call _get_dpb 310 _.LVL32: 0 000098E3 89C7 mov di, ax 0 000098E5 8956FE mov word ptr [bp-2], dx 313 _.LVL33: 179:ioctl.c **** { 314 .loc 1 179 0 is_stmt 1 discriminator 4 0 000098E8 09C2 or dx, ax 316 _.LVL34: 0 000098EA 7465 je _.L22 181:ioctl.c **** dev = dpbp->dpb_device; 318 .loc 1 181 0 discriminator 4 0 000098EC 8E46FE mov es, word ptr [bp-2] 0 000098EF 268A4501 mov al, byte ptr es:[di+1] 321 _.LVL35: 0 000098F3 A2[0100] mov byte ptr [_CharReqHdr+1], al 182:ioctl.c **** attr = dev->dh_attr; 323 .loc 1 182 0 discriminator 4 0 000098F6 268E5D13 mov ds, word ptr es:[di+19] 0 000098FA 268B5515 mov dx, word ptr es:[di+21] 326 _.LVL36: 183:ioctl.c **** } 327 .loc 1 183 0 discriminator 4 0 000098FE 8EC2 mov es, dx 0 00009900 8CDB mov bx, ds 0 00009902 268B4F04 mov cx, word ptr es:[bx+4] 331 _.LVL37: 332 _.L24: 193:ioctl.c **** { 333 .loc 1 193 0 0 00009906 368A04 mov al, byte ptr ss:[si] 0 00009909 3C09 cmp al, 9 0 0000990B 745B je _.L25 0 0000990D 3C0D cmp al, 13 0 0000990F 7503E98400 je _.L26 0 00009914 3C08 cmp al, 8 0 00009916 7403E914FF jne _.L19 341 _.LBB4: 197:ioctl.c **** if (cdsp == NULL) 342 .loc 1 197 0 0 0000991B 368A4402 mov al, byte ptr ss:[si+2] 0 0000991F 241F and al, 31 0 00009921 30E4 xor ah, ah 0 00009923 50 push ax 0 00009924 16 push ss 0 00009925 1F pop ds 349 _.LVL38: 0 00009926 E8[FEFF] call _get_cds1 351 _.LVL39: 198:ioctl.c **** return DE_INVLDDRV; 352 .loc 1 198 0 0 00009929 89C3 mov bx, ax 0 0000992B 09D0 or ax, dx 0 0000992D 742A je _.L28 200:ioctl.c **** return DE_INVLDFUNC; 356 .loc 1 200 0 0 0000992F 8EC2 mov es, dx 0 00009931 26837F4300 cmp word ptr es:[bx+67], 0 0 00009936 7D03E9F7FD jl _.L14 202:ioctl.c **** return SUCCESS; 360 .loc 1 202 0 0 0000993B 8E46FE mov es, word ptr [bp-2] 0 0000993E 26807D1801 cmp byte ptr es:[di+24], 1 0 00009943 19C0 sbb ax, ax 0 00009945 F7D8 neg ax 365 _.LVL40: 366 _.L41: 367 _.LBE4: 368 _.LBE8: 282:ioctl.c **** return SUCCESS; 369 .loc 1 282 0 0 00009947 8904 mov word ptr [si], ax 0 00009949 E918FE jmp _.L74 372 _.L20: 373 _.LBB9: 178:ioctl.c **** if (dpbp) 374 .loc 1 178 0 discriminator 2 0 0000994C 30E4 xor ah, ah 0 0000994E 48 dec ax 0 0000994F EB8E jmp _.L21 378 _.LVL41: 379 _.L22: 187:ioctl.c **** return DE_INVLDDRV; 380 .loc 1 187 0 0 00009951 8A04 mov al, byte ptr [si] 382 _.LVL42: 0 00009953 04F8 add al, -8 0 00009955 3C01 cmp al, 1 0 00009957 7606 jbe _.L45 386 _.LVL43: 387 _.L28: 188:ioctl.c **** dev = NULL; 388 .loc 1 188 0 0 00009959 B8F1FF mov ax, -15 0 0000995C E9D6FD jmp _.L1 391 _.LVL44: 392 _.L45: 190:ioctl.c **** } 393 .loc 1 190 0 0 0000995F B90010 mov cx, 4096 189:ioctl.c **** attr = ATTR_REMOTE; 395 .loc 1 189 0 0 00009962 8EDA mov ds, dx 0 00009964 89D2 mov dx, dx 0 00009966 EB9E jmp _.L24 399 _.LVL45: 400 _.L25: 0 00009968 894EFE mov word ptr [bp-2], cx 402 _.LVL46: 403 _.LBB5: 209:ioctl.c **** if (cdsp == NULL) 404 .loc 1 209 0 0 0000996B 368A4402 mov al, byte ptr ss:[si+2] 0 0000996F 241F and al, 31 0 00009971 30E4 xor ah, ah 0 00009973 50 push ax 0 00009974 16 push ss 0 00009975 1F pop ds 411 _.LVL47: 0 00009976 E8[FEFF] call _get_cds1 413 _.LVL48: 210:ioctl.c **** return DE_INVLDDRV; 414 .loc 1 210 0 0 00009979 89C3 mov bx, ax 0 0000997B 09D0 or ax, dx 0 0000997D 74DA je _.L28 212:ioctl.c **** attr |= ATTR_SUBST; 418 .loc 1 212 0 0 0000997F 8EC2 mov es, dx 0 00009981 26F6474410 test byte ptr es:[bx+68], 16 0 00009986 8B4EFE mov cx, word ptr [bp-2] 0 00009989 7403 je _.L31 213:ioctl.c **** r->AX = S_DONE | S_BUSY; 423 .loc 1 213 0 0 0000998B 80CD80 or ch, -128 425 _.LVL49: 426 _.L31: 214:ioctl.c **** r->DX = attr; 427 .loc 1 214 0 0 0000998E C7040003 mov word ptr [si], 768 215:ioctl.c **** return SUCCESS; 429 .loc 1 215 0 0 00009992 894C06 mov word ptr [si+6], cx 0 00009995 E9CCFD jmp _.L74 432 _.LVL50: 433 _.L26: 434 _.LBE5: 219:ioctl.c **** { /* 084A/484A, 084B/484B, 086A/486A, 086B/486B */ 435 .loc 1 219 0 0 00009998 368B4404 mov ax, word ptr ss:[si+4] 0 0000999C 25DEBF and ax, -16418 0 0000999F 3D4A08 cmp ax, 2122 0 000099A2 7403E988FE jne _.L19 0 000099A7 E960FE jmp _.L75 441 _.LVL51: 442 _.L46: 443 _.LBE9: 444 _.LBB10: 234:ioctl.c **** if (r->AL<=0x0f) 445 .loc 1 234 0 0 000099AA B98000 mov cx, 128 0 000099AD E99DFE jmp _.L32 448 _.LVL52: 449 _.L47: 236:ioctl.c **** if (r->AL<=0x08) 450 .loc 1 236 0 0 000099B0 B94000 mov cx, 64 0 000099B3 E997FE jmp _.L32 453 _.LVL53: 454 _.L48: 238:ioctl.c **** if (r->AL<=0x07) 455 .loc 1 238 0 0 000099B6 B90008 mov cx, 2048 0 000099B9 E991FE jmp _.L32 458 _.LVL54: 459 _.L33: 460 _.LBE10: 259:ioctl.c **** CharReqHdr.r_trans = MK_FP(r->DS, r->DX); 461 .loc 1 259 0 0 000099BC 368B4404 mov ax, word ptr ss:[si+4] 0 000099C0 36894512 mov word ptr ss:[di+18], ax 260:ioctl.c **** } 464 .loc 1 260 0 0 000099C4 368B4C0C mov cx, word ptr ss:[si+12] 466 _.LVL55: 0 000099C8 368B4406 mov ax, word ptr ss:[si+6] 0 000099CC 3689450E mov word ptr ss:[di+14], ax 0 000099D0 36894D10 mov word ptr ss:[di+16], cx 0 000099D4 E9CFFE jmp _.L35 471 _.LVL56: 472 _.L36: 273:ioctl.c **** r->AX = CharReqHdr.r_count; 473 .loc 1 273 0 0 000099D7 8A14 mov dl, byte ptr [si] 0 000099D9 80FA05 cmp dl, 5 0 000099DC 7706 ja _.L37 274:ioctl.c **** else if (r->AL <= 0x07) /* 0x06, 0x07 */ 477 .loc 1 274 0 0 000099DE 8B4512 mov ax, word ptr [di+18] 0 000099E1 E963FF jmp _.L41 480 _.L37: 275:ioctl.c **** r->AX = (CharReqHdr.r_status & S_BUSY) ? 0000 : 0x00ff; 481 .loc 1 275 0 0 000099E4 80FA07 cmp dl, 7 0 000099E7 7710 ja _.L38 276:ioctl.c **** else if (r->AL == 0x08) /* 0x08 */ 484 .loc 1 276 0 0 000099E9 F6C402 test ah, 2 0 000099EC 7506 jne _.L50 0 000099EE B8FF00 mov ax, 255 0 000099F1 E953FF jmp _.L41 489 _.L50: 0 000099F4 31C0 xor ax, ax 0 000099F6 E94EFF jmp _.L41 492 _.L38: 277:ioctl.c **** r->AX = (CharReqHdr.r_status & S_BUSY) ? 1 : 0; 493 .loc 1 277 0 0 000099F9 80FA08 cmp dl, 8 0 000099FC 750A jne _.L40 278:ioctl.c **** else if (r->AL == 0x0e || r->AL == 0x0f) /* 0x0e, 0x0f */ 496 .loc 1 278 0 0 000099FE B109 mov cl, 9 0 00009A00 D3E8 shr ax, cl 0 00009A02 83E001 and ax, 1 0 00009A05 E93FFF jmp _.L41 501 _.L40: 279:ioctl.c **** r->AL = CharReqHdr.r_unit; 502 .loc 1 279 0 0 00009A08 80C2F2 add dl, -14 0 00009A0B 80FA01 cmp dl, 1 0 00009A0E 7603E934FF ja _.L41 280:ioctl.c **** else /* 0x0c, 0x0d, 0x10, 0x11 */ 506 .loc 1 280 0 0 00009A13 8A4501 mov al, byte ptr [di+1] 0 00009A16 8804 mov byte ptr [si], al 0 00009A18 E949FD jmp _.L74 510 _.LVL57: 511 _.L71: 512 _.LBB11: 109:ioctl.c **** 513 .loc 1 109 0 0 00009A1B B8FAFF mov ax, -6 515 _.LVL58: 0 00009A1E E914FD jmp _.L1 517 _.LVL59: 518 _.L44: 134:ioctl.c **** 519 .loc 1 134 0 0 00009A21 B8F3FF mov ax, -13 521 _.LVL60: 0 00009A24 E90EFD jmp _.L1 523 _.LBE11: 524 _.LFE4: 525 .size _DosDevIOctl, .-_DosDevIOctl === Switch to base=012BB0h -> ".RODATA" 526 .section .rodata 527 .type _cmd, @object 528 .size _cmd, 18 529 _cmd: 0 00001866 00 .byte 0 0 00001867 00 .byte 0 0 00001868 03 .byte 3 0 00001869 0C .byte 12 0 0000186A 03 .byte 3 0 0000186B 0C .byte 12 0 0000186C 06 .byte 6 0 0000186D 0A .byte 10 0 0000186E 0F .byte 15 0 0000186F 00 .byte 0 0 00001870 00 .byte 0 0 00001871 00 .byte 0 0 00001872 13 .byte 19 0 00001873 13 .byte 19 0 00001874 17 .byte 23 0 00001875 18 .byte 24 0 00001876 19 .byte 25 0 00001877 19 .byte 25 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: io.lst 1 ; 2 ; File: 3 ; io.asm 4 ; Description: 5 ; DOS-C I/O Subsystem 6 ; 7 ; Copyright (c) 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Header$ 29 ; 30 31 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 32 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 33 34 extern ConTable 35 extern LptTable 36 extern ComTable 37 extern uPrtNo 38 extern CommonNdRdExit 39 ;!! extern _NumFloppies 40 extern blk_stk_top 41 extern clk_stk_top 42 extern _reloc_call_blk_driver 43 extern _reloc_call_clk_driver 44 45 extern _TEXT_DGROUP 46 47 ;--------------------------------------------------- 48 ; 49 ; Device entry points 50 ; 51 ; This really should be a struct and go into a request.inc file 52 ; 53 cmdlen equ 0 ; Length of this command 54 unit equ 1 ; Subunit Specified 55 cmd equ 2 ; Command Code 56 status equ 3 ; Status 57 media equ 13 ; Media Descriptor 58 trans equ 14 ; Transfer Address 59 count equ 18 ; Count of blocks or characters 60 start equ 20 ; First block to transfer 61 vid equ 22 ; Volume id pointer 62 huge equ 26 ; First block (32-bit) to transfer 63 64 ; 65 ; The following is the "array" of device driver headers for the internal 66 ; devices. There is one header per device including special aux: and prn: 67 ; pseudo devices. These psuedo devices are necessary for printer 68 ; redirection, i.e., serial or parallel ports, and com port aux selection. 69 ; 70 ; The devices are linked into each other and terminate with a -1 next 71 ; pointer. This saves some time on boot up and also allows us to throw all 72 ; device initialization into a single io_init function that may be placed 73 ; into a discardable code segmemnt. 74 ; === Switch to base=000100h -> "_IO_FIXED_DATA" 75 segment _IO_FIXED_DATA 76 77 ; 78 ; The "CON" device 79 ; 80 ; This device is the standard console device used by 81 ; DOS-C and kernel 82 ; 83 global _con_dev 84 _con_dev equ $ 0 0000054A [1200][0000] dw _prn_dev,LGROUP 0 0000054E 1380 dw 8013h ; con device (stdin & stdout) 0 00000550 [0600] dw GenStrategy 0 00000552 [1100] dw ConIntr 0 00000554 434F4E2020202020 db 'CON ' 90 91 ; 92 ; Generic prn device that can be redirected via mode 93 ; 94 global _prn_dev 0 0000055C [2400][0000] _prn_dev dw _aux_dev,LGROUP 0 00000560 40A0 dw 0A040h 0 00000562 [0600] dw GenStrategy 0 00000564 [1700] dw PrnIntr 0 00000566 50524E2020202020 db 'PRN ' 100 101 ; 102 ; Generic aux device that can be redirected via mode 103 ; 104 global _aux_dev 0 0000056E [3600][0000] _aux_dev dw _Lpt1Dev,LGROUP 0 00000572 0080 dw 8000h 0 00000574 [0600] dw GenStrategy 0 00000576 [3D00] dw AuxIntr 0 00000578 4155582020202020 db 'AUX ' 110 111 ; 112 ; Printer device drivers 113 ; 0 00000580 [4800][0000] _Lpt1Dev dw _Lpt2Dev,LGROUP 0 00000584 40A0 dw 0A040h 0 00000586 [0600] dw GenStrategy 0 00000588 [1D00] dw Lpt1Intr 0 0000058A 4C50543120202020 db 'LPT1 ' 0 00000592 [5A00][0000] _Lpt2Dev dw _Lpt3Dev,LGROUP 0 00000596 40A0 dw 0A040h 0 00000598 [0600] dw GenStrategy 0 0000059A [2500] dw Lpt2Intr 0 0000059C 4C50543220202020 db 'LPT2 ' 0 000005A4 [6C00][0000] _Lpt3Dev dw _Com1Dev,LGROUP 0 000005A8 40A0 dw 0A040h 0 000005AA [0600] dw GenStrategy 0 000005AC [2D00] dw Lpt3Intr 0 000005AE 4C50543320202020 db 'LPT3 ' 129 130 ; 131 ; Com device drivers 132 ; 0 000005B6 [7E00][0000] _Com1Dev dw _Com2Dev,LGROUP 0 000005BA 0080 dw 8000h 0 000005BC [0600] dw GenStrategy 0 000005BE [3D00] dw AuxIntr 0 000005C0 434F4D3120202020 db 'COM1 ' 0 000005C8 [9000][0000] _Com2Dev dw _Com3Dev,LGROUP 0 000005CC 0080 dw 8000h 0 000005CE [0600] dw GenStrategy 0 000005D0 [4300] dw Com2Intr 0 000005D2 434F4D3220202020 db 'COM2 ' 0 000005DA [A200][0000] _Com3Dev dw _Com4Dev,LGROUP 0 000005DE 0080 dw 8000h 0 000005E0 [0600] dw GenStrategy 0 000005E2 [4900] dw Com3Intr 0 000005E4 434F4D3320202020 db 'COM3 ' 0 000005EC [B400][0000] _Com4Dev dw _clk_dev,LGROUP 0 000005F0 0080 dw 8000h 0 000005F2 [0600] dw GenStrategy 0 000005F4 [4F00] dw Com4Intr 0 000005F6 434F4D3420202020 db 'COM4 ' 153 154 ; 155 ; Header for clock device 156 ; 157 global _clk_dev 158 _clk_dev equ $ 0 000005FE [C600][0000] dw _blk_dev,LGROUP 0 00000602 0880 dw 8008h ; clock device 0 00000604 [0600] dw GenStrategy 0 00000606 [FF00] dw clk_entry 0 00000608 434C4F434B242020 db 'CLOCK$ ' 164 165 ; 166 ; Header for device 167 ; 168 global _blk_dev 169 _blk_dev equ $ 0 00000610 FFFFFFFF dd -1 0 00000614 C208 dw 08c2h ; block device with ioctl 0 00000616 [0600] dw GenStrategy 0 00000618 [0601] dw blk_entry 0 0000061A 04 db 4 0 0000061B 00000000000000 db 0,0,0,0,0,0,0 176 177 178 ; 179 ; Temporary table until next release 180 ; 181 segment _IO_FIXED_DATA 0 00000622 00 DiskTable db 0 183 184 185 ; 186 ; Local storage 187 ; 188 %if 0 === Switch to base=000790h -> "_BSS" 189 segment _BSS 190 blk_dos_stk resw 1 191 blk_dos_seg resw 1 192 clk_dos_stk resw 1 193 clk_dos_seg resw 1 194 %endif 195 === Switch to base=000100h -> "_IO_TEXT" 196 segment _IO_TEXT 197 global _ReqPktPtr 0 00000212 00000000 _ReqPktPtr dd 0 0 00000216 0000 uUnitNumber dw 0 200 201 202 ; 203 ; Name: 204 ; GenStrategy 205 ; 206 ; Function: 207 ; Store the pointer to the request packet passed in es:bx 208 ; 209 ; Description: 210 ; Generic strategy routine. Unlike the original multitasking versions, 211 ; this version assumes that no more thank one device driver is active 212 ; at any time. The request is stored into memory in the one and only 213 ; location available for that purpose. 214 ; 215 global GenStrategy 216 GenStrategy: 0 00000218 2E891E[0000] mov word [cs:_ReqPktPtr],bx 0 0000021D 2E8C06[0200] mov word [cs:_ReqPktPtr+2],es 0 00000222 CB retf 220 221 222 ; 223 ; Name: 224 ; XXXXIntr 225 ; 226 ; Function: 227 ; Individual Interrupt routines for each device driver 228 ; 229 ; Description: 230 ; This is actually a single routine with entry points for each device. 231 ; The name used for the entry point is the device name with Intr 232 ; appended to it. 233 ; 234 ; Funtionally, each device driver has an entry and an associated 235 ; table. The table is a structure that consists of a control byte 236 ; followed by an array of pointers to C functions or assembly 237 ; subroutines that implement the individual device driver functions. 238 ; This allows the usage of common error dummy filler code to be used. 239 ; It also allows standardization of the calling procedure for these 240 ; internal device driver functions. 241 ; 242 ; Assembler call/return convention: 243 ; Each driver function is entered by a jump into the function and 244 ; exits by a jump to the appropriate success or error exit routine. 245 ; This speeds up the call and return and helps to minimize the stack 246 ; useage. The contents of the request packet are passed to each 247 ; routine in registers as follows: 248 ; 249 ; Register Function Description 250 ; -------- -------- ----------- 251 ; al unit Subunit Specified 252 ; ah media Media Descriptor 253 ; cx count Count of blocks or characters 254 ; dx start First block to transfer 255 ; es:di trans Transfer Address 256 ; ds:bx reqptr Request pointer 257 ; cs kernel code segment 258 ; ds kernel data segment 259 ; 260 ; The exit routines generally set the status based on the individual 261 ; routine. For example, _IOSuccess will clear the count where 262 ; _IOErrCnt will subtract the remaining amount in cx from the original 263 ; count. See each utility routine for expectations. 264 ; 265 ; C call/return convention: 266 ; The C calling convention simply sets up the C stack and passes the 267 ; request packet pointer as a far pointer to the function. Although 268 ; the utility routine names are such that they are accesible from the 269 ; C name space, they are cannot used. Instead, the common interrupt 270 ; code expects a return status to set in the request packet. It is up 271 ; to the device driver function to set the appropriate fields such as 272 ; count when an error occurs. 273 ; 274 ; How to differntiate between the two calling conventions: 275 ; This code is entirely table driven. The table is a structure that 276 ; is generally in the _IO_FIXED_DATA segment. It consists of a flag 277 ; byte followed by short pointers to the driver functions. Selecting 278 ; a driver type is accomplished by setting the type bit in the flag 279 ; (see below). 280 ; 281 ; 7 6 5 4 3 2 1 0 282 ; +---+---+---+---+---+---+---+---+ 283 ; | | | | | | | | | 284 ; +---+---+---+---+---+---+---+---+ 285 ; | | | |--- Number of table entries 286 ; | | +-------------------+ 287 ; | | |----------------------- Reserved 288 ; | +-------+ 289 ; +--------------------------------- type bit (1 == C / 0 == asm) 290 ; 291 ConIntr: 0 00000223 56 push si 0 00000224 BE[0000] mov si,ConTable 0 00000227 EB47 jmp short CharIntrEntry 295 296 PrnIntr: 0 00000229 56 push si 0 0000022A 50 push ax 0 0000022B 31C0 xor ax,ax 0 0000022D EB16 jmp short LptCmnIntr 301 302 Lpt1Intr: 0 0000022F 56 push si 0 00000230 50 push ax 0 00000231 30C0 xor al,al 0 00000233 B401 mov ah,1 0 00000235 EB0E jmp short LptCmnIntr 308 309 Lpt2Intr: 0 00000237 56 push si 0 00000238 50 push ax 0 00000239 B001 mov al,1 0 0000023B B402 mov ah,2 0 0000023D EB06 jmp short LptCmnIntr 315 316 Lpt3Intr: 0 0000023F 56 push si 0 00000240 50 push ax 0 00000241 B002 mov al,2 0 00000243 B403 mov ah,3 321 322 LptCmnIntr: 0 00000245 BE[0000] mov si,LptTable 0 00000248 2E8826[0000] mov [cs:uPrtNo],ah 0 0000024D EB22 jmp short DiskIntrEntry 326 327 328 AuxIntr: 0 0000024F 56 push si 0 00000250 50 push ax 0 00000251 30C0 xor al,al 0 00000253 EB12 jmp short ComCmnIntr 333 334 Com2Intr: 0 00000255 56 push si 0 00000256 50 push ax 0 00000257 B001 mov al,1 0 00000259 EB0C jmp short ComCmnIntr 339 340 Com3Intr: 0 0000025B 56 push si 0 0000025C 50 push ax 0 0000025D B002 mov al,2 0 0000025F EB06 jmp short ComCmnIntr 345 346 Com4Intr: 0 00000261 56 push si 0 00000262 50 push ax 0 00000263 B003 mov al,3 0 00000265 EB00 jmp short ComCmnIntr 351 352 ComCmnIntr: 0 00000267 BE[0000] mov si,ComTable 0 0000026A EB05 jmp short DiskIntrEntry 355 356 357 DskIntr: 0 0000026C 56 push si 0 0000026D BE[D800] mov si,DiskTable 360 CharIntrEntry: 0 00000270 50 push ax 362 DiskIntrEntry: 0 00000271 51 push cx 0 00000272 52 push dx 0 00000273 57 push di 0 00000274 55 push bp 0 00000275 1E push ds 0 00000276 06 push es 0 00000277 53 push bx 0 00000278 2EA2[0400] mov byte [cs:uUnitNumber],al 0 0000027C 2EC51E[0000] lds bx,[cs:_ReqPktPtr] 0 00000281 2EF60480 test byte [cs:si],80h 0 00000285 7420 je AsmType 374 0 00000287 8A4702 mov al,[bx+cmd] 0 0000028A 2E3A04 cmp al,[cs:si] 0 0000028D 7762 ja _IOCommandError 0 0000028F 98 cbw 0 00000290 D1E0 shl ax,1 0 00000292 01C6 add si,ax 0 00000294 97 xchg di,ax 382 0 00000295 1E push ds 0 00000296 53 push bx 0 00000297 89E5 mov bp,sp 0 00000299 2E8E1E[0000] mov ds,[cs:_TEXT_DGROUP] 0 0000029E FC cld 0 0000029F 2EFF5401 call word [cs:si+1] 0 000002A3 59 pop cx 0 000002A4 59 pop cx 0 000002A5 EB34 jmp short StoreStatus 392 0 000002A7 8A4701 AsmType: mov al,[bx+unit] 0 000002AA 8A670D mov ah,[bx+media] 0 000002AD 8B4F12 mov cx,[bx+count] 0 000002B0 8B5714 mov dx,[bx+start] 0 000002B3 97 xchg di,ax 0 000002B4 8A4702 mov al,[bx+cmd] 0 000002B7 2E3A04 cmp al,[cs:si] 0 000002BA 7735 ja _IOCommandError 0 000002BC 98 cbw 0 000002BD D1E0 shl ax,1 0 000002BF 01C6 add si,ax 0 000002C1 97 xchg di,ax 405 0 000002C2 C47F0E les di,[bx+trans] 0 000002C5 2E8E1E[0000] mov ds,[cs:_TEXT_DGROUP] 0 000002CA FC cld 0 000002CB 2EFF6401 jmp word [cs:si+1] 410 411 ; 412 ; Name: 413 ; _IOXXXXXXX 414 ; 415 ; Function: 416 ; Exit routines for internal device drivers. 417 ; 418 ; Description: 419 ; These routines are the exit for internal device drivers. _IOSuccess 420 ; is for read/write functions and correctly returns for a successful 421 ; read/write operation by setting the remainng count to zero. _IOExit 422 ; simply sets success bit and returns. _IODone returns complete and 423 ; busy status. _IOCommandError returns and error status for invalid 424 ; commands. _IOErrCnt corrects the remaining bytes for errors that 425 ; occurred during partial read/write operation. _IOErrorExit is a 426 ; generic error exit that sets done and error. 427 ; 428 global _IOSuccess 429 _IOSuccess: 0 000002CF 2EC51E[0000] lds bx,[cs:_ReqPktPtr] 0 000002D4 31C0 xor ax,ax 0 000002D6 894712 mov [bx+count],ax 433 434 global _IOExit 435 _IOExit: 0 000002D9 B401 mov ah,1 437 438 StoreStatus: 0 000002DB 2EC51E[0000] lds bx,[cs:_ReqPktPtr] 0 000002E0 894703 mov [bx+status],ax 0 000002E3 5B pop bx 0 000002E4 07 pop es 0 000002E5 1F pop ds 0 000002E6 5D pop bp 0 000002E7 5F pop di 0 000002E8 5A pop dx 0 000002E9 59 pop cx 0 000002EA 58 pop ax 0 000002EB 5E pop si 0 000002EC CB retf 451 452 453 global _IODone 454 _IODone: 0 000002ED B403 mov ah,3 0 000002EF EBEA jmp short StoreStatus 457 458 global _IOCommandError 459 _IOCommandError: 0 000002F1 B003 mov al,3 461 462 global _IOErrCnt 463 _IOErrCnt: 0 000002F3 2EC51E[0000] lds bx,[cs:_ReqPktPtr] 0 000002F8 294F12 sub [bx+count],cx 466 global _IOErrorExit 467 _IOErrorExit: 0 000002FB B481 mov ah,81h 0 000002FD EBDC jmp short StoreStatus 470 471 ; 472 ; Name: 473 ; GetUnitNum 474 ; 475 ; Function: 476 ; Return the internally set unit number. 477 ; 478 ; Description: 479 ; Simply return the contents of uUnitNumber. This version relies on 480 ; no segment registers and makes a safe call regardless of driver 481 ; state. 482 ; 483 global GetUnitNum 484 GetUnitNum: 0 000002FF 2E8B16[0400] mov dx,[cs:uUnitNumber] 0 00000304 C3 ret 487 488 ; 489 ; These are still old style DOS-C drivers. I'll replace 490 ; them in the next release 491 ; 492 493 494 ; 495 ; block device interrupt 496 ; 497 ; NOTE: This code is not standard device driver handlers 498 ; It is written for sperate code and data space. 499 ; 500 501 blk_driver_params: 0 00000305 [0000] dw blk_stk_top 0 00000307 [0000] dw _reloc_call_blk_driver 0 00000309 [0000] dw DGROUP 505 506 clk_driver_params: 0 0000030B [0000] dw clk_stk_top 0 0000030D [0000] dw _reloc_call_clk_driver 0 0000030F [0000] dw DGROUP 510 511 ; clock device interrupt 512 clk_entry: 0 00000311 9C pushf 0 00000312 53 push bx 515 0 00000313 BB[F900] mov bx, clk_driver_params 517 0 00000316 EB05 jmp short clk_and_blk_common 519 520 521 ; block device interrupt 522 blk_entry: 0 00000318 9C pushf 0 00000319 53 push bx 525 0 0000031A BB[F300] mov bx, blk_driver_params 527 528 clk_and_blk_common: 529 0 0000031D 50 push ax 0 0000031E 51 push cx 0 0000031F 52 push dx 533 534 535 ; small model 0 00000320 89E0 mov ax,sp ; use internal stack 0 00000322 8CD2 mov dx,ss 0 00000324 9C pushf ; put flags in cx 0 00000325 59 pop cx 0 00000326 FA cli ; no interrupts 0 00000327 2E8E16[0000] mov ss,[cs:_TEXT_DGROUP] 0 0000032C 2E8B27 mov sp,[cs:bx] 543 0 0000032F 51 push cx 0 00000330 9D popf ; restore interrupt flag 546 547 548 0 00000331 50 push ax ; save old SS/SP 0 00000332 52 push dx 551 552 ; push these registers on 0 00000333 1E push ds ; BLK_STACK 0 00000334 55 push bp ; to save stack space 0 00000335 56 push si 0 00000336 57 push di 0 00000337 06 push es 558 Protect386Registers 559 0 00000338 2E8E1E[0000] mov ds,[cs:_TEXT_DGROUP] ; 561 562 0 0000033D 2EFF36[0200] push word [cs:_ReqPktPtr+2] 0 00000342 2EFF36[0000] push word [cs:_ReqPktPtr] 0 00000347 2EFF5F02 call far [cs:bx+2] 0 0000034B 59 pop cx 0 0000034C 59 pop cx 568 0 0000034D 2EC41E[0000] les bx,[cs:_ReqPktPtr] ; now return completion code 0 00000352 26894703 mov word [es:bx+status],ax ; mark operation complete 571 572 573 Restore386Registers 0 00000356 07 pop es 0 00000357 5F pop di 0 00000358 5E pop si 0 00000359 5D pop bp 0 0000035A 1F pop ds 579 580 0 0000035B 5A pop dx ; get back old SS/SP 0 0000035C 58 pop ax 583 0 0000035D FA cli ; no interrupts 0 0000035E 8ED2 mov ss,dx ; use dos stack 0 00000360 89C4 mov sp,ax 587 588 0 00000362 5A pop dx 0 00000363 59 pop cx 0 00000364 58 pop ax 0 00000365 5B pop bx 0 00000366 9D popf 0 00000367 CB retf === Trace listing source: iprf.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=iprf.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc9dWHH1.s output file : iprf.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:56.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _init_put_console 8 .type _init_put_console, @function 9 _init_put_console: 10 _.LFB4: 11 .file 1 "prf.c" 1:prf.c **** /****************************************************************/ 2:prf.c **** /* */ 3:prf.c **** /* prf.c */ 4:prf.c **** /* */ 5:prf.c **** /* Abbreviated printf Function */ 6:prf.c **** /* */ 7:prf.c **** /* Copyright (c) 1995 */ 8:prf.c **** /* Pasquale J. Villani */ 9:prf.c **** /* All Rights Reserved */ 10:prf.c **** /* */ 11:prf.c **** /* This file is part of DOS-C. */ 12:prf.c **** /* */ 13:prf.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:prf.c **** /* modify it under the terms of the GNU General Public License */ 15:prf.c **** /* as published by the Free Software Foundation; either version */ 16:prf.c **** /* 2, or (at your option) any later version. */ 17:prf.c **** /* */ 18:prf.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:prf.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:prf.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:prf.c **** /* the GNU General Public License for more details. */ 22:prf.c **** /* */ 23:prf.c **** /* You should have received a copy of the GNU General Public */ 24:prf.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:prf.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:prf.c **** /* Cambridge, MA 02139, USA. */ 27:prf.c **** /****************************************************************/ 28:prf.c **** 29:prf.c **** #include "portab.h" 30:prf.c **** 31:prf.c **** #ifdef FORSYS 32:prf.c **** #ifdef __GNUC__ 33:prf.c **** #include 34:prf.c **** #else 35:prf.c **** #include 36:prf.c **** #endif 37:prf.c **** #include 38:prf.c **** #endif 39:prf.c **** 40:prf.c **** #ifdef _INIT 41:prf.c **** #define handle_char init_handle_char 42:prf.c **** #define put_console init_put_console 43:prf.c **** #define ltob init_ltob 44:prf.c **** #define do_printf init_do_printf 45:prf.c **** #define printf init_printf 46:prf.c **** #define sprintf init_sprintf 47:prf.c **** #define charp init_charp 48:prf.c **** #endif 49:prf.c **** 50:prf.c **** #include "debug.h" /* must be below xx to init_xx */ 51:prf.c **** 52:prf.c **** /* special console output routine */ 53:prf.c **** /*#define DOSEMU */ 54:prf.c **** #ifdef DOSEMU 55:prf.c **** 56:prf.c **** #define MAX_BUFSIZE 80 /* adjust if necessary */ 57:prf.c **** static int buff_offset = 0; 58:prf.c **** static char buff[MAX_BUFSIZE]; 59:prf.c **** 60:prf.c **** void put_console(int c) 61:prf.c **** { 62:prf.c **** if (buff_offset >= MAX_BUFSIZE) 63:prf.c **** { 64:prf.c **** buff_offset = 0; 65:prf.c **** DebugPrintf(("Printf buffer overflow!\n")); 66:prf.c **** } 67:prf.c **** if (c == '\n') 68:prf.c **** { 69:prf.c **** buff[buff_offset] = 0; 70:prf.c **** buff_offset = 0; 71:prf.c **** #ifdef __TURBOC__ 72:prf.c **** _ES = FP_SEG(buff); 73:prf.c **** _DX = FP_OFF(buff); 74:prf.c **** _AX = 0x13; 75:prf.c **** __int__(0xe6); 76:prf.c **** #elif defined(__GNUC__) 77:prf.c **** asm volatile( 78:prf.c **** "{ int $0xe6 | int 0xe6 }" 79:prf.c **** : /* outputs */ 80:prf.c **** : /* inputs */ "a"(0x13), "e"(FP_SEG(buff)), "d"(FP_OFF(buff)) 81:prf.c **** ); 82:prf.c **** #elif defined(I86) 83:prf.c **** asm 84:prf.c **** { 85:prf.c **** push ds; 86:prf.c **** pop es; 87:prf.c **** mov dx, offset buff; 88:prf.c **** mov ax, 0x13; 89:prf.c **** int 0xe6; 90:prf.c **** } 91:prf.c **** #endif 92:prf.c **** } 93:prf.c **** else 94:prf.c **** { 95:prf.c **** buff[buff_offset] = c; 96:prf.c **** buff_offset++; 97:prf.c **** } 98:prf.c **** } 99:prf.c **** #else 100:prf.c **** #ifdef __WATCOMC__ 101:prf.c **** void int29(char c); 102:prf.c **** #pragma aux int29 = "int 0x29" __parm [__al] __modify __exact [__bx]; 103:prf.c **** 104:prf.c **** #ifdef DEBUG_PRINT_COMPORT 105:prf.c **** void fastComPrint(char c); 106:prf.c **** #pragma aux fastComPrint = \ 107:prf.c **** "mov bx, 0xFD05" \ 108:prf.c **** "int 0x29" __parm [__al] __modify __exact [__bx]; 109:prf.c **** #endif 110:prf.c **** #endif 111:prf.c **** 112:prf.c **** void put_console(int c) 113:prf.c **** { 12 .loc 1 113 0 13 _.LVL0: 0 00003469 55 push bp 15 _.LCFI0: 0 0000346A 89E5 mov bp, sp 17 _.LCFI1: 114:prf.c **** if (c == '\n') 18 .loc 1 114 0 0 0000346C 837E040A cmp word ptr [bp+4], 10 0 00003470 7507 jne _.L2 115:prf.c **** put_console('\r'); 21 .loc 1 115 0 0 00003472 B80D00 mov ax, 13 0 00003475 50 push ax 0 00003476 E8[FEFF] call _init_put_console 25 _.LVL1: 26 _.L2: 116:prf.c **** 117:prf.c **** #ifdef FORSYS 118:prf.c **** write(1, &c, 1); /* write character to stdout */ 119:prf.c **** #else 120:prf.c **** #if defined(__TURBOC__) 121:prf.c **** _AL = c; 122:prf.c **** __int__(0x29); 123:prf.c **** #elif defined(__WATCOMC__) 124:prf.c **** int29(c); 125:prf.c **** #if defined DEBUG_PRINT_COMPORT 126:prf.c **** fastComPrint(c); 127:prf.c **** #endif 128:prf.c **** #elif defined(__GNUC__) 129:prf.c **** asm volatile("{ int $0x29 | int 0x29 }" : : "a"(c) : "bx"); 27 .loc 1 129 0 0 00003479 8B4604 mov ax, word ptr [bp+4] 29 #APP 30 ;# 129 "prf.c" 1 130 #elif defined(I86) 131:prf.c **** __asm 132:prf.c **** { 133:prf.c **** mov al, byte ptr c; 134:prf.c **** int 0x29; 135:prf.c **** } 136:prf.c **** #endif /* __TURBO__ */ 137:prf.c **** #endif /* FORSYS */ 138:prf.c **** } 31 int 0x29 32 ;# 0 "" 2 33 .loc 1 138 0 34 #NO_APP 0 0000347E 89EC mov sp, bp 0 00003480 5D pop bp 0 00003481 C20200 ret 2 38 _.LFE4: 39 .size _init_put_console, .-_init_put_console 40 .type _init_handle_char, @function 41 _init_handle_char: 42 _.LFB5: 139:prf.c **** #endif /* DOSEMU */ 140:prf.c **** 141:prf.c **** #if defined(DEBUG_NEED_PRINTF) || defined(FORSYS) || defined(_INIT) || defined(TEST) 142:prf.c **** 143:prf.c **** #if defined(DEBUG_NEED_PRINTF) && !defined(_INIT) && !defined(FORSYS) 144:prf.c **** /* need to use FAR pointers for resident DEBUG printf()s where SS != DS */ 145:prf.c **** #define SSFAR FAR 146:prf.c **** #else 147:prf.c **** #define SSFAR 148:prf.c **** #endif 149:prf.c **** 150:prf.c **** #ifndef FORSYS 151:prf.c **** /* copied from bcc (Bruce's C compiler) stdarg.h */ 152:prf.c **** typedef char SSFAR *va_list; 153:prf.c **** #define va_start(arg, last) ((arg) = (va_list) (&(last)+1)) 154:prf.c **** #define va_arg(arg, type) (((type SSFAR *)(arg+=sizeof(type)))[-1]) 155:prf.c **** #define va_end(arg) 156:prf.c **** #endif 157:prf.c **** 158:prf.c **** static BYTE SSFAR *charp = 0; 159:prf.c **** 160:prf.c **** STATIC VOID handle_char(COUNT); 161:prf.c **** STATIC void ltob(LONG, BYTE SSFAR *, COUNT); 162:prf.c **** STATIC void do_printf(const char *, REG va_list); 163:prf.c **** 164:prf.c **** /* special handler to switch between sprintf and printf */ 165:prf.c **** STATIC VOID handle_char(COUNT c) 166:prf.c **** { 43 .loc 1 166 0 44 _.LVL2: 0 00003484 89E3 mov bx, sp 46 _.LCFI2: 0 00003486 8B4702 mov ax, word ptr [bx+2] 167:prf.c **** if (charp == 0) 48 .loc 1 167 0 0 00003489 8B1E[0000] mov bx, word ptr [_init_charp] 0 0000348D 85DB test bx, bx 0 0000348F 7502 jne _.L5 168:prf.c **** put_console(c); 52 .loc 1 168 0 0 00003491 EBD6 jmp _init_put_console 54 _.LVL3: 55 _.L5: 169:prf.c **** else 170:prf.c **** #ifdef DEBUG_PRINT_COMPORT 171:prf.c **** if (charp == (BYTE SSFAR *)-1) 172:prf.c **** fastComPrint(c); 173:prf.c **** else 174:prf.c **** #endif 175:prf.c **** *charp++ = c; 56 .loc 1 175 0 0 00003493 8D5701 lea dx, [1+bx] 0 00003496 8916[0000] mov word ptr [_init_charp], dx 0 0000349A 8807 mov byte ptr [bx], al 176:prf.c **** } 60 .loc 1 176 0 0 0000349C C20200 ret 2 62 _.LFE5: 63 .size _init_handle_char, .-_init_handle_char 64 .global _init_sprintf 65 .type _init_sprintf, @function 66 _init_sprintf: 67 _.LFB8: 177:prf.c **** 178:prf.c **** /* ltob -- convert an long integer to a string in any base (2-16) */ 179:prf.c **** STATIC void ltob(LONG n, BYTE SSFAR * s, COUNT base) 180:prf.c **** { 181:prf.c **** ULONG u; 182:prf.c **** BYTE SSFAR *p; 183:prf.c **** BYTE SSFAR *q; 184:prf.c **** int c; 185:prf.c **** 186:prf.c **** u = n; 187:prf.c **** 188:prf.c **** if (base == -10) /* signals signed conversion */ 189:prf.c **** { 190:prf.c **** base = 10; 191:prf.c **** if (n < 0) 192:prf.c **** { 193:prf.c **** u = -n; 194:prf.c **** *s++ = '-'; 195:prf.c **** } 196:prf.c **** } 197:prf.c **** 198:prf.c **** p = s; 199:prf.c **** do 200:prf.c **** { /* generate digits in reverse order */ 201:prf.c **** *p++ = "0123456789abcdef"[(UWORD) (u % base)]; 202:prf.c **** } 203:prf.c **** while ((u /= base) > 0); 204:prf.c **** 205:prf.c **** *p = '\0'; /* terminate the string */ 206:prf.c **** for (q = s; q < --p; q++) 207:prf.c **** { /* reverse the digits */ 208:prf.c **** c = *q; 209:prf.c **** *q = *p; 210:prf.c **** *p = c; 211:prf.c **** } 212:prf.c **** } 213:prf.c **** 214:prf.c **** #define LEFT 0 215:prf.c **** #define RIGHT 1 216:prf.c **** #define ZEROSFILL 2 217:prf.c **** #define LONGARG 4 218:prf.c **** 219:prf.c **** /* printf -- short version of printf to conserve space */ 220:prf.c **** int VA_CDECL printf(CONST char *fmt, ...) 221:prf.c **** { 222:prf.c **** va_list arg; 223:prf.c **** va_start(arg, fmt); 224:prf.c **** charp = 0; 225:prf.c **** do_printf(fmt, arg); 226:prf.c **** return 0; 227:prf.c **** } 228:prf.c **** 229:prf.c **** #if defined(DEBUG_NEED_PRINTF) && !defined(_INIT) && !defined(FORSYS) 230:prf.c **** STATIC int VA_CDECL fsprintf(char FAR * buff, CONST char * fmt, ...) 231:prf.c **** { 232:prf.c **** va_list arg; 233:prf.c **** 234:prf.c **** va_start(arg, fmt); 235:prf.c **** charp = buff; 236:prf.c **** do_printf(fmt, arg); 237:prf.c **** handle_char('\0'); 238:prf.c **** return 0; 239:prf.c **** } 240:prf.c **** #else 241:prf.c **** #define fsprintf sprintf 242:prf.c **** #endif 243:prf.c **** 244:prf.c **** int VA_CDECL sprintf(char * buff, CONST char * fmt, ...) 245:prf.c **** { 68 .loc 1 245 0 69 _.LVL4: 0 0000349F 55 push bp 71 _.LCFI3: 0 000034A0 89E5 mov bp, sp 73 _.LCFI4: 0 000034A2 1E push ds 75 _.LVL5: 246:prf.c **** va_list arg; 247:prf.c **** 248:prf.c **** va_start(arg, fmt); 249:prf.c **** charp = buff; 76 .loc 1 249 0 0 000034A3 8B4604 mov ax, word ptr [bp+4] 0 000034A6 A3[0000] mov word ptr [_init_charp], ax 250:prf.c **** do_printf(fmt, arg); 79 .loc 1 250 0 0 000034A9 8D4608 lea ax, [8+bp] 81 _.LVL6: 0 000034AC 50 push ax 0 000034AD FF7606 push word ptr [bp+6] 0 000034B0 E81000 call _init_do_printf 85 _.LVL7: 251:prf.c **** handle_char('\0'); 86 .loc 1 251 0 0 000034B3 31C0 xor ax, ax 0 000034B5 50 push ax 0 000034B6 8946FE mov word ptr [bp-2], ax 0 000034B9 E8C8FF call _init_handle_char 91 _.LVL8: 252:prf.c **** return 0; 253:prf.c **** } 92 .loc 1 253 0 0 000034BC 8B46FE mov ax, word ptr [bp-2] 0 000034BF 89EC mov sp, bp 0 000034C1 5D pop bp 0 000034C2 C3 ret 97 _.LFE8: 98 .size _init_sprintf, .-_init_sprintf === Switch to base=012BB0h -> ".RODATA.STR1.1" 99 .section .rodata.str1.1,"aMS",@progbits,1 100 _.LC0: 0 00000D19 253034783A253034 .string "%04x:%04x" 0 00000D21 7800 102 _.LC1: 0 00000D23 3031323334353637 .string "0123456789abcdef" 0 00000D2B 3839616263646566 0 00000D33 00 === Switch to base=002270h -> ".TEXT" 104 .text 105 .type _init_do_printf, @function 106 _init_do_printf: 107 _.LFB9: 254:prf.c **** 255:prf.c **** #ifdef DEBUG_PRINT_COMPORT 256:prf.c **** int dbgc_printf(CONST char * fmt, ...) 257:prf.c **** { 258:prf.c **** va_list arg; 259:prf.c **** 260:prf.c **** va_start(arg, fmt); 261:prf.c **** charp = (BYTE SSFAR *)-1; 262:prf.c **** do_printf(fmt, arg); 263:prf.c **** handle_char('\0'); 264:prf.c **** return 0; 265:prf.c **** } 266:prf.c **** #endif 267:prf.c **** 268:prf.c **** STATIC void do_printf(CONST BYTE * fmt, va_list arg) 269:prf.c **** { 108 .loc 1 269 0 109 _.LVL9: 0 000034C3 56 push si 0 000034C4 57 push di 0 000034C5 55 push bp 113 _.LCFI5: 0 000034C6 89E5 mov bp, sp 115 _.LCFI6: 0 000034C8 83EC20 sub sp, 32 0 000034CB 8B7608 mov si, word ptr [bp+8] 0 000034CE 8B7E0A mov di, word ptr [bp+10] 119 _.LVL10: 120 _.L10: 270:prf.c **** int base, size; 271:prf.c **** BYTE s[13]; /* long enough for a 32-bit octal number string with sign */ 272:prf.c **** BYTE flags; 273:prf.c **** BYTE FAR *p; 274:prf.c **** 275:prf.c **** for (;*fmt != '\0'; fmt++) 121 .loc 1 275 0 discriminator 1 0 000034D1 8A04 mov al, byte ptr [si] 0 000034D3 84C0 test al, al 0 000034D5 7508 jne _.L54 125 _.L9: 276:prf.c **** { 277:prf.c **** if (*fmt != '%') 278:prf.c **** { 279:prf.c **** handle_char(*fmt); 280:prf.c **** continue; 281:prf.c **** } 282:prf.c **** 283:prf.c **** fmt++; 284:prf.c **** flags = RIGHT; 285:prf.c **** 286:prf.c **** if (*fmt == '-') 287:prf.c **** { 288:prf.c **** flags = LEFT; 289:prf.c **** fmt++; 290:prf.c **** } 291:prf.c **** 292:prf.c **** if (*fmt == '0') 293:prf.c **** { 294:prf.c **** flags |= ZEROSFILL; 295:prf.c **** fmt++; 296:prf.c **** } 297:prf.c **** 298:prf.c **** size = 0; 299:prf.c **** while (1) 300:prf.c **** { 301:prf.c **** unsigned c = (unsigned char)(*fmt - '0'); 302:prf.c **** if (c > 9) 303:prf.c **** break; 304:prf.c **** fmt++; 305:prf.c **** size = size * 10 + c; 306:prf.c **** } 307:prf.c **** 308:prf.c **** if (*fmt == 'l') 309:prf.c **** { 310:prf.c **** flags |= LONGARG; 311:prf.c **** fmt++; 312:prf.c **** } 313:prf.c **** 314:prf.c **** switch (*fmt) 315:prf.c **** { 316:prf.c **** case '\0': 317:prf.c **** va_end(arg); 318:prf.c **** return; 319:prf.c **** 320:prf.c **** case 'c': 321:prf.c **** handle_char(va_arg(arg, int)); 322:prf.c **** continue; 323:prf.c **** 324:prf.c **** case 'p': 325:prf.c **** { 326:prf.c **** UWORD w0 = va_arg(arg, unsigned); 327:prf.c **** char SSFAR *tmp = charp; 328:prf.c **** fsprintf(s, "%04x:%04x", va_arg(arg, unsigned), w0); 329:prf.c **** p = s; 330:prf.c **** charp = tmp; 331:prf.c **** break; 332:prf.c **** } 333:prf.c **** 334:prf.c **** case 's': 335:prf.c **** p = va_arg(arg, char *); 336:prf.c **** break; 337:prf.c **** 338:prf.c **** case 'F': 339:prf.c **** fmt++; 340:prf.c **** /* we assume %Fs here */ 341:prf.c **** case 'S': 342:prf.c **** p = va_arg(arg, char FAR *); 343:prf.c **** break; 344:prf.c **** 345:prf.c **** case 'i': 346:prf.c **** case 'd': 347:prf.c **** base = -10; 348:prf.c **** goto lprt; 349:prf.c **** 350:prf.c **** case 'o': 351:prf.c **** base = 8; 352:prf.c **** goto lprt; 353:prf.c **** 354:prf.c **** case 'u': 355:prf.c **** base = 10; 356:prf.c **** goto lprt; 357:prf.c **** 358:prf.c **** case 'X': 359:prf.c **** case 'x': 360:prf.c **** base = 16; 361:prf.c **** 362:prf.c **** lprt: 363:prf.c **** { 364:prf.c **** long currentArg; 365:prf.c **** if (flags & LONGARG) 366:prf.c **** currentArg = va_arg(arg, long); 367:prf.c **** else 368:prf.c **** { 369:prf.c **** currentArg = va_arg(arg, int); 370:prf.c **** if (base >= 0) 371:prf.c **** currentArg = (long)(unsigned)currentArg; 372:prf.c **** } 373:prf.c **** ltob(currentArg, s, base); 374:prf.c **** p = s; 375:prf.c **** } 376:prf.c **** break; 377:prf.c **** 378:prf.c **** default: 379:prf.c **** handle_char('?'); 380:prf.c **** case '%': 381:prf.c **** 382:prf.c **** handle_char(*fmt); 383:prf.c **** continue; 384:prf.c **** 385:prf.c **** } 386:prf.c **** { 387:prf.c **** size_t i = 0; 388:prf.c **** while(p[i]) i++; 389:prf.c **** size -= i; 390:prf.c **** } 391:prf.c **** 392:prf.c **** if (flags & RIGHT) 393:prf.c **** { 394:prf.c **** int ch = ' '; 395:prf.c **** if (flags & ZEROSFILL) ch = '0'; 396:prf.c **** for (; size > 0; size--) 397:prf.c **** handle_char(ch); 398:prf.c **** } 399:prf.c **** for (; *p != '\0'; p++) 400:prf.c **** handle_char(*p); 401:prf.c **** 402:prf.c **** for (; size > 0; size--) 403:prf.c **** handle_char(' '); 404:prf.c **** } 405:prf.c **** va_end(arg); 406:prf.c **** } 126 .loc 1 406 0 0 000034D7 89EC mov sp, bp 0 000034D9 5D pop bp 0 000034DA 5F pop di 130 _.LVL11: 0 000034DB 5E pop si 132 _.LVL12: 0 000034DC C20400 ret 4 134 _.LVL13: 135 _.L54: 277:prf.c **** { 136 .loc 1 277 0 0 000034DF 3C25 cmp al, 37 0 000034E1 7408 je _.L11 139 _.L87: 382:prf.c **** continue; 140 .loc 1 382 0 0 000034E3 98 cbw 0 000034E4 50 push ax 0 000034E5 E89CFF call _init_handle_char 144 _.LVL14: 383:prf.c **** 145 .loc 1 383 0 0 000034E8 E98501 jmp _.L12 147 _.L11: 148 _.LVL15: 286:prf.c **** { 149 .loc 1 286 0 0 000034EB 807C012D cmp byte ptr [si+1], 45 0 000034EF 7436 je _.L13 283:prf.c **** flags = RIGHT; 152 .loc 1 283 0 0 000034F1 46 inc si 154 _.LVL16: 284:prf.c **** 155 .loc 1 284 0 0 000034F2 C646EA01 mov byte ptr [bp-22], 1 157 _.LVL17: 158 _.L14: 292:prf.c **** { 159 .loc 1 292 0 0 000034F6 803C30 cmp byte ptr [si], 48 0 000034F9 7505 jne _.L15 294:prf.c **** fmt++; 162 .loc 1 294 0 0 000034FB 804EEA02 or byte ptr [bp-22], 2 164 _.LVL18: 295:prf.c **** } 165 .loc 1 295 0 0 000034FF 46 inc si 167 _.LVL19: 168 _.L15: 298:prf.c **** while (1) 169 .loc 1 298 0 0 00003500 C746E80000 mov word ptr [bp-24], 0 171 _.LVL20: 172 _.L17: 173 _.LBB9: 301:prf.c **** if (c > 9) 174 .loc 1 301 0 0 00003505 8A04 mov al, byte ptr [si] 0 00003507 88C4 mov ah, al 0 00003509 80C4D0 add ah, -48 0 0000350C 8866F0 mov byte ptr [bp-16], ah 0 0000350F C646F100 mov byte ptr [bp-15], 0 180 _.LVL21: 302:prf.c **** break; 181 .loc 1 302 0 0 00003513 80FC09 cmp ah, 9 0 00003516 7718 ja _.L16 304:prf.c **** size = size * 10 + c; 184 .loc 1 304 0 0 00003518 46 inc si 186 _.LVL22: 305:prf.c **** } 187 .loc 1 305 0 0 00003519 B80A00 mov ax, 10 0 0000351C F766E8 mul word ptr [bp-24] 0 0000351F 0346F0 add ax, word ptr [bp-16] 0 00003522 8946E8 mov word ptr [bp-24], ax 192 _.LVL23: 193 _.LBE9: 300:prf.c **** unsigned c = (unsigned char)(*fmt - '0'); 194 .loc 1 300 0 0 00003525 EBDE jmp _.L17 196 _.LVL24: 197 _.L13: 289:prf.c **** } 198 .loc 1 289 0 0 00003527 83C602 add si, 2 200 _.LVL25: 288:prf.c **** fmt++; 201 .loc 1 288 0 0 0000352A C646EA00 mov byte ptr [bp-22], 0 0 0000352E EBC6 jmp _.L14 204 _.LVL26: 205 _.L16: 308:prf.c **** { 206 .loc 1 308 0 0 00003530 3C6C cmp al, 108 0 00003532 7505 jne _.L18 310:prf.c **** fmt++; 209 .loc 1 310 0 0 00003534 804EEA04 or byte ptr [bp-22], 4 211 _.LVL27: 311:prf.c **** } 212 .loc 1 311 0 0 00003538 46 inc si 214 _.LVL28: 215 _.L18: 314:prf.c **** { 216 .loc 1 314 0 0 00003539 8A04 mov al, byte ptr [si] 0 0000353B 3C64 cmp al, 100 0 0000353D 7503E9E001 je _.L56 0 00003542 7F3C jg _.L21 0 00003544 3C46 cmp al, 70 0 00003546 7503E9C301 je _.L22 0 0000354B 7F13 jg _.L23 0 0000354D 84C0 test al, al 0 0000354F 7486 je _.L9 0 00003551 3C25 cmp al, 37 0 00003553 7407 je _.L25 228 _.L19: 379:prf.c **** case '%': 229 .loc 1 379 0 0 00003555 B83F00 mov ax, 63 0 00003558 50 push ax 0 00003559 E828FF call _init_handle_char 233 _.LVL29: 234 _.L25: 382:prf.c **** continue; 235 .loc 1 382 0 0 0000355C 8A04 mov al, byte ptr [si] 0 0000355E EB83 jmp _.L87 238 _.L23: 314:prf.c **** { 239 .loc 1 314 0 0 00003560 3C58 cmp al, 88 0 00003562 7503E9B301 je _.L26 0 00003567 3C63 cmp al, 99 0 00003569 7503E9F200 je _.L27 0 0000356E 3C53 cmp al, 83 0 00003570 75E3 jne _.L19 246 _.L28: 247 _.LVL30: 342:prf.c **** break; 248 .loc 1 342 0 0 00003572 8B0D mov cx, word ptr [di] 0 00003574 8B4502 mov ax, word ptr [di+2] 0 00003577 8946F0 mov word ptr [bp-16], ax 252 _.LVL31: 0 0000357A 83C704 add di, 4 254 _.LVL32: 343:prf.c **** 255 .loc 1 343 0 0 0000357D E92901 jmp _.L34 257 _.LVL33: 258 _.L21: 314:prf.c **** { 259 .loc 1 314 0 0 00003580 3C70 cmp al, 112 0 00003582 7503E9ED00 je _.L29 0 00003587 7E03E9B500 jg _.L30 0 0000358C 3C69 cmp al, 105 0 0000358E 7503E98F01 je _.L56 0 00003593 3C6F cmp al, 111 0 00003595 75BE jne _.L19 351:prf.c **** goto lprt; 267 .loc 1 351 0 0 00003597 C746F00800 mov word ptr [bp-16], 8 269 _.LVL34: 270 _.L20: 271 _.LBB10: 366:prf.c **** else 272 .loc 1 366 0 0 0000359C 89F8 mov ax, di 365:prf.c **** currentArg = va_arg(arg, long); 274 .loc 1 365 0 0 0000359E F646EA04 test byte ptr [bp-22], 4 0 000035A2 7503E98301 je _.L35 277 _.LVL35: 366:prf.c **** else 278 .loc 1 366 0 0 000035A7 83C004 add ax, 4 280 _.LVL36: 0 000035AA 8946E6 mov word ptr [bp-26], ax 282 _.LVL37: 0 000035AD 8B0D mov cx, word ptr [di] 0 000035AF 8B4502 mov ax, word ptr [di+2] 285 _.LVL38: 286 _.L36: 287 _.LBB11: 288 _.LBB12: 186:prf.c **** 289 .loc 1 186 0 0 000035B2 894EEE mov word ptr [bp-18], cx 0 000035B5 8946EC mov word ptr [bp-20], ax 292 _.LVL39: 188:prf.c **** { 293 .loc 1 188 0 0 000035B8 837EF0F6 cmp word ptr [bp-16], -10 0 000035BC 7403E98801 jne _.L86 296 _.LVL40: 191:prf.c **** { 297 .loc 1 191 0 0 000035C1 85C0 test ax, ax 0 000035C3 7C03E97C01 jge _.L58 193:prf.c **** *s++ = '-'; 300 .loc 1 193 0 0 000035C8 31D2 xor dx, dx 0 000035CA 89D7 mov di, dx 0 000035CC 29CA sub dx, cx 0 000035CE 8956EE mov word ptr [bp-18], dx 0 000035D1 19C7 sbb di, ax 0 000035D3 897EEC mov word ptr [bp-20], di 307 _.LVL41: 194:prf.c **** } 308 .loc 1 194 0 0 000035D6 C646F32D mov byte ptr [bp-13], 45 190:prf.c **** if (n < 0) 310 .loc 1 190 0 0 000035DA C746F00A00 mov word ptr [bp-16], 10 312 _.LVL42: 194:prf.c **** } 313 .loc 1 194 0 0 000035DF 8D4EF4 lea cx, [-12+bp] 315 _.LVL43: 316 _.L38: 198:prf.c **** do 317 .loc 1 198 0 0 000035E2 89CB mov bx, cx 201:prf.c **** } 319 .loc 1 201 0 0 000035E4 8B46F0 mov ax, word ptr [bp-16] 0 000035E7 99 cwd 0 000035E8 8956E4 mov word ptr [bp-28], dx 323 _.LVL44: 324 _.L40: 0 000035EB 894EE0 mov word ptr [bp-32], cx 326 _.LVL45: 0 000035EE 43 inc bx 328 _.LVL46: 0 000035EF 895EE2 mov word ptr [bp-30], bx 330 _.LVL47: 0 000035F2 FF76E4 push word ptr [bp-28] 0 000035F5 FF76F0 push word ptr [bp-16] 0 000035F8 FF76EC push word ptr [bp-20] 0 000035FB FF76EE push word ptr [bp-18] 0 000035FE E8[FEFF] call ___umodsi3 336 _.LVL48: 0 00003601 BF[0A00] mov di, offset _.LC1 0 00003604 93 xchg bx, ax 0 00003605 8A01 mov al, byte ptr [bx+di] 0 00003607 8B5EE2 mov bx, word ptr [bp-30] 0 0000360A 8847FF mov byte ptr [bx-1], al 203:prf.c **** 342 .loc 1 203 0 0 0000360D FF76E4 push word ptr [bp-28] 0 00003610 FF76F0 push word ptr [bp-16] 0 00003613 FF76EC push word ptr [bp-20] 0 00003616 FF76EE push word ptr [bp-18] 0 00003619 E8[FEFF] call ___udivsi3 348 _.LVL49: 0 0000361C 8946EE mov word ptr [bp-18], ax 350 _.LVL50: 0 0000361F 8956EC mov word ptr [bp-20], dx 352 _.LVL51: 0 00003622 09D0 or ax, dx 354 _.LVL52: 0 00003624 8B5EE2 mov bx, word ptr [bp-30] 0 00003627 8B4EE0 mov cx, word ptr [bp-32] 0 0000362A 75BF jne _.L40 358 _.LVL53: 205:prf.c **** for (q = s; q < --p; q++) 359 .loc 1 205 0 0 0000362C 8807 mov byte ptr [bx], al 361 _.LVL54: 362 _.L41: 206:prf.c **** { /* reverse the digits */ 363 .loc 1 206 0 0 0000362E 4B dec bx 365 _.LVL55: 0 0000362F 39D9 cmp cx, bx 0 00003631 7303E91901 jc _.L42 368 _.LVL56: 369 _.LBE12: 370 _.LBE11: 374:prf.c **** } 371 .loc 1 374 0 0 00003636 8D4EF3 lea cx, [-13+bp] 0 00003639 8C56F0 mov word ptr [bp-16], ss 374 _.LVL57: 375 _.LBE10: 376:prf.c **** 376 .loc 1 376 0 0 0000363C 8B7EE6 mov di, word ptr [bp-26] 0 0000363F EB68 jmp _.L34 379 _.LVL58: 380 _.L30: 314:prf.c **** { 381 .loc 1 314 0 0 00003641 3C75 cmp al, 117 0 00003643 7503E9CA00 je _.L32 0 00003648 3C78 cmp al, 120 0 0000364A 7503E9CB00 je _.L26 0 0000364F 3C73 cmp al, 115 0 00003651 7403E9FFFE jne _.L19 388 _.LVL59: 335:prf.c **** break; 389 .loc 1 335 0 0 00003656 8B0D mov cx, word ptr [di] 0 00003658 8C56F0 mov word ptr [bp-16], ss 392 _.LVL60: 0 0000365B 83C702 add di, 2 394 _.LVL61: 336:prf.c **** 395 .loc 1 336 0 0 0000365E EB49 jmp _.L34 397 _.LVL62: 398 _.L27: 321:prf.c **** continue; 399 .loc 1 321 0 0 00003660 89F8 mov ax, di 0 00003662 83C002 add ax, 2 0 00003665 8946F0 mov word ptr [bp-16], ax 403 _.LVL63: 0 00003668 FF35 push word ptr [di] 0 0000366A E817FE call _init_handle_char 406 _.LVL64: 0 0000366D 8B7EF0 mov di, word ptr [bp-16] 408 _.LVL65: 409 _.L12: 275:prf.c **** { 410 .loc 1 275 0 0 00003670 46 inc si 412 _.LVL66: 0 00003671 E95DFE jmp _.L10 414 _.LVL67: 415 _.L29: 416 _.LBB15: 327:prf.c **** fsprintf(s, "%04x:%04x", va_arg(arg, unsigned), w0); 417 .loc 1 327 0 0 00003674 8B16[0000] mov dx, word ptr [_init_charp] 0 00003678 8956EC mov word ptr [bp-20], dx 420 _.LVL68: 328:prf.c **** p = s; 421 .loc 1 328 0 0 0000367B 89F8 mov ax, di 0 0000367D 83C004 add ax, 4 0 00003680 8946EE mov word ptr [bp-18], ax 425 _.LVL69: 0 00003683 FF35 push word ptr [di] 427 _.LVL70: 0 00003685 FF7502 push word ptr [di+2] 429 _.LVL71: 0 00003688 B8[0000] mov ax, offset _.LC0 431 _.LVL72: 0 0000368B 50 push ax 433 _.LVL73: 0 0000368C 8D4EF3 lea cx, [-13+bp] 0 0000368F 51 push cx 436 _.LVL74: 0 00003690 894EF0 mov word ptr [bp-16], cx 438 _.LVL75: 0 00003693 E8[FEFF] call _init_sprintf 440 _.LVL76: 329:prf.c **** charp = tmp; 441 .loc 1 329 0 0 00003696 8B4EF0 mov cx, word ptr [bp-16] 0 00003699 8C56F0 mov word ptr [bp-16], ss 444 _.LVL77: 330:prf.c **** break; 445 .loc 1 330 0 0 0000369C 8B56EC mov dx, word ptr [bp-20] 0 0000369F 8916[0000] mov word ptr [_init_charp], dx 331:prf.c **** } 448 .loc 1 331 0 0 000036A3 83C408 add sp, 8 328:prf.c **** p = s; 450 .loc 1 328 0 0 000036A6 8B7EEE mov di, word ptr [bp-18] 452 _.LVL78: 453 _.L34: 454 _.LBE15: 455 _.LBB16: 387:prf.c **** while(p[i]) i++; 456 .loc 1 387 0 0 000036A9 31C0 xor ax, ax 458 _.LVL79: 459 _.L43: 388:prf.c **** size -= i; 460 .loc 1 388 0 discriminator 1 0 000036AB 89C3 mov bx, ax 0 000036AD 01CB add bx, cx 0 000036AF 8E46F0 mov es, word ptr [bp-16] 0 000036B2 26803F00 cmp byte ptr es:[bx], 0 0 000036B6 7403E9A200 jne _.L44 389:prf.c **** } 466 .loc 1 389 0 0 000036BB 8B56E8 mov dx, word ptr [bp-24] 0 000036BE 29C2 sub dx, ax 0 000036C0 89D0 mov ax, dx 470 _.LVL80: 471 _.LBE16: 392:prf.c **** { 472 .loc 1 392 0 0 000036C2 F646EA01 test byte ptr [bp-22], 1 0 000036C6 7420 je _.L50 475 _.LVL81: 476 _.LBB17: 395:prf.c **** for (; size > 0; size--) 477 .loc 1 395 0 0 000036C8 F646EA02 test byte ptr [bp-22], 2 0 000036CC 7503E99000 je _.L59 0 000036D1 BB3000 mov bx, 48 481 _.L46: 394:prf.c **** if (flags & ZEROSFILL) ch = '0'; 482 .loc 1 394 0 discriminator 1 0 000036D4 89C2 mov dx, ax 484 _.LVL82: 485 _.L47: 396:prf.c **** handle_char(ch); 486 .loc 1 396 0 discriminator 1 0 000036D6 85D2 test dx, dx 0 000036D8 7E03E98A00 jg _.L48 0 000036DD 89C2 mov dx, ax 490 _.LVL83: 0 000036DF 85C0 test ax, ax 0 000036E1 7D02 jge _.L49 0 000036E3 31D2 xor dx, dx 494 _.L49: 0 000036E5 29D0 sub ax, dx 0 000036E7 92 xchg dx, ax 497 _.LVL84: 498 _.L50: 499 _.LBE17: 399:prf.c **** handle_char(*p); 500 .loc 1 399 0 discriminator 1 0 000036E8 8E46F0 mov es, word ptr [bp-16] 0 000036EB 89CB mov bx, cx 0 000036ED 268A07 mov al, byte ptr es:[bx] 0 000036F0 84C0 test al, al 0 000036F2 7403E99000 jne _.L51 506 _.LVL85: 507 _.L52: 402:prf.c **** handle_char(' '); 508 .loc 1 402 0 discriminator 1 0 000036F7 85D2 test dx, dx 0 000036F9 7F03E972FF jle _.L12 0 000036FE 8956F0 mov word ptr [bp-16], dx 403:prf.c **** } 512 .loc 1 403 0 discriminator 2 0 00003701 B82000 mov ax, 32 0 00003704 50 push ax 0 00003705 E87CFD call _init_handle_char 516 _.LVL86: 402:prf.c **** handle_char(' '); 517 .loc 1 402 0 discriminator 2 0 00003708 8B56F0 mov dx, word ptr [bp-16] 0 0000370B 4A dec dx 520 _.LVL87: 0 0000370C EBE9 jmp _.L52 522 _.LVL88: 523 _.L22: 339:prf.c **** /* we assume %Fs here */ 524 .loc 1 339 0 0 0000370E 46 inc si 526 _.LVL89: 0 0000370F E960FE jmp _.L28 528 _.L32: 529 _.LVL90: 355:prf.c **** goto lprt; 530 .loc 1 355 0 0 00003712 C746F00A00 mov word ptr [bp-16], 10 532 _.LVL91: 356:prf.c **** 533 .loc 1 356 0 0 00003717 E982FE jmp _.L20 535 _.LVL92: 536 _.L26: 360:prf.c **** 537 .loc 1 360 0 0 0000371A C746F01000 mov word ptr [bp-16], 16 539 _.LVL93: 0 0000371F E97AFE jmp _.L20 541 _.LVL94: 542 _.L56: 347:prf.c **** goto lprt; 543 .loc 1 347 0 0 00003722 C746F0F6FF mov word ptr [bp-16], -10 545 _.LVL95: 0 00003727 E972FE jmp _.L20 547 _.LVL96: 548 _.L35: 549 _.LBB18: 369:prf.c **** if (base >= 0) 550 .loc 1 369 0 0 0000372A 83C002 add ax, 2 552 _.LVL97: 0 0000372D 8946E6 mov word ptr [bp-26], ax 554 _.LVL98: 0 00003730 8B05 mov ax, word ptr [di] 556 _.LVL99: 371:prf.c **** } 557 .loc 1 371 0 0 00003732 89C1 mov cx, ax 369:prf.c **** if (base >= 0) 559 .loc 1 369 0 0 00003734 99 cwd 0 00003735 92 xchg dx, ax 562 _.LVL100: 370:prf.c **** currentArg = (long)(unsigned)currentArg; 563 .loc 1 370 0 0 00003736 837EF000 cmp word ptr [bp-16], 0 0 0000373A 7D03E973FE jl _.L36 566 _.LVL101: 371:prf.c **** } 567 .loc 1 371 0 0 0000373F 31C0 xor ax, ax 569 _.LVL102: 0 00003741 E96EFE jmp _.L36 571 _.LVL103: 572 _.L58: 573 _.LBB14: 574 _.LBB13: 190:prf.c **** if (n < 0) 575 .loc 1 190 0 0 00003744 C746F00A00 mov word ptr [bp-16], 10 577 _.LVL104: 578 _.L86: 191:prf.c **** { 579 .loc 1 191 0 0 00003749 8D4EF3 lea cx, [-13+bp] 581 _.LVL105: 0 0000374C E993FE jmp _.L38 583 _.LVL106: 584 _.L42: 208:prf.c **** *q = *p; 585 .loc 1 208 0 0 0000374F 89CF mov di, cx 0 00003751 8A05 mov al, byte ptr [di] 588 _.LVL107: 209:prf.c **** *p = c; 589 .loc 1 209 0 0 00003753 8A27 mov ah, byte ptr [bx] 0 00003755 8825 mov byte ptr [di], ah 210:prf.c **** } 592 .loc 1 210 0 0 00003757 8807 mov byte ptr [bx], al 206:prf.c **** { /* reverse the digits */ 594 .loc 1 206 0 0 00003759 41 inc cx 596 _.LVL108: 0 0000375A E9D1FE jmp _.L41 598 _.LVL109: 599 _.L44: 600 _.LBE13: 601 _.LBE14: 602 _.LBE18: 603 _.LBB19: 388:prf.c **** size -= i; 604 .loc 1 388 0 discriminator 2 0 0000375D 40 inc ax 606 _.LVL110: 0 0000375E E94AFF jmp _.L43 608 _.LVL111: 609 _.L59: 610 _.LBE19: 611 _.LBB20: 394:prf.c **** if (flags & ZEROSFILL) ch = '0'; 612 .loc 1 394 0 0 00003761 BB2000 mov bx, 32 0 00003764 E96DFF jmp _.L46 615 _.LVL112: 616 _.L48: 0 00003767 894EE8 mov word ptr [bp-24], cx 0 0000376A 8946EA mov word ptr [bp-22], ax 0 0000376D 8956EC mov word ptr [bp-20], dx 397:prf.c **** } 620 .loc 1 397 0 discriminator 2 0 00003770 53 push bx 0 00003771 895EEE mov word ptr [bp-18], bx 0 00003774 E80DFD call _init_handle_char 624 _.LVL113: 396:prf.c **** handle_char(ch); 625 .loc 1 396 0 discriminator 2 0 00003777 8B56EC mov dx, word ptr [bp-20] 0 0000377A 4A dec dx 0 0000377B 8B4EE8 mov cx, word ptr [bp-24] 0 0000377E 8B46EA mov ax, word ptr [bp-22] 0 00003781 8B5EEE mov bx, word ptr [bp-18] 631 _.LVL114: 0 00003784 E94FFF jmp _.L47 633 _.LVL115: 634 _.L51: 0 00003787 894EEC mov word ptr [bp-20], cx 0 0000378A 8956EE mov word ptr [bp-18], dx 637 _.LBE20: 400:prf.c **** 638 .loc 1 400 0 discriminator 2 0 0000378D 98 cbw 0 0000378E 50 push ax 0 0000378F E8F2FC call _init_handle_char 642 _.LVL116: 399:prf.c **** handle_char(*p); 643 .loc 1 399 0 discriminator 2 0 00003792 8B4EEC mov cx, word ptr [bp-20] 0 00003795 41 inc cx 0 00003796 8B56EE mov dx, word ptr [bp-18] 647 _.LVL117: 0 00003799 E94CFF jmp _.L50 649 _.LFE9: 650 .size _init_do_printf, .-_init_do_printf 651 .global _init_printf 652 .type _init_printf, @function 653 _init_printf: 654 _.LFB7: 221:prf.c **** va_list arg; 655 .loc 1 221 0 656 _.LVL118: 0 0000379C 55 push bp 658 _.LCFI7: 0 0000379D 89E5 mov bp, sp 660 _.LCFI8: 661 _.LVL119: 224:prf.c **** do_printf(fmt, arg); 662 .loc 1 224 0 0 0000379F C706[0000]0000 mov word ptr [_init_charp], 0 225:prf.c **** return 0; 664 .loc 1 225 0 0 000037A5 8D4606 lea ax, [6+bp] 666 _.LVL120: 0 000037A8 50 push ax 0 000037A9 FF7604 push word ptr [bp+4] 0 000037AC E814FD call _init_do_printf 670 _.LVL121: 227:prf.c **** 671 .loc 1 227 0 0 000037AF 31C0 xor ax, ax 0 000037B1 89EC mov sp, bp 0 000037B3 5D pop bp 0 000037B4 C3 ret 676 _.LFE7: 677 .size _init_printf, .-_init_printf 678 .local _init_charp 679 .comm _init_charp,2,2 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: irqstack.lst 1 ; File: 2 ; irqstack.asm 3 ; Description: 4 ; Assembly support routines for hardware stack support 5 ; 6 ; Copyright (c) 1997, 1998 7 ; Svante Frey 8 ; All Rights Reserved 9 ; 10 ; This file is part of DOS-C. 11 ; 12 ; DOS-C is free software; you can redistribute it and/or 13 ; modify it under the terms of the GNU General Public License 14 ; as published by the Free Software Foundation; either version 15 ; 2, or (at your option) any later version. 16 ; 17 ; DOS-C is distributed in the hope that it will be useful, but 18 ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 ; the GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public 23 ; License along with DOS-C; see the file COPYING. If not, 24 ; write to the Free Software Foundation, 675 Mass Ave, 25 ; Cambridge, MA 02139, USA. 26 ; 27 ; $Id: irqstack.asm 1567 2011-04-09 02:03:20Z bartoldeman $ 28 ; 29 30 31 ; Code for stack switching during hardware interrupts. 32 33 ; Format of interrupt sharing protocol interrupt handler entry point: 34 ; Offset Size Description (Table 02568) 35 ; 00h 2 BYTEs short jump to actual start of interrupt handler, immediately 36 ; following this data block (EBh 10h) 37 ; 02h DWORD address of next handler in chain 38 ; 06h WORD signature 424Bh 39 ; 08h BYTE EOI flag 40 ; 00h software interrupt or secondary hardware interrupt handler 41 ; 80h primary hardware interrupt handler (will issue EOI to 42 ; interrupt controller) 43 ; 09h 2 BYTEs short jump to hardware reset routine 44 ; must point at a valid FAR procedure (may be just RETF) 45 ; 0Bh 7 BYTEs reserved (0) by IBM for future expansion 46 47 ; Ralf Brown documents that irq 2, 3, 4, 5, 6, 10, 11, 12, 14, 15 use the above 48 ; protocol.. 49 ; MS (http://support.microsoft.com/kb/84300/) 50 ; documents that STACKS= implements stacks for interrupt vectors 51 ; 02H, 08-0EH, 70H, and 72-77H. 52 ; that means that we need to redirect NMI (INT 2), irq 0, 1, 8, 13 without sharing 53 ; irq 9 (==irq2) and irq 7 (printer) are not handled at all 54 55 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 56 === Switch to base=000100h -> "_IRQTEXT" 57 segment _IRQTEXT 58 0 00000000 0000 stack_size dw 0 0 00000002 0000 stack_top dw 0 0 00000004 0000 stack_offs dw 0 0 00000006 0000 stack_seg dw 0 63 64 %macro irq 0 65 call general_irq_service 66 dd 0 67 %endmacro 68 69 %macro irqshare 1 70 jmp short %%1 71 dd 0 72 dw 424bh 73 db 0 74 jmp short retf%1 75 times 7 db 0 76 %%1: call general_irq_service_share 77 %endmacro 78 79 nmi: irq 79 <1> nmi: 0 00000008 E8[0000] call general_irq_service 0 0000000B 00000000 dd 0 80 irq_0: irq 80 <1> irq_0: 0 0000000F E8[0000] call general_irq_service 0 00000012 00000000 dd 0 81 irq_1: irq 81 <1> irq_1: 0 00000016 E8[0000] call general_irq_service 0 00000019 00000000 dd 0 82 irq_08: irq 82 <1> irq_08: 0 0000001D E8[0000] call general_irq_service 0 00000020 00000000 dd 0 83 irq_0d: irq 83 <1> irq_0d: 0 00000024 E8[0000] call general_irq_service 0 00000027 00000000 dd 0 84 0 0000002B CB retf1: retf 86 irq_2: irqshare 1 86 <1> irq_2: 0 0000002C EB10 jmp short %%1 0 0000002E 00000000 dd 0 0 00000032 4B42 dw 424bh 0 00000034 00 db 0 0 00000035 EBF4 jmp short retf%1 0 00000037 00 times 7 db 0 0 0000003E E8[0900] %%1: call general_irq_service_share 87 irq_3: irqshare 1 87 <1> irq_3: 0 00000041 EB10 jmp short %%1 0 00000043 00000000 dd 0 0 00000047 4B42 dw 424bh 0 00000049 00 db 0 0 0000004A EBDF jmp short retf%1 0 0000004C 00 times 7 db 0 0 00000053 E8[0900] %%1: call general_irq_service_share 88 irq_4: irqshare 1 88 <1> irq_4: 0 00000056 EB10 jmp short %%1 0 00000058 00000000 dd 0 0 0000005C 4B42 dw 424bh 0 0000005E 00 db 0 0 0000005F EBCA jmp short retf%1 0 00000061 00 times 7 db 0 0 00000068 E8[0900] %%1: call general_irq_service_share 89 irq_5: irqshare 1 89 <1> irq_5: 0 0000006B EB10 jmp short %%1 0 0000006D 00000000 dd 0 0 00000071 4B42 dw 424bh 0 00000073 00 db 0 0 00000074 EBB5 jmp short retf%1 0 00000076 00 times 7 db 0 0 0000007D E8[0900] %%1: call general_irq_service_share 90 irq_6: irqshare 1 90 <1> irq_6: 0 00000080 EB10 jmp short %%1 0 00000082 00000000 dd 0 0 00000086 4B42 dw 424bh 0 00000088 00 db 0 0 00000089 EBA0 jmp short retf%1 0 0000008B 00 times 7 db 0 0 00000092 E8[0900] %%1: call general_irq_service_share 91 irq_0a: irqshare 2 91 <1> irq_0a: 0 00000095 EB10 jmp short %%1 0 00000097 00000000 dd 0 0 0000009B 4B42 dw 424bh 0 0000009D 00 db 0 0 0000009E EB5E jmp short retf%1 0 000000A0 00 times 7 db 0 0 000000A7 E8[0900] %%1: call general_irq_service_share 92 irq_0b: irqshare 2 92 <1> irq_0b: 0 000000AA EB10 jmp short %%1 0 000000AC 00000000 dd 0 0 000000B0 4B42 dw 424bh 0 000000B2 00 db 0 0 000000B3 EB49 jmp short retf%1 0 000000B5 00 times 7 db 0 0 000000BC E8[0900] %%1: call general_irq_service_share 93 irq_0c: irqshare 2 93 <1> irq_0c: 0 000000BF EB10 jmp short %%1 0 000000C1 00000000 dd 0 0 000000C5 4B42 dw 424bh 0 000000C7 00 db 0 0 000000C8 EB34 jmp short retf%1 0 000000CA 00 times 7 db 0 0 000000D1 E8[0900] %%1: call general_irq_service_share 94 irq_0e: irqshare 2 94 <1> irq_0e: 0 000000D4 EB10 jmp short %%1 0 000000D6 00000000 dd 0 0 000000DA 4B42 dw 424bh 0 000000DC 00 db 0 0 000000DD EB1F jmp short retf%1 0 000000DF 00 times 7 db 0 0 000000E6 E8[0900] %%1: call general_irq_service_share 95 irq_0f: irqshare 2 95 <1> irq_0f: 0 000000E9 EB10 jmp short %%1 0 000000EB 00000000 dd 0 0 000000EF 4B42 dw 424bh 0 000000F1 00 db 0 0 000000F2 EB0A jmp short retf%1 0 000000F4 00 times 7 db 0 0 000000FB E8[0900] %%1: call general_irq_service_share 0 000000FE CB retf2: retf 97 98 ; align to 100h to align _LOWTEXT for interrupt vectors 99 ; in kernel.asm 0 000000FF 00 times (100h - ($ - stack_size)) db 0 101 === Switch to base=000100h -> "_IO_TEXT" 102 segment _IO_TEXT 103 104 general_irq_service: 0 000004F6 53 push bx 0 000004F7 89E3 mov bx, sp 0 000004F9 368B5F02 mov bx, [ss:bx+2] ; return address->old ivec 0 000004FD EB0A jmp short common_irq 109 110 general_irq_service_share: 0 000004FF 53 push bx 0 00000500 89E3 mov bx, sp 0 00000502 368B5F02 mov bx, [ss:bx+2] ; return address->old ivec 0 00000506 83EB13 sub bx, byte irq_3 - irq_2 - 2 115 common_irq: 0 00000509 52 push dx 0 0000050A 50 push ax 0 0000050B 1E push ds 119 0 0000050C 8CC8 mov ax, cs 0 0000050E 8ED8 mov ds, ax 122 0 00000510 A1[0200] mov ax, [stack_top] 0 00000513 3B06[0400] cmp ax, [stack_offs] 0 00000517 762B jbe dont_switch 126 0 00000519 8CD2 mov dx, ss 0 0000051B 89E0 mov ax, sp 129 0 0000051D 8E16[0600] mov ss, [stack_seg] 0 00000521 8B26[0200] mov sp, [stack_top] 132 0 00000525 52 push dx ; save old SS:SP on new stack 0 00000526 50 push ax 135 0 00000527 A1[0000] mov ax, [stack_size] 0 0000052A 2906[0200] sub [stack_top], ax 138 0 0000052E 9C pushf 0 0000052F FF1F call far word [bx] 141 0 00000531 FA cli 0 00000532 0106[0200] add [stack_top], ax 144 0 00000536 58 pop ax ; get stored SS:SP 0 00000537 5A pop dx 147 0 00000538 8ED2 mov ss, dx ; switch back to old stack 0 0000053A 89C4 mov sp, ax 150 0 0000053C 1F return: pop ds ; restore registers and return 0 0000053D 58 pop ax 0 0000053E 5A pop dx 0 0000053F 5B pop bx 0 00000540 83C402 add sp, byte 2 0 00000543 CF iret 157 0 00000544 9C dont_switch: pushf 0 00000545 FF1F call far word [bx] 0 00000547 EBF3 jmp short return 161 162 === Switch to base=00E150h -> "INIT_TEXT" 163 segment INIT_TEXT 164 165 global _init_stacks 166 ; VOID init_stacks(VOID FAR *stack_base, COUNT nStacks, WORD stackSize); 167 0 000002D9 0208097075 int_numbers: db 2,8,9,70h,75h 0 000002DE 0A0B0C0D0E72737476 int_numbers_share: db 0ah,0bh,0ch,0dh,0eh,72h,73h,74h,76h,77h 0 000002E7 77 170 171 _init_stacks: 0 000002E8 55 push bp 0 000002E9 89E5 mov bp, sp 0 000002EB 1E push ds 0 000002EC 57 push di 0 000002ED 56 push si 177 178 0 000002EE B8[0000] mov ax,LGROUP 0 000002F1 8ED8 mov ds,ax 0 000002F3 8EC0 mov es,ax 182 0 000002F5 8B5E04 mov bx, [bp+4] 0 000002F8 8B5606 mov dx, [bp+6] 0 000002FB 8B4608 mov ax, [bp+8] 0 000002FE 8B4E0A mov cx, [bp+0ah] 187 0 00000301 890E[0000] mov [stack_size], cx 0 00000305 891E[0400] mov [stack_offs], bx 0 00000309 8916[0600] mov [stack_seg], dx 191 0 0000030D F7E1 mul cx 0 0000030F 01D8 add ax, bx 194 ; stack_top = stack_size * nStacks + stack_seg:stack_offs 0 00000311 A3[0200] mov [stack_top], ax 196 0 00000314 31C0 xor ax, ax 0 00000316 8ED8 mov ds, ax 199 0 00000318 BF[0B00] mov di, nmi + 3 0 0000031B BA[0800] mov dx, nmi 0 0000031E BB[0000] mov bx, int_numbers 0 00000321 B90500 mov cx, int_numbers_share - int_numbers 0 00000324 BD0700 mov bp, irq_1 - irq_0 0 00000327 E80F00 call set_vect 206 0 0000032A 42 inc dx ; skip over retf (not di: go from nmi+3 to irq_2+2) 0 0000032B B90A00 mov cx, _init_stacks - int_numbers_share 0 0000032E BD1500 mov bp, irq_3 - irq_2 0 00000331 E80500 call set_vect 211 0 00000334 5E pop si 0 00000335 5F pop di 0 00000336 1F pop ds 0 00000337 5D pop bp 0 00000338 C3 ret 217 218 ; set interrupt vectors: 219 ; in: es=LGROUP, ds=0 220 ; bx: pointer to int_numbers bytes in cs 221 ; cx: number of vectors to set 222 ; dx: pointer to es:nmi and so on (new interrupt vectors) 223 ; di: pointer to es:nmi+3 and so on (pointer to place of old interrupt vectors) 224 ; bp: difference in offset between irq structures 225 ; out: bx, si, di updated, cx=0, ax destroyed 226 set_vect: 0 00000339 2E8A07 mov al, [cs:bx] ; get next int vector offset 0 0000033C 43 inc bx 0 0000033D 98 cbw 0 0000033E 89C6 mov si, ax 0 00000340 D1E6 shl si, 1 0 00000342 D1E6 shl si, 1 ; now ds:si -> int vector, es:di -> nmi+3, etc 233 0 00000344 A5 movsw ; save old vector 0 00000345 A5 movsw 236 0 00000346 FA cli 0 00000347 8954FC mov [si-4], dx ; set new vector 0 0000034A 8C44FE mov [si-2], es 0 0000034D FB sti 241 0 0000034E 01EA add dx, bp 0 00000350 8D7BFC lea di, [di+bp-4] ; update di, compensating for movsw 0 00000353 E2E4 loop set_vect 245 0 00000355 C3 ret === Trace listing source: kernel.lst 1 ; 2 ; File: 3 ; kernel.asm 4 ; Description: 5 ; kernel start-up code 6 ; 7 ; Copyright (c) 1995, 1996 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Id: kernel.asm 1705 2012-02-07 08:10:33Z perditionc $ 29 ; 30 31 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 32 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 33 %include "ludivmul.inc" 1 <1> ; this one adapted from elks, http://elks.sourceforge.net 2 <1> ; multiply cx:bx * dx:ax, result in dx:ax 3 <1> 4 <1> %macro LMULU 0 5 <1> 6 <1> push si 7 <1> push cx 8 <1> mov si, ax ; save _ax in si 9 <1> mov ax, bx ; cx:ax = _cx:_bx 10 <1> mul dx ; dx:ax = _bx*_dx (forget dx) 11 <1> xchg cx, ax ; cx = low(_dx*_bx) 12 <1> mul si ; dx:ax = _cx*_ax (forget dx) 13 <1> add cx, ax ; cx = low(_cx*_ax + _dx*_bx) 14 <1> mov ax, si ; restore _ax 15 <1> mul bx ; dx:ax = _bx*_ax 16 <1> add dx, cx ; dx = high(_bx*_ax)+low(_cx*_ax + _dx*_bx) 17 <1> pop cx 18 <1> pop si 19 <1> ret 20 <1> 21 <1> %endmacro 22 <1> 23 <1> ; divide dx:ax / cx:bx, quotient in dx:ax, remainder in cx:bx 24 <1> 25 <1> %macro LDIVMODU 0 26 <1> ; this one is adapted from an assembly gem: 27 <1> ; gem writer: Norbert Juffa, norbert.juffa@amd.com 28 <1> 29 <1> ; Dividing 64-bit unsigned integers Assembler / 80386 30 <1> 31 <1> ; Here is a division routine for dividing two 64-bit unsigned integers. 32 <1> ; I derived it by modifying some old 33 <1> ; 16-bit code for dividing 32-bit integers that I did several years ago for a 34 <1> ; Turbo-Pascal replacement library. 35 <1> ; If a 64-bit signed integer division is needed, appropriate shell code for 36 <1> ; this routine can easily be written. 37 <1> ; 38 <1> ; (adapted back to 32-bit by Bart Oldeman ;-)) 39 <1> ; 40 <1> ; __U4D divides two unsigned long numbers, the dividend and the divisor 41 <1> ; resulting in a quotient and a remainder. 42 <1> ; 43 <1> ; input: 44 <1> ; dx:ax = dividend 45 <1> ; cx:bx = divisor 46 <1> ; 47 <1> ; output: 48 <1> ; dx:ax = quotient of division of dividend by divisor 49 <1> ; cx:bx = remainder of division of dividend by divisor 50 <1> ; 51 <1> ; destroys: 52 <1> ; flags 53 <1> ; 54 <1> %ifdef STDCALL 55 <1> push bp 56 <1> mov bp, sp 57 <1> mov ax, [bp+6] 58 <1> mov dx, [bp+8] 59 <1> mov bx, [bp+10] 60 <1> mov cx, [bp+12] 61 <1> pop bp 62 <1> %endif 63 <1> 64 <1> test cx, cx ; divisor > 2^16-1 ? 65 <1> jnz %%big_divisor ; yes, divisor > 2^16-1 66 <1> cmp dx, bx ; only one division needed ? (cx = 0) 67 <1> jb %%one_div ; yes, one division sufficient 68 <1> 69 <1> 70 <1> xchg cx, ax ; save dividend-lo in cx, ax=0 71 <1> xchg ax, dx ; get dividend-hi in ax, dx=0 72 <1> div bx ; quotient-hi in ax 73 <1> xchg ax, cx ; cx = quotient-hi, ax =dividend-lo 74 <1> 75 <1> %%one_div: 76 <1> div bx ; ax = quotient-lo 77 <1> mov bx, dx ; bx = remainder-lo 78 <1> mov dx, cx ; dx = quotient-hi(quotient in dx:ax) 79 <1> xor cx, cx ; cx = remainder-hi (rem. in cx:bx) 80 <1> ret 81 <1> 82 <1> %%big_divisor: 83 <1> push si ; save temp 84 <1> push di ; variables 85 <1> push dx ; save 86 <1> push ax ; dividend 87 <1> mov si, bx ; divisor now in 88 <1> mov di, cx ; di:si and cx:bx 89 <1> %%shift_loop: 90 <1> shr dx, 1 ; shift both 91 <1> rcr ax, 1 ; dividend 92 <1> shr cx, 1 ; and divisor 93 <1> rcr bx, 1 ; right by 1 bit 94 <1> jnz %%shift_loop ; loop if di non-zero (rcr does not touch ZF) 95 <1> div bx ; compute quotient dx:ax>>x / cx:bx>>x (stored in ax; remainder in dx not used) 96 <1> pop bx ; get dividend lo-word 97 <1> mov cx, ax ; save quotient 98 <1> mul di ; quotient * divisor hi-word (low only) 99 <1> pop dx ; dividend high 100 <1> sub dx,ax ; dividend high - divisor high * quotient, no overflow (carry/borrow) possible here 101 <1> push dx ; save dividend high 102 <1> mov ax, cx ; ax=quotient 103 <1> mul si ; quotient * divisor lo-word 104 <1> sub bx, ax ; dividend-lo - (quot.*divisor-lo)-lo 105 <1> mov ax, cx ; get quotient 106 <1> pop cx ; restore dividend hi-word 107 <1> sbb cx, dx ; subtract (divisor-lo * quot.)-hi from dividend-hi 108 <1> sbb dx, dx ; 0 if remainder > 0, else FFFFFFFFh 109 <1> and si, dx ; nothing to add 110 <1> and di, dx ; back if remainder positive di:si := di:si(cx:bx) & dx:dx 111 <1> add bx, si ; correct remainder cx:bx += di:si 112 <1> adc cx, di ; and 113 <1> add ax, dx ; quotient if necessary ax += dx 114 <1> xor dx, dx ; clear hi-word of quot (ax<=FFFFh) dx := 0 115 <1> pop di ; restore temp 116 <1> pop si ; variables 117 <1> ret 118 <1> 119 <1> %endmacro 120 <1> 121 <1> %macro LSHLU 0 122 <1> pop bx 123 <1> popargs {dx,ax},cx 124 <1> push bx 125 <1> jcxz %%ret 126 <1> %%loop: shl ax, 1 127 <1> rcl dx, 1 128 <1> loop %%loop 129 <1> %%ret: ret 130 <1> %endmacro 131 <1> 132 <1> %macro LSHRU 0 133 <1> pop bx 134 <1> popargs {dx,ax},cx 135 <1> push bx 136 <1> jcxz %%ret 137 <1> %%loop: shr dx, 1 138 <1> rcr ax, 1 139 <1> loop %%loop 140 <1> %%ret: ret 141 <1> %endmacro 34 35 === Switch to base=000000h -> "PSP" 36 segment PSP 37 38 extern _ReqPktPtr 39 40 STACK_SIZE equ 384/2 ; stack allocated in words 41 42 ;************************************************************ 43 ; KERNEL BEGINS HERE, i.e. this is byte 0 of KERNEL.SYS 44 ;************************************************************ 45 46 %ifidn __OUTPUT_FORMAT__, obj 47 ..start: 48 %endif 49 bootloadunit: ; (byte of short jump re-used) 50 entry: 0 00000000 EB1E jmp short realentry 52 53 ;************************************************************ 54 ; KERNEL CONFIGURATION AREA 55 ; this is copied up on the very beginning 56 ; it's a good idea to keep this in sync with KConfig.h 57 ;************************************************************ 58 global _LowKernelConfig 59 _LowKernelConfig: 60 config_signature: 0 00000002 434F4E464947 db 'CONFIG' ; constant 0 00000008 0F00 dw configend-configstart; size of config area 63 ; to be checked !!! 64 65 configstart: 66 0 0000000A 00 DLASortByDriveNo db 0 ; sort disks by drive order 0 0000000B 01 InitDiskShowDriveAssignment db 1 ; 0 0000000C 02 SkipConfigSeconds db 2 ; 0 0000000D 00 ForceLBA db 0 ; 0 0000000E 01 GlobalEnableLBAsupport db 1 ; 0 0000000F 00 BootHarddiskSeconds db 0 ; 73 74 ; The following VERSION resource must be keep in sync with VERSION.H 0 00000010 FD Version_OemID db 0xFD ; OEM_ID 0 00000011 02 Version_Major db 2 0 00000012 2B00 Version_Revision dw 43 ; REVISION_SEQ 0 00000014 0100 Version_Release dw 1 ; 0=release build, >0=svn# 79 0 00000016 00 CheckDebugger: db 0 ; 0 = no check, 1 = check, 2 = assume present 0 00000017 00 Verbose db 0 ; -1 = quiet, 0 = normal, 1 = verbose 82 0 00000018 1F PartitionMode db 0x1f ; bits 0-1: 01=GPT if found, 00=MBR if found, 11=Hybrid, GPT first then MBR, 10=Hybrid, MBR first then GPT 84 ; in hybrid mode, EE partitions ignored, drives assigned by GPT or MBR first based on hybrid type 85 ; bits 2-4: 001=mount ESP (usually FAT32) partition, 010=mount MS Basic partitions, 100=mount unknown partitions 86 ; 111=attempt to mount all paritions, 110=attempt to mount all but ESP partitions 87 ; bits 5-7: reserved, 0 else undefined behavior 88 89 configend: 90 kernel_config_size: equ configend - config_signature 91 ; must be below-or-equal the size of struct _KernelConfig 92 ; in the file kconfig.h ! 93 0 00000019 00 times (32 - 4) - ($ - $$) db 0 0 0000001C 00000000 bootloadstack: dd 0 96 97 98 ;************************************************************ 99 ; KERNEL CONFIGURATION AREA END 100 ;************************************************************ 101 102 103 ;************************************************************ 104 ; KERNEL real entry (at ~60:20) 105 ; 106 ; moves the INIT part of kernel.sys to high memory (~9000:0) 107 ; then jumps there 108 ; to aid debugging, some '123' messages are output 109 ; this area is discardable and used as temporary PSP for the 110 ; init sequence 111 ;************************************************************ 112 113 cpu 8086 ; (keep initial entry compatible) 114 115 global realentry 116 realentry: ; execution continues here 0 00000020 0E push cs 0 00000021 1F pop ds 0 00000022 31FF xor di, di 0 00000024 881D mov byte [di + bootloadunit - $$], bl 0 00000026 55 push bp 0 00000027 89651C mov word [di + bootloadstack - $$], sp 0 0000002A 8C551E mov word [di + bootloadstack + 2 - $$], ss 0 0000002D E99000 jmp entry_common 125 126 0 00000030 90 times 0C0h - ($ - $$) nop ; magic offset (used by exeflat) 128 entry_common: 129 %ifndef QUIET 0 000000C0 50 push ax 0 000000C1 53 push bx 0 000000C2 9C pushf 0 000000C3 B8310E mov ax, 0e31h ; '1' Tracecode - kernel entered 0 000000C6 BBF000 mov bx, 00f0h 0 000000C9 CD10 int 010h 0 000000CB 9D popf 0 000000CC 5B pop bx 0 000000CD 58 pop ax 139 %endif 140 0 000000CE 0E push cs 0 000000CF 1F pop ds 0 000000D0 EA[0000][0000] jmp IGROUP:kernel_start 144 0 000000D5 00 beyond_entry: times 256-(beyond_entry-entry) db 0 146 ; scratch area for data (DOS_PSP) 147 _master_env equ $ - 128 148 global _master_env 149 === Switch to base=00E150h -> "INIT_TEXT" 150 segment INIT_TEXT 151 152 %ifdef TEST_FILL_INIT_TEXT 153 %macro step 0 154 %if _LFSR & 1 155 %assign _LFSR (_LFSR >> 1) ^ 0x80200003 156 %else 157 %assign _LFSR (_LFSR >> 1) 158 %endif 159 %endmacro 160 161 align 16 162 %assign _LFSR 1 163 %rep 1024 * 8 164 dd _LFSR 165 step 166 %endrep 167 %endif 168 169 extern _FreeDOSmain 170 extern _query_cpu 171 172 ; 173 ; kernel start-up 174 ; 175 kernel_start: 0 00000000 FC cld 177 178 %ifndef QUIET 0 00000001 53 push bx 0 00000002 9C pushf 0 00000003 B8320E mov ax, 0e32h ; '2' Tracecode - kernel entered 0 00000006 BBF000 mov bx, 00f0h 0 00000009 CD10 int 010h 0 0000000B 9D popf 0 0000000C 5B pop bx 186 %endif 187 188 189 extern _kernel_command_line 190 191 ; INP: ds => entry section, with CONFIG block 192 ; and compressed entry help data 193 ; (actually always used now) 194 initialise_command_line_buffer: 0 0000000D BA[0000] mov dx, I_GROUP 0 00000010 8EC2 mov es, dx 197 0 00000012 8A1E[0000] mov bl, [bootloadunit] 0 00000016 C536[1C00] lds si, [bootloadstack] ; -> original ss:sp - 2 0 0000001A 8D4402 lea ax, [si + 2] ; ax = original sp 0 0000001D 8B34 mov si, word [si] ; si = original bp 202 203 ; Note that the kernel command line buffer in 204 ; the init data segment is pre-initialised to 205 ; hold 0x00 0xFF in the first two bytes. This 206 ; is used to indicate no command line present, 207 ; as opposed to an empty command line which 208 ; will hold 0x00 0x00. 209 ; If any of the branches to .none are taken then 210 ; the buffer is not modified so it retains the 211 ; 0x00 0xFF contents. 0 0000001F 81FE1401 cmp si, 114h ; buffer fits below ss:bp ? 0 00000023 7222 jb .none ; no --> 0 00000025 817CEC434C cmp word [si - 14h], "CL" ; signature passed to us ? 0 0000002A 751B jne .none ; no --> 0 0000002C 8DB4ECFE lea si, [si - 114h] ; -> command line buffer 0 00000030 39F0 cmp ax, si ; stack top starts below-or-equal buffer ? 0 00000032 7713 ja .none ; no --> 0 00000034 BF[0000] mov di, _kernel_command_line ; our buffer 0 00000037 B9FF00 mov cx, 255 0 0000003A 31C0 xor ax, ax 0 0000003C 57 push di 0 0000003D F3A4 rep movsb ; copy up to 255 bytes 0 0000003F AA stosb ; truncate 0 00000040 5F pop di 0 00000041 B501 mov ch, 1 ; cx = 256 0 00000043 F2AE repne scasb ; scan for terminator 0 00000045 F3AA rep stosb ; clear remainder of buffer 229 ; (make sure we do not have 0x00 0xFF 230 ; even if the command line given is 231 ; actually the empty string) 232 .none: 233 0 00000047 FA cli 0 00000048 8ED2 mov ss, dx 0 0000004A BC[0004] mov sp, init_tos 0 0000004D CD12 int 12h ; move init text+data to higher memory 0 0000004F B106 mov cl,6 0 00000051 D3E0 shl ax,cl ; convert kb to para 0 00000053 BA[0F00] mov dx,15 + INITSIZE 0 00000056 B104 mov cl,4 0 00000058 D3EA shr dx,cl 0 0000005A 29D0 sub ax,dx 0 0000005C 8EC0 mov es,ax 0 0000005E BA[0000] mov dx,INITTEXTSIZE ; para aligned 0 00000061 D3EA shr dx,cl 0 00000063 01D0 add ax,dx 0 00000065 8ED0 mov ss,ax ; set SS to init data segment 0 00000067 FB sti ; now enable them 0 00000068 8CC8 mov ax,cs 0 0000006A BA[0000] mov dx,__HMATextEnd ; para aligned 0 0000006D D3EA shr dx,cl 253 %ifdef WATCOM 254 add ax,dx 255 %endif 0 0000006F 8ED8 mov ds,ax 0 00000071 BE[FEFF] mov si,-2 + INITSIZE; word aligned 0 00000074 8D4C02 lea cx,[si+2] 0 00000077 89F7 mov di,si 0 00000079 D1E9 shr cx,1 0 0000007B FD std ; if there's overlap only std is safe 0 0000007C F3A5 rep movsw 263 264 ; move HMA_TEXT to higher memory 0 0000007E 29D0 sub ax,dx 0 00000080 8ED8 mov ds,ax ; ds = HMA_TEXT 0 00000082 8CC0 mov ax,es 0 00000084 29D0 sub ax,dx 0 00000086 8EC0 mov es,ax ; es = new HMA_TEXT 270 0 00000088 BE[FEFF] mov si,-2 + __HMATextEnd 0 0000008B 8D4C02 lea cx,[si+2] 0 0000008E 89F7 mov di,si 0 00000090 D1E9 shr cx,1 0 00000092 F3A5 rep movsw 276 0 00000094 FC cld 278 %ifndef WATCOM ; for WATCOM: CS equal for HMA and INIT 0 00000095 01D0 add ax,dx 0 00000097 8EC0 mov es,ax ; otherwise CS -> init_text 281 %endif 0 00000099 06 push es 0 0000009A B8[9F00] mov ax,cont 0 0000009D 50 push ax 0 0000009E CB retf 286 cont: ; Now set up call frame 0 0000009F 2E8E1E[E900] mov ds,[cs:_INIT_DGROUP] 0 000000A4 89E5 mov bp,sp ; and set up stack frame for c 289 290 %ifndef QUIET 0 000000A6 53 push bx 0 000000A7 9C pushf 0 000000A8 B8330E mov ax, 0e33h ; '3' Tracecode - kernel entered 0 000000AB BBF000 mov bx, 00f0h 0 000000AE CD10 int 010h 0 000000B0 9D popf 0 000000B1 5B pop bx 298 %endif 299 0 000000B2 881E[6900] mov byte [_BootDrive],bl ; tell where we came from 301 302 ;!! int 11h 303 ;!! mov cl,6 304 ;!! shr al,cl 305 ;!! inc al 306 ;!! mov byte [_NumFloppies],al ; and how many 307 0 000000B6 E8[0000] call _query_cpu 309 %if XCPU != 86 310 %if XCPU < 186 || (XCPU % 100) != 86 || (XCPU / 100) > 9 311 %fatal Unknown CPU level defined 312 %endif 313 cmp al, (XCPU / 100) 314 jb cpu_abort ; if CPU not supported --> 315 316 cpu XCPU 317 %endif 0 000000B9 A2[6A00] mov [_CPULevel], al 319 320 initialise_kernel_config: 321 extern _InitKernelConfig 322 0 000000BC 8CD0 mov ax, ss ; => init data segment 0 000000BE BE6000 mov si, 60h 0 000000C1 8EDE mov ds, si ; => entry section 0 000000C3 BE[0200] mov si, _LowKernelConfig ; -> our CONFIG block 0 000000C6 8EC0 mov es, ax ; => init data segment 0 000000C8 BF[0000] mov di, _InitKernelConfig ; -> init's CONFIG block buffer 0 000000CB B90B00 mov cx, kernel_config_size / 2 ; size that we support 0 000000CE F3A5 rep movsw ; copy it over 331 %if kernel_config_size & 1 0 000000D0 A4 movsb ; allow odd size 333 %endif 0 000000D1 8ED8 mov ds, ax ; => init data segment 335 336 check_debugger_present: 337 extern _debugger_present 338 0 000000D3 B001 mov al, 1 ; assume debugger present 0 000000D5 807DFD01 cmp byte [di - kernel_config_size + (CheckDebugger - config_signature)], 1 0 000000D9 7708 ja .skip_ints_00_06 ; 2 means assume present 0 000000DB 7204 jb .absent ; 0 means assume absent 0 000000DD F8 clc ; 1 means check 0 000000DE CC int3 ; break to debugger 0 000000DF 7202 jc .skip_ints_00_06 346 ; The debugger should set CY here to indicate its 347 ; presence. The flag set is checked later to skip 348 ; overwriting the interrupt vectors 00h, 01h, 03h, 349 ; and 06h. This logic is taken from lDOS init. 350 .absent: 0 000000E1 31C0 xor ax, ax ; no debugger present 352 .skip_ints_00_06: 0 000000E3 A2[0000] mov byte [_debugger_present], al 354 0 000000E6 E9[0000] jmp _FreeDOSmain 356 357 %if XCPU != 86 358 cpu 8086 359 360 cpu_abort: 361 mov ah, 0Fh 362 int 10h ; get video mode, bh = active page 363 364 call .first ; print string that follows (address pushed by call) 365 366 %define LOADNAME "FreeDOS" 367 db 13,10 ; (to emit a blank line after the tracecodes) 368 db 13,10 369 db LOADNAME, " load error: An 80", '0'+(XCPU / 100) 370 db "86 processor or higher is required by this build.",13,10 371 db "To use ", LOADNAME, " on this processor please" 372 db " obtain a compatible build.",13,10 373 db 13,10 374 db "Press any key to reboot.",13,10 375 db 0 376 377 .display: 378 mov ah, 0Eh 379 mov bl, 07h ; page in bh, bl = colour for some modes 380 int 10h ; write character (may change bp!) 381 382 db 0A8h ; [test al,imm8] skip "pop si" [=imm8] after the first iteration 383 .first: 384 pop si ; (first iteration only) get message address from stack 385 cs lodsb ; get character 386 test al, al ; zero ? 387 jnz .display ; no, display and get next character --> 388 389 xor ax, ax 390 xor dx, dx 391 int 13h ; reset floppy disks 392 xor ax, ax 393 mov dl, 80h 394 int 13h ; reset hard disks 395 396 ; this "test ax, imm16" opcode is used to 397 db 0A9h ; skip "sti" \ "hlt" [=imm16] during first iteration 398 .wait: 399 sti 400 hlt ; idle while waiting for keystroke 401 mov ah, 01h 402 int 16h ; get keystroke 403 jz .wait ; none available, loop --> 404 405 mov ah, 00h 406 int 16h ; remove keystroke from buffer 407 408 int 19h ; reboot 409 jmp short $ ; (in case it returns, which it shouldn't) 410 411 cpu XCPU 412 %endif ; XCPU != 86 413 414 === Switch to base=00E150h -> "INIT_TEXT_END" 415 segment INIT_TEXT_END 416 417 418 ;************************************************************ 419 ; KERNEL CODE AREA END 420 ; the NUL device 421 ;************************************************************ 422 === Switch to base=000790h -> "CONST" 423 segment CONST 424 425 ; 426 ; NUL device strategy 427 ; 428 global _nul_strtgy 429 extern GenStrategy 430 _nul_strtgy: 0 000012B2 EA[0000][0000] jmp LGROUP:GenStrategy 432 433 ; 434 ; NUL device interrupt 435 ; 436 global _nul_intr 437 _nul_intr: 0 000012B7 06 push es 0 000012B8 53 push bx 0 000012B9 BB[0000] mov bx,LGROUP 0 000012BC 8EC3 mov es,bx 0 000012BE 26C41E[0000] les bx,[es:_ReqPktPtr] ;es:bx--> rqheadr 0 000012C3 26807F0204 cmp byte [es:bx+2],4 ;if read, set 0 read 0 000012C8 7506 jne no_nul_read 0 000012CA 26C747120000 mov word [es:bx+12h],0 446 no_nul_read: 0 000012D0 26814F030001 or word [es:bx+3],100h ;set "done" flag 0 000012D6 5B pop bx 0 000012D7 07 pop es 0 000012D8 CB retf 451 === Switch to base=000100h -> "_LOWTEXT" 452 segment _LOWTEXT 453 454 ; low interrupt vectors 10h,13h,15h,19h,1Bh 455 ; these need to be at 0070:0100 (see RBIL memory.lst) 456 global _intvec_table 0 00000100 10 _intvec_table: db 10h 0 00000101 00000000 dd 0 459 ; used by int13 handler and get/set via int 2f/13h 460 global _BIOSInt13 ; BIOS provided disk handler 461 global _UserInt13 ; actual disk handler used by kernel 0 00000105 13 db 13h 0 00000106 00000000 _BIOSInt13: dd 0 0 0000010A 15 db 15h 0 0000010B 00000000 dd 0 466 ; used for cleanup on reboot 467 global _BIOSInt19 0 0000010F 19 db 19h 0 00000110 00000000 _BIOSInt19: dd 0 0 00000114 1B db 1Bh 0 00000115 00000000 dd 0 472 ; default to using BIOS provided disk handler 0 00000119 13 db 13h 0 0000011A 00000000 _UserInt13: dd 0 475 476 ; floppy parameter table 477 global _int1e_table 0 0000011E 00 _int1e_table: times 0eh db 0 479 480 ;************************************************************ 481 ; KERNEL FIXED DATA AREA 482 ;************************************************************ 483 484 === Switch to base=000790h -> "_FIXED_DATA" 485 segment _FIXED_DATA 486 487 ; Because of the following bytes of data, THIS MODULE MUST BE THE FIRST 488 ; IN THE LINK SEQUENCE. THE BYTE AT DS:0004 determines the SDA format in 489 ; use. A 0 indicates MS-DOS 3.X style, a 1 indicates MS-DOS 4.0-6.X style. 490 global DATASTART 491 DATASTART: 492 global _DATASTART 493 _DATASTART: 0 00000000 00 dos_data db 0 0 00000001 [0000] dw kernel_start 0 00000003 00 db 0 ; padding 0 00000004 0100 dw 1 ; Hardcoded MS-DOS 4.0+ style 498 0 00000006 00 times (0eh - ($ - DATASTART)) db 0 500 global _NetBios 0 0000000E 0000 _NetBios dw 0 ; NetBios Number 502 0 00000010 00 times (26h - 0ch - ($ - DATASTART)) db 0 504 505 ; Globally referenced variables - WARNING: DO NOT CHANGE ORDER 506 ; BECAUSE THEY ARE DOCUMENTED AS UNDOCUMENTED (?) AND HAVE 507 ; MANY MULTIPLEX PROGRAMS AND TSRs ACCESSING THEM 508 global _NetRetry 0 0000001A 0300 _NetRetry dw 3 ;-000c network retry count 510 global _NetDelay 0 0000001C 0100 _NetDelay dw 1 ;-000a network delay count 512 global _DskBuffer 0 0000001E FFFFFFFF _DskBuffer dd -1 ;-0008 current dos disk buffer 514 global _inputptr 0 00000022 0000 _inputptr dw 0 ;-0004 Unread con input 516 global _first_mcb 0 00000024 0000 _first_mcb dw 0 ;-0002 Start of user memory 518 global _DPBp 519 global MARK0026H 520 ; A reference seems to indicate that this should start at offset 26h. 521 MARK0026H equ $ 0 00000026 FFFFFFFF _DPBp dd -1 ; 0000 First drive Parameter Block 523 global _sfthead 0 0000002A 00000000 _sfthead dd 0 ; 0004 System File Table head 525 global _clock 0 0000002E 00000000 _clock dd 0 ; 0008 CLOCK$ device 527 global _syscon 0 00000032 [0000][0000] _syscon dw _con_dev,LGROUP ; 000c console device 529 global _maxsecsize 0 00000036 0002 _maxsecsize dw 512 ; 0010 maximum bytes/sector of any block device 0 00000038 00000000 dd 0 ; 0012 pointer to buffers info structure 532 global _CDSp 0 0000003C 00000000 _CDSp dd 0 ; 0016 Current Directory Structure 534 global _FCBp 0 00000040 00000000 _FCBp dd 0 ; 001a FCB table pointer 536 global _nprotfcb 0 00000044 0000 _nprotfcb dw 0 ; 001e number of protected fcbs 538 global _nblkdev 0 00000046 00 _nblkdev db 0 ; 0020 number of block devices 540 global _lastdrive 0 00000047 00 _lastdrive db 0 ; 0021 value of last drive 542 global _nul_dev 543 _nul_dev: ; 0022 device chain root 544 extern _con_dev 0 00000048 [0000][0000] dw _con_dev, LGROUP 546 ; next is con_dev at init time. 0 0000004C 0480 dw 8004h ; attributes = char device, NUL bit set 0 0000004E [0000] dw _nul_strtgy 0 00000050 [0500] dw _nul_intr 0 00000052 4E554C2020202020 db 'NUL ' 551 global _njoined 0 0000005A 00 _njoined db 0 ; 0034 number of joined devices 0 0000005B 0000 dw 0 ; 0035 DOS 4 near pointer to special names (always zero in DOS 5) [setver precursor] 554 global _setverPtr 0 0000005D 00000000 _setverPtr dw 0,0 ; 0037 setver list (far pointer, set by setver driver) 0 00000061 0000 dw 0 ; 003B cs offset for fix a20 0 00000063 0000 dw 0 ; 003D psp of last umb exec 558 global _LoL_nbuffers 0 00000065 0100 _LoL_nbuffers dw 1 ; 003F number of buffers 0 00000067 0100 dw 1 ; 0041 size of pre-read buffer 561 global _BootDrive 0 00000069 01 _BootDrive db 1 ; 0043 drive we booted from 563 564 global _CPULevel 0 0000006A 00 _CPULevel db 0 ; 0044 cpu type (MSDOS >0 indicates dword moves ok, ie 386+) 566 ; unless compatibility issues arise FD uses 567 ; 0=808x, 1=18x, 2=286, 3=386+ 568 ; see cpu.asm, use >= as may add checks for 486 ... 569 0 0000006B 0000 dw 0 ; 0045 Extended memory in KBytes 571 buf_info: 572 global _firstbuf 0 0000006D 00000000 _firstbuf dd 0 ; 0047 disk buffer chain 0 00000071 0000 dw 0 ; 004B Number of dirty buffers 0 00000073 00000000 dd 0 ; 004D pre-read buffer 0 00000077 0000 dw 0 ; 0051 number of look-ahead buffers 577 global _bufloc 0 00000079 00 _bufloc db 0 ; 0053 00=conv 01=HMA 579 global _deblock_buf 0 0000007A 00000000 _deblock_buf dd 0 ; 0054 deblock buffer 0 0000007E 00 times 3 db 0 ; 0058 unknown 0 00000081 0000 dw 0 ; 005B unknown 0 00000083 00FF00 db 0, 0FFh, 0 ; 005D unknown 584 global _VgaSet 0 00000086 00 _VgaSet db 0 ; 0060 unknown 0 00000087 0000 dw 0 ; 0061 unknown 587 global _uppermem_link 0 00000089 00 _uppermem_link db 0 ; 0063 upper memory link flag 0 0000008A 0000 _min_pars dw 0 ; 0064 minimum paragraphs of memory 590 ; required by program being EXECed 591 global _uppermem_root 0 0000008C FFFF _uppermem_root dw 0ffffh ; 0066 dmd_upper_root (usually 9fff) 0 0000008E 0000 _last_para dw 0 ; 0068 para of last mem search 594 SysVarEnd: 595 596 ;; FreeDOS specific entries 597 ;; all variables below this point are subject to relocation. 598 ;; programs should not rely on any values below this point!!! 599 600 global _os_setver_minor 0 00000090 00 _os_setver_minor db 0 602 global _os_setver_major 0 00000091 05 _os_setver_major db 5 604 global _os_minor 0 00000092 00 _os_minor db 0 606 global _os_major 0 00000093 05 _os_major db 5 0 00000094 00 _rev_number db 0 609 global _version_flags 0 00000095 00 _version_flags db 0 611 612 global os_release 613 extern _os_release 0 00000096 [0000] os_release dw _os_release 615 616 %IFDEF WIN31SUPPORT 617 global _winStartupInfo, _winInstanced 618 _winInstanced dw 0 ; set to 1 on WinInit broadcast, 0 on WinExit broadcast 619 _winStartupInfo: 620 dw 0 ; structure version (same as windows version) 621 dd 0 ; next startup info structure, 0:0h marks end 622 dd 0 ; far pointer to name virtual device file or 0:0h 623 dd 0 ; far pointer, reference data for virtual device driver 624 %ifnidni __OUTPUT_FORMAT__, elf 625 dw instance_table,seg instance_table ; array of instance data 626 %else 627 dw instance_table ; array of instance data 628 global _winseg1 629 _winseg1: dw 0 630 %endif 631 instance_table: ; should include stacks, Win may auto determine SDA region 632 ; we simply include whole DOS data segment 633 %ifnidni __OUTPUT_FORMAT__, elf 634 dw seg _DATASTART, 0 ; [SEG:OFF] address of region's base 635 dw _markEndInstanceData wrt seg _DATASTART ; size in bytes 636 %else 637 global _winseg2 638 _winseg2: dw 0 639 dw 0 ; [SEG:OFF] address of region's base 640 global _winseg3 641 _winseg3: dw 0 ; size in bytes 642 %endif 643 dd 0 ; 0 marks end of table 644 dw 0 ; and 0 length for end of instance_table entry 645 global _winPatchTable 646 _winPatchTable: ; returns offsets to various internal variables 647 dw 0x0006 ; DOS version, major# in low byte, eg. 6.00 648 dw save_DS ; where DS stored during int21h dispatch 649 dw save_BX ; where BX stored during int21h dispatch 650 dw _InDOS ; offset of InDOS flag 651 dw _MachineId ; offset to variable containing MachineID 652 dw _CritPatch ; offset of to array of offsets to patch 653 ; NOTE: this points to a null terminated 654 ; array of offsets of critical section bytes 655 ; to patch, for now we can just point this 656 ; to an empty table 657 ; ie we just point to a 0 word to mark end 658 dw _uppermem_root ; seg of last arena header in conv memory 659 ; this matches MS DOS's location, but 660 ; do we have the same meaning? 661 %ENDIF ; WIN31SUPPORT 662 663 ;; The first 5 sft entries appear to have to be at DS:00cc 0 00000098 00 times (0cch - ($ - DATASTART)) db 0 665 global _firstsftt 666 _firstsftt: 0 000000CC FFFFFFFF dd -1 ; link to next 0 000000D0 0500 dw 5 ; count 0 000000D2 00 times 5*59 db 0 ; reserve space for the 5 sft entries 0 000001F9 00 db 0 ; pad byte so next value on even boundary 671 672 ; Some references seem to indicate that this data should start at 01fbh in 673 ; order to maintain 100% MS-DOS compatibility. 0 000001FA 00 times (01fbh - ($ - DATASTART)) db 0 675 676 global MARK01FBH 677 MARK01FBH equ $ 678 global _local_buffer ; local_buffer is 256 bytes long 679 ; so it overflows into kb_buf!! 680 ; only when kb_buf is used, local_buffer is limited to 128 bytes. 0 000001FB 00 _local_buffer: times 128 db 0 682 global _kb_buf 0 0000027B 8000 _kb_buf db 128,0 ; initialise buffer to empty 0 0000027D 00 times 128+1 db 0 ; room for 128 byte readline + LF 685 ; 686 ; Variables that follow are documented as part of the DOS 4.0-6.X swappable 687 ; data area in Ralf Browns Interrupt List #56 688 ; 689 ; this byte is used for ^P support 690 global _PrinterEcho 0 000002FE 00 _PrinterEcho db 0 ;-34 - 0 = no printer echo, ~0 echo 692 global _verify_ena 0 000002FF 00 _verify_ena db 0 ; ~0, write with verify 694 695 ; this byte is used for TABs (shared by all char device writes??) 696 global _scr_pos 0 00000300 00 _scr_pos db 0 ; Current Cursor Column 698 global _switchar 0 00000301 2F _switchar db '/' ;-31 - switch char 700 global _mem_access_mode 0 00000302 00 _mem_access_mode db 0 ;-30 - memory allocation strategy 702 global sharing_flag 0 00000303 00 sharing_flag db 0 ; 00 = sharing module not loaded 704 ; 01 = sharing module loaded, but 705 ; open/close for block devices 706 ; disabled 707 ; FF = sharing module loaded, 708 ; open/close for block devices 709 ; enabled (not implemented) 710 global _net_set_count 0 00000304 01 _net_set_count db 1 ;-28 - count the name below was set 712 global _net_name 0 00000305 202020202020202020 _net_name db ' ' ;-27 - 15 Character Network Name 0 0000030E 202020202020 0 00000314 00 db 00 ; Terminating 0 byte 715 716 717 ; 718 ; Variables contained the the "STATE_DATA" segment contain 719 ; information about the STATE of the current DOS Process. These 720 ; variables must be preserved regardless of the state of the INDOS 721 ; flag. 722 ; 723 ; All variables that appear in "STATE_DATA" **MUST** be declared 724 ; in this file as the offsets from the INTERNAL_DATA variable are 725 ; critical to the DOS applications that modify this data area. 726 ; 727 ; 728 global _ErrorMode, _InDOS 729 global _CritErrLocus, _CritErrCode 730 global _CritErrAction, _CritErrClass 731 global _CritErrDev, _CritErrDrive 732 global _dta 733 global _cu_psp, _default_drive 734 global _break_ena 735 global _return_code 736 global _internal_data 737 738 ; ensure offset of critical patch table remains fixed, some programs hard code offset 739 times (0315h - ($ - DATASTART)) db 0 740 global _CritPatch 0 00000315 0000 _CritPatch dw 0 ;-11 zero list of patched critical 0 00000317 0000 dw 0 ; section variables 0 00000319 0000 dw 0 ; DOS puts 0d0ch here but some 0 0000031B 0000 dw 0 ; progs really write to that addr. 0 0000031D 0000 dw 0 ;-03 - critical patch list terminator 0 0000031F 90 db 90h ;-01 - unused, NOP pad byte 747 _internal_data: ; <-- Address returned by INT21/5D06 0 00000320 00 _ErrorMode db 0 ; 00 - Critical Error Flag 0 00000321 00 _InDOS db 0 ; 01 - Indos Flag 0 00000322 00 _CritErrDrive db 0 ; 02 - Drive on write protect error 0 00000323 00 _CritErrLocus db 0 ; 03 - Error Locus 0 00000324 0000 _CritErrCode dw 0 ; 04 - DOS format error Code 0 00000326 00 _CritErrAction db 0 ; 06 - Error Action Code 0 00000327 00 _CritErrClass db 0 ; 07 - Error Class 0 00000328 00000000 _CritErrDev dd 0 ; 08 - Failing Device Address 0 0000032C 00000000 _dta dd 0 ; 0C - current DTA 0 00000330 0000 _cu_psp dw 0 ; 10 - Current PSP 0 00000332 0000 break_sp dw 0 ; 12 - used in int 23 0 00000334 0000 _return_code dw 0 ; 14 - return code from process 0 00000336 00 _default_drive db 0 ; 16 - Current Drive 0 00000337 01 _break_ena db 1 ; 17 - Break Flag (default TRUE) 0 00000338 00 db 0 ; 18 - flag, code page switching 0 00000339 00 db 0 ; 19 - flag, copy of 18 on int 24h abort 764 765 global _swap_always, _swap_indos 766 _swap_always: 767 768 global _Int21AX 0 0000033A 0000 _Int21AX dw 0 ; 1A - AX from last Int 21 770 771 global owning_psp, _MachineId 0 0000033C 0000 owning_psp dw 0 ; 1C - owning psp 0 0000033E 0000 _MachineId dw 0 ; 1E - remote machine ID 0 00000340 0000 dw 0 ; 20 - First usable mcb 0 00000342 0000 dw 0 ; 22 - Best usable mcb 0 00000344 0000 dw 0 ; 24 - Last usable mcb 0 00000346 0000 dw 0 ; 26 - memory size in paragraphs 0 00000348 0000 dw 0 ; 28 - unknown 0 0000034A 00 db 0 ; 2A - unknown 0 0000034B 00 db 0 ; 2B - unknown 0 0000034C 00 db 0 ; 2C - unknown 782 global _break_flg 0 0000034D 00 _break_flg db 0 ; 2D - Program aborted by ^C 0 0000034E 00 db 0 ; 2E - unknown 0 0000034F 00 db 0 ; 2F - not referenced 786 global _DayOfMonth 0 00000350 01 _DayOfMonth db 1 ; 30 - day of month 788 global _Month 0 00000351 01 _Month db 1 ; 31 - month 790 global _YearsSince1980 0 00000352 0000 _YearsSince1980 dw 0 ; 32 - year since 1980 0 00000354 FFFF daysSince1980 dw 0FFFFh ; 34 - number of days since epoch 793 ; force rebuild on first clock read 794 global _DayOfWeek 0 00000356 02 _DayOfWeek db 2 ; 36 - day of week 0 00000357 00 _console_swap db 0 ; 37 console swapped during read from dev 797 global _dosidle_flag 0 00000358 01 _dosidle_flag db 1 ; 38 - safe to call int28 if nonzero 799 global _abort_progress 0 00000359 00 _abort_progress db 0 ; 39 - abort in progress 801 global _CharReqHdr 802 _CharReqHdr: 803 global _ClkReqHdr 0 0000035A 00 _ClkReqHdr times 30 db 0 ; 3A - Device driver request header 0 00000378 00000000 dd 0 ; 58 - pointer to driver entry 806 global _MediaReqHdr 0 0000037C 00 _MediaReqHdr times 22 db 0 ; 5C - Device driver request header 808 global _IoReqHdr 0 00000392 00 _IoReqHdr times 30 db 0 ; 72 - Device driver request header 0 000003B0 00 times 6 db 0 ; 90 - unknown 811 global _ClkRecord 0 000003B6 00 _ClkRecord times 6 db 0 ; 96 - CLOCK$ transfer record 0 000003BC 0000 dw 0 ; 9C - unknown 814 global __PriPathBuffer 0 000003BE 00 __PriPathBuffer times 80h db 0 ; 9E - buffer for file name 816 global __SecPathBuffer 0 0000043E 00 __SecPathBuffer times 80h db 0 ;11E - buffer for file name 818 global _sda_tmp_dm 0 000004BE 00 _sda_tmp_dm times 21 db 0 ;19E - 21 byte srch state 820 global _SearchDir 0 000004D3 00 _SearchDir times 32 db 0 ;1B3 - 32 byte dir entry 822 global _TempCDS 0 000004F3 00 _TempCDS times 88 db 0 ;1D3 - TemporaryCDS buffer 824 global _DirEntBuffer 0 0000054B 00 _DirEntBuffer times 32 db 0 ;22B - space enough for 1 dir entry 826 global _wAttr 0 0000056B 0000 _wAttr dw 0 ;24B - extended FCB file attribute 828 829 830 global _SAttr 0 0000056D 00 _SAttr db 0 ;24D - Attribute Mask for Dir Search 832 global _OpenMode 0 0000056E 00 _OpenMode db 0 ;24E - File Open Attribute 834 0 0000056F 00 times 3 db 0 836 global _Server_Call 0 00000572 00 _Server_Call db 0 ;252 - Server call Func 5D sub 0 0 00000573 00 db 0 839 ; Pad to 05CCh 0 00000574 00 times (25ch - ($ - _internal_data)) db 0 841 842 global _term_type ; used by break and critical error 0 0000057C 00 _term_type db 0 ;25C - handlers during termination 844 ; ecm: 00h = normal terminate, 845 ; 01h = control-c terminate, 846 ; 02h = critical error abort, 847 ; 03h = TSR terminate 0 0000057D 00 db 0 ;25D - padding 849 global term_psp 0 0000057E 0000 term_psp dw 0 ;25E - 0?? 851 global int24_esbp 0 00000580 0000 int24_esbp times 2 dw 0 ;260 - pointer to criticalerr DPB 853 global _user_r, int21regs_off, int21regs_seg 854 _user_r: 0 00000584 0000 int21regs_off dw 0 ;264 - pointer to int21h stack frame 0 00000586 0000 int21regs_seg dw 0 ; i.e. points stack frame (SS:SP) with user registers when int21h called 857 global critical_sp 0 00000588 0000 critical_sp dw 0 ;268 - critical error internal stack, store SP during int24h 859 global current_ddsc 0 0000058A 0000 current_ddsc times 2 dw 0 ;26A - pointer to DPB for ??? 861 0 0000058E 0000 diskbuf_seg dw 0 ;26E - segment of disk buffer 0 00000590 00000000 dd 0 ;270 - saving partial cluster number??? - see https://faydoc.tripod.com/structures/16/1690.htm 0 00000594 0000 dw 0 0 00000596 0000 dw 0 ;276 - temp word 0 00000598 00 db 0 ;278 - media id returned by AH=1Bh,1Ch 0 00000599 00 db 0 ;279 - unused 868 869 ; Pad to 059ah 870 times (27ah - ($ - _internal_data)) db 0 871 global current_device 0 0000059A 0000 current_device times 2 dw 0 ;27A - point to device header if filename is character device 873 global _lpCurSft 0 0000059E 0000 _lpCurSft times 2 dw 0 ;27e - Current SFT 875 global _current_ldt 0 000005A2 0000 _current_ldt times 2 dw 0 ;282 - Current CDS 877 global _sda_lpFcb 0 000005A6 0000 _sda_lpFcb times 2 dw 0 ;286 - pointer to callers FCB 879 global _current_sft_idx 0 000005AA 0000 _current_sft_idx dw 0 ;28A - SFT index for next open 881 ; used by MS NET 0 000005AC 0000 dw 0 ;28C - temp file handler 0 000005AE 00000000 dd 0 ;28E - pointer to JFT entry (for file being opened) in process handle table 884 885 ; Pad to 05b2h 886 times (292h - ($ - _internal_data)) db 0 0 000005B2 [BE03] dw __PriPathBuffer ; 292 - "sda_WFP_START" offset in DOS DS of first filename argument 0 000005B4 [3E04] dw __SecPathBuffer ; 294 - "sda_REN_WFP" offset in DOS DS of second filename argument 0 000005B6 FFFF dw 0ffffh ; 296 - 0xffff or offset of last component in filename 890 891 ; Pad to 05ceh 0 000005B8 00 times (2aeh - ($ - _internal_data)) db 0 893 global _current_filepos 0 000005CE 0000 _current_filepos times 2 dw 0 ;2AE - current offset in file 895 896 ; Pad to 05eah 0 000005D2 00 times (2cah - ($ - _internal_data)) db 0 898 ;global _save_BX 899 ;global _save_DS 0 000005EA 0000 save_BX dw 0 ;2CA - unused by FreeDOS, for Win3.x 0 000005EC 0000 save_DS dw 0 ; compatibility, match MS's positions 0 000005EE 0000 dw 0 ; store DS,BX on entry to int21h (ie caller's values) 903 global _prev_user_r 904 global prev_int21regs_off 905 global prev_int21regs_seg 906 _prev_user_r: 0 000005F0 0000 prev_int21regs_off dw 0 ;2D0 - pointer to prev int 21 frame (see offset 264h) 0 000005F2 0000 prev_int21regs_seg dw 0 909 910 ; Pad to 05fdh, 2D4 through 2E4 used for int21h/ax=6C00h 0 000005F4 00 times (2ddh - ($ - _internal_data)) db 0 912 global _ext_open_action 913 global _ext_open_attrib 914 global _ext_open_mode 0 000005FD 0000 _ext_open_action dw 0 ;2DD - extended open action 0 000005FF 0000 _ext_open_attrib dw 0 ;2DF - extended open attrib 0 00000601 0000 _ext_open_mode dw 0 ;2E1 - extended open mode 0 00000603 00000000 open_filename dd 0 ;2E3 pointer to filename to open (see ax=6C00h) 919 920 ; Pad to 0620h 0 00000607 00 times (300h - ($ - _internal_data)) db 0 922 923 global apistk_bottom 924 apistk_bottom: 925 ; use bottom of error stack as scratch buffer 926 ; - only used during int 21 call 927 global _sda_tmp_dm_ren 0 00000620 90 _sda_tmp_dm_ren:times 21 db 0x90 ;300 - 21 byte srch state for rename 929 global _SearchDir_ren 0 00000635 90 _SearchDir_ren: times 32 db 0x90 ;315 - 32 byte dir entry for rename 931 932 ; stacks are made to initialize to no-ops so that high-water 933 ; testing can be performed 0 00000655 90 times STACK_SIZE*2-($-apistk_bottom) db 0x90 935 ; critical error stack 331 bytes?, disk stack 384 bytes, character i/o 384 bytes 936 ;300 - Error Processing Stack 937 global _error_tos 938 _error_tos: 0 000007A0 9090 times STACK_SIZE dw 0x9090 ;480 - Disk Function Stack 940 global _disk_api_tos 941 _disk_api_tos: 0 00000920 9090 times STACK_SIZE dw 0x9090 ;600 - Char Function Stack 943 global _char_api_tos 944 _char_api_tos: 945 apistk_top: 0 00000AA0 00 db 0 ;780 device driver look-ahead (printer), see ah=64h 0 00000AA1 00 _VolChange db 0 ;781 - volume change 0 00000AA2 00 _VirtOpen db 0 ;782 - virtual open flag 949 950 ; 783h to 788h are fastseek drive, 1st cluster, logical cluster, returned logical cluster 951 ; 78Ah dw ? temp location of SYSINIT 952 953 ; controlled variables end at offset 78Ch so pad to end 0 00000AA3 00 times (78ch - ($ - _internal_data)) db 0 955 956 ; MSDOS 7.1+ with FAT32 SDA extended 957 ;78Ch - 47 bytes of ??? 0 00000AAC 00 times (7bbh - ($ - _internal_data)) db 0 0 00000ADB 00 absrdwrflg db 0 ;7bbh - 0=int 25h/26h absolute read/write, 1=int 21h/ax=7305h 0 00000ADC 0000 times 12 dw 0 ;7bch to 7d2h, high word of 32bit values, see offsets 0x 2a2, 29c, 2bc, 29a, 276, 244, & registers ebx,edx,edi,ecx 0 00000AF4 0000 times 3 dw 0 ; ??? 962 963 ; 964 ; end of controlled variables 965 ; 966 === Switch to base=000790h -> "_BSS" 967 segment _BSS 968 ;!! global _NumFloppies 969 ;!!_NumFloppies resw 1 970 ;!!intr_dos_stk resw 1 971 ;!!intr_dos_seg resw 1 972 973 974 ; mark front and end of bss area to clear === Switch to base=012BB0h -> "IB_B" 975 segment IB_B 976 global __ib_start 977 __ib_start: === Switch to base=012BB0h -> "IB_E" 978 segment IB_E 979 global __ib_end 980 __ib_end: 981 ;; do not clear the other init BSS variables + STACK: too late. 982 983 ; kernel startup stack 984 global init_tos 985 00000000 resw 512 986 init_tos: 987 ; the last paragraph of conventional memory might become an MCB 988 00000400 resb 16 989 global __init_end 990 __init_end: 991 init_end: 992 === Switch to base=000790h -> "_DATA" 993 segment _DATA 994 ; blockdev private stack 995 global blk_stk_top 0 00000DAE 0000 times 256 dw 0 997 blk_stk_top: 998 999 ; clockdev private stack 1000 global clk_stk_top 0 00000FAE 0000 times 128 dw 0 1002 clk_stk_top: 1003 1004 ; int2fh private stack 1005 global int2f_stk_top 0 000010AE 0000 times 128 dw 0 1007 int2f_stk_top: 1008 1009 ; Dynamic data: 1010 ; member of the DOS DATA GROUP 1011 ; and marks definitive end of all used data in kernel data segment 1012 ; 1013 === Switch to base=000790h -> "_DATAEND" 1014 segment _DATAEND 1015 1016 _swap_indos: 1017 ; we don't know precisely what needs to be swapped before this, so set it here. 1018 ; this is just after FIXED_DATA+BSS+DATA and before (D)CONST+BSS 1019 ; probably, the clock and block stacks and disktransferbuffer should go past 1020 ; _swap_indos but only if int2a ah=80/81 (critical section start/end) 1021 ; are called upon entry and exit of the device drivers 1022 0 000011F2 9090 times 96 dw 0x9090 ; Process 0 Stack 1024 global _p_0_tos 1025 _p_0_tos: 1026 === Switch to base=000790h -> "DYN_DATA" 1027 segment DYN_DATA 1028 1029 global _Dyn 1030 _Dyn: 0 00001AD3 0000 DynAllocated dw 0 1032 ;times DynAllocated db ? ; allocated at runtime, need to add DynAllocated to _markEndInstanceData 1033 1034 global _markEndInstanceData 1035 _markEndInstanceData: ; mark end of DOS data seg we say needs instancing 1036 1037 === Switch to base=012BB0h -> "ID_B" 1038 segment ID_B 1039 global __INIT_DATA_START 1040 __INIT_DATA_START: === Switch to base=012BB0h -> "ID_E" 1041 segment ID_E 1042 global __INIT_DATA_END 1043 __INIT_DATA_END: 1044 1045 === Switch to base=00E150h -> "INIT_TEXT_START" 1046 segment INIT_TEXT_START 1047 global __InitTextStart 1048 __InitTextStart: ; and c version 1049 === Switch to base=00E150h -> "INIT_TEXT_END" 1050 segment INIT_TEXT_END 1051 global __InitTextEnd 1052 __InitTextEnd: ; and c version 1053 1054 ; 1055 ; start end end of HMA area 1056 === Switch to base=002270h -> "HMA_TEXT_START" 1057 segment HMA_TEXT_START 1058 global __HMATextAvailable 1059 __HMATextAvailable: 1060 global __HMATextStart 1061 __HMATextStart: 1062 1063 ; 1064 ; the HMA area is filled with 1eh+3(=sizeof VDISK) = 33 byte dummy data, 1065 ; so nothing will ever be below 0xffff:0031 1066 ; === Switch to base=002270h -> "HMA_TEXT" 1067 segment HMA_TEXT 1068 begin_hma: 0 00000000 00 times 10h db 0 ; filler [ffff:0..ffff:10] 0 00000010 00 times 20h db 0 0 00000030 00 db 0 1072 1073 ; to minimize relocations 1074 global _DGROUP_ 0 00000031 [0000] _DGROUP_ dw DGROUP 1076 1077 %ifdef WATCOM 1078 ; 32 bit multiplication + division 1079 global __U4M 1080 __U4M: 1081 LMULU 1082 global __U4D 1083 __U4D: 1084 LDIVMODU 1085 %endif 1086 1087 %ifdef gcc 1088 %macro ULONG_HELPERS 1 1089 global %1udivsi3 1090 %1udivsi3: call %1ldivmodu 1091 ret 8 1092 1093 global %1umodsi3 1094 %1umodsi3: call %1ldivmodu 1095 mov dx, cx 1096 mov ax, bx 1097 ret 8 1098 1099 %1ldivmodu: LDIVMODU 1100 1101 global %1ashlsi3 1102 %1ashlsi3: LSHLU 1103 1104 global %1lshrsi3 1105 %1lshrsi3: LSHRU 1106 %endmacro 1107 ULONG_HELPERS ___ 1089 <1> global %1udivsi3 0 00000033 E80D00 %1udivsi3: call %1ldivmodu 0 00000036 C20800 ret 8 1092 <1> 1093 <1> global %1umodsi3 0 00000039 E80700 %1umodsi3: call %1ldivmodu 0 0000003C 89CA mov dx, cx 0 0000003E 89D8 mov ax, bx 0 00000040 C20800 ret 8 1098 <1> 1099 <1> %1ldivmodu: LDIVMODU 1099 <2> ___ldivmodu: 26 <2> 27 <2> 28 <2> 29 <2> 30 <2> 31 <2> 32 <2> 33 <2> 34 <2> 35 <2> 36 <2> 37 <2> 38 <2> 39 <2> 40 <2> 41 <2> 42 <2> 43 <2> 44 <2> 45 <2> 46 <2> 47 <2> 48 <2> 49 <2> 50 <2> 51 <2> 52 <2> 53 <2> 54 <2> %ifdef STDCALL 0 00000043 55 push bp 0 00000044 89E5 mov bp, sp 0 00000046 8B4606 mov ax, [bp+6] 0 00000049 8B5608 mov dx, [bp+8] 0 0000004C 8B5E0A mov bx, [bp+10] 0 0000004F 8B4E0C mov cx, [bp+12] 0 00000052 5D pop bp 62 <2> %endif 63 <2> 0 00000053 85C9 test cx, cx 0 00000055 7512 jnz %%big_divisor 0 00000057 39DA cmp dx, bx 0 00000059 7205 jb %%one_div 68 <2> 69 <2> 0 0000005B 91 xchg cx, ax 0 0000005C 92 xchg ax, dx 0 0000005D F7F3 div bx 0 0000005F 91 xchg ax, cx 74 <2> 75 <2> %%one_div: 0 00000060 F7F3 div bx 0 00000062 89D3 mov bx, dx 0 00000064 89CA mov dx, cx 0 00000066 31C9 xor cx, cx 0 00000068 C3 ret 81 <2> 82 <2> %%big_divisor: 0 00000069 56 push si 0 0000006A 57 push di 0 0000006B 52 push dx 0 0000006C 50 push ax 0 0000006D 89DE mov si, bx 0 0000006F 89CF mov di, cx 89 <2> %%shift_loop: 0 00000071 D1EA shr dx, 1 0 00000073 D1D8 rcr ax, 1 0 00000075 D1E9 shr cx, 1 0 00000077 D1DB rcr bx, 1 0 00000079 75F6 jnz %%shift_loop 0 0000007B F7F3 div bx 0 0000007D 5B pop bx 0 0000007E 89C1 mov cx, ax 0 00000080 F7E7 mul di 0 00000082 5A pop dx 0 00000083 29C2 sub dx,ax 0 00000085 52 push dx 0 00000086 89C8 mov ax, cx 0 00000088 F7E6 mul si 0 0000008A 29C3 sub bx, ax 0 0000008C 89C8 mov ax, cx 0 0000008E 59 pop cx 0 0000008F 19D1 sbb cx, dx 0 00000091 19D2 sbb dx, dx 0 00000093 21D6 and si, dx 0 00000095 21D7 and di, dx 0 00000097 01F3 add bx, si 0 00000099 11F9 adc cx, di 0 0000009B 01D0 add ax, dx 0 0000009D 31D2 xor dx, dx 0 0000009F 5F pop di 0 000000A0 5E pop si 0 000000A1 C3 ret 118 <2> 1100 <1> 1101 <1> global %1ashlsi3 1102 <1> %1ashlsi3: LSHLU 1102 <2> ___ashlsi3: 0 000000A2 5B pop bx 123 <2> popargs {dx,ax},cx 249 <3> %rep %0 250 <3> %ifdef PASCAL 251 <3> %rotate -1 252 <3> %endif 253 <3> multipop %1 254 <3> %ifdef STDCALL 255 <3> %rotate 1 256 <3> %endif 257 <3> %endrep 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 000000A3 58 pop %1 243 <6> %rotate -1 0 000000A4 5A pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 000000A5 59 pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 0 000000A6 53 push bx 0 000000A7 E306 jcxz %%ret 0 000000A9 D1E0 %%loop: shl ax, 1 0 000000AB D1D2 rcl dx, 1 0 000000AD E2FA loop %%loop 0 000000AF C3 %%ret: ret 1103 <1> 1104 <1> global %1lshrsi3 1105 <1> %1lshrsi3: LSHRU 1105 <2> ___lshrsi3: 0 000000B0 5B pop bx 134 <2> popargs {dx,ax},cx 249 <3> %rep %0 250 <3> %ifdef PASCAL 251 <3> %rotate -1 252 <3> %endif 253 <3> multipop %1 254 <3> %ifdef STDCALL 255 <3> %rotate 1 256 <3> %endif 257 <3> %endrep 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 000000B1 58 pop %1 243 <6> %rotate -1 0 000000B2 5A pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 000000B3 59 pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 0 000000B4 53 push bx 0 000000B5 E306 jcxz %%ret 0 000000B7 D1EA %%loop: shr dx, 1 0 000000B9 D1D8 rcr ax, 1 0 000000BB E2FA loop %%loop 0 000000BD C3 %%ret: ret 1108 %endif 1109 0 000000BE 00 times 0xd0 - ($-begin_hma) db 0 1111 ; reserve space for far jump to cp/m routine 0 000000D0 00 times 5 db 0 1113 1114 ;End of HMA segment === Switch to base=002270h -> "HMA_TEXT_END" 1115 segment HMA_TEXT_END 1116 global __HMATextEnd 1117 __HMATextEnd: ; and c version 1118 1119 1120 1121 ; The default stack (_TEXT:0) will overwrite the data area, so I create a dummy 1122 ; stack here to ease debugging. -- ror4 1123 === Switch to base=01524Ah -> "_STACK" 1124 segment _STACK class(STACK) nobits stack 1125 1126 1127 1128 1129 === Switch to base=000790h -> "CONST" 1130 segment CONST 1131 ; dummy interrupt return handlers 1132 1133 global _int22_handler 1134 global _int28_handler 1135 global _int2a_handler 1136 global _empty_handler 1137 _int22_handler: 1138 _int28_handler: 1139 _int2a_handler: 1140 _empty_handler: 0 000012D9 CF iret 1142 1143 1144 global _initforceEnableA20 1145 initforceEnableA20: 0 000012DA E88000 call near forceEnableA20 0 000012DD CB retf 1148 1149 global __HMARelocationTableStart 1150 __HMARelocationTableStart: 1151 1152 global _int2f_handler 1153 extern reloc_call_int2f_handler 0 000012DE EA[0000]0000 _int2f_handler: jmp 0:reloc_call_int2f_handler 0 000012E3 E87700 call near forceEnableA20 1156 1157 global _int20_handler 1158 extern reloc_call_int20_handler 0 000012E6 EA[0000]0000 _int20_handler: jmp 0:reloc_call_int20_handler 0 000012EB E86F00 call near forceEnableA20 1161 1162 global _int21_handler 1163 extern reloc_call_int21_handler 0 000012EE EA[0000]0000 _int21_handler: jmp 0:reloc_call_int21_handler 0 000012F3 E86700 call near forceEnableA20 1166 1167 1168 global _low_int25_handler 1169 extern reloc_call_low_int25_handler 0 000012F6 EA[0000]0000 _low_int25_handler: jmp 0:reloc_call_low_int25_handler 0 000012FB E85F00 call near forceEnableA20 1172 1173 global _low_int26_handler 1174 extern reloc_call_low_int26_handler 0 000012FE EA[0000]0000 _low_int26_handler: jmp 0:reloc_call_low_int26_handler 0 00001303 E85700 call near forceEnableA20 1177 1178 global _int27_handler 1179 extern reloc_call_int27_handler 0 00001306 EA[0000]0000 _int27_handler: jmp 0:reloc_call_int27_handler 0 0000130B E84F00 call near forceEnableA20 1182 1183 global _int0_handler 1184 extern reloc_call_int0_handler 0 0000130E EA[0000]0000 _int0_handler: jmp 0:reloc_call_int0_handler 0 00001313 E84700 call near forceEnableA20 1187 1188 global _int6_handler 1189 extern reloc_call_int6_handler 0 00001316 EA[0000]0000 _int6_handler: jmp 0:reloc_call_int6_handler 0 0000131B E83F00 call near forceEnableA20 1192 1193 global _int19_handler 1194 extern reloc_call_int19_handler 0 0000131E EA[0000]0000 _int19_handler: jmp 0:reloc_call_int19_handler 0 00001323 E83700 call near forceEnableA20 1197 1198 global _cpm_entry 1199 extern reloc_call_cpm_entry 0 00001326 EA[0000]0000 _cpm_entry: jmp 0:reloc_call_cpm_entry 0 0000132B E82F00 call near forceEnableA20 1202 1203 global _reloc_call_blk_driver 1204 extern _blk_driver 1205 _reloc_call_blk_driver: 0 0000132E EA[0000]0000 jmp 0:_blk_driver 0 00001333 E82700 call near forceEnableA20 1208 1209 global _reloc_call_clk_driver 1210 extern _clk_driver 1211 _reloc_call_clk_driver: 0 00001336 EA[0000]0000 jmp 0:_clk_driver 0 0000133B E81F00 call near forceEnableA20 1214 1215 global _CharMapSrvc ; in _DATA (see AARD) 1216 extern _reloc_call_CharMapSrvc 0 0000133E EA[0000]0000 _CharMapSrvc: jmp 0:_reloc_call_CharMapSrvc 0 00001343 E81700 call near forceEnableA20 1219 1220 global _init_call_p_0 1221 extern reloc_call_p_0 0 00001346 EA[0000]0000 _init_call_p_0: jmp 0:reloc_call_p_0 0 0000134B E80F00 call near forceEnableA20 1224 1225 1226 global __HMARelocationTableEnd 1227 __HMARelocationTableEnd: 1228 1229 ; 1230 ; if we were lucky, we found all entries from the outside to the kernel. 1231 ; if not, BUMS 1232 ; 1233 ; 1234 ; this routine makes the HMA area available. PERIOD. 1235 ; must conserve ALL registers 1236 ; will be only ever called, if HMA (DOS=HIGH) is enabled. 1237 ; for obvious reasons it should be located at the relocation table 1238 ; 1239 1240 global _ENABLEA20 1241 _ENABLEA20: 0 0000134E B405 mov ah,5 1243 UsingXMSdriver: 1244 1245 global _XMS_Enable_Patch 1246 _XMS_Enable_Patch: ; SMC: patch to nop (90h) to enable use of XMS 0 00001350 CB retf 1248 0 00001351 53 push bx 0 00001352 9A00000000 call 0:0 ; (immediate far address patched) 1251 global _XMSDriverAddress 1252 _XMSDriverAddress: equ $ - 4 ; XMS driver, if detected 0 00001357 5B pop bx 0 00001358 CB retf 1255 1256 global _DISABLEA20 1257 _DISABLEA20: 0 00001359 B406 mov ah,6 0 0000135B EBF3 jmp short UsingXMSdriver 1260 1261 1262 global forceEnableA20 1263 forceEnableA20: 1264 0 0000135D 1E push ds 0 0000135E 06 push es 0 0000135F 50 push ax 0 00001360 56 push si 0 00001361 57 push di 0 00001362 51 push cx 0 00001363 9C pushf 0 00001364 FC cld 1273 1274 .retry: 0 00001365 31F6 xor si, si ; = 0000h 0 00001367 8EDE mov ds, si ; => low memory (IVT) 0 00001369 4E dec si ; = FFFFh 0 0000136A 8EC6 mov es, si ; => HMA at offset 10h 0 0000136C 46 inc si ; back to 0, -> IVT entry 0 and 1 0 0000136D BF1000 mov di, 10h ; -> HMA, or wrapping around to 0:0 0 00001370 B90400 mov cx, 4 0 00001373 F3A7 repe cmpsw ; compare up to 4 words 0 00001375 7408 je .enable 1284 1285 .success: 0 00001377 9D popf 0 00001378 59 pop cx 0 00001379 5F pop di 0 0000137A 5E pop si 0 0000137B 58 pop ax 0 0000137C 07 pop es 0 0000137D 1F pop ds 0 0000137E C3 retn 1294 1295 .enable: 1296 ; ok, we have to enable A20 (at least seems so) 0 0000137F 0E push cs ; make far call stack frame 0 00001380 E8CBFF call _ENABLEA20 0 00001383 EBE0 jmp short .retry 1300 1301 1302 ; global f*cking compatibility issues: 1303 ; 1304 ; very old brain dead software (PKLITE, copyright 1990) 1305 ; forces us to execute with A20 disabled 1306 ; 1307 1308 global _ExecUserDisableA20 1309 _ExecUserDisableA20: 0 00001385 50 push ax 0 00001386 0E push cs ; make far call stack frame 0 00001387 E8CFFF call _DISABLEA20 ; (no-op if not in HMA, patched otherwise) 0 0000138A 58 pop ax 0 0000138B CF iret 1315 1316 1317 ; Default Int 24h handler -- always returns fail 1318 ; so we have not to relocate it (now) 1319 ; 1320 FAIL equ 03h 1321 1322 global _int24_handler 0 0000138C B003 _int24_handler: mov al,FAIL 0 0000138E CF iret 1325 1326 ; 1327 ; this makes some things easier 1328 ; 1329 === Switch to base=000100h -> "_LOWTEXT" 1330 segment _LOWTEXT 1331 global _TEXT_DGROUP 0 0000012C [0000] _TEXT_DGROUP dw DGROUP 1333 === Switch to base=00E150h -> "INIT_TEXT" 1334 segment INIT_TEXT 1335 global _INIT_DGROUP 0 000000E9 [0000] _INIT_DGROUP dw DGROUP 1337 1338 %ifdef gcc 1339 ULONG_HELPERS _init_ 1089 <1> global %1udivsi3 0 000000EB E80D00 %1udivsi3: call %1ldivmodu 0 000000EE C20800 ret 8 1092 <1> 1093 <1> global %1umodsi3 0 000000F1 E80700 %1umodsi3: call %1ldivmodu 0 000000F4 89CA mov dx, cx 0 000000F6 89D8 mov ax, bx 0 000000F8 C20800 ret 8 1098 <1> 1099 <1> %1ldivmodu: LDIVMODU 1099 <2> _init_ldivmodu: 26 <2> 27 <2> 28 <2> 29 <2> 30 <2> 31 <2> 32 <2> 33 <2> 34 <2> 35 <2> 36 <2> 37 <2> 38 <2> 39 <2> 40 <2> 41 <2> 42 <2> 43 <2> 44 <2> 45 <2> 46 <2> 47 <2> 48 <2> 49 <2> 50 <2> 51 <2> 52 <2> 53 <2> 54 <2> %ifdef STDCALL 0 000000FB 55 push bp 0 000000FC 89E5 mov bp, sp 0 000000FE 8B4606 mov ax, [bp+6] 0 00000101 8B5608 mov dx, [bp+8] 0 00000104 8B5E0A mov bx, [bp+10] 0 00000107 8B4E0C mov cx, [bp+12] 0 0000010A 5D pop bp 62 <2> %endif 63 <2> 0 0000010B 85C9 test cx, cx 0 0000010D 7512 jnz %%big_divisor 0 0000010F 39DA cmp dx, bx 0 00000111 7205 jb %%one_div 68 <2> 69 <2> 0 00000113 91 xchg cx, ax 0 00000114 92 xchg ax, dx 0 00000115 F7F3 div bx 0 00000117 91 xchg ax, cx 74 <2> 75 <2> %%one_div: 0 00000118 F7F3 div bx 0 0000011A 89D3 mov bx, dx 0 0000011C 89CA mov dx, cx 0 0000011E 31C9 xor cx, cx 0 00000120 C3 ret 81 <2> 82 <2> %%big_divisor: 0 00000121 56 push si 0 00000122 57 push di 0 00000123 52 push dx 0 00000124 50 push ax 0 00000125 89DE mov si, bx 0 00000127 89CF mov di, cx 89 <2> %%shift_loop: 0 00000129 D1EA shr dx, 1 0 0000012B D1D8 rcr ax, 1 0 0000012D D1E9 shr cx, 1 0 0000012F D1DB rcr bx, 1 0 00000131 75F6 jnz %%shift_loop 0 00000133 F7F3 div bx 0 00000135 5B pop bx 0 00000136 89C1 mov cx, ax 0 00000138 F7E7 mul di 0 0000013A 5A pop dx 0 0000013B 29C2 sub dx,ax 0 0000013D 52 push dx 0 0000013E 89C8 mov ax, cx 0 00000140 F7E6 mul si 0 00000142 29C3 sub bx, ax 0 00000144 89C8 mov ax, cx 0 00000146 59 pop cx 0 00000147 19D1 sbb cx, dx 0 00000149 19D2 sbb dx, dx 0 0000014B 21D6 and si, dx 0 0000014D 21D7 and di, dx 0 0000014F 01F3 add bx, si 0 00000151 11F9 adc cx, di 0 00000153 01D0 add ax, dx 0 00000155 31D2 xor dx, dx 0 00000157 5F pop di 0 00000158 5E pop si 0 00000159 C3 ret 118 <2> 1100 <1> 1101 <1> global %1ashlsi3 1102 <1> %1ashlsi3: LSHLU 1102 <2> _init_ashlsi3: 0 0000015A 5B pop bx 123 <2> popargs {dx,ax},cx 249 <3> %rep %0 250 <3> %ifdef PASCAL 251 <3> %rotate -1 252 <3> %endif 253 <3> multipop %1 254 <3> %ifdef STDCALL 255 <3> %rotate 1 256 <3> %endif 257 <3> %endrep 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 0000015B 58 pop %1 243 <6> %rotate -1 0 0000015C 5A pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 0000015D 59 pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 0 0000015E 53 push bx 0 0000015F E306 jcxz %%ret 0 00000161 D1E0 %%loop: shl ax, 1 0 00000163 D1D2 rcl dx, 1 0 00000165 E2FA loop %%loop 0 00000167 C3 %%ret: ret 1103 <1> 1104 <1> global %1lshrsi3 1105 <1> %1lshrsi3: LSHRU 1105 <2> _init_lshrsi3: 0 00000168 5B pop bx 134 <2> popargs {dx,ax},cx 249 <3> %rep %0 250 <3> %ifdef PASCAL 251 <3> %rotate -1 252 <3> %endif 253 <3> multipop %1 254 <3> %ifdef STDCALL 255 <3> %rotate 1 256 <3> %endif 257 <3> %endrep 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 00000169 58 pop %1 243 <6> %rotate -1 0 0000016A 5A pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 250 <4> %ifdef PASCAL 251 <4> %rotate -1 252 <4> %endif 253 <4> multipop %1 242 <5> %rep %0 243 <5> %rotate -1 244 <5> pop %1 245 <5> %endrep 243 <6> %rotate -1 0 0000016B 59 pop %1 254 <4> %ifdef STDCALL 255 <4> %rotate 1 256 <4> %endif 0 0000016C 53 push bx 0 0000016D E306 jcxz %%ret 0 0000016F D1EA %%loop: shr dx, 1 0 00000171 D1D8 rcr ax, 1 0 00000173 E2FA loop %%loop 0 00000175 C3 %%ret: ret 1340 %endif === Trace listing source: lfnapi.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=lfnapi.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc04aY2e.s output file : lfnapi.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 _.Letext0: 8 .file 1 "../hdr/portab.h" 9 .file 2 "../hdr/device.h" 10 .file 3 "../hdr/mcb.h" 11 .file 4 "../hdr/pcb.h" 12 .file 5 "../hdr/ddate.h" 13 .file 6 "../hdr/dtime.h" 14 .file 7 "../hdr/fat.h" 15 .file 8 "../hdr/fcb.h" 16 .file 9 "../hdr/sft.h" 17 .file 10 "../hdr/dcb.h" 18 .file 11 "../hdr/cds.h" 19 .file 12 "../hdr/dirmatch.h" 20 .file 13 "../hdr/fnode.h" 21 .file 14 "../hdr/clock.h" 22 .file 15 "../hdr/kbd.h" 23 .file 16 "../hdr/buffer.h" 24 .file 17 "globals.h" === Switch to base unknown -> ".DEBUG_INFO" === Trace listing source: main.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=main.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccxir89L.s output file : main.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: === Switch to base=012BB0h -> ".RODATA.STR1.1" 7 .section .rodata.str1.1,"aMS",@progbits,1 8 _.LC0: 0 00000639 4450427000 .string "DPBp" === Switch to base=002270h -> ".TEXT" 10 .text 11 .type _update_dcb, @function 12 _update_dcb: 13 _.LFB14: 14 .file 1 "main.c" 1:main.c **** /****************************************************************/ 2:main.c **** /* */ 3:main.c **** /* main.c */ 4:main.c **** /* DOS-C */ 5:main.c **** /* */ 6:main.c **** /* Main Kernel Functions */ 7:main.c **** /* */ 8:main.c **** /* Copyright (c) 1995, 1996 */ 9:main.c **** /* Pasquale J. Villani */ 10:main.c **** /* All Rights Reserved */ 11:main.c **** /* */ 12:main.c **** /* This file is part of DOS-C. */ 13:main.c **** /* */ 14:main.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:main.c **** /* modify it under the terms of the GNU General Public License */ 16:main.c **** /* as published by the Free Software Foundation; either version */ 17:main.c **** /* 2, or (at your option) any later version. */ 18:main.c **** /* */ 19:main.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:main.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:main.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:main.c **** /* the GNU General Public License for more details. */ 23:main.c **** /* */ 24:main.c **** /* You should have received a copy of the GNU General Public */ 25:main.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:main.c **** /* write to the Free Software Foundation, Inc., */ 27:main.c **** /* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ 28:main.c **** /****************************************************************/ 29:main.c **** 30:main.c **** #include "portab.h" 31:main.c **** #include "init-mod.h" 32:main.c **** #include "dyndata.h" 33:main.c **** #include "debug.h" 34:main.c **** 35:main.c **** 36:main.c **** static char copyright[] = 37:main.c **** "(C) Copyright 1995-2023 Pasquale J. Villani and The FreeDOS Project.\n" 38:main.c **** "All Rights Reserved. This is free software and comes with ABSOLUTELY NO\n" 39:main.c **** "WARRANTY; you can redistribute it and/or modify it under the terms of the\n" 40:main.c **** "GNU General Public License as published by the Free Software Foundation;\n" 41:main.c **** "either version 2, or (at your option) any later version.\n"; 42:main.c **** 43:main.c **** STATIC VOID InitIO(void); 44:main.c **** 45:main.c **** STATIC VOID update_dcb(struct dhdr FAR *); 46:main.c **** STATIC VOID init_kernel(VOID); 47:main.c **** STATIC VOID signon(VOID); 48:main.c **** STATIC VOID kernel(VOID); 49:main.c **** STATIC VOID FsConfig(VOID); 50:main.c **** STATIC VOID InitPrinters(VOID); 51:main.c **** STATIC VOID InitSerialPorts(VOID); 52:main.c **** STATIC void CheckContinueBootFromHarddisk(void); 53:main.c **** STATIC void setup_int_vectors(void); 54:main.c **** 55:main.c **** #ifdef _MSC_VER 56:main.c **** BYTE _acrtused = 0; 57:main.c **** 58:main.c **** __segment DosDataSeg = 0; /* serves for all references to the DOS DATA segment 59:main.c **** necessary for MSC+our funny linking model 60:main.c **** */ 61:main.c **** __segment DosTextSeg = 0; 62:main.c **** 63:main.c **** #endif 64:main.c **** 65:main.c **** struct lol FAR *LoL = &DATASTART; 66:main.c **** 67:main.c **** struct _KernelConfig ASM InitKernelConfig = { -1 }; 68:main.c **** char ASM kernel_command_line[256] = { 0, -1 }; /* special none value */ 69:main.c **** int kernel_command_line_length BSS_INIT(0); 70:main.c **** UBYTE ASM debugger_present = 0xFF; /* initialised in kernel.asm 71:main.c **** do NOT set 0 here or compiler may 72:main.c **** move it into bss that we zero out */ 73:main.c **** 74:main.c **** VOID ASMCFUNC FreeDOSmain(void) 75:main.c **** { 76:main.c **** unsigned char drv; 77:main.c **** unsigned char FAR *p; 78:main.c **** char * pp; 79:main.c **** 80:main.c **** #ifdef _MSC_VER 81:main.c **** extern FAR prn_dev; 82:main.c **** DosDataSeg = (__segment) & DATASTART; 83:main.c **** DosTextSeg = (__segment) & prn_dev; 84:main.c **** #endif 85:main.c **** 86:main.c **** /* clear the Init BSS area (what normally the RTL does */ 87:main.c **** memset(_ib_start, 0, _ib_end - _ib_start); 88:main.c **** 89:main.c **** /* if the kernel has been UPX'ed, 90:main.c **** CONFIG info is stored at 50:e2 ..fc 91:main.c **** and the bootdrive (passed from BIOS) 92:main.c **** at 50:e0 93:main.c **** */ 94:main.c **** 95:main.c **** drv = LoL->BootDrive + 1; 96:main.c **** p = MK_FP(0, 0x5e0); 97:main.c **** { 98:main.c **** *p = drv - 1; /* compatibility with older kernels */ 99:main.c **** } 100:main.c **** 101:main.c **** if (drv >= 0x80) 102:main.c **** drv = 3; /* C: */ 103:main.c **** LoL->BootDrive = drv; 104:main.c **** 105:main.c **** /* install DOS API and other interrupt service routines, basic kernel functionality works */ 106:main.c **** setup_int_vectors(); 107:main.c **** 108:main.c **** #ifdef DEBUG 109:main.c **** /* printf must go after setup_int_vectors call */ 110:main.c **** if (kernel_command_line[0] == 0 && kernel_command_line[1] == (char)-1) { 111:main.c **** printf("\nKERNEL: Command line is not specified.\n"); 112:main.c **** } else { 113:main.c **** printf("\nKERNEL: Command line is \"%s\"\n", kernel_command_line); 114:main.c **** } 115:main.c **** #endif 116:main.c **** 117:main.c **** kernel_command_line_length = strlen(kernel_command_line); 118:main.c **** for (pp = kernel_command_line; *pp; ++pp) { 119:main.c **** if (*pp == ';') { 120:main.c **** *pp = 0; 121:main.c **** } 122:main.c **** } 123:main.c **** 124:main.c **** /* check if booting from floppy/CD */ 125:main.c **** CheckContinueBootFromHarddisk(); 126:main.c **** 127:main.c **** /* display copyright info and kernel emulation status */ 128:main.c **** signon(); 129:main.c **** 130:main.c **** /* initialize all internal variables, process CONFIG.SYS, load drivers, etc */ 131:main.c **** init_kernel(); 132:main.c **** 133:main.c **** #ifdef DEBUG 134:main.c **** /* Non-portable message kludge alert! */ 135:main.c **** printf("KERNEL: Boot drive = %c\n", 'A' + LoL->BootDrive - 1); 136:main.c **** #endif 137:main.c **** 138:main.c **** DoInstall(); 139:main.c **** 140:main.c **** kernel(); 141:main.c **** } 142:main.c **** 143:main.c **** /* 144:main.c **** InitializeAllBPBs() 145:main.c **** 146:main.c **** or MakeNortonDiskEditorHappy() 147:main.c **** 148:main.c **** it has been determined, that FDOS's BPB tables are initialized, 149:main.c **** only when used (like DIR H:). 150:main.c **** at least one known utility (norton DE) seems to access them directly. 151:main.c **** ok, so we access for all drives, that the stuff gets build 152:main.c **** */ 153:main.c **** void InitializeAllBPBs(VOID) 154:main.c **** { 155:main.c **** static char filename[] = "A:-@JUNK@-.TMP"; 156:main.c **** int drive, fileno; 157:main.c **** for (drive = 'C'; drive < 'A' + LoL->nblkdev; drive++) 158:main.c **** { 159:main.c **** filename[0] = drive; 160:main.c **** if ((fileno = open(filename, O_RDONLY)) >= 0) 161:main.c **** close(fileno); 162:main.c **** } 163:main.c **** } 164:main.c **** 165:main.c **** STATIC void PSPInit(void) 166:main.c **** { 167:main.c **** psp far *p = MK_FP(DOS_PSP, 0); 168:main.c **** 169:main.c **** /* Clear out new psp first */ 170:main.c **** fmemset(p, 0, sizeof(psp)); 171:main.c **** /* high half is used as environment */ 172:main.c **** 173:main.c **** /* initialize all entries and exits */ 174:main.c **** /* CP/M-like exit point */ 175:main.c **** p->ps_exit = 0x20cd; 176:main.c **** 177:main.c **** /* CP/M-like entry point - call far to special entry */ 178:main.c **** p->ps_farcall = 0x9a; 179:main.c **** p->ps_reentry = MK_FP(0, 0x30 * 4); 180:main.c **** /* unix style call - 0xcd 0x21 0xcb (int 21, retf) */ 181:main.c **** p->ps_unix[0] = 0xcd; 182:main.c **** p->ps_unix[1] = 0x21; 183:main.c **** p->ps_unix[2] = 0xcb; 184:main.c **** 185:main.c **** /* Now for parent-child relationships */ 186:main.c **** /* parent psp segment */ 187:main.c **** p->ps_parent = FP_SEG(p); 188:main.c **** /* previous psp pointer */ 189:main.c **** p->ps_prevpsp = MK_FP(0xffff,0xffff); 190:main.c **** 191:main.c **** /* Environment and memory useage parameters */ 192:main.c **** /* memory size in paragraphs */ 193:main.c **** /* p->ps_size = 0; clear from above */ 194:main.c **** /* environment paragraph */ 195:main.c **** p->ps_environ = DOS_PSP + 8; 196:main.c **** /* terminate address */ 197:main.c **** p->ps_isv22 = getvec(0x22); 198:main.c **** /* break address */ 199:main.c **** p->ps_isv23 = getvec(0x23); 200:main.c **** /* critical error address */ 201:main.c **** p->ps_isv24 = getvec(0x24); 202:main.c **** 203:main.c **** /* user stack pointer - int 21 */ 204:main.c **** /* p->ps_stack = NULL; clear from above */ 205:main.c **** 206:main.c **** /* File System parameters */ 207:main.c **** /* maximum open files */ 208:main.c **** p->ps_maxfiles = 20; 209:main.c **** fmemset(p->ps_files, 0xff, 20); 210:main.c **** 211:main.c **** /* open file table pointer */ 212:main.c **** p->ps_filetab = p->ps_files; 213:main.c **** 214:main.c **** /* default system version for int21/ah=30 */ 215:main.c **** p->ps_retdosver = (LoL->os_setver_minor << 8) + LoL->os_setver_major; 216:main.c **** 217:main.c **** /* first command line argument */ 218:main.c **** /* p->ps_fcb1.fcb_drive = 0; already set */ 219:main.c **** fmemset(p->ps_fcb1.fcb_fname, ' ', FNAME_SIZE + FEXT_SIZE); 220:main.c **** /* second command line argument */ 221:main.c **** /* p->ps_fcb2.fcb_drive = 0; already set */ 222:main.c **** fmemset(p->ps_fcb2.fcb_fname, ' ', FNAME_SIZE + FEXT_SIZE); 223:main.c **** 224:main.c **** /* do not modify command line tail, used as environment */ 225:main.c **** } 226:main.c **** 227:main.c **** #ifndef __WATCOMC__ 228:main.c **** /* for WATCOMC we can use the ones in task.c */ 229:main.c **** intvec getvec(unsigned char intno) 230:main.c **** { 231:main.c **** intvec iv; 232:main.c **** disable(); 233:main.c **** iv = *(intvec FAR *)MK_FP(0,4 * (intno)); 234:main.c **** enable(); 235:main.c **** return iv; 236:main.c **** } 237:main.c **** 238:main.c **** void setvec(unsigned char intno, intvec vector) 239:main.c **** { 240:main.c **** disable(); 241:main.c **** *(intvec FAR *)MK_FP(0,4 * intno) = vector; 242:main.c **** enable(); 243:main.c **** } 244:main.c **** #endif 245:main.c **** 246:main.c **** STATIC void setup_int_vectors(void) 247:main.c **** { 248:main.c **** static struct vec 249:main.c **** { 250:main.c **** unsigned char intno; 251:main.c **** size_t handleroff; 252:main.c **** } vectors[] = 253:main.c **** { 254:main.c **** /* all of these are in the DOS DS */ 255:main.c **** { 0x80 | 0x0, FP_OFF(int0_handler) }, /* zero divide */ 256:main.c **** { 0x80 | 0x1, FP_OFF(empty_handler) }, /* single step */ 257:main.c **** { 0x80 | 0x3, FP_OFF(empty_handler) }, /* debug breakpoint */ 258:main.c **** { 0x80 | 0x6, FP_OFF(int6_handler) }, /* invalid opcode */ 259:main.c **** { 0x19, FP_OFF(int19_handler) }, /* BIOS bootstrap loader, vdisk */ 260:main.c **** { 0x20, FP_OFF(int20_handler) }, 261:main.c **** { 0x21, FP_OFF(int21_handler) }, /* primary DOS API */ 262:main.c **** { 0x22, FP_OFF(int22_handler) }, 263:main.c **** { 0x24, FP_OFF(int24_handler) }, 264:main.c **** { 0x25, FP_OFF(low_int25_handler) }, /* DOS abs read/write calls */ 265:main.c **** { 0x26, FP_OFF(low_int26_handler) }, 266:main.c **** { 0x27, FP_OFF(int27_handler) }, 267:main.c **** { 0x28, FP_OFF(int28_handler) }, 268:main.c **** { 0x2a, FP_OFF(int2a_handler) }, 269:main.c **** { 0x2f, FP_OFF(int2f_handler) } /* multiplex int */ 270:main.c **** }; 271:main.c **** struct vec *pvec; 272:main.c **** struct lowvec FAR *plvec; 273:main.c **** int i; 274:main.c **** 275:main.c **** /* save current int vectors so can restore on reboot and call original directly */ 276:main.c **** for (plvec = intvec_table; plvec < intvec_table + 6; plvec++) 277:main.c **** plvec->isv = getvec(plvec->intno); 278:main.c **** 279:main.c **** /* install default handlers */ 280:main.c **** for (i = 0x23; i <= 0x3f; i++) 281:main.c **** setvec(i, empty_handler); /* note: int 31h segment should be DOS DS */ 282:main.c **** HaltCpuWhileIdle = 0; 283:main.c **** for (pvec = vectors; pvec < vectors + (sizeof vectors/sizeof *pvec); pvec++) 284:main.c **** if ((pvec->intno & 0x80) == 0 || debugger_present == 0) 285:main.c **** setvec(pvec->intno & 0x7F, (intvec)MK_FP(FP_SEG(empty_handler), pvec->handleroff)); 286:main.c **** pokeb(0, 0x30 * 4, 0xea); 287:main.c **** pokel(0, 0x30 * 4 + 1, (ULONG)cpm_entry); 288:main.c **** 289:main.c **** /* handlers for int 0x1b and 0x29 are in the device driver area LOWTEXT (0x70) */ 290:main.c **** setvec(0x1b, got_cbreak); 291:main.c **** setvec(0x29, int29_handler); /* required for printf! */ 292:main.c **** } 293:main.c **** 294:main.c **** STATIC void init_kernel(void) 295:main.c **** { 296:main.c **** COUNT i; 297:main.c **** 298:main.c **** LoL->os_setver_major = LoL->os_major = MAJOR_RELEASE; 299:main.c **** LoL->os_setver_minor = LoL->os_minor = MINOR_RELEASE; 300:main.c **** 301:main.c **** /* Init oem hook - returns memory size in KB */ 302:main.c **** ram_top = init_oem(); 303:main.c **** 304:main.c **** /* Note: HMA_TEXT and init code already moved higher in 305:main.c **** conventional memory by startup code, however, we still 306:main.c **** need to adjust any references to new location. So use 307:main.c **** current CS as that is where we were moved to and perform 308:main.c **** any fixups needed. Note this will also re-copy the 309:main.c **** HMA_TEXT segment, so be sure not to overwrite it prior 310:main.c **** to the MoveKernel() call. Kernel moved to around 8F??:0000 311:main.c **** */ 312:main.c **** #ifdef __WATCOMC__ 313:main.c **** lpTop = MK_FP(_CS, 0); 314:main.c **** #else 315:main.c **** lpTop = MK_FP(_CS - (FP_OFF(_HMATextEnd) + 15) / 16, 0); 316:main.c **** #endif 317:main.c **** 318:main.c **** MoveKernel(FP_SEG(lpTop)); 319:main.c **** lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0); 320:main.c **** 321:main.c **** /* Initialize IO subsystem */ 322:main.c **** InitIO(); 323:main.c **** InitPrinters(); 324:main.c **** InitSerialPorts(); 325:main.c **** 326:main.c **** init_PSPSet(DOS_PSP); 327:main.c **** set_DTA(MK_FP(DOS_PSP, 0x80)); 328:main.c **** PSPInit(); 329:main.c **** 330:main.c **** Init_clk_driver(); 331:main.c **** 332:main.c **** /* Do first initialization of system variable buffers so that */ 333:main.c **** /* we can read config.sys later. */ 334:main.c **** 335:main.c **** /* use largest possible value for the initial CDS */ 336:main.c **** LoL->lastdrive = 26; 337:main.c **** 338:main.c **** /* init_device((struct dhdr FAR *)&blk_dev, NULL, 0, &ram_top); */ 339:main.c **** /* WARNING: dsk_init() must be called prior to update_dcb() to ensure 340:main.c **** _Dyn (start of Dynamic memory block) is the start of drive data table (see getddt() in dsk.c) 341:main.c **** */ 342:main.c **** blk_dev.dh_name[0] = dsk_init(); 343:main.c **** 344:main.c **** PreConfig(); 345:main.c **** 346:main.c **** /* Number of units */ 347:main.c **** if (blk_dev.dh_name[0] > 0) 348:main.c **** update_dcb(&blk_dev); 349:main.c **** 350:main.c **** /* Now config the temporary file system */ 351:main.c **** FsConfig(); 352:main.c **** 353:main.c **** /* Now process CONFIG.SYS */ 354:main.c **** DoConfig(0); 355:main.c **** DoConfig(1); 356:main.c **** 357:main.c **** /* initialize near data and MCBs */ 358:main.c **** PreConfig2(); 359:main.c **** /* and process CONFIG.SYS one last time for device drivers */ 360:main.c **** DoConfig(2); 361:main.c **** 362:main.c **** 363:main.c **** /* Close all (device) files */ 364:main.c **** for (i = 0; i < 20; i++) 365:main.c **** close(i); 366:main.c **** 367:main.c **** /* and do final buffer allocation. */ 368:main.c **** PostConfig(); 369:main.c **** 370:main.c **** /* Init the file system one more time */ 371:main.c **** FsConfig(); 372:main.c **** 373:main.c **** configDone(); 374:main.c **** 375:main.c **** InitializeAllBPBs(); 376:main.c **** } 377:main.c **** 378:main.c **** STATIC VOID FsConfig(VOID) 379:main.c **** { 380:main.c **** struct dpb FAR *dpb = LoL->DPBp; 381:main.c **** int i; 382:main.c **** 383:main.c **** /* Initialize the current directory structures */ 384:main.c **** for (i = 0; i < LoL->lastdrive; i++) 385:main.c **** { 386:main.c **** struct cds FAR *pcds_table = &LoL->CDSp[i]; 387:main.c **** 388:main.c **** fmemcpy(pcds_table->cdsCurrentPath, "A:\\\0", 4); 389:main.c **** 390:main.c **** pcds_table->cdsCurrentPath[0] += i; 391:main.c **** 392:main.c **** if (i < LoL->nblkdev && (ULONG) dpb != 0xffffffffl) 393:main.c **** { 394:main.c **** pcds_table->cdsDpb = dpb; 395:main.c **** pcds_table->cdsFlags = CDSPHYSDRV; 396:main.c **** dpb = dpb->dpb_next; 397:main.c **** } 398:main.c **** else 399:main.c **** { 400:main.c **** pcds_table->cdsFlags = 0; 401:main.c **** } 402:main.c **** pcds_table->cdsStrtClst = 0xffff; 403:main.c **** pcds_table->cdsParam = 0xffff; 404:main.c **** pcds_table->cdsStoreUData = 0xffff; 405:main.c **** pcds_table->cdsJoinOffset = 2; 406:main.c **** } 407:main.c **** 408:main.c **** /* Log-in the default drive. */ 409:main.c **** init_setdrive(LoL->BootDrive - 1); 410:main.c **** 411:main.c **** /* The system file tables need special handling and are "hand */ 412:main.c **** /* built. Included is the stdin, stdout, stdaux and stdprn. */ 413:main.c **** /* a little bit of shuffling is necessary for compatibility */ 414:main.c **** 415:main.c **** /* sft_idx=0 is /dev/aux */ 416:main.c **** open("AUX", O_RDWR); 417:main.c **** 418:main.c **** /* handle 1, sft_idx=1 is /dev/con (stdout) */ 419:main.c **** open("CON", O_RDWR); 420:main.c **** 421:main.c **** /* 3 is /dev/aux */ 422:main.c **** dup2(STDIN, STDAUX); 423:main.c **** 424:main.c **** /* 0 is /dev/con (stdin) */ 425:main.c **** dup2(STDOUT, STDIN); 426:main.c **** 427:main.c **** /* 2 is /dev/con (stdin) */ 428:main.c **** dup2(STDOUT, STDERR); 429:main.c **** 430:main.c **** /* 4 is /dev/prn */ 431:main.c **** open("PRN", O_WRONLY); 432:main.c **** 433:main.c **** /* Initialize the disk buffer management functions */ 434:main.c **** /* init_call_init_buffers(); done from CONFIG.C */ 435:main.c **** } 436:main.c **** 437:main.c **** STATIC VOID signon() 438:main.c **** { 439:main.c **** if (InitKernelConfig.Verbose < 0) 440:main.c **** { 441:main.c **** #ifdef CUSTOM_BRANDING 442:main.c **** printf("\n" CUSTOM_BRANDING "\n\n"); 443:main.c **** #else 444:main.c **** printf("\n%S\n\n", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release))); 445:main.c **** #endif 446:main.c **** } else { 447:main.c **** #ifdef CUSTOM_BRANDING 448:main.c **** printf("\n" CUSTOM_BRANDING "\n\n%s", copyright); 449:main.c **** #else 450:main.c **** printf("\n%S" 451:main.c **** "Kernel compatibility %d.%d - " 452:main.c **** #if defined(__BORLANDC__) 453:main.c **** "BORLANDC" 454:main.c **** #elif defined(__TURBOC__) 455:main.c **** "TURBOC" 456:main.c **** #elif defined(_MSC_VER) 457:main.c **** "MSC" 458:main.c **** #elif defined(__WATCOMC__) 459:main.c **** "WATCOMC" 460:main.c **** #elif defined(__GNUC__) 461:main.c **** "GNUC" /* this is hypothetical only */ 462:main.c **** #else 463:main.c **** #error Unknown compiler 464:main.c **** generate some bullshit error here, as the compiler should be known 465:main.c **** #endif 466:main.c **** #if defined (I386) 467:main.c **** " - 80386 CPU required" 468:main.c **** #elif defined (I186) 469:main.c **** " - 80186 CPU required" 470:main.c **** #else 471:main.c **** " - 808x compatible" 472:main.c **** #endif 473:main.c **** 474:main.c **** #ifdef WITHFAT32 475:main.c **** " - FAT32 support" 476:main.c **** #endif 477:main.c **** "\n\n%s", 478:main.c **** MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)), 479:main.c **** MAJOR_RELEASE, MINOR_RELEASE, copyright); 480:main.c **** #endif 481:main.c **** } 482:main.c **** } 483:main.c **** 484:main.c **** STATIC void kernel() 485:main.c **** { 486:main.c **** CommandTail Cmd; 487:main.c **** 488:main.c **** if (master_env[0] == '\0') /* some shells panic on empty master env. */ 489:main.c **** fmemcpy(master_env, "PATH=.\0\0\0\0", sizeof("PATH=.\0\0\0\0")); 490:main.c **** 491:main.c **** /* process 0 */ 492:main.c **** /* Execute command.com from the drive we just booted from */ 493:main.c **** memset(Cmd.ctBuffer, 0, sizeof(Cmd.ctBuffer)); 494:main.c **** strcpy(Cmd.ctBuffer, Config.cfgInitTail); 495:main.c **** 496:main.c **** for (Cmd.ctCount = 0; Cmd.ctCount < sizeof(Cmd.ctBuffer); Cmd.ctCount++) 497:main.c **** if (Cmd.ctBuffer[Cmd.ctCount] == '\r') 498:main.c **** break; 499:main.c **** 500:main.c **** /* if stepping CONFIG.SYS (F5/F8), tell COMMAND.COM about it */ 501:main.c **** 502:main.c **** /* 3 for string + 2 for "\r\n" */ 503:main.c **** if (Cmd.ctCount < sizeof(Cmd.ctBuffer) - 5) 504:main.c **** { 505:main.c **** char *insertString = NULL; 506:main.c **** 507:main.c **** if (singleStep) 508:main.c **** insertString = " /Y"; /* single step AUTOEXEC */ 509:main.c **** 510:main.c **** if (SkipAllConfig) 511:main.c **** insertString = " /D"; /* disable AUTOEXEC */ 512:main.c **** 513:main.c **** if (insertString) 514:main.c **** { 515:main.c **** 516:main.c **** /* insert /D, /Y as first argument */ 517:main.c **** char *p, *q; 518:main.c **** 519:main.c **** for (p = Cmd.ctBuffer; p < &Cmd.ctBuffer[Cmd.ctCount]; p++) 520:main.c **** { 521:main.c **** if (*p == ' ' || *p == '\t' || *p == '\r') 522:main.c **** { 523:main.c **** for (q = &Cmd.ctBuffer[Cmd.ctCount + 1]; q >= p; q--) 524:main.c **** q[3] = q[0]; 525:main.c **** memcpy(p, insertString, 3); 526:main.c **** break; 527:main.c **** } 528:main.c **** } 529:main.c **** /* save buffer -- on the stack it's fine here */ 530:main.c **** Config.cfgInitTail = Cmd.ctBuffer; 531:main.c **** } 532:main.c **** } 533:main.c **** init_call_p_0(&Config); /* go execute process 0 (the shell) */ 534:main.c **** } 535:main.c **** 536:main.c **** /* check for a block device and update device control block */ 537:main.c **** STATIC VOID update_dcb(struct dhdr FAR * dhp) 538:main.c **** { 15 .loc 1 538 0 16 _.LVL0: 0 000004E9 56 push si 0 000004EA 57 push di 0 000004EB 55 push bp 20 _.LCFI0: 0 000004EC 89E5 mov bp, sp 22 _.LCFI1: 0 000004EE 83EC0E sub sp, 14 0 000004F1 8B4608 mov ax, word ptr [bp+8] 0 000004F4 8946F4 mov word ptr [bp-12], ax 0 000004F7 8B460A mov ax, word ptr [bp+10] 0 000004FA 8946F2 mov word ptr [bp-14], ax 539:main.c **** REG COUNT Index; 540:main.c **** COUNT nunits = dhp->dh_name[0]; 28 .loc 1 540 0 0 000004FD 8EC0 mov es, ax 0 000004FF 8B5EF4 mov bx, word ptr [bp-12] 0 00000502 268A470A mov al, byte ptr es:[bx+10] 0 00000506 8846FF mov byte ptr [bp-1], al 0 00000509 8846F8 mov byte ptr [bp-8], al 34 _.LVL1: 541:main.c **** struct dpb FAR *dpb; 542:main.c **** 543:main.c **** /* printf("nblkdev = %i\n", LoL->nblkdev); */ 544:main.c **** 545:main.c **** /* if no units, nothing to do, ensure at least 1 unit for rest of logic */ 546:main.c **** if (nunits == 0) return; 35 .loc 1 546 0 0 0000050C 8166F8FF00 and word ptr [bp-8], 255 0 00000511 7503E9E400 je _.L1 547:main.c **** 548:main.c **** /* allocate memory for new device control blocks, insert into chain [at end], and update our poin 549:main.c **** if ( LoL->first_mcb ) { 38 .loc 1 549 0 0 00000516 36C41E[0000] les bx, dword ptr ss:[_LoL] 0 0000051B 26837F2400 cmp word ptr es:[bx+36], 0 0 00000520 7503E9DF00 je _.L3 550:main.c **** dpb = (struct dpb FAR *)KernelAlloc(nunits * sizeof(struct dpb), 'E', Config.cfgDosDataUmb); 42 .loc 1 550 0 0 00000525 A0[0000] mov al, byte ptr [_Config] 44 _.LVL2: 0 00000528 30E4 xor ah, ah 0 0000052A 50 push ax 0 0000052B B045 mov al, 69 0 0000052D 50 push ax 0 0000052E B03D mov al, 61 0 00000530 F666FF mul byte ptr [bp-1] 0 00000533 50 push ax 0 00000534 E8[FEFF] call _KernelAlloc 53 _.LVL3: 54 _.L20: 551:main.c **** } 552:main.c **** else { 553:main.c **** dpb = DynAlloc("DPBp", blk_dev.dh_name[0], sizeof(struct dpb)); 55 .loc 1 553 0 0 00000537 91 xchg cx, ax 57 _.LVL4: 554:main.c **** } 555:main.c **** 556:main.c **** /* find end of dpb chain or initialize root if needed */ 557:main.c **** if (LoL->nblkdev == 0) 58 .loc 1 557 0 0 00000538 36C436[0000] les si, dword ptr ss:[_LoL] 0 0000053D 26807C4600 cmp byte ptr es:[si+70], 0 0 00000542 7403E9D700 jne _.L5 558:main.c **** { 559:main.c **** /* update root pointer to new end (our just allocated block) */ 560:main.c **** LoL->DPBp = dpb; 62 .loc 1 560 0 0 00000547 26894C26 mov word ptr es:[si+38], cx 64 _.LVL5: 0 0000054B 26895428 mov word ptr es:[si+40], dx 66 _.L6: 67 _.LBB42: 561:main.c **** } 562:main.c **** else 563:main.c **** { 564:main.c **** struct dpb FAR *tmp_dpb; 565:main.c **** /* find current end of dpb chain by following next pointers to end */ 566:main.c **** for (tmp_dpb = LoL->DPBp; (ULONG) tmp_dpb->dpb_next != 0xffffffffl; tmp_dpb = tmp_dpb->dpb_next 68 .loc 1 566 0 0 0000054F 89CB mov bx, cx 0 00000551 C746FC0000 mov word ptr [bp-4], 0 71 _.LVL6: 72 _.L10: 73 _.LBE42: 567:main.c **** ; 568:main.c **** /* insert into chain [at end] */ 569:main.c **** tmp_dpb->dpb_next = dpb; 570:main.c **** } 571:main.c **** /* dpb points to last block, one just allocated */ 572:main.c **** 573:main.c **** for (Index = 0; Index < nunits; Index++) 574:main.c **** { 575:main.c **** /* printf("processing unit %i of %i nunits\n", Index, nunits); */ 576:main.c **** dpb->dpb_next = dpb + 1; /* memory allocated as array, so next is just next element */ 74 .loc 1 576 0 0 00000556 89D8 mov ax, bx 0 00000558 83C03D add ax, 61 0 0000055B 8946F6 mov word ptr [bp-10], ax 0 0000055E 8EDA mov ds, dx 0 00000560 894719 mov word ptr [bx+25], ax 80 _.LVL7: 0 00000563 89571B mov word ptr [bx+27], dx 577:main.c **** dpb->dpb_unit = LoL->nblkdev; 82 .loc 1 577 0 0 00000566 36C536[0000] lds si, dword ptr ss:[_LoL] 0 0000056B 8A4446 mov al, byte ptr [si+70] 0 0000056E 8EDA mov ds, dx 0 00000570 8807 mov byte ptr [bx], al 578:main.c **** dpb->dpb_subunit = Index; 87 .loc 1 578 0 0 00000572 8A46FC mov al, byte ptr [bp-4] 0 00000575 884701 mov byte ptr [bx+1], al 579:main.c **** dpb->dpb_device = dhp; 90 .loc 1 579 0 0 00000578 8B46F4 mov ax, word ptr [bp-12] 0 0000057B 894713 mov word ptr [bx+19], ax 0 0000057E 8B46F2 mov ax, word ptr [bp-14] 0 00000581 894715 mov word ptr [bx+21], ax 580:main.c **** dpb->dpb_flags = M_CHANGED; 95 .loc 1 580 0 0 00000584 C64718FF mov byte ptr [bx+24], -1 581:main.c **** if ((LoL->CDSp != 0) && (LoL->nblkdev < LoL->lastdrive)) 97 .loc 1 581 0 0 00000588 36C53E[0000] lds di, dword ptr ss:[_LoL] 0 0000058D 8B453E mov ax, word ptr [di+62] 0 00000590 8946FA mov word ptr [bp-6], ax 0 00000593 8B753C mov si, word ptr [di+60] 0 00000596 09F0 or ax, si 0 00000598 7436 je _.L8 0 0000059A 8A4546 mov al, byte ptr [di+70] 0 0000059D 3A4547 cmp al, byte ptr [di+71] 0 000005A0 732E jnc _.L8 582:main.c **** { 583:main.c **** LoL->CDSp[LoL->nblkdev].cdsDpb = dpb; 107 .loc 1 583 0 0 000005A2 B458 mov ah, 88 0 000005A4 F6E4 mul ah 0 000005A6 01C6 add si, ax 0 000005A8 8E46FA mov es, word ptr [bp-6] 0 000005AB 26895C45 mov word ptr es:[si+69], bx 0 000005AF 8E46FA mov es, word ptr [bp-6] 0 000005B2 26895447 mov word ptr es:[si+71], dx 584:main.c **** LoL->CDSp[LoL->nblkdev].cdsFlags = CDSPHYSDRV; 115 .loc 1 584 0 0 000005B6 8A4546 mov al, byte ptr [di+70] 0 000005B9 B458 mov ah, 88 0 000005BB F6E4 mul ah 0 000005BD 8B5D3E mov bx, word ptr [di+62] 120 _.LVL8: 0 000005C0 895EFA mov word ptr [bp-6], bx 0 000005C3 03453C add ax, word ptr [di+60] 0 000005C6 93 xchg bx, ax 0 000005C7 8E46FA mov es, word ptr [bp-6] 0 000005CA 26C747430040 mov word ptr es:[bx+67], 16384 126 _.L8: 585:main.c **** } 586:main.c **** 587:main.c **** ++dpb; /* dbp = dbp->dpb_next; */ 588:main.c **** ++LoL->nblkdev; 127 .loc 1 588 0 discriminator 2 0 000005D0 FE4546 inc byte ptr [di+70] 573:main.c **** { 129 .loc 1 573 0 discriminator 2 0 000005D3 FF46FC inc word ptr [bp-4] 131 _.LVL9: 576:main.c **** dpb->dpb_unit = LoL->nblkdev; 132 .loc 1 576 0 discriminator 2 0 000005D6 8B5EF6 mov bx, word ptr [bp-10] 573:main.c **** { 134 .loc 1 573 0 discriminator 2 0 000005D9 8B46FC mov ax, word ptr [bp-4] 0 000005DC 3946F8 cmp word ptr [bp-8], ax 0 000005DF 7E03E972FF jg _.L10 589:main.c **** } 590:main.c **** /* note that always at least 1 valid dpb due to above early exit if nunits==0 */ 591:main.c **** (dpb - 1)->dpb_next = (void FAR *)0xFFFFFFFFl; 138 .loc 1 591 0 0 000005E4 B03D mov al, 61 0 000005E6 F666FF mul byte ptr [bp-1] 0 000005E9 01C8 add ax, cx 0 000005EB 93 xchg bx, ax 0 000005EC 8EC2 mov es, dx 0 000005EE 26C747DCFFFF mov word ptr es:[bx-36], -1 145 _.LVL10: 0 000005F4 26C747DEFFFF mov word ptr es:[bx-34], -1 147 _.L1: 592:main.c **** 593:main.c **** /* printf("processed %i nunits\n", nunits); */ 594:main.c **** } 148 .loc 1 594 0 0 000005FA 89EC mov sp, bp 0 000005FC 5D pop bp 0 000005FD 5F pop di 0 000005FE 5E pop si 0 000005FF 16 push ss 0 00000600 1F pop ds 0 00000601 C20400 ret 4 156 _.LVL11: 157 _.L3: 553:main.c **** } 158 .loc 1 553 0 0 00000604 B83D00 mov ax, 61 160 _.LVL12: 0 00000607 50 push ax 0 00000608 B8[0000] mov ax, offset _blk_dev@OZSEG16 0 0000060B 8EC0 mov es, ax 0 0000060D 26A0[0A00] mov al, byte ptr es:[_blk_dev+10] 0 00000611 30E4 xor ah, ah 0 00000613 50 push ax 0 00000614 B8[0000] mov ax, offset _.LC0 0 00000617 50 push ax 0 00000618 E8[FEFF] call _DynAlloc 170 _.LVL13: 0 0000061B E919FF jmp _.L20 172 _.LVL14: 173 _.L5: 174 _.LBB43: 566:main.c **** ; 175 .loc 1 566 0 0 0000061E 268B5C26 mov bx, word ptr es:[si+38] 0 00000622 268B4428 mov ax, word ptr es:[si+40] 178 _.LVL15: 179 _.L7: 566:main.c **** ; 180 .loc 1 566 0 is_stmt 0 discriminator 1 0 00000626 8EC0 mov es, ax 0 00000628 268B7F19 mov di, word ptr es:[bx+25] 0 0000062C 268B771B mov si, word ptr es:[bx+27] 0 00000630 83FFFF cmp di, -1 0 00000633 7510 jne _.L11 0 00000635 83FEFF cmp si, -1 0 00000638 750B jne _.L11 569:main.c **** } 188 .loc 1 569 0 is_stmt 1 0 0000063A 26894F19 mov word ptr es:[bx+25], cx 190 _.LVL16: 0 0000063E 2689571B mov word ptr es:[bx+27], dx 0 00000642 E90AFF jmp _.L6 193 _.LVL17: 194 _.L11: 566:main.c **** ; 195 .loc 1 566 0 0 00000645 89FB mov bx, di 197 _.LVL18: 0 00000647 96 xchg si, ax 0 00000648 EBDC jmp _.L7 200 _.LBE43: 201 _.LFE14: 202 .size _update_dcb, .-_update_dcb === Switch to base=012BB0h -> ".RODATA" 203 .section .rodata 204 _.LC1: 0 00000619 413A5C00 .string "A:\\" 0 0000061D 00 .string "" === Switch to base=012BB0h -> ".RODATA.STR1.1" 207 .section .rodata.str1.1 208 _.LC2: 0 0000063E 41555800 .string "AUX" 210 _.LC3: 0 00000642 434F4E00 .string "CON" 212 _.LC4: 0 00000646 50524E00 .string "PRN" === Switch to base=002270h -> ".TEXT" 214 .text 215 .type _FsConfig, @function 216 _FsConfig: 217 _.LFB11: 379:main.c **** struct dpb FAR *dpb = LoL->DPBp; 218 .loc 1 379 0 0 0000064A 56 push si 0 0000064B 57 push di 0 0000064C 55 push bp 222 _.LCFI2: 0 0000064D 89E5 mov bp, sp 224 _.LCFI3: 0 0000064F 83EC08 sub sp, 8 380:main.c **** int i; 226 .loc 1 380 0 0 00000652 36C41E[0000] les bx, dword ptr ss:[_LoL] 0 00000657 268B4726 mov ax, word ptr es:[bx+38] 0 0000065B 268B4F28 mov cx, word ptr es:[bx+40] 230 _.LVL19: 384:main.c **** { 231 .loc 1 384 0 0 0000065F C746F80000 mov word ptr [bp-8], 0 233 _.LVL20: 234 _.L22: 384:main.c **** { 235 .loc 1 384 0 is_stmt 0 discriminator 1 0 00000664 36C51E[0000] lds bx, dword ptr ss:[_LoL] 0 00000669 8A5747 mov dl, byte ptr [bx+71] 0 0000066C 30F6 xor dh, dh 0 0000066E 3956F8 cmp word ptr [bp-8], dx 0 00000671 7C46 jl _.L26 409:main.c **** 241 .loc 1 409 0 is_stmt 1 0 00000673 8A4769 mov al, byte ptr [bx+105] 243 _.LVL21: 0 00000676 30E4 xor ah, ah 0 00000678 48 dec ax 0 00000679 50 push ax 0 0000067A 16 push ss 0 0000067B 1F pop ds 0 0000067C E8[FEFF] call _init_setdrive 250 _.LVL22: 416:main.c **** 251 .loc 1 416 0 0 0000067F BE0200 mov si, 2 0 00000682 56 push si 0 00000683 B8[0500] mov ax, offset _.LC2 0 00000686 50 push ax 0 00000687 E8[FEFF] call _init_DosOpen 257 _.LVL23: 419:main.c **** 258 .loc 1 419 0 0 0000068A 56 push si 0 0000068B B8[0900] mov ax, offset _.LC3 0 0000068E 50 push ax 0 0000068F E8[FEFF] call _init_DosOpen 263 _.LVL24: 422:main.c **** 264 .loc 1 422 0 0 00000692 B80300 mov ax, 3 0 00000695 50 push ax 0 00000696 31C0 xor ax, ax 0 00000698 50 push ax 0 00000699 E8[FEFF] call _dup2 270 _.LVL25: 425:main.c **** 271 .loc 1 425 0 0 0000069C 31C0 xor ax, ax 0 0000069E 50 push ax 0 0000069F BF0100 mov di, 1 0 000006A2 57 push di 0 000006A3 E8[FEFF] call _dup2 277 _.LVL26: 428:main.c **** 278 .loc 1 428 0 0 000006A6 56 push si 0 000006A7 57 push di 0 000006A8 E8[FEFF] call _dup2 282 _.LVL27: 431:main.c **** 283 .loc 1 431 0 0 000006AB 57 push di 0 000006AC B8[0D00] mov ax, offset _.LC4 0 000006AF 50 push ax 0 000006B0 E8[FEFF] call _init_DosOpen 288 _.LVL28: 435:main.c **** 289 .loc 1 435 0 0 000006B3 89EC mov sp, bp 0 000006B5 5D pop bp 292 _.LVL29: 0 000006B6 5F pop di 0 000006B7 5E pop si 0 000006B8 C3 ret 296 _.LVL30: 297 _.L26: 0 000006B9 894EFE mov word ptr [bp-2], cx 0 000006BC 8946FC mov word ptr [bp-4], ax 300 _.LBB44: 386:main.c **** 301 .loc 1 386 0 0 000006BF B85800 mov ax, 88 303 _.LVL31: 0 000006C2 F766F8 mul word ptr [bp-8] 0 000006C5 8B773E mov si, word ptr [bx+62] 0 000006C8 03473C add ax, word ptr [bx+60] 307 _.LVL32: 388:main.c **** 308 .loc 1 388 0 0 000006CB BA0400 mov dx, 4 0 000006CE 52 push dx 0 000006CF 16 push ss 0 000006D0 BA[0000] mov dx, offset _.LC1 0 000006D3 52 push dx 0 000006D4 56 push si 0 000006D5 50 push ax 0 000006D6 8946FA mov word ptr [bp-6], ax 0 000006D9 16 push ss 0 000006DA 1F pop ds 0 000006DB E8[FEFF] call _init_fmemcpy 320 _.LVL33: 390:main.c **** 321 .loc 1 390 0 0 000006DE 8EC6 mov es, si 0 000006E0 8B5EFA mov bx, word ptr [bp-6] 0 000006E3 8A66F8 mov ah, byte ptr [bp-8] 0 000006E6 260027 add byte ptr es:[bx], ah 326 _.LVL34: 392:main.c **** { 327 .loc 1 392 0 0 000006E9 36C43E[0000] les di, dword ptr ss:[_LoL] 0 000006EE 268A5546 mov dl, byte ptr es:[di+70] 0 000006F2 30F6 xor dh, dh 0 000006F4 3956F8 cmp word ptr [bp-8], dx 0 000006F7 8B46FC mov ax, word ptr [bp-4] 0 000006FA 8B4EFE mov cx, word ptr [bp-2] 0 000006FD 7D47 jge _.L23 392:main.c **** { 335 .loc 1 392 0 is_stmt 0 discriminator 1 0 000006FF 83F8FF cmp ax, -1 0 00000702 7505 jne _.L27 0 00000704 83F9FF cmp cx, -1 0 00000707 743D je _.L23 340 _.L27: 394:main.c **** pcds_table->cdsFlags = CDSPHYSDRV; 341 .loc 1 394 0 is_stmt 1 0 00000709 8EC6 mov es, si 0 0000070B 26894745 mov word ptr es:[bx+69], ax 0 0000070F 26894F47 mov word ptr es:[bx+71], cx 395:main.c **** dpb = dpb->dpb_next; 345 .loc 1 395 0 0 00000713 26C747430040 mov word ptr es:[bx+67], 16384 396:main.c **** } 347 .loc 1 396 0 0 00000719 89C2 mov dx, ax 0 0000071B 8EC1 mov es, cx 0 0000071D 97 xchg di, ax 0 0000071E 268B4519 mov ax, word ptr es:[di+25] 0 00000722 268B4D1B mov cx, word ptr es:[di+27] 353 _.LVL35: 354 _.L25: 402:main.c **** pcds_table->cdsParam = 0xffff; 355 .loc 1 402 0 discriminator 2 0 00000726 8EC6 mov es, si 0 00000728 26C74749FFFF mov word ptr es:[bx+73], -1 403:main.c **** pcds_table->cdsStoreUData = 0xffff; 358 .loc 1 403 0 discriminator 2 0 0000072E 26C7474BFFFF mov word ptr es:[bx+75], -1 404:main.c **** pcds_table->cdsJoinOffset = 2; 360 .loc 1 404 0 discriminator 2 0 00000734 26C7474DFFFF mov word ptr es:[bx+77], -1 405:main.c **** } 362 .loc 1 405 0 discriminator 2 0 0000073A 26C7474F0200 mov word ptr es:[bx+79], 2 364 _.LBE44: 384:main.c **** { 365 .loc 1 384 0 discriminator 2 0 00000740 FF46F8 inc word ptr [bp-8] 367 _.LVL36: 0 00000743 E91EFF jmp _.L22 369 _.LVL37: 370 _.L23: 371 _.LBB45: 400:main.c **** } 372 .loc 1 400 0 0 00000746 8EC6 mov es, si 0 00000748 26C747430000 mov word ptr es:[bx+67], 0 0 0000074E EBD6 jmp _.L25 376 _.LBE45: 377 _.LFE11: 378 .size _FsConfig, .-_FsConfig 379 .type _EmulatedDriveStatus.constprop.0, @function 380 _EmulatedDriveStatus.constprop.0: 381 _.LFB22: 595:main.c **** 596:main.c **** /* If cmdLine is NULL, this is an internal driver */ 597:main.c **** 598:main.c **** BOOL init_device(struct dhdr FAR * dhp, char *cmdLine, COUNT mode, 599:main.c **** char FAR **r_top) 600:main.c **** { 601:main.c **** request rq; 602:main.c **** char name[8]; 603:main.c **** 604:main.c **** if (cmdLine) { 605:main.c **** char *p, *q, ch; 606:main.c **** int i; 607:main.c **** 608:main.c **** p = q = cmdLine; 609:main.c **** for (;;) 610:main.c **** { 611:main.c **** ch = *p; 612:main.c **** if (ch == '\0' || ch == ' ' || ch == '\t') 613:main.c **** break; 614:main.c **** p++; 615:main.c **** if (ch == '\\' || ch == '/' || ch == ':') 616:main.c **** q = p; /* remember position after path */ 617:main.c **** } 618:main.c **** for (i = 0; i < 8; i++) { 619:main.c **** ch = '\0'; 620:main.c **** if (p != q && *q != '.') 621:main.c **** ch = *q++; 622:main.c **** /* copy name, without extension */ 623:main.c **** name[i] = ch; 624:main.c **** } 625:main.c **** } 626:main.c **** 627:main.c **** rq.r_unit = 0; 628:main.c **** rq.r_status = 0; 629:main.c **** rq.r_command = C_INIT; 630:main.c **** rq.r_length = sizeof(request); 631:main.c **** rq.r_endaddr = *r_top; 632:main.c **** rq.r_bpbptr = (void FAR *)(cmdLine ? cmdLine : "\n"); 633:main.c **** rq.r_firstunit = LoL->nblkdev; 634:main.c **** 635:main.c **** execrh((request FAR *) & rq, dhp); 636:main.c **** 637:main.c **** /* 638:main.c **** * Added needed Error handle 639:main.c **** */ 640:main.c **** if ((rq.r_status & (S_ERROR | S_DONE)) == S_ERROR) 641:main.c **** return TRUE; 642:main.c **** 643:main.c **** if (cmdLine) 644:main.c **** { 645:main.c **** /* Don't link in device drivers which do not take up memory */ 646:main.c **** if (rq.r_endaddr == (BYTE FAR *) dhp) 647:main.c **** return TRUE; 648:main.c **** 649:main.c **** /* Don't link in block device drivers which indicate no units */ 650:main.c **** if (!(dhp->dh_attr & ATTR_CHAR) && !rq.r_nunits) 651:main.c **** { 652:main.c **** rq.r_endaddr = (BYTE FAR *) dhp; 653:main.c **** return TRUE; 654:main.c **** } 655:main.c **** 656:main.c **** 657:main.c **** /* Fix for multisegmented device drivers: */ 658:main.c **** /* If there are multiple device drivers in a single driver file, */ 659:main.c **** /* only the END ADDRESS returned by the last INIT call should be */ 660:main.c **** /* the used. It is recommended that all the device drivers in */ 661:main.c **** /* the file return the same address */ 662:main.c **** 663:main.c **** if (FP_OFF(dhp->dh_next) == 0xffff) 664:main.c **** { 665:main.c **** KernelAllocPara(FP_SEG(rq.r_endaddr) + (FP_OFF(rq.r_endaddr) + 15)/16 666:main.c **** - FP_SEG(dhp), 'D', name, mode); 667:main.c **** } 668:main.c **** 669:main.c **** /* Another fix for multisegmented device drivers: */ 670:main.c **** /* To help emulate the functionallity experienced with other DOS */ 671:main.c **** /* operating systems when calling multiple device drivers in a */ 672:main.c **** /* single driver file, save the end address returned from the */ 673:main.c **** /* last INIT call which will then be passed as the end address */ 674:main.c **** /* for the next INIT call. */ 675:main.c **** 676:main.c **** *r_top = (char FAR *)rq.r_endaddr; 677:main.c **** } 678:main.c **** 679:main.c **** if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) 680:main.c **** { 681:main.c **** dhp->dh_name[0] = rq.r_nunits; 682:main.c **** update_dcb(dhp); 683:main.c **** } 684:main.c **** 685:main.c **** if (dhp->dh_attr & ATTR_CONIN) 686:main.c **** LoL->syscon = dhp; 687:main.c **** else if (dhp->dh_attr & ATTR_CLOCK) 688:main.c **** LoL->clock = dhp; 689:main.c **** 690:main.c **** return FALSE; 691:main.c **** } 692:main.c **** 693:main.c **** STATIC void InitIO(void) 694:main.c **** { 695:main.c **** struct dhdr far *device = &LoL->nul_dev; 696:main.c **** 697:main.c **** /* Initialize driver chain */ 698:main.c **** do { 699:main.c **** init_device(device, NULL, 0, &lpTop); 700:main.c **** device = device->dh_next; 701:main.c **** } 702:main.c **** while (FP_OFF(device) != 0xffff); 703:main.c **** } 704:main.c **** 705:main.c **** /* issue an internal error message */ 706:main.c **** VOID init_fatal(BYTE * err_msg) 707:main.c **** { 708:main.c **** printf("\nInternal kernel error - %s\nSystem halted\n", err_msg); 709:main.c **** for (;;) ; 710:main.c **** } 711:main.c **** 712:main.c **** /* 713:main.c **** Initialize all printers 714:main.c **** 715:main.c **** this should work. IMHO, this might also be done on first use 716:main.c **** of printer, as I never liked the noise by a resetting printer, and 717:main.c **** I usually much more often reset my system, then I print :-) 718:main.c **** */ 719:main.c **** 720:main.c **** STATIC VOID InitPrinters(VOID) 721:main.c **** { 722:main.c **** iregs r; 723:main.c **** int num_printers, i; 724:main.c **** 725:main.c **** init_call_intr(0x11, &r); /* get equipment list */ 726:main.c **** 727:main.c **** num_printers = (r.a.x >> 14) & 3; /* bits 15-14 */ 728:main.c **** 729:main.c **** for (i = 0; i < num_printers; i++) 730:main.c **** { 731:main.c **** r.a.x = 0x0100; /* initialize printer */ 732:main.c **** r.d.x = i; 733:main.c **** init_call_intr(0x17, &r); 734:main.c **** } 735:main.c **** } 736:main.c **** 737:main.c **** STATIC VOID InitSerialPorts(VOID) 738:main.c **** { 739:main.c **** iregs r; 740:main.c **** int serial_ports, i; 741:main.c **** 742:main.c **** init_call_intr(0x11, &r); /* get equipment list */ 743:main.c **** 744:main.c **** serial_ports = (r.a.x >> 9) & 7; /* bits 11-9 */ 745:main.c **** 746:main.c **** for (i = 0; i < serial_ports; i++) 747:main.c **** { 748:main.c **** r.a.x = 0xA3; /* initialize serial port to 2400,n,8,1 */ 749:main.c **** r.d.x = i; 750:main.c **** init_call_intr(0x14, &r); 751:main.c **** } 752:main.c **** } 753:main.c **** 754:main.c **** /***************************************************************** 755:main.c **** if kernel.config.BootHarddiskSeconds is set, 756:main.c **** the default is to boot from harddisk, because 757:main.c **** the user is assumed to just have forgotten to 758:main.c **** remove the floppy/bootable CD from the drive. 759:main.c **** 760:main.c **** user has some seconds to hit ANY key to continue 761:main.c **** to boot from floppy/cd, else the system is 762:main.c **** booted from HD 763:main.c **** */ 764:main.c **** 765:main.c **** STATIC int EmulatedDriveStatus(int drive,char statusOnly) 382 .loc 1 765 0 383 _.LVL38: 0 00000750 55 push bp 385 _.LCFI4: 0 00000751 89E5 mov bp, sp 387 _.LCFI5: 0 00000753 83EC2C sub sp, 44 389 _.LVL39: 766:main.c **** { 767:main.c **** iregs r; 768:main.c **** char buffer[0x13]; 769:main.c **** buffer[0] = 0x13; 390 .loc 1 769 0 0 00000756 C646D513 mov byte ptr [bp-43], 19 770:main.c **** 771:main.c **** r.a.b.h = 0x4b; /* bootable CDROM - get status */ 772:main.c **** r.a.b.l = statusOnly; 392 .loc 1 772 0 0 0000075A C746E8004B mov word ptr [bp-24], 19200 773:main.c **** r.d.b.l = (char)drive; 394 .loc 1 773 0 0 0000075F 8B4604 mov ax, word ptr [bp+4] 0 00000762 8846EE mov byte ptr [bp-18], al 774:main.c **** r.si = (int)buffer; 397 .loc 1 774 0 0 00000765 8D46D5 lea ax, [-43+bp] 0 00000768 8946F0 mov word ptr [bp-16], ax 775:main.c **** init_call_intr(0x13, &r); 400 .loc 1 775 0 0 0000076B 8D46E8 lea ax, [-24+bp] 0 0000076E 50 push ax 0 0000076F B81300 mov ax, 19 0 00000772 50 push ax 0 00000773 E8[FEFF] call _init_call_intr 406 _.LVL40: 776:main.c **** 777:main.c **** if (r.flags & 1) 778:main.c **** return FALSE; 407 .loc 1 778 0 0 00000776 8B46FE mov ax, word ptr [bp-2] 0 00000779 F7D0 not ax 0 0000077B 83E001 and ax, 1 779:main.c **** 780:main.c **** return TRUE; 781:main.c **** } 411 .loc 1 781 0 0 0000077E 89EC mov sp, bp 0 00000780 5D pop bp 0 00000781 C20200 ret 2 415 _.LFE22: 416 .size _EmulatedDriveStatus.constprop.0, .-_EmulatedDriveStatus.constprop.0 417 .global _InitializeAllBPBs 418 .type _InitializeAllBPBs, @function 419 _InitializeAllBPBs: 420 _.LFB5: 154:main.c **** static char filename[] = "A:-@JUNK@-.TMP"; 421 .loc 1 154 0 422 _.LVL41: 157:main.c **** { 423 .loc 1 157 0 0 00000784 BA4300 mov dx, 67 425 _.LVL42: 0 00000787 C41E[0000] les bx, dword ptr [_LoL] 0 0000078B 268A4746 mov al, byte ptr es:[bx+70] 0 0000078F 30E4 xor ah, ah 0 00000791 83C040 add ax, 64 0 00000794 39C2 cmp dx, ax 0 00000796 7E01 jle _.L37 432 _.L38: 0 00000798 C3 ret 434 _.L37: 154:main.c **** static char filename[] = "A:-@JUNK@-.TMP"; 435 .loc 1 154 0 0 00000799 55 push bp 437 _.LCFI6: 0 0000079A 89E5 mov bp, sp 439 _.LCFI7: 0 0000079C 1E push ds 441 _.L34: 159:main.c **** if ((fileno = open(filename, O_RDONLY)) >= 0) 442 .loc 1 159 0 0 0000079D BB[0000] mov bx, offset _filename.1897 0 000007A0 8817 mov byte ptr [bx], dl 0 000007A2 8956FE mov word ptr [bp-2], dx 160:main.c **** close(fileno); 446 .loc 1 160 0 0 000007A5 31C0 xor ax, ax 0 000007A7 50 push ax 0 000007A8 53 push bx 0 000007A9 E8[FEFF] call _init_DosOpen 451 _.LVL43: 0 000007AC 85C0 test ax, ax 0 000007AE 8B56FE mov dx, word ptr [bp-2] 0 000007B1 7C07 jl _.L33 161:main.c **** } 455 .loc 1 161 0 0 000007B3 50 push ax 0 000007B4 E8[FEFF] call _close 458 _.LVL44: 0 000007B7 8B56FE mov dx, word ptr [bp-2] 460 _.L33: 157:main.c **** { 461 .loc 1 157 0 discriminator 2 0 000007BA 42 inc dx 463 _.LVL45: 0 000007BB C41E[0000] les bx, dword ptr [_LoL] 0 000007BF 268A4746 mov al, byte ptr es:[bx+70] 0 000007C3 30E4 xor ah, ah 0 000007C5 83C040 add ax, 64 0 000007C8 39C2 cmp dx, ax 0 000007CA 7ED1 jle _.L34 163:main.c **** 470 .loc 1 163 0 0 000007CC 89EC mov sp, bp 0 000007CE 5D pop bp 0 000007CF EBC7 jmp _.L38 474 _.LFE5: 475 .size _InitializeAllBPBs, .-_InitializeAllBPBs 476 .global _init_getvec 477 .type _init_getvec, @function 478 _init_getvec: 479 _.LFB7: 230:main.c **** intvec iv; 480 .loc 1 230 0 481 _.LVL46: 0 000007D1 89E3 mov bx, sp 483 _.LCFI8: 484 _.LBB46: 485 _.LBB47: 486 .file 2 "../hdr/portab.h" 1:../hdr/portab.h **** /****************************************************************/ 2:../hdr/portab.h **** /* */ 3:../hdr/portab.h **** /* portab.h */ 4:../hdr/portab.h **** /* */ 5:../hdr/portab.h **** /* DOS-C portability typedefs, etc. */ 6:../hdr/portab.h **** /* */ 7:../hdr/portab.h **** /* May 1, 1995 */ 8:../hdr/portab.h **** /* */ 9:../hdr/portab.h **** /* Copyright (c) 1995 */ 10:../hdr/portab.h **** /* Pasquale J. Villani */ 11:../hdr/portab.h **** /* All Rights Reserved */ 12:../hdr/portab.h **** /* */ 13:../hdr/portab.h **** /* This file is part of DOS-C. */ 14:../hdr/portab.h **** /* */ 15:../hdr/portab.h **** /* DOS-C is free software; you can redistribute it and/or */ 16:../hdr/portab.h **** /* modify it under the terms of the GNU General Public License */ 17:../hdr/portab.h **** /* as published by the Free Software Foundation; either version */ 18:../hdr/portab.h **** /* 2, or (at your option) any later version. */ 19:../hdr/portab.h **** /* */ 20:../hdr/portab.h **** /* DOS-C is distributed in the hope that it will be useful, but */ 21:../hdr/portab.h **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 22:../hdr/portab.h **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 23:../hdr/portab.h **** /* the GNU General Public License for more details. */ 24:../hdr/portab.h **** /* */ 25:../hdr/portab.h **** /* You should have received a copy of the GNU General Public */ 26:../hdr/portab.h **** /* License along with DOS-C; see the file COPYING. If not, */ 27:../hdr/portab.h **** /* write to the Free Software Foundation, 675 Mass Ave, */ 28:../hdr/portab.h **** /* Cambridge, MA 02139, USA. */ 29:../hdr/portab.h **** /****************************************************************/ 30:../hdr/portab.h **** 31:../hdr/portab.h **** #ifdef MAIN 32:../hdr/portab.h **** #ifdef VERSION_STRINGS 33:../hdr/portab.h **** static char *portab_hRcsId = 34:../hdr/portab.h **** "$Id: portab.h 1121 2005-03-15 15:25:08Z perditionc $"; 35:../hdr/portab.h **** #endif 36:../hdr/portab.h **** #endif 37:../hdr/portab.h **** 38:../hdr/portab.h **** /****************************************************************/ 39:../hdr/portab.h **** /* */ 40:../hdr/portab.h **** /* Machine dependant portable types. Note that this section is */ 41:../hdr/portab.h **** /* used primarily for segmented architectures. Common types and */ 42:../hdr/portab.h **** /* types used relating to segmented operations are found here. */ 43:../hdr/portab.h **** /* */ 44:../hdr/portab.h **** /* Be aware that segmented architectures impose on linear */ 45:../hdr/portab.h **** /* architectures because they require special types to be used */ 46:../hdr/portab.h **** /* throught the code that must be reduced to empty preprocessor */ 47:../hdr/portab.h **** /* replacements in the linear machine. */ 48:../hdr/portab.h **** /* */ 49:../hdr/portab.h **** /* #ifdef */ 50:../hdr/portab.h **** /* # define FAR far */ 51:../hdr/portab.h **** /* # define NEAR near */ 52:../hdr/portab.h **** /* #endif */ 53:../hdr/portab.h **** /* */ 54:../hdr/portab.h **** /* #ifdef */ 55:../hdr/portab.h **** /* # define FAR */ 56:../hdr/portab.h **** /* # define NEAR */ 57:../hdr/portab.h **** /* #endif */ 58:../hdr/portab.h **** /* */ 59:../hdr/portab.h **** /****************************************************************/ 60:../hdr/portab.h **** 61:../hdr/portab.h **** /* commandline overflow - removing -DI86 TE 62:../hdr/portab.h **** #if defined(__TURBOC__) 63:../hdr/portab.h **** 64:../hdr/portab.h **** #define I86 65:../hdr/portab.h **** #define CDECL cdecl 66:../hdr/portab.h **** #if __TURBOC__ > 0x202 67:../hdr/portab.h **** /* printf callers do the right thing for tc++ 1.01 but not tc 2.01 */ 68:../hdr/portab.h **** #define VA_CDECL 69:../hdr/portab.h **** #else 70:../hdr/portab.h **** #define VA_CDECL cdecl 71:../hdr/portab.h **** #endif 72:../hdr/portab.h **** #define PASCAL pascal 73:../hdr/portab.h **** void __int__(int); 74:../hdr/portab.h **** #ifndef FORSYS 75:../hdr/portab.h **** void __emit__(char, ...); 76:../hdr/portab.h **** #define disable() __emit__(0xfa) 77:../hdr/portab.h **** #define enable() __emit__(0xfb) 78:../hdr/portab.h **** #endif 79:../hdr/portab.h **** 80:../hdr/portab.h **** #elif defined(_MSC_VER) 81:../hdr/portab.h **** 82:../hdr/portab.h **** #define I86 83:../hdr/portab.h **** #define asm __asm 84:../hdr/portab.h **** #pragma warning(disable: 4761) /* "integral size mismatch in argument; 85:../hdr/portab.h **** conversion supplied" */ 86:../hdr/portab.h **** #define CDECL _cdecl 87:../hdr/portab.h **** #define VA_CDECL 88:../hdr/portab.h **** #define PASCAL pascal 89:../hdr/portab.h **** #define __int__(intno) asm int intno; 90:../hdr/portab.h **** #define disable() asm cli 91:../hdr/portab.h **** #define enable() asm sti 92:../hdr/portab.h **** #define _CS getCS() 93:../hdr/portab.h **** static unsigned short __inline getCS(void) 94:../hdr/portab.h **** { 95:../hdr/portab.h **** asm mov ax, cs; 96:../hdr/portab.h **** } 97:../hdr/portab.h **** #define _SS getSS() 98:../hdr/portab.h **** static unsigned short __inline getSS(void) 99:../hdr/portab.h **** { 100:../hdr/portab.h **** asm mov ax, ss; 101:../hdr/portab.h **** } 102:../hdr/portab.h **** 103:../hdr/portab.h **** #elif defined(__WATCOMC__) /* don't know a better way */ 104:../hdr/portab.h **** 105:../hdr/portab.h **** #if defined(_M_I86) 106:../hdr/portab.h **** 107:../hdr/portab.h **** #define I86 108:../hdr/portab.h **** #define __int__(intno) asm int intno; 109:../hdr/portab.h **** void disable(void); 110:../hdr/portab.h **** #pragma aux disable = "cli" __modify __exact []; 111:../hdr/portab.h **** void enable(void); 112:../hdr/portab.h **** #pragma aux enable = "sti" __modify __exact []; 113:../hdr/portab.h **** #define asm __asm 114:../hdr/portab.h **** #define far __far 115:../hdr/portab.h **** #define CDECL __cdecl 116:../hdr/portab.h **** #define VA_CDECL 117:../hdr/portab.h **** #define PASCAL pascal 118:../hdr/portab.h **** #define _CS getCS() 119:../hdr/portab.h **** unsigned short getCS(void); 120:../hdr/portab.h **** #pragma aux getCS = "mov dx,cs" __value [__dx] __modify __exact[__dx]; 121:../hdr/portab.h **** #define _SS getSS() 122:../hdr/portab.h **** unsigned short getSS(void); 123:../hdr/portab.h **** #pragma aux getSS = "mov dx,ss" __value [__dx] __modify __exact[__dx]; 124:../hdr/portab.h **** #if !defined(FORSYS) && !defined(EXEFLAT) && _M_IX86 >= 300 125:../hdr/portab.h **** #pragma aux __default __parm [__ax __dx __cx] __modify [__ax __dx __es __fs] /* min.unpacked size * 126:../hdr/portab.h **** #endif 127:../hdr/portab.h **** 128:../hdr/portab.h **** /* enable Possible loss of precision warning for compatibility with Borland */ 129:../hdr/portab.h **** #pragma enable_message(130) 130:../hdr/portab.h **** 131:../hdr/portab.h **** #else 132:../hdr/portab.h **** 133:../hdr/portab.h **** /* workaround for building some utils with OpenWatcom (flat model) */ 134:../hdr/portab.h **** #define MC68K 135:../hdr/portab.h **** 136:../hdr/portab.h **** #endif 137:../hdr/portab.h **** 138:../hdr/portab.h **** #elif defined (_MYMC68K_COMILER_) 139:../hdr/portab.h **** 140:../hdr/portab.h **** #define MC68K 141:../hdr/portab.h **** 142:../hdr/portab.h **** #elif defined(__GNUC__) 143:../hdr/portab.h **** 144:../hdr/portab.h **** #ifdef __FAR 145:../hdr/portab.h **** #define I86 146:../hdr/portab.h **** #define STRINGIFY(x) #x 147:../hdr/portab.h **** #define __int__(intno) asm volatile(STRINGIFY(int $##intno)) 148:../hdr/portab.h **** static inline void disable(void) 149:../hdr/portab.h **** { 150:../hdr/portab.h **** asm volatile("cli"); 487 .loc 2 150 0 488 #APP 489 ;# 150 "../hdr/portab.h" 1 151 } 490 cli 491 ;# 0 "" 2 492 _.LVL47: 493 #NO_APP 494 _.LBE47: 495 _.LBE46: 496 _.LBB48: 497 _.LBB49: 152:../hdr/portab.h **** static inline void enable(void) 153:../hdr/portab.h **** { 154:../hdr/portab.h **** asm volatile("sti"); 498 .loc 2 154 0 499 #APP 500 ;# 154 "../hdr/portab.h" 1 155 } 501 sti 502 ;# 0 "" 2 503 #NO_APP 504 _.LBE49: 505 _.LBE48: 233:main.c **** enable(); 506 .loc 1 233 0 0 000007D5 8A4702 mov al, byte ptr [bx+2] 0 000007D8 30E4 xor ah, ah 0 000007DA B102 mov cl, 2 0 000007DC D3E0 shl ax, cl 0 000007DE 89C3 mov bx, ax 0 000007E0 99 cwd 235:main.c **** } 513 .loc 1 235 0 0 000007E1 8EC2 mov es, dx 0 000007E3 268B07 mov ax, word ptr es:[bx] 0 000007E6 268B5702 mov dx, word ptr es:[bx+2] 236:main.c **** 517 .loc 1 236 0 0 000007EA C20200 ret 2 519 _.LFE7: 520 .size _init_getvec, .-_init_getvec 521 .global _setvec 522 .type _setvec, @function 523 _setvec: 524 _.LFB8: 239:main.c **** disable(); 525 .loc 1 239 0 526 _.LVL48: 0 000007ED 57 push di 0 000007EE 89E3 mov bx, sp 529 _.LCFI9: 0 000007F0 8E5F08 mov ds, word ptr [bx+8] 531 _.LBB50: 532 _.LBB51: 150:../hdr/portab.h **** } 533 .loc 2 150 0 534 #APP 535 ;# 150 "../hdr/portab.h" 1 536 cli 537 ;# 0 "" 2 538 #NO_APP 539 _.LBE51: 540 _.LBE50: 241:main.c **** enable(); 541 .loc 1 241 0 0 000007F4 368A4704 mov al, byte ptr ss:[bx+4] 0 000007F8 30E4 xor ah, ah 0 000007FA B102 mov cl, 2 0 000007FC D3E0 shl ax, cl 0 000007FE 99 cwd 0 000007FF 368B5F06 mov bx, word ptr ss:[bx+6] 0 00000803 8EC2 mov es, dx 0 00000805 89C7 mov di, ax 0 00000807 26891D mov word ptr es:[di], bx 551 _.LVL49: 0 0000080A 93 xchg bx, ax 0 0000080B 268C5F02 mov word ptr es:[bx+2], ds 554 _.LBB52: 555 _.LBB53: 154:../hdr/portab.h **** } 556 .loc 2 154 0 557 #APP 558 ;# 154 "../hdr/portab.h" 1 559 sti 560 ;# 0 "" 2 561 #NO_APP 562 _.LBE53: 563 _.LBE52: 243:main.c **** #endif 564 .loc 1 243 0 0 00000810 5F pop di 0 00000811 16 push ss 0 00000812 1F pop ds 0 00000813 C20600 ret 6 569 _.LFE8: 570 .size _setvec, .-_setvec === Switch to base=012BB0h -> ".RODATA.STR1.1" 571 .section .rodata.str1.1 572 _.LC5: 0 0000064A 0A00 .string "\n" === Switch to base=002270h -> ".TEXT" 574 .text 575 .global _init_device 576 .type _init_device, @function 577 _init_device: 578 _.LFB15: 600:main.c **** request rq; 579 .loc 1 600 0 580 _.LVL50: 0 00000816 56 push si 0 00000817 57 push di 0 00000818 55 push bp 584 _.LCFI10: 0 00000819 89E5 mov bp, sp 586 _.LCFI11: 0 0000081B 83EC2A sub sp, 42 0 0000081E 8B4608 mov ax, word ptr [bp+8] 0 00000821 8946D8 mov word ptr [bp-40], ax 0 00000824 8B760A mov si, word ptr [bp+10] 604:main.c **** char *p, *q, ch; 591 .loc 1 604 0 0 00000827 837E0C00 cmp word ptr [bp+12], 0 0 0000082B 745C je _.L44 0 0000082D 8B460C mov ax, word ptr [bp+12] 0 00000830 8946D6 mov word ptr [bp-42], ax 0 00000833 91 xchg cx, ax 597 _.L45: 598 _.LVL51: 599 _.LBB54: 611:main.c **** if (ch == '\0' || ch == ' ' || ch == '\t') 600 .loc 1 611 0 0 00000834 89CB mov bx, cx 0 00000836 8A07 mov al, byte ptr [bx] 603 _.LVL52: 612:main.c **** break; 604 .loc 1 612 0 0 00000838 A8DF test al, -33 0 0000083A 7428 je _.L48 0 0000083C 3C09 cmp al, 9 0 0000083E 7424 je _.L48 614:main.c **** if (ch == '\\' || ch == '/' || ch == ':') 609 .loc 1 614 0 0 00000840 41 inc cx 611 _.LVL53: 615:main.c **** q = p; /* remember position after path */ 612 .loc 1 615 0 0 00000841 3C5C cmp al, 92 0 00000843 9F lahf 0 00000844 D0E4 shl ah, 1 0 00000846 99 cwd 0 00000847 88D4 mov ah, dl 0 00000849 F6DC neg ah 0 0000084B 88E3 mov bl, ah 0 0000084D 3C2F cmp al, 47 0 0000084F 9F lahf 0 00000850 D0E4 shl ah, 1 0 00000852 99 cwd 0 00000853 F6DA neg dl 0 00000855 88DC mov ah, bl 0 00000857 08D4 or ah, dl 0 00000859 7504 jne _.L67 0 0000085B 3C3A cmp al, 58 0 0000085D 75D5 jne _.L45 630 _.L67: 616:main.c **** } 631 .loc 1 616 0 0 0000085F 894ED6 mov word ptr [bp-42], cx 633 _.LVL54: 0 00000862 EBD0 jmp _.L45 635 _.LVL55: 636 _.L48: 0 00000864 31DB xor bx, bx 619:main.c **** if (p != q && *q != '.') 638 .loc 1 619 0 0 00000866 88DC mov ah, bl 640 _.L52: 641 _.LVL56: 0 00000868 88E0 mov al, ah 620:main.c **** ch = *q++; 643 .loc 1 620 0 0 0000086A 3B4ED6 cmp cx, word ptr [bp-42] 0 0000086D 740F je _.L51 620:main.c **** ch = *q++; 646 .loc 1 620 0 is_stmt 0 discriminator 1 0 0000086F 8B7ED6 mov di, word ptr [bp-42] 0 00000872 8A05 mov al, byte ptr [di] 0 00000874 3C2E cmp al, 46 0 00000876 7503E90901 je _.L62 621:main.c **** /* copy name, without extension */ 651 .loc 1 621 0 is_stmt 1 0 0000087B FF46D6 inc word ptr [bp-42] 653 _.LVL57: 654 _.L51: 623:main.c **** } 655 .loc 1 623 0 discriminator 2 0 0000087E 89EF mov di, bp 0 00000880 8841DA mov byte ptr [bx+di-38], al 618:main.c **** ch = '\0'; 658 .loc 1 618 0 discriminator 2 0 00000883 43 inc bx 660 _.LVL58: 0 00000884 83FB08 cmp bx, 8 0 00000887 75DF jne _.L52 663 _.LVL59: 664 _.L44: 665 _.LBE54: 627:main.c **** rq.r_status = 0; 666 .loc 1 627 0 0 00000889 C646E300 mov byte ptr [bp-29], 0 628:main.c **** rq.r_command = C_INIT; 668 .loc 1 628 0 0 0000088D C746E50000 mov word ptr [bp-27], 0 629:main.c **** rq.r_length = sizeof(request); 670 .loc 1 629 0 0 00000892 C646E400 mov byte ptr [bp-28], 0 630:main.c **** rq.r_endaddr = *r_top; 672 .loc 1 630 0 0 00000896 C646E21E mov byte ptr [bp-30], 30 631:main.c **** rq.r_bpbptr = (void FAR *)(cmdLine ? cmdLine : "\n"); 674 .loc 1 631 0 0 0000089A 8B5E10 mov bx, word ptr [bp+16] 0 0000089D C407 les ax, dword ptr [bx] 0 0000089F 8946F0 mov word ptr [bp-16], ax 0 000008A2 8C46F2 mov word ptr [bp-14], es 632:main.c **** rq.r_firstunit = LoL->nblkdev; 679 .loc 1 632 0 0 000008A5 8B560C mov dx, word ptr [bp+12] 0 000008A8 8CD0 mov ax, ss 0 000008AA 85D2 test dx, dx 0 000008AC 7505 jne _.L53 632:main.c **** rq.r_firstunit = LoL->nblkdev; 684 .loc 1 632 0 is_stmt 0 discriminator 2 0 000008AE BA[1100] mov dx, offset _.LC5 0 000008B1 8CD0 mov ax, ss 687 _.L53: 632:main.c **** rq.r_firstunit = LoL->nblkdev; 688 .loc 1 632 0 discriminator 4 0 000008B3 8956F4 mov word ptr [bp-12], dx 0 000008B6 8946F6 mov word ptr [bp-10], ax 633:main.c **** 691 .loc 1 633 0 is_stmt 1 discriminator 4 0 000008B9 C41E[0000] les bx, dword ptr [_LoL] 0 000008BD 268A4746 mov al, byte ptr es:[bx+70] 0 000008C1 8846F8 mov byte ptr [bp-8], al 635:main.c **** 695 .loc 1 635 0 discriminator 4 0 000008C4 56 push si 0 000008C5 FF76D8 push word ptr [bp-40] 0 000008C8 8D46E2 lea ax, [-30+bp] 0 000008CB 16 push ss 0 000008CC 50 push ax 0 000008CD E8[FEFF] call _init_execrh 702 _.LVL60: 640:main.c **** return TRUE; 703 .loc 1 640 0 discriminator 4 0 000008D0 8B46E5 mov ax, word ptr [bp-27] 0 000008D3 250081 and ax, -32512 0 000008D6 3D0080 cmp ax, -32768 0 000008D9 7503E9C100 je _.L65 643:main.c **** { 708 .loc 1 643 0 0 000008DE 837E0C00 cmp word ptr [bp+12], 0 0 000008E2 7459 je _.L55 646:main.c **** return TRUE; 711 .loc 1 646 0 0 000008E4 8B5EF0 mov bx, word ptr [bp-16] 0 000008E7 8B46F2 mov ax, word ptr [bp-14] 0 000008EA 395ED8 cmp word ptr [bp-40], bx 0 000008ED 7507 jne _.L68 0 000008EF 39C6 cmp si, ax 0 000008F1 7503E9A900 je _.L65 718 _.L68: 650:main.c **** { 719 .loc 1 650 0 0 000008F6 8EC6 mov es, si 0 000008F8 8B7ED8 mov di, word ptr [bp-40] 0 000008FB 26837D0400 cmp word ptr es:[di+4], 0 0 00000900 7C09 jl _.L57 650:main.c **** { 724 .loc 1 650 0 is_stmt 0 discriminator 1 0 00000902 807EEF00 cmp byte ptr [bp-17], 0 0 00000906 7503E99400 je _.L65 727 _.L57: 663:main.c **** { 728 .loc 1 663 0 is_stmt 1 0 0000090B 8EC6 mov es, si 0 0000090D 8B7ED8 mov di, word ptr [bp-40] 0 00000910 26833DFF cmp word ptr es:[di], -1 0 00000914 7219 jc _.L58 665:main.c **** - FP_SEG(dhp), 'D', name, mode); 733 .loc 1 665 0 0 00000916 FF760E push word ptr [bp+14] 0 00000919 8D56DA lea dx, [-38+bp] 0 0000091C 52 push dx 0 0000091D B244 mov dl, 68 0 0000091F 52 push dx 0 00000920 29F0 sub ax, si 0 00000922 83C30F add bx, 15 0 00000925 B104 mov cl, 4 0 00000927 D3EB shr bx, cl 0 00000929 01D8 add ax, bx 0 0000092B 50 push ax 0 0000092C E8[FEFF] call _KernelAllocPara 746 _.LVL61: 747 _.L58: 676:main.c **** } 748 .loc 1 676 0 0 0000092F 8B46F0 mov ax, word ptr [bp-16] 0 00000932 8B5E10 mov bx, word ptr [bp+16] 0 00000935 8907 mov word ptr [bx], ax 0 00000937 8B46F2 mov ax, word ptr [bp-14] 0 0000093A 894702 mov word ptr [bx+2], ax 754 _.L55: 679:main.c **** { 755 .loc 1 679 0 0 0000093D 8EC6 mov es, si 0 0000093F 8B5ED8 mov bx, word ptr [bp-40] 0 00000942 26837F0400 cmp word ptr es:[bx+4], 0 0 00000947 7C12 jl _.L59 679:main.c **** { 760 .loc 1 679 0 is_stmt 0 discriminator 1 0 00000949 8A46EF mov al, byte ptr [bp-17] 0 0000094C 84C0 test al, al 0 0000094E 740B je _.L59 681:main.c **** update_dcb(dhp); 764 .loc 1 681 0 is_stmt 1 0 00000950 2688470A mov byte ptr es:[bx+10], al 766 _.LVL62: 682:main.c **** } 767 .loc 1 682 0 0 00000954 56 push si 0 00000955 FF76D8 push word ptr [bp-40] 0 00000958 E88EFB call _update_dcb 771 _.LVL63: 772 _.L59: 685:main.c **** LoL->syscon = dhp; 773 .loc 1 685 0 0 0000095B 8EC6 mov es, si 0 0000095D 8B5ED8 mov bx, word ptr [bp-40] 0 00000960 268B4704 mov ax, word ptr es:[bx+4] 0 00000964 89C2 mov dx, ax 0 00000966 83E201 and dx, 1 0 00000969 741E je _.L60 686:main.c **** else if (dhp->dh_attr & ATTR_CLOCK) 780 .loc 1 686 0 0 0000096B C41E[0000] les bx, dword ptr [_LoL] 0 0000096F 8B56D8 mov dx, word ptr [bp-40] 0 00000972 26895732 mov word ptr es:[bx+50], dx 0 00000976 26897734 mov word ptr es:[bx+52], si 785 _.L85: 690:main.c **** } 786 .loc 1 690 0 0 0000097A 31C0 xor ax, ax 788 _.L43: 691:main.c **** 789 .loc 1 691 0 0 0000097C 89EC mov sp, bp 0 0000097E 5D pop bp 0 0000097F 5F pop di 0 00000980 5E pop si 0 00000981 C20A00 ret 10 795 _.LVL64: 796 _.L62: 797 _.LBB55: 619:main.c **** if (p != q && *q != '.') 798 .loc 1 619 0 0 00000984 88E0 mov al, ah 0 00000986 E9F5FE jmp _.L51 801 _.LVL65: 802 _.L60: 803 _.LBE55: 687:main.c **** LoL->clock = dhp; 804 .loc 1 687 0 0 00000989 83E008 and ax, 8 0 0000098C 74EE je _.L43 688:main.c **** 807 .loc 1 688 0 0 0000098E C41E[0000] les bx, dword ptr [_LoL] 0 00000992 8B4ED8 mov cx, word ptr [bp-40] 0 00000995 26894F2E mov word ptr es:[bx+46], cx 0 00000999 26897730 mov word ptr es:[bx+48], si 0 0000099D EBDB jmp _.L85 813 _.LVL66: 814 _.L65: 641:main.c **** 815 .loc 1 641 0 0 0000099F B80100 mov ax, 1 0 000009A2 EBD8 jmp _.L43 818 _.LFE15: 819 .size _init_device, .-_init_device === Switch to base=012BB0h -> ".RODATA.STR1.1" 820 .section .rodata.str1.1 821 _.LC6: 0 0000064C 202F5900 .string " /Y" 823 _.LC7: 0 00000650 202F4400 .string " /D" 825 _.LC8: 0 00000654 466C6F70707900 .string "Floppy" 827 _.LC9: 0 0000065B 0A0A0A2020202020 .string "\n\n\n Hit any key within %d seconds to continue boot from %s\n Hit 'H' or wai 0 00000663 48697420616E7920 0 0000066B 6B65792077697468 0 00000673 696E202564207365 0 0000067B 636F6E647320746F 0 00000683 20636F6E74696E75 0 0000068B 6520626F6F742066 0 00000693 726F6D2025730A20 0 0000069B 2020202048697420 0 000006A3 274827206F722020 0 000006AB 2020776169742025 0 000006B3 64207365636F6E64 0 000006BB 7320746F20626F6F 0 000006C3 742066726F6D2048 0 000006CB 6172646469736B0A 0 000006D3 00 829 _.LC10: 0 000006D4 0A25530A0A00 .string "\n%S\n\n" 831 _.LC11: 0 000006DA 0A25534B65726E65 .string "\n%SKernel compatibility %d.%d - GNUC - 808x compatible - FAT32 support\n\n%s" 0 000006E2 6C20636F6D706174 0 000006EA 6962696C69747920 0 000006F2 25642E2564202D20 0 000006FA 474E5543202D2038 0 00000702 30387820636F6D70 0 0000070A 617469626C65202D 0 00000712 2046415433322073 0 0000071A 7570706F72740A0A 0 00000722 257300 === Switch to base=012BB0h -> ".RODATA" 833 .section .rodata 834 _.LC12: 0 0000061E 504154483D2E00 .string "PATH=." 0 00000625 00 .string "" 0 00000626 00 .string "" 0 00000627 00 .string "" 0 00000628 00 .string "" === Switch to base=002270h -> ".TEXT" 840 .text 841 .global _FreeDOSmain 842 .type _FreeDOSmain, @function 843 _FreeDOSmain: 844 _.LFB4: 75:main.c **** unsigned char drv; 845 .loc 1 75 0 0 000009A4 56 push si 0 000009A5 57 push di 0 000009A6 55 push bp 849 _.LCFI12: 0 000009A7 89E5 mov bp, sp 851 _.LCFI13: 0 000009A9 81EC8400 sub sp, 132 87:main.c **** 853 .loc 1 87 0 0 000009AD B8[0000] mov ax, offset __ib_end 0 000009B0 2D[0000] sub ax, offset __ib_start 0 000009B3 50 push ax 0 000009B4 31FF xor di, di 0 000009B6 57 push di 0 000009B7 B8[0000] mov ax, offset __ib_start 0 000009BA 50 push ax 0 000009BB E8[FEFF] call _init_memset 862 _.LVL67: 95:main.c **** p = MK_FP(0, 0x5e0); 863 .loc 1 95 0 0 000009BE C41E[0000] les bx, dword ptr [_LoL] 0 000009C2 268A4769 mov al, byte ptr es:[bx+105] 866 _.LVL68: 98:main.c **** } 867 .loc 1 98 0 0 000009C6 8EC7 mov es, di 0 000009C8 26A2E005 mov byte ptr es:[1504], al 101:main.c **** drv = 3; /* C: */ 870 .loc 1 101 0 0 000009CC FEC0 inc al 872 _.LVL69: 0 000009CE 7902 jns _.L87 102:main.c **** LoL->BootDrive = drv; 874 .loc 1 102 0 0 000009D0 B003 mov al, 3 876 _.LVL70: 877 _.L87: 103:main.c **** 878 .loc 1 103 0 0 000009D2 C41E[0000] les bx, dword ptr [_LoL] 0 000009D6 26884769 mov byte ptr es:[bx+105], al 881 _.LVL71: 882 _.LBB108: 883 _.LBB109: 276:main.c **** plvec->isv = getvec(plvec->intno); 884 .loc 1 276 0 0 000009DA BE[0000] mov si, offset _intvec_table@OZSEG16 0 000009DD BB[0000] mov bx, offset _intvec_table 887 _.LVL72: 888 _.L146: 277:main.c **** 889 .loc 1 277 0 0 000009E0 8EC6 mov es, si 0 000009E2 26FF37 push word ptr es:[bx] 0 000009E5 899E7EFF mov word ptr [bp-130], bx 0 000009E9 E8[FEFF] call _init_getvec 894 _.LVL73: 0 000009EC 8EC6 mov es, si 0 000009EE 8B9E7EFF mov bx, word ptr [bp-130] 0 000009F2 26894701 mov word ptr es:[bx+1], ax 898 _.LVL74: 0 000009F6 26895703 mov word ptr es:[bx+3], dx 276:main.c **** plvec->isv = getvec(plvec->intno); 900 .loc 1 276 0 0 000009FA 83C305 add bx, 5 902 _.LVL75: 0 000009FD 81FB[1E00] cmp bx, offset _intvec_table+30 0 00000A01 72DD jc _.L146 0 00000A03 B023 mov al, 35 906 _.LVL76: 907 _.L90: 281:main.c **** HaltCpuWhileIdle = 0; 908 .loc 1 281 0 0 00000A05 BE[0000] mov si, offset _empty_handler@OZSEG16 0 00000A08 56 push si 0 00000A09 BA[0000] mov dx, offset _empty_handler 0 00000A0C 52 push dx 0 00000A0D 50 push ax 0 00000A0E 88867EFF mov byte ptr [bp-130], al 0 00000A12 E8[FEFF] call _setvec 916 _.LVL77: 0 00000A15 8A867EFF mov al, byte ptr [bp-130] 0 00000A19 FEC0 inc al 280:main.c **** setvec(i, empty_handler); /* note: int 31h segment should be DOS DS */ 919 .loc 1 280 0 0 00000A1B 3C40 cmp al, 64 0 00000A1D 75E6 jne _.L90 282:main.c **** for (pvec = vectors; pvec < vectors + (sizeof vectors/sizeof *pvec); pvec++) 922 .loc 1 282 0 0 00000A1F B8[0000] mov ax, offset _HaltCpuWhileIdle@OZSEG16 0 00000A22 8EC0 mov es, ax 0 00000A24 26C606[0000]00 mov byte ptr es:[_HaltCpuWhileIdle], 0 926 _.LVL78: 283:main.c **** if ((pvec->intno & 0x80) == 0 || debugger_present == 0) 927 .loc 1 283 0 0 00000A2A BB[0F00] mov bx, offset _vectors.1921 929 _.LVL79: 930 _.L93: 284:main.c **** setvec(pvec->intno & 0x7F, (intvec)MK_FP(FP_SEG(empty_handler), pvec->handleroff)); 931 .loc 1 284 0 0 00000A2D 8A07 mov al, byte ptr [bx] 0 00000A2F 84C0 test al, al 0 00000A31 7D07 jge _.L91 0 00000A33 803E[0000]00 cmp byte ptr [_debugger_present], 0 0 00000A38 7512 jne _.L92 937 _.L91: 285:main.c **** pokeb(0, 0x30 * 4, 0xea); 938 .loc 1 285 0 0 00000A3A 56 push si 0 00000A3B FF7701 push word ptr [bx+1] 0 00000A3E 899E7EFF mov word ptr [bp-130], bx 0 00000A42 247F and al, 127 0 00000A44 50 push ax 0 00000A45 E8[FEFF] call _setvec 945 _.LVL80: 0 00000A48 8B9E7EFF mov bx, word ptr [bp-130] 947 _.LVL81: 948 _.L92: 283:main.c **** if ((pvec->intno & 0x80) == 0 || debugger_present == 0) 949 .loc 1 283 0 0 00000A4C 83C303 add bx, 3 951 _.LVL82: 0 00000A4F 81FB[3C00] cmp bx, offset _vectors.1921+45 0 00000A53 72D8 jc _.L93 286:main.c **** pokel(0, 0x30 * 4 + 1, (ULONG)cpm_entry); 954 .loc 1 286 0 0 00000A55 8EC7 mov es, di 0 00000A57 26C606C000EA mov byte ptr es:[192], -22 287:main.c **** 957 .loc 1 287 0 0 00000A5D 26C706C100[0000] mov word ptr es:[193], offset _cpm_entry 0 00000A64 B8[0000] mov ax, offset _cpm_entry@OZSEG16 0 00000A67 26A3C300 mov word ptr es:[195], ax 961 _.LVL83: 962 _.LBB110: 963 _.LBB111: 964 _.LBB112: 965 _.LBB113: 150:../hdr/portab.h **** } 966 .loc 2 150 0 967 #APP 968 ;# 150 "../hdr/portab.h" 1 969 cli 970 ;# 0 "" 2 971 #NO_APP 972 _.LBE113: 973 _.LBE112: 241:main.c **** enable(); 974 .loc 1 241 0 0 00000A6C 26C7066C00[0000] mov word ptr es:[108], offset _got_cbreak 0 00000A73 B8[0000] mov ax, offset _got_cbreak@OZSEG16 0 00000A76 26A36E00 mov word ptr es:[110], ax 978 _.LBB114: 979 _.LBB115: 154:../hdr/portab.h **** } 980 .loc 2 154 0 981 #APP 982 ;# 154 "../hdr/portab.h" 1 983 sti 984 ;# 0 "" 2 985 _.LVL84: 986 #NO_APP 987 _.LBE115: 988 _.LBE114: 989 _.LBE111: 990 _.LBE110: 991 _.LBB116: 992 _.LBB117: 993 _.LBB118: 994 _.LBB119: 150:../hdr/portab.h **** } 995 .loc 2 150 0 996 #APP 997 ;# 150 "../hdr/portab.h" 1 998 cli 999 ;# 0 "" 2 1000 #NO_APP 1001 _.LBE119: 1002 _.LBE118: 241:main.c **** enable(); 1003 .loc 1 241 0 0 00000A7C 26C706A400[0000] mov word ptr es:[164], offset _int29_handler 0 00000A83 B8[0000] mov ax, offset _int29_handler@OZSEG16 0 00000A86 26A3A600 mov word ptr es:[166], ax 1007 _.LBB120: 1008 _.LBB121: 154:../hdr/portab.h **** } 1009 .loc 2 154 0 1010 #APP 1011 ;# 154 "../hdr/portab.h" 1 1012 sti 1013 ;# 0 "" 2 1014 _.LVL85: 1015 #NO_APP 1016 _.LBE121: 1017 _.LBE120: 1018 _.LBE117: 1019 _.LBE116: 1020 _.LBE109: 1021 _.LBE108: 117:main.c **** for (pp = kernel_command_line; *pp; ++pp) { 1022 .loc 1 117 0 0 00000A8B BE[0000] mov si, offset _kernel_command_line 0 00000A8E 56 push si 0 00000A8F E8[FEFF] call _init_strlen 1026 _.LVL86: 0 00000A92 A3[0000] mov word ptr [_kernel_command_line_length], ax 1028 _.LVL87: 118:main.c **** if (*pp == ';') { 1029 .loc 1 118 0 0 00000A95 89F3 mov bx, si 1031 _.LVL88: 1032 _.L94: 118:main.c **** if (*pp == ';') { 1033 .loc 1 118 0 is_stmt 0 discriminator 1 0 00000A97 8A07 mov al, byte ptr [bx] 0 00000A99 84C0 test al, al 0 00000A9B 7403E9F502 jne _.L96 1037 _.LVL89: 1038 _.LBB122: 1039 _.LBB123: 782:main.c **** 783:main.c **** STATIC void CheckContinueBootFromHarddisk(void) 784:main.c **** { 785:main.c **** char *bootedFrom = "Floppy/CD"; 786:main.c **** iregs r; 787:main.c **** int key; 788:main.c **** 789:main.c **** if (InitKernelConfig.BootHarddiskSeconds == 0) 1040 .loc 1 789 0 is_stmt 1 0 00000AA0 BE[0000] mov si, offset _InitKernelConfig 0 00000AA3 8A440D mov al, byte ptr [si+13] 0 00000AA6 84C0 test al, al 0 00000AA8 7441 je _.L99 790:main.c **** return; 791:main.c **** 792:main.c **** if (LoL->BootDrive >= 3) 1045 .loc 1 792 0 0 00000AAA C41E[0000] les bx, dword ptr [_LoL] 1047 _.LVL90: 0 00000AAE 26807F6902 cmp byte ptr es:[bx+105], 2 0 00000AB3 7736 ja _.L99 1050 _.LVL91: 793:main.c **** { 794:main.c **** #if 0 795:main.c **** if (!EmulatedDriveStatus(0x80,1)) 796:main.c **** #endif 797:main.c **** { 798:main.c **** /* already booted from HD */ 799:main.c **** return; 800:main.c **** } 801:main.c **** } 802:main.c **** else { 803:main.c **** #if 0 804:main.c **** if (!EmulatedDriveStatus(0x00,1)) 805:main.c **** #endif 806:main.c **** bootedFrom = "Floppy"; 807:main.c **** } 808:main.c **** 809:main.c **** printf("\n" 1051 .loc 1 809 0 0 00000AB5 98 cbw 0 00000AB6 50 push ax 0 00000AB7 BA[1B00] mov dx, offset _.LC8 0 00000ABA 52 push dx 0 00000ABB 50 push ax 0 00000ABC B8[2200] mov ax, offset _.LC9 0 00000ABF 50 push ax 0 00000AC0 E8[FEFF] call _init_printf 1060 _.LVL92: 810:main.c **** "\n" 811:main.c **** "\n" 812:main.c **** " Hit any key within %d seconds to continue boot from %s\n" 813:main.c **** " Hit 'H' or wait %d seconds to boot from Harddisk\n", 814:main.c **** InitKernelConfig.BootHarddiskSeconds, 815:main.c **** bootedFrom, 816:main.c **** InitKernelConfig.BootHarddiskSeconds 817:main.c **** ); 818:main.c **** 819:main.c **** key = GetBiosKey(InitKernelConfig.BootHarddiskSeconds); 1061 .loc 1 819 0 0 00000AC3 8A440D mov al, byte ptr [si+13] 0 00000AC6 98 cbw 0 00000AC7 50 push ax 0 00000AC8 E8[FEFF] call _GetBiosKey 1066 _.LVL93: 820:main.c **** 821:main.c **** if (key != -1 && (key & 0xff) != 'h' && (key & 0xff) != 'H') 1067 .loc 1 821 0 0 00000ACB 83C408 add sp, 8 0 00000ACE 83F8FF cmp ax, -1 0 00000AD1 7503E9CA02 je _.L98 0 00000AD6 25DF00 and ax, 223 1072 _.LVL94: 0 00000AD9 83F848 cmp ax, 72 0 00000ADC 7503E9BF02 je _.L98 822:main.c **** { 823:main.c **** /* user has hit a key, continue to boot from floppy/CD */ 824:main.c **** printf("\n"); 1075 .loc 1 824 0 0 00000AE1 B8[1100] mov ax, offset _.LC5 0 00000AE4 50 push ax 0 00000AE5 E8[FEFF] call _init_printf 1079 _.LVL95: 0 00000AE8 83C402 add sp, 2 1081 _.LVL96: 1082 _.L99: 1083 _.LBE123: 1084 _.LBE122: 1085 _.LBB125: 1086 _.LBB126: 439:main.c **** { 1087 .loc 1 439 0 0 00000AEB 807C1500 cmp byte ptr [si+21], 0 444:main.c **** #endif 1089 .loc 1 444 0 0 00000AEF C41E[0000] les bx, dword ptr [_LoL] 0 00000AF3 268B979600 mov dx, word ptr es:[bx+150] 439:main.c **** { 1092 .loc 1 439 0 0 00000AF8 7C03E9DE02 jge _.L100 444:main.c **** #endif 1094 .loc 1 444 0 0 00000AFD 06 push es 0 00000AFE 52 push dx 0 00000AFF B8[9B00] mov ax, offset _.LC10 0 00000B02 50 push ax 0 00000B03 E8[FEFF] call _init_printf 1100 _.LVL97: 0 00000B06 83C406 add sp, 6 1102 _.L101: 1103 _.LBE126: 1104 _.LBE125: 1105 _.LBB128: 1106 _.LBB129: 298:main.c **** LoL->os_setver_minor = LoL->os_minor = MINOR_RELEASE; 1107 .loc 1 298 0 0 00000B09 C41E[0000] les bx, dword ptr [_LoL] 0 00000B0D 26C687930007 mov byte ptr es:[bx+147], 7 299:main.c **** 1110 .loc 1 299 0 0 00000B13 26C7879100070A mov word ptr es:[bx+145], 2567 0 00000B1A 26C68790000A mov byte ptr es:[bx+144], 10 302:main.c **** 1113 .loc 1 302 0 0 00000B20 E8[FEFF] call _init_oem 1115 _.LVL98: 0 00000B23 A3[0000] mov word ptr [_ram_top], ax 1117 _.LBB130: 1118 _.LBB131: 156:../hdr/portab.h **** #define far __far 157:../hdr/portab.h **** #define CDECL __attribute__((cdecl)) 158:../hdr/portab.h **** #define VA_CDECL 159:../hdr/portab.h **** #define PASCAL 160:../hdr/portab.h **** 161:../hdr/portab.h **** #define _CS getCS() 162:../hdr/portab.h **** static inline unsigned short getCS(void) 163:../hdr/portab.h **** { 164:../hdr/portab.h **** unsigned short ret; 165:../hdr/portab.h **** asm volatile("{ mov %%cs, %0 | mov %0, cs }" : "=r"(ret)); 1119 .loc 2 165 0 1120 #APP 1121 ;# 165 "../hdr/portab.h" 1 166 return ret; 1122 mov ax, cs 1123 ;# 0 "" 2 1124 #NO_APP 1125 _.LBE131: 1126 _.LBE130: 315:main.c **** #endif 1127 .loc 1 315 0 0 00000B28 BA[0F00] mov dx, offset ___ia16_near_alias.15+15 0 00000B2B B104 mov cl, 4 0 00000B2D D3EA shr dx, cl 0 00000B2F 29D0 sub ax, dx 0 00000B31 A3[0200] mov word ptr [_lpTop+2], ax 0 00000B34 C706[0000]0000 mov word ptr [_lpTop], 0 318:main.c **** lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0); 1134 .loc 1 318 0 0 00000B3A 50 push ax 0 00000B3B E8[FEFF] call _MoveKernel 1137 _.LVL99: 319:main.c **** 1138 .loc 1 319 0 0 00000B3E A1[0200] mov ax, word ptr [_lpTop+2] 0 00000B41 0501F0 add ax, -4095 0 00000B44 C706[0000]F0FF mov word ptr [_lpTop], -16 0 00000B4A A3[0200] mov word ptr [_lpTop+2], ax 1143 _.LBB132: 1144 _.LBB133: 695:main.c **** 1145 .loc 1 695 0 0 00000B4D 8B36[0000] mov si, word ptr [_LoL] 0 00000B51 83C648 add si, 72 0 00000B54 8B16[0200] mov dx, word ptr [_LoL+2] 1149 _.LVL100: 1150 _.L102: 699:main.c **** device = device->dh_next; 1151 .loc 1 699 0 0 00000B58 B8[0000] mov ax, offset _lpTop 0 00000B5B 50 push ax 0 00000B5C 57 push di 0 00000B5D 57 push di 0 00000B5E 52 push dx 0 00000B5F 89967EFF mov word ptr [bp-130], dx 0 00000B63 56 push si 0 00000B64 E8[FEFF] call _init_device 1160 _.LVL101: 700:main.c **** } 1161 .loc 1 700 0 0 00000B67 89F3 mov bx, si 0 00000B69 8B967EFF mov dx, word ptr [bp-130] 0 00000B6D 8EC2 mov es, dx 0 00000B6F 268B34 mov si, word ptr es:[si] 1166 _.LVL102: 0 00000B72 268B5702 mov dx, word ptr es:[bx+2] 1168 _.LVL103: 702:main.c **** } 1169 .loc 1 702 0 0 00000B76 83FEFF cmp si, -1 0 00000B79 75DD jne _.L102 1172 _.LVL104: 1173 _.LBE133: 1174 _.LBE132: 1175 _.LBB134: 1176 _.LBB135: 725:main.c **** 1177 .loc 1 725 0 0 00000B7B 8D4680 lea ax, [-128+bp] 0 00000B7E 50 push ax 0 00000B7F B91100 mov cx, 17 0 00000B82 51 push cx 0 00000B83 898E7CFF mov word ptr [bp-132], cx 0 00000B87 E8[FEFF] call _init_call_intr 1184 _.LVL105: 727:main.c **** 1185 .loc 1 727 0 0 00000B8A 8B4680 mov ax, word ptr [bp-128] 0 00000B8D B10E mov cl, 14 0 00000B8F D3E8 shr ax, cl 0 00000B91 89867EFF mov word ptr [bp-130], ax 1190 _.LVL106: 729:main.c **** { 1191 .loc 1 729 0 0 00000B95 8D7401 lea si, [1+si] 1193 _.LVL107: 1194 _.L103: 0 00000B98 39B67EFF cmp word ptr [bp-130], si 0 00000B9C 7E03E95502 jg _.L104 1197 _.LVL108: 1198 _.LBE135: 1199 _.LBE134: 1200 _.LBB137: 1201 _.LBB138: 742:main.c **** 1202 .loc 1 742 0 0 00000BA1 8D4680 lea ax, [-128+bp] 0 00000BA4 50 push ax 0 00000BA5 FFB67CFF push word ptr [bp-132] 0 00000BA9 E8[FEFF] call _init_call_intr 1207 _.LVL109: 744:main.c **** 1208 .loc 1 744 0 0 00000BAC 8B7680 mov si, word ptr [bp-128] 0 00000BAF B109 mov cl, 9 0 00000BB1 D3EE shr si, cl 0 00000BB3 83E607 and si, 7 1213 _.LVL110: 746:main.c **** { 1214 .loc 1 746 0 0 00000BB6 31D2 xor dx, dx 1216 _.LVL111: 1217 _.L105: 0 00000BB8 39D6 cmp si, dx 0 00000BBA B81400 mov ax, 20 0 00000BBD 7403E94B02 jne _.L106 0 00000BC2 89867EFF mov word ptr [bp-130], ax 1222 _.LVL112: 1223 _.LBE138: 1224 _.LBE137: 326:main.c **** set_DTA(MK_FP(DOS_PSP, 0x80)); 1225 .loc 1 326 0 0 00000BC6 BE6000 mov si, 96 0 00000BC9 56 push si 0 00000BCA E8[FEFF] call _init_PSPSet 1229 _.LVL113: 327:main.c **** PSPInit(); 1230 .loc 1 327 0 0 00000BCD 56 push si 0 00000BCE BA8000 mov dx, 128 0 00000BD1 52 push dx 0 00000BD2 E8[FEFF] call _set_DTA 1235 _.LVL114: 1236 _.LBB140: 1237 _.LBB141: 170:main.c **** /* high half is used as environment */ 1238 .loc 1 170 0 0 00000BD5 BA0001 mov dx, 256 0 00000BD8 52 push dx 0 00000BD9 57 push di 0 00000BDA 56 push si 0 00000BDB 57 push di 0 00000BDC E8[FEFF] call _init_fmemset 1245 _.LVL115: 175:main.c **** 1246 .loc 1 175 0 0 00000BDF 8EC6 mov es, si 0 00000BE1 26C7060000CD20 mov word ptr es:[0], 8397 178:main.c **** p->ps_reentry = MK_FP(0, 0x30 * 4); 1249 .loc 1 178 0 0 00000BE8 26C60605009A mov byte ptr es:[5], -102 179:main.c **** /* unix style call - 0xcd 0x21 0xcb (int 21, retf) */ 1251 .loc 1 179 0 0 00000BEE 26C7060600C000 mov word ptr es:[6], 192 0 00000BF5 26897D08 mov word ptr es:[di+8], di 182:main.c **** p->ps_unix[2] = 0xcb; 1254 .loc 1 182 0 0 00000BF9 26C7065000CD21 mov word ptr es:[80], 8653 183:main.c **** 1256 .loc 1 183 0 0 00000C00 26C6065200CB mov byte ptr es:[82], -53 187:main.c **** /* previous psp pointer */ 1258 .loc 1 187 0 0 00000C06 2689361600 mov word ptr es:[22], si 189:main.c **** 1260 .loc 1 189 0 0 00000C0B 26C7063800FFFF mov word ptr es:[56], -1 0 00000C12 26C7063A00FFFF mov word ptr es:[58], -1 195:main.c **** /* terminate address */ 1263 .loc 1 195 0 0 00000C19 26C7062C006800 mov word ptr es:[44], 104 1265 _.LVL116: 1266 _.LBB142: 1267 _.LBB143: 1268 _.LBB144: 1269 _.LBB145: 150:../hdr/portab.h **** } 1270 .loc 2 150 0 1271 #APP 1272 ;# 150 "../hdr/portab.h" 1 1273 cli 1274 ;# 0 "" 2 1275 #NO_APP 1276 _.LBE145: 1277 _.LBE144: 233:main.c **** enable(); 1278 .loc 1 233 0 0 00000C21 8EC7 mov es, di 0 00000C23 268B168800 mov dx, word ptr es:[136] 0 00000C28 268B0E8A00 mov cx, word ptr es:[138] 1282 _.LVL117: 1283 _.LBB146: 1284 _.LBB147: 154:../hdr/portab.h **** } 1285 .loc 2 154 0 1286 #APP 1287 ;# 154 "../hdr/portab.h" 1 1288 sti 1289 ;# 0 "" 2 1290 _.LVL118: 1291 #NO_APP 1292 _.LBE147: 1293 _.LBE146: 1294 _.LBE143: 1295 _.LBE142: 197:main.c **** /* break address */ 1296 .loc 1 197 0 0 00000C2E 8EC6 mov es, si 0 00000C30 2689160A00 mov word ptr es:[10], dx 0 00000C35 26890E0C00 mov word ptr es:[12], cx 1300 _.LVL119: 1301 _.LBB148: 1302 _.LBB149: 1303 _.LBB150: 1304 _.LBB151: 150:../hdr/portab.h **** } 1305 .loc 2 150 0 1306 #APP 1307 ;# 150 "../hdr/portab.h" 1 1308 cli 1309 ;# 0 "" 2 1310 #NO_APP 1311 _.LBE151: 1312 _.LBE150: 233:main.c **** enable(); 1313 .loc 1 233 0 0 00000C3B 8EC7 mov es, di 0 00000C3D 268B168C00 mov dx, word ptr es:[140] 0 00000C42 268B0E8E00 mov cx, word ptr es:[142] 1317 _.LVL120: 1318 _.LBB152: 1319 _.LBB153: 154:../hdr/portab.h **** } 1320 .loc 2 154 0 1321 #APP 1322 ;# 154 "../hdr/portab.h" 1 1323 sti 1324 ;# 0 "" 2 1325 _.LVL121: 1326 #NO_APP 1327 _.LBE153: 1328 _.LBE152: 1329 _.LBE149: 1330 _.LBE148: 199:main.c **** /* critical error address */ 1331 .loc 1 199 0 0 00000C48 8EC6 mov es, si 0 00000C4A 2689160E00 mov word ptr es:[14], dx 0 00000C4F 26890E1000 mov word ptr es:[16], cx 1335 _.LVL122: 1336 _.LBB154: 1337 _.LBB155: 1338 _.LBB156: 1339 _.LBB157: 150:../hdr/portab.h **** } 1340 .loc 2 150 0 1341 #APP 1342 ;# 150 "../hdr/portab.h" 1 1343 cli 1344 ;# 0 "" 2 1345 #NO_APP 1346 _.LBE157: 1347 _.LBE156: 233:main.c **** enable(); 1348 .loc 1 233 0 0 00000C55 8EC7 mov es, di 0 00000C57 268B169000 mov dx, word ptr es:[144] 0 00000C5C 268B0E9200 mov cx, word ptr es:[146] 1352 _.LVL123: 1353 _.LBB158: 1354 _.LBB159: 154:../hdr/portab.h **** } 1355 .loc 2 154 0 1356 #APP 1357 ;# 154 "../hdr/portab.h" 1 1358 sti 1359 ;# 0 "" 2 1360 _.LVL124: 1361 #NO_APP 1362 _.LBE159: 1363 _.LBE158: 1364 _.LBE155: 1365 _.LBE154: 201:main.c **** 1366 .loc 1 201 0 0 00000C62 8EC6 mov es, si 0 00000C64 2689161200 mov word ptr es:[18], dx 0 00000C69 26890E1400 mov word ptr es:[20], cx 208:main.c **** fmemset(p->ps_files, 0xff, 20); 1370 .loc 1 208 0 0 00000C6E 8B867EFF mov ax, word ptr [bp-130] 0 00000C72 26A33200 mov word ptr es:[50], ax 209:main.c **** 1373 .loc 1 209 0 0 00000C76 BA1800 mov dx, 24 0 00000C79 50 push ax 0 00000C7A B8FF00 mov ax, 255 0 00000C7D 50 push ax 0 00000C7E 56 push si 0 00000C7F 52 push dx 0 00000C80 89967EFF mov word ptr [bp-130], dx 0 00000C84 E8[FEFF] call _init_fmemset 1382 _.LVL125: 212:main.c **** 1383 .loc 1 212 0 0 00000C87 8EC6 mov es, si 0 00000C89 8B967EFF mov dx, word ptr [bp-130] 0 00000C8D 2689163400 mov word ptr es:[52], dx 0 00000C92 2689363600 mov word ptr es:[54], si 215:main.c **** 1388 .loc 1 215 0 0 00000C97 C41E[0000] les bx, dword ptr [_LoL] 0 00000C9B 268A879000 mov al, byte ptr es:[bx+144] 0 00000CA0 B108 mov cl, 8 0 00000CA2 D3E0 shl ax, cl 0 00000CA4 268A979100 mov dl, byte ptr es:[bx+145] 0 00000CA9 30F6 xor dh, dh 0 00000CAB 01D0 add ax, dx 0 00000CAD 8EC6 mov es, si 0 00000CAF 26A34000 mov word ptr es:[64], ax 219:main.c **** /* second command line argument */ 1398 .loc 1 219 0 0 00000CB3 B80B00 mov ax, 11 0 00000CB6 50 push ax 0 00000CB7 B82000 mov ax, 32 0 00000CBA 50 push ax 0 00000CBB 89867EFF mov word ptr [bp-130], ax 0 00000CBF 56 push si 0 00000CC0 BA5D00 mov dx, 93 0 00000CC3 52 push dx 0 00000CC4 E8[FEFF] call _init_fmemset 1408 _.LVL126: 222:main.c **** 1409 .loc 1 222 0 0 00000CC7 B80B00 mov ax, 11 0 00000CCA 50 push ax 0 00000CCB 8B867EFF mov ax, word ptr [bp-130] 0 00000CCF 50 push ax 0 00000CD0 56 push si 0 00000CD1 B86D00 mov ax, 109 0 00000CD4 50 push ax 0 00000CD5 E8[FEFF] call _init_fmemset 1418 _.LVL127: 1419 _.LBE141: 1420 _.LBE140: 330:main.c **** 1421 .loc 1 330 0 0 00000CD8 E8[FEFF] call _Init_clk_driver 1423 _.LVL128: 336:main.c **** 1424 .loc 1 336 0 0 00000CDB C41E[0000] les bx, dword ptr [_LoL] 0 00000CDF 26C647471A mov byte ptr es:[bx+71], 26 342:main.c **** 1427 .loc 1 342 0 0 00000CE4 E8[FEFF] call _dsk_init 1429 _.LVL129: 0 00000CE7 BE[0000] mov si, offset _blk_dev@OZSEG16 0 00000CEA 8EC6 mov es, si 0 00000CEC 26A2[0A00] mov byte ptr es:[_blk_dev+10], al 344:main.c **** 1433 .loc 1 344 0 0 00000CF0 E8[FEFF] call _PreConfig 1435 _.LVL130: 347:main.c **** update_dcb(&blk_dev); 1436 .loc 1 347 0 0 00000CF3 8EC6 mov es, si 0 00000CF5 26803E[0A00]00 cmp byte ptr es:[_blk_dev+10], 0 0 00000CFB C7867EFF0B00 mov word ptr [bp-130], 11 0 00000D01 7408 je _.L107 348:main.c **** 1441 .loc 1 348 0 0 00000D03 56 push si 0 00000D04 B8[0000] mov ax, offset _blk_dev 0 00000D07 50 push ax 0 00000D08 E8DEF7 call _update_dcb 1446 _.LVL131: 1447 _.L107: 351:main.c **** 1448 .loc 1 351 0 0 00000D0B E83CF9 call _FsConfig 1450 _.LVL132: 354:main.c **** DoConfig(1); 1451 .loc 1 354 0 0 00000D0E 57 push di 0 00000D0F E8[FEFF] call _DoConfig 1454 _.LVL133: 355:main.c **** 1455 .loc 1 355 0 0 00000D12 B80100 mov ax, 1 0 00000D15 50 push ax 0 00000D16 E8[FEFF] call _DoConfig 1459 _.LVL134: 358:main.c **** /* and process CONFIG.SYS one last time for device drivers */ 1460 .loc 1 358 0 0 00000D19 E8[FEFF] call _PreConfig2 1462 _.LVL135: 360:main.c **** 1463 .loc 1 360 0 0 00000D1C B80200 mov ax, 2 0 00000D1F 50 push ax 0 00000D20 E8[FEFF] call _DoConfig 1467 _.LVL136: 364:main.c **** close(i); 1468 .loc 1 364 0 0 00000D23 31F6 xor si, si 1470 _.LVL137: 1471 _.L108: 365:main.c **** 1472 .loc 1 365 0 0 00000D25 56 push si 0 00000D26 E8[FEFF] call _close 1475 _.LVL138: 364:main.c **** close(i); 1476 .loc 1 364 0 0 00000D29 46 inc si 1478 _.LVL139: 0 00000D2A 83FE14 cmp si, 20 0 00000D2D 75F6 jne _.L108 368:main.c **** 1481 .loc 1 368 0 0 00000D2F E8[FEFF] call _PostConfig 1483 _.LVL140: 371:main.c **** 1484 .loc 1 371 0 0 00000D32 E815F9 call _FsConfig 1486 _.LVL141: 373:main.c **** 1487 .loc 1 373 0 0 00000D35 E8[FEFF] call _configDone 1489 _.LVL142: 375:main.c **** } 1490 .loc 1 375 0 0 00000D38 E8[FEFF] call _InitializeAllBPBs 1492 _.LVL143: 1493 _.LVL144: 1494 _.LBE129: 1495 _.LBE128: 138:main.c **** 1496 .loc 1 138 0 0 00000D3B E8[FEFF] call _DoInstall 1498 _.LVL145: 1499 _.LBB163: 1500 _.LBB164: 488:main.c **** fmemcpy(master_env, "PATH=.\0\0\0\0", sizeof("PATH=.\0\0\0\0")); 1501 .loc 1 488 0 0 00000D3E BB[0000] mov bx, offset _master_env 0 00000D41 B8[0000] mov ax, offset _master_env@OZSEG16 0 00000D44 8EC0 mov es, ax 0 00000D46 26803F00 cmp byte ptr es:[bx], 0 0 00000D4A 750E jne _.L109 489:main.c **** 1507 .loc 1 489 0 0 00000D4C FFB67EFF push word ptr [bp-130] 0 00000D50 16 push ss 0 00000D51 BA[0500] mov dx, offset _.LC12 0 00000D54 52 push dx 0 00000D55 50 push ax 0 00000D56 53 push bx 0 00000D57 E8[FEFF] call _init_fmemcpy 1515 _.LVL146: 1516 _.L109: 493:main.c **** strcpy(Cmd.ctBuffer, Config.cfgInitTail); 1517 .loc 1 493 0 0 00000D5A B87F00 mov ax, 127 0 00000D5D 50 push ax 0 00000D5E 57 push di 0 00000D5F 8D7680 lea si, [-128+bp] 0 00000D62 8D7C01 lea di, [1+si] 0 00000D65 57 push di 0 00000D66 E8[FEFF] call _init_memset 1525 _.LVL147: 494:main.c **** 1526 .loc 1 494 0 0 00000D69 FF36[0800] push word ptr [_Config+8] 0 00000D6D 57 push di 0 00000D6E E8[FEFF] call _init_strcpy 1530 _.LVL148: 496:main.c **** if (Cmd.ctBuffer[Cmd.ctCount] == '\r') 1531 .loc 1 496 0 0 00000D71 C6468000 mov byte ptr [bp-128], 0 0 00000D75 31DB xor bx, bx 0 00000D77 88D8 mov al, bl 0 00000D79 88DC mov ah, bl 497:main.c **** break; 1536 .loc 1 497 0 0 00000D7B B201 mov dl, 1 1538 _.L110: 496:main.c **** if (Cmd.ctBuffer[Cmd.ctCount] == '\r') 1539 .loc 1 496 0 0 00000D7D 3C7F cmp al, 127 0 00000D7F 7403E9A500 jne _.L112 0 00000D84 84E4 test ah, ah 0 00000D86 7403 je _.L114 0 00000D88 884680 mov byte ptr [bp-128], al 1545 _.L114: 533:main.c **** } 1546 .loc 1 533 0 0 00000D8B 16 push ss 0 00000D8C B8[0000] mov ax, offset _Config 0 00000D8F 50 push ax 0 00000D90 9A[00000000] call (_init_call_p_0@OZSEG16):_init_call_p_0 1551 _.LVL149: 1552 _.L96: 1553 _.LBE164: 1554 _.LBE163: 119:main.c **** *pp = 0; 1555 .loc 1 119 0 0 00000D95 3C3B cmp al, 59 0 00000D97 7503 jne _.L95 120:main.c **** } 1558 .loc 1 120 0 0 00000D99 C60700 mov byte ptr [bx], 0 1560 _.L95: 118:main.c **** if (*pp == ';') { 1561 .loc 1 118 0 discriminator 2 0 00000D9C 43 inc bx 1563 _.LVL150: 0 00000D9D E9F7FC jmp _.L94 1565 _.LVL151: 1566 _.L98: 1567 _.LBB169: 1568 _.LBB124: 825:main.c **** return; 826:main.c **** } 827:main.c **** 828:main.c **** /* reboot from harddisk */ 829:main.c **** EmulatedDriveStatus(0x00,0); 1569 .loc 1 829 0 0 00000DA0 57 push di 0 00000DA1 E8ACF9 call _EmulatedDriveStatus.constprop.0 1572 _.LVL152: 830:main.c **** EmulatedDriveStatus(0x80,0); 1573 .loc 1 830 0 0 00000DA4 BA8000 mov dx, 128 0 00000DA7 52 push dx 0 00000DA8 89967EFF mov word ptr [bp-130], dx 0 00000DAC E8A1F9 call _EmulatedDriveStatus.constprop.0 1578 _.LVL153: 831:main.c **** 832:main.c **** /* now jump and run */ 833:main.c **** r.a.x = 0x0201; 1579 .loc 1 833 0 0 00000DAF C746800102 mov word ptr [bp-128], 513 834:main.c **** r.c.x = 0x0001; 1581 .loc 1 834 0 0 00000DB4 C746840100 mov word ptr [bp-124], 1 835:main.c **** r.d.x = 0x0080; 1583 .loc 1 835 0 0 00000DB9 8B967EFF mov dx, word ptr [bp-130] 0 00000DBD 895686 mov word ptr [bp-122], dx 836:main.c **** r.b.x = 0x7c00; 1586 .loc 1 836 0 0 00000DC0 C74682007C mov word ptr [bp-126], 31744 837:main.c **** r.es = 0; 1588 .loc 1 837 0 0 00000DC5 897E90 mov word ptr [bp-112], di 838:main.c **** 839:main.c **** init_call_intr(0x13, &r); 1590 .loc 1 839 0 0 00000DC8 8D4680 lea ax, [-128+bp] 0 00000DCB 50 push ax 0 00000DCC B81300 mov ax, 19 0 00000DCF 50 push ax 0 00000DD0 E8[FEFF] call _init_call_intr 1596 _.LVL154: 840:main.c **** 841:main.c **** { 842:main.c **** #if __GNUC__ 843:main.c **** asm volatile("{ jmp $0,$0x7c00 | jmp 0,0x7c00 }"::); 1597 .loc 1 843 0 1598 #APP 1599 ;# 843 "main.c" 1 844 #else 1600 jmp 0,0x7c00 1601 ;# 0 "" 2 1602 #NO_APP 0 00000DD8 E910FD jmp _.L99 1604 _.LVL155: 1605 _.L100: 1606 _.LBE124: 1607 _.LBE169: 1608 _.LBB170: 1609 _.LBB127: 450:main.c **** "Kernel compatibility %d.%d - " 1610 .loc 1 450 0 0 00000DDB B9[5801] mov cx, offset _copyright 0 00000DDE 51 push cx 0 00000DDF B90A00 mov cx, 10 0 00000DE2 51 push cx 0 00000DE3 B90700 mov cx, 7 0 00000DE6 51 push cx 0 00000DE7 06 push es 0 00000DE8 52 push dx 0 00000DE9 B8[A100] mov ax, offset _.LC11 0 00000DEC 50 push ax 0 00000DED E8[FEFF] call _init_printf 1622 _.LVL156: 0 00000DF0 83C40C add sp, 12 0 00000DF3 E913FD jmp _.L101 1625 _.LVL157: 1626 _.L104: 1627 _.LBE127: 1628 _.LBE170: 1629 _.LBB171: 1630 _.LBB162: 1631 _.LBB160: 1632 _.LBB136: 731:main.c **** r.d.x = i; 1633 .loc 1 731 0 0 00000DF6 C746800001 mov word ptr [bp-128], 256 732:main.c **** init_call_intr(0x17, &r); 1635 .loc 1 732 0 0 00000DFB 897686 mov word ptr [bp-122], si 733:main.c **** } 1637 .loc 1 733 0 0 00000DFE 8D4680 lea ax, [-128+bp] 0 00000E01 50 push ax 0 00000E02 B81700 mov ax, 23 0 00000E05 50 push ax 0 00000E06 E8[FEFF] call _init_call_intr 1643 _.LVL158: 729:main.c **** { 1644 .loc 1 729 0 0 00000E09 46 inc si 1646 _.LVL159: 0 00000E0A E98BFD jmp _.L103 1648 _.LVL160: 1649 _.L106: 1650 _.LBE136: 1651 _.LBE160: 1652 _.LBB161: 1653 _.LBB139: 748:main.c **** r.d.x = i; 1654 .loc 1 748 0 0 00000E0D C74680A300 mov word ptr [bp-128], 163 749:main.c **** init_call_intr(0x14, &r); 1656 .loc 1 749 0 0 00000E12 895686 mov word ptr [bp-122], dx 0 00000E15 89967EFF mov word ptr [bp-130], dx 750:main.c **** } 1659 .loc 1 750 0 0 00000E19 8D4E80 lea cx, [-128+bp] 0 00000E1C 51 push cx 0 00000E1D 50 push ax 0 00000E1E E8[FEFF] call _init_call_intr 1664 _.LVL161: 746:main.c **** { 1665 .loc 1 746 0 0 00000E21 8B967EFF mov dx, word ptr [bp-130] 0 00000E25 42 inc dx 1668 _.LVL162: 0 00000E26 E98FFD jmp _.L105 1670 _.LVL163: 1671 _.L112: 0 00000E29 88C6 mov dh, al 0 00000E2B FEC6 inc dh 0 00000E2D 8D4F01 lea cx, [1+bx] 1675 _.LBE139: 1676 _.LBE161: 1677 _.LBE162: 1678 _.LBE171: 1679 _.LBB172: 1680 _.LBB168: 497:main.c **** break; 1681 .loc 1 497 0 0 00000E30 8078010D cmp byte ptr [bx+si+1], 13 0 00000E34 7409 je _.L111 0 00000E36 89CB mov bx, cx 0 00000E38 88F0 mov al, dh 0 00000E3A 88D4 mov ah, dl 0 00000E3C E93EFF jmp _.L110 1688 _.L111: 0 00000E3F 84E4 test ah, ah 0 00000E41 7403 je _.L115 0 00000E43 884680 mov byte ptr [bp-128], al 1692 _.L115: 503:main.c **** { 1693 .loc 1 503 0 0 00000E46 3C79 cmp al, 121 0 00000E48 7603E93EFF ja _.L114 1696 _.LVL164: 1697 _.LBB165: 507:main.c **** insertString = " /Y"; /* single step AUTOEXEC */ 1698 .loc 1 507 0 0 00000E4D 803E[0000]00 cmp byte ptr [_singleStep], 0 0 00000E52 7449 je _.L126 508:main.c **** 1701 .loc 1 508 0 0 00000E54 BA[1300] mov dx, offset _.LC6 1703 _.L117: 1704 _.LVL165: 510:main.c **** insertString = " /D"; /* disable AUTOEXEC */ 1705 .loc 1 510 0 0 00000E57 803E[0000]00 cmp byte ptr [_SkipAllConfig], 0 0 00000E5C 7543 jne _.L127 513:main.c **** { 1708 .loc 1 513 0 0 00000E5E 85D2 test dx, dx 0 00000E60 7503E926FF je _.L114 1711 _.LVL166: 1712 _.L118: 511:main.c **** 1713 .loc 1 511 0 0 00000E65 8D7680 lea si, [-128+bp] 0 00000E68 8D7C01 lea di, [1+si] 1716 _.LBB166: 519:main.c **** { 1717 .loc 1 519 0 0 00000E6B 8D7001 lea si, [1+bx+si] 1719 _.L119: 1720 _.LVL167: 0 00000E6E 39F7 cmp di, si 0 00000E70 7322 jnc _.L124 521:main.c **** { 1723 .loc 1 521 0 0 00000E72 8A05 mov al, byte ptr [di] 0 00000E74 88C4 mov ah, al 0 00000E76 80E4FB and ah, -5 0 00000E79 80FC09 cmp ah, 9 0 00000E7C 7404 je _.L129 0 00000E7E 3C20 cmp al, 32 0 00000E80 752C jne _.L120 1731 _.L129: 523:main.c **** q[3] = q[0]; 1732 .loc 1 523 0 0 00000E82 89DE mov si, bx 0 00000E84 8D5A82 lea bx, [-126+bp+si] 1735 _.LVL168: 1736 _.L122: 0 00000E87 39DF cmp di, bx 0 00000E89 761B jbe _.L123 525:main.c **** break; 1739 .loc 1 525 0 0 00000E8B B80300 mov ax, 3 0 00000E8E 50 push ax 0 00000E8F 52 push dx 0 00000E90 57 push di 0 00000E91 E8[FEFF] call _init_memcpy 1745 _.LVL169: 1746 _.L124: 530:main.c **** } 1747 .loc 1 530 0 0 00000E94 8D4681 lea ax, [-127+bp] 0 00000E97 A3[0800] mov word ptr [_Config+8], ax 0 00000E9A E9EEFE jmp _.L114 1751 _.LVL170: 1752 _.L126: 1753 _.LBE166: 505:main.c **** 1754 .loc 1 505 0 0 00000E9D 31D2 xor dx, dx 0 00000E9F EBB6 jmp _.L117 1757 _.LVL171: 1758 _.L127: 511:main.c **** 1759 .loc 1 511 0 0 00000EA1 BA[1700] mov dx, offset _.LC7 1761 _.LVL172: 0 00000EA4 EBBF jmp _.L118 1763 _.LVL173: 1764 _.L123: 1765 _.LBB167: 524:main.c **** memcpy(p, insertString, 3); 1766 .loc 1 524 0 0 00000EA6 8A07 mov al, byte ptr [bx] 0 00000EA8 884703 mov byte ptr [bx+3], al 523:main.c **** q[3] = q[0]; 1769 .loc 1 523 0 0 00000EAB 4B dec bx 1771 _.LVL174: 0 00000EAC EBD9 jmp _.L122 1773 _.LVL175: 1774 _.L120: 519:main.c **** { 1775 .loc 1 519 0 0 00000EAE 47 inc di 1777 _.LVL176: 0 00000EAF EBBD jmp _.L119 1779 _.LBE167: 1780 _.LBE165: 1781 _.LBE168: 1782 _.LBE172: 1783 _.LFE4: 1784 .size _FreeDOSmain, .-_FreeDOSmain === Switch to base=012BB0h -> ".RODATA.STR1.1" 1785 .section .rodata.str1.1 1786 _.LC13: 0 00000725 0A496E7465726E61 .string "\nInternal kernel error - %s\nSystem halted\n" 0 0000072D 6C206B65726E656C 0 00000735 206572726F72202D 0 0000073D 2025730A53797374 0 00000745 656D2068616C7465 0 0000074D 640A00 === Switch to base=002270h -> ".TEXT" 1788 .text 1789 .global _init_fatal 1790 .type _init_fatal, @function 1791 _init_fatal: 1792 _.LFB17: 707:main.c **** printf("\nInternal kernel error - %s\nSystem halted\n", err_msg); 1793 .loc 1 707 0 1794 _.LVL177: 0 00000EB1 55 push bp 1796 _.LCFI14: 0 00000EB2 89E5 mov bp, sp 1798 _.LCFI15: 708:main.c **** for (;;) ; 1799 .loc 1 708 0 0 00000EB4 FF7604 push word ptr [bp+4] 0 00000EB7 B8[EC00] mov ax, offset _.LC13 0 00000EBA 50 push ax 0 00000EBB E8[FEFF] call _init_printf 1804 _.LVL178: 0 00000EBE 83C404 add sp, 4 1806 _.L155: 0 00000EC1 EBFE jmp _.L155 1808 _.LFE17: 1809 .size _init_fatal, .-_init_fatal === Switch to base=000790h -> ".DATA" 1810 .data 1811 .type _filename.1897, @object 1812 .size _filename.1897, 15 1813 _filename.1897: 0 00000000 413A2D404A554E4B .string "A:-@JUNK@-.TMP" 0 00000008 402D2E544D5000 1815 .type _vectors.1921, @object 1816 .size _vectors.1921, 45 1817 _vectors.1921: 0 0000000F 80 .byte -128 0 00000010 [0000] .hword ___ia16_near_alias.0 0 00000012 81 .byte -127 0 00000013 [0000] .hword ___ia16_near_alias.1 0 00000015 83 .byte -125 0 00000016 [0000] .hword ___ia16_near_alias.2 0 00000018 86 .byte -122 0 00000019 [0000] .hword ___ia16_near_alias.3 0 0000001B 19 .byte 25 0 0000001C [0000] .hword ___ia16_near_alias.4 0 0000001E 20 .byte 32 0 0000001F [0000] .hword ___ia16_near_alias.5 0 00000021 21 .byte 33 0 00000022 [0000] .hword ___ia16_near_alias.6 0 00000024 22 .byte 34 0 00000025 [0000] .hword ___ia16_near_alias.7 0 00000027 24 .byte 36 0 00000028 [0000] .hword ___ia16_near_alias.8 0 0000002A 25 .byte 37 0 0000002B [0000] .hword ___ia16_near_alias.9 0 0000002D 26 .byte 38 0 0000002E [0000] .hword ___ia16_near_alias.10 0 00000030 27 .byte 39 0 00000031 [0000] .hword ___ia16_near_alias.11 0 00000033 28 .byte 40 0 00000034 [0000] .hword ___ia16_near_alias.12 0 00000036 2A .byte 42 0 00000037 [0000] .hword ___ia16_near_alias.13 0 00000039 2F .byte 47 0 0000003A [0000] .hword ___ia16_near_alias.14 1848 .global _debugger_present 1849 .type _debugger_present, @object 1850 .size _debugger_present, 1 1851 _debugger_present: 0 0000003C FF .byte -1 1853 .global _kernel_command_line_length === Switch to base=012BB0h -> ".BSS" 1854 .bss 1855 .p2align 1 1856 .type _kernel_command_line_length, @object 1857 .size _kernel_command_line_length, 2 1858 _kernel_command_line_length: 0 00001224 0000 .skip 2,0 1860 .global _kernel_command_line === Switch to base=000790h -> ".DATA" 1861 .data 1862 .type _kernel_command_line, @object 1863 .size _kernel_command_line, 256 1864 _kernel_command_line: 0 0000003D 00 .byte 0 0 0000003E FF .byte -1 0 0000003F 0000000000000000 .skip 254,0 0 00000047 0000000000000000 0 0000004F 0000000000000000 0 00000057 0000000000000000 0 0000005F 0000000000000000 0 00000067 0000000000000000 0 0000006F 0000000000000000 0 00000077 0000000000000000 0 0000007F 0000000000000000 0 00000087 0000000000000000 0 0000008F 0000000000000000 0 00000097 0000000000000000 0 0000009F 0000000000000000 0 000000A7 0000000000000000 0 000000AF 0000000000000000 0 000000B7 0000000000000000 0 000000BF 0000000000000000 0 000000C7 0000000000000000 0 000000CF 0000000000000000 0 000000D7 0000000000000000 0 000000DF 0000000000000000 0 000000E7 0000000000000000 0 000000EF 0000000000000000 0 000000F7 0000000000000000 0 000000FF 0000000000000000 0 00000107 0000000000000000 0 0000010F 0000000000000000 0 00000117 0000000000000000 0 0000011F 0000000000000000 0 00000127 0000000000000000 0 0000012F 0000000000000000 0 00000137 000000000000 1868 .global _InitKernelConfig 1869 .type _InitKernelConfig, @object 1870 .size _InitKernelConfig, 23 1871 _InitKernelConfig: 0 0000013D FF .byte -1 0 0000013E 0000000000 .skip 5,0 0 00000143 0000000000000000 .skip 17,0 0 0000014B 0000000000000000 0 00000153 00 1875 .global _LoL 1876 .p2align 1 1877 .type _LoL, @object 1878 .size _LoL, 4 1879 _LoL: 0 00000154 [0000] .hword _DATASTART 1881 .reloc ., R_386_OZSEG16, _DATASTART 0 00000156 [0000] .hword 0 1883 .type _copyright, @object 1884 .size _copyright, 346 1885 _copyright: 0 00000158 28432920436F7079 .ascii "(C) Copyright 1995-2023 Pasquale J. Villani and The FreeDOS " 0 00000160 7269676874203139 0 00000168 39352D3230323320 0 00000170 5061737175616C65 0 00000178 204A2E2056696C6C 0 00000180 616E6920616E6420 0 00000188 5468652046726565 0 00000190 444F5320 0 00000194 50726F6A6563742E .ascii "Project.\nAll Rights Reserved." 0 0000019C 0A416C6C20526967 0 000001A4 6874732052657365 0 000001AC 727665642E 0 000001B1 2054686973206973 .string " This is free software and comes with ABSOLUTELY NO\nWARRANTY; you can redistribute it an 0 000001B9 206672656520736F 0 000001C1 6674776172652061 0 000001C9 6E6420636F6D6573 0 000001D1 2077697468204142 0 000001D9 534F4C5554454C59 0 000001E1 204E4F0A57415252 0 000001E9 414E54593B20796F 0 000001F1 752063616E207265 0 000001F9 6469737472696275 0 00000201 746520697420616E 0 00000209 642F6F72206D6F64 0 00000211 6966792069742075 0 00000219 6E64657220746865 0 00000221 207465726D73206F 0 00000229 66207468650A474E 0 00000231 552047656E657261 0 00000239 6C205075626C6963 0 00000241 204C6963656E7365 0 00000249 206173207075626C 0 00000251 6973686564206279 0 00000259 2074686520467265 0 00000261 6520536F66747761 0 00000269 726520466F756E64 0 00000271 6174696F6E3B0A65 0 00000279 6974686572207665 0 00000281 7273696F6E20322C 0 00000289 206F722028617420 0 00000291 796F7572206F7074 0 00000299 696F6E2920616E79 0 000002A1 206C617465722076 0 000002A9 657273696F6E2E0A 0 000002B1 00 1889 .weakref ___ia16_near_alias.15,__HMATextEnd 1890 .weakref ___ia16_near_alias.14,_int2f_handler 1891 .weakref ___ia16_near_alias.13,_int2a_handler 1892 .weakref ___ia16_near_alias.12,_int28_handler 1893 .weakref ___ia16_near_alias.11,_int27_handler 1894 .weakref ___ia16_near_alias.10,_low_int26_handler 1895 .weakref ___ia16_near_alias.9,_low_int25_handler 1896 .weakref ___ia16_near_alias.8,_int24_handler 1897 .weakref ___ia16_near_alias.7,_int22_handler 1898 .weakref ___ia16_near_alias.6,_int21_handler 1899 .weakref ___ia16_near_alias.5,_int20_handler 1900 .weakref ___ia16_near_alias.4,_int19_handler 1901 .weakref ___ia16_near_alias.3,_int6_handler 1902 .weakref ___ia16_near_alias.2,_empty_handler 1903 .weakref ___ia16_near_alias.1,_empty_handler 1904 .weakref ___ia16_near_alias.0,_int0_handler === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: memdisk.lst 1 ; File: 2 ; memdisk.asm 3 ; Description: 4 ; Query for memdisk provided config.sys parameters 5 ; 6 ; DOS-C 7 ; Copyright (c) 2011 8 ; FreeDOS 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; 24 25 ; requires 386+ registers, check LoL->CPU >=3 prior to calling (or use 386 build) 26 27 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif === Switch to base=00E150h -> "INIT_TEXT" 28 segment INIT_TEXT 29 30 CPU 386 31 ;********************************************************************* 32 ; 33 ; query_memdisk() based on similar subroutine in Eric Auer's public domain getargs.asm which is based on IFMEMDSK 34 ; input: drive (in AL) to query if memdisk provided disk 35 ; output: a far * to a memdiskinfo structure as defined by memdisk (see config.c) 36 ; struct memdiskinfo FAR * query_memdisk(UBYTE drive); 37 global _query_memdisk 38 _query_memdisk: 39 ; save registers, assumes enough space on stack & valid stack frame setup, ax & dx return values 0 0000043B 06 push es 0 0000043C 57 push di 0 0000043D 6653 push ebx 0 0000043F 6651 push ecx 0 00000441 6652 push edx ; we only care about high word 0 00000443 6650 push eax ; we only care about high word 0 00000445 66BA00004953 mov edx,53490000h ; magic3 + 0 0000044B 88C2 mov dl, al ; drive number (only argument, assumed to be in AL) 0 0000044D 66B800084D45 mov eax,454d0800h ; magic1 + AH=8 (get geometry) 0 00000453 66B900004D44 mov ecx,444d0000h ; magic2 0 00000459 66BB00004B3F mov ebx,3f4b0000h ; magic4 0 0000045F CD13 int 13h ; BIOS DISK API 0 00000461 66C1E810 shr eax,16 ; ignore AX 0 00000465 66C1EB10 shr ebx,16 ; ignore BX 0 00000469 66C1E910 shr ecx,16 ; ignore CX (geometry C/S) 0 0000046D 66C1EA10 shr edx,16 ; ignore DX (geometry H in DH) 0 00000471 3D214D cmp ax,4d21h ; magic5 0 00000474 7514 jnz nomemdisk 0 00000476 81F9454D cmp cx,4d45h ; magic6 0 0000047A 750E jnz nomemdisk 0 0000047C 81FA4449 cmp dx,4944h ; magic7 0 00000480 7508 jnz nomemdisk 0 00000482 81FB534B cmp bx,4b53h ; magic8 0 00000486 7502 jnz nomemdisk 0 00000488 EB04 jmp cleanup 65 66 nomemdisk: 0 0000048A 31FF xor di, di ; return NULL; 0 0000048C 8EC7 mov es, di 69 70 cleanup: 0 0000048E 6658 pop eax 0 00000490 665A pop edx 0 00000492 89F8 mov ax, di ; return MK_FP(es, di); 0 00000494 8CC2 mov dx, es 0 00000496 6659 pop ecx 0 00000498 665B pop ebx 0 0000049A 5F pop di 0 0000049B 07 pop es 0 0000049C C3 retn === Trace listing source: memmgr.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=memmgr.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccHxoKFP.s output file : memmgr.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:54.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _joinMCBs, @function 8 _joinMCBs: 9 _.LFB4: 10 .file 1 "memmgr.c" 1:memmgr.c **** /****************************************************************/ 2:memmgr.c **** /* */ 3:memmgr.c **** /* memmgr.c */ 4:memmgr.c **** /* */ 5:memmgr.c **** /* Memory Manager for Core Allocation */ 6:memmgr.c **** /* */ 7:memmgr.c **** /* Copyright (c) 1995 */ 8:memmgr.c **** /* Pasquale J. Villani */ 9:memmgr.c **** /* All Rights Reserved */ 10:memmgr.c **** /* */ 11:memmgr.c **** /* This file is part of DOS-C. */ 12:memmgr.c **** /* */ 13:memmgr.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:memmgr.c **** /* modify it under the terms of the GNU General Public License */ 15:memmgr.c **** /* as published by the Free Software Foundation; either version */ 16:memmgr.c **** /* 2, or (at your option) any later version. */ 17:memmgr.c **** /* */ 18:memmgr.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:memmgr.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:memmgr.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:memmgr.c **** /* the GNU General Public License for more details. */ 22:memmgr.c **** /* */ 23:memmgr.c **** /* You should have received a copy of the GNU General Public */ 24:memmgr.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:memmgr.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:memmgr.c **** /* Cambridge, MA 02139, USA. */ 27:memmgr.c **** /****************************************************************/ 28:memmgr.c **** 29:memmgr.c **** #include "portab.h" 30:memmgr.c **** #include "globals.h" 31:memmgr.c **** 32:memmgr.c **** #ifdef VERSION_STRING 33:memmgr.c **** static BYTE *memmgrRcsId = 34:memmgr.c **** "$Id: memmgr.c 1338 2007-07-20 20:52:33Z mceric $"; 35:memmgr.c **** #endif 36:memmgr.c **** 37:memmgr.c **** #define nxtMCBsize(mcb,size) MK_FP(FP_SEG(mcb) + (size) + 1, FP_OFF(mcb)) 38:memmgr.c **** #define nxtMCB(mcb) nxtMCBsize((mcb), (mcb)->m_size) 39:memmgr.c **** 40:memmgr.c **** #define mcbFree(mcb) ((mcb)->m_psp == FREE_PSP) 41:memmgr.c **** #define mcbValid(mcb) ( ((mcb)->m_size != 0xffff) && \ 42:memmgr.c **** ((mcb)->m_type == MCB_NORMAL || (mcb)->m_type == MCB_LAST) ) 43:memmgr.c **** #define mcbFreeable(mcb) \ 44:memmgr.c **** ((mcb)->m_type == MCB_NORMAL || (mcb)->m_type == MCB_LAST) 45:memmgr.c **** 46:memmgr.c **** #define para2far(seg) (mcb FAR *)MK_FP((seg) , 0) 47:memmgr.c **** 48:memmgr.c **** /* 49:memmgr.c **** * Join any following unused MCBs to MCB 'p'. 50:memmgr.c **** * Return: 51:memmgr.c **** * SUCCESS: on success 52:memmgr.c **** * else: error number <> 53:memmgr.c **** */ 54:memmgr.c **** STATIC COUNT joinMCBs(seg para) 55:memmgr.c **** { 11 .loc 1 55 0 12 _.LVL0: 0 00009A27 56 push si 0 00009A28 57 push di 0 00009A29 55 push bp 16 _.LCFI0: 0 00009A2A 89E5 mov bp, sp 18 _.LCFI1: 56:memmgr.c **** mcb FAR *p = para2far(para); 19 .loc 1 56 0 0 00009A2C 31FF xor di, di 21 _.LVL1: 57:memmgr.c **** mcb FAR *q; 58:memmgr.c **** 59:memmgr.c **** /* loop as long as the current MCB is not the last one in the chain 60:memmgr.c **** and the next MCB is unused */ 61:memmgr.c **** while (p->m_type == MCB_NORMAL) 62:memmgr.c **** { 63:memmgr.c **** q = nxtMCB(p); 22 .loc 1 63 0 0 00009A2E 8B4E08 mov cx, word ptr [bp+8] 0 00009A31 41 inc cx 25 _.LVL2: 26 _.L2: 61:memmgr.c **** { 27 .loc 1 61 0 0 00009A32 8E4608 mov es, word ptr [bp+8] 0 00009A35 26803D4D cmp byte ptr es:[di], 77 0 00009A39 7408 je _.L5 31 _.L6: 64:memmgr.c **** if (!mcbFree(q)) 65:memmgr.c **** break; 66:memmgr.c **** if (!mcbValid(q)) 67:memmgr.c **** return DE_MCBDESTRY; 68:memmgr.c **** /* join both MCBs */ 69:memmgr.c **** p->m_type = q->m_type; /* possibly the next MCB is the last one */ 70:memmgr.c **** p->m_size += q->m_size + 1; /* one for q's MCB itself */ 71:memmgr.c **** #if 0 /* this spoils QB4's habit to double-free: */ 72:memmgr.c **** q->m_type = 'K'; /* Invalidate the magic number (whole MCB) */ 73:memmgr.c **** #else 74:memmgr.c **** q->m_size = 0xffff; /* mark the now unlinked MCB as "fake" */ 75:memmgr.c **** #endif 76:memmgr.c **** } 77:memmgr.c **** 78:memmgr.c **** return SUCCESS; 32 .loc 1 78 0 0 00009A3B 31C0 xor ax, ax 34 _.L1: 79:memmgr.c **** } 35 .loc 1 79 0 0 00009A3D 5D pop bp 0 00009A3E 5F pop di 38 _.LVL3: 0 00009A3F 5E pop si 0 00009A40 C20200 ret 2 41 _.LVL4: 42 _.L5: 63:memmgr.c **** if (!mcbFree(q)) 43 .loc 1 63 0 0 00009A43 8E4608 mov es, word ptr [bp+8] 0 00009A46 268B360300 mov si, word ptr es:[3] 0 00009A4B 89C8 mov ax, cx 0 00009A4D 01F0 add ax, si 48 _.LVL5: 64:memmgr.c **** if (!mcbFree(q)) 49 .loc 1 64 0 0 00009A4F 8EC0 mov es, ax 0 00009A51 26833E010000 cmp word ptr es:[1], 0 0 00009A57 75E2 jne _.L6 66:memmgr.c **** return DE_MCBDESTRY; 53 .loc 1 66 0 0 00009A59 26833E0300FF cmp word ptr es:[3], -1 0 00009A5F 7430 je _.L8 66:memmgr.c **** return DE_MCBDESTRY; 56 .loc 1 66 0 is_stmt 0 discriminator 1 0 00009A61 268A15 mov dl, byte ptr es:[di] 0 00009A64 80FA4D cmp dl, 77 0 00009A67 7405 je _.L9 0 00009A69 80FA5A cmp dl, 90 0 00009A6C 7523 jne _.L8 62 _.L9: 69:memmgr.c **** p->m_size += q->m_size + 1; /* one for q's MCB itself */ 63 .loc 1 69 0 is_stmt 1 0 00009A6E 8E4608 mov es, word ptr [bp+8] 0 00009A71 268815 mov byte ptr es:[di], dl 70:memmgr.c **** #if 0 /* this spoils QB4's habit to double-free: */ 66 .loc 1 70 0 0 00009A74 8EC0 mov es, ax 0 00009A76 268B1E0300 mov bx, word ptr es:[3] 0 00009A7B 8D5801 lea bx, [1+bx+si] 0 00009A7E 8E4608 mov es, word ptr [bp+8] 0 00009A81 26891E0300 mov word ptr es:[3], bx 74:memmgr.c **** #endif 72 .loc 1 74 0 0 00009A86 8EC0 mov es, ax 0 00009A88 26C7060300FFFF mov word ptr es:[3], -1 0 00009A8F EBA1 jmp _.L2 76 _.L8: 67:memmgr.c **** /* join both MCBs */ 77 .loc 1 67 0 0 00009A91 B8F9FF mov ax, -7 79 _.LVL6: 0 00009A94 EBA7 jmp _.L1 81 _.LFE4: 82 .size _joinMCBs, .-_joinMCBs 83 .global _adjust_far 84 .type _adjust_far, @function 85 _adjust_far: 86 _.LFB5: 80:memmgr.c **** 81:memmgr.c **** /* 82:memmgr.c **** * Return a normalized far pointer 83:memmgr.c **** */ 84:memmgr.c **** void FAR * adjust_far(const void FAR * fp) 85:memmgr.c **** { 87 .loc 1 85 0 88 _.LVL7: 0 00009A96 57 push di 0 00009A97 55 push bp 91 _.LCFI2: 0 00009A98 89E5 mov bp, sp 93 _.LCFI3: 0 00009A9A 8B5E06 mov bx, word ptr [bp+6] 0 00009A9D 8B7E08 mov di, word ptr [bp+8] 86:memmgr.c **** /* and return an adddress adjusted to the nearest paragraph */ 87:memmgr.c **** /* boundary. */ 88:memmgr.c **** 89:memmgr.c **** if (FP_SEG(fp) == 0xffff) 90:memmgr.c **** return (void FAR *)fp; 96 .loc 1 90 0 0 00009AA0 89D8 mov ax, bx 0 00009AA2 89FA mov dx, di 89:memmgr.c **** return (void FAR *)fp; 99 .loc 1 89 0 0 00009AA4 83FFFF cmp di, -1 0 00009AA7 740B je _.L14 91:memmgr.c **** 92:memmgr.c **** #ifndef I86 93:memmgr.c **** if (FP_SEG(fp) == 0) 94:memmgr.c **** return (void FAR *)fp; 95:memmgr.c **** #endif 96:memmgr.c **** 97:memmgr.c **** return MK_FP(FP_SEG(fp) + (FP_OFF(fp) >> 4), FP_OFF(fp) & 0xf); 102 .loc 1 97 0 0 00009AA9 89DA mov dx, bx 0 00009AAB B104 mov cl, 4 0 00009AAD D3EA shr dx, cl 0 00009AAF 83E00F and ax, 15 0 00009AB2 01FA add dx, di 108 _.L14: 98:memmgr.c **** } 109 .loc 1 98 0 0 00009AB4 5D pop bp 0 00009AB5 5F pop di 0 00009AB6 C20400 ret 4 113 _.LFE5: 114 .size _adjust_far, .-_adjust_far 115 .global _DosMemAlloc 116 .type _DosMemAlloc, @function 117 _DosMemAlloc: 118 _.LFB6: 99:memmgr.c **** 100:memmgr.c **** #undef REG 101:memmgr.c **** #define REG 102:memmgr.c **** 103:memmgr.c **** #if 1 /* #ifdef KERNEL KERNEL */ 104:memmgr.c **** /* Allocate a new memory area. *para is assigned to the segment of the 105:memmgr.c **** MCB rather then the segment of the data portion */ 106:memmgr.c **** /* If mode == LARGEST, asize MUST be != NULL and will always recieve the 107:memmgr.c **** largest available block, which is allocated. 108:memmgr.c **** If mode != LARGEST, asize maybe NULL, but if not, it is assigned to the 109:memmgr.c **** size of the largest available block only on failure. 110:memmgr.c **** size is the minimum size of the block to search for, 111:memmgr.c **** even if mode == LARGEST. 112:memmgr.c **** */ 113:memmgr.c **** COUNT DosMemAlloc(UWORD size, COUNT mode, seg *para, UWORD *asize) 114:memmgr.c **** { 119 .loc 1 114 0 120 _.LVL8: 0 00009AB9 56 push si 0 00009ABA 57 push di 0 00009ABB 55 push bp 124 _.LCFI4: 0 00009ABC 89E5 mov bp, sp 126 _.LCFI5: 0 00009ABE 83EC0A sub sp, 10 0 00009AC1 8B4E0A mov cx, word ptr [bp+10] 115:memmgr.c **** REG mcb FAR *p; 116:memmgr.c **** mcb FAR *foundSeg; 117:memmgr.c **** mcb FAR *biggestSeg; 118:memmgr.c **** /* Initialize */ 119:memmgr.c **** 120:memmgr.c **** searchAgain: 121:memmgr.c **** 122:memmgr.c **** p = para2far(first_mcb); 129 .loc 1 122 0 0 00009AC4 31C0 xor ax, ax 0 00009AC6 8EC0 mov es, ax 132 _.L20: 133 _.LVL9: 134 _.L44: 0 00009AC8 368B3E[0000] mov di, word ptr ss:[_first_mcb] 136 _.LVL10: 123:memmgr.c **** 124:memmgr.c **** biggestSeg = foundSeg = NULL; 125:memmgr.c **** /* 126:memmgr.c **** Hack to the Umb Region direct for now. Save time and program space. 127:memmgr.c **** */ 128:memmgr.c **** if ((uppermem_link & 1) && uppermem_root != 0xffff) 137 .loc 1 128 0 0 00009ACD 36F606[0000]01 test byte ptr ss:[_uppermem_link], 1 0 00009AD3 7428 je _.L21 140 .loc 1 128 0 is_stmt 0 discriminator 1 0 00009AD5 368B16[0000] mov dx, word ptr ss:[_uppermem_root] 0 00009ADA 83FAFF cmp dx, -1 0 00009ADD 741E je _.L21 144 _.LBB2: 0 00009ADF 89C8 mov ax, cx 129:memmgr.c **** { 130:memmgr.c **** COUNT tmpmode = (mode == LARGEST ? mem_access_mode : mode); 146 .loc 1 130 0 is_stmt 1 0 00009AE1 83F9FF cmp cx, -1 0 00009AE4 7506 jne _.L22 149 .loc 1 130 0 is_stmt 0 discriminator 1 0 00009AE6 36A0[0000] mov al, byte ptr ss:[_mem_access_mode] 0 00009AEA 30E4 xor ah, ah 152 _.L22: 153 _.LVL11: 131:memmgr.c **** if ((mode != LARGEST || size == 0xffff) && 154 .loc 1 131 0 is_stmt 1 discriminator 4 0 00009AEC 83F9FF cmp cx, -1 0 00009AEF 7206 jc _.L59 0 00009AF1 837E08FF cmp word ptr [bp+8], -1 0 00009AF5 7206 jc _.L21 159 _.L59: 160 .loc 1 131 0 is_stmt 0 discriminator 1 0 00009AF7 A8C0 test al, -64 0 00009AF9 7402 je _.L21 132:memmgr.c **** (tmpmode & (FIRST_FIT_UO | FIRST_FIT_U))) 133:memmgr.c **** p = para2far(uppermem_root); 163 .loc 1 133 0 is_stmt 1 0 00009AFB 89D7 mov di, dx 165 _.LVL12: 166 _.L21: 0 00009AFD 8CC6 mov si, es 0 00009AFF C746FC0000 mov word ptr [bp-4], 0 0 00009B04 31C0 xor ax, ax 0 00009B06 8946FE mov word ptr [bp-2], ax 0 00009B09 92 xchg dx, ax 172 _.LVL13: 173 _.L37: 174 _.LBE2: 134:memmgr.c **** } 135:memmgr.c **** 136:memmgr.c **** /* Search through memory blocks */ 137:memmgr.c **** FOREVER 138:memmgr.c **** { 139:memmgr.c **** /* check for corruption */ 140:memmgr.c **** if (!mcbValid(p)) 175 .loc 1 140 0 0 00009B0A 8EDF mov ds, di 0 00009B0C 833E0300FF cmp word ptr [3], -1 0 00009B11 750D jne _.L24 179 _.LVL14: 180 _.L26: 141:memmgr.c **** return DE_MCBDESTRY; 181 .loc 1 141 0 0 00009B13 B8F9FF mov ax, -7 183 _.LVL15: 184 _.L19: 142:memmgr.c **** 143:memmgr.c **** if (mcbFree(p)) 144:memmgr.c **** { /* unused block, check if it applies to the rule */ 145:memmgr.c **** if (joinMCBs(FP_SEG(p)) != SUCCESS) /* join following unused blocks */ 146:memmgr.c **** return DE_MCBDESTRY; /* error */ 147:memmgr.c **** 148:memmgr.c **** if (!biggestSeg || biggestSeg->m_size < p->m_size) 149:memmgr.c **** biggestSeg = p; 150:memmgr.c **** 151:memmgr.c **** if (p->m_size >= size) 152:memmgr.c **** { /* if the block is too small, ignore */ 153:memmgr.c **** /* this block has a "match" size, try the rule set */ 154:memmgr.c **** switch (mode) 155:memmgr.c **** { 156:memmgr.c **** case LAST_FIT: /* search for last possible */ 157:memmgr.c **** case LAST_FIT_U: 158:memmgr.c **** case LAST_FIT_UO: 159:memmgr.c **** default: 160:memmgr.c **** foundSeg = p; 161:memmgr.c **** break; 162:memmgr.c **** 163:memmgr.c **** case LARGEST: /* grab the biggest block */ 164:memmgr.c **** /* it is calculated when the MCB chain 165:memmgr.c **** was completely checked */ 166:memmgr.c **** break; 167:memmgr.c **** 168:memmgr.c **** case BEST_FIT: /* first, but smallest block */ 169:memmgr.c **** case BEST_FIT_U: 170:memmgr.c **** case BEST_FIT_UO: 171:memmgr.c **** if (!foundSeg || foundSeg->m_size > p->m_size) 172:memmgr.c **** /* better match found */ 173:memmgr.c **** foundSeg = p; 174:memmgr.c **** break; 175:memmgr.c **** 176:memmgr.c **** case FIRST_FIT: /* first possible */ 177:memmgr.c **** case FIRST_FIT_U: 178:memmgr.c **** case FIRST_FIT_UO: 179:memmgr.c **** foundSeg = p; 180:memmgr.c **** goto stopIt; /* OK, rest of chain can be ignored */ 181:memmgr.c **** 182:memmgr.c **** } 183:memmgr.c **** } 184:memmgr.c **** } 185:memmgr.c **** 186:memmgr.c **** if (p->m_type == MCB_LAST) 187:memmgr.c **** break; /* end of chain reached */ 188:memmgr.c **** 189:memmgr.c **** p = nxtMCB(p); /* advance to next MCB */ 190:memmgr.c **** } 191:memmgr.c **** 192:memmgr.c **** if (mode == LARGEST && biggestSeg && biggestSeg->m_size >= size) 193:memmgr.c **** *asize = (foundSeg = biggestSeg)->m_size; 194:memmgr.c **** 195:memmgr.c **** if (!foundSeg || !foundSeg->m_size) 196:memmgr.c **** { /* no block to fullfill the request */ 197:memmgr.c **** if ((mode != LARGEST) && (mode & FIRST_FIT_U) && 198:memmgr.c **** (uppermem_link & 1) && uppermem_root != 0xffff) 199:memmgr.c **** { 200:memmgr.c **** mode &= ~FIRST_FIT_U; 201:memmgr.c **** goto searchAgain; 202:memmgr.c **** } 203:memmgr.c **** if (asize) 204:memmgr.c **** *asize = biggestSeg ? biggestSeg->m_size : 0; 205:memmgr.c **** return DE_NOMEM; 206:memmgr.c **** } 207:memmgr.c **** 208:memmgr.c **** stopIt: /* reached from FIRST_FIT on match */ 209:memmgr.c **** 210:memmgr.c **** if (mode != LARGEST && size != foundSeg->m_size) 211:memmgr.c **** { 212:memmgr.c **** /* Split the found buffer because it is larger than requested */ 213:memmgr.c **** /* foundSeg := pointer to allocated block 214:memmgr.c **** p := pointer to MCB that will form the rest of the block 215:memmgr.c **** */ 216:memmgr.c **** if ((mode == LAST_FIT) || (mode == LAST_FIT_UO) 217:memmgr.c **** || (mode == LAST_FIT_U)) 218:memmgr.c **** { 219:memmgr.c **** /* allocate the block from the end of the found block */ 220:memmgr.c **** p = foundSeg; 221:memmgr.c **** p->m_size -= size + 1; /* size+1 paragraphes are allocated by 222:memmgr.c **** the new segment (+1 for MCB itself) */ 223:memmgr.c **** foundSeg = nxtMCB(p); 224:memmgr.c **** 225:memmgr.c **** /* initialize stuff because foundSeg > p */ 226:memmgr.c **** foundSeg->m_type = p->m_type; 227:memmgr.c **** p->m_type = MCB_NORMAL; 228:memmgr.c **** } 229:memmgr.c **** else 230:memmgr.c **** { /* all other modes allocate from the beginning */ 231:memmgr.c **** p = nxtMCBsize(foundSeg, size); 232:memmgr.c **** 233:memmgr.c **** /* initialize stuff because p > foundSeg */ 234:memmgr.c **** p->m_type = foundSeg->m_type; 235:memmgr.c **** p->m_size = foundSeg->m_size - size - 1; 236:memmgr.c **** foundSeg->m_type = MCB_NORMAL; 237:memmgr.c **** } 238:memmgr.c **** 239:memmgr.c **** /* Already initialized: 240:memmgr.c **** p->m_size, ->m_type, foundSeg->m_type 241:memmgr.c **** */ 242:memmgr.c **** p->m_psp = FREE_PSP; /* unused */ 243:memmgr.c **** 244:memmgr.c **** foundSeg->m_size = size; 245:memmgr.c **** } 246:memmgr.c **** 247:memmgr.c **** /* Already initialized: 248:memmgr.c **** foundSeg->m_size, ->m_type 249:memmgr.c **** */ 250:memmgr.c **** foundSeg->m_psp = cu_psp; /* the new block is for current process */ 251:memmgr.c **** foundSeg->m_name[0] = '\0'; 252:memmgr.c **** 253:memmgr.c **** *para = FP_SEG(foundSeg); 254:memmgr.c **** return SUCCESS; 255:memmgr.c **** } 185 .loc 1 255 0 0 00009B16 89EC mov sp, bp 0 00009B18 5D pop bp 0 00009B19 5F pop di 0 00009B1A 5E pop si 0 00009B1B 16 push ss 0 00009B1C 1F pop ds 0 00009B1D C20800 ret 8 193 _.LVL16: 194 _.L24: 140:memmgr.c **** return DE_MCBDESTRY; 195 .loc 1 140 0 discriminator 1 0 00009B20 8EDF mov ds, di 0 00009B22 8CC3 mov bx, es 0 00009B24 8A07 mov al, byte ptr [bx] 0 00009B26 3C4D cmp al, 77 0 00009B28 7404 je _.L60 201 _.LVL17: 0 00009B2A 3C5A cmp al, 90 0 00009B2C 75E5 jne _.L26 204 _.L60: 143:memmgr.c **** { /* unused block, check if it applies to the rule */ 205 .loc 1 143 0 0 00009B2E 8EDF mov ds, di 0 00009B30 833E010000 cmp word ptr [1], 0 0 00009B35 7403E98900 jne _.L28 0 00009B3A 8C46F6 mov word ptr [bp-10], es 0 00009B3D 8956F8 mov word ptr [bp-8], dx 0 00009B40 894EFA mov word ptr [bp-6], cx 145:memmgr.c **** return DE_MCBDESTRY; /* error */ 212 .loc 1 145 0 0 00009B43 57 push di 0 00009B44 16 push ss 0 00009B45 1F pop ds 0 00009B46 E8DEFE call _joinMCBs 217 _.LVL18: 0 00009B49 85C0 test ax, ax 0 00009B4B 75C6 jne _.L26 148:memmgr.c **** biggestSeg = p; 220 .loc 1 148 0 0 00009B4D 8B46FC mov ax, word ptr [bp-4] 0 00009B50 09F0 or ax, si 0 00009B52 8B4EFA mov cx, word ptr [bp-6] 0 00009B55 8B56F8 mov dx, word ptr [bp-8] 0 00009B58 8E46F6 mov es, word ptr [bp-10] 0 00009B5B 743A je _.L53 0 00009B5D 8E5EFC mov ds, word ptr [bp-4] 0 00009B60 8B4403 mov ax, word ptr [si+3] 0 00009B63 8EDF mov ds, di 0 00009B65 3B060300 cmp ax, word ptr [3] 0 00009B69 722C jc _.L53 232 _.LVL19: 233 _.L29: 151:memmgr.c **** { /* if the block is too small, ignore */ 234 .loc 1 151 0 0 00009B6B 8EDF mov ds, di 0 00009B6D A10300 mov ax, word ptr [3] 0 00009B70 394608 cmp word ptr [bp+8], ax 0 00009B73 774E ja _.L28 154:memmgr.c **** { 239 .loc 1 154 0 0 00009B75 83F940 cmp cx, 64 0 00009B78 7503E96701 je _.L54 0 00009B7D 7F1F jg _.L33 0 00009B7F 85C9 test cx, cx 0 00009B81 7503E95E01 je _.L54 0 00009B86 83F901 cmp cx, 1 0 00009B89 7427 je _.L34 0 00009B8B 83F9FF cmp cx, -1 0 00009B8E 7433 je _.L28 249 _.L56: 0 00009B90 8C46FE mov word ptr [bp-2], es 251 _.LVL20: 0 00009B93 89FA mov dx, di 0 00009B95 EB2C jmp _.L28 254 _.LVL21: 255 _.L53: 0 00009B97 8CC6 mov si, es 257 _.LVL22: 0 00009B99 897EFC mov word ptr [bp-4], di 0 00009B9C EBCD jmp _.L29 260 _.LVL23: 261 _.L33: 0 00009B9E 81F98000 cmp cx, 128 0 00009BA2 7503E93D01 je _.L54 0 00009BA7 81F98100 cmp cx, 129 0 00009BAB 7405 je _.L34 0 00009BAD 83F941 cmp cx, 65 0 00009BB0 75DE jne _.L56 268 _.L34: 171:memmgr.c **** /* better match found */ 269 .loc 1 171 0 0 00009BB2 8B5EFE mov bx, word ptr [bp-2] 0 00009BB5 09D3 or bx, dx 0 00009BB7 74D7 je _.L56 0 00009BB9 8EDA mov ds, dx 0 00009BBB 8B5EFE mov bx, word ptr [bp-2] 0 00009BBE 3B4703 cmp ax, word ptr [bx+3] 0 00009BC1 72CD jc _.L56 277 _.LVL24: 278 _.L28: 186:memmgr.c **** break; /* end of chain reached */ 279 .loc 1 186 0 0 00009BC3 8EDF mov ds, di 0 00009BC5 8CC3 mov bx, es 0 00009BC7 803F5A cmp byte ptr [bx], 90 0 00009BCA 740A je _.L36 189:memmgr.c **** } 284 .loc 1 189 0 0 00009BCC 8B1E0300 mov bx, word ptr [3] 0 00009BD0 8D7901 lea di, [1+bx+di] 287 _.LVL25: 140:memmgr.c **** return DE_MCBDESTRY; 288 .loc 1 140 0 0 00009BD3 E934FF jmp _.L37 290 _.LVL26: 291 _.L36: 192:memmgr.c **** *asize = (foundSeg = biggestSeg)->m_size; 292 .loc 1 192 0 0 00009BD6 83F9FF cmp cx, -1 0 00009BD9 7303E9BB00 jc _.L38 0 00009BDE 8B46FC mov ax, word ptr [bp-4] 0 00009BE1 09F0 or ax, si 0 00009BE3 7503E9B100 je _.L38 192:memmgr.c **** *asize = (foundSeg = biggestSeg)->m_size; 298 .loc 1 192 0 is_stmt 0 discriminator 1 0 00009BE8 8E5EFC mov ds, word ptr [bp-4] 0 00009BEB 8B4403 mov ax, word ptr [si+3] 0 00009BEE 394608 cmp word ptr [bp+8], ax 0 00009BF1 7603E9A300 ja _.L38 303 _.LVL27: 193:memmgr.c **** 304 .loc 1 193 0 is_stmt 1 0 00009BF6 8B5E0E mov bx, word ptr [bp+14] 0 00009BF9 368907 mov word ptr ss:[bx], ax 0 00009BFC 8976FE mov word ptr [bp-2], si 0 00009BFF 8CDA mov dx, ds 309 _.LVL28: 310 _.L39: 195:memmgr.c **** { /* no block to fullfill the request */ 311 .loc 1 195 0 discriminator 1 0 00009C01 8EDA mov ds, dx 0 00009C03 8B5EFE mov bx, word ptr [bp-2] 0 00009C06 837F0300 cmp word ptr [bx+3], 0 0 00009C0A 7503E99400 je _.L42 316 _.L43: 210:memmgr.c **** { 317 .loc 1 210 0 0 00009C0F 83F9FF cmp cx, -1 0 00009C12 7465 je _.L47 320 _.LVL29: 321 _.L32: 210:memmgr.c **** { 322 .loc 1 210 0 is_stmt 0 discriminator 1 0 00009C14 8EC2 mov es, dx 0 00009C16 8B5EFE mov bx, word ptr [bp-2] 0 00009C19 268B7703 mov si, word ptr es:[bx+3] 0 00009C1D 397608 cmp word ptr [bp+8], si 0 00009C20 7457 je _.L47 216:memmgr.c **** || (mode == LAST_FIT_U)) 328 .loc 1 216 0 is_stmt 1 0 00009C22 89C8 mov ax, cx 0 00009C24 83E0BF and ax, -65 217:memmgr.c **** { 331 .loc 1 217 0 0 00009C27 83F802 cmp ax, 2 0 00009C2A 268A07 mov al, byte ptr es:[bx] 0 00009C2D 7409 je _.L61 0 00009C2F 81F98200 cmp cx, 130 0 00009C33 7403E9B400 jne _.L48 337 _.L61: 338 _.LVL30: 221:memmgr.c **** the new segment (+1 for MCB itself) */ 339 .loc 1 221 0 0 00009C38 8B4E08 mov cx, word ptr [bp+8] 0 00009C3B F7D1 not cx 0 00009C3D 01CE add si, cx 0 00009C3F 8EC2 mov es, dx 0 00009C41 8B5EFE mov bx, word ptr [bp-2] 0 00009C44 26897703 mov word ptr es:[bx+3], si 346 _.LVL31: 223:memmgr.c **** 347 .loc 1 223 0 0 00009C48 89D3 mov bx, dx 349 _.LVL32: 0 00009C4A 8D7001 lea si, [1+bx+si] 351 _.LVL33: 226:memmgr.c **** p->m_type = MCB_NORMAL; 352 .loc 1 226 0 0 00009C4D 8EC6 mov es, si 0 00009C4F 8B5EFE mov bx, word ptr [bp-2] 0 00009C52 268807 mov byte ptr es:[bx], al 356 _.LVL34: 227:memmgr.c **** } 357 .loc 1 227 0 0 00009C55 8EC2 mov es, dx 0 00009C57 8B5EFE mov bx, word ptr [bp-2] 360 _.LVL35: 0 00009C5A 26C6074D mov byte ptr es:[bx], 77 0 00009C5E 89D1 mov cx, dx 223:memmgr.c **** 363 .loc 1 223 0 0 00009C60 89F2 mov dx, si 365 _.L50: 366 _.LVL36: 242:memmgr.c **** 367 .loc 1 242 0 0 00009C62 8EC1 mov es, cx 0 00009C64 8B5EFE mov bx, word ptr [bp-2] 0 00009C67 26C747010000 mov word ptr es:[bx+1], 0 371 _.LVL37: 244:memmgr.c **** } 372 .loc 1 244 0 0 00009C6D 8EC2 mov es, dx 0 00009C6F 8B4608 mov ax, word ptr [bp+8] 0 00009C72 8B5EFE mov bx, word ptr [bp-2] 376 _.LVL38: 0 00009C75 26894703 mov word ptr es:[bx+3], ax 378 _.L47: 379 _.LVL39: 250:memmgr.c **** foundSeg->m_name[0] = '\0'; 380 .loc 1 250 0 0 00009C79 36A1[0000] mov ax, word ptr ss:[_cu_psp] 0 00009C7D 8EC2 mov es, dx 0 00009C7F 8B5EFE mov bx, word ptr [bp-2] 0 00009C82 26894701 mov word ptr es:[bx+1], ax 385 _.LVL40: 251:memmgr.c **** 386 .loc 1 251 0 0 00009C86 8B5EFE mov bx, word ptr [bp-2] 388 _.LVL41: 0 00009C89 26C6470800 mov byte ptr es:[bx+8], 0 253:memmgr.c **** return SUCCESS; 390 .loc 1 253 0 0 00009C8E 8B5E0C mov bx, word ptr [bp+12] 0 00009C91 368917 mov word ptr ss:[bx], dx 254:memmgr.c **** } 393 .loc 1 254 0 0 00009C94 31C0 xor ax, ax 0 00009C96 E97DFE jmp _.L19 396 _.LVL42: 397 _.L38: 195:memmgr.c **** { /* no block to fullfill the request */ 398 .loc 1 195 0 0 00009C99 8B46FE mov ax, word ptr [bp-2] 0 00009C9C 09D0 or ax, dx 0 00009C9E 7403E95EFF jne _.L39 402 _.LVL43: 403 _.L42: 197:memmgr.c **** (uppermem_link & 1) && uppermem_root != 0xffff) 404 .loc 1 197 0 0 00009CA3 83F9FF cmp cx, -1 0 00009CA6 7520 jne _.L40 407 _.L41: 203:memmgr.c **** *asize = biggestSeg ? biggestSeg->m_size : 0; 408 .loc 1 203 0 0 00009CA8 837E0E00 cmp word ptr [bp+14], 0 0 00009CAC 7414 je _.L57 204:memmgr.c **** return DE_NOMEM; 411 .loc 1 204 0 0 00009CAE 8B46FC mov ax, word ptr [bp-4] 0 00009CB1 09F0 or ax, si 0 00009CB3 7407 je _.L45 0 00009CB5 8E46FC mov es, word ptr [bp-4] 0 00009CB8 268B4403 mov ax, word ptr es:[si+3] 417 _.L45: 204:memmgr.c **** return DE_NOMEM; 418 .loc 1 204 0 is_stmt 0 discriminator 4 0 00009CBC 8B5E0E mov bx, word ptr [bp+14] 0 00009CBF 368907 mov word ptr ss:[bx], ax 421 _.L57: 205:memmgr.c **** } 422 .loc 1 205 0 is_stmt 1 0 00009CC2 B8F8FF mov ax, -8 0 00009CC5 E94EFE jmp _.L19 425 _.L40: 197:memmgr.c **** (uppermem_link & 1) && uppermem_root != 0xffff) 426 .loc 1 197 0 discriminator 1 0 00009CC8 F6C180 test cl, -128 0 00009CCB 74DB je _.L41 197:memmgr.c **** (uppermem_link & 1) && uppermem_root != 0xffff) 429 .loc 1 197 0 is_stmt 0 discriminator 2 0 00009CCD 36F606[0000]01 test byte ptr ss:[_uppermem_link], 1 0 00009CD3 74D3 je _.L41 198:memmgr.c **** { 432 .loc 1 198 0 is_stmt 1 0 00009CD5 36833E[0000]FF cmp word ptr ss:[_uppermem_root], -1 0 00009CDB 74CB je _.L41 200:memmgr.c **** goto searchAgain; 435 .loc 1 200 0 0 00009CDD 81E17FFF and cx, -129 437 _.LVL44: 201:memmgr.c **** } 438 .loc 1 201 0 0 00009CE1 E9E4FD jmp _.L44 440 _.LVL45: 441 _.L54: 154:memmgr.c **** { 442 .loc 1 154 0 0 00009CE4 8C46FE mov word ptr [bp-2], es 444 _.LVL46: 0 00009CE7 89FA mov dx, di 0 00009CE9 E928FF jmp _.L32 447 _.LVL47: 448 _.L48: 231:memmgr.c **** 449 .loc 1 231 0 0 00009CEC 8B5E08 mov bx, word ptr [bp+8] 451 _.LVL48: 0 00009CEF 89D7 mov di, dx 0 00009CF1 8D4901 lea cx, [1+bx+di] 454 _.LVL49: 234:memmgr.c **** p->m_size = foundSeg->m_size - size - 1; 455 .loc 1 234 0 0 00009CF4 8EC1 mov es, cx 0 00009CF6 8B5EFE mov bx, word ptr [bp-2] 0 00009CF9 268807 mov byte ptr es:[bx], al 459 _.LVL50: 235:memmgr.c **** foundSeg->m_type = MCB_NORMAL; 460 .loc 1 235 0 0 00009CFC 8B4608 mov ax, word ptr [bp+8] 0 00009CFF F7D0 not ax 0 00009D01 8EC2 mov es, dx 0 00009D03 8B5EFE mov bx, word ptr [bp-2] 465 _.LVL51: 0 00009D06 26034703 add ax, word ptr es:[bx+3] 0 00009D0A 8EC1 mov es, cx 0 00009D0C 26894703 mov word ptr es:[bx+3], ax 236:memmgr.c **** } 469 .loc 1 236 0 0 00009D10 8EC2 mov es, dx 0 00009D12 8B5EFE mov bx, word ptr [bp-2] 0 00009D15 26C6074D mov byte ptr es:[bx], 77 0 00009D19 E946FF jmp _.L50 474 _.LFE6: 475 .size _DosMemAlloc, .-_DosMemAlloc 476 .global _DosMemLargest 477 .type _DosMemLargest, @function 478 _DosMemLargest: 479 _.LFB7: 256:memmgr.c **** 257:memmgr.c **** /* 258:memmgr.c **** * Unlike the name and the original prototype could suggest, this function 259:memmgr.c **** * is used to return the _size_ of the largest available block rather than 260:memmgr.c **** * the block itself. 261:memmgr.c **** * 262:memmgr.c **** * Known bug: a memory area with a size of the data area of 0 (zero) is 263:memmgr.c **** * not considered a "largest" block. <> 264:memmgr.c **** */ 265:memmgr.c **** COUNT DosMemLargest(UWORD *size) 266:memmgr.c **** { 480 .loc 1 266 0 481 _.LVL52: 0 00009D1C 56 push si 0 00009D1D 57 push di 0 00009D1E 55 push bp 485 _.LCFI6: 0 00009D1F 89E5 mov bp, sp 487 _.LCFI7: 0 00009D21 83EC06 sub sp, 6 0 00009D24 8B7608 mov si, word ptr [bp+8] 267:memmgr.c **** seg dummy; 268:memmgr.c **** *size = 0; 490 .loc 1 268 0 0 00009D27 C7040000 mov word ptr [si], 0 269:memmgr.c **** DosMemAlloc(0xffff, LARGEST, &dummy, size); 492 .loc 1 269 0 0 00009D2B 56 push si 0 00009D2C 8D56FC lea dx, [-4+bp] 0 00009D2F 52 push dx 0 00009D30 8956FA mov word ptr [bp-6], dx 0 00009D33 BFFFFF mov di, -1 0 00009D36 57 push di 0 00009D37 57 push di 0 00009D38 E8[FEFF] call _DosMemAlloc 501 _.LVL53: 270:memmgr.c **** if (mem_access_mode & 0x80) /* then the largest block is probably low! */ 502 .loc 1 270 0 0 00009D3B A0[0000] mov al, byte ptr [_mem_access_mode] 0 00009D3E 84C0 test al, al 0 00009D40 8B56FA mov dx, word ptr [bp-6] 0 00009D43 7D22 jge _.L116 507 _.LBB3: 271:memmgr.c **** { 272:memmgr.c **** UWORD lowsize = 0; 508 .loc 1 272 0 0 00009D45 C746FE0000 mov word ptr [bp-2], 0 273:memmgr.c **** mem_access_mode &= ~0x80; 510 .loc 1 273 0 0 00009D4A 247F and al, 127 0 00009D4C A2[0000] mov byte ptr [_mem_access_mode], al 274:memmgr.c **** DosMemAlloc(0xffff, LARGEST, &dummy, &lowsize); 513 .loc 1 274 0 0 00009D4F 8D46FE lea ax, [-2+bp] 0 00009D52 50 push ax 0 00009D53 52 push dx 0 00009D54 57 push di 0 00009D55 57 push di 0 00009D56 E8[FEFF] call _DosMemAlloc 520 _.LVL54: 275:memmgr.c **** mem_access_mode |= 0x80; 521 .loc 1 275 0 0 00009D59 800E[0000]80 or byte ptr [_mem_access_mode], -128 276:memmgr.c **** if (lowsize > *size) 523 .loc 1 276 0 0 00009D5E 8B46FE mov ax, word ptr [bp-2] 0 00009D61 3904 cmp word ptr [si], ax 0 00009D63 7302 jnc _.L116 277:memmgr.c **** *size = lowsize; 527 .loc 1 277 0 0 00009D65 8904 mov word ptr [si], ax 529 _.L116: 530 _.LBE3: 278:memmgr.c **** } 279:memmgr.c **** return *size ? SUCCESS : DE_NOMEM; 531 .loc 1 279 0 0 00009D67 31C0 xor ax, ax 0 00009D69 3904 cmp word ptr [si], ax 0 00009D6B 7503 jne _.L115 0 00009D6D B8F8FF mov ax, -8 536 _.L115: 280:memmgr.c **** } 537 .loc 1 280 0 0 00009D70 89EC mov sp, bp 0 00009D72 5D pop bp 0 00009D73 5F pop di 0 00009D74 5E pop si 0 00009D75 C20200 ret 2 543 _.LFE7: 544 .size _DosMemLargest, .-_DosMemLargest 545 .global _DosMemFree 546 .type _DosMemFree, @function 547 _DosMemFree: 548 _.LFB8: 281:memmgr.c **** 282:memmgr.c **** /* 283:memmgr.c **** * Deallocate a memory block. para is the segment of the MCB itself 284:memmgr.c **** * This function can be called with para == 0, which eases other parts 285:memmgr.c **** * of the kernel. 286:memmgr.c **** */ 287:memmgr.c **** COUNT DosMemFree(UWORD para) 288:memmgr.c **** { 549 .loc 1 288 0 550 _.LVL55: 0 00009D78 55 push bp 552 _.LCFI8: 0 00009D79 89E5 mov bp, sp 554 _.LCFI9: 0 00009D7B 8B4604 mov ax, word ptr [bp+4] 289:memmgr.c **** REG mcb FAR *p; 290:memmgr.c **** 291:memmgr.c **** if (!para) /* let esp. the kernel call this fct with para==0 */ 556 .loc 1 291 0 0 00009D7E 85C0 test ax, ax 0 00009D80 742C je _.L125 292:memmgr.c **** return DE_INVLDMCB; 293:memmgr.c **** 294:memmgr.c **** /* Initialize */ 295:memmgr.c **** p = para2far(para); 559 .loc 1 295 0 0 00009D82 31DB xor bx, bx 561 _.LVL56: 296:memmgr.c **** 297:memmgr.c **** /* check for corruption */ 298:memmgr.c **** if (!mcbFreeable(p)) /* does not have to be valid, freeable is enough */ 562 .loc 1 298 0 0 00009D84 8EC0 mov es, ax 0 00009D86 268A17 mov dl, byte ptr es:[bx] 0 00009D89 80FA4D cmp dl, 77 0 00009D8C 7405 je _.L126 0 00009D8E 80FA5A cmp dl, 90 0 00009D91 751B jne _.L125 569 _.L126: 299:memmgr.c **** return DE_INVLDMCB; 300:memmgr.c **** 301:memmgr.c **** /* Mark the mcb as free so that we can later */ 302:memmgr.c **** /* merge with other surrounding free MCBs */ 303:memmgr.c **** p->m_psp = FREE_PSP; 570 .loc 1 303 0 0 00009D93 8EC0 mov es, ax 0 00009D95 26C70601000000 mov word ptr es:[1], 0 573 _.LVL57: 304:memmgr.c **** fmemset(p->m_name, '\0', 8); 574 .loc 1 304 0 0 00009D9C BA0800 mov dx, 8 0 00009D9F 52 push dx 0 00009DA0 53 push bx 0 00009DA1 50 push ax 0 00009DA2 52 push dx 0 00009DA3 E8[FEFF] call _fmemset 581 _.LVL58: 305:memmgr.c **** 306:memmgr.c **** return SUCCESS; 582 .loc 1 306 0 0 00009DA6 31C0 xor ax, ax 584 _.L121: 307:memmgr.c **** } 585 .loc 1 307 0 0 00009DA8 89EC mov sp, bp 0 00009DAA 5D pop bp 0 00009DAB C20200 ret 2 589 _.LVL59: 590 _.L125: 292:memmgr.c **** 591 .loc 1 292 0 0 00009DAE B8F7FF mov ax, -9 593 _.LVL60: 0 00009DB1 EBF5 jmp _.L121 595 _.LFE8: 596 .size _DosMemFree, .-_DosMemFree 597 .global _DosMemChange 598 .type _DosMemChange, @function 599 _DosMemChange: 600 _.LFB9: 308:memmgr.c **** 309:memmgr.c **** /* 310:memmgr.c **** * Resize an allocated memory block. 311:memmgr.c **** * para is the segment of the data portion of the block rather than 312:memmgr.c **** * the segment of the MCB itself. 313:memmgr.c **** * 314:memmgr.c **** * If the block shall grow, it is resized to the maximal size less than 315:memmgr.c **** * or equal to size. This is the way MS DOS is reported to work. 316:memmgr.c **** */ 317:memmgr.c **** COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize) 318:memmgr.c **** { 601 .loc 1 318 0 602 _.LVL61: 0 00009DB3 56 push si 0 00009DB4 57 push di 0 00009DB5 55 push bp 606 _.LCFI10: 0 00009DB6 89E5 mov bp, sp 608 _.LCFI11: 0 00009DB8 83EC06 sub sp, 6 0 00009DBB 8B7E0A mov di, word ptr [bp+10] 0 00009DBE 8B760C mov si, word ptr [bp+12] 319:memmgr.c **** REG mcb FAR *p; mcb FAR * q; 320:memmgr.c **** 321:memmgr.c **** /* Initialize */ 322:memmgr.c **** p = para2far(para - 1); /* pointer to MCB */ 612 .loc 1 322 0 0 00009DC1 8B4608 mov ax, word ptr [bp+8] 0 00009DC4 48 dec ax 0 00009DC5 8946FE mov word ptr [bp-2], ax 0 00009DC8 31C0 xor ax, ax 0 00009DCA 8ED8 mov ds, ax 618 _.LVL62: 323:memmgr.c **** 324:memmgr.c **** /* check for corruption */ 325:memmgr.c **** if (!mcbValid(p)) 619 .loc 1 325 0 0 00009DCC 8E46FE mov es, word ptr [bp-2] 0 00009DCF 26A10300 mov ax, word ptr es:[3] 622 _.LVL63: 0 00009DD3 83F8FF cmp ax, -1 0 00009DD6 750D jne _.L132 625 _.LVL64: 626 _.L134: 326:memmgr.c **** return DE_MCBDESTRY; 627 .loc 1 326 0 0 00009DD8 B8F9FF mov ax, -7 629 _.L131: 327:memmgr.c **** 328:memmgr.c **** /* check if to grow the block */ 329:memmgr.c **** if (size > p->m_size) 330:memmgr.c **** { 331:memmgr.c **** /* first try to make the MCB larger by joining with any following 332:memmgr.c **** unused blocks */ 333:memmgr.c **** if (joinMCBs(FP_SEG(p)) != SUCCESS) 334:memmgr.c **** return DE_MCBDESTRY; 335:memmgr.c **** 336:memmgr.c **** if (size > p->m_size) 337:memmgr.c **** { /* block is still too small */ 338:memmgr.c **** if (maxSize) 339:memmgr.c **** *maxSize = p->m_size; 340:memmgr.c **** return DE_NOMEM; 341:memmgr.c **** } 342:memmgr.c **** } 343:memmgr.c **** 344:memmgr.c **** /* shrink it down */ 345:memmgr.c **** if (size < p->m_size) 346:memmgr.c **** { 347:memmgr.c **** /* make q a pointer to the new next block */ 348:memmgr.c **** q = nxtMCBsize(p, size); 349:memmgr.c **** /* reduce the size of p and add difference to q */ 350:memmgr.c **** q->m_size = p->m_size - size - 1; 351:memmgr.c **** q->m_type = p->m_type; 352:memmgr.c **** 353:memmgr.c **** p->m_size = size; 354:memmgr.c **** 355:memmgr.c **** /* Make certian the old psp is not last (if it was) */ 356:memmgr.c **** p->m_type = MCB_NORMAL; 357:memmgr.c **** 358:memmgr.c **** /* Mark the mcb as free so that we can later */ 359:memmgr.c **** /* merge with other surrounding free MCBs */ 360:memmgr.c **** q->m_psp = FREE_PSP; 361:memmgr.c **** fmemset(q->m_name, '\0', 8); 362:memmgr.c **** 363:memmgr.c **** /* try to join q with the free MCBs following it if possible */ 364:memmgr.c **** if (joinMCBs(FP_SEG(q)) != SUCCESS) 365:memmgr.c **** return DE_MCBDESTRY; 366:memmgr.c **** } 367:memmgr.c **** 368:memmgr.c **** /* MS network client NET.EXE: DosMemChange sets the PSP * 369:memmgr.c **** * not tested, if always, or only on success TE* 370:memmgr.c **** * only on success seems more logical to me - Bart 371:memmgr.c **** p->m_psp = cu_psp; 372:memmgr.c **** 373:memmgr.c **** return SUCCESS; 374:memmgr.c **** } 630 .loc 1 374 0 0 00009DDB 89EC mov sp, bp 0 00009DDD 5D pop bp 0 00009DDE 5F pop di 0 00009DDF 5E pop si 0 00009DE0 16 push ss 0 00009DE1 1F pop ds 0 00009DE2 C20600 ret 6 638 _.LVL65: 639 _.L132: 0 00009DE5 8CD9 mov cx, ds 325:memmgr.c **** return DE_MCBDESTRY; 641 .loc 1 325 0 discriminator 1 0 00009DE7 8E46FE mov es, word ptr [bp-2] 643 _.LVL66: 0 00009DEA 8CDB mov bx, ds 0 00009DEC 268A17 mov dl, byte ptr es:[bx] 0 00009DEF 80FA4D cmp dl, 77 0 00009DF2 7405 je _.L140 648 _.LVL67: 0 00009DF4 80FA5A cmp dl, 90 0 00009DF7 75DF jne _.L134 651 _.L140: 329:memmgr.c **** { 652 .loc 1 329 0 0 00009DF9 39F8 cmp ax, di 0 00009DFB 732C jnc _.L136 0 00009DFD 894EFA mov word ptr [bp-6], cx 0 00009E00 8C5EFC mov word ptr [bp-4], ds 333:memmgr.c **** return DE_MCBDESTRY; 657 .loc 1 333 0 0 00009E03 FF76FE push word ptr [bp-2] 0 00009E06 16 push ss 0 00009E07 1F pop ds 0 00009E08 E81CFC call _joinMCBs 662 _.LVL68: 0 00009E0B 85C0 test ax, ax 0 00009E0D 75C9 jne _.L134 336:memmgr.c **** { /* block is still too small */ 665 .loc 1 336 0 0 00009E0F 8E46FE mov es, word ptr [bp-2] 0 00009E12 26A10300 mov ax, word ptr es:[3] 0 00009E16 39C7 cmp di, ax 0 00009E18 C54EFA lds cx, dword ptr [bp-6] 0 00009E1B 760C jbe _.L136 338:memmgr.c **** *maxSize = p->m_size; 671 .loc 1 338 0 0 00009E1D 85F6 test si, si 0 00009E1F 7403 je _.L139 339:memmgr.c **** return DE_NOMEM; 674 .loc 1 339 0 0 00009E21 368904 mov word ptr ss:[si], ax 676 _.L139: 340:memmgr.c **** } 677 .loc 1 340 0 0 00009E24 B8F8FF mov ax, -8 0 00009E27 EBB2 jmp _.L131 680 _.LVL69: 681 _.L136: 345:memmgr.c **** { 682 .loc 1 345 0 0 00009E29 8E46FE mov es, word ptr [bp-2] 0 00009E2C 268B160300 mov dx, word ptr es:[3] 0 00009E31 39D7 cmp di, dx 0 00009E33 720F jc _.L137 687 _.LVL70: 688 _.L138: 371:memmgr.c **** 689 .loc 1 371 0 0 00009E35 36A1[0000] mov ax, word ptr ss:[_cu_psp] 0 00009E39 8E46FE mov es, word ptr [bp-2] 0 00009E3C 26A30100 mov word ptr es:[1], ax 373:memmgr.c **** } 693 .loc 1 373 0 0 00009E40 31C0 xor ax, ax 0 00009E42 EB97 jmp _.L131 696 _.LVL71: 697 _.L137: 348:memmgr.c **** /* reduce the size of p and add difference to q */ 698 .loc 1 348 0 0 00009E44 8B5EFE mov bx, word ptr [bp-2] 0 00009E47 8D7101 lea si, [1+bx+di] 701 _.LVL72: 350:memmgr.c **** q->m_type = p->m_type; 702 .loc 1 350 0 0 00009E4A 89F8 mov ax, di 0 00009E4C F7D0 not ax 0 00009E4E 01D0 add ax, dx 0 00009E50 8EC6 mov es, si 0 00009E52 26A30300 mov word ptr es:[3], ax 708 _.LVL73: 351:memmgr.c **** 709 .loc 1 351 0 0 00009E56 8E46FE mov es, word ptr [bp-2] 0 00009E59 8CDB mov bx, ds 0 00009E5B 268A07 mov al, byte ptr es:[bx] 0 00009E5E 8EC6 mov es, si 0 00009E60 268807 mov byte ptr es:[bx], al 353:memmgr.c **** 715 .loc 1 353 0 0 00009E63 8E46FE mov es, word ptr [bp-2] 0 00009E66 26893E0300 mov word ptr es:[3], di 356:memmgr.c **** 718 .loc 1 356 0 0 00009E6B 8E46FE mov es, word ptr [bp-2] 0 00009E6E 26C60600004D mov byte ptr es:[0], 77 360:memmgr.c **** fmemset(q->m_name, '\0', 8); 721 .loc 1 360 0 0 00009E74 8EC6 mov es, si 0 00009E76 26890E0100 mov word ptr es:[1], cx 361:memmgr.c **** 724 .loc 1 361 0 0 00009E7B B80800 mov ax, 8 0 00009E7E 50 push ax 0 00009E7F 51 push cx 0 00009E80 56 push si 0 00009E81 50 push ax 0 00009E82 16 push ss 0 00009E83 1F pop ds 732 _.LVL74: 0 00009E84 E8[FEFF] call _fmemset 734 _.LVL75: 364:memmgr.c **** return DE_MCBDESTRY; 735 .loc 1 364 0 0 00009E87 56 push si 0 00009E88 E89CFB call _joinMCBs 738 _.LVL76: 0 00009E8B 85C0 test ax, ax 0 00009E8D 74A6 je _.L138 0 00009E8F E946FF jmp _.L134 742 _.LFE9: 743 .size _DosMemChange, .-_DosMemChange === Switch to base=012BB0h -> ".RODATA.STR1.1" 744 .section .rodata.str1.1,"aMS",@progbits,1 745 _.LC0: 0 00001A21 646F73206D656D20 .string "dos mem corrupt, first_mcb=" 0 00001A29 636F72727570742C 0 00001A31 2066697273745F6D 0 00001A39 63623D00 747 _.LC1: 0 00001A3D 0A707265762000 .string "\nprev " 749 _.LC2: 0 00001A44 6E6F744D5A00 .string "notMZ" === Switch to base=002270h -> ".TEXT" 751 .text 752 .global _DosMemCheck 753 .type _DosMemCheck, @function 754 _DosMemCheck: 755 _.LFB10: 375:memmgr.c **** 376:memmgr.c **** /* 377:memmgr.c **** * Check the MCB chain for allocation corruption 378:memmgr.c **** */ 379:memmgr.c **** COUNT DosMemCheck(void) 380:memmgr.c **** { 756 .loc 1 380 0 0 00009E92 56 push si 0 00009E93 57 push di 0 00009E94 55 push bp 760 _.LCFI12: 0 00009E95 89E5 mov bp, sp 762 _.LCFI13: 0 00009E97 83EC06 sub sp, 6 764 _.LVL77: 381:memmgr.c **** REG mcb FAR *p; 382:memmgr.c **** REG mcb FAR *pprev = 0; 383:memmgr.c **** 384:memmgr.c **** /* Initialize */ 385:memmgr.c **** p = para2far(first_mcb); 765 .loc 1 385 0 0 00009E9A 8B3E[0000] mov di, word ptr [_first_mcb] 0 00009E9E 31F6 xor si, si 768 _.LVL78: 382:memmgr.c **** 769 .loc 1 382 0 0 00009EA0 89F0 mov ax, si 0 00009EA2 89F1 mov cx, si 772 _.LVL79: 773 _.L146: 386:memmgr.c **** 387:memmgr.c **** /* Search through memory blocks */ 388:memmgr.c **** while (p->m_type != MCB_LAST) /* not all MCBs touched */ 774 .loc 1 388 0 0 00009EA4 8EC7 mov es, di 0 00009EA6 268A14 mov dl, byte ptr es:[si] 0 00009EA9 80FA5A cmp dl, 90 0 00009EAC 7504 jne _.L149 389:memmgr.c **** { 390:memmgr.c **** /* check for corruption */ 391:memmgr.c **** if (p->m_type != MCB_NORMAL) 392:memmgr.c **** { 393:memmgr.c **** put_string("dos mem corrupt, first_mcb="); 394:memmgr.c **** put_unsigned(first_mcb, 16, 4); 395:memmgr.c **** hexd("\nprev ", pprev, 16); 396:memmgr.c **** hexd("notMZ", p, 16); 397:memmgr.c **** return DE_MCBDESTRY; 398:memmgr.c **** } 399:memmgr.c **** 400:memmgr.c **** /* not corrupted - but not end, bump the pointer */ 401:memmgr.c **** pprev = p; 402:memmgr.c **** p = nxtMCB(p); 403:memmgr.c **** } 404:memmgr.c **** return SUCCESS; 779 .loc 1 404 0 0 00009EAE 31C0 xor ax, ax 0 00009EB0 EB44 jmp _.L145 782 _.L149: 391:memmgr.c **** { 783 .loc 1 391 0 0 00009EB2 80FA4D cmp dl, 77 0 00009EB5 7445 je _.L147 0 00009EB7 894EFE mov word ptr [bp-2], cx 0 00009EBA 8946FC mov word ptr [bp-4], ax 0 00009EBD 8976FA mov word ptr [bp-6], si 393:memmgr.c **** put_unsigned(first_mcb, 16, 4); 789 .loc 1 393 0 0 00009EC0 BA[0000] mov dx, offset _.LC0 0 00009EC3 52 push dx 0 00009EC4 E8[FEFF] call _put_string 793 _.LVL80: 394:memmgr.c **** hexd("\nprev ", pprev, 16); 794 .loc 1 394 0 0 00009EC7 BA0400 mov dx, 4 0 00009ECA 52 push dx 0 00009ECB BE1000 mov si, 16 0 00009ECE 56 push si 0 00009ECF FF36[0000] push word ptr [_first_mcb] 0 00009ED3 E8[FEFF] call _put_unsigned 801 _.LVL81: 395:memmgr.c **** hexd("notMZ", p, 16); 802 .loc 1 395 0 0 00009ED6 56 push si 0 00009ED7 8B4EFE mov cx, word ptr [bp-2] 0 00009EDA 51 push cx 0 00009EDB 8B46FC mov ax, word ptr [bp-4] 0 00009EDE 50 push ax 0 00009EDF BA[1C00] mov dx, offset _.LC1 0 00009EE2 52 push dx 0 00009EE3 E8[FEFF] call _hexd 811 _.LVL82: 396:memmgr.c **** return DE_MCBDESTRY; 812 .loc 1 396 0 0 00009EE6 56 push si 0 00009EE7 57 push di 0 00009EE8 8B76FA mov si, word ptr [bp-6] 0 00009EEB 56 push si 0 00009EEC B8[2300] mov ax, offset _.LC2 0 00009EEF 50 push ax 0 00009EF0 E8[FEFF] call _hexd 820 _.LVL83: 397:memmgr.c **** } 821 .loc 1 397 0 0 00009EF3 B8F9FF mov ax, -7 823 _.LVL84: 824 _.L145: 405:memmgr.c **** } 825 .loc 1 405 0 0 00009EF6 89EC mov sp, bp 0 00009EF8 5D pop bp 0 00009EF9 5F pop di 829 _.LVL85: 0 00009EFA 5E pop si 0 00009EFB C3 ret 832 _.LVL86: 833 _.L147: 402:memmgr.c **** } 834 .loc 1 402 0 0 00009EFC 89F0 mov ax, si 0 00009EFE 89F9 mov cx, di 0 00009F00 8EC7 mov es, di 0 00009F02 268B1E0300 mov bx, word ptr es:[3] 0 00009F07 8D7901 lea di, [1+bx+di] 840 _.LVL87: 0 00009F0A EB98 jmp _.L146 842 _.LFE10: 843 .size _DosMemCheck, .-_DosMemCheck 844 .global _DosUmbLink 845 .type _DosUmbLink, @function 846 _DosUmbLink: 847 _.LFB12: 406:memmgr.c **** 407:memmgr.c **** COUNT FreeProcessMem(UWORD ps) 408:memmgr.c **** { 409:memmgr.c **** mcb FAR *p; 410:memmgr.c **** BYTE oldumbstate = uppermem_link & 1; 411:memmgr.c **** 412:memmgr.c **** /* link in upper memory to free those , too */ 413:memmgr.c **** DosUmbLink(1); 414:memmgr.c **** 415:memmgr.c **** /* Search through all memory blocks */ 416:memmgr.c **** for (p = para2far(first_mcb);; p = nxtMCB(p)) 417:memmgr.c **** { 418:memmgr.c **** 419:memmgr.c **** if (!mcbValid(p)) /* check for corruption */ 420:memmgr.c **** return DE_MCBDESTRY; 421:memmgr.c **** 422:memmgr.c **** if (p->m_psp == ps) 423:memmgr.c **** DosMemFree(FP_SEG(p)); 424:memmgr.c **** 425:memmgr.c **** if (p->m_type == MCB_LAST) 426:memmgr.c **** break; 427:memmgr.c **** } 428:memmgr.c **** 429:memmgr.c **** DosUmbLink(oldumbstate); 430:memmgr.c **** 431:memmgr.c **** return SUCCESS; 432:memmgr.c **** } 433:memmgr.c **** 434:memmgr.c **** #ifdef DEBUG 435:memmgr.c **** VOID show_chain(void) 436:memmgr.c **** { 437:memmgr.c **** mcb FAR *p; 438:memmgr.c **** p = para2far(first_mcb); 439:memmgr.c **** 440:memmgr.c **** for (;;) 441:memmgr.c **** { 442:memmgr.c **** mcb_print(p); 443:memmgr.c **** if (p->m_type == MCB_LAST || p->m_type != MCB_NORMAL) 444:memmgr.c **** return; 445:memmgr.c **** else 446:memmgr.c **** p = nxtMCB(p); 447:memmgr.c **** } 448:memmgr.c **** } 449:memmgr.c **** 450:memmgr.c **** VOID mcb_print(mcb FAR * mcbp) 451:memmgr.c **** { 452:memmgr.c **** static BYTE buff[9]; 453:memmgr.c **** 454:memmgr.c **** fmemcpy(buff, mcbp->m_name, 8); 455:memmgr.c **** buff[8] = '\0'; 456:memmgr.c **** printf 457:memmgr.c **** ("%04x:%04x -> |%s| m_type = 0x%02x '%c'; m_psp = 0x%04x; m_size = 0x%04x\n", 458:memmgr.c **** FP_SEG(mcbp), FP_OFF(mcbp), *buff == '\0' ? "*NO-ID*" : buff, 459:memmgr.c **** mcbp->m_type, mcbp->m_type > ' ' ? mcbp->m_type : ' ', mcbp->m_psp, 460:memmgr.c **** mcbp->m_size); 461:memmgr.c **** } 462:memmgr.c **** #endif 463:memmgr.c **** 464:memmgr.c **** void DosUmbLink(unsigned n) 465:memmgr.c **** { 848 .loc 1 465 0 849 _.LVL88: 0 00009F0C 56 push si 0 00009F0D 57 push di 0 00009F0E 55 push bp 853 _.LCFI14: 0 00009F0F 89E5 mov bp, sp 855 _.LCFI15: 0 00009F11 8B4608 mov ax, word ptr [bp+8] 466:memmgr.c **** REG mcb FAR *p; 467:memmgr.c **** REG mcb FAR *q; 468:memmgr.c **** 469:memmgr.c **** if (uppermem_root == 0xffff) 857 .loc 1 469 0 0 00009F14 8B0E[0000] mov cx, word ptr [_uppermem_root] 0 00009F18 83F9FF cmp cx, -1 0 00009F1B 7466 je _.L151 861 _.LVL89: 470:memmgr.c **** return; 471:memmgr.c **** 472:memmgr.c **** p = para2far(first_mcb); 473:memmgr.c **** if (n > 1 || (uppermem_link & 1) == n) 862 .loc 1 473 0 0 00009F1D 83F801 cmp ax, 1 0 00009F20 7761 ja _.L151 865 .loc 1 473 0 is_stmt 0 discriminator 1 0 00009F22 8A16[0000] mov dl, byte ptr [_uppermem_link] 0 00009F26 80E201 and dl, 1 0 00009F29 30F6 xor dh, dh 0 00009F2B 39D0 cmp ax, dx 0 00009F2D 7454 je _.L151 472:memmgr.c **** if (n > 1 || (uppermem_link & 1) == n) 871 .loc 1 472 0 is_stmt 1 0 00009F2F 8B36[0000] mov si, word ptr [_first_mcb] 0 00009F33 31FF xor di, di 874 _.LVL90: 875 _.L153: 474:memmgr.c **** return; 475:memmgr.c **** while (FP_SEG(p) != uppermem_root && p->m_type != MCB_LAST) 876 .loc 1 475 0 0 00009F35 39F1 cmp cx, si 0 00009F37 7436 je _.L154 879 .loc 1 475 0 is_stmt 0 discriminator 1 0 00009F39 8EC6 mov es, si 881 _.LVL91: 0 00009F3B 268A15 mov dl, byte ptr es:[di] 0 00009F3E 80FA5A cmp dl, 90 0 00009F41 7514 jne _.L155 476:memmgr.c **** { 477:memmgr.c **** if (!mcbValid(p)) 478:memmgr.c **** return; 479:memmgr.c **** q = p; 480:memmgr.c **** p = nxtMCB(p); 481:memmgr.c **** } 482:memmgr.c **** if (n == 0) 885 .loc 1 482 0 is_stmt 1 0 00009F43 85C0 test ax, ax 0 00009F45 7438 je _.L158 888 _.L157: 483:memmgr.c **** { 484:memmgr.c **** if (q->m_type == MCB_NORMAL && FP_SEG(p) == uppermem_root) 485:memmgr.c **** q->m_type = MCB_LAST; 486:memmgr.c **** } 487:memmgr.c **** else if (p->m_type == MCB_LAST) 889 .loc 1 487 0 0 00009F47 8EC6 mov es, si 0 00009F49 26803D5A cmp byte ptr es:[di], 90 0 00009F4D 7534 jne _.L151 488:memmgr.c **** p->m_type = MCB_NORMAL; 893 .loc 1 488 0 0 00009F4F 26C60600004D mov byte ptr es:[0], 77 895 _.LVL92: 0 00009F55 EB28 jmp _.L158 897 _.LVL93: 898 _.L155: 477:memmgr.c **** return; 899 .loc 1 477 0 0 00009F57 8EC6 mov es, si 0 00009F59 268B1E0300 mov bx, word ptr es:[3] 0 00009F5E 80FA4D cmp dl, 77 0 00009F61 7520 jne _.L151 0 00009F63 83FBFF cmp bx, -1 0 00009F66 731B jnc _.L151 906 _.LVL94: 480:memmgr.c **** } 907 .loc 1 480 0 0 00009F68 8EDF mov ds, di 0 00009F6A 8D7001 lea si, [1+bx+si] 910 _.LVL95: 0 00009F6D EBC6 jmp _.L153 912 _.LVL96: 913 _.L154: 482:memmgr.c **** { 914 .loc 1 482 0 0 00009F6F 85C0 test ax, ax 0 00009F71 75D4 jne _.L157 484:memmgr.c **** q->m_type = MCB_LAST; 917 .loc 1 484 0 0 00009F73 8CDB mov bx, ds 0 00009F75 26803F4D cmp byte ptr es:[bx], 77 0 00009F79 7504 jne _.L158 921 _.LVL97: 485:memmgr.c **** } 922 .loc 1 485 0 0 00009F7B 26C6075A mov byte ptr es:[bx], 90 924 _.LVL98: 925 _.L158: 489:memmgr.c **** else 490:memmgr.c **** return; 491:memmgr.c **** uppermem_link = n; 926 .loc 1 491 0 0 00009F7F 36A2[0000] mov byte ptr ss:[_uppermem_link], al 928 _.LVL99: 929 _.L151: 492:memmgr.c **** } 930 .loc 1 492 0 0 00009F83 5D pop bp 0 00009F84 5F pop di 0 00009F85 5E pop si 0 00009F86 16 push ss 0 00009F87 1F pop ds 0 00009F88 C20200 ret 2 937 _.LFE12: 938 .size _DosUmbLink, .-_DosUmbLink 939 .global _FreeProcessMem 940 .type _FreeProcessMem, @function 941 _FreeProcessMem: 942 _.LFB11: 408:memmgr.c **** mcb FAR *p; 943 .loc 1 408 0 944 _.LVL100: 0 00009F8B 56 push si 0 00009F8C 57 push di 0 00009F8D 55 push bp 948 _.LCFI16: 0 00009F8E 89E5 mov bp, sp 950 _.LCFI17: 0 00009F90 1E push ds 410:memmgr.c **** 952 .loc 1 410 0 0 00009F91 A0[0000] mov al, byte ptr [_uppermem_link] 0 00009F94 8846FF mov byte ptr [bp-1], al 955 _.LVL101: 413:memmgr.c **** 956 .loc 1 413 0 0 00009F97 B80100 mov ax, 1 958 _.LVL102: 0 00009F9A 50 push ax 0 00009F9B E8[FEFF] call _DosUmbLink 961 _.LVL103: 416:memmgr.c **** { 962 .loc 1 416 0 0 00009F9E 8B36[0000] mov si, word ptr [_first_mcb] 0 00009FA2 31FF xor di, di 965 _.LVL104: 966 _.L172: 419:memmgr.c **** return DE_MCBDESTRY; 967 .loc 1 419 0 0 00009FA4 8EC6 mov es, si 0 00009FA6 26833E0300FF cmp word ptr es:[3], -1 0 00009FAC 7440 je _.L174 419:memmgr.c **** return DE_MCBDESTRY; 971 .loc 1 419 0 is_stmt 0 discriminator 1 0 00009FAE 268A05 mov al, byte ptr es:[di] 0 00009FB1 3C4D cmp al, 77 0 00009FB3 7404 je _.L175 0 00009FB5 3C5A cmp al, 90 0 00009FB7 7535 jne _.L174 977 _.L175: 422:memmgr.c **** DosMemFree(FP_SEG(p)); 978 .loc 1 422 0 is_stmt 1 0 00009FB9 8EC6 mov es, si 0 00009FBB 26A10100 mov ax, word ptr es:[1] 0 00009FBF 3B4608 cmp ax, word ptr [bp+8] 0 00009FC2 7504 jne _.L170 423:memmgr.c **** 983 .loc 1 423 0 0 00009FC4 56 push si 0 00009FC5 E8[FEFF] call _DosMemFree 986 _.LVL105: 987 _.L170: 425:memmgr.c **** break; 988 .loc 1 425 0 0 00009FC8 8EC6 mov es, si 0 00009FCA 26803D5A cmp byte ptr es:[di], 90 0 00009FCE 740A je _.L171 416:memmgr.c **** { 992 .loc 1 416 0 0 00009FD0 268B1E0300 mov bx, word ptr es:[3] 0 00009FD5 8D7001 lea si, [1+bx+si] 995 _.LVL106: 419:memmgr.c **** return DE_MCBDESTRY; 996 .loc 1 419 0 0 00009FD8 EBCA jmp _.L172 998 _.L171: 410:memmgr.c **** 999 .loc 1 410 0 0 00009FDA 8A46FF mov al, byte ptr [bp-1] 0 00009FDD 2401 and al, 1 429:memmgr.c **** 1002 .loc 1 429 0 0 00009FDF 98 cbw 0 00009FE0 50 push ax 0 00009FE1 E8[FEFF] call _DosUmbLink 1006 _.LVL107: 431:memmgr.c **** } 1007 .loc 1 431 0 0 00009FE4 31C0 xor ax, ax 1009 _.L167: 432:memmgr.c **** 1010 .loc 1 432 0 0 00009FE6 89EC mov sp, bp 0 00009FE8 5D pop bp 0 00009FE9 5F pop di 1014 _.LVL108: 0 00009FEA 5E pop si 1016 _.LVL109: 0 00009FEB C20200 ret 2 1018 _.LVL110: 1019 _.L174: 420:memmgr.c **** 1020 .loc 1 420 0 0 00009FEE B8F9FF mov ax, -7 0 00009FF1 EBF3 jmp _.L167 1023 _.LFE11: 1024 .size _FreeProcessMem, .-_FreeProcessMem === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: misc.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=misc.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccbldYh4.s output file : misc.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 _.Letext0: 8 .file 1 "../hdr/portab.h" 9 .file 2 "../hdr/device.h" 10 .file 3 "../hdr/mcb.h" 11 .file 4 "../hdr/pcb.h" 12 .file 5 "../hdr/ddate.h" 13 .file 6 "../hdr/dtime.h" 14 .file 7 "../hdr/fat.h" 15 .file 8 "../hdr/fcb.h" 16 .file 9 "../hdr/sft.h" 17 .file 10 "../hdr/dcb.h" 18 .file 11 "../hdr/cds.h" 19 .file 12 "../hdr/dirmatch.h" 20 .file 13 "../hdr/fnode.h" 21 .file 14 "../hdr/clock.h" 22 .file 15 "../hdr/kbd.h" 23 .file 16 "../hdr/buffer.h" 24 .file 17 "globals.h" === Switch to base unknown -> ".DEBUG_INFO" === Trace listing source: network.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=network.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccaBC38m.s output file : network.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _get_machine_name 8 .type _get_machine_name, @function 9 _get_machine_name: 10 _.LFB4: 11 .file 1 "network.c" 1:network.c **** /****************************************************************/ 2:network.c **** /* */ 3:network.c **** /* network.c */ 4:network.c **** /* DOS-C */ 5:network.c **** /* */ 6:network.c **** /* Networking Support functions */ 7:network.c **** /* */ 8:network.c **** /* Copyright (c) 1995, 1999 */ 9:network.c **** /* James Tabor */ 10:network.c **** /* All Rights Reserved */ 11:network.c **** /* */ 12:network.c **** /* This file is part of DOS-C. */ 13:network.c **** /* */ 14:network.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:network.c **** /* modify it under the terms of the GNU General Public License */ 16:network.c **** /* as published by the Free Software Foundation; either version */ 17:network.c **** /* 2, or (at your option) any later version. */ 18:network.c **** /* */ 19:network.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:network.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:network.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:network.c **** /* the GNU General Public License for more details. */ 23:network.c **** /* */ 24:network.c **** /* You should have received a copy of the GNU General Public */ 25:network.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:network.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:network.c **** /* Cambridge, MA 02139, USA. */ 28:network.c **** /****************************************************************/ 29:network.c **** 30:network.c **** #include "portab.h" 31:network.c **** #include "globals.h" 32:network.c **** 33:network.c **** #ifdef VERSION_STRINGS 34:network.c **** static BYTE *RcsId = 35:network.c **** "$Id: network.c 895 2004-04-21 17:40:12Z bartoldeman $"; 36:network.c **** #endif 37:network.c **** 38:network.c **** /* see RBIL D-2152 and D-215D06 before attempting 39:network.c **** to change these two functions! 40:network.c **** */ 41:network.c **** UWORD get_machine_name(BYTE FAR * netname) 42:network.c **** { 12 .loc 1 42 0 13 _.LVL0: 0 0000BD24 55 push bp 15 _.LCFI0: 0 0000BD25 89E5 mov bp, sp 17 _.LCFI1: 43:network.c **** fmemcpy(netname, &net_name, 16); 18 .loc 1 43 0 0 0000BD27 B81000 mov ax, 16 0 0000BD2A 50 push ax 0 0000BD2B 16 push ss 0 0000BD2C B8[0000] mov ax, offset _net_name 0 0000BD2F 50 push ax 0 0000BD30 FF7606 push word ptr [bp+6] 0 0000BD33 FF7604 push word ptr [bp+4] 0 0000BD36 E8[FEFF] call _fmemcpy 27 _.LVL1: 44:network.c **** return (NetBios); 45:network.c **** } 28 .loc 1 45 0 0 0000BD39 A1[0000] mov ax, word ptr [_NetBios] 0 0000BD3C 89EC mov sp, bp 0 0000BD3E 5D pop bp 0 0000BD3F C20400 ret 4 33 _.LFE4: 34 .size _get_machine_name, .-_get_machine_name 35 .global _set_machine_name 36 .type _set_machine_name, @function 37 _set_machine_name: 38 _.LFB5: 46:network.c **** 47:network.c **** VOID set_machine_name(BYTE FAR * netname, UWORD name_num) 48:network.c **** { 39 .loc 1 48 0 40 _.LVL2: 0 0000BD42 55 push bp 42 _.LCFI2: 0 0000BD43 89E5 mov bp, sp 44 _.LCFI3: 49:network.c **** NetBios = name_num; 45 .loc 1 49 0 0 0000BD45 8B4608 mov ax, word ptr [bp+8] 0 0000BD48 A3[0000] mov word ptr [_NetBios], ax 50:network.c **** fmemcpy(&net_name, netname, 15); 48 .loc 1 50 0 0 0000BD4B B80F00 mov ax, 15 0 0000BD4E 50 push ax 0 0000BD4F FF7606 push word ptr [bp+6] 0 0000BD52 FF7604 push word ptr [bp+4] 0 0000BD55 16 push ss 0 0000BD56 B8[0000] mov ax, offset _net_name 0 0000BD59 50 push ax 0 0000BD5A E8[FEFF] call _fmemcpy 57 _.LVL3: 51:network.c **** net_set_count++; 58 .loc 1 51 0 0 0000BD5D FE06[0000] inc byte ptr [_net_set_count] 52:network.c **** } 60 .loc 1 52 0 0 0000BD61 89EC mov sp, bp 0 0000BD63 5D pop bp 0 0000BD64 C20600 ret 6 64 _.LFE5: 65 .size _set_machine_name, .-_set_machine_name 66 .global _network_redirector_fp 67 .type _network_redirector_fp, @function 68 _network_redirector_fp: 69 _.LFB6: 53:network.c **** 54:network.c **** int network_redirector_fp(unsigned cmd, void far *s) 55:network.c **** { 70 .loc 1 55 0 71 _.LVL4: 0 0000BD67 55 push bp 73 _.LCFI4: 0 0000BD68 89E5 mov bp, sp 75 _.LCFI5: 56:network.c **** return (int)network_redirector_mx(cmd, s, 0); 76 .loc 1 56 0 0 0000BD6A 31C0 xor ax, ax 0 0000BD6C 50 push ax 0 0000BD6D FF7608 push word ptr [bp+8] 0 0000BD70 FF7606 push word ptr [bp+6] 0 0000BD73 FF7604 push word ptr [bp+4] 0 0000BD76 E8[FEFF] call _network_redirector_mx 83 _.LVL5: 57:network.c **** } 84 .loc 1 57 0 0 0000BD79 89EC mov sp, bp 0 0000BD7B 5D pop bp 0 0000BD7C C20600 ret 6 88 _.LFE6: 89 .size _network_redirector_fp, .-_network_redirector_fp 90 .global _network_redirector 91 .type _network_redirector, @function 92 _network_redirector: 93 _.LFB7: 58:network.c **** 59:network.c **** int network_redirector(unsigned cmd) 60:network.c **** { 94 .loc 1 60 0 95 _.LVL6: 0 0000BD7F 55 push bp 97 _.LCFI6: 0 0000BD80 89E5 mov bp, sp 99 _.LCFI7: 61:network.c **** return network_redirector_fp(cmd, NULL); 100 .loc 1 61 0 0 0000BD82 31C0 xor ax, ax 0 0000BD84 50 push ax 0 0000BD85 50 push ax 0 0000BD86 FF7604 push word ptr [bp+4] 0 0000BD89 E8[FEFF] call _network_redirector_fp 106 _.LVL7: 62:network.c **** } 107 .loc 1 62 0 0 0000BD8C 89EC mov sp, bp 0 0000BD8E 5D pop bp 0 0000BD8F C20200 ret 2 111 _.LFE7: 112 .size _network_redirector, .-_network_redirector === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: newstuff.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=newstuff.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccZ6tH3A.s output file : newstuff.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _SetJFTSize 8 .type _SetJFTSize, @function 9 _SetJFTSize: 10 _.LFB4: 11 .file 1 "newstuff.c" 1:newstuff.c **** /****************************************************************/ 2:newstuff.c **** /* */ 3:newstuff.c **** /* newstuff.c */ 4:newstuff.c **** /* DOS-C */ 5:newstuff.c **** /* */ 6:newstuff.c **** /* Copyright (c) 1996 */ 7:newstuff.c **** /* Svante Frey */ 8:newstuff.c **** /* All Rights Reserved */ 9:newstuff.c **** /* */ 10:newstuff.c **** /* This file is part of DOS-C. */ 11:newstuff.c **** /* */ 12:newstuff.c **** /* DOS-C is free software; you can redistribute it and/or */ 13:newstuff.c **** /* modify it under the terms of the GNU General Public License */ 14:newstuff.c **** /* as published by the Free Software Foundation; either version */ 15:newstuff.c **** /* 2, or (at your option) any later version. */ 16:newstuff.c **** /* */ 17:newstuff.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 18:newstuff.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 19:newstuff.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 20:newstuff.c **** /* the GNU General Public License for more details. */ 21:newstuff.c **** /* */ 22:newstuff.c **** /* You should have received a copy of the GNU General Public */ 23:newstuff.c **** /* License along with DOS-C; see the file COPYING. If not, */ 24:newstuff.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 25:newstuff.c **** /* Cambridge, MA 02139, USA. */ 26:newstuff.c **** /****************************************************************/ 27:newstuff.c **** 28:newstuff.c **** #include "portab.h" 29:newstuff.c **** #include "globals.h" 30:newstuff.c **** #include "debug.h" 31:newstuff.c **** 32:newstuff.c **** /* 33:newstuff.c **** TE-TODO: if called repeatedly by same process, 34:newstuff.c **** last allocation must be freed. if handle count < 20, copy back to PSP 35:newstuff.c **** */ 36:newstuff.c **** int SetJFTSize(UWORD nHandles) 37:newstuff.c **** { 12 .loc 1 37 0 13 _.LVL0: 0 0000ADBC 56 push si 0 0000ADBD 57 push di 0 0000ADBE 55 push bp 17 _.LCFI0: 0 0000ADBF 89E5 mov bp, sp 19 _.LCFI1: 0 0000ADC1 83EC0A sub sp, 10 0 0000ADC4 8B7608 mov si, word ptr [bp+8] 38:newstuff.c **** UWORD block, maxBlock, i; 39:newstuff.c **** psp FAR *ppsp = MK_FP(cu_psp, 0); 22 .loc 1 39 0 0 0000ADC7 A1[0000] mov ax, word ptr [_cu_psp] 0 0000ADCA 8946FA mov word ptr [bp-6], ax 0 0000ADCD 31DB xor bx, bx 26 _.LVL1: 40:newstuff.c **** UBYTE FAR *newtab; 41:newstuff.c **** 42:newstuff.c **** if (nHandles <= ppsp->ps_maxfiles) 27 .loc 1 42 0 0 0000ADCF 8EC0 mov es, ax 0 0000ADD1 2639363200 cmp word ptr es:[50], si 0 0000ADD6 720E jc _.L2 43:newstuff.c **** { 44:newstuff.c **** ppsp->ps_maxfiles = nHandles; 31 .loc 1 44 0 0 0000ADD8 2689363200 mov word ptr es:[50], si 33 _.LVL2: 34 _.L6: 45:newstuff.c **** return SUCCESS; 46:newstuff.c **** } 47:newstuff.c **** 48:newstuff.c **** if ((DosMemAlloc 49:newstuff.c **** ((nHandles + 0xf) >> 4, mem_access_mode, &block, &maxBlock)) < 0) 50:newstuff.c **** return DE_NOMEM; 51:newstuff.c **** 52:newstuff.c **** ++block; 53:newstuff.c **** newtab = MK_FP(block, 0); 54:newstuff.c **** 55:newstuff.c **** i = ppsp->ps_maxfiles; 56:newstuff.c **** /* copy existing part and fill up new part by "no open file" */ 57:newstuff.c **** fmemcpy(newtab, ppsp->ps_filetab, i); 58:newstuff.c **** fmemset(newtab + i, 0xff, nHandles - i); 59:newstuff.c **** 60:newstuff.c **** ppsp->ps_maxfiles = nHandles; 61:newstuff.c **** ppsp->ps_filetab = newtab; 62:newstuff.c **** 63:newstuff.c **** return SUCCESS; 35 .loc 1 63 0 0 0000ADDD 93 xchg bx, ax 37 _.L1: 64:newstuff.c **** } 38 .loc 1 64 0 0 0000ADDE 89EC mov sp, bp 0 0000ADE0 5D pop bp 0 0000ADE1 5F pop di 0 0000ADE2 5E pop si 0 0000ADE3 C20200 ret 2 44 _.LVL3: 45 _.L2: 0 0000ADE6 895EF8 mov word ptr [bp-8], bx 48:newstuff.c **** ((nHandles + 0xf) >> 4, mem_access_mode, &block, &maxBlock)) < 0) 47 .loc 1 48 0 0 0000ADE9 8D46FE lea ax, [-2+bp] 49 _.LVL4: 0 0000ADEC 50 push ax 0 0000ADED 8D46FC lea ax, [-4+bp] 0 0000ADF0 50 push ax 0 0000ADF1 A0[0000] mov al, byte ptr [_mem_access_mode] 0 0000ADF4 30E4 xor ah, ah 0 0000ADF6 50 push ax 49:newstuff.c **** return DE_NOMEM; 56 .loc 1 49 0 0 0000ADF7 8D440F lea ax, [15+si] 0 0000ADFA B104 mov cl, 4 0 0000ADFC D3E8 shr ax, cl 48:newstuff.c **** ((nHandles + 0xf) >> 4, mem_access_mode, &block, &maxBlock)) < 0) 60 .loc 1 48 0 0 0000ADFE 50 push ax 0 0000ADFF E8[FEFF] call _DosMemAlloc 63 _.LVL5: 0 0000AE02 85C0 test ax, ax 0 0000AE04 7C4E jl _.L4 52:newstuff.c **** newtab = MK_FP(block, 0); 66 .loc 1 52 0 0 0000AE06 8B7EFC mov di, word ptr [bp-4] 0 0000AE09 47 inc di 0 0000AE0A 897EFC mov word ptr [bp-4], di 70 _.LVL6: 55:newstuff.c **** /* copy existing part and fill up new part by "no open file" */ 71 .loc 1 55 0 0 0000AE0D 8E46FA mov es, word ptr [bp-6] 0 0000AE10 26A13200 mov ax, word ptr es:[50] 74 _.LVL7: 57:newstuff.c **** fmemset(newtab + i, 0xff, nHandles - i); 75 .loc 1 57 0 0 0000AE14 50 push ax 0 0000AE15 8946F6 mov word ptr [bp-10], ax 0 0000AE18 26FF363600 push word ptr es:[54] 0 0000AE1D 26FF363400 push word ptr es:[52] 0 0000AE22 57 push di 0 0000AE23 8B5EF8 mov bx, word ptr [bp-8] 0 0000AE26 53 push bx 0 0000AE27 E8[FEFF] call _fmemcpy 84 _.LVL8: 58:newstuff.c **** 85 .loc 1 58 0 0 0000AE2A 89F2 mov dx, si 0 0000AE2C 8B46F6 mov ax, word ptr [bp-10] 0 0000AE2F 29C2 sub dx, ax 0 0000AE31 52 push dx 0 0000AE32 BAFF00 mov dx, 255 0 0000AE35 52 push dx 0 0000AE36 57 push di 0 0000AE37 50 push ax 0 0000AE38 E8[FEFF] call _fmemset 95 _.LVL9: 60:newstuff.c **** ppsp->ps_filetab = newtab; 96 .loc 1 60 0 0 0000AE3B 8E46FA mov es, word ptr [bp-6] 0 0000AE3E 2689363200 mov word ptr es:[50], si 99 _.LVL10: 61:newstuff.c **** 100 .loc 1 61 0 0 0000AE43 C45EF8 les bx, dword ptr [bp-8] 0 0000AE46 26895F34 mov word ptr es:[bx+52], bx 0 0000AE4A 8E46FA mov es, word ptr [bp-6] 0 0000AE4D 26893E3600 mov word ptr es:[54], di 0 0000AE52 EB89 jmp _.L6 106 _.LVL11: 107 _.L4: 50:newstuff.c **** 108 .loc 1 50 0 0 0000AE54 B8F8FF mov ax, -8 0 0000AE57 EB85 jmp _.L1 111 _.LFE4: 112 .size _SetJFTSize, .-_SetJFTSize 113 .global _DosMkTmp 114 .type _DosMkTmp, @function 115 _DosMkTmp: 116 _.LFB5: 65:newstuff.c **** 66:newstuff.c **** long DosMkTmp(BYTE FAR * pathname, UWORD attr) 67:newstuff.c **** { 117 .loc 1 67 0 118 _.LVL12: 0 0000AE59 56 push si 0 0000AE5A 57 push di 0 0000AE5B 55 push bp 122 _.LCFI2: 0 0000AE5C 89E5 mov bp, sp 124 _.LCFI3: 0 0000AE5E 83EC12 sub sp, 18 0 0000AE61 8B7E08 mov di, word ptr [bp+8] 0 0000AE64 8B460A mov ax, word ptr [bp+10] 0 0000AE67 8946FC mov word ptr [bp-4], ax 68:newstuff.c **** /* create filename from current date and time */ 69:newstuff.c **** char FAR *ptmp; 70:newstuff.c **** unsigned long randvar; 71:newstuff.c **** long rc; 72:newstuff.c **** int loop; 73:newstuff.c **** 74:newstuff.c **** ptmp = pathname + fstrlen(pathname); 129 .loc 1 74 0 0 0000AE6A 50 push ax 0 0000AE6B 57 push di 0 0000AE6C E8[FEFF] call _fstrlen 133 _.LVL13: 0 0000AE6F 01F8 add ax, di 0 0000AE71 8946FA mov word ptr [bp-6], ax 136 _.LVL14: 75:newstuff.c **** if (os_major == 5) { /* clone some bad habit of MS DOS 5.0 only */ 137 .loc 1 75 0 0 0000AE74 803E[0000]05 cmp byte ptr [_os_major], 5 0 0000AE79 7520 jne _.L8 0 0000AE7B 89C3 mov bx, ax 76:newstuff.c **** if (ptmp == pathname || (ptmp[-1] != '\\' && ptmp[-1] != '/')) 141 .loc 1 76 0 0 0000AE7D 39C7 cmp di, ax 0 0000AE7F 740F je _.L9 144 .loc 1 76 0 is_stmt 0 discriminator 1 0 0000AE81 8E46FC mov es, word ptr [bp-4] 0 0000AE84 268A47FF mov al, byte ptr es:[bx-1] 147 _.LVL15: 0 0000AE88 3C5C cmp al, 92 0 0000AE8A 740F je _.L8 0 0000AE8C 3C2F cmp al, 47 0 0000AE8E 740B je _.L8 152 _.L9: 153 _.LVL16: 77:newstuff.c **** *ptmp++ = '\\'; 154 .loc 1 77 0 is_stmt 1 0 0000AE90 8E46FC mov es, word ptr [bp-4] 0 0000AE93 26C6075C mov byte ptr es:[bx], 92 157 _.LVL17: 0 0000AE97 43 inc bx 159 _.LVL18: 0 0000AE98 895EFA mov word ptr [bp-6], bx 161 _.LVL19: 162 _.L8: 78:newstuff.c **** } 79:newstuff.c **** ptmp[8] = '\0'; 163 .loc 1 79 0 0 0000AE9B C45EFA les bx, dword ptr [bp-6] 0 0000AE9E 26C6470800 mov byte ptr es:[bx+8], 0 166 _.LVL20: 80:newstuff.c **** 81:newstuff.c **** randvar = ((unsigned long)dos_getdate() << 16) | dos_gettime(); 167 .loc 1 81 0 0 0000AEA3 E8[FEFF] call _dos_getdate 169 _.LVL21: 0 0000AEA6 96 xchg si, ax 0 0000AEA7 E8[FEFF] call _dos_gettime 172 _.LVL22: 0 0000AEAA 8946FE mov word ptr [bp-2], ax 0 0000AEAD 89F3 mov bx, si 175 _.LVL23: 0 0000AEAF 050010 add ax, 4096 0 0000AEB2 8946F0 mov word ptr [bp-16], ax 0 0000AEB5 96 xchg si, ax 0 0000AEB6 83D000 adc ax, 0 0 0000AEB9 8946EE mov word ptr [bp-18], ax 181 _.LVL24: 182 _.L28: 183 _.LBB2: 82:newstuff.c **** 83:newstuff.c **** loop = 0; 84:newstuff.c **** do { 85:newstuff.c **** unsigned long tmp = randvar++; 184 .loc 1 85 0 0 0000AEBC 8B46FE mov ax, word ptr [bp-2] 0 0000AEBF 83C001 add ax, 1 0 0000AEC2 8946F6 mov word ptr [bp-10], ax 0 0000AEC5 89D8 mov ax, bx 0 0000AEC7 83D000 adc ax, 0 0 0000AECA 8946F4 mov word ptr [bp-12], ax 191 _.LVL25: 0 0000AECD BA0800 mov dx, 8 86:newstuff.c **** int i; 87:newstuff.c **** for(i = 7; i >= 0; tmp >>= 4, i--) 193 .loc 1 87 0 0 0000AED0 C746F80700 mov word ptr [bp-8], 7 0 0000AED5 B50C mov ch, 12 196 _.LVL26: 197 _.L11: 88:newstuff.c **** ptmp[i] = ((char)tmp & 0xf) + 'A'; 198 .loc 1 88 0 discriminator 3 0 0000AED7 8B46FA mov ax, word ptr [bp-6] 0 0000AEDA 0346F8 add ax, word ptr [bp-8] 0 0000AEDD 96 xchg si, ax 0 0000AEDE 8A66FE mov ah, byte ptr [bp-2] 0 0000AEE1 80E40F and ah, 15 0 0000AEE4 80C441 add ah, 65 0 0000AEE7 8E46FC mov es, word ptr [bp-4] 0 0000AEEA 268824 mov byte ptr es:[si], ah 207 _.LVL27: 87:newstuff.c **** ptmp[i] = ((char)tmp & 0xf) + 'A'; 208 .loc 1 87 0 discriminator 3 0 0000AEED 89D8 mov ax, bx 0 0000AEEF 88E9 mov cl, ch 0 0000AEF1 D3E0 shl ax, cl 0 0000AEF3 96 xchg si, ax 0 0000AEF4 8B46FE mov ax, word ptr [bp-2] 0 0000AEF7 B104 mov cl, 4 0 0000AEF9 D3E8 shr ax, cl 0 0000AEFB 8946F2 mov word ptr [bp-14], ax 0 0000AEFE 93 xchg bx, ax 0 0000AEFF D3E8 shr ax, cl 219 _.LVL28: 0 0000AF01 89F3 mov bx, si 0 0000AF03 0B5EF2 or bx, word ptr [bp-14] 0 0000AF06 895EFE mov word ptr [bp-2], bx 223 _.LVL29: 0 0000AF09 93 xchg bx, ax 0 0000AF0A FF4EF8 dec word ptr [bp-8] 226 _.LVL30: 0 0000AF0D 4A dec dx 0 0000AF0E 75C7 jne _.L11 89:newstuff.c **** 90:newstuff.c **** /* DOS versions: > 5: characters A - P 91:newstuff.c **** < 5: hex digits */ 92:newstuff.c **** if (os_major < 5) 229 .loc 1 92 0 0 0000AF10 380E[0000] cmp byte ptr [_os_major], cl 0 0000AF14 7E20 jle _.L12 232 _.LVL31: 233 _.L18: 93:newstuff.c **** for (i = 0; i < 8; i++) 94:newstuff.c **** ptmp[i] -= (ptmp[i] < 'A' + 10) ? '0' - 'A' : 10; 95:newstuff.c **** 96:newstuff.c **** /* only create new file -- 2001/09/22 ska*/ 97:newstuff.c **** rc = DosOpen(pathname, O_LEGACY | O_CREAT | O_RDWR, attr); 234 .loc 1 97 0 0 0000AF16 FF760C push word ptr [bp+12] 0 0000AF19 B8020C mov ax, 3074 0 0000AF1C 50 push ax 0 0000AF1D FF76FC push word ptr [bp-4] 0 0000AF20 57 push di 0 0000AF21 E8[FEFF] call _DosOpen 241 _.LVL32: 242 _.LBE2: 98:newstuff.c **** } while (rc == DE_FILEEXISTS && loop++ < 0xfff); 243 .loc 1 98 0 0 0000AF24 83F8B0 cmp ax, -80 0 0000AF27 7505 jne _.L7 0 0000AF29 83FAFF cmp dx, -1 0 0000AF2C 7432 je _.L31 248 _.LVL33: 249 _.L7: 99:newstuff.c **** 100:newstuff.c **** return rc; 101:newstuff.c **** } 250 .loc 1 101 0 0 0000AF2E 89EC mov sp, bp 0 0000AF30 5D pop bp 0 0000AF31 5F pop di 0 0000AF32 5E pop si 0 0000AF33 C20600 ret 6 256 _.LVL34: 257 _.L12: 258 _.LBB3: 0 0000AF36 BE0800 mov si, 8 0 0000AF39 92 xchg dx, ax 94:newstuff.c **** 261 .loc 1 94 0 0 0000AF3A B6EF mov dh, -17 0 0000AF3C B10A mov cl, 10 264 _.LVL35: 265 _.L17: 0 0000AF3E 8B5EFA mov bx, word ptr [bp-6] 0 0000AF41 01C3 add bx, ax 0 0000AF43 8E46FC mov es, word ptr [bp-4] 0 0000AF46 268A17 mov dl, byte ptr es:[bx] 0 0000AF49 88F5 mov ch, dh 0 0000AF4B 80FA4A cmp dl, 74 0 0000AF4E 7E02 jle _.L16 0 0000AF50 88CD mov ch, cl 274 _.L16: 94:newstuff.c **** 275 .loc 1 94 0 is_stmt 0 discriminator 4 0 0000AF52 28EA sub dl, ch 0 0000AF54 8E46FC mov es, word ptr [bp-4] 0 0000AF57 268817 mov byte ptr es:[bx], dl 93:newstuff.c **** ptmp[i] -= (ptmp[i] < 'A' + 10) ? '0' - 'A' : 10; 279 .loc 1 93 0 is_stmt 1 discriminator 4 0 0000AF5A 40 inc ax 281 _.LVL36: 0 0000AF5B 4E dec si 0 0000AF5C 75E0 jne _.L17 0 0000AF5E EBB6 jmp _.L18 285 _.LVL37: 286 _.L31: 287 _.LVL38: 0 0000AF60 8B4EF6 mov cx, word ptr [bp-10] 0 0000AF63 894EFE mov word ptr [bp-2], cx 290 _.LVL39: 0 0000AF66 8B5EF4 mov bx, word ptr [bp-12] 292 _.LBE3: 98:newstuff.c **** 293 .loc 1 98 0 discriminator 1 0 0000AF69 3B4EF0 cmp cx, word ptr [bp-16] 0 0000AF6C 7403E94BFF jne _.L28 0 0000AF71 3B5EEE cmp bx, word ptr [bp-18] 0 0000AF74 7403E943FF jne _.L28 0 0000AF79 EBB3 jmp _.L7 299 _.LFE5: 300 .size _DosMkTmp, .-_DosMkTmp === Switch to base=012BB0h -> ".RODATA.STR1.1" 301 .section .rodata.str1.1,"aMS",@progbits,1 302 _.LC0: 0 00001A94 44455600 .string "DEV" 304 _.LC1: 0 00001A98 5C4445565C00 .string "\\DEV\\" === Switch to base=002270h -> ".TEXT" 306 .text 307 .global _truename 308 .type _truename, @function 309 _truename: 310 _.LFB6: 102:newstuff.c **** 103:newstuff.c **** 104:newstuff.c **** #define drLetterToNr(dr) ((unsigned char)((dr) - 'A')) 105:newstuff.c **** /* Convert an uppercased drive letter into the drive index */ 106:newstuff.c **** #define drNrToLetter(dr) ((dr) + 'A') 107:newstuff.c **** /* the other direction */ 108:newstuff.c **** 109:newstuff.c **** /* In DOS there are no free-standing UNC paths, therefore there 110:newstuff.c **** is always a logical drive letter associated with a path 111:newstuff.c **** spec. This letter is also the index into the CDS */ 112:newstuff.c **** 113:newstuff.c **** /* 114:newstuff.c **** Definition of functions for the handling of the Current 115:newstuff.c **** Directory Structure. 116:newstuff.c **** 117:newstuff.c **** MUX-11-23: Qualify Remote Filename 118:newstuff.c **** DOS-0x60 calls this MUX functions to let the Network Redirector 119:newstuff.c **** qualify the filename. According INTRSPY MS DOS 6 does not pre- 120:newstuff.c **** process the passed in filename in any way (see attached transcripts). 121:newstuff.c **** 122:newstuff.c **** The DOS-60 interface TRUENAME looks like this: 123:newstuff.c **** 124:newstuff.c **** DosTruename(src, dest) { 125:newstuff.c **** if (MUX-11-23(src, dest) != Error) 126:newstuff.c **** return SUCCESS 127:newstuff.c **** return local_truename(src, dest); 128:newstuff.c **** } 129:newstuff.c **** 130:newstuff.c **** The CDS has the following entries: 131:newstuff.c **** 132:newstuff.c **** char cdsPath[CDSPATHLEN]; 133:newstuff.c **** The fully-qualified current working directory of this drive. 134:newstuff.c **** The format is DOS :\[{\}] 135:newstuff.c **** or UNC \\[{\}]. 136:newstuff.c **** The drive indicates the physical drive letter and is the 137:newstuff.c **** index into the blk_device[]. 138:newstuff.c **** 139:newstuff.c **** UWORD cdsFlags; 140:newstuff.c **** Indicates what kind this logical drive is: 141:newstuff.c **** NETWORK: drive is NOT local \ If both are set, drive is IFS 142:newstuff.c **** PHYSICAL: drive is local / If none is set, drive is non-existant 143:newstuff.c **** JOIN: drive is joined in as the path cdsPath. This Flag uses the 144:newstuff.c **** index into the CDS table to indicate the physical drive. 145:newstuff.c **** SUBST: drive substitutes the path cdsPath. 146:newstuff.c **** HIDDEN: drive is not included into the redirector's list. 147:newstuff.c **** 148:newstuff.c **** struct dpb FAR *cdsDpb; 149:newstuff.c **** Pointer to the DPB driving the physical drive. In DOS-C, the physical 150:newstuff.c **** drive letter is the index into the DPB[]. But for compatibly reason 151:newstuff.c **** this field will be set correctly. 152:newstuff.c **** 153:newstuff.c **** UWORD cdsStartCluster; 154:newstuff.c **** For local drives only: This holds the cluster number of 155:newstuff.c **** the start of the current working directory of this 156:newstuff.c **** logical drive. If 0000h, it's the root directory; if 157:newstuff.c **** 0ffffh, the drive was never accessed and has to be read 158:newstuff.c **** again. 159:newstuff.c **** 160:newstuff.c **** void FAR *cdsIFSrecord; 161:newstuff.c **** UWORD cdsIFSparameter; 162:newstuff.c **** For networked drives only: Holds pointer/parameters to/for IFS 163:newstuff.c **** driver. (Well, I don't know.) 164:newstuff.c **** 165:newstuff.c **** UWORD cdsPathOff; 166:newstuff.c **** Number of characters of the cdsPath[], which are hidden. The 167:newstuff.c **** logical path is combined by the logical drive letter and the 168:newstuff.c **** cdsPath[] part, which is not hidden. 169:newstuff.c **** 170:newstuff.c **** IFS FAR *cdsIFSdrv; 171:newstuff.c **** Will be zeroed for local drives. 172:newstuff.c **** 173:newstuff.c **** Revision 1.2 1995/12/03 22:17:41 ska 174:newstuff.c **** bugfix: Scanning of file name in 8.3 failed on "." and on longer names. 175:newstuff.c **** 176:newstuff.c **** Revision 1.1 1995/11/09 07:43:30 ska 177:newstuff.c **** # 178:newstuff.c **** 179:newstuff.c **** */ 180:newstuff.c **** 181:newstuff.c **** #define PATH_ERROR() \ 182:newstuff.c **** fstrchr(src, '/') == 0 && fstrchr(src, '\\') == 0 \ 183:newstuff.c **** ? DE_FILENOTFND \ 184:newstuff.c **** : DE_PATHNOTFND 185:newstuff.c **** #define PATHLEN 128 186:newstuff.c **** 187:newstuff.c **** 188:newstuff.c **** /* Map a logical path into a physical one. 189:newstuff.c **** 190:newstuff.c **** 1) Uppercasing path. 191:newstuff.c **** 2) Flipping '/' -> '\\'. 192:newstuff.c **** 3) Removing empty directory components & ".". 193:newstuff.c **** 4) Processing ".." components. 194:newstuff.c **** 5) Convert path components into 8.3 convention. 195:newstuff.c **** 6) Make it fully-qualified. 196:newstuff.c **** 7) Map it to SUBST/UNC. 197:newstuff.c **** 8) Map to JOIN. 198:newstuff.c **** 199:newstuff.c **** Return: 200:newstuff.c **** *cdsItem will be point to the appropriate CDS entry. This will allow 201:newstuff.c **** the caller to aquire the DPB or the IFS informtion of this entry. 202:newstuff.c **** error number 203:newstuff.c **** Return value: 204:newstuff.c **** DE_FILENOTFND, or DE_PATHNOTFND (as described in RBIL) 205:newstuff.c **** If the output path pnfo->physPath exceeds the length MAX_PATH, the error 206:newstuff.c **** DE_FILENOTFND will be returned. 207:newstuff.c **** */ 208:newstuff.c **** 209:newstuff.c **** /* 210:newstuff.c **** * Added support for external and internal calls. 211:newstuff.c **** * Clean buffer before use. Make the true path and expand file names. 212:newstuff.c **** * Example: *.* -> ????????.??? as in the currect way. 213:newstuff.c **** * MSD returns \\D.\A.\????????.??? with SHSUCDX. So, this code is not 214:newstuff.c **** * compatible MSD Func 60h. 215:newstuff.c **** */ 216:newstuff.c **** 217:newstuff.c **** /*TE TODO: 218:newstuff.c **** 219:newstuff.c **** experimenting with NUL on MSDOS 7.0 (win95) 220:newstuff.c **** 221:newstuff.c **** WIN95 FREEDOS 222:newstuff.c **** TRUENAME NUL C:/NUL OK 223:newstuff.c **** TRUENAME .\NUL C:\DOS\NUL 224:newstuff.c **** TRUENAME ..\NUL C:\NUL 225:newstuff.c **** TRUENAME ..\..\NUL path not found 226:newstuff.c **** TRUENAME Z:NUL invalid drive (not lastdrive!!) 227:newstuff.c **** TRUENAME A:NUL A:/NUL OK 228:newstuff.c **** TRUENAME A:\NUL A:\NUL 229:newstuff.c **** 230:newstuff.c **** */ 231:newstuff.c **** 232:newstuff.c **** #define PNE_WILDCARD 1 233:newstuff.c **** #define PNE_DOT 2 234:newstuff.c **** 235:newstuff.c **** STATIC const char _DirChars[] = "\"[]:|<>+=;,"; 236:newstuff.c **** 237:newstuff.c **** #define DirChar(c) (((unsigned char)(c)) >= ' ' && \ 238:newstuff.c **** !strchr(_DirChars, (c))) 239:newstuff.c **** 240:newstuff.c **** #define addChar(c) \ 241:newstuff.c **** { \ 242:newstuff.c **** if (p >= dest + SFTMAX) return PATH_ERROR(); /* path too long */ \ 243:newstuff.c **** *p++ = c; \ 244:newstuff.c **** } 245:newstuff.c **** 246:newstuff.c **** COUNT truename(const char FAR * src, char * dest, COUNT mode) 247:newstuff.c **** { 311 .loc 1 247 0 312 _.LVL40: 0 0000AF7B 56 push si 0 0000AF7C 57 push di 0 0000AF7D 55 push bp 316 _.LCFI4: 0 0000AF7E 89E5 mov bp, sp 318 _.LCFI5: 0 0000AF80 83EC12 sub sp, 18 0 0000AF83 8B7E0C mov di, word ptr [bp+12] 321 _.LVL41: 248:newstuff.c **** COUNT i; 249:newstuff.c **** struct dhdr FAR *dhp; 250:newstuff.c **** const char FAR *froot; 251:newstuff.c **** COUNT result; 252:newstuff.c **** unsigned state; 253:newstuff.c **** struct cds FAR *cdsEntry; 254:newstuff.c **** char *p = dest; /* dynamic pointer into dest */ 255:newstuff.c **** char *rootPos; 256:newstuff.c **** char src0; 257:newstuff.c **** 258:newstuff.c **** tn_printf(("truename(%S)\n", src)); 259:newstuff.c **** 260:newstuff.c **** /* First, adjust the source pointer */ 261:newstuff.c **** src = adjust_far(src); 322 .loc 1 261 0 0 0000AF86 FF760A push word ptr [bp+10] 0 0000AF89 FF7608 push word ptr [bp+8] 0 0000AF8C E8[FEFF] call _adjust_far 326 _.LVL42: 0 0000AF8F 894608 mov word ptr [bp+8], ax 328 _.LVL43: 0 0000AF92 89560A mov word ptr [bp+10], dx 330 _.LVL44: 262:newstuff.c **** 263:newstuff.c **** /* In opposite of the TRUENAME shell command, an empty string is 264:newstuff.c **** rejected by MS DOS 6 */ 265:newstuff.c **** src0 = src[0]; 331 .loc 1 265 0 0 0000AF95 8EC2 mov es, dx 0 0000AF97 89C3 mov bx, ax 0 0000AF99 268A0F mov cl, byte ptr es:[bx] 335 _.LVL45: 266:newstuff.c **** if (src0 == '\0') 336 .loc 1 266 0 0 0000AF9C 84C9 test cl, cl 0 0000AF9E 7507 jne _.L34 339 _.LVL46: 340 _.L92: 267:newstuff.c **** return DE_FILENOTFND; 268:newstuff.c **** 269:newstuff.c **** if (src0 == '\\' && src[1] == '\\') { 270:newstuff.c **** const char FAR *unc_src = src; 271:newstuff.c **** /* Flag UNC paths and short circuit processing. Set current LDT */ 272:newstuff.c **** /* to sentinel (offset 0xFFFF) for redirector processing. */ 273:newstuff.c **** tn_printf(("Truename: UNC detected\n")); 274:newstuff.c **** do { 275:newstuff.c **** src0 = unc_src[0]; 276:newstuff.c **** addChar(src0); 277:newstuff.c **** unc_src++; 278:newstuff.c **** } while (src0); 279:newstuff.c **** current_ldt = (struct cds FAR *)MK_FP(0xFFFF,0xFFFF); 280:newstuff.c **** tn_printf(("Returning path: \"%s\"\n", dest)); 281:newstuff.c **** /* Flag as network - drive bits are empty but shouldn't get */ 282:newstuff.c **** /* referenced for network with empty current_ldt. */ 283:newstuff.c **** return IS_NETWORK; 284:newstuff.c **** } 285:newstuff.c **** 286:newstuff.c **** /* Do we have a drive? */ 287:newstuff.c **** if (src[1] == ':') 288:newstuff.c **** result = drLetterToNr(DosUpFChar(src0)); 289:newstuff.c **** else 290:newstuff.c **** result = default_drive; 291:newstuff.c **** 292:newstuff.c **** dhp = IsDevice(src); 293:newstuff.c **** 294:newstuff.c **** cdsEntry = get_cds(result); 295:newstuff.c **** if (cdsEntry == NULL) 296:newstuff.c **** { 297:newstuff.c **** /* If opening a character device, DOS allows device name 298:newstuff.c **** to be prefixed by [invalid] drive letter and/or optionally 299:newstuff.c **** \DEV\ directory prefix, however, any other directory 300:newstuff.c **** including root (\) is an invalid path if drive is not 301:newstuff.c **** valid and returns such. 302:newstuff.c **** Whereas truename always fails for invalid drive. 303:newstuff.c **** */ 304:newstuff.c **** if (dhp && (mode & CDS_MODE_CHECK_DEV_PATH) && (result >= lastdrive)) 305:newstuff.c **** { 306:newstuff.c **** /* Note: check for (result >= lastdrive) means invalid drive 307:newstuff.c **** was provided as otherwise we would have used default_drive 308:newstuff.c **** so we know src in the form of X:? 309:newstuff.c **** fail if anything other than no path or path is \DEV\ 310:newstuff.c **** */ 311:newstuff.c **** const char FAR *s = src+2; 312:newstuff.c **** char c = *s; 313:newstuff.c **** 314:newstuff.c **** if( c != '\\' && c != '/' ) c = '\0'; 315:newstuff.c **** /* could be 1 letter devicename, don't go scanning random memory */ 316:newstuff.c **** if (*(src+3) != '\0') 317:newstuff.c **** { 318:newstuff.c **** s = fstrchr(src+3, '\\'); /* ?is there \ or / other than immediately after drive: */ 319:newstuff.c **** if (s == NULL) s = fstrchr(src+3, '/'); 320:newstuff.c **** } 321:newstuff.c **** else 322:newstuff.c **** { 323:newstuff.c **** s = NULL; 324:newstuff.c **** } 325:newstuff.c **** 326:newstuff.c **** if (c == '\0') 327:newstuff.c **** { 328:newstuff.c **** /* either X:devicename or X:path\devicename */ 329:newstuff.c **** if (s != NULL) goto invalid_path; 330:newstuff.c **** } 331:newstuff.c **** else 332:newstuff.c **** { 333:newstuff.c **** /* either X:\devicename or X:\path\devicename 334:newstuff.c **** only X:\DEV\devicename is valid path 335:newstuff.c **** */ 336:newstuff.c **** if (s == NULL) goto invalid_path; 337:newstuff.c **** if (s != src+6) goto invalid_path; 338:newstuff.c **** if (fmemcmp(src+3, "DEV", 3) != 0) goto invalid_path; 339:newstuff.c **** s = fstrchr(src+7, '\\'); 340:newstuff.c **** if (s == NULL) s = fstrchr(src+7, '/'); 341:newstuff.c **** if (s != NULL) goto invalid_path; 342:newstuff.c **** } 343:newstuff.c **** 344:newstuff.c **** /* use CDS of current drive (MS-DOS may return drive P: for invalid drive.) */ 345:newstuff.c **** result = default_drive; 346:newstuff.c **** cdsEntry = get_cds(result); 347:newstuff.c **** if (cdsEntry == NULL) goto invalid_path; 348:newstuff.c **** } 349:newstuff.c **** else 350:newstuff.c **** { 351:newstuff.c **** invalid_path: 352:newstuff.c **** return DE_PATHNOTFND; 353:newstuff.c **** } 354:newstuff.c **** } 355:newstuff.c **** 356:newstuff.c **** fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS)); 357:newstuff.c **** tn_printf(("CDS entry: #%u @%p (%u) '%s'\n", result, cdsEntry, 358:newstuff.c **** TempCDS.cdsBackslashOffset, TempCDS.cdsCurrentPath)); 359:newstuff.c **** /* is the current_ldt thing necessary for compatibly?? 360:newstuff.c **** -- 2001/09/03 ska*/ 361:newstuff.c **** current_ldt = cdsEntry; 362:newstuff.c **** if (TempCDS.cdsFlags & CDSNETWDRV) 363:newstuff.c **** result |= IS_NETWORK; 364:newstuff.c **** 365:newstuff.c **** if (dhp) 366:newstuff.c **** result |= IS_DEVICE; 367:newstuff.c **** 368:newstuff.c **** /* Try if the Network redirector wants to do it */ 369:newstuff.c **** dest[0] = '\0'; /* better probable for sanity check below -- 370:newstuff.c **** included by original truename() */ 371:newstuff.c **** /* MUX succeeded and really something */ 372:newstuff.c **** if (!(mode & CDS_MODE_SKIP_PHYSICAL) && 373:newstuff.c **** QRemote_Fn(dest, src) == SUCCESS && dest[0] != '\0') 374:newstuff.c **** { 375:newstuff.c **** tn_printf(("QRemoteFn() returned: \"%s\"\n", dest)); 376:newstuff.c **** #ifdef DEBUG_TRUENAME 377:newstuff.c **** if (strlen(dest) >= SFTMAX) 378:newstuff.c **** panic("Truename: QRemote_Fn() overflowed output buffer"); 379:newstuff.c **** #endif 380:newstuff.c **** if (dest[2] == '/' && (result & IS_DEVICE)) 381:newstuff.c **** result &= ~IS_NETWORK; 382:newstuff.c **** return result; 383:newstuff.c **** } 384:newstuff.c **** 385:newstuff.c **** /* Redirector interface failed --> proceed with local mapper */ 386:newstuff.c **** dest[0] = drNrToLetter(result & 0x1f); 387:newstuff.c **** dest[1] = ':'; 388:newstuff.c **** 389:newstuff.c **** /* Do we have a drive? */ 390:newstuff.c **** if (src[1] == ':') 391:newstuff.c **** src += 2; 392:newstuff.c **** 393:newstuff.c **** /* 394:newstuff.c **** Code repoff from dosfns.c 395:newstuff.c **** MSD returns X:/CON for truename con. Not X:\CON 396:newstuff.c **** */ 397:newstuff.c **** /* check for a device */ 398:newstuff.c **** 399:newstuff.c **** dest[2] = '\\'; 400:newstuff.c **** if (result & IS_DEVICE) 401:newstuff.c **** { 402:newstuff.c **** froot = get_root(src); 403:newstuff.c **** if (froot == src || froot == src + 5) 404:newstuff.c **** { 405:newstuff.c **** if (froot == src + 5) 406:newstuff.c **** { 407:newstuff.c **** fmemcpy(dest + 3, src, 5); 408:newstuff.c **** DosUpMem(dest + 3, 5); 409:newstuff.c **** if (dest[3] == '/') dest[3] = '\\'; 410:newstuff.c **** if (dest[7] == '/') dest[7] = '\\'; 411:newstuff.c **** } 412:newstuff.c **** if (froot == src || memcmp(dest + 3, "\\DEV\\", 5) == 0) 413:newstuff.c **** { 414:newstuff.c **** /* /// Bugfix: NUL.LST is the same as NUL. This is true for all 415:newstuff.c **** devices. On a device name, the extension is irrelevant 416:newstuff.c **** as long as the name matches. 417:newstuff.c **** - Ron Cemer */ 418:newstuff.c **** dest[2] = '/'; 419:newstuff.c **** result &= ~IS_NETWORK; 420:newstuff.c **** /* /// DOS will return C:/NUL.LST if you pass NUL.LST in. 421:newstuff.c **** DOS will also return C:/NUL.??? if you pass NUL.* in. 422:newstuff.c **** Code added here to support this. 423:newstuff.c **** - Ron Cemer */ 424:newstuff.c **** src = froot; 425:newstuff.c **** } 426:newstuff.c **** } 427:newstuff.c **** } 428:newstuff.c **** 429:newstuff.c **** /* Make fully-qualified logical path */ 430:newstuff.c **** /* register these two used characters and the \0 terminator byte */ 431:newstuff.c **** /* we always append the current dir to stat the drive; 432:newstuff.c **** the only exceptions are devices without paths */ 433:newstuff.c **** rootPos = p = dest + 2; 434:newstuff.c **** if (*p != '/') /* i.e., it's a backslash! */ 435:newstuff.c **** { 436:newstuff.c **** BYTE *cp; 437:newstuff.c **** 438:newstuff.c **** cp = TempCDS.cdsCurrentPath; 439:newstuff.c **** /* ensure termination of strcpy */ 440:newstuff.c **** cp[MAX_CDSPATH - 1] = '\0'; 441:newstuff.c **** if ((TempCDS.cdsFlags & CDSNETWDRV) == 0) 442:newstuff.c **** { 443:newstuff.c **** if (media_check(TempCDS.cdsDpb) < 0) 444:newstuff.c **** return DE_PATHNOTFND; 445:newstuff.c **** 446:newstuff.c **** /* dos_cd ensures that the path exists; if not, we 447:newstuff.c **** need to change to the root directory */ 448:newstuff.c **** if (dos_cd(cp) != SUCCESS) { 449:newstuff.c **** cp[TempCDS.cdsBackslashOffset + 1] = 450:newstuff.c **** cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0'; 451:newstuff.c **** dos_cd(cp); 452:newstuff.c **** } 453:newstuff.c **** } 454:newstuff.c **** 455:newstuff.c **** if (!(mode & CDS_MODE_SKIP_PHYSICAL)) 456:newstuff.c **** { 457:newstuff.c **** tn_printf(("SUBSTing from: %s\n", cp)); 458:newstuff.c **** /* What to do now: the logical drive letter will be replaced by the hidden 459:newstuff.c **** portion of the associated path. This is necessary for NETWORK and 460:newstuff.c **** SUBST drives. For local drives it should not harm. 461:newstuff.c **** This is actually the reverse mechanism of JOINED drives. */ 462:newstuff.c **** 463:newstuff.c **** strcpy(dest, cp); 464:newstuff.c **** if (TempCDS.cdsFlags & CDSSUBST) 465:newstuff.c **** { 466:newstuff.c **** /* The drive had been changed --> update the CDS pointer */ 467:newstuff.c **** if (dest[1] == ':') 468:newstuff.c **** { /* sanity check if this really is a local drive still */ 469:newstuff.c **** unsigned i = drLetterToNr(dest[0]); 470:newstuff.c **** 471:newstuff.c **** /* truename returns the "real", not the "virtual" drive letter! */ 472:newstuff.c **** if (i < lastdrive) /* sanity check #2 */ 473:newstuff.c **** result = (result & 0xffe0) | i; 474:newstuff.c **** } 475:newstuff.c **** } 476:newstuff.c **** rootPos = p = dest + TempCDS.cdsBackslashOffset; 477:newstuff.c **** } 478:newstuff.c **** else 479:newstuff.c **** { 480:newstuff.c **** cp += TempCDS.cdsBackslashOffset; 481:newstuff.c **** /* truename must use the CuDir of the "virtual" drive letter! */ 482:newstuff.c **** /* tn_printf(("DosGetCuDir drive #%u\n", prevresult & 0x1f)); */ 483:newstuff.c **** strcpy(p, cp); 484:newstuff.c **** } 485:newstuff.c **** if (p[0] == '\0') 486:newstuff.c **** p[1] = p[0]; 487:newstuff.c **** p[0] = '\\'; /* force backslash! */ 488:newstuff.c **** 489:newstuff.c **** if (*src != '\\' && *src != '/') 490:newstuff.c **** p += strlen(p); 491:newstuff.c **** else /* skip the absolute path marker */ 492:newstuff.c **** src++; 493:newstuff.c **** /* remove trailing separator */ 494:newstuff.c **** if (p[-1] == '\\') p--; 495:newstuff.c **** } 496:newstuff.c **** 497:newstuff.c **** /* append the path specified in src */ 498:newstuff.c **** 499:newstuff.c **** state = 0; 500:newstuff.c **** while(*src) 501:newstuff.c **** { 502:newstuff.c **** /* New segment. If any wildcards in previous 503:newstuff.c **** segment(s), this is an invalid path. */ 504:newstuff.c **** if (state & PNE_WILDCARD) 505:newstuff.c **** return DE_PATHNOTFND; 506:newstuff.c **** 507:newstuff.c **** /* append backslash if not already there. 508:newstuff.c **** MS DOS preserves a trailing '\\', so an access to "C:\\DOS\\" 509:newstuff.c **** or "CDS.C\\" fails; in that case the last new segment consists of just 510:newstuff.c **** the \ */ 511:newstuff.c **** if (p[-1] != *rootPos) 512:newstuff.c **** addChar(*rootPos); 341 .loc 1 512 0 0 0000AFA0 C746FEFEFF mov word ptr [bp-2], -2 0 0000AFA5 EB44 jmp _.L33 344 _.LVL47: 345 _.L34: 269:newstuff.c **** const char FAR *unc_src = src; 346 .loc 1 269 0 0 0000AFA7 80F95C cmp cl, 92 0 0000AFAA 756D jne _.L36 269:newstuff.c **** const char FAR *unc_src = src; 349 .loc 1 269 0 is_stmt 0 discriminator 1 0 0000AFAC 8EC2 mov es, dx 0 0000AFAE 89C3 mov bx, ax 0 0000AFB0 26807F015C cmp byte ptr es:[bx+1], 92 0 0000AFB5 7562 jne _.L36 0 0000AFB7 C746FE8100 mov word ptr [bp-2], 129 355 _.L41: 356 _.LVL48: 357 _.LBB4: 275:newstuff.c **** addChar(src0); 358 .loc 1 275 0 is_stmt 1 0 0000AFBC 8EC2 mov es, dx 0 0000AFBE 268A0F mov cl, byte ptr es:[bx] 361 _.LVL49: 276:newstuff.c **** unc_src++; 362 .loc 1 276 0 0 0000AFC1 FF4EFE dec word ptr [bp-2] 0 0000AFC4 7536 jne _.L37 276:newstuff.c **** unc_src++; 365 .loc 1 276 0 is_stmt 0 discriminator 1 0 0000AFC6 B92F00 mov cx, 47 367 _.LVL50: 0 0000AFC9 51 push cx 0 0000AFCA 52 push dx 370 _.LVL51: 371 _.L256: 0 0000AFCB 50 push ax 373 _.L253: 0 0000AFCC 16 push ss 0 0000AFCD 1F pop ds 0 0000AFCE E8[FEFF] call _fstrchr 377 _.LVL52: 0 0000AFD1 09D0 or ax, dx 0 0000AFD3 7511 jne _.L38 276:newstuff.c **** unc_src++; 380 .loc 1 276 0 discriminator 3 0 0000AFD5 B85C00 mov ax, 92 0 0000AFD8 50 push ax 0 0000AFD9 FF760A push word ptr [bp+10] 0 0000AFDC FF7608 push word ptr [bp+8] 0 0000AFDF E8[FEFF] call _fstrchr 386 _.LVL53: 0 0000AFE2 09D0 or ax, dx 0 0000AFE4 74BA je _.L92 389 _.L38: 276:newstuff.c **** unc_src++; 390 .loc 1 276 0 0 0000AFE6 C746FEFDFF mov word ptr [bp-2], -3 392 _.L33: 393 _.LBE4: 513:newstuff.c **** /* skip multiple separators (duplicated slashes) */ 514:newstuff.c **** while (*src == '/' || *src == '\\') 515:newstuff.c **** src++; 516:newstuff.c **** 517:newstuff.c **** if(*src == '.') 518:newstuff.c **** { 519:newstuff.c **** int dots = 1; 520:newstuff.c **** /* special directory component */ 521:newstuff.c **** ++src; 522:newstuff.c **** if (*src == '.') /* skip the second dot */ 523:newstuff.c **** { 524:newstuff.c **** ++src; 525:newstuff.c **** dots++; 526:newstuff.c **** } 527:newstuff.c **** if (*src == '/' || *src == '\\' || *src == '\0') 528:newstuff.c **** { 529:newstuff.c **** --p; /* backup the backslash */ 530:newstuff.c **** if (dots == 2) 531:newstuff.c **** { 532:newstuff.c **** /* ".." entry */ 533:newstuff.c **** /* remove last path component */ 534:newstuff.c **** while(*--p != '\\') 535:newstuff.c **** if (p <= rootPos) /* already on root */ 536:newstuff.c **** return DE_PATHNOTFND; 537:newstuff.c **** } 538:newstuff.c **** continue; /* next char */ 539:newstuff.c **** } 540:newstuff.c **** 541:newstuff.c **** /* ill-formed .* or ..* entries => return error */ 542:newstuff.c **** /* The error is either PATHNOTFND or FILENOTFND 543:newstuff.c **** depending on if it is not the last component */ 544:newstuff.c **** return PATH_ERROR(); 545:newstuff.c **** } 546:newstuff.c **** 547:newstuff.c **** /* normal component */ 548:newstuff.c **** /* append component in 8.3 convention */ 549:newstuff.c **** 550:newstuff.c **** /* *** parse name and extension *** */ 551:newstuff.c **** i = FNAME_SIZE; 552:newstuff.c **** state &= ~PNE_DOT; 553:newstuff.c **** while(*src != '/' && *src != '\\' && *src != '\0') 554:newstuff.c **** { 555:newstuff.c **** char c = *src++; 556:newstuff.c **** if (c == '*') 557:newstuff.c **** { 558:newstuff.c **** /* register the wildcard, even if no '?' is appended */ 559:newstuff.c **** c = '?'; 560:newstuff.c **** while (i) 561:newstuff.c **** { 562:newstuff.c **** --i; 563:newstuff.c **** addChar(c); 564:newstuff.c **** } 565:newstuff.c **** /** Alternative implementation: 566:newstuff.c **** if (i) 567:newstuff.c **** { 568:newstuff.c **** if (dest + SFTMAX - *p < i) 569:newstuff.c **** PATH_ERROR; 570:newstuff.c **** fmemset(p, '?', i); 571:newstuff.c **** p += i; 572:newstuff.c **** } **/ 573:newstuff.c **** } 574:newstuff.c **** if (c == '.') 575:newstuff.c **** { 576:newstuff.c **** if (state & PNE_DOT) /* multiple dots are ill-formed */ 577:newstuff.c **** return PATH_ERROR(); 578:newstuff.c **** /* strip trailing dot */ 579:newstuff.c **** if (*src == '/' || *src == '\\' || *src == '\0') 580:newstuff.c **** break; 581:newstuff.c **** /* we arrive here only when an extension-dot has been found */ 582:newstuff.c **** state |= PNE_DOT; 583:newstuff.c **** i = FEXT_SIZE + 1; 584:newstuff.c **** } 585:newstuff.c **** else if (c == '?') 586:newstuff.c **** state |= PNE_WILDCARD; 587:newstuff.c **** if (i) { /* name length in limits */ 588:newstuff.c **** --i; 589:newstuff.c **** if (!DirChar(c)) return PATH_ERROR(); 590:newstuff.c **** addChar(c); 591:newstuff.c **** } 592:newstuff.c **** } 593:newstuff.c **** /* *** end of parse name and extension *** */ 594:newstuff.c **** } 595:newstuff.c **** if (state & PNE_WILDCARD && !(mode & CDS_MODE_ALLOW_WILDCARDS)) 596:newstuff.c **** return DE_PATHNOTFND; 597:newstuff.c **** if (p == dest + 2) 598:newstuff.c **** { 599:newstuff.c **** /* we must always add a seperator if dest = "c:" */ 600:newstuff.c **** addChar('\\'); 601:newstuff.c **** } 602:newstuff.c **** 603:newstuff.c **** *p = '\0'; /* add the string terminator */ 604:newstuff.c **** DosUpFString(rootPos); /* upcase the file/path name */ 605:newstuff.c **** 606:newstuff.c **** /** Note: 607:newstuff.c **** Only the portions passed in by the user are upcased, because it is 608:newstuff.c **** assumed that the CDS is configured correctly and if it contains 609:newstuff.c **** lower case letters, it is required so **/ 610:newstuff.c **** 611:newstuff.c **** tn_printf(("Absolute logical path: \"%s\"\n", dest)); 612:newstuff.c **** 613:newstuff.c **** /* Now, all the steps 1) .. 7) are fullfilled. Join now */ 614:newstuff.c **** /* search, if this path is a joined drive */ 615:newstuff.c **** 616:newstuff.c **** if (dest[2] != '/' && (!(mode & CDS_MODE_SKIP_PHYSICAL)) && njoined) 617:newstuff.c **** { 618:newstuff.c **** struct cds FAR *cdsp = CDSp; 619:newstuff.c **** for(i = 0; i < lastdrive; ++i, ++cdsp) 620:newstuff.c **** { 621:newstuff.c **** /* How many bytes must match */ 622:newstuff.c **** size_t j = fstrlen(cdsp->cdsCurrentPath); 623:newstuff.c **** /* the last component must end before the backslash offset and */ 624:newstuff.c **** /* the path the drive is joined to leads the logical path */ 625:newstuff.c **** if ((cdsp->cdsFlags & CDSJOINED) && (dest[j] == '\\' || dest[j] == '\0') 626:newstuff.c **** && fmemcmp(dest, cdsp->cdsCurrentPath, j) == 0) 627:newstuff.c **** { /* JOINed drive found */ 628:newstuff.c **** dest[0] = drNrToLetter(i); /* index is physical here */ 629:newstuff.c **** dest[1] = ':'; 630:newstuff.c **** if (dest[j] == '\0') 631:newstuff.c **** { /* Reduce to root direc */ 632:newstuff.c **** dest[2] = '\\'; 633:newstuff.c **** dest[3] = 0; 634:newstuff.c **** /* move the relative path right behind the drive letter */ 635:newstuff.c **** } 636:newstuff.c **** else if (j != 2) 637:newstuff.c **** { 638:newstuff.c **** strcpy(dest + 2, dest + j); 639:newstuff.c **** } 640:newstuff.c **** result = (result & 0xffe0) | i; /* tweak drive letter (JOIN) */ 641:newstuff.c **** current_ldt = cdsp; 642:newstuff.c **** result &= ~IS_NETWORK; 643:newstuff.c **** if (cdsp->cdsFlags & CDSNETWDRV) 644:newstuff.c **** result |= IS_NETWORK; 645:newstuff.c **** tn_printf(("JOINed path: \"%s\"\n", dest)); 646:newstuff.c **** return result; 647:newstuff.c **** } 648:newstuff.c **** } 649:newstuff.c **** /* nothing found => continue normally */ 650:newstuff.c **** } 651:newstuff.c **** if ((mode & CDS_MODE_CHECK_DEV_PATH) && 652:newstuff.c **** ((result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) && 653:newstuff.c **** dest[2] != '/' && !dir_exists(dest)) 654:newstuff.c **** return DE_PATHNOTFND; 655:newstuff.c **** 656:newstuff.c **** /* Note: Not reached on error or if JOIN or QRemote_Fn (2f.1123) matched */ 657:newstuff.c **** if (mode==CDS_MODE_ALLOW_WILDCARDS) /* DosTruename mode */ 658:newstuff.c **** { 659:newstuff.c **** /* in other words: result & 0x60 = 0x20...: */ 660:newstuff.c **** if (os_major==6 && (result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) 661:newstuff.c **** result = 0x3a00; /* MS DOS 6.22, according to RBIL: AH=3a if char dev */ 662:newstuff.c **** else 663:newstuff.c **** result = 0; /* AL is 00, 2f, 5c, or last-of-TempCDS.cdsCurrentPath? */ 664:newstuff.c **** } 665:newstuff.c **** tn_printf(("Physical path: \"%s\"\n", dest)); 666:newstuff.c **** return result; 667:newstuff.c **** } 394 .loc 1 667 0 is_stmt 1 0 0000AFEB 8B46FE mov ax, word ptr [bp-2] 0 0000AFEE 89EC mov sp, bp 0 0000AFF0 5D pop bp 0 0000AFF1 5F pop di 0 0000AFF2 5E pop si 0 0000AFF3 16 push ss 0 0000AFF4 1F pop ds 0 0000AFF5 C20800 ret 8 403 _.LVL54: 404 _.L136: 405 _.LBB5: 276:newstuff.c **** unc_src++; 406 .loc 1 276 0 0 0000AFF8 89F7 mov di, si 0 0000AFFA EBC0 jmp _.L41 409 _.LVL55: 410 _.L37: 276:newstuff.c **** unc_src++; 411 .loc 1 276 0 is_stmt 0 discriminator 2 0 0000AFFC 89FE mov si, di 0 0000AFFE 46 inc si 414 _.LVL56: 0 0000AFFF 880D mov byte ptr [di], cl 277:newstuff.c **** } while (src0); 416 .loc 1 277 0 is_stmt 1 discriminator 2 0 0000B001 43 inc bx 418 _.LVL57: 278:newstuff.c **** current_ldt = (struct cds FAR *)MK_FP(0xFFFF,0xFFFF); 419 .loc 1 278 0 discriminator 2 0 0000B002 84C9 test cl, cl 0 0000B004 75F2 jne _.L136 279:newstuff.c **** tn_printf(("Returning path: \"%s\"\n", dest)); 422 .loc 1 279 0 0 0000B006 C706[0000]FFFF mov word ptr [_current_ldt], -1 0 0000B00C C706[0200]FFFF mov word ptr [_current_ldt+2], -1 283:newstuff.c **** } 425 .loc 1 283 0 0 0000B012 C746FE4000 mov word ptr [bp-2], 64 0 0000B017 EBD2 jmp _.L33 428 _.LVL58: 429 _.L36: 430 _.LBE5: 287:newstuff.c **** result = drLetterToNr(DosUpFChar(src0)); 431 .loc 1 287 0 0 0000B019 8EC2 mov es, dx 0 0000B01B 93 xchg bx, ax 0 0000B01C 26807F013A cmp byte ptr es:[bx+1], 58 0 0000B021 7403E94501 jne _.L42 288:newstuff.c **** else 436 .loc 1 288 0 0 0000B026 51 push cx 0 0000B027 E8[FEFF] call _DosUpFChar 439 _.LVL59: 0 0000B02A 04BF add al, -65 0 0000B02C 30E4 xor ah, ah 442 _.L243: 290:newstuff.c **** 443 .loc 1 290 0 0 0000B02E 8946FE mov word ptr [bp-2], ax 445 _.LVL60: 292:newstuff.c **** 446 .loc 1 292 0 0 0000B031 FF760A push word ptr [bp+10] 0 0000B034 FF7608 push word ptr [bp+8] 0 0000B037 E8[FEFF] call _IsDevice 450 _.LVL61: 0 0000B03A 8946F6 mov word ptr [bp-10], ax 0 0000B03D 8956F4 mov word ptr [bp-12], dx 453 _.LVL62: 294:newstuff.c **** if (cdsEntry == NULL) 454 .loc 1 294 0 0 0000B040 FF76FE push word ptr [bp-2] 0 0000B043 E8[FEFF] call _get_cds 457 _.LVL63: 0 0000B046 8946FA mov word ptr [bp-6], ax 0 0000B049 8956F8 mov word ptr [bp-8], dx 460 _.LVL64: 295:newstuff.c **** { 461 .loc 1 295 0 0 0000B04C 92 xchg dx, ax 463 _.LVL65: 0 0000B04D 0B56F8 or dx, word ptr [bp-8] 0 0000B050 7403E99600 jne _.L44 304:newstuff.c **** { 466 .loc 1 304 0 0 0000B055 8B46F6 mov ax, word ptr [bp-10] 468 _.LVL66: 0 0000B058 0B46F4 or ax, word ptr [bp-12] 0 0000B05B 7489 je _.L38 0 0000B05D F6460E02 test byte ptr [bp+14], 2 0 0000B061 7483 je _.L38 304:newstuff.c **** { 473 .loc 1 304 0 is_stmt 0 discriminator 2 0 0000B063 A0[0000] mov al, byte ptr [_lastdrive] 0 0000B066 30E4 xor ah, ah 0 0000B068 3946FE cmp word ptr [bp-2], ax 0 0000B06B 7D03E976FF jl _.L38 478 _.LBB6: 312:newstuff.c **** 479 .loc 1 312 0 is_stmt 1 0 0000B070 C45E08 les bx, dword ptr [bp+8] 0 0000B073 8CC0 mov ax, es 0 0000B075 268A4F02 mov cl, byte ptr es:[bx+2] 483 _.LVL67: 314:newstuff.c **** /* could be 1 letter devicename, don't go scanning random memory */ 484 .loc 1 314 0 0 0000B079 80F95C cmp cl, 92 0 0000B07C 7407 je _.L46 0 0000B07E 80F92F cmp cl, 47 0 0000B081 7402 je _.L46 0 0000B083 88D1 mov cl, dl 490 _.LVL68: 491 _.L46: 316:newstuff.c **** { 492 .loc 1 316 0 0 0000B085 8EC0 mov es, ax 0 0000B087 26807F0300 cmp byte ptr es:[bx+3], 0 0 0000B08C 7503E97906 je _.L48 0 0000B091 884EFC mov byte ptr [bp-4], cl 318:newstuff.c **** if (s == NULL) s = fstrchr(src+3, '/'); 497 .loc 1 318 0 0 0000B094 BE5C00 mov si, 92 0 0000B097 56 push si 0 0000B098 83C303 add bx, 3 0 0000B09B 50 push ax 0 0000B09C 53 push bx 0 0000B09D E8[FEFF] call _fstrchr 504 _.LVL69: 319:newstuff.c **** } 505 .loc 1 319 0 0 0000B0A0 89C3 mov bx, ax 0 0000B0A2 09D3 or bx, dx 0 0000B0A4 85DB test bx, bx 0 0000B0A6 8976FE mov word ptr [bp-2], si 510 _.LVL70: 0 0000B0A9 8A4EFC mov cl, byte ptr [bp-4] 0 0000B0AC 7403E94F06 jne _.L49 319:newstuff.c **** } 513 .loc 1 319 0 is_stmt 0 discriminator 1 0 0000B0B1 B82F00 mov ax, 47 515 _.LVL71: 0 0000B0B4 50 push ax 0 0000B0B5 8B4608 mov ax, word ptr [bp+8] 0 0000B0B8 83C003 add ax, 3 0 0000B0BB FF760A push word ptr [bp+10] 0 0000B0BE 50 push ax 0 0000B0BF E8[FEFF] call _fstrchr 522 _.LVL72: 326:newstuff.c **** { 523 .loc 1 326 0 is_stmt 1 discriminator 1 0 0000B0C2 8A4EFC mov cl, byte ptr [bp-4] 0 0000B0C5 84C9 test cl, cl 0 0000B0C7 7403E9A600 jne _.L50 329:newstuff.c **** } 527 .loc 1 329 0 0 0000B0CC 09D0 or ax, dx 529 _.LVL73: 0 0000B0CE 7403E913FF jne _.L38 531 _.LVL74: 532 _.L53: 345:newstuff.c **** cdsEntry = get_cds(result); 533 .loc 1 345 0 0 0000B0D3 A0[0000] mov al, byte ptr [_default_drive] 0 0000B0D6 98 cbw 0 0000B0D7 8946FE mov word ptr [bp-2], ax 537 _.LVL75: 346:newstuff.c **** if (cdsEntry == NULL) goto invalid_path; 538 .loc 1 346 0 0 0000B0DA 50 push ax 0 0000B0DB E8[FEFF] call _get_cds 541 _.LVL76: 0 0000B0DE 8946FA mov word ptr [bp-6], ax 543 _.LVL77: 0 0000B0E1 8956F8 mov word ptr [bp-8], dx 545 _.LVL78: 347:newstuff.c **** } 546 .loc 1 347 0 0 0000B0E4 09D0 or ax, dx 548 _.LVL79: 0 0000B0E6 7503E9FBFE je _.L38 550 _.LVL80: 551 _.L44: 552 _.LBE6: 356:newstuff.c **** tn_printf(("CDS entry: #%u @%p (%u) '%s'\n", result, cdsEntry, 553 .loc 1 356 0 0 0000B0EB B85800 mov ax, 88 0 0000B0EE 50 push ax 0 0000B0EF FF76F8 push word ptr [bp-8] 0 0000B0F2 FF76FA push word ptr [bp-6] 0 0000B0F5 BE[0000] mov si, offset _TempCDS 0 0000B0F8 16 push ss 0 0000B0F9 56 push si 0 0000B0FA E8[FEFF] call _fmemcpy 562 _.LVL81: 361:newstuff.c **** if (TempCDS.cdsFlags & CDSNETWDRV) 563 .loc 1 361 0 0 0000B0FD 8B46FA mov ax, word ptr [bp-6] 0 0000B100 A3[0000] mov word ptr [_current_ldt], ax 0 0000B103 8B46F8 mov ax, word ptr [bp-8] 0 0000B106 A3[0200] mov word ptr [_current_ldt+2], ax 362:newstuff.c **** result |= IS_NETWORK; 568 .loc 1 362 0 0 0000B109 36837C4300 cmp word ptr ss:[si+67], 0 0 0000B10E 8976FC mov word ptr [bp-4], si 0 0000B111 7D04 jge _.L54 363:newstuff.c **** 572 .loc 1 363 0 0 0000B113 804EFE40 or byte ptr [bp-2], 64 574 _.LVL82: 575 _.L54: 365:newstuff.c **** result |= IS_DEVICE; 576 .loc 1 365 0 0 0000B117 8B46F6 mov ax, word ptr [bp-10] 0 0000B11A 0B46F4 or ax, word ptr [bp-12] 579 _.LVL83: 0 0000B11D 7404 je _.L55 366:newstuff.c **** 581 .loc 1 366 0 0 0000B11F 804EFE20 or byte ptr [bp-2], 32 583 _.LVL84: 584 _.L55: 369:newstuff.c **** included by original truename() */ 585 .loc 1 369 0 0 0000B123 C60500 mov byte ptr [di], 0 372:newstuff.c **** QRemote_Fn(dest, src) == SUCCESS && dest[0] != '\0') 587 .loc 1 372 0 0 0000B126 8B460E mov ax, word ptr [bp+14] 0 0000B129 83E001 and ax, 1 0 0000B12C 8946F4 mov word ptr [bp-12], ax 0 0000B12F 7403E9AE00 jne _.L57 373:newstuff.c **** { 592 .loc 1 373 0 discriminator 1 0 0000B134 8D4608 lea ax, [8+bp] 0 0000B137 50 push ax 0 0000B138 16 push ss 0 0000B139 57 push di 0 0000B13A B82311 mov ax, 4387 0 0000B13D 50 push ax 0 0000B13E E8[FEFF] call _network_redirector_mx 600 _.LVL85: 372:newstuff.c **** QRemote_Fn(dest, src) == SUCCESS && dest[0] != '\0') 601 .loc 1 372 0 discriminator 1 0 0000B141 85C0 test ax, ax 0 0000B143 7403E99A00 jne _.L57 373:newstuff.c **** { 604 .loc 1 373 0 0 0000B148 36803D00 cmp byte ptr ss:[di], 0 0 0000B14C 7503E99100 je _.L57 380:newstuff.c **** result &= ~IS_NETWORK; 607 .loc 1 380 0 0 0000B151 36807D022F cmp byte ptr ss:[di+2], 47 0 0000B156 7403E990FE jne _.L33 380:newstuff.c **** result &= ~IS_NETWORK; 610 .loc 1 380 0 is_stmt 0 discriminator 1 0 0000B15B F646FE20 test byte ptr [bp-2], 32 0 0000B15F 7503E987FE je _.L33 381:newstuff.c **** return result; 613 .loc 1 381 0 is_stmt 1 0 0000B164 8066FEBF and byte ptr [bp-2], -65 615 _.LVL86: 0 0000B168 E980FE jmp _.L33 617 _.LVL87: 618 _.L42: 290:newstuff.c **** 619 .loc 1 290 0 0 0000B16B A0[0000] mov al, byte ptr [_default_drive] 0 0000B16E 98 cbw 0 0000B16F E9BCFE jmp _.L243 623 _.LVL88: 624 _.L50: 625 _.LBB7: 336:newstuff.c **** if (s != src+6) goto invalid_path; 626 .loc 1 336 0 0 0000B172 89C1 mov cx, ax 0 0000B174 09D1 or cx, dx 0 0000B176 7503E96BFE je _.L38 630 _.LVL89: 631 _.L135: 337:newstuff.c **** if (fmemcmp(src+3, "DEV", 3) != 0) goto invalid_path; 632 .loc 1 337 0 0 0000B17B 8B4E08 mov cx, word ptr [bp+8] 0 0000B17E 8B5E0A mov bx, word ptr [bp+10] 0 0000B181 89CE mov si, cx 0 0000B183 83C606 add si, 6 0 0000B186 39F0 cmp ax, si 0 0000B188 7403E959FE jne _.L38 0 0000B18D 39DA cmp dx, bx 0 0000B18F 7403E952FE jne _.L38 338:newstuff.c **** s = fstrchr(src+7, '\\'); 641 .loc 1 338 0 0 0000B194 B80300 mov ax, 3 0 0000B197 50 push ax 0 0000B198 16 push ss 0 0000B199 B8[0000] mov ax, offset _.LC0 0 0000B19C 50 push ax 0 0000B19D 83C103 add cx, 3 0 0000B1A0 52 push dx 0 0000B1A1 51 push cx 0 0000B1A2 E8[FEFF] call _fmemcmp 651 _.LVL90: 0 0000B1A5 85C0 test ax, ax 0 0000B1A7 7403E93AFE jne _.L38 339:newstuff.c **** if (s == NULL) s = fstrchr(src+7, '/'); 654 .loc 1 339 0 0 0000B1AC FF76FE push word ptr [bp-2] 0 0000B1AF 8B4608 mov ax, word ptr [bp+8] 0 0000B1B2 83C007 add ax, 7 0 0000B1B5 FF760A push word ptr [bp+10] 0 0000B1B8 50 push ax 0 0000B1B9 E8[FEFF] call _fstrchr 661 _.LVL91: 340:newstuff.c **** if (s != NULL) goto invalid_path; 662 .loc 1 340 0 0 0000B1BC 09D0 or ax, dx 664 _.LVL92: 0 0000B1BE 85C0 test ax, ax 0 0000B1C0 7403E921FE jne _.L38 340:newstuff.c **** if (s != NULL) goto invalid_path; 667 .loc 1 340 0 is_stmt 0 discriminator 1 0 0000B1C5 B82F00 mov ax, 47 0 0000B1C8 50 push ax 0 0000B1C9 8B4608 mov ax, word ptr [bp+8] 0 0000B1CC 83C007 add ax, 7 0 0000B1CF FF760A push word ptr [bp+10] 0 0000B1D2 50 push ax 0 0000B1D3 E8[FEFF] call _fstrchr 675 _.LVL93: 341:newstuff.c **** } 676 .loc 1 341 0 is_stmt 1 discriminator 1 0 0000B1D6 09D0 or ax, dx 678 _.LVL94: 0 0000B1D8 85C0 test ax, ax 680 _.LVL95: 681 _.L242: 326:newstuff.c **** { 682 .loc 1 326 0 0 0000B1DA 7503E9F4FE je _.L53 0 0000B1DF E904FE jmp _.L38 685 _.LVL96: 686 _.L57: 687 _.LBE7: 386:newstuff.c **** dest[1] = ':'; 688 .loc 1 386 0 0 0000B1E2 8A46FE mov al, byte ptr [bp-2] 0 0000B1E5 241F and al, 31 0 0000B1E7 0441 add al, 65 0 0000B1E9 8805 mov byte ptr [di], al 387:newstuff.c **** 693 .loc 1 387 0 0 0000B1EB C645013A mov byte ptr [di+1], 58 390:newstuff.c **** src += 2; 695 .loc 1 390 0 0 0000B1EF C45E08 les bx, dword ptr [bp+8] 0 0000B1F2 26807F013A cmp byte ptr es:[bx+1], 58 0 0000B1F7 7506 jne _.L58 391:newstuff.c **** 699 .loc 1 391 0 0 0000B1F9 83C302 add bx, 2 0 0000B1FC 895E08 mov word ptr [bp+8], bx 702 _.L58: 399:newstuff.c **** if (result & IS_DEVICE) 703 .loc 1 399 0 0 0000B1FF C645025C mov byte ptr [di+2], 92 400:newstuff.c **** { 705 .loc 1 400 0 0 0000B203 F646FE20 test byte ptr [bp-2], 32 0 0000B207 7503E99200 je _.L59 402:newstuff.c **** if (froot == src || froot == src + 5) 708 .loc 1 402 0 0 0000B20C FF760A push word ptr [bp+10] 0 0000B20F FF7608 push word ptr [bp+8] 0 0000B212 E8[FEFF] call _get_root 712 _.LVL97: 0 0000B215 96 xchg si, ax 714 _.LVL98: 403:newstuff.c **** { 715 .loc 1 403 0 0 0000B216 8B4608 mov ax, word ptr [bp+8] 717 _.LVL99: 0 0000B219 8B4E0A mov cx, word ptr [bp+10] 0 0000B21C 39C6 cmp si, ax 0 0000B21E 7504 jne _.L142 0 0000B220 39CA cmp dx, cx 0 0000B222 740D je _.L60 723 _.L142: 403:newstuff.c **** { 724 .loc 1 403 0 is_stmt 0 discriminator 1 0 0000B224 89C3 mov bx, ax 0 0000B226 83C305 add bx, 5 0 0000B229 39DE cmp si, bx 0 0000B22B 7571 jne _.L59 0 0000B22D 39CA cmp dx, cx 0 0000B22F 756D jne _.L59 731 _.L60: 405:newstuff.c **** { 732 .loc 1 405 0 is_stmt 1 0 0000B231 89C3 mov bx, ax 0 0000B233 83C305 add bx, 5 0 0000B236 39DE cmp si, bx 0 0000B238 7546 jne _.L64 0 0000B23A 39CA cmp dx, cx 0 0000B23C 7542 jne _.L64 407:newstuff.c **** DosUpMem(dest + 3, 5); 739 .loc 1 407 0 0 0000B23E 8D5D03 lea bx, [3+di] 0 0000B241 B90500 mov cx, 5 0 0000B244 51 push cx 0 0000B245 894EEE mov word ptr [bp-18], cx 0 0000B248 52 push dx 0 0000B249 8956F0 mov word ptr [bp-16], dx 0 0000B24C 50 push ax 0 0000B24D 16 push ss 0 0000B24E 53 push bx 0 0000B24F 895EF2 mov word ptr [bp-14], bx 0 0000B252 8C56F6 mov word ptr [bp-10], ss 0 0000B255 E8[FEFF] call _fmemcpy 752 _.LVL100: 408:newstuff.c **** if (dest[3] == '/') dest[3] = '\\'; 753 .loc 1 408 0 0 0000B258 8B4EEE mov cx, word ptr [bp-18] 0 0000B25B 51 push cx 0 0000B25C 8E46F6 mov es, word ptr [bp-10] 0 0000B25F 06 push es 0 0000B260 8B5EF2 mov bx, word ptr [bp-14] 0 0000B263 53 push bx 0 0000B264 E8[FEFF] call _DosUpMem 761 _.LVL101: 409:newstuff.c **** if (dest[7] == '/') dest[7] = '\\'; 762 .loc 1 409 0 0 0000B267 36807D032F cmp byte ptr ss:[di+3], 47 0 0000B26C 8B56F0 mov dx, word ptr [bp-16] 0 0000B26F 7504 jne _.L65 409:newstuff.c **** if (dest[7] == '/') dest[7] = '\\'; 766 .loc 1 409 0 is_stmt 0 discriminator 1 0 0000B271 C645035C mov byte ptr [di+3], 92 768 _.L65: 410:newstuff.c **** } 769 .loc 1 410 0 is_stmt 1 0 0000B275 36807D072F cmp byte ptr ss:[di+7], 47 0 0000B27A 7504 jne _.L64 410:newstuff.c **** } 772 .loc 1 410 0 is_stmt 0 discriminator 1 0 0000B27C C645075C mov byte ptr [di+7], 92 774 _.LVL102: 775 _.L64: 412:newstuff.c **** { 776 .loc 1 412 0 is_stmt 1 0 0000B280 397608 cmp word ptr [bp+8], si 0 0000B283 7403E98701 jne _.L67 0 0000B288 39560A cmp word ptr [bp+10], dx 0 0000B28B 7403E97F01 jne _.L67 781 _.L68: 418:newstuff.c **** result &= ~IS_NETWORK; 782 .loc 1 418 0 0 0000B290 C645022F mov byte ptr [di+2], 47 419:newstuff.c **** /* /// DOS will return C:/NUL.LST if you pass NUL.LST in. 784 .loc 1 419 0 0 0000B294 8066FEBF and byte ptr [bp-2], -65 786 _.LVL103: 424:newstuff.c **** } 787 .loc 1 424 0 0 0000B298 897608 mov word ptr [bp+8], si 0 0000B29B 89560A mov word ptr [bp+10], dx 790 _.L59: 433:newstuff.c **** if (*p != '/') /* i.e., it's a backslash! */ 791 .loc 1 433 0 0 0000B29E 89F8 mov ax, di 0 0000B2A0 83C002 add ax, 2 0 0000B2A3 8946F6 mov word ptr [bp-10], ax 795 _.LVL104: 434:newstuff.c **** { 796 .loc 1 434 0 0 0000B2A6 36807D022F cmp byte ptr ss:[di+2], 47 0 0000B2AB 7503E9A101 je _.L138 799 _.LVL105: 800 _.LBB8: 440:newstuff.c **** if ((TempCDS.cdsFlags & CDSNETWDRV) == 0) 801 .loc 1 440 0 0 0000B2B0 C606[4200]00 mov byte ptr [_TempCDS+66], 0 441:newstuff.c **** { 803 .loc 1 441 0 0 0000B2B5 8B5EFC mov bx, word ptr [bp-4] 0 0000B2B8 36837F4300 cmp word ptr ss:[bx+67], 0 0 0000B2BD 7C3B jl _.L71 443:newstuff.c **** return DE_PATHNOTFND; 807 .loc 1 443 0 0 0000B2BF 36FF36[4700] push word ptr ss:[_TempCDS+71] 0 0000B2C4 36FF36[4500] push word ptr ss:[_TempCDS+69] 0 0000B2C9 E8[FEFF] call _media_check 811 _.LVL106: 0 0000B2CC 85C0 test ax, ax 0 0000B2CE 7D03E913FD jl _.L38 448:newstuff.c **** cp[TempCDS.cdsBackslashOffset + 1] = 814 .loc 1 448 0 0 0000B2D3 FF76FC push word ptr [bp-4] 0 0000B2D6 E8[FEFF] call _dos_cd 817 _.LVL107: 0 0000B2D9 85C0 test ax, ax 0 0000B2DB 741D je _.L71 449:newstuff.c **** cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0'; 820 .loc 1 449 0 0 0000B2DD 8B5EFC mov bx, word ptr [bp-4] 0 0000B2E0 8B474F mov ax, word ptr [bx+79] 450:newstuff.c **** dos_cd(cp); 823 .loc 1 450 0 0 0000B2E3 8E46F8 mov es, word ptr [bp-8] 0 0000B2E6 96 xchg si, ax 0 0000B2E7 8B5EFA mov bx, word ptr [bp-6] 0 0000B2EA 26C6400100 mov byte ptr es:[bx+si+1], 0 828 _.LVL108: 449:newstuff.c **** cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0'; 829 .loc 1 449 0 0 0000B2EF C684[0100]00 mov byte ptr [si+_TempCDS+1], 0 451:newstuff.c **** } 831 .loc 1 451 0 0 0000B2F4 FF76FC push word ptr [bp-4] 0 0000B2F7 E8[FEFF] call _dos_cd 834 _.LVL109: 835 _.L71: 455:newstuff.c **** { 836 .loc 1 455 0 0 0000B2FA 837EF400 cmp word ptr [bp-12], 0 0 0000B2FE 7403E92B01 jne _.L73 463:newstuff.c **** if (TempCDS.cdsFlags & CDSSUBST) 839 .loc 1 463 0 0 0000B303 FF76FC push word ptr [bp-4] 0 0000B306 57 push di 0 0000B307 E8[FEFF] call _strcpy 843 _.LVL110: 464:newstuff.c **** { 844 .loc 1 464 0 0 0000B30A 8B5EFC mov bx, word ptr [bp-4] 0 0000B30D 36F6474410 test byte ptr ss:[bx+68], 16 0 0000B312 7422 je _.L74 467:newstuff.c **** { /* sanity check if this really is a local drive still */ 848 .loc 1 467 0 0 0000B314 36807D013A cmp byte ptr ss:[di+1], 58 0 0000B319 751B jne _.L74 851 _.LBB9: 469:newstuff.c **** 852 .loc 1 469 0 0 0000B31B 8A05 mov al, byte ptr [di] 0 0000B31D 04BF add al, -65 0 0000B31F 30E4 xor ah, ah 856 _.LVL111: 472:newstuff.c **** result = (result & 0xffe0) | i; 857 .loc 1 472 0 0 0000B321 8A16[0000] mov dl, byte ptr [_lastdrive] 0 0000B325 30F6 xor dh, dh 0 0000B327 39D0 cmp ax, dx 0 0000B329 730B jnc _.L74 473:newstuff.c **** } 862 .loc 1 473 0 0 0000B32B 8B56FE mov dx, word ptr [bp-2] 0 0000B32E 83E2E0 and dx, -32 0 0000B331 09C2 or dx, ax 0 0000B333 8956FE mov word ptr [bp-2], dx 867 _.LVL112: 868 _.L74: 869 _.LBE9: 476:newstuff.c **** } 870 .loc 1 476 0 0 0000B336 89F8 mov ax, di 0 0000B338 8B5EFC mov bx, word ptr [bp-4] 0 0000B33B 3603474F add ax, word ptr ss:[bx+79] 874 _.LVL113: 875 _.L244: 876 _.LBE8: 433:newstuff.c **** if (*p != '/') /* i.e., it's a backslash! */ 877 .loc 1 433 0 0 0000B33F 8946FC mov word ptr [bp-4], ax 879 _.LVL114: 880 _.LBB10: 485:newstuff.c **** p[1] = p[0]; 881 .loc 1 485 0 0 0000B342 8B5EFC mov bx, word ptr [bp-4] 0 0000B345 36803F00 cmp byte ptr ss:[bx], 0 0 0000B349 7504 jne _.L76 486:newstuff.c **** p[0] = '\\'; /* force backslash! */ 885 .loc 1 486 0 0 0000B34B C6470100 mov byte ptr [bx+1], 0 887 _.L76: 487:newstuff.c **** 888 .loc 1 487 0 0 0000B34F 8B5EFC mov bx, word ptr [bp-4] 0 0000B352 C6075C mov byte ptr [bx], 92 489:newstuff.c **** p += strlen(p); 891 .loc 1 489 0 0 0000B355 C45E08 les bx, dword ptr [bp+8] 0 0000B358 8CC0 mov ax, es 894 _.LVL115: 0 0000B35A 268A17 mov dl, byte ptr es:[bx] 0 0000B35D 80FA5C cmp dl, 92 0 0000B360 7503E9DF00 je _.L77 0 0000B365 80FA2F cmp dl, 47 0 0000B368 7503E9D700 je _.L77 490:newstuff.c **** else /* skip the absolute path marker */ 900 .loc 1 490 0 0 0000B36D FF76FC push word ptr [bp-4] 0 0000B370 E8[FEFF] call _strlen 903 _.LVL116: 0 0000B373 0346FC add ax, word ptr [bp-4] 0 0000B376 96 xchg si, ax 906 _.LVL117: 907 _.L78: 494:newstuff.c **** } 908 .loc 1 494 0 0 0000B377 36807CFF5C cmp byte ptr ss:[si-1], 92 0 0000B37C 9F lahf 0 0000B37D D0E4 shl ah, 1 0 0000B37F 99 cwd 0 0000B380 01D6 add si, dx 914 _.LVL118: 915 _.L69: 916 _.LBE10: 499:newstuff.c **** while(*src) 917 .loc 1 499 0 0 0000B382 31C9 xor cx, cx 512:newstuff.c **** /* skip multiple separators (duplicated slashes) */ 919 .loc 1 512 0 0 0000B384 89F8 mov ax, di 0 0000B386 83E880 sub ax, -128 0 0000B389 8946F4 mov word ptr [bp-12], ax 923 _.LVL119: 924 _.L79: 500:newstuff.c **** { 925 .loc 1 500 0 0 0000B38C 8E5E08 mov ds, word ptr [bp+8] 0 0000B38F 8B460A mov ax, word ptr [bp+10] 0 0000B392 8EC0 mov es, ax 0 0000B394 8CDB mov bx, ds 0 0000B396 26803F00 cmp byte ptr es:[bx], 0 0 0000B39A 7403E9BC00 jne _.L118 595:newstuff.c **** return DE_PATHNOTFND; 932 .loc 1 595 0 0 0000B39F F6C101 test cl, 1 0 0000B3A2 7409 je _.L119 595:newstuff.c **** return DE_PATHNOTFND; 935 .loc 1 595 0 is_stmt 0 discriminator 1 0 0000B3A4 F6460E04 test byte ptr [bp+14], 4 0 0000B3A8 7503E939FC je _.L38 938 _.L119: 597:newstuff.c **** { 939 .loc 1 597 0 is_stmt 1 0 0000B3AD 3B76F6 cmp si, word ptr [bp-10] 0 0000B3B0 7510 jne _.L120 600:newstuff.c **** } 942 .loc 1 600 0 0 0000B3B2 8D958000 lea dx, [128+di] 0 0000B3B6 39D6 cmp si, dx 0 0000B3B8 7203E9B700 jnc _.L261 946 _.LVL120: 600:newstuff.c **** } 947 .loc 1 600 0 is_stmt 0 discriminator 2 0 0000B3BD 36C6045C mov byte ptr ss:[si], 92 0 0000B3C1 46 inc si 950 _.LVL121: 951 _.L120: 603:newstuff.c **** DosUpFString(rootPos); /* upcase the file/path name */ 952 .loc 1 603 0 is_stmt 1 0 0000B3C2 36C60400 mov byte ptr ss:[si], 0 604:newstuff.c **** 954 .loc 1 604 0 0 0000B3C6 16 push ss 0 0000B3C7 FF76FC push word ptr [bp-4] 0 0000B3CA 16 push ss 0 0000B3CB 1F pop ds 0 0000B3CC E8[FEFF] call _DosUpFString 960 _.LVL122: 616:newstuff.c **** { 961 .loc 1 616 0 0 0000B3CF 36807D022F cmp byte ptr ss:[di+2], 47 0 0000B3D4 7409 je _.L127 0 0000B3D6 F6460E01 test byte ptr [bp+14], 1 0 0000B3DA 7503E92D02 je _.L123 966 _.LVL123: 967 _.L127: 651:newstuff.c **** ((result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) && 968 .loc 1 651 0 0 0000B3DF F6460E02 test byte ptr [bp+14], 2 0 0000B3E3 7403E9EA02 jne _.L125 971 _.L126: 657:newstuff.c **** { 972 .loc 1 657 0 0 0000B3E8 837E0E04 cmp word ptr [bp+14], 4 0 0000B3EC 7403E9FAFB jne _.L33 660:newstuff.c **** result = 0x3a00; /* MS DOS 6.22, according to RBIL: AH=3a if char dev */ 975 .loc 1 660 0 0 0000B3F1 36803E[0000]06 cmp byte ptr ss:[_os_major], 6 0 0000B3F7 750E jne _.L140 660:newstuff.c **** result = 0x3a00; /* MS DOS 6.22, according to RBIL: AH=3a if char dev */ 978 .loc 1 660 0 is_stmt 0 discriminator 1 0 0000B3F9 8A46FE mov al, byte ptr [bp-2] 0 0000B3FC 83E060 and ax, 96 0 0000B3FF 83F820 cmp ax, 32 0 0000B402 7503E9F102 je _.L141 983 _.L140: 663:newstuff.c **** } 984 .loc 1 663 0 is_stmt 1 0 0000B407 C746FE0000 mov word ptr [bp-2], 0 986 _.LVL124: 0 0000B40C E9DCFB jmp _.L33 988 _.LVL125: 989 _.L67: 0 0000B40F 8956F6 mov word ptr [bp-10], dx 412:newstuff.c **** { 991 .loc 1 412 0 discriminator 1 0 0000B412 B80500 mov ax, 5 0 0000B415 50 push ax 0 0000B416 B8[0400] mov ax, offset _.LC1 0 0000B419 50 push ax 0 0000B41A 8D4503 lea ax, [3+di] 0 0000B41D 50 push ax 0 0000B41E E8[FEFF] call _memcmp 999 _.LVL126: 0 0000B421 85C0 test ax, ax 0 0000B423 8B56F6 mov dx, word ptr [bp-10] 0 0000B426 7503E965FE je _.L68 0 0000B42B E970FE jmp _.L59 1004 _.LVL127: 1005 _.L73: 1006 _.LBB11: 480:newstuff.c **** /* truename must use the CuDir of the "virtual" drive letter! */ 1007 .loc 1 480 0 0 0000B42E 8B5EFC mov bx, word ptr [bp-4] 0 0000B431 8B474F mov ax, word ptr [bx+79] 0 0000B434 05[0000] add ax, offset _TempCDS 483:newstuff.c **** } 1011 .loc 1 483 0 0 0000B437 50 push ax 0 0000B438 FF76F6 push word ptr [bp-10] 0 0000B43B E8[FEFF] call _strcpy 1015 _.LVL128: 1016 _.LBE11: 433:newstuff.c **** if (*p != '/') /* i.e., it's a backslash! */ 1017 .loc 1 433 0 0 0000B43E 8B46F6 mov ax, word ptr [bp-10] 0 0000B441 E9FBFE jmp _.L244 1020 _.LVL129: 1021 _.L77: 1022 _.LBB12: 492:newstuff.c **** /* remove trailing separator */ 1023 .loc 1 492 0 0 0000B444 43 inc bx 0 0000B445 895E08 mov word ptr [bp+8], bx 0 0000B448 89460A mov word ptr [bp+10], ax 0 0000B44B 8B76FC mov si, word ptr [bp-4] 0 0000B44E E926FF jmp _.L78 1029 _.LVL130: 1030 _.L138: 1031 _.LBE12: 433:newstuff.c **** if (*p != '/') /* i.e., it's a backslash! */ 1032 .loc 1 433 0 0 0000B451 8B46F6 mov ax, word ptr [bp-10] 1034 _.LVL131: 0 0000B454 8946FC mov word ptr [bp-4], ax 0 0000B457 96 xchg si, ax 0 0000B458 E927FF jmp _.L69 1038 _.LVL132: 1039 _.L118: 504:newstuff.c **** return DE_PATHNOTFND; 1040 .loc 1 504 0 0 0000B45B F6C101 test cl, 1 0 0000B45E 7403E983FB jne _.L38 511:newstuff.c **** addChar(*rootPos); 1043 .loc 1 511 0 0 0000B463 8B5EFC mov bx, word ptr [bp-4] 0 0000B466 368A17 mov dl, byte ptr ss:[bx] 0 0000B469 363854FF cmp byte ptr ss:[si-1], dl 0 0000B46D 7412 je _.L82 512:newstuff.c **** /* skip multiple separators (duplicated slashes) */ 1048 .loc 1 512 0 0 0000B46F 3B76F4 cmp si, word ptr [bp-12] 0 0000B472 7209 jc _.L81 1051 _.L261: 600:newstuff.c **** } 1052 .loc 1 600 0 discriminator 1 0 0000B474 BA2F00 mov dx, 47 0 0000B477 52 push dx 0 0000B478 50 push ax 0 0000B479 1E push ds 0 0000B47A E94FFB jmp _.L253 1058 _.L81: 1059 _.LVL133: 512:newstuff.c **** /* skip multiple separators (duplicated slashes) */ 1060 .loc 1 512 0 discriminator 2 0 0000B47D 368814 mov byte ptr ss:[si], dl 0 0000B480 46 inc si 1063 _.LVL134: 1064 _.L82: 514:newstuff.c **** src++; 1065 .loc 1 514 0 0 0000B481 C45E08 les bx, dword ptr [bp+8] 0 0000B484 8CC2 mov dx, es 0 0000B486 268A07 mov al, byte ptr es:[bx] 0 0000B489 3C2F cmp al, 47 0 0000B48B 7460 je _.L83 0 0000B48D 3C5C cmp al, 92 0 0000B48F 745C je _.L83 517:newstuff.c **** { 1073 .loc 1 517 0 0 0000B491 3C2E cmp al, 46 0 0000B493 7571 jne _.L84 1076 _.LVL135: 1077 _.LBB13: 521:newstuff.c **** if (*src == '.') /* skip the second dot */ 1078 .loc 1 521 0 0 0000B495 8D4701 lea ax, [1+bx] 0 0000B498 894608 mov word ptr [bp+8], ax 522:newstuff.c **** { 1081 .loc 1 522 0 0 0000B49B 26807F012E cmp byte ptr es:[bx+1], 46 0 0000B4A0 7554 jne _.L139 524:newstuff.c **** dots++; 1084 .loc 1 524 0 0 0000B4A2 83C302 add bx, 2 0 0000B4A5 895E08 mov word ptr [bp+8], bx 1087 _.LVL136: 525:newstuff.c **** } 1088 .loc 1 525 0 0 0000B4A8 C746F80200 mov word ptr [bp-8], 2 1090 _.LVL137: 1091 _.L85: 527:newstuff.c **** { 1092 .loc 1 527 0 0 0000B4AD C55E08 lds bx, dword ptr [bp+8] 0 0000B4B0 8A07 mov al, byte ptr [bx] 0 0000B4B2 8846FA mov byte ptr [bp-6], al 0 0000B4B5 3C2F cmp al, 47 0 0000B4B7 9F lahf 0 0000B4B8 D0E4 shl ah, 1 0 0000B4BA 99 cwd 0 0000B4BB F6DA neg dl 0 0000B4BD 3C5C cmp al, 92 0 0000B4BF 9F lahf 0 0000B4C0 D0E4 shl ah, 1 0 0000B4C2 88E0 mov al, ah 0 0000B4C4 98 cbw 0 0000B4C5 F6DC neg ah 0 0000B4C7 08E2 or dl, ah 0 0000B4C9 7506 jne _.L143 0 0000B4CB 807EFA01 cmp byte ptr [bp-6], 1 0 0000B4CF 732C jnc _.L86 1111 _.L143: 529:newstuff.c **** if (dots == 2) 1112 .loc 1 529 0 0 0000B4D1 4E dec si 1114 _.LVL138: 530:newstuff.c **** { 1115 .loc 1 530 0 0 0000B4D2 837EF802 cmp word ptr [bp-8], 2 0 0000B4D6 7403E9B1FE jne _.L79 1118 _.L90: 534:newstuff.c **** if (p <= rootPos) /* already on root */ 1119 .loc 1 534 0 0 0000B4DB 4E dec si 1121 _.LVL139: 0 0000B4DC 36803C5C cmp byte ptr ss:[si], 92 0 0000B4E0 7503E9A7FE je _.L79 535:newstuff.c **** return DE_PATHNOTFND; 1124 .loc 1 535 0 0 0000B4E5 3976FC cmp word ptr [bp-4], si 0 0000B4E8 72F1 jc _.L90 0 0000B4EA E9F9FA jmp _.L38 1128 _.LVL140: 1129 _.L83: 1130 _.LBE13: 515:newstuff.c **** 1131 .loc 1 515 0 0 0000B4ED 43 inc bx 0 0000B4EE 895E08 mov word ptr [bp+8], bx 0 0000B4F1 89560A mov word ptr [bp+10], dx 0 0000B4F4 EB8B jmp _.L82 1136 _.LVL141: 1137 _.L139: 1138 _.LBB14: 519:newstuff.c **** /* special directory component */ 1139 .loc 1 519 0 0 0000B4F6 C746F80100 mov word ptr [bp-8], 1 0 0000B4FB EBB0 jmp _.L85 1142 _.LVL142: 1143 _.L86: 544:newstuff.c **** } 1144 .loc 1 544 0 0 0000B4FD B82F00 mov ax, 47 0 0000B500 50 push ax 0 0000B501 1E push ds 0 0000B502 53 push bx 0 0000B503 E9C6FA jmp _.L253 1150 _.LVL143: 1151 _.L84: 1152 _.LBE14: 552:newstuff.c **** while(*src != '/' && *src != '\\' && *src != '\0') 1153 .loc 1 552 0 0 0000B506 83E1FD and cx, -3 1155 _.LVL144: 551:newstuff.c **** state &= ~PNE_DOT; 1156 .loc 1 551 0 0 0000B509 C746FA0800 mov word ptr [bp-6], 8 1158 _.LVL145: 1159 _.L94: 553:newstuff.c **** { 1160 .loc 1 553 0 0 0000B50E C55E08 lds bx, dword ptr [bp+8] 0 0000B511 8A07 mov al, byte ptr [bx] 0 0000B513 88C4 mov ah, al 0 0000B515 80F42F xor ah, 47 0 0000B518 80FC01 cmp ah, 1 0 0000B51B 18D2 sbb dl, dl 0 0000B51D FEC2 inc dl 0 0000B51F 88C4 mov ah, al 0 0000B521 80F45C xor ah, 92 0 0000B524 80FC01 cmp ah, 1 0 0000B527 18E4 sbb ah, ah 0 0000B529 FEC4 inc ah 0 0000B52B 84E2 test dl, ah 0 0000B52D 7503E95AFE je _.L79 0 0000B532 84C0 test al, al 0 0000B534 7503E953FE je _.L79 1177 _.LBB15: 555:newstuff.c **** if (c == '*') 1178 .loc 1 555 0 0 0000B539 8D4701 lea ax, [1+bx] 0 0000B53C 894608 mov word ptr [bp+8], ax 0 0000B53F 8C5E0A mov word ptr [bp+10], ds 0 0000B542 8A17 mov dl, byte ptr [bx] 0 0000B544 8856F8 mov byte ptr [bp-8], dl 1184 _.LVL146: 556:newstuff.c **** { 1185 .loc 1 556 0 0 0000B547 80FA2A cmp dl, 42 0 0000B54A 755C jne _.L95 0 0000B54C 89F3 mov bx, si 0 0000B54E 8B56FA mov dx, word ptr [bp-6] 1190 _.LVL147: 0 0000B551 01F2 add dx, si 1192 _.LVL148: 1193 _.L96: 0 0000B553 89DE mov si, bx 1195 _.LVL149: 560:newstuff.c **** { 1196 .loc 1 560 0 0 0000B555 39D3 cmp bx, dx 0 0000B557 753B jne _.L99 1199 _.LVL150: 0 0000B559 C746FA0000 mov word ptr [bp-6], 0 1201 _.LVL151: 1202 _.L100: 586:newstuff.c **** if (i) { /* name length in limits */ 1203 .loc 1 586 0 0 0000B55E 83C901 or cx, 1 1205 _.LVL152: 587:newstuff.c **** --i; 1206 .loc 1 587 0 0 0000B561 837EFA00 cmp word ptr [bp-6], 0 0 0000B565 74A7 je _.L94 1209 _.LVL153: 588:newstuff.c **** if (!DirChar(c)) return PATH_ERROR(); 1210 .loc 1 588 0 0 0000B567 FF4EFA dec word ptr [bp-6] 1212 _.LVL154: 0 0000B56A C646F83F mov byte ptr [bp-8], 63 1214 _.LVL155: 1215 _.L108: 0 0000B56E 894EF2 mov word ptr [bp-14], cx 1217 _.LVL156: 589:newstuff.c **** addChar(c); 1218 .loc 1 589 0 discriminator 2 0 0000B571 8A46F8 mov al, byte ptr [bp-8] 0 0000B574 98 cbw 0 0000B575 50 push ax 0 0000B576 B8[0000] mov ax, offset __DirChars 0 0000B579 50 push ax 0 0000B57A 16 push ss 0 0000B57B 1F pop ds 0 0000B57C E8[FEFF] call _strchr 1227 _.LVL157: 0 0000B57F 85C0 test ax, ax 0 0000B581 8B4EF2 mov cx, word ptr [bp-14] 0 0000B584 7565 jne _.L262 590:newstuff.c **** } 1231 .loc 1 590 0 0 0000B586 3B76F4 cmp si, word ptr [bp-12] 0 0000B589 7360 jnc _.L262 1234 _.LVL158: 590:newstuff.c **** } 1235 .loc 1 590 0 is_stmt 0 discriminator 2 0 0000B58B 8A46F8 mov al, byte ptr [bp-8] 0 0000B58E 8804 mov byte ptr [si], al 0 0000B590 46 inc si 1239 _.LVL159: 0 0000B591 E97AFF jmp _.L94 1241 _.LVL160: 1242 _.L99: 563:newstuff.c **** } 1243 .loc 1 563 0 is_stmt 1 0 0000B594 3B5EF4 cmp bx, word ptr [bp-12] 0 0000B597 7208 jc _.L97 1246 _.LVL161: 1247 _.L260: 577:newstuff.c **** /* strip trailing dot */ 1248 .loc 1 577 0 0 0000B599 BA2F00 mov dx, 47 0 0000B59C 52 push dx 0 0000B59D 1E push ds 0 0000B59E E92AFA jmp _.L256 1253 _.LVL162: 1254 _.L97: 563:newstuff.c **** } 1255 .loc 1 563 0 discriminator 2 0 0000B5A1 36C6073F mov byte ptr ss:[bx], 63 0 0000B5A5 43 inc bx 1258 _.LVL163: 0 0000B5A6 EBAB jmp _.L96 1260 _.LVL164: 1261 _.L95: 574:newstuff.c **** { 1262 .loc 1 574 0 0 0000B5A8 807EF82E cmp byte ptr [bp-8], 46 0 0000B5AC 754A jne _.L101 576:newstuff.c **** return PATH_ERROR(); 1265 .loc 1 576 0 0 0000B5AE F6C102 test cl, 2 0 0000B5B1 75E6 jne _.L260 579:newstuff.c **** break; 1268 .loc 1 579 0 0 0000B5B3 8A4701 mov al, byte ptr [bx+1] 0 0000B5B6 3C2F cmp al, 47 0 0000B5B8 9F lahf 0 0000B5B9 D0E4 shl ah, 1 0 0000B5BB 99 cwd 0 0000B5BC 88D4 mov ah, dl 0 0000B5BE F6DC neg ah 0 0000B5C0 88E3 mov bl, ah 0 0000B5C2 3C5C cmp al, 92 0 0000B5C4 9F lahf 0 0000B5C5 D0E4 shl ah, 1 0 0000B5C7 99 cwd 0 0000B5C8 F6DA neg dl 0 0000B5CA 88DC mov ah, bl 0 0000B5CC 08D4 or ah, dl 0 0000B5CE 7403E9B9FD jne _.L79 0 0000B5D3 84C0 test al, al 0 0000B5D5 7503E9B2FD je _.L79 582:newstuff.c **** i = FEXT_SIZE + 1; 1287 .loc 1 582 0 0 0000B5DA 83C902 or cx, 2 1289 _.LVL165: 583:newstuff.c **** } 1290 .loc 1 583 0 0 0000B5DD C746FA0400 mov word ptr [bp-6], 4 1292 _.LVL166: 1293 _.L104: 588:newstuff.c **** if (!DirChar(c)) return PATH_ERROR(); 1294 .loc 1 588 0 0 0000B5E2 FF4EFA dec word ptr [bp-6] 1296 _.LVL167: 589:newstuff.c **** addChar(c); 1297 .loc 1 589 0 0 0000B5E5 807EF81F cmp byte ptr [bp-8], 31 0 0000B5E9 7783 ja _.L108 1300 _.LVL168: 1301 _.L262: 590:newstuff.c **** } 1302 .loc 1 590 0 discriminator 1 0 0000B5EB B82F00 mov ax, 47 0 0000B5EE 50 push ax 0 0000B5EF FF760A push word ptr [bp+10] 0 0000B5F2 FF7608 push word ptr [bp+8] 0 0000B5F5 E9D4F9 jmp _.L253 1308 _.LVL169: 1309 _.L101: 585:newstuff.c **** state |= PNE_WILDCARD; 1310 .loc 1 585 0 0 0000B5F8 807EF83F cmp byte ptr [bp-8], 63 0 0000B5FC 7503E95DFF je _.L100 587:newstuff.c **** --i; 1313 .loc 1 587 0 0 0000B601 837EFA00 cmp word ptr [bp-6], 0 0 0000B605 7503E904FF je _.L94 0 0000B60A EBD6 jmp _.L104 1317 _.LVL170: 1318 _.L123: 1319 _.LBE15: 616:newstuff.c **** { 1320 .loc 1 616 0 discriminator 2 0 0000B60C 36803E[0000]00 cmp byte ptr ss:[_njoined], 0 0 0000B612 7503E9C8FD je _.L127 1323 _.LBB16: 618:newstuff.c **** for(i = 0; i < lastdrive; ++i, ++cdsp) 1324 .loc 1 618 0 0 0000B617 8B36[0000] mov si, word ptr [_CDSp] 1326 _.LVL171: 0 0000B61B A1[0200] mov ax, word ptr [_CDSp+2] 0 0000B61E 8946FC mov word ptr [bp-4], ax 1329 _.LVL172: 619:newstuff.c **** { 1330 .loc 1 619 0 0 0000B621 C746FA0000 mov word ptr [bp-6], 0 1332 _.LVL173: 1333 _.L128: 619:newstuff.c **** { 1334 .loc 1 619 0 is_stmt 0 discriminator 1 0 0000B626 A0[0000] mov al, byte ptr [_lastdrive] 0 0000B629 30E4 xor ah, ah 0 0000B62B 3946FA cmp word ptr [bp-6], ax 0 0000B62E 7C03E9ACFD jge _.L127 1339 _.LBB17: 622:newstuff.c **** /* the last component must end before the backslash offset and */ 1340 .loc 1 622 0 is_stmt 1 0 0000B633 FF76FC push word ptr [bp-4] 0 0000B636 56 push si 0 0000B637 E8[FEFF] call _fstrlen 1344 _.LVL174: 0 0000B63A 89C1 mov cx, ax 1346 _.LVL175: 625:newstuff.c **** && fmemcmp(dest, cdsp->cdsCurrentPath, j) == 0) 1347 .loc 1 625 0 0 0000B63C 8E46FC mov es, word ptr [bp-4] 0 0000B63F 26F6444420 test byte ptr es:[si+68], 32 0 0000B644 7503E98000 je _.L129 625:newstuff.c **** && fmemcmp(dest, cdsp->cdsCurrentPath, j) == 0) 1351 .loc 1 625 0 is_stmt 0 discriminator 1 0 0000B649 89F8 mov ax, di 0 0000B64B 01C8 add ax, cx 0 0000B64D 8946F8 mov word ptr [bp-8], ax 0 0000B650 89CB mov bx, cx 0 0000B652 8A01 mov al, byte ptr [bx+di] 0 0000B654 3C5C cmp al, 92 0 0000B656 7404 je _.L144 0 0000B658 84C0 test al, al 0 0000B65A 756D jne _.L129 1361 _.L144: 626:newstuff.c **** { /* JOINed drive found */ 1362 .loc 1 626 0 is_stmt 1 0 0000B65C 51 push cx 0 0000B65D 894EF4 mov word ptr [bp-12], cx 0 0000B660 FF76FC push word ptr [bp-4] 0 0000B663 56 push si 0 0000B664 16 push ss 0 0000B665 57 push di 0 0000B666 E8[FEFF] call _fmemcmp 1370 _.LVL176: 0 0000B669 85C0 test ax, ax 0 0000B66B 8B4EF4 mov cx, word ptr [bp-12] 0 0000B66E 7559 jne _.L129 628:newstuff.c **** dest[1] = ':'; 1374 .loc 1 628 0 0 0000B670 8A56FA mov dl, byte ptr [bp-6] 0 0000B673 80C241 add dl, 65 0 0000B676 8815 mov byte ptr [di], dl 629:newstuff.c **** if (dest[j] == '\0') 1378 .loc 1 629 0 0 0000B678 C645013A mov byte ptr [di+1], 58 630:newstuff.c **** { /* Reduce to root direc */ 1380 .loc 1 630 0 0 0000B67C 8B5EF8 mov bx, word ptr [bp-8] 0 0000B67F 36803F00 cmp byte ptr ss:[bx], 0 0 0000B683 7534 jne _.L131 632:newstuff.c **** dest[3] = 0; 1384 .loc 1 632 0 0 0000B685 C645025C mov byte ptr [di+2], 92 633:newstuff.c **** /* move the relative path right behind the drive letter */ 1386 .loc 1 633 0 0 0000B689 884503 mov byte ptr [di+3], al 1388 _.L132: 640:newstuff.c **** current_ldt = cdsp; 1389 .loc 1 640 0 0 0000B68C 8B46FE mov ax, word ptr [bp-2] 0 0000B68F 83E0E0 and ax, -32 0 0000B692 0B46FA or ax, word ptr [bp-6] 1393 _.LVL177: 641:newstuff.c **** result &= ~IS_NETWORK; 1394 .loc 1 641 0 0 0000B695 8936[0000] mov word ptr [_current_ldt], si 0 0000B699 8B56FC mov dx, word ptr [bp-4] 0 0000B69C 8916[0200] mov word ptr [_current_ldt+2], dx 642:newstuff.c **** if (cdsp->cdsFlags & CDSNETWDRV) 1398 .loc 1 642 0 0 0000B6A0 83E0BF and ax, -65 1400 _.LVL178: 0 0000B6A3 8946FE mov word ptr [bp-2], ax 1402 _.LVL179: 643:newstuff.c **** result |= IS_NETWORK; 1403 .loc 1 643 0 0 0000B6A6 8EC2 mov es, dx 0 0000B6A8 26837C4300 cmp word ptr es:[si+67], 0 0 0000B6AD 7C03E939F9 jge _.L33 644:newstuff.c **** tn_printf(("JOINed path: \"%s\"\n", dest)); 1407 .loc 1 644 0 0 0000B6B2 804EFE40 or byte ptr [bp-2], 64 1409 _.LVL180: 0 0000B6B6 E932F9 jmp _.L33 1411 _.L131: 636:newstuff.c **** { 1412 .loc 1 636 0 0 0000B6B9 83F902 cmp cx, 2 0 0000B6BC 74CE je _.L132 638:newstuff.c **** } 1415 .loc 1 638 0 0 0000B6BE FF76F8 push word ptr [bp-8] 0 0000B6C1 FF76F6 push word ptr [bp-10] 0 0000B6C4 E8[FEFF] call _strcpy 1419 _.LVL181: 0 0000B6C7 EBC3 jmp _.L132 1421 _.LVL182: 1422 _.L129: 1423 _.LBE17: 619:newstuff.c **** { 1424 .loc 1 619 0 0 0000B6C9 FF46FA inc word ptr [bp-6] 1426 _.LVL183: 0 0000B6CC 83C658 add si, 88 1428 _.LVL184: 0 0000B6CF E954FF jmp _.L128 1430 _.LVL185: 1431 _.L125: 1432 _.LBE16: 652:newstuff.c **** dest[2] != '/' && !dir_exists(dest)) 1433 .loc 1 652 0 discriminator 1 0 0000B6D2 8A46FE mov al, byte ptr [bp-2] 0 0000B6D5 83E060 and ax, 96 651:newstuff.c **** ((result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) && 1436 .loc 1 651 0 discriminator 1 0 0000B6D8 83F820 cmp ax, 32 0 0000B6DB 7403E908FD jne _.L126 652:newstuff.c **** dest[2] != '/' && !dir_exists(dest)) 1439 .loc 1 652 0 0 0000B6E0 36807D022F cmp byte ptr ss:[di+2], 47 0 0000B6E5 7503E9FEFC je _.L126 653:newstuff.c **** return DE_PATHNOTFND; 1442 .loc 1 653 0 0 0000B6EA 57 push di 0 0000B6EB E8[FEFF] call _dir_exists 1445 _.LVL186: 0 0000B6EE 85C0 test ax, ax 0 0000B6F0 7403E9F3FC jne _.L126 0 0000B6F5 E9EEF8 jmp _.L38 1449 _.L141: 661:newstuff.c **** else 1450 .loc 1 661 0 0 0000B6F8 C746FE003A mov word ptr [bp-2], 14848 1452 _.LVL187: 0 0000B6FD E9EBF8 jmp _.L33 1454 _.LVL188: 1455 _.L49: 1456 _.LBB18: 326:newstuff.c **** { 1457 .loc 1 326 0 0 0000B700 84C9 test cl, cl 0 0000B702 7403E974FA jne _.L135 0 0000B707 E9DCF8 jmp _.L38 1461 _.LVL189: 1462 _.L48: 0 0000B70A 84C9 test cl, cl 0 0000B70C E9CBFA jmp _.L242 1465 _.LBE18: 1466 _.LFE6: 1467 .size _truename, .-_truename === Switch to base=012BB0h -> ".RODATA" 1468 .section .rodata 1469 .type __DirChars, @object 1470 .size __DirChars, 12 1471 __DirChars: 0 00001878 225B5D3A7C3C3E2B .string "\"[]:|<>+=;," 0 00001880 3D3B2C00 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: nls_hc.lst 1 ; Hardcoded DOS-NLS information for country = 1, codepage = 437 2 ; This is an automatically generated file! 3 ; Any modifications will be lost! 4 5 ; Prerequisites: 6 ;; ==> Assuming that data of tables remains constant all the time 7 ;; ==> Reordering tables 1, 2, 4 and 5 8 9 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif === Switch to base=000790h -> "CONST2" 10 segment CONST2 11 12 GLOBAL _nlsPackageHardcoded 13 _nlsPackageHardcoded: 0 00001390 000000000100B501 DB 000h, 000h, 000h, 000h, 001h, 000h, 0b5h, 001h 0 00001398 0F0059004E000600 DB 00fh, 000h, 059h, 000h, 04eh, 000h, 006h, 000h 0 000013A0 02 DB 002h 0 000013A1 [4800][0000] DW ?table2, DGROUP 0 000013A5 04 DB 004h 0 000013A6 [CA00][0000] DW ?table4, DGROUP 0 000013AA 05 DB 005h 0 000013AB [4C01][0000] DW ?table5, DGROUP 0 000013AF 06 DB 006h 0 000013B0 [6401][0000] DW ?table6, DGROUP 0 000013B4 07 DB 007h 0 000013B5 [6602][0000] DW ?table7, DGROUP 26 GLOBAL _nlsCountryInfoHardcoded 27 _nlsCountryInfoHardcoded: 0 000013B9 01 DB 001h 29 GLOBAL _nlsCntryInfoHardcoded 30 _nlsCntryInfoHardcoded: 31 ?table1: 0 000013BA 1C000100B5010000 DB 01ch, 000h, 001h, 000h, 0b5h, 001h, 000h, 000h 0 000013C2 24000000002C002E DB 024h, 000h, 000h, 000h, 000h, 02ch, 000h, 02eh 0 000013CA 002D003A00000200 DB 000h, 02dh, 000h, 03ah, 000h, 000h, 002h, 000h 35 extern _CharMapSrvc 0 000013D2 [0000][0000] DW _CharMapSrvc, DGROUP 0 000013D6 2C00 DB 02ch, 000h 38 GLOBAL _hcTablesStart 39 _hcTablesStart: 40 GLOBAL _nlsUpcaseHardcoded 41 _nlsUpcaseHardcoded: 42 ?table2: 0 000013D8 8000809A45418E41 DB 080h, 000h, 080h, 09ah, 045h, 041h, 08eh, 041h 0 000013E0 8F80454545494949 DB 08fh, 080h, 045h, 045h, 045h, 049h, 049h, 049h 0 000013E8 8E8F9092924F994F DB 08eh, 08fh, 090h, 092h, 092h, 04fh, 099h, 04fh 0 000013F0 555559999A9B9C9D DB 055h, 055h, 059h, 099h, 09ah, 09bh, 09ch, 09dh 0 000013F8 9E9F41494F55A5A5 DB 09eh, 09fh, 041h, 049h, 04fh, 055h, 0a5h, 0a5h 0 00001400 A6A7A8A9AAABACAD DB 0a6h, 0a7h, 0a8h, 0a9h, 0aah, 0abh, 0ach, 0adh 0 00001408 AEAFB0B1B2B3B4B5 DB 0aeh, 0afh, 0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h 0 00001410 B6B7B8B9BABBBCBD DB 0b6h, 0b7h, 0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh 0 00001418 BEBFC0C1C2C3C4C5 DB 0beh, 0bfh, 0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h 0 00001420 C6C7C8C9CACBCCCD DB 0c6h, 0c7h, 0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh 0 00001428 CECFD0D1D2D3D4D5 DB 0ceh, 0cfh, 0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h 0 00001430 D6D7D8D9DADBDCDD DB 0d6h, 0d7h, 0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh 0 00001438 DEDFE0E1E2E3E4E5 DB 0deh, 0dfh, 0e0h, 0e1h, 0e2h, 0e3h, 0e4h, 0e5h 0 00001440 E6E7E8E9EAEBECED DB 0e6h, 0e7h, 0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh 0 00001448 EEEFF0F1F2F3F4F5 DB 0eeh, 0efh, 0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h 0 00001450 F6F7F8F9FAFBFCFD DB 0f6h, 0f7h, 0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh 0 00001458 FEFF DB 0feh, 0ffh 60 GLOBAL _nlsFUpcaseHardcoded 61 _nlsFUpcaseHardcoded: 62 ?table4: 0 0000145A 8000809A45418E41 DB 080h, 000h, 080h, 09ah, 045h, 041h, 08eh, 041h 0 00001462 8F80454545494949 DB 08fh, 080h, 045h, 045h, 045h, 049h, 049h, 049h 0 0000146A 8E8F9092924F994F DB 08eh, 08fh, 090h, 092h, 092h, 04fh, 099h, 04fh 0 00001472 555559999A9B9C9D DB 055h, 055h, 059h, 099h, 09ah, 09bh, 09ch, 09dh 0 0000147A 9E9F41494F55A5A5 DB 09eh, 09fh, 041h, 049h, 04fh, 055h, 0a5h, 0a5h 0 00001482 A6A7A8A9AAABACAD DB 0a6h, 0a7h, 0a8h, 0a9h, 0aah, 0abh, 0ach, 0adh 0 0000148A AEAFB0B1B2B3B4B5 DB 0aeh, 0afh, 0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h 0 00001492 B6B7B8B9BABBBCBD DB 0b6h, 0b7h, 0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh 0 0000149A BEBFC0C1C2C3C4C5 DB 0beh, 0bfh, 0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h 0 000014A2 C6C7C8C9CACBCCCD DB 0c6h, 0c7h, 0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh 0 000014AA CECFD0D1D2D3D4D5 DB 0ceh, 0cfh, 0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h 0 000014B2 D6D7D8D9DADBDCDD DB 0d6h, 0d7h, 0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh 0 000014BA DEDFE0E1E2E3E4E5 DB 0deh, 0dfh, 0e0h, 0e1h, 0e2h, 0e3h, 0e4h, 0e5h 0 000014C2 E6E7E8E9EAEBECED DB 0e6h, 0e7h, 0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh 0 000014CA EEEFF0F1F2F3F4F5 DB 0eeh, 0efh, 0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h 0 000014D2 F6F7F8F9FAFBFCFD DB 0f6h, 0f7h, 0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh 0 000014DA FEFF DB 0feh, 0ffh 80 GLOBAL _nlsFnameTermHardcoded 81 _nlsFnameTermHardcoded: 82 ?table5: 0 000014DC 16008E00FF410020 DB 016h, 000h, 08eh, 000h, 0ffh, 041h, 000h, 020h 0 000014E4 EE0E2E222F5C5B5D DB 0eeh, 00eh, 02eh, 022h, 02fh, 05ch, 05bh, 05dh 0 000014EC 3A7C3C3E2B3D3B2C DB 03ah, 07ch, 03ch, 03eh, 02bh, 03dh, 03bh, 02ch 86 GLOBAL _nlsCollHardcoded 87 _nlsCollHardcoded: 88 ?table6: 0 000014F4 0001000102030405 DB 000h, 001h, 000h, 001h, 002h, 003h, 004h, 005h 0 000014FC 060708090A0B0C0D DB 006h, 007h, 008h, 009h, 00ah, 00bh, 00ch, 00dh 0 00001504 0E0F101112131415 DB 00eh, 00fh, 010h, 011h, 012h, 013h, 014h, 015h 0 0000150C 161718191A1B1C1D DB 016h, 017h, 018h, 019h, 01ah, 01bh, 01ch, 01dh 0 00001514 1E1F202122232425 DB 01eh, 01fh, 020h, 021h, 022h, 023h, 024h, 025h 0 0000151C 262728292A2B2C2D DB 026h, 027h, 028h, 029h, 02ah, 02bh, 02ch, 02dh 0 00001524 2E2F303132333435 DB 02eh, 02fh, 030h, 031h, 032h, 033h, 034h, 035h 0 0000152C 363738393A3B3C3D DB 036h, 037h, 038h, 039h, 03ah, 03bh, 03ch, 03dh 0 00001534 3E3F404142434445 DB 03eh, 03fh, 040h, 041h, 042h, 043h, 044h, 045h 0 0000153C 464748494A4B4C4D DB 046h, 047h, 048h, 049h, 04ah, 04bh, 04ch, 04dh 0 00001544 4E4F505152535455 DB 04eh, 04fh, 050h, 051h, 052h, 053h, 054h, 055h 0 0000154C 565758595A5B5C5D DB 056h, 057h, 058h, 059h, 05ah, 05bh, 05ch, 05dh 0 00001554 5E5F604142434445 DB 05eh, 05fh, 060h, 041h, 042h, 043h, 044h, 045h 0 0000155C 464748494A4B4C4D DB 046h, 047h, 048h, 049h, 04ah, 04bh, 04ch, 04dh 0 00001564 4E4F505152535455 DB 04eh, 04fh, 050h, 051h, 052h, 053h, 054h, 055h 0 0000156C 565758595A7B7C7D DB 056h, 057h, 058h, 059h, 05ah, 07bh, 07ch, 07dh 0 00001574 7E7F435545414141 DB 07eh, 07fh, 043h, 055h, 045h, 041h, 041h, 041h 0 0000157C 4143454545494949 DB 041h, 043h, 045h, 045h, 045h, 049h, 049h, 049h 0 00001584 41414541414F4F4F DB 041h, 041h, 045h, 041h, 041h, 04fh, 04fh, 04fh 0 0000158C 5555594F55242424 DB 055h, 055h, 059h, 04fh, 055h, 024h, 024h, 024h 0 00001594 242441494F554E4E DB 024h, 024h, 041h, 049h, 04fh, 055h, 04eh, 04eh 0 0000159C A6A73FA9AAABAC21 DB 0a6h, 0a7h, 03fh, 0a9h, 0aah, 0abh, 0ach, 021h 0 000015A4 2222B0B1B2B3B4B5 DB 022h, 022h, 0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h 0 000015AC B6B7B8B9BABBBCBD DB 0b6h, 0b7h, 0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh 0 000015B4 BEBFC0C1C2C3C4C5 DB 0beh, 0bfh, 0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h 0 000015BC C6C7C8C9CACBCCCD DB 0c6h, 0c7h, 0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh 0 000015C4 CECFD0D1D2D3D4D5 DB 0ceh, 0cfh, 0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h 0 000015CC D6D7D8D9DADBDCDD DB 0d6h, 0d7h, 0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh 0 000015D4 DEDFE053E2E3E4E5 DB 0deh, 0dfh, 0e0h, 053h, 0e2h, 0e3h, 0e4h, 0e5h 0 000015DC E6E7E8E9EAEBECED DB 0e6h, 0e7h, 0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh 0 000015E4 EEEFF0F1F2F3F4F5 DB 0eeh, 0efh, 0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h 0 000015EC F6F7F8F9FAFBFCFD DB 0f6h, 0f7h, 0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh 0 000015F4 FEFF DB 0feh, 0ffh 122 GLOBAL _nlsDBCSHardcoded 123 _nlsDBCSHardcoded: 124 ?table7: 0 000015F6 0000000000000000 DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 0 000015FE 0000 DB 000h, 000h 127 GLOBAL _hcTablesEnd 128 _hcTablesEnd: === Trace listing source: nls.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=nls.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccBuErIX.s output file : nls.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _searchPackage, @function 8 _searchPackage: 9 _.LFB7: 10 .file 1 "nls.c" 1:nls.c **** /****************************************************************/ 2:nls.c **** /* */ 3:nls.c **** /* nls.c */ 4:nls.c **** /* FreeDOS */ 5:nls.c **** /* */ 6:nls.c **** /* National Languge Support functions and data structures */ 7:nls.c **** /* */ 8:nls.c **** /* Copyright (c) 2000 */ 9:nls.c **** /* Steffen Kaiser */ 10:nls.c **** /* All Rights Reserved */ 11:nls.c **** /* */ 12:nls.c **** /* This file is part of FreeDOS. */ 13:nls.c **** /* */ 14:nls.c **** /* DOS-C is free software; you can redistribute it and/or */ 15:nls.c **** /* modify it under the terms of the GNU General Public License */ 16:nls.c **** /* as published by the Free Software Foundation; either version */ 17:nls.c **** /* 2, or (at your option) any later version. */ 18:nls.c **** /* */ 19:nls.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 20:nls.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 21:nls.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 22:nls.c **** /* the GNU General Public License for more details. */ 23:nls.c **** /* */ 24:nls.c **** /* You should have received a copy of the GNU General Public */ 25:nls.c **** /* License along with DOS-C; see the file COPYING. If not, */ 26:nls.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 27:nls.c **** /* Cambridge, MA 02139, USA. */ 28:nls.c **** /****************************************************************/ 29:nls.c **** 30:nls.c **** /* 31:nls.c **** * Note 1: Some code assume certains prerequisites to be matched, 32:nls.c **** * e.g. character tables exactly 128 bytes long; I try to keep\ 33:nls.c **** * track of these conditions within comments marked with: 34:nls.c **** * ==ska*/ 35:nls.c **** 36:nls.c **** #include "portab.h" 37:nls.c **** #include "globals.h" 38:nls.c **** #include "pcb.h" 39:nls.c **** #include "nls.h" 40:nls.c **** #include "debug.h" 41:nls.c **** 42:nls.c **** #ifdef VERSION_STRINGS 43:nls.c **** static BYTE *RcsId = 44:nls.c **** "$Id: nls.c 1491 2009-07-18 20:48:44Z bartoldeman $"; 45:nls.c **** #endif 46:nls.c **** 47:nls.c **** #ifdef NLS_DEBUG 48:nls.c **** #define log(a) printf a 49:nls.c **** #define log1(a) printf a 50:nls.c **** #else 51:nls.c **** #define log(a) 52:nls.c **** #ifdef NDEBUG 53:nls.c **** #define log1(a) 54:nls.c **** #else 55:nls.c **** #define log1(a) printf a 56:nls.c **** #endif 57:nls.c **** #endif 58:nls.c **** 59:nls.c **** struct nlsInfoBlock ASM nlsInfo = { 60:nls.c **** (char FAR *)0 /* filename to COUNTRY.SYS */ 61:nls.c **** , 437 /* system code page */ 62:nls.c **** /* Implementation flags */ 63:nls.c **** , 0 64:nls.c **** #ifdef NLS_MODIFYABLE_DATA 65:nls.c **** | NLS_CODE_MODIFYABLE_DATA 66:nls.c **** #endif 67:nls.c **** #ifdef NLS_REORDER_POINTERS 68:nls.c **** | NLS_CODE_REORDER_POINTERS 69:nls.c **** #endif 70:nls.c **** #ifdef __GNUC__ 71:nls.c **** , {.seg=DosDataSeg, .off=&nlsPackageHardcoded} /* hardcoded first package */ 72:nls.c **** , {.seg=DosDataSeg, .off=&nlsPackageHardcoded} /* first item in chain */ 73:nls.c **** #else 74:nls.c **** , &nlsPackageHardcoded /* hardcoded first package */ 75:nls.c **** , &nlsPackageHardcoded /* first item in chain */ 76:nls.c **** #endif 77:nls.c **** }; 78:nls.c **** 79:nls.c **** /* getTableX return the pointer to the X'th table; X==subfct */ 80:nls.c **** /* subfct 2: normal upcase table; 4: filename upcase table */ 81:nls.c **** #ifdef NLS_REORDER_POINTERS 82:nls.c **** #define getTable2(nls) ((nls)->nlsPointers[0].pointer) 83:nls.c **** #define getTable4(nls) ((nls)->nlsPointers[1].pointer) 84:nls.c **** #define getTable7(nls) ((nls)->nlsPointers[4].pointer) 85:nls.c **** #else 86:nls.c **** #define getTable2(nls) getTable(2, (nls)) 87:nls.c **** #define getTable4(nls) getTable(4, (nls)) 88:nls.c **** #define getTable7(nls) getTable(7, (nls)) 89:nls.c **** #define NEED_GET_TABLE 90:nls.c **** #endif 91:nls.c **** /*== both chartables must be 128 bytes long and lower range is 92:nls.c **** identical to 7bit-US-ASCII ==ska*/ 93:nls.c **** #define getCharTbl2(nls) \ 94:nls.c **** (((struct nlsCharTbl FAR*)getTable2(nls))->tbl - 0x80) 95:nls.c **** #define getCharTbl4(nls) \ 96:nls.c **** (((struct nlsCharTbl FAR*)getTable4(nls))->tbl - 0x80) 97:nls.c **** 98:nls.c **** /******************************************************************** 99:nls.c **** ***** MUX calling functions **************************************** 100:nls.c **** ********************************************************************/ 101:nls.c **** 102:nls.c **** #ifdef __GNUC__ 103:nls.c **** #define call_nls(a,b,c,d,e,f) call_nls(f,e,d,c,b,a) 104:nls.c **** #endif 105:nls.c **** extern long ASMPASCAL call_nls(UWORD, VOID FAR *, UWORD, UWORD, UWORD, UWORD); 106:nls.c **** /*== DS:SI _always_ points to global NLS info structure <-> no 107:nls.c **** * subfct can use these registers for anything different. ==ska*/ 108:nls.c **** STATIC long muxGo(int subfct, UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize, 109:nls.c **** void FAR *buf) 110:nls.c **** { 111:nls.c **** long ret; 112:nls.c **** log(("NLS: muxGo(): subfct=%x, cntry=%u, cp=%u, ES:DI=%p\n", 113:nls.c **** subfct, cntry, cp, buf)); 114:nls.c **** ret = call_nls(bp, buf, subfct, cp, cntry, bufsize); 115:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 116:nls.c **** return ret; 117:nls.c **** } 118:nls.c **** 119:nls.c **** /* 120:nls.c **** * Call NLSFUNC to load the NLS package 121:nls.c **** */ 122:nls.c **** STATIC COUNT muxLoadPkg(int subfct, UWORD cp, UWORD cntry) 123:nls.c **** { 124:nls.c **** long ret; 125:nls.c **** 126:nls.c **** /* 0x1400 == not installed, ok to install */ 127:nls.c **** /* 0x1401 == not installed, not ok to install */ 128:nls.c **** /* 0x14FF == installed */ 129:nls.c **** 130:nls.c **** #if NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID 131:nls.c **** /* make sure the NLSFUNC ID is updated */ 132:nls.c **** #error "NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID" 133:nls.c **** #endif 134:nls.c **** /* Install check must pass the FreeDOS NLSFUNC version as codepage (cp) and 135:nls.c **** the FreeDOS NLSFUNC ID as buffer size (bufsize). If they match the 136:nls.c **** version in NLSFUNC, on return it will set BX (cp on entry) to FreeDOS 137:nls.c **** NLSFUNC ID. call_nls will set the high word = BX on return. 138:nls.c **** */ 139:nls.c **** ret = muxGo(0, 0, NLS_FREEDOS_NLSFUNC_VERSION, 0, NLS_FREEDOS_NLSFUNC_ID, 0); 140:nls.c **** if ((int)ret != 0x14ff) 141:nls.c **** return DE_FILENOTFND; /* No NLSFUNC --> no load */ 142:nls.c **** if ((int)(ret >> 16) != NLS_FREEDOS_NLSFUNC_ID) /* FreeDOS NLSFUNC will return */ 143:nls.c **** return DE_INVLDACC; /* This magic number */ 144:nls.c **** 145:nls.c **** /* OK, the correct NLSFUNC is available --> load pkg */ 146:nls.c **** /* If cp == -1 on entry, NLSFUNC updates cp to the codepage loaded 147:nls.c **** into memory. The system must then change to this one later */ 148:nls.c **** return (int)muxGo(subfct, 0, cp, cntry, 0, 0); 149:nls.c **** } 150:nls.c **** 151:nls.c **** STATIC int muxBufGo(int subfct, int bp, UWORD cp, UWORD cntry, 152:nls.c **** UWORD bufsize, VOID FAR * buf) 153:nls.c **** { 154:nls.c **** log(("NLS: muxBufGo(): subfct=%x, BP=%u, cp=%u, cntry=%u, len=%u, buf=%p\n", 155:nls.c **** subfct, bp, cp, cntry, bufsize, buf)); 156:nls.c **** 157:nls.c **** return (int)muxGo(subfct, bp, cp, cntry, bufsize, buf); 158:nls.c **** } 159:nls.c **** 160:nls.c **** #define mux65(s,cp,cc,bs,b) muxBufGo(2, (s), (cp), (cc), (bs), (b)) 161:nls.c **** #define mux38(cp,cc,bs,b) muxBufGo(4, 0, (cp), (cc), (bs), (b)) 162:nls.c **** #define muxYesNo(ch) muxBufGo(NLSFUNC_YESNO,0, NLS_DEFAULT, NLS_DEFAULT, (ch), 0) 163:nls.c **** #define muxUpMem(s,b,bs) muxBufGo((s),0, NLS_DEFAULT,NLS_DEFAULT, (bs), (b)) 164:nls.c **** 165:nls.c **** /******************************************************************** 166:nls.c **** ***** Helper functions********************************************** 167:nls.c **** ********************************************************************/ 168:nls.c **** 169:nls.c **** /* 170:nls.c **** * Search for the NLS package within the chain 171:nls.c **** * Also resolves the default values (-1) into the currently 172:nls.c **** * active codepage/country code. 173:nls.c **** */ 174:nls.c **** STATIC struct nlsPackage FAR *searchPackage(UWORD cp, UWORD cntry) 175:nls.c **** { 11 .loc 1 175 0 12 _.LVL0: 0 0000B70F 56 push si 0 0000B710 57 push di 0 0000B711 89E3 mov bx, sp 16 _.LCFI0: 0 0000B713 8B4F06 mov cx, word ptr [bx+6] 0 0000B716 8B7708 mov si, word ptr [bx+8] 176:nls.c **** struct nlsPackage FAR *nls; 177:nls.c **** 178:nls.c **** if (cp == NLS_DEFAULT) 19 .loc 1 178 0 0 0000B719 83F9FF cmp cx, -1 0 0000B71C BB[0000] mov bx, offset _nlsInfo 0 0000B71F 7507 jne _.L2 179:nls.c **** cp = nlsInfo.actPkg->cp; 23 .loc 1 179 0 0 0000B721 C47F08 les di, dword ptr [bx+8] 0 0000B724 268B4D06 mov cx, word ptr es:[di+6] 26 _.LVL1: 27 _.L2: 180:nls.c **** if (cntry == NLS_DEFAULT) 28 .loc 1 180 0 0 0000B728 83FEFF cmp si, -1 0 0000B72B 7507 jne _.L3 181:nls.c **** cntry = nlsInfo.actPkg->cntry; 31 .loc 1 181 0 0 0000B72D C47F08 les di, dword ptr [bx+8] 0 0000B730 268B7504 mov si, word ptr es:[di+4] 34 _.LVL2: 35 _.L3: 182:nls.c **** 183:nls.c **** nls = nlsInfo.chain; 36 .loc 1 183 0 0 0000B734 8B470C mov ax, word ptr [bx+12] 0 0000B737 8B570E mov dx, word ptr [bx+14] 39 _.LVL3: 40 _.L6: 184:nls.c **** while ((nls->cp != cp || nls->cntry != cntry) 41 .loc 1 184 0 0 0000B73A 8EC2 mov es, dx 0 0000B73C 89C3 mov bx, ax 0 0000B73E 263B4F06 cmp cx, word ptr es:[bx+6] 0 0000B742 7506 jne _.L4 46 .loc 1 184 0 is_stmt 0 discriminator 1 0 0000B744 263B7704 cmp si, word ptr es:[bx+4] 0 0000B748 7410 je _.L1 49 _.L4: 185:nls.c **** && (nls = nls->nxt) != NULL) ; 50 .loc 1 185 0 is_stmt 1 0 0000B74A 93 xchg bx, ax 0 0000B74B 8EC2 mov es, dx 0 0000B74D 268B07 mov ax, word ptr es:[bx] 54 _.LVL4: 0 0000B750 268B5702 mov dx, word ptr es:[bx+2] 56 _.LVL5: 0 0000B754 89C3 mov bx, ax 0 0000B756 09D3 or bx, dx 0 0000B758 75E0 jne _.L6 60 _.LVL6: 61 _.L1: 186:nls.c **** 187:nls.c **** return nls; 188:nls.c **** } 62 .loc 1 188 0 0 0000B75A 5F pop di 0 0000B75B 5E pop si 65 _.LVL7: 0 0000B75C C20400 ret 4 67 _.LFE7: 68 .size _searchPackage, .-_searchPackage 69 .type _muxLoadPkg, @function 70 _muxLoadPkg: 71 _.LFB5: 123:nls.c **** long ret; 72 .loc 1 123 0 73 _.LVL8: 0 0000B75F 56 push si 0 0000B760 55 push bp 76 _.LCFI1: 0 0000B761 89E5 mov bp, sp 78 _.LCFI2: 79 _.LVL9: 80 _.LBB28: 81 _.LBB29: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 82 .loc 1 114 0 0 0000B763 31F6 xor si, si 0 0000B765 56 push si 0 0000B766 56 push si 0 0000B767 56 push si 0 0000B768 56 push si 0 0000B769 B802FD mov ax, -766 0 0000B76C 50 push ax 0 0000B76D 56 push si 0 0000B76E B84B53 mov ax, 21323 0 0000B771 50 push ax 0 0000B772 E8[FEFF] call _call_nls 94 _.LVL10: 95 _.LBE29: 96 _.LBE28: 140:nls.c **** return DE_FILENOTFND; /* No NLSFUNC --> no load */ 97 .loc 1 140 0 0 0000B775 3DFF14 cmp ax, 5375 0 0000B778 751D jne _.L11 142:nls.c **** return DE_INVLDACC; /* This magic number */ 100 .loc 1 142 0 0 0000B77A 81FA4B53 cmp dx, 21323 0 0000B77E 751C jne _.L12 103 _.LVL11: 104 _.LBB30: 105 _.LBB31: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 106 .loc 1 114 0 0 0000B780 56 push si 0 0000B781 56 push si 0 0000B782 56 push si 0 0000B783 FF7606 push word ptr [bp+6] 0 0000B786 FF7608 push word ptr [bp+8] 0 0000B789 FF760A push word ptr [bp+10] 0 0000B78C 56 push si 0 0000B78D E8[FEFF] call _call_nls 115 _.LVL12: 116 _.L9: 117 _.LBE31: 118 _.LBE30: 149:nls.c **** 119 .loc 1 149 0 0 0000B790 89EC mov sp, bp 0 0000B792 5D pop bp 0 0000B793 5E pop si 0 0000B794 C20600 ret 6 124 _.L11: 141:nls.c **** if ((int)(ret >> 16) != NLS_FREEDOS_NLSFUNC_ID) /* FreeDOS NLSFUNC will return */ 125 .loc 1 141 0 0 0000B797 B8FEFF mov ax, -2 0 0000B79A EBF4 jmp _.L9 128 _.L12: 143:nls.c **** 129 .loc 1 143 0 0 0000B79C B8F4FF mov ax, -12 0 0000B79F EBEF jmp _.L9 132 _.LFE5: 133 .size _muxLoadPkg, .-_muxLoadPkg 134 .type _nlsGetData, @function 135 _nlsGetData: 136 _.LFB11: 189:nls.c **** 190:nls.c **** /* For various robustnesses reasons and to simplify the implementation 191:nls.c **** at other places, locateSubfct() returns NULL (== "not found"), 192:nls.c **** if nls == NULL on entry. */ 193:nls.c **** STATIC VOID FAR *locateSubfct(struct nlsPackage FAR * nls, int subfct) 194:nls.c **** { 195:nls.c **** int cnt; 196:nls.c **** struct nlsPointer FAR *p; 197:nls.c **** 198:nls.c **** if (nls) 199:nls.c **** for (cnt = nls->numSubfct, p = &nls->nlsPointers[0]; cnt--; ++p) 200:nls.c **** if (p->subfct == (UBYTE) subfct) 201:nls.c **** return p; 202:nls.c **** 203:nls.c **** return NULL; 204:nls.c **** } 205:nls.c **** 206:nls.c **** #ifdef NEED_GET_TABLE 207:nls.c **** /* search the table (from a subfct) from the active package */ 208:nls.c **** /* Note: Because this table returns the pointers for stuff of 209:nls.c **** *internal* purpose, it seems to be more comfortable that this 210:nls.c **** function is guaranteed to return valid pointers, rather than 211:nls.c **** to let the user (some kernel function) deal with non-existing 212:nls.c **** tables -- 2000/02/26 ska*/ 213:nls.c **** STATIC VOID FAR *getTable(UBYTE subfct, struct nlsPackage FAR * nls) 214:nls.c **** { 215:nls.c **** struct nlsPointer FAR *poi; 216:nls.c **** 217:nls.c **** if ((poi = locateSubfct(nls, subfct)) != NULL) 218:nls.c **** return poi; 219:nls.c **** 220:nls.c **** /* Failed --> return the hardcoded table */ 221:nls.c **** switch (subfct) 222:nls.c **** { 223:nls.c **** case 2: 224:nls.c **** return &nlsUpcaseHardcoded; 225:nls.c **** case 4: 226:nls.c **** return &nlsFUpcaseHardcoded; 227:nls.c **** /* case 5: return &nlsFn 228:nls.c **** /* case 6: return &nlsCollHardcodedTable; */ 229:nls.c **** case 7: 230:nls.c **** return &nlsDBCSHardcoded; 231:nls.c **** } 232:nls.c **** return NULL; 233:nls.c **** } 234:nls.c **** #endif 235:nls.c **** 236:nls.c **** /* 237:nls.c **** * Copy a buffer and test the size of the buffer 238:nls.c **** * Returns SUCCESS on success; DE_INVLDFUNC on failure 239:nls.c **** * 240:nls.c **** * Efficiency note: This function is used as: 241:nls.c **** * return cpyBuf(buf, bufsize, ...) 242:nls.c **** * three times. If the code optimizer is some good, it can re-use 243:nls.c **** * the code to push bufsize, buf, call cpyBuf() and return its result. 244:nls.c **** * The parameter were ordered to allow this code optimization. 245:nls.c **** */ 246:nls.c **** STATIC COUNT cpyBuf(VOID FAR * dst, UWORD dstlen, VOID FAR * src, 247:nls.c **** UWORD srclen) 248:nls.c **** { 249:nls.c **** if (srclen <= dstlen) 250:nls.c **** { 251:nls.c **** fmemcpy(dst, src, srclen); 252:nls.c **** return SUCCESS; 253:nls.c **** } 254:nls.c **** return DE_INVLDFUNC; /* buffer too small */ 255:nls.c **** } 256:nls.c **** 257:nls.c **** /* 258:nls.c **** * This function assumes that 'map' is adjusted such that 259:nls.c **** * map[0x80] is the uppercase of character 0x80. 260:nls.c **** *== 128 byte chartables, lower range conform to 7bit-US-ASCII ==ska*/ 261:nls.c **** STATIC VOID upMMem(UBYTE FAR * map, UBYTE FAR * str, unsigned len) 262:nls.c **** { 263:nls.c **** REG unsigned c; 264:nls.c **** 265:nls.c **** #ifdef NLS_DEBUG 266:nls.c **** UBYTE FAR *oldStr; 267:nls.c **** unsigned oldLen; 268:nls.c **** 269:nls.c **** oldStr = str; 270:nls.c **** oldLen = len; 271:nls.c **** log(("NLS: upMMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str), 272:nls.c **** FP_OFF(str))); 273:nls.c **** for (c = 0; c < len; ++c) 274:nls.c **** printf("%c", str[c] > 32 ? str[c] : '.'); 275:nls.c **** printf("\"\n"); 276:nls.c **** #endif 277:nls.c **** if (len) 278:nls.c **** do 279:nls.c **** { 280:nls.c **** if ((c = *str) >= 'a' && c <= 'z') 281:nls.c **** *str += 'A' - 'a'; 282:nls.c **** else if (c > 0x7f) 283:nls.c **** *str = map[c]; 284:nls.c **** ++str; 285:nls.c **** } 286:nls.c **** while (--len); 287:nls.c **** #ifdef NLS_DEBUG 288:nls.c **** printf("NLS: upMMem(): result=\""); 289:nls.c **** for (c = 0; c < oldLen; ++c) 290:nls.c **** printf("%c", oldStr[c] > 32 ? oldStr[c] : '.'); 291:nls.c **** printf("\"\n"); 292:nls.c **** #endif 293:nls.c **** } 294:nls.c **** 295:nls.c **** /******************************************************************** 296:nls.c **** ***** Lowlevel interface ******************************************* 297:nls.c **** ********************************************************************/ 298:nls.c **** 299:nls.c **** /* GetData function used by both the MUX-callback function and 300:nls.c **** the direct-access interface. 301:nls.c **** subfct == NLS_DOS_38 is a value > 0xff in order to not clash 302:nls.c **** with subfunctions valid to be passed as DOS-65-XX. */ 303:nls.c **** STATIC int nlsGetData(struct nlsPackage FAR * nls, int subfct, 304:nls.c **** UBYTE FAR * buf, unsigned bufsize) 305:nls.c **** { 137 .loc 1 305 0 138 _.LVL13: 0 0000B7A1 56 push si 0 0000B7A2 57 push di 0 0000B7A3 55 push bp 142 _.LCFI3: 0 0000B7A4 89E5 mov bp, sp 144 _.LCFI4: 0 0000B7A6 1E push ds 0 0000B7A7 8B5E08 mov bx, word ptr [bp+8] 0 0000B7AA 8B460A mov ax, word ptr [bp+10] 0 0000B7AD C5560E lds dx, dword ptr [bp+14] 0 0000B7B0 8B7E12 mov di, word ptr [bp+18] 150 _.LVL14: 151 _.LBB40: 152 _.LBB41: 198:nls.c **** for (cnt = nls->numSubfct, p = &nls->nlsPointers[0]; cnt--; ++p) 153 .loc 1 198 0 0 0000B7B3 89D9 mov cx, bx 0 0000B7B5 09C1 or cx, ax 0 0000B7B7 7410 je _.L28 199:nls.c **** if (p->subfct == (UBYTE) subfct) 157 .loc 1 199 0 0 0000B7B9 8EC0 mov es, ax 0 0000B7BB 268B4F0E mov cx, word ptr es:[bx+14] 160 _.LVL15: 0 0000B7BF 83C310 add bx, 16 162 _.LVL16: 163 _.L17: 0 0000B7C2 89CE mov si, cx 0 0000B7C4 4E dec si 166 _.LVL17: 0 0000B7C5 85C9 test cx, cx 0 0000B7C7 7505 jne _.L19 169 _.LVL18: 170 _.L28: 171 _.LBE41: 172 _.LBE40: 306:nls.c **** VOID FAR *poi; 307:nls.c **** 308:nls.c **** log(("NLS: nlsGetData(): subfct=%x, bufsize=%u, cp=%u, cntry=%u\n", 309:nls.c **** subfct, bufsize, nls->cp, nls->cntry)); 310:nls.c **** 311:nls.c **** /* Theoretically tables 1 and, if NLS_REORDER_POINTERS is enabled, 312:nls.c **** 2 and 4 could be hard-coded, because their 313:nls.c **** data is located at predictable (calculatable) locations. 314:nls.c **** However, 1 and subfct NLS_DOS_38 are to handle the same 315:nls.c **** data and the "locateSubfct()" call has to be implemented anyway, 316:nls.c **** in order to handle all subfunctions. 317:nls.c **** Also, NLS is often NOT used in any case, so this code is more 318:nls.c **** size than speed optimized. */ 319:nls.c **** if ((poi = locateSubfct(nls, subfct)) != NULL) 320:nls.c **** { 321:nls.c **** log(("NLS: nlsGetData(): subfunction found\n")); 322:nls.c **** switch (subfct) 323:nls.c **** { 324:nls.c **** case 1: /* Extended Country Information */ 325:nls.c **** return cpyBuf(buf, bufsize, poi, 326:nls.c **** ((struct nlsExtCntryInfo FAR *)poi)->size + 3); 327:nls.c **** case NLS_DOS_38: /* Normal Country Information */ 328:nls.c **** return cpyBuf(buf, bufsize, &(((struct nlsExtCntryInfo FAR *)poi)->dateFmt), 24); /* 329:nls.c **** /* don't copy 34, copy only 0x18 instead, 330:nls.c **** see comment at DosGetCountryInformation TE */ 331:nls.c **** default: 332:nls.c **** /* All other subfunctions just return the found nlsPoinerInf 333:nls.c **** structure */ 334:nls.c **** return cpyBuf(buf, bufsize, poi, sizeof(struct nlsPointer)); 335:nls.c **** } 336:nls.c **** } 337:nls.c **** 338:nls.c **** /* The requested subfunction could not been located within the 339:nls.c **** NLS pkg --> error. Because the data corresponds to the subfunction 340:nls.c **** number passed to the API, the failure is the same as that a wrong 341:nls.c **** API function has been called. */ 342:nls.c **** log(("NLS: nlsGetData(): Subfunction not found\n")); 343:nls.c **** return DE_INVLDFUNC; 173 .loc 1 343 0 0 0000B7C9 B8FFFF mov ax, -1 0 0000B7CC EB47 jmp _.L14 176 _.LVL19: 177 _.L19: 178 _.LBB43: 179 _.LBB42: 200:nls.c **** return p; 180 .loc 1 200 0 0 0000B7CE 8EC0 mov es, ax 0 0000B7D0 268A0F mov cl, byte ptr es:[bx] 0 0000B7D3 3A4E0C cmp cl, byte ptr [bp+12] 0 0000B7D6 7407 je _.L18 199:nls.c **** if (p->subfct == (UBYTE) subfct) 185 .loc 1 199 0 0 0000B7D8 83C305 add bx, 5 187 _.LVL20: 0 0000B7DB 89F1 mov cx, si 0 0000B7DD EBE3 jmp _.L17 190 _.L18: 191 _.LVL21: 192 _.LBE42: 193 _.LBE43: 319:nls.c **** { 194 .loc 1 319 0 0 0000B7DF 89D9 mov cx, bx 0 0000B7E1 09C1 or cx, ax 0 0000B7E3 74E4 je _.L28 322:nls.c **** { 198 .loc 1 322 0 0 0000B7E5 837E0C01 cmp word ptr [bp+12], 1 0 0000B7E9 7411 je _.L22 0 0000B7EB 817E0C0101 cmp word ptr [bp+12], 257 0 0000B7F0 742D je _.L23 203 _.LVL22: 204 _.LBB44: 205 _.LBB45: 249:nls.c **** { 206 .loc 1 249 0 0 0000B7F2 83FF04 cmp di, 4 0 0000B7F5 76D2 jbe _.L28 251:nls.c **** return SUCCESS; 209 .loc 1 251 0 0 0000B7F7 B90500 mov cx, 5 0 0000B7FA EB0D jmp _.L31 212 _.LVL23: 213 _.L22: 214 _.LBE45: 215 _.LBE44: 326:nls.c **** case NLS_DOS_38: /* Normal Country Information */ 216 .loc 1 326 0 0 0000B7FC 8EC0 mov es, ax 0 0000B7FE 268B4F01 mov cx, word ptr es:[bx+1] 0 0000B802 83C103 add cx, 3 220 _.LVL24: 221 _.LBB47: 222 _.LBB48: 249:nls.c **** { 223 .loc 1 249 0 0 0000B805 39F9 cmp cx, di 0 0000B807 77C0 ja _.L28 226 _.LVL25: 227 _.L31: 228 _.LBE48: 229 _.LBE47: 230 _.LBB49: 231 _.LBB46: 251:nls.c **** return SUCCESS; 232 .loc 1 251 0 0 0000B809 51 push cx 0 0000B80A 50 push ax 0 0000B80B 53 push bx 0 0000B80C 1E push ds 0 0000B80D 52 push dx 0 0000B80E 16 push ss 0 0000B80F 1F pop ds 0 0000B810 E8[FEFF] call _fmemcpy 241 _.LVL26: 252:nls.c **** } 242 .loc 1 252 0 0 0000B813 31C0 xor ax, ax 244 _.L14: 245 _.LBE46: 246 _.LBE49: 344:nls.c **** } 247 .loc 1 344 0 0 0000B815 89EC mov sp, bp 0 0000B817 5D pop bp 0 0000B818 5F pop di 0 0000B819 5E pop si 0 0000B81A 16 push ss 0 0000B81B 1F pop ds 0 0000B81C C20C00 ret 12 255 _.LVL27: 256 _.L23: 328:nls.c **** /* don't copy 34, copy only 0x18 instead, 257 .loc 1 328 0 0 0000B81F 83C307 add bx, 7 259 _.LVL28: 260 _.LBB50: 261 _.LBB51: 249:nls.c **** { 262 .loc 1 249 0 0 0000B822 83FF17 cmp di, 23 0 0000B825 76A2 jbe _.L28 251:nls.c **** return SUCCESS; 265 .loc 1 251 0 0 0000B827 B91800 mov cx, 24 0 0000B82A EBDD jmp _.L31 268 _.LBE51: 269 _.LBE50: 270 _.LFE11: 271 .size _nlsGetData, .-_nlsGetData 272 .type _upMMem.part.0, @function 273 _upMMem.part.0: 274 _.LFB36: 261:nls.c **** { 275 .loc 1 261 0 276 _.LVL29: 0 0000B82C 56 push si 0 0000B82D 57 push di 0 0000B82E 55 push bp 280 _.LCFI5: 0 0000B82F 89E5 mov bp, sp 282 _.LCFI6: 0 0000B831 C44E08 les cx, dword ptr [bp+8] 0 0000B834 C5760C lds si, dword ptr [bp+12] 0 0000B837 8B7E10 mov di, word ptr [bp+16] 286 _.LVL30: 287 _.L35: 280:nls.c **** *str += 'A' - 'a'; 288 .loc 1 280 0 0 0000B83A 8A14 mov dl, byte ptr [si] 0 0000B83C 88D0 mov al, dl 0 0000B83E 30E4 xor ah, ah 292 _.LVL31: 0 0000B840 83F860 cmp ax, 96 0 0000B843 760A jbe _.L33 0 0000B845 83F87A cmp ax, 122 0 0000B848 7711 ja _.L34 281:nls.c **** else if (c > 0x7f) 297 .loc 1 281 0 0 0000B84A 80C2E0 add dl, -32 0 0000B84D 8814 mov byte ptr [si], dl 300 _.LVL32: 301 _.L33: 284:nls.c **** } 302 .loc 1 284 0 0 0000B84F 46 inc si 304 _.LVL33: 286:nls.c **** #ifdef NLS_DEBUG 305 .loc 1 286 0 0 0000B850 4F dec di 307 _.LVL34: 0 0000B851 75E7 jne _.L35 293:nls.c **** 309 .loc 1 293 0 0 0000B853 5D pop bp 0 0000B854 5F pop di 312 _.LVL35: 0 0000B855 5E pop si 314 _.LVL36: 0 0000B856 16 push ss 0 0000B857 1F pop ds 0 0000B858 C20A00 ret 10 318 _.LVL37: 319 _.L34: 282:nls.c **** *str = map[c]; 320 .loc 1 282 0 0 0000B85B 83F87F cmp ax, 127 0 0000B85E 76EF jbe _.L33 283:nls.c **** ++str; 323 .loc 1 283 0 0 0000B860 01C8 add ax, cx 325 _.LVL38: 0 0000B862 89C3 mov bx, ax 0 0000B864 268A07 mov al, byte ptr es:[bx] 0 0000B867 8804 mov byte ptr [si], al 0 0000B869 EBE4 jmp _.L33 330 _.LFE36: 331 .size _upMMem.part.0, .-_upMMem.part.0 332 .type _xUpMem, @function 333 _xUpMem: 334 _.LFB19: 345:nls.c **** 346:nls.c **** VOID nlsCPchange(UWORD cp) 347:nls.c **** { 348:nls.c **** UNREFERENCED_PARAMETER(cp); 349:nls.c **** put_string("\7\nchange codepage not yet done ska\n"); 350:nls.c **** } 351:nls.c **** 352:nls.c **** /* 353:nls.c **** * Changes the current active codepage or cntry 354:nls.c **** * 355:nls.c **** * Note: Usually any call sees a value of -1 (0xFFFF) as "the current 356:nls.c **** * country/CP". When a new NLS pkg is loaded, there is however a little 357:nls.c **** * difference, because one could mean that when switching to country XY 358:nls.c **** * the system may change to any codepage required. 359:nls.c **** * Example: 360:nls.c **** * MODE has prepared codepages 437 and 850. 361:nls.c **** * The user loaded a 2nd NLS pkg via CONFIG.SYS with: 362:nls.c **** * COUNTRY=49,850,C:\COUNTRY.SYS 363:nls.c **** * By default, the kernel maintains the hardcoded 001,437 (U.S.A./CP437) 364:nls.c **** * After the Country statement the system switches to codepage 850. 365:nls.c **** * But when the user invokes DOS-38-01/DX=FFFF (Set Country ID to 1) 366:nls.c **** * the system _must_ switch to codepage 437, because this is the only 367:nls.c **** * NLS pkg loaded. 368:nls.c **** * Therefore, setPackage() will substitute the current country ID, if 369:nls.c **** * cntry==-1, but leaves cp==-1 in order to let NLSFUNC choose the most 370:nls.c **** * appropriate codepage on its own. 371:nls.c **** */ 372:nls.c **** 373:nls.c **** STATIC COUNT nlsSetPackage(struct nlsPackage FAR * nls) 374:nls.c **** { 375:nls.c **** if (nls->cp != nlsInfo.actPkg->cp) /* Codepage gets changed --> 376:nls.c **** inform all character drivers thereabout. 377:nls.c **** If this fails, it would be possible that the old 378:nls.c **** NLS pkg had been removed from memory by NLSFUNC. */ 379:nls.c **** nlsCPchange(nls->cp); 380:nls.c **** 381:nls.c **** nlsInfo.actPkg = nls; 382:nls.c **** 383:nls.c **** return SUCCESS; 384:nls.c **** } 385:nls.c **** STATIC COUNT DosSetPackage(UWORD cp, UWORD cntry) 386:nls.c **** { 387:nls.c **** /* Right now, we do not have codepage change support in kernel, so push 388:nls.c **** it through the mux in any case. */ 389:nls.c **** #if 0 390:nls.c **** struct nlsPackage FAR *nls; /* NLS package to use to return the info from */ 391:nls.c **** 392:nls.c **** /* nls := NLS package of cntry/codepage */ 393:nls.c **** if ((nls = searchPackage(cp, cntry)) != NULL) 394:nls.c **** /* OK the NLS pkg is loaded --> activate it */ 395:nls.c **** return nlsSetPackage(nls); 396:nls.c **** 397:nls.c **** /* not loaded --> invoke NLSFUNC to load it */ 398:nls.c **** #endif 399:nls.c **** return muxLoadPkg(NLSFUNC_LOAD_PKG2, cp, cntry); 400:nls.c **** } 401:nls.c **** 402:nls.c **** STATIC COUNT nlsLoadPackage(struct nlsPackage FAR * nls) 403:nls.c **** { 404:nls.c **** 405:nls.c **** nlsInfo.actPkg = nls; 406:nls.c **** 407:nls.c **** return SUCCESS; 408:nls.c **** } 409:nls.c **** STATIC COUNT DosLoadPackage(UWORD cp, UWORD cntry) 410:nls.c **** { 411:nls.c **** struct nlsPackage FAR *nls; /* NLS package to use to return the info from */ 412:nls.c **** 413:nls.c **** /* nls := NLS package of cntry/codepage */ 414:nls.c **** if ((nls = searchPackage(cp, cntry)) != NULL) 415:nls.c **** /* OK the NLS pkg is loaded --> activate it */ 416:nls.c **** return nlsLoadPackage(nls); 417:nls.c **** 418:nls.c **** /* not loaded --> invoke NLSFUNC to load it */ 419:nls.c **** return muxLoadPkg(NLSFUNC_LOAD_PKG, cp, cntry); 420:nls.c **** } 421:nls.c **** 422:nls.c **** STATIC void nlsUpMem(struct nlsPackage FAR * nls, VOID FAR * str, int len) 423:nls.c **** { 424:nls.c **** log(("NLS: nlsUpMem()\n")); 425:nls.c **** upMMem(getCharTbl2(nls), (UBYTE FAR *) str, len); 426:nls.c **** } 427:nls.c **** STATIC void nlsFUpMem(struct nlsPackage FAR * nls, VOID FAR * str, int len) 428:nls.c **** { 429:nls.c **** log(("NLS: nlsFUpMem()\n")); 430:nls.c **** upMMem(getCharTbl4(nls), (UBYTE FAR *) str, len); 431:nls.c **** } 432:nls.c **** 433:nls.c **** STATIC VOID xUpMem(struct nlsPackage FAR * nls, VOID FAR * str, 434:nls.c **** unsigned len) 435:nls.c **** /* upcase a memory area */ 436:nls.c **** { 335 .loc 1 436 0 336 _.LVL39: 0 0000B86B 56 push si 0 0000B86C 55 push bp 339 _.LCFI7: 0 0000B86D 89E5 mov bp, sp 341 _.LCFI8: 0 0000B86F 1E push ds 0 0000B870 8B5E06 mov bx, word ptr [bp+6] 0 0000B873 C54608 lds ax, dword ptr [bp+8] 0 0000B876 8B760C mov si, word ptr [bp+12] 0 0000B879 8B4E0E mov cx, word ptr [bp+14] 437:nls.c **** log(("NLS: xUpMem(): cp=%u, cntry=%u\n", nls->cp, nls->cntry)); 438:nls.c **** 439:nls.c **** if (nls->flags & NLS_FLAG_DIRECT_UPCASE) 347 .loc 1 439 0 0 0000B87C 8EC0 mov es, ax 0 0000B87E 268B5708 mov dx, word ptr es:[bx+8] 0 0000B882 8956FE mov word ptr [bp-2], dx 0 0000B885 83E201 and dx, 1 0 0000B888 741D je _.L39 353 _.LVL40: 354 _.LBB62: 355 _.LBB63: 356 _.LBB64: 357 _.LBB65: 277:nls.c **** do 358 .loc 1 277 0 0 0000B88A 85C9 test cx, cx 0 0000B88C 7430 je _.L38 361 _.LBE65: 362 _.LBE64: 425:nls.c **** } 363 .loc 1 425 0 0 0000B88E 268B5711 mov dx, word ptr es:[bx+17] 0 0000B892 268B4F13 mov cx, word ptr es:[bx+19] 366 _.LVL41: 0 0000B896 83C282 add dx, -126 368 _.LBB68: 369 _.LBB66: 0 0000B899 895606 mov word ptr [bp+6], dx 371 _.LVL42: 0 0000B89C 894E08 mov word ptr [bp+8], cx 373 _.LVL43: 0 0000B89F 16 push ss 0 0000B8A0 1F pop ds 376 _.LBE66: 377 _.LBE68: 378 _.LBE63: 379 _.LBE62: 440:nls.c **** nlsUpMem(nls, str, len); 441:nls.c **** else 442:nls.c **** muxBufGo(NLSFUNC_UPMEM, 0, nls->cp, nls->cntry, len, str); 443:nls.c **** } 380 .loc 1 443 0 0 0000B8A1 89EC mov sp, bp 0 0000B8A3 5D pop bp 0 0000B8A4 5E pop si 384 _.LBB71: 385 _.LBB70: 386 _.LBB69: 387 _.LBB67: 0 0000B8A5 EB85 jmp _upMMem.part.0 389 _.LVL44: 390 _.L39: 391 _.LBE67: 392 _.LBE69: 393 _.LBE70: 394 _.LBE71: 395 _.LBB72: 396 _.LBB73: 397 _.LBB74: 398 _.LBB75: 399 _.LBB76: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 400 .loc 1 114 0 0 0000B8A7 52 push dx 402 _.LVL45: 0 0000B8A8 56 push si 0 0000B8A9 1E push ds 0 0000B8AA BA2200 mov dx, 34 0 0000B8AD 52 push dx 0 0000B8AE 8EC0 mov es, ax 0 0000B8B0 26FF7706 push word ptr es:[bx+6] 0 0000B8B4 26FF7704 push word ptr es:[bx+4] 0 0000B8B8 51 push cx 0 0000B8B9 16 push ss 0 0000B8BA 1F pop ds 413 _.LVL46: 0 0000B8BB E8[FEFF] call _call_nls 415 _.LVL47: 416 _.L38: 417 _.LBE76: 418 _.LBE75: 419 _.LBE74: 420 _.LBE73: 421 _.LBE72: 422 .loc 1 443 0 0 0000B8BE 89EC mov sp, bp 0 0000B8C0 5D pop bp 0 0000B8C1 5E pop si 0 0000B8C2 16 push ss 0 0000B8C3 1F pop ds 0 0000B8C4 C20A00 ret 10 429 _.LFE19: 430 .size _xUpMem, .-_xUpMem 431 .type _nlsYesNo, @function 432 _nlsYesNo: 433 _.LFB21: 444:nls.c **** 445:nls.c **** STATIC BOOL nlsIsDBCS(UBYTE ch) 446:nls.c **** { 447:nls.c **** 448:nls.c **** if (ch < 128) 449:nls.c **** return FALSE; /* No leadbyte is smaller than that */ 450:nls.c **** 451:nls.c **** { 452:nls.c **** UWORD FAR *t= ((struct nlsDBCS FAR*)getTable7(nlsInfo.actPkg))->dbcsTbl; 453:nls.c **** 454:nls.c **** for (; *t != 0; ++t) 455:nls.c **** if (ch >= (*t & 0xFF) && ch <= (*t >> 8)) 456:nls.c **** return TRUE; 457:nls.c **** } 458:nls.c **** 459:nls.c **** return FALSE; 460:nls.c **** } 461:nls.c **** 462:nls.c **** STATIC int nlsYesNo(struct nlsPackage FAR * nls, UWORD ch) 463:nls.c **** { 434 .loc 1 463 0 435 _.LVL48: 0 0000B8C7 56 push si 0 0000B8C8 57 push di 0 0000B8C9 55 push bp 439 _.LCFI9: 0 0000B8CA 89E5 mov bp, sp 441 _.LCFI10: 0 0000B8CC 1E push ds 0 0000B8CD 8B7608 mov si, word ptr [bp+8] 0 0000B8D0 8B460A mov ax, word ptr [bp+10] 0 0000B8D3 8946FE mov word ptr [bp-2], ax 464:nls.c **** /* Check if it is a dual byte character */ 465:nls.c **** if (!nlsIsDBCS(ch & 0xFF)) { 446 .loc 1 465 0 0 0000B8D6 8B560C mov dx, word ptr [bp+12] 448 _.LVL49: 449 _.LBB82: 450 _.LBB83: 448:nls.c **** return FALSE; /* No leadbyte is smaller than that */ 451 .loc 1 448 0 0 0000B8D9 84D2 test dl, dl 0 0000B8DB 7D1A jge _.L46 454 _.LBB84: 452:nls.c **** 455 .loc 1 452 0 0 0000B8DD BB[0000] mov bx, offset _nlsInfo 0 0000B8E0 36C47F08 les di, dword ptr ss:[bx+8] 0 0000B8E4 26C55D25 lds bx, dword ptr es:[di+37] 0 0000B8E8 83C302 add bx, 2 460 _.LVL50: 0 0000B8EB 89D7 mov di, dx 0 0000B8ED 81E7FF00 and di, 255 463 _.LVL51: 464 _.L47: 454:nls.c **** if (ch >= (*t & 0xFF) && ch <= (*t >> 8)) 465 .loc 1 454 0 0 0000B8F1 8B07 mov ax, word ptr [bx] 0 0000B8F3 85C0 test ax, ax 0 0000B8F5 7538 jne _.L50 469 _.LVL52: 470 _.L46: 471 _.LBE84: 472 _.LBE83: 473 _.LBE82: 466:nls.c **** ch &= 0xFF; 474 .loc 1 466 0 0 0000B8F7 B600 mov dh, 0 0 0000B8F9 89560C mov word ptr [bp+12], dx 477 _.LBB87: 478 _.LBB88: 479 .file 2 "../hdr/portab.h" 1:../hdr/portab.h **** /****************************************************************/ 2:../hdr/portab.h **** /* */ 3:../hdr/portab.h **** /* portab.h */ 4:../hdr/portab.h **** /* */ 5:../hdr/portab.h **** /* DOS-C portability typedefs, etc. */ 6:../hdr/portab.h **** /* */ 7:../hdr/portab.h **** /* May 1, 1995 */ 8:../hdr/portab.h **** /* */ 9:../hdr/portab.h **** /* Copyright (c) 1995 */ 10:../hdr/portab.h **** /* Pasquale J. Villani */ 11:../hdr/portab.h **** /* All Rights Reserved */ 12:../hdr/portab.h **** /* */ 13:../hdr/portab.h **** /* This file is part of DOS-C. */ 14:../hdr/portab.h **** /* */ 15:../hdr/portab.h **** /* DOS-C is free software; you can redistribute it and/or */ 16:../hdr/portab.h **** /* modify it under the terms of the GNU General Public License */ 17:../hdr/portab.h **** /* as published by the Free Software Foundation; either version */ 18:../hdr/portab.h **** /* 2, or (at your option) any later version. */ 19:../hdr/portab.h **** /* */ 20:../hdr/portab.h **** /* DOS-C is distributed in the hope that it will be useful, but */ 21:../hdr/portab.h **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 22:../hdr/portab.h **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 23:../hdr/portab.h **** /* the GNU General Public License for more details. */ 24:../hdr/portab.h **** /* */ 25:../hdr/portab.h **** /* You should have received a copy of the GNU General Public */ 26:../hdr/portab.h **** /* License along with DOS-C; see the file COPYING. If not, */ 27:../hdr/portab.h **** /* write to the Free Software Foundation, 675 Mass Ave, */ 28:../hdr/portab.h **** /* Cambridge, MA 02139, USA. */ 29:../hdr/portab.h **** /****************************************************************/ 30:../hdr/portab.h **** 31:../hdr/portab.h **** #ifdef MAIN 32:../hdr/portab.h **** #ifdef VERSION_STRINGS 33:../hdr/portab.h **** static char *portab_hRcsId = 34:../hdr/portab.h **** "$Id: portab.h 1121 2005-03-15 15:25:08Z perditionc $"; 35:../hdr/portab.h **** #endif 36:../hdr/portab.h **** #endif 37:../hdr/portab.h **** 38:../hdr/portab.h **** /****************************************************************/ 39:../hdr/portab.h **** /* */ 40:../hdr/portab.h **** /* Machine dependant portable types. Note that this section is */ 41:../hdr/portab.h **** /* used primarily for segmented architectures. Common types and */ 42:../hdr/portab.h **** /* types used relating to segmented operations are found here. */ 43:../hdr/portab.h **** /* */ 44:../hdr/portab.h **** /* Be aware that segmented architectures impose on linear */ 45:../hdr/portab.h **** /* architectures because they require special types to be used */ 46:../hdr/portab.h **** /* throught the code that must be reduced to empty preprocessor */ 47:../hdr/portab.h **** /* replacements in the linear machine. */ 48:../hdr/portab.h **** /* */ 49:../hdr/portab.h **** /* #ifdef */ 50:../hdr/portab.h **** /* # define FAR far */ 51:../hdr/portab.h **** /* # define NEAR near */ 52:../hdr/portab.h **** /* #endif */ 53:../hdr/portab.h **** /* */ 54:../hdr/portab.h **** /* #ifdef */ 55:../hdr/portab.h **** /* # define FAR */ 56:../hdr/portab.h **** /* # define NEAR */ 57:../hdr/portab.h **** /* #endif */ 58:../hdr/portab.h **** /* */ 59:../hdr/portab.h **** /****************************************************************/ 60:../hdr/portab.h **** 61:../hdr/portab.h **** /* commandline overflow - removing -DI86 TE 62:../hdr/portab.h **** #if defined(__TURBOC__) 63:../hdr/portab.h **** 64:../hdr/portab.h **** #define I86 65:../hdr/portab.h **** #define CDECL cdecl 66:../hdr/portab.h **** #if __TURBOC__ > 0x202 67:../hdr/portab.h **** /* printf callers do the right thing for tc++ 1.01 but not tc 2.01 */ 68:../hdr/portab.h **** #define VA_CDECL 69:../hdr/portab.h **** #else 70:../hdr/portab.h **** #define VA_CDECL cdecl 71:../hdr/portab.h **** #endif 72:../hdr/portab.h **** #define PASCAL pascal 73:../hdr/portab.h **** void __int__(int); 74:../hdr/portab.h **** #ifndef FORSYS 75:../hdr/portab.h **** void __emit__(char, ...); 76:../hdr/portab.h **** #define disable() __emit__(0xfa) 77:../hdr/portab.h **** #define enable() __emit__(0xfb) 78:../hdr/portab.h **** #endif 79:../hdr/portab.h **** 80:../hdr/portab.h **** #elif defined(_MSC_VER) 81:../hdr/portab.h **** 82:../hdr/portab.h **** #define I86 83:../hdr/portab.h **** #define asm __asm 84:../hdr/portab.h **** #pragma warning(disable: 4761) /* "integral size mismatch in argument; 85:../hdr/portab.h **** conversion supplied" */ 86:../hdr/portab.h **** #define CDECL _cdecl 87:../hdr/portab.h **** #define VA_CDECL 88:../hdr/portab.h **** #define PASCAL pascal 89:../hdr/portab.h **** #define __int__(intno) asm int intno; 90:../hdr/portab.h **** #define disable() asm cli 91:../hdr/portab.h **** #define enable() asm sti 92:../hdr/portab.h **** #define _CS getCS() 93:../hdr/portab.h **** static unsigned short __inline getCS(void) 94:../hdr/portab.h **** { 95:../hdr/portab.h **** asm mov ax, cs; 96:../hdr/portab.h **** } 97:../hdr/portab.h **** #define _SS getSS() 98:../hdr/portab.h **** static unsigned short __inline getSS(void) 99:../hdr/portab.h **** { 100:../hdr/portab.h **** asm mov ax, ss; 101:../hdr/portab.h **** } 102:../hdr/portab.h **** 103:../hdr/portab.h **** #elif defined(__WATCOMC__) /* don't know a better way */ 104:../hdr/portab.h **** 105:../hdr/portab.h **** #if defined(_M_I86) 106:../hdr/portab.h **** 107:../hdr/portab.h **** #define I86 108:../hdr/portab.h **** #define __int__(intno) asm int intno; 109:../hdr/portab.h **** void disable(void); 110:../hdr/portab.h **** #pragma aux disable = "cli" __modify __exact []; 111:../hdr/portab.h **** void enable(void); 112:../hdr/portab.h **** #pragma aux enable = "sti" __modify __exact []; 113:../hdr/portab.h **** #define asm __asm 114:../hdr/portab.h **** #define far __far 115:../hdr/portab.h **** #define CDECL __cdecl 116:../hdr/portab.h **** #define VA_CDECL 117:../hdr/portab.h **** #define PASCAL pascal 118:../hdr/portab.h **** #define _CS getCS() 119:../hdr/portab.h **** unsigned short getCS(void); 120:../hdr/portab.h **** #pragma aux getCS = "mov dx,cs" __value [__dx] __modify __exact[__dx]; 121:../hdr/portab.h **** #define _SS getSS() 122:../hdr/portab.h **** unsigned short getSS(void); 123:../hdr/portab.h **** #pragma aux getSS = "mov dx,ss" __value [__dx] __modify __exact[__dx]; 124:../hdr/portab.h **** #if !defined(FORSYS) && !defined(EXEFLAT) && _M_IX86 >= 300 125:../hdr/portab.h **** #pragma aux __default __parm [__ax __dx __cx] __modify [__ax __dx __es __fs] /* min.unpacked size * 126:../hdr/portab.h **** #endif 127:../hdr/portab.h **** 128:../hdr/portab.h **** /* enable Possible loss of precision warning for compatibility with Borland */ 129:../hdr/portab.h **** #pragma enable_message(130) 130:../hdr/portab.h **** 131:../hdr/portab.h **** #else 132:../hdr/portab.h **** 133:../hdr/portab.h **** /* workaround for building some utils with OpenWatcom (flat model) */ 134:../hdr/portab.h **** #define MC68K 135:../hdr/portab.h **** 136:../hdr/portab.h **** #endif 137:../hdr/portab.h **** 138:../hdr/portab.h **** #elif defined (_MYMC68K_COMILER_) 139:../hdr/portab.h **** 140:../hdr/portab.h **** #define MC68K 141:../hdr/portab.h **** 142:../hdr/portab.h **** #elif defined(__GNUC__) 143:../hdr/portab.h **** 144:../hdr/portab.h **** #ifdef __FAR 145:../hdr/portab.h **** #define I86 146:../hdr/portab.h **** #define STRINGIFY(x) #x 147:../hdr/portab.h **** #define __int__(intno) asm volatile(STRINGIFY(int $##intno)) 148:../hdr/portab.h **** static inline void disable(void) 149:../hdr/portab.h **** { 150:../hdr/portab.h **** asm volatile("cli"); 151:../hdr/portab.h **** } 152:../hdr/portab.h **** static inline void enable(void) 153:../hdr/portab.h **** { 154:../hdr/portab.h **** asm volatile("sti"); 155:../hdr/portab.h **** } 156:../hdr/portab.h **** #define far __far 157:../hdr/portab.h **** #define CDECL __attribute__((cdecl)) 158:../hdr/portab.h **** #define VA_CDECL 159:../hdr/portab.h **** #define PASCAL 160:../hdr/portab.h **** 161:../hdr/portab.h **** #define _CS getCS() 162:../hdr/portab.h **** static inline unsigned short getCS(void) 163:../hdr/portab.h **** { 164:../hdr/portab.h **** unsigned short ret; 165:../hdr/portab.h **** asm volatile("{ mov %%cs, %0 | mov %0, cs }" : "=r"(ret)); 166:../hdr/portab.h **** return ret; 167:../hdr/portab.h **** } 168:../hdr/portab.h **** 169:../hdr/portab.h **** #define _SS getSS() 170:../hdr/portab.h **** static inline unsigned short getSS(void) 171:../hdr/portab.h **** { 172:../hdr/portab.h **** unsigned short ret; 173:../hdr/portab.h **** asm volatile("{ mov %%ss, %0 | mov %0, ss }" : "=r"(ret)); 480 .loc 2 173 0 481 #APP 482 ;# 173 "../hdr/portab.h" 1 174 return ret; 483 mov ax, ss 484 ;# 0 "" 2 485 #NO_APP 486 _.LBE88: 487 _.LBE87: 467:nls.c **** log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? (char)ch : ' ')); 468:nls.c **** xUpMem(nls, MK_FP(_SS, &ch), 1); /* Upcase character */ 488 .loc 1 468 0 0 0000B8FE BA0100 mov dx, 1 0 0000B901 52 push dx 0 0000B902 8D560C lea dx, [12+bp] 0 0000B905 50 push ax 0 0000B906 52 push dx 0 0000B907 FF76FE push word ptr [bp-2] 0 0000B90A 56 push si 0 0000B90B 16 push ss 0 0000B90C 1F pop ds 0 0000B90D E85BFF call _xUpMem 499 _.LVL53: 500 _.L49: 469:nls.c **** /* Cannot use DosUpChar(), because 470:nls.c **** maybe: nls != current NLS pkg 471:nls.c **** However: Upcase character within lowlevel 472:nls.c **** function to allow a yesNo() function 473:nls.c **** catched by external MUX-14 handler, which 474:nls.c **** does NOT upcase character. */ 475:nls.c **** log(("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch > 32 ? (char)ch : ' ')); 476:nls.c **** } 477:nls.c **** else 478:nls.c **** log(("NLS: nlsYesNo(): in ch=%u (DBCS)\n", ch)); 479:nls.c **** 480:nls.c **** if (ch == nls->yeschar) 501 .loc 1 480 0 0 0000B910 8B460C mov ax, word ptr [bp+12] 0 0000B913 8E46FE mov es, word ptr [bp-2] 0 0000B916 2639440A cmp word ptr es:[si+10], ax 0 0000B91A 7428 je _.L52 481:nls.c **** return 1; 482:nls.c **** if (ch == nls->nochar) 506 .loc 1 482 0 0 0000B91C 263B440C cmp ax, word ptr es:[si+12] 0 0000B920 7427 je _.L53 483:nls.c **** return 0; 484:nls.c **** return 2; 509 .loc 1 484 0 0 0000B922 B80200 mov ax, 2 511 _.L45: 485:nls.c **** } 512 .loc 1 485 0 0 0000B925 89EC mov sp, bp 0 0000B927 5D pop bp 0 0000B928 5F pop di 0 0000B929 5E pop si 0 0000B92A 16 push ss 0 0000B92B 1F pop ds 0 0000B92C C20600 ret 6 520 _.LVL54: 521 _.L50: 522 _.LBB89: 523 _.LBB86: 524 _.LBB85: 455:nls.c **** return TRUE; 525 .loc 1 455 0 0 0000B92F 89C1 mov cx, ax 0 0000B931 30ED xor ch, ch 0 0000B933 39F9 cmp cx, di 0 0000B935 7708 ja _.L48 0 0000B937 B108 mov cl, 8 0 0000B939 D3E8 shr ax, cl 0 0000B93B 39F8 cmp ax, di 0 0000B93D 73D1 jnc _.L49 534 _.L48: 454:nls.c **** if (ch >= (*t & 0xFF) && ch <= (*t >> 8)) 535 .loc 1 454 0 0 0000B93F 83C302 add bx, 2 537 _.LVL55: 0 0000B942 EBAD jmp _.L47 539 _.LVL56: 540 _.L52: 541 _.LBE85: 542 _.LBE86: 543 _.LBE89: 481:nls.c **** if (ch == nls->nochar) 544 .loc 1 481 0 0 0000B944 B80100 mov ax, 1 0 0000B947 EBDC jmp _.L45 547 _.L53: 483:nls.c **** return 2; 548 .loc 1 483 0 0 0000B949 31C0 xor ax, ax 0 0000B94B EBD8 jmp _.L45 551 _.LFE21: 552 .size _nlsYesNo, .-_nlsYesNo === Switch to base=012BB0h -> ".RODATA.STR1.1" 553 .section .rodata.str1.1,"aMS",@progbits,1 554 _.LC0: 0 00001A9E 070A6368616E6765 .string "\007\nchange codepage not yet done ska\n" 0 00001AA6 20636F6465706167 0 00001AAE 65206E6F74207965 0 00001AB6 7420646F6E652073 0 00001ABE 6B610A00 === Switch to base=002270h -> ".TEXT" 556 .text 557 .global _nlsCPchange 558 .type _nlsCPchange, @function 559 _nlsCPchange: 560 _.LFB12: 347:nls.c **** UNREFERENCED_PARAMETER(cp); 561 .loc 1 347 0 562 _.LVL57: 0 0000B94D 55 push bp 564 _.LCFI11: 0 0000B94E 89E5 mov bp, sp 566 _.LCFI12: 349:nls.c **** } 567 .loc 1 349 0 0 0000B950 C74604[0000] mov word ptr [bp+4], offset _.LC0 569 _.LVL58: 350:nls.c **** 570 .loc 1 350 0 0 0000B955 5D pop bp 349:nls.c **** } 572 .loc 1 349 0 0 0000B956 E9[FEFF] jmp _put_string 574 _.LVL59: 575 _.LFE12: 576 .size _nlsCPchange, .-_nlsCPchange 577 .global _DosYesNo 578 .type _DosYesNo, @function 579 _DosYesNo: 580 _.LFB22: 486:nls.c **** 487:nls.c **** /******************************************************************** 488:nls.c **** ***** DOS API ****************************************************** 489:nls.c **** ********************************************************************/ 490:nls.c **** 491:nls.c **** BYTE DosYesNo(UWORD ch) 492:nls.c **** /* returns: 0: ch == "No", 1: ch == "Yes", 2: ch crap */ 493:nls.c **** { 581 .loc 1 493 0 582 _.LVL60: 0 0000B959 56 push si 0 0000B95A 55 push bp 585 _.LCFI13: 0 0000B95B 89E5 mov bp, sp 587 _.LCFI14: 0 0000B95D 1E push ds 0 0000B95E 8B5606 mov dx, word ptr [bp+6] 494:nls.c **** if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_YESNO) 590 .loc 1 494 0 0 0000B961 BE[0000] mov si, offset _nlsInfo 0 0000B964 C45C08 les bx, dword ptr [si+8] 0 0000B967 268B4708 mov ax, word ptr es:[bx+8] 0 0000B96B 83E004 and ax, 4 0 0000B96E 740D je _.L58 495:nls.c **** return nlsYesNo(nlsInfo.actPkg, ch); 596 .loc 1 495 0 0 0000B970 52 push dx 0 0000B971 06 push es 0 0000B972 53 push bx 0 0000B973 E851FF call _nlsYesNo 601 _.LVL61: 602 _.L57: 496:nls.c **** else 497:nls.c **** return muxYesNo(ch); 498:nls.c **** } 603 .loc 1 498 0 0 0000B976 89EC mov sp, bp 0 0000B978 5D pop bp 0 0000B979 5E pop si 0 0000B97A C20200 ret 2 608 _.L58: 609 _.LVL62: 610 _.LBB94: 611 _.LBB95: 612 _.LBB96: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 613 .loc 1 114 0 0 0000B97D 50 push ax 0 0000B97E 50 push ax 0 0000B97F 50 push ax 0 0000B980 B82300 mov ax, 35 0 0000B983 50 push ax 0 0000B984 B8FFFF mov ax, -1 0 0000B987 50 push ax 0 0000B988 50 push ax 0 0000B989 52 push dx 0 0000B98A E8[FEFF] call _call_nls 624 _.LVL63: 625 _.LBE96: 626 _.LBE95: 627 _.LBE94: 497:nls.c **** } 628 .loc 1 497 0 0 0000B98D EBE7 jmp _.L57 630 _.LFE22: 631 .size _DosYesNo, .-_DosYesNo 632 .global _DosUpMem 633 .type _DosUpMem, @function 634 _DosUpMem: 635 _.LFB23: 499:nls.c **** 500:nls.c **** #ifndef DosUpMem 501:nls.c **** VOID DosUpMem(VOID FAR * str, unsigned len) 502:nls.c **** { 636 .loc 1 502 0 637 _.LVL64: 0 0000B98F 55 push bp 639 _.LCFI15: 0 0000B990 89E5 mov bp, sp 641 _.LCFI16: 503:nls.c **** xUpMem(nlsInfo.actPkg, str, len); 642 .loc 1 503 0 0 0000B992 FF7608 push word ptr [bp+8] 0 0000B995 FF7606 push word ptr [bp+6] 0 0000B998 FF7604 push word ptr [bp+4] 0 0000B99B BB[0000] mov bx, offset _nlsInfo 0 0000B99E FF770A push word ptr [bx+10] 0 0000B9A1 FF7708 push word ptr [bx+8] 0 0000B9A4 E8C4FE call _xUpMem 650 _.LVL65: 504:nls.c **** } 651 .loc 1 504 0 0 0000B9A7 89EC mov sp, bp 0 0000B9A9 5D pop bp 0 0000B9AA C20600 ret 6 655 _.LFE23: 656 .size _DosUpMem, .-_DosUpMem 657 .global _DosUpChar 658 .type _DosUpChar, @function 659 _DosUpChar: 660 _.LFB24: 505:nls.c **** #endif 506:nls.c **** 507:nls.c **** /* 508:nls.c **** * This function is also called by the backdoor entry specified by 509:nls.c **** * the "upCaseFct" member of the Country Information structure. Therefore 510:nls.c **** * the HiByte of the first argument must remain unchanged. 511:nls.c **** * See NLSSUPT.ASM -- 2000/03/30 ska 512:nls.c **** */ 513:nls.c **** unsigned char ASMCFUNC DosUpChar(unsigned char ch) 514:nls.c **** /* upcase a single character */ 515:nls.c **** { 661 .loc 1 515 0 662 _.LVL66: 0 0000B9AD 55 push bp 664 _.LCFI17: 0 0000B9AE 89E5 mov bp, sp 666 _.LCFI18: 667 _.LBB97: 668 _.LBB98: 173:../hdr/portab.h **** return ret; 669 .loc 2 173 0 670 #APP 671 ;# 173 "../hdr/portab.h" 1 672 mov ax, ss 673 ;# 0 "" 2 674 #NO_APP 675 _.LBE98: 676 _.LBE97: 516:nls.c **** log(("NLS: DosUpChar(): in ch=%u (%c)\n", ch, ch > 32 ? ch : ' ')); 517:nls.c **** DosUpMem(MK_FP(_SS, &ch), 1); 677 .loc 1 517 0 0 0000B9B2 BA0100 mov dx, 1 0 0000B9B5 52 push dx 0 0000B9B6 50 push ax 0 0000B9B7 8D4604 lea ax, [4+bp] 682 _.LVL67: 0 0000B9BA 50 push ax 0 0000B9BB E8[FEFF] call _DosUpMem 685 _.LVL68: 518:nls.c **** log(("NLS: DosUpChar(): upcased ch=%u (%c)\n", ch, ch > 32 ? ch : ' ')); 519:nls.c **** return ch; 520:nls.c **** } 686 .loc 1 520 0 0 0000B9BE 8A4604 mov al, byte ptr [bp+4] 0 0000B9C1 89EC mov sp, bp 0 0000B9C3 5D pop bp 0 0000B9C4 C3 ret 691 _.LFE24: 692 .size _DosUpChar, .-_DosUpChar 693 .global _DosUpString 694 .type _DosUpString, @function 695 _DosUpString: 696 _.LFB25: 521:nls.c **** 522:nls.c **** VOID DosUpString(char FAR * str) 523:nls.c **** /* upcase a string */ 524:nls.c **** { 697 .loc 1 524 0 698 _.LVL69: 0 0000B9C5 56 push si 0 0000B9C6 57 push di 0 0000B9C7 55 push bp 702 _.LCFI19: 0 0000B9C8 89E5 mov bp, sp 704 _.LCFI20: 0 0000B9CA 8B7608 mov si, word ptr [bp+8] 0 0000B9CD 8B7E0A mov di, word ptr [bp+10] 525:nls.c **** DosUpMem(str, fstrlen(str)); 707 .loc 1 525 0 0 0000B9D0 57 push di 0 0000B9D1 56 push si 0 0000B9D2 E8[FEFF] call _fstrlen 711 _.LVL70: 0 0000B9D5 50 push ax 0 0000B9D6 57 push di 0 0000B9D7 56 push si 0 0000B9D8 E8[FEFF] call _DosUpMem 716 _.LVL71: 526:nls.c **** } 717 .loc 1 526 0 0 0000B9DB 89EC mov sp, bp 0 0000B9DD 5D pop bp 0 0000B9DE 5F pop di 0 0000B9DF 5E pop si 0 0000B9E0 C20400 ret 4 723 _.LFE25: 724 .size _DosUpString, .-_DosUpString 725 .global _DosUpFMem 726 .type _DosUpFMem, @function 727 _DosUpFMem: 728 _.LFB26: 527:nls.c **** 528:nls.c **** VOID DosUpFMem(VOID FAR * str, unsigned len) 529:nls.c **** /* upcase a memory area for file names */ 530:nls.c **** { 729 .loc 1 530 0 730 _.LVL72: 0 0000B9E3 56 push si 0 0000B9E4 57 push di 0 0000B9E5 55 push bp 734 _.LCFI21: 0 0000B9E6 89E5 mov bp, sp 736 _.LCFI22: 0 0000B9E8 1E push ds 0 0000B9E9 8E5E08 mov ds, word ptr [bp+8] 0 0000B9EC 8B760A mov si, word ptr [bp+10] 0 0000B9EF 8B560C mov dx, word ptr [bp+12] 531:nls.c **** #ifdef NLS_DEBUG 532:nls.c **** unsigned c; 533:nls.c **** log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str), 534:nls.c **** FP_OFF(str))); 535:nls.c **** for (c = 0; c < len; ++c) 536:nls.c **** printf("%c", ((char FAR *)str)[c] > 32 ? ((char FAR *)str)[c] : '.'); 537:nls.c **** printf("\"\n"); 538:nls.c **** #endif 539:nls.c **** if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_FUPCASE) 741 .loc 1 539 0 0 0000B9F2 BF[0000] mov di, offset _nlsInfo 0 0000B9F5 36C45D08 les bx, dword ptr ss:[di+8] 0 0000B9F9 268B4708 mov ax, word ptr es:[bx+8] 0 0000B9FD 8946FE mov word ptr [bp-2], ax 0 0000BA00 83E002 and ax, 2 0 0000BA03 7425 je _.L68 748 _.LVL73: 749 _.LBB109: 750 _.LBB110: 751 _.LBB111: 752 _.LBB112: 277:nls.c **** do 753 .loc 1 277 0 0 0000BA05 85D2 test dx, dx 0 0000BA07 7417 je _.L67 0 0000BA09 52 push dx 0 0000BA0A 56 push si 0 0000BA0B 1E push ds 759 _.LBE112: 760 _.LBE111: 430:nls.c **** } 761 .loc 1 430 0 0 0000BA0C 268B4716 mov ax, word ptr es:[bx+22] 0 0000BA10 8946FE mov word ptr [bp-2], ax 0 0000BA13 83C082 add ax, -126 765 _.LBB114: 766 _.LBB113: 0 0000BA16 26FF7718 push word ptr es:[bx+24] 0 0000BA1A 50 push ax 0 0000BA1B 16 push ss 0 0000BA1C 1F pop ds 0 0000BA1D E80CFE call _upMMem.part.0 772 _.LVL74: 773 _.L67: 774 _.LBE113: 775 _.LBE114: 776 _.LBE110: 777 _.LBE109: 540:nls.c **** nlsFUpMem(nlsInfo.actPkg, str, len); 541:nls.c **** else 542:nls.c **** muxUpMem(NLSFUNC_FILE_UPMEM, str, len); 543:nls.c **** } 778 .loc 1 543 0 0 0000BA20 89EC mov sp, bp 0 0000BA22 5D pop bp 0 0000BA23 5F pop di 0 0000BA24 5E pop si 0 0000BA25 16 push ss 0 0000BA26 1F pop ds 0 0000BA27 C20600 ret 6 786 _.LVL75: 787 _.L68: 788 _.LBB115: 789 _.LBB116: 790 _.LBB117: 791 _.LBB118: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 792 .loc 1 114 0 0 0000BA2A 50 push ax 0 0000BA2B 56 push si 0 0000BA2C 1E push ds 0 0000BA2D B8A200 mov ax, 162 0 0000BA30 50 push ax 0 0000BA31 B8FFFF mov ax, -1 0 0000BA34 50 push ax 0 0000BA35 50 push ax 0 0000BA36 52 push dx 0 0000BA37 16 push ss 0 0000BA38 1F pop ds 804 _.LVL76: 0 0000BA39 E8[FEFF] call _call_nls 806 _.LVL77: 807 _.LBE118: 808 _.LBE117: 809 _.LBE116: 810 _.LBE115: 811 .loc 1 543 0 0 0000BA3C EBE2 jmp _.L67 813 _.LFE26: 814 .size _DosUpFMem, .-_DosUpFMem 815 .global _DosUpFChar 816 .type _DosUpFChar, @function 817 _DosUpFChar: 818 _.LFB27: 544:nls.c **** 545:nls.c **** unsigned char DosUpFChar(unsigned char ch) 546:nls.c **** /* upcase a single character for file names */ 547:nls.c **** { 819 .loc 1 547 0 820 _.LVL78: 0 0000BA3E 55 push bp 822 _.LCFI23: 0 0000BA3F 89E5 mov bp, sp 824 _.LCFI24: 825 _.LBB119: 826 _.LBB120: 173:../hdr/portab.h **** return ret; 827 .loc 2 173 0 828 #APP 829 ;# 173 "../hdr/portab.h" 1 830 mov ax, ss 831 ;# 0 "" 2 832 #NO_APP 833 _.LBE120: 834 _.LBE119: 548:nls.c **** DosUpFMem(MK_FP(_SS, & ch), 1); 835 .loc 1 548 0 0 0000BA43 BA0100 mov dx, 1 0 0000BA46 52 push dx 0 0000BA47 50 push ax 0 0000BA48 8D4604 lea ax, [4+bp] 840 _.LVL79: 0 0000BA4B 50 push ax 0 0000BA4C E8[FEFF] call _DosUpFMem 843 _.LVL80: 549:nls.c **** return ch; 550:nls.c **** } 844 .loc 1 550 0 0 0000BA4F 8A4604 mov al, byte ptr [bp+4] 0 0000BA52 89EC mov sp, bp 0 0000BA54 5D pop bp 0 0000BA55 C20200 ret 2 849 _.LFE27: 850 .size _DosUpFChar, .-_DosUpFChar 851 .global _DosUpFString 852 .type _DosUpFString, @function 853 _DosUpFString: 854 _.LFB28: 551:nls.c **** 552:nls.c **** VOID DosUpFString(char FAR * str) 553:nls.c **** /* upcase a string for file names */ 554:nls.c **** { 855 .loc 1 554 0 856 _.LVL81: 0 0000BA58 56 push si 0 0000BA59 57 push di 0 0000BA5A 55 push bp 860 _.LCFI25: 0 0000BA5B 89E5 mov bp, sp 862 _.LCFI26: 0 0000BA5D 8B7608 mov si, word ptr [bp+8] 0 0000BA60 8B7E0A mov di, word ptr [bp+10] 555:nls.c **** DosUpFMem(str, fstrlen(str)); 865 .loc 1 555 0 0 0000BA63 57 push di 0 0000BA64 56 push si 0 0000BA65 E8[FEFF] call _fstrlen 869 _.LVL82: 0 0000BA68 50 push ax 0 0000BA69 57 push di 0 0000BA6A 56 push si 0 0000BA6B E8[FEFF] call _DosUpFMem 874 _.LVL83: 556:nls.c **** } 875 .loc 1 556 0 0 0000BA6E 89EC mov sp, bp 0 0000BA70 5D pop bp 0 0000BA71 5F pop di 0 0000BA72 5E pop si 0 0000BA73 C20400 ret 4 881 _.LFE28: 882 .size _DosUpFString, .-_DosUpFString 883 .global _DosGetData 884 .type _DosGetData, @function 885 _DosGetData: 886 _.LFB29: 557:nls.c **** 558:nls.c **** /* 559:nls.c **** * Called for all subfunctions other than 0x20-0x23,& 0xA0-0xA2 560:nls.c **** * of DOS-65 561:nls.c **** * 562:nls.c **** * If the requested NLS pkg specified via cntry and cp is _not_ 563:nls.c **** * loaded, MUX-14 is invoked; otherwise the pkg's NLS_Fct_buf 564:nls.c **** * function is invoked. 565:nls.c **** */ 566:nls.c **** COUNT DosGetData(int subfct, UWORD cp, UWORD cntry, UWORD bufsize, 567:nls.c **** VOID FAR * buf) 568:nls.c **** { 887 .loc 1 568 0 888 _.LVL84: 0 0000BA76 56 push si 0 0000BA77 57 push di 0 0000BA78 55 push bp 892 _.LCFI27: 0 0000BA79 89E5 mov bp, sp 894 _.LCFI28: 0 0000BA7B 83EC08 sub sp, 8 0 0000BA7E C47E08 les di, dword ptr [bp+8] 0 0000BA81 8B760C mov si, word ptr [bp+12] 0 0000BA84 8B460E mov ax, word ptr [bp+14] 0 0000BA87 8946FE mov word ptr [bp-2], ax 0 0000BA8A 8B4610 mov ax, word ptr [bp+16] 0 0000BA8D 8946FC mov word ptr [bp-4], ax 0 0000BA90 8B4E12 mov cx, word ptr [bp+18] 569:nls.c **** struct nlsPackage FAR *nls; /* NLS package to use to return the info from */ 570:nls.c **** 571:nls.c **** log(("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n", 572:nls.c **** subfct, cp, cntry, bufsize)); 573:nls.c **** 574:nls.c **** if (!buf || !bufsize) 903 .loc 1 574 0 0 0000BA93 09C8 or ax, cx 0 0000BA95 894EF8 mov word ptr [bp-8], cx 0 0000BA98 747C je _.L84 0 0000BA9A 837EFE01 cmp word ptr [bp-2], 1 0 0000BA9E 7276 jc _.L84 575:nls.c **** return DE_INVLDDATA; 576:nls.c **** if (subfct == 0) /* Currently not supported */ 909 .loc 1 576 0 0 0000BAA0 85FF test di, di 0 0000BAA2 7477 je _.L85 577:nls.c **** return DE_INVLDFUNC; 578:nls.c **** 579:nls.c **** /* nls := NLS package of cntry/codepage */ 580:nls.c **** if ((nls = searchPackage(cp, cntry)) != NULL) 912 .loc 1 580 0 0 0000BAA4 56 push si 0 0000BAA5 06 push es 0 0000BAA6 8C46FA mov word ptr [bp-6], es 0 0000BAA9 E863FC call _searchPackage 917 _.LVL85: 0 0000BAAC 89C3 mov bx, ax 0 0000BAAE 09D0 or ax, dx 0 0000BAB0 C44EF8 les cx, dword ptr [bp-8] 0 0000BAB3 7434 je _.L80 581:nls.c **** { 582:nls.c **** /* matching NLS package found */ 583:nls.c **** if (nls->flags & NLS_FLAG_DIRECT_GETDATA) 922 .loc 1 583 0 0 0000BAB5 8EC2 mov es, dx 0 0000BAB7 26F6470808 test byte ptr es:[bx+8], 8 0 0000BABC 7420 je _.L82 584:nls.c **** /* Direct access to the data */ 585:nls.c **** return nlsGetData(nls, subfct, buf, bufsize); 926 .loc 1 585 0 0 0000BABE 8B46FE mov ax, word ptr [bp-2] 0 0000BAC1 894612 mov word ptr [bp+18], ax 0 0000BAC4 8B46FC mov ax, word ptr [bp-4] 0 0000BAC7 89460E mov word ptr [bp+14], ax 931 _.LVL86: 0 0000BACA 894E10 mov word ptr [bp+16], cx 0 0000BACD 897E0C mov word ptr [bp+12], di 0 0000BAD0 895E08 mov word ptr [bp+8], bx 935 _.LVL87: 0 0000BAD3 89560A mov word ptr [bp+10], dx 937 _.LVL88: 586:nls.c **** cp = nls->cp; 587:nls.c **** cntry = nls->cntry; 588:nls.c **** } 589:nls.c **** 590:nls.c **** /* If the NLS pkg is not loaded into memory or the direct-access 591:nls.c **** flag is disabled, the request must be passed through MUX */ 592:nls.c **** return (subfct == NLS_DOS_38) 593:nls.c **** ? mux38(cp, cntry, bufsize, buf) 594:nls.c **** : mux65(subfct, cp, cntry, bufsize, buf); 595:nls.c **** } 938 .loc 1 595 0 0 0000BAD6 89EC mov sp, bp 0 0000BAD8 5D pop bp 0 0000BAD9 5F pop di 0 0000BADA 5E pop si 585:nls.c **** cp = nls->cp; 943 .loc 1 585 0 0 0000BADB E9C3FC jmp _nlsGetData 945 _.LVL89: 946 _.L82: 586:nls.c **** cp = nls->cp; 947 .loc 1 586 0 0 0000BADE 8EC2 mov es, dx 0 0000BAE0 268E4706 mov es, word ptr es:[bx+6] 950 _.LVL90: 587:nls.c **** } 951 .loc 1 587 0 0 0000BAE4 8EDA mov ds, dx 0 0000BAE6 8B7704 mov si, word ptr [bx+4] 954 _.LVL91: 955 _.L80: 594:nls.c **** } 956 .loc 1 594 0 0 0000BAE9 81FF0101 cmp di, 257 0 0000BAED 751D jne _.L83 959 _.LVL92: 960 _.LBB129: 961 _.LBB130: 962 _.LBB131: 963 _.LBB132: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 964 .loc 1 114 0 0 0000BAEF 31C0 xor ax, ax 0 0000BAF1 50 push ax 0 0000BAF2 51 push cx 0 0000BAF3 FF76FC push word ptr [bp-4] 0 0000BAF6 B80400 mov ax, 4 970 _.LVL93: 971 _.L90: 972 _.LBE132: 973 _.LBE131: 974 _.LBE130: 975 _.LBE129: 976 _.LBB133: 977 _.LBB134: 978 _.LBB135: 979 _.LBB136: 0 0000BAF9 50 push ax 0 0000BAFA 06 push es 0 0000BAFB 56 push si 0 0000BAFC FF76FE push word ptr [bp-2] 0 0000BAFF 16 push ss 0 0000BB00 1F pop ds 0 0000BB01 E8[FEFF] call _call_nls 987 _.LVL94: 988 _.L78: 989 _.LBE136: 990 _.LBE135: 991 _.LBE134: 992 _.LBE133: 993 .loc 1 595 0 0 0000BB04 89EC mov sp, bp 0 0000BB06 5D pop bp 0 0000BB07 5F pop di 0 0000BB08 5E pop si 0 0000BB09 C20C00 ret 12 999 _.LVL95: 1000 _.L83: 1001 _.LBB140: 1002 _.LBB139: 1003 _.LBB138: 1004 _.LBB137: 114:nls.c **** log(("NLS: muxGo(): return value = %lx\n", ret)); 1005 .loc 1 114 0 0 0000BB0C 57 push di 0 0000BB0D 51 push cx 0 0000BB0E FF76FC push word ptr [bp-4] 0 0000BB11 B80200 mov ax, 2 0 0000BB14 EBE3 jmp _.L90 1011 _.LVL96: 1012 _.L84: 1013 _.LBE137: 1014 _.LBE138: 1015 _.LBE139: 1016 _.LBE140: 575:nls.c **** if (subfct == 0) /* Currently not supported */ 1017 .loc 1 575 0 0 0000BB16 B8F3FF mov ax, -13 0 0000BB19 EBE9 jmp _.L78 1020 _.L85: 577:nls.c **** 1021 .loc 1 577 0 0 0000BB1B B8FFFF mov ax, -1 0 0000BB1E EBE4 jmp _.L78 1024 _.LFE29: 1025 .size _DosGetData, .-_DosGetData 1026 .global _DosGetCountryInformation 1027 .type _DosGetCountryInformation, @function 1028 _DosGetCountryInformation: 1029 _.LFB30: 596:nls.c **** 597:nls.c **** /* 598:nls.c **** * Called for DOS-38 get info 599:nls.c **** * 600:nls.c **** * Note: DOS-38 does not receive the size of the buffer; therefore 601:nls.c **** * it is assumed the buffer is large enough as described in RBIL, 602:nls.c **** * which is 34 bytes _hardcoded_. 603:nls.c **** */ 604:nls.c **** /* TE 05/04/01 605:nls.c **** * NETX calls Int 21 AX=3800 606:nls.c **** * and gives a buffer of (at most) 0x20 bytes 607:nls.c **** * MSDOS 6.2 copies only 0x18 bytes 608:nls.c **** * RBIL documents 0x18 bytes and calls 10 bytes 'reserved' 609:nls.c **** * so we change the amount of copied bytes to 0x18 610:nls.c **** */ 611:nls.c **** 612:nls.c **** #ifndef DosGetCountryInformation 613:nls.c **** COUNT DosGetCountryInformation(UWORD cntry, VOID FAR * buf) 614:nls.c **** { 1030 .loc 1 614 0 1031 _.LVL97: 0 0000BB20 55 push bp 1033 _.LCFI29: 0 0000BB21 89E5 mov bp, sp 1035 _.LCFI30: 615:nls.c **** return DosGetData(NLS_DOS_38, NLS_DEFAULT, cntry, 0x18, buf); 1036 .loc 1 615 0 0 0000BB23 FF7608 push word ptr [bp+8] 0 0000BB26 FF7606 push word ptr [bp+6] 0 0000BB29 B81800 mov ax, 24 0 0000BB2C 50 push ax 0 0000BB2D FF7604 push word ptr [bp+4] 0 0000BB30 B8FFFF mov ax, -1 0 0000BB33 50 push ax 0 0000BB34 B80101 mov ax, 257 0 0000BB37 50 push ax 0 0000BB38 E8[FEFF] call _DosGetData 1047 _.LVL98: 616:nls.c **** } 1048 .loc 1 616 0 0 0000BB3B 89EC mov sp, bp 0 0000BB3D 5D pop bp 0 0000BB3E C20600 ret 6 1052 _.LFE30: 1053 .size _DosGetCountryInformation, .-_DosGetCountryInformation 1054 .global _DosSetCountry 1055 .type _DosSetCountry, @function 1056 _DosSetCountry: 1057 _.LFB31: 617:nls.c **** #endif 618:nls.c **** 619:nls.c **** /* 620:nls.c **** * Called for DOS-38 set country code 621:nls.c **** */ 622:nls.c **** #ifndef DosSetCountry 623:nls.c **** COUNT DosSetCountry(UWORD cntry) 624:nls.c **** { 1058 .loc 1 624 0 1059 _.LVL99: 0 0000BB41 56 push si 0 0000BB42 57 push di 0 0000BB43 55 push bp 1063 _.LCFI31: 0 0000BB44 89E5 mov bp, sp 1065 _.LCFI32: 0 0000BB46 8B7608 mov si, word ptr [bp+8] 1067 _.LVL100: 1068 _.LBB145: 1069 _.LBB146: 414:nls.c **** /* OK the NLS pkg is loaded --> activate it */ 1070 .loc 1 414 0 0 0000BB49 56 push si 0 0000BB4A BFFFFF mov di, -1 0 0000BB4D 57 push di 0 0000BB4E E8BEFB call _searchPackage 1075 _.LVL101: 0 0000BB51 89C1 mov cx, ax 0 0000BB53 09D1 or cx, dx 0 0000BB55 7413 je _.L94 1079 _.LVL102: 1080 _.LBB147: 1081 _.LBB148: 405:nls.c **** 1082 .loc 1 405 0 0 0000BB57 BB[0000] mov bx, offset _nlsInfo 0 0000BB5A 894708 mov word ptr [bx+8], ax 0 0000BB5D 89570A mov word ptr [bx+10], dx 1086 _.LVL103: 1087 _.LBE148: 1088 _.LBE147: 416:nls.c **** 1089 .loc 1 416 0 0 0000BB60 31C0 xor ax, ax 1091 _.LVL104: 1092 _.L93: 1093 _.LBE146: 1094 _.LBE145: 625:nls.c **** return DosLoadPackage(NLS_DEFAULT, cntry); 626:nls.c **** } 1095 .loc 1 626 0 0 0000BB62 89EC mov sp, bp 0 0000BB64 5D pop bp 0 0000BB65 5F pop di 0 0000BB66 5E pop si 0 0000BB67 C20200 ret 2 1101 _.LVL105: 1102 _.L94: 1103 _.LBB150: 1104 _.LBB149: 419:nls.c **** } 1105 .loc 1 419 0 0 0000BB6A 56 push si 0 0000BB6B 57 push di 0 0000BB6C B80300 mov ax, 3 1109 _.LVL106: 0 0000BB6F 50 push ax 0 0000BB70 E8ECFB call _muxLoadPkg 1112 _.LVL107: 1113 _.LBE149: 1114 _.LBE150: 625:nls.c **** return DosLoadPackage(NLS_DEFAULT, cntry); 1115 .loc 1 625 0 0 0000BB73 EBED jmp _.L93 1117 _.LFE31: 1118 .size _DosSetCountry, .-_DosSetCountry 1119 .global _DosGetCodepage 1120 .type _DosGetCodepage, @function 1121 _DosGetCodepage: 1122 _.LFB32: 627:nls.c **** #endif 628:nls.c **** 629:nls.c **** /* 630:nls.c **** * Called for DOS-66-01 get CP 631:nls.c **** */ 632:nls.c **** COUNT DosGetCodepage(UWORD * actCP, UWORD * sysCP) 633:nls.c **** { 1123 .loc 1 633 0 1124 _.LVL108: 0 0000BB75 56 push si 0 0000BB76 55 push bp 1127 _.LCFI33: 0 0000BB77 89E5 mov bp, sp 1129 _.LCFI34: 634:nls.c **** *sysCP = nlsInfo.sysCodePage; 1130 .loc 1 634 0 0 0000BB79 BE[0000] mov si, offset _nlsInfo 0 0000BB7C 8B4404 mov ax, word ptr [si+4] 0 0000BB7F 8B5E08 mov bx, word ptr [bp+8] 0 0000BB82 8907 mov word ptr [bx], ax 635:nls.c **** *actCP = nlsInfo.actPkg->cp; 1135 .loc 1 635 0 0 0000BB84 C45C08 les bx, dword ptr [si+8] 0 0000BB87 268B4706 mov ax, word ptr es:[bx+6] 0 0000BB8B 8B5E06 mov bx, word ptr [bp+6] 0 0000BB8E 8907 mov word ptr [bx], ax 636:nls.c **** return SUCCESS; 637:nls.c **** } 1140 .loc 1 637 0 0 0000BB90 31C0 xor ax, ax 0 0000BB92 5D pop bp 0 0000BB93 5E pop si 0 0000BB94 C20400 ret 4 1145 _.LFE32: 1146 .size _DosGetCodepage, .-_DosGetCodepage 1147 .global _DosSetCodepage 1148 .type _DosSetCodepage, @function 1149 _DosSetCodepage: 1150 _.LFB33: 638:nls.c **** 639:nls.c **** /* 640:nls.c **** * Called for DOS-66-02 set CP 641:nls.c **** * Note: One cannot change the system CP. Why it is necessary 642:nls.c **** * to specify it, is lost to me. (2000/02/13 ska) 643:nls.c **** */ 644:nls.c **** COUNT DosSetCodepage(UWORD actCP, UWORD sysCP) 645:nls.c **** { 1151 .loc 1 645 0 1152 _.LVL109: 0 0000BB97 55 push bp 1154 _.LCFI35: 0 0000BB98 89E5 mov bp, sp 1156 _.LCFI36: 0 0000BB9A 8B4606 mov ax, word ptr [bp+6] 646:nls.c **** if (sysCP == NLS_DEFAULT || sysCP == nlsInfo.sysCodePage) 1158 .loc 1 646 0 0 0000BB9D 83F8FF cmp ax, -1 0 0000BBA0 7406 je _.L101 1161 .loc 1 646 0 is_stmt 0 discriminator 1 0 0000BBA2 3B06[0400] cmp ax, word ptr [_nlsInfo+4] 0 0000BBA6 7514 jne _.L103 1164 _.L101: 1165 _.LVL110: 1166 _.LBB153: 1167 _.LBB154: 399:nls.c **** } 1168 .loc 1 399 0 is_stmt 1 0 0000BBA8 B8FFFF mov ax, -1 0 0000BBAB 50 push ax 0 0000BBAC FF7604 push word ptr [bp+4] 0 0000BBAF B80100 mov ax, 1 0 0000BBB2 50 push ax 0 0000BBB3 E8A9FB call _muxLoadPkg 1175 _.LVL111: 1176 _.L100: 1177 _.LBE154: 1178 _.LBE153: 647:nls.c **** return DosSetPackage(actCP, NLS_DEFAULT); 648:nls.c **** return DE_INVLDDATA; 649:nls.c **** } 1179 .loc 1 649 0 0 0000BBB6 89EC mov sp, bp 0 0000BBB8 5D pop bp 0 0000BBB9 C20400 ret 4 1183 _.LVL112: 1184 _.L103: 648:nls.c **** } 1185 .loc 1 648 0 0 0000BBBC B8F3FF mov ax, -13 1187 _.LVL113: 0 0000BBBF EBF5 jmp _.L100 1189 _.LFE33: 1190 .size _DosSetCodepage, .-_DosSetCodepage 1191 .global _DosGetDBCS 1192 .type _DosGetDBCS, @function 1193 _DosGetDBCS: 1194 _.LFB34: 650:nls.c **** 651:nls.c **** VOID FAR *DosGetDBCS(void) 652:nls.c **** { 1195 .loc 1 652 0 0 0000BBC1 56 push si 1197 _.LCFI37: 653:nls.c **** return getTable7(nlsInfo.actPkg); 1198 .loc 1 653 0 0 0000BBC2 BE[0000] mov si, offset _nlsInfo 0 0000BBC5 C45C08 les bx, dword ptr [si+8] 0 0000BBC8 268B4725 mov ax, word ptr es:[bx+37] 0 0000BBCC 268B5727 mov dx, word ptr es:[bx+39] 654:nls.c **** } 1203 .loc 1 654 0 0 0000BBD0 5E pop si 0 0000BBD1 C3 ret 1206 _.LFE34: 1207 .size _DosGetDBCS, .-_DosGetDBCS 1208 .global _syscall_MUX14 1209 .type _syscall_MUX14, @function 1210 _syscall_MUX14: 1211 _.LFB35: 655:nls.c **** 656:nls.c **** /******************************************************************** 657:nls.c **** ***** MUX-14 API *************************************************** 658:nls.c **** ********************************************************************/ 659:nls.c **** 660:nls.c **** /* This is the kernel's default NLSFUNC multiplex int 2F/14 (MUX-14) 661:nls.c **** handling. If made it here then no other program has hooked MUX-14 662:nls.c **** and handled request -- either none loaded or choose to pass request 663:nls.c **** on. 664:nls.c **** 665:nls.c **** Registers: 666:nls.c **** AH == 14 667:nls.c **** AL == subfunction 668:nls.c **** BX == codepage 669:nls.c **** DX == country code 670:nls.c **** DS:SI == internal global nlsInfo 671:nls.c **** ES:DI == user block 672:nls.c **** 673:nls.c **** Return value: AL register to be returned 674:nls.c **** if AL == 0, Carry must be cleared, otherwise set 675:nls.c **** */ 676:nls.c **** UWORD ASMCFUNC syscall_MUX14(iregs FAR *pr) 677:nls.c **** { 1212 .loc 1 677 0 1213 _.LVL114: 0 0000BBD2 56 push si 0 0000BBD3 57 push di 0 0000BBD4 55 push bp 1217 _.LCFI38: 0 0000BBD5 89E5 mov bp, sp 1219 _.LCFI39: 0 0000BBD7 1E push ds 678:nls.c **** struct nlsPackage FAR *nls; /* addressed NLS package */ 679:nls.c **** 680:nls.c **** log(("NLS: MUX14(): subfct=%x, cp=%u, cntry=%u\n", pr->AL, pr->BX, pr->DX)); 681:nls.c **** 682:nls.c **** if ((nls = searchPackage(pr->BX, pr->DX)) == NULL) 1221 .loc 1 682 0 0 0000BBD8 C45E08 les bx, dword ptr [bp+8] 0 0000BBDB 8CC6 mov si, es 0 0000BBDD 26FF7706 push word ptr es:[bx+6] 0 0000BBE1 26FF7702 push word ptr es:[bx+2] 0 0000BBE5 895EFE mov word ptr [bp-2], bx 0 0000BBE8 E824FB call _searchPackage 1228 _.LVL115: 0 0000BBEB 89C7 mov di, ax 1230 _.LVL116: 0 0000BBED 09D0 or ax, dx 1232 _.LVL117: 0 0000BBEF 7428 je _.L126 683:nls.c **** return DE_INVLDFUNC; /* no such package */ 684:nls.c **** 685:nls.c **** log(("NLS: MUX14(): NLS pkg found\n")); 686:nls.c **** 687:nls.c **** switch (pr->AL) 1234 .loc 1 687 0 0 0000BBF1 8EC6 mov es, si 0 0000BBF3 8B5EFE mov bx, word ptr [bp-2] 0 0000BBF6 268A07 mov al, byte ptr es:[bx] 0 0000BBF9 3C04 cmp al, 4 0 0000BBFB 7503E98600 je _.L113 0 0000BC00 771D ja _.L114 0 0000BC02 3C01 cmp al, 1 0 0000BC04 7503E9BB00 je _.L115 0 0000BC09 726F jc _.L116 0 0000BC0B 3C02 cmp al, 2 0 0000BC0D 7503E98900 je _.L117 0 0000BC12 3C03 cmp al, 3 0 0000BC14 7503E9A000 je _.L118 1248 _.L126: 688:nls.c **** { 689:nls.c **** case NLSFUNC_INSTALL_CHECK: 690:nls.c **** pr->BX = NLS_FREEDOS_NLSFUNC_ID; 691:nls.c **** return SUCCESS; /* kernel just simulates default functions */ 692:nls.c **** case NLSFUNC_DOS38: 693:nls.c **** return nlsGetData(nls, NLS_DOS_38, MK_FP(pr->ES, pr->DI), 34); 694:nls.c **** case NLSFUNC_GETDATA: 695:nls.c **** return nlsGetData(nls, pr->BP, MK_FP(pr->ES, pr->DI), pr->CX); 696:nls.c **** case NLSFUNC_DRDOS_GETDATA: 697:nls.c **** /* Does not pass buffer length */ 698:nls.c **** return nlsGetData(nls, pr->CL, MK_FP(pr->ES, pr->DI), 512); 699:nls.c **** case NLSFUNC_LOAD_PKG: 700:nls.c **** return nlsLoadPackage(nls); 701:nls.c **** case NLSFUNC_LOAD_PKG2: 702:nls.c **** return nlsSetPackage(nls); 703:nls.c **** case NLSFUNC_YESNO: 704:nls.c **** return nlsYesNo(nls, pr->CX); 705:nls.c **** case NLSFUNC_UPMEM: 706:nls.c **** nlsUpMem(nls, MK_FP(pr->ES, pr->DI), pr->CX); 707:nls.c **** return SUCCESS; 708:nls.c **** case NLSFUNC_FILE_UPMEM: 709:nls.c **** #ifdef NLS_DEBUG 710:nls.c **** { 711:nls.c **** unsigned j; 712:nls.c **** BYTE FAR *p; 713:nls.c **** log(("NLS: MUX14(FILE_UPMEM): len=%u, %04x:%04x=\"", pr->CX, 714:nls.c **** pr->ES, pr->DI)); 715:nls.c **** for (j = 0, p = MK_FP(pr->ES, pr->DI); j < pr->CX; ++j) 716:nls.c **** printf("%c", p[j] > 32 ? p[j] : '.'); 717:nls.c **** printf("\"\n"); 718:nls.c **** } 719:nls.c **** #endif 720:nls.c **** nlsFUpMem(nls, MK_FP(pr->ES, pr->DI), pr->CX); 721:nls.c **** return SUCCESS; 722:nls.c **** } 723:nls.c **** log(("NLS: MUX14(): Invalid function %x\n", pr->AL)); 724:nls.c **** return DE_INVLDFUNC; /* no such function */ 1249 .loc 1 724 0 0 0000BC19 B8FFFF mov ax, -1 0 0000BC1C E99400 jmp _.L110 1252 _.L114: 687:nls.c **** { 1253 .loc 1 687 0 0 0000BC1F 3C23 cmp al, 35 0 0000BC21 7503E9C800 je _.L119 0 0000BC26 7730 ja _.L120 0 0000BC28 3C22 cmp al, 34 0 0000BC2A 75ED jne _.L126 706:nls.c **** return SUCCESS; 1259 .loc 1 706 0 0 0000BC2C 8EC6 mov es, si 0 0000BC2E 268B4F04 mov cx, word ptr es:[bx+4] 1262 _.LVL118: 707:nls.c **** case NLSFUNC_FILE_UPMEM: 1263 .loc 1 707 0 0 0000BC32 89C8 mov ax, cx 1265 _.LBB169: 1266 _.LBB170: 1267 _.LBB171: 1268 _.LBB172: 277:nls.c **** do 1269 .loc 1 277 0 0 0000BC34 85C9 test cx, cx 0 0000BC36 747B je _.L110 1272 _.LVL119: 0 0000BC38 51 push cx 1274 _.LVL120: 1275 _.LBE172: 1276 _.LBE171: 1277 _.LBE170: 1278 _.LBE169: 706:nls.c **** return SUCCESS; 1279 .loc 1 706 0 0 0000BC39 268B470A mov ax, word ptr es:[bx+10] 1281 _.LBB178: 1282 _.LBB177: 1283 _.LBB175: 1284 _.LBB173: 0 0000BC3D 26FF7710 push word ptr es:[bx+16] 0 0000BC41 50 push ax 1287 _.LBE173: 1288 _.LBE175: 425:nls.c **** } 1289 .loc 1 425 0 0 0000BC42 8EC2 mov es, dx 0 0000BC44 268B4511 mov ax, word ptr es:[di+17] 0 0000BC48 8946FE mov word ptr [bp-2], ax 0 0000BC4B 83C082 add ax, -126 1294 _.LBB176: 1295 _.LBB174: 0 0000BC4E 26FF7513 push word ptr es:[di+19] 1297 _.LVL121: 1298 _.L133: 1299 _.LBE174: 1300 _.LBE176: 1301 _.LBE177: 1302 _.LBE178: 1303 _.LBB179: 1304 _.LBB180: 1305 _.LBB181: 1306 _.LBB182: 0 0000BC52 50 push ax 0 0000BC53 E8D6FB call _upMMem.part.0 1309 _.LVL122: 0 0000BC56 EB2A jmp _.L130 1311 _.LVL123: 1312 _.L120: 1313 _.LBE182: 1314 _.LBE181: 1315 _.LBE180: 1316 _.LBE179: 687:nls.c **** { 1317 .loc 1 687 0 0 0000BC58 3CA2 cmp al, -94 0 0000BC5A 7503E99C00 je _.L122 0 0000BC5F 3CFE cmp al, -2 0 0000BC61 75B6 jne _.L126 698:nls.c **** case NLSFUNC_LOAD_PKG: 1322 .loc 1 698 0 0 0000BC63 B80002 mov ax, 512 0 0000BC66 50 push ax 0 0000BC67 8EC6 mov es, si 0 0000BC69 268B470A mov ax, word ptr es:[bx+10] 0 0000BC6D 26FF7710 push word ptr es:[bx+16] 0 0000BC71 50 push ax 0 0000BC72 268A4704 mov al, byte ptr es:[bx+4] 0 0000BC76 30E4 xor ah, ah 0 0000BC78 EB1E jmp _.L132 1332 _.L116: 690:nls.c **** return SUCCESS; /* kernel just simulates default functions */ 1333 .loc 1 690 0 0 0000BC7A 8EC6 mov es, si 0 0000BC7C 26C747024B53 mov word ptr es:[bx+2], 21323 1336 _.LVL124: 1337 _.L130: 700:nls.c **** case NLSFUNC_LOAD_PKG2: 1338 .loc 1 700 0 0 0000BC82 31C0 xor ax, ax 0 0000BC84 EB2D jmp _.L110 1341 _.LVL125: 1342 _.L113: 693:nls.c **** case NLSFUNC_GETDATA: 1343 .loc 1 693 0 0 0000BC86 B82200 mov ax, 34 0 0000BC89 50 push ax 0 0000BC8A 8EC6 mov es, si 0 0000BC8C 268B470A mov ax, word ptr es:[bx+10] 0 0000BC90 26FF7710 push word ptr es:[bx+16] 0 0000BC94 50 push ax 0 0000BC95 B80101 mov ax, 257 1351 _.L132: 698:nls.c **** case NLSFUNC_LOAD_PKG: 1352 .loc 1 698 0 0 0000BC98 50 push ax 0 0000BC99 EB13 jmp _.L131 1355 _.L117: 695:nls.c **** case NLSFUNC_DRDOS_GETDATA: 1356 .loc 1 695 0 0 0000BC9B 8EC6 mov es, si 0 0000BC9D 26FF7704 push word ptr es:[bx+4] 0 0000BCA1 268B470A mov ax, word ptr es:[bx+10] 0 0000BCA5 26FF7710 push word ptr es:[bx+16] 0 0000BCA9 50 push ax 0 0000BCAA 26FF770C push word ptr es:[bx+12] 1363 _.L131: 0 0000BCAE 52 push dx 0 0000BCAF 57 push di 0 0000BCB0 E8EEFA call _nlsGetData 1367 _.LVL126: 1368 _.L110: 725:nls.c **** } 1369 .loc 1 725 0 0 0000BCB3 89EC mov sp, bp 0 0000BCB5 5D pop bp 0 0000BCB6 5F pop di 0 0000BCB7 5E pop si 0 0000BCB8 C3 ret 1375 _.LVL127: 1376 _.L118: 1377 _.LBB191: 1378 _.LBB192: 405:nls.c **** 1379 .loc 1 405 0 0 0000BCB9 BB[0000] mov bx, offset _nlsInfo 0 0000BCBC 897F08 mov word ptr [bx+8], di 0 0000BCBF 89570A mov word ptr [bx+10], dx 0 0000BCC2 EBBE jmp _.L130 1384 _.LVL128: 1385 _.L115: 1386 _.LBE192: 1387 _.LBE191: 1388 _.LBB193: 1389 _.LBB194: 375:nls.c **** inform all character drivers thereabout. 1390 .loc 1 375 0 0 0000BCC4 BE[0000] mov si, offset _nlsInfo 0 0000BCC7 8B5C08 mov bx, word ptr [si+8] 0 0000BCCA 8EC2 mov es, dx 0 0000BCCC 268B4506 mov ax, word ptr es:[di+6] 0 0000BCD0 8E440A mov es, word ptr [si+10] 0 0000BCD3 263B4706 cmp ax, word ptr es:[bx+6] 0 0000BCD7 740D je _.L124 0 0000BCD9 8956FE mov word ptr [bp-2], dx 1399 _.LVL129: 1400 _.LBB195: 1401 _.LBB196: 349:nls.c **** } 1402 .loc 1 349 0 0 0000BCDC B8[0000] mov ax, offset _.LC0 0 0000BCDF 50 push ax 0 0000BCE0 E8[FEFF] call _put_string 1406 _.LVL130: 0 0000BCE3 8B56FE mov dx, word ptr [bp-2] 1408 _.LVL131: 1409 _.L124: 1410 _.LBE196: 1411 _.LBE195: 381:nls.c **** 1412 .loc 1 381 0 0 0000BCE6 897C08 mov word ptr [si+8], di 0 0000BCE9 89540A mov word ptr [si+10], dx 0 0000BCEC EB94 jmp _.L130 1416 _.LVL132: 1417 _.L119: 1418 _.LBE194: 1419 _.LBE193: 704:nls.c **** case NLSFUNC_UPMEM: 1420 .loc 1 704 0 0 0000BCEE 8EC6 mov es, si 0 0000BCF0 26FF7704 push word ptr es:[bx+4] 0 0000BCF4 52 push dx 0 0000BCF5 57 push di 0 0000BCF6 E8CEFB call _nlsYesNo 1426 _.LVL133: 0 0000BCF9 EBB8 jmp _.L110 1428 _.LVL134: 1429 _.L122: 720:nls.c **** return SUCCESS; 1430 .loc 1 720 0 0 0000BCFB 8EC6 mov es, si 0 0000BCFD 268B4F04 mov cx, word ptr es:[bx+4] 1433 _.LVL135: 707:nls.c **** case NLSFUNC_FILE_UPMEM: 1434 .loc 1 707 0 0 0000BD01 89C8 mov ax, cx 1436 _.LBB197: 1437 _.LBB189: 1438 _.LBB186: 1439 _.LBB183: 277:nls.c **** do 1440 .loc 1 277 0 0 0000BD03 85C9 test cx, cx 0 0000BD05 74AC je _.L110 1443 _.LVL136: 0 0000BD07 51 push cx 1445 _.LVL137: 1446 _.LBE183: 1447 _.LBE186: 1448 _.LBE189: 1449 _.LBE197: 720:nls.c **** return SUCCESS; 1450 .loc 1 720 0 0 0000BD08 268B470A mov ax, word ptr es:[bx+10] 1452 _.LBB198: 1453 _.LBB190: 1454 _.LBB187: 1455 _.LBB184: 0 0000BD0C 26FF7710 push word ptr es:[bx+16] 0 0000BD10 50 push ax 1458 _.LBE184: 1459 _.LBE187: 430:nls.c **** } 1460 .loc 1 430 0 0 0000BD11 8EC2 mov es, dx 0 0000BD13 268B4516 mov ax, word ptr es:[di+22] 0 0000BD17 8946FE mov word ptr [bp-2], ax 0 0000BD1A 83C082 add ax, -126 1465 _.LBB188: 1466 _.LBB185: 0 0000BD1D 26FF7518 push word ptr es:[di+24] 0 0000BD21 E92EFF jmp _.L133 1469 _.LBE185: 1470 _.LBE188: 1471 _.LBE190: 1472 _.LBE198: 1473 _.LFE35: 1474 .size _syscall_MUX14, .-_syscall_MUX14 1475 .global _nlsInfo === Switch to base=000790h -> ".DATA" 1476 .data 1477 .type _nlsInfo, @object 1478 .size _nlsInfo, 16 1479 _nlsInfo: 0 000011E2 0000 .hword 0 0 000011E4 0000 .hword 0 0 000011E6 B501 .hword 437 0 000011E8 0200 .hword 2 0 000011EA [0000] .hword _nlsPackageHardcoded 0 000011EC [0000] .hword _DosDataSeg 0 000011EE [0000] .hword _nlsPackageHardcoded 0 000011F0 [0000] .hword _DosDataSeg === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: nlssupt.lst 1 ; File: 2 ; nls.asm 3 ; Description: 4 ; Assembly support routines for nls functions. 5 ; 6 ; Copyright (c) 1995, 1998 7 ; Pasquale J. Villani 8 ; All Rights Reserved 9 ; 10 ; This file is part of DOS-C. 11 ; 12 ; DOS-C is free software; you can redistribute it and/or 13 ; modify it under the terms of the GNU General Public License 14 ; as published by the Free Software Foundation; either version 15 ; 2, or (at your option) any later version. 16 ; 17 ; DOS-C is distributed in the hope that it will be useful, but 18 ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 ; the GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public 23 ; License along with DOS-C; see the file COPYING. If not, 24 ; write to the Free Software Foundation, 675 Mass Ave, 25 ; Cambridge, MA 02139, USA. 26 ; 27 ; $Id: nlssupt.asm 971 2004-05-30 19:31:07Z bartoldeman $ 28 ; 29 30 31 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 32 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 33 === Switch to base=002270h -> "HMA_TEXT" 34 segment HMA_TEXT 35 global _reloc_call_CharMapSrvc 36 extern _DosUpChar 37 extern _DGROUP_ 38 ; 39 ; CharMapSrvc: 40 ; User callable character mapping service. 41 ; Part of Function 38h 42 ; 43 _reloc_call_CharMapSrvc: 44 45 Protect386Registers 0 00000505 1E push ds 0 00000506 06 push es 48 ; push bp 49 ; push si 50 ; push di 0 00000507 52 push dx 0 00000508 51 push cx 0 00000509 53 push bx 54 0 0000050A 50 push ax ; arg of _upChar 0 0000050B 2E8E1E[0000] mov ds,[cs:_DGROUP_] 57 0 00000510 E8[0000] call _DosUpChar 59 ;add sp, byte 2 // next POP retrieves orig AX 60 0 00000513 5B pop bx 0 00000514 88FC mov ah, bh ; keep hibyte untouched 63 0 00000516 5B pop bx 0 00000517 59 pop cx 0 00000518 5A pop dx 67 ; pop di 68 ; pop si 69 ; pop bp 0 00000519 07 pop es 0 0000051A 1F pop ds 72 Restore386Registers 0 0000051B CB retf ; Return far === Trace listing source: prf.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=prf.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccS09wBI.s output file : prf.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _put_console 8 .type _put_console, @function 9 _put_console: 10 _.LFB4: 11 .file 1 "prf.c" 1:prf.c **** /****************************************************************/ 2:prf.c **** /* */ 3:prf.c **** /* prf.c */ 4:prf.c **** /* */ 5:prf.c **** /* Abbreviated printf Function */ 6:prf.c **** /* */ 7:prf.c **** /* Copyright (c) 1995 */ 8:prf.c **** /* Pasquale J. Villani */ 9:prf.c **** /* All Rights Reserved */ 10:prf.c **** /* */ 11:prf.c **** /* This file is part of DOS-C. */ 12:prf.c **** /* */ 13:prf.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:prf.c **** /* modify it under the terms of the GNU General Public License */ 15:prf.c **** /* as published by the Free Software Foundation; either version */ 16:prf.c **** /* 2, or (at your option) any later version. */ 17:prf.c **** /* */ 18:prf.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:prf.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:prf.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:prf.c **** /* the GNU General Public License for more details. */ 22:prf.c **** /* */ 23:prf.c **** /* You should have received a copy of the GNU General Public */ 24:prf.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:prf.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:prf.c **** /* Cambridge, MA 02139, USA. */ 27:prf.c **** /****************************************************************/ 28:prf.c **** 29:prf.c **** #include "portab.h" 30:prf.c **** 31:prf.c **** #ifdef FORSYS 32:prf.c **** #ifdef __GNUC__ 33:prf.c **** #include 34:prf.c **** #else 35:prf.c **** #include 36:prf.c **** #endif 37:prf.c **** #include 38:prf.c **** #endif 39:prf.c **** 40:prf.c **** #ifdef _INIT 41:prf.c **** #define handle_char init_handle_char 42:prf.c **** #define put_console init_put_console 43:prf.c **** #define ltob init_ltob 44:prf.c **** #define do_printf init_do_printf 45:prf.c **** #define printf init_printf 46:prf.c **** #define sprintf init_sprintf 47:prf.c **** #define charp init_charp 48:prf.c **** #endif 49:prf.c **** 50:prf.c **** #include "debug.h" /* must be below xx to init_xx */ 51:prf.c **** 52:prf.c **** /* special console output routine */ 53:prf.c **** /*#define DOSEMU */ 54:prf.c **** #ifdef DOSEMU 55:prf.c **** 56:prf.c **** #define MAX_BUFSIZE 80 /* adjust if necessary */ 57:prf.c **** static int buff_offset = 0; 58:prf.c **** static char buff[MAX_BUFSIZE]; 59:prf.c **** 60:prf.c **** void put_console(int c) 61:prf.c **** { 62:prf.c **** if (buff_offset >= MAX_BUFSIZE) 63:prf.c **** { 64:prf.c **** buff_offset = 0; 65:prf.c **** DebugPrintf(("Printf buffer overflow!\n")); 66:prf.c **** } 67:prf.c **** if (c == '\n') 68:prf.c **** { 69:prf.c **** buff[buff_offset] = 0; 70:prf.c **** buff_offset = 0; 71:prf.c **** #ifdef __TURBOC__ 72:prf.c **** _ES = FP_SEG(buff); 73:prf.c **** _DX = FP_OFF(buff); 74:prf.c **** _AX = 0x13; 75:prf.c **** __int__(0xe6); 76:prf.c **** #elif defined(__GNUC__) 77:prf.c **** asm volatile( 78:prf.c **** "{ int $0xe6 | int 0xe6 }" 79:prf.c **** : /* outputs */ 80:prf.c **** : /* inputs */ "a"(0x13), "e"(FP_SEG(buff)), "d"(FP_OFF(buff)) 81:prf.c **** ); 82:prf.c **** #elif defined(I86) 83:prf.c **** asm 84:prf.c **** { 85:prf.c **** push ds; 86:prf.c **** pop es; 87:prf.c **** mov dx, offset buff; 88:prf.c **** mov ax, 0x13; 89:prf.c **** int 0xe6; 90:prf.c **** } 91:prf.c **** #endif 92:prf.c **** } 93:prf.c **** else 94:prf.c **** { 95:prf.c **** buff[buff_offset] = c; 96:prf.c **** buff_offset++; 97:prf.c **** } 98:prf.c **** } 99:prf.c **** #else 100:prf.c **** #ifdef __WATCOMC__ 101:prf.c **** void int29(char c); 102:prf.c **** #pragma aux int29 = "int 0x29" __parm [__al] __modify __exact [__bx]; 103:prf.c **** 104:prf.c **** #ifdef DEBUG_PRINT_COMPORT 105:prf.c **** void fastComPrint(char c); 106:prf.c **** #pragma aux fastComPrint = \ 107:prf.c **** "mov bx, 0xFD05" \ 108:prf.c **** "int 0x29" __parm [__al] __modify __exact [__bx]; 109:prf.c **** #endif 110:prf.c **** #endif 111:prf.c **** 112:prf.c **** void put_console(int c) 113:prf.c **** { 12 .loc 1 113 0 13 _.LVL0: 0 0000BD92 55 push bp 15 _.LCFI0: 0 0000BD93 89E5 mov bp, sp 17 _.LCFI1: 114:prf.c **** if (c == '\n') 18 .loc 1 114 0 0 0000BD95 837E040A cmp word ptr [bp+4], 10 0 0000BD99 7507 jne _.L2 115:prf.c **** put_console('\r'); 21 .loc 1 115 0 0 0000BD9B B80D00 mov ax, 13 0 0000BD9E 50 push ax 0 0000BD9F E8[FEFF] call _put_console 25 _.LVL1: 26 _.L2: 116:prf.c **** 117:prf.c **** #ifdef FORSYS 118:prf.c **** write(1, &c, 1); /* write character to stdout */ 119:prf.c **** #else 120:prf.c **** #if defined(__TURBOC__) 121:prf.c **** _AL = c; 122:prf.c **** __int__(0x29); 123:prf.c **** #elif defined(__WATCOMC__) 124:prf.c **** int29(c); 125:prf.c **** #if defined DEBUG_PRINT_COMPORT 126:prf.c **** fastComPrint(c); 127:prf.c **** #endif 128:prf.c **** #elif defined(__GNUC__) 129:prf.c **** asm volatile("{ int $0x29 | int 0x29 }" : : "a"(c) : "bx"); 27 .loc 1 129 0 0 0000BDA2 8B4604 mov ax, word ptr [bp+4] 29 #APP 30 ;# 129 "prf.c" 1 130 #elif defined(I86) 131:prf.c **** __asm 132:prf.c **** { 133:prf.c **** mov al, byte ptr c; 134:prf.c **** int 0x29; 135:prf.c **** } 136:prf.c **** #endif /* __TURBO__ */ 137:prf.c **** #endif /* FORSYS */ 138:prf.c **** } 31 int 0x29 32 ;# 0 "" 2 33 .loc 1 138 0 34 #NO_APP 0 0000BDA7 89EC mov sp, bp 0 0000BDA9 5D pop bp 0 0000BDAA C20200 ret 2 38 _.LFE4: 39 .size _put_console, .-_put_console === Switch to base=012BB0h -> ".RODATA.STR1.1" 40 .section .rodata.str1.1,"aMS",@progbits,1 41 _.LC0: 0 00001AC2 3031323334353637 .string "0123456789abcdef" 0 00001ACA 3839616263646566 0 00001AD2 00 === Switch to base=002270h -> ".TEXT" 43 .text 44 .global _put_unsigned 45 .type _put_unsigned, @function 46 _put_unsigned: 47 _.LFB6: 139:prf.c **** #endif /* DOSEMU */ 140:prf.c **** 141:prf.c **** #if defined(DEBUG_NEED_PRINTF) || defined(FORSYS) || defined(_INIT) || defined(TEST) 142:prf.c **** 143:prf.c **** #if defined(DEBUG_NEED_PRINTF) && !defined(_INIT) && !defined(FORSYS) 144:prf.c **** /* need to use FAR pointers for resident DEBUG printf()s where SS != DS */ 145:prf.c **** #define SSFAR FAR 146:prf.c **** #else 147:prf.c **** #define SSFAR 148:prf.c **** #endif 149:prf.c **** 150:prf.c **** #ifndef FORSYS 151:prf.c **** /* copied from bcc (Bruce's C compiler) stdarg.h */ 152:prf.c **** typedef char SSFAR *va_list; 153:prf.c **** #define va_start(arg, last) ((arg) = (va_list) (&(last)+1)) 154:prf.c **** #define va_arg(arg, type) (((type SSFAR *)(arg+=sizeof(type)))[-1]) 155:prf.c **** #define va_end(arg) 156:prf.c **** #endif 157:prf.c **** 158:prf.c **** static BYTE SSFAR *charp = 0; 159:prf.c **** 160:prf.c **** STATIC VOID handle_char(COUNT); 161:prf.c **** STATIC void ltob(LONG, BYTE SSFAR *, COUNT); 162:prf.c **** STATIC void do_printf(const char *, REG va_list); 163:prf.c **** 164:prf.c **** /* special handler to switch between sprintf and printf */ 165:prf.c **** STATIC VOID handle_char(COUNT c) 166:prf.c **** { 167:prf.c **** if (charp == 0) 168:prf.c **** put_console(c); 169:prf.c **** else 170:prf.c **** #ifdef DEBUG_PRINT_COMPORT 171:prf.c **** if (charp == (BYTE SSFAR *)-1) 172:prf.c **** fastComPrint(c); 173:prf.c **** else 174:prf.c **** #endif 175:prf.c **** *charp++ = c; 176:prf.c **** } 177:prf.c **** 178:prf.c **** /* ltob -- convert an long integer to a string in any base (2-16) */ 179:prf.c **** STATIC void ltob(LONG n, BYTE SSFAR * s, COUNT base) 180:prf.c **** { 181:prf.c **** ULONG u; 182:prf.c **** BYTE SSFAR *p; 183:prf.c **** BYTE SSFAR *q; 184:prf.c **** int c; 185:prf.c **** 186:prf.c **** u = n; 187:prf.c **** 188:prf.c **** if (base == -10) /* signals signed conversion */ 189:prf.c **** { 190:prf.c **** base = 10; 191:prf.c **** if (n < 0) 192:prf.c **** { 193:prf.c **** u = -n; 194:prf.c **** *s++ = '-'; 195:prf.c **** } 196:prf.c **** } 197:prf.c **** 198:prf.c **** p = s; 199:prf.c **** do 200:prf.c **** { /* generate digits in reverse order */ 201:prf.c **** *p++ = "0123456789abcdef"[(UWORD) (u % base)]; 202:prf.c **** } 203:prf.c **** while ((u /= base) > 0); 204:prf.c **** 205:prf.c **** *p = '\0'; /* terminate the string */ 206:prf.c **** for (q = s; q < --p; q++) 207:prf.c **** { /* reverse the digits */ 208:prf.c **** c = *q; 209:prf.c **** *q = *p; 210:prf.c **** *p = c; 211:prf.c **** } 212:prf.c **** } 213:prf.c **** 214:prf.c **** #define LEFT 0 215:prf.c **** #define RIGHT 1 216:prf.c **** #define ZEROSFILL 2 217:prf.c **** #define LONGARG 4 218:prf.c **** 219:prf.c **** /* printf -- short version of printf to conserve space */ 220:prf.c **** int VA_CDECL printf(CONST char *fmt, ...) 221:prf.c **** { 222:prf.c **** va_list arg; 223:prf.c **** va_start(arg, fmt); 224:prf.c **** charp = 0; 225:prf.c **** do_printf(fmt, arg); 226:prf.c **** return 0; 227:prf.c **** } 228:prf.c **** 229:prf.c **** #if defined(DEBUG_NEED_PRINTF) && !defined(_INIT) && !defined(FORSYS) 230:prf.c **** STATIC int VA_CDECL fsprintf(char FAR * buff, CONST char * fmt, ...) 231:prf.c **** { 232:prf.c **** va_list arg; 233:prf.c **** 234:prf.c **** va_start(arg, fmt); 235:prf.c **** charp = buff; 236:prf.c **** do_printf(fmt, arg); 237:prf.c **** handle_char('\0'); 238:prf.c **** return 0; 239:prf.c **** } 240:prf.c **** #else 241:prf.c **** #define fsprintf sprintf 242:prf.c **** #endif 243:prf.c **** 244:prf.c **** int VA_CDECL sprintf(char * buff, CONST char * fmt, ...) 245:prf.c **** { 246:prf.c **** va_list arg; 247:prf.c **** 248:prf.c **** va_start(arg, fmt); 249:prf.c **** charp = buff; 250:prf.c **** do_printf(fmt, arg); 251:prf.c **** handle_char('\0'); 252:prf.c **** return 0; 253:prf.c **** } 254:prf.c **** 255:prf.c **** #ifdef DEBUG_PRINT_COMPORT 256:prf.c **** int dbgc_printf(CONST char * fmt, ...) 257:prf.c **** { 258:prf.c **** va_list arg; 259:prf.c **** 260:prf.c **** va_start(arg, fmt); 261:prf.c **** charp = (BYTE SSFAR *)-1; 262:prf.c **** do_printf(fmt, arg); 263:prf.c **** handle_char('\0'); 264:prf.c **** return 0; 265:prf.c **** } 266:prf.c **** #endif 267:prf.c **** 268:prf.c **** STATIC void do_printf(CONST BYTE * fmt, va_list arg) 269:prf.c **** { 270:prf.c **** int base, size; 271:prf.c **** BYTE s[13]; /* long enough for a 32-bit octal number string with sign */ 272:prf.c **** BYTE flags; 273:prf.c **** BYTE FAR *p; 274:prf.c **** 275:prf.c **** for (;*fmt != '\0'; fmt++) 276:prf.c **** { 277:prf.c **** if (*fmt != '%') 278:prf.c **** { 279:prf.c **** handle_char(*fmt); 280:prf.c **** continue; 281:prf.c **** } 282:prf.c **** 283:prf.c **** fmt++; 284:prf.c **** flags = RIGHT; 285:prf.c **** 286:prf.c **** if (*fmt == '-') 287:prf.c **** { 288:prf.c **** flags = LEFT; 289:prf.c **** fmt++; 290:prf.c **** } 291:prf.c **** 292:prf.c **** if (*fmt == '0') 293:prf.c **** { 294:prf.c **** flags |= ZEROSFILL; 295:prf.c **** fmt++; 296:prf.c **** } 297:prf.c **** 298:prf.c **** size = 0; 299:prf.c **** while (1) 300:prf.c **** { 301:prf.c **** unsigned c = (unsigned char)(*fmt - '0'); 302:prf.c **** if (c > 9) 303:prf.c **** break; 304:prf.c **** fmt++; 305:prf.c **** size = size * 10 + c; 306:prf.c **** } 307:prf.c **** 308:prf.c **** if (*fmt == 'l') 309:prf.c **** { 310:prf.c **** flags |= LONGARG; 311:prf.c **** fmt++; 312:prf.c **** } 313:prf.c **** 314:prf.c **** switch (*fmt) 315:prf.c **** { 316:prf.c **** case '\0': 317:prf.c **** va_end(arg); 318:prf.c **** return; 319:prf.c **** 320:prf.c **** case 'c': 321:prf.c **** handle_char(va_arg(arg, int)); 322:prf.c **** continue; 323:prf.c **** 324:prf.c **** case 'p': 325:prf.c **** { 326:prf.c **** UWORD w0 = va_arg(arg, unsigned); 327:prf.c **** char SSFAR *tmp = charp; 328:prf.c **** fsprintf(s, "%04x:%04x", va_arg(arg, unsigned), w0); 329:prf.c **** p = s; 330:prf.c **** charp = tmp; 331:prf.c **** break; 332:prf.c **** } 333:prf.c **** 334:prf.c **** case 's': 335:prf.c **** p = va_arg(arg, char *); 336:prf.c **** break; 337:prf.c **** 338:prf.c **** case 'F': 339:prf.c **** fmt++; 340:prf.c **** /* we assume %Fs here */ 341:prf.c **** case 'S': 342:prf.c **** p = va_arg(arg, char FAR *); 343:prf.c **** break; 344:prf.c **** 345:prf.c **** case 'i': 346:prf.c **** case 'd': 347:prf.c **** base = -10; 348:prf.c **** goto lprt; 349:prf.c **** 350:prf.c **** case 'o': 351:prf.c **** base = 8; 352:prf.c **** goto lprt; 353:prf.c **** 354:prf.c **** case 'u': 355:prf.c **** base = 10; 356:prf.c **** goto lprt; 357:prf.c **** 358:prf.c **** case 'X': 359:prf.c **** case 'x': 360:prf.c **** base = 16; 361:prf.c **** 362:prf.c **** lprt: 363:prf.c **** { 364:prf.c **** long currentArg; 365:prf.c **** if (flags & LONGARG) 366:prf.c **** currentArg = va_arg(arg, long); 367:prf.c **** else 368:prf.c **** { 369:prf.c **** currentArg = va_arg(arg, int); 370:prf.c **** if (base >= 0) 371:prf.c **** currentArg = (long)(unsigned)currentArg; 372:prf.c **** } 373:prf.c **** ltob(currentArg, s, base); 374:prf.c **** p = s; 375:prf.c **** } 376:prf.c **** break; 377:prf.c **** 378:prf.c **** default: 379:prf.c **** handle_char('?'); 380:prf.c **** case '%': 381:prf.c **** 382:prf.c **** handle_char(*fmt); 383:prf.c **** continue; 384:prf.c **** 385:prf.c **** } 386:prf.c **** { 387:prf.c **** size_t i = 0; 388:prf.c **** while(p[i]) i++; 389:prf.c **** size -= i; 390:prf.c **** } 391:prf.c **** 392:prf.c **** if (flags & RIGHT) 393:prf.c **** { 394:prf.c **** int ch = ' '; 395:prf.c **** if (flags & ZEROSFILL) ch = '0'; 396:prf.c **** for (; size > 0; size--) 397:prf.c **** handle_char(ch); 398:prf.c **** } 399:prf.c **** for (; *p != '\0'; p++) 400:prf.c **** handle_char(*p); 401:prf.c **** 402:prf.c **** for (; size > 0; size--) 403:prf.c **** handle_char(' '); 404:prf.c **** } 405:prf.c **** va_end(arg); 406:prf.c **** } 407:prf.c **** 408:prf.c **** #endif 409:prf.c **** #if !defined(FORSYS) && !defined(_INIT) 410:prf.c **** 411:prf.c **** extern void put_string(const char *); 412:prf.c **** extern void put_unsigned(unsigned, int, int); 413:prf.c **** 414:prf.c **** void hexd(char *title, UBYTE FAR * p, COUNT numBytes) 415:prf.c **** { 416:prf.c **** int loop, start = 0; 417:prf.c **** put_string(title); 418:prf.c **** if (numBytes > 16) 419:prf.c **** put_console('\n'); 420:prf.c **** 421:prf.c **** for (start = 0; start < numBytes; start += 16) 422:prf.c **** { 423:prf.c **** put_unsigned(FP_SEG(p), 16, 4); 424:prf.c **** put_console(':'); 425:prf.c **** put_unsigned(FP_OFF(p + start), 16, 4); 426:prf.c **** put_console('|'); 427:prf.c **** for (loop = start; loop < numBytes && loop < start+16;loop++) 428:prf.c **** { 429:prf.c **** put_unsigned(p[loop], 16, 2); 430:prf.c **** put_console(' '); 431:prf.c **** } 432:prf.c **** for (loop = start; loop < numBytes && loop < start+16;loop++) 433:prf.c **** put_console(p[loop] < 0x20 ? '.' : p[loop]); 434:prf.c **** put_console('\n'); 435:prf.c **** } 436:prf.c **** } 437:prf.c **** 438:prf.c **** /* put_unsigned -- print unsigned int in base 2--16 */ 439:prf.c **** void put_unsigned(unsigned n, int base, int width) 440:prf.c **** { 48 .loc 1 440 0 49 _.LVL2: 0 0000BDAD 56 push si 0 0000BDAE 57 push di 0 0000BDAF 55 push bp 53 _.LCFI2: 0 0000BDB0 89E5 mov bp, sp 55 _.LCFI3: 0 0000BDB2 83EC06 sub sp, 6 0 0000BDB5 8B4608 mov ax, word ptr [bp+8] 0 0000BDB8 8B760C mov si, word ptr [bp+12] 59 _.LVL3: 441:prf.c **** char s[6]; 442:prf.c **** int i; 443:prf.c **** 444:prf.c **** for (i = 0; i < width; i++) 60 .loc 1 444 0 0 0000BDBB 31C9 xor cx, cx 445:prf.c **** { /* generate digits in reverse order */ 446:prf.c **** s[i] = "0123456789abcdef"[(UWORD) (n % base)]; 62 .loc 1 446 0 0 0000BDBD BA[0000] mov dx, offset _.LC0 0 0000BDC0 8EC2 mov es, dx 65 _.LVL4: 66 _.L5: 444:prf.c **** { /* generate digits in reverse order */ 67 .loc 1 444 0 discriminator 1 0 0000BDC2 39F1 cmp cx, si 0 0000BDC4 7C12 jl _.L6 0 0000BDC6 85F6 test si, si 0 0000BDC8 7D02 jge _.L8 0 0000BDCA 31F6 xor si, si 73 _.LVL5: 74 _.L8: 447:prf.c **** n /= base; 448:prf.c **** } 449:prf.c **** 450:prf.c **** while(i != 0) 75 .loc 1 450 0 0 0000BDCC 85F6 test si, si 0 0000BDCE 751D jne _.L9 451:prf.c **** { /* print digits in reverse order */ 452:prf.c **** put_console(s[--i]); 453:prf.c **** } 454:prf.c **** } 78 .loc 1 454 0 0 0000BDD0 89EC mov sp, bp 0 0000BDD2 5D pop bp 0 0000BDD3 5F pop di 0 0000BDD4 5E pop si 83 _.LVL6: 0 0000BDD5 C20600 ret 6 85 _.LVL7: 86 _.L6: 446:prf.c **** n /= base; 87 .loc 1 446 0 discriminator 3 0 0000BDD8 31D2 xor dx, dx 0 0000BDDA F7760A div word ptr [bp+10] 90 _.LVL8: 0 0000BDDD 89D3 mov bx, dx 0 0000BDDF 8CC7 mov di, es 0 0000BDE1 8A11 mov dl, byte ptr [bx+di] 0 0000BDE3 89EF mov di, bp 0 0000BDE5 89CB mov bx, cx 0 0000BDE7 8851FA mov byte ptr [bx+di-6], dl 97 _.LVL9: 444:prf.c **** { /* generate digits in reverse order */ 98 .loc 1 444 0 discriminator 3 0 0000BDEA 41 inc cx 100 _.LVL10: 0 0000BDEB EBD5 jmp _.L5 102 _.LVL11: 103 _.L9: 452:prf.c **** } 104 .loc 1 452 0 0 0000BDED 4E dec si 106 _.LVL12: 0 0000BDEE 89EF mov di, bp 0 0000BDF0 89F3 mov bx, si 0 0000BDF2 8A41FA mov al, byte ptr [bx+di-6] 0 0000BDF5 98 cbw 0 0000BDF6 50 push ax 0 0000BDF7 E8[FEFF] call _put_console 113 _.LVL13: 0 0000BDFA EBD0 jmp _.L8 115 _.LFE6: 116 .size _put_unsigned, .-_put_unsigned 117 .global _put_string 118 .type _put_string, @function 119 _put_string: 120 _.LFB7: 455:prf.c **** 456:prf.c **** void put_string(const char *s) 457:prf.c **** { 121 .loc 1 457 0 122 _.LVL14: 0 0000BDFC 56 push si 0 0000BDFD 55 push bp 125 _.LCFI4: 0 0000BDFE 89E5 mov bp, sp 127 _.LCFI5: 0 0000BE00 8B7606 mov si, word ptr [bp+6] 129 _.LVL15: 130 _.L12: 458:prf.c **** while(*s != '\0') 131 .loc 1 458 0 0 0000BE03 8A04 mov al, byte ptr [si] 0 0000BE05 84C0 test al, al 0 0000BE07 7507 jne _.L13 459:prf.c **** put_console(*s++); 460:prf.c **** } 135 .loc 1 460 0 0 0000BE09 89EC mov sp, bp 0 0000BE0B 5D pop bp 0 0000BE0C 5E pop si 139 _.LVL16: 0 0000BE0D C20200 ret 2 141 _.LVL17: 142 _.L13: 459:prf.c **** put_console(*s++); 143 .loc 1 459 0 0 0000BE10 46 inc si 145 _.LVL18: 0 0000BE11 98 cbw 0 0000BE12 50 push ax 0 0000BE13 E8[FEFF] call _put_console 149 _.LVL19: 0 0000BE16 EBEB jmp _.L12 151 _.LFE7: 152 .size _put_string, .-_put_string 153 .global _hexd 154 .type _hexd, @function 155 _hexd: 156 _.LFB5: 415:prf.c **** int loop, start = 0; 157 .loc 1 415 0 158 _.LVL20: 0 0000BE18 56 push si 0 0000BE19 57 push di 0 0000BE1A 55 push bp 162 _.LCFI6: 0 0000BE1B 89E5 mov bp, sp 164 _.LCFI7: 0 0000BE1D 83EC08 sub sp, 8 0 0000BE20 C4460A les ax, dword ptr [bp+10] 0 0000BE23 8946FE mov word ptr [bp-2], ax 0 0000BE26 8C46FC mov word ptr [bp-4], es 169 _.LVL21: 417:prf.c **** if (numBytes > 16) 170 .loc 1 417 0 0 0000BE29 FF7608 push word ptr [bp+8] 0 0000BE2C E8[FEFF] call _put_string 173 _.LVL22: 418:prf.c **** put_console('\n'); 174 .loc 1 418 0 0 0000BE2F 837E0E10 cmp word ptr [bp+14], 16 0 0000BE33 7E07 jle _.L16 419:prf.c **** 177 .loc 1 419 0 0 0000BE35 B80A00 mov ax, 10 0 0000BE38 50 push ax 0 0000BE39 E8[FEFF] call _put_console 181 _.LVL23: 182 _.L16: 423:prf.c **** put_console(':'); 183 .loc 1 423 0 discriminator 1 0 0000BE3C 31FF xor di, di 185 _.LVL24: 186 _.L17: 421:prf.c **** { 187 .loc 1 421 0 discriminator 1 0 0000BE3E 3B7E0E cmp di, word ptr [bp+14] 0 0000BE41 7C08 jl _.L25 436:prf.c **** 190 .loc 1 436 0 0 0000BE43 89EC mov sp, bp 0 0000BE45 5D pop bp 0 0000BE46 5F pop di 194 _.LVL25: 0 0000BE47 5E pop si 0 0000BE48 C20800 ret 8 197 _.LVL26: 198 _.L25: 423:prf.c **** put_console(':'); 199 .loc 1 423 0 0 0000BE4B BA0400 mov dx, 4 0 0000BE4E 52 push dx 0 0000BE4F 8956FA mov word ptr [bp-6], dx 0 0000BE52 BE1000 mov si, 16 0 0000BE55 56 push si 0 0000BE56 FF76FC push word ptr [bp-4] 0 0000BE59 E8[FEFF] call _put_unsigned 207 _.LVL27: 208 _.LBB8: 209 _.LBB9: 129:prf.c **** #elif defined(I86) 210 .loc 1 129 0 0 0000BE5C B83A00 mov ax, 58 212 #APP 213 ;# 129 "prf.c" 1 214 int 0x29 215 ;# 0 "" 2 216 _.LVL28: 217 #NO_APP 218 _.LBE9: 219 _.LBE8: 425:prf.c **** put_console('|'); 220 .loc 1 425 0 0 0000BE61 8B46FE mov ax, word ptr [bp-2] 0 0000BE64 01F8 add ax, di 0 0000BE66 8B56FA mov dx, word ptr [bp-6] 0 0000BE69 52 push dx 0 0000BE6A 56 push si 0 0000BE6B 50 push ax 0 0000BE6C E8[FEFF] call _put_unsigned 228 _.LVL29: 229 _.LBB10: 230 _.LBB11: 129:prf.c **** #elif defined(I86) 231 .loc 1 129 0 0 0000BE6F B87C00 mov ax, 124 233 #APP 234 ;# 129 "prf.c" 1 235 int 0x29 236 ;# 0 "" 2 237 _.LVL30: 238 #NO_APP 0 0000BE74 89FA mov dx, di 0 0000BE76 8976FA mov word ptr [bp-6], si 241 _.LVL31: 242 _.L18: 243 _.LBE11: 244 _.LBE10: 427:prf.c **** { 245 .loc 1 427 0 discriminator 3 0 0000BE79 8D750F lea si, [15+di] 0 0000BE7C 39D6 cmp si, dx 0 0000BE7E 7C29 jl _.L19 429:prf.c **** put_console(' '); 249 .loc 1 429 0 discriminator 4 0 0000BE80 B80200 mov ax, 2 0 0000BE83 50 push ax 0 0000BE84 FF76FA push word ptr [bp-6] 0 0000BE87 8B5EFE mov bx, word ptr [bp-2] 0 0000BE8A 01D3 add bx, dx 0 0000BE8C 8956F8 mov word ptr [bp-8], dx 0 0000BE8F 8E46FC mov es, word ptr [bp-4] 0 0000BE92 268A07 mov al, byte ptr es:[bx] 0 0000BE95 30E4 xor ah, ah 0 0000BE97 50 push ax 0 0000BE98 E8[FEFF] call _put_unsigned 261 _.LVL32: 262 _.LBB12: 263 _.LBB13: 129:prf.c **** #elif defined(I86) 264 .loc 1 129 0 discriminator 4 0 0000BE9B B82000 mov ax, 32 266 #APP 267 ;# 129 "prf.c" 1 268 int 0x29 269 ;# 0 "" 2 270 _.LVL33: 271 #NO_APP 272 _.LBE13: 273 _.LBE12: 427:prf.c **** { 274 .loc 1 427 0 discriminator 4 0 0000BEA0 8B56F8 mov dx, word ptr [bp-8] 0 0000BEA3 42 inc dx 277 _.LVL34: 0 0000BEA4 39560E cmp word ptr [bp+14], dx 0 0000BEA7 7FD0 jg _.L18 280 _.L19: 433:prf.c **** put_console('\n'); 281 .loc 1 433 0 0 0000BEA9 89FA mov dx, di 283 _.LVL35: 284 _.L22: 432:prf.c **** put_console(p[loop] < 0x20 ? '.' : p[loop]); 285 .loc 1 432 0 discriminator 3 0 0000BEAB 39D6 cmp si, dx 0 0000BEAD 7C23 jl _.L24 433:prf.c **** put_console('\n'); 288 .loc 1 433 0 0 0000BEAF 8B5EFE mov bx, word ptr [bp-2] 0 0000BEB2 01D3 add bx, dx 0 0000BEB4 8E46FC mov es, word ptr [bp-4] 0 0000BEB7 268A07 mov al, byte ptr es:[bx] 0 0000BEBA 3C1F cmp al, 31 0 0000BEBC 7702 ja _.L21 0 0000BEBE B02E mov al, 46 296 _.L21: 0 0000BEC0 8956FA mov word ptr [bp-6], dx 433:prf.c **** put_console('\n'); 298 .loc 1 433 0 is_stmt 0 discriminator 4 0 0000BEC3 30E4 xor ah, ah 0 0000BEC5 50 push ax 0 0000BEC6 E8[FEFF] call _put_console 302 _.LVL36: 432:prf.c **** put_console(p[loop] < 0x20 ? '.' : p[loop]); 303 .loc 1 432 0 is_stmt 1 discriminator 4 0 0000BEC9 8B56FA mov dx, word ptr [bp-6] 0 0000BECC 42 inc dx 306 _.LVL37: 0 0000BECD 39560E cmp word ptr [bp+14], dx 0 0000BED0 7FD9 jg _.L22 309 _.L24: 434:prf.c **** } 310 .loc 1 434 0 0 0000BED2 B80A00 mov ax, 10 0 0000BED5 50 push ax 0 0000BED6 E8[FEFF] call _put_console 314 _.LVL38: 421:prf.c **** { 315 .loc 1 421 0 0 0000BED9 83C710 add di, 16 317 _.LVL39: 0 0000BEDC E95FFF jmp _.L17 319 _.LFE5: 320 .size _hexd, .-_hexd === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: printer.lst 1 ; 2 ; File: 3 ; printer.asm 4 ; Description: 5 ; Printer device driver 6 ; 7 ; Copyright (c) 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Header$ 29 ; 30 31 %include "io.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; io.inc 4 <1> ; Description: 5 <1> ; Segments and external common routines used by various device drivers 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Header$ 29 <1> ; 30 <1> 31 <1> %include "segs.inc" 1 <2> ; File: 2 <2> ; segs.inc 3 <2> ; Description: 4 <2> ; Segment definitions for the kernel 5 <2> ; 6 <2> ; Copyright (c) 1998 7 <2> ; Pasquale J. Villani 8 <2> ; All Rights Reserved 9 <2> ; 10 <2> ; This file is part of DOS-C. 11 <2> ; 12 <2> ; DOS-C is free software; you can redistribute it and/or 13 <2> ; modify it under the terms of the GNU General Public License 14 <2> ; as published by the Free Software Foundation; either version 15 <2> ; 2, or (at your option) any later version. 16 <2> ; 17 <2> ; DOS-C is distributed in the hope that it will be useful, but 18 <2> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <2> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <2> ; the GNU General Public License for more details. 21 <2> ; 22 <2> ; You should have received a copy of the GNU General Public 23 <2> ; License along with DOS-C; see the file COPYING. If not, 24 <2> ; write to the Free Software Foundation, 675 Mass Ave, 25 <2> ; Cambridge, MA 02139, USA. 26 <2> ; 27 <2> ; $Header$ 28 <2> ; 29 <2> 30 <2> ; CPU specification -- putting it here because all .asm files include this 31 <2> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <2> ; understand it 33 <2> %ifdef __NASM_VER__ 34 <2> %if XCPU == 86 35 <2> CPU 8086 36 <2> %else 37 <2> CPU XCPU 38 <2> %endif 39 <2> %endif 40 <2> 41 <2> ; for OW on Linux: 42 <2> %ifdef owlinux 43 <2> %define WATCOM 44 <2> %endif 45 <2> 46 <2> %ifidn __OUTPUT_FORMAT__, obj 47 <2> group PGROUP PSP 48 <2> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <2> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <2> %ifdef WATCOM 51 <2> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <2> %define IGROUP TGROUP 53 <2> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <2> %else 55 <2> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <2> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <2> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <2> %endif 59 <2> %define class(x) class=x 60 <2> %define nobits 61 <2> %define exec 62 <2> %define INITSIZE init_end wrt INIT_TEXT 63 <2> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <2> 65 <2> %else ; using ELF 66 <2> 67 <2> BITS 16 68 <2> ; groups are defined in the linker script kernel.ld 69 <2> extern PGROUP 70 <2> extern DGROUP 71 <2> extern LGROUP 72 <2> extern TGROUP 73 <2> extern IGROUP 74 <2> extern I_GROUP 75 <2> %define class(x) 76 <2> %define stack 77 <2> extern INITSIZE 78 <2> %define INITTEXTSIZE __InitTextEnd 79 <2> 80 <2> %endif 81 <2> === Switch to base=000000h -> "PSP" 82 <2> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <2> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <2> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <2> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <2> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <2> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <2> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <2> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <2> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <2> segment _DATAEND class(DATA) align=1 92 <2> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <2> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <2> segment CONST2 class(DATA) align=2 95 <2> ;for MSC === Switch to base=000000h -> "DCONST" 96 <2> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <2> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <2> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <2> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <2> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <2> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <2> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <2> segment INIT_TEXT_END class(CODE) align=16 104 <2> 105 <2> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <2> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <2> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <2> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <2> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <2> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <2> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <2> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <2> segment IB_E class(FAR_DATA) align=2 114 <2> %else === Switch to base=012BB0h -> "ID_B" 115 <2> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <2> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <2> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <2> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <2> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <2> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <2> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <2> segment IB_E class(IB) align=2 nobits 123 <2> %endif 32 <1> 33 <1> ; 34 <1> ; Error Return Codes 35 <1> ; 36 <1> 37 <1> %define E_WRPRT 0 ; Write Protect 38 <1> %define E_UNIT 1 ; Unknown Unit 39 <1> %define E_NOTRDY 2 ; Device Not Ready 40 <1> %define E_CMD 3 ; Unknown Command 41 <1> %define E_CRC 4 ; Crc Error 42 <1> %define E_LENGTH 5 ; Bad Length 43 <1> %define E_SEEK 6 ; Seek Error 44 <1> %define E_MEDIA 7 ; Unknown MEDIA 45 <1> %define E_NOTFND 8 ; Sector Not Found 46 <1> %define E_PAPER 9 ; No Paper 47 <1> %define E_WRITE 10 ; Write Fault 48 <1> %define E_READ 11 ; Read Fault 49 <1> %define E_FAILURE 12 ; General Failure 50 <1> 51 <1> 52 <1> extern _IOExit 53 <1> extern _IOSuccess 54 <1> extern _IOErrorExit 55 <1> extern _IOErrCnt 56 <1> extern _IODone 57 <1> extern _IOCommandError 58 <1> extern GetUnitNum 59 <1> extern _ReqPktPtr 60 <1> 32 33 %define PRT_TIMEOUT 01h 34 %define PRT_IOERROR 08h 35 %define PRT_SELECTED 10h 36 %define PRT_OUTOFPAPER 20h 37 %define PRT_ACK 40h 38 %define PRT_NOTBUSY 80h 39 40 %define PRT_WRITECHAR 00h 41 %define PRT_INITPORT 01h 42 %define PRT_GETSTATUS 02h 43 === Switch to base=000100h -> "_IO_FIXED_DATA" 44 segment _IO_FIXED_DATA 45 46 global LptTable 0 00000654 18 LptTable db 18h 0 00000655 [0000] dw _IOExit 0 00000657 [0000] dw _IOExit 0 00000659 [0000] dw _IOExit 0 0000065B [0000] dw _IOCommandError 0 0000065D [0000] dw _IOSuccess 0 0000065F [0000] dw _IODone 0 00000661 [0000] dw _IOExit 0 00000663 [0000] dw _IOExit 0 00000665 [0900] dw PrtWrite 0 00000667 [0900] dw PrtWrite 0 00000669 [2B00] dw PrtOutStat 0 0000066B [0000] dw _IOExit 0 0000066D [0000] dw _IOExit 0 0000066F [0000] dw _IOExit 0 00000671 [0000] dw _IOExit 0 00000673 [0000] dw _IOExit 0 00000675 [6300] dw PrtOutBsy 0 00000677 [0000] dw _IOExit 0 00000679 [0000] dw _IOExit 0 0000067B [A900] dw PrtGenIoctl 0 0000067D [0000] dw _IOExit 0 0000067F [0000] dw _IOExit 0 00000681 [0000] dw _IOExit 0 00000683 [0000] dw _IOCommandError 0 00000685 [0000] dw _IOCommandError 73 74 === Switch to base=000100h -> "_IO_TEXT" 75 segment _IO_TEXT 76 global uPrtNo 0 00000412 00 uPrtNo db 0 0 00000413 5000 uPrtQuantum dw 50h 0 00000415 50005000 dw 50h, 50h 0 00000419 5000 db 50h, 00h 81 82 PrtWrite: 0 0000041B E317 jcxz PrtWr3 ; Exit if nothing to write 84 85 PrtCharLoop: ; next character loop 86 0 0000041D BB0200 mov bx, 2 ; number of retries 88 PrtRetryTwice: 0 00000420 B402 mov ah, PRT_GETSTATUS ; get status, ah=2 0 00000422 E82E00 call PrtIOCall ; 0 00000425 7510 jnz PrtWr4 92 0 00000427 268A05 mov al,[es:di] 94 0 0000042A B400 mov ah, PRT_WRITECHAR ; print character, ah=0 0 0000042C E82400 call PrtIOCall ; (0800) 97 0 0000042F 7506 jnz PrtWr4 ; NZ = error, retry 99 0 00000431 47 inc di 0 00000432 E2E9 loop PrtCharLoop ; next character 102 PrtWr3: 0 00000434 E9[0000] jmp _IOExit 104 PrtWr4: ; repeat 0 00000437 4B dec bx 0 00000438 75E6 jnz PrtRetryTwice 107 PrtWr5: 0 0000043A E9[0000] jmp _IOErrCnt 109 110 111 112 PrtOutStat: 0 0000043D E81100 call GetPrtStat 0 00000440 75F8 jnz PrtWr5 0 00000442 B009 mov al, E_PAPER 0 00000444 F6C420 test ah, PRT_OUTOFPAPER 0 00000447 75F1 jnz PrtWr5 0 00000449 F6C480 test ah, PRT_NOTBUSY 0 0000044C 75E6 jnz PrtWr3 0 0000044E E9[0000] jmp _IODone 121 122 123 124 GetPrtStat: 0 00000451 B402 mov ah,PRT_GETSTATUS 126 127 PrtIOCall: 0 00000453 E8[0000] call GetUnitNum 0 00000456 CD17 int 17h ; print char al, get status ah 130 0 00000458 88E0 mov al, ah ; if (stat & 0x30) == 0x30 return 10; 0 0000045A 2430 and al, PRT_SELECTED|PRT_OUTOFPAPER 0 0000045C 3C30 cmp al, PRT_SELECTED|PRT_OUTOFPAPER 0 0000045E B00A mov al, E_WRITE 0 00000460 7410 je ret_error_code 136 0 00000462 F6C429 test ah, PRT_OUTOFPAPER|PRT_IOERROR|PRT_TIMEOUT ; 29h 0 00000465 B002 mov al, E_NOTRDY 0 00000467 7409 jz ret_error_code 140 0 00000469 F6C420 test ah, PRT_OUTOFPAPER ; 20h 0 0000046C B00A mov al, E_WRITE 0 0000046E 7402 jz ret_error_code ; not out of paper -> E_WRITE 144 145 ret_error_code_9: 0 00000470 B009 mov al, E_PAPER 147 148 ret_error_code: 0 00000472 3C02 cmp al, E_NOTRDY ; 2 = no error 0 00000474 C3 retn 151 152 153 154 PrtOutBsy: 0 00000475 1E push ds 0 00000476 06 push es 0 00000477 1F pop ds 0 00000478 89FE mov si,di 159 PrtOtBsy1: 0 0000047A 51 push cx 0 0000047B 53 push bx 0 0000047C 31DB xor bx,bx 0 0000047E 2E8A1E[0000] mov bl,[cs:uPrtNo] 0 00000483 D1E3 shl bx,1 0 00000485 2E8B8F[0100] mov cx,[cs:uPrtQuantum+bx] 0 0000048A 5B pop bx 167 PrtOtBsy2: 0 0000048B E8C3FF call GetPrtStat 0 0000048E 751E jnz PrtOtBsy3 0 00000490 F6C480 test ah, PRT_NOTBUSY 0 00000493 E1F6 loopz PrtOtBsy2 0 00000495 59 pop cx 0 00000496 7417 jz PrtOtBsy4 0 00000498 AC lodsb 0 00000499 30E4 xor ah,ah 0 0000049B E8B5FF call PrtIOCall 0 0000049E 750F jnz PrtOtBsy4 0 000004A0 E2D8 loop PrtOtBsy1 0 000004A2 1F pop ds 0 000004A3 2EC51E[0000] lds bx,[cs:_ReqPktPtr] 0 000004A8 294F12 sub [bx+12h],cx 0 000004AB E9[0000] jmp _IOExit 183 PrtOtBsy3: 0 000004AE 59 pop cx 185 PrtOtBsy4: 0 000004AF 1F pop ds 0 000004B0 2EC51E[0000] lds bx,[cs:_ReqPktPtr] 0 000004B5 294F12 sub [bx+12h],cx 0 000004B8 E9[0000] jmp _IOErrorExit 190 191 192 193 PrtGenIoctl: 0 000004BB 2EC43E[0000] les di,[cs:_ReqPktPtr] 0 000004C0 26807D0D05 cmp byte [es:di+0Dh],5 0 000004C5 7403 je PrtGnIoctl2 197 PrtGnIoctl1: 0 000004C7 E9[0000] jmp _IOCommandError 199 PrtGnIoctl2: 0 000004CA 268A450E mov al,[es:di+0Eh] 0 000004CE 26C47D13 les di,[es:di+13h] 0 000004D2 31DB xor bx,bx 0 000004D4 2E8A1E[0000] mov bl,[cs:uPrtNo] 0 000004D9 D1E3 shl bx,1 0 000004DB 2E8B8F[0100] mov cx,[cs:uPrtQuantum+bx] 0 000004E0 3C65 cmp al,65h 0 000004E2 7407 je PrtGnIoctl3 0 000004E4 3C45 cmp al,45h 0 000004E6 75DF jne PrtGnIoctl1 0 000004E8 268B0D mov cx,[es:di] 211 PrtGnIoctl3: 0 000004EB 2E898F[0100] mov [cs:uPrtQuantum+bx],cx 0 000004F0 26890D mov [es:di],cx 0 000004F3 E9[0000] jmp _IOExit 215 216 217 218 ; 219 ; some comments to last changes (TE, 23/09/01) 220 ; 221 ; original implementation didn't print at all - on my machine,LPT2 222 ; 223 ; maybe this one is not much better either, 224 ; but should print a little bit 225 ; 226 ; the status bits = AH 227 ; 228 ; 1 0 229 ; 80 - BUSY not busy busy 230 ; 40 - ACK transfer finished not yet finished 231 ; 20 - PAP no paper available paper OK 232 ; 10 - ONOF printer online not online 233 ; 08 - ERR some error no error 234 ; 01 - TIM some error when transfer OK 235 ; 236 ; some states 237 ; 30 - there is no printer at all 238 ; c8 - there is a printer without power 239 ; 10 - printer with power, but not initialized 240 ; 90 - this one is fine 241 ; 242 ; you must not simply print without asking for status 243 ; as the BIOS has a LARGE timeout before aborting 244 ; === Trace listing source: procsupt.lst 1 ; 2 ; File: 3 ; procsupt.asm 4 ; Description: 5 ; Assembly support routines for process handling, etc. 6 ; 7 ; Copyright (c) 1995,1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Id: procsupt.asm 1591 2011-05-06 01:46:55Z bartoldeman $ 29 ; 30 31 32 %include "segs.inc" 1 <1> ; File: 2 <1> ; segs.inc 3 <1> ; Description: 4 <1> ; Segment definitions for the kernel 5 <1> ; 6 <1> ; Copyright (c) 1998 7 <1> ; Pasquale J. Villani 8 <1> ; All Rights Reserved 9 <1> ; 10 <1> ; This file is part of DOS-C. 11 <1> ; 12 <1> ; DOS-C is free software; you can redistribute it and/or 13 <1> ; modify it under the terms of the GNU General Public License 14 <1> ; as published by the Free Software Foundation; either version 15 <1> ; 2, or (at your option) any later version. 16 <1> ; 17 <1> ; DOS-C is distributed in the hope that it will be useful, but 18 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <1> ; the GNU General Public License for more details. 21 <1> ; 22 <1> ; You should have received a copy of the GNU General Public 23 <1> ; License along with DOS-C; see the file COPYING. If not, 24 <1> ; write to the Free Software Foundation, 675 Mass Ave, 25 <1> ; Cambridge, MA 02139, USA. 26 <1> ; 27 <1> ; $Header$ 28 <1> ; 29 <1> 30 <1> ; CPU specification -- putting it here because all .asm files include this 31 <1> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <1> ; understand it 33 <1> %ifdef __NASM_VER__ 34 <1> %if XCPU == 86 35 <1> CPU 8086 36 <1> %else 37 <1> CPU XCPU 38 <1> %endif 39 <1> %endif 40 <1> 41 <1> ; for OW on Linux: 42 <1> %ifdef owlinux 43 <1> %define WATCOM 44 <1> %endif 45 <1> 46 <1> %ifidn __OUTPUT_FORMAT__, obj 47 <1> group PGROUP PSP 48 <1> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <1> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <1> %ifdef WATCOM 51 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <1> %define IGROUP TGROUP 53 <1> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <1> %else 55 <1> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <1> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <1> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <1> %endif 59 <1> %define class(x) class=x 60 <1> %define nobits 61 <1> %define exec 62 <1> %define INITSIZE init_end wrt INIT_TEXT 63 <1> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <1> 65 <1> %else ; using ELF 66 <1> 67 <1> BITS 16 68 <1> ; groups are defined in the linker script kernel.ld 69 <1> extern PGROUP 70 <1> extern DGROUP 71 <1> extern LGROUP 72 <1> extern TGROUP 73 <1> extern IGROUP 74 <1> extern I_GROUP 75 <1> %define class(x) 76 <1> %define stack 77 <1> extern INITSIZE 78 <1> %define INITTEXTSIZE __InitTextEnd 79 <1> 80 <1> %endif 81 <1> === Switch to base=000000h -> "PSP" 82 <1> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <1> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <1> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <1> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <1> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <1> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <1> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <1> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <1> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <1> segment _DATAEND class(DATA) align=1 92 <1> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <1> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <1> segment CONST2 class(DATA) align=2 95 <1> ;for MSC === Switch to base=000000h -> "DCONST" 96 <1> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <1> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <1> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <1> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <1> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <1> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <1> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <1> segment INIT_TEXT_END class(CODE) align=16 104 <1> 105 <1> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <1> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <1> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <1> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <1> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <1> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <1> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <1> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <1> segment IB_E class(FAR_DATA) align=2 114 <1> %else === Switch to base=012BB0h -> "ID_B" 115 <1> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <1> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <1> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <1> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <1> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <1> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <1> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <1> segment IB_E class(IB) align=2 nobits 123 <1> %endif 33 34 extern _user_r 35 36 extern _break_flg ; break detected flag 37 extern _term_type 38 extern _int21_handler ; far call system services 39 40 %include "stacks.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; stacks.inc 4 <1> ; Description: 5 <1> ; Macro support for register stack frame 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $ 29 <1> ; 30 <1> 31 <1> ; 32 <1> ; Standard stack frame used throughout DOS-C 33 <1> ; 34 <1> ; MS-DOS specific 35 <1> ; 36 <1> ; +---------------+ 37 <1> ; | irp hi | 26 38 <1> ; +---------------+ 39 <1> ; | irp low | 24 40 <1> ; +---------------+ 41 <1> ; | flags | 22 42 <1> ; +---------------+ 43 <1> ; | cs | 20 44 <1> ; +---------------+ 45 <1> ; | ip | 18 46 <1> ; +---------------+ 47 <1> ; | es | 16 48 <1> ; +---------------+ 49 <1> ; | ds | 14 50 <1> ; +---------------+ 51 <1> ; | bp | 12 52 <1> ; +---------------+ 53 <1> ; | di | 10 54 <1> ; +---------------+ 55 <1> ; | si | 8 56 <1> ; +---------------+ 57 <1> ; | dx | 6 58 <1> ; +---------------+ 59 <1> ; | cx | 4 60 <1> ; +---------------+ 61 <1> ; | bx | 2 62 <1> ; +---------------+ 63 <1> ; | ax | 0 64 <1> ; +---------------+ 65 <1> ; 66 <1> 67 <1> ;; Note: The order of the pushed registers _must_ match with the definition 68 <1> ;; of the "iregs" structure within PCB.H, because a pointer to the last 69 <1> ;; pushed register is used as a pointer to a "iregs" structure within the 70 <1> ;; called C sources! -- 2000/03/22 ska 71 <1> 72 <1> ; Don't use `struc RegFrame' etc. here because it interferes with segment 73 <1> ; definitions. 74 <1> reg_ax equ 0 75 <1> reg_bx equ 2 76 <1> reg_cx equ 4 77 <1> reg_dx equ 6 78 <1> reg_si equ 8 79 <1> reg_di equ 10 80 <1> reg_bp equ 12 81 <1> reg_ds equ 14 82 <1> reg_es equ 16 83 <1> reg_ip equ 18 84 <1> reg_cs equ 20 85 <1> reg_flags equ 22 86 <1> irp_low equ 24 87 <1> irp_hi equ 26 88 <1> 89 <1> %macro PUSH$ALL 0 90 <1> push es 91 <1> push ds 92 <1> push bp 93 <1> push di 94 <1> push si 95 <1> push dx 96 <1> push cx 97 <1> push bx 98 <1> push ax 99 <1> %endmacro 100 <1> 101 <1> %macro POP$ALL 0 102 <1> pop ax 103 <1> pop bx 104 <1> pop cx 105 <1> pop dx 106 <1> pop si 107 <1> pop di 108 <1> pop bp 109 <1> pop ds 110 <1> pop es 111 <1> %endmacro 112 <1> 113 <1> ; I386.inc - 10/25/01 by tom ehlert 114 <1> ; 115 <1> ; compiling the kernel for 386 will (sometimes) change the 116 <1> ; high part of (some) registers, which will be (sometimes) be used 117 <1> ; later 118 <1> ; 119 <1> ; assumption: 120 <1> ; we have never seen MSVC to use anything but eax, ecx, edx, 121 <1> ; nor have we seen Borland C to use anything but eax, ebx, edx, 122 <1> ; so we only protect eax, ebx or ecx, edx to conserve stack space 123 <1> ; 124 <1> ; to save even more stack space, we save only HIGH part of regs 125 <1> ; at some expense of slower execution. it's easier anyway :-) 126 <1> ; 127 <1> ; WATCOM only uses FS: and GS: (using -zff and -zgf) and never 128 <1> ; any high part of the 386 registers 129 <1> ; 130 <1> 131 <1> 132 <1> %IF XCPU < 386 133 <1> ; no need to save/restore anything 134 <1> 135 <1> ; error 1 2 3 136 <1> %macro Protect386Registers 0 137 <1> %endmacro 138 <1> 139 <1> %assign Size386Registers 0 140 <1> 141 <1> %macro RestoreSP 0 142 <1> mov sp, bp 143 <1> %endmacro 144 <1> 145 <1> %macro Restore386Registers 0 146 <1> %endmacro 147 <1> 148 <1> %ELSE 149 <1> %ifdef WATCOM 150 <1> 151 <1> %macro Protect386Registers 0 152 <1> push fs 153 <1> push gs 154 <1> %endmacro 155 <1> 156 <1> %assign Size386Registers 4 157 <1> 158 <1> %macro RestoreSP 0 159 <1> lea sp, [bp - Size386Registers] 160 <1> %endmacro 161 <1> 162 <1> %macro Restore386Registers 0 163 <1> pop gs 164 <1> pop fs 165 <1> %endmacro 166 <1> 167 <1> %else 168 <1> 169 <1> %macro Protect386Registers 0 170 <1> push eax 171 <1> pop ax 172 <1> %ifdef MSCL8 173 <1> push ecx 174 <1> pop cx 175 <1> %else ;BC5 176 <1> push ebx 177 <1> pop bx 178 <1> %endif 179 <1> push edx 180 <1> pop dx 181 <1> %endmacro 182 <1> 183 <1> %assign Size386Registers 6 184 <1> 185 <1> %macro RestoreSP 0 186 <1> lea sp, [bp - Size386Registers] 187 <1> %endmacro 188 <1> 189 <1> %macro Restore386Registers 0 190 <1> push dx 191 <1> pop edx 192 <1> %ifdef MSCL8 193 <1> push cx 194 <1> pop ecx 195 <1> %else ;BC5 196 <1> push bx 197 <1> pop ebx 198 <1> %endif 199 <1> push ax 200 <1> pop eax 201 <1> %endmacro 202 <1> 203 <1> %endif 204 <1> %ENDIF 205 <1> 206 <1> ; macros to define stack arguments 207 <1> ; arg a, {b,4}, c 208 <1> ; defines a and c as "word" arguments and b as a "dword" argument 209 <1> ; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10] 210 <1> ; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4] 211 <1> ; 212 <1> ; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL 213 <1> ; in reverse order). Here dx,ax is a dword argument dx:ax where dx is 214 <1> ; the high word. The caller is responsible for dealing with instruction 215 <1> ; pointer (ip) on the stack. 216 <1> 217 <1> %ifdef gcc 218 <1> %define STDCALL 219 <1> %else 220 <1> %define PASCAL 221 <1> %endif 222 <1> 223 <1> %macro definearg 1-2 2 224 <1> %xdefine .%1 bp+.argloc 225 <1> %assign .argloc .argloc+%2 226 <1> %endmacro 227 <1> 228 <1> %macro arg 1-* 229 <1> %assign .argloc 4 230 <1> %rep %0 231 <1> %ifdef PASCAL 232 <1> %rotate -1 233 <1> %endif 234 <1> definearg %1 235 <1> %ifdef STDCALL 236 <1> %rotate 1 237 <1> %endif 238 <1> %endrep 239 <1> %endmacro 240 <1> 241 <1> %macro multipop 1-* 242 <1> %rep %0 243 <1> %rotate -1 244 <1> pop %1 245 <1> %endrep 246 <1> %endmacro 247 <1> 248 <1> %macro popargs 1-* 249 <1> %rep %0 250 <1> %ifdef PASCAL 251 <1> %rotate -1 252 <1> %endif 253 <1> multipop %1 254 <1> %ifdef STDCALL 255 <1> %rotate 1 256 <1> %endif 257 <1> %endrep 258 <1> %endmacro 41 === Switch to base=002270h -> "HMA_TEXT" 42 segment HMA_TEXT 43 44 extern _DGROUP_ 45 46 ; 47 ; Special call for switching processes 48 ; 49 ; void exec_user(iregs far *irp, int disable_a20) 50 ; 51 global _exec_user 52 _exec_user: 53 54 ; PUSH$ALL 55 ; mov ds,[_DGROUP_] 56 ; cld 57 ; 58 ; 59 ; 0 0000051C 58 pop ax ; return address (unused) 61 0 0000051D 5D pop bp ; irp (user ss:sp) 0 0000051E 5E pop si 0 0000051F 59 pop cx ; disable A20? 0 00000520 09C9 or cx,cx 0 00000522 7414 jz do_iret 67 0 00000524 FA cli 0 00000525 8ED6 mov ss,si 0 00000527 89EC mov sp,bp ; set-up user stack 0 00000529 FB sti 72 ; 73 POP$ALL 0 0000052A 58 pop ax 0 0000052B 5B pop bx 0 0000052C 59 pop cx 0 0000052D 5A pop dx 0 0000052E 5E pop si 0 0000052F 5F pop di 0 00000530 5D pop bp 0 00000531 1F pop ds 0 00000532 07 pop es 74 extern _ExecUserDisableA20 0 00000533 EA[0000][0000] jmp DGROUP:_ExecUserDisableA20 76 do_iret: 77 extern _int21_iret 0 00000538 E9[0000] jmp _int21_iret 79 === Switch to base=000100h -> "_LOWTEXT" 80 segment _LOWTEXT 81 82 83 ;; Called whenever the BIOS detects a ^Break state 84 global _got_cbreak 85 _got_cbreak: 0 00000203 1E push ds 0 00000204 50 push ax 0 00000205 B84000 mov ax, 40h 0 00000208 8ED8 mov ds, ax 0 0000020A 800E710080 or byte [71h], 80h ;; set the ^Break flag 0 0000020F 58 pop ax 0 00000210 1F pop ds 0 00000211 CF iret 94 === Switch to base=002270h -> "HMA_TEXT" 95 segment HMA_TEXT 96 97 ; 98 ; Special call for switching processes during break handling 99 ; 100 ; void interrupt far spawn_int23() 101 ; 102 ; 103 ; +---------------+ 104 ; | flags | 22 105 ; +---------------+ 106 ; | cs | 20 107 ; +---------------+ 108 ; | ip | 18 109 ; +---------------+ 110 ; | es | 16 111 ; +---------------+ 112 ; | ds | 14 113 ; +---------------+ 114 ; | bp | 12 115 ; +---------------+ 116 ; | di | 10 117 ; +---------------+ 118 ; | si | 8 119 ; +---------------+ 120 ; | dx | 6 121 ; +---------------+ 122 ; | cx | 4 123 ; +---------------+ 124 ; | bx | 2 125 ; +---------------+ 126 ; | ax | 0 <--- bp & sp after mov bp,sp 127 ; +---------------+ 128 ; 129 global _spawn_int23 130 _spawn_int23: 131 132 ;; 1999/03/27 ska - comments: see cmt1.txt 0 0000053B 2E8E1E[0000] mov ds, [cs:_DGROUP_] ;; Make sure DS is OK 0 00000540 8B2E[0000] mov bp, [_user_r] 135 136 ; restore to user stack 0 00000544 FA cli ;; Pre-8086 don't disable INT autom. 138 ;*TE PATCH 139 ; CtrlC at DosInput (like C:>DATE does) 140 ; Nukes the Kernel. 141 ; 142 ; it looks like ENTRY.ASM+PROCSUPT.ASM 143 ; got out of sync. 144 ; 145 ; spawn_int() assumes a stack layout at 146 ; usr_ss:usr:sp. but usr:ss currently contains 0 147 ; 148 ; this patch helps FreeDos to survive CtrlC, 149 ; but should clearly be done somehow else. 0 00000545 8E16[0200] mov ss, [_user_r+2] 151 RestoreSP 0 00000549 89EC mov sp, bp 152 0 0000054B FB sti 154 155 ; get all the user registers back 156 Restore386Registers 157 POP$ALL 0 0000054C 58 pop ax 0 0000054D 5B pop bx 0 0000054E 59 pop cx 0 0000054F 5A pop dx 0 00000550 5E pop si 0 00000551 5F pop di 0 00000552 5D pop bp 0 00000553 1F pop ds 0 00000554 07 pop es 158 159 ;; Construct the piece of code into the stack 160 161 ;; stack frame: during generation of code piece 162 ;; 163 ;; BP | SP | Meaning 164 ;; 7 | 11 | offset CALL FAR will push onto stack 165 ;; 5 | 9 | CALL FAR segment 166 ;; 3 | 7 | CALL FAR offset 167 ;; 2 | 6 | CALL FAR ??regain_control_int23 | instruction byte 168 ;; 0 | 4 | INT 23 <> 169 ;; -2 | 2 | segment of address of INT-23 \ To jump to INT 23 170 ;; -4 | 0 | offset of address of INT-23 / via RETF 171 ;; Upon return from INT-23 the CALL FAR pushes the address of 172 ;; the byte immediately following the CALL FAR onto the stack. 173 ;; This value POPed and decremented by 7 is the value SP must 174 ;; contain, if the INT-23 was returned with RETF2/IRET. 175 0 00000555 83EC08 sub sp, byte 8 ;; code piece needs 7 bytes --> 4 words 0 00000558 16 push ss ;; prepare jump to INT-23 via RETF 0 00000559 55 push bp ;; will be offset / temp: saved BP 0 0000055A 89E5 mov bp, sp 0 0000055C 83C504 add bp, byte 4 ;; position BP onto INT-23 0 0000055F C74600CD23 mov word [bp], 23cdh ;; INT 23h 0 00000564 C646029A mov byte [bp+2], 9ah ;; CALL FAR immediate 0 00000568 C74603[5900] mov word [bp+3], ??regain_control_int23 0 0000056D 8C4E05 mov word [bp+5], cs 185 186 ;; complete the jump to INT-23 via RETF and restore BP 0 00000570 876EFC xchg word [bp-4], bp 188 0 00000573 F8 clc ;; set default action --> resume 190 ; invoke the int 23 handler its address has been constructed 191 ;; on the stack 0 00000574 CB retf 193 194 ??regain_control_int23: 195 196 ;; stack frame: constructed on entry to INT-23 197 ;; 198 ; BP | SP | Meaning 199 ;; 7 | 11 | offset CALL FAR will push onto stack 200 ;; 5 | 9 | CALL FAR segment 201 ;; 3 | 7 | CALL FAR offset 202 ;; 2 | 6 | CALL FAR ??regain_control_int23 | instruction byte 203 ;; 0 | 4 | INT 23 <> 204 ;; -2 | 2 | segment of address of INT-23 \ To jump to INT 23 205 ;; -4 | 0 | offset of address of INT-23 / via RETF 206 ;; Upon return from INT-23 the CALL FAR pushes the address of 207 ;; the byte immediately following the CALL FAR onto the stack. 208 ;; This value POPed and decremented by 7 is the value SP must 209 ;; contain, if the INT-23 was returned with RETF2/IRET. 210 211 ;; stack frame: used during recovering from INT-23 212 ;; 213 ;; BP | Meaning 214 ;; 1 | <> 215 ;; 0 | <> 216 ;; -1 | saved BP 217 ;; -3 | saved AX 218 ;; -7 | INT 23 <> 219 220 ;; Somewhere on stack: 221 ;; SP | Meaning 222 ;; 4 | segment of return address of CALL FAR 223 ;; 2 | offset of return address of CALL FAR 224 ;; 0 | saved BP 225 0 00000575 55 push bp 0 00000576 89E5 mov bp, sp 0 00000578 8B6E02 mov bp, [bp+2] ;; get should-be address + 7 0 0000057B 8946FD mov word [bp-3], ax ;; save AX 0 0000057E 58 pop ax ;; old BP 0 0000057F 8946FF mov word [bp-1], ax ;; preserve saved BP 0 00000582 89E8 mov ax, bp 0 00000584 48 dec ax ;; last used word of stack 0 00000585 48 dec ax ;; Don't use SUB to keep Carry flag 0 00000586 48 dec ax 0 00000587 94 xchg ax, sp ;; AX := current stack; SP corrected 237 ;; Currently: BP - 7 == address of INT-23 238 ;; should be AX + 4 --> IRET or RETF 2 239 ;; ==> Test if BP - 7 == AX + 4 240 ;; ==> Test if AX + 4 - BP + 7 == 0 0 00000588 9C pushf ;; preserve Carry flag 0 00000589 83C00B add ax, byte 4 + 7 0 0000058C 29E8 sub ax, bp ;; AX := SP + 4 0 0000058E 58 pop ax ;; saved Carry flag 0 0000058F 7402 jz ??int23_ign_carry ;; equal -> IRET --> ignore Carry 246 ;; Carry is already cleared 0 00000591 50 push ax 0 00000592 9D popf ;; restore Carry flag 249 250 ??int23_ign_carry: 0 00000593 58 pop ax ;; Restore the original register 0 00000594 7312 jnc ??int23_respawn 253 ;; The user returned via RETF 0, Carry is set 254 ;; --> terminate program 255 ;; This is done by set the _break_flg and modify the 256 ;; AH value, which is passed to the _respawn_ call 257 ;; into 0, which is "Terminate program". 0 00000596 1E push ds ;; we need DGROUP 0 00000597 2E8E1E[0000] mov ds, [cs:_DGROUP_] 0 0000059C FE06[0000] inc byte [_break_flg] 0 000005A0 C606[0000]01 mov byte [_term_type], 1 262 ; ecm: This is overwritten in the int 21h handler, 263 ; but is passed from the int 23h caller to the 264 ; terminate code in MS-DOS by writing this. 265 ; For us, break_flg is used in function 4Ch to 266 ; re-set term_type to 1 later. 0 000005A5 1F pop ds 268 0 000005A6 30E4 xor ah, ah ;; clear ah --> perform DOS-00 --> terminate 270 271 ??int23_respawn: 0 000005A8 5D pop bp ;; Restore the original register 0 000005A9 EA[0000][0000] jmp DGROUP:_int21_handler 274 275 ; 276 ; interrupt enable and disable routines 277 ; 278 ; public _enable 279 ;_enable proc near 280 ; sti 281 ; ret 282 ;_enable endp 283 ; 284 ; public _disable 285 ;_disable proc near 286 ; cli 287 ; ret 288 ;_disable endp 289 290 extern _p_0_tos,_P_0 291 292 ; prepare to call process 0 (the shell) from P_0() in C 293 294 global reloc_call_p_0 295 reloc_call_p_0: 0 000005AE 58 pop ax ; return address (32-bit, unused) 0 000005AF 58 pop ax 0 000005B0 58 pop ax ; fetch parameter 0 (32-bit) from the old stack 0 000005B1 5A pop dx 0 000005B2 2E8E1E[0000] mov ds,[cs:_DGROUP_] 0 000005B7 FA cli 0 000005B8 2E8E16[0000] mov ss,[cs:_DGROUP_] 0 000005BD BC[0000] mov sp,_p_0_tos ; load the dedicated process 0 stack 0 000005C0 FB sti 0 000005C1 52 push dx ; pass parameter 0 onto the new stack 0 000005C2 50 push ax 0 000005C3 E8[0000] call _P_0 ; no return, allow parameter fetch from C === Trace listing source: serial.lst 1 ; 2 ; File: 3 ; serial.asm 4 ; Description: 5 ; Serial device driver 6 ; 7 ; Copyright (c) 1998 8 ; Pasquale J. Villani 9 ; All Rights Reserved 10 ; 11 ; This file is part of DOS-C. 12 ; 13 ; DOS-C is free software; you can redistribute it and/or 14 ; modify it under the terms of the GNU General Public License 15 ; as published by the Free Software Foundation; either version 16 ; 2, or (at your option) any later version. 17 ; 18 ; DOS-C is distributed in the hope that it will be useful, but 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 ; the GNU General Public License for more details. 22 ; 23 ; You should have received a copy of the GNU General Public 24 ; License along with DOS-C; see the file COPYING. If not, 25 ; write to the Free Software Foundation, 675 Mass Ave, 26 ; Cambridge, MA 02139, USA. 27 ; 28 ; $Header$ 29 ; 30 31 %include "io.inc" 1 <1> ; 2 <1> ; File: 3 <1> ; io.inc 4 <1> ; Description: 5 <1> ; Segments and external common routines used by various device drivers 6 <1> ; 7 <1> ; Copyright (c) 1998 8 <1> ; Pasquale J. Villani 9 <1> ; All Rights Reserved 10 <1> ; 11 <1> ; This file is part of DOS-C. 12 <1> ; 13 <1> ; DOS-C is free software; you can redistribute it and/or 14 <1> ; modify it under the terms of the GNU General Public License 15 <1> ; as published by the Free Software Foundation; either version 16 <1> ; 2, or (at your option) any later version. 17 <1> ; 18 <1> ; DOS-C is distributed in the hope that it will be useful, but 19 <1> ; WITHOUT ANY WARRANTY; without even the implied warranty of 20 <1> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 21 <1> ; the GNU General Public License for more details. 22 <1> ; 23 <1> ; You should have received a copy of the GNU General Public 24 <1> ; License along with DOS-C; see the file COPYING. If not, 25 <1> ; write to the Free Software Foundation, 675 Mass Ave, 26 <1> ; Cambridge, MA 02139, USA. 27 <1> ; 28 <1> ; $Header$ 29 <1> ; 30 <1> 31 <1> %include "segs.inc" 1 <2> ; File: 2 <2> ; segs.inc 3 <2> ; Description: 4 <2> ; Segment definitions for the kernel 5 <2> ; 6 <2> ; Copyright (c) 1998 7 <2> ; Pasquale J. Villani 8 <2> ; All Rights Reserved 9 <2> ; 10 <2> ; This file is part of DOS-C. 11 <2> ; 12 <2> ; DOS-C is free software; you can redistribute it and/or 13 <2> ; modify it under the terms of the GNU General Public License 14 <2> ; as published by the Free Software Foundation; either version 15 <2> ; 2, or (at your option) any later version. 16 <2> ; 17 <2> ; DOS-C is distributed in the hope that it will be useful, but 18 <2> ; WITHOUT ANY WARRANTY; without even the implied warranty of 19 <2> ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 20 <2> ; the GNU General Public License for more details. 21 <2> ; 22 <2> ; You should have received a copy of the GNU General Public 23 <2> ; License along with DOS-C; see the file COPYING. If not, 24 <2> ; write to the Free Software Foundation, 675 Mass Ave, 25 <2> ; Cambridge, MA 02139, USA. 26 <2> ; 27 <2> ; $Header$ 28 <2> ; 29 <2> 30 <2> ; CPU specification -- putting it here because all .asm files include this 31 <2> ; file __NASM_VER__ was introduced in NASM after CPU -- ver 0.98 doesn't 32 <2> ; understand it 33 <2> %ifdef __NASM_VER__ 34 <2> %if XCPU == 86 35 <2> CPU 8086 36 <2> %else 37 <2> CPU XCPU 38 <2> %endif 39 <2> %endif 40 <2> 41 <2> ; for OW on Linux: 42 <2> %ifdef owlinux 43 <2> %define WATCOM 44 <2> %endif 45 <2> 46 <2> %ifidn __OUTPUT_FORMAT__, obj 47 <2> group PGROUP PSP 48 <2> group LGROUP _IRQTEXT _LOWTEXT _IO_TEXT _IO_FIXED_DATA _TEXT 49 <2> group DGROUP _FIXED_DATA _BSS _DATA _DATAEND CONST CONST2 DCONST DYN_DATA 50 <2> %ifdef WATCOM 51 <2> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END INIT_TEXT_START INIT_TEXT INIT_TEXT_END 52 <2> %define IGROUP TGROUP 53 <2> group I_GROUP ID_B I_DATA ICONST ICONST2 ID_E IB_B I_BSS IB_E 54 <2> %else 55 <2> group TGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END 56 <2> group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END 57 <2> group I_GROUP ID_B ID ID_E IC IDATA IB_B IB IB_E 58 <2> %endif 59 <2> %define class(x) class=x 60 <2> %define nobits 61 <2> %define exec 62 <2> %define INITSIZE init_end wrt INIT_TEXT 63 <2> %define INITTEXTSIZE __INIT_DATA_START wrt INIT_TEXT 64 <2> 65 <2> %else ; using ELF 66 <2> 67 <2> BITS 16 68 <2> ; groups are defined in the linker script kernel.ld 69 <2> extern PGROUP 70 <2> extern DGROUP 71 <2> extern LGROUP 72 <2> extern TGROUP 73 <2> extern IGROUP 74 <2> extern I_GROUP 75 <2> %define class(x) 76 <2> %define stack 77 <2> extern INITSIZE 78 <2> %define INITTEXTSIZE __InitTextEnd 79 <2> 80 <2> %endif 81 <2> === Switch to base=000000h -> "PSP" 82 <2> segment PSP class(PSP) === Switch to base=000100h -> "_IRQTEXT" 83 <2> segment _IRQTEXT class(LCODE) exec === Switch to base=000100h -> "_LOWTEXT" 84 <2> segment _LOWTEXT class(LCODE) exec === Switch to base=000100h -> "_IO_TEXT" 85 <2> segment _IO_TEXT class(LCODE) exec === Switch to base=000100h -> "_IO_FIXED_DATA" 86 <2> segment _IO_FIXED_DATA class(LCODE) align=2 === Switch to base=002270h -> "_TEXT" 87 <2> segment _TEXT class(LCODE) exec === Switch to base=000790h -> "_FIXED_DATA" 88 <2> segment _FIXED_DATA class(FDATA) align=16 === Switch to base=000790h -> "_BSS" 89 <2> segment _BSS class(BSS) align=2 === Switch to base=000790h -> "_DATA" 90 <2> segment _DATA class(DATA) align=2 === Switch to base=000790h -> "_DATAEND" 91 <2> segment _DATAEND class(DATA) align=1 92 <2> ;for WATCOM === Switch to base=000790h -> "CONST" 93 <2> segment CONST class(DATA) align=2 === Switch to base=000790h -> "CONST2" 94 <2> segment CONST2 class(DATA) align=2 95 <2> ;for MSC === Switch to base=000000h -> "DCONST" 96 <2> segment DCONST class(DCONST) align=2 === Switch to base=000790h -> "DYN_DATA" 97 <2> segment DYN_DATA class(DYN_DATA) === Switch to base=002270h -> "HMA_TEXT_START" 98 <2> segment HMA_TEXT_START class(CODE) align=16 === Switch to base=002270h -> "HMA_TEXT" 99 <2> segment HMA_TEXT class(CODE) exec === Switch to base=002270h -> "HMA_TEXT_END" 100 <2> segment HMA_TEXT_END class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT_START" 101 <2> segment INIT_TEXT_START class(CODE) align=16 === Switch to base=00E150h -> "INIT_TEXT" 102 <2> segment INIT_TEXT class(CODE) exec === Switch to base=00E150h -> "INIT_TEXT_END" 103 <2> segment INIT_TEXT_END class(CODE) align=16 104 <2> 105 <2> %ifdef WATCOM === Switch to base=012BB0h -> "ID_B" 106 <2> segment ID_B class(FAR_DATA) align=16 === Switch to base unknown -> "I_DATA" 107 <2> segment I_DATA class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST" 108 <2> segment ICONST class(FAR_DATA) align=2 === Switch to base unknown -> "ICONST2" 109 <2> segment ICONST2 class(FAR_DATA) align=2 === Switch to base=012BB0h -> "ID_E" 110 <2> segment ID_E class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_B" 111 <2> segment IB_B class(FAR_DATA) align=2 === Switch to base unknown -> "I_BSS" 112 <2> segment I_BSS class(FAR_DATA) align=2 === Switch to base=012BB0h -> "IB_E" 113 <2> segment IB_E class(FAR_DATA) align=2 114 <2> %else === Switch to base=012BB0h -> "ID_B" 115 <2> segment ID_B class(ID) align=16 === Switch to base=000000h -> "ID" 116 <2> segment ID class(ID) align=2 === Switch to base=000000h -> "IDATA" 117 <2> segment IDATA class(ID) align=2 === Switch to base=012BB0h -> "ID_E" 118 <2> segment ID_E class(ID) align=2 === Switch to base=000000h -> "IC" 119 <2> segment IC class(IC) align=2 === Switch to base=012BB0h -> "IB_B" 120 <2> segment IB_B class(IB) align=2 nobits === Switch to base=000000h -> "IB" 121 <2> segment IB class(IB) align=2 nobits === Switch to base=012BB0h -> "IB_E" 122 <2> segment IB_E class(IB) align=2 nobits 123 <2> %endif 32 <1> 33 <1> ; 34 <1> ; Error Return Codes 35 <1> ; 36 <1> 37 <1> %define E_WRPRT 0 ; Write Protect 38 <1> %define E_UNIT 1 ; Unknown Unit 39 <1> %define E_NOTRDY 2 ; Device Not Ready 40 <1> %define E_CMD 3 ; Unknown Command 41 <1> %define E_CRC 4 ; Crc Error 42 <1> %define E_LENGTH 5 ; Bad Length 43 <1> %define E_SEEK 6 ; Seek Error 44 <1> %define E_MEDIA 7 ; Unknown MEDIA 45 <1> %define E_NOTFND 8 ; Sector Not Found 46 <1> %define E_PAPER 9 ; No Paper 47 <1> %define E_WRITE 10 ; Write Fault 48 <1> %define E_READ 11 ; Read Fault 49 <1> %define E_FAILURE 12 ; General Failure 50 <1> 51 <1> 52 <1> extern _IOExit 53 <1> extern _IOSuccess 54 <1> extern _IOErrorExit 55 <1> extern _IOErrCnt 56 <1> extern _IODone 57 <1> extern _IOCommandError 58 <1> extern GetUnitNum 59 <1> extern _ReqPktPtr 60 <1> 32 === Switch to base=000100h -> "_IO_FIXED_DATA" 33 segment _IO_FIXED_DATA 34 35 global ComTable 0 0000063C 0A ComTable db 0Ah 0 0000063D [0000] dw _IOExit 0 0000063F [0000] dw _IOExit 0 00000641 [0000] dw _IOExit 0 00000643 [0000] dw _IOCommandError 0 00000645 [0000] dw ComRead 0 00000647 [4300] dw ComNdRead 0 00000649 [2F00] dw ComInStat 0 0000064B [7D00] dw ComInpFlush 0 0000064D [8600] dw ComWrite 0 0000064F [8600] dw ComWrite 0 00000651 [6200] dw ComOutStat 48 49 50 === Switch to base=000100h -> "_IO_TEXT" 51 segment _IO_TEXT 52 53 extern CommonNdRdExit 54 55 ComRead: 0 00000368 E315 jcxz ComRd3 0 0000036A E89B00 call GetComStat 0 0000036D 31C0 xor ax,ax 0 0000036F 8607 xchg [bx],al 0 00000371 08C0 or al,al 0 00000373 7507 jnz ComRd2 62 ComRd1: 0 00000375 E80A00 call BiosRdCom 0 00000378 08E4 or ah,ah ; timeout? 0 0000037A 78F9 js ComRd1 ; yes, try again 66 ComRd2: 0 0000037C AA stosb 0 0000037D E2F6 loop ComRd1 69 70 ComRd3: 0 0000037F E9[0000] jmp _IOExit 72 73 74 BiosRdCom: 0 00000382 B402 mov ah,2 0 00000384 E85800 call ComIOCall 0 00000387 F6C40E test ah,0Eh 0 0000038A 740A jz BiosRdRetn 0 0000038C 83C402 add sp,byte 2 0 0000038F 30C0 xor al,al 0 00000391 0CB0 or al,0B0h 0 00000393 E9[0000] jmp _IOErrCnt 83 BiosRdRetn: 0 00000396 C3 retn 85 86 87 ComInStat: ; similar to ComNdRead but returns no char, only flags 0 00000397 E86E00 call GetComStat 0 0000039A 8A07 mov al,[bx] 0 0000039C 08C0 or al,al 0 0000039E 7508 jnz ComInAvail 0 000003A0 E83600 call ComRdStatus 0 000003A3 F6C401 test ah,1 ; char waiting 0 000003A6 741F jz ComNdRtn 95 ; test al,20h ; DSR (why do we test this?) 96 ; jz ComNdRtn 0 000003A8 E9[0000] ComInAvail: jmp _IOExit ; return "ready" 98 99 100 ComNdRead: 0 000003AB E85A00 call GetComStat 0 000003AE 8A07 mov al,[bx] 0 000003B0 08C0 or al,al 0 000003B2 7510 jnz ComNdRd1 0 000003B4 E82200 call ComRdStatus 0 000003B7 F6C401 test ah,1 ; char waiting 0 000003BA 740B jz ComNdRtn 108 ; test al,20h ; DSR (why do we test this?) 109 ; jz ComNdRtn 0 000003BC E8C3FF call BiosRdCom 0 000003BF E84600 call GetComStat 0 000003C2 8807 mov [bx],al 113 ComNdRd1: 0 000003C4 E9[0000] jmp CommonNdRdExit ; return that char 115 ComNdRtn: 0 000003C7 E9[0000] jmp _IODone ; return "busy" 117 118 119 ComOutStat: 0 000003CA E80C00 call ComRdStatus 0 000003CD A820 test al,20h 0 000003CF 74F6 jz ComNdRtn 0 000003D1 F6C420 test ah,20h 0 000003D4 74F1 jz ComNdRtn 0 000003D6 E9[0000] jmp _IOExit ; return "ready" 126 127 128 ComRdStatus: 0 000003D9 B403 mov ah,3 0 000003DB E80100 call ComIOCall 0 000003DE C3 retn 132 133 134 ComIOCall: 0 000003DF E8[0000] call GetUnitNum 0 000003E2 CD14 int 14h ; RS-232 get char al, ah=return status 0 000003E4 C3 retn 138 139 140 ComInpFlush: 0 000003E5 E82000 call GetComStat 0 000003E8 C60700 mov byte [bx],0 0 000003EB E9[0000] jmp _IOExit 144 145 146 ComWrite: 0 000003EE E38F jcxz ComRd3 148 ComWr1: 0 000003F0 268A05 mov al,[es:di] 0 000003F3 47 inc di 0 000003F4 B401 mov ah,1 0 000003F6 E8E6FF call ComIOCall 0 000003F9 F6C480 test ah,80h 0 000003FC 7405 jz ComWr2 0 000003FE B00A mov al,0Ah 0 00000400 E9[0000] jmp _IOErrCnt 157 ComWr2: 0 00000403 E2EB loop ComWr1 0 00000405 E9[0000] jmp _IOExit 160 161 162 GetComStat: 0 00000408 E8[0000] call GetUnitNum 0 0000040B 89D3 mov bx,dx 0 0000040D 81C3[0000] add bx,ComStatArray 0 00000411 C3 retn 167 === Switch to base=000790h -> "_DATA" 168 segment _DATA 169 0 000011AE 00000000 ComStatArray db 0, 0, 0, 0 171 172 ; Revision 1.2 1999/08/10 17:57:13 jprice 173 ; ror4 2011-02 patch 174 ; 175 ; Revision 1.1.1.1 1999/03/29 15:41:31 jprice 176 ; New version without IPL.SYS 177 ; 178 ; Revision 1.1 1999/02/08 05:55:57 jprice 179 ; Added Pat's 1937 kernel patches 180 ; 181 ; EndLog 182 ; === Trace listing source: strings.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=strings.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccuTkD6r.s output file : strings.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 _.Letext0: 8 .file 1 "../hdr/portab.h" === Switch to base unknown -> ".DEBUG_INFO" === Trace listing source: sysclk.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=sysclk.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccmiqPF8.s output file : sysclk.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:52.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _clk_driver 8 .type _clk_driver, @function 9 _clk_driver: 10 _.LFB6: 11 .file 1 "sysclk.c" 1:sysclk.c **** /****************************************************************/ 2:sysclk.c **** /* */ 3:sysclk.c **** /* sysclk.c */ 4:sysclk.c **** /* */ 5:sysclk.c **** /* System Clock Driver */ 6:sysclk.c **** /* */ 7:sysclk.c **** /* Copyright (c) 1995 */ 8:sysclk.c **** /* Pasquale J. Villani */ 9:sysclk.c **** /* All Rights Reserved */ 10:sysclk.c **** /* */ 11:sysclk.c **** /* This file is part of DOS-C. */ 12:sysclk.c **** /* */ 13:sysclk.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:sysclk.c **** /* modify it under the terms of the GNU General Public License */ 15:sysclk.c **** /* as published by the Free Software Foundation; either version */ 16:sysclk.c **** /* 2, or (at your option) any later version. */ 17:sysclk.c **** /* */ 18:sysclk.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:sysclk.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:sysclk.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:sysclk.c **** /* the GNU General Public License for more details. */ 22:sysclk.c **** /* */ 23:sysclk.c **** /* You should have received a copy of the GNU General Public */ 24:sysclk.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:sysclk.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:sysclk.c **** /* Cambridge, MA 02139, USA. */ 27:sysclk.c **** /****************************************************************/ 28:sysclk.c **** 29:sysclk.c **** #include "portab.h" 30:sysclk.c **** #include "globals.h" 31:sysclk.c **** 32:sysclk.c **** #ifdef VERSION_STRINGS 33:sysclk.c **** static char *RcsId = 34:sysclk.c **** "$Id: sysclk.c 681 2003-09-09 17:32:20Z bartoldeman $"; 35:sysclk.c **** #endif 36:sysclk.c **** 37:sysclk.c **** /* */ 38:sysclk.c **** /* WARNING - THIS DRIVER IS NON-PORTABLE!!!! */ 39:sysclk.c **** /* */ 40:sysclk.c **** UWORD ASM DaysSinceEpoch = 0; 41:sysclk.c **** typedef UDWORD ticks_t; 42:sysclk.c **** 43:sysclk.c **** STATIC int ByteToBcd(int x) 44:sysclk.c **** { 45:sysclk.c **** return ((x / 10) << 4) | (x % 10); 46:sysclk.c **** } 47:sysclk.c **** /* 48:sysclk.c **** STATIC int BcdToByte(int x) 49:sysclk.c **** { 50:sysclk.c **** return ((x >> 4) & 0xf) * 10 + (x & 0xf); 51:sysclk.c **** } 52:sysclk.c **** */ 53:sysclk.c **** STATIC void DayToBcd(BYTE * x, unsigned mon, unsigned day, unsigned yr) 54:sysclk.c **** { 55:sysclk.c **** x[1] = ByteToBcd(mon); 56:sysclk.c **** x[0] = ByteToBcd(day); 57:sysclk.c **** x[3] = ByteToBcd(yr / 100); 58:sysclk.c **** x[2] = ByteToBcd(yr % 100); 59:sysclk.c **** } 60:sysclk.c **** 61:sysclk.c **** WORD ASMCFUNC FAR clk_driver(rqptr rp) 62:sysclk.c **** { 12 .loc 1 62 0 13 _.LVL0: 0 00001978 56 push si 0 00001979 57 push di 0 0000197A 55 push bp 17 _.LCFI0: 0 0000197B 89E5 mov bp, sp 19 _.LCFI1: 0 0000197D 83EC16 sub sp, 22 0 00001980 8B460A mov ax, word ptr [bp+10] 0 00001983 8946F4 mov word ptr [bp-12], ax 0 00001986 8B460C mov ax, word ptr [bp+12] 0 00001989 8946F2 mov word ptr [bp-14], ax 63:sysclk.c **** BYTE bcd_days[4], bcd_minutes, bcd_hours, bcd_seconds; 64:sysclk.c **** 65:sysclk.c **** switch (rp->r_command) 25 .loc 1 65 0 0 0000198C 8EC0 mov es, ax 0 0000198E 8B5EF4 mov bx, word ptr [bp-12] 0 00001991 26807F020B cmp byte ptr es:[bx+2], 11 0 00001996 770D ja _.L2 0 00001998 268A4702 mov al, byte ptr es:[bx+2] 0 0000199C 30E4 xor ah, ah 0 0000199E D1E0 shl ax, 1 0 000019A0 93 xchg bx, ax 0 000019A1 FFA7[0000] jmp word ptr [bx+_.L4] === Switch to base=012BB0h -> ".RODATA" 35 .section .rodata 36 .p2align 1 37 .p2align 2 38 _.L4: 0 00001634 [3600] .hword _.L3 0 00001636 [2D00] .hword _.L2 0 00001638 [2D00] .hword _.L2 0 0000163A [2D00] .hword _.L2 0 0000163C [4600] .hword _.L5 0 0000163E [2D00] .hword _.L2 0 00001640 [2D00] .hword _.L2 0 00001642 [4100] .hword _.L15 0 00001644 [FF00] .hword _.L7 0 00001646 [2D00] .hword _.L2 0 00001648 [2D00] .hword _.L2 0 0000164A [4100] .hword _.L15 === Switch to base=002270h -> ".TEXT" 51 .text 52 _.L2: 66:sysclk.c **** { 67:sysclk.c **** case C_INIT: 68:sysclk.c **** 69:sysclk.c **** /* done in initclk.c */ 70:sysclk.c **** /* rp->r_endaddr = device_end(); not needed - bart */ 71:sysclk.c **** rp->r_nunits = 0; 72:sysclk.c **** return S_DONE; 73:sysclk.c **** 74:sysclk.c **** case C_INPUT: 75:sysclk.c **** { 76:sysclk.c **** struct ClockRecord clk; 77:sysclk.c **** int tmp; 78:sysclk.c **** ticks_t ticks; 79:sysclk.c **** 80:sysclk.c **** if (sizeof(struct ClockRecord) != rp->r_count) 81:sysclk.c **** return failure(E_LENGTH); 82:sysclk.c **** 83:sysclk.c **** /* The scaling factor is now 84:sysclk.c **** 6553600/1193180 = 327680/59659 = 65536*5/59659 */ 85:sysclk.c **** 86:sysclk.c **** ticks = 5 * ReadPCClock(); 87:sysclk.c **** ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u; 88:sysclk.c **** 89:sysclk.c **** tmp = (int)(ticks / 6000); 90:sysclk.c **** clk.clkHours = tmp / 60; 91:sysclk.c **** clk.clkMinutes = tmp % 60; 92:sysclk.c **** 93:sysclk.c **** tmp = (int)(ticks % 6000); 94:sysclk.c **** clk.clkSeconds = tmp / 100; 95:sysclk.c **** clk.clkHundredths = tmp % 100; 96:sysclk.c **** 97:sysclk.c **** clk.clkDays = DaysSinceEpoch; 98:sysclk.c **** 99:sysclk.c **** fmemcpy(rp->r_trans, &clk, sizeof(struct ClockRecord)); 100:sysclk.c **** } 101:sysclk.c **** return S_DONE; 102:sysclk.c **** 103:sysclk.c **** case C_OUTPUT: 104:sysclk.c **** { 105:sysclk.c **** const unsigned short *pdays; 106:sysclk.c **** unsigned Day, Month, Year; 107:sysclk.c **** struct ClockRecord clk; 108:sysclk.c **** ticks_t hs, Ticks; 109:sysclk.c **** 110:sysclk.c **** if (sizeof(struct ClockRecord) != rp->r_count) 111:sysclk.c **** return failure(E_LENGTH); 112:sysclk.c **** 113:sysclk.c **** fmemcpy(&clk, rp->r_trans, sizeof(struct ClockRecord)); 114:sysclk.c **** 115:sysclk.c **** /* Set PC Clock first */ 116:sysclk.c **** DaysSinceEpoch = clk.clkDays; 117:sysclk.c **** hs = 6000 * (ticks_t)(60 * clk.clkHours + clk.clkMinutes) + 118:sysclk.c **** (ticks_t)(100 * clk.clkSeconds + clk.clkHundredths); 119:sysclk.c **** 120:sysclk.c **** /* The scaling factor is now 121:sysclk.c **** 1193180/6553600 = 59659/327680 = 59659/65536/5 */ 122:sysclk.c **** 123:sysclk.c **** Ticks = ((hs >> 16) * 59659u + (((hs & 0xffff) * 59659u) >> 16)) / 5; 124:sysclk.c **** 125:sysclk.c **** WritePCClock(Ticks); 126:sysclk.c **** 127:sysclk.c **** /* Now set AT clock */ 128:sysclk.c **** /* Fix year by looping through each year, subtracting */ 129:sysclk.c **** /* the appropriate number of days for that year. */ 130:sysclk.c **** for (Year = 1980, Day = clk.clkDays;;) 131:sysclk.c **** { 132:sysclk.c **** pdays = is_leap_year_monthdays(Year); 133:sysclk.c **** if (Day >= pdays[12]) 134:sysclk.c **** { 135:sysclk.c **** ++Year; 136:sysclk.c **** Day -= pdays[12]; 137:sysclk.c **** } 138:sysclk.c **** else 139:sysclk.c **** break; 140:sysclk.c **** } 141:sysclk.c **** 142:sysclk.c **** /* Day contains the days left and count the number of */ 143:sysclk.c **** /* days for that year. Use this to index the table. */ 144:sysclk.c **** for (Month = 1; Month < 13; ++Month) 145:sysclk.c **** { 146:sysclk.c **** if (pdays[Month] > Day) 147:sysclk.c **** { 148:sysclk.c **** Day = Day - pdays[Month - 1] + 1; 149:sysclk.c **** break; 150:sysclk.c **** } 151:sysclk.c **** } 152:sysclk.c **** 153:sysclk.c **** DayToBcd(bcd_days, Month, Day, Year); 154:sysclk.c **** bcd_minutes = ByteToBcd(clk.clkMinutes); 155:sysclk.c **** bcd_hours = ByteToBcd(clk.clkHours); 156:sysclk.c **** bcd_seconds = ByteToBcd(clk.clkSeconds); 157:sysclk.c **** WriteATClock(bcd_days, bcd_hours, bcd_minutes, bcd_seconds); 158:sysclk.c **** } 159:sysclk.c **** return S_DONE; 160:sysclk.c **** 161:sysclk.c **** case C_OFLUSH: 162:sysclk.c **** case C_IFLUSH: 163:sysclk.c **** return S_DONE; 164:sysclk.c **** 165:sysclk.c **** case C_OUB: 166:sysclk.c **** case C_NDREAD: 167:sysclk.c **** case C_OSTAT: 168:sysclk.c **** case C_ISTAT: 169:sysclk.c **** default: 170:sysclk.c **** return failure(E_FAILURE); /* general failure */ 53 .loc 1 170 0 0 000019A5 B80C81 mov ax, -32500 55 _.LVL1: 56 _.L1: 171:sysclk.c **** } 172:sysclk.c **** } 57 .loc 1 172 0 0 000019A8 89EC mov sp, bp 0 000019AA 5D pop bp 0 000019AB 5F pop di 0 000019AC 5E pop si 0 000019AD CB retf 63 _.LVL2: 64 _.L3: 71:sysclk.c **** return S_DONE; 65 .loc 1 71 0 0 000019AE 8E46F2 mov es, word ptr [bp-14] 0 000019B1 8B5EF4 mov bx, word ptr [bp-12] 0 000019B4 26C6470D00 mov byte ptr es:[bx+13], 0 69 _.LVL3: 70 _.L15: 163:sysclk.c **** 71 .loc 1 163 0 0 000019B9 B80001 mov ax, 256 0 000019BC EBEA jmp _.L1 74 _.LVL4: 75 _.L5: 76 _.LBB20: 80:sysclk.c **** return failure(E_LENGTH); 77 .loc 1 80 0 0 000019BE 8E46F2 mov es, word ptr [bp-14] 0 000019C1 8B5EF4 mov bx, word ptr [bp-12] 0 000019C4 26837F1206 cmp word ptr es:[bx+18], 6 0 000019C9 7405 je _.L8 82 _.L18: 83 _.LBE20: 84 _.LBB21: 111:sysclk.c **** 85 .loc 1 111 0 0 000019CB B80581 mov ax, -32507 0 000019CE EBD8 jmp _.L1 88 _.L8: 89 _.LBE21: 90 _.LBB38: 86:sysclk.c **** ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u; 91 .loc 1 86 0 0 000019D0 E8[FEFF] call _ReadPCClock 93 _.LVL5: 0 000019D3 96 xchg si, ax 0 000019D4 89D3 mov bx, dx 0 000019D6 B80500 mov ax, 5 0 000019D9 F7E3 mul bx 0 000019DB 93 xchg bx, ax 0 000019DC 31C9 xor cx, cx 0 000019DE BF0500 mov di, 5 0 000019E1 96 xchg si, ax 0 000019E2 F7E7 mul di 0 000019E4 8946EE mov word ptr [bp-18], ax 0 000019E7 8956F0 mov word ptr [bp-16], dx 0 000019EA 01D3 add bx, dx 106 _.LVL6: 87:sysclk.c **** 107 .loc 1 87 0 0 000019EC 51 push cx 0 000019ED 894EEA mov word ptr [bp-22], cx 0 000019F0 B80BE9 mov ax, -5877 0 000019F3 50 push ax 0 000019F4 53 push bx 0 000019F5 895EEC mov word ptr [bp-20], bx 0 000019F8 FF76EE push word ptr [bp-18] 0 000019FB E8[FEFF] call ___udivsi3 116 _.LVL7: 0 000019FE 97 xchg di, ax 0 000019FF 8B4EEA mov cx, word ptr [bp-22] 0 00001A02 89CE mov si, cx 0 00001A04 51 push cx 0 00001A05 B80BE9 mov ax, -5877 0 00001A08 50 push ax 0 00001A09 8B5EEC mov bx, word ptr [bp-20] 0 00001A0C 53 push bx 0 00001A0D FF76EE push word ptr [bp-18] 0 00001A10 E8[FEFF] call ___umodsi3 127 _.LVL8: 0 00001A13 56 push si 0 00001A14 BA0BE9 mov dx, -5877 0 00001A17 52 push dx 0 00001A18 50 push ax 0 00001A19 56 push si 0 00001A1A E8[FEFF] call ___udivsi3 134 _.LVL9: 0 00001A1D 93 xchg bx, ax 0 00001A1E 01F3 add bx, si 0 00001A20 11D7 adc di, dx 138 _.LVL10: 89:sysclk.c **** clk.clkHours = tmp / 60; 139 .loc 1 89 0 0 00001A22 56 push si 0 00001A23 B87017 mov ax, 6000 0 00001A26 50 push ax 0 00001A27 57 push di 0 00001A28 53 push bx 0 00001A29 895EEE mov word ptr [bp-18], bx 0 00001A2C E8[FEFF] call ___udivsi3 147 _.LVL11: 90:sysclk.c **** clk.clkMinutes = tmp % 60; 148 .loc 1 90 0 0 00001A2F B93C00 mov cx, 60 0 00001A32 99 cwd 0 00001A33 F7F9 idiv cx 152 _.LVL12: 0 00001A35 8846FD mov byte ptr [bp-3], al 91:sysclk.c **** 154 .loc 1 91 0 0 00001A38 8856FC mov byte ptr [bp-4], dl 93:sysclk.c **** clk.clkSeconds = tmp / 100; 156 .loc 1 93 0 0 00001A3B 56 push si 0 00001A3C B87017 mov ax, 6000 0 00001A3F 50 push ax 0 00001A40 57 push di 0 00001A41 8B5EEE mov bx, word ptr [bp-18] 0 00001A44 53 push bx 0 00001A45 E8[FEFF] call ___umodsi3 164 _.LVL13: 94:sysclk.c **** clk.clkHundredths = tmp % 100; 165 .loc 1 94 0 0 00001A48 B96400 mov cx, 100 0 00001A4B 99 cwd 0 00001A4C F7F9 idiv cx 169 _.LVL14: 0 00001A4E 8846FF mov byte ptr [bp-1], al 95:sysclk.c **** 171 .loc 1 95 0 0 00001A51 8856FE mov byte ptr [bp-2], dl 97:sysclk.c **** 173 .loc 1 97 0 0 00001A54 A1[0000] mov ax, word ptr [_DaysSinceEpoch] 0 00001A57 8946FA mov word ptr [bp-6], ax 99:sysclk.c **** } 176 .loc 1 99 0 0 00001A5A B80600 mov ax, 6 0 00001A5D 50 push ax 0 00001A5E 8D46FA lea ax, [-6+bp] 0 00001A61 16 push ss 0 00001A62 50 push ax 0 00001A63 8E46F2 mov es, word ptr [bp-14] 0 00001A66 8B5EF4 mov bx, word ptr [bp-12] 0 00001A69 26FF7710 push word ptr es:[bx+16] 0 00001A6D 26FF770E push word ptr es:[bx+14] 0 00001A71 E8[FEFF] call _fmemcpy 187 _.LVL15: 0 00001A74 E942FF jmp _.L15 189 _.LVL16: 190 _.L7: 191 _.LBE38: 192 _.LBB39: 110:sysclk.c **** return failure(E_LENGTH); 193 .loc 1 110 0 0 00001A77 8E46F2 mov es, word ptr [bp-14] 0 00001A7A 8B5EF4 mov bx, word ptr [bp-12] 0 00001A7D 26837F1206 cmp word ptr es:[bx+18], 6 0 00001A82 7403E944FF jne _.L18 113:sysclk.c **** 198 .loc 1 113 0 0 00001A87 B80600 mov ax, 6 0 00001A8A 50 push ax 0 00001A8B 8E46F2 mov es, word ptr [bp-14] 0 00001A8E 8B5EF4 mov bx, word ptr [bp-12] 0 00001A91 26FF7710 push word ptr es:[bx+16] 0 00001A95 26FF770E push word ptr es:[bx+14] 0 00001A99 8D46FA lea ax, [-6+bp] 0 00001A9C 16 push ss 0 00001A9D 50 push ax 0 00001A9E E8[FEFF] call _fmemcpy 209 _.LVL17: 116:sysclk.c **** hs = 6000 * (ticks_t)(60 * clk.clkHours + clk.clkMinutes) + 210 .loc 1 116 0 0 00001AA1 8B46FA mov ax, word ptr [bp-6] 0 00001AA4 A3[0000] mov word ptr [_DaysSinceEpoch], ax 117:sysclk.c **** (ticks_t)(100 * clk.clkSeconds + clk.clkHundredths); 213 .loc 1 117 0 0 00001AA7 B03C mov al, 60 0 00001AA9 F666FD mul byte ptr [bp-3] 0 00001AAC 8A56FC mov dl, byte ptr [bp-4] 0 00001AAF 30F6 xor dh, dh 0 00001AB1 01D0 add ax, dx 0 00001AB3 93 xchg bx, ax 0 00001AB4 B87017 mov ax, 6000 0 00001AB7 F7EB imul bx 0 00001AB9 93 xchg bx, ax 0 00001ABA 89D6 mov si, dx 118:sysclk.c **** 224 .loc 1 118 0 0 00001ABC B064 mov al, 100 0 00001ABE F666FF mul byte ptr [bp-1] 0 00001AC1 8A56FE mov dl, byte ptr [bp-2] 0 00001AC4 30F6 xor dh, dh 0 00001AC6 01D0 add ax, dx 0 00001AC8 89C1 mov cx, ax 0 00001ACA 99 cwd 117:sysclk.c **** (ticks_t)(100 * clk.clkSeconds + clk.clkHundredths); 232 .loc 1 117 0 0 00001ACB 01D9 add cx, bx 0 00001ACD 96 xchg si, ax 0 00001ACE 11D0 adc ax, dx 0 00001AD0 8946F4 mov word ptr [bp-12], ax 237 _.LVL18: 123:sysclk.c **** 238 .loc 1 123 0 0 00001AD3 31FF xor di, di 0 00001AD5 BE0BE9 mov si, -5877 0 00001AD8 91 xchg cx, ax 242 _.LVL19: 0 00001AD9 F7E6 mul si 0 00001ADB 89D1 mov cx, dx 245 _.LVL20: 0 00001ADD 8B46F4 mov ax, word ptr [bp-12] 0 00001AE0 F7E6 mul si 0 00001AE2 01C1 add cx, ax 0 00001AE4 92 xchg dx, ax 0 00001AE5 11F8 adc ax, di 0 00001AE7 57 push di 0 00001AE8 BA0500 mov dx, 5 0 00001AEB 52 push dx 0 00001AEC 50 push ax 0 00001AED 51 push cx 0 00001AEE E8[FEFF] call ___udivsi3 257 _.LVL21: 125:sysclk.c **** 258 .loc 1 125 0 0 00001AF1 52 push dx 0 00001AF2 50 push ax 0 00001AF3 E8[FEFF] call _WritePCClock 262 _.LVL22: 130:sysclk.c **** { 263 .loc 1 130 0 0 00001AF6 8B76FA mov si, word ptr [bp-6] 265 _.LVL23: 0 00001AF9 C746F4BC07 mov word ptr [bp-12], 1980 267 _.LVL24: 268 _.L11: 132:sysclk.c **** if (Day >= pdays[12]) 269 .loc 1 132 0 0 00001AFE FF76F4 push word ptr [bp-12] 0 00001B01 E8[FEFF] call _is_leap_year_monthdays 272 _.LVL25: 0 00001B04 97 xchg di, ax 274 _.LVL26: 133:sysclk.c **** { 275 .loc 1 133 0 0 00001B05 8B4518 mov ax, word ptr [di+24] 277 _.LVL27: 0 00001B08 39C6 cmp si, ax 0 00001B0A 7207 jc _.L10 135:sysclk.c **** Day -= pdays[12]; 280 .loc 1 135 0 0 00001B0C FF46F4 inc word ptr [bp-12] 282 _.LVL28: 136:sysclk.c **** } 283 .loc 1 136 0 0 00001B0F 29C6 sub si, ax 285 _.LVL29: 132:sysclk.c **** if (Day >= pdays[12]) 286 .loc 1 132 0 0 00001B11 EBEB jmp _.L11 288 _.L10: 0 00001B13 B80100 mov ax, 1 290 _.L14: 291 _.LVL30: 146:sysclk.c **** { 292 .loc 1 146 0 0 00001B16 89C3 mov bx, ax 0 00001B18 D1E3 shl bx, 1 0 00001B1A 3B31 cmp si, word ptr [bx+di] 0 00001B1C 7203E99800 jnc _.L12 0 00001B21 8D5401 lea dx, [1+si] 148:sysclk.c **** break; 298 .loc 1 148 0 0 00001B24 89C3 mov bx, ax 0 00001B26 81C3FF7F add bx, 32767 0 00001B2A D1E3 shl bx, 1 0 00001B2C 2B11 sub dx, word ptr [bx+di] 0 00001B2E 89D6 mov si, dx 304 _.LVL31: 305 _.L13: 306 _.LBB22: 307 _.LBB23: 308 _.LBB24: 309 _.LBB25: 45:sysclk.c **** } 310 .loc 1 45 0 0 00001B30 BB0A00 mov bx, 10 0 00001B33 99 cwd 0 00001B34 F7FB idiv bx 314 _.LVL32: 0 00001B36 B104 mov cl, 4 0 00001B38 D3E0 shl ax, cl 0 00001B3A 09D0 or ax, dx 318 _.LBE25: 319 _.LBE24: 55:sysclk.c **** x[0] = ByteToBcd(day); 320 .loc 1 55 0 0 00001B3C 8846F7 mov byte ptr [bp-9], al 322 _.LBB26: 323 _.LBB27: 45:sysclk.c **** } 324 .loc 1 45 0 0 00001B3F 96 xchg si, ax 0 00001B40 99 cwd 0 00001B41 F7FB idiv bx 0 00001B43 89D6 mov si, dx 329 _.LVL33: 0 00001B45 D3E0 shl ax, cl 0 00001B47 92 xchg dx, ax 0 00001B48 09F2 or dx, si 333 _.LBE27: 334 _.LBE26: 56:sysclk.c **** x[3] = ByteToBcd(yr / 100); 335 .loc 1 56 0 0 00001B4A 8856F6 mov byte ptr [bp-10], dl 57:sysclk.c **** x[2] = ByteToBcd(yr % 100); 337 .loc 1 57 0 0 00001B4D BF6400 mov di, 100 339 _.LVL34: 0 00001B50 8B46F4 mov ax, word ptr [bp-12] 0 00001B53 31D2 xor dx, dx 0 00001B55 F7F7 div di 0 00001B57 89D6 mov si, dx 344 _.LBB28: 345 _.LBB29: 45:sysclk.c **** } 346 .loc 1 45 0 0 00001B59 99 cwd 0 00001B5A F7FB idiv bx 0 00001B5C D3E0 shl ax, cl 0 00001B5E 09D0 or ax, dx 351 _.LBE29: 352 _.LBE28: 57:sysclk.c **** x[2] = ByteToBcd(yr % 100); 353 .loc 1 57 0 0 00001B60 8846F9 mov byte ptr [bp-7], al 355 _.LBB30: 356 _.LBB31: 45:sysclk.c **** } 357 .loc 1 45 0 0 00001B63 96 xchg si, ax 0 00001B64 99 cwd 0 00001B65 F7FB idiv bx 0 00001B67 89D6 mov si, dx 0 00001B69 D3E0 shl ax, cl 0 00001B6B 89C2 mov dx, ax 0 00001B6D 09F2 or dx, si 365 _.LBE31: 366 _.LBE30: 58:sysclk.c **** } 367 .loc 1 58 0 0 00001B6F 8856F8 mov byte ptr [bp-8], dl 369 _.LVL35: 370 _.LBE23: 371 _.LBE22: 154:sysclk.c **** bcd_hours = ByteToBcd(clk.clkHours); 372 .loc 1 154 0 0 00001B72 8A46FC mov al, byte ptr [bp-4] 0 00001B75 8846F4 mov byte ptr [bp-12], al 375 _.LVL36: 0 00001B78 C646F500 mov byte ptr [bp-11], 0 377 _.LVL37: 155:sysclk.c **** bcd_seconds = ByteToBcd(clk.clkSeconds); 378 .loc 1 155 0 0 00001B7C 8A46FD mov al, byte ptr [bp-3] 0 00001B7F 8846F2 mov byte ptr [bp-14], al 0 00001B82 C646F300 mov byte ptr [bp-13], 0 382 _.LVL38: 156:sysclk.c **** WriteATClock(bcd_days, bcd_hours, bcd_minutes, bcd_seconds); 383 .loc 1 156 0 0 00001B86 8A46FF mov al, byte ptr [bp-1] 0 00001B89 30E4 xor ah, ah 386 _.LVL39: 387 _.LBB32: 388 _.LBB33: 45:sysclk.c **** } 389 .loc 1 45 0 0 00001B8B 99 cwd 0 00001B8C F7FB idiv bx 392 _.LVL40: 0 00001B8E D3E0 shl ax, cl 0 00001B90 09D0 or ax, dx 395 _.LBE33: 396 _.LBE32: 157:sysclk.c **** } 397 .loc 1 157 0 0 00001B92 50 push ax 399 _.LVL41: 400 _.LBB34: 401 _.LBB35: 45:sysclk.c **** } 402 .loc 1 45 0 0 00001B93 8B46F4 mov ax, word ptr [bp-12] 0 00001B96 99 cwd 0 00001B97 F7FB idiv bx 0 00001B99 89D6 mov si, dx 0 00001B9B D3E0 shl ax, cl 0 00001B9D 92 xchg dx, ax 0 00001B9E 09F2 or dx, si 410 _.LBE35: 411 _.LBE34: 157:sysclk.c **** } 412 .loc 1 157 0 0 00001BA0 52 push dx 414 _.LVL42: 415 _.LBB36: 416 _.LBB37: 45:sysclk.c **** } 417 .loc 1 45 0 0 00001BA1 8B46F2 mov ax, word ptr [bp-14] 0 00001BA4 99 cwd 0 00001BA5 F7FB idiv bx 0 00001BA7 89D6 mov si, dx 0 00001BA9 D3E0 shl ax, cl 0 00001BAB 92 xchg dx, ax 0 00001BAC 09F2 or dx, si 425 _.LBE37: 426 _.LBE36: 157:sysclk.c **** } 427 .loc 1 157 0 0 00001BAE 52 push dx 429 _.LVL43: 0 00001BAF 8D46F6 lea ax, [-10+bp] 0 00001BB2 50 push ax 432 _.LVL44: 0 00001BB3 E8[FEFF] call _WriteATClock 434 _.LVL45: 0 00001BB6 E900FE jmp _.L15 436 _.LVL46: 437 _.L12: 144:sysclk.c **** { 438 .loc 1 144 0 discriminator 2 0 00001BB9 40 inc ax 440 _.LVL47: 0 00001BBA 83F80D cmp ax, 13 0 00001BBD 7403E954FF jne _.L14 0 00001BC2 E96BFF jmp _.L13 444 _.LBE39: 445 _.LFE6: 446 .size _clk_driver, .-_clk_driver 447 .global _DaysSinceEpoch === Switch to base=012BB0h -> ".BSS" 448 .bss 449 .p2align 1 450 .type _DaysSinceEpoch, @object 451 .size _DaysSinceEpoch, 2 452 _DaysSinceEpoch: 0 00000D00 0000 .skip 2,0 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: syspack.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=syspack.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccUtK5EO.s output file : syspack.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:55.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 _.Letext0: 8 .file 1 "../hdr/portab.h" 9 .file 2 "../hdr/device.h" 10 .file 3 "../hdr/mcb.h" 11 .file 4 "../hdr/pcb.h" 12 .file 5 "../hdr/ddate.h" 13 .file 6 "../hdr/dtime.h" 14 .file 7 "../hdr/fat.h" 15 .file 8 "../hdr/fcb.h" 16 .file 9 "../hdr/sft.h" 17 .file 10 "../hdr/dcb.h" 18 .file 11 "../hdr/cds.h" 19 .file 12 "../hdr/dirmatch.h" 20 .file 13 "../hdr/fnode.h" 21 .file 14 "../hdr/clock.h" 22 .file 15 "../hdr/kbd.h" 23 .file 16 "../hdr/buffer.h" 24 .file 17 "globals.h" === Switch to base unknown -> ".DEBUG_INFO" === Trace listing source: systime.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=systime.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/ccXIaYQ4.s output file : systime.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:53.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .global _is_leap_year_monthdays 8 .type _is_leap_year_monthdays, @function 9 _is_leap_year_monthdays: 10 _.LFB4: 11 .file 1 "systime.c" 1:systime.c **** /****************************************************************/ 2:systime.c **** /* */ 3:systime.c **** /* systime.c */ 4:systime.c **** /* */ 5:systime.c **** /* DOS/C Date/Time Functions */ 6:systime.c **** /* */ 7:systime.c **** /* Copyright (c) 1998 */ 8:systime.c **** /* Pasquale J. Villani */ 9:systime.c **** /* All Rights Reserved */ 10:systime.c **** /* */ 11:systime.c **** /* This file is part of DOS-C. */ 12:systime.c **** /* */ 13:systime.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:systime.c **** /* modify it under the terms of the GNU General Public License */ 15:systime.c **** /* as published by the Free Software Foundation; either version */ 16:systime.c **** /* 2, or (at your option) any later version. */ 17:systime.c **** /* */ 18:systime.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:systime.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:systime.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:systime.c **** /* the GNU General Public License for more details. */ 22:systime.c **** /* */ 23:systime.c **** /* You should have received a copy of the GNU General Public */ 24:systime.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:systime.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:systime.c **** /* Cambridge, MA 02139, USA. */ 27:systime.c **** /****************************************************************/ 28:systime.c **** 29:systime.c **** #include "portab.h" 30:systime.c **** #include "dtime.h" 31:systime.c **** #include "ddate.h" 32:systime.c **** #include "globals.h" 33:systime.c **** 34:systime.c **** #ifdef VERSION_STRINGS 35:systime.c **** static BYTE *RcsId = 36:systime.c **** "$Id: systime.c 683 2003-09-09 17:43:43Z bartoldeman $"; 37:systime.c **** #endif 38:systime.c **** 39:systime.c **** const UWORD days[2][13] = { 40:systime.c **** {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, 41:systime.c **** {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} 42:systime.c **** }; 43:systime.c **** 44:systime.c **** extern request ASM ClkReqHdr; 45:systime.c **** 46:systime.c **** /* 47:systime.c **** return a pointer to an array with the days for that year 48:systime.c **** */ 49:systime.c **** 50:systime.c **** const UWORD *is_leap_year_monthdays(UWORD y) 51:systime.c **** { 12 .loc 1 51 0 13 _.LVL0: 0 00002BCD 55 push bp 15 _.LCFI0: 0 00002BCE 89E5 mov bp, sp 17 _.LCFI1: 52:systime.c **** /* this is correct in a strict mathematical sense 53:systime.c **** return ((y) & 3 ? days[0] : (y) % 100 ? days[1] : (y) % 400 ? days[0] : days[1]); */ 54:systime.c **** 55:systime.c **** /* this will work until 2200 - long enough for me - and saves 0x1f bytes */ 56:systime.c **** 57:systime.c **** if ((y & 3) || y == 2100) 18 .loc 1 57 0 0 00002BD0 F6460403 test byte ptr [bp+4], 3 0 00002BD4 750E jne _.L3 0 00002BD6 817E043408 cmp word ptr [bp+4], 2100 0 00002BDB 7407 je _.L3 58:systime.c **** return days[0]; 59:systime.c **** 60:systime.c **** return days[1]; 23 .loc 1 60 0 0 00002BDD B8[1A00] mov ax, offset _days+26 25 _.L1: 61:systime.c **** } 26 .loc 1 61 0 0 00002BE0 5D pop bp 0 00002BE1 C20200 ret 2 29 _.L3: 58:systime.c **** return days[0]; 30 .loc 1 58 0 0 00002BE4 B8[0000] mov ax, offset _days 0 00002BE7 EBF7 jmp _.L1 33 _.LFE4: 34 .size _is_leap_year_monthdays, .-_is_leap_year_monthdays 35 .global _DaysFromYearMonthDay 36 .type _DaysFromYearMonthDay, @function 37 _DaysFromYearMonthDay: 38 _.LFB5: 62:systime.c **** 63:systime.c **** UWORD DaysFromYearMonthDay(UWORD Year, UWORD Month, UWORD DayOfMonth) 64:systime.c **** { 39 .loc 1 64 0 40 _.LVL1: 0 00002BE9 56 push si 0 00002BEA 57 push di 0 00002BEB 55 push bp 44 _.LCFI2: 0 00002BEC 89E5 mov bp, sp 46 _.LCFI3: 0 00002BEE 8B7608 mov si, word ptr [bp+8] 65:systime.c **** if (Year < 1980) 48 .loc 1 65 0 0 00002BF1 81FEBB07 cmp si, 1979 0 00002BF5 7632 jbe _.L7 51 _.LVL2: 52 _.LBB4: 53 _.LBB5: 66:systime.c **** return 0; 67:systime.c **** 68:systime.c **** return DayOfMonth - 1 69:systime.c **** + is_leap_year_monthdays(Year)[Month - 1] 54 .loc 1 69 0 0 00002BF7 56 push si 0 00002BF8 E8[FEFF] call _is_leap_year_monthdays 57 _.LVL3: 0 00002BFB 8EC0 mov es, ax 70:systime.c **** + ((Year - 1980) * 365) + ((Year - 1980 + 3) / 4); 59 .loc 1 70 0 0 00002BFD B86D01 mov ax, 365 0 00002C00 F7E6 mul si 0 00002C02 8B5E0C mov bx, word ptr [bp+12] 0 00002C05 97 xchg di, ax 0 00002C06 8D99F3F8 lea bx, [-1805+bx+di] 0 00002C0A 8D8447F8 lea ax, [-1977+si] 0 00002C0E B102 mov cl, 2 0 00002C10 D3E8 shr ax, cl 0 00002C12 01D8 add ax, bx 69:systime.c **** + ((Year - 1980) * 365) + ((Year - 1980 + 3) / 4); 69 .loc 1 69 0 0 00002C14 8B5E0A mov bx, word ptr [bp+10] 0 00002C17 81C3FF7F add bx, 32767 0 00002C1B D1E3 shl bx, 1 73 .loc 1 70 0 0 00002C1D 8CC7 mov di, es 0 00002C1F 0301 add ax, word ptr [bx+di] 76 _.LVL4: 77 _.L5: 78 _.LBE5: 79 _.LBE4: 71:systime.c **** 72:systime.c **** } 80 .loc 1 72 0 0 00002C21 89EC mov sp, bp 0 00002C23 5D pop bp 0 00002C24 5F pop di 0 00002C25 5E pop si 0 00002C26 C20600 ret 6 86 _.LVL5: 87 _.L7: 66:systime.c **** 88 .loc 1 66 0 0 00002C29 31C0 xor ax, ax 0 00002C2B EBF4 jmp _.L5 91 _.LFE5: 92 .size _DaysFromYearMonthDay, .-_DaysFromYearMonthDay 93 .global _ExecuteClockDriverRequest 94 .type _ExecuteClockDriverRequest, @function 95 _ExecuteClockDriverRequest: 96 _.LFB6: 73:systime.c **** 74:systime.c **** /* common - call the clock driver */ 75:systime.c **** void ExecuteClockDriverRequest(BYTE command) 76:systime.c **** { 97 .loc 1 76 0 98 _.LVL6: 0 00002C2D 55 push bp 100 _.LCFI4: 0 00002C2E 89E5 mov bp, sp 102 _.LCFI5: 77:systime.c **** BinaryCharIO(&clock, sizeof(struct ClockRecord), &ClkRecord, command); 103 .loc 1 77 0 0 00002C30 8A4604 mov al, byte ptr [bp+4] 0 00002C33 98 cbw 0 00002C34 50 push ax 0 00002C35 16 push ss 0 00002C36 B8[0000] mov ax, offset _ClkRecord 0 00002C39 50 push ax 0 00002C3A B80600 mov ax, 6 0 00002C3D 50 push ax 0 00002C3E B8[0000] mov ax, offset _clock 0 00002C41 50 push ax 0 00002C42 E8[FEFF] call _BinaryCharIO 115 _.LVL7: 78:systime.c **** } 116 .loc 1 78 0 0 00002C45 89EC mov sp, bp 0 00002C47 5D pop bp 0 00002C48 C20200 ret 2 120 _.LFE6: 121 .size _ExecuteClockDriverRequest, .-_ExecuteClockDriverRequest 122 .global _DosGetTime 123 .type _DosGetTime, @function 124 _DosGetTime: 125 _.LFB7: 79:systime.c **** 80:systime.c **** void DosGetTime(struct dostime *dt) 81:systime.c **** { 126 .loc 1 81 0 127 _.LVL8: 0 00002C4B 56 push si 0 00002C4C 55 push bp 130 _.LCFI6: 0 00002C4D 89E5 mov bp, sp 132 _.LCFI7: 0 00002C4F 8B7606 mov si, word ptr [bp+6] 82:systime.c **** ExecuteClockDriverRequest(C_INPUT); 134 .loc 1 82 0 0 00002C52 B004 mov al, 4 0 00002C54 50 push ax 0 00002C55 E8[FEFF] call _ExecuteClockDriverRequest 138 _.LVL9: 83:systime.c **** 84:systime.c **** if (ClkReqHdr.r_status & S_ERROR) 139 .loc 1 84 0 0 00002C58 833E[0300]00 cmp word ptr [_ClkReqHdr+3], 0 0 00002C5D 781A js _.L11 85:systime.c **** return; 86:systime.c **** 87:systime.c **** dt->hour = ClkRecord.clkHours; 142 .loc 1 87 0 0 00002C5F BB[0000] mov bx, offset _ClkRecord 0 00002C62 8A4703 mov al, byte ptr [bx+3] 0 00002C65 884401 mov byte ptr [si+1], al 88:systime.c **** dt->minute = ClkRecord.clkMinutes; 146 .loc 1 88 0 0 00002C68 8A4702 mov al, byte ptr [bx+2] 0 00002C6B 8804 mov byte ptr [si], al 89:systime.c **** dt->second = ClkRecord.clkSeconds; 149 .loc 1 89 0 0 00002C6D 8A4705 mov al, byte ptr [bx+5] 0 00002C70 884403 mov byte ptr [si+3], al 90:systime.c **** dt->hundredth = ClkRecord.clkHundredths; 152 .loc 1 90 0 0 00002C73 8A4704 mov al, byte ptr [bx+4] 0 00002C76 884402 mov byte ptr [si+2], al 155 _.L11: 91:systime.c **** } 156 .loc 1 91 0 0 00002C79 89EC mov sp, bp 0 00002C7B 5D pop bp 0 00002C7C 5E pop si 0 00002C7D C20200 ret 2 161 _.LFE7: 162 .size _DosGetTime, .-_DosGetTime 163 .global _DosSetTime 164 .type _DosSetTime, @function 165 _DosSetTime: 166 _.LFB8: 92:systime.c **** 93:systime.c **** int DosSetTime(const struct dostime *dt) 94:systime.c **** { 167 .loc 1 94 0 168 _.LVL10: 0 00002C80 56 push si 0 00002C81 55 push bp 171 _.LCFI8: 0 00002C82 89E5 mov bp, sp 173 _.LCFI9: 0 00002C84 8B7606 mov si, word ptr [bp+6] 95:systime.c **** if (dt->hour > 23 || dt->minute > 59 || 175 .loc 1 95 0 0 00002C87 807C0117 cmp byte ptr [si+1], 23 0 00002C8B 7753 ja _.L19 178 .loc 1 95 0 is_stmt 0 discriminator 1 0 00002C8D 803C3B cmp byte ptr [si], 59 0 00002C90 774E ja _.L19 181 .loc 1 95 0 discriminator 2 0 00002C92 807C033B cmp byte ptr [si+3], 59 0 00002C96 7748 ja _.L19 96:systime.c **** dt->second > 59 || dt->hundredth > 99) 184 .loc 1 96 0 is_stmt 1 0 00002C98 807C0263 cmp byte ptr [si+2], 99 0 00002C9C 7742 ja _.L19 97:systime.c **** return DE_INVLDDATA; 98:systime.c **** 99:systime.c **** /* for ClkRecord.clkDays */ 100:systime.c **** ExecuteClockDriverRequest(C_INPUT); 187 .loc 1 100 0 0 00002C9E B004 mov al, 4 0 00002CA0 50 push ax 0 00002CA1 E8[FEFF] call _ExecuteClockDriverRequest 191 _.LVL11: 101:systime.c **** 102:systime.c **** ClkRecord.clkHours = dt->hour; 192 .loc 1 102 0 0 00002CA4 8A4401 mov al, byte ptr [si+1] 0 00002CA7 BB[0000] mov bx, offset _ClkRecord 0 00002CAA 884703 mov byte ptr [bx+3], al 103:systime.c **** ClkRecord.clkMinutes = dt->minute; 196 .loc 1 103 0 0 00002CAD 8A04 mov al, byte ptr [si] 0 00002CAF 884702 mov byte ptr [bx+2], al 104:systime.c **** ClkRecord.clkSeconds = dt->second; 199 .loc 1 104 0 0 00002CB2 8A4403 mov al, byte ptr [si+3] 0 00002CB5 884705 mov byte ptr [bx+5], al 105:systime.c **** ClkRecord.clkHundredths = dt->hundredth; 202 .loc 1 105 0 0 00002CB8 8A4402 mov al, byte ptr [si+2] 0 00002CBB 884704 mov byte ptr [bx+4], al 106:systime.c **** 107:systime.c **** ExecuteClockDriverRequest(C_OUTPUT); 205 .loc 1 107 0 0 00002CBE B008 mov al, 8 0 00002CC0 50 push ax 0 00002CC1 E8[FEFF] call _ExecuteClockDriverRequest 209 _.LVL12: 108:systime.c **** 109:systime.c **** if (ClkReqHdr.r_status & S_ERROR) 210 .loc 1 109 0 0 00002CC4 BB[0000] mov bx, offset _ClkReqHdr 0 00002CC7 837F0300 cmp word ptr [bx+3], 0 0 00002CCB 7D18 jge _.L20 110:systime.c **** return char_error(&ClkReqHdr, (struct dhdr FAR *)clock); 214 .loc 1 110 0 0 00002CCD FF36[0200] push word ptr [_clock+2] 0 00002CD1 FF36[0000] push word ptr [_clock] 0 00002CD5 53 push bx 0 00002CD6 E8[FEFF] call _char_error 219 _.LVL13: 220 _.L14: 111:systime.c **** return SUCCESS; 112:systime.c **** } 221 .loc 1 112 0 0 00002CD9 89EC mov sp, bp 0 00002CDB 5D pop bp 0 00002CDC 5E pop si 0 00002CDD C20200 ret 2 226 _.L19: 97:systime.c **** 227 .loc 1 97 0 0 00002CE0 B8F3FF mov ax, -13 0 00002CE3 EBF4 jmp _.L14 230 _.L20: 111:systime.c **** return SUCCESS; 231 .loc 1 111 0 0 00002CE5 31C0 xor ax, ax 0 00002CE7 EBF0 jmp _.L14 234 _.LFE8: 235 .size _DosSetTime, .-_DosSetTime 236 .global _DosGetDate 237 .type _DosGetDate, @function 238 _DosGetDate: 239 _.LFB9: 113:systime.c **** 114:systime.c **** unsigned char DosGetDate(struct dosdate *dd) 115:systime.c **** { 240 .loc 1 115 0 241 _.LVL14: 0 00002CE9 56 push si 0 00002CEA 57 push di 0 00002CEB 55 push bp 245 _.LCFI10: 0 00002CEC 89E5 mov bp, sp 247 _.LCFI11: 0 00002CEE 1E push ds 0 00002CEF 1E push ds 116:systime.c **** UWORD c; 117:systime.c **** const UWORD *pdays; 118:systime.c **** UWORD Year, Month; 119:systime.c **** 120:systime.c **** ExecuteClockDriverRequest(C_INPUT); 250 .loc 1 120 0 0 00002CF0 B004 mov al, 4 0 00002CF2 50 push ax 0 00002CF3 E8[FEFF] call _ExecuteClockDriverRequest 254 _.LVL15: 0 00002CF6 30C0 xor al, al 121:systime.c **** 122:systime.c **** if (ClkReqHdr.r_status & S_ERROR) 256 .loc 1 122 0 0 00002CF8 833E[0300]00 cmp word ptr [_ClkReqHdr+3], 0 0 00002CFD 7851 js _.L22 259 _.LVL16: 123:systime.c **** return 0; 124:systime.c **** 125:systime.c **** for (Year = 1980, c = ClkRecord.clkDays;;) 260 .loc 1 125 0 0 00002CFF BE[0000] mov si, offset _ClkRecord 0 00002D02 8B14 mov dx, word ptr [si] 263 _.LVL17: 0 00002D04 BFBC07 mov di, 1980 0 00002D07 8976FE mov word ptr [bp-2], si 266 _.LVL18: 267 _.L26: 0 00002D0A 8956FC mov word ptr [bp-4], dx 269 _.LVL19: 126:systime.c **** { 127:systime.c **** pdays = is_leap_year_monthdays(Year); 270 .loc 1 127 0 0 00002D0D 57 push di 0 00002D0E E8[FEFF] call _is_leap_year_monthdays 273 _.LVL20: 0 00002D11 96 xchg si, ax 275 _.LVL21: 128:systime.c **** if (c >= pdays[12]) 276 .loc 1 128 0 0 00002D12 8B4418 mov ax, word ptr [si+24] 278 _.LVL22: 0 00002D15 8B56FC mov dx, word ptr [bp-4] 0 00002D18 39C2 cmp dx, ax 0 00002D1A 733C jnc _.L24 0 00002D1C B80100 mov ax, 1 283 _.LVL23: 284 _.L25: 129:systime.c **** { 130:systime.c **** ++Year; 131:systime.c **** c -= pdays[12]; 132:systime.c **** } 133:systime.c **** else 134:systime.c **** break; 135:systime.c **** } 136:systime.c **** 137:systime.c **** /* c contains the days left and count the number of days for */ 138:systime.c **** /* that year. Use this to index the table. */ 139:systime.c **** Month = 1; 140:systime.c **** while (c >= pdays[Month]) 285 .loc 1 140 0 0 00002D1F 89C3 mov bx, ax 0 00002D21 D1E3 shl bx, 1 0 00002D23 3B10 cmp dx, word ptr [bx+si] 0 00002D25 7336 jnc _.L27 141:systime.c **** { 142:systime.c **** ++Month; 143:systime.c **** } 144:systime.c **** 145:systime.c **** dd->year = Year; 290 .loc 1 145 0 0 00002D27 8B5E08 mov bx, word ptr [bp+8] 0 00002D2A 893F mov word ptr [bx], di 146:systime.c **** dd->month = Month; 293 .loc 1 146 0 0 00002D2C 884703 mov byte ptr [bx+3], al 147:systime.c **** dd->monthday = c - pdays[Month - 1] + 1; 295 .loc 1 147 0 0 00002D2F FEC2 inc dl 297 _.LVL24: 0 00002D31 05FF7F add ax, 32767 299 _.LVL25: 0 00002D34 93 xchg bx, ax 0 00002D35 D1E3 shl bx, 1 0 00002D37 2A10 sub dl, byte ptr [bx+si] 0 00002D39 8B5E08 mov bx, word ptr [bp+8] 0 00002D3C 885702 mov byte ptr [bx+2], dl 148:systime.c **** 149:systime.c **** /* Day of week is simple. Take mod 7, add 2 (for Tuesday */ 150:systime.c **** /* 1-1-80) and take mod again */ 151:systime.c **** 152:systime.c **** return (ClkRecord.clkDays + 2) % 7; 305 .loc 1 152 0 0 00002D3F 8B5EFE mov bx, word ptr [bp-2] 0 00002D42 8B07 mov ax, word ptr [bx] 308 _.LVL26: 0 00002D44 83C002 add ax, 2 0 00002D47 B90700 mov cx, 7 0 00002D4A 31D2 xor dx, dx 0 00002D4C F7F1 div cx 0 00002D4E 88D0 mov al, dl 314 _.LVL27: 315 _.L22: 153:systime.c **** } 316 .loc 1 153 0 0 00002D50 89EC mov sp, bp 0 00002D52 5D pop bp 0 00002D53 5F pop di 0 00002D54 5E pop si 0 00002D55 C20200 ret 2 322 _.LVL28: 323 _.L24: 130:systime.c **** c -= pdays[12]; 324 .loc 1 130 0 0 00002D58 47 inc di 326 _.LVL29: 131:systime.c **** } 327 .loc 1 131 0 0 00002D59 29C2 sub dx, ax 329 _.LVL30: 127:systime.c **** if (c >= pdays[12]) 330 .loc 1 127 0 0 00002D5B EBAD jmp _.L26 332 _.LVL31: 333 _.L27: 142:systime.c **** } 334 .loc 1 142 0 0 00002D5D 40 inc ax 336 _.LVL32: 0 00002D5E EBBF jmp _.L25 338 _.LFE9: 339 .size _DosGetDate, .-_DosGetDate 340 .global _DosSetDate 341 .type _DosSetDate, @function 342 _DosSetDate: 343 _.LFB10: 154:systime.c **** 155:systime.c **** int DosSetDate(const struct dosdate *dd) 156:systime.c **** { 344 .loc 1 156 0 345 _.LVL33: 0 00002D60 56 push si 0 00002D61 57 push di 0 00002D62 55 push bp 349 _.LCFI12: 0 00002D63 89E5 mov bp, sp 351 _.LCFI13: 0 00002D65 83EC06 sub sp, 6 0 00002D68 8B5E08 mov bx, word ptr [bp+8] 157:systime.c **** UWORD Year = dd->year; 354 .loc 1 157 0 0 00002D6B 8B37 mov si, word ptr [bx] 356 _.LVL34: 158:systime.c **** UWORD Month = dd->month; 357 .loc 1 158 0 0 00002D6D 8A4F03 mov cl, byte ptr [bx+3] 0 00002D70 884EFE mov byte ptr [bp-2], cl 0 00002D73 884EFB mov byte ptr [bp-5], cl 0 00002D76 C646FF00 mov byte ptr [bp-1], 0 362 _.LVL35: 159:systime.c **** UWORD DayOfMonth = dd->monthday; 363 .loc 1 159 0 0 00002D7A 8A5702 mov dl, byte ptr [bx+2] 0 00002D7D 30F6 xor dh, dh 0 00002D7F 8956FC mov word ptr [bp-4], dx 160:systime.c **** const UWORD *pdays = is_leap_year_monthdays(Year); 367 .loc 1 160 0 0 00002D82 56 push si 0 00002D83 E8[FEFF] call _is_leap_year_monthdays 370 _.LVL36: 0 00002D86 97 xchg di, ax 372 _.LVL37: 161:systime.c **** 162:systime.c **** if (Year < 1980 || Year > 2099 373 .loc 1 162 0 0 00002D87 8D8444F8 lea ax, [-1980+si] 375 _.LVL38: 0 00002D8B 83F877 cmp ax, 119 0 00002D8E 775A ja _.L35 163:systime.c **** || Month < 1 || Month > 12 378 .loc 1 163 0 0 00002D90 8B46FE mov ax, word ptr [bp-2] 0 00002D93 48 dec ax 164:systime.c **** || DayOfMonth < 1 381 .loc 1 164 0 0 00002D94 83F80C cmp ax, 11+1 0 00002D97 7351 jnc _.L35 0 00002D99 8B56FC mov dx, word ptr [bp-4] 0 00002D9C 85D2 test dx, dx 0 00002D9E 744A je _.L35 165:systime.c **** || DayOfMonth > pdays[Month] - pdays[Month - 1]) 387 .loc 1 165 0 0 00002DA0 8A4EFB mov cl, byte ptr [bp-5] 0 00002DA3 88C8 mov al, cl 0 00002DA5 30E4 xor ah, ah 0 00002DA7 D1E0 shl ax, 1 0 00002DA9 93 xchg bx, ax 0 00002DAA 8B01 mov ax, word ptr [bx+di] 0 00002DAC 2B41FE sub ax, word ptr [bx+di-2] 0 00002DAF 39C2 cmp dx, ax 0 00002DB1 7737 ja _.L35 166:systime.c **** return DE_INVLDDATA; 167:systime.c **** 168:systime.c **** ExecuteClockDriverRequest(C_INPUT); 397 .loc 1 168 0 0 00002DB3 B004 mov al, 4 0 00002DB5 50 push ax 0 00002DB6 E8[FEFF] call _ExecuteClockDriverRequest 401 _.LVL39: 169:systime.c **** 170:systime.c **** ClkRecord.clkDays = DaysFromYearMonthDay(Year, Month, DayOfMonth); 402 .loc 1 170 0 0 00002DB9 8B56FC mov dx, word ptr [bp-4] 0 00002DBC 52 push dx 0 00002DBD FF76FE push word ptr [bp-2] 0 00002DC0 56 push si 0 00002DC1 E8[FEFF] call _DaysFromYearMonthDay 408 _.LVL40: 0 00002DC4 A3[0000] mov word ptr [_ClkRecord], ax 171:systime.c **** 172:systime.c **** ExecuteClockDriverRequest(C_OUTPUT); 410 .loc 1 172 0 0 00002DC7 B008 mov al, 8 0 00002DC9 50 push ax 0 00002DCA E8[FEFF] call _ExecuteClockDriverRequest 414 _.LVL41: 173:systime.c **** 174:systime.c **** if (ClkReqHdr.r_status & S_ERROR) 415 .loc 1 174 0 0 00002DCD BB[0000] mov bx, offset _ClkReqHdr 0 00002DD0 837F0300 cmp word ptr [bx+3], 0 0 00002DD4 7D19 jge _.L36 175:systime.c **** return char_error(&ClkReqHdr, (struct dhdr FAR *)clock); 419 .loc 1 175 0 0 00002DD6 FF36[0200] push word ptr [_clock+2] 0 00002DDA FF36[0000] push word ptr [_clock] 0 00002DDE 53 push bx 0 00002DDF E8[FEFF] call _char_error 424 _.LVL42: 425 _.L31: 176:systime.c **** return SUCCESS; 177:systime.c **** } 426 .loc 1 177 0 0 00002DE2 89EC mov sp, bp 0 00002DE4 5D pop bp 0 00002DE5 5F pop di 430 _.LVL43: 0 00002DE6 5E pop si 432 _.LVL44: 0 00002DE7 C20200 ret 2 434 _.LVL45: 435 _.L35: 166:systime.c **** 436 .loc 1 166 0 0 00002DEA B8F3FF mov ax, -13 0 00002DED EBF3 jmp _.L31 439 _.L36: 176:systime.c **** return SUCCESS; 440 .loc 1 176 0 0 00002DEF 31C0 xor ax, ax 0 00002DF1 EBEF jmp _.L31 443 _.LFE10: 444 .size _DosSetDate, .-_DosSetDate 445 .global _days === Switch to base=012BB0h -> ".RODATA" 446 .section .rodata 447 .p2align 1 448 .type _days, @object 449 .size _days, 52 450 _days: 0 0000164C 0000 .hword 0 0 0000164E 1F00 .hword 31 0 00001650 3B00 .hword 59 0 00001652 5A00 .hword 90 0 00001654 7800 .hword 120 0 00001656 9700 .hword 151 0 00001658 B500 .hword 181 0 0000165A D400 .hword 212 0 0000165C F300 .hword 243 0 0000165E 1101 .hword 273 0 00001660 3001 .hword 304 0 00001662 4E01 .hword 334 0 00001664 6D01 .hword 365 0 00001666 0000 .hword 0 0 00001668 1F00 .hword 31 0 0000166A 3C00 .hword 60 0 0000166C 5B00 .hword 91 0 0000166E 7900 .hword 121 0 00001670 9800 .hword 152 0 00001672 B600 .hword 182 0 00001674 D500 .hword 213 0 00001676 F400 .hword 244 0 00001678 1201 .hword 274 0 0000167A 3101 .hword 305 0 0000167C 4F01 .hword 335 0 0000167E 6E01 .hword 366 === Switch to base unknown -> ".DEBUG_FRAME" === Trace listing source: task.lst GNU assembler version 2.39 (ia16-elf) using BFD version (GNU Binutils) 2.39. options passed : -a=task.lst --listing-cont-lines=9999 --listing-rhs-width=100 --listing-lhs-width=2 -ag input file : /tmp/cc3B0oNb.s output file : task.obj target : ia16-unknown-elf time stamp : 2026-04-23T22:29:54.000+0200 1 .arch i8086,jumps 2 .code16 3 .intel_syntax noprefix 4 #NO_APP === Switch to base=002270h -> ".TEXT" 5 .text 6 _.Ltext0: 7 .type _ExecMemAlloc, @function 8 _ExecMemAlloc: 9 _.LFB15: 10 .file 1 "task.c" 1:task.c **** /****************************************************************/ 2:task.c **** /* */ 3:task.c **** /* task.c */ 4:task.c **** /* */ 5:task.c **** /* Task Manager for DOS Processes */ 6:task.c **** /* */ 7:task.c **** /* Copyright (c) 1995 */ 8:task.c **** /* Pasquale J. Villani */ 9:task.c **** /* All Rights Reserved */ 10:task.c **** /* */ 11:task.c **** /* This file is part of DOS-C. */ 12:task.c **** /* */ 13:task.c **** /* DOS-C is free software; you can redistribute it and/or */ 14:task.c **** /* modify it under the terms of the GNU General Public License */ 15:task.c **** /* as published by the Free Software Foundation; either version */ 16:task.c **** /* 2, or (at your option) any later version. */ 17:task.c **** /* */ 18:task.c **** /* DOS-C is distributed in the hope that it will be useful, but */ 19:task.c **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 20:task.c **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 21:task.c **** /* the GNU General Public License for more details. */ 22:task.c **** /* */ 23:task.c **** /* You should have received a copy of the GNU General Public */ 24:task.c **** /* License along with DOS-C; see the file COPYING. If not, */ 25:task.c **** /* write to the Free Software Foundation, 675 Mass Ave, */ 26:task.c **** /* Cambridge, MA 02139, USA. */ 27:task.c **** /****************************************************************/ 28:task.c **** 29:task.c **** #include "portab.h" 30:task.c **** #include "globals.h" 31:task.c **** #include "debug.h" 32:task.c **** 33:task.c **** 34:task.c **** 35:task.c **** #define toupper(c) ((c) >= 'a' && (c) <= 'z' ? (c) + ('A' - 'a') : (c)) 36:task.c **** 37:task.c **** #define LOADNGO 0 38:task.c **** #define LOAD 1 39:task.c **** #define OVERLAY 3 40:task.c **** 41:task.c **** #define LOAD_HIGH 0x80 42:task.c **** 43:task.c **** /* static exe_header ExeHeader; 44:task.c **** to save some bytes, both static and on stack, 45:task.c **** we recycle SecPathBuffer TE */ 46:task.c **** 47:task.c **** #define ExeHeader (*(exe_header *)(SecPathName + 0)) 48:task.c **** #define TempExeBlock (*(exec_blk *)(SecPathName + sizeof(exe_header))) 49:task.c **** #define Shell (SecPathName + sizeof(exe_header) + sizeof(exec_blk)) 50:task.c **** 51:task.c **** #ifdef __TURBOC__ /* this is a Borlandism and doesn't work elsewhere */ 52:task.c **** #if sizeof(SecPathName) < sizeof(exe_header) + sizeof(exec_blk) + NAMEMAX 53:task.c **** #error No room in SecPathName to be recycled! 54:task.c **** #endif 55:task.c **** #endif 56:task.c **** 57:task.c **** #define CHUNK 32256 58:task.c **** #define MAXENV 32768u 59:task.c **** #define ENV_KEEPFREE 0x83 /* keep unallocated by environment variables */ 60:task.c **** /* The '65' added to nEnvSize does not cover the additional stuff: 61:task.c **** + 2 bytes: number of strings 62:task.c **** + 80h bytes: maximum absolute filename 63:task.c **** + 1 byte: '\0' 64:task.c **** -- 1999/04/21 ska */ 65:task.c **** 66:task.c **** intvec getvec(unsigned char intno) 67:task.c **** { 68:task.c **** intvec iv; 69:task.c **** disable(); 70:task.c **** iv = *(intvec FAR *)MK_FP(0,4 * (intno)); 71:task.c **** enable(); 72:task.c **** return iv; 73:task.c **** } 74:task.c **** 75:task.c **** void setvec(unsigned char intno, intvec vector) 76:task.c **** { 77:task.c **** disable(); 78:task.c **** *(intvec FAR *)MK_FP(0,4 * intno) = vector; 79:task.c **** enable(); 80:task.c **** } 81:task.c **** 82:task.c **** ULONG SftGetFsize(int sft_idx) 83:task.c **** { 84:task.c **** sft FAR *s = idx_to_sft(sft_idx); 85:task.c **** 86:task.c **** /* Get the SFT block that contains the SFT */ 87:task.c **** if (FP_OFF(s) == (size_t) -1) 88:task.c **** return DE_INVLDHNDL; 89:task.c **** 90:task.c **** return s->sft_size; 91:task.c **** } 92:task.c **** 93:task.c **** STATIC WORD SetverCompareFilename(BYTE FAR *m1, BYTE FAR *m2, COUNT c) 94:task.c **** { 95:task.c **** while (c--) 96:task.c **** { 97:task.c **** if (toupper(*m1) != toupper(*m2)) 98:task.c **** { 99:task.c **** return *m1 - *m2; 100:task.c **** } 101:task.c **** 102:task.c **** m1 = m1 + 1; m2 = m2 + 1; 103:task.c **** } 104:task.c **** 105:task.c **** return 0; 106:task.c **** } 107:task.c **** 108:task.c **** STATIC UWORD SetverGetVersion(BYTE FAR *table, BYTE FAR *name) 109:task.c **** { 110:task.c **** BYTE FAR *len; 111:task.c **** COUNT nlen; 112:task.c **** 113:task.c **** if ((table != NULL) && (name != NULL)) 114:task.c **** { 115:task.c **** nlen = fstrlen(name); 116:task.c **** 117:task.c **** while (*(len = table) != 0) 118:task.c **** { 119:task.c **** if ((*len == nlen) && (SetverCompareFilename(name, table + 1, *len) == 0)) 120:task.c **** { 121:task.c **** return *((UWORD FAR *)(table + *len + 1)); 122:task.c **** } 123:task.c **** 124:task.c **** table = table + *len + 3; 125:task.c **** } 126:task.c **** } 127:task.c **** 128:task.c **** return 0; 129:task.c **** } 130:task.c **** 131:task.c **** /* allocate memory for and copy current process env to child environment 132:task.c **** returns segment of env MCB (not env block itself) in pChildEnvSeg 133:task.c **** */ 134:task.c **** STATIC COUNT ChildEnv(exec_blk * exp, UWORD * pChildEnvSeg, char far * pathname) 135:task.c **** { 136:task.c **** BYTE FAR *pSrc; 137:task.c **** BYTE FAR *pDest; 138:task.c **** UWORD nEnvSize; 139:task.c **** COUNT RetCode; 140:task.c **** /* UWORD MaxEnvSize; 141:task.c **** psp FAR *ppsp = MK_FP(cu_psp, 0); 142:task.c **** *pChildEnvSeg = 0; /* initialize to invalid value, prevent free'ing random address on errors by c 143:task.c **** 144:task.c **** /* create a new environment for the process */ 145:task.c **** /* copy parent's environment if exec.env_seg == 0 */ 146:task.c **** 147:task.c **** ProcDbgPrintf(("ChildEnv: environment block is %u, using %s\n", exp->exec.env_seg, (exp->exec.env 148:task.c **** pSrc = exp->exec.env_seg ? 149:task.c **** MK_FP(exp->exec.env_seg, 0) : MK_FP(ppsp->ps_environ, 0); 150:task.c **** 151:task.c **** #if 0 152:task.c **** /* Every process requires an environment because of argv[0] 153:task.c **** -- 1999/04/21 ska */ 154:task.c **** */if (!pSrc) /* no environment to copy */ 155:task.c **** { 156:task.c **** *pChildEnvSeg = 0; 157:task.c **** return SUCCESS; 158:task.c **** } 159:task.c **** #endif 160:task.c **** 161:task.c **** nEnvSize = 1; 162:task.c **** /* This loop had not counted the very last '\0' 163:task.c **** -- 1999/04/21 ska */ 164:task.c **** if (pSrc) 165:task.c **** { /* if no environment is available, one byte is required */ 166:task.c **** 167:task.c **** for (nEnvSize = 0;; nEnvSize++) 168:task.c **** { 169:task.c **** /* Test env size and abort if greater than max */ 170:task.c **** if (nEnvSize >= MAXENV - ENV_KEEPFREE) 171:task.c **** return DE_INVLDENV; 172:task.c **** 173:task.c **** /* loop until first double terminator '\0\0' found */ 174:task.c **** if (*(UWORD FAR *) (pSrc + nEnvSize) == 0) 175:task.c **** break; 176:task.c **** } 177:task.c **** nEnvSize += 2; /* account for trailing \0\0 */ 178:task.c **** } 179:task.c **** 180:task.c **** /* allocate enough space for env + path (rounding up to nearest para) 181:task.c **** Note: we must allocate at least 1 paragraph (16 bytes) for empty environment 182:task.c **** + ENV_KEEPFREE for argv[0] (program name) 183:task.c **** */ 184:task.c **** /* ProcDbgPrintf(("PriPathName is %lu bytes\n", sizeof(PriPathName))); */ 185:task.c **** assert(sizeof(PriPathName)+3==ENV_KEEPFREE); 186:task.c **** if ((RetCode = DosMemAlloc((nEnvSize + ENV_KEEPFREE + 15)/16, 187:task.c **** mem_access_mode, pChildEnvSeg, 188:task.c **** NULL /*(UWORD FAR *) MaxEnvSize ska */ )) < 0) 189:task.c **** { 190:task.c **** ProcDbgPrintf(("Error alloc Env space\n")); 191:task.c **** return RetCode; 192:task.c **** } 193:task.c **** pDest = MK_FP(*pChildEnvSeg + 1, 0); /* skip past MCB and set pDest to start of env block */ 194:task.c **** 195:task.c **** /* fill the new env and inform the process of its */ 196:task.c **** /* location throught the psp */ 197:task.c **** 198:task.c **** /* copy the environment */ 199:task.c **** if (pSrc) 200:task.c **** { 201:task.c **** fmemcpy(pDest, pSrc, nEnvSize); 202:task.c **** pDest += nEnvSize; 203:task.c **** } 204:task.c **** else 205:task.c **** *pDest++ = '\0'; /* create an empty environment */ 206:task.c **** 207:task.c **** /* initialize 'extra strings' count */ 208:task.c **** *((UWORD FAR *) pDest) = 1; 209:task.c **** pDest += sizeof(UWORD) / sizeof(BYTE); 210:task.c **** 211:task.c **** /* copy complete pathname */ 212:task.c **** if ((RetCode = truename(pathname, PriPathName, CDS_MODE_SKIP_PHYSICAL)) < SUCCESS) 213:task.c **** { 214:task.c **** ProcDbgPrintf(("Failed to get truename for env argv0\n")); 215:task.c **** return RetCode; 216:task.c **** } 217:task.c **** ProcDbgPrintf(("ChildEnv for [%s]\n", PriPathName)); 218:task.c **** fstrcpy(pDest, PriPathName); 219:task.c **** 220:task.c **** /* Theoretically one could either: 221:task.c **** + resize the already allocated block to best-fit behind the pathname, or 222:task.c **** + generate the filename into a temporary buffer to allocate only the 223:task.c **** minimum required environment -- 1999/04/21 ska */ 224:task.c **** 225:task.c **** return SUCCESS; 226:task.c **** } 227:task.c **** 228:task.c **** /* The following code is 8086 dependant */ 229:task.c **** void new_psp(seg para, seg cur_psp) 230:task.c **** { 231:task.c **** psp FAR *p = MK_FP(para, 0); 232:task.c **** 233:task.c **** fmemcpy(p, MK_FP(cur_psp, 0), sizeof(psp)); 234:task.c **** 235:task.c **** /* terminate address */ 236:task.c **** p->ps_isv22 = getvec(0x22); 237:task.c **** /* break address */ 238:task.c **** p->ps_isv23 = getvec(0x23); 239:task.c **** /* critical error address */ 240:task.c **** p->ps_isv24 = getvec(0x24); 241:task.c **** /* RBIL is wrong on zeroing parent_psp, and in fact some 242:task.c **** * progs (Alpha Waves game, https://github.com/stsp/fdpp/issues/112) 243:task.c **** * won't work if its zeroed. */ 244:task.c **** #if 0 245:task.c **** /* parent psp segment set to 0 (see RBIL int21/ah=26) */ 246:task.c **** p->ps_parent = 0; 247:task.c **** #endif 248:task.c **** /* default system version for int21/ah=30 */ 249:task.c **** p->ps_retdosver = (os_setver_minor << 8) + os_setver_major; 250:task.c **** } 251:task.c **** 252:task.c **** void child_psp(seg para, seg cur_psp, int psize) 253:task.c **** { 254:task.c **** psp FAR *p = MK_FP(para, 0); 255:task.c **** psp FAR *q = MK_FP(cur_psp, 0); 256:task.c **** int i; 257:task.c **** 258:task.c **** new_psp(para, cur_psp); 259:task.c **** 260:task.c **** /* Now for parent-child relationships */ 261:task.c **** /* parent psp segment */ 262:task.c **** p->ps_parent = cu_psp; 263:task.c **** /* previous psp pointer */ 264:task.c **** p->ps_prevpsp = q; 265:task.c **** 266:task.c **** /* Environment and memory useage parameters */ 267:task.c **** /* memory size in paragraphs */ 268:task.c **** p->ps_size = psize; 269:task.c **** 270:task.c **** /* File System parameters */ 271:task.c **** /* maximum open files */ 272:task.c **** p->ps_maxfiles = 20; 273:task.c **** fmemset(p->ps_files, 0xff, 20); 274:task.c **** 275:task.c **** /* open file table pointer */ 276:task.c **** p->ps_filetab = p->ps_files; 277:task.c **** 278:task.c **** /* clone the file table -- 0xff is unused */ 279:task.c **** for (i = 0; i < 20; i++) 280:task.c **** if (CloneHandle(i) >= 0) 281:task.c **** p->ps_files[i] = q->ps_filetab[i]; 282:task.c **** 283:task.c **** /* first command line argument */ 284:task.c **** p->ps_fcb1.fcb_drive = 0; 285:task.c **** fmemset(p->ps_fcb1.fcb_fname, ' ', FNAME_SIZE + FEXT_SIZE); 286:task.c **** /* second command line argument */ 287:task.c **** p->ps_fcb2.fcb_drive = 0; 288:task.c **** fmemset(p->ps_fcb2.fcb_fname, ' ', FNAME_SIZE + FEXT_SIZE); 289:task.c **** 290:task.c **** /* local command line */ 291:task.c **** p->ps_cmd.ctCount = 0; 292:task.c **** p->ps_cmd.ctBuffer[0] = 0xd; /* command tail */ 293:task.c **** } 294:task.c **** 295:task.c **** STATIC UWORD patchPSP(UWORD pspseg, UWORD envseg, exec_blk FAR * exb, 296:task.c **** BYTE FAR * fnam) 297:task.c **** { 298:task.c **** psp FAR *psp; 299:task.c **** mcb FAR *pspmcb; 300:task.c **** int i; 301:task.c **** BYTE FAR *np; 302:task.c **** UWORD fakever; 303:task.c **** 304:task.c **** pspmcb = MK_FP(pspseg, 0); 305:task.c **** ++pspseg; 306:task.c **** psp = MK_FP(pspseg, 0); 307:task.c **** 308:task.c **** /* complete the psp by adding the command line and FCBs */ 309:task.c **** fmemcpy(&psp->ps_cmd, exb->exec.cmd_line, sizeof(CommandTail)); 310:task.c **** if (FP_OFF(exb->exec.fcb_1) != 0xffff) 311:task.c **** { 312:task.c **** fmemcpy(&psp->ps_fcb1, exb->exec.fcb_1, 16); 313:task.c **** fmemcpy(&psp->ps_fcb2, exb->exec.fcb_2, 16); 314:task.c **** } 315:task.c **** 316:task.c **** /* identify the mcb as this functions' */ 317:task.c **** pspmcb->m_psp = pspseg; 318:task.c **** /* Patch in environment segment, if present, also adjust its MCB */ 319:task.c **** if (envseg) 320:task.c **** { 321:task.c **** ((mcb FAR *) MK_FP(envseg, 0))->m_psp = pspseg; 322:task.c **** envseg++; 323:task.c **** } 324:task.c **** psp->ps_environ = envseg; 325:task.c **** 326:task.c **** /* use the file name less extension - left adjusted and */ 327:task.c **** np = fnam; 328:task.c **** for (;;) 329:task.c **** { 330:task.c **** switch (*fnam++) 331:task.c **** { 332:task.c **** case '\0': 333:task.c **** goto set_name; 334:task.c **** case ':': 335:task.c **** case '/': 336:task.c **** case '\\': 337:task.c **** np = fnam; 338:task.c **** } 339:task.c **** } 340:task.c **** set_name: 341:task.c **** for (i = 0; i < 8 && np[i] != '.' && np[i] != '\0'; i++) 342:task.c **** { 343:task.c **** pspmcb->m_name[i] = toupper(np[i]); 344:task.c **** } 345:task.c **** if (i < 8) 346:task.c **** pspmcb->m_name[i] = '\0'; 347:task.c **** 348:task.c **** if ((fakever = SetverGetVersion(setverPtr, np)) != 0) 349:task.c **** { 350:task.c **** psp->ps_retdosver = fakever; 351:task.c **** } 352:task.c **** 353:task.c **** /* return value: AX value to be passed based on FCB values */ 354:task.c **** return (get_cds1(psp->ps_fcb1.fcb_drive) ? 0 : 0xff) | 355:task.c **** (get_cds1(psp->ps_fcb2.fcb_drive) ? 0 : 0xff00); 356:task.c **** } 357:task.c **** 358:task.c **** STATIC int load_transfer(UWORD ds, exec_blk *exp, UWORD fcbcode, COUNT mode) 359:task.c **** { 360:task.c **** psp FAR *p = MK_FP(ds, 0); 361:task.c **** psp FAR *q = MK_FP(cu_psp, 0); 362:task.c **** 363:task.c **** /* Transfer control to the executable */ 364:task.c **** p->ps_parent = cu_psp; 365:task.c **** p->ps_prevpsp = q; 366:task.c **** q->ps_stack = (BYTE FAR *)user_r; 367:task.c **** user_r->FLAGS &= ~FLG_CARRY; 368:task.c **** 369:task.c **** cu_psp = ds; 370:task.c **** /* process dta */ 371:task.c **** dta = &p->ps_cmd; 372:task.c **** 373:task.c **** if (mode == LOADNGO) 374:task.c **** { 375:task.c **** iregs FAR *irp; 376:task.c **** 377:task.c **** /* build the user area on the stack */ 378:task.c **** irp = (iregs FAR *)(exp->exec.stack - sizeof(iregs)); 379:task.c **** 380:task.c **** /* start allocating REGs (as in MS-DOS - some demos expect them so --LG) */ 381:task.c **** /* see http://www.beroset.com/asm/showregs.asm */ 382:task.c **** irp->DX = irp->ES = irp->DS = ds; 383:task.c **** irp->CS = FP_SEG(exp->exec.start_addr); 384:task.c **** irp->SI = irp->IP = FP_OFF(exp->exec.start_addr); 385:task.c **** irp->DI = FP_OFF(exp->exec.stack); 386:task.c **** irp->BP = 0x91e; /* this is more or less random but some programs 387:task.c **** expect 0x9 in the high byte of BP!! */ 388:task.c **** irp->AX = irp->BX = fcbcode; 389:task.c **** irp->CX = 0xFF; 390:task.c **** irp->FLAGS = 0x200; 391:task.c **** 392:task.c **** if (InDOS) 393:task.c **** --InDOS; 394:task.c **** exec_user(irp, 1); 395:task.c **** 396:task.c **** /* We should never be here 397:task.c **** fatal("KERNEL RETURNED!!!"); */ 398:task.c **** } 399:task.c **** /* mode == LOAD */ 400:task.c **** exp->exec.stack -= 2; 401:task.c **** *((UWORD FAR *)(exp->exec.stack)) = fcbcode; 402:task.c **** return SUCCESS; 403:task.c **** } 404:task.c **** 405:task.c **** /* Now find out how many paragraphs are available 406:task.c **** considering a threshold, trying HIGH then LOW */ 407:task.c **** STATIC int ExecMemLargest(UWORD *asize, UWORD threshold) 408:task.c **** { 409:task.c **** int rc; 410:task.c **** if (mem_access_mode & 0x80) 411:task.c **** { 412:task.c **** mem_access_mode &= ~0x80; 413:task.c **** mem_access_mode |= 0x40; 414:task.c **** rc = DosMemLargest(asize); 415:task.c **** mem_access_mode &= ~0x40; 416:task.c **** /* less memory than the .COM/.EXE file has: 417:task.c **** try low memory first */ 418:task.c **** if (rc != SUCCESS || *asize < threshold) 419:task.c **** rc = DosMemLargest(asize); 420:task.c **** mem_access_mode |= 0x80; 421:task.c **** } 422:task.c **** else 423:task.c **** rc = DosMemLargest(asize); 424:task.c **** return (*asize < threshold ? DE_NOMEM : rc); 425:task.c **** } 426:task.c **** 427:task.c **** STATIC int ExecMemAlloc(UWORD size, seg *para, UWORD *asize) 428:task.c **** { 11 .loc 1 428 0 12 _.LVL0: 0 00009FF3 56 push si 0 00009FF4 57 push di 0 00009FF5 55 push bp 16 _.LCFI0: 0 00009FF6 89E5 mov bp, sp 18 _.LCFI1: 0 00009FF8 1E push ds 0 00009FF9 1E push ds 0 00009FFA 8B7E0A mov di, word ptr [bp+10] 0 00009FFD 8B760C mov si, word ptr [bp+12] 429:task.c **** /* We can still get an error on first fit if the above */ 430:task.c **** /* returned size was a best fit case */ 431:task.c **** /* ModeLoadHigh = 80 = try high, then low */ 432:task.c **** int rc = DosMemAlloc(size, mem_access_mode, para, asize); 23 .loc 1 432 0 0 0000A000 56 push si 0 0000A001 57 push di 0 0000A002 A0[0000] mov al, byte ptr [_mem_access_mode] 0 0000A005 30E4 xor ah, ah 0 0000A007 50 push ax 0 0000A008 FF7608 push word ptr [bp+8] 0 0000A00B E8[FEFF] call _DosMemAlloc 31 _.LVL1: 433:task.c **** 434:task.c **** if (rc != SUCCESS) 32 .loc 1 434 0 0 0000A00E 85C0 test ax, ax 0 0000A010 7448 je _.L2 435:task.c **** { 436:task.c **** if (rc == DE_NOMEM) 35 .loc 1 436 0 0 0000A012 83F8F8 cmp ax, -8 0 0000A015 753B jne _.L1 437:task.c **** { 438:task.c **** rc = DosMemAlloc(0, LARGEST, para, asize); 38 .loc 1 438 0 0 0000A017 56 push si 0 0000A018 57 push di 0 0000A019 B9FFFF mov cx, -1 0 0000A01C 51 push cx 0 0000A01D 894EFC mov word ptr [bp-4], cx 0 0000A020 31D2 xor dx, dx 0 0000A022 52 push dx 0 0000A023 8956FE mov word ptr [bp-2], dx 0 0000A026 E8[FEFF] call _DosMemAlloc 48 _.LVL2: 439:task.c **** if ((mem_access_mode & 0x80) && (rc != SUCCESS)) 49 .loc 1 439 0 0 0000A029 8A1E[0000] mov bl, byte ptr [_mem_access_mode] 0 0000A02D 84DB test bl, bl 0 0000A02F 8B56FE mov dx, word ptr [bp-2] 0 0000A032 8B4EFC mov cx, word ptr [bp-4] 0 0000A035 7D17 jge _.L4 55 .loc 1 439 0 is_stmt 0 discriminator 1 0 0000A037 85C0 test ax, ax 0 0000A039 7424 je _.L6 440:task.c **** { 441:task.c **** mem_access_mode &= ~0x80; 58 .loc 1 441 0 is_stmt 1 0 0000A03B 80E37F and bl, 127 0 0000A03E 881E[0000] mov byte ptr [_mem_access_mode], bl 442:task.c **** rc = DosMemAlloc(0, LARGEST, para, asize); 61 .loc 1 442 0 0 0000A042 56 push si 0 0000A043 57 push di 0 0000A044 51 push cx 0 0000A045 52 push dx 0 0000A046 E8[FEFF] call _DosMemAlloc 67 _.LVL3: 443:task.c **** mem_access_mode |= 0x80; 68 .loc 1 443 0 0 0000A049 800E[0000]80 or byte ptr [_mem_access_mode], -128 70 _.L4: 444:task.c **** } 445:task.c **** } 446:task.c **** } 447:task.c **** else 448:task.c **** { 449:task.c **** /* with no error, we got exactly what we asked for */ 450:task.c **** *asize = size; 451:task.c **** } 452:task.c **** 453:task.c **** /* This should never happen, but ... */ 454:task.c **** if (rc == SUCCESS && *asize < size) 71 .loc 1 454 0 0 0000A04E 85C0 test ax, ax 0 0000A050 740D je _.L6 74 _.LVL4: 75 _.L1: 455:task.c **** { 456:task.c **** DosMemFree(*para); 457:task.c **** return DE_NOMEM; 458:task.c **** } 459:task.c **** return rc; 460:task.c **** } 76 .loc 1 460 0 0 0000A052 89EC mov sp, bp 0 0000A054 5D pop bp 0 0000A055 5F pop di 0 0000A056 5E pop si 0 0000A057 C20600 ret 6 82 _.LVL5: 83 _.L2: 450:task.c **** } 84 .loc 1 450 0 0 0000A05A 8B4608 mov ax, word ptr [bp+8] 86 _.LVL6: 0 0000A05D 8904 mov word ptr [si], ax 88 _.L6: 0 0000A05F 31C0 xor ax, ax 454:task.c **** { 90 .loc 1 454 0 discriminator 1 0 0000A061 8B5608 mov dx, word ptr [bp+8] 0 0000A064 3B14 cmp dx, word ptr [si] 0 0000A066 76EA jbe _.L1 456:task.c **** return DE_NOMEM; 94 .loc 1 456 0 0 0000A068 FF35 push word ptr [di] 0 0000A06A E8[FEFF] call _DosMemFree 97 _.LVL7: 457:task.c **** } 98 .loc 1 457 0 0 0000A06D B8F8FF mov ax, -8 0 0000A070 EBE0 jmp _.L1 101 _.LFE15: 102 .size _ExecMemAlloc, .-_ExecMemAlloc 103 .type _ChildEnv, @function 104 _ChildEnv: 105 _.LFB9: 135:task.c **** BYTE FAR *pSrc; 106 .loc 1 135 0 107 _.LVL8: 0 0000A072 56 push si 0 0000A073 57 push di 0 0000A074 55 push bp 111 _.LCFI2: 0 0000A075 89E5 mov bp, sp 113 _.LCFI3: 0 0000A077 83EC08 sub sp, 8 0 0000A07A 8B760A mov si, word ptr [bp+10] 0 0000A07D C4460C les ax, dword ptr [bp+12] 0 0000A080 8946FE mov word ptr [bp-2], ax 0 0000A083 8C46FC mov word ptr [bp-4], es 141:task.c **** *pChildEnvSeg = 0; /* initialize to invalid value, prevent free'ing random address on errors by c 119 .loc 1 141 0 0 0000A086 A1[0000] mov ax, word ptr [_cu_psp] 121 _.LVL9: 142:task.c **** 122 .loc 1 142 0 0 0000A089 C7040000 mov word ptr [si], 0 148:task.c **** MK_FP(exp->exec.env_seg, 0) : MK_FP(ppsp->ps_environ, 0); 124 .loc 1 148 0 0 0000A08D 8B5E08 mov bx, word ptr [bp+8] 0 0000A090 8B1F mov bx, word ptr [bx] 149:task.c **** 127 .loc 1 149 0 0 0000A092 85DB test bx, bx 0 0000A094 B90000 mov cx, 0 0 0000A097 7507 jne _.L15 149:task.c **** 131 .loc 1 149 0 is_stmt 0 discriminator 2 0 0000A099 8EC0 mov es, ax 0 0000A09B 268B1E2C00 mov bx, word ptr es:[44] 134 _.L15: 135 _.LVL10: 164:task.c **** { /* if no environment is available, one byte is required */ 136 .loc 1 164 0 is_stmt 1 0 0000A0A0 89C8 mov ax, cx 138 _.LVL11: 0 0000A0A2 09D8 or ax, bx 0 0000A0A4 85C0 test ax, ax 0 0000A0A6 7503E98A00 je _.L24 0 0000A0AB B87D7F mov ax, 32637 0 0000A0AE 31FF xor di, di 144 _.LVL12: 145 _.L20: 174:task.c **** break; 146 .loc 1 174 0 0 0000A0B0 8EC3 mov es, bx 0 0000A0B2 26833D00 cmp word ptr es:[di], 0 0 0000A0B6 7409 je _.L18 167:task.c **** { 150 .loc 1 167 0 0 0000A0B8 47 inc di 152 _.LVL13: 170:task.c **** return DE_INVLDENV; 153 .loc 1 170 0 0 0000A0B9 48 dec ax 0 0000A0BA 75F4 jne _.L20 171:task.c **** 156 .loc 1 171 0 0 0000A0BC B8F6FF mov ax, -10 0 0000A0BF EB6C jmp _.L13 159 _.L18: 177:task.c **** } 160 .loc 1 177 0 0 0000A0C1 83C702 add di, 2 162 _.LVL14: 163 _.L16: 0 0000A0C4 895EF8 mov word ptr [bp-8], bx 186:task.c **** mem_access_mode, pChildEnvSeg, 165 .loc 1 186 0 0 0000A0C7 51 push cx 0 0000A0C8 894EFA mov word ptr [bp-6], cx 0 0000A0CB 56 push si 0 0000A0CC A0[0000] mov al, byte ptr [_mem_access_mode] 0 0000A0CF 30E4 xor ah, ah 0 0000A0D1 50 push ax 0 0000A0D2 8D859200 lea ax, [146+di] 0 0000A0D6 B104 mov cl, 4 174 _.LVL15: 0 0000A0D8 D3E8 shr ax, cl 0 0000A0DA 50 push ax 177 _.LVL16: 0 0000A0DB E8[FEFF] call _DosMemAlloc 179 _.LVL17: 0 0000A0DE 85C0 test ax, ax 0 0000A0E0 7C4B jl _.L13 193:task.c **** 182 .loc 1 193 0 0 0000A0E2 8B34 mov si, word ptr [si] 0 0000A0E4 46 inc si 185 _.LVL18: 199:task.c **** { 186 .loc 1 199 0 0 0000A0E5 8B4EFA mov cx, word ptr [bp-6] 0 0000A0E8 89C8 mov ax, cx 189 _.LVL19: 0 0000A0EA 8B5EF8 mov bx, word ptr [bp-8] 0 0000A0ED 09D8 or ax, bx 0 0000A0EF BA0100 mov dx, 1 0 0000A0F2 7446 je _.L21 0 0000A0F4 8956FA mov word ptr [bp-6], dx 195 _.LVL20: 201:task.c **** pDest += nEnvSize; 196 .loc 1 201 0 0 0000A0F7 57 push di 0 0000A0F8 53 push bx 0 0000A0F9 51 push cx 0 0000A0FA 56 push si 0 0000A0FB 51 push cx 0 0000A0FC E8[FEFF] call _fmemcpy 203 _.LVL21: 0 0000A0FF 8B56FA mov dx, word ptr [bp-6] 205 _.LVL22: 206 _.L23: 208:task.c **** pDest += sizeof(UWORD) / sizeof(BYTE); 207 .loc 1 208 0 0 0000A102 8EC6 mov es, si 0 0000A104 26C7050100 mov word ptr es:[di], 1 210 _.LVL23: 212:task.c **** { 211 .loc 1 212 0 0 0000A109 52 push dx 0 0000A10A BA[0000] mov dx, offset __PriPathBuffer 0 0000A10D 52 push dx 0 0000A10E 8956FA mov word ptr [bp-6], dx 0 0000A111 FF76FC push word ptr [bp-4] 0 0000A114 FF76FE push word ptr [bp-2] 0 0000A117 E8[FEFF] call _truename 219 _.LVL24: 0 0000A11A 85C0 test ax, ax 0 0000A11C 7C0F jl _.L13 218:task.c **** 222 .loc 1 218 0 0 0000A11E 16 push ss 0 0000A11F 8B56FA mov dx, word ptr [bp-6] 0 0000A122 52 push dx 209:task.c **** 226 .loc 1 209 0 0 0000A123 8D4502 lea ax, [2+di] 228 _.LVL25: 218:task.c **** 229 .loc 1 218 0 0 0000A126 56 push si 0 0000A127 50 push ax 0 0000A128 E8[FEFF] call _fstrcpy 233 _.LVL26: 225:task.c **** } 234 .loc 1 225 0 0 0000A12B 31C0 xor ax, ax 236 _.LVL27: 237 _.L13: 226:task.c **** 238 .loc 1 226 0 0 0000A12D 89EC mov sp, bp 0 0000A12F 5D pop bp 0 0000A130 5F pop di 0 0000A131 5E pop si 0 0000A132 C20800 ret 8 244 _.LVL28: 245 _.L24: 161:task.c **** /* This loop had not counted the very last '\0' 246 .loc 1 161 0 0 0000A135 BF0100 mov di, 1 0 0000A138 EB8A jmp _.L16 249 _.LVL29: 250 _.L21: 205:task.c **** 251 .loc 1 205 0 0 0000A13A 89D7 mov di, dx 253 _.LVL30: 0 0000A13C 8EC6 mov es, si 0 0000A13E 26A20000 mov byte ptr es:[0], al 256 _.LVL31: 0 0000A142 EBBE jmp _.L23 258 _.LFE9: 259 .size _ChildEnv, .-_ChildEnv 260 .type _ExecMemLargest, @function 261 _ExecMemLargest: 262 _.LFB14: 408:task.c **** int rc; 263 .loc 1 408 0 264 _.LVL32: 0 0000A144 56 push si 0 0000A145 57 push di 0 0000A146 55 push bp 268 _.LCFI4: 0 0000A147 89E5 mov bp, sp 270 _.LCFI5: 0 0000A149 8B7608 mov si, word ptr [bp+8] 0 0000A14C 8B7E0A mov di, word ptr [bp+10] 410:task.c **** { 273 .loc 1 410 0 0 0000A14F A0[0000] mov al, byte ptr [_mem_access_mode] 0 0000A152 84C0 test al, al 0 0000A154 7D30 jge _.L28 412:task.c **** mem_access_mode |= 0x40; 277 .loc 1 412 0 0 0000A156 247F and al, 127 413:task.c **** rc = DosMemLargest(asize); 279 .loc 1 413 0 0 0000A158 0C40 or al, 64 0 0000A15A A2[0000] mov byte ptr [_mem_access_mode], al 414:task.c **** mem_access_mode &= ~0x40; 282 .loc 1 414 0 0 0000A15D 56 push si 0 0000A15E E8[FEFF] call _DosMemLargest 285 _.LVL33: 415:task.c **** /* less memory than the .COM/.EXE file has: 286 .loc 1 415 0 0 0000A161 8026[0000]BF and byte ptr [_mem_access_mode], -65 418:task.c **** rc = DosMemLargest(asize); 288 .loc 1 418 0 0 0000A166 85C0 test ax, ax 0 0000A168 7504 jne _.L29 418:task.c **** rc = DosMemLargest(asize); 291 .loc 1 418 0 is_stmt 0 discriminator 1 0 0000A16A 393C cmp word ptr [si], di 0 0000A16C 7304 jnc _.L30 294 _.L29: 419:task.c **** mem_access_mode |= 0x80; 295 .loc 1 419 0 is_stmt 1 0 0000A16E 56 push si 0 0000A16F E8[FEFF] call _DosMemLargest 298 _.LVL34: 299 _.L30: 420:task.c **** } 300 .loc 1 420 0 0 0000A172 800E[0000]80 or byte ptr [_mem_access_mode], -128 302 _.L31: 424:task.c **** } 303 .loc 1 424 0 0 0000A177 3B3C cmp di, word ptr [si] 0 0000A179 7603 jbe _.L27 0 0000A17B B8F8FF mov ax, -8 307 _.LVL35: 308 _.L27: 425:task.c **** 309 .loc 1 425 0 0 0000A17E 89EC mov sp, bp 0 0000A180 5D pop bp 0 0000A181 5F pop di 0 0000A182 5E pop si 0 0000A183 C20400 ret 4 315 _.L28: 423:task.c **** return (*asize < threshold ? DE_NOMEM : rc); 316 .loc 1 423 0 0 0000A186 56 push si 0 0000A187 E8[FEFF] call _DosMemLargest 319 _.LVL36: 0 0000A18A EBEB jmp _.L31 321 _.LFE14: 322 .size _ExecMemLargest, .-_ExecMemLargest 323 .type _patchPSP, @function 324 _patchPSP: 325 _.LFB12: 297:task.c **** psp FAR *psp; 326 .loc 1 297 0 327 _.LVL37: 0 0000A18C 56 push si 0 0000A18D 57 push di 0 0000A18E 55 push bp 331 _.LCFI6: 0 0000A18F 89E5 mov bp, sp 333 _.LCFI7: 0 0000A191 83EC0E sub sp, 14 0 0000A194 8B760C mov si, word ptr [bp+12] 0 0000A197 8B460E mov ax, word ptr [bp+14] 0 0000A19A 8946FC mov word ptr [bp-4], ax 0 0000A19D 8B7E10 mov di, word ptr [bp+16] 0 0000A1A0 8B4612 mov ax, word ptr [bp+18] 0 0000A1A3 8946FA mov word ptr [bp-6], ax 341 _.LVL38: 305:task.c **** psp = MK_FP(pspseg, 0); 342 .loc 1 305 0 0 0000A1A6 8B4608 mov ax, word ptr [bp+8] 0 0000A1A9 40 inc ax 0 0000A1AA 8946FE mov word ptr [bp-2], ax 346 _.LVL39: 309:task.c **** if (FP_OFF(exb->exec.fcb_1) != 0xffff) 347 .loc 1 309 0 0 0000A1AD B88000 mov ax, 128 349 _.LVL40: 0 0000A1B0 50 push ax 0 0000A1B1 8E46FC mov es, word ptr [bp-4] 0 0000A1B4 26FF7404 push word ptr es:[si+4] 0 0000A1B8 26FF7402 push word ptr es:[si+2] 0 0000A1BC FF76FE push word ptr [bp-2] 0 0000A1BF 50 push ax 0 0000A1C0 E8[FEFF] call _fmemcpy 357 _.LVL41: 310:task.c **** { 358 .loc 1 310 0 0 0000A1C3 8E46FC mov es, word ptr [bp-4] 0 0000A1C6 268B5406 mov dx, word ptr es:[si+6] 0 0000A1CA 268B4C08 mov cx, word ptr es:[si+8] 0 0000A1CE 83FAFF cmp dx, -1 0 0000A1D1 742C je _.L35 312:task.c **** fmemcpy(&psp->ps_fcb2, exb->exec.fcb_2, 16); 364 .loc 1 312 0 0 0000A1D3 B81000 mov ax, 16 0 0000A1D6 50 push ax 0 0000A1D7 8946F8 mov word ptr [bp-8], ax 0 0000A1DA 51 push cx 0 0000A1DB 52 push dx 0 0000A1DC FF76FE push word ptr [bp-2] 0 0000A1DF BA5C00 mov dx, 92 0 0000A1E2 52 push dx 0 0000A1E3 E8[FEFF] call _fmemcpy 374 _.LVL42: 313:task.c **** } 375 .loc 1 313 0 0 0000A1E6 8B46F8 mov ax, word ptr [bp-8] 0 0000A1E9 50 push ax 0 0000A1EA 8E46FC mov es, word ptr [bp-4] 0 0000A1ED 26FF740C push word ptr es:[si+12] 0 0000A1F1 26FF740A push word ptr es:[si+10] 0 0000A1F5 FF76FE push word ptr [bp-2] 0 0000A1F8 B86C00 mov ax, 108 0 0000A1FB 50 push ax 0 0000A1FC E8[FEFF] call _fmemcpy 385 _.LVL43: 386 _.L35: 317:task.c **** /* Patch in environment segment, if present, also adjust its MCB */ 387 .loc 1 317 0 0 0000A1FF 8E4608 mov es, word ptr [bp+8] 0 0000A202 8B46FE mov ax, word ptr [bp-2] 0 0000A205 26A30100 mov word ptr es:[1], ax 391 _.LVL44: 319:task.c **** { 392 .loc 1 319 0 0 0000A209 837E0A00 cmp word ptr [bp+10], 0 0 0000A20D 740D je _.L36 321:task.c **** envseg++; 395 .loc 1 321 0 0 0000A20F 8E460A mov es, word ptr [bp+10] 0 0000A212 8B46FE mov ax, word ptr [bp-2] 0 0000A215 26A30100 mov word ptr es:[1], ax 322:task.c **** } 399 .loc 1 322 0 0 0000A219 FF460A inc word ptr [bp+10] 401 _.LVL45: 402 _.L36: 324:task.c **** 403 .loc 1 324 0 0 0000A21C 8E46FE mov es, word ptr [bp-2] 0 0000A21F 8B460A mov ax, word ptr [bp+10] 0 0000A222 26A32C00 mov word ptr es:[44], ax 407 _.LVL46: 327:task.c **** for (;;) 408 .loc 1 327 0 0 0000A226 89FE mov si, di 410 _.LVL47: 411 _.L37: 330:task.c **** { 412 .loc 1 330 0 0 0000A228 8D5501 lea dx, [1+di] 414 _.LVL48: 0 0000A22B 8E46FA mov es, word ptr [bp-6] 0 0000A22E 268A05 mov al, byte ptr es:[di] 0 0000A231 3C2F cmp al, 47 0 0000A233 7415 je _.L39 0 0000A235 7F0B jg _.L40 0 0000A237 84C0 test al, al 0 0000A239 7503E9F400 je _.L41 422 _.L38: 337:task.c **** } 423 .loc 1 337 0 0 0000A23E 89D7 mov di, dx 0 0000A240 EBE6 jmp _.L37 426 _.L40: 330:task.c **** { 427 .loc 1 330 0 0 0000A242 3C3A cmp al, 58 0 0000A244 7404 je _.L39 0 0000A246 3C5C cmp al, 92 0 0000A248 75F4 jne _.L38 432 _.L39: 433 _.LVL49: 337:task.c **** } 434 .loc 1 337 0 0 0000A24A 89D6 mov si, dx 0 0000A24C EBF0 jmp _.L38 437 _.LVL50: 438 _.L45: 343:task.c **** } 439 .loc 1 343 0 0 0000A24E 88C4 mov ah, al 0 0000A250 80C49F add ah, -97 0 0000A253 80FC19 cmp ah, 25 0 0000A256 7702 ja _.L42 343:task.c **** } 444 .loc 1 343 0 is_stmt 0 discriminator 1 0 0000A258 04E0 add al, -32 446 _.L42: 343:task.c **** } 447 .loc 1 343 0 discriminator 4 0 0000A25A 8E4608 mov es, word ptr [bp+8] 0 0000A25D 26884708 mov byte ptr es:[bx+8], al 341:task.c **** { 450 .loc 1 341 0 is_stmt 1 discriminator 4 0 0000A261 43 inc bx 452 _.LVL51: 0 0000A262 4A dec dx 0 0000A263 7403E9CF00 jne _.L43 455 _.L44: 348:task.c **** { 456 .loc 1 348 0 0 0000A268 8B3E[0000] mov di, word ptr [_setverPtr] 0 0000A26C A1[0200] mov ax, word ptr [_setverPtr+2] 0 0000A26F 8946FC mov word ptr [bp-4], ax 460 _.LVL52: 461 _.LBB73: 462 _.LBB74: 113:task.c **** { 463 .loc 1 113 0 0 0000A272 09F8 or ax, di 465 _.LVL53: 0 0000A274 7503E98500 je _.L50 0 0000A279 8B46FA mov ax, word ptr [bp-6] 0 0000A27C 09F0 or ax, si 0 0000A27E 747E je _.L50 115:task.c **** 470 .loc 1 115 0 0 0000A280 FF76FA push word ptr [bp-6] 0 0000A283 56 push si 0 0000A284 E8[FEFF] call _fstrlen 474 _.LVL54: 0 0000A287 8ED8 mov ds, ax 476 _.LVL55: 0 0000A289 89FB mov bx, di 478 _.LVL56: 479 _.L51: 117:task.c **** { 480 .loc 1 117 0 0 0000A28B 8E46FC mov es, word ptr [bp-4] 0 0000A28E 268A17 mov dl, byte ptr es:[bx] 0 0000A291 84D2 test dl, dl 0 0000A293 7469 je _.L50 119:task.c **** { 485 .loc 1 119 0 0 0000A295 88D0 mov al, dl 0 0000A297 98 cbw 0 0000A298 8CD9 mov cx, ds 0 0000A29A 39C1 cmp cx, ax 0 0000A29C 7403E9C000 jne _.L52 491 _.LVL57: 0 0000A2A1 89D8 mov ax, bx 0 0000A2A3 40 inc ax 0 0000A2A4 8946F4 mov word ptr [bp-12], ax 495 _.LVL58: 0 0000A2A7 8CD8 mov ax, ds 497 _.LVL59: 0 0000A2A9 8976F8 mov word ptr [bp-8], si 499 _.LVL60: 500 _.L53: 501 _.LBB75: 502 _.LBB76: 95:task.c **** { 503 .loc 1 95 0 0 0000A2AC 89C1 mov cx, ax 0 0000A2AE 49 dec cx 0 0000A2AF 894EF2 mov word ptr [bp-14], cx 507 _.LVL61: 0 0000A2B2 85C0 test ax, ax 0 0000A2B4 7437 je _.L62 97:task.c **** { 510 .loc 1 97 0 0 0000A2B6 C47EF8 les di, dword ptr [bp-8] 0 0000A2B9 268A0D mov cl, byte ptr es:[di] 513 _.LVL62: 0 0000A2BC 88C8 mov al, cl 0 0000A2BE 049F add al, -97 0 0000A2C0 3C19 cmp al, 25 0 0000A2C2 88C8 mov al, cl 0 0000A2C4 98 cbw 0 0000A2C5 7703 ja _.L54 0 0000A2C7 83C0E0 add ax, -32 521 _.L54: 0 0000A2CA 8946F6 mov word ptr [bp-10], ax 0 0000A2CD 8E46FC mov es, word ptr [bp-4] 0 0000A2D0 8B7EF4 mov di, word ptr [bp-12] 0 0000A2D3 268A35 mov dh, byte ptr es:[di] 0 0000A2D6 88F0 mov al, dh 0 0000A2D8 049F add al, -97 0 0000A2DA 3C19 cmp al, 25 0 0000A2DC 88F0 mov al, dh 0 0000A2DE 98 cbw 0 0000A2DF 7703 ja _.L57 0 0000A2E1 83C0E0 add ax, -32 533 _.L57: 0 0000A2E4 3946F6 cmp word ptr [bp-10], ax 0 0000A2E7 746C je _.L58 536 _.LVL63: 537 _.LBE76: 538 _.LBE75: 119:task.c **** { 539 .loc 1 119 0 0 0000A2E9 38F1 cmp cl, dh 0 0000A2EB 7574 jne _.L52 542 _.L62: 121:task.c **** } 543 .loc 1 121 0 0 0000A2ED 88D0 mov al, dl 0 0000A2EF 98 cbw 0 0000A2F0 97 xchg di, ax 0 0000A2F1 8D5901 lea bx, [1+bx+di] 548 _.LVL64: 0 0000A2F4 8E46FC mov es, word ptr [bp-4] 0 0000A2F7 268B07 mov ax, word ptr es:[bx] 551 _.LVL65: 552 _.LBE74: 553 _.LBE73: 348:task.c **** { 554 .loc 1 348 0 0 0000A2FA 85C0 test ax, ax 0 0000A2FC 756E jne _.L59 557 _.L50: 354:task.c **** (get_cds1(psp->ps_fcb2.fcb_drive) ? 0 : 0xff00); 558 .loc 1 354 0 0 0000A2FE 8E46FE mov es, word ptr [bp-2] 0 0000A301 26A05C00 mov al, byte ptr es:[92] 0 0000A305 30E4 xor ah, ah 0 0000A307 50 push ax 0 0000A308 16 push ss 0 0000A309 1F pop ds 0 0000A30A E8[FEFF] call _get_cds1 566 _.LVL66: 0 0000A30D 09D0 or ax, dx 0 0000A30F 7564 jne _.L67 0 0000A311 BEFF00 mov si, 255 570 _.L64: 355:task.c **** } 571 .loc 1 355 0 0 0000A314 8E46FE mov es, word ptr [bp-2] 0 0000A317 26A06C00 mov al, byte ptr es:[108] 0 0000A31B 30E4 xor ah, ah 0 0000A31D 50 push ax 0 0000A31E E8[FEFF] call _get_cds1 577 _.LVL67: 0 0000A321 09D0 or ax, dx 0 0000A323 7554 jne _.L68 0 0000A325 B800FF mov ax, -256 581 _.L65: 354:task.c **** (get_cds1(psp->ps_fcb2.fcb_drive) ? 0 : 0xff00); 582 .loc 1 354 0 0 0000A328 09F0 or ax, si 356:task.c **** 584 .loc 1 356 0 0 0000A32A 89EC mov sp, bp 0 0000A32C 5D pop bp 0 0000A32D 5F pop di 0 0000A32E 5E pop si 0 0000A32F C20C00 ret 12 590 _.LVL68: 591 _.L41: 330:task.c **** { 592 .loc 1 330 0 discriminator 3 0 0000A332 BA0800 mov dx, 8 594 _.LVL69: 0 0000A335 31DB xor bx, bx 596 _.LVL70: 597 _.L43: 341:task.c **** { 598 .loc 1 341 0 discriminator 3 0 0000A337 8D38 lea di, [bx+si] 0 0000A339 8E46FA mov es, word ptr [bp-6] 0 0000A33C 268A05 mov al, byte ptr es:[di] 0 0000A33F 84C0 test al, al 0 0000A341 7407 je _.L47 0 0000A343 3C2E cmp al, 46 0 0000A345 7403E904FF jne _.L45 606 _.L47: 346:task.c **** 607 .loc 1 346 0 0 0000A34A 8E4608 mov es, word ptr [bp+8] 0 0000A34D 26C6470800 mov byte ptr es:[bx+8], 0 0 0000A352 E913FF jmp _.L44 611 _.LVL71: 612 _.L58: 613 _.LBB80: 614 _.LBB79: 615 _.LBB78: 616 _.LBB77: 102:task.c **** } 617 .loc 1 102 0 0 0000A355 FF46F8 inc word ptr [bp-8] 619 _.LVL72: 0 0000A358 FF46F4 inc word ptr [bp-12] 621 _.LVL73: 0 0000A35B 8B46F2 mov ax, word ptr [bp-14] 0 0000A35E E94BFF jmp _.L53 624 _.LVL74: 625 _.L52: 626 _.LBE77: 627 _.LBE78: 124:task.c **** } 628 .loc 1 124 0 0 0000A361 88D0 mov al, dl 0 0000A363 98 cbw 0 0000A364 89C7 mov di, ax 0 0000A366 8D5903 lea bx, [3+bx+di] 633 _.LVL75: 0 0000A369 E91FFF jmp _.L51 635 _.LVL76: 636 _.L59: 637 _.LBE79: 638 _.LBE80: 350:task.c **** } 639 .loc 1 350 0 0 0000A36C 8E46FE mov es, word ptr [bp-2] 0 0000A36F 26A34000 mov word ptr es:[64], ax 0 0000A373 EB89 jmp _.L50 643 _.L67: 354:task.c **** (get_cds1(psp->ps_fcb2.fcb_drive) ? 0 : 0xff00); 644 .loc 1 354 0 0 0000A375 31F6 xor si, si 0 0000A377 EB9B jmp _.L64 647 _.L68: 355:task.c **** } 648 .loc 1 355 0 0 0000A379 31C0 xor ax, ax 0 0000A37B EBAB jmp _.L65 651 _.LFE12: 652 .size _patchPSP, .-_patchPSP 653 .type _load_transfer, @function 654 _load_transfer: 655 _.LFB13: 359:task.c **** psp FAR *p = MK_FP(ds, 0); 656 .loc 1 359 0 657 _.LVL77: 0 0000A37D 56 push si 0 0000A37E 57 push di 0 0000A37F 55 push bp 661 _.LCFI8: 0 0000A380 89E5 mov bp, sp 663 _.LCFI9: 0 0000A382 8B4608 mov ax, word ptr [bp+8] 0 0000A385 8B760A mov si, word ptr [bp+10] 0 0000A388 8B7E0C mov di, word ptr [bp+12] 667 _.LVL78: 361:task.c **** 668 .loc 1 361 0 0 0000A38B 8B16[0000] mov dx, word ptr [_cu_psp] 670 _.LVL79: 364:task.c **** p->ps_prevpsp = q; 671 .loc 1 364 0 0 0000A38F 8EC0 mov es, ax 0 0000A391 2689161600 mov word ptr es:[22], dx 674 _.LVL80: 365:task.c **** q->ps_stack = (BYTE FAR *)user_r; 675 .loc 1 365 0 0 0000A396 26C70638000000 mov word ptr es:[56], 0 0 0000A39D 2689163A00 mov word ptr es:[58], dx 366:task.c **** user_r->FLAGS &= ~FLG_CARRY; 678 .loc 1 366 0 0 0000A3A2 8B1E[0000] mov bx, word ptr [_user_r] 0 0000A3A6 8B0E[0200] mov cx, word ptr [_user_r+2] 0 0000A3AA 8EC2 mov es, dx 0 0000A3AC 26891E2E00 mov word ptr es:[46], bx 0 0000A3B1 26890E3000 mov word ptr es:[48], cx 367:task.c **** 684 .loc 1 367 0 0 0000A3B6 8EC1 mov es, cx 0 0000A3B8 26806716FE and byte ptr es:[bx+22], -2 369:task.c **** /* process dta */ 687 .loc 1 369 0 0 0000A3BD A3[0000] mov word ptr [_cu_psp], ax 371:task.c **** 689 .loc 1 371 0 0 0000A3C0 C706[0000]8000 mov word ptr [_dta], 128 0 0000A3C6 A3[0200] mov word ptr [_dta+2], ax 373:task.c **** { 692 .loc 1 373 0 0 0000A3C9 837E0E01 cmp word ptr [bp+14], 1 0 0000A3CD 7362 jnc _.L94 695 _.LBB81: 378:task.c **** 696 .loc 1 378 0 0 0000A3CF 8B5C0E mov bx, word ptr [si+14] 0 0000A3D2 8B4C10 mov cx, word ptr [si+16] 0 0000A3D5 8D57E8 lea dx, [-24+bx] 700 _.LVL81: 382:task.c **** irp->CS = FP_SEG(exp->exec.start_addr); 701 .loc 1 382 0 0 0000A3D8 8EC1 mov es, cx 0 0000A3DA 268947F6 mov word ptr es:[bx-10], ax 0 0000A3DE 268947F8 mov word ptr es:[bx-8], ax 0 0000A3E2 268947EE mov word ptr es:[bx-18], ax 383:task.c **** irp->SI = irp->IP = FP_OFF(exp->exec.start_addr); 706 .loc 1 383 0 0 0000A3E6 8B4414 mov ax, word ptr [si+20] 708 _.LVL82: 0 0000A3E9 268947FC mov word ptr es:[bx-4], ax 384:task.c **** irp->DI = FP_OFF(exp->exec.stack); 710 .loc 1 384 0 0 0000A3ED 8B4412 mov ax, word ptr [si+18] 0 0000A3F0 268947FA mov word ptr es:[bx-6], ax 0 0000A3F4 268947F0 mov word ptr es:[bx-16], ax 385:task.c **** irp->BP = 0x91e; /* this is more or less random but some programs 714 .loc 1 385 0 0 0000A3F8 8B440E mov ax, word ptr [si+14] 0 0000A3FB 268947F2 mov word ptr es:[bx-14], ax 386:task.c **** expect 0x9 in the high byte of BP!! */ 717 .loc 1 386 0 0 0000A3FF 26C747F41E09 mov word ptr es:[bx-12], 2334 388:task.c **** irp->CX = 0xFF; 719 .loc 1 388 0 0 0000A405 26897FEA mov word ptr es:[bx-22], di 0 0000A409 26897FE8 mov word ptr es:[bx-24], di 389:task.c **** irp->FLAGS = 0x200; 722 .loc 1 389 0 0 0000A40D 26C747ECFF00 mov word ptr es:[bx-20], 255 390:task.c **** 724 .loc 1 390 0 0 0000A413 26C747FE0002 mov word ptr es:[bx-2], 512 392:task.c **** --InDOS; 726 .loc 1 392 0 0 0000A419 A0[0000] mov al, byte ptr [_InDOS] 0 0000A41C 84C0 test al, al 0 0000A41E 7405 je _.L95 393:task.c **** exec_user(irp, 1); 730 .loc 1 393 0 0 0000A420 FEC8 dec al 0 0000A422 A2[0000] mov byte ptr [_InDOS], al 733 _.LVL83: 734 _.L95: 394:task.c **** 735 .loc 1 394 0 0 0000A425 B80100 mov ax, 1 0 0000A428 50 push ax 0 0000A429 51 push cx 0 0000A42A 52 push dx 0 0000A42B E8[FEFF] call _exec_user 741 _.LVL84: 0 0000A42E 83C406 add sp, 6 743 _.L94: 744 _.LBE81: 400:task.c **** *((UWORD FAR *)(exp->exec.stack)) = fcbcode; 745 .loc 1 400 0 0 0000A431 8B5C0E mov bx, word ptr [si+14] 0 0000A434 8B4410 mov ax, word ptr [si+16] 0 0000A437 8D57FE lea dx, [-2+bx] 0 0000A43A 89540E mov word ptr [si+14], dx 401:task.c **** return SUCCESS; 750 .loc 1 401 0 0 0000A43D 8EC0 mov es, ax 0 0000A43F 26897FFE mov word ptr es:[bx-2], di 403:task.c **** 753 .loc 1 403 0 0 0000A443 31C0 xor ax, ax 0 0000A445 89EC mov sp, bp 0 0000A447 5D pop bp 0 0000A448 5F pop di 0 0000A449 5E pop si 759 _.LVL85: 0 0000A44A C20800 ret 8 761 _.LFE13: 762 .size _load_transfer, .-_load_transfer 763 .global _getvec 764 .type _getvec, @function 765 _getvec: 766 _.LFB4: 67:task.c **** intvec iv; 767 .loc 1 67 0 768 _.LVL86: 0 0000A44D 89E3 mov bx, sp 770 _.LCFI10: 771 _.LBB82: 772 _.LBB83: 773 .file 2 "../hdr/portab.h" 1:../hdr/portab.h **** /****************************************************************/ 2:../hdr/portab.h **** /* */ 3:../hdr/portab.h **** /* portab.h */ 4:../hdr/portab.h **** /* */ 5:../hdr/portab.h **** /* DOS-C portability typedefs, etc. */ 6:../hdr/portab.h **** /* */ 7:../hdr/portab.h **** /* May 1, 1995 */ 8:../hdr/portab.h **** /* */ 9:../hdr/portab.h **** /* Copyright (c) 1995 */ 10:../hdr/portab.h **** /* Pasquale J. Villani */ 11:../hdr/portab.h **** /* All Rights Reserved */ 12:../hdr/portab.h **** /* */ 13:../hdr/portab.h **** /* This file is part of DOS-C. */ 14:../hdr/portab.h **** /* */ 15:../hdr/portab.h **** /* DOS-C is free software; you can redistribute it and/or */ 16:../hdr/portab.h **** /* modify it under the terms of the GNU General Public License */ 17:../hdr/portab.h **** /* as published by the Free Software Foundation; either version */ 18:../hdr/portab.h **** /* 2, or (at your option) any later version. */ 19:../hdr/portab.h **** /* */ 20:../hdr/portab.h **** /* DOS-C is distributed in the hope that it will be useful, but */ 21:../hdr/portab.h **** /* WITHOUT ANY WARRANTY; without even the implied warranty of */ 22:../hdr/portab.h **** /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 23:../hdr/portab.h **** /* the GNU General Public License for more details. */ 24:../hdr/portab.h **** /* */ 25:../hdr/portab.h **** /* You should have received a copy of the GNU General Public */ 26:../hdr/portab.h **** /* License along with DOS-C; see the file COPYING. If not, */ 27:../hdr/portab.h **** /* write to the Free Software Foundation, 675 Mass Ave, */ 28:../hdr/portab.h **** /* Cambridge, MA 02139, USA. */ 29:../hdr/portab.h **** /****************************************************************/ 30:../hdr/portab.h **** 31:../hdr/portab.h **** #ifdef MAIN 32:../hdr/portab.h **** #ifdef VERSION_STRINGS 33:../hdr/portab.h **** static char *portab_hRcsId = 34:../hdr/portab.h **** "$Id: portab.h 1121 2005-03-15 15:25:08Z perditionc $"; 35:../hdr/portab.h **** #endif 36:../hdr/portab.h **** #endif 37:../hdr/portab.h **** 38:../hdr/portab.h **** /****************************************************************/ 39:../hdr/portab.h **** /* */ 40:../hdr/portab.h **** /* Machine dependant portable types. Note that this section is */ 41:../hdr/portab.h **** /* used primarily for segmented architectures. Common types and */ 42:../hdr/portab.h **** /* types used relating to segmented operations are found here. */ 43:../hdr/portab.h **** /* */ 44:../hdr/portab.h **** /* Be aware that segmented architectures impose on linear */ 45:../hdr/portab.h **** /* architectures because they require special types to be used */ 46:../hdr/portab.h **** /* throught the code that must be reduced to empty preprocessor */ 47:../hdr/portab.h **** /* replacements in the linear machine. */ 48:../hdr/portab.h **** /* */ 49:../hdr/portab.h **** /* #ifdef */ 50:../hdr/portab.h **** /* # define FAR far */ 51:../hdr/portab.h **** /* # define NEAR near */ 52:../hdr/portab.h **** /* #endif */ 53:../hdr/portab.h **** /* */ 54:../hdr/portab.h **** /* #ifdef */ 55:../hdr/portab.h **** /* # define FAR */ 56:../hdr/portab.h **** /* # define NEAR */ 57:../hdr/portab.h **** /* #endif */ 58:../hdr/portab.h **** /* */ 59:../hdr/portab.h **** /****************************************************************/ 60:../hdr/portab.h **** 61:../hdr/portab.h **** /* commandline overflow - removing -DI86 TE 62:../hdr/portab.h **** #if defined(__TURBOC__) 63:../hdr/portab.h **** 64:../hdr/portab.h **** #define I86 65:../hdr/portab.h **** #define CDECL cdecl 66:../hdr/portab.h **** #if __TURBOC__ > 0x202 67:../hdr/portab.h **** /* printf callers do the right thing for tc++ 1.01 but not tc 2.01 */ 68:../hdr/portab.h **** #define VA_CDECL 69:../hdr/portab.h **** #else 70:../hdr/portab.h **** #define VA_CDECL cdecl 71:../hdr/portab.h **** #endif 72:../hdr/portab.h **** #define PASCAL pascal 73:../hdr/portab.h **** void __int__(int); 74:../hdr/portab.h **** #ifndef FORSYS 75:../hdr/portab.h **** void __emit__(char, ...); 76:../hdr/portab.h **** #define disable() __emit__(0xfa) 77:../hdr/portab.h **** #define enable() __emit__(0xfb) 78:../hdr/portab.h **** #endif 79:../hdr/portab.h **** 80:../hdr/portab.h **** #elif defined(_MSC_VER) 81:../hdr/portab.h **** 82:../hdr/portab.h **** #define I86 83:../hdr/portab.h **** #define asm __asm 84:../hdr/portab.h **** #pragma warning(disable: 4761) /* "integral size mismatch in argument; 85:../hdr/portab.h **** conversion supplied" */ 86:../hdr/portab.h **** #define CDECL _cdecl 87:../hdr/portab.h **** #define VA_CDECL 88:../hdr/portab.h **** #define PASCAL pascal 89:../hdr/portab.h **** #define __int__(intno) asm int intno; 90:../hdr/portab.h **** #define disable() asm cli 91:../hdr/portab.h **** #define enable() asm sti 92:../hdr/portab.h **** #define _CS getCS() 93:../hdr/portab.h **** static unsigned short __inline getCS(void) 94:../hdr/portab.h **** { 95:../hdr/portab.h **** asm mov ax, cs; 96:../hdr/portab.h **** } 97:../hdr/portab.h **** #define _SS getSS() 98:../hdr/portab.h **** static unsigned short __inline getSS(void) 99:../hdr/portab.h **** { 100:../hdr/portab.h **** asm mov ax, ss; 101:../hdr/portab.h **** } 102:../hdr/portab.h **** 103:../hdr/portab.h **** #elif defined(__WATCOMC__) /* don't know a better way */ 104:../hdr/portab.h **** 105:../hdr/portab.h **** #if defined(_M_I86) 106:../hdr/portab.h **** 107:../hdr/portab.h **** #define I86 108:../hdr/portab.h **** #define __int__(intno) asm int intno; 109:../hdr/portab.h **** void disable(void); 110:../hdr/portab.h **** #pragma aux disable = "cli" __modify __exact []; 111:../hdr/portab.h **** void enable(void); 112:../hdr/portab.h **** #pragma aux enable = "sti" __modify __exact []; 113:../hdr/portab.h **** #define asm __asm 114:../hdr/portab.h **** #define far __far 115:../hdr/portab.h **** #define CDECL __cdecl 116:../hdr/portab.h **** #define VA_CDECL 117:../hdr/portab.h **** #define PASCAL pascal 118:../hdr/portab.h **** #define _CS getCS() 119:../hdr/portab.h **** unsigned short getCS(void); 120:../hdr/portab.h **** #pragma aux getCS = "mov dx,cs" __value [__dx] __modify __exact[__dx]; 121:../hdr/portab.h **** #define _SS getSS() 122:../hdr/portab.h **** unsigned short getSS(void); 123:../hdr/portab.h **** #pragma aux getSS = "mov dx,ss" __value [__dx] __modify __exact[__dx]; 124:../hdr/portab.h **** #if !defined(FORSYS) && !defined(EXEFLAT) && _M_IX86 >= 300 125:../hdr/portab.h **** #pragma aux __default __parm [__ax __dx __cx] __modify [__ax __dx __es __fs] /* min.unpacked size * 126:../hdr/portab.h **** #endif 127:../hdr/portab.h **** 128:../hdr/portab.h **** /* enable Possible loss of precision warning for compatibility with Borland */ 129:../hdr/portab.h **** #pragma enable_message(130) 130:../hdr/portab.h **** 131:../hdr/portab.h **** #else 132:../hdr/portab.h **** 133:../hdr/portab.h **** /* workaround for building some utils with OpenWatcom (flat model) */ 134:../hdr/portab.h **** #define MC68K 135:../hdr/portab.h **** 136:../hdr/portab.h **** #endif 137:../hdr/portab.h **** 138:../hdr/portab.h **** #elif defined (_MYMC68K_COMILER_) 139:../hdr/portab.h **** 140:../hdr/portab.h **** #define MC68K 141:../hdr/portab.h **** 142:../hdr/portab.h **** #elif defined(__GNUC__) 143:../hdr/portab.h **** 144:../hdr/portab.h **** #ifdef __FAR 145:../hdr/portab.h **** #define I86 146:../hdr/portab.h **** #define STRINGIFY(x) #x 147:../hdr/portab.h **** #define __int__(intno) asm volatile(STRINGIFY(int $##intno)) 148:../hdr/portab.h **** static inline void disable(void) 149:../hdr/portab.h **** { 150:../hdr/portab.h **** asm volatile("cli"); 774 .loc 2 150 0 775 #APP 776 ;# 150 "../hdr/portab.h" 1 151 } 777 cli 778 ;# 0 "" 2 779 _.LVL87: 780 #NO_APP 781 _.LBE83: 782 _.LBE82: 783 _.LBB84: 784 _.LBB85: 152:../hdr/portab.h **** static inline void enable(void) 153:../hdr/portab.h **** { 154:../hdr/portab.h **** asm volatile("sti"); 785 .loc 2 154 0 786 #APP 787 ;# 154 "../hdr/portab.h" 1 155 } 788 sti 789 ;# 0 "" 2 790 #NO_APP 791 _.LBE85: 792 _.LBE84: 70:task.c **** enable(); 793 .loc 1 70 0 0 0000A451 8A4702 mov al, byte ptr [bx+2] 0 0000A454 30E4 xor ah, ah 0 0000A456 B102 mov cl, 2 0 0000A458 D3E0 shl ax, cl 0 0000A45A 89C3 mov bx, ax 0 0000A45C 99 cwd 72:task.c **** } 800 .loc 1 72 0 0 0000A45D 8EC2 mov es, dx 0 0000A45F 268B07 mov ax, word ptr es:[bx] 0 0000A462 268B5702 mov dx, word ptr es:[bx+2] 73:task.c **** 804 .loc 1 73 0 0 0000A466 C20200 ret 2 806 _.LFE4: 807 .size _getvec, .-_getvec 808 .global _setvec_resident 809 .type _setvec_resident, @function 810 _setvec_resident: 811 _.LFB5: 76:task.c **** disable(); 812 .loc 1 76 0 813 _.LVL88: 0 0000A469 57 push di 0 0000A46A 89E3 mov bx, sp 816 _.LCFI11: 0 0000A46C 8E5F08 mov ds, word ptr [bx+8] 818 _.LBB86: 819 _.LBB87: 150:../hdr/portab.h **** } 820 .loc 2 150 0 821 #APP 822 ;# 150 "../hdr/portab.h" 1 823 cli 824 ;# 0 "" 2 825 #NO_APP 826 _.LBE87: 827 _.LBE86: 78:task.c **** enable(); 828 .loc 1 78 0 0 0000A470 368A4704 mov al, byte ptr ss:[bx+4] 0 0000A474 30E4 xor ah, ah 0 0000A476 B102 mov cl, 2 0 0000A478 D3E0 shl ax, cl 0 0000A47A 99 cwd 0 0000A47B 368B5F06 mov bx, word ptr ss:[bx+6] 0 0000A47F 8EC2 mov es, dx 0 0000A481 89C7 mov di, ax 0 0000A483 26891D mov word ptr es:[di], bx 838 _.LVL89: 0 0000A486 93 xchg bx, ax 0 0000A487 268C5F02 mov word ptr es:[bx+2], ds 841 _.LBB88: 842 _.LBB89: 154:../hdr/portab.h **** } 843 .loc 2 154 0 844 #APP 845 ;# 154 "../hdr/portab.h" 1 846 sti 847 ;# 0 "" 2 848 #NO_APP 849 _.LBE89: 850 _.LBE88: 80:task.c **** 851 .loc 1 80 0 0 0000A48C 5F pop di 0 0000A48D 16 push ss 0 0000A48E 1F pop ds 0 0000A48F C20600 ret 6 856 _.LFE5: 857 .size _setvec_resident, .-_setvec_resident 858 .global _SftGetFsize 859 .type _SftGetFsize, @function 860 _SftGetFsize: 861 _.LFB6: 83:task.c **** sft FAR *s = idx_to_sft(sft_idx); 862 .loc 1 83 0 863 _.LVL90: 0 0000A492 55 push bp 865 _.LCFI12: 0 0000A493 89E5 mov bp, sp 867 _.LCFI13: 84:task.c **** 868 .loc 1 84 0 0 0000A495 FF7604 push word ptr [bp+4] 0 0000A498 E8[FEFF] call _idx_to_sft 871 _.LVL91: 0 0000A49B 89C3 mov bx, ax 873 _.LVL92: 87:task.c **** return DE_INVLDHNDL; 874 .loc 1 87 0 0 0000A49D 83F8FF cmp ax, -1 0 0000A4A0 7410 je _.L106 90:task.c **** } 877 .loc 1 90 0 0 0000A4A2 8EC2 mov es, dx 0 0000A4A4 268B4711 mov ax, word ptr es:[bx+17] 880 _.LVL93: 0 0000A4A8 268B5713 mov dx, word ptr es:[bx+19] 882 _.LVL94: 883 _.L104: 91:task.c **** 884 .loc 1 91 0 0 0000A4AC 89EC mov sp, bp 0 0000A4AE 5D pop bp 0 0000A4AF C20200 ret 2 888 _.LVL95: 889 _.L106: 88:task.c **** 890 .loc 1 88 0 0 0000A4B2 B8FAFF mov ax, -6 892 _.LVL96: 0 0000A4B5 89DA mov dx, bx 894 _.LVL97: 0 0000A4B7 EBF3 jmp _.L104 896 _.LFE6: 897 .size _SftGetFsize, .-_SftGetFsize 898 .global _new_psp 899 .type _new_psp, @function 900 _new_psp: 901 _.LFB10: 230:task.c **** psp FAR *p = MK_FP(para, 0); 902 .loc 1 230 0 903 _.LVL98: 0 0000A4B9 56 push si 0 0000A4BA 55 push bp 906 _.LCFI14: 0 0000A4BB 89E5 mov bp, sp 908 _.LCFI15: 0 0000A4BD 1E push ds 231:task.c **** 910 .loc 1 231 0 0 0000A4BE 31DB xor bx, bx 912 _.LVL99: 233:task.c **** 913 .loc 1 233 0 0 0000A4C0 B80001 mov ax, 256 0 0000A4C3 50 push ax 0 0000A4C4 FF7608 push word ptr [bp+8] 0 0000A4C7 53 push bx 0 0000A4C8 FF7606 push word ptr [bp+6] 0 0000A4CB 53 push bx 0 0000A4CC 895EFE mov word ptr [bp-2], bx 0 0000A4CF E8[FEFF] call _fmemcpy 922 _.LVL100: 923 _.LBB90: 924 _.LBB91: 925 _.LBB92: 926 _.LBB93: 150:../hdr/portab.h **** } 927 .loc 2 150 0 928 #APP 929 ;# 150 "../hdr/portab.h" 1 930 cli 931 ;# 0 "" 2 932 #NO_APP 933 _.LBE93: 934 _.LBE92: 70:task.c **** enable(); 935 .loc 1 70 0 0 0000A4D3 BE8800 mov si, 136 0 0000A4D6 8B5EFE mov bx, word ptr [bp-2] 0 0000A4D9 8EC3 mov es, bx 0 0000A4DB 268B14 mov dx, word ptr es:[si] 0 0000A4DE 268B4402 mov ax, word ptr es:[si+2] 941 _.LVL101: 942 _.LBB94: 943 _.LBB95: 154:../hdr/portab.h **** } 944 .loc 2 154 0 945 #APP 946 ;# 154 "../hdr/portab.h" 1 947 sti 948 ;# 0 "" 2 949 _.LVL102: 950 #NO_APP 951 _.LBE95: 952 _.LBE94: 953 _.LBE91: 954 _.LBE90: 236:task.c **** /* break address */ 955 .loc 1 236 0 0 0000A4E3 8E4606 mov es, word ptr [bp+6] 0 0000A4E6 2689570A mov word ptr es:[bx+10], dx 958 _.LVL103: 0 0000A4EA 8E4606 mov es, word ptr [bp+6] 0 0000A4ED 2689470C mov word ptr es:[bx+12], ax 961 _.LVL104: 962 _.LBB96: 963 _.LBB97: 964 _.LBB98: 965 _.LBB99: 150:../hdr/portab.h **** } 966 .loc 2 150 0 967 #APP 968 ;# 150 "../hdr/portab.h" 1 969 cli 970 ;# 0 "" 2 971 #NO_APP 972 _.LBE99: 973 _.LBE98: 70:task.c **** enable(); 974 .loc 1 70 0 0 0000A4F2 BE8C00 mov si, 140 0 0000A4F5 8EC3 mov es, bx 0 0000A4F7 268B14 mov dx, word ptr es:[si] 0 0000A4FA 268B4402 mov ax, word ptr es:[si+2] 979 _.LVL105: 980 _.LBB100: 981 _.LBB101: 154:../hdr/portab.h **** } 982 .loc 2 154 0 983 #APP 984 ;# 154 "../hdr/portab.h" 1 985 sti 986 ;# 0 "" 2 987 _.LVL106: 988 #NO_APP 989 _.LBE101: 990 _.LBE100: 991 _.LBE97: 992 _.LBE96: 238:task.c **** /* critical error address */ 993 .loc 1 238 0 0 0000A4FF 8E4606 mov es, word ptr [bp+6] 0 0000A502 2689570E mov word ptr es:[bx+14], dx 0 0000A506 8E4606 mov es, word ptr [bp+6] 0 0000A509 26894710 mov word ptr es:[bx+16], ax 998 _.LVL107: 999 _.LBB102: 1000 _.LBB103: 1001 _.LBB104: 1002 _.LBB105: 150:../hdr/portab.h **** } 1003 .loc 2 150 0 1004 #APP 1005 ;# 150 "../hdr/portab.h" 1 1006 cli 1007 ;# 0 "" 2 1008 #NO_APP 1009 _.LBE105: 1010 _.LBE104: 70:task.c **** enable(); 1011 .loc 1 70 0 0 0000A50E BE9000 mov si, 144 0 0000A511 8EC3 mov es, bx 0 0000A513 268B14 mov dx, word ptr es:[si] 0 0000A516 268B4402 mov ax, word ptr es:[si+2] 1016 _.LVL108: 1017 _.LBB106: 1018 _.LBB107: 154:../hdr/portab.h **** } 1019 .loc 2 154 0 1020 #APP 1021 ;# 154 "../hdr/portab.h" 1 1022 sti 1023 ;# 0 "" 2 1024 _.LVL109: 1025 #NO_APP 1026 _.LBE107: 1027 _.LBE106: 1028 _.LBE103: 1029 _.LBE102: 240:task.c **** /* RBIL is wrong on zeroing parent_psp, and in fact some 1030 .loc 1 240 0 0 0000A51B 8E4606 mov es, word ptr [bp+6] 0 0000A51E 26895712 mov word ptr es:[bx+18], dx 0 0000A522 8E4606 mov es, word ptr [bp+6] 0 0000A525 26894714 mov word ptr es:[bx+20], ax 249:task.c **** } 1035 .loc 1 249 0 0 0000A529 8B16[0000] mov dx, word ptr [_os_setver_minor] 0 0000A52D B108 mov cl, 8 0 0000A52F D3E2 shl dx, cl 0 0000A531 A0[0000] mov al, byte ptr [_os_setver_major] 0 0000A534 98 cbw 0 0000A535 01C2 add dx, ax 0 0000A537 8E4606 mov es, word ptr [bp+6] 0 0000A53A 26895740 mov word ptr es:[bx+64], dx 250:task.c **** 1044 .loc 1 250 0 0 0000A53E 89EC mov sp, bp 0 0000A540 5D pop bp 0 0000A541 5E pop si 0 0000A542 C20400 ret 4 1049 _.LFE10: 1050 .size _new_psp, .-_new_psp 1051 .global _child_psp 1052 .type _child_psp, @function 1053 _child_psp: 1054 _.LFB11: 253:task.c **** psp FAR *p = MK_FP(para, 0); 1055 .loc 1 253 0 1056 _.LVL110: 0 0000A545 56 push si 0 0000A546 57 push di 0 0000A547 55 push bp 1060 _.LCFI16: 0 0000A548 89E5 mov bp, sp 1062 _.LCFI17: 0 0000A54A 1E push ds 0 0000A54B 1E push ds 0 0000A54C 8B7608 mov si, word ptr [bp+8] 254:task.c **** psp FAR *q = MK_FP(cur_psp, 0); 1066 .loc 1 254 0 0 0000A54F 31FF xor di, di 1068 _.LVL111: 258:task.c **** 1069 .loc 1 258 0 0 0000A551 FF760A push word ptr [bp+10] 0 0000A554 56 push si 0 0000A555 E8[FEFF] call _new_psp 1073 _.LVL112: 262:task.c **** /* previous psp pointer */ 1074 .loc 1 262 0 0 0000A558 A1[0000] mov ax, word ptr [_cu_psp] 0 0000A55B 8EC6 mov es, si 0 0000A55D 26A31600 mov word ptr es:[22], ax 1078 _.LVL113: 264:task.c **** 1079 .loc 1 264 0 0 0000A561 26897D38 mov word ptr es:[di+56], di 0 0000A565 8B460A mov ax, word ptr [bp+10] 0 0000A568 26A33A00 mov word ptr es:[58], ax 268:task.c **** 1083 .loc 1 268 0 0 0000A56C 8B460C mov ax, word ptr [bp+12] 0 0000A56F 26A30200 mov word ptr es:[2], ax 272:task.c **** fmemset(p->ps_files, 0xff, 20); 1086 .loc 1 272 0 0 0000A573 26C70632001400 mov word ptr es:[50], 20 273:task.c **** 1088 .loc 1 273 0 0 0000A57A B91800 mov cx, 24 0 0000A57D BA1400 mov dx, 20 0 0000A580 52 push dx 0 0000A581 8956FC mov word ptr [bp-4], dx 0 0000A584 B8FF00 mov ax, 255 0 0000A587 50 push ax 0 0000A588 56 push si 0 0000A589 51 push cx 0 0000A58A 894EFE mov word ptr [bp-2], cx 0 0000A58D E8[FEFF] call _fmemset 1099 _.LVL114: 276:task.c **** 1100 .loc 1 276 0 0 0000A590 8EC6 mov es, si 0 0000A592 8B4EFE mov cx, word ptr [bp-2] 0 0000A595 26890E3400 mov word ptr es:[52], cx 0 0000A59A 2689363600 mov word ptr es:[54], si 1105 _.LVL115: 0 0000A59F 8B56FC mov dx, word ptr [bp-4] 0 0000A5A2 8956FE mov word ptr [bp-2], dx 1108 _.LVL116: 1109 _.L112: 280:task.c **** p->ps_files[i] = q->ps_filetab[i]; 1110 .loc 1 280 0 0 0000A5A5 57 push di 0 0000A5A6 E8[FEFF] call _CloneHandle 1113 _.LVL117: 0 0000A5A9 85C0 test ax, ax 0 0000A5AB 7C1C jl _.L111 281:task.c **** 1116 .loc 1 281 0 0 0000A5AD 8E460A mov es, word ptr [bp+10] 0 0000A5B0 26A13600 mov ax, word ptr es:[54] 0 0000A5B4 8946FC mov word ptr [bp-4], ax 0 0000A5B7 89FB mov bx, di 0 0000A5B9 26031E3400 add bx, word ptr es:[52] 0 0000A5BE 8EC0 mov es, ax 0 0000A5C0 268A07 mov al, byte ptr es:[bx] 0 0000A5C3 8EC6 mov es, si 0 0000A5C5 26884518 mov byte ptr es:[di+24], al 1126 _.L111: 279:task.c **** if (CloneHandle(i) >= 0) 1127 .loc 1 279 0 discriminator 2 0 0000A5C9 47 inc di 1129 _.LVL118: 0 0000A5CA FF4EFE dec word ptr [bp-2] 0 0000A5CD 75D6 jne _.L112 284:task.c **** fmemset(p->ps_fcb1.fcb_fname, ' ', FNAME_SIZE + FEXT_SIZE); 1132 .loc 1 284 0 0 0000A5CF 8EC6 mov es, si 0 0000A5D1 8A46FE mov al, byte ptr [bp-2] 0 0000A5D4 26A25C00 mov byte ptr es:[92], al 285:task.c **** /* second command line argument */ 1136 .loc 1 285 0 0 0000A5D8 BA0B00 mov dx, 11 0 0000A5DB 52 push dx 0 0000A5DC 8956FC mov word ptr [bp-4], dx 0 0000A5DF BF2000 mov di, 32 1141 _.LVL119: 0 0000A5E2 57 push di 0 0000A5E3 56 push si 0 0000A5E4 B85D00 mov ax, 93 0 0000A5E7 50 push ax 0 0000A5E8 E8[FEFF] call _fmemset 1147 _.LVL120: 287:task.c **** fmemset(p->ps_fcb2.fcb_fname, ' ', FNAME_SIZE + FEXT_SIZE); 1148 .loc 1 287 0 0 0000A5EB 8EC6 mov es, si 0 0000A5ED 8A46FE mov al, byte ptr [bp-2] 0 0000A5F0 26A26C00 mov byte ptr es:[108], al 288:task.c **** 1152 .loc 1 288 0 0 0000A5F4 8B56FC mov dx, word ptr [bp-4] 0 0000A5F7 52 push dx 0 0000A5F8 57 push di 0 0000A5F9 56 push si 0 0000A5FA B86D00 mov ax, 109 0 0000A5FD 50 push ax 0 0000A5FE E8[FEFF] call _fmemset 1160 _.LVL121: 291:task.c **** p->ps_cmd.ctBuffer[0] = 0xd; /* command tail */ 1161 .loc 1 291 0 0 0000A601 8EC6 mov es, si 0 0000A603 8A46FE mov al, byte ptr [bp-2] 0 0000A606 26A28000 mov byte ptr es:[128], al 292:task.c **** } 1165 .loc 1 292 0 0 0000A60A 26C60681000D mov byte ptr es:[129], 13 293:task.c **** 1167 .loc 1 293 0 0 0000A610 89EC mov sp, bp 0 0000A612 5D pop bp 0 0000A613 5F pop di 0 0000A614 5E pop si 1172 _.LVL122: 0 0000A615 C20600 ret 6 1174 _.LFE11: 1175 .size _child_psp, .-_child_psp 1176 .global _DosComLoader 1177 .type _DosComLoader, @function 1178 _DosComLoader: 1179 _.LFB16: 461:task.c **** 462:task.c **** COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) 463:task.c **** { 1180 .loc 1 463 0 1181 _.LVL123: 0 0000A618 56 push si 0 0000A619 57 push di 0 0000A61A 55 push bp 1185 _.LCFI18: 0 0000A61B 89E5 mov bp, sp 1187 _.LCFI19: 0 0000A61D 83EC12 sub sp, 18 0 0000A620 C44608 les ax, dword ptr [bp+8] 0 0000A623 8946F4 mov word ptr [bp-12], ax 0 0000A626 8C46F2 mov word ptr [bp-14], es 464:task.c **** UWORD mem; 465:task.c **** UWORD env, asize = 0; 1192 .loc 1 465 0 0 0000A629 C746FE0000 mov word ptr [bp-2], 0 1194 _.LBB108: 1195 _.LBB109: 466:task.c **** 467:task.c **** { 468:task.c **** UWORD com_size; 469:task.c **** { 470:task.c **** ULONG com_size_long = SftGetFsize(fd); 1196 .loc 1 470 0 0 0000A62E FF7610 push word ptr [bp+16] 0 0000A631 E8[FEFF] call _SftGetFsize 1199 _.LVL124: 471:task.c **** /* maximally 64k - 256 bytes stack - 472:task.c **** 256 bytes psp */ 473:task.c **** com_size = ((UWORD)min(com_size_long, 0xfe00u) >> 4) + 0x10; 1200 .loc 1 473 0 0 0000A634 85D2 test dx, dx 0 0000A636 7403E9A401 jne _.L130 0 0000A63B 3DFFFD cmp ax, -513 0 0000A63E 7603E99C01 ja _.L130 1205 .loc 1 473 0 is_stmt 0 discriminator 1 0 0000A643 B104 mov cl, 4 0 0000A645 D3E8 shr ax, cl 1208 _.LVL125: 0 0000A647 83C010 add ax, 16 0 0000A64A 96 xchg si, ax 1211 _.L116: 1212 _.LVL126: 1213 _.LBE109: 474:task.c **** } 475:task.c **** 476:task.c **** if ((mode & 0x7f) != OVERLAY) 1214 .loc 1 476 0 is_stmt 1 discriminator 4 0 0000A64B 8B7E0E mov di, word ptr [bp+14] 0 0000A64E 83E77F and di, 127 0 0000A651 83FF03 cmp di, 3 0 0000A654 7503E98C01 je _.L118 1219 _.LBB110: 477:task.c **** { 478:task.c **** COUNT rc; 479:task.c **** UBYTE UMBstate = uppermem_link; 1220 .loc 1 479 0 0 0000A659 A0[0000] mov al, byte ptr [_uppermem_link] 0 0000A65C 8846F1 mov byte ptr [bp-15], al 1223 _.LVL127: 480:task.c **** UBYTE orig_mem_access = mem_access_mode; 1224 .loc 1 480 0 0 0000A65F A0[0000] mov al, byte ptr [_mem_access_mode] 1226 _.LVL128: 0 0000A662 8846F8 mov byte ptr [bp-8], al 1228 _.LVL129: 481:task.c **** 482:task.c **** if (mode & 0x80) 1229 .loc 1 482 0 0 0000A665 8B460E mov ax, word ptr [bp+14] 1231 _.LVL130: 0 0000A668 258000 and ax, 128 0 0000A66B 8946F6 mov word ptr [bp-10], ax 0 0000A66E 740F je _.L119 483:task.c **** { 484:task.c **** mem_access_mode |= 0x80; 1235 .loc 1 484 0 0 0000A670 8A46F8 mov al, byte ptr [bp-8] 0 0000A673 0C80 or al, -128 0 0000A675 A2[0000] mov byte ptr [_mem_access_mode], al 1239 _.LVL131: 485:task.c **** DosUmbLink(1); /* link in UMBs */ 1240 .loc 1 485 0 0 0000A678 B80100 mov ax, 1 0 0000A67B 50 push ax 0 0000A67C E8[FEFF] call _DosUmbLink 1244 _.LVL132: 1245 _.L119: 486:task.c **** } 487:task.c **** 488:task.c **** rc = ChildEnv(exp, &env, namep); 1246 .loc 1 488 0 0 0000A67F FF76F2 push word ptr [bp-14] 0 0000A682 FF76F4 push word ptr [bp-12] 0 0000A685 8D46FC lea ax, [-4+bp] 0 0000A688 50 push ax 0 0000A689 FF760C push word ptr [bp+12] 0 0000A68C E8E3F9 call _ChildEnv 1253 _.LVL133: 0 0000A68F 89C2 mov dx, ax 1255 _.LVL134: 489:task.c **** #if DEBUG 490:task.c **** if (rc != SUCCESS) { ProcDbgPrintf(("Failed to create ChildEnv\n")); } 491:task.c **** #endif 492:task.c **** 493:task.c **** /* COMFILES will always be loaded in largest area. is that true TE */ 494:task.c **** /* yes, see RBIL, int21/ah=48 -- Bart */ 495:task.c **** 496:task.c **** if (rc == SUCCESS) 1256 .loc 1 496 0 0 0000A691 85C0 test ax, ax 0 0000A693 7522 jne _.L120 497:task.c **** rc = ExecMemLargest(&asize, com_size); 1259 .loc 1 497 0 0 0000A695 56 push si 0 0000A696 8D76FE lea si, [-2+bp] 1262 _.LVL135: 0 0000A699 56 push si 1264 _.LVL136: 0 0000A69A E8A7FA call _ExecMemLargest 1266 _.LVL137: 0 0000A69D 89C2 mov dx, ax 1268 _.LVL138: 498:task.c **** 499:task.c **** if (rc == SUCCESS) 1269 .loc 1 499 0 0 0000A69F 85C0 test ax, ax 0 0000A6A1 7514 jne _.L120 500:task.c **** /* Allocate our memory and pass back any errors */ 501:task.c **** rc = ExecMemAlloc(asize, &mem, &asize); 1272 .loc 1 501 0 0 0000A6A3 56 push si 0 0000A6A4 8D46FA lea ax, [-6+bp] 1275 _.LVL139: 0 0000A6A7 50 push ax 0 0000A6A8 FF76FE push word ptr [bp-2] 0 0000A6AB E845F9 call _ExecMemAlloc 1279 _.LVL140: 0 0000A6AE 89C2 mov dx, ax 1281 _.LVL141: 502:task.c **** 503:task.c **** if (rc != SUCCESS) 1282 .loc 1 503 0 0 0000A6B0 85C0 test ax, ax 0 0000A6B2 7503E94A01 je _.L121 1285 _.L120: 0 0000A6B7 8956EE mov word ptr [bp-18], dx 1287 _.LVL142: 504:task.c **** DosMemFree(env); 1288 .loc 1 504 0 0 0000A6BA FF76FC push word ptr [bp-4] 0 0000A6BD E8[FEFF] call _DosMemFree 1291 _.LVL143: 505:task.c **** 506:task.c **** if (mode & 0x80) 1292 .loc 1 506 0 0 0000A6C0 837EF600 cmp word ptr [bp-10], 0 0 0000A6C4 8B56EE mov dx, word ptr [bp-18] 0 0000A6C7 7503E90A01 je _.L115 1296 _.LVL144: 1297 _.L128: 0 0000A6CC 8956F6 mov word ptr [bp-10], dx 507:task.c **** { 508:task.c **** DosUmbLink(UMBstate); /* restore link state */ 1299 .loc 1 508 0 0 0000A6CF 8A46F1 mov al, byte ptr [bp-15] 0 0000A6D2 30E4 xor ah, ah 0 0000A6D4 50 push ax 0 0000A6D5 E8[FEFF] call _DosUmbLink 1304 _.LVL145: 509:task.c **** mem_access_mode = orig_mem_access; 1305 .loc 1 509 0 0 0000A6D8 8A46F8 mov al, byte ptr [bp-8] 0 0000A6DB A2[0000] mov byte ptr [_mem_access_mode], al 1308 _.LVL146: 510:task.c **** mode &= 0x7f; 511:task.c **** } 512:task.c **** 513:task.c **** if (rc != SUCCESS) 1309 .loc 1 513 0 0 0000A6DE 8B56F6 mov dx, word ptr [bp-10] 0 0000A6E1 85D2 test dx, dx 0 0000A6E3 7403E9EE00 jne _.L115 1313 _.LVL147: 1314 _.L129: 514:task.c **** return rc; 515:task.c **** 516:task.c **** ++mem; 1315 .loc 1 516 0 0 0000A6E8 FF46FA inc word ptr [bp-6] 1317 _.LBE110: 0 0000A6EB 897E0E mov word ptr [bp+14], di 1319 _.LVL148: 1320 _.L123: 1321 _.LBE108: 1322 _.LBB113: 517:task.c **** } 518:task.c **** else 519:task.c **** mem = exp->load.load_seg; 520:task.c **** } 521:task.c **** 522:task.c **** ProcDbgPrintf(("DosComLoader. Loading '%S' at %04x\n", namep, mem)); 523:task.c **** /* Now load the executable */ 524:task.c **** { 525:task.c **** BYTE FAR *sp; 526:task.c **** 527:task.c **** if (mode == OVERLAY) /* memory already allocated */ 1323 .loc 1 527 0 0 0000A6EE 837E0E03 cmp word ptr [bp+14], 3 0 0000A6F2 8B7EFA mov di, word ptr [bp-6] 0 0000A6F5 BE0000 mov si, 0 0 0000A6F8 7403E9F300 jne _.L124 528:task.c **** sp = MK_FP(mem, 0); 1328 .loc 1 528 0 0 0000A6FD 89F2 mov dx, si 1330 _.LVL149: 1331 _.L125: 0 0000A6FF 8956F8 mov word ptr [bp-8], dx 1333 _.LVL150: 529:task.c **** else /* test the filesize against the allocated memory */ 530:task.c **** sp = MK_FP(mem, sizeof(psp)); 531:task.c **** 532:task.c **** /* MS DOS always only loads the very first 64KB - sizeof(psp) bytes. 533:task.c **** -- 1999/04/21 ska */ 534:task.c **** 535:task.c **** /* rewind to start */ 536:task.c **** SftSeek(fd, 0, 0); 1334 .loc 1 536 0 0 0000A702 56 push si 0 0000A703 56 push si 0 0000A704 56 push si 0 0000A705 FF7610 push word ptr [bp+16] 0 0000A708 E8[FEFF] call _SftSeek 1340 _.LVL151: 537:task.c **** /* read everything, but at most 64K - sizeof(PSP) */ 538:task.c **** /* lpproj: some device drivers (not exe) are larger than 0xff00bytes... */ 539:task.c **** DosRWSft(fd, (mode == OVERLAY) ? 0xfffeU : 0xff00U, sp, XFR_READ); 1341 .loc 1 539 0 0 0000A70B 837E0E03 cmp word ptr [bp+14], 3 0 0000A70F 8B56F8 mov dx, word ptr [bp-8] 0 0000A712 7503E9DF00 je _.L131 0 0000A717 B800FF mov ax, -256 1346 _.L126: 1347 .loc 1 539 0 is_stmt 0 discriminator 4 0 0000A71A B90100 mov cx, 1 0 0000A71D 51 push cx 0 0000A71E 57 push di 0 0000A71F 52 push dx 0 0000A720 50 push ax 0 0000A721 FF7610 push word ptr [bp+16] 0 0000A724 E8[FEFF] call _DosRWSft 1355 _.LVL152: 540:task.c **** DosCloseSft(fd, FALSE); 1356 .loc 1 540 0 is_stmt 1 discriminator 4 0 0000A727 56 push si 0 0000A728 FF7610 push word ptr [bp+16] 0 0000A72B E8[FEFF] call _DosCloseSft 1360 _.LVL153: 1361 _.LBE113: 541:task.c **** } 542:task.c **** 543:task.c **** if (mode == OVERLAY) 1362 .loc 1 543 0 discriminator 4 0 0000A72E 837E0E03 cmp word ptr [bp+14], 3 0 0000A732 7503E99D00 je _.L132 1365 _.LVL154: 1366 _.LBB114: 1367 _.LBB115: 1368 _.LBB116: 1369 _.LBB117: 1370 _.LBB118: 150:../hdr/portab.h **** } 1371 .loc 2 150 0 1372 #APP 1373 ;# 150 "../hdr/portab.h" 1 1374 cli 1375 ;# 0 "" 2 1376 #NO_APP 1377 _.LBE118: 1378 _.LBE117: 78:task.c **** enable(); 1379 .loc 1 78 0 0 0000A738 C41E[0000] les bx, dword ptr [_user_r] 0 0000A73C 8CC2 mov dx, es 0 0000A73E 268B4712 mov ax, word ptr es:[bx+18] 0 0000A742 8EC6 mov es, si 0 0000A744 26A38800 mov word ptr es:[136], ax 1385 _.LVL155: 0 0000A748 8EC2 mov es, dx 0 0000A74A 268B4714 mov ax, word ptr es:[bx+20] 0 0000A74E 8EC6 mov es, si 0 0000A750 26A38A00 mov word ptr es:[138], ax 1390 _.LBB119: 1391 _.LBB120: 154:../hdr/portab.h **** } 1392 .loc 2 154 0 1393 #APP 1394 ;# 154 "../hdr/portab.h" 1 1395 sti 1396 ;# 0 "" 2 1397 _.LVL156: 1398 #NO_APP 1399 _.LBE120: 1400 _.LBE119: 1401 _.LBE116: 1402 _.LBE115: 544:task.c **** return SUCCESS; 545:task.c **** 546:task.c **** { 547:task.c **** UWORD fcbcode; 548:task.c **** psp FAR *p; 549:task.c **** 550:task.c **** /* point to the PSP so we can build it */ 551:task.c **** setvec(0x22, (intvec)MK_FP(user_r->CS, user_r->IP)); 552:task.c **** child_psp(mem, cu_psp, mem + asize); 1403 .loc 1 552 0 0 0000A755 8B46FA mov ax, word ptr [bp-6] 0 0000A758 89C2 mov dx, ax 0 0000A75A 0356FE add dx, word ptr [bp-2] 0 0000A75D 52 push dx 0 0000A75E FF36[0000] push word ptr [_cu_psp] 0 0000A762 50 push ax 0 0000A763 E8[FEFF] call _child_psp 1411 _.LVL157: 553:task.c **** 554:task.c **** fcbcode = patchPSP(mem - 1, env, exp, namep); 1412 .loc 1 554 0 0 0000A766 FF76F2 push word ptr [bp-14] 0 0000A769 FF76F4 push word ptr [bp-12] 0 0000A76C 16 push ss 0 0000A76D FF760C push word ptr [bp+12] 0 0000A770 FF76FC push word ptr [bp-4] 0 0000A773 8B46FA mov ax, word ptr [bp-6] 0 0000A776 48 dec ax 0 0000A777 50 push ax 0 0000A778 E811FA call _patchPSP 1422 _.LVL158: 555:task.c **** /* set asize to end of segment */ 556:task.c **** if (asize > 0x1000) 1423 .loc 1 556 0 0 0000A77B 817EFE0010 cmp word ptr [bp-2], 4096 0 0000A780 7605 jbe _.L127 557:task.c **** asize = 0x1000; 1426 .loc 1 557 0 0 0000A782 C746FE0010 mov word ptr [bp-2], 4096 1428 _.L127: 558:task.c **** if (asize < 0x11) 1429 .loc 1 558 0 0 0000A787 8B5EFE mov bx, word ptr [bp-2] 0 0000A78A 83FB10 cmp bx, 16 0 0000A78D 766D jbe _.L133 559:task.c **** return DE_NOMEM; 560:task.c **** asize -= 0x11; 1433 .loc 1 560 0 0 0000A78F 83C3EF add bx, -17 561:task.c **** /* CP/M compatibility--size of first segment for .COM files 562:task.c **** while preserving the far call to 0:00c0 + 563:task.c **** copy in HMA at ffff:00d0 */ 564:task.c **** p = MK_FP(mem, 0); 1435 .loc 1 564 0 0 0000A792 8E46FA mov es, word ptr [bp-6] 1437 _.LVL159: 565:task.c **** p->ps_reentry = MK_FP(0xc - asize, asize << 4); 1438 .loc 1 565 0 0 0000A795 89DA mov dx, bx 0 0000A797 B104 mov cl, 4 0 0000A799 D3E2 shl dx, cl 0 0000A79B BF0C00 mov di, 12 0 0000A79E 29DF sub di, bx 0 0000A7A0 2689160600 mov word ptr es:[6], dx 0 0000A7A5 26893E0800 mov word ptr es:[8], di 566:task.c **** asize <<= 4; 567:task.c **** asize += 0x10e; 1446 .loc 1 567 0 0 0000A7AA 81C20E01 add dx, 270 0 0000A7AE 89D3 mov bx, dx 0 0000A7B0 8956FE mov word ptr [bp-2], dx 568:task.c **** exp->exec.stack = MK_FP(mem, asize); 1450 .loc 1 568 0 0 0000A7B3 8B7E0C mov di, word ptr [bp+12] 0 0000A7B6 89550E mov word ptr [di+14], dx 0 0000A7B9 8C4510 mov word ptr [di+16], es 569:task.c **** exp->exec.start_addr = MK_FP(mem, 0x100); 1454 .loc 1 569 0 0 0000A7BC C745120001 mov word ptr [di+18], 256 0 0000A7C1 8C4514 mov word ptr [di+20], es 570:task.c **** *((UWORD FAR *) MK_FP(mem, asize)) = (UWORD) 0; 1457 .loc 1 570 0 0 0000A7C4 268937 mov word ptr es:[bx], si 571:task.c **** load_transfer(mem, exp, fcbcode, mode); 1459 .loc 1 571 0 0 0000A7C7 FF760E push word ptr [bp+14] 0 0000A7CA 50 push ax 0 0000A7CB FF760C push word ptr [bp+12] 0 0000A7CE FF76FA push word ptr [bp-6] 0 0000A7D1 E8A9FB call _load_transfer 1465 _.LVL160: 1466 _.L132: 1467 _.LBE114: 544:task.c **** 1468 .loc 1 544 0 0 0000A7D4 31D2 xor dx, dx 1470 _.L115: 572:task.c **** } 573:task.c **** return SUCCESS; 574:task.c **** } 1471 .loc 1 574 0 0 0000A7D6 92 xchg dx, ax 0 0000A7D7 89EC mov sp, bp 0 0000A7D9 5D pop bp 0 0000A7DA 5F pop di 0 0000A7DB 5E pop si 0 0000A7DC C20A00 ret 10 1478 _.LVL161: 1479 _.L130: 1480 _.LBB121: 1481 _.LBB111: 473:task.c **** } 1482 .loc 1 473 0 0 0000A7DF BEF00F mov si, 4080 0 0000A7E2 E966FE jmp _.L116 1485 _.LVL162: 1486 _.L118: 1487 _.LBE111: 519:task.c **** } 1488 .loc 1 519 0 0 0000A7E5 8B5E0C mov bx, word ptr [bp+12] 0 0000A7E8 8B07 mov ax, word ptr [bx] 0 0000A7EA 8946FA mov word ptr [bp-6], ax 0 0000A7ED E9FEFE jmp _.L123 1493 _.LVL163: 1494 _.L124: 1495 _.LBE121: 1496 _.LBB122: 530:task.c **** 1497 .loc 1 530 0 0 0000A7F0 BA0001 mov dx, 256 1499 _.LVL164: 0 0000A7F3 E909FF jmp _.L125 1501 _.LVL165: 1502 _.L131: 539:task.c **** DosCloseSft(fd, FALSE); 1503 .loc 1 539 0 0 0000A7F6 B8FEFF mov ax, -2 0 0000A7F9 E91EFF jmp _.L126 1506 _.LVL166: 1507 _.L133: 1508 _.LBE122: 1509 _.LBB123: 559:task.c **** asize -= 0x11; 1510 .loc 1 559 0 0 0000A7FC BAF8FF mov dx, -8 0 0000A7FF EBD5 jmp _.L115 1513 _.LVL167: 1514 _.L121: 1515 _.LBE123: 1516 _.LBB124: 1517 _.LBB112: 506:task.c **** { 1518 .loc 1 506 0 0 0000A801 837EF600 cmp word ptr [bp-10], 0 0 0000A805 7403E9C2FE jne _.L128 0 0000A80A 8B7E0E mov di, word ptr [bp+14] 0 0000A80D E9D8FE jmp _.L129 1523 _.LBE112: 1524 _.LBE124: 1525 _.LFE16: 1526 .size _DosComLoader, .-_DosComLoader 1527 .global _return_user 1528 .type _return_user, @function 1529 _return_user: 1530 _.LFB17: 575:task.c **** 576:task.c **** VOID return_user(void) 577:task.c **** { 1531 .loc 1 577 0 0 0000A810 56 push si 0 0000A811 57 push di 0 0000A812 55 push bp 1535 _.LCFI20: 0 0000A813 89E5 mov bp, sp 1537 _.LCFI21: 0 0000A815 1E push ds 578:task.c **** psp FAR *p; psp FAR * q; 579:task.c **** REG COUNT i; 580:task.c **** iregs FAR *irp; 581:task.c **** /* long j;*/ 582:task.c **** 583:task.c **** /* restore parent */ 584:task.c **** p = MK_FP(cu_psp, 0); 1539 .loc 1 584 0 0 0000A816 A1[0000] mov ax, word ptr [_cu_psp] 0 0000A819 8946FE mov word ptr [bp-2], ax 0 0000A81C 31F6 xor si, si 1543 _.LVL168: 585:task.c **** 586:task.c **** /* When process returns - restore the isv */ 587:task.c **** setvec(0x22, p->ps_isv22); 1544 .loc 1 587 0 0 0000A81E 8EC0 mov es, ax 0 0000A820 268B160A00 mov dx, word ptr es:[10] 0 0000A825 26A10C00 mov ax, word ptr es:[12] 1548 _.LVL169: 1549 _.LBB125: 1550 _.LBB126: 1551 _.LBB127: 1552 _.LBB128: 150:../hdr/portab.h **** } 1553 .loc 2 150 0 1554 #APP 1555 ;# 150 "../hdr/portab.h" 1 1556 cli 1557 ;# 0 "" 2 1558 #NO_APP 1559 _.LBE128: 1560 _.LBE127: 78:task.c **** enable(); 1561 .loc 1 78 0 0 0000A82A 8EC6 mov es, si 1563 _.LVL170: 0 0000A82C 2689168800 mov word ptr es:[136], dx 1565 _.LVL171: 0 0000A831 26A38A00 mov word ptr es:[138], ax 1567 _.LBB129: 1568 _.LBB130: 154:../hdr/portab.h **** } 1569 .loc 2 154 0 1570 #APP 1571 ;# 154 "../hdr/portab.h" 1 1572 sti 1573 ;# 0 "" 2 1574 _.LVL172: 1575 #NO_APP 1576 _.LBE130: 1577 _.LBE129: 1578 _.LBE126: 1579 _.LBE125: 588:task.c **** setvec(0x23, p->ps_isv23); 1580 .loc 1 588 0 0 0000A836 8E46FE mov es, word ptr [bp-2] 0 0000A839 268B160E00 mov dx, word ptr es:[14] 0 0000A83E 26A11000 mov ax, word ptr es:[16] 1584 _.LVL173: 1585 _.LBB131: 1586 _.LBB132: 1587 _.LBB133: 1588 _.LBB134: 150:../hdr/portab.h **** } 1589 .loc 2 150 0 1590 #APP 1591 ;# 150 "../hdr/portab.h" 1 1592 cli 1593 ;# 0 "" 2 1594 #NO_APP 1595 _.LBE134: 1596 _.LBE133: 78:task.c **** enable(); 1597 .loc 1 78 0 0 0000A843 8EC6 mov es, si 0 0000A845 2689168C00 mov word ptr es:[140], dx 0 0000A84A 26A38E00 mov word ptr es:[142], ax 1601 _.LBB135: 1602 _.LBB136: 154:../hdr/portab.h **** } 1603 .loc 2 154 0 1604 #APP 1605 ;# 154 "../hdr/portab.h" 1 1606 sti 1607 ;# 0 "" 2 1608 _.LVL174: 1609 #NO_APP 1610 _.LBE136: 1611 _.LBE135: 1612 _.LBE132: 1613 _.LBE131: 589:task.c **** setvec(0x24, p->ps_isv24); 1614 .loc 1 589 0 0 0000A84F 8E46FE mov es, word ptr [bp-2] 0 0000A852 268B161200 mov dx, word ptr es:[18] 0 0000A857 26A11400 mov ax, word ptr es:[20] 1618 _.LVL175: 1619 _.LBB137: 1620 _.LBB138: 1621 _.LBB139: 1622 _.LBB140: 150:../hdr/portab.h **** } 1623 .loc 2 150 0 1624 #APP 1625 ;# 150 "../hdr/portab.h" 1 1626 cli 1627 ;# 0 "" 2 1628 #NO_APP 1629 _.LBE140: 1630 _.LBE139: 78:task.c **** enable(); 1631 .loc 1 78 0 0 0000A85C 8EC6 mov es, si 0 0000A85E 2689169000 mov word ptr es:[144], dx 0 0000A863 26A39200 mov word ptr es:[146], ax 1635 _.LBB141: 1636 _.LBB142: 154:../hdr/portab.h **** } 1637 .loc 2 154 0 1638 #APP 1639 ;# 154 "../hdr/portab.h" 1 1640 sti 1641 ;# 0 "" 2 1642 _.LVL176: 1643 #NO_APP 1644 _.LBE142: 1645 _.LBE141: 1646 _.LBE138: 1647 _.LBE137: 590:task.c **** 591:task.c **** abort_progress = -1; 1648 .loc 1 591 0 0 0000A868 C606[0000]FF mov byte ptr [_abort_progress], -1 592:task.c **** 593:task.c **** /* And free all process memory if not a TSR return */ 594:task.c **** network_redirector(REM_PROCESS_END); 1650 .loc 1 594 0 0 0000A86D B82211 mov ax, 4386 0 0000A870 50 push ax 0 0000A871 E8[FEFF] call _network_redirector 1654 _.LVL177: 595:task.c **** /* might be a good idea to do that after closing 596:task.c **** but doesn't help NET either TE */ 597:task.c **** 598:task.c **** if (term_type != 3 && p->ps_parent != cu_psp) 1655 .loc 1 598 0 0 0000A874 803E[0000]03 cmp byte ptr [_term_type], 3 0 0000A879 742A je _.L143 1658 .loc 1 598 0 is_stmt 0 discriminator 1 0 0000A87B 8E46FE mov es, word ptr [bp-2] 0 0000A87E 26A11600 mov ax, word ptr es:[22] 0 0000A882 3B06[0000] cmp ax, word ptr [_cu_psp] 0 0000A886 741D je _.L143 599:task.c **** { 600:task.c **** network_redirector(REM_CLOSEALL); 1663 .loc 1 600 0 is_stmt 1 0 0000A888 B81D11 mov ax, 4381 0 0000A88B 50 push ax 0 0000A88C E8[FEFF] call _network_redirector 1667 _.LVL178: 601:task.c **** for (i = 0; i < p->ps_maxfiles; i++) 1668 .loc 1 601 0 0 0000A88F 89F7 mov di, si 1670 _.LVL179: 1671 _.L144: 1672 .loc 1 601 0 is_stmt 0 discriminator 1 0 0000A891 8E46FE mov es, word ptr [bp-2] 0 0000A894 26393E3200 cmp word ptr es:[50], di 0 0000A899 776B ja _.L145 602:task.c **** { 603:task.c **** DosClose(i); 604:task.c **** } 605:task.c **** FcbCloseAll(); 1676 .loc 1 605 0 is_stmt 1 0 0000A89B E8[FEFF] call _FcbCloseAll 1678 _.LVL180: 606:task.c **** FreeProcessMem(cu_psp); 1679 .loc 1 606 0 0 0000A89E FF36[0000] push word ptr [_cu_psp] 0 0000A8A2 E8[FEFF] call _FreeProcessMem 1682 _.LVL181: 1683 _.L143: 607:task.c **** } 608:task.c **** 609:task.c **** cu_psp = p->ps_parent; 1684 .loc 1 609 0 0 0000A8A5 8E46FE mov es, word ptr [bp-2] 0 0000A8A8 26A11600 mov ax, word ptr es:[22] 0 0000A8AC A3[0000] mov word ptr [_cu_psp], ax 1688 _.LVL182: 610:task.c **** q = MK_FP(cu_psp, 0); 611:task.c **** 612:task.c **** abort_progress = 0; 1689 .loc 1 612 0 0 0000A8AF C606[0000]00 mov byte ptr [_abort_progress], 0 613:task.c **** 614:task.c **** irp = (iregs FAR *) q->ps_stack; 1691 .loc 1 614 0 0 0000A8B4 8EC0 mov es, ax 0 0000A8B6 268B1E2E00 mov bx, word ptr es:[46] 0 0000A8BB 268B0E3000 mov cx, word ptr es:[48] 1695 _.LVL183: 615:task.c **** 616:task.c **** irp->CS = FP_SEG(p->ps_isv22); 1696 .loc 1 616 0 0 0000A8C0 8E46FE mov es, word ptr [bp-2] 0 0000A8C3 268B160C00 mov dx, word ptr es:[12] 0 0000A8C8 8EC1 mov es, cx 0 0000A8CA 26895714 mov word ptr es:[bx+20], dx 617:task.c **** irp->IP = FP_OFF(p->ps_isv22); 1701 .loc 1 617 0 0 0000A8CE 8E46FE mov es, word ptr [bp-2] 0 0000A8D1 268B160A00 mov dx, word ptr es:[10] 0 0000A8D6 8EC1 mov es, cx 0 0000A8D8 26895712 mov word ptr es:[bx+18], dx 618:task.c **** irp->FLAGS = 0x200; /* clear trace and carry flags, set interrupt flag */ 1706 .loc 1 618 0 0 0000A8DC 26C747160002 mov word ptr es:[bx+22], 512 619:task.c **** 620:task.c **** if (InDOS) 1708 .loc 1 620 0 0 0000A8E2 8A16[0000] mov dl, byte ptr [_InDOS] 0 0000A8E6 84D2 test dl, dl 0 0000A8E8 7406 je _.L146 621:task.c **** --InDOS; 1712 .loc 1 621 0 0 0000A8EA FECA dec dl 0 0000A8EC 8816[0000] mov byte ptr [_InDOS], dl 1715 _.L146: 622:task.c **** exec_user((iregs FAR *) q->ps_stack, 0); 1716 .loc 1 622 0 0 0000A8F0 56 push si 0 0000A8F1 8EC0 mov es, ax 0 0000A8F3 26FF363000 push word ptr es:[48] 0 0000A8F8 26FF362E00 push word ptr es:[46] 0 0000A8FD E8[FEFF] call _exec_user 1722 _.LVL184: 623:task.c **** } 1723 .loc 1 623 0 0 0000A900 89EC mov sp, bp 0 0000A902 5D pop bp 0 0000A903 5F pop di 0 0000A904 5E pop si 0 0000A905 C3 ret 1729 _.LVL185: 1730 _.L145: 603:task.c **** } 1731 .loc 1 603 0 discriminator 3 0 0000A906 57 push di 0 0000A907 E8[FEFF] call _DosClose 1734 _.LVL186: 601:task.c **** { 1735 .loc 1 601 0 discriminator 3 0 0000A90A 47 inc di 1737 _.LVL187: 0 0000A90B EB84 jmp _.L144 1739 _.LFE17: 1740 .size _return_user, .-_return_user 1741 .global _DosExeLoader 1742 .type _DosExeLoader, @function 1743 _DosExeLoader: 1744 _.LFB18: 624:task.c **** 625:task.c **** COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) 626:task.c **** { 1745 .loc 1 626 0 1746 _.LVL188: 0 0000A90D 56 push si 0 0000A90E 57 push di 0 0000A90F 55 push bp 1750 _.LCFI22: 0 0000A910 89E5 mov bp, sp 1752 _.LCFI23: 0 0000A912 83EC1C sub sp, 28 0 0000A915 C44608 les ax, dword ptr [bp+8] 0 0000A918 8946EA mov word ptr [bp-22], ax 0 0000A91B 8C46E8 mov word ptr [bp-24], es 0 0000A91E 8B760E mov si, word ptr [bp+14] 627:task.c **** UWORD mem, env, start_seg, asize = 0; 1758 .loc 1 627 0 0 0000A921 C746FA0000 mov word ptr [bp-6], 0 1760 _.LBB143: 628:task.c **** UWORD exe_size; 629:task.c **** { 630:task.c **** UWORD image_size; 631:task.c **** 632:task.c **** /* compute image size by removing the offset from the */ 633:task.c **** /* number pages scaled to bytes plus the remainder and */ 634:task.c **** /* the psp */ 635:task.c **** #if 0 636:task.c **** if (ExeHeader.exPages >= 2048) 637:task.c **** return DE_INVLDDATA; /* we're not able to get >=1MB in dos memory */ 638:task.c **** #else 639:task.c **** /* TurboC++ 3 BOSS NE stub: image > 1 MB but load only "X mod 1 MB" */ 640:task.c **** /* ExeHeader.exPages &= 0x7ff; */ /* just let << 5 do the clipping! */ 641:task.c **** #endif 642:task.c **** /* First scale the size and remove the offset */ 643:task.c **** image_size = (ExeHeader.exPages << 5) - ExeHeader.exHeaderSize; 1761 .loc 1 643 0 0 0000A926 BB[0000] mov bx, offset __SecPathBuffer 0 0000A929 8B4704 mov ax, word ptr [bx+4] 0 0000A92C B105 mov cl, 5 0 0000A92E D3E0 shl ax, cl 0 0000A930 2B4708 sub ax, word ptr [bx+8] 0 0000A933 8946EE mov word ptr [bp-18], ax 1768 _.LVL189: 644:task.c **** 645:task.c **** /* We should not attempt to allocate 646:task.c **** memory if we are overlaying the current process, because the new 647:task.c **** process will simply re-use the block we already have allocated. 648:task.c **** Jun 11, 2000 - rbc */ 649:task.c **** 650:task.c **** if ((mode & 0x7f) != OVERLAY) 1769 .loc 1 650 0 0 0000A936 89F0 mov ax, si 1771 _.LVL190: 0 0000A938 83E07F and ax, 127 0 0000A93B 8946F2 mov word ptr [bp-14], ax 0 0000A93E 83F803 cmp ax, 3 0 0000A941 89DF mov di, bx 0 0000A943 7503E9FB00 je _.L152 1777 _.LBB144: 651:task.c **** { 652:task.c **** UBYTE UMBstate = uppermem_link; 1778 .loc 1 652 0 0 0000A948 A0[0000] mov al, byte ptr [_uppermem_link] 0 0000A94B 8846F0 mov byte ptr [bp-16], al 1781 _.LVL191: 653:task.c **** UBYTE orig_mem_access = mem_access_mode; 1782 .loc 1 653 0 0 0000A94E A0[0000] mov al, byte ptr [_mem_access_mode] 1784 _.LVL192: 0 0000A951 8846EC mov byte ptr [bp-20], al 1786 _.LVL193: 654:task.c **** COUNT rc; 655:task.c **** 656:task.c **** /* and finally add in the psp size */ 657:task.c **** image_size += sizeof(psp) / 16; /* TE 03/20/01 */ 1787 .loc 1 657 0 0 0000A954 8346EE10 add word ptr [bp-18], 16 1789 _.LVL194: 658:task.c **** exe_size = image_size + ExeHeader.exMinAlloc; 659:task.c **** 660:task.c **** /* Some ancient NE programs set exMinAlloc to 0xffff to signify 661:task.c **** that they should not be run as normal MZ programs at all. Check 662:task.c **** for this and similar conditions. -- 2019/11/05 tkchia */ 663:task.c **** if (exe_size < image_size) 1790 .loc 1 663 0 0 0000A958 8B46EE mov ax, word ptr [bp-18] 1792 _.LVL195: 0 0000A95B 03470A add ax, word ptr [bx+10] 1794 _.LVL196: 0 0000A95E 8946E6 mov word ptr [bp-26], ax 0 0000A961 7303E96202 jc _.L179 664:task.c **** return DE_NOMEM; 665:task.c **** 666:task.c **** /* Clone the environement and create a memory arena */ 667:task.c **** if (mode & 0x80) 1797 .loc 1 667 0 0 0000A966 81E68000 and si, 128 0 0000A96A 740C je _.L154 668:task.c **** { 669:task.c **** DosUmbLink(1); /* link in UMBs */ 1800 .loc 1 669 0 0 0000A96C B80100 mov ax, 1 1802 _.LVL197: 0 0000A96F 50 push ax 0 0000A970 E8[FEFF] call _DosUmbLink 1805 _.LVL198: 670:task.c **** mem_access_mode |= 0x80; 1806 .loc 1 670 0 0 0000A973 800E[0000]80 or byte ptr [_mem_access_mode], -128 1808 _.L154: 671:task.c **** } 672:task.c **** 673:task.c **** rc = ChildEnv(exp, &env, namep); 1809 .loc 1 673 0 0 0000A978 FF76E8 push word ptr [bp-24] 0 0000A97B FF76EA push word ptr [bp-22] 0 0000A97E 8D46F8 lea ax, [-8+bp] 0 0000A981 50 push ax 0 0000A982 FF760C push word ptr [bp+12] 0 0000A985 E8EAF6 call _ChildEnv 1816 _.LVL199: 0 0000A988 8946F4 mov word ptr [bp-12], ax 1818 _.LVL200: 674:task.c **** #if DEBUG 675:task.c **** if (rc != SUCCESS) { ProcDbgPrintf(("Failed to create ChildEnv\n")); } 676:task.c **** #endif 677:task.c **** 678:task.c **** if (rc == SUCCESS) 1819 .loc 1 678 0 0 0000A98B 85C0 test ax, ax 0 0000A98D 750D jne _.L155 679:task.c **** /* Now find out how many paragraphs are available */ 680:task.c **** rc = ExecMemLargest(&asize, exe_size); 1822 .loc 1 680 0 0 0000A98F FF76E6 push word ptr [bp-26] 0 0000A992 8D46FA lea ax, [-6+bp] 1825 _.LVL201: 0 0000A995 50 push ax 0 0000A996 E8ABF7 call _ExecMemLargest 1828 _.LVL202: 0 0000A999 8946F4 mov word ptr [bp-12], ax 1830 _.LVL203: 1831 _.L155: 681:task.c **** 682:task.c **** exe_size = image_size + ExeHeader.exMaxAlloc; 1832 .loc 1 682 0 0 0000A99C 8B4D0C mov cx, word ptr [di+12] 0 0000A99F 8B46EE mov ax, word ptr [bp-18] 0 0000A9A2 01C8 add ax, cx 1836 _.LVL204: 683:task.c **** /* second test is for overflow (avoiding longs) -- 684:task.c **** exMaxAlloc can be high */ 685:task.c **** if (exe_size > asize || exe_size < image_size) 1837 .loc 1 685 0 0 0000A9A4 8B56FA mov dx, word ptr [bp-6] 0 0000A9A7 39D0 cmp ax, dx 0 0000A9A9 7705 ja _.L182 0 0000A9AB 3946EE cmp word ptr [bp-18], ax 0 0000A9AE 7602 jbe _.L156 1843 _.L182: 0 0000A9B0 89D0 mov ax, dx 1845 _.LVL205: 1846 _.L156: 686:task.c **** exe_size = asize; 687:task.c **** 688:task.c **** /* TE if ExeHeader.exMinAlloc == ExeHeader.exMaxAlloc == 0, 689:task.c **** DOS will allocate the largest possible memory area 690:task.c **** and load the image as high as possible into it. 691:task.c **** discovered (and after that found in RBIL), when testing NET */ 692:task.c **** 693:task.c **** if ((ExeHeader.exMinAlloc | ExeHeader.exMaxAlloc) == 0) 1847 .loc 1 693 0 0 0000A9B2 0B4D0A or cx, word ptr [di+10] 0 0000A9B5 7501 jne _.L160 685:task.c **** exe_size = asize; 1850 .loc 1 685 0 0 0000A9B7 92 xchg dx, ax 1852 _.LVL206: 1853 _.L160: 694:task.c **** exe_size = asize; 695:task.c **** 696:task.c **** /* Allocate our memory and pass back any errors */ 697:task.c **** if (rc == SUCCESS) 1854 .loc 1 697 0 0 0000A9B8 837EF400 cmp word ptr [bp-12], 0 0 0000A9BC 7516 jne _.L161 698:task.c **** rc = ExecMemAlloc(exe_size, &mem, &asize); 1857 .loc 1 698 0 0 0000A9BE 8D56FA lea dx, [-6+bp] 0 0000A9C1 52 push dx 0 0000A9C2 8D56F6 lea dx, [-10+bp] 0 0000A9C5 52 push dx 0 0000A9C6 50 push ax 0 0000A9C7 E829F6 call _ExecMemAlloc 1864 _.LVL207: 0 0000A9CA 8946F4 mov word ptr [bp-12], ax 1866 _.LVL208: 699:task.c **** 700:task.c **** if (rc != SUCCESS) 1867 .loc 1 700 0 0 0000A9CD 85C0 test ax, ax 0 0000A9CF 7503E9FB01 je _.L162 1870 _.LVL209: 1871 _.L161: 701:task.c **** DosMemFree(env); 1872 .loc 1 701 0 0 0000A9D4 FF76F8 push word ptr [bp-8] 0 0000A9D7 E8[FEFF] call _DosMemFree 1875 _.LVL210: 702:task.c **** 703:task.c **** if (mode & 0x80) 1876 .loc 1 703 0 0 0000A9DA 85F6 test si, si 0 0000A9DC 7503E98C01 je _.L151 1879 _.L177: 704:task.c **** { 705:task.c **** mem_access_mode = orig_mem_access; /* restore old situation */ 1880 .loc 1 705 0 0 0000A9E1 8A46EC mov al, byte ptr [bp-20] 0 0000A9E4 A2[0000] mov byte ptr [_mem_access_mode], al 706:task.c **** DosUmbLink(UMBstate); /* restore link state */ 1883 .loc 1 706 0 0 0000A9E7 8A46F0 mov al, byte ptr [bp-16] 0 0000A9EA 30E4 xor ah, ah 0 0000A9EC 50 push ax 0 0000A9ED E8[FEFF] call _DosUmbLink 1888 _.LVL211: 707:task.c **** } 708:task.c **** if (rc != SUCCESS) 1889 .loc 1 708 0 0 0000A9F0 837EF400 cmp word ptr [bp-12], 0 0 0000A9F4 7403E97401 jne _.L151 1892 _.L178: 1893 _.LVL212: 709:task.c **** return rc; 710:task.c **** 711:task.c **** mode &= 0x7f; /* forget about high loading from now on */ 712:task.c **** 713:task.c **** ProcDbgPrintf(("DosExeLoader. Loading '%S' at %04x\n", namep, mem)); 714:task.c **** 715:task.c **** /* memory found large enough - continue processing */ 716:task.c **** ++mem; 1894 .loc 1 716 0 0 0000A9F9 FF46F6 inc word ptr [bp-10] 1896 _.LVL213: 1897 _.L163: 1898 _.LBE144: 717:task.c **** 718:task.c **** /* /// Added open curly brace and "else" clause. We should not attempt 719:task.c **** to allocate memory if we are overlaying the current process, because 720:task.c **** the new process will simply re-use the block we already have allocated. 721:task.c **** This was causing execl() to fail in applications which use it to 722:task.c **** overlay (replace) the current exe file with a new one. 723:task.c **** Jun 11, 2000 - rbc */ 724:task.c **** } 725:task.c **** else /* !!OVERLAY */ 726:task.c **** { 727:task.c **** mem = exp->load.load_seg; 728:task.c **** } 729:task.c **** 730:task.c **** /* Now load the executable */ 731:task.c **** /* offset to start of image */ 732:task.c **** if (SftSeek(fd, ExeHeader.exHeaderSize * 16UL, 0) != SUCCESS) 1899 .loc 1 732 0 0 0000A9FC 31F6 xor si, si 0 0000A9FE 56 push si 0 0000A9FF 8B4508 mov ax, word ptr [di+8] 0 0000AA02 89C2 mov dx, ax 0 0000AA04 B10C mov cl, 12 0 0000AA06 D3EA shr dx, cl 0 0000AA08 B104 mov cl, 4 0 0000AA0A D3E0 shl ax, cl 0 0000AA0C 884EF0 mov byte ptr [bp-16], cl 0 0000AA0F 52 push dx 0 0000AA10 50 push ax 0 0000AA11 FF7610 push word ptr [bp+16] 0 0000AA14 E8[FEFF] call _SftSeek 1913 _.LVL214: 0 0000AA17 8946F4 mov word ptr [bp-12], ax 0 0000AA1A 39F0 cmp ax, si 0 0000AA1C 8976EC mov word ptr [bp-20], si 0 0000AA1F 8A4EF0 mov cl, byte ptr [bp-16] 0 0000AA22 742C je _.L164 1919 _.LVL215: 1920 _.L183: 1921 _.LBE143: 1922 _.LBB147: 733:task.c **** { 734:task.c **** if (mode != OVERLAY) 735:task.c **** { 736:task.c **** DosMemFree(--mem); 737:task.c **** DosMemFree(env); 738:task.c **** } 739:task.c **** return DE_INVLDDATA; 740:task.c **** } 741:task.c **** 742:task.c **** /* create the start seg for later computations */ 743:task.c **** start_seg = mem; 744:task.c **** exe_size = image_size; 745:task.c **** if (mode != OVERLAY) 746:task.c **** { 747:task.c **** exe_size -= sizeof(psp) / 16; 748:task.c **** start_seg += sizeof(psp) / 16; 749:task.c **** if (exe_size > 0 && (ExeHeader.exMinAlloc | ExeHeader.exMaxAlloc) == 0) 750:task.c **** { 751:task.c **** mcb FAR *mp = MK_FP(mem - 1, 0); 752:task.c **** 753:task.c **** /* then the image should be placed as high as possible */ 754:task.c **** start_seg += mp->m_size - image_size; 755:task.c **** } 756:task.c **** } 757:task.c **** } 758:task.c **** 759:task.c **** /* read in the image in 32256 chunks */ 760:task.c **** { 761:task.c **** int nBytesRead, toRead = CHUNK; 762:task.c **** seg sp = start_seg; 763:task.c **** 764:task.c **** while (1) 765:task.c **** { 766:task.c **** if (exe_size < CHUNK/16) 767:task.c **** toRead = exe_size*16; 768:task.c **** nBytesRead = (int)DosRWSft(fd, toRead, MK_FP(sp, 0), XFR_READ); 769:task.c **** if (nBytesRead < toRead || exe_size <= CHUNK/16) 770:task.c **** break; 771:task.c **** sp += CHUNK/16; 772:task.c **** exe_size -= CHUNK/16; 773:task.c **** } 774:task.c **** } 775:task.c **** 776:task.c **** { /* relocate the image for new segment */ 777:task.c **** COUNT i; 778:task.c **** UWORD reloc[2]; 779:task.c **** seg FAR *spot; 780:task.c **** 781:task.c **** SftSeek(fd, ExeHeader.exRelocTable, 0); 782:task.c **** for (i = 0; i < ExeHeader.exRelocItems; i++) 783:task.c **** { 784:task.c **** if (DosRWSft 785:task.c **** (fd, sizeof(reloc), (VOID FAR *) & reloc[0], XFR_READ) != sizeof(reloc)) 786:task.c **** { 787:task.c **** if (mode != OVERLAY) 1923 .loc 1 787 0 0 0000AA24 837EF203 cmp word ptr [bp-14], 3 0 0000AA28 7411 je _.L180 788:task.c **** { 789:task.c **** DosMemFree(--mem); 1926 .loc 1 789 0 0 0000AA2A 8B46F6 mov ax, word ptr [bp-10] 0 0000AA2D 48 dec ax 0 0000AA2E 8946F6 mov word ptr [bp-10], ax 0 0000AA31 50 push ax 0 0000AA32 E8[FEFF] call _DosMemFree 1932 _.LVL216: 790:task.c **** DosMemFree(env); 1933 .loc 1 790 0 0 0000AA35 FF76F8 push word ptr [bp-8] 0 0000AA38 E8[FEFF] call _DosMemFree 1936 _.LVL217: 1937 _.L180: 1938 _.LBE147: 1939 _.LBB148: 739:task.c **** } 1940 .loc 1 739 0 0 0000AA3B C746F4F3FF mov word ptr [bp-12], -13 0 0000AA40 E92A01 jmp _.L151 1943 _.LVL218: 1944 _.L152: 727:task.c **** } 1945 .loc 1 727 0 0 0000AA43 8B5E0C mov bx, word ptr [bp+12] 0 0000AA46 8B17 mov dx, word ptr [bx] 0 0000AA48 8956F6 mov word ptr [bp-10], dx 0 0000AA4B 8976F2 mov word ptr [bp-14], si 0 0000AA4E EBAC jmp _.L163 1951 _.LVL219: 1952 _.L164: 743:task.c **** exe_size = image_size; 1953 .loc 1 743 0 0 0000AA50 8B56F6 mov dx, word ptr [bp-10] 1955 _.LVL220: 0 0000AA53 8B76EE mov si, word ptr [bp-18] 0 0000AA56 8956F0 mov word ptr [bp-16], dx 745:task.c **** { 1958 .loc 1 745 0 0 0000AA59 837EF203 cmp word ptr [bp-14], 3 0 0000AA5D 7426 je _.L165 1961 _.LVL221: 748:task.c **** if (exe_size > 0 && (ExeHeader.exMinAlloc | ExeHeader.exMaxAlloc) == 0) 1962 .loc 1 748 0 0 0000AA5F 89D0 mov ax, dx 0 0000AA61 83C010 add ax, 16 0 0000AA64 8946F0 mov word ptr [bp-16], ax 1966 _.LVL222: 749:task.c **** { 1967 .loc 1 749 0 0 0000AA67 83C6F0 add si, -16 1969 _.LVL223: 0 0000AA6A 7419 je _.L165 749:task.c **** { 1971 .loc 1 749 0 is_stmt 0 discriminator 1 0 0000AA6C 8B450C mov ax, word ptr [di+12] 1973 _.LVL224: 0 0000AA6F 0B450A or ax, word ptr [di+10] 0 0000AA72 7511 jne _.L165 1976 _.LVL225: 1977 _.LBB145: 751:task.c **** 1978 .loc 1 751 0 is_stmt 1 0 0000AA74 4A dec dx 1980 _.LVL226: 0 0000AA75 8EC2 mov es, dx 0 0000AA77 8B46F0 mov ax, word ptr [bp-16] 0 0000AA7A 2603060300 add ax, word ptr es:[3] 754:task.c **** } 1984 .loc 1 754 0 0 0000AA7F 2B46EE sub ax, word ptr [bp-18] 0 0000AA82 8946F0 mov word ptr [bp-16], ax 1987 _.LVL227: 1988 _.L165: 0 0000AA85 89F0 mov ax, si 0 0000AA87 D3E0 shl ax, cl 0 0000AA89 8946EE mov word ptr [bp-18], ax 1992 _.LVL228: 1993 _.LBE145: 1994 _.LBE148: 1995 _.LBB149: 762:task.c **** 1996 .loc 1 762 0 0 0000AA8C 8B5EF0 mov bx, word ptr [bp-16] 761:task.c **** seg sp = start_seg; 1998 .loc 1 761 0 0 0000AA8F B9007E mov cx, 32256 2000 _.LVL229: 2001 _.L169: 766:task.c **** toRead = exe_size*16; 2002 .loc 1 766 0 0 0000AA92 81FEDF07 cmp si, 2015 0 0000AA96 7703 ja _.L166 2005 _.LVL230: 767:task.c **** nBytesRead = (int)DosRWSft(fd, toRead, MK_FP(sp, 0), XFR_READ); 2006 .loc 1 767 0 0 0000AA98 8B4EEE mov cx, word ptr [bp-18] 2008 _.LVL231: 2009 _.L166: 768:task.c **** if (nBytesRead < toRead || exe_size <= CHUNK/16) 2010 .loc 1 768 0 0 0000AA9B B80100 mov ax, 1 0 0000AA9E 50 push ax 0 0000AA9F 53 push bx 0 0000AAA0 895EE4 mov word ptr [bp-28], bx 0 0000AAA3 FF76EC push word ptr [bp-20] 0 0000AAA6 51 push cx 0 0000AAA7 894EE6 mov word ptr [bp-26], cx 0 0000AAAA FF7610 push word ptr [bp+16] 0 0000AAAD E8[FEFF] call _DosRWSft 2020 _.LVL232: 0 0000AAB0 8046EF82 add byte ptr [bp-17], -126 769:task.c **** break; 2022 .loc 1 769 0 0 0000AAB4 8B4EE6 mov cx, word ptr [bp-26] 0 0000AAB7 39C1 cmp cx, ax 0 0000AAB9 C746E60100 mov word ptr [bp-26], 1 0 0000AABE 7F13 jg _.L167 0 0000AAC0 81FEE107 cmp si, 2016+1 0 0000AAC4 720D jc _.L167 771:task.c **** exe_size -= CHUNK/16; 2029 .loc 1 771 0 0 0000AAC6 8B5EE4 mov bx, word ptr [bp-28] 0 0000AAC9 81C3E007 add bx, 2016 2032 _.LVL233: 772:task.c **** } 2033 .loc 1 772 0 0 0000AACD 81C620F8 add si, -2016 2035 _.LVL234: 766:task.c **** toRead = exe_size*16; 2036 .loc 1 766 0 0 0000AAD1 EBBF jmp _.L169 2038 _.LVL235: 2039 _.L167: 2040 _.LBE149: 2041 _.LBB150: 781:task.c **** for (i = 0; i < ExeHeader.exRelocItems; i++) 2042 .loc 1 781 0 0 0000AAD3 FF76EC push word ptr [bp-20] 0 0000AAD6 FF76EC push word ptr [bp-20] 0 0000AAD9 FF7518 push word ptr [di+24] 0 0000AADC FF7610 push word ptr [bp+16] 0 0000AADF E8[FEFF] call _SftSeek 2048 _.LVL236: 782:task.c **** { 2049 .loc 1 782 0 0 0000AAE2 31F6 xor si, si 2051 _.LVL237: 2052 _.L170: 782:task.c **** { 2053 .loc 1 782 0 is_stmt 0 discriminator 1 0 0000AAE4 397506 cmp word ptr [di+6], si 0 0000AAE7 7603E98C00 ja _.L176 2056 _.LBE150: 791:task.c **** } 792:task.c **** return DE_INVLDDATA; 793:task.c **** } 794:task.c **** if (mode == OVERLAY) 795:task.c **** { 796:task.c **** spot = MK_FP(reloc[1] + mem, reloc[0]); 797:task.c **** *spot += exp->load.reloc; 798:task.c **** } 799:task.c **** else 800:task.c **** { 801:task.c **** /* spot = MK_FP(reloc[1] + mem + 0x10, reloc[0]); */ 802:task.c **** spot = MK_FP(reloc[1] + start_seg, reloc[0]); 803:task.c **** *spot += start_seg; 804:task.c **** } 805:task.c **** } 806:task.c **** } 807:task.c **** 808:task.c **** /* and finally close the file */ 809:task.c **** DosCloseSft(fd, FALSE); 2057 .loc 1 809 0 is_stmt 1 0 0000AAEC FF76EC push word ptr [bp-20] 0 0000AAEF FF7610 push word ptr [bp+16] 0 0000AAF2 E8[FEFF] call _DosCloseSft 2061 _.LVL238: 810:task.c **** 811:task.c **** /* exit here for overlay */ 812:task.c **** if (mode == OVERLAY) 2062 .loc 1 812 0 0 0000AAF5 837EF203 cmp word ptr [bp-14], 3 0 0000AAF9 7472 je _.L151 2065 _.LVL239: 2066 _.LBB151: 2067 _.LBB152: 2068 _.LBB153: 2069 _.LBB154: 2070 _.LBB155: 150:../hdr/portab.h **** } 2071 .loc 2 150 0 2072 #APP 2073 ;# 150 "../hdr/portab.h" 1 2074 cli 2075 ;# 0 "" 2 2076 #NO_APP 2077 _.LBE155: 2078 _.LBE154: 78:task.c **** enable(); 2079 .loc 1 78 0 0 0000AAFC C41E[0000] les bx, dword ptr [_user_r] 0 0000AB00 8CC2 mov dx, es 0 0000AB02 268B4712 mov ax, word ptr es:[bx+18] 0 0000AB06 8E46EC mov es, word ptr [bp-20] 0 0000AB09 26A38800 mov word ptr es:[136], ax 2085 _.LVL240: 0 0000AB0D 8EC2 mov es, dx 0 0000AB0F 268B4714 mov ax, word ptr es:[bx+20] 0 0000AB13 8E46EC mov es, word ptr [bp-20] 0 0000AB16 26A38A00 mov word ptr es:[138], ax 2090 _.LBB156: 2091 _.LBB157: 154:../hdr/portab.h **** } 2092 .loc 2 154 0 2093 #APP 2094 ;# 154 "../hdr/portab.h" 1 2095 sti 2096 ;# 0 "" 2 2097 _.LVL241: 2098 #NO_APP 2099 _.LBE157: 2100 _.LBE156: 2101 _.LBE153: 2102 _.LBE152: 813:task.c **** return SUCCESS; 814:task.c **** 815:task.c **** { 816:task.c **** UWORD fcbcode; 817:task.c **** 818:task.c **** /* point to the PSP so we can build it */ 819:task.c **** setvec(0x22, (intvec)MK_FP(user_r->CS, user_r->IP)); 820:task.c **** child_psp(mem, cu_psp, mem + asize); 2103 .loc 1 820 0 0 0000AB1B 8B46F6 mov ax, word ptr [bp-10] 0 0000AB1E 89C2 mov dx, ax 0 0000AB20 0356FA add dx, word ptr [bp-6] 0 0000AB23 52 push dx 0 0000AB24 FF36[0000] push word ptr [_cu_psp] 0 0000AB28 50 push ax 0 0000AB29 E8[FEFF] call _child_psp 2111 _.LVL242: 821:task.c **** 822:task.c **** fcbcode = patchPSP(mem - 1, env, exp, namep); 2112 .loc 1 822 0 0 0000AB2C FF76E8 push word ptr [bp-24] 0 0000AB2F FF76EA push word ptr [bp-22] 0 0000AB32 16 push ss 0 0000AB33 FF760C push word ptr [bp+12] 0 0000AB36 FF76F8 push word ptr [bp-8] 0 0000AB39 8B46F6 mov ax, word ptr [bp-10] 0 0000AB3C 48 dec ax 0 0000AB3D 50 push ax 0 0000AB3E E84BF6 call _patchPSP 2122 _.LVL243: 823:task.c **** exp->exec.stack = 824:task.c **** MK_FP(ExeHeader.exInitSS + start_seg, ExeHeader.exInitSP); 2123 .loc 1 824 0 0 0000AB41 8B4EF0 mov cx, word ptr [bp-16] 0 0000AB44 034D0E add cx, word ptr [di+14] 0 0000AB47 8B5510 mov dx, word ptr [di+16] 823:task.c **** exp->exec.stack = 2127 .loc 1 823 0 0 0000AB4A 8B5E0C mov bx, word ptr [bp+12] 0 0000AB4D 89570E mov word ptr [bx+14], dx 0 0000AB50 894F10 mov word ptr [bx+16], cx 825:task.c **** exp->exec.start_addr = 826:task.c **** MK_FP(ExeHeader.exInitCS + start_seg, ExeHeader.exInitIP); 2131 .loc 1 826 0 0 0000AB53 8B56F0 mov dx, word ptr [bp-16] 0 0000AB56 035516 add dx, word ptr [di+22] 0 0000AB59 8B4D14 mov cx, word ptr [di+20] 825:task.c **** exp->exec.start_addr = 2135 .loc 1 825 0 0 0000AB5C 894F12 mov word ptr [bx+18], cx 0 0000AB5F 895714 mov word ptr [bx+20], dx 827:task.c **** 828:task.c **** /* Transfer control to the executable */ 829:task.c **** load_transfer(mem, exp, fcbcode, mode); 2138 .loc 1 829 0 0 0000AB62 FF76F2 push word ptr [bp-14] 0 0000AB65 50 push ax 0 0000AB66 53 push bx 0 0000AB67 FF76F6 push word ptr [bp-10] 0 0000AB6A E810F8 call _load_transfer 2144 _.LVL244: 2145 _.L151: 2146 _.LBE151: 830:task.c **** } 831:task.c **** return SUCCESS; 832:task.c **** } 2147 .loc 1 832 0 0 0000AB6D 8B46F4 mov ax, word ptr [bp-12] 0 0000AB70 89EC mov sp, bp 0 0000AB72 5D pop bp 0 0000AB73 5F pop di 0 0000AB74 5E pop si 0 0000AB75 C20A00 ret 10 2154 _.LVL245: 2155 _.L176: 2156 _.LBB158: 784:task.c **** (fd, sizeof(reloc), (VOID FAR *) & reloc[0], XFR_READ) != sizeof(reloc)) 2157 .loc 1 784 0 0 0000AB78 FF76E6 push word ptr [bp-26] 0 0000AB7B 8D46FC lea ax, [-4+bp] 0 0000AB7E 16 push ss 0 0000AB7F 50 push ax 0 0000AB80 B80400 mov ax, 4 0 0000AB83 50 push ax 0 0000AB84 FF7610 push word ptr [bp+16] 0 0000AB87 E8[FEFF] call _DosRWSft 2166 _.LVL246: 0 0000AB8A 83F804 cmp ax, 4 0 0000AB8D 7403E992FE jne _.L183 0 0000AB92 85D2 test dx, dx 0 0000AB94 7403E98BFE jne _.L183 794:task.c **** { 2171 .loc 1 794 0 0 0000AB99 837EF203 cmp word ptr [bp-14], 3 0 0000AB9D 8B46FE mov ax, word ptr [bp-2] 0 0000ABA0 8B4EFC mov cx, word ptr [bp-4] 0 0000ABA3 7514 jne _.L174 796:task.c **** *spot += exp->load.reloc; 2176 .loc 1 796 0 0 0000ABA5 0346F6 add ax, word ptr [bp-10] 2178 _.LVL247: 797:task.c **** } 2179 .loc 1 797 0 0 0000ABA8 8B5E0C mov bx, word ptr [bp+12] 0 0000ABAB 8B5702 mov dx, word ptr [bx+2] 0 0000ABAE 8EC0 mov es, ax 0 0000ABB0 89CB mov bx, cx 0 0000ABB2 260117 add word ptr es:[bx], dx 2185 _.LVL248: 2186 _.L175: 782:task.c **** { 2187 .loc 1 782 0 discriminator 2 0 0000ABB5 46 inc si 2189 _.LVL249: 0 0000ABB6 E92BFF jmp _.L170 2191 _.L174: 802:task.c **** *spot += start_seg; 2192 .loc 1 802 0 0 0000ABB9 0346F0 add ax, word ptr [bp-16] 2194 _.LVL250: 803:task.c **** } 2195 .loc 1 803 0 0 0000ABBC 8EC0 mov es, ax 0 0000ABBE 8B46F0 mov ax, word ptr [bp-16] 2198 _.LVL251: 0 0000ABC1 89CB mov bx, cx 0 0000ABC3 260107 add word ptr es:[bx], ax 0 0000ABC6 EBED jmp _.L175 2202 _.LVL252: 2203 _.L179: 2204 _.LBE158: 2205 _.LBB159: 2206 _.LBB146: 664:task.c **** 2207 .loc 1 664 0 0 0000ABC8 C746F4F8FF mov word ptr [bp-12], -8 0 0000ABCD EB9E jmp _.L151 2210 _.LVL253: 2211 _.L162: 703:task.c **** { 2212 .loc 1 703 0 0 0000ABCF 85F6 test si, si 0 0000ABD1 7503E923FE je _.L178 0 0000ABD6 E908FE jmp _.L177 2216 _.LBE146: 2217 _.LBE159: 2218 _.LFE18: 2219 .size _DosExeLoader, .-_DosExeLoader 2220 .global _DosExec 2221 .type _DosExec, @function 2222 _DosExec: 2223 _.LFB19: 833:task.c **** 834:task.c **** /* mode = LOAD or EXECUTE 835:task.c **** ep = EXE block 836:task.c **** lp = filename to load (string) 837:task.c **** 838:task.c **** leb = local copy of exe block 839:task.c **** */ 840:task.c **** COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp) 841:task.c **** { 2224 .loc 1 841 0 2225 _.LVL254: 0 0000ABD9 56 push si 0 0000ABDA 57 push di 0 0000ABDB 55 push bp 2229 _.LCFI24: 0 0000ABDC 89E5 mov bp, sp 2231 _.LCFI25: 0 0000ABDE 83EC0C sub sp, 12 0 0000ABE1 C4460A les ax, dword ptr [bp+10] 0 0000ABE4 8946FA mov word ptr [bp-6], ax 0 0000ABE7 8C46F8 mov word ptr [bp-8], es 0 0000ABEA 8B460E mov ax, word ptr [bp+14] 0 0000ABED 8946FE mov word ptr [bp-2], ax 0 0000ABF0 8B7E10 mov di, word ptr [bp+16] 842:task.c **** COUNT rc; 843:task.c **** COUNT fd; 844:task.c **** 845:task.c **** if ((mode & 0x7f) > 3 || (mode & 0x7f) == 2) 2239 .loc 1 845 0 0 0000ABF3 8A4608 mov al, byte ptr [bp+8] 0 0000ABF6 83E07F and ax, 127 0 0000ABF9 83F803 cmp ax, 3 0 0000ABFC 7E03E9C900 jg _.L217 0 0000AC01 83F802 cmp ax, 2 0 0000AC04 7503E9C100 je _.L217 846:task.c **** return DE_INVLDFMT; 847:task.c **** 848:task.c **** fmemcpy(&TempExeBlock, ep, sizeof(exec_blk)); 2246 .loc 1 848 0 0 0000AC09 8C56FC mov word ptr [bp-4], ss 0 0000AC0C BE1600 mov si, 22 0 0000AC0F 56 push si 0 0000AC10 FF76F8 push word ptr [bp-8] 0 0000AC13 FF76FA push word ptr [bp-6] 0 0000AC16 16 push ss 0 0000AC17 B8[1C00] mov ax, offset __SecPathBuffer+28 0 0000AC1A 50 push ax 0 0000AC1B E8[FEFF] call _fmemcpy 2256 _.LVL255: 849:task.c **** /* If file not found - free ram and return error */ 850:task.c **** 851:task.c **** if (IsDevice(lp) || /* we don't want to execute C:>NUL */ 2257 .loc 1 851 0 0 0000AC1E 57 push di 0 0000AC1F FF76FE push word ptr [bp-2] 0 0000AC22 E8[FEFF] call _IsDevice 2261 _.LVL256: 0 0000AC25 09D0 or ax, dx 0 0000AC27 8976F6 mov word ptr [bp-10], si 0 0000AC2A 740C je _.L210 2265 _.L212: 852:task.c **** (fd = (short)DosOpenSft(lp, O_LEGACY | O_OPEN | O_RDONLY, 0)) < 0) 853:task.c **** { 854:task.c **** return DE_FILENOTFND; 2266 .loc 1 854 0 0 0000AC2C BAFEFF mov dx, -2 2268 _.L207: 855:task.c **** } 856:task.c **** 857:task.c **** rc = (int)DosRWSft(fd, sizeof(exe_header), (BYTE FAR *)&ExeHeader, XFR_READ); 858:task.c **** 859:task.c **** if (rc == sizeof(exe_header) && 860:task.c **** (ExeHeader.exSignature == MAGIC || ExeHeader.exSignature == OLD_MAGIC)) 861:task.c **** { 862:task.c **** rc = DosExeLoader(lp, &TempExeBlock, mode, fd); 863:task.c **** } 864:task.c **** else if (rc != 0) 865:task.c **** { 866:task.c **** rc = DosComLoader(lp, &TempExeBlock, mode, fd); 867:task.c **** } else { 868:task.c **** rc = DE_INVLDFMT; 869:task.c **** } 870:task.c **** 871:task.c **** DosCloseSft(fd, FALSE); 872:task.c **** 873:task.c **** if (mode == LOAD && rc == SUCCESS) 874:task.c **** fmemcpy(ep, &TempExeBlock, sizeof(exec_blk)); 875:task.c **** 876:task.c **** return rc; 877:task.c **** } 2269 .loc 1 877 0 0 0000AC2F 92 xchg dx, ax 0 0000AC30 89EC mov sp, bp 0 0000AC32 5D pop bp 0 0000AC33 5F pop di 0 0000AC34 5E pop si 0 0000AC35 C20A00 ret 10 2276 _.L210: 852:task.c **** (fd = (short)DosOpenSft(lp, O_LEGACY | O_OPEN | O_RDONLY, 0)) < 0) 2277 .loc 1 852 0 discriminator 1 0 0000AC38 50 push ax 0 0000AC39 B80009 mov ax, 2304 0 0000AC3C 50 push ax 0 0000AC3D 57 push di 0 0000AC3E FF76FE push word ptr [bp-2] 0 0000AC41 E8[FEFF] call _DosOpenSft 2284 _.LVL257: 0 0000AC44 89C6 mov si, ax 2286 _.LVL258: 851:task.c **** (fd = (short)DosOpenSft(lp, O_LEGACY | O_OPEN | O_RDONLY, 0)) < 0) 2287 .loc 1 851 0 discriminator 1 0 0000AC46 85C0 test ax, ax 0 0000AC48 7CE2 jl _.L212 857:task.c **** 2290 .loc 1 857 0 0 0000AC4A B80100 mov ax, 1 2292 _.LVL259: 0 0000AC4D 50 push ax 0 0000AC4E BB[0000] mov bx, offset __SecPathBuffer 0 0000AC51 16 push ss 0 0000AC52 53 push bx 0 0000AC53 895EF4 mov word ptr [bp-12], bx 0 0000AC56 B81C00 mov ax, 28 0 0000AC59 50 push ax 0 0000AC5A 56 push si 0 0000AC5B E8[FEFF] call _DosRWSft 2302 _.LVL260: 859:task.c **** (ExeHeader.exSignature == MAGIC || ExeHeader.exSignature == OLD_MAGIC)) 2303 .loc 1 859 0 0 0000AC5E 83F81C cmp ax, 28 0 0000AC61 8B5EF4 mov bx, word ptr [bp-12] 0 0000AC64 754C jne _.L213 860:task.c **** { 2307 .loc 1 860 0 discriminator 1 0 0000AC66 8B07 mov ax, word ptr [bx] 2309 _.LVL261: 859:task.c **** (ExeHeader.exSignature == MAGIC || ExeHeader.exSignature == OLD_MAGIC)) 2310 .loc 1 859 0 discriminator 1 0 0000AC68 3D4D5A cmp ax, 23117 0 0000AC6B 7405 je _.L219 0 0000AC6D 3D5A4D cmp ax, 19802 0 0000AC70 7547 jne _.L214 2315 _.L219: 862:task.c **** } 2316 .loc 1 862 0 0 0000AC72 56 push si 0 0000AC73 FF7608 push word ptr [bp+8] 0 0000AC76 B8[1C00] mov ax, offset __SecPathBuffer+28 0 0000AC79 50 push ax 0 0000AC7A 57 push di 0 0000AC7B FF76FE push word ptr [bp-2] 0 0000AC7E E8[FEFF] call _DosExeLoader 2324 _.LVL262: 2325 _.L232: 866:task.c **** } else { 2326 .loc 1 866 0 0 0000AC81 92 xchg dx, ax 2328 _.LVL263: 2329 _.L216: 0 0000AC82 8956FE mov word ptr [bp-2], dx 2331 _.LVL264: 871:task.c **** 2332 .loc 1 871 0 0 0000AC85 31C0 xor ax, ax 0 0000AC87 50 push ax 0 0000AC88 56 push si 0 0000AC89 E8[FEFF] call _DosCloseSft 2337 _.LVL265: 873:task.c **** fmemcpy(ep, &TempExeBlock, sizeof(exec_blk)); 2338 .loc 1 873 0 0 0000AC8C 837E0801 cmp word ptr [bp+8], 1 0 0000AC90 8B56FE mov dx, word ptr [bp-2] 0 0000AC93 759A jne _.L207 0 0000AC95 85D2 test dx, dx 0 0000AC97 7596 jne _.L207 874:task.c **** 2344 .loc 1 874 0 0 0000AC99 FF76F6 push word ptr [bp-10] 0 0000AC9C FF76FC push word ptr [bp-4] 0 0000AC9F B8[1C00] mov ax, offset __SecPathBuffer+28 0 0000ACA2 50 push ax 0 0000ACA3 FF76F8 push word ptr [bp-8] 0 0000ACA6 FF76FA push word ptr [bp-6] 0 0000ACA9 E8[FEFF] call _fmemcpy 2352 _.LVL266: 0 0000ACAC 8B56FE mov dx, word ptr [bp-2] 0 0000ACAF E97DFF jmp _.L207 2355 _.LVL267: 2356 _.L213: 868:task.c **** } 2357 .loc 1 868 0 0 0000ACB2 BAF5FF mov dx, -11 864:task.c **** { 2359 .loc 1 864 0 0 0000ACB5 85C0 test ax, ax 0 0000ACB7 74C9 je _.L216 2362 _.LVL268: 2363 _.L214: 866:task.c **** } else { 2364 .loc 1 866 0 0 0000ACB9 56 push si 0 0000ACBA FF7608 push word ptr [bp+8] 0 0000ACBD B8[1C00] mov ax, offset __SecPathBuffer+28 0 0000ACC0 50 push ax 0 0000ACC1 57 push di 0 0000ACC2 FF76FE push word ptr [bp-2] 0 0000ACC5 E8[FEFF] call _DosComLoader 2372 _.LVL269: 0 0000ACC8 EBB7 jmp _.L232 2374 _.LVL270: 2375 _.L217: 846:task.c **** 2376 .loc 1 846 0 0 0000ACCA BAF5FF mov dx, -11 0 0000ACCD E95FFF jmp _.L207 2379 _.LFE19: 2380 .size _DosExec, .-_DosExec === Switch to base=012BB0h -> ".RODATA.STR1.1" 2381 .section .rodata.str1.1,"aMS",@progbits,1 2382 _.LC0: 0 00001A4A 426164206F72206D .string "Bad or missing Command Interpreter: " 0 00001A52 697373696E672043 0 00001A5A 6F6D6D616E642049 0 00001A62 6E74657270726574 0 00001A6A 65723A2000 2384 _.LC1: 0 00001A6F 20456E7465722074 .string " Enter the full shell command line: " 0 00001A77 68652066756C6C20 0 00001A7F 7368656C6C20636F 0 00001A87 6D6D616E64206C69 0 00001A8F 6E653A2000 === Switch to base=002270h -> ".TEXT" 2386 .text 2387 .global _P_0 2388 .type _P_0, @function 2389 _P_0: 2390 _.LFB20: 878:task.c **** 879:task.c **** #include "config.h" /* config structure definition */ 880:task.c **** 881:task.c **** /* start process 0 (the shell) */ 882:task.c **** VOID ASMCFUNC P_0(struct config FAR *Config) 883:task.c **** { 2391 .loc 1 883 0 2392 _.LVL271: 0 0000ACD0 56 push si 0 0000ACD1 57 push di 0 0000ACD2 55 push bp 2396 _.LCFI26: 0 0000ACD3 89E5 mov bp, sp 2398 _.LCFI27: 0 0000ACD5 83EC1A sub sp, 26 884:task.c **** BYTE *tailp, *endp; 885:task.c **** exec_blk exb; 886:task.c **** UBYTE mode = Config->cfgP_0_startmode; 2400 .loc 1 886 0 0 0000ACD8 C45E08 les bx, dword ptr [bp+8] 0 0000ACDB 8CC6 mov si, es 0 0000ACDD 268A4710 mov al, byte ptr es:[bx+16] 0 0000ACE1 8846E9 mov byte ptr [bp-23], al 2405 _.LVL272: 887:task.c **** 888:task.c **** /* build exec block and save all parameters here as init part will vanish! */ 889:task.c **** exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *)-1L; 2406 .loc 1 889 0 0 0000ACE4 C746F4FFFF mov word ptr [bp-12], -1 0 0000ACE9 C746F6FFFF mov word ptr [bp-10], -1 0 0000ACEE C746F0FFFF mov word ptr [bp-16], -1 0 0000ACF3 C746F2FFFF mov word ptr [bp-14], -1 890:task.c **** exb.exec.env_seg = DOS_PSP + 8; 2411 .loc 1 890 0 0 0000ACF8 C746EA6800 mov word ptr [bp-22], 104 891:task.c **** fstrcpy(Shell, MK_FP(FP_SEG(Config), Config->cfgInit)); 2413 .loc 1 891 0 0 0000ACFD 268B4706 mov ax, word ptr es:[bx+6] 2415 _.LVL273: 0 0000AD01 895EE6 mov word ptr [bp-26], bx 0 0000AD04 06 push es 0 0000AD05 50 push ax 0 0000AD06 BF[3200] mov di, offset __SecPathBuffer+50 0 0000AD09 16 push ss 0 0000AD0A 57 push di 0 0000AD0B E8[FEFF] call _fstrcpy 2423 _.LVL274: 892:task.c **** /* join name and tail */ 893:task.c **** fstrcpy(Shell + strlen(Shell), MK_FP(FP_SEG(Config), Config->cfgInitTail)); 2424 .loc 1 893 0 0 0000AD0E 8EC6 mov es, si 0 0000AD10 8B5EE6 mov bx, word ptr [bp-26] 0 0000AD13 268B4708 mov ax, word ptr es:[bx+8] 0 0000AD17 8946E6 mov word ptr [bp-26], ax 0 0000AD1A 57 push di 0 0000AD1B E8[FEFF] call _strlen 2431 _.LVL275: 0 0000AD1E 56 push si 0 0000AD1F FF76E6 push word ptr [bp-26] 0 0000AD22 01F8 add ax, di 0 0000AD24 16 push ss 0 0000AD25 50 push ax 0 0000AD26 E8[FEFF] call _fstrcpy 2438 _.LVL276: 894:task.c **** endp = Shell + strlen(Shell); 2439 .loc 1 894 0 0 0000AD29 57 push di 0 0000AD2A E8[FEFF] call _strlen 2442 _.LVL277: 0 0000AD2D 01F8 add ax, di 0 0000AD2F 96 xchg si, ax 2445 _.LVL278: 2446 _.L237: 2447 _.LBB160: 895:task.c **** 896:task.c **** for ( ; ; ) /* endless shell load loop - reboot or shut down to exit it! */ 897:task.c **** { 898:task.c **** BYTE *p; 899:task.c **** /* if there are no parameters, point to end without "\r\n" */ 900:task.c **** if((tailp = strchr(Shell,'\t')) == NULL && 2448 .loc 1 900 0 0 0000AD30 B80900 mov ax, 9 2450 _.LVL279: 0 0000AD33 50 push ax 0 0000AD34 57 push di 0 0000AD35 E8[FEFF] call _strchr 2454 _.LVL280: 0 0000AD38 89C2 mov dx, ax 2456 _.LVL281: 0 0000AD3A 85C0 test ax, ax 0 0000AD3C 7511 jne _.L234 2459 .loc 1 900 0 is_stmt 0 discriminator 1 0 0000AD3E B82000 mov ax, 32 2461 _.LVL282: 0 0000AD41 50 push ax 0 0000AD42 57 push di 0 0000AD43 E8[FEFF] call _strchr 2465 _.LVL283: 0 0000AD46 89C2 mov dx, ax 2467 _.LVL284: 0 0000AD48 85C0 test ax, ax 0 0000AD4A 7503 jne _.L234 901:task.c **** (tailp = strchr(Shell, ' ')) == NULL) 902:task.c **** tailp = endp - 2; 2470 .loc 1 902 0 is_stmt 1 0 0000AD4C 8D54FE lea dx, [-2+si] 2472 _.LVL285: 2473 _.L234: 0 0000AD4F 89F3 mov bx, si 2475 _.LVL286: 2476 _.L235: 0 0000AD51 4B dec bx 2478 _.LVL287: 903:task.c **** /* shift tail to right by 2 to make room for '\0', ctCount */ 904:task.c **** for (p = endp - 1; p >= tailp; p--) 2479 .loc 1 904 0 discriminator 1 0 0000AD52 39DA cmp dx, bx 0 0000AD54 765F jbe _.L236 905:task.c **** *(p + 2) = *p; 906:task.c **** /* terminate name and tail */ 907:task.c **** *tailp = *(endp + 2) = '\0'; 2482 .loc 1 907 0 0 0000AD56 C6440200 mov byte ptr [si+2], 0 0 0000AD5A 89D3 mov bx, dx 2485 _.LVL288: 0 0000AD5C C60700 mov byte ptr [bx], 0 908:task.c **** /* ctCount: just past '\0' do not count the "\r\n" */ 909:task.c **** exb.exec.cmd_line = (CommandTail *)(tailp + 1); 2487 .loc 1 909 0 0 0000AD5F 43 inc bx 0 0000AD60 895EEC mov word ptr [bp-20], bx 0 0000AD63 8C56EE mov word ptr [bp-18], ss 910:task.c **** exb.exec.cmd_line->ctCount = endp - tailp - 2; 2491 .loc 1 910 0 0 0000AD66 96 xchg si, ax 0 0000AD67 29D0 sub ax, dx 0 0000AD69 8956E6 mov word ptr [bp-26], dx 0 0000AD6C 04FE add al, -2 0 0000AD6E 368807 mov byte ptr ss:[bx], al 911:task.c **** #ifdef DEBUG 912:task.c **** DebugPrintf(("Process 0 starting: %s%s\n\n", Shell, tailp + 2)); 913:task.c **** #endif 914:task.c **** res_DosExec(mode, &exb, Shell); 2497 .loc 1 914 0 0 0000AD71 57 push di 0 0000AD72 8D46EA lea ax, [-22+bp] 0 0000AD75 50 push ax 0 0000AD76 8A46E9 mov al, byte ptr [bp-23] 0 0000AD79 30E4 xor ah, ah 0 0000AD7B 50 push ax 0 0000AD7C E8[FEFF] call _res_DosExec 2505 _.LVL289: 915:task.c **** put_string("Bad or missing Command Interpreter: "); /* failure _or_ exit */ 2506 .loc 1 915 0 0 0000AD7F B8[0000] mov ax, offset _.LC0 0 0000AD82 50 push ax 0 0000AD83 E8[FEFF] call _put_string 2510 _.LVL290: 916:task.c **** put_string(Shell); 2511 .loc 1 916 0 0 0000AD86 57 push di 0 0000AD87 E8[FEFF] call _put_string 2514 _.LVL291: 917:task.c **** put_string(tailp + 2); 2515 .loc 1 917 0 0 0000AD8A 8B56E6 mov dx, word ptr [bp-26] 0 0000AD8D 83C202 add dx, 2 0 0000AD90 52 push dx 0 0000AD91 E8[FEFF] call _put_string 2520 _.LVL292: 918:task.c **** put_string(" Enter the full shell command line: "); 2521 .loc 1 918 0 0 0000AD94 B8[2500] mov ax, offset _.LC1 0 0000AD97 50 push ax 0 0000AD98 E8[FEFF] call _put_string 2525 _.LVL293: 919:task.c **** endp = Shell + res_read(STDIN, Shell, NAMEMAX); 2526 .loc 1 919 0 0 0000AD9B B84300 mov ax, 67 0 0000AD9E 50 push ax 0 0000AD9F 57 push di 0 0000ADA0 31D2 xor dx, dx 0 0000ADA2 52 push dx 0 0000ADA3 8956E6 mov word ptr [bp-26], dx 0 0000ADA6 E8[FEFF] call _res_read 2534 _.LVL294: 0 0000ADA9 05[3200] add ax, offset __SecPathBuffer+50 0 0000ADAC 96 xchg si, ax 2537 _.LVL295: 920:task.c **** *endp = '\0'; /* terminate string for strchr */ 2538 .loc 1 920 0 0 0000ADAD 8B56E6 mov dx, word ptr [bp-26] 0 0000ADB0 8814 mov byte ptr [si], dl 2541 _.LBE160: 897:task.c **** BYTE *p; 2542 .loc 1 897 0 0 0000ADB2 E97BFF jmp _.L237 2544 _.LVL296: 2545 _.L236: 2546 _.LBB161: 905:task.c **** /* terminate name and tail */ 2547 .loc 1 905 0 discriminator 3 0 0000ADB5 8A07 mov al, byte ptr [bx] 0 0000ADB7 884702 mov byte ptr [bx+2], al 2550 _.LVL297: 0 0000ADBA EB95 jmp _.L235 2552 _.LBE161: 2553 _.LFE20: 2554 .size _P_0, .-_P_0 === Switch to base unknown -> ".DEBUG_FRAME"