Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   MIPS Assembly Program Help - Press 0 on keyboard to show options? (http://www.go4expert.com/forums/mips-assembly-program-help-press-0-t25348/)

BearPaw 27Mar2011 00:19

MIPS Assembly Program Help - Press 0 on keyboard to show options?
 
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


All times are GMT +5.5. The time now is 06:22.