New flashable memory map and layout
This commit is contained in:
parent
5f28453c11
commit
6e76c28d41
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
BIN
roms/f256k/toolbox-20.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-21.bin
Normal file
BIN
roms/f256k/toolbox-21.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-22.bin
Normal file
BIN
roms/f256k/toolbox-22.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-23.bin
Normal file
BIN
roms/f256k/toolbox-23.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-24.bin
Normal file
BIN
roms/f256k/toolbox-24.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-25.bin
Normal file
BIN
roms/f256k/toolbox-25.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-26.bin
Normal file
BIN
roms/f256k/toolbox-26.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-27.bin
Normal file
BIN
roms/f256k/toolbox-27.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-28.bin
Normal file
BIN
roms/f256k/toolbox-28.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-29.bin
Normal file
BIN
roms/f256k/toolbox-29.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-2A.bin
Normal file
BIN
roms/f256k/toolbox-2A.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-2B.bin
Normal file
BIN
roms/f256k/toolbox-2B.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-2C.bin
Normal file
BIN
roms/f256k/toolbox-2C.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-2D.bin
Normal file
BIN
roms/f256k/toolbox-2D.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-2E.bin
Normal file
BIN
roms/f256k/toolbox-2E.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-2F.bin
Normal file
BIN
roms/f256k/toolbox-2F.bin
Normal file
Binary file not shown.
BIN
roms/f256k/toolbox-30.bin
Normal file
BIN
roms/f256k/toolbox-30.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,17 +1,19 @@
|
||||||
"00","toolbox-00.bin"
|
"20","toolbox-20.bin"
|
||||||
"01","toolbox-01.bin"
|
"21","toolbox-21.bin"
|
||||||
"02","toolbox-02.bin"
|
"22","toolbox-22.bin"
|
||||||
"03","toolbox-03.bin"
|
"23","toolbox-23.bin"
|
||||||
"04","toolbox-04.bin"
|
"24","toolbox-24.bin"
|
||||||
"05","toolbox-05.bin"
|
"25","toolbox-25.bin"
|
||||||
"06","toolbox-06.bin"
|
"26","toolbox-26.bin"
|
||||||
"07","toolbox-07.bin"
|
"27","toolbox-27.bin"
|
||||||
"08","toolbox-08.bin"
|
"28","toolbox-28.bin"
|
||||||
"09","toolbox-09.bin"
|
"29","toolbox-29.bin"
|
||||||
"0A","toolbox-0A.bin"
|
"2A","toolbox-2A.bin"
|
||||||
"0B","toolbox-0B.bin"
|
"2B","toolbox-2B.bin"
|
||||||
"0C","toolbox-0C.bin"
|
"2C","toolbox-2C.bin"
|
||||||
"0D","toolbox-0D.bin"
|
"2D","toolbox-2D.bin"
|
||||||
"0E","toolbox-0E.bin"
|
"2E","toolbox-2E.bin"
|
||||||
"0F","toolbox-0F.bin"
|
"2F","toolbox-2F.bin"
|
||||||
|
"30","toolbox-30.bin"
|
||||||
|
"31","toolbox-31.bin"
|
||||||
"3F","toolbox-3F.bin"
|
"3F","toolbox-3F.bin"
|
||||||
|
|
|
|
@ -1,15 +1,20 @@
|
||||||
(define memories
|
(define memories
|
||||||
'(
|
'(
|
||||||
(memory flash
|
(memory flash
|
||||||
(address (#xf80000 . #xfdffff))
|
(address (#xfc0000 . #xffdfff))
|
||||||
(type ROM)
|
(type ROM)
|
||||||
(fill #xff)
|
(fill #xff)
|
||||||
(section
|
(section
|
||||||
(jumptable #xf80000)
|
|
||||||
data_init_table
|
data_init_table
|
||||||
data
|
data
|
||||||
ifar))
|
ifar))
|
||||||
|
|
||||||
|
(memory flash-high
|
||||||
|
(address (#xffe000 . #xfffeff))
|
||||||
|
(type ROM)
|
||||||
|
(fill #xff)
|
||||||
|
(section jumptable))
|
||||||
|
|
||||||
(memory flash-shadow
|
(memory flash-shadow
|
||||||
(address (#xffff00 . #xffffff))
|
(address (#xffff00 . #xffffff))
|
||||||
(type ROM)
|
(type ROM)
|
||||||
|
@ -42,12 +47,12 @@
|
||||||
(placement-group bits (section data near)))
|
(placement-group bits (section data near)))
|
||||||
|
|
||||||
(memory stackram
|
(memory stackram
|
||||||
(address (#x00c000 . #x00cfff))
|
(address (#x00edeb . #xfdeb))
|
||||||
(type RAM)
|
(type RAM)
|
||||||
(section stack))
|
(section stack))
|
||||||
|
|
||||||
(memory DirectPage
|
(memory DirectPage
|
||||||
(address (#x00bf00 . #x00bfff))
|
(address (#x00fe00 . #x00feff))
|
||||||
(section (registers ztiny)))
|
(section (registers ztiny)))
|
||||||
|
|
||||||
(block stack (size #x1000))
|
(block stack (size #x1000))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
DEBUGGER=../module/Calypsi-remote-debug/src
|
DEBUGGER=../module/Calypsi-remote-debug/src
|
||||||
|
|
||||||
UNIT := F256K
|
UNIT := F256K
|
||||||
MEMORY := RAM
|
MEMORY := ROM
|
||||||
|
|
||||||
# Define OS-dependent variables
|
# Define OS-dependent variables
|
||||||
|
|
||||||
|
|
66
src/boot.c
66
src/boot.c
|
@ -20,6 +20,7 @@
|
||||||
#include "dev/txt_screen.h"
|
#include "dev/txt_screen.h"
|
||||||
#include "dev/sprites.h"
|
#include "dev/sprites.h"
|
||||||
#include "dev/tiles.h"
|
#include "dev/tiles.h"
|
||||||
|
#include "gabe_reg.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "vicky_general.h"
|
#include "vicky_general.h"
|
||||||
#include "rsrc/sprites/boot_sprites.h"
|
#include "rsrc/sprites/boot_sprites.h"
|
||||||
|
@ -28,6 +29,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.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_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_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
|
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;
|
} 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[] = {
|
static enum boot_src_e boot_chain[MAX_BOOT_SRC];
|
||||||
BOOT_SRC_RAM,
|
static bool bootable[MAX_BOOT_SRC];
|
||||||
BOOT_SRC_CARTRIDGE,
|
static short boot_src_cnt = 0;
|
||||||
BOOT_SRC_SD0,
|
|
||||||
// BOOT_SRC_SD1,
|
|
||||||
BOOT_SRC_ROM,
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool bootable[10];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A holder for empty arguments list so we have something to point to when starting a binary file
|
* @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);
|
// txt_set_mode(0, TXT_MODE_TEXT | TXT_MODE_SPRITE);
|
||||||
*tvky_mstr_ctrl = (uint16_t)(VKY_MCR_TEXT);
|
*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_set_update(0);
|
||||||
|
|
||||||
tile_map_assign(0, 0, 0, 0, 0);
|
tile_map_assign(0, 0, 0, 0, 0);
|
||||||
|
@ -374,13 +371,28 @@ static short sc_to_function(unsigned short scancode) {
|
||||||
*/
|
*/
|
||||||
void boot_screen() {
|
void boot_screen() {
|
||||||
enum boot_src_e boot_source = BOOT_SRC_NONE;
|
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 boot_position = 0;
|
||||||
short bootable_count = 0;
|
short bootable_count = 0;
|
||||||
short i = 0;
|
short i = 0;
|
||||||
long jiffies_target = 0;
|
long jiffies_target = 0;
|
||||||
char message[80];
|
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
|
// Make sure that ANSI escape codes will be honored
|
||||||
chan_ioctrl(0, CON_IOCTRL_ANSI_ON, 0, 0);
|
chan_ioctrl(0, CON_IOCTRL_ANSI_ON, 0, 0);
|
||||||
|
|
||||||
|
@ -403,7 +415,7 @@ void boot_screen() {
|
||||||
tile_init();
|
tile_init();
|
||||||
sprite_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_set_update(0);
|
||||||
|
|
||||||
tile_map_assign(0, (uint16_t *)boot_tiles_map, 42, 32, 1);
|
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");
|
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;
|
bootable[position] = false;
|
||||||
boot_icon(position, boot_chain[position]);
|
boot_icon(position, boot_chain[position]);
|
||||||
if (is_bootable(boot_chain[position], &boot_record[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 there is a boot icon specified in the boot record, change to that icon
|
||||||
if (boot_record[position] != 0) {
|
if (boot_record[position] != 0) {
|
||||||
if (boot_record[position]->icon_address != 0) {
|
// TODO: fix cartridge icon issue
|
||||||
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]->icon_address != 0) {
|
||||||
if (boot_record[position]->clut_address != 0) {
|
// sprite_assign(position, (uint8_t *)(boot_record[position]->icon_address), 0, 0);
|
||||||
for (i = 0; i < 4 * 256; i++) {
|
|
||||||
uint8_t * source_clut = (uint8_t *)boot_record[position]->clut_address;
|
// // If there is a CLUT defined for the boot record, switch to use that clut
|
||||||
VKY_GR_CLUT_2[i] = source_clut[i];
|
// if (boot_record[position]->clut_address != 0) {
|
||||||
}
|
// for (i = 0; i < 4 * 256; i++) {
|
||||||
sprite_clut(position, 2);
|
// 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) {
|
if (bootable_count > 1) {
|
||||||
printf("\nSelect a boot source:\n\n");
|
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]) {
|
if (bootable[i]) {
|
||||||
sprintf(message, "\e[93mF%d\e[37m-%s\n", i+1, boot_source_name(boot_chain[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));
|
chan_write(0, (uint8_t *)message, strlen(message));
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
static t_sprite sprite_shadow[SPRITE_MAX];
|
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
|
* @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) {
|
void sprite_assign(uint8_t sprite, const uint8_t * address, uint8_t size, uint8_t layer) {
|
||||||
if (sprite < SPRITE_MAX) {
|
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
|
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 |= (size & 0x03) << 5; // Add in the new size
|
||||||
tmp |= (layer & 0x03) << 3; // Add in the new layer
|
tmp |= (layer & 0x03) << 3; // Add in the new layer
|
||||||
|
|
|
@ -7,16 +7,26 @@
|
||||||
static t_tile_set tile_set_shadow[VKY_TILESET_MAX];
|
static t_tile_set tile_set_shadow[VKY_TILESET_MAX];
|
||||||
static t_tile_map tile_map_shadow[VKY_TILEMAP_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
|
* @brief Setup a tile set
|
||||||
*
|
*
|
||||||
* @param set the number of the tile set (0 - 7)
|
* @param set the number of the tile set (0 - 7)
|
||||||
* @param address pointer to the bitmap for the tile set
|
* @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
|
* @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) {
|
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) {
|
if (is_square) {
|
||||||
tile_set_shadow[set].control = VKY_TILESET_SQUARE;
|
tile_set_shadow[set].control = VKY_TILESET_SQUARE;
|
||||||
} else {
|
} 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) {
|
void tile_map_assign(uint8_t map, uint16_t * address, uint8_t width, uint8_t height, uint8_t size) {
|
||||||
if (map <= VKY_TILEMAP_MAX) {
|
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].width = width;
|
||||||
tile_map_shadow[map].height = height;
|
tile_map_shadow[map].height = height;
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
|
|
@ -20,9 +20,10 @@
|
||||||
*
|
*
|
||||||
* @param set the number of the tile set (0 - 7)
|
* @param set the number of the tile set (0 - 7)
|
||||||
* @param address pointer to the bitmap for the tile set
|
* @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
|
* @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
|
* @brief Update the hardware tile set from its shadow
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
#define VER_MAJOR 1
|
#define VER_MAJOR 1
|
||||||
#define VER_MINOR 0
|
#define VER_MINOR 0
|
||||||
#define VER_BUILD 2
|
#define VER_BUILD 4
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue