Help with homework

Can someone please help me with this homework? I don't know where to even begin. I don't want someone to do it for me, just tell me how I should do this. Thank you.

http://www.csis.ysu.edu/~kriss/classes/f2013/3740/index.html
Which homework?
This is your class index... What exactly are you looking for? (When trying to click any chapter, it's asking for user/pass.
I don't know why it went to that page instead of the page my homework is on. I'm sorry. It's the second to last one called "Writting a MARIE assembler (due 10/23/2012)".
Would anyone happen to know what I should do?
I cannot access the readings, but this homework appears to be a departure from what you have done so far. It requires you to use programming skills you have gained from other classes.

You need to write a program (in C++ or whatever language your professor accepts) to read a file, given by the user.

Your program will read the file twice.

The first time, it is just looking for where things go. This is pretty easy since all your opcodes appear to be one word wide, and each word has its own address.

Once you have a table of symbol-name to index/location, print it out.

The second time you read the file in order to create the output assembly, using your symbol table to properly compile the opcodes.

For example, the LOAD opcode is 1000 + address of word to load. Since the symbol "X" refers to the word at location 104, the complete opcode is 1104. Notice that all the opcodes and addresses/locations are given in hexadecimal.

To get the filename from the user, I recommend you use main()'s arguments:

1
2
3
4
5
6
7
8
9
10
11
12
13
// here's some pseudo-code to get started

int main( int argc, char** argv )
{
    if (argc != 2) complain();

    const char* filename = argv[ 1 ];

    create_symbol_table( filename );
    assemble( filename );

    return 0;
}

Start with that and see where you can go from there. For example, which standard container will you use to store your symbol table? How will you check to see that the input does not contain the same symbol more than once?

See how far you can get with that.
Topic archived. No new replies allowed.