Jump to content
IGNORED

Program size issue


Recommended Posts

I'm bumping this great topic so it stays fresh.

 

I've just written up a mapping document of my game and ordered all the code into proper segments, and just doing this and not adding any new code caused me to get the purple screen of death again.  And all I did was move one GOTO chunk of code to the bottom of all the other GOTO statements (It was originally after all the GOSUB statements) and coincidentally the ASM was right after this chunk, so I don't know why this would trigger the error as I would say this should not have changed anything.

 

I think Carlsson stated that the CONSTANTS.BAS doesn't really add any overhead, right?  I was thinking of removing this and just added the handful of constants directly into my code if this would help.  In either case, here is my code workflow:

 

1-Constants.bas include file and all other defined variables, I might need 10 or so more, but I am not near any of the limits so this is good)

2-Game flow (all the GOTO chunks - I should be done with this)

3-GOSUB Procedures (I will probably need a few more of these)

4-BITMAPS (these should be final, don't think I need any more)

5-TABLE arrays (these should be final, don't think I need any more)

6-SOUND (this will grow once I get to it. I only have a couple things in here. I'm not adding a large music loop, will just need a few more sound effects and a couple of small music jingles that only run a couple of measures)

 

Right now, I'm using ASM $C100 and the only place I could get it where the code compiles AND the game works is before the final GOTO chunk before the GOSUB sections begin.

 

I should probably think abut this in a smarter way once I'm done.  Any additional thought?  thanks

 

 

 

Edited by Mik's Arcade
Link to comment
Share on other sites

It is correct that CONSTANTS only has a number of defined constants that add 0 bytes to the executable. Did you check the list file to see exactly where each section ends up? You might want to post at least the CFG file to see which segments have been selected, if there are some overlap beyond what you address.

Link to comment
Share on other sites

27 minutes ago, carlsson said:

It is correct that CONSTANTS only has a number of defined constants that add 0 bytes to the executable. Did you check the list file to see exactly where each section ends up? You might want to post at least the CFG file to see which segments have been selected, if there are some overlap beyond what you address.

I cannot find a CFG file at all. I've attached the LST file, but I'm lost on what to look for in here.  I'm at least still able to compile and run the program.  And I've added about 9 new variables too so I'm out of the danger zone for now.  I at least know I am in good shape.  I must have plenty of room to move stuff around if I need to eventually.

 

 

sasuke.lst

Edited by Mik's Arcade
Link to comment
Share on other sites

Hm.. how can the compiler + assembler step complete without a CFG file is generated?

 

Anyway, it was mentioned earlier that near the end of the segment $C040 - $FFFF, you must not have code, only data. I see that your program uses the following areas:

 

$5000 - $5EC1

$C100 - $DF95

 

Note that the epilogue is attached after your program, so you might want to do one of the following:

 

1. Add ASM ORG $A000 right before "REM START of SOUND LOGIC" ($DA10) to steer the sound effects and epilogue code into a new segment.

2. Replace ASM ORG $C100 with ASM ORG $A000 earlier on. Since your current code is less than $2000 decles, it would fit into this segment as well.

 

See the file contrib/42k.bas for an order of segments. Honestly the fact that code can't go at the end of the last segment was news to me until recently, or perhaps I misunderstood that part of the discussion.

 

Edit: Ok, the cut-off for code should be $F000 so your program in its current state is a good while away from that. In that case, I'm not sure why you got the purple screen. Generally though, the sound effects are code so perhaps put those after the other GOSUB routines, though the epilogue would attach itself after your last data anyway, but you could probably do a segment switch right before that if required.

Edited by carlsson
Link to comment
Share on other sites

1 hour ago, carlsson said:

Hm.. how can the compiler + assembler step complete without a CFG file is generated?

 

Anyway, it was mentioned earlier that near the end of the segment $C040 - $FFFF, you must not have code, only data. I see that your program uses the following areas:

 

$5000 - $5EC1

$C100 - $DF95

 

Note that the epilogue is attached after your program, so you might want to do one of the following:

 

1. Add ASM ORG $A000 right before "REM START of SOUND LOGIC" ($DA10) to steer the sound effects and epilogue code into a new segment.

2. Replace ASM ORG $C100 with ASM ORG $A000 earlier on. Since your current code is less than $2000 decles, it would fit into this segment as well.

 

See the file contrib/42k.bas for an order of segments. Honestly the fact that code can't go at the end of the last segment was news to me until recently, or perhaps I misunderstood that part of the discussion.

 

Edit: Ok, the cut-off for code should be $F000 so your program in its current state is a good while away from that. In that case, I'm not sure why you got the purple screen. Generally though, the sound effects are code so perhaps put those after the other GOSUB routines, though the epilogue would attach itself after your last data anyway, but you could probably do a segment switch right before that if required.

thanks, this conversation gets more interesting.  I'm using @DZ-Jay SDK, so I don't know if this changes anything.  I use INTYBUILD without any other options to compile programs, so I don't know if this has anything to do with no CFG file being generated. I would assume it should go in the BIN folder.

 

I "used" to use ASM ORG $A000 but then I started getting the purple screen again just today.  After reading through this thread i switched it to $C100 and eventually got it working again.  All the sound effects code is at the end of the program. I threw the ASM ORG $A000 where you suggested just to be safe as I will be adding more stuff there soon.

 

For the moment, everything is working, but usage of these segments is still fuzzy.  I'm sure I will get it eventually.

 

thanks

 

 

Link to comment
Share on other sites

It sounds like something else is happening. Honestly I don't remember what happens if you switch to a different segment in the middle of a routine, vs if you do it right before a label. I'm not sure if you even tried to change segment in the middle of code but it could be worth having a look at.

Link to comment
Share on other sites

13 minutes ago, carlsson said:

It sounds like something else is happening. Honestly I don't remember what happens if you switch to a different segment in the middle of a routine, vs if you do it right before a label. I'm not sure if you even tried to change segment in the middle of code but it could be worth having a look at.

I never added the ASM statement in the middle of a routine but I see what you are getting at.

 

Originally, I had it between a GOSUB procedure and a GOTO block of code. (ie, right after the END on the GOSUB procedure and before the GOTO label) Then I realized that this GOTO block was sitting after the all the GOSUB procedures. So, I merely moved the GOTO block to be at the end of the other GOTO blocks so they would be grouped together.

 

Now I can see how this might impact a 'segment' of code and how what a seemingly harmless cut and paste in a text editor could change a lot when the code is actually compiled.

 

On a fun note, I just completed the code framework to handle all of the boss battles in the game and have the first boss 100% completed.  I originally hard coded everything just to test the code loop on this one boss but I have since turned it logic that can support any number of bosses by using variables and different states, just like the main game loop.  All I need to do now is set the variables and conditions for them and test.  This should be pretty easy. Once I did this for the main loop, setting up the enemy waves themselves was a piece of cake. I might finish it up before Thanksgiving!!!   Of course, then it is time to polish the game and add more music and sound, but that's the fun stuff.

Edited by Mik's Arcade
  • 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...