Jump to content
IGNORED

Bankswitching causes compilation failure


bjbest60

Recommended Posts

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 List
FASTFETCH 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 4

C:\Documents and Settings\Desktop\bB\fall\fall12.bas.asm (5084): error: Illegal Addressing mode 'sta '.

fall10test.bas

Edited by bjbest60
Link to comment
Share on other sites

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
Link to comment
Share on other sites

 

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 by bjbest60
Link to comment
Share on other sites

After trying a bunch of random things, it finally compiles for me:

 

attachicon.giffall10test_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 by bjbest60
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...