Program sederhana untuk konversi bilangan heksa mejadi desimal,
ORG 100h
MULAI:
MOV AX,3H
INT 10H
XOR BX,BX
MOV CL,4
MOV AH,1
INT 21h
WHILE_:
CMP AL,0Dh
JE END_WHILE
CMP AL,46H
JG MULAI
CMP AL,30H
JL MULAI
CMP AL,39h
JG HURUF
AND AL,0Fh
JMP GESER
HURUF:
SUB AL,37h
GESER:
SHL BX,4
OR BL,AL
CMP CL,1
JE END_WHILE
INT 21h
LOOP WHILE_
END_WHILE:
mov ah,9
lea dx,baris
int 21h
mov cx,16
simpan:
shl bx,1
jc keri
mov ah,2
mov dl,30h
int 21h
loop simpan
keri:
mov ah,2
mov dl,31h
int 21h
loop simpan
mov ah,4ch
int 21h
ret
baris db 0ah,0dh, '$'
Selamat mecoba
ORG 100h
MULAI:
MOV AX,3H
INT 10H
XOR BX,BX
MOV CL,4
MOV AH,1
INT 21h
WHILE_:
CMP AL,0Dh
JE END_WHILE
CMP AL,46H
JG MULAI
CMP AL,30H
JL MULAI
CMP AL,39h
JG HURUF
AND AL,0Fh
JMP GESER
HURUF:
SUB AL,37h
GESER:
SHL BX,4
OR BL,AL
CMP CL,1
JE END_WHILE
INT 21h
LOOP WHILE_
END_WHILE:
mov ah,9
lea dx,baris
int 21h
mov cx,16
simpan:
shl bx,1
jc keri
mov ah,2
mov dl,30h
int 21h
loop simpan
keri:
mov ah,2
mov dl,31h
int 21h
loop simpan
mov ah,4ch
int 21h
ret
baris db 0ah,0dh, '$'
Selamat mecoba
1 komentar:
lea nya eror gmn tu mbak?
Posting Komentar