I am creating a restaurant program in assembly language which display a list of food together with its price.
When user want to make an order, the program will prompt user to enter product number and enter the quantity of food they want to buy. The program will then calculate/multiply the price and the quantity, then display the total price of the order.
My codes seems like error because it only display weird character as the output of the multiplication. It also displays the line7 string twice when I run the program.
I really appreciate it if you could help me and explain the mistakes I made. Thank you in advance!
inputqty db 10,13 “Input quantity: $”
line10 db 10,13, “-----Food Menu-----$”
line7 db 10,13, “1. Pizza: $2 $”
orderopt db 10,13, “Input product ID to make order: $”
pizzaprice db 2
totalprice db 10,13, "Total price: $"
foodmenu:
mov ah,9
lea dx,line10 ;display food menu banner
int 21h
mov ah,9
lea dx,line7 ;display pizza menu with price
int 21h
mov ah,9
lea dx,orderopt ;prompt user to input choice
int 21h
mov ah,1 ;read a character
int 21h
cmp al,31h
je pizzatotal ;calculate the total price of pizza if user input is 1
pizzatotal:
mov ah,9
lea dx,inputqty ;prompt user to input quantity
int 21h
mov ah,1
int 21h
sub al,48
mov bl,pizzaprice
add bl,48
mul bl
mov ah,9
lea dx,pizzatotal ;displaying the total price
add dl,48
int 21h
mov ah,2
mov dl,al ;to display result
add dl,48
int 21h
cmp al,30h
je foodmenu