-
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.
Initial support for a PET target (#109)
* Initial support for a PET target * Created user-definable symbol for RAM size to add support for 8k and 16k PETs * Added variables to the commodore linker file to be defined in the concrete targets specifying the start and end of the free zero page * Pushed zero page flag in clang.cfg down from commodore into concrete targets as all targets no longer share the same amount of free zero page * Added mention of PET support to README
- Loading branch information
1 parent
857294f
commit adafbc0
Showing
15 changed files
with
105 additions
and
4 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
-mlto-zp=110 | ||
-D__C64__ |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
-mlto-zp=110 | ||
-D__CBM__ |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
-mlto-zp=110 | ||
-D__CX16__ | ||
-mcpu=mos65c02 |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
-mlto-zp=110 | ||
-D__MEGA65__ | ||
-mcpu=mos65ce02 |
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,12 @@ | ||
platform(pet COMPLETE HOSTED PARENT commodore) | ||
|
||
if(NOT CMAKE_CROSSCOMPILING) | ||
return() | ||
endif() | ||
|
||
install(FILES link.ld TYPE LIB) | ||
|
||
add_platform_object_file(pet-basic-header basic-header.o basic-header.S) | ||
|
||
add_platform_library(pet-c kernal.S) | ||
target_include_directories(pet-c BEFORE PUBLIC .) |
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,13 @@ | ||
; PET BASIC header that jumps to _start | ||
|
||
.section .basic_header,"aR",@progbits | ||
.short next_line ; address of next BASIC line | ||
.short 7773 ; line number: l33t for LLVM, a hint that this program was | ||
; compiled with LLVM | ||
.byte 0x9e ; SYS keyword BASIC token | ||
.mos_addr_asciz _start, 4 ; the location of the _start symbol, in 4 decimal | ||
; ASCII digits | ||
next_line: | ||
.short 0 ; end of basic program | ||
|
||
|
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,2 @@ | ||
-mlto-zp=107 | ||
-D__PET__ |
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,32 @@ | ||
; Copyright 2022 LLVM-MOS Project | ||
; Licensed under the Apache License, Version 2.0 with LLVM Exceptions, | ||
; See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license | ||
; information. | ||
|
||
; Originally from cc65. Modified from original version. | ||
|
||
; | ||
; Ullrich von Bassewitz, 19.11.2002 | ||
; | ||
; PET Kernal functions | ||
; | ||
|
||
#define __PET__ 1 | ||
#include <cbm_kernal.inc> | ||
|
||
.macro weakdef name:req | ||
.weak \name | ||
__\name = \name | ||
.global __\name | ||
.endm | ||
|
||
weakdef CLRCH | ||
weakdef BASIN | ||
weakdef CHRIN | ||
weakdef STOP | ||
weakdef GETIN | ||
weakdef CLALL | ||
weakdef UDTIM | ||
weakdef CHROUT | ||
weakdef BSOUT | ||
weakdef CHRIN |
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,28 @@ | ||
/* Commodore PET PRG file linker script. | ||
* | ||
* Produces a PRG file with a SYS command to start the program. | ||
*/ | ||
|
||
PROVIDE(__ram_size = 32); | ||
ASSERT(__ram_size <= 32, | ||
"RAM size must be <= 32 (8x96 and SuperPETs are not supported by this target)") | ||
ASSERT(__ram_size >= 8, | ||
"RAM size must be at least 8") | ||
|
||
__basic_zp_start = 0x0002; | ||
__basic_zp_end = 0x008D; | ||
|
||
MEMORY { | ||
ram (rw) : ORIGIN = 0x0401, LENGTH = (__ram_size * 1024) - 0x0401 | ||
} | ||
|
||
INCLUDE commodore.ld | ||
|
||
/* Grow stack downwards from end of RAM */ | ||
__stack = (__ram_size * 1024) - 1; | ||
|
||
OUTPUT_FORMAT { | ||
/* Tells the PET LOAD command where to place the file's contents. */ | ||
SHORT(0x0401) | ||
TRIM(ram) | ||
} |