Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old February 12th, 2007, 08:26 PM
ur2g2b4got ur2g2b4got is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 2 ur2g2b4got User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 20 sec
Reputation Power: 0
Print to screen using Assembly

I am writing a program in assembly that takes in some information and prints out the answer. I have everything the way I need it except for one part. It prompst the user for a number (1,2,3) and then the number of tickets (1-10) and then the users name. It calculates the price and prints out a line with the total. However, before it prints out the total it should print out the name that was entered and then a sentence. It should look like: Jen, your total cost is $100" (if you entered 10 tickets at $10 each). I know how to print an integer and a string but not a string that was the result of user input. I will put the segments of code below that I believe is important. Any help that you could be, I would really appreciate it. Thank you! And let me know if you need more of the code to understand what I did.

move $t1, $v0 # saves number of seats to $t1
mul $t1, $t1, 10 # gets price of tickets

li $v0, 4 # users name goes in register $v0
la $a0, prompt2 # address of string to be printed
# goes in register $a0
syscall

li $v0, 8 # code for read_string goes in register $v0
la $a0, statestr # address of the input goes in register $a0
li $a1, 20 # size of buffer goes in register $a1
syscall

li $v0, 4 #prints out name
la $a0, string3
syscall

li $v0, 4
la $a0, statestr
la $a0, string #prints out string
syscall

move $a0, $t1
li $v0, 1
syscall

Reply With Quote
  #2  
Old February 12th, 2007, 10:54 PM
ur2g2b4got ur2g2b4got is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 2 ur2g2b4got User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 20 sec
Reputation Power: 0
Never mind everyone! I figured it out! I was missing a syscall in order to print it out. Now I just have to get the formatting of the output correct!

Thanks anyway!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Print to screen using Assembly


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway