Banner Update
Updated the banner printed in the credits and modified the CLI to print the banner only on initial startup.
This commit is contained in:
parent
7256df53c9
commit
22ead3534a
|
@ -440,7 +440,7 @@ void boot_from_bdev(short device) {
|
|||
|
||||
} else {
|
||||
// No over-ride provided... boot the default
|
||||
cli_repl(cli_screen, initial_path);
|
||||
cli_start_repl(cli_screen, initial_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
118
src/cli/cli.c
118
src/cli/cli.c
|
@ -85,6 +85,9 @@ extern short cmd_credits(short channel, int argc, const char * argv[]);
|
|||
* Variables
|
||||
*/
|
||||
|
||||
/** The model number of the current machine */
|
||||
short g_model_id = 0;
|
||||
|
||||
/** The channel to use for interactions */
|
||||
short g_current_channel = 0;
|
||||
|
||||
|
@ -313,9 +316,13 @@ char * strtok_r(char * source, const char * delimiter, char ** saveptr) {
|
|||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactivate the CLI's read-eval-print loop after a command has completed
|
||||
*/
|
||||
void cli_rerepl() {
|
||||
while (1) {
|
||||
cli_repl(g_current_channel, 0);
|
||||
print(g_current_channel, "\n\n");
|
||||
cli_repl(g_current_channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,45 +515,18 @@ short cli_getchar(short channel) {
|
|||
} while (1);
|
||||
}
|
||||
|
||||
char line[256];
|
||||
char line[128];
|
||||
|
||||
/**
|
||||
* Print out the credits
|
||||
*/
|
||||
short cmd_credits(short channel, int argc, const char * argv[]) {
|
||||
const char * color_bars = "\x1b[31m\x0b\x0c\x1b[35m\x0b\x0c\x1b[33m\x0b\x0c\x1b[32m\x0b\x0c\x1b[36m\x0b\x0c";
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560U
|
||||
const char * title_1 = "\x1b[37m A 2222 55555 666 000 U U";
|
||||
const char * title_2 = "\x1b[37m A A 2 5 6 0 0 U U";
|
||||
const char * title_3 = "\x1b[37m AAAAA 222 555 6666 0 0 U U";
|
||||
const char * title_4 = "\x1b[37m A A 2 5 6 6 0 0 U U";
|
||||
const char * title_5 = "\x1b[37m A A 22222 5555 666 000 UUU";
|
||||
#elif MODEL == MODEL_FOENIX_A2560U_PLUS
|
||||
const char * title_1 = "\x1b[37m A 2222 55555 666 000 U U +";
|
||||
const char * title_2 = "\x1b[37m A A 2 5 6 0 0 U U +";
|
||||
const char * title_3 = "\x1b[37m AAAAA 222 555 6666 0 0 U U +++++";
|
||||
const char * title_4 = "\x1b[37m A A 2 5 6 6 0 0 U U +";
|
||||
const char * title_5 = "\x1b[37m A A 22222 5555 666 000 UUU +";
|
||||
#elif MODEL == MODEL_FOENIX_A2560K
|
||||
const char * title_1 = "\x1b[37m A 2222 55555 666 000 K K";
|
||||
const char * title_2 = "\x1b[37m A A 2 5 6 0 0 K K";
|
||||
const char * title_3 = "\x1b[37m AAAAA 222 555 6666 0 0 KKK";
|
||||
const char * title_4 = "\x1b[37m A A 2 5 6 6 0 0 K K";
|
||||
const char * title_5 = "\x1b[37m A A 22222 5555 666 000 K K";
|
||||
#else
|
||||
const char * title_1 = "\x1b[37m FFFFF OOO EEEEE N N IIIII X X";
|
||||
const char * title_2 = "\x1b[37m F O O E NN N I X X";
|
||||
const char * title_3 = "\x1b[37m FFF O O EEE N N N I X";
|
||||
const char * title_4 = "\x1b[37m F O O E N NN I X X";
|
||||
const char * title_5 = "\x1b[37m F OOO EEEEE N N IIIII X X";
|
||||
#endif
|
||||
|
||||
|
||||
short scan_code = 0;
|
||||
|
||||
sprintf(line, "\x1b[2J\x1b[H");
|
||||
print(channel, line);
|
||||
print(channel, "\x1b[2J\x1b[1;2H");
|
||||
print_banner(channel, g_model_id);
|
||||
|
||||
sprintf(line, " %s%s\n %s %s\n %s %s\n %s %s\n%s %s\n\n", color_bars, title_1, color_bars, title_2, color_bars, title_3, color_bars, title_4, color_bars, title_5);
|
||||
print(channel, line);
|
||||
print(channel, "\n");
|
||||
|
||||
sprintf(line, "| Version | %02d.%02d-alpha+%04d |\n", VER_MAJOR, VER_MINOR, VER_BUILD);
|
||||
print_box(channel, "{-------------------------------------------------------------}\n");
|
||||
|
@ -569,9 +549,7 @@ short cmd_credits(short channel, int argc, const char * argv[]) {
|
|||
scan_code = sys_kbd_scancode();
|
||||
} while (scan_code != 0x01);
|
||||
|
||||
sprintf(line, "\x1b[2J\x1b[H");
|
||||
print(channel, line);
|
||||
|
||||
print(channel,"\x1b[2J\x1b[H");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -835,12 +813,17 @@ void cli_setup_screen(short channel, const char * path, short is_active) {
|
|||
// Draw the window
|
||||
cli_draw_window(channel, path, is_active);
|
||||
print(channel, "\x1b[2J\x1b[1;2H");
|
||||
|
||||
print(channel, "\x1b[2J\x1b[1;2H");
|
||||
print_banner(channel, g_model_id);
|
||||
|
||||
print(channel, "\nType HELP or ? for help.\n");
|
||||
}
|
||||
|
||||
//
|
||||
// Enter the CLI's read-eval-print loop
|
||||
//
|
||||
short cli_repl(short channel, const char * init_cwd) {
|
||||
short cli_repl(short channel) {
|
||||
char command_line[MAX_COMMAND_SIZE];
|
||||
char cwd_buffer[MAX_PATH_LEN];
|
||||
short result = 0;
|
||||
|
@ -849,26 +832,6 @@ short cli_repl(short channel, const char * init_cwd) {
|
|||
short old_channel;
|
||||
|
||||
old_channel = channel;
|
||||
g_current_channel = channel;
|
||||
|
||||
if (init_cwd != 0) {
|
||||
result = sys_fsys_set_cwd(init_cwd);
|
||||
if (result) {
|
||||
char message[80];
|
||||
sprintf(message, "Unable to set startup directory: %s\n", err_message(result));
|
||||
print(g_current_channel, message);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the screen(s)
|
||||
cli_setup_screen(channel, init_cwd, 1); // Initialize our main main screen
|
||||
if (g_num_screens > 1) {
|
||||
for (i = 0; i < g_num_screens; i++) { // Set up each screen we aren't using
|
||||
if (i != channel) {
|
||||
cli_setup_screen(i, init_cwd, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_cwd_changed = 1;
|
||||
cursor.x = 0;
|
||||
|
@ -932,6 +895,42 @@ short cli_repl(short channel, const char * init_cwd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the read-eval-print loop
|
||||
*
|
||||
* @param channel the channel to use for interactions
|
||||
* @param init_cwd the initial current working directory
|
||||
*/
|
||||
short cli_start_repl(short channel, const char * init_cwd) {
|
||||
char cwd_buffer[MAX_PATH_LEN];
|
||||
short result = 0;
|
||||
short i = 0;
|
||||
t_point cursor;
|
||||
|
||||
g_current_channel = channel;
|
||||
|
||||
if (init_cwd != 0) {
|
||||
result = sys_fsys_set_cwd(init_cwd);
|
||||
if (result) {
|
||||
char message[80];
|
||||
sprintf(message, "Unable to set startup directory: %s\n", err_message(result));
|
||||
print(g_current_channel, message);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the screen(s)
|
||||
cli_setup_screen(channel, init_cwd, 1); // Initialize our main main screen
|
||||
if (g_num_screens > 1) {
|
||||
for (i = 0; i < g_num_screens; i++) { // Set up each screen we aren't using
|
||||
if (i != channel) {
|
||||
cli_setup_screen(i, init_cwd, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cli_repl(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a batch file at the given path
|
||||
*
|
||||
|
@ -1091,6 +1090,7 @@ short cli_init() {
|
|||
|
||||
// Figure out how many screens we have
|
||||
sys_get_info(&info);
|
||||
g_model_id = info.model;
|
||||
g_num_screens = info.screens;
|
||||
|
||||
cli_set_init();
|
||||
|
|
|
@ -26,14 +26,25 @@ typedef short (*cli_cmd_handler)(short screen, int argc, const char * argv[]);
|
|||
*/
|
||||
extern short cli_init();
|
||||
|
||||
/**
|
||||
* Start the read-eval-print loop
|
||||
*
|
||||
* @param channel the channel to use for interactions
|
||||
* @param init_cwd the initial current working directory
|
||||
*/
|
||||
extern short cli_start_repl(short channel, const char * init_cwd);
|
||||
|
||||
/**
|
||||
* Reactivate the CLI's read-eval-print loop after a command has completed
|
||||
*/
|
||||
extern void cli_rerepl();
|
||||
|
||||
/**
|
||||
* Enter the CLI's read-eval-print loop
|
||||
*
|
||||
* Inputs:
|
||||
* channel = the console channel to use for I/O
|
||||
* init_cwd = pointer to the path for the initial current working directory
|
||||
* @param channel the channel to use for interactions
|
||||
*/
|
||||
extern short cli_repl(short channel, const char * init_cwd);
|
||||
extern short cli_repl(short channel);
|
||||
|
||||
/*
|
||||
* Evaluate an argument to a number
|
||||
|
|
8533
src/foenixmcp.s68
8533
src/foenixmcp.s68
File diff suppressed because it is too large
Load diff
18201
src/mapfile
18201
src/mapfile
File diff suppressed because it is too large
Load diff
131
src/simpleio.c
131
src/simpleio.c
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "syscalls.h"
|
||||
#include "simpleio.h"
|
||||
#include "dev/txt_screen.h"
|
||||
|
@ -42,6 +43,15 @@ void print_box(short channel, const char * message) {
|
|||
char c;
|
||||
for (x = message; *x; x++) {
|
||||
switch (*x) {
|
||||
case 0x1B:
|
||||
// ESC... print this and the next character
|
||||
sys_chan_write_b(channel, 0x1B);
|
||||
if (*(x+1) == '[') {
|
||||
sys_chan_write_b(channel, '[');
|
||||
x++;
|
||||
}
|
||||
break;
|
||||
|
||||
case '{':
|
||||
// Upper-left angle
|
||||
c = 0xDA;
|
||||
|
@ -97,6 +107,11 @@ void print_box(short channel, const char * message) {
|
|||
c = 0xC5;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
// Block
|
||||
c = 0xDB;
|
||||
break;
|
||||
|
||||
default:
|
||||
c = *x;
|
||||
break;
|
||||
|
@ -294,3 +309,119 @@ void str_upcase(const char * src, char * dst) {
|
|||
}
|
||||
dst[strlen(src)] = 0;
|
||||
}
|
||||
|
||||
const char * model_banner[] = {
|
||||
// 0 = C256 FMX
|
||||
" _________ ___________ ________ ____ __",
|
||||
" / ____/__ \\ / ____/ ___/ / ____/ |/ / |/ /",
|
||||
" / / __/ //___ \\/ __ \\ / /_ / /|_/ /| / ",
|
||||
"/ /___ / __/____/ / /_/ / / __/ / / / // | ",
|
||||
"\\____//____/_____/\\____/ /_/ /_/ /_//_/|_| ",
|
||||
|
||||
// 1 = C256 U
|
||||
" _________ ___________ __ __",
|
||||
" / ____/__ \\ / ____/ ___/ / / / /",
|
||||
" / / __/ //___ \\/ __ \\ / / / / ",
|
||||
"/ /___ / __/____/ / /_/ / / /_/ / ",
|
||||
"\\____//____/_____/\\____/ \\____/ ",
|
||||
|
||||
// 2 = Blank
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
// 3 = Blank
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
// 4 = A2560 GENX
|
||||
" ___ ___ ___________ ____ _____________ ___ __",
|
||||
" / | |__ \\ / ____/ ___// __ \\ / ____/ ____/ | / / |/ /",
|
||||
" / /| | __/ //___ \\/ __ \\/ / / / / / __/ __/ / |/ /| / ",
|
||||
" / ___ |/ __/____/ / /_/ / /_/ / / /_/ / /___/ /| // | ",
|
||||
"/_/ |_/____/_____/\\____/\\____/ \\____/_____/_/ |_//_/|_| ",
|
||||
|
||||
// 5 = C256 U+
|
||||
" _________ ___________ __ __ ",
|
||||
" / ____/__ \\ / ____/ ___/ / / / / __ ",
|
||||
" / / __/ //___ \\/ __ \\ / / / /_/ /_",
|
||||
"/ /___ / __/____/ / /_/ / / /_/ /_ __/",
|
||||
"\\____//____/_____/\\____/ \\____/ /_/ ",
|
||||
|
||||
// 6 = A2560 U+
|
||||
" ___ ___ ___________ ____ __ __ ",
|
||||
" / | |__ \\ / ____/ ___// __ \\ / / / / __ ",
|
||||
" / /| | __/ //___ \\/ __ \\/ / / / / / / /_/ /_",
|
||||
" / ___ |/ __/____/ / /_/ / /_/ / / /_/ /_ __/",
|
||||
"/_/ |_/____/_____/\\____/\\____/ \\____/ /_/ ",
|
||||
|
||||
// 7 = Blank
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
// 8 = A2560 X
|
||||
" ___ ___ ___________ ____ _ __",
|
||||
" / | |__ \\ / ____/ ___// __ \\ | |/ /",
|
||||
" / /| | __/ //___ \\/ __ \\/ / / / | / ",
|
||||
" / ___ |/ __/____/ / /_/ / /_/ / / | ",
|
||||
"/_/ |_/____/_____/\\____/\\____/ /_/|_| ",
|
||||
|
||||
// 9 = A2560 U
|
||||
" ___ ___ ___________ ____ __ __",
|
||||
" / | |__ \\ / ____/ ___// __ \\ / / / /",
|
||||
" / /| | __/ //___ \\/ __ \\/ / / / / / / / ",
|
||||
" / ___ |/ __/____/ / /_/ / /_/ / / /_/ / ",
|
||||
"/_/ |_/____/_____/\\____/\\____/ \\____/ ",
|
||||
|
||||
// 10 = Blank
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
// 11 = A2560 K
|
||||
" ___ ___ ___________ ____ __ __",
|
||||
" / | |__ \\ / ____/ ___// __ \\ / //_/",
|
||||
" / /| | __/ //___ \\/ __ \\/ / / / / ,< ",
|
||||
" / ___ |/ __/____/ / /_/ / /_/ / / /| | ",
|
||||
"/_/ |_/____/_____/\\____/\\____/ /_/ |_| "
|
||||
};
|
||||
|
||||
/**
|
||||
* Print out the bannerized name of the model, given its ID
|
||||
*
|
||||
* @param channel the number of the channel to print on
|
||||
* @param model_id the number of the particular Foenix model
|
||||
*/
|
||||
void print_banner(short channel, short model_id) {
|
||||
const char * color_bars = "\x1b[31m\x0b\x0c\x1b[35m\x0b\x0c\x1b[33m\x0b\x0c\x1b[32m\x0b\x0c\x1b[36m\x0b\x0c\x1b[37m";
|
||||
const short lines_per_model = 5;
|
||||
const short max_model_id = 11;
|
||||
char line[80];
|
||||
|
||||
if (model_id <= max_model_id) {
|
||||
short index = model_id * lines_per_model;
|
||||
int i = 0, j = 0;
|
||||
|
||||
for (i = 0; i < lines_per_model; i++) {
|
||||
for (j = lines_per_model - i - 1; j > 0; j--) {
|
||||
sys_chan_write_b(channel, ' ');
|
||||
}
|
||||
print(channel, color_bars);
|
||||
for (j = 0; j < i; j++) {
|
||||
sys_chan_write_b(channel, ' ');
|
||||
}
|
||||
print(channel, model_banner[index+i]);
|
||||
sys_chan_write_b(channel, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,4 +99,12 @@ extern void dump_buffer(short channel, const unsigned char * buffer, short size,
|
|||
*/
|
||||
extern void str_upcase(const char * src, char * dst);
|
||||
|
||||
/**
|
||||
* Print out the bannerized name of the model, given its ID
|
||||
*
|
||||
* @param channel the number of the channel to print on
|
||||
* @param model_id the number of the particular Foenix model
|
||||
*/
|
||||
extern void print_banner(short channel, short model_id);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue