One of the great memories I have is the hours and hours of programming the commodore 64. At first in Basic and after some time in assembler. At first I typed in some basic programs as they where published in several computer magazines. You needed to type them in and store them on tape. Lately I was looking for the smaller programs called one-liners. Small programs that only required a few to just one line of code. As the line length only allows 80 characters including the line-number this was a challenge. Some tricks could be used like shortening the commands to save characters. For example “print” could be replaced by “?”. And the special commodore characters could also be used to create special effects. 

On this page I collected some of the one-liners that I created or found in the magazines, or internet. Hard to determine the first publisher as many variations sometimes are out there. But if you think you where the first let me know and I put you name to it. 

Note: Most examples below can be really shortened using the basic abbreviations (see : here but for convenience and readability I used the char values or just splitted the commands on multiple lines so you van copy them easily). See for the control characters the overview defined here, great resources. 

Name: “Flower”

This miniature Basic program is defined using two basic code lines. I started with a one-liner only could not fit the code to realize random colorization  in one line . 


The actual miniature Basic code as typed in on the commodore you see here below.

Name: “Sinus”

I created this oneliner after I saw a demo on a plot function added to the Basic interpreter. I was thinking this is something I needed to try just using the standard functions. 

The actual one-line miniature Basic code as typed in on the commodore you see here below. It just fit up to the last character possible. 

To have more understanding on the oneliner I also have the more readable version here that can be copied directly into the vice commodore emulator if you want. 

10 for n=0 to 3*3.1415step0.05
20 x=int(4.2*n):y=int(12*sin(n))
25 o=y*40+x+(12*40):poke1024+o,81:poke55296+o,1
30 next n

Name: “10 print

Background: This is I think one of the most known one-liner. It even has a real book written about it. This can be found here (

10 print chr$(109+int(rnd(1)*2));:goto 10

Name: “Colour snake

Background: I just played a bit with the Petscii cursor characters and the random function. The below code can be shorted using the Petscii characters, but for ease of copy here using the chr values.

And a longer version that is more easy to copy or type in. 

0 c$=chr$(145)+chr$(157)+chr$(29)+chr$(17):print chr$(147)
1 printchr$(113)+chr$(157);:fort=1to50:next:poke646,rnd(.)*256
2 print chr$(18)+” “+chr$(146)+chr$(157)+mid$(c$,rnd(1)*4+1,1);:goto1

Name: “Christmas Tree”

Background: Just a for the fun of it, a first try after 40 years.

1?chr$(147):k$=””:b$=””:s$=” “:fort=1to10:k$=k$+”*”:b$=b$+”**”
2?s$+k$:?left$(s$,len(s$)-t)+b$:next t:?left$(s$,len(s$)-1)+”***”

Name: “Simple geometric pattern

Background: This I found on the internet ( here) from basic-fieserwolf (Needed to google a bit how to type the “Pi” character in Vice. (ctrl+page-down, in low character mode) just that you know it. So you can shorten it to one-line is you use the Petscii characters.

And a longer version that is more easy to copy or type in. 

2 poke646,a+9:printchr$(18)+chr$(a+190); :next: y=y+1:goto1

Name: “pixel screen scroll”

Background: Show a use of the wait command and the register 53265 to create a pixel scroll. 

10 ?chr$(147):poke53280,6:poke53281,1:for l=1024to2023:pokel,123:nextl
30 forl=0to7:wait53265,128:poke53265,(peek(53265)and240)or7-l:poke53270,l:next

40 goto 30

Name: “Color bars – simple

Name Color bars – simple
Very simple example using the 16 available colors

10forx=.to15:poke646,x:fory=.to39:printchr$(18)+” “;:nexty,x

Name: “Waves”

Background: Lot’s of variants available on the internet , here an simple example of it. First a multiline version which is more easy to copy into the vice Commudore 64 emulator. Second the oneliner as show in the above video.

10 ?chr$(175)+chr$(114)+chr$(102)+chr$(96)+chr$(100)+chr$(101)+chr$(183);
20 ?chr$(101)+chr$(100)+chr$(96)+chr$(102)+chr$(114)+chr$(175);
30 goto 10

Second the oneliner example. In order to type this directly in on a Commodore 64 computer and use the Petscii characters you need to use key combinations. So in the below code don’t type it literally. For example {C= + P} means press the commodore key,

10 print “{C= + P} + {Shift + RFCDE} + {C=+Y} + {SHIFT+ EDCFR} + {C= + P}”;:goto 10

Whereby {C=+P} means : hold the commodore key in combination with the “P”
and {Shift + …} means: hold the shift-key while pressing the letters

Name: “Text Scroller”

Background: Uses the poke commands to position the cursor on a certain row and line in the text screen. 

10 ?chr$(147);:r=10:poke214,r:?:poke211,0:?”just for the fun of it”
20 poke1103+(r*40),peek(1064+(r*40)):poke214,r:?:poke211,1:?chr$(20)
40 for j=0to50:next:goto 20

Name: “Boogie Woogie”

Background: inspired on the Modriaan painting. Making use of the positioning cursor row and column on screen poke.

10 ?chr$(147):c$=”026″:poke53281,1:poke53280,0
15 s$=chr$(161)+chr$(162)+chr$(169)+chr$(182)+chr$(127)+” “

20 poke214,(rnd(.)*22):?:poke211,(rnd(1)*40):?mid$(s$,int(rnd(1)*6+1),1)
30 poke646,val(mid$(c$,int(rnd(1)*3+1),1)): goto 20

Name: “Full arcade (”)

As you can see using the short codes it is exactly oneline of code, even one space left. When you type list the following code will show.

This one is really special. I had heard of it but could not find the actual source of it until recently I discovered that it had his own web-site with a very appropriate name, namely:

It is a real one-liner fully playable game with stars and spaceship (ok, you need some imagination). You control the ship using the number “1” and “9” keys. I first tried it in Vice, but to be able to play you need to slowdown the game a bit, it is to fast.

It uses every basic abbreviation that is possible. You can read on this here. It took me a few moments to figure them out to see what I needed to type in to get it working.

This is really a master-piece of work.


Name: “Boogie Woogie 2.0″

Background: Second try inspired on the Modriaan painting this time I created the dimond shape. In order to get this result I needed to refresh some of the Math knowledge.. 

2if int(0.5*x+y-10)*int(-0.5*x+y+10)>=0 and y<=10 then a=1
3if int(-0.5*x+y-10)*int(0.5*x+y-30)>=0 and y>=10 then a=1
5 pO214,y:?:pO211,x:?t$;:next: y=y+1:if y>=21 then y=0
6 goto1

Name: Border change in Basic

You can copy the code below if you want to test it in Vice the commodore 64 emulator. 

0 q=53265:w=128:b=53280:wAq,w:pOb,1:pOb,2:pOb,3:pOb,4:pOb,5:pOb,6:gO0

Name: “Birds fly”

Using different technicues a nice oneliner is created here. You can move the bird from left to right using the keys 1 and 2. In de code below ensure that the “S” in the last part is actually the clear screen ({shift{+{home} keys). 


The actual oneliner code as typed in on the commodore you see here below.

Name: “Laser color bars

This oneliner shows the use of the screen memory and color memory in combination with the poke command to put a character and color on a certain location on the screen. The position is calculated from top to bottom. This is all done in just one single line of code. This is done by entering the commands using the shortcodes as mentioned before. 


The actual oneliner code as typed in on the commodore you see here below.

Geen reacties

Geef een antwoord

Het e-mailadres wordt niet gepubliceerd.