diff options
| author | Loic Guegan <loic.guegan@mailbox.org> | 2023-12-25 07:30:17 +0100 |
|---|---|---|
| committer | Loic Guegan <loic.guegan@mailbox.org> | 2023-12-25 07:30:17 +0100 |
| commit | 001e18b3d4a195aaca1d281453d8a89d85563175 (patch) | |
| tree | 10ee21e946926840a63c8b18d40b7d0699f495ca /src/vcpu.c | |
| parent | 475996af26408156486faa43682f7effdabfa156 (diff) | |
Minor changes
Diffstat (limited to 'src/vcpu.c')
| -rw-r--r-- | src/vcpu.c | 32 |
1 files changed, 24 insertions, 8 deletions
@@ -13,7 +13,7 @@ unsigned short S; // General purpose registers (8 bits each) // Note last one often used as a flag register -unsigned char R[16]; +unsigned char V[16]; // Delay timer (8 bits) unsigned char DT; @@ -34,19 +34,35 @@ void VCPUFetch(){ } void VCPUDecode(){ - char X=(State.opcode<<4) & 0xF0; - char Y=(State.opcode<<8) & 0xF0; - char N=(State.opcode<<12) & 0xF0; - char NN=(State.opcode<<8) & 0xFF; - short NNN=(State.opcode<<4) & 0xFFF0; + 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; } void VCPUExecute(){ - switch(State.opcode){ - case 0x00E0: + switch(State.opcode & 0xF){ + case 0x0: ScreenClear(); break ;; + case 0x1: + PC=State.NNN; + break + ;; + case 0x6: + V[State.X]=State.NN; + break + ;; + case 0x7: + V[State.X]+=State.NN; + break + ;; + case 0xA: + I=State.NNN; + break + ;; } } |
