;-------------------------bin16out routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
;         page : 44
;
; ROUTINE FOR CONVERSION FROM 16-BIT BINARY TO ASCII BINARY
;
; FUNCTION: This routine accepts an 16-bit binary number in the DX register
; and converts it to ASCII binary form which is sent to the std output
; device.
; INPUT: Upon entry an 16-bit binary is in the DX register
; OUTPUT: A string of ASCII digits representing a binary number is sent
; out through the std output device.
; REGISTERS USED:  No registers are modified.  DX is used for input
; SEGMENTS REFERENCED:  None
; ROUTINES CALLED:  STDOUT
; SPECIAL NOTES: None
;
; ROUTINE TO CONVERT FROM INTERNAL 16-BIT BINARY TO ASCII BINARY
;
bin16out	proc	far
;
;  a binary number is in DX
;	
	push	cx		; save registers
	push	ax
;
	mov	cx,16		; loop for a count of 16
bin16out1:
	rol	dx,1		; rotate DX left once
	mov	al,dl		; move into AL
	and	al,1		; just keep digit
	add	al,30h		; adjust AL to ASCII
	call	stdout		; output to console
	loop	bin16out1	; again until cx is 0
;
	pop	ax		; restore registers
	pop	cx
	ret			; return
;
bin16out	endp
;-------------------------bin16out routine ends---------------------------+
