Fix the quirked jump address, wrap the sprite start when clipping, and make Fx0A wait for release - #81
Open
HarianthK wants to merge 1 commit into
Open
Fix the quirked jump address, wrap the sprite start when clipping, and make Fx0A wait for release#81HarianthK wants to merge 1 commit into
HarianthK wants to merge 1 commit into
Conversation
…d make Fx0A wait for release With jumpQuirks on, Bxnn added only the low byte of the address to Vx, so BE00 with vE at 0x9C landed at 0x09C instead of 0xE9C. The whole twelve bit address counts. The existing test for the quirked jump encoded the low byte reading and changes with this. With clipQuirks on, a sprite whose start lay past the edge was not drawn at all, because the position was only wrapped when clipping was off. The start always wraps; clipping only applies to the overhang. Fx0A moved on as soon as a key went down. The original hardware waits for the key to come up. The key seen going down is remembered and the instruction completes once it is released, read from the key state so a press from before the wait cannot satisfy it. Four tests added, one updated. The screen mock now reports a size so the wrap has something to wrap around.
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.
The same three things as in craigthomas/Chip8Python#51 and craigthomas/Chip8C#61, found by reading the same routines in this port. Each has a unit test, and
./gradlew testpasses (204 tests).Quirked jump. With
jumpQuirkson,Bxnnadded only the low byte of the address toVx, sojump0 0xE00withvEat0x9Clanded at0x09Cinstead of0xE9C. The whole twelve bit address counts; its top nibble both names the register and is part of the address.testJumpToRegisterPlusValueJumpQuirksencoded the low byte reading, so it changes with this, with the jump row of Timendus' quirks test as the reference.Clipping. With
clipQuirkson, a sprite whose start position lay past the edge was not drawn at all, because the position was only wrapped when clipping was off. The start always wraps around the screen; clipping only decides what happens to the part that hangs over. That is theERR2the quirks test shows on its clipping row. Fixed in bothdrawNormalSpriteanddrawExtendedSprite. The screen mock insetUpnow reports 64 by 32 so the wrap has something to wrap around; without that the existingtestDrawSpriteInvokeddivides by zero.Fx0A. Execution resumed as soon asgetCurrentKeyreported a key down. The original hardware moves on when the key is released, and the keypad test's third check reportsNOT RELEASEDfor this. The key seen going down is now remembered inkeypressPendingand the register written onceisKeyPressedreports it up. Reading the key state rather than the last key pressed also means a press from before the wait began cannot satisfy it.Not touched:
Fx29uses the whole register as a character number, as in the other two ports, so I have left it as you have it.Checked that each new test fails on the current
mainand passes with the fix.