Homework 2: What is a Wombat Anyway?

The goals of this homework are: Wikipedia says "Humans can receive puncture wounds from wombat claws, as well as bites. Startled wombats can also charge humans and bowl them over, with the attendant risks of broken bones from the fall."

While my wombat is friendly, waiting until the last minute to get to know it might provoke attacks similar to those described above.


Please do the following:
  1. [1 pont each] Provide the WOMBAT machine language representation for each of the following WOMBAT assembly instructions
    1. ADDI 23
    2. ADD hx2F2
    3. jmpz 102
  2. 1 point each] Provide the WOMBAT assembly code for each of the following WOMBAT machine instructions
    1. 1101 0000 0010 00102
    2. 906616
    3. 0300008
  3. [1 point] Give the low level (CPU component level) RTN needed to accomplish the WOMBAT instruction LOAD 100. Do not include the Fetch portion of this instruction.
  4. [1 point] Give the low level (CPU component level) RTN needed to accomplish the WOMBAT instruction LOADI 100. Do not include the Fetch portion of this instruction.
  5. [1 point] Would you expect a difference in the amount of time it takes to exectue LOAD 100 vs LOADI 100? Why or why not?
  6. [1 point] The WOMBAT instruction allows a 12 bit address. What is the highest memory location available? Why?
  7. [4 points] Write a program which reads in integers representing a lower bound, an upper bound and a skip factor, and prints the numbers from the lower bound to the upper bound inclusive. The input will be in the proper order, the lower bound will always be less than the upper bound, and the increment will be greater than 0.
  8. [6 points] Write a program in WOMBAT assembly that reads in a single positive integer greater than 2. If the integer is prime, print a 1 otherwise print a 0.
    [bennett@mirkwood wmb]$ sim a.out
    Enter a value=> 13
    Output value : 1
    [bennett@mirkwood wmb]$ sim a.out
    Enter a value=> 14
    Output value : 0
    

Submission