For the K/X, allow logging to channel A (text screen) without going through the console stuff. This is so we can start logging earlier, and also use that for debugging the console stuff itself.
This commit is contained in:
parent
6e8b1e1e17
commit
954dae8ced
24
src/log.c
24
src/log.c
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "dev/uart.h"
|
||||
#include "dev/txt_screen.h"
|
||||
|
||||
#include "vicky3_txt_a_logger.h"
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560U || MODEL == MODEL_FOENIX_A2560U_PLUS
|
||||
#include "A2560U/gabe_a2560u.h"
|
||||
|
@ -32,6 +32,7 @@ static short log_level;
|
|||
static void (*do_log)(const char* message);
|
||||
static void log_to_uart(const char* message);
|
||||
static void log_to_screen(const char* message);
|
||||
static void log_to_channel_A_low_level(const char *message);
|
||||
|
||||
#define UART_COM1 0
|
||||
|
||||
|
@ -49,14 +50,21 @@ void buzzer_off(void) {
|
|||
void log_init(void) {
|
||||
log_setlevel(DEFAULT_LOG_LEVEL);
|
||||
|
||||
if (log_channel == LOG_CHANNEL_UART0) {
|
||||
switch (log_channel) {
|
||||
case LOG_CHANNEL_UART0:
|
||||
uart_init(UART_COM1);
|
||||
do_log = log_to_uart;
|
||||
//log(LOG_INFO,"FOENIX DEBUG OUTPUT------------");
|
||||
}
|
||||
else
|
||||
|
||||
break;
|
||||
case LOG_CHANNEL_CHANNEL_A_LOW_LEVEL:
|
||||
channel_A_logger_init();
|
||||
do_log = log_to_channel_A_low_level;
|
||||
break;
|
||||
default:
|
||||
do_log = log_to_screen;
|
||||
}
|
||||
log(LOG_INFO,"FOENIX DEBUG OUTPUT------------");
|
||||
}
|
||||
|
||||
unsigned short panic_number; /* The number of the kernel panic */
|
||||
unsigned long panic_pc; /* The PC where the issue occurred */
|
||||
|
@ -257,6 +265,12 @@ static void log_to_screen(const char *message) {
|
|||
txt_print(log_channel, "\n");
|
||||
}
|
||||
|
||||
static void log_to_channel_A_low_level(const char *message) {
|
||||
channel_A_write(message);
|
||||
channel_A_write("\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Log a message to the console.
|
||||
*
|
||||
|
|
|
@ -10,17 +10,18 @@
|
|||
|
||||
#define LOG_CHANNEL_UART0 -1
|
||||
#define LOG_CHANNEL_CHANNEL_A 0
|
||||
#define LOG_CHANNEL_CHANNEL B 1
|
||||
#define LOG_CHANNEL_CHANNEL_B 1
|
||||
#define LOG_CHANNEL_CHANNEL_A_LOW_LEVEL 10 // low-level routines (doesn't use MCP's console stuff)
|
||||
|
||||
/*
|
||||
* Settings
|
||||
*/
|
||||
#ifndef DEFAULT_LOG_LEVEL
|
||||
#define DEFAULT_LOG_LEVEL LOG_ERROR
|
||||
#define DEFAULT_LOG_LEVEL LOG_TRACE
|
||||
#endif
|
||||
|
||||
#ifndef LOG_CHANNEL
|
||||
#define LOG_CHANNEL LOG_CHANNEL_UART0
|
||||
#define LOG_CHANNEL LOG_CHANNEL_CHANNEL_A_LOW_LEVEL
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
323
src/vicky3_txt_a_logger.c
Normal file
323
src/vicky3_txt_a_logger.c
Normal file
|
@ -0,0 +1,323 @@
|
|||
// This is standalone and raw logger for the A2560X/K/GenX channel A
|
||||
// It is meant to be standalone and pretty raw so to minimize chances of failing, as it is used for debugging.
|
||||
|
||||
#include "sys_general.h"
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560K || MODEL == MODEL_FOENIX_A2560X || MODEL == MODEL_FOENIX_GENX
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define VICKY3_A_BASE ((uint8_t*)0xfec40000L)
|
||||
|
||||
|
||||
static const unsigned char MSX_CP437_8x8_bin[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81,
|
||||
0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0x7e,
|
||||
0x00, 0x6c, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10, 0x38, 0x7c, 0xfe,
|
||||
0x7c, 0x38, 0x10, 0x00, 0x38, 0x38, 0xfe, 0xfe, 0x54, 0x10, 0x7c, 0x00,
|
||||
0x10, 0x38, 0x7c, 0xfe, 0xfe, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x18, 0x3c,
|
||||
0x3c, 0x18, 0x00, 0x00, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff,
|
||||
0x00, 0x18, 0x24, 0x42, 0x42, 0x24, 0x18, 0x00, 0xff, 0xe7, 0xdb, 0xbd,
|
||||
0xbd, 0xdb, 0xe7, 0xff, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
|
||||
0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x30, 0x28, 0x24, 0x24,
|
||||
0x28, 0x20, 0xe0, 0xc0, 0x3c, 0x24, 0x3c, 0x24, 0x24, 0xe4, 0xdc, 0x18,
|
||||
0x10, 0x54, 0x28, 0xc6, 0x28, 0x54, 0x10, 0x00, 0x20, 0x30, 0x38, 0x3c,
|
||||
0x38, 0x30, 0x20, 0x00, 0x04, 0x0c, 0x1c, 0x3c, 0x1c, 0x0c, 0x04, 0x00,
|
||||
0x10, 0x38, 0x7c, 0x10, 0x10, 0x7c, 0x38, 0x10, 0x48, 0x48, 0x48, 0x48,
|
||||
0x48, 0x00, 0x48, 0x00, 0x3e, 0x4a, 0x4a, 0x3a, 0x0a, 0x0a, 0x0a, 0x00,
|
||||
0x1c, 0x20, 0x18, 0x24, 0x24, 0x18, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7e, 0x7e, 0x00, 0x10, 0x38, 0x7c, 0x10, 0x7c, 0x38, 0x10, 0xff,
|
||||
0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x54, 0x38, 0x10, 0x00, 0x20, 0x40, 0xff, 0x40, 0x20, 0x00, 0x00,
|
||||
0x00, 0x04, 0x02, 0xff, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40,
|
||||
0x7c, 0x00, 0x00, 0x00, 0x00, 0x24, 0x42, 0xff, 0x42, 0x24, 0x00, 0x00,
|
||||
0x00, 0x10, 0x38, 0x7c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7c, 0x38,
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x28, 0x28, 0x28, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x28, 0x00,
|
||||
0x10, 0x3c, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x60, 0x64, 0x08, 0x10,
|
||||
0x20, 0x4c, 0x0c, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00,
|
||||
0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0x40,
|
||||
0x40, 0x20, 0x10, 0x00, 0x10, 0x08, 0x04, 0x04, 0x04, 0x08, 0x10, 0x00,
|
||||
0x10, 0x54, 0x38, 0x10, 0x38, 0x54, 0x10, 0x00, 0x00, 0x10, 0x10, 0x7c,
|
||||
0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00,
|
||||
0x38, 0x44, 0x44, 0x54, 0x44, 0x44, 0x38, 0x00, 0x10, 0x30, 0x50, 0x10,
|
||||
0x10, 0x10, 0x7c, 0x00, 0x38, 0x44, 0x04, 0x08, 0x30, 0x40, 0x7c, 0x00,
|
||||
0x38, 0x44, 0x04, 0x18, 0x04, 0x44, 0x38, 0x00, 0x08, 0x18, 0x28, 0x48,
|
||||
0x7c, 0x08, 0x08, 0x00, 0x7c, 0x40, 0x70, 0x08, 0x04, 0x08, 0x70, 0x00,
|
||||
0x18, 0x20, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x7c, 0x44, 0x08, 0x10,
|
||||
0x10, 0x10, 0x10, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00,
|
||||
0x38, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00,
|
||||
0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0x00,
|
||||
0x00, 0x7c, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00,
|
||||
0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x38, 0x44, 0x04, 0x34,
|
||||
0x54, 0x54, 0x38, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x00,
|
||||
0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x18, 0x24, 0x40, 0x40,
|
||||
0x40, 0x24, 0x18, 0x00, 0x70, 0x28, 0x24, 0x24, 0x24, 0x28, 0x70, 0x00,
|
||||
0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7c, 0x00, 0x7c, 0x40, 0x40, 0x78,
|
||||
0x40, 0x40, 0x40, 0x00, 0x38, 0x44, 0x40, 0x5c, 0x44, 0x44, 0x38, 0x00,
|
||||
0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x00, 0x38, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x38, 0x00, 0x1c, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00,
|
||||
0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x40, 0x40, 0x40, 0x40,
|
||||
0x40, 0x40, 0x7c, 0x00, 0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00,
|
||||
0x44, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x00, 0x38, 0x44, 0x44, 0x44,
|
||||
0x44, 0x44, 0x38, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00,
|
||||
0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x78, 0x44, 0x44, 0x78,
|
||||
0x50, 0x48, 0x44, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00,
|
||||
0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x44, 0x44, 0x44, 0x44,
|
||||
0x44, 0x44, 0x38, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00,
|
||||
0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, 0x44, 0x44, 0x28, 0x10,
|
||||
0x28, 0x44, 0x44, 0x00, 0x44, 0x44, 0x44, 0x38, 0x10, 0x10, 0x10, 0x00,
|
||||
0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7c, 0x00, 0x3c, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x3c, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00,
|
||||
0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x10, 0x28, 0x44, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
|
||||
0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04,
|
||||
0x3c, 0x44, 0x3c, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00,
|
||||
0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x04, 0x04, 0x34, 0x4c,
|
||||
0x44, 0x4c, 0x34, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x38, 0x00,
|
||||
0x18, 0x24, 0x20, 0x78, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x44,
|
||||
0x44, 0x3c, 0x04, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00,
|
||||
0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00, 0x00, 0x08, 0x00, 0x18,
|
||||
0x08, 0x08, 0x48, 0x30, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00,
|
||||
0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x68, 0x54,
|
||||
0x54, 0x54, 0x54, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00,
|
||||
0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x58, 0x64,
|
||||
0x64, 0x58, 0x40, 0x40, 0x00, 0x00, 0x34, 0x4c, 0x4c, 0x34, 0x04, 0x04,
|
||||
0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x40,
|
||||
0x38, 0x04, 0x78, 0x00, 0x20, 0x20, 0x78, 0x20, 0x20, 0x24, 0x18, 0x00,
|
||||
0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x34, 0x00, 0x00, 0x00, 0x44, 0x44,
|
||||
0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x44, 0x44, 0x54, 0x54, 0x28, 0x00,
|
||||
0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x44, 0x44,
|
||||
0x4c, 0x34, 0x04, 0x38, 0x00, 0x00, 0x7c, 0x08, 0x10, 0x20, 0x7c, 0x00,
|
||||
0x0c, 0x10, 0x10, 0x20, 0x10, 0x10, 0x0c, 0x00, 0x10, 0x10, 0x10, 0x00,
|
||||
0x10, 0x10, 0x10, 0x00, 0x30, 0x08, 0x08, 0x04, 0x08, 0x08, 0x30, 0x00,
|
||||
0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c,
|
||||
0x7c, 0x7c, 0x7c, 0x00, 0x18, 0x24, 0x40, 0x40, 0x24, 0x18, 0x08, 0x30,
|
||||
0x48, 0x00, 0x48, 0x48, 0x48, 0x48, 0x34, 0x00, 0x08, 0x10, 0x38, 0x44,
|
||||
0x7c, 0x40, 0x38, 0x00, 0x10, 0x28, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00,
|
||||
0x28, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, 0x20, 0x10, 0x38, 0x04,
|
||||
0x3c, 0x44, 0x3c, 0x00, 0x38, 0x28, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00,
|
||||
0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x10, 0x30, 0x10, 0x28, 0x38, 0x44,
|
||||
0x7c, 0x40, 0x38, 0x00, 0x28, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x38, 0x00,
|
||||
0x20, 0x10, 0x38, 0x44, 0x7c, 0x40, 0x38, 0x00, 0x28, 0x00, 0x00, 0x30,
|
||||
0x10, 0x10, 0x38, 0x00, 0x10, 0x28, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00,
|
||||
0x20, 0x10, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00, 0x28, 0x00, 0x10, 0x28,
|
||||
0x44, 0x7c, 0x44, 0x00, 0x10, 0x28, 0x10, 0x28, 0x44, 0x7c, 0x44, 0x00,
|
||||
0x08, 0x10, 0x7c, 0x40, 0x78, 0x40, 0x7c, 0x00, 0x00, 0x00, 0x6e, 0x10,
|
||||
0x7c, 0x90, 0x6e, 0x00, 0x3e, 0x50, 0x90, 0xfc, 0x90, 0x90, 0x9e, 0x00,
|
||||
0x10, 0x28, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x28, 0x00, 0x38, 0x44,
|
||||
0x44, 0x44, 0x38, 0x00, 0x20, 0x10, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
|
||||
0x10, 0x28, 0x00, 0x48, 0x48, 0x48, 0x34, 0x00, 0x20, 0x10, 0x00, 0x48,
|
||||
0x48, 0x48, 0x34, 0x00, 0x28, 0x00, 0x44, 0x44, 0x4c, 0x34, 0x04, 0x38,
|
||||
0x28, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x28, 0x00, 0x44, 0x44,
|
||||
0x44, 0x44, 0x38, 0x00, 0x00, 0x10, 0x38, 0x54, 0x50, 0x54, 0x38, 0x10,
|
||||
0x18, 0x24, 0x20, 0x78, 0x20, 0x22, 0x7c, 0x00, 0x44, 0x44, 0x28, 0x7c,
|
||||
0x10, 0x7c, 0x10, 0x00, 0x38, 0x44, 0xf0, 0x40, 0xf0, 0x44, 0x38, 0x00,
|
||||
0x18, 0x24, 0x20, 0x70, 0x20, 0x20, 0x20, 0xc0, 0x08, 0x10, 0x38, 0x04,
|
||||
0x3c, 0x44, 0x3c, 0x00, 0x10, 0x20, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00,
|
||||
0x08, 0x10, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x10, 0x20, 0x00, 0x48,
|
||||
0x48, 0x48, 0x34, 0x00, 0x28, 0x50, 0x00, 0x58, 0x64, 0x44, 0x44, 0x00,
|
||||
0x14, 0x28, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x00, 0x30, 0x08, 0x38, 0x48,
|
||||
0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x10, 0x20, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x7c,
|
||||
0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x00, 0x00,
|
||||
0x42, 0x44, 0x4e, 0x52, 0x2e, 0x48, 0x8e, 0x00, 0x42, 0x44, 0x4a, 0x5a,
|
||||
0x2e, 0x42, 0x82, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00,
|
||||
0x00, 0x12, 0x24, 0x48, 0x24, 0x12, 0x00, 0x00, 0x00, 0x90, 0x48, 0x24,
|
||||
0x48, 0x90, 0x00, 0x00, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22,
|
||||
0xcc, 0x33, 0xcc, 0x33, 0xcc, 0x33, 0xcc, 0x33, 0xee, 0xbb, 0xee, 0xbb,
|
||||
0xee, 0xbb, 0xee, 0xbb, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, 0x10,
|
||||
0xf0, 0x10, 0x10, 0x10, 0x28, 0x28, 0x28, 0xe8, 0x28, 0x28, 0x28, 0x28,
|
||||
0x00, 0x00, 0x00, 0xf8, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0xf0, 0x10,
|
||||
0xf0, 0x10, 0x10, 0x10, 0x28, 0x28, 0xe8, 0x08, 0xe8, 0x28, 0x28, 0x28,
|
||||
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0xf8, 0x08,
|
||||
0xe8, 0x28, 0x28, 0x28, 0x28, 0x28, 0xe8, 0x08, 0xf8, 0x00, 0x00, 0x00,
|
||||
0x28, 0x28, 0x28, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0xf0, 0x10,
|
||||
0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xff, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x1f, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x28, 0x28, 0x28, 0x2f,
|
||||
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x2f, 0x20, 0x3f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3f, 0x20, 0x2f, 0x28, 0x28, 0x28, 0x28, 0x28, 0xef, 0x00,
|
||||
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef, 0x28, 0x28, 0x28,
|
||||
0x28, 0x28, 0x2f, 0x20, 0x2f, 0x28, 0x28, 0x28, 0x00, 0x00, 0xff, 0x00,
|
||||
0xff, 0x00, 0x00, 0x00, 0x28, 0x28, 0xef, 0x00, 0xef, 0x28, 0x28, 0x28,
|
||||
0x10, 0x10, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x10, 0x10, 0x10,
|
||||
0x00, 0x00, 0x00, 0xff, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1f, 0x10, 0x1f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x3f,
|
||||
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xff, 0x28, 0x28, 0x28, 0x28,
|
||||
0x10, 0x10, 0xff, 0x10, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x10, 0x10, 0x10, 0x10,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
|
||||
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x48, 0x48, 0x48, 0x34, 0x00,
|
||||
0x00, 0x00, 0x38, 0x44, 0x78, 0x44, 0x78, 0x40, 0x7c, 0x40, 0x40, 0x40,
|
||||
0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x7e, 0x24, 0x24, 0x24, 0x24, 0x00,
|
||||
0x7c, 0x40, 0x20, 0x10, 0x20, 0x40, 0x7c, 0x00, 0x00, 0x00, 0x3e, 0x44,
|
||||
0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x70, 0x80,
|
||||
0x00, 0x00, 0x34, 0x58, 0x10, 0x10, 0x10, 0x00, 0x7c, 0x10, 0x28, 0x44,
|
||||
0x28, 0x10, 0x7c, 0x00, 0x38, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x38, 0x00,
|
||||
0x38, 0x44, 0x44, 0x44, 0x28, 0x28, 0x6c, 0x00, 0x3c, 0x20, 0x18, 0x44,
|
||||
0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x6c, 0x00, 0x00,
|
||||
0x00, 0x24, 0x4a, 0x52, 0x22, 0x5c, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x40,
|
||||
0x38, 0x40, 0x3c, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00,
|
||||
0x00, 0x7c, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10,
|
||||
0x10, 0x7c, 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x38, 0x00,
|
||||
0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x38, 0x00, 0x0c, 0x12, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60,
|
||||
0x00, 0x10, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x54, 0x08,
|
||||
0x20, 0x54, 0x08, 0x00, 0x00, 0x10, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00, 0x00, 0x1e, 0x10, 0x10, 0x10, 0x10, 0x90, 0x50, 0x20,
|
||||
0x00, 0x38, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x38, 0x04, 0x1c, 0x20,
|
||||
0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
struct vicky3_t {
|
||||
uint32_t control;
|
||||
uint32_t border_control;
|
||||
uint32_t border_color;
|
||||
uint32_t background_color;
|
||||
uint32_t cursor_control;
|
||||
uint32_t cursor_position;
|
||||
uint32_t line_interrupt_01;
|
||||
uint32_t line_interrupt_23;
|
||||
uint32_t font_mgr_0;
|
||||
uint32_t font_mgr_1;
|
||||
uint32_t reserved_0028[6];
|
||||
uint32_t mouse_graphics[16*16*2];
|
||||
uint16_t mouse_control; // Must write as 32bits !
|
||||
uint16_t reserved_c02;
|
||||
uint32_t mouse_position; // Read only
|
||||
uint16_t reserved_c06;
|
||||
uint32_t ps2_byte[3]; // Must write as 32 bits. See doc.
|
||||
};
|
||||
|
||||
struct vicky3_text_memory_t {
|
||||
char display[0x4000];
|
||||
uint8_t notmapped_4000[0x4000];
|
||||
uint8_t color[0x4000];
|
||||
uint8_t nomapped_c000[0x400];
|
||||
uint32_t palette_fg[16];
|
||||
uint32_t palette_bg[16];
|
||||
};
|
||||
|
||||
static volatile struct vicky3_t * const vicky3_a_ctrl = (struct vicky3_t*)VICKY3_A_BASE;
|
||||
static uint8_t * const font_memory = VICKY3_A_BASE + 0x8000;
|
||||
static struct vicky3_text_memory_t * const text_memory = (struct vicky3_text_memory_t*)(VICKY3_A_BASE + 0x20000);
|
||||
|
||||
static void scroll();
|
||||
void channel_A_cls(char c);
|
||||
|
||||
void channel_A_logger_init(void)
|
||||
{
|
||||
vicky3_a_ctrl->control = 1; // Text enable, enable video, 800x600, no gamma
|
||||
vicky3_a_ctrl->border_color = 0; // No border
|
||||
vicky3_a_ctrl->background_color = 0x00110033UL; // xxRGB
|
||||
vicky3_a_ctrl->cursor_control = 0x027F0007UL;
|
||||
|
||||
// Load font
|
||||
for (int i=0; i<0x1000; i++)
|
||||
font_memory[i] = MSX_CP437_8x8_bin[i];
|
||||
|
||||
// Setup colors
|
||||
text_memory->palette_fg[0] = vicky3_a_ctrl->background_color;
|
||||
text_memory->palette_fg[1] = 0x00ffffff; // White
|
||||
text_memory->palette_fg[2] = 0x00ff0000; // Used for cursor color
|
||||
|
||||
channel_A_cls();
|
||||
}
|
||||
|
||||
#define COL_COUNT (800/8)
|
||||
#define LINE_COUNT (600/8)
|
||||
|
||||
|
||||
void channel_A_cls()
|
||||
{
|
||||
// Clear screen
|
||||
for (int i=0; i<0x4000; i++)
|
||||
{
|
||||
text_memory->display[i] = 0;
|
||||
text_memory->color[i] = 0x10; // Foreground: color 1, background: color 0 (ie transparent color);
|
||||
}
|
||||
}
|
||||
|
||||
void channel_A_write(const char *c)
|
||||
{
|
||||
uint32_t x,y;
|
||||
|
||||
x = y = vicky3_a_ctrl->cursor_position;
|
||||
x &= 0xffff;
|
||||
y = (y >> 16);
|
||||
|
||||
while (c && *c)
|
||||
{
|
||||
if (*c == '\r')
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
else if (*c == '\n')
|
||||
{
|
||||
if (y == LINE_COUNT-1)
|
||||
scroll();
|
||||
else
|
||||
y++;
|
||||
x = 0; // Assume we intend that \n = \r\n
|
||||
}
|
||||
else
|
||||
{
|
||||
text_memory->display[COL_COUNT*y + x] = *c;
|
||||
|
||||
if (++x == COL_COUNT)
|
||||
channel_A_write("\n");
|
||||
}
|
||||
|
||||
vicky3_a_ctrl->cursor_position = (y << 16) | x;
|
||||
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void scroll()
|
||||
{
|
||||
#define COPY_BYTE_BY_BYTE
|
||||
#ifdef COPY_BYTE_BY_BYTE
|
||||
char *src = &text_memory->display[1*COL_COUNT];
|
||||
char *dst = &text_memory->display[0];
|
||||
for (int i=0 ; i<((LINE_COUNT-1)*COL_COUNT)/4; i++)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
}
|
||||
for (int i=0; i < COL_COUNT/4; i++)
|
||||
{
|
||||
*dst++ = ' ';
|
||||
*dst++ = ' ';
|
||||
*dst++ = ' ';
|
||||
*dst++ = ' ';
|
||||
}
|
||||
#else
|
||||
// This doesn't work because it uses 16/32 byte writes
|
||||
memcpy(&text_memory->display[COL_COUNT], &text_memory->display[0], COL_COUNT*LINE_COUNT-1);
|
||||
memset(&text_memory->display[COL_COUNT*LINE_COUNT-1], COL_COUNT, 0); // VBCC doesn't know bzero
|
||||
#endif
|
||||
// If we used background colours we would have to scroll them as well, but we don't.
|
||||
}
|
||||
|
||||
#endif
|
14
src/vicky3_txt_a_logger.h
Normal file
14
src/vicky3_txt_a_logger.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef VICKY3_TXT_A_LOGGER
|
||||
#define VICKY3_TXT_A_LOGGER
|
||||
|
||||
#include "sys_general.h"
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560K || MODEL == MODEL_FOENIX_A2560X || MODEL == MODEL_FOENIX_GENX
|
||||
|
||||
void channel_A_logger_init(void);
|
||||
void channel_A_cls();
|
||||
void channel_A_write(const char *c);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue