Jump to content

separating lines on the commodore 64


Recommended Posts

i recently made a short "game", if you could call it that. it's a simple guessing game called Key and Lock. the object is two look at two objects represented by the C64's Character set and guess if it will fit the lock, represented by an x. my question is this: is there an alternative to the WAIT command for the c64. i want the program to wait for a keypress then give the result.



This is a key

will the key fit the lock?

(wait for keypress)

it fits, good job


or if the key does not fit

(wait for key press)

it does not fir, too bad


also, is there a way to space out the lines so its not bunched up?


thanks in advance (p.s, i tried the IF command for a$ and got an error. i need a workaround.)

Link to comment
Share on other sites

Waiting for the keypress is easy enough, use GET to read the keyboard and keep looping back if the result is null:


300 GET A$

310 IF A$="" THEN 300


Spacing out the lines can be done a couple of ways; either use PRINT on it's own between two existing lines to print out a blank line or typing the existing lines as PRINT "[hit cursor down]will the key fit the lock?" which embeds a cursor down into the PRINT statement.

Link to comment
Share on other sites

I keep getting an error


if a$= "open door" goto 50

syntax error

Because the syntax is wrong; they're called IF/THEN statements for a reason and you need an IF and a THEN for it to work!




Actually, in Commodore BASIC you can skip the GOTO so...




...will work too.

Link to comment
Share on other sites

If - goto constructs work on the C64, too,


if a$= "open door" goto 50,


if a$= "open door" then 50 and


if a$= "open door" then goto 50


should all do the same, the syntax error must be caused by something else. I'd check for hard to spot typos like AS instead of A$, ; instead of : or something like that.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...