The cheapest way to clear the screen is:
Code: Select all
_console_clear((char*)0x800, 0x00,120); /* 0x00 is the background color */
This calls SYS_SetMemory 120 times, one for each row of the screen. No dependencies.
You can add option --no-runtime-bss to save another 100 bytes or so.
Instead of "SYS_Random() % 64", try "SYS_Random() & 63" to avoid importing the division code.
You can also save some code by using a pointer (const char*) instead of an index (int) to scan the Arecibo string.
Finally, to make it work on a 32K gigatron, you need to split the string in pieces of about 92 bytes max. One way to do this is to have a code in the string that gives the address of the next one. To do this in C, you probably need to initialize the string like
Code: Select all
#define JUMPCODE '@'
#deifne hi(addr) (((int)(addr)&0xff00)>>8)
#define lo(addr) ((int)(addr)&0xff)
char part1[92] = { 'A', '0', ... , JUMPCODE,lo(part2), hi(part2) };
char part2[92] = { ..... , JUMPCODE, lo(part2), hi(part2) };
char part3[92] = ....
and of course you need to handle JUMPCODE in your decoding routine. But since you no longer can use the convenient string syntax, you could just as well store 8 bits per byte, and use code 0x00 or any unused 8 bit combination as a jump code. Anyway, endless possibilities.