f256/f256k.patch
2023-12-30 17:05:38 -06:00

82 lines
2 KiB
Diff

diff --git a/mos-platform/CMakeLists.txt b/mos-platform/CMakeLists.txt
index d5558c97..38de869c 100644
--- a/mos-platform/CMakeLists.txt
+++ b/mos-platform/CMakeLists.txt
@@ -59,6 +59,7 @@ add_subdirectory(c128)
add_subdirectory(cpm65)
add_subdirectory(cx16)
add_subdirectory(eater)
+add_subdirectory(f256k)
add_subdirectory(mega65)
add_subdirectory(sim)
add_subdirectory(nes)
diff --git a/mos-platform/f256k/CMakeLists.txt b/mos-platform/f256k/CMakeLists.txt
new file mode 100644
index 00000000..d6c8af82
--- /dev/null
+++ b/mos-platform/f256k/CMakeLists.txt
@@ -0,0 +1,18 @@
+platform(f256k COMPLETE PARENT common)
+
+if(NOT CMAKE_CROSSCOMPILING)
+ return()
+endif()
+
+add_platform_library(f256k-crt0)
+merge_libraries(f256k-crt0
+ common-crt0
+ common-init-stack
+ common-copy-zp-data
+ common-zero-bss
+ common-exit-return
+)
+
+target_compile_options(f256k-crt0 PUBLIC -mcpu=mosw65c02)
+#target_include_directories(dodo-c SYSTEM BEFORE PUBLIC .)
+#target_compile_options(f256k-c PUBLIC -mcpu=mos65c02)
diff --git a/mos-platform/f256k/link.ld b/mos-platform/f256k/link.ld
new file mode 100644
index 00000000..5f357eeb
--- /dev/null
+++ b/mos-platform/f256k/link.ld
@@ -0,0 +1,40 @@
+/* f256k uses first 16 bytes of ZP for mmu control? */
+__rc0 = 0x10;
+INCLUDE imag-regs.ld
+ASSERT(__rc0 == 0x10, "Inconsistent zero page map.")
+ASSERT(__rc31 == 0x2f, "Inconsistent zero page map.")
+
+
+MEMORY {
+ /* kernel uses 0xf0-0xff for parameter passing */
+ zp : ORIGIN = __rc31 + 1, LENGTH = 0xF0 - (__rc31 + 1)
+ ram (rw) : ORIGIN = 0x200, LENGTH = 0x800-0x200
+ rom (rw) : ORIGIN = 0x800, LENGTH = 0xC000-0x800
+}
+
+
+REGION_ALIAS("c_readonly", rom)
+REGION_ALIAS("c_writeable", ram)
+
+SECTIONS { INCLUDE c.ld }
+
+/* Set initial soft stack address to just above last ram address. (It grows down.) */
+__stack = ORIGIN(ram) + LENGTH(ram);
+
+
+/* bare binary, _start at 0x2000 */
+OUTPUT_FORMAT {
+ TRIM(rom)
+}
+
+/* PGX */
+/*
+OUTPUT_FORMAT {
+ BYTE(0x50)
+ BYTE(0x47)
+ BYTE(0x58)
+ BYTE(0x03)
+ LONG(_start)
+ TRIM(rom)
+}
+*/