Fun article and project. I enjoyed reading and playing around with it.
My first run of `make release` failed with this error.
cc -std=c11 -Wall -Wextra -Werror -pedantic -O3 -DNDEBUG -c -o build/main.o src/main.c
src/main.c: In function ‘main’:
src/main.c:23:3: error: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
23 | fread(file, file_size, 1, fp);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
It might have something to do with my local setup. It was simple enough to solve, to check the return value and exit with error code.
errorcodezero 17 minutes ago [-]
Ah oops small mistake with the C file handling. Thank you for the kind words on my project and finding the issue I'll be sure to fix it when I get the time.
lioeters 8 minutes ago [-]
The article was really good, explaining the details of how the virtual machine works.
I starred the Git repo, good luck with the Hack Club!
johnisgood 1 hours ago [-]
Yes, to fix it: either check its return value, or add "(void)" at the end of the function, e.g. "(void)fread(...)". Since they did not add "(void)", I assume they meant to check the return value, they just simply forgot.
drob518 1 hours ago [-]
Fun project. You might want to build an emulator for a real 16-bit CPU like a 6502. That would allow you to run real, existing software on it. That way you don’t have to write your own code.
errorcodezero 16 minutes ago [-]
Thank you! I think building an emulator for a real platform is going to be next on my list. A game console might be interesting to try especially or a 16-bit cpu like you mentioned.
AlexeyBrin 1 hours ago [-]
6502 is an 8-bit CPU. Writing an emulator for it would be cool though.
pjc50 26 minutes ago [-]
M68k is probably the best choice for that. Not because of the architecture but because it was so widely used.
Rendered at 14:59:23 GMT+0000 (Coordinated Universal Time) with Vercel.
My first run of `make release` failed with this error.
It might have something to do with my local setup. It was simple enough to solve, to check the return value and exit with error code.I starred the Git repo, good luck with the Hack Club!