Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : TDECSHOW

 
Output of file : TDECSHOW contained in archive : ASM-SUBR.ZIP
;-------------------------tdecshow routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
; page : 95
;
; NAME TDECSHOW
;
; ROUTINE FOR DISPLAY OF FLOATING POINT
;
; FUNCTION: This routine displays a floating point number on the std
; output device.
;
; INPUT: Upon input a number is stored in temporary decimal floating point
; form. The temporary format has a string of 25 decimal digits, a sign
; byte, and a base ten exponent which is stored in two's complement 16-bit
; binary format (Fig 5-5).
;
; OUTPUT: The individual characters of a floating point number are sent
; out the standard output device. The form of the output is: a sign char-
; acter which is blank or minus, followed by decimal digits of the mantissa
; with one imbedded decimal point to the right of the first significant
; digit. Following the mantissa is an exponent which starts with the letter
; 'E', then a sign, then a d8cimal number (Fig 5-4).
;
; REGISTERS USED: AL, CX, DX and SI are modified.
;
; SEGMENTS REFERENCED: The data segment contains the variables DECBUFF
; (25 BYTES), DECSIGN (1 byte), and DECEXP (2 bytes).
;
; ROUTINES CALLED: STDOUT, DEC16OUT
;
; SPECIAL NOTES: This is a near procedure needed by FPOUT.
;
; ROUTINE TO DISPLAY TEMPORARY DECIMAL FLOATING POINT NUMBERS
;
tdecshow proc near
;
; output the sign
cmp decsign,0 ; is the sign there ?
mov al,' ' ; space if not
je decshow1
;
; output a minus sign
mov al,'-' ; minus sign
;
tdecshow1:
call stdout ; send it out
;
tdecshow2:
; output the first digit and a decimal point
lea si,decbuff+21 ; point to the first digit
mov al,[si] ; get it
dec si ; point to next digit
add al,30h ; convert to ASCII
call stdout ; send it out
;
mov al,'.' ; ASCII decimal point
call stdout ; send it out
;
; output the rest of the decimal string
mov cx,7 ; only seven more digits
;
tdecshow3:
mov al,[si] ; get digit
dec si ; point to next digit
add al,30h ; convert to ASCII
call stdout ; send it out
loop tdecshow3 ; until all digits sent
;
mov al,'E' ; E for (E)xponent
call stdout ; send it out
;
; now the exponent
mov dx,decexp ; grab the exponent
cmp dx,0 ; check sign
mov al,'+' ; plus sign
jge tdecshow4 ; if non-negative
;
; if negative exponent
neg dx ; absolute value of exponent
mov al,'-' ; minus sign
;
tdecshow4:
call stdout ; output sign of exponent
call dec16out ; output exponent
;
ret ; return
;
tdecshow endp
;-------------------------tdecshow routine ends---------------------------+


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : TDECSHOW

  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/