2021-08-05 05:10:08 +00:00
|
|
|
/* by qkumba */
|
|
|
|
|
|
|
|
/* plaintext machine language for 6+2 encoding suitable for basic bot */
|
|
|
|
|
|
|
|
/* unfortunately the tokenizer has apple II enhanced behavior */
|
|
|
|
/* where lowercase letters outside of quotes/rem are uppercased */
|
|
|
|
|
|
|
|
|
2021-08-04 22:48:03 +00:00
|
|
|
#include <fcntl.h>
|
2021-08-04 23:48:19 +00:00
|
|
|
//#include <io.h>
|
2021-08-04 22:48:03 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2021-08-04 23:48:19 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#ifndef O_BINARY
|
|
|
|
#define O_BINARY 0
|
|
|
|
#define O_TEXT 0
|
|
|
|
#endif
|
2021-08-04 22:48:03 +00:00
|
|
|
|
2021-08-05 05:09:06 +00:00
|
|
|
static unsigned char decoder[] = "\"******GRASCDEFITa!DEL0GR)@I\\q}F0jjjjjjjF0jFORLOGASCsONERR0)}=LENpPOSlo";
|
2021-08-04 23:48:19 +00:00
|
|
|
|
2021-08-05 05:09:06 +00:00
|
|
|
void main(int argc, char *argv[])
|
|
|
|
{
|
2021-08-04 22:48:03 +00:00
|
|
|
int i, l, j, b2, b6;
|
|
|
|
unsigned char b[150];
|
|
|
|
unsigned char bb2[150];
|
|
|
|
unsigned char bb6[150];
|
2021-08-04 23:48:19 +00:00
|
|
|
char call[32];
|
2021-08-04 22:48:03 +00:00
|
|
|
|
|
|
|
memset(b, 0, sizeof(b));
|
|
|
|
i = open(argv[1], O_RDONLY | O_BINARY);
|
|
|
|
l = read(i, b, sizeof(b));
|
|
|
|
close(i);
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
b2 = 0;
|
|
|
|
b6 = sizeof(bb6);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
unsigned char c;
|
|
|
|
|
|
|
|
if (!(j % 3))
|
|
|
|
{
|
|
|
|
c = ((((b[j + 0] >> 6) & 2) + (b[j + 0] & 1)) << 0)
|
|
|
|
+ ((((b[j + 1] >> 6) & 2) + (b[j + 1] & 1)) << 2)
|
|
|
|
+ ((((b[j + 2] >> 6) & 2) + (b[j + 2] & 1)) << 4)
|
2021-08-05 05:09:06 +00:00
|
|
|
+ 0x2b
|
|
|
|
- (7 * (int) !j);
|
2021-08-04 22:48:03 +00:00
|
|
|
|
2021-08-05 05:09:06 +00:00
|
|
|
bb2[b2++] = c;
|
2021-08-04 22:48:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
c = ((b[j] >> 1) & 0x3f) + 0x23 + (int) !(j % 3);
|
|
|
|
|
|
|
|
bb6[--b6] = c;
|
|
|
|
}
|
|
|
|
while (++j < l);
|
|
|
|
|
|
|
|
sprintf(call, "0CALL%d\"", 2049+10+b2+6+(int)sizeof(bb6)-b6+1);
|
2021-08-05 05:09:06 +00:00
|
|
|
i = open("out", O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, 0x80);
|
2021-08-04 22:48:03 +00:00
|
|
|
write(i, call, strlen(call));
|
|
|
|
write(i, bb2, b2);
|
2021-08-05 05:09:06 +00:00
|
|
|
write(i, "\n1\"", sizeof("\n1\"")-1);
|
2021-08-04 22:48:03 +00:00
|
|
|
write(i, bb6 + b6, sizeof(bb6) - b6);
|
|
|
|
write(i, decoder, sizeof(decoder)-1);
|
2021-08-05 05:09:06 +00:00
|
|
|
write(i, "\n",1);
|
2021-08-04 22:48:03 +00:00
|
|
|
close(i);
|
|
|
|
}
|