Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ejona86/taus
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: twoplayer/v0.4.0
Choose a base ref
...
head repository: ejona86/taus
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Mar 7, 2020

  1. Makefile: remove bash-ism

    This restores compatibility with dash which is /bin/sh on Debian
    systems.
    ejona86 committed Mar 7, 2020
    Copy the full SHA
    ee48f79 View commit details
  2. nes.mk: Use xxd instead of basenc

    This extends compatibility to systems that have a coreutils from before
    2019, which is a lot of systems. xxd is technically a new dependency,
    but it seems _very_ common so I'm treating it more like "ls" which is a
    given.
    ejona86 committed Mar 7, 2020
    Copy the full SHA
    6b55ab1 View commit details
  3. Add Travis-CI for building on Linux

    No tests are run
    ejona86 authored Mar 7, 2020
    Copy the full SHA
    c3eed7b View commit details
  4. Copy the full SHA
    08bdbd6 View commit details
  5. travis: Add test support

    Unfortunately this adds 1.5 minutes to the build. 4x as slow!
    ejona86 authored Mar 7, 2020
    Copy the full SHA
    0db887f View commit details

Commits on Mar 16, 2020

  1. handicap: Make more compatible with twoplayer

    Hasn't actually been tested with twoplayer, but made the IPS hunks
    non-conflicting and added player2 logic. Unfortunately, it is 5 bytes
    too large to fit in the leftover space of
    height_menu_nametablepalette_patch.
    ejona86 committed Mar 16, 2020
    Copy the full SHA
    c1246b3 View commit details

Commits on Mar 17, 2020

  1. handicap: Reduce PRG with Type B playfield init

    Reusing the type b playfield initialization logic, the code shrunk so it
    fits in the leftover space of height_menu_nametablepalette_patch.
    ejona86 committed Mar 17, 2020
    Copy the full SHA
    72e3543 View commit details

Commits on Mar 18, 2020

  1. handicap: Fix typo for twoplayer compatibility

    Tested working with twoplayer
    ejona86 committed Mar 18, 2020
    Copy the full SHA
    720a128 View commit details
  2. twoplayer: Swap to tmp vars to fix Type B

    This resolves the hanging on playfield init when Type B was selected.
    ejona86 committed Mar 18, 2020
    Copy the full SHA
    579292a View commit details
  3. Copy the full SHA
    7a551b7 View commit details
  4. Copy the full SHA
    0e45746 View commit details

Commits on Mar 20, 2020

  1. Copy the full SHA
    da53266 View commit details
  2. twoplayer: Fix demo when two players are enabled

    As an easter egg, if one of the players moves with the controller that
    player would then be playing against the demo.
    ejona86 committed Mar 20, 2020
    Copy the full SHA
    bc164df View commit details
  3. twoplayer: Add sanity and performance regression test

    Additionally, tests can now be run in parallel, which reduces a full
    build from 24s to 14s on my machine. The tests will also only rerun if
    their dependencies change, reducing the need to comment out tests in the
    Makefile.
    ejona86 committed Mar 20, 2020
    Copy the full SHA
    fe9facc View commit details

Commits on Mar 21, 2020

  1. twoplayer: Let player 2 disable next piece independently of p1

    P1 can still disable P2's next piece for Famicom compatibility.
    ejona86 committed Mar 21, 2020
    Copy the full SHA
    beb3056 View commit details
  2. twoplayer: Allow p1 to press start in high score for p2

    This is necessary for famicom where p2 lacks a start button.
    
    Fixes #7
    ejona86 committed Mar 21, 2020
    Copy the full SHA
    bb1b3a4 View commit details

Commits on Mar 22, 2020

  1. twoplayer: Fix tetriminos in background

    Tetrimino design by Emma Joe Anderson <jandew+dev@gmail.com>.
    ejona86 committed Mar 22, 2020
    Copy the full SHA
    469b6d2 View commit details
  2. Copy the full SHA
    a7b35a7 View commit details
  3. Copy the full SHA
    46657f6 View commit details

Commits on Mar 23, 2020

  1. taus: Split playerid into separate mod

    Shrunk size to fit in unreferenced_data3, to ease CODE location
    allocation. The IPS does not conflict with twoplayer, but combining the
    two is untested.
    ejona86 committed Mar 23, 2020
    Copy the full SHA
    afe414c View commit details

Commits on Apr 5, 2020

  1. Copy the full SHA
    a7a45b6 View commit details
  2. Copy the full SHA
    07baa5f View commit details
  3. Copy the full SHA
    00bf524 View commit details

Commits on Apr 6, 2020

  1. playerid: Show id in Type B; remove sprite variant

    Having both sprite and nametable codepaths wasn't all that useful.
    Seems I had settled on nametable.
    
    Fixing Type B also fixed showing the id in twoplayer.
    ejona86 committed Apr 6, 2020
    Copy the full SHA
    4c3462f View commit details

Commits on Apr 11, 2020

  1. Copy the full SHA
    dc2b770 View commit details
  2. playerid: Fix CODE to _actually_ be in unreferenced_data3

    It was accidentally in the sound effect area just after
    unreferenced_data3. The wrong size clued me in that something was wrong,
    since it was way too big. Unclear where that size came from.
    ejona86 committed Apr 11, 2020
    Copy the full SHA
    f2683da View commit details
  3. Copy the full SHA
    350784a View commit details
  4. Copy the full SHA
    d4b8c69 View commit details
  5. Copy the full SHA
    302eead View commit details
  6. Copy the full SHA
    9db0d2e View commit details
  7. Copy the full SHA
    96a9f14 View commit details
  8. Copy the full SHA
    b7c1643 View commit details
  9. Copy the full SHA
    43c8ef1 View commit details

Commits on Apr 13, 2020

  1. Copy the full SHA
    28d51b1 View commit details
  2. taus: Rewrite playfieldLiteral copy loop

    I was bothered it used two index registers, and then couldn't help
    myself to shrink the size.
    ejona86 committed Apr 13, 2020
    Copy the full SHA
    be71a0b View commit details
  3. Copy the full SHA
    a2144a0 View commit details

Commits on Apr 19, 2020

  1. Copy the full SHA
    fb00de1 View commit details

Commits on Apr 20, 2020

  1. Copy the full SHA
    00eab0a View commit details

Commits on Apr 25, 2020

  1. Copy the full SHA
    94038e9 View commit details
  2. Copy the full SHA
    bd8e3a8 View commit details
  3. Copy the full SHA
    c74f452 View commit details
  4. twoplayer: Swap palettes for player1 and player2

    This restores player1 to their original palette for improved
    compatibility with other mods.
    ejona86 committed Apr 25, 2020
    Copy the full SHA
    2086dbf View commit details

Commits on Apr 26, 2020

  1. taus: Combine render code into render stats

    This avoids a collision with twoplayer caused by an optimization to run
    render sooner.
    ejona86 committed Apr 26, 2020
    Copy the full SHA
    0e32721 View commit details
  2. twoplayer: Avoid shifting large amounts of code in render_mode_play_a…

    …nd_demo
    
    This avoids collisions with taus where it modifies the stats rendering.
    
    Unfortunately, this adds 6 cycles to rendering, which will probably
    exceed our budget at higher play levels. I don't want to deal with that
    at the moment; I don't think anyone will notice, and it really deserves
    a test anyway.
    ejona86 committed Apr 26, 2020
    Copy the full SHA
    dd82293 View commit details
  3. taus: Move to unreferenced_data4

    unreferenced_data1 is bigger and more convenient for twoplayer to fully
    consume.
    ejona86 committed Apr 26, 2020
    Copy the full SHA
    7f01ed7 View commit details
  4. twoplayer: Move from unreferenced_data4 to legal_screen_nametable

    The nametable is RLE compressed to make room.
    ejona86 committed Apr 26, 2020
    Copy the full SHA
    5eabd4b View commit details
  5. Copy the full SHA
    948abbd View commit details

Commits on Jun 14, 2020

  1. Add PAL disassembly support

    PAL is very similar to NTSC, with just some slight size differences
    which cause offsets. So we just track the insertions/deletions and
    rewrite the NTSC addresses.
    ejona86 committed Jun 14, 2020
    Copy the full SHA
    842de23 View commit details

Commits on Jul 3, 2020

  1. Copy the full SHA
    532da5b View commit details

Commits on Jul 25, 2020

  1. taus: Use raw nametable; convert to stripe RLE during build

    This breaks diffs, but makes the nametable much easier to view and
    modify.
    ejona86 committed Jul 25, 2020
    Copy the full SHA
    436c42c View commit details
Showing with 2,321 additions and 1,195 deletions.
  1. +50 −0 .github/workflows/testing.yml
  2. +1 −0 .gitignore
  3. +50 −0 7bag-test.lua
  4. +62 −0 7bag.s
  5. +205 −53 Makefile
  6. +98 −27 README.md
  7. +41 −7 asm.lua
  8. +6 −8 chart-test.lua
  9. +17 −43 chart.s
  10. +2 −3 fastlegal.s
  11. +0 −37 handicap.ips.cfg
  12. +65 −61 handicap.s
  13. BIN hard-drop-taus.chr
  14. +99 −0 hard-drop-taus.s
  15. +0 −13 highscores.ips.cfg
  16. +12 −13 highscores.s
  17. +142 −0 hold.s
  18. BIN hold_game.nam
  19. +20 −0 ips-segments.awk
  20. +34 −0 ips.inc
  21. BIN media/handicap-ingame.aspect.png
  22. BIN media/handicap-ingame.png
  23. BIN media/handicap-ingame.thumb.png
  24. BIN media/handicap-selection.aspect.png
  25. BIN media/handicap-selection.png
  26. BIN media/handicap-selection.thumb.png
  27. BIN media/playerid-ingame.aspect.png
  28. BIN media/playerid-ingame.png
  29. BIN media/playerid-ingame.thumb.png
  30. BIN media/twoplayer-side.aspect.png
  31. BIN media/twoplayer-side.png
  32. BIN media/twoplayer-side.thumb.png
  33. BIN media/twoplayer-top.aspect.png
  34. BIN media/twoplayer-top.png
  35. BIN media/twoplayer-top.thumb.png
  36. +16 −2 nes.mk
  37. +64 −0 ntsc2pal.awk
  38. +23 −88 playerid.s
  39. +94 −0 save-highscores.s
  40. +0 −21 screens.ips.cfg
  41. +5 −11 screens.s
  42. +71 −0 stripe-enc.awk
  43. +21 −26 taus-test.lua
  44. +0 −72 taus.ips.cfg
  45. +8 −0 taus.ips.cfg.snip
  46. +38 −96 taus.s
  47. BIN taus_game.nam
  48. +115 −36 tetris-PRG.info
  49. +149 −0 tetris-tbl.inc
  50. +4 −2 tetris.nes.cfg
  51. BIN tournament.nam
  52. +13 −0 twoplayer-garbage.s
  53. +51 −0 twoplayer-test.lua
  54. +351 −488 twoplayer-tetris-PRG.s.diff
  55. +36 −0 twoplayer.inc
  56. +7 −4 twoplayer.nes.cfg
  57. +351 −84 twoplayer.s
  58. BIN twoplayer_game.nam
  59. BIN twoplayer_game_top.nam
50 changes: 50 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Testing

on:
push:
pull_request:

permissions:
contents: read

jobs:
build:
# 22.04 suffers from https://github.com/TASEmulators/fceux/issues/413
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Add packages
run: |
sudo apt-get update
sudo apt-get install cc65 fceux
- name: Grab Dependencies
env:
ERSOFT_SECRET: ${{ secrets.ERSOFT_SECRET }}
run: |
mkdir -p ~/.local/bin
curl -L -u "$ERSOFT_SECRET" https://ejona.ersoft.org/taus-ci/flips -o ~/.local/bin/flips
chmod +x ~/.local/bin/flips
curl -OL -u "$ERSOFT_SECRET" https://ejona.ersoft.org/taus-ci/tetris.nes
curl -OL -u "$ERSOFT_SECRET" https://ejona.ersoft.org/taus-ci/tetris-pal.nes
- name: Build NTSC
run: |
make V=1
mv build/ build-ntsc/
- name: Build PAL
run: |
make V=1 PAL=1
mv build/ build-pal/
- name: Test NTSC
run: |
ln -snf build-ntsc/ build
xvfb-run -a make V=1 test
- name: Test PAL
run: |
ln -snf build-pal/ build
xvfb-run -a make V=1 PAL=1 test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
tetris.nes
tetris-pal.nes
50 changes: 50 additions & 0 deletions 7bag-test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require("ypcall") -- must be first, as it changes globals
require("asm")
require("testing")

local labels = asm.loadlabels("build/7bag.lbl")

local spawnTable = {0x02, 0x07, 0x08, 0x0A, 0x0B, 0x0E, 0x12}

function test_fullbag ()
asm.waitexecute(0x813B) -- cmp gameModeState in @mainLoop
asm.jsr(labels.disableNmi)
local results = {}
for _, orientID in pairs(spawnTable) do
results[orientID] = 0
end
math.randomseed(1)
memory.writebyte(labels.spawnID, 0)
for i=1,14 do
memory.writebyte(labels.rng_seed, math.random(256))
asm.jsr(labels.pickRandomTetrimino_7bag)
local a = memory.getregister("a")
results[a] = results[a] + 1
end
print(results)
for orientID, cnt in pairs(results) do
assert(cnt == 2, "orientation: " .. orientID .. " count: " .. cnt)
end
end

function test_distribution ()
asm.waitexecute(0x813B) -- cmp gameModeState in @mainLoop
asm.jsr(labels.disableNmi)
local results = {}
for _, orientID in pairs(spawnTable) do
results[orientID] = 0
end
for i=0,255 do
memory.writebyte(labels.spawnID, 0x7F)
memory.writebyte(labels.rng_seed, i)
asm.jsr(labels.pickRandomTetrimino_7bag)
local a = memory.getregister("a")
results[a] = results[a] + 1
end
print(results)
for orientID, cnt in pairs(results) do
assert(cnt == 36 or cnt == 37, "Imbalanced")
end
end

testing.run()
62 changes: 62 additions & 0 deletions 7bag.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
;
; Mod that uses a 7-bag for choosing tetriminos
;

.include "build/tetris.inc"
.include "ips.inc"

.segment "PICK_TETRIMINO_PATCH"
ips_segment "PICK_TETRIMINO_PATCH",pickRandomTetrimino,$0038

pickRandomTetrimino_7bag:
lda spawnID
bne @countBits
lda #$7F
sta spawnID

; Count number of pieces remaining in bag
@countBits:
ldx #0
@shiftLoop:
lsr a
bcc @bitClear
inx ; Trashes Z, so bne is unconditional
@bitClear:
bne @shiftLoop

; Bounded random
@mult: tay ; Set y=0
@multLoop:
clc
adc rng_seed
bcc @noCarry
iny
@noCarry:
dex
bne @multLoop

; Find chosen piece
lda spawnID
iny ; THINGS ARE WEIRD HERE
@nextBit:
inx
lsr a
bcc @nextBit
dey
bne @nextBit

; Clear chosen piece in spawnID
txa
tay
lda #$00
sec
@shiftLeft:
rol
dey
bne @shiftLeft
eor spawnID
sta spawnID

lda spawnTable,x
rts

Loading