|
|
1.1 root 1: #ifndef _OUTPUT_H
2: #define _OUTPUT_H
3:
4: /*
5: * The C outputted 68k program behaves in a not entirely 68k compatible manner.
6: * The exception table of the 68k does not exist and exceptions must be set by
7: * host call. Pending exceptions are only tested on *conditional* branch instructions,
8: * so a tight 'jmp' or 'bra' loop will not permit exceptions to be handled.
9: *
10: * There is no distinction between user and supervisor mode. No instructions to
11: * access the condition codes have been implemented.
12: *
13: * Not implemented:
14: * abcd, andi to ccr, andi to sr, bkpt, chk, cmpm, eori to ccr, eori to sr,
15: * move to/from ccr, move to/from sr, move usp, movec, movep, moves, nbcd,
16: * ori to ccr, ori to sr, reset, rtd, rtr, sbcd, stop, tas, trap, trapv
17: * These are mostly a load of crap.
18: */
19:
20: #define COMPILE_C 0
21: #define COMPILE_i386 1
22: #define COMPILE_MAX 2
23:
24: enum M68K_OPS {
25: OP_NONE, OP_JMP, OP_BCHG, OP_BCLR, OP_BSET, OP_BTST, OP_MULS, OP_MULU,
26: OP_AND, OP_OR, OP_XOR, OP_NOT, OP_NEGX, OP_NEG, OP_DIVU, OP_DIVS, OP_ASL,
27: OP_LSL, OP_ROXR, OP_ROXL, OP_ROL, OP_ROR, OP_ASR, OP_LSR,
28: OP_MOVEM, OP_SUBX, OP_ADDX, OP_ADD, OP_CMPA, OP_CMP, OP_SUB,
29: OP_ADDA, OP_SUBA, OP_SWAP, OP_JSR, OP_BCC, OP_DBCC, OP_CLR,
30: OP_EXG, OP_EXT, OP_RTE, OP_RTS, OP_ILLEGAL, OP_HCALL, OP_LINK,
31: OP_UNLK, OP_MOVE, OP_MOVEA, OP_TST, OP_PEA, OP_LEA, OP_SCC, OP_MAX
32: };
33:
34: typedef struct Operation {
35: enum M68K_OPS optype;
36: int size;
37: Opcode opcode;
38: ea_t src;
39: ea_t dest;
40: } op_t;
41:
42: struct Compiler {
43: void (*push_op) (enum M68K_OPS type, ea_t *src, ea_t *dest, int size);
44: void (*push_op2) (enum M68K_OPS type, ea_t *src, ea_t *dest, int size, int opcode);
45: void (*push_op_basic) (enum M68K_OPS type);
46:
47: void (*label) (const char *lab);
48: void (*addr_label) (int labelled);
49:
50: void (*begin) (const char *src_filename, const char *bin_filename);
51: void (*end) (const char *src_filename);
52: };
53:
54: extern struct Compiler compiler[COMPILE_MAX];
55:
56: extern void c_push_op (enum M68K_OPS type, ea_t *src, ea_t *dest, int size);
57: extern void c_push_op2 (enum M68K_OPS type, ea_t *src, ea_t *dest, int size, int opcode);
58: extern void c_push_op_basic (enum M68K_OPS type);
59: extern void c_begin (const char *src_filename, const char *bin_filename);
60: extern void c_end (const char *src_filename);
61: extern void c_label (const char *lab);
62: extern void c_addr_label ();
63:
64: extern void i386_push_op (enum M68K_OPS type, ea_t *src, ea_t *dest, int size);
65: extern void i386_push_op2 (enum M68K_OPS type, ea_t *src, ea_t *dest, int size, int opcode);
66: extern void i386_push_op_basic (enum M68K_OPS type);
67: extern void i386_begin (const char *src_filename, const char *bin_filename);
68: extern void i386_end (const char *src_filename);
69: extern void i386_label (const char *lab);
70: extern void i386_addr_label ();
71:
72: #endif /* _OUTPUT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.