eaxhla/tool/xfat.c
2024-07-24 07:47:32 -04:00

42 lines
1.3 KiB
C

/* Ignore this file, it's for my autistic way of testing. -- xolatile */
#include <xolatile/xtandard.c>
#define header \
"#include <stdio.h>\n" \
"#include <stdlib.h>\n" \
"#include \"../source/assembler.h\"\n" \
"#include \"../source/assembler.c\"\n" \
"static unsigned int array [] = { "
#define footer \
"};\n" \
"int main (void) {\n" \
" unsigned int index;\n" \
" assemble ((unsigned int) (sizeof (array) / sizeof (array [0])), array);\n" \
" for (index = 0; index < text_sector_size; ++index)\n" \
" printf (\"%02X \", text_sector_byte [index]);\n" \
" return (0);\n" \
"}\n"
int main (int argc, char * * argv) {
int file, i;
file = file_open ("x.c", O_RDWR | O_CREAT | O_TRUNC);
file_echo (file, header);
for (i = 1; i < argc; ++i) {
file_echo (file, argv [i]);
file_echo (file, ", ");
}
file_echo (file, footer);
file = file_close (file);
execute ("gcc x.c && ./a.out && echo -- && rm a.out x.c");
return (log_success);
}