Jump to content

Photo

Bankswitching causes compilation failure


18 replies to this topic

#1 bjbest60 OFFLINE  

bjbest60

    Chopper Commander

  • 109 posts
  • Location:Space Cactus Canyon

Posted Sat Dec 8, 2018 4:43 PM

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 '.

Attached Files


Edited by bjbest60, Sat Dec 8, 2018 6:26 PM.


#2 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,811 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Dec 8, 2018 7:42 PM

Looks like you're not jumping to bank 3. You can't just fall into a bank with your code, if I remember correctly.



#3 bjbest60 OFFLINE  

bjbest60

    Chopper Commander

  • Topic Starter
  • 109 posts
  • Location:Space Cactus Canyon

Posted Sat Dec 8, 2018 8:37 PM

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.



#4 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 648 posts

Posted Sat Dec 8, 2018 8:53 PM

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


#5 bjbest60 OFFLINE  

bjbest60

    Chopper Commander

  • Topic Starter
  • 109 posts
  • Location:Space Cactus Canyon

Posted Sat Dec 8, 2018 11:50 PM

 

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, Sat Dec 8, 2018 11:51 PM.


#6 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,811 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sun Dec 9, 2018 3:20 AM

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

 

Attached File  fall10test_2018y_12m_09d_0415t.bas   31.64KB   17 downloads



#7 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 648 posts

Posted Sun Dec 9, 2018 5:35 AM

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.

#8 bjbest60 OFFLINE  

bjbest60

    Chopper Commander

  • Topic Starter
  • 109 posts
  • Location:Space Cactus Canyon

Posted Sun Dec 9, 2018 8:44 AM

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, Sun Dec 9, 2018 8:52 AM.


#9 bogax OFFLINE  

bogax

    Dragonstomper

  • 787 posts

Posted Sun Dec 9, 2018 9:20 AM

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



#10 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 648 posts

Posted Sun Dec 9, 2018 9:29 AM

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,



#11 RevEng ONLINE  

RevEng

    Bit Player

  • 5,073 posts
  • Location:bottom of the stack

Posted Sun Dec 9, 2018 9:31 AM

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?

#12 bogax OFFLINE  

bogax

    Dragonstomper

  • 787 posts

Posted Sun Dec 9, 2018 9:48 AM

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

Attached Files



#13 RevEng ONLINE  

RevEng

    Bit Player

  • 5,073 posts
  • Location:bottom of the stack

Posted Sun Dec 9, 2018 10:59 AM

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.

#14 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 648 posts

Posted Sun Dec 9, 2018 11:12 AM

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?



#15 RevEng ONLINE  

RevEng

    Bit Player

  • 5,073 posts
  • Location:bottom of the stack

Posted Sun Dec 9, 2018 11:38 AM

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.

#16 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 648 posts

Posted Sun Dec 9, 2018 11:43 AM

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.



#17 RevEng ONLINE  

RevEng

    Bit Player

  • 5,073 posts
  • Location:bottom of the stack

Posted Sun Dec 9, 2018 11:48 AM

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.

#18 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,811 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sun Dec 9, 2018 1:33 PM

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.

#19 bjbest60 OFFLINE  

bjbest60

    Chopper Commander

  • Topic Starter
  • 109 posts
  • Location:Space Cactus Canyon

Posted Sun Dec 9, 2018 9:42 PM

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.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users