Compare commits
No commits in common. "gered" and "main" have entirely different histories.
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -52,15 +52,3 @@ Mkfile.old
|
|||
dkms.conf
|
||||
.vscode/settings.json
|
||||
/misc/F256xE_Kernal_Code
|
||||
|
||||
# lsp / clangd
|
||||
/.cache/
|
||||
/.clangd
|
||||
/compile_commands.json
|
||||
|
||||
obj/
|
||||
/foenixmgr.ini
|
||||
/*.s37
|
||||
/*.raw
|
||||
/*.bin
|
||||
/*.lst
|
||||
|
|
135
Makefile
135
Makefile
|
@ -1,135 +0,0 @@
|
|||
TARGET = toolbox
|
||||
TARGET_RAM = $(TARGET)_ram
|
||||
TARGET_ROM = $(TARGET)_rom
|
||||
|
||||
UNIT = F256K
|
||||
|
||||
SRCS_BASE = boot.c \
|
||||
log.c \
|
||||
memory.c \
|
||||
proc.c \
|
||||
ring_buffer.c \
|
||||
simpleio.c \
|
||||
sys_general.c \
|
||||
timers.c \
|
||||
toolbox.c \
|
||||
utilities.c \
|
||||
dev/block.c \
|
||||
dev/channel.c \
|
||||
dev/console.c \
|
||||
dev/fsys.c \
|
||||
dev/sprites.c \
|
||||
dev/tiles.c \
|
||||
dev/txt_screen.c \
|
||||
dev/rtc.c \
|
||||
dev/uart.c \
|
||||
snd/codec_c256.c \
|
||||
snd/psg.c \
|
||||
snd/sid.c \
|
||||
fatfs/ff.c \
|
||||
fatfs/ffsystem.c \
|
||||
fatfs/ffunicode.c
|
||||
|
||||
SRCS_BASE_F256 = cartridge.c \
|
||||
dev/txt_f256.c \
|
||||
dev/kbd_f256.c \
|
||||
dev/indicators_c256.c \
|
||||
dev/interrupts_f256.c \
|
||||
dev/sdc_f256.c \
|
||||
dev/iec.c \
|
||||
fatfs/toolbox_bdev.c \
|
||||
C256/extras.s \
|
||||
C256/f256-cstartup.s \
|
||||
C256/iecll.s \
|
||||
C256/interrupts.s \
|
||||
C256/io_stubs.c \
|
||||
C256/jumptable.s
|
||||
|
||||
ifeq ($(UNIT),F256)
|
||||
TOOLCHAIN = 65816
|
||||
SRCS_FOR_UNIT = $(SRCS_BASE_F256) dev/kbd_f256jr.c
|
||||
CFLAGS_FOR_UNIT = -DMODEL=2 -DCPU=255 --target=f256
|
||||
LDFLAGS_FOR_UNIT_ROM = src/C256/f256-flash.scm --cstartup=f256
|
||||
LDFLAGS_FOR_UNIT_RAM = src/C256/f256-ld_lc.scm --cstartup=f256
|
||||
else ifeq ($(UNIT),F256JR2)
|
||||
TOOLCHAIN = 65816
|
||||
SRCS_FOR_UNIT = $(SRCS_BASE_F256) dev/kbd_f256jr.c
|
||||
CFLAGS_FOR_UNIT = -DMODEL=35 -DCPU=255 --target=f256
|
||||
LDFLAGS_FOR_UNIT_ROM = src/C256/f256k2-flash.scm --cstartup=f256
|
||||
LDFLAGS_FOR_UNIT_RAM = src/C256/f256-ld_lc.scm --cstartup=f256
|
||||
else ifeq ($(UNIT),F256K)
|
||||
TOOLCHAIN = 65816
|
||||
SRCS_FOR_UNIT = $(SRCS_BASE_F256) dev/kbd_f256k.c
|
||||
CFLAGS_FOR_UNIT = -DMODEL=18 -DCPU=255 --target=f256
|
||||
LDFLAGS_FOR_UNIT_ROM = src/C256/f256-flash.scm --cstartup=f256
|
||||
LDFLAGS_FOR_UNIT_RAM = src/C256/f256-ld_lc.scm --cstartup=f256
|
||||
else ifeq ($(UNIT),F256K2)
|
||||
TOOLCHAIN = 65816
|
||||
SRCS_FOR_UNIT = $(SRCS_BASE_F256) dev/kbd_f256k.c
|
||||
CFLAGS_FOR_UNIT = -DMODEL=17 -DCPU=255 --target=f256
|
||||
LDFLAGS_FOR_UNIT_ROM = src/C256/f256k2-flash.scm --cstartup=f256
|
||||
LDFLAGS_FOR_UNIT_RAM = src/C256/f256-ld_lc.scm --cstartup=f256
|
||||
else
|
||||
$(error "Unrecognized UNIT: $(UNIT)")
|
||||
endif
|
||||
|
||||
ifeq ($(TOOLCHAIN),65816)
|
||||
ifeq ($(strip $(CALYPSI_65816_ROOT)),)
|
||||
$(error "Please set CALYPSI_65816_ROOT in your environment!")
|
||||
endif
|
||||
|
||||
CC = cc65816
|
||||
AS = as65816
|
||||
LD = ln65816
|
||||
TOOLCHAIN_ROOT = $(CALYPSI_65816_ROOT)
|
||||
else
|
||||
$(error "Unrecognized TOOLCHAIN: $(TOOLCHAIN)")
|
||||
endif
|
||||
|
||||
SRC_DIR = src
|
||||
SRC_FILES = $(addprefix $(SRC_DIR)/, $(SRCS_BASE) $(SRCS_FOR_UNIT))
|
||||
INCLUDE_DIRS = $(SRC_DIR) $(SRC_DIR)/include $(TOOLCHAIN_ROOT)/include
|
||||
INCLUDES = $(foreach dir,$(INCLUDE_DIRS),-I$(dir))
|
||||
|
||||
OBJ_DIR = obj
|
||||
OBJ_FILES = $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(SRC_FILES)))
|
||||
|
||||
DEPS_DIR = $(OBJ_DIR)
|
||||
DEPENDS = $(OBJ_FILES:.o=.d)
|
||||
|
||||
CFLAGS = --code-model=large --data-model=large --list-file=$@.lst $(INCLUDES) $(CFLAGS_FOR_UNIT)
|
||||
AFLAGS = --code-model=large --data-model=large $(INCLUDES)
|
||||
|
||||
LDFLAGS_FOR_ROM = --rom-code $(LDFLAGS_FOR_UNIT_ROM)
|
||||
LDFLAGS_FOR_RAM = $(LDFLAGS_FOR_UNIT_RAM)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
all: rom ram
|
||||
|
||||
rom: $(TARGET_ROM).s37
|
||||
|
||||
ram: $(TARGET_RAM).s37
|
||||
|
||||
clean:
|
||||
rm -f *.s37
|
||||
rm -f *.lst
|
||||
rm -rf $(OBJ_DIR)
|
||||
|
||||
$(TARGET_ROM).s37: $(OBJ_FILES)
|
||||
$(LD) -o $@ $^ $(LDFLAGS_FOR_ROM) --output-format=s37 --list-file=$@.lst
|
||||
|
||||
$(TARGET_RAM).s37: $(OBJ_FILES)
|
||||
$(LD) -o $@ $^ $(LDFLAGS_FOR_RAM) --output-format=s37 --list-file=$@.lst
|
||||
|
||||
$(OBJ_DIR)/%.c.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -MMD -MP -MF$(DEPS_DIR)/$*.d $(CFLAGS) -o $@ $<
|
||||
|
||||
$(OBJ_DIR)/%.s.o: %.s
|
||||
@mkdir -p $(dir $@)
|
||||
$(AS) $(AFLAGS) -o $@ $<
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
|
41
src/boot.c
41
src/boot.c
|
@ -25,7 +25,6 @@
|
|||
#include "vicky_general.h"
|
||||
#include "rsrc/sprites/boot_sprites.h"
|
||||
#include "rsrc/tiles/boot_tiles.h"
|
||||
#include "syscalls.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -168,7 +167,6 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
|
||||
switch(device) {
|
||||
case BOOT_SRC_RAM:
|
||||
DEBUG("Scanning boot source BOOT_SRC_RAM");
|
||||
top_ram = (uint32_t)mem_get_ramtop();
|
||||
for (uint32_t address = 0; address < top_ram; address += boot_record_alignment) {
|
||||
record = (boot_record_p)address;
|
||||
|
@ -181,7 +179,6 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
break;
|
||||
|
||||
case BOOT_SRC_ROM:
|
||||
DEBUG("Scanning boot source BOOT_SRC_ROM");
|
||||
record = (boot_record_p)boot_rom_location;
|
||||
if (is_valid_boot_record(record)) {
|
||||
*boot_record = record;
|
||||
|
@ -190,7 +187,6 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
break;
|
||||
|
||||
case BOOT_SRC_CARTRIDGE:
|
||||
DEBUG("Scanning boot source BOOT_SRC_CARTRIDGE");
|
||||
record = (boot_record_p)boot_cart_location;
|
||||
if (is_valid_boot_record(record)) {
|
||||
*boot_record = record;
|
||||
|
@ -199,21 +195,18 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
break;
|
||||
|
||||
case BOOT_SRC_SD0:
|
||||
DEBUG("Scanning boot source BOOT_SRC_SD0");
|
||||
if ((fsys_stat("/sd0/fnxboot.pgx", &file_info) >= 0) || (fsys_stat("/sd0/fnxboot.pgz", &file_info) >= 0)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case BOOT_SRC_SD1:
|
||||
DEBUG("Scanning boot source BOOT_SRC_SD1");
|
||||
if ((fsys_stat("/sd1/fnxboot.pgx", &file_info) >= 0) || (fsys_stat("/sd1/fnxboot.pgz", &file_info) >= 0)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG1("Unknown boot source type to scan %d, skipping", device);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -441,8 +434,6 @@ static short sc_to_function(unsigned short scancode) {
|
|||
*
|
||||
*/
|
||||
void boot_screen() {
|
||||
INFO("Starting boot screen");
|
||||
|
||||
enum boot_src_e boot_source = BOOT_SRC_NONE;
|
||||
boot_record_p boot_record[MAX_BOOT_SRC];
|
||||
short boot_position = 0;
|
||||
|
@ -528,7 +519,6 @@ void boot_screen() {
|
|||
bootable[position] = false;
|
||||
boot_icon(position, boot_chain[position]);
|
||||
if (is_bootable(boot_chain[position], &boot_record[position])) {
|
||||
DEBUG1("Determined that boot source %d is bootable", position);
|
||||
boot_icon_highlight(position);
|
||||
bootable[position] = true;
|
||||
bootable_count++;
|
||||
|
@ -559,7 +549,6 @@ void boot_screen() {
|
|||
}
|
||||
}
|
||||
}
|
||||
DEBUG("Finished scanning boot sources");
|
||||
|
||||
// List out all the selectable boot sources
|
||||
if (bootable_count > 1) {
|
||||
|
@ -573,40 +562,34 @@ void boot_screen() {
|
|||
}
|
||||
}
|
||||
|
||||
sprintf(message, "\nPress \e[93mSPACE\e[37m to boot from default source.\n");
|
||||
chan_write(0, (uint8_t *)message, strlen(message));
|
||||
sprintf(message, "Press \e[93m<=\e[37m to rescan for boot sources.\n");
|
||||
sprintf(message, "\nPress \e[93mSPACE\e[37m for default.\n");
|
||||
chan_write(0, (uint8_t *)message, strlen(message));
|
||||
|
||||
// Let the user select a boot source
|
||||
// Give the user time to press a key to select a boot source
|
||||
// If the time expires, boot the default source (earliest in the boot chain)
|
||||
|
||||
while (true) {
|
||||
jiffies_target = timers_jiffies() + 60 * 15;
|
||||
while (jiffies_target > timers_jiffies()) {
|
||||
unsigned short scancode = kbd_get_scancode();
|
||||
if (scancode > 0) {
|
||||
if (scancode == 1) {
|
||||
printf("Rebooting ...\n");
|
||||
sys_reboot();
|
||||
}
|
||||
|
||||
short selected = sc_to_function(scancode);
|
||||
|
||||
if (selected == 0x20) {
|
||||
INFO("Booting from default ...");
|
||||
printf("Booting from default ...\n");
|
||||
// SPACE was pressed... just boot the default
|
||||
boot_from(boot_source, boot_record[0]);
|
||||
break;
|
||||
|
||||
} else if (selected > 0) {
|
||||
INFO1("Booting from device %d", selected);
|
||||
printf("Booting from %d ...\n", selected);
|
||||
if (bootable[selected - 1]) {
|
||||
boot_position = selected - 1;
|
||||
boot_source = boot_chain[boot_position];
|
||||
boot_from(boot_source, boot_record[boot_position]);
|
||||
} else {
|
||||
printf("Nothing bootable at device %d.\n", selected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// And launch the system
|
||||
|
||||
boot_from(boot_source, boot_record[boot_position]);
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
|
|||
uart_setbps(cdev_to_uart(chan->dev), bps_code);
|
||||
|
||||
// Get the next token
|
||||
token = strtok_r(NULL, ",", &saveptr);
|
||||
token = strtok_r(spec_copy, ",", &saveptr);
|
||||
if (token) {
|
||||
// Parse the data bit count
|
||||
i = atoi(token);
|
||||
|
@ -320,7 +320,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
|
|||
}
|
||||
|
||||
// Get the next token
|
||||
token = strtok_r(NULL, ",", &saveptr);
|
||||
token = strtok_r(spec_copy, ",", &saveptr);
|
||||
if (token) {
|
||||
// Parse the stop bit count (1 or 2)
|
||||
i = atoi(token);
|
||||
|
@ -334,7 +334,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
|
|||
}
|
||||
|
||||
// Get the next token
|
||||
token = strtok_r(NULL, ",", &saveptr);
|
||||
token = strtok_r(spec_copy, ",", &saveptr);
|
||||
if (token) {
|
||||
// NONE, ODD, EVEN, MARK, or SPACE
|
||||
if (strcmp(token, "NONE") == 0) {
|
||||
|
|
|
@ -27,7 +27,7 @@ const char * sys_model_name[] = {
|
|||
"F256 K2c",
|
||||
"F256 K2",
|
||||
"F256 Ke",
|
||||
"F256 K2e", // 20
|
||||
"F256 K2e" // 20
|
||||
"Reserved",
|
||||
"Reserved",
|
||||
"Reserved",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "log_level.h"
|
||||
#define DEFAULT_LOG_LEVEL LOG_ERROR
|
||||
#define LOG_CHANNEL LOG_CHANNEL_UART0
|
||||
#define LOG_CHANNEL LOG_CHANNEL_CHANNEL_A
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
@ -246,11 +246,11 @@ void initialize() {
|
|||
}
|
||||
#endif
|
||||
|
||||
if ((res = uart_install())) {
|
||||
log_num(LOG_ERROR, "FAILED: serial port initialization", res);
|
||||
} else {
|
||||
log(LOG_INFO, "Serial ports initialized.");
|
||||
}
|
||||
// if (res = uart_install()) {
|
||||
// log_num(LOG_ERROR, "FAILED: serial port initialization", res);
|
||||
// } else {
|
||||
// log(LOG_INFO, "Serial ports initialized.");
|
||||
// }
|
||||
|
||||
if ((res = fsys_init())) {
|
||||
log_num(LOG_ERROR, "FAILED: file system initialization", res);
|
||||
|
|
Loading…
Reference in a new issue