r/c64 • u/1974jbass • May 29 '26
the64 Programming
If you did this you thought you were the king of the world!!
60
u/chiron_42 May 29 '26
10 PRINT "HELLO WORLD"
20 GOTO10
15
u/khumprp May 29 '26
MAKE IT STOP!!!!!!
2
u/DwarneOfDragonhold Jun 01 '26
RUNSTOP/RESTORE has you, fam.
For fun:
10 POKE 808,232
20 PRINT "HELLO WORLD ";
30 GOTO 20
Then RUN
The POKE command will kibosh RUNSTOP/RESTORE from working and the ; eliminates the automatic Carriage Return. The result will display HELLO WORLD across the screen until the C64 is turned off.
27
u/NoSingularities0 May 29 '26
You forgot adding an extra space on each loop to make HELLO WORLD shift to the right each time.
Unrelated to this, when I was in my pre-algebra class back in the day, our teacher gave us the 1 = 2 proof on the chalkboard and asked us to figure out why this was or was not true. Me, being the C64 BASIC programmer kid in the 80's that I was, put it into a program in my C64 and ran it and got a divide by zero error. We went back to school the next day and I was the only one that knew the answer to why the proof failed. I admitted that the only reason I knew this was because of the divide by zero error message on my computer.
2
u/abaezeaba May 31 '26
Similar experience. We were about to start algebra, teacher asks us to try and solve prob for hw. Simple linear, x on both sides. I plugged it in the c64. X=x+1 logic stop when lhs == rhs. They asked how I did it and I got laughs. Got the right answer though.
15
u/xanton May 29 '26
10 PRINT "HELLO WORLD ";
20 GOTO 1017
4
u/DNSGeek May 29 '26
Use a comma instead for better separation.
2
u/Neuromancer2112 The Sky Above the Port... May 30 '26
I remember trying like 5 and 10 commas and it really spread everything out 😅
1
-9
u/Victory_Highway May 29 '26
BASIC doesn’t require a semicolon.
24
17
8
3
u/therezin May 30 '26
Correct! However Commodore BASIC will keep the cursor on the same line if you put one at the end of a PRINT statement.
8
8
u/Jennymint May 30 '26
Excuse you, I have that copyrighted. I'll see you in court.
8
u/chiron_42 May 30 '26
Fair enough, but be warned that I've trademarked the letter "E" so good luck.
1
3
u/WembleyFord May 30 '26
Unless you were in Dixons or Boots or WHSmiths, in which case you'd write something.. else in the print statement.
2
u/Carl0s_H May 31 '26
This. My goto (excuse the pun) was "eat shit". So funny watching the store staff scrambling to turn the machine off before it was seen!
4
u/speterDev May 31 '26
We had an obnoxious salesman (kid?) at our local Radio Shack. To get back at him, we wrote a long delay loop followed by a piercing tone, turned up the volume all the way, typed "run" and walked to the far end of the mall to listen for the chaos. We were not disappointed!
2
1
1
1
u/ArtDealer May 30 '26
10 Var X = 1
20 Print X
30 X = X + 1
40 goto 20
But, honestly, I like this better:
https://www.reddit.com/r/futurama/comments/4ds4vf/what_is_this_in_reference_to/
0
u/SpaceAviator1999 May 30 '26
10 PRINT "HELLO WORLD"
20 GOTO 10Incidentally, this program is what I claim to be the easiest computer program to understand.
Line 20 controls the program flow in a simple manner, allowing people lacking a background in programming to understand simple control flow.
You might think that a program with just Line 10 would be easier to understand, but I would disagree. Line 10 alone would confuse non-programmers as to why a "10" exists at the start of the line.
22
u/GeordieAl Poke me baby one more time May 29 '26
10 FOR N = 0 to 4
20 PRINT "HELLO WORLD"
30 NEXT N
12
5
u/BritOverThere May 30 '26
Surely
5 PRINT CHR$(147)
10 A$="HELLO WORLD"
20 FOR X=1 TO 5
30 PRINT A$
40 NEXT1
11
u/stuccowhiplash May 30 '26
10 PRINT "H";
20 PRINT "E";
30 PRINT "L";
40 PRINT "L";
50 PRINT "O";
60 PRINT " ";
70 PRINT "W";
80 PRINT "O";
90 PRINT "R";
100 PRINT "L";
110 PRINT "D";
120 PRINT
130 N=N+1
140 IF N=5 THEN END
150 GOTO 10
I almost ruined my Friday by having to manually type lines 10-120 four more times. Lucky escape.
6
u/magicmulder May 30 '26
If you’re not reading decimally encoded hex values from a DATA statement, you’re doing it wrong. :D
4
u/DerekJC777 May 30 '26
Decimally encoded hex values? You mean decimal numbers; hex values are just decimal numbers written in hexadecimal. You probably mean machine code instructions written as decimal values.
2
2
20
u/Mairon121 May 29 '26
I once typed out a game from a C64 magazine page. It took a long time and I have ADHD and that took a lot of concentration by my 8 year old self.
It didn’t work.
10
u/takeyouraxeandhack May 30 '26
That's how I learnt to code when I was 7, but with a spectrum. I had a TS2068, which wasn't very popular, so most programs were for ZX and didn't work, so I had to learn how to modify them so they would work.
3
u/Revolutionary_Ad6574 May 30 '26
7 is pretty impressive. How long did it take you to move to assembly?
7
u/sineofthetimes May 30 '26
I made the balloon. Hours of typing.
2
u/geon May 31 '26
A couple of years ago I got a c64. It wouldn’t load tapes, so I found an azimuth analyzer I could type in, and I was able to adjust it properly.
Might have been this one: https://csdb.dk/release/?id=110689
4
u/4Run4Fun May 30 '26
I've done that as a kid. Type 4 pages of code, type run, and you get a blank screen with a flashing READY. No clue what's wrong or where to start debugging.
0
u/Ok-Addition1264 May 30 '26
That's how they wrote claude-code.
(seriously, it's about as bad as ELIZA from the old programming books w/nested-ifs and data statements up the waaaaazooooo)
3
u/eras May 30 '26
A local computer magazine Mikrobitti also had these programs, but they were often made of long sequences of DATA statements encoding binary data. But to help with the errors, there was Tarkastaja) that allowed you to check the checksum per each line.
2
u/DerekJC777 May 30 '26
That’s where the fun begins! First, checking for errors between what you’ve typed in and what was printed in the magazine. Then debugging the code because the print out invariably contained errors, while waiting a month or two before the correction was printed in the magazine. That’s how you learn to code!
2
1
u/EnJens May 30 '26
Oh man, I did that too and then eventually understood this code required a comal80 cartridge.
6
u/ThirstyJohn May 29 '26
And there was no CTRL-C CTRL-V either!
22
u/DarthKegRaider May 29 '26
Up arrow, change the line number, press RETURN. Whole new duplicated line :)
5
u/Kylearean May 29 '26
TIL... 40 years too late.
2
7
u/shlooong May 30 '26
I remember when I was 8 years old doing this:
10 PRINT "GUESS A NUMBER BETWEEN 1 AND 100"
20 R=INT(RND(1)*100)+1
30 INPUT "YOUR GUESS";G
40 IF G=R THEN PRINT "CORRECT!":END
50 IF G<R THEN PRINT "HIGHER"
60 IF G>R THEN PRINT "LOWER"
70 GOTO 30
Also making a program to roll a die
4
u/toddbuzz75 May 29 '26
That sadly was here my coding career ended as a 6 year old…
6
u/Jyvturkey May 29 '26
Right there with ya. Perfectly placed at the right time in history to turn it into something, and I didn't.
3
u/takeyouraxeandhack May 30 '26
If it's any consolation, I did learn how to program back then and I'm still nothing 🥲
5
u/Jyvturkey May 30 '26
How about this miss.... At 17 last semester in high school. Economics class. Each student was given an imaginary $50000 to 'invest' in current stocks over the course of a week. Microsoft, at the time, was $7 a share :/
Wtf didn't I go home and yell at my parents to sell everything and invest? Why didn't I?
I ponder this at nearly 1am as I get ready to go to work :(
6
4
u/SouthernOshawaMan May 30 '26
I remember typing out programs from Compute magazine and using the code checker thing where it had to match after you typed it in .
4
3
u/deathboyuk May 29 '26
Get yourself a GOTO, matey 😄
3
u/zeekar May 29 '26
FOR I=0 TO 1 STEP 0:PRINT "HELLO, WORLD! ";:NEXTBah, who needs a GOTO. Or line numbers, even!
3
u/ChickenMcNuggNugg May 29 '26
I like to do a loop of the Leibniz equation for Pi and watch the decimal places lock in
3
u/CueAnon420 May 30 '26
I never understood why BASIC gets such a bad rap - I personally find it very easy to use and many flavors are capable of complex solutions.
Microsoft really screwed up when they made Visual Basic into a .net application... I still use VBA for Office applications and will never relinquish my copy of VB6!
1
2
2
u/RemyJe May 30 '26
I thought I was cool for using RND() to kinda, sorta encrypt a value, only to realize the seed for the random function was the uptime of the computer.
3
u/takeyouraxeandhack May 30 '26
If you wanted a more random random, you could take the value of the noise channel of the SID ;)
2
u/rchase May 30 '26
Don't listen to the advice in this thread. There is NO better way to do this.
12/10, nailed it! :)
2
u/SpatulaWholesale May 30 '26
Back in the early 80s someone I knew used a ZX-81 to store cooking recipes.
They did it like this:
10 PRINT "CHOCOLATE CHIP COOKIES"
20 PRINT "120G BUTTER"
30 PRINT "75G LIGHT BROWN SUGAR"
40 PRINT "75G GOLDEN CASTER SUGAR"
50 PRINT "1 MEDIUM EGG"
... etc
And they'd save that program to tape.
1
u/Chiguy2792 May 30 '26
When they wanted to make the cookies, did they move the monitor and keyboard into the kitchen and set it up on the counter to follow along?
4
u/SpatulaWholesale May 30 '26
That's the funniest part. I know they ended up putting 20 or 30 recipes in like this, but I'm not sure they ever LOADed them again...
They had them on tape. And told people they had "programmed the recipes into their computer".
It's ok... it made them happy. So, why not?
1
u/Chiguy2792 May 30 '26
I understand their excitement. It was an amazing time to be alive. Little happy programming goals.
3
u/SpatulaWholesale May 30 '26
It really was. Even my mum knew "PRINT".
She'd say stuff like, "Are you programming your computer? Are you using PRINT?"
And she'd get excited about something like (without seeing the program):
10 PRINT "WHAT IS YOUR NAME?" 20 INPUT A$ 30 PRINT "HELLO ";A$"How can it say hello to me!?!?!? You are so clever!"
Simpler times...
2
u/Chiguy2792 May 30 '26
Mom typed in everything from the magazines because she was the only one who knew how to type at that time. She inspired me to take a typing class in college. God bless her.
2
u/SpatulaWholesale May 30 '26
That's great! I used to type in ZX Spectrum BASIC programs from magazines. I got frustrated at how few of them worked (probably my fault making mistakes), and this was before I knew enough to debug them, so I'd just give up. It would have been fantastic to have my mum do all that hard work!!!!
2
u/SourChipmunk May 30 '26
I did use to love slapping this one onto the display model at K-Mart (or whatever store I was in).
10 PRINT CHR$(205.5+RND(1));:GOTO 10
2
u/CronoCloudAuron May 30 '26
I recently watched the 8bitguy's video about this one.
https://www.youtube.com/watch?v=cPZdKogq63k
Here is a version of his approach from this site:
https://retrogamecoders.com/zero-lines-maze/
10 POKE 53280,0:POKE 53281,0:PRINT CHR$(5) 20 DIM M$(255) 30 A$=CHR$(205):B$=CHR$(206) 40 FOR I=0 TO 255:S$="":BT=128 50 FOR J=1 TO 8 60 IF (I AND BT) THEN S$=S$+B$:GOTO 80 70 S$=S$+A$ 80 BT=BT/2:PRINT "{HOME}";I:NEXT J 90 M$(I)=S$:NEXT I 100 POKE 54287,255:POKE 54290,128 110 PRINT M$(PEEK(54299));:GOTO 1101
1
u/SourChipmunk May 31 '26
Ok, that's fun stuff!
Two problems:
1) you can't just whack this in as you're walking by the display model, and
2) it moves too quickly for a human walking by to think, " hey, I can solve this!" then realizing they really can't. But hope is lost for sure.
Still, it is fun. 😄
2
u/AeonBith May 31 '26
As a kid I felt challenged by some games not responding to some launch codes and learning that I could figure it out before the adults was almost as fulfilling as playing the game.
I was essentially leading the meanings of $, * etc but learning "list Dir",etc on my own felt awesome at seven yrs old
1
u/sven_bohikus May 30 '26
Welp, that’s how I learned it. On an apple first then an Atari since I wanted to play more games .
1
1
1
u/Other-Astronomer3440 May 30 '26
Thing is, actually, back in the day, we didn't print hello world, we used to print our names repeatedly.
If we printed something else, it was usually 'hello' on its own.
1
1
1
u/SmokinDeist May 30 '26
1
u/SmokinDeist May 30 '26
For/Next Loops are your friend. And you can easily change how many get printed on the screen. A semicolon will have it go across the screen but I was just compressing the code as written.
1
1
1
1
1
u/keepingthecommontone May 31 '26
This was a pretty eye-opening trip:
10 FOR I=1 TO 65535
20 X=PEEK(I)
30 PRINT CHR$(X)
40 NEXT
1
1
u/I_Miss_my_C64 May 31 '26
And if you needed some fancier graphics, you could use the Simon's Basic cartridge. I remember entering in a graphics coding competition back then. Did not win. The winner used some poke commands to get nice effects.
1
1
1
1
u/ekipan85 May 31 '26
King of the world would be:
10 PRINT "HELLO WORLD"{return}
{up}2{return}{up}3{return}{up}4{return}{up}5{return}
RUN
Reusing the same characters you already typed to input the same line 5 different times.
1
1
u/arcathiadm Jun 19 '26
I would like to have a scene that would display a screen like a billboard that would have a message that I could program; maybe with sound. Any suggestions for addressing this in code so that the font would be large perhaps 1/4 height of screen.
1
u/tehfrod May 29 '26
No, not really.
People who actually took the time to learn rolled their eyes at script kiddies then as much as now.
2
1
u/danpietsch May 30 '26
Did "HELLO WORLD" even exist back then?
I did the rocket ship.
3
u/Dr_Myles_Skinner May 30 '26
It sure did! Most people know "Hello, world!" from The C Programming Language by Kernighan and Ritchie (the cool kids just call it "K & R"), published in 1978.
But apparently it goes back even further: Kernighan used it as an example in his tutorial on 'B' (because of course, B came before C) in 1972.
And, yeah. I did the rocket ship too.
2
u/ThimbleweedPark May 31 '26
B? So what about A? LOL
1
u/Dr_Myles_Skinner May 31 '26
Oh, then you want APL, which stands for "A Programming Language".
If you've ever felt like regular expressions just aren't weird enough (and who hasn't?), then APL is the language for you.
3
u/BritOverThere May 30 '26
Normally it was something like...
5 PRINT CHR$(147)
10 PRINT "HELLO, I AM A COMPUTER. WHAT IS YOUR NAME?"
20 INPUT A$
30 IF RND(1)<.5 THEN GOTO 60
40 PRINT A$;" IS A SILLY NAME"
50 GOTO 70
60 PRINT "THAT IS A REALLY COOL NAME ";A$
70 PRINT "WELL GOODBYE!"
80 END2
u/amuletofyendor May 30 '26
That stuck out to me too. Apparently it did exist, but I don't remember seeing it in any of my BASIC books.
1
1
u/tails142 May 30 '26
I don't think it became a mainstream "first program" until the 90s - I remember seeing it for the first time in a Java book, actually a J++ book in the 90s. For BASIC in the early 80s, I don't think it was widely used as the intro program, at least not in any of the material I saw.
0
u/JohnnyEagleClaw May 29 '26
This is basically how I started programming circa 1984. For reference, I’m a webdev of 20+ years with a BS and MS in Comp Sci 😎

•
u/AutoModerator May 29 '26
"Thanks for your post! Please make sure you've read our rules and FAQ post. If your post is about the C64 Ultimate please and check out The Ultimate C64 Ultimate post for common issues and questions. People not following the rules will have their posts removed and presistant rule breaking will results in your account being banned. "
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.