Aritmatik dengan prosedur (assembly)

Aritmatik dengan prosedur (assembly)

A. Kode program :

.MODEL SMALL
.CODE
ORG 100h
start : jmp proses
a DW 24
b DW 13
c DW 3
d DW 2
Kal01 DB 'Bil A = $'
Kal02 DB 13,10,'Bil B = $'
Kal03 DB 13,10,'Bil C = $'
Kal04 DB 13,10,'Hasil Penjumlahan A+B = $'
Kal05 DB 13,10,'Hasil Pengurangan B-C = $'
Kal06 DB 13,10,'Hasil Perkalian A*C = $'
proses:
mov AH,09
mov DX,OFFSET Kal01
int 21h
mov AX, a
call show
mov AH,09
mov DX,OFFSET Kal02
int 21h
mov AX, b
call show
mov AH,09
mov DX,OFFSET Kal03
int 21h
mov AX, c
call show
mov AH,09
mov DX,OFFSET Kal04
int 21h
mov AX, a
ADD AX, b
call show
mov AH,09
mov DX,OFFSET Kal05
int 21h
mov AX, b
SUB AX, c
call show
mov AH,09
mov DX,OFFSET Kal06
int 21h
mov AX, a
MUL c

show proc near
mov BX,10
XOR CX,CX
putar :
XOR DX,DX
DIV BX
PUSH DX
INC CX
cmp AX,0
JNE putar
print :
pop DX
ADD DL,'0'
mov AH,02
int 21h
loop print
ret
endp
int 20h

END start

B. Screenshoot :

Tidak ada komentar:

Posting Komentar