Integrated new text code into kernel
Switched the console device to use the new text routine.
This commit is contained in:
parent
855676864a
commit
57a97aee2b
|
@ -5,9 +5,9 @@
|
|||
1. [x] A2560K "Moe" keyboard driver
|
||||
1. [x] PS/2 keyboard driver
|
||||
1. [x] Channel (Stream) driver model
|
||||
1. [ ] System call library
|
||||
1. [-] System call library (implemented by daschewie)
|
||||
1. [x] Channel driver for console (raw output and ANSI output)
|
||||
1. [ ] Channel driver for the serial ports
|
||||
1. [x] Channel driver for the serial ports
|
||||
1. [ ] Channel driver for the parallel port
|
||||
1. [ ] Channel driver for the MIDI ports
|
||||
1. [x] Block driver model
|
||||
|
@ -29,7 +29,7 @@
|
|||
1. Built-in commands:
|
||||
1. [x] DIR [path]
|
||||
1. [x] COPY [path] TO [path]
|
||||
1. [ ] RENAME [path] TO [path]
|
||||
1. [x] RENAME [path] TO [path]
|
||||
1. [x] DELETE [path]
|
||||
1. [x] CD [path]
|
||||
1. [x] PWD
|
||||
|
@ -37,7 +37,7 @@
|
|||
1. [ ] PRINT [expression]
|
||||
1. [x] POKE [address], [value] -- value to an address
|
||||
1. [x] PEEK [address] -- value from an address
|
||||
1. [ ] CALL [address] -- Start running assembly code
|
||||
1. [x] CALL [address] -- Start running assembly code
|
||||
1. [x] DUMP [address], [size]
|
||||
1. [ ] SETCOLOR [lut], [index], [r], [g], [b] -- set a color LUT value
|
||||
1. [x] SETTIME
|
||||
|
|
|
@ -67,7 +67,7 @@ cpu_c_src := $(wildcard $(cpu)/*.c)
|
|||
cpu_assembly_obj := $(subst .s,.o,$(cpu_assembly_src))
|
||||
cpu_c_obj := $(subst .c,.o,$(cpu_c_src))
|
||||
|
||||
dev_base_sources = dev/block.c dev/channel.c dev/console.c dev/fsys.c dev/pata.c dev/ps2.c dev/rtc.c dev/sdc.c dev/text_screen_iii.c dev/txt_screen.o dev/uart.c
|
||||
dev_base_sources = dev/block.c dev/channel.c dev/console.c dev/fsys.c dev/pata.c dev/ps2.c dev/rtc.c dev/sdc.c dev/txt_screen.c dev/uart.c
|
||||
ifeq ($(UNIT),a2560k)
|
||||
dev_c_src := $(dev_base_sources) dev/fdc.c dev/kbd_mo.c dev/lpt.c dev/midi.c dev/txt_a2560k_a.o dev/txt_a2560k_b.o
|
||||
else
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "interrupt.h"
|
||||
#include "rtc_reg.h"
|
||||
#include "dev/rtc.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "snd/codec.h"
|
||||
#include "vicky_general.h"
|
||||
|
||||
|
@ -425,7 +424,6 @@ short cli_font_set(short screen, const char * value) {
|
|||
char message[80];
|
||||
|
||||
/* Reset the text screen */
|
||||
text_init();
|
||||
fsys_close(chan);
|
||||
|
||||
sprintf(message, "Unable to read font file: %d\n", b);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "dev/console.h"
|
||||
#include "dev/ps2.h"
|
||||
#include "dev/kbd_mo.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "simpleio.h"
|
||||
|
||||
#define ANSI_BUFFER_SIZE 16
|
||||
|
@ -189,7 +189,7 @@ void ansi_process_c(p_channel chan, p_console_data con_data, char c) {
|
|||
|
||||
} else {
|
||||
/* Not working on a sequence... so just print it */
|
||||
text_put_raw(chan->dev, c);
|
||||
txt_put(chan->dev, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ void ansi_process_c(p_channel chan, p_console_data con_data, char c) {
|
|||
* ANSI Handler: cursor up
|
||||
*/
|
||||
void ansi_cuu(p_channel chan, short arg_count, short args[]) {
|
||||
unsigned short x, y;
|
||||
t_point position;
|
||||
short delta = 1;
|
||||
|
||||
TRACE("ansi_cuu");
|
||||
|
@ -208,16 +208,16 @@ void ansi_cuu(p_channel chan, short arg_count, short args[]) {
|
|||
|
||||
if (delta == 0) delta = 1;
|
||||
|
||||
text_get_xy(chan->dev, &x, &y);
|
||||
y -= delta;
|
||||
text_set_xy(chan->dev, x, y);
|
||||
txt_get_xy(chan->dev, &position);
|
||||
position.y -= delta;
|
||||
txt_set_xy(chan->dev, position.x, position.y);
|
||||
}
|
||||
|
||||
/*
|
||||
* ANSI Handler: cursor forward
|
||||
*/
|
||||
void ansi_cuf(p_channel chan, short arg_count, short args[]) {
|
||||
unsigned short x, y;
|
||||
t_point position;
|
||||
short delta = 1;
|
||||
|
||||
TRACE("ansi_cuf");
|
||||
|
@ -228,16 +228,16 @@ void ansi_cuf(p_channel chan, short arg_count, short args[]) {
|
|||
|
||||
if (delta == 0) delta = 1;
|
||||
|
||||
text_get_xy(chan->dev, &x, &y);
|
||||
x += delta;
|
||||
text_set_xy(chan->dev, x, y);
|
||||
txt_get_xy(chan->dev, &position);
|
||||
position.x += delta;
|
||||
txt_set_xy(chan->dev, position.x, position.y);
|
||||
}
|
||||
|
||||
/*
|
||||
* ANSI Handler: cursor back
|
||||
*/
|
||||
void ansi_cub(p_channel chan, short arg_count, short args[]) {
|
||||
unsigned short x, y;
|
||||
t_point position;
|
||||
short delta = 1;
|
||||
|
||||
TRACE("ansi_cub");
|
||||
|
@ -248,16 +248,16 @@ void ansi_cub(p_channel chan, short arg_count, short args[]) {
|
|||
|
||||
if (delta == 0) delta = 1;
|
||||
|
||||
text_get_xy(chan->dev, &x, &y);
|
||||
x -= delta;
|
||||
text_set_xy(chan->dev, x, y);
|
||||
txt_get_xy(chan->dev, &position);
|
||||
position.x -= delta;
|
||||
txt_set_xy(chan->dev, position.x, position.y);
|
||||
}
|
||||
|
||||
/*
|
||||
* ANSI Handler: cursor down
|
||||
*/
|
||||
void ansi_cud(p_channel chan, short arg_count, short args[]) {
|
||||
unsigned short x, y;
|
||||
t_point position;
|
||||
short delta = 1;
|
||||
|
||||
TRACE("ansi_cud");
|
||||
|
@ -268,9 +268,9 @@ void ansi_cud(p_channel chan, short arg_count, short args[]) {
|
|||
|
||||
if (delta == 0) delta = 1;
|
||||
|
||||
text_get_xy(chan->dev, &x, &y);
|
||||
y += delta;
|
||||
text_set_xy(chan->dev, x, y);
|
||||
txt_get_xy(chan->dev, &position);
|
||||
position.y += delta;
|
||||
txt_set_xy(chan->dev, position.x, position.y);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -292,7 +292,7 @@ void ansi_cup(p_channel chan, short arg_count, short args[]) {
|
|||
if (x == 0) x = 1;
|
||||
if (y == 0) y = 1;
|
||||
|
||||
text_set_xy(chan->dev, x - 1, y - 1);
|
||||
txt_set_xy(chan->dev, x - 1, y - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -307,7 +307,7 @@ void ansi_ed(p_channel chan, short arg_count, short args[]) {
|
|||
n = args[0];
|
||||
}
|
||||
|
||||
text_clear(chan->dev, n);
|
||||
txt_clear(chan->dev, n);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -322,7 +322,7 @@ void ansi_el(p_channel chan, short arg_count, short args[]) {
|
|||
n = args[0];
|
||||
}
|
||||
|
||||
text_clear_line(chan->dev, n);
|
||||
txt_clear_line(chan->dev, n);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -337,7 +337,7 @@ void ansi_ich(p_channel chan, short arg_count, short args[]) {
|
|||
n = args[0];
|
||||
}
|
||||
|
||||
text_insert(chan->dev, n);
|
||||
txt_insert(chan->dev, n);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -352,20 +352,20 @@ void ansi_dch(p_channel chan, short arg_count, short args[]) {
|
|||
n = args[0];
|
||||
}
|
||||
|
||||
text_delete(chan->dev, n);
|
||||
txt_delete(chan->dev, n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set Graphics Rendition
|
||||
*/
|
||||
void ansi_sgr(p_channel chan, short argc, short args[]) {
|
||||
short foreground = 0, background = 0;
|
||||
unsigned char foreground = 0, background = 0;
|
||||
short i;
|
||||
|
||||
TRACE("ansi_sgr");
|
||||
|
||||
/* Get the current colors */
|
||||
text_get_color(chan->dev, &foreground, &background);
|
||||
txt_get_color(chan->dev, &foreground, &background);
|
||||
|
||||
/* Walk through each argument code... */
|
||||
for (i = 0; i < argc; i++) {
|
||||
|
@ -399,7 +399,7 @@ void ansi_sgr(p_channel chan, short argc, short args[]) {
|
|||
}
|
||||
|
||||
/* Set the colors */
|
||||
text_set_color(chan->dev, foreground, background);
|
||||
txt_set_color(chan->dev, foreground, background);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -452,7 +452,7 @@ static short con_flush(p_channel chan) {
|
|||
con_data = (p_console_data)&(chan->data);
|
||||
if (con_data->control & CON_CTRL_ANSI) {
|
||||
for (i = 0; i < con_data->ansi_buffer_count; i++) {
|
||||
text_put_raw(chan->dev, con_data->ansi_buffer[i]);
|
||||
txt_put(chan->dev, con_data->ansi_buffer[i]);
|
||||
con_data->ansi_buffer[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ short con_write_b(p_channel chan, uint8_t b) {
|
|||
|
||||
} else {
|
||||
/* Not processing ANSI codes... just pass it to the text driver */
|
||||
text_put_raw(chan->dev, (char)b);
|
||||
txt_put(chan->dev, (char)b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "log.h"
|
||||
#include "dev/lpt.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "sys_general.h"
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "constants.h"
|
||||
#include "vicky_general.h"
|
||||
#include "text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "simpleio.h"
|
||||
#include "sys_general.h"
|
||||
#include "rsrc/font/MSX_CP437_8x8.h"
|
|
@ -9,7 +9,7 @@
|
|||
#include "indicators.h"
|
||||
#include "dev/block.h"
|
||||
#include "dev/pata.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "dev/rtc.h"
|
||||
#include "pata_reg.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "vicky_general.h"
|
||||
#include "dev/ps2.h"
|
||||
#include "dev/rtc.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "rsrc/bitmaps/mouse_pointer.h"
|
||||
|
||||
#define PS2_TIMEOUT_JF 10 /* Timeout in jiffies: 1/60 second units */
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "sdc_reg.h"
|
||||
#include "dev/rtc.h"
|
||||
#include "dev/sdc.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
|
||||
//
|
||||
// Constants
|
||||
|
|
|
@ -3,15 +3,17 @@
|
|||
* Text screen driver for A2560K Channel A
|
||||
*/
|
||||
|
||||
extern const unsigned char MSX_CP437_8x8_bin[];
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "constants.h"
|
||||
#include "log.h"
|
||||
#include "utilities.h"
|
||||
#include "A2560K/vky_chan_a.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "dev/txt_a2560k_a.h"
|
||||
|
||||
extern const unsigned char foenix_st_8x8[];
|
||||
|
||||
/* Default text color lookup table values (AARRGGBB) */
|
||||
const unsigned long a2560k_a_lut[VKY3_A_LUT_SIZE] = {
|
||||
0xFF000000, // Black (transparent)
|
||||
|
@ -239,6 +241,22 @@ void txt_a2560k_a_set_cursor(short enable, short rate, char c) {
|
|||
*VKY3_A_CCR = ((a2560k_a_color & 0xff) << 24) | ((c & 0xff) << 16) | ((rate & 0x03) << 1) | (enable & 0x01);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current region
|
||||
*
|
||||
* @param region pointer to a t_rect describing the rectangular region (using character cells for size and size)
|
||||
*
|
||||
* @return 0 on success, any other number means the region was invalid
|
||||
*/
|
||||
short txt_a2560k_a_get_region(p_rect region) {
|
||||
region->origin.x = a2560k_a_region.origin.x;
|
||||
region->origin.y = a2560k_a_region.origin.y;
|
||||
region->size.width = a2560k_a_region.size.width;
|
||||
region->size.height = a2560k_a_region.size.height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a region to restrict further character display, scrolling, etc.
|
||||
* Note that a region of zero size will reset the region to the full size of the screen.
|
||||
|
@ -265,6 +283,18 @@ short txt_a2560k_a_set_region(p_rect region) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default foreground and background colors for printing
|
||||
*
|
||||
* @param pointer to the foreground the Text LUT index of the new current foreground color (0 - 15)
|
||||
* @param pointer to the background the Text LUT index of the new current background color (0 - 15)
|
||||
*/
|
||||
short txt_a2560k_a_get_color(unsigned char * foreground, unsigned char * background) {
|
||||
*foreground = (a2560k_a_color & 0xf0) >> 4;
|
||||
*background = a2560k_a_color & 0x0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default foreground and background colors for printing
|
||||
*
|
||||
|
@ -272,7 +302,7 @@ short txt_a2560k_a_set_region(p_rect region) {
|
|||
* @param background the Text LUT index of the new current background color (0 - 15)
|
||||
*/
|
||||
short txt_a2560k_a_set_color(unsigned char foreground, unsigned char background) {
|
||||
a2560k_a_color = ((foreground & 0x0f) << 4) | (background & 0x0f);
|
||||
a2560k_a_color = ((foreground & 0x0f) << 4) + (background & 0x0f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -433,15 +463,6 @@ void txt_a2560k_a_get_xy(p_point position) {
|
|||
/**
|
||||
* Print a character to the current cursor position in the current color
|
||||
*
|
||||
* Most character codes will result in a glyph being displayed at the current
|
||||
* cursor position, advancing the cursor one spot. There are some exceptions that
|
||||
* will be treated as control codes:
|
||||
*
|
||||
* 0x08 - BS - Move the cursor back one position, erasing the character underneath
|
||||
* 0x09 - HT - Move forward to the next TAB stop
|
||||
* 0x0A - LF - Move the cursor down one line (line feed)
|
||||
* 0x0D - CR - Move the cursor to column 0 (carriage return)
|
||||
*
|
||||
* @param screen the number of the text device
|
||||
* @param c the character to print
|
||||
*/
|
||||
|
@ -450,35 +471,13 @@ void txt_a2560k_a_put(char c) {
|
|||
short y;
|
||||
unsigned int offset;
|
||||
|
||||
switch (c) {
|
||||
case 0x08:
|
||||
/* Backspace */
|
||||
break;
|
||||
x = a2560k_a_region.origin.x + a2560k_a_cursor.x;
|
||||
y = a2560k_a_region.origin.y + a2560k_a_cursor.y;
|
||||
offset = y * a2560k_a_max_size.width + x;
|
||||
VKY3_A_TEXT_MATRIX[offset] = c;
|
||||
VKY3_A_COLOR_MATRIX[offset] = a2560k_a_color;
|
||||
|
||||
case 0x09:
|
||||
/* horizontal tab */
|
||||
break;
|
||||
|
||||
case 0x0A:
|
||||
/* line feed */
|
||||
txt_a2560k_a_set_xy(a2560k_a_cursor.x, a2560k_a_cursor.y + 1);
|
||||
break;
|
||||
|
||||
case 0x0D:
|
||||
/* carriage return */
|
||||
txt_a2560k_a_set_xy(0, a2560k_a_cursor.y);
|
||||
break;
|
||||
|
||||
default:
|
||||
x = a2560k_a_region.origin.x + a2560k_a_cursor.x;
|
||||
y = a2560k_a_region.origin.y + a2560k_a_cursor.y;
|
||||
offset = y * a2560k_a_max_size.width + x;
|
||||
VKY3_A_TEXT_MATRIX[offset] = c;
|
||||
VKY3_A_COLOR_MATRIX[offset] = a2560k_a_color;
|
||||
|
||||
txt_a2560k_a_set_xy(a2560k_a_cursor.x + 1, a2560k_a_cursor.y);
|
||||
break;
|
||||
}
|
||||
txt_a2560k_a_set_xy(a2560k_a_cursor.x + 1, a2560k_a_cursor.y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -541,14 +540,14 @@ void txt_a2560k_a_init() {
|
|||
txt_a2560k_a_set_color(0x07, 0x04);
|
||||
|
||||
/* Set the font */
|
||||
txt_a2560k_a_set_font(8, 8, MSX_CP437_8x8_bin); /* Use 8x8 font */
|
||||
txt_a2560k_a_set_font(8, 8, foenix_st_8x8); /* Use 8x8 font */
|
||||
|
||||
/* Set the cursor */
|
||||
txt_a2560k_a_set_cursor(1, 0, 0xB1);
|
||||
|
||||
/* Set the border */
|
||||
txt_a2560k_a_set_border(32, 32); /* Set up the border */
|
||||
txt_a2560k_a_set_border_color(0x7f, 0x00, 0x7f);
|
||||
txt_a2560k_a_set_border(16, 16); /* Set up the border */
|
||||
txt_a2560k_a_set_border_color(0, 0, 0x3f);
|
||||
|
||||
/*
|
||||
* Enable set_sizes, now that everything is set up initially
|
||||
|
@ -585,12 +584,15 @@ short txt_a2560k_a_install() {
|
|||
device.init = txt_a2560k_a_init;
|
||||
device.get_capabilities = txt_a2560k_a_get_capabilities;
|
||||
device.set_mode = txt_a2560k_a_set_mode;
|
||||
device.set_sizes = txt_a2560k_a_set_sizes;
|
||||
device.set_resolution = txt_a2560k_a_set_resolution;
|
||||
device.set_border = txt_a2560k_a_set_border;
|
||||
device.set_border_color = txt_a2560k_a_set_border_color;
|
||||
device.set_font = txt_a2560k_a_set_font;
|
||||
device.set_cursor = txt_a2560k_a_set_cursor;
|
||||
device.get_region = txt_a2560k_a_get_region;
|
||||
device.set_region = txt_a2560k_a_set_region;
|
||||
device.get_color = txt_a2560k_a_get_color;
|
||||
device.set_color = txt_a2560k_a_set_color;
|
||||
device.set_xy = txt_a2560k_a_set_xy;
|
||||
device.get_xy = txt_a2560k_a_get_xy;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef __TXT_A2560K_A_H
|
||||
#define __TXT_A2560K_A_H
|
||||
|
||||
/* Channel A is assigned to screen #1, it will be considered a secondary channel */
|
||||
#define TXT_SCREEN_A2560K_A 1
|
||||
/* Channel A is assigned to screen #0, it will be considered a secondary channel */
|
||||
#define TXT_SCREEN_A2560K_A 0
|
||||
|
||||
/**
|
||||
* Initialize and install the driver
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* Text screen driver for A2560K Channel B
|
||||
*/
|
||||
|
||||
extern const unsigned char MSX_CP437_8x8_bin[];
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "log.h"
|
||||
|
@ -13,6 +11,8 @@ extern const unsigned char MSX_CP437_8x8_bin[];
|
|||
#include "dev/txt_screen.h"
|
||||
#include "dev/txt_a2560k_b.h"
|
||||
|
||||
extern const unsigned char foenix_st_8x8[];
|
||||
|
||||
/* Default text color lookup table values (AARRGGBB) */
|
||||
const unsigned long a2560k_b_lut[VKY3_B_LUT_SIZE] = {
|
||||
0xFF000000, // Black (transparent)
|
||||
|
@ -462,15 +462,6 @@ void txt_a2560k_b_get_xy(p_point position) {
|
|||
/**
|
||||
* Print a character to the current cursor position in the current color
|
||||
*
|
||||
* Most character codes will result in a glyph being displayed at the current
|
||||
* cursor position, advancing the cursor one spot. There are some exceptions that
|
||||
* will be treated as control codes:
|
||||
*
|
||||
* 0x08 - BS - Move the cursor back one position, erasing the character underneath
|
||||
* 0x09 - HT - Move forward to the next TAB stop
|
||||
* 0x0A - LF - Move the cursor down one line (line feed)
|
||||
* 0x0D - CR - Move the cursor to column 0 (carriage return)
|
||||
*
|
||||
* @param screen the number of the text device
|
||||
* @param c the character to print
|
||||
*/
|
||||
|
@ -479,35 +470,13 @@ void txt_a2560k_b_put(char c) {
|
|||
short y;
|
||||
unsigned int offset;
|
||||
|
||||
switch (c) {
|
||||
case 0x08:
|
||||
/* Backspace */
|
||||
break;
|
||||
x = a2560k_b_region.origin.x + a2560k_b_cursor.x;
|
||||
y = a2560k_b_region.origin.y + a2560k_b_cursor.y;
|
||||
offset = y * a2560k_b_max_size.width + x;
|
||||
VKY3_B_TEXT_MATRIX[offset] = c;
|
||||
VKY3_B_COLOR_MATRIX[offset] = a2560k_b_color;
|
||||
|
||||
case 0x09:
|
||||
/* horizontal tab */
|
||||
break;
|
||||
|
||||
case 0x0A:
|
||||
/* line feed */
|
||||
txt_a2560k_b_set_xy(a2560k_b_cursor.x, a2560k_b_cursor.y + 1);
|
||||
break;
|
||||
|
||||
case 0x0D:
|
||||
/* carriage return */
|
||||
txt_a2560k_b_set_xy(0, a2560k_b_cursor.y);
|
||||
break;
|
||||
|
||||
default:
|
||||
x = a2560k_b_region.origin.x + a2560k_b_cursor.x;
|
||||
y = a2560k_b_region.origin.y + a2560k_b_cursor.y;
|
||||
offset = y * a2560k_b_max_size.width + x;
|
||||
VKY3_B_TEXT_MATRIX[offset] = c;
|
||||
VKY3_B_COLOR_MATRIX[offset] = a2560k_b_color;
|
||||
|
||||
txt_a2560k_b_set_xy(a2560k_b_cursor.x + 1, a2560k_b_cursor.y);
|
||||
break;
|
||||
}
|
||||
txt_a2560k_b_set_xy(a2560k_b_cursor.x + 1, a2560k_b_cursor.y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -575,7 +544,7 @@ void txt_a2560k_b_init() {
|
|||
txt_a2560k_b_set_color(0x07, 0x04);
|
||||
|
||||
/* Set the font */
|
||||
txt_a2560k_b_set_font(8, 8, MSX_CP437_8x8_bin); /* Use 8x8 font */
|
||||
txt_a2560k_b_set_font(8, 8, foenix_st_8x8); /* Use 8x8 font */
|
||||
|
||||
/* Set the cursor */
|
||||
txt_a2560k_b_set_cursor(1, 0, 0xB1);
|
||||
|
@ -602,7 +571,7 @@ void txt_a2560k_b_init() {
|
|||
txt_a2560k_b_set_xy(0, 0);
|
||||
|
||||
/* Clear the screen */
|
||||
txt_a2560k_b_fill('X');
|
||||
txt_a2560k_b_fill(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -619,6 +588,7 @@ short txt_a2560k_b_install() {
|
|||
device.init = txt_a2560k_b_init;
|
||||
device.get_capabilities = txt_a2560k_b_get_capabilities;
|
||||
device.set_mode = txt_a2560k_b_set_mode;
|
||||
device.set_sizes = txt_a2560k_b_set_sizes;
|
||||
device.set_resolution = txt_a2560k_b_set_resolution;
|
||||
device.set_border = txt_a2560k_b_set_border;
|
||||
device.set_border_color = txt_a2560k_b_set_border_color;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef __TXT_A2560K_B_H
|
||||
#define __TXT_A2560K_B_H
|
||||
|
||||
/* Channel B is assigned to screen #0, it will be considered the primary channel */
|
||||
#define TXT_SCREEN_A2560K_B 0
|
||||
/* Channel B is assigned to screen #1, it will be considered the primary channel */
|
||||
#define TXT_SCREEN_A2560K_B 1
|
||||
|
||||
/**
|
||||
* Initialize and install the driver
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* to the low level drivers (e.g. txt_a2560k_a) registered with it.
|
||||
*/
|
||||
|
||||
#include "constants.h"
|
||||
#include "log.h"
|
||||
#include "dev/txt_screen.h"
|
||||
|
||||
|
@ -31,12 +32,15 @@ void txt_init() {
|
|||
txt_device_driver[i].init = 0;
|
||||
txt_device_driver[i].get_capabilities = 0;
|
||||
txt_device_driver[i].set_mode = 0;
|
||||
txt_device_driver[i].set_sizes = 0;
|
||||
txt_device_driver[i].set_resolution = 0;
|
||||
txt_device_driver[i].set_border = 0;
|
||||
txt_device_driver[i].set_border_color = 0;
|
||||
txt_device_driver[i].set_font = 0;
|
||||
txt_device_driver[i].set_cursor = 0;
|
||||
txt_device_driver[i].get_region = 0;
|
||||
txt_device_driver[i].set_region = 0;
|
||||
txt_device_driver[i].get_color = 0;
|
||||
txt_device_driver[i].set_color = 0;
|
||||
txt_device_driver[i].set_xy = 0;
|
||||
txt_device_driver[i].get_xy = 0;
|
||||
|
@ -68,12 +72,15 @@ short txt_register(p_txt_device device) {
|
|||
txt_device_driver[i].init = device->init;
|
||||
txt_device_driver[i].get_capabilities = device->get_capabilities;
|
||||
txt_device_driver[i].set_mode = device->set_mode;
|
||||
txt_device_driver[i].set_sizes = device->set_sizes;
|
||||
txt_device_driver[i].set_resolution = device->set_resolution;
|
||||
txt_device_driver[i].set_border = device->set_border;
|
||||
txt_device_driver[i].set_border_color = device->set_border_color;
|
||||
txt_device_driver[i].set_font = device->set_font;
|
||||
txt_device_driver[i].set_cursor = device->set_cursor;
|
||||
txt_device_driver[i].get_region = device->get_region;
|
||||
txt_device_driver[i].set_region = device->set_region;
|
||||
txt_device_driver[i].get_color = device->get_color;
|
||||
txt_device_driver[i].set_color = device->set_color;
|
||||
txt_device_driver[i].set_xy = device->set_xy;
|
||||
txt_device_driver[i].get_xy = device->get_xy;
|
||||
|
@ -101,7 +108,6 @@ p_txt_device txt_get_device(short screen) {
|
|||
return device;
|
||||
} else {
|
||||
log_num(LOG_ERROR, "txt_get_device: number mismatch ", screen);
|
||||
log_num(LOG_ERROR, "txt_get_device: number mismatch ", device->number);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +164,22 @@ short txt_set_mode(short screen, short mode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculate the size of the text screen
|
||||
*
|
||||
* @return 0 on success, any other number means the mode is invalid for the screen
|
||||
*/
|
||||
short txt_setsizes(short screen) {
|
||||
p_txt_device device = txt_get_device(screen);
|
||||
if (device) {
|
||||
if (device->set_sizes) {
|
||||
device->set_sizes();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the display resolution of the screen
|
||||
*
|
||||
|
@ -245,6 +267,24 @@ void txt_set_cursor(short screen, short enable, short rate, char c) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current region.
|
||||
*
|
||||
* @param screen the number of the text device
|
||||
* @param region pointer to a t_rect describing the rectangular region (using character cells for size and size)
|
||||
*
|
||||
* @return 0 on success, any other number means the region was invalid
|
||||
*/
|
||||
short txt_get_region(short screen, p_rect region) {
|
||||
p_txt_device device = txt_get_device(screen);
|
||||
if (device) {
|
||||
if (device->get_region) {
|
||||
return device->get_region(region);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a region to restrict further character display, scrolling, etc.
|
||||
* Note that a region of zero size will reset the region to the full size of the screen.
|
||||
|
@ -281,6 +321,23 @@ short txt_set_color(short screen, unsigned char foreground, unsigned char backgr
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the foreground and background color for printing
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* foreground = pointer to the foreground color number
|
||||
* background = pointer to the background color number
|
||||
*/
|
||||
void txt_get_color(short screen, unsigned char * foreground, unsigned char * background) {
|
||||
p_txt_device device = txt_get_device(screen);
|
||||
if (device) {
|
||||
if (device->get_color) {
|
||||
return device->get_color(foreground, background);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position of the cursor to (x, y) relative to the current region
|
||||
* If the (x, y) coordinate is outside the region, it will be clipped to the region.
|
||||
|
@ -331,14 +388,58 @@ void txt_get_xy(short screen, p_point position) {
|
|||
* @param c the character to print
|
||||
*/
|
||||
void txt_put(short screen, char c) {
|
||||
t_point cursor;
|
||||
|
||||
p_txt_device device = txt_get_device(screen);
|
||||
if (device) {
|
||||
if (device->put) {
|
||||
device->put(c);
|
||||
switch (c) {
|
||||
case CHAR_BS:
|
||||
/* Backspace */
|
||||
txt_get_xy(screen, &cursor);
|
||||
if (cursor.x > 0) {
|
||||
txt_set_xy(screen, cursor.x - 1, cursor.y);
|
||||
device->put(' ');
|
||||
txt_set_xy(screen, cursor.x - 1, cursor.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case CHAR_TAB:
|
||||
/* horizontal tab */
|
||||
txt_get_xy(screen, &cursor);
|
||||
txt_set_xy(screen, ((cursor.x >> 3) + 1) << 3, cursor.y);
|
||||
break;
|
||||
|
||||
case CHAR_NL:
|
||||
/* line feed */
|
||||
txt_get_xy(screen, &cursor);
|
||||
txt_set_xy(screen, 0, cursor.y + 1);
|
||||
break;
|
||||
|
||||
case CHAR_CR:
|
||||
/* carriage return */
|
||||
break;
|
||||
|
||||
default:
|
||||
device->put(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a character to the screen without any escape code interpretation
|
||||
*
|
||||
* Deprecated legacy function
|
||||
*
|
||||
* @param screen the screen number 0 for channel A, 1 for channel B
|
||||
* @param c the character to print
|
||||
*/
|
||||
void text_put_raw(short screen, char c) {
|
||||
txt_put(screen, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an ASCII Z string to the screen
|
||||
*
|
||||
|
@ -383,3 +484,196 @@ void txt_fill(short screen, char c) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the screen of data
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* mode = 0: erase from the cursor to the end of the screen,
|
||||
1: erase from start of the screen to the cursor,
|
||||
2: erase entire screen
|
||||
*/
|
||||
void txt_clear(short screen, short mode) {
|
||||
t_point cursor;
|
||||
t_rect old_region, region;
|
||||
|
||||
txt_get_xy(screen, &cursor);
|
||||
txt_get_region(screen, &old_region);
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
// Erase from cursor to end of region
|
||||
|
||||
// Clear the end of the line
|
||||
region.origin.x = old_region.origin.x + cursor.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = old_region.size.width - cursor.x;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Clear the region after the cursor
|
||||
region.origin.x = old_region.origin.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y + 1;
|
||||
region.size.width = old_region.size.width;
|
||||
region.size.height = old_region.size.height - cursor.y;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Restore the original region
|
||||
txt_set_region(screen, &old_region);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Erase from start of region to cursor
|
||||
|
||||
// Clear the region to the cursor line
|
||||
region.origin.x = old_region.origin.x;
|
||||
region.origin.y = old_region.origin.y;
|
||||
region.size.width = old_region.size.width;
|
||||
region.size.height = cursor.y;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Clear the end of the line
|
||||
region.origin.x = old_region.origin.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = cursor.x;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Restore the original region
|
||||
txt_set_region(screen, &old_region);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Erase entire region
|
||||
txt_fill(screen, ' ');
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear part or all of the current line
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* mode = 0: erase from the start of the line to the cursor,
|
||||
* 1: erase from cursor to end of the line,
|
||||
* 2: erase entire line
|
||||
*/
|
||||
void txt_clear_line(short screen, short mode) {
|
||||
t_point cursor;
|
||||
t_rect old_region, region;
|
||||
|
||||
txt_get_xy(screen, &cursor);
|
||||
txt_get_region(screen, &old_region);
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
// Erase from cursor to end of line
|
||||
|
||||
// Clear the end of the line
|
||||
region.origin.x = old_region.origin.x + cursor.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = old_region.size.width - cursor.x;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Restore the original region
|
||||
txt_set_region(screen, &old_region);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Erase from start of line to cursor
|
||||
|
||||
// Clear the end of the line
|
||||
region.origin.x =old_region.origin.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = cursor.x;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Restore the original region
|
||||
txt_set_region(screen, &old_region);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Clear the line
|
||||
region.origin.x = old_region.origin.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = old_region.size.width;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_fill(screen, ' ');
|
||||
|
||||
// Restore the original region
|
||||
txt_set_region(screen, &old_region);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert a number of characters at the cursor position
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* count = the number of characters to insert
|
||||
*/
|
||||
void txt_insert(short screen, short count) {
|
||||
t_point cursor;
|
||||
t_rect old_region, region;
|
||||
|
||||
if (count > 0) {
|
||||
txt_get_xy(screen, &cursor);
|
||||
txt_get_region(screen, &old_region);
|
||||
|
||||
region.origin.x = old_region.origin.x + cursor.x;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = old_region.size.width - cursor.x;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_scroll(screen, count, 0);
|
||||
txt_set_region(screen, &old_region);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete a number of characters at the cursor position
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* count = the number of characters to delete
|
||||
*/
|
||||
void txt_delete(short screen, short count) {
|
||||
t_point cursor;
|
||||
t_rect old_region, region;
|
||||
short left;
|
||||
|
||||
if (count > 0) {
|
||||
txt_get_xy(screen, &cursor);
|
||||
txt_get_region(screen, &old_region);
|
||||
|
||||
if (count > cursor.x) {
|
||||
count = cursor.x;
|
||||
}
|
||||
|
||||
region.origin.x = old_region.origin.x + cursor.x - count;
|
||||
region.origin.y = old_region.origin.y + cursor.y;
|
||||
region.size.width = old_region.size.width - cursor.x + count;
|
||||
region.size.height = 1;
|
||||
txt_set_region(screen, ®ion);
|
||||
txt_scroll(screen, 0-count, 0);
|
||||
txt_set_region(screen, &old_region);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ typedef struct s_txt_capabilities {
|
|||
typedef void (*p_init)();
|
||||
typedef const p_txt_capabilities (*p_get_capabilities)();
|
||||
typedef short (*p_set_mode)(short mode);
|
||||
typedef void (*p_setsizes)();
|
||||
typedef short (*p_set_resolution)(short width, short height);
|
||||
typedef void (*p_set_border)(short width, short height);
|
||||
typedef void (*p_set_border_color)(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
@ -69,10 +70,11 @@ typedef short (*p_set_font)(short width, short height, unsigned char * data);
|
|||
typedef void (*p_set_cursor)(short enable, short rate, char c);
|
||||
typedef short (*p_set_region)(p_rect region);
|
||||
typedef short (*p_set_color)(unsigned char foreground, unsigned char background);
|
||||
typedef short (*p_get_color)(unsigned char * foreground, unsigned char * background);
|
||||
typedef void (*p_set_xy)(short x, short y);
|
||||
typedef void (*p_get_xy)(p_point position);
|
||||
typedef void (*p_put)(char c);
|
||||
typedef void (*p_scroll)(short horiztonal, short vertical);
|
||||
typedef void (*p_scroll)(short horizontal, short vertical);
|
||||
typedef void (*p_fill)(char c);
|
||||
|
||||
/**
|
||||
|
@ -90,11 +92,14 @@ typedef struct s_txt_device {
|
|||
p_init init; /**< Pointer to the device's init function */
|
||||
p_get_capabilities get_capabilities; /**< Pointer to the device's get_capabilities function */
|
||||
p_set_mode set_mode; /**< Pointer to the device's set_mode function */
|
||||
p_setsizes set_sizes; /**< Pointer to the device's set_sizes function */
|
||||
p_set_resolution set_resolution; /**< Pointer to the device's set_resolution function */
|
||||
p_set_border set_border; /**< Pointer to the device's set_border function */
|
||||
p_set_border_color set_border_color; /**< Pointer to the device's set_border function */
|
||||
p_set_font set_font; /**< Pointer to the device's set_font function */
|
||||
p_set_region get_region; /**< Pointer to the device's get_region function */
|
||||
p_set_region set_region; /**< Pointer to the device's set_region function */
|
||||
p_get_color get_color; /**< Pointer to the device's get_color function */
|
||||
p_set_color set_color; /**< Pointer to the device's set_color function */
|
||||
p_set_cursor set_cursor; /**< Pointer to the device's set_cursor function */
|
||||
p_set_xy set_xy; /**< Pointer to the device's set_xy function */
|
||||
|
@ -144,6 +149,13 @@ extern const p_txt_capabilities txt_get_capabilities(short screen);
|
|||
*/
|
||||
extern short txt_set_mode(short screen, short mode);
|
||||
|
||||
/**
|
||||
* Recalculate the size of the text screen
|
||||
*
|
||||
* @return 0 on success, any other number means the mode is invalid for the screen
|
||||
*/
|
||||
extern short txt_setsizes(short screen);
|
||||
|
||||
/**
|
||||
* Set the display resolution of the screen
|
||||
*
|
||||
|
@ -194,6 +206,16 @@ extern short txt_set_font(short screen, short width, short height, unsigned char
|
|||
*/
|
||||
extern void txt_set_cursor(short screen, short enable, short rate, char c);
|
||||
|
||||
/**
|
||||
* Get the current region.
|
||||
*
|
||||
* @param screen the number of the text device
|
||||
* @param region pointer to a t_rect describing the rectangular region (using character cells for size and size)
|
||||
*
|
||||
* @return 0 on success, any other number means the region was invalid
|
||||
*/
|
||||
extern short txt_set_region(short screen, p_rect region);
|
||||
|
||||
/**
|
||||
* Set a region to restrict further character display, scrolling, etc.
|
||||
* Note that a region of zero size will reset the region to the full size of the screen.
|
||||
|
@ -214,6 +236,16 @@ extern short txt_set_region(short screen, p_rect region);
|
|||
*/
|
||||
extern short txt_set_color(short screen, unsigned char foreground, unsigned char background);
|
||||
|
||||
/*
|
||||
* Get the foreground and background color for printing
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* foreground = pointer to the foreground color number
|
||||
* background = pointer to the background color number
|
||||
*/
|
||||
extern void txt_get_color(short screen, unsigned char * foreground, unsigned char * background);
|
||||
|
||||
/**
|
||||
* Set the position of the cursor to (x, y) relative to the current region
|
||||
* If the (x, y) coordinate is outside the region, it will be clipped to the region.
|
||||
|
@ -251,6 +283,16 @@ extern void txt_get_xy(short screen, p_point position);
|
|||
*/
|
||||
extern void txt_put(short screen, char c);
|
||||
|
||||
/*
|
||||
* Send a character to the screen without any escape code interpretation
|
||||
*
|
||||
* Deprecated legacy function
|
||||
*
|
||||
* @param screen the screen number 0 for channel A, 1 for channel B
|
||||
* @param c the character to print
|
||||
*/
|
||||
extern void text_put_raw(short screen, char c);
|
||||
|
||||
/**
|
||||
* Print an ASCII Z string to the screen
|
||||
*
|
||||
|
@ -276,4 +318,44 @@ extern void txt_scroll(short screen, short horiztonal, short vertical);
|
|||
*/
|
||||
extern void txt_fill(short screen, char c);
|
||||
|
||||
/*
|
||||
* Clear the screen of data
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* mode = 0: erase from the cursor to the end of the screen,
|
||||
1: erase from start of the screen to the cursor,
|
||||
2: erase entire screen
|
||||
*/
|
||||
extern void txt_clear(short screen, short mode);
|
||||
|
||||
/*
|
||||
* Clear part or all of the current line
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* mode = 0: erase from the start of the line to the cursor,
|
||||
* 1: erase from cursor to end of the line,
|
||||
* 2: erase entire line
|
||||
*/
|
||||
extern void txt_clear_line(short screen, short mode);
|
||||
|
||||
/*
|
||||
* Insert a number of characters at the cursor position
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* count = the number of characters to insert
|
||||
*/
|
||||
extern void txt_insert(short screen, short count);
|
||||
|
||||
/*
|
||||
* Delete a number of characters at the cursor position
|
||||
*
|
||||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
* count = the number of characters to delete
|
||||
*/
|
||||
extern void txt_delete(short screen, short count);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "log.h"
|
||||
#include "dev/block.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "ff.h" /* Obtains integer types */
|
||||
#include "diskio.h" /* Declarations of disk functions */
|
||||
#include "simpleio.h"
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#include "dev/channel.h"
|
||||
#include "dev/console.h"
|
||||
#include "dev/fdc.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
|
||||
// #include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "dev/txt_a2560k_a.h"
|
||||
#include "dev/txt_a2560k_b.h"
|
||||
|
@ -48,6 +47,8 @@
|
|||
#include "rsrc/bitmaps/splash_a2560k.h"
|
||||
#endif
|
||||
|
||||
#include "rsrc/font/foenix_st_8_8.h"
|
||||
|
||||
const char* VolumeStr[FF_VOLUMES] = { "sd", "fd", "hd" };
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
|
@ -183,52 +184,23 @@ void initialize() {
|
|||
short res;
|
||||
|
||||
/* Set the logging level */
|
||||
log_setlevel(LOG_ERROR);
|
||||
log_setlevel(LOG_FATAL);
|
||||
|
||||
// /* Hide the mouse */
|
||||
mouse_set_visible(0);
|
||||
|
||||
/* Initialize the text channels */
|
||||
text_init();
|
||||
txt_init();
|
||||
txt_a2560k_a_install();
|
||||
txt_a2560k_b_install();
|
||||
txt_init_screen(1);
|
||||
txt_init_screen(0);
|
||||
log(LOG_INFO, "Text system initialized");
|
||||
|
||||
/* Initialize the indicators */
|
||||
ind_init();
|
||||
log(LOG_INFO, "Indicators initialized");
|
||||
|
||||
txt_init();
|
||||
if (res = txt_a2560k_a_install()) {
|
||||
log(LOG_ERROR, "Could not install A2560K Channel B driver");
|
||||
} else {
|
||||
log(LOG_ERROR, "A2560K Channel B driver installed");
|
||||
}
|
||||
txt_init_screen(TXT_SCREEN_A2560K_A);
|
||||
txt_fill(TXT_SCREEN_A2560K_A, 'Y');
|
||||
|
||||
txt_set_xy(TXT_SCREEN_A2560K_A, 0, 0);
|
||||
for (int x = 0; x < 600; x++) {
|
||||
txt_print(TXT_SCREEN_A2560K_A, "Hello! ");
|
||||
}
|
||||
|
||||
t_rect region;
|
||||
region.origin.x = 5;
|
||||
region.origin.y = 10;
|
||||
region.size.width = 20;
|
||||
region.size.height = 10;
|
||||
txt_set_region(TXT_SCREEN_A2560K_A, ®ion);
|
||||
txt_set_color(TXT_SCREEN_A2560K_A, 0x07, 0x00);
|
||||
txt_set_xy(TXT_SCREEN_A2560K_A, 0, 0);
|
||||
txt_fill(TXT_SCREEN_A2560K_A, ' ');
|
||||
|
||||
for (int x = 0; x < 15; x++) {
|
||||
char buffer[80];
|
||||
sprintf(buffer, "Line %d...\n\r", x);
|
||||
txt_print(TXT_SCREEN_A2560K_A, buffer);
|
||||
}
|
||||
|
||||
txt_scroll(TXT_SCREEN_A2560K_A, -2, 2);
|
||||
|
||||
while (1) ;
|
||||
|
||||
/* Initialize the interrupt system */
|
||||
int_init();
|
||||
|
||||
|
@ -328,16 +300,13 @@ void initialize() {
|
|||
log(LOG_INFO, "File system initialized.");
|
||||
}
|
||||
|
||||
/* Wait until the target duration has been reached _or_ the user presses a key */
|
||||
while (target_jiffies > sys_time_jiffies()) {
|
||||
short scan_code = sys_kbd_scancode();
|
||||
if (scan_code != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go back to text mode */
|
||||
// text_init();
|
||||
// /* Wait until the target duration has been reached _or_ the user presses a key */
|
||||
// while (target_jiffies > sys_time_jiffies()) {
|
||||
// short scan_code = sys_kbd_scancode();
|
||||
// if (scan_code != 0) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
|
@ -381,9 +350,6 @@ int main(int argc, char * argv[]) {
|
|||
sprintf(welcome, "Foenix/MCP v%02d.%02d-alpha+%04d\n\nType \"HELP\" or \"?\" for command summary.", VER_MAJOR, VER_MINOR, VER_BUILD);
|
||||
sys_chan_write(0, welcome, strlen(welcome));
|
||||
|
||||
short columns = 0, rows = 0;
|
||||
text_getsize(0, &columns, &rows);
|
||||
|
||||
cli_repl(0);
|
||||
|
||||
log(LOG_INFO, "Stopping.");
|
||||
|
|
9143
src/foenixmcp.s68
9143
src/foenixmcp.s68
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,7 @@
|
|||
|
||||
/* Text Color LUTs for Channel A */
|
||||
#define VKY3_A_LUT_SIZE 16
|
||||
#define VKY3_A_TEXT_LUT_FG ((volatile unsigned char *)0xFEC6C400) /**< Text foreground color look up table for channel A */
|
||||
#define VKY3_A_TEXT_LUT_BG ((volatile unsigned char *)0xFEC6C440) /**< Text background color look up table for channel A */
|
||||
#define VKY3_A_TEXT_LUT_FG ((volatile unsigned long *)0xFEC6C400) /**< Text foreground color look up table for channel A */
|
||||
#define VKY3_A_TEXT_LUT_BG ((volatile unsigned long *)0xFEC6C440) /**< Text background color look up table for channel A */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -328,7 +328,7 @@ extern short sys_chan_close(short chan);
|
|||
* Inputs:
|
||||
* screen = the screen number 0 for channel A, 1 for channel B
|
||||
*/
|
||||
extern void text_setsizes(short chan);
|
||||
extern void sys_text_setsizes(short chan);
|
||||
|
||||
/***
|
||||
*** Block device system calls
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
|
||||
#include "interrupt.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
|
||||
#define MAX_HANDLERS 48
|
||||
|
||||
|
|
32
src/log.c
32
src/log.c
|
@ -9,7 +9,7 @@
|
|||
#include "log.h"
|
||||
#include "simpleio.h"
|
||||
#include "syscalls.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
|
||||
static short log_channel = 0;
|
||||
static short log_level = 999;
|
||||
|
@ -109,29 +109,29 @@ void panic(void) {
|
|||
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);
|
||||
txt_init_screen(0);
|
||||
txt_set_border(0, 0);
|
||||
txt_set_color(0, 15, 1);
|
||||
txt_set_cursor(0, 0, 0, 0);
|
||||
txt_clear(0, 2);
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_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++);
|
||||
txt_set_xy(0, column, row++);
|
||||
sprintf(buffer, "\xB3 \xB3");
|
||||
print(0, buffer);
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
sprintf(buffer, "\xB3 Oh dear, something has gone wrong... \xB3");
|
||||
print(0, buffer);
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
sprintf(buffer, "\xB3 \xB3");
|
||||
print(0, buffer);
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
switch (panic_number) {
|
||||
case 2:
|
||||
sprintf(buffer, "\xB3 Bus Error \xB3");
|
||||
|
@ -166,29 +166,29 @@ void panic(void) {
|
|||
}
|
||||
print(0, buffer);
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
sprintf(buffer, "\xB3 \xB3");
|
||||
print(0, buffer);
|
||||
|
||||
if (address_expected) {
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
print(0, "\xB3 PC: ");
|
||||
print_hex_32(0, panic_pc);
|
||||
print(0, " Address: ");
|
||||
print_hex_32(0, panic_address);
|
||||
print(0, " \xB3");
|
||||
} else {
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
print(0, "\xB3 PC: ");
|
||||
print_hex_32(0, panic_pc);
|
||||
print(0, " \xB3");
|
||||
}
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_set_xy(0, column, row++);
|
||||
sprintf(buffer, "\xB3 \xB3");
|
||||
print(0, buffer);
|
||||
|
||||
text_set_xy(0, column, row++);
|
||||
txt_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);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "dev/block.h"
|
||||
#include "dev/fsys.h"
|
||||
#include "dev/rtc.h"
|
||||
#include "dev/txt_screen.h"
|
||||
#include "sys_general.h"
|
||||
|
||||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
|
@ -109,7 +110,7 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
|
|||
return cdev_register((p_dev_chan)param0);
|
||||
|
||||
case KFN_TEXT_SETSIZES:
|
||||
text_setsizes((short)param0);
|
||||
txt_setsizes((short)param0);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
|
|
18230
src/mapfile
18230
src/mapfile
File diff suppressed because it is too large
Load diff
|
@ -255,7 +255,7 @@ const unsigned char splashscreen_lut[] = {
|
|||
0xFD, 0xFD, 0xFD, 0x00,
|
||||
0xFE, 0xFE, 0xFE, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0x00,
|
||||
}
|
||||
};
|
||||
|
||||
const unsigned char splashscreen_pix[] = {
|
||||
0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01,
|
||||
|
@ -675,4 +675,4 @@ const unsigned char splashscreen_pix[] = {
|
|||
0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01,
|
||||
0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01,
|
||||
0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0x69, 0x01, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
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,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <string.h>
|
||||
#include "syscalls.h"
|
||||
#include "simpleio.h"
|
||||
#include "dev/text_screen_iii.h"
|
||||
#include "dev/txt_screen.h"
|
||||
|
||||
/*
|
||||
* Print a character to a channel
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
void print_c(short channel, char c) {
|
||||
//sys_chan_write_b(channel, c);
|
||||
text_put_raw(channel, c);
|
||||
txt_put(channel, c);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
|
||||
#define VER_MAJOR 0
|
||||
#define VER_MINOR 3
|
||||
#define VER_BUILD 6
|
||||
#define VER_BUILD 8
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue