-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add atari8-stdcart target * cleanup/fix atari8-stdcart target * atari8-stdcart typo * atari8-stdcart fix crt0 and .*data copies * atari8-stdcart avoid duplicate symbols, expose _cart_init tweak to avoid duplicate symbols (tested with --whole-archive) allow override of _cart_init; this won't be used most of the time but is useful in cases where you want to taint memory in order to test that the data copy functions are working * reference copy-data.c from mos-common
- Loading branch information
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# TODO; refactor atari8, remove copy-data.c | ||
platform(atari8-stdcart COMPLETE PARENT atari8) | ||
|
||
if(NOT CMAKE_CROSSCOMPILING) | ||
return() | ||
endif() | ||
|
||
install(FILES | ||
cart-rom-fixed.ld | ||
link.ld | ||
stdcart.ld | ||
TYPE LIB) | ||
|
||
# ../common/crt0/copy-data; see above | ||
add_platform_library(atari8-stdcart-crt0 syms.s ../common/crt0/copy-data.c) | ||
target_compile_options(atari8-stdcart-crt0 PRIVATE -fno-lto) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ASSERT(__cart_rom_size == 8 || __cart_rom_size == 16, | ||
"ATARI 800 STDCART: Only 8 KiB and 16 KiB ROM supported") | ||
|
||
MEMORY { | ||
cart_rom_vma (rx) : ORIGIN = __cart_rom_size == 16 ? 0x8000 : 0xA000, | ||
LENGTH = __cart_rom_size * 1024 | ||
} | ||
|
||
REGION_ALIAS("c_rom_vma", cart_rom_vma) | ||
REGION_ALIAS("c_rom_lma", cart_rom) | ||
|
||
SECTIONS { | ||
.cart_rom_fixed : { *(.cart_rom_fixed .cart_rom_fixed.*) } >cart_rom | ||
.vector 0xbffa - ORIGIN(cart_rom_vma) + ORIGIN(cart_rom) : { | ||
SHORT(_start) /* START entrypoint (after OS setup) */ | ||
BYTE(0x0) /* "Inserted" */ | ||
BYTE(0x04) /* Bits: 7=diag, 2=start, 0=Enable_DOS */ | ||
SHORT(_cart_init) /* INIT entrpoint (before OS setup) */ | ||
} >cart_rom | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* Atari800 cartridge linker scripts. */ | ||
|
||
INCLUDE stdcart.ld | ||
INCLUDE cart-rom-fixed.ld | ||
|
||
OUTPUT_FORMAT { | ||
FULL(cart_rom) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Provide imaginary (zero page) registers. */ | ||
__rc0 = 0x80; | ||
INCLUDE imag-regs.ld | ||
ASSERT(__rc31 == 0x9f, "Inconsistent zero page map.") | ||
|
||
ASSERT(__cart_rom_size == 1 << LOG2CEIL(__cart_rom_size), | ||
"ATARI 800 STDCART: ROM size must be a power of 2.") | ||
|
||
MEMORY { | ||
zp : ORIGIN = __rc31 + 1, LENGTH = 0x100 - (__rc31 + 1) | ||
|
||
/* 0x700 works w/o DOS. */ | ||
ram : ORIGIN = 0x700, LENGTH = 0x2000 - 0x700 | ||
|
||
/* CART-ROM LMA. */ | ||
cart_rom : ORIGIN = 0x01000000, LENGTH = __cart_rom_size * 1024 | ||
} | ||
|
||
SECTIONS { | ||
.text : { | ||
INCLUDE text-sections.ld | ||
} >c_rom_vma AT>c_rom_lma | ||
.rodata : { INCLUDE rodata-sections.ld } >c_rom_vma AT>c_rom_lma | ||
.data : { INCLUDE data-sections.ld } >ram AT>c_rom_lma | ||
__data_load_start = LOADADDR(.data) - LOADADDR(.rodata) + ADDR(.rodata); | ||
__data_size = SIZEOF(.data); | ||
.zp.data : { INCLUDE zp-data-sections.ld } >zp AT>c_rom_lma | ||
__zp_data_load_start = LOADADDR(.zp.data) - LOADADDR(.rodata) + ADDR(.rodata); | ||
__zp_data_size = SIZEOF(.zp.data); | ||
/* The data initializers take up space at the C_ROM_VMA too, not just in RAM. */ | ||
.data_initializers ADDR(.rodata) + SIZEOF(.rodata) + __data_size + | ||
__zp_data_size : {} >c_rom_vma | ||
.zp.bss (NOLOAD) : { | ||
INCLUDE zp-bss-sections.ld | ||
} >zp | ||
INCLUDE zp-bss-symbols.ld | ||
INCLUDE zp-noinit.ld | ||
.bss (NOLOAD) : { INCLUDE bss-sections.ld } >ram AT>ram | ||
INCLUDE bss-symbols.ld | ||
.noinit (NOLOAD) : { INCLUDE noinit-sections.ld } >ram AT>ram | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; defaults | ||
|
||
; ROM size, only 8 and 16 KiB are supported | ||
.weak __cart_rom_size | ||
__cart_rom_size = 8 | ||
|
||
; INIT typically isn't used but allow override | ||
.weak _cart_init | ||
_cart_init: | ||
rts |