bjbest60 Posted December 8, 2018 Share Posted December 8, 2018 (edited) Good gravy, am I pulling my hair out. I'm trying to add audio code to a game I've created. The audio code itself works as its own 4k game, playing the tune. The game code works as its own 8k game (it's a skydiving thing). When I change the romsize to 16k, I've been getting all sorts of weird errors. In the attached version, I'm told "=" is an illegal keyword. In other iterations as I've been attempting to isolate the problem, I've been told there's been an error (illegal address, I think) with "sta". Sometimes "FASTFETCH" is unrecognized. Nothing seems consistent or enlightening to me. The common denominator is that bank 3 makes things screwy. I have a feeling this has to do with bankswitching and/or the kernel options, but the options should be valid together. When I cut the audio code entirely from the file, the game compiles and the kernel options behave as expected. But if I add the audio code back in, I get an error at the "musiccounter = musiccounter + 1" line (which, again, works normally in a standalone program). Right now, no code even switches banks explicitly. The audio isn't called by anything yet, and the game code is self-contained in bank 2. Maybe I'm missing something super-obvious because I've been staring at it for too long. But I'd really appreciate some review. I've tried compiling on two separate machines, current bB software, same result. Thanks for any advice. EDIT: In the attached file, the first set of commands in bank 3 (under the "nextline" heading) might be overindented, though I've never had that as an issue before. But, trying some other fixes, here's the other error I get if the compilation doesn't crash upon hitting bank 3: --- Unresolved Symbol ListFASTFETCH 0000 ???? (R ) 3185 bytes of ROM space left in bank 1 684 bytes of ROM space left in bank 2 2275 bytes of ROM space left in bank 3 1879 bytes of ROM space left in bank 4C:\Documents and Settings\Desktop\bB\fall\fall12.bas.asm (5084): error: Illegal Addressing mode 'sta '. fall10test.bas Edited December 9, 2018 by bjbest60 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/ Share on other sites More sharing options...
+Random Terrain Posted December 9, 2018 Share Posted December 9, 2018 Looks like you're not jumping to bank 3. You can't just fall into a bank with your code, if I remember correctly. Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173068 Share on other sites More sharing options...
bjbest60 Posted December 9, 2018 Author Share Posted December 9, 2018 Yes. In this version, I don't expect any of the audio code to do anything; it's not linked to the main loop in any way (i.e., there's no goto / gosub going to or from it). But I do expect the code to compile, and I can't get it that far. Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173092 Share on other sites More sharing options...
+Karl G Posted December 9, 2018 Share Posted December 9, 2018 Hmm - it compiles fine for me? Runs okay, too. Found dasm version: DASM 2.20.11 unofficial 20140202a Starting build of fall10test.bas batari Basic v1.01dreveng40 (C)2005-2017 2600 Basic compilation complete. 3997 bytes of ROM space left in bank 1 585 bytes of ROM space left in bank 2 2335 bytes of ROM space left in bank 3 2030 bytes of ROM space left in bank 4 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173104 Share on other sites More sharing options...
bjbest60 Posted December 9, 2018 Author Share Posted December 9, 2018 (edited) Hmm - it compiles fine for me? Runs okay, too. Found dasm version: DASM 2.20.11 unofficial 20140202a Starting build of fall10test.bas batari Basic v1.01dreveng40 (C)2005-2017 2600 Basic compilation complete. 3997 bytes of ROM space left in bank 1 585 bytes of ROM space left in bank 2 2335 bytes of ROM space left in bank 3 2030 bytes of ROM space left in bank 4 Thanks. That's at least somewhat heartening. But after uninstalling and reinstalling bB and vbb, I still can't compile. I actually have the same bytes reported as your compilation, but I'm still getting an error which is more mysterious than before as there's even less to go on. There are no unresolved symbols listed anymore. --- Unresolved Symbol List 3997 bytes of ROM space left in bank 1 585 bytes of ROM space left in bank 2 2333 bytes of ROM space left in bank 3 2030 bytes of ROM space left in bank 4 C:\Users\Owner\Desktop\bB.1.1d.reveng41\fall10test.bas.asm (4599): error: Illegal Addressing mode 'sta '. I get the same results trying to compile from the command line rather than bB. What setup are you using (OS, using Vbb or not, etc.)? Could someone else try compiling with whatever setup they've got and report results here? Edited December 9, 2018 by bjbest60 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173195 Share on other sites More sharing options...
+Random Terrain Posted December 9, 2018 Share Posted December 9, 2018 After trying a bunch of random things, it finally compiles for me: fall10test_2018y_12m_09d_0415t.bas 1 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173256 Share on other sites More sharing options...
+Karl G Posted December 9, 2018 Share Posted December 9, 2018 I am using the latest RevEng build on Mac OS. I really doubt that the build platform makes a difference, though. It's strange that we are seeing different results. 1 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173274 Share on other sites More sharing options...
bjbest60 Posted December 9, 2018 Author Share Posted December 9, 2018 (edited) After trying a bunch of random things, it finally compiles for me: fall10test_2018y_12m_09d_0415t.bas Cool. Thanks for looking at it! The code now compiles for me, too. I see you've added underscores to the variable names and labels. Can you describe what other things you did? The file I attached was a simplified case of my actual file (I'm actually on draft 12), so I'd prefer to make changes to the new file. But I can do a side-by-side comparison and change lines one at a time if necessary. I am using the latest RevEng build on Mac OS. I really doubt that the build platform makes a difference, though. It's strange that we are seeing different results. Yeah, I'm still baffled by what's actually going on. I've fought with this for a long time now and haven't gotten anywhere. I wish I had a clearer idea of the specific problem. Edited December 9, 2018 by bjbest60 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173329 Share on other sites More sharing options...
bogax Posted December 9, 2018 Share Posted December 9, 2018 after getting rid of those god cursed tabs and replacing them with decent spaces and changing the ";" to "rem" on line 1276 (WTF !?) it compiles for me using bB.1.1d.reveng41 on Win 8.1 1 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173347 Share on other sites More sharing options...
+Karl G Posted December 9, 2018 Share Posted December 9, 2018 bB has issues with tabs? I can't figure out why the original compiled fine on my Mac, though. I tried on a Windows VM, and it failed in the same way. Very strange, Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173354 Share on other sites More sharing options...
RevEng Posted December 9, 2018 Share Posted December 9, 2018 The original compiles fine for me on Linux with using bB.1.1d.reveng41. Can someone send me their assembly file, from a compile session with the original basic file that generates the "Illegal Addressing mode 'sta '" error? Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173356 Share on other sites More sharing options...
bogax Posted December 9, 2018 Share Posted December 9, 2018 The original compiles fine for me on Linux with using bB.1.1d.reveng41. Can someone send me their assembly file, from a compile session with the original basic file that generates the "Illegal Addressing mode 'sta '" error? it never gets that far for me if I don't get rid of the tabs it stops on line 1107 musiccounter = musiccounter + 1 with "(1107): Error: Unknown keyword: = " without the tabs .L0421 in bB.asm 4599 in the .lst bB.asm fall10test.bas.lst 1 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173364 Share on other sites More sharing options...
RevEng Posted December 9, 2018 Share Posted December 9, 2018 Thanks for that. Weird that this is a platform specific bug. This is the section of code around L0421 in the listing... 4596 33d6 .L0421 ; ;sounddelay = 30^M 4597 33d6 4598 33d6 a9 1e LDA #30 C:\bB.1.1d.reveng41\code\fall10test\fall10test.bas.asm (4599): error: Illegal Addressing mode 'sta '. 4599 33d8 STA ;sounddelay^M The semicolons aren't being stripped out from the bB preprocessor, like they should. The preprocessor switches modes depending on what it's currently parsing. (eg. general source, data statement, playfield statement, etc) I think the issue here is the preprocessor hasn't properly left one of the previous modes earlier in the source code, probably due to the tabs. I'm not really a lex guy (the preprocessor is written in lex) and I can't reproduce this on my laptop currently, so it may take me some time to further pinpoint and fix. It's probably best to go with bogax's workaround for now. 2 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173404 Share on other sites More sharing options...
+Karl G Posted December 9, 2018 Share Posted December 9, 2018 How does it call lex on each platform? Linux and Mac come with (f)lex out of the box, but what about Windows? Is the preprocess.exe actually a version of lex? Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173415 Share on other sites More sharing options...
RevEng Posted December 9, 2018 Share Posted December 9, 2018 It's a compiled language. Lex generates (temporary) c code from the preprocessor.lex source, which in turn gets compiled into the bB preprocess binaries. Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173429 Share on other sites More sharing options...
+Karl G Posted December 9, 2018 Share Posted December 9, 2018 Okay, I follow that, but how is lex itself called on Windows, since as far as I know, Windows doesn't include a lex binary? I'm just trying to speculate on why the results would be different on Windows as they would be on Mac and Linux. Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173435 Share on other sites More sharing options...
RevEng Posted December 9, 2018 Share Posted December 9, 2018 Okay, I follow that, but how is lex itself called on Windows, since as far as I know, Windows doesn't include a lex binary? I'm just trying to speculate on why the results would be different on Windows as they would be on Mac and Linux. Lex doesn't get called on Windows when you're using bB, and it doesn't get called on Unix either. It gets called only when I build the bB executables themselves. 1 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173441 Share on other sites More sharing options...
+Random Terrain Posted December 9, 2018 Share Posted December 9, 2018 The lights keep flicking off and on, so I had to turn my computer off. I'm talking this into my mother's old iPhone, so this post might have weird spelling problems. I first noticed at least one label starting with a keyword, so I changed all the labels to have two underscores at the beginning. That didn't fix it, so I added one Underscore at the beginning of the variable aliases. That didn't fix the problem, so I started checking the semicolons. Some of your sound data had comments without semicolons, so I put in the semicolons, and I think I removed the places where you had multiple semicolons on the same line. It still didn't fix the problem, well I should say that the problem kept changing, But there was always a problem. The last thing I had to do was change a semicolon to a REM at the beginning of a line in your sound code. After that, it compiled. Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173505 Share on other sites More sharing options...
bjbest60 Posted December 10, 2018 Author Share Posted December 10, 2018 I applied bogax's changes to my current draft of the game, and it now compiles and the sound routines are functional. It's so weird that semicolons would be throwing things off. Thank you so much to all of you who looked into this and offered comments and advice--I don't think I would have figured this out on my own. I'm excited to be moving forward again, and appreciate that you took the time to wade through my code. 1 Quote Link to comment https://forums.atariage.com/topic/285792-bankswitching-causes-compilation-failure/#findComment-4173814 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.