Added PANIC and version info

Added a panic screen that should come up for various exceptions. Made a few other minor changes.
This commit is contained in:
Peter Weingartner 2021-10-19 20:35:41 -04:00
parent 526d47aadb
commit 1db976edb5
15 changed files with 13183 additions and 7820 deletions

View file

@ -102,6 +102,7 @@ short cmd_cls(short channel, int argc, char * argv[]) {
*/
short cmd_sysinfo(short channel, int argc, char * argv[]) {
t_sys_info info;
char buffer[80];
sys_get_info(&info);
print(channel, "System information:\nModel: ");
@ -120,6 +121,9 @@ short cmd_sysinfo(short channel, int argc, char * argv[]) {
print(channel, "\nVICKY version: ");
print_hex_16(channel, info.vicky_rev);
sprintf(buffer, "\nMCP version: v%02d.%02d.%04d", info.mcp_version, info.mcp_rev, info.mcp_build);
print(channel, buffer);
print(channel, "\n");
return 0;

View file

@ -126,9 +126,6 @@ int text_init() {
*chan_a->master_control = VKY3_MCR_TEXT_EN; /* Set to text only mode: 640x480 */
chan_a->border_control[0] = 0x00102001; // Enable border
chan_a->border_control[1] = 0x00008080; // Cyan border
/* Set the font for channel A */
for (i = 0; i < 0x800; i++) {
@ -136,6 +133,7 @@ int text_init() {
VICKY_TXT_FONT_A[i] = b;
}
text_set_border(0, 1, 0x20, 0x10, 0x00008080);
text_setsizes(0);
text_set_color(0, 0xf, 4);
text_set_cursor(0, 0xF3, 0xB1, 1, 1);
@ -174,6 +172,33 @@ int text_init() {
return 0;
}
/*
* Set the border
*
* Inputs:
* screen = the screen number 0 for channel A, 1 for channel B
* visible = 0 to hide, any other number to show
* width = the horizontal thickness of the border in pixels
* height = the vertical thickness of the border in pixels
* color = the RGB color (xxRRGGBB)
*/
void text_set_border(short screen, short visible, short width, short height, unsigned long color) {
if (screen < MAX_TEXT_CHANNELS) {
p_text_channel chan = &text_channel[screen];
if (visible) {
/* Set the width and color */
chan->border_control[0] = ((height & 0xff) << 16) | ((width & 0xff) << 8) | 1;
chan->border_control[1] = (color & 0x00ff0000) | ((color & 0xff) << 8) | ((color & 0xff00) >> 8);
} else {
/* Hide the border and make it 0 width */
chan->border_control[0] = 0;
chan->border_control[1] = 0;
}
}
}
/*
* Set the cursor properties
*

View file

@ -22,6 +22,18 @@ extern int text_init();
*/
extern void text_set_cursor(short screen, short color, char character, short rate, short enable);
/*
* Set the border
*
* Inputs:
* screen = the screen number 0 for channel A, 1 for channel B
* visible = 0 to hide, any other number to show
* width = the horizontal thickness of the border in pixels
* height = the vertical thickness of the border in pixels
* color = the RGB color (xxRRGGBB)
*/
extern void text_set_border(short screen, short visible, short width, short height, unsigned long color);
/*
* Set the position of the cursor on the screen. Adjusts internal pointers used for printing the characters
*

BIN
src/foenixmcp.bin Normal file

Binary file not shown.

View file

@ -31,7 +31,8 @@
#include "snd/sid.h"
#include "fatfs/ff.h"
#include "cli/cli.h"
/* #include "rsrc/bitmaps/splash_a2560k.h"*/
// #include "rsrc/bitmaps/splash_a2560k.h"
// #include "rsrc/bitmaps/splash_a2560u.h"
const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
@ -89,7 +90,7 @@ const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
*LED2_REG = 0x02;
}
#endif
//
// /*
// * Load and display the splash screen
// */
@ -108,7 +109,7 @@ const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
//
// /* Copy the bitmap to video RAM */
// for (i = 0; i < sizeof(splash_screen_bmap); i++) {
// VRAM_Bank0[i] = splash_screen_bmap[i];
// VRAM_Bank0[i] = i * 0xff; // splash_screen_bmap[i];
// }
//
// /* Set up the bitmap */
@ -118,20 +119,21 @@ const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
// /* Turn off the border */
// *BorderControlReg_L_A = 0;
//
// /* Set a background color for the bitmap mode */
// *BackGroundControlReg_A = 0x00800080;
//
// /* Display the splashscreen: 320x200 */
// *MasterControlReg_A = VKY3_MCR_BITMAP_EN | VKY3_MCR_GRAPH_EN | VKY3_MCR_DOUBLE_EN;
// *MasterControlReg_A = 0x000000fD | VKY3_MCR_DOUBLE_EN;
//
// for (i = 0; i < 4096*1024; i++) ;
// }
void print_error(short channel, char * message, short code) {
print(channel, message);
print(channel, ": ");
print_hex_16(channel, code);
print(channel, "\n");
}
extern short current_color;
void print_error(short channel, char * message, short code) {
print(channel, message);
print(channel, ": ");
print_hex_16(channel, code);
print(channel, "\n");
}
/*
* Initialize the kernel systems.
@ -147,7 +149,7 @@ void initialize() {
mouse_set_visible(0);
/* Display the splash screen */
/* load_splashscreen(); */
// load_splashscreen();
/* Initialize the text channels */
text_init();
@ -246,7 +248,7 @@ int main(int argc, char * argv[]) {
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
#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 +++++";

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@
* Screen Channel A
*/
#define MasterControlReg_A ((volatile uint32_t *)0x00B40000)
#define MasterControlReg_A ((volatile unsigned long *)0x00B40000)
#define VKY3_MCR_TEXT_EN 0x00000001 /* Text Mode Enable */
#define VKY3_MCR_TEXT_OVRLY 0x00000002 /* Text Mode overlay */
#define VKY3_MCR_GRAPH_EN 0x00000004 /* Graphic Mode Enable */
@ -20,57 +20,57 @@
#define VKY3_MCR_MANUAL_GAMMA_EN 0x00020000 /* Enable Manual GAMMA Enable */
#define VKY3_MCR_BLANK_EN 0x00040000 /* Turn OFF sync (to monitor in sleep mode) */
#define BorderControlReg_L_A ((volatile uint32_t *)0x00B40004)
#define BorderControlReg_L_A ((volatile unsigned long *)0x00B40004)
#define VKY3_BRDR_EN 0x00000001 /* Border Enable */
#define VKY3_X_SCROLL_MASK 0x00000070 /* X Scroll */
#define VKY3_X_SIZE_MASK 0x00003f00 /* X Size */
#define VKY3_Y_SIZE_MASK 0x003f0000 /* Y Size */
#define BorderControlReg_H_A ((volatile uint32_t *)0x00B40008)
#define BackGroundControlReg_A ((volatile uint32_t *)0x00B4000C)
#define CursorControlReg_L_A ((volatile uint32_t *)0x00B40010)
#define CursorControlReg_H_A ((volatile uint32_t *)0x00B40014)
#define BorderControlReg_H_A ((volatile unsigned long *)0x00B40008)
#define BackGroundControlReg_A ((volatile unsigned long *)0x00B4000C)
#define CursorControlReg_L_A ((volatile unsigned long *)0x00B40010)
#define CursorControlReg_H_A ((volatile unsigned long *)0x00B40014)
#define LineInterrupt0_A ((volatile uint16_t *)0x00B40018)
#define LineInterrupt1_A ((volatile uint16_t *)0x00B4001A)
#define LineInterrupt2_A ((volatile uint16_t *)0x00B4001C)
#define LineInterrupt3_A ((volatile uint16_t *)0x00B4001E)
#define LineInterrupt0_A ((volatile unsigned short *)0x00B40018)
#define LineInterrupt1_A ((volatile unsigned short *)0x00B4001A)
#define LineInterrupt2_A ((volatile unsigned short *)0x00B4001C)
#define LineInterrupt3_A ((volatile unsigned short *)0x00B4001E)
#define MousePointer_Mem_A ((volatile uint16_t *)0x00B40400)
#define MousePtr_A_CTRL_Reg ((volatile uint16_t *)0x00B40C00)
#define MousePointer_Mem_A ((volatile unsigned short *)0x00B40400)
#define MousePtr_A_CTRL_Reg ((volatile unsigned short *)0x00B40C00)
#define MousePtr_En 0x0001
#define MousePtr_A_X_Pos ((volatile uint16_t *)0x00B40C02)
#define MousePtr_A_Y_Pos ((volatile uint16_t *)0x00B40C04)
#define MousePtr_A_Mouse0 ((volatile uint16_t *)0x00B40C0A)
#define MousePtr_A_Mouse1 ((volatile uint16_t *)0x00B40C0C)
#define MousePtr_A_Mouse2 ((volatile uint16_t *)0x00B40C0E)
#define MousePtr_A_X_Pos ((volatile unsigned short *)0x00B40C02)
#define MousePtr_A_Y_Pos ((volatile unsigned short *)0x00B40C04)
#define MousePtr_A_Mouse0 ((volatile unsigned short *)0x00B40C0A)
#define MousePtr_A_Mouse1 ((volatile unsigned short *)0x00B40C0C)
#define MousePtr_A_Mouse2 ((volatile unsigned short *)0x00B40C0E)
#define ScreenText_A ((volatile char *)0x00B60000) /* Text matrix */
#define ColorText_A ((volatile uint8_t *)0x00B68000) /* Color matrix */
#define FG_CLUT_A ((volatile uint16_t *)0x00B6C400) /* Foreground LUT */
#define BG_CLUT_A ((volatile uint16_t *)0x00B6C440) /* Background LUT */
#define ColorText_A ((volatile unsigned char *)0x00B68000) /* Color matrix */
#define FG_CLUT_A ((volatile unsigned short *)0x00B6C400) /* Foreground LUT */
#define BG_CLUT_A ((volatile unsigned short *)0x00B6C440) /* Background LUT */
#define BM0_Control_Reg ((volatile uint16_t *)0x00B40100)
#define BM0_Addy_Pointer_Reg ((volatile uint16_t *)0x00B40104)
#define BM0_Control_Reg ((volatile unsigned long *)0x00B40100)
#define BM0_Addy_Pointer_Reg ((volatile unsigned long *)0x00B40104)
#define Sprite_0_CTRL ((volatile uint16_t *)0x00B41000)
#define Sprite_0_ADDY_HI ((volatile uint16_t *)0x00B41002)
#define Sprite_0_POS_X ((volatile uint16_t *)0x00B41004)
#define Sprite_0_POS_Y ((volatile uint16_t *)0x00B41006)
#define Sprite_0_CTRL ((volatile unsigned short *)0x00B41000)
#define Sprite_0_ADDY_HI ((volatile unsigned short *)0x00B41002)
#define Sprite_0_POS_X ((volatile unsigned short *)0x00B41004)
#define Sprite_0_POS_Y ((volatile unsigned short *)0x00B41006)
/*
* Color lookup tables
*/
#define LUT_0 ((volatile uint8_t *)0x00B42000)
#define LUT_1 ((volatile uint8_t *)0x00B42400)
#define LUT_2 ((volatile uint8_t *)0x00B42800)
#define LUT_3 ((volatile uint8_t *)0x00B42C00)
#define LUT_4 ((volatile uint8_t *)0x00B43000)
#define LUT_5 ((volatile uint8_t *)0x00B43400)
#define LUT_6 ((volatile uint8_t *)0x00B43800)
#define LUT_7 ((volatile uint8_t *)0x00B43C00)
#define LUT_0 ((volatile unsigned char *)0x00B42000)
#define LUT_1 ((volatile unsigned char *)0x00B42400)
#define LUT_2 ((volatile unsigned char *)0x00B42800)
#define LUT_3 ((volatile unsigned char *)0x00B42C00)
#define LUT_4 ((volatile unsigned char *)0x00B43000)
#define LUT_5 ((volatile unsigned char *)0x00B43400)
#define LUT_6 ((volatile unsigned char *)0x00B43800)
#define LUT_7 ((volatile unsigned char *)0x00B43C00)
/*
* Text mode font memory
@ -82,6 +82,6 @@
* Location of VRAM
*/
#define VRAM_Bank0 ((volatile uint8_t *)0x00C00000)
#define VRAM_Bank0 ((volatile unsigned char *)0x00C00000)
#endif

View file

@ -15,6 +15,67 @@ void log_init() {
log_level = 999;
}
/*
* Display a panic screen
*
* Inputs:
* code = number indicating the type of violation
* pc = the value of the program counter at the time of the error
* address = (optional) the address of the access that caused the issue
*/
void panic(const char * message, unsigned long pc, unsigned long address){
char buffer[80];
short column = 18;
short row = 10;
/* Shut off all interrupts */
int_disable_all();
/* Re-initialize the text screen */
text_init();
text_set_border(0, 0, 0, 0, 0);
text_set_color(0, 15, 1);
text_set_cursor(0, 0, 0, 0, 0);
text_clear(0, 2);
text_set_xy(0, column, row++);
sprintf(buffer, "\xDA\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xBF");
print(0, buffer);
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 Oh dear, something has gone wrong... \xB3");
print(0, buffer);
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 \xB3");
print(0, buffer);
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 %-40s \xB3", message);
print(0, buffer);
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 \xB3");
print(0, buffer);
if (address == 0l) {
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X \xB3", message);
print(0, buffer);
} else {
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X ADDRESS: %08X \xB3", pc, address);
print(0, buffer);
}
text_set_xy(0, column, row++);
sprintf(buffer, "\xC0\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xD9");
print(0, buffer);
/* Wait forever */
while (1) ;
}
/*
* Set the maximum level of verbosity in logging.
* To be printed, a message must have a level lower or equal to this level.

View file

@ -12,6 +12,16 @@
#define LOG_TRACE 4 /* Log tracing information (like entry into a subroutine) */
#define LOG_VERBOSE 5 /* Log a truly verbose message... the sort you almost never want to bother with */
/*
* Display a panic screen
*
* Inputs:
* message = string indicating the type of error
* pc = the value of the program counter at the time of the error
* address = (optional) the address of the access that caused the issue
*/
extern void panic(const char * message, unsigned long pc, unsigned long address);
/*
* Set the maximum level of verbosity in logging.
* To be printed, a message must have a level lower or equal to this level.

View file

@ -1,5 +1,6 @@
xref ___main
xref _cli_rerepl
xref _panic
xdef _syscall
xdef ___exit
@ -12,13 +13,13 @@
dc.l ___STACK ; 00 - Initial stack pointer
dc.l coldboot ; 01 - Initial PC
dc.l not_impl ; 02 - Bus error
dc.l not_impl ; 03 - Address error
dc.l not_impl ; 04 - Illegal instruction
dc.l not_impl ; 05 - Zero divide
dc.l not_impl ; 06 - CHK instruction
dc.l not_impl ; 07 - TRAPV instruction
dc.l not_impl ; 08 - Priviledge error
dc.l _handle_bus ; 02 - Bus error
dc.l _handle_address ; 03 - Address error
dc.l _handle_illegal ; 04 - Illegal instruction
dc.l _handle_div0 ; 05 - Zero divide
dc.l _handle_chk ; 06 - CHK instruction
dc.l _handle_trapv ; 07 - TRAPV instruction
dc.l _handle_priv ; 08 - Priviledge error
dc.l not_impl ; 09 - Trace
dc.l not_impl ; 10 - Line 1010
dc.l not_impl ; 11 - Line 1111
@ -283,3 +284,84 @@ _restart_cli:
lea ___STACK,sp
jsr _cli_rerepl
bra _restart_cli
;
; Handle a Bus Error by going to the panic screen
;
_handle_bus:
move.l (2,a7),a0 ; Target address in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_BUS,a2
bra call_panic
;
; Handle a Address Error by going to the panic screen
;
_handle_address:
move.l (2,a7),a0 ; Target address in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_ADDRESS,a2
bra call_panic
;
; Handle a Illegal Instruction Error by going to the panic screen
;
_handle_illegal:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_ILLEGAL,a2
bra call_panic
;
; Handle a Divide by Zero Error by going to the panic screen
;
_handle_div0:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_DIV0,a2
bra call_panic
;
; Handle a CHK Error by going to the panic screen
;
_handle_chk:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_CHK,a2
bra call_panic
;
; Handle a TRAPV Error by going to the panic screen
;
_handle_trapv:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_TRAPV,a2
bra call_panic
;
; Handle a Privilege Error by going to the panic screen
;
_handle_priv:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_PRIV,a2
bra call_panic
call_panic:
move.l a2,-(a7)
move.l a1,-(a7)
move.l a0,-(a7)
jsr _panic
panic_loop:
bra panic_loop
data
MSG_ERR_BUS: dc.b "Bus Error"
MSG_ERR_ADDRESS: dc.b "Address Error"
MSG_ERR_ILLEGAL: dc.b "Illegal Instruction Error"
MSG_ERR_DIV0: dc.b "Divide by Zero Error"
MSG_ERR_CHK: dc.b "Range Check Error"
MSG_ERR_TRAPV: dc.b "Overflow Error"
MSG_ERR_PRIV: dc.b "Privilege Error"

10670
src/mapfile

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,10 @@
void sys_get_info(p_sys_info info) {
unsigned short machine_id = *GABE_MACHINE_ID;
info->mcp_version = VER_MAJOR;
info->mcp_rev = VER_MINOR;
info->mcp_build = VER_BUILD;
info->has_floppy = 0;
/* Model, CPU, and the presence of the floppy are set at compile time */

View file

@ -32,6 +32,9 @@
* Structure to describe the hardware
*/
typedef struct s_sys_info {
unsigned short mcp_version; /* Current version of the MCP kernel */
unsigned short mcp_rev; /* Current revision, or sub-version of the MCP kernel */
unsigned short mcp_build; /* Current vuild # of the MCP kernel */
unsigned short model; /* Code to say what model of machine this is */
const char * model_name; /* Human readable name of the model of the computer */
unsigned short cpu; /* Code to say which CPU is running */

View file

@ -1,5 +1,5 @@
RAMSTART = 0x00010000;
RAMSIZE = 0x00020000;
RAMSIZE = 0x00030000;
STACKLEN = 0x400;
MEMORY