Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : AULSHR.ASM

 
Output of file : AULSHR.ASM contained in archive : VCCRT1.ZIP
page ,132
title aulshr - assigning unsigned long shift right
;***
;aulshr.asm - Assigning Unsigned Long Shift Right routine
;
; Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
;
;Purpose:
; defines assigning unsigned long shift right routines
; creates the following routines:
; __aFFaulshr (large model)
; __aFNaulshr (medium model)
; __aNFaulshr (compact model)
; __aNNaulshr (small model)
;
;*******************************************************************************

.xlist
include version.inc
include cmacros.inc
include mm.inc
include cmphlp.inc
.list

sBegin code
assumes cs,code
assumes ds,data

page
;***
;aulshr - assigning unsigned long shift right
;
;Purpose:
; does a unsigned long shift right, assigning the result to the dividend.
; calls ulshr to do all the real work
;
;Entry:
; parameters passed on stack as follows:
; 1st pushed: shift count (WORD)
; 2nd pushed: address of unsigned long to be shifted
; (DWORD in models C,L; WORD in models S,M)
;
;Exit:
; the unsigned long is updated
; NOTE: parameters are removed from stack by this routine
;
;Uses:
; AX, CX, DX
;
;Exceptions:
;
;*******************************************************************************

aASGN ulshr

; Move arguments into registers and invoke the regular shift routine, ulshr,
; to do the work. The local stack looks as follows after it has been set up:
;
; -------------------------
; | |
; |-----------------------|
; | shift count |
; |-----------------------|
; |pointer to long value**|
; |-----------------------|
; | return address* |
; |-----------------------|
;BP,SP-->| old BP |
; |-----------------------|
; | |
; -------------------------
;
; * - 2 bytes if small/compact model; 4 bytes if medium/large model
; ** - 2 bytes if small/medium model; 4 bytes if large/compact model

PNTR equ BPARGBAS[bp] ; stack addr. of data pointer
SHFTCNT equ DAT_ADDR_SZ+BPARGBAS[bp] ; stack addr. of shift count
VAL equ [bx] ; address of data value

if sizeD
push ds
endif
push bx

LOAD bx,PNTR ; get pointer to data into bx or ds:bx
mov ax,LOWORD(VAL) ; dx:ax <- long data value
mov dx,HIWORD(VAL)
mov cx,SHFTCNT ; cx <- shift count

callnahlpr ulshr ; use __a?ulshr to do the actual shifting

; store away shifted value and return

mov LOWORD(VAL),ax ; store shifted value
mov HIWORD(VAL),dx

pop bx
if sizeD
pop ds
endif

cEnd nolocals
return 2+DAT_ADDR_SZ

sEnd

end


  3 Responses to “Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : AULSHR.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/