# Category : Assembly Language Source Code

Archive : ASM_SUBR.ZIP

Filename : DECHALF

; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.

; page : 101

;

; NAME DECHALF

;

; ROUTINE FOR Halving A Temporary Decimal Floating Point Number

;

; FUNCTION: This routine divides a temporary decimal floating point number

; by two.

;

; INPUT: Upon input DI points to a temporary decimal floating point number.

;

; OUTPUT: Upon exit the number has been divided by two.

;

; REGISTERS USED: AX, CX and DI are modified.

;

; SEGMENTS REFERENCED: The data segment contains a temporary decimal

; floating point number.

;

; ROUTINES CALLED: None

;

; SPECIAL NOTES: This is a NEAR routine called by FPOUT.

;

; ROUTINE TO DIVIDE TEMPORARY FP DECIMAL NUMBER BY 2 - RESULT NOT HALVED.

;

dechalf proc near

;

; first shift up one digit

mov cx,25 ; for a count of 25

mov al,0 ; zero previous byte

;

dechalf1:

xchg al,[di] ; exchange with current digit

inc di ; point to next digit

loop dechalf1

;

dec decexp ; decrement decimal digit

;

; now divide by two

mov cx,25 ; for a count of 25

mov ah,0 ; clear

;

dechalf2:

push cx ; save count

dec di ; point to next digit

mov al,[di] ; get the digit

mov cl,2 ; divisor of 2

aad ; adjust for division

div cl ; divide

mov [di],al ; put back

pop cx ; restore count

loop dechalf2

;

ret ; return

;

dechalf endp

;-------------------------dechalf routine ends---------------------------+

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

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

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/