diff options
| author | 2019-09-24 15:25:22 -0400 | |
|---|---|---|
| committer | 2019-09-24 15:25:22 -0400 | |
| commit | 2aace3fc7302e8e09dfc2a7f54576c340d054a1c (patch) | |
| tree | 0c2b45d3afa8531231fa5618fe9c35b6ea105503 | |
| parent | 2a9e97d7429f93a224fc366f78eed75308f3fc38 (diff) | |
| download | chip8-2aace3fc7302e8e09dfc2a7f54576c340d054a1c.tar.gz chip8-2aace3fc7302e8e09dfc2a7f54576c340d054a1c.tar.bz2 chip8-2aace3fc7302e8e09dfc2a7f54576c340d054a1c.zip | |
add more instructions
| -rw-r--r-- | chip8.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -122,6 +122,38 @@ void vm_thread(void* v) { vm.Vx[15] = 0; } break; + case '5': + if (vm.Vx[hex_char(str[1])] > vm.Vx[hex_char(str[2])]) { + vm.Vx[15] = 1; + } else { + vm.Vx[15] = 0; + } + vm.Vx[hex_char(str[1])] -= vm.Vx[hex_char(str[2])]; + break; + case '6': + if ((vm.Vx[hex_char(str[1])] & 1) == 1) { + vm.Vx[15] = 1; + } else { + vm.Vx[15] = 0; + } + vm.Vx[hex_char(str[1])] /= 2; + break; + case '7': + if (vm.Vx[hex_char(str[1])] < vm.Vx[hex_char(str[2])]) { + vm.Vx[15] = 1; + } else { + vm.Vx[15] = 0; + } + vm.Vx[hex_char(str[1])] = vm.Vx[hex_char(str[2])] - vm.Vx[hex_char(str[1])]; + break; + case 'e': + if ((vm.Vx[hex_char(str[1])] & 1) == 1) { + vm.Vx[15] = 1; + } else { + vm.Vx[15] = 0; + } + vm.Vx[hex_char(str[1])] *= 2; + break; } } |