More file cleanup
Removed some unnecessary included files... reduced size of the build a little.
This commit is contained in:
parent
f2ad2d84aa
commit
dd97ce82b9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
36
src/boot.c
36
src/boot.c
|
@ -77,6 +77,8 @@ static enum boot_src_e boot_chain[MAX_BOOT_SRC];
|
|||
static bool bootable[MAX_BOOT_SRC];
|
||||
static short boot_src_cnt = 0;
|
||||
|
||||
extern t_sys_info info;
|
||||
|
||||
/**
|
||||
* @brief A holder for empty arguments list so we have something to point to when starting a binary file
|
||||
*
|
||||
|
@ -86,6 +88,37 @@ static char * boot_args[] = {
|
|||
0
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Display the system information
|
||||
*
|
||||
*/
|
||||
static void display_sysinfo() {
|
||||
// 8 x 22 region
|
||||
t_rect region;
|
||||
region.size.height = 8;
|
||||
region.size.width = 23;
|
||||
region.origin.x = 80 - region.size.width;
|
||||
region.origin.y = 60 - region.size.height;
|
||||
|
||||
txt_set_region(0, ®ion);
|
||||
|
||||
printf("Foenix Retro Systems\n");
|
||||
printf("Model %s\n", info.model_name);
|
||||
printf("CPU %s\n", info.cpu_name);
|
||||
printf("Clock %lu MHz\n", info.cpu_clock_khz / (long)1000);
|
||||
printf("Memory %d KB\n", (int)(info.system_ram_size / ((long)1024 * (long)1024)));
|
||||
printf("FPGA %04X %04X.%04X\n", info.fpga_model, info.fpga_version, info.fpga_subver);
|
||||
printf("Toolbox v%d.%02d.%04d\n", info.mcp_version, info.sub_model, info.mcp_build);
|
||||
|
||||
region.size.width = 0;
|
||||
region.size.height = 0;
|
||||
region.origin.x = 0;
|
||||
region.origin.y = 0;
|
||||
|
||||
txt_set_region(0, ®ion);
|
||||
txt_set_xy(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check the memory indicated to validate it is a boot record... if so, launch the code indicated
|
||||
*
|
||||
|
@ -459,6 +492,9 @@ void boot_screen() {
|
|||
|
||||
*tvky_layers = 0x0444;
|
||||
|
||||
// Display the system information;
|
||||
display_sysinfo();
|
||||
|
||||
// Set up the text window for the boot messaging
|
||||
t_rect boot_text_window;
|
||||
boot_text_window.origin.x = 14;
|
||||
|
|
152
src/dev/bitmap.c
152
src/dev/bitmap.c
|
@ -1,152 +0,0 @@
|
|||
/**
|
||||
* @file bitmap.c
|
||||
* @author your name (you@domain.com)
|
||||
* @brief Simple bitmap management code
|
||||
* @version 0.1
|
||||
* @date 2023-10-02
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "dma.h"
|
||||
#include "vicky_general.h"
|
||||
|
||||
#define NUM_BITMAP_PLANES 2
|
||||
|
||||
static uint8_t bm_visible = 0; // Track whether a given bitmap plane is visible
|
||||
|
||||
/**
|
||||
* @brief Set the visibility of a given bitmap plane, and the CLUT to use
|
||||
*
|
||||
* @param plane the number of the bitmap to update
|
||||
* @param clut the number of the CLUT to use for the bitmap
|
||||
* @param is_visible 0 to hide the bitmap, any other number to show it
|
||||
*/
|
||||
void bm_set_visibility(short plane, short clut, short is_visible) {
|
||||
uint8_t new_control_value = (clut & 0x03) << 1 | (is_visible) ? 1 : 0;
|
||||
|
||||
switch(plane) {
|
||||
case 0:
|
||||
*bm0_control = new_control_value;
|
||||
if (is_visible) {
|
||||
bm_visible |= 0x01;
|
||||
} else {
|
||||
bm_visible &= ~0x01;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
*bm1_control = new_control_value;
|
||||
if (is_visible) {
|
||||
bm_visible |= 0x02;
|
||||
} else {
|
||||
bm_visible &= ~0x02;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (bm_visible) {
|
||||
tvky_mstr_ctrl->raw = tvky_mstr_ctrl->raw | VKY_MCR_TEXT_OVERLAY | VKY_MCR_GRAPHICS | VKY_MCR_BITMAP;
|
||||
} else {
|
||||
tvky_mstr_ctrl->raw = tvky_mstr_ctrl->raw & ~(VKY_MCR_TEXT_OVERLAY | VKY_MCR_GRAPHICS | VKY_MCR_BITMAP);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the
|
||||
*
|
||||
* @param plane the number of the bitmap to set
|
||||
* @param src the address of the bitmap data to use (should be in video RAM)
|
||||
*/
|
||||
void bm_set_data(short plane, uint8_t * src) {
|
||||
uint32_t src_raw = (uint32_t)src - (uint32_t)vram_base;
|
||||
|
||||
switch (plane) {
|
||||
case 0:
|
||||
bm0_address[0] = (uint8_t)(src_raw & 0xff);
|
||||
bm0_address[1] = (uint8_t)((src_raw >> 8) & 0xff);
|
||||
bm0_address[2] = (uint8_t)((src_raw >> 16) & 0xff);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
bm1_address[0] = (uint8_t)(src_raw & 0xff);
|
||||
bm1_address[1] = (uint8_t)((src_raw >> 8) & 0xff);
|
||||
bm1_address[2] = (uint8_t)((src_raw >> 16) & 0xff);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fill the bitmap data with a given color
|
||||
*
|
||||
* @param dest the area of video RAM to fill
|
||||
* @param color the color index to fill it with
|
||||
* @param width the width of the image in pixels
|
||||
* @param height the height of the image in pixels
|
||||
*/
|
||||
void bm_fill(uint8_t * dest, uint8_t color, int width, int height) {
|
||||
vdma_fill_linear(dest, color, (long)width * (long)height);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load the color lookup table
|
||||
*
|
||||
* @param clut number of the CLUT to load
|
||||
* @param src pointer to the source data for the CLUT (in B, G, R, A order)
|
||||
*/
|
||||
void bm_load_clut(short clut, uint8_t * src) {
|
||||
uint8_t * base = (uint8_t *)((uint32_t)VKY_GR_CLUT_0 + 4l * 256l * (uint32_t)clut);
|
||||
|
||||
tvky_bg_color->blue = src[0];
|
||||
tvky_bg_color->green = src[1];
|
||||
tvky_bg_color->red = src[2];
|
||||
|
||||
for (int i = 0; i < 4 * 256; i++) {
|
||||
base[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load RLE bitmap data into video RAM
|
||||
*
|
||||
* @param dest address to load with the expanded bitmap data (should be in video RAM)
|
||||
* @param src address of the RLE data to expand
|
||||
* @param width the width of the image in pixels
|
||||
* @param height the height of the image in pixels
|
||||
*/
|
||||
void bm_load_rle(uint8_t * dest, uint8_t * src, int width, int height) {
|
||||
uint32_t my_base = (uint32_t)dest;
|
||||
|
||||
// Clear the image map
|
||||
bm_fill(dest, 0, width, height);
|
||||
|
||||
uint8_t count = *(src++);
|
||||
while (count != 0) {
|
||||
uint8_t value = *(src++);
|
||||
if (value != 0) {
|
||||
volatile uint8_t * my_pointer = (uint8_t *)my_base;
|
||||
for (int i = 0; i < count; i++) {
|
||||
my_pointer[i] = value;
|
||||
}
|
||||
}
|
||||
my_base += count;
|
||||
|
||||
count = *(src++);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the bitmap system
|
||||
*
|
||||
*/
|
||||
void bm_init() {
|
||||
bm_visible = 0;
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
* @brief Definitions for functions to manage bitmap displays
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BITMAP_H__
|
||||
#define __BITMAP_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Set the visibility of a given bitmap plane, and the CLUT to use
|
||||
*
|
||||
* @param plane the number of the bitmap to update
|
||||
* @param clut the number of the CLUT to use for the bitmap
|
||||
* @param is_visible 0 to hide the bitmap, any other number to show it
|
||||
*/
|
||||
extern void bm_set_visibility(short plane, short clut, short is_visible);
|
||||
|
||||
/**
|
||||
* @brief Set the
|
||||
*
|
||||
* @param plane the number of the bitmap to set
|
||||
* @param src the address of the bitmap data to use (should be in video RAM)
|
||||
*/
|
||||
extern void bm_set_data(short plane, uint8_t * src);
|
||||
|
||||
/**
|
||||
* @brief Fill the bitmap data with a given color
|
||||
*
|
||||
* @param dest the area of video RAM to fill
|
||||
* @param color the color index to fill it with
|
||||
* @param width the width of the image in pixels
|
||||
* @param height the height of the image in pixels
|
||||
*/
|
||||
extern void bm_fill(uint8_t * dest, uint8_t color, int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Load the color lookup table
|
||||
*
|
||||
* @param clut number of the CLUT to load
|
||||
* @param src pointer to the source data for the CLUT (in B, G, R, A order)
|
||||
*/
|
||||
extern void bm_load_clut(short clut, uint8_t * src);
|
||||
|
||||
/**
|
||||
* @brief Load RLE bitmap data into video RAM
|
||||
*
|
||||
* @param dest address to load with the expanded bitmap data (should be in video RAM)
|
||||
* @param src address of the RLE data to expand
|
||||
* @param width the width of the image in pixels
|
||||
* @param height the height of the image in pixels
|
||||
*/
|
||||
extern void bm_load_rle(uint8_t * dest, uint8_t * src, int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Initialize the bitmap system
|
||||
*
|
||||
*/
|
||||
extern void bm_init();
|
||||
|
||||
#endif
|
|
@ -1,215 +0,0 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vicky_general.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
|
||||
struct bmp_color_s {
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
uint8_t reserved;
|
||||
};
|
||||
|
||||
struct bmp_infoheader_s {
|
||||
uint32_t infoheader_size;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint16_t planes;
|
||||
uint16_t bit_count;
|
||||
uint32_t compression;
|
||||
uint32_t image_size;
|
||||
uint32_t x_pixels_per_m;
|
||||
uint32_t y_pixels_per_m;
|
||||
uint32_t colors_used;
|
||||
uint32_t colors_important;
|
||||
struct bmp_color_s color_table[];
|
||||
};
|
||||
|
||||
struct bmp_header_s {
|
||||
char signature[2];
|
||||
uint32_t file_size;
|
||||
uint32_t reserved;
|
||||
uint32_t offset;
|
||||
struct bmp_infoheader_s info_header;
|
||||
};
|
||||
|
||||
const uint16_t BMP_BC_MONO = 1; // Monochrome
|
||||
const uint16_t BMP_BC_INDEX_16 = 4; // 4-bit indexed color (16 colors total)
|
||||
const uint16_t BMP_BC_INDEX_256 = 8; // 8-bit indexed color (256 colors total)
|
||||
const uint16_t BMP_BC_RGB_16 = 16; // 16-bit RGB
|
||||
const uint16_t BMP_BC_RGB_24 = 24; // 24-bit RGB (True Color)
|
||||
|
||||
const uint32_t BMP_RGB = 0; // No compression
|
||||
const uint32_t BMP_RLE8 = 1; // 8-bit run-length-encoded
|
||||
const uint32_t BMP_RLE4 = 2; // 4-bit run-length-encoded
|
||||
|
||||
const short BMP_OK = 0; // BMP file was processed without error
|
||||
const short BMP_BAD_FILETYPE = -1; // File does not have a BMP signature
|
||||
const short BMP_BAD_FORMAT = -2; // BMP file is not in a supported format (color format or compression)
|
||||
|
||||
/**
|
||||
* @brief Set the components of a color in a graphics color lookup table
|
||||
*
|
||||
* NOTE: this routine might need to be swapped out for different hardware
|
||||
*
|
||||
* @param clut the number of the graphics CLUT to update
|
||||
* @param color the number of the color to update
|
||||
* @param red the red component
|
||||
* @param green the green component
|
||||
* @param blue the blue component
|
||||
*/
|
||||
static void bm_set_color(short clut, short color, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
volatile uint8_t * clut_p = VKY_GR_CLUT_0 + (clut * 256 * 4);
|
||||
uint32_t offset = color * 4;
|
||||
clut_p[offset] = blue;
|
||||
clut_p[offset+1] = green;
|
||||
clut_p[offset+2] = red;
|
||||
clut_p[offset+3] = 0xff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load a color lookup table
|
||||
*
|
||||
* @param src_colors pointer to the BMP color table
|
||||
* @param numcolors the number of colors in the BMP color table
|
||||
* @param clut the number of the color palette to load
|
||||
*/
|
||||
static void load_palette(struct bmp_color_s * src_colors, int numcolors, int clut) {
|
||||
for (int color = 0; color < numcolors; color++) {
|
||||
bm_set_color(clut, color, src_colors[color].red, src_colors[color].green, src_colors[color].blue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decompress the BMP 256 color image data, given 8-bit RLE compression
|
||||
*
|
||||
* @param img_data pointer to the BMP compressed image data
|
||||
* @param width the width of the image to build up
|
||||
* @param height the height of the image to build up
|
||||
* @param destination pointer to the destination to expand the image into
|
||||
*/
|
||||
static void expand_index8_rle8(char * img_data, uint32_t width, uint32_t height, char * destination) {
|
||||
int i = 0;
|
||||
uint32_t row = 0;
|
||||
uint32_t column = 0;
|
||||
uint32_t img_index = 0;
|
||||
|
||||
// Calculate address of the first row
|
||||
char * dest_row = (char *)((uint32_t)destination + (height - row - 1) * width);
|
||||
|
||||
// Default the image to color 0
|
||||
memset(destination, 0, width * height);
|
||||
|
||||
// Process the data blocks in the image data until we reach the end of the image
|
||||
while (1) {
|
||||
char count = img_data[img_index++];
|
||||
char value = img_data[img_index++];
|
||||
|
||||
if (count > 0) {
|
||||
// We have a run of bytes
|
||||
for (i = 0; i < count; i++) {
|
||||
dest_row[column++] = value;
|
||||
if (column >= width) {
|
||||
column = 0;
|
||||
row -= 1;
|
||||
dest_row = (char *)((uint32_t)destination + (height - row - 1) * width);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Count == 0: we have to process the escape sequence
|
||||
switch (value) {
|
||||
case 0:
|
||||
// End of line... handle padding
|
||||
img_index += (3 - img_index % 4);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// End of bitmap... we're done
|
||||
return;
|
||||
|
||||
case 2:
|
||||
// Delta... adjust row and column
|
||||
char dx = img_data[img_index++];
|
||||
char dy = img_data[img_index++];
|
||||
|
||||
row += dy;
|
||||
column += dx;
|
||||
dest_row = (char *)((uint32_t)destination + (height - row - 1) * width);
|
||||
break;
|
||||
|
||||
default:
|
||||
// value indicates the number of bytes to copy raw
|
||||
for (i = 0; i < value; i++) {
|
||||
char b = img_data[img_index++];
|
||||
dest_row[column++] = b;
|
||||
if (column >= width) {
|
||||
column = 0;
|
||||
row -= 1;
|
||||
dest_row = (char *)((uint32_t)destination + (height - row - 1) * width);
|
||||
}
|
||||
|
||||
if (img_index % 2) {
|
||||
// Skip over padding, if we're on an odd byte
|
||||
img_index++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BMP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Render a BMP file into a destination bitmap image and a destination color palette
|
||||
*
|
||||
* @param bmp_data pointer to the raw BMP data
|
||||
* @param dest_img pointer to the area in memory to load the expanded bitmap data
|
||||
* @param clut the number of the graphics CLUT to use for the image
|
||||
* @return 0 if image could be processed, any other number is an error
|
||||
*/
|
||||
short bm_bmp_render(char * bmp_data, char * dest_img, short clut) {
|
||||
struct bmp_header_s * bmp_header = (struct bmp_header_s *)bmp_data;
|
||||
if ((bmp_header->signature[0] == 'B') & (bmp_header->signature[0] == 'M')) {
|
||||
// We have a BMP file... calculate the starting address of the image data
|
||||
uint8_t * img_data = (uint8_t *)(bmp_data + bmp_header->offset);
|
||||
|
||||
// Get the statistics on the BMP image
|
||||
uint32_t width = bmp_header->info_header.width;
|
||||
uint32_t height = bmp_header->info_header.height;
|
||||
uint32_t bit_count = bmp_header->info_header.bit_count;
|
||||
uint32_t compression = bmp_header->info_header.compression;
|
||||
|
||||
// Dispatch to the correct expansion routine based on the color mode and the compression
|
||||
switch (bit_count) {
|
||||
case BMP_BC_INDEX_256:
|
||||
switch (compression) {
|
||||
case BMP_RLE8:
|
||||
// 256 color indexed compressed using RLE8
|
||||
load_palette(bmp_header->info_header.color_table, (int)bmp_header->info_header.colors_used, clut);
|
||||
expand_index8_rle8(img_data, width, height, dest_img);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unsupported compression for 256 color mode
|
||||
return BMP_BAD_FORMAT;
|
||||
}
|
||||
|
||||
default:
|
||||
// Unsupported color mode
|
||||
return BMP_BAD_FORMAT;
|
||||
}
|
||||
|
||||
return BMP_OK;
|
||||
} else {
|
||||
return BMP_BAD_FILETYPE;
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* @file bmp_expand.h
|
||||
* @author your name (you@domain.com)
|
||||
* @brief Provide a way to convert some BMP files to a bitmap image
|
||||
* @version 0.1
|
||||
* @date 2024-06-07
|
||||
*
|
||||
* @copyright Copyright (c) 2024
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __bmp_expand_h__
|
||||
#define __bmp_expand_h__
|
||||
|
||||
extern const short BMP_OK; // BMP file was processed without error
|
||||
extern const short BMP_BAD_FILETYPE; // File does not have a BMP signature
|
||||
extern const short BMP_BAD_FORMAT; // BMP file is not in a supported format (color format or compression)
|
||||
|
||||
/**
|
||||
* @brief Render a BMP file into a destination bitmap image and a destination color palette
|
||||
*
|
||||
* @param bmp_data pointer to the raw BMP data
|
||||
* @param dest_img pointer to the area in memory to load the expanded bitmap data
|
||||
* @param clut the number of the graphics CLUT to use for the image
|
||||
* @return 0 if image could be processed, any other number is an error
|
||||
*/
|
||||
extern short bm_bmp_render(char * bmp_data, char * dest_img, short clut);
|
||||
|
||||
#endif
|
|
@ -15,9 +15,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "features.h"
|
||||
#include "constants.h"
|
||||
#include "dev/channel.h"
|
||||
#if HAS_FLOPPY
|
||||
#include "dev/fdc.h"
|
||||
#endif
|
||||
#include "errors.h"
|
||||
#include "elf.h"
|
||||
#include "fsys.h"
|
||||
|
@ -108,11 +111,13 @@ void fsys_update_stat(const char * path) {
|
|||
}
|
||||
}
|
||||
|
||||
#if HAS_FLOPPY
|
||||
if (strncmp(buffer, "/fd", 3) == 0) {
|
||||
// If the drive is the floppy drive, force the drive to spin up and check for a disk change
|
||||
// this will update the fdc_status, which will be seen by FatFS and treated appropriately
|
||||
sys_bdev_ioctrl(BDEV_FDC, FDC_CTRL_CHECK_CHANGE, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -877,9 +882,11 @@ SYSTEMCALL short fsys_set_label(short drive, const char * label) {
|
|||
|
||||
// If the drive being labeled is on the floppy drive, make sure the FDC status
|
||||
// is updated correctly for disk change by spinning up the motor and checking the DIR register
|
||||
#if HAS_FLOPPY
|
||||
if (drive == BDEV_FDC) {
|
||||
sys_bdev_ioctrl(BDEV_FDC, FDC_CTRL_CHECK_CHANGE, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
sprintf(buffer, "%d:%s", drive, label);
|
||||
fres = f_setlabel(buffer);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef __kbd_f256_h__
|
||||
#define __kbd_f256_h__
|
||||
|
||||
#include "sys_general.h"
|
||||
|
||||
#if MODEL == MODEL_FOENIX_F256
|
||||
#include "kbd_f256jr.h"
|
||||
#elif MODEL == MODEL_FOENIX_F256K || MODEL == MODEL_FOENIX_F256K2
|
||||
|
|
223
src/toolbox.c
223
src/toolbox.c
|
@ -43,13 +43,14 @@
|
|||
#include "syscalls.h"
|
||||
#include "timers.h"
|
||||
#include "boot.h"
|
||||
#include "dev/bitmap.h"
|
||||
#include "memory.h"
|
||||
#include "dev/block.h"
|
||||
#include "dev/channel.h"
|
||||
#include "dev/console.h"
|
||||
#include "dev/dma.h"
|
||||
#if HAS_FLOPPY
|
||||
#include "dev/fdc.h"
|
||||
#endif
|
||||
#include "dev/fsys.h"
|
||||
#include "dev/iec.h"
|
||||
#include "iecll.h"
|
||||
|
@ -65,7 +66,6 @@
|
|||
#include "vicky_general.h"
|
||||
#include "fatfs/ff.h"
|
||||
#include "rsrc/font/MSX_CP437_8x8.h"
|
||||
#include "rsrc/bitmaps/splash_c256_u.h"
|
||||
|
||||
const char* VolumeStr[FF_VOLUMES] = { "sd0", "sd1" };
|
||||
|
||||
|
@ -133,10 +133,6 @@ void initialize() {
|
|||
|
||||
INFO("Text system initialized.");
|
||||
|
||||
// // Initialize the bitmap system
|
||||
// bm_init();
|
||||
// INFO("Bitmap system initialized...");
|
||||
|
||||
/* Initialize the indicators */
|
||||
ind_init();
|
||||
INFO("Indicators initialized");
|
||||
|
@ -257,219 +253,6 @@ void initialize() {
|
|||
}
|
||||
}
|
||||
|
||||
t_file_info dir;
|
||||
uint8_t buffer[512];
|
||||
|
||||
void dump(uint8_t * buffer, int count) {
|
||||
char char_buffer[17];
|
||||
|
||||
printf("\n");
|
||||
|
||||
short index = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if ((i > 0) && (i % 16 == 0)) {
|
||||
index = 0;
|
||||
char_buffer[16] = 0;
|
||||
printf(" %s\n", char_buffer);
|
||||
} else if (i > 0) {
|
||||
char c = buffer[i];
|
||||
printf("%02X ", c);
|
||||
|
||||
if (isalpha(c) || isdigit(c)) {
|
||||
char_buffer[index++] = c;
|
||||
} else {
|
||||
char_buffer[index++] = '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf(" %s\n", char_buffer);
|
||||
}
|
||||
|
||||
union fatfs_date_u {
|
||||
struct {
|
||||
unsigned int day : 5;
|
||||
unsigned int month : 4;
|
||||
unsigned int year : 7;
|
||||
} s;
|
||||
short date;
|
||||
};
|
||||
|
||||
union fatfs_time_u {
|
||||
struct {
|
||||
unsigned int second : 5;
|
||||
unsigned int minute : 6;
|
||||
unsigned int hour : 5;
|
||||
} s;
|
||||
short time;
|
||||
};
|
||||
|
||||
void print_fatfs_datetime(short date, short time) {
|
||||
union fatfs_date_u fat_date;
|
||||
union fatfs_time_u fat_time;
|
||||
|
||||
fat_date.date = date;
|
||||
fat_time.time = time;
|
||||
|
||||
printf("%04d-%02d-%02d %02d:%02d ", fat_date.s.year + 1980, fat_date.s.month, fat_date.s.day, fat_time.s.hour, fat_time.s.minute);
|
||||
}
|
||||
|
||||
void print_directory() {
|
||||
printf("\nDirectory for /sd0/\n");
|
||||
short fd = fsys_opendir("/sd0/");
|
||||
if (fd > -1) {
|
||||
INFO("fsys_opendir");
|
||||
|
||||
short result = fsys_readdir(fd, &dir);
|
||||
while ((result == 0) && (dir.name[0] != 0)) {
|
||||
if (dir.name[0] == 0) {
|
||||
break;
|
||||
} else {
|
||||
if ((dir.attributes & FSYS_AM_SYS) == 0) {
|
||||
print_fatfs_datetime(dir.date, dir.time);
|
||||
printf(" %4ld ", dir.size);
|
||||
|
||||
if (dir.attributes & FSYS_AM_DIR) {
|
||||
printf(" %s/\n", dir.name);
|
||||
} else {
|
||||
printf(" %s\n", dir.name);
|
||||
}
|
||||
}
|
||||
|
||||
result = fsys_readdir(fd, &dir);
|
||||
}
|
||||
}
|
||||
|
||||
fsys_closedir(fd);
|
||||
INFO("fsys_closedir");
|
||||
} else {
|
||||
ERROR1("Could not open directory %d", fd);
|
||||
}
|
||||
}
|
||||
|
||||
void create_sample_file(const char * path) {
|
||||
printf("\nTrying to create: %s\n", path);
|
||||
short fd = fsys_open(path, FSYS_CREATE_ALWAYS | FSYS_WRITE);
|
||||
if (fd > 0) {
|
||||
char message[80];
|
||||
printf("Got channel #%d\n", fd);
|
||||
sprintf(message, "Hello, world!\n");
|
||||
short result = chan_write(fd, (uint8_t *)message, strlen(message));
|
||||
printf("Wrote %d characters.\n", result);
|
||||
fsys_close(fd);
|
||||
|
||||
} else {
|
||||
printf("Could not create file: %d\n", fd);
|
||||
}
|
||||
}
|
||||
|
||||
void read_sample_file(const char * path) {
|
||||
printf("\nContents of %s:\n", path);
|
||||
short fd = fsys_open(path, FSYS_READ);
|
||||
if (fd >= 0) {
|
||||
short c = 0;
|
||||
short status;
|
||||
do {
|
||||
c = chan_read_b(fd);
|
||||
chan_write_b(0, (uint8_t)c);
|
||||
status = chan_status(fd);
|
||||
} while ((status & CDEV_STAT_EOF) == 0);
|
||||
chan_close(fd);
|
||||
|
||||
} else {
|
||||
printf("Could not open file: %d\n", fd);
|
||||
}
|
||||
}
|
||||
|
||||
void test_sdc() {
|
||||
print_directory();
|
||||
|
||||
printf("\nfsys_rename(\"/sd0/hello.txt\", \"/sd0/renamed.txt\")");
|
||||
fsys_rename("/sd0/hello.txt", "/sd0/renamed.txt");
|
||||
print_directory();
|
||||
|
||||
printf("\nfsys_delete(\"/sd0/renamed.txt\")");
|
||||
fsys_delete("/sd0/renamed.txt");
|
||||
print_directory();
|
||||
|
||||
printf("\nCreating /sd0/hello.txt\n");
|
||||
create_sample_file("/sd0/hello.txt");
|
||||
print_directory();
|
||||
|
||||
read_sample_file("/sd0/test.txt");
|
||||
read_sample_file("/sd0/hello.txt");
|
||||
}
|
||||
|
||||
void test_kbd_sc() {
|
||||
printf("> ");
|
||||
do {
|
||||
unsigned short scancode = kbd_get_scancode();
|
||||
if (scancode != 0) {
|
||||
printf("%04X ", scancode);
|
||||
}
|
||||
} while (!kbd_break());
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
void test_kbd() {
|
||||
printf("Keyboard test... press RUN/STOP or CTRL-C for boot:\n");
|
||||
printf("> ");
|
||||
do {
|
||||
char c = kbd_getc();
|
||||
if (c != 0) {
|
||||
txt_put(0, c);
|
||||
}
|
||||
} while (!kbd_break());
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
void test_psg() {
|
||||
long target_time = rtc_get_jiffies() + (long)(60 * 2);
|
||||
|
||||
psg_tone(3, 0, 262);
|
||||
psg_tone(3, 1, 262 * 2);
|
||||
psg_tone(3, 2, 262 * 4);
|
||||
|
||||
psg_attenuation(3, 0, 0);
|
||||
psg_attenuation(3, 1, 15);
|
||||
psg_attenuation(3, 2, 15);
|
||||
|
||||
while (target_time > rtc_get_jiffies()) {
|
||||
;
|
||||
}
|
||||
|
||||
psg_attenuation(3, 0, 15);
|
||||
psg_attenuation(3, 1, 15);
|
||||
psg_attenuation(3, 2, 15);
|
||||
}
|
||||
|
||||
void test_sysinfo() {
|
||||
// 8 x 22 region
|
||||
t_rect region;
|
||||
region.size.height = 8;
|
||||
region.size.width = 23;
|
||||
region.origin.x = 80 - region.size.width;
|
||||
region.origin.y = 60 - region.size.height;
|
||||
|
||||
txt_set_region(0, ®ion);
|
||||
|
||||
printf("Foenix Retro Systems\n");
|
||||
printf("Model %s\n", info.model_name);
|
||||
printf("CPU %s\n", info.cpu_name);
|
||||
printf("Clock %lu MHz\n", info.cpu_clock_khz / (long)1000);
|
||||
printf("Memory %d KB\n", (int)(info.system_ram_size / ((long)1024 * (long)1024)));
|
||||
printf("FPGA %04X %04X.%04X\n", info.fpga_model, info.fpga_version, info.fpga_subver);
|
||||
printf("Toolbox v%d.%02d.%04d\n", info.mcp_version, info.sub_model, info.mcp_build);
|
||||
|
||||
region.size.width = 0;
|
||||
region.size.height = 0;
|
||||
region.origin.x = 0;
|
||||
region.origin.y = 0;
|
||||
|
||||
txt_set_region(0, ®ion);
|
||||
txt_set_xy(0, 0, 0);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
short result;
|
||||
short i;
|
||||
|
@ -479,8 +262,6 @@ int main(int argc, char * argv[]) {
|
|||
|
||||
kbd_init();
|
||||
|
||||
test_sysinfo();
|
||||
// test_kbd();
|
||||
boot_screen();
|
||||
|
||||
#ifdef _CALYPSI_MCP_DEBUGGER
|
||||
|
|
|
@ -15,5 +15,4 @@
|
|||
"2E","toolbox-2E.bin"
|
||||
"2F","toolbox-2F.bin"
|
||||
"30","toolbox-30.bin"
|
||||
"31","toolbox-31.bin"
|
||||
"3F","toolbox-3F.bin"
|
||||
|
|
|
|
@ -7,6 +7,6 @@
|
|||
|
||||
#define VER_MAJOR 1
|
||||
#define VER_MINOR 0
|
||||
#define VER_BUILD 37
|
||||
#define VER_BUILD 38
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue