Note: This is the June 17, 2006 capture of http://bentong.topcities.com/comp/progs/asm/dispbin.htm from the Wayback Machine. This was uploaded to the reloaded ISLESV.NET on June 22, 2023.

; Procedure DISPBIN.ASM: Display value of AL in binary on screen.
;
; This file Copyright (C) 2004-2005 by Vincent "Bentong" S. Isles
;				  http://bentong.topcities.com
; 				  bentong_isles@yahoo.com
        .MODEL  SMALL
        .CODE

        PUBLIC  DISPBIN                         ; make this available during
                                                ; linking
DISPBIN PROC    NEAR
        MOV     CX,8                            ; set up loop counter
NEXT:   SHL     AL,1                            ; move MSB into CF
        PUSH    AX                              ; save number first
        JC      ITIS1                           ; was MSB a 1?
        MOV     DL,30H                          ; load '0' character
        JMP     SAY01                           ; go display it
ITIS1:  MOV     DL,31H                          ; load '1' character
SAY01:  MOV     AH,2                            ; display char func
        INT     21H
        POP     AX                              ; get number back
        LOOP    NEXT
        RET
DISPBIN ENDP

        END

Leave a Reply

Your email address will not be published. Required fields are marked *