Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate mega65/ header-directory #36

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ work
build

# Visual studio code
.vscode
.vscode/*

# CMake
CMakeCache.txt
Expand Down
28 changes: 14 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ set(objects
src/time.c)

set(headers
include/conio.h
include/debug.h
include/dirent.h
include/fileio.h
include/hal.h
include/memory.h
include/mouse.h
include/random.h
include/sdcard.h
include/targets.h
include/tests.h
include/time.h)
include/mega65/conio.h
include/mega65/debug.h
include/mega65/dirent.h
include/mega65/fileio.h
include/mega65/hal.h
include/mega65/memory.h
include/mega65/mouse.h
include/mega65/random.h
include/mega65/sdcard.h
include/mega65/targets.h
include/mega65/tests.h
include/mega65/time.h)

set_source_files_properties(${objects} PROPERTIES LANGUAGE C)
set_source_files_properties(${assembler} PROPERTIES LANGUAGE ASM)
Expand Down Expand Up @@ -68,15 +68,15 @@ set(CLANG_WARNINGS
-Wpedantic # warn if non-standard C/C++ is used
-Wlanguage-extension-token
)
target_compile_options(mega65libc PRIVATE -mcpu=mos65ce02 -Os ${CLANG_WARNINGS})
target_compile_options(mega65libc PRIVATE -Os ${CLANG_WARNINGS})

# install target
include(GNUInstallDirs)
install(TARGETS mega65libc
EXPORT mega65libc-export
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include
PUBLIC_HEADER DESTINATION include/mega65
)
install(FILES cmake/mega65libcConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mega65libc)

Expand Down
1 change: 0 additions & 1 deletion Makefile_cc65
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ all: libmega65.a
clean:
rm -f src/*.o
rm -f src/cc65/*.o
rm -f libmega65.a
rm -rf work

cleanall: clean
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion include/debug.h → include/mega65/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

void debug_msg(char* m);

#endif // __MEGA65_DEBUG_H
#endif // __MEGA65_DEBUG_H
2 changes: 1 addition & 1 deletion include/dirent.h → include/mega65/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ struct m65_dirent {
char d_name[256];
};

#endif // __MEGA65_DIRENT_H
#endif // __MEGA65_DIRENT_H
4 changes: 2 additions & 2 deletions include/fcio.h → include/mega65/fcio.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef __MEGA65_FCIO_H
#define __MEGA65_FCIO_H

#include <memory.h>
#include <mega65/memory.h>
#include <stdbool.h>

#define FCBUFSIZE 0xff
Expand Down Expand Up @@ -521,4 +521,4 @@ void fc_plotExtChar(byte x, byte y, byte c);
*/
void fc_plotPetsciiChar(byte x, byte y, byte c, byte color, byte exAttr);

#endif // __MEGA65_FCIO_H
#endif // __MEGA65_FCIO_H
2 changes: 1 addition & 1 deletion include/fileio.h → include/mega65/fileio.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ unsigned char chdir(char* filename);
// Change working directory to the root directory
unsigned char chdirroot(void);

#endif // __MEGA65_FILEIO_H
#endif // __MEGA65_FILEIO_H
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion include/mouse.h → include/mega65/mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ void mouse_bind_to_sprite(unsigned char sprite_num);
void mouse_set_bounding_box(
unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2);

#endif // __MEGA65_MOUSE_H
#endif // __MEGA65_MOUSE_H
6 changes: 3 additions & 3 deletions include/random.h → include/mega65/random.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <stdint.h>

#ifndef __MEGA65_RANDOM_H
#define __MEGA65_RANDOM_H

#include <stdint.h>

uint32_t random32(uint32_t range);
uint16_t random16(uint16_t range);
uint8_t random8(uint8_t range);
Expand All @@ -11,4 +11,4 @@ uint8_t rand8(uint8_t range);
uint16_t rand16(uint16_t range);
uint32_t rand32(uint32_t range);

#endif // __MEGA65_RANDOM_H
#endif // __MEGA65_RANDOM_H
2 changes: 1 addition & 1 deletion include/sdcard.h → include/mega65/sdcard.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <hal.h>
#include <mega65/hal.h>

#ifndef __MEGA65_SDCARD_H
#define __MEGA65_SDCARD_H
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/conio.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <conio.h>
#include <memory.h>
#include <mega65/conio.h>
#include <mega65/memory.h>
#include <string.h>

#define VIC_BASE 0xD000UL
Expand Down
2 changes: 1 addition & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <memory.h>
#include <mega65/memory.h>

unsigned char the_char;
void debug_msg(char* m)
Expand Down
7 changes: 3 additions & 4 deletions src/fat32.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include <mega65/sdcard.h>
#include <mega65/hal.h>
#include <mega65/memory.h>
#include <stdio.h>
#include <string.h>

#include <sdcard.h>
#include <hal.h>
#include <memory.h>

/*
Create a file in the root directory of the new FAT32 filesystem
with the indicated name and size.
Expand Down
4 changes: 2 additions & 2 deletions src/fcio.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#define __C64__ 1
#endif

#include <fcio.h>
#include <memory.h>
#include <mega65/fcio.h>
#include <mega65/memory.h>
#include <c64.h>
#include <cbm.h>
#include <stdarg.h>
Expand Down
4 changes: 2 additions & 2 deletions src/hal.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <hal.h>
#include <memory.h>
#include <mega65/hal.h>
#include <mega65/memory.h>

void usleep(uint32_t micros)
{
Expand Down
2 changes: 1 addition & 1 deletion src/memory.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <mega65/memory.h>
#include <stdio.h>
#include <memory.h>

#ifdef __clang__
volatile struct dmagic_dmalist dmalist;
Expand Down
3 changes: 2 additions & 1 deletion src/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
Date 2020-07-01
*/

#include <memory.h>
#include <mega65/memory.h>
#include <mega65/mouse.h>

unsigned short mouse_min_x = 0;
unsigned short mouse_min_y = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

*/

#include <mega65/memory.h>
#include <mega65/random.h>
#include <stdint.h>
#include <memory.h>

uint32_t random_temp;
uint8_t random_step;
Expand Down
7 changes: 3 additions & 4 deletions src/sdcard.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include <mega65/sdcard.h>
#include <mega65/hal.h>
#include <mega65/memory.h>
#include <stdio.h>
#include <string.h>

#include <sdcard.h>
#include <hal.h>
#include <memory.h>

uint8_t sector_buffer[512];

const long sd_sectorbuffer = 0xffd6e00L;
Expand Down
4 changes: 2 additions & 2 deletions src/targets.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <memory.h>
#include <targets.h>
#include <mega65/memory.h>
#include <mega65/targets.h>

unsigned char detect_target(void)
{
Expand Down
5 changes: 2 additions & 3 deletions src/tests.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

#include <mega65/memory.h>
#include <mega65/tests.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <memory.h>
#include <tests.h>

unsigned char __tests_out;
unsigned short __ut_issueNum;
Expand Down
8 changes: 4 additions & 4 deletions src/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
that into account.
*/

#include <mega65/memory.h>
#include <mega65/time.h>
#include <mega65/targets.h>
#include <mega65/hal.h>
#include <stdio.h>
#include <memory.h>
#include <time.h>
#include <targets.h>
#include <hal.h>

#define I2CDELAY 5000L

Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function(TEST NAME)
add_executable(${NAME} ${NAME}.c)
target_link_libraries(${NAME} mega65libc)
set_target_properties(${NAME} PROPERTIES OUTPUT_NAME ${NAME}.prg)
target_compile_options(${NAME} PRIVATE -mcpu=mos65ce02 -Os ${CLANG_WARNINGS})
target_compile_options(${NAME} PRIVATE -Os ${CLANG_WARNINGS})
if (XEMU)
add_test(NAME ${NAME} COMMAND sh -c "${XEMU} ${XEMU_ARGS} -prg ${NAME}.prg")
endif()
Expand Down
3 changes: 2 additions & 1 deletion tests/test-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <mega65/memory.h>

#define XEMU_CONTROL 0xD6CF
#define XEMU_QUIT 0x42

void xemu_exit(int exit_code)
{
POKE(XEMU_CONTROL, (uint8_t)exit_code);
Expand Down