Showing posts with label pal. Show all posts
Showing posts with label pal. Show all posts

Friday, 6 March 2020

Machine Detection Intro

I've spent twenty minutes today adding a *tiny* (and simple) little intro screen to the game before the main title screen appears.  This intro displays information about the type of machine the game is being played on as detected by the code added yesterday in the previous diary entry here...

This intro informs the user the machine type being used (PAL or NTSC) and the fact that the music and sound was designed for an 8580 SID chip.

It also gives me a chance to use the 'Cosine' sprites that I designed months ago and that have been languishing in the sprite bank unseen and unused up until now!  The sprites and messages look a little like this when running in WinVICE using NTSC...


Obviously, the message changes to PAL if such a machine is being used.

I'll own up to hacking my own code a bit!  The game essentially uses two 'modes', title screen on or title screen off, which is stored in a label called 'title_mode'.  When title screen is off, the game is in play - the two modes use slightly different code branches.  For example, the colour washing of text on the title screen is handled in one of my IRQ splits, but when the title screen mode is off, the colour washing code is skipped.

However, for this little intro and for various reasons, I need to run a little portion of title screen code and a little portion of game screen code, so there is now an intro check to skip or add certain elements and I admit to doing this in a quite hacky, yucky way!  It works, but I may need to recode this as it's stirring my OCD tendencies!

Next diary entry...

Thursday, 5 March 2020

NTSC

I'm guessing that this little game of mine will mainly appeal to people in Europe (hopefully!), but since I'm part of a C64 group (Arkanix Labs) that is U.S. and therefore NTSC based as well as a U.K. and PAL based group (Cosine Systems), I would feel a little disloyal towards my American cousins if I didn't include compatibility for NTSC systems.

If you don't know anything about NTSC, then do some research possibly by starting here...

Basically, NTSC machines run at 60Hz instead of 50Hz as on PAL.  Also, they have fewer display scanlines, 262 versus 312.  For my game, this means that my blue top border I wanted for 2 levels and which works nicely under PAL (see diary entry here...), starts waaay too early on NTSC and appears at the bottom of the screen, something like this...


To combat this, I've included an extra IRQ split in the top border.  Thus, the first IRQ split colours the background (therefore border area) black to eliminate the blue at the bottom of the screen under NTSC and the second IRQ split, which starts just as a PAL machine begins displaying the visible area of the top display, then colours the background blue.

Miraculously, this seemed to work!  Well, in WinVICE at least - I'll have to wait for my NTSC friends to test on real hardware for me and report back to be sure!  At present, it now look like this under NTSC in WinVICE...


Adding an additional split did have a knock on effect on some other timings; since the NTSC display has less screen time to execute in it seems, the title screen code was over-running and everything was slow and flickery.  A little rearrangement of some of my IRQ code later and all was back up to speed!

The other NTSC issue is the music.  Since NTSC machines run slightly quicker, the music was playing too fast and sounded awful.  Therefore, I've coded up a timer/counter that skips calling the music driver every few frames thereby slowing it down.  Of course, the game needs to know what type of machine it is running on, so I've now included a check at the start of the code to do this.

I've used a modified version of code that was posted on CSDb so thanks to all those involved in that discussion and who shared code, which you can find here...

Next diary entry...