experimental/pim.s

Download file

Release 2026-11-04-r2 · SHA256 fb61e6ba5a2cb5af0c7dbae918751dc0ddbeed0e6ec4067a42f79d1931f15d1a · Click a line number for a direct link.

1| Season penalty minutes per player (2026-10-28, NHL94 forum: "I don't see PIMs being saved").2| The game counts each player's penalty minutes in its team blocks ($C6CE home, $CA32 away)3| at +$102 + roster slot (bytes, slot 0 = the team), next to goals $B4, assists $CE, shots $E8.4| After every played season game they are added (saturating at 255) to battery RAM, in the5| logical range the hack never used (zero in every bank of jdc's save after a whole season):6|   league   $09A0 + 25*team   (32 teams x 25 slots = 800 bytes, $09A0..$0CBF)7|   playoffs $07C0 + 25*slot   (17 SEEDS slots, $07C0..$0968; postats.s clear now runs to $096A)8| The checksum is kept with season.s's running DELTA, like its player rows.9| +0 game: both teams of the game just played (season.s save, after gkreal; POGAME = playoffs)10| +4 clearleague: zero the league block (season.s clearall, a new season)11| +8 offset: d0 = team, d1 = 0 league / 1 playoffs -> d0 = SRAM offset of its 25 bytes,12|    or -1 (a team without a playoff slot)13    .equ HOME_T,0xFFFFC33114    .equ AWAY_T,0xFFFFC33315    .equ DELTA,0xFFFFF0F016    .equ POGAME,0xFFFFF0D217    .equ SEEDS,0xFFFFF6C018    .equ SRAM_RD,0x1A24419    .equ SRAM_WR,0x1A1E420    .equ BUF,0xFFFFF180                | 32 bytes (season.s row buffer area, free after its rows)21    .equ PIMF,0x10222    .equ LEAGUE,0x09A023    .equ POBASE,0x07C024    .text25    .globl _start26_start:27    bra.w game28    bra.w clearleague29    bra.w offset3031offset:                                | d0 team, d1 0/1 -> d0 offset or -132    movem.l %d1-%d2/%a0,-(%sp)33    andi.l #0xFF,%d034    tst.w %d135    bne.s 1f36    mulu.w #25,%d037    addi.l #LEAGUE,%d038    bra.s 9f391:  lea SEEDS,%a0                      | the team's place in the playoff tree (as postats.s)40    moveq #0,%d2412:  cmp.b (%a0,%d2.w),%d042    beq.s 3f43    addq.w #1,%d244    cmpi.w #16,%d245    bcs.s 2b46    moveq #-1,%d047    bra.s 9f483:  move.l %d2,%d049    mulu.w #25,%d050    addi.l #POBASE,%d0519:  movem.l (%sp)+,%d1-%d2/%a052    rts5354game:55    movem.l %d0-%d4/%a0-%a1,-(%sp)56    moveq #0,%d057    move.b HOME_T,%d058    movea.l #0xFFFFC6CE,%a159    bsr.s addteam60    moveq #0,%d061    move.b AWAY_T,%d062    movea.l #0xFFFFCA32,%a163    bsr.s addteam64    movem.l (%sp)+,%d0-%d4/%a0-%a165    rts6667addteam:                               | d0 = team, a1 = its team block68    moveq #0,%d169    tst.b POGAME70    beq.s 1f71    moveq #1,%d1721:  bsr.s offset73    tst.l %d074    bmi.s 9f75    move.l %d0,%d476    lea BUF,%a077    moveq #25,%d178    jsr SRAM_RD79    lea BUF,%a080    lea PIMF+1(%a1),%a1                | the game's minutes of roster slot 1..2581    moveq #0,%d382    moveq #0,%d2                       | slot index 0..24 = roster slot 1..25832:  move.b (%a0,%d2.w),%d384    sub.b %d3,DELTA                    | the old byte leaves the checksum85    moveq #0,%d186    move.b (%a1,%d2.w),%d187    add.w %d3,%d1                      | (d3 high byte is 0 from the byte loads below)88    cmpi.w #255,%d189    bls.s 3f90    move.w #255,%d1913:  move.b %d1,(%a0,%d2.w)92    add.b %d1,DELTA                    | the new byte enters it93    moveq #0,%d394    addq.w #1,%d295    cmpi.w #25,%d296    bcs.s 2b97    lea BUF,%a098    move.l %d4,%d099    moveq #25,%d1100    jsr SRAM_WR1019:  rts102103clearleague:104    movem.l %d0-%d4/%a0,-(%sp)105    move.l #LEAGUE,%d41061:  lea BUF,%a0107    move.l %d4,%d0108    moveq #25,%d1109    jsr SRAM_RD110    lea BUF,%a0111    moveq #24,%d11122:  move.b (%a0),%d0113    sub.b %d0,DELTA114    clr.b (%a0)+115    dbra %d1,2b116    lea BUF,%a0117    move.l %d4,%d0118    moveq #25,%d1119    jsr SRAM_WR120    addi.l #25,%d4121    cmpi.l #LEAGUE+800,%d4122    bcs.s 1b123    movem.l (%sp)+,%d0-%d4/%a0124    rts125