Compare commits
5 commits
21fe8ef908
...
e45a899c43
Author | SHA1 | Date | |
---|---|---|---|
|
e45a899c43 | ||
|
337da365c0 | ||
|
a447776078 | ||
|
8e50c61349 | ||
|
7704756b72 |
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -52,3 +52,10 @@ Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
/misc/F256xE_Kernal_Code
|
/misc/F256xE_Kernal_Code
|
||||||
|
|
||||||
|
obj/
|
||||||
|
/foenixmgr.ini
|
||||||
|
/*.s37
|
||||||
|
/*.raw
|
||||||
|
/*.bin
|
||||||
|
/*.lst
|
||||||
|
|
135
Makefile
Normal file
135
Makefile
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
27
src/boot.c
27
src/boot.c
|
@ -25,6 +25,7 @@
|
||||||
#include "vicky_general.h"
|
#include "vicky_general.h"
|
||||||
#include "rsrc/sprites/boot_sprites.h"
|
#include "rsrc/sprites/boot_sprites.h"
|
||||||
#include "rsrc/tiles/boot_tiles.h"
|
#include "rsrc/tiles/boot_tiles.h"
|
||||||
|
#include "syscalls.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -562,34 +563,36 @@ void boot_screen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(message, "\nPress \e[93mSPACE\e[37m for default.\n");
|
sprintf(message, "\nPress \e[93mSPACE\e[37m to boot from default source.\nPress \e[93m<=\e[37m to rescan for boot sources.\n");
|
||||||
chan_write(0, (uint8_t *)message, strlen(message));
|
chan_write(0, (uint8_t *)message, strlen(message));
|
||||||
|
|
||||||
// Give the user time to press a key to select a boot source
|
// Let the user select a boot source
|
||||||
// If the time expires, boot the default source (earliest in the boot chain)
|
|
||||||
|
|
||||||
jiffies_target = timers_jiffies() + 60 * 15;
|
while (true) {
|
||||||
while (jiffies_target > timers_jiffies()) {
|
|
||||||
unsigned short scancode = kbd_get_scancode();
|
unsigned short scancode = kbd_get_scancode();
|
||||||
if (scancode > 0) {
|
if (scancode > 0) {
|
||||||
|
if (scancode == 1) {
|
||||||
|
printf("Rebooting ...\n");
|
||||||
|
sys_reboot();
|
||||||
|
}
|
||||||
|
|
||||||
short selected = sc_to_function(scancode);
|
short selected = sc_to_function(scancode);
|
||||||
|
|
||||||
if (selected == 0x20) {
|
if (selected == 0x20) {
|
||||||
|
printf("Booting from default ...\n");
|
||||||
// SPACE was pressed... just boot the default
|
// SPACE was pressed... just boot the default
|
||||||
break;
|
boot_from(boot_source, boot_record[0]);
|
||||||
|
|
||||||
} else if (selected > 0) {
|
} else if (selected > 0) {
|
||||||
|
printf("Booting from %d ...\n", selected);
|
||||||
if (bootable[selected - 1]) {
|
if (bootable[selected - 1]) {
|
||||||
boot_position = selected - 1;
|
boot_position = selected - 1;
|
||||||
boot_source = boot_chain[boot_position];
|
boot_source = boot_chain[boot_position];
|
||||||
break;
|
boot_from(boot_source, boot_record[boot_position]);
|
||||||
|
} else {
|
||||||
|
printf("Nothing bootable at device %d.\n", selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// And launch the system
|
|
||||||
|
|
||||||
boot_from(boot_source, boot_record[boot_position]);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
* @return the smallest short c such that c >= a / b
|
* @return the smallest short c such that c >= a / b
|
||||||
*/
|
*/
|
||||||
short ceil_div_short(short a, short b) {
|
short ceil_div_short(short a, short b) {
|
||||||
return (a + (b - 1)) / b;
|
if (a % b) {
|
||||||
|
return (a / b) + 1;
|
||||||
|
} else {
|
||||||
|
return a / b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue