CSE 378 Homework 2 - Part 3

Cebollita Programming

Problem Description

You're going to write a primitive disassembler - a program that takes as input a hex number representing a Cebollita machine instruction and prints out what the instruction is using the more easily read notation of the assembler.

Here's an example:

Enter an instruction in hex:    01284820
ADD    $9, $9, $8
Enter an instruction in hex:    0000000c
SYSCALL    $0, $0, $0
Enter an instruction in hex:    c
SYSCALL    $0, $0, $0
Enter an instruction in hex:
SLL    $0, $0, $0
Enter an instruction in hex:    23bdfff8
Not a recognized instruction type
Enter an instruction in hex:    z

Syscall: Exit
(The Cebollita graphical debugger window includes a disassembly of instructions in the text pane at the top.)

A few more particulars, some of which are illustrated in the example above:

Required Implementation Approach

You'll write two pieces of code, resulting in two files:

Suggested Implementation Approach

Almost everything you have to do in this assignment is new. I suggest you develop your solution in this way:
  1. Start by writing a standalone C-- program that disassembles. Get that working first, before worrying about writing a mainline or anything in assembler.

    The things to be wary of here are the C-- pointer data types (e.g., char*), which are probably new to you, and the fact that C-- is such a bare bones language that many things that are natural to say and that you can say in Java or C will not be recognized in C-- (e.g., for loops).

  2. Once that is working, write the mainline in assembler, and work on getting the procedure call linkage correct.

Prologues and iolibs

You'll want to use prologue-os.o and iolib-os.o

How To Turn In

1. Navigate to the directory containing disasm.c and main.s.

2. Type in 'turnin -c cse378 main.s disasm.c'.

3. Enter your section.