Move code out of main and into their own files
All of the SD card commands are moved into their own file, with functions sd_init, sd_get_rca, sd_select_card, sd_get_status, and sd_readblock. The FAT functions are movied into fat.c and give functions fat_init and fat_read. Note that the filename is ignored for now, it always reads the first file in the root directory. The loading of o65 files is done in o65.c, and executing is done in exec.c This cleans up the main file signifigantly and leaves the project open to expansion.
This commit is contained in:
28
sw/o65.c
Normal file
28
sw/o65.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <conio.h>
|
||||
|
||||
#include "o65.h"
|
||||
|
||||
void o65_print_option(o65_opt_t* opt) {
|
||||
int i;
|
||||
|
||||
cprintf("Option Length: %d\n", opt->olen);
|
||||
cprintf("Option Type: %x ", opt->type);
|
||||
|
||||
switch (opt->type) {
|
||||
case O65_OPT_FILENAME: cprintf("Filename\n"); break;
|
||||
case O65_OPT_OS: cprintf("OS\n"); break;
|
||||
case O65_OPT_ASSEMBLER: cprintf("Assembler\n"); break;
|
||||
case O65_OPT_AUTHOR: cprintf("Author\n"); break;
|
||||
case O65_OPT_DATE: cprintf("Creation Date\n"); break;
|
||||
default: cprintf("Invalid\n"); break;
|
||||
}
|
||||
|
||||
if (opt->type != O65_OPT_OS) {
|
||||
for (i = 0; i < opt->olen - 2; i++) {
|
||||
cprintf("%c", opt->data[i]);
|
||||
}
|
||||
} else {
|
||||
cprintf("%x", opt->data[0]);
|
||||
}
|
||||
cprintf("\n\n");
|
||||
}
|
||||
Reference in New Issue
Block a user