New flashable memory map and layout

This commit is contained in:
Peter Weingartner 2024-08-27 18:34:08 -04:00
parent 5f28453c11
commit 6e76c28d41
44 changed files with 99 additions and 53 deletions

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.

BIN
roms/f256k/toolbox-20.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-21.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-22.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-23.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-24.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-25.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-26.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-27.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-28.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-29.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-2A.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-2B.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-2C.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-2D.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-2E.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-2F.bin Normal file

Binary file not shown.

BIN
roms/f256k/toolbox-30.bin Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,17 +1,19 @@
"00","toolbox-00.bin"
"01","toolbox-01.bin"
"02","toolbox-02.bin"
"03","toolbox-03.bin"
"04","toolbox-04.bin"
"05","toolbox-05.bin"
"06","toolbox-06.bin"
"07","toolbox-07.bin"
"08","toolbox-08.bin"
"09","toolbox-09.bin"
"0A","toolbox-0A.bin"
"0B","toolbox-0B.bin"
"0C","toolbox-0C.bin"
"0D","toolbox-0D.bin"
"0E","toolbox-0E.bin"
"0F","toolbox-0F.bin"
"20","toolbox-20.bin"
"21","toolbox-21.bin"
"22","toolbox-22.bin"
"23","toolbox-23.bin"
"24","toolbox-24.bin"
"25","toolbox-25.bin"
"26","toolbox-26.bin"
"27","toolbox-27.bin"
"28","toolbox-28.bin"
"29","toolbox-29.bin"
"2A","toolbox-2A.bin"
"2B","toolbox-2B.bin"
"2C","toolbox-2C.bin"
"2D","toolbox-2D.bin"
"2E","toolbox-2E.bin"
"2F","toolbox-2F.bin"
"30","toolbox-30.bin"
"31","toolbox-31.bin"
"3F","toolbox-3F.bin"

1 00 20 toolbox-00.bin toolbox-20.bin
2 01 21 toolbox-01.bin toolbox-21.bin
3 02 22 toolbox-02.bin toolbox-22.bin
4 03 23 toolbox-03.bin toolbox-23.bin
5 04 24 toolbox-04.bin toolbox-24.bin
6 05 25 toolbox-05.bin toolbox-25.bin
7 06 26 toolbox-06.bin toolbox-26.bin
8 07 27 toolbox-07.bin toolbox-27.bin
9 08 28 toolbox-08.bin toolbox-28.bin
10 09 29 toolbox-09.bin toolbox-29.bin
11 0A 2A toolbox-0A.bin toolbox-2A.bin
12 0B 2B toolbox-0B.bin toolbox-2B.bin
13 0C 2C toolbox-0C.bin toolbox-2C.bin
14 0D 2D toolbox-0D.bin toolbox-2D.bin
15 0E 2E toolbox-0E.bin toolbox-2E.bin
16 0F 2F toolbox-0F.bin toolbox-2F.bin
17 30 toolbox-30.bin
18 31 toolbox-31.bin
19 3F 3F toolbox-3F.bin toolbox-3F.bin

View file

@ -1,15 +1,20 @@
(define memories
'(
(memory flash
(address (#xf80000 . #xfdffff))
(address (#xfc0000 . #xffdfff))
(type ROM)
(fill #xff)
(section
(jumptable #xf80000)
data_init_table
data
ifar))
(memory flash-high
(address (#xffe000 . #xfffeff))
(type ROM)
(fill #xff)
(section jumptable))
(memory flash-shadow
(address (#xffff00 . #xffffff))
(type ROM)
@ -42,12 +47,12 @@
(placement-group bits (section data near)))
(memory stackram
(address (#x00c000 . #x00cfff))
(address (#x00edeb . #xfdeb))
(type RAM)
(section stack))
(memory DirectPage
(address (#x00bf00 . #x00bfff))
(address (#x00fe00 . #x00feff))
(section (registers ztiny)))
(block stack (size #x1000))

View file

@ -2,7 +2,7 @@
DEBUGGER=../module/Calypsi-remote-debug/src
UNIT := F256K
MEMORY := RAM
MEMORY := ROM
# Define OS-dependent variables

View file

@ -20,6 +20,7 @@
#include "dev/txt_screen.h"
#include "dev/sprites.h"
#include "dev/tiles.h"
#include "gabe_reg.h"
#include "timers.h"
#include "vicky_general.h"
#include "rsrc/sprites/boot_sprites.h"
@ -28,6 +29,8 @@
#include <stdio.h>
#include <string.h>
#define MAX_BOOT_SRC 5
const uint32_t boot_record_alignment = 8192; // Number of bytes for boot record alignement
const uint32_t boot_rom_location = 0xf80000; // Location to check for a boot record in ROM
const uint32_t boot_cart_location = 0xf40000; // Location to check for a boot record in ROM
@ -67,18 +70,12 @@ typedef struct boot_record_s {
} boot_record_t, *boot_record_p;
/**
* @brief List bootable areas to check, in priority order
* @brief List bootable areas to check, in priority order (without RAM booting)
*
*/
static enum boot_src_e boot_chain[] = {
BOOT_SRC_RAM,
BOOT_SRC_CARTRIDGE,
BOOT_SRC_SD0,
// BOOT_SRC_SD1,
BOOT_SRC_ROM,
};
static bool bootable[10];
static enum boot_src_e boot_chain[MAX_BOOT_SRC];
static bool bootable[MAX_BOOT_SRC];
static short boot_src_cnt = 0;
/**
* @brief A holder for empty arguments list so we have something to point to when starting a binary file
@ -265,7 +262,7 @@ static void boot_reset_screen() {
// txt_set_mode(0, TXT_MODE_TEXT | TXT_MODE_SPRITE);
*tvky_mstr_ctrl = (uint16_t)(VKY_MCR_TEXT);
tile_set_assign(0, 0, false);
tile_set_assign(0, 0, 0, false);
tile_set_update(0);
tile_map_assign(0, 0, 0, 0, 0);
@ -374,13 +371,28 @@ static short sc_to_function(unsigned short scancode) {
*/
void boot_screen() {
enum boot_src_e boot_source = BOOT_SRC_NONE;
boot_record_p boot_record[10];
boot_record_p boot_record[MAX_BOOT_SRC];
short boot_position = 0;
short bootable_count = 0;
short i = 0;
long jiffies_target = 0;
char message[80];
// Check the DIP switches to see if we should include RAM booting
// Choose the correct boot chain accordingly
i = 0;
boot_src_cnt = 0;
if ((*GABE_DIP_REG & DIP_BOOT_RAM) == 0) {
boot_chain[0] = BOOT_SRC_RAM;
i = 1;
boot_src_cnt++;
}
boot_chain[i++] = BOOT_SRC_CARTRIDGE;
boot_chain[i++] = BOOT_SRC_SD0;
boot_chain[i++] = BOOT_SRC_ROM;
boot_src_cnt += 3;
// Make sure that ANSI escape codes will be honored
chan_ioctrl(0, CON_IOCTRL_ANSI_ON, 0, 0);
@ -403,7 +415,7 @@ void boot_screen() {
tile_init();
sprite_init();
tile_set_assign(0, (uint8_t *)boot_tiles_pixels, false);
tile_set_assign(0, (uint8_t *)boot_tiles_pixels, 8 * (256 + 8), false);
tile_set_update(0);
tile_map_assign(0, (uint16_t *)boot_tiles_map, 42, 32, 1);
@ -425,7 +437,7 @@ void boot_screen() {
printf("Scanning for bootable devices...\n");
for (short position = 0; position < sizeof(boot_chain) / sizeof(enum boot_src_e); position++) {
for (short position = 0; position < boot_src_cnt; position++) {
bootable[position] = false;
boot_icon(position, boot_chain[position]);
if (is_bootable(boot_chain[position], &boot_record[position])) {
@ -442,18 +454,20 @@ void boot_screen() {
// If there is a boot icon specified in the boot record, change to that icon
if (boot_record[position] != 0) {
if (boot_record[position]->icon_address != 0) {
sprite_assign(position, (uint8_t *)(boot_record[position]->icon_address), 0, 0);
// TODO: fix cartridge icon issue
// If there is a CLUT defined for the boot record, switch to use that clut
if (boot_record[position]->clut_address != 0) {
for (i = 0; i < 4 * 256; i++) {
uint8_t * source_clut = (uint8_t *)boot_record[position]->clut_address;
VKY_GR_CLUT_2[i] = source_clut[i];
}
sprite_clut(position, 2);
}
}
// if (boot_record[position]->icon_address != 0) {
// sprite_assign(position, (uint8_t *)(boot_record[position]->icon_address), 0, 0);
// // If there is a CLUT defined for the boot record, switch to use that clut
// if (boot_record[position]->clut_address != 0) {
// for (i = 0; i < 4 * 256; i++) {
// uint8_t * source_clut = (uint8_t *)boot_record[position]->clut_address;
// VKY_GR_CLUT_2[i] = source_clut[i];
// }
// sprite_clut(position, 2);
// }
// }
}
}
}
@ -462,7 +476,7 @@ void boot_screen() {
if (bootable_count > 1) {
printf("\nSelect a boot source:\n\n");
for (i = 0; i < sizeof(boot_chain) / sizeof(enum boot_src_e); i++) {
for (i = 0; i < boot_src_cnt; i++) {
if (bootable[i]) {
sprintf(message, "\e[93mF%d\e[37m-%s\n", i+1, boot_source_name(boot_chain[i]));
chan_write(0, (uint8_t *)message, strlen(message));

View file

@ -19,6 +19,8 @@
static t_sprite sprite_shadow[SPRITE_MAX];
const uint32_t sprite_ram_base = 0x000000;
/**
* @brief Update a sprite's hardware registers from the shadow registers
*
@ -38,7 +40,13 @@ static void sprite_update(uint8_t sprite) {
*/
void sprite_assign(uint8_t sprite, const uint8_t * address, uint8_t size, uint8_t layer) {
if (sprite < SPRITE_MAX) {
sprite_shadow[sprite].address = (p_far24)address;
uint8_t * sprite_mem = (uint8_t *)(sprite_ram_base + 32 * 32 * sprite);
for (int i = 0; i < 32 * 32; i++) {
sprite_mem[i] = address[i];
}
sprite_shadow[sprite].address = (p_far24)sprite_mem;
uint8_t tmp = sprite_shadow[sprite].control & 0x87; // Mask off the size and layer bits
tmp |= (size & 0x03) << 5; // Add in the new size
tmp |= (layer & 0x03) << 3; // Add in the new layer

View file

@ -7,16 +7,26 @@
static t_tile_set tile_set_shadow[VKY_TILESET_MAX];
static t_tile_map tile_map_shadow[VKY_TILEMAP_MAX];
const uint32_t tile_set_memory_base = 0x002000;
const uint32_t tile_map_memory_base = 0x003000;
/**
* @brief Setup a tile set
*
* @param set the number of the tile set (0 - 7)
* @param address pointer to the bitmap for the tile set
* @param size the number of bytes in the tile set
* @param is_square if true, layout of image is square, if false it is 8 or 16 pixels wide
*/
void tile_set_assign(uint8_t set, uint8_t * address, bool is_square) {
void tile_set_assign(uint8_t set, uint8_t * address, int size, bool is_square) {
if (set <= VKY_TILESET_MAX) {
tile_set_shadow[set].address = (p_far24)address;
uint8_t * tile_set_ram = (uint8_t *)tile_set_memory_base;
for (int i = 0; i < size; i++) {
tile_set_ram[i] = address[i];
}
tile_set_shadow[set].address = (p_far24)tile_set_ram;
if (is_square) {
tile_set_shadow[set].control = VKY_TILESET_SQUARE;
} else {
@ -55,7 +65,13 @@ void tile_init() {
*/
void tile_map_assign(uint8_t map, uint16_t * address, uint8_t width, uint8_t height, uint8_t size) {
if (map <= VKY_TILEMAP_MAX) {
tile_map_shadow[map].address = (p_far24)address;
uint16_t * tile_map_ram = (uint8_t *)tile_map_memory_base;
for (int i = 0; i < width*height; i++) {
tile_map_ram[i] = address[i];
}
tile_map_shadow[map].address = (p_far24)tile_map_ram;
tile_map_shadow[map].width = width;
tile_map_shadow[map].height = height;
if (size == 0) {

View file

@ -20,9 +20,10 @@
*
* @param set the number of the tile set (0 - 7)
* @param address pointer to the bitmap for the tile set
* @param size the number of bytes in the tile set
* @param is_square if true, layout of image is square, if false it is 8 or 16 pixels wide
*/
extern void tile_set_assign(uint8_t set, uint8_t * address, bool is_square);
extern void tile_set_assign(uint8_t set, uint8_t * address, int size, bool is_square);
/**
* @brief Update the hardware tile set from its shadow

View file

@ -7,6 +7,6 @@
#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_BUILD 2
#define VER_BUILD 4
#endif