CHIP-8 Emulator p2: Drawing a Logo (C / SDL2)

CHIP8 machine typedef, emulating enough instructions for a company logo to display correctly, and printing debug output for instructions. Errata: - handle_input(), when pausing/unpausing, prints PAUSED when resuming, not when pausing. That is fixed sometime in the future. - print_debug_info(), for 0x2NNN calling a subroutine, has the code for setting the PC, not printing debug info. That is fixed later, way later... - init_chip8(), using %zu for rom_size and max_size gives errors on windows. I later casted these to (unsigned long long) and used %llu so it works on both linux & windows. Git Repos: ~queso_fuego/chip8_emulator_c Links: (for ) (COSMAC VIP instruction manual) Join the Community Discord: Contact: email: fuegoqueso@ twitter: @Queso_Fuego twitch (if I stream again, may be on youtube idk): Notes: - Emulating instructions could be simpler/easier to read by using separate values for registers and an instruction_t type in emulate_instruction(), instead of attaching it to the chip8 struct. That would remove most of the chip8 dereferencing line noise, but it wouldn’t have the data attached to the chip8 struct allowing 1 single parm to pass all of its associated info. But that isn’t really needed out side of emulating the instructions anyway. - Another way to print debug info per instruction could be adding a string to the instruction_t type that is filled out and printed at runtime with current instruction and chip8 register data. That might still need extra code per instruction, but shouldn’t need a full duplicated switch statement in print_debug_info(). Questions about setup/software/etc.? Check the FAQ: 0:00 getting test roms 3:49 chip8_t typedef & init function 29:42 set paused/resumed state 34:35 instruction_t typedef and start emulating instructions 55:28 print debug output for instructions, continue emulating more things incl. DXYN to draw sprites 1:24:52 update_screen() to draw chip8 pixels 1:39:55 finish instructions to draw logo correctly 1:47:20 add pixel outlines 1:49:30 coming up & outro Music: Downtown Glow by Ghostrifter & Devyzed Creative Commons — Attribution-NoDerivs 3.0 Unported — CC BY-ND 3.0 Music promoted by #chip8 #emulator #programming
Back to Top