User Tools

Site Tools


ugbasic:10liner
Translations of this page:


Join BASIC 10Liner Contest with ugBASIC

An interesting competition is held at the beginning of each year: the BASIC 10Liner Contest. Run by Gunnar Kanold since 2011, you can submit game or programs written for any BASIC for 8-bit home computer for which an emulator is available. Some of the entries in previous years were astounding, and give an example of the abilities of classic computers like the the Commodore 64 or Atari 800.

Obviously, it is possible to use ugBASIC to participate in the next “BASIC10Liner” competition, in the following categories:

Category Description Allowed?
PUR-80 A game in 10 lines of max 80 characters (w/abbrev.)
PUR-120 A game in 10 lines of max 120 characters (w/abbrev.)
EXTREME-256 A game in 10 lines of max 256 characters (w/abbrev.)

You cannot join the PUR-80 category since ugBASIC is not a native BASIC like the PUR-80 category require. In order to reduce space you can use one or two letters abbreviations for each instruction.

In order to produce an executable that meets the rules, you have to use the -1 option on command line version. As an alternative, if you are using UGBASIC-IDE, the option can be enabled by using the “10-Liner” Contest option on the Build menu.

Rules to join

On official website you will find the exact list of rules that the source will have to respect. There are some general ones, which apply regardless of the category, and that must be satisfied. This small section will help to write a program that respect them all.

No external data

1. Loading of data or program parts from mass storage is not allowed

It is not possible to load images, text files or other data from external files. This is a very convenient feature of ugBASIC, because it allows you to decline a resource for various platforms. Unfortunately, the regulation does not allow this type of feature. To better ensure that this rule is met, the -1 option disables the load instructions (LOAD and the like) and the UGBASIC-IDE option does the same.

There are alternatives.

It is possible to substitute an “inline” definition for an external file, with the definition of a buffer that contains the equivalent binary data. In this case, however, it is necessary to reconstruct the native data. There is currently no function that converts a generic buffer (and it would take up too much space anyway). Obviously, any static graphic resources can be replaced by drawings in real time.

  pipe = IMAGE LOAD("pipe.png")
  PUT IMAGE pipe AT 0, 0

Can be replaced with

  DRAW 0, 0 TO 0, 8

No machine program allowed

2. The 10 lines must not contain any machine programs

This rule is implicitly respected. In fact, at the moment it is not possible to include or execute assembly code or machine code, so no attention has to be taken.

No self-modifying or hidden initialization

3. All code must be visible in the listing: self-modifying code or hidden initializations are not allowed

This rule is implicitly respected. In fact, at the moment it is not possible to self modify the ugBASIC code, or to initialize by using nothing different of an explicit constant.

Allowed POKEs

4. Allowed are POKEs in storage locations

Although ugBASIC theoretically allows you to use POKE commands, you really shouldn't need them.

Executable deploy format

8. The program must be submitted on a disk or tape image

At the moment ugBASIC generates different types of output, depending on the target considered. In particular:

target description output description allowed?
atari Atari 400/800 xex Executable file
atarixl Atari XL xex Executable file
c64 Commodore 64 prg Executable file
d32 Dragon 32 bin ROM image
d64 Dragon 64 bin ROM image
mo5 Thomson MO5 k7 TAPE image
msx1 MSX 1 rom ROM image
pc128op Olivetti Prodest PC128 k7 TAPE image
plus4 Commodore PLUS/4 prg Executable file
vic20 Commodore VIC-20 prg Executable file
zx ZX Spectrum 48K tap TAPE image

For all types that are checked, the format is already compatible with the competition. For the others it is necessary to insert the executable inside a disk / cassette image. This is a simple operation, and can be done with one of the available open source tools. In one of the next versions it will be possible to generate the image ready to be delivered directly from the command line (see here for more informations).

Listability

9. The program must be listable

Using the -1 option, a small runtime module will be inserted into the program, which will allow you to run the program (RUN command) or display it (LIST command).

Proof of category

10. Together with the program a text file with the program description and instructions should be handed in, incl. short description of the start via emulator, additionally a screenshot in jpg or png format or an animated screenshot in gif format should be enclosed, also, you should include proof of this, which shows that the program does not have more characters than allowed in the category

In ugBASIC, the character count must be done in the same way as with other BASICs. The only care is the control sequences (eg: color change, screen cancellation, directional cursors, …). In general, control sequences are always two characters long, except for clearing the screen ({CLEAR}) and issuing a single specific character ({048} for 0). In these cases, the occupation is limited to a single character.

In addition to manual character counting, which is a practice that will still have to be done at least once, under Microsoft Windows you can use the convenient functionality of UGBASIC-IDE. This functionality allows you to verify, in real time, that the source code of the program complies with any category, since it counts the exact characters for each line (ten lines maximum), control sequences in strings too.

Example

As an “proof of concept”, I ported to ugBASIC the game created to participate in the 2020 edition of “BASIC10Liner” competition, and that won the FRATZENGEBALLER'S SPECIAL AWARD. The game (source here) was originally wrote in COMMODORE BASIC V2. Since the target machine (Commodore 64) is the same, it was sufficient to make some minor changes (mainly, the replace of letter case on abbreviations, some readdressing using POKE, and some other minimum changes, sources are here).

It could participate in the EXTREME-256 category, as well as the original one. The runtime loads directly on the emulator and it is possible to view the source code of the program (LIST command) before running it (RUN command).

This is a very limited porting for demonstration purposes only.

The executable version can be downloaded here.

POWERED BY