--- uae/src/genp2c.c 2018/04/24 16:39:50 1.1 +++ uae/src/genp2c.c 2018/04/24 16:49:58 1.1.1.4 @@ -12,7 +12,9 @@ #include "sysconfig.h" #include "sysdeps.h" -#include "custom.h" +/* We can't include custom.h here. */ +#define MAX_WORDS_PER_LINE 50 + static char *gen_ind (char *a, int b) { @@ -38,7 +40,11 @@ static char *gen_indsx (char *a, char *s #define reg(a) "%" a #define ind(a,b) #b"("a")" #define imm(a) "$"#a +#ifdef USE_UNDERSCORE +#define sym(a) "_"#a +#else #define sym(a) #a +#endif #define indx(a,b,c,d) #b"("a","c","#d")" #define indsx(a,s,b,c,d) s"+"#b"("a","c","#d")" @@ -76,13 +82,14 @@ static void orl (char *src, char *dst) { static void imull (unsigned long val, char *dst) { printf ("\timull $0x%08lx,%s\n", val, dst); } static void decl (char *dst) { printf ("\tdecl %s\n", dst); } static void incl (char *dst) { printf ("\tincl %s\n", dst); } -static void bswapl (char *dst) { printf ("\tbswapl %s\n", dst); } +static void bswapl (char *dst) { printf ("\tbswap %s\n", dst); } static void shrl (int count, char *dst) { printf ("\tshrl $%d,%s\n", count, dst); } static void shll (int count, char *dst) { printf ("\tshll $%d,%s\n", count, dst); } static void pushl (char *src) { printf ("\tpushl %s\n", src); } static void popl (char *dst) { printf ("\tpopl %s\n", dst); } static void ret (void) { printf ("\tret\n"); } -static void align (int a) { printf ("\t.align %d\n", 1 << a); } +static void align (int a) { printf ("\t.p2align %d,0x90\n", a); } + static void shiftleftl (int count, char *dst) { if (count == 0) @@ -109,7 +116,7 @@ static void shiftleftl (int count, char static void declare_fn (char *name) { printf ("\t.globl %s\n", name); - printf ("\t.type %s,@function\n", name); +/* printf ("\t.type %s,@function\n", name); */ align (5); printf ("%s:\n", name); } @@ -139,7 +146,7 @@ static void gen_x86_set_hires_h_toobad_k char buf[40]; char *indb0; - sprintf (buf, "set_hires_h_%d_%d", pl, mode); + sprintf (buf, sym (set_hires_h_%d_%d), pl, mode); declare_fn (buf); pushl (ebp); @@ -235,7 +242,7 @@ static void gen_x86_set_hires_h (int pl, char buf[40]; char *indb0; - sprintf (buf, "set_hires_h_%d_%d", pl, mode); + sprintf (buf, sym (set_hires_h_%d_%d), pl, mode); declare_fn (buf); pushl (ebp); @@ -391,7 +398,7 @@ static void gen_x86_set_hires_l (int pl, int loop; char buf[40]; - sprintf (buf, "set_hires_l_%d_%d", pl, mode); + sprintf (buf, sym (set_hires_l_%d_%d), pl, mode); declare_fn (buf); pushl (ebp); @@ -450,7 +457,7 @@ static void gen_x86_set_lores_h (int pl, int loop; char buf[40]; - sprintf (buf, "set_lores_h_%d_%d", pl, mode); + sprintf (buf, sym (set_lores_h_%d_%d), pl, mode); declare_fn (buf); pushl (ebp); @@ -556,7 +563,6 @@ static void gen_c_set_hires_l (int pl, i int plmul = mode == 0 ? 1 : 2; int ploff = mode == 2 ? 1 : 0; int i; - int loop; if (header) printf("extern "); @@ -592,7 +598,7 @@ static void gen_c_set_lores_h (int pl, i { int plmul = mode == 0 ? 1 : 2; int ploff = mode == 2 ? 1 : 0; - int i, j; + int i; if (header) printf("extern ");