Small cleanup formatting and new rom locations.

This commit is contained in:
2026-05-26 07:48:47 +02:00
parent bc9a282b52
commit e604880b4e
2 changed files with 26 additions and 26 deletions
+23 -24
View File
@@ -12,38 +12,37 @@ CYCLES_PER_FRAME :: 12
// Display will handle all the screen drawing with raylib etc
run_system :: proc(s: ^System) {
rl.InitWindow(SCREEN_WITDH, SCREEN_HEIGHT, "chip8")
rl.InitWindow(SCREEN_WITDH, SCREEN_HEIGHT, "chip8")
// Cap at 60hz/60fps
rl.SetTargetFPS(60)
rl.SetTargetFPS(60)
for !rl.WindowShouldClose() {
rl.BeginDrawing()
for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.BLACK)
rl.ClearBackground(rl.BLACK)
// Do a cpu cycle
// Cap at 60hz/60fps
for _ in 0..<CYCLES_PER_FRAME {
cycle(s)
}
// Do a cpu cycle
for _ in 0..<CYCLES_PER_FRAME {
cycle(s)
}
render_display_buffer(&s.display)
render_display_buffer(&s.display)
rl.EndDrawing()
}
rl.EndDrawing()
}
rl.CloseWindow()
rl.CloseWindow()
}
// update display with display buffer bits
render_display_buffer :: proc(display_buffer: ^[32][64]u8) {
// get row
for y in 0..<len(display_buffer) {
// get cols
for x in 0..<len(display_buffer[0]) {
if display_buffer[y][x] == 0x01 {
rl.DrawRectangle(i32(x * SCALE), i32(y * SCALE), SCALE, SCALE, rl.WHITE)
}
}
}
// get row
for y in 0..<len(display_buffer) {
// get cols
for x in 0..<len(display_buffer[0]) {
if display_buffer[y][x] == 0x01 {
rl.DrawRectangle(i32(x * SCALE), i32(y * SCALE), SCALE, SCALE, rl.WHITE)
}
}
}
}