Praktikum IX - Mencetak Angka


MENCETAK ANGKA

.model small
.code
org 100h

mulai:
mov bl, 10
mov al, 38
div bl
push ax
mov dl,al
add dl, 30h
mov ah,2
int 21h

pop ax
mov dl,ah
mov ah,2
add dl,30h
int 21h

int 20h

end mulai

hasil : 38

CONTOH 2 :

.model small
.code
org 100h

TData :
JMP Proses
Text_Angka Dw 345

Proses:
mov ax, Text_Angka
mov bx,10
xor cx, cx;cx

ulang:
xor dx,dx
div bx
push dx
inc cx
cmp ax,0
jne ulang

cetak :
pop dx
add dl,'0'
mov ah,02
int 21h

loop cetak

int 20h
end TData

hasil : 345

 Tadi kuliah mbahas virus..  jadi penasaran..
---------------------------------------------------------------------------------------------------------------------------------------------------------
Ranking: 5
 
© Bosan Kuliah All Rights Reserved