Skip to content

Instantly share code, notes, and snippets.

@febnug
Created January 12, 2021 13:42
Show Gist options
  • Save febnug/15fc89b1295665a56a873385a2d3ec6e to your computer and use it in GitHub Desktop.
Save febnug/15fc89b1295665a56a873385a2d3ec6e to your computer and use it in GitHub Desktop.
; bikin program .EXE
;
; caranya :
;
; C:\> tasm BAJU
; C:\> tlink BAJU
;
; jalanin programnya :
;
; C:\> BAJU
.model small
.stack 100h
org 100h
.data
input db 13, 10, 'Ukuran baju (S/M/L) ? $'
input2 db 13, 10, 'Input lagi (Y/T) ? $'
ukuran_besar db 13, 10, 'Ukuran baju besar $'
ukuran_sedang db 13, 10, 'Ukuran baju sedang $'
ukuran_kecil db 13, 10, 'Ukuran baju kecil $'
.code
mulai:
mov ax, @data
mov ds, ax
input_user:
lea dx, input
mov ah, 09
int 21h
mov ah, 0
int 16h
mov bx, ax
mov dl, al
mov ah, 2
int 21h
kecil:
cmp bl, 53h
je cetak_string_kecil
jne sedang
jmp input_lagi
sedang:
cmp bl, 4Dh
je cetak_string_sedang
jne besar
besar:
cmp bl, 4Ch
je cetak_string_besar
jmp input_lagi
input_lagi:
lea dx, input2
mov ah, 09
int 21h
mov ah, 0
int 16h
mov bx, ax
mov dl, al
mov ah, 2
int 21h
ya:
cmp bl, 59h
je input_user
jne tidak
tidak:
cmp bl, 54h
je selesai
cetak_string_kecil:
lea dx, ukuran_kecil
jmp cetak
cetak_string_sedang:
lea dx, ukuran_sedang
jmp cetak
cetak_string_besar:
lea dx, ukuran_besar
jmp cetak
cetak:
mov ah, 09h
int 21h
jmp input_lagi
selesai:
mov ax, 4c00h
int 21h
end mulai
; bikin file .COM
;
; caranya :
;
: C:\> tasm DOLLAR.ASM
; C:\> tlink /t DOLLAR
;
; jalanin programnya :
;
; C:\> DOLLAR
.model small
.code
org 100h
mulai:
mov al, "$"
mov ah, 0eh
int 10h
mov al, "a"
int 10h
mov al, "t"
int 10h
mov al, "u"
int 10h
mov al, " "
int 10h
mov al, "N"
int 10h
mov al, "u"
int 10h
mov al, "s"
int 10h
mov al, "a"
int 10h
mov al, " "
int 10h
mov al, "$"
int 10h
mov al, "a"
int 10h
mov al, "t"
int 10h
mov al, "u"
int 10h
mov al, " "
int 10h
mov al, "B"
int 10h
mov al, "a"
int 10h
mov al, "n"
int 10h
mov al, "g"
int 10h
mov al, "s"
int 10h
mov al, "a"
int 10h
mov ax, 4c00h
int 21h
end mulai
; solusi yang "dumb" menurut saya
;
; karena fungsi 09h di interupsi 21h, harus pake "$" (terminated string)
; untuk mencetak string
;
; + ---------------------------------------
; | entry: ds:dx -> "$"-terminated string
; | return al = 24h
; +----------------------------------------
;
; jadi ya pake teletype output aja, fungsi 0eh di interupsi 10h
; tapi bisa juga pake fungsi 02h di fungsi 21h ¯\_(ツ)_/¯
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment