From: notaz Date: Thu, 20 Nov 2014 23:57:47 +0000 (+0200) Subject: megaed-sv: allow to input raw mapper code X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d788f3de66aeda55c2518b5e511111face3a82a;p=megadrive.git megaed-sv: allow to input raw mapper code --- diff --git a/megaed-sv/main.c b/megaed-sv/main.c index 1b2359a..a0741b6 100644 --- a/megaed-sv/main.c +++ b/megaed-sv/main.c @@ -215,6 +215,17 @@ static noinline int printf(const char *fmt, ...) return d; // wrong.. } +static u8 gethex(char c) +{ + if ('0' <= c && c <= '9') + return c - '0'; + if ('a' <= c && c <= 'f') + return c - 'a' + 10; + if ('A' <= c && c <= 'F') + return c - 'A' + 10; + return 0; +} + static const char *exc_names[] = { NULL, NULL, @@ -511,6 +522,12 @@ static int do_run(OsRoutine *ed, u8 b3, int tas_sync) case 'M': mapper = MTYPE_10M; break; + case 'n': + // raw numer: hex XX: mtype | x; + // x: bits [4-7]: SRAM_ON, SRAM_3M_ON, SNAP_SAVE_ON, MKEY + mapper = gethex(ed->usbReadByte()) << 4; + mapper |= gethex(ed->usbReadByte()); + break; default: return -1; }