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

 
Output of file : ALSHL.ASM contained in archive : VCCRT1.ZIP
page ,132
title alshl - assigning long shift left
;***
;alshl.asm - Assigning Long Shift Left routine
;
; Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
;
;Purpose:
; defines assigning long shift left routines
; creates the following routines:
; __aFFalshl (large model)
; __aFNalshl (medium model)
; __aNFalshl (compact model)
; __aNNalshl (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
;***
;alshl - assigning long shift left
;
;Purpose:
; does a long shift left, assigning the result to the dividend.
; calls lshl to do all the real work
;
;Entry:
; parameters passed on stack as follows:
; 1st pushed: shift count (WORD)
; 2nd pushed: address of long to be shifted
; (DWORD in models C,L; WORD in models S,M)
;
;Exit:
; the long is updated
; NOTE: parameters are removed from stack by this routine
;
;Uses:
; AX, CX, DX
;
;Exceptions:
;
;*******************************************************************************

aASGN lshl

;
; Moves arguments into registers and invoke the normal left shift routine
; lshl 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 compact/large 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 lshl ; use __a?lshl 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 : ALSHL.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/