diff --git a/Samples/Dialog/dialog.r b/Samples/Dialog/dialog.r index 380f48907f..118b379bcc 100644 --- a/Samples/Dialog/dialog.r +++ b/Samples/Dialog/dialog.r @@ -54,3 +54,26 @@ resource 'DITL' (128) { RadioButton { enabled, "Radio 2" }; } }; + +#include "Processes.r" + +resource 'SIZE' (-1) { + dontSaveScreen, + acceptSuspendResumeEvents, + enableOptionSwitch, + canBackground, + multiFinderAware, + backgroundAndForeground, + dontGetFrontClicks, + ignoreChildDiedEvents, + is32BitCompatible, + reserved, + reserved, + reserved, + reserved, + reserved, + reserved, + reserved, + 100 * 1024, + 100 * 1024 +}; diff --git a/Samples/SystemExtension/SystemExtension.r b/Samples/SystemExtension/SystemExtension.r index 07dee8fc29..de425aba9e 100644 --- a/Samples/SystemExtension/SystemExtension.r +++ b/Samples/SystemExtension/SystemExtension.r @@ -1,13 +1,7 @@ +#include "Retro68.r" + type 'INIT' { - hex string dontBreakAtEntry = $"", breakAtEntry = $"A9FF"; - longint = 0x61000002; // bsr *+2 -relativeTo: - integer = 0x0697; // addi.l #_, (a7) - longint = $$long(fltfile + 8*8) + (fltfile-relativeTo)/8; - integer = 0x4e75; // rts - longint = fltfile/8; -fltfile: - hex string; + RETRO68_CODE_TYPE }; resource 'INIT' (128) { diff --git a/cmake/add_application.cmake b/cmake/add_application.cmake index bec808ff68..6109570824 100644 --- a/cmake/add_application.cmake +++ b/cmake/add_application.cmake @@ -8,6 +8,7 @@ function(add_application name) set(options DEBUGBREAK CONSOLE) set(oneValueArgs TYPE CREATOR) set(multiValueArgs FILES MAKEAPPL_ARGS) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) list(APPEND ARGS_FILES ${ARGS_UNPARSED_ARGUMENTS}) @@ -45,9 +46,15 @@ function(add_application name) endif() foreach(f ${rsrc_files}) - list(APPEND ARGS_MAKEAPPL_ARGS --copy "${f}") + list(APPEND ARGS_MAKEAPPL_ARGS "${f}") endforeach() + if(NOT ARGS_TYPE) + set(ARGS_TYPE "APPL") + endif() + if(NOT ARGS_CREATOR) + set(ARGS_CREATOR "????") + endif() if(TARGET libretro) @@ -58,7 +65,13 @@ function(add_application name) add_custom_command( OUTPUT ${name}.bin ${name}.APPL ${name}.dsk - COMMAND ${MAKE_APPL} ${ARGS_MAKEAPPL_ARGS} -c "${name}.flt" -o "${name}" + #COMMAND ${MAKE_APPL} ${ARGS_MAKEAPPL_ARGS} -c "${name}.flt" -o "${name}" + COMMAND ${REZ} ${CMAKE_SOURCE_DIR}/libretro/Retro68APPL.r + -I${REZ_INCLUDE_PATH} + -DFLT_FILE_NAME="\\"${name}.flt\\"" + -o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL" + -t ${ARGS_TYPE} -c ${ARGS_CREATOR} + ${ARGS_MAKEAPPL_ARGS} DEPENDS ${name} ${rsrc_files}) add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin) endfunction() diff --git a/libretro/CMakeLists.txt b/libretro/CMakeLists.txt index 437825e488..fe8a333016 100644 --- a/libretro/CMakeLists.txt +++ b/libretro/CMakeLists.txt @@ -30,7 +30,11 @@ add_library(retrocrt malloc.c syscalls.c glue.c - consolehooks.c) + consolehooks.c + Retro68.r + Retro68APPL.r +) install(TARGETS retrocrt DESTINATION lib) install(FILES Retro68Runtime.h DESTINATION include) +install(FILES Retro68.r Retro68APPL.r DESTINATION RIncludes) diff --git a/libretro/Retro68.r b/libretro/Retro68.r new file mode 100644 index 0000000000..cb4fe3d90c --- /dev/null +++ b/libretro/Retro68.r @@ -0,0 +1,41 @@ +type 'CODE' (0) { + longint; // size above A5 + longint; // size of application globals + longint = (jtend - jtstart) / 8; // size of jump table + longint; // a5 offset of jump tabe +jtstart: + array { + integer; // offset + integer = 0x3f3c; + integer; // segment + integer = 0xa9f0; + }; +jtend: + ; +}; + +#define RETRO68_CODE_TYPE \ + hex string dontBreakAtEntry = $"", breakAtEntry = $"A9FF"; \ + longint = 0x61000002; /* bsr *+2 */ \ + relativeTo: \ + integer = 0x0697; /* addi.l #_, (a7) */ \ + longint = $$long(fltfile + 8*8) + (fltfile-relativeTo)/8; \ + integer = 0x4e75; /* rts */ \ + longint = fltfile/8; \ + fltfile: \ + hex string; + + + +type 'CODE' (1) { + integer = 0; + integer = 1; + RETRO68_CODE_TYPE +}; + +#define RETRO68_JUMP_TABLE { \ + 0x28, 0, 0x20, \ + { \ + 0, 1; \ + }; \ +} diff --git a/libretro/Retro68APPL.r b/libretro/Retro68APPL.r new file mode 100644 index 0000000000..3b2d5e26fc --- /dev/null +++ b/libretro/Retro68APPL.r @@ -0,0 +1,29 @@ +#include "Processes.r" +#include "Retro68.r" + +resource 'CODE' (0) RETRO68_JUMP_TABLE; + +resource 'CODE' (1) { + dontBreakAtEntry, $$read(FLT_FILE_NAME); +}; + +resource 'SIZE' (-1) { + dontSaveScreen, + acceptSuspendResumeEvents, + enableOptionSwitch, + canBackground, + multiFinderAware, + backgroundAndForeground, + dontGetFrontClicks, + ignoreChildDiedEvents, + is32BitCompatible, + reserved, + reserved, + reserved, + reserved, + reserved, + reserved, + reserved, + 1024 * 1024, + 1024 * 1024 +};