📄 int2f.asm
字号:
; Returns zero if successfully locked or unlocked. Otherwise
; returns non-zero.
; If the return value is non-zero, it is the negated error
; return code for the DOS 0x5c call. */
;STATIC int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
; int fileno, /* file_table entry number */
; unsigned long ofs, /* offset into file */
; unsigned long len, /* length (in bytes) of region to lock or unlock */
; int unlock) /* one to unlock; zero to lock */
global SHARE_LOCK_UNLOCK
SHARE_LOCK_UNLOCK:
mov ax,0x10a4
jmp short share_common
; Int 2F Multipurpose Remote System Calls
;
; added by James Tabor jimtabor@infohwy.com
; changed by Bart Oldeman
;
; assume ss == ds after setup of stack in entry
; sumtimes return data *ptr is the push stack word
;
remote_lseek: ; arg is a pointer to the long seek value
mov bx, cx
mov dx, [bx]
mov cx, [bx+2]
; "fall through"
remote_getfattr:
clc ; set to succeed
int 2fh
jc ret_neg_ax
jmp short ret_int2f
remote_lock_unlock:
mov dx, cx ; parameter block (dx) in arg
mov bx, cx
mov bl, [bx + 8] ; unlock or not
mov cx, 1
int 0x2f
jnc ret_set_ax_to_carry
mov ah, 0
jmp short ret_neg_ax
;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg)
global NETWORK_REDIRECTOR_MX
NETWORK_REDIRECTOR_MX:
pop bx ; ret address
pop cx ; stack value (arg); cx in remote_rw
pop dx ; off s
pop es ; seg s
pop ax ; cmd (ax)
push bx ; ret address
call_int2f:
push bp
push si
push di
cmp al, 0fh
je remote_getfattr
mov di, dx ; es:di -> s and dx is used for 1125!
cmp al, 08h
je remote_rw
cmp al, 09h
je remote_rw
cmp al, 0ah
je remote_lock_unlock
cmp al, 21h
je remote_lseek
cmp al, 22h
je remote_process_end
cmp al, 23h
je qremote_fn
push cx ; arg
cmp al, 0ch
je remote_getfree
cmp al, 1eh
je remote_print_doredir
cmp al, 1fh
je remote_print_doredir
int2f_call:
xor cx, cx ; set to succeed; clear carry and CX
int 2fh
pop bx
jnc ret_set_ax_to_cx
ret_neg_ax:
neg ax
ret_int2f:
pop di
pop si
pop bp
ret
ret_set_ax_to_cx: ; ext_open or rw -> status from CX in AX
; otherwise CX was set to zero above
xchg ax, cx ; set ax:=cx (one byte shorter than mov)
jmp short ret_int2f
remote_print_doredir: ; di points to an lregs structure
mov es,[di+0xe]
mov bx,[di+2]
mov cx,[di+4]
mov dx,[di+6]
mov si,[di+8]
lds di,[di+0xa]
clc ; set to succeed
int 2fh
pop bx ; restore stack and ds=ss
push ss
pop ds
jc ret_neg_ax
ret_set_ax_to_carry: ; carry => -1 else 0 (SUCCESS)
sbb ax, ax
jmp short ret_int2f
remote_getfree:
clc ; set to succeed
int 2fh
pop di ; retrieve pushed pointer arg
jc ret_set_ax_to_carry
mov [di],ax
mov [di+2],bx
mov [di+4],cx
mov [di+6],dx
jmp short ret_set_ax_to_carry
remote_rw:
clc ; set to succeed
int 2fh
jc ret_min_dx_ax
xor dx, dx ; dx:ax := dx:cx = bytes read
jmp short ret_set_ax_to_cx
ret_min_dx_ax: neg ax
cwd
jmp short ret_int2f
qremote_fn:
mov bx, cx
lds si, [bx]
jmp short int2f_restore_ds
remote_process_end: ; Terminate process
mov ds, [_cu_psp]
int2f_restore_ds:
clc
int 2fh
push ss
pop ds
jmp short ret_set_ax_to_carry
; extern UWORD ASMCFUNC call_nls(UWORD subfct, struct nlsInfoBlock *nlsinfo,
; UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize, UWORD FAR *buf, UWORD *id);
global _call_nls
_call_nls:
push bp
mov bp, sp
push si
mov al, [bp + 4] ; subfct
mov ah, 0x14
mov si, [bp + 6] ; nlsinfo
mov bx, [bp + 10] ; cp
mov dx, [bp + 12] ; cntry
mov cx, [bp + 14] ; bufsize
les di, [bp + 16] ; buf
push bp
mov bp, [bp + 8] ; bp
int 0x2f
pop bp
mov bp, [bp + 20] ; store id (in SS:) unless it's NULL
or bp, bp
jz nostore
mov [bp], bx
nostore:
pop si
pop bp
ret
;
; Test to see if a umb driver has been loaded.
; if so, retrieve largest available block+size
;
; From RB list and Dosemu xms.c.
;
; Call the XMS driver "Request upper memory block" function with:
; AH = 10h
; DX = size of block in paragraphs
; Return: AX = status
; 0001h success
; BX = segment address of UMB
; DX = actual size of block
; 0000h failure
; BL = error code (80h,B0h,B1h) (see #02775)
; DX = largest available block
;
; (Table 02775)
; Values for XMS error code returned in BL:
; 00h successful
; 80h function not implemented
; B0h only a smaller UMB is available
; B1h no UMB's are available
; B2h UMB segment number is invalid
;
segment INIT_TEXT
; int ASMPASCAL UMB_get_largest(void FAR * driverAddress,
; UCOUNT * seg, UCOUNT * size);
global UMB_GET_LARGEST
UMB_GET_LARGEST:
push bp
mov bp,sp
mov dx,0xffff ; go for broke!
mov ax,1000h ; get the umb's
call far [bp+8] ; Call the driver
;
; bl = 0xB0 and ax = 0 so do it again.
;
cmp bl,0xb0 ; fail safe
jne umbt_error
and dx,dx ; if it returns a size of zero.
je umbt_error
mov ax,1000h ; dx set with largest size
call far [bp+8] ; Call the driver
cmp ax,1
jne umbt_error
; now return the segment
; and the size
mov cx,bx ; *seg = segment
mov bx, [bp+6]
mov [bx],cx
mov bx, [bp+4] ; *size = size
mov [bx],dx
umbt_ret:
pop bp
ret 8 ; this was called NEAR!!
umbt_error: xor ax,ax
jmp short umbt_ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -