[dsp] Fix display instruction
This commit is contained in:
15
README.md
15
README.md
@@ -13,14 +13,15 @@ Chip 8 emulator/interpreter.
|
|||||||
- [X] Registers
|
- [X] Registers
|
||||||
- [X] Stack
|
- [X] Stack
|
||||||
- [X] Display
|
- [X] Display
|
||||||
- [ ] Instruction Processing
|
- [X] Instruction Processing
|
||||||
- [X] Bare requirements for IBM Logo
|
- [X] Bare requirements for IBM Logo
|
||||||
- [ ] ALU operations
|
- [X] ALU operations
|
||||||
- [ ] Procedure related
|
- [X] Procedure related
|
||||||
- [ ] Timer
|
- [X] Timer
|
||||||
- [ ] Super chip8 compatibility.
|
- [X] Super chip8 compatibility.
|
||||||
- [ ] Audio
|
- [X] Audio
|
||||||
- [ ] Keyboard
|
- Audio seems to be broken on my device. I will check with other devices.
|
||||||
|
- [X] Keyboard
|
||||||
|
|
||||||
### More information on CHIP-8
|
### More information on CHIP-8
|
||||||
|
|
||||||
|
@@ -290,10 +290,14 @@ impl Device {
|
|||||||
for i in 0..n as usize {
|
for i in 0..n as usize {
|
||||||
let index = Self::get_framebuffer_index(x, y + i);
|
let index = Self::get_framebuffer_index(x, y + i);
|
||||||
let slice_from_memory = self.memory[self.registers.i as usize + i];
|
let slice_from_memory = self.memory[self.registers.i as usize + i];
|
||||||
|
// if we are drawing below the screen
|
||||||
|
if (y+i)>=Self::FRAME_BUFFER_HEIGHT {
|
||||||
|
log::trace!("Overdraw detected, skipping");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for bit_index in (0..8).rev() {
|
for bit_index in (0..8).rev() {
|
||||||
// if i'm going to the next line, stop
|
// if going out of the screen, stop
|
||||||
if Self::get_framebuffer_index(0, y + 1) == index {
|
if Self::get_framebuffer_index(0, y+i + 1) <= (index + (7 - bit_index)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let bit_is_true = (slice_from_memory & (1 << bit_index)) == (1 << bit_index);
|
let bit_is_true = (slice_from_memory & (1 << bit_index)) == (1 << bit_index);
|
||||||
|
Reference in New Issue
Block a user