=== Trace listing source: drbio/bin/biosgrps.lst 1 ; File : $BIOSGRPS.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; 33 ; ENDLOG 34 35 group CGROUP CODE ENDCODE RCODE_ALIGN RCODE RESUMECODE RESBIOS ICODE IDATA INITCODE STACKS INITDATA INITPSP INITENV DATAEND 36 37 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 38 39 end === Trace listing source: drbio/bin/init.lst 1 ; File : $INIT.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; INIT.ASM 1.25 93/12/07 15:51:27 33 ; Move int13pointer to offset 0B4h as some app expects it there 34 ; INIT.ASM 1.24 93/11/18 18:57:20 35 ; Increase amount reserved for COMMAND.COM by 256 bytes 36 ; INIT.ASM 1.23 93/11/17 19:29:26 37 ; Change default DEBLOCK seg to FFFF for performance reasons 38 ; INIT.ASM 1.19 93/07/22 19:43:59 39 ; switch over to REQUEST.EQU 40 ; ENDLOG 41 42 %include "lmacros2.mac" 1 <1> [list -] 1 ****************** <1> warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi] 14 <1> [list -] 43 44 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 45 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 46 %include "drmacros.mac" 1 <1> ; File : $DRMACROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 09-Nov-88 made RETF conditional for MASM 5.1/TASM 1.0 35 <1> 36 <1> FALSE equ 0 37 <1> TRUE equ (~ FALSE) 38 <1> 39 <1> 40 <1> %macro jmps 1.nolist 41 <1> jmp short %1 42 <1> %endmacro 43 <1> 44 <1> %macro stripangles 2.nolist 45 <1> %defstr %%param %2 46 <1> %substr %%opening %%param 1 47 <1> %ifidn %%opening, '<' 48 <1> %substr %%param %%param 2,-1 49 <1> %endif 50 <1> %strlen %%length %%param 51 <1> %substr %%closing %%param %%length 52 <1> %ifidn %%closing, '>' 53 <1> %substr %%param %%param 1,-2 54 <1> %endif 55 <1> %deftok %%token %%param 56 <1> %1 %%token 57 <1> %endmacro 58 <1> 59 <1> %macro pushx 0-*.nolist 60 <1> %rep %0 61 <1> stripangles push, %1 62 <1> %rotate 1 63 <1> %endrep 64 <1> %endmacro 65 <1> 66 <1> %macro popx 0-*.nolist 67 <1> %rep %0 68 <1> stripangles pop, %1 69 <1> %rotate 1 70 <1> %endrep 71 <1> %endmacro 72 <1> 73 <1> %macro incx 0-*.nolist 74 <1> %rep %0 75 <1> stripangles inc, %1 76 <1> %rotate 1 77 <1> %endrep 78 <1> %endmacro 79 <1> 80 <1> %macro decx 0-*.nolist 81 <1> %rep %0 82 <1> stripangles dec, %1 83 <1> %rotate 1 84 <1> %endrep 85 <1> %endmacro 86 <1> 87 <1> %macro rb 1.nolist 88 <1> db %1 dup (?) 89 <1> %endmacro 90 <1> 91 <1> %macro rw 1.nolist 92 <1> dw %1 dup (?) 93 <1> %endmacro 94 <1> 95 <1> %macro rd 1.nolist 96 <1> dd %1 dup (?) 97 <1> %endmacro 47 %include "ibmros.mac" 1 <1> ; File : $IBMROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> VIDEO_INT equ 10h 36 <1> EQUIPMENT_INT equ 11h 37 <1> MEMORY_INT equ 12h 38 <1> DISK_INT equ 13h 39 <1> ASYNC_INT equ 14h 40 <1> SYSTEM_INT equ 15h 41 <1> KEYBOARD_INT equ 16h 42 <1> PRINTER_INT equ 17h 43 <1> RTC_INT equ 1Ah 44 <1> CTRLBRK_INT equ 1Bh 45 <1> 46 <1> ; Int 10 subfunctions 47 <1> 48 <1> SET_CURSOR_TYPE equ 01h 49 <1> WRITE_CURSOR equ 02h ; Set cursor position 50 <1> READ_CURSOR equ 03h ; Read cursor position 51 <1> SCROLL_UP equ 06h ; Scroll active page up 52 <1> SCROLL_DOWN equ 07h ; Scroll active page down 53 <1> READ_CHAR equ 08h ; Read attribute/char at cur position 54 <1> WRITE_CHAR equ 09h ; Write attribute/char at cur position 55 <1> WRITE_TTY equ 0eh ; Write teletype at current position 56 <1> GET_STATE equ 0fh ; Return current video mode 57 <1> 58 <1> ; Int 13 subfunctions 59 <1> 60 <1> ROS_RESET equ 00h ; reset disk system 61 <1> ROS_READ equ 02h ; read from disk 62 <1> ROS_WRITE equ 03h ; write to disk 63 <1> ROS_VERIFY equ 04h ; verify data on disk 64 <1> ROS_FORMAT equ 05h ; format track on disk 65 <1> ROS_PARAM equ 08h ; get drive parameters 66 <1> ROS_GETTYPE equ 15h ; get drive type 67 <1> ROS_DSKCHG equ 16h ; check disk change status 68 <1> ROS_SETTYPE equ 17h ; set disk type for format 69 <1> ROS_SETMEDIA equ 18h ; set media type for format 70 <1> ROS_LBACHK equ 41h ; int 13 extensions install check 71 <1> ROS_LBAREAD equ 42h ; extended read 72 <1> ROS_LBAWRITE equ 43h ; extended write 73 <1> ROS_LBAVERIFY equ 44h ; extended verify 74 <1> ROS_LBAPARAM equ 48h ; get extended drive parameters 75 <1> 76 <1> PRN_ERROR equ 00101001b ; printer error bits 77 <1> PRN_NOTBUSY equ 10000000b 78 <1> PRN_ACK equ 01000000b 79 <1> PRN_PAPER equ 00100000b 80 <1> PRN_SELECT equ 00010000b 81 <1> PRN_IOERR equ 00001000b 82 <1> PRN_TIMEOUT equ 00000001b 83 <1> 84 <1> AUX_ERROR equ 10000000b ; auxiliary error bits 85 <1> 86 <1> ; Int 15 subfunctions 87 <1> 88 <1> EXT_MEMORY equ 88h ; Return extended memory size in KB 48 %include "msdos.mac" 1 <1> ; File : $Workfile: MSDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; MSDOS.EQU 1.1 92/11/10 10:48:56 34 <1> ; Added to appslib source directory. 35 <1> ; ENDLOG 36 <1> 37 <1> MS_P_TERMCPM equ 00H 38 <1> MS_C_READ equ 01H 39 <1> MS_C_WRITE equ 02H 40 <1> MS_A_READ equ 03H 41 <1> MS_A_WRITE equ 04H 42 <1> MS_L_WRITE equ 05H 43 <1> MS_C_RAWIO equ 06H 44 <1> MS_C_RAWIN equ 07H 45 <1> MS_C_NOECHO equ 08H 46 <1> MS_C_WRITESTR equ 09H 47 <1> MS_C_READSTR equ 0aH 48 <1> MS_C_STAT equ 0bH 49 <1> MS_C_FLUSH equ 0cH 50 <1> MS_DRV_ALLRESET equ 0dH 51 <1> MS_DRV_SET equ 0eH 52 <1> MS_F_OPEN equ 0fH 53 <1> MS_F_CLOSE equ 10H 54 <1> MS_F_SFIRST equ 11H 55 <1> MS_F_SNEXT equ 12H 56 <1> MS_F_DELETE equ 13H 57 <1> MS_F_READ equ 14H 58 <1> MS_F_WRITE equ 15H 59 <1> MS_F_MAKE equ 16H 60 <1> MS_F_RENAME equ 17H 61 <1> MS_DRV_GET equ 19H 62 <1> MS_F_DMAOFF equ 1aH 63 <1> MS_DRV_ALLOC equ 1bH 64 <1> MS_DRV_ALLOCSPEC equ 1cH 65 <1> MS_F_READRAND equ 21H 66 <1> MS_F_WRITERAND equ 22H 67 <1> MS_F_SIZE equ 23H 68 <1> MS_F_RANDREC equ 24H 69 <1> MS_S_SETINT equ 25H 70 <1> MS_P_MKPSP equ 26H 71 <1> MS_F_READBLK equ 27H 72 <1> MS_F_WRITEBLK equ 28H 73 <1> MS_F_PARSE equ 29H 74 <1> MS_T_GETDATE equ 2aH 75 <1> MS_T_SETDATE equ 2bH 76 <1> MS_T_GETTIME equ 2cH 77 <1> MS_T_SETTIME equ 2dH 78 <1> MS_F_VERIFY equ 2eH 79 <1> MS_F_DMAGET equ 2fH 80 <1> MS_S_BDOSVER equ 30H 81 <1> MS_P_TERMKEEP equ 31H 82 <1> MS_S_BREAK equ 33H 83 <1> MS_S_GETINT equ 35H 84 <1> MS_DRV_SPACE equ 36H 85 <1> MS_S_COUNTRY equ 38H 86 <1> MS_X_MKDIR equ 39H 87 <1> MS_X_RMDIR equ 3aH 88 <1> MS_X_CHDIR equ 3bH 89 <1> MS_X_CREAT equ 3cH 90 <1> MS_X_OPEN equ 3dH 91 <1> MS_X_CLOSE equ 3eH 92 <1> MS_X_READ equ 3fH 93 <1> MS_X_WRITE equ 40H 94 <1> MS_X_UNLINK equ 41H 95 <1> MS_X_LSEEK equ 42H 96 <1> MS_X_CHMOD equ 43H 97 <1> MS_X_IOCTL equ 44H 98 <1> MS_X_DUP equ 45H 99 <1> MS_X_DUP2 equ 46H 100 <1> MS_X_CURDIR equ 47H 101 <1> MS_M_ALLOC equ 48H 102 <1> MS_M_FREE equ 49H 103 <1> MS_M_SETBLOCK equ 4aH 104 <1> MS_X_EXEC equ 4bH 105 <1> MS_X_EXIT equ 4cH 106 <1> MS_X_WAIT equ 4dH 107 <1> MS_X_FIRST equ 4eH 108 <1> MS_X_NEXT equ 4fH 109 <1> MS_P_SETPSP equ 50H 110 <1> MS_F_GETVERIFY equ 54H 111 <1> MS_X_RENAME equ 56H 112 <1> MS_X_DATETIME equ 57H 113 <1> MS_M_STRATEGY equ 58h 114 <1> MS_F_ERROR equ 59H 115 <1> MS_X_MKTEMP equ 5aH 116 <1> MS_X_MKNEW equ 5bH 117 <1> MS_F_LOCK equ 5cH 118 <1> MS_X_EXPAND equ 60H 119 <1> MS_P_GETPSP equ 62H 120 <1> MS_X_GETCP equ 6601h 121 <1> MS_X_SETCP equ 6602h 122 <1> MS_X_SETHC equ 67h 123 <1> MS_X_COMMIT equ 68h 124 <1> 125 <1> DOS_INT equ 21h ; DOS Entry Point 126 <1> ; 127 <1> STDIN equ 0 ; Standard Console Input Handle 128 <1> STDOUT equ 1 ; Standard Console Output Handle 129 <1> STDERR equ 2 ; Standard Error Output 130 <1> STDAUX equ 3 ; Auxilary Device Handle 131 <1> STDPRN equ 4 ; Printer Device Handle 49 %include "request.mac" ; request header equates 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 39 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 57 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 50 %include "bpb.mac" 1 <1> ; File : $BPB.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> BPB struc 0 00000000 ???? SECSIZ dw ? ; # of bytes per sector 0 00000002 ?? ALLOCSIZ db ? ; # of sectors per allocation unit 0 00000003 ???? FATADD dw ? ; # of reserved sectors (1) 0 00000005 ?? NFATS db ? ; # of fats 0 00000006 ???? DIRMAX dw ? ; # of directory entries 0 00000008 ???? TOTSEC dw ? ; # of sectors total in image 0 0000000A ?? FATID db ? ; holds a copy of the fat id byte 0 0000000B ???? FATSEC dw ? ; # of sectors in a fat 0 0000000D ???? SPT dw ? ; # of sectors per track 0 0000000F ???? HEADS dw ? ; # of heads 0 00000011 ???????? HIDDEN dd ? ; disk offset (32 bit) 0 00000015 ???????? SIZ dd ? ; disk size (32 bit) 0 00000019 ???????? BFATSEC dd ? ; # of sectors per FAT 0 0000001D ???? FATFLAG dw ? ; flags for FAT mirroring 0 0000001F ???? FSVER dw ? ; version of file system 0 00000021 ???????? FSROOT dd ? ; starting cluster of root directory 0 00000025 ???? FSINFO dw ? ; sector number of file system info block 0 00000027 ???? BOOTBAK dw ? ; sector number of backup boot block 53 00000029 <1> RESRVD2 dw 6 dup (?) 54 <1> BPB ends 54 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 55 <1> 56 <1> BPB_LENGTH equ BPB_size 57 <1> 58 <1> BPB_SECTOR_OFFSET equ 0bh 59 <1> 60 <1> OLDBPB struc 0 00000000 ???? OLDBPB_SECSIZ dw ? ; # of bytes per sector 0 00000002 ?? OLDBPB_ALLOCSIZ db ? ; # of sectors per allocation unit 0 00000003 ???? OLDBPB_FATADD dw ? ; # of reserved sectors (1) 0 00000005 ?? OLDBPB_NFATS db ? ; # of fats 0 00000006 ???? OLDBPB_DIRMAX dw ? ; # of directory entries 0 00000008 ???? OLDBPB_TOTSEC dw ? ; # of sectors total in image 0 0000000A ?? OLDBPB_FATID db ? ; holds a copy of the fat id byte 0 0000000B ???? OLDBPB_FATSEC dw ? ; # of sectors in a fat 0 0000000D ???? OLDBPB_SPT dw ? ; # of sectors per track 0 0000000F ???? OLDBPB_HEADS dw ? ; # of heads 0 00000011 ???????? OLDBPB_HIDDEN dd ? ; disk offset (32 bit) 0 00000015 ???????? OLDBPB_SIZ dd ? ; disk size (32 bit) 0 00000019 ???????????? OLDBPB_RESRVD2 db 6 dup (?) 74 <1> OLDBPB ends 74 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 75 <1> 76 <1> OLDBPB_LENGTH equ OLDBPB_size 51 %include "udsc.mac" 1 <1> ; File : $UDSC.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> OLD_UDSC_BPB_LENGTH equ 25 36 <1> UDSC_BPB_LENGTH equ 53 37 <1> 38 <1> UDSC struc 0 00000000 ???????? NEXT dd ? ; link to next UDSC_ 0 00000004 ?? RUNIT db ? ; ROS drive number (0/1/80/81) 0 00000005 ?? DRIVE db ? ; logical drive 42 00000006 <1> UDSCBPB db UDSC_BPB_LENGTH dup (?) ; current BPB 0 0000003B ?? UDSCFATFLAG db ? 0 0000003C ???? OPNCNT dw ? ; # of files open on drive 0 0000003E ?? TYP db ? ; floppy drive type (0/1/2/7) 0 0000003F ???? FLAGS dw ? ; various flags for drive 0 00000041 ???? NCYL dw ? ; # of cylinders per drive 48 00000043 <1> DEVBPB db UDSC_BPB_LENGTH dup (?) ; device BPB 0 00000078 ?? LAST_TRACK db ? ; unused (last track accessed) 0 00000079 ???????? TIMER dw 2 dup (?) ; tick count for MEDCHK 51 0000007D <1> LABL db 12 dup (?) ; ASCIIZ volume label 0 00000089 ???????? SERIAL dd ? ; serial number 53 0000008D <1> FSTYPE db 9 dup (?) ; ASCIIZ "FAT12"/"FAT16" type 54 <1> UDSC ends 54 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 55 <1> 56 <1> UDSC_LENGTH equ UDSC_size 57 <1> UDSC.TIMER equ TIMER ; NASM port label 58 <1> UDSC_FM_PART equ UDSC.TIMER ; fixed media part type (always 1) 59 <1> UDSC_FM_OFFSET equ UDSC.TIMER+2 ; fixed media part offset (always 0) 60 <1> 61 <1> UDF_HARD equ 0001h ; drive is a hard disk 62 <1> UDF_CHGLINE equ 0002h ; drive support disk change line 63 <1> UDF_UNSURE equ 0004h ; drive has just been formatted 64 <1> UDF_VFLOPPY equ 0010h ; drive shares physical drive 65 <1> UDF_OWNER equ 0020h ; logical drive "owns" physical drive 66 <1> UDF_MEDIA equ 0100h ; media id is from bootsec, not default 67 <1> UDF_NOACCESS equ 0200h ; set if access to drive is disabled 68 <1> UDF_LBA equ 0400h ; drive accessed by LBA 69 <1> MAXPART equ 26 ; support up 26 drives 52 %include "driver.mac" 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 41 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 53 %include "keys.mac" ; common key definitions 1 <1> NUL equ 0 2 <1> BS equ 8 3 <1> TAB equ 9 4 <1> LF equ 10 5 <1> CR equ 13 54 55 === Switch to base=000000h -> "ENDCODE" 56 section ENDCODE 57 ENDCODE_start: === Switch to base=000000h -> "DATAEND" 58 section DATAEND 59 DATAEND_start: === Switch to base=000000h -> "IDATA" 60 section IDATA 61 IDATA_start: === Switch to base=000000h -> "INITDATA" 62 section INITDATA 63 INITDATA_start: === Switch to base=000000h -> "RCODE" 64 section RCODE 65 RCODE_start: === Switch to base=000000h -> "RESBIOS" 66 section RESBIOS 67 RESBIOS_start: === Switch to base=000000h -> "RESUMECODE" 68 section RESUMECODE 69 RESUMECODE_start: 70 71 72 ; IBM AT Hardware equates 73 74 ;COMPRESSED equ FALSE ; enables compressed changes. 75 76 ; a little macro to help locate things 77 ; it warns us when the ORG get trampled on 78 %macro orgabs 2.nolist 79 %assign %%was ($ - $$) 80 %assign %%is %1 81 %if %%was > %%is 82 %warning absolute data overwritten !! moving it: %2 83 %else 84 org %1 85 %endif 86 %endmacro 87 88 %macro jmpfar 2.nolist 89 db 0EAh ; jmpf opcode 90 dw offset %1 wrt CGROUP ; offset of destination 91 %2: dw 0EDCh ; segment of destination 92 %endmacro 93 94 %macro callfar 2.nolist 95 db 09Ah ; callf opcode 96 dw offset %1 wrt CGROUP ; offset of destination 97 %2: dw 0EDCh ; segment of destination 98 %endmacro 99 100 F5KEY equ 3F00h 101 F8KEY equ 4200h 102 103 SWITCH_F equ 01h 104 105 absolute 0 106 107 org 0000h*4, db ? 0 000032D0 ???? i0off dw ? 0 000032D2 ???? i0seg dw ? 110 111 org 0001h*4, db ? 0 000032D4 ???? i1off dw ? 0 000032D6 ???? i1seg dw ? 114 0 000032D8 ?? org 0003h*4, db ? 0 000032DC ???? i3off dw ? 0 000032DE ???? i3seg dw ? 118 119 org 0004h*4, db ? 0 000032E0 ???? i4off dw ? 0 000032E2 ???? i4seg dw ? 122 0 000032E4 ?? org 0015h*4, db ? 0 00003324 ???? i15off dw ? 0 00003326 ???? i15seg dw ? 126 0 00003328 ?? org 0019h*4, db ? 0 00003334 ???? i19off dw ? 0 00003336 ???? i19seg dw ? 130 0 00003338 ?? org 001Eh*4, db ? 132 i1Eptr label dword 0 00003348 ???? i1Eoff dw ? 0 0000334A ???? i1Eseg dw ? 135 0 0000334C ?? org 002Fh*4, db ? 137 i2Fptr label dword 0 0000338C ???? i2Foff dw ? 0 0000338E ???? i2Fseg dw ? 140 0 00003390 ?? org 006Ch*4, db ? 142 i6Cptr label dword 0 00003480 ???? i6Coff dw ? 0 00003482 ???? i6Cseg dw ? 145 146 IVECT ends 147 148 group CGROUP CODE RCODE ICODE INITDATA 149 === Switch to base=000000h -> "CODE" 150 section CODE public align=2 class=CODE 150 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 151 152 Assume CS:CGROUP, DS:Nothing, ES:Nothing, SS:Nothing 153 154 public strat 155 %if SVARDOS 156 public kernflg 157 public COMPRESS_FROM_HERE 158 %endif 159 160 extrn ConsoleTable:word 161 extrn ClockTable:word 162 extrn SerParCommonTable:word 163 extrn DiskTable:near 164 extrn Int13Deblock:near 165 extrn Int13Unsure:near 166 extrn Int2FHandler:near 167 extrn ResumeHandler:near 168 169 extrn biosinit_end:byte ; End of the BIOS Init Code and Data 170 extrn biosinit:near 171 172 extrn rcode_fixups:word 173 extrn rcode_seg:word 174 extrn rcode_offset:word 175 extrn rcode_len:word 176 extrn icode_len:word 177 extrn current_dos:word 178 extrn device_root:dword 179 extrn mem_size:word 180 extrn ext_mem_size:word 181 extrn init_buf:byte 182 extrn init_drv:byte 183 extrn init_int13_unit:byte 184 extrn init_runit:byte 185 extrn comspec_drv:byte 186 extrn init_flags:word 187 188 189 %include "biosmsgs.mac" ; Include TFT Header File 1 <1> extrn _disk_msgA : byte 2 <1> extrn disk_msgA : byte 3 <1> extrn _disk_msgB : byte 4 <1> extrn disk_msgB : byte 5 <1> extrn _div_by_zero_msg : byte 6 <1> extrn div_by_zero_msg : byte 190 191 Public A20Enable 192 A20Enable proc near 193 ;======== 194 ; This location is fixed up at run time to be a RET 195 ; If the BIOS is relocated to the HMA then it is fixed up again to be 196 ; CALLF IBMDOS:A20Enable; RET 197 ; Calling this location at run time will ensure that the HMA is mapped 198 ; in so we can access the HMA code. 199 ; 200 A20Enable endp 201 202 init proc near ; this is at BIOSCODE:0000h 0 00000000 E9[1500] jmp init0 ; jump to zero-decompression stage 204 init endp 205 206 %if SVARDOS 207 ; start offset of zero-compressed file area 208 compstart dw offset COMPRESS_FROM_HERE wrt CGROUP 209 210 ; kernel flags: 211 ; bit 0: set if assembled for compression 212 ; bit 1: set if assembled for single-file kernel 213 ; bit 7: set after kernel was processed by COMPBIOS and COMPKERN 214 215 ; bit 2: if set, gives debugger a chance to intercept by calling INT 3 216 ; CAUTION: breaks original IBM-PC compatibility if not run under 217 ; debugger 218 ; As of the lCFG block use in 2024 September this debugger check flag 219 ; is no longer used from the kernel flags. Use lDOS patchini/patchdeb 220 ; to modify the check debugger byte in the lCFG block instead. 221 kernflg db (SINGLEFILE << 1) + COMPRESSED 222 %else 223 init0 equ init1 224 225 compflg label word 0 00000003 [0000] dw offset INITDATA_start wrt CGROUP ; compresses from INITDATA onwards 227 %endif ; this word set to 0 when compressed 228 0 00000005 00 org 06h 230 0 00000006 434F4D504151436F6D db 'COMPAQCompatible' 0 0000000F 70617469626C65 0 00000016 [0000] dw offset RCODE_start wrt CGROUP ; lets find offset of RCODE 0 00000018 0000 MemFixup dw 0 ; and its relocated segment 234 235 236 Public cleanup 237 cleanup PROC far ; BIOSINIT will call here later 0 0000001A CB ret 239 cleanup endp 240 241 242 ; Device driver headers for serial/parallel devices 243 0 0000001B [3600]0000 con_drvr dw offset aux_drvr, 0 ; link to next device driver 0 0000001F 13C0 dw DA_CHARDEV+DA_SPECIAL+DA_ISCOT+DA_ISCIN+DA_IOCTL 0 00000021 [1901][A901] dw offset strat, offset IntCon 0 00000025 434F4E2020202020 db 'CON ' 0 0000002D 434F4C4F5552 db 'COLOUR' 0 00000033 000700 col_mode db 0,7,0 250 251 %imacro dump_aux_prn_drvr 0 252 dw offset prn_drvr, 0 ; link to next device driver 253 dw DA_CHARDEV 254 dw offset strat, offset IntCOM1 255 db 'AUX ' 256 257 dw offset clock_drvr, 0 ; link to next device driver 258 dw DA_CHARDEV 259 dw offset strat, offset IntLPT1 260 db 'PRN ' 261 %endmacro 262 aux_drvr: equ $ 263 prn_drvr: equ $ + 18 264 265 %if SVARDOS 266 aux_prn_drvr_destination: 267 268 %imacro lcfgoption 3+.nolist 269 _fill %1, 0, lcfg 270 %%start: 271 %2 272 %3 273 %%end: 274 %assign %%index %%start - lcfg 275 %rep %%end - %%start 276 %assign LCFGINUSE LCFGINUSE | (1 << %%index) 277 %assign %%index %%index + 1 278 %endrep 279 %endmacro 280 %assign LCFGINUSE 0 281 282 align 4, db 0 283 lcfg: 284 .: jmp strict short .end 285 lcfgoption 2,, db "lCFG" 286 lcfgoption 6,, db "00" 287 lcfgoption 8,, dq .inuse 288 289 %include "../tmp/edrdosl.mac" 290 291 lcfgoption 32,, 292 .end: 293 .size: equ .end - . 294 .inuse equ LCFGINUSE 295 296 _fill 18 * 2, 0, aux_prn_drvr_destination 297 aux_prn_drvr_size equ $ - aux_prn_drvr_destination 298 %else 299 dump_aux_prn_drvr 0 00000036 [4800]0000 dw offset prn_drvr, 0 0 0000003A 0080 dw DA_CHARDEV 0 0000003C [1901][9501] dw offset strat, offset IntCOM1 0 00000040 4155582020202020 db 'AUX ' 256 <1> 0 00000048 [5A00]0000 dw offset clock_drvr, 0 0 0000004C 0080 dw DA_CHARDEV 0 0000004E [1901][8601] dw offset strat, offset IntLPT1 0 00000052 50524E2020202020 db 'PRN ' 300 %endif 301 0 0000005A [6E01]0000 clock_drvr dw disk_drvr, 0 ; link to next device driver 0 0000005E 0880 dw DA_CHARDEV+DA_ISCLK 0 00000060 [1901][AE01] dw offset strat, offset IntClock 0 00000064 434C4F434B242020 db 'CLOCK$ ' 306 0 0000006C [C400]0000 com1_drvr dw offset lpt1_drvr, 0 ; link to next device driver 0 00000070 0080 dw DA_CHARDEV 0 00000072 [1901][9501] dw offset strat, offset IntCOM1 0 00000076 434F4D3120202020 db 'COM1 ' 311 0 0000007E [9000]0000 com2_drvr dw offset com3_drvr, 0 ; link to next device driver 0 00000082 0080 dw DA_CHARDEV 0 00000084 [1901][9A01] dw offset strat, offset IntCOM2 0 00000088 434F4D3220202020 db 'COM2 ' 316 0 00000090 [A200]0000 com3_drvr dw offset com4_drvr, 0 ; link to next device driver 0 00000094 0080 dw DA_CHARDEV 0 00000096 [1901][9F01] dw offset strat, offset IntCOM3 0 0000009A 434F4D3320202020 db 'COM3 ' 321 322 %IFDEF EMBEDDED 323 extrn rdisk_drvr:near 324 com4_drvr dw offset rdisk_drvr, 0 ; link to next device driver 325 %ELSE 0 000000A2 FFFFFFFF com4_drvr dw -1, -1 ; link to next device driver 327 %ENDIF 0 000000A6 0080 dw DA_CHARDEV 0 000000A8 [1901][A401] dw offset strat, offset IntCOM4 0 000000AC 434F4D3420202020 db 'COM4 ' 331 332 333 orgabs 0b4h, i13pointer ; save address at fixed location 334 ; for dirty apps 335 336 Public i13pointer, i13off_save, i13seg_save 337 338 i13pointer label dword ; address of ROS Int 13h entry 0 000000B4 ???? i13off_save dw ? 0 000000B6 ???? i13seg_save dw ? 341 342 343 orgabs 0b8h, req_ptr ; REQ_HDR 344 345 public req_ptr, req_off, req_seg 346 347 req_ptr label dword 0 000000B8 0000 req_off dw 0 ;** fixed location ** 0 000000BA 0000 req_seg dw 0 ;** fixed location ** 350 351 ; Local single character buffer for Ctrl-Break handling 352 public serparFlag, serparChar 353 0 000000BC 00000000 serparFlag db 4 dup (FALSE) ; we haven't got any yet 0 000000C0 ???????? serparChar db 4 dup (?) ; will store one character 356 0 000000C4 [D600]0000 lpt1_drvr dw offset lpt2_drvr, 0 ; link to next device driver 0 000000C8 0080 dw DA_CHARDEV 0 000000CA [1901][8601] dw offset strat, offset IntLPT1 0 000000CE 4C50543120202020 db 'LPT1 ' 361 362 0 000000D6 [E800]0000 lpt2_drvr dw offset lpt3_drvr, 0 ; link to next device driver 0 000000DA 0080 dw DA_CHARDEV 0 000000DC [1901][8B01] dw offset strat, offset IntLPT2 0 000000E0 4C50543220202020 db 'LPT2 ' 367 0 000000E8 [7E00]0000 lpt3_drvr dw offset com2_drvr, 0 ; link to next device driver 0 000000EC 0080 dw DA_CHARDEV 0 000000EE [1901][9001] dw offset strat, offset IntLPT3 0 000000F2 4C50543320202020 db 'LPT3 ' 372 0 000000FA 00 orgabs 100h, vecSave ; save vectors at fixed location 374 ; for dirty apps 375 376 Public orgInt13 377 0 00000100 10 vecSave db 10h 0 00000101 00000000 dw 0,0 0 00000105 13 db 13h 0 00000106 00000000 orgInt13 dw 0,0 0 0000010A 15 db 15h 0 0000010B 00000000 dw 0,0 0 0000010F 19 db 19h 0 00000110 00000000 dw 0,0 0 00000114 1B db 1Bh 0 00000115 00000000 dw 0,0 388 389 NUM_SAVED_VECS equ ($ - vecSave) / 5 390 391 strat proc far 0 00000119 2E891E[B800] mov [cs:req_off],bx 0 0000011E 2E8C06[BA00] mov [cs:req_seg],es 0 00000123 CB ret 395 strat endp 396 397 Int19Trap: 0 00000124 FC cld 0 00000125 FA cli ; be sure... 0 00000126 0E push cs 0 00000127 1F pop ds 0 00000128 BE[0001] mov si, offset vecSave 0 0000012B B90500 mov cx,NUM_SAVED_VECS ; restore this many vectors 404 Int19Trap10: 0 0000012E 31C0 xor ax,ax ; zero AH for lodsb 0 00000130 8EC0 mov es,ax ; ES -> interrupt vectors 0 00000132 AC lodsb ; AX = vector to restore 0 00000133 D1E0 shl ax,1 0 00000135 D1E0 shl ax,1 ; point at address 0 00000137 97 xchg ax,di ; ES:DI -> location to restore 0 00000138 A5 movsw 0 00000139 A5 movsw ; restore this vector 0 0000013A E2F2 loop Int19Trap10 ; go and do another 0 0000013C 833E[6401]00 cmp word ptr [oldxbda],0 ; has the XBDA been moved? 0 00000141 741E je Int19Trap20 ; no 0 00000143 A1[6A01] mov ax,word ptr [oldmemtop]; also restore old conventional 417 ; memory top 0 00000146 8E06[6401] mov es,word ptr [oldxbda]; yes, move it back 0 0000014A 8B0E[6801] mov cx,word ptr [xbdalen] 0 0000014E 8E1E[6601] mov ds,word ptr [newxbda] 0 00000152 31F6 xor si,si 0 00000154 31FF xor di,di 0 00000156 F3A5 rep movsw 0 00000158 8ED9 mov ds, cx ; => segment 0 0 0000015A 8C060E04 mov word ptr [40Eh], es 0 0000015E A31304 mov word ptr [413h], ax 427 ; update BIOS data 428 Int19Trap20: 0 00000161 CD19 int 19h ; and go to original int 19... 430 0 00000163 90 even 432 Public oldxbda,newxbda,xbdalen,oldmemtop 0 00000164 0000 oldxbda dw 0 ; old XBDA segment address 0 00000166 0000 newxbda dw 0 ; new XBDA segment address 0 00000168 0000 xbdalen dw 0 ; length of XBDA in words 0 0000016A 0000 oldmemtop dw 0 ; old conventional mem limit 437 438 orgabs 16ch, devno ; PRN:/AUX: the device number 439 0 0000016C 0000 devno db 0,0 ;** fixed location ** 441 442 Public NumDiskUnits, DeblockSeg 443 0 0000016E [6C00]0000 disk_drvr dw offset com1_drvr, 0 ; link to next driver 0 00000172 4228 dw DA_NONIBM+DA_GETSET+DA_REMOVE+DA_BIGDRV 0 00000174 [1901][B301] dw offset strat, offset IntDisk 0 00000178 05?????????????? NumDiskUnits db 5, 7 dup (?) 0 00000180 DC0E dw 0EDCh ; checked by DRIVER.SYS 0 00000182 0000 dw 0 ; was allocate UDSC 0 00000184 00A0 DeblockSeg dw 0A000h ; segment we start deblocking 451 452 453 IntLPT1: ; LPT1 0 00000186 E82F00 call DeviceDriver 0 00000189 0000 dw 0 456 457 IntLPT2: ; LPT2 0 0000018B E82A00 call DeviceDriver 0 0000018E 0100 dw 1 460 461 IntLPT3: ; LPT3 0 00000190 E82500 call DeviceDriver 0 00000193 0200 dw 2 464 465 IntCOM1: ; AUX = COM1 0 00000195 E82000 call DeviceDriver 0 00000198 0300 dw 3 468 469 IntCOM2: ; COM2 0 0000019A E81B00 call DeviceDriver 0 0000019D 0400 dw 4 472 473 IntCOM3: ; COM3 0 0000019F E81600 call DeviceDriver 0 000001A2 0500 dw 5 476 477 IntCOM4: ; COM4 0 000001A4 E81100 call DeviceDriver 0 000001A7 0600 dw 6 480 481 IntCon: 0 000001A9 E80C00 call DeviceDriver 0 000001AC [0000] dw offset ConsoleTable 484 485 IntClock: 0 000001AE E80700 call DeviceDriver 0 000001B1 [0000] dw offset ClockTable 488 489 Public IntDiskTable 490 IntDisk: 0 000001B3 E80200 call DeviceDriver 492 IntDiskTable: 0 000001B6 [0000] dw offset DiskTable 494 495 DeviceDriver proc near 0 000001B8 E845FE call A20Enable ; make sure A20 is on 0 000001BB EA[0400]DC0E jmpfar DriverFunction, DriverFunctionFixup 498 DeviceDriver endp 499 500 extrn i13_AX:word 501 502 Public Int13Trap 503 504 Int13Trap proc far 505 ;-------- 506 ; The Int 13 code is in low memory for speed, with unusual conditions 507 ; having the overhead of A20Enable calls 508 ; 0 000001C0 80FC05 cmp ah,ROS_FORMAT ; ROS format function? 0 000001C3 741C je Int13TrapFormat 511 Int13Trap10: 0 000001C5 2EA3[0000] mov [cs:i13_AX],ax ; save Op/Count in case of error 0 000001C9 F8 clc 0 000001CA 9C pushf ; fake an Int 0 000001CB 2EFF1E[B400] call far [cs:i13pointer] ; call the ROM BIOS 0 000001D0 7203 jc Int13Trap20 ; check for error 0 000001D2 CA0200 ret 2 ; none, so return to caller 518 Int13Trap20: 0 000001D5 80FC09 cmp ah,9 ; it it a DMA error ? 0 000001D8 740C je Int13TrapDMA ; then deblock it 0 000001DA E81100 call Int13TrapUnsure ; else declare floppy drive unsure 0 000001DD F9 stc ; restore error flag 0 000001DE CA0200 ret 2 ; return to user 524 525 Int13TrapFormat: 0 000001E1 E80A00 call Int13TrapUnsure ; mark media as unsure 0 000001E4 EBDF jmps Int13Trap10 ; and resume 528 529 Int13TrapDMA: 0 000001E6 E817FE call A20Enable ; make sure A20 is on 0 000001E9 EA[0000]DC0E jmpfar Int13Deblock, Int13DeblockFixup 532 533 Int13TrapUnsure proc near 0 000001EE E80FFE call A20Enable ; make sure A20 is on 0 000001F1 9A[0000]DC0E callfar Int13Unsure, Int13UnsureFixup 0 000001F6 C3 ret 537 Int13TrapUnsure endp 538 539 Int13Trap endp 540 541 542 Public Int2FTrap 543 544 Int2FTrap proc far 545 ;-------- 0 000001F7 EA[0000]DC0E jmpfar Int2FHandler, Int2FFixup 547 Int2FTrap endp 548 549 550 Resume proc far 551 ;----- 0 000001FC E801FE call A20Enable ; make sure A20 is on 0 000001FF EA[0000]DC0E jmpfar ResumeHandler, ResumeFixup 554 Resume endp 555 556 Int0Trap proc far 557 ;------- 0 00000204 E8F9FD call A20Enable ; make sure A20 is on 0 00000207 EA[C900]DC0E jmpfar Int0Handler, Int0Fixup 560 Int0Trap endp 561 562 Public FastConsole 563 564 FastConsole proc far 565 ;---------- 566 ; RAM entry to ensure INT29 vector is below INT20 vector 567 ; We keep the normal path low to maxmimise performance, but on backspace we 568 ; take the A20Enable hit and call high for greater TPA. 569 ; 0 0000020C 5053565755 pushx ; old ROS corrupts these 0 00000211 3C08 cmp al,8 ; back space character 0 00000213 7503E98000 je Fastcon30 ; special case 573 Fastcon10: 0 00000218 06 push es 0 00000219 51 push cx 0 0000021A B94000 mov cx,40h 0 0000021D 8EC1 mov es,cx 0 0000021F 2E8B1E[3300] mov bx,word ptr [cs:col_mode] ; get colour mode 0 00000224 86FB xchg bh,bl 0 00000226 80FF00 cmp bh,0 ; check if COLOUR is active 0 00000229 745E je Fastcon15 ; no, continue normally 0 0000022B 3C07 cmp al,7 ; check for non-printable chars 0 0000022D 745A je Fastcon15 0 0000022F 3C0A cmp al,0ah 0 00000231 744E je Fastcon13 0 00000233 3C0D cmp al,0dh 0 00000235 7452 je Fastcon15 0 00000237 30FF xor bh,bh ; assume video page 0 0 00000239 B409 mov ah,9 0 0000023B B90100 mov cx,1 ; one char to display 0 0000023E CD10 int 10h ; display char with given colour 0 00000240 88E3 mov bl,ah 0 00000242 B403 mov ah,3 0 00000244 CD10 int 10h 0 00000246 FEC2 inc dl 0 00000248 263A164A00 cmp dl,[es:4ah] 0 0000024D 7227 jb Fastcon12 0 0000024F B200 mov dl,0 599 Fastcon11: 0 00000251 FEC6 inc dh 0 00000253 263A368400 cmp dh,[es:84h] 0 00000258 761C jbe Fastcon12 0 0000025A FECE dec dh 0 0000025C 52 push dx 0 0000025D B80106 mov ax,601h 0 00000260 31C9 xor cx,cx 0 00000262 268A164A00 mov dl,[es:4ah] 0 00000267 FECA dec dl 0 00000269 268A368400 mov dh,[es:84h] 0 0000026E 2E8A3E[3400] mov bh,byte ptr [cs:col_mode+1] 0 00000273 CD10 int 10h 0 00000275 5A pop dx 613 Fastcon12: 0 00000276 B402 mov ah,2 0 00000278 268A3E6200 mov bh,[es:62h] 0 0000027D CD10 int 10h 0 0000027F EB0F jmps Fastcon20 618 Fastcon13: 0 00000281 B403 mov ah,3 0 00000283 30FF xor bh,bh 0 00000285 CD10 int 10h 0 00000287 EBC8 jmps Fastcon11 623 Fastcon15: 0 00000289 B40E mov ah,0eh ; use ROS TTY-like output function 0 0000028B BB0700 mov bx,7 ; use the normal attribute 0 0000028E CD10 int VIDEO_INT ; output the character in AL 627 Fastcon20: 0 00000290 59 pop cx 0 00000291 07 pop es 0 00000292 5D5F5E5B58 popx 0 00000297 CF iret 632 633 Fastcon30: 0 00000298 E865FD call A20Enable ; make sure A20 is on 0 0000029B EA[5F00]DC0E jmpfar OutputBS, OutputBSFixup ; call up to the HMA 636 637 FastConsole endp 638 639 Public ControlBreak 640 ControlBreak: 641 642 ;----------- 0 000002A0 2EC706[5D06]03FF mov word [cs:local_char],'C'-40h + (256*TRUE) 644 ;; mov local_char,'C'-40h ; force ^C into local buffer 645 ;; mov local_flag,TRUE ; indicate buffer not empty 646 Int1Trap: 647 Int3Trap: 648 Int4Trap: 0 000002A7 CF iret 650 651 even 652 public daycount 0 000002A8 0000 daycount dw 0 654 655 656 657 ; More Disk Data 658 659 public local_buffer,local_id,local_pt 660 661 662 even 663 664 %if SVARDOS 665 ; DRBIO/DRKERNEL uncompression and relocation stage. This is executed right 666 ; after the jump at the beginning of the CODE segment. This area is shared 667 ; with the 512 byte deblocking buffer and gets eventually overwritten. 668 ; 669 ; If the kernel is not loaded to segment 70h it is relocated to it. 670 671 init0 proc near 672 673 local_buffer label byte 674 675 mov byte [cs:A20Enable],0C3h ; fixup the RET 676 mov si,TEMP_RELOC_SEG - 41h ; stack right below relocation 677 mov ss,si ; segment with 16 bytes safety 678 mov sp,400h ; distance 679 680 sti 681 cld 682 683 ; The following expects ds:bp to point to the boot sector, in 684 ; particular the BPB, to push its hidden sectors field to stack. 685 ; It is used to determine the boot drive by matching the 686 ; partition offset. 687 push word [ds:1eh + bp] ; push BPB hidden sectors 688 push word [ds:1ch + bp] ; ..popped at init0 end 689 690 push cx ; save entry registers 691 push di ; (important in ROM systems) 692 693 xor si,si 694 mov ds,si 695 mov es,si 696 697 Assume DS:IVECT, ES:IVECT 698 699 ; Copy diskette parameters (11 bytes) from the location stored 700 ; at INT1E over to 0000:0522. This MAY previously be located at 7C00 701 ; or another (non-)BIOS location depending on the boot sector code. 702 ; After copying, set INT1E to point to the new location. 703 704 mov di,522h ; ES:DI -> save area for parameters 705 lds si,[i1Eptr] ; DS:SI -> FD parameters for ROS 706 707 Assume DS:Nothing 708 709 mov [es:i1Eoff],di 710 mov [es:i1Eseg],es ; setup new location 711 mov cx,11 712 rep movsb 713 mov byte ptr [es:di-7],36 ; enable read/writing of 36 sectors/track 714 715 pop di 716 pop cx 717 718 push ax ; ROM boot: BDOS seg 719 mov ax, cs ; preserve entry registers 720 mov ds, ax ; other than si, ds and es 721 xor si, si 722 723 ; determine which register holds the boot drive unit 724 ; EDR load protocol: CS=70h, DL=unit 725 ; FreeDOS load protocol: CS=60h, BL=unit 726 ; standardize to DL holding drive unit 727 cmp ax,60h ; are we loaded at segment 60h? 728 jne uncompress_and_relocate_kernel 729 mov dl,bl ; copy phys boot drive fron BL to DL 730 731 uncompress_and_relocate_kernel: 732 %if COMPRESSED eq 0 733 ; if kernel is uncompressed and we live at the correct segment, then 734 ; skip whole uncompression and relocation 735 push cs 736 pop ax 737 cmp ax,BIO_SEG 738 jne @F 739 jmp not_compressed 740 @@: 741 %endif 742 push di ; ROM boot: DL=0ffh, Disk boot: DL=phys boot drv 743 push bx ; ROM boot: memory size, Disk boot: unused 744 push cx ; ROM boot: initial drives, Disk boot: unused 745 push dx ; ROM boot: BIO seg, Disk boot: unused 746 747 mov ax,TEMP_RELOC_SEG 748 mov es,ax 749 %if (SINGLEFILE eq 1) | (COMPRESSED eq 1) 750 ; determine kernel file size in words 751 ; this is set by COMPBIOS and COMPKERN tools 752 mov ax,[cs:kernel_size] 753 %else 754 ; for an uncompressed DRBIO.SYS we must determine kernel_size, as 755 ; neither COMPBIO or COMPKERN are run on this (kernel_size=0) 756 mov ax,offset DATAEND_start wrt CGROUP 757 shr ax,1 758 mov [cs:kernel_size],ax 759 %endif 760 ; we now copy up to 128K to TEMP_RELOC_SEG for relocation 761 ; and / or uncompression 762 call copywords 763 764 ; we now far jmp to our kernel copy at TEMP_RELOC_SEG 765 db 0eah 766 dw @@farjmp_tmp_seg,TEMP_RELOC_SEG 767 @@farjmp_tmp_seg: 768 769 mov ax,TEMP_RELOC_SEG 770 mov ds,ax 771 mov ax,BIO_SEG 772 mov es,ax 773 774 %if COMPRESSED eq 1 775 ; copy uncompressed part of compressed DRBIO / KERNEL to BIO_SEG 776 mov ax, offset COMPRESS_FROM_HERE 777 inc ax 778 shr ax,1 779 %else 780 ; copy whole kernel if uncompressed 781 mov ax,[cs:kernel_size] 782 %endif 783 call copywords 784 785 ; we now far jmp to ourself at BIO_SEG 786 db 0eah 787 dw @@farjmp_bio_seg,BIO_SEG 788 @@farjmp_bio_seg: 789 790 %if COMPRESSED eq 1 791 ; now decompress the compressed part of DRBIO/KERNEL 792 mov si, offset COMPRESS_FROM_HERE 793 mov di,si 794 @@uncompress_block: 795 mov cl,4 796 mov bx,ds ; canonicalize ds:si 797 mov ax,si ; to support kernel images >64K 798 shr ax,cl ; and make sure we do not wrap around 799 add ax,bx ; at segment boundary while 800 mov ds,ax ; uncompressing 801 and si,0fh 802 mov bx,es ; canonicalize es:di 803 mov ax,di ; to support kernel images >64K 804 shr ax,cl ; and make sure we do not wrap around 805 add ax,bx ; at segment boundary while 806 mov es,ax ; uncompressing 807 and di,0fh 808 lodsw ; get control word 809 mov cx,ax ; as a count 810 jcxz @@uncompress_fini ; all done 811 test cx,8000h ; negative ? 812 jnz @@uncompress_zeros ; yes do zeros 813 rep movsb ; else move in data bytes 814 jmp @@uncompress_block ; and to the next 815 @@uncompress_zeros: 816 and cx,7fffh ; remove sign 817 jcxz @@uncompress_block ; none to do 818 xor ax,ax 819 rep stosb ; fill with zeros 820 jmp @@uncompress_block 821 @@uncompress_fini: 822 %endif 823 pop dx ; ROM boot: DL=0ffh, Disk boot: DL=phys boot drv 824 pop cx ; ROM boot: memory size, Disk boot: unused 825 pop bx ; ROM boot: initial drives, Disk boot: unused 826 pop di ; ROM boot: BIO seg, Disk boot: unused 827 not_compressed: 828 pop ax ; ROM boot: BDOS seg 829 pop word [cs:part_off] ; pushed at init0 start from BPB hidden sectors 830 pop word [cs:part_off+2] 831 jmp init1 ; next initialization stage is 832 ; part of discardable ICODE segment 833 init0 endp 834 835 copywords proc 836 ; copies up to 0ffffh words 837 ; ax = count 838 ; ds:0 = source segment 839 ; es:0 = destination segment 840 ; destroyed: si, di 841 xor si,si 842 xor di,di 843 test ax,ax 844 js @F ; more than 64K, take long route 845 mov cx,ax 846 rep movsw 847 ret 848 @@: mov cx,8000h 849 rep movsw ; copy first 64K 850 sub ax,8000h 851 mov cx,ax ; CX now contains how much left 852 mov ax,ds 853 add ax,1000h 854 mov ds,ax ; increase DS by 1000h (64K) 855 mov ax,es 856 add ax,1000h 857 mov es,ax ; increase ES by 1000h (64K) 858 rep movsw ; copy what is left 859 ret 860 861 copywords endp 862 863 kernel_size dw 0 ; kernel file size in words 864 ; patched by compbios and compkern 865 COMPRESS_FROM_HERE: 866 867 %if ($ - init0) gt 512 868 error "too much code in deblocking buffer" 869 %endif 870 ; grow deblocking buffer to 512 byte 871 db 512 - ($ - init0) dup (?) 872 %else 873 000002AA local_buffer db 512 dup (?) ; local deblocking buffer 874 %endif 875 876 SECSIZE equ 512 877 IDOFF equ SECSIZE-2 ; last word in boot sector is ID 878 PTOFF equ IDOFF-40h ; 4*16 bytes for partition def's 879 local_id equ local_buffer + IDOFF 880 local_pt equ local_buffer + PTOFF 881 882 even 883 Public diskaddrpack 884 diskaddrpack: ; disk address packet structure for LBA access 0 000004AA 10 db 10h ; size of packet 0 000004AB 00 db 0 ; reserved 0 000004AC 0100 dw 1 ; number of blocks to transfer 0 000004AE 00000000 dd 0 ; transfer buffer address 0 000004B2 0000000000000000 dq 0 ; starting absolute block number 890 891 public bpbs,bpb160,bpb360,bpb720,NBPBS 892 893 ; List of BPBs that we usually support 894 895 bpb160: 896 istruc OLDBPB 897 at OLDBPB_SECSIZ 0 000004BA 0002 bpb160.OLDBPB_SECSIZ: dw 512 899 at OLDBPB_ALLOCSIZ 0 000004BC 01 bpb160.OLDBPB_ALLOCSIZ: db 1 901 at OLDBPB_FATADD 0 000004BD 0100 bpb160.OLDBPB_FATADD: dw 1 903 at OLDBPB_NFATS 0 000004BF 02 bpb160.OLDBPB_NFATS: db 2 905 at OLDBPB_DIRMAX 0 000004C0 4000 bpb160.OLDBPB_DIRMAX: dw 64 907 at OLDBPB_TOTSEC 0 000004C2 4001 bpb160.OLDBPB_TOTSEC: dw 40*1*8 909 at OLDBPB_FATID 0 000004C4 FE bpb160.OLDBPB_FATID: db 0FEh 911 at OLDBPB_FATSEC 0 000004C5 0100 bpb160.OLDBPB_FATSEC: dw 1 913 at OLDBPB_SPT 0 000004C7 0800 bpb160.OLDBPB_SPT: dw 8 915 at OLDBPB_HEADS 0 000004C9 0100 bpb160.OLDBPB_HEADS: dw 1 917 at OLDBPB_HIDDEN 0 000004CB 00000000 bpb160.OLDBPB_HIDDEN: dd 0 919 at OLDBPB_SIZ 0 000004CF 00000000 bpb160.OLDBPB_SIZ: dd 0 921 at OLDBPB_RESRVD2 922 bpb160.OLDBPB_RESRVD2: 0 000004D3 00 iend 924 bpb180: 925 istruc OLDBPB 926 at OLDBPB_SECSIZ 0 000004D9 0002 bpb180.OLDBPB_SECSIZ: dw 512 928 at OLDBPB_ALLOCSIZ 0 000004DB 01 bpb180.OLDBPB_ALLOCSIZ: db 1 930 at OLDBPB_FATADD 0 000004DC 0100 bpb180.OLDBPB_FATADD: dw 1 932 at OLDBPB_NFATS 0 000004DE 02 bpb180.OLDBPB_NFATS: db 2 934 at OLDBPB_DIRMAX 0 000004DF 4000 bpb180.OLDBPB_DIRMAX: dw 64 936 at OLDBPB_TOTSEC 0 000004E1 6801 bpb180.OLDBPB_TOTSEC: dw 40*1*9 938 at OLDBPB_FATID 0 000004E3 FC bpb180.OLDBPB_FATID: db 0FCh 940 at OLDBPB_FATSEC 0 000004E4 0200 bpb180.OLDBPB_FATSEC: dw 2 942 at OLDBPB_SPT 0 000004E6 0900 bpb180.OLDBPB_SPT: dw 9 944 at OLDBPB_HEADS 0 000004E8 0100 bpb180.OLDBPB_HEADS: dw 1 946 at OLDBPB_HIDDEN 0 000004EA 00000000 bpb180.OLDBPB_HIDDEN: dd 0 948 at OLDBPB_SIZ 0 000004EE 00000000 bpb180.OLDBPB_SIZ: dd 0 950 at OLDBPB_RESRVD2 951 bpb180.OLDBPB_RESRVD2: 0 000004F2 00 iend 953 bpb320: 954 istruc OLDBPB 955 at OLDBPB_SECSIZ 0 000004F8 0002 bpb320.OLDBPB_SECSIZ: dw 512 957 at OLDBPB_ALLOCSIZ 0 000004FA 02 bpb320.OLDBPB_ALLOCSIZ: db 2 959 at OLDBPB_FATADD 0 000004FB 0100 bpb320.OLDBPB_FATADD: dw 1 961 at OLDBPB_NFATS 0 000004FD 02 bpb320.OLDBPB_NFATS: db 2 963 at OLDBPB_DIRMAX 0 000004FE 7000 bpb320.OLDBPB_DIRMAX: dw 112 965 at OLDBPB_TOTSEC 0 00000500 8002 bpb320.OLDBPB_TOTSEC: dw 40*2*8 967 at OLDBPB_FATID 0 00000502 FF bpb320.OLDBPB_FATID: db 0FFh 969 at OLDBPB_FATSEC 0 00000503 0100 bpb320.OLDBPB_FATSEC: dw 1 971 at OLDBPB_SPT 0 00000505 0800 bpb320.OLDBPB_SPT: dw 8 973 at OLDBPB_HEADS 0 00000507 0200 bpb320.OLDBPB_HEADS: dw 2 975 at OLDBPB_HIDDEN 0 00000509 00000000 bpb320.OLDBPB_HIDDEN: dd 0 977 at OLDBPB_SIZ 0 0000050D 00000000 bpb320.OLDBPB_SIZ: dd 0 979 at OLDBPB_RESRVD2 980 bpb320.OLDBPB_RESRVD2: 0 00000511 00 iend 982 bpb360: 983 istruc OLDBPB 984 at OLDBPB_SECSIZ 0 00000517 0002 bpb360.OLDBPB_SECSIZ: dw 512 986 at OLDBPB_ALLOCSIZ 0 00000519 02 bpb360.OLDBPB_ALLOCSIZ: db 2 988 at OLDBPB_FATADD 0 0000051A 0100 bpb360.OLDBPB_FATADD: dw 1 990 at OLDBPB_NFATS 0 0000051C 02 bpb360.OLDBPB_NFATS: db 2 992 at OLDBPB_DIRMAX 0 0000051D 7000 bpb360.OLDBPB_DIRMAX: dw 112 994 at OLDBPB_TOTSEC 0 0000051F D002 bpb360.OLDBPB_TOTSEC: dw 40*2*9 996 at OLDBPB_FATID 0 00000521 FD bpb360.OLDBPB_FATID: db 0FDh 998 at OLDBPB_FATSEC 0 00000522 0200 bpb360.OLDBPB_FATSEC: dw 2 1000 at OLDBPB_SPT 0 00000524 0900 bpb360.OLDBPB_SPT: dw 9 1002 at OLDBPB_HEADS 0 00000526 0200 bpb360.OLDBPB_HEADS: dw 2 1004 at OLDBPB_HIDDEN 0 00000528 00000000 bpb360.OLDBPB_HIDDEN: dd 0 1006 at OLDBPB_SIZ 0 0000052C 00000000 bpb360.OLDBPB_SIZ: dd 0 1008 at OLDBPB_RESRVD2 1009 bpb360.OLDBPB_RESRVD2: 0 00000530 00 iend 1011 bpb1200: 1012 istruc OLDBPB 1013 at OLDBPB_SECSIZ 0 00000536 0002 bpb1200.OLDBPB_SECSIZ: dw 512 1015 at OLDBPB_ALLOCSIZ 0 00000538 01 bpb1200.OLDBPB_ALLOCSIZ: db 1 1017 at OLDBPB_FATADD 0 00000539 0100 bpb1200.OLDBPB_FATADD: dw 1 1019 at OLDBPB_NFATS 0 0000053B 02 bpb1200.OLDBPB_NFATS: db 2 1021 at OLDBPB_DIRMAX 0 0000053C E000 bpb1200.OLDBPB_DIRMAX: dw 224 1023 at OLDBPB_TOTSEC 0 0000053E 6009 bpb1200.OLDBPB_TOTSEC: dw 80*2*15 1025 at OLDBPB_FATID 0 00000540 F9 bpb1200.OLDBPB_FATID: db 0F9h 1027 at OLDBPB_FATSEC 0 00000541 0700 bpb1200.OLDBPB_FATSEC: dw 7 1029 at OLDBPB_SPT 0 00000543 0F00 bpb1200.OLDBPB_SPT: dw 15 1031 at OLDBPB_HEADS 0 00000545 0200 bpb1200.OLDBPB_HEADS: dw 2 1033 at OLDBPB_HIDDEN 0 00000547 00000000 bpb1200.OLDBPB_HIDDEN: dd 0 1035 at OLDBPB_SIZ 0 0000054B 00000000 bpb1200.OLDBPB_SIZ: dd 0 1037 at OLDBPB_RESRVD2 1038 bpb1200.OLDBPB_RESRVD2: 0 0000054F 00 iend 1040 bpb720: 1041 istruc OLDBPB 1042 at OLDBPB_SECSIZ 0 00000555 0002 bpb720.OLDBPB_SECSIZ: dw 512 1044 at OLDBPB_ALLOCSIZ 0 00000557 02 bpb720.OLDBPB_ALLOCSIZ: db 2 1046 at OLDBPB_FATADD 0 00000558 0100 bpb720.OLDBPB_FATADD: dw 1 1048 at OLDBPB_NFATS 0 0000055A 02 bpb720.OLDBPB_NFATS: db 2 1050 at OLDBPB_DIRMAX 0 0000055B 7000 bpb720.OLDBPB_DIRMAX: dw 112 1052 at OLDBPB_TOTSEC 0 0000055D A005 bpb720.OLDBPB_TOTSEC: dw 80*2*9 1054 at OLDBPB_FATID 0 0000055F F9 bpb720.OLDBPB_FATID: db 0F9h 1056 at OLDBPB_FATSEC 0 00000560 0300 bpb720.OLDBPB_FATSEC: dw 3 1058 at OLDBPB_SPT 0 00000562 0900 bpb720.OLDBPB_SPT: dw 9 1060 at OLDBPB_HEADS 0 00000564 0200 bpb720.OLDBPB_HEADS: dw 2 1062 at OLDBPB_HIDDEN 0 00000566 00000000 bpb720.OLDBPB_HIDDEN: dd 0 1064 at OLDBPB_SIZ 0 0000056A 00000000 bpb720.OLDBPB_SIZ: dd 0 1066 at OLDBPB_RESRVD2 1067 bpb720.OLDBPB_RESRVD2: 0 0000056E 00 iend 1069 bpb1440: 1070 istruc OLDBPB 1071 at OLDBPB_SECSIZ 0 00000574 0002 bpb1440.OLDBPB_SECSIZ: dw 512 1073 at OLDBPB_ALLOCSIZ 0 00000576 01 bpb1440.OLDBPB_ALLOCSIZ: db 1 1075 at OLDBPB_FATADD 0 00000577 0100 bpb1440.OLDBPB_FATADD: dw 1 1077 at OLDBPB_NFATS 0 00000579 02 bpb1440.OLDBPB_NFATS: db 2 1079 at OLDBPB_DIRMAX 0 0000057A E000 bpb1440.OLDBPB_DIRMAX: dw 224 1081 at OLDBPB_TOTSEC 0 0000057C 400B bpb1440.OLDBPB_TOTSEC: dw 80*2*18 1083 at OLDBPB_FATID 0 0000057E F0 bpb1440.OLDBPB_FATID: db 0F0h 1085 at OLDBPB_FATSEC 0 0000057F 0900 bpb1440.OLDBPB_FATSEC: dw 9 1087 at OLDBPB_SPT 0 00000581 1200 bpb1440.OLDBPB_SPT: dw 18 1089 at OLDBPB_HEADS 0 00000583 0200 bpb1440.OLDBPB_HEADS: dw 2 1091 at OLDBPB_HIDDEN 0 00000585 00000000 bpb1440.OLDBPB_HIDDEN: dd 0 1093 at OLDBPB_SIZ 0 00000589 00000000 bpb1440.OLDBPB_SIZ: dd 0 1095 at OLDBPB_RESRVD2 1096 bpb1440.OLDBPB_RESRVD2: 0 0000058D 00 iend 1098 bpb2880: 1099 istruc OLDBPB 1100 at OLDBPB_SECSIZ 0 00000593 0002 bpb2880.OLDBPB_SECSIZ: dw 512 1102 at OLDBPB_ALLOCSIZ 0 00000595 02 bpb2880.OLDBPB_ALLOCSIZ: db 2 1104 at OLDBPB_FATADD 0 00000596 0100 bpb2880.OLDBPB_FATADD: dw 1 1106 at OLDBPB_NFATS 0 00000598 02 bpb2880.OLDBPB_NFATS: db 2 1108 at OLDBPB_DIRMAX 0 00000599 F000 bpb2880.OLDBPB_DIRMAX: dw 240 1110 at OLDBPB_TOTSEC 0 0000059B 8016 bpb2880.OLDBPB_TOTSEC: dw 80*2*36 1112 at OLDBPB_FATID 0 0000059D F0 bpb2880.OLDBPB_FATID: db 0F0h 1114 at OLDBPB_FATSEC 0 0000059E 0900 bpb2880.OLDBPB_FATSEC: dw 9 1116 at OLDBPB_SPT 0 000005A0 2400 bpb2880.OLDBPB_SPT: dw 36 1118 at OLDBPB_HEADS 0 000005A2 0200 bpb2880.OLDBPB_HEADS: dw 2 1120 at OLDBPB_HIDDEN 0 000005A4 00000000 bpb2880.OLDBPB_HIDDEN: dd 0 1122 at OLDBPB_SIZ 0 000005A8 00000000 bpb2880.OLDBPB_SIZ: dd 0 1124 at OLDBPB_RESRVD2 1125 bpb2880.OLDBPB_RESRVD2: 0 000005AC 00 iend 1127 NBPBS equ 8 1128 1129 ; The following is a template, that gets overwritten 1130 ; with the real parameters and is used while formatting 1131 1132 public local_parms,parms_spt,parms_gpl 1133 public layout_table,bpbtbl 1134 0 000005B2 DF local_parms db 11011111b ; step rate 0 000005B3 02 db 2 ; DMA mode 0 000005B4 25 db 37 ; 2*18.2 = 2 second motor off 0 000005B5 02 db 2 ; 512 bytes per sector 0 000005B6 12 parms_spt db 18 ; sectors per track 0 000005B7 2A db 2Ah ; gap length for read/write 0 000005B8 FF db 0FFh ; data length (128 byte/sector only) 0 000005B9 50 parms_gpl db 50h ; data length for format 0 000005BA F6 db 0F6h ; fill byte for format 0 000005BB 0F db 15 ; head settle time in ms 0 000005BC 08 db 8 ; motor on delay in 1/8s 1146 1147 ; The BPB table need not survive config time, so share with layout table 1148 1149 bpbtbl label word 1150 1151 MAX_SPT equ 40 1152 1153 layout_table label word ; current # of sectors/track 1154 1155 %assign variable_s 1 1156 1157 %rep MAX_SPT 1158 ; C H S N 1159 ; - - - - 1160 db 0, 0, variable_s, 2 1161 %assign variable_s variable_s + 1 1162 %endrep 1158 <1> 1159 <1> 0 000005BD 00000102 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005C1 00000202 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005C5 00000302 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005C9 00000402 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005CD 00000502 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005D1 00000602 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005D5 00000702 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005D9 00000802 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005DD 00000902 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005E1 00000A02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005E5 00000B02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005E9 00000C02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005ED 00000D02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005F1 00000E02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005F5 00000F02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005F9 00001002 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 000005FD 00001102 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000601 00001202 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000605 00001302 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000609 00001402 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 0000060D 00001502 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000611 00001602 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000615 00001702 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000619 00001802 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 0000061D 00001902 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000621 00001A02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000625 00001B02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000629 00001C02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 0000062D 00001D02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000631 00001E02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000635 00001F02 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000639 00002002 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 0000063D 00002102 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000641 00002202 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000645 00002302 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000649 00002402 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 0000064D 00002502 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000651 00002602 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000655 00002702 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1158 <1> 1159 <1> 0 00000659 00002802 db 0, 0, variable_s, 2 1161 <1> %assign variable_s variable_s + 1 1163 1164 orgabs 600h, local_char ; CON: one character look-ahead buffer 1164 ****************** warning: absolute data overwritten !! moving it: local_char [-w+user] 1165 ; nb. it's at 61B in DOS 4.0 1166 1167 Public local_char, local_flag 1168 0 0000065D 00 local_char db 0 ;** fixed location ** 0 0000065E 00 local_flag db 0 ;** fixed location ** 1171 0 0000065F 90 even 1173 public endbios 0 00000660 [0000] endbios dw offset RESBIOS_start wrt CGROUP ; pointer to last resident byte 1175 === Switch to base=000000h -> "RESUMECODE" 1176 CODE ends 1177 === Switch to base=000000h -> "ICODE" 1178 section ICODE public align=2 class=ICODE ; reusable initialization code 1178 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 1179 1180 Assume CS:CGROUP, DS:CGROUP, ES:CGROUP, SS:Nothing 1181 1182 align 2, db 0 0 00004320 [1705] bpbs dw offset bpb360 ; 0: 320/360 Kb 5.25" floppy 0 00004322 [3605] dw offset bpb1200 ; 1: 1.2 Mb 5.25" floppy 0 00004324 [5505] dw offset bpb720 ; 2: 720 Kb 3.5" floppy 0 00004326 [1705] dw offset bpb360 ; 3: (8" single density) 0 00004328 [1705] dw offset bpb360 ; 4: (8" double density) 0 0000432A [1705] dw offset bpb360 ; 5: hard disk 0 0000432C [1705] dw offset bpb360 ; 6: tape drive 0 0000432E [7405] dw offset bpb1440 ; 7: 1.44 Mb 3.5" floppy 0 00004330 [7405] dw offset bpb1440 ; 8: Other 0 00004332 [9305] dw offset bpb2880 ; 9: 2.88 Mb 3.5" floppy 1193 1194 %if SVARDOS 1195 aux_prn_drvr_source: 1196 .: 1197 dump_aux_prn_drvr 1198 %if $ - . != aux_prn_drvr_size 1199 %error Unexpected layout 1200 %endif 1201 %endif 1202 0 00004334 00 checkdebugger: db 0 1204 1205 init1 proc near 1206 1207 %if SVARDOS ; source is in compressed part, so copy it here 1208 push cx 1209 push di 1210 1211 ; Get lCFG items to use later. 1212 mov cl, byte [lcfg.checkdebugger] 1213 mov byte [cs:checkdebugger], cl 1214 push cs 1215 pop es 1216 mov di, aux_prn_drvr_destination 1217 push cs 1218 pop ds 1219 mov si, aux_prn_drvr_source 1220 mov cx, words(aux_prn_drvr_size) 1221 rep movsw 1222 1223 pop di 1224 pop cx 1225 %endif 1226 1227 %if SVARDOS eq 0 1228 ; DRBIO initialization code. This is executed right after the jump 1229 ; at the beginning of the CODE segment. 1230 1231 ; Get lCFG items to use later. 0 00004335 8EC1 mov es, cx 0 00004337 268A4D14 mov cl, byte [es:di + LCFG_CheckDebugger] 0 0000433B 2E880E[1400] mov byte [cs:checkdebugger], cl 1235 1236 ; 1237 ; We now uncompress to > (7C00h (ie. boot stack) - 700h (ie. base of code) 1238 ; This means our stack collides with our code, very bad news. 1239 ; To avoid this we switch stacks into a safer area ie. 0C000h 1240 ; The floppy parameters also MAY live at 7C00, so we have to relocate these 1241 ; before we expand. 1242 0 00004340 2EC606[0000]C3 mov byte [cs:A20Enable],0C3h 1244 ; fixup the RET 1245 0 00004346 BC00C0 mov sp, 0C000h ; switch to magic stack 1247 0 00004349 FB sti 0 0000434A FC cld 1250 1251 ; the following expects ds:bp to point to the boot sector, in 1252 ; particular the BPB, to push its hidden sectors field to stack 0 0000434B 3EFF761E push word [ds:1eh + bp] ; push BPB hidden sectors 0 0000434F 3EFF761C push word [ds:1ch + bp] ; ..popped at biosinit to part_off 1255 0 00004353 56 push si ; drdoslen 0 00004354 50 push ax ; drdosseg 0 00004355 51 push cx ; save entry registers 0 00004356 57 push di ; (important in ROM systems) 1260 1261 %if COMPRESSED 1262 mov ds, ax 1263 mov cx, si 1264 mov ax, 1070h 1265 mov es, ax 1266 mov di, si 1267 std 1268 cmpsb 1269 rep movsb 1270 cld 1271 pop di 1272 pop cx 1273 pop si 1274 push ax 1275 push cx 1276 push di 1277 %endif 1278 0 00004357 31F6 xor si,si 0 00004359 8EDE mov ds,si 0 0000435B 8EC6 mov es,si 1282 1283 Assume DS:IVECT, ES:IVECT 1284 1285 ; Copy diskette parameters (11 bytes) from the location stored 1286 ; at INT1E over to 0000:0522. This MAY previously be located at 7C00 1287 ; or another (non-)BIOS location depending on the boot sector code. 1288 ; After copying, set INT1E to point to the new location. 1289 0 0000435D BF2205 mov di,522h ; ES:DI -> save area for parameters 0 00004360 C5367800 lds si,[i1Eptr] ; DS:SI -> FD parameters for ROS 1292 1293 Assume DS:Nothing 1294 0 00004364 26893E7800 mov [es:i1Eoff],di 0 00004369 268C067A00 mov [es:i1Eseg],es ; setup new location 0 0000436E B90B00 mov cx,11 0 00004371 F3A4 rep movsb 0 00004373 26C645F924 mov byte ptr [es:di-7],36 ; enable read/writing of 36 sectors/track 1300 0 00004378 5F pop di 0 00004379 59 pop cx 1303 1304 %if COMPRESSED 1305 mov si, cs ; preserve entry registers 1306 mov ds, si ; other than si, ds and es 1307 mov es, si 1308 xor si, si 1309 mov si, [compflg] ; Get Compresed BIOS Flag 1310 or si, si ; Set to Zero if the BIOS has 1311 jnz bios_r50_not_compressed ; been compressed 1312 mov si, offset INITDATA_start wrt CGROUP 1313 push di ; bios_seg 1314 push ax ; bdos_seg 1315 push bx ; initial drives 1316 push cx ; memory size 1317 push dx ; initial flags 1318 lea cx, [biosinit_end] 1319 sub cx, si 1320 inc cx ; length of compressed part plus one 1321 mov di, cx 1322 neg di ; furthest offset we can use 1323 and di, 0fff0h ; on the next para below 1324 push di 1325 push si 1326 shr cx, 1 1327 rep movsw ; take a copy 1328 pop di ; di is now -> compressed dest 1329 pop si ; this is now -> compressed source 1330 bios_r20: 1331 lodsw ; get control word 1332 mov cx,ax ; as a count 1333 jcxz bios_r40 ; all done 1334 test cx,8000h ; negative ? 1335 jnz bios_r30 ; yes do zeros 1336 rep movsb ; else move in data bytes 1337 jmp short bios_r20 ; and to the next 1338 1339 bios_r30: 1340 and cx,7fffh ; remove sign 1341 jcxz bios_r20 ; none to do 1342 xor ax,ax 1343 rep stosb ; fill with zeros 1344 jmp short bios_r20 1345 bios_r40: 1346 pop dx 1347 pop cx 1348 pop bx 1349 pop ax 1350 pop di 1351 bios_r50_not_compressed: 1352 %endif ; compressed 1353 1354 %endif ; lDOS flavour init0 1355 0 0000437A 8CCE mov si,cs 0 0000437C 8EDE mov ds,si ; DS -> local data segment 0 0000437E 80FAFF cmp dl,0ffh ; booting from ROM? 0 00004381 742E jz rom_boot 0 00004383 81FE0010 cmp si,1000h ; test if debugging 0 00004387 7244 jb disk_boot ; skip if not 1362 1363 ; When the BIOS is loaded by the DOSLOAD or LOADER utilities under 1364 ; Concurrent for DEBUGGING or in a ROM system then on entry AX 1365 ; contains the current location of the BDOS and CX the memory Size. 1366 ; Bx is the current code segment 1367 0 00004389 2E8916[0000] mov [cs:rcode_seg],dx ; rom segment of bios 0 0000438E 2EA3[0000] mov [cs:current_dos],ax ; current location of the BDOS 0 00004392 2E890E[0000] mov [cs:mem_size],cx ; total memory size 0 00004397 2E881E[0000] mov [cs:init_drv],bl ; initial drive 0 0000439C 2E883E[0000] mov [cs:comspec_drv],bh ; 0 000043A1 2EC606[0000]03 mov byte [cs:init_buf],3 ; assume default # of buffers 0 000043A7 2EC706[0000]0300 mov word [cs:init_flags],3 0 000043AE E9FA00 jmp bios_exit 1376 1377 rom_boot: ; BIOS is copied from ROM: 1378 ; DL = 0FFh 1379 ; AX = segment address of DRBDOS 1380 ; BH = COMSPEC drive 1381 ; BL = INIT_DRV 0 000043B1 2E893E[0000] mov [cs:rcode_seg],di ; DI = BIOS ROM SEG 0 000043B6 2EA3[0000] mov [cs:current_dos],ax ; current location of the BDOS 0 000043BA 2E881E[0000] mov [cs:init_drv],bl ; initial drive C: 0 000043BF 2E883E[0000] mov [cs:comspec_drv],bh ; commspec drive C: 0 000043C4 2EC706[0000]0300 mov word [cs:init_flags],3 ; it is a ROM system, use comspec drive 0 000043CB EB1E jmps rom_boot10 ; common code 1388 1389 disk_boot: 0 000043CD 2E8C0E[0000] mov [cs:rcode_seg],cs 0 000043D2 29C0 sub ax,ax 0 000043D4 2EA3[0000] mov [cs:current_dos],ax ; current BDOS location to disk load 0 000043D8 92 xchg ax,dx ; AL = boot drive 0 000043D9 2EA2[0000] mov [cs:init_runit],al ; save the ROS unit 0 000043DD 2EA2[0000] mov [cs:init_int13_unit],al ; save the ROS unit 0 000043E1 3C80 cmp al,80h ; test the boot drive 0 000043E3 7202 jb floppy_boot ; skip if floppy boot 0 000043E5 B002 mov al,2 ; it's a hard drive 1399 floppy_boot: 0 000043E7 2EA2[0000] mov [cs:init_drv],al ; set boot drive 1401 1402 rom_boot10: 0 000043EB 1E06 pushx ; save registers 0 000043ED 29DB sub bx,bx 0 000043EF 8EDB mov ds,bx ; DS:BX -> interrupt vectors 1406 1407 Assume DS:IVECT 1408 0 000043F1 0E push cs ; we want to save vectors some 0 000043F2 07 pop es ; locally 1411 0 000043F3 8D3E[0001] lea di,[vecSave] 0 000043F7 B90500 mov cx,NUM_SAVED_VECS ; restore this many vectors 1414 SaveVectors: 0 000043FA 31C0 xor ax,ax ; zero AH 0 000043FC 268A05 mov al,[es:di] ; AX = vector to save 0 000043FF 47 inc di ; skip to save position 0 00004400 D1E0 shl ax,1 0 00004402 D1E0 shl ax,1 ; point at address 0 00004404 96 xchg ax,si ; DS:SI -> location to save 0 00004405 A5 movsw 0 00004406 A5 movsw ; save this vector 0 00004407 E2F1 loop SaveVectors ; go and do another 1424 1425 debugger_check: 1426 %if SVARDOS && 0 1427 test byte [es:kernflg],DEBUG_FLG 1428 jz debugger_disabled 1429 clc 1430 %else 0 00004409 2EA0[1400] mov al, byte [cs:checkdebugger] 0 0000440D A804 test al, LCFG_DBG_ONLY_VALID 0 0000440F 740E jz @F 1434 ; ds => IVT 0 00004411 833E0C00FF cmp word [i3off], -1 0 00004416 7420 je .nocheck 0 00004418 833E0E0000 cmp word [i3seg], 0 0 0000441D 7419 je .nocheck 1439 @@: 0 0000441F A808 test al, LCFG_DBG_ONLY_IISP 0 00004421 7411 jz @F 1442 ; ds => IVT 0 00004423 C41E0C00 les bx, [i3off] ; es:bx -> int 3 handler 0 00004427 83FBEE cmp bx, -18 ; valid ? (could tear word access ?) 0 0000442A 770C ja .nocheck ; no, cannot be a valid IISP header --> 0 0000442C 26817F064B42 cmp word [es:bx + 6], "KB" ; signature present ? 0 00004432 7504 jne .nocheck ; no --> 1448 @@: 0 00004434 A801 test al, LCFG_DBG_CHECK 0 00004436 7508 jnz .check 1451 .nocheck: 0 00004438 2EC606[2501]90 mov byte [cs:.patch], 90h ; do not check 0 0000443E EB00 jmp @F ; (flush queue for the SMC) 1454 @@: 1455 .check: 0 00004440 A802 test al, LCFG_DBG_ASSUME ; (NC) 0 00004442 7401 jz .runint3 ; if to assume off --> (NC) 0 00004444 F9 stc ; assume on (CY) 1459 .runint3: 1460 %endif 0 00004445 CC .patch: int3 ; SMC: patched to NOP if not to run int3 0 00004446 721E jc debugger_detected 1463 debugger_disabled: 0 00004448 C7060000[0402] mov word [i0off],offset Int0Trap 0 0000444E 8C0E0200 mov [i0seg],cs ; now grab int0 vector 0 00004452 C7060400[A702] mov word [i1off],offset Int1Trap 0 00004458 8C0E0600 mov [i1seg],cs ; now grab int1 vector 0 0000445C C7060C00[A702] mov word [i3off],offset Int1Trap 0 00004462 8C0E0E00 mov [i3seg],cs ; now grab int3 vector 1470 1471 debugger_detected: 0 00004466 C7061000[A702] mov word [i4off],offset Int1Trap 0 0000446C 8C0E1200 mov [i4seg],cs ; now grab int4 vector 0 00004470 C7066400[2401] mov word [i19off],offset Int19Trap 0 00004476 8C0E6600 mov [i19seg],cs ; now grab int19 vector 1476 0 0000447A 071F popx 1478 1479 Assume DS:CGROUP, ES:CGROUP 1480 1481 %if SVARDOS 1482 mov si,offset kernel_ver_msg 1483 call output_msg 1484 mov si,offset repository_msg 1485 call output_msg 1486 %else 0 0000447C BE[1200] mov si,offset drdosprojects_msg 0 0000447F E8A000 call output_msg 0 00004482 BE[6600] mov si,offset starting_dos_msg 0 00004485 E89A00 call output_msg 1491 %endif 1492 0 00004488 B488 mov ah,EXT_MEMORY 0 0000448A CD15 int SYSTEM_INT ; find out how much extended memory 0 0000448C 7302 jnc bios_extmem 0 0000448E 31C0 xor ax,ax ; say we have no memory 1497 bios_extmem: 0 00004490 A3[0000] mov [ext_mem_size],ax ; we have and store for reference 1499 0 00004493 C606[0000]03 mov byte [init_buf],3 ; assume default of 3 buffers 0 00004498 CD12 int MEMORY_INT ; get amount of conventional memory 0 0000449A 3D8000 cmp ax,128 0 0000449D 7605 jbe bios_mem 0 0000449F C606[0000]05 mov byte [init_buf],5 ; use 5 buffers if > 128K of memory 1505 bios_mem: ; get amount of conventional memory 0 000044A4 B106 mov cl,6 ; in kilobytes (AX) 0 000044A6 D3E0 shl ax,cl ; convert Kb's to paragraphs 0 000044A8 A3[0000] mov [mem_size],ax ; set end of TPA 1509 1510 bios_exit: 1511 ; The following code performs the fixups necessary for ROM executable 1512 ; internal device drivers. 0 000044AB 8CC8 mov ax,cs ; check if we are on a rommed system 0 000044AD 3B06[0000] cmp ax,[rcode_seg] 0 000044B1 751C jne keep_rcode ; if so no relocation required 0 000044B3 B8[0000] mov ax,offset RCODE_start wrt CGROUP 0 000044B6 A3[0000] mov [rcode_offset],ax ; fixup variable need 0 000044B9 BB[0000] mov bx,offset IDATA_start wrt CGROUP 0 000044BC 29C3 sub bx,ax 0 000044BE 891E[0000] mov [icode_len],bx ; during init we need RCODE and ICODE 0 000044C2 BB[0000] mov bx,offset RESUMECODE_start wrt CGROUP 0 000044C5 29C3 sub bx,ax 0 000044C7 891E[0000] mov [rcode_header],bx 0 000044CB 891E[0000] mov [rcode_len],bx ; afterwards we just need RCODE 1525 keep_rcode: 1526 1527 ; If the system ROM BIOS supports RESUME mode then it will call Int 6C 1528 ; when returning from sleep mode. We take this over and reset the clock 1529 ; based upon the RTC value. To save space we only relocate the code if 1530 ; required. 1531 ; 0 000044CF B80041 mov ax,4100h ; does the BIOS support resume mode 0 000044D2 31DB xor bx,bx 0 000044D4 CD15 int 15h ; lets ask it 0 000044D6 7224 jc resume_exit 0 000044D8 1E push ds 0 000044D9 31C0 xor ax,ax 0 000044DB 8ED8 mov ds,ax ; DS = vectors 1539 Assume DS:IVECT 0 000044DD C706B001[FC01] mov word [i6Coff],offset Resume 0 000044E3 8C0EB201 mov [i6Cseg],cs ; point Int 6C at resume code 1542 Assume DS:CGROUP 0 000044E7 1F pop ds 0 000044E8 8CC8 mov ax,cs ; check if we are on a rommed system 0 000044EA 3B06[0000] cmp ax,[rcode_seg] 0 000044EE 750C jne resume_exit ; if so nothing extra to keep 0 000044F0 B8[0000] mov ax,offset RESBIOS_start wrt CGROUP 0 000044F3 2D[0000] sub ax,offset RCODE_start wrt CGROUP 0 000044F6 A3[0000] mov [rcode_header],ax ; keep Resume code as well... 0 000044F9 A3[0000] mov [rcode_len],ax ; afterwards we just need RCODE 1551 resume_exit: 0 000044FC B8[0000] mov ax,offset ENDCODE_start wrt CGROUP ; discard RCODE (we will relocate it) 0 000044FF A3[6006] mov [endbios],ax 0 00004502 C706[0000][0000] mov word [rcode_fixups],offset bios_fixup_tbl 1555 0 00004508 BB[1B00] mov bx,offset con_drvr ; get first device driver in chain 0 0000450B 891E[0000] mov word ptr [device_root+0],bx 0 0000450F 8C1E[0200] mov word ptr [device_root+2],ds 1559 1560 @@next_fixup: 0 00004513 833FFF cmp word ptr [bx],0FFFFh ; last driver in BIOS? 0 00004516 7407 je @@fixup_done 0 00004518 8C5F02 mov [2 + bx],ds ; fix up segments in driver chain 0 0000451B 8B1F mov bx,[bx] 0 0000451D EBF4 jmp short @@next_fixup 1566 @@fixup_done: 0 0000451F E9[0000] jmp biosinit ; jump to BIOS code 1568 1569 init1 endp 1570 1571 public output_msg 1572 output_msg: 1573 ;---------------- 1574 ; On Entry: 1575 ; si = offset message_msg 1576 ; On Exit: 1577 ; None 0 00004522 5053 pushx 0 00004524 AC lodsb ; get 1st character (never NULL) 1580 output_msg10: 0 00004525 B40E mov ah,0Eh 0 00004527 BB0700 mov bx,7 0 0000452A CD10 int VIDEO_INT ; TTY write of character 0 0000452C AC lodsb ; fetch another character 0 0000452D 84C0 test al,al ; end of string ? 0 0000452F 75F4 jnz output_msg10 0 00004531 5B58 popx 0 00004533 C3 ret 1589 1590 public output_hex 1591 output_hex: 1592 ;---------------- 1593 ; On Entry: 1594 ; dx = 2 byte hex value 1595 ; On Exit: 1596 ; None 1597 ; Used Regs: 1598 ; ax,bx,cx,dx,si 0 00004534 50535156 pushx 0 00004538 B90400 mov cx,4 0 0000453B B40E mov ah,0eh 0 0000453D BB0700 mov bx,7 1603 output_hex10: 0 00004540 88F0 mov al,dh 0 00004542 51 push cx 0 00004543 B104 mov cl,4 0 00004545 D2E8 shr al,cl 0 00004547 59 pop cx 0 00004548 240F and al,0fh 0 0000454A 3C09 cmp al,09h ; greater 0-9? 0 0000454C 7F04 jg output_hex20 0 0000454E 0430 add al,30h 0 00004550 EB02 jmp output_hex30 1614 output_hex20: 0 00004552 0437 add al,37h 1616 output_hex30: 0 00004554 CD10 int VIDEO_INT 0 00004556 51 push cx 0 00004557 B104 mov cl,4 0 00004559 D3E2 shl dx,cl 0 0000455B 59 pop cx 0 0000455C E2E2 loop output_hex10 0 0000455E BE[4902] mov si,offset output_hex40 0 00004561 E8BEFF call output_msg 0 00004564 5E595B58 popx 0 00004568 C3 ret 0 00004569 2000 output_hex40 db 20h,NUL ; end of string 1628 === Switch to base=000000h -> "RESUMECODE" 1629 ICODE ends 1630 === Switch to base=000000h -> "INITDATA" 1631 section INITDATA public align=16 class=INITDATA 1631 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 1632 1633 %if SVARDOS 1634 extrn part_off:word 1635 %endif 1636 1637 ; This is a zero terminated list of locations to be fixed up with the 1638 ; segment of the relocated BIOS RCODE 1639 0 00008200 [1800] bios_fixup_tbl dw offset MemFixup 0 00008202 [9E02] dw offset OutputBSFixup 0 00008204 [BE01] dw offset DriverFunctionFixup 0 00008206 [0A02] dw offset Int0Fixup 0 00008208 [EC01] dw offset Int13DeblockFixup 0 0000820A [F401] dw offset Int13UnsureFixup 0 0000820C [FA01] dw offset Int2FFixup 0 0000820E [0202] dw offset ResumeFixup 1648 %IFDEF EMBEDDED 1649 dw offset RdiskFixup 1650 %endif 0 00008210 0000 dw 0 1652 1653 %if SVARDOS 1654 %include "svarver.mac" 1655 1656 kernel_ver_msg db KERNEL_VER_STR, 0 1657 repository_msg db REPOSITORY_STR, 0 1658 %else 1659 1660 %ifndef LDOS 1661 %assign LDOS 0 1662 %elifempty LDOS 1663 %assign LDOS 1 1664 %endif 1665 1666 %if LDOS 0 00008212 0D0A drdosprojects_msg db CR, LF 0 00008214 6C444F5320456E6861 db "lDOS Enhanced DR-DOS kernel fork https://hg.pushbx.org/ecm/edrdos" 0 0000821D 6E6365642044522D44 0 00008226 4F53206B65726E656C 0 0000822F 20666F726B20202020 0 00008238 202020202020202020 0 00008241 202068747470733A2F 0 0000824A 2F68672E7075736862 0 00008253 782E6F72672F65636D 0 0000825C 2F656472646F73 0 00008263 0D0A00 db CR, LF, NUL 1670 ;lDOS Enhanced DR-DOS kernel fork https://hg.pushbx.org/ecm/edrdos 1671 ;Enhanced DR-DOS continuation https://github.com/svardos/edrdos 1672 ;The DR-DOS/OpenDOS Enhancement Project http://www.drdosprojects.de 1673 ;12345678901234567890123456789012345678901234567890123456789012345678901234567890 1674 %elif SVARDOS 1675 drdosprojects_msg db CR, LF, "Enhanced DR-DOS continuation https://github.com/svardos/edrdos", CR, LF, NUL 1676 %else 1677 drdosprojects_msg db CR, LF, "The DR-DOS/OpenDOS Enhancement Project http://www.drdosprojects.de", CR, LF, NUL 1678 %endif 0 00008266 0D0A5374617274696E starting_dos_msg db CR, LF, "Starting " 0 0000826F 6720 1680 %define SHORTVERSION 1 1681 shortversion equ 1 1682 %include "version.mac" 1 <1> %imacro comment 0-*.nolist 1 ****************** <1> warning: redefining multi-line macro `comment' [-w+pp-macro-redef-multi] 2 <1> %endmacro 3 <1> 4 <1> %ifndef SHORTVERSION 5 <1> %undef shortversion 6 <1> %define if comment 7 <1> %define ifdef comment 8 <1> %define else comment 9 <1> %define endif comment 10 <1> %include "version.inc" 11 <1> %undef if 12 <1> %undef ifdef 13 <1> %undef else 14 <1> %undef endif 15 <1> %else 16 <1> %define shortversion 1 17 <1> %macro if 1.nolist 18 <1> %define db comment 19 <1> %endmacro 20 <1> %macro ifdef 1.nolist 21 <1> %define db comment 22 <1> %endmacro 23 <1> %macro else 0.nolist 24 <1> %define db comment 25 <1> %endmacro 26 <1> %macro endif 0.nolist 27 <1> %undef db 28 <1> %endmacro 29 <1> %include "version.inc" 1 <2> 0 00008271 456E68616E63656420 db 'Enhanced DR-DOS 7.01.08 WIP (2024 August)' 0 0000827A 44522D444F5320372E 0 00008283 30312E303820574950 0 0000828C 202832303234204175 0 00008295 6775737429 3 <2> ifdef shortversion 4 <2> else 5 <2> db ' based on Caldera OpenDOS 7.01' 6 <2> endif 30 <1> %undef db 31 <1> %unmacro if 1.nolist 32 <1> %unmacro ifdef 1.nolist 33 <1> %unmacro else 0.nolist 34 <1> %unmacro endif 0.nolist 35 <1> %endif 0 0000829A 0D0A00 db CR, LF, NUL 1684 %endif 1685 === Switch to base=000000h -> "RESUMECODE" 1686 INITDATA ends 1687 === Switch to base=000000h -> "CODE" 1688 section CODE class=CODE 1688 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 1689 %IFDEF EMBEDDED 1690 extrn RdiskFixup:word 1691 %endif === Switch to base=000000h -> "RESUMECODE" 1692 CODE ends 1693 1694 === Switch to base=000000h -> "RCODE_ALIGN" 1695 section RCODE_ALIGN public align=16 class=RCODE 1695 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 1696 %ifndef ROMSYS 1697 ; db 1100h dup(0) ; reserve space for command.com 0 00000680 000000000000000000 db 1A00h dup(0) ; reserve space for command.com 0 00000689 000000000000000000 0 00000692 000000000000000000 0 0000069B 000000000000000000 0 000006A4 000000000000000000 0 000006AD 000000000000000000 0 000006B6 000000000000000000 0 000006BF 000000000000000000 0 000006C8 000000000000000000 0 000006D1 000000000000000000 0 000006DA 000000000000000000 0 000006E3 000000000000000000 0 000006EC 000000000000000000 0 000006F5 000000000000000000 0 000006FE 000000000000000000 0 00000707 000000000000000000 0 00000710 000000000000000000 0 00000719 000000000000000000 0 00000722 000000000000000000 0 0000072B 000000000000000000 0 00000734 000000000000000000 0 0000073D 000000000000000000 0 00000746 000000000000000000 0 0000074F 000000000000000000 0 00000758 000000000000000000 0 00000761 000000000000000000 0 0000076A 000000000000000000 0 00000773 000000000000000000 0 0000077C 000000000000000000 0 00000785 000000000000000000 0 0000078E 000000000000000000 0 00000797 000000000000000000 0 000007A0 000000000000000000 0 000007A9 000000000000000000 0 000007B2 000000000000000000 0 000007BB 000000000000000000 0 000007C4 000000000000000000 0 000007CD 000000000000000000 0 000007D6 000000000000000000 0 000007DF 000000000000000000 0 000007E8 000000000000000000 0 000007F1 000000000000000000 0 000007FA 000000000000000000 0 00000803 000000000000000000 0 0000080C 000000000000000000 0 00000815 000000000000000000 0 0000081E 000000000000000000 0 00000827 000000000000000000 0 00000830 000000000000000000 0 00000839 000000000000000000 0 00000842 000000000000000000 0 0000084B 000000000000000000 0 00000854 000000000000000000 0 0000085D 000000000000000000 0 00000866 000000000000000000 0 0000086F 000000000000000000 0 00000878 000000000000000000 0 00000881 000000000000000000 0 0000088A 000000000000000000 0 00000893 000000000000000000 0 0000089C 000000000000000000 0 000008A5 000000000000000000 0 000008AE 000000000000000000 0 000008B7 000000000000000000 0 000008C0 000000000000000000 0 000008C9 000000000000000000 0 000008D2 000000000000000000 0 000008DB 000000000000000000 0 000008E4 000000000000000000 0 000008ED 000000000000000000 0 000008F6 000000000000000000 0 000008FF 000000000000000000 0 00000908 000000000000000000 0 00000911 000000000000000000 0 0000091A 000000000000000000 0 00000923 000000000000000000 0 0000092C 000000000000000000 0 00000935 000000000000000000 0 0000093E 000000000000000000 0 00000947 000000000000000000 0 00000950 000000000000000000 0 00000959 000000000000000000 0 00000962 000000000000000000 0 0000096B 000000000000000000 0 00000974 000000000000000000 0 0000097D 000000000000000000 0 00000986 000000000000000000 0 0000098F 000000000000000000 0 00000998 000000000000000000 0 000009A1 000000000000000000 0 000009AA 000000000000000000 0 000009B3 000000000000000000 0 000009BC 000000000000000000 0 000009C5 000000000000000000 0 000009CE 000000000000000000 0 000009D7 000000000000000000 0 000009E0 000000000000000000 0 000009E9 000000000000000000 0 000009F2 000000000000000000 0 000009FB 000000000000000000 0 00000A04 000000000000000000 0 00000A0D 000000000000000000 0 00000A16 000000000000000000 0 00000A1F 000000000000000000 0 00000A28 000000000000000000 0 00000A31 000000000000000000 0 00000A3A 000000000000000000 0 00000A43 000000000000000000 0 00000A4C 000000000000000000 0 00000A55 000000000000000000 0 00000A5E 000000000000000000 0 00000A67 000000000000000000 0 00000A70 000000000000000000 0 00000A79 000000000000000000 0 00000A82 000000000000000000 0 00000A8B 000000000000000000 0 00000A94 000000000000000000 0 00000A9D 000000000000000000 0 00000AA6 000000000000000000 0 00000AAF 000000000000000000 0 00000AB8 000000000000000000 0 00000AC1 000000000000000000 0 00000ACA 000000000000000000 0 00000AD3 000000000000000000 0 00000ADC 000000000000000000 0 00000AE5 000000000000000000 0 00000AEE 000000000000000000 0 00000AF7 000000000000000000 0 00000B00 000000000000000000 0 00000B09 000000000000000000 0 00000B12 000000000000000000 0 00000B1B 000000000000000000 0 00000B24 000000000000000000 0 00000B2D 000000000000000000 0 00000B36 000000000000000000 0 00000B3F 000000000000000000 0 00000B48 000000000000000000 0 00000B51 000000000000000000 0 00000B5A 000000000000000000 0 00000B63 000000000000000000 0 00000B6C 000000000000000000 0 00000B75 000000000000000000 0 00000B7E 000000000000000000 0 00000B87 000000000000000000 0 00000B90 000000000000000000 0 00000B99 000000000000000000 0 00000BA2 000000000000000000 0 00000BAB 000000000000000000 0 00000BB4 000000000000000000 0 00000BBD 000000000000000000 0 00000BC6 000000000000000000 0 00000BCF 000000000000000000 0 00000BD8 000000000000000000 0 00000BE1 000000000000000000 0 00000BEA 000000000000000000 0 00000BF3 000000000000000000 0 00000BFC 000000000000000000 0 00000C05 000000000000000000 0 00000C0E 000000000000000000 0 00000C17 000000000000000000 0 00000C20 000000000000000000 0 00000C29 000000000000000000 0 00000C32 000000000000000000 0 00000C3B 000000000000000000 0 00000C44 000000000000000000 0 00000C4D 000000000000000000 0 00000C56 000000000000000000 0 00000C5F 000000000000000000 0 00000C68 000000000000000000 0 00000C71 000000000000000000 0 00000C7A 000000000000000000 0 00000C83 000000000000000000 0 00000C8C 000000000000000000 0 00000C95 000000000000000000 0 00000C9E 000000000000000000 0 00000CA7 000000000000000000 0 00000CB0 000000000000000000 0 00000CB9 000000000000000000 0 00000CC2 000000000000000000 0 00000CCB 000000000000000000 0 00000CD4 000000000000000000 0 00000CDD 000000000000000000 0 00000CE6 000000000000000000 0 00000CEF 000000000000000000 0 00000CF8 000000000000000000 0 00000D01 000000000000000000 0 00000D0A 000000000000000000 0 00000D13 000000000000000000 0 00000D1C 000000000000000000 0 00000D25 000000000000000000 0 00000D2E 000000000000000000 0 00000D37 000000000000000000 0 00000D40 000000000000000000 0 00000D49 000000000000000000 0 00000D52 000000000000000000 0 00000D5B 000000000000000000 0 00000D64 000000000000000000 0 00000D6D 000000000000000000 0 00000D76 000000000000000000 0 00000D7F 000000000000000000 0 00000D88 000000000000000000 0 00000D91 000000000000000000 0 00000D9A 000000000000000000 0 00000DA3 000000000000000000 0 00000DAC 000000000000000000 0 00000DB5 000000000000000000 0 00000DBE 000000000000000000 0 00000DC7 000000000000000000 0 00000DD0 000000000000000000 0 00000DD9 000000000000000000 0 00000DE2 000000000000000000 0 00000DEB 000000000000000000 0 00000DF4 000000000000000000 0 00000DFD 000000000000000000 0 00000E06 000000000000000000 0 00000E0F 000000000000000000 0 00000E18 000000000000000000 0 00000E21 000000000000000000 0 00000E2A 000000000000000000 0 00000E33 000000000000000000 0 00000E3C 000000000000000000 0 00000E45 000000000000000000 0 00000E4E 000000000000000000 0 00000E57 000000000000000000 0 00000E60 000000000000000000 0 00000E69 000000000000000000 0 00000E72 000000000000000000 0 00000E7B 000000000000000000 0 00000E84 000000000000000000 0 00000E8D 000000000000000000 0 00000E96 000000000000000000 0 00000E9F 000000000000000000 0 00000EA8 000000000000000000 0 00000EB1 000000000000000000 0 00000EBA 000000000000000000 0 00000EC3 000000000000000000 0 00000ECC 000000000000000000 0 00000ED5 000000000000000000 0 00000EDE 000000000000000000 0 00000EE7 000000000000000000 0 00000EF0 000000000000000000 0 00000EF9 000000000000000000 0 00000F02 000000000000000000 0 00000F0B 000000000000000000 0 00000F14 000000000000000000 0 00000F1D 000000000000000000 0 00000F26 000000000000000000 0 00000F2F 000000000000000000 0 00000F38 000000000000000000 0 00000F41 000000000000000000 0 00000F4A 000000000000000000 0 00000F53 000000000000000000 0 00000F5C 000000000000000000 0 00000F65 000000000000000000 0 00000F6E 000000000000000000 0 00000F77 000000000000000000 0 00000F80 000000000000000000 0 00000F89 000000000000000000 0 00000F92 000000000000000000 0 00000F9B 000000000000000000 0 00000FA4 000000000000000000 0 00000FAD 000000000000000000 0 00000FB6 000000000000000000 0 00000FBF 000000000000000000 0 00000FC8 000000000000000000 0 00000FD1 000000000000000000 0 00000FDA 000000000000000000 0 00000FE3 000000000000000000 0 00000FEC 000000000000000000 0 00000FF5 000000000000000000 0 00000FFE 000000000000000000 0 00001007 000000000000000000 0 00001010 000000000000000000 0 00001019 000000000000000000 0 00001022 000000000000000000 0 0000102B 000000000000000000 0 00001034 000000000000000000 0 0000103D 000000000000000000 0 00001046 000000000000000000 0 0000104F 000000000000000000 0 00001058 000000000000000000 0 00001061 000000000000000000 0 0000106A 000000000000000000 0 00001073 000000000000000000 0 0000107C 000000000000000000 0 00001085 000000000000000000 0 0000108E 000000000000000000 0 00001097 000000000000000000 0 000010A0 000000000000000000 0 000010A9 000000000000000000 0 000010B2 000000000000000000 0 000010BB 000000000000000000 0 000010C4 000000000000000000 0 000010CD 000000000000000000 0 000010D6 000000000000000000 0 000010DF 000000000000000000 0 000010E8 000000000000000000 0 000010F1 000000000000000000 0 000010FA 000000000000000000 0 00001103 000000000000000000 0 0000110C 000000000000000000 0 00001115 000000000000000000 0 0000111E 000000000000000000 0 00001127 000000000000000000 0 00001130 000000000000000000 0 00001139 000000000000000000 0 00001142 000000000000000000 0 0000114B 000000000000000000 0 00001154 000000000000000000 0 0000115D 000000000000000000 0 00001166 000000000000000000 0 0000116F 000000000000000000 0 00001178 000000000000000000 0 00001181 000000000000000000 0 0000118A 000000000000000000 0 00001193 000000000000000000 0 0000119C 000000000000000000 0 000011A5 000000000000000000 0 000011AE 000000000000000000 0 000011B7 000000000000000000 0 000011C0 000000000000000000 0 000011C9 000000000000000000 0 000011D2 000000000000000000 0 000011DB 000000000000000000 0 000011E4 000000000000000000 0 000011ED 000000000000000000 0 000011F6 000000000000000000 0 000011FF 000000000000000000 0 00001208 000000000000000000 0 00001211 000000000000000000 0 0000121A 000000000000000000 0 00001223 000000000000000000 0 0000122C 000000000000000000 0 00001235 000000000000000000 0 0000123E 000000000000000000 0 00001247 000000000000000000 0 00001250 000000000000000000 0 00001259 000000000000000000 0 00001262 000000000000000000 0 0000126B 000000000000000000 0 00001274 000000000000000000 0 0000127D 000000000000000000 0 00001286 000000000000000000 0 0000128F 000000000000000000 0 00001298 000000000000000000 0 000012A1 000000000000000000 0 000012AA 000000000000000000 0 000012B3 000000000000000000 0 000012BC 000000000000000000 0 000012C5 000000000000000000 0 000012CE 000000000000000000 0 000012D7 000000000000000000 0 000012E0 000000000000000000 0 000012E9 000000000000000000 0 000012F2 000000000000000000 0 000012FB 000000000000000000 0 00001304 000000000000000000 0 0000130D 000000000000000000 0 00001316 000000000000000000 0 0000131F 000000000000000000 0 00001328 000000000000000000 0 00001331 000000000000000000 0 0000133A 000000000000000000 0 00001343 000000000000000000 0 0000134C 000000000000000000 0 00001355 000000000000000000 0 0000135E 000000000000000000 0 00001367 000000000000000000 0 00001370 000000000000000000 0 00001379 000000000000000000 0 00001382 000000000000000000 0 0000138B 000000000000000000 0 00001394 000000000000000000 0 0000139D 000000000000000000 0 000013A6 000000000000000000 0 000013AF 000000000000000000 0 000013B8 000000000000000000 0 000013C1 000000000000000000 0 000013CA 000000000000000000 0 000013D3 000000000000000000 0 000013DC 000000000000000000 0 000013E5 000000000000000000 0 000013EE 000000000000000000 0 000013F7 000000000000000000 0 00001400 000000000000000000 0 00001409 000000000000000000 0 00001412 000000000000000000 0 0000141B 000000000000000000 0 00001424 000000000000000000 0 0000142D 000000000000000000 0 00001436 000000000000000000 0 0000143F 000000000000000000 0 00001448 000000000000000000 0 00001451 000000000000000000 0 0000145A 000000000000000000 0 00001463 000000000000000000 0 0000146C 000000000000000000 0 00001475 000000000000000000 0 0000147E 000000000000000000 0 00001487 000000000000000000 0 00001490 000000000000000000 0 00001499 000000000000000000 0 000014A2 000000000000000000 0 000014AB 000000000000000000 0 000014B4 000000000000000000 0 000014BD 000000000000000000 0 000014C6 000000000000000000 0 000014CF 000000000000000000 0 000014D8 000000000000000000 0 000014E1 000000000000000000 0 000014EA 000000000000000000 0 000014F3 000000000000000000 0 000014FC 000000000000000000 0 00001505 000000000000000000 0 0000150E 000000000000000000 0 00001517 000000000000000000 0 00001520 000000000000000000 0 00001529 000000000000000000 0 00001532 000000000000000000 0 0000153B 000000000000000000 0 00001544 000000000000000000 0 0000154D 000000000000000000 0 00001556 000000000000000000 0 0000155F 000000000000000000 0 00001568 000000000000000000 0 00001571 000000000000000000 0 0000157A 000000000000000000 0 00001583 000000000000000000 0 0000158C 000000000000000000 0 00001595 000000000000000000 0 0000159E 000000000000000000 0 000015A7 000000000000000000 0 000015B0 000000000000000000 0 000015B9 000000000000000000 0 000015C2 000000000000000000 0 000015CB 000000000000000000 0 000015D4 000000000000000000 0 000015DD 000000000000000000 0 000015E6 000000000000000000 0 000015EF 000000000000000000 0 000015F8 000000000000000000 0 00001601 000000000000000000 0 0000160A 000000000000000000 0 00001613 000000000000000000 0 0000161C 000000000000000000 0 00001625 000000000000000000 0 0000162E 000000000000000000 0 00001637 000000000000000000 0 00001640 000000000000000000 0 00001649 000000000000000000 0 00001652 000000000000000000 0 0000165B 000000000000000000 0 00001664 000000000000000000 0 0000166D 000000000000000000 0 00001676 000000000000000000 0 0000167F 000000000000000000 0 00001688 000000000000000000 0 00001691 000000000000000000 0 0000169A 000000000000000000 0 000016A3 000000000000000000 0 000016AC 000000000000000000 0 000016B5 000000000000000000 0 000016BE 000000000000000000 0 000016C7 000000000000000000 0 000016D0 000000000000000000 0 000016D9 000000000000000000 0 000016E2 000000000000000000 0 000016EB 000000000000000000 0 000016F4 000000000000000000 0 000016FD 000000000000000000 0 00001706 000000000000000000 0 0000170F 000000000000000000 0 00001718 000000000000000000 0 00001721 000000000000000000 0 0000172A 000000000000000000 0 00001733 000000000000000000 0 0000173C 000000000000000000 0 00001745 000000000000000000 0 0000174E 000000000000000000 0 00001757 000000000000000000 0 00001760 000000000000000000 0 00001769 000000000000000000 0 00001772 000000000000000000 0 0000177B 000000000000000000 0 00001784 000000000000000000 0 0000178D 000000000000000000 0 00001796 000000000000000000 0 0000179F 000000000000000000 0 000017A8 000000000000000000 0 000017B1 000000000000000000 0 000017BA 000000000000000000 0 000017C3 000000000000000000 0 000017CC 000000000000000000 0 000017D5 000000000000000000 0 000017DE 000000000000000000 0 000017E7 000000000000000000 0 000017F0 000000000000000000 0 000017F9 000000000000000000 0 00001802 000000000000000000 0 0000180B 000000000000000000 0 00001814 000000000000000000 0 0000181D 000000000000000000 0 00001826 000000000000000000 0 0000182F 000000000000000000 0 00001838 000000000000000000 0 00001841 000000000000000000 0 0000184A 000000000000000000 0 00001853 000000000000000000 0 0000185C 000000000000000000 0 00001865 000000000000000000 0 0000186E 000000000000000000 0 00001877 000000000000000000 0 00001880 000000000000000000 0 00001889 000000000000000000 0 00001892 000000000000000000 0 0000189B 000000000000000000 0 000018A4 000000000000000000 0 000018AD 000000000000000000 0 000018B6 000000000000000000 0 000018BF 000000000000000000 0 000018C8 000000000000000000 0 000018D1 000000000000000000 0 000018DA 000000000000000000 0 000018E3 000000000000000000 0 000018EC 000000000000000000 0 000018F5 000000000000000000 0 000018FE 000000000000000000 0 00001907 000000000000000000 0 00001910 000000000000000000 0 00001919 000000000000000000 0 00001922 000000000000000000 0 0000192B 000000000000000000 0 00001934 000000000000000000 0 0000193D 000000000000000000 0 00001946 000000000000000000 0 0000194F 000000000000000000 0 00001958 000000000000000000 0 00001961 000000000000000000 0 0000196A 000000000000000000 0 00001973 000000000000000000 0 0000197C 000000000000000000 0 00001985 000000000000000000 0 0000198E 000000000000000000 0 00001997 000000000000000000 0 000019A0 000000000000000000 0 000019A9 000000000000000000 0 000019B2 000000000000000000 0 000019BB 000000000000000000 0 000019C4 000000000000000000 0 000019CD 000000000000000000 0 000019D6 000000000000000000 0 000019DF 000000000000000000 0 000019E8 000000000000000000 0 000019F1 000000000000000000 0 000019FA 000000000000000000 0 00001A03 000000000000000000 0 00001A0C 000000000000000000 0 00001A15 000000000000000000 0 00001A1E 000000000000000000 0 00001A27 000000000000000000 0 00001A30 000000000000000000 0 00001A39 000000000000000000 0 00001A42 000000000000000000 0 00001A4B 000000000000000000 0 00001A54 000000000000000000 0 00001A5D 000000000000000000 0 00001A66 000000000000000000 0 00001A6F 000000000000000000 0 00001A78 000000000000000000 0 00001A81 000000000000000000 0 00001A8A 000000000000000000 0 00001A93 000000000000000000 0 00001A9C 000000000000000000 0 00001AA5 000000000000000000 0 00001AAE 000000000000000000 0 00001AB7 000000000000000000 0 00001AC0 000000000000000000 0 00001AC9 000000000000000000 0 00001AD2 000000000000000000 0 00001ADB 000000000000000000 0 00001AE4 000000000000000000 0 00001AED 000000000000000000 0 00001AF6 000000000000000000 0 00001AFF 000000000000000000 0 00001B08 000000000000000000 0 00001B11 000000000000000000 0 00001B1A 000000000000000000 0 00001B23 000000000000000000 0 00001B2C 000000000000000000 0 00001B35 000000000000000000 0 00001B3E 000000000000000000 0 00001B47 000000000000000000 0 00001B50 000000000000000000 0 00001B59 000000000000000000 0 00001B62 000000000000000000 0 00001B6B 000000000000000000 0 00001B74 000000000000000000 0 00001B7D 000000000000000000 0 00001B86 000000000000000000 0 00001B8F 000000000000000000 0 00001B98 000000000000000000 0 00001BA1 000000000000000000 0 00001BAA 000000000000000000 0 00001BB3 000000000000000000 0 00001BBC 000000000000000000 0 00001BC5 000000000000000000 0 00001BCE 000000000000000000 0 00001BD7 000000000000000000 0 00001BE0 000000000000000000 0 00001BE9 000000000000000000 0 00001BF2 000000000000000000 0 00001BFB 000000000000000000 0 00001C04 000000000000000000 0 00001C0D 000000000000000000 0 00001C16 000000000000000000 0 00001C1F 000000000000000000 0 00001C28 000000000000000000 0 00001C31 000000000000000000 0 00001C3A 000000000000000000 0 00001C43 000000000000000000 0 00001C4C 000000000000000000 0 00001C55 000000000000000000 0 00001C5E 000000000000000000 0 00001C67 000000000000000000 0 00001C70 000000000000000000 0 00001C79 000000000000000000 0 00001C82 000000000000000000 0 00001C8B 000000000000000000 0 00001C94 000000000000000000 0 00001C9D 000000000000000000 0 00001CA6 000000000000000000 0 00001CAF 000000000000000000 0 00001CB8 000000000000000000 0 00001CC1 000000000000000000 0 00001CCA 000000000000000000 0 00001CD3 000000000000000000 0 00001CDC 000000000000000000 0 00001CE5 000000000000000000 0 00001CEE 000000000000000000 0 00001CF7 000000000000000000 0 00001D00 000000000000000000 0 00001D09 000000000000000000 0 00001D12 000000000000000000 0 00001D1B 000000000000000000 0 00001D24 000000000000000000 0 00001D2D 000000000000000000 0 00001D36 000000000000000000 0 00001D3F 000000000000000000 0 00001D48 000000000000000000 0 00001D51 000000000000000000 0 00001D5A 000000000000000000 0 00001D63 000000000000000000 0 00001D6C 000000000000000000 0 00001D75 000000000000000000 0 00001D7E 000000000000000000 0 00001D87 000000000000000000 0 00001D90 000000000000000000 0 00001D99 000000000000000000 0 00001DA2 000000000000000000 0 00001DAB 000000000000000000 0 00001DB4 000000000000000000 0 00001DBD 000000000000000000 0 00001DC6 000000000000000000 0 00001DCF 000000000000000000 0 00001DD8 000000000000000000 0 00001DE1 000000000000000000 0 00001DEA 000000000000000000 0 00001DF3 000000000000000000 0 00001DFC 000000000000000000 0 00001E05 000000000000000000 0 00001E0E 000000000000000000 0 00001E17 000000000000000000 0 00001E20 000000000000000000 0 00001E29 000000000000000000 0 00001E32 000000000000000000 0 00001E3B 000000000000000000 0 00001E44 000000000000000000 0 00001E4D 000000000000000000 0 00001E56 000000000000000000 0 00001E5F 000000000000000000 0 00001E68 000000000000000000 0 00001E71 000000000000000000 0 00001E7A 000000000000000000 0 00001E83 000000000000000000 0 00001E8C 000000000000000000 0 00001E95 000000000000000000 0 00001E9E 000000000000000000 0 00001EA7 000000000000000000 0 00001EB0 000000000000000000 0 00001EB9 000000000000000000 0 00001EC2 000000000000000000 0 00001ECB 000000000000000000 0 00001ED4 000000000000000000 0 00001EDD 000000000000000000 0 00001EE6 000000000000000000 0 00001EEF 000000000000000000 0 00001EF8 000000000000000000 0 00001F01 000000000000000000 0 00001F0A 000000000000000000 0 00001F13 000000000000000000 0 00001F1C 000000000000000000 0 00001F25 000000000000000000 0 00001F2E 000000000000000000 0 00001F37 000000000000000000 0 00001F40 000000000000000000 0 00001F49 000000000000000000 0 00001F52 000000000000000000 0 00001F5B 000000000000000000 0 00001F64 000000000000000000 0 00001F6D 000000000000000000 0 00001F76 000000000000000000 0 00001F7F 000000000000000000 0 00001F88 000000000000000000 0 00001F91 000000000000000000 0 00001F9A 000000000000000000 0 00001FA3 000000000000000000 0 00001FAC 000000000000000000 0 00001FB5 000000000000000000 0 00001FBE 000000000000000000 0 00001FC7 000000000000000000 0 00001FD0 000000000000000000 0 00001FD9 000000000000000000 0 00001FE2 000000000000000000 0 00001FEB 000000000000000000 0 00001FF4 000000000000000000 0 00001FFD 000000000000000000 0 00002006 000000000000000000 0 0000200F 000000000000000000 0 00002018 000000000000000000 0 00002021 000000000000000000 0 0000202A 000000000000000000 0 00002033 000000000000000000 0 0000203C 000000000000000000 0 00002045 000000000000000000 0 0000204E 000000000000000000 0 00002057 000000000000000000 0 00002060 000000000000000000 0 00002069 000000000000000000 0 00002072 000000000000000000 0 0000207B 0000000000 1699 %endif === Switch to base=000000h -> "RESUMECODE" 1700 RCODE_ALIGN ends 1701 === Switch to base=000000h -> "RCODE" 1702 section RCODE public align=2 class=RCODE 1702 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 1703 0 00002080 0000 rcode_header dw 0 1705 1706 Public DataSegment 1707 0 00002082 7000 DataSegment dw BIO_SEG ; segment address of low data/code 1709 1710 ; Called to vector to appropriate sub-function in device driver 1711 ; The Function table address immediately follows the near call, so we can index 1712 ; into it using the return address. If the offset is in the range 0-6 it's 1713 ; actually a device number for the serial/parallel driver 1714 ; 1715 ; 1716 ; On Entry to subfunctions ES:BX -> req_hdr, DX = devno (serial/parallel) 1717 ; 1718 1719 FunctionTable struc 0 00002080 ?? Max db ? 0 00002081 ???? Entry dw ? 1722 FunctionTable ends 1722 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 1723 1724 Public DriverFunction 1725 1726 DriverFunction proc far 0 00002084 FC cld 0 00002085 83EC16 sub sp,(P_STRUC_size)-4 ; make space for stack variables 0 00002088 55 push bp ; (BP and RET are included) 0 00002089 89E5 mov bp,sp ; set up stack frame 0 0000208B 1E06 pushx 0 0000208D 505351525657 pushx ; save all registers 0 00002093 2E8E1E[0200] mov ds,[cs:DataSegment] 0 00002098 8B7618 mov si,[bp+(P_STRUC_size)-2] ; get return address = command table 0 0000209B AD lodsw ; AX = following word 0 0000209C 92 xchg ax,dx ; DX = device number (0-6) 0 0000209D BE[0000] mov si,offset SerParCommonTable 0 000020A0 83FA06 cmp dx,6 ; if not a device number it's a table 0 000020A3 7602 jbe DriverFunction10 0 000020A5 89D6 mov si,dx ; DS:SI -> table 1741 DriverFunction10: 0 000020A7 C41E[B800] les bx,[req_ptr] ; ES:BX -> request header 1743 P_STRUC.REQUEST_OFF equ REQUEST_OFF ; NASM port label 0 000020AB 895E02 mov [P_STRUC.REQUEST_OFF + bp],bx 1745 P_STRUC.REQUEST_SEG equ REQUEST_SEG ; NASM port label 0 000020AE 8C4604 mov [P_STRUC.REQUEST_SEG + bp],es 0 000020B1 268A4702 mov al,[es:RH_CMD + bx] ; check if legal command 1748 FunctionTable.Max equ Max ; NASM port label 0 000020B5 2E3A04 cmp al,[cs:FunctionTable.Max + si] 0 000020B8 7720 ja cmderr ; skip if out of range 0 000020BA 98 cbw ; convert to word 0 000020BB 01C0 add ax,ax ; make it a word offset 0 000020BD 01C6 add si,ax ; add index to function table 1754 FunctionTable.Entry equ Entry ; NASM port label 0 000020BF 2EFF5401 call [cs:FunctionTable.Entry + si] 1756 P_DSTRUC.REQUEST equ REQUEST ; NASM port label 0 000020C3 C45E02 les bx,[P_DSTRUC.REQUEST + bp] 1758 cmddone: 0 000020C6 0D0001 or ax,RHS_DONE ; indicate request is "done" 0 000020C9 26894703 mov [es:RH_STATUS + bx],ax ; update the status for BDOS 0 000020CD 5F5E5A595B58 popx ; restore all registers 0 000020D3 071F popx 0 000020D5 5D pop bp 0 000020D6 83C418 add sp,(P_STRUC_size)-2 ; discard stack variables 0 000020D9 CB ret 1766 1767 cmderr: 0 000020DA B80380 mov ax,RHS_ERROR+3 ; "invalid command" error 0 000020DD EBE7 jmps cmddone ; return the error 1770 1771 DriverFunction endp 1772 1773 1774 1775 OutputBS proc far 1776 ;------- 1777 ; pushx ; these are on the stack 0 000020DF 5152 pushx 0 000020E1 B403 mov ah,3 ; get cursor address 0 000020E3 B700 mov bh,0 ; on page zero 0 000020E5 CD10 int VIDEO_INT ; BH = page, DH/DL = cursor row/col 0 000020E7 85D2 test dx,dx ; row 0, col 0 0 000020E9 7417 jz OutputBS10 ; ignore if first line 0 000020EB FECA dec dl ; are we in column 0? 0 000020ED 7913 jns OutputBS10 ; no, normal BS 0 000020EF FECE dec dh ; else move up one line 0 000020F1 1E push ds 0 000020F2 31C0 xor ax,ax 0 000020F4 8ED8 mov ds,ax 0 000020F6 8A164A04 mov dl,byte ptr [44ah] ; DL = # of columns 0 000020FA 4A dec dx ; DL = last column 0 000020FB 1F pop ds 0 000020FC B402 mov ah,2 ; set cursor, DH/DL = cursor, BH = page 0 000020FE CD10 int VIDEO_INT ; set cursor address 0 00002100 EB08 jmps OutputBS20 1796 1797 OutputBS10: 0 00002102 B8080E mov ax,0E08h ; use ROS TTY-like output function 0 00002105 BB0700 mov bx,7 ; use the normal attribute 0 00002108 CD10 int VIDEO_INT ; output the character in AL 1801 OutputBS20: 0 0000210A 5A59 popx 0 0000210C 5D5F5E5B58 popx 0 00002111 CF iret 1805 1806 OutputBS endp 1807 1808 1809 extern div_by_zero_length 1810 1811 i0_disp_ax_hex: 0 00002112 86C4 xchg al, ah 0 00002114 E80200 call i0_disp_al_hex 0 00002117 86C4 xchg al, ah 1815 1816 i0_disp_al_hex: 0 00002119 B104 mov cl, 4 0 0000211B D2C8 ror al, cl 0 0000211D E80200 call i0_disp_al_nybble_hex 0 00002120 D2C8 ror al, cl 1821 i0_disp_al_nybble_hex: 0 00002122 50 push ax 0 00002123 240F and al, 15 0 00002125 0430 add al, '0' 0 00002127 3C39 cmp al, '9' 0 00002129 7602 jbe .dec 0 0000212B 0407 add al, 'A' - ('9' + 1) 1828 .dec: 0 0000212D E80700 call i0_disp_al 0 00002130 58 pop ax 0 00002131 C3 retn 1832 1833 i0_disp_ax: 0 00002132 E80200 call i0_disp_al 0 00002135 86C4 xchg al, ah 1836 1837 ; INP: bx = STDERR 1838 ; al = text byte 1839 ; CHG: dx 1840 i0_disp_al: 0 00002137 51 push cx 0 00002138 1E push ds 0 00002139 50 push ax 0 0000213A 16 push ss 0 0000213B 1F pop ds 0 0000213C B90100 mov cx, 1 0 0000213F 89E2 mov dx, sp 0 00002141 B440 mov ah, MS_X_WRITE 0 00002143 CD21 int DOS_INT 0 00002145 58 pop ax 0 00002146 1F pop ds 0 00002147 59 pop cx 0 00002148 C3 retn 1854 1855 1856 Int0Handler proc far 1857 ;---------- 0 00002149 FC cld 0 0000214A 89E5 mov bp, sp 0 0000214C 50 push ax 0 0000214D 53 push bx 0 0000214E 51 push cx 0 0000214F 52 push dx 0 00002150 0E push cs 0 00002151 1F pop ds 0 00002152 BA[0000] mov dx,offset div_by_zero_msg ; DS:SI points at ASCIZ message 0 00002155 BB0200 mov bx,STDERR ; to STDERR - where else ? 0 00002158 B9[0000] mov cx, div_by_zero_length ; write one at a time 0 0000215B B440 mov ah,MS_X_WRITE ; write out the error 0 0000215D CD21 int DOS_INT 1871 0 0000215F 8B4602 mov ax, [bp + 2] 0 00002162 E8ADFF call i0_disp_ax_hex 0 00002165 B03A mov al, ':' 0 00002167 E8CDFF call i0_disp_al 1876 0 0000216A 8B4600 mov ax, [bp] 0 0000216D E8A2FF call i0_disp_ax_hex 0 00002170 B82D3E mov ax, "->" 0 00002173 E8BCFF call i0_disp_ax 1881 0 00002176 C57600 lds si, [bp] 0 00002179 BF1000 mov di, 16 1884 .loop: 0 0000217C B020 mov al, ' ' 0 0000217E E8B6FF call i0_disp_al 0 00002181 AC lodsb 0 00002182 E894FF call i0_disp_al_hex 0 00002185 4F dec di 0 00002186 75F4 jnz .loop 1891 0 00002188 B80D0A mov ax, 13 | (10 << 8) 0 0000218B E8A4FF call i0_disp_ax 1894 0 0000218E BE[3A01] mov si, i0_table 1896 .loop_table: 0 00002191 B020 mov al, ' ' 0 00002193 E8A1FF call i0_disp_al 0 00002196 2EAD cs lodsw 0 00002198 E897FF call i0_disp_ax 0 0000219B B03D mov al, '=' 0 0000219D E897FF call i0_disp_al 0 000021A0 2EAC cs lodsb 0 000021A2 98 cbw 0 000021A3 97 xchg di, ax 0 000021A4 8B03 mov ax, [bp + di] 0 000021A6 E869FF call i0_disp_ax_hex 0 000021A9 81FE[4601] cmp si, i0_table.end 0 000021AD 72E2 jb .loop_table 1910 0 000021AF B80D0A mov ax, 13 | (10 << 8) 0 000021B2 E87DFF call i0_disp_ax 1913 0 000021B5 B8014C mov ax,MS_X_EXIT*256+1 ; time to leave - say we got an error 0 000021B8 CD21 int DOS_INT ; go for it! 1916 1917 Int0Handler endp 1918 1919 i0_table: 0 000021BA 4158FE db "AX", -2 0 000021BD 4258FC db "BX", -4 0 000021C0 4358FA db "CX", -6 0 000021C3 4458F8 db "DX", -8 1924 .end: 1925 === Switch to base=000000h -> "RESUMECODE" 1926 RCODE ends 1927 1928 end init === Trace listing source: drbio/bin/clock.lst 1 ; File : $CLOCK.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; CLOCK.ASM 1.12 93/07/22 19:43:10 33 ; switch over to REQUEST.EQU 34 ; ENDLOG 35 36 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 37 %include "drmacros.mac" ; standard DR macros 1 <1> ; File : $DRMACROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 09-Nov-88 made RETF conditional for MASM 5.1/TASM 1.0 35 <1> 36 <1> FALSE equ 0 37 <1> TRUE equ (~ FALSE) 38 <1> 39 <1> 40 <1> %macro jmps 1.nolist 41 <1> jmp short %1 42 <1> %endmacro 43 <1> 44 <1> %macro stripangles 2.nolist 45 <1> %defstr %%param %2 46 <1> %substr %%opening %%param 1 47 <1> %ifidn %%opening, '<' 48 <1> %substr %%param %%param 2,-1 49 <1> %endif 50 <1> %strlen %%length %%param 51 <1> %substr %%closing %%param %%length 52 <1> %ifidn %%closing, '>' 53 <1> %substr %%param %%param 1,-2 54 <1> %endif 55 <1> %deftok %%token %%param 56 <1> %1 %%token 57 <1> %endmacro 58 <1> 59 <1> %macro pushx 0-*.nolist 60 <1> %rep %0 61 <1> stripangles push, %1 62 <1> %rotate 1 63 <1> %endrep 64 <1> %endmacro 65 <1> 66 <1> %macro popx 0-*.nolist 67 <1> %rep %0 68 <1> stripangles pop, %1 69 <1> %rotate 1 70 <1> %endrep 71 <1> %endmacro 72 <1> 73 <1> %macro incx 0-*.nolist 74 <1> %rep %0 75 <1> stripangles inc, %1 76 <1> %rotate 1 77 <1> %endrep 78 <1> %endmacro 79 <1> 80 <1> %macro decx 0-*.nolist 81 <1> %rep %0 82 <1> stripangles dec, %1 83 <1> %rotate 1 84 <1> %endrep 85 <1> %endmacro 86 <1> 87 <1> %macro rb 1.nolist 88 <1> db %1 dup (?) 89 <1> %endmacro 90 <1> 91 <1> %macro rw 1.nolist 92 <1> dw %1 dup (?) 93 <1> %endmacro 94 <1> 95 <1> %macro rd 1.nolist 96 <1> dd %1 dup (?) 97 <1> %endmacro 38 %include "ibmros.mac" ; ROM BIOS equates 1 <1> ; File : $IBMROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> VIDEO_INT equ 10h 36 <1> EQUIPMENT_INT equ 11h 37 <1> MEMORY_INT equ 12h 38 <1> DISK_INT equ 13h 39 <1> ASYNC_INT equ 14h 40 <1> SYSTEM_INT equ 15h 41 <1> KEYBOARD_INT equ 16h 42 <1> PRINTER_INT equ 17h 43 <1> RTC_INT equ 1Ah 44 <1> CTRLBRK_INT equ 1Bh 45 <1> 46 <1> ; Int 10 subfunctions 47 <1> 48 <1> SET_CURSOR_TYPE equ 01h 49 <1> WRITE_CURSOR equ 02h ; Set cursor position 50 <1> READ_CURSOR equ 03h ; Read cursor position 51 <1> SCROLL_UP equ 06h ; Scroll active page up 52 <1> SCROLL_DOWN equ 07h ; Scroll active page down 53 <1> READ_CHAR equ 08h ; Read attribute/char at cur position 54 <1> WRITE_CHAR equ 09h ; Write attribute/char at cur position 55 <1> WRITE_TTY equ 0eh ; Write teletype at current position 56 <1> GET_STATE equ 0fh ; Return current video mode 57 <1> 58 <1> ; Int 13 subfunctions 59 <1> 60 <1> ROS_RESET equ 00h ; reset disk system 61 <1> ROS_READ equ 02h ; read from disk 62 <1> ROS_WRITE equ 03h ; write to disk 63 <1> ROS_VERIFY equ 04h ; verify data on disk 64 <1> ROS_FORMAT equ 05h ; format track on disk 65 <1> ROS_PARAM equ 08h ; get drive parameters 66 <1> ROS_GETTYPE equ 15h ; get drive type 67 <1> ROS_DSKCHG equ 16h ; check disk change status 68 <1> ROS_SETTYPE equ 17h ; set disk type for format 69 <1> ROS_SETMEDIA equ 18h ; set media type for format 70 <1> ROS_LBACHK equ 41h ; int 13 extensions install check 71 <1> ROS_LBAREAD equ 42h ; extended read 72 <1> ROS_LBAWRITE equ 43h ; extended write 73 <1> ROS_LBAVERIFY equ 44h ; extended verify 74 <1> ROS_LBAPARAM equ 48h ; get extended drive parameters 75 <1> 76 <1> PRN_ERROR equ 00101001b ; printer error bits 77 <1> PRN_NOTBUSY equ 10000000b 78 <1> PRN_ACK equ 01000000b 79 <1> PRN_PAPER equ 00100000b 80 <1> PRN_SELECT equ 00010000b 81 <1> PRN_IOERR equ 00001000b 82 <1> PRN_TIMEOUT equ 00000001b 83 <1> 84 <1> AUX_ERROR equ 10000000b ; auxiliary error bits 85 <1> 86 <1> ; Int 15 subfunctions 87 <1> 88 <1> EXT_MEMORY equ 88h ; Return extended memory size in KB 39 %include "request.mac" ; request header equates 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 39 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 57 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 40 %include "driver.mac" ; device driver equates 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 41 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 41 42 ;page 43 group CGROUP CODE RCODE RESUMECODE ICODE 44 45 TIME struc 0 00000000 ???? DAYS dw ? 0 00000002 ?? MINUTES db ? 0 00000003 ?? HOURS db ? 0 00000004 ?? HUNDREDTHS db ? 0 00000005 ?? SECONDS db ? 51 TIME ends 51 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 52 53 Assume CS:CGROUP, DS:CGROUP, ES:Nothing, SS:Nothing 54 === Switch to base=000000h -> "CODE" 55 section CODE class=CODE 55 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 56 57 extrn endbios:word ; for device driver INIT function 58 extrn daycount:word 59 60 ; There are 1193180/65536 ticks per second, or 0E90Bh/10000h ticks per 5/100th. 61 62 CONVERSION_FACTOR equ 0E90Bh 63 64 CODE ends 65 === Switch to base=000000h -> "RCODE" 66 section RCODE class=RCODE 66 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 67 68 extrn DataSegment:word 69 0 000021C6 1F1C1F1E1F1E1F1F1E monlen db 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 0 000021CF 1F1E1F 71 72 73 Public ClockTable 74 75 ClockTable: 0 000021D2 09 db 9 ; Last supported function 0 000021D3 [0000] dw dd_init ; 0-initialize driver 0 000021D5 [2100] dw dd_error ; 1-media change check (disks only) 0 000021D7 [2100] dw dd_error ; 2-build BPB (disks only) 0 000021D9 [2100] dw dd_error ; 3-IOCTL string input 0 000021DB [2500] dw dd_input ; 4-input 0 000021DD [2100] dw dd_error ; 5-nondestructive input (char only) 0 000021DF [2100] dw dd_error ; 6-input status (char only) 0 000021E1 [2100] dw dd_error ; 7-input flush 0 000021E3 [6200] dw dd_output ; 8-output 0 000021E5 [6200] dw dd_output ; 9-output with verify 87 88 ;page 89 90 dd_error: ; used for all unsupported driver functions 91 ;-------- 0 000021E7 B80380 mov ax,RHS_ERROR+3 ; "invalid command" error 0 000021EA C3 ret 94 95 dd_input: ; 4-input 96 ;-------- 0 000021EB 26C47F0E les di,[es:RH4_BUFFER + bx] ; ES:DI -> requested date/time buffer 0 000021EF E8E400 call read_system_ticks ; read system tick counter 0 000021F2 A1[0000] mov ax,[daycount] ; AX = date 0 000021F5 AB stosw ; return date 0 000021F6 52 push dx ; save low word of ticks 0 000021F7 B80500 mov ax,5 0 000021FA F7E1 mul cx ; multiply high word of ticks by 5 0 000021FC 91 xchg ax,cx ; save result in CX 0 000021FD 5A pop dx 0 000021FE B80500 mov ax,5 0 00002201 F7E2 mul dx ; multiply low word of tick by 5 0 00002203 01CA add dx,cx ; and add in high word 0 00002205 BB0BE9 mov bx,CONVERSION_FACTOR 0 00002208 F7F3 div bx ; convert to centi-secs 0 0000220A 50 push ax ; save high word of result 0 0000220B 31C0 xor ax,ax 0 0000220D F7F3 div bx ; divide remainder 0 0000220F 5A pop dx ; recover high word of result 115 ; giving us time in centi-secs 0 00002210 BB7017 mov bx,60*100 ; BX = centi-secs/minute 0 00002213 F7F3 div bx ; AX = # minutes 0 00002215 52 push dx ; save centi-secs remainder 0 00002216 99 cwd ; DX = 0 0 00002217 BB3C64 mov bx,60+(256*100) ; BL = minutes/hour,BH = centi-secs/sec 0 0000221A F6F3 div bl ; AL = hours, AH = minutes remainder 0 0000221C 86C4 xchg al,ah 0 0000221E AB stosw ; return minutes then hours 0 0000221F 58 pop ax ; recover centi-secs remainder 0 00002220 F6F7 div bh ; AL = secs, AH = centi-secs remainder 0 00002222 86C4 xchg al,ah 0 00002224 AB stosw ; return centi-secs then secs 0 00002225 29C0 sub ax,ax 0 00002227 C3 ret 130 131 ; page 132 133 dd_output: ; 8-output 134 ;--------- 0 00002228 26C4770E les si,[es:RH4_BUFFER + bx] 136 137 ; First we'll convert the date & set the RTC if present: 138 139 TIME.DAYS equ DAYS ; NASM port label 0 0000222C 268B04 mov ax,[es:TIME.DAYS + si] ; # of days since 1/1/1980 0 0000222F A3[0000] mov [daycount],ax 142 0 00002232 BABC07 mov dx,1980 ; get initial year 144 output1: 0 00002235 B96D01 mov cx,365 ; assumed year size 0 00002238 F6C203 test dl,3 ; test for leap years 0 0000223B 7501 jnz output2 ; skip if not a leap year 0 0000223D 41 inc cx ; leap years have 366 days 149 output2: 0 0000223E 39C8 cmp ax,cx ; more days than this year? 0 00002240 7205 jb output3 ; skip if less - same year 0 00002242 29C8 sub ax,cx ; else date in future year 0 00002244 42 inc dx ; subtract from total, next year 0 00002245 EBEE jmps output1 ; check again 155 156 output3: ; DX = binary year, AX = day in year 0 00002247 29DB sub bx,bx ; start with January 0 00002249 29C9 sub cx,cx ; CH = 0 159 output4: 0 0000224B 2E8A8F[0000] mov cl,[cs:monlen + bx] ; CX = # of days in next month 0 00002250 80F91C cmp cl,28 ; is it february ? 0 00002253 7506 jne output5 0 00002255 F6C203 test dl,3 ; is it a leap year ? 0 00002258 7501 jnz output5 0 0000225A 41 inc cx ; leap years have 29 days in february 166 output5: 0 0000225B 39C8 cmp ax,cx ; remaining day count >= month length? 0 0000225D 7205 jb output6 ; skip if right month found 0 0000225F 29C8 sub ax,cx ; else subtract days in that month 0 00002261 43 inc bx ; move on to next month 0 00002262 EBE7 jmps output4 ; repeat until month found 172 173 output6: ; DX = binary year 0 00002264 40 inc ax ; AX = day-1 => convert to day 0 00002265 43 inc bx ; BX = month-1 => convert to month 0 00002266 88DC mov ah,bl ; high byte is month 0 00002268 E87800 call bin2bcd ; convert to month 178 0 0000226B 92 xchg ax,dx ; DL, DH = day, month of date 180 ; AX = binary year 181 0 0000226C B364 mov bl,100 0 0000226E F6F3 div bl ; AL = century, AH = year 0 00002270 86C4 xchg al,ah ; AH = century, AL = year 0 00002272 E86E00 call bin2bcd ; convert AL, AH from binary to BCD 0 00002275 91 xchg ax,cx ; CL, CH = year, century for date 187 0 00002276 B405 mov ah,5 ; set real time clock date 0 00002278 CD1A int RTC_INT ; on AT, XT-286, PS/2, etc. 190 191 ; Now we'll convert the time & set the RTC if present 192 193 ; mov ah,es:TIME.HOURS[si] 194 ; mov al,es:TIME.MINUTES[si] ; get binary hours & minutes 195 TIME.MINUTES equ MINUTES ; NASM port label 0 0000227A 268B4402 mov ax,word ptr [es:TIME.MINUTES + si] 0 0000227E E86200 call bin2bcd ; convert to BCD values 0 00002281 91 xchg ax,cx ; CH, CL = hh:mm in BCD 199 TIME.SECONDS equ SECONDS ; NASM port label 0 00002282 268A6405 mov ah,[es:TIME.SECONDS + si] 0 00002286 B000 mov al,0 ; get binary seconds & no daylight saving 0 00002288 E85800 call bin2bcd ; convert to BCD values 0 0000228B 92 xchg ax,dx ; DH, DL = ss.000 in BCD 204 0 0000228C B403 mov ah,3 ; set real time clock time 0 0000228E CD1A int RTC_INT ; on AT, XT-286, PS/2, etc. 207 0 00002290 B064 mov al,100 0 00002292 26F66405 mul byte [es:TIME.SECONDS + si] ; AX = seconds in hundredths 0 00002296 92 xchg ax,dx ; save in DX 211 TIME.HUNDREDTHS equ HUNDREDTHS ; NASM port label 0 00002297 268A4404 mov al,[es:TIME.HUNDREDTHS + si] 0 0000229B 98 cbw ; AX = hundredths 0 0000229C 01D0 add ax,dx ; AX = secs and hundredths in 1/100ths 0 0000229E 99 cwd ; make the a dword 0 0000229F BB0500 mov bx,5 0 000022A2 F7F3 div bx ; AX = secs and hundredths in 5/100ths 0 000022A4 93 xchg ax,bx ; save in BX 0 000022A5 B03C mov al,60 ; convert hours into minutes 220 TIME.HOURS equ HOURS ; NASM port label 0 000022A7 26F66403 mul byte [es:TIME.HOURS + si] ; AX = hours in mins 0 000022AB 92 xchg ax,dx 0 000022AC 268A4402 mov al,[es:TIME.MINUTES + si] 0 000022B0 98 cbw ; AX = minutes value 0 000022B1 01D0 add ax,dx ; AX = hours and mins in mins 0 000022B3 BAB004 mov dx,60*20 0 000022B6 F7E2 mul dx ; DX:AX = hours and mins in 5/100ths 0 000022B8 01D8 add ax,bx 0 000022BA 83D200 adc dx,0 ; DX:AX = total in 5/100ths 0 000022BD BB0BE9 mov bx,CONVERSION_FACTOR ; load up our magic value 0 000022C0 52 push dx ; save high word 0 000022C1 F7E3 mul bx ; DX = low word result 0 000022C3 89D1 mov cx,dx ; save for later 0 000022C5 58 pop ax ; recover high word 0 000022C6 F7E3 mul bx ; DX:AX = result from high word 0 000022C8 01C8 add ax,cx ; add low and high word results 0 000022CA 83D200 adc dx,0 ; together in DX:AX 0 000022CD 92 xchg ax,dx ; DX = low word of result 0 000022CE 91 xchg ax,cx ; CX = high word of result 240 0 000022CF B401 mov ah,1 ; set system timer 0 000022D1 CD1A int RTC_INT ; CX = high word, DX = low word 243 0 000022D3 29C0 sub ax,ax ; return successfully when done 0 000022D5 C3 ret 246 247 248 Public read_system_ticks 249 250 read_system_ticks: 251 ;----------------- 0 000022D6 B400 mov ah,0 ; read system tick counter 0 000022D8 CD1A int RTC_INT 0 000022DA 84C0 test al,al ; have we passed midnight ? 0 000022DC 7404 jz read_st10 ; if so a new day has dawned 0 000022DE FF06[0000] inc word [daycount] 257 read_st10: 0 000022E2 C3 ret 259 260 bin2bcd: ; convert AL and AH to BCD values 261 ;------- 0 000022E3 E80000 call bin2bcd1 ; swap AL, AH, convert to BCD 263 ; call bin2bcd1 264 ; ret 265 bin2bcd1: 0 000022E6 51 push cx 0 000022E7 88E5 mov ch,ah ; save AH in scratch register 0 000022E9 D40A aam ; AL = AL % 10; AH = AL/10; 0 000022EB B104 mov cl,4 0 000022ED D2E4 shl ah,cl ; shift tens into high nibble 0 000022EF 08C4 or ah,al ; combine the nibbles 0 000022F1 88E8 mov al,ch ; restore the high byte into low byte 0 000022F3 59 pop cx 0 000022F4 C3 ret 275 276 RCODE ends ; end of device driver code 277 === Switch to base=000000h -> "RESUMECODE" 278 section RESUMECODE class=RESUME 278 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 279 280 ; If the system ROM BIOS supports RESUME mode then it will call Int 6C 281 ; when returning from sleep mode. We take this over and reset the clock 282 ; based upon the RTC value. To save space we only relocate the code if 283 ; required. 284 ; 285 286 Public ResumeHandler 287 ResumeHandler proc far 0 000032D0 FB sti 0 000032D1 2EA1[0000] mov ax,[cs:DataSegment] ; we have been asleep and are being 0 000032D5 8ED8 mov ds,ax ; woken by the BIOS 0 000032D7 8EC0 mov es,ax ; lets re-read the RTC before 0 000032D9 E81000 call set_clock ; we return to them 0 000032DC F8 clc 0 000032DD CA0200 ret 2 295 ResumeHandler endp 296 0 000032E0 1F1C1F1E1F1E1F1F1E set_monlen db 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 0 000032E9 1F1E1F 298 299 300 set_clock: 301 ;--------- 302 ; We may also be called after a RESUME when we have to reset the time. 303 0 000032EC B402 mov ah,2 ; read real time clock 0 000032EE 31C9 xor cx,cx 0 000032F0 31D2 xor dx,dx ; assume it won't work 0 000032F2 F9 stc 0 000032F3 CD1A int RTC_INT ; CH = hours, CL = mins, DH = secs 0 000032F5 724E jc set_clock40 ; (all in BCD remember) 310 0 000032F7 86C6 xchg al,dh ; AL = secs 0 000032F9 E8C400 call bcd2bin ; AL = secs in binary 0 000032FC 3C3B cmp al,59 0 000032FE 7745 ja set_clock40 ; reject invalid seconds 0 00003300 B464 mov ah,100 0 00003302 F6E4 mul ah ; AX = seconds in hundredths 0 00003304 99 cwd ; make it a dword 0 00003305 BB0500 mov bx,5 0 00003308 F7F3 div bx ; AX = secs and hundredths in 5/100ths 0 0000330A 93 xchg ax,bx ; save in BX 321 0 0000330B 88E8 mov al,ch ; AL = hours in BCD 0 0000330D E8B000 call bcd2bin ; AL = hours in binary 0 00003310 3C17 cmp al,23 0 00003312 7731 ja set_clock40 ; reject invalid hours 0 00003314 B43C mov ah,60 ; convert hours into minutes 0 00003316 F6E4 mul ah ; AX = hours in mins 0 00003318 92 xchg ax,dx ; save in DX 329 0 00003319 88C8 mov al,cl ; AL = mins in BCD 0 0000331B E8A200 call bcd2bin ; AL = mins in binary 0 0000331E 3C3B cmp al,59 0 00003320 7423 je set_clock40 ; reject invalid mins 0 00003322 98 cbw ; AX = minutes value 0 00003323 01D0 add ax,dx ; AX = hours and mins in mins 0 00003325 BAB004 mov dx,60*20 0 00003328 F7E2 mul dx ; DX:AX = hours and mins in 5/100ths 0 0000332A 01D8 add ax,bx 0 0000332C 83D200 adc dx,0 ; DX:AX = total in 5/100ths 0 0000332F BB0BE9 mov bx,CONVERSION_FACTOR ; load up our magic value 0 00003332 52 push dx ; save high word 0 00003333 F7E3 mul bx ; DX = low word result 0 00003335 89D1 mov cx,dx ; save for later 0 00003337 58 pop ax ; recover high word 0 00003338 F7E3 mul bx ; DX:AX = result from high word 0 0000333A 01C8 add ax,cx ; add low and high word results 0 0000333C 83D200 adc dx,0 ; together in DX:AX 0 0000333F 92 xchg ax,dx ; DX = low word of result 0 00003340 91 xchg ax,cx ; CX = high word of result 350 0 00003341 B401 mov ah,1 ; set system timer 0 00003343 CD1A int RTC_INT ; CX = high word, DX = low word 353 354 set_clock40: 0 00003345 B404 mov ah,4 ; read RTC (if present) 0 00003347 CD1A int RTC_INT ; validate date - CMOS may be corrupt 0 00003349 81F98019 cmp cx,1980h ; Too low? 0 0000334D 7212 jb set_clock45 ; Yes so skip 0 0000334F 81F99920 cmp cx,2099h ; Too high ? 0 00003353 770C ja set_clock45 ; Yes so skip 0 00003355 81FA0101 cmp dx,0101h ; Too low? 0 00003359 7206 jb set_clock45 ; Yes so skip 0 0000335B 81FA1231 cmp dx,3112h ; Too high ? 0 0000335F 7606 jbe set_clock50 ; No its okay so scram 365 set_clock45: 0 00003361 B98019 mov cx,1980h ; assume the year 1980 0 00003364 BA0101 mov dx,0101h ; assume 1st of January of that year 368 set_clock50: 0 00003367 91 xchg ax,cx ; AL, AH = year, century in BCD 0 00003368 E85500 call bcd2bin ; convert values to binary 0 0000336B 91 xchg ax,cx 0 0000336C 92 xchg ax,dx ; AL, AH = day, month in BCD 0 0000336D E85000 call bcd2bin ; convert values to binary 0 00003370 92 xchg ax,dx 375 0 00003371 C706[0000]0000 mov word [daycount],0 ; zero the daycount in case of RESUME 0 00003377 B85013 mov ax,19*256 + 80 ; assume 1980 378 set_clock55: 0 0000337A 39C8 cmp ax,cx ; same year? 0 0000337C 7418 je set_clock65 0 0000337E BB6D01 mov bx,365 ; assume 365 days in that year 0 00003381 A803 test al,3 ; test for leap year 0 00003383 7501 jnz set_clock60 ; (this works til 2400 A.D.) 0 00003385 43 inc bx ; add FEB 29 if divisible by four 385 set_clock60: 0 00003386 011E[0000] add [daycount],bx ; add days in previous year to total 0 0000338A FEC0 inc al ; next year 0 0000338C 3C64 cmp al,100 ; end of century? 0 0000338E 72EA jb set_clock55 ; skip if same century 0 00003390 B000 mov al,0 ; continue with XX00 0 00003392 FEC4 inc ah ; ...next century 0 00003394 EBE4 jmps set_clock55 ; check year again 393 394 395 set_clock65: ; same year by now 0 00003396 91 xchg ax,cx ; CX = year 0 00003397 81EA0101 sub dx,0101h ; make month, day 0 relative 0 0000339B 29DB sub bx,bx ; assume January 0 0000339D 29C0 sub ax,ax ; AH = 0 400 set_clock70: 0 0000339F 38DE cmp dh,bl ; does current month match? 0 000033A1 7416 je set_clock80 ; skip if it does 0 000033A3 2E8A87[1000] mov al,[cs:set_monlen + bx] ; get length of that month 0 000033A8 3C1C cmp al,28 ; is it february ? 0 000033AA 7506 jne set_clock75 0 000033AC F6C103 test cl,3 ; is it a leap year ? 0 000033AF 7501 jnz set_clock75 0 000033B1 40 inc ax ; leap year, 29 days in february 409 set_clock75: 0 000033B2 0106[0000] add [daycount],ax ; add it to total day count 0 000033B6 43 inc bx ; move on to next month 0 000033B7 EBE6 jmps set_clock70 413 414 set_clock80: 0 000033B9 88D0 mov al,dl ; get days in that month 0 000033BB 0106[0000] add [daycount],ax ; add them to day count 0 000033BF C3 ret 418 419 bcd2bin: 420 ;------- 421 ; entry: AL, AH = BCD values 422 ; AL, AH = binary equivalents 423 0 000033C0 E80000 call bcd2bin1 ; swap AL, AH, convert AL to binary 425 ; call bcd2bin1 ; swap AL, AH, convert AL to binary 426 ; ret 427 428 bcd2bin1: ; convert BCD to binary 0 000033C3 86C4 xchg al,ah ; swap the two values 0 000033C5 53 push bx 0 000033C6 B300 mov bl,0 ; start off without tens 432 bcd2bin2: 0 000033C8 3C10 cmp al,10h ; check if more tens 0 000033CA 7207 jb bcd2bin3 ; all tens done 0 000033CC 2C10 sub al,10h ; else subtract 10 in BCD 0 000033CE 80C30A add bl,10 ; ...and add it in binary 0 000033D1 EBF5 jmps bcd2bin2 ; repeat for all tens 438 bcd2bin3: ; AL = ones, BL = tens 0 000033D3 00D8 add al,bl ; AL = binary value 0 000033D5 5B pop bx ; restore BX 0 000033D6 C3 ret 442 443 444 RESUMECODE ends 445 446 === Switch to base=000000h -> "ICODE" 447 section ICODE class=ICODE ; initialization code 447 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 448 449 Assume CS:CGROUP, DS:CGROUP 450 451 dd_init: ; 0-initialize driver 452 ;------- 0 0000456C E8[1C00] call set_clock ; set elapsed ticks 454 455 P_DSTRUC.REQUEST equ REQUEST ; NASM port label 0 0000456F C45E02 les bx,[P_DSTRUC.REQUEST + bp] ; ES:BX -> request header 457 0 00004572 A1[0000] mov ax,[endbios] 0 00004575 2689470E mov [es:RH0_RESIDENT + bx],ax ; set end of device driver 0 00004579 268C5F10 mov [es:RH0_RESIDENT+2 + bx],ds 461 0 0000457D 29C0 sub ax,ax ; initialization succeeded 0 0000457F C3 ret ; (BIOS init always does...) 464 465 466 ICODE ends 467 468 end === Trace listing source: drbio/bin/console.lst 1 ; File : $CONSOLE.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; 33 ; CONSOLE.ASM 1.8 93/07/22 19:43:16 34 ; switch over to REQUEST.EQU 35 ; CONSOLE.ASM 1.7 93/07/19 18:57:15 36 ; Add header 37 ; 38 ; ENDLOG 39 40 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 41 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 42 %include "drmacros.mac" ; standard DR macros 1 <1> ; File : $DRMACROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 09-Nov-88 made RETF conditional for MASM 5.1/TASM 1.0 35 <1> 36 <1> FALSE equ 0 37 <1> TRUE equ (~ FALSE) 38 <1> 39 <1> 40 <1> %macro jmps 1.nolist 41 <1> jmp short %1 42 <1> %endmacro 43 <1> 44 <1> %macro stripangles 2.nolist 45 <1> %defstr %%param %2 46 <1> %substr %%opening %%param 1 47 <1> %ifidn %%opening, '<' 48 <1> %substr %%param %%param 2,-1 49 <1> %endif 50 <1> %strlen %%length %%param 51 <1> %substr %%closing %%param %%length 52 <1> %ifidn %%closing, '>' 53 <1> %substr %%param %%param 1,-2 54 <1> %endif 55 <1> %deftok %%token %%param 56 <1> %1 %%token 57 <1> %endmacro 58 <1> 59 <1> %macro pushx 0-*.nolist 60 <1> %rep %0 61 <1> stripangles push, %1 62 <1> %rotate 1 63 <1> %endrep 64 <1> %endmacro 65 <1> 66 <1> %macro popx 0-*.nolist 67 <1> %rep %0 68 <1> stripangles pop, %1 69 <1> %rotate 1 70 <1> %endrep 71 <1> %endmacro 72 <1> 73 <1> %macro incx 0-*.nolist 74 <1> %rep %0 75 <1> stripangles inc, %1 76 <1> %rotate 1 77 <1> %endrep 78 <1> %endmacro 79 <1> 80 <1> %macro decx 0-*.nolist 81 <1> %rep %0 82 <1> stripangles dec, %1 83 <1> %rotate 1 84 <1> %endrep 85 <1> %endmacro 86 <1> 87 <1> %macro rb 1.nolist 88 <1> db %1 dup (?) 89 <1> %endmacro 90 <1> 91 <1> %macro rw 1.nolist 92 <1> dw %1 dup (?) 93 <1> %endmacro 94 <1> 95 <1> %macro rd 1.nolist 96 <1> dd %1 dup (?) 97 <1> %endmacro 43 %include "ibmros.mac" ; ROM BIOS equates 1 <1> ; File : $IBMROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> VIDEO_INT equ 10h 36 <1> EQUIPMENT_INT equ 11h 37 <1> MEMORY_INT equ 12h 38 <1> DISK_INT equ 13h 39 <1> ASYNC_INT equ 14h 40 <1> SYSTEM_INT equ 15h 41 <1> KEYBOARD_INT equ 16h 42 <1> PRINTER_INT equ 17h 43 <1> RTC_INT equ 1Ah 44 <1> CTRLBRK_INT equ 1Bh 45 <1> 46 <1> ; Int 10 subfunctions 47 <1> 48 <1> SET_CURSOR_TYPE equ 01h 49 <1> WRITE_CURSOR equ 02h ; Set cursor position 50 <1> READ_CURSOR equ 03h ; Read cursor position 51 <1> SCROLL_UP equ 06h ; Scroll active page up 52 <1> SCROLL_DOWN equ 07h ; Scroll active page down 53 <1> READ_CHAR equ 08h ; Read attribute/char at cur position 54 <1> WRITE_CHAR equ 09h ; Write attribute/char at cur position 55 <1> WRITE_TTY equ 0eh ; Write teletype at current position 56 <1> GET_STATE equ 0fh ; Return current video mode 57 <1> 58 <1> ; Int 13 subfunctions 59 <1> 60 <1> ROS_RESET equ 00h ; reset disk system 61 <1> ROS_READ equ 02h ; read from disk 62 <1> ROS_WRITE equ 03h ; write to disk 63 <1> ROS_VERIFY equ 04h ; verify data on disk 64 <1> ROS_FORMAT equ 05h ; format track on disk 65 <1> ROS_PARAM equ 08h ; get drive parameters 66 <1> ROS_GETTYPE equ 15h ; get drive type 67 <1> ROS_DSKCHG equ 16h ; check disk change status 68 <1> ROS_SETTYPE equ 17h ; set disk type for format 69 <1> ROS_SETMEDIA equ 18h ; set media type for format 70 <1> ROS_LBACHK equ 41h ; int 13 extensions install check 71 <1> ROS_LBAREAD equ 42h ; extended read 72 <1> ROS_LBAWRITE equ 43h ; extended write 73 <1> ROS_LBAVERIFY equ 44h ; extended verify 74 <1> ROS_LBAPARAM equ 48h ; get extended drive parameters 75 <1> 76 <1> PRN_ERROR equ 00101001b ; printer error bits 77 <1> PRN_NOTBUSY equ 10000000b 78 <1> PRN_ACK equ 01000000b 79 <1> PRN_PAPER equ 00100000b 80 <1> PRN_SELECT equ 00010000b 81 <1> PRN_IOERR equ 00001000b 82 <1> PRN_TIMEOUT equ 00000001b 83 <1> 84 <1> AUX_ERROR equ 10000000b ; auxiliary error bits 85 <1> 86 <1> ; Int 15 subfunctions 87 <1> 88 <1> EXT_MEMORY equ 88h ; Return extended memory size in KB 44 %include "request.mac" ; request header equates 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 39 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 57 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 45 %include "driver.mac" ; device driver equates 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 41 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 46 47 ;page 48 group CGROUP CODE RCODE ICODE 49 50 Assume CS:CGROUP, DS:CGROUP, ES:CGROUP, SS:CGROUP 51 === Switch to base=000000h -> "CODE" 52 section CODE class=CODE 52 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 53 54 INSERT_ACTIVE equ 2 ; set if cmdline insert active 55 56 extrn endbios:word ; for device driver INIT function 57 extrn FastConsole:far ; console output vector 58 extrn ControlBreak:far ; ^C program abort 59 extrn local_flag:byte 60 extrn local_char:byte 61 62 CODE ends 63 === Switch to base=000000h -> "RCODE" 64 section RCODE class=RCODE 64 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 65 66 ; Device driver function table 67 68 Public ConsoleTable 69 70 ConsoleTable: 0 000022F6 0E db 14 ; Last supported command 0 000022F7 [0000] dw dd_init ; 0-initialize driver 0 000022F9 [4B00] dw dd_error ; 1-media change check (disks only) 0 000022FB [4B00] dw dd_error ; 2-build BPB (disks only) 0 000022FD [4B00] dw dd_inioctl ; 3-IOCTL string input 0 000022FF [A000] dw dd_input ; 4-input 0 00002301 [B500] dw dd_poll ; 5-nondestructive input (char only) 0 00002303 [C100] dw dd_instat ; 6-input status (char only) 0 00002305 [CA00] dw dd_inflush ; 7-input flush 0 00002307 [D400] dw dd_output ; 8-output 0 00002309 [D400] dw dd_output ; 9-output with verify 0 0000230B [B200] dw dd_outstat ; 10-output status (char only) 0 0000230D [B200] dw dd_outflush ; 11-output flush (char only) 0 0000230F [1F00] dw dd_outioctl ; 12-IOCTL string output 0 00002311 [B200] dw dd_open ; 13-device open 0 00002313 [B200] dw dd_close ; 14-device close 87 88 89 Assume DS:CGROUP, ES:Nothing, SS:Nothing 90 91 ;page 92 93 dd_outioctl: 94 ;----------- 0 00002315 268B4F12 mov cx,[es:RH4_COUNT + bx] ; get # of characters to output 0 00002319 83F902 cmp cx,2 ; is it what we expect ? 0 0000231C 7523 jne dd_error ; no, bail out 0 0000231E 1E push ds 0 0000231F 26C5770E lds si,[es:RH4_BUFFER + bx] ; DS:SI -> buffer 0 00002323 AD lodsw ; get the data 0 00002324 1F pop ds 0 00002325 96 xchg ax,si ; save data in SI 0 00002326 B403 mov ah,3 ; read cursor position/type 0 00002328 B700 mov bh,0 ; for page zero 0 0000232A CD10 int VIDEO_INT 0 0000232C 80E5C0 and ch,0c0h ; make cursor start line = 0 0 0000232F 88C8 mov al,cl ; AL = bottom line of cursor 0 00002331 48 dec ax ; AL = bottom line - 1 0 00002332 F7C60200 test si,INSERT_ACTIVE 0 00002336 7402 jz dd_outioctl10 0 00002338 D0E8 shr al,1 ; Insert active is 1/2 size block 112 dd_outioctl10: 0 0000233A 08C5 or ch,al ; cursor start line is now here 0 0000233C B401 mov ah,1 ; set cursor type 0 0000233E CD10 int VIDEO_INT 0 00002340 C3 ret 117 118 dd_inioctl: 119 ;---------- 120 ; jmp dd_error ; input not supported 121 122 dd_error: ; used for all unsupported driver functions 123 ;-------- 0 00002341 B80380 mov ax,RHS_ERROR+3 ; "invalid command" error 0 00002344 C3 ret 126 127 128 poll_c1: 0 00002345 B400 mov ah,0 ; eat the next character 0 00002347 CD16 int KEYBOARD_INT ; take it out of ROS buffer 131 ; and check again 132 poll_char: 133 ;--------- 134 ; exit: ZF = 1 => no character ready 135 ; ZF = 0 => AL = character 136 0 00002349 A0[0000] mov al,[local_char] ; get the local character 0 0000234C 803E[0000]FF cmp byte [local_flag],TRUE ; do we have local character? 0 00002351 7411 je poll_c4 ; no, check ROS keyboard status 0 00002353 B401 mov ah,1 ; get keyboard status (and character) 0 00002355 CD16 int KEYBOARD_INT ; read character from keyboard 0 00002357 744F jz input9 ; skip if no character there 0 00002359 85C0 test ax,ax ; test if we got Ctrl-Brk 0 0000235B 74E8 jz poll_c1 ; and eat it if we have 145 poll_c3: ; we've got a character 0 0000235D 3D0072 cmp ax,7200h ; is this Ctrl-PrtSc? 0 00002360 7502 jne poll_c4 0 00002362 B010 mov al,'P'-40h ; convert to ^P character 149 poll_c4: ; return the character in AL 0 00002364 80CCFF or ah,TRUE ; indicate "ready" status 0 00002367 C3 ret 152 153 char_read: 154 ;--------- 0 00002368 803E[0000]FF cmp byte [local_flag],TRUE ; do we have local character? 0 0000236D 741E je rdchr3 ; handle that specially 0 0000236F B400 mov ah,0 0 00002371 CD16 int KEYBOARD_INT ; read character from keyboard 0 00002373 85C0 test ax,ax ; test if we got Ctrl-Brk 0 00002375 74F1 jz char_read ; retry in that case 0 00002377 3D0072 cmp ax,7200h ; is this Ctrl-PrtSc? 0 0000237A 7503 jne rdchr1 ; skip if any other 0 0000237C B010 mov al,'P'-40h ; convert to ^P character 0 0000237E C3 ret ; and return it 165 rdchr1: ; else it is normal or function key 0 0000237F 84C0 test al,al ; test if function key 0 00002381 7509 jnz rdchr2 ; skip if normal character 0 00002383 C606[0000]FF mov byte [local_flag],TRUE ; else return scan code as next 0 00002388 8826[0000] mov [local_char],ah ; character from next INPUT 170 rdchr2: ; return the character in AL 0 0000238C C3 ret 172 rdchr3: 0 0000238D C606[0000]00 mov byte [local_flag],FALSE ; tell them buffer is invalid 0 00002392 A0[0000] mov al,[local_char] ; get the local charcater 0 00002395 C3 ret ; and return it 176 177 ; page 178 dd_input: ; 4-input 179 ;-------- 0 00002396 268B4F12 mov cx,[es:RH4_COUNT + bx] ; get # of characters to output 0 0000239A E30C jcxz input9 ; return if nothing to input 0 0000239C 06 push es ; save ES (-> request header!) 0 0000239D 26C47F0E les di,[es:RH4_BUFFER + bx] ; get address of string to input 184 input1: 0 000023A1 E8C4FF call char_read ; read 8-bit character 0 000023A4 AA stosb ; store it in input buffer 0 000023A5 E2FA loop input1 ; repeat for all characters 0 000023A7 07 pop es 189 input9: 190 ; sub ax,ax 191 ; ret 192 193 dd_outstat: ; 10-output status (char only) 194 ;---------- ; always ready, return no busy 195 196 dd_outflush: ; 11-output flush (char only) 197 ;----------- ; unbuffered, perform no operation 198 199 dd_open: ; 13-device open 200 ;------- ; no operation 201 202 dd_close: ; 14-device close 203 ;-------- ; no operation 0 000023A8 29C0 sub ax,ax 0 000023AA C3 ret 206 207 dd_poll: ; 5-nondestructive input (char only) 208 ;------- 0 000023AB E89BFF call poll_char ; check keyboard status 0 000023AE 740C jz dd_instat20 0 000023B0 2688470D mov [es:RH5_CHAR + bx],al ; return the character 212 dd_poll10: 0 000023B4 29C0 sub ax,ax 0 000023B6 C3 ret 215 216 dd_instat: ; 6-input status (char only) 217 ;--------- 0 000023B7 E88FFF call poll_char ; check keyboard status 0 000023BA 75F8 jnz dd_poll10 220 dd_instat20: 0 000023BC B80002 mov ax,RHS_BUSY 0 000023BF C3 ret 223 224 225 dd_inflush: ; 7-input flush 226 ;--------- 0 000023C0 E886FF call poll_char ; check keyboard status 0 000023C3 74EF jz dd_poll10 ; skip if not ready 0 000023C5 E8A0FF call char_read ; else read next character 0 000023C8 EBF6 jmps dd_inflush ; repeat until buffer empty 231 232 dd_output: ; 8-output 233 ;--------- 0 000023CA 268B4F12 mov cx,[es:RH4_COUNT + bx] ; get # of characters to output 0 000023CE E310 jcxz output9 ; return if nothing to output 0 000023D0 06 push es ; save ES (-> request header!) 0 000023D1 26C4770E les si,[es:RH4_BUFFER + bx] ; get address of string to output 238 output1: 0 000023D5 26AC es lodsb ; get next character to output 0 000023D7 9C pushf ; stack as per Int 29 0 000023D8 9A db 09Ah ; CALLF to our fastconsole entry 0 000023D9 [0000] dw offset FastConsole 0 000023DB 7000 dw BIO_SEG 0 000023DD E2F6 loop output1 ; repeat for all characters 0 000023DF 07 pop es 246 output9: 0 000023E0 29C0 sub ax,ax 0 000023E2 C3 ret 249 250 251 RCODE ends ; end of device driver code 252 253 ;page 254 === Switch to base=000000h -> "ICODE" 255 section ICODE class=ICODE ; initialization code 255 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 256 257 dd_init: ; 0-initialize driver 258 ;------- 259 0 00004580 06 push es 0 00004581 29C0 sub ax,ax 0 00004583 8EC0 mov es,ax 0 00004585 B8[0000] mov ax,offset FastConsole ; console output vector 0 00004588 BFA400 mov di,FASTCON_INT*4 ; setup fast single character 0 0000458B AB stosw ; console output vector 0 0000458C 8CD8 mov ax,ds ; (identified by DA_SPECIAL) 0 0000458E AB stosw 0 0000458F BF6C00 mov di,CTRLBRK_INT*4 ; setup Ctrl-Break ROS vector 0 00004592 B8[0000] mov ax,offset ControlBreak ; for ^C program abort 0 00004595 AB stosw ; when a character has already 0 00004596 8CD8 mov ax,ds ; been typed into the ROS buffer 0 00004598 AB stosw 0 00004599 07 pop es 274 275 %ifdef JAPAN 276 277 mov ax,05000H ; Japanese mode (AX machine) 278 mov bx,81 ; 081 : Japanese mode select 279 int VIDEO_INT ; 280 281 mov ax,05000h ; Japanese mode (AX machine) 282 mov bx,81 ; 081 : Japanese mode select 283 int KEYBOARD_INT ; 284 285 %endif 286 0 0000459A B80D0E mov ax,14*256 + 13 ; output a carriage return 0 0000459D CD10 int VIDEO_INT 0 0000459F B80A0E mov ax,14*256 + 10 ; output a line feed 0 000045A2 CD10 int VIDEO_INT 291 292 P_DSTRUC.REQUEST equ REQUEST ; NASM port label 0 000045A4 C45E02 les bx,[P_DSTRUC.REQUEST + bp] ; ES:BX -> request header 294 0 000045A7 A1[0000] mov ax,[endbios] ; get last resident byte in BIOS 0 000045AA 2689470E mov [es:RH0_RESIDENT + bx],ax ; set end of device driver 0 000045AE 268C5F10 mov [es:RH0_RESIDENT+2 + bx],ds 298 0 000045B2 29C0 sub ax,ax ; initialization succeeded 0 000045B4 C3 ret 301 302 ICODE ends 303 304 end === Trace listing source: drbio/bin/disk.lst 1 ; File : $DISK.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : 6 ; 7 ; Last Edited By : $Author: RGROSS$ 8 ; 9 ; Bugs: - UDSC_FSTYPE is not updated correctly if actual file system type 10 ; does not match the type of partition table. This may be be a 11 ; non-issue, because UDSC_FSTYPE is not actually used by 12 ; the kernel. 13 ; 14 ; - BPB_SIZE et al. are not read from the BPB of the hard disk 15 ; partition but always constructed from information stored in the 16 ; partition table. This may impose a problem where these values 17 ; disagree. 18 ; 19 ; ecm note: If the BPB size is smaller than the partition 20 ; table entry size then the BPB size is now preferred. 21 ; 22 ; - Kernel allows access to non-formatted disks, because a valid 23 ; default BPB is constructed. Even file operations may seem to 24 ; succeed if FAT etc. by accident store sensible values. 25 ; 26 ;-----------------------------------------------------------------------; 27 ; Copyright Unpublished Work of Novell, Inc. All Rights Reserved. 28 ; 29 ; THIS WORK IS AN UNPUBLISHED WORK AND CONTAINS CONFIDENTIAL, 30 ; PROPRIETARY AND TRADE SECRET INFORMATION OF NOVELL, INC. 31 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) NOVELL, INC. EMPLOYEES 32 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 33 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN NOVELL, INC. WHO 34 ; HAVE ENTERED INTO APPROPRIATE LICENSE AGREEMENTS. NO PART OF THIS 35 ; WORK MAY BE USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, 36 ; REVISED, MODIFIED, TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, 37 ; COLLECTED, COMPILED, LINKED, RECAST, TRANSFORMED OR ADAPTED 38 ; WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, INC. ANY USE OR 39 ; EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT 40 ; THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. 41 ;-----------------------------------------------------------------------; 42 ; 43 ; *** Current Edit History *** 44 ; *** End of Current Edit History *** 45 ; 46 ; $Log: $ 47 ; DISK.ASM 1.1 93/11/18 17:20:12 RGROSS 48 ; 49 ; DISK.ASM 1.41 93/11/18 17:20:25 IJACK 50 ; 51 ; DISK.ASM 1.40 93/11/10 00:28:12 IJACK 52 ; Format changes so you can format your hard disk 53 ; DISK.ASM 1.39 93/11/08 21:47:25 IJACK 54 ; Add hidden sectors to ioctl format etc of hard disks 55 ; DISK.ASM 1.38 93/11/02 16:09:29 IJACK 56 ; Always zero BPB_HIDDEN_SECTORS on floppies - problem with PCW free disk which 57 ; has garbage in those fields. 58 ; DISK.ASM 1.37 93/10/18 17:33:18 IJACK 59 ; format c: fix 60 ; DISK.ASM 1.36 93/10/11 18:37:24 IJACK 61 ; media-change checks serial-numbers for 3.5" disks 62 ; DISK.ASM 1.35 93/10/06 22:09:16 IJACK 63 ; vec_save extrn replaced by orgInt13 extrn 64 ; DISK.ASM 1.34 93/09/03 20:13:32 IJACK 65 ; Fix bug in disk formatting 66 ; DISK.ASM 1.33 93/09/01 17:40:31 IJACK 67 ; update UDSC_TIMER after media check forced by drive change 68 ; (DBASE IV slow installation problem) 69 ; DISK.ASM 1.32 93/08/12 15:33:07 IJACK 70 ; Handle DMA error from multi-track read (ancient PC-XT hard disk) 71 ; DISK.ASM 1.31 93/08/03 15:29:01 IJACK 72 ; use serial numbers for media change detection 73 ; DISK.ASM 1.30 93/08/02 18:44:50 IJACK 74 ; don't trust the changeline if switching drives 75 ; DISK.ASM 1.29 93/08/02 18:38:19 IJACK 76 ; 77 ; DISK.ASM 1.28 93/08/02 14:47:38 IJACK 78 ; 79 ; DISK.ASM 1.27 93/07/29 21:00:24 IJACK 80 ; get rid of genpb_ptr and genpb_minor 81 ; DISK.ASM 1.26 93/07/26 21:18:25 IJACK 82 ; Correctly return UDSC_ root from Int 2F/0803 83 ; DISK.ASM 1.25 93/07/26 18:07:21 IJACK 84 ; Switch ms-windows to full screen when prompting for disk 85 ; DISK.ASM 1.24 93/07/23 17:34:27 IJACK 86 ; fix floppy/driver.sys support 87 ; DISK.ASM 1.23 93/07/22 20:37:42 IJACK 88 ; 89 ; DISK.ASM 1.22 93/07/22 19:43:46 IJACK 90 ; switch over to REQUEST.EQU 91 ; change floppy drive order, add get/set serial number 92 ; DISK.ASM 1.21 93/07/19 18:57:21 IJACK 93 ; Add header 94 ; 95 ; ENDLOG 96 97 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 98 %include "drmacros.mac" ; standard DR macros 1 <1> ; File : $DRMACROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 09-Nov-88 made RETF conditional for MASM 5.1/TASM 1.0 35 <1> 36 <1> FALSE equ 0 37 <1> TRUE equ (~ FALSE) 38 <1> 39 <1> 40 <1> %macro jmps 1.nolist 41 <1> jmp short %1 42 <1> %endmacro 43 <1> 44 <1> %macro stripangles 2.nolist 45 <1> %defstr %%param %2 46 <1> %substr %%opening %%param 1 47 <1> %ifidn %%opening, '<' 48 <1> %substr %%param %%param 2,-1 49 <1> %endif 50 <1> %strlen %%length %%param 51 <1> %substr %%closing %%param %%length 52 <1> %ifidn %%closing, '>' 53 <1> %substr %%param %%param 1,-2 54 <1> %endif 55 <1> %deftok %%token %%param 56 <1> %1 %%token 57 <1> %endmacro 58 <1> 59 <1> %macro pushx 0-*.nolist 60 <1> %rep %0 61 <1> stripangles push, %1 62 <1> %rotate 1 63 <1> %endrep 64 <1> %endmacro 65 <1> 66 <1> %macro popx 0-*.nolist 67 <1> %rep %0 68 <1> stripangles pop, %1 69 <1> %rotate 1 70 <1> %endrep 71 <1> %endmacro 72 <1> 73 <1> %macro incx 0-*.nolist 74 <1> %rep %0 75 <1> stripangles inc, %1 76 <1> %rotate 1 77 <1> %endrep 78 <1> %endmacro 79 <1> 80 <1> %macro decx 0-*.nolist 81 <1> %rep %0 82 <1> stripangles dec, %1 83 <1> %rotate 1 84 <1> %endrep 85 <1> %endmacro 86 <1> 87 <1> %macro rb 1.nolist 88 <1> db %1 dup (?) 89 <1> %endmacro 90 <1> 91 <1> %macro rw 1.nolist 92 <1> dw %1 dup (?) 93 <1> %endmacro 94 <1> 95 <1> %macro rd 1.nolist 96 <1> dd %1 dup (?) 97 <1> %endmacro 99 %include "ibmros.mac" ; ROM BIOS equates 1 <1> ; File : $IBMROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> VIDEO_INT equ 10h 36 <1> EQUIPMENT_INT equ 11h 37 <1> MEMORY_INT equ 12h 38 <1> DISK_INT equ 13h 39 <1> ASYNC_INT equ 14h 40 <1> SYSTEM_INT equ 15h 41 <1> KEYBOARD_INT equ 16h 42 <1> PRINTER_INT equ 17h 43 <1> RTC_INT equ 1Ah 44 <1> CTRLBRK_INT equ 1Bh 45 <1> 46 <1> ; Int 10 subfunctions 47 <1> 48 <1> SET_CURSOR_TYPE equ 01h 49 <1> WRITE_CURSOR equ 02h ; Set cursor position 50 <1> READ_CURSOR equ 03h ; Read cursor position 51 <1> SCROLL_UP equ 06h ; Scroll active page up 52 <1> SCROLL_DOWN equ 07h ; Scroll active page down 53 <1> READ_CHAR equ 08h ; Read attribute/char at cur position 54 <1> WRITE_CHAR equ 09h ; Write attribute/char at cur position 55 <1> WRITE_TTY equ 0eh ; Write teletype at current position 56 <1> GET_STATE equ 0fh ; Return current video mode 57 <1> 58 <1> ; Int 13 subfunctions 59 <1> 60 <1> ROS_RESET equ 00h ; reset disk system 61 <1> ROS_READ equ 02h ; read from disk 62 <1> ROS_WRITE equ 03h ; write to disk 63 <1> ROS_VERIFY equ 04h ; verify data on disk 64 <1> ROS_FORMAT equ 05h ; format track on disk 65 <1> ROS_PARAM equ 08h ; get drive parameters 66 <1> ROS_GETTYPE equ 15h ; get drive type 67 <1> ROS_DSKCHG equ 16h ; check disk change status 68 <1> ROS_SETTYPE equ 17h ; set disk type for format 69 <1> ROS_SETMEDIA equ 18h ; set media type for format 70 <1> ROS_LBACHK equ 41h ; int 13 extensions install check 71 <1> ROS_LBAREAD equ 42h ; extended read 72 <1> ROS_LBAWRITE equ 43h ; extended write 73 <1> ROS_LBAVERIFY equ 44h ; extended verify 74 <1> ROS_LBAPARAM equ 48h ; get extended drive parameters 75 <1> 76 <1> PRN_ERROR equ 00101001b ; printer error bits 77 <1> PRN_NOTBUSY equ 10000000b 78 <1> PRN_ACK equ 01000000b 79 <1> PRN_PAPER equ 00100000b 80 <1> PRN_SELECT equ 00010000b 81 <1> PRN_IOERR equ 00001000b 82 <1> PRN_TIMEOUT equ 00000001b 83 <1> 84 <1> AUX_ERROR equ 10000000b ; auxiliary error bits 85 <1> 86 <1> ; Int 15 subfunctions 87 <1> 88 <1> EXT_MEMORY equ 88h ; Return extended memory size in KB 100 %include "request.mac" ; request header equates 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 39 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 57 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 101 %include "bpb.mac" ; BIOS parameter block equates 1 <1> ; File : $BPB.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> BPB struc 0 00000000 ???? SECSIZ dw ? ; # of bytes per sector 0 00000002 ?? ALLOCSIZ db ? ; # of sectors per allocation unit 0 00000003 ???? FATADD dw ? ; # of reserved sectors (1) 0 00000005 ?? NFATS db ? ; # of fats 0 00000006 ???? DIRMAX dw ? ; # of directory entries 0 00000008 ???? TOTSEC dw ? ; # of sectors total in image 0 0000000A ?? FATID db ? ; holds a copy of the fat id byte 0 0000000B ???? FATSEC dw ? ; # of sectors in a fat 0 0000000D ???? SPT dw ? ; # of sectors per track 0 0000000F ???? HEADS dw ? ; # of heads 0 00000011 ???????? HIDDEN dd ? ; disk offset (32 bit) 0 00000015 ???????? SIZ dd ? ; disk size (32 bit) 0 00000019 ???????? BFATSEC dd ? ; # of sectors per FAT 0 0000001D ???? FATFLAG dw ? ; flags for FAT mirroring 0 0000001F ???? FSVER dw ? ; version of file system 0 00000021 ???????? FSROOT dd ? ; starting cluster of root directory 0 00000025 ???? FSINFO dw ? ; sector number of file system info block 0 00000027 ???? BOOTBAK dw ? ; sector number of backup boot block 53 00000029 <1> RESRVD2 dw 6 dup (?) 54 <1> BPB ends 54 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 55 <1> 56 <1> BPB_LENGTH equ BPB_size 57 <1> 58 <1> BPB_SECTOR_OFFSET equ 0bh 59 <1> 60 <1> OLDBPB struc 0 00000000 ???? OLDBPB_SECSIZ dw ? ; # of bytes per sector 0 00000002 ?? OLDBPB_ALLOCSIZ db ? ; # of sectors per allocation unit 0 00000003 ???? OLDBPB_FATADD dw ? ; # of reserved sectors (1) 0 00000005 ?? OLDBPB_NFATS db ? ; # of fats 0 00000006 ???? OLDBPB_DIRMAX dw ? ; # of directory entries 0 00000008 ???? OLDBPB_TOTSEC dw ? ; # of sectors total in image 0 0000000A ?? OLDBPB_FATID db ? ; holds a copy of the fat id byte 0 0000000B ???? OLDBPB_FATSEC dw ? ; # of sectors in a fat 0 0000000D ???? OLDBPB_SPT dw ? ; # of sectors per track 0 0000000F ???? OLDBPB_HEADS dw ? ; # of heads 0 00000011 ???????? OLDBPB_HIDDEN dd ? ; disk offset (32 bit) 0 00000015 ???????? OLDBPB_SIZ dd ? ; disk size (32 bit) 0 00000019 ???????????? OLDBPB_RESRVD2 db 6 dup (?) 74 <1> OLDBPB ends 74 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 75 <1> 76 <1> OLDBPB_LENGTH equ OLDBPB_size 102 %include "udsc.mac" ; unit descriptor equates 1 <1> ; File : $UDSC.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> OLD_UDSC_BPB_LENGTH equ 25 36 <1> UDSC_BPB_LENGTH equ 53 37 <1> 38 <1> UDSC struc 0 00000000 ???????? NEXT dd ? ; link to next UDSC_ 0 00000004 ?? RUNIT db ? ; ROS drive number (0/1/80/81) 0 00000005 ?? DRIVE db ? ; logical drive 42 00000006 <1> UDSCBPB db UDSC_BPB_LENGTH dup (?) ; current BPB 0 0000003B ?? UDSCFATFLAG db ? 0 0000003C ???? OPNCNT dw ? ; # of files open on drive 0 0000003E ?? TYP db ? ; floppy drive type (0/1/2/7) 0 0000003F ???? FLAGS dw ? ; various flags for drive 0 00000041 ???? NCYL dw ? ; # of cylinders per drive 48 00000043 <1> DEVBPB db UDSC_BPB_LENGTH dup (?) ; device BPB 0 00000078 ?? LAST_TRACK db ? ; unused (last track accessed) 0 00000079 ???????? TIMER dw 2 dup (?) ; tick count for MEDCHK 51 0000007D <1> LABL db 12 dup (?) ; ASCIIZ volume label 0 00000089 ???????? SERIAL dd ? ; serial number 53 0000008D <1> FSTYPE db 9 dup (?) ; ASCIIZ "FAT12"/"FAT16" type 54 <1> UDSC ends 54 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 55 <1> 56 <1> UDSC_LENGTH equ UDSC_size 57 <1> UDSC.TIMER equ TIMER ; NASM port label 58 <1> UDSC_FM_PART equ UDSC.TIMER ; fixed media part type (always 1) 59 <1> UDSC_FM_OFFSET equ UDSC.TIMER+2 ; fixed media part offset (always 0) 60 <1> 61 <1> UDF_HARD equ 0001h ; drive is a hard disk 62 <1> UDF_CHGLINE equ 0002h ; drive support disk change line 63 <1> UDF_UNSURE equ 0004h ; drive has just been formatted 64 <1> UDF_VFLOPPY equ 0010h ; drive shares physical drive 65 <1> UDF_OWNER equ 0020h ; logical drive "owns" physical drive 66 <1> UDF_MEDIA equ 0100h ; media id is from bootsec, not default 67 <1> UDF_NOACCESS equ 0200h ; set if access to drive is disabled 68 <1> UDF_LBA equ 0400h ; drive accessed by LBA 69 <1> MAXPART equ 26 ; support up 26 drives 103 %include "driver.mac" ; device driver equates 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 41 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 104 %include "keys.mac" ; common key definitions 1 <1> NUL equ 0 2 <1> BS equ 8 3 <1> TAB equ 9 4 <1> LF equ 10 5 <1> CR equ 13 105 106 107 %macro int_____DISK_INT 0.nolist 108 call Int13 109 %endmacro 110 111 FASTSETTLE equ FALSE ; disable "head settle == 0 ms" 112 113 RETRY_MAX equ 3 ; do 3 retries if we get an error 114 MAX_SPT equ 40 ; maximum sectors per track 115 116 SECSIZE equ 512 117 IDOFF equ SECSIZE-2 ; last word in boot sector is ID 118 PTOFF equ IDOFF-40h ; 4*16 bytes for partition def's 119 120 DOS20_ID equ 1 ; DOS 2.0 partition, < 4086 clusters 121 DOS30_ID equ 4 ; DOS 3.0 partition, < 65536 sectors 122 DOSEX_ID equ 5 ; DOS 3.3 extended partition 123 DOS331_ID equ 6 ; COMPAQ DOS 3.31 partition > 32 Mb 124 FAT16X_ID equ 0eh ; FAT16 LBA partition 125 FAT32_ID equ 0bh ; FAT32 partition 126 FAT32X_ID equ 0ch ; FAT32 LBA partition 127 EXTX_ID equ 0fh ; Win95 ExtendedX partition 128 129 ; Now for the secure partition types 130 SEC_ID equ 0C0h ; New DR secure partition types 131 SEC_ID2 equ 0D0h ; Old DR secure partition types 132 133 ;page 134 group CGROUP CODE RCODE ICODE RESBIOS IDATA 135 136 Assume CS:CGROUP, DS:CGROUP, ES:Nothing, SS:Nothing 137 138 absolute 0 139 0 00000000 ?? org 0013h*4, db ? 0 0000004C ???? i13off dw ? 0 0000004E ???? i13seg dw ? 143 0 00000050 ?? org 001Eh*4, db ? 0 00000078 ???????? i1eptr dd ? 146 0 0000007C ?? org 002Fh*4, db ? 0 000000BC ???? i2Foff dw ? 0 000000BE ???? i2Fseg dw ? 150 0 000000C0 ?? org 0504h, db ? 0 00000504 ?? dual_byte db ? ; multiple drive byte at 50:4 153 154 IVECT ends 155 === Switch to base=000000h -> "CODE" 156 section CODE class=CODE 156 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 157 158 extrn endbios:word ; for device driver INIT function 159 extrn read_system_ticks:near ; get system tick count in CX/DX 160 extrn Int13Trap:near 161 extrn Int2FTrap:near 162 extrn orgInt13:dword 163 extrn i13pointer:dword 164 extrn i13off_save:word 165 extrn i13seg_save:word 166 167 extrn NumDiskUnits:byte 168 extrn DeblockSeg:word 169 extrn local_parms:byte 170 extrn parms_spt:byte 171 extrn parms_gpl:byte 172 extrn local_buffer:byte 173 extrn local_pt:word 174 extrn local_id:word 175 extrn layout_table:word 176 extrn bpbs:word 177 extrn bpb160:byte 178 extrn bpb360:byte 179 extrn bpb720:byte 180 extrn NBPBS:abs 181 extrn bpbtbl:word 182 extrn req_off:word 183 extrn req_seg:word 184 extrn output_msg:near 185 extrn output_hex:near 186 extrn diskaddrpack:word 187 188 udsc_root label dword 0 00000662 FFFFFFFF dw -1,-1 190 0 00000666 2205 orig_int1e_off dw 522h 0 00000668 0000 orig_int1e_seg dw 0 193 0 0000066A 2205 new_int1e_off dw 522h 0 0000066C 0000 new_int1e_seg dw 0 196 197 198 Public i13_AX 199 i13_AX label word 0 0000066E ?? i13_size db ? ; number of sectors to xfer 0 0000066F ?? i13_op db ? ; Int13 Operation 202 i13_dma_ptr label dword 0 00000670 ???? i13_dma_off dw ? 0 00000672 ???? i13_dma_seg dw ? 205 0 00000674 ?? activeRosUnit db ? ; currently active ROS unit 207 208 %include "biosmsgs.mac" ; Include TFT Header File 1 <1> extrn _disk_msgA : byte 2 <1> extrn disk_msgA : byte 3 <1> extrn _disk_msgB : byte 4 <1> extrn disk_msgB : byte 5 <1> extrn _div_by_zero_msg : byte 6 <1> extrn div_by_zero_msg : byte 209 210 211 %ifdef JAPAN 212 extrn disk_msgA_jpn :byte 213 extrn disk_msgB_jpn :byte 214 %endif 215 216 ;disk_msgA db 13,10,'Insert disk for drive ' 217 ;disk_msgB db ': any press any key when ready ', 0 218 219 ;page 220 Assume DS:nothing, SS:nothing, ES:nothing 221 222 CODE ends 223 === Switch to base=000000h -> "RCODE" 224 section RCODE class=RCODE 224 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 225 226 extrn DataSegment:word 227 228 even 229 Int13: 0 000023E4 F8 clc 231 Int13_Keep_CF: 0 000023E5 55 push bp 0 000023E6 CD13 int DISK_INT 0 000023E8 5D pop bp 0 000023E9 C3 ret 236 237 0 000023EA 038008104004060007 ros_errors db 03h, 80h, 08h, 10h, 40h, 04h, 06h, 00h, 07h 0 000023F3 0002040406080F0C07 dos_errors db 00h, 02h, 04h, 04h, 06h, 08h, 0Fh, 0Ch, 07h 240 NUMROSERR equ dos_errors - ros_errors 241 242 ; The following code is required in order to cope with 243 ; application programs invoking Int 13h directly. It 244 ; handles applications that format floppies or access the 245 ; disk via Int 13h after a floppy disk change. 246 247 Assume CS:CGROUP, DS:Nothing, ES:Nothing, SS:Nothing 248 249 250 Public Int13Unsure 251 ;---------- 252 Int13Unsure proc far 253 ;---------- 0 000023FC FB sti 0 000023FD FC cld 0 000023FE 1E push ds 0 000023FF 2E8E1E[0000] mov ds,[cs:DataSegment] 258 Assume DS:CGROUP 0 00002404 E80201 call i13_unsure ; no longer sure of this drive 0 00002407 1F pop ds 0 00002408 CB ret 262 Int13Unsure endp 263 264 Public Int13Deblock 265 266 ;----------- 267 Int13Deblock proc far 268 ;----------- 269 ; handle user programs formatting the disk 0 00002409 FB sti 0 0000240A FC cld 0 0000240B 1E push ds 0 0000240C 2E8E1E[0000] mov ds,[cs:DataSegment] 274 Assume DS:CGROUP 275 0 00002411 0653515657 pushx ; save work registers 0 00002416 891E[0E00] mov [i13_dma_off],bx 0 0000241A 8C06[1000] mov [i13_dma_seg],es 279 i13_deblock10: 0 0000241E 5152 pushx 0 00002420 B104 mov cl,4 0 00002422 A1[1000] mov ax,[i13_dma_seg] ; get transfer address 0 00002425 D3E0 shl ax,cl ; get A4..A15 from segment 0 00002427 0306[0E00] add ax,[i13_dma_off] ; combine with A0..A15 from offset 0 0000242B F7D0 not ax ; AX = # of bytes left in 64K bank 0 0000242D 31D2 xor dx,dx 0 0000242F B90002 mov cx,SECSIZE 0 00002432 F7F1 div cx ; convert this to physical sectors 0 00002434 8A16[0C00] mov dl,[i13_size] ; see if we can xfer amount wanted 0 00002438 38D0 cmp al,dl ; capable of more than requested? 0 0000243A 7201 jb i13_deblock20 ; skip if we can do it all 0 0000243C 92 xchg ax,dx ; we can do them all 293 i13_deblock20: 0 0000243D C41E[0E00] les bx,[i13_dma_ptr] ; do the xfer to here 0 00002441 5A59 popx 0 00002443 8A26[0D00] mov ah,[i13_op] ; get read/write/verify operation 0 00002447 84C0 test al,al ; if zero length possible 0 00002449 7408 jz i13_deblock30 ; then deblock 0 0000244B 8CC7 mov di,es ; get transfer address 0 0000244D 3B3E[0000] cmp di,[DeblockSeg] ; is this in high memory ? 0 00002451 723E jb i13_deblock50 ; then force through deblock buffer 302 i13_deblock30: 0 00002453 1E push ds ; if deblocking then we'd better 0 00002454 07 pop es ; point at local buffer we 0 00002455 BB[0000] mov bx,offset local_buffer ; will be using for actual I/O 0 00002458 803E[0D00]03 cmp byte [i13_op],ROS_WRITE 0 0000245D 750F jne i13_deblock40 ; skip data copy if not writing to disk 0 0000245F 1E push ds 0 00002460 51 push cx 0 00002461 89DF mov di,bx ; ES:DI -> local buffer 0 00002463 C536[0E00] lds si,[i13_dma_ptr] ; DS:SI -> data to write 0 00002467 B90001 mov cx,SECSIZE/2 0 0000246A F3A5 rep movsw ; copy to deblocking buffer 0 0000246C 59 pop cx 0 0000246D 1F pop ds 316 i13_deblock40: 0 0000246E B001 mov al,1 ; do a single sector via buffer 0 00002470 F8 clc 0 00002471 9C pushf ; fake an Int 0 00002472 FF1E[0000] call far [i13pointer] ; to the track handler 0 00002476 7272 jc i13_deblock90 ; stop on error 0 00002478 B001 mov al,1 ; restore AL for buggy bios's 0 0000247A 803E[0D00]02 cmp byte [i13_op],ROS_READ ; if we are reading then we'll 0 0000247F 751C jne i13_deblock60 ; have to copy data out of 0 00002481 51 push cx ; the deblocking buffer 0 00002482 C43E[0E00] les di,[i13_dma_ptr] ; ES:DI -> dest for data 0 00002486 BE[0000] mov si,offset local_buffer ; point at local buffer which 0 00002489 B90001 mov cx,SECSIZE/2 ; contains actual data 0 0000248C F3A5 rep movsw ; copy from deblocking buffer 0 0000248E 59 pop cx 0 0000248F EB0C jmps i13_deblock60 332 333 i13_deblock50: 0 00002491 50 push ax ; save # sectors in xfer 0 00002492 F8 clc 0 00002493 9C pushf ; fake an Int 0 00002494 FF1E[0000] call far [i13pointer] ; do the operation 0 00002498 5B pop bx 0 00002499 88D8 mov al,bl ; restore AL for buggy bios's 0 0000249B 724D jc i13_deblock90 ; stop on error 341 i13_deblock60: ; we succeeded in doing AL sectors 0 0000249D 2806[0C00] sub [i13_size],al ; forget about those we have done 0 000024A1 7647 jbe i13_deblock90 ; and do more if there are any 0 000024A3 50 push ax 0 000024A4 B420 mov ah,SECSIZE/16 0 000024A6 F6E4 mul ah ; AX = paras to inc DMA address 0 000024A8 0106[1000] add [i13_dma_seg],ax ; up DMA address by this amount 0 000024AC 58 pop ax 0 000024AD E84300 call i13_point_unit ; ES:DI -> UDSC_ 0 000024B0 7238 jc i13_deblock90 ; exit if we can't find it 0 000024B2 89CB mov bx,cx ; get sector/cylinder in BX 0 000024B4 83E33F and bx,0003Fh ; BX = sector 0 000024B7 83E1C0 and cx,0FFC0h ; CX = mandled cylinder bits 0 000024BA 00C3 add bl,al ; work out new sector 355 i13_deblock70: 356 UDSC.UDSCBPB equ UDSCBPB ; NASM port label 357 BPB.SPT equ SPT ; NASM port label 0 000024BC 268B4513 mov ax,[es:di+UDSC.UDSCBPB+BPB.SPT] 0 000024C0 39C3 cmp bx,ax ; still on the same track ? 0 000024C2 7621 jbe i13_deblock80 ; easy if no overflow onto next track 0 000024C4 29C3 sub bx,ax ; subtract a tracks worth 0 000024C6 FEC6 inc dh ; and move onto next head 0 000024C8 88F0 mov al,dh ; isolate head from cylinder 0 000024CA 83E03F and ax,003Fh ; bits 10/11 365 BPB.HEADS equ HEADS ; NASM port label 0 000024CD 263B4515 cmp ax,[es:di+UDSC.UDSCBPB+BPB.HEADS] 0 000024D1 72E9 jb i13_deblock70 ; onto next track yet ? 0 000024D3 80E6C0 and dh,0C0h ; back to head zero 0 000024D6 80C501 add ch,1 ; onto next track (bits 0-7) 0 000024D9 73E1 jnc i13_deblock70 ; overflow to bits 8-9 ? 0 000024DB 80C140 add cl,040h ; yes, "inc" bits 8/9 of cylinder 0 000024DE 73DC jnc i13_deblock70 ; overflow to bits 10-11 ? 0 000024E0 80C640 add dh,040h ; yes, "inc" bits 10/11 of cylinder 0 000024E3 EBD7 jmps i13_deblock70 375 376 i13_deblock80: 0 000024E5 09D9 or cx,bx ; recombine sector/cylinder 0 000024E7 E934FF jmp i13_deblock10 ; and do some more 379 380 i13_deblock90: 0 000024EA 5F5E595B07 popx ; restore work registers 0 000024EF 1F pop ds ; recover user DS 0 000024F0 CA0200 ret 2 ; return to user with result 384 385 i13_point_unit proc near 386 ;------------- 387 ; On Entry: 388 ; DL = ROS unit 389 ; On Exit: 390 ; ES:DI -> UDSC_ for that unit 391 ; All other regs preserved 392 ; 0 000024F3 C43E[0000] les di,[udsc_root] ; ES:DI -> 1st es:UDSC_ 394 i13_point_unit10: 395 UDSC.RUNIT equ RUNIT ; NASM port label 0 000024F7 263A5504 cmp dl,[es:UDSC.RUNIT + di] ; find the physical unit 0 000024FB 740B je i13_point_unit20 398 UDSC.NEXT equ NEXT ; NASM port label 0 000024FD 26C43D les di,[es:UDSC.NEXT + di] 0 00002500 83FFFF cmp di,0FFFFh ; else try the next es:UDSC_ 0 00002503 75F2 jne i13_point_unit10 0 00002505 B409 mov ah,09h ; return DMA error to caller as we 0 00002507 F9 stc ; don't know about this unit 404 i13_point_unit20: 0 00002508 C3 ret 406 i13_point_unit endp 407 408 Int13Deblock endp 409 410 i13_unsure proc near 411 ;--------- 412 ; mark physical drive DL as unsure 413 ; 0 00002509 1E56 pushx 0 0000250B C536[0000] lds si,[udsc_root] 416 i13_unsure10: 0 0000250F 3A5404 cmp dl,[UDSC.RUNIT + si] ; does it match ROS drive? 0 00002512 7504 jne i13_unsure20 ; skip if not 419 UDSC.FLAGS equ FLAGS ; NASM port label 0 00002514 834C3F04 or word [UDSC.FLAGS + si],UDF_UNSURE 421 i13_unsure20: ; next drive 0 00002518 C534 lds si,[UDSC.NEXT + si] 0 0000251A 83FEFF cmp si,0FFFFh 0 0000251D 75F0 jne i13_unsure10 0 0000251F 5E1F popx ; restore registers 0 00002521 C3 ret 427 428 i13_unsure endp 429 430 Assume DS:Nothing, SS:Nothing, ES:Nothing 431 432 Public Int2FHandler 433 434 Int2FHandler proc far 435 ;----------- 436 ; On Entry we have offset/seg of next in chain on the stack 437 ; (ie. we can pass on by a RETF) 438 ; 0 00002522 80FC08 cmp ah,8 ; DRIVER.SYS support 0 00002525 7423 je i2F_driver 0 00002527 80FC13 cmp ah,13h ; int13 intercept 0 0000252A 751D jne i2F_iret 443 ; 444 ; Int 13 interception support 445 ; --------------------------- 446 ; 447 ; On Entry: 448 ; DS:DX -> New Int 13 vector 449 ; ES:BX -> Int 13 vector restored by Int 19 450 ; 451 ; On Exit: 452 ; DS:DX -> Old Int 13 vector 453 ; ES:BX -> Old Int 13 vector restored by Int 19 454 ; 455 i2F_i13_intercept: 0 0000252C 8CD8 mov ax,ds 0 0000252E 2E8E1E[0000] mov ds,[cs:DataSegment] 458 Assume DS:CGROUP 0 00002533 8716[0000] xchg dx,[i13off_save] 0 00002537 8706[0000] xchg ax,[i13seg_save] 0 0000253B 50 push ax 0 0000253C 871E[0000] xchg bx,word ptr [orgInt13] 0 00002540 8CC0 mov ax,es 0 00002542 8706[0200] xchg ax,word ptr [orgInt13+2] 0 00002546 8EC0 mov es,ax 0 00002548 1F pop ds 467 Assume DS:Nothing 468 i2F_iret: 0 00002549 CF iret 470 471 472 ; 473 ; DRIVER.SYS support 474 ; ------------------- 475 ; 476 ; On Entry: 477 ; AX=0800, installation check 478 ; AX=0801, add new block device at DS:SI 479 ; AX=0802, execute driver request at ES:BX 480 ; AX=0803, return address of first es:UDSC_ 481 ; 482 i2F_driver: 0 0000254A 3C01 cmp al,1 0 0000254C 7209 jb i2F_driver_check 0 0000254E 740A je i2F_driver_add 0 00002550 3C03 cmp al,3 0 00002552 721F jb i2F_driver_req 0 00002554 7413 je i2F_driver_point 0 00002556 CF iret 490 491 i2F_driver_check: 492 ; 493 ; Installation check 494 ; 0 00002557 B0FF mov al,0ffh ; say we are installed 0 00002559 CF iret 497 498 i2F_driver_add: 499 ; 500 ; Add new block device DS:DI 501 ; 0 0000255A 1E push ds 0 0000255B 06 push es 0 0000255C 1E push ds 0 0000255D 07 pop es ; ES:DI -> unit 0 0000255E 2E8E1E[0000] mov ds,[cs:DataSegment] 0 00002563 E87400 call add_unit 0 00002566 07 pop es 0 00002567 1F pop ds 0 00002568 CF iret 511 512 i2F_driver_point: 513 ; 514 ; return DS:DI -> first UDSC_ 515 ; 0 00002569 2E8E1E[0000] mov ds,[cs:DataSegment] ; DS -> our data 0 0000256E C53E[0000] lds di,[udsc_root] 0 00002572 CF iret 519 ; 520 ; Execute DRIVER.SYS request ES:BX 521 ; 522 i2F_driver_req: 0 00002573 1E push ds 0 00002574 2E8E1E[0000] mov ds,[cs:DataSegment] 525 Assume DS:CGROUP 0 00002579 891E[0000] mov [req_off],bx ; fill in request pointer 0 0000257D 8C06[0000] mov [req_seg],es ; as if it was local 0 00002581 1F pop ds 529 Assume DS:Nothing 0 00002582 2EFF36[A601] push word [cs:driverTable] ; fiddle the table address 0 00002587 E9[0000] jmp DriverFunction ; then go to normal handler 532 533 extrn DriverFunction:near 534 extrn IntDiskTable:word ; = DiskTable 535 0 0000258A [0000] driverTable dw offset IntDiskTable ; push address of table on 537 ; stack as DriverFunction 538 ; examines it 539 540 Int2FHandler endp 541 542 Assume DS:CGROUP, SS:Nothing, ES:Nothing 543 544 Public DiskTable 545 546 DiskTable label word 0 0000258C 18 db 24 ; Last supported function 0 0000258D [0000] dw dd_init ; 0-initialize driver 0 0000258F [4C02] dw dd_medchk ; 1-media change check 0 00002591 [F302] dw dd_build_bpb ; 2-build BIOS Parameter Block 0 00002593 [4802] dw dd_error ; 3-IOCTL string input 0 00002595 [1305] dw dd_input ; 4-input 0 00002597 [4802] dw dd_error ; 5-nondestructive input (char only) 0 00002599 [4802] dw dd_error ; 6-input status (char only) 0 0000259B [4802] dw dd_error ; 7-input flush 0 0000259D [0705] dw dd_output ; 8-output 0 0000259F [0D05] dw dd_output_vfy ; 9-output with verify 0 000025A1 [4802] dw dd_error ; 10-output status (char only) 0 000025A3 [4802] dw dd_error ; 11-output flush (char only) 0 000025A5 [4802] dw dd_error ; 12-IOCTL string output 0 000025A7 [CA07] dw dd_open ; 13-device open 0 000025A9 [D407] dw dd_close ; 14-device close 0 000025AB [DE07] dw dd_remchk ; 15-removable media check 0 000025AD [4802] dw dd_error ; 16-n/a 0 000025AF [4802] dw dd_error ; 17-n/a 0 000025B1 [4802] dw dd_error ; 18-n/a 0 000025B3 [EF07] dw dd_genioctl ; 19-generic IOCTL 0 000025B5 [4802] dw dd_error ; 20-n/a 0 000025B7 [4802] dw dd_error ; 21-n/a 0 000025B9 [4802] dw dd_error ; 22-n/a 0 000025BB [300C] dw dd_getdev ; 23-get logical drive 0 000025BD [380C] dw dd_setdev ; 24-set logical drive 573 574 575 point_unit: ; get unit descriptor for work drive 576 ;---------- 577 ; On Entry: 578 ; ES:BX -> Request Header 579 ; On Exit: 580 ; AL = logical drive 581 ; ES:DI -> es:UDSC_ 582 ; (All other registers preserved) 583 ; 0 000025BF 268A4701 mov al,[es:RH_UNIT + bx] ; get the unit number (0=A:, 1=B:, etc) 0 000025C3 C43E[0000] les di,[udsc_root] ; ES:DI -> 1st es:UDSC_ 586 point_unit10: 587 UDSC.DRIVE equ DRIVE ; NASM port label 0 000025C7 263A4505 cmp al,[es:UDSC.DRIVE + di] ; stop if the logical drive matches 0 000025CB 740C je point_unit20 0 000025CD 26C43D les di,[es:UDSC.NEXT + di] 0 000025D0 83FFFF cmp di,0FFFFh ; else try the next es:UDSC_ 0 000025D3 75F2 jne point_unit10 0 000025D5 58 pop ax ; don't return to the caller 0 000025D6 B80180 mov ax,RHS_ERROR+1 ; return "invalid unit" error 595 point_unit20: 0 000025D9 C3 ret 597 598 add_unit: ; add a new unit to the list 599 ;-------- 600 ; On Entry: 601 ; ES:DI -> UDSC to add 602 ; On Exit: 603 ; ES:DI preserved 604 ; 0 000025DA 268A4505 mov al,[es:UDSC.DRIVE + di] ; get the logical unit 0 000025DE 3C1A cmp al,MAXPART ; is it too many ? 0 000025E0 7349 jae add_unit40 0 000025E2 1E push ds 0 000025E3 26C705FFFF mov word ptr [es:UDSC.NEXT + di],0FFFFh 610 ; make sure it's terminated 0 000025E8 2681653F0306 and word [es:UDSC.FLAGS + di],UDF_LBA+UDF_HARD+UDF_CHGLINE+UDF_NOACCESS 0 000025EE 8D36[0000] lea si,[udsc_root] ; DS:SI -> [first UDSC_] 613 add_unit10: 0 000025F2 833CFF cmp word ptr [UDSC.NEXT + si],0FFFFh 0 000025F5 742E je add_unit30 0 000025F7 C534 lds si,[UDSC.NEXT + si] ; DS:SI -> UDSC_ we already have 0 000025F9 268A4504 mov al,[es:UDSC.RUNIT + di] 0 000025FD 3A4404 cmp al,[UDSC.RUNIT + si] ; do the logical units match ? 0 00002600 75F0 jne add_unit10 0 00002602 8B443F mov ax,[UDSC.FLAGS + si] ; inherit some flags 0 00002605 50 push ax 0 00002606 250304 and ax,UDF_LBA+UDF_HARD+UDF_CHGLINE 0 00002609 2609453F or [es:UDSC.FLAGS + di],ax ; hard disk/changeline inherited 0 0000260D 58 pop ax 0 0000260E A90100 test ax,UDF_HARD 0 00002611 75DF jnz add_unit10 ; skip owner stuff on hard drive 0 00002613 A91000 test ax,UDF_VFLOPPY ; is this a multiple drive anyway ? 0 00002616 7506 jnz add_unit20 0 00002618 83C830 or ax,UDF_OWNER+UDF_VFLOPPY 0 0000261B 89443F mov [UDSC.FLAGS + si],ax ; no, 1st person becomes owner 631 add_unit20: 0 0000261E 26834D3F10 or word [es:UDSC.FLAGS + di],UDF_VFLOPPY 0 00002623 EBCD jmps add_unit10 ; go and try the next 634 add_unit30: 0 00002625 893C mov word ptr [UDSC.NEXT + si],di 0 00002627 8C4402 mov word ptr [UDSC.NEXT+2 + si],es 0 0000262A 1F pop ds 638 add_unit40: 0 0000262B C3 ret 640 641 dd_error: ; 3-IOCTL string input 642 ;-------- 0 0000262C B80380 mov ax,RHS_ERROR+3 ; "invalid command" error 0 0000262F C3 ret 645 646 dd_medchk: ; 1-media change check 647 ;--------- 648 ; entry: ES:BX -> request header 649 ; exit: RH1_RETURN = 0, 1 or FF 650 ; 00 = media may have changed 651 ; 01 = media hasn't changed 652 ; FF = media has been changed 653 0 00002630 E88CFF call point_unit ; get unit descriptor 0 00002633 26F7453F0100 test word [es:UDSC.FLAGS + di],UDF_HARD 0 00002639 7526 jnz medchk2 ; "hasn't changed" if hard disk 0 0000263B E8710A call ask_for_disk ; make sure we've got correct floppy 0 0000263E 268B453F mov ax,[es:UDSC.FLAGS + di] ; get flags 0 00002642 A90400 test ax,UDF_UNSURE ; has format/diskcopy occurred? 0 00002645 757F jnz medchk6 ; may have changed to different format 0 00002647 A90200 test ax,UDF_CHGLINE 0 0000264A 7419 jz medchk3 ; skip ROS call if no change line 0 0000264C 268A5504 mov dl,[es:UDSC.RUNIT + di] 0 00002650 88D0 mov al,dl ; don't trust changeline if we are 0 00002652 8606[1200] xchg al,[activeRosUnit] ; changing floppies 0 00002656 38D0 cmp al,dl ; return may have changed 0 00002658 750B jne medchk3 0 0000265A B416 mov ah,ROS_DSKCHG ; get disk change status function 0 0000265C E885FD int_____DISK_INT ; AH=0: DC low, AH=6: DC active 0 0000265F 721E jc medchk5 ; disk change not active? 671 medchk2: 0 00002661 B001 mov al,01h ; disk hasn't changed 0 00002663 EB63 jmps medchk_ret 674 675 676 medchk3: ; no changeline support, use timer 0 00002665 E8[0000] call read_system_ticks ; get system tick count in CX/DX 0 00002668 89D0 mov ax,dx 0 0000266A 26874579 xchg ax,[es:UDSC.TIMER + di] ; get previous time and update 0 0000266E 29C2 sub dx,ax 0 00002670 89C8 mov ax,cx 0 00002672 2687457B xchg ax,[es:UDSC.TIMER+2 + di] 0 00002676 19C1 sbb cx,ax ; CX/DX = # ticks since last access 0 00002678 7505 jne medchk5 ; media could have changed if > 64k 0 0000267A 83FA36 cmp dx,18*3 ; more than three seconds expired? 0 0000267D 72E2 jb medchk2 ; "not changed" if access too recent 687 medchk5: 0 0000267F B90100 mov cx,1 ; read track 0, sector 1 (boot sector) 0 00002682 E83C02 call login_read ; to check the builtin BPB 0 00002685 723F jc medchk6 ; may have changed if read error 691 BPB.FATID equ FATID ; NASM port label 0 00002687 A0[1500] mov al,[local_buffer+BPB_SECTOR_OFFSET+BPB.FATID] 0 0000268A 3CF0 cmp al,0F0h ; check if we find a BPB 0 0000268C 7238 jb medchk6 ; may have changed if not good BPB 0 0000268E 263A4510 cmp al,[es:UDSC.UDSCBPB+BPB.FATID + di] 0 00002692 7522 jne medchk8 ; has media byte changed ? 697 ; point si to FAT16 ext. boot sig 0 00002694 BE[2600] mov si,offset local_buffer+BPB_SECTOR_OFFSET+OLD_UDSC_BPB_LENGTH+2 699 700 BPB.DIRMAX equ DIRMAX ; NASM port label 0 00002697 833E[1100]00 cmp word [local_buffer+BPB_SECTOR_OFFSET+BPB.DIRMAX],0 0 0000269C 7503 jnz medchkf16 ; is it not FAT32? 703 ; FAT32 => adjust si to DOS 7.1 EBPB 0 0000269E BE[4200] mov si,offset local_buffer+BPB_SECTOR_OFFSET+UDSC_BPB_LENGTH+2 705 medchkf16: 0 000026A1 AC lodsb ; get extended boot 0 000026A2 2C29 sub al,29h ; do we have an extended boot ? 0 000026A4 7403 je medchk7 ; no, test against our dummy value 0 000026A6 BE[BA03] mov si,offset dummyMediaID 710 medchk7: 0 000026A9 57 push di 712 UDSC.SERIAL equ SERIAL ; NASM port label 0 000026AA 8DBD8900 lea di,[UDSC.SERIAL + di] 0 000026AE B90200 mov cx,2 0 000026B1 F3A7 repe cmpsw ; is serial number unchanged ? 0 000026B3 5F pop di 0 000026B4 7410 je medchk6 ; then return may have changed 718 medchk8: 719 UDSC.LABL equ LABL ; NASM port label 0 000026B6 8D457D lea ax,[UDSC.LABL + di] ; ES:AX -> ASCII label 721 P_DSTRUC.REQUEST equ REQUEST ; NASM port label 0 000026B9 C55E02 lds bx,[P_DSTRUC.REQUEST + bp] 0 000026BC 89470F mov word ptr [RH1_VOLID + bx],ax 0 000026BF 8C4711 mov word ptr [RH1_VOLID+2 + bx],es 0 000026C2 B0FF mov al,0FFH ; return disk changed 0 000026C4 EB02 jmps medchk_ret 727 728 medchk6: 0 000026C6 B000 mov al,00h ; disk may have changed 730 731 medchk_ret: 0 000026C8 2683653FFB and word [es:UDSC.FLAGS + di],~ UDF_UNSURE 0 000026CD C45E02 les bx,[P_DSTRUC.REQUEST + bp] 0 000026D0 2688470E mov [es:RH1_RETURN + bx],al ; set return value 0 000026D4 29C0 sub ax,ax 0 000026D6 C3 ret 737 738 739 ; page 740 dd_build_bpb: ; 2-build BIOS Parameter Block 741 ;------------ 0 000026D7 E8E5FE call point_unit ; get unit descriptor 0 000026DA 26F7453F0100 test word [es:UDSC.FLAGS + di],UDF_HARD 0 000026E0 7505 jnz bldbpb1 ; BPB doesn't change for hard disks 0 000026E2 E82300 call login_media ; try to determine media type (BPB) 0 000026E5 721E jc bldbpb_err 747 bldbpb1: 748 UDSC.OPNCNT equ OPNCNT ; NASM port label 0 000026E7 26C7453C0000 mov word [es:UDSC.OPNCNT + di],0 ; no files open at this time 0 000026ED 2683653FFB and word [es:UDSC.FLAGS + di],~ UDF_UNSURE 751 ; media is sure 0 000026F2 8D7506 lea si,[UDSC.UDSCBPB + di] 0 000026F5 8CC0 mov ax,es 0 000026F7 C45E02 les bx,[P_DSTRUC.REQUEST + bp] 0 000026FA 26897712 mov [es:RH2_BPBOFF + bx],si ; return the current BPB 0 000026FE 26894714 mov [es:RH2_BPBSEG + bx],ax 757 0 00002702 31C0 xor ax,ax 0 00002704 C3 ret 760 761 bldbpb_err: 0 00002705 E93302 jmp xlat_error ; return error code 763 ; ret 764 765 766 767 login_media: ; determine BPB for new floppy disk 768 ;----------- 0 00002708 1E push ds 0 00002709 B90100 mov cx,1 ; read track 0, sector 1 (boot) 0 0000270C E8B201 call login_read ; to determine media type 0 0000270F B400 mov ah,0 ; AH=0 is general failure code on carry 0 00002711 7243 jc login_media_err ; abort if physical error 0 00002713 803E[1500]F0 cmp byte [local_buffer+BPB_SECTOR_OFFSET+BPB.FATID],0F0h 0 00002718 7219 jb login_media10 ; fail unless FATID sensible 0 0000271A AD lodsw ; get JMP instruction from boot sector 0 0000271B 93 xchg ax,bx ; save in BX 0 0000271C AC lodsb ; get next 3rd byte in AX 0 0000271D 83C608 add si,8 ; skip JMP, OEM name, SI -> BPB 0 00002720 80FBE9 cmp bl,0E9h ; does it start with a JMP ? 0 00002723 7444 je login_media40 0 00002725 80FB69 cmp bl,069h 0 00002728 743F je login_media40 0 0000272A 80FBEB cmp bl,0EBh ; how about a JMPS ? 0 0000272D 7504 jne login_media10 0 0000272F 3C90 cmp al,090h ; then we need a NOP 0 00002731 7436 je login_media40 788 login_media10: 0 00002733 B90200 mov cx,2 ; read track 0, sector 2 (FAT) 0 00002736 E88801 call login_read ; try to read the sector 0 00002739 B400 mov ah,0 ; AH=0 is general failure code on carry 0 0000273B 7219 jc login_media_err ; abort if physical error 0 0000273D 837C01FF cmp word ptr [1 + si],-1 ; bytes 1, 2 must be 0FFh, 0FFh 0 00002741 B407 mov ah,7 ; bad media type error 0 00002743 7511 jne login_media_err ; error if bad fat 0 00002745 AC lodsb ; else get FAT ID byte 0 00002746 BE[0000] mov si,offset bpb160 ; look through builtin BPB table 0 00002749 B9[0000] mov cx,NBPBS ; # of builtin BPBs 799 login_media20: 0 0000274C 3A440A cmp al,[BPB.FATID + si] ; does it match one we know? 0 0000274F 7418 je login_media40 ; yes, use builtin BPB 0 00002751 83C635 add si,BPB_LENGTH ; else move to next BPB 0 00002754 E2F6 loop login_media20 ; repeat for all BPBs 804 login_media_err: ; can't read BPB 0 00002756 26834D3F04 or word [es:UDSC.FLAGS + di],UDF_UNSURE ; mark as UNSURE 806 UDSC.DEVBPB equ DEVBPB ; NASM port label 0 0000275B 8D7543 lea si,[UDSC.DEVBPB + di] ; copy DEVBPB into BPB 0 0000275E 8D7D06 lea di,[UDSC.UDSCBPB + di] 0 00002761 06 push es 0 00002762 1F pop ds 0 00002763 E84F00 call copy_bpb ; copy DEVBPB into BPB 0 00002766 F9 stc ; mark as error 0 00002767 1F pop ds 0 00002768 C3 ret ; error code in AH 815 login_media40: 0 00002769 57 push di 0 0000276A 8D7D06 lea di,[UDSC.UDSCBPB + di] ; ES:DI -> unit descriptor (UDSC) 0 0000276D E84500 call copy_bpb 0 00002770 5F pop di 820 BPB.SECSIZ equ SECSIZ ; NASM port label 0 00002771 26C745060002 mov word [es:di+UDSC.UDSCBPB+BPB.SECSIZ],SECSIZE 822 BPB.HIDDEN equ HIDDEN ; NASM port label 0 00002777 26894D17 mov word ptr [es:(UDSC.UDSCBPB+BPB.HIDDEN) + di],cx 0 0000277B 26894D19 mov word ptr [es:(UDSC.UDSCBPB+BPB.HIDDEN+2) + di],cx 0 0000277F 81FE[2400] cmp si,offset local_buffer+OLD_UDSC_BPB_LENGTH+BPB_SECTOR_OFFSET 0 00002783 7408 je login_media70 0 00002785 81FE[4000] cmp si,offset local_buffer+UDSC_BPB_LENGTH+BPB_SECTOR_OFFSET 0 00002789 7402 je login_media70 0 0000278B EB06 jmp login_media50 830 login_media70: 0 0000278D AD lodsw ; skip 2 bytes 0 0000278E AC lodsb ; now get possible boot signature 0 0000278F 3C29 cmp al,29h ; is it an extended boot sector ? 0 00002791 7405 je login_media60 ; yes, use it 835 login_media50: 0 00002793 0E push cs ; no bootsector BPB, load dummy values 0 00002794 1F pop ds ; DS:SI -> our dummy value 0 00002795 BE[BA03] mov si,offset dummyMediaID 839 login_media60: 0 00002798 E82900 call UpdateMediaID ; update UDSC_ with media info 0 0000279B F8 clc 0 0000279C 1F pop ds 0 0000279D C3 ret 844 0 0000279E 00000000 dummyMediaID dd 0 ; serial number 0 0 000027A2 4E4F204E414D452020 db 'NO NAME ' 0 000027AB 2020 0 000027AD 4641543132202020 db 'FAT12 ' 848 849 ; copy BPB 850 ; IN: DS:SI -> source BPB ; ES:DI -> target BPB 851 ; OUT: CX = 0 ; SI and DI advanced by BPB size 852 copy_bpb proc 0 000027B5 B91900 mov cx,OLD_UDSC_BPB_LENGTH 0 000027B8 837C0600 cmp word ptr [BPB.DIRMAX + si],0 ; test for FAT32 0 000027BC 7503 jne @@no_fat32 0 000027BE B93500 mov cx,UDSC_BPB_LENGTH ; size of FAT32 BPB 857 @@no_fat32: 0 000027C1 F3A4 rep movsb 0 000027C3 C3 ret 860 copy_bpb endp 861 862 UpdateMediaID: 863 ;------------- 864 ; On Entry: 865 ; DS:SI -> extended boot record info 866 ; ES:DI -> UDSC_ to update 867 ; On Exit: 868 ; ES:DI preserved 869 ; 0 000027C4 57 push di 0 000027C5 31C0 xor ax,ax ; AX = a handy zero 0 000027C7 8DBD8900 lea di,[UDSC.SERIAL + di] 0 000027CB A5 movsw 0 000027CC A5 movsw ; copy serial number 0 000027CD 5F pop di 0 000027CE 57 push di 0 000027CF 8D7D7D lea di,[UDSC.LABL + di] 0 000027D2 B90B00 mov cx,11 0 000027D5 F3A4 rep movsb ; copy the volume label 0 000027D7 AA stosb ; zero terminate it 0 000027D8 5F pop di 0 000027D9 57 push di 883 UDSC.FSTYPE equ FSTYPE ; NASM port label 0 000027DA 8DBD8D00 lea di,[UDSC.FSTYPE + di] 0 000027DE A5 movsw 0 000027DF A5 movsw 0 000027E0 A5 movsw 0 000027E1 A5 movsw ; copy the file system type 0 000027E2 AA stosb ; zero terminate it 0 000027E3 5F pop di 0 000027E4 C3 ret 892 893 getdrivegeo: ; get number of heads & sectors 894 ;------------- 895 ; On Entry: 896 ; DL unit 897 ; On Exit: 898 ; max_head & max_sect 899 0 000027E5 51520657 pushx 0 000027E9 B408 mov ah,ROS_PARAM ; get drive parameters 0 000027EB E8F6FB int_____DISK_INT 0 000027EE 30D2 xor dl,dl ; isolate head bits 0 000027F0 86F2 xchg dh,dl 0 000027F2 42 inc dx 0 000027F3 2E8916[2E0D] mov [cs:max_head],dx ; number of heads on this drive 0 000027F8 83E13F and cx,3fh ; isolate sector bits 0 000027FB 2E890E[300D] mov [cs:max_sect],cx ; number of sectors per track on this drive 0 00002800 5F075A59 popx 0 00002804 C3 ret 911 912 login_CHS2LBA: 913 ;------------- 914 ; On Entry: 915 ; DH head 916 ; DL unit 917 ; CX cylinder and sector 918 ; DS:SI -> disk address packet structure 919 ; On Exit: 920 ; LBA data in disk address packet 921 0 00002805 E8DDFF call getdrivegeo 0 00002808 52 push dx 0 00002809 89C8 mov ax,cx ; isolate cylinder bits 0 0000280B 83E0C0 and ax,0ffc0h 0 0000280E 86E0 xchg ah,al ; compute 10-bit cylinder number 0 00002810 D0C4 rol ah,1 0 00002812 D0C4 rol ah,1 0 00002814 88F3 mov bl,dh ; isolate head bits 0 00002816 30FF xor bh,bh 0 00002818 2EF726[2E0D] mul word [cs:max_head] ; multiply with number of heads 0 0000281D 01D8 add ax,bx ; add head number 0 0000281F 83D200 adc dx,0 0 00002822 50 push ax 0 00002823 89D0 mov ax,dx ; multiply with sectors per track 0 00002825 2EF726[300D] mul word [cs:max_sect] 0 0000282A 89440A mov word ptr [si+10],ax 0 0000282D 89540C mov word ptr [si+12],dx 0 00002830 58 pop ax 0 00002831 2EF726[300D] mul word [cs:max_sect] 0 00002836 83E13F and cx,3fh ; isolate sector bits 0 00002839 49 dec cx 0 0000283A 894C08 mov word ptr [si+8],cx ; add products and sector number 0 0000283D 014408 add word ptr [si+8],ax 0 00002840 11540A adc word ptr [si+10],dx 0 00002843 83540C00 adc word ptr [si+12],0 0 00002847 5A pop dx 0 00002848 C3 ret 949 950 login_LBA2CHS: 951 ;------------- 952 ; On Entry: 953 ; DS:SI -> disk address packet structure 954 ; LBA data in disk address packet 955 ; On Exit: 956 ; DH head 957 ; DL unit 958 ; CX cylinder and sector 959 0 00002849 E899FF call getdrivegeo 0 0000284C 52 push dx ; save unit number 0 0000284D BA0000 mov dx,0 ; divide high word of LBA block number 0 00002850 8B440A mov ax,word ptr [si+10] 0 00002853 2EF736[300D] div word [cs:max_sect] 0 00002858 50 push ax ; high word of quotient 0 00002859 8B4408 mov ax,word ptr [si+8] ; divide low word & remainder 0 0000285C 2EF736[300D] div word [cs:max_sect] 0 00002861 89D1 mov cx,dx ; remainder = sector number 0 00002863 41 inc cx ; sector count starts with 1 0 00002864 5A pop dx ; get high word 0 00002865 2EF736[2E0D] div word [cs:max_head] ; divide through number of heads 0 0000286A D0CC ror ah,1 ; convert cylinder and sector number to CHS format 0 0000286C D0CC ror ah,1 0 0000286E 86E0 xchg ah,al 0 00002870 09C1 or cx,ax 0 00002872 86F2 xchg dh,dl ; head number to DH 0 00002874 58 pop ax ; get unit number 0 00002875 88C2 mov dl,al 0 00002877 C3 ret 980 981 login_read_lba: 982 ; entry: CH, CL = cylinder/sector to read 983 ; exit: CY = 1, AH = status if error 984 ; else local_buffer filled in 985 0 00002878 268A5504 mov dl,[es:UDSC.RUNIT + di] ; DL = ROS drive 0 0000287C B600 mov dh,0 ; DH = head number 988 989 login_read_dx_lba: ; read on drive DL, head DH 990 ;------------- ; (entry for hard disk login) 991 ; On Entry: 992 ; DS:SI -> disk address packet 993 ; DL unit number 994 995 P_STRUC.RETRY equ RETRY ; NASM port label 0 0000287E C6460A03 mov byte [P_STRUC.RETRY + bp],RETRY_MAX ; initialize retry count 997 logrd1_lba: 0 00002882 F706[0C00]0100 test word [int13ex_bits],1 ; LBA support present? 0 00002888 7414 jz logrd1a_lba ; no, then use old CHS method 0 0000288A C744020100 mov word ptr [si+2],1 ; read one sector 0 0000288F C74404[0000] mov word ptr [si+4],offset local_buffer ; address of transfer buffer 0 00002894 8C5C06 mov word ptr [si+6],DS 0 00002897 B442 mov ah,ROS_LBAREAD 0 00002899 E848FB int_____DISK_INT 0 0000289C EB10 jmp logrd1b_lba 1006 logrd1a_lba: 0 0000289E E8A8FF call login_LBA2CHS ; convert LBA parameters to CHS 0 000028A1 06 push es 0 000028A2 B80102 mov ax,ROS_READ*256 + 1 ; read one sector from ROS 0 000028A5 1E push ds 0 000028A6 07 pop es ; ES = DS = local segment 0 000028A7 BB[0000] mov bx,offset local_buffer 0 000028AA E837FB int_____DISK_INT ; call the ROM BIOS 0 000028AD 07 pop es 1015 logrd1b_lba: 0 000028AE 730D jnc logrd3_lba ; skip if no disk error 0 000028B0 50 push ax 1018 ; mov ah,ROS_RESET 0 000028B1 31C0 xor ax,ax 0 000028B3 E82EFB int_____DISK_INT ; reset the drive 0 000028B6 58 pop ax 0 000028B7 FE4E0A dec byte [P_STRUC.RETRY + bp] 0 000028BA 75C6 jnz logrd1_lba ; loop back if more retries 1024 logrd2_lba: 0 000028BC F9 stc 1026 logrd3_lba: 0 000028BD BE[0000] mov si,offset local_buffer 0 000028C0 C3 ret 1029 1030 login_read: 1031 ; entry: CH, CL = cylinder/sector to read 1032 ; exit: CY = 1, AH = status if error 1033 ; else local_buffer filled in 1034 0 000028C1 268A5504 mov dl,[es:UDSC.RUNIT + di] ; DL = ROS drive 0 000028C5 B600 mov dh,0 ; DH = head number 1037 1038 login_read_dx: ; read on drive DL, head DH 1039 ;------------- ; (entry for hard disk login) 0 000028C7 C6460A03 mov byte [P_STRUC.RETRY + bp],RETRY_MAX ; initialize retry count 1041 logrd1: 0 000028CB 06 push es 0 000028CC B80102 mov ax,ROS_READ*256 + 1 ; read one sector from ROS 0 000028CF 1E push ds 0 000028D0 07 pop es ; ES = DS = local segment 0 000028D1 BB[0000] mov bx,offset local_buffer 0 000028D4 E80DFB int_____DISK_INT ; call the ROM BIOS 0 000028D7 07 pop es 0 000028D8 730D jnc logrd3 ; skip if no disk error 0 000028DA 50 push ax 1051 ; mov ah,ROS_RESET 0 000028DB 31C0 xor ax,ax 0 000028DD E804FB int_____DISK_INT ; reset the drive 0 000028E0 58 pop ax 0 000028E1 FE4E0A dec byte [P_STRUC.RETRY + bp] 0 000028E4 75E5 jnz logrd1 ; loop back if more retries 1057 logrd2: 0 000028E6 F9 stc 1059 logrd3: 0 000028E7 BE[0000] mov si,offset local_buffer 0 000028EA C3 ret 1062 1063 ; page 1064 dd_output: ; 8-output 1065 ;--------- 1066 P_STRUC.ROSCMD equ ROSCMD ; NASM port label 0 000028EB C6460C03 mov byte [P_STRUC.ROSCMD + bp],ROS_WRITE ; write to floppy/hard disk 0 000028EF EB0A jmps io_common 1069 1070 dd_output_vfy: ; 9-output with verify 1071 ;------------- 0 000028F1 C6460C04 mov byte [P_STRUC.ROSCMD + bp],ROS_VERIFY ; write & verify floppy/hard disk 0 000028F5 EB04 jmps io_common 1074 1075 dd_input: ; 4-input 1076 ;-------- 0 000028F7 C6460C02 mov byte [P_STRUC.ROSCMD + bp],ROS_READ ; read from floppy/hard disk 1078 ; jmps io_common 1079 1080 io_common: ; common code for the above three 0 000028FB E8C1FC call point_unit ; get unit descriptor 0 000028FE 26F7453F0002 test word [es:UDSC.FLAGS + di],UDF_NOACCESS 0 00002904 7405 jz io_granted 0 00002906 B80780 mov ax,RHS_ERROR+7 ; bad media type 0 00002909 F9 stc 0 0000290A C3 ret 1087 io_granted: 0 0000290B E8A107 call ask_for_disk ; make sure we've got correct floppy 0 0000290E E84300 call setup_rw ; setup for read/write operation 0 00002911 7227 jc io_ret ; return if bad parameters 1091 io_loop: 0 00002913 E8DF00 call track_rw ; read as much as possible on track 0 00002916 7223 jc xlat_error ; return if physical disk error 1094 P_STRUC.COUNT equ COUNT ; NASM port label 0 00002918 837E1200 cmp word [P_STRUC.COUNT + bp],0 ; test if any more stuff to read 0 0000291C 75F5 jne io_loop ; yes, loop back for more 1097 0 0000291E 268A4504 mov al,[es:UDSC.RUNIT + di] ; remember the drive that is active 0 00002922 A2[1200] mov [activeRosUnit],al 0 00002925 26F7453F0300 test word [es:UDSC.FLAGS + di],UDF_HARD+UDF_CHGLINE 0 0000292B 750B jnz io_exit ; skip timer read for hard/changeline 1102 0 0000292D E8[0000] call read_system_ticks ; get system tick count in CX/DX 0 00002930 26895579 mov [es:UDSC.TIMER + di],dx 0 00002934 26894D7B mov [es:UDSC.TIMER+2 + di],cx ; save time of successful access 1106 io_exit: 0 00002938 31C0 xor ax,ax ; all done, no error encountered 1108 io_ret: 0 0000293A C3 ret 1110 1111 xlat_error: ; translate ROS error to DOS error 1112 ;---------- 1113 ; entry: AH = ROS disk error code, CY = 1 1114 ; exit: AX = status to be returned to BDOS 1115 0 0000293B 0657 pushx ; save some registers 0 0000293D 88E0 mov al,ah ; AL = ROS error code 0 0000293F 0E push cs 0 00002940 07 pop es 0 00002941 BF[0600] mov di,offset ros_errors ; ES:DI -> ROS error code table 0 00002944 B90900 mov cx,NUMROSERR 0 00002947 F2AE repne scasb ; scan for match 0 00002949 B80080 mov ax,RHS_ERROR ; get basic error indication 0 0000294C 2E0A4508 or al,[cs:(offset dos_errors-offset ros_errors-1) + di] 1125 ; combine with type of error 0 00002950 5F07 popx 0 00002952 F9 stc 0 00002953 C3 ret 1129 1130 1131 1132 setup_rw: ; prepare for INPUT, OUTPUT or OUTPUT_VFY 1133 ;-------- 1134 ; On Entry: 1135 ; ES:DI -> UDSC 1136 ; On Exit: 1137 ; if CY == 0: 1138 ; P_CYL, P_HEAD, P_SECTOR, 1139 ; P_DMAOFF, P_DMASEG, P_COUNT initialized 1140 ; if CY == 1: invalid parameters detected 1141 ; ES:DI preserved 1142 0 00002954 1E push ds 0 00002955 C55E02 lds bx,[P_DSTRUC.REQUEST + bp] 0 00002958 8B470E mov ax,[RH4_BUFOFF + bx] ; get offset of transfer buffer 1146 P_STRUC.DMAOFF equ DMAOFF ; NASM port label 0 0000295B 894606 mov [P_STRUC.DMAOFF + bp],ax ; set transfer offset 0 0000295E 8B4710 mov ax,[RH4_BUFSEG + bx] ; get segment of transfer buffer 1149 P_STRUC.DMASEG equ DMASEG ; NASM port label 0 00002961 894608 mov [P_STRUC.DMASEG + bp],ax ; set transfer segment 0 00002964 8B4712 mov ax,[RH4_COUNT + bx] ; get sector count from request header 0 00002967 894612 mov [P_STRUC.COUNT + bp],ax ; save it locally for later 0 0000296A 8B4714 mov ax,[RH4_SECTOR + bx] ; get low 16 bit of sector # 0 0000296D 29D2 sub dx,dx ; assume value is 16 bit only 0 0000296F 803F16 cmp byte [RH_LEN + bx],22 ; check if small request 0 00002972 741A je setrw2 ; if so forget the rest 0 00002974 803F18 cmp byte [RH_LEN + bx],24 ; check if large request 0 00002977 7505 jne setrw1 0 00002979 8B5716 mov dx,[RH4_SECTOR+2 + bx] ; yes, get 32-bit record number 0 0000297C EB10 jmps setrw2 1161 setrw1: 0 0000297E 803F1E cmp byte [RH_LEN + bx],30 0 00002981 750B jne setrw2 0 00002983 83F8FF cmp ax,-1 ; magic number indicating it's 0 00002986 7506 jne setrw2 ; a 32-bit record number 0 00002988 8B471A mov ax,[RH4_BIGSECTORLO + bx] 0 0000298B 8B571C mov dx,[RH4_BIGSECTORHI + bx] 1168 setrw2: 0 0000298E 1F pop ds 1170 0 0000298F 8B4E12 mov cx,[P_STRUC.COUNT + bp] ; get requested count 0 00002992 E31D jcxz setrw3 ; invalid count 0 00002994 49 dec cx ; CX = count - 1 1174 BPB.TOTSEC equ TOTSEC ; NASM port label 0 00002995 26837D0E00 cmp word ptr [es:(UDSC.UDSCBPB+BPB.TOTSEC) + di],0 0 0000299A 751A jne setrw4 ; skip if < 65536 sectors on disk 0 0000299C 01C8 add ax,cx 0 0000299E 83D200 adc dx,0 ; AX/DX = # of last sector for I/O 0 000029A1 720E jc setrw3 ; error if > 32 bits 1180 BPB.SIZ equ SIZ ; NASM port label 0 000029A3 263B551D cmp dx,word ptr [es:(UDSC.UDSCBPB+BPB.SIZ+2) + di] 0 000029A7 7708 ja setrw3 ; skip if too large 0 000029A9 7215 jb setrw5 ; O.K. if small enough 0 000029AB 263B451B cmp ax,word ptr [es:(UDSC.UDSCBPB+BPB.SIZ) + di] 0 000029AF 720F jb setrw5 ; fail if too large 1186 setrw3: 0 000029B1 B80880 mov ax,RHS_ERROR+8 ; return "sector not found" 0 000029B4 F9 stc 0 000029B5 C3 ret 1190 1191 setrw4: ; less than 65536 records 0 000029B6 01C8 add ax,cx ; compute end of transfer 0 000029B8 72F7 jc setrw3 ; skip if overflow 0 000029BA 263B450E cmp ax,[es:di+UDSC.UDSCBPB+BPB.TOTSEC] 0 000029BE 73F1 jae setrw3 ; skip if too large 1196 setrw5: 0 000029C0 29C8 sub ax,cx 0 000029C2 83DA00 sbb dx,0 ; add partition address for hard disk 0 000029C5 26034517 add ax,word ptr [es:di+UDSC.UDSCBPB+BPB.HIDDEN] 0 000029C9 26135519 adc dx,word ptr [es:di+UDSC.UDSCBPB+BPB.HIDDEN+2] 1201 P_STRUC.LBABLOCK equ LBABLOCK ; NASM port label 0 000029CD 894616 mov word ptr [P_STRUC.LBABLOCK + bp],ax ; Logical Block Address of start sector 0 000029D0 895618 mov word ptr [P_STRUC.LBABLOCK + bp+2],dx 0 000029D3 50 push ax ; AX/DX = 32 bit starting record address 0 000029D4 52 push dx ; save starting record 0 000029D5 268B4513 mov ax,[es:di+UDSC.UDSCBPB+BPB.SPT] 0 000029D9 26F76515 mul word [es:di+UDSC.UDSCBPB+BPB.HEADS]; get sectors per track * heads 0 000029DD 89C1 mov cx,ax ; CX = sectors per cylinder 0 000029DF 5A pop dx ; recover 32 bit start block 0 000029E0 58 pop ax 0 000029E1 F7F1 div cx ; AX = cylinder #, DX = head/sec offset 1212 P_STRUC.CYL equ CYL ; NASM port label 0 000029E3 894610 mov [P_STRUC.CYL + bp],ax ; save physical cylinder number 0 000029E6 31C0 xor ax,ax ; make remainder 32 bit so 0 000029E8 92 xchg ax,dx ; DX:AX = (head # * SPT) + sector # 0 000029E9 26F77513 div word [es:di+UDSC.UDSCBPB+BPB.SPT]; divide by sectors per track 1217 P_STRUC.SECTOR equ SECTOR ; NASM port label 0 000029ED 88560E mov [P_STRUC.SECTOR + bp],dl ; DX = sector #, AX = head # 1219 P_STRUC.HEAD equ HEAD ; NASM port label 0 000029F0 88460F mov [P_STRUC.HEAD + bp],al ; save physical sector/head for later 1221 0 000029F3 F8 clc ; tell them we like the parameters 0 000029F4 C3 ret ; we've figured out starting address 1224 1225 track_rw: 1226 ;-------- 1227 ; entry: P_CYL = cylinder for start of transfer 1228 ; P_HEAD = head # for start of transfer 1229 ; P_SECTOR = sector # for start of transfer 1230 ; P_COUNT = remaining sector count 1231 ; P_DMAOFF = transfer offset 1232 ; P_DMASEG = transfer segment 1233 ; P_LBABLOCK = block # for start of transfer 1234 ; ES:DI -> UDSC structure 1235 ; exit: CY = 0 if no error, P_COUNT = remaining sectors 1236 ; CY = 1 if error, AH = ROS error code 1237 0 000029F5 E85D01 call track_setup ; compute size of transfer 1239 %if FASTSETTLE 1240 call new_settle ; set new head settle delay 1241 %endif 1242 P_STRUC.DIRECT equ DIRECT ; NASM port label 0 000029F8 807E0B00 cmp byte [P_STRUC.DIRECT + bp],0 ; DMA boundary problem? 0 000029FC 7519 jne trkrw10 ; no, direct transfer performed 0 000029FE 807E0C02 cmp byte [P_STRUC.ROSCMD + bp],ROS_READ 0 00002A02 7413 je trkrw10 ; skip if not writing to disk 0 00002A04 1E0657 pushx 0 00002A07 B90001 mov cx,SECSIZE/2 ; CX = # of word per sector 0 00002A0A 1E push ds 0 00002A0B 07 pop es ; ES:DI -> destination 0 00002A0C BF[0000] mov di,offset local_buffer 1252 P_DSTRUC.DMA equ DMA ; NASM port label 0 00002A0F C57606 lds si,[P_DSTRUC.DMA + bp] ; DS:SI -> source 0 00002A12 F3A5 rep movsw ; copy from deblocking buffer 0 00002A14 5F071F popx 1256 trkrw10: 0 00002A17 C6460A03 mov byte [P_STRUC.RETRY + bp],RETRY_MAX ; perform up to three retries 1258 trkrw20: ; loop back here for retries 0 00002A1B 268A5504 mov dl,[es:UDSC.RUNIT + di] ; get ROS unit # 0 00002A1F 26F7453F0004 test word [es:UDSC.FLAGS + di],UDF_LBA ; drive accessed via LBA? 0 00002A25 7453 jz trkrw25 ; no, then use CHS routine 1262 1263 trkrw25_lba: 0 00002A27 8D36[0000] lea si,[diskaddrpack] ; disk address packet structure 0 00002A2B 8B4616 mov ax,word ptr [P_STRUC.LBABLOCK + bp] ; get block number 0 00002A2E 894408 mov word ptr [si+8],ax 0 00002A31 8B4618 mov ax,word ptr [P_STRUC.LBABLOCK + bp+2] 0 00002A34 89440A mov word ptr [si+10],ax 0 00002A37 8C5C06 mov word ptr [si+6],ds ; address of transfer buffer 0 00002A3A C74404[0000] mov word ptr [si+4],offset local_buffer 1271 ; push es 1272 ; mov ax,ds 1273 ; mov es,ax 1274 ; mov bx,offset local_buffer ; point at our local buffer 0 00002A3F 807E0B00 cmp byte [P_STRUC.DIRECT + bp],0 ; DMA boundary problem? 0 00002A43 740C je trkrw30_lba ; no, direct transfer performed 0 00002A45 8B4608 mov ax,word ptr [P_DSTRUC.DMA + bp+2] ; transfer address 0 00002A48 894406 mov word ptr [si+6],ax 0 00002A4B 8B4606 mov ax,word ptr [P_DSTRUC.DMA + bp] 0 00002A4E 894404 mov word ptr [si+4],ax 1281 ; les bx,P_DSTRUC.DMA[bp] ; ES:BX -> transfer address 1282 trkrw30_lba: 1283 ; mov ax,P_STRUC.MCNT[bp] ; AL = physical sector count 1284 P_STRUC.MCNT equ MCNT ; NASM port label 0 00002A51 8B4614 mov ax,[P_STRUC.MCNT + bp] ; physical sector count 0 00002A54 894402 mov word ptr [si+2],ax 0 00002A57 30C0 xor al,al 0 00002A59 8A660C mov ah,[P_STRUC.ROSCMD + bp] ; AH = ROS read command 0 00002A5C 80C440 add ah,40h ; extended (LBA) version of command 0 00002A5F 80FC44 cmp ah,ROS_LBAVERIFY ; write with verify? 0 00002A62 7511 jne trkrw40_lba ; skip if ROS_READ or ROS_WRITE 0 00002A64 B443 mov ah,ROS_LBAWRITE ; else first perform normal write 0 00002A66 E87BF9 int_____DISK_INT ; call ROS to write to disk 0 00002A69 720D jc trkrw50_lba ; skip if any errors occurred 0 00002A6B 8B4614 mov ax,[P_STRUC.MCNT + bp] ; else get sector count 0 00002A6E 894402 mov word ptr [si+2],ax 0 00002A71 30C0 xor al,al 0 00002A73 B444 mov ah,ROS_LBAVERIFY ; verify disk sectors 1299 trkrw40_lba: ; AH = function, AL = count 0 00002A75 E86CF9 int_____DISK_INT ; read/write/verify via ROM BIOS 1301 trkrw50_lba: ; CY = 1, AH = error code 1302 ; pop es 0 00002A78 EB48 jmp trkrw55 ; continue with normal routine 1304 1305 1306 trkrw25: 0 00002A7A 8B4E10 mov cx,[P_STRUC.CYL + bp] ; get cylinder # 0 00002A7D 86CD xchg cl,ch ; CH = bits 0..7, CL = bits 8..11 0 00002A7F D0C9 ror cl,1 0 00002A81 D0C9 ror cl,1 ; cylinder bits 8..9 in bits 6..7 0 00002A83 88CE mov dh,cl ; cylinder bits 10.11 in bits 0..1 0 00002A85 80E1C0 and cl,11000000b ; isolate cylinder bits 8..9 0 00002A88 024E0E add cl,[P_STRUC.SECTOR + bp] ; bits 0..5 are sector number 0 00002A8B 41 inc cx ; make it one-relative for ROS 0 00002A8C D0CE ror dh,1 0 00002A8E D0CE ror dh,1 ; cylinder bits 10..11 in bits 6..7 0 00002A90 80E6C0 and dh,11000000b ; isolate cylinder bits 10..11 0 00002A93 02760F add dh,[P_STRUC.HEAD + bp] ; add physical head number 1319 0 00002A96 06 push es 0 00002A97 8CD8 mov ax,ds 0 00002A99 8EC0 mov es,ax 0 00002A9B BB[0000] mov bx,offset local_buffer ; point at our local buffer 0 00002A9E 807E0B00 cmp byte [P_STRUC.DIRECT + bp],0 ; DMA boundary problem? 0 00002AA2 7403 je trkrw30 ; no, direct transfer performed 0 00002AA4 C45E06 les bx,[P_DSTRUC.DMA + bp] ; ES:BX -> transfer address 1327 trkrw30: 0 00002AA7 8B4614 mov ax,[P_STRUC.MCNT + bp] ; AL = physical sector count 0 00002AAA 8A660C mov ah,[P_STRUC.ROSCMD + bp] ; AH = ROS read command 0 00002AAD 80FC04 cmp ah,ROS_VERIFY ; write with verify? 0 00002AB0 750C jne trkrw40 ; skip if ROS_READ or ROS_WRITE 0 00002AB2 B403 mov ah,ROS_WRITE ; else first perform normal write 0 00002AB4 E82DF9 int_____DISK_INT ; call ROS to write to disk 0 00002AB7 7208 jc trkrw50 ; skip if any errors occurred 0 00002AB9 8B4614 mov ax,[P_STRUC.MCNT + bp] ; else get sector count 0 00002ABC B404 mov ah,ROS_VERIFY ; verify disk sectors 1337 trkrw40: ; AH = function, AL = count 0 00002ABE E823F9 int_____DISK_INT ; read/write/verify via ROM BIOS 1339 trkrw50: ; CY = 1, AH = error code 0 00002AC1 07 pop es 1341 trkrw55: 0 00002AC2 731C jnc trkrw70 ; skip if no errors occurred 0 00002AC4 E88600 call disk_reset ; reset the hardware 0 00002AC7 80FC11 cmp ah,11h ; ECC corrected data? 0 00002ACA 740F je trkrw60 ; first sector known to be good 0 00002ACC 80FC03 cmp ah,03h ; write protect error 0 00002ACF 7408 je trkrw_error ; don't recover, report to user 0 00002AD1 FE4E0A dec byte [P_STRUC.RETRY + bp] ; count # of errors so far 0 00002AD4 7403E942FF jnz trkrw20 ; retries done, declare it permanent 1350 trkrw_error: ; disk error occurred 1351 %if FASTSETTLE 1352 call old_settle ; restore head settle delay 1353 %endif 0 00002AD9 F9 stc ; CY = 1 indicates error, AH = code 0 00002ADA C3 ret 1356 1357 trkrw60: ; ECC error, only 1st sector OK 0 00002ADB C746140100 mov word [P_STRUC.MCNT + bp],1 ; say we have done one sector 1359 trkrw70: ; read/write/verify succeeded 0 00002AE0 807E0B00 cmp byte [P_STRUC.DIRECT + bp],0 ; DMA boundary problem? 0 00002AE4 7517 jne trkrw80 ; no, direct transfer performed 0 00002AE6 807E0C02 cmp byte [P_STRUC.ROSCMD + bp],ROS_READ 0 00002AEA 7511 jne trkrw80 ; skip if not reading from disk 0 00002AEC 571E06 pushx 0 00002AEF B90001 mov cx,SECSIZE/2 ; CX = # of word per sector 0 00002AF2 BE[0000] mov si,offset local_buffer 0 00002AF5 C47E06 les di,[P_DSTRUC.DMA + bp] ; DS:SI -> source, ES:DI -> destination 0 00002AF8 F3A5 rep movsw ; copy from deblocking buffer 0 00002AFA 071F5F popx 1370 trkrw80: 0 00002AFD 8B4614 mov ax,[P_STRUC.MCNT + bp] ; get physical transfer length 0 00002B00 294612 sub [P_STRUC.COUNT + bp],ax ; subtract from total transfer length 0 00002B03 7446 jz trkrw90 ; exit if none left 1374 trkrw85_lba: 0 00002B05 26F7453F0004 test word [es:UDSC.FLAGS + di],UDF_LBA ; drive accessed via LBA? 0 00002B0B 7412 jz trkrw85 ; no, then use CHS routine 0 00002B0D 30E4 xor ah,ah ; update current LBA 0 00002B0F 014616 add word ptr [P_STRUC.LBABLOCK + bp],ax 0 00002B12 83561800 adc word ptr [P_STRUC.LBABLOCK+2 + bp],0 0 00002B16 B420 mov ah,SECSIZE/16 0 00002B18 F6E4 mul ah ; AX = paras to inc DMA address 0 00002B1A 014608 add [P_STRUC.DMASEG + bp],ax ; update DMA segment 0 00002B1D EB2C jmps trkrw90 1384 trkrw85: 0 00002B1F 00460E add [P_STRUC.SECTOR + bp],al ; update current sector 0 00002B22 B420 mov ah,SECSIZE/16 0 00002B24 F6E4 mul ah ; AX = paras to inc DMA address 0 00002B26 014608 add [P_STRUC.DMASEG + bp],ax ; update DMA segment 0 00002B29 31C0 xor ax,ax 0 00002B2B 8A460E mov al,[P_STRUC.SECTOR + bp] ; get current sector 0 00002B2E 263B4513 cmp ax,[es:di+UDSC.UDSCBPB+BPB.SPT] 0 00002B32 7217 jb trkrw90 ; skip if on same track 0 00002B34 C6460E00 mov byte [P_STRUC.SECTOR + bp],0 ; else start at beginning of new track 0 00002B38 FE460F inc byte [P_STRUC.HEAD + bp] ; move to the next head 0 00002B3B 8A460F mov al,[P_STRUC.HEAD + bp] ; get current head 0 00002B3E 263B4515 cmp ax,[es:di+UDSC.UDSCBPB+BPB.HEADS] 0 00002B42 7207 jb trkrw90 ; did we go over end of cylinder? 0 00002B44 C6460F00 mov byte [P_STRUC.HEAD + bp],0 ; start with first head... 0 00002B48 FF4610 inc word [P_STRUC.CYL + bp] ; ... on the next cylinder 1400 trkrw90: 1401 %if FASTSETTLE 1402 call old_settle ; restore head settle delay 1403 %endif 0 00002B4B F8 clc ; indicate no errors 0 00002B4C C3 ret 1406 1407 1408 1409 disk_reset: 1410 ;---------- 1411 ; entry: DL = ROS drive code 1412 0 00002B4D 50 push ax ; save the error status 1414 ; mov ah,ROS_RESET ; try a restore 0 00002B4E 31C0 xor ax,ax 0 00002B50 E891F8 int_____DISK_INT ; might sort things out 0 00002B53 58 pop ax ; restore error status 0 00002B54 C3 ret 1419 1420 1421 track_setup: ; prepare for I/O on disk track 1422 ;----------- 1423 ; entry: P_CYL = cylinder for start of transfer 1424 ; P_HEAD = head # for start of transfer 1425 ; P_SECTOR = sector # for start of transfer 1426 ; P_COUNT = remaining sector count 1427 ; P_DMAOFF = transfer offset 1428 ; P_DMASEG = transfer segment 1429 ; ES:DI -> UDSC structure 1430 ; exit: P_DIRECT = 1 if no deblocking 1431 ; P_MCNT = # of sectors possible in one ROS call 1432 1433 0 00002B55 8B4608 mov ax,[P_STRUC.DMASEG + bp] ; get transfer address 0 00002B58 3B06[0000] cmp ax,[DeblockSeg] ; is this in high memory ? 0 00002B5C 7346 jae trksu20 ; then force through deblock buffer 0 00002B5E 8B4612 mov ax,[P_STRUC.COUNT + bp] ; assume we can transfer all 0 00002B61 3DFF00 cmp ax,0ffh ; more than 255 blocks to transfer? 0 00002B64 7603 jbe trksu0 ; no, then proceed 0 00002B66 B8FF00 mov ax,0ffh ; yes, restrict counter to one byte to prevent overflow 1441 trksu0: 0 00002B69 894614 mov [P_STRUC.MCNT + bp],ax ; that's requested this time 0 00002B6C C6460B01 mov byte [P_STRUC.DIRECT + bp],1 ; directly to destination 0 00002B70 26F6450480 test byte [es:UDSC.RUNIT + di],80h ; is it a hard disk transfer ? 0 00002B75 7536 jnz trksu30 ; yes, transfer the lot 1446 ; floppy transfer, break up into tracks 0 00002B77 268B5513 mov dx,[es:di+UDSC.UDSCBPB+BPB.SPT] 1448 ; DX = sectors per track 0 00002B7B 2A560E sub dl,[P_STRUC.SECTOR + bp] ; subtract starting sector 0 00002B7E 39C2 cmp dx,ax ; more than we want? 0 00002B80 7303 jae trksu10 ; no, use this count 0 00002B82 895614 mov [P_STRUC.MCNT + bp],dx ; set count for this pass 1453 trksu10: 0 00002B85 8B4608 mov ax,[P_STRUC.DMASEG + bp] ; get transfer address 0 00002B88 B104 mov cl,4 0 00002B8A D3E0 shl ax,cl ; get A4..A15 from segment 0 00002B8C 034606 add ax,[P_STRUC.DMAOFF + bp] ; combine with A0..A15 from offset 0 00002B8F F7D0 not ax ; AX = # of bytes left in 64K bank 0 00002B91 29D2 sub dx,dx 0 00002B93 B90002 mov cx,SECSIZE 0 00002B96 F7F1 div cx ; convert this to physical sectors 0 00002B98 3B4614 cmp ax,[P_STRUC.MCNT + bp] ; capable of more than requested? 0 00002B9B 7310 jae trksu30 ; skip if we can do it all 0 00002B9D 894614 mov [P_STRUC.MCNT + bp],ax ; else update possible transfer length 0 00002BA0 85C0 test ax,ax ; can we transfer anything at all? 0 00002BA2 7509 jnz trksu30 ; yes, perform the transfer 1467 trksu20: 0 00002BA4 C746140100 mov word [P_STRUC.MCNT + bp],1 ; single sector transfer via buffer 0 00002BA9 C6460B00 mov byte [P_STRUC.DIRECT + bp],0 ; if DIRECT = 0, deblocked transfer 1470 trksu30: 0 00002BAD C3 ret 1472 1473 1474 1475 1476 %if FASTSETTLE 1477 new_settle: 1478 ;---------- 1479 test word [es:UDSC.FLAGS + di],UDF_HARD ; fix head settle on floppies 1480 jnz new_settle9 1481 cmp byte [P_STRUC.ROSCMD + bp],ROS_READ 1482 jne new_settle9 1483 push ax 1484 pushx 1485 sub ax,ax 1486 mov ds,ax 1487 Assume DS:IVECT 1488 lds bx,[i1eptr] 1489 xchg al,[9 + bx] 1490 Assume DS:CGROUP 1491 popx 1492 P_STRUC.SETTLE equ SETTLE ; NASM port label 1493 mov [P_STRUC.SETTLE + bp],al 1494 pop ax 1495 new_settle9: 1496 ret 1497 1498 old_settle: 1499 ;---------- 1500 test word [es:UDSC.FLAGS + di],UDF_HARD ; fix head settle on floppies 1501 jnz old_settle9 1502 cmp byte [P_STRUC.ROSCMD + bp],ROS_READ 1503 jne old_settle9 1504 pushx 1505 mov al,[P_STRUC.SETTLE + bp] 1506 sub bx,bx 1507 mov ds,bx 1508 Assume DS:IVECT 1509 lds bx,[i1eptr] 1510 mov [9 + bx],al 1511 Assume DS:CGROUP 1512 popx 1513 old_settle9: 1514 ret 1515 %endif 1516 1517 1518 dd_open: ; 13-device open 1519 ;------- 0 00002BAE E80EFA call point_unit ; get unit descriptor 0 00002BB1 26FF453C inc word [es:UDSC.OPNCNT + di] ; increment open count 0 00002BB5 29C0 sub ax,ax 0 00002BB7 C3 ret 1524 1525 1526 dd_close: ; 14-device close 1527 ;-------- 0 00002BB8 E804FA call point_unit ; get unit descriptor 0 00002BBB 26FF4D3C dec word [es:UDSC.OPNCNT + di] ; decrement open count 0 00002BBF 29C0 sub ax,ax 0 00002BC1 C3 ret 1532 1533 1534 dd_remchk: ; 15-removable media check 1535 ;--------- 0 00002BC2 E8FAF9 call point_unit ; get unit descriptor 0 00002BC5 29C0 sub ax,ax ; assume floppy disk 0 00002BC7 26F7453F0100 test word [es:UDSC.FLAGS + di],UDF_HARD 0 00002BCD 7403 jz remchk1 ; skip if it really is a floppy 0 00002BCF B80002 mov ax,RHS_BUSY ; else return "busy" for hard disk 1541 remchk1: 0 00002BD2 C3 ret 1543 1544 dd_genioctl: ; 19-generic IOCTL 1545 ;----------- 0 00002BD3 268B4F0D mov cx,[es:RH19_CATEGORY + bx] ; get major & minor function 0 00002BD7 86CD xchg cl,ch ; swap them around 0 00002BD9 E8E3F9 call point_unit ; get unit descriptor 1549 0 00002BDC 80FD08 cmp ch,8 ; is it the right major category? 0 00002BDF 7405 je ioctl5 ; yes, proceed 0 00002BE1 80FD48 cmp ch,48h ; else check for cat 48h (FAT32) 0 00002BE4 751B jne ioctl20 ; neither one, return an error 1554 ioctl5: 1555 0 00002BE6 2E882E[4E08] mov byte ptr [cs:ioctl_cat],ch 1557 ; save category code for later use 1558 0 00002BEB 26834D3F04 or word [es:UDSC.FLAGS + di],UDF_UNSURE 1560 ; media unsure after IOCTL 1561 0 00002BF0 BE[2308] mov si,offset genioctlTable 1563 ioctl10: 0 00002BF3 2EAC cs lodsb ; get category 0 00002BF5 88C5 mov ch,al ; keep in CH 0 00002BF7 2EAD cs lodsw ; AX = function address 0 00002BF9 38E9 cmp cl,ch ; is it the category we want ? 0 00002BFB 7408 je ioctl30 ; yes, go do it 0 00002BFD 84ED test ch,ch ; is it the end of the list ? 0 00002BFF 75F2 jnz ioctl10 ; no, do another one 1571 ioctl20: 0 00002C01 B80380 mov ax,RHS_ERROR+3 ; "unknown command" 0 00002C04 C3 ret 1574 ioctl30: 0 00002C05 FFE0 jmp ax ; go do our routine 1576 1577 genioctlTable label byte 0 00002C07 40 db RQ19_SET ; set device parameters 0 00002C08 [BB08] dw offset ioctl_set 0 00002C0A 60 db RQ19_GET ; get device parameters 0 00002C0B [5608] dw offset ioctl_get 0 00002C0D 41 db RQ19_WRITE ; write track 0 00002C0E [3709] dw offset ioctl_write 0 00002C10 61 db RQ19_READ ; read track 0 00002C11 [3109] dw offset ioctl_read 0 00002C13 42 db RQ19_FORMAT ; format & verify track 0 00002C14 [AB09] dw offset ioctl_format 0 00002C16 62 db RQ19_VERIFY ; verify track 0 00002C17 [AB09] dw offset ioctl_verify 0 00002C19 66 db RQ19_GETMEDIA ; get media id 0 00002C1A [550B] dw offset ioctl_getmedia 0 00002C1C 46 db RQ19_SETMEDIA ; set media id 0 00002C1D [740B] dw offset ioctl_setmedia 0 00002C1F 47 db RQ19_SETACCESS ; set access flag 0 00002C20 [9B0B] dw offset ioctl_setaccess 0 00002C22 67 db RQ19_GETACCESS ; get access flag 0 00002C23 [B70B] dw offset ioctl_getaccess 0 00002C25 4A db RQ19_LOCKLOG 0 00002C26 [D00B] dw offset ioctl_locklogical 0 00002C28 4B db RQ19_LOCKPHYS 0 00002C29 [D00B] dw offset ioctl_lockphysical 0 00002C2B 6A db RQ19_UNLOCKLOG 0 00002C2C [D00B] dw offset ioctl_unlocklogical 0 00002C2E 6B db RQ19_UNLOCKPHYS 0 00002C2F [D00B] dw offset ioctl_unlockphysical 0 00002C31 00 db 0 ; terminate the list 1607 0 00002C32 00 ioctl_cat db 0 ; category code for dd_geniotcl 1609 1610 point_ioctl_packet: 1611 ;------------------ 1612 ; On Entry: 1613 ; None 1614 ; On Exit: 1615 ; DS:BX -> ioctl request packet 1616 ; All other regs preserved 1617 ; 0 00002C33 C55E02 lds bx,[P_DSTRUC.REQUEST + bp] 0 00002C36 C55F13 lds bx,[RH19_GENPB + bx] ; ES:BX -> request packet 0 00002C39 C3 ret 1621 1622 1623 ioctl_get: 1624 ;--------- 0 00002C3A 1E push ds 0 00002C3B E8F5FF call point_ioctl_packet ; DS:BX -> ioctl packet 1627 UDSC.TYP equ TYP ; NASM port label 0 00002C3E 268A453E mov al,[es:UDSC.TYP + di] ; get drive type 0 00002C42 884701 mov [1 + bx],al ; return drive type (0/1/2/5/7) 1630 0 00002C45 268B453F mov ax,[es:UDSC.FLAGS + di] ; get device attributes 0 00002C49 250304 and ax,UDF_LBA+UDF_HARD+UDF_CHGLINE ; isolate hard disk + change line bits 0 00002C4C 894702 mov [2 + bx],ax ; return device attributes 1634 1635 UDSC.NCYL equ NCYL ; NASM port label 0 00002C4F 268B4541 mov ax,[es:UDSC.NCYL + di] ; get # of cylinders 0 00002C53 894704 mov [4 + bx],ax ; return # of cylinders 1638 0 00002C56 29C0 sub ax,ax ; for now always say "default" 0 00002C58 884706 mov [6 + bx],al ; return media type 1641 0 00002C5B F60701 test byte ptr [bx],1 ; return default BPB? 0 00002C5E 1F pop ds 0 00002C5F 8D7543 lea si,[UDSC.DEVBPB + di] ; assume we want device BPB 0 00002C62 7413 jz get1 ; skip if yes 0 00002C64 26F7453F0100 test word [es:UDSC.FLAGS + di],UDF_HARD 0 00002C6A 750B jnz get1 ; BPB doesn't change for hard disks 0 00002C6C E84004 call ask_for_disk ; make sure we've got correct floppy 0 00002C6F E896FA call login_media ; determine floppy disk type 0 00002C72 7228 jc get_err ; abort if can't login disk 0 00002C74 8D7506 lea si,[UDSC.UDSCBPB + di] ; get current BPB 1652 get1: 0 00002C77 1E push ds 0 00002C78 06 push es 0 00002C79 57 push di 0 00002C7A 06 push es 0 00002C7B E8B5FF call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002C7E 1E push ds 0 00002C7F 07 pop es 0 00002C80 8D7F07 lea di,[7 + bx] ; ES:DI -> BPB in parameter block 0 00002C83 1F pop ds ; DS:SI -> BPB to copy 0 00002C84 2E803E[4E08]48 cmp byte [cs:ioctl_cat],48h 1663 ; extended BPB requested? 0 00002C8A 7405 je get2 ; yes 0 00002C8C B91F00 mov cx,OLDBPB_LENGTH ; no, use old-style BPB 0 00002C8F EB03 jmps get3 1667 get2: 0 00002C91 B93500 mov cx,UDSC_BPB_LENGTH ; else use extended BPB 1669 get3: 0 00002C94 F3A4 rep movsb ; copy the BPB across to user 0 00002C96 5F pop di 0 00002C97 07 pop es 0 00002C98 1F pop ds 0 00002C99 31C0 xor ax,ax ; return success 0 00002C9B C3 ret 1676 get_err: 0 00002C9C E99CFC jmp xlat_error ; return error code 1678 ; ret 1679 1680 ioctl_set: ; set device parameters 1681 ;--------- 1682 0 00002C9F 1E push ds 0 00002CA0 06 push es 0 00002CA1 E88FFF call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002CA4 F60702 test byte ptr [bx],2 ; ignore all but track layout? 0 00002CA7 753F jnz set2 ; yes, skip BPB stuff 1688 0 00002CA9 8A4701 mov al,[1 + bx] ; get new drive type (0/1/2/5/7) 0 00002CAC 2688453E mov [es:UDSC.TYP + di],al ; set drive type 1691 0 00002CB0 2683653FFC and word [es:UDSC.FLAGS + di],~ (UDF_HARD+UDF_CHGLINE) 0 00002CB5 8B4702 mov ax,[2 + bx] ; get new device attributes 0 00002CB8 83E003 and ax,UDF_HARD+UDF_CHGLINE ; isolate hard disk + change line bits 0 00002CBB 2609453F or [es:UDSC.FLAGS + di],ax ; combine the settings 1696 0 00002CBF 8B4704 mov ax,[4 + bx] ; get new # of cylinders 0 00002CC2 26894541 mov [es:UDSC.NCYL + di],ax ; set # of cylinders 1699 0 00002CC6 8D4506 lea ax,[UDSC.UDSCBPB + di] ; AX -> media BPB in es:UDSC_ 0 00002CC9 F60701 test byte ptr [bx],1 ; fix BPB for "build BPB" call? 0 00002CCC 7503 jnz set1 ; skip if new media BPB only 0 00002CCE 8D4543 lea ax,[UDSC.DEVBPB + di] ; AX -> device BPB in es:UDSC_ 1704 set1: 0 00002CD1 8D7707 lea si,[7 + bx] ; DS:SI -> new BPB from user 0 00002CD4 97 xchg ax,di ; ES:DI -> BPB in es:UDSC_ 0 00002CD5 2E803E[4E08]48 cmp byte [cs:ioctl_cat],48h 1708 ; extended BPB supplied? 0 00002CDB 7405 je set1a ; yes 0 00002CDD B91F00 mov cx,OLDBPB_LENGTH ; no, copy old-style BPB 0 00002CE0 EB03 jmps set1b 1712 set1a: 0 00002CE2 B93500 mov cx,UDSC_BPB_LENGTH ; else copy extended BPB 1714 set1b: 0 00002CE5 F3A4 rep movsb ; copy BPB into UDSC as new default 0 00002CE7 97 xchg ax,di ; ES:DI -> UDSC_ again 1717 1718 set2: ; now set track layout 1719 ; lea si,BPB_LENGTH+7[bx] ; DS:SI -> new user layout 0 00002CE8 8D7726 lea si,[OLDBPB_LENGTH+7 + bx] ; DS:SI -> new user layout 0 00002CEB 2E8E06[0000] mov es,[cs:DataSegment] 0 00002CF0 BF[0000] mov di,offset layout_table ; ES:DI -> BIOS layout table 0 00002CF3 AD lodsw ; get sector count 0 00002CF4 85C0 test ax,ax ; make sure this is good value 0 00002CF6 7418 jz set6 0 00002CF8 83F828 cmp ax,MAX_SPT ; make sure this is good value 0 00002CFB 7713 ja set6 ; so we don't overflow table 0 00002CFD 91 xchg ax,cx ; CX = sector count 1729 set3: ; loop here for every sector 0 00002CFE 47 inc di 0 00002CFF 47 inc di 0 00002D00 AD lodsw ; get sector number 0 00002D01 AA stosb ; write sector number 0 00002D02 AD lodsw ; get sector size (0080, 0100, 0200, 0400) 0 00002D03 D1E0 shl ax,1 ; double it (0100, 0200, 0400, 0800) 1736 set4: 0 00002D05 D0EC shr ah,1 ; halve the sector size until = 128 0 00002D07 7204 jc set5 ; we've shifted out bottom bit 0 00002D09 FEC0 inc al ; count the # of bits 0 00002D0B 75F8 jnz set4 ; (this should always jump) 1741 set5: 0 00002D0D AA stosb ; store LOG2 (sector size/128) 0 00002D0E E2EE loop set3 ; repeat for all sectors 1744 set6: 0 00002D10 07 pop es 0 00002D11 1F pop ds 0 00002D12 31C0 xor ax,ax 0 00002D14 C3 ret 1749 1750 ioctl_read: 1751 ;---------- 1752 0 00002D15 C6460C02 mov byte [P_STRUC.ROSCMD + bp],ROS_READ ; read physical track 0 00002D19 EB04 jmps ioctl_rw_common ; use common code 1755 1756 ioctl_write: 1757 ;----------- 1758 0 00002D1B C6460C03 mov byte [P_STRUC.ROSCMD + bp],ROS_WRITE ; write physical track 1760 ; jmps ioctl_rw_common ; use common code 1761 1762 ioctl_rw_common: 0 00002D1F E8C3FA call getdrivegeo ; get heads & sectors 0 00002D22 E88A03 call ask_for_disk ; make sure we've got correct floppy 0 00002D25 1E push ds 0 00002D26 E80AFF call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002D29 8A4705 mov al,[5 + bx] ; get logical sector (0..SPT-1) 0 00002D2C 88460E mov [P_STRUC.SECTOR + bp],al 0 00002D2F 8B4707 mov ax,[7 + bx] ; get sector count 0 00002D32 894612 mov [P_STRUC.COUNT + bp],ax 0 00002D35 8B4709 mov ax,[9 + bx] ; get transfer address 0 00002D38 894606 mov [P_STRUC.DMAOFF + bp],ax 0 00002D3B 8B470B mov ax,[11 + bx] 0 00002D3E 894608 mov [P_STRUC.DMASEG + bp],ax 0 00002D41 8B4701 mov ax,[1 + bx] ; get head number 0 00002D44 88460F mov [P_STRUC.HEAD + bp],al 0 00002D47 8B4703 mov ax,[3 + bx] ; get cylinder number 0 00002D4A 894610 mov [P_STRUC.CYL + bp],ax 1779 0 00002D4D 2EF726[2E0D] mul word [cs:max_head] ; multiply with number of heads 0 00002D52 30ED xor ch,ch 0 00002D54 8A4E0F mov cl,[P_STRUC.HEAD + bp] 0 00002D57 01C8 add ax,cx ; add head number 0 00002D59 83D200 adc dx,0 0 00002D5C 50 push ax 0 00002D5D 89D0 mov ax,dx ; multiply with sectors per track 0 00002D5F 2EF726[300D] mul word [cs:max_sect] 0 00002D64 894618 mov word ptr [P_STRUC.LBABLOCK + bp+2],ax 0 00002D67 58 pop ax 0 00002D68 2EF726[300D] mul word [cs:max_sect] 0 00002D6D 30ED xor ch,ch 0 00002D6F 8A4E0E mov cl,[P_STRUC.SECTOR + bp] 0 00002D72 FEC9 dec cl 0 00002D74 894E16 mov word ptr [P_STRUC.LBABLOCK + bp],cx ; add products and sector number 0 00002D77 014616 add word ptr [P_STRUC.LBABLOCK + bp],ax 0 00002D7A 115618 adc word ptr [P_STRUC.LBABLOCK + bp+2],dx 1797 0 00002D7D 1F pop ds 1799 rw_loop: 0 00002D7E E874FC call track_rw ; read as much as possible on track 0 00002D81 7209 jc rw_err ; return if physical disk error 0 00002D83 837E1200 cmp word [P_STRUC.COUNT + bp],0 ; test if any more stuff to read 0 00002D87 75F5 jne rw_loop ; yes, loop back for more 0 00002D89 29C0 sub ax,ax ; all done, no error encountered 0 00002D8B C3 ret ; return O.K. code 1806 rw_err: 0 00002D8C E9ACFB jmp xlat_error ; translate ROS code to DOS error 1808 ; ret 1809 1810 ioctl_verify: 1811 ;------------ 1812 ioctl_format: 1813 ;------------ 0 00002D8F E81D03 call ask_for_disk ; make sure we've got correct floppy 0 00002D92 C6460A03 mov byte [P_STRUC.RETRY + bp],RETRY_MAX ; perform up to three retries 1816 format_retry: 0 00002D96 E8C500 call set_format ; attempt data rate setup 0 00002D99 1E push ds 0 00002D9A E896FE call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002D9D F60701 test byte ptr [bx],1 ; are we testing parameters only ? 0 00002DA0 7406 jz format10 0 00002DA2 8807 mov [bx],al ; return AL 0 00002DA4 1F pop ds 0 00002DA5 31C0 xor ax,ax ; we succeeded 0 00002DA7 C3 ret 1826 1827 format10: 0 00002DA8 268B4513 mov ax,[es:di+UDSC.UDSCBPB+BPB.SPT] 0 00002DAC F60702 test byte ptr [bx],2 ; is it undocumented "do 2 tracks" bit? 0 00002DAF 7402 jz format20 0 00002DB1 01C0 add ax,ax ; yes, double the count 1832 format20: 0 00002DB3 894612 mov [P_STRUC.COUNT + bp],ax ; save it locally for later 0 00002DB6 8A7701 mov dh,[1 + bx] ; get head # 0 00002DB9 8B4F03 mov cx,[3 + bx] ; get cylinder # 0 00002DBC D0CD ror ch,1 0 00002DBE D0CD ror ch,1 0 00002DC0 86CD xchg cl,ch 0 00002DC2 80C901 or cl,1 ; start with sector 1 0 00002DC5 268A5504 mov dl,[es:UDSC.RUNIT + di] ; get ROS drive # 0 00002DC9 C55E02 lds bx,[P_DSTRUC.REQUEST + bp] ; DS:BX -> Request Header 0 00002DCC 8B5F0D mov bx,[RH19_CATEGORY + bx] ; get major & minor function 0 00002DCF 1F pop ds 1844 0 00002DD0 06 push es 0 00002DD1 31C0 xor ax,ax 0 00002DD3 8EC0 mov es,ax 0 00002DD5 A1[0800] mov ax,[new_int1e_off] ; point floppy paramters at local 0 00002DD8 2687067800 xchg ax,[es:4*1Eh] 0 00002DDD A3[0400] mov [orig_int1e_off],ax ; save old value 0 00002DE0 A1[0A00] mov ax,[new_int1e_seg] 0 00002DE3 2687067A00 xchg ax,[es:4*1Eh+2] 0 00002DE8 A3[0600] mov [orig_int1e_seg],ax 0 00002DEB 07 pop es 1855 1856 format30: 0 00002DEC 80FF42 cmp bh,RQ19_FORMAT ; skip if verify only 0 00002DEF 751B jne format40 0 00002DF1 26F7453F0100 test word [es:UDSC.FLAGS + di],UDF_HARD 0 00002DF7 7513 jnz format40 ; hard disks are always verify 1861 0 00002DF9 8B4612 mov ax,[P_STRUC.COUNT + bp] 0 00002DFC B405 mov ah,ROS_FORMAT 0 00002DFE 06 push es 0 00002DFF 53 push bx 0 00002E00 1E push ds 0 00002E01 07 pop es 0 00002E02 BB[0000] mov bx,offset layout_table ; ES:BX -> parameter table 0 00002E05 E8DCF5 int_____DISK_INT 0 00002E08 5B pop bx 0 00002E09 07 pop es 0 00002E0A 7214 jc format50 1873 format40: ; no error on format, try verify 0 00002E0C 8B4612 mov ax,[P_STRUC.COUNT + bp] 0 00002E0F B404 mov ah,ROS_VERIFY 0 00002E11 06 push es 0 00002E12 53 push bx 0 00002E13 31DB xor bx,bx 0 00002E15 8EC3 mov es,bx 0 00002E17 E8CAF5 int_____DISK_INT 0 00002E1A 5B pop bx 0 00002E1B 07 pop es 0 00002E1C 7202 jc format50 0 00002E1E 31C0 xor ax,ax ; return success 1885 format50: 0 00002E20 06 push es 0 00002E21 57 push di 0 00002E22 50 push ax 0 00002E23 B80000 mov ax,0 0 00002E26 8EC0 mov es,ax 0 00002E28 BF7800 mov di,78h 0 00002E2B A1[0400] mov ax,[orig_int1e_off] 0 00002E2E AB stosw 0 00002E2F A1[0600] mov ax,[orig_int1e_seg] 0 00002E32 AB stosw 0 00002E33 58 pop ax 0 00002E34 5F pop di 0 00002E35 07 pop es 0 00002E36 7310 jnc format60 ; if no error's just exit 0 00002E38 E800FB call xlat_error ; translate to DOS error 0 00002E3B FE4E0A dec byte [P_STRUC.RETRY + bp] ; any more retries ? 0 00002E3E 7408 jz format60 ; no, just exit with error 1903 ; mov ah,ROS_RESET 0 00002E40 31C0 xor ax,ax 0 00002E42 E89FF5 int_____DISK_INT ; reset the drive 0 00002E45 E94EFF jmp format_retry ; now give it another go 1907 format60: 0 00002E48 C3 ret 1909 1910 1911 ; The following table indicates which combinations of drive 1912 ; types, sectors per track and tracks per disk are O.K. and 1913 ; which value in AL is required for those combinations for 1914 ; INT 13h, AH = 17h ("set DASD type for format"). 1915 1916 ; +---------------------- 0 = 360Kb, 1 = 1.2Mb, 2 = 720Kb 1917 ; | +------------------ # of sectors/track (9, 15, 18) 1918 ; | | +--------------- # of tracks per disk (40 or 80) 1919 ; | | | +----------- 1 = 360 Kb in 360 Kb 1920 ; | | | | 2 = 360 Kb in 1.2 Mb 1921 ; | | | | 3 = 1.2 Mb in 1.2 Mb 1922 ; | | | | 4 = 720 Kb in 720 Kb 1923 ; | | | | +-------- gap length for format 1924 ; | | | | | 1925 ; V V V V V 1926 0 00002E49 0009280150 ok_fmt_table db 0, 9, 40, 1, 50h ; 360 Kb 0 00002E4E 0109280250 db 1, 9, 40, 2, 50h ; 360 Kb in 1.2 Mb 0 00002E53 010F500354 db 1, 15, 80, 3, 54h ; 1.2 Mb in 1.2 Mb 0 00002E58 0209500450 db 2, 9, 80, 4, 50h ; 720 Kb in 720 Kb 0 00002E5D FF db -1 ; end of table 1932 1933 set_format: 1934 ;---------- 1935 ; On Entry: 1936 ; ES:DI -> UDSC_ 1937 ; On Exit: 1938 ; AL = 0 on success, else value to return in parameter block 1939 ; ES:DI preserved 1940 ; 0 00002E5E 1E push ds 0 00002E5F E8D1FD call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002E62 8A7701 mov dh,[1 + bx] ; get the head number 0 00002E65 8B4F03 mov cx,[3 + bx] ; get the cylinder number 0 00002E68 1F pop ds 1946 0 00002E69 BE[0000] mov si,offset layout_table ; SI -> track layout table 0 00002E6C B82800 mov ax,MAX_SPT ; AX = # of sectors per track 1949 set_format10: 0 00002E6F 880C mov [0 + si],cl ; set cylinder number 0 00002E71 887401 mov [1 + si],dh ; set head number 0 00002E74 83C604 add si,4 ; next sector entry 0 00002E77 48 dec ax ; count down # of sectors 0 00002E78 75F5 jnz set_format10 ; repeat until all done 1955 0 00002E7A E89700 call get_ncyl ; return # of tracks 0 00002E7D 48 dec ax ; AX = max. cylinder # 0 00002E7E D0CC ror ah,1 0 00002E80 D0CC ror ah,1 ; move bits 8,9 into 6,7 0 00002E82 86C4 xchg al,ah 0 00002E84 268B4D13 mov cx,[es:di+UDSC.UDSCBPB+BPB.SPT] 1962 ; get desired sectors/track 0 00002E88 09C1 or cx,ax ; CL, CH = max. cylinder/max. sector # 0 00002E8A 81F90827 cmp cx,2708h ; check for 40 track, 8 sectors/track 0 00002E8E 7501 jne set_format20 ; we convert 160, 320 to 180, 360 0 00002E90 41 inc cx ; make it 9 sectors per track 1967 set_format20: 0 00002E91 268A5504 mov dl,[es:UDSC.RUNIT + di] ; get ROS unit number 0 00002E95 0657 pushx 0 00002E97 B418 mov ah,ROS_SETMEDIA ; set type for format 0 00002E99 E848F5 int_____DISK_INT ; check if combination is legal 0 00002E9C 893E[0800] mov [new_int1e_off],di 0 00002EA0 8C06[0A00] mov [new_int1e_seg],es ; ES:DI -> new parameters if legal 0 00002EA4 5F07 popx 0 00002EA6 7203 jc set_format40 ; did we succeed ? 1976 set_format30: 0 00002EA8 31C0 xor ax,ax ; success, return no errors 0 00002EAA C3 ret 1979 1980 set_format40: 1981 ; ROM BIOS has given an error, if the function isn't supported drop 1982 ; thru' and try the older method's 1983 ; 0 00002EAB B002 mov al,2 ; assume ROS doesn't support it 0 00002EAD 80FC0C cmp ah,0Ch ; media combination not supported ? 0 00002EB0 7461 je set_format80 ; return AL=2 0 00002EB2 40 inc ax ; AL = 3 0 00002EB3 80FC80 cmp ah,80h ; drive not ready ? 0 00002EB6 745B je set_format80 ; return AL=3 1990 1991 ; Lets look for a match in our tables 1992 0 00002EB8 E85900 call get_ncyl ; AX = number of cylinders 0 00002EBB 268B4D13 mov cx,[es:di+UDSC.UDSCBPB+BPB.SPT] 1995 ; CL = sectors per track 0 00002EBF 88C5 mov ch,al ; CH = tracks per disk 0 00002EC1 81F90828 cmp cx,2808h ; 40 tracks, 8 sectors? 0 00002EC5 7501 jne set_format50 0 00002EC7 41 inc cx ; force it to 9 sectors/track 2000 set_format50: 0 00002EC8 BE[610A] mov si,offset ok_fmt_table-4 2002 set_format60: 0 00002ECB 83C604 add si,4 ; next table entry 0 00002ECE 2EAC cs lodsb ; get drive type 0 00002ED0 3CFF cmp al,0FFh ; end of device/media list? 0 00002ED2 743D je set_format70 ; yes, can't handle this combination 0 00002ED4 263A453E cmp al,[es:UDSC.TYP + di] ; does the drive type match? 0 00002ED8 75F1 jne set_format60 ; try next one if wrong drive 0 00002EDA 2E3B0C cmp cx,[cs:si] ; do tracks/sectors match? 0 00002EDD 75EC jne set_format60 ; no, try next one 2011 0 00002EDF 880E[0000] mov [parms_spt],cl ; set sectors/track 0 00002EE3 2E8A4403 mov al,[cs:3 + si] ; get required gap length from table 0 00002EE7 A2[0000] mov [parms_gpl],al ; set gap length for format 0 00002EEA B8[0000] mov ax,offset local_parms 0 00002EED A3[0800] mov [new_int1e_off],ax ; use local parameters for formatting 0 00002EF0 8C1E[0A00] mov [new_int1e_seg],ds ; set new interrupt vector address 0 00002EF4 268A5504 mov dl,[es:UDSC.RUNIT + di] 0 00002EF8 2E8A4402 mov al,[cs:2 + si] ; get media/drive combination 0 00002EFC B417 mov ah,ROS_SETTYPE ; set the drive type 0 00002EFE E8E3F4 int_____DISK_INT 0 00002F01 73A5 jnc set_format30 ; return if no errors 0 00002F03 26807D3E00 cmp byte [es:UDSC.TYP + di],0 ; is this a 360 K drive? 0 00002F08 749E je set_format30 ; go ahead, might be old ROS 0 00002F0A 26807D3E02 cmp byte [es:UDSC.TYP + di],2 ; is this a 720 K drive? 0 00002F0F 7497 je set_format30 ; go ahead, might be old ROS 2027 set_format70: 0 00002F11 B001 mov al,1 ; return not supported 2029 set_format80: 0 00002F13 C3 ret 2031 2032 2033 get_ncyl: 2034 ;-------- 0 00002F14 268B450E mov ax,[es:di+UDSC.UDSCBPB+BPB.TOTSEC] 0 00002F18 31D2 xor dx,dx ; get sectors on disk 0 00002F1A 85C0 test ax,ax ; zero means we use 32 bit value 0 00002F1C 7508 jnz get_ncyl10 0 00002F1E 268B451B mov ax,word ptr [es:(UDSC.UDSCBPB+BPB.SIZ) + di] 0 00002F22 268B551D mov dx,word ptr [es:(UDSC.UDSCBPB+BPB.SIZ+2) + di] 2041 get_ncyl10: 0 00002F26 26F77513 div word [es:di+UDSC.UDSCBPB+BPB.SPT] ; AX = # of cylinders * heads 0 00002F2A E80400 call get_ncyl20 ; round up 0 00002F2D 26F77515 div word [es:di+UDSC.UDSCBPB+BPB.HEADS]; AX = # of cylinders 2045 get_ncyl20: 0 00002F31 85D2 test dx,dx ; do we have overflow ? 0 00002F33 7403 jz get_ncyl30 0 00002F35 40 inc ax ; round up 0 00002F36 31D2 xor dx,dx ; make it a 32 bit value 2050 get_ncyl30: 0 00002F38 C3 ret 2052 2053 2054 ioctl_getmedia: 2055 ;-------------- 0 00002F39 C6460C02 mov byte [P_STRUC.ROSCMD + bp],ROS_READ ; read from floppy/hard disk 0 00002F3D E87700 call rw_media ; read the boot sector 0 00002F40 7215 jc getmedia10 0 00002F42 06 push es 0 00002F43 57 push di 0 00002F44 1E push ds 0 00002F45 E8EBFC call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002F48 1E push ds 0 00002F49 07 pop es 0 00002F4A 8D7F02 lea di,[2 + bx] ; ES:DI -> skip info word 0 00002F4D 1F pop ds ; DS:SI -> boot sector media id 0 00002F4E B91700 mov cx,4+11+8 0 00002F51 F3A4 rep movsb ; copy the boot sector image 0 00002F53 5F pop di 0 00002F54 07 pop es 0 00002F55 31C0 xor ax,ax 2072 getmedia10: 0 00002F57 C3 ret 2074 2075 2076 ioctl_setmedia: 2077 ;-------------- 0 00002F58 C6460C02 mov byte [P_STRUC.ROSCMD + bp],ROS_READ ; read from floppy/hard disk 0 00002F5C E85800 call rw_media ; read the boot sector 0 00002F5F 721D jc setmedia10 0 00002F61 1E push ds 0 00002F62 56 push si 0 00002F63 06 push es 0 00002F64 57 push di 0 00002F65 1E push ds 0 00002F66 56 push si 0 00002F67 E8C9FC call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002F6A 8D7702 lea si,[2 + bx] ; DS:SI -> skip info word 0 00002F6D 5F pop di 0 00002F6E 07 pop es ; ES:DI -> boot sector image 0 00002F6F B91700 mov cx,4+11+8 0 00002F72 F3A4 rep movsb ; update the boot sector image 0 00002F74 5F pop di 0 00002F75 07 pop es 0 00002F76 5E pop si 0 00002F77 1F pop ds 0 00002F78 C6460C03 mov byte [P_STRUC.ROSCMD + bp],ROS_WRITE ; write to floppy/hard disk 0 00002F7C EB39 jmp rw_media ; write the boot sector 2099 setmedia10: 0 00002F7E C3 ret 2101 2102 ioctl_setaccess proc 0 00002F7F 1E push ds 0 00002F80 E8B0FC call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002F83 268B453F mov ax,[es:UDSC.FLAGS + di] ; get flags 0 00002F87 25FFFD and ax,~ UDF_NOACCESS ; clear NOACCES flag 0 00002F8A 807F0100 cmp byte ptr [1 + bx],0 ; zero means request sets no access flg 0 00002F8E 7503 jne @@done ; if not zero, skip setting NOACCESS 0 00002F90 0D0002 or ax,UDF_NOACCESS ; set NOACCESS flag 0 00002F93 2689453F @@done: mov [es:UDSC.FLAGS + di],ax ; write back access flag 0 00002F97 31C0 xor ax,ax ; return success 0 00002F99 1F pop ds 0 00002F9A C3 ret 2114 ioctl_setaccess endp 2115 2116 ioctl_getaccess proc 0 00002F9B 1E push ds 0 00002F9C E894FC call point_ioctl_packet ; DS:BX -> ioctl packet 0 00002F9F 268B453F mov ax,[es:UDSC.FLAGS + di] ; get flags 0 00002FA3 C6470101 mov byte ptr [1 + bx],1 ; default to access granted 0 00002FA7 250002 and ax,UDF_NOACCESS ; perhaps not? 0 00002FAA 7406 jz @@done ; it is granted! 0 00002FAC C6470100 mov byte ptr [1 + bx],0 ; otherwise indicate not accessible 0 00002FB0 31C0 xor ax,ax ; return success 0 00002FB2 1F @@done: pop ds 0 00002FB3 C3 ret 2127 ioctl_getaccess endp 2128 2129 2130 ioctl_locklogical: 2131 ioctl_lockphysical: 2132 ioctl_unlocklogical: 2133 ioctl_unlockphysical: 0 00002FB4 31C0 xor ax,ax ; return success 0 00002FB6 C3 ret 2136 2137 rw_media: 2138 ;-------- 2139 ; On Entry: 2140 ; ES:DI -> UDSC 2141 ; On Exit: 2142 ; ES:DI preserved 2143 ; CY clear, SI -> boot record info 2144 ; CY set on error, AX = error code 2145 ; 2146 ; setup parameters to read/write boot sector to/from local buffer 2147 ; 0 00002FB7 E8F500 call ask_for_disk ; make sure we've got correct floppy 0 00002FBA C74606[0000] mov word [P_STRUC.DMAOFF + bp],offset local_buffer 0 00002FBF 8C5E08 mov [P_STRUC.DMASEG + bp],ds ; set transfer address 0 00002FC2 C746120100 mov word [P_STRUC.COUNT + bp],1 ; read 1 sector 0 00002FC7 268B4513 mov ax,[es:di+UDSC.UDSCBPB+BPB.SPT] 0 00002FCB 26F76515 mul word [es:di+UDSC.UDSCBPB+BPB.HEADS]; get sectors per track * heads 0 00002FCF 91 xchg ax,cx ; CX = sectors per cylinder 0 00002FD0 268B4517 mov ax,word ptr [es:di+UDSC.UDSCBPB+BPB.HIDDEN] 0 00002FD4 268B5519 mov dx,word ptr [es:di+UDSC.UDSCBPB+BPB.HIDDEN+2] 0 00002FD8 894616 mov word ptr [P_STRUC.LBABLOCK + bp],ax ; Logical Block Address of start sector 0 00002FDB 895618 mov word ptr [P_STRUC.LBABLOCK+2 + bp],dx 0 00002FDE F7F1 div cx ; AX = cylinder #, DX = head/sec offset 0 00002FE0 894610 mov [P_STRUC.CYL + bp],ax ; save physical cylinder number 0 00002FE3 31C0 xor ax,ax ; make remainder 32 bit so 0 00002FE5 92 xchg ax,dx ; DX:AX = (head # * SPT) + sector # 0 00002FE6 26F77513 div word [es:di+UDSC.UDSCBPB+BPB.SPT] ; divide by sectors per track 0 00002FEA 88560E mov [P_STRUC.SECTOR + bp],dl ; DX = sector #, AX = head # 0 00002FED 88460F mov [P_STRUC.HEAD + bp],al ; save physical sector/head for later 0 00002FF0 E88BFD call rw_loop ; read the boot sector 0 00002FF3 721E jc rw_media20 0 00002FF5 803E[1500]F0 cmp byte [local_buffer+BPB_SECTOR_OFFSET+BPB.FATID],0F0h 0 00002FFA 7214 jb rw_media10 0 00002FFC 833E[1100]00 cmp word [local_buffer+BPB_SECTOR_OFFSET+BPB.DIRMAX],0 ; FAT32 drive? 0 00003001 7505 jne rw_media05 ; no 0 00003003 BE[4200] mov si,offset local_buffer+UDSC_BPB_LENGTH+BPB_SECTOR_OFFSET+2 0 00003006 EB03 jmps rw_media07 2174 rw_media05: 0 00003008 BE[2600] mov si,offset local_buffer+OLD_UDSC_BPB_LENGTH+BPB_SECTOR_OFFSET+2 2176 rw_media07: 0 0000300B AC lodsb ; get extended boot 0 0000300C 2C29 sub al,29h ; do we have an extended boot ? 0 0000300E 7403 je rw_media20 ; no, well we can't write a new one 2180 rw_media10: 0 00003010 B80380 mov ax,RHS_ERROR+3 ; "unknown command" 2182 rw_media20: 0 00003013 C3 ret 2184 2185 2186 dd_getdev: ; 23-get logical drive 2187 ;--------- 2188 ; get logical drive that corresponds to the physical drive 0 00003014 E8A8F5 call point_unit ; get unit descriptor 0 00003017 E81200 call get_owner ; DL = owning drive (zero not owned) 0 0000301A EB06 jmps dd_setdev10 ; return the owner 2192 2193 2194 dd_setdev: ; 24-set logical drive 2195 ;--------- 2196 ; set logical drive that corresponds to the physical drive 2197 ; 0 0000301C E8A0F5 call point_unit ; get unit descriptor 0 0000301F E84800 call set_owner ; set new owner 2200 dd_setdev10: 0 00003022 C45E02 les bx,[P_DSTRUC.REQUEST + bp] 0 00003025 26885701 mov [es:RH_UNIT + bx],dl ; return current logical drive 0 00003029 31C0 xor ax,ax 0 0000302B C3 ret 2205 2206 get_owner: 2207 ;--------- 2208 ; On Entry: 2209 ; ES:DI -> UDSC_ 2210 ; On Exit: 2211 ; DL = owning drive (zero = no owner) 2212 ; 0 0000302C 31D2 xor dx,dx ; assume one unit per physical drive 0 0000302E 268B453F mov ax,[es:UDSC.FLAGS + di] 0 00003032 A90100 test ax,UDF_HARD 0 00003035 7532 jnz get_owner40 0 00003037 A91000 test ax,UDF_VFLOPPY 0 0000303A 742D jz get_owner40 0 0000303C 1E push ds 0 0000303D 8EDA mov ds,dx ; DS -> low memory 2221 Assume DS:IVECT 0 0000303F 8A160405 mov dl,[dual_byte] 0 00003043 1F pop ds 2224 Assume DS:CGROUP 0 00003044 268A4504 mov al,[es:UDSC.RUNIT + di] ; lets look for this ROS drive 0 00003048 84C0 test al,al ; is it physical unit zero ? 0 0000304A 741C jz get_owner30 ; yes, return dual_byte 0 0000304C 1E push ds ; no, search our internal info 0 0000304D C536[0000] lds si,[udsc_root] 2230 Assume DS:Nothing 2231 get_owner10: 0 00003051 3A4404 cmp al,[UDSC.RUNIT + si] ; do we use the same drive ? 0 00003054 750A jne get_owner20 0 00003056 F7443F2000 test word [UDSC.FLAGS + si],UDF_OWNER 0 0000305B 7403 jz get_owner20 ; do we own it ? 0 0000305D 8A5405 mov dl,[UDSC.DRIVE + si] ; get the logical drive owner 2237 get_owner20: 0 00003060 C534 lds si,[UDSC.NEXT + si] 0 00003062 83FEFF cmp si,0FFFFh ; try the next drive 0 00003065 75EA jne get_owner10 0 00003067 1F pop ds 2242 Assume DS:CGROUP 2243 get_owner30: 0 00003068 42 inc dx ; make drive one based 2245 get_owner40: 0 00003069 C3 ret 2247 2248 set_owner: 2249 ;--------- 2250 ; On Entry: 2251 ; ES:DI -> UDSC_ 2252 ; On Exit: 2253 ; ES:DI preserved 2254 ; DL = owning drive (zero = no owner) 2255 ; 0 0000306A 31D2 xor dx,dx ; assume one unit per physical drive 0 0000306C 268B453F mov ax,[es:UDSC.FLAGS + di] 0 00003070 A90100 test ax,UDF_HARD 0 00003073 7539 jnz set_owner40 0 00003075 A91000 test ax,UDF_VFLOPPY 0 00003078 7434 jz set_owner40 0 0000307A 268A4505 mov al,[es:UDSC.DRIVE + di] 0 0000307E 268A6504 mov ah,[es:UDSC.RUNIT + di] ; get ROS unit 0 00003082 84E4 test ah,ah ; is it unit zero ? 0 00003084 7507 jnz set_owner10 0 00003086 1E push ds 0 00003087 8EDA mov ds,dx ; DS -> low memory 2268 Assume DS:IVECT 0 00003089 A20405 mov [dual_byte],al ; set dual drive support byte 0 0000308C 1F pop ds 2271 Assume DS:CGROUP 2272 set_owner10: 0 0000308D 1E push ds 0 0000308E C536[0000] lds si,[udsc_root] 2275 Assume DS:Nothing 2276 set_owner20: 0 00003092 3A6404 cmp ah,[UDSC.RUNIT + si] ; does this unit use the same drive ? 0 00003095 750D jne set_owner30 0 00003097 834C3F24 or word [UDSC.FLAGS + si],UDF_UNSURE+UDF_OWNER 0 0000309B 3A4505 cmp al,[UDSC.DRIVE + di] 0 0000309E 7404 je set_owner30 0 000030A0 83643FDF and word [UDSC.FLAGS + si],~ UDF_OWNER 2283 set_owner30: 0 000030A4 C534 lds si,[UDSC.NEXT + si] 0 000030A6 83FEFF cmp si,0FFFFh ; end of the line ? 0 000030A9 75E7 jne set_owner20 0 000030AB 1F pop ds 2288 Assume DS:CGROUP 0 000030AC 92 xchg ax,dx ; DL = owning drive 0 000030AD 42 inc dx ; make it one based 2291 set_owner40: 0 000030AE C3 ret 2293 2294 2295 ask_for_disk: ; make sure the right disk is in the floppy drive 2296 ;------------ 0 000030AF E87AFF call get_owner ; DL = owning drive 0 000030B2 4A dec dx ; make DL zero based 0 000030B3 783B js askfdsk30 ; stop if not a logical drive 0 000030B5 268A7505 mov dh,[es:UDSC.DRIVE + di] ; DH = new drive, DL = old drive 0 000030B9 38F2 cmp dl,dh ; do we own the drive ? 0 000030BB 7433 je askfdsk30 ; yes, stop now 0 000030BD 52 push dx ; save for broadcast 0 000030BE 88F2 mov dl,dh ; new owner in DL 0 000030C0 E8A7FF call set_owner ; we are now the owner 0 000030C3 06 push es 0 000030C4 57 push di 0 000030C5 0E push cs 0 000030C6 E83100 call FullScreen 0 000030C9 5F pop di 0 000030CA 07 pop es 0 000030CB 5A pop dx 0 000030CC B8004A mov ax,4A00h ; should we prompt ? 0 000030CF 31C9 xor cx,cx 0 000030D1 CD2F int 2Fh ; lets ask 0 000030D3 41 inc cx ; CX = FFFF ? 0 000030D4 E31A jcxz askfdsk30 ; then skip prompt 2318 %ifdef JAPAN 2319 mov ax,5001h ; get adaptor mode 2320 int VIDEO_INT ; .. 2321 cmp bx,81 ; japanese mode ? 2322 mov si,offset disk_msgA_jpn ; get message to print for Japanese 2323 je askfdsk10 ; yes 2324 %endif 0 000030D6 BE[0000] mov si,offset disk_msgA ; get message to print 2326 askfdsk10: 0 000030D9 E81700 call WriteASCIIZ ; output the string 0 000030DC 268A4505 mov al,[es:UDSC.DRIVE + di] ; get drive letter for new drive 0 000030E0 0441 add al,'A' 0 000030E2 4E dec si ; point to NUL 0 000030E3 E80B00 call WriteNext ; output char, stop at NUL 2332 %ifdef JAPAN 2333 mov ax,5001h ; get adaptor mode 2334 int VIDEO_INT ; .. 2335 cmp bx,81 ; japanese mode ? 2336 mov si,offset disk_msgB_jpn ; get message to print for Japanese 2337 je askfdsk20 ; yes 2338 %endif 0 000030E6 BE[0000] mov si,offset disk_msgB ; get message to print 2340 askfdsk20: 0 000030E9 E80700 call WriteASCIIZ ; output the string 0 000030EC B400 mov ah,0 ; wait for any key to be pressed 0 000030EE CD16 int KEYBOARD_INT ; read one key from keyboard 2344 askfdsk30: 0 000030F0 C3 ret ; we've got the right drive 2346 2347 WriteNext: 0 000030F1 CD29 int 29h ; output via fastconsole entry 2349 WriteASCIIZ: 0 000030F3 2EAC cs lodsb ; get next char 0 000030F5 84C0 test al,al 0 000030F7 75F8 jnz WriteNext ; stop at NUL 0 000030F9 C3 ret 2354 2355 FullScreen: 0 000030FA 31FF xor di,di 0 000030FC 8EC7 mov es,di 0 000030FE B88416 mov ax,1684h ; get the entry point 0 00003101 BB1500 mov bx,21 ; for DOSMGR 0 00003104 CD2F int 2Fh 0 00003106 8CC3 mov bx,es 0 00003108 09FB or bx,di ; anyone there ? 0 0000310A 7405 jz FullScreen10 0 0000310C B80100 mov ax,1 ; yes, go full screen please 0 0000310F 06 push es ; fake a JMPF to ES:DI 0 00003110 57 push di 2367 FullScreen10: 0 00003111 CB retf 2369 2370 0 00003112 0000 max_head dw 0 ; maximum number of heads 0 00003114 0000 max_sect dw 0 ; maximum sectors per track 2373 2374 RCODE ends ; end of device driver code 2375 2376 ;page 2377 === Switch to base=000000h -> "ICODE" 2378 section ICODE class=ICODE ; initialization code 2378 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 2379 2380 Assume CS:CGROUP, DS:CGROUP, ES:Nothing, SS:Nothing 2381 2382 dd_init: ; 0-initialize driver 2383 ;------- 2384 0 000045B6 E84E02 call hard_init ; setup hard disk units 0 000045B9 E82600 call floppy_init ; setup floppy units 2387 0 000045BC C45E02 les bx,[P_DSTRUC.REQUEST + bp] 0 000045BF A0[0700] mov al,[nunits] ; get # of units installed 0 000045C2 2688470D mov [es:RH0_NUNITS + bx],al ; return value to the BDOS 0 000045C6 A2[0000] mov [NumDiskUnits],al ; also set it in device header 2392 0 000045C9 A1[0000] mov ax,[endbios] ; get pointer to last resident byte 0 000045CC 2689470E mov [es:RH0_RESIDENT + bx],ax ; set end of device driver 0 000045D0 268C5F10 mov [es:RH0_RESIDENT+2 + bx],ds 2396 0 000045D4 B8[0000] mov ax,offset bpbtbl 0 000045D7 26894712 mov [es:RH0_BPBOFF + bx],ax ; set BPB table array 0 000045DB 268C5F14 mov [es:RH0_BPBSEG + bx],ds 2400 0 000045DF 29C0 sub ax,ax ; initialization succeeded 0 000045E1 C3 ret ; (BIOS init always does...) 2403 2404 2405 floppy_init: 2406 ;----------- 0 000045E2 C606[0700]00 mov byte [nunits],0 ; floppies start at drive A: 0 000045E7 B400 mov ah,ROS_RESET ; reset the disk system 0 000045E9 31D2 xor dx,dx ; for NEAT hard disk boot bug 0 000045EB E8[0000] int_____DISK_INT 0 000045EE CD11 int EQUIPMENT_INT ; determine equipment status 0 000045F0 B106 mov cl,6 0 000045F2 D3E8 shr ax,cl ; shift down floppy bits 0 000045F4 83E003 and ax,03h ; mask for floppy 0 000045F7 40 inc ax ; correct 0 based code 0 000045F8 A2[0900] mov [nfloppy],al 2417 0 000045FB 3C01 cmp al,1 ; if there is only one floppy 0 000045FD 7501 jne equip_check_des ; then use 2 designators 0 000045FF 40 inc ax ; this fakes a B: drive 2421 equip_check_des: 0 00004600 89C1 mov cx,ax ; CX = # of units to set up 0 00004602 31D2 xor dx,dx ; DL = physical drive 2424 equip_loop: 0 00004604 51 push cx 2426 0 00004605 E8E107 call new_unit ; ES:DI -> UDSC 0 00004608 26885504 mov [es:UDSC.RUNIT + di],dl ; set physical drive (ROS code) 0 0000460C 2681653FFFFD and word [es:UDSC.FLAGS + di],~ UDF_NOACCESS ; floppy access enabled by default 2430 0 00004612 E85700 call floppy_type ; determine type, build default BPB 2432 0 00004615 803E[0900]01 cmp byte [nfloppy],1 ; do we only have single drive? 0 0000461A 7401 je equip_single ; yes, use same physical drive for all 0 0000461C 42 inc dx ; else use new drive for each unit 2436 equip_single: ; we only have one physical drive 2437 0 0000461D E8[F601] call add_unit ; add ES:DI to list of UDSC_'s 2439 0 00004620 59 pop cx 0 00004621 E2E1 loop equip_loop ; repeat for all logical floppies 2442 0 00004623 1E06 pushx 2444 0 00004625 1E push ds ; DS -> i13_trap segment 2446 0 00004626 8CDF mov di,ds 0 00004628 8EC7 mov es,di 0 0000462A 29F6 sub si,si 0 0000462C 8EDE mov ds,si 0 0000462E C57478 lds si,[78h + si] 0 00004631 BF[0000] mov di,offset local_parms ; copy parameters to template 0 00004634 B90B00 mov cx,11 0 00004637 F3A4 rep movsb 2455 0 00004639 07 pop es ; now ES -> i13_trap segment 2457 Assume ES:CGROUP 0 0000463A 29C0 sub ax,ax 0 0000463C 8ED8 mov ds,ax ; DS -> interrupt vectors 2460 Assume DS:IVECT 0 0000463E B8[0000] mov ax,offset Int2FTrap ; hook Int 2F 0 00004641 A3BC00 mov [i2Foff],ax 0 00004644 8C06BE00 mov [i2Fseg],es 0 00004648 B8[0000] mov ax,offset Int13Trap ; hook Int 13 0 0000464B 87064C00 xchg ax,[i13off] 0 0000464F 26A3[0000] mov [es:i13off_save],ax 0 00004653 8CC0 mov ax,es 0 00004655 87064E00 xchg ax,[i13seg] 0 00004659 26A3[0000] mov [es:i13seg_save],ax 2470 0 0000465D BF0005 mov di,500h ; dual drive byte & friends live here 0 00004660 B90900 mov cx,12h/2 ; zero some bytes at 50h:0 0 00004663 29C0 sub ax,ax ; get a quick zero 0 00004665 8EC0 mov es,ax ; ES:DI -> 0:500h 0 00004667 F3AB rep stosw ; setup dual drive byte & friends 2476 2477 Assume DS:CGROUP, ES:Nothing 0 00004669 071F popx 2479 0 0000466B C3 ret 2481 2482 2483 floppy_type: 2484 ;----------- 2485 ; entry: DI -> unit descriptor 2486 0 0000466C C6453E00 mov byte [UDSC.TYP + di],0 ; assume 360K 5.25" floppy 0 00004670 C745412800 mov word [UDSC.NCYL + di],40 ; 40 tracks only 0 00004675 B415 mov ah,ROS_GETTYPE ; "Read DASD type" 0 00004677 E8[0000] int_____DISK_INT ; find out if disk change line available 0 0000467A 7215 jc equip_no_chgline ; skip if function not supported 0 0000467C 80FC02 cmp ah,2 ; floppy with disk change line? 0 0000467F 7510 jne equip_no_chgline ; no, must be old 360K 0 00004681 26834D3F02 or word [es:UDSC.FLAGS + di],UDF_CHGLINE 0 00004686 26C6453E01 mov byte [es:UDSC.TYP + di],1 ; assume 1.2Mb floppy 0 0000468B 26C745415000 mov word [es:UDSC.NCYL + di],80 ; 80 tracks 2497 equip_no_chgline: 0 00004691 065752 pushx ; save our registers 0 00004694 B408 mov ah,ROS_PARAM ; read drive parameters 0 00004696 E8[0000] int_____DISK_INT ; find out floppy type 0 00004699 5A5F07 popx 0 0000469C 723E jc equip_no_type ; skip if PC,XT,jr,AT before 10 Jan 84 0 0000469E 4B dec bx ; make values 0 based 0 0000469F 7921 jns equip_type ; (CMOS invalid - type = 0) 0 000046A1 31DB xor bx,bx ; assume 360K 0 000046A3 80FD4F cmp ch,4fh ; is it 80 track ? 0 000046A6 7534 jne equip_no_type ; if not forget it 0 000046A8 B301 mov bl,1 ; BL = 1 (ie. 1.2M) 0 000046AA 80F90F cmp cl,15 ; 15 spt ? 0 000046AD 7413 je equip_type 0 000046AF 43 inc bx ; BL = 2 (ie. 720k) 0 000046B0 80F909 cmp cl,9 ; 9 spt ? 0 000046B3 740D je equip_type 0 000046B5 43 inc bx ; BL = 3 (ie. 1.4M) 0 000046B6 80F912 cmp cl,18 ; 18 spt ? 0 000046B9 7407 je equip_type 0 000046BB 43 inc bx 0 000046BC 43 inc bx ; BL = 5 (ie. 2.8M) 0 000046BD 80F924 cmp cl,36 ; 36 spt ? 0 000046C0 751A jne equip_no_type ; don't recognise anything 2521 equip_type: 0 000046C2 80FB00 cmp bl,0 ; 360K 5.25"? 0 000046C5 7411 je equip_type_ok ; yes 0 000046C7 26C745415000 mov word [es:UDSC.NCYL + di],80 ; else assume 80 tracks 0 000046CD 80FB03 cmp bl,3 ; is it 1.44 Mb 3.5" type? 0 000046D0 7206 jb equip_type_ok ; skip if 360K, 1.2Mb, 720K (0, 1, 2) 0 000046D2 B307 mov bl,7 ; use reserved "Other" type 0 000046D4 7402 je equip_type_ok 0 000046D6 43 inc bx ; else make it 2.88 Mb type 9 0 000046D7 43 inc bx 2531 equip_type_ok: 0 000046D8 26885D3E mov [es:UDSC.TYP + di],bl ; set the default drive type for format 2533 equip_no_type: 2534 0 000046DC 268A453E mov al,[es:UDSC.TYP + di] ; AL = 0, 1, 2 or 7 (360/1.2/720/1.44) 0 000046E0 98 cbw ; make it a word 0 000046E1 96 xchg ax,si ; SI = drive type 0 000046E2 D1E6 shl si,1 ; SI = drive type * 2 0 000046E4 8BB4[0000] mov si,[bpbs + si] ; get default BPB for drive 0 000046E8 81FE[0000] cmp si,offset bpb360 ; is this is a 360 K drive? 0 000046EC 7506 jne equip_360 ; skip if any other type 0 000046EE C787[0000][0000] mov word [bpbtbl + bx],offset bpb720 ; use larger default BPB 2543 equip_360: 0 000046F4 B93500 mov cx,UDSC_BPB_LENGTH ; CX = size of BPB 0 000046F7 06575651 pushx 0 000046FB 8D7D06 lea di,[UDSC.UDSCBPB + di] 0 000046FE 8CD8 mov ax,ds 0 00004700 8EC0 mov es,ax ; ES = DS 0 00004702 F3A4 rep movsb ; make default BPB current BPB in UDSC 0 00004704 595E5F07 popx 2551 0 00004708 51 push cx 0 00004709 56 push si 2554 ; This check is reported to be needed for an 2555 ; emulated diskette drive created by GRUB4DOS. 0 0000470A 84D2 test dl, dl ; Hard Disk ? 0 0000470C 7951 jns equip_type_nolba ; no --> 0 0000470E 065752 pushx 0 00004711 B448 mov ah,ROS_LBAPARAM ; get extended drive parameters 0 00004713 8D36[0E00] lea si,[int13ex_para] ; DS:SI -> drive parameter buffer 0 00004717 E8[0000] int_____DISK_INT 0 0000471A 5A5F07 popx 0 0000471D 7240 jc equip_type_nolba ; error, assume standard FDD 0 0000471F F744020400 test word ptr [2 + si],4 ; removable drive? 0 00004724 7539 jnz equip_type_nolba ; no 0 00004726 26834D3F01 or word [es:UDSC.FLAGS + di],UDF_HARD ; classify it as hard disk 0 0000472B 8B4404 mov ax,[4 + si] ; number of cylinders 0 0000472E 26894541 mov [es:UDSC.NCYL + di],ax 0 00004732 8B4408 mov ax,[8 + si] ; number of heads 0 00004735 A2[0200] mov [nhead],al 0 00004738 8B440C mov ax,[0ch + si] ; number of sectors per track 0 0000473B A2[0100] mov [nsect],al 0 0000473E 8B4410 mov ax,[10h + si] ; total number of sectors 0 00004741 2689451B mov word ptr [es:di+UDSC.UDSCBPB+BPB.SIZ],ax 0 00004745 8B4412 mov ax,[12h + si] 0 00004748 2689451D mov word ptr [es:di+UDSC.UDSCBPB+BPB.SIZ+2],ax 0 0000474C 8D5D06 lea bx,[UDSC.UDSCBPB + di] 0 0000474F 06575652 pushx 0 00004753 E82C05 call hd_bpb ; build BPB from scratch 0 00004756 5A5E5F07 popx 0 0000475A 5E pop si 0 0000475B 8D7506 lea si,[UDSC.UDSCBPB + di] 0 0000475E 56 push si 2584 equip_type_nolba: 0 0000475F 5E pop si 0 00004760 59 pop cx 0 00004761 0657 pushx 0 00004763 8D7D43 lea di,[UDSC.DEVBPB + di] 0 00004766 F3A4 rep movsb ; copy BPB to device BPB in UDSC 0 00004768 5F07 popx 0 0000476A C3 ret 2592 2593 2594 ; page 2595 2596 LOG_PRIM equ 01h ; log in primary partitions 2597 LOG_EXTD equ 02h ; log in extended partitions 2598 0 0000476B 0100 log_flag dw LOG_PRIM ; scan for primary only initially 2600 0 0000476D 312E780D0A00 ver_1x db "1.x",CR,LF,NUL 0 00004773 322E302F4544442D31 ver_20 db "2.0/EDD-1.0",CR,LF,NUL 0 0000477C 2E300D0A00 0 00004781 322E312F4544442D31 ver_21 db "2.1/EDD-1.1",CR,LF,NUL 0 0000478A 2E310D0A00 0 0000478F 4544442D332E300D0A ver_30 db "EDD-3.0",CR,LF,NUL 0 00004798 00 0 00004799 537570706F72746564 lba_supp_msg db "Supported version of int 13 extensions: ", NUL 0 000047A2 2076657273696F6E20 0 000047AB 6F6620696E74203133 0 000047B4 20657874656E73696F 0 000047BD 6E733A2000 0 000047C2 7761726E696E673A20 last_sect_msg db "warning: can't read last partition sector, verify partition layout", CR, LF, NUL 0 000047CB 63616E277420726561 0 000047D4 64206C617374207061 0 000047DD 72746974696F6E2073 0 000047E6 6563746F722C207665 0 000047EF 726966792070617274 0 000047F8 6974696F6E206C6179 0 00004801 6F75740D0A00 2607 2608 hard_init: ; setup all hard disk units 2609 ;--------- 2610 ; mov log_flag,LOG_PRIM ; log in primary only initially 0 00004807 E80600 call hardi0 ; C: & D: 0 0000480A C706[B501]0200 mov word [log_flag],LOG_EXTD ; log in extended only 2613 ; call hardi0 2614 ; ret 2615 2616 hardi0: 0 00004810 B408 mov ah,ROS_PARAM ; get hard disk parameters 0 00004812 B280 mov dl,80h 0 00004814 E8[0000] int_____DISK_INT ; get # of hard disks we have 0 00004817 7303E99400 jc hardi9 ; skip if hard disks not supported 0 0000481C 84D2 test dl,dl ; test if any hard disks found 0 0000481E 7503E98D00 jz hardi9 ; skip if there weren't any 0 00004823 88D0 mov al,dl 0 00004825 98 cbw 0 00004826 91 xchg ax,cx ; CX = # of hard disks 0 00004827 B280 mov dl,80h ; start with first hard disk 2627 hardi1: 0 00004829 C706[4000]0000 mov word [lastpart],0 0 0000482F C706[4200]0000 mov word [lastpart+2],0 0 00004835 5152 pushx ; save drive count, physical drive 0 00004837 1E push ds 0 00004838 BB4000 mov bx, 40h 0 0000483B 8EDB mov ds, bx 2634 ; Setting ds = 40h is a Book8088 bugfix, refer to 2635 ; http://www.bttr-software.de/forum/forum_entry.php?id=21061 0 0000483D B80041 mov ax, 4100h ; int 13 extensions available? 0 00004840 BBAA55 mov bx, 55AAh 0 00004843 31C9 xor cx, cx ; harden 0 00004845 B600 mov dh, 0 ; harden 0 00004847 F9 stc ; harden 0 00004848 E8[0100] call Int13_Keep_CF ; pass CY to int 13h 0 0000484B 1F pop ds 0 0000484C 724E jc hardi4 0 0000484E 81FB55AA cmp bx,0aa55h 0 00004852 7548 jnz hardi4 0 00004854 833E[0A00]00 cmp word [int13ex_ver],0 0 00004859 7537 jnz hardi3 0 0000485B BE[E301] mov si,offset lba_supp_msg 0 0000485E E8[0000] call output_msg 0 00004861 80FC01 cmp ah,01 0 00004864 7509 jnz ver20 0 00004866 8D36[B701] lea si,[ver_1x] 0 0000486A E8[0000] call output_msg 0 0000486D EB23 jmp hardi3 2655 ver20: 0 0000486F 80FC20 cmp ah,20h 0 00004872 7509 jnz ver21 0 00004874 8D36[BD01] lea si,[ver_20] 0 00004878 E8[0000] call output_msg 0 0000487B EB15 jmp hardi3 2661 ver21: 0 0000487D 80FC21 cmp ah,21h 0 00004880 7509 jnz ver30 0 00004882 8D36[CB01] lea si,[ver_21] 0 00004886 E8[0000] call output_msg 0 00004889 EB07 jmp hardi3 2667 ver30: 0 0000488B 8D36[D901] lea si,[ver_30] 0 0000488F E8[0000] call output_msg 2670 hardi3: 0 00004892 8826[0A00] mov byte ptr [int13ex_ver],ah ; version of int 13 extensions 0 00004896 890E[0C00] mov [int13ex_bits],cx ; int 13 API support bitmap 0 0000489A EB0C jmp hardi2 2674 hardi4: 0 0000489C C706[0A00]0000 mov word [int13ex_ver],0 0 000048A2 C706[0C00]0000 mov word [int13ex_bits],0 2677 hardi2: 0 000048A8 E80900 call login_hdisk ; find all partitions on hard disk 0 000048AB 5A59 popx ; restore physical drive, drive count 0 000048AD 42 inc dx ; next physical hard disk 0 000048AE E201 loop hardi1_j ; next physical hard disk 2682 hardi9: ; all hard disks done 0 000048B0 C3 ret 2684 2685 hardi1_j: 0 000048B1 E975FF jmp hardi1 ; near jump 2687 2688 2689 login_hdisk: ; find all partitions on a hard disk 2690 ;----------- 2691 ; entry: DL = 80h, 81h for 1st/2nd hard disk 2692 0 000048B4 FF36[B501] push word [log_flag] ; save state for next drive 2694 0 000048B8 8816[0000] mov [p_unit],dl ; save physical drive 2696 2697 ; get drive parameters 0 000048BC 52 push dx 0 000048BD 06 push es 0 000048BE B408 mov ah,ROS_PARAM ; get drive parameters 0 000048C0 E8[0000] int_____DISK_INT 0 000048C3 FEC6 inc dh ; DH = number of heads 0 000048C5 8836[0200] mov [nhead],dh ; set # of heads on drive 0 000048C9 FECE dec dh 0 000048CB 88C8 mov al,cl 0 000048CD 243F and al,3Fh ; isolate sector count 0 000048CF A2[0100] mov [nsect],al ; set sectors per track 0 000048D2 07 pop es 0 000048D3 58 pop ax 2710 2711 ; CX, DX still valid from above INT call 0 000048D4 88C2 mov dl,al 0 000048D6 8D36[0000] lea si,[diskaddrpack] ; pointer to disk address packet 0 000048DA E8[2104] call login_CHS2LBA ; convert CHS values to LBA 0 000048DD 8B4408 mov ax,word ptr [si+8] ; largest block available via CHS 0 000048E0 A3[3400] mov word ptr [partend_max],ax 0 000048E3 8B440A mov ax,word ptr [si+10] 0 000048E6 A3[3600] mov word ptr [partend_max+2],ax 0 000048E9 C706[3C00]0000 mov word [ptstart],0 ; block 0 0 000048EF C706[3E00]0000 mov word [ptstart+2],0 0 000048F5 C706[3800]0000 mov word [extoffset],0 0 000048FB C706[3A00]0000 mov word [extoffset+2],0 0 00004901 C606[4400]00 mov byte [extoffvalid],0 2724 ; mov cx,0001h ; track 0, sector 1 2725 ; mov dh,0 ; partition tables start on head 0 2726 ; lea si,diskaddrpack ; pointer to disk address packet 2727 ; mov word ptr [si+8],0 ; block 0 2728 ; mov word ptr [si+10],0 2729 log_h1: 0 00004906 8A16[0000] mov dl,[p_unit] ; get physical unit 0 0000490A F706[0C00]0100 test word [int13ex_bits],1 ; LBA support? 0 00004910 751A jnz log_h1b ; yes, proceed normally 0 00004912 A1[3E00] mov ax,word ptr [ptstart+2] ; partition table accessible via CHS? 0 00004915 3B06[3600] cmp ax,word ptr [partend_max+2] 0 00004919 7603E91501 ja log_h9 ; table out of CHS bounds, terminating PT chain 0 0000491E 720C jb log_h1b ; within bounds, proceed 0 00004920 A1[3C00] mov ax,word ptr [ptstart] 0 00004923 3B06[3400] cmp ax,word ptr [partend_max] 0 00004927 7603E90701 ja log_h9 ; out of bounds, terminate PT chain here 2740 log_h1b: 0 0000492C 56 push si 0 0000492D 8D36[0000] lea si,[diskaddrpack] ; pointer to disk address packet 0 00004931 A1[3C00] mov ax,word ptr [ptstart] ; partition table sector 0 00004934 894408 mov word ptr [si+8],ax 0 00004937 A1[3E00] mov ax,word ptr [ptstart+2] 0 0000493A 89440A mov word ptr [si+10],ax 0 0000493D E8[9A04] call login_read_dx_lba 0 00004940 5E pop si 0 00004941 7303 jnc log_h1a 0 00004943 E9ED00 jmp log_h9 ; give up if disk error 2751 log_h1a: 2752 ;; cmp local_id,0AA55h 2753 ;; jne log_h9 ; give up if not initialized 2754 0 00004946 F706[B501]0100 test word [log_flag],LOG_PRIM ; scanning for primary? 0 0000494C 7460 jz log_h5 ; no, ignore all primary partitions 2757 0 0000494E BE[0000] mov si,offset local_pt ; point to partition table 2759 log_h2: 2760 ;** SECURE PARTITIONS ** 0 00004951 A0[4600] mov al,[init_runit] 0 00004954 84C0 test al,al ; booting from a hard disk ? 2763 ;** SECURE PARTITIONS ** 0 00004956 8A4404 mov al,[4 + si] ; get system ID 2765 ;** SECURE PARTITIONS ** 0 00004959 7911 jns log_h2a ; booting from a hard disk ? 0 0000495B 88C4 mov ah,al ; yes, allow secure partitions 0 0000495D 80E4F0 and ah,0F0h 0 00004960 80FCC0 cmp ah,SEC_ID 0 00004963 7405 je log_h02 0 00004965 80FCD0 cmp ah,SEC_ID2 0 00004968 7502 jne log_h2a 2773 log_h02: 0 0000496A 28E0 sub al,ah ; turn into a sensible partition ID 2775 log_h2a: 2776 ;** SECURE PARTITIONS ** 0 0000496C 3C01 cmp al,DOS20_ID ; is this a DOS 2.x partition? 0 0000496E 7414 je log_h3 ; yes, try to log it in 0 00004970 3C04 cmp al,DOS30_ID ; is this a DOS 3.0/3.1/3.2 partition? 0 00004972 7410 je log_h3 ; yes, try to log it in 0 00004974 3C06 cmp al,DOS331_ID ; is this a DOS 3.31/4.0 partition? 0 00004976 740C je log_h3 ; yes, try to log it in 0 00004978 3C0E cmp al,FAT16X_ID ; is this a DOS 7.x FAT16 LBA partition? 0 0000497A 7408 je log_h3 ; yes, try to log it in 0 0000497C 3C0B cmp al,FAT32_ID ; is this a DOS 7.x FAT32 partition? 0 0000497E 7404 je log_h3 ; yes, try to log it in 0 00004980 3C0C cmp al,FAT32X_ID ; is this a DOS 7.x FAT32 LBA partition? 0 00004982 7521 jne log_h4 ; skip if not a good partition 2789 log_h3: 0 00004984 56 push si ; save partition table index 0 00004985 5152 pushx ; save partition table address 0 00004987 E8AE00 call login_primary ; login primary partition 0 0000498A 5A59 popx ; get partition table address 0 0000498C 8D36[0000] lea si,[diskaddrpack] ; pointer to disk address packet 0 00004990 A1[3C00] mov ax,word ptr [ptstart] ; offset of partition table 0 00004993 894408 mov word ptr [si+8],ax 0 00004996 A1[3E00] mov ax,word ptr [ptstart+2] 0 00004999 89440A mov word ptr [si+10],ax 0 0000499C E8[9A04] call login_read_dx_lba ; re-read partition table 0 0000499F 5E pop si ; get partition table index 0 000049A0 7303E98E00 jc log_h9 ; give up if error 2802 log_h4: 0 000049A5 83C610 add si,16 ; next partition table entry 0 000049A8 81FE[0000] cmp si,offset local_id ; all partitions checked? 0 000049AC 72A3 jb log_h2 ; loop back if more 2806 2807 log_h5: ; primary partitions done 0 000049AE F706[B501]0200 test word [log_flag],LOG_EXTD ; scanning for extended? 0 000049B4 747D jz log_h9 ; skip if no extended scan 2810 0 000049B6 830E[B501]01 or word [log_flag],LOG_PRIM ; scan for both types now 0 000049BB BE[0000] mov si,offset local_pt ; SI -> partition table 2813 ; RG-01 2814 log_h6: 2815 ;** SECURE PARTITIONS ** 0 000049BE A0[4600] mov al,[init_runit] 0 000049C1 84C0 test al,al ; booting from a hard disk ? 2818 ;** SECURE PARTITIONS ** 0 000049C3 8A4404 mov al,[4 + si] ; get system ID 2820 ;** SECURE PARTITIONS ** 0 000049C6 7911 jns log_h6a ; booting from a hard disk ? 0 000049C8 88C4 mov ah,al ; yes, allow secure partitions 0 000049CA 80E4F0 and ah,0F0h 0 000049CD 80FCC0 cmp ah,SEC_ID 0 000049D0 7405 je log_sec2 0 000049D2 80FCD0 cmp ah,SEC_ID2 0 000049D5 7502 jne log_h6a 2828 log_sec2: 0 000049D7 28E0 sub al,ah 2830 log_h6a: 2831 ;** SECURE PARTITIONS ** 0 000049D9 3C05 cmp al,DOSEX_ID ; DOS 3.3 extended partition found? 0 000049DB 7404 je log_h6b 0 000049DD 3C0F cmp al,EXTX_ID 0 000049DF 7549 jne log_h7 2836 log_h6b: 0 000049E1 A1[3800] mov ax,word ptr [extoffset] ; compute offset of next partition table 0 000049E4 034408 add ax,[si+8] 0 000049E7 A3[3C00] mov word ptr [ptstart],ax 0 000049EA A1[3A00] mov ax,word ptr [extoffset+2] 0 000049ED 13440A adc ax,[si+10] 0 000049F0 A3[3E00] mov word ptr [ptstart+2],ax 0 000049F3 F606[4400]01 test byte [extoffvalid],1 ; first extended partition? 0 000049F8 7511 jnz log_h6c ; no, then use the old value 0 000049FA 8B4408 mov ax,[si+8] ; use this offset as offset for all other extended partitions 0 000049FD A3[3800] mov word ptr [extoffset],ax 0 00004A00 8B440A mov ax,[si+10] 0 00004A03 A3[3A00] mov word ptr [extoffset+2],ax 0 00004A06 C606[4400]01 mov byte [extoffvalid],1 ; set offset valid flag 2850 log_h6c: 2851 ; mov dh,1[si] ; get head # for next table 2852 ; mov cx,2[si] ; get cylinder, sector for next table 2853 ; xchg ch,cl ; compute 10-bit cylinder number 2854 ; rol ch,1 2855 ; rol ch,1 2856 ; and cx,3ffh 0 00004A0B A1[3E00] mov ax,word ptr [ptstart+2] ; check for loops in the PT chain 0 00004A0E 3B06[4200] cmp ax,word ptr [lastpart+2] ; higher block number than last table? 0 00004A12 7707 ja log_h6d ; yes, then proceed with this table 2860 ; jb log_h7 ; no, do not follow chain to this table 0 00004A14 A1[3C00] mov ax,word ptr [ptstart] 0 00004A17 3B06[4000] cmp ax,word ptr [lastpart] 2863 ; jbe log_h7 ; no, do not follow chain to this table 2864 log_h6d: 0 00004A1B A1[3C00] mov ax,word ptr [ptstart] ; store address of last partition table for comparison 0 00004A1E A3[4000] mov word ptr [lastpart],ax 0 00004A21 A1[3E00] mov ax,word ptr [ptstart+2] 0 00004A24 A3[4200] mov word ptr [lastpart+2],ax 2869 ; mov cx,2[si] 0 00004A27 E9DCFE jmp log_h1 ; read & scan next partition table 2871 2872 log_h7: ; entry not an extended partition 2873 ; mov cx,2[si] 0 00004A2A 83C610 add si,16 ; next partition table entry 0 00004A2D 81FE[FE01] cmp si,offset local_buffer+IDOFF; all partitions checked? 0 00004A31 728B jb log_h6 ; loop back if more 2877 2878 log_h9: ; drive login done 0 00004A33 8F06[B501] pop word [log_flag] ; restore state for next drive 0 00004A37 C3 ret 2881 2882 2883 login_primary: 2884 ;------------- 2885 ; entry: SI -> partition table entry 2886 0 00004A38 8B440C mov ax,[12 + si] ; get size of partition (low) 0 00004A3B A3[0300] mov [part_size],ax 0 00004A3E 8B440E mov ax,[14 + si] ; get size of partition (high) 0 00004A41 A3[0500] mov [part_size+2],ax 0 00004A44 A1[3C00] mov ax,word ptr [ptstart] ; compute begin of partition 0 00004A47 034408 add ax,word ptr [si+8] 0 00004A4A A3[2C00] mov word ptr [partstart],ax 0 00004A4D A1[3E00] mov ax,word ptr [ptstart+2] 0 00004A50 13440A adc ax,word ptr [si+10] 0 00004A53 A3[2E00] mov word ptr [partstart+2],ax 0 00004A56 A1[2C00] mov ax,word ptr [partstart] ; compute end of partition 0 00004A59 03440C add ax,word ptr [si+12] 0 00004A5C A3[3000] mov word ptr [partend],ax 0 00004A5F A1[2E00] mov ax,word ptr [partstart+2] 0 00004A62 13440E adc ax,word ptr [si+14] 0 00004A65 A3[3200] mov word ptr [partend+2],ax 0 00004A68 832E[3000]01 sub word [partend],1 ; minus one 0 00004A6D 831E[3200]00 sbb word [partend+2],0 0 00004A72 8A4404 mov al,[si+4] ; get partition type 0 00004A75 A2[4500] mov [parttype],al 0 00004A78 F706[0C00]0100 test word [int13ex_bits],1 ; LBA support present? 0 00004A7E 750E jnz login_p0 ; yes, then proceed normally 0 00004A80 803E[4500]0E cmp byte [parttype],FAT16X_ID ; LBA partition? 0 00004A85 744A je login_p9 ; ignore this if LBA support not present 0 00004A87 803E[4500]0C cmp byte [parttype],FAT32X_ID ; LBA partition? 0 00004A8C 7443 je login_p9 ; ignore this if LBA support not present 2913 login_p0: 0 00004A8E 535152 pushx 0 00004A91 8D36[0000] lea si,[diskaddrpack] ; pointer to disk address packet 0 00004A95 A1[3000] mov ax,word ptr [partend] ; copy last partition sector number 0 00004A98 894408 mov word ptr [si+8],ax ; to test-read 0 00004A9B A1[3200] mov ax,word ptr [partend+2] 0 00004A9E 89440A mov word ptr [si+10],ax 0 00004AA1 E8[9A04] call login_read_dx_lba ; try to read last partition sector 0 00004AA4 5A595B popx 0 00004AA7 7306 jnc login_p1 0 00004AA9 BE[0C02] mov si,offset last_sect_msg ; and warn if not readable 0 00004AAC E8[0000] call output_msg 2925 login_p1: 0 00004AAF 535152 pushx 0 00004AB2 8D36[0000] lea si,[diskaddrpack] ; pointer to disk address packet 0 00004AB6 A1[2C00] mov ax,word ptr [partstart] ; copy partition start sector number 0 00004AB9 894408 mov word ptr [si+8],ax 0 00004ABC A1[2E00] mov ax,word ptr [partstart+2] 0 00004ABF 89440A mov word ptr [si+10],ax 0 00004AC2 E8[9A04] call login_read_dx_lba ; try to read the first sector 0 00004AC5 5A595B popx 0 00004AC8 7207 jc login_p9 ; skip if partition not readable 2935 ; CX, DX = disk addr of 1st sector 2936 ; SI -> boot sector 2937 ; PART_SIZE = 32 bit partition address 0 00004ACA 803E[0700]1A cmp byte [nunits],MAXPART ; do we already have the maximum? 0 00004ACF 7201 jb log_p0 ; skip if space for more units 2940 login_p9: 0 00004AD1 C3 ret ; else ignore this partition 2942 2943 log_p0: 0 00004AD2 E81403 call new_unit ; ES:DI -> new UDSC 0 00004AD5 803E[4500]0E cmp byte [parttype],FAT16X_ID ; LBA partition? 0 00004ADA 741B je log_p0a ; yes, then always use LBA 0 00004ADC 803E[4500]0C cmp byte [parttype],FAT32X_ID ; LBA partition? 0 00004AE1 7414 je log_p0a ; yes, then always use LBA 0 00004AE3 A1[3200] mov ax,word ptr [partend+2] ; test if beyond CHS barrier 0 00004AE6 3B06[3600] cmp ax,word ptr [partend_max+2] 0 00004AEA 770B ja log_p0a ; yes, then use LBA 0 00004AEC 7217 jb log_p0b ; within CHS bounds, do not use LBA 0 00004AEE A1[3000] mov ax,word ptr [partend] 0 00004AF1 3B06[3400] cmp ax,word ptr [partend_max] 0 00004AF5 760E jbe log_p0b ; within CHS bounds, do not use LBA 2956 log_p0a: 0 00004AF7 A1[0C00] mov ax,word ptr [int13ex_bits]; int 13 extensions support bitmap 0 00004AFA A90100 test ax,1 ; extended disk access functions? 0 00004AFD 7406 jz log_p0b ; no => use CHS access 0 00004AFF 26814D3F0004 or word [es:UDSC.FLAGS + di],UDF_LBA ; else enable LBA access for drive 2961 log_p0b: 0 00004B05 26834D3F01 or word [es:UDSC.FLAGS + di],UDF_HARD 0 00004B0A 26885504 mov [es:UDSC.RUNIT + di],dl ; set physical drive (ROS code) 0 00004B0E 26C6453E05 mov byte [es:UDSC.TYP + di],5 ; set type = hard disk 0 00004B13 26C745790100 mov word [es:UDSC_FM_PART + di],1 0 00004B19 26C7457B0000 mov word [es:UDSC_FM_OFFSET + di],0 2967 0 00004B1F 88F0 mov al,dh ; copy head byte 0 00004B21 24C0 and al,11000000b ; cylinder # bits 10..11 are in 6..7 0 00004B23 D0C0 rol al,1 ; shift bits to bottom of word 0 00004B25 D0C0 rol al,1 0 00004B27 88CC mov ah,cl ; cylinder # bits 8..9 are in 6..7 0 00004B29 80E4C0 and ah,11000000b ; strip off non-cylinder # bits 0 00004B2C 08C4 or ah,al ; combine the bits 0 00004B2E D0C4 rol ah,1 ; shift the bits into place 0 00004B30 D0C4 rol ah,1 0 00004B32 88E8 mov al,ch ; cylinder # bits 0..7 0 00004B34 29C3 sub bx,ax ; bx = # cylinders 0 00004B36 43 inc bx ; make it inclusive 0 00004B37 26895D41 mov [es:UDSC.NCYL + di],bx ; and save it 2981 ; push ax ; save # CYLINDERS 2982 ; mov al,nsect 2983 ; and dh,00111111b ; DH = head offset 2984 ; mul dh ; AX = HEAD_OFF * NSECT 2985 ; xchg ax,bx ; keep in BX 2986 ; mov al,nsect 2987 ; mul nhead ; AX = HEADS * NSECT 2988 ; pop dx ; recover # CYLINDERS 2989 ; mul dx ; DX:AX = CYLINDERS * HEADS * NSECT 2990 ; add ax,bx 2991 ; adc dx,0 ; DX:AX = (CYL*HEADS + HEAD_OFF)*NSECT 2992 2993 ; and cx,00111111b ; isolate bottom 6 bits (sector #) 2994 ; dec cx ; sector numbers are one-relative 2995 ; add ax,cx ; add in non-partition sectors 2996 ; adc dx,0 ; (usually 2.x partition table) 2997 0 00004B3B 8D5D06 lea bx,[UDSC.UDSCBPB + di] ; BX -> BPB to build 0 00004B3E 83C60B add si,BPB_SECTOR_OFFSET ; skip JMP + OEM name in boot sector 3000 0 00004B41 A1[2C00] mov ax,word ptr [partstart] 0 00004B44 8B16[2E00] mov dx,word ptr [partstart+2] 0 00004B48 894711 mov word ptr [BPB.HIDDEN + bx],ax ; set the partition address 0 00004B4B 895713 mov word ptr [BPB.HIDDEN+2 + bx],dx ; (32 bit sector offset) 0 00004B4E A1[0300] mov ax,[part_size] 0 00004B51 8B16[0500] mov dx,[part_size+2] 0 00004B55 894715 mov word ptr [BPB.SIZ + bx],ax ; set partition size in sectors 0 00004B58 895717 mov word ptr [BPB.SIZ+2 + bx],dx 3009 0 00004B5B 894708 mov [BPB.TOTSEC + bx],ax ; set partition size for < 32 Mb 3011 ; we'll zero this later if > 32 Mb 0 00004B5E 0657505256 pushx 0 00004B63 E81C01 call hd_bpb ; build BPB from scratch 0 00004B66 5E5A585F07 popx 3015 0 00004B6B 807CF5E9 cmp byte ptr [si-11],0E9h ; look for a jmp 0 00004B6F 7413 jz log_p1a 0 00004B71 817CF590EB cmp word ptr [si-11],0EB90h ; look for a nop!jmps 0 00004B76 740C jz log_p1a 0 00004B78 807CF5EB cmp byte ptr [si-11],0EBh ; look for a jmps 0 00004B7C 751E jnz log_p1 ; at the start of the boot sector. 0 00004B7E 807CF790 cmp byte ptr [si-9],90h ; EJH 7-1-91 0 00004B82 7518 jnz log_p1 3024 log_p1a: 3025 0 00004B84 F704FF01 test word [BPB.SECSIZ + si],SECSIZE-1; not a multiple of 512 byte? 0 00004B88 7512 jnz log_p1 0 00004B8A 807C0AF8 cmp byte [BPB.FATID + si],0F8h ; is this a good hard disk? 0 00004B8E 750C jne log_p1 3030 BPB.NFATS equ NFATS ; NASM port label 0 00004B90 807C0502 cmp byte [BPB.NFATS + si],2 ; too many FATs? 0 00004B94 7706 ja log_p1 0 00004B96 807C0501 cmp byte [BPB.NFATS + si],1 ; no FATs at all? 0 00004B9A 7303 jae log_p2 ; continue if BPB is valid 3035 ; elsa build new BPB 3036 log_p1: ; any of the above: BPB invalid 3037 ; (propably FDISKed, not FORMATted yet) 0 00004B9C E9CA00 jmp log_p9 3039 3040 log_p2: ; valid BPB for partition, AX/DX = size 0 00004B9F 2681653FFFFD and word [es:UDSC.FLAGS + di], ~ UDF_NOACCESS ; mark drive as accessible 0 00004BA5 837C0800 cmp word ptr [BPB.TOTSEC + si], 0 ; BPB says small size ? 0 00004BA9 750B jne log_p2a ; no --> 0 00004BAB 85D2 test dx, dx ; partition table says larger ? 0 00004BAD 7511 jnz log_replace ; yes, replace it with BPB size --> 0 00004BAF 394408 cmp word ptr [BPB.TOTSEC + si], ax ; BPB says smaller than partition table ? 0 00004BB2 720C jb log_replace ; yes, replace it with BPB size --> 0 00004BB4 EB22 jmp log_p2z 3049 log_p2a: 0 00004BB6 395417 cmp word ptr [BPB.SIZ+2 + si], dx ; BPB says smaller than partition table ? 0 00004BB9 7503 jne log_p2b 0 00004BBB 394415 cmp word ptr [BPB.SIZ + si], ax 3053 log_p2b: 0 00004BBE 7318 jae log_p2z ; no --> 3055 3056 log_replace: 0 00004BC0 8B4C08 mov cx, word ptr [BPB.TOTSEC + si] ; = 0 or small size 0 00004BC3 8B5417 mov dx, word ptr [BPB.SIZ+2 + si] 0 00004BC6 8B4415 mov ax, word ptr [BPB.SIZ + si] 0 00004BC9 E304 jcxz log_p2x ; if to use large size --> 0 00004BCB 31D2 xor dx, dx 0 00004BCD 89C8 mov ax, cx ; use small size as large size too 3063 log_p2x: 0 00004BCF 894F08 mov word ptr [BPB.TOTSEC + bx], cx ; set small size 0 00004BD2 894715 mov word ptr [BPB.SIZ + bx], ax 0 00004BD5 895717 mov word ptr [BPB.SIZ+2 + bx], dx ; set large size 3067 3068 log_p2z: 0 00004BD8 50 push ax 3070 BPB.ALLOCSIZ equ ALLOCSIZ ; NASM port label 0 00004BD9 8A4402 mov al,[BPB.ALLOCSIZ + si] ; copy a few parameters from the 0 00004BDC 884702 mov [BPB.ALLOCSIZ + bx],al ; Boot Sector BPB to our new BPB 0 00004BDF 8B4406 mov ax,[BPB.DIRMAX + si] ; EJH 7-1-91 0 00004BE2 894706 mov [BPB.DIRMAX + bx],ax 3075 BPB.FATSEC equ FATSEC ; NASM port label 0 00004BE5 8B440B mov ax,[BPB.FATSEC + si] 0 00004BE8 89470B mov [BPB.FATSEC + bx],ax 0 00004BEB 8B04 mov ax,[BPB.SECSIZ + si] 0 00004BED 8907 mov [BPB.SECSIZ + bx],ax 3080 BPB.FATADD equ FATADD ; NASM port label 0 00004BEF 8B4403 mov ax,[BPB.FATADD + si] 0 00004BF2 894703 mov [BPB.FATADD + bx],ax 0 00004BF5 8A4405 mov al,[BPB.NFATS + si] 0 00004BF8 884705 mov [BPB.NFATS + bx],al 0 00004BFB 837C0B00 cmp word [BPB.FATSEC + si],0 ; is this a FAT32 BPB? 0 00004BFF 740D je log_p21 ; yes, then copy some more parameters 0 00004C01 8B440B mov ax,[BPB.FATSEC + si] ; expand sectors per FAT value to 32-bit 3088 BPB.BFATSEC equ BFATSEC ; NASM port label 0 00004C04 894719 mov word ptr [BPB.BFATSEC + bx],ax 0 00004C07 C7471B0000 mov word ptr [BPB.BFATSEC+2 + bx],0 0 00004C0C EB30 jmps log_p22 3092 log_p21: 0 00004C0E 8B4419 mov ax,word ptr [BPB.BFATSEC + si] 0 00004C11 894719 mov word ptr [BPB.BFATSEC + bx],ax 0 00004C14 8B441B mov ax,word ptr [BPB.BFATSEC+2 + si] 0 00004C17 89471B mov word ptr [BPB.BFATSEC+2 + bx],ax 3097 BPB.FATFLAG equ FATFLAG ; NASM port label 0 00004C1A 8B441D mov ax,[BPB.FATFLAG + si] 0 00004C1D 89471D mov [BPB.FATFLAG + bx],ax 3100 BPB.FSVER equ FSVER ; NASM port label 0 00004C20 8B441F mov ax,[BPB.FSVER + si] 0 00004C23 89471F mov [BPB.FSVER + bx],ax 3103 BPB.FSROOT equ FSROOT ; NASM port label 0 00004C26 8B4421 mov ax,word ptr [BPB.FSROOT + si] 0 00004C29 894721 mov word ptr [BPB.FSROOT + bx],ax 0 00004C2C 8B4423 mov ax,word ptr [BPB.FSROOT+2 + si] 0 00004C2F 894723 mov word ptr [BPB.FSROOT+2 + bx],ax 3108 BPB.FSINFO equ FSINFO ; NASM port label 0 00004C32 8B4425 mov ax,[BPB.FSINFO + si] 0 00004C35 894725 mov [BPB.FSINFO + bx],ax 3111 BPB.BOOTBAK equ BOOTBAK ; NASM port label 0 00004C38 8B4427 mov ax,[BPB.BOOTBAK + si] 0 00004C3B 894727 mov [BPB.BOOTBAK + bx],ax 3114 log_p22: 0 00004C3E 58 pop ax 3116 0 00004C3F 837F0800 cmp word [BPB.TOTSEC + bx],0 ; is it an 32 bit sector partition ? 0 00004C43 7507 jne log_p3 ; no, carry on 0 00004C45 85D2 test dx,dx ; would it fit in 16 bit sector sizes ? 0 00004C47 7503 jnz log_p3 ; yes, then make BPB_TOTSEC 0 00004C49 894708 mov [BPB.TOTSEC + bx],ax ; a valid 16 bit value too 3122 log_p3: ; valid BPB for partition, AX/DX = size 0 00004C4C 813F0002 cmp word [BPB.SECSIZ + bx],SECSIZE 0 00004C50 7617 jbe log_p9 ; skip if no large sectors 0 00004C52 D12F shr word [BPB.SECSIZ + bx],1 ; halve the sector size 0 00004C54 D06702 shl byte [BPB.ALLOCSIZ + bx],1 ; double the cluster size 0 00004C57 D1670B shl word [BPB.FATSEC + bx],1 ; double the FAT size 0 00004C5A D16703 shl word [BPB.FATADD + bx],1 ; double the FAT address 0 00004C5D D16708 shl word [BPB.TOTSEC + bx],1 ; double # of sectors 0 00004C60 73EA jnc log_p3 ; skip if still < 65536 sectors 0 00004C62 C747080000 mov word [BPB.TOTSEC + bx],0 ; else indicate large partition 0 00004C67 EBE3 jmps log_p3 ; try again 3133 ; we've adjusted the sector size 3134 log_p9: 0 00004C69 1E57 pushx 0 00004C6B 06 push es 0 00004C6C 1F pop ds 0 00004C6D 8D7506 lea si,[UDSC.UDSCBPB + di] ; DS:SI -> new BPB 0 00004C70 8D7D43 lea di,[UDSC.DEVBPB + di] ; ES:DI -> fixed BPB 0 00004C73 B93500 mov cx,UDSC_BPB_LENGTH 0 00004C76 F3A4 rep movsb ; make this the fixed BPB 0 00004C78 5F1F popx 0 00004C7A E8[F601] call add_unit ; register this DDSC_ 0 00004C7D FE06[0800] inc byte [nhard] ; yet another hard disk 0 00004C81 C3 ret 3146 3147 hd_bpb: 3148 ;------ 3149 ; IN: DS:BX = ptr to BPB to be build (BPB_SIZE and BPB_HIDDEN pre-filled) 3150 ; ES:DI = ptr to UDSC table entry 3151 ; OUT: DS:BX = ptr to initialized BPB 3152 ; 3153 ; CALL STACK: login_hdisk -> login_primary -> hd_bpb 3154 ; 3155 ; Builds a default BPB based on the size of the partition to login. 3156 ; Makes also use of global variable parttype to determine the FAT type. 3157 ; Before hd_bpb is called, it is ensured via login_hdisk that parttype is 3158 ; of supported FAT type. 3159 ; 3160 ; The algorithm is as follows: 3161 ; - build a FAT-12 BPB if partition size allows it and parttype is FAT-12 3162 ; - else, build a FAT-16 BPB if partition size allows it and parttype is not 3163 ; FAT-32 or FAT-32X 3164 ; - in all other cases, make it FAT-32 3165 ; 3166 ; Also sets informal UDSC_FSTYPE to zero terminated string indicating 3167 ; FAT12, FAT16, FAT32. 3168 ; 3169 ; This default BPB will be overwritten by login_primary with BPB values 3170 ; of the partition, if it contains a valid FAT formatted file system. 3171 ; 3172 0 00004C82 C74725FFFF mov word [BPB.FSINFO + bx],0ffffh ; no FS info sector for default BPB 0 00004C87 C74727FFFF mov word [BPB.BOOTBAK + bx],0ffffh ; no backup boot sector 0 00004C8C C7070002 mov word [BPB.SECSIZ + bx],SECSIZE ; set standard sector size 0 00004C90 C747030100 mov word [BPB.FATADD + bx],1 ; one reserved (boot) sector 0 00004C95 C6470502 mov byte [BPB.NFATS + bx],2 ; two FAT copies 0 00004C99 C747060002 mov word [BPB.DIRMAX + bx],512 ; assume 512 entry root directory 3179 ; BPB_TOTSEC set up already 0 00004C9E C6470AF8 mov byte [BPB.FATID + bx],0F8h ; standard hard disk ID 0 00004CA2 A0[0100] mov al,[nsect] 0 00004CA5 B400 mov ah,0 0 00004CA7 89470D mov [BPB.SPT + bx],ax ; set sectors/track 0 00004CAA A0[0200] mov al,[nhead] 0 00004CAD 89470F mov [BPB.HEADS + bx],ax ; set # of heads 3186 ; determine FAT size: 0 00004CB0 C6470204 mov byte [BPB.ALLOCSIZ + bx],2*2 ; assume 2 K clusters 0 00004CB4 8B4715 mov ax,word ptr [BPB.SIZ + bx]; AX/DX = 32 bit sector count 0 00004CB7 8B5717 mov dx,word ptr [BPB.SIZ+2 + bx] 0 00004CBA 85D2 test dx,dx ; have we got huge partition (type 6)? 0 00004CBC 752D jnz hd_bpb10 ; yes, it's 16-bit 0 00004CBE 3DCE7F cmp ax,7FCEh ; more than 16 Mb? 0 00004CC1 736E jae hd_bpb20 ; yes, use 16 bit FAT 0 00004CC3 803E[4500]01 cmp byte [parttype],DOS20_ID ; <16 Mb, but parttype indicates that 0 00004CC8 7567 jnz hd_bpb20 ; this is not FAT-12 -> must be FAT-16 3196 ; This branch can be taken even if 4 SpC (2 KiB clusters) 3197 ; would lead to misdetecting the FAT as FAT12. However, 3198 ; the only ill effect is that we may allocate too many 3199 ; FAT sectors for the assumed FAT16 in this case. 3200 0 00004CCA B90800 mov cx,4*2 ; else we've got old 12-bit FAT 0 00004CCD 884F02 mov [BPB.ALLOCSIZ + bx],cl ; we use 4 K clusters 0 00004CD0 01C8 add ax,cx ; adjust DX:AX for rounding 0 00004CD2 48 dec ax ; when we work out num clusters 0 00004CD3 F7F1 div cx ; AX = # of clusters 0 00004CD5 89C1 mov cx,ax 0 00004CD7 01C0 add ax,ax ; * 2 0 00004CD9 01C8 add ax,cx ; * 3 0 00004CDB D1E8 shr ax,1 ; AX = num clus * 3/2 = bytes 0 00004CDD 15FF01 adc ax,512-1 ; allow for rounding 0 00004CE0 31D2 xor dx,dx 0 00004CE2 B90002 mov cx,512 0 00004CE5 F7F1 div cx ; AX = # fat sectors 0 00004CE7 89470B mov [BPB.FATSEC + bx],ax ; remember FAT size 0 00004CEA C3 ret 3216 3217 hd_bpb10: 0 00004CEB C747080000 mov word [BPB.TOTSEC + bx],0 ; zero this if BPB_SIZE is required 0 00004CF0 803E[4500]0B cmp byte [parttype],FAT32_ID ; create FAT32 BPB if parttype 0 00004CF5 745D jz hd_bpb30 ; indicates a FAT32 partition 0 00004CF7 803E[4500]0C cmp byte [parttype],FAT32X_ID ; 0 00004CFC 7456 jz hd_bpb30 ; 0 00004CFE 83FA02 cmp dx,2 ; less than 2*65536 sectors (64 Mb)? 0 00004D01 722E jb hd_bpb20 ; yes, leave cluster size the same 0 00004D03 C6470208 mov byte [BPB.ALLOCSIZ + bx],4*2 ; use 4 K clusters if 64-128 Mb 0 00004D07 83FA04 cmp dx,4 ; less than 4*65536 sectors (128 Mb)? 0 00004D0A 7225 jb hd_bpb20 ; yes, leave cluster size the same 0 00004D0C C6470210 mov byte [BPB.ALLOCSIZ + bx],8*2 ; use 8 K clusters if 128-512 Mb 0 00004D10 83FA10 cmp dx,16 ; less than 16*65536 sectors (512 Mb)? 0 00004D13 721C jb hd_bpb20 ; yes, leave cluster size the same 0 00004D15 C6470220 mov byte [BPB.ALLOCSIZ + bx],16*2 ; use 16 K clusters if 512-1024 Mb 0 00004D19 83FA20 cmp dx,32 ; less than 32*65536 sectors (1 Gb)? 0 00004D1C 7213 jb hd_bpb20 ; yes, leave cluster size the same 0 00004D1E C6470240 mov byte [BPB.ALLOCSIZ + bx],32*2 ; use 32 K clusters if 1-2 Gb 0 00004D22 83FA40 cmp dx,64 ; less than 64*65536 sectors (2 Gb)? 0 00004D25 720A jb hd_bpb20 ; yes, leave cluster size the same 0 00004D27 C6470280 mov byte [BPB.ALLOCSIZ + bx],64*2 ; use 64 K clusters if 2-4 Gb 0 00004D2B 81FA8000 cmp dx,128 ; less than 128*65536 sectors (4 Gb)? 0 00004D2F 7323 jae hd_bpb30 ; no, use FAT-32 3240 ; 256 sectors per cluster disabled for compatibility reasons. 3241 ; They are still supported if such a partition is encountered, but 3242 ; not established by a default BPB (Boeckmann) 3243 ; mov BPB.ALLOCSIZ[bx],0 ; use 128 K clusters if 4-8 Gb 3244 ; cmp dx,256 ; more than 256*65536 sectors (8 Gb)? 3245 ; jae hd_bpb30 ; then use FAT32 instead 3246 3247 hd_bpb20: ; cluster size determined 0 00004D31 83E821 sub ax,1+(512*32/SECSIZE) ; subtract reserved+root directory 0 00004D34 83DA00 sbb dx,0 ; (note: 32 bytes per entry) 0 00004D37 31C9 xor cx,cx 0 00004D39 8A6F02 mov ch,[BPB.ALLOCSIZ + bx] ; CX = (256 * # of clusters on drive) 0 00004D3C 49 dec cx 0 00004D3D 01C8 add ax,cx ; add in for rounding error 0 00004D3F 83D200 adc dx,0 0 00004D42 41 inc cx 0 00004D43 7503 jnz hd_bpb25 0 00004D45 92 xchg ax,dx 0 00004D46 EB02 jmps hd_bpb26 3259 hd_bpb25: 0 00004D48 F7F1 div cx ; AX = # of fat sectors 3261 hd_bpb26: 0 00004D4A 89470B mov [BPB.FATSEC + bx],ax ; remember FAT size 0 00004D4D 26C685910036 mov byte [es:UDSC.FSTYPE+4 + di],'6'; change "FAT12" to "FAT16" 0 00004D53 C3 ret 3265 3266 hd_bpb30: ; build BPB for FAT32 0 00004D54 C747060000 mov word [BPB.DIRMAX + bx],0 ; FAT32, so no fixed root dir 0 00004D59 C747032000 mov word [BPB.FATADD + bx],20h ; assume 32 reserved sectors 0 00004D5E C747210200 mov word ptr [BPB.FSROOT + bx],2; assume root dir is in first cluster 0 00004D63 C6470201 mov byte [BPB.ALLOCSIZ + bx],1 ; use 0.5 K clusters <64 Mb 0 00004D67 83FA02 cmp dx,2 ; less than 2*65536 sectors (64 Mb)? 0 00004D6A 723E jb hd_bpb40 ; yes, leave cluster size the same 0 00004D6C C6470202 mov byte [BPB.ALLOCSIZ + bx],1*2 ; use 1 K clusters if 64-256 Mb 0 00004D70 83FA08 cmp dx,8 ; less than 8*65536 sectors (256 Mb)? 0 00004D73 7235 jb hd_bpb40 ; yes, leave cluster size the same 0 00004D75 C6470204 mov byte [BPB.ALLOCSIZ + bx],2*2 ; use 2 K clusters if 256-1024 Mb 0 00004D79 83FA20 cmp dx,32 ; less than 32*65536 sectors (1 Gb)? 0 00004D7C 722C jb hd_bpb40 ; yes, leave cluster size the same 0 00004D7E C6470208 mov byte [BPB.ALLOCSIZ + bx],4*2 ; use 4 K clusters if 1-4 Gb 0 00004D82 81FA8000 cmp dx,128 ; less than 128*65536 sectors (4 Gb)? 0 00004D86 7222 jb hd_bpb40 ; yes, leave cluster size the same 0 00004D88 C6470210 mov byte [BPB.ALLOCSIZ + bx],8*2 ; use 8 K clusters if 4-16 Gb 0 00004D8C 81FA0002 cmp dx,512 ; less than 512*65536 sectors (16 Gb)? 0 00004D90 7218 jb hd_bpb40 ; yes, leave cluster size the same 0 00004D92 C6470220 mov byte [BPB.ALLOCSIZ + bx],16*2 ; use 16 K clusters if 16-64 Gb 0 00004D96 81FA0008 cmp dx,2048 ; less than 2048*65536 sectors (64 Gb)? 0 00004D9A 720E jb hd_bpb40 ; yes, leave cluster size the same 0 00004D9C C6470240 mov byte [BPB.ALLOCSIZ + bx],32*2 ; use 32 K clusters if 64-256 Gb 0 00004DA0 81FA0020 cmp dx,8192 ; less than 8192*65536 sectors (256 Gb)? 0 00004DA4 7204 jb hd_bpb40 ; yes, leave cluster size the same 0 00004DA6 C6470280 mov byte [BPB.ALLOCSIZ + bx],64*2 ; use 64 K clusters if 256-1024 Gb 3292 ; 256 sectors per cluster disabled for compatibility reasons (Boeckmann) 3293 ; cmp dx,32768 ; less than 32768*65536 sectors (1024 Gb)? 3294 ; jb hd_bpb40 ; yes, leave cluster size the same 3295 ; mov BPB.ALLOCSIZ[bx],0 ; use 128 K clusters if >1024 Gb 3296 3297 ; Now follows the calculation of the sector count per FAT. 3298 ; It is calculated after the formula 3299 ; (total_sec + (sec_per_clust-1) - reserved) / 3300 ; (sect_per_clust * entries_per_FAT_sector) 3301 ; This is somewhat inefficient, because the FATs are unnecessarily 3302 ; treated as data area. 3303 hd_bpb40: ; DX:AX = total sectors 0 00004DAA 2B4703 sub ax,[BPB.FATADD + bx] ; subtract reserved 0 00004DAD 83DA00 sbb dx,0 0 00004DB0 31C9 xor cx,cx 0 00004DB2 8A6F02 mov ch,[BPB.ALLOCSIZ + bx] 0 00004DB5 D1E9 shr cx,1 ; CX = sectors per cluster * 128 3309 ; If CX is now zero this means that we are dealing with 3310 ; 256 sectors per cluster. We set CX to: 3311 ; 256 sectors per cluster * 128 FAT entries per sector = 8000h 0 00004DB7 7502 jnz hd_bpb41 0 00004DB9 B580 mov ch,80h 3314 hd_bpb41: 0 00004DBB 49 dec cx 0 00004DBC 01C8 add ax,cx ; add in for rounding error 0 00004DBE 83D200 adc dx,0 0 00004DC1 41 inc cx 3319 ; div cx ; AX = # of fat sectors 0 00004DC2 55 push bp 0 00004DC3 52 push dx 0 00004DC4 50 push ax 0 00004DC5 31C0 xor ax,ax 0 00004DC7 50 push ax 0 00004DC8 51 push cx 0 00004DC9 83EC08 sub sp,8 0 00004DCC E87300 call div32i 0 00004DCF 83C404 add sp,4 0 00004DD2 58 pop ax 0 00004DD3 5A pop dx 0 00004DD4 83C408 add sp,8 0 00004DD7 5D pop bp 0 00004DD8 894719 mov word ptr [BPB.BFATSEC + bx],ax ; remember FAT size 0 00004DDB 89571B mov word ptr [BPB.BFATSEC+2 + bx],dx 0 00004DDE 83670B00 and word ptr [BPB.FATSEC + bx], 0 ; clear small FAT size field 0 00004DE2 26C685900033 mov byte [es:UDSC.FSTYPE+3 + di],'3'; change "FAT12" to "FAT32" 0 00004DE8 C3 ret 3338 3339 new_unit: 0 00004DE9 1E push ds 0 00004DEA 50 push ax 0 00004DEB 53 push bx 0 00004DEC 51 push cx 0 00004DED 52 push dx 0 00004DEE 56 push si 0 00004DEF 2E8E06[0000] mov es,[cs:DataSegment] 0 00004DF4 8B3E[0000] mov di,[endbios] ; get next unit descriptor 0 00004DF8 B99600 mov cx,UDSC_LENGTH 0 00004DFB 010E[0000] add [endbios],cx ; grow the BIOS size 0 00004DFF 31C0 xor ax,ax 0 00004E01 57 push di 0 00004E02 F3AA rep stosb ; zero the UDSC 0 00004E04 5F pop di 0 00004E05 31DB xor bx,bx 0 00004E07 8A1E[0700] mov bl,[nunits] ; BX = unit we are working on 0 00004E0B 26885D05 mov [es:UDSC.DRIVE + di],bl ; make that our logical unit 0 00004E0F 26814D3F0002 or word [es:UDSC.FLAGS + di],UDF_NOACCESS ; no access until valid BPB 0 00004E15 D1E3 shl bx,1 ; make it a BPB index 0 00004E17 8D4543 lea ax,[UDSC.DEVBPB + di] ; get storage area for device BPB 0 00004E1A 8987[0000] mov [bpbtbl + bx],ax ; update entry in BPB table 0 00004E1E D1EB shr bx,1 ; get the latest drive 0 00004E20 43 inc bx ; onto next unit 0 00004E21 80FB02 cmp bl,2 ; 3rd floppy ? 0 00004E24 7504 jne new_unit10 0 00004E26 021E[0800] add bl,[nhard] ; yes, skip past hard disks 3366 new_unit10: 0 00004E2A 881E[0700] mov [nunits],bl ; store ready for next time 0 00004E2E 26C64504FF mov byte [es:UDSC.RUNIT + di],0FFh ; set physical drive (ROS code) 0 00004E33 0E push cs 0 00004E34 1F pop ds ; DS:SI -> our dummy value 0 00004E35 BE[BA03] mov si,offset dummyMediaID 0 00004E38 E8[E003] call UpdateMediaID ; update UDSC_ with media info 0 00004E3B 5E pop si 0 00004E3C 5A pop dx 0 00004E3D 59 pop cx 0 00004E3E 5B pop bx 0 00004E3F 58 pop ax 0 00004E40 1F pop ds 0 00004E41 C3 ret 3380 3381 div32i: ; 32-bit division 3382 ;-------- 3383 ; On Entry: 3384 ; 32-bit dividend & divisor on stack 3385 ; space for 32-bit quotient & remainder reserved on stack 3386 ; SP-16 3387 ; On Exit: 3388 ; 32-bit quotient & remainder on stack 3389 ; SP-16 3390 ; Modified registers: 3391 ; AX,CX,DX,BP 0 00004E42 89E5 mov bp,sp ; base address of temporary variables 0 00004E44 83C502 add bp,2 0 00004E47 31C0 xor ax,ax ; clear work registers 0 00004E49 31D2 xor dx,dx 0 00004E4B B92000 mov cx,32 ; 32 bits 3397 div32i_loop: 0 00004E4E D16604 shl word ptr [4 + bp],1 ; multiply quotient with two 0 00004E51 D15606 rcl word ptr [6 + bp],1 0 00004E54 D1660C shl word ptr [12 + bp],1 ; shift one bit from dividend 0 00004E57 D1560E rcl word ptr [14 + bp],1 0 00004E5A D1D0 rcl ax,1 ; to work registers 0 00004E5C D1D2 rcl dx,1 0 00004E5E 3B560A cmp dx,[10 + bp] ; compare high word with divisor 0 00004E61 7211 jb div32i_2 0 00004E63 7705 ja div32i_1 0 00004E65 3B4608 cmp ax,[8 + bp] ; compare low word 0 00004E68 720A jb div32i_2 3409 div32i_1: 0 00004E6A 834E0401 or word ptr [4 + bp],1 ; divisor fits one time 0 00004E6E 2B4608 sub ax,[8 + bp] ; subtract divisor 0 00004E71 1B560A sbb dx,[10 + bp] 3413 div32i_2: 0 00004E74 E2D8 loop div32i_loop ; loop back if more bits to shift 0 00004E76 894600 mov [bp],ax ; save remainder onto stack 0 00004E79 895602 mov [2 + bp],dx 0 00004E7C C3 ret 3418 3419 ICODE ends 3420 === Switch to base=000000h -> "RESBIOS" 3421 section RESBIOS class=RESBIOS 3421 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 3422 ; NOTE: we extend the resident BIOS size by the amount of 3423 ; memory required by the disk driver. 3424 00000000 db MAXPART*UDSC_LENGTH dup (?) 3425 RESBIOS ends 3426 === Switch to base=000000h -> "IDATA" 3427 section IDATA 0 00004EB0 ?? p_unit db ? ; 80h, 81h for hard disks 0 00004EB1 ?? nsect db ? ; # of sectors per track 0 00004EB2 ?? nhead db ? ; # of heads on disk 0 00004EB3 ???????? part_size dw 2 dup (?) ; temporary save address for size 0 00004EB7 02 nunits db 2 ; start with driver C: 0 00004EB8 00 nhard db 0 ; # of hard disk partitions 0 00004EB9 00 nfloppy db 0 ; # of floppy drives 3435 0 00004EBA 0000 int13ex_ver dw 0 ; version of int 13 extensions 0 00004EBC 0000 int13ex_bits dw 0 ; int 13 API support bitmap 3438 0 00004EBE 1E00 int13ex_para dw 30 ; extended drive parameters 3440 00000010 db 28 dup (?) 3441 3442 ; Public diskaddrpack 3443 ;diskaddrpack: ; disk address packet structure for LBA access 3444 ; db 10h ; size of packet 3445 ; db 0 ; reserved 3446 ; dw 1 ; number of blocks to transfer 3447 ; dd 0 ; transfer buffer address 3448 ; dq 0 ; starting absolute block number 3449 0 00004EDC 00000000 partstart dd 0 ; first block of partition 0 00004EE0 00000000 partend dd 0 ; last block of partition 0 00004EE4 00000000 partend_max dd 0 ; limit implied by CHS if LBA not available 0 00004EE8 00000000 extoffset dd 0 ; block offset of extended partition 0 00004EEC 00000000 ptstart dd 0 ; block offset of current partition table 0 00004EF0 00000000 lastpart dd 0 ; last checked partition 0 00004EF4 00 extoffvalid db 0 ; extoffset valid flag 0 00004EF5 00 parttype db 0 ; ID of partition 3458 3459 Public init_runit 0 00004EF6 00 init_runit db 0 ; poked with ROS Unit at boot 3461 3462 IDATA ends 3463 3464 end === Trace listing source: drbio/bin/serpar.lst 1 ; File : $SERPAR.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; SERPAR.ASM 1.7 93/07/22 19:44:27 33 ; switch over to REQUEST.EQU 34 ; SERPAR.ASM 1.6 93/07/19 18:57:59 35 ; Add header 36 ; 37 ; ENDLOG 38 39 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 40 %include "drmacros.mac" ; standard DR macros 1 <1> ; File : $DRMACROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 09-Nov-88 made RETF conditional for MASM 5.1/TASM 1.0 35 <1> 36 <1> FALSE equ 0 37 <1> TRUE equ (~ FALSE) 38 <1> 39 <1> 40 <1> %macro jmps 1.nolist 41 <1> jmp short %1 42 <1> %endmacro 43 <1> 44 <1> %macro stripangles 2.nolist 45 <1> %defstr %%param %2 46 <1> %substr %%opening %%param 1 47 <1> %ifidn %%opening, '<' 48 <1> %substr %%param %%param 2,-1 49 <1> %endif 50 <1> %strlen %%length %%param 51 <1> %substr %%closing %%param %%length 52 <1> %ifidn %%closing, '>' 53 <1> %substr %%param %%param 1,-2 54 <1> %endif 55 <1> %deftok %%token %%param 56 <1> %1 %%token 57 <1> %endmacro 58 <1> 59 <1> %macro pushx 0-*.nolist 60 <1> %rep %0 61 <1> stripangles push, %1 62 <1> %rotate 1 63 <1> %endrep 64 <1> %endmacro 65 <1> 66 <1> %macro popx 0-*.nolist 67 <1> %rep %0 68 <1> stripangles pop, %1 69 <1> %rotate 1 70 <1> %endrep 71 <1> %endmacro 72 <1> 73 <1> %macro incx 0-*.nolist 74 <1> %rep %0 75 <1> stripangles inc, %1 76 <1> %rotate 1 77 <1> %endrep 78 <1> %endmacro 79 <1> 80 <1> %macro decx 0-*.nolist 81 <1> %rep %0 82 <1> stripangles dec, %1 83 <1> %rotate 1 84 <1> %endrep 85 <1> %endmacro 86 <1> 87 <1> %macro rb 1.nolist 88 <1> db %1 dup (?) 89 <1> %endmacro 90 <1> 91 <1> %macro rw 1.nolist 92 <1> dw %1 dup (?) 93 <1> %endmacro 94 <1> 95 <1> %macro rd 1.nolist 96 <1> dd %1 dup (?) 97 <1> %endmacro 41 %include "ibmros.mac" ; ROM BIOS equates 1 <1> ; File : $IBMROS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> VIDEO_INT equ 10h 36 <1> EQUIPMENT_INT equ 11h 37 <1> MEMORY_INT equ 12h 38 <1> DISK_INT equ 13h 39 <1> ASYNC_INT equ 14h 40 <1> SYSTEM_INT equ 15h 41 <1> KEYBOARD_INT equ 16h 42 <1> PRINTER_INT equ 17h 43 <1> RTC_INT equ 1Ah 44 <1> CTRLBRK_INT equ 1Bh 45 <1> 46 <1> ; Int 10 subfunctions 47 <1> 48 <1> SET_CURSOR_TYPE equ 01h 49 <1> WRITE_CURSOR equ 02h ; Set cursor position 50 <1> READ_CURSOR equ 03h ; Read cursor position 51 <1> SCROLL_UP equ 06h ; Scroll active page up 52 <1> SCROLL_DOWN equ 07h ; Scroll active page down 53 <1> READ_CHAR equ 08h ; Read attribute/char at cur position 54 <1> WRITE_CHAR equ 09h ; Write attribute/char at cur position 55 <1> WRITE_TTY equ 0eh ; Write teletype at current position 56 <1> GET_STATE equ 0fh ; Return current video mode 57 <1> 58 <1> ; Int 13 subfunctions 59 <1> 60 <1> ROS_RESET equ 00h ; reset disk system 61 <1> ROS_READ equ 02h ; read from disk 62 <1> ROS_WRITE equ 03h ; write to disk 63 <1> ROS_VERIFY equ 04h ; verify data on disk 64 <1> ROS_FORMAT equ 05h ; format track on disk 65 <1> ROS_PARAM equ 08h ; get drive parameters 66 <1> ROS_GETTYPE equ 15h ; get drive type 67 <1> ROS_DSKCHG equ 16h ; check disk change status 68 <1> ROS_SETTYPE equ 17h ; set disk type for format 69 <1> ROS_SETMEDIA equ 18h ; set media type for format 70 <1> ROS_LBACHK equ 41h ; int 13 extensions install check 71 <1> ROS_LBAREAD equ 42h ; extended read 72 <1> ROS_LBAWRITE equ 43h ; extended write 73 <1> ROS_LBAVERIFY equ 44h ; extended verify 74 <1> ROS_LBAPARAM equ 48h ; get extended drive parameters 75 <1> 76 <1> PRN_ERROR equ 00101001b ; printer error bits 77 <1> PRN_NOTBUSY equ 10000000b 78 <1> PRN_ACK equ 01000000b 79 <1> PRN_PAPER equ 00100000b 80 <1> PRN_SELECT equ 00010000b 81 <1> PRN_IOERR equ 00001000b 82 <1> PRN_TIMEOUT equ 00000001b 83 <1> 84 <1> AUX_ERROR equ 10000000b ; auxiliary error bits 85 <1> 86 <1> ; Int 15 subfunctions 87 <1> 88 <1> EXT_MEMORY equ 88h ; Return extended memory size in KB 42 %include "request.mac" ; request header equates 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 39 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 57 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 43 %include "driver.mac" ; device driver equates 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 41 ****************** <1> warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 44 45 ;page 46 group CGROUP CODE RCODE ICODE 47 48 Assume CS:CGROUP, DS:CGROUP, ES:CGROUP, SS:CGROUP 49 === Switch to base=000000h -> "CODE" 50 section CODE class=CODE 50 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 51 52 extrn endbios:word ; for device driver INIT function 53 extrn serparFlag:byte 54 extrn serparChar:byte 55 56 CODE ends 57 === Switch to base=000000h -> "RCODE" 58 section RCODE class=RCODE 58 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 59 60 Public SerParCommonTable 61 62 SerParCommonTable: 0 00003116 13 db 19 ; Last supported function 0 00003117 [0000] dw dd_init ; 0-initialize driver 0 00003119 [2900] dw dd_error ; 1-media change check (disks only) 0 0000311B [2900] dw dd_error ; 2-build BPB (disks only) 0 0000311D [2900] dw dd_error ; 3-IOCTL string input 0 0000311F [7200] dw dd_input ; 4-input 0 00003121 [9600] dw dd_poll ; 5-nondestructive input (char only) 0 00003123 [B000] dw dd_instat ; 6-input status (char only) 0 00003125 [C200] dw dd_inflush ; 7-input flush 0 00003127 [DD00] dw dd_output ; 8-output 0 00003129 [DD00] dw dd_output ; 9-output with verify 0 0000312B [2901] dw dd_outstat ; 10-output status (char only) 0 0000312D [5001] dw dd_outflush ; 11-output flush (char only) 0 0000312F [2900] dw dd_error ; 12-IOCTL string output 0 00003131 [5301] dw dd_open ; 13-device open 0 00003133 [5601] dw dd_close ; 14-device close 0 00003135 [2900] dw dd_error ; 15-removable media check (disks only) 0 00003137 [2900] dw dd_error ; 16-n/a 0 00003139 [2900] dw dd_error ; 17-n/a 0 0000313B [2900] dw dd_error ; 18-n/a 0 0000313D [5901] dw dd_genioctl ; 19-generic IOC 84 85 Assume DS:CGROUP, ES:Nothing, SS:Nothing 86 87 ;page 88 89 dd_error: ; used for all unsupported driver functions 90 ;-------- 0 0000313F B80380 mov ax,RHS_ERROR+3 ; "invalid command" error 0 00003142 C3 ret 93 94 ; page 95 96 poll_char: 97 ;--------- 98 ; exit: ZF = 1 => no character ready 99 ; ZF = 0 => AL = character 100 0 00003143 80BC[0000]FF cmp byte [serparFlag + si],TRUE ; do we have local character? 0 00003148 7506 jne poll_c2 ; skip if not 0 0000314A 8A84[0000] mov al,[serparChar + si] ; get the local charcater 0 0000314E EB16 jmps poll_c4 ; and return it 105 poll_c2: ; need to check ROS keyboard status 0 00003150 B403 mov ah,3 ; get serial status status 0 00003152 CD14 int ASYNC_INT ; read serial status 0 00003154 F6C401 test ah,1 ; test "received data" bit 0 00003157 7411 jz poll_c9 ; skip if no character there 0 00003159 B402 mov ah,2 ; read the character 0 0000315B CD14 int ASYNC_INT ; character returned in AL 0 0000315D 8884[0000] mov [serparChar + si],al ; save it for look ahead 0 00003161 C684[0000]FF mov byte [serparFlag + si],TRUE ; we've got a local character 114 poll_c4: ; return the character in AL 0 00003166 80CCFF or ah,TRUE ; indicate "ready" status 0 00003169 C3 ret 117 poll_c9: 0 0000316A 29C0 sub ax,ax ; indicate "not-ready" status 0 0000316C C3 ret ; (driver is busy) 120 121 122 char_read: 123 ;--------- 0 0000316D 31C0 xor ax,ax 0 0000316F 80BC[0000]FF cmp byte [serparFlag + si],TRUE ; do we have local character? 0 00003174 750A jne rdchr1 0 00003176 C684[0000]00 mov byte [serparFlag + si],FALSE ; tell them buffer is invalid 0 0000317B 8A84[0000] mov al,[serparChar + si] ; get the local character 0 0000317F C3 ret ; and return it 130 rdchr1: 0 00003180 B402 mov ah,2 ; read character from serial port 0 00003182 CD14 int ASYNC_INT ; call the ROM BIOS 0 00003184 80E40E and ah,0eh ; only worry about these error bits 0 00003187 C3 ret ; and return the character 135 136 ; page 137 dd_input: ; 4-input 138 ;-------- 0 00003188 06 push es ; save ES (-> request header!) 0 00003189 268B4F12 mov cx,[es:RH4_COUNT + bx] ; get # of characters to output 0 0000318D E315 jcxz input9 ; return if nothing to input 0 0000318F 83EA03 sub dx,3 ; convert to serial port # 0 00003192 7210 jb input9 ; return none read if parallel port 0 00003194 89D6 mov si,dx ; SI = serial port index 0 00003196 26C47F0E les di,[es:RH4_BUFFER + bx] ; get address of string to input 146 input2: 0 0000319A E8D0FF call char_read ; read 8-bit character 0 0000319D 84E4 test ah,ah ; did we read OK ? 0 0000319F 7503 jnz input9 ; if we have an error stop now 0 000031A1 AA stosb ; store it in input buffer 0 000031A2 E2F6 loop input2 ; repeat for all characters 152 input9: 0 000031A4 07 pop es 0 000031A5 26294F12 sub [es:RH4_COUNT + bx],cx ; update to actual number xfered 0 000031A9 29C0 sub ax,ax 0 000031AB C3 ret 157 158 dd_poll: ; 5-nondestructive input (console only) 159 ;------- 0 000031AC 83FA03 cmp dx,3 ; check if a parallel port 0 000031AF 7211 jb poll_busy ; they are never ready 0 000031B1 83EA03 sub dx,3 0 000031B4 89D6 mov si,dx ; SI = serial port index 0 000031B6 E88AFF call poll_char ; check keyboard status 0 000031B9 7407 jz poll_busy 0 000031BB 2688470D mov [es:RH5_CHAR + bx],al ; return the character 0 000031BF 29C0 sub ax,ax 0 000031C1 C3 ret 169 poll_busy: 0 000031C2 B80002 mov ax,RHS_BUSY ; indicate no character waiting 0 000031C5 C3 ret 172 173 dd_instat: ; 6-input status (char only) 174 ;--------- 0 000031C6 83FA03 cmp dx,3 ; check if a parallel port 0 000031C9 72F7 jb poll_busy ; if so it's always busy 0 000031CB 83EA03 sub dx,3 0 000031CE 89D6 mov si,dx ; SI = serial port index 0 000031D0 E870FF call poll_char ; check keyboard status 0 000031D3 74ED jz poll_busy 0 000031D5 29C0 sub ax,ax ; indicate "not ready" status 0 000031D7 C3 ret 183 184 dd_inflush: ; 7-input flush 185 ;--------- 0 000031D8 83FA03 cmp dx,3 ; check if a parallel port 0 000031DB 7304 jae inflsh1 ; skip if serial port 0 000031DD B80B80 mov ax,RHS_ERROR+11 ; return "read error" if attempting 0 000031E0 C3 ret ; to read from the parallel port 190 inflsh1: 0 000031E1 83EA03 sub dx,3 0 000031E4 89D6 mov si,dx ; SI = serial port index 193 inflsh2: 0 000031E6 E85AFF call poll_char ; check keyboard status 0 000031E9 7405 jz inflsh_ret ; skip if not ready 0 000031EB E87FFF call char_read ; else read next character 0 000031EE EBF6 jmps inflsh2 ; repeat until buffer empty 198 inflsh_ret: ; keyboard buffer empty 0 000031F0 29C0 sub ax,ax ; return success 0 000031F2 C3 ret 201 202 dd_output: ; 8-output 203 ;--------- 0 000031F3 268B4F12 mov cx,[es:RH4_COUNT + bx] ; get # of characters to output 0 000031F7 E343 jcxz output5 ; return if nothing to output 0 000031F9 06 push es ; save ES (-> request header!) 0 000031FA 26C4770E les si,[es:RH4_BUFFER + bx] ; get address of string to output 0 000031FE 83EA03 sub dx,3 ; test if parallel port 0 00003201 7321 jae output2 ; skip if serial port 0 00003203 83C203 add dx,3 ; back to parallel port number 211 output1: 0 00003206 26AC es lodsb ; get next character to output 0 00003208 B400 mov ah,0 ; output AL to parallel port 0 0000320A CD17 int PRINTER_INT ; output to parallel port 0 0000320C B002 mov al,2 ; "not ready" error 0 0000320E F6C401 test ah,PRN_TIMEOUT ; printer not ready? 0 00003211 7520 jnz output4 ; yes, return error 0 00003213 B009 mov al,9 ; "printer out of paper" error 0 00003215 F6C420 test ah,PRN_PAPER ; printer out paper? 0 00003218 7519 jnz output4 ; yes, return error 0 0000321A 40 inc ax ; "write fault" error 0 0000321B F6C429 test ah,PRN_ERROR ; test if other errors 0 0000321E 7513 jnz output4 ; skip if any errors occurred 0 00003220 E2E4 loop output1 ; else repeat for all characters 0 00003222 EB0F jmps output4 ; return successfully when done 226 227 output2: ; output is for serial port 0 00003224 26AC es lodsb ; get next character to output 0 00003226 B401 mov ah,1 ; output AL to serial port 0 00003228 CD14 int ASYNC_INT ; output to serial port 0 0000322A B002 mov al,2 ; "not ready" error 0 0000322C F6C480 test ah,AUX_ERROR ; test if time out etc. 0 0000322F 7502 jnz output4 ; skip if any errors occurred 0 00003231 E2F1 loop output2 ; else repeat for all characters 235 output4: 0 00003233 B480 mov ah,RHS_ERROR >> 8 ; assume an error code 0 00003235 07 pop es 0 00003236 26294F12 sub [es:RH4_COUNT + bx],cx ; update to actual number xfered 0 0000323A 7402 jz output6 ; none xfered is an error 240 output5: 0 0000323C 29C0 sub ax,ax ; return successfully when done 242 output6: 0 0000323E C3 ret 244 245 246 247 dd_outstat: ; 10-output status (char only) 248 ;---------- 0 0000323F 83FA03 cmp dx,3 ; test if parallel port 0 00003242 730B jae outstat1 0 00003244 B402 mov ah,2 ; read parallel port status 0 00003246 CD17 int PRINTER_INT ; call the ROM BIOS 0 00003248 F6C480 test ah,80h ; test "not busy" bit 0 0000324B 7512 jnz outstat_ready ; if not busy then ready for output 0 0000324D EB13 jmps outstat_busy ; else we must be still busy 256 outstat1: 0 0000324F 83EA03 sub dx,3 0 00003252 B403 mov ah,3 ; get status for serial port 0 00003254 CD14 int ASYNC_INT 0 00003256 F6C420 test ah,20h ; transmit buffer register emmpty? 0 00003259 7407 jz outstat_busy 0 0000325B A820 test al,20h ; data set ready? 0 0000325D 7403 jz outstat_busy 264 outstat_ready: 0 0000325F 29C0 sub ax,ax ; always ready, return no busy 0 00003261 C3 ret 267 outstat_busy: 0 00003262 B80002 mov ax,RHS_BUSY 0 00003265 C3 ret 270 271 dd_outflush: ; 11-output flush (char only) 272 ;----------- 0 00003266 29C0 sub ax,ax ; unbuffered, perform no operation 0 00003268 C3 ret 275 276 277 ; page 278 dd_open: ; 13-device open 279 ;------- 0 00003269 29C0 sub ax,ax ; no operation 0 0000326B C3 ret 282 283 284 dd_close: ; 14-device close 285 ;-------- 0 0000326C 29C0 sub ax,ax ; no operation 0 0000326E C3 ret 288 289 290 ; page 291 dd_genioctl: ; 19-generic IOCTL 292 ;----------- 0 0000326F 29C0 sub ax,ax 0 00003271 C3 ret 295 296 297 RCODE ends ; end of device driver code 298 299 ;page 300 === Switch to base=000000h -> "ICODE" 301 section ICODE class=ICODE ; initialization code 301 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 302 303 dd_init: ; 0-initialize driver 304 ;------- 0 00004E7E 83FA03 cmp dx,3 ; check if serial or parallel 0 00004E81 7306 jae init1 ; skip if serial port setup 0 00004E83 B401 mov ah,1 ; initialize parallel port 0 00004E85 CD17 int PRINTER_INT ; call the ROM BIOS 0 00004E87 EB09 jmps init2 310 init1: 0 00004E89 83EA03 sub dx,3 0 00004E8C B400 mov ah,0 ; initialize serial port 0 00004E8E B0A3 mov al,0A3h ; 2400 Bd, no parity, 8 data, 1 stop 0 00004E90 CD14 int ASYNC_INT ; call the ROM BIOS 315 init2: 316 P_DSTRUC.REQUEST equ REQUEST ; NASM port label 0 00004E92 C45E02 les bx,[P_DSTRUC.REQUEST + bp] ; ES:BX -> request header 318 0 00004E95 A1[0000] mov ax,[endbios] 0 00004E98 2689470E mov [es:RH0_RESIDENT + bx],ax ; set end of device driver 0 00004E9C 268C5F10 mov [es:RH0_RESIDENT+2 + bx],ds 322 0 00004EA0 29C0 sub ax,ax ; initialization succeeded 0 00004EA2 C3 ret ; (BIOS init always does...) 325 326 ICODE ends 327 328 end === Trace listing source: drbio/bin/biosmsgs.lst 1 NUL equ 0 2 BS equ 8 3 TAB equ 9 4 LF equ 10 5 CR equ 13 6 7 %include "biosgrps.mac" 1 <1> ; File : $BIOSGRPS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG === Switch to base=000000h -> "CODE" 34 <1> section CODE public align=2 class=CODE 35 <1> CODE ends 36 <1> === Switch to base=000000h -> "ENDCODE" 37 <1> section ENDCODE public align=1 class=ENDCODE 38 <1> ENDCODE ends 39 <1> === Switch to base=000000h -> "RCODE_ALIGN" 40 <1> section RCODE_ALIGN public align=16 class=RCODE 41 <1> RCODE_ALIGN ends 42 <1> === Switch to base=000000h -> "RCODE" 43 <1> section RCODE public align=2 class=RCODE 44 <1> RCODE ends 45 <1> === Switch to base=000000h -> "RESUMECODE" 46 <1> section RESUMECODE public align=16 class=RESUME 47 <1> RESUMECODE ends 48 <1> === Switch to base=000000h -> "RESBIOS" 49 <1> section RESBIOS public align=16 class=RESBIOS 50 <1> RESBIOS ends 51 <1> === Switch to base=000000h -> "ICODE" 52 <1> section ICODE public align=2 class=ICODE 53 <1> ICODE ends 54 <1> === Switch to base=000000h -> "IDATA" 55 <1> section IDATA public align=16 class=IDATA 56 <1> IDATA ends 57 <1> === Switch to base=000000h -> "INITCODE" 58 <1> section INITCODE public align=16 class=INITCODE 59 <1> INITCODE ends 60 <1> === Switch to base=000000h -> "STACKS" 61 <1> section STACKS public align=16 class=STACKS 62 <1> STACKS ends 63 <1> === Switch to base=000000h -> "INITDATA" 64 <1> section INITDATA public align=16 class=INITDATA 65 <1> INITDATA ends 66 <1> === Switch to base=000000h -> "INITPSP" 67 <1> section INITPSP public align=16 class=INITDATA 68 <1> INITPSP ends 69 <1> === Switch to base=000000h -> "INITENV" 70 <1> section INITENV public align=16 class=INITDATA 71 <1> INITENV ends 72 <1> === Switch to base=000000h -> "DATAEND" 73 <1> section DATAEND public align=16 class=INITDATA 74 <1> DATAEND ends 75 <1> 8 9 group CGROUP RCODE 10 11 === Switch to base=000000h -> "RCODE" 12 section RCODE align=2 public class=RCODE 12 ****************** warning: segment attributes specified on redeclaration of segment: ignoring [-w+other] 13 14 ; Source .TFT file: 'TMP1.$$$' 15 public _disk_msgA 16 public disk_msgA 17 disk_msgA label byte 0 00003272 0D0A496E7365727420 _disk_msgA db CR, LF, "Insert diskette for drive ", NUL 0 0000327B 6469736B6574746520 0 00003284 666F72206472697665 0 0000328D 2000 19 public _disk_msgB 20 public disk_msgB 21 disk_msgB label byte 0 0000328F 3A20616E640D0A2020 _disk_msgB db ": and", CR, LF, " strike any key when ready", CR, LF, LF, NUL 0 00003298 20737472696B652061 0 000032A1 6E79206B6579207768 0 000032AA 656E2072656164790D 0 000032B3 0A0A00 23 public _div_by_zero_msg 24 public div_by_zero_msg 25 div_by_zero_msg label byte 0 000032B6 0D0A44697669646520 _div_by_zero_msg db CR, LF, "Divide Error at " 0 000032BF 4572726F7220617420 27 public div_by_zero_length 28 div_by_zero_length equ $ - div_by_zero_msg 29 30 RCODE ends 31 32 33 end === Trace listing source: drbio/bin/biosinit.lst 1 ; File : $BIOSINIT.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; BIOSINIT.A86 1.43 93/12/03 00:38:19 33 ; Fix bug in AllocHMA when base not para aligned 34 ; BIOSINIT.A86 1.42 93/11/29 21:40:03 35 ; Fill in name field of system DMD's (owner=8) with 'SC' 36 ; BIOSINIT.A86 1.41 93/11/18 15:43:14 37 ; Add primitive multi-master checking 38 ; BIOSINIT.A86 1.40 93/11/11 12:25:29 39 ; VDISK header changes 40 ; BIOSINIT.A86 1.39 93/11/08 23:19:22 41 ; SetupHMA does CALL5 initialisation 42 ; BIOSINIT.A86 1.38 93/10/29 20:03:48 43 ; BIOS relocation services restored for possible 3rd party memory manager use 44 ; BIOSINIT.A86 1.37 93/10/29 19:42:27 45 ; Change HIDOS default to off 46 ; BIOSINIT.A86 1.36 93/09/22 15:22:14 47 ; Change int21/4458 to les bx,cs:drdos_ptr (smaller, faster) 48 ; BIOSINIT.A86 1.35 93/09/03 20:10:55 49 ; Support intl YES/NO 50 ; BIOSINIT.A86 1.34 93/09/02 22:34:42 51 ; Add header to system allocations 52 ; BIOSINIT.A86 1.33 93/09/01 17:36:57 53 ; increase stack size for aspi4dos.sys 54 ; BIOSINIT.A86 1.31 93/08/06 20:55:16 55 ; re-arrange device init order for SCREATE.SYS on a VDISK.SYS 56 ; BIOSINIT.A86 1.28 93/08/02 14:45:43 57 ; hide preload drives from func_device 58 ; ENDLOG 59 60 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 61 %include "msdos.mac" ; DOS Function Equates 1 <1> ; File : $Workfile: MSDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; MSDOS.EQU 1.1 92/11/10 10:48:56 34 <1> ; Added to appslib source directory. 35 <1> ; ENDLOG 36 <1> 37 <1> MS_P_TERMCPM equ 00H 38 <1> MS_C_READ equ 01H 39 <1> MS_C_WRITE equ 02H 40 <1> MS_A_READ equ 03H 41 <1> MS_A_WRITE equ 04H 42 <1> MS_L_WRITE equ 05H 43 <1> MS_C_RAWIO equ 06H 44 <1> MS_C_RAWIN equ 07H 45 <1> MS_C_NOECHO equ 08H 46 <1> MS_C_WRITESTR equ 09H 47 <1> MS_C_READSTR equ 0aH 48 <1> MS_C_STAT equ 0bH 49 <1> MS_C_FLUSH equ 0cH 50 <1> MS_DRV_ALLRESET equ 0dH 51 <1> MS_DRV_SET equ 0eH 52 <1> MS_F_OPEN equ 0fH 53 <1> MS_F_CLOSE equ 10H 54 <1> MS_F_SFIRST equ 11H 55 <1> MS_F_SNEXT equ 12H 56 <1> MS_F_DELETE equ 13H 57 <1> MS_F_READ equ 14H 58 <1> MS_F_WRITE equ 15H 59 <1> MS_F_MAKE equ 16H 60 <1> MS_F_RENAME equ 17H 61 <1> MS_DRV_GET equ 19H 62 <1> MS_F_DMAOFF equ 1aH 63 <1> MS_DRV_ALLOC equ 1bH 64 <1> MS_DRV_ALLOCSPEC equ 1cH 65 <1> MS_F_READRAND equ 21H 66 <1> MS_F_WRITERAND equ 22H 67 <1> MS_F_SIZE equ 23H 68 <1> MS_F_RANDREC equ 24H 69 <1> MS_S_SETINT equ 25H 70 <1> MS_P_MKPSP equ 26H 71 <1> MS_F_READBLK equ 27H 72 <1> MS_F_WRITEBLK equ 28H 73 <1> MS_F_PARSE equ 29H 74 <1> MS_T_GETDATE equ 2aH 75 <1> MS_T_SETDATE equ 2bH 76 <1> MS_T_GETTIME equ 2cH 77 <1> MS_T_SETTIME equ 2dH 78 <1> MS_F_VERIFY equ 2eH 79 <1> MS_F_DMAGET equ 2fH 80 <1> MS_S_BDOSVER equ 30H 81 <1> MS_P_TERMKEEP equ 31H 82 <1> MS_S_BREAK equ 33H 83 <1> MS_S_GETINT equ 35H 84 <1> MS_DRV_SPACE equ 36H 85 <1> MS_S_COUNTRY equ 38H 86 <1> MS_X_MKDIR equ 39H 87 <1> MS_X_RMDIR equ 3aH 88 <1> MS_X_CHDIR equ 3bH 89 <1> MS_X_CREAT equ 3cH 90 <1> MS_X_OPEN equ 3dH 91 <1> MS_X_CLOSE equ 3eH 92 <1> MS_X_READ equ 3fH 93 <1> MS_X_WRITE equ 40H 94 <1> MS_X_UNLINK equ 41H 95 <1> MS_X_LSEEK equ 42H 96 <1> MS_X_CHMOD equ 43H 97 <1> MS_X_IOCTL equ 44H 98 <1> MS_X_DUP equ 45H 99 <1> MS_X_DUP2 equ 46H 100 <1> MS_X_CURDIR equ 47H 101 <1> MS_M_ALLOC equ 48H 102 <1> MS_M_FREE equ 49H 103 <1> MS_M_SETBLOCK equ 4aH 104 <1> MS_X_EXEC equ 4bH 105 <1> MS_X_EXIT equ 4cH 106 <1> MS_X_WAIT equ 4dH 107 <1> MS_X_FIRST equ 4eH 108 <1> MS_X_NEXT equ 4fH 109 <1> MS_P_SETPSP equ 50H 110 <1> MS_F_GETVERIFY equ 54H 111 <1> MS_X_RENAME equ 56H 112 <1> MS_X_DATETIME equ 57H 113 <1> MS_M_STRATEGY equ 58h 114 <1> MS_F_ERROR equ 59H 115 <1> MS_X_MKTEMP equ 5aH 116 <1> MS_X_MKNEW equ 5bH 117 <1> MS_F_LOCK equ 5cH 118 <1> MS_X_EXPAND equ 60H 119 <1> MS_P_GETPSP equ 62H 120 <1> MS_X_GETCP equ 6601h 121 <1> MS_X_SETCP equ 6602h 122 <1> MS_X_SETHC equ 67h 123 <1> MS_X_COMMIT equ 68h 124 <1> 125 <1> DOS_INT equ 21h ; DOS Entry Point 126 <1> ; 127 <1> STDIN equ 0 ; Standard Console Input Handle 128 <1> STDOUT equ 1 ; Standard Console Output Handle 129 <1> STDERR equ 2 ; Standard Error Output 130 <1> STDAUX equ 3 ; Auxilary Device Handle 131 <1> STDPRN equ 4 ; Printer Device Handle 62 %include "psp.mac" ; PSP Definition 1 <1> ; File : $PSP.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; Program Segment Prefix 36 <1> ; ---------------------- 37 <1> ; This structure holds vital information for DOS programs 38 <1> ; 39 <1> ;******************************************************************************* 40 <1> ;* 41 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 42 <1> ;* 00 | int 20 | memory | *** | jmpf|longjmp off| 43 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 44 <1> ;* 08 |longjmp seg| int22 Off | int22 Seg | int22 Off | 45 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 46 <1> ;* 10 | int22 Seg | int24 Off | int24 Seg | Parent | 47 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 48 <1> ;* 18 | Default Handle Table | 49 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 50 <1> ;* 20 | XFT (20 entries) | 51 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 52 <1> ;* 28 | XFT contd. | Environ | User SP | 53 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 54 <1> ;* 30 | User SS | xfnmax | xftoff | xftseg | 55 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 56 <1> ;* 38 | res1 | res2 | ric | *** | ********* | 57 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 58 <1> ;* 40 | version | ********* | ********* | ********* | 59 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 60 <1> ;* 48 | ********* | ********* | ********* | ********* | 61 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 62 <1> ;* 50 | int 21 | retf| *** | ********* | ********* | 63 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 64 <1> ;* 58 | ********* | ********* | PSP fcb 1 | 65 <1> ;* +-----+-----+-----+-----+-----+-----+-----+-----+ 66 <1> 67 <1> labelsize PSP_INT20, word, 0000h 68 <1> labelsize PSP_MEMORY, word, 0002h 69 <1> ;PSP_??? equ byte ptr 0004h 70 <1> labelsize PSP_LONGCALL, byte, 0005h 71 <1> labelsize PSP_LONGOFF, word, 0006h 72 <1> labelsize PSP_LONGSEG, word, 0008h 73 <1> labelsize PSP_TERM_IP, word, 000Ah 74 <1> labelsize PSP_TERM_CS, word, 000Ch 75 <1> labelsize PSP_BREAK_IP, word, 000Eh 76 <1> labelsize PSP_BREAK_CS, word, 0010h 77 <1> labelsize PSP_ERROR_IP, word, 0012h 78 <1> labelsize PSP_ERROR_CS, word, 0014h 79 <1> labelsize PSP_PARENT, word, 0016h 80 <1> labelsize PSP_XFT, byte, 0018h 81 <1> ; 82 <1> ; The Default Handle Table is HERE !! 83 <1> ; 84 <1> labelsize PSP_ENVIRON, word, 002ch 85 <1> labelsize PSP_USERSP, word, 002eh 86 <1> labelsize PSP_USERSS, word, 0030h 87 <1> labelsize PSP_XFNMAX, word, 0032h 88 <1> labelsize PSP_XFTPTR, dword, 0034h 89 <1> labelsize PSP_XFTOFF, word, 0034h 90 <1> labelsize PSP_XFTSEG, word, 0036h 91 <1> labelsize PSP_RES1, word, 0038h ; DOS Reserved 0FFFFh 92 <1> labelsize PSP_RES2, word, 003Ah ; DOS Reserved 0FFFFh 93 <1> labelsize PSP_RIC, byte, 003Ch ; Return Interim Character flag 94 <1> labelsize PSP_VERSION, word, 0040h ; DOS version number 95 <1> 96 <1> 97 <1> labelsize PSP_DOSCALL, word, 0050h 98 <1> labelsize PSP_DOSRETF, byte, 0052h 99 <1> 100 <1> labelsize PSP_FCB1, byte, 005Ch 101 <1> labelsize PSP_FCB2, byte, 006Ch 102 <1> labelsize PSP_COMLEN, byte, 0080h 103 <1> labelsize PSP_COMLINE, byte, 0081h 104 <1> 105 <1> XFNMAX equ 20 106 <1> 107 <1> PSPLEN equ 100h 108 <1> PSPILEN equ 60h 63 %include "f52data.mac" ; Internal DOS data area 1 <1> ; File : $F52DATA.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; The following equates define the Data Area whose address is 35 <1> ; returned by function 52. 36 <1> ; 37 <1> 38 <1> labelsize F52_BCBBUF, dword, -0008h ; current buffer 39 <1> labelsize F52_BCBOFF, word, -0008h ; current buffer 40 <1> labelsize F52_BCBSEG, word, -0006h ; current buffer 41 <1> labelsize F52_DMDROOT, word, -0002h ; Memory Descriptor Root (Seg) 42 <1> labelsize F52_DDSCPTR, dword, 0000h ; DDSC Table Address 43 <1> labelsize F52_FILEPTR, dword, 0004h ; File Handle Table Address 44 <1> labelsize F52_CLKDEV, dword, 0008h ; Clock Device Header 45 <1> labelsize F52_CONDEV, dword, 000Ch ; Console Device Header 46 <1> labelsize F52_SECSIZE, word, 0010h ; Maximum Sector Size 47 <1> labelsize F52_BUFINFOPTR, dword, 0012h ; Buffer Info pointer 48 <1> labelsize F52_PATHPTR, dword, 0016h ; Path Control Table Address 49 <1> labelsize F52_PATHOFF, word, 0016h 50 <1> labelsize F52_PATHSEG, word, 0018h 51 <1> labelsize F52_FCBPTR, dword, 001Ah ; FCB Table Address 52 <1> ; equ word ptr 001Eh ; #Entries in FCB Table 53 <1> labelsize F52_PHYDRV, byte, 0020h ; Last Physical Drive 54 <1> labelsize F52_LASTDRV, byte, 0021h ; Last Logical Drive 55 <1> labelsize F52_DEVROOT, dword, 0022h ; Root Device Header 56 <1> labelsize F52_JOINDRV, byte, 0034h ; Number of JOIN'd drives 57 <1> labelsize F52_SETVER, dword, 0037h ; SETVER table pointer 58 <1> labelsize F52_NUM_BUF, word, 003Fh ; number of disk buffers 59 <1> labelsize F52_READ_AHEAD, word, 0041h ; size of read-ahead buffer 60 <1> labelsize F52_BOOTDRV, byte, 0043h ; boot drive (1-26) 61 <1> labelsize F52_CPU_TYPE, byte, 0044h ; 01 if >= 386SX 62 <1> labelsize F52_EXT_MEM, word, 0045h ; Int 15h, AH=87h 63 <1> labelsize F52_BUF_INFO, dword, 0047h ; points at Buffer Info 64 <1> labelsize F52_HMAFLAG, byte, 0053h ; 1 if buffers in HMA 65 <1> labelsize F52_DEBLOCK, word, 0056h ; deblock if buffers in HMA 66 <1> labelsize F52_DMD_UPPER, word, 0066h ; upper memory chain 67 <1> labelsize F52_SHARE_STUB, dword, 006Ah ; Share Stub Entries*15 68 <1> 69 <1> ;DRDOS Specific 70 <1> 71 <1> labelsize DRDOS_CRITSTUBS, word, 0000h ; Offset of end of instance data 72 <1> labelsize DRDOS_HIST1CTL, word, 0004h ; History 1 Control 73 <1> labelsize DRDOS_HIST2CTL, word, 0006h ; History 2 Control 74 <1> labelsize DRDOS_HISTFLG, byte, 0008h ; History Buffer Flag 75 <1> labelsize DRDOS_DUAL_LANG, byte, 0009h ; Utils Dual Language Support 76 <1> labelsize DRDOS_CUR_LANG, byte, 000Ah ; Current Language 77 <1> labelsize DRDOS_EXT_MEM, word, 000Bh ; Total Extended Memory 78 <1> labelsize DRDOS_HIMEM_ROOT, word, 0010h ; High memory chain 79 <1> labelsize DRDOS_ENVSEG, word, 0012h ; Seg of environment 80 <1> labelsize DRDOS_DMD_BASE, word, 0016h ; base memory freed at 81 <1> labelsize DRDOS_DMD_UPPER, word, 0018h ; upper memory chain 82 <1> labelsize DRDOS_MACHINE_ID, word, 001Ah ; local machine ID 83 <1> labelsize DRDOS_COUNTRY_FILE, word, 001Eh ; offset of filename 84 <1> labelsize DRDOS_HASHOFF, word, 0020h ; fastopen hash root 85 <1> labelsize DRDOS_HASHSEG, word, 0022h ; pointer 86 <1> labelsize DRDOS_HASHMAX, word, 0024h ; max # dir entries 87 <1> labelsize DRDOS_DEBLOCK, word, 0026h ; himem deblock buffer 88 <1> labelsize DRDOS_INT2F, word, 002Ch ; internal Int 2F hook 64 %include "doshndl.mac" ; Dummy DOS structures 1 <1> ; File : $DOSHNDL.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> labelsize DCNTRL_DSADD, dword, 0000h 36 <1> labelsize DCNTRL_DSOFF, word, 0000h 37 <1> labelsize DCNTRL_DSSEG, word, 0002h 38 <1> labelsize DCNTRL_COUNT, word, 0004h 39 <1> DCNTRL_LEN equ 6 40 <1> 41 <1> labelsize DHNDL_COUNT, word, 00h ; 00 - Usage Count 42 <1> labelsize DHNDL_MODE, word, 02h ; 02 - File Mode 43 <1> 44 <1> DHM_FCB equ 8000h ; marks as FCB 45 <1> DHM_COMMIT equ 4000h ; auto-commit file 46 <1> DHM_NOCRIT equ 2000h ; no critical errors 47 <1> DHM_LOCAL equ 10000000b ; file is not inherited 48 <1> DHM_SHAREMSK equ 01110000b ; sharing bits 49 <1> DHM_COMPAT equ 00000000b 50 <1> DHM_DENY_ALL equ 00010000b ; exclusive - deny all 51 <1> DHM_DENY_WRITE equ 00100000b 52 <1> DHM_DENY_READ equ 00110000b 53 <1> DHM_DENY_NONE equ 01000000b 54 <1> DHM_RWMSK equ 00001111b ; read write bits 55 <1> DHM_RW equ 00000010b ; file opened read/write 56 <1> DHM_WO equ 00000001b ; file opened write only 57 <1> DHM_RO equ 00000000b ; file opened read only 58 <1> 59 <1> ; 60 <1> ; 01h to 03h To be Determined 61 <1> ; 62 <1> labelsize DHNDL_DATRB, byte, 04h ; Disk attribute byte 63 <1> labelsize DHNDL_ATTR, byte, 05h ; Attribute Byte 64 <1> labelsize DHNDL_WATTR, word, 05h ; Attribute Word 65 <1> 66 <1> DHAT_REMOTE equ 8000h ; set if file remote 67 <1> DHAT_TIMEOK equ 4000h ; set if timestamp up to date 68 <1> DHAT_LOCAL equ 1000h ; file is not inherited 69 <1> DHAT_NETPRN equ 0800h ; device is networked printer 70 <1> DHAT_DEV equ 0080h ; device/file bit 71 <1> DHAT_READY equ 0040h ; ready/not ready bit 72 <1> DHAT_CLEAN equ 0040h ; this bit CLEAR if dirty 73 <1> DHAT_BIN equ 0020h ; raw/cooked bit 74 <1> DHAT_DRVMSK equ 001Fh ; drive in bottom bits 75 <1> DHAT_CLK equ 0008h ; -reserved- 76 <1> DHAT_NUL equ 0004h ; handle is null device 77 <1> DHAT_COT equ 0002h ; handle is console output device 78 <1> DHAT_CIN equ 0001h ; handle is console input device 79 <1> 80 <1> labelsize DHNDL_DEVPTR, dword, 07h ; 07 - pointer to device 81 <1> labelsize DHNDL_DEVOFF, word, 07h ; 07 - offset of device 82 <1> labelsize DHNDL_DEVSEG, word, 09h ; 09 - segment of device 83 <1> labelsize DHNDL_BLK1, word, 0Bh ; 0B - first cluster in file 84 <1> ; (lower 32 bits) 85 <1> labelsize DHNDL_TIME, word, 0Dh ; 0D - file time stamp 86 <1> labelsize DHNDL_DATE, word, 0Fh ; 0F - file date stamp 87 <1> labelsize DHNDL_SIZE, dword, 11h ; 11 - file length 88 <1> ; (lower 32 bits) 89 <1> labelsize DHNDL_SIZELO, word, 11h 90 <1> labelsize DHNDL_SIZEHI, word, 13h 91 <1> labelsize DHNDL_POS, dword, 15h ; 15 - current file position 92 <1> ; (lower 32 bits) 93 <1> labelsize DHNDL_POSLO, word, 15h 94 <1> labelsize DHNDL_POSHI, word, 17h 95 <1> labelsize DHNDL_IDX, word, 19h ; 19 - relative cluster within file of last read 96 <1> ; (lower 32 bits) 97 <1> labelsize DHNDL_DBLK, word, 1Bh ; 1B - cluster # of dir entry 98 <1> ; (lower 32 bits) 99 <1> labelsize DHNDL_DCNTHI, byte, 1Eh ; 1E - dir offset # within cluster 100 <1> labelsize DHNDL_DCNTLO, byte, 1Fh ; 1F - dir offset # within cluster 101 <1> labelsize DHNDL_NAME, byte, 20h ; 20 - File/Device Name 102 <1> labelsize DHNDL_EXT, byte, 28h ; 28 - File extension 103 <1> labelsize DHNDL_SFT, dword, 2Bh ; 2B - pointer to previous SFT 104 <1> labelsize DHNDL_UID, word, 2Fh ; 2F - Owning Machine ID 105 <1> labelsize DHNDL_PSP, word, 31h ; 31 - Owning PSP 106 <1> labelsize DHNDL_SHARE, word, 33h ; 33 - Offset of sharing record 107 <1> labelsize DHNDL_BLK, word, 35h ; 35 - absolute cluster of last read 108 <1> ; (lower 32 bits) 109 <1> ; 37 - dword reserved for IFS 110 <1> labelsize DHNDL_BLK1H, word, 3Bh ; 3B - first cluster in file 111 <1> ; (higher 32 bits) 112 <1> labelsize DHNDL_IDXH, word, 3Dh ; 3D - relative cluster within file of last read 113 <1> ; (higher 32 bits) 114 <1> labelsize DHNDL_DBLKH, word, 3Fh ; 3F - cluster # of dir entry 115 <1> ; (higher 32 bits) 116 <1> labelsize DHNDL_BLKH, word, 41h ; 41 - absolute cluster of last read 117 <1> ; (higher 32 bits) 118 <1> labelsize DHNDL_SIZEX, dword, 43h ; 43 - file length 119 <1> ; (higher 32 bits) 120 <1> labelsize DHNDL_SIZEXLO, word, 43h 121 <1> labelsize DHNDL_SIZEXHI, word, 45h 122 <1> labelsize DHNDL_POSX, dword, 47h ; 47 - current file position 123 <1> ; (higher 32 bits) 124 <1> labelsize DHNDL_POSXLO, word, 47h 125 <1> labelsize DHNDL_POSXHI, word, 49h 126 <1> DHNDL_LEN equ 4Bh 127 <1> 128 <1> ; With DOS 3 structures _DBLK is a 16 bit 129 <1> 130 <1> 131 <1> ; Logical Drive Table format 132 <1> labelsize LDT_NAME, byte, 00h ; 00 - Ascii Name field 133 <1> labelsize LDT_FLAGS, word, 43h ; 43 - Flag field 134 <1> labelsize LDT_PDT, dword, 45h ; 45 - PDT for this drive 135 <1> labelsize LDT_BLK, word, 49h ; 49 - directory sector 136 <1> labelsize LDT_ROOT, word, 4bh ; 4B - virtual block root 137 <1> labelsize LDT_DRV, byte, 4dh ; 4D - physical drive 138 <1> labelsize LDT_ROOTLEN, word, 4fh ; 4F - Length of root portion 139 <1> labelsize LDT_BLKH, word, 51h 140 <1> labelsize LDT_ROOTH, word, 53h 141 <1> LDT_LEN equ 58h 142 <1> 143 <1> LFLG_NETWRKD equ 8000h 144 <1> LFLG_PHYSICAL equ 4000h 145 <1> LFLG_JOINED equ 2000h 146 <1> LFLG_SUBST equ 1000h 65 %include "fdos.mac" 1 <1> ; File : $FDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 35 <1> ; Structure of Buffer Control Blocks 36 <1> ; ---------------------------------- 37 <1> ; These BCBs immediately preceed the data buffers. BCBs are 38 <1> ; always shared for all drives and therefore must be big 39 <1> ; enough for the largest drive. 40 <1> ; 41 <1> 42 <1> labelsize BCB_NEXT, word, 00h ; link to next buffer 43 <1> labelsize BCB_PREV, word, 02h ; link to previous buffer 44 <1> labelsize BCB_DRV, byte, 04h ; drive of this buffer or 0FFh 45 <1> labelsize BCB_FLAGS, byte, 05h ; buffer flags 46 <1> labelsize BCB_REC, word, 06h ; low 16 bits of sector address 47 <1> labelsize BCB_REC2, word, 08h ; top 16 bits of sector address 48 <1> ;BCB_REC2 equ byte ptr 08h ; top 8 bits of record address 49 <1> labelsize BCB_COPIES, byte, 0Ah ; number of copies to write 50 <1> labelsize BCB_SEPARATION, word, 0Bh ; # sectors copies are apart 51 <1> labelsize BCB_DDSC, dword, 0Dh ; DWORD ptr to DDSC_ 52 <1> labelsize BCB_REMOTE, word, 11h ; remote in-use count 53 <1> labelsize BCB_DATA, byte, 14h ; buffer data 54 <1> 55 <1> BF_ISFAT equ 0002h ; buffer marked as FAT sector 56 <1> BF_ISDIR equ 0004h ; buffer marked as Directory sector 57 <1> BF_ISDAT equ 0008h ; buffer marked as Data sector 58 <1> BF_DIRTY equ 0040h ; buffer marked as modified 59 <1> BF_REMOTE equ 0080h ; buffer is remote 60 <1> 61 <1> MAX12 equ 0FF6h ; max. disk size w/ 12-bit media 62 <1> 63 <1> ; Structure of Hash Control Block 64 <1> ; ------------------------------- 65 <1> ; Each hash control block refers to the hash codes of one 66 <1> ; disrectory cluster or a root directory. 67 <1> 68 <1> labelsize HCB_LINK, word, 0 ; link to next control block 69 <1> labelsize HCB_DRV, byte, 2 ; drive for this entry or 0FFh 70 <1> labelsize HCB_CLU, word, 4 ; cluster number or 0000 if root 71 <1> labelsize HCB_CLUH, word, 6 ; high word of cluster number 72 <1> labelsize HCB_CNT, word, 8 ; number of hashed entries 73 <1> labelsize HCB_DATA, word, 10 ; hash buffer data 74 <1> 75 <1> 76 <1> ; Structure of DOS FCB 77 <1> ; -------------------- 78 <1> ; This is hopefully consistent with what DOS stores in an 79 <1> ; open file control block for DOS 1.x functions 80 <1> 81 <1> labelsize MSF_EXTFLG, byte, 0 ; if this is 0xFF, skip 1st 7 byte 82 <1> labelsize MSF_ATTRIB, byte, 6 ; file attributes if MSF_EXTFLG 83 <1> labelsize MSF_DRIVE, byte, 0 ; 1st byte normally drive code 84 <1> labelsize MSF_NAME, byte, 1 ; 8-bit ASCII file name, 11 characters 85 <1> labelsize MSF_BLOCK, word, 12 ; current block number 86 <1> labelsize MSF_RECSIZE, word, 14 ; current logical record size 87 <1> labelsize MSF_SIZE, word, 16 ; 32-bit file size 88 <1> labelsize MSF_DATE, word, 20 ; last date stamp 89 <1> labelsize MSF_TIME, word, 22 ; last time stamp 90 <1> labelsize MSF_IFN, byte, 24 ;; internal file number 91 <1> labelsize MSF_IOCTL, byte, 25 ;; file status 92 <1> labelsize MSF_BLOCK1, word, 26 ;; 1st block of file 93 <1> labelsize MSF_DBLK, word, 28 ;; directory block 94 <1> labelsize MSF_DEVPTR, dword, 28 ;; address of device driver 95 <1> labelsize MSF_DCNT, word, 30 ;; directory count 96 <1> labelsize MSF_CR, byte, 32 ; current sequential record 97 <1> labelsize MSF_RR, word, 33 ; random record address (3 or 4 byte) 98 <1> labelsize MSF_RR2, byte, 35 ; random record overflow 99 <1> 100 <1> 101 <1> ; Structure of DOS DPB 102 <1> ; -------------------- 103 <1> ; The layout of this structure is a guess based on 104 <1> ; examples. It is returned by PC MODE on functions 1Fh and 105 <1> ; 32h and is required by various disk-related utilities 106 <1> ; like disk editors and CHKDSK. 107 <1> 108 <1> labelsize DDSC_UNIT, byte, 0 ; absolute drive number 109 <1> labelsize DDSC_RUNIT, byte, 1 ; relative unit number 110 <1> labelsize DDSC_SECSIZE, word, 2 ; sector size in bytes 111 <1> labelsize DDSC_CLMSK, byte, 4 ; sectors/cluster - 1 112 <1> labelsize DDSC_CLSHF, byte, 5 ; log2 (sectors/cluster) 113 <1> labelsize DDSC_FATADDR, word, 6 ; sector address of FAT 114 <1> labelsize DDSC_NFATS, byte, 8 ; # of FAT copies 115 <1> labelsize DDSC_DIRENT, word, 9 ; size of root directory 116 <1> labelsize DDSC_DATADDR, word, 11 ; sector address of cluster #2 117 <1> labelsize DDSC_NCLSTRS, word, 13 ; # of clusters on disk 118 <1> labelsize DDSC_NFATRECS, word, 15 ; # of sectors per FAT 119 <1> labelsize DDSC_DIRADDR, word, 17 ; sector address of root dir 120 <1> labelsize DDSC_DEVHEAD, dword, 19 ; device driver header 121 <1> labelsize DDSC_DEVOFF, word, 19 122 <1> labelsize DDSC_DEVSEG, word, 21 123 <1> labelsize DDSC_MEDIA, byte, 23 ; current media byte 124 <1> labelsize DDSC_FIRST, byte, 24 ; "drive never accessed" flag 125 <1> labelsize DDSC_LINK, dword, 25 ; next drive's DDSC 126 <1> labelsize DDSC_BLOCK, word, 29 ; next block to allocate 127 <1> labelsize DDSC_FREE, word, 31 ; total free clusters on drive 128 <1> labelsize DDSC_BFREE, dword, 33 ; total free clusters on drive (32-bit) 129 <1> labelsize DDSC_FSFLAGS, word, 37 ; FAT mirroring flags 130 <1> labelsize DDSC_FSINFO, word, 39 ; sector number of file system info block 131 <1> labelsize DDSC_BOOTBAK, word, 41 ; sector number of backup boot sector 132 <1> labelsize DDSC_BDATADDR, dword, 43 ; sector address of cluster #2 (32-bit) 133 <1> labelsize DDSC_BCLSTRS, dword, 47 ; # of clusters on disk (32-bit) 134 <1> labelsize DDSC_BFATRECS, dword, 51 ; # of sectors per FAT (32-bit) 135 <1> labelsize DDSC_FSROOT, dword, 55 ; starting cluster of root directory 136 <1> labelsize DDSC_BBLOCK, dword, 59 ; next block to allocate (32-bit) 137 <1> labelsize DDSC_FSVER, word, 63 ; version of file system 138 <1> DDSC_LEN equ 65 139 <1> 140 <1> 141 <1> 142 <1> ; DELWATCH hooks called by OS 143 <1> 144 <1> DELW_RDMASK equ 0 ; delete dir search mask 145 <1> DELW_DELETE equ 2 ; delete this dir entry 146 <1> DELW_FREECLU equ 3 ; free some clusters 147 <1> DELW_FREERD equ 4 ; free root dir entry 148 <1> DELW_SPACE equ 5 ; add "deletes" to free space 149 <1> DELW_NEWDISK equ 7 ; new disk logged in 150 <1> DELW_PURGE equ 14 ; perge pd file 151 <1> DELW_UNDEL equ 15 ; undelete pd file 152 <1> 153 <1> ; SuperStore hook called by OS 154 <1> 155 <1> SSTOR_SPACE equ 10h ; enquire # physical free space 156 <1> 157 <1> ; Password hooks called by OS 158 <1> 159 <1> PASSWD_CREAT equ 20h ; initialise an entry 160 <1> PASSWD_CHMOD equ 21h ; change an entry 161 <1> PASSWD_CHECK equ 22h ; check an entry 162 <1> 163 <1> ; Share hooks in PCMODE data segment 164 <1> ; 165 <1> ; These point to a stub which does a "STC, RETF" 166 <1> ; 167 <1> 168 <1> NUM_SHARE_STUB_ENTRIES equ 15 169 <1> 170 <1> S_LOCKS equ 4*0 ; share lock/unlock region 171 <1> S_UPDATE equ 4*1 ; update DHNDL from share 172 <1> S_RECORD equ 4*2 ; update share from DHNDL 173 <1> S_FDOSRW equ 4*3 ; validate proposed operation 174 <1> S_DISCARD equ 4*4 ; discard all files on drive 175 <1> S_OPEN equ 4*5 ; files is opening, remember it 176 <1> S_CLOSE equ 4*6 ; files is closing, forget it 177 <1> S_OM_COMPAT equ 4*7 ; check open mode compatible 178 <1> S_CLOSE_IF_OPEN equ 4*8 ; close if compat open, else deny 179 <1> S_DENY_IF_OPEN equ 4*9 ; deny if open shared/by others 180 <1> S_GET_LIST_ENTRY equ 4*10 ; get open file list entry 181 <1> S_CLOSE_FILES equ 4*11 ; close all files for given PSP/UID 182 <1> 183 <1> ; struct dirfcb 184 <1> 185 <1> labelsize DNAME, byte, 0 ;file name & type 186 <1> labelsize DATTS, byte, 11 187 <1> DA_RO equ 01h ; 0x01 - read/only 188 <1> DA_HIDDEN equ 02h ; 0x02 - hidden 189 <1> DA_SYSTEM equ 04h ; 0x04 - system 190 <1> DA_VOLUME equ 08h ; 0x08 - volume label 191 <1> DA_DIR equ 10h ; 0x10 - sub-directory 192 <1> DA_ARCHIVE equ 20h ; 0x20 - archive 193 <1> DA_CLUSTER equ 80h ; 0x80 - return starting cluster from search (API extention) 194 <1> DA_DELWATCH equ 80h ; 0x88 - return pending delete files 195 <1> DA_FIXED equ 11011000b ; can't CHMOD label, dir, unused bits 196 <1> DA_CHANGE equ ~ DA_FIXED ; all others are changeable 197 <1> 198 <1> ;DATTS2 equ 12 ;CP/M attributes 199 <1> ; ; 0x80 - f1' modify default open rules 200 <1> ; ; 0x40 - f2' partial close default 201 <1> ; ; 0x20 - f3' ignore close checksum errors 202 <1> ; ; 0x10 - f4' disable checksums 203 <1> ; ; 0x08 - (reserved) 204 <1> ; ; 0x04 - DELETE password 205 <1> ; ; 0x02 - WRITE password 206 <1> ; ; 0x01 - READ password 207 <1> DSIZEX equ 12 ;file size extension for FAT+ (bit 0-2 and 5-7) 208 <1> DUNDEL equ 13 ;1st letter of deleted file 209 <1> labelsize DPWD, word, 14 ;16-bit password hash code 210 <1> labelsize DMODTIME, word, 16 ;delwatch time (hhhhhmmmmmmsssss) 211 <1> labelsize DMODDATE, word, 18 ;delwatch date (yyyyyyymmmmddddd) 212 <1> ;DRECSIZE equ 16 ;FlexOS record size 213 <1> ;DUSER equ 18 ;FlexOS user ID of creator 214 <1> ;DGROUP equ 19 ;FlexOS group ID of creator 215 <1> labelsize DPWM, word, 20 ;FlexOS access rights 216 <1> labelsize DBLOCK1H, word, 20 ;high word of first block in file 217 <1> DTIME equ 22 ;time (hhhhhmmmmmmsssss) 218 <1> DDATE equ 24 ;date (yyyyyyymmmmddddd) 219 <1> DBLOCK1 equ 26 ;first block in file 220 <1> DSIZE equ 28 ;current file size 221 <1> 222 <1> ; DOS Media Password Definitions 223 <1> ; ------------------------------ 224 <1> 225 <1> PWM_OWNER equ 000Fh ; PWD Owner mask 226 <1> PWM_GROUP equ 00F0h ; PWD Group mask 227 <1> PWM_WORLD equ 0F00h ; PWD World mask 228 <1> PWM_R equ 0888h ; PWD required for reading 229 <1> PWM_W equ 0444h ; PWD required for writing 230 <1> PWM_E equ 0222h ; PWD req'd for executing 231 <1> PWM_D equ 0111h ; PWD required for deleting 232 <1> PWM_ANY equ PWM_R+PWM_W+PWM_D ; PWD required for anything 233 <1> 234 <1> 235 <1> ; literal constants 236 <1> 237 <1> FAT12 equ 00fffh ; 12 bit fat 238 <1> FAT16 equ 0ffffh ; 16 bit fat 239 <1> FAT32 equ 0 ; 32 bit fat 240 <1> 241 <1> ENDDIR equ 0ffffh ;end of directory 242 <1> 66 %include "modfunc.mac" 1 <1> ; File : $Workfile: MODFUNC.DEF$ 2 <1> ; 3 <1> ; Description : Standard VLADIVAR include file 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ;****************************************************************; 35 <1> ;* *; 36 <1> ;* OS386 Inter-Module Function Definitions *; 37 <1> ;* *; 38 <1> ;****************************************************************; 39 <1> 40 <1> OS386_FUNC equ 2780h ; AX value 41 <1> OS386_INT equ 02Fh ; interrupt number 42 <1> 43 <1> ; Module definitions 44 <1> USER equ 0 45 <1> SUP equ 1 46 <1> RTM equ 2 47 <1> MEM equ 3 48 <1> DOM equ 4 49 <1> VM equ 5 50 <1> DPMI equ 6 51 <1> DPMS equ 7 52 <1> MIN_MODULE equ 5 53 <1> MAX_MODULE equ 15 54 <1> 55 <1> ; Internal SUP functions 56 <1> F_NotImp equ SUP + 0100h * 00 ; Function Not Implemented 57 <1> F_Illegal equ SUP + 0100h * 01 ; Illegal Function 58 <1> F_ModuleReg equ SUP + 0100h * 02 ; Register Module 59 <1> F_SysDatAlloc equ SUP + 0100h * 03 ; allocate SYSDAT memory 60 <1> F_SysDat equ SUP + 0100h * 04 ; return SYSDAT selector 61 <1> F_MoveReal equ SUP + 0100h * 05 ; move real mode memory to protected mode 62 <1> F_Reboot equ SUP + 0100h * 06 63 <1> F_Debug equ SUP + 0100h * 07 64 <1> F_ForeCheck equ SUP + 0100h * 08 ; Check for foreground 65 <1> F_RegisterVxD equ SUP + 0100h * 09 ; Register VxD with system 66 <1> F_UnloadVxD equ SUP + 0100h * 10 ; Unload VxD hook 67 <1> F_PostInit equ SUP + 0100h * 11 ; end of initialisation phase 68 <1> F_AllocWindow equ SUP + 0100h * 12 ; allocate a 4K mapping window 69 <1> F_RegisterBoot equ SUP + 0100h * 13 ; register reboot addresses 70 <1> F_EnquireBoot equ SUP + 0100h * 14 ; enquire if reboot active 71 <1> F_GetDebugLevel equ SUP + 0100h * 15 ; get debug level 72 <1> F_SetDebugLevel equ SUP + 0100h * 16 ; set debug level 73 <1> F_Version equ SUP + 0100h * 17 ; version check 74 <1> F_V86BPInstall equ SUP + 0100h * 18 ; install v86 break point 75 <1> F_V86BPRemove equ SUP + 0100h * 19 ; remove v86 break point 76 <1> F_V86BPOffer equ SUP + 0100h * 20 ; offer int 3 as v86 break point 77 <1> F_LoaderCleanup equ SUP + 0100h * 21 ; offer the chance to cleanup 78 <1> F_RegisterVxDWindow equ SUP + 0100h * 22 ; Register VxD mapping window 79 <1> F_RegisterPNW equ SUP + 0100h * 23 ; Register PNW info 80 <1> 81 <1> ; Internal RTM functions 82 <1> F_PDCount equ RTM + 0100h * 01 83 <1> F_FlgWait equ RTM + 0100h * 02 84 <1> F_FlgSet equ RTM + 0100h * 03 85 <1> F_QMake equ RTM + 0100h * 04 86 <1> F_QOpen equ RTM + 0100h * 05 87 <1> F_QDelete equ RTM + 0100h * 06 88 <1> F_QRead equ RTM + 0100h * 07 89 <1> F_CQread equ RTM + 0100h * 08 90 <1> F_QWrite equ RTM + 0100h * 09 91 <1> F_CQWrite equ RTM + 0100h * 10 92 <1> F_Delay equ RTM + 0100h * 11 93 <1> F_Dispatch equ RTM + 0100h * 12 94 <1> F_PTerm equ RTM + 0100h * 13 95 <1> F_PCreat equ RTM + 0100h * 14 96 <1> F_SetPrior equ RTM + 0100h * 15 97 <1> F_PDAddr equ RTM + 0100h * 16 98 <1> F_PAbort equ RTM + 0100h * 17 99 <1> F_Sleep equ RTM + 0100h * 18 100 <1> F_Wakeup equ RTM + 0100h * 19 101 <1> F_FindPDName equ RTM + 0100h * 20 102 <1> F_SetFlags equ RTM + 0100h * 21 103 <1> F_EndOfInterrupt equ RTM + 0100h * 22 ; Register PIC end of interrupt 104 <1> F_NoAbort equ RTM + 0100h * 23 105 <1> F_OkAbort equ RTM + 0100h * 24 106 <1> F_FlagStatus equ RTM + 0100h * 25 107 <1> F_QRdMX equ RTM + 0100h * 26 108 <1> F_QWrMX equ RTM + 0100h * 27 109 <1> F_FlgAlloc equ RTM + 0100h * 28 110 <1> F_FlgFree equ RTM + 0100h * 29 111 <1> F_NumFlags equ RTM + 0100h * 30 112 <1> F_NDQRead equ RTM + 0100h * 31 113 <1> F_FlgWWTO equ RTM + 0100h * 32 114 <1> F_UdaAlloc equ RTM + 0100h * 33 115 <1> F_UdaFree equ RTM + 0100h * 34 116 <1> F_PFreeze equ RTM + 0100h * 35 117 <1> F_PThaw equ RTM + 0100h * 36 118 <1> F_CritEnter equ RTM + 0100h * 37 119 <1> F_CritExit equ RTM + 0100h * 38 120 <1> F_PCreate equ RTM + 0100h * 39 121 <1> F_PDList equ RTM + 0100h * 40 122 <1> F_PDToName equ RTM + 0100h * 41 123 <1> F_PDToStatus equ RTM + 0100h * 42 124 <1> F_PDToDomain equ RTM + 0100h * 43 125 <1> F_GetPrior equ RTM + 0100h * 44 126 <1> F_QDList equ RTM + 0100h * 45 127 <1> F_QDToName equ RTM + 0100h * 46 128 <1> F_QDToMsgLen equ RTM + 0100h * 47 129 <1> F_QDToMaxMsgs equ RTM + 0100h * 48 130 <1> F_QDToNqPD equ RTM + 0100h * 49 131 <1> F_QDToDqPD equ RTM + 0100h * 50 132 <1> F_QDToNumMsgs equ RTM + 0100h * 51 133 <1> F_QDToFlags equ RTM + 0100h * 52 134 <1> F_NameToQD equ RTM + 0100h * 53 135 <1> F_NameToPD equ RTM + 0100h * 54 136 <1> F_MutexAlloc equ RTM + 0100h * 55 137 <1> F_MutexFree equ RTM + 0100h * 56 138 <1> F_MutexEnter equ RTM + 0100h * 57 139 <1> F_MutexCEnter equ RTM + 0100h * 58 140 <1> F_MutexExit equ RTM + 0100h * 59 141 <1> F_Slice equ RTM + 0100h * 60 142 <1> F_TickLength equ RTM + 0100h * 61 143 <1> F_ProcessID equ RTM + 0100h * 62 144 <1> F_QClose equ RTM + 0100h * 63 145 <1> F_QDispose equ RTM + 0100h * 64 146 <1> F_PDToFlags equ RTM + 0100h * 65 147 <1> F_PDToDParam equ RTM + 0100h * 66 148 <1> F_ReleaseMX equ RTM + 0100h * 67 149 <1> F_SimulateInt equ RTM + 0100h * 68 150 <1> F_SetQFlags equ RTM + 0100h * 69 151 <1> F_TickRate equ RTM + 0100h * 70 152 <1> 153 <1> ; Internal MEMORY functions 154 <1> F_PdirGet equ MEM + 0100h * 01 155 <1> F_PdirSet equ MEM + 0100h * 02 156 <1> F_PageAlloc equ MEM + 0100h * 03 157 <1> F_RealAllocG equ MEM + 0100h * 04 158 <1> F_RealAllocI equ MEM + 0100h * 05 159 <1> F_PtblRead equ MEM + 0100h * 06 160 <1> F_PtblWrite equ MEM + 0100h * 07 161 <1> F_PageGet equ MEM + 0100h * 08 162 <1> F_PageSet equ MEM + 0100h * 09 163 <1> F_PagesAlloc equ MEM + 0100h * 10 164 <1> F_PageFree equ MEM + 0100h * 11 165 <1> F_MemAlloc equ MEM + 0100h * 12 166 <1> F_MemFree equ MEM + 0100h * 13 167 <1> F_MemSize equ MEM + 0100h * 14 168 <1> F_MemResize equ MEM + 0100h * 15 169 <1> F_DescAlloc equ MEM + 0100h * 16 170 <1> F_DescFree equ MEM + 0100h * 17 171 <1> F_DescGet equ MEM + 0100h * 18 172 <1> F_DescSet equ MEM + 0100h * 19 173 <1> F_DescMemAlloc equ MEM + 0100h * 20 174 <1> F_DescMemFree equ MEM + 0100h * 21 175 <1> F_DescMemSize equ MEM + 0100h * 22 176 <1> F_DescMemResize equ MEM + 0100h * 23 177 <1> F_PageLock equ MEM + 0100h * 24 178 <1> F_PageUnlock equ MEM + 0100h * 25 179 <1> F_PageLockAny equ MEM + 0100h * 26 180 <1> F_PageUnlockReuse equ MEM + 0100h * 27 181 <1> F_PageLockNone equ MEM + 0100h * 28 182 <1> F_PageUnlockNone equ MEM + 0100h * 29 183 <1> F_CallRealRaw equ MEM + 0100h * 30 ; Call real mode (SS:ESP supplied) 184 <1> F_IntRealRaw equ MEM + 0100h * 31 ; Do real mode interrupt (SS:ESP supplied) 185 <1> F_CallReal equ MEM + 0100h * 32 ; Call real mode with RETF frame 186 <1> F_IntReal equ MEM + 0100h * 33 ; Do real mode interrupt 187 <1> F_PagedCallReal equ MEM + 0100h * 34 ; Paged real mode call 188 <1> F_PagedIntReal equ MEM + 0100h * 35 ; Paged real mode interrupt 189 <1> F_CallIretReal equ MEM + 0100h * 36 ; Call real mode with IRET frame 190 <1> F_CallIretRealRaw equ MEM + 0100h * 37 ; Call real mode with IRET frame (SS:ESP supplied) 191 <1> F_CallProt16 equ MEM + 0100h * 38 ; Call protected mode 16 bit code 192 <1> F_CallProt32 equ MEM + 0100h * 39 ; Call protected mode 32 bit code 193 <1> F_IAddPage equ MEM + 0100h * 40 ; add kernel instance data 194 <1> F_BankPageLock equ MEM + 0100h * 41 195 <1> F_BankPageUnlock equ MEM + 0100h * 42 196 <1> F_BankPageLockAny equ MEM + 0100h * 43 197 <1> F_BankPageUnlockReuse equ MEM+0100h * 44 198 <1> F_BankPageLockNone equ MEM + 0100h * 45 199 <1> F_BankPageUnlockNone equ MEM+ 0100h * 46 200 <1> F_GateAlloc equ MEM + 0100h * 47 201 <1> F_GateFree equ MEM + 0100h * 48 202 <1> F_MemTotalFree equ MEM + 0100h * 49 203 <1> F_AddressSpace equ MEM + 0100h * 50 204 <1> F_MemTotal equ MEM + 0100h * 51 205 <1> F_DescRead equ MEM + 0100h * 52 206 <1> F_DescWrite equ MEM + 0100h * 53 207 <1> F_GetStack equ MEM + 0100h * 54 208 <1> F_SetStack equ MEM + 0100h * 55 209 <1> 210 <1> ; Internal DOMain functions 211 <1> 212 <1> F_DAlloc equ DOM + 0100h * 00 ; create a new domain 213 <1> F_DFree equ DOM + 0100h * 01 ; free up a domain 214 <1> F_DGet equ DOM + 0100h * 02 ; get current domain 215 <1> F_DSet equ DOM + 0100h * 03 ; switch to another domain 216 <1> F_SWIntHandler equ DOM + 0100h * 04 ; Install Software Interrupt handler 217 <1> F_PFaultHandler equ DOM + 0100h * 05 ; Install Page Fault handler 218 <1> F_IOExHandler equ DOM + 0100h * 06 ; Install I/O Exception handler 219 <1> F_GenExHandler equ DOM + 0100h * 07 ; Install General Exception handler 220 <1> F_HWIntHandler equ DOM + 0100h * 08 ; Install HW int handler 221 <1> F_IOBitGet equ DOM + 0100h * 09 ; Get domain IO bitmap 222 <1> F_IOBitSet equ DOM + 0100h * 10 ; Set domain IO bitmap 223 <1> F_BankIOBitGet equ DOM + 0100h * 11 ; Get domain banked IO bitmap 224 <1> F_BankIOBitSet equ DOM + 0100h * 12 ; Set domain banked IO bitmap 225 <1> F_BankMemGet equ DOM + 0100h * 13 ; Read domain banked memory 226 <1> F_BankMemSet equ DOM + 0100h * 14 ; Write domain banked memory 227 <1> F_BankPageGet equ DOM + 0100h * 15 ; Get domain banked page table entry 228 <1> F_BankPageSet equ DOM + 0100h * 16 ; Set domain banked page table entry 229 <1> F_RegInstData equ DOM + 0100h * 17 ; register DOS instance data 230 <1> F_NProcesses equ DOM + 0100h * 18 ; Get number of processes in domain 231 <1> F_DFreeze equ DOM + 0100h * 19 ; Suspend domain 232 <1> F_DThaw equ DOM + 0100h * 20 ; Unsuspend domain 233 <1> F_DFork equ DOM + 0100h * 21 ; Fork domain 234 <1> F_DAbort equ DOM + 0100h * 22 ; Abort all processes in domain 235 <1> F_UnlinkHandler equ DOM + 0100h * 23 ; Uninstall a handler 236 <1> F_HWIntDfltHandler equ DOM + 0100h * 24 ; Install HW int default handler 237 <1> F_VHWIntHandler equ DOM + 0100h * 25 ; Install Virtual HW int handler 238 <1> F_VHWIntDfltHandler equ DOM + 0100h * 26 ; Install Virtual HW int default handler 239 <1> F_SwapInHandler equ DOM + 0100h * 27 ; Install process swap in handler 240 <1> F_SwapOutHandler equ DOM + 0100h * 28 ; Install process swap out handler 241 <1> F_DosStartup equ DOM + 0100h * 29 ; Statup a DOS session 242 <1> F_DosShutdown equ DOM + 0100h * 30 ; Terminate a DOS session 243 <1> F_PCreateHandler equ DOM + 0100h * 31 ; Install process create handler 244 <1> F_PDeleteHandler equ DOM + 0100h * 32 ; Install process terminate handler 245 <1> F_RootPD equ DOM + 0100h * 33 ; Get Domain Root Process 246 <1> F_DForeground equ DOM + 0100h * 34 ; Domain has just switched to foreground 247 <1> F_DBackground equ DOM + 0100h * 35 ; Domain will be switching to background 248 <1> F_MapHMA equ DOM + 0100h * 36 ; Map Domains HMA 249 <1> F_AddInstData equ DOM + 0100h * 37 ; add DOS instance data 250 <1> F_DMemFree equ DOM + 0100h * 38 ; get memory available to this domain 251 <1> F_DMemTotal equ DOM + 0100h * 39 ; get memory allocated to this domain 252 <1> F_DGetMemLimit equ DOM + 0100h * 40 ; get limit on local memory allocations 253 <1> F_DSetMemLimit equ DOM + 0100h * 41 ; set limit on local memory allocations 254 <1> F_ReflectInt21 equ DOM + 0100h * 42 ; support for protected mode Int 21's 255 <1> F_DTestRegion equ DOM + 0100h * 43 ; test region for global/local memory 256 <1> F_Switcher equ DOM + 0100h * 44 ; make task switcher call 257 <1> F_HandlerCleanup equ DOM + 0100h * 45 ; debugger hook - remove all handlers for a selector 258 <1> F_DFlagGet equ DOM + 0100h * 46 ; get Domain Flags 259 <1> F_DFlagSet equ DOM + 0100h * 47 ; set Domain Flags 260 <1> F_DSwitchHandler equ DOM + 0100h * 48 ; Install domain switch handler 261 <1> F_GIOExHandler equ DOM + 0100h * 49 ; Install Global I/O Exception handler 262 <1> 263 <1> ;------------ 264 <1> 265 <1> ; VM Functions 266 <1> 267 <1> F_VMProtInit equ VM + 0100h * 00 ; Protected Mode initialisation internal) 268 <1> 269 <1> F_LoadMT equ VM + 0100h * 01 ; Load MultiTasking 270 <1> F_UnloadMT equ VM + 0100h * 02 ; Unload MultiTasking 271 <1> F_ConsoleFree equ VM + 0100h * 03 ; Save Console if enabled, then free it 272 <1> F_ConsoleGet equ VM + 0100h * 04 ; Get Console, then restore if enabled 273 <1> F_ConsoleSaveEnable equ VM +0100h * 05 ; Enable Console save/restore 274 <1> F_ConsoleSaveDisable equ VM +0100h * 06 ; Disable Console save/restore 275 <1> 276 <1> F_TMInit equ VM + 0100h * 07 ; Task Manager Init 277 <1> F_GetKey equ VM + 0100h * 08 ; Domain Manager to Keyboard Handler 278 <1> F_KeyScanEnable equ VM + 0100h * 09 ; Enable hotkey scanning 279 <1> F_KeyScanDisable equ VM + 0100h * 10 ; Disable hotkey scanning 280 <1> F_ConsoleOwner equ VM + 0100h * 11 ; Get console owner domain id 281 <1> F_DMAHandlerEnable equ VM + 0100h * 12 ; Re-enable DMA address translation 282 <1> F_DMAHandlerDisable equ VM + 0100h * 13 ; Disable DMA address translation 283 <1> F_SetSerialTimeout equ VM + 0100h * 14 ; Set Serial Port Timeout 284 <1> F_SetParallelTimeout equ VM+ 0100h * 15 ; Set Parallel Port Timeout 285 <1> F_VCPIEntry equ VM + 0100h * 16 ; Domain is going into VCPI mode 286 <1> F_VCPIExit equ VM + 0100h * 17 ; Domain has probably come out of VCPI mode 287 <1> F_SetGlobalMsgMode equ VM + 0100h * 18 ; Enter global message display mode 288 <1> F_DisplayGlobalMsg equ VM + 0100h * 19 ; Ditto, plus display message 289 <1> F_ExitGlobalMsgMode equ VM + 0100h * 20 ; Exit global message display mode 290 <1> F_SetDomainMsgMode equ VM + 0100h * 21 ; Enter domain message display mode 291 <1> F_DisplayDomainMsg equ VM + 0100h * 22 ; Ditto, plus display message 292 <1> F_ExitDomainMsgMode equ VM + 0100h * 23 ; Exit domain message display mode 293 <1> F_DisplayFatalMsg equ VM + 0100h * 24 ; Display fatal message 294 <1> F_SetSerialBase equ VM + 0100h * 25 ; Set Serial port base address 295 <1> F_SetParallelBase equ VM + 0100h * 26 ; Set Parallel port base address 296 <1> F_SetSerialIRQ equ VM + 0100h * 27 ; Set Serial port IRQ number 297 <1> F_SetParallelIRQ equ VM + 0100h * 28 ; Set Parallel port IRQ number 298 <1> F_ResetVideo equ VM + 0100h * 29 ; EMERGENCY reset of the video system 299 <1> F_SetMouseIRQ equ VM + 0100h * 30 ; Set mouse IRQ 300 <1> F_CheckNotIdle equ VM + 0100h * 31 ; Check if we are idle or not 301 <1> F_GetMouseInfo equ VM + 0100h * 32 302 <1> F_GetSerialOwner equ VM + 0100h * 33 303 <1> F_GetSerialTimeout equ VM + 0100h * 34 304 <1> F_GetParallelOwner equ VM + 0100h * 35 305 <1> F_GetParallelTimeout equ VM+ 0100h * 36 306 <1> 307 <1> LAST_VM_FUNC equ 36 308 <1> 309 <1> ;------------ 310 <1> 311 <1> ; DPMI Functions 312 <1> 313 <1> ; These "DPMI" functions are those that are provided by the DPMI module via the 314 <1> ; Vladivar interface. True DPMI functions should be accessed via int 31h as per 315 <1> ; the DPMI spec. 316 <1> 317 <1> F_InitDPMI equ DPMI + 0100h * 0 ; used internally by DPMI. Do not call. 318 <1> F_DescAllocLDT equ DPMI + 0100H * 1 ; allocate an LDT descriptor 319 <1> F_DescFreeLDT equ DPMI + 0100H * 2 ; free an LDT descriptor 320 <1> F_DescGetLDT equ DPMI + 0100H * 3 ; same as F_DescGet, but for LDT 321 <1> F_DescSetLDT equ DPMI + 0100H * 4 ; same as F_DescSet, but for LDT 322 <1> F_DescAllocInt21 equ DPMI + 0100H * 5 ; allocate an LDT descriptor for pmode 323 <1> ; int 21 memory allocation. 324 <1> F_WhereIsDPMI equ DPMI + 0100H * 6 ; return address of DPMI global data 325 <1> 326 <1> LAST_DPMI_FUNC equ 6 327 <1> 67 68 TRUE equ 0FFFFh ; value of TRUE 69 FALSE equ 0 ; value of FALSE 70 71 ; 72 ; Equates for INIT_FLAGS which can be modified by the BIOS 73 ; the default is a RAM based BDOS (Code and Data) with INIT_DRV 74 ; specifing the default drive and the initial drive for COMSPEC 75 ; 76 77 INIT_ROMCODE equ 0001h ; Rom based DOS CODE 78 INIT_COMSPEC equ 0002h ; COMSPEC_DRV specifies the default 79 ; Command Processor Drive 80 INIT_WINDOWS equ 0004h ; Disable windows support 81 82 COMMAND_BASE equ 000E0h ; must cover FFFF:D0 for CALL5 fixup 83 COMMAND_SIZE equ 01FA0h 84 85 group CGROUP CODE INITCODE INITDATA INITPSP INITENV DATAEND 86 ASSUME CS:CGROUP,DS:CGROUP 87 === Switch to base=000000h -> "CODE" 88 section CODE public align=2 class=CODE 89 CODE ends 90 91 ; 92 ; The DOS Code Segment is formatted as follows. 93 ; 94 labelsize DOS_OFFSET, word, 0008h ; Offset of code in segment 95 labelsize HISTORY_CODE, word, 000Ch ; Start of history code 96 labelsize INIT_CODE, word, 000Eh ; Start of initialisation code 97 labelsize DOS_FLAG, word, 001Ch ; Compressed Data Flag 98 labelsize DOS_CODE, word, 001Eh ; DOS Code Length (Bytes) 99 labelsize DOS_DATA, word, 0020h ; DOS Data Length (Bytes) 100 labelsize NO_YES_CHARS, word, 0028h ; DOS Data No/Yes characters 101 102 labelsize INT31_SEGMENT, word, 00C6h ; DOS Data Segment pointer 103 ; for ROM systems 104 JMPF_OPCODE equ 0EAh ; 8086 JMPF instruction 105 106 ;F5KEY equ 3F00h 107 ;F8KEY equ 4200h 108 109 SWITCH_F equ 01h 110 SWITCH_N equ 02h 111 112 %if SVARDOS 113 extrn kernflg:byte 114 %endif 115 extrn oldxbda:word 116 extrn newxbda:word 117 extrn xbdalen:word 118 extrn oldmemtop:word 119 === Switch to base=000000h -> "INITCODE" 120 section INITCODE public align=16 class=INITCODE 121 extrn cleanup:near ; BIOS Clean Up routine 122 extrn config_init:near ; CONFIG Code Init 123 extrn config_finish:near ; Update DOS with Device Info 124 extrn config:near ; CONFIG.SYS Processor 125 extrn crlf:near ; Output CR/LF to screen 126 extrn resident_device_init:near ; Device Driver Init 127 extrn setup_ldt:near 128 extrn setup_stacks:near 129 extrn detect_boot_drv:near 130 extrn dos_version_check:near 131 extrn dos_load_panic:near 132 %if SVARDOS 133 %if SINGLEFILE eq 0 134 extrn read_dos:near ; load DOS file 135 %endif 136 %endif 137 extrn preload_done:near 138 139 copyright: 140 %if SVARDOS 141 %include "svarver.mac" 142 db COPYRIGHT_STR 143 db 0 144 %else 0 00004F00 436F70797269676874 db 'Copyright (c) 1983,1996 ' 0 00004F09 202863292031393833 0 00004F12 2C3139393620 0 00004F18 43616C646572612C20 db 'Caldera, Inc. All Rights Reserved ' 0 00004F21 496E632E20416C6C20 0 00004F2A 526967687473205265 0 00004F33 73657276656420 0 00004F3A 585858582D30303030 db 'XXXX-0000-987654321X ' 0 00004F43 2D3938373635343332 0 00004F4C 315820 148 0 00004F4F 506174636865732074 db 'Patches to original OpenDOS source code ' 0 00004F58 6F206F726967696E61 0 00004F61 6C204F70656E444F53 0 00004F6A 20736F757263652063 0 00004F73 6F646520 0 00004F77 436F70797269676874 db 'Copyright (c) 2002-2011 Udo Kuhnt' 0 00004F80 202863292032303032 0 00004F89 2D323031312055646F 0 00004F92 204B75686E74 151 %endif 152 153 154 Public biosinit 155 ;======== 156 biosinit: 157 ;======== 158 ; entry: MEM_SIZE = memory size in paragraphs 159 ; DEVICE_ROOT = address of 1st resident device driver 160 ; INIT_DRV = boot drive (0 = A:, 1 = B:, etc.) 161 ; INIT_BUF = minimum # of disk buffers 162 ; CURRENT_DOS = code segment of DOS (if loaded) 163 ; INIT_FLAGS = Control Flags 164 ; COMSPEC_DRV = Drive for Command Processor 165 ; 166 ; 167 ; we set up the following variables 168 ; BIOS_SEG = low memory BIOS code/data (static) 169 ; DOS_DSEG = low memory DOS data area (static) 170 ; RCODE_SEG = relocated BIOS code segment 171 ; DOS_CSEG = relocated DOS code segment 172 ; INIT_DSEG = segment based initialisation data 173 ; 0 00004F98 FC cld 0 00004F99 FA cli 0 00004F9A 8CC8 mov ax,cs ; Initialise our stack and Data Segment 0 00004F9C 8ED8 mov ds,ax 178 %if SVARDOS eq 0 0 00004F9E 8F06[0000] pop word [drdosseg] ; drkernpl ax 0 00004FA2 8F06[0200] pop word [drdoslen] ; drkernpl si 0 00004FA6 8F06[0000] pop word [part_off] ; pushed at init from BPB hidden sectors 0 00004FAA 8F06[0200] pop word [part_off+2] 183 %endif 0 00004FAE 8ED0 mov ss,ax 0 00004FB0 BC[7604] mov sp,offset stack 0 00004FB3 FB sti 187 0 00004FB4 A3[5100] mov [bios_seg],ax ; Save the BIOS Segment 189 190 ; Now some code which allows Remote Program Loader to reserve some memory 191 ; which will be safe from being trampled on by the system. 192 ; The RPL takes over Int 2F and has a magic signature "RPL" at offset 3 from 193 ; it's entry point. If this is detected an Int2f is issued 194 ; 195 ; On Entry: 196 ; AX = 4A06, DX = Segment address of top of memory 197 ; On Exit: 198 ; DX = segment address of the RPL 199 ; 200 ; On return the system will build a DMD entry for the RPL, with an owner field 201 ; of 8 (ie. System). The RPL can poke this entry to 0 when it wishes to free 202 ; the memory. 203 ; 204 ; In addition we now look for "RPLOADER", and if found we remember the address 205 ; of the entry point so we can call it with status information 206 0 00004FB7 8B16[2C00] mov dx,[mem_size] ; get existing size 0 00004FBB 4A dec dx ; one para less for upper mem DMD link 0 00004FBC 31C0 xor ax,ax 0 00004FBE 8EC0 mov es,ax ; point to vectors 0 00004FC0 BBBC00 mov bx,4*2fh ; we want Int 2F vector 0 00004FC3 26C41F les bx,[es:bx] ; pick up the contents 0 00004FC6 8D7F03 lea di,[3 + bx] ; point to magic signature "RPL" 0 00004FC9 BE[4300] mov si,offset rpl_name 0 00004FCC B90300 mov cx,3 0 00004FCF F3A6 repe cmpsb ; does the signature match ? 0 00004FD1 7546 jne biosinit20 0 00004FD3 B90500 mov cx,5 ; look also for "RPLOADER" 0 00004FD6 F3A6 repe cmpsb 0 00004FD8 7508 jne biosinit10 0 00004FDA 891E[4B00] mov [rpl_off],bx ; save entry point for use later 0 00004FDE 8C06[4D00] mov [rpl_seg],es 223 biosinit10: 0 00004FE2 B8064A mov ax,4a06h ; magic number for RPL 0 00004FE5 CD2F int 2fh ; does anyone want to steal memory ? 0 00004FE7 42 inc dx 0 00004FE8 3B16[2C00] cmp dx,[mem_size] ; is memory size unchanged ? 0 00004FEC 732B jnb biosinit20 0 00004FEE 4A dec dx ; point back at start of memory 0 00004FEF 4A dec dx ; then one below for DMD start 0 00004FF0 8EC2 mov es,dx ; ES points to DMD 0 00004FF2 26C60600005A mov byte [es:DMD_ID],IDZ ; make it last in the chain 0 00004FF8 26C70601000800 mov word [es:DMD_PSP],8 ; owned by system 0 00004FFF 8D3E0800 lea di,[DMD_NAME] ; point to name field 0 00005003 BE[4300] mov si,offset rpl_name 0 00005006 B90400 mov cx,(lengthof_rpl_name)/2 0 00005009 F3A5 rep movsw ; initialise name field too 0 0000500B 42 inc dx ; skip the DMD for real top 0 0000500C 8716[2C00] xchg dx,[mem_size] ; replace memory size with new value 0 00005010 2B16[2C00] sub dx,[mem_size] ; whats the difference ? 0 00005014 2689160300 mov [es:DMD_LEN],dx ; save it's this length 242 biosinit20: 243 244 ; End of RPL support 0 00005019 A1[2C00] mov ax,[mem_size] ; get top of memory 0 0000501C 2D0018 sub ax,MOVE_DOWN 0 0000501F A3[5D00] mov [mem_max],ax ; last available paragraph 248 0 00005022 A3[5300] mov [init_dseg],ax ; initialisation data lives here 0 00005025 B104 mov cl,4 0 00005027 BA9F39 mov dx,DYNAMIC_DATA_END+15 0 0000502A D3EA shr dx,cl ; we need this much dynamic data 0 0000502C 01D0 add ax,dx 254 255 ; Now we try to relocate the BIOS 0 0000502E 8B16[1600] mov dx,[rcode_len] ; we want to keep this much BIOS code 0 00005032 0116[2200] add [systemSize],dx ; so add to reserved space in HMA 0 00005036 8B16[1400] mov dx,[icode_len] ; how much do we want to move ? 0 0000503A D3EA shr dx,cl 0 0000503C 741D jz biosinit30 ; if ROMed we have nothing to relocate 0 0000503E A3[1200] mov [rcode_seg],ax ; relocated BIOS lives here 0 00005041 01D0 add ax,dx ; remember how much we allocated 0 00005043 8B16[1000] mov dx,[rcode_offset] 0 00005047 89D6 mov si,dx 0 00005049 89D7 mov di,dx 0 0000504B D3EA shr dx,cl ; DX = para offset of data 0 0000504D 2916[1200] sub [rcode_seg],dx ; adjust our segment value 0 00005051 8E06[1200] mov es,[rcode_seg] 0 00005055 8B0E[1400] mov cx,[icode_len] 0 00005059 F3A4 rep movsb ; copy it up 271 biosinit30: 0 0000505B A3[6100] mov [dos_cseg],ax ; a relocated DOS image will live here 273 274 ; Move BDOS to dos_cseg segment if we have combined BIO/BDIOS file 275 %if SVARDOS 276 %if SINGLEFILE 277 push ds 278 mov [current_dos],ax ; prevent relocated_init from 279 mov es,ax ; trying to load BDOS file 280 mov ax,offset DATAEND_start wrt CGROUP ; calculate paragraphs 281 mov cl,4 ; of BDOS into the kernel file... 282 shr ax,cl 283 push cs 284 pop si 285 add ax,si ; ... and add kernel load segment to 286 mov ds,ax ; get absolute BDOS segment 287 xor si,si 288 xor di,di 289 mov cx,[DOS_CODE] ; get code and data size from BDOS 290 add cx,[DOS_DATA] ; header 291 inc cx 292 shr cx,1 293 rep movsw ; move it 294 pop ds 295 %endif ; SINGLEFILE 296 %else ; SVARDOS 0 0000505E 1E push ds 0 0000505F 8B0E[0200] mov cx, [drdoslen] 0 00005063 8E1E[0000] mov ds, [drdosseg] 0 00005067 31F6 xor si, si 0 00005069 8EC0 mov es, ax 0 0000506B 31FF xor di, di 0 0000506D F3A4 rep movsb 0 0000506F 1F pop ds 305 %endif ; SVARDOS 306 0 00005070 B8[2000] mov ax,offset biosinit_end+32 0 00005073 B104 mov cl,4 ; Leave the Last Paragraph Free for 0 00005075 D3E8 shr ax,cl ; himem DMD 0 00005077 F7D8 neg ax ; Calculate the destination 0 00005079 0306[2C00] add ax,[mem_size] ; Segment for the BIOS relocation 312 0 0000507D B9[0000] mov cx,offset biosinit_end ; Relocate the BIOSINIT code to 0 00005080 BE[9800] mov si,offset biosinit ; the top of available memory 0 00005083 89F7 mov di,si 0 00005085 29F1 sub cx,si ; Size of BIOSINIT 0 00005087 8EC0 mov es,ax ; Initialize ES and copy CX words 0 00005089 F3A4 rep movsb 319 0 0000508B 06 push es ; fiddle RETF to relocated code 0 0000508C B8[9102] mov ax,offset relocated_init 0 0000508F 50 push ax 0 00005090 CB retf 324 ; 325 ; Generic BIOS INIT Patch area 326 ; 327 ; include i:patch.cod 0 00005091 909090909090909090 db 256 dup (90h) 0 0000509A 909090909090909090 0 000050A3 909090909090909090 0 000050AC 909090909090909090 0 000050B5 909090909090909090 0 000050BE 909090909090909090 0 000050C7 909090909090909090 0 000050D0 909090909090909090 0 000050D9 909090909090909090 0 000050E2 909090909090909090 0 000050EB 909090909090909090 0 000050F4 909090909090909090 0 000050FD 909090909090909090 0 00005106 909090909090909090 0 0000510F 909090909090909090 0 00005118 909090909090909090 0 00005121 909090909090909090 0 0000512A 909090909090909090 0 00005133 909090909090909090 0 0000513C 909090909090909090 0 00005145 909090909090909090 0 0000514E 909090909090909090 0 00005157 909090909090909090 0 00005160 909090909090909090 0 00005169 909090909090909090 0 00005172 909090909090909090 0 0000517B 909090909090909090 0 00005184 909090909090909090 0 0000518D 90909090 329 ; 330 ; BIOSINIT CODE and DATA have now been relocated to high memory 331 ; 332 relocated_init: 0 00005191 8CC8 mov ax,cs 0 00005193 FA cli 0 00005194 8ED0 mov ss,ax 0 00005196 BC[7604] mov sp,offset stack 0 00005199 FB sti 0 0000519A 8ED8 mov ds,ax ; All Segment registers now point 0 0000519C 8EC0 mov es,ax ; to the relocated BIOSINIT 340 341 0 0000519E E8[0000] call config_init ; initialize setup module 0 000051A1 E8E90A call dd_fixup ; fixup relocatable device drivers 0 000051A4 C43E[2800] les di,[device_root] ; initialize all the resident 0 000051A8 E8[0000] call resident_device_init ; device drivers 0 000051AB 0E push cs 0 000051AC 07 pop es 348 0 000051AD BA0100 mov dx,1 ; phase one of RPL initialisation 0 000051B0 E8430B call rploader ; inform RPLoader if present 0 000051B3 E8650B call Verify386 ; CY set if not a 386 0 000051B6 A1[5B00] mov ax,[mem_current] ; get ending address returned by BIOS 0 000051B9 7208 jc dont_align 0 000051BB 3D0001 cmp ax,0100h 0 000051BE 7303 jae dont_align ; lets be 4 KByte aligned to benefit 0 000051C0 B80001 mov ax,0100h ; the multi tasker (386 or above) 357 dont_align: 0 000051C3 A3[6300] mov [free_seg],ax ; and save as first Free Segment 359 %if SVARDOS 360 test word [init_flags],INIT_ROMCODE ; ROM boot: no boot drv detection 361 jnz skip_boot_drv_detection 362 call detect_boot_drv 363 skip_boot_drv_detection: 364 %if SINGLEFILE eq 0 365 cmp word [current_dos],0 ; does the OEM want us to read 366 jnz dos_reloc ; the DOS file from disk? 367 mov ax,[dos_cseg] 368 mov [current_dos],ax ; the file is held on the INIT_DRV with 369 call read_dos ; the name specified in DOS_NAME 370 %endif 371 %else 0 000051C6 E8[0000] call detect_boot_drv 373 0 000051C9 833E[1A00]00 cmp word [current_dos],0 ; does the OEM want us to read 0 000051CE 7506 jnz dos_reloc ; the DOS file from disk? 0 000051D0 A1[6100] mov ax,[dos_cseg] 0 000051D3 A3[1A00] mov [current_dos],ax ; the file is held on the INIT_DRV with 378 %endif 379 ; 380 ; The following code will relocate the DOS code. 381 ; 382 dos_reloc: 383 ; 384 ; We now move the DOS data to low memory 385 ; 0 000051D6 A1[1A00] mov ax,[current_dos] 0 000051D9 A3[6100] mov [dos_cseg],ax ; Update the DOS Code Segment 0 000051DC 8ED8 mov ds,ax 389 0 000051DE B104 mov cl,4 391 0 000051E0 A11E00 mov ax,[DOS_CODE] ; get size of DOS code 0 000051E3 2E0106[2200] add [cs:systemSize],ax ; and add to the system size 0 000051E8 D3E8 shr ax,cl ; convert to para's 0 000051EA 2EA3[2000] mov [cs:dosCodeParaSize],ax ; save for EMM386.SYS 396 0 000051EE A10800 mov ax,[DOS_OFFSET] ; remember we have padding 0 000051F1 2E0106[5F00] add [cs:dos_coff],ax ; and adjust DOS init offset 0 000051F6 D3E8 shr ax,cl ; also adjust DOS segment 0 000051F8 2E2906[6100] sub [cs:dos_cseg],ax ; to account for padding 401 0 000051FD 31C0 xor ax,ax 0 000051FF 8EC0 mov es,ax ; ES -> interrupt vectors 0 00005201 A12000 mov ax,[DOS_DATA] ; get # of bytes of DOS data 0 00005204 2EA3[7704] mov [cs:dosdata_len],ax 0 00005208 83C00F add ax,15 0 0000520B D3E8 shr ax,cl ; get para size of DOS data 0 0000520D 2E2906[5D00] sub [cs:mem_max],ax 0 00005212 2EA1[5D00] mov ax,[cs:mem_max] 410 ; xchg ax,cs:free_seg ; get seg for DOS data 411 ; add cs:free_seg,ax ; remember how much we used 0 00005216 26A3C600 mov [es:INT31_SEGMENT],ax ; update the segment value of INT31 0 0000521A 8EC0 mov es,ax ; so ROMMED systems can find PCM_DSEG 0 0000521C 2EA3[5500] mov [cs:dos_dseg],ax ; we need to remember where too... 415 0 00005220 8B361E00 mov si,[DOS_CODE] ; offset of DOS Data 0 00005224 31FF xor di,di ; destination offset 418 0 00005226 F7061C000100 test word [DOS_FLAG], 1 ; has the DOS Data been compressed 0 0000522C 7508 jnz dos_r20 ; yes so call the decompress routine 0 0000522E 8B0E2000 mov cx,[DOS_DATA] ; otherwise just copy the data. 0 00005232 F3A4 rep movsb 0 00005234 EB1B jmp short dos_r40 424 425 ; 426 ; This routine will decompress the DOS data area which has 427 ; been compressed after linking using Andy Wightmans data 428 ; compression algorithm. 429 ; 430 dos_r20: 431 %if compressdrdos eq 0 432 jmp dos_load_panic 433 %else 0 00005236 AD lodsw ; get control word 0 00005237 89C1 mov cx,ax ; as a count 0 00005239 E316 jcxz dos_r40 ; all done 0 0000523B F7C10080 test cx,8000h ; negative ? 0 0000523F 7504 jnz dos_r30 ; yes do zeros 0 00005241 F3A4 rep movsb ; else move in data bytes 0 00005243 EBF1 jmp short dos_r20 ; and to the next 441 442 dos_r30: 0 00005245 81E1FF7F and cx,7fffh ; remove sign 0 00005249 E3EB jcxz dos_r20 ; none to do 0 0000524B 31C0 xor ax,ax 0 0000524D F3AA rep stosb ; fill with zeros 0 0000524F EBE5 jmp short dos_r20 448 %endif 449 450 dos_r40: 0 00005251 0E push cs 0 00005252 1F pop ds 0 00005253 0E push cs 0 00005254 07 pop es 455 0 00005255 8A0E[0000] mov cl,[dev_count] 0 00005259 880E[7604] mov [res_dev_count],cl 0 0000525D B104 mov cl,4 ; reserve space for resident DDSC's 0 0000525F B84100 mov ax,DDSC_LEN 0 00005262 F626[0000] mul byte [dev_count] ; AX byte are required 0 00005266 83C00F add ax,15 0 00005269 D3E8 shr ax,cl ; AX para are required 0 0000526B 2906[5D00] sub [mem_max],ax 0 0000526F A1[5D00] mov ax,[mem_max] 465 ; xchg ax,free_seg 466 ; add free_seg,ax ; we have allocated the space 0 00005272 A3[0E00] mov [res_ddsc_seg],ax ; point res_ddsc_ptr at the space 0 00005275 8B16[5500] mov dx,[dos_dseg] 0 00005279 29D0 sub ax,dx ; DOS resident DDSC_'s use DOS data seg 0 0000527B 3D0010 cmp ax,1000h ; surely we must fit ? 0 0000527E 7309 jae dos_r50 0 00005280 D3E0 shl ax,cl ; offset within pcmode data segment 0 00005282 A3[0C00] mov [res_ddsc_off],ax 0 00005285 8916[0E00] mov [res_ddsc_seg],dx ; setup pointer to resident DDSC's 475 dos_r50: 476 0 00005289 A1[6300] mov ax,[free_seg] ; reserve space for interrupt stubs 0 0000528C A3[7904] mov [int_stubs_seg],ax 0 0000528F 8306[6300]0B add word [free_seg],11 480 481 ; 482 ; Call the DOS INIT Code passing all the information setup 483 ; by the BIOS. 484 ; 0 00005294 A1[2C00] mov ax,[mem_size] ; pass the Memory Size, the first free 0 00005297 8B1E[6300] mov bx,[free_seg] ; segment and the initial 0 0000529B 8A16[3200] mov dl,[init_drv] ; drive to the DOS init routine 0 0000529F 8E06[7904] mov es,[int_stubs_seg] 0 000052A3 FA cli 0 000052A4 8E1E[5500] mov ds,[dos_dseg] ; DS -> DOS data segment 0 000052A8 2EFF1E[5F00] call far [cs:dos_init] 492 493 ; mov es,cs:dos_dseg 494 ; mov bx,26h ; ES:BX -> list of lists 495 ; mov ax,es:word ptr F52_FCBPTR[bx] 496 ; shr ax,1 ! shr ax,1 497 ; shr ax,1 ! shr ax,1 498 ; and es:word ptr F52_FCBPTR[bx],15 499 ; add es:word ptr F52_FCBPTR+2[bx],ax 0 000052AD FB sti 0 000052AE 0E push cs 0 000052AF 1F pop ds 0 000052B0 8E06[1A00] mov es,[current_dos] ; internationalise the yes/no chars 0 000052B4 268B3E2800 mov di,[es:NO_YES_CHARS] 0 000052B9 8E06[5500] mov es,[dos_dseg] ; ES:DI -> internal table 0 000052BD A1[0000] mov ax,word ptr [no_char] 0 000052C0 AB stosw ; replace default no chars 0 000052C1 A1[0000] mov ax,word ptr [yes_char] 0 000052C4 AB stosw ; replace default yes chars 0 000052C5 0E push cs 0 000052C6 07 pop es 0 000052C7 8306[5F00]03 add word [dos_coff],3 ; next dos_init call just fixes up 513 ; segment relocations 514 0 000052CC BA0200 mov dx,2 ; phase two of RPL initialisation 0 000052CF E8240A call rploader ; inform RPLoader if present 517 0 000052D2 E8F200 call config_start ; get free memory 0 000052D5 E8[0000] call config ; read and process CONFIG.SYS 0 000052D8 E89901 call config_end ; relocate DOS code and free memory 521 0 000052DB B8023D mov ax,(MS_X_OPEN*256)+2 ; Open for Write 0 000052DE BA[7E00] mov dx,offset idle_dev ; Get the IDLE Device Name# 0 000052E1 CD21 int DOS_INT ; Open the device 0 000052E3 721D jc dos_r70 ; Quit on Error 0 000052E5 50 push ax ; Save the Handle 0 000052E6 B85844 mov ax,4458h ; Get the address of the IDLE data 0 000052E9 CD21 int DOS_INT ; area in ES:AX 0 000052EB 5B pop bx ; Restore the Handle 0 000052EC A3[8500] mov [idle_off],ax ; Save the data area offset and 0 000052EF 8C06[8700] mov [idle_seg],es ; segment 0 000052F3 B80344 mov ax,4403h 0 000052F6 BA[8500] mov dx,offset idle_off 0 000052F9 B90400 mov cx,4 0 000052FC CD21 int DOS_INT 0 000052FE B43E mov ah,MS_X_CLOSE 0 00005300 CD21 int DOS_INT 538 539 dos_r70: 0 00005302 E8B408 call mark_system_memory ; ensure any memory we have allocated 541 ; is marked as system 0 00005305 C706[4F00][0000] mov word [bios_offset],offset cleanup 0 0000530B FF1E[4F00] call far [bios] ; execute BIOS cleanup code 544 0 0000530F B80358 mov ax,(MS_M_STRATEGY*256)+3 0 00005312 31DB xor bx,bx ; unlink in upper memory region 0 00005314 CD21 int 21h 548 0 00005316 BA0300 mov dx,3 ; phase three of RPL initialisation 0 00005319 E8DA09 call rploader ; inform RPLoader if present 551 0 0000531C B8FF12 mov ax,12ffh ; magic cleanup call to MemMAX 0 0000531F BB0500 mov bx,5 ; to do any tidy ups it wishes 0 00005322 31C9 xor cx,cx 0 00005324 31D2 xor dx,dx 0 00005326 CD2F int 2fh 557 0 00005328 0E push cs 0 00005329 07 pop es 560 load_e10: 561 ; expand shell filename to absolute path 0 0000532A BE[0200] mov si,offset shell 0 0000532D 89F7 mov di,si 0 0000532F 1E push ds 0 00005330 07 pop es 0 00005331 B460 mov ah,MS_X_EXPAND 0 00005333 CD21 int DOS_INT 0 00005335 721D jc shell_error 569 0 00005337 E8F509 call add_comspec_to_env ; append / update COMSPEC in config env 571 %if BIO_SEG ge 70h 572 ; relocate config environment to segment 60 if kernel is not in the way 0 0000533A E84A0A call copy_config_env_to_seg60 574 %endif 0 0000533D B8004B mov ax,(MS_X_EXEC * 256)+0 ; Exec the Command Processor 0 00005340 BB[9500] mov bx,offset exec_env ; Get the Parameter Block Address 0 00005343 BA[0200] mov dx,offset shell ; and the Command Processor 0 00005346 8C1E[9900] mov [exec_clseg],ds 0 0000534A 8C1E[9D00] mov [exec_fcb1seg],ds 0 0000534E 8C1E[A100] mov [exec_fcb2seg],ds 0 00005352 CD21 int DOS_INT ; Go for it 582 583 shell_error: 0 00005354 B409 mov ah,MS_C_WRITESTR ; Print an error message and wait for 0 00005356 BA[0000] mov dx,offset bad_exec ; the user to enter new name 0 00005359 CD21 int DOS_INT 0 0000535B B40A mov ah,MS_C_READSTR ; get user to input new COMMAND 0 0000535D BA[0000] mov dx,offset shell_ask ; location 0 00005360 CD21 int DOS_INT 0 00005362 E8[0000] call crlf ; tidy up with CR/LF 0 00005365 31DB xor bx,bx 0 00005367 8A1E[0100] mov bl,[shell_end] 0 0000536B 88BF[0200] mov [shell + bx],bh ; replace CR with NULL 0 0000536F EBB9 jmp short load_e10 595 596 597 Public get_boot_options 598 get_boot_options: 599 ;---------------- 600 ; On Entry: 601 ; None 602 ; On Exit: 603 ; AX = boot options 0 00005371 E81600 call option_key ; poll keyboard for a while 0 00005374 7513 jnz get_boot_options20 ; if key available return that 0 00005376 F606[0000]02 test byte [boot_switches],SWITCH_N ; boot keys disabled? 0 0000537B 750C jnz get_boot_options20 ; then do not check shift key, either 0 0000537D B402 mov ah,2 ; else ask ROS for shift state 0 0000537F CD16 int 16h 0 00005381 83E003 and ax,3 ; a SHIFT key is the same as F5KEY 0 00005384 7403 jz get_boot_options20 0 00005386 B8003F mov ax,F5KEY ; ie. bypass everything 613 get_boot_options20: 0 00005389 C3 ret 615 616 option_key: 617 ;---------- 618 ; On Entry: 619 ; None 620 ; On Exit: 621 ; AX = keypress if interesting (F5/F8) 622 ; ZF clear if we have an interesting key 623 ; 624 ; Poll keyboard looking for a key press. We do so for a maximum of 36 ticks 625 ; (approx 2 seconds). 626 ; 0 0000538A 31C0 xor ax,ax 0 0000538C CD1A int 1Ah ; get ticks in DX 0 0000538E 89D1 mov cx,dx ; save in CX for later 630 option_key10: 0 00005390 51 push cx 0 00005391 B401 mov ah,1 0 00005393 CD16 int 16h ; check keyboard for key 0 00005395 59 pop cx 0 00005396 7517 jnz option_key30 ; stop if key available 0 00005398 F606[0000]01 test byte [boot_switches],SWITCH_F ; SWITCHES /F present? 0 0000539D 750D jnz option_key20 ; yes, skip delay 0 0000539F 51 push cx 0 000053A0 31C0 xor ax,ax 0 000053A2 CD1A int 1Ah ; get ticks in DX 0 000053A4 59 pop cx 0 000053A5 29CA sub dx,cx ; work out elapsed time 0 000053A7 83FA24 cmp dx,36 ; more than 2 secs ? 0 000053AA 72E4 jb option_key10 645 option_key20: 0 000053AC 31C0 xor ax,ax ; timeout, set ZF, no key pressed 0 000053AE C3 ret 648 649 option_key30: 0 000053AF F606[0000]02 test byte [boot_switches],SWITCH_N ; boot keys disabled? 0 000053B4 75F6 jnz option_key20 ; yes, continue without reading it 0 000053B6 3D003F cmp ax,F5KEY ; if it is a key we want then 0 000053B9 7405 je option_key40 ; read it, else just leave 0 000053BB 3D0042 cmp ax,F8KEY ; in the type-ahead buffer 0 000053BE 75EC jne option_key20 656 option_key40: 0 000053C0 31C0 xor ax,ax 0 000053C2 CD16 int 16h ; read the key 0 000053C4 85C0 test ax,ax ; clear ZF to indicate we have a key 0 000053C6 C3 ret 661 662 ; 663 ; Initialise the PSP and inform DOS of the 664 ; location of the BIOSINIT PSP. The MS_P_SETPSP *MUST* be the first 665 ; INT21 function call because the PSP Address is used during the 666 ; entry code except when the INDOS flag is set and certain function 667 ; calls are made. 668 ; 669 ; Then open the Resident character devices so that the dynamically 670 ; devices can output messages to the screen etc. 671 ; 672 config_start: 0 000053C7 B104 mov cl,4 0 000053C9 8CDB mov bx,ds 0 000053CB B8[1000] mov ax,offset psp ; Now force DOS Plus to use the 0 000053CE D3E8 shr ax,cl ; internal PSP for all disk and 0 000053D0 01C3 add bx,ax ; character I/O 0 000053D2 891E[4600] mov [xftbl_seg],bx ; Update the Handle Table Pointer 0 000053D6 891E[2600] mov [parent_psp],bx ; and make this the root process 0 000053DA B450 mov ah,MS_P_SETPSP ; Set the current PSP 0 000053DC CD21 int DOS_INT 682 %if DOS5 0 000053DE B80633 mov ax,3306h 0 000053E1 CD21 int 21h ; get true version 0 000053E3 891E[5000] mov [dosVersion],bx ; and plant in initial PSP 686 %endif 0 000053E7 E8[0000] call dos_version_check ; make sure we are on correct DOS 688 0 000053EA B85844 mov ax,4458h 0 000053ED CD21 int DOS_INT ; we need to access local data 0 000053EF 891E[0800] mov [drdos_off],bx ; so save a pointer to it 0 000053F3 8C06[0A00] mov [drdos_seg],es 0 000053F7 A1[2E00] mov ax,[ext_mem_size] 0 000053FA 2689470B mov [es:DRDOS_EXT_MEM + bx],ax ; save extended memory size in DOS 0 000053FE B80052 mov ax,5200h 0 00005401 CD21 int DOS_INT 0 00005403 891E[0400] mov [func52_off],bx 0 00005407 8C06[0600] mov [func52_seg],es ; save pointer to internal data 699 %if DOS5 0 0000540B A1[2E00] mov ax,[ext_mem_size] 0 0000540E 26894745 mov [es:F52_EXT_MEM + bx],ax ; save extended memory size in DOS 702 %endif 0 00005412 B80803 mov ax,TEMP_LDT/16 ; use our temporary LDT's 0 00005415 0306[5300] add ax,[init_dseg] ; during system init 0 00005419 26C747160000 mov word [es:F52_PATHOFF + bx],0 ; point at the LDT's 0 0000541F 26894718 mov [es:F52_PATHSEG + bx],ax 0 00005423 0E push cs 0 00005424 07 pop es 709 0 00005425 B448 mov ah,MS_M_ALLOC ; Allocate all available memory 0 00005427 BBFFFF mov bx,0FFFFh ; BX is returned with the maximum 0 0000542A CD21 int DOS_INT ; available block size 713 0 0000542C B448 mov ah,MS_M_ALLOC 0 0000542E CD21 int DOS_INT 0 00005430 A3[5700] mov [mem_first_base],ax ; Base of 1st allocated block 0 00005433 A3[5900] mov [mem_current_base],ax ; Base of allocated memory 0 00005436 A3[5B00] mov [mem_current],ax ; Next available Segment 719 0 00005439 C606[0000]00 mov byte [configPass],0 0 0000543E E8[0000] call config_finish ; Update DOS with the information 722 ; obtained from loading the resident 723 ; drivers. 0 00005441 B40E mov ah,MS_DRV_SET ; Select the Default Drive 0 00005443 8A16[3200] mov dl,[init_drv] ; passed to us by the BIOS 0 00005447 CD21 int DOS_INT 727 0 00005449 B41A mov ah,MS_F_DMAOFF ; Initialise the DMA address for 0 0000544B BA[4B01] mov dx,offset search_state ; the Search First State data 0 0000544E CD21 int DOS_INT 731 0 00005450 A0[3200] mov al,[init_drv] ; get the boot drive then check 0 00005453 F706[3000]0200 test word [init_flags],INIT_COMSPEC ; flags to see if this is the 0 00005459 7403 jz config_s05 ; default COMSPEC drive. 0 0000545B A0[3400] mov al,[comspec_drv] 736 737 config_s05: 0 0000545E 0006[0200] add [shell],al ; update the drive letter of shell 0 00005462 0006[AC00] add [shell_drv],al ; and the reload path 740 0 00005466 E8FB00 call open_stdaux ; Open STDAUX as internal handle #0 0 00005469 E8DD00 call open_stdcon ; Open Standard CON Devices as #1 0 0000546C B43E mov ah,MS_X_CLOSE ; now close AUX again 0 0000546E BB0300 mov bx,STDAUX ; for CONFIG processing 0 00005471 CD21 int DOS_INT 0 00005473 C3 ret 747 748 749 ; 750 ; Relocate the DOS CODE from high memory to immediately above 751 ; the device drivers, buffers etc. Then call the DOS_CLEANUP code 752 ; so that any self segment pointers maintained in the DOS DATA 753 ; can be updated. Then free all the unused memory and reopen the 754 ; standard devices. 755 ; 756 config_end: 0 00005474 06 push es 0 00005475 A0[7100] mov al,[last_drv] ; get lastdrive value 0 00005478 C41E[0400] les bx,[func52_ptr] 0 0000547C 263A4720 cmp al,[es:F52_PHYDRV + bx] ; less than the # of Physical drives ? 0 00005480 7704 ja config_end10 0 00005482 268A4720 mov al,[es:F52_PHYDRV + bx] ; ensure minimum of # physical drives 763 config_end10: 0 00005486 26884721 mov [es:F52_LASTDRV + bx],al ; set # of drives installed 0 0000548A B104 mov cl,4 ; we will be converting byte-paras 0 0000548C B458 mov ah,LDT_LEN ; we need this many bytes per drive 0 0000548E F6E4 mul ah ; *lastdrive 0 00005490 83C00F add ax,15 ; round LDT's size up to para 0 00005493 D3E8 shr ax,cl 0 00005495 B24C mov dl,'L' ; allocate LDT's 0 00005497 8A36[0000] mov dh,[lastdrvIn] 0 0000549B E8AC05 call alloc_instseg ; Allocate memory AX is destination 773 0 0000549E 57 push di 0 0000549F 50 push ax 0 000054A0 91 xchg ax,cx 0 000054A1 B058 mov al,LDT_LEN 0 000054A3 268A6721 mov ah,[es:F52_LASTDRV + bx] 0 000054A7 80FC1A cmp ah,26 0 000054AA 7602 jbe config_end20 0 000054AC B41A mov ah,26 782 config_end20: 0 000054AE F6E4 mul ah 0 000054B0 91 xchg ax,cx 0 000054B1 1E push ds 0 000054B2 06 push es 0 000054B3 26C57716 lds si,[es:F52_PATHPTR + bx] 0 000054B7 8EC0 mov es,ax 0 000054B9 F3A4 rep movsb 0 000054BB 07 pop es 0 000054BC 1F pop ds 0 000054BD 58 pop ax 0 000054BE 5F pop di 794 0 000054BF 26897F16 mov [es:F52_PATHOFF + bx],di ; point at the LDT's 0 000054C3 26894718 mov [es:F52_PATHSEG + bx],ax ; save seg we just allocated 0 000054C7 07 pop es 798 799 ; call setup_ldt ; initialise LDT structures 800 0 000054C8 E8[0000] call setup_stacks ; allocate stacks 802 0 000054CB E8AE00 call relocate_system ; relocate system as requested 804 805 configpass equ configPass ; NASM port label 0 000054CE C606[0000]03 mov byte [configpass],3 0 000054D3 C706[0000]0000 mov word [cfg_head],0 0 000054D9 C706[0000]0000 mov word [cfg_tail],0 0 000054DF C706[0000]0000 mov word [cfg_seeklo],0 0 000054E5 C706[0000]0000 mov word [cfg_seekhi],0 0 000054EB E8[0000] call preload_done 812 0 000054EE 06 push es ; Free all of the unused memory 0 000054EF 8E06[5900] mov es,[mem_current_base] ; ES: Base Allocated Memory 0 000054F3 8B1E[5B00] mov bx,[mem_current] ; Get the currently allocated memory 0 000054F7 2B1E[5900] sub bx,[mem_current_base] ; and subtract mem_current_base to 0 000054FB B44A mov ah,MS_M_SETBLOCK ; give the number of paragraphs used 0 000054FD CD21 int DOS_INT ; and modify block accordingly 819 820 ; Kludge - if the CONFIG file has had a line of the form INSTALL= to load a TSR 821 ; then that TSR will have inherited the handles, so bumping the open count, but 822 ; the func 31 exit leaves all these files open. As a result we will get the 823 ; wrong internal file numbers unless we force complete closure. So we keep 824 ; trying to close each internal handle until we get an error. 825 0 000054FF B462 mov ah,MS_P_GETPSP 0 00005501 CD21 int DOS_INT ; get current PSP 0 00005503 8EC3 mov es,bx 0 00005505 268B0E3200 mov cx,[es:PSP_XFNMAX] ; Close all the standard handles 0 0000550A 26C43E3400 les di,[es:PSP_XFTPTR] ; and then reopen them in case a 0 0000550F BB0000 mov bx,0 ; dynamicly loadable device has 832 cfg_e10: ; replaced the BIOS driver 0 00005512 268A11 mov dl,[es:di+bx] ; save old internal handle 0 00005515 B43E mov ah,MS_X_CLOSE 0 00005517 CD21 int DOS_INT ; try and close this handle 0 00005519 268811 mov [es:di+bx],dl ; put the internal handle back 0 0000551C 73F4 jnc cfg_e10 ; and try and close it again 0 0000551E 26C601FF mov byte ptr [es:di+bx],0ffh 0 00005522 43 inc bx ; mark as closed and try next handle 0 00005523 E2ED loop cfg_e10 0 00005525 07 pop es 842 ;; jmp short open_std 843 844 open_std: 0 00005526 E83B00 call open_stdaux ; open AUX device as STDAUX 0 00005529 E81D00 call open_stdcon ; now STDIN, STDOUT, STDERR 847 ; jmp open_stdprn ; finally STDPRN 848 849 open_stdprn: 0 0000552C B8013D mov ax,(MS_X_OPEN * 256) + 1 0 0000552F BA[7600] mov dx,offset printer ; Open the PRN device 0 00005532 CD21 int DOS_INT 0 00005534 7212 jc open_sp10 ; No PRN device 0 00005536 83F804 cmp ax,STDPRN ; If all the previous Opens were 0 00005539 740D jz open_sp10 ; successful then this is STDPRN 0 0000553B 89C3 mov bx,ax ; otherwise force this to STDPRN 0 0000553D B90400 mov cx,STDPRN 0 00005540 B446 mov ah,MS_X_DUP2 0 00005542 CD21 int DOS_INT 0 00005544 B43E mov ah,MS_X_CLOSE 0 00005546 CD21 int DOS_INT 862 open_sp10: 0 00005548 C3 ret 864 865 open_stdcon: 0 00005549 B8023D mov ax,(MS_X_OPEN * 256) + 2 0 0000554C BA[7200] mov dx,offset console ; Open the CON device 0 0000554F CD21 int DOS_INT 0 00005551 7210 jc open_sc10 ; No CON device 0 00005553 89C3 mov bx,ax ; First Open should be STDIN 0 00005555 B90100 mov cx,STDOUT ; Force Duplicate to STDOUT 0 00005558 B446 mov ah,MS_X_DUP2 0 0000555A CD21 int DOS_INT 0 0000555C B90200 mov cx,STDERR ; Then Force Duplicate to STDERR 0 0000555F B446 mov ah,MS_X_DUP2 0 00005561 CD21 int DOS_INT 877 open_sc10: 0 00005563 C3 ret 879 880 open_stdaux: 0 00005564 B8023D mov ax,(MS_X_OPEN * 256) + 2 0 00005567 BA[7A00] mov dx,offset auxilary ; Open the AUX device 0 0000556A CD21 int DOS_INT ; to get internal handle 0 0 0000556C 720D jc open_sa10 ; No AUX device 0 0000556E 89C3 mov bx,ax ; Force DUP to STDAUX 0 00005570 B90300 mov cx,STDAUX 0 00005573 B446 mov ah,MS_X_DUP2 0 00005575 CD21 int DOS_INT 0 00005577 B43E mov ah,MS_X_CLOSE 0 00005579 CD21 int DOS_INT 891 open_sa10: 0 0000557B C3 ret 893 894 895 relocate_system: 0 0000557C 1E push ds 0 0000557D 06 push es 0 0000557E 833E[1C00]FF cmp word [dos_target_seg],0FFFFh ; is the OS going high ? 0 00005583 750F jne relocate_system10 0 00005585 E82B04 call SetupHMA ; make sure HMA chain is established 0 00005588 31C9 xor cx,cx 0 0000558A 870E[2400] xchg cx,[systemHMA] ; free up any space reserved for the OS 0 0000558E E84D07 call FreeHMA 0 00005591 E81607 call ReserveCommandHMA ; reserve space for COMMAND.COM 905 906 relocate_system10: 0 00005594 E88806 call reloc_bios ; move down relocatable drivers 0 00005597 E82100 call reloc_dos ; move DOS above drivers if RAM based 0 0000559A E88B00 call reloc_dosdata 0 0000559D E85901 call reloc_xbda 0 000055A0 31C9 xor cx,cx 0 000055A2 870E[2600] xchg cx,[commandHMA] 0 000055A6 E83507 call FreeHMA ; return command.com HMA space to pool 0 000055A9 FA cli 0 000055AA 8E06[7904] mov es,[int_stubs_seg] 0 000055AE 8E1E[5500] mov ds,[dos_dseg] ; DS -> DOS data segment 0 000055B2 2EFF1E[5F00] call far [cs:dos_init] ; (in case of CS relative fixups) 0 000055B7 FB sti 0 000055B8 07 pop es 0 000055B9 1F pop ds 0 000055BA C3 ret 922 923 reloc_dos: ; move DOS down to just above drivers 924 ;---------- 0 000055BB 1E push ds 0 000055BC 06 push es 0 000055BD F706[3000]0100 test word [init_flags],INIT_ROMCODE ; Run the DOS code in ROM 0 000055C3 7402 jz reloc_dos05 0 000055C5 EB5E jmp reloc_dos90 930 reloc_dos05: 0 000055C7 8E06[1A00] mov es,[current_dos] 0 000055CB 268B160800 mov dx,[es:DOS_OFFSET] 0 000055D0 268B0E1E00 mov cx,[es:DOS_CODE] ; get DOS code size in bytes 0 000055D5 A1[1C00] mov ax,[dos_target_seg] ; get DOS target 0 000055D8 83F8FF cmp ax,0FFFFh ; it it seg FFFF ? 0 000055DB 7507 jne reloc_dos10 937 ; mov es,current_dos 938 ; mov dx,es:DOS_OFFSET 0 000055DD E86003 call AllocHMA ; allocate CX bytes, offset < DX 0 000055E0 7335 jnc reloc_dos50 ; if we can use high memory 0 000055E2 31C0 xor ax,ax ; can't, so try auto-allocation 942 reloc_dos10: 0 000055E4 85C0 test ax,ax ; has a specific address been 0 000055E6 751A jnz reloc_dos40 ; specified ? 0 000055E8 51 push cx ; save DOS code size 0 000055E9 91 xchg ax,cx 0 000055EA B104 mov cl,4 0 000055EC D3E8 shr ax,cl ; convert to paragraphs 0 000055EE 59 pop cx 0 000055EF 803E[6900]00 cmp byte [hidos],0 ; do we want to relocate DOS ? 0 000055F4 7405 je reloc_dos20 ; no, allocate conventionally 0 000055F6 E81C05 call alloc_upper ; else allocate space for the DOS 0 000055F9 7307 jnc reloc_dos40 ; in upper memory if possible 954 reloc_dos20: 0 000055FB 8E06[1A00] mov es,[current_dos] ; if conventional memory we 956 ; mov ax,es:INIT_CODE ; can discard INIT code 957 ; cmp history_flg,0 ; is history enabled ? 958 ; jne reloc_dos30 959 ; mov ax,es:HISTORY_CODE ; no, discard history code as well 960 ;reloc_dos30: 961 ; push cx 962 ; add ax,15 963 ; mov cl,4 ; convert to paragraphs 964 ; shr ax,cl 965 ; pop cx 0 000055FF E8B504 call alloc_seg_with_padding ; allocate in conventional memory 967 reloc_dos40: 0 00005602 92 xchg ax,dx ; save segment address 0 00005603 8E06[1A00] mov es,[current_dos] ; point at code 0 00005607 26A10800 mov ax,[es:DOS_OFFSET] ; get offset of code start 0 0000560B 31FF xor di,di 0 0000560D 8EC2 mov es,dx ; ES:DI -> destination address 0 0000560F 51 push cx ; save DOS size 0 00005610 B104 mov cl,4 0 00005612 D3E8 shr ax,cl ; AX = header size in para's 0 00005614 29C2 sub dx,ax ; adjust DOS segment accordingly 0 00005616 59 pop cx ; CX = DOS size in bytes 978 reloc_dos50: 979 ; At this point 980 ; CX = # bytes to move 981 ; ES:DI -> destination 982 ; DX = segment to fixup 983 ; 0 00005617 8916[6100] mov [dos_cseg],dx ; new code segment for DOS 0 0000561B 8E1E[1A00] mov ds,[current_dos] ; DS -> DOS code 0 0000561F 31F6 xor si,si 0 00005621 D1E9 shr cx,1 ; CX = # of words in DOS 0 00005623 F3A5 rep movsw ; copy DOS down 989 990 reloc_dos90: ; fixups performed 0 00005625 07 pop es 0 00005626 1F pop ds 0 00005627 C3 ret 994 995 reloc_dosdata: 0 00005628 06 push es ; save ES 997 0 00005629 B84100 mov ax,DDSC_LEN ;length of DDSC structure 0 0000562C F626[7604] mul byte [res_dev_count] ; * number of resident devices 0 00005630 50 push ax 0 00005631 F606[6F00]01 test byte [hiddscs],DDSCS_IN_HMA ; is HMA usage enabled? 0 00005636 7414 jz reloc_data20 ; no, skip it 0 00005638 06 push es 0 00005639 50 push ax 0 0000563A E87603 call SetupHMA ; prepare HMA 0 0000563D 59 pop cx 0 0000563E BAFFFF mov dx,0ffffh 0 00005641 E8FC02 call AllocHMA ; and try to allocate CX bytes there 0 00005644 7205 jc reloc_data10 ; did not work, try other mem instead 0 00005646 8CC0 mov ax,es 0 00005648 07 pop es 0 00005649 EB1D jmp reloc_data50 1013 reloc_data10: 0 0000564B 07 pop es 1015 reloc_data20: 0 0000564C 58 pop ax 0 0000564D 50 push ax 0 0000564E B104 mov cl,4 ; convert bytes to paragraphs 0 00005650 83C00F add ax,15 ; and round it 0 00005653 D3E8 shr ax,cl 0 00005655 B24D mov dl,'M' ; MCB type 0 00005657 F606[6F00]02 test byte [hiddscs],DDSCS_IN_UMB ; is upper mem usage enabled 0 0000565C 7405 jz reloc_data30 ; no, try low mem instead 0 0000565E E84904 call alloc_hiseg ; try to allocate upper mem 0 00005661 7303 jnc reloc_data40 ; if it did not work, try low 1026 reloc_data30: 0 00005663 E86C04 call alloc_seg ; allocate low mem 1028 reloc_data40: 0 00005666 31FF xor di,di 1030 reloc_data50: 0 00005668 8EC0 mov es,ax ; mem position is at ES:DI 0 0000566A 59 pop cx 0 0000566B 89FA mov dx,di 0 0000566D 1E push ds 0 0000566E C536[0C00] lds si,[res_ddsc_ptr] ; copy DDSCs there 0 00005672 F3A4 rep movsb 0 00005674 1F pop ds 0 00005675 89D7 mov di,dx 0 00005677 8A0E[7604] mov cl,[res_dev_count] 0 0000567B 1E push ds 0 0000567C 06 push es 0 0000567D C41E[0400] les bx,[func52_ptr] 0 00005681 26C57716 lds si,[es:F52_PATHPTR + bx] 0 00005685 07 pop es 1045 reloc_data60: ; fix up new DDSC addresses in LDTs 0 00005686 897C45 mov word ptr [LDT_PDT + si],di 0 00005689 894447 mov word ptr [LDT_PDT+2 + si],ax 0 0000568C 80F901 cmp cl,1 ; and in DDSCs 0 0000568F 740D je reloc_data65 ; skip last one 0 00005691 26897D19 mov word ptr [es:DDSC_LINK + di],di 0 00005695 2683451941 add word ptr [es:DDSC_LINK + di],DDSC_LEN 0 0000569A 2689451B mov word ptr [es:DDSC_LINK+2 + di],ax 1053 reloc_data65: 0 0000569E 83C741 add di,DDSC_LEN ; next DDSC 0 000056A1 83C658 add si,LDT_LEN ; next LDT 0 000056A4 E2E0 loop reloc_data60 0 000056A6 1F pop ds 0 000056A7 A3[0E00] mov [res_ddsc_seg],ax ; fix up pointers in DOS data segment 0 000056AA 8916[0C00] mov [res_ddsc_off],dx 0 000056AE C41E[0400] les bx,[func52_ptr] 0 000056B2 26894702 mov word ptr [es:F52_DDSCPTR+2 + bx],ax 0 000056B6 268917 mov word ptr [es:F52_DDSCPTR + bx],dx 1063 0 000056B9 A1[7704] mov ax,[dosdata_len] ; length of DOS data segment 0 000056BC B104 mov cl,4 ; convert this to paragraphs 0 000056BE 83C00F add ax,15 0 000056C1 D3E8 shr ax,cl 0 000056C3 B24D mov dl,'M' ; MCB type 0 000056C5 F606[6E00]02 test byte [hidosdata],DOSDATA_IN_UMB ; shall the DOS data go high? 0 000056CA 7405 jz reloc_data70 ; no, then try low mem instead 0 000056CC E8DB03 call alloc_hiseg ; try to allocate upper mem 0 000056CF 7303 jnc reloc_data80 ; did not work, try low instead 1073 reloc_data70: 0 000056D1 E8FE03 call alloc_seg ; allocate low 1075 reloc_data80: 0 000056D4 8B0E[7704] mov cx,[dosdata_len] ; copy the DOS data segment to new location 0 000056D8 8EC0 mov es,ax 0 000056DA 31FF xor di,di 0 000056DC 31F6 xor si,si 0 000056DE 1E push ds 0 000056DF 8E1E[5500] mov ds,[dos_dseg] 0 000056E3 F3A4 rep movsb 0 000056E5 1F pop ds 0 000056E6 A3[5500] mov [dos_dseg],ax ; and fix up the pointers 0 000056E9 A3[0A00] mov [drdos_seg],ax 0 000056EC A3[0600] mov [func52_seg],ax 0 000056EF 31FF xor di,di 0 000056F1 8EC7 mov es,di 0 000056F3 26A3C600 mov [es:INT31_SEGMENT],ax 1090 0 000056F7 07 pop es ; restore ES again 0 000056F8 C3 ret 1093 1094 reloc_xbda: 0 000056F9 803E[7000]00 cmp byte [hixbda],0 ; shall the XBDA be moved? 0 000056FE 7503 jne reloc_xbda02 ; yes 0 00005700 E93C01 jmp reloc_xbda140 ; no, nothing to do 1098 reloc_xbda02: 0 00005703 06 push es ; save ES 0 00005704 B84000 mov ax,40h ; address of BIOS data area 0 00005707 8EC0 mov es,ax 0 00005709 BB0000 mov bx,0 0 0000570C 268B470E mov ax,[es:0eh + bx] ; segment address of XBDA if one exists 0 00005710 3B06[2C00] cmp ax,[mem_size] ; is it at the top of conventional mem? 0 00005714 7403 je reloc_xbda03 ; yes, go on 0 00005716 E92501 jmp reloc_xbda130 ; no, then moving it is no good 1107 reloc_xbda03: 0 00005719 8EC0 mov es,ax ; ES = XBDA segment 0 0000571B 30E4 xor ah,ah 0 0000571D 268A07 mov al,[es:bx] ; length of XBDA in kilobytes 0 00005720 B106 mov cl,6 ; make this paragraphs 0 00005722 D3E0 shl ax,cl 0 00005724 89C1 mov cx,ax 0 00005726 8CC2 mov dx,es 0 00005728 01D0 add ax,dx ; end of XBDA 0 0000572A 3D00A0 cmp ax,0a000h ; is it just before the video RAM? 0 0000572D 7403 je reloc_xbda05 ; yes, that is just what we want 0 0000572F E90C01 jmp reloc_xbda130 ; if not, do not move it 1119 reloc_xbda05: 0 00005732 B24D mov dl,'M' ; MCB type 0 00005734 89C8 mov ax,cx 0 00005736 F606[7000]02 test byte [hixbda],MOVE_XBDA_HIGH ; shall we try to move it to upper mem? 0 0000573B 7405 jz reloc_xbda10 ; no 0 0000573D E8D503 call alloc_upper ; try to allocate in upper mem 0 00005740 730D jnc reloc_xbda20 ; did not work, try low instead 1126 reloc_xbda10: 0 00005742 F606[7000]01 test byte [hixbda],MOVE_XBDA_LOW ; shall we move it to low base mem? 0 00005747 7503 jnz reloc_xbda15 ; yes 0 00005749 E9F200 jmp reloc_xbda130 ; no, then just leave it where it is 1130 reloc_xbda15: 0 0000574C E88303 call alloc_seg ; allocate low mem 1132 reloc_xbda20: 0 0000574F 51 push cx 0 00005750 31DB xor bx,bx 0 00005752 92 xchg ax,dx 0 00005753 30E4 xor ah,ah 0 00005755 268A07 mov al,[es:bx] ; length of XBDA in kilobytes 0 00005758 B109 mov cl,9 ; make this words instead 0 0000575A D3E0 shl ax,cl 0 0000575C 91 xchg ax,cx 0 0000575D 1E push ds 0 0000575E 8CC0 mov ax,es ; save old XBDA segment address, 0 00005760 06 push es 1144 BIOS_SEG equ bios_seg ; NASM port label 0 00005761 8E06[5100] mov es,[BIOS_SEG] ; segment address of low memory code 0 00005765 26A3[0000] mov [es:oldxbda],ax ; save old XBDA segment address, 0 00005769 268916[0000] mov [es:newxbda],dx ; new address 0 0000576E 26890E[0000] mov [es:xbdalen],cx ; and length for Int 19h 0 00005773 07 pop es 0 00005774 06 push es ; copy XBDA to new position 0 00005775 1F pop ds 0 00005776 8EC2 mov es,dx 0 00005778 31FF xor di,di 0 0000577A 31F6 xor si,si 0 0000577C F3A5 rep movsw 0 0000577E B84000 mov ax,40h ; and update the BIOS data area with the new address 0 00005781 8ED8 mov ds,ax 0 00005783 8C470E mov [0eh + bx],es 0 00005786 1F pop ds 0 00005787 59 pop cx 0 00005788 C41E[0400] les bx,[func52_ptr] ; now get the start of the MCB chain 0 0000578C 268E47FE mov es,[es:F52_DMDROOT + bx] 0 00005790 8B36[2C00] mov si,[mem_size] 0 00005794 4E dec si 1165 reloc_xbda30: 0 00005795 8CC0 mov ax,es 0 00005797 89C7 mov di,ax 0 00005799 2603060300 add ax,[es:DMD_LEN] ; and check them to find the right one 0 0000579E 40 inc ax 0 0000579F 39F7 cmp di,si ; is this the one that includes the old XBDA? 0 000057A1 7424 je reloc_xbda40 ; yes 0 000057A3 26803E00005A cmp byte [es:DMD_ID],IDZ ; already the last one? 0 000057A9 750A jne reloc_xbda31 ; no 0 000057AB 56 push si 0 000057AC 46 inc si 0 000057AD 39F0 cmp ax,si ; XBDA immediately following this block? 0 000057AF 5E pop si 0 000057B0 740E je reloc_xbda35 ; yes 0 000057B2 E98900 jmp reloc_xbda130 ; did not find it 1180 reloc_xbda31: 0 000057B5 39F0 cmp ax,si ; already past the right position? 0 000057B7 7603 jna reloc_xbda32 ; no 0 000057B9 E98200 jmp reloc_xbda130 ; that cannot be helped 1184 reloc_xbda32: 0 000057BC 8EC0 mov es,ax ; get the address of the next MCB 0 000057BE EBD5 jmp reloc_xbda30 ; try again 1187 reloc_xbda35: 0 000057C0 26010E0300 add [es:DMD_LEN],cx ; length of XBDA 0 000057C5 EB5B jmp reloc_xbda45 1190 reloc_xbda40: 0 000057C7 50 push ax ; save length of old MCB 0 000057C8 26FF360100 push word [es:DMD_PSP] ; and the old PSP pointer 0 000057CD 268A2E0000 mov ch,[es:DMD_ID] ; and also its ID code 0 000057D2 B8FF9F mov ax,09fffh ; compute the new length 0 000057D5 29F8 sub ax,di 0 000057D7 48 dec ax 0 000057D8 26A30300 mov [es:DMD_LEN],ax ; and update the MCB accordingly 0 000057DC 26C70601000000 mov word [es:DMD_PSP],0 ; make this free mem 0 000057E3 26C70608005344 mov word [es:DMD_NAME],'S'+256*'D' 0 000057EA 26C6060A0000 mov byte [es:DMD_NAME+2],0 0 000057F0 26C60600004D mov byte [es:DMD_ID],IDM ; there surely follows another one 0 000057F6 B8FF9F mov ax,09fffh ; this is where the system area starts now 0 000057F9 8EC0 mov es,ax 0 000057FB 26882E0000 mov [es:DMD_ID],ch ; use these values from the old MCB 0 00005800 268F060100 pop word [es:DMD_PSP] 0 00005805 58 pop ax 0 00005806 2DFF9F sub ax,9fffh 0 00005809 48 dec ax 0 0000580A 26A30300 mov [es:DMD_LEN],ax ; and this is the new length 0 0000580E C41E[0400] les bx,[func52_ptr] ; update the upper memory chain 0 00005812 26C74766FF9F mov word [es:F52_DMD_UPPER + bx],9fffh 0 00005818 C41E[0800] les bx,[drdos_ptr] 0 0000581C 26C74718FF9F mov word [es:DRDOS_DMD_UPPER + bx],9fffh 1214 reloc_xbda45: 0 00005822 C706[2C00]00A0 mov word [mem_size],0a000h ; and the base mem top 0 00005828 B84000 mov ax,40h ; also update the new base mem size 0 0000582B 8EC0 mov es,ax ; in the BIOS data area 0 0000582D BB1300 mov bx,13h 0 00005830 B88002 mov ax,640 0 00005833 268707 xchg [es:bx],ax 0 00005836 8E06[5100] mov es,[BIOS_SEG] 0 0000583A 26A3[0000] mov [es:oldmemtop],ax ; save old conventional memory top 1223 reloc_xbda130: 0 0000583E 07 pop es ; restore ES again 1225 reloc_xbda140: 0 0000583F C3 ret 1227 1228 Public HookInt2F 1229 1230 HookInt2F: 1231 ;--------- 1232 ; Hook Int 2F during device driver initialisation so we can intercept 1233 ; some broadcasts 1234 ; On Entry: 1235 ; None (beware DS/ES can be anything) 1236 ; On Exit: 1237 ; None (All regs preserved) 1238 ; 0 00005840 06 push es 0 00005841 50 push ax 0 00005842 53 push bx 0 00005843 2EC41E[0800] les bx,[cs:drdos_ptr] 0 00005848 268B5F2C mov bx,[es:DRDOS_INT2F + bx] ; ES:BX -> Int 2F hooks 0 0000584C B8[8509] mov ax,offset Int2FHandler 0 0000584F 26874704 xchg ax,[es:4 + bx] ; get Int 2F offset 0 00005853 2EA3[AB09] mov [cs:int2FOff],ax 0 00005857 8CC8 mov ax,cs 0 00005859 26874706 xchg ax,[es:6 + bx] ; get Int 2F segment 0 0000585D 2EA3[AD09] mov [cs:int2FSeg],ax 0 00005861 5B pop bx 0 00005862 58 pop ax 0 00005863 07 pop es 0 00005864 C3 ret 1254 1255 Public UnhookInt2F 1256 1257 UnhookInt2F: 1258 ;----------- 1259 ; Device driver initialisation has finished, so unhook from Int 2F 1260 ; On Entry: 1261 ; None (beware DS/ES can be anything) 1262 ; On Exit: 1263 ; None (All regs preserved) 1264 ; 0 00005865 06 push es 0 00005866 50 push ax 0 00005867 53 push bx 0 00005868 2EC41E[0800] les bx,[cs:drdos_ptr] 0 0000586D 268B5F2C mov bx,[es:DRDOS_INT2F + bx] ; ES:BX -> Int 2F hooks 0 00005871 2EA1[AB09] mov ax,[cs:int2FOff] 0 00005875 26894704 mov [es:4 + bx],ax ; restore Int 2F offset 0 00005879 2EA1[AD09] mov ax,[cs:int2FSeg] 0 0000587D 26894706 mov [es:6 + bx],ax ; restore Int 2F segment 0 00005881 5B pop bx 0 00005882 58 pop ax 0 00005883 07 pop es 0 00005884 C3 ret 1278 1279 1280 ; During device driver init we provide some services on Int 2F 1281 ; eg. 12FF for EMM386.SYS and 4A01/4A02 for Windows HIMEM.SYS 1282 1283 Int2FHandler: 1284 ;------------ 1285 ; On Entry: 1286 ; callers DS on stack 1287 ; On Exit: 1288 ; if not handled pass on to BIOS, callers DS on stack, all regs preserved 1289 ; 0 00005885 1F pop ds ; pop DS from stack 0 00005886 3D014A cmp ax,4A01h ; Query Free HMA Space ? 0 00005889 7478 je HMAQueryFree 0 0000588B 3D024A cmp ax,4A02h ; Allocate HMA Space ? 0 0000588E 745C je HMAAlloc 0 00005890 3DFF12 cmp ax,12FFh ; is it a relocation service ? 0 00005893 7514 jne OldInt2F 0 00005895 FB sti ; if we RETF don't leave IF disabled 0 00005896 83FB09 cmp bx,9 ; register upper memory link 0 00005899 743A je DOSUpperMemoryRoot 0 0000589B 83FB01 cmp bx,1 ; Relocate BDOS 0 0000589E 720F jb DOSQuerySize ; what's the size of DOS 0 000058A0 7414 je DOSRelocate ; where to put it 0 000058A2 83FB03 cmp bx,3 ; Relocate BIOS 0 000058A5 7216 jb BIOSQuerySize ; what's the size of BIOS 0 000058A7 7422 je BIOSRelocate ; where to put it 1306 1307 OldInt2F: 0 000058A9 1E push ds ; DS on stack as expected 0 000058AA EA db JMPF_OPCODE 0 000058AB 0000 int2FOff dw 0 0 000058AD 0000 int2FSeg dw 0 1312 1313 1314 ; Enquire DOS size 1315 DOSQuerySize: 1316 ;------------ 1317 ; On Entry: 1318 ; None 1319 ; On Exit: 1320 ; AX = 0 1321 ; DX = DOS Size in para's 1322 ; 0 000058AF 2E8B16[2000] mov dx,[cs:dosCodeParaSize] ; DX = para's required for DOS code 0 000058B4 EB1A jmp short RelocExit 1325 1326 ; Relocate DOS 1327 DOSRelocate: 1328 ;----------- 1329 ; On Entry: 1330 ; DX = para to reloacte to (FFFF=HMA) 1331 ; On Exit: 1332 ; AX = 0 1333 ; 0 000058B6 2E8916[1C00] mov [cs:dos_target_seg],dx ; save where 0 000058BB EB13 jmp short RelocExit 1336 1337 1338 ; Enquire BIOS size 1339 BIOSQuerySize: 1340 ;------------- 1341 ; On Entry: 1342 ; None 1343 ; On Exit: 1344 ; AX = 0 1345 ; DX = BIOS Size in para's 1346 ; 0 000058BD 2E8B16[1600] mov dx,[cs:rcode_len] ; DX = bytes required for BIOS code 0 000058C2 83C20F add dx,15 0 000058C5 B104 mov cl,4 0 000058C7 D3EA shr dx,cl ; DX para's required 0 000058C9 EB05 jmp short RelocExit 1352 1353 ; Relocate BIOS 1354 BIOSRelocate: 1355 ;------------ 1356 ; On Entry: 1357 ; DX = para to reloacte to (FFFF=HMA) 1358 ; On Exit: 1359 ; AX = 0 1360 ; 0 000058CB 2E8916[1E00] mov [cs:bios_target_seg],dx ; save where 1362 ; jmp short RelocExit 1363 1364 RelocExit: 0 000058D0 31C0 xor ax,ax ; indicate success 0 000058D2 CA0200 retf 2 1367 1368 1369 DOSUpperMemoryRoot: 1370 ;------------------ 0 000058D5 2EC41E[0800] les bx,[cs:drdos_ptr] 0 000058DA 26895718 mov [es:DRDOS_DMD_UPPER + bx],dx ; remember upper memory link 1373 %if DOS5 0 000058DE 2EC41E[0400] les bx,[cs:func52_ptr] 0 000058E3 26895766 mov [es:F52_DMD_UPPER + bx],dx ; remember upper memory link 1376 %endif 0 000058E7 31C0 xor ax,ax 0 000058E9 CA0200 retf 2 1379 1380 HMAAlloc: 1381 ;-------- 1382 ; On Entry: 1383 ; BX = # bytes to allocate 1384 ; On Exit: 1385 ; ES:DI -> start of allocated block 1386 ; BX trashed 1387 ; 0 000058EC 1E push ds 0 000058ED 50 push ax 0 000058EE 51 push cx 0 000058EF 52 push dx 0 000058F0 56 push si 0 000058F1 55 push bp 0 000058F2 0E push cs 0 000058F3 1F pop ds ; establish data seg 0 000058F4 89D9 mov cx,bx ; CX = bytes wanted 0 000058F6 BAFFFF mov dx,0FFFFh ; anywhere is OK 0 000058F9 E84400 call AllocHMA ; ES:DI -> allocated data 0 000058FC 5D pop bp 0 000058FD 5E pop si 0 000058FE 5A pop dx 0 000058FF 59 pop cx 0 00005900 58 pop ax 0 00005901 1F pop ds 0 00005902 CF iret 1406 1407 1408 HMAQueryFree: 1409 ;------------ 1410 ; On Entry: 1411 ; None 1412 ; On Exit: 1413 ; BX = Size of block remaining (0 if no HMA) 1414 ; ES:DI -> start of available HMA (FFFF:FFFF if no HMA) 1415 ; 0 00005903 1E push ds 0 00005904 50 push ax 0 00005905 51 push cx 0 00005906 52 push dx 0 00005907 56 push si 0 00005908 55 push bp 0 00005909 0E push cs 0 0000590A 1F pop ds ; establish data seg 0 0000590B E8A500 call SetupHMA ; allocate the HMA for OS use 0 0000590E 2EC41E[0800] les bx,[cs:drdos_ptr] 0 00005913 268B7F10 mov di,[es:DRDOS_HIMEM_ROOT + bx] 0 00005917 B8FFFF mov ax,0FFFFh ; get offset of HMA entry 0 0000591A 8EC0 mov es,ax 0 0000591C 85FF test di,di ; do we have a himem root ? 0 0000591E 7414 jz HMAQueryFree10 ; no, return failure 0 00005920 268B5D02 mov bx,[es:2 + di] ; BX = size of region 0 00005924 89F8 mov ax,di ; para align the base 0 00005926 83C00F add ax,15 ; because the allocation will 0 00005929 83E0F0 and ax,0FFF0h 0 0000592C 29F8 sub ax,di ; AX bytes left in the para 0 0000592E 01C7 add di,ax ; bias the starting location 0 00005930 29C3 sub bx,ax ; that many less available 0 00005932 7705 ja HMAQueryFree20 ; if non-zero, return it 1439 HMAQueryFree10: 0 00005934 31DB xor bx,bx ; BX = zero on failure 0 00005936 BFFFFF mov di,0FFFFh ; ES:DI -> FFFF:FFFF 1442 HMAQueryFree20: 0 00005939 5D pop bp 0 0000593A 5E pop si 0 0000593B 5A pop dx 0 0000593C 59 pop cx 0 0000593D 58 pop ax 0 0000593E 1F pop ds 0 0000593F CF iret 1450 1451 1452 Public AllocHMA 1453 1454 AllocHMA: 1455 ;-------- 1456 ; On Entry: 1457 ; CX = bytes to allocate 1458 ; DX = offset of allocation 1459 ; On Exit: 1460 ; CY set if no can do and ES:DI = FFFF:FFFF 1461 ; else 1462 ; ES:DI -> memory allocated (para aligned) 1463 ; CX preserved 1464 ; DX = segment to fixup 1465 ; 0 00005940 2EC41E[0800] les bx,[cs:drdos_ptr] 0 00005945 268B7F10 mov di,[es:DRDOS_HIMEM_ROOT + bx] 0 00005949 85FF test di,di ; have we a HIMEM chain ? 0 0000594B 745F jz AllocHMA20 0 0000594D 39D7 cmp di,dx ; low enough for us 0 0000594F 775B ja AllocHMA20 0 00005951 B8FFFF mov ax,0FFFFh ; relocate to magic segment 0 00005954 8EC0 mov es,ax ; lets examine high memory 0 00005956 268B4502 mov ax,[es:2 + di] ; get size of himem entry 0 0000595A 268B35 mov si,[es:di] ; and get himem link 0 0000595D 89FB mov bx,di 0 0000595F 83C30F add bx,15 0 00005962 83E3F0 and bx,0FFF0h ; BX is now para aligned 0 00005965 29FB sub bx,di ; BX is bytes left in para 0 00005967 29D8 sub ax,bx ; so we only have this much 0 00005969 7241 jc AllocHMA20 ; less than a para ? 0 0000596B 83C70F add di,15 ; para align the base, dropping 0 0000596E 83E7F0 and di,0FFF0h ; non-aligned bit on floor 0 00005971 39C8 cmp ax,cx ; is himem entry big enough ? 0 00005973 7237 jb AllocHMA20 ; no, allocate from 1st MByte 0 00005975 7414 je AllocHMA10 ; just made it! 0 00005977 29C8 sub ax,cx ; how much is left 0 00005979 83F804 cmp ax,2*2 ; is it to small to keep ? 0 0000597C 720D jb AllocHMA10 ; no, discard the remainder 0 0000597E 89FB mov bx,di ; point to new entry 0 00005980 01CB add bx,cx ; this many byte up 0 00005982 268937 mov [es:bx],si ; fill in link field 0 00005985 26894702 mov [es:2 + bx],ax ; and length 0 00005989 89DE mov si,bx ; make this new root 1495 AllocHMA10: 0 0000598B 51 push cx ; save length of CODE 0 0000598C 52 push dx ; and offset of CODE 0 0000598D 2EC41E[0800] les bx,[cs:drdos_ptr] 0 00005992 26897710 mov [es:DRDOS_HIMEM_ROOT + bx],si 0 00005996 58 pop ax ; AX = offset of CODE 0 00005997 B104 mov cl,4 0 00005999 D3E8 shr ax,cl ; make it paras 0 0000599B BAFFFF mov dx,0ffffh 0 0000599E 8EC2 mov es,dx ; ES:DI -> destination of CODE 0 000059A0 89FA mov dx,di 0 000059A2 B104 mov cl,4 0 000059A4 D3EA shr dx,cl ; DX = offset from FFFF in para's 0 000059A6 4A dec dx ; DX = offset from 10000 0 000059A7 29C2 sub dx,ax ; DX = fixup segment 0 000059A9 59 pop cx ; CX = bytes to move 0 000059AA F8 clc ; made it! 0 000059AB C3 ret 1513 1514 AllocHMA20: 0 000059AC BFFFFF mov di,0FFFFh ; set ES:DI = FFFF:FFFF 0 000059AF 8EC7 mov es,di 0 000059B1 F9 stc ; can't do it 0 000059B2 C3 ret 1519 1520 Public SetupHMA 1521 1522 SetupHMA: 1523 ;-------- 1524 ; We have a client for the high memory area at segment FFFF 1525 ; We should try and setup a high memory free chain 1526 ; XMS only supports allocation of the complete area, so try and grab 1527 ; it all and do our own sub-allocations within it. 1528 ; 0 000059B3 06 push es 0 000059B4 2EC41E[0800] les bx,[cs:drdos_ptr] 0 000059B9 26837F1000 cmp word [es:DRDOS_HIMEM_ROOT + bx],0; do we already have a chain ? 0 000059BE 756E jnz SetupHMA10 ; if so skip XMS allocation 0 000059C0 B80043 mov ax,4300h ; check for XMS installation 0 000059C3 CD2F int 2fh 0 000059C5 3C80 cmp al,80h 0 000059C7 757F jne SetupHMA20 0 000059C9 B81043 mov ax,4310h ; get address of XMS driver 0 000059CC CD2F int 2fh 0 000059CE 891E[6500] mov word ptr [xms_driver],bx 0 000059D2 8C06[6700] mov word ptr [xms_driver+2],es 0 000059D6 B400 mov ah,0 ; version number check 0 000059D8 FF1E[6500] call far [xms_driver] 0 000059DC 83FA01 cmp dx,1 ; does HiMem exist ? 0 000059DF 7567 jne SetupHMA20 0 000059E1 B401 mov ah,1 ; allocate whole HiMem 0 000059E3 BAFFFF mov dx,0ffffh 0 000059E6 FF1E[6500] call far [xms_driver] 0 000059EA 83F801 cmp ax,1 ; did we succeed ? 0 000059ED 7559 jne SetupHMA20 0 000059EF B403 mov ah,3 ; enable a20 gate 0 000059F1 FF1E[6500] call far [xms_driver] 0 000059F5 83F801 cmp ax,1 ; did we succeed ? 0 000059F8 754E jne SetupHMA20 0 000059FA 2EC41E[0800] les bx,[cs:drdos_ptr] 0 000059FF 26C74710E000 mov word [es:DRDOS_HIMEM_ROOT + bx],COMMAND_BASE 0 00005A05 B8FFFF mov ax,0FFFFh ; one entry of FFF0 bytes covers 0 00005A08 8EC0 mov es,ax ; the complete HMA 0 00005A0A 40 inc ax 0 00005A0B 26A3E000 mov word ptr [es:COMMAND_BASE],ax 0 00005A0F 26C706E20020FF mov word [es:COMMAND_BASE+2],-COMMAND_BASE 0 00005A16 BF1000 mov di,10h ; copy a dummy VDISK header 0 00005A19 BE[2B01] mov si,offset dummyVDISK 0 00005A1C B91000 mov cx,10h 0 00005A1F F3A5 rep movsw ; copy up 0x20 bytes 0 00005A21 1E push ds ; now fixup JMPF in hi-memory for CALL5 0 00005A22 8ED8 mov ds,ax ; link for PC-NFS 0 00005A24 BEC000 mov si,4*30h ; DS:SI -> Int 30 vector 0 00005A27 8D7C10 lea di,[10h + si] ; ES:DI -> himem alias 0 00005A2A A5 movsw 0 00005A2B A5 movsw 0 00005A2C A4 movsb ; copy the JMPF 0 00005A2D 1F pop ds 1573 SetupHMA10: 0 00005A2E 2EC41E[0800] les bx,[cs:drdos_ptr] ; private data area in ES:BX 0 00005A33 BAE000 mov dx,COMMAND_BASE 0 00005A36 263B5710 cmp dx,[es:DRDOS_HIMEM_ROOT + bx] 0 00005A3A 750C jne SetupHMA20 ; should we be reserving space for OS? 0 00005A3C 8B0E[2200] mov cx,[systemSize] ; we should reserve this much 0 00005A40 E87D02 call ReserveHMA ; for the OS in the HMA 0 00005A43 7203 jc SetupHMA20 0 00005A45 A3[2400] mov [systemHMA],ax ; save for re-use 1582 SetupHMA20: 0 00005A48 07 pop es 0 00005A49 C3 ret 1585 1586 1587 Public alloc_instseg 1588 1589 alloc_instseg: 1590 ; allocate AX paragraphs for data that will have to be instanced during 1591 ; multitasking. if Vladivar kernel available ask that, or else just 1592 ; try for normal upper memory 0 00005A4A 50 push ax 0 00005A4B 53 push bx ; save registers 0 00005A4C 51 push cx 0 00005A4D B90111 mov cx,F_Version ; is the multi-tasker loaded ? 0 00005A50 B88027 mov ax,OS386_FUNC 0 00005A53 CD2F int OS386_INT 0 00005A55 CD2F int 2Fh ; check for Vladivar 0 00005A57 85C9 test cx,cx ; CX=0 if it's there 0 00005A59 59 pop cx 0 00005A5A 5B pop bx 0 00005A5B 58 pop ax 0 00005A5C 751B jnz alloc_instseg20 ; no, allocate normally 0 00005A5E 50 push ax 0 00005A5F 53 push bx 0 00005A60 51 push cx 0 00005A61 52 push dx 0 00005A62 89C2 mov dx,ax ; DX = paragraphs required 0 00005A64 B90305 mov cx,F_RealAllocI ; ask nicely for memory 0 00005A67 B88027 mov ax,OS386_FUNC 0 00005A6A CD2F int OS386_INT 0 00005A6C 5A pop dx 0 00005A6D 59 pop cx 0 00005A6E 5B pop bx 0 00005A6F 7207 jc alloc_instseg10 ; did we get any ? 0 00005A71 83C402 add sp,2 0 00005A74 31FF xor di,di 0 00005A76 F8 clc ; we've done it !! 0 00005A77 C3 ret 1621 1622 alloc_instseg10: 0 00005A78 58 pop ax ; we didn't manage it... 1624 ; jmp alloc_hiseg 1625 1626 alloc_instseg20: 0 00005A79 53 push bx 0 00005A7A F6C601 test dh,ALLOC_IN_HMA 0 00005A7D 741A jz alloc_instseg30 0 00005A7F 06 push es 0 00005A80 50 push ax 0 00005A81 B104 mov cl,4 ; convert paragraphs to bytes 0 00005A83 D3E0 shl ax,cl 0 00005A85 50 push ax 0 00005A86 E82AFF call SetupHMA ; make sure HMA chain is established 0 00005A89 59 pop cx ; CX = bytes wanted 0 00005A8A BAFFFF mov dx,0FFFFh ; anywhere is OK 0 00005A8D E8B0FE call AllocHMA ; ES:DI -> allocated data 0 00005A90 58 pop ax 0 00005A91 7205 jc alloc_instseg25 0 00005A93 8CC0 mov ax,es 0 00005A95 07 pop es 0 00005A96 EB10 jmp short alloc_instseg55 1644 alloc_instseg25: 0 00005A98 07 pop es 1646 alloc_instseg30: 0 00005A99 F6C602 test dh,ALLOC_IN_UMB 0 00005A9C 7405 jz alloc_instseg40 ; allocation from UMB's OK ? 0 00005A9E E87400 call alloc_upper ; yes, try and allocate memory there 0 00005AA1 7303 jnc alloc_instseg50 1651 alloc_instseg40: 0 00005AA3 E82C00 call alloc_seg ; allocate memory in bottom 640 K 1653 alloc_instseg50: 0 00005AA6 31FF xor di,di 1655 alloc_instseg55: 0 00005AA8 5B pop bx 0 00005AA9 C3 ret 1658 1659 Public alloc_hiseg 1660 alloc_hiseg: 1661 ; allocate AX paragraphs in high memory if possible, otherwise allocate 1662 ; it in conventional memory 0 00005AAA 803E[6900]00 cmp byte [hidos],0 ; do we want to relocate DOS ? 0 00005AAF 7421 je alloc_seg ; no, allocate conventionally 0 00005AB1 E86100 call alloc_upper ; try to allocate some upper memory 0 00005AB4 721C jc alloc_seg ; can't, so allocate conventional 0 00005AB6 C3 ret ; else return address of allocated mem 1668 1669 alloc_seg_with_padding: 1670 ; On Entry: 1671 ; AX = para's required 1672 ; DX = minimum acceptable offset 1673 ; On Exit: 1674 ; AX = base para 1675 ; 1676 ; If gate A20 is enabled we can't use negative offset's for DOS/BIOS so 1677 ; we pad conventional memory to avoid this. Avoid seg=0 while here. 0 00005AB7 51 push cx 0 00005AB8 52 push dx 0 00005AB9 83C21F add dx,15+16 ; DX is the offset we will be using 0 00005ABC B104 mov cl,4 ; so make sure base is high enough 0 00005ABE D3EA shr dx,cl ; convert "offset" to a segment value 0 00005AC0 3B16[5B00] cmp dx,[mem_current] ; make sure we don't generate a 0 00005AC4 7604 jbe alloc_seg_nopad ; negative segement value as this 0 00005AC6 8916[5B00] mov [mem_current],dx ; will crash if a20 enabled 1686 alloc_seg_nopad: ; pad if necessary 0 00005ACA B24D mov dl,'M' ; allocate for DOS 0 00005ACC E80300 call alloc_seg ; now we can allocate OK 0 00005ACF 5A pop dx 0 00005AD0 59 pop cx 0 00005AD1 C3 ret 1692 1693 Public alloc_seg 1694 alloc_seg: 1695 ;--------- 1696 ; On Entry: 1697 ; AX = para's required 1698 ; DL = subsegment type 1699 ; On Exit: 1700 ; AX = base para 1701 ; 0 00005AD2 1E push ds 0 00005AD3 51 push cx 0 00005AD4 89C1 mov cx,ax ; remember how much was wanted 0 00005AD6 40 inc ax ; allow an extra para for a header 0 00005AD7 0306[5B00] add ax,[mem_current] ; Return a pointer to AX paragraphs 0 00005ADB 3B06[5D00] cmp ax,[mem_max] ; of memory to the calling routine. 0 00005ADF 7331 jae alloc_s10 0 00005AE1 8706[5B00] xchg ax,[mem_current] 0 00005AE5 8ED8 mov ds,ax ; DS:0 -> header 0 00005AE7 40 inc ax ; AX:0 -> buffer 0 00005AE8 88160000 mov [DMD_ID],dl ; remember the type 0 00005AEC A30100 mov [DMD_PSP],ax ; owner = itself 0 00005AEF 890E0300 mov [DMD_LEN],cx ; size in para 0 00005AF3 31C9 xor cx,cx ; zero rest for cosmetic reasons 0 00005AF5 890E0500 mov word ptr [DMD_NAME-3],cx 0 00005AF9 890E0600 mov word ptr [DMD_NAME-2],cx 0 00005AFD C70608005344 mov word [DMD_NAME],'S'+256*'D' 0 00005B03 890E0A00 mov word ptr [DMD_NAME+2],cx 0 00005B07 890E0C00 mov word ptr [DMD_NAME+4],cx 0 00005B0B 890E0E00 mov word ptr [DMD_NAME+6],cx 0 00005B0F 59 pop cx 0 00005B10 1F pop ds 0 00005B11 C3 ret 1725 1726 alloc_s10: 0 00005B12 F4 hlt ; ##jc## 0 00005B13 EBFD jmp short alloc_s10 1729 1730 Public alloc_upper 1731 alloc_upper: 1732 ;----------- 1733 ; On Entry: 1734 ; AX = paragraphs required 1735 ; On Exit: 1736 ; CY clear: AX = paragraphs address of allocated memory 1737 ; CY set: cannot allocate memory (All regs preserved) 1738 ; 0 00005B15 53 push bx 0 00005B16 50 push ax ; save para required 0 00005B17 833E[6A00]00 cmp word [himem_base],0 ; we have already allocated some ? 0 00005B1C 7421 je alloc_upper10 ; nothing to grow, allocate new block 0 00005B1E 8B1E[6C00] mov bx,[himem_size] ; himem was this big 0 00005B22 01C3 add bx,ax ; try and extend it 0 00005B24 06 push es 0 00005B25 8E06[6A00] mov es,[himem_base] ; point at existing himem 0 00005B29 B44A mov ah,MS_M_SETBLOCK ; and try and set to new size 0 00005B2B CD21 int DOS_INT 0 00005B2D 07 pop es 0 00005B2E 720F jc alloc_upper10 ; can't grow, so allocate new block 0 00005B30 A1[6A00] mov ax,[himem_base] 0 00005B33 0306[6C00] add ax,[himem_size] ; return seg above old alloc 0 00005B37 5B pop bx ; recover para required 0 00005B38 011E[6C00] add [himem_size],bx ; add into himem size 0 00005B3C 5B pop bx 0 00005B3D F8 clc ; success.. 0 00005B3E C3 ret ; return AX = seg 1758 1759 alloc_upper10: 0 00005B3F B80158 mov ax,(MS_M_STRATEGY*256)+1; set allocation strategy 0 00005B42 B341 mov bl,41h ; to best fit, high only 0 00005B44 CD21 int DOS_INT 0 00005B46 5B pop bx 0 00005B47 53 push bx ; recover para required in BX 0 00005B48 B448 mov ah, MS_M_ALLOC ; and try to allocate them 0 00005B4A CD21 int DOS_INT 0 00005B4C 9C pushf 0 00005B4D 50 push ax ; save CF and possible address 0 00005B4E B80158 mov ax,(MS_M_STRATEGY*256)+1; set allocation strategy 0 00005B51 B300 mov bl,0 ; to first fit 0 00005B53 CD21 int DOS_INT 0 00005B55 58 pop ax 0 00005B56 9D popf ; restore CF and possible address 0 00005B57 721A jc alloc_upper20 ; can't allocate, use conventional 0 00005B59 3B06[2C00] cmp ax,[mem_size] ; is it from upper memory ? 0 00005B5D 770A ja alloc_upper15 ; yes, we can use it 0 00005B5F 06 push es ; it's conventional, free it up 0 00005B60 8EC0 mov es,ax ; seg address in ES 0 00005B62 B449 mov ah,MS_M_FREE 0 00005B64 CD21 int DOS_INT ; free up this memory 0 00005B66 07 pop es 0 00005B67 EB0A jmp short alloc_upper20 ; try again with XMS 1783 1784 alloc_upper15: 0 00005B69 A3[6A00] mov [himem_base],ax ; save base value 0 00005B6C 8F06[6C00] pop word [himem_size] ; save size 0 00005B70 5B pop bx ; and return seg in AX 0 00005B71 F8 clc ; success.. 0 00005B72 C3 ret 1790 1791 alloc_upper20: 0 00005B73 58 pop ax 0 00005B74 5B pop bx ; restore regs 0 00005B75 1E push ds 0 00005B76 06 push es 0 00005B77 53 push bx 0 00005B78 51 push cx 0 00005B79 52 push dx 0 00005B7A 56 push si 0 00005B7B 57 push di 0 00005B7C 55 push bp 0 00005B7D 50 push ax ; save allocation size 0 00005B7E B80043 mov ax,4300h ; check for XMS installation 0 00005B81 CD2F int 2fh 0 00005B83 3C80 cmp al,80h 0 00005B85 7527 jne alloc_upper30 0 00005B87 B81043 mov ax,4310h ; get address of XMS driver 0 00005B8A CD2F int 2fh 0 00005B8C 891E[6500] mov word ptr [xms_driver],bx 0 00005B90 8C06[6700] mov word ptr [xms_driver+2],es 0 00005B94 5A pop dx 0 00005B95 52 push dx ; DX = allocation size 0 00005B96 B410 mov ah,10h ; allocate upper memory block 0 00005B98 FF1E[6500] call far [xms_driver] 0 00005B9C 83F801 cmp ax,1 ; did we succeed ? 0 00005B9F 750D jne alloc_upper30 0 00005BA1 58 pop ax ; recover allocation size 0 00005BA2 89D8 mov ax,bx ; return para address of himem 0 00005BA4 5D pop bp 0 00005BA5 5F pop di 0 00005BA6 5E pop si 0 00005BA7 5A pop dx 0 00005BA8 59 pop cx 0 00005BA9 5B pop bx 0 00005BAA 07 pop es 0 00005BAB 1F pop ds 0 00005BAC F8 clc ; success 0 00005BAD C3 ret 1829 1830 alloc_upper30: 0 00005BAE 58 pop ax ; recover allocation size 0 00005BAF 5D pop bp 0 00005BB0 5F pop di 0 00005BB1 5E pop si 0 00005BB2 5A pop dx 0 00005BB3 59 pop cx 0 00005BB4 5B pop bx 0 00005BB5 07 pop es 0 00005BB6 1F pop ds 0 00005BB7 F9 stc ; failure.... 0 00005BB8 C3 ret 1842 1843 1844 mark_system_memory: 1845 ;------------------ 1846 ; ensure any memory we have allocated is owned by PSP 0008, a magic value 1847 ; used to indicate system memory 0 00005BB9 06 push es 0 00005BBA C41E[0400] les bx,[func52_ptr] ; get internal data in ES:BX 0 00005BBE 268E47FE mov es,[es:F52_DMDROOT + bx] ; get 1st DMD entry 0 00005BC2 B462 mov ah,MS_P_GETPSP 0 00005BC4 CD21 int DOS_INT ; get our PSP in BX 1853 mark_sm10: 0 00005BC6 26803E00004D cmp byte [es:DMD_ID],'M' 0 00005BCC 7408 je mark_sm20 ; check we have a valid DMD 0 00005BCE 26803E00005A cmp byte [es:DMD_ID],'Z' 0 00005BD4 7547 jne mark_sm50 ; stop if we don't 1858 mark_sm20: 0 00005BD6 263B1E0100 cmp bx,[es:DMD_PSP] ; is it ours ?? 0 00005BDB 7507 jne mark_sm30 0 00005BDD 26C70601000800 mov word [es:DMD_PSP],0008 ; mark as system 1862 mark_sm30: 0 00005BE4 26833E010008 cmp word [es:DMD_PSP],0008 ; if system mark as SC 0 00005BEA 751D jne mark_sm40 0 00005BEC 31C0 xor ax,ax ; zero rest for cosmetic reasons 0 00005BEE 26A30500 mov word ptr [es:DMD_NAME-3],ax 0 00005BF2 26A30600 mov word ptr [es:DMD_NAME-2],ax 0 00005BF6 26C70608005343 mov word [es:DMD_NAME],'S'+256*'C' 0 00005BFD 26A30A00 mov word ptr [es:DMD_NAME+2],ax 0 00005C01 26A30C00 mov word ptr [es:DMD_NAME+4],ax 0 00005C05 26A30E00 mov word ptr [es:DMD_NAME+6],ax 1872 mark_sm40: 0 00005C09 26803E00005A cmp byte [es:DMD_ID],'Z' ; is it the last DMD ? 0 00005C0F 740C je mark_sm50 ; then stop 0 00005C11 8CC0 mov ax,es 0 00005C13 40 inc ax ; skip DMD header and add 0 00005C14 2603060300 add ax,[es:DMD_LEN] ; length to find next DMD 0 00005C19 8EC0 mov es,ax 0 00005C1B EBA9 jmp short mark_sm10 ; now go and look at that 1880 mark_sm50: 0 00005C1D 07 pop es 0 00005C1E C3 ret 1883 1884 ; Relocate the BIOS code from top of memory 1885 reloc_bios: 0 00005C1F 8B16[1000] mov dx,[rcode_offset] 0 00005C23 8B0E[1600] mov cx,[rcode_len] ; we need to relocate this much 0 00005C27 85C9 test cx,cx ; do we need to move anything ? 0 00005C29 7501 jnz reloc_bios10 0 00005C2B C3 ret 1891 reloc_bios10: 0 00005C2C 83C10F add cx,15 ; round rcode size up to a para 0 00005C2F 83E1F0 and cx,0FFF0h 0 00005C32 A1[1E00] mov ax,[bios_target_seg] ; where do we go 0 00005C35 85C0 test ax,ax 0 00005C37 7406 jz reloc_bios20 ; zero - do it ourselves 0 00005C39 40 inc ax ; FFFF - unlikely as it's not 0 00005C3A 740A jz reloc_bios25 ; currently supported 0 00005C3C 48 dec ax ; else we've been given a seg 0 00005C3D EB25 jmp short reloc_bios40 1901 reloc_bios20: 0 00005C3F 833E[1C00]FF cmp word [dos_target_seg],0FFFFh ; if DOS goes up, so does BIOS 0 00005C44 7505 jne reloc_bios30 1904 reloc_bios25: 0 00005C46 E8F7FC call AllocHMA ; in HIGH memory 0 00005C49 7328 jnc reloc_bios50 1907 reloc_bios30: 0 00005C4B 89C8 mov ax,cx ; allocate conventionally 0 00005C4D D1E8 shr ax,1 0 00005C4F D1E8 shr ax,1 ; in para's of course 0 00005C51 D1E8 shr ax,1 0 00005C53 D1E8 shr ax,1 0 00005C55 803E[6900]00 cmp byte [hidos],0 ; do we want to relocate DOS ? 0 00005C5A 7405 je reloc_bios35 ; no, allocate conventionally 0 00005C5C E8B6FE call alloc_upper ; try to allocate some upper memory 0 00005C5F 7303 jnc reloc_bios40 ; can't, so allocate conventional 1917 reloc_bios35: ; padding out if required 0 00005C61 E853FE call alloc_seg_with_padding 1919 reloc_bios40: 0 00005C64 8EC0 mov es,ax 0 00005C66 31FF xor di,di ; ES:DI -> destination 0 00005C68 D1EA shr dx,1 0 00005C6A D1EA shr dx,1 ; convert offset to para's 0 00005C6C D1EA shr dx,1 0 00005C6E D1EA shr dx,1 0 00005C70 29D0 sub ax,dx ; bias segment appropriately 0 00005C72 92 xchg ax,dx ; and have in DX 1928 reloc_bios50: 0 00005C73 06 push es 0 00005C74 51 push cx 0 00005C75 57 push di 1932 0 00005C76 1E push ds 0 00005C77 8B36[1000] mov si,[rcode_offset] 0 00005C7B 8E1E[1200] mov ds,[rcode_seg] 0 00005C7F F3A4 rep movsb 0 00005C81 1F pop ds 0 00005C82 8916[1200] mov [rcode_seg],dx ; new RCODE location 1939 0 00005C86 E80400 call dd_fixup ; fixup any device drivers 1941 0 00005C89 5F pop di 0 00005C8A 59 pop cx 0 00005C8B 07 pop es 0 00005C8C C3 ret 1946 1947 1948 ; 1949 ; The following code performs the fixups necessary for RELOCATABLE executable 1950 ; internal device drivers. 1951 1952 dd_fixup: 1953 ; On Entry: 1954 ; None 1955 ; On Exit: 1956 ; None 1957 0 00005C8D 06 push es 0 00005C8E 8B3E[1200] mov di,[rcode_seg] ; fixup to this segment 0 00005C92 8B36[1800] mov si,[rcode_fixups] ; get fixup table 0 00005C96 85F6 test si,si ; is there one ? 0 00005C98 740E jz dd_fixup20 0 00005C9A 8E06[5100] mov es,[bios_seg] 1964 dd_fixup10: 0 00005C9E AD lodsw ; get a fixup offset 0 00005C9F 85C0 test ax,ax ; last of the fixups ? 0 00005CA1 7405 jz dd_fixup20 0 00005CA3 97 xchg ax,di ; point to the fixup 0 00005CA4 AB stosw ; do the fixup 0 00005CA5 97 xchg ax,di ; save segment again 0 00005CA6 EBF6 jmp short dd_fixup10 1972 dd_fixup20: 0 00005CA8 07 pop es 0 00005CA9 C3 ret 1975 1976 1977 ReserveOSHMA: 1978 ;------------ 1979 ; reserve space in HMA for OS 1980 ; On Entry: 1981 ; None 1982 ; On Exit: 1983 ; None 1984 ; 1985 1986 ReserveCommandHMA: 1987 ;---------------- 1988 ; reserve space in HMA for COMMAND.COM 1989 ; On Entry: 1990 ; None 1991 ; On Exit: 1992 ; None 1993 ; 0 00005CAA 833E[2600]00 cmp word [commandHMA],0 ; been here already ?? 0 00005CAF 750E jne ReserveCommandHMA10 0 00005CB1 B9A01F mov cx,COMMAND_SIZE 0 00005CB4 BAE000 mov dx,COMMAND_BASE 0 00005CB7 E80600 call ReserveHMA ; reserve the space in HMA 0 00005CBA 7203 jc ReserveCommandHMA10 ; if we can 0 00005CBC A3[2600] mov [commandHMA],ax ; save for re-use 2001 ReserveCommandHMA10: 0 00005CBF C3 ret 2003 2004 ReserveHMA: 2005 ;---------- 2006 ; reserve some space in the HMA 2007 ; On Entry: 2008 ; CX = size require 2009 ; DX = maximum offset acceptable 2010 ; On Exit: 2011 ; AX = offset of reserved space 2012 ; 0 00005CC0 06 push es 0 00005CC1 E87CFC call AllocHMA ; allocate space in HIGH memory 0 00005CC4 7216 jc ReserveHMA10 0 00005CC6 26C7050000 mov word ptr [es:di],0 ; no link, it's this big 0 00005CCB 26894D02 mov word ptr [es:2 + di],cx 0 00005CCF 8CC3 mov bx,es 0 00005CD1 B8FFFF mov ax,0FFFFh 0 00005CD4 29D8 sub ax,bx ; AX = para offset adjustment required 0 00005CD6 B104 mov cl,4 0 00005CD8 D3E0 shl ax,cl ; convert to byte offset 0 00005CDA 01F8 add ax,di ; AX = offset from FFFF:0 2024 ReserveHMA10: 0 00005CDC 07 pop es 0 00005CDD C3 ret 2027 2028 2029 FreeHMA: 2030 ;------- 2031 ; Return reserved HMA space to pool 2032 ; On Entry: 2033 ; CX = offset of HMA block to relink (0 = noblock) 2034 ; On Exit: 2035 ; None 2036 ; 0 00005CDE E315 jcxz free_himem10 ; no block, don't recycle 0 00005CE0 06 push es 0 00005CE1 51 push cx ; save offset 0 00005CE2 2EC41E[0800] les bx,[cs:drdos_ptr] 0 00005CE7 58 pop ax ; recover offset 0 00005CE8 89C7 mov di,ax ; remember offset for later 0 00005CEA 26874710 xchg ax,[es:DRDOS_HIMEM_ROOT + bx]; become new head of HMA 0 00005CEE BBFFFF mov bx,0FFFFh 0 00005CF1 8EC3 mov es,bx ; point ES:DI at our section 0 00005CF3 AB stosw ; chain on rest of HMA 0 00005CF4 07 pop es 2048 free_himem10: 0 00005CF5 C3 ret 2050 2051 2052 rploader: 2053 ;-------- 2054 ; On Entry: 2055 ; DX = phase code 2056 ; On Exit: 2057 ; None, All regs preserved 0 00005CF6 06 push es 0 00005CF7 50 push ax 0 00005CF8 53 push bx 0 00005CF9 51 push cx 0 00005CFA 52 push dx 0 00005CFB A1[4B00] mov ax,[rpl_off] ; do we have an RPL sitting on 0 00005CFE 0B06[4D00] or ax,[rpl_seg] ; Int 13h 0 00005D02 7411 jz rploader10 0 00005D04 B8FF12 mov ax,12ffh ; magic cleanup call to RPL 0 00005D07 BB0500 mov bx,5 ; to do any tidy ups it wishes 0 00005D0A 31C9 xor cx,cx ; following resident BIOS 0 00005D0C BA0100 mov dx,1 ; initialisation 0 00005D0F 9C pushf 0 00005D10 FA cli 0 00005D11 FF1E[4B00] call far [rpl_entry] ; fake an INT 2073 rploader10: 0 00005D15 5A pop dx 0 00005D16 59 pop cx 0 00005D17 5B pop bx 0 00005D18 58 pop ax 0 00005D19 07 pop es 0 00005D1A C3 ret 2080 2081 Public Verify386 2082 2083 Verify386: 2084 ;--------- 2085 ; On Entry: 2086 ; None 2087 ; On Exit: 2088 ; CY clear if 386 or above 2089 ; 0 00005D1B 54 push sp ; really old CPU's inc SP 0 00005D1C 58 pop ax ; before pushing 0 00005D1D 39E0 cmp ax,sp ; newer ones push original SP 0 00005D1F 750C jne Verify386fail 0 00005D21 B80030 mov ax,3000h ; now try to set IOPL = 3 0 00005D24 50 push ax 0 00005D25 9D popf 0 00005D26 9C pushf 0 00005D27 5B pop bx 0 00005D28 21D8 and ax,bx ; any IOPL bits set ? 0 00005D2A 7401 jz Verify386fail 2101 ; clc ; it's at least a 386 0 00005D2C C3 ret 2103 Verify386fail: 0 00005D2D F9 stc ; it's not a 386 0 00005D2E C3 ret 2106 2107 ; append COMSPEC to config environment 2108 add_comspec_to_env proc 0 00005D2F 06 push es 0 00005D30 53 push bx 0 00005D31 1E push ds 0 00005D32 07 pop es 0 00005D33 833E[5A00]FF cmp word [comspec_env_offset],-1 ; COMSPEC= already present in env? 0 00005D38 7409 je @@search ; if not, search env end 0 00005D3A 8B3E[5A00] mov di,[comspec_env_offset] 0 00005D3E 83C708 add di,8 ; skip COMSPEC= 0 00005D41 EB21 jmp @@copy_shell ; COMSPEC= already there, update only filename 2118 @@search: 0 00005D43 BF[0000] mov di,offset envstart ; search end of environment 0 00005D46 803D00 cmp byte ptr [di],0 ; special case: environment empty? 0 00005D49 7408 je @@copy_comspec ; then skip right to setting COMSPEC 0 00005D4B 4F dec di 2123 @@search_next: 0 00005D4C 47 inc di 0 00005D4D 833D00 cmp word ptr [di],0 0 00005D50 75FA jne @@search_next 0 00005D52 47 inc di ; DI points to free part of env 2128 @@copy_comspec: 0 00005D53 893E[5A00] mov [comspec_env_offset],di ; remember comspec offset 0 00005D57 81FF[F8FF] cmp di,offset envend - 8 0 00005D5B 7319 jae @@err ; not much room enough to copy COMSPEC= 0 00005D5D BE[5200] mov si,offset comspec 0 00005D60 A5 movsw 0 00005D61 A5 movsw 0 00005D62 A5 movsw 0 00005D63 A5 movsw 2137 @@copy_shell: 0 00005D64 BE[0200] mov si,offset shell 2139 @@copy_next: 0 00005D67 81FF[0000] cmp di,offset envend 0 00005D6B 7309 jae @@err ; environment full!!! 0 00005D6D AC lodsb ; copy single filename char 0 00005D6E AA stosb 0 00005D6F 84C0 test al,al 0 00005D71 75F4 jnz @@copy_next 0 00005D73 AA stosb ; append second zero 0 00005D74 EB0E jmp @@ret 0 00005D76 8B3E[5A00] @@err: mov di,[comspec_env_offset] ; revert appending of comspec 0 00005D7A C7050000 mov word ptr [di],0 ; terminate env with double zero 0 00005D7E C706[5A00]FFFF mov word [comspec_env_offset],-1 ; set comspec not appended 0 00005D84 5B @@ret: pop bx 0 00005D85 07 pop es 0 00005D86 C3 ret 2154 add_comspec_to_env endp 2155 2156 copy_config_env_to_seg60 proc 0 00005D87 06 push es 0 00005D88 B86000 mov ax,60h 0 00005D8B 8EC0 mov es,ax 0 00005D8D BE[0000] mov si,offset envstart 0 00005D90 31FF xor di,di 0 00005D92 B98000 mov cx,80h 0 00005D95 F3A5 rep movsw 0 00005D97 C41E[0800] les bx,[drdos_ptr] 0 00005D9B 26894712 mov [es:DRDOS_ENVSEG + bx],ax ; tell COMMAND.COM where we are 0 00005D9F 07 pop es 0 00005DA0 C3 ret 2168 copy_config_env_to_seg60 endp 2169 2170 INITCODE ends 2171 === Switch to base=000000h -> "INITDATA" 2172 section INITDATA public align=2 class=INITDATA 2173 2174 2175 %include "initmsgs.mac" ; Include TFT Header File 1 <1> extrn _bad_break : byte 2 <1> extrn bad_break : byte 3 <1> extrn _bad_buffers : byte 4 <1> extrn bad_buffers : byte 5 <1> extrn _bad_command : byte 6 <1> extrn bad_command : byte 7 <1> extrn _bad_country : byte 8 <1> extrn bad_country : byte 9 <1> extrn _bad_drivparm : byte 10 <1> extrn bad_drivparm : byte 11 <1> extrn _bad_exec : byte 12 <1> extrn bad_exec : byte 13 <1> extrn _bad_fcbs : byte 14 <1> extrn bad_fcbs : byte 15 <1> extrn _bad_filename : byte 16 <1> extrn bad_filename : byte 17 <1> extrn _bad_files : byte 18 <1> extrn bad_files : byte 19 <1> extrn _bad_fopen : byte 20 <1> extrn bad_fopen : byte 21 <1> extrn _bad_history : byte 22 <1> extrn bad_history : byte 23 <1> extrn _bad_lastdrive : byte 24 <1> extrn bad_lastdrive : byte 25 <1> extrn _bad_shell : byte 26 <1> extrn bad_shell : byte 27 <1> extrn _bootpart_not_found_msg : byte 28 <1> extrn bootpart_not_found_msg : byte 29 <1> extrn _dos_msg : byte 30 <1> extrn dos_msg : byte 31 <1> extrn _no_char : byte 32 <1> extrn no_char : byte 33 <1> extrn _yes_char : byte 34 <1> extrn yes_char : byte 35 <1> extrn _run_char : byte 36 <1> extrn run_char : byte 37 <1> extrn _f5key_msg : byte 38 <1> extrn f5key_msg : byte 39 <1> extrn _f8key_msg : byte 40 <1> extrn f8key_msg : byte 2176 2177 2178 extrn history_flg:byte 2179 extrn next_drv:byte 2180 extrn dev_count:byte 2181 extrn lastdrvIn:byte 2182 extrn configPass:byte 2183 extrn part_off:word 2184 extrn cfg_head:word 2185 extrn cfg_tail:word 2186 extrn cfg_seeklo:word 2187 extrn cfg_seekhi:word 2188 extrn boot_options:word 2189 extrn boot_switches:byte 2190 extrn envstart:near 2191 extrn envend:near 2192 %if SVARDOS eq 0 0 000082A0 0000 drdosseg dw 0 0 000082A2 0000 drdoslen dw 0 2195 %endif 2196 2197 ; 2198 ; PUBLIC Variables which are initialised by the BIOS before the 2199 ; BIOSINIT code has been executed. 2200 ; 2201 data_start label byte ; used to para-align PSP & ENV 2202 2203 Public func52_ptr 2204 func52_ptr label dword ; address of internal BDOS variables 0 000082A4 0000 func52_off dw 0 ; offset " " " 0 000082A6 0000 func52_seg dw 0 ; segment " " " 2207 2208 Public drdos_ptr 2209 drdos_ptr label dword ; address of internal BDOS variables 0 000082A8 0000 drdos_off dw 0 ; offset " " " 0 000082AA 0000 drdos_seg dw 0 ; segment " " " 2212 2213 2214 Public res_ddsc_ptr 2215 res_ddsc_ptr label dword 0 000082AC 0000 res_ddsc_off dw 0 2217 Public res_ddsc_seg 0 000082AE 0000 res_ddsc_seg dw 0 2219 2220 Public rcode_offset, rcode_seg, icode_len, rcode_len, rcode_fixups 2221 0 000082B0 0000 rcode_offset dw 0 ; current offset of relocated code 0 000082B2 0000 rcode_seg dw 0 ; current segment of relocated code 0 000082B4 0000 icode_len dw 0 ; initial size of relocated code 0 000082B6 0000 rcode_len dw 0 ; final size of relocated code 0 000082B8 0000 rcode_fixups dw 0 ; offset of rcode fixup table 2227 2228 Public current_dos 0 000082BA 0000 current_dos dw 0 ; Current Segment Address of DOS Code 2230 2231 Public dos_target_seg, bios_target_seg 0 000082BC 0000 dos_target_seg dw 0 ; target address for DOS relocation 0 000082BE 0000 bios_target_seg dw 0 ; 0000 - auto-relocate 2234 ; FFFF - high memory (not allocated) 2235 ; xxxx - driver allocated address 2236 0 000082C0 0000 dosCodeParaSize dw 0 ; Size of DOS code in para's 2238 0 000082C2 A01F systemSize dw COMMAND_SIZE ; BIOS+DOS code sizes are added to 2240 ; give total size to reserve in HMA 2241 0 000082C4 0000 systemHMA dw 0 ; offset of area in HMA reserved 2243 ; for SYSTEM (BIOS/DOS/COMMAND) 0 000082C6 0000 commandHMA dw 0 ; offset of area in HMA reserved 2245 ; for COMMAND.COM 2246 2247 2248 Public device_root 0 000082C8 00000000 device_root dd 0 ; Root of Resident Device driver Chain 2250 2251 Public mem_size, ext_mem_size, comspec_drv 2252 Public init_flags, init_drv, init_int13_unit 2253 0 000082CC 0000 mem_size dw 0 ; Total Memory Size (in Paragraphs) 0 000082CE 0000 ext_mem_size dw 0 ; Total Extended Memory Size (in KB.) 0 000082D0 0000 init_flags dw 0 ; BIOS INIT Flags 0 000082D2 00 init_drv db 0 ; Boot Drive (A is 0 .....) 0 000082D3 00 init_int13_unit db 0 0 000082D4 00 comspec_drv db 0 ; Default COMSPEC Drive 2260 2261 Public num_stacks, stack_size 2262 0 000082D5 0000 num_stacks dw DEF_NUM_STACKS 0 000082D7 8000 stack_size dw DEF_SIZE_STACK 2265 2266 Public num_files, num_fcbs, num_fopen 2267 Public country_code, code_page 2268 0 000082D9 0100 num_files dw DEF_NUM_FILES ; # of file handles 0 000082DB 0400 num_fcbs dw DEF_NUM_FCBS ; # of fcb file handles 0 000082DD FFFF num_fopen dw -1 ; "unset" value for fast open 0 000082DF 0100 country_code dw DEF_COUNTRY ; Country Code 0 000082E1 0000 code_page dw DEF_CODEPAGE ; Code Page 2274 2275 %if SVARDOS 2276 %if SINGLEFILE eq 0 2277 Public dos_name 2278 dos_name db 'DRDOS SYS',0 ; default DOS filename 2279 %endif 2280 %endif 2281 0 000082E3 52504C4F41444552 rpl_name db 'RPLOADER' 2283 lengthof_rpl_name equ $ - rpl_name 2284 2285 rpl_entry label dword ; remember RPL entry point for 0 000082EB 0000 rpl_off dw 0 ; startup broadcasts 0 000082ED 0000 rpl_seg dw 0 2288 2289 ; 2290 ; Internal variables used by the BIOSINIT code 2291 ; 2292 Public bios_seg 2293 bios label dword ; Far pointer to the BIOS Cleanup 0 000082EF 0000 bios_offset dw 0 ; routines. 0 000082F1 0000 bios_seg dw 0 2296 2297 Public init_dseg 0 000082F3 0000 init_dseg dw 0 ; Init data segment 2299 2300 Public dos_dseg 0 000082F5 0000 dos_dseg dw 0 ; DOS Data Segment Address 2302 2303 Public mem_current_base, mem_current, mem_max 0 000082F7 0000 mem_first_base dw 0 ; Base of First Allocated Memory 0 000082F9 0000 mem_current_base dw 0 ; Base of Current Allocated Memory 0 000082FB 0000 mem_current dw 0 ; Next Free Paragraph 0 000082FD 0000 mem_max dw 0 ; Last available Paragraph 2308 2309 2310 dos_init label dword ; DOS Initialization Code 0 000082FF 0000 dos_coff dw 0 ; DOS Init Code Offset 0 00008301 0000 dos_cseg dw 0 ; DOS Init Code Segment 2313 0 00008303 0000 free_seg dw 0 ; First available paragraph. 2315 0 00008305 00000000 xms_driver dd 0 ; address of himem driver 2317 2318 Public hidos 0 00008309 00 hidos db 0 ; set true if HIDOS requested 0 0000830A 0000 himem_base dw 0 ; base of HIMEM seg allocations 0 0000830C 0000 himem_size dw 0 ; length of HIMEM seg allocations 2322 2323 Public hidosdata 0 0000830E 00 hidosdata db 0 2325 Public hiddscs 0 0000830F 00 hiddscs db 0 2327 Public hixbda 0 00008310 00 hixbda db 0 2329 2330 Public last_drv 2331 0 00008311 05 last_drv db 5 ; default is "E:" 2333 0 00008312 434F4E00 console db 'CON',0 ; Default Console Device 0 00008316 50524E00 printer db 'PRN',0 ; Default Printer Device 0 0000831A 41555800 auxilary db 'AUX',0 ; Default Auxilary Device 2337 0 0000831E 2449444C452400 idle_dev db '$IDLE$',0 ; Idle Device Name 0 00008325 0000 idle_off dw 0 ; Idle Data Area Offset 0 00008327 0000 idle_seg dw 0 ; Idle Data Area Segment 2341 0 00008329 002020202020202020 dummy_fcb db 0,' ' 0 00008332 202020 2343 0 00008335 0000 exec_env dw 0 ; Environment Segment 0 00008337 [AB00] exec_cloff dw shell_cline ; Command Line Offset 0 00008339 0000 exec_clseg dw 0 ; Command Line Segment 0 0000833B [8900] dw dummy_fcb 0 0000833D 0000 exec_fcb1seg dw 0 ; FCB 1 Offset and Segment 0 0000833F [8900] dw dummy_fcb 0 00008341 0000 exec_fcb2seg dw 0 ; FCB 2 Offset and Segment 0 00008343 00000000 dd 0 ; SS:SP 0 00008347 00000000 dd 0 ; CS:IP 2353 2354 Public shell_cline 0 0000834B 00 shell_cline db 0 ; Initial Command Line 0 0000834C 0D shell_drv db 0Dh 0 0000834D 000000000000000000 db 126 dup (0) 0 00008356 000000000000000000 0 0000835F 000000000000000000 0 00008368 000000000000000000 0 00008371 000000000000000000 0 0000837A 000000000000000000 0 00008383 000000000000000000 0 0000838C 000000000000000000 0 00008395 000000000000000000 0 0000839E 000000000000000000 0 000083A7 000000000000000000 0 000083B0 000000000000000000 0 000083B9 000000000000000000 0 000083C2 000000000000000000 2358 0 000083CB 000000 dummyVDISK db 0, 0, 0 ; jump instruction 0 000083CE 564449534B332E33 db 'VDISK3.3' ; OEM name 0 000083D6 8000 dw 128 ; bytes per sector 0 000083D8 01 db 1 ; sectors per allocation unit 0 000083D9 0100 dw 1 ; number of reserved sectors 0 000083DB 01 db 1 ; number of FATs 0 000083DC 2800 dw 40 ; number of root directory entries 0 000083DE 0002 dw 512 ; total number of sectors 0 000083E0 FE db 0FEh ; media descriptor byte 0 000083E1 0600 dw 6 ; sectors per FAT 0 000083E3 0800 dw 8 ; sectors per track 0 000083E5 0100 dw 1 ; number of heads 0 000083E7 0000 dw 0 ; number of hidden sectors 0 000083E9 4004 dw 1024+64 ; KB of extended memory used 2373 0 000083EB 000000000000000000 search_state db 43 dup (0) ; Search First/Next State 0 000083F4 000000000000000000 0 000083FD 000000000000000000 0 00008406 000000000000000000 0 0000840F 00000000000000 2375 2376 even 0 00008416 000000000000000000 dw 384 dup (0) ; big stack for ASPI4DOS.SYS driver 0 0000841F 000000000000000000 0 00008428 000000000000000000 0 00008431 000000000000000000 0 0000843A 000000000000000000 0 00008443 000000000000000000 0 0000844C 000000000000000000 0 00008455 000000000000000000 0 0000845E 000000000000000000 0 00008467 000000000000000000 0 00008470 000000000000000000 0 00008479 000000000000000000 0 00008482 000000000000000000 0 0000848B 000000000000000000 0 00008494 000000000000000000 0 0000849D 000000000000000000 0 000084A6 000000000000000000 0 000084AF 000000000000000000 0 000084B8 000000000000000000 0 000084C1 000000000000000000 0 000084CA 000000000000000000 0 000084D3 000000000000000000 0 000084DC 000000000000000000 0 000084E5 000000000000000000 0 000084EE 000000000000000000 0 000084F7 000000000000000000 0 00008500 000000000000000000 0 00008509 000000000000000000 0 00008512 000000000000000000 0 0000851B 000000000000000000 0 00008524 000000000000000000 0 0000852D 000000000000000000 0 00008536 000000000000000000 0 0000853F 000000000000000000 0 00008548 000000000000000000 0 00008551 000000000000000000 0 0000855A 000000000000000000 0 00008563 000000000000000000 0 0000856C 000000000000000000 0 00008575 000000000000000000 0 0000857E 000000000000000000 0 00008587 000000000000000000 0 00008590 000000000000000000 0 00008599 000000000000000000 0 000085A2 000000000000000000 0 000085AB 000000000000000000 0 000085B4 000000000000000000 0 000085BD 000000000000000000 0 000085C6 000000000000000000 0 000085CF 000000000000000000 0 000085D8 000000000000000000 0 000085E1 000000000000000000 0 000085EA 000000000000000000 0 000085F3 000000000000000000 0 000085FC 000000000000000000 0 00008605 000000000000000000 0 0000860E 000000000000000000 0 00008617 000000000000000000 0 00008620 000000000000000000 0 00008629 000000000000000000 0 00008632 000000000000000000 0 0000863B 000000000000000000 0 00008644 000000000000000000 0 0000864D 000000000000000000 0 00008656 000000000000000000 0 0000865F 000000000000000000 0 00008668 000000000000000000 0 00008671 000000000000000000 0 0000867A 000000000000000000 0 00008683 000000000000000000 0 0000868C 000000000000000000 0 00008695 000000000000000000 0 0000869E 000000000000000000 0 000086A7 000000000000000000 0 000086B0 000000000000000000 0 000086B9 000000000000000000 0 000086C2 000000000000000000 0 000086CB 000000000000000000 0 000086D4 000000000000000000 0 000086DD 000000000000000000 0 000086E6 000000000000000000 0 000086EF 000000000000000000 0 000086F8 000000000000000000 0 00008701 000000000000000000 0 0000870A 000000000000000000 0 00008713 000000 2378 stack label word 2379 0 00008716 00 res_dev_count db 0 0 00008717 0000 dosdata_len dw 0 0 00008719 0000 int_stubs_seg dw 0 2383 2384 INITDATA ends 2385 === Switch to base=000000h -> "INITPSP" 2386 section INITPSP public align=16 class=INITDATA 0 00009760 5A db 'Z' ; dummy DMD header 0 00009761 0800 dw 0008h ; owner is system 0 00009763 1000 dw 0010h ; length of PSP 0 00009765 000000 db 3 dup (0) ; pad to 8 bytes 0 00009768 444F530000000000 db 'DOS',0,0,0,0,0 ; name field (must be 8 bytes) 0 00009770 000000000000000000 psp db 16h dup (0) ; Zero Fill PSP Header 0 00009779 000000000000000000 0 00009782 00000000 0 00009786 0000 parent_psp dw 0 ; parent, patched to itself 0 00009788 FFFFFF db 0FFh, 0FFh, 0FFh ; STDIN, STDOUT, STDERR 0 0000978B FFFF db 0FFh, 0FFh ; STDAUX, STDPRN 0 0000978D FFFFFF db 0FFh, 0FFh, 0FFh ; Remainder CLOSED 0 00009790 FFFFFF db 0FFh, 0FFh, 0FFh 0 00009793 FFFFFF db 0FFh, 0FFh, 0FFh 0 00009796 FFFFFF db 0FFh, 0FFh, 0FFh 0 00009799 FFFFFF db 0FFh, 0FFh, 0FFh 0 0000979C 0000 dw 0000 ; PSP Environment Pointer 0 0000979E 00000000 dw 0000, 0000 ; DOS User SS:SP 0 000097A2 1400 dw 20 ; Maximum of 20 Handles 0 000097A4 1800 dw offset PSP_XFT ; Handle Table Offset 0 000097A6 0000 xftbl_seg dw 0 ; Handle Table Segment 0 000097A8 0000000000000000 db (offset PSP_VERSION - offset PSP_RES1) dup (0) 2407 Public dosVersion 0 000097B0 0700 dosVersion dw 7 ; DOS version is 7.0 0 000097B2 000000000000000000 db (PSPILEN - offset PSP_VERSION - 2) dup (0) 0 000097BB 000000000000000000 0 000097C4 000000000000000000 0 000097CD 000000 2410 ; PAD to Partial PSP Size 2411 INITPSP ends 2412 === Switch to base=000000h -> "INITENV" 2413 section INITENV public align=16 class=INITDATA 2414 0 000097D0 4F shell_ask db 79 ; max len 0 000097D1 00 shell_end db 0 ; end of the line 2417 Public shell 0 000097D2 413A5C434F4D4D414E shell db 'A:\COMMAND.COM', 0 0 000097DB 442E434F4D00 2419 lengthof_shell equ $ - shell 0 000097E1 000000000000000000 db (80-lengthof_shell) dup (0) 0 000097EA 000000000000000000 0 000097F3 000000000000000000 0 000097FC 000000000000000000 0 00009805 000000000000000000 0 0000980E 000000000000000000 0 00009817 000000000000000000 0 00009820 0000 0 00009822 434F4D535045433D comspec db 'COMSPEC=' 0 0000982A FFFF comspec_env_offset dw -1 ; comspec offset of environment 2423 2424 INITENV ends 2425 === Switch to base=000000h -> "DATAEND" 2426 section DATAEND public align=16 class=INITDATA 2427 DATAEND_start: 2428 2429 Public biosinit_end 2430 biosinit_end label byte 2431 DATAEND ends 2432 2433 end === Trace listing source: drbio/bin/config.lst 1 ; File : $CONFIG.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; 33 ; CONFIG.A86 1.35 93/12/01 18:30:29 34 ; nls_temp_area grows to 258 bytes 35 ; CONFIG.A86 1.34 93/11/28 15:30:27 36 ; Support HIBUFFERS in UMB's 37 ; CONFIG.A86 1.32 93/11/22 15:02:14 38 ; Bus Master checks do Int 21/0D before/after to discard any buffers 39 ; CONFIG.A86 1.30 93/11/18 18:02:26 40 ; Add primitive multi-master checking 41 ; CONFIG.A86 1.27 93/11/04 16:34:24 42 ; Extra callout to STACKER to determine if a drive is valid 43 ; CONFIG.A86 1.26 93/11/03 17:00:19 44 ; Stop dblspace phantom drives from appearing (FATsize=0) 45 ; CONFIG.A86 1.25 93/09/14 20:12:24 46 ; Initialise LFLG_PHYSICAL better - allow for zero FAT's meaning phantom drive 47 ; CONFIG.A86 1.24 93/09/02 22:34:50 48 ; Add header to system allocations 49 ; CONFIG.A86 1.23 93/08/06 20:55:23 50 ; re-arrange device init order for SCREATE.SYS on a VDISK.SYS 51 ; CONFIG.A86 1.22 93/08/02 14:45:55 52 ; hide preload drives from func_device 53 ; CONFIG.A86 1.20 93/07/28 19:19:08 54 ; call to SetupHMA before AllocHMA in setup_buffers allows buffers to go high 55 ; on novell memory managers 56 ; ENDLOG 57 58 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 59 %include "msdos.mac" 1 <1> ; File : $Workfile: MSDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; MSDOS.EQU 1.1 92/11/10 10:48:56 34 <1> ; Added to appslib source directory. 35 <1> ; ENDLOG 36 <1> 37 <1> MS_P_TERMCPM equ 00H 38 <1> MS_C_READ equ 01H 39 <1> MS_C_WRITE equ 02H 40 <1> MS_A_READ equ 03H 41 <1> MS_A_WRITE equ 04H 42 <1> MS_L_WRITE equ 05H 43 <1> MS_C_RAWIO equ 06H 44 <1> MS_C_RAWIN equ 07H 45 <1> MS_C_NOECHO equ 08H 46 <1> MS_C_WRITESTR equ 09H 47 <1> MS_C_READSTR equ 0aH 48 <1> MS_C_STAT equ 0bH 49 <1> MS_C_FLUSH equ 0cH 50 <1> MS_DRV_ALLRESET equ 0dH 51 <1> MS_DRV_SET equ 0eH 52 <1> MS_F_OPEN equ 0fH 53 <1> MS_F_CLOSE equ 10H 54 <1> MS_F_SFIRST equ 11H 55 <1> MS_F_SNEXT equ 12H 56 <1> MS_F_DELETE equ 13H 57 <1> MS_F_READ equ 14H 58 <1> MS_F_WRITE equ 15H 59 <1> MS_F_MAKE equ 16H 60 <1> MS_F_RENAME equ 17H 61 <1> MS_DRV_GET equ 19H 62 <1> MS_F_DMAOFF equ 1aH 63 <1> MS_DRV_ALLOC equ 1bH 64 <1> MS_DRV_ALLOCSPEC equ 1cH 65 <1> MS_F_READRAND equ 21H 66 <1> MS_F_WRITERAND equ 22H 67 <1> MS_F_SIZE equ 23H 68 <1> MS_F_RANDREC equ 24H 69 <1> MS_S_SETINT equ 25H 70 <1> MS_P_MKPSP equ 26H 71 <1> MS_F_READBLK equ 27H 72 <1> MS_F_WRITEBLK equ 28H 73 <1> MS_F_PARSE equ 29H 74 <1> MS_T_GETDATE equ 2aH 75 <1> MS_T_SETDATE equ 2bH 76 <1> MS_T_GETTIME equ 2cH 77 <1> MS_T_SETTIME equ 2dH 78 <1> MS_F_VERIFY equ 2eH 79 <1> MS_F_DMAGET equ 2fH 80 <1> MS_S_BDOSVER equ 30H 81 <1> MS_P_TERMKEEP equ 31H 82 <1> MS_S_BREAK equ 33H 83 <1> MS_S_GETINT equ 35H 84 <1> MS_DRV_SPACE equ 36H 85 <1> MS_S_COUNTRY equ 38H 86 <1> MS_X_MKDIR equ 39H 87 <1> MS_X_RMDIR equ 3aH 88 <1> MS_X_CHDIR equ 3bH 89 <1> MS_X_CREAT equ 3cH 90 <1> MS_X_OPEN equ 3dH 91 <1> MS_X_CLOSE equ 3eH 92 <1> MS_X_READ equ 3fH 93 <1> MS_X_WRITE equ 40H 94 <1> MS_X_UNLINK equ 41H 95 <1> MS_X_LSEEK equ 42H 96 <1> MS_X_CHMOD equ 43H 97 <1> MS_X_IOCTL equ 44H 98 <1> MS_X_DUP equ 45H 99 <1> MS_X_DUP2 equ 46H 100 <1> MS_X_CURDIR equ 47H 101 <1> MS_M_ALLOC equ 48H 102 <1> MS_M_FREE equ 49H 103 <1> MS_M_SETBLOCK equ 4aH 104 <1> MS_X_EXEC equ 4bH 105 <1> MS_X_EXIT equ 4cH 106 <1> MS_X_WAIT equ 4dH 107 <1> MS_X_FIRST equ 4eH 108 <1> MS_X_NEXT equ 4fH 109 <1> MS_P_SETPSP equ 50H 110 <1> MS_F_GETVERIFY equ 54H 111 <1> MS_X_RENAME equ 56H 112 <1> MS_X_DATETIME equ 57H 113 <1> MS_M_STRATEGY equ 58h 114 <1> MS_F_ERROR equ 59H 115 <1> MS_X_MKTEMP equ 5aH 116 <1> MS_X_MKNEW equ 5bH 117 <1> MS_F_LOCK equ 5cH 118 <1> MS_X_EXPAND equ 60H 119 <1> MS_P_GETPSP equ 62H 120 <1> MS_X_GETCP equ 6601h 121 <1> MS_X_SETCP equ 6602h 122 <1> MS_X_SETHC equ 67h 123 <1> MS_X_COMMIT equ 68h 124 <1> 125 <1> DOS_INT equ 21h ; DOS Entry Point 126 <1> ; 127 <1> STDIN equ 0 ; Standard Console Input Handle 128 <1> STDOUT equ 1 ; Standard Console Output Handle 129 <1> STDERR equ 2 ; Standard Error Output 130 <1> STDAUX equ 3 ; Auxilary Device Handle 131 <1> STDPRN equ 4 ; Printer Device Handle 60 %include "char.mac" 1 <1> ; File : $CHAR.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ;************************************************; 35 <1> ;* *; 36 <1> ;* Character Definitions *; 37 <1> ;* *; 38 <1> ;************************************************; 39 <1> 40 <1> CTLA equ 'A' - '@' 41 <1> CTLB equ 'B' - '@' 42 <1> CTLC equ 'C' - '@' 43 <1> CTLD equ 'D' - '@' 44 <1> CTLE equ 'E' - '@' 45 <1> CTLF equ 'F' - '@' 46 <1> CTLG equ 'G' - '@' 47 <1> BELL equ 'G' - '@' 48 <1> CTLH equ 'H' - '@' 49 <1> CTLI equ 'I' - '@' 50 <1> TAB equ 'I' - '@' 51 <1> CTLJ equ 'J' - '@' 52 <1> LF equ 'J' - '@' 53 <1> CTLK equ 'K' - '@' 54 <1> CTLM equ 'M' - '@' 55 <1> CR equ 'M' - '@' 56 <1> CTLP equ 'P' - '@' 57 <1> CTLQ equ 'Q' - '@' 58 <1> CTLR equ 'R' - '@' 59 <1> CTLS equ 'S' - '@' 60 <1> CTLT equ 'T' - '@' 61 <1> CTLU equ 'U' - '@' 62 <1> CTLV equ 'V' - '@' 63 <1> CTLW equ 'W' - '@' 64 <1> CTLX equ 'X' - '@' 65 <1> CTLY equ 'Y' - '@' 66 <1> CTLZ equ 'Z' - '@' 67 <1> ESC equ '[' - '@' 68 <1> CTLBS equ '\' - '@' 69 <1> CTLUB equ '_' - '@' 70 <1> CTLUP equ '^' - '@' 71 <1> DEL equ 07Fh 72 <1> RUBOUT equ DEL 73 <1> 74 <1> CTL equ '^' 61 %include "request.mac" 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 62 %include "driver.mac" 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 63 %include "fdos.mac" 1 <1> ; File : $FDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 35 <1> ; Structure of Buffer Control Blocks 36 <1> ; ---------------------------------- 37 <1> ; These BCBs immediately preceed the data buffers. BCBs are 38 <1> ; always shared for all drives and therefore must be big 39 <1> ; enough for the largest drive. 40 <1> ; 41 <1> 42 <1> labelsize BCB_NEXT, word, 00h ; link to next buffer 43 <1> labelsize BCB_PREV, word, 02h ; link to previous buffer 44 <1> labelsize BCB_DRV, byte, 04h ; drive of this buffer or 0FFh 45 <1> labelsize BCB_FLAGS, byte, 05h ; buffer flags 46 <1> labelsize BCB_REC, word, 06h ; low 16 bits of sector address 47 <1> labelsize BCB_REC2, word, 08h ; top 16 bits of sector address 48 <1> ;BCB_REC2 equ byte ptr 08h ; top 8 bits of record address 49 <1> labelsize BCB_COPIES, byte, 0Ah ; number of copies to write 50 <1> labelsize BCB_SEPARATION, word, 0Bh ; # sectors copies are apart 51 <1> labelsize BCB_DDSC, dword, 0Dh ; DWORD ptr to DDSC_ 52 <1> labelsize BCB_REMOTE, word, 11h ; remote in-use count 53 <1> labelsize BCB_DATA, byte, 14h ; buffer data 54 <1> 55 <1> BF_ISFAT equ 0002h ; buffer marked as FAT sector 56 <1> BF_ISDIR equ 0004h ; buffer marked as Directory sector 57 <1> BF_ISDAT equ 0008h ; buffer marked as Data sector 58 <1> BF_DIRTY equ 0040h ; buffer marked as modified 59 <1> BF_REMOTE equ 0080h ; buffer is remote 60 <1> 61 <1> MAX12 equ 0FF6h ; max. disk size w/ 12-bit media 62 <1> 63 <1> ; Structure of Hash Control Block 64 <1> ; ------------------------------- 65 <1> ; Each hash control block refers to the hash codes of one 66 <1> ; disrectory cluster or a root directory. 67 <1> 68 <1> labelsize HCB_LINK, word, 0 ; link to next control block 69 <1> labelsize HCB_DRV, byte, 2 ; drive for this entry or 0FFh 70 <1> labelsize HCB_CLU, word, 4 ; cluster number or 0000 if root 71 <1> labelsize HCB_CLUH, word, 6 ; high word of cluster number 72 <1> labelsize HCB_CNT, word, 8 ; number of hashed entries 73 <1> labelsize HCB_DATA, word, 10 ; hash buffer data 74 <1> 75 <1> 76 <1> ; Structure of DOS FCB 77 <1> ; -------------------- 78 <1> ; This is hopefully consistent with what DOS stores in an 79 <1> ; open file control block for DOS 1.x functions 80 <1> 81 <1> labelsize MSF_EXTFLG, byte, 0 ; if this is 0xFF, skip 1st 7 byte 82 <1> labelsize MSF_ATTRIB, byte, 6 ; file attributes if MSF_EXTFLG 83 <1> labelsize MSF_DRIVE, byte, 0 ; 1st byte normally drive code 84 <1> labelsize MSF_NAME, byte, 1 ; 8-bit ASCII file name, 11 characters 85 <1> labelsize MSF_BLOCK, word, 12 ; current block number 86 <1> labelsize MSF_RECSIZE, word, 14 ; current logical record size 87 <1> labelsize MSF_SIZE, word, 16 ; 32-bit file size 88 <1> labelsize MSF_DATE, word, 20 ; last date stamp 89 <1> labelsize MSF_TIME, word, 22 ; last time stamp 90 <1> labelsize MSF_IFN, byte, 24 ;; internal file number 91 <1> labelsize MSF_IOCTL, byte, 25 ;; file status 92 <1> labelsize MSF_BLOCK1, word, 26 ;; 1st block of file 93 <1> labelsize MSF_DBLK, word, 28 ;; directory block 94 <1> labelsize MSF_DEVPTR, dword, 28 ;; address of device driver 95 <1> labelsize MSF_DCNT, word, 30 ;; directory count 96 <1> labelsize MSF_CR, byte, 32 ; current sequential record 97 <1> labelsize MSF_RR, word, 33 ; random record address (3 or 4 byte) 98 <1> labelsize MSF_RR2, byte, 35 ; random record overflow 99 <1> 100 <1> 101 <1> ; Structure of DOS DPB 102 <1> ; -------------------- 103 <1> ; The layout of this structure is a guess based on 104 <1> ; examples. It is returned by PC MODE on functions 1Fh and 105 <1> ; 32h and is required by various disk-related utilities 106 <1> ; like disk editors and CHKDSK. 107 <1> 108 <1> labelsize DDSC_UNIT, byte, 0 ; absolute drive number 109 <1> labelsize DDSC_RUNIT, byte, 1 ; relative unit number 110 <1> labelsize DDSC_SECSIZE, word, 2 ; sector size in bytes 111 <1> labelsize DDSC_CLMSK, byte, 4 ; sectors/cluster - 1 112 <1> labelsize DDSC_CLSHF, byte, 5 ; log2 (sectors/cluster) 113 <1> labelsize DDSC_FATADDR, word, 6 ; sector address of FAT 114 <1> labelsize DDSC_NFATS, byte, 8 ; # of FAT copies 115 <1> labelsize DDSC_DIRENT, word, 9 ; size of root directory 116 <1> labelsize DDSC_DATADDR, word, 11 ; sector address of cluster #2 117 <1> labelsize DDSC_NCLSTRS, word, 13 ; # of clusters on disk 118 <1> labelsize DDSC_NFATRECS, word, 15 ; # of sectors per FAT 119 <1> labelsize DDSC_DIRADDR, word, 17 ; sector address of root dir 120 <1> labelsize DDSC_DEVHEAD, dword, 19 ; device driver header 121 <1> labelsize DDSC_DEVOFF, word, 19 122 <1> labelsize DDSC_DEVSEG, word, 21 123 <1> labelsize DDSC_MEDIA, byte, 23 ; current media byte 124 <1> labelsize DDSC_FIRST, byte, 24 ; "drive never accessed" flag 125 <1> labelsize DDSC_LINK, dword, 25 ; next drive's DDSC 126 <1> labelsize DDSC_BLOCK, word, 29 ; next block to allocate 127 <1> labelsize DDSC_FREE, word, 31 ; total free clusters on drive 128 <1> labelsize DDSC_BFREE, dword, 33 ; total free clusters on drive (32-bit) 129 <1> labelsize DDSC_FSFLAGS, word, 37 ; FAT mirroring flags 130 <1> labelsize DDSC_FSINFO, word, 39 ; sector number of file system info block 131 <1> labelsize DDSC_BOOTBAK, word, 41 ; sector number of backup boot sector 132 <1> labelsize DDSC_BDATADDR, dword, 43 ; sector address of cluster #2 (32-bit) 133 <1> labelsize DDSC_BCLSTRS, dword, 47 ; # of clusters on disk (32-bit) 134 <1> labelsize DDSC_BFATRECS, dword, 51 ; # of sectors per FAT (32-bit) 135 <1> labelsize DDSC_FSROOT, dword, 55 ; starting cluster of root directory 136 <1> labelsize DDSC_BBLOCK, dword, 59 ; next block to allocate (32-bit) 137 <1> labelsize DDSC_FSVER, word, 63 ; version of file system 138 <1> DDSC_LEN equ 65 139 <1> 140 <1> 141 <1> 142 <1> ; DELWATCH hooks called by OS 143 <1> 144 <1> DELW_RDMASK equ 0 ; delete dir search mask 145 <1> DELW_DELETE equ 2 ; delete this dir entry 146 <1> DELW_FREECLU equ 3 ; free some clusters 147 <1> DELW_FREERD equ 4 ; free root dir entry 148 <1> DELW_SPACE equ 5 ; add "deletes" to free space 149 <1> DELW_NEWDISK equ 7 ; new disk logged in 150 <1> DELW_PURGE equ 14 ; perge pd file 151 <1> DELW_UNDEL equ 15 ; undelete pd file 152 <1> 153 <1> ; SuperStore hook called by OS 154 <1> 155 <1> SSTOR_SPACE equ 10h ; enquire # physical free space 156 <1> 157 <1> ; Password hooks called by OS 158 <1> 159 <1> PASSWD_CREAT equ 20h ; initialise an entry 160 <1> PASSWD_CHMOD equ 21h ; change an entry 161 <1> PASSWD_CHECK equ 22h ; check an entry 162 <1> 163 <1> ; Share hooks in PCMODE data segment 164 <1> ; 165 <1> ; These point to a stub which does a "STC, RETF" 166 <1> ; 167 <1> 168 <1> NUM_SHARE_STUB_ENTRIES equ 15 169 <1> 170 <1> S_LOCKS equ 4*0 ; share lock/unlock region 171 <1> S_UPDATE equ 4*1 ; update DHNDL from share 172 <1> S_RECORD equ 4*2 ; update share from DHNDL 173 <1> S_FDOSRW equ 4*3 ; validate proposed operation 174 <1> S_DISCARD equ 4*4 ; discard all files on drive 175 <1> S_OPEN equ 4*5 ; files is opening, remember it 176 <1> S_CLOSE equ 4*6 ; files is closing, forget it 177 <1> S_OM_COMPAT equ 4*7 ; check open mode compatible 178 <1> S_CLOSE_IF_OPEN equ 4*8 ; close if compat open, else deny 179 <1> S_DENY_IF_OPEN equ 4*9 ; deny if open shared/by others 180 <1> S_GET_LIST_ENTRY equ 4*10 ; get open file list entry 181 <1> S_CLOSE_FILES equ 4*11 ; close all files for given PSP/UID 182 <1> 183 <1> ; struct dirfcb 184 <1> 185 <1> labelsize DNAME, byte, 0 ;file name & type 186 <1> labelsize DATTS, byte, 11 187 <1> DA_RO equ 01h ; 0x01 - read/only 188 <1> DA_HIDDEN equ 02h ; 0x02 - hidden 189 <1> DA_SYSTEM equ 04h ; 0x04 - system 190 <1> DA_VOLUME equ 08h ; 0x08 - volume label 191 <1> DA_DIR equ 10h ; 0x10 - sub-directory 192 <1> DA_ARCHIVE equ 20h ; 0x20 - archive 193 <1> DA_CLUSTER equ 80h ; 0x80 - return starting cluster from search (API extention) 194 <1> DA_DELWATCH equ 80h ; 0x88 - return pending delete files 195 <1> DA_FIXED equ 11011000b ; can't CHMOD label, dir, unused bits 196 <1> DA_CHANGE equ ~ DA_FIXED ; all others are changeable 197 <1> 198 <1> ;DATTS2 equ 12 ;CP/M attributes 199 <1> ; ; 0x80 - f1' modify default open rules 200 <1> ; ; 0x40 - f2' partial close default 201 <1> ; ; 0x20 - f3' ignore close checksum errors 202 <1> ; ; 0x10 - f4' disable checksums 203 <1> ; ; 0x08 - (reserved) 204 <1> ; ; 0x04 - DELETE password 205 <1> ; ; 0x02 - WRITE password 206 <1> ; ; 0x01 - READ password 207 <1> DSIZEX equ 12 ;file size extension for FAT+ (bit 0-2 and 5-7) 208 <1> DUNDEL equ 13 ;1st letter of deleted file 209 <1> labelsize DPWD, word, 14 ;16-bit password hash code 210 <1> labelsize DMODTIME, word, 16 ;delwatch time (hhhhhmmmmmmsssss) 211 <1> labelsize DMODDATE, word, 18 ;delwatch date (yyyyyyymmmmddddd) 212 <1> ;DRECSIZE equ 16 ;FlexOS record size 213 <1> ;DUSER equ 18 ;FlexOS user ID of creator 214 <1> ;DGROUP equ 19 ;FlexOS group ID of creator 215 <1> labelsize DPWM, word, 20 ;FlexOS access rights 216 <1> labelsize DBLOCK1H, word, 20 ;high word of first block in file 217 <1> DTIME equ 22 ;time (hhhhhmmmmmmsssss) 218 <1> DDATE equ 24 ;date (yyyyyyymmmmddddd) 219 <1> DBLOCK1 equ 26 ;first block in file 220 <1> DSIZE equ 28 ;current file size 221 <1> 222 <1> ; DOS Media Password Definitions 223 <1> ; ------------------------------ 224 <1> 225 <1> PWM_OWNER equ 000Fh ; PWD Owner mask 226 <1> PWM_GROUP equ 00F0h ; PWD Group mask 227 <1> PWM_WORLD equ 0F00h ; PWD World mask 228 <1> PWM_R equ 0888h ; PWD required for reading 229 <1> PWM_W equ 0444h ; PWD required for writing 230 <1> PWM_E equ 0222h ; PWD req'd for executing 231 <1> PWM_D equ 0111h ; PWD required for deleting 232 <1> PWM_ANY equ PWM_R+PWM_W+PWM_D ; PWD required for anything 233 <1> 234 <1> 235 <1> ; literal constants 236 <1> 237 <1> FAT12 equ 00fffh ; 12 bit fat 238 <1> FAT16 equ 0ffffh ; 16 bit fat 239 <1> FAT32 equ 0 ; 32 bit fat 240 <1> 241 <1> ENDDIR equ 0ffffh ;end of directory 242 <1> 64 %include "f52data.mac" ; Function 52 DOS Data Area 1 <1> ; File : $F52DATA.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; The following equates define the Data Area whose address is 35 <1> ; returned by function 52. 36 <1> ; 37 <1> 38 <1> labelsize F52_BCBBUF, dword, -0008h ; current buffer 39 <1> labelsize F52_BCBOFF, word, -0008h ; current buffer 40 <1> labelsize F52_BCBSEG, word, -0006h ; current buffer 41 <1> labelsize F52_DMDROOT, word, -0002h ; Memory Descriptor Root (Seg) 42 <1> labelsize F52_DDSCPTR, dword, 0000h ; DDSC Table Address 43 <1> labelsize F52_FILEPTR, dword, 0004h ; File Handle Table Address 44 <1> labelsize F52_CLKDEV, dword, 0008h ; Clock Device Header 45 <1> labelsize F52_CONDEV, dword, 000Ch ; Console Device Header 46 <1> labelsize F52_SECSIZE, word, 0010h ; Maximum Sector Size 47 <1> labelsize F52_BUFINFOPTR, dword, 0012h ; Buffer Info pointer 48 <1> labelsize F52_PATHPTR, dword, 0016h ; Path Control Table Address 49 <1> labelsize F52_PATHOFF, word, 0016h 50 <1> labelsize F52_PATHSEG, word, 0018h 51 <1> labelsize F52_FCBPTR, dword, 001Ah ; FCB Table Address 52 <1> ; equ word ptr 001Eh ; #Entries in FCB Table 53 <1> labelsize F52_PHYDRV, byte, 0020h ; Last Physical Drive 54 <1> labelsize F52_LASTDRV, byte, 0021h ; Last Logical Drive 55 <1> labelsize F52_DEVROOT, dword, 0022h ; Root Device Header 56 <1> labelsize F52_JOINDRV, byte, 0034h ; Number of JOIN'd drives 57 <1> labelsize F52_SETVER, dword, 0037h ; SETVER table pointer 58 <1> labelsize F52_NUM_BUF, word, 003Fh ; number of disk buffers 59 <1> labelsize F52_READ_AHEAD, word, 0041h ; size of read-ahead buffer 60 <1> labelsize F52_BOOTDRV, byte, 0043h ; boot drive (1-26) 61 <1> labelsize F52_CPU_TYPE, byte, 0044h ; 01 if >= 386SX 62 <1> labelsize F52_EXT_MEM, word, 0045h ; Int 15h, AH=87h 63 <1> labelsize F52_BUF_INFO, dword, 0047h ; points at Buffer Info 64 <1> labelsize F52_HMAFLAG, byte, 0053h ; 1 if buffers in HMA 65 <1> labelsize F52_DEBLOCK, word, 0056h ; deblock if buffers in HMA 66 <1> labelsize F52_DMD_UPPER, word, 0066h ; upper memory chain 67 <1> labelsize F52_SHARE_STUB, dword, 006Ah ; Share Stub Entries*15 68 <1> 69 <1> ;DRDOS Specific 70 <1> 71 <1> labelsize DRDOS_CRITSTUBS, word, 0000h ; Offset of end of instance data 72 <1> labelsize DRDOS_HIST1CTL, word, 0004h ; History 1 Control 73 <1> labelsize DRDOS_HIST2CTL, word, 0006h ; History 2 Control 74 <1> labelsize DRDOS_HISTFLG, byte, 0008h ; History Buffer Flag 75 <1> labelsize DRDOS_DUAL_LANG, byte, 0009h ; Utils Dual Language Support 76 <1> labelsize DRDOS_CUR_LANG, byte, 000Ah ; Current Language 77 <1> labelsize DRDOS_EXT_MEM, word, 000Bh ; Total Extended Memory 78 <1> labelsize DRDOS_HIMEM_ROOT, word, 0010h ; High memory chain 79 <1> labelsize DRDOS_ENVSEG, word, 0012h ; Seg of environment 80 <1> labelsize DRDOS_DMD_BASE, word, 0016h ; base memory freed at 81 <1> labelsize DRDOS_DMD_UPPER, word, 0018h ; upper memory chain 82 <1> labelsize DRDOS_MACHINE_ID, word, 001Ah ; local machine ID 83 <1> labelsize DRDOS_COUNTRY_FILE, word, 001Eh ; offset of filename 84 <1> labelsize DRDOS_HASHOFF, word, 0020h ; fastopen hash root 85 <1> labelsize DRDOS_HASHSEG, word, 0022h ; pointer 86 <1> labelsize DRDOS_HASHMAX, word, 0024h ; max # dir entries 87 <1> labelsize DRDOS_DEBLOCK, word, 0026h ; himem deblock buffer 88 <1> labelsize DRDOS_INT2F, word, 002Ch ; internal Int 2F hook 65 %include "doshndl.mac" ; DOS Handle Structure Definition 1 <1> ; File : $DOSHNDL.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> labelsize DCNTRL_DSADD, dword, 0000h 36 <1> labelsize DCNTRL_DSOFF, word, 0000h 37 <1> labelsize DCNTRL_DSSEG, word, 0002h 38 <1> labelsize DCNTRL_COUNT, word, 0004h 39 <1> DCNTRL_LEN equ 6 40 <1> 41 <1> labelsize DHNDL_COUNT, word, 00h ; 00 - Usage Count 42 <1> labelsize DHNDL_MODE, word, 02h ; 02 - File Mode 43 <1> 44 <1> DHM_FCB equ 8000h ; marks as FCB 45 <1> DHM_COMMIT equ 4000h ; auto-commit file 46 <1> DHM_NOCRIT equ 2000h ; no critical errors 47 <1> DHM_LOCAL equ 10000000b ; file is not inherited 48 <1> DHM_SHAREMSK equ 01110000b ; sharing bits 49 <1> DHM_COMPAT equ 00000000b 50 <1> DHM_DENY_ALL equ 00010000b ; exclusive - deny all 51 <1> DHM_DENY_WRITE equ 00100000b 52 <1> DHM_DENY_READ equ 00110000b 53 <1> DHM_DENY_NONE equ 01000000b 54 <1> DHM_RWMSK equ 00001111b ; read write bits 55 <1> DHM_RW equ 00000010b ; file opened read/write 56 <1> DHM_WO equ 00000001b ; file opened write only 57 <1> DHM_RO equ 00000000b ; file opened read only 58 <1> 59 <1> ; 60 <1> ; 01h to 03h To be Determined 61 <1> ; 62 <1> labelsize DHNDL_DATRB, byte, 04h ; Disk attribute byte 63 <1> labelsize DHNDL_ATTR, byte, 05h ; Attribute Byte 64 <1> labelsize DHNDL_WATTR, word, 05h ; Attribute Word 65 <1> 66 <1> DHAT_REMOTE equ 8000h ; set if file remote 67 <1> DHAT_TIMEOK equ 4000h ; set if timestamp up to date 68 <1> DHAT_LOCAL equ 1000h ; file is not inherited 69 <1> DHAT_NETPRN equ 0800h ; device is networked printer 70 <1> DHAT_DEV equ 0080h ; device/file bit 71 <1> DHAT_READY equ 0040h ; ready/not ready bit 72 <1> DHAT_CLEAN equ 0040h ; this bit CLEAR if dirty 73 <1> DHAT_BIN equ 0020h ; raw/cooked bit 74 <1> DHAT_DRVMSK equ 001Fh ; drive in bottom bits 75 <1> DHAT_CLK equ 0008h ; -reserved- 76 <1> DHAT_NUL equ 0004h ; handle is null device 77 <1> DHAT_COT equ 0002h ; handle is console output device 78 <1> DHAT_CIN equ 0001h ; handle is console input device 79 <1> 80 <1> labelsize DHNDL_DEVPTR, dword, 07h ; 07 - pointer to device 81 <1> labelsize DHNDL_DEVOFF, word, 07h ; 07 - offset of device 82 <1> labelsize DHNDL_DEVSEG, word, 09h ; 09 - segment of device 83 <1> labelsize DHNDL_BLK1, word, 0Bh ; 0B - first cluster in file 84 <1> ; (lower 32 bits) 85 <1> labelsize DHNDL_TIME, word, 0Dh ; 0D - file time stamp 86 <1> labelsize DHNDL_DATE, word, 0Fh ; 0F - file date stamp 87 <1> labelsize DHNDL_SIZE, dword, 11h ; 11 - file length 88 <1> ; (lower 32 bits) 89 <1> labelsize DHNDL_SIZELO, word, 11h 90 <1> labelsize DHNDL_SIZEHI, word, 13h 91 <1> labelsize DHNDL_POS, dword, 15h ; 15 - current file position 92 <1> ; (lower 32 bits) 93 <1> labelsize DHNDL_POSLO, word, 15h 94 <1> labelsize DHNDL_POSHI, word, 17h 95 <1> labelsize DHNDL_IDX, word, 19h ; 19 - relative cluster within file of last read 96 <1> ; (lower 32 bits) 97 <1> labelsize DHNDL_DBLK, word, 1Bh ; 1B - cluster # of dir entry 98 <1> ; (lower 32 bits) 99 <1> labelsize DHNDL_DCNTHI, byte, 1Eh ; 1E - dir offset # within cluster 100 <1> labelsize DHNDL_DCNTLO, byte, 1Fh ; 1F - dir offset # within cluster 101 <1> labelsize DHNDL_NAME, byte, 20h ; 20 - File/Device Name 102 <1> labelsize DHNDL_EXT, byte, 28h ; 28 - File extension 103 <1> labelsize DHNDL_SFT, dword, 2Bh ; 2B - pointer to previous SFT 104 <1> labelsize DHNDL_UID, word, 2Fh ; 2F - Owning Machine ID 105 <1> labelsize DHNDL_PSP, word, 31h ; 31 - Owning PSP 106 <1> labelsize DHNDL_SHARE, word, 33h ; 33 - Offset of sharing record 107 <1> labelsize DHNDL_BLK, word, 35h ; 35 - absolute cluster of last read 108 <1> ; (lower 32 bits) 109 <1> ; 37 - dword reserved for IFS 110 <1> labelsize DHNDL_BLK1H, word, 3Bh ; 3B - first cluster in file 111 <1> ; (higher 32 bits) 112 <1> labelsize DHNDL_IDXH, word, 3Dh ; 3D - relative cluster within file of last read 113 <1> ; (higher 32 bits) 114 <1> labelsize DHNDL_DBLKH, word, 3Fh ; 3F - cluster # of dir entry 115 <1> ; (higher 32 bits) 116 <1> labelsize DHNDL_BLKH, word, 41h ; 41 - absolute cluster of last read 117 <1> ; (higher 32 bits) 118 <1> labelsize DHNDL_SIZEX, dword, 43h ; 43 - file length 119 <1> ; (higher 32 bits) 120 <1> labelsize DHNDL_SIZEXLO, word, 43h 121 <1> labelsize DHNDL_SIZEXHI, word, 45h 122 <1> labelsize DHNDL_POSX, dword, 47h ; 47 - current file position 123 <1> ; (higher 32 bits) 124 <1> labelsize DHNDL_POSXLO, word, 47h 125 <1> labelsize DHNDL_POSXHI, word, 49h 126 <1> DHNDL_LEN equ 4Bh 127 <1> 128 <1> ; With DOS 3 structures _DBLK is a 16 bit 129 <1> 130 <1> 131 <1> ; Logical Drive Table format 132 <1> labelsize LDT_NAME, byte, 00h ; 00 - Ascii Name field 133 <1> labelsize LDT_FLAGS, word, 43h ; 43 - Flag field 134 <1> labelsize LDT_PDT, dword, 45h ; 45 - PDT for this drive 135 <1> labelsize LDT_BLK, word, 49h ; 49 - directory sector 136 <1> labelsize LDT_ROOT, word, 4bh ; 4B - virtual block root 137 <1> labelsize LDT_DRV, byte, 4dh ; 4D - physical drive 138 <1> labelsize LDT_ROOTLEN, word, 4fh ; 4F - Length of root portion 139 <1> labelsize LDT_BLKH, word, 51h 140 <1> labelsize LDT_ROOTH, word, 53h 141 <1> LDT_LEN equ 58h 142 <1> 143 <1> LFLG_NETWRKD equ 8000h 144 <1> LFLG_PHYSICAL equ 4000h 145 <1> LFLG_JOINED equ 2000h 146 <1> LFLG_SUBST equ 1000h 66 %include "country.mac" 1 <1> ; File : $COUNTRY.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> US_DATE equ 0 ; American Date Format mm/dd/yy 36 <1> EURO_DATE equ 1 ; European Date Format dd/mm/yy 37 <1> JAP_DATE equ 2 ; Japanese Date Format yy/mm/dd 38 <1> 39 <1> CLOCK_12 equ 0 ; 12 Hour Clock Time Format 40 <1> CLOCK_24 equ 1 ; 24 Hour Clock Time Format 41 <1> 42 <1> labelsize CI_CODE, word, 0FFFCh ; Country Code 43 <1> labelsize CI_CODEPAGE, word, 0FFFEh ; Code page 44 <1> labelsize CI_DATEFMT, word, 0 ; Date Format 45 <1> labelsize CI_CURRENCY, byte, 2 ; Currency Symbols 46 <1> labelsize CI_THOUSANDS, byte, 7 ; Thousands Separator 47 <1> labelsize CI_DECIMAL, byte, 9 ; Decimal Separator 48 <1> labelsize CI_DATESEP, byte, 11 ; Date Separator 49 <1> labelsize CI_TIMESEP, byte, 13 ; Time Separator 50 <1> labelsize CI_CURFMT, byte, 15 ; Currency Format 51 <1> labelsize CI_CURDIGITS, byte, 16 ; Significant Currency Digits 52 <1> labelsize CI_TIMEFMT, byte, 17 ; Time Format 53 <1> labelsize CI_CASEOFF, word, 18 ; Case Translation Offset 54 <1> labelsize CI_CASESEG, word, 20 ; Case Translation Segment 55 <1> labelsize CI_DATASEP, byte, 22 ; Data List Separator 56 <1> CI_STATICLEN equ 24 ; Static Country Data Length 57 <1> CI_LENGTH equ 32 ; Total Country Data Length 58 <1> 59 <1> labelsize EXI_ID, byte, 0 ; Information ID 60 <1> labelsize EXI_TBLOFF, word, 1 ; Table Offset 61 <1> labelsize EXI_TBLSEG, word, 3 ; Table Segment 62 <1> 63 <1> labelsize EXI_ID1, byte, 0 ; 6501 Info ID (why move it?!) 64 <1> labelsize EXI_LENGTH, word, 1 ; 6501 Table Length 65 <1> EXI_DATA_LEN equ 3 ; 6501 Country Data 66 <1> 67 <1> labelsize EXCI_CUR_COUNTRY, word, 0 ; Current Country 68 <1> labelsize EXCI_CUR_CP, word, 2 ; Current Codepage 69 <1> EXCI_CI_DATAOFF equ 4 ; Start of CI_ data 70 <1> 71 <1> EXCI_STATLEN equ CI_STATICLEN+4 ; Static Ext Country Info 72 <1> EXCI_MAXLEN equ EXCI_STATLEN+10+EXI_DATA_LEN ; Max Ext Country Info 73 <1> 67 68 TRUE equ 0FFFFh ; value of TRUE 69 FALSE equ 0 ; value of FALSE 70 71 group CGROUP INITCODE INITDATA 72 ASSUME CS:CGROUP,DS:CGROUP 73 === Switch to base=000000h -> "INITCODE" 74 section INITCODE public align=16 class=INITCODE 75 76 extrn AllocHMA:near 77 extrn SetupHMA:near 78 extrn alloc_instseg:near ; Allocate "Segment" Instance Memory 79 extrn alloc_hiseg:near ; Allocate "Segment" Upper or Low Memory, depending on hidos flag 80 extrn alloc_seg:near ; Allocate "Segment" Memory 81 extrn alloc_upper:near ; Allocate "Segment" Upper Memory 82 extrn config_process:near 83 extrn InitStacks:near 84 extrn HookInt2F:near 85 extrn UnhookInt2F:near 86 extrn Verify386:near 87 extrn preload_done:near 88 extrn get_boot_options:near 89 90 Public config_init 91 config_init: ; Initialize the CONFIG data 0 00005DB0 C3 ret 93 94 95 Public country_init 96 country_init: 97 ;------------ 0 00005DB1 1E push ds 0 00005DB2 06 push es 0 00005DB3 57 push di 0 00005DB4 56 push si 102 103 ; Obtain the address of the DBCS table in the BDOS. 0 00005DB5 B80765 mov ax, 06507h ; Extended Country Info: get DBCS ptr 0 00005DB8 BBFFFF mov bx, 0FFFFh ; codepage number: -1 for global cp 0 00005DBB B90500 mov cx, 00005h ; size of info. buffer 0 00005DBE BAFFFF mov dx, 0FFFFh ; country code: -1 for current country 0 00005DC1 BF[9906] mov di, offset dbcs_buf 0 00005DC4 1E push ds 0 00005DC5 07 pop es ; es:di -> 5 byte buffer 0 00005DC6 CD21 int DOS_INT ; returns with buffer filled in 112 113 ; Get the current country information. 0 00005DC8 BA[9E06] mov dx, offset ctry_info ; ds:dx -> buffer to be filled in 0 00005DCB B80038 mov ax, 03800h ; get current country info 0 00005DCE CD21 int DOS_INT 0 00005DD0 730F jnc ctry_info_done ; no carry = no error 118 119 ; Failed to get country info. Place dummy uppercase routine in table. 0 00005DD2 BE[9E06] mov si, offset ctry_info 0 00005DD5 C74412[3A00] mov word [CI_CASEOFF + si], offset myretf 0 00005DDA 8C4C14 mov [CI_CASESEG + si], cs 0 00005DDD 8B1E[0000] mov bx, [country_code] 124 125 ctry_info_done: 0 00005DE1 891E[0000] mov [country_code], bx 127 0 00005DE5 5E pop si 0 00005DE6 5F pop di 0 00005DE7 07 pop es 0 00005DE8 1F pop ds 0 00005DE9 C3 ret 133 0 00005DEA CB myretf: retf 135 136 ; 137 ; CONFIG is called after the BIOS INIT code has been relocated to high 138 ; memory, the BIOS and BDOS have been initialised. 139 ; 140 Public config ; Process CONFIG.SYS, loading and 141 config: ; initialising device drivers 0 00005DEB E8C3FF call country_init ; initialise DBCS tbl and country info 0 00005DEE A1[1501] mov ax,[max_secsize] ; get maximum sector size in BIOS 0 00005DF1 C41E[0000] les bx,[func52_ptr] 0 00005DF5 263B4710 cmp ax,[es:F52_SECSIZE + bx] ; larger than default? 0 00005DF9 7604 jbe cfg_skip ; skip if not 0 00005DFB 26894710 mov [es:F52_SECSIZE + bx],ax ; else update sector size 148 cfg_skip: 0 00005DFF E86E00 call cpu_init ; initialise CPU type 0 00005E02 1E push ds 0 00005E03 07 pop es 152 0 00005E04 E8[0000] call config_process ; Process CONFIG.SYS 154 0 00005E07 E8[0000] call get_boot_options ; look for user keypress 0 00005E0A A3[0000] mov [boot_options],ax ; return any options 0 00005E0D 3D003F cmp ax,F5KEY 0 00005E10 750A jne cfg_no_f5 0 00005E12 8D16[0000] lea dx,[f5key_msg] 0 00005E16 B409 mov ah,MS_C_WRITESTR 0 00005E18 CD21 int DOS_INT 0 00005E1A EB0D jmp short cfg_no_f8 163 cfg_no_f5: 0 00005E1C 3D0042 cmp ax,F8KEY 0 00005E1F 7508 jne cfg_no_f8 0 00005E21 8D16[0000] lea dx,[f8key_msg] 0 00005E25 B409 mov ah,MS_C_WRITESTR 0 00005E27 CD21 int DOS_INT 169 cfg_no_f8: 170 0 00005E29 C606[F406]01 mov byte [configPass],1 ; second pass of CONFIG.SYS 0 00005E2E C706[0000]0000 mov word [cfg_head],0 0 00005E34 C706[0000]0000 mov word [cfg_tail],0 0 00005E3A C706[0000]0000 mov word [cfg_seeklo],0 0 00005E40 C706[0000]0000 mov word [cfg_seekhi],0 0 00005E46 E8[0000] call preload_done 177 0 00005E49 833E[0000]08 cmp word [num_files],MIN_NUM_FILES ; Ensure the Minimum number of File 0 00005E4E 7306 jae cfg_ex10 ; have been allocated. 0 00005E50 C706[0000]0800 mov word [num_files],MIN_NUM_FILES 181 cfg_ex10: 0 00005E56 31C0 xor ax,ax 0 00005E58 A0[0601] mov al,[init_buf] ; now ensure we have allocated 0 00005E5B A3[BE06] mov [num_buf],ax ; the correct number of buffers 185 0 00005E5E E81F00 call SetupDeblocking ; do our thing with deblocking 187 0 00005E61 C606[F406]02 mov byte [configPass],2 0 00005E66 E82605 call config_finish ; clean up configuration 0 00005E69 E82C07 call setup_fopen ; allocate disk hashing 0 00005E6C E85801 call setup_history 0 00005E6F C3 ret 193 194 cpu_init: 195 ; If we are on a 386 or above set CPU flag 0 00005E70 E8[0000] call Verify386 ; make sure it's a 386 0 00005E73 7209 jc cpu_init10 ; skip setting falg if not 0 00005E75 C41E[0000] les bx,[func52_ptr] 0 00005E79 26C6474401 mov byte [es:F52_CPU_TYPE + bx],1 ; we have a 386 ! 200 cpu_init10: 0 00005E7E F9 stc ; it's not a 386 0 00005E7F C3 ret 203 204 205 SetupDeblocking: 206 ;--------------- 207 ; Some types of hard disk controller give us problems with disk access of 208 ; mapped memory (eg. upper memory, LIM pages). 209 ; We can force single sector deblocking in the disk driver to avoid these 210 ; problems. On DRDOS 5/6 our default was single sector I/O above A000, but 211 ; this gives performance problems when devices/tsr's are loaded into upper 212 ; memory (eg. STACKER, SERVER). To avoid this we use the following strategy. 213 ; 214 ; Default for CONFIG is A000, and may be updated at any time by a DEBLOCK= 215 ; statement. If this happens the user setting has priority. 216 ; 217 ; At the end of CONFIG, assume no user supplied setting, we do some simple 218 ; tests for multi-master controllers. If these fail we leave the settings 219 ; at A000. If they succeed we go ahead and change the default setting to 220 ; deblock at FFFF. The test is to read the 1st sector into low memory, and 221 ; again into upper memory. If we read the same thing then assume all is well. 222 ; If we can't do this leave the deblocking set at A000. 223 ; 224 ; NB. We will still have problems from LIM, and from DMA crossing page 225 ; boundaries on some memory managers (eg. DRDOS 5.0) 226 ; 0 00005E80 C41E[0000] les bx,[func52_ptr] 0 00005E84 8D5F22 lea bx,[F52_DEVROOT + bx] ; ES:BX -> NUL device link 0 00005E87 803E[F306]00 cmp byte [DeblockSetByUser],FALSE 0 00005E8C 7403 je SetupDeblocking20 ; the user is king 231 SetupDeblocking10: 0 00005E8E 0E push cs 0 00005E8F 07 pop es ; ES -> local data again 0 00005E90 C3 ret 235 236 SetupDeblocking20: ; get next device driver 0 00005E91 26C41F les bx,[es:bx] ; we want resident disk device 0 00005E94 83FBFF cmp bx,0FFFFh ; end of the chain ? 0 00005E97 74F5 je SetupDeblocking10 0 00005E99 26F747040080 test word ptr [es:4 + bx],8000h 0 00005E9F 75F0 jnz SetupDeblocking20 ; we assume one disk device at 70:xxxx 0 00005EA1 8CC0 mov ax,es 0 00005EA3 2E3B06[0000] cmp ax,[cs:bios_seg] ; scan for resident disk in IO.SYS 0 00005EA8 75E7 jne SetupDeblocking20 0 00005EAA 26817F12DC0E cmp word ptr [es:18 + bx],0EDCh 0 00005EB0 75DF jne SetupDeblocking20 ; is it our disk driver ? 0 00005EB2 8D4716 lea ax,[22 + bx] ; deblocking variable is here 0 00005EB5 A3[EF06] mov [deblockOffset],ax ; remember that for fixups 0 00005EB8 8C06[F106] mov [deblockSeg],es 250 DEVHDR.STRATEGY equ STRATEGY ; NASM port label 0 00005EBC 268B4706 mov ax,[es:DEVHDR.STRATEGY + bx] ; Set up the STRATEGY Entry Point 0 00005EC0 A3[1B02] mov [strategy_off],ax 0 00005EC3 8C06[1D02] mov [strategy_seg],es 254 255 DEVHDR.INTERRUPT equ INTERRUPT ; NASM port label 0 00005EC7 268B4708 mov ax,[es:DEVHDR.INTERRUPT + bx] ; Set up the INTERRUPT Entry Point 0 00005ECB A3[1F02] mov [interrupt_off],ax 0 00005ECE 8C06[2102] mov [interrupt_seg],es 259 DEVHDR.NAM equ NAM ; NASM port label 0 00005ED2 268A470A mov al,[es:DEVHDR.NAM + bx] ; get # supported units 0 00005ED6 98 cbw 0 00005ED7 A3[ED06] mov [numUnits],ax ; remember for later 263 0 00005EDA B80158 mov ax,(MS_M_STRATEGY*256)+1; set allocation strategy 0 00005EDD B342 mov bl,42h ; to last fit, upper only 0 00005EDF CD21 int DOS_INT 0 00005EE1 BB2000 mov bx,512/16 ; we need a 512 byte buffer 0 00005EE4 B448 mov ah, MS_M_ALLOC ; try to allocate on in upper memory 0 00005EE6 CD21 int DOS_INT 0 00005EE8 722B jc SetupDeblocking50 0 00005EEA A3[EB06] mov [UpperMemoryBuffer],ax ; use this for deblocking checks 0 00005EED 8B0E[ED06] mov cx,[numUnits] ; CX = # of drives supported 0 00005EF1 BA0200 mov dx,'C'-'A' ; start with drive C: 0 00005EF4 29D1 sub cx,dx ; CX = # of potential hard disks 0 00005EF6 7615 jbe SetupDeblocking40 ; skip tests if none 276 SetupDeblocking30: ; DX = next drive, CX = drive count 0 00005EF8 51 push cx 0 00005EF9 52 push dx 0 00005EFA E82200 call BusMasterCheck ; check if drive DL bus master disk 0 00005EFD 5A pop dx 0 00005EFE 59 pop cx 0 00005EFF 720C jc SetupDeblocking40 ; is so leave deblocking alone 0 00005F01 42 inc dx ; else move to next drive 0 00005F02 E2F4 loop SetupDeblocking30 ; repeat for all drives 0 00005F04 C41E[EF06] les bx,[deblockPointer] 0 00005F08 26C707FFFF mov word ptr [es:bx],0FFFFh ; safe to disable deblocking 287 SetupDeblocking40: 0 00005F0D 8E06[EB06] mov es,[UpperMemoryBuffer] 0 00005F11 B449 mov ah,MS_M_FREE 0 00005F13 CD21 int DOS_INT ; free the upper memory buffer 291 SetupDeblocking50: 0 00005F15 B80158 mov ax,(MS_M_STRATEGY*256)+1; set allocation strategy 0 00005F18 B300 mov bl,0 ; to first fit 0 00005F1A CD21 int DOS_INT 0 00005F1C 0E push cs 0 00005F1D 07 pop es ; ES -> local data again 0 00005F1E C3 ret 298 299 300 BusMasterCheck: ; determine if we have an old troublesome controller 301 ;-------------- 302 ; On Entry: 303 ; DL = drive to check (zero based) 304 ; On Exit: 305 ; CY set if troublesome drive 306 ; 0 00005F1F E83B00 call BusMasterRemovable ; is it a removable device ? 0 00005F22 7338 jnc BMCheck10 ; yes, skip the checks 0 00005F24 A1[0000] mov ax,[mem_current] ; read into low memory 0 00005F27 E85000 call BusMasterRead ; read one sector from disk 0 00005F2A 7230 jc BMCheck10 ; give up if we couldn't read 312 0 00005F2C 8E06[0000] mov es,[mem_current] ; ensure at least the 1st word will 0 00005F30 26A10000 mov ax,[es:0] ; differ if the read doesn't happen 0 00005F34 F7D0 not ax 0 00005F36 8E06[EB06] mov es,[UpperMemoryBuffer] 0 00005F3A 26A30000 mov [es:0],ax 318 0 00005F3E A1[EB06] mov ax,[UpperMemoryBuffer] ; read into upper memory 0 00005F41 E83600 call BusMasterRead ; read one sector from disk 0 00005F44 7216 jc BMCheck10 ; give up if we couldn't read 322 0 00005F46 31F6 xor si,si 0 00005F48 31FF xor di,di 0 00005F4A B90001 mov cx,512/2 0 00005F4D 8E06[0000] mov es,[mem_current] 0 00005F51 8E1E[EB06] mov ds,[UpperMemoryBuffer] 0 00005F55 F3A7 repe cmpsw ; does the sector match ? 0 00005F57 0E push cs 0 00005F58 1F pop ds 0 00005F59 7401 je BMCheck10 ; yes, everything is fine 0 00005F5B F9 stc ; no, better leave DEBLOCK at A000 333 BMCheck10: 0 00005F5C C3 ret 335 336 BusMasterRemovable: 337 ;------------------ 338 ; On Entry: 339 ; DL = drive 340 ; On Exit: 341 ; CY set if not a removable drive 342 ; DL preserved 343 ; 0 00005F5D 0E push cs 0 00005F5E 07 pop es 0 00005F5F BB[C006] mov bx,offset removableMediaRequest 0 00005F62 26885701 mov [es:RH_UNIT + bx],dl 0 00005F66 2EFF1E[1B02] call far [cs:strategy_far] 0 00005F6B 2EFF1E[1F02] call far [cs:interrupt_far] 0 00005F70 26F747030002 test word [es:RH_STATUS + bx],RHS_BUSY 0 00005F76 7401 jz BusMasterRemovable10 0 00005F78 F9 stc ; busy bit set, it's a hard disk 353 BusMasterRemovable10: 0 00005F79 C3 ret 355 356 BusMasterRead: ; Read first sector from drive BL 357 ;------------- 358 ; On Entry: 359 ; AX = segment of buffer 360 ; DL = 02 for C:, 03 for D:, etc. 361 ; Exit: 362 ; CY clear if deblocking not required 363 ; DL preserved 364 ; 0 00005F7A C41E[EF06] les bx,[deblockPointer] 0 00005F7E 26C707FFFF mov word ptr [es:bx],0FFFFh ; no deblocking during the test 0 00005F83 0E push cs 0 00005F84 07 pop es 0 00005F85 BB[CD06] mov bx,offset readRequest 0 00005F88 26885701 mov [es:RH_UNIT + bx],dl 0 00005F8C 26C7470E0000 mov word [es:RH4_BUFOFF + bx],0 0 00005F92 26894710 mov [es:RH4_BUFSEG + bx],ax 0 00005F96 26C747120100 mov word [es:RH4_COUNT + bx],1 0 00005F9C 2EFF1E[1B02] call far [cs:strategy_far] 0 00005FA1 2EFF1E[1F02] call far [cs:interrupt_far] 0 00005FA6 26F747030080 test word [es:RH_STATUS + bx],RHS_ERROR 0 00005FAC 7401 jz BusMasterRead10 0 00005FAE F9 stc ; error bit set, say we had a problem 379 BusMasterRead10: 0 00005FAF C41E[EF06] les bx,[deblockPointer] 0 00005FB3 26C70700A0 mov word ptr [es:bx],0A000h ; enable deblocking again 0 00005FB8 C3 ret 383 384 385 Public setup_stacks 386 387 setup_stacks: 0 00005FB9 8B0E[0000] mov cx,[num_stacks] ; we want this many stacks 0 00005FBD E307 jcxz setup_stacks10 ; skip if we don't want any 0 00005FBF 8B16[0000] mov dx,[stack_size] ; they should be this big 0 00005FC3 E8[0000] call InitStacks ; initialise the stacks 392 setup_stacks10: 0 00005FC6 C3 ret 394 395 setup_history: 0 00005FC7 F606[0000]01 test byte [history_flg],RLF_ENHANCED 0 00005FCC 7421 jz setup_hist10 ; if history not enabled just exit 398 0 00005FCE 06 push es 0 00005FCF C41E[0000] les bx,[drdos_ptr] ; Get the internal data area 401 0 00005FD3 268B7704 mov si,[es:DRDOS_HIST1CTL + bx]; Get the address of History Control 0 00005FD7 A1[0100] mov ax,[history_size] ; Get Offset buffer for History data 0 00005FDA E81300 call setup_hist20 ; Allocate Buffer 1 405 0 00005FDD 268B7706 mov si,[es:DRDOS_HIST2CTL + bx]; Get the address of History Control 2 0 00005FE1 A1[0100] mov ax,[history_size] ; Get Offset buffer for History data 0 00005FE4 E80900 call setup_hist20 ; Allocate Buffer 2 409 0 00005FE7 A0[0000] mov al,[history_flg] ; copy history state 0 00005FEA 26884708 mov [es:DRDOS_HISTFLG + bx],al ; into DRDOS data area 412 0 00005FEE 07 pop es 414 setup_hist10: 0 00005FEF C3 ret 416 417 setup_hist20: 0 00005FF0 83E0F0 and ax,~ 15 ; round to a complete paragraph 0 00005FF3 83C010 add ax,16 ; always be a para bigger 0 00005FF6 26894402 mov word ptr [es:02 + si],ax ; Buffer Tail Address 0 00005FFA B104 mov cl,4 0 00005FFC 50 push ax ; save buffers size in bytes 0 00005FFD D3E8 shr ax,cl ; convert to para's 0 00005FFF B248 mov dl,'H' ; History buffer 0 00006001 B602 mov dh,ALLOC_IN_UMB 0 00006003 E8[0000] call alloc_instseg ; Allocate Buffer 0 00006006 268904 mov word ptr [es:00 + si],ax ; Buffer Start Address 0 00006009 59 pop cx ; recover buffer size in bytes 0 0000600A 06 push es 0 0000600B 8EC0 mov es,ax ; point ES at buffer seg 0 0000600D 31FF xor di,di ; ES:DI -> buffer 0 0000600F 31C0 xor ax,ax ; zero it 0 00006011 F3AA rep stosb ; before use 0 00006013 07 pop es 0 00006014 C3 ret 436 437 438 Public device_init, resident_device_init 439 440 ; DEVICE_INIT will initialise the device with the Device Header at 441 ; ES:BX 442 ; 443 ; Entry: 444 ; ES:DI Address of First Device Header 445 ; DS:SI Command Line Parameters 446 ; 447 ; Exit: 448 ; AX Top bit set on error, error code in AL 449 ; 450 device_init: 451 ;----------- 0 00006015 06 push es 0 00006016 57 push di 0 00006017 E82D06 call build_cmd_tail ; point DS:SI to dos style cmd line 0 0000601A 5F pop di 0 0000601B 07 pop es 0 0000601C E8[0000] call HookInt2F ; hook the Int 2F vector 0 0000601F E80600 call resident_device_init 0 00006022 E8[0000] call UnhookInt2F ; get off the Int 2F vector 0 00006025 85C0 test ax,ax ; set the flags 0 00006027 C3 ret 462 463 resident_device_init: 464 ;-------------------- 0 00006028 C706[2F01]0000 mov word [rel_unit],0 ; set rel unit to zero for block devices 0 0000602E C606[0C01]00 mov byte [dev_count],0 0 00006033 BB[2702] mov bx,offset request_hdr ; ds:bx -> command block 468 %if TRUE 0 00006036 A1[0000] mov ax,[mem_max] ; AX:0 -> top of available memory 0 00006039 C7470E0000 mov word [RH0_RESIDENT + bx],0 ; pass to the device driver 0 0000603E 894710 mov [RH0_RESIDENT+2 + bx],ax ; in the RESIDENT field 472 %else 473 mov [RH0_RESIDENT + bx],di ; Force the default RESIDENT field 474 mov [RH0_RESIDENT+2 + bx],es ; to be the error condition 475 %endif 476 dev_i10: 0 00006041 56 push si 0 00006042 06 push es 0 00006043 57 push di 0 00006044 E83806 call save_vecs ; save interrupt vectors 0 00006047 BB[2702] mov bx,offset request_hdr ; ds:bx -> command block 0 0000604A E89E00 call dev_init ; initialise the device driver 483 DEVHDR.ATTRIB equ ATTRIB ; NASM port label 0 0000604D 26F745040080 test word [es:DEVHDR.ATTRIB + di],DA_CHARDEV 0 00006053 7506 jnz dev_i18 ; skip if a character device 0 00006055 807F0D00 cmp byte [RH0_NUNITS + bx],0 ; no drives installed for disk device? 0 00006059 7421 je dev_i_err ; failed if no drives found 488 dev_i18: 0 0000605B 8B470E mov ax,[RH0_RESIDENT + bx] ; Calculate the address of 0 0000605E B104 mov cl,4 ; last paragraph used by the 0 00006060 D3E8 shr ax,cl ; device driver. If this is the 0 00006062 034710 add ax,[RH0_RESIDENT+2 + bx] ; device driver CS then error 0 00006065 F7470E0F00 test word [RH0_RESIDENT + bx],15 ; allow for partial para ? 0 0000606A 7401 jz dev_i19 0 0000606C 40 inc ax ; round it up 496 dev_i19: 0 0000606D 3B06[1D02] cmp ax,[strategy_seg] 0 00006071 7609 jbe dev_i_err 499 0 00006073 3B06[0000] cmp ax,[mem_max] ; Check for Memory Overflow 0 00006077 7218 jb dev_i30 ; if it does then we can't install 0 00006079 E81C06 call restore_vecs ; so replace interrupt vectors 503 dev_i_err: ; device initialization failed! 0 0000607C 2EC43E[0000] les di,[cs:func52_ptr] ; ES:DI -> internal data 0 00006081 8CC0 mov ax,es 0 00006083 09F8 or ax,di ; DOS data area present yet? 0 00006085 5F pop di 0 00006086 07 pop es ; recover the device header 509 510 DEVHDR.NEXT equ NEXT ; NASM port label 0 00006087 26C43D les di,[es:DEVHDR.NEXT + di] ; try next device driver 0 0000608A 742B jz dev_i60 ; if it's resident initialisation 0 0000608C BFFFFF mov di,0FFFFh ; else stop now 0 0000608F EB26 jmp short dev_i60 515 516 ; The device driver initialised OK so now build/update internal 517 ; tables based on the device driver type. 518 ; 519 ; AX = next available paragraph 520 ; DS:BX = request header 521 ; ES:DI = device driver header 522 ; 523 dev_i30: ; DEV_INIT OK so update the Top of 0 00006091 A3[0000] mov [mem_current],ax ; memory field 0 00006094 26F745040080 test word [es:DEVHDR.ATTRIB + di],DA_CHARDEV 0 0000609A 7405 jz dev_i40 527 0 0000609C E89100 call char_device ; Handle Initialization of all 0 0000609F EB03 jmp short dev_i50 ; character devices 530 531 dev_i40: 0 000060A1 E8AE00 call block_device ; Handle Initialization of all 533 ; jmp short dev_i50 ; Block Devices 534 535 dev_i50: 0 000060A4 5F pop di 0 000060A5 07 pop es ; Retrieve the current device header 0 000060A6 26FF7502 push word ptr [es:di+DEVHDR.NEXT+2] ; save next entry on the list 0 000060AA 26FF35 push word ptr [es:di+DEVHDR.NEXT] ; while we deal with existing one 0 000060AD 26C705FFFF mov word ptr [es:di+DEVHDR.NEXT],0FFFFh; terminate the list 0 000060B2 E8A902 call device_insert ; and insert into the list 0 000060B5 5F pop di 0 000060B6 07 pop es ; go round till the end 544 dev_i60: 0 000060B7 5E pop si ; recover cmdline for next device 0 000060B8 83FFFF cmp di,0FFFFh ; was that the last device to 0 000060BB 7584 jne dev_i10 ; initialise, no do next 0 000060BD BB[2702] mov bx,offset request_hdr ; ds:bx -> command block 0 000060C0 8B4703 mov ax,[RH_STATUS + bx] ; return Status Register 0 000060C3 25FF80 and ax,80FFh ; is there an error ? 0 000060C6 7802 js dev_i70 0 000060C8 31C0 xor ax,ax ; no, return success 553 dev_i70: 0 000060CA C3 ret 555 556 557 public init_static_request 558 init_static_request: 559 ; Set up request header for INIT command. 0 000060CB 29C0 sub ax,ax ; get a convenient zero 0 000060CD C60716 mov byte [RH_LEN + bx],RH0_LEN ; Init Request Length 0 000060D0 884701 mov [RH_UNIT + bx],al ; relative drive always 0 0 000060D3 C6470200 mov byte [RH_CMD + bx],CMD_INIT ; Init Command 0 000060D7 894703 mov [RH_STATUS + bx],ax ; Zero Status Register 565 0 000060DA 897712 mov [RH0_BPBOFF + bx],si ; Save the command line offset and 0 000060DD 8C5F14 mov [RH0_BPBSEG + bx],ds ; Segment in the BPB Pointer 568 0 000060E0 A0[0D01] mov al,[next_drv] ; the first drive for this device 0 000060E3 2A06[0000] sub al,[preload_drv] ; (not including preloaded devices) 0 000060E7 884716 mov [RH0_DRIVE + bx],al ; will be allocated as NEXT_DRV 572 ;;; mov es:DEVHDR.NEXTSEG[di],0 ; force seg to zero (386max 4.05) 0 000060EA C3 ret 574 575 dev_init: 576 ;-------- 577 ; On Entry: 578 ; ES:DI -> device driver header 579 ; DS:BX -> req header 580 ; DS:SI -> command line 581 ; On Exit: 582 ; ES:DI/DS:BX 583 ; 0 000060EB 268B4506 mov ax,[es:DEVHDR.STRATEGY + di] ; Set up the STRATEGY Entry Point 0 000060EF A3[1B02] mov [strategy_off],ax 0 000060F2 8C06[1D02] mov [strategy_seg],es 587 0 000060F6 268B4508 mov ax,[es:DEVHDR.INTERRUPT + di] ; Set up the INTERRUPT Entry Point 0 000060FA A3[1F02] mov [interrupt_off],ax 0 000060FD 8C06[2102] mov [interrupt_seg],es 0 00006101 E8C7FF call init_static_request 592 0 00006104 1E push ds 0 00006105 06 push es ; Save Segment registers 0 00006106 53 push bx 0 00006107 56 push si 0 00006108 57 push di ; and pointers (not all preserve them) 0 00006109 1E push ds 0 0000610A 07 pop es ; ES -> Points at the Data Segment 0 0000610B 8E1E[1D02] mov ds,[strategy_seg] ; DS == Device Drive Segment 0 0000610F 89FE mov si,di ; DS:SI -> device driver header 0 00006111 1E push ds 0 00006112 06 push es 0 00006113 2EFF1E[1B02] call far [cs:strategy_far] ; Call Device Strategy Routine 0 00006118 07 pop es 0 00006119 1F pop ds 0 0000611A 8B4408 mov ax,[DEVHDR.INTERRUPT + si] ; Set up the INTERRUPT Entry Point 0 0000611D 26A3[1F02] mov [es:interrupt_off],ax 0 00006121 2EFF1E[1F02] call far [cs:interrupt_far] ; Call Device Interrupt Routine 0 00006126 5F pop di 0 00006127 5E pop si 0 00006128 5B pop bx ; recover the pointers 0 00006129 07 pop es 0 0000612A 1F pop ds ; Restore Segment Registers 0 0000612B 268C4502 mov word ptr [es:di+DEVHDR.NEXT+2],es ; ignore segment - it MUST be same one 0 0000612F C3 ret 617 618 ; 619 ; Character Device Driver Initialised OK so now build/update internal 620 ; tables based on the device driver type. 621 ; 622 ; DS:BX Request Header 623 ; ES:DI Device Driver Header 624 ; 625 char_device: 0 00006130 26F745040100 test word [es:DEVHDR.ATTRIB + di],DA_ISCIN 0 00006136 7409 jz char_d10 ; is this the standard console device? 0 00006138 893E[1D01] mov [condev_off],di ; save console device driver address 0 0000613C 8C06[1F01] mov [condev_seg],es 0 00006140 C3 ret 631 632 char_d10: 0 00006141 26F745040800 test word [es:DEVHDR.ATTRIB + di],DA_ISCLK 0 00006147 7408 jz char_d20 ; is this the standard clock device? 0 00006149 893E[1901] mov [clkdev_off],di ; save clock device driver address 0 0000614D 8C06[1B01] mov [clkdev_seg],es 637 char_d20: 0 00006151 C3 ret 639 640 641 ; Block device driver initialised OK. Save the values 642 ; returned from the INIT call so we can later build all the 643 ; required internal tables. 644 ; 645 ; entry: DS:BX -> request header 646 ; ES:DI -> device driver header 647 ; 648 public block_device 649 block_device: 0 00006152 B009 mov al,BLKDEV_LENGTH ; bytes per block device table entry 0 00006154 F626[0E01] mul byte [num_blkdev] ; * # of block devices installed 0 00006158 05[3101] add ax,offset blkdev_table ; AX -> block dev init result table 0 0000615B 96 xchg ax,si ; pointer to next block device struct 0 0000615C 893E[2501] mov [devoff],di 0 00006160 8C06[2701] mov [devseg],es ; point to device driver header 0 00006164 893C mov [0 + si],di 0 00006166 8C4402 mov [2 + si],es ; save device driver address for later 0 00006169 8B4712 mov ax,[RH0_BPBOFF + bx] 0 0000616C 894404 mov [4 + si],ax ; save BPB table address (offset) 0 0000616F 8B4714 mov ax,[RH0_BPBSEG + bx] 0 00006172 894406 mov [6 + si],ax ; save BPB table address (segment) 0 00006175 8A4F0D mov cl,[RH0_NUNITS + bx] 0 00006178 884C08 mov [8 + si],cl ; get # of units supported by driver 0 0000617B 26884D0A mov [es:DEVHDR.NAM + di],cl ; set # of units in device name 0 0000617F FF06[0E01] inc word [num_blkdev] ; we've installed another block device 0 00006183 000E[0D01] add [next_drv],cl ; update drive base for next driver 0 00006187 000E[0C01] add [dev_count],cl ; number of new units 668 0 0000618B A1[1001] mov ax,[boot_device] ; now for Andy's bit about boot device 0 0000618E 0B06[1201] or ax,[boot_device+2] ; have we already got a boot device? 0 00006192 7518 jnz not_boot_dev 0 00006194 8A2E[0000] mov ch,[init_drv] 0 00006198 2A2E[0D01] sub ch,[next_drv] ; is sub unit in this driver 0 0000619C 770E ja not_boot_dev ; no, skip it 0 0000619E 00CD add ch,cl ; work out which sub unit it is 0 000061A0 882E[1401] mov [boot_drv],ch ; and remember it 0 000061A4 893E[1001] mov [boot_device],di 0 000061A8 8C06[1201] mov [boot_device+2],es 679 not_boot_dev: 680 0 000061AC 56 push si 0 000061AD 06 push es 0 000061AE 57 push di 0 000061AF 8A4C08 mov cl,[8 + si] 0 000061B2 B500 mov ch,0 ; CX = # of drives found in driver 0 000061B4 C47404 les si,[4 + si] ; ES:SI -> BPB array in BIOS 0 000061B7 8C06[2301] mov [bpbseg],es ; remember the segment 688 blkdev_loop: 0 000061BB 26AD es lodsw ; AX = offset of next BPB 0 000061BD 06 push es 0 000061BE 56 push si 0 000061BF 51 push cx 0 000061C0 A3[2101] mov [bpboff],ax ; remember the offset 0 000061C3 97 xchg ax,di ; ES:DI -> next BPB 0 000061C4 268B05 mov ax,[es:di] ; AX = sector size for BPB 0 000061C7 3B06[1501] cmp ax,[max_secsize] ; new maximum for sector size 0 000061CB 7603 jbe blkdev_next1 ; skip if sector size not grown 0 000061CD A3[1501] mov [max_secsize],ax ; else set new maximum 699 blkdev_next1: 0 000061D0 268A5502 mov dl,[es:2 + di] ; get sectors per cluster 0 000061D4 B600 mov dh,0 ; make this a word 0 000061D6 F7E2 mul dx ; AX = bytes per cluster 0 000061D8 3B06[1701] cmp ax,[max_clsize] ; more than previous maximum 0 000061DC 7603 jbe blkdev_next2 ; skip if no new high score 0 000061DE A3[1701] mov [max_clsize],ax ; else record max. sector size 706 blkdev_next2: 0 000061E1 C41E[0000] les bx,[func52_ptr] ; ES:BX -> internal data 0 000061E5 8CC0 mov ax,es 0 000061E7 09D8 or ax,bx ; DOS data area present yet? 0 000061E9 7414 jz blkdev_next3 ; skip if BDOS not present yet 0 000061EB E89503 call setup_drives ; update drives in BDOS data 0 000061EE 8E06[0000] mov es,[mem_current] ; MUST create a DDSC just after driver 0 000061F2 8306[0000]05 add word [mem_current],(DDSC_LEN+15)/16 0 000061F7 31ED xor bp,bp ; ES:BP points to the DDSC 0 000061F9 E86200 call setup_ddsc ; add new DDSC_ to chain 0 000061FC E8BB00 call setup_ldt ; initialise LDT for that drive 717 blkdev_next3: 0 000061FF 59 pop cx 0 00006200 5E pop si 0 00006201 07 pop es 0 00006202 E2B7 loop blkdev_loop ; repeat for all BPBs in driver 0 00006204 5F pop di 0 00006205 07 pop es 0 00006206 5E pop si 0 00006207 C3 ret 726 727 resident_ddscs: 728 ;-------------- 729 ; Allocate DDSC's for the resident device drivers - we can only do this 730 ; after the DOS data area is established. 731 ; 0 00006208 FF36[0000] push word [res_ddsc_ptr] 0 0000620C 29DB sub bx,bx ; start with 1st block device 0 0000620E 8B0E[0E01] mov cx,[num_blkdev] ; get # of block devices 0 00006212 E345 jcxz res_ddsc40 ; skip if no block devices 736 res_ddsc10: 0 00006214 53 push bx 0 00006215 51 push cx 0 00006216 B80900 mov ax,BLKDEV_LENGTH 0 00006219 F7E3 mul bx 0 0000621B 05[3101] add ax,offset blkdev_table 0 0000621E 96 xchg ax,si ; SI -> block device table 0 0000621F 29C9 sub cx,cx 0 00006221 8A4C08 mov cl,[8 + si] ; CX = # of units on device 0 00006224 29DB sub bx,bx ; BX = relative unit # * 2 0 00006226 891E[2F01] mov [rel_unit],bx ; start with relative unit # 0 747 748 res_ddsc20: ; CX = remaining units 0 0000622A 53 push bx 0 0000622B 51 push cx 0 0000622C 56 push si ; BX = offset, SI -> drive structure 0 0000622D AD lodsw 0 0000622E A3[2501] mov [devoff],ax ; save device header offset 0 00006231 AD lodsw 0 00006232 A3[2701] mov [devseg],ax ; save device header segment 0 00006235 C434 les si,[si] ; get offset of BPB array 0 00006237 268B00 mov ax,[es:bx+si] ; get offset for our BPB 0 0000623A A3[2101] mov [bpboff],ax 0 0000623D 8C06[2301] mov [bpbseg],es ; save pointer to BPB 760 0 00006241 C42E[0000] les bp,[res_ddsc_ptr] ; point to position for DDSC_ 0 00006245 8306[0000]41 add word [res_ddsc_ptr],DDSC_LEN 0 0000624A E81100 call setup_ddsc ; setup one unit 0 0000624D 5E pop si 0 0000624E 59 pop cx 0 0000624F 5B pop bx 0 00006250 43 inc bx 0 00006251 43 inc bx ; increment (unit index*2) 0 00006252 E2D6 loop res_ddsc20 ; repeat for next unit, same driver 770 0 00006254 59 pop cx 0 00006255 5B pop bx 0 00006256 43 inc bx 0 00006257 E2BB loop res_ddsc10 ; repeat for next driver 775 res_ddsc40: ; all block devices done 0 00006259 8F06[0000] pop word [res_ddsc_ptr] 0 0000625D C3 ret 778 779 780 setup_ddsc: 781 ;---------- 782 ; On Entry: 783 ; ES:BP -> DDSC_ to initialise and link into chain 784 ; bpbptr -> BPB to initialise from 785 ; devseg:devoff -> device driver header 786 ; abs_unit, rel_unit reflect drive 787 ; On Exit: 788 ; None 789 ; 0 0000625E 1E push ds 0 0000625F C536[2101] lds si,[bpbptr] ; DS:SI points to the BPB 0 00006263 B453 mov ah,53h ; build DDSC from BPB call 0 00006265 CD21 int DOS_INT ; initialises the structure 0 00006267 1F pop ds 0 00006268 A1[2501] mov ax,[devoff] 0 0000626B 26894613 mov [es:DDSC_DEVOFF + bp],ax 0 0000626F A1[2701] mov ax,[devseg] 0 00006272 26894615 mov [es:DDSC_DEVSEG + bp],ax 799 0 00006276 A1[2D01] mov ax,[abs_unit] 0 00006279 FF06[2D01] inc word [abs_unit] 0 0000627D 26884600 mov [es:DDSC_UNIT + bp],al ; set absolute unit (global) 0 00006281 A1[2F01] mov ax,[rel_unit] 0 00006284 FF06[2F01] inc word [rel_unit] 0 00006288 26884601 mov [es:DDSC_RUNIT + bp],al ; set relative unit (driver relative) 806 0 0000628C B8FFFF mov ax,-1 ; set link to FFFFh:FFFFh 0 0000628F 26894619 mov word ptr [es:DDSC_LINK + bp],ax 0 00006293 2689461B mov word ptr [es:DDSC_LINK+2 + bp],ax 0 00006297 26884618 mov [es:DDSC_FIRST + bp],al ; set drive never accessed flag 0 0000629B 8CC0 mov ax,es ; now link into device chain 812 ; 0 0000629D C41E[0000] les bx,[func52_ptr] ; ES:BX -> secret 52h data 0 000062A1 8D5FE7 lea bx,[(F52_DDSCPTR-offset DDSC_LINK) + bx] 815 setup_ddsc10: 0 000062A4 26837F19FF cmp word ptr [es:DDSC_LINK + bx],0FFFFh 0 000062A9 7406 je setup_ddsc20 ; is there another one ? 0 000062AB 26C45F19 les bx,[es:DDSC_LINK + bx] ; onto next DDSC_ 0 000062AF EBF3 jmp short setup_ddsc10 820 setup_ddsc20: ; link new DDSC to end of chain 0 000062B1 26896F19 mov word ptr [es:DDSC_LINK + bx],bp 0 000062B5 2689471B mov word ptr [es:DDSC_LINK+2 + bx],ax 0 000062B9 C3 ret ; now RAF will be happy 824 825 826 Public setup_ldt 827 828 setup_ldt: 0 000062BA 1E push ds 0 000062BB 06 push es 0 000062BC C41E[0000] les bx,[func52_ptr] ; get internal data in ES:BX 0 000062C0 B058 mov al,LDT_LEN ; we need this many bytes per drive 0 000062C2 26F66721 mul byte [es:F52_LASTDRV + bx] ; *lastdrive 0 000062C6 91 xchg ax,cx ; CX = size to initialise 0 000062C7 268A4721 mov al,[es:F52_LASTDRV + bx] ; lastdrive 0 000062CB 50 push ax ; save for later 0 000062CC 26C47F16 les di,[es:F52_PATHPTR + bx] ; now initialise the CSD's 0 000062D0 89FB mov bx,di 0 000062D2 30C0 xor al,al ; to zero 0 000062D4 F3AA rep stosb ; zero them 0 000062D6 58 pop ax ; recover lastdrive 842 843 ; xor bx,bx ; start with zero offset 0 000062D7 31C9 xor cx,cx ; start with drive A 0 000062D9 86C1 xchg al,cl ; AH = physical limit, CX logical limit 846 ldt_init: 0 000062DB 50 push ax 0 000062DC 51 push cx 0 000062DD 50 push ax 0 000062DE 8D3F lea di,[LDT_NAME + bx] 0 000062E0 0441 add al,'A' ; make drive ASCII 0 000062E2 AA stosb 0 000062E3 B83A5C mov ax,':\' ; point at the root ; NASM port swapped text literals 0 000062E6 AB stosw 0 000062E7 B8FFFF mov ax,0FFFFh 0 000062EA 8D7F49 lea di,[LDT_BLK + bx] ; set to FFFF to force LDT_ rebuild 0 000062ED AB stosw 0 000062EE AB stosw 0 000062EF AB stosw ; next two words are FFFF too 0 000062F0 8D7F51 lea di,[LDT_BLKH + bx] 0 000062F3 AB stosw 0 000062F4 8D7F53 lea di,[LDT_ROOTH + bx] 0 000062F7 AB stosw 0 000062F8 8D7F4F lea di,[LDT_ROOTLEN + bx] 0 000062FB B80200 mov ax,2 0 000062FE AB stosw ; set the length field 0 000062FF 58 pop ax 0 00006300 2EC536[0000] lds si,[cs:func52_ptr] ; get internal data in DS:SI 0 00006305 83EE19 sub si,offset DDSC_LINK 870 ldt_init20: 0 00006308 C57419 lds si,[DDSC_LINK + si] ; point to next PDT 0 0000630B 83FEFF cmp si,-1 ; skip if there isn't one 0 0000630E 7443 je ldt_init40 0 00006310 3A04 cmp al,[DDSC_UNIT + si] ; is this the DDSC for the drive 0 00006312 75F4 jne ldt_init20 ; if not try another 0 00006314 26897745 mov word ptr [es:LDT_PDT + bx],si 0 00006318 268C5F47 mov word ptr [es:LDT_PDT+2 + bx],ds 0 0000631C 807C0800 cmp byte [DDSC_NFATS + si],0 ; no FATS, then it's a reserved drive 0 00006320 7431 je ldt_init40 0 00006322 06 push es 0 00006323 53 push bx 0 00006324 50 push ax ; save drive we are processing 0 00006325 B8114A mov ax,4A11h 0 00006328 31DB xor bx,bx 0 0000632A CD2F int 2Fh ; do an STACKER installation check 0 0000632C 5A pop dx ; DL = drive we are processing 0 0000632D 85C0 test ax,ax 0 0000632F B80040 mov ax,LFLG_PHYSICAL ; assume a physical drive 0 00006332 7519 jnz ldt_init30 ; no STACKER, it's physical 0 00006334 80E941 sub cl,'A' ; zero base STACKER drive returned 0 00006337 38D1 cmp cl,dl ; should we check this drive ? 0 00006339 7712 ja ldt_init30 ; below 1st drive, it's physical 0 0000633B 50 push ax 0 0000633C 52 push dx 0 0000633D B8114A mov ax,4A11h 0 00006340 BB0100 mov bx,1 ; ask STACKER for host drive 0 00006343 CD2F int 2Fh 0 00006345 5A pop dx 0 00006346 58 pop ax 0 00006347 38D3 cmp bl,dl ; is this the host drive ? 0 00006349 7502 jne ldt_init30 0 0000634B 31C0 xor ax,ax ; drive is invalid 903 ldt_init30: 0 0000634D 5B pop bx 0 0000634E 07 pop es 0 0000634F 26894743 mov [es:LDT_FLAGS + bx],ax 907 ldt_init40: 0 00006353 83C358 add bx,LDT_LEN ; move onto next LDT_ 0 00006356 59 pop cx 0 00006357 58 pop ax 0 00006358 40 inc ax ; and next drive 0 00006359 E280 loop ldt_init ; done to lastdrive ? no, do another 913 0 0000635B 07 pop es 0 0000635C 1F pop ds 0 0000635D C3 ret 917 918 Public device_insert 919 920 device_insert: 921 ;------------- 922 ; insert device drivers at ES:DI into global chain 923 ; if we are initialising the resident device drivers then we don't have 924 ; a global chain, so insert them on a local chain and try again later 0 0000635E 1E push ds 0 0000635F C51E[0000] lds bx,[func52_ptr] ; Internal Data Pointer 0 00006363 8D7722 lea si,[F52_DEVROOT + bx] ; DS:SI -> NUL device 0 00006366 8CD8 mov ax,ds ; if BDOS data area isn't present 0 00006368 09D8 or ax,bx ; we are initialising resident 0 0000636A 7505 jnz dev_ins_next ; devices 0 0000636C 0E push cs 0 0000636D 1F pop ds 0 0000636E BE[2901] mov si,offset resdev_chain ; it's resident devices 934 dev_ins_next: 0 00006371 83FFFF cmp di,-1 ; end of device chain reached? 0 00006374 7417 je devins_done ; yes, all devices inserted 0 00006376 8B04 mov ax,[0 + si] 0 00006378 8B5402 mov dx,[2 + si] ; DX:AX = original chain 0 0000637B 893C mov [0 + si],di 0 0000637D 8C4402 mov [2 + si],es ; link our device at head of chain 0 00006380 268705 xchg ax,[es:0 + di] ; link old global chain to device 0 00006383 26875502 xchg dx,[es:2 + di] ; & get next device in local chain 0 00006387 89C7 mov di,ax ; point to next device in chain 0 00006389 8EC2 mov es,dx 0 0000638B EBE4 jmp short dev_ins_next ; repeat until chain empty 946 devins_done: 0 0000638D 1F pop ds 0 0000638E C3 ret 949 950 951 public config_finish 952 953 config_finish: ; finish off configuration 954 ;------------- 0 0000638F 833E[2901]FF cmp word [resdev_off],-1 ; are resident devices already 0 00006394 7410 je cfg_fin10 ; installed 0 00006396 C43E[2901] les di,[resdev_chain] ; insert all the resident device 0 0000639A E8C1FF call device_insert ; drivers into DOS chain 0 0000639D E868FE call resident_ddscs ; build DDSC's for resident devices 0 000063A0 C706[2901]FFFF mov word [resdev_off],-1 ; only do this once... 961 cfg_fin10: 962 0 000063A6 803E[F406]00 cmp byte [configPass],0 ; skip if second pass 0 000063AB 750A jne cfg_fin20 0 000063AD C41E[0000] les bx,[func52_ptr] ; ES:BX -> base of DOS variables 0 000063B1 E8CF01 call setup_drives ; Update No of Physical Drives in case 967 ; this is the first pass 0 000063B4 E803FF call setup_ldt ; setup the ldt's 969 cfg_fin20: 0 000063B7 C41E[0000] les bx,[func52_ptr] 0 000063BB 8D7F08 lea di,[F52_CLKDEV + bx] ; ES:DI -> clock ptr, console ptr 0 000063BE BE[1901] mov si,offset clkdev_off ; DS:SI -> local pointer values 0 000063C1 A5 movsw ; set offset of clock device driver 0 000063C2 A5 movsw ; set segment of clock device driver 0 000063C3 A5 movsw ; set offset of console device driver 0 000063C4 A5 movsw ; set segment of console device driver 977 0 000063C5 FF36[0000] push word [num_files] 0 000063C9 FF36[0000] push word [num_fcbs] 0 000063CD A0[0901] mov al,[filesIn] 0 000063D0 50 push ax 0 000063D1 C706[0000]0000 mov word [num_fcbs],MIN_NUM_FCBS 0 000063D7 C706[0000]0800 mov word [num_files],MIN_NUM_FILES 0 000063DD C606[0901]00 mov byte [filesIn],0 0 000063E2 E8FE00 call setup_doshndl 0 000063E5 58 pop ax 0 000063E6 A2[0901] mov [filesIn],al 0 000063E9 8F06[0000] pop word [num_fcbs] 0 000063ED 8F06[0000] pop word [num_files] 990 0 000063F1 E8EF00 call setup_doshndl ; Allocate DOS compatible Handles 992 ; NB must immediately follow devices ! 0 000063F4 E80100 call setup_buffers ; allocate the requested # 0 000063F7 C3 ret 995 996 997 setup_buffers: 998 ;------------- 999 ; entry: num_buf = minimum # of buffers required 1000 ; 0 - use temporary high buffers 1001 ; 0 000063F8 C41E[0000] les bx,[func52_ptr] ; ES:BX -> internal data structure 0 000063FC A1[BE06] mov ax,[num_buf] ; fill in info in DOS for diagnostic 0 000063FF 2689473F mov [es:F52_NUM_BUF + bx],ax ; programs 0 00006403 A0[0701] mov al,[num_read_ahead_buf] 0 00006406 26894741 mov [es:F52_READ_AHEAD + bx],ax 0 0000640A 268B4710 mov ax,[es:F52_SECSIZE + bx] ; get DOS data sector size 0 0000640E 3B06[1501] cmp ax,[max_secsize] ; has it been poked to a bigger value ? 0 00006412 7703 ja setup_b10 ; if so we must discard anyway 0 00006414 A1[1501] mov ax,[max_secsize] ; get max. sector size found 1011 setup_b10: 0 00006417 26894710 mov [es:F52_SECSIZE + bx],ax ; update max. sector size in PCMODE 0 0000641B A3[1501] mov [max_secsize],ax ; update max. sector size locally 0 0000641E 83C014 add ax,offset BCB_DATA ; add in the header size 1015 0 00006421 8E06[0000] mov es,[init_dseg] ; ES:DI -> init buffers 0 00006425 BF0020 mov di,offset INIT_BUFFERS 0 00006428 B90400 mov cx,NUM_BUFFS ; CX buffs, DX in size, at ES:DI 0 0000642B BA2004 mov dx,SIZEOF_BUFFS ; size of init buffers 0 0000642E 833E[BE06]00 cmp word [num_buf],0 ; (zero at init time) 0 00006433 744E je setup_b70 ; go ahead and initialise 1022 0 00006435 50 push ax ; save size of buffer 0 00006436 F726[BE06] mul word [num_buf] ; AX = total bytes required 0 0000643A 85D2 test dx,dx ; > 64 K ? 0 0000643C 7403 jz setup_b30 0 0000643E B8FFFF mov ax,0FFFFh ; do the maximum 1028 setup_b30: 0 00006441 5B pop bx ; BX = size of a buffer 0 00006442 89C1 mov cx,ax ; CX bytes required 0 00006444 31D2 xor dx,dx 0 00006446 F7F3 div bx ; AX = # buffers 1033 0 00006448 50 push ax ; save # buffers 0 00006449 53 push bx ; save size of a buffer 0 0000644A 51 push cx ; save bytes wanted 0 0000644B F606[0801]01 test byte [buffersIn],BUFFERS_IN_HMA 0 00006450 F9 stc ; do we want buffers at FFFF ? 0 00006451 740B jz setup_b40 0 00006453 E8[0000] call SetupHMA ; make sure HMA chain is established 0 00006456 59 pop cx 0 00006457 51 push cx ; CX = bytes wanted 0 00006458 BAFFFF mov dx,0FFFFh ; anywhere is OK 0 0000645B E8[0000] call AllocHMA ; ES:DI -> allocated data 1045 setup_b40: 0 0000645E 58 pop ax ; AX = bytes wanted 0 0000645F 5A pop dx ; DX = size of a buffer 0 00006460 59 pop cx ; CX = number of buffer 0 00006461 7320 jnc setup_b70 ; if CY clear ES:DI -> our space 1050 0 00006463 D1E8 shr ax,1 0 00006465 D1E8 shr ax,1 0 00006467 D1E8 shr ax,1 0 00006469 D1E8 shr ax,1 0 0000646B 40 inc ax ; convert from bytes to para's 0 0000646C 52 push dx 0 0000646D B242 mov dl,'B' ; allocate as a Buffer 0 0000646F F606[0801]02 test byte [buffersIn],BUFFERS_IN_UMB 0 00006474 7405 jz setup_b50 ; allocation from UMB's OK ? 0 00006476 E8[0000] call alloc_upper ; yes, try and allocate memory there 0 00006479 7303 jnc setup_b60 1062 setup_b50: 0 0000647B E8[0000] call alloc_seg ; allocate memory in bottom 640 K 1064 setup_b60: 0 0000647E 5A pop dx 0 0000647F 8EC0 mov es,ax ; ES = segment 0 00006481 31FF xor di,di ; ES:DI -> start of buffer 1068 setup_b70: 1069 ; Buffer space for CX buffers, of size DX, allocated at ES:DI 0 00006483 89FE mov si,di ; remember where 1st buffer is 1071 setup_b80: 0 00006485 51 push cx 0 00006486 89FB mov bx,di ; BX = current buffer 0 00006488 89D1 mov cx,dx 0 0000648A 31C0 xor ax,ax 0 0000648C F3AA rep stosb ; zero the buffer, ES:DI -> next buffer 0 0000648E 26C64704FF mov byte [es:BCB_DRV + bx],0FFh ; invalidate buffer 0 00006493 26893F mov [es:BCB_NEXT + bx],di ; point to where "next" will be 0 00006496 89D8 mov ax,bx 0 00006498 29D0 sub ax,dx ; work out what our previous was 0 0000649A 26894702 mov [es:BCB_PREV + bx],ax ; and point to it 0 0000649E 59 pop cx 0 0000649F E2E4 loop setup_b80 ; do them all 1084 0 000064A1 268937 mov [es:BCB_NEXT + bx],si ; the last's "next" is our first buffer 0 000064A4 26895C02 mov [es:BCB_PREV + si],bx ; the first's "previous" is our last 0 000064A8 8CC0 mov ax,es ; AX:SI -> 1st buffer 0 000064AA C41E[0000] les bx,[func52_ptr] ; ES:BX -> internal data structure 0 000064AE 268977F8 mov [es:F52_BCBOFF + bx],si 0 000064B2 268947FA mov [es:F52_BCBSEG + bx],ax ; fixup buffer pointers 0 000064B6 26897747 mov word ptr [es:F52_BUF_INFO + bx],si 0 000064BA 26894749 mov word ptr [es:F52_BUF_INFO+2 + bx],ax 0 000064BE 40 inc ax ; seg FFFF ? 0 000064BF 7521 jnz setup_b90 ; skip if not 0 000064C1 26C6475301 mov byte [es:F52_HMAFLAG + bx],1 ; buffers are in HMA 0 000064C6 268B4710 mov ax,[es:F52_SECSIZE + bx] 0 000064CA 83C00F add ax,15 0 000064CD B104 mov cl,4 0 000064CF D3E8 shr ax,cl ; convert to para size 0 000064D1 B242 mov dl,'B' ; allocate as a Buffer 0 000064D3 E8[0000] call alloc_hiseg ; allocate a deblocking buffer 0 000064D6 26894756 mov [es:F52_DEBLOCK + bx],ax 0 000064DA C41E[0000] les bx,[drdos_ptr] ; ES:BX -> data area 0 000064DE 26894726 mov [es:DRDOS_DEBLOCK + bx],ax ; of deblocking buffer 1105 setup_b90: 0 000064E2 C3 ret 1107 1108 setup_doshndl: 0 000064E3 06 push es 0 000064E4 C41E[0000] les bx,[func52_ptr] ; Internal Data Pointer 0 000064E8 8D5F04 lea bx,[F52_FILEPTR + bx] ; Start of Handle List 0 000064EB 8B0E[0000] mov cx,[num_files] ; Number of DOS Handles 0 000064EF 030E[0000] add cx,[num_fcbs] ; + some for FCB's 0 000064F3 81F9FF00 cmp cx,255 0 000064F7 7603 jbe setup_dh10 0 000064F9 B9FF00 mov cx,255 ; maximum IFN is 255 1117 setup_dh10: 0 000064FC 26833FFF cmp word [es:DCNTRL_DSOFF + bx],0FFFFh ; Last entry ? 0 00006500 740B je setup_dh20 ; no, loop round again 0 00006502 26C41F les bx,[es:DCNTRL_DSADD + bx] ; Get the Next Entry 0 00006505 262B4F04 sub cx,[es:DCNTRL_COUNT + bx] ; Update the count 0 00006509 7276 jc setup_dh30 ; going negative isn't allowed 0 0000650B EBEF jmp short setup_dh10 1124 1125 setup_dh20: 0 0000650D E372 jcxz setup_dh30 ; any left to allocate ? 1127 0 0000650F B84B00 mov ax,DHNDL_LEN ; How many bytes do we need 0 00006512 F7E1 mul cx ; for the structure 0 00006514 83C006 add ax,DCNTRL_LEN ; including the control 0 00006517 89C2 mov dx,ax 1132 0 00006519 F606[0901]01 test byte [filesIn],FILES_IN_HMA 0 0000651E 741C jz setup_dh23 0 00006520 06 push es 0 00006521 53 push bx 0 00006522 50 push ax 0 00006523 51 push cx 0 00006524 52 push dx 0 00006525 E8[0000] call SetupHMA ; make sure HMA chain is established 0 00006528 59 pop cx 0 00006529 51 push cx ; CX = bytes wanted 0 0000652A BAFFFF mov dx,0FFFFh ; anywhere is OK 0 0000652D E8[0000] call AllocHMA ; ES:DI -> allocated data 0 00006530 5A pop dx 0 00006531 59 pop cx 0 00006532 58 pop ax 0 00006533 5B pop bx 0 00006534 7205 jc setup_dh22 0 00006536 8CC0 mov ax,es 0 00006538 07 pop es 0 00006539 EB1F jmp short setup_dh27 1153 setup_dh22: 0 0000653B 07 pop es 1155 setup_dh23: 0 0000653C 83C00F add ax,15 ; Ensure the new structure is 0 0000653F D1E8 shr ax,1 0 00006541 D1E8 shr ax,1 ; a paragraph value 0 00006543 D1E8 shr ax,1 0 00006545 D1E8 shr ax,1 ; allocate some memory 0 00006547 B246 mov dl,'F' ; allocate for Files 0 00006549 F606[0901]02 test byte [filesIn],FILES_IN_UMB ; UMB usage activated? 0 0000654E 7405 jz setup_dh25 ; no, use conventional mem 0 00006550 E8[0000] call alloc_upper ; then try to move them there first 0 00006553 7303 jnc setup_dh26 ; if upper fails, try low mem 1166 setup_dh25: 0 00006555 E8[0000] call alloc_seg 1168 setup_dh26: 0 00006558 31FF xor di,di 1170 setup_dh27: 0 0000655A 26893F mov [es:DCNTRL_DSOFF + bx],di ; link the new seg 0 0000655D 26894702 mov [es:DCNTRL_DSSEG + bx],ax ; to the end of the list 1173 1174 ; We can now initialise the new structure 0 00006561 26C41F les bx,[es:DCNTRL_DSADD + bx] ; Get the New Entry 0 00006564 26C707FFFF mov word [es:DCNTRL_DSOFF + bx],0FFFFh ; terminate the list 0 00006569 26C74702FFFF mov word [es:DCNTRL_DSSEG + bx],0FFFFh ; with -1,-1 0 0000656F 26894F04 mov [es:DCNTRL_COUNT + bx],cx ; Number of elements 1179 ; Now zero the tables 0 00006573 B84B00 mov ax,DHNDL_LEN ; How many bytes do we have 0 00006576 F7E1 mul cx ; with this number of elements 0 00006578 89C1 mov cx,ax ; in the structure 0 0000657A 8D7F06 lea di,[DCNTRL_LEN + bx] ; Zero the contents of the 0 0000657D 28C0 sub al,al ; structure 0 0000657F F3AA rep stosb 1186 1187 setup_dh30: 0 00006581 07 pop es 0 00006582 C3 ret 1190 1191 1192 setup_drives: 0 00006583 A0[0D01] mov al,[next_drv] ; AL = # of drives supported 0 00006586 06 push es 0 00006587 53 push bx 0 00006588 C41E[0000] les bx,[func52_ptr] ; ES:BX -> base of DOS variables 0 0000658C 26884720 mov [es:F52_PHYDRV + bx],al ; set # of Physical drives installed 1198 ; mov es:F52_LASTDRV[bx],al ; set # of Logical drives installed 0 00006590 26C647211A mov byte [es:F52_LASTDRV + bx],26 ; set # of Logical drives installed 0 00006595 5B pop bx 0 00006596 07 pop es 0 00006597 C3 ret 1203 1204 1205 setup_fopen: ; allocate file hashing information 1206 ;----------- 0 00006598 C41E[0000] les bx,[drdos_ptr] 0 0000659C A1[0000] mov ax,[num_fopen] ; get # of hashed directory entries 0 0000659F 83F8FF cmp ax,-1 ; has it been set yet ? 0 000065A2 750C jne setup_fopen10 ; yes, then leave it alone 0 000065A4 B80010 mov ax,DEF_NUM_FOPEN 0 000065A7 26837F1000 cmp word [es:DRDOS_HIMEM_ROOT + bx],0; do we have a high memory chain ? 0 000065AC 7502 jne setup_fopen10 ; high memory means no TPA hit 0 000065AE 31C0 xor ax,ax ; keep things small otherwise 1215 setup_fopen10: 0 000065B0 31D2 xor dx,dx ; AX/DX = 32 bit # of entries 0 000065B2 8B36[1701] mov si,[max_clsize] ; max. cluster size 0 000065B6 B105 mov cl,5 ; 32 byte per directory entry 0 000065B8 D3EE shr si,cl ; SI = directory entries per cluster 0 000065BA 01F0 add ax,si ; round up count to multiple of cluster 0 000065BC 48 dec ax 0 000065BD F7F6 div si ; AX = # of hashed blocks 0 000065BF 89C1 mov cx,ax 0 000065C1 E376 jcxz setup_fopen90 ; skip if hashing disabled 1225 0 000065C3 26897724 mov [es:DRDOS_HASHMAX + bx],si ; maximum # dir entries allowed 1227 0 000065C7 D1E6 shl si,1 ; SI = bytes required for data 0 000065C9 8D740A lea si,[HCB_DATA + si] ; + control information 0 000065CC F7E6 mul si ; AX bytes of data required 0 000065CE 85D2 test dx,dx 0 000065D0 7567 jnz setup_fopen90 ; overflow (shouldn't happen) 1233 1234 ; Allocate CX HCB_'s of size SI bytes, AX bytes in total 1235 0 000065D2 268B5F10 mov bx,[es:DRDOS_HIMEM_ROOT + bx]; do we have a high memory chain ? 0 000065D6 85DB test bx,bx ; zero indicates we don't 0 000065D8 742C jz setup_fopen30 0 000065DA BAFFFF mov dx,0FFFFh ; use the magic FFFF segment 0 000065DD 8EC2 mov es,dx 0 000065DF 263B4702 cmp ax,[es:2 + bx] ; is there enough room ? 0 000065E3 7721 ja setup_fopen30 ; no, forget try conventinal memory 0 000065E5 26294702 sub [es:2 + bx],ax ; else allocate the memory 0 000065E9 268B7F02 mov di,[es:2 + bx] ; get base+length 0 000065ED 01DF add di,bx ; = our allocation 0 000065EF 268B4702 mov ax,[es:2 + bx] ; if the section left is under 0 000065F3 83F804 cmp ax,2*2 ; 2 words discard it 0 000065F6 730B jae setup_fopen20 ; as we may overwrite size/link 0 000065F8 268B07 mov ax,[es:bx] ; get next entry 0 000065FB C41E[0000] les bx,[drdos_ptr] ; and make it the new himem root 0 000065FF 26894710 mov [es:DRDOS_HIMEM_ROOT + bx],ax 1252 setup_fopen20: 0 00006603 92 xchg ax,dx ; AX = FFFF 0 00006604 EB12 jmp short setup_fopen40 ; AX:DI -> data block allocated 1255 1256 setup_fopen30: 0 00006606 D1E8 shr ax,1 ; convert size to para's 0 00006608 D1E8 shr ax,1 0 0000660A D1E8 shr ax,1 0 0000660C D1E8 shr ax,1 0 0000660E 40 inc ax ; allow for rounding 0 0000660F B245 mov dl,'E' 0 00006611 E8[0000] call alloc_hiseg ; allocate it para aligned 0 00006614 48 dec ax ; zero offset terminates the chain 0 00006615 BF1000 mov di,10h ; so start with a non-zero offset 1266 ; jmp short setup_fopen40 ; AX:DI -> data block allocated 1267 1268 setup_fopen40: 1269 ; setup CX HCB_'s of size SI at AX:DI 0 00006618 C41E[0000] les bx,[drdos_ptr] 0 0000661C 26897F20 mov [es:DRDOS_HASHOFF + bx],di 0 00006620 26894722 mov [es:DRDOS_HASHSEG + bx],ax 0 00006624 8EC0 mov es,ax 1274 1275 setup_fopen50: 0 00006626 26C64502FF mov byte [es:HCB_DRV + di],-1 ; discard the HCB initially 0 0000662B 89FB mov bx,di ; remember where it is 0 0000662D 01F7 add di,si ; onto next HCB_ 0 0000662F 26893F mov [es:HCB_LINK + bx],di ; link it to previous HCB_ 0 00006632 E2F2 loop setup_fopen50 ; allocate all hash control blocks 0 00006634 26C7070000 mov word [es:HCB_LINK + bx],0 ; zero terminate the list 1282 setup_fopen90: ; all HCBs done, return 0 00006639 0E push cs 0 0000663A 07 pop es ; back to 8080 model 0 0000663B C3 ret 1286 1287 1288 Public whitespace 1289 1290 whitespace: 0 0000663C AC lodsb ; Skip any White Space in the 0 0000663D 3C20 cmp al,' ' 0 0000663F 74FB jz whitespace ; CR/LF terminated string 0 00006641 3C09 cmp al,TAB 0 00006643 74F7 jz whitespace 0 00006645 4E dec si 0 00006646 C3 ret 1298 1299 Public build_cmd_tail 1300 build_cmd_tail: 0 00006647 1E push ds 0 00006648 07 pop es 0 00006649 B9FD00 mov cx,(lengthof_cfg_buffer) - 3 ; (leave room for 3 extra chars) 0 0000664C BF[0300] mov di,offset cfg_buffer 1305 build_cl1: 0 0000664F AC lodsb ; Copy the device name 0 00006650 3C20 cmp al,' ' ; until a Control char (end of line) 0 00006652 760B jbe build_cl2 ; or a Space (end of name) 0 00006654 3C2F cmp al,'/' ; Also stop scanning when a switch 0 00006656 7407 je build_cl2 ; character is detected 0 00006658 AA stosb 0 00006659 E2F4 loop build_cl1 0 0000665B B00D mov al,CR ; indicate we can go no more.... 0 0000665D EB18 jmp short build_cl4 1315 build_cl2: 0 0000665F 3C0D cmp al,CR ; it it really the end ? 0 00006661 B020 mov al,' ' ; now insert a space character 0 00006663 AA stosb 0 00006664 7412 je build_cl_exit ; CR meant it's time to go 0 00006666 807CFF20 cmp byte ptr [si-1],' ' 0 0000666A 7401 je build_cl3 0 0000666C 4E dec si ; rewind the source one character 1323 build_cl3: 0 0000666D AC lodsb ; Copy the tail 0 0000666E 3C0D cmp al,CR ; until we find a CR 0 00006670 7405 je build_cl4 ; at the end of the line 0 00006672 AA stosb 0 00006673 E2F8 loop build_cl3 0 00006675 B00D mov al,CR ; no more room, so terminate 1330 build_cl4: 0 00006677 AA stosb 1332 build_cl_exit: 0 00006678 B00A mov al,LF ; now insert the terminating linefeed 0 0000667A AA stosb ; at the end of the buffer 0 0000667B BE[0300] mov si,offset cfg_buffer 0 0000667E C3 ret 1337 1338 save_vecs: 1339 ; save interrupt vectors so we can restore if device init fails 0 0000667F 1E push ds 0 00006680 06 push es 0 00006681 56 push si 0 00006682 57 push di 0 00006683 51 push cx 0 00006684 B90002 mov cx,(lengthof_vec_save_buf)*2 ; CX = words to save 0 00006687 31F6 xor si,si 0 00006689 8EDE mov ds,si ; DS:SI -> vectors to save 0 0000668B 0E push cs 0 0000668C 07 pop es 0 0000668D BF[9902] mov di,offset vec_save_buf ; ES:DI -> save area 0 00006690 F3A5 rep movsw ; save them 0 00006692 59 pop cx 0 00006693 5F pop di 0 00006694 5E pop si 0 00006695 07 pop es 0 00006696 1F pop ds 0 00006697 C3 ret 1358 1359 restore_vecs: 1360 ; replace interrupt vectors after a dd_init fails 0 00006698 1E push ds 0 00006699 06 push es 0 0000669A 56 push si 0 0000669B 57 push di 0 0000669C 51 push cx 0 0000669D B90001 mov cx,lengthof_vec_save_buf ; CX = vectors to restore 0 000066A0 0E push cs 0 000066A1 1F pop ds 0 000066A2 BE[9902] mov si,offset vec_save_buf ; DS:SI -> save area 0 000066A5 31FF xor di,di 0 000066A7 8EC7 mov es,di ; ES:DI -> vectors to restore 1372 rest_vec1: 0 000066A9 268B4502 mov ax,[es:2 + di] ; get updated vector 0 000066AD 3B06[0000] cmp ax,[mem_current] ; below attempted driver? 0 000066B1 720A jb rest_vec2 ; yes, don't zap it 0 000066B3 3B06[0000] cmp ax,[mem_max] ; above attempted driver? 0 000066B7 7304 jae rest_vec2 ; yes, don't zap it 0 000066B9 A5 movsw 0 000066BA A5 movsw ; else restore vector 0 000066BB EB06 jmp short rest_vec3 ; overwritten by driver 1381 rest_vec2: 0 000066BD 83C604 add si,4 ; skip vector in source 0 000066C0 83C704 add di,4 ; and in destination 1384 rest_vec3: 0 000066C3 E2E4 loop rest_vec1 ; next vector 0 000066C5 59 pop cx 0 000066C6 5F pop di 0 000066C7 5E pop si 0 000066C8 07 pop es 0 000066C9 1F pop ds 0 000066CA C3 ret 1392 1393 INITCODE ends 1394 1395 === Switch to base=000000h -> "INITDATA" 1396 section INITDATA public align=2 class=INITDATA 1397 1398 extrn shell:byte ; Default Command Processor 1399 extrn shell_cline:byte ; Default Command Line 1400 extrn num_files:word ; default # of file handles 1401 extrn num_fcbs:word ; default # of fcb file handles 1402 extrn num_fopen:word ; default value for fast open 1403 extrn country_code:word ; Requested Country Code (Default US) 1404 extrn num_stacks:word ; # hardware stacks wanted 1405 extrn stack_size:word ; size of a hardware stack 1406 1407 1408 extrn mem_current:word ; Current Load Address 1409 extrn mem_max:word ; Top of Available Memory 1410 extrn init_dseg:word ; Current init Data Segment 1411 1412 extrn dos_dseg:word 1413 extrn bios_seg:word 1414 extrn func52_ptr:dword 1415 extrn drdos_ptr:dword 1416 extrn res_ddsc_ptr:dword 1417 extrn cfg_head:word 1418 extrn cfg_tail:word 1419 extrn cfg_seeklo:word 1420 extrn cfg_seekhi:word 1421 extrn boot_options:word 1422 1423 %include "initmsgs.mac" ; Include TFT Header File 1 <1> extrn _bad_break : byte 2 <1> extrn bad_break : byte 3 <1> extrn _bad_buffers : byte 4 <1> extrn bad_buffers : byte 5 <1> extrn _bad_command : byte 6 <1> extrn bad_command : byte 7 <1> extrn _bad_country : byte 8 <1> extrn bad_country : byte 9 <1> extrn _bad_drivparm : byte 10 <1> extrn bad_drivparm : byte 11 <1> extrn _bad_exec : byte 12 <1> extrn bad_exec : byte 13 <1> extrn _bad_fcbs : byte 14 <1> extrn bad_fcbs : byte 15 <1> extrn _bad_filename : byte 16 <1> extrn bad_filename : byte 17 <1> extrn _bad_files : byte 18 <1> extrn bad_files : byte 19 <1> extrn _bad_fopen : byte 20 <1> extrn bad_fopen : byte 21 <1> extrn _bad_history : byte 22 <1> extrn bad_history : byte 23 <1> extrn _bad_lastdrive : byte 24 <1> extrn bad_lastdrive : byte 25 <1> extrn _bad_shell : byte 26 <1> extrn bad_shell : byte 27 <1> extrn _bootpart_not_found_msg : byte 28 <1> extrn bootpart_not_found_msg : byte 29 <1> extrn _dos_msg : byte 30 <1> extrn dos_msg : byte 31 <1> extrn _no_char : byte 32 <1> extrn no_char : byte 33 <1> extrn _yes_char : byte 34 <1> extrn yes_char : byte 35 <1> extrn _run_char : byte 36 <1> extrn run_char : byte 37 <1> extrn _f5key_msg : byte 38 <1> extrn f5key_msg : byte 39 <1> extrn _f8key_msg : byte 40 <1> extrn f8key_msg : byte 1424 %include "biosmsgs.mac" 1 <1> extrn _disk_msgA : byte 2 <1> extrn disk_msgA : byte 3 <1> extrn _disk_msgB : byte 4 <1> extrn disk_msgB : byte 5 <1> extrn _div_by_zero_msg : byte 6 <1> extrn div_by_zero_msg : byte 1425 1426 1427 extrn preload_drv:byte 1428 extrn init_drv:byte ; the initial boot drive 1429 1430 Public dev_load_seg, dev_reloc_seg, dev_epb, dev_name, dev_count 1431 Public rel_unit, dev_epb 1432 Public strategy_off, strategy_seg, interrupt_off, interrupt_seg, request_hdr 1433 strategy equ STRATEGY ; NASM port label 1434 Public next_drv, strategy_seg, strategy, interrupt_far 1435 Public strategy_seg, condev_off, condev_seg, clkdev_off, clkdev_seg 1436 Public num_blkdev, blkdev_table, next_drv, max_secsize 1437 Public max_clsize, init_buf, num_read_ahead_buf 1438 Public buffersIn, history_flg, history_size 1439 Public dbcs_tbl, ctry_info, boot_device, boot_drv, resdev_chain 1440 Public filesIn, stacksIn, lastdrvIn 1441 1442 0 0000871C 00 history_flg db 0 ; Disable history buffers to save RAM 0 0000871D 0001 history_size dw 256 ; When enabled 2*history size are used for bufs 1445 0 0000871F 000000000000000000 cfg_buffer db CFG_BUF_LEN dup (0) ; extra termination for buggy Windows 0 00008728 000000000000000000 0 00008731 000000000000000000 0 0000873A 000000000000000000 0 00008743 000000000000000000 0 0000874C 000000000000000000 0 00008755 000000000000000000 0 0000875E 000000000000000000 0 00008767 000000000000000000 0 00008770 000000000000000000 0 00008779 000000000000000000 0 00008782 000000000000000000 0 0000878B 000000000000000000 0 00008794 000000000000000000 0 0000879D 000000000000000000 0 000087A6 000000000000000000 0 000087AF 000000000000000000 0 000087B8 000000000000000000 0 000087C1 000000000000000000 0 000087CA 000000000000000000 0 000087D3 000000000000000000 0 000087DC 000000000000000000 0 000087E5 000000000000000000 0 000087EE 000000000000000000 0 000087F7 000000000000000000 0 00008800 000000000000000000 0 00008809 000000000000000000 0 00008812 000000000000000000 0 0000881B 00000000 1447 lengthof_cfg_buffer equ $ - cfg_buffer 0 0000881F 0D0A00 db CR,LF,0 ; device driver - give it CR/LF to hit 1449 0 00008822 03 init_buf db MIN_NUM_BUFFS ; default # of buffers 0 00008823 00 num_read_ahead_buf db DEF_READ_AHEAD ; default # of read-ahead 0 00008824 00 buffersIn db 0 ; desired location of buffers, default is low 1453 0 00008825 00 filesIn db 0 ; desired location of file handles, default is low 0 00008826 00 stacksIn db 0 ; desired location of stacks, default is low 0 00008827 00 lastdrvIn db 0 ; desired location of LDT, default is low 1457 0 00008828 00 dev_count db 0 ; count of new drives (used by preload) 0 00008829 00 next_drv db 0 ; Next Drive to Allocate 0 0000882A 0000 num_blkdev dw 0 ; # of block devices installed 1461 0 0000882C 00000000 boot_device dw 0,0 ; ptr to boot device 0 00008830 00 boot_drv db 0 ; and the sub unit number 1464 0 00008831 0000 max_secsize dw 0 ; max. sector size encountered 0 00008833 0000 max_clsize dw 0 ; max. cluster size encountered 1467 1468 ; Do not change the order of the next four words: 0 00008835 0000 clkdev_off dw 0 ; clock device driver 0 00008837 0000 clkdev_seg dw 0 0 00008839 0000 condev_off dw 0 ; console device driver 0 0000883B 0000 condev_seg dw 0 1473 1474 bpbptr label dword ; temporary BPB pointer 0 0000883D 0000 bpboff dw 0 0 0000883F 0000 bpbseg dw 0 1477 1478 devptr label dword ; temporary device header pointer 0 00008841 0000 devoff dw 0 0 00008843 0000 devseg dw 0 1481 1482 resdev_chain label dword ; head of chain for resident device 0 00008845 FFFF resdev_off dw -1 ; drivers 0 00008847 FFFF resdev_seg dw -1 1485 0 00008849 0000 abs_unit dw 0 ; absolute unit # 0 0000884B 0000 rel_unit dw 0 ; relative unit # 1488 0 0000884D 000000000000000000 blkdev_table db BLKDEV_LENGTH*26 dup (0); save block device driver addr. here 0 00008856 000000000000000000 0 0000885F 000000000000000000 0 00008868 000000000000000000 0 00008871 000000000000000000 0 0000887A 000000000000000000 0 00008883 000000000000000000 0 0000888C 000000000000000000 0 00008895 000000000000000000 0 0000889E 000000000000000000 0 000088A7 000000000000000000 0 000088B0 000000000000000000 0 000088B9 000000000000000000 0 000088C2 000000000000000000 0 000088CB 000000000000000000 0 000088D4 000000000000000000 0 000088DD 000000000000000000 0 000088E6 000000000000000000 0 000088EF 000000000000000000 0 000088F8 000000000000000000 0 00008901 000000000000000000 0 0000890A 000000000000000000 0 00008913 000000000000000000 0 0000891C 000000000000000000 0 00008925 000000000000000000 0 0000892E 000000000000000000 1490 1491 ; 1492 ; Variable for the FUNC_DEVICE and DEV_INIT sub routines 1493 ; 1494 1495 strategy_far label dword ; Device Strategy Entry Point 0 00008937 0000 strategy_off dw 0 ; Offset 0 00008939 0000 strategy_seg dw 0 ; Segment Address 1498 1499 interrupt_far label dword ; Device Entry Point 0 0000893B 0000 interrupt_off dw 0 ; Offset 0 0000893D 0000 interrupt_seg dw 0 ; Segment Address 1502 1503 dev_root label dword ; Pointer to Root of Device List 0 0000893F 0000 dev_offset dw 0 ; Offset of First Device 0 00008941 0000 dev_segment dw 0 ; Segment of First Device 1506 0 00008943 000000000000000000 request_hdr db RH_SIZE dup (0) ; DOS Request Header 0 0000894C 000000000000000000 0 00008955 000000000000000000 0 0000895E 000000 1508 0 00008961 000000000000000000 dev_name db MAX_FILELEN dup (0) 0 0000896A 000000000000000000 0 00008973 000000000000000000 0 0000897C 000000000000000000 0 00008985 000000000000000000 0 0000898E 000000000000000000 0 00008997 000000000000000000 0 000089A0 000000000000000000 0 000089A9 0000000000000000 1510 1511 dev_epb label dword 0 000089B1 0000 dev_load_seg dw 0 ; Load Segment for Device Driver 0 000089B3 0000 dev_reloc_seg dw 0 ; Relocation Factor to be Applied 1514 1515 ; 1516 ; A number of routines share this common buffer as they are never required 1517 ; at the same time. The current clients are - 1518 ; 1519 ; BDOSLDR.A86: a sector buffer for boot load of IBMDOS 1520 ; CONFIG.A86: vector save buffer (during devicehigh) 1521 ; NLSFUNC.A86: scratch area for country info 1522 1523 Public sector_buffer 1524 sector_buffer label byte 1525 ; rb 512 ; we need to read a single sector 1526 1527 Public nls_temp_area 1528 nls_temp_area label byte ; NLS buffer can be shared with 1529 ; db 258 dup (0) ; vec_save_buf as they are never 1530 ; used together 1531 1532 0 000089B5 000000000000000000 vec_save_buf dd 256 dup (0) ; reserve space to save int vectors 0 000089BE 000000000000000000 0 000089C7 000000000000000000 0 000089D0 000000000000000000 0 000089D9 000000000000000000 0 000089E2 000000000000000000 0 000089EB 000000000000000000 0 000089F4 000000000000000000 0 000089FD 000000000000000000 0 00008A06 000000000000000000 0 00008A0F 000000000000000000 0 00008A18 000000000000000000 0 00008A21 000000000000000000 0 00008A2A 000000000000000000 0 00008A33 000000000000000000 0 00008A3C 000000000000000000 0 00008A45 000000000000000000 0 00008A4E 000000000000000000 0 00008A57 000000000000000000 0 00008A60 000000000000000000 0 00008A69 000000000000000000 0 00008A72 000000000000000000 0 00008A7B 000000000000000000 0 00008A84 000000000000000000 0 00008A8D 000000000000000000 0 00008A96 000000000000000000 0 00008A9F 000000000000000000 0 00008AA8 000000000000000000 0 00008AB1 000000000000000000 0 00008ABA 000000000000000000 0 00008AC3 000000000000000000 0 00008ACC 000000000000000000 0 00008AD5 000000000000000000 0 00008ADE 000000000000000000 0 00008AE7 000000000000000000 0 00008AF0 000000000000000000 0 00008AF9 000000000000000000 0 00008B02 000000000000000000 0 00008B0B 000000000000000000 0 00008B14 000000000000000000 0 00008B1D 000000000000000000 0 00008B26 000000000000000000 0 00008B2F 000000000000000000 0 00008B38 000000000000000000 0 00008B41 000000000000000000 0 00008B4A 000000000000000000 0 00008B53 000000000000000000 0 00008B5C 000000000000000000 0 00008B65 000000000000000000 0 00008B6E 000000000000000000 0 00008B77 000000000000000000 0 00008B80 000000000000000000 0 00008B89 000000000000000000 0 00008B92 000000000000000000 0 00008B9B 000000000000000000 0 00008BA4 000000000000000000 0 00008BAD 000000000000000000 0 00008BB6 000000000000000000 0 00008BBF 000000000000000000 0 00008BC8 000000000000000000 0 00008BD1 000000000000000000 0 00008BDA 000000000000000000 0 00008BE3 000000000000000000 0 00008BEC 000000000000000000 0 00008BF5 000000000000000000 0 00008BFE 000000000000000000 0 00008C07 000000000000000000 0 00008C10 000000000000000000 0 00008C19 000000000000000000 0 00008C22 000000000000000000 0 00008C2B 000000000000000000 0 00008C34 000000000000000000 0 00008C3D 000000000000000000 0 00008C46 000000000000000000 0 00008C4F 000000000000000000 0 00008C58 000000000000000000 0 00008C61 000000000000000000 0 00008C6A 000000000000000000 0 00008C73 000000000000000000 0 00008C7C 000000000000000000 0 00008C85 000000000000000000 0 00008C8E 000000000000000000 0 00008C97 000000000000000000 0 00008CA0 000000000000000000 0 00008CA9 000000000000000000 0 00008CB2 000000000000000000 0 00008CBB 000000000000000000 0 00008CC4 000000000000000000 0 00008CCD 000000000000000000 0 00008CD6 000000000000000000 0 00008CDF 000000000000000000 0 00008CE8 000000000000000000 0 00008CF1 000000000000000000 0 00008CFA 000000000000000000 0 00008D03 000000000000000000 0 00008D0C 000000000000000000 0 00008D15 000000000000000000 0 00008D1E 000000000000000000 0 00008D27 000000000000000000 0 00008D30 000000000000000000 0 00008D39 000000000000000000 0 00008D42 000000000000000000 0 00008D4B 000000000000000000 0 00008D54 000000000000000000 0 00008D5D 000000000000000000 0 00008D66 000000000000000000 0 00008D6F 000000000000000000 0 00008D78 000000000000000000 0 00008D81 000000000000000000 0 00008D8A 000000000000000000 0 00008D93 000000000000000000 0 00008D9C 000000000000000000 0 00008DA5 000000000000000000 0 00008DAE 00000000000000 1534 lengthof_vec_save_buf equ ($ - vec_save_buf) / 4 1535 0 00008DB5 00 dbcs_buf db 0 ; BDOS puts a 7 here 0 00008DB6 00000000 dbcs_tbl dd 0 ; pointer to DBCS table in BDOS 1538 0 00008DBA 000000000000000000 ctry_info db CI_LENGTH dup (0) ; country information 0 00008DC3 000000000000000000 0 00008DCC 000000000000000000 0 00008DD5 0000000000 1540 0 00008DDA 0000 num_buf dw 0 ; # of buffers allocated 1542 1543 1544 ; The following are used for detecting old bus master controllers: 1545 0 00008DDC 0D removableMediaRequest db 13 ; length of request 0 00008DDD 00 db 0 ; unit 0 00008DDE 0F db 15 ; removable media check command 0 00008DDF 0000 dw 0 ; status 0 00008DE1 0000000000000000 db 8 dup (0) ; reserved bytes 1551 1552 0 00008DE9 1E readRequest db 30 ; length of request 0 00008DEA 00 db 0 ; unit 0 00008DEB 04 db 4 ; read command 0 00008DEC 0000 dw 0 ; status 0 00008DEE 0000000000000000 db 8 dup (0) ; reserved bytes 0 00008DF6 F8 db 0F8h ; media ID 0 00008DF7 00000000 dw 0,0 ; buffer address 0 00008DFB 0100 dw 1 ; read one sector 0 00008DFD FFFF dw 0FFFFh ; use big sector read 0 00008DFF 00000000 dw 0,0 ; Volume ID 0 00008E03 01000000 dw 1,0 ; starting sector zero 1564 1565 0 00008E07 0000 UpperMemoryBuffer dw 0 1567 0 00008E09 0000 numUnits dw 0 1569 1570 deblockPointer label dword 0 00008E0B 0000 deblockOffset dw 0 0 00008E0D 0000 deblockSeg dw 0 1573 1574 Public DeblockSetByUser 0 00008E0F 00 DeblockSetByUser db FALSE 1576 1577 Public configPass 0 00008E10 00 configPass db 0 1579 1580 INITDATA ends 1581 1582 end === Trace listing source: drbio/bin/genercfg.lst 1 ; File : $GENERCFG.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; 33 ; GENERCFG.A86 1.51 93/12/02 00:15:06 34 ; When auto-sizing DEVICEHIGH requirements use EXE header info if present 35 ; GENERCFG.A86 1.49 93/11/29 14:10:29 36 ; Add NUMLOCK=ON/OFF support 37 ; GENERCFG.A86 1.48 93/11/28 15:32:22 38 ; Support HIBUFFERS in UMB's 39 ; GENERCFG.A86 1.47 93/11/22 15:45:11 40 ; Ignore [COMMON] statements 41 ; GENERCFG.A86 1.46 93/11/18 16:20:16 42 ; Add primitive multi-master checking 43 ; GENERCFG.A86 1.45 93/11/17 20:07:17 44 ; change history defaults 45 ; GENERCFG.A86 1.44 93/11/16 14:10:21 46 ; F5 has precedence over ? 47 ; GENERCFG.A86 1.42 93/11/08 17:37:06 48 ; Move INSTALLHIGH to before INSTALL, so it's now recognised 49 ; GENERCFG.A86 1.41 93/11/04 16:28:08 50 ; Cosmetic change - the preload name field now strips off "C:\" properly 51 ; GENERCFG.A86 1.40 93/11/03 22:52:14 52 ; Replace chardev test with one for zero units 53 ; GENERCFG.A86 1.39 93/11/03 18:21:16 54 ; disable CHARDEV test until it gets fixed 55 ; GENERCFG.A86 1.38 93/11/03 17:11:05 56 ; Preloaded compression drivers maybe loaded from C: when booting 57 ; from a diskette. 58 ; GENERCFG.A86 1.37 93/10/29 19:42:51 59 ; DOS=UMB turns HIDOS on 60 ; GENERCFG.A86 1.36 93/09/28 19:54:52 61 ; Support "DEVICE?=" syntax, and "SWITCHES=/N" 62 ; GENERCFG.A86 1.35 93/09/02 22:35:16 63 ; Add header to system allocations 64 ; GENERCFG.A86 1.32 93/08/02 14:46:21 65 ; hide preload drives from func_device 66 ; support INSTALLHIGH 67 ; GENERCFG.A86 1.30 93/07/29 14:47:15 68 ; Change SETVER method 69 ; GENERCFG.A86 1.28 93/07/20 22:32:07 70 ; default upper memory link = FFFF 71 ; ENDLOG 72 73 74 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 75 %include "msdos.mac" 1 <1> ; File : $Workfile: MSDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; MSDOS.EQU 1.1 92/11/10 10:48:56 34 <1> ; Added to appslib source directory. 35 <1> ; ENDLOG 36 <1> 37 <1> MS_P_TERMCPM equ 00H 38 <1> MS_C_READ equ 01H 39 <1> MS_C_WRITE equ 02H 40 <1> MS_A_READ equ 03H 41 <1> MS_A_WRITE equ 04H 42 <1> MS_L_WRITE equ 05H 43 <1> MS_C_RAWIO equ 06H 44 <1> MS_C_RAWIN equ 07H 45 <1> MS_C_NOECHO equ 08H 46 <1> MS_C_WRITESTR equ 09H 47 <1> MS_C_READSTR equ 0aH 48 <1> MS_C_STAT equ 0bH 49 <1> MS_C_FLUSH equ 0cH 50 <1> MS_DRV_ALLRESET equ 0dH 51 <1> MS_DRV_SET equ 0eH 52 <1> MS_F_OPEN equ 0fH 53 <1> MS_F_CLOSE equ 10H 54 <1> MS_F_SFIRST equ 11H 55 <1> MS_F_SNEXT equ 12H 56 <1> MS_F_DELETE equ 13H 57 <1> MS_F_READ equ 14H 58 <1> MS_F_WRITE equ 15H 59 <1> MS_F_MAKE equ 16H 60 <1> MS_F_RENAME equ 17H 61 <1> MS_DRV_GET equ 19H 62 <1> MS_F_DMAOFF equ 1aH 63 <1> MS_DRV_ALLOC equ 1bH 64 <1> MS_DRV_ALLOCSPEC equ 1cH 65 <1> MS_F_READRAND equ 21H 66 <1> MS_F_WRITERAND equ 22H 67 <1> MS_F_SIZE equ 23H 68 <1> MS_F_RANDREC equ 24H 69 <1> MS_S_SETINT equ 25H 70 <1> MS_P_MKPSP equ 26H 71 <1> MS_F_READBLK equ 27H 72 <1> MS_F_WRITEBLK equ 28H 73 <1> MS_F_PARSE equ 29H 74 <1> MS_T_GETDATE equ 2aH 75 <1> MS_T_SETDATE equ 2bH 76 <1> MS_T_GETTIME equ 2cH 77 <1> MS_T_SETTIME equ 2dH 78 <1> MS_F_VERIFY equ 2eH 79 <1> MS_F_DMAGET equ 2fH 80 <1> MS_S_BDOSVER equ 30H 81 <1> MS_P_TERMKEEP equ 31H 82 <1> MS_S_BREAK equ 33H 83 <1> MS_S_GETINT equ 35H 84 <1> MS_DRV_SPACE equ 36H 85 <1> MS_S_COUNTRY equ 38H 86 <1> MS_X_MKDIR equ 39H 87 <1> MS_X_RMDIR equ 3aH 88 <1> MS_X_CHDIR equ 3bH 89 <1> MS_X_CREAT equ 3cH 90 <1> MS_X_OPEN equ 3dH 91 <1> MS_X_CLOSE equ 3eH 92 <1> MS_X_READ equ 3fH 93 <1> MS_X_WRITE equ 40H 94 <1> MS_X_UNLINK equ 41H 95 <1> MS_X_LSEEK equ 42H 96 <1> MS_X_CHMOD equ 43H 97 <1> MS_X_IOCTL equ 44H 98 <1> MS_X_DUP equ 45H 99 <1> MS_X_DUP2 equ 46H 100 <1> MS_X_CURDIR equ 47H 101 <1> MS_M_ALLOC equ 48H 102 <1> MS_M_FREE equ 49H 103 <1> MS_M_SETBLOCK equ 4aH 104 <1> MS_X_EXEC equ 4bH 105 <1> MS_X_EXIT equ 4cH 106 <1> MS_X_WAIT equ 4dH 107 <1> MS_X_FIRST equ 4eH 108 <1> MS_X_NEXT equ 4fH 109 <1> MS_P_SETPSP equ 50H 110 <1> MS_F_GETVERIFY equ 54H 111 <1> MS_X_RENAME equ 56H 112 <1> MS_X_DATETIME equ 57H 113 <1> MS_M_STRATEGY equ 58h 114 <1> MS_F_ERROR equ 59H 115 <1> MS_X_MKTEMP equ 5aH 116 <1> MS_X_MKNEW equ 5bH 117 <1> MS_F_LOCK equ 5cH 118 <1> MS_X_EXPAND equ 60H 119 <1> MS_P_GETPSP equ 62H 120 <1> MS_X_GETCP equ 6601h 121 <1> MS_X_SETCP equ 6602h 122 <1> MS_X_SETHC equ 67h 123 <1> MS_X_COMMIT equ 68h 124 <1> 125 <1> DOS_INT equ 21h ; DOS Entry Point 126 <1> ; 127 <1> STDIN equ 0 ; Standard Console Input Handle 128 <1> STDOUT equ 1 ; Standard Console Output Handle 129 <1> STDERR equ 2 ; Standard Error Output 130 <1> STDAUX equ 3 ; Auxilary Device Handle 131 <1> STDPRN equ 4 ; Printer Device Handle 76 %include "char.mac" 1 <1> ; File : $CHAR.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ;************************************************; 35 <1> ;* *; 36 <1> ;* Character Definitions *; 37 <1> ;* *; 38 <1> ;************************************************; 39 <1> 40 <1> CTLA equ 'A' - '@' 41 <1> CTLB equ 'B' - '@' 42 <1> CTLC equ 'C' - '@' 43 <1> CTLD equ 'D' - '@' 44 <1> CTLE equ 'E' - '@' 45 <1> CTLF equ 'F' - '@' 46 <1> CTLG equ 'G' - '@' 47 <1> BELL equ 'G' - '@' 48 <1> CTLH equ 'H' - '@' 49 <1> CTLI equ 'I' - '@' 50 <1> TAB equ 'I' - '@' 51 <1> CTLJ equ 'J' - '@' 52 <1> LF equ 'J' - '@' 53 <1> CTLK equ 'K' - '@' 54 <1> CTLM equ 'M' - '@' 55 <1> CR equ 'M' - '@' 56 <1> CTLP equ 'P' - '@' 57 <1> CTLQ equ 'Q' - '@' 58 <1> CTLR equ 'R' - '@' 59 <1> CTLS equ 'S' - '@' 60 <1> CTLT equ 'T' - '@' 61 <1> CTLU equ 'U' - '@' 62 <1> CTLV equ 'V' - '@' 63 <1> CTLW equ 'W' - '@' 64 <1> CTLX equ 'X' - '@' 65 <1> CTLY equ 'Y' - '@' 66 <1> CTLZ equ 'Z' - '@' 67 <1> ESC equ '[' - '@' 68 <1> CTLBS equ '\' - '@' 69 <1> CTLUB equ '_' - '@' 70 <1> CTLUP equ '^' - '@' 71 <1> DEL equ 07Fh 72 <1> RUBOUT equ DEL 73 <1> 74 <1> CTL equ '^' 77 %include "request.mac" 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 78 %include "driver.mac" 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 79 %include "fdos.mac" 1 <1> ; File : $FDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; 35 <1> ; Structure of Buffer Control Blocks 36 <1> ; ---------------------------------- 37 <1> ; These BCBs immediately preceed the data buffers. BCBs are 38 <1> ; always shared for all drives and therefore must be big 39 <1> ; enough for the largest drive. 40 <1> ; 41 <1> 42 <1> labelsize BCB_NEXT, word, 00h ; link to next buffer 43 <1> labelsize BCB_PREV, word, 02h ; link to previous buffer 44 <1> labelsize BCB_DRV, byte, 04h ; drive of this buffer or 0FFh 45 <1> labelsize BCB_FLAGS, byte, 05h ; buffer flags 46 <1> labelsize BCB_REC, word, 06h ; low 16 bits of sector address 47 <1> labelsize BCB_REC2, word, 08h ; top 16 bits of sector address 48 <1> ;BCB_REC2 equ byte ptr 08h ; top 8 bits of record address 49 <1> labelsize BCB_COPIES, byte, 0Ah ; number of copies to write 50 <1> labelsize BCB_SEPARATION, word, 0Bh ; # sectors copies are apart 51 <1> labelsize BCB_DDSC, dword, 0Dh ; DWORD ptr to DDSC_ 52 <1> labelsize BCB_REMOTE, word, 11h ; remote in-use count 53 <1> labelsize BCB_DATA, byte, 14h ; buffer data 54 <1> 55 <1> BF_ISFAT equ 0002h ; buffer marked as FAT sector 56 <1> BF_ISDIR equ 0004h ; buffer marked as Directory sector 57 <1> BF_ISDAT equ 0008h ; buffer marked as Data sector 58 <1> BF_DIRTY equ 0040h ; buffer marked as modified 59 <1> BF_REMOTE equ 0080h ; buffer is remote 60 <1> 61 <1> MAX12 equ 0FF6h ; max. disk size w/ 12-bit media 62 <1> 63 <1> ; Structure of Hash Control Block 64 <1> ; ------------------------------- 65 <1> ; Each hash control block refers to the hash codes of one 66 <1> ; disrectory cluster or a root directory. 67 <1> 68 <1> labelsize HCB_LINK, word, 0 ; link to next control block 69 <1> labelsize HCB_DRV, byte, 2 ; drive for this entry or 0FFh 70 <1> labelsize HCB_CLU, word, 4 ; cluster number or 0000 if root 71 <1> labelsize HCB_CLUH, word, 6 ; high word of cluster number 72 <1> labelsize HCB_CNT, word, 8 ; number of hashed entries 73 <1> labelsize HCB_DATA, word, 10 ; hash buffer data 74 <1> 75 <1> 76 <1> ; Structure of DOS FCB 77 <1> ; -------------------- 78 <1> ; This is hopefully consistent with what DOS stores in an 79 <1> ; open file control block for DOS 1.x functions 80 <1> 81 <1> labelsize MSF_EXTFLG, byte, 0 ; if this is 0xFF, skip 1st 7 byte 82 <1> labelsize MSF_ATTRIB, byte, 6 ; file attributes if MSF_EXTFLG 83 <1> labelsize MSF_DRIVE, byte, 0 ; 1st byte normally drive code 84 <1> labelsize MSF_NAME, byte, 1 ; 8-bit ASCII file name, 11 characters 85 <1> labelsize MSF_BLOCK, word, 12 ; current block number 86 <1> labelsize MSF_RECSIZE, word, 14 ; current logical record size 87 <1> labelsize MSF_SIZE, word, 16 ; 32-bit file size 88 <1> labelsize MSF_DATE, word, 20 ; last date stamp 89 <1> labelsize MSF_TIME, word, 22 ; last time stamp 90 <1> labelsize MSF_IFN, byte, 24 ;; internal file number 91 <1> labelsize MSF_IOCTL, byte, 25 ;; file status 92 <1> labelsize MSF_BLOCK1, word, 26 ;; 1st block of file 93 <1> labelsize MSF_DBLK, word, 28 ;; directory block 94 <1> labelsize MSF_DEVPTR, dword, 28 ;; address of device driver 95 <1> labelsize MSF_DCNT, word, 30 ;; directory count 96 <1> labelsize MSF_CR, byte, 32 ; current sequential record 97 <1> labelsize MSF_RR, word, 33 ; random record address (3 or 4 byte) 98 <1> labelsize MSF_RR2, byte, 35 ; random record overflow 99 <1> 100 <1> 101 <1> ; Structure of DOS DPB 102 <1> ; -------------------- 103 <1> ; The layout of this structure is a guess based on 104 <1> ; examples. It is returned by PC MODE on functions 1Fh and 105 <1> ; 32h and is required by various disk-related utilities 106 <1> ; like disk editors and CHKDSK. 107 <1> 108 <1> labelsize DDSC_UNIT, byte, 0 ; absolute drive number 109 <1> labelsize DDSC_RUNIT, byte, 1 ; relative unit number 110 <1> labelsize DDSC_SECSIZE, word, 2 ; sector size in bytes 111 <1> labelsize DDSC_CLMSK, byte, 4 ; sectors/cluster - 1 112 <1> labelsize DDSC_CLSHF, byte, 5 ; log2 (sectors/cluster) 113 <1> labelsize DDSC_FATADDR, word, 6 ; sector address of FAT 114 <1> labelsize DDSC_NFATS, byte, 8 ; # of FAT copies 115 <1> labelsize DDSC_DIRENT, word, 9 ; size of root directory 116 <1> labelsize DDSC_DATADDR, word, 11 ; sector address of cluster #2 117 <1> labelsize DDSC_NCLSTRS, word, 13 ; # of clusters on disk 118 <1> labelsize DDSC_NFATRECS, word, 15 ; # of sectors per FAT 119 <1> labelsize DDSC_DIRADDR, word, 17 ; sector address of root dir 120 <1> labelsize DDSC_DEVHEAD, dword, 19 ; device driver header 121 <1> labelsize DDSC_DEVOFF, word, 19 122 <1> labelsize DDSC_DEVSEG, word, 21 123 <1> labelsize DDSC_MEDIA, byte, 23 ; current media byte 124 <1> labelsize DDSC_FIRST, byte, 24 ; "drive never accessed" flag 125 <1> labelsize DDSC_LINK, dword, 25 ; next drive's DDSC 126 <1> labelsize DDSC_BLOCK, word, 29 ; next block to allocate 127 <1> labelsize DDSC_FREE, word, 31 ; total free clusters on drive 128 <1> labelsize DDSC_BFREE, dword, 33 ; total free clusters on drive (32-bit) 129 <1> labelsize DDSC_FSFLAGS, word, 37 ; FAT mirroring flags 130 <1> labelsize DDSC_FSINFO, word, 39 ; sector number of file system info block 131 <1> labelsize DDSC_BOOTBAK, word, 41 ; sector number of backup boot sector 132 <1> labelsize DDSC_BDATADDR, dword, 43 ; sector address of cluster #2 (32-bit) 133 <1> labelsize DDSC_BCLSTRS, dword, 47 ; # of clusters on disk (32-bit) 134 <1> labelsize DDSC_BFATRECS, dword, 51 ; # of sectors per FAT (32-bit) 135 <1> labelsize DDSC_FSROOT, dword, 55 ; starting cluster of root directory 136 <1> labelsize DDSC_BBLOCK, dword, 59 ; next block to allocate (32-bit) 137 <1> labelsize DDSC_FSVER, word, 63 ; version of file system 138 <1> DDSC_LEN equ 65 139 <1> 140 <1> 141 <1> 142 <1> ; DELWATCH hooks called by OS 143 <1> 144 <1> DELW_RDMASK equ 0 ; delete dir search mask 145 <1> DELW_DELETE equ 2 ; delete this dir entry 146 <1> DELW_FREECLU equ 3 ; free some clusters 147 <1> DELW_FREERD equ 4 ; free root dir entry 148 <1> DELW_SPACE equ 5 ; add "deletes" to free space 149 <1> DELW_NEWDISK equ 7 ; new disk logged in 150 <1> DELW_PURGE equ 14 ; perge pd file 151 <1> DELW_UNDEL equ 15 ; undelete pd file 152 <1> 153 <1> ; SuperStore hook called by OS 154 <1> 155 <1> SSTOR_SPACE equ 10h ; enquire # physical free space 156 <1> 157 <1> ; Password hooks called by OS 158 <1> 159 <1> PASSWD_CREAT equ 20h ; initialise an entry 160 <1> PASSWD_CHMOD equ 21h ; change an entry 161 <1> PASSWD_CHECK equ 22h ; check an entry 162 <1> 163 <1> ; Share hooks in PCMODE data segment 164 <1> ; 165 <1> ; These point to a stub which does a "STC, RETF" 166 <1> ; 167 <1> 168 <1> NUM_SHARE_STUB_ENTRIES equ 15 169 <1> 170 <1> S_LOCKS equ 4*0 ; share lock/unlock region 171 <1> S_UPDATE equ 4*1 ; update DHNDL from share 172 <1> S_RECORD equ 4*2 ; update share from DHNDL 173 <1> S_FDOSRW equ 4*3 ; validate proposed operation 174 <1> S_DISCARD equ 4*4 ; discard all files on drive 175 <1> S_OPEN equ 4*5 ; files is opening, remember it 176 <1> S_CLOSE equ 4*6 ; files is closing, forget it 177 <1> S_OM_COMPAT equ 4*7 ; check open mode compatible 178 <1> S_CLOSE_IF_OPEN equ 4*8 ; close if compat open, else deny 179 <1> S_DENY_IF_OPEN equ 4*9 ; deny if open shared/by others 180 <1> S_GET_LIST_ENTRY equ 4*10 ; get open file list entry 181 <1> S_CLOSE_FILES equ 4*11 ; close all files for given PSP/UID 182 <1> 183 <1> ; struct dirfcb 184 <1> 185 <1> labelsize DNAME, byte, 0 ;file name & type 186 <1> labelsize DATTS, byte, 11 187 <1> DA_RO equ 01h ; 0x01 - read/only 188 <1> DA_HIDDEN equ 02h ; 0x02 - hidden 189 <1> DA_SYSTEM equ 04h ; 0x04 - system 190 <1> DA_VOLUME equ 08h ; 0x08 - volume label 191 <1> DA_DIR equ 10h ; 0x10 - sub-directory 192 <1> DA_ARCHIVE equ 20h ; 0x20 - archive 193 <1> DA_CLUSTER equ 80h ; 0x80 - return starting cluster from search (API extention) 194 <1> DA_DELWATCH equ 80h ; 0x88 - return pending delete files 195 <1> DA_FIXED equ 11011000b ; can't CHMOD label, dir, unused bits 196 <1> DA_CHANGE equ ~ DA_FIXED ; all others are changeable 197 <1> 198 <1> ;DATTS2 equ 12 ;CP/M attributes 199 <1> ; ; 0x80 - f1' modify default open rules 200 <1> ; ; 0x40 - f2' partial close default 201 <1> ; ; 0x20 - f3' ignore close checksum errors 202 <1> ; ; 0x10 - f4' disable checksums 203 <1> ; ; 0x08 - (reserved) 204 <1> ; ; 0x04 - DELETE password 205 <1> ; ; 0x02 - WRITE password 206 <1> ; ; 0x01 - READ password 207 <1> DSIZEX equ 12 ;file size extension for FAT+ (bit 0-2 and 5-7) 208 <1> DUNDEL equ 13 ;1st letter of deleted file 209 <1> labelsize DPWD, word, 14 ;16-bit password hash code 210 <1> labelsize DMODTIME, word, 16 ;delwatch time (hhhhhmmmmmmsssss) 211 <1> labelsize DMODDATE, word, 18 ;delwatch date (yyyyyyymmmmddddd) 212 <1> ;DRECSIZE equ 16 ;FlexOS record size 213 <1> ;DUSER equ 18 ;FlexOS user ID of creator 214 <1> ;DGROUP equ 19 ;FlexOS group ID of creator 215 <1> labelsize DPWM, word, 20 ;FlexOS access rights 216 <1> labelsize DBLOCK1H, word, 20 ;high word of first block in file 217 <1> DTIME equ 22 ;time (hhhhhmmmmmmsssss) 218 <1> DDATE equ 24 ;date (yyyyyyymmmmddddd) 219 <1> DBLOCK1 equ 26 ;first block in file 220 <1> DSIZE equ 28 ;current file size 221 <1> 222 <1> ; DOS Media Password Definitions 223 <1> ; ------------------------------ 224 <1> 225 <1> PWM_OWNER equ 000Fh ; PWD Owner mask 226 <1> PWM_GROUP equ 00F0h ; PWD Group mask 227 <1> PWM_WORLD equ 0F00h ; PWD World mask 228 <1> PWM_R equ 0888h ; PWD required for reading 229 <1> PWM_W equ 0444h ; PWD required for writing 230 <1> PWM_E equ 0222h ; PWD req'd for executing 231 <1> PWM_D equ 0111h ; PWD required for deleting 232 <1> PWM_ANY equ PWM_R+PWM_W+PWM_D ; PWD required for anything 233 <1> 234 <1> 235 <1> ; literal constants 236 <1> 237 <1> FAT12 equ 00fffh ; 12 bit fat 238 <1> FAT16 equ 0ffffh ; 16 bit fat 239 <1> FAT32 equ 0 ; 32 bit fat 240 <1> 241 <1> ENDDIR equ 0ffffh ;end of directory 242 <1> 80 %include "f52data.mac" ; Function 52 DOS Data Area 1 <1> ; File : $F52DATA.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> ; The following equates define the Data Area whose address is 35 <1> ; returned by function 52. 36 <1> ; 37 <1> 38 <1> labelsize F52_BCBBUF, dword, -0008h ; current buffer 39 <1> labelsize F52_BCBOFF, word, -0008h ; current buffer 40 <1> labelsize F52_BCBSEG, word, -0006h ; current buffer 41 <1> labelsize F52_DMDROOT, word, -0002h ; Memory Descriptor Root (Seg) 42 <1> labelsize F52_DDSCPTR, dword, 0000h ; DDSC Table Address 43 <1> labelsize F52_FILEPTR, dword, 0004h ; File Handle Table Address 44 <1> labelsize F52_CLKDEV, dword, 0008h ; Clock Device Header 45 <1> labelsize F52_CONDEV, dword, 000Ch ; Console Device Header 46 <1> labelsize F52_SECSIZE, word, 0010h ; Maximum Sector Size 47 <1> labelsize F52_BUFINFOPTR, dword, 0012h ; Buffer Info pointer 48 <1> labelsize F52_PATHPTR, dword, 0016h ; Path Control Table Address 49 <1> labelsize F52_PATHOFF, word, 0016h 50 <1> labelsize F52_PATHSEG, word, 0018h 51 <1> labelsize F52_FCBPTR, dword, 001Ah ; FCB Table Address 52 <1> ; equ word ptr 001Eh ; #Entries in FCB Table 53 <1> labelsize F52_PHYDRV, byte, 0020h ; Last Physical Drive 54 <1> labelsize F52_LASTDRV, byte, 0021h ; Last Logical Drive 55 <1> labelsize F52_DEVROOT, dword, 0022h ; Root Device Header 56 <1> labelsize F52_JOINDRV, byte, 0034h ; Number of JOIN'd drives 57 <1> labelsize F52_SETVER, dword, 0037h ; SETVER table pointer 58 <1> labelsize F52_NUM_BUF, word, 003Fh ; number of disk buffers 59 <1> labelsize F52_READ_AHEAD, word, 0041h ; size of read-ahead buffer 60 <1> labelsize F52_BOOTDRV, byte, 0043h ; boot drive (1-26) 61 <1> labelsize F52_CPU_TYPE, byte, 0044h ; 01 if >= 386SX 62 <1> labelsize F52_EXT_MEM, word, 0045h ; Int 15h, AH=87h 63 <1> labelsize F52_BUF_INFO, dword, 0047h ; points at Buffer Info 64 <1> labelsize F52_HMAFLAG, byte, 0053h ; 1 if buffers in HMA 65 <1> labelsize F52_DEBLOCK, word, 0056h ; deblock if buffers in HMA 66 <1> labelsize F52_DMD_UPPER, word, 0066h ; upper memory chain 67 <1> labelsize F52_SHARE_STUB, dword, 006Ah ; Share Stub Entries*15 68 <1> 69 <1> ;DRDOS Specific 70 <1> 71 <1> labelsize DRDOS_CRITSTUBS, word, 0000h ; Offset of end of instance data 72 <1> labelsize DRDOS_HIST1CTL, word, 0004h ; History 1 Control 73 <1> labelsize DRDOS_HIST2CTL, word, 0006h ; History 2 Control 74 <1> labelsize DRDOS_HISTFLG, byte, 0008h ; History Buffer Flag 75 <1> labelsize DRDOS_DUAL_LANG, byte, 0009h ; Utils Dual Language Support 76 <1> labelsize DRDOS_CUR_LANG, byte, 000Ah ; Current Language 77 <1> labelsize DRDOS_EXT_MEM, word, 000Bh ; Total Extended Memory 78 <1> labelsize DRDOS_HIMEM_ROOT, word, 0010h ; High memory chain 79 <1> labelsize DRDOS_ENVSEG, word, 0012h ; Seg of environment 80 <1> labelsize DRDOS_DMD_BASE, word, 0016h ; base memory freed at 81 <1> labelsize DRDOS_DMD_UPPER, word, 0018h ; upper memory chain 82 <1> labelsize DRDOS_MACHINE_ID, word, 001Ah ; local machine ID 83 <1> labelsize DRDOS_COUNTRY_FILE, word, 001Eh ; offset of filename 84 <1> labelsize DRDOS_HASHOFF, word, 0020h ; fastopen hash root 85 <1> labelsize DRDOS_HASHSEG, word, 0022h ; pointer 86 <1> labelsize DRDOS_HASHMAX, word, 0024h ; max # dir entries 87 <1> labelsize DRDOS_DEBLOCK, word, 0026h ; himem deblock buffer 88 <1> labelsize DRDOS_INT2F, word, 002Ch ; internal Int 2F hook 81 %include "doshndl.mac" ; DOS Handle Structure Definition 1 <1> ; File : $DOSHNDL.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> labelsize DCNTRL_DSADD, dword, 0000h 36 <1> labelsize DCNTRL_DSOFF, word, 0000h 37 <1> labelsize DCNTRL_DSSEG, word, 0002h 38 <1> labelsize DCNTRL_COUNT, word, 0004h 39 <1> DCNTRL_LEN equ 6 40 <1> 41 <1> labelsize DHNDL_COUNT, word, 00h ; 00 - Usage Count 42 <1> labelsize DHNDL_MODE, word, 02h ; 02 - File Mode 43 <1> 44 <1> DHM_FCB equ 8000h ; marks as FCB 45 <1> DHM_COMMIT equ 4000h ; auto-commit file 46 <1> DHM_NOCRIT equ 2000h ; no critical errors 47 <1> DHM_LOCAL equ 10000000b ; file is not inherited 48 <1> DHM_SHAREMSK equ 01110000b ; sharing bits 49 <1> DHM_COMPAT equ 00000000b 50 <1> DHM_DENY_ALL equ 00010000b ; exclusive - deny all 51 <1> DHM_DENY_WRITE equ 00100000b 52 <1> DHM_DENY_READ equ 00110000b 53 <1> DHM_DENY_NONE equ 01000000b 54 <1> DHM_RWMSK equ 00001111b ; read write bits 55 <1> DHM_RW equ 00000010b ; file opened read/write 56 <1> DHM_WO equ 00000001b ; file opened write only 57 <1> DHM_RO equ 00000000b ; file opened read only 58 <1> 59 <1> ; 60 <1> ; 01h to 03h To be Determined 61 <1> ; 62 <1> labelsize DHNDL_DATRB, byte, 04h ; Disk attribute byte 63 <1> labelsize DHNDL_ATTR, byte, 05h ; Attribute Byte 64 <1> labelsize DHNDL_WATTR, word, 05h ; Attribute Word 65 <1> 66 <1> DHAT_REMOTE equ 8000h ; set if file remote 67 <1> DHAT_TIMEOK equ 4000h ; set if timestamp up to date 68 <1> DHAT_LOCAL equ 1000h ; file is not inherited 69 <1> DHAT_NETPRN equ 0800h ; device is networked printer 70 <1> DHAT_DEV equ 0080h ; device/file bit 71 <1> DHAT_READY equ 0040h ; ready/not ready bit 72 <1> DHAT_CLEAN equ 0040h ; this bit CLEAR if dirty 73 <1> DHAT_BIN equ 0020h ; raw/cooked bit 74 <1> DHAT_DRVMSK equ 001Fh ; drive in bottom bits 75 <1> DHAT_CLK equ 0008h ; -reserved- 76 <1> DHAT_NUL equ 0004h ; handle is null device 77 <1> DHAT_COT equ 0002h ; handle is console output device 78 <1> DHAT_CIN equ 0001h ; handle is console input device 79 <1> 80 <1> labelsize DHNDL_DEVPTR, dword, 07h ; 07 - pointer to device 81 <1> labelsize DHNDL_DEVOFF, word, 07h ; 07 - offset of device 82 <1> labelsize DHNDL_DEVSEG, word, 09h ; 09 - segment of device 83 <1> labelsize DHNDL_BLK1, word, 0Bh ; 0B - first cluster in file 84 <1> ; (lower 32 bits) 85 <1> labelsize DHNDL_TIME, word, 0Dh ; 0D - file time stamp 86 <1> labelsize DHNDL_DATE, word, 0Fh ; 0F - file date stamp 87 <1> labelsize DHNDL_SIZE, dword, 11h ; 11 - file length 88 <1> ; (lower 32 bits) 89 <1> labelsize DHNDL_SIZELO, word, 11h 90 <1> labelsize DHNDL_SIZEHI, word, 13h 91 <1> labelsize DHNDL_POS, dword, 15h ; 15 - current file position 92 <1> ; (lower 32 bits) 93 <1> labelsize DHNDL_POSLO, word, 15h 94 <1> labelsize DHNDL_POSHI, word, 17h 95 <1> labelsize DHNDL_IDX, word, 19h ; 19 - relative cluster within file of last read 96 <1> ; (lower 32 bits) 97 <1> labelsize DHNDL_DBLK, word, 1Bh ; 1B - cluster # of dir entry 98 <1> ; (lower 32 bits) 99 <1> labelsize DHNDL_DCNTHI, byte, 1Eh ; 1E - dir offset # within cluster 100 <1> labelsize DHNDL_DCNTLO, byte, 1Fh ; 1F - dir offset # within cluster 101 <1> labelsize DHNDL_NAME, byte, 20h ; 20 - File/Device Name 102 <1> labelsize DHNDL_EXT, byte, 28h ; 28 - File extension 103 <1> labelsize DHNDL_SFT, dword, 2Bh ; 2B - pointer to previous SFT 104 <1> labelsize DHNDL_UID, word, 2Fh ; 2F - Owning Machine ID 105 <1> labelsize DHNDL_PSP, word, 31h ; 31 - Owning PSP 106 <1> labelsize DHNDL_SHARE, word, 33h ; 33 - Offset of sharing record 107 <1> labelsize DHNDL_BLK, word, 35h ; 35 - absolute cluster of last read 108 <1> ; (lower 32 bits) 109 <1> ; 37 - dword reserved for IFS 110 <1> labelsize DHNDL_BLK1H, word, 3Bh ; 3B - first cluster in file 111 <1> ; (higher 32 bits) 112 <1> labelsize DHNDL_IDXH, word, 3Dh ; 3D - relative cluster within file of last read 113 <1> ; (higher 32 bits) 114 <1> labelsize DHNDL_DBLKH, word, 3Fh ; 3F - cluster # of dir entry 115 <1> ; (higher 32 bits) 116 <1> labelsize DHNDL_BLKH, word, 41h ; 41 - absolute cluster of last read 117 <1> ; (higher 32 bits) 118 <1> labelsize DHNDL_SIZEX, dword, 43h ; 43 - file length 119 <1> ; (higher 32 bits) 120 <1> labelsize DHNDL_SIZEXLO, word, 43h 121 <1> labelsize DHNDL_SIZEXHI, word, 45h 122 <1> labelsize DHNDL_POSX, dword, 47h ; 47 - current file position 123 <1> ; (higher 32 bits) 124 <1> labelsize DHNDL_POSXLO, word, 47h 125 <1> labelsize DHNDL_POSXHI, word, 49h 126 <1> DHNDL_LEN equ 4Bh 127 <1> 128 <1> ; With DOS 3 structures _DBLK is a 16 bit 129 <1> 130 <1> 131 <1> ; Logical Drive Table format 132 <1> labelsize LDT_NAME, byte, 00h ; 00 - Ascii Name field 133 <1> labelsize LDT_FLAGS, word, 43h ; 43 - Flag field 134 <1> labelsize LDT_PDT, dword, 45h ; 45 - PDT for this drive 135 <1> labelsize LDT_BLK, word, 49h ; 49 - directory sector 136 <1> labelsize LDT_ROOT, word, 4bh ; 4B - virtual block root 137 <1> labelsize LDT_DRV, byte, 4dh ; 4D - physical drive 138 <1> labelsize LDT_ROOTLEN, word, 4fh ; 4F - Length of root portion 139 <1> labelsize LDT_BLKH, word, 51h 140 <1> labelsize LDT_ROOTH, word, 53h 141 <1> LDT_LEN equ 58h 142 <1> 143 <1> LFLG_NETWRKD equ 8000h 144 <1> LFLG_PHYSICAL equ 4000h 145 <1> LFLG_JOINED equ 2000h 146 <1> LFLG_SUBST equ 1000h 82 %include "country.mac" 1 <1> ; File : $COUNTRY.DEF$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> US_DATE equ 0 ; American Date Format mm/dd/yy 36 <1> EURO_DATE equ 1 ; European Date Format dd/mm/yy 37 <1> JAP_DATE equ 2 ; Japanese Date Format yy/mm/dd 38 <1> 39 <1> CLOCK_12 equ 0 ; 12 Hour Clock Time Format 40 <1> CLOCK_24 equ 1 ; 24 Hour Clock Time Format 41 <1> 42 <1> labelsize CI_CODE, word, 0FFFCh ; Country Code 43 <1> labelsize CI_CODEPAGE, word, 0FFFEh ; Code page 44 <1> labelsize CI_DATEFMT, word, 0 ; Date Format 45 <1> labelsize CI_CURRENCY, byte, 2 ; Currency Symbols 46 <1> labelsize CI_THOUSANDS, byte, 7 ; Thousands Separator 47 <1> labelsize CI_DECIMAL, byte, 9 ; Decimal Separator 48 <1> labelsize CI_DATESEP, byte, 11 ; Date Separator 49 <1> labelsize CI_TIMESEP, byte, 13 ; Time Separator 50 <1> labelsize CI_CURFMT, byte, 15 ; Currency Format 51 <1> labelsize CI_CURDIGITS, byte, 16 ; Significant Currency Digits 52 <1> labelsize CI_TIMEFMT, byte, 17 ; Time Format 53 <1> labelsize CI_CASEOFF, word, 18 ; Case Translation Offset 54 <1> labelsize CI_CASESEG, word, 20 ; Case Translation Segment 55 <1> labelsize CI_DATASEP, byte, 22 ; Data List Separator 56 <1> CI_STATICLEN equ 24 ; Static Country Data Length 57 <1> CI_LENGTH equ 32 ; Total Country Data Length 58 <1> 59 <1> labelsize EXI_ID, byte, 0 ; Information ID 60 <1> labelsize EXI_TBLOFF, word, 1 ; Table Offset 61 <1> labelsize EXI_TBLSEG, word, 3 ; Table Segment 62 <1> 63 <1> labelsize EXI_ID1, byte, 0 ; 6501 Info ID (why move it?!) 64 <1> labelsize EXI_LENGTH, word, 1 ; 6501 Table Length 65 <1> EXI_DATA_LEN equ 3 ; 6501 Country Data 66 <1> 67 <1> labelsize EXCI_CUR_COUNTRY, word, 0 ; Current Country 68 <1> labelsize EXCI_CUR_CP, word, 2 ; Current Codepage 69 <1> EXCI_CI_DATAOFF equ 4 ; Start of CI_ data 70 <1> 71 <1> EXCI_STATLEN equ CI_STATICLEN+4 ; Static Ext Country Info 72 <1> EXCI_MAXLEN equ EXCI_STATLEN+10+EXI_DATA_LEN ; Max Ext Country Info 73 <1> 83 84 ADDDRV equ 0 85 86 TRUE equ 0FFFFh ; value of TRUE 87 FALSE equ 0 ; value of FALSE 88 89 ;F5KEY equ 3F00h ; keys returned by BIOS 90 ;F8KEY equ 4200h ; in boot_options 91 92 SWITCH_F equ 01h ; in boot_switches 93 SWITCH_N equ 02h 94 95 SWITCH_MAX equ 10 ; maximum number of SWITCH commands 96 97 labelsize CFG_NAME, word, 0000h ; Command Name 98 labelsize CFG_FUNC, word, 0002h ; Command Subroutine 99 labelsize CFG_FLAGS, word, 0004h ; Command flags 100 CFG_SIZE equ 6 ; Size of each Entry 101 102 CF_LAST equ 0003h ; execute in last config pass 103 CF_NOF equ 0008h ; set if F5/F8 should be ignored 104 CF_LC equ 0010h ; set if case should be preserved 105 CF_QUERY equ 0020h ; set at run time eg. "DEVICE?" 106 CF_ALL equ 0040h ; execute in all config passes 107 108 labelsize drivp_spt, word, ioctl_bpb+13 109 labelsize drivp_heads, word, ioctl_bpb+15 ; # of heads 110 111 group CGROUP INITCODE INITDATA INITENV 112 ASSUME CS:CGROUP,DS:CGROUP 113 === Switch to base=000000h -> "INITCODE" 114 section INITCODE public align=16 class=INITCODE 115 116 extrn whitespace:near 117 extrn build_cmd_tail:near 118 extrn device_init:near 119 extrn init_static_request:near 120 extrn block_device:near 121 extrn device_insert:near 122 %ifn ADDDRV 123 extrn nls_hook:near 124 extrn nls_unhook:near 125 %endif 126 127 CONFIG_ERRLVL equ 400h ; special 'CONFIG' error level 128 129 ; config_process returns CF set if an error occurred during command file 130 ; processing for ADDDRV.EXE 131 132 Public config_process 133 config_process: ; Process CONFIG.SYS 134 0 000066D0 8926[F505] mov [save_sp],sp ; save SP for unstructured GOSUB's 136 137 %if ADDDRV 138 mov byte [error_flag],0 139 %else 0 000066D4 B8[0000] mov ax,offset envstart ; env buffer is para aligned 0 000066D7 B104 mov cl,4 0 000066D9 D3E8 shr ax,cl ; convert offset to paras 0 000066DB 8CD9 mov cx,ds 0 000066DD 01C8 add ax,cx ; segment of env variables 0 000066DF C41E[0000] les bx,[drdos_ptr] 0 000066E3 26894712 mov [es:DRDOS_ENVSEG + bx],ax ; tell COMMAND.COM where we are 0 000066E7 1E push ds 0 000066E8 07 pop es 149 %endif 150 0 000066E9 B419 mov ah,MS_DRV_GET ; check whether we are loading from 0 000066EB CD21 int DOS_INT ; drive C: 0 000066ED 3C02 cmp al,2 0 000066EF 7413 je preload_security 0 000066F1 1E push ds 0 000066F2 B432 mov ah,32h ; get DOS parameter block 0 000066F4 B203 mov dl,3 ; ensure drive C: is valid (no critical 0 000066F6 CD21 int DOS_INT ; errors) 0 000066F8 1F pop ds 0 000066F9 3CFF cmp al,0ffh ; skip if the drive is not valid 0 000066FB 740A je preload_stacker 0 000066FD C606[0700]01 mov byte [alt_drive],1 ; drive C: should be used also 0 00006702 EB03 jmp preload_stacker 164 165 preload_security: 0 00006704 E82F02 call preload_device ; preload the SECURITY device driver 167 168 preload_stacker: 0 00006707 C706[0800][1A00] mov word [preload_file],offset stacker_file+2 0 0000670D E82602 call preload_device ; preload STACKER from default drive 0 00006710 7326 jnc preload_done 172 0 00006712 C706[0800][2900] mov word [preload_file],offset dblspace_file+2 0 00006718 E81B02 call preload_device ; STACKER failed, try DBLSPACE from default 0 0000671B 731B jnc preload_done 176 0 0000671D 803E[0700]00 cmp byte [alt_drive],0 ; STACKER and DBLSPACE failed on A:, 0 00006722 7414 je preload_done ; should we look on drive C:? 179 0 00006724 C706[0800][1800] mov word [preload_file],offset stacker_file 0 0000672A E80902 call preload_device ; preload STACKER from drive C: 0 0000672D 7309 jnc preload_done 183 0 0000672F C706[0800][2700] mov word [preload_file],offset dblspace_file 0 00006735 E8FE01 call preload_device ; STACKER failed, try DBLSPACE from C: 186 187 Public preload_done 188 preload_done: 0 00006738 B8803D mov ax,(MS_X_OPEN*256)+80h ; Open the configuration file 0 0000673B BA[3700] mov dx,offset cfg_file ; Try Opening the file DCONFIG.SYS 0 0000673E CD21 int DOS_INT ; if this fails then open CONFIG.SYS 0 00006740 7310 jnc cfg_20 ; Found DCONFIG.SYS 193 194 %if ADDDRV 195 mov si,dx 196 mov dx,offset err_no_command_file 197 xor al,al 198 call config_error 199 jmp short cfg_exit 200 %else 0 00006742 BE[3800] mov si,offset cfg_file+1 0 00006745 BF[3700] mov di,offset cfg_file 0 00006748 E8BA14 call copy_asciiz ; make DCONFIG.SYS = CONFIG.SYS 204 0 0000674B B8803D mov ax,(MS_X_OPEN*256)+80h ; Open the configuration file 0 0000674E CD21 int DOS_INT ; CONFIG.SYS 0 00006750 7229 jc cfg_exit ; Return on error without complaint 208 %endif 209 210 cfg_20: 0 00006752 89C3 mov bx,ax ; get the CONFIG handle 0 00006754 B43E mov ah,MS_X_CLOSE ; Close the CONFIG file 0 00006756 CD21 int DOS_INT 214 215 cfg_nextline: ; Read the next command line 0 00006758 E83612 call readline ; If Carry then Terminal Error 0 0000675B 721E jc cfg_exit ; so Exit 0 0000675D A1[FD00] mov ax,[boot_options] 219 cfg_continue: 0 00006760 50 push ax ; save query options 0 00006761 E85510 call scan ; Now Scan the command List 0 00006764 58 pop ax ; recover query options 0 00006765 720A jc cfg_error ; for a matching command name 0 00006767 E81900 call cfg_query ; prompt to see if we want it 0 0000676A 72EC jc cfg_nextline 0 0000676C FF5502 call [CFG_FUNC + di] ; Execute the request command 0 0000676F EBE7 jmp short cfg_nextline ; and loop till the end of the file 228 229 cfg_error: 0 00006771 BA[0000] mov dx,offset bad_command ; Display a Bad command error msg 0 00006774 B00D mov al,CR ; and the CR terminated string 0 00006776 E81D10 call config_error ; then continue processing 0 00006779 EBDD jmp short cfg_nextline ; Carry Returned On Error 234 235 cfg_exit: 0 0000677B 8B26[F505] mov sp,[save_sp] ; get back the real stack 0 0000677F E80601 call preload_complete ; move transcient code to final position 238 %if ADDDRV 239 cmp byte [error_flag],1 ;Set CF if error flag is zero 240 cmc ;Set CF if error flag is 1 241 %endif 0 00006782 C3 ret 243 244 245 cfg_query: 246 ; On Entry: 247 ; AX = boot_options key 248 ; SI -> command tail 249 ; DI -> CFG_ 250 ; On Exit: 251 ; CY set if we should skip command 252 ; SI/DI preserved 253 ; 0 00006783 56 push si 0 00006784 57 push di 0 00006785 8B5504 mov dx,[CFG_FLAGS + di] ; flags for this config command 0 00006788 803E[0000]00 cmp byte [configpass],0 ; CF_ALL does not include pass 0 0 0000678D 7406 je cfg_query05 ; so skip the test in this pass 0 0000678F F7C24000 test dx,CF_ALL ; present in all phases? 0 00006793 750D jnz cfg_query06 ; yes, then execute it 261 cfg_query05: 0 00006795 80E207 and dl,CF_NOF-1 ; config pass to execute in 0 00006798 3A16[0000] cmp dl,[configpass] ; does the phase number match? 0 0000679C 7404 je cfg_query06 ; yes 0 0000679E F9 stc 0 0000679F E9DC00 jmp cfg_query90 ; else skip the command 267 268 cfg_query06: 0 000067A2 F745040800 test word [CFG_FLAGS + di],CF_NOF ; are Function Keys allowed ? 270 ; clc ; if not process the command 0 000067A7 7403 jz cfg_query06a 0 000067A9 E9D200 jmp cfg_query90 273 cfg_query06a: 0 000067AC 3D003F cmp ax,F5KEY ; F5 bypasses CONFIG processing 0 000067AF F9 stc ; so bypass this line 276 ; je cfg_query90 0 000067B0 7503 jne cfg_query07 0 000067B2 E9C900 jmp cfg_query90 279 cfg_query07: 0 000067B5 F745042000 test word [CFG_FLAGS + di],CF_QUERY ; specific QUERY request ? 0 000067BA 7509 jnz cfg_query10 0 000067BC 3D0042 cmp ax,F8KEY ; should we prompt for everything ? 0 000067BF F8 clc ; if not process the command 284 ; jne cfg_query90 0 000067C0 7403 je cfg_query10 0 000067C2 E9B900 jmp cfg_query90 287 cfg_query10: 0 000067C5 56 push si 0 000067C6 8B35 mov si,[CFG_NAME + di] ; DS:SI -> command name we matched 290 cfg_query20: 0 000067C8 AC lodsb ; get character 0 000067C9 84C0 test al,al ; zero terminated 0 000067CB 7407 jz cfg_query30 0 000067CD 92 xchg ax,dx ; DL= character 0 000067CE B402 mov ah,MS_C_WRITE 0 000067D0 CD21 int DOS_INT ; output the character 0 000067D2 EBF4 jmp short cfg_query20 ; "DEVICE" 298 cfg_query30: 0 000067D4 B23D mov dl,'=' 0 000067D6 B402 mov ah,MS_C_WRITE 0 000067D8 CD21 int DOS_INT ; "DEVICE=" 0 000067DA 5E pop si ; rest of command line 303 cfg_query40: 0 000067DB AC lodsb 0 000067DC 3C0D cmp al,CR ; is it the end of the line ? 0 000067DE 7407 je cfg_query50 ; no, do another character 0 000067E0 92 xchg ax,dx ; DL= character 0 000067E1 B402 mov ah,MS_C_WRITE 0 000067E3 CD21 int DOS_INT ; output the character 0 000067E5 EBF4 jmp short cfg_query40 ; "DEVICE=FILENAME.SYS" 311 cfg_query50: 0 000067E7 B409 mov ah,MS_C_WRITESTR ; Output msg of form " (Y/N) ? " 0 000067E9 BA[BF05] mov dx,offset confirm_msg1 0 000067EC CD21 int DOS_INT ; do " (" 0 000067EE B402 mov ah,MS_C_WRITE 0 000067F0 8A16[0000] mov dl,[yes_char] 0 000067F4 CD21 int DOS_INT ; do "Y" 0 000067F6 B22C mov dl,',' 0 000067F8 CD21 int DOS_INT ; do "," 0 000067FA 8A16[0000] mov dl,[no_char] 0 000067FE CD21 int DOS_INT ; do "N" 0 00006800 B22C mov dl,',' 0 00006802 CD21 int DOS_INT ; do "," 0 00006804 8A16[0000] mov dl,[run_char] 0 00006808 CD21 int DOS_INT ; do "R" 0 0000680A B409 mov ah,MS_C_WRITESTR 0 0000680C BA[C205] mov dx,offset confirm_msg2 0 0000680F CD21 int DOS_INT ; do ") ? " 329 cfg_query60: 0 00006811 E8F813 call wait_for_key ; wait until a key is pressed 0 00006814 A0[EF05] mov al,[default_query_char] ; if we timeout default 0 00006817 720C jc cfg_query70 0 00006819 B407 mov ah,MS_C_RAWIN 0 0000681B CD21 int DOS_INT ; read a char 0 0000681D 84C0 test al,al ; is it a function key ? 0 0000681F 7504 jnz cfg_query70 0 00006821 B407 mov ah,MS_C_RAWIN 0 00006823 CD21 int DOS_INT ; throw away function keys 339 ; jmps cfg_query60 340 cfg_query70: 0 00006825 3C0D cmp al,13 ; accept for 'yes' 0 00006827 7505 jne cfg_query71 0 00006829 A0[0000] mov al,[yes_char] 0 0000682C EB3F jmp short cfg_query80 345 cfg_query71: 0 0000682E 3C20 cmp al,32 ; accept for 'no' 0 00006830 7506 jne cfg_query72 0 00006832 A0[0000] mov al,[no_char] 0 00006835 F9 stc 0 00006836 EB35 jmp short cfg_query80 351 cfg_query72: 0 00006838 3C1B cmp al,27 ; accept for 'run' 0 0000683A 750B jne cfg_query73 0 0000683C A0[0000] mov al,[run_char] 0 0000683F C706[FD00]0000 mov word [boot_options],0 0 00006845 EB26 jmp short cfg_query80 357 cfg_query73: 0 00006847 E84D10 call toupper ; make response upper case 0 0000684A 3A06[0000] cmp al,[yes_char] 0 0000684E 741D je cfg_query80 0 00006850 3A06[0000] cmp al,[no_char] 0 00006854 7503 jne cfg_query75 0 00006856 F9 stc 0 00006857 EB14 jmp short cfg_query80 365 cfg_query75: 0 00006859 3A06[0000] cmp al,[run_char] 0 0000685D 7408 je cfg_query76 0 0000685F B402 mov ah,MS_C_WRITE 0 00006861 B207 mov dl,7 0 00006863 CD21 int DOS_INT ; beep 0 00006865 EBAA jmp short cfg_query60 372 cfg_query76: 0 00006867 C706[FD00]0000 mov word [boot_options],0 374 cfg_query80: 0 0000686D 9C pushf 0 0000686E 50 push ax ; save response 0 0000686F B402 mov ah,MS_C_WRITE 0 00006871 88C2 mov dl,al 0 00006873 CD21 int DOS_INT ; echo the char 0 00006875 B409 mov ah,MS_C_WRITESTR 0 00006877 BA[C705] mov dx,offset confirm_msg3 ; "DEVICE=FILENAME.SYS (Y/N) ?" 0 0000687A CD21 int DOS_INT ; now do CR/LF to tidy up 0 0000687C 58 pop ax 384 ; call toupper ; make response upper case 385 ; cmp al,yes_char ; is it yes ? 386 ; je cfg_query90 387 ; stc ; return CY set, skip this line 0 0000687D 9D popf 389 cfg_query90: 0 0000687E 5F pop di 0 0000687F 5E pop si 0 00006880 C3 ret 393 394 395 call_preload_entry: ; call the preload device driver back door 0 00006881 1E push ds ; all DBLSPACE calls destroy DS register 0 00006882 FF1E[0000] call far [preload_entry] 0 00006886 1F pop ds 0 00006887 C3 ret 400 401 preload_complete: ; CONFIG processing complete 0 00006888 1E push ds 0 00006889 06 push es 0 0000688A B8114A mov ax,4a11h ; DBLSPACE presence check 0 0000688D 31DB xor bx,bx 0 0000688F CD2F int 2fh 0 00006891 09C0 or ax,ax 0 00006893 7546 jnz reloc_end 0 00006895 F7C20080 test dx,8000h ; is relocation already complete (may 0 00006899 7440 jz reloc_end ; be done by HIDEVICE statement) 0 0000689B BBFFFF mov bx,0ffffh ; query the size of the transcient 0 0000689E B8114A mov ax,4a11h ; portion 0 000068A1 CD2F int 2fh 414 0 000068A3 8B0E[0000] mov cx,[mem_current] ; pull transcient portion down to low 0 000068A7 8EC1 mov es,cx ; memory 0 000068A9 41 inc cx 0 000068AA 26C606000044 mov byte [es:DMD_ID],'D' ; control block type is 'D' (device 0 000068B0 26890E0100 mov [es:DMD_PSP],cx ; driver), owner is self 0 000068B5 26A30300 mov [es:DMD_LEN],ax 0 000068B9 40 inc ax ; control block overhead 0 000068BA 0106[0000] add [mem_current],ax 0 000068BE BF0800 mov di,8 ; copy the name to the control block 0 000068C1 8B36[0800] mov si,[preload_file] ; device filename 425 preload_complete10: 0 000068C5 AC lodsb ; get a character 0 000068C6 3C5C cmp al,'\' ; have we found the '\' yet ? 0 000068C8 75FB jne preload_complete10 ; no, go swallow another character 0 000068CA A5 movsw 0 000068CB A5 movsw 0 000068CC A5 movsw 0 000068CD A5 movsw ; copy the 8 bytes 0 000068CE 8CC0 mov ax,es 0 000068D0 40 inc ax ; segment address of free memory 0 000068D1 8EC0 mov es,ax 0 000068D3 BBFEFF mov bx,0fffeh ; move transcient portion down 0 000068D6 B8114A mov ax,4a11h 0 000068D9 CD2F int 2fh 439 reloc_end: 0 000068DB 07 pop es 0 000068DC 1F pop ds 0 000068DD C3 ret 443 444 PreloadFixup: 445 ;------------ 446 ; On Entry: 447 ; None 448 ; On Exit: 449 ; None 450 ; All regs preserved 451 ; 0 000068DE 06 push es 0 000068DF 53 push bx 0 000068E0 50 push ax 0 000068E1 A0[0600] mov al,[preload_drv] ; get number of preload drives 0 000068E4 C41E[0000] les bx,[func52_ptr] 0 000068E8 26284720 sub [es:F52_PHYDRV + bx],al 0 000068EC 26284721 sub [es:F52_LASTDRV + bx],al 0 000068F0 58 pop ax 0 000068F1 5B pop bx 0 000068F2 07 pop es 0 000068F3 C3 ret 463 464 PreloadCleanup: 465 ;-------------- 466 ; On Entry: 467 ; None 468 ; On Exit: 469 ; None 470 ; 471 ; inform DBLSPACE about each device driver 0 000068F4 1E push ds 0 000068F5 06 push es 0 000068F6 31C0 xor ax,ax 0 000068F8 8606[0600] xchg al,[preload_drv] ; get number of preload drives 0 000068FC C41E[0000] les bx,[func52_ptr] 0 00006900 26004720 add [es:F52_PHYDRV + bx],al 0 00006904 26004721 add [es:F52_LASTDRV + bx],al 0 00006908 B8114A mov ax,4a11h ; DBLSPACE installation check 0 0000690B 31DB xor bx,bx 0 0000690D CD2F int 2fh 0 0000690F 09C0 or ax,ax 0 00006911 7520 jnz broadcast_exit 0 00006913 F7C20080 test dx,8000h ; initialisation complete? 0 00006917 741A jz broadcast_exit 0 00006919 882E[0600] mov [preload_drv],ch ; save # preload drives 0 0000691D 8B16[0000] mov dx,[mem_max] ; top of available memory 0 00006921 8B0E[0000] mov cx,[mem_current] ; base of available memory 0 00006925 29CA sub dx,cx 0 00006927 B455 mov ah,55h ; version number 0 00006929 A0[0000] mov al,[dev_count] ; number of new units installed 0 0000692C BB0200 mov bx,02h 0 0000692F FF1E[0000] call far [preload_entry] 494 broadcast_exit: 0 00006933 07 pop es 0 00006934 1F pop ds 0 00006935 C3 ret 498 499 preload_device: ; preload disk compression driver before 500 ; processing (D)CONFIG.SYS file 0 00006936 8B16[0800] mov dx,[preload_file] 0 0000693A 8B0E[0000] mov cx,[mem_current] ; next available segment address 0 0000693E 8EC1 mov es,cx 0 00006940 41 inc cx 0 00006941 26C606000044 mov byte [es:DMD_ID],'D' ; control block type is 'D' (device 0 00006947 26890E0100 mov [es:DMD_PSP],cx ; driver), owner is self 0 0000694C BF0800 mov di,8 ; copy the name to the control block 0 0000694F 89D6 mov si,dx ; device filename 509 preload_device10: 0 00006951 AC lodsb ; get a character 0 00006952 3C5C cmp al,'\' ; have we found the '\' yet ? 0 00006954 75FB jne preload_device10 ; no, go swallow another character 0 00006956 A5 movsw 0 00006957 A5 movsw 0 00006958 A5 movsw 0 00006959 A5 movsw ; copy the 8 bytes 0 0000695A 8CC0 mov ax,es 0 0000695C 40 inc ax ; segment address of free memory 0 0000695D A3[0000] mov [dev_load_seg],ax ; destination segment for EXEC call 0 00006960 A3[0000] mov [dev_reloc_seg],ax ; relocation factor for .EXE drivers 0 00006963 50 push ax 0 00006964 1E push ds 0 00006965 07 pop es 0 00006966 BB[0000] mov bx,offset dev_epb ; ES:BX control structure 0 00006969 B8034B mov ax,(MS_X_EXEC * 256)+3 0 0000696C CD21 int DOS_INT 0 0000696E 07 pop es ; ES:0 -> preload driver 0 0000696F 7303 jnc load_ok 529 load_bad: 0 00006971 E9B400 jmp preload_exit 531 load_ok: 0 00006974 26813E12002C2E cmp WORD [es:12h],2e2ch ; preload device signature 0 0000697B 75F4 jne load_bad 0 0000697D 8C06[0200] mov [preload_seg],es ; back door entry to preload driver 0 00006981 26833E820006 cmp word [es:82h],6 ; is it the old DBLSPACE driver ? 0 00006987 7506 jne load_new_dblspace 0 00006989 C706[0400]0600 mov word [preload_ver],6 ; yes, give it the old version 538 load_new_dblspace: 0 0000698F C706[0000]0000 mov word [rel_unit],0 ; reset driver relative unit no. 0 00006995 BB[0000] mov bx,offset request_hdr ; DS:BX static INIT request header 0 00006998 A1[0000] mov ax,[mem_max] ; highest segment available to the 0 0000699B C7470E0000 mov word [RH0_RESIDENT + bx],0 ; driver 0 000069A0 894710 mov [RH0_RESIDENT+2 + bx],ax 0 000069A3 8CC8 mov ax,cs 0 000069A5 8EC0 mov es,ax 0 000069A7 1E push ds 0 000069A8 E8[0000] call init_static_request ; initialise remaining fields 0 000069AB 2EA1[0400] mov ax,[cs:preload_ver] 0 000069AF FF1E[0000] call far [preload_entry] 0 000069B3 1F pop ds 0 000069B4 7272 jc preload_exit ; INIT function fails if CARRY set 0 000069B6 09C0 or ax,ax ; or AX != 0 0 000069B8 756E jnz preload_exit 554 ;; mov ax,ds:RH0_RESIDENT[bx] ; end of resident portion (offset) 555 ;; add ax,15 ; convert offset to paragraph size 556 ;; mov cl,4 557 ;; shr ax,cl 558 ;; add ax,ds:RH0_RESIDENT+2[bx] ; end of resident portion (segment) 559 ;JS we should check that the source and destination do not overlap here! 560 0 000069BA BB0400 mov bx,04h ; find the size of the transient code 0 000069BD E8C1FE call call_preload_entry 0 000069C0 2906[0000] sub [mem_max],ax ; move the top of available memory down 564 0 000069C4 8E06[0000] mov es,[mem_max] ; ES destination for relocatable code 0 000069C8 FF0E[0000] dec word [mem_max] ; last free segment address 0 000069CC BB0600 mov bx,06h ; call driver to relocate code etc. 0 000069CF E8AFFE call call_preload_entry 0 000069D2 40 inc ax 0 000069D3 A3[0000] mov [mem_current],ax ; update base of free TPA 571 0 000069D6 8E06[0200] mov es,[preload_seg] 0 000069DA 31FF xor di,di ; ES:DI -> preload driver 0 000069DC BB[0000] mov bx,offset request_hdr 0 000069DF 8A470D mov al,[RH0_NUNITS + bx] 0 000069E2 84C0 test al,al 0 000069E4 7407 jz preload_char_dev 0 000069E6 0006[0600] add [preload_drv],al ; remember how many preloaded drives 0 000069EA E8[0000] call block_device ; setup the DPBs and other block structures 580 581 preload_char_dev: 0 000069ED 8B0E[0000] mov cx,[mem_current] 0 000069F1 A1[0200] mov ax,[preload_seg] 0 000069F4 29C1 sub cx,ax ; CX = length of preload driver 0 000069F6 48 dec ax 0 000069F7 8EC0 mov es,ax ; ES:0 -> "DMD" for preload driver 0 000069F9 26890E0300 mov [es:DMD_LEN],cx 0 000069FE 40 inc ax 0 000069FF 8EC0 mov es,ax 0 00006A01 31FF xor di,di ; ES:DI -> "device" header 0 00006A03 B8FFFF mov ax,0FFFFh 0 00006A06 268905 mov [es:di],ax 0 00006A09 26894502 mov [es:2 + di],ax 0 00006A0D E8[0000] call device_insert ; insert device into chain 595 0 00006A10 8B16[0000] mov dx,[mem_max] ; top of available memory 0 00006A14 8B0E[0000] mov cx,[mem_current] ; base of available memory 0 00006A18 29CA sub dx,cx 0 00006A1A B80055 mov ax,5500h ; AH = version, AL = all internal drives 0 00006A1D BB0200 mov bx,02h ; mount existing container files 0 00006A20 E85EFE call call_preload_entry 602 0 00006A23 31DB xor bx,bx ; complete initialisation (hook 0 00006A25 E859FE call call_preload_entry ; interrupts etc.) 605 606 preload_exit: 0 00006A28 0E push cs 0 00006A29 07 pop es 0 00006A2A C3 ret 610 611 612 613 func_hidevice: ; HIDEVICE=filename 614 ; Look for /L:r1[,s1][;r2[,s2]] [/S] filename 615 ; Look for SIZE= filename 616 0 00006A2B C706[E505]0000 mov word [himem_region],0 ; assume no region supplied 0 00006A31 C706[E705]0000 mov word [himem_size],0 ; and no size 0 00006A37 BF[CA05] mov di,offset region_opt ; check out /L: region option 0 00006A3A E8C00D call compare 0 00006A3D 720D jc hidevice10 0 00006A3F E82410 call parse_region ; get region and size 0 00006A42 7313 jnc hidevice20 0 00006A44 31F6 xor si,si ; something wrong, give an error 0 00006A46 BA[0000] mov dx,offset bad_filename 0 00006A49 E94A0D jmp config_error 627 628 hidevice10: 0 00006A4C BF[D105] mov di,offset size_opt ; check out SIZE= option 0 00006A4F E8AB0D call compare 0 00006A52 7203 jc hidevice20 ; if no SIZE= just try to load it 0 00006A54 E86510 call parse_size ; else get supplied value 633 hidevice20: 0 00006A57 E8[0000] call whitespace ; we may have a '=' lurking 635 hidevice30: 0 00006A5A AC lodsb ; strip off optional '=' 0 00006A5B 3C3D cmp al,'=' ; before the filename 0 00006A5D 74FB je hidevice30 0 00006A5F 4E dec si ; it wasn't a '=' after all 0 00006A60 E8[0000] call whitespace 641 0 00006A63 A1[E705] mov ax,[himem_size] ; get size parameter 0 00006A66 3D0060 cmp ax,6000h ; should we just load low ? 0 00006A69 7319 jae func_device 0 00006A6B 56 push si 0 00006A6C 85C0 test ax,ax ; have we been given a size ? 0 00006A6E 7503 jne hidevice40 0 00006A70 E87010 call size_file ; get requirements from file size 649 hidevice40: 0 00006A73 E8E010 call himem_setup ; try and find some hi memory 0 00006A76 5E pop si 0 00006A77 720B jc func_device ; if we can't load low 0 00006A79 56 push si 0 00006A7A E80700 call func_device ; now try and install the device 0 00006A7D E85C11 call himem_cleanup ; clean up our hi memory 0 00006A80 5E pop si 0 00006A81 7201 jc func_device ; error loading hi, try low 0 00006A83 C3 ret 659 660 661 func_device: ; DEVICE=filename 0 00006A84 56 push si 0 00006A85 BF[0000] mov di,offset dev_name ; Copy the Device Filename into a 0 00006A88 C60500 mov byte ptr [di],0 ; local buffer and zero terminate 0 00006A8B E8A311 call copy_file 0 00006A8E 5E pop si ; Restore original SI 0 00006A8F 7257 jc device_error 668 0 00006A91 06 push es 0 00006A92 56 push si 0 00006A93 8E06[0000] mov es,[mem_current] ; ES points at structure 0 00006A97 E89700 call BuildHeader 0 00006A9A 5E pop si 0 00006A9B 56 push si 0 00006A9C E8A100 call FindName ; DS:SI -> leafname 0 00006A9F E8BD00 call SetName ; Fill in name info 0 00006AA2 5E pop si 0 00006AA3 07 pop es 679 0 00006AA4 A1[0000] mov ax,[mem_current] ; Get Current Memory Base 0 00006AA7 40 inc ax ; allow a para for a header 0 00006AA8 A3[0000] mov [dev_load_seg],ax ; Setup the Load Address and the 0 00006AAB A3[0000] mov [dev_reloc_seg],ax ; relocation factor to be applied to 684 ; .EXE device drivers 685 0 00006AAE B8003D mov ax,(MS_X_OPEN * 256)+0 ; open file r/o 0 00006AB1 BA[0000] mov dx,offset dev_name 0 00006AB4 CD21 int DOS_INT 0 00006AB6 7230 jc device_error 0 00006AB8 89C3 mov bx,ax ; now find out how big the file is 0 00006ABA B80242 mov ax,(MS_X_LSEEK * 256)+2 0 00006ABD 31C9 xor cx,cx 0 00006ABF 31D2 xor dx,dx ; by seeking to zero bytes from end 0 00006AC1 CD21 int DOS_INT 0 00006AC3 7223 jc device_error 696 0 00006AC5 91 xchg ax,cx ; save lo byte of length 698 0 00006AC6 B43E mov ah,MS_X_CLOSE ; close this file 0 00006AC8 CD21 int DOS_INT 0 00006ACA 721C jc device_error 702 0 00006ACC 89C8 mov ax,cx ; DX:AX file length 0 00006ACE 09D1 or cx,dx ; do we have a zero length file 0 00006AD0 7416 jz device_error ; if so stop now 706 0 00006AD2 B104 mov cl,4 0 00006AD4 D3E8 shr ax,cl ; convert file size to para 0 00006AD6 B10C mov cl,12 0 00006AD8 D3E2 shl dx,cl ; ignore > 1 MByte portion 0 00006ADA 09C2 or dx,ax ; dx = file size in para 0 00006ADC 42 inc dx ; one for rounding error 713 0 00006ADD 0316[0000] add dx,[mem_current] ; top of area needed for the load 0 00006AE1 3B16[0000] cmp dx,[mem_max] ; will file fit (really HIDEVICE check) 0 00006AE5 720F jb func_device10 ; no, stop now 0 00006AE7 C3 ret 718 719 device_error: 0 00006AE8 A3[F305] mov [error_level],ax ; save error code 0 00006AEB B000 mov al,0 0 00006AED BE[0000] mov si,offset dev_name 0 00006AF0 BA[0000] mov dx,offset bad_filename 0 00006AF3 E9A00C jmp config_error 725 726 func_device10: 0 00006AF6 B8034B mov ax,(MS_X_EXEC * 256)+3 ; Use the Load Overlay function to 0 00006AF9 BB[0000] mov bx,offset dev_epb ; Read in and Relocate the Device 0 00006AFC BA[0000] mov dx,offset dev_name ; driver 0 00006AFF CD21 int DOS_INT ; 0 00006B01 72E5 jc device_error 732 733 ; mov dosVersion,ax ; set version number 734 0 00006B03 06 push es 0 00006B04 A1[0000] mov ax,[mem_current] ; Get Current Memory Base 0 00006B07 50 push ax 0 00006B08 40 inc ax ; skip the header 0 00006B09 31FF xor di,di ; Address of the first device header 0 00006B0B 8EC0 mov es,ax ; in the device chain 741 742 %if ADDDRV 743 test [es:DH_ATTRIB + di],DA_CHARDEV 744 jnz f_dev30 ;Character device driver ? 745 746 ; Can't install block device drivers so output error message and exit. 747 pop es 748 pop es 749 750 xor al,al 751 mov si,offset dev_name 752 mov dx,offset err_block_device 753 jmp config_error 754 755 f_dev30: 756 %endif 757 0 00006B0D E8CEFD call PreloadFixup ; fiddle things for preload 759 %if DOS5 0 00006B10 E88200 call ProtmanFixup ; fiddle int 12 memory for PROTMAN$ 761 %endif 0 00006B13 E8[0000] call device_init ; initialise the device drivers 763 %if DOS5 0 00006B16 E8B200 call ProtmanCleanup ; restore int 12 memory after PROTMAN$ 765 %endif 0 00006B19 A3[F305] mov [error_level],ax ; save error code 0 00006B1C 07 pop es ; by old EMM386.SYS 0 00006B1D A1[0000] mov ax,[mem_current] 0 00006B20 26A30300 mov [es:DMD_LEN],ax ; save memory field 0 00006B24 8CC0 mov ax,es 0 00006B26 40 inc ax 0 00006B27 2629060300 sub [es:DMD_LEN],ax 0 00006B2C 07 pop es 0 00006B2D E8C4FD call PreloadCleanup ; cleanup after ourselves 0 00006B30 C3 ret 776 777 778 BuildHeader: 779 ;----------- 780 ; On Entry: 781 ; ES:0 -> header 782 ; On Exit: 783 ; None 784 ; 0 00006B31 31FF xor di,di 0 00006B33 B044 mov al,'D' 0 00006B35 AA stosb ; ID_FIELD 0 00006B36 8CC0 mov ax,es 0 00006B38 40 inc ax 0 00006B39 AB stosw ; OWNER_FIELD 0 00006B3A 31C0 xor ax,ax 0 00006B3C AA stosb 0 00006B3D AB stosw 0 00006B3E AB stosw ; zero rest up to name 0 00006B3F C3 ret 796 797 798 FindName: 799 ;-------- 800 ; On Entry: 801 ; DS:SI -> pathname of file 802 ; On Exit: 803 ; DS:SI -> final leaf name of file 804 ; CX = length of leaf name 805 ; 0 00006B40 89F1 mov cx,si ; remember start of leaf 807 FindName10: 0 00006B42 AC lodsb 0 00006B43 3C20 cmp al,' ' ; end of the name ? 0 00006B45 7612 jbe FindName30 0 00006B47 E8290D call dbcs_lead ; is it a double byte pair ? 0 00006B4A 7503 jne FindName20 0 00006B4C AC lodsb ; include the second byte 0 00006B4D EBF3 jmp short FindName10 815 FindName20: 0 00006B4F 3C5C cmp al,'\' ; is it a seperator ? 0 00006B51 74ED je FindName 0 00006B53 3C2F cmp al,'/' 0 00006B55 74E9 je FindName 0 00006B57 EBE9 jmp short FindName10 821 FindName30: 0 00006B59 87CE xchg cx,si ; SI -> start of leaf name 0 00006B5B 29F1 sub cx,si 0 00006B5D 49 dec cx ; CX = length 0 00006B5E C3 ret 826 827 828 SetName: 829 ;------- 830 ; On Entry: 831 ; DS:SI -> leaf name to update 832 ; ES = DMD to update 833 ; On Exit: 834 ; CX/SI preserved 835 ; 0 00006B5F 56 push si 0 00006B60 BF0800 mov di,offset DMD_NAME ; point at the owners name field 838 SetName10: 0 00006B63 AC lodsb 0 00006B64 3C20 cmp al,' ' ; end of the name ? 0 00006B66 7618 jbe SetName30 0 00006B68 E8080D call dbcs_lead ; is it a double byte pair ? 0 00006B6B 7509 jne SetName20 0 00006B6D AA stosb ; copy 1st byte of pair 0 00006B6E 83FF10 cmp di,(offset DMD_NAME)+DMD_NAME_LEN 0 00006B71 730D jae SetName30 ; don't overflow if name too long 0 00006B73 A4 movsb ; and the second 0 00006B74 EBED jmp short SetName10 849 850 SetName20: 0 00006B76 AA stosb 0 00006B77 3C2E cmp al,'.' ; discard all following '.' 0 00006B79 7405 je SetName30 0 00006B7B 83FF10 cmp di,(offset DMD_NAME)+DMD_NAME_LEN 0 00006B7E 72E3 jb SetName10 ; don't overflow if name too long 856 SetName30: 0 00006B80 4F dec di 0 00006B81 31C0 xor ax,ax 859 SetName40: 0 00006B83 AA stosb ; zero the '.' 0 00006B84 83FF10 cmp di,(offset DMD_NAME)+DMD_NAME_LEN 0 00006B87 72FA jb SetName40 ; zero the rest of the name 863 SetName50: 0 00006B89 5E pop si 0 00006B8A C3 ret 866 867 %if DOS5 868 869 ROS_MEMORY equ 413h ; main memory on KB 870 0 00006B8B 50524F544D414E24 protmanName db 'PROTMAN$' 872 0 00006B93 0000 protmanAdjust dw 0 874 875 ProtmanFixup: 876 ;------------ 877 ; On Entry: 878 ; ES:DI -> device driver header 879 ; On Exit: 880 ; All regs preserved 881 ; 882 ; fiddle int 12 memory for PROTMAN$ 883 ; 0 00006B95 51 push cx 0 00006B96 56 push si 0 00006B97 57 push di 0 00006B98 2EC706[C304]0000 mov word [cs:protmanAdjust],0 ; assume it's not protman 0 00006B9F BE[BB04] mov si,offset protmanName 889 DEVHDR.NAM equ NAM ; NASM port label 0 00006BA2 8D7D0A lea di,[DEVHDR.NAM + di] ; ES:DI -> device driver name 0 00006BA5 B90400 mov cx,8/2 0 00006BA8 F3A7 repe cmpsw ; does the name match ? 0 00006BAA 751B jne ProtmanFixup10 0 00006BAC 8B36[0000] mov si,[mem_max] ; SI = top of memory in para 0 00006BB0 1E push ds 896 ; xor cx,cx 0 00006BB1 8ED9 mov ds,cx 0 00006BB3 B106 mov cl,10-4 0 00006BB5 D3EE shr si,cl ; convert para to KBytes 0 00006BB7 8B0E1304 mov cx,[ROS_MEMORY] ; CX = existing top of memory 0 00006BBB 29F1 sub cx,si ; CX = amount to hide 0 00006BBD 290E1304 sub [ROS_MEMORY],cx ; hide it 0 00006BC1 1F pop ds 0 00006BC2 2E890E[C304] mov [cs:protmanAdjust],cx ; remember how much we hid 905 ProtmanFixup10: 0 00006BC7 5F pop di 0 00006BC8 5E pop si 0 00006BC9 59 pop cx 0 00006BCA C3 ret 910 911 ProtmanCleanup: 912 ;-------------- 913 ; On Entry: 914 ; None 915 ; On Exit: 916 ; All regs preserved 917 ; restore int 12 memory after PROTMAN$ 918 ; 0 00006BCB 1E push ds 0 00006BCC 50 push ax 0 00006BCD 31C0 xor ax,ax 0 00006BCF 8ED8 mov ds,ax 0 00006BD1 2EA1[C304] mov ax,[cs:protmanAdjust] ; normally zero.. 0 00006BD5 01061304 add [ROS_MEMORY],ax 0 00006BD9 58 pop ax 0 00006BDA 1F pop ds 0 00006BDB C3 ret 928 929 %endif 930 931 ; 932 ; The syntax currently supported is "COUNTRY=NNN,[YYY],[FILENAME]" 933 ; where:- 934 ; NNN is a valid country code based on 935 ; the International Dialing Code 936 ; 937 ; YYY is the default CODEPAGE 938 ; 939 ; FILENAME is the location and name of the COUNTRY.SYS 940 ; file containing the extended country info. 941 ; 942 ; 943 %ifn ADDDRV 944 func_country: ; COUNTRY=nnn,[yyy],[filename] 0 00006BDC E83C0D call atoi ; ax = country code 0 00006BDF 7249 jc f_ctry50 ; check for error 0 00006BE1 A3[0000] mov [country_code],ax ; save the Country Code 0 00006BE4 E8450C call separator ; look for ',' 0 00006BE7 721A jc f_ctry20 0 00006BE9 E82F0D call atoi ; Get the Code Page 0 00006BEC 7203 jc f_ctry10 ; invalid or non existent code page 0 00006BEE A3[0000] mov [code_page],ax ; save default Code Page 953 f_ctry10: 0 00006BF1 E8380C call separator ; look for ',' 0 00006BF4 720D jc f_ctry20 ; copy the supplied pathname 0 00006BF6 C41E[0000] les bx,[drdos_ptr] ; Get the internal data area 0 00006BFA 268B7F1E mov di,[es:DRDOS_COUNTRY_FILE + bx] 958 ; ES:DI -> pcmode buffer for name 0 00006BFE E83010 call copy_file 0 00006C01 0E push cs ; restore ES 0 00006C02 07 pop es 962 f_ctry20: 0 00006C03 E8[0000] call nls_hook ; install our lang support 0 00006C06 8B1E[0000] mov bx, [country_code] ; bx = country code 0 00006C0A B438 mov ah, MS_S_COUNTRY 0 00006C0C B0FF mov al, 0FFh ; 16 bit country code 0 00006C0E BAFFFF mov dx, 0FFFFh ; set country code subfunction 0 00006C11 CD21 int DOS_INT 0 00006C13 7212 jc f_ctry40 ; check for error 0 00006C15 8B1E[0000] mov bx, [code_page] ; bx = code page 0 00006C19 09DB or bx,bx 0 00006C1B 7407 jz f_ctry30 ; No Code Page Set leave as 437 0 00006C1D B80266 mov ax, MS_X_SETCP ; set codepage subfunction 0 00006C20 CD21 int DOS_INT ; to set Current CodePage 0 00006C22 7203 jc f_ctry40 976 f_ctry30: 0 00006C24 E9[0000] jmp nls_unhook ; remove our lang support 978 ; ret 979 980 f_ctry40: 0 00006C27 E8[0000] call nls_unhook ; remove our lang support 982 f_ctry50: 983 ; Bad or non-existant number in command tail. Display error message. 0 00006C2A 31F6 xor si,si 0 00006C2C BA[0000] mov dx, offset bad_country 0 00006C2F E9640B jmp config_error 987 988 989 990 func_shell: ; SHELL=filename 0 00006C32 BF[0000] mov di,offset shell ; Copy the New Command Name 0 00006C35 E8F90F call copy_file ; into the BIOSINIT buffer 0 00006C38 7215 jc shell_error 994 0 00006C3A BF[0100] mov di,offset shell_cline+1 ; Now copy the default command 0 00006C3D B020 mov al,' ' 0 00006C3F AA stosb ; into place 0 00006C40 B90000 mov cx,0 ; 999 f_sh10: 0 00006C43 AC lodsb 0 00006C44 AA stosb ; Copy the next Character 0 00006C45 41 inc cx ; Increment the count 0 00006C46 3C0D cmp al,CR ; Was this the end of string Char 0 00006C48 75F9 jnz f_sh10 ; No so Repeat 0 00006C4A 880E[0000] mov [shell_cline],cl ; Save Command Length 0 00006C4E C3 ret 1007 1008 shell_error: 0 00006C4F B00D mov al,CR 0 00006C51 BA[0000] mov dx,offset bad_shell 0 00006C54 E93F0B jmp config_error 1012 1013 func_hilastdrive: ; HILASTDRIVE=d: 0 00006C57 800E[0000]03 or byte [lastdrvIn],LASTDRV_IN_HMA+LASTDRV_IN_UMB 1015 ; enable HMA and UMB usage for LDT 1016 1017 func_lastdrive: ; LASTDRIVE=d: 0 00006C5C E8BC0C call atoi ; are we supplying a decimal number? 0 00006C5F 720C jc f_lastdrive10 0 00006C61 3C20 cmp al,32 ; is it in range ? 0 00006C63 7616 jbe f_lastdrive20 1022 lastdrv_error: 0 00006C65 31F6 xor si,si ; Do not display Failing String 0 00006C67 BA[0000] mov dx,offset bad_lastdrive ; and display an error message 0 00006C6A E9290B jmp config_error 1026 1027 f_lastdrive10: 0 00006C6D AC lodsb ; Get the Option Character 0 00006C6E E8260C call toupper ; and convert to Upper Case 0 00006C71 2C41 sub al, 'A' ; al should be between 0..25 0 00006C73 72F0 jc lastdrv_error 0 00006C75 3C19 cmp al, 'Z'-'A' 0 00006C77 77EC ja lastdrv_error 0 00006C79 FEC0 inc al ; al = number of drives in system 1035 f_lastdrive20: 0 00006C7B A2[0000] mov [last_drv],al ; remember for later 0 00006C7E C3 ret 1038 1039 1040 1041 func_break: ; BREAK=ON/OFF 0 00006C7F E8320C call check_onoff ; Check for ON or OFF 0 00006C82 88C2 mov dl,al ; Get value found 0 00006C84 7308 jnc set_break ; and check for error 1045 0 00006C86 31F6 xor si,si ; Do not display Failing String 0 00006C88 BA[0000] mov dx, offset bad_break ; Bad or non-existant ON/OFF string 0 00006C8B E9080B jmp config_error ; in command tail. Display error message. 1049 1050 set_break: 0 00006C8E B433 mov ah,MS_S_BREAK ; Set the Default Break Flag 0 00006C90 B001 mov al,01 ; Set Sub-Function 0 00006C92 CD21 int DOS_INT ; Execute function and return 0 00006C94 C3 ret 1055 1056 1057 1058 func_numlock: ; NUMLOCK=ON/OFF 0 00006C95 E81C0C call check_onoff ; Check for ON or OFF 0 00006C98 7217 jc numlock20 0 00006C9A 1E push ds 0 00006C9B 31DB xor bx,bx 0 00006C9D 8EDB mov ds,bx 0 00006C9F BB1704 mov bx,417h ; DS:BX -> keyboard control 0 00006CA2 800F20 or byte ptr [bx],20h ; set numlock bit 0 00006CA5 84C0 test al,al ; was it numlock on ? 0 00006CA7 7503 jnz numlock10 ; if not, better clear the bit 0 00006CA9 8027DF and byte ptr [bx],~ 20h 1069 numlock10: 0 00006CAC 1F pop ds 0 00006CAD B40B mov ah,MS_C_STAT ; get console status 0 00006CAF CD21 int DOS_INT ; (usually int 16 update NUMLOCK state) 1073 numlock20: 0 00006CB1 C3 ret 1075 1076 1077 1078 func_hibuffers: ; HIBUFFERS=nn[,nn] 0 00006CB2 800E[0000]03 or byte [buffersIn],BUFFERS_IN_HMA+BUFFERS_IN_UMB 1080 ; enable HMA and UMB usage for disk buffers 1081 ; jmp func_buffers 1082 1083 func_buffers: ; BUFFERS=nn[,nn] 0 00006CB7 E8610C call atoi ; AX = # of buffers 0 00006CBA 722B jc buffer_error ; check for error 0 00006CBC 83F803 cmp ax,MIN_NUM_BUFFS ; check if less than minimum 0 00006CBF 7303 jae func_buf1 0 00006CC1 B80300 mov ax,3 ; force to use minimum if less 1089 func_buf1: 0 00006CC4 83F863 cmp ax,MAX_NUM_BUFFS ; check if more than maximum 0 00006CC7 7603 jbe func_buf2 0 00006CC9 B86300 mov ax,MAX_NUM_BUFFS ; force to use maximum if more 1093 func_buf2: 0 00006CCC A2[0000] mov [init_buf],al ; update if we want more 0 00006CCF E85A0B call separator ; look for ',' 0 00006CD2 7212 jc func_buf4 0 00006CD4 E8440C call atoi ; Get read-ahead buffer size 0 00006CD7 720E jc buffer_error 0 00006CD9 83F801 cmp ax,MIN_READ_AHEAD 0 00006CDC 7209 jb buffer_error 0 00006CDE 83F863 cmp ax,MAX_READ_AHEAD 0 00006CE1 7704 ja buffer_error 0 00006CE3 A2[0000] mov [num_read_ahead_buf],al 1104 func_buf4: 0 00006CE6 C3 ret 1106 1107 buffer_error: 0 00006CE7 31F6 xor si,si ; Do not display Failing String 0 00006CE9 BA[0000] mov dx, offset bad_buffers 0 00006CEC E9A70A jmp config_error 1111 1112 func_hifiles: ; HIFILES=nn 0 00006CEF 800E[0000]03 or byte [filesIn],FILES_IN_HMA+FILES_IN_UMB 1114 ; enable HMA and UMB usage for file handles 1115 1116 func_files: ; FILES=nn 0 00006CF4 E8240C call atoi ; AX = # of files 0 00006CF7 7214 jc files_error ; check for error 0 00006CF9 83F808 cmp ax,MIN_NUM_FILES ; check if less than minimum 0 00006CFC 7303 jae func_fil1 0 00006CFE B80800 mov ax,MIN_NUM_FILES ; force to use minimum if less 1122 func_fil1: 0 00006D01 3DFF00 cmp ax,MAX_NUM_FILES ; check if more than maximum 0 00006D04 7603 jbe func_fil2 0 00006D06 B8FF00 mov ax,MAX_NUM_FILES ; force to use maximum if more 1126 func_fil2: 0 00006D09 A3[0000] mov [num_files],ax ; update the number required 0 00006D0C C3 ret 1129 1130 files_error: 0 00006D0D 31F6 xor si,si ; Do not display Failing String 0 00006D0F BA[0000] mov dx, offset bad_files 0 00006D12 E9810A jmp config_error 1134 1135 func_hifcbs: ; HIFCBS=nn 0 00006D15 800E[0000]03 or byte [filesIn],FILES_IN_HMA+FILES_IN_UMB 1137 ; enable HMA and UMB usage for file handles 1138 1139 func_fcbs: ; FCBS=nn 0 00006D1A E8FE0B call atoi ; AX = # of files 0 00006D1D 7214 jc fcbs_error ; check for error 0 00006D1F 83F800 cmp ax,MIN_NUM_FCBS ; check if less than minimum 0 00006D22 7303 jae func_fcb1 0 00006D24 B80000 mov ax,MIN_NUM_FCBS ; force to use minimum if less 1145 func_fcb1: 0 00006D27 3DFF00 cmp ax,MAX_NUM_FCBS ; check if more than maximum 0 00006D2A 7603 jbe func_fcb2 0 00006D2C B8FF00 mov ax,MAX_NUM_FCBS ; force to use maximum if more 1149 func_fcb2: 0 00006D2F A3[0000] mov [num_fcbs],ax ; update number of FCB's 0 00006D32 C3 ret 1152 1153 fcbs_error: 0 00006D33 31F6 xor si,si ; Do not display Failing String 0 00006D35 BA[0000] mov dx, offset bad_fcbs 0 00006D38 E95B0A jmp config_error 1157 %endif ;not ADDDRV 1158 1159 1160 1161 func_common: ; [COMMON] 1162 func_remark: ; REM Comment field 0 00006D3B C3 ret 1164 1165 func_switches: ; SWITCHES=... 1166 ; /N = disable F5/F8 feature 1167 ; /W = zap wina20.386 name 1168 ; /K = disable enhanced keyboard support 1169 ; /F = skip statup delay 1170 0 00006D3C E8[0000] call whitespace ; skip all spaces 0 00006D3F AD lodsw ; get '/x' 0 00006D40 3C0D cmp al,CR ; check for end-of-line 0 00006D42 741B je func_switches10 0 00006D44 80FC0D cmp ah,CR ; check for end-of-line 0 00006D47 7416 je func_switches10 0 00006D49 3D2F46 cmp ax,'/F' ; NASM port swapped text literals 0 00006D4C 7507 jne func_switches05 0 00006D4E 800E[FF00]01 or byte [boot_switches],SWITCH_F 0 00006D53 EBE7 jmp short func_switches 1181 func_switches05: 0 00006D55 3D2F4E cmp ax,'/N' ; NASM port swapped text literals 0 00006D58 75E2 jne func_switches 1184 ; mov boot_options,0 ; disable boot options 0 00006D5A 800E[FF00]02 or byte [boot_switches],SWITCH_N ; disable boot options 1186 func_switches10: 0 00006D5F C3 ret 1188 1189 func_histacks: ; HISTACKS=number,size 0 00006D60 800E[0000]03 or byte [stacksIn],STACKS_IN_HMA+STACKS_IN_UMB 1191 ; enable HMA and UMB usage for stacks 1192 1193 func_stacks: ; STACKS=number,size 1194 ;----------- 0 00006D65 E8B30B call atoi ; ax = number of stacks 0 00006D68 7228 jc func_stacks20 ; check for error 0 00006D6A 85C0 test ax,ax ; special case ? (disabled) 0 00006D6C 740A jz func_stacks10 0 00006D6E 83F808 cmp ax,MIN_NUM_STACKS ; range check for a sensible value 0 00006D71 721F jb func_stacks20 0 00006D73 83F840 cmp ax,MAX_NUM_STACKS 0 00006D76 771A ja func_stacks20 1203 func_stacks10: 0 00006D78 A3[0000] mov [num_stacks],ax 0 00006D7B E8AE0A call separator ; look for ',' 0 00006D7E 7212 jc func_stacks20 0 00006D80 E8980B call atoi ; get size of a stack frame 0 00006D83 720D jc func_stacks20 0 00006D85 83F820 cmp ax,MIN_SIZE_STACK ; range check it 0 00006D88 7208 jb func_stacks20 0 00006D8A 3D0002 cmp ax,MAX_SIZE_STACK 0 00006D8D 7703 ja func_stacks20 0 00006D8F A3[0000] mov [stack_size],ax 1214 func_stacks20: 0 00006D92 C3 ret 1216 1217 1218 %ifn ADDDRV 1219 func_deblock: ; DEBLOCK=xxxx 1220 ;------------ 0 00006D93 E83D0B call atohex ; read hex number into DX:AX 0 00006D96 7212 jc func_deblock10 0 00006D98 85D2 test dx,dx 0 00006D9A 750E jnz func_deblock10 0 00006D9C C606[0000]FF mov byte [DeblockSetByUser],TRUE & 0FFh ; the user has supplied a setting 0 00006DA1 1E push ds 0 00006DA2 8E1E[0000] mov ds,[bios_seg] 0 00006DA6 A3[0000] mov [DeblockSeg],ax ; save deblocking segment 0 00006DA9 1F pop ds 1230 func_deblock10: 0 00006DAA C3 ret 1232 1233 func_fastopen: ; FASTOPEN=nn 0 00006DAB E86D0B call atoi ; AX = # of files to cache 0 00006DAE 7218 jc fopen_error ; check for error 0 00006DB0 85C0 test ax,ax ; disable fast open? 0 00006DB2 7410 jz func_fopen2 ; yes, allow to set to 0000 0 00006DB4 83F800 cmp ax,MIN_NUM_FOPEN ; check if less than minimum 0 00006DB7 7303 jae func_fopen1 0 00006DB9 B80000 mov ax,MIN_NUM_FOPEN ; force to use minimum if less 1241 func_fopen1: 0 00006DBC 3D0080 cmp ax,MAX_NUM_FOPEN ; check if more than maximum 0 00006DBF 7603 jbe func_fopen2 0 00006DC1 B80080 mov ax,MAX_NUM_FOPEN ; force to use maximum if more 1245 func_fopen2: 0 00006DC4 A3[0000] mov [num_fopen],ax ; update if we want more 1247 func_fopen3: 0 00006DC7 C3 ret 1249 1250 fopen_error: 0 00006DC8 31F6 xor si,si ; Do not display Failing String 0 00006DCA BA[0000] mov dx, offset bad_fopen 0 00006DCD E9C609 jmp config_error 1254 1255 1256 func_drivparm: ; DRIVPARM = /d:nn [/c] [/f:ff] [h:hh] [/n] [/s:ss] [/t:tt] 1257 ;------------- 1258 ; This function specifies the drive parameters for a device 1259 ; and overrides the defaults assumed by the device driver. 1260 0 00006DD0 C606[8102]FF mov byte [drivp_drv],0FFh ; invalid drive 0 00006DD5 E82301 call get_switch ; get next switch 0 00006DD8 3C64 cmp al,'d' ; first option must be /d:dd 0 00006DDA 7559 jne drivparm_error 0 00006DDC E82D01 call get_number ; get numeric parameter 0 00006DDF A2[8102] mov [drivp_drv],al 0 00006DE2 C606[8202]00 mov byte [drivp_chg],FALSE 0 00006DE7 C606[8302]00 mov byte [drivp_prm],FALSE 0 00006DEC C706[8502]5000 mov word [drivp_trk],80 ; assume 80 tracks 1270 0 00006DF2 8A1E[8102] mov bl,[drivp_drv] ; get drive to set up 0 00006DF6 80FB19 cmp bl,'Z'-'A' 0 00006DF9 773A ja drivparm_error 0 00006DFB FEC3 inc bl 0 00006DFD C606[D901]00 mov byte [ioctl_pb],0 ; return defaults 0 00006E02 B80D44 mov ax,440Dh ; generic IOCTL 0 00006E05 B96008 mov cx,0860h ; get device parameters 0 00006E08 BA[D901] mov dx,offset ioctl_func 0 00006E0B CD21 int DOS_INT 0 00006E0D 7226 jc drivparm_error ; skip if we can't get parameters 1281 0 00006E0F C606[8402]02 mov byte [drivp_ff],2 ; assume 720K 3.5" drive 0 00006E14 E80401 call set_form_factor ; set defaults for form factor 1284 0 00006E17 E8E100 call get_switch ; get next switch 0 00006E1A 3C63 cmp al,'c' ; is it /c (change line available) 0 00006E1C 7508 jne drivparm1 0 00006E1E C606[8202]FF mov byte [drivp_chg],TRUE & 0FFh ; disk change line available 0 00006E23 E8D500 call get_switch ; get next switch 1290 drivparm1: 0 00006E26 3C66 cmp al,'f' ; form factor specification? 0 00006E28 7516 jne drivparm2 0 00006E2A E8DF00 call get_number ; get numeric parameter 0 00006E2D A2[8402] mov [drivp_ff],al ; set form factor 0 00006E30 E8E800 call set_form_factor ; set defaults for form factor 0 00006E33 EB08 jmp short drivparm_loop ; get more parameters 1297 1298 drivparm_error: 0 00006E35 31F6 xor si,si 0 00006E37 BA[0000] mov dx,offset bad_drivparm 0 00006E3A E95909 jmp config_error 1302 1303 drivparm_loop: 0 00006E3D E8BB00 call get_switch ; get next switch 1305 drivparm2: 0 00006E40 3C68 cmp al,'h' ; specify number of heads 0 00006E42 750D jne drivparm3 0 00006E44 E8C500 call get_number ; get numeric parameter 0 00006E47 83F863 cmp ax,99 0 00006E4A 77E9 ja drivparm_error 0 00006E4C A3[EF01] mov [drivp_heads],ax ; set # of heads 0 00006E4F EBEC jmp short drivparm_loop 1313 1314 drivparm3: 0 00006E51 3C6E cmp al,'n' 0 00006E53 7507 jne drivparm4 0 00006E55 C606[8302]FF mov byte [drivp_prm],TRUE & 0FFh ; non-removable media 0 00006E5A EBE1 jmp short drivparm_loop 1319 1320 drivparm4: 0 00006E5C 3C73 cmp al,'s' 0 00006E5E 750D jne drivparm5 0 00006E60 E8A900 call get_number ; get numeric parameter 0 00006E63 83F83F cmp ax,63 ; range check sector per track 0 00006E66 77CD ja drivparm_error 0 00006E68 A3[ED01] mov [drivp_spt],ax ; set # of sectors/track 0 00006E6B EBD0 jmp short drivparm_loop 1328 1329 drivparm5: 0 00006E6D 3C74 cmp al,'t' 0 00006E6F 75C4 jne drivparm_error 0 00006E71 E89800 call get_number ; get numeric parameter 0 00006E74 3DE703 cmp ax,999 0 00006E77 77BC ja drivparm_error 0 00006E79 A3[8502] mov [drivp_trk],ax ; set # of sectors/track 0 00006E7C EBBF jmp short drivparm_loop 1337 1338 drivparm_done: ; now set drive parameters 0 00006E7E 8A1E[8102] mov bl,[drivp_drv] 0 00006E82 80FB19 cmp bl,'Z'-'A' 0 00006E85 77AE ja drivparm_error 1342 0 00006E87 C606[D901]04 mov byte [ioctl_func],00000100b ; normal track layout assumed, 1344 ; set device BPB for drive 0 00006E8C A0[8402] mov al,[drivp_ff] ; get form factor 0 00006E8F A2[DA01] mov [ioctl_type],al 1347 0 00006E92 29C0 sub ax,ax ; assume removable, no disk change 0 00006E94 803E[8302]00 cmp byte [drivp_prm],FALSE 0 00006E99 7403 je drivp_d1 0 00006E9B 83C801 or ax,1 ; drive is permanent media 1352 drivp_d1: 0 00006E9E 803E[8202]00 cmp byte [drivp_chg],FALSE 0 00006EA3 7403 je drivp_d2 0 00006EA5 83C802 or ax,2 ; drive supports disk change line 1356 drivp_d2: 0 00006EA8 A3[DB01] mov [ioctl_attrib],ax ; set drive attributes 1358 0 00006EAB A1[8502] mov ax,[drivp_trk] ; set # of cylinders 0 00006EAE A3[DD01] mov [ioctl_tracks],ax 1361 0 00006EB1 C606[DF01]00 mov byte [ioctl_mtype],0 ; assume standard type 1363 0 00006EB6 A1[ED01] mov ax,[drivp_spt] ; get sectors/track 0 00006EB9 BF[FF01] mov di,offset ioctl_layout 0 00006EBC 1E push ds 0 00006EBD 07 pop es ; ES:DI -> layout table 0 00006EBE AB stosw ; set # of sectors 0 00006EBF 91 xchg ax,cx ; CX = # of sectors 0 00006EC0 B80100 mov ax,1 ; start with sector 1 1371 drivp_d3: 0 00006EC3 AB stosw ; set next sector # 0 00006EC4 40 inc ax ; move to next sector 0 00006EC5 E2FC loop drivp_d3 ; repeat for all sectors 1375 0 00006EC7 A1[EF01] mov ax,[drivp_heads] 0 00006ECA F726[ED01] mul word [drivp_spt] 0 00006ECE 8B16[8502] mov dx,[drivp_trk] 0 00006ED2 F7E2 mul dx ; AX/DX = # of sectors/disk 0 00006ED4 BF[E001] mov di,offset ioctl_bpb 0 00006ED7 894508 mov [8 + di],ax ; set sectors per disk 0 00006EDA 85D2 test dx,dx 0 00006EDC 740B jz drivp_d4 0 00006EDE C745080000 mov word ptr [8 + di],0 ; indicate large partition 0 00006EE3 894515 mov [21 + di],ax ; set disk size in sectors 0 00006EE6 895517 mov [23 + di],dx 1387 drivp_d4: 0 00006EE9 8A1E[8102] mov bl,[drivp_drv] 0 00006EED FEC3 inc bl 0 00006EEF B80D44 mov ax,440Dh 0 00006EF2 B94008 mov cx,0840h ; set drive parameters 0 00006EF5 BA[D901] mov dx,offset ioctl_func 0 00006EF8 CD21 int DOS_INT ; tell the BIOS, ignore errors 1394 0 00006EFA C3 ret 1396 1397 1398 get_switch: ; get next command line switch 0 00006EFB E8[0000] call whitespace ; skip all spaces & tabs 0 00006EFE AC lodsb ; get next character 0 00006EFF 5A pop dx ; get return address 0 00006F00 3C2F cmp al,'/' ; did we get a switch? 0 00006F02 7403 je get_swt9 ; yes, return the character 0 00006F04 E977FF jmp drivparm_done 1405 get_swt9: 0 00006F07 AC lodsb 0 00006F08 0C20 or al,('a' ^ 'A') ; return upper-cased character 0 00006F0A FFE2 jmp dx 1409 1410 1411 get_number: 1412 ; entry: SI -> next character (must be ':') 1413 0 00006F0C AC lodsb ; get next character 0 00006F0D 3C3A cmp al,':' ; must be colon 0 00006F0F 7506 jne get_num_err ; return error if not 0 00006F11 E8070A call atoi ; get numeric value 0 00006F14 7201 jc get_num_err ; must be number 0 00006F16 C3 ret ; AX = number 1420 1421 get_num_err: 0 00006F17 5A pop dx 0 00006F18 E91AFF jmp drivparm_error ; reject this command 1424 1425 1426 set_form_factor: 0 00006F1B 8A1E[8402] mov bl,[drivp_ff] 0 00006F1F 80FB07 cmp bl,7 0 00006F22 7717 ja set_form9 0 00006F24 B700 mov bh,0 0 00006F26 D1E3 shl bx,1 0 00006F28 56 push si 0 00006F29 06 push es 0 00006F2A 8BB7[8702] mov si,[ff_table + bx] ; SI -> default media BPB 0 00006F2E 1E push ds 0 00006F2F 07 pop es 0 00006F30 BF[E001] mov di,offset ioctl_bpb ; ES:DI -> local BPB 0 00006F33 B91500 mov cx,21 ; copy initialized portion 0 00006F36 F3A4 rep movsb 0 00006F38 07 pop es 0 00006F39 5E pop si 0 00006F3A C3 ret 1443 1444 set_form9: 0 00006F3B E9F7FE jmp drivparm_error 1446 1447 1448 ; 1449 ; This function modifies the History buffer support provided by 1450 ; DR DOS the defaults are History OFF, 512 byte buffers, 1451 ; Insert ON, Search OFF, Matching OFF. 1452 ; 1453 func_history: ; HISTORY = ON|OFF[,NNNN[,ON|OFF[,ON|OFF[,ON|OFF]]]] 1454 ;------------ 0 00006F3E C606[0000]00 mov byte [history_flg],0 ; start with it all off 1456 0 00006F43 E86E09 call check_onoff ; Check for ON|OFF Switch 0 00006F46 725A jc f_hist_err 0 00006F48 84C0 test al,al 0 00006F4A 7455 jz f_hist_exit ; if OFF forget the rest 0 00006F4C 800E[0000]03 or byte [history_flg],RLF_ENHANCED+RLF_INS 1462 0 00006F51 E8D808 call separator ; look for ',' 0 00006F54 724B jc f_hist_exit ; Buffer Size not Specified 0 00006F56 E8C209 call atoi ; Get the Buffer Size 0 00006F59 7247 jc f_hist_err ; Invalid on no existant size 0 00006F5B 3D8000 cmp ax,128 0 00006F5E 7242 jb f_hist_err ; Buffer Size to Small 0 00006F60 3D0010 cmp ax,4096 0 00006F63 773D ja f_hist_err ; Buffer Size to Large 0 00006F65 A3[0000] mov [history_size],ax ; Save History Buffer Size 1472 0 00006F68 E8C108 call separator ; look for ',' 0 00006F6B 7234 jc f_hist_exit ; Insert mode not Specified 0 00006F6D E84409 call check_onoff ; Check for ON|OFF Switch 0 00006F70 7230 jc f_hist_err 0 00006F72 84C0 test al,al 0 00006F74 7505 jnz func_hist10 0 00006F76 8026[0000]FD and byte [history_flg],~ RLF_INS ; Insert state OFF 1480 func_hist10: 0 00006F7B E8AE08 call separator ; look for ',' 0 00006F7E 7221 jc f_hist_exit ; Search mode not Specified 0 00006F80 E83109 call check_onoff ; Check for ON|OFF Switch 0 00006F83 721D jc f_hist_err 0 00006F85 84C0 test al,al 0 00006F87 7405 jz func_hist20 0 00006F89 800E[0000]04 or byte [history_flg],RLF_SEARCH ; Search state ON 1488 func_hist20: 0 00006F8E E89B08 call separator ; look for ',' 0 00006F91 720E jc f_hist_exit ; Match mode not Specified 0 00006F93 E81E09 call check_onoff ; Check for ON|OFF Switch 0 00006F96 720A jc f_hist_err 0 00006F98 84C0 test al,al 0 00006F9A 7405 jz func_hist30 0 00006F9C 800E[0000]08 or byte [history_flg],RLF_MATCH ; Match state ON 1496 func_hist30: 1497 1498 f_hist_exit: 0 00006FA1 C3 ret 1500 1501 f_hist_err: 0 00006FA2 31F6 xor si,si ; Do not display Failing String 0 00006FA4 BA[0000] mov dx, offset bad_history ; Bad or non-existant ON/OFF string 0 00006FA7 E9EC07 jmp config_error ; in command tail. Display error message. 1505 1506 1507 ; 1508 ; HIINSTALL filename [Command Line Parameters] 1509 ; 1510 ; As INSTALL, but uses high memory if possible 1511 ; 1512 func_hiinstall: 1513 0 00006FAA B80258 mov ax,5802h 0 00006FAD CD21 int DOS_INT ; get upper memory link 0 00006FAF 98 cbw 0 00006FB0 50 push ax ; save upper memory link 1518 0 00006FB1 B80058 mov ax,5800h 0 00006FB4 CD21 int DOS_INT ; get alloc strategy 0 00006FB6 50 push ax ; save alloc strategy 1522 0 00006FB7 B80358 mov ax,5803h 0 00006FBA BB0100 mov bx,1 ; set upper memory link 0 00006FBD CD21 int DOS_INT ; to 1 1526 0 00006FBF B80158 mov ax,5801h 0 00006FC2 BB8000 mov bx,80h ; set alloc strategy to lowest-upper 0 00006FC5 CD21 int DOS_INT ; if available 1530 0 00006FC7 E80D00 call func_install ; try and install it 1532 0 00006FCA B80158 mov ax,5801h 0 00006FCD 5B pop bx ; set alloc strategy 0 00006FCE CD21 int DOS_INT ; to original value 1536 0 00006FD0 B80358 mov ax,5803h 0 00006FD3 5B pop bx ; set upper memory link 0 00006FD4 CD21 int DOS_INT ; to original value 1540 0 00006FD6 C3 ret 1542 1543 1544 1545 ; 1546 ; INSTALL filename [Command Line Parameters] 1547 ; 1548 ; INSTALL will load and execute "FILENAME" with the optional command 1549 ; line parameters and continue processing the DCONFIG.SYS file when 1550 ; the application terminates. 1551 ; 1552 ; Entry 1553 ; ds:si -> first character of CR terminated filename and option string. 1554 ; Exit 1555 ; none 1556 ; 1557 ; WARNING - 1558 ; This code make certain assumptions about memory layout. 1559 ; If memory gets fragmented then it all starts falling apart. 1560 ; 1561 func_install: 1562 ;------------ 0 00006FD7 1E push ds 0 00006FD8 06 push es 1565 ; 1566 ; Shrink the previously allocated memory block to MEM_CURRENT 1567 ; in preparation of the INSTALL EXEC function. 1568 ; 0 00006FD9 8E06[0000] mov es,[mem_current_base] ; ES: Base Allocated Memory 0 00006FDD 8B1E[0000] mov bx,[mem_current] ; Get the currently allocated memory 0 00006FE1 2B1E[0000] sub bx,[mem_current_base] ; and subtract mem_current_base to 0 00006FE5 B449 mov ah,MS_M_FREE ; give the number of paragraphs used 0 00006FE7 7402 jz func_i10 ; if none, free it all up 0 00006FE9 B44A mov ah,MS_M_SETBLOCK ; else modify block accordingly 1575 func_i10: 0 00006FEB CD21 int DOS_INT 1577 1578 ; Now to protect the CONFIG code in high memory 0 00006FED B448 mov ah,MS_M_ALLOC ; we now try to find base of TPA 0 00006FEF BBFFFF mov bx,0ffffh ; ASSUME it is the biggest bit 0 00006FF2 CD21 int 21h ; of free memory about 0 00006FF4 B448 mov ah,MS_M_ALLOC ; give it to me please 0 00006FF6 CD21 int 21h ; ax:0 -> exec memory 0 00006FF8 53 push bx ; we have allocated BX para's 0 00006FF9 8EC0 mov es,ax ; ES -> exec memory 1586 ; mov bx,init_dseg ; we want to protect BX:0 and above 0 00006FFB 8B1E[0000] mov bx,[res_ddsc_seg] ; we want to protect BX:0 and above 0 00006FFF 4B dec bx ; allow for DMD 0 00007000 29C3 sub bx,ax ; we can spare this many paras 0 00007002 B44A mov ah,MS_M_SETBLOCK ; for the exec so grow the 0 00007004 CD21 int 21h ; block accordingly 0 00007006 58 pop ax ; AX = total, BX = amount for install 1593 0 00007007 29D8 sub ax,bx ; AX = amount we just freed 0 00007009 48 dec ax ; allow for DMD 0 0000700A 93 xchg ax,bx ; BX = freed portion (the Init code) 0 0000700B B448 mov ah,MS_M_ALLOC ; ASSUME an allocation of this size 0 0000700D CD21 int 21h ; will contain SYSDAT/CONFIG 0 0000700F 50 push ax ; save seg so we can free mem later 1600 0 00007010 B449 mov ah, MS_M_FREE ; now free up the bit we prepared 0 00007012 CD21 int 21h ; earlier so exec has something 0 00007014 1E push ds 0 00007015 07 pop es ; to work in 1605 0 00007016 BF[0000] mov di,offset dev_name ; Copy the filename into a local 0 00007019 E8150C call copy_file ; buffer 1608 1609 ; Calculate the command line length 0 0000701C 89F7 mov di,si ; by scanning the command line for 0 0000701E B00D mov al,CR ; the terminating CR 0 00007020 B98000 mov cx,128 0 00007023 F2AE repnz scasb 0 00007025 4F dec di 0 00007026 89F8 mov ax,di 0 00007028 29F0 sub ax,si 0 0000702A 4E dec si ; Point to the byte before the 0 0000702B 8804 mov byte ptr [si],al ; command line string and update 1619 ; the count 1620 0 0000702D B8[0000] mov ax,offset envstart ; env buffer is para aligned 0 00007030 B104 mov cl,4 0 00007032 D3E8 shr ax,cl ; convert offset to paras 0 00007034 8CD9 mov cx,ds 0 00007036 01C8 add ax,cx ; segment of env variables 0 00007038 A3[BF01] mov [exec_envseg],ax 0 0000703B 8936[C101] mov [exec_lineoff],si 0 0000703F 8C1E[C301] mov [exec_lineseg],ds 0 00007043 C706[C501]FEFF mov word [exec_fcb1off],0FFFEh ; Force PCMODE to generate 0 00007049 C706[C901]FEFF mov word [exec_fcb2off],0FFFEh ; correct FCB References 1631 0 0000704F 8C16[D701] mov [system_ss],ss 0 00007053 8926[D501] mov [system_sp],sp 1634 0 00007057 BA[0000] mov dx,offset dev_name ; Get ASCIIZ Command 0 0000705A BB[BF01] mov bx,offset exec_envseg ; and Parameter Block Offset 0 0000705D B8004B mov ax,4B00h ; Load and Execute Program with Handle 0 00007060 CD21 int DOS_INT ; EXEC the application 1639 0 00007062 FA cli ; Swap back to the original stack 0 00007063 2E8E16[D701] mov ss,[cs:system_ss] ; again with interrupts disabled 0 00007068 2E8B26[D501] mov sp,[cs:system_sp] 0 0000706D FB sti 1644 0 0000706E B44D mov ah,MS_X_WAIT ; if all went well return the 0 00007070 7304 jnc func_i20 ; termination code 0 00007072 B459 mov ah,MS_F_ERROR ; if we had an error from EXEC 0 00007074 31DB xor bx,bx ; get extended error 1649 func_i20: 0 00007076 CD21 int DOS_INT ; retrieve error value 0 00007078 2EA3[F305] mov [cs:error_level],ax ; and save for testing 1652 0 0000707C 07 pop es ; recover the seg we protected 0 0000707D B449 mov ah, MS_M_FREE ; so we can free that memory up 0 0000707F CD21 int 21h 1656 0 00007081 B448 mov ah,MS_M_ALLOC ; try and allocate as much as possible 0 00007083 BBFFFF mov bx, 0FFFFh ; ASSUME this will cover CONFIG 0 00007086 CD21 int 21h ; bx = No. of paras available 0 00007088 B448 mov ah, MS_M_ALLOC ; give me bx paras please 0 0000708A CD21 int 21h ; ax:0 -> my memory 1662 0 0000708C 07 pop es 0 0000708D 1F pop ds 0 0000708E A3[0000] mov [mem_current_base],ax ; save memory base 0 00007091 A3[0000] mov [mem_current],ax ; for future allocations 0 00007094 C3 ret 1668 1669 1670 1671 func_hidos: ; HIDOS ON/OFF 0 00007095 E81C08 call check_onoff ; Check for ON or OFF 0 00007098 7203 jc f_hidos10 ; Return on error 0 0000709A A2[0000] mov [hidos],al ; update hidos flag 1675 f_hidos10: 0 0000709D C3 ret 1677 1678 func_dosdata: ; DOSDATA=UMB - relocate DOS data segment to upper memory 0 0000709E E88B07 call separator 0 000070A1 BF[DB05] mov di,offset low_opt 0 000070A4 E85607 call compare 0 000070A7 7207 jc func_dosdata10 0 000070A9 C606[0000]00 mov byte [hidosdata],0 0 000070AE EBEE jmp short func_dosdata 1685 func_dosdata10: 0 000070B0 BF[E105] mov di,offset umb_opt 0 000070B3 E84707 call compare 0 000070B6 7207 jc func_dosdata20 0 000070B8 800E[0000]02 or byte [hidosdata],DOSDATA_IN_UMB 0 000070BD EBDF jmp short func_dosdata 1691 func_dosdata20: 0 000070BF C3 ret 1693 1694 func_ddscs: ; DDSCS=HIGH,UMB - relocate DDSCs to high or upper memory 0 000070C0 E86907 call separator 0 000070C3 BF[DB05] mov di,offset low_opt 0 000070C6 E83407 call compare 0 000070C9 7207 jc func_ddscs10 0 000070CB C606[0000]00 mov byte [hiddscs],0 0 000070D0 EBEE jmp short func_ddscs 1701 func_ddscs10: 0 000070D2 E85707 call separator 0 000070D5 BF[D605] mov di,offset high_opt 0 000070D8 E82207 call compare 0 000070DB 7207 jc func_ddscs20 0 000070DD 800E[0000]01 or byte [hiddscs],DDSCS_IN_HMA 0 000070E2 EBDC jmp short func_ddscs 1708 func_ddscs20: 0 000070E4 E84507 call separator 0 000070E7 BF[E105] mov di,offset umb_opt 0 000070EA E81007 call compare 0 000070ED 7207 jc func_ddscs30 0 000070EF 800E[0000]02 or byte [hiddscs],DDSCS_IN_UMB 0 000070F4 EBCA jmp short func_ddscs 1715 func_ddscs30: 0 000070F6 C3 ret 1717 1718 func_xbda: ; XBDA=LOW,UMB 0 000070F7 E83207 call separator 0 000070FA BF[DB05] mov di,offset low_opt 0 000070FD E8FD06 call compare 0 00007100 7207 jc func_xbda10 0 00007102 800E[0000]01 or byte [hixbda],MOVE_XBDA_LOW 0 00007107 EBEE jmp short func_xbda 1725 func_xbda10: 0 00007109 E82007 call separator 0 0000710C BF[E105] mov di,offset umb_opt 0 0000710F E8EB06 call compare 0 00007112 7207 jc func_xbda20 0 00007114 800E[0000]02 or byte [hixbda],MOVE_XBDA_HIGH 0 00007119 EBDC jmp short func_xbda 1732 func_xbda20: 0 0000711B C3 ret 1734 1735 1736 func_dos: ; DOS=HIGH - relocate BIOS/BDOS/Buffer etc to FFFF 0 0000711C E80D07 call separator ; Deblank Command 0 0000711F BF[D605] mov di,offset high_opt ; es:di -> "HIGH" 0 00007122 E8D806 call compare ; do we have an "HIGH"? 0 00007125 7207 jc func_dos10 0 00007127 56 push si 0 00007128 E83100 call func_dos_high ; execute HIGH 0 0000712B 5E pop si 0 0000712C EBEE jmp short func_dos 1745 func_dos10: 0 0000712E BF[DB05] mov di,offset low_opt ; es:di -> "LOW" 0 00007131 E8C906 call compare 0 00007134 7207 jc func_dos20 0 00007136 56 push si 0 00007137 E83900 call func_dos_low ; execute LOW 0 0000713A 5E pop si 0 0000713B EBDF jmp short func_dos 1753 func_dos20: 0 0000713D BF[E105] mov di,offset umb_opt ; es:di -> "UMB" 0 00007140 E8BA06 call compare 0 00007143 7207 jc func_dos30 0 00007145 56 push si 0 00007146 E85000 call func_dos_umb ; execute UMB 0 00007149 5E pop si 0 0000714A EBD0 jmp short func_dos 1761 func_dos30: 0 0000714C BF[DF05] mov di,offset noumb_opt ; es:di -> "NOUMB" 0 0000714F E8AB06 call compare 0 00007152 7207 jc func_dos40 0 00007154 56 push si 0 00007155 E87500 call func_dos_noumb ; execute NOUMB 0 00007158 5E pop si 0 00007159 EBC1 jmp short func_dos 1769 func_dos40: 0 0000715B C3 ret 1771 1772 func_dos_high: 1773 ;------------- 1774 ; Move DOS into the HMA and allocate buffers etc. high too. 1775 ; 0 0000715C C706[0000]FFFF mov word [dos_target_seg],0FFFFh 0 00007162 C706[0000]FFFF mov word [bios_target_seg],0FFFFh 0 00007168 C606[0000]FF mov byte [hidos],TRUE & 0FFh ; update hidos flag to be ON 0 0000716D 800E[0000]01 or byte [buffersIn],BUFFERS_IN_HMA; buffers at seg FFFF too 1780 ; or filesIn,FILES_IN_HMA ; and also files 0 00007172 C3 ret 1782 1783 func_dos_low: 1784 ;------------ 1785 ; force all allocation to be low 1786 ; 0 00007173 C706[0000]0000 mov word [dos_target_seg],0 0 00007179 C706[0000]0000 mov word [bios_target_seg],0 0 0000717F C606[0000]00 mov byte [hidos],FALSE ; system allocation from low memory 0 00007184 C606[0000]00 mov byte [buffersIn],0 ; buffers from low memory 0 00007189 C606[0000]00 mov byte [filesIn],0 ; also files 0 0000718E C606[0000]00 mov byte [stacksIn],0 ; and stacks 0 00007193 C606[0000]00 mov byte [lastdrvIn],0 ; and LDT 0 00007198 C3 ret 1795 1796 func_dos_umb: 1797 ;------------ 1798 ; allocate Upper Memory Blocks and link them to the DMD chain 1799 ; 0 00007199 C606[0000]FF mov byte [hidos],TRUE & 0FFh ; update hidos flag to be ON 0 0000719E 800E[0000]02 or byte [buffersIn],BUFFERS_IN_UMB; enable UMB usage for buffers 0 000071A3 800E[0000]02 or byte [filesIn],FILES_IN_UMB ; and files 0 000071A8 800E[0000]02 or byte [stacksIn],STACKS_IN_UMB ; and stacks 0 000071AD 800E[0000]02 or byte [lastdrvIn],LASTDRV_IN_UMB; and LDT 0 000071B2 E85B00 call initialise_dmd_upper ; build initial upper memory DMD 0 000071B5 720D jc func_dos_umb30 1807 func_dos_umb10: 0 000071B7 E81B00 call alloc_xms_umb ; allocate XMS upper memory 0 000071BA 7205 jc func_dos_umb20 0 000071BC E80B01 call add_dmd_upper ; add to upper memory DMD's 0 000071BF EBF6 jmp short func_dos_umb10 ; go around again 1812 func_dos_umb20: 0 000071C1 E8BA00 call remove_last_dmd ; get rid of useless last DMD 1814 func_dos_umb30: 0 000071C4 B80358 mov ax,(MS_M_STRATEGY*256)+3 0 000071C7 BB0100 mov bx,1 ; link in upper memory region 0 000071CA CD21 int 21h 0 000071CC C3 ret 1819 1820 func_dos_noumb: 1821 ;-------------- 1822 ; Unlink Upper Memory blocks from the DMD chain 1823 ; 0 000071CD B80358 mov ax,(MS_M_STRATEGY*256)+3 0 000071D0 31DB xor bx,bx ; unlink upper memory region 0 000071D2 CD21 int 21h 0 000071D4 C3 ret 1828 1829 alloc_xms_umb: 1830 ; On Entry: 1831 ; None 1832 ; On Exit: 1833 ; CY set is no upper memory available 1834 ; else 1835 ; BX = para base address 1836 ; DX = para size 1837 ; 1838 ; Try to allocate the largest possible block of XMS memory 1839 ; so we can link it to the upper memory chain 1840 ; 0 000071D5 06 push es 0 000071D6 B80043 mov ax,4300h ; check for XMS installation 0 000071D9 CD2F int 2fh 0 000071DB 3C80 cmp al,80h 0 000071DD 752A jne alloc_xms10 0 000071DF B81043 mov ax,4310h ; get address of XMS driver 0 000071E2 CD2F int 2fh 0 000071E4 2E891E[3C0B] mov word ptr [cs:xms_driver],bx 0 000071E9 2E8C06[3E0B] mov word ptr [cs:xms_driver+2],es 0 000071EE B410 mov ah,10h ; allocate upper memory block 0 000071F0 BAFFFF mov dx,0FFFFh ; DX set to find largest block 0 000071F3 2EFF1E[3C0B] call far [cs:xms_driver] 0 000071F8 83FA03 cmp dx,3 ; we need at least 3 para's 0 000071FB 720C jb alloc_xms10 ; before we contruct a DMD 0 000071FD B410 mov ah,10h ; now allocate largest block 0 000071FF 2EFF1E[3C0B] call far [cs:xms_driver] 0 00007204 83F801 cmp ax,1 ; did we succeed ? 0 00007207 7401 je alloc_xms20 1859 alloc_xms10: 0 00007209 F9 stc ; return CY set indicating failure 1861 alloc_xms20: 0 0000720A 07 pop es 0 0000720B C3 ret 1864 1865 xms_driver label dword 0 0000720C 00000000 dw 0,0 1867 1868 initialise_dmd_upper: 1869 ; On Entry: 1870 ; None 1871 ; On Exit: 1872 ; CY set if chain already exists 1873 ; (BX/DX preserved) 1874 ; 1875 ; build initial upper memory DMD 1876 ; we rely on the fact the last para in memory is unused 1877 ; (but BIOSINIT makes sure that is true) 1878 ; 0 00007210 06 push es 0 00007211 53 push bx 0 00007212 52 push dx 1882 %if DOS5 0 00007213 C41E[0000] les bx,[func52_ptr] ; ES:BX -> list of lists 0 00007217 26837F66FF cmp word [es:F52_DMD_UPPER + bx],0FFFFh 1885 %else 1886 les bx,[drdos_ptr] 1887 cmp word [es:DRDOS_DMD_UPPER + bx],0 1888 les bx,[funv52_ptr] ; ES:BX -> list of lists 1889 %endif 0 0000721C F9 stc ; assume error return required 0 0000721D 755B jne initialise_dmd_upper30 ; bail out if chain already established 0 0000721F 268E47FE mov es,[es:F52_DMDROOT + bx] ; ES -> 1st DMD 1893 initialise_dmd_upper10: 0 00007223 26803E00005A cmp byte [es:DMD_ID],IDZ ; end of DMD chain ? 0 00007229 7415 je initialise_dmd_upper20 0 0000722B 26803E00004D cmp byte [es:DMD_ID],IDM ; do we have any more DMD's ? 0 00007231 F9 stc 0 00007232 7546 jne initialise_dmd_upper30 ; woops, chain must be bad 0 00007234 8CC0 mov ax,es ; better point to it 0 00007236 40 inc ax 0 00007237 2603060300 add ax,[es:DMD_LEN] ; AX:0 -> next DMD 0 0000723C 8EC0 mov es,ax 0 0000723E EBE3 jmp short initialise_dmd_upper10 1904 1905 initialise_dmd_upper20: 0 00007240 8CC0 mov ax,es 0 00007242 2603060300 add ax,[es:DMD_LEN] ; AX:0 -> will be upper memory chain 0 00007247 3D00A0 cmp ax,0A000h ; if the DMD chain is already into 0 0000724A F5 cmc ; upper memory, lets make sure we 0 0000724B 722D jb initialise_dmd_upper30 ; stop before we fall apart 0 0000724D 26C60600004D mov byte [es:DMD_ID],IDM ; no longer the last entry 0 00007253 26FF0E0300 dec word [es:DMD_LEN] ; shorten last DMD to make room 0 00007258 8EC0 mov es,ax ; point to new DMD 0 0000725A 26C60600005A mov byte [es:DMD_ID],IDZ ; there is only one entry in the chain 0 00007260 26C70601000800 mov word [es:DMD_PSP],8 ; its' owned by "system" 0 00007267 91 xchg ax,cx ; CX = DMD 0 00007268 B8FFFF mov ax,0FFFFh 0 0000726B 29C8 sub ax,cx ; it's this big 0 0000726D 26A30300 mov [es:DMD_LEN],ax 1920 %if DOS5 0 00007271 C41E[0000] les bx,[func52_ptr] 0 00007275 26894F66 mov [es:F52_DMD_UPPER + bx],cx 1923 %else 1924 les bx,[drdos_ptr] 1925 mov [es:DRDOS_DMD_UPPER + bx],cx 1926 %endif 0 00007279 F8 clc 1928 initialise_dmd_upper30: 0 0000727A 5A pop dx 0 0000727B 5B pop bx 0 0000727C 07 pop es 0 0000727D C3 ret 1933 1934 1935 remove_last_dmd: 1936 ; On Entry: 1937 ; None 1938 ; On Exit: 1939 ; None 1940 ; 1941 ; We have build an upper memory DMD chain, but we have left an extra 1942 ; DMD around covering the ROMs at the top of memory. Remove it if 1943 ; it's not required. 1944 ; 0 0000727E 06 push es 0 0000727F C41E[0000] les bx,[func52_ptr] ; ES:BX -> list of lists 0 00007283 268E47FE mov es,[es:F52_DMDROOT + bx] ; ES -> 1st DMD 1948 remove_last_dmd10: 0 00007287 26803E00004D cmp byte [es:DMD_ID],IDM ; do we have any more DMD's ? 0 0000728D 7539 jne remove_last_dmd20 ; bail out if we don't 0 0000728F 8CC0 mov ax,es ; remember previous DMD 0 00007291 8CC2 mov dx,es 0 00007293 42 inc dx 0 00007294 2603160300 add dx,[es:DMD_LEN] ; DX:0 -> next DMD 0 00007299 8EC2 mov es,dx 0 0000729B 26803E00005A cmp byte [es:DMD_ID],IDZ ; end of DMD chain ? 0 000072A1 75E4 jne remove_last_dmd10 0 000072A3 26833E010008 cmp word [es:DMD_PSP],8 ; is it owned by "system" ? 0 000072A9 751D jne remove_last_dmd20 ; if so we can ditch this entry 0 000072AB 8EC0 mov es,ax ; ES = next to last DMD 0 000072AD 26C60600005A mov byte [es:DMD_ID],IDZ ; new end of chain 0 000072B3 26FF060300 inc word [es:DMD_LEN] ; include last para 1963 %if DOS5 0 000072B8 C41E[0000] les bx,[func52_ptr] ; ES:BX -> list of lists 0 000072BC 263B5766 cmp dx,[es:F52_DMD_UPPER + bx] 0 000072C0 7506 jne remove_last_dmd20 ; remove upper memory link if none left 0 000072C2 26C74766FFFF mov word [es:F52_DMD_UPPER + bx],0FFFFh 1968 %else 1969 les bx,[drdos_ptr] 1970 cmp dx,[es:DRDOS_DMD_UPPER + bx] 1971 jne remove_last_dmd20 ; remove upper memory link if none left 1972 mov word [es:DRDOS_DMD_UPPER + bx],0 1973 %endif 1974 remove_last_dmd20: 0 000072C8 07 pop es 0 000072C9 C3 ret 1977 1978 1979 add_dmd_upper: 1980 ; On Entry: 1981 ; BX = base address of DMD 1982 ; DX = size of DMD 1983 ; On Exit: 1984 ; None 1985 ; 1986 ; Add this block into the upper memory chain. 1987 ; To do this we find the DMD containing the block and link it into place 1988 ; 0 000072CA 06 push es 0 000072CB 53 push bx ; save base address 0 000072CC C41E[0000] les bx,[func52_ptr] ; ES:BX -> list of lists 0 000072D0 268B47FE mov ax,[es:F52_DMDROOT + bx] ; AX -> 1st DMD 0 000072D4 5B pop bx ; 1st DMD is always below XMS 0 000072D5 39D8 cmp ax,bx ; memory, so bomb out if not 0 000072D7 7366 jae add_dmd_upper40 ; as our DMD's must be corrupt 1996 add_dmd_upper10: 0 000072D9 8EC0 mov es,ax 0 000072DB 2603060300 add ax,[es:DMD_LEN] ; AX:0 -> end of this block 0 000072E0 39D8 cmp ax,bx ; is the next block above us ? 0 000072E2 770B ja add_dmd_upper20 ; if not try the next block 0 000072E4 40 inc ax ; AX:0 -> next DMD 0 000072E5 26803E00004D cmp byte [es:DMD_ID],IDM ; do we have any more DMD's ? 0 000072EB 74EC je add_dmd_upper10 ; we should have...... 0 000072ED EB50 jmp short add_dmd_upper40 ; stop, DMD's are screwed up 2005 2006 add_dmd_upper20: 2007 ; We have found the block we wish to insert a new free block into 0 000072EF 26833E010008 cmp word [es:DMD_PSP],8 ; it must be owned by "system" 0 000072F5 7548 jne add_dmd_upper40 2010 ; Shorten existing DMD to point to new block 0 000072F7 89D8 mov ax,bx ; work out how far to new DMD 0 000072F9 8CC1 mov cx,es 0 000072FB 29C8 sub ax,cx ; it's this many para's 0 000072FD 48 dec ax ; forget the header 0 000072FE 2687060300 xchg ax,[es:DMD_LEN] ; set new length 2016 ; now we need to work out how much is left above the new DMD 0 00007303 29D0 sub ax,dx ; subtract length of new block 0 00007305 262B060300 sub ax,[es:DMD_LEN] ; subtract the portion below 2019 ; Create DMD covering new block 0 0000730A B14D mov cl,IDM ; create a new entry 0 0000730C 26860E0000 xchg cl,[es:DMD_ID] ; CL = existing ID (M/Z) 0 00007311 8EC3 mov es,bx ; ES -> base of new DMD 0 00007313 26C60600004D mov byte [es:DMD_ID],IDM ; it's a link field 0 00007319 26C70601000000 mov word [es:DMD_PSP],0 ; it's free 0 00007320 4A dec dx ; forget the header 0 00007321 01D3 add bx,dx ; last para is here 0 00007323 4A dec dx ; forget the next link 0 00007324 2689160300 mov [es:DMD_LEN],dx ; it's this long 2029 ; Build a new DMD at the top if the new block for anything above it 0 00007329 8EC3 mov es,bx 0 0000732B 26880E0000 mov [es:DMD_ID],cl ; inherit the ID field 0 00007330 26A30300 mov [es:DMD_LEN],ax ; and it's this long 0 00007334 85C0 test ax,ax ; if zero length then 0 00007336 7403 jz add_dmd_upper30 ; it's free 0 00007338 B80800 mov ax,8 ; else it's system 2036 add_dmd_upper30: 0 0000733B 26A30100 mov [es:DMD_PSP],ax ; set owner 2038 add_dmd_upper40: 0 0000733F 07 pop es 0 00007340 C3 ret 2041 2042 2043 2044 2045 func_set: ; SET envar=string 0 00007341 E8[0000] call whitespace ; deblank the command 0 00007344 BF[FFFF] mov di,offset envstart-1 ; point to our environment area 2048 func_set5: 0 00007347 47 inc di 0 00007348 26833D00 cmp word ptr [es:di],0 ; are we at the end yet 0 0000734C 75F9 jne func_set5 0 0000734E 81FF[0000] cmp di,offset envstart ; if nothing is there yet start 0 00007352 7401 je func_set10 ; at the NUL, else skip the NUL 0 00007354 47 inc di ; to leave a seperator 2055 func_set10: 0 00007355 AC lodsb ; get a character 0 00007356 3C0D cmp al,CR ; end of the line yet ? 0 00007358 7409 je func_set20 0 0000735A 81FF[FA00] cmp di,offset envend ; have we room ? 0 0000735E 7306 jae func_set30 ; bail out if not 0 00007360 AA stosb ; save the character 0 00007361 EBF2 jmp short func_set10 2063 func_set20: 0 00007363 31C0 xor ax,ax ; terminate with NULL 0 00007365 AA stosb 2066 func_set30: 0 00007366 C3 ret 2068 %endif ;not ADDDRV 2069 2070 2071 func_echo: ; ECHO "string" 0 00007367 E8[0000] call whitespace ; Scan off all white space 0 0000736A AC lodsb ; before the optional 0 0000736B 3C3D cmp al,'=' ; '=' character. 0 0000736D 7401 je func_echo10 0 0000736F 4E dec si ; point at char 2077 func_echo10: 0 00007370 BA[EE02] mov dx,offset msg_dollar ; NUL error message 0 00007373 B00D mov al,CR ; SI -> config line anyway 0 00007375 E91E04 jmp config_error ; use error reporting routine 2081 2082 func_yeschar: ; yeschar "string" 0 00007378 E8[0000] call whitespace ; Scan off all white space 0 0000737B AC lodsb ; before the optional 0 0000737C 3C3D cmp al,'=' ; '=' character. 0 0000737E 7401 je func_yeschar10 0 00007380 4E dec si ; point at char 2088 func_yeschar10: 0 00007381 E8[0000] call whitespace 0 00007384 AC lodsb 0 00007385 A2[0000] mov [yes_char],al ; update YES character 0 00007388 C3 ret 2093 2094 func_chain: ; CHAIN="filename" - use as new CONFIG.SYS 0 00007389 BF[0000] mov di,offset dev_name ; Copy the Device Filename into a 0 0000738C C60500 mov byte ptr [di],0 ; local buffer and zero terminate 0 0000738F E89F08 call copy_file 0 00007392 722B jc func_chain10 ; ignore if any problems 0 00007394 B8803D mov ax,(MS_X_OPEN*256)+80h ; Try to open the file 0 00007397 BA[0000] mov dx,offset dev_name ; as a new config file 0 0000739A CD21 int DOS_INT ; if we can't ignore it 0 0000739C 7221 jc func_chain10 0 0000739E 89C3 mov bx,ax 0 000073A0 B43E mov ah,MS_X_CLOSE 0 000073A2 CD21 int DOS_INT ; close the new file 0 000073A4 BE[0000] mov si,offset dev_name 0 000073A7 BF[3700] mov di,offset cfg_file 0 000073AA E85808 call copy_asciiz ; copy the new name 0 000073AD C706[8300]0000 mov word [cfg_seeklo],0 ; start at begining of it 0 000073B3 C706[8500]0000 mov word [cfg_seekhi],0 0 000073B9 C706[8900]0000 mov word [cfg_tail],0 ; force a read 2112 func_chain10: 0 000073BF C3 ret 2114 2115 func_switch: ; SWITCH=option0, option1 2116 ; GOSUB to appropriate label 0 000073C0 803E[0000]01 cmp byte [configpass],1 0 000073C5 771E ja func_switch05 0 000073C7 E84208 call wait_for_key ; wait until a key is pressed 0 000073CA 7208 jc func_switch01 ; ignore if timeout 0 000073CC B407 mov ah,MS_C_RAWIN 0 000073CE CD21 int DOS_INT ; read a char 0 000073D0 3C0D cmp al,CR 0 000073D2 7503 jne func_switch02 2125 func_switch01: 0 000073D4 A0[F005] mov al,[default_switch_char] ; use default character 2127 func_switch02: 0 000073D7 3C30 cmp al,'0' ; ignore if < '0' 0 000073D9 72E5 jb func_switch 0 000073DB 3C39 cmp al,'9' ; or > '9' 0 000073DD 77E1 ja func_switch 0 000073DF 2C31 sub al,'1' ; convert from ASCII 0 000073E1 7902 jns func_switch05 0 000073E3 B00A mov al,10 ; make '0' into 10 2135 func_switch05: 0 000073E5 BF0000 mov di,0 0 000073E8 31DB xor bx,bx 0 000073EA 8B0E[8300] mov cx,[cfg_seeklo] 0 000073EE 8B16[8500] mov dx,[cfg_seekhi] 0 000073F2 2B0E[8900] sub cx,[cfg_tail] 0 000073F6 83DA00 sbb dx,0 0 000073F9 030E[8700] add cx,[cfg_head] 0 000073FD 83D200 adc dx,0 2144 func_switch06: 0 00007400 3B3E[8B00] cmp di,[cfg_switchnum] 0 00007404 7317 jae func_switch10 0 00007406 398F[8D00] cmp word ptr [cfg_switchbuf + bx],cx 0 0000740A 7506 jne func_switch07 0 0000740C 3997[8F00] cmp word ptr [cfg_switchbuf+2 + bx],dx 0 00007410 7417 je func_switch11 2151 func_switch07: 0 00007412 83FF0A cmp di,SWITCH_MAX 0 00007415 7312 jae func_switch11 0 00007417 47 inc di 0 00007418 83C305 add bx,5 0 0000741B EBE3 jmp short func_switch06 2157 func_switch10: 0 0000741D 803E[0000]01 cmp byte [configpass],1 0 00007422 771A ja func_switch12 0 00007424 47 inc di 0 00007425 893E[8B00] mov [cfg_switchnum],di 2162 func_switch11: 0 00007429 803E[0000]01 cmp byte [configpass],1 0 0000742E 770E ja func_switch12 0 00007430 898F[8D00] mov word ptr [cfg_switchbuf + bx],cx 0 00007434 8997[8F00] mov word ptr [cfg_switchbuf+2 + bx],dx 0 00007438 8887[9100] mov [cfg_switchbuf+4 + bx],al 0 0000743C EB04 jmp short func_switch15 2169 func_switch12: 0 0000743E 8A87[9100] mov al,[cfg_switchbuf+4 + bx] 2171 func_switch15: 0 00007442 98 cbw ; AX = lines to skip 0 00007443 91 xchg ax,cx ; make CX the loop count 0 00007444 E319 jcxz func_switch30 0 00007446 89F3 mov bx,si ; BX -> saved command line start 2176 func_switch20: 0 00007448 53 push bx 0 00007449 51 push cx 0 0000744A BF[0000] mov di,offset dev_name ; copy and discard a label 0 0000744D E8E107 call copy_file 0 00007450 59 pop cx 0 00007451 5B pop bx 0 00007452 720D jc func_switch40 ; ignore if any problems 0 00007454 53 push bx 0 00007455 51 push cx 0 00007456 E8D303 call separator ; look for ',' 0 00007459 59 pop cx 0 0000745A 5B pop bx 0 0000745B 7204 jc func_switch40 ; stop at end of line 0 0000745D E2E9 loop func_switch20 2191 func_switch30: 0 0000745F EB05 jmp func_gosub ; execute a GOSUB 2193 2194 func_switch40: 0 00007461 89DE mov si,bx ; retract to start of line 0 00007463 E95AFF jmp func_switch ; then back to sleep again 2197 2198 func_gosub: ; GOSUB="label" 2199 ;---------- 0 00007466 58 pop ax ; get return address 0 00007467 8B1E[8300] mov bx,[cfg_seeklo] ; get existing offset 0 0000746B 8B0E[8500] mov cx,[cfg_seekhi] ; in CONFIG file 0 0000746F 2B1E[8900] sub bx,[cfg_tail] ; work out begining of buffer 0 00007473 83D900 sbb cx,0 0 00007476 031E[8700] add bx,[cfg_head] ; add in current offset in buffer 0 0000747A 83D100 adc cx,0 0 0000747D 53 push bx ; save as position to RETURN to 0 0000747E 51 push cx 0 0000747F 50 push ax ; save return address again 0 00007480 E82600 call func_goto ; try to GOTO label 0 00007483 7201 jc func_return 0 00007485 C3 ret ; RET, with old offset on stack 2213 2214 func_return: ; RETURN [n] 2215 ;----------- 0 00007486 5B pop bx ; get return address 0 00007487 3B26[F505] cmp sp,[save_sp] ; is anything on stack ? 0 0000748B 731A jae func_return20 ; no, cannot RETURN 0 0000748D 8F06[8500] pop word [cfg_seekhi] 0 00007491 8F06[8300] pop word [cfg_seeklo] ; restore position in file 0 00007495 C706[8900]0000 mov word [cfg_tail],0 ; force a read 0 0000749B 53 push bx 0 0000749C E87C04 call atoi ; returning a value ? 0 0000749F 5B pop bx 0 000074A0 7302 jnc func_return10 ; default to 0 0 000074A2 31C0 xor ax,ax 2227 func_return10: 0 000074A4 A3[F305] mov [error_level],ax ; return result in error level 2229 func_return20: 0 000074A7 53 push bx ; save return address 0 000074A8 C3 ret ; and return to it 2232 2233 func_goto: ; GOTO="label" 2234 ;--------- 0 000074A9 BF[0000] mov di,offset dev_name ; Copy the label into a 0 000074AC C60500 mov byte ptr [di],0 ; local buffer and zero terminate 0 000074AF E87F07 call copy_file 0 000074B2 7231 jc func_goto10 ; ignore if any problems 2239 0 000074B4 C706[8300]0000 mov word [cfg_seeklo],0 ; Seek to start of file 0 000074BA C706[8500]0000 mov word [cfg_seekhi],0 0 000074C0 C706[8900]0000 mov word [cfg_tail],0 ; force a re-read 2243 2244 func_goto5: 0 000074C6 E8C804 call readline ; read in a line 0 000074C9 721A jc func_goto10 ; stop if end of file 0 000074CB E88903 call strupr ; upper case possible label 0 000074CE BB[BF00] mov bx,offset cfg_buffer 0 000074D1 803F3A cmp byte ptr [bx],':' ; is it a label ? 0 000074D4 75F0 jne func_goto5 ; no, try next line 0 000074D6 BE[0000] mov si,offset dev_name 2252 func_goto6: 0 000074D9 43 inc bx ; next char in possible label 0 000074DA AC lodsb ; get a character 0 000074DB 84C0 test al,al ; end of label ? 0 000074DD 7406 je func_goto10 ; we have a match ! 0 000074DF 3A07 cmp al,byte ptr [bx] ; does it match 0 000074E1 75E3 jne func_goto5 ; no, try next line 0 000074E3 EBF4 jmp short func_goto6 ; yes, look at next character 2260 func_goto10: 0 000074E5 C3 ret 2262 2263 func_exit: 2264 ; Stop processing CONFIG.SYS 0 000074E6 E8A804 call readline ; read in a line 0 000074E9 73FB jnc func_exit ; until we can read no more.. 0 000074EB C3 ret 2268 2269 func_cls: 2270 ; CLEAR SCREEN 2271 ; This is PC specific - sorry 0 000074EC B40F mov ah,15 ; get current 0 000074EE CD10 int 10h ; screen mode 0 000074F0 B400 mov ah,0 0 000074F2 CD10 int 10h ; reset it to clear screen 0 000074F4 C3 ret 2277 2278 func_cpos: 2279 ; Set cursor position 0 000074F5 E82304 call atoi ; AX = row 0 000074F8 7304 jnc func_cpos10 ; check for error 0 000074FA 31C0 xor ax,ax ; default to top left 0 000074FC EB14 jmp short func_cpos40 2284 func_cpos10: 0 000074FE 50 push ax ; save row 0 000074FF E82A03 call separator ; look for ',' 0 00007502 7205 jc func_cpos20 ; no col specified 0 00007504 E81404 call atoi ; get col 0 00007507 7303 jnc func_cpos30 2290 func_cpos20: 0 00007509 B80100 mov ax,1 ; default to left 2292 func_cpos30: 0 0000750C 5A pop dx 0 0000750D 88D4 mov ah,dl ; AH = row, AL = col 0 0000750F 2D0101 sub ax,0101h ; compensate for being one based 2296 func_cpos40: 0 00007512 92 xchg ax,dx ; DH = row, DL = col 0 00007513 31DB xor bx,bx ; page zero 0 00007515 B402 mov ah,2 ; set cursor position 0 00007517 CD10 int 10h ; Eeeek!! call the ROS 0 00007519 C3 ret 2302 2303 func_colour: ; Set fore-/background/border colour 0 0000751A 06 push es 0 0000751B E82E03 call comma ; check for leading ',' 0 0000751E 7319 jnc func_colour10 ; no fg col set, skip to bg 0 00007520 E8F803 call atoi ; else get foreground colour code 0 00007523 7251 jc func_colour30 ; no numerical value follows, skip 0 00007525 240F and al,15 ; only 0-15 supported 0 00007527 C41E[0000] les bx,[condev_off] ; store in console driver 0 0000752B 26C6471801 mov byte ptr [es:24 + bx],1 ; and mark COLOUR as active 0 00007530 26884719 mov [es:25 + bx],al 0 00007534 E8F502 call separator ; more to set? 0 00007537 723D jc func_colour30 ; no 2315 func_colour10: 0 00007539 E81003 call comma ; another comma following? 0 0000753C 731D jnc func_colour20 ; then skip to next section 0 0000753E E8DA03 call atoi ; get value 0 00007541 7233 jc func_colour30 ; none found, done 0 00007543 240F and al,15 ; mask to 0-15 0 00007545 B104 mov cl,4 ; * 16 0 00007547 D2E0 shl al,cl 0 00007549 C41E[0000] les bx,[condev_off] ; store in console driver 0 0000754D 26C6471801 mov byte ptr [es:24 + bx],1 ; mark COLOUR as active 0 00007552 26084719 or [es:25 + bx],al 0 00007556 E8D302 call separator ; finished now? 0 00007559 721B jc func_colour30 ; it seems so 2328 func_colour20: 0 0000755B E8BD03 call atoi ; else get border colour 0 0000755E 7216 jc func_colour30 ; if there is one 0 00007560 240F and al,15 ; only use lower four bits 0 00007562 C41E[0000] les bx,[condev_off] ; store in console driver 0 00007566 26C6471801 mov byte ptr [es:24 + bx],1 ; mark COLOUR as active 0 0000756B 2608471A or [es:26 + bx],al 0 0000756F 88C7 mov bh,al ; and set border colour right away 0 00007571 B80110 mov ax,1001h 0 00007574 CD10 int 10h 2338 func_colour30: 0 00007576 C41E[0000] les bx,[condev_off] ; get address of console driver 0 0000757A 26807F1801 cmp byte ptr [es:24 + bx],1 ; check if any colour was changed 0 0000757F 7507 jne func_colour40 ; apparently not 0 00007581 268A5F19 mov bl,byte ptr [es:25 + bx] ; else get the fg/bg colour 0 00007585 E80200 call col_screen ; and apply it to the whole screen 2344 func_colour40: 0 00007588 07 pop es ; done 0 00007589 C3 ret 2347 2348 col_screen: 0 0000758A B40F mov ah,0fh ; get current screen page 0 0000758C CD10 int 10h ; screen page in BH 0 0000758E B403 mov ah,3 ; get cursor position 0 00007590 CD10 int 10h 0 00007592 52 push dx 2354 0 00007593 BE4000 mov si,40h ; BIOS data segment 0 00007596 8EC6 mov es,si 0 00007598 31F6 xor si,si 0 0000759A 31D2 xor dx,dx ; start in upper left corner 0 0000759C B90100 mov cx,1 ; only one char per time 2360 col_screen10: 0 0000759F 06 push es 0 000075A0 56 push si 0 000075A1 B402 mov ah,2 ; set cursor position 0 000075A3 CD10 int 10h 0 000075A5 B408 mov ah,8 ; read character with colour 0 000075A7 CD10 int 10h ; AL = char, AH = colour 0 000075A9 B409 mov ah,9 ; write char back, BL = colour 0 000075AB CD10 int 10h 0 000075AD 5E pop si 0 000075AE 07 pop es 0 000075AF FEC2 inc dl ; mov to next column 0 000075B1 263A544A cmp dl,[es:4ah + si] ; already at the end of the line? 0 000075B5 75E8 jne col_screen10 ; no, do it again 0 000075B7 30D2 xor dl,dl ; else continue at first column 0 000075B9 FEC6 inc dh ; in next line 0 000075BB 263AB48400 cmp dh,[es:84h + si] ; already last in last line 0 000075C0 76DD jbe col_screen10 ; not finished, yet 2378 0 000075C2 5A pop dx 0 000075C3 B402 mov ah,2 ; restore cursor position 0 000075C5 CD10 int 10h 0 000075C7 C3 ret 2383 2384 func_timeout: 2385 ; set TIMEOUT for keyboard input 0 000075C8 E85003 call atoi ; AX = # timeout count 0 000075CB 7302 jnc func_timeout10 ; check for error 0 000075CD 31C0 xor ax,ax ; bad values mean no timeout 2389 func_timeout10: 0 000075CF A3[F105] mov [keyb_timeout],ax ; save timeout count 0 000075D2 E85702 call separator ; look for ',' 0 000075D5 721D jc func_timeout20 0 000075D7 AC lodsb ; get default query char 0 000075D8 3C0A cmp al,LF 0 000075DA 7418 je func_timeout20 0 000075DC 3C0D cmp al,CR 0 000075DE 7414 je func_timeout20 0 000075E0 A2[EF05] mov [default_query_char],al 0 000075E3 E84602 call separator ; look for ',' 0 000075E6 720C jc func_timeout20 0 000075E8 AC lodsb ; get default switch char 0 000075E9 3C0D cmp al,CR 0 000075EB 7407 je func_timeout20 0 000075ED 3C0A cmp al,LF 0 000075EF 7403 je func_timeout20 0 000075F1 A2[F005] mov [default_switch_char],al 2407 func_timeout20: 0 000075F4 C3 ret 2409 2410 func_error: 2411 ; ERROR='n' 0 000075F5 E82303 call atoi ; AX = error count to match 0 000075F8 7203 jc func_error10 0 000075FA A3[F305] mov [error_level],ax ; set error level 2415 func_error10: 0 000075FD C3 ret 2417 2418 func_onerror: 2419 ; ONERROR='n' optional command 2420 ; 0 000075FE E8[0000] call whitespace ; Scan off all white space 0 00007601 31DB xor bx,bx ; index relationship = 1st item 0 00007603 31D2 xor dx,dx ; DX is bit to set 2424 func_onerror10: 0 00007605 09D3 or bx,dx ; set reationship bit 0 00007607 AC lodsb ; now process a character 0 00007608 BA0200 mov dx,2 0 0000760B 3C3D cmp al,'=' ; if '=' set bit 1 0 0000760D 74F6 je func_onerror10 0 0000760F BA0400 mov dx,4 0 00007612 3C3C cmp al,'<' ; if '<' set bit 2 0 00007614 74EF je func_onerror10 0 00007616 BA0800 mov dx,8 0 00007619 3C3E cmp al,'>' ; if '>' set bit 3 0 0000761B 74E8 je func_onerror10 0 0000761D 4E dec si ; point at char 0 0000761E 53 push bx ; save relationship 0 0000761F E8F902 call atoi ; AX = error count to match 0 00007622 5B pop bx ; recover relationship 0 00007623 7209 jc func_onerror20 0 00007625 3906[F305] cmp [error_level],ax ; is it the error level we want ? 0 00007629 2EFFA7[5F0F] jmp [cs:func_onerror_tbl + bx] ; jump to handler 2443 func_onerror20: 0 0000762E C3 ret 2445 2446 func_onerror_tbl: 0 0000762F [6F0F] dw func_onerror_eq ; . . . 0 00007631 [6F0F] dw func_onerror_eq ; . . = 0 00007633 [750F] dw func_onerror_lt ; . < . 0 00007635 [780F] dw func_onerror_le ; . < = 0 00007637 [7B0F] dw func_onerror_gt ; > . . 0 00007639 [7E0F] dw func_onerror_ge ; > . = 0 0000763B [720F] dw func_onerror_ne ; > < . 0 0000763D [810F] dw func_onerror_take ; > < = 2455 2456 func_onerror_eq: 0 0000763F 7410 je func_onerror_take 0 00007641 C3 ret 2459 2460 func_onerror_ne: 0 00007642 750D jne func_onerror_take 0 00007644 C3 ret 2463 2464 func_onerror_lt: 0 00007645 720A jb func_onerror_take 0 00007647 C3 ret 2467 2468 func_onerror_le: 0 00007648 7607 jbe func_onerror_take 0 0000764A C3 ret 2471 2472 func_onerror_gt: 0 0000764B 7704 ja func_onerror_take 0 0000764D C3 ret 2475 2476 func_onerror_ge: 0 0000764E 7301 jae func_onerror_take 0 00007650 C3 ret 2479 2480 func_onerror_take: 0 00007651 58 pop ax ; discard return address 0 00007652 31C0 xor ax,ax ; boot key options = none 0 00007654 E909F1 jmp cfg_continue ; and execute this command 2484 2485 2486 2487 func_query: 2488 ; ?optional command 0 00007657 813E[FD00]003F cmp word [boot_options],F5KEY ; if F5 has been pressed then 2490 ; je func_query50 ; do nothing 0 0000765D 7503 jne func_query05 0 0000765F E9C600 jmp func_query50 2493 func_query05: 0 00007662 E8[0000] call whitespace ; discard any following whitespace 0 00007665 AC lodsb ; get a character 0 00007666 3C3F cmp al,'?' ; is it another '?', is so swallow it 0 00007668 74ED je func_query ; and go round again 0 0000766A 4E dec si ; it wasn't a '?', forget we looked 0 0000766B B201 mov dl,1 ; assume execution in main phase 0 0000766D 56 push si 0 0000766E 52 push dx 0 0000766F E84701 call scan ; scan the command list 0 00007672 5A pop dx 0 00007673 5E pop si 0 00007674 7210 jc func_query06 0 00007676 8B5504 mov dx,[CFG_FLAGS + di] ; flags for this config command 0 00007679 803E[0000]00 cmp byte [configpass],0 ; CF_ALL does not include pass 0 0 0000767E 7406 je func_query06 0 00007680 F7C24000 test dx,CF_ALL ; present in all phases? 0 00007684 750D jnz func_query07 ; yes, proceed with query 2511 func_query06: 0 00007686 80E207 and dl,CF_NOF-1 ; config pass to execute in 0 00007689 3A16[0000] cmp dl,[configpass] ; does the phase number match? 0 0000768D 7404 je func_query07 ; yes, proceed with query 0 0000768F F9 stc 0 00007690 E99500 jmp func_query50 ; no, no need to ask for it 2517 func_query07: 0 00007693 56 push si ; save current position 0 00007694 AC lodsb ; get next real char 0 00007695 31C9 xor cx,cx ; assume no prompt string 0 00007697 3C22 cmp al,'"' ; '?"user prompt"' - keep silent as 0 00007699 7502 jne func_query10 ; user has supplied prompt 0 0000769B 91 xchg ax,cx ; CL = " if user prompt 0 0000769C AC lodsb 2525 func_query10: 0 0000769D 38C8 cmp al,cl ; is this the user prompt char ? 0 0000769F 742A je func_query20 ; then stop now 0 000076A1 92 xchg ax,dx ; DL= character 0 000076A2 B402 mov ah,MS_C_WRITE 0 000076A4 CD21 int DOS_INT ; output the character 0 000076A6 AC lodsb 0 000076A7 3C0D cmp al,CR ; is it the end of the line ? 0 000076A9 75F2 jne func_query10 ; no, do another character 0 000076AB B409 mov ah,MS_C_WRITESTR ; Output msg of form " (Y/N) ? " 0 000076AD BA[BF05] mov dx,offset confirm_msg1 0 000076B0 CD21 int DOS_INT ; do " (" 0 000076B2 B402 mov ah,MS_C_WRITE 0 000076B4 8A16[0000] mov dl,[yes_char] 0 000076B8 CD21 int DOS_INT ; do "Y" 0 000076BA B22F mov dl,'/' 0 000076BC CD21 int DOS_INT ; do "/" 0 000076BE 8A16[0000] mov dl,[no_char] 0 000076C2 CD21 int DOS_INT ; do "N" 0 000076C4 B409 mov ah,MS_C_WRITESTR 0 000076C6 BA[C205] mov dx,offset confirm_msg2 0 000076C9 CD21 int DOS_INT ; do ") ? " 2547 func_query20: 0 000076CB E302 jcxz func_query30 ; if no user supplied prompt 0 000076CD 58 pop ax ; don't discard original starting 0 000076CE 56 push si ; position 2551 func_query30: 0 000076CF E83A05 call wait_for_key ; wait until a key is pressed 0 000076D2 A0[EF05] mov al,[default_query_char] ; if we timeout default 0 000076D5 720C jc func_query40 0 000076D7 B407 mov ah,MS_C_RAWIN 0 000076D9 CD21 int DOS_INT ; read a char 0 000076DB 84C0 test al,al ; is it a function key ? 0 000076DD 7504 jnz func_query40 0 000076DF B407 mov ah,MS_C_RAWIN 0 000076E1 CD21 int DOS_INT ; throw away function keys 2561 ; jmps func_query30 2562 func_query40: 0 000076E3 3C0D cmp al,13 ; accept for 'yes' 0 000076E5 7505 jne func_query41 0 000076E7 A0[0000] mov al,[yes_char] 0 000076EA EB20 jmp short func_query45 2567 func_query41: 0 000076EC 3C20 cmp al,32 ; accept for 'no' 0 000076EE 7505 jne func_query42 0 000076F0 A0[0000] mov al,[no_char] 0 000076F3 EB17 jmp short func_query45 2572 func_query42: 0 000076F5 E89F01 call toupper 0 000076F8 3A06[0000] cmp al,[yes_char] 0 000076FC 740E je func_query45 0 000076FE 3A06[0000] cmp al,[no_char] 0 00007702 7408 je func_query45 0 00007704 B402 mov ah,MS_C_WRITE 0 00007706 B207 mov dl,7 0 00007708 CD21 int DOS_INT 0 0000770A EBC3 jmp short func_query30 2582 func_query45: 0 0000770C 50 push ax ; save response 0 0000770D B402 mov ah,MS_C_WRITE 0 0000770F 88C2 mov dl,al 0 00007711 CD21 int DOS_INT ; echo the char 0 00007713 B409 mov ah,MS_C_WRITESTR 0 00007715 BA[C705] mov dx,offset confirm_msg3 0 00007718 CD21 int DOS_INT ; now do CR/LF to tidy up 0 0000771A 58 pop ax 2591 ; call toupper ; make response upper case 0 0000771B 5E pop si ; recover starting position 0 0000771C 3A06[0000] cmp al,[yes_char] 0 00007720 7506 jne func_query50 0 00007722 58 pop ax ; Discard Return Address 0 00007723 31C0 xor ax,ax ; boot key options = none 0 00007725 E938F0 jmp cfg_continue ; Execute the command 2598 func_query50: 0 00007728 C3 ret ; Return without Executing Command 2600 2601 2602 2603 func_getkey: ; GETKEY 0 00007729 E8E004 call wait_for_key ; wait until a key is pressed 0 0000772C B80004 mov ax,CONFIG_ERRLVL ; assume we have timed out 0 0000772F 7206 jc func_getkey10 ; ignore if timeout 0 00007731 B407 mov ah,MS_C_RAWIN 0 00007733 CD21 int DOS_INT ; read a char 0 00007735 30E4 xor ah,ah ; convert to word 2610 func_getkey10: 0 00007737 A3[F305] mov [error_level],ax 0 0000773A C3 ret 2613 2614 func_version: ; VERSION=x.xx,x.xx 0 0000773B E80E01 call comma ; check for leading ',' 0 0000773E 732D jnc func_version20 ; if yes, then skip to true version 0 00007740 31D2 xor dx,dx 0 00007742 E8D601 call atoi ; get major version number 0 00007745 724E jc func_version40 ; no numerical value 0 00007747 83F800 cmp ax,0 0 0000774A 7449 jz func_version40 0 0000774C 88C2 mov dl,al 0 0000774E E8F000 call dot ; check for '.' 0 00007751 7207 jc func_version10 0 00007753 E8C501 call atoi ; get minor version number 0 00007756 723D jc func_version40 0 00007758 88C6 mov dh,al 2628 func_version10: 0 0000775A 06 push es 0 0000775B 53 push bx 0 0000775C 8E06[0000] mov es,[dos_dseg] 0 00007760 BB120D mov bx,0d12h ; use as new DOS version 0 00007763 268917 mov [es:bx],dx 0 00007766 5B pop bx 0 00007767 07 pop es 0 00007768 E8C100 call separator ; check for ',' 0 0000776B 7228 jc func_version40 2638 func_version20: 0 0000776D 31D2 xor dx,dx 0 0000776F E8A901 call atoi ; get major version number 0 00007772 7221 jc func_version40 ; no numerical value 0 00007774 83F800 cmp ax,0 0 00007777 741C jz func_version40 0 00007779 88C2 mov dl,al 0 0000777B E8C300 call dot ; check for '.' 0 0000777E 7207 jc func_version30 0 00007780 E89801 call atoi ; get minor version number 0 00007783 7210 jc func_version40 0 00007785 88C6 mov dh,al 2650 func_version30: 0 00007787 06 push es 0 00007788 53 push bx 0 00007789 8E06[0000] mov es,[dos_dseg] 0 0000778D BB100D mov bx,0d10h ; use as new DOS version 0 00007790 268917 mov [es:bx],dx 0 00007793 5B pop bx 0 00007794 07 pop es 2658 func_version40: 0 00007795 C3 ret 2660 2661 ; CONFIG_ERROR is the global error handler for the CONFIG.SYS 2662 ; commands. It is called with SI pointing to the CR/LF terminated string 2663 ; that caused the error and with DX pointing to an "informative" error 2664 ; message. 2665 ; 2666 ; On Entry:- AL Terminating Character 2667 ; DX Offset of Error Message 2668 ; SI 0000 No Message to display 2669 ; Offset of AL terminated string 2670 ; 2671 config_error: 2672 2673 %if ADDDRV 2674 mov byte [error_flag],1 2675 %endif 2676 0 00007796 50 push ax 0 00007797 B409 mov ah,MS_C_WRITESTR ; Print the Error Message 0 00007799 CD21 int DOS_INT ; passed in DX 0 0000779B 58 pop ax 2681 0 0000779C 88C4 mov ah,al ; AH = terminating character 0 0000779E 85F6 test si,si ; display the failing string ? 0 000077A0 740D jz cfg_e20 ; YES then scan for terminator 2685 cfg_e10: 0 000077A2 AC lodsb ; get char to display 0 000077A3 38E0 cmp al,ah ; have we reached the terminator ? 0 000077A5 7408 je cfg_e20 0 000077A7 92 xchg ax,dx ; DL = character to display 0 000077A8 B402 mov ah,MS_C_WRITE ; print a character at a time 0 000077AA CD21 int DOS_INT 0 000077AC 92 xchg ax,dx ; terminator back in AH 0 000077AD EBF3 jmp short cfg_e10 2694 cfg_e20: 2695 ;; jmp crlf ; Terminate with a CRLF 2696 2697 Public crlf 2698 crlf: 0 000077AF 52 push dx 0 000077B0 BA[EC02] mov dx,offset msg_crlf ; Print a CR LF 0 000077B3 B409 mov ah,MS_C_WRITESTR 0 000077B5 CD21 int DOS_INT 0 000077B7 5A pop dx 0 000077B8 C3 ret 2705 2706 ; 2707 ; Scan the command table for a match with the first entry in the 2708 ; CR/LF terminated string passed in SI 2709 scan: 0 000077B9 E8[0000] call whitespace ; scan off all white space 0 000077BC 53 push bx ; save the CONFIG Handle 0 000077BD BB[E902] mov bx,offset cfg_table - CFG_SIZE 2713 2714 scan_10: 0 000077C0 83C306 add bx,CFG_SIZE ; bx -> next entry in table 0 000077C3 8B3F mov di,[CFG_NAME + bx] ; es:di -> next entry name 0 000077C5 85FF test di,di ; end of table ? 0 000077C7 F9 stc ; assume so 0 000077C8 7431 jz scan_exit ; Yes Exit with the Carry Flag Set 0 000077CA 56 push si ; Save the String Offset 0 000077CB E82F00 call compare 0 000077CE 58 pop ax ; Remove String Address 0 000077CF 7303 jnc scan_20 ; String Matched 0 000077D1 96 xchg ax,si ; Restore the original String Address 0 000077D2 EBEC jmp short scan_10 ; and test the next entry 2726 2727 scan_20: 0 000077D4 836704DF and word [CFG_FLAGS + bx],~ CF_QUERY 0 000077D8 F747041000 test word [CFG_FLAGS + bx],CF_LC ; should we upper case line ? 0 000077DD 7518 jnz scan_50 ; skip if not 0 000077DF 96 xchg ax,si 0 000077E0 E87400 call strupr ; upper case the command line 0 000077E3 96 xchg ax,si 2734 scan_30: 0 000077E4 E8[0000] call whitespace ; Scan off all white space before and 0 000077E7 AC lodsb ; after the option '=' character 0 000077E8 3C3F cmp al,'?' ; are we querying things ? 0 000077EA 7506 jne scan_40 0 000077EC 834F0420 or word [CFG_FLAGS + bx],CF_QUERY ; remember the query, now go and 0 000077F0 EBF2 jmp short scan_30 ; remove any other whitespace 2741 scan_40: 0 000077F2 3C3D cmp al,'=' ; '=' character. 0 000077F4 74EE je scan_30 0 000077F6 4E dec si 2745 scan_50: 0 000077F7 89DF mov di,bx ; Save the Table Entry 0 000077F9 31C0 xor ax,ax ; and exit with the Carry Flag Reset 2748 scan_exit: 0 000077FB 5B pop bx 0 000077FC C3 ret 2751 2752 ; Compare two strings in case insensitive manner 2753 ; On Entry: 2754 ; ds:si -> String 1 (upper/lower case, length determined by string 2) 2755 ; es:di -> String 2 (uppercase, null terminated) 2756 ; On Exit: 2757 ; Carry clear: strings are the same 2758 ; ds:si -> character immediately following end of string 1 2759 ; es:di -> character immediately following end on string 2 2760 ; 2761 ; Carry set: strings different 2762 ; ds:si -> As on entry 2763 ; es:di -> undefined 2764 ; 2765 compare: 2766 ;------- 0 000077FD 53 push bx 0 000077FE 56 push si ; save starting position 2769 compare10: 0 000077FF 268A05 mov al,[es:di] ; al = next character 0 00007802 47 inc di 0 00007803 84C0 test al,al ; end of string 2 yet ? 0 00007805 741E jz compare40 ; yes, strings must be equal 0 00007807 E86900 call dbcs_lead ; DBCS lead byte? 0 0000780A 750C jnz compare20 ; no 0 0000780C 88C4 mov ah,al 0 0000780E AC lodsb ; is 1st byte of pair the same ? 0 0000780F 38E0 cmp al,ah 0 00007811 7511 jne compare30 0 00007813 A6 cmpsb ; is 2nd byte of pair equal ? 0 00007814 750E jne compare30 0 00007816 EBE7 jmp short compare10 2783 compare20: 0 00007818 E87C00 call toupper ; just uppercase this byte 0 0000781B 93 xchg ax,bx ; BL = string2 character 0 0000781C AC lodsb ; al = next char in string 1 0 0000781D E87700 call toupper ; (can't be KANJI if it matches) 0 00007820 38D8 cmp al,bl ; check the characters are 0 00007822 74DB je compare10 ; identical stop the compare 2790 compare30: 0 00007824 F9 stc ; on a mismatch and set CY 2792 compare40: 0 00007825 5B pop bx ; recover starting position 0 00007826 7302 jnc compare50 0 00007828 89DE mov si,bx ; SI = original start 2796 compare50: 0 0000782A 5B pop bx 0 0000782B C3 ret 2799 2800 2801 separator: 2802 ;--------- 2803 ; On Entry: 2804 ; DS:SI -> string 2805 ; On Exit: 2806 ; DS:SI -> next option 2807 ; CY set if end of line 2808 ; 2809 ; Strips off all whitespace, and the optional ',' 2810 ; CY set at end of line 0 0000782C E8[0000] call whitespace ; deblank string and 0 0000782F AC lodsb ; check for ',' separator 0 00007830 3C2C cmp al,',' ; discarding if found 0 00007832 7407 je separator10 0 00007834 3C0D cmp al,CR ; end of the line ? 0 00007836 F9 stc ; assume so 0 00007837 7402 je separator10 0 00007839 4E dec si ; something else, leave alone 0 0000783A F8 clc ; not end of line 2820 separator10: 0 0000783B C3 ret 2822 2823 separator20: 0 0000783C E8[0000] call whitespace ; strip of following spaces 0 0000783F F8 clc ; not end of line 0 00007840 C3 ret 2827 2828 dot: 2829 ;--------- 2830 ; On Entry: 2831 ; DS:SI -> string 2832 ; On Exit: 2833 ; DS:SI -> next option 2834 ; CY set if '.' not found 2835 ; 2836 ; Strips off all whitespace, and the optional '.' 0 00007841 E8[0000] call whitespace ; deblank string and 0 00007844 AC lodsb ; check for '.' separator 0 00007845 3C2E cmp al,'.' ; discarding if found 0 00007847 7402 je dot10 0 00007849 4E dec si 0 0000784A F9 stc ; else set carry 2843 dot10: 0 0000784B C3 ret 2845 2846 comma: 2847 ;--------- 2848 ; On Entry: 2849 ; DS:SI -> string 2850 ; On Exit: 2851 ; DS:SI -> next option 2852 ; CY set if ',' not found 2853 ; 2854 ; Strips off all whitespace, and the optional ',' 0 0000784C E8[0000] call whitespace ; deblank string and 0 0000784F AC lodsb ; check for ',' separator 0 00007850 3C2C cmp al,',' ; discarding if found 0 00007852 7402 je comma10 0 00007854 4E dec si 0 00007855 F9 stc ; else set carry 2861 comma10: 0 00007856 C3 ret 2863 2864 strupr: 2865 ;------ 2866 ; Uppercase a null terminated string. 2867 ; Entry 2868 ; ds:si -> null terminated string 2869 ; Exit 2870 ; none (string is uppercased) 2871 ; Lost 2872 ; no registers changed 2873 2874 0 00007857 56 push si 0 00007858 50 push ax 2877 2878 spr_loop: 0 00007859 8A04 mov al, [si] ; al = next byte from string 0 0000785B 84C0 test al, al ; end of string? 0 0000785D 7411 jz spr_done ; yes - exit 2882 2883 ; cmp al,' ' ; BAP. End at first space 2884 ; je spr_done ; or comma or slash 2885 ; cmp al,',' ; so that parameters 2886 ; je spr_done ; are not uppercased 2887 ; cmp al,'/' ; Took out again cos it caused 2888 ; je spr_done ; problems with labels (I think). 2889 0 0000785F E81100 call dbcs_lead ; DBCS lead byte? 0 00007862 7504 jnz spr_not_dbcs ; no 0 00007864 46 inc si ; yes - skip first and second bytes of 0 00007865 46 inc si ; pair as they cannot be uppercased 0 00007866 EBF1 jmp spr_loop ; loop round 2895 spr_not_dbcs: 2896 0 00007868 E82C00 call toupper ; just uppercase this byte 0 0000786B 8804 mov [si], al ; return the result to the string 0 0000786D 46 inc si 0 0000786E EBE9 jmp spr_loop ; continue 2901 2902 spr_done: 0 00007870 58 pop ax 0 00007871 5E pop si 0 00007872 C3 ret 2906 2907 2908 dbcs_lead: 2909 ;--------- 2910 ; Return true if given byte is the first of a double byte character. 2911 ; Entry 2912 ; al = byte to be tested 2913 ; Exit 2914 ; Z Flag = 1 - byte is a DBCS lead 2915 ; 0 - byte is not a DBCS lead 2916 ; Lost 2917 ; no registers changed 2918 2919 0 00007873 1E push ds 0 00007874 56 push si 0 00007875 53 push bx 0 00007876 50 push ax 2924 2925 ; First get a pointer to the double byte lead table in the COUNTRY info. 0 00007877 C536[0000] lds si, [dbcs_tbl] ; ds:si -> double byte table 0 0000787B 46 inc si 0 0000787C 46 inc si ; skip table length 2929 2930 ; Examine each entry in the table to see if it defines a range that includes 2931 ; the given character. 0 0000787D 88C3 mov bl, al ; bl = byte to be tested 2933 dbcs_loop: 0 0000787F AD lodsw ; al/ah = start/end of range 0 00007880 85C0 test ax, ax ; end of table? 0 00007882 740C jz dbcs_no ; yes - exit (not in table) 0 00007884 38D8 cmp al, bl ; start <= bl? 0 00007886 77F7 ja dbcs_loop ; no - try next range 0 00007888 38DC cmp ah, bl ; bl <= end? 0 0000788A 72F3 jb dbcs_loop ; no - try next range 2941 0 0000788C 38C0 cmp al, al ; return with Z flag set 0 0000788E EB02 jmp dbcs_exit 2944 2945 dbcs_no: 0 00007890 3C01 cmp al, 1 ; return with Z flag reset 2947 2948 dbcs_exit: 0 00007892 58 pop ax 0 00007893 5B pop bx 0 00007894 5E pop si 0 00007895 1F pop ds 0 00007896 C3 ret 2954 2955 2956 2957 toupper: 2958 ;------- 2959 ; Return the uppercase equivilant of the given character. 2960 ; The uppercase function defined in the international info block is 2961 ; called for characters above 80h. 2962 ; Entry 2963 ; al = character to uppercase 2964 ; Exit 2965 ; al uppercased 2966 ; Lost 2967 ; no registers lost 2968 0 00007897 53 push bx 0 00007898 88E7 mov bh, ah 0 0000789A B400 mov ah, 0 ; ax = character to be converted 0 0000789C 3C61 cmp al, 'a' ; al < 'a'? 0 0000789E 7210 jb exit_toupper ; yes - done (char unchanged) 0 000078A0 3C7A cmp al, 'z' ; al <= 'z'? 0 000078A2 760A jbe a_z ; yes - do ASCII conversion 0 000078A4 3C80 cmp al, 80h ; international char? 0 000078A6 7208 jb exit_toupper ; no - done (char unchanged) 2978 2979 ; ch >= 80h -- call international routine 0 000078A8 FF1E[1200] call far [ctry_info+CI_CASEOFF] 0 000078AC EB02 jmp exit_toupper 2982 2983 a_z: 2984 ; 'a' <= ch <= 'z' -- convert to uppercase ASCII equivilant 0 000078AE 24DF and al, 0DFh 2986 2987 exit_toupper: 0 000078B0 88FC mov ah, bh 0 000078B2 5B pop bx 0 000078B3 C3 ret 2991 2992 2993 2994 2995 ; 2996 ; Scan the string DS:SI for ON or OFF return with the carry flag set 2997 ; on error or AL = 1 for ON and AL = 0 for OFF. 2998 ; 2999 check_onoff: 0 000078B4 E8[0000] call whitespace ; Deblank Command 0 000078B7 56 push si 0 000078B8 BF[B805] mov di,offset cmd_on ; es:di -> "ON" 0 000078BB E83FFF call compare ; do we have an "ON"? 0 000078BE B001 mov al,01 ; Assume ON found 0 000078C0 730F jnc chk_onoff10 3006 0 000078C2 5E pop si 0 000078C3 56 push si ; Save String Location in Case of Error 0 000078C4 BF[BB05] mov di,offset cmd_off ; es:di -> "OFF" 0 000078C7 E833FF call compare ; do we have an "OFF"? 0 000078CA B000 mov al,00 0 000078CC 7303 jnc chk_onoff10 0 000078CE 5E pop si ; No match so return original address 0 000078CF F9 stc ; with the CARRY falg set. 0 000078D0 C3 ret 3016 3017 chk_onoff10: 0 000078D1 5F pop di ; Remove Old String address 0 000078D2 C3 ret ; and return to caller 3020 3021 atohex: 3022 ;------ 3023 ; To convert a hex number in the form of an ASCII string to a 32 bit 3024 ; integer. 3025 ; 3026 ; On Entry: 3027 ; DS:SI -> ASCII hex number 3028 ; (the end of the number is taken as the first non-digit) 3029 ; On Exit: 3030 ; CY clear: 3031 ; DX:AX = converted number 3032 ; ds:si -> first non-digit 3033 ; 3034 ; CY set: 3035 ; Either the first character was not a digit 3036 ; or the number could not be represented in 32 bits 3037 ; ds:si -> point at which error occured 3038 ; ax undefined 3039 ; Lost 3040 ; no other register 3041 0 000078D3 53 push bx 0 000078D4 51 push cx 0 000078D5 57 push di 0 000078D6 E8[0000] call whitespace ; Deblank Line 0 000078D9 89F7 mov di,si ; save string start offset 0 000078DB 31D2 xor dx,dx 0 000078DD 31DB xor bx,bx ; number is formed in DX:BX 3049 3050 atohex10: 0 000078DF AC lodsb ; AL = next char from string 0 000078E0 E8B4FF call toupper ; upper case it 0 000078E3 3C41 cmp al,'A' 0 000078E5 7208 jb atohex20 0 000078E7 3C46 cmp al,'F' 0 000078E9 7704 ja atohex20 0 000078EB 2C37 sub al,'A'-10 0 000078ED EB08 jmp short atohex30 3059 atohex20: 0 000078EF 2C30 sub al, '0' 0 000078F1 721D jc atohex40 ; stop if invalid character 0 000078F3 3C09 cmp al, 9 0 000078F5 7719 ja atohex40 3064 atohex30: 0 000078F7 98 cbw ; AX = digit 0 000078F8 F6C6F0 test dh,0f0h ; will we overflow ? 0 000078FB 7518 jnz atohex_error 0 000078FD B104 mov cl,4 0 000078FF 53 push bx ; save (top 4 bits) 0 00007900 D3E3 shl bx,cl ; *16 0 00007902 01C3 add bx,ax ; add in new digit 0 00007904 58 pop ax 0 00007905 D3C0 rol ax,cl ; top 4 bits to bottom 4 bits 0 00007907 83E00F and ax,000Fh ; isolate them 0 0000790A D3E2 shl dx,cl 0 0000790C 01C2 add dx,ax ; add in new digit 0 0000790E EBCF jmp atohex10 3078 3079 atohex40: 0 00007910 4E dec si ; forget the char we stopped on 0 00007911 39FE cmp si, di ; was there at least one digit? 0 00007913 7701 ja atohex50 ; yes - exit with carry clear 3083 atohex_error: 0 00007915 F9 stc ; set error flag 3085 atohex50: 0 00007916 93 xchg ax,bx ; AX = result 0 00007917 5F pop di 0 00007918 59 pop cx 0 00007919 5B pop bx 0 0000791A C3 ret 3091 3092 atoi: 3093 ;---- 3094 ; To convert a decimal number in the form of an ASCII string to a 16 bit 3095 ; integer. 3096 ; 3097 ; Entry 3098 ; ds:si -> ASCII decimal number 3099 ; (the end of the number is taken as the first non-digit) 3100 ; Exit 3101 ; Carry clear: 3102 ; ax = converted number 3103 ; ds:si -> first non-digit 3104 ; 3105 ; Carry set: 3106 ; Either the first character was not a digit 3107 ; or the number could not be represented in 16 bits 3108 ; ds:si -> point at which error occured 3109 ; ax undefined 3110 ; Lost 3111 ; no other register 3112 0 0000791B 53 push bx 0 0000791C 51 push cx 0 0000791D 52 push dx 0 0000791E 57 push di 0 0000791F E8[0000] call whitespace ; Deblank Line 0 00007922 89F7 mov di, si ; save string start offset 0 00007924 B90A00 mov cx, 10 ; for multiply 0 00007927 31C0 xor ax, ax ; number is formed in ax 3121 3122 atoi_loop: 0 00007929 8A1C mov bl, [si] ; bl = next char from string 0 0000792B 80EB30 sub bl, '0' 0 0000792E 7212 jc atoi_done 0 00007930 80FB09 cmp bl, 9 0 00007933 770D ja atoi_done 0 00007935 B700 mov bh, 0 ; bx = next digit 3129 0 00007937 F7E1 mul cx ; ax = 10 * ax 0 00007939 720C jc exit_atoi ; check for 16 bit overflow 0 0000793B 01D8 add ax, bx ; ax = (10 * ax) + bx 0 0000793D 7208 jc exit_atoi 3134 0 0000793F 46 inc si ; ds:si -> next char in string 0 00007940 EBE7 jmp atoi_loop 3137 3138 atoi_done: 0 00007942 39FE cmp si, di ; was there at least one digit? 0 00007944 7501 jne exit_atoi ; yes - exit with carry clear 0 00007946 F9 stc ; no - set error flag 3142 3143 exit_atoi: 0 00007947 5F pop di 0 00007948 5A pop dx 0 00007949 59 pop cx 0 0000794A 5B pop bx 0 0000794B C3 ret 3149 3150 atol: 3151 ;---- 3152 ; To convert a decimal number in the form of an ASCII string to a 32 bit 3153 ; integer. 3154 ; 3155 ; Entry 3156 ; ds:si -> ASCII decimal number 3157 ; (the end of the number is taken as the first non-digit) 3158 ; Exit 3159 ; CY clear: 3160 ; DX:AX = converted number 3161 ; ds:si -> first non-digit 3162 ; 3163 ; CY set: 3164 ; Either the first character was not a digit 3165 ; or the number could not be represented in 32 bits 3166 ; ds:si -> point at which error occured 3167 ; ax undefined 3168 ; Lost 3169 ; no other register 3170 0 0000794C 53 push bx 0 0000794D 51 push cx 0 0000794E 57 push di 0 0000794F E8[0000] call whitespace ; Deblank Line 0 00007952 89F7 mov di, si ; save string start offset 0 00007954 31C0 xor ax, ax ; number is formed in 0 00007956 99 cwd ; DX/AX 3178 3179 atol10: 0 00007957 31DB xor bx,bx ; use CX/BX for next digit 0 00007959 31C9 xor cx,cx 0 0000795B 8A1C mov bl,[si] ; BL = next char from string 0 0000795D 80EB30 sub bl,'0' 0 00007960 7226 jc atol20 0 00007962 80FB09 cmp bl, 9 ; validate digit 0 00007965 7721 ja atol20 0 00007967 01C0 add ax,ax 0 00007969 11D2 adc dx,dx ; * 2 0 0000796B 7220 jc atol30 0 0000796D 01C3 add bx,ax ; * 2 + new digit 0 0000796F 11D1 adc cx,dx 0 00007971 721A jc atol30 0 00007973 01C0 add ax,ax 0 00007975 11D2 adc dx,dx ; * 4 0 00007977 7214 jc atol30 0 00007979 01C0 add ax,ax 0 0000797B 11D2 adc dx,dx ; * 8 0 0000797D 720E jc atol30 0 0000797F 01D8 add ax,bx ; * 10 + new digit 0 00007981 01CA add dx,cx 0 00007983 7208 jc atol30 0 00007985 46 inc si ; ds:si -> next char in string 0 00007986 EBCF jmp atol10 3204 3205 atol20: 0 00007988 39FE cmp si,di ; was there at least one digit? 0 0000798A 7501 jne atol30 ; yes - exit with carry clear 0 0000798C F9 stc ; no - set error flag 3209 atol30: 0 0000798D 5F pop di 0 0000798E 59 pop cx 0 0000798F 5B pop bx 0 00007990 C3 ret 3214 3215 readline: 3216 ;-------- 3217 ; On Entry: 3218 ; None 3219 ; On Exit: 3220 ; DS:SI -> line in buffer 3221 ; CY set if we have a problem (eg at EOF) 3222 ; 0 00007991 B9FE00 mov cx,CFG_BUF_LEN-2 ; Read the next command line 0 00007994 BF[BF00] mov di,offset cfg_buffer ; into the CFG_BUFFER 0 00007997 89FE mov si,di ; Save the Destination String 3226 ; address 3227 read_l10: 0 00007999 E83400 call getchar ; al = next char from file 0 0000799C 3C0D cmp al,CR 0 0000799E 74F9 jz read_l10 ; end of line ? 0 000079A0 3C0A cmp al,LF 0 000079A2 74F5 jz read_l10 ; end of line ? 0 000079A4 3C1A cmp al,EOF 0 000079A6 7502 jne read_l20 ; end of file ? 0 000079A8 F9 stc ; indicate a problem 0 000079A9 C3 ret 3237 3238 read_l20: 0 000079AA AA stosb ; put next char into the buffer 0 000079AB E82200 call getchar ; al = next char from file 3241 0 000079AE 3C1A cmp al,EOF 0 000079B0 7414 jz read_l30 ; end of file ? 0 000079B2 3C0D cmp al,CR 0 000079B4 7410 jz read_l30 ; end of line ? 0 000079B6 3C0A cmp al,LF 0 000079B8 740C jz read_l30 ; end of line ? 0 000079BA E2EE loop read_l20 ; loop while space remains 3249 3250 ; If we fall through to this point the line is too long. Make it a comment. 0 000079BC 89F7 mov di, si ; ds:di -> start of buffer 0 000079BE B03B mov al, ';' 0 000079C0 AA stosb ; place ';' at buffer start 0 000079C1 B90100 mov cx, 1 ; get another one character 0 000079C4 EBE4 jmp short read_l20 ; loop until all of this line consumed 3256 3257 ; At this point buffer contains a line of text from CCONFIG.SYS. 3258 ; Terminate it properly 3259 read_l30: 0 000079C6 B00D mov al,CR 0 000079C8 AA stosb ; terminate line with CR 0 000079C9 B00A mov al,LF 0 000079CB AA stosb ; and a LF 0 000079CC 30C0 xor al,al 0 000079CE AA stosb ; Reset the Carry Flag 0 000079CF C3 ret 3267 3268 getchar: 0 000079D0 8B1E[8700] mov bx,[cfg_head] ; we are here in the buffer 0 000079D4 3B1E[8900] cmp bx,[cfg_tail] ; are there any more characters ? 0 000079D8 730D jae getchar10 ; no, read some in from disk 0 000079DA 1E push ds 0 000079DB 8E1E[0000] mov ds,[init_dseg] 0 000079DF 8A07 mov al,[CONFIG_BUF + bx] ; get a character from the buffer 0 000079E1 1F pop ds 0 000079E2 FF06[8700] inc word [cfg_head] ; inc the pointer 0 000079E6 C3 ret 3278 3279 getchar10: 3280 ; we need to read some characters from disk into our buffer 0 000079E7 51 push cx 0 000079E8 52 push dx ; Assume something will go wrong 0 000079E9 C706[8900]0000 mov word [cfg_tail],0 ; say nothing is in the buffer 3284 0 000079EF B8803D mov ax,(MS_X_OPEN*256)+80h ; Open the configuration file 0 000079F2 BA[3700] mov dx,offset cfg_file 0 000079F5 CD21 int DOS_INT 0 000079F7 723A jc getchar40 ; failure, return EOF 3289 0 000079F9 89C3 mov bx,ax 0 000079FB B80042 mov ax,(MS_X_LSEEK*256)+0 0 000079FE 8B16[8300] mov dx,[cfg_seeklo] 0 00007A02 8B0E[8500] mov cx,[cfg_seekhi] 0 00007A06 CD21 int DOS_INT ; seek to current file position 0 00007A08 7225 jc getchar30 ; failure to seek, close and exit 3296 0 00007A0A B43F mov ah,MS_X_READ 0 00007A0C B90020 mov cx,CONFIG_BUF_SIZE 0 00007A0F 1E push ds 0 00007A10 8E1E[0000] mov ds,[init_dseg] 0 00007A14 BA0000 mov dx,offset CONFIG_BUF ; lets try and fill out buffer 0 00007A17 CD21 int DOS_INT 0 00007A19 1F pop ds 0 00007A1A 7213 jc getchar30 0 00007A1C A3[8900] mov [cfg_tail],ax 0 00007A1F B80142 mov ax,(MS_X_LSEEK*256)+1 0 00007A22 31D2 xor dx,dx 0 00007A24 31C9 xor cx,cx 0 00007A26 CD21 int DOS_INT ; get current file position 0 00007A28 A3[8300] mov [cfg_seeklo],ax ; and save for possible 0 00007A2B 8916[8500] mov [cfg_seekhi],dx ; future re-opens 3312 getchar30: 0 00007A2F B43E mov ah,MS_X_CLOSE ; Close the CONFIG file 0 00007A31 CD21 int DOS_INT 3315 getchar40: 0 00007A33 8B1E[8900] mov bx,[cfg_tail] ; now lets see if we filled the buffer 0 00007A37 81FB0020 cmp bx,CONFIG_BUF_SIZE ; if not its EOF so mark it as such 0 00007A3B 7417 je getchar50 0 00007A3D 1E push ds 0 00007A3E 8E1E[0000] mov ds,[init_dseg] 0 00007A42 C6071A mov byte [CONFIG_BUF + bx],EOF ; add an EOF mark 0 00007A45 1F pop ds ; in case there isn't one already 0 00007A46 FF06[8900] inc word [cfg_tail] 0 00007A4A FF06[8300] inc word [cfg_seeklo] 0 00007A4E 7504 jnz getchar50 0 00007A50 FF06[8500] inc word [cfg_seekhi] 3327 getchar50: 0 00007A54 1E push ds 0 00007A55 8E1E[0000] mov ds,[init_dseg] 0 00007A59 A00000 mov al,[CONFIG_BUF] ; return 1st char from buffer 0 00007A5C 1F pop ds 0 00007A5D C706[8700]0100 mov word [cfg_head],1 ; remember we have returned char 0 00007A63 5A pop dx 0 00007A64 59 pop cx 0 00007A65 C3 ret 3336 3337 3338 ; 3339 ; On a DEVICEHIGH we have encountered a line 3340 ; /L:r1[,s1][;r2[,s2]]... [/S] 3341 ; where r1 = load region, s1 = hex size in bytes, r2,s2 etc are further regions 3342 ; currently only r1/s1 are supported 3343 ; /S says the regions should m#be minimised 3344 3345 parse_region: 3346 ;On Entry: 3347 ; DS:SI -> command line following '/L:' 3348 ; On Exit: 3349 ; DS:SI -> 1st non-parsed character 3350 ; CY set on error 3351 ; 0 00007A66 E8B2FE call atoi ; get a region to load in 0 00007A69 7249 jc parse_region40 0 00007A6B A3[E505] mov [himem_region],ax ; remember region to try 0 00007A6E E8[0000] call whitespace ; scan off all white space 0 00007A71 AC lodsb 0 00007A72 4E dec si ; now see is we have an optional size 0 00007A73 3C2C cmp al,',' ; have we a ',' character ? 0 00007A75 B80000 mov ax,0 ; assume minimum size not supplied 0 00007A78 7538 jne parse_region30 0 00007A7A 46 inc si 0 00007A7B E8CEFE call atol ; read number into DX:AX 0 00007A7E 83FA0F cmp dx,15 ; is number too big ? 0 00007A81 7731 ja parse_region40 0 00007A83 B91000 mov cx,16 ; convert to para's 0 00007A86 F7F1 div cx 0 00007A88 40 inc ax ; allow for round up 0 00007A89 40 inc ax ; and for header 0 00007A8A 50 push ax ; save size of region 3370 parse_region10: 0 00007A8B BF[CE05] mov di,offset slashs_opt ; do we have a "/S" to minimise 0 00007A8E E86CFD call compare ; the UMB's (ignore it if so) 0 00007A91 731E jnc parse_region20 0 00007A93 E8[0000] call whitespace ; scan off all white space 0 00007A96 AC lodsb 0 00007A97 4E dec si ; strip off other regions 0 00007A98 3C3B cmp al,';' ; another region follows ';' 0 00007A9A 7515 jne parse_region20 0 00007A9C 46 inc si 0 00007A9D E87BFE call atoi ; eat the region number 0 00007AA0 720F jc parse_region20 0 00007AA2 E8[0000] call whitespace ; scan off all white space 0 00007AA5 AC lodsb 0 00007AA6 4E dec si 0 00007AA7 3C2C cmp al,',' ; is a size specified ? 0 00007AA9 75E0 jne parse_region10 ; no, check for another region 0 00007AAB 46 inc si 0 00007AAC E89DFE call atol ; eat the size 0 00007AAF 73DA jnc parse_region10 3390 parse_region20: 0 00007AB1 58 pop ax 3392 parse_region30: 0 00007AB2 F8 clc ; we can proceed 0 00007AB3 C3 ret 3395 3396 parse_region40: 0 00007AB4 C706[E705]FFFF mov word [himem_size],0FFFFh ; 1 MByte wanted (ho, ho) 0 00007ABA F9 stc ; we had problems.. 0 00007ABB C3 ret 3400 3401 ; On a DEVICEHIGH we may encounter a line 3402 ; SIZE [=] s 3403 ; where s = size of region in hex bytes 3404 3405 parse_size: 3406 ;On Entry: 3407 ; DS:SI -> command line following '/L:' 3408 ; On Exit: 3409 ; DS:SI -> 1st non-parsed character 3410 ; CY set on error 3411 ; 0 00007ABC E8[0000] call whitespace ; Scan off all white space 0 00007ABF AC lodsb ; before and after the optional 0 00007AC0 3C3D cmp al,'=' ; '=' character. 0 00007AC2 74F8 je parse_size 0 00007AC4 4E dec si 0 00007AC5 E80BFE call atohex ; read hex number into DX:AX 0 00007AC8 720F jc parse_size10 0 00007ACA 83FA0F cmp dx,15 ; is number too big ? 0 00007ACD 770C ja parse_size20 ; just load low 0 00007ACF B91000 mov cx,16 ; convert to para's 0 00007AD2 F7F1 div cx 0 00007AD4 40 inc ax ; allow for round up 0 00007AD5 40 inc ax ; and for header 0 00007AD6 A3[E705] mov [himem_size],ax ; remember size required 3426 parse_size10: 0 00007AD9 F8 clc 0 00007ADA C3 ret 3429 3430 parse_size20: 0 00007ADB C706[E705]FFFF mov word [himem_size],0FFFFh ; 1 MByte wanted (ho, ho) 0 00007AE1 F9 stc 0 00007AE2 C3 ret 3434 3435 3436 ; A size has not been suppleied with DEVICEHIGH, so guess-timate one 3437 ; based on file size 3438 3439 size_file: 3440 ; On Entry: 3441 ; DS:SI -> filename 3442 ; On Exit: 3443 ; DS:SI preserved 3444 ; 0 00007AE3 56 push si 0 00007AE4 BF[0000] mov di,offset dev_name ; copy the device filename into a 0 00007AE7 C60500 mov byte ptr [di],0 ; local buffer and zero terminate 0 00007AEA E84401 call copy_file 0 00007AED 5E pop si 0 00007AEE B8003D mov ax,(MS_X_OPEN * 256)+0 ; open file r/o 0 00007AF1 BA[0000] mov dx,offset dev_name 0 00007AF4 CD21 int DOS_INT 0 00007AF6 7304 jnc size_file10 0 00007AF8 B8FFFF mov ax,0FFFFh ; can't open file, force low to prevent 0 00007AFB C3 ret ; two sets of error messages 3456 3457 size_file10: 0 00007AFC 93 xchg ax,bx ; handle in BX 0 00007AFD B43F mov ah,MS_X_READ 0 00007AFF B91C00 mov cx,EXE_LENGTH 0 00007B02 BA[0001] mov dx,offset exeBuffer 0 00007B05 CD21 int DOS_INT ; read in possible exe header 0 00007B07 722C jc size_file20 0 00007B09 39C8 cmp ax,cx ; did we read all we wanted ? 0 00007B0B 7232 jb size_file40 ; if not it can't be an EXE 0 00007B0D 813E[0001]4D5A cmp word [exeSignature],'MZ' ; check the signature ; NASM port swapped text literals 0 00007B13 752A jne size_file40 ; if invalid can't be an EXE 0 00007B15 B80002 mov ax,512 0 00007B18 F726[0401] mul word [exeSize] ; DX/AX bytes in image 0 00007B1C 0306[0201] add ax,[exeFinal] 0 00007B20 83D200 adc dx,0 0 00007B23 B91000 mov cx,16 0 00007B26 39CA cmp dx,cx ; are we too big ? 0 00007B28 730B jae size_file20 ; yes, force low 0 00007B2A F7F1 div cx ; AX = para's required 0 00007B2C 40 inc ax ; one for rounding error 0 00007B2D 7406 jz size_file20 0 00007B2F 0306[0A01] add ax,[exeMinpara] ; add on extra para's required 0 00007B33 7303 jnc size_file30 3480 size_file20: 0 00007B35 B8FFFF mov ax,0FFFFh ; problems, force a load low 3482 size_file30: 0 00007B38 50 push ax ; save para's required 0 00007B39 B43E mov ah,MS_X_CLOSE ; close this file 0 00007B3B CD21 int DOS_INT 0 00007B3D 58 pop ax ; AX para's required 0 00007B3E C3 ret 3488 3489 size_file40: 0 00007B3F B80242 mov ax,(MS_X_LSEEK * 256)+2 0 00007B42 31C9 xor cx,cx ; now find out how big the file is 0 00007B44 31D2 xor dx,dx ; by seeking to zero bytes from end 0 00007B46 CD21 int DOS_INT 0 00007B48 72EB jc size_file20 0 00007B4A B91000 mov cx,16 0 00007B4D 39CA cmp dx,cx ; are we too big ? 0 00007B4F 73E4 jae size_file20 ; yes, force low 0 00007B51 F7F1 div cx ; AX = para's required 0 00007B53 40 inc ax ; one for rounding error 0 00007B54 EBE2 jmp short size_file30 3501 3502 himem_setup: 3503 ; On Entry: 3504 ; AX = minimum amount of upper memory required (in para's) 3505 ; On Exit: 3506 ; CY clear if able to satisfy request 3507 ; CY set on error (we then load low) 3508 ; 3509 ; try and find some hi memory 3510 ; we allocate the biggest available chunk of upper memory 3511 ; 0 00007B56 06 push es 0 00007B57 89C1 mov cx,ax ; CX = para's required 0 00007B59 A1[0000] mov ax,[mem_current_base] 0 00007B5C A3[EB05] mov [himem_current_base],ax ; save mem_current_base 0 00007B5F A1[0000] mov ax,[mem_current] 0 00007B62 A3[E905] mov [himem_current],ax ; save mem_current 0 00007B65 A1[0000] mov ax,[mem_max] 0 00007B68 A3[ED05] mov [himem_max],ax ; save mem_max 0 00007B6B B448 mov ah,MS_M_ALLOC 0 00007B6D BBFFFF mov bx,0FFFFh ; give me all memory (please) 0 00007B70 CD21 int 21h ; bx = No. of paras available 0 00007B72 39CB cmp bx,cx ; do we have enough ? 0 00007B74 7264 jc himem_setup40 ; no, give up now 3525 0 00007B76 833E[E505]00 cmp word [himem_region],0 ; is there a region specified ? 0 00007B7B 7443 je himem_setup20 ; no, allocate largest block 3528 3529 ; Allocate the region specified by /L: 0 00007B7D C41E[0000] les bx,[func52_ptr] ; ES:BX -> list of lists 0 00007B81 268B4766 mov ax,[es:F52_DMD_UPPER + bx] ; get upper memory link 0 00007B85 83F8FF cmp ax,0FFFFh ; make sure there is one 0 00007B88 7436 je himem_setup20 ; shouldn't happen.... 0 00007B8A 8EC0 mov es,ax 3535 himem_setup10: 0 00007B8C 26803E00004D cmp byte [es:DMD_ID],'M' ; is there another block ? 0 00007B92 F9 stc ; if we run out of blocks then 0 00007B93 7545 jne himem_setup40 ; we load low 0 00007B95 8EC0 mov es,ax ; ES -> DMD 0 00007B97 268B1E0300 mov bx,[es:DMD_LEN] ; get length in para'a 0 00007B9C 40 inc ax 0 00007B9D 01D8 add ax,bx ; AX -> next DMD 0 00007B9F 26833E010000 cmp word [es:DMD_PSP],0 ; is it free ? 0 00007BA5 75E5 jne himem_setup10 ; no, try the next 0 00007BA7 FF0E[E505] dec word [himem_region] ; found the right region yet ? 0 00007BAB 75DF jnz himem_setup10 0 00007BAD 39CB cmp bx,cx ; do we have enough ? 0 00007BAF 7229 jc himem_setup40 ; no, go low 0 00007BB1 8CC0 mov ax,es ; ES -> DMD header to allocate 0 00007BB3 40 inc ax 0 00007BB4 8EC0 mov es,ax ; ES -> data in block 0 00007BB6 B44A mov ah, MS_M_SETBLOCK 0 00007BB8 CD21 int 21h ; "allocate" this block 0 00007BBA 8CC0 mov ax,es 0 00007BBC 730F jnc himem_setup30 ; this can only fail if DMD chain 0 00007BBE EB1A jmp short himem_setup40 ; is corrupt... 3557 3558 himem_setup20: 3559 ; allocate the largest block available for DEVICEHIGH 0 00007BC0 B448 mov ah, MS_M_ALLOC 0 00007BC2 BBFFFF mov bx, 0FFFFh ; give me all memory (please) 0 00007BC5 CD21 int 21h ; bx = No. of paras available 0 00007BC7 B448 mov ah, MS_M_ALLOC ; give me bx paras please 0 00007BC9 CD21 int 21h ; ax:0 -> my memory 0 00007BCB 720D jc himem_setup40 ; woops, what happened ? 3566 himem_setup30: 0 00007BCD A3[0000] mov [mem_current_base],ax 0 00007BD0 A3[0000] mov [mem_current],ax ; save base of himem area 0 00007BD3 A3[0000] mov [mem_max],ax 0 00007BD6 011E[0000] add [mem_max],bx ; top of himem area 3571 himem_setup40: 0 00007BDA 07 pop es 0 00007BDB C3 ret 3574 3575 himem_cleanup: 3576 ; clean up our high memory - this hook should free up any difference 3577 ; between himem_current and himem_max 0 00007BDC A1[ED05] mov ax,[himem_max] 0 00007BDF A3[0000] mov [mem_max],ax ; restore mem_max 0 00007BE2 A1[EB05] mov ax,[himem_current_base] 0 00007BE5 8706[0000] xchg [mem_current_base],ax ; restore mem_current_base 0 00007BE9 8B1E[E905] mov bx,[himem_current] 0 00007BED 871E[0000] xchg [mem_current],bx ; restore mem_current 0 00007BF1 06 push es 0 00007BF2 8EC0 mov es,ax ; ES -> memory block 0 00007BF4 29C3 sub bx,ax ; has any memory been used ? 0 00007BF6 7406 jz himem_cleanup10 0 00007BF8 B44A mov ah,MS_M_SETBLOCK ; try and shrink the block 0 00007BFA CD21 int DOS_INT ; to the size we used 0 00007BFC 07 pop es 3591 ; clc ; return success 0 00007BFD C3 ret 3593 3594 himem_cleanup10: 0 00007BFE B449 mov ah,MS_M_FREE ; free it all up 0 00007C00 CD21 int DOS_INT 0 00007C02 07 pop es 0 00007C03 F9 stc ; return an error 0 00007C04 C3 ret 3600 3601 copy_asciiz: 3602 ;----------- 0 00007C05 AC lodsb ; get a character 0 00007C06 AA stosb ; copy it 0 00007C07 84C0 test al,al ; is it the terminating NUL ? 0 00007C09 75FA jnz copy_asciiz ; do next char 0 00007C0B C3 ret 3608 3609 wait_for_key: 3610 ;------------ 3611 ; On Entry: 3612 ; None 3613 ; On Exit: 3614 ; CY set if no key pressed within timeout 3615 ; 0 00007C0C 8B0E[F105] mov cx,[keyb_timeout] ; get timeout value 0 00007C10 F8 clc ; assume no timeout 0 00007C11 E31D jcxz wait_for_key30 3619 wait_for_key10: 0 00007C13 51 push cx 0 00007C14 B42C mov ah,MS_T_GETTIME ; get current time 0 00007C16 CD21 int DOS_INT ; so we can do timeout 0 00007C18 89D3 mov bx,dx ; save secs in BH 0 00007C1A 59 pop cx 3625 wait_for_key20: 0 00007C1B B40B mov ah,MS_C_STAT ; is a character ready ? 0 00007C1D CD21 int DOS_INT ; if so process it 0 00007C1F 84C0 test al,al ; do we have a character ? 0 00007C21 750D jnz wait_for_key30 0 00007C23 51 push cx 0 00007C24 B42C mov ah,MS_T_GETTIME ; get current time 0 00007C26 CD21 int DOS_INT ; so we can do timeout 0 00007C28 59 pop cx 0 00007C29 38F7 cmp bh,dh ; have we timed out ? 0 00007C2B 74EE je wait_for_key20 0 00007C2D E2E4 loop wait_for_key10 ; another second gone by 0 00007C2F F9 stc ; we have timed out 3638 wait_for_key30: 0 00007C30 C3 ret 3640 3641 ; 3642 ; COPY_FILE copies the next parameter from DS:SI into the buffer 3643 ; at ES:DI and terminates with a NULL character. The parameter is 3644 ; expected to be a FileName. DS:SI are returned pointing to the 3645 ; next parameter in the command. 3646 ; 3647 copy_file: 0 00007C31 E8[0000] call whitespace ; DeBlank the Command Line 0 00007C34 B95000 mov cx,MAX_FILELEN ; Limit FileName Length 0 00007C37 56 push si ; Save SI in case of error 3651 copy_f10: 0 00007C38 AC lodsb ; Copy upto the first Space or 0 00007C39 3C20 cmp al,' ' ; Control Character 0 00007C3B 7611 jbe copy_f20 0 00007C3D 3C2C cmp al,',' ; stop at ',' too 0 00007C3F 740D je copy_f20 0 00007C41 3C2F cmp al,'/' ; Also stop scanning when a switch 0 00007C43 7409 je copy_f20 ; character is detected 0 00007C45 AA stosb 0 00007C46 E2F0 loop copy_f10 0 00007C48 5E pop si ; Restore the original SI 0 00007C49 B80D00 mov ax,13 ; 13 = invalid data error 0 00007C4C F9 stc ; and return with an error 0 00007C4D C3 ret 3665 3666 copy_f20: 0 00007C4E 58 pop ax ; Remove Original String address 0 00007C4F 4E dec si ; Point at the failing character 0 00007C50 31C0 xor ax,ax 0 00007C52 AA stosb ; Zero Terminate FileName 0 00007C53 C3 ret 3672 3673 INITCODE ends 3674 3675 === Switch to base=000000h -> "INITDATA" 3676 section INITDATA public align=2 class=INITDATA 3677 3678 %if ADDDRV 3679 extrn err_no_command_file:byte 3680 extrn err_block_device:byte 3681 %else 3682 extrn shell:byte ; Default Command Processor 3683 extrn shell_cline:byte ; Default Command Line 3684 %endif 3685 extrn dev_epb:byte 3686 extrn dev_count:byte 3687 extrn rel_unit:word 3688 3689 extrn dos_target_seg:word 3690 extrn bios_target_seg:word 3691 extrn mem_current_base:word ; Current Base Address 3692 extrn mem_current:word ; Current Load Address 3693 extrn mem_max:word ; Top of Available Memory 3694 extrn mem_size:word ; Real top of Memory 3695 3696 extrn init_dseg:word ; Current Init Data Segment 3697 extrn res_ddsc_seg:word 3698 3699 %include "initmsgs.mac" ; Include TFT Header File 1 <1> extrn _bad_break : byte 2 <1> extrn bad_break : byte 3 <1> extrn _bad_buffers : byte 4 <1> extrn bad_buffers : byte 5 <1> extrn _bad_command : byte 6 <1> extrn bad_command : byte 7 <1> extrn _bad_country : byte 8 <1> extrn bad_country : byte 9 <1> extrn _bad_drivparm : byte 10 <1> extrn bad_drivparm : byte 11 <1> extrn _bad_exec : byte 12 <1> extrn bad_exec : byte 13 <1> extrn _bad_fcbs : byte 14 <1> extrn bad_fcbs : byte 15 <1> extrn _bad_filename : byte 16 <1> extrn bad_filename : byte 17 <1> extrn _bad_files : byte 18 <1> extrn bad_files : byte 19 <1> extrn _bad_fopen : byte 20 <1> extrn bad_fopen : byte 21 <1> extrn _bad_history : byte 22 <1> extrn bad_history : byte 23 <1> extrn _bad_lastdrive : byte 24 <1> extrn bad_lastdrive : byte 25 <1> extrn _bad_shell : byte 26 <1> extrn bad_shell : byte 27 <1> extrn _bootpart_not_found_msg : byte 28 <1> extrn bootpart_not_found_msg : byte 29 <1> extrn _dos_msg : byte 30 <1> extrn dos_msg : byte 31 <1> extrn _no_char : byte 32 <1> extrn no_char : byte 33 <1> extrn _yes_char : byte 34 <1> extrn yes_char : byte 35 <1> extrn _run_char : byte 36 <1> extrn run_char : byte 37 <1> extrn _f5key_msg : byte 38 <1> extrn f5key_msg : byte 39 <1> extrn _f8key_msg : byte 40 <1> extrn f8key_msg : byte 3700 3701 3702 ; extrn bad_command:byte 3703 ; extrn bad_filename:byte 3704 3705 %ifn ADDDRV 3706 ; extrn bad_shell:byte 3707 ; extrn bad_country:byte 3708 ; extrn bad_lastdrive:byte 3709 ; extrn bad_break:byte 3710 ; extrn bad_buffers:byte 3711 ; extrn bad_files:byte 3712 ; extrn bad_fcbs:byte 3713 ; extrn bad_fopen:byte 3714 ; extrn bad_drivparm:byte 3715 ; extrn bad_history:byte 3716 %endif 3717 3718 ; extrn yes_char:byte ; In BIOSMSGS.ASM 3719 ; extrn no_char:byte 3720 3721 extrn dev_load_seg:word 3722 extrn dev_reloc_seg:word 3723 extrn dev_epb:byte 3724 extrn dev_name:byte 3725 extrn dev_name:byte 3726 extrn dosVersion:word 3727 extrn strategy_off:word 3728 extrn strategy_seg:word 3729 extrn interrupt_off:word 3730 extrn interrupt_seg:word 3731 extrn request_hdr:byte 3732 extrn next_drv:byte 3733 extrn strategy_seg:word 3734 extrn strategy_far:dword 3735 extrn interrupt_far:dword 3736 extrn func52_ptr:dword 3737 extrn strategy_seg:word 3738 extrn condev_off:word 3739 extrn condev_seg:word 3740 extrn clkdev_off:word 3741 extrn clkdev_seg:word 3742 extrn num_blkdev:byte 3743 extrn blkdev_table:byte 3744 extrn last_drv:byte 3745 extrn next_drv:byte 3746 extrn max_secsize:word 3747 extrn max_clsize:word 3748 extrn country_code:word 3749 extrn code_page:word 3750 extrn drdos_ptr:dword 3751 extrn init_buf:byte 3752 extrn num_read_ahead_buf:byte 3753 extrn buffersIn:byte 3754 extrn num_files:word 3755 extrn num_fcbs:word 3756 extrn num_fopen:word 3757 extrn history_flg:byte ; In INIT code 3758 extrn history_size:word ; 3759 extrn num_stacks:word 3760 extrn stack_size:word 3761 extrn filesIn:byte 3762 extrn stacksIn:byte 3763 extrn lastdrvIn:byte 3764 extrn hidosdata:byte 3765 extrn hiddscs:byte 3766 extrn hixbda:byte 3767 extrn configpass:byte 3768 3769 %ifn ADDDRV 3770 extrn hidos:byte 3771 extrn bios_seg:word 3772 extrn DeblockSetByUser:Byte 3773 extrn DeblockSeg:word ; In BIOS data 3774 %endif 3775 3776 extrn dbcs_tbl:dword 3777 extrn ctry_info:byte 3778 extrn dos_dseg:word 3779 3780 3781 Public cfg_file, cfg_file_end 3782 3783 preload_entry label dword ; preload back door entry 0 00008E12 1400 dw 14h ; offset is pre-initialised to 14h 0 00008E14 0000 preload_seg dw 0 3786 0 00008E16 0A00 preload_ver dw 10 ; version to give DBLSPACE 3788 3789 Public preload_drv 0 00008E18 00 preload_drv db 0 ; number of preload drives 0 00008E19 00 alt_drive db 0 ; preload checks alternative drive, 3792 ; (only used loading from A:) 3793 3794 ; The preload_file is used as is to open a preload device 3795 ; It is also used to initialise a "DMD" name, and the code to do this 3796 ; currently finds the "\" and then copies the next 8 characters. 3797 ; This works with the current names - any new names may require modifications 3798 0 00008E1A [0A00] preload_file dw offset security_file ; initially '\SECURITY.BIN' 0 00008E1C 5C5345435552495459 security_file db '\SECURITY.BIN',0 0 00008E25 2E42494E00 0 00008E2A 433A5C535441434B45 stacker_file db 'C:\STACKER.BIN',0 0 00008E33 522E42494E00 0 00008E39 433A5C44424C535041 dblspace_file db 'C:\DBLSPACE.BIN',0 0 00008E42 43452E42494E00 3803 0 00008E49 44434F4E4649472E53 cfg_file db 'DCONFIG.SYS',0 ; Configuration File 0 00008E52 595300 0 00008E55 000000000000000000 db 64 dup (0) ; space for bigger CHAIN'd file 0 00008E5E 000000000000000000 0 00008E67 000000000000000000 0 00008E70 000000000000000000 0 00008E79 000000000000000000 0 00008E82 000000000000000000 0 00008E8B 000000000000000000 0 00008E94 00 3806 cfg_file_end label byte 3807 3808 Public cfg_seeklo,cfg_seekhi 0 00008E95 0000 cfg_seeklo dw 0 ; offset we have reached in CONFIG file 0 00008E97 0000 cfg_seekhi dw 0 ; in case Richards CONFIG file > 64k 3811 3812 Public cfg_head,cfg_tail 0 00008E99 0000 cfg_head dw 0 ; offset we are at in CONFIG_BUF 0 00008E9B 0000 cfg_tail dw 0 ; # bytes currently in CONFIG_BUF 3815 0 00008E9D 0000 cfg_switchnum dw 0 ; number of SWITCH decisions stored 0 00008E9F 000000000000000000 cfg_switchbuf db 5*SWITCH_MAX dup (0) ; buffer for config lines/key presses 0 00008EA8 000000000000000000 0 00008EB1 000000000000000000 0 00008EBA 000000000000000000 0 00008EC3 000000000000000000 0 00008ECC 0000000000 3818 0 00008ED1 000000000000000000 cfg_buffer db CFG_BUF_LEN dup (0) ; individual lines live here 0 00008EDA 000000000000000000 0 00008EE3 000000000000000000 0 00008EEC 000000000000000000 0 00008EF5 000000000000000000 0 00008EFE 000000000000000000 0 00008F07 000000000000000000 0 00008F10 000000000000000000 0 00008F19 000000000000000000 0 00008F22 000000000000000000 0 00008F2B 000000000000000000 0 00008F34 000000000000000000 0 00008F3D 000000000000000000 0 00008F46 000000000000000000 0 00008F4F 000000000000000000 0 00008F58 000000000000000000 0 00008F61 000000000000000000 0 00008F6A 000000000000000000 0 00008F73 000000000000000000 0 00008F7C 000000000000000000 0 00008F85 000000000000000000 0 00008F8E 000000000000000000 0 00008F97 000000000000000000 0 00008FA0 000000000000000000 0 00008FA9 000000000000000000 0 00008FB2 000000000000000000 0 00008FBB 000000000000000000 0 00008FC4 000000000000000000 0 00008FCD 00000000 3820 3821 ; 3822 ; EXEC parameter blocks for INSTALL function 3823 ; 0 00008FD1 0000 exec_envseg dw 0 ; Environment Segment 0 00008FD3 0000 exec_lineoff dw 0 ; Command Line Offset 0 00008FD5 0000 exec_lineseg dw 0 ; Command Line Segment 0 00008FD7 0000 exec_fcb1off dw 0 ; Offset of FCB 1 (5Ch) 0 00008FD9 0000 exec_fcb1seg dw 0 ; Segment of FCB 1 (5Ch) 0 00008FDB 0000 exec_fcb2off dw 0 ; Offset of FCB 2 (6Ch) 0 00008FDD 0000 exec_fcb2seg dw 0 ; Segment of FCB 2 (6Ch) 0 00008FDF 0000000000000000 dd 2 dup (0) ; Initial SS:SP & CS:IP 3832 0 00008FE7 0000 system_sp dw 0 0 00008FE9 0000 system_ss dw 0 3835 3836 ioctl_pb label byte 0 00008FEB 00 ioctl_func db 0 ; special functions 0 00008FEC 00 ioctl_type db 0 ; device type (form factor) 0 00008FED 0000 ioctl_attrib dw 0 ; device attributes 0 00008FEF 0000 ioctl_tracks dw 0 ; # of tracks 0 00008FF1 00 ioctl_mtype db 0 ; media type, usually zero 0 00008FF2 000000000000000000 ioctl_bpb db 31 dup (0) ; default BPB for this type of disk 0 00008FFB 000000000000000000 0 00009004 000000000000000000 0 0000900D 00000000 0 00009011 000000000000000000 ioctl_layout dw 1+64 dup (0) ; support 64 sectors/track max. 0 0000901A 000000000000000000 0 00009023 000000000000000000 0 0000902C 000000000000000000 0 00009035 000000000000000000 0 0000903E 000000000000000000 0 00009047 000000000000000000 0 00009050 000000000000000000 0 00009059 000000000000000000 0 00009062 000000000000000000 0 0000906B 000000000000000000 0 00009074 000000000000000000 0 0000907D 000000000000000000 0 00009086 000000000000000000 0 0000908F 00000000 3844 0 00009093 00 drivp_drv db 0 ; drive 0-15 0 00009094 00 drivp_chg db 0 ; change line support 0 00009095 00 drivp_prm db 0 ; permanent media flag 0 00009096 00 drivp_ff db 0 ; form factor 0 00009097 5000 drivp_trk dw 80 3850 0 00009099 [9702][A802][B902] ff_table dw bpb360, bpb1200, bpb720 ; 360/1200/720 Kb 0 0000909F [DB02][A802] dw bpb243, bpb1200 ; 8" sd/dd 0 000090A3 [9702][9702] dw bpb360, bpb360 ; hard disk, tape 0 000090A7 [CA02] dw bpb1440 ; 1440 Kb 3855 0 000090A9 0002 bpb360 dw 512 0 000090AB 02 db 2 0 000090AC 0100 dw 1 0 000090AE 02 db 2 0 000090AF 7000 dw 112 0 000090B1 D002 dw 40*2*9 0 000090B3 FD db 0FDh 0 000090B4 0200 dw 2 0 000090B6 0900 dw 9 0 000090B8 0200 dw 2 3866 0 000090BA 0002 bpb1200 dw 512 0 000090BC 01 db 1 0 000090BD 0100 dw 1 0 000090BF 02 db 2 0 000090C0 E000 dw 224 0 000090C2 6009 dw 80*2*15 0 000090C4 F9 db 0F9h 0 000090C5 0700 dw 7 0 000090C7 0F00 dw 15 0 000090C9 0200 dw 2 3877 0 000090CB 0002 bpb720 dw 512 ; bytes per sector 0 000090CD 02 db 2 ; sectors/cluster 0 000090CE 0100 dw 1 ; FAT address 0 000090D0 02 db 2 ; # of FAT copies 0 000090D1 7000 dw 112 ; root directory size 0 000090D3 A005 dw 80*2*9 ; sectors/disk 0 000090D5 F9 db 0F9h ; media byte 0 000090D6 0300 dw 3 ; size of single FAT copy 0 000090D8 0900 dw 9 ; sectors per track 0 000090DA 0200 dw 2 ; # of heads 3888 0 000090DC 0002 bpb1440 dw 512 0 000090DE 01 db 1 0 000090DF 0100 dw 1 0 000090E1 02 db 2 0 000090E2 E000 dw 224 0 000090E4 400B dw 80*2*18 0 000090E6 F9 db 0F9h 0 000090E7 0700 dw 7 0 000090E9 1200 dw 18 0 000090EB 0200 dw 2 3899 0 000090ED 8000 bpb243 dw 128 0 000090EF 04 db 4 0 000090F0 0100 dw 1 0 000090F2 02 db 2 0 000090F3 4000 dw 64 0 000090F5 D207 dw 77*1*26 0 000090F7 E5 db 0E5h 0 000090F8 0100 dw 1 0 000090FA 1A00 dw 26 0 000090FC 0100 dw 1 3910 0 000090FE 0D0A msg_crlf db CR, LF 0 00009100 24 msg_dollar db '$' 3913 3914 cfg_table label word 3915 %ifn ADDDRV 0 00009101 [4D04][0C05]0100 dw cmd_country, func_country, 1 ; COUNTRY=nnn,nnn,country 0 00009107 [5504][6205]0100 dw cmd_shellhigh, func_shell, 1 ; SHELLHIGH=filename (SHELL alias FreeDOS compatibility) 0 0000910D [5F04][6205]0100 dw cmd_shell, func_shell, 1 ; SHELL=filename 0 00009113 [6504][8705]0100 dw cmd_lastdrivehigh,func_hilastdrive,1 ; LASTDRIVEHIGH=d: 0 00009119 [7504][8C05]0100 dw cmd_lastdrive, func_lastdrive, 1 ; LASTDRIVE=d: 0 0000911F [7304][8705]0100 dw cmd_hilastdrive,func_hilastdrive,1 ; HILASTDRIVE=d: 0 00009125 [7F04][AF05]0100 dw cmd_break, func_break, 1 ; BREAK=ON/OFF 0 0000912B [8504][E205]0100 dw cmd_buffershigh,func_hibuffers, 1 ; BUFFERSHIGH=nn 0 00009131 [9304][E705]0100 dw cmd_buffers, func_buffers, 1 ; BUFFERS=nn 0 00009137 [9104][E205]0100 dw cmd_hibuffers, func_hibuffers, 1 ; HIBUFFERS=nn 0 0000913D [9D04][4A06]0100 dw cmd_fcbs, func_fcbs, 1 ; FCBS=nn 0 00009143 [9B04][4506]0100 dw cmd_hifcbs, func_hifcbs, 1 ; HIFCBS=nn 0 00009149 [A204][1F06]0100 dw cmd_fileshigh, func_hifiles, 1 ; FILESHIGH=nn 0 0000914F [AE04][2406]0100 dw cmd_files, func_files, 1 ; FILES=nn 0 00009155 [AC04][1F06]0100 dw cmd_hifiles, func_hifiles, 1 ; HIFILES=nn 0 0000915B [B604][9506]0100 dw cmd_stacks, func_stacks, 1 ; STACKS=nn 0 00009161 [B404][9006]0100 dw cmd_histacks, func_histacks, 1 ; HISTACKS=nn 0 00009167 [BD04][DB06]0100 dw cmd_fastopen, func_fastopen, 1 ; FASTOPEN=nnn 0 0000916D [C604][0007]0100 dw cmd_drivparm, func_drivparm, 1 ; DRIVPARM=/d:nn ... 0 00009173 [CF04][6E08]0100 dw cmd_history, func_history, 1 ; HISTORY=ON|OFF,NNN 0 00009179 [E104][DA08]0300 dw cmd_hiinstalllast,func_hiinstall,CF_LAST; HIINSTALLLAST=cmdstring 0 0000917F [D704][DA08]0100 dw cmd_hiinstall, func_hiinstall, 1 ; HIINSTALL=cmdstring 0 00009185 [EF04][DA08]0100 dw cmd_installhigh, func_hiinstall, 1 ; INSTALLHIGH=cmdstring 0 0000918B [E304][0709]0300 dw cmd_installlast,func_install, CF_LAST ; INSTALLLAST=cmdstring 0 00009191 [D904][0709]0100 dw cmd_install, func_install, 1 ; INSTALL=cmdstring 0 00009197 [0E05][C509]0100 dw cmd_hidos, func_hidos, 1 ; HIDOS=ON/OFF 0 0000919D [FB04][CE09]0100 dw cmd_dosdata, func_dosdata, 1 ; DOSDATA=UMB 0 000091A3 [0305][F009]0100 dw cmd_ddscs, func_ddscs, 1 ; DDSCS=HIGH,UMB 0 000091A9 [0905][270A]0100 dw cmd_xbda, func_xbda, 1 ; XBDA=LOW,UMB 0 000091AF [1005][4C0A]0100 dw cmd_dos, func_dos, 1 ; DOS=HIGH 0 000091B5 [1405][710C]1100 dw cmd_set, func_set, 1+CF_LC ; SET envar=string 0 000091BB [1805][6C06]0800 dw cmd_switches, func_switches, CF_NOF ; SWITCHES=... 3948 %endif 0 000091C1 [2C05][5B03]0100 dw cmd_hidevice, func_hidevice, 1 ; HIDEVICE=filename 0 000091C7 [2105][5B03]0100 dw cmd_devicehigh, func_hidevice, 1 ; DEVICEHIGH=filename 0 000091CD [2E05][B403]0100 dw cmd_device, func_device, 1 ; DEVICE=filename 0 000091D3 [3505][6B06]0900 dw cmd_remark, func_remark, 1+CF_NOF; REM Comment 0 000091D9 [3905][6B06]0900 dw cmd_semicolon, func_remark, 1+CF_NOF; ; Comment 0 000091DF [3B05][6B06]0900 dw cmd_colon, func_remark, 1+CF_NOF; :label 0 000091E5 [3D05][B90C]4000 dw cmd_chain, func_chain, CF_ALL ; CHAIN=filename 0 000091EB [4305][D90D]4000 dw cmd_goto, func_goto, CF_ALL ; GOTO=label 0 000091F1 [4805][960D]4000 dw cmd_gosub, func_gosub, CF_ALL ; GOSUB=label 0 000091F7 [4E05][B60D]4000 dw cmd_return, func_return, CF_ALL ; RETURN (from GOSUB) 0 000091FD [5505][1C0E]0100 dw cmd_cls, func_cls, 1 ; Clear Screen 0 00009203 [5905][250E]0100 dw cmd_cpos, func_cpos, 1 ; Set Cursor Position 0 00009209 [5E05][4A0E]0100 dw cmd_colour, func_colour, 1 ; Set Fore-/Background/Border Colour 0 0000920F [6505][F80E]0100 dw cmd_timeout, func_timeout, 1 ; set ? TIMEOUT 0 00009215 [6D05][F00C]4100 dw cmd_switch, func_switch, 1+CF_ALL; SWITCH=n 0 0000921B [8005][2E0F]5100 dw cmd_onerror, func_onerror, 1+CF_ALL+CF_LC; ONERROR='n' optional command 0 00009221 [7405][870F]5800 dw cmd_query, func_query, CF_ALL+CF_NOF+CF_LC; ?optional command 0 00009227 [7605][970C]1100 dw cmd_echo, func_echo, 1+CF_LC ; ECHO=string 0 0000922D [7B05][160E]4000 dw cmd_exit, func_exit, CF_ALL ; EXIT 0 00009233 [8205][250F]4100 dw cmd_error, func_error, 1+CF_ALL; ERROR='n' 0 00009239 [8805][5910]0100 dw cmd_getkey, func_getkey, 1 ; GETKEY 0 0000923F [8F05][A80C]0100 dw cmd_yeschar, func_yeschar, 1 ; YESCHAR= 0 00009245 [9705][C306]0100 dw cmd_deblock, func_deblock, 1 ; DEBLOCK=xxxx 0 0000924B [9F05][C505]0100 dw cmd_numlock, func_numlock, 1 ; NUMLOCK=ON/OFF 0 00009251 [A705][6B10]0100 dw cmd_version, func_version, 1 ; VERSION=x.xx 0 00009257 [AF05][6B06]0100 dw cmd_common, func_common, 1 ; [COMMON] 0 0000925D 0000 dw 0 ; end of table 3976 3977 %ifn ADDDRV 0 0000925F 434F554E54525900 cmd_country db 'COUNTRY',0 0 00009267 5348454C4C48494748 cmd_shellhigh db 'SHELLHIGH',0 0 00009270 00 0 00009271 5348454C4C00 cmd_shell db 'SHELL',0 0 00009277 4C4153544452495645 cmd_lastdrivehigh db 'LASTDRIVEHIGH',0 0 00009280 4849474800 0 00009285 4849 cmd_hilastdrive db 'HI' ;'HILASTDRIVE',0 0 00009287 4C4153544452495645 cmd_lastdrive db 'LASTDRIVE',0 0 00009290 00 0 00009291 425245414B00 cmd_break db 'BREAK',0 0 00009297 425546464552534849 cmd_buffershigh db 'BUFFERSHIGH',0 0 000092A0 474800 0 000092A3 4849 cmd_hibuffers db 'HI' ;'HIBUFFERS',0 0 000092A5 4255464645525300 cmd_buffers db 'BUFFERS',0 0 000092AD 4849 cmd_hifcbs db 'HI' ;'HIFCBS',0 0 000092AF 4643425300 cmd_fcbs db 'FCBS',0 0 000092B4 46494C455348494748 cmd_fileshigh db 'FILESHIGH',0 0 000092BD 00 0 000092BE 4849 cmd_hifiles db 'HI' ;'HIFILES',0 0 000092C0 46494C455300 cmd_files db 'FILES',0 0 000092C6 4849 cmd_histacks db 'HI' ;'HISTACKS',0 0 000092C8 535441434B5300 cmd_stacks db 'STACKS',0 0 000092CF 464153544F50454E00 cmd_fastopen db 'FASTOPEN',0 0 000092D8 445249565041524D00 cmd_drivparm db 'DRIVPARM', 0 0 000092E1 484953544F525900 cmd_history db 'HISTORY', 0 0 000092E9 4849 cmd_hiinstall db 'HI' ;'HIINSTALL', 0 0 000092EB 494E5354414C4C00 cmd_install db 'INSTALL', 0 0 000092F3 4849 cmd_hiinstalllast db 'HI' ;'HIINSTALLLAST', 0 0 000092F5 494E5354414C4C4C41 cmd_installlast db 'INSTALLLAST', 0 0 000092FE 535400 0 00009301 494E5354414C4C4849 cmd_installhigh db 'INSTALLHIGH', 0 0 0000930A 474800 0 0000930D 444F534441544100 cmd_dosdata db 'DOSDATA',0 0 00009315 444453435300 cmd_ddscs db 'DDSCS',0 0 0000931B 5842444100 cmd_xbda db 'XBDA',0 0 00009320 4849 cmd_hidos db 'HI' ;'HIDOS',0 0 00009322 444F5300 cmd_dos db 'DOS',0 0 00009326 53455400 cmd_set db 'SET',0 0 0000932A 535749544348455300 cmd_switches db 'SWITCHES',0 4010 %endif 0 00009333 444556494345484947 cmd_devicehigh db 'DEVICEHIGH',0 0 0000933C 4800 0 0000933E 4849 cmd_hidevice db 'HI' ;'HIDEVICE',0 0 00009340 44455649434500 cmd_device db 'DEVICE',0 0 00009347 52454D00 cmd_remark db 'REM', 0 0 0000934B 3B00 cmd_semicolon db ';',0 0 0000934D 3A00 cmd_colon db ':',0 0 0000934F 434841494E00 cmd_chain db 'CHAIN',0 0 00009355 474F544F00 cmd_goto db 'GOTO',0 0 0000935A 474F53554200 cmd_gosub db 'GOSUB',0 0 00009360 52455455524E00 cmd_return db 'RETURN',0 0 00009367 434C5300 cmd_cls db 'CLS',0 0 0000936B 43504F5300 cmd_cpos db 'CPOS',0 0 00009370 434F4C4F555200 cmd_colour db 'COLOUR',0 0 00009377 54494D454F555400 cmd_timeout db 'TIMEOUT',0 0 0000937F 53574954434800 cmd_switch db 'SWITCH',0 0 00009386 3F00 cmd_query db '?',0 0 00009388 4543484F00 cmd_echo db 'ECHO',0 0 0000938D 4558495400 cmd_exit db 'EXIT',0 0 00009392 4F4E cmd_onerror db 'ON' ;'ONERROR',0 0 00009394 4552524F5200 cmd_error db 'ERROR',0 0 0000939A 4745544B455900 cmd_getkey db 'GETKEY',0 0 000093A1 5945534348415200 cmd_yeschar db 'YESCHAR',0 0 000093A9 4445424C4F434B00 cmd_deblock db 'DEBLOCK',0 0 000093B1 4E554D4C4F434B00 cmd_numlock db 'NUMLOCK',0 0 000093B9 56455253494F4E00 cmd_version db 'VERSION',0 0 000093C1 5B434F4D4D4F4E5D00 cmd_common db '[COMMON]',0 4037 0 000093CA 4F4E00 cmd_on db 'ON',0 0 000093CD 4F464600 cmd_off db 'OFF',0 4040 0 000093D1 202824 confirm_msg1 db ' ($' 0 000093D4 29203F2024 confirm_msg2 db ') ? $' 0 000093D9 0D0A24 confirm_msg3 db CR,LF,'$' 4044 0 000093DC 2F4C3A00 region_opt db '/L:',0 0 000093E0 2F5300 slashs_opt db '/S',0 0 000093E3 53495A4500 size_opt db 'SIZE',0 0 000093E8 4849474800 high_opt db 'HIGH',0 0 000093ED 4C4F5700 low_opt db 'LOW',0 0 000093F1 4E4F noumb_opt db 'NO' ;'NOUMB',0 0 000093F3 554D4200 umb_opt db 'UMB',0 4052 0 000093F7 0000 himem_region dw 0 ; region to hidevice into 0 000093F9 0000 himem_size dw 0 ; minimum size wanted 0 000093FB 0000 himem_current dw 0 0 000093FD 0000 himem_current_base dw 0 0 000093FF 0000 himem_max dw 0 4058 4059 %if ADDDRV 4060 error_flag db 0 ;1 if error occurred during command 4061 ;file processing, 0 otherwise 4062 %endif 4063 0 00009401 0D default_query_char db CR 0 00009402 31 default_switch_char db '1' 4066 0 00009403 0000 keyb_timeout dw 0 ; default is no timeout 0 00009405 0000 error_level dw 0 ; default is no error 0 00009407 0000 save_sp dw 0 ; save SP here for GOSUB/RETURN's 4070 4071 INITDATA ends 4072 === Switch to base=000000h -> "INITENV" 4073 section INITENV public align=16 class=INITDATA 4074 Public envstart 0 00009830 000000000000000000 envstart db 250 dup (0) ; <<< initial env buffer, copied to seg 60 0 00009839 000000000000000000 0 00009842 000000000000000000 0 0000984B 000000000000000000 0 00009854 000000000000000000 0 0000985D 000000000000000000 0 00009866 000000000000000000 0 0000986F 000000000000000000 0 00009878 000000000000000000 0 00009881 000000000000000000 0 0000988A 000000000000000000 0 00009893 000000000000000000 0 0000989C 000000000000000000 0 000098A5 000000000000000000 0 000098AE 000000000000000000 0 000098B7 000000000000000000 0 000098C0 000000000000000000 0 000098C9 000000000000000000 0 000098D2 000000000000000000 0 000098DB 000000000000000000 0 000098E4 000000000000000000 0 000098ED 000000000000000000 0 000098F6 000000000000000000 0 000098FF 000000000000000000 0 00009908 000000000000000000 0 00009911 000000000000000000 0 0000991A 000000000000000000 0 00009923 00000000000000 4076 Public envend ; 0 0000992A 0000 envend dw 0 ; make it double null terminated 0 0000992C 1A db 1Ah ; EOF marker env buffer 4079 Public boot_options, boot_switches 0 0000992D 0000 boot_options dw 0 0 0000992F 00 boot_switches db 0 4082 ; set by BIOS to either the SHIFT states, or to F5KEY or F8KEY 4083 ; >>> end of range copied to seg 60 4084 ; may not exceed 256 bytes 4085 EXE_LENGTH equ 001Ch 4086 4087 exeBuffer label word 0 00009930 0000 exeSignature dw 0 ; 0000 Valid EXE contains 'MZ' 0 00009932 0000 exeFinal dw 0 ; 0002 Image Length MOD 512 0 00009934 0000 exeSize dw 0 ; 0004 Image Length DIV 512 0 00009936 0000 exeRelcnt dw 0 ; 0006 No. of Relocation Items 0 00009938 0000 exeHeader dw 0 ; 0008 Header Size in paragraphs 0 0000993A 0000 exeMinpara dw 0 ; 000A Minimum No extra paragraphs 0 0000993C 0000 exeMaxpara dw 0 ; 000C Maximum No of extra paragraphs 0 0000993E 0000 exeSS dw 0 ; 000E Displacment of Stack Segment 0 00009940 0000 exeSP dw 0 ; 0010 Initial SP 0 00009942 0000 exeChecksum dw 0 ; 0012 Negative CheckSum 0 00009944 0000 exeIP dw 0 ; 0014 Initial IP 0 00009946 0000 exeCS dw 0 ; 0016 Code Segment displacement 0 00009948 0000 exeReloff dw 0 ; 0018 Byte Offset of First REL item 0 0000994A 0000 exeOverlay dw 0 ; 001A Overlay Number (0 == Resident) 4102 4103 INITENV ends 4104 4105 end === Trace listing source: drbio/bin/nlsfunc.lst 1 ; File : $NLSFUNC.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; 33 ; NLSFUNC.A86 1.6 93/12/01 18:30:10 34 ; Read in full 258 bytes of collating info 35 ; ENDLOG 36 37 ; 38 ; We have a problem with NLSFUNC.EXE - if this isn't loaded with an INSTALL= 39 ; in CONFIG.SYS then the calls to set language/codepage will fail. 40 ; So we provide the same functionality that NLSFUNC.EXE does here in the 41 ; initialisation code. "nls_hook" is called by CONFIG before the country is 42 ; set, then "nls_unhook" is called afterwards so we can throw away this code. 43 ; 44 45 VALID_SIG equ 0EDC1h ; valid signature in COUNTRY.SYS file 46 47 labelsize DH_NEXT, dword, 0 ; Dword Pointer to Next DEV 48 labelsize DH_ATTRIB, word, 4 ; device attribute bits 49 labelsize DH_NAME, byte, 10 ; 8-BYTE device name 50 51 DA_CHARDEV equ 8000h ; 1=character device, 0=block device 52 DA_IOCTL equ 4000h ; device supports IOCTL string I/O 53 DA_GETSET equ 0040h ; supports 3.2 level functionality 54 55 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 56 %include "msdos.mac" 1 <1> ; File : $Workfile: MSDOS.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; MSDOS.EQU 1.1 92/11/10 10:48:56 34 <1> ; Added to appslib source directory. 35 <1> ; ENDLOG 36 <1> 37 <1> MS_P_TERMCPM equ 00H 38 <1> MS_C_READ equ 01H 39 <1> MS_C_WRITE equ 02H 40 <1> MS_A_READ equ 03H 41 <1> MS_A_WRITE equ 04H 42 <1> MS_L_WRITE equ 05H 43 <1> MS_C_RAWIO equ 06H 44 <1> MS_C_RAWIN equ 07H 45 <1> MS_C_NOECHO equ 08H 46 <1> MS_C_WRITESTR equ 09H 47 <1> MS_C_READSTR equ 0aH 48 <1> MS_C_STAT equ 0bH 49 <1> MS_C_FLUSH equ 0cH 50 <1> MS_DRV_ALLRESET equ 0dH 51 <1> MS_DRV_SET equ 0eH 52 <1> MS_F_OPEN equ 0fH 53 <1> MS_F_CLOSE equ 10H 54 <1> MS_F_SFIRST equ 11H 55 <1> MS_F_SNEXT equ 12H 56 <1> MS_F_DELETE equ 13H 57 <1> MS_F_READ equ 14H 58 <1> MS_F_WRITE equ 15H 59 <1> MS_F_MAKE equ 16H 60 <1> MS_F_RENAME equ 17H 61 <1> MS_DRV_GET equ 19H 62 <1> MS_F_DMAOFF equ 1aH 63 <1> MS_DRV_ALLOC equ 1bH 64 <1> MS_DRV_ALLOCSPEC equ 1cH 65 <1> MS_F_READRAND equ 21H 66 <1> MS_F_WRITERAND equ 22H 67 <1> MS_F_SIZE equ 23H 68 <1> MS_F_RANDREC equ 24H 69 <1> MS_S_SETINT equ 25H 70 <1> MS_P_MKPSP equ 26H 71 <1> MS_F_READBLK equ 27H 72 <1> MS_F_WRITEBLK equ 28H 73 <1> MS_F_PARSE equ 29H 74 <1> MS_T_GETDATE equ 2aH 75 <1> MS_T_SETDATE equ 2bH 76 <1> MS_T_GETTIME equ 2cH 77 <1> MS_T_SETTIME equ 2dH 78 <1> MS_F_VERIFY equ 2eH 79 <1> MS_F_DMAGET equ 2fH 80 <1> MS_S_BDOSVER equ 30H 81 <1> MS_P_TERMKEEP equ 31H 82 <1> MS_S_BREAK equ 33H 83 <1> MS_S_GETINT equ 35H 84 <1> MS_DRV_SPACE equ 36H 85 <1> MS_S_COUNTRY equ 38H 86 <1> MS_X_MKDIR equ 39H 87 <1> MS_X_RMDIR equ 3aH 88 <1> MS_X_CHDIR equ 3bH 89 <1> MS_X_CREAT equ 3cH 90 <1> MS_X_OPEN equ 3dH 91 <1> MS_X_CLOSE equ 3eH 92 <1> MS_X_READ equ 3fH 93 <1> MS_X_WRITE equ 40H 94 <1> MS_X_UNLINK equ 41H 95 <1> MS_X_LSEEK equ 42H 96 <1> MS_X_CHMOD equ 43H 97 <1> MS_X_IOCTL equ 44H 98 <1> MS_X_DUP equ 45H 99 <1> MS_X_DUP2 equ 46H 100 <1> MS_X_CURDIR equ 47H 101 <1> MS_M_ALLOC equ 48H 102 <1> MS_M_FREE equ 49H 103 <1> MS_M_SETBLOCK equ 4aH 104 <1> MS_X_EXEC equ 4bH 105 <1> MS_X_EXIT equ 4cH 106 <1> MS_X_WAIT equ 4dH 107 <1> MS_X_FIRST equ 4eH 108 <1> MS_X_NEXT equ 4fH 109 <1> MS_P_SETPSP equ 50H 110 <1> MS_F_GETVERIFY equ 54H 111 <1> MS_X_RENAME equ 56H 112 <1> MS_X_DATETIME equ 57H 113 <1> MS_M_STRATEGY equ 58h 114 <1> MS_F_ERROR equ 59H 115 <1> MS_X_MKTEMP equ 5aH 116 <1> MS_X_MKNEW equ 5bH 117 <1> MS_F_LOCK equ 5cH 118 <1> MS_X_EXPAND equ 60H 119 <1> MS_P_GETPSP equ 62H 120 <1> MS_X_GETCP equ 6601h 121 <1> MS_X_SETCP equ 6602h 122 <1> MS_X_SETHC equ 67h 123 <1> MS_X_COMMIT equ 68h 124 <1> 125 <1> DOS_INT equ 21h ; DOS Entry Point 126 <1> ; 127 <1> STDIN equ 0 ; Standard Console Input Handle 128 <1> STDOUT equ 1 ; Standard Console Output Handle 129 <1> STDERR equ 2 ; Standard Error Output 130 <1> STDAUX equ 3 ; Auxilary Device Handle 131 <1> STDPRN equ 4 ; Printer Device Handle 57 %include "mserror.mac" 1 <1> ; File : $MSERROR.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ED_FUNCTION equ -01 ; invalid function number 36 <1> ED_FILE equ -02 ; file not found 37 <1> ED_PATH equ -03 ; path not found 38 <1> ED_HANDLE equ -04 ; too many open files 39 <1> ED_ACCESS equ -05 ; file access denied 40 <1> ED_H_MATCH equ -06 ; invalid handle number 41 <1> ED_DMD equ -07 ; memory descriptor destroyed 42 <1> ED_MEMORY equ -08 ; insufficient memory 43 <1> ED_BLOCK equ -09 ; invalid memory block addr 44 <1> ED_ENVIRON equ -10 ; invalid environment 45 <1> ED_FORMAT equ -11 ; invalid format 46 <1> ED_ACC_CODE equ -12 ; invalid access code 47 <1> ED_DATA equ -13 ; invalid data 48 <1> ED_DRIVE equ -15 ; invalid drive specified 49 <1> ED_DIR equ -16 ; can't remove current dir 50 <1> ED_DEVICE equ -17 ; not same device 51 <1> ED_ROOM equ -18 ; no more files 52 <1> 53 <1> ED_PROTECT equ -19 ; disk write protected 54 <1> ED_BADUNIT equ -20 ; invalid drive specified 55 <1> ED_NOTREADY equ -21 ; drive doesn't respond 56 <1> ED_BADCMD equ -22 ; invalid command to driver 57 <1> ED_BADDATA equ -23 ; data CRC error 58 <1> ED_BADRHLEN equ -24 ; (shouldn't happen) 59 <1> ED_BADSEEK equ -25 ; can't seek to track 60 <1> ED_BADMEDIA equ -26 ; unrecognizable medium 61 <1> ED_RNF equ -27 ; record/sector not found 62 <1> ED_NOPAPER equ -28 ; printer error 63 <1> ED_WRFAIL equ -29 ; write failed 64 <1> ED_RDFAIL equ -30 ; read failed 65 <1> ED_GENFAIL equ -31 ; anything failed 66 <1> ED_SHAREFAIL equ -32 ; sharing conflict 67 <1> ED_LOCKFAIL equ -33 ; locking conflict 68 <1> ED_DISKCHG equ -34 ; invalid disk change 69 <1> ED_NOFCBS equ -35 ; FCB table exhausted 70 <1> ED_NOLOCKS equ -36 ; lock list items exhausted 71 <1> ED_NET equ -50 ; Network Request Not Supported 72 <1> 73 <1> ED_NETACCESS equ -65 ; file access denied 74 <1> 75 <1> ED_NETPWD equ -73 ; Server Password Error 76 <1> ED_NETVER equ -74 ; Incorrect Server version 77 <1> ED_NETREQ equ -75 ; No Local Network Resources 78 <1> ED_NETTIME equ -76 ; Network Time Out Error 79 <1> ED_NETCOMM equ -77 ; Network Communications Error 80 <1> ED_NETSRVR equ -78 ; No Server Network Resources 81 <1> ED_NETLOG equ -79 ; Server Not Logged In 82 <1> 83 <1> ED_EXISTS equ -80 ; file already exists 84 <1> ED_MAKE equ -82 ; Cannot Make (Files ??) 85 <1> ED_FAIL equ -83 ; FAIL code returned from INT 24 86 <1> ED_STRUCT equ -84 ; Out of Structures 87 <1> ED_ASSIGN equ -85 ; Already Assigned 88 <1> ED_PASSWORD equ -86 ; Invalid Password 89 <1> ED_PARAM equ -87 ; Invalid Parameter 90 <1> ED_NETWRITE equ -88 ; Network write fault 91 <1> ED_NETFUNC equ -89 ; Function not supported on network 92 <1> ED_COMPONENT equ -90 ; system component not installed 93 <1> ED_LASTERROR equ -90 ; Last Error Number Used 94 <1> 95 <1> CLASS_RESOURCE equ 1 ; Out of Resource 96 <1> CLASS_TEMP equ 2 ; Temporary Situation 97 <1> CLASS_AUTHOR equ 3 ; Authorization Error 98 <1> CLASS_INTERNAL equ 4 ; Internal System Software Error 99 <1> CLASS_HARDWARE equ 5 ; Hardware Failure 100 <1> CLASS_SYSTEM equ 6 ; Serious System Failure 101 <1> CLASS_APPLIC equ 7 ; Application Program Error 102 <1> CLASS_LOST equ 8 ; File/Item Not Found 103 <1> CLASS_FORMAT equ 9 ; File/Item Illegal Format 104 <1> CLASS_LOCKED equ 10 ; File/Item Locked 105 <1> CLASS_MEDIA equ 11 ; Media Failure 106 <1> CLASS_EXISTS equ 12 ; Item Already Exists 107 <1> CLASS_UNKNOWN equ 13 ; Unknown Classification 108 <1> 109 <1> ACT_RETRY equ 1 ; Retry a few times then prompt user 110 <1> ACT_DELAY equ 2 ; Delay then as ACT_RETRY 111 <1> ACT_USER equ 3 ; Prompt user to re-enter data 112 <1> ACT_ABORT equ 4 ; Clean Up then ABORT the process 113 <1> ACT_TERM equ 5 ; Terminate immeadiately NO CLEAN UP 114 <1> ACT_IGNORE equ 6 ; Ignore the Error 115 <1> ACT_URETRY equ 7 ; Retry the error after user intervention 116 <1> 117 <1> LOC_UNKNOWN equ 1 ; Unknown error location 118 <1> LOC_BLOCK equ 2 ; Block Device Failure 119 <1> LOC_NET equ 3 ; Network Failure 120 <1> LOC_CHAR equ 4 ; Related to Serial/Character devices 121 <1> LOC_MEMORY equ 5 ; Failure related to Memory 58 59 60 group CGROUP INITCODE === Switch to base=000000h -> "INITCODE" 61 section INITCODE public align=16 class=INITCODE 62 63 ; We share our NLS buffer with other temporary users 64 65 extrn nls_temp_area:byte 66 67 Public nls_hook, nls_unhook 68 69 nls_hook: 70 ;-------- 71 ; On Entry: 72 ; none 73 ; On Exit: 74 ; none 75 ; 0 00007C60 06 push es 0 00007C61 B435 mov ah,MS_S_GETINT 0 00007C63 B02F mov al,2fh 0 00007C65 CD21 int DOS_INT ; read and save old INT 2F vector 0 00007C67 2E891E[2F00] mov [cs:old_int2f_off],bx 0 00007C6C 2E8C06[3100] mov [cs:old_int2f_seg],es 0 00007C71 B425 mov ah,MS_S_SETINT 0 00007C73 B02F mov al,2fh 84 cgroup equ CGROUP ; NASM port equate 0 00007C75 BA[3300] mov dx,offset int2f_handler wrt cgroup ; install our own INT 2F handler 0 00007C78 CD21 int DOS_INT 0 00007C7A 07 pop es 0 00007C7B C3 ret 89 90 nls_unhook: 91 ;---------- 92 ; On Entry: 93 ; none 94 ; On Exit: 95 ; none 96 ; 0 00007C7C 1E push ds 0 00007C7D 2E8B16[2F00] mov dx,[cs:old_int2f_off] 0 00007C82 2E8E1E[3100] mov ds,[cs:old_int2f_seg] 0 00007C87 B425 mov ah,MS_S_SETINT ; restore INT 2F vector 0 00007C89 B02F mov al,2fh 0 00007C8B CD21 int DOS_INT 0 00007C8D 1F pop ds 0 00007C8E C3 ret 105 106 old_int2f label dword 0 00007C8F 0000 old_int2f_off dw 0 0 00007C91 0000 old_int2f_seg dw 0 109 110 int2f_handler: 111 ;------------- 0 00007C93 80FC14 cmp ah,014h ; is it for us ? 0 00007C96 7405 je int2f_handler10 0 00007C98 2EFF2E[2F00] jmp far [cs:old_int2f] ; no, pass it on 115 116 int2f_handler10: 0 00007C9D 3C00 cmp al,0 ; installation check ? 0 00007C9F 7503 jne int2f_handler20 0 00007CA1 B0FF mov al,0ffh ; we are already installed 0 00007CA3 CF iret 121 122 int2f_handler20: 0 00007CA4 3CFF cmp al,0ffh ; Codepage Prep ? 0 00007CA6 7506 jne int2f_handler30 0 00007CA8 E84300 call f66_prep 0 00007CAB CA0200 retf 2 ; iret, keeping flags 127 128 int2f_handler30: 0 00007CAE 3CFE cmp al,0feh ; Country Get Data ? 0 00007CB0 7506 jne int2f_handler40 0 00007CB2 E8D900 call f65_locate_and_read 0 00007CB5 CA0200 retf 2 ; iret, keeping flags 133 134 int2f_handler40: 0 00007CB8 F9 stc ; CY to indicate an error 0 00007CB9 B80100 mov ax,-ED_FUNCTION ; function not supported 0 00007CBC CA0200 retf 2 ; return an error 138 139 0 00007CBF 0000 f66_cp dw 0 ; INT21/66 Local Variable 0 00007CC1 0200 cp_packet dw 2 ; Packet Size 0 00007CC3 0000 cp_cpid dw 0 ; Request CodePage 0 00007CC5 0000 db 0,0 ; Packet Terminators 144 0 00007CC7 0000 preperr dw 0 ; Prepare function Error Code 0 00007CC9 000000000000000000 prepname db 9 dup (0) ; Reserved for ASCIIZ Device Name 147 148 ; 149 ; Area for country.sys current pointer table 150 ; (these are all offsets into country.sys) 151 ; 0 00007CD2 0000 f65xx_code dw 0 ; Country code 0 00007CD4 0000 f65xx_cp dw 0 ; Code page 0 00007CD6 0000 dw 0 ; +1 reserved 0 00007CD8 0000 f65xx_data dw 0 ; Data area 0 00007CDA 0000 dw 0 ; Upper case table 0 00007CDC 0000 dw 0 ; +1 reserved 0 00007CDE 0000 dw 0 ; Filename upper case table 0 00007CE0 0000 dw 0 ; Legal file characters 0 00007CE2 0000 dw 0 ; Collating table 0 00007CE4 0000 dw 0 ; Double byte character set lead byte table 162 f65xx_ptable_len equ 20 163 0 00007CE6 0000 f65xx_codepage dw 0 0 00007CE8 0000 f65xx_country dw 0 0 00007CEA 0000 f65xx_sig dw 0 ; Signature 0 00007CEC 0000 c_handle dw 0 168 169 170 f66_prep: 171 ; 172 ; This function scans the complete device list and prepares 173 ; all devices which support codepage. 174 ; 175 ; On Entry BX Requested CodePage 176 ; 177 ; On Exit AX Last Error Code 178 ; 179 DA_CODEPAGE equ DA_CHARDEV+DA_IOCTL+DA_GETSET 180 0 00007CEE 1E push ds 0 00007CEF 06 push es 0 00007CF0 0E push cs 0 00007CF1 07 pop es 0 00007CF2 2E891E[5F00] mov [cs:f66_cp],bx ; Save requested CodePage 0 00007CF7 2EC706[6700]0000 mov word [cs:preperr],0000 ; Initialize Prepare Error 0 00007CFE B82C12 mov ax,122ch ; magic hook get Device List 0 00007D01 CD2F int 2fh ; after the NUL entry 0 00007D03 8EDB mov ds,bx ; BX:AX -> header after INT 2F 0 00007D05 89C3 mov bx,ax ; DS:BX -> header to be useful 191 f66_p10: 0 00007D07 1E push ds 0 00007D08 53 push bx 0 00007D09 8B4704 mov ax,[DH_ATTRIB + bx] 0 00007D0C 2540C0 and ax,DA_CODEPAGE ; Check for a Character Device which 0 00007D0F 3D40C0 cmp ax,DA_CODEPAGE ; supports IOCTL strings and GETSET 0 00007D12 7568 jnz f66_p40 ; otherwise skip the device 198 0 00007D14 8D770A lea si,[DH_NAME + bx] ; Found a matching device so 0 00007D17 BF[6900] mov di,offset prepname ; open the device and select the 0 00007D1A B90800 mov cx,8 ; requested codepage 202 203 f66_p20: 0 00007D1D AC lodsb 0 00007D1E 3C20 cmp al,' ' 0 00007D20 7403 je f66_p30 0 00007D22 AA stosb 0 00007D23 E2F8 loop f66_p20 209 210 f66_p30: 0 00007D25 30C0 xor al,al 0 00007D27 AA stosb 0 00007D28 0E push cs 0 00007D29 1F pop ds 0 00007D2A BA[6900] mov dx,offset prepname ; Write Access 0 00007D2D B101 mov cl,1 ; Open for write 0 00007D2F B82612 mov ax,1226h 0 00007D32 CD2F int 2fh ; call magic hook 0 00007D34 7242 jc f66_perr 0 00007D36 89C3 mov bx,ax ; Save Device Handle in BX 221 0 00007D38 2E8B36[5F00] mov si,[cs:f66_cp] ; Get Requested CodePage in SI 0 00007D3D BA[6100] mov dx,offset cp_packet ; Offset of CodePage Struct 0 00007D40 B96A00 mov cx,006Ah ; Get Unknown CodePage 0 00007D43 55 push bp 0 00007D44 BD0C00 mov bp,0ch ; Generic IOCTL 0 00007D47 B82B12 mov ax,122bh 0 00007D4A CD2F int 2fh ; call magic hook 0 00007D4C 5D pop bp 0 00007D4D 7207 jc f66_p32 ; Error so Select requested Code Page 231 0 00007D4F 2E3B36[6300] cmp si,[cs:cp_cpid] 0 00007D54 741B je f66_p35 ; If this the currently selected 234 f66_p32: ; skip the select CodePage 0 00007D56 2E8936[6300] mov [cs:cp_cpid],si 0 00007D5B BA[6100] mov dx,offset cp_packet ; Offset of CodePage Struct 0 00007D5E B94A00 mov cx,004Ah ; Select Unkown CodePage 0 00007D61 55 push bp 0 00007D62 BD0C00 mov bp,0ch ; Generic IOCTL 0 00007D65 B82B12 mov ax,122bh 0 00007D68 CD2F int 2fh ; call magic hook 0 00007D6A 5D pop bp 0 00007D6B 7304 jnc f66_p35 ; No Error so skip the error 244 f66_p33: 0 00007D6D 2EA3[6700] mov [cs:preperr],ax ; save 246 247 f66_p35: 0 00007D71 B82712 mov ax,1227h 0 00007D74 CD2F int 2fh ; magic hook to close handle 0 00007D76 EB04 jmp f66_p40 251 252 f66_perr: 0 00007D78 2EA3[6700] mov [cs:preperr],ax ; Save the error code and try the 254 f66_p40: ; next device in the chain 0 00007D7C 5B pop bx ; Restore the Device offset 0 00007D7D 1F pop ds 0 00007D7E C51F lds bx,[DH_NEXT + bx] ; check next character device for 0 00007D80 83FBFF cmp bx,0FFFFh ; Codepage support 0 00007D83 7582 jne f66_p10 260 0 00007D85 2EA1[6700] mov ax,[cs:preperr] ; All devices have been prepared 0 00007D89 07 pop es 0 00007D8A 1F pop ds 0 00007D8B 09C0 or ax,ax ; now return the last error code 0 00007D8D C3 ret ; in AX 266 267 ; 268 ; ********************************************************************** 269 ; *** Function 65 support - routines for seeking a country/codepage *** 270 ; *** and loading the required information into the temp data area *** 271 ; ********************************************************************** 272 ; 273 ; ************************************************** 274 ; *** Open country.sys and search for the *** 275 ; *** table of offsets for the given country/ *** 276 ; *** codepage, read it in and exit. *** 277 ; ************************************************** 278 279 f65_locate_and_read: 280 ;------------------- 281 ; Locate and Read info CL for Country DX Codepage BX using file DS:DI 0 00007D8E 85FF test di,di ; valid filename ? 0 00007D90 F9 stc 0 00007D91 7423 jz f65_lr_exit 285 0 00007D93 51 push cx 0 00007D94 E82000 call f65x_find_info ; Will need to load up the info 0 00007D97 58 pop ax 0 00007D98 721C jc f65_lr_exit ; so do it if we can. 290 0 00007D9A BA[0000] mov dx,offset nls_temp_area 0 00007D9D B90201 mov cx,258 ; read 258 bytes into local buffer 0 00007DA0 50 push ax 0 00007DA1 E8C400 call f65x_load_info ; Load required info 0 00007DA4 58 pop ax 0 00007DA5 720F jc f65_lr_exit 0 00007DA7 2E8B1E[8C00] mov bx,[cs:c_handle] ; Close the file first 0 00007DAC B82712 mov ax,1227h 0 00007DAF CD2F int 2fh ; magic hook to close handle 0 00007DB1 7203 jc f65_lr_exit 0 00007DB3 BE[0000] mov si,offset nls_temp_area ; Tell subroutines where info is 302 f65_lr_exit: 0 00007DB6 C3 ret 304 ; 305 ; Entry: dx=country code, bx=codepage 306 ; Exit : carry set, and country.sys closed if failure 307 ; country.sys open ready for more reads if success 308 ; 309 f65x_find_info: 0 00007DB7 2E8916[8800] mov [cs:f65xx_country],dx 0 00007DBC 2E891E[8600] mov [cs:f65xx_codepage],bx 0 00007DC1 89FA mov dx,di 0 00007DC3 31C9 xor cx,cx ; Open for read 0 00007DC5 B82612 mov ax,1226h 0 00007DC8 CD2F int 2fh ; call magic hook 0 00007DCA 0E push cs ; get DS pointing to this segment 0 00007DCB 1F pop ds ; for future reads 0 00007DCC 7301 jnc f65x_10 0 00007DCE C3 ret ; Successful open? 320 f65x_10: 0 00007DCF 2EA3[8C00] mov [cs:c_handle],ax ; Save handle 0 00007DD3 2E8B16[8800] mov dx,[cs:f65xx_country] 0 00007DD8 2E3916[7200] cmp [cs:f65xx_code],dx ; do we already have the information? 0 00007DDD 7507 jne f65x_30 ; No - get it from country.sys 325 f65x_20: 0 00007DDF 2E391E[7400] cmp [cs:f65xx_cp],bx ; Does codepage agree too? 0 00007DE4 746B je f65x_35 ; Yes so exit with no more ado 328 f65x_30: 0 00007DE6 BA7E00 mov dx,007Eh 0 00007DE9 31C9 xor cx,cx ; Seek within country.sys 0 00007DEB 2E8B1E[8C00] mov bx,[cs:c_handle] 0 00007DF0 55 push bp 0 00007DF1 BD0000 mov bp,0 ; seek from begining 0 00007DF4 B82812 mov ax,1228h 0 00007DF7 CD2F int 2fh 0 00007DF9 5D pop bp 0 00007DFA 7260 jc f65x_err 0 00007DFC 2E8B1E[8C00] mov bx,[cs:c_handle] ; check them 0 00007E01 B90200 mov cx,2 0 00007E04 BA[8A00] mov dx,offset f65xx_sig 0 00007E07 B82912 mov ax,1229h 0 00007E0A CD2F int 2fh ; read the signature bytes 0 00007E0C 724E jc f65x_err 0 00007E0E 2E813E[8A00]C1ED cmp word [cs:f65xx_sig],VALID_SIG 0 00007E15 7545 jne f65x_err ; If signature bad exit 346 f65x_32: 0 00007E17 2E8B1E[8C00] mov bx,[cs:c_handle] ; Read from country.sys header until 0 00007E1C B91400 mov cx,f65xx_ptable_len ; Country/codepage found or NULL 0 00007E1F BA[7200] mov dx,offset f65xx_code 0 00007E22 B82912 mov ax,1229h 0 00007E25 CD2F int 2fh 0 00007E27 7233 jc f65x_err 0 00007E29 2E833E[7200]00 cmp word [cs:f65xx_code],0 ; Found NULL so reqd combination 0 00007E2F 742B je f65x_err ; was not found 0 00007E31 2E8B16[7200] mov dx,[cs:f65xx_code] ; Get the country/codepage values 0 00007E36 2E8B1E[7400] mov bx,[cs:f65xx_cp] ; read from Country.SYS 0 00007E3B 2E3B16[8800] cmp dx,[cs:f65xx_country] ; Check against the requested 0 00007E40 75D5 jne f65x_32 ; Country. 0 00007E42 2E833E[8600]00 cmp word [cs:f65xx_codepage],0 ; If a codepage match is not 0 00007E48 7407 jz f65x_35 ; then return success 0 00007E4A 2E3B1E[8600] cmp bx,[cs:f65xx_codepage] ; Check against the requested 0 00007E4F 75C6 jne f65x_32 ; Codepage 363 f65x_35: 0 00007E51 2E8916[8800] mov [cs:f65xx_country],dx ; Force the Search Country and 0 00007E56 2E891E[8600] mov [cs:f65xx_codepage],bx ; CodePage to be Updated 0 00007E5B C3 ret 367 368 f65x_err: 0 00007E5C 2E8B1E[8C00] mov bx,[cs:c_handle] ; and set the carry flag before 0 00007E61 B82712 mov ax,1227h 0 00007E64 CD2F int 2fh ; magic hook to close handle 0 00007E66 F9 stc 0 00007E67 C3 ret 374 375 ; 376 ; ************************************************** 377 ; *** Load the type of information requested *** 378 ; *** For the country currently active in the *** 379 ; *** offset table *** 380 ; ************************************************** 381 ; 382 ; Entry: al=type of info, dx=offset of buffer to read info into cx=no of bytes 383 ; Exit : carry set, and country.sys closed if failure 384 ; 385 f65x_load_info: 0 00007E68 06 push es 0 00007E69 51 push cx 0 00007E6A 52 push dx 0 00007E6B 1E push ds ; Make es=ds 0 00007E6C 07 pop es 0 00007E6D FEC8 dec al ; 1=Data , 2=uppercase, 4=fuppercase 0 00007E6F 28FF sub bh,bh ; 5=filechars, 6=Collating table 0 00007E71 88C3 mov bl,al ; 7=DBCS table 0 00007E73 D1E3 shl bx,1 ; Retrieve relevant offset 0 00007E75 2E8B97[7800] mov dx,[cs:f65xx_data + bx] 0 00007E7A 31C9 xor cx,cx ; Seek within country.sys 0 00007E7C 2E8B1E[8C00] mov bx,[cs:c_handle] 0 00007E81 55 push bp 0 00007E82 BD0000 mov bp,0 ; seek from begining 0 00007E85 B82812 mov ax,1228h 0 00007E88 CD2F int 2fh 0 00007E8A 5D pop bp 0 00007E8B 5A pop dx ; Get buffer address back 0 00007E8C 59 pop cx ; and number of bytes to read 0 00007E8D 72CD jc f65x_err 0 00007E8F 85C0 test ax,ax ; zero offset is a problem 0 00007E91 74C9 jz f65x_err ; (probably DBCS with old COUNTRY.SYS) 0 00007E93 2E8B1E[8C00] mov bx,[cs:c_handle] ; Now read that info into our data area 0 00007E98 B82912 mov ax,1229h 0 00007E9B CD2F int 2fh 0 00007E9D 72BD jc f65x_err 0 00007E9F 07 pop es 0 00007EA0 C3 ret 414 415 INITCODE ENDS 416 417 end === Trace listing source: drbio/bin/bdosldr.lst 1 ; File : $BDOSLDR.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; 33 ; ENDLOG 34 35 %include "request.mac" 1 <1> ; File : $REQUEST.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> P_DSTRUC struc 0 00000000 ???? dw ? 0 00000002 ???????? REQUEST dd ? 0 00000006 ???????? DMA dd ? 39 <1> P_DSTRUC ends 40 <1> 41 <1> P_STRUC struc 0 00000000 ???? dw ? ; saved BP 0 00000002 ???? REQUEST_OFF dw ? ; request header offset 0 00000004 ???? REQUEST_SEG dw ? ; request header segment 0 00000006 ???? DMAOFF dw ? ; transfer offset 0 00000008 ???? DMASEG dw ? ; transfer segment 0 0000000A ?? RETRY db ? ; retry count for disk errors 0 0000000B ?? DIRECT db ? ; 0 if DMA deblocking required 0 0000000C ?? ROSCMD db ? ; 2 = read, 3 = write, 4 = verify 0 0000000D ?? SETTLE db ? ; for fast settle on reads 0 0000000E ?? SECTOR db ? ; sector # (0..BPB_SPT-1) 0 0000000F ?? HEAD db ? ; head # (0..BPB_HEADS-1) 0 00000010 ???? CYL dw ? ; cylinder # (0..1023) 0 00000012 ???? COUNT dw ? ; requested sector count 0 00000014 ???? MCNT dw ? ; physical sector count 0 00000016 ???????? LBABLOCK dd ? ; Logical Block Address of start sector 57 <1> P_STRUC ends 58 <1> 59 <1> 60 <1> 61 <1> CMD_INIT equ 0 ; Initialize the Device Driver 62 <1> CMD_MEDIA_CHECK equ 1 ; Request Media Check 63 <1> CMD_BUILD_BPB equ 2 ; Build Drive BPB 64 <1> CMD_INPUT_IOCTL equ 3 ; IOCTL input 65 <1> CMD_INPUT equ 4 ; Input 66 <1> CMD_INPUT_NOWAIT equ 5 ; Non destructive input no wait 67 <1> CMD_INPUT_STATUS equ 6 ; Input status 68 <1> CMD_INPUT_FLUSH equ 7 ; Input flush 69 <1> CMD_OUTPUT equ 8 ; Output 70 <1> CMD_OUTPUT_VERIFY equ 9 ; Output with verify 71 <1> CMD_OUTPUT_STATUS equ 10 ; Output status 72 <1> CMD_OUTPUT_FLUSH equ 11 ; Output flush 73 <1> CMD_OUTPUT_IOCTL equ 12 ; IOCTL output 74 <1> CMD_DEVICE_OPEN equ 13 ; Device OPEN 75 <1> CMD_DEVICE_CLOSE equ 14 ; Device CLOSE 76 <1> CMD_FIXED_MEDIA equ 15 ; Removeable Media Check 77 <1> CMD_GENERIC_IOCTL equ 19 ; Generic IOCTL 78 <1> CMD_GET_DEVICE equ 23 ; Get the Logical Device 79 <1> CMD_SET_DEVICE equ 24 ; Set the Logical Device 80 <1> CMD_QUERY_IOCTL equ 25 ; query ioctl support 81 <1> 82 <1> ; Generic Request Header Format 83 <1> 84 <1> labelsize RH_LEN, byte, 0 85 <1> labelsize RH_UNIT, byte, 1 86 <1> labelsize RH_CMD, byte, 2 87 <1> labelsize RH_STATUS, word, 3 88 <1> RHS_DONE equ 0100h 89 <1> RHS_BUSY equ 0200h 90 <1> RHS_IC equ 0400h ; Interim Character 91 <1> RHS_RM equ 0800h 92 <1> RHS_ERROR equ 8000h 93 <1> 94 <1> ;****** 95 <1> ;* No longer safe to use - some device drivers trample on them.... 96 <1> ;* 97 <1> ;* RH_STRATEGY equ dword ptr 5 ; Device Strategy Routine 98 <1> ;* RH_STRATOFF equ word ptr 5 ; Strategy Offset 99 <1> ;* RH_STRATSEG equ word ptr 7 ; Strategy Segment 100 <1> ;* RH_INTERRUPT equ dword ptr 9 ; Device Interrupt Routine 101 <1> ;* RH_INTOFF equ word ptr 9 ; Intterupt Offset 102 <1> ;* RH_INTSEG equ word ptr 11 ; Interrupt Segment 103 <1> ;***** 104 <1> 105 <1> ; Request header for initialization 106 <1> 107 <1> labelsize RH0_NUNITS, byte, 13 108 <1> labelsize RH0_RESIDENT, word, 14 109 <1> labelsize RH0_BPBOFF, word, 18 110 <1> labelsize RH0_BPBSEG, word, 20 111 <1> labelsize RH0_DRIVE, byte, 22 112 <1> RH0_LEN equ 22 113 <1> 114 <1> ; Request header for media check 115 <1> 116 <1> labelsize RH1_MEDIA, byte, 13 ; BDOS: current media byte 117 <1> labelsize RH1_RETURN, byte, 14 ; driver: return code (00, 01, FF) 118 <1> labelsize RH1_VOLID, dword, 15 ; driver: volume label address 119 <1> RH1_LEN equ 15 120 <1> 121 <1> ; Request header for "build BPB" 122 <1> 123 <1> labelsize RH2_MEDIA, byte, 13 ; BDOS or driver? 124 <1> labelsize RH2_BUFFER, dword, 14 ; BDOS: scratch buffer for driver use 125 <1> labelsize RH2_BPB, dword, 18 ; same as the following: 126 <1> labelsize RH2_BPBOFF, word, 18 ; driver: address of new BPB 127 <1> labelsize RH2_BPBSEG, word, 20 128 <1> RH2_LEN equ 24 129 <1> 130 <1> ; Request header for input/output 131 <1> 132 <1> labelsize RH4_MEDIA, byte, 13 ; BDOS: current media byte 133 <1> labelsize RH4_RIC, byte, 13 ; BDOS: Return Interim Char flg 134 <1> labelsize RH4_BUFFER, dword, 14 ; BDOS: disk transfer address 135 <1> labelsize RH4_BUFOFF, word, 14 ; BDOS: Buffer Offset 136 <1> labelsize RH4_BUFSEG, word, 16 ; BDOS: Buffer Segment 137 <1> labelsize RH4_COUNT, word, 18 ; BDOS: sector count 138 <1> labelsize RH4_SECTOR, word, 20 ; BDOS: starting sector 139 <1> labelsize RH4_VOLID, dword, 22 ; driver: volume if illegal disk change 140 <1> labelsize RH4_BIGSECTOR, dword, 26 141 <1> labelsize RH4_BIGSECTORLO, word, 26 142 <1> labelsize RH4_BIGSECTORHI, word, 28 143 <1> 144 <1> RH4_LEN equ 30 145 <1> 146 <1> ; Request Header for Non-Destructive Input 147 <1> 148 <1> labelsize RH5_CHAR, byte, 13 ; Character Read from Device 149 <1> labelsize RH5_RIC, byte, 13 ; BDOS: Return Interim Char flg 150 <1> RH5_LEN equ 14 151 <1> 152 <1> ; Request Header for Device Open 153 <1> 154 <1> RH13_LEN equ 13 155 <1> 156 <1> ; Request Header for Device Close 157 <1> 158 <1> RH14_LEN equ 13 159 <1> 160 <1> ; Request header for generic IOCTL 161 <1> 162 <1> labelsize RH19_CATEGORY, word, 13 ; BDOS: major/minor function number 163 <1> labelsize RH19_MAJOR, byte, 13 ; BDOS: Major Function Number 164 <1> labelsize RH19_MINOR, byte, 14 ; BDOS: Minor Function Number 165 <1> labelsize RH19_SI, word, 15 ; BDOS: User SI 166 <1> labelsize RH19_DI, word, 17 ; BDOS: User DI 167 <1> labelsize RH19_GENPB, dword, 19 ; BDOS: extra parameters 168 <1> RH19_LEN equ 23 169 <1> 170 <1> RQ19_SET equ 40h ; set device parameters 171 <1> RQ19_GET equ 60h ; get device parameters 172 <1> RQ19_WRITE equ 41h ; write tracks 173 <1> RQ19_READ equ 61h ; read tracks 174 <1> RQ19_FORMAT equ 42h ; format tracks 175 <1> RQ19_VERIFY equ 62h ; verify tracks 176 <1> RQ19_SETMEDIA equ 46h ; set media ID 177 <1> RQ19_SETACCESS equ 47h ; set access flag 178 <1> RQ19_GETMEDIA equ 66h ; get media ID 179 <1> RQ19_GETACCESS equ 67h ; get access flag 180 <1> RQ19_LOCKLOG equ 4ah 181 <1> RQ19_LOCKPHYS equ 4bh 182 <1> RQ19_UNLOCKLOG equ 6ah 183 <1> RQ19_UNLOCKPHYS equ 6bh 184 <1> 185 <1> RQ19_PRP_START equ 4Ch ; start of codepage prepare 186 <1> RQ19_PRP_END equ 4Dh ; end of codepage prepare 187 <1> RQ19_SELECT equ 4Ah ; select code page 188 <1> RQ19_QRY_SEL equ 6Ah ; query selected code page 189 <1> RQ19_QRY_PRP equ 6Bh ; query prepared code page(s) 190 <1> RQ19_DSP_SET equ 5Fh ; set display information 191 <1> RQ19_DSP_GET equ 7Fh ; get display information 192 <1> 193 <1> ; Request header for get/set drive 194 <1> 195 <1> labelsize RH24_CMD, byte, 14 ; BDOS: Command Code 196 <1> labelsize RH24_STATUS, word, 15 ; BDOS: Status 197 <1> labelsize RH24_RESVD, dword, 17 ; BDOS: Reserved 198 <1> RH24_LEN equ 21 199 <1> 200 <1> RH_SIZE equ 30 ; maximum size of request header 36 %include "driver.mac" 1 <1> ; File : $DRIVER.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> ; Device driver header offsets. 34 <1> 35 <1> DEVHDR struc 0 00000000 ???????? NEXT dd ? 0 00000004 ???? ATTRIB dw ? 0 00000006 ???? STRATEGY dw ? 0 00000008 ???? INTERRUPT dw ? 0 0000000A ???????????????? NAM db 8 dup (?) 41 <1> DEVHDR ends 42 <1> 43 <1> DA_CHARDEV equ 8000h ; 1=character device, 0=block device 44 <1> DA_IOCTL equ 4000h ; device supports IOCTL string I/O 45 <1> DA_NONIBM equ 2000h ; dosen't require FAT for login 46 <1> DA_OTILBSY equ 2000h ; supports "output until busy" 47 <1> DA_REMOVE equ 0800h ; supports "removable media" check 48 <1> DA_QUERY equ 0080h ; supports query ioctl 49 <1> DA_GETSET equ 0040h ; supports 3.2 level functionality 50 <1> DA_SPECIAL equ 0010h ; fast console ouput via INT 29h 51 <1> DA_ISCLK equ 0008h ; device is current clock device 52 <1> DA_ISNUL equ 0004h ; device is NUL device (reserved) 53 <1> DA_BIGDRV equ 0002h ; supports > 65535 sector per drive 54 <1> DA_ISCOT equ 0002h ; device is standard output device 55 <1> DA_ISCIN equ 0001h ; device is standard input device 56 <1> 57 <1> FASTCON_INT equ 29h ; fast console output interrupt 58 <1> 37 %include "udsc.mac" 1 <1> ; File : $UDSC.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; ENDLOG 33 <1> 34 <1> 35 <1> OLD_UDSC_BPB_LENGTH equ 25 36 <1> UDSC_BPB_LENGTH equ 53 37 <1> 38 <1> UDSC struc 0 00000000 ???????? NEXT dd ? ; link to next UDSC_ 0 00000004 ?? RUNIT db ? ; ROS drive number (0/1/80/81) 0 00000005 ?? DRIVE db ? ; logical drive 42 00000006 <1> UDSCBPB db UDSC_BPB_LENGTH dup (?) ; current BPB 0 0000003B ?? UDSCFATFLAG db ? 0 0000003C ???? OPNCNT dw ? ; # of files open on drive 0 0000003E ?? TYP db ? ; floppy drive type (0/1/2/7) 0 0000003F ???? FLAGS dw ? ; various flags for drive 0 00000041 ???? NCYL dw ? ; # of cylinders per drive 48 00000043 <1> DEVBPB db UDSC_BPB_LENGTH dup (?) ; device BPB 0 00000078 ?? LAST_TRACK db ? ; unused (last track accessed) 0 00000079 ???????? TIMER dw 2 dup (?) ; tick count for MEDCHK 51 0000007D <1> LABL db 12 dup (?) ; ASCIIZ volume label 0 00000089 ???????? SERIAL dd ? ; serial number 53 0000008D <1> FSTYPE db 9 dup (?) ; ASCIIZ "FAT12"/"FAT16" type 54 <1> UDSC ends 55 <1> 56 <1> UDSC_LENGTH equ UDSC_size 57 <1> UDSC.TIMER equ TIMER ; NASM port label 58 <1> UDSC_FM_PART equ UDSC.TIMER ; fixed media part type (always 1) 59 <1> UDSC_FM_OFFSET equ UDSC.TIMER+2 ; fixed media part offset (always 0) 60 <1> 61 <1> UDF_HARD equ 0001h ; drive is a hard disk 62 <1> UDF_CHGLINE equ 0002h ; drive support disk change line 63 <1> UDF_UNSURE equ 0004h ; drive has just been formatted 64 <1> UDF_VFLOPPY equ 0010h ; drive shares physical drive 65 <1> UDF_OWNER equ 0020h ; logical drive "owns" physical drive 66 <1> UDF_MEDIA equ 0100h ; media id is from bootsec, not default 67 <1> UDF_NOACCESS equ 0200h ; set if access to drive is disabled 68 <1> UDF_LBA equ 0400h ; drive accessed by LBA 69 <1> MAXPART equ 26 ; support up 26 drives 38 %include "config.mac" 1 <1> ; File : $CONFIG.EQU$ 2 <1> ; 3 <1> ; Description : 4 <1> ; 5 <1> ; Original Author : DIGITAL RESEARCH 6 <1> ; 7 <1> ; Last Edited By : $CALDERA$ 8 <1> ; 9 <1> ;-----------------------------------------------------------------------; 10 <1> ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 <1> ; 12 <1> ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 <1> ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 <1> ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 <1> ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 <1> ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 <1> ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 <1> ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 <1> ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 <1> ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 <1> ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 <1> ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 <1> ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 <1> ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 <1> ; CIVIL LIABILITY. 26 <1> ;-----------------------------------------------------------------------; 27 <1> ; 28 <1> ; *** Current Edit History *** 29 <1> ; *** End of Current Edit History *** 30 <1> ; 31 <1> ; $Log$ 32 <1> ; 33 <1> ; ENDLOG 34 <1> 35 <1> ; For SvarDOS kernel flavours 36 <1> COMPRESSED_FLG equ 1 37 <1> SINGLEFILE_FLG equ 2 38 <1> DEBUG_FLG equ 4 ; (obsolete, no longer used) 39 <1> TEMP_RELOC_SEG equ 2000h ; used on initial BIO relocation 40 <1> 41 <1> ; For lDOS lCFG block 42 <1> LCFG_CheckDebugger equ 20 43 <1> LCFG_DBG_CHECK equ 1 ; flag: check debugger present, run int3 44 <1> LCFG_DBG_ASSUME equ 2 ; flag: default to assume debugger present 45 <1> LCFG_DBG_ONLY_VALID equ 4 46 <1> LCFG_DBG_ONLY_IISP equ 8 47 <1> ; For the FreeDOS kernel the CONFIG block CheckDebugger value is 48 <1> ; as yet used as an ordinal: < 1, == 1, or > 1. However, we use 49 <1> ; ours here as 8 independent flags that can be set individually. 50 <1> 51 <1> DOS5 equ 0FFFFh 52 <1> 53 <1> BIO_SEG equ 70h ; BIO lives here 54 <1> 55 <1> MOVE_DOWN equ 1800h ; start relocated code 96K down 56 <1> 57 <1> NUM_BUFFS equ 4 58 <1> SIZEOF_BUFFS equ 1024+32 ; allow for large sectors during init 59 <1> 60 <1> labelsize CONFIG_BUF, byte, 0 61 <1> CONFIG_BUF_SIZE equ 8*1024 ; CONFIG.SYS read in this size chunks 62 <1> INIT_BUFFERS equ CONFIG_BUF+CONFIG_BUF_SIZE 63 <1> 64 <1> INIT_BUFFERS_SIZE equ NUM_BUFFS*SIZEOF_BUFFS 65 <1> ; reserve space for init disk buffers 66 <1> TEMP_LDT equ INIT_BUFFERS+INIT_BUFFERS_SIZE 67 <1> ; space for temp LDT's at CONFIG time 68 <1> TEMP_LDT_SIZE equ ((26*58h)/16)*16+20h 69 <1> 70 <1> DYNAMIC_DATA_END equ TEMP_LDT+TEMP_LDT_SIZE 71 <1> 72 <1> BLKDEV_LENGTH equ 9 ; # of bytes per block device init entry 73 <1> 74 <1> MAX_PATHLEN equ 65 ; Maximum Path Length 75 <1> MAX_FILELEN equ 80 ; Maximum File Length 76 <1> EOF equ 01ah ; End of File Marker 77 <1> 78 <1> MIN_NUM_BUFFS equ 3 ; minimum # of disk buffers required 79 <1> MAX_NUM_BUFFS equ 99 ; maximum # of disk buffers supported 80 <1> DEF_NUM_BUFFS equ 1 ; 1 during config to so most go hi 81 <1> 82 <1> MIN_READ_AHEAD equ 1 ; minimum read-ahead 83 <1> MAX_READ_AHEAD equ 99 ; maximum read-ahead 84 <1> DEF_READ_AHEAD equ 0 ; default no read-ahead 85 <1> ; 86 <1> ; DEF_NUM_FILES must be less than MIN_NUM_FILES in order to 87 <1> ; force two file structure allocations Windows will FAIL if this 88 <1> ; is not TRUE. 89 <1> ; 90 <1> MIN_NUM_FILES equ 8 ; minimum # of files required 91 <1> MAX_NUM_FILES equ 255 ; maximum # of files supported 92 <1> DEF_NUM_FILES equ 1 ; default # of files (+4 FCBS) 93 <1> 94 <1> MIN_NUM_FCBS equ 0 ; minimum # of fcbs required 95 <1> MAX_NUM_FCBS equ 255 ; maximum # of fcbs supported 96 <1> DEF_NUM_FCBS equ 4 ; default # of fcb handles 97 <1> 98 <1> MIN_NUM_FOPEN equ 0 ; minimum # of hashed files required 99 <1> MAX_NUM_FOPEN equ 32768 ; maximum # of hashed files supported 100 <1> DEF_NUM_FOPEN equ 4096 ; default # of files on normal system 101 <1> 102 <1> MIN_NUM_STACKS equ 8 ; on hardware interrupts swap stacks 103 <1> MAX_NUM_STACKS equ 64 ; to a dynamically allocated one 104 <1> DEF_NUM_STACKS equ 0 ; zero is a special case - no swapping 105 <1> 106 <1> MIN_SIZE_STACK equ 32 ; the dynamic stacks are this size 107 <1> MAX_SIZE_STACK equ 512 108 <1> DEF_SIZE_STACK equ 128 ; default size 109 <1> 110 <1> CFG_BUF_LEN equ 256 ; Length of CONFIG.SYS line buffer 111 <1> 112 <1> DEF_COUNTRY equ 1 ; USA 113 <1> DEF_CODEPAGE equ 0 ; No codepage 114 <1> 115 <1> DELWATCH equ 0FFFFh 116 <1> 117 <1> RLF_ENHANCED equ 00000001b ; Enhanced features are on 118 <1> RLF_INS equ 00000010b ; Insert Flag 119 <1> RLF_SEARCH equ 00000100b ; Search mode on 120 <1> RLF_MATCH equ 00001000b ; We are matching a command 121 <1> 122 <1> BUFFERS_IN_HMA equ 00000001b 123 <1> BUFFERS_IN_UMB equ 00000010b 124 <1> 125 <1> FILES_IN_HMA equ 00000001b 126 <1> FILES_IN_UMB equ 00000010b 127 <1> 128 <1> STACKS_IN_HMA equ 00000001b 129 <1> STACKS_IN_UMB equ 00000010b 130 <1> 131 <1> LASTDRV_IN_HMA equ 00000001b 132 <1> LASTDRV_IN_UMB equ 00000010b 133 <1> 134 <1> DDSCS_IN_HMA equ 00000001b 135 <1> DDSCS_IN_UMB equ 00000010b 136 <1> 137 <1> DOSDATA_IN_UMB equ 00000010b 138 <1> 139 <1> ALLOC_IN_HMA equ 00000001b 140 <1> ALLOC_IN_UMB equ 00000010b 141 <1> 142 <1> MOVE_XBDA_LOW equ 00000001b 143 <1> MOVE_XBDA_HIGH equ 00000010b 144 <1> 145 <1> labelsize DMD_ID, byte, 0 ; id code ('M' or 'Z') 146 <1> labelsize DMD_PSP, word, 1 ; owner of memory block 147 <1> labelsize DMD_LEN, word, 3 ; length of memory block 148 <1> labelsize DMD_NAME, byte, 8 ; ASCIIZ name field 149 <1> DMD_NAME_LEN equ 8 ; 8 Bytes long 150 <1> IDM equ 'M' ; not last id code 151 <1> IDZ equ 'Z' ; last id code 152 <1> 153 <1> F5KEY equ 3F00h ; keys returned by BIOS 154 <1> F8KEY equ 4200h ; in boot_options 39 %include "initmsgs.mac" ; for dos_msg error msg 1 <1> extrn _bad_break : byte 2 <1> extrn bad_break : byte 3 <1> extrn _bad_buffers : byte 4 <1> extrn bad_buffers : byte 5 <1> extrn _bad_command : byte 6 <1> extrn bad_command : byte 7 <1> extrn _bad_country : byte 8 <1> extrn bad_country : byte 9 <1> extrn _bad_drivparm : byte 10 <1> extrn bad_drivparm : byte 11 <1> extrn _bad_exec : byte 12 <1> extrn bad_exec : byte 13 <1> extrn _bad_fcbs : byte 14 <1> extrn bad_fcbs : byte 15 <1> extrn _bad_filename : byte 16 <1> extrn bad_filename : byte 17 <1> extrn _bad_files : byte 18 <1> extrn bad_files : byte 19 <1> extrn _bad_fopen : byte 20 <1> extrn bad_fopen : byte 21 <1> extrn _bad_history : byte 22 <1> extrn bad_history : byte 23 <1> extrn _bad_lastdrive : byte 24 <1> extrn bad_lastdrive : byte 25 <1> extrn _bad_shell : byte 26 <1> extrn bad_shell : byte 27 <1> extrn _bootpart_not_found_msg : byte 28 <1> extrn bootpart_not_found_msg : byte 29 <1> extrn _dos_msg : byte 30 <1> extrn dos_msg : byte 31 <1> extrn _no_char : byte 32 <1> extrn no_char : byte 33 <1> extrn _yes_char : byte 34 <1> extrn yes_char : byte 35 <1> extrn _run_char : byte 36 <1> extrn run_char : byte 37 <1> extrn _f5key_msg : byte 38 <1> extrn f5key_msg : byte 39 <1> extrn _f8key_msg : byte 40 <1> extrn f8key_msg : byte 40 41 ; MISC constants 42 CR equ 0dh ;the usual 43 LF equ 0ah 44 45 46 labelsize req1_return, byte, req_media+1 47 labelsize req1_volid, word, req_media+2 48 49 labelsize req2_bufoff, word, req_media+1 50 labelsize req2_bufseg, word, req_media+3 51 labelsize req2_bpb, word, req_media+5 52 53 labelsize req3_buffer, dword, req_media+1 54 labelsize req3_bufoff, word, req_media+1 55 labelsize req3_bufseg, word, req_media+3 56 labelsize req3_count, word, req_media+5 57 labelsize req3_sector, word, req_media+7 58 labelsize req3_volid, word, req_media+9 59 labelsize req3_sector32, word, req_media+13 60 61 62 labelsize DATTS, byte, 11 63 DA_VOLUME equ 08h 64 DA_DIR equ 10h 65 labelsize DBLOCK1H, word, 20 66 labelsize DBLOCK1, word, 26 67 labelsize DSIZE, word, 28 68 69 70 71 group CGROUP INITCODE INITDATA 72 === Switch to base=000000h -> "INITCODE" 73 section INITCODE public align=2 class=INITCODE 74 ASSUME CS:CGROUP,DS:CGROUP 75 76 VER_MUSTBE equ 1072h 77 78 %if SVARDOS eq 0 79 %undef SINGLEFILE 80 SINGLEFILE equ 1 81 %endif 82 83 84 Public detect_boot_drv 85 Public dos_version_check 86 %if SINGLEFILE eq 0 87 Public read_dos ; read BDOS from disk 88 %endif 89 90 91 dos_version_check proc 92 ;----------------- 0 00007EA2 B85244 mov ax,4452h 0 00007EA5 CD21 int 21h ; try and get DRDOS version number 0 00007EA7 7209 jc @@fail ; it's not DRDOS ! 0 00007EA9 83E0FE and ax,0fffeh ; don't be so picky 0 00007EAC 3D7210 cmp ax,VER_MUSTBE ; version check the DRDOS BDOS 0 00007EAF 7501 jne @@fail ; reject all but the one we want 0 00007EB1 C3 ret ; return now I'm happy 0 00007EB2 E9DC00 @@fail: jmp dos_load_panic 101 dos_version_check endp 102 103 104 ; Tries to detect to logical boot drive by the given phys boot drv 105 ; and a partition offset 106 detect_boot_drv proc 0 00007EB5 C43E[0000] les di,[boot_device] ; get device driver address 0 00007EB9 8A16[0000] mov dl,[boot_drv] ; get the boot drive sub unit 0 00007EBD 30F6 xor dh,dh 0 00007EBF FECE dec dh ; dh=255 0 00007EC1 8CC0 mov ax,es 0 00007EC3 09F8 or ax,di ; make sure boot device is initialised 0 00007EC5 745C jz @@error 114 @@get_device_procs: 0 00007EC7 268B4506 mov ax,[es:6 + di] ; get strategy offset 0 00007ECB A3[0000] mov [strat_off],ax 0 00007ECE 8C06[0200] mov [strat_seg],es ; get strategy segment 0 00007ED2 268B4508 mov ax,[es:8 + di] ; get interrupt offset 0 00007ED6 A3[0400] mov [intrpt_off],ax 0 00007ED9 8C06[0600] mov [intrpt_seg],es ; get interrupt segment 121 @@test_drv: 0 00007EDD BB[0C00] mov bx,offset req_hdr 0 00007EE0 885701 mov [bx+RH_UNIT],dl ; save logical unit to use 0 00007EE3 C6470202 mov byte [bx+RH_CMD],CMD_BUILD_BPB 0 00007EE7 E8B200 call device_request ; tell it to build a BPB 0 00007EEA 7302 jnc @@bpb_ok ; BPB successfully built 0 00007EEC EB2A jmp @@next_drv ; if not, try next drive 128 @@bpb_ok: 0 00007EEE 3A16[0000] cmp dl,[boot_drv] 0 00007EF2 7502 jne @@compare_part_off 0 00007EF4 88D6 mov dh,dl ; dh=boot_drv 132 @@compare_part_off: 0 00007EF6 C47F12 les di,[bx+RH2_BPB] 0 00007EF9 A0[0000] mov al, [init_int13_unit] 135 ; magic: poke into the UPB structure around the BPB 136 UDSC.UDSCBPB equ UDSCBPB ; NASM port label 137 UDSC.RUNIT equ RUNIT ; NASM port label 0 00007EFC 263845FE cmp byte ptr [es:- UDSC.UDSCBPB + UDSC.RUNIT + di], al 0 00007F00 7516 jne @@next_drv 0 00007F02 A1[0800] mov ax,[part_off] 0 00007F05 26394511 cmp word ptr [es:BPB_HIDDEN + di],ax 0 00007F09 750D jne @@next_drv 0 00007F0B A1[0A00] mov ax,[part_off+2] 0 00007F0E 26394513 cmp word ptr [es:BPB_HIDDEN+2 + di],ax 0 00007F12 7504 jne @@next_drv 0 00007F14 88D6 mov dh,dl 0 00007F16 EB06 jmp @@done 148 @@next_drv: 0 00007F18 FEC2 inc dl ; increase log drv num 0 00007F1A 7402 jz @@done 0 00007F1C EBBF jmp @@test_drv 152 @@done: 0 00007F1E 80FEFF cmp dh,255 0 00007F21 7507 jne @@store_boot_drv ; boot drv found? 155 @@error: 0 00007F23 BA[0000] mov dx,offset bootpart_not_found_msg 0 00007F26 E80C00 call bio_output_str 158 %if SINGLEFILE eq 1 0 00007F29 C3 ret 160 %else 161 mov dx,offset dos_msg 162 jmp dos_load_panic ; fatal error for dual-file kernel 163 %endif 164 @@store_boot_drv: 0 00007F2A 88F2 mov dl,dh 0 00007F2C 8816[0000] mov [boot_drv],dl 0 00007F30 8816[0000] mov [init_drv],dl 0 00007F34 C3 ret 169 detect_boot_drv endp 170 171 172 ;-------- 173 ; Print '$' terminated message at offset DX to console without using the BDOS 174 ; 175 bio_output_str proc 0 00007F35 50 push ax 0 00007F36 53 push bx 0 00007F37 56 push si 0 00007F38 57 push di 0 00007F39 06 push es 0 00007F3A C43E[0000] les di,[resdev_chain] ; get first device driver address 182 @@dev_scan: 183 DEVHDR.ATTRIB equ ATTRIB ; NASM port label 0 00007F3E 26F745040080 test word [es:di+DEVHDR.ATTRIB],DA_CHARDEV 0 00007F44 7408 jz @@dev_next ; skip if not a character device 0 00007F46 26F745040200 test word [es:di+DEVHDR.ATTRIB],DA_ISCOT 0 00007F4C 7505 jnz @@dev_found ; skip if console device found 188 @@dev_next: 0 00007F4E 26C43D les di,[es:di] ; get next device 0 00007F51 EBEB jmp @@dev_scan 191 @@dev_found: 0 00007F53 268B4506 mov ax,[es:6 + di] ; get strategy offset 0 00007F57 A3[0000] mov [strat_off],ax 0 00007F5A 8C06[0200] mov [strat_seg],es ; get strategy segment 0 00007F5E 268B4508 mov ax,[es:8 + di] ; get interrupt offset 0 00007F62 A3[0400] mov [intrpt_off],ax 0 00007F65 8C06[0600] mov [intrpt_seg],es ; get interrupt segment 198 0 00007F69 BB[0C00] mov bx,offset req_hdr 0 00007F6C C6470208 mov byte [bx+RH_CMD],CMD_OUTPUT ; write to console 0 00007F70 C6071E mov byte [bx+RH_LEN],RH4_LEN ; set request header length 0 00007F73 89570E mov [bx+RH4_BUFOFF],dx ; set address of string 0 00007F76 8C5F10 mov [bx+RH4_BUFSEG],ds 0 00007F79 C74712FFFF mov word [bx+RH4_COUNT],-1 0 00007F7E 89D6 mov si,dx ; now find the end of the string 206 @@count_chars: 0 00007F80 FF4712 inc word [bx+RH4_COUNT] ; print another char 0 00007F83 AC lodsb ; examine the next one 0 00007F84 3C24 cmp al,'$' ; terminating char ? 0 00007F86 75F8 jnz @@count_chars 0 00007F88 E81100 call device_request ; call the console driver 0 00007F8B 07 pop es 0 00007F8C 5F pop di 0 00007F8D 5E pop si 0 00007F8E 5B pop bx 0 00007F8F 58 pop ax 0 00007F90 C3 ret 218 bio_output_str endp 219 220 221 public dos_load_panic 222 223 dos_load_panic proc ; any error has occurred loading the BDOS 0 00007F91 0E push cs 0 00007F92 1F pop ds 0 00007F93 BA[0000] mov dx,offset dos_msg 0 00007F96 E89CFF call bio_output_str 0 00007F99 FB sti 229 @@forever: 0 00007F9A EBFE jmp @@forever ; wait for reboot 231 dos_load_panic endp 232 233 234 device_request: ; general device driver interface 235 ;-------------- 236 ; entry: BX -> request header 237 ; exit: CY = 1 if error 238 0 00007F9C 1E push ds 0 00007F9D 06 push es 0 00007F9E 1E push ds 0 00007F9F 07 pop es 0 00007FA0 8E1E[0200] mov ds,[strat_seg] 0 00007FA4 2EFF1E[0000] call far [cs:strat_ptr] 0 00007FA9 2EFF1E[0400] call far [cs:intrpt_ptr] 0 00007FAE 07 pop es 0 00007FAF 1F pop ds 0 00007FB0 F747030080 test word [bx+RH_STATUS],RHS_ERROR 0 00007FB5 7502 jnz devreq_err 0 00007FB7 F8 clc 0 00007FB8 C3 ret 252 devreq_err: 0 00007FB9 F9 stc 0 00007FBA C3 ret 255 256 %if SINGLEFILE eq 0 257 ;-------- 258 read_dos: ; read in the BDOS 259 ;-------- 260 call login_drive ; build BPB for the boot drive 261 mov si,offset dos_name ; get name of file to open 262 call open_file ; open the BDOS file 263 call read_file ; read in the system file 264 ret 265 266 login_drive: 267 ;----------- 268 les di,[boot_device] ; get device driver address 269 mov dl,[boot_drv] ; get the boot drive sub unit 270 mov bx,offset req_hdr 271 mov [bx+RH_UNIT],dl ; save logical unit to use 272 mov byte [bx+RH_CMD],CMD_BUILD_BPB 273 call device_request ; tell it to build a BPB 274 jnc login_drive10 275 jmp dos_load_panic 276 login_drive10: 277 push ds 278 push si 279 push ds 280 pop es 281 mov di,offset local_bpb ; ES:DI -> local BPB copy 282 mov cx,BPB_LENGTH 283 lds si,[bx+RH2_BPB] ; copy BPB to local memory 284 rep movsb 285 pop si 286 pop ds 287 288 ; Now we have to figure out whether the media uses 12 or 16 bit FATs. 289 ; To that end, we need to compute the # of clusters on the drive: 290 291 cmp word [BT_dirsize],0 ; check for FAT32 file system 292 jnz login_drive20 ; fixed root dir, FAT12/16 293 mov word [fattype],2 ; this is probably a FAT32 drive 294 mov ax,[BT_big_fat_size] 295 mov [nfatsecs],ax 296 mov ax,[BT_big_fat_size+2] 297 mov [nfatsecs+2],ax 298 ret 299 login_drive20: 300 mov word [fattype],0 ; assume 12 bit FAT 301 302 mov al,[BT_nfats] ; compute FAT size 303 mov ah,0 ; AX = # of FAT copies (usually 2) 304 mul word [BT_fat_size] ; AX/DX = size of FAT in sectors 305 306 add ax,[BT_reserved_sectors] ; add in bootstrap sectors 307 adc dx,0 308 mov cx,ax ; CX/BP = sector address of root dir 309 mov bp,dx 310 311 mov ax,32 ; compute root directory size 312 mul word [BT_dirsize] ; AX/DX = bytes in directory 313 mov bx,[BT_bytes_per_sector] 314 dec bx ; BX = sector size - 1 for rounding 315 add ax,bx ; round up to next sector size 316 adc dx,0 317 inc bx ; BX = sector size in bytes 318 div bx ; AX = # of root directory sectors 319 add cx,ax ; CX/BP = sectors before data area 320 adc bp,0 321 322 mov ax,[BT_total_sectors] ; AX/DX = total disk size in sectors 323 sub dx,dx 324 test ax,ax ; is it actually larger than 65535? 325 jnz dev_small ; no, AX/DX is correct 326 mov ax,[BT_total_long] ; else get real size from extension 327 mov dx,[BT_total_long+2] 328 dev_small: ; AX/DX = disk size in sectors 329 sub ax,cx ; AX/DX = data sectors 330 sbb dx,bp 331 ; now convert this to clusters 332 mov bl,[BT_sctr_per_cluster] 333 mov bh,0 ; BX = sectors per clusters 334 div bx ; AX = # of data clusters 335 inc ax 336 inc ax ; cluster 0,1 are reserved 337 cmp ax,0FF6h ; is this too large for 12 bits? 338 jbe dev_12bit ; skip if 12 bits will do 339 mov word [fattype],1 ; else we use 16 bits 340 dev_12bit: 341 mov ax,[BT_fat_size] 342 mov [nfatsecs],ax 343 xor ax,ax 344 mov [nfatsecs+2],ax 345 ret 346 347 348 open_file: ; open BDOS system file 349 ;--------- 350 ; entry: SI -> 11 byte file name 351 352 cmp word [fattype],2 ; booting from a FAT32 drive? 353 je open_file10 ; yes 354 xor ax,ax 355 push ax 356 mov al,[BT_nfats] 357 cbw 358 push ax 359 push word [nfatsecs+2] 360 push word [nfatsecs] 361 sub sp,8 ; reserve space on stack 362 ; mul BT_fat_size ; DX:AX = # FAT sectors 363 call mul32 364 pop ax 365 pop dx ; DX:AX = # FAT sectors 366 add sp,12 ; clean up the stack 367 mov cx,ax ; BP:CX = rel_sctr dir start 368 mov bp,dx 369 mov dx,[BT_dirsize] ; dx = # entries to scan 370 jmp open_f1 371 open_file10: 372 mov bp,[BT_fs_root+2] ; FAT32 root dir cluster 373 mov cx,[BT_fs_root] 374 open_file15: 375 mov [start_cluster+2],bp 376 mov [start_cluster],cx 377 call clus2sec 378 xor ah,ah 379 mov al,[BT_sctr_per_cluster] 380 ; cbw 381 mul word [BT_bytes_per_sector] 382 mov bx,32 383 div bx 384 open_f1: ; CX = current dir sector 385 ; DX = current dir count 386 ; SI -> file name 387 push bp 388 push cx 389 push dx 390 push si 391 push ds 392 pop es ; ES:BX -> sector buffer 393 mov bx,offset sector_buffer 394 mov dx,1 ; read one directory sector 395 call rd_sector_rel ; via disk driver 396 pop si 397 pop dx 398 pop cx 399 pop bp 400 ; inc cx ; increment sector for next time 401 add cx,1 ; increment sector for next time 402 adc bp,0 403 404 sub bx,bx ; start at beginning of sector 405 open_f2: 406 lea di,[sector_buffer + bx] ; ES:DI -> directory entry 407 push si 408 push di 409 push cx ; save name ptr and count 410 push ds 411 pop es 412 mov cx,11 413 repe cmpsb ; check if name matches 414 pop cx 415 pop di 416 pop si 417 jne open_f3 ; skip if name doesn't match 418 test byte [DATTS + di],DA_DIR+DA_VOLUME 419 jz open_foundit ; skip if matches 420 open_f3: 421 dec dx ; count down root directory entries 422 ; jz open_fail ; skip if root directory done 423 jz open_f4 ; skip if end of root dir or cluster reached 424 add bx,32 ; next entry in directory sector 425 cmp bx,[BT_bytes_per_sector] ; sector complete? 426 jb open_f2 ; loop back while more 427 jmp open_f1 ; read next directory sector 428 open_f4: 429 cmp word [fattype],2 ; FAT32 root dir? 430 jne open_fail ; no, reached end of root dir 431 mov bp,[start_cluster+2] ; else look for next dir cluster 432 mov cx,[start_cluster] 433 call next_cluster ; find next cluster in chain 434 jc open_fail ; already at last root dir cluster 435 jmp open_file15 436 437 open_fail: ; file not found 438 jmp dos_load_panic 439 440 open_foundit: ; found the open file handle 441 mov ax,[DSIZE + di] ; get length of dosfile 442 mov dx,[DSIZE+2 + di] 443 mov cx,[BT_bytes_per_sector] ; in sectors 444 div cx 445 ; cmp dx,0 ; any remainder? 446 ; jne open_found10 ; no 447 inc ax ; round to whole sectors 448 open_found10: 449 mov [dosfile_size],ax ; and save it 450 mov ax,[DBLOCK1 + di] ; get first disk block 451 mov [start_cluster],ax ; save starting cluster 452 xor ax,ax 453 cmp word [fattype],2 ; FAT32 drive? 454 jne open_found15 ; no, then skip high word of cluster 455 mov ax,[DBLOCK1H + di] 456 open_found15: 457 mov [start_cluster+2],ax 458 xor ax,ax 459 ret ; return success 460 461 462 read_file: ; read BDOS files into memory at MEM_CURRENT:0000 463 ;--------- 464 mov ax,[current_dos] ; Get the Segment address to 465 mov [dta_seg],ax ; load the BDOS at 466 sub ax,ax 467 mov [dta_off],ax 468 rd_file1: 469 mov word [cluster_count],1 ; we can read at least one cluster 470 mov cx,[start_cluster] 471 mov bp,[start_cluster+2] 472 rd_file2: ; check if next cluster contiguous 473 push bp 474 push cx ; save current cluster number 475 call next_cluster ; get link to next cluster 476 pop dx ; get previous cluster # 477 pop ax 478 ; inc dx ; is current cluster contiguous? 479 add dx,1 ; is current cluster contiguous? 480 adc ax,0 481 cmp cx,dx ; contiguos if BP:CX == AX:DX 482 jne rd_file3 ; no, need a separate read 483 cmp bp,ax 484 jne rd_file3 485 inc word [cluster_count] ; else read one more cluster 486 jmp rd_file2 ; try again with next cluster 487 rd_file3: ; BP:CX = next chain, multi cluster read 488 push bp 489 push cx ; save start of next chain 490 les bx,[dta_ptr] ; ES:BX -> transfer address 491 mov cx,[start_cluster] ; previous contiguous chain starts here 492 mov bp,[start_cluster+2] 493 mov dx,[cluster_count] ; length of chain in clusters 494 call rd_cluster ; read DX clusters 495 mov al,[BT_sctr_per_cluster] 496 mov ah,0 ; AX = sectors per cluster 497 mul word [cluster_count] ; AX = sectors in chain to read 498 mul word [BT_bytes_per_sector] ; AX = bytes in chain to read 499 add [dta_off],ax 500 pop cx ; BP:CX = next (noncontiguous) cluster 501 pop bp 502 mov [start_cluster],cx ; start of new chain 503 mov [start_cluster+2],bp 504 inc cx ; was it end of file cluster number? 505 jnz rd_file1 ; go back for more if not 506 inc bp 507 jnz rd_file1 508 ; else all clusters done 509 ret 510 511 512 get_FAT_byte: 513 ;------------ 514 ; entry: BX = offset into FAT 515 516 mov ax,bx ; BX = offset into FAT 517 sub dx,dx ; AX/DX = 32 bit offset 518 div word [BT_bytes_per_sector] ; AX = sector, DX = offset in sector 519 push dx ; save offset in sector 520 xor dx,dx 521 call locate_FAT ; read FAT sector AX 522 pop bx ; BX = offset in FAT sector 523 mov al,[sector_buffer + bx] ; get byte from FAT buffer 524 ret 525 526 527 locate_FAT: 528 ;---------- 529 ; entry: DX:AX = FAT sector to locate 530 531 cmp ax,[current_fatsec] ; AX = sector offset into FAT 532 jne locate_fat10 533 cmp dx,[current_fatsec+2] 534 je locate_FAT_match ; O.K. if same as last time 535 locate_fat10: 536 mov [current_fatsec],ax ; set new sector for next time 537 mov [current_fatsec+2],dx 538 push cx 539 push si ; preserve FAT index 540 mov bp,dx 541 mov cx,ax ; BP:CX = sector number 542 mov bx,offset sector_buffer 543 push ds 544 pop es ; ES:BX -> sector buffer 545 mov dx,1 ; DX = single sector 546 call rd_sector_rel ; read FAT sector 547 pop si 548 pop cx ; restore FAT index 549 550 locate_FAT_match: ; return with right sector in buffer 551 ret 552 553 554 555 ; reads sectors relative to start of DOS area on disk (start=0) 556 ; same parameters as rd_sector 557 rd_sector_rel: 558 ;------------- 559 ; entry: BP:CX = sector address relative to first FAT sector (32-bit) 560 ; DX = sector count 561 562 ; sub bp,bp ;overflow word = 0 563 add cx,[BT_reserved_sectors] 564 adc bp,0 565 ; jmp rd_sector 566 567 568 ; reads absolute sectors from hard disk using rom bios 569 rd_sector: 570 ;--------- 571 ; entry: DX = number of sectors 572 ; ES:BX -> data transfer buffer 573 ; DS -> program global data segment 574 ; CX/BP = absolute sector # (32 bit) (low/high) 575 576 push cx 577 push dx ; save parameters 578 mov [req3_bufoff],bx ; save transfer offset 579 mov [req3_bufseg],es ; save transfer segment 580 mov [req3_count],dx ; set sector count 581 mov bx,offset req_hdr ; BX -> request header 582 mov byte [bx+RH_CMD],CMD_INPUT ; read from disk device 583 mov [req3_sector],cx ; set requested sector address 584 mov byte [req_hdr],RH4_LEN 585 mov [req3_sector32],cx ; with 32 sector number 586 mov [req3_sector32+2],bp 587 test bp,bp ; large sector number? 588 jz rd_sec1 ; no, normal request header 589 mov word [req3_sector],0FFFFh ; mark as a large request 590 rd_sec1: 591 call device_request ; tell it to read sectors 592 jnc rd_sec2 593 jmp dos_load_panic 594 rd_sec2: 595 pop cx 596 pop dx 597 ret ; if CY, AH=error code 598 599 600 rd_cluster: 601 ;---------- 602 ; entry: BP:CX = DOS cluster number. 603 ; DX = cluster count 604 ; ES:BX -> transfer buffer 605 606 push bx 607 push es 608 609 mov al,[BT_sctr_per_cluster] 610 mov ah,0 ; AX = sectors per cluster 611 mul dx ; AX = sectors in all clusters 612 cmp ax,[dosfile_size] ; is this longer than actual file size? 613 jbe rd_cluster10 ; no 614 mov ax,[dosfile_size] ; do not read more than remaining 615 rd_cluster10: 616 sub [dosfile_size],ax ; less to read next time 617 push ax ; save the sector count 618 619 sub cx,2 ; cluster 2 is data area start 620 sbb bp,0 621 xor ax,ax 622 push ax 623 mov al,[BT_sctr_per_cluster] 624 ; cbw 625 xor ah,ah 626 push ax 627 push bp 628 push cx 629 sub sp,8 ; reserve space on stack 630 ; mul cx ; AX,DX = relative sector # 631 call mul32 632 pop ax 633 pop dx ; DX:AX = relative sector # 634 add sp,12 ; clean up the stack 635 mov cx,ax 636 mov bp,dx ; CX,BP = data area sector # 637 638 push bp 639 xor ax,ax 640 push ax 641 mov al,[BT_nfats] ; compute FAT size 642 mov ah,0 ; AX = # of FAT copies (usually 2) 643 push ax 644 push word [nfatsecs+2] 645 push word [nfatsecs] 646 sub sp,8 ; reserve space on stack 647 ; mul BT_fat_size ; AX/DX = size of FAT in sectors 648 call mul32 649 pop ax 650 pop dx ; DX:AX = size of FAT in sectors 651 add sp,12 ; clean up the stack 652 pop bp 653 add cx,ax 654 adc bp,dx ; CX,BP = end of FAT sectors 655 656 mov ax,32 657 mul word [BT_dirsize] ; AX,DX = bytes in root directory 658 mov bx,[BT_bytes_per_sector] 659 dec bx 660 add ax,bx ; round up directory size 661 adc dx,0 662 inc bx 663 div bx ; AX = root directory sectors 664 add cx,ax 665 adc bp,0 ; add root directory size 666 667 add cx,[BT_reserved_sectors] ; add in boot sector(s) 668 adc bp,0 669 670 pop dx 671 pop es 672 pop bx ; sector count, disk address 673 674 jmp rd_sector ; DX secs from CX/BP to ES:BX 675 676 677 ; Finds the NEXT cluster after the one passed in CX in an allocation 678 ; chain by using the FAT. Returns the carry set if the end of chain 679 ; mark is found, otherwise returns the NEW cluster # in CX. 680 next_cluster: 681 ;------------ 682 push dx 683 push bx ; save some registers 684 cmp word [fattype],0 ; check if this is 12 bit media 685 je next_cluster12 ; skip if old fashioned 12 bit 686 xor ax,ax 687 push ax 688 cmp word [fattype],1 ; is this FAT16? 689 jne next_cluster5 ; no, it must be FAT32 690 mov ax,2 691 jmp next_cluster6 692 next_cluster5: 693 mov ax,4 694 next_cluster6: 695 push ax 696 push bp 697 push cx 698 sub sp,8 ; reserve space on stack 699 ; mul cx ; AX/DX = byte offset in FAT (max. 128K) 700 call mul32 701 pop ax 702 pop dx 703 add sp,12 ; clean up the stack again 704 push dx 705 push ax 706 xor ax,ax 707 push ax 708 push word [BT_bytes_per_sector] 709 sub sp,8 ; reserve space on stack 710 ; div BT_bytes_per_sector ; AX = FAT sector #, DX = byte offset 711 call div32 712 pop bx 713 add sp,2 714 pop ax 715 pop dx 716 add sp,8 ; clean up the stack 717 ; push dx ; save byte offset within sector 718 push bx ; save byte offset within sector 719 call locate_FAT ; get FAT sector AX 720 pop bx ; BX = offset within sector 721 mov cx,word ptr [sector_buffer + bx] 722 ; get 16 bit from FAT 723 xor bp,bp 724 cmp word [fattype],2 ; is this FAT32? 725 jne next_cluster7 ; no, skip high word 726 mov bp,word ptr [sector_buffer+2 + bx] 727 ; get high 16 bit from FAT 728 and bp,0FFFh ; mask out reserved high nibble 729 next_cluster7: 730 cmp cx,0FFF7h ; check if too large for # 731 ; jae next_cluster_eof ; set carry, EOF 732 jb next_cluster9 733 cmp word [fattype],2 ; FAT32? 734 jne next_cluster_eof ; no, then it is already EOF 735 cmp bp,0FFFh ; else also check high word 736 je next_cluster_eof ; set carry, EOF 737 next_cluster9: 738 clc 739 jmp next_cluster_ret ; good link 740 741 next_cluster12: ; DOS 2.x disk 742 push cx ; save cluster number 743 mov bx,cx 744 add bx,bx ; BX = cluster# * 2 745 add bx,cx ; BX = cluster# * 3 746 shr bx,1 ; BX = cluster# * 1.5 747 push bx ; save offset in the FAT 748 inc bx ; BX = offset of high byte 749 call get_FAT_byte ; get the high byte in AL 750 pop bx ; BX = offset of low byte 751 push ax ; save high byte on stack 752 call get_FAT_byte ; get the low byte in AL 753 pop bx ; pop off high byte into BL 754 mov ah,bl ; set high byte, AX = word 755 pop cx ; restore cluster number 756 shr cx,1 ; test if even or odd 757 jnc even_fat ; if even entry, done 758 mov cl,4 ; odd entry, shift down one nibble 759 shr ax,cl ; else need to justify 760 even_fat: ; even entry, strip off top bits 761 and ax,0fffh ; bx[0..11] are cluster 762 mov cx,ax ; CX = cluster number 763 xor bp,bp 764 cmp cx,0ff7h ; compare with largest legal 12 bit # 765 jae next_cluster_eof ; check for end mark 766 clc 767 jmp next_cluster_ret ; return value in CX, CY = 0 768 next_cluster_eof: 769 mov cx,-1 ; indicate end of chain 770 mov bp,-1 771 stc ; end of chain 772 next_cluster_ret: 773 pop bx 774 pop dx 775 ret 776 777 clus2sec: 778 ;---------- 779 ; entry: BP:CX = DOS cluster number 780 ; exit: BP:CX = sector number 781 782 sub cx,2 ; cluster 2 is data area start 783 sbb bp,0 784 xor ax,ax 785 push ax 786 mov al,[BT_sctr_per_cluster] 787 ; cbw 788 xor ah,ah 789 push ax 790 push bp 791 push cx 792 sub sp,8 ; reserve space on stack 793 ; mul cx ; AX,DX = relative sector # 794 call mul32 795 pop ax 796 pop dx ; DX:AX = relative sector # 797 add sp,12 ; clean up the stack 798 mov cx,ax 799 mov bp,dx ; CX,BP = data area sector # 800 801 push bp 802 xor ax,ax 803 push ax 804 mov al,[BT_nfats] ; compute FAT size 805 mov ah,0 ; AX = # of FAT copies (usually 2) 806 push ax 807 push word [nfatsecs+2] 808 push word [nfatsecs] 809 sub sp,8 ; reserve space on stack 810 ; mul BT_fat_size ; AX/DX = size of FAT in sectors 811 call mul32 812 pop ax 813 pop dx ; DX:AX = size of FAT in sectors 814 add sp,12 ; clean up the stack 815 pop bp 816 add cx,ax 817 adc bp,dx ; CX,BP = end of FAT sectors 818 ret 819 820 mul32: ; 32-bit multiplication 821 ;-------- 822 ; On Entry: 823 ; 32-bit factors on stack 824 ; space for 64-bit product reserved on stack 825 ; SP-16 826 ; On Exit: 827 ; 64-bit product on stack 828 ; SP-16 829 ; Carry flag set if result does not fit in double word 830 ; Modified registers: 831 ; AX,DX,BP,SP 832 mov bp,sp ; base address of temporary variables 833 add bp,2 834 mov ax,[10 + bp] ; multiply high word of factors 835 mul word ptr [14 + bp] 836 mov [4 + bp],ax ; store result 837 mov [6 + bp],dx 838 mov ax,[10 + bp] ; multiply high word of first factor with low word of second 839 mul word ptr [12 + bp] 840 mov [2 + bp],ax ; add result to previous 841 add [4 + bp],dx 842 adc word ptr [6 + bp],0 843 mov ax,[8 + bp] ; multiply low word of first factor with high word of second 844 mul word ptr [14 + bp] 845 add [2 + bp],ax ; add result to previous 846 adc [4 + bp],dx 847 adc word ptr [6 + bp],0 848 mov ax,[8 + bp] ; multiply low word of first factor with low word of second 849 mul word ptr [12 + bp] 850 mov [bp],ax ; add result 851 add [2 + bp],dx 852 adc word ptr [4 + bp],0 853 adc word ptr [6 + bp],0 854 cmp word ptr [4 + bp],0 ; 64-bit result? 855 jnz mul32_1 ; yes 856 cmp word ptr [6 + bp],0 857 jz mul32_2 ; no 858 mul32_1: 859 stc ; yes, set carry flag to indicate this 860 mul32_2: 861 ret 862 863 div32: ; 32-bit division 864 ;-------- 865 ; On Entry: 866 ; 32-bit dividend & divisor on stack 867 ; space for 32-bit quotient & remainder reserved on stack 868 ; SP-16 869 ; On Exit: 870 ; 32-bit quotient & remainder on stack 871 ; SP-16 872 ; Modified registers: 873 ; AX,CX,DX,BP 874 mov bp,sp ; base address of temporary variables 875 add bp,2 876 xor ax,ax ; clear work registers 877 xor dx,dx 878 mov cx,32 ; 32 bits 879 div32_loop: 880 shl word ptr [4 + bp],1 ; multiply quotient with two 881 rcl word ptr [6 + bp],1 882 shl word ptr [12 + bp],1 ; shift one bit from dividend 883 rcl word ptr [14 + bp],1 884 rcl ax,1 ; to work registers 885 rcl dx,1 886 cmp dx,[10 + bp] ; compare high word with divisor 887 jb div32_2 888 ja div32_1 889 cmp ax,[8 + bp] ; compare low word 890 jb div32_2 891 div32_1: 892 or word ptr [4 + bp],1 ; divisor fits one time 893 sub ax,[8 + bp] ; subtract divisor 894 sbb dx,[10 + bp] 895 div32_2: 896 loop div32_loop ; loop back if more bits to shift 897 mov [bp],ax ; save remainder onto stack 898 mov [2 + bp],dx 899 ret 900 901 %endif ; SINGLEFILE=0 902 903 INITCODE ends 904 905 906 ; 907 ; INITIALIZED DATA SEGMENT 908 ; ======================== === Switch to base=000000h -> "INITDATA" 909 section INITDATA public align=2 class=INITDATA 910 911 extrn resdev_chain:dword ; resident device driver root 912 extrn current_dos:word ; current BDOS segment 913 extrn boot_device:dword ; device driver we boot from 914 extrn boot_drv:byte ; boot drive 915 extrn init_drv:byte ; init drive 916 extrn init_int13_unit:byte 917 918 919 strat_ptr label dword 0 0000940A ???? strat_off dw ? 0 0000940C ???? strat_seg dw ? 922 923 intrpt_ptr label dword 0 0000940E ???? intrpt_off dw ? 0 00009410 ???? intrpt_seg dw ? 926 927 Public part_off 0 00009412 00000000 part_off dw 0,0 ; offset of boot partition 929 930 %if SINGLEFILE eq 0 931 extrn dos_name:byte ; name of BDOS file 932 933 dta_ptr label dword 934 dta_off dw ? 935 dta_seg dw ? 936 937 start_cluster dw 2 dup (?) 938 cluster_count dw ? 939 dosfile_size dw ? 940 941 current_fatsec dw -1,-1 ; no FAT sector read yet 942 fattype dw 0 ; defaults to 12 bit FAT 943 nfatsecs dw 0,0 ; number of FAT sectors (32-bit) 944 945 %endif 946 947 ; static request header for DOS device driver I/O 948 0 00009416 16 req_hdr db 22 0 00009417 ?? req_unit db ? 0 00009418 ?? req_cmd db ? 0 00009419 ???? req_status dw ? 0 0000941B ???????????????? dd 2 dup (?) 0 00009423 ?? req_media db ? 955 0000001A db 16 dup (?) 956 957 ; local copy of the BPB for the boot device 958 959 %if SINGLEFILE eq 0 960 local_bpb label byte 961 BT_bytes_per_sector dw ? 962 BT_sctr_per_cluster db ? 963 BT_reserved_sectors dw ? 964 BT_nfats db ? 965 BT_dirsize dw ? 966 BT_total_sectors dw ? 967 BT_fatid db ? 968 BT_fat_size dw ? 969 BT_sectors_per_track dw ? 970 BT_nheads dw ? 971 BT_hidden_sectors dw 2 dup (?) 972 BT_total_long dw 2 dup (?) 973 BT_big_fat_size dw 2 dup (?) 974 BT_fat_flags dw ? 975 BT_fs_version dw ? 976 BT_fs_root dw 2 dup (?) 977 BT_fs_info dw ? 978 BT_boot_backup dw ? 979 BPB_LENGTH equ (offset $ - offset local_bpb) 980 %endif 981 BPB_HIDDEN equ 17 982 983 extrn sector_buffer:byte 984 INITDATA ends 985 986 end === Trace listing source: drbio/bin/stacks.lst 1 ; File : $STACKS.ASM$ 2 ; 3 ; Description : 4 ; 5 ; Original Author : DIGITAL RESEARCH 6 ; 7 ; Last Edited By : $CALDERA$ 8 ; 9 ;-----------------------------------------------------------------------; 10 ; Copyright Work of Caldera, Inc. All Rights Reserved. 11 ; 12 ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, 13 ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. 14 ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES 15 ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF 16 ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO 17 ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE 18 ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE 19 ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, 20 ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, 21 ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, 22 ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF 23 ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 24 ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND 25 ; CIVIL LIABILITY. 26 ;-----------------------------------------------------------------------; 27 ; 28 ; *** Current Edit History *** 29 ; *** End of Current Edit History *** 30 ; 31 ; $Log$ 32 ; STACKS.ASM 1.6 93/10/26 19:08:13 33 ; Fix bug when we run out of stacks 34 ; STACKS.ASM 1.4 93/09/02 22:36:47 35 ; Add header to system allocations 36 ; ENDLOG 37 38 STACKS_IN_HMA equ 00000001b 39 STACKS_IN_UMB equ 00000010b 40 41 group CGROUP INITCODE STACKS INITDATA 42 === Switch to base=000000h -> "STACKS" 43 section STACKS public align=16 class=STACKS 44 45 Assume CS:STACKS, DS:Nothing, ES:Nothing, SS:Nothing 46 47 Public StackCode 48 StackCode: 49 50 ;************ 51 ; FIXED DATA 52 ;************ 53 0 000080C0 0000 dw 0 0 000080C2 0000 NumOfStacks dw 0 ; we have this many stacks 0 000080C4 0000 StackCB dw 0 ; NumOfStacks*8 = size of control array 0 000080C6 0000 StackSize dw 0 ; size of an individual stack 58 StackPtr label dword ; pointer to stack data 59 Public StackSeg,StackOff 0 000080C8 [4001] StackOff dw offset StackHeap wrt STACKS 0 000080CA 0000 StackSeg dw 0 0 000080CC [4001] FirstStack dw offset StackHeap wrt STACKS 0 000080CE [3801] LastStack dw offset StackHeap-STACK_CB_SIZE wrt STACKS 0 000080D0 [3801] NextStack dw offset StackHeap-STACK_CB_SIZE wrt STACKS 65 66 ;************ 67 ; FIXED DATA 68 ;************ 69 70 labelsize STACK_CB_FLAGS, word, 0 ; stack flags 71 labelsize STACK_CB_SP, word, 2 ; old stack saved here 72 labelsize STACK_CB_SS, word, 4 73 labelsize STACK_CB_TOP, word, 6 ; stack top lives here 74 STACK_CB_SIZE equ 8 75 76 STACK_FREE equ 0 ; stack is available to allocate 77 STACK_INUSE equ 1 ; stack is in use 78 STACK_OVERFLOW equ 2 ; stack has overflowed 79 80 ; 81 ; Our hardware interrupt handlers which are of the form 82 ; 83 ; call SwapStack 84 ; db 0EAh ; JMPF opcode 85 ; dd oldIntHandler 86 ; 87 ; By looking at the near return address we can find the address of the old 88 ; interrupt handler. 89 ; We try to allocate a stack from our pool of stacks, working downward to 90 ; reduce the problems of stack overflow. 91 ; 92 ; We check the top of the stack contains a pointer to our control block and 93 ; if this is invalid we assume the stack has overflowed, and try the next one. 94 ; We have no way of recovering a stack that has overflowed (eg. by zapping 95 ; everything below us on exit). 96 ; 97 ; If we run out of stacks we just continue on the callers stack, rather than 98 ; halting the system. 99 ; 100 101 Int02: 0 000080D2 E86D00 call SwapStack 0 000080D5 EA db 0EAh ; JMPF 0 000080D6 08000000 i02Off dw 4*02h,0 105 106 Int08: 0 000080DA E86500 call SwapStack 0 000080DD EA db 0EAh ; JMPF 0 000080DE 20000000 i08Off dw 4*08h,0 110 111 Int09: 0 000080E2 E85D00 call SwapStack 0 000080E5 EA db 0EAh 0 000080E6 24000000 i09Off dw 4*09h,0 115 116 Int0A: 0 000080EA E85500 call SwapStack 0 000080ED EA db 0EAh ; JMPF 0 000080EE 28000000 i0AOff dw 4*0Ah,0 120 121 Int0B: 0 000080F2 E84D00 call SwapStack 0 000080F5 EA db 0EAh ; JMPF 0 000080F6 2C000000 i0BOff dw 4*0Bh,0 125 126 Int0C: 0 000080FA E84500 call SwapStack 0 000080FD EA db 0EAh ; JMPF 0 000080FE 30000000 i0COff dw 4*0Ch,0 130 131 Int0D: 0 00008102 E83D00 call SwapStack 0 00008105 EA db 0EAh ; JMPF 0 00008106 34000000 i0DOff dw 4*0Dh,0 135 136 Int0E: 0 0000810A E83500 call SwapStack 0 0000810D EA db 0EAh ; JMPF 0 0000810E 38000000 i0EOff dw 4*0Eh,0 140 141 Int70: 0 00008112 E82D00 call SwapStack 0 00008115 EA db 0EAh ; JMPF 0 00008116 C0010000 i70Off dw 4*70h,0 145 146 Int72: 0 0000811A E82500 call SwapStack 0 0000811D EA db 0EAh ; JMPF 0 0000811E C8010000 i72Off dw 4*72h,0 150 151 Int73: 0 00008122 E81D00 call SwapStack 0 00008125 EA db 0EAh ; JMPF 0 00008126 CC010000 i73Off dw 4*73h,0 155 156 Int74: 0 0000812A E81500 call SwapStack 0 0000812D EA db 0EAh ; JMPF 0 0000812E D0010000 i74Off dw 4*74h,0 160 161 Int76: 0 00008132 E80D00 call SwapStack 0 00008135 EA db 0EAh ; JMPF 0 00008136 D8010000 i76Off dw 4*76h,0 165 166 Int77: 0 0000813A E80500 call SwapStack 0 0000813D EA db 0EAh ; JMPF 0 0000813E DC010000 i77Off dw 4*77h,0 170 171 SwapStack proc near 172 ; On Entry: 173 ; As per INT except word on stack from near call, which gives old vector 174 ; On Exit: 175 ; None 176 ; 0 00008142 FA cli ; just in case 0 00008143 55 push bp 0 00008144 56 push si ; save work registers 0 00008145 57 push di 0 00008146 E80000 call SwapStack05 ; get offset of our code in segment 182 SwapStack05: 0 00008149 5F pop di 0 0000814A 81EF8900 sub di,(SwapStack05-StackCode) ; to locate the stack variables 185 ; mov si,[cs:NextStack-StackCode] ; start looking here for a stack 0 0000814E 2E8B7510 mov si,[cs:(NextStack-StackCode) + di] ; start looking here for a stack 187 SwapStack10: 0 00008152 2E833C00 cmp word [cs:STACK_CB_FLAGS + si],STACK_FREE 0 00008156 7543 jne SwapStack20 ; use this stack if possible 0 00008158 2E8B6C06 mov bp,[cs:STACK_CB_TOP + si] ; get the top of this stack 0 0000815C 2E3B7600 cmp si,word ptr [cs:bp] ; does the check match ? 0 00008160 7539 jne SwapStack20 ; no, try the next one 193 ; mov [cs:NextStack-StackCode],si ; remember where we are 0 00008162 2E897510 mov [cs:(NextStack-StackCode) + di],si ; remember where we are 0 00008166 2EC7040100 mov word [cs:STACK_CB_FLAGS + si],STACK_INUSE 0 0000816B 2E8C5404 mov [cs:STACK_CB_SS + si],ss ; save old stack 0 0000816F 2E896402 mov [cs:STACK_CB_SP + si],sp 198 0 00008173 89E5 mov bp,sp 0 00008175 875E06 xchg bx,word ptr [6 + bp] ; BX = return address, BX saved 201 0 00008178 8CCD mov bp,cs 0 0000817A 8ED5 mov ss,bp 0 0000817C 2E8B6406 mov sp,[cs:STACK_CB_TOP + si] ; switch stacks 0 00008180 9C pushf 0 00008181 2EFF5F01 call far [cs:1 + bx] ; fake an INT to old handler 0 00008185 2E8E5404 mov ss,[cs:STACK_CB_SS + si] 0 00008189 2E8B6402 mov sp,[cs:STACK_CB_SP + si] ; swap back to the original stack 0 0000818D 2EC7040000 mov word [cs:STACK_CB_FLAGS + si],STACK_FREE 210 ; mov [cs:NextStack-StackCode],si ; update in case we were nested 0 00008192 2E897510 mov [cs:(NextStack-StackCode) + di],si ; update in case we were nested 0 00008196 5F pop di 0 00008197 5E pop si ; restore registers 0 00008198 5D pop bp 0 00008199 5B pop bx ; (was return address, now saved BX) 0 0000819A CF iret ; exit interrupt handler 217 218 SwapStack20: 0 0000819B 83EE08 sub si,STACK_CB_SIZE ; it's not, so try the next 220 ; cmp si,[cs:FirstStack-StackCode] ; if there is one 0 0000819E 2E3B750C cmp si,[cs:(FirstStack-StackCode) + di] ; if there is one 0 000081A2 73AE jae SwapStack10 0 000081A4 5F pop di 0 000081A5 5E pop si ; restore registers 0 000081A6 5D pop bp 0 000081A7 C3 ret ; back to JMPF as we can't swap stacks 227 228 SwapStack endp 229 0 000081A8 0800[1600] i19Table dw 4*02H, offset i02Off wrt STACKS 0 000081AC 2000[1E00] dw 4*08H, offset i08Off wrt STACKS 0 000081B0 2400[2600] dw 4*09H, offset i09Off wrt STACKS 0 000081B4 2800[2E00] dw 4*0AH, offset i0AOff wrt STACKS 0 000081B8 2C00[3600] dw 4*0BH, offset i0BOff wrt STACKS 0 000081BC 3000[3E00] dw 4*0CH, offset i0COff wrt STACKS 0 000081C0 3400[4600] dw 4*0DH, offset i0DOff wrt STACKS 0 000081C4 3800[4E00] dw 4*0EH, offset i0EOff wrt STACKS 0 000081C8 C001[5600] dw 4*70H, offset i70Off wrt STACKS 0 000081CC C801[5E00] dw 4*72H, offset i72Off wrt STACKS 0 000081D0 CC01[6600] dw 4*73H, offset i73Off wrt STACKS 0 000081D4 D001[6E00] dw 4*74H, offset i74Off wrt STACKS 0 000081D8 D801[7600] dw 4*76H, offset i76Off wrt STACKS 0 000081DC DC01[7E00] dw 4*77H, offset i77Off wrt STACKS 0 000081E0 0000 dw 0 245 246 Int19: 247 ; Trap the Int 19 reboot and restore any hardware vectors we have hooked 0 000081E2 FA cli 0 000081E3 FC cld 0 000081E4 31C0 xor ax,ax 0 000081E6 8EC0 mov es,ax ; ES = interrupt vectors 0 000081E8 0E push cs 0 000081E9 1F pop ds 254 Assume DS:STACKS 0 000081EA 8D36[E800] lea si,[i19Table] ; DS:SI -> table to restore 256 Int1910: 0 000081EE AD lodsw 0 000081EF 97 xchg ax,di ; ES:DI -> address to restore to 0 000081F0 AD lodsw 0 000081F1 96 xchg ax,si ; CS:SI -> value to restore 0 000081F2 A5 movsw 0 000081F3 A5 movsw 0 000081F4 96 xchg ax,si ; restore position in table 0 000081F5 833C00 cmp word ptr [si],0 0 000081F8 75F4 jne Int1910 0 000081FA EA db 0EAh ; JMPF 0 000081FB 64000000 i19Off dw 4*19h,0 268 0 000081FF 90 even ; word align our stacks 270 271 StackHeap label word ; dynamically build stack CB's here 272 273 RELOCATE_SIZE equ ($ - StackCode) 274 275 STACKS ends 276 === Switch to base=000000h -> "INITCODE" 277 section INITCODE public align=16 class=INITCODE 278 279 Assume CS:CGROUP, DS:CGROUP, ES:Nothing, SS:Nothing 280 281 extrn alloc_hiseg:near 282 extrn alloc_upper:near 283 extrn alloc_seg:near 284 extrn SetupHMA:near 285 extrn AllocHMA:near 286 287 Public InitStacks 288 ;========== 289 InitStacks: 290 ;========== 291 ; On Entry: 292 ; CX = number of stacks 293 ; DX = size of stack 294 ; Values are checked 295 ; On Exit: 296 ; None 297 ; 0 00007FC0 1E push ds 0 00007FC1 06 push es 0 00007FC2 42 inc dx ; let's ensure stacks are WORD 0 00007FC3 83E2FE and dx,0FFFEh ; aligned... 0 00007FC6 890E[0200] mov [NumOfStacks],cx 0 00007FCA 8916[0600] mov [StackSize],dx 0 00007FCE B80800 mov ax,STACK_CB_SIZE 0 00007FD1 F7E1 mul cx ; AX = bytes in control area 0 00007FD3 A3[0400] mov [StackCB],ax 0 00007FD6 0106[0E00] add [LastStack],ax 0 00007FDA 0106[1000] add [NextStack],ax 0 00007FDE 0106[0800] add [StackOff],ax ; adjust our pointers 0 00007FE2 91 xchg ax,cx ; AX = NumOfStacks 0 00007FE3 F726[0600] mul word [StackSize] ; AX bytes are required for stacks 0 00007FE7 0306[0800] add ax,[StackOff] ; add to start of stacks 0 00007FEB 50 push ax ; save length in bytes 314 0 00007FEC F606[0000]01 test byte [stacksIn],STACKS_IN_HMA ; HMA usage enables for stacks? 0 00007FF1 7413 jz InitStacks04 0 00007FF3 E8[0000] call SetupHMA ; make sure HMA chain is established 0 00007FF6 59 pop cx ; CX = bytes wanted 0 00007FF7 51 push cx 0 00007FF8 BAFFFF mov dx,0FFFFh ; anywhere is OK 0 00007FFB E8[0000] call AllocHMA ; ES:DI -> allocated data 0 00007FFE 58 pop ax 0 00007FFF 50 push ax 0 00008000 7204 jc InitStacks04 ; if high mem allocation failed, try upper 0 00008002 8CC0 mov ax,es ; AX = segment 0 00008004 EB1A jmp InitStacks07 327 InitStacks04: 0 00008006 83C00F add ax,15 ; allow for rounding 0 00008009 B104 mov cl,4 0 0000800B D3E8 shr ax,cl ; convert it to para's 0 0000800D B253 mov dl,'S' ; allocation signature is Stacks 0 0000800F F606[0000]02 test byte [stacksIn],STACKS_IN_UMB ; UMB usage enables for stacks? 0 00008014 7405 jz InitStacks05 0 00008016 E8[0000] call alloc_upper ; yes, try to allocate upper memory 0 00008019 7303 jnc InitStacks06 ; if this fails 336 InitStacks05: 0 0000801B E8[0000] call alloc_seg ; try to allocate low mem 338 InitStacks06: 0 0000801E 31FF xor di,di 340 InitStacks07: 0 00008020 59 pop cx ; CX = length in bytes 0 00008021 57 push di 0 00008022 A3[0A00] mov [StackSeg],ax ; remember where 0 00008025 893E[0800] mov [StackOff],di 0 00008029 8EC0 mov es,ax 346 Assume ES:STACKS 0 0000802B B0CC mov al,0CCh ; fill stacks with CC for debug 0 0000802D F3AA rep stosb 0 0000802F 5F pop di 0 00008030 BE[0000] mov si,offset StackCode wrt CGROUP 0 00008033 B94001 mov cx,RELOCATE_SIZE 0 00008036 F3A4 rep movsb ; relocate the code 353 0 00008038 8B1E[0C00] mov bx,[FirstStack] ; lets start building the CB's 0 0000803C 8B0E[0200] mov cx,[NumOfStacks] 0 00008040 C536[0800] lds si,[StackPtr] ; SI = bottom of stack area 357 Assume DS:STACKS 0 00008044 83EE02 sub si,2 ; we want the word below top of stack 359 InitStacks10: 0 00008047 0336[0600] add si,[StackSize wrt STACKS] ; SI = top of stack 0 0000804B C7070000 mov word [STACK_CB_FLAGS + bx],STACK_FREE 0 0000804F 897706 mov [STACK_CB_TOP + bx],si ; set top of stack 0 00008052 891C mov word ptr [si],bx ; set backlink 0 00008054 83C308 add bx,STACK_CB_SIZE ; onto next control block 0 00008057 E2EE loop InitStacks10 366 0 00008059 31C0 xor ax,ax 0 0000805B 8ED8 mov ds,ax 369 Assume DS:Nothing 0 0000805D FA cli 0 0000805E BE[C100] mov si,offset iTable wrt CGROUP ; now we fixup the vectors 372 InitStacks20: 0 00008061 2E8B04 mov ax,word ptr [cs:0 + si] ; ES:AX = entry point 0 00008064 2E8B7C02 mov di,word ptr [cs:2 + si] ; ES:DI = fixup location 0 00008068 268B1D mov bx,word ptr [es:di] ; get the vector to fixup 0 0000806B 8707 xchg ax,word ptr [bx] ; set entry offset while saving 0 0000806D AB stosw ; previous handler offset 0 0000806E 8CC0 mov ax,es 0 00008070 874702 xchg ax,word ptr [2 + bx] ; now the segment 0 00008073 AB stosw 0 00008074 83C604 add si,2*2 ; onto next entry 0 00008077 2E833C00 cmp word ptr [cs:0 + si],0 ; (zero terminated) 0 0000807B 75E4 jnz InitStacks20 0 0000807D FB sti 385 InitStacks30: 0 0000807E 07 pop es 0 0000807F 1F pop ds 0 00008080 C3 ret 389 0 00008081 [1200][1600] iTable dw offset Int02 wrt STACKS, offset i02Off wrt STACKS 0 00008085 [1A00][1E00] dw offset Int08 wrt STACKS, offset i08Off wrt STACKS 0 00008089 [2200][2600] dw offset Int09 wrt STACKS, offset i09Off wrt STACKS 0 0000808D [2A00][2E00] dw offset Int0A wrt STACKS, offset i0AOff wrt STACKS 0 00008091 [3200][3600] dw offset Int0B wrt STACKS, offset i0BOff wrt STACKS 0 00008095 [3A00][3E00] dw offset Int0C wrt STACKS, offset i0COff wrt STACKS 0 00008099 [4200][4600] dw offset Int0D wrt STACKS, offset i0DOff wrt STACKS 0 0000809D [4A00][4E00] dw offset Int0E wrt STACKS, offset i0EOff wrt STACKS 0 000080A1 [5200][5600] dw offset Int70 wrt STACKS, offset i70Off wrt STACKS 0 000080A5 [5A00][5E00] dw offset Int72 wrt STACKS, offset i72Off wrt STACKS 0 000080A9 [6200][6600] dw offset Int73 wrt STACKS, offset i73Off wrt STACKS 0 000080AD [6A00][6E00] dw offset Int74 wrt STACKS, offset i74Off wrt STACKS 0 000080B1 [7200][7600] dw offset Int76 wrt STACKS, offset i76Off wrt STACKS 0 000080B5 [7A00][7E00] dw offset Int77 wrt STACKS, offset i77Off wrt STACKS 0 000080B9 [2201][3B01] dw offset Int19 wrt STACKS, offset i19Off wrt STACKS 0 000080BD 0000 dw 0 406 407 INITCODE ends 408 === Switch to base=000000h -> "INITDATA" 409 section INITDATA public align=2 class=INITDATA 410 411 extrn stacksIn:byte 412 413 INITDATA ends 414 415 end === Trace listing source: drbio/bin/initmsgs.lst 1 NUL equ 0 2 BS equ 8 3 TAB equ 9 4 LF equ 10 5 CR equ 13 6 7 group CGROUP INITDATA 8 === Switch to base=000000h -> "INITDATA" 9 section INITDATA align=2 public class=INITDATA 10 assume ds:CGROUP, cs:CGROUP 11 12 ; Source .TFT file: 'TMP1.$$$' 13 public _yes_char 14 public yes_char 15 yes_char label byte 0 00009434 597900 _yes_char db "Yy", NUL 17 public _no_char 18 public no_char 19 no_char label byte 0 00009437 4E6E00 _no_char db "Nn", NUL 21 public _run_char 22 public run_char 23 run_char label byte 0 0000943A 527200 _run_char db "Rr", NUL 25 public _bad_command 26 public bad_command 27 bad_command label byte 0 0000943D 496E76616C69642063 _bad_command db "Invalid command in CONFIG.SYS file.$", NUL 0 00009446 6F6D6D616E6420696E 0 0000944F 20434F4E4649472E53 0 00009458 59532066696C652E24 0 00009461 00 29 public _bad_filename 30 public bad_filename 31 bad_filename label byte 0 00009462 426164206F72206D69 _bad_filename db "Bad or missing file $", NUL 0 0000946B 7373696E672066696C 0 00009474 65202400 33 public _bad_shell 34 public bad_shell 35 bad_shell label byte 0 00009478 496E76616C69642053 _bad_shell db "Invalid SHELL filename $", NUL 0 00009481 48454C4C2066696C65 0 0000948A 6E616D65202400 37 public _bad_lastdrive 38 public bad_lastdrive 39 bad_lastdrive label byte 0 00009491 496E76616C6964206C _bad_lastdrive db "Invalid last drive character (use A..Z) $", NUL 0 0000949A 617374206472697665 0 000094A3 206368617261637465 0 000094AC 72202875736520412E 0 000094B5 2E5A29202400 41 public _bad_break 42 public bad_break 43 bad_break label byte 0 000094BB 496E76616C69642062 _bad_break db "Invalid break switch (use ON or OFF)$", NUL 0 000094C4 7265616B2073776974 0 000094CD 63682028757365204F 0 000094D6 4E206F72204F464629 0 000094DF 2400 45 public _bad_buffers 46 public bad_buffers 47 bad_buffers label byte 0 000094E1 496E76616C6964206E _bad_buffers db "Invalid number of buffers $", NUL 0 000094EA 756D626572206F6620 0 000094F3 627566666572732024 0 000094FC 00 49 public _bad_files 50 public bad_files 51 bad_files label byte 0 000094FD 496E76616C6964206E _bad_files db "Invalid number of files (use 5..255)", CR, LF, "$", NUL 0 00009506 756D626572206F6620 0 0000950F 66696C657320287573 0 00009518 6520352E2E32353529 0 00009521 0D0A2400 53 public _bad_fcbs 54 public bad_fcbs 55 bad_fcbs label byte 0 00009525 496E76616C6964206E _bad_fcbs db "Invalid number of FCBS", CR, LF, "$", NUL 0 0000952E 756D626572206F6620 0 00009537 464342530D0A2400 57 public _bad_fopen 58 public bad_fopen 59 bad_fopen label byte 0 0000953F 496E76616C6964206E _bad_fopen db "Invalid number of FASTOPEN entries (use 128..32768)", CR, LF, "$", NUL 0 00009548 756D626572206F6620 0 00009551 464153544F50454E20 0 0000955A 656E74726965732028 0 00009563 757365203132382E2E 0 0000956C 3332373638290D0A24 0 00009575 00 61 public _bad_drivparm 62 public bad_drivparm 63 bad_drivparm label byte 0 00009576 496E76616C6964206F _bad_drivparm db "Invalid or missing DRIVPARM parameters, usage:", CR, LF, "DRIVPARM = /D:d [/C] [/F:f] [/H:h] [/N] [/S:s] [/T:t]", CR, LF, "$", NUL 0 0000957F 72206D697373696E67 0 00009588 20445249565041524D 0 00009591 20706172616D657465 0 0000959A 72732C207573616765 0 000095A3 3A0D0A445249565041 0 000095AC 524D203D202F443A64 0 000095B5 205B2F435D205B2F46 0 000095BE 3A665D205B2F483A68 0 000095C7 5D205B2F4E5D205B2F 0 000095D0 533A735D205B2F543A 0 000095D9 745D0D0A2400 65 public _bad_history 66 public bad_history 67 bad_history label byte 0 000095DF 496E76616C69642048 _bad_history db "Invalid HISTORY parameters, usage:", CR, LF, "HISTORY = ON|OFF [,nnn[, ON|OFF]]", CR, LF, "$", NUL 0 000095E8 4953544F5259207061 0 000095F1 72616D65746572732C 0 000095FA 2075736167653A0D0A 0 00009603 484953544F5259203D 0 0000960C 204F4E7C4F4646205B 0 00009615 2C6E6E6E5B2C204F4E 0 0000961E 7C4F46465D5D0D0A24 0 00009627 00 69 public _bad_country 70 public bad_country 71 bad_country label byte 0 00009628 496E76616C69642063 _bad_country db "Invalid country code and / or code page$", NUL 0 00009631 6F756E74727920636F 0 0000963A 646520616E64202F20 0 00009643 6F7220636F64652070 0 0000964C 6167652400 73 public _bad_exec 74 public bad_exec 75 bad_exec label byte 0 00009651 426164206F72206D69 _bad_exec db "Bad or missing command interpreter.", CR, LF, "Please enter a valid filename.", CR, LF, "$", NUL 0 0000965A 7373696E6720636F6D 0 00009663 6D616E6420696E7465 0 0000966C 727072657465722E0D 0 00009675 0A506C656173652065 0 0000967E 6E7465722061207661 0 00009687 6C69642066696C656E 0 00009690 616D652E0D0A2400 77 public _bootpart_not_found_msg 78 public bootpart_not_found_msg 79 bootpart_not_found_msg label byte 0 00009698 0D0A7761726E696E67 _bootpart_not_found_msg db CR, LF, "warning: can't find boot partition", CR, LF, "$",NUL 0 000096A1 3A2063616E27742066 0 000096AA 696E6420626F6F7420 0 000096B3 706172746974696F6E 0 000096BC 0D0A2400 81 public _dos_msg 82 public dos_msg 83 dos_msg label byte 0 000096C0 0D0A70616E69633A20 _dos_msg db CR, LF, "panic: can't load DRDOS.SYS, giving up$", NUL 0 000096C9 63616E2774206C6F61 0 000096D2 64204452444F532E53 0 000096DB 59532C20676976696E 0 000096E4 672075702400 85 public _f5key_msg 86 public f5key_msg 87 f5key_msg label byte 0 000096EA 0D0A4635206B657920 _f5key_msg db CR,LF,"F5 key was pressed, skipping configuration files",CR,LF,"$",NUL 0 000096F3 776173207072657373 0 000096FC 65642C20736B697070 0 00009705 696E6720636F6E6669 0 0000970E 6775726174696F6E20 0 00009717 66696C65730D0A2400 89 public _f8key_msg 90 public f8key_msg 91 f8key_msg label byte 0 00009720 0D0A4638206B657920 _f8key_msg db CR,LF,"F8 key was pressed, single-stepping configuration files",CR,LF,"$",NUL 0 00009729 776173207072657373 0 00009732 65642C2073696E676C 0 0000973B 652D7374657070696E 0 00009744 6720636F6E66696775 0 0000974D 726174696F6E206669 0 00009756 6C65730D0A2400 93 94 INITDATA ends 95 96 97 end