•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 456,573 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,607 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 881 | Replies: 2
![]() |
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Pretty new to assembly language and I need help with this problem. I'm trying to traverse through a string and see if each character is either a number or a operand (+, -, *, /). Everytime I run the program, it doesn't work properly. I'm pretty sure the error is in the 'lb' line after my loop label but I can't figure out what is wrong. Any help would be greatly appreciated. Thank you.
Also, if anyone knows of a decent MIPS simulator/debugger, please let me know. Thanks again!
.data string1: .asciiz "Please enter a string. Make sure the string only contains RPN characters: " string2: .asciiz "Invalid input: " string3: .asciiz "Input is valid.\n" string4: .asciiz "The first operator is " string5: .asciiz "No operator found.\n" string6: .asciiz "Please enter a single interger: \n" string7: .asciiz "Please enter a single operator (+,-,*,/): \n" string8: .asciiz "The result is " input: .space 50 output: .space 3 .text .globl Olu Olu: la $a0, string1 li $v0, 4 syscall la $a0, input li $v0, 8 syscall move $s0, $a0 #address of input loop: lb $t0, ($s0) # gets a character beq $t0, $zero, next # runs loop till 0 is received blt $t0, 48, charCheck # checks if char is less than 0 bgt $t0, 57, notValid # checks if char is greater than 9 add $s0, $s0, 1 # moves along string j loop notValid: la $a0, string2 li $v0, 4 syscall move $a0, $t0 li $v0, 11 syscall j next charCheck: bne $t0, 42, notValid #checks if char is equal to op bne $t0, 43, notValid bne $t0, 45, notValid bne $t0, 47, notValid add $s0, $s0, 1 j loop next: li $v0, 10 syscall
Also, if anyone knows of a decent MIPS simulator/debugger, please let me know. Thanks again!
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Figured out what was wrong, really stupid mistake. The move instruction before the loop label was supposed to be from $v0 to $s0, not $a0 to $v0. However, when I make the correction and run the program, I get an address out of range error at the 'lb' instruction which is definitely not supposed to happen. Any help would greatly be appreciated. Thanks again!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Assembly Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Computer Architecture Reference (Computer Science and Software Design)
- Convert Word document into a RichText Format document (Visual Basic 4 / 5 / 6)
- How to COmpare a word file and an XML file (C#)
- MIPS language question pls help.. (Assembly)
- get a random word (C++)
- Vb Runtime Files (Visual Basic 4 / 5 / 6)
- Opening MS Word Docs in VB (Visual Basic 4 / 5 / 6)
- Computer powers up, does not boot (Troubleshooting Dead Machines)
- Computer is slower than the tectonic plates shifting (Troubleshooting Dead Machines)
- Word (and other utilities) don't load correctly (Windows NT / 2000 / XP / 2003)
Other Threads in the Assembly Forum
- Previous Thread: Helps?!?
- Next Thread: MASM int 10h help


Linear Mode