1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

MIPS Assembly Program Help - Press 0 on keyboard to show options?

Discussion in 'Assembly Language Programming (ALP) Forum' started by BearPaw, Mar 26, 2011.

  1. BearPaw

    BearPaw Guest


    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):

    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: "

    li $v0, 4
    la $a0, welcome

    li $v0, 4
    la $a0, name

    li $v0, 8
    la $a0, buffer
    li $a1, 60

    li $v0, 4
    la $a0, namerespond

    li $v0, 4
    la $a0, buffer


    li $v0, 4
    la $a0, catalog

    li $v0, 5
    add $s0, $s0, 1

    bltz $s0, orange

    li $v0, 4
    la $a0, options

    j red


    li $v0, 1
    move $a0, $s0

Share This Page