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

 
Output of file : OCT16IN contained in archive : ASM-SUBR.ZIP
;-------------------------oct16in routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
; page : 45
;
; NAME OCT16IN
; ROUTINE FOR conversion from ASCII octal to 16-bit Binary
;
; FUNCTION: This routine accepts an octal number from the standard input
; device and converts it to internal 16-bit binary form.
; INPUT: The individual digits of the octal number are received in ASCII
; through a call to a standard I/O routine. The valid digits are 0 - 7.
; 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 modified. It returns the result.
; SEGMENTS REFERENCED: None
; ROUTINES CALLED: STDIN
; SPECIAL NOTES: None
;
; ROUTINE TO CONVERT FROM ASCII OCTAL TO INTERNAL 16-BIT BINARY
;
oct16in proc far
;
push cx ; save registers
push ax
;
mov dx,0 ; initialize DX
;
oct16in1:
call stdin ; a digit comes in in AL
sub al,30h ; reduce from ASCII
jl oct16in2 ; check if too low
cmp al,7
jg oct16in2 ; check if too high
cbw ; convert to word
;
mov cl,3
sal dx,cl ; shift dx left once
add dx,ax ; add in digit
jmp oct16in1
;
oct16in2:
;
pop ax ; restore registers
pop cx
ret ; return
;
oct16in endp
;-------------------------oct16in routine ends---------------------------+


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

  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/