stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

2h 21m 27s logged

LOG 5: LAST LOG BEFORE SHIP, MADE THE PROJECT MOSTLY SUCKLESS,

REWORKED KEYBOARD, ADDED A DIE FUNCTION, ROMS ARE NOW LOADED VIA
TERMINAL, ADDED MACROS, ADDED README

FEATURES

“SUCKLESS”

I made the program (i think) as much compliant to the suckless philosophy as i can and did most of (not all of) the stylistic choices mentioned in the suckless style guide. I think making it suckless majorly improved the program

KEYBOARD REWORK

Because i decided i wanted to make the project basically suckless i have decided that i needed to rework the keyboard functions. I replaced the keyboard struct with long long keyboard[16]. The index is now the key and the value is the value that key_pressed compares against when the instrcutions are called. key_pressed returns (now - keypad[k]) < ACCEPTABLE_DISTANCE which made the logic way smaller and easier to read. I also replaced the ~ 60 lines key switch statement with a single array that has all the characters of the Chip-8 keyboard and compares it using strchr with the input ch and the difference between the return value of strchr and the positon of keyboard[0] is the index which the current time is written into

DIE FUNCTION

I added a die function that replaces all early exit functions that would kill the entire program. It gets an input string and other parameters (like printf would get) and print it to stderr. It does this by using varargs. If initscr() has been called it also does endwin() and if not it doesnt (a bool is turned to true after initscr() has been called). Because of this read_rom is now void because every error path calls die instead of returning false. fopen also calls strerror if it fails to display WHY fopen has failed

TERMINAL INPUT

Previously rom names were hardcoded into the program and had to be changed and recompiled if i wanted to change them. Now the program takes in multiple arguments (2 in total, more or less results in an error after which the proper usage is displayed) and the rom (if found) is copied and executed which makes testing multiple programs way easier.

MACROS

I removed magic number and replaced them with macros to make the code more readable and theoretically modifiable.

README

I added a README in the repo that explains pretty much everything that you would need to know before using the program

0
16

Comments 0

No comments yet. Be the first!