campo-sirio/gfm/hmi.asm
alex ba237a9d91 Patch level : no patch
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll)


git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
2002-02-26 12:19:02 +00:00

71 lines
1.6 KiB
NASM
Executable File

; void _HalveUnsArr(a,n)
;
; ARGUMENT
; unsigned *a[];
; unsigned n;
;
; DESCRIPTION
; Halves the number a (taken as one number of 'n' 16-bit unsigneds).
;
; SIDE EFFECTS
; If number is odd, discards low-order bit.
;
; RETURNS
; None.
;
; AUTHOR
; Andy Anderson 31-JAN-1987 13:30
; Copyright (C) 1987-90 Greenleaf Software Inc. All Rights Reserved.
;
; MODIFICATIONS
; aa 08-JUL-87 80-bit
;
;
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 right (divide by 2)
;
; for if small model then
; parm1_ = ptr to source1
; parm2_ = number of words to shift right (divide by 2)
;
;
cproc _HalveUnsArr,,_hmi
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 bx,bx ; clear flags
mov bx,cx ; then convert number of word to
dec bx ; index for loop
rcl bx,1 ; change byte to word offset
xor ax,ax ; clear flags
lp:
rcr Word Ptr [bx+si],1 ; word and divide it by 2
dec bx ; and decrease the index (offset)
dec bx
loop lp ; for next until done
; no return values
if _LDATA
pop ds
endif
cproce
endps
END