From 6c351e0717608ab8e0dce206818439531508534c Mon Sep 17 00:00:00 2001 From: bbbbbr Date: Mon, 29 Jan 2024 23:59:04 -0800 Subject: [PATCH] Tools: Detect gbnim --- Changelog.md | 1 + src/entry_names_gbnim.h | 26 ++++++++++++++++++++++++++ src/gbtoolchainid.c | 6 +++--- src/sig_gbnim.c | 30 ++++++++++++++++++++++++++++++ src/sig_gbnim.h | 8 ++++++++ test/gbnim_pocketclicker.gb | Bin 0 -> 32768 bytes 6 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 src/entry_names_gbnim.h create mode 100644 src/sig_gbnim.c create mode 100644 src/sig_gbnim.h create mode 100644 test/gbnim_pocketclicker.gb 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 0000000000000000000000000000000000000000..22e10d2fbd464deb8e7cad15052ceda8f15c67b4 GIT binary patch literal 32768 zcmeHN33OZ4nZDA~W?PmeJ2;Bs#!r$7ikt-3&IHFeieela2*hq1Fqwhc30cULi494S zydb%dCN48m5*TvAG6~aVrqj&?%2pU6qdLSWN@J$VKo=qp4H2hH?4g0%V66H6`((=w zNvA#2Gv~}X?>+1J-TlAczuf!&|EAM_+~sf;<;&-X(yn}Yd}vye=pAfY>e8?0PCK8B zERnVDB|c5^;kdLg-kTm7d+X8-{*OxRYtrfCzuCO`SU$^>wzK=0ndLK+t+eke%<}VN z+ur@fFW!3erI)tczRmLMW54+MqX%DlvC8+kwN0O0cf+dBeU2$tMMauks?woH2HyWP zOD6YD*knV0?CROchvGMs+pZ{g_NFblXZw@aBrFML-F7r9bjTlK%KBW%n@q_@5V;A*+AuwvC&DO<&y6 zw7IVRi`zDCXI7@sy8WAiw{Pm$v9*1he8>828}Hn@ZHv5hyS%M^hrIrt^;_>;zv0eJ z%+2iDk(BN|r=BgVX{l*Vh)29mWTv=H#}b-ZTBnvRyKQa!oR`v+xUt@8$YeQ<7qm>7 zhJuGY*1WB4b2_g)7re4*?3=Bf-)LD~H-wxU>xVQN7JYF+>O9wVyY9ZFnE6aE`q=(h zx5pIgl5-A6-_*vsJesSj^SI92dUO1cHd-d(b#r@;`?j@%NUv)isH#e=Yo5!Q_v@{p zueEnR+!XxBMr2TqyORDkx6kRk#kGAnA;wG@h6WR$J^l~ct!={t_uk*y^FYh#`19J4 z91xTc10@EPfAOwGDbvW$8FmrA`9shfYn{TWak}xF$ z=n%xP+t#A%(;zPTOC8!i=dq%V7@W_-xY1{H{d|@yz-M`zyp7bIRdi>~beB6RQlMr= zcii!bY1uKY=xb%sk8}ynE{1feULajjIVkW|xDRL(3J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