Sunday 18 December 2016

A few Commodore 64 images

Here's some Commodore 64 visuals I've been working on recently.


The two snake heads were laid out long time ago, but the detailing and background was done recently. The overall composition was in flux as I kept changing the position of the heads, adding the third blurred head relatively late in the process.

Never thought I'd say this but I feel c64 hires is easier than multicolor. Obviously, the resolution is higher, but importantly, the color choices are always local. With multicolor, you have to decide the overall background color at some point and that choice often has tricky consequences.

Page at CSDb

Lawless of the West:

Another hires. This is an obvious tribute to the Commodore 64 game Law of the West, but it also derives a little from Edvard Munch's Evening on Karl Johan, though not very consciously. Other references: Italian westerns and a bit of McCabe & Mrs. Miller too. The grouping of characters also reminds me of the Italian comic Gli Aristocratici.

I have wanted to use a vanishing point perspective in a C64 pic for some time, and it is quite challenging to both have a sense of space and human characters in the same pic. Even here the people are sort of pasted on front of the background.

Page at CSDb

Hokuto Force logo:

This is a PETSCII character art I made for the group Hokute Force for an Commodore 64 intro coded by Flavioweb. I went for a "metal band style" with some ninja-fic touches.

I'm quite happy how it turned out. Again, character art shows it's force: If this had been a multicolor bitmap, I might not have come up with the idea or been able to follow it through.

In hindsight as I look at the space between the F and the O, the gap should have been maybe a bit narrower... Oh, well.

The way the logo is presented in the intro is a bit different, the above is a compromise between the intended logo and how it works in the intro.

Page at CSDb

Saturday 3 December 2016

6502 notes

I've been dabbling in 6502 machine code for a long time, but only recently started to get a hold of it. My initial touchpoint was the machine code monitor on the Action Replay VI module on the C64 and a battered copy of the Commodore 64 Programmer's Reference I found from a flea market in early 1990s.

Which I obviously still have.
These days, I know a bit more, but certain things are a bit difficult to remember. Here's some.

How the Carry (C) affects the ADC and SBC instructions (and the difference)

For the longest time I did not get this. For additions, carry is cleared (with CLC) and then becomes set if the addition crosses the 255 boundary. The C flag is then carried (duh) over to the next ADC instruction as a +1. With subtraction, it's the reverse: the carry is previously set and then becomes cleared if the subtraction crosses 0. When clear, the SBC #$00 performs a SBC #$01, for example. After this, 16-bit addition and subtraction became easier to understand.

;Incrementing a 16-bit value at $C000-$C001 with ADC

    CLC          ;Clear Carry
    LDA $C000
    ADC #$01     ;if $FF is crossed Carry becomes set
    STA $C000
    LDA $C001
    ADC #$00     ;is like 1 if Carry is set
    STA $C001

;Decrementing a 16-bit value at $C000-$C001 with SBC

    SEC          ;Set Carry
    LDA $C000
    SBC #$01     ;if $FF is crossed Carry becomes clear
    STA $C000
    LDA $C001
    SBC #$00     ;is like 1 if Carry is clear
    STA $C001

When is the Overflow (V) flag set?

This flag is not that useful to me, but I don't want to forget what it does.

As two bytes are added together with ADC, as above, the calculation is at the same time evaluated as unsigned and "signed". If the numbers as "signed" cross a boundary of (-127...128) the overflow will be set.

I've come across a misconception that says "if the 7th bit of the original value and the resulting calculation are different, then the overflow is set."

However, the following will not trigger the overflow flag, even though the 7th bit clearly changes:

    LDA #$FF     ; 0b11111111 (-1) is the original value
    ADC #$02     ; 0b00000010
                 ; 0b00000001 (+1) is the result

I won't go around doing the two's complement explanation, which frankly just makes it more difficult to understand for me. Let's just have a look at how the signed numbers work:

Positive values:

00000000 = 0
00000001 = 1
00000010 = 2
00000011 = 3
00000100 = 4
00001000 = 8
00010000 = 16
00100000 = 32
01000000 = 64
01111111 = 127

The negative numbers have their minus sign bit set:

11111111 = -1
11111110 = -2
11111101 = -3
11111100 = -4
11111011 = -5
11110111 = -9
11101111 = -17
11011111 = -33
10111111 = -65
10000000 = -128

There's no special "signed mode" for the ADC command. Simply, if within the above representation, you do a calculation that crosses over 127, or under -128, the V flag will be set. Just like the C will be used when crossing over 0...255 in the ordinary representation.

So what the above example does is -1+2, which does not cross this boundary any more than 1+2 would set the C flag.

The reformulated rule: "If values with a similar 7th bit are added together, and the 7th bit changes, the V flag is set."

For the most part I don't see the point of the signed-system, as I can usually pretend that 128 or 32768 is the zero point in an unsigned calculation.

Here, have a picture of a silly robot that makes it all easier to understand.

How the Indexed Indirect and Indirect Indexed addressing modes work

Most of these things have no place in fast code, hence I had not really looked at them.

Perhaps the funniest personal discovery was to see that it's possible to point to a 16-bit address using the indirect indexed addressing mode. I did not know the 6502 was capable of doing this so directly (relatively speaking). It's bit like z80's ld (de),a but not really. Because there is no 16-bit register as such, incrementing the address is a matter of using the ADC on the stored value as described in the first topic above.

Usually a memory fill is done effectively with something like this, which would fill the C64 default screen area with a "space".

    LDA #$20
    LDX #$FF
    STA $0400,X
    STA $0500,X
    STA $0600,X
    STA $0700,X
    BNE loop

We can write the start address to a location in a zero page and use the indexed indirect mode to write to the address, at the same time incrementing the stored value with a 16-bit addition.

Some have suggested that the zero-page works as a bunch of additional "registers" for the 6502 and this seems to validate that idea slightly.

(It is extremely slow, though)

    LDA #$04    ;high byte of start address $0400
    STA $11     ;store at zero page
    LDA #$00    ;low byte of start address $0400
    STA $10     ;store at zero page
    LDY #$00    ;we won't change the Y in the following
    LDA #$20    ;fill with ASCII space       
    STA ($10),Y ;write to address stored at zp $10-$11
    CLC         ;clear Carry
    LDA #$01    ;low byte of 16-bit addition
    ADC $10     ;add to low byte

    STA $10
    LDA #$00    ;high byte of 16-bit addition
    ADC $11     ;add to high byte (+Carry)
    STA $11
    CMP #$08    ;are we at $08xx?
    BEQ exit
    JMP loop

When to use BPL, BMI, BCS, BCC branching operations

Some of my earliest code tended to work with BEQ and BNE only. Quite a lot can be achieved with them. The classic loop already used above, works without comparison instructions at all. Besides this, it can make a big speed difference how the '0' is used in data/tables.

    LDX #$0B
    INC $d020
    BNE loop

My first instinct has been to use the BPL and BMI opcodes as they sounded nice and simple: Branch on PLus and Branch on MInus.

However, the BPL/BMI work with the signed interpretation discussed above. Parts of code might work as intended if the numbers happened to be in the +0...127 boundary, which probably confused me in the past.

So the BCC (Branch if Carry Clear) and BCS (Branch if Carry Set) are used instead when dealing with unsigned number comparisons, even if they sound less friendly.

    LDA #$20
    CMP #$21

    LDA #$20
    CMP #$20

    LDA #$20
    CMP #$1F

This ought to branch if the A value is lesser than the one it is compared to:

    LDA #$1F   ; $00-$1F will result in C=0
    CMP #$20
    BCC branch ; (branches in this case)

The next one branches if the A value is equal or greater than the one it is compared to:

    LDA #$20   ; $20-$FF will result in C=1
    CMP #$20
    BCS branch ; (branches in this case)

So, yeah.

Strangely enough many of the webpages and even books about 6502 are incomplete when it comes to explaining in detail what each of the commands do. Even the books might just state that a particular opcode "affects" a certain flag, but may not open up how exactly that flag is affected.

Friday 18 November 2016

Saboteur! remake

How it all began...
I've always been a fan of this atmospheric ninja/industrial espionage game released in the 1980s on ZX Spectrum, Commodore 64 and various other platforms. Now I'm looking at the recent (2015) version of Saboteur! at, from none other than... Clive Townsend, the original author.

Based on Unity/WebGL, it runs happily on a modern browser.  Before I say anything, I'd urge anyone who finds the game working on their computer to simply go and pay the small fee for the full game. Especially all those naughty people who played the original Saboteur games for free back in the day :)

With remakes of old games, I often feel that any changes to the original seem "wrong". Nothing like that here. The original central gameplay is intact. There are simply visual and especially aural improvements that make the experience of revisiting Saboteur more interesting. The game has also been expanded greatly, which I'll discuss below.

There are various options that need some attention before playing seriously. You'll have to sign in to get the full game, but as a bonus you get to save your highscores, achievements and other progress to your online account. As for the options, the game was initially set as "fast", but I found the "normal" speed most satisfying at least for now. The QAOP keyboard controls are satisfactory. The ninja moves with arrow keys too but the QAOP gives a crisper response at least on my computer.

As the game replicates the original, the controls have not been updated in any way. Especially the jumping sections may put off people who are used to more fluid, console-type games.

The menu graphics are all new, high resolution, but the game graphics are Spectrum-like, and boldly so. You can also select C64 colours if they are more to your taste. I wouldn't have blamed the author for changing the graphical style altogether, but it's good to have the ZX Spectrum style pixeling here.

Guess which mode?
Well, there are in fact more graphics modes than the ZX/C64, but they have to be found in-game and they only work in the original warehouse area. Making them work was not 100% obvious, so here goes: After you've found the different "VR goggles" in the expanded game, start a new game from the beginning, then press ESC to get to the expanded graphic mode options.

However, even the ZX and C64 modes are not identical to the originals: there are tiny updates and added detail here and there. The new grenade explosion is pretty mighty.

The New Story

Like many players, I didn't know that blowing up the bomb was not enough to truly complete the mission. The disk has to be retrieved, too. Then it gets interesting. After you think you've completed the mission, there's more to do but I won't say anything about it here in case someone is a newcomer.

...Well, ok. I have to say something. What unfolds is a completely new Saboteur adventure, which is more modern, storyboarded kind of game. There's more to read, for instance, as the ninja communicates with the radio dispatcher, Metal Gear style. The style stays true to the 8-bit limitations, it's just as if the Speccy had a huge amount of memory. Even if I suspect some scenes would not run on a standard Spectrum the effects never go overboard.

We're not in Ninja Kansas anymore
The new area deviates a bit from the "one item held" logic of the original, as you can now possess keys and other quest items. Also, the map is no longer strictly two-dimensional as you can enter from front and back of the screen to different sections of the map. There are quest-oriented sections and then time-based map areas that are more reminiscent of the original Saboteur game. There are also jumping areas that make me pull my hair out in frustration, like I was ten years old playing Jet Set Willy. Maybe I can blame the keyboard here!

There's now more to do, new enemy types and behavior, more switches, keys and moving mechanisms to set and reset. There's also a lot of detail and humor, such as winks and nods to 1980s pop culture, ninja schlock and earlier computer culture. What I appreciate is that all the references are from the period, no internet memes in sight! No doubt we'll get to learn some more about the Saboteur world and how the first game ties to the sequel, the Avenging Angel.

Maybe, just maybe, I would have preferred a more compartmentalized play experience, such as new missions instead of this longer quest. Yet, altogether the new sections are well organized and as you get further you're bound to be obsessed with seeing it all through. Obviously the new material in no way detracts from the original game, which is intact. As with the original, the difficulty levels change the game experience and the map, and I'm looking forward trying to complete the harder modes. If a true Saboteur III appears, this all certainly seems very promising for it!

The game is quite a perfect treat to those who liked the original, and I think those who grew with 8-bit games should find it interesting. More changes might have been needed to win over more new fans, but then again too many changes might have lost that Saboteur charm.

Saboteur at

My thoughts on the Saboteur II remake

Look at the Saboteur SiO

Tuesday 1 November 2016

Jean-Michel Jarre at Helsinki

The doors open...

I always thought that the "computer crowd" in the 1980s perhaps listened proportionally more Jarre, Kraftwerk, Tangerine Dream and Vangelis than the general population. At least in Europe. Well, who knows.

I felt a few words about the Jarre concert yesterday was in order. It was a good, entertaining show. I've never seen Jarre live, so I only knew about the massive concerts in a roundabout way, through TV shows and all.

These circular projections had a laser-like intensity.
This small scale fit Jarre well. The tracks had been transformed into faster, shorter, more trance-like versions, while the visuals were an unrelenting barrage of old-fashioned wireframe vector graphics, geometric shapes, point clouds and realtime video feeds. Jarre played a touchscreen app, a guitar and of course the laser harp, so he was not exactly sitting still behind his gear either. The recent Electronica-collaborations appear to have been helpful for renewing the setlist.

Equinoxe album art was also used for humorous effect.
The stage had been arranged into layers of semi-transparent mobile grids to which the graphics were projected. Some of the sheets were behind the stage and some on the front and sides. This, on occasions, gave a surprisingly three-dimensional feel to the stage. It worked especially well when there was a central object to look at and a cluster of moving tiny objects. (Scene demos, anyone?)

I found it, for this time at least, more interesting than Kraftwerk's recent turn to 3D material, but I can also understand the German quartet would not want their clear-cut images to be split into smithereens.

Guess what? A new Oxygène
On occasions, I felt that some old tracks that on album had good structure and progression had been reduced to almost medley-like appearances in-between altered material. This then led me to think why some tracks were not used, as they could have worked better in new form. For example, Magnetic Fields II (old track) or Téo and Téa (a more recent track) might have fit in this show almost unaltered, yet they were not played at all.

I'm also glad that although Jarre's music has benefited from the back-and-forth influence with the recent electronic music styles, the songs were not altered to the Guetta/Skrillex EDM-dubstep mould.

Sorry about the bit poor photos. I did not even think I'd get the urge to take my camera out so often.

The famous Laser Harp

Saturday 29 October 2016

Johnny Mnemonic and your dad's cyberpunk

Only recently I got to see Johnny Mnemonic (1995), based on the William Gibson short story. Given the bad reputation I found it to be surprisingly nice little film. Surely the acting and directing is not that great, but there's lot of cyber-cheese, inventive sets and visuals. These 1 and 30 minutes pack quite a punch. Thanks to Marq "the Finn" for delivering the goods.

We get to see what Internet is like in 2021:

A lot of man-machine interaction:

Why is the AI always an ethereal female?

Jacking into Cyberspace:

What it amounts to is a glorified Excel? Minority Report, eat your heart out:

Of course, the entities met in Cyberspace are distorted, disembodied heads and generally incomprehensible visuals:

In any Cyberpunk setting, The Rich live classy:

While the poor are left to collect scraps:

Big corporations piss on your humanity. Perhaps a shock to the system is in order:

And that's not nearly all! I wouldn't even think of spoiling some of the best stuff. All in all it's a pretty good visualization of Gibson's universe. It's hardly Blade Runner-quality but an enjoyable treat and possibly the most pure filmatisation of what Cyberpunk meant back in the day.

Sunday 23 October 2016

New Spectrum, New C64?

Recently, there have been some rumors about new models of ZX Spectrum and Commodore 64. Whereas we've lately seen the ZX Spectrum Recreated and the Spectrum Vega /plus game console, the Next promises to be something more like a real computer, like the ZX Evolution. Following the blueprints of C64 Reloaded, Individual Computers seeks to produce both new cases and new stock of the Reloaded. There's also a funding campaign for something called THE 64, which sounds a bit too ambitious to be honest.

Although the new computers would be compatible with their respective originals, they are not exact replicas. And why would they be, really? The world deserves a better C64 and a better Spectrum. Such a project would also open up the possibility for further "cloning" with contemporary means, ensuring the platforms live on.

Anyway, all this made me think, what would I like to see from such a project?

Overall, the new computers could be more flexible for building different types of cases and input/output solutions. The 1980s home computers were notoriously closed products. Many connectors could be made as header pins, and the responsibility for building the less often used connectors would be up to the owner or third parties.

There are two schools of thought about the video output. Others would like a current (hdmi) video output for modern displays, whereas others see old-fashioned monitors and TVs as a must. One possibility is to have modular video output, you'd only get what you need. However it can be a bit of a space-waster really. ZXEvo has it pretty good, a VGA output and then header pins for RGB.

Given this overall idea, below are my wishlists. These are simply fantasy as I can't really plan this type of stuff.

The Fantasy models:

  • Circuitboard footprint that fits in at least some Spectrum model case (preferably the toastrack 128, but maybe +2/+3)
  • A new z80 processor 3,5mHz/7mHz/14mHz
  • 48K-64K base RAM, Memory expansions through the 128K memory model or more as in Russian machines (Evolution).
  • FPGA ULA video generation. Preferably pins for RGB and composite, but also modern hdmi.
  • FPGA YM audio generation. Also a socket for real YM
  • Alterable timing schemes: Russian Pentagon, British Spectrum, something new? (Not sure how to achieve this)
  • SD card reader. I would maybe leave out the floppy controller.
  • First 16K as re-writable/replaceable ROM, or as RAM with write protect.
  • Reasonably compatible zxbus/edge connector pinout
  • Keyboard input pins compatible with the original spectrum, but also USB or at least PS/2
  • Audio jack/pins
  • Joystick pins (sinclair/kempston)
  • Kempston mouse compatible mouse port, maybe USB or at least PS/2

So, quite similar to ZX Evolution really. The major difference is trying to make it fit in smaller space and leave out certain things. I'm not too keen on new display modes, but why not.

If there has to be a new case, borrow ideas from 128K Spectrum or Sinclair QL, but a bit flatter if possible. The QL keys looked cool but I guess they have to go. The Next renders look good but in my opinion round shapes never quite belonged with the Spectrum... What I'm looking at is a keyboard-less case, that could be altered to integrate a keyboard.


  • Original footprint circuit board, preferably short board
  • A new 6502 processor? Does such a thing exist?
  • 64K memory, expansions via the REU standard. Also REU on board, what's the maximum, 16MB?
  • Standard serial port (real 1541, SD2IEC)
  • SD card reader
  • Cartrdige expansion as 100% cartridge-compatible as possible.
  • FPGA SID. Audio generation via SID emulation, also a socket for real SID 8580/6581 or Swinsid
  • FPGA VIC-II. Video generation, preferably both composite/RGB and modern hdmi
  • Joystick ports/pins
  • Commodore mouse compatible mouse port, maybe USB or at least PS/2
  • Keyboard input pins compatible with the original C64, but also USB or at least PS/2
  • Audio jack

The C64 is a tricky thing. With Spectrum, the specs are simple and there's also some precedent for ignoring them. Consider the Russian scene for example, who have very nearly redefined what a ZX Spectrum is. But with Commodore 64, fans would not be satisfied with anything less than a timing-exact, perfect, real thing.

If there's a new case, it would be C64C-style, and forget the original brown breadbox colors. Yes the breadboard is nostalgic but it's a bit too tall and ugly to be honest. With keyboards it's a different thing. Many functioning originals exist so it would be wise to allow using the genuine item. This pretty much then defines the form of the computer. Proper arrow keys would be welcome, though.

Sunday 25 September 2016

The Crappificent Seven *)

Years ago I made a list of Top Westerns movies. Well, now here I have some of the less inspiring western films I've seen.

Some words of warning: There are worse films. These are at least watchable in some way. Yet I hasten to say that for the most part these are not "so bad it's funny good". What do I mean with "watchable?" For example, Blazing Stewardesses (1975) is much worse than anything on this list because I could not bring myself to watch it to the end.

Ok, that's enough, here's the list:

Captain Apache (1971)

A singing Lee Van Cleef in a crappy British faux-spaghetti western. Also, tiresomely brutal and corrupt Mexican revolutionaries etc. What is the mystery of "April Morning"? Ooh, aren't you just dying to know! (Hint: In the end it doesn't even matter)

White Comanche (1968)

As Clint Eastwood ascended from a TV career via European westerns, many were undoubtedly seeking to repeat this success. Here, William Shatner plays two roles in this stupid western made in the heels of better productions. I know what you're thinking, but no, although some laughs can be had here, for the most part it is a dull affair.

But WHICH of them died? Eh? Eh?
Consider two identical half-breed twins, one who lived with the white people and the one with the native Americans.  Does a thoughtful essay on nature and nurture ensue? Well, apparently nature does not so much abhor a vacuum, but redundancy, so a duel inevitably ensues between the two forces. This calls for an ancient Apache ritual... A joust on horseback, with revolvers.

(Trivia: Leonard Nimoy played a western villain in a slightly better film Catlow.)

Lucky Luke (1991 / 2009)

Lucky Luke is such a household name that for a certain generation of Europeans the whole idea of a western is tinted with the humor and caricatures of the Morris and Goscinny comic strip. It's a bit sad that the concept did not result in any good live action films. (Except maybe the Terence Hill flick Man from the East, a rip-off of the LL story The Tenderfoot)

The first tries to translate pick'n'mix elements from the comic book too directly to the screen, whereas the 2009 version attempts to cram every possible meta-reference about Lucky Luke and western cinema into one film. Luke is also given a totally unsuitable tragic "origin story" and the makers tried very hard to be post-modern. They succeeded.

I think it's pretty safe to say that Les Daltons from 2004 is not too good either, but I've not seen it (yet). Edit: I have seen it – it's not too good.

Trinity and Sartana (1972)

As a rule of thumb a prolonged "barfight scene" is a good indicator of a poor-mediocre western (as opposed to just some minor violent exchange in the saloon). Well, this film climaxes with a ten minute bar fight scene at the end, and man, isn't it comedic.

Trinity and Sartana were well established names in their own official and unofficial movies, here the names are exploited for something that has nothing to do with either. Trinity is really "Trinidad", while Sartana, who looks more like actual Trinity, does some acrobatic tricks.

Apache Blood (1975)

Frankly I can recollect almost nothing about this borefest with poor editing and disjointed scenes. On second thoughts, I might have been watching Andy Warhol's Lonesome Cowboys. 

Yes, it's bad to the point I was wondering if it was really supposed to be an art film.

Django's Cut Price Corpses (1971)

Aka. A Pistol for Django.

Well, it might be said that as a rule of thumb any unofficial "Django" movie that isn't the original Django, Django Kill! or Django Unchained, could compete for inclusion in a list of bad westerns. I wouldn't go so far, as some "Djangos" are quite reasonable. This one's pretty stupid, though.

There's a guy who does not look or behave like Django at all, the plotline is quite incompatible with anything we know about Django, and overall it doesn't make much sense. The twist ending makes the Django-premise even less credible. (It's of the "he planned it all beforehand" variety)

Left: From the bottom of the barrel, Right: Poetic justice.
There's a group of Mexican brothers and one sister (no great spoiler there, it's very apparent she's a woman) who all seem to be inadequate at accomplishing anything. Notably the film has quite many woman characters for a western, but this simply means a lot of women getting slapped on the face or otherwise mistreated.

Tex and the Lord of the Deep (1985)

The idea of western characters encountering an ancient pre-columbian mystery is not that bad, but nothing good comes out of it here.

I've always considered Tex Willer to be dry reading, but here the filmmakers have really been able to expand on that quality: there's a lot of time-wasting and all the sets are very lackluster. The same lethargic tune seems to play throughout, and any craftsmanship that made Italian westerns interesting seems to have been forgotten.

Only the guy dying from the super-poison is a relatively interesting special effect, and spaghetti-veteran William Berger makes a passable Kit Carson, not that the role involves much more than having a beard.

Dead Men Don't Make Shadows (1970)

Also known as The Stranger that Kneels Beside the Shadow of a Corpse.

Demofilo Fidani is sometimes regarded as the Ed Wood of Spaghetti Westerns, so I'm saying nothing new here. To be fair, there are some nice scenes and the consistently low-budget surroundings even helps lend an aura of originality. Yet with Fidani the general editing and cinematic storytelling is rather abysmal, and instead of having artistic merit they tend to evoke a feeling of "what the hell did I just watch?".

In some mysterious way person grows wiser through watching Fidani westerns, so perhaps they are not all bad.

Hey, it can look interesting occasionally. But the main character there, is almost as expressive as he gets.
Here, the first 10 minutes of initial happenings all look and sound like the title scene: some guy rides in the wilderness, and then arrives at a western town, accompanied with dull background music. Dramatic zooms into Wanted-posters abound.

Django and Sartana are coming... It's the End (1970)

(It's "Django Defies Sartana" in my box set, a whole different film holds that title.)

Another Fidani film. Let's cap this up in some more detail:

Fidani's trademark seems to be long, wandering sequences that clearly explicate how the hero travels through the landscape, riding on horseback. In a striking contrast to this meticulous attention to detail, it's nigh on impossible to get any clarity on who's actually travelling and where to.

A woman gets kidnapped. The ranch hands, almost a full minute into the attack, are still carrying barrels and baskets when they are cruelly shot down.

When the ransom note appears on the door, the voiceover reads it, including the signature followed with a laughter. "...Burt Kelly. Brahahaha!"

Well, moments after, both Sartana and Django seem to be after the kidnapper. After meeting a frog and an old shivering man in a ghost town.

Dramatic zooms into Wanted-posters abound.

The villain is clearly insane, as they tend to be in Italian westerns. (He lives in a kind of a tepee inside his house.) His shtick is playing cards in front of the mirror, and the joke is that the mirror image "cheats".

Also, the villains, although they have no reason at all to spare Django's or Sartana's life, never kill them when they might have the opportunity.

In the shootout at the end, for the most part the villains proactively make enormous leaps just before they are shot, in order to fall spectacularly for no particular reason.

One Damned Day at Dawn... Django meets Sartana from the same director is also a contender.

Terror of Tiny Town (1938)

You'd be forgiven for thinking that a Western film populated entirely with midgets would be hilariously non-PC and camp, but in fact it is endlessly boring. The camera scans the little people on eye-level anyway, and the sets are mostly built to scale, so the impression of their smallness diminishes and what the viewer is left with is - and I must apologize - some malformed cowboys.

White Fang and the Hunter (1975)

This is the sequel n to the White Fang films, which I suppose have some tenuous connection to Jack London books.

Just some Joseph looking for a manger... It's not there
The titular dog gets little screen time in this film. Mostly we are subjected to the antics of a venerated spaghetti sidekick Ignazio Spalla, who plays a drunken old fart. The joke is that he drinks a lot of booze, and that's the joke. He usually responds to everything with a "blaarh", or "arrr..?" with pouted lips and a surprised look on his face. Then he marries an indian old maid and they both get drunk, rolling around in a snowy dirt ditch. Then railroad something-something, forced marriage, fake priest, a bar fight, the end.

The Outlaw (1943)

Some seem to think this is a reasonable movie, so I may be in the wrong here. The film depicts an unlikely meeting between Doc Holliday, Billy the Kid and Pat Garrett. They are so removed from any historical (or legendary) depictions of them, sometimes I feel these are just three guys who happen to have those names by accident.

Some unintentional surrealism and absurd scenes here and there seem to portend more unconventional westerns to come, but I just can't care at all.

I guess the film was considered somewhat daring or even "naughty" in it's time, and echoes of this reputation may have made the film more well-known than it deserves to be. Jane Russell is hardly as "prominent" in the film as in the posters & promo stills.

It Can be Done Amigo (1972)

Somewhere in El Crapo, Texas... A cute idea: Jack Palance tries to force-wed his pregnant sister (or whatever, can't remember) to Bud Spencer, who does not fancy her at all. And when Bud Spencer does not get along with someone, you know what he can be like.

Two actors relying on heavy mannerisms can't quite carry it through. Spencer frowns and head-butts his way through the movie, whereas Palance mostly lies down, seemingly recovering from a hangover or something worse.

The pinnacle of jokes is the end where Spencer apparently finally beats up the woman. Ha, ha.

I have a pretty big soft spot for Bud Spencer movies, may he Rest in Peace, but here, no.

Bonus: Frisco Kid (1979)

It's one thing to point out failures in small productions, and perhaps not too fair either. But when a large cinematic production goes awry, it's a different order altogether. Using this metric, Frisco Kid might be the worst western film ever.

Again, it's not a bad idea, a Jewish Rabbi traveling through the old west. However, two hours are wasted in prolonged sketches and vignettes, possibly aiming at some kind of muted, subtle humor.

Sad to see Gene Wilder (Rest in Peace him too), who did a good job in Young Frankenstein and Sherlock Holmes' Smarter Brother, plod through this useless material.

*) Yes there are more than seven

Friday 16 September 2016

Y NO Z80+editable chars?

Mode Z80 Non-Z80 (6502, 6800)
Memory Mapped
Character Display
Enterprise, Sharp MZ series, Aquarius, Laser 200 VIC-20, C64, Panasonic JR200, Atari 8-bit, Commodore Plus/4, Oric Atmos
Memory Mapped
Character Set
Enterprise, Sharp MZ-800(?) VIC-20, C64, Panasonic JR200, Atari 8-bit, Commodore Plus/4, Oric Atmos
Memory Mapped
Bitmap Mode
Enterprise, ZX Spectrum, Amstrad, ZX81, SAM Coupé, Sharp MZ VIC-20, C64, Panasonic JR200, Atari 8-bit,, Commodore Plus/4, Oric Atmos
VDP MSX 1/2, Sega SC-3000, Coleco Adam, Memotech MTX, Tatung Einstein

Character displays proved to be very effective for 8-bit computers. Intuitive to program, less wasteful of memory and with high potential for optimizing graphics for your chosen approach.
loop:INC $0400,X;INC $0500,X;INC $0600,X;INC $0700,X;INX;JMP loop
What the above table highlights is that there seem to be very few computers combining the Z80 processor with a memory mapped character display with editable character set. I've only heard that Enterprise, the swansong of the 8-bit era, might have such modes. Sharp MZ-800 has something called the Programmable Character Generator, which I think does the trick too. I'm pretty sure that another latecomer, SAM Coupé, does not have a true text mode. The point is that none of the popular Z80 computers had the feature.

Some websites list Sinclair-style pseudo-text bitmap modes as "text modes" too, so it can be confusing. The accurate distinction between pseudo-text, fixed character set modes and fully editable character set modes is not made often enough.

Why were there so few Z80-based memory mapped character graphics? Surely, if the 6502 can whizz user-defined characters around the screen, the Z80 could whizz considerably more?

I don't know. Maybe the engineers thought the Z80 was in any case powerful enough to handle bitmap graphics (a very marketable feature back then). Or, there may be some bus-architectural reason why combining Z80 with a sophisticated character display would be difficult or result in something that brings complications for the programmer or additional contentions with the other chips. I'm especially wondering this as there are Z80-computers with a char display (Aquarius, Sharp series, Laser) but without editable characters. A full 256-character set would have eaten 2K of RAM though.

In the table I've also included some VDP-based computers. It was close to being a standard solution and one can suppose at some point it was easier to design a Z80+VDP computer than start creating new video chips. There seem to be no 6502+VDP computers either, which might have been a poor combo.

Monday 1 August 2016

The great MSX aspect ratio swindle

Edit: The whole text is a bit silly because I did not use Screenmode 2 on the MSX, which makes the screen wider. I still think the "method" may be of interest, hoping I can some day do this better.

I photographed the screen of Commodore 64, MSX (Toshiba HX-109, Commodore 64 (Beige, not sure of exact issue) and ZX Spectrum (Issue 2) from the same position, using the same display, a Sony from late 1980s (or early 1990s). All outputs are composite. The C64 has a clear border from the boot-up, on the MSX I inserted some characters in crucial positions. With the Spectrum I used a routine for filling the attribute memory, as the BASIC does not easily allow setting the true border color.

The inspiration came from this blog post. There's a tendency to portray MSX pictures and videos on the web with a ratio that is not very true to life. But are then MSX screens radically different in shape compared to Spectrum screens?

In the following I simply overlay the photographs using GIMP layering and opacity. The pics are of horrible quality, but at least they are from the same position. What I like about this "visual method" is that I'm not asking what is the "real" specified aspect ratio of the computer output, but how the C64, Spectrum and MSX aspect ratios relate to each other on a real hardware.

Of course this leaves out the possibility that different displays react differently to the video output, which might result in exaggerated or diminished difference, who knows. Some monitors had easy access to adjusting the horizontal and vertical stretching, muddling the issue a bit further.

Well, off to the comparisons.

Overlaying the Spectrum and MSX images reveals a difference. Though the images are obviously of the same height (the spectrum image starting and ending a bit before the MSX one), the Spectrum is clearly narrower.

Overlaying Spectrum and MSX screen on GIMP. (Spectrum is the light rectangle)
Comparing the C64 and MSX is a bit trickier as they do not have the same pixel resolution. So whereas the screen shape is pretty similar between the two, C64 has 320x200 whereas MSX and Spectrum have a 256x192 resolution. From the screenshot it's quite clear the C64 has 8 pixel lines "above" where the MSX screen starts.

Commodore 64 and MSX screen overlayed. C64 screen is indicated by the dark blue area.

Here's the C64/Spectrum overlay. There's 64 pixels more horizontal resolution to c64, which shows roughly as a four-character width difference between the screens. Edit: Previously I thought the 4 characters corresponded with the 64 pixels, but this was a thought error. (8 characters would do.) So the pixel aspect ratios are a bit different.

Spectrum and C64 screens overlayed. Spectrum is again the light rectangle.

Ok, and then, all together. Red is Spectrum, Green is MSX, Yellow is C64.
Edit: in MSX Screenmode 2 (basically all the games) the green box would extend very near to the right border and slightly over the left border.

I also used GIMP rectangles to approximately calculate the screen proportions from the images, but this is less valuable because the photographs are distorted.

Spectrum: 1,45 (256 x 192)
MSX: 1,67 (256 x 192)
C64: 1,58 (320 x 200)

What follows is not true in any absolute sense, but if the Spectrum screen is like the black box above, then in comparison to that, the MSX screen (mode 0, 240x192) appears as the one below:

Saturday 23 July 2016

Fort Django

A little reflection on the making of a Commodore 64 game. It's the first C64 machine-code game project I've really finished. All right, it was made with cc65 C with inline assembler but what I mean it's not made in BASIC. Significantly, it's the first 8-bit game I've made public in some way.

I guess making an 8-bit game is something I would have liked to do for a long time. Fort Django was started in 2014, and after a long pause I found the energy to make it into a release.

The game

You guide the character with a joystick in port 2. You can run, climb, crouch, jump and shoot. Shoot down the baddies, collect money bags and find the exit. The descending bonus timer means the faster you can collect the next bag the more $ you can get.

The game is very short and not at all hard. The only challenge comes from trying to be faster, for example it's possible to break the $10000 barrier on completion.

Get that bag, shoot that baddie
Inspired by Saboteur! from Durell, I at first thought about making a beat 'em up oriented game. As I needed to scale down the project I found it would be simpler to turn the game into a shooter with a western theme. The map is very small, but then again I like short games such as Saboteur! and Bruce Lee, as they have a strange kind of replay value. Much like with Saboteur!, I wanted to ensure there was a definite ending to the game and score could not be milked forever.

Making of

I created the game with cc65 C compiler, using inline-assembler for speed critical parts such as the sprite routines. The C64 has eight sprites, eight 8-bit addresses for the horizontal coordinate (0-255) and one address that holds the highest bits for all the X coordinates, so the sprites can also reach the right hand part of the screen. (256-320)

For a beginner it can be a bit tricky to decode these 9-bit sprite coordinates, especially in pure assembler. I have eight separate 16-bit memory locations for storing the X coordinates. These are then broken down into the hardware sprite coordinate values. This approach is a compromise between ease of use and speed.

The figure below shows how the 16-bit X coordinates are stored in $C000/$C001, $C008/$C009, $C010/$C018 byte pairs (the grey stuff in the middle). The less significant byte of these 16-bit values can be copied directly to the $D000, $D002, $D004... but the high bit is taken from the lowest bit of the most significant byte of the 16-bit values and combined into a value that is stored in $D010.

This is done once in a frame, so the high-bit issue can be forgotten in other parts of the code. The handiness of this is only really apparent in C, where you can then move the sprite x coordinate around with:


Comparisons between coordinates become easier, too.  This checks if sprite 7 is right of the sprite 0:


Basically all the "collision detection" is built from this type of statements instead of the hardware sprite collision address, and as such is not pixel perfect. In these box-collision cases it's better to be lenient toward the player and a bit biased against the enemies.

The "16-bit" coordinate ought not to exceed 511, because only one bit is taken from the more significant byte.

The sprite Y coordinates are 8-bit values anyway and can be handled directly with the $D001, $D003, $D005... hardware addresses.

The whole X coordinate copying is achieved with the code below, starting from the less significant byte copying and ending with the high-bit construction. Obviously other locations than $C000- can be used for the coordinate storage.

     lda $C038
     sta $D00E
     lda $C030
     sta $D00C
     lda $C028
     sta $D00A
     lda $C020
     sta $D008
     lda $C018
     sta $D006
     lda $C010
     sta $D004
     lda $C008
     sta $D002
     lda $C000
     sta $D000

     lda $C039
     rol a
     ora $C031
     rol a
     ora $C029
     rol a
     ora $C021
     rol a
     ora $C019
     rol a
     ora $C011
     rol a
     ora $C009
     rol a
     ora $C001
     sta $D010

This is a starting point for a fairly generic solution, but of course it can be adapted for any particular needs. For example, the top sprite coordinates of the dudes in the game are copied and transformed from the bottom part coordinates, which changes the above routine a bit. Also, if less sprites are used why bother going through all the eight?

About the graphics

The graphics are made with PETSCII editor. Not only the background tiles, but the game map and even the sprites have been edited there. It goes to show that the PETSCII editor multiframe-editing is surprisingly powerful way for controlling this type of game "assets".
The game map tiles.
Another PETSCII screen was wasted for defining the movement rules for the above tiles. These are used for building a movement table every time the player enters a room, just as the room is drawn from tiles. How all these sprite, tile and movement table elements exactly relate to each other is a bit too intense to explain here, especially as they are not that well thought out.
The tile movement rules. @=space, A=block, B=platform, C=ladder
The map was also edited in the PETSCII editor. The 40x25 area is divided into 5x3 tile elements, giving 64 simple screens. Coloring indicates enemies and money bags. Not everything is absolutely visible in the picture below, as some spaces can be "colored" too. The game engine allows only certain combinations and positions for the enemies and objects.
The game map.
The map memory area is also used for indicating whether objects or enemies are removed, from the 1 (white=enemy) and 2(red=bag) status into 255 and 254. After the game is over these are changed back into 1 and 2.

Editing a multicolor sprite in PETSCII editor. The sprite export is not a standard feature!

What next?

I dropped many game elements I toyed with at some point. For instance, the chests could have contained items, and the doors could have potentially led to other areas in the fort.

The gold bags were a fairly late addition when I felt that only shooting bad guys would be far too minimal. From adding the bags it was a small leap to increase the jumping elements in the game. The bags also inspired the time-based "bonus dollars" mechanic. Still there might have been a bit more to do.

Code-wise, a music routine would have been nice but in the beginning I was a bit scared to sync the animation with a music interrupt. The sound effects are also sparse due to my inexperience with SID.

Yet, all additions would have also expanded the complexity of the game and the testing time exponentially. I'm glad I could finish it as it is. With this experience I already have some ideas about how to approach this type of project better.


You'll need a Commodore 64 or an emulator to play the game.

Fort Django v1.1 at CSDb
Read the blog post about the v1.1

1.0 (older version):
Direct download
Alternative link
Page at CSDb
A cracked version in a T64 format