BASIC Command Help

Basic and Machine Language

Moderator: Moderators

Post Reply
Ihavenousername
Vic 20 Drifter
Posts: 23
Joined: Sun Nov 08, 2009 7:00 pm

BASIC Command Help

Post by Ihavenousername »

I've been working on a program for the VIC-20 for about three weeks now and its coming along pretty well, but there are a few BASIC commands and other things that would help my program a lot that I haven't been able to figure out yet.

Could anyone explain how or tell me the commands to do the following things?

-Have the program clear the screen by itself, without the user having to press the CLR key before the program.

-Have a key give a poke command. For example, have the program POKE 36878 when the F key is pressed.

-Have the program respond to the paddle controllers. For example, when the paddle read-out is 255 on one of the paddles, set the VICs volume to 5, and when the paddle read-out is 10 or 0, have the VICs volume set to 0.

I appreciate any help.
I'm also sorry for not replying to my last topic, I was very busy and didn't have time. But I did get to read most of it and I'm glad so many people replied.
User avatar
pitcalco
just pitcalco
Posts: 1272
Joined: Wed Dec 28, 2005 4:13 pm
Location: Berlin

Post by pitcalco »

1.

Code: Select all

PRINT CHR$(147)
2. and 3. More complicated, but can certainly be done. I will get back later unless someone else beats me to it (and probably will with a better routine than I would offer :wink: )
There are only three kinds of people in the world: those who can count and those who can't.

Paul Lambert
Berlin
Federal Republic of Germany
Ihavenousername
Vic 20 Drifter
Posts: 23
Joined: Sun Nov 08, 2009 7:00 pm

Post by Ihavenousername »

Thanks.

I didn't think the clear screen one would be hard, but I just couldn't figure out the right way to do it.
User avatar
pitcalco
just pitcalco
Posts: 1272
Joined: Wed Dec 28, 2005 4:13 pm
Location: Berlin

Post by pitcalco »

Well as for the second question, that is not so hard either but the question needs to be a bit more precise.

Namely, you don't really POKE 36878. Rather you POKE some value into 36878. For instance POKE 36878, 1 will result in a certain screen colouration (I don't remember which).

You can implement such a thing in many ways in a BASIC program but how you weave it into a working routine can get complicated. It all depends.

Simply you can do something like this to start:

Code: Select all

10 PRINT CHR$(147)
20 INPUT "Enter a number from 0-255",A
30 POKE 36878,A
40 GOTO 10
...just to play around with the concept.
There are only three kinds of people in the world: those who can count and those who can't.

Paul Lambert
Berlin
Federal Republic of Germany
Ihavenousername
Vic 20 Drifter
Posts: 23
Joined: Sun Nov 08, 2009 7:00 pm

Post by Ihavenousername »

I was planning to poke different values into it using different keys.

And the command was a lot simpler then I thought it would be. Thanks again.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

When you press control keys inside of " ", special codes will be recorded that does those things, so for example to clear the screen:

10 print "{press shift home}"

You can do the same thing with the colors and cursors etc...


Adjusting the volume with the paddle:
10 poke 36875, 200 : rem make some sound
20 poke 36878, peek(36872)/17
30 goto 20

To get key input without halting the program, use GET

For example:

10 print "press b to stop"
20 print ".";
30 get a$ : if a$="b" then end
40 goto 20

Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

F keys also gets recorded inside of " ", so to check for f-keys you can do something like:

10 get a$ : if a$="" then 10
20 if a$ = "{press f1}" then something
30 if a$ = "{press f3}" then something else

etc...
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Post Reply