# Session log

What was done in each working session, written for jdc and anyone following along. Newest first.
Technical details are in `CHANGELOG.md` and `HACKING.md`.

## 2026-10-22

- **Y takes your goalie** (fix 9, `ygoalie.s`): 6-button pad, Goalie Ctrl Manual, your team without the puck → Y = your goalie;
  with the puck Y = B (pass) as before. Tested headless with MAME `-ctrl1 md6button` (home, away, plain and season ROM).
- `h.lua` now finds a 6-button pad port too; `build.sh` assembles `ygoalie.s` before `patch.py`.
- **Goalie stats** in the season (GP, W, GA, SA, SV% on page 2 of a team screen), SRAM `$E20`; mapped which SRAM the hack uses.
- **Fixed:** simulated losses almost all counted as overtime losses (flag overwritten by `dist`).
- Standings: OTW and OTL columns (W = regulation wins).
- **League table** after every season game with the playoff tree's team banners, scrollable (`table.s`).
- `mknv.py ... fill` makes test seasons with random results.
- League table: fixed digits drawn on top of each other after scrolling (text in two planes); all text now in the back plane.
- Then made it one division per screen (jdc), Left/Right = division, gap to the division leader.

## 2026-10-21 (late)

- **Divisions:** Season Standings shows the four NHL divisions, one per page, starting on your team's division.
- **The site now offers the season ROM** (the IPS patch gives the full version with the season). New "A full season"
  section, ratings explained on every team page, the whole site checked against what the ROM does.
- Y button for the goalie: investigated — the hack already reads 6-button pads and uses Y for something; not done yet.
- Fixed: the New Season question still said "Whole Season".

## 2026-10-21 (evening, later)

- Regular Season is the season mode now: Play Mode shows Continue Season / New Season. New Season clears the old season
  when the first new game is played; until then the stats screens show an empty season (bug jdc found: they showed the old one).
- Shots on goal per player; Season Standings has an arrow (Up/Down) and C opens a team's players (#, name, G, A, PTS, SOG).
- Checked with CPU games: player goals add up to team goals for all 32 teams, assists ≤ 2 per goal, shots ≥ goals.
- A longer 30-game run was lost: stopping MAME from outside doesn't save the battery file (noted in HACKING.md).

## 2026-10-21 (night)

- Fixed: a player could be in two lines (Draisaitl in line 1 and line 2 for Edmonton; the same pattern in every team).
  The extra-skater slots now use 4th-line players.
- Fighting now shows N/A in the menu when Penalties is Off (fights already needed penalties on).
- **Season: your team and the schedule.** The first Regular Season game you play sets your team. After that the menu
  shows your next game from an 82-game schedule (every opponent 2–3 times, home and away alternating) and Home/Away/Players
  can't be changed. Tested: Edmonton vs Rangers (1–1 after OT) was recorded and the menu moved on to game 2 at Calgary.
- **New Season** in the pre-game menu: asks "Start a new Whole Season?" (A+C yes, Start back), then clears the season and
  goes to the main menu to pick a team.
- Stats from the main menu: opening the stats screens on top of the main menu was tried, but they need the scoreboard
  screen setup and drew garbage. Instead, in Whole Season Start skips the Matchups screen and goes straight to the
  pre-game menu with Season Standings and Scoring Leaders (one press from the main menu).
- After the first game of a season nothing in the menu can be changed except Play Mode (jdc). The empty row now shows
  the next game: "2/82 at CGY".
- **Scoring Leaders:** goals and assists for every player, from your games and the simulated ones, in a new screen
  (replaces Record Holders). Main menu → Start → (Matchups, Start) → pre-game menu has Season Standings and Scoring Leaders.
- Whole Season menu cleaned up as jdc asked: Players shows "One" or "Two - Teammates" (co-op plays every game at home),
  the Home row is called "Team" and the Away row is gone (the opponent shows in the logos).
- **Whole Season** is now its own choice in Play Mode (jdc's idea); Regular Season is a free single game again.
- jdc noticed you could still pick anything in Regular Season before the first game. Now only your team (Home) can be
  picked; the opponent and Players follow automatically. Per. length, goalie control, penalties etc. are still free.
- Agreed season design (jdc): pick one team, the schedule picks the opponent, after each game a season menu with
  standings, scoring leaders and Continue for the next game. Work on that continues (see `SEASON_MODE.md`).

## 2026-10-21 (late evening) — project MEGAdriveHARDJOB started

- New folder `~/.config/retroarch/roms/claude/MEGAdriveHARDJOB/` with a copy of the patched ROM, for building a season mode
  into the ROM (option A). The normal ROM is untouched.
- Found: the game's 8 KB battery RAM, the hack's routines to read/write it, which parts are used, and about 4 KB free;
  where goals and team stats live during a game. Plan in `SEASON_MODE.md`.
- **Step 1 works:** every finished game is now recorded in a standings table in battery RAM (games, wins, losses,
  overtime losses, ties, goals for/against). Highlights from other games during intermissions are not counted. The table
  survives a restart. Tested with three CPU games (one in overtime). Found and fixed a crash on the way (the hack's own
  checksum routine overwrote replay memory).
- **The rest of the league plays too:** after each of your games the other 30 teams play a simulated round, weighted
  by team strength from the ratings, so the whole table fills up.
- **Season Standings screen in the game:** in the pause and post-game menus ("Other Scores" replaced). Sorted by points,
  two pages, A+C starts a new season. The season ROM is `MEGAdriveHARDJOB/NHL94-season.bin` (the normal ROM is untouched).
- New tool: a real 68000 assembler through the SGDK Docker image (`tools/m68kasm.sh`), so bigger code can be written in assembly.
- Test rig fix: MAME kept battery RAM between test runs (per ROM name), so menu settings leaked from earlier tests.
  `run.sh` now starts every run with empty battery RAM (`KEEP_NVRAM=1` keeps it).

## 2026-10-21 (evening)

### Sorting on the team pages
- Click a rating column header (for example SPD) and the player with the highest value comes first, the rest in order below.
  Click it again and the list is back to normal.
- Select several columns (for example SPD and PWR) and the players are sorted by the sum, with a Sum column shown.
  Selected headers light up green.
- The sorting applies to forwards, defence and goalies at the same time.
- The selection is kept in the address, so a sorted view can be shared: `team.html?t=EDM&s=2,5` shows McDavid first
  with 10, ahead of Draisaitl with 9.

### Frondell and Stenberg
- Anton Frondell had only 1s in every rating. That was the hack's placeholder, which had been copied along.
  He now has star ratings at Bedard's level: 5 in speed, agility, offence, shot power, stickhandling and accuracy.
- Ivar Stenberg also got star ratings, focused on passing and stickhandling (6).
- Both are in `rosters/overrides.json`, so they keep their ratings when the rosters are updated.
- The same placeholder bug was found for L'Heureux, Lindstein, Holl and Cole Hutson. They now have real ratings from NHL
  stats; Hutson, for example, lands at the level of Gostisbehere and Luke Hughes.
- Side effect: the model no longer learns from placeholders, so some other new players in 22 teams changed slightly.
  Players who were already in the ROM are not affected.
- Tested: a full CPU game Chicago–Seattle without errors.

### Everything saved so the next session is easy
- `dela.jdc.se/nhl94/CLAUDE.md` is read automatically when Claude is started in that folder. It says to read the notes first
  and repeats the most important rules. jdc only has to start Claude in `~/mount/truenas/www/dela.jdc.se/nhl94` and say what to do.
- Claude notes on the site, all in English: Start here (where everything is, rules, standard tasks, status, known gaps),
  Hacking guide, Changes and measurements, Oilers lineup and ratings, and this session log.
- `build.sh` now also refreshes the team pages and the md5 on the front page.

## 2026-10-21 (afternoon)

### All 32 teams
- Each team's roster from the NHL's official API, its lines from DailyFaceoff, every trio turned to official NHL positions.
- Each team keeps its 26 slots and its number of goalies.
- Picking order: dressed tonight → rest of the roster → injured → prospects. Utah and Vancouver had too few players and were
  filled with old ROM players who are on no NHL team.
- Players already in the ROM keep the hack's ratings, even after changing teams. New players are rated from NHL stats with
  the same model as Edmonton; players with few or no NHL games get typical depth-player ratings.
- Edmonton kept as approved by jdc.
- Tested: all 32 read back exactly; full CPU games with eight teams (BOS–CAR, CBJ–OTT, NSH–TOR, SEA–ANA). The Line Editor
  was only checked for Edmonton.

### Website
- Teams: all 32 logos taken from the game's team select. Click a logo for the team page: lines, power play, penalty kill,
  the whole roster with position, handedness and all ratings. New players are marked NEW (hover to see how they were rated).
- Claude notes and Tools pages; the tools moved to `nhl94/tools/` and all work is done from there.
- The ROM is always built to `~/.config/retroarch/roms/claude/NHL 2026 - 94 Edition v5.1W.bin`; ROM files, saved test
  states and backups stay private in `~/.config/retroarch/roms/claude/work/`.

### Worth knowing
- Montreal has 3 goalies in the hack although its team flag says 2; kept as it was.
- Goalie ratings are only partly mapped (weight, agility, speed and endurance known, the rest shown as numbered columns).

## 2026-10-21 (morning)

- Off-screen arrow fixed (was 32 px too far left).
- Fighting: Off / On only, and the setting now holds for the whole game.
- Edmonton roster and lines as of October 21, with ratings for the new players.
- Blue-line zone moved out from distance 140 to 160 to make it a bit harder.
- First version of this website.

## 2026-10-13 to 2026-10-20

- Co-op passing to the other human, goalie passes never blind, blue-line shots can score (15 %), shootouts tested.
