Thread: Robocop AGA
View Single Post
Old 12 November 2021, 17:09   #54
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
Update #4

Although I've been distracted with my real work lately, work on the intro sequences has continued; adding a couple of more scenes and utilising some audio samples ripped from the movie. I've also done a bit of refactoring to stitch all of the scenes together nicely, which seems to have gone well.

My main conundrum this time centred around finding an easy way to render the text in the high score table in different colours.

Coders will know that the Copper allows you to change the colour registers depending on the current position of the beam drawing the screen, the most common way being that the changes are handled with a vertical beam change, i.e. line by line. That would solve the font colours at the top: the red 'BEST PLAYERS' line and the table header, but the tricky (for me anyway) part came next.

For each high score line, the majority of the text is green but the name should be in white. You could of course blit a different colour font here, but that's too easy; it would take valuable memory up, and that's not the hardware-banging low-level way I wanted to go with this project. I'm here to learn, not take the easy way out.

The Copper also allows you to change colour registers (or any register) by waiting horizontally too, although it's a little more restricted as I was about to find out. Sounds simple enough in theory; wait for a specific line, then wait for a specific horizontal position, change the two colours required for the font to render correctly, wait again for a safe area after the name and set them back to green. However, in practice:



The horizontal waits clearly aren't working as expected! Apart from the copper loops, and the pesky WAIT command working differently after a certain line (read in more technical detail here: http://eab.abime.net/showthread.php?t=108722) it became apparent that there just wasn't enough time to change two colour registers:



The image above shows that after changing one colour, the beam has already moved across a number of pixels and by the time it comes to changing the second colour the position is completely out of sync. Back to the drawing board.

The final solution kindly pointed out by mcgeezer lay in a new AGA register called BPLCON4 which allows you to shift the position of the palette which is used by the bitplanes with one register write which was enough for my needs in this case. The two white palette entries were 4 positions away from the two green entries, so shifting the palette to the left by 4 positions made sure that the correct colours were in the correct place at the correct time! Result!



Two other scenes were added to the sequence to allow me to stich them all together: the quick flash of white noise after the high score table, and the prime directives. The white noise is simple a sequence of 5 images which are flashed onto the screen as 16 colour 64 pixel wide sprites, again using SSCAN2 to lessen the load, and repeated 4 times. Easy.

The prime directives scene takes the same 'typewriter' code used in the highscores table and outputs different text, which is made easier by the fact that it's all green text so no messing around with Copper loops, or WAIT instructions. I did want to initiate some of the sound effects at specific times though so I refactored my code to execute a callback when each line ends, allowing me to look at the line which has just ended and play a different sample relative to that line number.

Oh, there's also a subtle difference from the arcade version in the prime directives scene as bit of an improvement, Easter egg

[ Show youtube player ]

Shout outs and big thanks for help during this little phase belong to:
- ross: keyboard irq help, copper horizontal waits
- roondar: copper horizontal waits and general 68k advice
- mcgeezer: copper colour changes with BPLCON4 and some
- gigabates: pesky non-ascii codes in source code making vasm take a wobbler
- DanScott: NOT.b advice and some supertastic "set" examples
- jotd: More invaluable 68k advice
DanielAllsopp is online now  
 
Page generated in 0.07983 seconds with 11 queries