•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 391,767 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,189 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:
Views: 740 | Replies: 2
![]() |
•
•
Join Date: Dec 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi All!
I have a programming assignment that ive been trying to work on. Recently, ive successfully wrote it in java, but im trying to use that as psuedocode so that i can transcribe it into mips - but i dont understand this stuff! ive been reading this book but it honestly doesnt help!
the assignment reads:
1. In the data segment, allocate static space for a long vector of integers.
2. Assign values from x1 to x2 (increment for the next value through the entire vector), where x1 and x2 must be obtained through a dialog with a user. Check for errors in the input (such as x2 greater or equal to x1; Too long vector; etc.)
3. Ask the user to input a number, which will indicate the number of rows of a matrix the stored vector will be converted into.
4. Find out, through a division operation, the number of columns of this matrix.
5. Print the matrix
6. Transpose this matrix – use indexed addressing mode.
7. Print the transposed matrix.
8. Terminate the program.
also, i do not understand the compiler used - im using PCSpim - any clues would help..
any help would be greatly apprciated! Thanks in advance
I have a programming assignment that ive been trying to work on. Recently, ive successfully wrote it in java, but im trying to use that as psuedocode so that i can transcribe it into mips - but i dont understand this stuff! ive been reading this book but it honestly doesnt help!
the assignment reads:
1. In the data segment, allocate static space for a long vector of integers.
2. Assign values from x1 to x2 (increment for the next value through the entire vector), where x1 and x2 must be obtained through a dialog with a user. Check for errors in the input (such as x2 greater or equal to x1; Too long vector; etc.)
3. Ask the user to input a number, which will indicate the number of rows of a matrix the stored vector will be converted into.
4. Find out, through a division operation, the number of columns of this matrix.
5. Print the matrix
6. Transpose this matrix – use indexed addressing mode.
7. Print the transposed matrix.
8. Terminate the program.
also, i do not understand the compiler used - im using PCSpim - any clues would help..
any help would be greatly apprciated! Thanks in advance
Last edited by hsanjakd : Dec 4th, 2007 at 8:11 pm.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,809
Reputation:
Rep Power: 11
Solved Threads: 184
Here's some desperate help:
If I understand your problem correctly, you must get two numbers from the user, x1 and x2, then make an array (or vector) of values from x1 to x2 inclusive?
PCSpim is neither a compiler nor a proper assembler. It is a simulator for a virtual machine.
Write your tal program using your favorite plain-text editor (like emacs or notepad or whatever), load it into spim, and run it with the "Go" button. The only caveat to using Spim is that your program must begin with the label "main" instead of "__start".
Try typing in some simple examples from your textbook. Then try creating some simple examples of your own design.
Here's a simple example designed to help you in your project:
The WikiPedia article has a section on MIPS Assembly Language that lists all the syscall arguments and return values and all the opcodes you'll need.
Hope this helps.
If I understand your problem correctly, you must get two numbers from the user, x1 and x2, then make an array (or vector) of values from x1 to x2 inclusive?
PCSpim is neither a compiler nor a proper assembler. It is a simulator for a virtual machine.
Write your tal program using your favorite plain-text editor (like emacs or notepad or whatever), load it into spim, and run it with the "Go" button. The only caveat to using Spim is that your program must begin with the label "main" instead of "__start".
Try typing in some simple examples from your textbook. Then try creating some simple examples of your own design.
Here's a simple example designed to help you in your project:
MIPS Syntax (Toggle Plain Text)
# Example program to print a friendly # message five times, then quit. .data # This is static data. # Its size does not change. # This is the string to print str_hello: .asciiz "Hello world!\n" # These are syscall argument values # (I like to name them for easy use) print_string: .word 4 # $a0 : address of string to print exit: .word 10 .text # print_n_times( str_hello, 5 ) main: la $a0, str_hello li $a1, 5 jal print_n_times # quit lw $2, exit syscall # subroutine # arguments: # $a0 : address of string to print # $a1 : number of times to print it # # preserve return address on stack print_n_times: sub $sp, 4 sw $ra, 4($sp) # can't print < 0 times... bltz $a1, pnt_end # done if no more to print loop: beq $a1, $0, pnt_end # print the string at m[$a0] lw $2, print_string syscall # number of times to print -= 1 sub $a1, $a1, 1 # next b loop # pop return address and return pnt_end: lw $ra, 4($sp) add $sp, 4 jr $ra
The WikiPedia article has a section on MIPS Assembly Language that lists all the syscall arguments and return values and all the opcodes you'll need.
Hope this helps.
•
•
Join Date: May 2006
Location: ★ ijug.net ★
Posts: 834
Reputation:
Rep Power: 4
Solved Threads: 61
You can first write in c/c++ and decompile it to assembly and get some idea how to code it
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Assembly Marketplace
Similar Threads
- Help Me please help me (Java)
- What's wrong here (C)
- Please hel me.....is urgent!!! (C++)
Other Threads in the Assembly Forum
- Previous Thread: strcat in MIPS
- Next Thread: Simple EEPROM Programmer Through Parallel PC Port (also posted in Developers lounge)



Linear Mode