summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-12-25 09:22:19 +0100
committerLoic Guegan <loic.guegan@mailbox.org>2023-12-25 09:22:19 +0100
commit02574531db0f1e3e69b1615d9801ea70775aaf84 (patch)
tree5681e42a7e274bdf654456e99d34c6edfddd8d3e
parent16f7128a0c81a508940ee1a8e8d1b8fe36f83259 (diff)
Minor changes
-rw-r--r--src/vcpu.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/vcpu.c b/src/vcpu.c
index e722bb0..4ca5cc1 100644
--- a/src/vcpu.c
+++ b/src/vcpu.c
@@ -20,14 +20,19 @@ void VCPUFetch(){
}
void VCPUDecode(){
- State.X=(State.opcode<<4) & 0xF0;
- State.Y=(State.opcode<<8) & 0xF0;
- State.N=(State.opcode<<12) & 0xF0;
- State.NN=(State.opcode<<8) & 0xFF;
- State.NNN=(State.opcode<<4) & 0xFFF0;
+ State.X=(State.opcode>>8) & 0xF;
+ State.Y=(State.opcode>>4) & 0xF;
+ State.N=State.opcode & 0xF;
+
+ State.NN=State.Y;
+ State.NN=State.NN<<4;
+ State.NN=State.NN | State.N;
+
+ State.NNN=State.opcode&0x0FFF;
}
void VCPUExecute(){
+ // VCPUDump();
switch(State.opcode >> 12){
case 0x0:
ScreenClear();
@@ -63,4 +68,9 @@ void VCPUExecute(){
void VCPUDump(){
printf("opcode: 0x%04x\n",State.opcode&0xFFFF);
+ printf("X: 0x%01x\n",State.X);
+ printf("Y: 0x%01x\n",State.Y);
+ printf("N: 0x%01x\n",State.N);
+ printf("NN: 0x%02x\n",State.NN);
+ printf("NNN: 0x%03x\n",State.NNN);
}