dos33fsprogs/basic/appleiibot/convert_qkumba.c

33 lines
848 B
C
Raw Normal View History

2020-10-05 03:50:13 +00:00
/* code by qkumba */
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
2020-10-05 03:50:13 +00:00
int i = 0;
int e = 0,filesize;
unsigned char in[1024];
unsigned char enc[1024];
2020-10-09 05:06:02 +00:00
printf("1REM");
2020-10-05 03:50:13 +00:00
filesize=read(0,in,1024);
do {
enc[e++] = ((in[i + 2] & 3) << 4) +
((in[i + 1] & 3) << 2) + (in[i + 0] & 3) + 32;
2020-10-09 05:06:02 +00:00
if (i<filesize) printf("%c",(in[i + 0] >> 2) + 32);
if (i + 1 < filesize) printf("%c",(in[i + 1] >> 2) + 32);
if (i + 2 < filesize) printf("%c",(in[i + 2] >> 2) + 32);
2020-10-05 03:50:13 +00:00
} while ((i += 3) < filesize);
enc[e]=0;
2020-10-09 05:06:02 +00:00
2020-10-05 03:50:13 +00:00
printf("%s\n",enc);
2020-12-06 05:47:52 +00:00
printf("2FORI=0TO%d:C=(PEEK(%d+I/3)-32)/4^(I-INT(I/3)*3):POKE768+I,C+4*(PEEK(2054+I)-32-INT(C/4)):NEXT:CALL768\n",
2020-10-09 05:06:02 +00:00
filesize,2054+filesize);
2020-10-05 03:50:13 +00:00
2020-10-17 19:21:25 +00:00
// note, peek/poke truncate?
//2FORI=1013TO1141:C=(PEEK(1843+I/3)-32)/4^(I-INT(I/3)*3):POKEI,C+4*(PEEK(1041+I)-32-INT(C/4)):NEXT:&
2020-10-05 03:50:13 +00:00
return 0;
}