Clean up int2f assembly a bit (merge some common bits, clarify label names)

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@922 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-05-04 10:16:45 +00:00
parent 99d287bd2c
commit 02db26383e
1 changed files with 29 additions and 35 deletions

View File

@ -282,8 +282,8 @@ remote_lseek: ; arg is a pointer to the long seek value
remote_getfattr: remote_getfattr:
clc ; set to succeed clc ; set to succeed
int 2fh int 2fh
jc no_clear_ax jc ret_neg_ax
jmp short no_neg_ax jmp short ret_int2f
remote_lock_unlock: remote_lock_unlock:
mov dx, cx ; parameter block (dx) in arg mov dx, cx ; parameter block (dx) in arg
@ -291,10 +291,9 @@ remote_lock_unlock:
mov bl, [bx + 8] ; unlock or not mov bl, [bx + 8] ; unlock or not
mov cx, 1 mov cx, 1
int 0x2f int 0x2f
jnc ret_set_ax_to_carry
mov ah, 0 mov ah, 0
jc lock_error jmp short ret_neg_ax
mov al, 0
lock_error: jmp no_clear_ax
;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg) ;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg)
global NETWORK_REDIRECTOR_MX global NETWORK_REDIRECTOR_MX
@ -312,7 +311,7 @@ call_int2f:
cmp al, 0fh cmp al, 0fh
je remote_getfattr je remote_getfattr
mov di, dx ; es:di -> s mov di, dx ; es:di -> s and dx is used for 1125!
cmp al, 08h cmp al, 08h
je remote_rw je remote_rw
cmp al, 09h cmp al, 09h
@ -338,19 +337,20 @@ int2f_call:
xor cx, cx ; set to succeed; clear carry and CX xor cx, cx ; set to succeed; clear carry and CX
int 2fh int 2fh
pop bx pop bx
jnc clear_ax jnc ret_set_ax_to_cx
no_clear_ax: ret_neg_ax:
neg ax neg ax
xchg cx, ax ret_int2f:
clear_ax:
xchg ax, cx ; extended open -> status from CX in AX
; otherwise CX was set to zero above
no_neg_ax:
pop di pop di
pop si pop si
pop bp pop bp
ret 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 remote_print_doredir: ; di points to an lregs structure
mov es,[di+0xe] mov es,[di+0xe]
mov bx,[di+2] mov bx,[di+2]
@ -364,51 +364,45 @@ remote_print_doredir: ; di points to an lregs structure
pop bx ; restore stack and ds=ss pop bx ; restore stack and ds=ss
push ss push ss
pop ds pop ds
jc no_clear_ax jc ret_neg_ax
xor cx, cx ret_set_ax_to_carry: ; carry => -1 else 0 (SUCCESS)
jmp short clear_ax sbb ax, ax
jmp short ret_int2f
remote_getfree: remote_getfree:
clc ; set to succeed clc ; set to succeed
int 2fh int 2fh
pop di ; retrieve pushed pointer arg pop di ; retrieve pushed pointer arg
jc no_clear_ax jc ret_set_ax_to_carry
mov [di],ax mov [di],ax
mov [di+2],bx mov [di+2],bx
mov [di+4],cx mov [di+4],cx
mov [di+6],dx mov [di+6],dx
xor cx, cx jmp short ret_set_ax_to_carry
jmp short clear_ax
remote_rw: remote_rw:
clc ; set to succeed clc ; set to succeed
int 2fh int 2fh
jc int2f_carry jc ret_min_dx_ax
mov ax, cx xor dx, dx ; dx:ax := dx:cx = bytes read
xor dx, dx ; dx:ax = bytes read jmp short ret_set_ax_to_cx
jmp short no_neg_ax ret_min_dx_ax: neg ax
int2f_carry: neg ax
cwd cwd
jmp short no_neg_ax jmp short ret_int2f
qremote_fn: qremote_fn:
push ds
mov bx, cx mov bx, cx
lds si, [bx] lds si, [bx]
clc jmp short int2f_restore_ds
int 2fh
pop ds
mov ax,0xffff
jc no_neg_ax
xor cx, cx
jmp short clear_ax
remote_process_end: ; Terminate process remote_process_end: ; Terminate process
mov ds, [_cu_psp] mov ds, [_cu_psp]
int2f_restore_ds:
clc
int 2fh int 2fh
push ss push ss
pop ds pop ds
jmp short no_neg_ax jmp short ret_set_ax_to_carry
; extern UWORD ASMCFUNC call_nls(UWORD subfct, struct nlsInfoBlock *nlsinfo, ; extern UWORD ASMCFUNC call_nls(UWORD subfct, struct nlsInfoBlock *nlsinfo,
; UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize, UWORD FAR *buf, UWORD *id); ; UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize, UWORD FAR *buf, UWORD *id);