Skip to content

Instantly share code, notes, and snippets.

@febnug
Last active January 5, 2021 02:58
Show Gist options
  • Save febnug/6b34c31f846af22dc4ec9786aefd7e65 to your computer and use it in GitHub Desktop.
Save febnug/6b34c31f846af22dc4ec9786aefd7e65 to your computer and use it in GitHub Desktop.
; bikin program .EXE compile dengan :
;
; C:\> tasm aa2
; C:\> tlink aa2
;
;
; belum di fix, masih ada bug
.model small
.stack 200h
.data
hasil db 13, 10, 'Hasil Nilai1 + Nilai2 - Nilai3 = $'
input1 db 13, 10, 'Masukan Nilai1 : $'
input2 db 13, 10, 'Masukan Nilai2 : $'
input3 db 13, 10, 'Masukan Nilai3 : $'
.code
mulai:
mov ax, @data
mov ds, ax
lea dx, input1
mov ah, 09
int 21h
mov ah, 0
int 16h
mov bh, al
mov dl, al
mov ah, 2
int 21h
lea dx, input2
mov ah, 09
int 21h
mov ah, 0
int 16h
mov bl, al
mov dl, bl
mov ah, 2
int 21h
lea dx, input3
mov ah, 09
int 21h
mov ah, 0
int 16h
mov cl, al
mov dl, cl
mov ah, 2
int 21h
lea dx, hasil
mov ah, 09
int 21h
add bh, bl
sub bh, cl
mov al, bh
mov dl, al
mov ah, 2
int 21h
mov ax, 4c00h
int 21h
ret
end mulai
; bikin program .EXE compile dengan :
;
; C:\> tasm uas1
; C:\> tlink uas1
.model small
.stack 100h
org 100h
.data
input db 13, 10, 'Masukan Nilai Anda : $'
kal1 db 13, 10, 'Nilai anda A $'
kal2 db 13, 10, 'Nilai anda B $'
kal3 db 13, 10, 'Nilai anda C $'
kal4 db 13, 10, 'Nilai anda D $'
kal5 db 13, 10, 'Nilai anda E $'
.code
mulai:
mov ax, @data
mov ds, ax
lea dx, input
mov ah, 09
int 21h
mov ah, 0
int 16h
mov bx, ax
mov dl, al
mov ah, 2
int 21h
cmp bl, 32h
je d
jle e
cmp bl, 34h
je c
jle d
cmp bl, 36h
je c
jle c
cmp bl, 38h
je b
jle b
cmp bl, 39h
je a
jle a
a:
lea dx, kal1
jmp cetak
b:
lea dx, kal2
jmp cetak
c:
lea dx, kal3
jmp cetak
d:
lea dx, kal4
jmp cetak
e:
lea dx, kal5
jmp cetak
cetak:
mov ah, 09h
int 21h
mov ax, 4c00h
int 21h
ret
end mulai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment