11 #include "../include/utilities.h" 12 #include "../include/mystring.h" 13 #include "../filesystem/API/fsapi.h" 16 #define BUFFER_SIZE 64 17 #define PROMT "yb@yb-thinkpad-e450:~$ " 18 #define HELP_MSG " run <program> : run program <program>\n\r" \ 19 " \t e.g. run stoneQ: run program stoneQ.bin\n\r" \ 20 " \t in program, press Q to exit\n\r" \ 21 " ls : list all file in root directory\n\r"\ 22 " showinfo: print my id 16337269 in 3-D mod" 23 #define LOW_8_MASK (0b11111111) 24 #define GET_LOW_8BITS(X) (X & LOW_8_MASK) 25 #define GET_HIGH_8BITS(X) (X >> 8) 26 #include "../include/stdio.h" 27 #include "../include/graphic.h" 28 #define TERMINAL_STYLE (TO_FN(G_PINKISH)) 88 if (CMDindex == 0)
return;
93 int (*userProgram)() = (
int (*)())(0x6c00);
96 putln(
"ERROR: system protect file");
99 putln(
"ERROR: folder not executable");
102 putln(
"ERROR: partition info protect");
105 putln(
"ERROR: file not found");
117 printf(
"%10s|%20s|%10s\n",
"filename",
"filesize(bytes)",
"begin cluster");
139 printf(
"cursor row is %d, col is %d\n",
row, col);
149 printf(
"old row %d col %d, new row %d col %d\n", orow, ocol, nrow, ncol);
162 puts(
"ybsh: command not found: ");
static void __screen_scroll(uint16_t row_col_lu, uint16_t row_col_rd, uint8_t lines, uint16_t direction)
#define ERR_TYPE_DOC
target type is partition doc, unable
static int16_t strstr(const char *src, const char *tar)
void kb_interupt_install()
static FAT_ITEM * __next_item(FAT_ITEM *p)
#define ERR_NOT_FOUND
file not found
static int16_t strchr(const char *str, char chr)
#define ERR_TYPE_FLDR
target type is folder, unable to execute the operation
char CMD_BUFFER[BUFFER_SIZE+10]
void kb_interupt_uninstall()
static int16_t __load_program(const char *targetFilename)
uint32_t filesize
in bytes
static int16_t putch(char ch)
#define GET_HIGH_8BITS(X)
#define BACK_SPACE
'' ascii
int strcmp(const char *lhs, const char *rhs)
static uint16_t get_cursor()
static int16_t puts_style(char const *str, uint8_t style)
#define ERR_SYS_PROTC
system protected file, not allow executing the operation
static void set_cursor(uint8_t row, uint8_t col)
static int printf(const char *format,...)
static FAT_ITEM * CUR_DIR
current directory pointer
static int16_t putln(char const *str)
static FAT_ITEM * __get_root_dir()
#define BUFFER_SIZE
buffer size for parcing command
static int16_t __has_next_item(const FAT_ITEM *p)
static int16_t puts(char const *str)
static int16_t __FAT_showable_item(const FAT_ITEM *p)