MEMBUAT APLIKASI PENGHITUNG IPK DENGAN BAHASA ASSEMBLY
Oleh
chmood
Kali ini saya akan share script program penghitung IPK dengan bahasa Assembly menggunakan program A86.
Scriptnya sebagai berikut:
org 100h
jmp proses1
org 105h
sks: db 03h,03h,02h,02h
org 110h
kal0 db 13,10,'Masukkan Nilai: #39;
kal1 db 13,10,'Angka yang anda masukkan false#39;
kal2 db 'A'
db 13,10,'#39;
kal3 db 'B'
db 13,10,'#39;
kal4 db 'C'
db 13,10,'#39;
kal5 db 'D'
db 13,10,'#39;
kal6 db 'E'
db 13,10,'#39;
kal7 db 13,10,'Bahasa Rakitan :#39;
kal8 db 13,10,'Statistika :#39;
kal9 db 13,10,'Sistem Informasi :#39;
kal10 db 13,10,'Metode Numerik :#39;
kal11 db 13,10,'No Mata Pelajaran SKS Index #39;
kal12 db 13,10,'1 Bahasa Rakitan 3 #39;
kal13 db 13,10,'2 Statistika 3 #39;
kal14 db 13,10,'3 Sistem Informasi 2 #39;
kal15 db 13,10,'4 Metode Numerik 2 #39;
kal16 db 13,10,'-------------------------------#39;
kal17 db '4'
db 13,10,'#39;
kal18 db '3'
db 13,10,'#39;
kal19 db '2'
db 13,10,'#39;
kal20 db '1'
db 13,10,'#39;
kal21 db '0'
db 13,10,'#39;
kal22 db 13,10,' IPK = #39;
ulang: and ax,ax
cmp cx,3
je mp2
cmp cx,2
je mp3
cmp cx,1
je mp4
jmp lanjut
proses1: mov cx,4
mov si,550h
mp1: call mapel1
jmp ratusn
mp2: call mapel2
jmp ratusn
mp3: call mapel3
jmp ratusn
mp4: call mapel4
jmp ratusn
ratusn: mov ah,1
int 21h
banding1: cmp al,31h
jg false
jl proses2
je prosesA1
prosesA1: mov ah,1
int 21h
bandingA1: cmp ah,30h
je prosesA2
jg false
prosesA2: mov ah,1
int 21h
bandingA2: cmp al,30h
je cetakA
jg false
proses2: mov ah,1
int 21h
cmp al,30h
jl false2
cmp al,39h
jg false2
banding2: cmp ax,139h
jz prosesA3
cmp ax,138h
jz prosesB
cmp ax,137h
jz prosesC
cmp ax,136h
jz prosesD
cmp ax,135h
jz prosesE
jl prosesE
prosesA3: mov ah,1
int 21h
cmp al,30h
jl false3
cmp al,39h
jg false3
jmp cetakA
false: call input
false2: call input
false3: mov ah,09
lea dx,kal1
int 21h
jmp ulang
jmp ulang
cetakA: mov al,4h
mov [si],al
inc si
dec cx
jmp ulang
prosesB: mov ah,1
int 21h
cmp al,30h
jl false3
cmp al,39h
jg false3
cetakB: mov al,3h
mov [si],al
inc si
dec cx
jmp ulang
prosesC: mov ah,1
int 21h
cmp al,30h
jl false3
cmp al,39h
jg false3
cetakC: mov al,2h
mov [si],al
inc si
dec cx
jmp ulang
prosesD: mov ah,1
int 21h
cmp al,30h
jl false3
cmp al,39h
jg false3
cetakD: mov al,1h
mov [si],al
inc si
dec cx
jmp ulang
prosesE: mov ah,1
int 21h
cmp al,30h
jl false3
cmp al,39h
jg false3
cetakE: mov al,00h
mov [si],al
inc si
dec cx
jmp ulang
lanjut: mov cx,4
mov si,550h
call judul
cek: cmp cx,4
je mp1a
cmp cx,3
je mp2a
cmp cx,2
je mp3a
cmp cx,1
je mp4a
jne lanjut2
mp1a: call mapel1b
call ceknil
mp2a: call mapel2b
inc si
call ceknil
mp3a: call mapel3b
inc si
call ceknil
mp4a: call mapel4b
inc si
call ceknil
inA: call indexA
dec cx
jmp cek
inB: call indexB
dec cx
jmp cek
nilC: call indexC
dec cx
jmp cek
inD: call indexD
dec cx
jmp cek
inE: call indexE
dec cx
jmp cek
lanjut2: mov ah,9
lea dx,kal16
int 21h
mov di,560h
mov si,550h
mov bp,105h
mov cx,4h
hitung: xor ax,ax
call kali
loop hitung
mov di,560h
xor ax,ax
mov al,[di]
mov cx,3h
hitung2: call tambah
loop hitung2
call bagi
call ipk
ipk4: call ip4
jmp akhir
ipk3: call ip3
jmp akhir
ipk2: call ip2
jmp akhir
ipk1: call ip1
jmp akhir
ipk0: call ip0
jmp akhir
akhir: int 20h
input proc near
mov ah,1
int 21h
ret
input endp
ceknil proc near
mov al,[si]
cmp al,04h
je inA
cmp al,03h
je inB
cmp al,02h
je nilC
cmp al,01h
je inD
cmp al,00h
je inE
ret
ceknil endp
ipk proc near
mov ah,09h
lea dx,kal22
int 21h
cmp bh,4h
je ipk4
cmp bh,3h
je ipk3
cmp bh,2h
je ipk2
cmp bh,1h
je ipk1
cmp bh,0h
je ipk0
ret
ipk endp
tambah proc near
inc di
mov ah,[di]
add al,ah
ret
tambah endp
bagi proc near
mov bh,al
xor ax,ax
mov al,bh
mov bl,0ah
div bl
mov bh,al
ret
bagi endp
kali proc near
mov al,[si]
mov bx,[bp]
mul bl
mov [di],al
inc di
inc si
inc bp
ret
kali endp
mapel1 proc near
mov ah,09
lea dx,kal7
int 21h
ret
mapel1 endp
mapel1b proc near
mov ah,09
lea dx,kal12
int 21h
ret
mapel1b endp
mapel2 proc near
mov ah,09
lea dx,kal8
int 21h
ret
mapel2 endp
mapel2b proc near
mov ah,09
lea dx,kal13
int 21h
ret
mapel2b endp
mapel3 proc near
mov ah,09
lea dx,kal9
int 21h
ret
mapel3 endp
mapel3b proc near
mov ah,09
lea dx,kal14
int 21h
ret
mapel3b endp
mapel4 proc near
mov ah,09
lea dx,kal10
int 21h
ret
mapel4 endp
mapel4b proc near
mov ah,09
lea dx,kal15
int 21h
ret
mapel4b endp
judul proc near
mov ah,9
lea dx,kal16
int 21h
mov ah,9
lea dx,kal11
int 21h
mov ah,9
lea dx,kal16
int 21h
ret
judul endp
indexA proc near
mov ah,9
lea dx,kal2
int 21h
ret
indexA endp
indexB proc near
mov ah,9
lea dx,kal3
int 21h
ret
indexB endp
indexC proc near
mov ah,9
lea dx,kal4
int 21h
ret
indexC endp
indexD proc near
mov ah,9
lea dx,kal5
int 21h
ret
indexD endp
indexE proc near
mov ah,9
lea dx,kal6
int 21h
ret
indexE endp
ip4 proc near
mov ah,9
lea dx,kal17
int 21h
ret
ip4 endp
ip3 proc near
mov ah,9
lea dx,kal18
int 21h
ret
ip3 endp
ip2 proc near
mov ah,9
lea dx,kal19
int 21h
ret
ip2 endp
ip1 proc near
mov ah,9
lea dx,kal20
int 21h
ret
ip1 endp
ip0 proc near
mov ah,9
lea dx,kal21
int 21h
ret
ip0 endp
Print Screen
:
Category
Komentar