SteveC1331 Posted June 26, 2020 Share Posted June 26, 2020 I made a test app to verify behavior using opendir(), fopen(), fwrite(), fputs() etc. which seems to work fine. When I use the same concepts in my game xex, I get a crash after fopen() of the file I am going to write. I'm not sure how to proceed to debug/fix my problem. I turned on tracecio and this is the output for the game.xex CIO: IOCB=1, CMD=$03 (open), AUX1=$04, filename="H2:CFGAME.XEX" CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$1df4, length=$0002 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$2e00, length=$0213 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$02e2, length=$0002 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$4108, length=$025b CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$02e2, length=$0002 CIO: IOCB=2, CMD=$03 (open), AUX1=$0c, filename="S:" CIO: IOCB=2 (S:), CMD=$0C (close) CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$4108, length=$72e6 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$02e0, length=$0002 CIO: IOCB=1 (H:), CMD=$07 (get characters), buffer=$15a0, length=$0004 CIO: IOCB=1 (H:), CMD=$0C (close) CIO: IOCB=2 (-), CMD=$0C (close) CIO: IOCB=0 (E:), CMD=$07 (put characters): buf=$9177, len=$000A CIO: IOCB=1, CMD=$03 (open), AUX1=$0c, filename="S:" CIO: IOCB=2, CMD=$03 (open), AUX1=$1c, filename="S:" CIO: IOCB=0 (E:), CMD=$07 (put characters): buf=$9141, len=$0016 CIO: IOCB=3, CMD=$03 (open), AUX1=$1c, filename="S:" CIO: IOCB=4, CMD=$03 (open), AUX1=$08, filename="H4:T.CFM" CPU: Illegal instruction hit: 423A (245415: 15, 23) A=08 X=40 Y=00 S=ED P=33 ( ZC) 4239: 32 KIL I load the xex from the H: device and it successfully loads and runs. I am not explicitly interacting with any device S: My test xex, which is just text mode, does not cause any actions on an S: device. I thought maybe I hit a problem with the interaction between opendir() and opening files, but I commented that part out. Any ideas would be appreciated. thanks! Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted June 26, 2020 Share Posted June 26, 2020 Can you build & post the test binary with a label file or alternatively the source and this will make getting others to debug it a bit easier. You also don't mention which version of the CC65 toolkit you are using. Quote Link to comment Share on other sites More sharing options...
SteveC1331 Posted June 27, 2020 Author Share Posted June 27, 2020 21 hours ago, Wrathchild said: Can you build & post the test binary with a label file or alternatively the source and this will make getting others to debug it a bit easier. You also don't mention which version of the CC65 toolkit you are using. cc65 --version V2.18 - Git cab4910 I've attached the cfgame.xex and .lbl and .dbg files. With an H device mounted in Altirra, To repro, select 1. Map Editor, then X for save, H for drive, a number, then type a short file name like t.map I'm a little concerned its a stack overflow problem, but I'm not sure. cfgame.zip Quote Link to comment Share on other sites More sharing options...
phaeron Posted June 27, 2020 Share Posted June 27, 2020 3 hours ago, SteveC1331 said: cc65 --version V2.18 - Git cab4910 I've attached the cfgame.xex and .lbl and .dbg files. With an H device mounted in Altirra, To repro, select 1. Map Editor, then X for save, H for drive, a number, then type a short file name like t.map I'm a little concerned its a stack overflow problem, but I'm not sure. cfgame.zip 349.92 kB · 1 download Looks like the CIO_handler routine is being corrupted by out of bounds screen drawing. Call stack: setcursor() -> cputdirect() -> _cputc() ->_cputsxy() ->_putString() -> __initMapEditor(). 2 Quote Link to comment Share on other sites More sharing options...
SteveC1331 Posted June 27, 2020 Author Share Posted June 27, 2020 (edited) 4 hours ago, phaeron said: Looks like the CIO_handler routine is being corrupted by out of bounds screen drawing. Call stack: setcursor() -> cputdirect() -> _cputc() ->_cputsxy() ->_putString() -> __initMapEditor(). thanks much! I found some things strange in how to get characters to show up in the footer 4 lines vs. how much memory should have been used for graphics mode 12. calling _graphics(12) implemented by the CC65 atari lib. e.g. if I offset characters by only 20 lines, they do not draw in the footer area as I would have expected, if offset by 24 lines the characters show up in the footer graphics area. There should only be 24 rows of characters total memory in graphics mode 12 I thought. I know some will probably point towards making a custom display list, which maybe I'll resort to, but I think I should be able to get things to work using _graphics(12) I can write a test app to verify some of this behavior to try to figure out what is going on. ------- Update: Even more simple - I'm making the call to that function putString(), that is supposed to work only in _graphics(12), before initing to _graphics(12). thanks much again! Edited June 27, 2020 by SteveC1331 updated info Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.