C programming using putty - need help for project

This is a discussion on C programming using putty - need help for project within the C Programming forums, part of the General Programming Boards category; my program only needs to handle the following MIPS instructions: add, addi, addiu, addu, beq, bgez, bgtz, blez, bltz, bne, ...

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    1

    C programming using putty - need help for project

    my program only needs to handle the following MIPS instructions: add, addi, addiu, addu, beq, bgez, bgtz, blez, bltz, bne, j, jal, jalr, jr, lb, lui, lw, mul, nop, ori, sb, sll, slt, sra, sub, sw, syscall, xor, and xori.
    for each of the machine instructions my program should determine what MIPS instruction it is, and print that out on a separate line together with its address and machine code.

    so basically i got this project where i need to design a program that reads in hexadecimal values (eg. 8fa40000 27a50004 24a6000) using a text file and outputs something like this:

    [0x00400000] 0x8fa40000 lw
    [0x00400004] 0x27a50004 addiu
    [0x00400008] 0x24a60004 addiu
    (sample output)

    showing the machine address, machine instruction and the opcode of the instruction, with no additional whitespace.


    to do all this, i gotta to decode some aspects of MIPS instructions and keep track of the current address. specifi cally, i need to:
     - keep track of the current location. i assume that the fi rst instruction will be at address 0x00400000 and each further instruction will be four bytes later.
     - determine the opcode of each instruction.

    so by the end i need to carefully separate the opcodes into classes, and create code to determine the opcode of any given instruction.

    my problem is, i don't even know how to get started. it would be great if you guys could help me out, thanks =)

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    What you're talking about is a disassembler... pretty standard stuff in years gone by, now part of most debuggers.

    You should be able to find all kinds of tutorials and examples on the web.

    You need to sit down with pencil and paper and work the problem until you understand it.
    You need to become the process... what steps do you have to do to take a program apart.

    Then once you understand the problem well enough that you can verbalize it, you can start planning which functions you need.
    Then you can start writing your code.

    Nobody... not anywhere... could take on a project like this by simply sitting down and writing code. It's too complex.

    For our part... get through the process, get your code started. If you get stuck, ask specific questions and post relevent code sections here and we'll see what we can do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming project
    By Eman in forum General Discussions
    Replies: 1
    Last Post: 04-06-2011, 10:27 AM
  2. plz help me in my c programming project
    By fifi25 in forum C Programming
    Replies: 2
    Last Post: 11-04-2010, 07:39 AM
  3. C programming invoke putty/plink
    By PUBBY in forum C Programming
    Replies: 2
    Last Post: 07-27-2007, 01:01 PM
  4. Printing in PuTTY
    By mall0y in forum Tech Board
    Replies: 6
    Last Post: 09-28-2006, 10:25 AM
  5. C Programming Project Help!!!
    By Neildadon in forum C Programming
    Replies: 1
    Last Post: 05-21-2002, 12:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21