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 Commodore 64 or Atari 800.

Could I join with ugBASIC?

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

CATEGORY DESCRIPTION OK?
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.)
SCHAU  Any program 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 requires. 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


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

Rule 1. Loading data or program parts from mass storage devices 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, at startup, using drawing primitives.

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

can be replaced with

DRAW "BM0,0C8R14D1L14D1R14L12U1C5R10"

or, in a more compacted form:

Dr"BM0,0C8R14D1L14D1R14L12U1C5R10"



No machine program allowed

Rule: 2. The 10 lines must not contain machine programs. ()

To respect this rule, you have to avoid to use ASM instruction. To better ensure that this rule is met, the -1 option disables this instruction, and the UGBASIC-IDE option does the same.



Compiled programs allowed

Rule: 3. Programs may be compiled (source must still be submitted) ().

ugBASIC is a compiler, and compiled programs complies with this rule. You can still send your source separately, or list it using the LIST command.





No self-modifying or hidden initialization

Rule: 4. All code must be visible in the listing: no self-modifying code or hidden initializations are 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

Rule: 5. POKEs are allowed. ()

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



Executable deploy format

Rule: 9. The program must be submitted on a disk or tape image suitable for the system ().

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

TARGET OUTPUT DESCRIPTION ALLOWED
cpc dsk Amstrad COC - Disk image
atari xex Atari 400/800 - xex executable
atr Atari 400/800 - disk image
atarixl xex Atari XL/XE - xex executable
atr Atari XL/XE - ATR disk image
coleco rom ColecoVision
c64 prg Commodore 64 - prg executable
d64 Commodore 64 - 1541 disk image
c128 prg Commodore 128 - prg executable
d64 Commodore 128 - 1541 disk image
c128z prg Commodore 128 (Zilog Z80) - prg executable
d32 bin Dragon 32 - binary image
d64 bin Dragon 64 - binary image
sc3000 rom Sega SC-3000 - cartidge image (ROM)
sg1000 rom Sega SG-1000 - cartidge image (ROM)
mo5 k7 Thomson MO5 - tape image
msx1 rom MSX1 - ROM cartidge
dsk MSX1 - DSK disk image
pc128op k7 Thomson MO6 / Olivetti Prodest PC128 - tape image
coco bin TRS-80 Color Computer 1/2 - binary image
dsk TRS-80 Color Computer 1/2 - Disc Basic image
coco3 bin TRS-80 Color Computer 3 - binary image
dsk TRS-80 Color Computer 3 - Disc Basic image
plus4 prg Commodore PLUS/4 - prg executable
vic20 prg Commodore VIC-20 - prg executable
d64 Commodore VIC-20 - 1541 disk image
zx tap ZX Spectrum 48K - tape image


For all types that are checked (✓), the format is already compatible with the competition. For the others it is necessary to put the executable inside a disk / cassette image. This is a simple operation, and can be done with one of the available open source tools.



Listability

Rule: 10. The program must be listable (The LIST command must produce a readable program listing) ().



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

Rule: 11. Include the following in a ZIP file with your submission: The program (on disk or tape image file); a text file with the program description and instructions; a short description of how to start the game using the emulator; a screenshot in jpg or png format (or an animated screenshot in gif format); a program listing that proves the program does not have more characters than allowed for 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.



Examples



As "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.