Thread: Have you ever programmed for MIPS?

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    277

    Have you ever programmed for MIPS?

    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

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    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:

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    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

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    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

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    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/AS...365094-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.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 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.

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    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

  8. #8
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    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 mips
    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.
    And to conclude that Maragato is constantly contradicting in this thread->
    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
    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....

    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.

  9. #9
    Quote Originally Posted by GanglyLamb
    ...

    ::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...
    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.
    DrakkenKorin

    Get off my Intarweb!!!!

  10. #10
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    lol if anyone looked at my code they would have seen its a little buggy, luckily I fixed it before turning it in.

  11. #11
    Quietly Lurking
    Join Date
    Aug 2001
    Posts
    208
    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

  12. #12
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    What's wrong with x86?

  13. #13
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    Quote Originally Posted by Bubba
    What's wrong with x86?
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tell me the best 1 person programmed game made???
    By RNH in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 12-10-2007, 02:42 PM
  2. Never programmed before, and got a problem.
    By Dribbler in forum C++ Programming
    Replies: 16
    Last Post: 01-02-2007, 06:44 AM
  3. Have You Programmed Anything Cool?
    By thetinman in forum A Brief History of Cprogramming.com
    Replies: 53
    Last Post: 05-15-2006, 06:39 PM
  4. Game I've Programmed
    By GodLike in forum Game Programming
    Replies: 17
    Last Post: 05-06-2002, 07:39 AM
  5. Game I've Programmed
    By GodLike in forum Windows Programming
    Replies: 0
    Last Post: 04-11-2002, 09:36 AM