From 588ad3f1b2660cc81fb3d4f319439b637efd44db Mon Sep 17 00:00:00 2001 From: Kyle J Cardoza Date: Thu, 11 Jul 2024 01:50:40 -0400 Subject: [PATCH] Combined boot and kernel modules into one --- Makefile | 12 ++++-------- config/boot.mk | 10 ---------- config/boot.scm | 36 ----------------------------------- config/config.mk | 0 config/kernel.mk | 0 config/kernel.scm | 11 +++++++++-- doc/syscalls.md | 4 ++-- include/.DS_Store | Bin include/65c816.h | 0 include/config.h | 0 include/kernel/device.h | 0 include/kernel/device/null.h | 0 include/kernel/file.h | 4 ++-- include/macros.h | 0 include/sentinel65x.h | 0 include/vera.h | 0 include/w65c265s.h | 0 license.md | 0 readme.md | 0 src/.DS_Store | Bin src/{boot => kernel}/boot.s | 12 ++++++++---- src/kernel/cstartup.s | 0 src/kernel/device.c | 0 src/kernel/device/null.c | 0 src/kernel/file.c | 0 src/kernel/irq.c | 0 src/kernel/irq_trampoline.s | 0 src/kernel/main.c | 0 src/kernel/stubs.c | 0 src/kernel/vera_font_0.ase | Bin 30 files changed, 25 insertions(+), 64 deletions(-) mode change 100644 => 100755 Makefile delete mode 100644 config/boot.mk delete mode 100644 config/boot.scm mode change 100644 => 100755 config/config.mk mode change 100644 => 100755 config/kernel.mk mode change 100644 => 100755 config/kernel.scm mode change 100644 => 100755 doc/syscalls.md mode change 100644 => 100755 include/.DS_Store mode change 100644 => 100755 include/65c816.h mode change 100644 => 100755 include/config.h mode change 100644 => 100755 include/kernel/device.h mode change 100644 => 100755 include/kernel/device/null.h mode change 100644 => 100755 include/kernel/file.h mode change 100644 => 100755 include/macros.h mode change 100644 => 100755 include/sentinel65x.h mode change 100644 => 100755 include/vera.h mode change 100644 => 100755 include/w65c265s.h mode change 100644 => 100755 license.md mode change 100644 => 100755 readme.md mode change 100644 => 100755 src/.DS_Store rename src/{boot => kernel}/boot.s (79%) mode change 100644 => 100755 mode change 100644 => 100755 src/kernel/cstartup.s mode change 100644 => 100755 src/kernel/device.c mode change 100644 => 100755 src/kernel/device/null.c mode change 100644 => 100755 src/kernel/file.c mode change 100644 => 100755 src/kernel/irq.c mode change 100644 => 100755 src/kernel/irq_trampoline.s mode change 100644 => 100755 src/kernel/main.c mode change 100644 => 100755 src/kernel/stubs.c mode change 100644 => 100755 src/kernel/vera_font_0.ase diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index b0b5d5b..91de722 --- a/Makefile +++ b/Makefile @@ -5,18 +5,14 @@ TARGET := sentinel-65x-512K .PHONY: all all: build/$(TARGET).bin -include config/boot.mk include config/kernel.mk -build/$(TARGET).bin: build/boot.bin build/kernel.bin +build/$(TARGET).bin: build/kernel.bin #Create an empty .bin file. @dd if=/dev/zero of=$@ bs=1024 count=512 -# Add the boot module at offset 0x008000 - @dd if=build/boot.bin of=$@ bs=1024 seek=32 conv=notrunc - -# Add the bios module at offset 0x008300 - @dd if=build/kernel.bin of=$@ bs=1 seek=33536 conv=notrunc +# Add the bios module at offset 0x000000 + @dd if=build/kernel.bin of=$@ conv=notrunc .PHONY: clean clean: @@ -32,5 +28,5 @@ clean: \) -delete .PHONY: flash -flash: $(TARGET).bin +flash: build/$(TARGET).bin $(MP) $(MPFLAGS) -w $< diff --git a/config/boot.mk b/config/boot.mk deleted file mode 100644 index 881cb88..0000000 --- a/config/boot.mk +++ /dev/null @@ -1,10 +0,0 @@ -BOOT_SRC := $(wildcard src/boot/*.s) - -BOOT_OBJ := $(BOOT_SRC:.s=.o) - -BOOT_LDFLAGS := --list-file build/boot.lst - -build/boot.bin: $(BOOT_OBJ) - @echo "Linking $@..." - @$(LD) -o $@ config/boot.scm $(LDFLAGS) $(BOOT_LDFLAGS) $^ - @mv build/boot.raw $@ \ No newline at end of file diff --git a/config/boot.scm b/config/boot.scm deleted file mode 100644 index 0880d47..0000000 --- a/config/boot.scm +++ /dev/null @@ -1,36 +0,0 @@ -(define memories '( - - (memory Code - (address (#x008000 . #x0080FF)) - (section code) - (section cdata) - (section switch) - ) - - (memory Data - (address (#x008100 . #x0081FF)) - (section near) - (section data) - (section znear) - (section zdata) - ) - - (memory Stack - (address (#x000100 . #x0001FF)) - (section (stack #x00100)) - ) - - (memory DirectPage - (address (#x000000 . #x0000FF)) - (section - (registers #x000004) - (ztiny) - ) - ) - - (block stack (size #x100)) ; machine stack size - - (base-address _DirectPageStart DirectPage 0) - - (base-address _NearBaseAddress Data 0) -)) diff --git a/config/config.mk b/config/config.mk old mode 100644 new mode 100755 diff --git a/config/kernel.mk b/config/kernel.mk old mode 100644 new mode 100755 diff --git a/config/kernel.scm b/config/kernel.scm old mode 100644 new mode 100755 index bbc6020..0b39f6c --- a/config/kernel.scm +++ b/config/kernel.scm @@ -9,8 +9,15 @@ (section heap) ) + (memory BOOT + (address (#x008000 . #x0082FF)) + (scatter-to boot_rom) + (section boot) + ) + (memory ROM - (address (#xC08300 . #xC0FFFF)) + (address (#xC00000 . #xC0FFFF)) + (section (boot_rom #xC08000)) (section (code #xC08300)) (section farcode) (section cdata) @@ -41,5 +48,5 @@ (base-address _DirectPageStart DirectPage 0) - (base-address _NearBaseAddress ROM 0) + (base-address _NearBaseAddress RAM #x00) )) diff --git a/doc/syscalls.md b/doc/syscalls.md old mode 100644 new mode 100755 index 54d748b..90d441f --- a/doc/syscalls.md +++ b/doc/syscalls.md @@ -341,8 +341,8 @@ Arguments: Return value: - `C`: Status code - - `X`: New file position (`31:16`) - - `Y`: New file position (`15:0`) + - `X`: New file position (Low word) + - `Y`: New file position (High word) This call moves the internal file pointer, the position in the specified file from which data can be read or to which data can be written. On success, this call returns diff --git a/include/.DS_Store b/include/.DS_Store old mode 100644 new mode 100755 diff --git a/include/65c816.h b/include/65c816.h old mode 100644 new mode 100755 diff --git a/include/config.h b/include/config.h old mode 100644 new mode 100755 diff --git a/include/kernel/device.h b/include/kernel/device.h old mode 100644 new mode 100755 diff --git a/include/kernel/device/null.h b/include/kernel/device/null.h old mode 100644 new mode 100755 diff --git a/include/kernel/file.h b/include/kernel/file.h old mode 100644 new mode 100755 index b6bfbef..bb98f32 --- a/include/kernel/file.h +++ b/include/kernel/file.h @@ -44,8 +44,8 @@ struct file { uint8_t minor_number; }; -// Using the pathname in the provided FCB, identify the device which manages -// the file and have that device populate the FCB. +// Using the pathname in the provided file stucture, identify the device which manages +// the file and have that device populate the file structure. int file_init(char *pathname, struct file *file); int file_open(struct file *file); diff --git a/include/macros.h b/include/macros.h old mode 100644 new mode 100755 diff --git a/include/sentinel65x.h b/include/sentinel65x.h old mode 100644 new mode 100755 diff --git a/include/vera.h b/include/vera.h old mode 100644 new mode 100755 diff --git a/include/w65c265s.h b/include/w65c265s.h old mode 100644 new mode 100755 diff --git a/license.md b/license.md old mode 100644 new mode 100755 diff --git a/readme.md b/readme.md old mode 100644 new mode 100755 diff --git a/src/.DS_Store b/src/.DS_Store old mode 100644 new mode 100755 diff --git a/src/boot/boot.s b/src/kernel/boot.s old mode 100644 new mode 100755 similarity index 79% rename from src/boot/boot.s rename to src/kernel/boot.s index 50dab2f..92d4398 --- a/src/boot/boot.s +++ b/src/kernel/boot.s @@ -3,13 +3,11 @@ //; boot/boot.s //; Boot code for Sentinel 65X //; -//; Copyright © 2024 Kyle J Cardoza +//; Copyright � 2024 Kyle J Cardoza #include "sentinel65x.h" - .section code, noreorder - .pubweak __program_root_section -__program_root_section: + .section boot, noreorder .asciz "WDC" w65c265s_init: // Disable interrupts @@ -49,5 +47,11 @@ delay_y lda #0b11110011 sta PCS7 + // Disable the on-CPU ROM + w65c265s_rom_off + + // Disable the on-CPU RAM + w65c265s_sram_off + // And we are booted enough to jump to high ROM. jmp long:0xC08300 \ No newline at end of file diff --git a/src/kernel/cstartup.s b/src/kernel/cstartup.s old mode 100644 new mode 100755 diff --git a/src/kernel/device.c b/src/kernel/device.c old mode 100644 new mode 100755 diff --git a/src/kernel/device/null.c b/src/kernel/device/null.c old mode 100644 new mode 100755 diff --git a/src/kernel/file.c b/src/kernel/file.c old mode 100644 new mode 100755 diff --git a/src/kernel/irq.c b/src/kernel/irq.c old mode 100644 new mode 100755 diff --git a/src/kernel/irq_trampoline.s b/src/kernel/irq_trampoline.s old mode 100644 new mode 100755 diff --git a/src/kernel/main.c b/src/kernel/main.c old mode 100644 new mode 100755 diff --git a/src/kernel/stubs.c b/src/kernel/stubs.c old mode 100644 new mode 100755 diff --git a/src/kernel/vera_font_0.ase b/src/kernel/vera_font_0.ase old mode 100644 new mode 100755