none
INTERRUPTX 中断接口问题:为什么QB4.5可以环境编译EXE使用正常,而QB 7.1下使用不正常呢? RRS feed

  • 问题

  •  

    同样的个BAS源码文件,在quick basic 4.5下编译生成的EXE,在实模式的DOS下,可以保存磁盘扇区,而qbasic 7.1的则不能,保存的磁盘扇区文件,全为“00”???

     

     

    两个环境都相应加载QBX.BI 或者QB.BIN,即   "/L QBX.BI" 下面蓝底部分是可选部分,当加载.BI文件时去除。

    难道是QB.QLB与QBX.QLB存在区别,WHY???

    如下:

     

    DECLARE SUB HD (m%)
    DECLARE SUB xint (Num%)
    TYPE RegTypeX
         ax    AS INTEGER
         bx    AS INTEGER
         CX    AS INTEGER
         dx    AS INTEGER
         bp    AS INTEGER
         si    AS INTEGER
         di    AS INTEGER
         flags AS INTEGER
         ds    AS INTEGER
         es    AS INTEGER
    END TYPE
    DIM SHARED ax    AS INTEGER, bx   AS INTEGER, CX   AS INTEGER, dx   AS INTEGER, bp   AS INTEGER
    DIM SHARED si    AS INTEGER, di   AS INTEGER, flags AS INTEGER, ds   AS INTEGER, es   AS INTEGER
    GetCom$ = RTRIM$(LTRIM$(UCASE$(COMMAND$)))
    'GetCom$ = "9"
    f% = INSTR(1, GetCom$, ">")
    IF f% <> 0 THEN FileName$ = RTRIM$(LTRIM$(MID$(GetCom$, f% + 1, LEN(GetCom$) - f%)))
    IF INSTR(1, GetCom$, "SAVE MBR") THEN GetCom$ = "1"
    IF INSTR(1, GetCom$, "LOAD MBR") THEN GetCom$ = "2"
    SELECT CASE GetCom$
        CASE "", "0"
           PRINT "Usage: Mtools {switch} [ > FileName]"
           PRINT "Switches:"
           PRINT "   /Save MBR    OR 1  TO Save HdDisk Mbr   (保存MBR)"
           PRINT "   /Load MBR    OR 2  TO Load HdDisk Mbr   (恢复MBR)"

        CASE "1"
           IF FileName$ = "" THEN INPUT "Plese Input File Name = ", FileName$
           IF FileName$ = "" THEN FileName$ = "HdMbr.dat"
           OPEN FileName$ FOR BINARY AS #1
           CALL HD(0)
           PRINT "Save MBR ok ! File Name -> "; FileName$
        CASE "2"
           IF FileName$ = "" THEN INPUT "Plese Input File Name = ", FileName$
           IF FileName$ = "" THEN FileName$ = "HdMbr.dat"
           OPEN FileName$ FOR BINARY AS #1
           CALL HD(1)
           PRINT "Load MBR ok ! File Name -> "; FileName$

    END SELECT
    END

    SUB HD (m%)
    SELECT CASE m%
       CASE 0  'save
         buff$ = SPACE$(512)
         ax = &H201
         bx = SADD(buff$)
         CX = 1
         dx = &H80
         es = VARSEG(buff$)
         CALL xint(&H13)
         PUT #1, 1, buff$
       CASE 1  'load
         buff$ = SPACE$(512)
         GET #1, 1, buff$
         ax = &H301
         bx = SADD(buff$)
         CX = 1
         dx = &H80
         es = VARSEG(buff$)
         CALL xint(&H13)
       'CASE 2  'cls
    END SELECT

    END SUB

    SUB xint (Num%)
    '中断调用的公用子程序
    '用法 :  Xint 中断号

    DIM Reg  AS RegTypeX
    Reg.ax = ax
    Reg.bx = bx
    Reg.CX = CX
    Reg.dx = dx
    Reg.si = si
    Reg.di = di
    Reg.ds = ds
    Reg.es = es
    CALL INTERRUPTX(Num%, Reg, Reg)
    ax = Reg.ax
    bx = Reg.bx
    CX = Reg.CX
    dx = Reg.dx
    si = Reg.si
    di = Reg.di
    ds = Reg.ds
    es = Reg.es
    END SUB

    2008年5月12日 9:29