i wrote my first C64 program

Welcome back to our Commodore Discussion forum. If you have a question, comment, problem, or just want to chat about Commodore, post it here for free.

Have some fun and talk to others interested in the Old and New Commodore world.

Moderators: wiskow, Trazan

Post Reply
Hakemon
Posts: 8
Joined: Mon May 29, 2006 11:16 pm

i wrote my first C64 program

Post by Hakemon »

I can't believe it, I learn the basic commands in a day, and in the same day, I write a Commodore 64 program (about 80+ lines of code)..

Tell me what you guys think, it's a Quiz program, to a disney cartoon called "American Dragon"..

i know of atleast one thing I forgot to add, on the title screen for it, it needs the Copywrite to Disney, that way they don't get on my case about it, and at the end, I probably should supply my public email address...

remember, i JUST learned C64 BASIC today (and BASIC all together), so this program is VERY dull, and doesn't even keep score------yet... (if anyone knows how you do that, PLEASE let me know)...

http://blackevilweredragon.spymac.com/adjlquiz.zip

(you don't need to know the answers to the questions if you just want to BETA test it.. just pushing enter/return will give incorrect responses, with the correct answer being displayed..

EDIT: Here's a bug I found, can anyone help me on this one? On questions 8 and 10, just pushing return or enter, yields a "correct" response, not a "incorrect" response.. What gives? I looked at the coding, and from what I see, it's all good..
User avatar
K.C.
Posts: 9
Joined: Wed Sep 20, 2006 5:02 am

Post by K.C. »

Look at lines 20 and 30:

Code: Select all

20 INPUT ANSWER$
30 IF ANSWER$="YES" THEN GOTO 60
These lines force you to type YES, otherwise your program is terminated. When you just hit Enter at the following INPUT commands (line 80, 140, 200, 270, etc.), the variable ANSWER$ still contains the word YES.
Now look at line 610:

Code: Select all

610 IF ANSWER$="YES" THEN GOTO 640
This is true when you did not enter anything at the previous questions and line 640 will display the "CORRECT" message.
You can change line 600 to

Code: Select all

600 ANSWER$="":INPUT ANSWER$
Hakemon
Posts: 8
Joined: Mon May 29, 2006 11:16 pm

Post by Hakemon »

K.C. wrote:Look at lines 20 and 30:

Code: Select all

20 INPUT ANSWER$
30 IF ANSWER$="YES" THEN GOTO 60
These lines force you to type YES, otherwise your program is terminated. When you just hit Enter at the following INPUT commands (line 80, 140, 200, 270, etc.), the variable ANSWER$ still contains the word YES.
Now look at line 610:

Code: Select all

610 IF ANSWER$="YES" THEN GOTO 640
This is true when you did not enter anything at the previous questions and line 640 will display the "CORRECT" message.
You can change line 600 to

Code: Select all

600 ANSWER$="":INPUT ANSWER$
ill try and give that a shot... i've never used an input command like that before (heck, i didn't use the input command i DID use before yesterday)..

thanks for giving a look at the code, and finding out the bug
Hakemon
Posts: 8
Joined: Mon May 29, 2006 11:16 pm

Post by Hakemon »

what command clears the screen? I want it to clear the screen everytime a new question is displayed, so that way it isn't hard to read...
gklinger
Posts: 116
Joined: Mon Jun 12, 2006 5:47 pm
Location: Toronto, CANADA
Contact:

Post by gklinger »

Use a print statement with a press of the CLR/HOME key in between quotes. You should see an inverted heart. That will clear your screen.

If you're starting out with BASIC programming on the Commodore 64, I would suggest that you have a look at the Commodore 64 Programmer's Reference Guide. It's filled with all kinds of useful information. You might be interested in the Secret Society of Commodore Coders message forum. It's a good place to ask these kinds of questions and get general programming advice, be it about BASIC or machine language (or anything else you can think of).
Call me Golan; my parents did.
Hakemon
Posts: 8
Joined: Mon May 29, 2006 11:16 pm

Post by Hakemon »

gklinger wrote:Use a print statement with a press of the CLR/HOME key in between quotes. You should see an inverted heart. That will clear your screen.

If you're starting out with BASIC programming on the Commodore 64, I would suggest that you have a look at the Commodore 64 Programmer's Reference Guide. It's filled with all kinds of useful information. You might be interested in the Secret Society of Commodore Coders message forum. It's a good place to ask these kinds of questions and get general programming advice, be it about BASIC or machine language (or anything else you can think of).
that didn't work quite well..

when I pushed Clear Home, I saw an inverted S, and when i ran the program, while it did move the cursor up to the top left, the screen didn't clear, and it confused the heck out of the program, as it overlaid the printed text on top of text already there, essentially making the INPUT useless, crashing the program..
gklinger
Posts: 116
Joined: Mon Jun 12, 2006 5:47 pm
Location: Toronto, CANADA
Contact:

Post by gklinger »

Whoops. Hold shift when you press CLR/HOME. That will give you the inverse heart which will clear the screen. Without the shift you get a home (top left corner) without a clear. Sorry about that. The first thing you should do is have a look through the Commodore 64 User Manual which will familiarize you with the basic (no pun intended) operations of the C64 (like clearing the screen). There's also some information about programming the C64 in BASIC.
Call me Golan; my parents did.
jasonboche
Posts: 3
Joined: Thu Dec 27, 2007 8:11 am
Location: Minnesota
Contact:

Post by jasonboche »

Hakemon wrote:what command clears the screen? I want it to clear the screen everytime a new question is displayed, so that way it isn't hard to read...
print chr$(147)

or

? chr$(147)
Post Reply