⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rxdosini.asm

📁 dos source
💻 ASM
📖 第 1 页 / 共 5 页
字号:
        TITLE   'INI - RxDOS Initialize'
        PAGE 59, 132
        .LALL

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  INI - RxDOS Initialize                                       ;
        ;...............................................................;

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Real Time Dos                                                ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  This material  was created as a published version  of a DOS  ;
        ;  equivalent product.   This program  logically  functions in  ;
        ;  the same way as  MSDOS functions and it  is  internal  data  ;
        ;  structure compliant with MSDOS 6.0                           ;
        ;                                                               ;
        ;  This product is distributed  AS IS and contains no warranty  ;
        ;  whatsoever,   including  warranty  of   merchantability  or  ;
        ;  fitness for a particular purpose.                            ;
        ;                                                               ;
        ;                                                               ;
        ;  (c) Copyright 1990, 1997. Api Software and Mike Podanoffsky  ;
        ;      All Rights Reserved Worldwide.                           ;
        ;                                                               ;
        ;  This product is protected under copyright laws and  may not  ;
        ;  be reproduced  in whole  or in part, in any form  or media,  ;
        ;  included but not limited to source listing, facsimile, data  ;
        ;  transmission, cd-rom, or  floppy disk without the expressed  ;
        ;  written consent of the author.                               ;
        ;                                                               ;
        ;  License  for  distribution  for commercial  use  or  resale  ;
        ;  required from:                                               ;
        ;                                                               ;
        ;  Api Software                                                 ;
        ;  12 South Walker Street                                       ;
        ;  Lowell,  MA   01851                                          ;
        ;                                                               ;
        ;  internet: mikep@world.std.com                                ;
        ;                                                               ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;  Compile with MASM 5.1                                        ;
        ;...............................................................;

        include rxdosmac.asm
        include rxdosdef.asm

RxDOS   SEGMENT PUBLIC 'CODE'
        assume cs:RxDOS, ds:RxDOS, es:RxDOS, ss:RxDOS

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  INI - RxDOS Initialize                                       ;
        ;...............................................................;

        public RxDOS_initialize
        public RxDOS_LineEditorBuffers

        public LogTraceBlockDevRequest
        public LogTraceBlockDevReturn
        public LogTraceCharDevRequest
        public LogTraceCharDevReturn
        public LogTraceInt21Calls

        extrn _RxDOS_bNumBlockDev               : byte
        extrn _RxDOS_BufferList                 : near
        extrn _RxDOS_CurrentDrive               : byte
        extrn _RxDOS_BootDrive                  : byte

        extrn _RxDOS_CommandShell               : near
        extrn _RxDOS_Buffers                    : dword
        extrn _RxDOS_bLastDrive                 : byte
        extrn _RxDOS_bSwitchChar                : byte
        extrn _RxDOS_bCtrlBreakCheck            : byte
        extrn _RxDOS_MaxMemory                  : word
        extrn _RxDOS_NULLDev                    : dword
        extrn _RxDOS_pCDS                       : dword
        extrn _RxDOS_pDPB                       : dword
        extrn _RxDOS_pFT                        : dword
        extrn _RxDOS_pStartMemBlock             : word

        extrn _RxDOS_CurrentSeg                 : word
        extrn _RxDOS_SharedBuffer               : near
        extrn _RxDOS_pDTA                       : near
        extrn _RxDOS_CurrentPSP                 : near
        extrn _RxDOS_pCONdriver                 : near
        extrn _RxDOS_pCLOCKdriver               : near

        extrn _RxDOS_UserCodePage               : near
        extrn _RxDOS_SystemCodePage             : near
        extrn _RxDOS_CurrCountryInfo            : near
        extrn _RetCallersStackFrame             : near

        extrn RxDOS_StackTop                    : near
        extrn RxDOS_StackTemp                   : near
        extrn RxDOS_start                       : near

        extrn _CallDOS                          : far
        extrn _Interrupt_20                     : near
        extrn _Interrupt_21                     : near
        extrn _Interrupt_23                     : near
        extrn _Interrupt_24                     : near
        extrn _Interrupt_25                     : near
        extrn _Interrupt_26                     : near
        extrn _Interrupt_27                     : near
        extrn _Interrupt_28                     : near
        extrn _Interrupt_2a                     : near
        extrn _Interrupt_2f                     : near
        extrn _IRet                             : near

        extrn maxBlockDevices                   : near
        extrn FindAvailableSFTHandle            : near
        extrn checkforDeviceType                : near
        extrn checkforDeviceName                : near
        extrn stdDeviceAssignTable              : near

        extrn scanDirectory                     : near
        extrn initdiskAccess                    : near
        extrn lowerCase                         : near
        extrn upperCase                         : near
        extrn CopyString                        : near
        extrn readLine                          : near
        extrn _initializeMemoryBlock            : near
        extrn SDAExtendedSwapArea               : near
        extrn initReqBlock                      : near

        extrn RxDOS_USA_DefaultUpperCaseFunction : far

     ;  extrn msgUnknownCommandinConfig         : near
     ;  extrn _RxDOS_ConfigKeywords             : near

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Line Editor Buffer Pool                                      ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  Init code space is used to hold interim buffers.             ;
        ;                                                               ;
        ;                                                               ;
        ;...............................................................;

RxDOS_LineEditorBuffers dw  ( RxDOS_EndOfInitCode - $ ) / sizeLINEEDITOR_BUFFERPOOL

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  CONFIG Statement Types                                       ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  WARNING: These values cannot be changed without also         ;
        ;  changing the dispatch table.                                 ;
        ;                                                               ;
        ;...............................................................;

CONFIGTYPE_ENDOFARGS    equ 0000h                       ; last entry
CONFIGTYPE_DOS          equ 0001h                       ; dos = umb, high
CONFIGTYPE_NUMLOCK      equ 0002h                       ; numlock = on | off
CONFIGTYPE_BREAK        equ 0003h                       ; break = on | off
CONFIGTYPE_SET          equ 0004h                       ; set

CONFIGTYPE_COUNTRY      equ 0005h                       ; contry = 
CONFIGTYPE_DEVICE       equ 0006h                       ; device devicename [ options ]
CONFIGTYPE_DEVICEHIGH   equ 0007h                       ; devicehigh devicename [ options ]
CONFIGTYPE_DRIVPARAM    equ 0008h                       ; driveparam
CONFIGTYPE_MULTITRACK   equ 0009h                       ; multitrack
CONFIGTYPE_SWITCHES     equ 0010h                       ; switches

CONFIGTYPE_BUFFERS      equ 0011h                       ; buffers =
CONFIGTYPE_FILES        equ 0012h                       ; files =
CONFIGTYPE_FCBS         equ 0013h                       ; fcbs = x [, y ]
CONFIGTYPE_LASTDRIVE    equ 0014h                       ; lastdrive = x
CONFIGTYPE_SHELL        equ 0015h                       ; shell specifypath
CONFIGTYPE_STACKS       equ 0016h                       ; stacks

CONFIGTYPE_INSTALL      equ 0017h                       ; install progname
CONFIGTYPE_INSTALLHIGH  equ 0018h                       ; installhigh progname

CONFIGTYPE_MENUDEFAULT  equ 0019h                       ; blockname [, timeout ]
CONFIGTYPE_MENUITEM     equ 001Ah                       ; itemname [, text ]
CONFIGTYPE_MENUCOLOR    equ 001Bh                       ; x [, y]
CONFIGTYPE_SUBMENU      equ 001Ch                       ; itemname [, text ]
CONFIGTYPE_INCLUDE      equ 001Dh                       ; itemname
CONFIGTYPE_MENUBLOCK    equ 001Eh                       ; [...]

CONFIGTYPE_SWITCHCHAR   equ 0020h                       ; char
CONFIGTYPE_COMMENTS     equ 0021h                       ; comments
CONFIGTYPE_REM          equ 0022h                       ; remarks

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  CONFIG Flags And Options                                     ;
        ;...............................................................;

CONFIGFLAG_ENABLED      equ 0001h
CONFIGFLAG_PROCESSED    equ 0002h

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  CONFIGSTMT structure                                         ;
        ;...............................................................;

        CONFIGSTMT struc

cStmtType               dw ?                    ; config statement type
cStmtName               db ?                    ; statement starts here

        CONFIGSTMT ends

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  CONFIGLINE Buffer                                            ;
        ;...............................................................;

        CONFIGLINE struc

configType              dw ?                    ; config statement type
configLength            dw ?                    ; config line length
configFlags             dw ?                    ; config statement line number
configLineNumber        dw ?                    ; config statement line number
configStatement         db ?                    ; statement starts here

        CONFIGLINE ends

        ;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
        ;  Config File Processing                                       ;
        ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
        ;                                                               ;
        ;  This module reads the entire  Config.sys  file from  a par-  ;
        ;  tially initialized system.  It expects  minimally  buffers,  ;
        ;  CDS, and other  DOS  data  structures.   Config  processing  ;
        ;  happens in two phases:  pass one gathers facts and pass two  ;
        ;  reconfigures data structures and loads drivers.              ;
        ;                                                               ;
        ;  Returns:                                                     ;
        ;  ds/es   both will point to ss                                ;
        ;  ax      current drive                                        ;
        ;...............................................................;

configProcessing:

        Entry
        ddef  _configStatements, es, di
        ddef  _configNextLine, es, di

        def  _comment    , ';'                          ; default comment character
        def  _charsread
        def  _linenumber , 0000
        def  _dosFlags,    0000

        defbytes _diskAccess, sizeDISKACCESS
        defbytes _linebuffer, 255

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  find/ open config.sys 
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        setDS cs
        setES cs
        xor dx, dx
        mov al, byte ptr [ _RxDOS_CurrentDrive ]        ; startup drive
        mov di, offset _RxDOS_ConfigFile                ; search config file
        call scanDirectory                              ; open config.sys
        ifc configProcessing_Return                     ; if none found -->

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  find/ open config.sys 
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        push word ptr es:[ deFileSize. _low  ][ si ]
        push word ptr es:[ deFileSize. _high ][ si ]

        setES ss
        lea bx, _diskAccess [ bp ]                      ; build access control block
        call initdiskAccess                             ; [ax] is drive, [dx] is cluster

        pop word ptr ss:[ diskAcFileSize. _high ][ bx ]
        pop word ptr ss:[ diskAcFileSize. _low  ][ bx ]

configProcessing_12:
        getdarg es, di, _configNextLine
        mov word ptr es:[ configType   ][ di ], CONFIGTYPE_ENDOFARGS
        mov word ptr es:[ configLength ][ di ], 0000

        setES ss
        mov cx, 254
        lea di, offset _linebuffer [ bp ]
        lea bx, _diskAccess [ bp ]                      ; build access control block
        call readLine                                   ; read a line
        ifz configProcessing_36                         ; at end, reconfigure system -->

        inc word ptr [ _linenumber ][ bp ]              ; lines read

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;  strip trailing newline
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     ;  lea di, offset _linebuffer [ bp - 1 ]
     ;  add di, cx
     ;  cmp byte ptr ss:[ di ], 0Ah                     ; trailing newline?
     ;  jne short configProcessing_14                   ; no -->
     ;  mov byte ptr ss:[ di ], 0                       ; change to null
     ;  dec cx

configProcessing_14:
        lea di, offset _linebuffer [ bp ]

        getarg ax, _comment                             ; parse out comments
        call configRemoveComments                       ; remove comments
        jz configProcessing_12                          ; if nothing left on line -->
        mov word ptr [ _charsread ][ bp ], cx           ; characters read

        setES ss
        cmp byte ptr ss:[ di ], ':'                     ; comment line ?
        jz configProcessing_12                          ; yes, ignore -->
        cmp byte ptr ss:[ di ], '['                     ; block item specifier ?
        jz configProcessing_16                          ; yes -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -