; 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