Skip to content

Andre Myrick - Computer Architecture#201

Open
AM-Myrick wants to merge 19 commits into
bloominstituteoftechnology:masterfrom
AM-Myrick:master
Open

Andre Myrick - Computer Architecture#201
AM-Myrick wants to merge 19 commits into
bloominstituteoftechnology:masterfrom
AM-Myrick:master

Conversation

@AM-Myrick
Copy link
Copy Markdown

@AM-Myrick AM-Myrick commented Mar 4, 2019

Day 1: Get print8.ls8 running

  • Inventory what is here
  • Implement struct cpu in cpu.h
  • Add RAM functions cpu_ram_read and cpu_ram_write
  • Implement cpu_init()
  • Implement the core of cpu_run()
  • Implement the HLT instruction handler
  • Add the LDI instruction
  • Add the PRN instruction

Day 2: Add the ability to load files dynamically, get mult.ls8 and stack.ls8 running

  • Un-hardcode the machine code
  • Implement the cpu_load function to load an .ls8 file given the filename passed in as an argument
  • Implement a Multiply instruction and Print the result (run mult8.ls8)
  • Implement the System Stack and be able to run the stack.ls8 program

Day 3: Get call.ls8 running

  • Implement the CALL and RET instructions
  • Implement Subroutine Calls and be able to run the call.ls8 program

Stretch

  • Add the timer interrupt to the LS-8 emulator
  • Add the keyboard interrupt to the LS-8 emulator

Copy link
Copy Markdown

@codejoncode codejoncode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't needed today but maybe needed down the road add a flag to your cpu struct unsigned char FL;

Copy link
Copy Markdown

@codejoncode codejoncode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job Andre looks like you should be able to read files.

Copy link
Copy Markdown

@codejoncode codejoncode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..

Copy link
Copy Markdown

@codejoncode codejoncode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsigned char operandA = ram[(cpu->PC + 1) & 0xff];
unsigned char operandB = ram[(cpu->PC + 2) & 0xff];

// True if this instruction might set the PC
int instruction_set_pc = (IR >> 4) & 1;
//Above^^^^^^^^^^^should before the while loop

// increase PC after the switch

if (!instruction_set_pc) {
    cpu->PC += ((IR >> 6) & 0x3) + 1;
}

//this is because the first 2 bits to the left of the instruction will tell you how many operands

this will prevent you from having to use two switch statements.

Some more advance stuff but you could do this instead of incrementing on each individual switch. I know you're usually interested in less lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants