diff --git a/mos-platform/c128/CMakeLists.txt b/mos-platform/c128/CMakeLists.txt index eae189ecf..b0a3d350a 100644 --- a/mos-platform/c128/CMakeLists.txt +++ b/mos-platform/c128/CMakeLists.txt @@ -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) diff --git a/mos-platform/c128/devnum.s b/mos-platform/c128/devnum.s new file mode 100644 index 000000000..a14a8f98f --- /dev/null +++ b/mos-platform/c128/devnum.s @@ -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 diff --git a/mos-platform/cx16/CMakeLists.txt b/mos-platform/cx16/CMakeLists.txt index 85284a727..da9442147 100644 --- a/mos-platform/cx16/CMakeLists.txt +++ b/mos-platform/cx16/CMakeLists.txt @@ -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 diff --git a/mos-platform/cx16/filevars.s b/mos-platform/cx16/filevars.s new file mode 100644 index 000000000..ab720b25e --- /dev/null +++ b/mos-platform/cx16/filevars.s @@ -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 diff --git a/mos-platform/mega65/CMakeLists.txt b/mos-platform/mega65/CMakeLists.txt index d11ecb0d0..e5c57a0aa 100644 --- a/mos-platform/mega65/CMakeLists.txt +++ b/mos-platform/mega65/CMakeLists.txt @@ -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 .) diff --git a/mos-platform/mega65/filevars.s b/mos-platform/mega65/filevars.s new file mode 100644 index 000000000..80b17c919 --- /dev/null +++ b/mos-platform/mega65/filevars.s @@ -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 diff --git a/mos-platform/pet/CMakeLists.txt b/mos-platform/pet/CMakeLists.txt index 55c4057c7..d33a52fab 100644 --- a/mos-platform/pet/CMakeLists.txt +++ b/mos-platform/pet/CMakeLists.txt @@ -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 .) diff --git a/mos-platform/pet/devnum.s b/mos-platform/pet/devnum.s new file mode 100644 index 000000000..3839fe5a8 --- /dev/null +++ b/mos-platform/pet/devnum.s @@ -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 diff --git a/mos-platform/vic20/CMakeLists.txt b/mos-platform/vic20/CMakeLists.txt index 5dd90aeab..e601ef6dd 100644 --- a/mos-platform/vic20/CMakeLists.txt +++ b/mos-platform/vic20/CMakeLists.txt @@ -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 .) diff --git a/mos-platform/vic20/devnum.s b/mos-platform/vic20/devnum.s new file mode 100644 index 000000000..fd174baaa --- /dev/null +++ b/mos-platform/vic20/devnum.s @@ -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