StewBC / cc65-Chess

Portable chess game in C. Commodore 64, Apple 2, Atari, Oric, Commander X16, curses terminal, etc.
44 stars 15 forks source link

plus4 version crashes #15

Closed calmopyrin closed 7 months ago

calmopyrin commented 7 months ago

The plus4 build crashes and eventually lands on a HALT opcode. Possibly a corrupted stack.

Opcodes executed before the crash:

#        address
0000 : . 4F47 02        ABS         [AC|XR|YR|ST:56D40321]
-001 : . 851C 20 47 4F  JSR $4F47   [AC|XR|YR|ST:56D40321]
-002 : . 8519 4F 55 54  SRE $5455   [AC|XR|YR|ST:00D40322]
-003 : . 8518 48        PHA         [AC|XR|YR|ST:00D40322]
-004 : . 6937 20 18 85  JSR $8518   [AC|XR|YR|ST:00D40322]
-005 : . 6935 A9 00     LDA #$00    [AC|XR|YR|ST:F2D403A0]
-006 : . 6933 A2 D4     LDX #$D4    [AC|XR|YR|ST:F21D03A0]
-007 : . 904E 60        RTS         [AC|XR|YR|ST:F21D03A0]
-008 : . 904C 49 FF     EOR #$FF    [AC|XR|YR|ST:0D1D0322]
-009 : . 9045 10 05     BPL $904C   [AC|XR|YR|ST:0D1D0322]
-010 : . 9043 24 13     BIT $13     [AC|XR|YR|ST:0D1D0320]
-011 : . 90B7 60        RTS         [AC|XR|YR|ST:0D1D0320]
-012 : . 90B5 29 FF     AND #$FF    [AC|XR|YR|ST:0D1D0320]
-013 : . A790 60        RTS         [AC|XR|YR|ST:0D1D0320]
-014 : . A78E B0 ED     BCS $A77D   [AC|XR|YR|ST:0D1D0320]
-015 : . D9D8 60        RTS         [AC|XR|YR|ST:0D1D0320] *
-016 : . D9D7 18        CLC         [AC|XR|YR|ST:0D1D0320]
-017 : . D9D6 68        PLA         [AC|XR|YR|ST:1D1D0320]
-018 : . D9D5 AA        TAX         [AC|XR|YR|ST:1D060320]
-019 : . D9D4 68        PLA         [AC|XR|YR|ST:00060322]
-020 : . D9D0 F0 02     BEQ $D9D4   [AC|XR|YR|ST:00060322]
-021 : . D9CE A5 CF     LDA $CF     [AC|XR|YR|ST:03060320]
StewBC commented 7 months ago

Right now, updating to the latest cc65 gives me a game that seems to work, but where the font is completely messed up. The version of cc65 I had updated to previously had the same when I built with it this morning, but messed up in a very different way.

This is a bit of an aside, but I think unit testing on cc65 has not been great. There have been other issues recently in my projects - all related to cc65 changes. I have switched over to the llvm-mos compiler. Perhaps when I have a chance I'll try to switch cc65-Chess to llvm-mos (if it supports all platforms - I haven't checked yet). That would make the naming a bit odd.

Bottom line is - this might be chess, it might be the compiler but I am not going to put time into looking as I simply don't trust the compiler. I realize that at this moment it means that the project isn't in a great state since I can't even make a visually working Plus4 game. My guess it everything will work with a compiler that's 7 months old, or older - whichever version I had when I made the Plus4. Unfortunately I didn't record the compiler version at the time.

I am sorry. I just don't have time right now to look into this beyond what I just did. Thank you for taking it for a spin, though!