ポケコンPC-G850を手に入れたついでに、そのエミュレータであるg800をApple Siliconなmacでコンパイルしたので、そのメモ。
基本的にはbrew環境のSDL2を使ってコンパイルしただけで、手直しはほんのちょっとです。brewだけインストール済みって人はbrew install sdl2だけしてもらえたらって感じ。
コードで直さなきゃいけないのは以下の点だけ。基本的には古のUNIXの修正で良くやるやつで、stri*系とmemi*系をstrcase*系に直す、MAX_PATHをPATH_MAXに直す(今どきそれで良いのか?ってのは別の話)、足りてないincludeと標準関数名との衝突を避けるリネームをするだけ。
あとはmakeで警告などは出るものの、最後まで通りました。
diff --git a/basic.c b/basic.c
index 9764b01..0860a6e 100644
--- a/basic.c
+++ b/basic.c
@@ -671,7 +671,7 @@ static int encodeNumDms(uint8 *num, const uint8 *str, int dms)
} else
sign = 0x00;
- if(strnicmp((const char *)p, "&H", 2) == 0) { /* 16<90>i<95>\<8B>L */
+ if(strncasecmp((const char *)p, "&H", 2) == 0) { /* 16<90>i<95>\<8B>L */^M
int i;
uint32 x = 0;
uint8 dec[8 + 1], *q;
@@ -3213,7 +3213,7 @@ uint8 *skipBlank(const uint8 **p)
*/
int peekSymbol(const uint8 **p, const uint8 *symbol)
{
- return memicmp(*p, symbol, strlen(symbol)) == 0;
+ return strncasecmp(*p, symbol, strlen(symbol)) == 0;^M
}
#define peekSymbol(p, symbol) peekSymbol(p, (const uint8 *)(symbol))
@@ -5468,7 +5468,7 @@ static int staErase(struct Basic *bas, const uint8 **p)
*/
static int staFiles(struct Basic *bas, const uint8 **p)
{
- char path[MAX_PATH] = "";
+ char path[PATH_MAX] = "";^M
uint8 ch;
if(!isTerm(p))
@@ -5614,7 +5614,7 @@ static int staGoto(struct Basic *bas, const uint8 **p)
/*
*/
-static void pause(struct Basic *bas)
+static void pause800(struct Basic *bas)^M
{
if(*pauseWhenPrint & 0x04)
while(getKeycode() != GKEY_RETURN)
@@ -5688,7 +5688,7 @@ static int staGprint(struct Basic *bas, const uint8 **p)
return ERR_10;
}
- pause(bas);
+ pause800(bas);^M
return ERR_OK_NEXT;
}
@@ -6552,7 +6552,7 @@ static int staOpen(struct Basic *bas, const uint8 **p)
{
int err, fileno = 1, mode = 0;
uint8 *filename;
- char path[MAX_PATH];
+ char path[PATH_MAX];^M
if((err = fetchStr(bas, &filename, p)) < 0)
return err;
@@ -6967,7 +6967,7 @@ static int staPrint(struct Basic *bas, const uint8 **p)
if(isTerm(p)) {
*noWrap = 0x00;
- pause(bas);
+ pause800(bas);^M
return ERR_OK_NEXT;
}
@@ -7050,7 +7050,7 @@ static int staPrint(struct Basic *bas, const uint8 **p)
return ERR_10;
}
- pause(bas);
+ pause800(bas);^M
return ERR_OK_NEXT;
}
@@ -8028,7 +8028,7 @@ static int getKeywordFromName(int *code, const uint8 *name)
}
/* RESERVED<82><A9>? */
- if(strnicmp((const char *)name, "RESERVED", 8) != 0)
+ if(strncasecmp((const char *)name, "RESERVED", 8) != 0)^M
return ERR_OK;
for(p = name + 8; *p == ' '; p++)
;
diff --git a/iocs.c b/iocs.c
index 3cb47d1..6e1ed54 100644
--- a/iocs.c
+++ b/iocs.c
@@ -1516,13 +1516,13 @@ uint8 getChrcode(int cursor)
/* <83><8D><81>[<83>}<8E><9A><81>E<83>J<83>i<95>ϊ<B7><83>e<81>[<83>u<83><8B><82><A9><82>猟<8D>????<EA><92>v<82><B7><82><EA><82>L<83><85><81>[<82>ɓ<FC><82><EA><82><E9> */
for(r = table; r->roman != NULL; r++)
- if(memicmp(roman, r->roman, strlen(roman)) == 0) {
+ if(strncasecmp(roman, r->roman, strlen(roman)) == 0) {^M
if(strlen(roman) == strlen(r->roman)) {
strcpy(queue, r->kana);
if(memory[0x7901] & 0x08) {
for(d = dai_sho; d->dai != NULL; d++)
- if(stricmp(queue, d->dai) == 0)
+ if(strcasecmp(queue, d->dai) == 0)^M
strcpy(queue, d->sho);
memory[0x7901] &= ~0x08;
}
diff --git a/menu.c b/menu.c
index 9f84189..1dc1642 100644
--- a/menu.c
+++ b/menu.c
@@ -14,6 +14,7 @@
# include <unistd.h>
# include <sys/types.h>
# include <sys/stat.h>
+# include <dirent.h>^M
#endif
#include "g800.h"