Jump to content

The Southsider

  • entries
    81
  • comments
    767
  • views
    138,562

Juno Third


Guest

719 views

It has been a while since my last blog posting, and I haven't been very active on the site recently. This is not because I have lost interest in the Atari - it is just that I haven't had time to do much on my various projects lately. The main distraction has been a book that I have been writing for the past year. The publishers deadline was the end of February, and as usual I ended up writing the majority of it in the last two months! However, now that it is out of the way I should have significantly more free time again. I would really like to produce something for the minigame competition this year, and the deadline for the Stella programming contest is fast approaching.

 

 

 

Over the last week I have been working on my Juno First game again, and the latest version is attached to the end of this entry. It probably doesn't look much different than the previous version, but it now contains a completely new kernel, and some fantastic sprites by Nathan. There are still a few small bugs, and it is definitely the most difficult kernel that I have written so far! This difficulty comes from the fact that I wanted the sprite graphics to be updated every line (i.e. a 1-line kernel), but this potentially requires doing all of the following tasks on every line:

  1. Display the spaceship sprite.
  2. Display the alien sprite.
  3. Change the spaceship and alien sprite colours.
  4. Display the two missile sprites.
  5. Display the laser beam.
  6. Display the moving grid.

I had to make a few compromises to fit everything in (e.g. the missiles are only updated every other line), but overall I am reasonably happy with the way things turned out. The result is really at the upper-limit of what is possible on the 2600 without any extra memory. It took me many hours of careful unrolling and optimisation, and there were many times that I though it wouldn't be possible. The tightest part is when the ship needs to be displayed at the bottom of the screen. There are absolutely no free cycles at this point, and I can't see any way to squeeze this code further. The entire kernel is written without any illegal instructions, as none of them seemed appropriate.

 

The biggest problem with the current kernel is the HMOVE bars, which cause the gridlines to flicker along the left edge. There are a number of possible solutions, but none of them are ideal:

  1. Perform an early HMOVE -> may cause problems on PAL Atari Jr machines.
  2. Use the PF to hide the left part of the screen -> will appear in the same colour as the laser beam.
  3. Perform an HMOVE on every line -> not enough space kernel cycles.
  4. Update COLUBK on cycle 26 -> tricky but not impossible - will make the left border larger than the right border.
  5. Ignore the problem -> looks a bit messy and will also interfere with the sprites.

I am currently leaning towards the fourth option, but I was wondering if anyone has any better ideas? Also, any more suggestion on how to tighten the code are welcome. The (messy) source code is included in the zip archive.

 

Chris

11 Comments


Recommended Comments

Hi there!

 

That's funny that you post your update today - because just this morning, I tried the MSX version of Juno First.

Oh does it suck! :) :cool:

 

BTW:

Perform an HMOVE on every line -> not enough space kernel cycles.
Actually it's just required on the lines where the scrolling is displayed, no? :D

 

Greetings,

Manuel

Link to comment
Perform an HMOVE on every line -> not enough space kernel cycles.
Actually it's just required on the lines where the scrolling is displayed, no? :cool:

 

Yes you are right of course, though there are still not enough spare cycles (as it would require HMCLRs).

 

Chris

Link to comment

Nice work! The HMOVE lines don't bother me, personally. I usually just think of them as another identifying characteristic of 2600 games. :cool:

Link to comment

RE: HMOVE lines

 

One more possibility: Since you don't need to put the HMOVE right after the repositioning, you could optionally wait a scanline to do the HMOVE if the line happens to occur on the same scanline.

 

If this helps, I think that an HMOVE can be done from cycle 75 to cycle 6 and still work as expected.

Link to comment
If this helps, I think that an HMOVE can be done from cycle 75 to cycle 6 and still work as expected.

 

After a write to HMOVE, the system takes a certain amount of time to output the necessary pulses to the horizontal counters. This time is 1 1/3 cycles per pulse, plus about 2-3 more cycles IIRC. Note that (1) the number of pulses is the 4 MSB's of the movement register, XOR'ed with $8, (2) all pulses must complete before the end of horizontal blanking, and (3) all pulses for a sprite must complete before its horizontal positioning register is changed.

Link to comment

The game looks great. I'd like to see you attempt some sort of particle effects on explosions next.

 

I would wait until the tail end of development to try to get rid of the HMOVE lines. It just seems like a final touch, not a showstopper.

Link to comment

The game looks great. I'd like to see you attempt some sort of particle effects on explosions next.

 

I would wait until the tail end of development to try to get rid of the HMOVE lines. It just seems like a final touch, not a showstopper.

This requires kernel mods, which are usually quite difficult to do when cycles are already limited. I'd vote for doing it sooner rather than later, since programmers rarely want to mess with the kernel once the game is nearly done.

Link to comment

RE: HMOVE lines

One more possibility: Since you don't need to put the HMOVE right after the repositioning, you could optionally wait a scanline to do the HMOVE if the line happens to occur on the same scanline.

If this helps, I think that an HMOVE can be done from cycle 75 to cycle 6 and still work as expected.

 

Thanks for the suggestion. The repositioning lines are already moved dynamically so that they don't happen on the same scanline as a gridline. It shouldn't be too difficult to do the same with the HMOVEs.

 

After a write to HMOVE, the system takes a certain amount of time to output the necessary pulses to the horizontal counters. This time is 1 1/3 cycles per pulse, plus about 2-3 more cycles IIRC. Note that (1) the number of pulses is the 4 MSB's of the movement register, XOR'ed with $8, (2) all pulses must complete before the end of horizontal blanking, and (3) all pulses for a sprite must complete before its horizontal positioning register is changed.

 

Thanks for the technical explanation. However, I have always wondered why the HMOVEs appear as a small black line on the screen, rather than simply happening invisibly in the background?

 

The game looks great. I'd like to see you attempt some sort of particle effects on explosions next.

I would wait until the tail end of development to try to get rid of the HMOVE lines. It just seems like a final touch, not a showstopper.

This requires kernel mods, which are usually quite difficult to do when cycles are already limited. I'd vote for doing it sooner rather than later, since programmers rarely want to mess with the kernel once the game is nearly done.

 

I have to agree with batari here - the kernel is very difficult to tweak later in the development process. I find that I quickly forget the assumptions that were made during the kernel coding.

 

Chris

Link to comment
Thanks for the technical explanation. However, I have always wondered why the HMOVEs appear as a small black line on the screen, rather than simply happening invisibly in the background?

 

Feeding pulses into the horizontal counter causes objects to move left. Except on late-model Juniors, where feeding pulses during the displayed part of the screen will cause counts to be dropped, it's not possible to move objects rightward by feeding pulses into the count circuit.

 

To allow for rightward movement of objects, the 2600 extends horizontal blanking by 8 pixels following an HMOVE. This causes the counters to receive 8 fewer pulses than they would otherwise, moving objects 8 pixels right. If you specify no motion, what happens is that the pulser circuit feeds in 8 pulses (shoving the object 8 pixels left) but the delayed end of HBLANK causes what would be the first 8 pulses to be skipped. This is why a cycle 74 HMOVE works as it does: the latch that indicates whether to delay the end of HBLANK is reset at the end of each scan line, so it will be immediately reset following a cycle-74 HMOVE. Since the latch doesn't get set, objects get placed 8 pixels left of where they normally would.

Link to comment

The game looks great. I'd like to see you attempt some sort of particle effects on explosions next.

 

I would wait until the tail end of development to try to get rid of the HMOVE lines. It just seems like a final touch, not a showstopper.

This requires kernel mods, which are usually quite difficult to do when cycles are already limited. I'd vote for doing it sooner rather than later, since programmers rarely want to mess with the kernel once the game is nearly done.

 

I'm not talking about doing it after the game is completely coded.

 

I meant that it should be a lower priority, but done before the kernel is completed. In other words, get everything else done in the kernel you want to do, and then see if it's even feasible at that point to get rid of HMOVE lines. You don't want to remove the HMOVE lines and realize that you've just prevented yourself from, let's say, having the enemies extend to the left side of the screen or some other severe limitation. Doesn't seem worth the tradeoff to me.

Link to comment
I meant that it should be a lower priority, but done before the kernel is completed. In other words, get everything else done in the kernel you want to do, and then see if it's even feasible at that point to get rid of HMOVE lines. You don't want to remove the HMOVE lines and realize that you've just prevented yourself from, let's say, having the enemies extend to the left side of the screen or some other severe limitation. Doesn't seem worth the tradeoff to me.

 

That seems fair, though it should be noted that priority does not imply coding sequence. I find it can be helpful to code first the parts of a subkernel whose timing is most fixed even if they might be omitted (e.g. "If I include a colored border, I'll need 5 cycles at this spot on the line). Coding such things early on helps to make clear the constraints the rest of the subkernel has to meet, and will thus help clarify what will be possible.

 

Further, it's important to be willing to tear up and redo subkernels a few times. Archive the old ones in case the new ones don't work (or aren't any better), but unless a subkernel does everything you could want it to do, don't be afraid to try some different approaches. Even one that aren't quite suitable for the task at hand may be a useful addition to your tool belt.

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