Hello,
I need help and don't understand how to press 0 on the keyboard to show a list of options. If the number is not 0 then it should say "Error: Please press 0."
Then once I have the options listed, I still cannot figure out how to select each one by its' number.
I am trying to have a customer select from the options and then give a total (like a receipt), thank you!
Here is what I have (I tried using jump tables):
.data
buffer: .space 60
welcome: .asciiz "\nWelcome to the Candy Store"
name: .asciiz "\nWhat is your name? "
namerespond: .asciiz "\nTake a look at our candy selection..... "
catalog: .asciiz "\nPress 0 to view the candy catalog."
options: .asciiz "\nThe candy catalog :
To purchase select 1 Cookie $200
To purchase select 2 Gum $100
To purchase select 3 Lollipop $500
To purchase select 4 Gummie Bears $300
To purchase select 5 Chocolate $100
selection: .asciiz "\nYou selected to purchase: "
total: .asciiz "\nYour total is: "
.text
main:
li $v0, 4
la $a0, welcome
syscall
li $v0, 4
la $a0, name
syscall
li $v0, 8
la $a0, buffer
li $a1, 60
syscall
li $v0, 4
la $a0, namerespond
syscall
li $v0, 4
la $a0, buffer
syscall
red:
li $v0, 4
la $a0, catalog
syscall
li $v0, 5
syscall
add $s0, $s0, 1
bltz $s0, orange
li $v0, 4
la $a0, options
syscall
j red
orange:
li $v0, 1
move $a0, $s0
syscall
