PROGRAM FOR PC(PROGRAM COUNTER) experienced programer please look

This is a discussion on PROGRAM FOR PC(PROGRAM COUNTER) experienced programer please look within the C Programming forums, part of the General Programming Boards category; hi... ive got a problem i have to write a code to implement a PC but im not really sure ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    11

    PROGRAM FOR PC(PROGRAM COUNTER) experienced programer please look

    hi...
    ive got a problem i have to write a code to implement a PC but im not really sure where to get started ,its one of my questions on my practice exam and i cant seem to figure it out.. can someone please give me some tips on how to go along with it or if someone has a example of one... thanks

    **************************************************
    write a C progam that implements the program counter of a MIPS mico processor to access a BYTE wide array of main memory and retrive a 32 bit wide instruction. Adapt your program so that the program counter can deal with jumps to and return from process(ie alter the contents of PC)
    *************************************************

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Well the PC is just going to be an integer which is increased by 4 every instruction. For each count, you need to take the integer value stored in the PC, and use it as an address. Access that address in memory, and extract 32 bits of machine code. Execute the machine code, increment the PC by 4, and repeat. Simple

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Line Counter program
    By siavoshkc in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-22-2006, 12:49 AM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. Last program!!
    By buckwheat88 in forum C++ Programming
    Replies: 12
    Last Post: 01-17-2006, 12:31 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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