diff --git a/Changelog.md b/Changelog.md index ef19a29..f875178 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ Changelog # Version 1.4.8 - Detect GBStudio 3.2.0 +- Detect gbnim # Version 1.4.7 - Detect GBForth diff --git a/src/entry_names_gbnim.h b/src/entry_names_gbnim.h new file mode 100644 index 0000000..4f82aea --- /dev/null +++ b/src/entry_names_gbnim.h @@ -0,0 +1,26 @@ + +#include +#include + +#include "common.h" + +#ifndef _ENTRY_NAMES_GBNIM_H +#define _ENTRY_NAMES_GBNIM_H + + + // ==== SHARED CODE WITH C STARTS HERE ==== + + // ==== gbnim ==== + // + // https://github.com/ZoomTen/pocket-clicker/blob/4b520a95e9b8b22d5b3860cac124b4ad6de2215d/src/asm/crt0/header_init_rstvectors.s#L121C1-L128C19 + DEF_PATTERN_ADDR(sig_gbnim_startup_1_at, 0x0176); + DEF_PATTERN_BUF(sig_gbnim_startup_1, AR_ARGS(0x22, 0x77, 0xE0, 0x0F, 0xE0, 0x26)); + + // https://github.com/ZoomTen/pocket-clicker/blob/4b520a95e9b8b22d5b3860cac124b4ad6de2215d/src/asm/crt0/header_init_rstvectors.s#L144C1-L158C10 + DEF_PATTERN_ADDR(sig_gbnim_startup_2_at, 0x0185); + DEF_PATTERN_BUF(sig_gbnim_startup_2, AR_ARGS(0x0E, 0x0B, 0xF7, 0xCD, 0x92, 0x28, 0xE0, 0x4A, 0x3E, 0x07, 0xE0, 0x4B, 0x3E, 0xE4, 0xE0, 0x47, 0xE0, 0x48, 0xE0, 0x49, 0x3C)); + + // ==== SHARED CODE WITH C ENDS HERE ==== + + +#endif // _ENTRY_NAMES_GBNIM_H diff --git a/src/gbtoolchainid.c b/src/gbtoolchainid.c index 2a3ce15..6bdab64 100644 --- a/src/gbtoolchainid.c +++ b/src/gbtoolchainid.c @@ -16,6 +16,7 @@ #include "sig_turborascal.h" #include "sig_gbforth.h" #include "sig_gbbasic.h" +#include "sig_gbnim.h" #include "sig_music.h" @@ -126,11 +127,10 @@ void gbtools_detect(uint8_t * p_rom_data, uint32_t rom_size, bool strict_mode) { check_gbbasic(); } - // Turbo Rascal + // Various other toolchains check_turborascal(); - - // GB Forth check_gbforth(); + check_gbnim(); // Check for music drivers // May report multiple drivers (if found) in default output mode diff --git a/src/sig_gbnim.c b/src/sig_gbnim.c new file mode 100644 index 0000000..9b2ad33 --- /dev/null +++ b/src/sig_gbnim.c @@ -0,0 +1,30 @@ +// This is free and unencumbered software released into the public domain. +// For more information, please refer to +// bbbbbr 2020 + +#include +#include + +#include "common.h" +#include "entries.h" +#include "gbtoolchainid.h" + +#include "entry_names_gbnim.h" + +#include + +// Check for GB Nim +void check_gbnim(void) { + + tool_entry entry; + + // ==== SHARED CODE WITH C STARTS HERE ==== + entry = FORMAT_ENTRY(TYPE_TOOLS, "gbnim", ""); + if (CHECK_PATTERN_AT_ADDR(sig_gbnim_startup_1, sig_gbnim_startup_1_at)) { + if (CHECK_PATTERN_AT_ADDR(sig_gbnim_startup_2, sig_gbnim_startup_2_at)) { + entry_add(entry); + } + } + + // ==== SHARED CODE WITH C ENDS HERE ==== +} diff --git a/src/sig_gbnim.h b/src/sig_gbnim.h new file mode 100644 index 0000000..5055fc3 --- /dev/null +++ b/src/sig_gbnim.h @@ -0,0 +1,8 @@ + +#ifndef _SIG_GBNIM_H +#define _SIG_GBNIM_H + +void check_gbnim(void); + +#endif // _SIG_GBNIM_H + diff --git a/test/gbnim_pocketclicker.gb b/test/gbnim_pocketclicker.gb new file mode 100644 index 0000000..22e10d2 Binary files /dev/null and b/test/gbnim_pocketclicker.gb differ