使用msdos文件编码时的汇编语言问题

时间:2018-04-25 11:05:46

标签: assembly assemblies inline-assembly

正如readme.txt文件所说:您应该链接 BIOS ,以便在 SYSINIT 结束时回拨bios 。如果你不需要这个电话,只需找到一个远程RET并将其标记为RE_INIT并将其公开。 我的问题从这里开始:

我很困惑,我应该在 SKELIO.ASM 文件中搜索远RET 并将其标记为RE_INIT(但我应该在哪里放置此标签?)或者我应该去找" SYSINIT.ASM"文件并在那里搜索远RET 并将其标记为RE_INIT(如何?)。请参阅下面的代码,了解这两个文件的某些部分。我必须提一下,skelio.asm文件用于bios,sysinit.asm文件用于系统初始化。

SKELIO.ASM :代码如下

; I/O system for Version 2.x of MSDOS.

;This BIOS designed to be linked with the SYSINIT module provided by
;Microsoft

BIOSIZ  EQU     4096            ;Size of BIOS in bytes.
BIOSIZS EQU     100H            ;Size of BIOS in Paragraphs.
ANSI    EQU     0               ;Ansi switch.

;Additional Information for the ALTOS machine.

QSIZE   EQU     100             ;Input queue size.
BIOSSEG EQU     0C0H            ;I/O system segment.
MAX_MEM EQU     4000H           ;Memory size in paragraphs.

; Constants for commands in Altos ROM.

ROM_CONSTA      EQU     01      ;Return status AL of console selected in CX.
ROM_CONIN       EQU     02      ;Get char. from console in CX to AL
ROM_CONOUT      EQU     03      ;Write char. in DL to console in CX.
ROM_PMSG        EQU     07      ;Write string ES:DX to console in CX.
ROM_DISKIO      EQU     08      ;Perform disk I/O from IOPB in ES:CX.
ROM_INIT        EQU     10      ;Returns boot console and top memory ES:DX.

;Things needed to communicate with SYSINIT

EXTRN   SYSINIT:FAR                   ;The entry point of SYSINIT
EXTRN   CURRENT_DOS_LOCATION:WORD     ;Where the DOS is when SYSINIT called
EXTRN   FINAL_DOS_LOCATION:WORD       ;Where I want SYSINIT to put the DOS
EXTRN   DEVICE_LIST:DWORD             ;Pointer to the DEVICE list.
EXTRN   MEMORY_SIZE:WORD              ;Size in paragraphs of Physical 
;memory.
EXTRN   DEFAULT_DRIVE:BYTE            ;Default Drive to use when system 
;booted
EXTRN   BUFFERS:BYTE                  ;Number of default buffers.
                                  ; Leave as is and SYSINIT uses only 2.

CODE    SEGMENT
ASSUME  CS:CODE,DS:CODE,ES:CODE,SS:CODE

    ORG     0               ;Starts at an offset of zero.

INIT:   JMP     HWINIT

    PAGE

    SUBTTL  Device driver tables.
------- and so on
--------SKELIO.ASM code ends here
------------------------------------------------------------------------
SYSINIT.ASM: code as follows

TITLE   BIOS SYSTEM INITIALIZATION

FALSE   EQU     0
TRUE    EQU     NOT FALSE
IBMVER     EQU     FALSE
IBM        EQU     IBMVER
IBMJAPVER  EQU     FALSE                ; If TRUE set KANJI true also
MSVER      EQU     TRUE 
ALTVECT    EQU     FALSE                ; Switch to build ALTVECT version
HIGHMEM    EQU     FALSE
KANJI      EQU     FALSE

    IF      IBMVER OR IBMJAPVER
NOEXEC  EQU     TRUE
    ELSE
NOEXEC  EQU     FALSE
    ENDIF

; Set to agree with those in DOST:MSHEAD.ASM, ALTVECT version only
MAJOR_VERSION   EQU      2
MINOR_VERSION   EQU     0B  ;2.11

DOSSIZE EQU     5000H

; Internal DOS data returned by DOSINIT

SYSINITVAR  STRUC
DPBHEAD     DD      ?                   ; Pointer to head of DPB-FAT list
sft_addr    DD      ?                   ; Pointer to first FCB table
; The following address points to the CLOCK device
BCLOCK      DD      ?
; The following address is used by DISKSTATCHK it is always
; points to the console input device header
BCON        DD      ?                   ; Console device entry points
NUMIO       DB      0                   ; Number of disk tables
MAXSEC      DW      0                   ; Maximum allowed sector size
BUFFHEAD    DD      ?                   ; Head of buffer queue
DEVHEAD     DD      ?
SYSINITVAR  ENDS

    INCLUDE DOSSYM.ASM
    INCLUDE DEVSYM.ASM

    IF      NOT IBM
    IF      NOT IBMJAPVER

    ENDIF
    ENDIF

SYSINITSEG      SEGMENT PUBLIC 'SYSTEM_INIT'
------------------------------ and so on
------------------------------ and so on
LOCSTACK LABEL BYTE

    CALL    MSDOS
    MOV     WORD PTR [DOSINFO+2],ES ; SAVE POINTER TO DOS INFO
    MOV     WORD PTR [DOSINFO],DI

    IF      NOT IBM
    IF      NOT IBMJAPVER
    CALL    RE_INIT                 ; Re-call the BIOS <-----**problem**
    ENDIF
    ENDIF

    STI
    CLD

    IF      HIGHMEM
    PUSH    DS
    MOV     BX,DS
    ADD     BX,10H
    MOV     ES,BX
    PUSH    CS
    POP     DS
    XOR     SI,SI
    MOV     DI,SI
    MOV     CX,OFFSET SYSSIZE + 1
    SHR     CX,1                    ; Divide by 2 to get words

sysinit.asm代码在这里结束

我正在尝试将skelio.obj,sysinit.obj和sysimes.obj链接在一起 所以我将获得ms dos exe文件,我将能够运行ms dos 使用它。 谢谢。请提一下我应该搜索一下FAR RET的skelio.asm文件 标记它RE_INIT或我应该使用sysinit.asm文件。

0 个答案:

没有答案