17 #define TIM_PRINT_PROMPT "\e[1;36mtim>\e[0m "
20 #define TIM_PROMPT printf(TIM_PRINT_PROMPT)
23 #define tprintf(...) {TIM_PROMPT; printf(__VA_ARGS__);}
26 #define log(...) {TIM_PROMPT; printf(__VA_ARGS__);}
31 #define debug(...) {TIM_PROMPT; \
32 printf("line %d of %s in %s\n", __LINE__, __FUNCTION__, __FILE__); \
44 #define warning(...) {TIM_PROMPT; \
45 printf("\e[1;33m[Warning] \e[0m"); \
46 printf("line %d of %s in %s\n", __LINE__, __FUNCTION__, __FILE__); \
48 printf("\e[1;33m[Warning] \e[0m"); \
49 printf(__VA_ARGS__); \
50 TIM_PROMPT; printf("\n"); }
53 #define error(...) {TIM_PROMPT; \
54 printf("\e[1;31m[Error] \e[0m"); \
55 printf("line %d of %s in %s\n", __LINE__, __FUNCTION__, __FILE__); \
57 printf("\e[1;31m[Error] \e[0m"); \
58 printf(__VA_ARGS__); \
59 TIM_PROMPT; printf("\n"); }
62 #define fatal(...) {error(__VA_ARGS__); \
64 printf("\e[1;31m[ FATAL ERROR ] \e[0m\n"); \
70 typedef unsigned char BOOL;
79 typedef enum tim_register_e{
120 typedef enum tim_instruction_opcode_e {
187 typedef enum tim_condition_e{
Store register X to address in register Y with offset in register Z.
Definition: common.h:123
Bitwise NOR two registers together.
Definition: common.h:139
Floating point Subtract immediate value from register X.
Definition: common.h:164
Floating point Multiply register X by register Y.
Definition: common.h:171
Logical shift left the bits in register X by the value in register Y.
Definition: common.h:141
Call to function who's address is contained within register X.
Definition: common.h:131
int tim_immediate
typedef for tim immediate values as operands to instructions.
Definition: common.h:76
tim_condition
A condition code for conditional execution.
Definition: common.h:187
tim_instruction_size size
The number of bytes the instruction occupies in memory.
Definition: common.h:184
Floating point Add register X to immediate value.
Definition: common.h:163
BOOL tim_is_special_register(tim_register reg)
Checks if the supplied register is a special register or not.
Definition: common.c:76
Floating point Add register X to register Y.
Definition: common.h:169
tim_instruction_opcode
Encodes all of the valid instruction opcodes and their bit values.
Definition: common.h:120
Floating point Divide register X by register Y.
Definition: common.h:172
Move the content of register X into register Y.
Definition: common.h:127
Floating point Multiply register X by immediate value.
Definition: common.h:165
tim_register
Encodes the address of the registers.
Definition: common.h:79
Bitwise AND two registers together.
Definition: common.h:144
Integer Subtract immediate value from register X.
Definition: common.h:152
Store register X to address in register Y with immediate offset.
Definition: common.h:124
Load to register X from address in register Y with immediate offset.
Definition: common.h:122
unsigned char tim_instruction_size
Encodes the size in bytes of an instruction in memory.
Definition: common.h:117
Return from the last function call.
Definition: common.h:133
Floating point Arithmetic shift register X right value in register Y.
Definition: common.h:174
BOOL tim_is_temp_register(tim_register reg)
Checks if the supplied register is a temporary register or not.
Definition: common.c:62
Integer Add register X to immediate value.
Definition: common.h:151
Integer Divide register X by immediate value.
Definition: common.h:154
Integer Arithmetic shift register X left by immediate value.
Definition: common.h:155
Integer Multiply register X by immediate value.
Definition: common.h:153
Pop element at top of stack into register X and increment the stack pointer.
Definition: common.h:126
BOOL tim_is_general_register(tim_register reg)
Checks if the supplied register is a general purpose register or not.
Definition: common.c:48
Jump to address contained within instruction immediate.
Definition: common.h:130
Bitwise OR two registers together.
Definition: common.h:146
Floating point Arithmetic shift register X left by value in register Y.
Definition: common.h:173
Sleeps the core for a certain number of cycles.
Definition: common.h:175
Load to register X from address in register Y with offset in register Z.
Definition: common.h:121
Floating point Arithmetic shift register X right immediate value.
Definition: common.h:168
Integer Subtract register X from register Y.
Definition: common.h:158
Jump to address contained within register X.
Definition: common.h:129
Stop processing and wait to be reset.
Definition: common.h:135
Integer Arithmetic shift register X right immediate value.
Definition: common.h:156
Integer Divide register X by register Y.
Definition: common.h:160
Floating point Arithmetic shift register X left by immediate value.
Definition: common.h:167
Bitwise NAND two registers together.
Definition: common.h:145
Integer Arithmetic shift register X right value in register Y.
Definition: common.h:162
Floating point Divide register X by immediate value.
Definition: common.h:166
Bitwise AND two registers together.
Definition: common.h:136
Move immediate I into register X.
Definition: common.h:128
Bitwise invert the specificed register.
Definition: common.h:143
Push register X onto the top of the stack and decrement the stack pointer.
Definition: common.h:125
Bitwise XOR two registers together.
Definition: common.h:148
unsigned char BOOL
Boolean type.
Definition: common.h:70
Bitwise NOR two registers together.
Definition: common.h:147
Integer Multiply register X by register Y.
Definition: common.h:159
Integer Add register X to register Y.
Definition: common.h:157
Test two general or special registers and set comparison bits.
Definition: common.h:134
Logical shift left the bits in register X by the immediate value.
Definition: common.h:149
Floating point Subtract register X from register Y.
Definition: common.h:170
Bitwise OR two registers together.
Definition: common.h:138
Used in the parse tree for instruction like DATA that are not emitted.
Definition: common.h:176
Bitwise XOR two registers together.
Definition: common.h:140
Bitwise NAND two registers together.
Definition: common.h:137
Logical shift right the bits in register X by the value in register Y.
Definition: common.h:142
tim_instruction_opcode opcode
The opcode of the instruction.
Definition: common.h:181
Integer Arithmetic shift register X left by value in register Y.
Definition: common.h:161
Logical shift right the bits in register X by the immediate value.
Definition: common.h:150
Call to function who's address is contained within instruction immediate.
Definition: common.h:132