Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   display all uppercase letters from A-Z and their ASCII value in binary beside them... (http://www.go4expert.com/forums/display-uppercase-letters-z-ascii-value-t21560/)

brextin 28Mar2010 21:35

display all uppercase letters from A-Z and their ASCII value in binary beside them...
 
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



All times are GMT +5.5. The time now is 20:19.