home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / memory / xm / xmdos.asm < prev    next >
Encoding:
Assembly Source File  |  1990-10-08  |  14.1 KB  |  797 lines

  1.         .386
  2.  
  3. thiscodesel    =    18h
  4. psp2sel        =    24h
  5.  
  6.         include    xmhd.inc
  7.         include    xmmac.mac
  8.         include    xmmsg.def
  9. ;
  10. _DATA        segment    para public USE16 'DATA'
  11.         extrn    EData:sect
  12.         extrn    ThisSSESP: fword
  13.         extrn    ThisDataBase: dword
  14.         extrn    ThisCodeBase: dword
  15.         
  16.         extrn    EndCode:byte
  17.         extrn    RMIDTLIMITBase: fword
  18.         extrn    IDTLIMITBase: fword
  19.         extrn    GDTLIMITBase: fword
  20.         extrn    ExeCSEIP: fword
  21.         extrn    exeeip: dword
  22.         extrn    ExeCS : word
  23.         extrn    savedssesp: fword
  24.         extrn    Exessesp: fword
  25.         extrn    exeesp: dword
  26.         extrn    Exess : word
  27.         extrn    debugflag: word
  28.  
  29.         public    TestPoint01,cindxs,cfwrite,cfread,cpsp
  30.         public    TestPoint02
  31.         ends
  32.     
  33. _TEXT        segment    para public USE16 'CODE'
  34.         extrn    OSExit:near
  35.         extrn    a20_on:near, a20_off:near
  36.         extrn    Ty_Debugger:near
  37.         ends
  38.         
  39. _DATA        segment    para public USE16 'DATA'
  40.  
  41.         public    DosCallP
  42. ;        DosFuncMax
  43.         public    DosBuffer, DosWorkI, DosWorkO, Mywork
  44.         public    comp_buffer, pspwork
  45.         extrn    exeeax:dword, exeax:word, savedflags:dword
  46.  
  47.         public    DosLog
  48. DosLog        dw    80h dup (0h)
  49. SavedDS        dw    0
  50. SavedES        dw    0
  51.  
  52. TransferedByte    dd    ?
  53.         
  54. PSPWork        db    768  dup (0)
  55. DosBuffer    label    byte
  56. DosWorkI    db    dosbuffersize dup (0)
  57.         org    dosworki+PageSize
  58. DosWorkO    db    PageSize dup (26)
  59. MyWork        db    512  dup (27)
  60. Comp_Buffer    dw    256  dup (0)
  61.  
  62. ; input: lower nibble, output: upper nibble
  63. ; register only = 0,  
  64. ; 1 = ds:dx, 2 = es:bx, 3 = es:di, 4 = ds:di
  65.         align    dword
  66. DosCallP    dw    DosExit        ;.0
  67.         dw    cnopa        ;.1
  68.         dw    cnop        ;.2
  69.         dw    cnopa        ;i3
  70.         dw    cnop        ;.4
  71.         dw    cnop        ;.5
  72.         dw    cnopa        ;.6
  73.         dw    cnopa        ;.7
  74.         dw    cnopa        ;.8
  75.         dw    cins        ;.9
  76.         dw    cigets        ;.10    get line
  77.         dw    cnopa        ;.11    console status
  78.         dw    cigets_c    ;.12    flush and key in
  79.         dw    cnop        ;.13    disk reset
  80.         dw    cnopa        ;.14    change current drive
  81.         dw    cabort        ;.15    open file
  82.         dw    cabort        ;.16    close file
  83.         dw    cabort        ;.17    find first
  84.         dw    cabort        ;.18    find next
  85.         dw    cabort        ;.19    delete file
  86.         dw    cabort        ;.20    sequencial read 
  87.         dw    cabort        ;.21    sequencial write
  88.         dw    cabort        ;.22    create file
  89.         dw    cabort        ;.23(17)    rename
  90.         dw    cabort        ;.18h    ??
  91.         dw    cnopa        ;.19h    get current drive
  92.         dw    cabort        ;.1ah    set dta
  93.         dw    cabort        ;.1bh     get current drive data
  94.         dw    cremain        ;.1ch    get drive data
  95.         dw    cabort        ;.1dh
  96.         dw    cabort        ;.1eh
  97.         dw    cabort        ;.1f
  98.         dw    cabort        ;.20
  99.         dw    cabort        ;.21h    random read
  100.         dw    cabort        ;.22h    random write
  101.         dw    cabort        ;.23h    get file size
  102.         dw    cabort        ;.24h    set ralative record
  103.         dw    cabort        ;.25h    set vector
  104.         dw    cabort        ;.26h
  105.         dw    cabort        ;.27h      random block read
  106.         dw    cabort         ;.28h    random block write
  107.         dw    cabort        ;.29h     parse file name
  108.         dw    cnopr        ;.2ah    get date
  109.         dw    cnopa        ;.2bh    set date
  110.         dw    cnopr        ;.2ch    get time
  111.         dw    cnopa        ;.2dh    set time
  112.         dw    cnop        ;.2eh    set/reset verify flag
  113.         dw    cremain        ;.2fh    get dta
  114.         dw    cnopa        ;.30h    dos version no
  115.         dw    cabort        ;.31h    kiip process (TSR)
  116.         dw    cremain        ;.32h
  117.         dw    cnopr        ;.33h    set/reset ctr-c check
  118.         dw    cabort        ;.34h    
  119.         dw    cabort        ;.35h    get int vector
  120.         dw    cnopr        ;.36h    get disk free space
  121.         dw    cabort        ;.37h
  122.         dw    cremain        ;.38h    country information
  123.         dw    cindxs        ;.39h    create directory  
  124.         dw    cindxs        ;.3ah    remove directory entry
  125.         dw    cindxs        ;.3bh    change directory          
  126.         dw    cindxs        ;.3ch    create a file 
  127.         dw    cindxs        ;.3dh    open a file
  128.         dw    cnopa        ;.3eh    close a file
  129.         dw    cfread        ;.3fh    file/device read 
  130.         dw    cfwrite        ;.40h    file/device write 
  131.         dw    cindxs        ;.41h    delete a directory entry
  132.         dw    cnopr        ;.42h    move file pointer
  133.         dw    cindxs        ;.43h    chmod
  134.         dw    ciIOC         ;.44h    i/o control for device
  135.         dw    cnop        ;.45h    duplicate File handle
  136.         dw    cnopr        ;.46h    force duplicate of a handle
  137.         dw    ccdir        ;.47h    return text of directory
  138.         dw    cabort        ;.48h    allocate memory
  139.         dw    cabort        ;.49h    free allocated memory
  140.         dw    cabort        ;.4ah    modify/allocated memory block
  141.         dw    cremain        ;.4bh    load/exec
  142.         dw    DosExit        ;.4ch    terminate
  143.         dw    cnopa        ;.4dh    get return code from child
  144.         dw    cremain        ;.4eh    find first
  145.         dw    cremain        ;.4fh    find next
  146.         dw    cremain        ;.50h
  147.         dw    cremain        ;.51h
  148.         dw    cremain        ;.52h    ??
  149.         dw    cremain        ;.53h    ??
  150.         dw    cnopa        ;.54h    return verify flag
  151.         dw    cabort        ;.55h    ??
  152.         dw    crename        ;.56h    rename
  153.         dw    cnopr        ;.57h    get/set tod
  154.         dw    cabort        ; 58h     malloc strategy
  155.         dw    cnopr        ; 59h    get extended error code
  156.         dw    ctempnam      ; 5ah    create temporal file
  157.         dw    cindxs        ; 5bh      create file with check
  158.         dw    cabort
  159.         dw    cabort        ; 5dh
  160.         dw    cabort        ; 5eh
  161.         dw    cabort        ; 5fh
  162.         dw    cabort        ; 60h
  163.         dw    cabort        ; 61h
  164.         dw    cpsp        ; 62h
  165.         dw    cabort
  166.         dw    cabort
  167. ;
  168. ;DosFuncMax    equ    ($ - DosCallP) / 2
  169.  
  170. _DATA        ends
  171. ;
  172. ;
  173. _TEXT        segment    para public USE16 'CODE'
  174.         assume    cs:_TEXT, ds:_DATA
  175.         public    DosFlush
  176.         extrn    DosProtected
  177. ;
  178. ; int 21 from protected mode
  179. ; Hardware interrupt may occure while CPU executing this routine.
  180. ; So, we must not share save area with other interrupt handlers.
  181. ;
  182.  
  183.         .386P
  184. DosFlush    proc    far
  185.         mov    ax,_DATA
  186.         mov    ds,ax        ; communication buffer is 
  187.         mov    es,ax        ; also in this _DATA segment
  188.         mov    fs,ax
  189.         mov    gs,ax
  190.  
  191.         lss    esp, ThisSSESP
  192.         lidt    RMIDTLimitBase
  193.         mov    eax, ExeEAX
  194. ;
  195.         pushad
  196.         mov    bp,sp
  197.         sti
  198.         mov    ax,_DATA
  199.         mov    fs,ax
  200.         mov    gs,ax
  201. ;
  202. ; Show register information at dos call.
  203. ;
  204.         test    DebugFlag, MASK Deb_Trace_dos
  205.         jz    .do_dos1
  206.         push    ecx
  207.         push    edx
  208.         push    esi
  209.         push    edi
  210.         call    CRLF
  211.         lea    si, 8*4[bp]
  212.         mov    cx, 8
  213. .show_reg:        
  214.         lea    si, -4[si]
  215.         mov    eax, ss:dword ptr[si]
  216.         call    Hex32S            ; Edi,esi,ebp,esp
  217.                         ; ebx,edx,ecx,eax
  218.         loop    .show_reg
  219.         
  220.         push    es
  221.         les    eax, ExeCSEIP
  222.         call    PutPointer
  223.         pop    es
  224. ;        
  225.         pop    edi
  226.         pop    esi
  227.         pop    edx
  228.         pop    ecx
  229. .do_dos1:
  230. ;
  231. ;  call debugger at dos call.
  232. ;  convention is  ty_debugger(eip, esp, edi, esi, ebp, xxx, ebx, edx, ecx, eax)
  233. ;  where 
  234. ;
  235.         test    DebugFlag,MASK Deb_Trap_Dos
  236.         jz    .do_dos2
  237.         push    dword ptr ExeESP
  238.         push    dword ptr ExeEIP
  239.         call    Ty_debugger
  240.         add    sp,8
  241. .do_dos2:
  242. ;
  243.         .386
  244. TestPoint02    proc    near
  245. IF FMR70
  246.         call    a20_off
  247. ENDIF
  248.         mov    ax, [ExeAX]
  249.         cmp    ah, DosFuncMax
  250.         jae    DosExit
  251.         movzx    ebx, ah
  252.         push    offset .do_dos_ret
  253.         inc    DosLog[ebx*2]
  254.         push    DosCallP[ebx*2]
  255. IF FMR70        
  256.         call    a20_on
  257. ENDIF
  258.         mov    ah, byte ptr[SavedFlags]
  259.         sahf
  260.         movzx    ebx, [bp].rbx
  261.         mov    eax, ExeEAX
  262.         endp
  263. TestPoint01    proc    near             ; assure this 'ret' is
  264.         ret                ; near-return
  265.         endp
  266. ;
  267. .do_dos_ret    proc    near
  268. IF TransPort
  269. IF FMR70    
  270.         call    a20_off
  271.         nop
  272.         call    a20_on
  273. ENDIF
  274. ENDIF
  275. ;        mov    fs:[TempDS], ds
  276. ;        mov    fs:[TempES], es
  277. ;
  278. ; show register at dos-exit
  279. ;
  280.         test    DebugFlag, MASK Deb_Trace_dos
  281.         jz    .do_dos_ret1
  282.         mov    al,'-'
  283.         call    putchar
  284.         mov    eax, ExeEAX
  285.         call    Hex32S
  286.         mov    eax, [bp].recx
  287.         call    Hex32S
  288.         mov    eax, [bp].redx
  289.         call    Hex32S
  290.         mov    eax, [bp].rebx
  291.         call    Hex32S
  292.         mov    al, byte ptr SavedFlags
  293.         call    HexALS
  294.         
  295. .do_dos_ret1:
  296.         .386P
  297.         mov    sp, bp
  298.         popad
  299. ;
  300. ; return to protected mode 
  301. ;
  302.         cli
  303.         lidt    fs:[IDTLimitBase]
  304.         lgdt    fs:[GDTLimitBase]
  305.         mov    eax, CR0
  306.         or    al, ONCR0
  307.         and    al, OFFCR0
  308.         mov    CR0, eax
  309.         fjmp    ThisCodeSel, DosProtected
  310.         endp
  311. ;
  312. ;
  313. ; Dos (int 21h) handling routines
  314. ;
  315.         .386
  316. dosfunc        label    near
  317. cnop        proc    near        
  318. cnopa:
  319.         mov    ax, [bp].rax
  320.         mov    cx, [bp].rcx
  321.         mov    bx, [bp].rbx
  322.         mov    dx, [bp].rdx
  323. IF FMR70
  324.         call    a20_off
  325. ENDIF
  326.         int    21h
  327.         mov    ExeEAX,eax
  328.         lahf
  329.         mov    byte ptr SavedFlags, ah
  330. IF FMR70
  331.         call    a20_on
  332. ENDIF
  333.         ret
  334. cnopr:        
  335. IF FMR70
  336.         call    a20_off
  337. ENDIF        
  338.         mov    ax,[bp].rax
  339.         mov    bx,[bp].rbx
  340.         int    21h
  341.         mov    [bp].rcx, cx
  342.         mov    [bp].rdx, dx
  343.         mov    [bp].rbx, bx
  344.         mov    [bp].rsi, si
  345.         mov    [bp].rdi, di
  346.         movzx    eax,ax
  347.         mov    ExeEAX,eax
  348.         lahf
  349.         mov    byte ptr SavedFlags, ah
  350. IF FMR70
  351.         call    a20_on
  352. ENDIF
  353.         ret
  354.         endp
  355.  
  356. cremain:                ; We'll support it in feature, 
  357.  
  358.  
  359. cabort:
  360. ;
  361. C_Exit:
  362.         sti
  363.         call    CRLF
  364.         mov    eax, ExeEAX
  365.         cmp    ah, 4ch
  366.         je    C_normalx
  367.         cmp    ah, 0
  368.         je    C_normalx
  369.         call    Hex32s
  370. ;        
  371.         lea    edx, FuncNotAvail
  372.         call    Msg
  373.         les    eax, ExeCSEIP
  374.         call    PutPointer
  375.         les    eax, SavedSSESP
  376.         call    PutPointer
  377.         call    CRLF
  378.         lea    edx, RegS
  379.         call    Msg
  380.         mov    eax, [bp].reax
  381.         call    Hex32s
  382.         mov    eax, [bp].recx
  383.         call    Hex32s
  384.         mov    eax, [bp].redx
  385.         call    Hex32s
  386.         mov    eax, [bp].rebx
  387.         call    Hex32s
  388.         mov    eax, [bp].resp
  389.         call    Hex32s
  390.         mov    eax, [bp].rebp
  391.         call    Hex32s
  392.         mov    eax, [bp].resi
  393.         call    Hex32s
  394.         mov    eax, [bp].redi
  395.         call    Hex32s
  396.         mov    ax, SavedDS
  397.         call    HexS
  398.         mov    ax, SavedES
  399.         call    HexS
  400.         call    CRLF
  401.         mov    al,99            ; my error code
  402.         jmp    C_done
  403.         endp
  404. ;
  405.         public    dosexit
  406. DosExit        proc    near
  407. C_normalx:
  408.         push    ax
  409.         lea    edx, FileName
  410.         call    Msg
  411.         lea    edx, ExitMsg
  412.         call    Msg
  413.         pop    ax
  414.         mov    EndCode, al
  415.         call    Hex
  416.         call    CRLF
  417. C_done:        
  418.         .386P
  419.         mov    eax, CR0
  420.         xor    ax, ax
  421.         jmp    OSExit
  422.         endp
  423. ;        
  424. ;
  425.         .386
  426.         public    putpointer
  427. PutPointer    proc    near
  428.         push    eax
  429.         mov    ax, es
  430.         call    HexS
  431.         lea    dx, ColonS
  432.         call    Msg
  433.         pop    eax
  434.         call    Hex32
  435.         ret
  436.         endp
  437. ;        
  438.         align    dword
  439. ;
  440. ; copy string ds:dx to internal buffer  (_data:DosWorki)
  441. ;
  442. c_strlen    proc    near
  443.         cld
  444.         mov    ecx, MaxTransfer     ;
  445.         prefix32
  446.     repnz    scasb    
  447.         neg    ecx
  448.         add    ecx, MaxTransfer + 1
  449.         ret
  450.         endp
  451.  
  452.  
  453. cins        proc    near
  454.         mov    al,'$'
  455.         jmp    .cinz
  456. cindxs        label    near
  457.         mov    al,0
  458. .cinz        label    near
  459.         mov    edi,[bp].redx
  460.         add    edi,Edata.Base
  461.         sub    edi,ThisDataBase
  462.         push    edi
  463.         call    c_strlen
  464.         pop    esi
  465.         mov    edi,offset DosWorkI
  466.         add    cx, 2
  467.         prefix32
  468.     rep    movsb
  469.         mov    di, [bp].rdi
  470.         mov    si, [bp].rsi
  471.         mov    cx, [bp].rcx
  472. IF FMR70
  473.         call    a20_off
  474. ENDIF        
  475.         mov    dx, offset DosWorkI
  476.         mov    ax, [bp].rax
  477.         int    21h
  478.         movzx    eax, ax
  479.         mov    ExeEAX, eax
  480.         lahf
  481.         mov    byte ptr SavedFlags, ah
  482.         mov    [bp].rcx, cx
  483.         mov    [bp].rbx, bx
  484. IF  FMR70
  485.         call    a20_on
  486. ENDIF
  487.         ret
  488.         endp
  489. cinPrse:
  490.         jmp    cabort
  491. ;    
  492. cigets        proc    near
  493.         mov    edx, [bp].redx
  494.         add    edx, [EData.Base]
  495.         sub    edx, [ThisDataBase]
  496.         
  497.         push    ax
  498.         mov    al, [edx]
  499.         mov    DosWorki[0], al
  500.         pop    ax
  501.         
  502. IF FMR70
  503.         call    a20_off
  504. ENDIF
  505.         push    edx
  506.         mov    edx, offset Dosworki
  507.         mov    EAX, ExeEAX
  508.         int    21h
  509.         mov    esi, edx
  510.         pop    edi
  511. IF FMR70
  512.         call    a20_on
  513. ENDIF
  514.         movzx    ecx, byte ptr[esi]
  515.         add    cx, 2
  516.         cld
  517.         Prefix32
  518.     rep    movsb
  519.         ret
  520.         endp
  521.  
  522. cigets_c    proc    near
  523. ;        mov    eax, [ExeEAX]
  524.         cmp    al, 0ah
  525.         je    cigets
  526. IF  FMR70
  527.         call    a20_off
  528. ENDIF        
  529.         int    21h
  530.         mov    ExeEAX, eax
  531. IF FMR70
  532.         call    a20_on
  533. ENDIF
  534.         ret
  535.         endp
  536.  
  537. ;
  538. ;
  539. ; call Real-Mode child process
  540. ;
  541. ;cexec:
  542. ;        ret
  543.  
  544.  
  545.  
  546. ;
  547. ; ds:dx is pointer to output buffer
  548. ; so, set it to _data:DosWorkO
  549. ;
  550. ; file read (function 3fh)
  551. ;
  552. cfread        proc    near
  553.         add    edx, EData.base
  554.         sub    edx, ThisDataBase
  555.         mov    edi, edx
  556.         mov    TransferedByte, 0
  557. .cfr1:        
  558.         jcxz    .cfrxe
  559.         
  560.         push    ecx
  561.         cmp    ecx, DosBufferSize
  562.         jbe    .cfr2
  563.         mov    cx, DosBufferSize
  564. .cfr2:        
  565.         push    edi
  566.         mov    bx, [bp].rbx
  567.         mov    dx, offset DosBuffer
  568. IF FMR70
  569.         call    a20_off
  570. ENDIF
  571.         mov    ax, [bp].rax
  572.         int    21h
  573.         pop    edi
  574. IF FMR70
  575.         call    a20_on
  576. ENDIF
  577.         jc    .cfrxer
  578.         
  579.         movzx    eax, ax
  580.         add    TransferedByte, eax
  581.         mov    ecx, eax
  582.         jcxz    .cfrxe1
  583.         
  584.         mov    esi, offset DosBuffer
  585.         cld    
  586.         prefix32
  587.     rep    movsb    
  588.         pop    ecx
  589.         
  590.         sub    ecx, eax
  591.         ja    .cfr1
  592. .cfrxe:
  593.         and    byte ptr SavedFlags, not 1
  594.         mov    eax, TransferedByte
  595.         mov    ExeEAX, eax
  596.         ret
  597. .cfrxe1:
  598.         pop    ecx
  599.         jmp    .cfrxe
  600. .cfrxer:
  601.         pop    ecx
  602.         or    byte ptr SavedFlags, 1
  603.         ret
  604.         endp
  605. ;
  606. ; only function 47h call 'ccdir'.
  607. ;  so, transfer data is always 64 byte.
  608. ;
  609. ;cisip:
  610. ccdir:
  611.         mov    esi,offset DosWorkO    
  612.         int    21h
  613.         mov    ExeEax, eax
  614.         lahf
  615.         mov    byte ptr SavedFlags, ah
  616.         jc    .ccdirx
  617.         mov    esi, offset DosWorkO
  618.         mov    edi, [bp].resi
  619.         add    edi, EData.Base
  620.         sub    edi, ThisDataBase
  621.         mov    cx, 64 / 4
  622.         cld
  623.     rep    movsd
  624. .ccdirx:
  625.         ret
  626. ;
  627. ;     c_input_dx_data
  628. ; ds:dx contains input data
  629. ; ecx contains length
  630. ;
  631. cfwrite        proc    near
  632.         mov    esi, [bp].redx
  633.         add    esi, EData.Base
  634.         sub    esi, ThisDataBase
  635.         xor    eax, eax
  636.         mov    ExeEAX, eax    ; transfered bytes
  637.         mov    bx, [bp].rBX        ; handle
  638.         mov    ecx, [bp].rECX        ; bytes
  639.         cld
  640. .cfw1:
  641.         jcxz    .cfw3
  642.         push    ecx
  643.         cmp    ecx, DosBufferSize
  644.         jbe    .cfw2
  645.         mov    ecx, DosBufferSize
  646. .cfw2:
  647.         push    ecx
  648.         mov    edi, offset DosBuffer
  649.         mov    dx, di
  650.         prefix32
  651.     rep    movsb    
  652.         pop    ecx
  653.  
  654. IF FMR70
  655.         call    a20_off
  656. ENDIF        
  657.         mov    ax, [bp].rax
  658.         int    21h
  659.         pop    ecx
  660. IF FMR70
  661.         call    a20_on
  662. ENDIF
  663.         jc    .cfwxerr
  664.         movzx    eax, ax
  665.         add    ExeEax, eax
  666.         
  667.         sub    ecx, eax
  668.         ja    .cfw1
  669. .cfw3:
  670.         and    byte ptr SavedFlags, not 1
  671.         ret
  672. .cfwxerr:
  673.         or    byte ptr SavedFlags, 1
  674.         ret
  675.         endp
  676. ;
  677. ctempnam:
  678.         mov    esi, [bp].redx
  679.         add    esi, EData.Base
  680.         sub    esi, ThisDataBase
  681.         push    esi
  682.  
  683.         mov    al, 0
  684. ; length of input string        -- should be subroutined
  685.         mov    edi, esi
  686.         mov    ecx, 200
  687.         prefix32
  688.     rep    scasb
  689.         sub    ecx, 200
  690.         neg    ecx
  691.         inc    ecx
  692.         
  693.         push    ecx
  694.         mov    edi, offset DosWorkI    ; copy string int my buffer
  695.         cld
  696.         prefix32
  697.     rep    movsb
  698. IF FMR70
  699.         call    a20_off
  700. ENDIF        
  701.         mov    ecx, [bp].recx        ; issue system call
  702.         int    21h
  703.         mov    ExeEax, eax
  704. IF FMR70
  705.         call    a20_on
  706. ENDIF
  707.         jc    .ctempx
  708.         pop    ecx            ; remember input string length
  709. ;
  710.         add    ecx, 13            ; add tempname field
  711.         pop    edi            ; string buffer of exp
  712.         mov    esi, offset DosWorkI
  713.         cld
  714.         prefix32            ; copy answer
  715.     rep    movsb
  716. .ctempx:
  717.         ret
  718.         endp
  719.  
  720. ;
  721. ; rename function
  722. ; ds:dx --> current path name
  723. ; es:di --> new path name
  724. ;    path name should shorter than 2+64+13 bytes !
  725. crename        proc    near
  726. ;ci_ren:
  727.         mov    esi,[bp].rEDI
  728.         add    esi,[EData.Base]
  729.         sub    esi,[ThisDataBase]
  730.         cld
  731.         mov    ecx, 128/4        ; temporal value
  732.         mov    edi, offset DosWorkI + 256
  733.         prefix32
  734.     rep    movsd    
  735.         
  736.         mov    esi,[bp].redx
  737.         add    esi, EData.Base
  738.         sub    esi, ThisDataBase
  739.         cld
  740.         mov    ecx, 128/4
  741.         mov    edi, offset DosWorkI
  742.         prefix32
  743.     rep    movsd
  744.         
  745.         mov    dx, offset DosWorkI + 0
  746.         mov    di, offset DosWorkI + 256
  747. IF  FMR70
  748.         call    a20_off
  749. ENDIF        
  750.         mov    eax, [bp].rEAX
  751.         int    21h
  752.         mov    ExeEAX, eax
  753.         lahf    
  754.         mov    byte ptr SavedFlags, ah
  755. IF FMR70
  756.         call    a20_on
  757. ENDIF
  758.         ret
  759.         endp
  760. ;
  761. cpsp        proc    near
  762.         mov    [bp].rebx, PSP2Sel
  763.         ret
  764.         endp
  765.  
  766. ;
  767. ; specially for I/O control 
  768. ; copy data in DosWorkI to ds:dx (cx bytes)
  769. ;
  770. ciIOC        proc    near
  771.         mov    ax,[bp].rax
  772.         cmp    al,0
  773.         je    cnopr
  774.         cmp    al,1
  775.         je    cnopr
  776.         cmp    al,2
  777.         je    cfread        ; read cx bytes into ds:edx
  778.         cmp    al,3
  779.         je    cfwrite        ; write cx bytes from ds:edx
  780.         cmp    al,4
  781.         je    cfread
  782.         cmp    al,5
  783.         je    cfwrite
  784.         cmp    al,7        ;6,7 get information
  785.         jbe    cnopa        ;
  786.         cmp    al,8
  787.         je    cnopa
  788.         cmp    al,10
  789.         jbe    cnopr        ;9,10
  790.         cmp    al,11
  791.         je    cnopr
  792.         jmp    cabort
  793.         endp
  794.  
  795. _TEXT        ends
  796.         end    
  797.