diff --git a/src/c/c.stinkr b/src/c/c.stinkr index ba243ee3..f48fbe45 100644 --- a/src/c/c.stinkr +++ b/src/c/c.stinkr @@ -3,7 +3,7 @@ l c31.stk l c32.stk l c33.stk l c34.stk -l c3510 +l c35.stk l c91.stk l c94.stk l c95.stk diff --git a/src/c/c2610.mid b/src/c/c2610.mid deleted file mode 100644 index b16849d9..00000000 Binary files a/src/c/c2610.mid and /dev/null differ diff --git a/src/c/c3510.mid b/src/c/c3510.mid deleted file mode 100644 index 7a5b4871..00000000 Binary files a/src/c/c3510.mid and /dev/null differ diff --git a/src/c/c42.c b/src/c/c42.c new file mode 100644 index 00000000..6267ddaa --- /dev/null +++ b/src/c/c42.c @@ -0,0 +1,385 @@ +/* Created from disassembly of SAIL file C4220.MID[C,SYS]. + * Care has been taken to match line numbers in the generated + * MIDAS file. */ + +extern int mflag; +extern int f_output; +extern char cstore[]; +extern char *fn_string; +extern int fn_output; + +char *afloat(); +char *aidn(); +char *aif(); +char *aifm(); +char *am(); +char *aname(); +char *apname(); +char *astring(); +char *ffloat(); +char *get_buf(); +char *opname(); +char *sconcat(); +char *asetfno(); + +#define TEXT "t" +#define BINARY "b" +#define SMALL "-34359738368" + +int nfn { 9 }; +char *fn[] { "ff", "i", "sr", "n", "if", "ifm", "m", "pname", "setfno" }; +char *(*ff[])() { afloat, aidn, astring, aname, aif, aifm, am, apname, asetfno }; +int funcn[10]; +#define STRING_EMPTY "" +char *regnames[] { "A", "C", "D", "B" }; + +int packf(); +int packc(); + +char bufff[10][50]; +int bufc { 0 }; +int packb[4]; +int packn[1]; + +/* + * + */ +char * asetfno (a, b) +char **b; +{ + stcpy(*b, funcn); + return ""; +} + +/* + * + * + * + * + * + * + */ +char *aname (x, y) +char *y; +{ + int a, b; + char *c, *d; + + a = atoi(*y); + if (x == 1) return opname(a); + b = atoi(y[1]); + + + + if (mflag != 0) cprint("ANAME(%d,%d)\n", a, b); + + + + if (a >= 0) return regnames[a]; + a = -a; + d = ""; + if (a >= 9) { + c = regnames[a - 9]; + if (b != 0) d = sconcat(3, "#1(", c, ")"); + else d = sconcat(3, "(", c, ")"); + goto end; + } + switch (a) { + case 1: + d = sconcat(3, "<#1-FS", funcn, "-\\%P>(P)"); + goto end; + case 2: + return "%i(#1)"; + case 3: + return "I#1"; + case 4: + d = sconcat(3, "<#1-FS", funcn, "-\\%A-\\%P>(P)"); + goto end; + case 5: + return "L#1"; + case 6: + return "[#1]"; + case 7: + return "[%ff(#1)]"; + case 8: + return "S#1"; + } + + return ""; +end: if (b%1 != 0) error(6025, 0); + return d; +} + +/* + * + * + * + * + */ +char *opname (x) +{ + switch (x) { + case 64: + case 102: + return "ADD"; + case 68: + case 94: + case 106: + return "SUB"; + case 72: + return "IMUL"; + case 76: + case 80: + return "IDIV"; + case 86: + return "AND"; + case 90: + return "IOR"; + case 88: + return "XOR"; + case 66: + return "FADR"; + case 70: + return "FSBR"; + case 74: + return "FMPR"; + case 78: + return "FDVR"; + } + return ""; +} + +/* + * + * + * + */ +char *aif (a, b) +char **b; +{ + return atoi(*b) != 0 ? "#1" : "#2"; +} + +/* + * + * + * + */ +char *aifm (x, y) +char **y; +{ + int a; + if (atoi(*y) == -6) { + a = atoi(y[1]); + if (a >= 0 && a <= 262143) + return "#2"; } + return "#3"; +} + +/* + * + * + * + */ +char *am (x, y) +char **y; +{ + return &cstore[atoi(*y)]; +} + +/* + * + * + * + */ +char *aidn (x, y) +char **y; +{ + char *a, *b, *c; + int d, e; + + if (x > 0) { + a = &cstore[atoi(*y)]; + b = c = get_buf(); + if (*a == ' ') { + ++a; + d = 6; + while ((e = *a++) != 0 && --d >= 0) { + if (e == '$') + e = *a++; + if (e == '#' || e == '%') *b++ = '\\'; + *b++ = e; + } + + } else { + *b++ = 'Z'; + d = 5; + while ((e = *a++) != 0 && --d >= 0) + *b++ = e == '_' ? 'J' : e; + } + *b = 0; + return c; + } + return ""; +} + +/* + * + * + * + * + */ +char * afloat (a, b) +char **b; +{ + return ffloat (atoi (*b)); +} +char *ffloat (a) +{ + char *b, *c, *d; + char e, f; + + d = get_buf(); + f = 0; + b = &cstore[a]; + c = d; + + while (e = *b++) { + switch (e) { + case '.': f = 1; + *c++ = '.'; + if ((*b < '0') | (*b > '9')) *c++ = '0'; + break; + case 'e': if (!f) { + *c++ = '.'; + *c++ = '0'; + f = 1; + } + *c++ = '^'; + break; + default: if (c < d+50) *c++ = e; + } + } + if (f == 0) { + *c++ = '.'; + *c++ = '0'; + } + + *c++ = 0; + return d; +} + +/* + * + * + * + * + */ +char *astring (a, b) +{ + int c, d, e; + + d = 0; + c = xopen(fn_string, 114, BINARY); + + while (1) { + packf(); + e = cgetc(c); + if (e <= 0) if (ceof(c)) break; + cprint (f_output, "S%d:", d); + d++; + while (1) { + if (e == '$') { + e = cgetc(c); + d++; + if (e == '0') e = 0; + packc(e); + } + else { + packc(e); + if (e == 0) break; + } + e = cgetc(c); + d++; + } + } + cclose(c); + packf(); + return "\\"; +} + +/* + * + * + * + * + * + */ +char *apname (a, b) +{ + char *buf; + buf = get_buf(); + fngnm(fn_output, buf); + return buf; +} + +/* + */ +char *sconcat (x, y, x0, x1, x2, x3) +char *y; +{ + char b; + char *c; + char *d; + char **e; + char *f; + + f = get_buf(); + e = &y - 1; + d = f; + + while (--x >= 0) { + c = *++e; + while (b = *c++) *d++ = b; + } + + *d = 0; + return f; +} + +/* + * + * + * + * + * + * + * + * + */ +char *get_buf () +{ + if (++bufc >= 10) bufc=0; + return bufff[bufc]; +} + +/* + * + * + * + * + * + * + * + * + * + */ +int packc (x) +{ + cprint(f_output, "\t%d\n", x); +} + +int packf () +{ + ; +} diff --git a/src/c/c4220.mid b/src/c/c4220.mid deleted file mode 100644 index e38e6a79..00000000 Binary files a/src/c/c4220.mid and /dev/null differ diff --git a/src/c/c4320.mid b/src/c/c4320.mid deleted file mode 100644 index 81f49745..00000000 Binary files a/src/c/c4320.mid and /dev/null differ diff --git a/src/c/lp.stinkr b/src/c/lp.stinkr index 8919324e..a2a5e01e 100644 --- a/src/c/lp.stinkr +++ b/src/c/lp.stinkr @@ -5,7 +5,7 @@ l c22.stk l c23.stk l c24.stk l c25.stk -l c2610 +l c26.stk l c91.stk l c92.stk l c95.stk diff --git a/src/c/m.stinkr b/src/c/m.stinkr index 32b9aa62..88be033f 100644 --- a/src/c/m.stinkr +++ b/src/c/m.stinkr @@ -1,7 +1,7 @@ x c/clib l c41.stk -l c4220 -l c4320 +l c42.stk +l c43.stk l c92.stk l c93.stk l c94.stk