1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

    Joined:
    Mar 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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...
    Code:
    .model small
    .stack 100h
    .data
        nextLine db 10, 13, '$ '
    .code
    
    mov ax, @data
    mov ds, ax
    mov es, ax
    
    mov al, 'A'
    mov ch, 1
    
    ulit:
    cmp ch, 27
    je ulit2
    mov ah, 2
    mov dl, al
    int 21h
    inc al
    inc ch
    
    jmp ulit
    
    ulit2:
    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
    end
     
    Last edited by a moderator: Mar 29, 2010

Share This Page