campo-sirio/src/gfm/dmi.asm
mtollari 1b14ec9415 Spostamento cartella sorgenti
git-svn-id: svn://10.65.10.50/branches/R_10_00@23236 c028cbd2-c16b-5b4b-a496-9718f37d4682
2016-09-09 13:59:02 +00:00

75 lines
1.7 KiB
NASM
Executable File

; int _DoubleUnsArr(a,n)
;
; ARGUMENT
; unsigned *a[];
; unsigned n;
;
; DESCRIPTION
; Doubles the number a (taken as one number of 'n' 16-bit unsigned's).
;
; SIDE EFFECTS
; Overflow if sign bit goes set in high-order unsigned
;
; RETURNS
; None, athough they are set in AX for future use if needed
;
; AUTHOR
; Andy Anderson 31-JAN-1987 14: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_ = number of words to shift left (multipy by 2)
;
; for if small model then
; parm1_ = ptr to source1
; parm2_ = number of words to shift left (multipy by 2)
;
;
cproc _DoubleUnsArr,,_dmi
if _LDATA
push ds
lds si,parm1_ ; ptr to a
mov cx,parm3_ ; get number of words to shift
else
mov si,parm1_
mov cx,parm2_ ; ditto for small model
endif
xor ax,ax ; clear flags
lp:
rcl Word Ptr [si],1 ; word and multipy it by 2
inc si ; and increase the index (offset)
inc si ; without disturbing the carry
loop lp ; for next until done
jc overf ; carry-out is overflow and
test [si-2],8000h ; overflow if high-order set
jnz overf
mov ax,GM_SUCCESS ; otherwise no overflow
exit:
if _LDATA
pop ds
endif
cproce
overf:
mov ax,GM_FAILURE
jmp short exit
endps
END