This shows you the differences between two versions of the page.
ii:assignments:s2:chip8 [2023/03/07 13:03] radu.mantu [FAQ] |
ii:assignments:s2:chip8 [2023/04/26 11:37] (current) florin.stancu |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
- | ====== CHIP-8 emulator ====== | + | ====== CHIP-8 Emulator (bonus) ====== |
===== Context ===== | ===== Context ===== | ||
Line 99: | Line 99: | ||
* ''00E0'': clear screen | * ''00E0'': clear screen | ||
* ''1NNN'': jump to address ''NNN'' | * ''1NNN'': jump to address ''NNN'' | ||
- | * ''6XNN'': set the value of the ''V[X]'' register to ''NN'' | + | * ''6XNN'': set the value of the ''Vx'' register to ''NN'' |
- | * ''7XNN'': add ''NN'' to register ''V[X]'' | + | * ''7XNN'': add ''NN'' to register ''Vx'' |
* ''ANNN'': set the value of the ''I'' register to ''NNN'' | * ''ANNN'': set the value of the ''I'' register to ''NNN'' | ||
- | * ''DXYN'': display a ''N''-byte sprite at location ''V[X]'', ''V[Y]'' | + | * ''DXYN'': display a ''N''-byte sprite at location ''Vx'', ''Vy'' |
* [[https://github.com/corax89/chip8-test-rom|chip8-test-rom 1]]: Tests the 18 instructions described in the README. | * [[https://github.com/corax89/chip8-test-rom|chip8-test-rom 1]]: Tests the 18 instructions described in the README. | ||
* [[https://github.com/metteo/chip8-test-rom|chip8-test-rom 2]]: More tests. | * [[https://github.com/metteo/chip8-test-rom|chip8-test-rom 2]]: More tests. | ||
Line 112: | Line 112: | ||
**Q: Can I write the emulator in something other than C/C++?** \\ | **Q: Can I write the emulator in something other than C/C++?** \\ | ||
A: No. | A: No. | ||
+ | |||
+ | **Q: What platform will this assignment be tested on?** \\ | ||
+ | A: Linux only. | ||
**Q: How do I read the instruction codes in the specification?** \\ | **Q: How do I read the instruction codes in the specification?** \\ | ||
- | A: In the spec, the instructions are represented as 4 characters, each signifying a nibble (4 bits). Hex digits (''0-9A-F'') are invariants and you should try to match them exactly. E.g. ''00EE'' (''RET'') is composed of 4 constant nibbles. Whenever you see ''X'' or ''Y'', that part of the opcode is variable and it represents what general purpose register (''V'') is involved in that operation. E.g. ''FX65'' (''LD Vx, [I]'') will load in register ''Vx'' the value located at the memory address stored in register ''I''). Finally, whenever you see a sequence of ''K'' or ''N'' characters (notation can differ), know that these are //immediate values//. These are basically arguments for the instructions that are embedded in the opcode itself. E.g. ''6XKK'' (''LD Vx, byte'') will load the value ''KK'' into ''Vx''. So for ''614F'', we will have ''V1 = 0x4F''. | + | A: In the spec, the instructions are represented as 4 characters, each signifying a nibble (4 bits). Hex digits (''0-9A-F'') are invariants and you should try to match them exactly. E.g. ''00EE'' (''RET'') is composed of 4 constant nibbles. Whenever you see ''X'' or ''Y'', that part of the opcode is variable and it represents what general purpose register (''V'') is involved in that operation. E.g. ''FX65'' (''LD Vx, [I]'') will load in register ''Vx'' the value located at the memory address stored in register ''I''; basically, it's dereferencing a pointer. Finally, whenever you see a sequence of ''K'' or ''N'' characters (notation can differ), know that these are //immediate values//. These are basically arguments for the instructions that are embedded in the opcode itself. E.g. ''6XKK'' (''LD Vx, byte'') will load the value ''KK'' into ''Vx''. So for ''614F'', we will have ''V1 = 0x4F''. |
- | + | ||
+ | **Q: There are so many CHIP-8 emulators out there. What if I'm tempted to "take inspiration" from some of them?** \\ | ||
+ | A: Once you come up with a solution of your own //and implement it//, it's ok to look at other approaches. After all, to write good code you first need to read good code. However, taking inspiration and "taking inspiration" are two different things. In addition to a manual review, we'll also perform an AST comparison of your submitted code, against each other and as many public CHIP-8 projects as we can find. Just keep that in mind :p | ||
<note> | <note> | ||
**TODO:** Collect questions from Teams / lab and add them here. | **TODO:** Collect questions from Teams / lab and add them here. | ||
</note> | </note> |