The program was written in 8502 assembly langauage and was compiled with the publicly available (http://www.floodgap.com/retrotech/xa/) cross assembler "xa" v2.1.4f (c) 1989-98 by A.Fachat on a Windows machine (in a DOS box) using the included (one line) batch file "make.bat"

This produces a 4534 byte binary (including the 2 byte load address of $1400).  You can play it by issuing

BOOT"BATLBLOX.PRG"

from the BASIC C128 mode.  However, this is about 500 bytes over the 4 kiByte limit for the competition so more steps are required.

Next, the program is compressed with the publicly available (http://www.cs.tut.fi/~albert/Dev/pucrunch/) "pucrunch" 15.7.2003 by Pasi Ojala
using the included batch file "bbunch.bat"  This produces a self-expanding file "tiny.prg" of 4121 bytes (including 2 byte load address).  While the program does a nice job of compressing and offers output for several Commodore computers, the C128 is not one of them!

So the final step is to hack "tiny.prg".  The program loads as a C64 BASIC program at $801 and simply SYS to $80D.  We don't want or need this for the C128.  It also wants to set the C64 memory configuration by storing to $01 which we don't want either.  Also, the program does some relocation: copies some code to the zero and stack then copies the remainder of the file up in memory to $16be.

We won't be moving the file in memory so that part (and the C64 stuff) must be deleted.  Using the Commodore 128's ML Monitor, load "tiny.prg" to bank 1 address $801 with the command

L"TINY.PRG",8,10801

Transfer the non-BASIC part to bank 0 with the command

T 1080D 11817 15B3

We did not transfer the BASIC header and the program now occupies 15B3 through 25BD (note this is 10 bytes over the limit).  Next replace the STA $01 instruction at $15B6 with the following

A 15B6 NOP
A 15B7 SEI

We don't really need to disable interrupts, but since the depacker uses so much of the stack its probably a good idea to leave some room.

We remove the (file) relocation by simply transfering the preceding code over it with the command

T 15B7 15CA 15CC

Now the program occupies $15CC through $25BD which is within the 4 kiByte limit. Yeah!

The (zero page/stack) relocation code must be patched with

A 15D7 LDA 15E2,X

And another STA $01 must be patched with

A 1681 BIT 01

Finally, save the file with the command

S"BATTLE BLOX",8,15CC,25BE

Note the command requires an end address+1.

There you have it!  A 4082 byte (4084 including 2 byte load address) game ready to play.  Simply exit to BASIC with the X command and then issue

BOOT"BATTLE BLOX"

This binary is included in the distribution as "BATLBLOX.PRG" and also as the file "BATTLE BLOX" within the 1541 disk image "BATLBLOX.D64".

As an added feature, a boot loader was added to the disk image using Commodore's "AUTOBOOT MAKER" available on the 1571 Test/Demo diskette.
