Add function prototypes.

This commit is contained in:
carl 2019-03-25 00:11:43 +08:00
parent 98c5d1f0ee
commit 180d3388d6
2 changed files with 67 additions and 42 deletions

View file

@ -76,3 +76,33 @@ short eamode[] = {
/* 074L */ DTA|MEM |PUTL | (RELO4 )<<8, /* 074L */ DTA|MEM |PUTL | (RELO4 )<<8,
}; };
#endif #endif
/* 680x0 specific instructions */
void ea_1(int sz, int bits);
void ea_2(int sz, int bits);
void indexmode(int hibyte);
void checksize(int sz, int bits);
void test68010(void);
void badoperand(void);
void shift_op(int opc, int sz);
void bitop(int opc);
void add(int opc, int sz);
void and(int opc, int sz);
int to_dreg(int opc, int sz, int bits);
int from_dreg(int opc, int sz, int bits);
void cmp(int sz);
void move(int sz);
void move_special(int sz);
int reverse(register int regs, int max);
void movem(int dr, int sz, int regs);
void movep(int sz);
void branch(int opc, expr_t exp);
void ea5x73(int rg, int sz);
void ea707172(int sz);
void ea6x(int rg, int ir, int sz);
void ea72(void);
void ea73(int ri, int sz);
void Xnofit(void);
void fbranch(int opc, expr_t exp);
void ch_sz_dreg(int size, int mode);
void check_fsize(int sz, int size);

View file

@ -8,8 +8,7 @@
* Motorola 68000/68010 auxiliary functions * Motorola 68000/68010 auxiliary functions
*/ */
static int static int extension_offset(void)
extension_offset()
{ {
switch(curr_instr) { switch(curr_instr) {
case MOVEM: case MOVEM:
@ -25,9 +24,9 @@ extension_offset()
return 2; return 2;
} }
ea_1(sz, bits) void ea_1(int sz, int bits)
{ {
register flag; register int flag;
if (mrg_1 > 074) if (mrg_1 > 074)
serror("no specials"); serror("no specials");
@ -61,7 +60,7 @@ ea_1(sz, bits)
emit2(loww(exp_1.val)); emit2(loww(exp_1.val));
} }
ea_2(sz, bits) void ea_2(int sz, int bits)
{ {
mrg_1 = mrg_2; mrg_1 = mrg_2;
exp_1 = exp_2; exp_1 = exp_2;
@ -69,30 +68,30 @@ ea_2(sz, bits)
ea_1(sz, bits); ea_1(sz, bits);
} }
indexmode(hibyte) void indexmode(int hibyte)
{ {
Xfit(fitb(exp_2.val)); Xfit(fitb(exp_2.val));
exp_2.val = hibyte | lowb(exp_2.val); exp_2.val = hibyte | lowb(exp_2.val);
} }
checksize(sz, bits) void checksize(int sz, int bits)
{ {
if ((bits & (1 << (sz>>6))) == 0) if ((bits & (1 << (sz>>6))) == 0)
serror("bad size"); serror("bad size");
} }
test68010() void test68010(void)
{ {
if (model != 1 && pass == PASS_3) if (model != 1 && pass == PASS_3)
warning("68010 instruction"); warning("68010 instruction");
} }
badoperand() void badoperand(void)
{ {
serror("bad operands"); serror("bad operands");
} }
shift_op(opc, sz) void shift_op(int opc, int sz)
{ {
if (mrg_1 < 010 && mrg_2 < 010) { if (mrg_1 < 010 && mrg_2 < 010) {
emit2((opc&0170470) | sz | mrg_1<<9 | mrg_2); emit2((opc&0170470) | sz | mrg_1<<9 | mrg_2);
@ -113,9 +112,9 @@ shift_op(opc, sz)
ea_2(SIZE_W, MEM|ALT); ea_2(SIZE_W, MEM|ALT);
} }
bitop(opc) void bitop(int opc)
{ {
register bits; register int bits;
bits = DTA|ALT; bits = DTA|ALT;
if (opc == 0 && (mrg_1 < 010 || mrg_2 != 074)) if (opc == 0 && (mrg_1 < 010 || mrg_2 != 074))
@ -134,7 +133,7 @@ bitop(opc)
badoperand(); badoperand();
} }
add(opc, sz) void add(int opc, int sz)
{ {
if ((mrg_2 & 070) == 010) if ((mrg_2 & 070) == 010)
checksize(sz, 2|4); checksize(sz, 2|4);
@ -168,7 +167,7 @@ add(opc, sz)
badoperand(); badoperand();
} }
and(opc, sz) void and(int opc, int sz)
{ {
if (mrg_1 == 074 && mrg_2 >= 076) { /* ccr or sr */ if (mrg_1 == 074 && mrg_2 >= 076) { /* ccr or sr */
if (sz != SIZE_NON) if (sz != SIZE_NON)
@ -194,7 +193,7 @@ and(opc, sz)
badoperand(); badoperand();
} }
to_dreg(opc, sz, bits) int to_dreg(int opc, int sz, int bits)
{ {
if ((mrg_2 & 070) != 000) if ((mrg_2 & 070) != 000)
return(0); return(0);
@ -203,7 +202,7 @@ to_dreg(opc, sz, bits)
return(1); return(1);
} }
from_dreg(opc, sz, bits) int from_dreg(int opc, int sz, int bits)
{ {
if ((mrg_1 & 070) != 000) if ((mrg_1 & 070) != 000)
return(0); return(0);
@ -212,9 +211,9 @@ from_dreg(opc, sz, bits)
return(1); return(1);
} }
cmp(sz) void cmp(int sz)
{ {
register opc; register int opc;
if ((mrg_1&070) == 030 && (mrg_2&070) == 030) { if ((mrg_1&070) == 030 && (mrg_2&070) == 030) {
emit2(0130410 | sz | (mrg_1&7) | (mrg_2&7)<<9); emit2(0130410 | sz | (mrg_1&7) | (mrg_2&7)<<9);
@ -259,9 +258,9 @@ cmp(sz)
badoperand(); badoperand();
} }
move(sz) void move(int sz)
{ {
register opc; register int opc;
if (mrg_1 > 074 || mrg_2 > 074) { if (mrg_1 > 074 || mrg_2 > 074) {
move_special(sz); move_special(sz);
@ -291,7 +290,7 @@ move(sz)
ea_2(sz, ALT); ea_2(sz, ALT);
} }
move_special(sz) void move_special(int sz)
{ {
if (mrg_2 >= 076) { if (mrg_2 >= 076) {
if (sz != SIZE_NON) if (sz != SIZE_NON)
@ -322,9 +321,7 @@ move_special(sz)
badoperand(); badoperand();
} }
int int reverse(register int regs, int max)
reverse(regs, max)
register int regs;
{ {
register int r, i; register int r, i;
@ -337,9 +334,9 @@ reverse(regs, max)
return regs; return regs;
} }
movem(dr, sz, regs) void movem(int dr, int sz, int regs)
{ {
register i; register int i;
if ((mrg_2>>3) == 04) { if ((mrg_2>>3) == 04) {
regs = reverse(regs, 16); regs = reverse(regs, 16);
@ -359,7 +356,7 @@ movem(dr, sz, regs)
ea_2(sz, i); ea_2(sz, i);
} }
movep(sz) void movep(int sz)
{ {
checksize(sz, 2|4); checksize(sz, 2|4);
if (mrg_1<010 && (mrg_2&070)==050) { if (mrg_1<010 && (mrg_2&070)==050) {
@ -375,10 +372,9 @@ movep(sz)
badoperand(); badoperand();
} }
branch(opc, exp) void branch(int opc, expr_t exp)
expr_t exp;
{ {
register sm; register int sm;
exp.val -= (DOTVAL + 2); exp.val -= (DOTVAL + 2);
if ((pass == PASS_2) if ((pass == PASS_2)
@ -406,7 +402,7 @@ expr_t exp;
} }
} }
ea5x73(rg, sz) void ea5x73(int rg, int sz)
{ {
if ((exp_2.typ & ~S_DOT) == DOTTYP) { if ((exp_2.typ & ~S_DOT) == DOTTYP) {
/* pc relative with index */ /* pc relative with index */
@ -426,9 +422,9 @@ ea5x73(rg, sz)
badoperand(); badoperand();
} }
ea707172(sz) void ea707172(int sz)
{ {
register sm; register int sm;
mrg_2 = 071; mrg_2 = 071;
switch (sz) { switch (sz) {
@ -474,20 +470,20 @@ ea707172(sz)
} }
} }
ea6x(rg, ir, sz) void ea6x(int rg, int ir, int sz)
{ {
mrg_2 = 060 | rg; mrg_2 = 060 | rg;
checksize(sz, 2|4); checksize(sz, 2|4);
indexmode(ir<<12 | (sz&0200)<<4); indexmode(ir<<12 | (sz&0200)<<4);
} }
ea72() void ea72(void)
{ {
mrg_2 = 072; mrg_2 = 072;
exp_2.val -= (DOTVAL + extension_offset()); exp_2.val -= (DOTVAL + extension_offset());
} }
ea73(ri, sz) void ea73(int ri, int sz)
{ {
mrg_2 = 073; mrg_2 = 073;
exp_2.val -= (DOTVAL + extension_offset()); exp_2.val -= (DOTVAL + extension_offset());
@ -495,15 +491,14 @@ ea73(ri, sz)
indexmode(ri<<12 | (sz&0200)<<4); indexmode(ri<<12 | (sz&0200)<<4);
} }
Xnofit() void Xnofit(void)
{ {
if (pass == PASS_3) serror("too big"); if (pass == PASS_3) serror("too big");
} }
fbranch(opc, exp) void fbranch(int opc, expr_t exp)
expr_t exp;
{ {
register sm; register int sm;
exp.val -= (DOTVAL + 2); exp.val -= (DOTVAL + 2);
if ((pass == PASS_2) if ((pass == PASS_2)
@ -528,14 +523,14 @@ expr_t exp;
emit4(exp.val); emit4(exp.val);
} }
ch_sz_dreg(size, mode) void ch_sz_dreg(int size, int mode)
{ {
if (mode == 0 && if (mode == 0 &&
(size == FSIZE_X || size == FSIZE_P || size == FSIZE_D)) (size == FSIZE_X || size == FSIZE_P || size == FSIZE_D))
serror("illegal size for data register"); serror("illegal size for data register");
} }
check_fsize(sz, size) void check_fsize(int sz, int size)
{ {
if (sz != size) serror("bad size"); if (sz != size) serror("bad size");
} }