# Category : Assembly Language Source Code

Archive : ASM_SUBR.ZIP

Filename : BIN16IN

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

; page : 42

;

; NAME BIN16IN

; ROUTINE FOR conversion from ASCII binary to internal 16-bit binary

;

; FUNCTION: This routine accepts a binary number from the std input device

; and converts it to internal 16-bit binary form.

; INPUT: The individual digits of the binary number are received in ASCII

; through a call to a std I/O routine. The valid digits are 0 and 1. An

; ASCII code other than for a valid digit will terminate the routine.

; OUTPUT: A 16-bit Binary number is returned in the DX register.

; REGISTERS USED: Only DX is moified. It returns the result.

; SEGMENTS REFERENCED: None

; ROUTINES CALLED: STDIN

; SPECIAL NOTES: None

;

; ROUTINE TO CONVERT FROM ASCII BINARY TO INTERNAL 16-BIT BINARY

;

bin16in proc far

;

push ax ; save registers

;

mov dx,0 ; initialize dx as zero

;

bin16in1:

call stdin ; digit comes in thru al

sub al,30h ; subtract 30 hex

jl bin16in2 ; check if too low

cmp al,1

jg bin16in2 ; check if too high

cbw ; convert to word

;

sal dx,1 ; shift dx left once

add dx,ax ; add in digit

jmp bin16in1

;

bin16in2:

;

pop ax ; restore registers

ret ; return

;

bin16in endp

;-------------------------bin16in 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/