Skip to content
Game 1 Unit 6 of 6 1 hr learning time

Sunset

Two registers set the hour. POKE the background for the sky and the border for the frame, add a soft SID tone as each tower tops out, and the black screen becomes a city at dusk — your finished Skyline.

100% of Skyline

The city is built and the windows are lit, but it stands on a black screen at no particular hour. Two registers change that: one for the sky behind the towers, one for the border around them. Set them, and the whole mood turns. Add a soft tone as each tower tops out, and Skyline is finished.

10 PRINT CHR$(147)
20 POKE 53280,0:POKE 53281,6
30 POKE 54296,15
40 FOR C=2 TO 38 STEP 4
50 H=INT(RND(1)*12)+5
60 FOR R=24 TO 24-H+1 STEP -1
70 POKE 1024+R*40+C,160
80 CO=12
90 IF RND(1)<.4 THEN CO=7
100 POKE 55296+R*40+C,CO
110 NEXT R
120 GOSUB 200
130 NEXT C
140 END
200 POKE 54273,40:POKE 54272,0
210 POKE 54277,0:POKE 54278,240
220 POKE 54276,17
230 FOR T=1 TO 30:NEXT T
240 POKE 54276,16
250 RETURN
A C64 cityscape at dusk: grey tower silhouettes of varied heights against a midnight-blue sky, scattered with yellow lit windows.
Two POKEs make the hour: a midnight-blue sky behind the towers, a black border around it. The same city, now at dusk.

Line 20 does the mood in one breath: POKE 53281, 6 paints the background — the sky behind every tower — midnight blue, and POKE 53280, 0 sets the border black. Those two addresses are worth memorising; nearly every C64 program sets them in its first few lines to choose the screen it lives on.

The rest is the subroutine at line 200, called once per tower by the GOSUB at line 120. It plays a short note on the SID — volume set once at line 30, then a triangle tone gated on and off — so the city chimes as each tower tops out. It's the same SID you met in the primer, here doing one small job: a sound to mark a moment.

That's Skyline. From one block placed by address to a self-composing city at dusk — every part of it characters and colour POKEd straight to the screen, the way every C64 game draws.

Try this

  • Change the hour. Try POKE 53281, 11 (dark grey, an overcast city) or POKE 53281, 0 with a POKE 53280, 6 border for deep night. Three pairs, three times of day.
  • Make it yours. Widen the streets, raise the towers, change the window colour, retune the chime — until it's a skyline you'd put your name to.

What's next

You've written a complete C64 program that draws itself. Next in Volume 1 comes Oracle — the machine stops drawing and starts answering, as you meet RND as a decision-maker and arrays as a memory of choices.