this was published in Vandalism News #43 /gpz
instead of an essay….
I was long thinking about writing a tutorial about coding, and the (obviously) real bad demos at ms99 finally kicked me to write something about all the little things that were discovered over the last decade of the scene. this beginning series of tutorials wont help you with learning 6502 assembly, and i will assume that you know certain basics. it'll bore the majority i guess, if i started with 'hello world' type stuff and explain the differences about 'OR' and 'AND'. You should know about handling your favourite assembler or monitor and should have a memory-map handy for reference, when it comes to advanced shit in later issues. Beeing able to knock up a well done intro should be a good level - If you wanna learn how to display a sprite in ml, or how to play a tune in irq, i'd advice you to get some decent book or other docs, or better, ask some other lazy scener
Instead it'll tell you lots of cheap tricks to make your lame code look like 31337 demos and let you win all major compos the next decade of the scene. (rotfl)
honestly, i had this wild dream of 2nd generation 14 years old c64 enthusiasts which squeze their first intro out of turbo-asm (you lucky bastards, can you imagine that most of the old legendary code was made in a ml-monitor?) and which dream of making a nice demo. I have seen a lot of 'unknown' ppl releasing at ms99 lately, and if i can just make one of the upcoming demos better, all the effort will be worth it.
so here it is…
This time i will just quickly tell you about what i consider known as 'junkmodes', that is basically the 8×8 and 4×4 based stuff that doesnt need any fld/fli based routine to be displayed. Now don't cry NOOO! we dont want this crap, but also if you dont like it you should get the basic idea since a lot of the more advanced stuff later will need a certain understanding of this shit.
These modes seem to be liked by the coders, since they are basically much easier to handle and thus also perform much better than for eg hires. Even if these modes have the obvious drawback of very low resolution and (if not handled clever) bad flicker in interlaced variations, they can be used for quite a bit of nice effects. (But please do me a favour and dont do yet another plasma!)
please notice that incase i speak of 'pixels' i may mostly refer to the 8×8, 4×4 or whatever pixel wide 'area' that is used to represent the smallest 'independent' square in the choosen mode.
these modes basically use the videoram for pixel data and do not use the color-ram at all. I've silently 'forgotten' to mention the 8×8 char mode (16 cols) you may use by filling the videoram by some char and using color-ram for your fx. This crap rarely looks even 'good enough' so just forget about it
1) 8×8 - Characters (40×25, 256 'patterns')
this is maybe the easiest, and most speedy gfx mode that is possible. it is done by using a charset that either consists of an 'animation' that is 256 steps long (for eg a jumping dot, a spinning quadrangle or sth, whatever… use your stoned brain to create sth that looks freaky or you have sort of 'colorfade' with semi-randomly setted pixels.
2) 8×8 - Bitmap (40×25, 128 'colors')
this mode uses a bitmap with a 'checkerboard' pattern, so beeing able to display one of 128 'mixed' colors in a 8×8 area by writing 2 colors to high and lowbyte of the matching videoram position.
3) 4×4 - Characters (80×50, 4 'colors')
This is a good compromise between speed and resolution, and quite useable for routines that would be to slow in 4×4-fli mode. It is achieved by using a character-set that represents all 256 combinations of 4×4 wide blocks possible in a cursor with 4 colors. The adressing can be compared with hires a little, if you arrange your charset that for eg. bit0-1 represent color 0, bit2-3 represent color 1, etc… you get the idea
4) 8×4 - Bitmap (40×50, 16 'colors') / 4×8 - Bitmap (80×25, 16 'colors')
Since in this modes 'pixels' are not squared, they usually dont look to well imho, but still it may be worth a try. These work with a bitmap that consists of 8×4 pixel wide 'blocks' (either vertical or horizontal) made of alternating multi-color bit-patterns (eg fill bitmap with $5a for vertical version). with this you will double resolution on one axis with the drawback of a bit more complicated pixel and color adressing and a slightly strange appearance to the eye.
1) faked resolution interlace
this is what most coders seem to add to their junkmode routines, that is simply alternating the softscroll register(s) each frame half a 'pixel' width to smoothen the ugly fat pixels. this habit is mostly the reason for those effects looking so bad and flickering like hell, so *please* think twice before doing it - and IF you use it, use clever colors that do mix very well so you get minimum flicker. (colors with matching luminance are said to work well in that case *G*)
2) color interlace
this uses two alternating videorams in order to 'mix' those. with clever colortables you will be able to use quite a lot of colors that dont flicker to much (luminances do the trick again). notice this works also with the charset-modes to get 'mixed' patterns. itll need a bit of additional code maybe to update the second videoram, but not that much.
3) 'real' resolution interlace
this uses two videorams, which are displayed alternating but with an offset of half a 'pixel' width (in the direction at which you wanna gain resolution). This will look much better than the faked thing, but it will also require to calculate the double amount of 'pixels' and so prolly take twice as much time to calculate a full frame. nevertheless if your fx is really fast, this is what you really should try.
why not using the color-ram you may think, and you are right! BUT: think first if it will really make sence in your situation. Using the coloram will maybe give you some more flexibility, let you use some more colors or even let you overlay a totally different second effect that just works in colorram, but the additional code needed to handle it will also slow down everything, and in the worst case make your effect look worse than before.
luminance is the 'brightness' portion of a color that is beeing displayed by your monitor. Also, if you connect a color-source to a black/white monitor or tv-set, the picture is made of the luminance values.
1) 0 black 2a) 6,9 blue, brown 2b) 2,11 red, dark grey 3a) 4,8 violet, orange 3b) 12,14 middle grey, light blue 3c) 5,10 green, light red 4a) 3,15 cyan, light grey 4b) 7,13 yellow, light green 5) 1 white
so far so good… hope you liked this little start a bit, and you found a little also that isnt just old news for you. however, i had to start *somewhere* … so, you ask what will maybe come next, and i'll tell you… before i'll go on with “grafix modes 2” (all c64 'standard' modes, hires and multicolor bitmap/sprites/charsets etc) i will give you some insight to “gaining speed - learn how screen-buffering becomes your best friend” (all about single, doubble and tripple buffering) which will be just the consequence to follow-up the previous tutorial. After all that we will come to “what was fld again?” (cookbook for fld/fli routines)“ which will lead us to “grafix modes 3” (last not least telling you about all those with an fld/fli-type of display-routine). At this point, we'll see what comes up next, i am thinking of both some more technical crap (inside irq/nmi, hacking $d011) as well as coding-style (self-generating/-modifying code, unrolled loops vs zeropage code) and maybe also some shit dedicated to specific demo-fx (wanna know how plasma worx? hehe).
so long… code your ass off!
groepaz/hitmen, april, 26th, 1999 email@example.com (feedback welcomed!)
… the C=ommunity loves you!