Fix 5xy0 comparison & full font load (+ opcode tests)#2
Open
bvlik wants to merge 4 commits into
Open
Conversation
- 5xy0 skipped when Vx != Vy; the CHIP-8 spec skips when Vx == Vy (9xy0 is the 'not equal' variant). Inverted comparison fixed. - InitiateChip8 copied only 10 of the 80 font bytes, leaving glyphs 2..F blank while Fx29 addresses them at Vx*5. Load the whole fontSet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes two emulation bugs in
emul8/emul8.goand adds the first opcode test suite.Bug 1 —
5xy0comparison inverted5xy0("skip next ifVx == Vy") was implemented with!=, i.e. it behaved like9xy0. Any ROM relying onSE Vx, Vywould branch the wrong way. Fixed to==.Bug 2 — only 10 of 80 font bytes loaded
InitiateChip8copiedfontSetwithfor i := 0; i < 10, loading just glyphs0and1.Fx29addresses each glyph atVx*5, so glyphs2–Fpointed at zeroed memory andrendered blank. Now loads the full 80-byte set.
Tests —
emul8/emul8_test.go(standardtesting, white-box)Covers
6xnn/7xnn,5xy0/9xy0,8xy4carry,8xy5borrow,Annn/Bnnn,Fx33BCD,
Fx55/Fx65store-load,2nnn/00EEcall-return, and3xnn/4xnn. Two areregression tests pinning the fixes above. CI now runs
go test ./...alongside build/vet.How to verify
go test ./...