Added sys_txt_get_sizes

Added sys_txt_get_sizes to return the size of a screen in characters and pixels.
This commit is contained in:
Peter Weingartner 2022-05-02 19:27:39 -04:00
parent 7185377535
commit 9a6af9bbe7
16 changed files with 8694 additions and 8572 deletions

Binary file not shown.

View file

@ -0,0 +1 @@
,RYOKO/pjw,Ryoko,02.05.2022 19:18,file:///C:/Users/pjw/AppData/Roaming/LibreOffice/4;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -205,27 +205,32 @@ short cmd_cls(short channel, int argc, const char * argv[]) {
* Display information about the system * Display information about the system
*/ */
short cmd_sysinfo(short channel, int argc, const char * argv[]) { short cmd_sysinfo(short channel, int argc, const char * argv[]) {
t_extent text_size, pixel_size;
char buffer[80]; char buffer[80];
sprintf(buffer, "System information:\nModel: %s", cli_sys_info.model_name); sprintf(buffer, "\nSystem information:\nModel: %s\n", cli_sys_info.model_name);
print(channel, buffer); print(channel, buffer);
sprintf(buffer, "\nCPU: %s", cli_sys_info.cpu_name); sprintf(buffer, "CPU: %s\n", cli_sys_info.cpu_name);
print(channel, buffer); print(channel, buffer);
sprintf(buffer, "\nClock (kHz): %u", cli_sys_info.cpu_clock_khz); sprintf(buffer, "Clock (kHz): %u\n", cli_sys_info.cpu_clock_khz);
print(channel, buffer); print(channel, buffer);
sprintf(buffer, "\nSystem Memory: 0x%lX", cli_sys_info.system_ram_size); sprintf(buffer, "System Memory: 0x%lX\n", cli_sys_info.system_ram_size);
print(channel, buffer); print(channel, buffer);
sprintf(buffer, "\nFPGA Model: %08lX", cli_sys_info.fpga_model); sprintf(buffer, "FPGA Model: %08lX\n", cli_sys_info.fpga_model);
print(channel, buffer); print(channel, buffer);
sprintf(buffer, "\nFPGA Version: %04X.%04X", cli_sys_info.fpga_version, cli_sys_info.fpga_subver); sprintf(buffer, "FPGA Version: %04X.%04X\n", cli_sys_info.fpga_version, cli_sys_info.fpga_subver);
print(channel, buffer); print(channel, buffer);
sprintf(buffer, "\nMCP version: v%02u.%02u.%04u\n", cli_sys_info.mcp_version, cli_sys_info.mcp_rev, cli_sys_info.mcp_build); sprintf(buffer, "MCP version: v%02u.%02u.%04u\n", cli_sys_info.mcp_version, cli_sys_info.mcp_rev, cli_sys_info.mcp_build);
print(channel, buffer);
sys_txt_get_sizes(0, &text_size, &pixel_size);
sprintf(buffer, "Screen#0 size: %dx%d characters, %dx%d pixels.\n", text_size.width, text_size.height, pixel_size.width, pixel_size.height);
print(channel, buffer); print(channel, buffer);
return 0; return 0;

View file

@ -97,6 +97,24 @@ void txt_a2560k_a_set_sizes() {
} }
} }
/**
* Get the display resolutions
*
* @param text_size the size of the screen in visible characters (may be null)
* @param pixel_size the size of the screen in pixels (may be null)
*/
void txt_a2560k_a_get_sizes(p_extent text_size, p_extent pixel_size) {
if (text_size) {
text_size->width = a2560k_a_visible_size.width;
text_size->height = a2560k_a_visible_size.height;
}
if (pixel_size) {
pixel_size->width = a2560k_a_resolution.width;
pixel_size->height = a2560k_a_resolution.height;
}
}
/** /**
* Set the display mode for the screen * Set the display mode for the screen
* *
@ -618,6 +636,7 @@ short txt_a2560k_a_install() {
device.put = txt_a2560k_a_put; device.put = txt_a2560k_a_put;
device.scroll = txt_a2560k_a_scroll; device.scroll = txt_a2560k_a_scroll;
device.fill = txt_a2560k_a_fill; device.fill = txt_a2560k_a_fill;
device.get_sizes = txt_a2560k_a_get_sizes;
return txt_register(&device); return txt_register(&device);
} }

View file

@ -88,6 +88,24 @@ void txt_a2560k_b_set_sizes() {
} }
} }
/**
* Get the display resolutions
*
* @param text_size the size of the screen in visible characters (may be null)
* @param pixel_size the size of the screen in pixels (may be null)
*/
void txt_a2560k_b_get_sizes(p_extent text_size, p_extent pixel_size) {
if (text_size) {
text_size->width = a2560k_b_visible_size.width;
text_size->height = a2560k_b_visible_size.height;
}
if (pixel_size) {
pixel_size->width = a2560k_b_resolution.width;
pixel_size->height = a2560k_b_resolution.height;
}
}
/** /**
* Set the display mode for the screen * Set the display mode for the screen
* *
@ -645,6 +663,7 @@ short txt_a2560k_b_install() {
device.put = txt_a2560k_b_put; device.put = txt_a2560k_b_put;
device.scroll = txt_a2560k_b_scroll; device.scroll = txt_a2560k_b_scroll;
device.fill = txt_a2560k_b_fill; device.fill = txt_a2560k_b_fill;
device.get_sizes = txt_a2560k_b_get_sizes;
return txt_register(&device); return txt_register(&device);
} }

View file

@ -48,6 +48,7 @@ void txt_init() {
txt_device_driver[i].put = 0; txt_device_driver[i].put = 0;
txt_device_driver[i].scroll = 0; txt_device_driver[i].scroll = 0;
txt_device_driver[i].fill = 0; txt_device_driver[i].fill = 0;
txt_device_driver[i].get_sizes = 0;
} }
} }
@ -89,6 +90,7 @@ short txt_register(p_txt_device device) {
txt_device_driver[i].put = device->put; txt_device_driver[i].put = device->put;
txt_device_driver[i].scroll = device->scroll; txt_device_driver[i].scroll = device->scroll;
txt_device_driver[i].fill = device->fill; txt_device_driver[i].fill = device->fill;
txt_device_driver[i].get_sizes = device->get_sizes;
return 0; return 0;
} else { } else {
@ -694,3 +696,19 @@ void txt_delete(short screen, short count) {
txt_set_region(screen, &old_region); txt_set_region(screen, &old_region);
} }
} }
/**
* Get the display resolutions
*
* @param screen the screen number 0 for channel A, 1 for channel B
* @param text_size the size of the screen in visible characters (may be null)
* @param pixel_size the size of the screen in pixels (may be null)
*/
void txt_get_sizes(short screen, p_extent text_size, p_extent pixel_size) {
p_txt_device device = txt_get_device(screen);
if (device) {
if (device->get_sizes) {
device->get_sizes(text_size, pixel_size);
}
}
}

View file

@ -49,6 +49,7 @@ typedef void (*p_get_xy)(p_point position);
typedef void (*p_put)(char c); typedef void (*p_put)(char c);
typedef void (*p_scroll)(short horizontal, short vertical); typedef void (*p_scroll)(short horizontal, short vertical);
typedef void (*p_fill)(char c); typedef void (*p_fill)(char c);
typedef void (*p_get_sizes)(p_extent text_size, p_extent pixel_size);
/** /**
* @struct s_txt_device * @struct s_txt_device
@ -81,6 +82,7 @@ typedef struct s_txt_device {
p_put put; /**< Pointer to the device's put function */ p_put put; /**< Pointer to the device's put function */
p_scroll scroll; /**< Pointer to the device's scroll function */ p_scroll scroll; /**< Pointer to the device's scroll function */
p_fill fill; /**< Pointer to the device's fill function */ p_fill fill; /**< Pointer to the device's fill function */
p_get_sizes get_sizes; /**< Pointer to the device's get_sizes function */
} t_txt_device, *p_txt_device; } t_txt_device, *p_txt_device;
/** /**
@ -340,4 +342,13 @@ extern void txt_insert(short screen, short count);
*/ */
extern void txt_delete(short screen, short count); extern void txt_delete(short screen, short count);
/**
* Get the display resolutions
*
* @param screen the screen number 0 for channel A, 1 for channel B
* @param text_size the size of the screen in visible characters (may be null)
* @param pixel_size the size of the screen in pixels (may be null)
*/
extern void txt_get_sizes(short screen, p_extent text_size, p_extent pixel_size);
#endif #endif

View file

@ -118,6 +118,7 @@
#define KFN_TXT_SCROLL 0x6F /* Scroll the current region */ #define KFN_TXT_SCROLL 0x6F /* Scroll the current region */
// #define KFN_TXT_FILL 0x70 /* Fill the current region */ // #define KFN_TXT_FILL 0x70 /* Fill the current region */
#define KFN_TXT_SET_CURSOR_VIS 0x71 /* Set cursor visibility */ #define KFN_TXT_SET_CURSOR_VIS 0x71 /* Set cursor visibility */
#define KFN_TXT_GET_SIZES 0x72 /* Get the screen size (visible text cells and total pixel resolution) */
/* /*
* Call into the kernel (provided by assembly) * Call into the kernel (provided by assembly)
@ -873,4 +874,13 @@ extern void sys_txt_set_cursor_visible(short screen, short is_visible);
*/ */
extern short sys_txt_set_font(short screen, short width, short height, unsigned char * data); extern short sys_txt_set_font(short screen, short width, short height, unsigned char * data);
/**
* Get the display resolutions
*
* @param screen the screen number 0 for channel A, 1 for channel B
* @param text_size the size of the screen in visible characters (may be null)
* @param pixel_size the size of the screen in pixels (may be null)
*/
extern void sys_txt_get_sizes(short screen, p_extent text_size, p_extent pixel_size);
#endif #endif

View file

@ -343,7 +343,11 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
case KFN_TXT_SET_CURSOR_VIS: case KFN_TXT_SET_CURSOR_VIS:
/* Set the cursor visibility */ /* Set the cursor visibility */
txt_set_cursor_visible((short)param0, (short)param1); txt_set_cursor_visible((short)param0, (short)param1);
break; return 0;
case KFN_TXT_GET_SIZES:
txt_get_sizes((short)param0, (p_extent)param1, (p_extent)param2);
return 0;
default: default:
return ERR_GENERAL; return ERR_GENERAL;

17148
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -849,3 +849,14 @@ void sys_txt_set_cursor_visible(short screen, short is_visible) {
short sys_txt_set_font(short screen, short width, short height, unsigned char * data) { short sys_txt_set_font(short screen, short width, short height, unsigned char * data) {
return syscall(KFN_TXT_SET_FONT, screen, width, height, data); return syscall(KFN_TXT_SET_FONT, screen, width, height, data);
} }
/**
* Get the display resolutions
*
* @param screen the screen number 0 for channel A, 1 for channel B
* @param text_size the size of the screen in visible characters (may be null)
* @param pixel_size the size of the screen in pixels (may be null)
*/
void sys_txt_get_sizes(short screen, p_extent text_size, p_extent pixel_size) {
syscall(KFN_TXT_GET_SIZES, screen, text_size, pixel_size);
}

View file

@ -6,7 +6,7 @@
#define __VERSION_H #define __VERSION_H
#define VER_MAJOR 0 #define VER_MAJOR 0
#define VER_MINOR 52 #define VER_MINOR 53
#define VER_BUILD 39 #define VER_BUILD 2
#endif #endif