Combined boot and kernel modules into one

This commit is contained in:
Kyle J Cardoza 2024-07-11 01:50:40 -04:00
parent 6d4a8f4e2b
commit 588ad3f1b2
30 changed files with 25 additions and 64 deletions

12
Makefile Normal file → Executable file
View File

@ -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 $<

View File

@ -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 $@

View File

@ -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)
))

0
config/config.mk Normal file → Executable file
View File

0
config/kernel.mk Normal file → Executable file
View File

11
config/kernel.scm Normal file → Executable file
View File

@ -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)
))

4
doc/syscalls.md Normal file → Executable file
View File

@ -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

0
include/.DS_Store vendored Normal file → Executable file
View File

0
include/65c816.h Normal file → Executable file
View File

0
include/config.h Normal file → Executable file
View File

0
include/kernel/device.h Normal file → Executable file
View File

0
include/kernel/device/null.h Normal file → Executable file
View File

4
include/kernel/file.h Normal file → Executable file
View File

@ -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);

0
include/macros.h Normal file → Executable file
View File

0
include/sentinel65x.h Normal file → Executable file
View File

0
include/vera.h Normal file → Executable file
View File

0
include/w65c265s.h Normal file → Executable file
View File

0
license.md Normal file → Executable file
View File

0
readme.md Normal file → Executable file
View File

0
src/.DS_Store vendored Normal file → Executable file
View File

12
src/boot/boot.s → src/kernel/boot.s Normal file → Executable file
View File

@ -3,13 +3,11 @@
//; boot/boot.s
//; Boot code for Sentinel 65X
//;
//; Copyright © 2024 Kyle J Cardoza <Kyle.Cardoza@icloud.com>
//; Copyright <EFBFBD> 2024 Kyle J Cardoza <Kyle.Cardoza@icloud.com>
#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

0
src/kernel/cstartup.s Normal file → Executable file
View File

0
src/kernel/device.c Normal file → Executable file
View File

0
src/kernel/device/null.c Normal file → Executable file
View File

0
src/kernel/file.c Normal file → Executable file
View File

0
src/kernel/irq.c Normal file → Executable file
View File

0
src/kernel/irq_trampoline.s Normal file → Executable file
View File

0
src/kernel/main.c Normal file → Executable file
View File

0
src/kernel/stubs.c Normal file → Executable file
View File

0
src/kernel/vera_font_0.ase Normal file → Executable file
View File