campo-sirio/gfm/smi.asm

82 lines
1.8 KiB
NASM
Raw Normal View History

; void _smi(src1,src2,n)
;
; ARGUMENT
; unsigned *src1,*src2;
; unsigned n;
;
; DESCRIPTION
; Subtracts src1-src2 and puts the result in src1. It's
; assumed that caller has checked to assure that src1<src2 so
; no borrow can ever be generated(that's why this is a void)!!
;
; SIDE EFFECTS
; None.
;
; RETURNS
; None.
;
; AUTHOR
; Andy Anderson 31-JAN-1987 11:45
; Copyright (C) 1987-90 Greenleaf Software Inc. All Rights Reserved.
;
; MODIFICATIONS
;
;
;
include model.h
include prologue.h
include gm.equ
pseg gmath
;
; if large memory model then:
;
; parm1_ = ptr to source 1
; parm3_ = ptr to source 2;
; parm5_ = number of words
;
; for if small model then
; parm1_ = ptr to source1
; parm2_ = ptr to source2
; parm3_ = number of words
cproc _SubUnsArr,,_smi
if _LDATA
push ds
push es
lds si,parm1_ ; ptr to src1
les di,parm3_ ; ptr to src2
mov cx,parm5_ ; init number of subtracts
else
mov si,parm1_
mov di,parm2_
mov cx,parm3_ ; number of subtracts
endif
xor ax,ax ; clear flags
lp:
mov ax,[si] ; sub's ints til done with multiple
if _LDATA
sbb ax,es:[di] ; precision number
else
sbb ax,[di] ; precision number
endif
mov [si],ax ; sum to src1
inc di ; then move up one digit in
inc di
inc si ; string for each of the ints
inc si
loop lp ; continue until done
if _LDATA
pop es
pop ds
endif
cproce
endps
END