New sample: game2048 - port of 2048-NES to C# with dotnes#440
Open
jonathanpeppers wants to merge 2 commits intomainfrom
Open
New sample: game2048 - port of 2048-NES to C# with dotnes#440jonathanpeppers wants to merge 2 commits intomainfrom
jonathanpeppers wants to merge 2 commits intomainfrom
Conversation
Port of mmuszkow/2048-nes (Unlicense) from C/cc65 to idiomatic C# using the dotnes transpiler. Features: - Complete 2048 game logic: slide, merge, win/loss detection - Title screen with START button, scrolls to game board - 4x4 grid with tile redraw using set_vram_update - Notification sprites for newly merged tiles - Button release detection (original behavior preserved) - Pre-formatted NT_UPD buffers for vertical text messages - Custom CHR ROM converted from original 2048.chr Technical details: - All game state as top-level locals (no methods needed) - Flat byte[16] array with y*4+x indexing (no 2D arrays) - Manual VRAM buffer with NT_UPD_HORZ format for tile redraws - Mapper 0, horizontal mirroring, 32KB PRG + 8KB CHR Fixes two bugs from original MOVE DOWN logic: - map[2][j] notification was applied to wrong tile (map[3][j]) - map[0][j] clear was overwriting map[1][j] instead Closes #379 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The NTADR handler's backward scan for JSR pusha found one from an unrelated computation (e.g. p1 = 4 + i * 6) that was already consumed by a corresponding JSR popa. This caused the handler to use a stale constant (4) as the x argument instead of loading from the variable. Fix: after finding a JSR pusha in the backward scan, verify it wasn't consumed by checking for a JSR popa between the pusha and the current position. If consumed, fall through to the 'no pusha' path which correctly identifies adjacent LDA Absolute instructions. Also updates game2048 Program.cs with the pre-computed NTADR args workaround and refreshes test DLLs + verified.bin snapshot. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Port of mmuszkow/2048-nes (Unlicense) from C/cc65 to idiomatic C# using the dotnes transpiler.
Features
set_vram_update2048.chrTechnical details
byte[16]array withy*4+xindexing (no 2D arrays)NT_UPD_HORZformat for tile redrawsBug fixes from original
Fixes two bugs in the original C code's MOVE DOWN logic:
map[3][j]instead ofmap[2][j])map[1][j] = 0instead ofmap[0][j] = 0)Testing
Closes #379