Commit Graph

13 Commits

Author SHA1 Message Date
Marcus Vinicius de Carvalho ab5914b269 Simple modulo optimization
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.
2021-08-01 12:49:28 +08:00
Marcus Vinicius de Carvalho 25d228c440 Merge pull request #48 from Ivsucram/issue47
Issue 47
2021-07-30 17:29:24 +08:00
Marcus Vinicius de Carvalho e6f494aea3 Issue 47
https://github.com/Ivsucram/ivsemu/issues/47
2021-07-30 15:42:05 +08:00
Marcus Vinicius de Carvalho 03b943eeca Chip-8: From Rect to Textures
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.
2021-07-30 15:02:08 +08:00
Marcus Vinicius de Carvalho d6430f0a2e Fixed chip-8 access modifiers 2021-07-28 12:54:24 +08:00
Marcus Vinicius de Carvalho ab7ec2300a Modularized chip-8 2021-07-28 03:14:42 +08:00
Marcus Vinicius de Carvalho a05f885ebc Rust fmt 2021-07-25 20:11:18 +08:00
Marcus Vinicius de Carvalho 5bf025439c Static-link to SDL2
This small build configuration helps setting LLDB into Rust, as well as to release a compiled released version of the code.
2021-07-24 23:20:46 +08:00
Marcus Vinicius de Carvalho 3d694139f1 Function refactor 2
Code functions, words and overall organization was refactored
2021-07-23 02:06:03 +08:00
Marcus Vinicius de Carvalho 5c90a93239 Functions refactor
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.
2021-07-23 01:30:39 +08:00
Marcus Vinicius de Carvalho 26a1b85841 Chip-8 emulator
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.
2021-07-22 21:09:50 +08:00
Marcus Vinicius de Carvalho 9202042093 chip-8 architecture 2021-07-21 19:16:34 +08:00
Marcus Vinicius de Carvalho 48b56d4836 Initial commit 2021-07-21 11:08:37 +08:00