As we are using a base 2 for our RHS modulo operator, we changed that for a bitwise and operator, which is faster.
In other words, if the RHS of the modulo operator (i.e. LHS % RHS) is a base 2, we can write "LHS & (RHS -1)", which will yield the same results but with a faster processing time.
The main contribution of this commit is changing the display rendering method. Before, I was asking the canvas to render rectangles, which represented scaled pixesl. Now I am using a texture, that is automatically stretched to the whole canvas by SDL.
The display coding is running faster, but there is still some ways to improve rendering. The main one is to change the cpu display buffer from a multi-dimensional array of booleans (indincating pixels toggling) to a single dimension pixel-color array. In the pixel-color array, 4u8 samples represent a single pixel on screen (R: u8, G: u8, B: u8, A:u8).
This refactor will force the CPU to control have knowledge of which color will be printed on the display, letting the display being agnostic to implementation details.
This refactor will be added as an issue to the github project kanban and further analyzed.
Besides that, other changes to the codebase were mainly in terms of code organization.
A small function refactor where we centralize things around the cpu.
Also, now it is easier to create more instructions (for SC and OX) and link the decoded instruction with the correct emulated function.
Complete Chip-8 instructions. However, the user still needs to modify the code to select the ROM. Next-step will be to insert SUPER-CHIP and OX-CHIP instructions, as well as to give menu options to the user.