Commodore FREE One Liners competition.
Moderator: Moderators
-
- Vic 20 Dabbler
- Posts: 78
- Joined: Fri Jan 20, 2006 3:41 am
Commodore FREE One Liners competition.
Commodore FREE is running a One Liners competition to link in with the publication of this book.
All Commodore 8-bit formats are welcome, and your program must be a maximum of two lines (so there are two categories: genuine one liners, and two liners). The two line thing is to compensate for the lack of characters per line in most dialects of Commodore BASIC. For instance, you can get a lot of logic into Sinclair BASIC and others in just one line of BASIC.
I've done an example disk to get everyone started. The full article should be published in the next issue of Commodore FREE - if not then the deadline might have to be moved. It's announced here to give you a head start
Here are some rules:
* Machine code can be used if it's using a MC loader (DATA/FOR/POKE combo) – 0 sys 2059 which then runs an entire game written in assembly, C or some other compiled or assembled code is not a one liner for the purposes of this competition.
* For two-liners, the first line should be used for variables, functions and data, and the second should contain the logic.
* Please provide as much information as possible with your submissions, ie, what you were trying to achieve, and how far you think you got to achieving it; how you created your program (genuine one liner, BASIC 7 or whatever).
* Entries are welcome on all Commodore 8-bit formats in any known variant of BASIC – please save them to a D64 disk image along with your documentation. So, you could try something for the VIC-20, for instance.
* Have fun with it – remember, 640 bytes ought to be enough for anyone!
* The closing date is Friday 8th March 2013 at 11:59pm GMT. The winner will be announced in the next available issue of Commodore FREE, and through the various forums that we use. We will dig out some prizes for you.
Please feel free to ask any questions.
All Commodore 8-bit formats are welcome, and your program must be a maximum of two lines (so there are two categories: genuine one liners, and two liners). The two line thing is to compensate for the lack of characters per line in most dialects of Commodore BASIC. For instance, you can get a lot of logic into Sinclair BASIC and others in just one line of BASIC.
I've done an example disk to get everyone started. The full article should be published in the next issue of Commodore FREE - if not then the deadline might have to be moved. It's announced here to give you a head start
Here are some rules:
* Machine code can be used if it's using a MC loader (DATA/FOR/POKE combo) – 0 sys 2059 which then runs an entire game written in assembly, C or some other compiled or assembled code is not a one liner for the purposes of this competition.
* For two-liners, the first line should be used for variables, functions and data, and the second should contain the logic.
* Please provide as much information as possible with your submissions, ie, what you were trying to achieve, and how far you think you got to achieving it; how you created your program (genuine one liner, BASIC 7 or whatever).
* Entries are welcome on all Commodore 8-bit formats in any known variant of BASIC – please save them to a D64 disk image along with your documentation. So, you could try something for the VIC-20, for instance.
* Have fun with it – remember, 640 bytes ought to be enough for anyone!
* The closing date is Friday 8th March 2013 at 11:59pm GMT. The winner will be announced in the next available issue of Commodore FREE, and through the various forums that we use. We will dig out some prizes for you.
Please feel free to ask any questions.
Without context, we are only data.
-
- Vic 20 Dabbler
- Posts: 78
- Joined: Fri Jan 20, 2006 3:41 am
It's just a rule of BASIC, isn't it? You can't declare a variable in line 200 to use in line 100 without a gosub or something. But yes, you are correct. Programs are basically variables, functions and data.groepaz wrote:"the first line should be used for variables, functions and data"
could you clearify what that does actually exclude? my code usually purely consists of variables, functions and data.
Regards,
Shaun.
Without context, we are only data.
I'm a little confused.
A two-liner on the VIC is 2x2x22=88 characters of basic. The length of a basic line is two screen lines, am I right?
And then a maximum of 640 bytes is mentioned, which would fit a lot longer program than in two lines of VIC basic.
I have a little idea, but I don't think it'll fit in two lines of VIC basic. But 640 bytes of basic code must be more than enough. So can I use that?
A two-liner on the VIC is 2x2x22=88 characters of basic. The length of a basic line is two screen lines, am I right?
And then a maximum of 640 bytes is mentioned, which would fit a lot longer program than in two lines of VIC basic.
I have a little idea, but I don't think it'll fit in two lines of VIC basic. But 640 bytes of basic code must be more than enough. So can I use that?
- Mike
- Herr VC
- Posts: 4832
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
The screen editor of the VIC-20 accepts up to four physical lines as a single logical line, i.e. 88 characters.
With abbreviations (for example, ? for PRINT, F SHIFT-O for FOR, N SHIFT-E for NEXT, etc., see the VIC User's manual), you can enter some more code into these four lines. When this line is LISTed again though, the abbreviations are expanded to the complete keywords. The line then spans more than four physical lines, and cannot be edited anymore as a whole (unless you retype it again in abbreviated form).
BASIC itself is not limited though to lines of just 88 characters, regardless whether typed in full or in abbreviated form. Rather, the interpreter accepts lines with up to 255 bytes in length, including the two-byte link pointer, two-byte line number, and the terminating null byte at the end of the line. Keywords of BASIC (the 'tokens') count for a single byte. Lines longer than this cannot be handled by the routine that relinks the lines when a program is loaded.
Such an over-length line can't be entered in quite the usual way, but - at least in principle - one could POKE it into memory by hand. Or use petcat.
The 640 bytes note is presumably just a joke referring to an old saying attributed to Bill Gates.
With abbreviations (for example, ? for PRINT, F SHIFT-O for FOR, N SHIFT-E for NEXT, etc., see the VIC User's manual), you can enter some more code into these four lines. When this line is LISTed again though, the abbreviations are expanded to the complete keywords. The line then spans more than four physical lines, and cannot be edited anymore as a whole (unless you retype it again in abbreviated form).
BASIC itself is not limited though to lines of just 88 characters, regardless whether typed in full or in abbreviated form. Rather, the interpreter accepts lines with up to 255 bytes in length, including the two-byte link pointer, two-byte line number, and the terminating null byte at the end of the line. Keywords of BASIC (the 'tokens') count for a single byte. Lines longer than this cannot be handled by the routine that relinks the lines when a program is loaded.
Such an over-length line can't be entered in quite the usual way, but - at least in principle - one could POKE it into memory by hand. Or use petcat.
The 640 bytes note is presumably just a joke referring to an old saying attributed to Bill Gates.
- Kweepa
- Vic 20 Scientist
- Posts: 1314
- Joined: Fri Jan 04, 2008 5:11 pm
- Location: Austin, Texas
- Occupation: Game maker
Hmm... I had a go, but I couldn't write much in less than 256 bytes.
So here's my 256 byte attempt. ZXOK to move, P to bomb.
http://www.kweepa.com/step/vic20/games/twofiftysix.prg
So here's my 256 byte attempt. ZXOK to move, P to bomb.
http://www.kweepa.com/step/vic20/games/twofiftysix.prg
-
- Vic 20 Dabbler
- Posts: 78
- Joined: Fri Jan 20, 2006 3:41 am
It's a reference to Bill Gate's supposed claim that 640 Kilobytes ought to be enough for anyone (that's only part of what he said, as I recall). But if you've written something in *less than* 640 bytes then 640 bytes *was enough* for your one-liner as you've got space to spare.Witzo wrote:Thanks Mike. Two basic lines of four physical lines each, then that's what I'll be aiming for.
I'll disregard Shaun.Bebbington's remark about the 640 bytes.
So far, there has been one disqualification - it was a program listing that had around 30 lines.
Anyway, the deadline is close, so feel free to submit your entries.
Regards,
Shaun.
Without context, we are only data.
-
- Vic 20 Dabbler
- Posts: 78
- Joined: Fri Jan 20, 2006 3:41 am
Very good, but I count five lines of BASIC.Kweepa wrote:Hmm... I had a go, but I couldn't write much in less than 256 bytes.
So here's my 256 byte attempt. ZXOK to move, P to bomb.
http://www.kweepa.com/step/vic20/games/twofiftysix.prg
Regards,
Shaun.
Without context, we are only data.
- Kweepa
- Vic 20 Scientist
- Posts: 1314
- Joined: Fri Jan 04, 2008 5:11 pm
- Location: Austin, Texas
- Occupation: Game maker
Great! We can hide a line by numbering it 0!Shaun.Bebbington wrote: Very good, but I count five lines of BASIC.
It wasn't really an attempt to enter, since I think the rules are too strict for the VIC, although as Leeeeeee says the same game could theoretically be entered as two lines. I'd prefer a byte count. What is the C64 line limit? Is it 4x40=160 'bytes'?