0% found this document useful (0 votes)
46 views3 pages

Contoh Program Assembly

This program is an assembly language program for a restaurant menu and ordering system. It displays a header, prompts the user to enter their ID and name, then displays a menu in a loop. The user can select a menu item number or press 0 to exit. If an invalid number is entered, an error is displayed before looping back to the menu.

Uploaded by

askarya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views3 pages

Contoh Program Assembly

This program is an assembly language program for a restaurant menu and ordering system. It displays a header, prompts the user to enter their ID and name, then displays a menu in a loop. The user can select a menu item number or press 0 to exit. If an invalid number is entered, an error is displayed before looping back to the menu.

Uploaded by

askarya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Contoh Program Assembly

START ORG $1000 ; first instruction of program

LEA HEADER,A1
MOVE.B #14,D0 ;LITERAL NO 14, D0 REGISTER DATA, D0 AKAN
BERISI 14
TRAP #15 ;TAMPILKAN PESAN

LEA ID,A1 ;LABEL INPUT ID


MOVE.B #14,D0
TRAP #15

LEA BUFFER,A1 ;INPUT ID


MOVE.B #2,D0
TRAP #15

LEA NAMA,A1 ;LABEL INPUT NAMA


MOVE.B #14,D0
TRAP #15

LEA BUFFER2,A1 ;INPUT NAMA


MOVE.B #2,D0
TRAP #15

LEA IDO,A1 ;LABEL OUTPUT ID


MOVE.B #14,D0
TRAP #15

LEA BUFFER,A1 ;OUTPUT ID


MOVE.B #13,D0
TRAP #15

LEA NAMA0,A1 ;LABEL OUTPUT NAMA


MOVE.B #14,D0
TRAP #15

LEA BUFFER2,A1 ;OUTPUT NAMA


MOVE.B #13,D0
TRAP #15

;OUTPUT MENU
LOOP LEA MENU,A1
MOVE.B #14,D0
TRAP #15

;INPUT MENU
MOVE.B #4,D0
TRAP #15
CMP.L #0,D1
BEQ DONE

CMP.B #0,D1
BLT SALAH
CMP.B #5,D1
BGT SALAH

;MASUK PERCABANGAN
CMP.B #1,D1
;MOVE.L #5000,D1
BNE DUA
LEA PIL1,A1
MOVE.B #14,D0
TRAP #15
BRA LOOP

DUA CMP.B #2,D1


;MOVE.L #5000,D1
BNE TIGA
LEA PIL2,A1
MOVE.B #14,D0
TRAP #15
BRA LOOP

TIGA CMP.B #3,D1


BNE EMPAT
LEA PIL3,A1
MOVE.B #14,D0
TRAP #15
BRA LOOP

EMPAT CMP.B #4,D1


BNE LIMA
LEA PIL4,A1
MOVE.B #14,D0
TRAP #15
BRA LOOP

LIMA LEA PIL5,A1


MOVE.B #14,D0
TRAP #15

BRA LOOP

SALAH LEA SLH,A1


MOVE.B #14,D0
TRAP #15
BRA LOOP

DONE MOVE.B #9,D0


TRAP #15
CR EQU $0D
LF EQU $0A
MENU DC.B CR,LF,'PILIH MENU 1-5, TEKAN O UNTUK EXIT : ',0
SLH DC.B 'ANGKA YANG ANDA INPUT TIDAK DIANTARA 1-5',CR,LF,0
PIL1 DC.B '1. BAKSO, HARGA : RP.5000',CR,LF,0
PIL2 DC.B '2. MIE AYAM, HARGA : RP.6000',CR,LF,0
PIL3 DC.B '3. RAMES, HARGA : RP.4000',CR,LF,0
PIL4 DC.B '4. ES TEH, HARGA : RP.2000',CR,LF,0
PIL5 DC.B '5. ES SUSU, HARGA : RP.3000',CR,LF,0
;LABEL UNTUK ID
ID DC.B 'MASUKKAN NO KURSI ANDA : ',0
IDO DC.B CR,LF,CR,LF,'KURSI ANDA ADALAH : ',0
;LABEL UNTUK NAMA
NAMA DC.B 'MASUKKAN NAMA ANDA : ',0
NAMA0 DC.B 'NAMA ANDA ADALAH : ',0
;HEADER
HEADER DC.B 'WARUNG MAKAN INDAH',CR,LF
DC.B 'TERSEDIA BERBAGAI MACAM MENU MAKANAN',CR,LF
DC.B 'SELAMAT MENIKMATI',CR,LF,CR,LF,CR,LF
DC.B '1. BAKSO HARGA : Rp. 5000,-',CR,LF
DC.B '2. MIE AYAM HARGA : Rp. 6000,-',CR,LF
DC.B '3. RAMES HARGA : Rp. 4000,-',CR,LF
DC.B '4. ES TEH HARGA : Rp. 2000,-',CR,LF
DC.B '5. ES SUSU HARGA : Rp. 3000,-',CR,LF,CR,LF,CR,LF,0

TOTAL DC.B 'TOTAL HARGA ADALAH : '

DS.W 0
BUFFER DS.B 80
BUFFER2 DS.B 80

END START ; last line of source

You might also like