Basic Program CONTEST (project 1)

Basic and Machine Language

Moderator: Moderators

User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Basic Program CONTEST (project 1)

Post by Jeff-20 »

We will have a bunch of new members soon... I am trying to bring more.

I haven't been using my VIC this year, so I want to find motivation. I thought it might be fun to have a few projects... this is the first one.

Let's have a Game programming contest! It will be fun!

I am thinking of some rules, so let's all contribute to designing the competition now. Here's what I have in mind.

1. The program must be a GAME.
we all love games!

2. It must be a BASIC program under 10 lines!
This way, we don't have to deal with messy stuff like memory expansion or Machine Language hardware. No memory tricks, just straight basic skills, and all VICs will be compatible.

We could all type in a short program. I know 10 seems short, but this restriction would ensure a new program effort. And let's face it we all have busy lives, so the development time would be short.

I think everyone could put something together in a short time and it would be small enough to distribute via wave file, type in program or emulator files...

What do you think? Any other suggestions?

As for project 2 (see title)... I have been thinking about doing one big collaboration program in which everyone can contribute... maybe like an exquiste corpse poem... everyone just adds to it. :lol:

What do you think?
Last edited by Jeff-20 on Tue Jan 16, 2007 9:12 am, edited 2 times in total.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Nice idea, although I would suggest 20 lines of Basic if you want to get anything playable. The reason why is that most games are built on decision making and comparisons (IF), and as you know there is no ELSE statement in Commodore Basic to continue on the same line if the condition was not met.

Of course, there are clever tricks which can be used instead of IF statements. For example, this kind of movement:

15 IF A$="U" THEN S=S-22
17 IF A$="N" THEN S=S+22
19 IF A$="H" THEN S=S-1
21 IF A$="J" THEN S=S+1
23 POKE 7680+OS,32:POKE 7680+S,81:OS=S

can be rewritten as:

15 S=S+(A$="U")*22-(A$="N")*22+(A$="H")-(A$="J")
23 POKE 7680+OS,32:POKE 7680+S,81:OS=S

For those who don't realize why, it is because Basic will evaluate each condition to true (-1) or false (0). From school, we know that 1 - -1 = 1 + 1 = 2, so in reality, the line is:

S=S+(0 or -1)*22 - (0 or -1)*22 + (0 or -1) - (0 or -1)

which happens to yield the same result as the four IFs. More complex scenarios would need different solutions, but this is a start.
Anders Carlsson

Image Image Image Image Image
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

ok.. I guess 15 or 20 lines... we should hammer out the rules while we get together a group of participants...

a game
15 or 20 lines (we'll decide that later)
Basic
unexpanded memory

anything else?

I think it will be fun to see all the creative approaches...
High Scores, Links, and Jeff's Basic Games page.
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

It's a great idea.

God, I wish i knew about this vic 20 forum earlier!

Chris
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Hi Chris. I was going to mention this site to you, Dong Feng and whoever else who would be interested on Vintage Computer, but forgot.

I think the rules are quite OK. Maybe you should add that POKEs are ok, but no SYS or USR calls (which also prevents from smart using of ROM routines - dunno about WAIT though). Joystick should probably be allowed, but there probably are no other peripherals one can benefit from by requiring.

Actually, I think one of my less crappy CSSCGC entries could well fit into this Basic programming compo, once I manage to convert it down to < 20 lines of code.
Anders Carlsson

Image Image Image Image Image
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

Hey Anders;

I know, once I found this site (thanks to a link on sys.cmb) I freaked when I saw a forum just for the vic 20, and wondered immediately why you did not tell me :)

Chris
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

ok...

It is a game so I also think Joysticks should be (the only periph) allowed.

I use WAIT commands for joystick reading (fire to continue, etc.) but I also agree ML-related commands like USR and SYS should probably not be allowed.

It is a BASIC game contest.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Actually, I have never fully figured out how to make use of the USR function. In theory I know how Basic will access it, but I never found a need or usage for a ML routine I couldn't SYS and PEEK values from.

How about self-modifying Basic? :lol: I'm not saying I could manage to get a program working properly while changing itself, but it could be a future idea for the 912th Denial compo, when people have accustomized themselves to the concept.
Anders Carlsson

Image Image Image Image Image
aneurysm
not your PAL
Posts: 178
Joined: Sat Mar 06, 2004 11:06 pm

Post by aneurysm »

wait... the joysticks are ok but paddles aren't on the list? :cry:
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Anything that plugs into the game port then? I believe it is ten times more common to have an Atari-style joystick than having a pair of paddles or a lightpen or something even more obscure, which means that a paddle-only game will be difficult for most people to play.

There was a paddle-only Atari 2600 game in last MiniCompo. While some of the emulators support paddles, I don't know how common it was on that platform. It surely is a cool, analogue controller but if it is not very common, I would think twice before only supporting it in my program. It reminds me of an advertisment by UK based software house Bug-Byte in 1984, looking for new free-lance or in-house programmers:

* Write your game for any of these platforms, in preferred order: C64, Spectrum, BBC, Atari etc
* Don't aim for obscure combinations (i.e. VIC-20 with 3K expansion and light pen) which limits the market too much
* Be creative, don't copy an existing game
* etc
Anders Carlsson

Image Image Image Image Image
james
Vic 20 Newbie
Posts: 1
Joined: Wed Mar 31, 2004 2:54 pm

Post by james »

Fantastic idea ! It has to be at least 15 years since I've done any programming on a VIC so I'm afraid I've forgotten most of it. It has brought back lots of memories finding VICE and your forum! Keep up the good work.

Does anyone know where I can get get some VIC-20 BASIC program listings to type in, for old times sake? Anyone got any listings /articles from magazines, etc, scanned to PDF?

One program I am having trouble finding is the old TESTCARD program that came with the VIC-20 and played the can-can !! Anyone managed to find it ?
JAMES TURNER
West Yorkshire, England
Email: turnerja@ukonline.co.uk
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

Hi James;

You can find quite a bit of stuff here:

http://www.funet.fi/pub/cbm/vic20/
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

So, has anyone got any ideas so far what they may try and program?

I am still trying to figure out something I may be able to fit in 20 lines, and still be a playable game.

I was thinking about a simple blackjack game or something along those lines.

Actually a battleship clone doesn't look like it would take too many lines either.

Chris
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

james wrote:Does anyone know where I can get get some VIC-20 BASIC program listings to type in, for old times sake? Anyone got any listings /articles from magazines, etc, scanned to PDF?
I don't where you can find listings, but I recently processed an already scanned listing, and it was quite some work to get all the way from an image scan to a working program.

What I did was to run OCR on the image, get a text file with OCR errors which I manually corrected as far as possible. Then I run bastok or tok64 to convert the text file into a tokenized Basic program. I fixed any errors the converter reported and run the program in the emulator. Then the program crashed out, and I had to go back to the listing and find what error I had not spotted etc.

I also had a COMPUTE MLX listing, which I wrote my own converter to translate MLX text files into a program. Actually it was easier to get all those numbers (or hexadecimals) correct than the Basic listing, as the number of "allowed combinations" somehow is fewer in a ML listing.

I think I will try to rewrite my inverted Blitz/Bomber program into Commodore Basic. It is quite simple but reasonably playable.
Anders Carlsson

Image Image Image Image Image
User avatar
freshlamb
Vic 20 Dabbler
Posts: 76
Joined: Sun Apr 04, 2004 5:38 pm
Website: http://www.rufnoiz.com
Location: Prince Albert SK Can

Post by freshlamb »

This is all really cool! I remember seeing your games listed on eBay and went to your site on geocities, but it never changed, and I felt sad. But I just got the digest from the Vic20 Yahoo group and ran over here. I pulled out my vic for a couple days but couldn't get motivated to do much so I put it away. Maybe now I'll have a reason. I like the game contest and will try to put something together for it, but after seeing some of the programs available from you guys I feel extremely underwhelmed! The self modifing code sounds interesting but would you be able to implemet anything meaningful in less than 20 lines? Can't wait for more.

Kurt
Post Reply