Jump to content
  • entries
    334
  • comments
    900
  • views
    258,315

mischief managed


EricBall

773 views

Last entry I complained that I'd run out of space. Well, I've now managed to free up a whack-o-space, which has (at least for the moment) cured my space issues. I'm now trying to work out what the heck my enemy AI code is doing (along with some code tweaking). I'm hoping I can get a new release out in the next couple of days.

 

For those curious, I found the space in my kernal (of all places). Since I knew I needed a goodly amount of space (i.e. not just a few bytes), I first looked at the listing and divided the code (and data) into chunks (i.e. enemy AI) along with how big each was. The theory it's easier to find savings in a big chunk of code (or data) than a small routine. For Skeleton+ I removed a color lookup table used as part of the Skeleton dead sequence and replaced it with a random number generator (since the colors looked mostly random anyway). Unfortunately there aren't any similar tables in Leprechaun.

 

The biggest routine in the first bank (which is where I needed space) was the kernel, so I started looking there. One of the things which I saw was there were three repositioning routines which took up a bunch of space: first row, odd rows, and even rows. Hmmm... Might it be possible to get rid of the first row routine? Unfortunately, there wasn't quite enough cycles at the end of the odd row repositioning routine to squeeze in a test to jump directly to the even row repositioning routine.

 

Then I had a flash of insight. Part of the reason the repositioning routine is so large is it is partially unrolled to give it enough cycles to squeeze in some of the other logic into a single line. But the first row doesn't have to fit in a single line - there's some unused cycles after the score routine. Thus a 94 byte routine dropped to 34 bytes (and moved to a different bank, not that I have a lot of space left there either). Woo-hoo!

9 Comments


Recommended Comments

Juggle bank usage is fun - not. I'm at that stage in MM :ponder:

I think I'm through most of that. SuperCharger puts some additional restrictions on bankswitching in that there are 3x2K SC-RAM plus the 2K SC BIOS ROM, but you can't select all possible combinations.

 

Bankswitch layout is really a matter of what needs access to what. In Leprechaun I've got 5 pages for level & sprite data. So that's gotta be accessible by the kernel, the routines which scan the level data for movement, and the routines which update the level data. But the 6-digit routine doesn't need access to that data, but has a page worth of character sprites. So that's all stuck in a different bank which can also access the BIOS, so that's where the title and other screens will go.

 

Of course, standard 2600 bankswitching which swaps out all 4K has bigger challenges since you're looking for routines which don't need access to any large shared data, and where the bankswitch overhead & address overlay can be made to work.

Link to comment
Bankswitch layout is really a matter of what needs access to what. In Leprechaun I've got 5 pages for level & sprite data. So that's gotta be accessible by the kernel, the routines which scan the level data for movement, and the routines which update the level data. But the 6-digit routine doesn't need access to that data, but has a page worth of character sprites. So that's all stuck in a different bank which can also access the BIOS, so that's where the title and other screens will go.

 

Have you given any thought to using an AtariVox/MemCard to hold level data? You could have one program which puts 4K of level data into the memcard at $3000-$3FFF (the scratchpad zone) and then have the main program load levels from there.

Link to comment

Have you given any thought to using an AtariVox/MemCard to hold level data? You could have one program which puts 4K of level data into the memcard at $3000-$3FFF (the scratchpad zone) and then have the main program load levels from there.

Supporting the MemCard for high-scores is on the wish list, but I'm not sure I understand what your suggestion is or what value it has over the existing Online Level Editor.

Link to comment

Have you given any thought to using an AtariVox/MemCard to hold level data? You could have one program which puts 4K of level data into the memcard at $3000-$3FFF (the scratchpad zone) and then have the main program load levels from there.

Supporting the MemCard for high-scores is on the wish list, but I'm not sure I understand what your suggestion is or what value it has over the existing Online Level Editor.

 

The idea would be that the user would load the game in two parts. Part 1 would put 4K worth of level data into the AtariVox and then load Part 2, which would be the game itself. The game could then switch among 4K worth of levels without having to reload anything. Basically, it would be functionally equivalent in many ways to having 10K instead of 6K on the SuperCharger.

Link to comment

I would think if you did something like that, you'd have to include a MemCard with the game, and bump up the cost of the game to cover it, right?

Link to comment
I would think if you did something like that, you'd have to include a MemCard with the game, and bump up the cost of the game to cover it, right?

 

You could offer people the choice of either using a memcard and doing a two-part load after which no more loading would be needed, or else loading each level off tape/CD. The memcard wouldn't be absolutely required, but it would its presence would make the game much more convenient.

Link to comment

You could offer people the choice of either using a memcard and doing a two-part load after which no more loading would be needed, or else loading each level off tape/CD. The memcard wouldn't be absolutely required, but it would its presence would make the game much more convenient.

Except each level is ~768 bytes (3 pages, spread over 5 pages in SC-RAM), so 4K would only be 5 levels (versus 99 on tape/CD).

Link to comment

Except each level is ~768 bytes (3 pages, spread over 5 pages in SC-RAM), so 4K would only be 5 levels (versus 99 on tape/CD).

 

Each level is 19x32 cells each of which holds one of six things. I can understand that during gameplay you may need to have a lot of data "fully unpacked" for use by the kernel, but by my tally each level should take under 256 bytes (19x3x4 plus a few for monster placement) without compressing anything very 'hard'. Using simple arithmetic coding (3 pixels/byte) would reduce that to 203 bytes plus monsters; using fancier packing (16 pixels/5 bytes) would reduce it to 190 plus monsters. So 4K would allow for 16-20 levels, which would be enough for a reasonable game.

Link to comment
Guest
Add a comment...

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