1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

display all uppercase letters from A-Z and their ASCII value in binary beside them...

Discussion in 'Assembly Language Programming (ALP) Forum' started by brextin, Mar 28, 2010.

  1. brextin

    brextin New Member

    Mar 28, 2010
    Likes Received:
    Trophy Points:
    i'm doing this code but it only print one letter and it's letter A together with the binary value of letter A, i hope you could help me correct my code,,really need this,please help me... thanks... hoping for immediate reply... i'm using TASM x8086...
    .model small
    .stack 100h
        nextLine db 10, 13, '$ '
    mov ax, @data
    mov ds, ax
    mov es, ax
    mov al, 'A'
    mov ch, 1
    cmp ch, 27
    je ulit2
    mov ah, 2
    mov dl, al
    int 21h
    inc al
    inc ch
    jmp ulit
    XOR BX, BX                   ; clear BX
    MOV BL, AL                   ; move AL to BL
    XOR BH, BH                   ; clear BH
    MOV CX, 8                    ; initialize loop counter
    MOV AH, 2                    ; set output function
    @OUTPUT:                     ; jump label
    SHL BL, 1                  ; shift left BX by 1 bit
    JNC @ZERO                  ; jump to label @ZERO if CF=0
    INC BH                     ; increment BH
    MOV DL, 31H                ; set DL=1
    JMP @DISPLAY           ; jump to label @DISPLAY
    @ZERO:                     ; jump label
    MOV DL, 30H              ; set DL=0
    @DISPLAY:                  ; jump label
    INT 21H                  ; display digit
    LOOP @OUTPUT                ; jump to label @OUTPUT
    OR BH, 30H                   ; convert the decimal to ascii code
    MOV AH, 2                    ; print the contents of BH
    MOV DL, BH
    mov ah, 4ch
    int 21h
    Last edited by a moderator: Mar 29, 2010

Share This Page