Skip to content

Commit

Permalink
Add missing commodore devnum/filevars
Browse files Browse the repository at this point in the history
This allows e.g. commodore fopen to link on non-c64 targets.
  • Loading branch information
mysterymath committed May 31, 2024
1 parent 5fcba40 commit a83c611
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 4 deletions.
6 changes: 5 additions & 1 deletion mos-platform/c128/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ add_platform_object_file(c128-basic-header basic-header.o basic-header.S)
add_platform_object_file(c128-init-mmu init-mmu.o init-mmu.S)
target_include_directories(c128-init-mmu PRIVATE .)

add_platform_library(c128-c c128.c kernal.S)
add_platform_library(c128-c
c128.c
devnum.s
kernal.S
)
target_include_directories(c128-c BEFORE PUBLIC .)
target_include_directories(c128-c BEFORE PUBLIC ../c64)

17 changes: 17 additions & 0 deletions mos-platform/c128/devnum.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; Copyright 2023 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.

;
; Oliver Schmidt, 2010-02-14
;

.include "c128.inc"

.globl devnum
.zeropage devnum

devnum = DEVNUM
1 change: 1 addition & 0 deletions mos-platform/cx16/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ add_platform_library(cx16-c
cx16_k_screen_set_charset.s
cx16_k_sprite_set_image.s
cx16_k_sprite_set_position.s
filevars.s
get_numbanks.s
get_ostype.s
get_tv.s
Expand Down
38 changes: 38 additions & 0 deletions mos-platform/cx16/filevars.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
; Copyright 2024 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.

; 2002-11-15, Ullrich von Bassewitz
; 2019-11-08, Greg King
;
; Variables used for CBM file I/O
;

.globl curunit

.include "cx16.inc"


.bss
curunit:
.fill 1


.section .init,"axR",@progbits
initcurunit:
lda DEVNUM
bne L0
lda #8 ; Default is SD card
sta DEVNUM
L0: sta curunit
rts


.section .fini,"axR",@progbits
updatedevnum:
lda curunit
sta DEVNUM
rts
5 changes: 4 additions & 1 deletion mos-platform/mega65/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ merge_libraries(mega65-crt0
add_platform_object_file(mega65-basic-header basic-header.o basic-header.S)
add_platform_object_file(mega65-unmap-basic unmap-basic.o unmap-basic.S)

add_platform_library(mega65-c kernal.S)
add_platform_library(mega65-c
filevars.s
kernal.S
)
target_include_directories(mega65-c BEFORE PUBLIC .)
25 changes: 25 additions & 0 deletions mos-platform/mega65/filevars.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
; Copyright 2024 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, 15.11.2002
;
; Variables used for Mega65 file I/O
;

.globl curunit


.bss
curunit:
.fill 1


.section .init,"axR",@progbits
initcurunit:
lda #8 ; Default is disk
sta curunit
5 changes: 4 additions & 1 deletion mos-platform/pet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ install(FILES pet.inc DESTINATION ${ASMINCDIR})

add_platform_object_file(pet-basic-header basic-header.o basic-header.S)

add_platform_library(pet-c kernal.S)
add_platform_library(pet-c
devnum.s
kernal.S
)
target_include_directories(pet-c BEFORE PUBLIC .)
17 changes: 17 additions & 0 deletions mos-platform/pet/devnum.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; Copyright 2024 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.

;
; Oliver Schmidt, 2010-02-14
;

.include "pet.inc"

.globl devnum
.zeropage devnum

devnum = DEVNUM
5 changes: 4 additions & 1 deletion mos-platform/vic20/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ install(FILES vic20.inc DESTINATION ${ASMINCDIR})

add_platform_object_file(vic20-basic-header basic-header.o basic-header.S)

add_platform_library(vic20-c kernal.S)
add_platform_library(vic20-c
devnum.s
kernal.S
)
target_include_directories(vic20-c BEFORE PUBLIC .)

17 changes: 17 additions & 0 deletions mos-platform/vic20/devnum.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; Copyright 2024 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.

;
; Oliver Schmidt, 2010-02-14
;

.include "vic20.inc"

.globl devnum
.zeropage devnum

devnum = DEVNUM

0 comments on commit a83c611

Please sign in to comment.