I'm doing it to university and it is a pain. I hate assembly, anyone has a funny history or fact about coding in it? By the way if you have some source examples they will be very welcome cause I still kinda lost
I'm doing it to university and it is a pain. I hate assembly, anyone has a funny history or fact about coding in it? By the way if you have some source examples they will be very welcome cause I still kinda lost
Here is somthing I did for school this weekend.
Code:.data nameArray: .asciiz "Troy Curless" success: .asciiz "Sucess" failure: .asciiz "Failure" .text .ent main main: subu $sp,$sp,36 #Activation record 12 + 24. sw $fp,36($sp) #Save the frame pointer on the stack for the main function. addu $fp,$sp,36 la $s0,nameArray #address of nameArray in $a0 to pass to printchar: la $s1,success #Success message la $s2,failure #Failed message add $a0,$s0,$zero jal printchar #call printchar function add $a0,$s1,$zero #prep for function call addi $ra,$ra,12 #adjust return register beq $v0,$zero,fail #branch to print failure if 0 failure jal printchar #print success fail: add $a0,$s2,$zero #else prep load failure into arg register jal printchar #call printchar(failure) slt $v1,$zero,$v0 #set on successful print j exit .end main printchar: sw $ra,-12($fp) sw $s0,0($fp) sw $s1,-4($fp) sw $s2,-8($fp) li $v0,4 syscall li $v0,1 lw $s0,0($fp) lw $s1,-4($fp) lw $s2,-8($fp) # Now do housekeeping for the main function. lw $ra,-12($fp) #Load the old return address from the stack jr $ra #Return to caller. .end printchar exit:
In fact I need to discover how to save an int into a specific memory position. I know google ive fast searched it but I couldnt find, my C project is killing me, I have few time for mips
I've got my old MIPs textbook I could sell you cheap, if you don't mind waiting a week for me to get it from my parents' house (and if I can find it). It's a hell of a book
I think this is it
http://www.amazon.com/exec/obidos/AS...365094-4120670
-Govtcheez
[email protected]
I got it free from a friend but I'm too occupied to read it right now, so I wonder if I can make the project just by reading some code examples.Originally Posted by Govtcheez
> I hate assembly, anyone has a funny history or fact about coding in it?
Well write the silly thing in C then.
Then do "gcc -S" on it to get the assembler and tweak it to match what you want to do.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Originally Posted by Salem
I wish I could, but I need to learn this stuff
I'm doing it to university and it is a pain. I hate assembly,my C project is killing me, I have few time for mipsAnd to conclude that Maragato is constantly contradicting in this thread->Quote:
Originally Posted by Govtcheez
I've got my old MIPs textbook I could sell you cheap, if you don't mind waiting a week for me to get it from my parents' house (and if I can find it). It's a hell of a book
I think this is it
http://www.amazon.com/exec/obidos/A...0365094-4120670
I got it free from a friend but I'm too occupied to read it right now, so I wonder if I can make the project just by reading some code examples.
You say you dont have time, that you hate assembly, you donīt want to read that book and you say you cant just learn it by looking at codesnippets....Quote:
Originally Posted by Salem
> I hate assembly, anyone has a funny history or fact about coding in it?
Well write the silly thing in C then.
Then do "gcc -S" on it to get the assembler and tweak it to match what you want to do.
I wish I could, but I need to learn this stuff
ONE suggestion for you: get right onto it and study the damn thing. The faster you start learning it the faster all your problems will be over.
::edit::
also i think that that book has an index ( like any other book actually ) so take the book and just look into the things you need to accomplish this project...dont worry about the rest for now just make sure you know the things needed for your project...
Last edited by GanglyLamb; 10-04-2004 at 07:01 AM.
Originally Posted by Salem
not only that but there's a section in that book (appendix) that deals with mips and common usages - we used the same book for my comp org class.Originally Posted by GanglyLamb
DrakkenKorin
Get off my Intarweb!!!!
lol if anyone looked at my code they would have seen its a little buggy, luckily I fixed it before turning it in.
First, the book that Govt was offering is a great book, I used it in my Comp Arch. class and it is great if you want to learn how computers work on a level just above logic gates.
Second, how can you dislike mips, compared to x86 asm its wonderful
All, X86 asm is a hell, instructions are messud up, you cant freely use the registers, some instructions doesnt work on some registers... Common problems of a CISC machine.Originally Posted by Bubba