luis#215
Open
luiscmartinez wants to merge 2 commits into
Open
Conversation
|
|
||
| case ALU_ADD: | ||
| cpu->reg[regA] += cpu->reg[regB]; | ||
| break; |
There was a problem hiding this comment.
These look good. What other operations could you add to the ALU?
| break; | ||
|
|
||
| case POP: | ||
| cpu->reg[operandA] = cpu_ram_read(cpu, cpu->reg[7]++); |
There was a problem hiding this comment.
I like that you're using cpu_ram_read() and cpu_ram_write() for PUSH and POP, I think this is the more proper way of doing this. I just assigned the values directly.
| case RET: | ||
| cpu->PC = cpu_ram_read(cpu, cpu->reg[7]++); | ||
| break; | ||
| case CMP: |
There was a problem hiding this comment.
This is actually an ALU operation. You can move it there if you want to. When looking at the operation codes, the third bit from the left is 1 if it is an ALU operation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.