stuff
This commit is contained in:
13
meson.build
13
meson.build
@@ -1,13 +1,18 @@
|
||||
project('MyLittleCPU', 'c')
|
||||
|
||||
sources = [
|
||||
sources = files(
|
||||
'src/main.c',
|
||||
'src/emu.c',
|
||||
'src/memory.c',
|
||||
'src/instruction.c',
|
||||
'src/util.c'
|
||||
]
|
||||
)
|
||||
|
||||
args = ['-Wall', '-Wextra', '-O3']
|
||||
asmSources = files(
|
||||
'src/assembler/main.c'
|
||||
)
|
||||
|
||||
executable('emu', sources, c_args: args)
|
||||
args = ['-Wall', '-Wextra']
|
||||
|
||||
executable('emu', sources, c_args: args)
|
||||
execuatble('assembler', asmSources, c_args: args)
|
||||
|
||||
@@ -12,11 +12,16 @@ typedef enum : uint8_t {
|
||||
} InstructionOpcode;
|
||||
|
||||
typedef enum {
|
||||
// General purpose registers
|
||||
REG_A, REG_B, REG_C,
|
||||
|
||||
// Function arguments
|
||||
REG_X, REG_Y, REG_Z,
|
||||
|
||||
// Return value
|
||||
REG_R,
|
||||
|
||||
// Flags
|
||||
REG_F,
|
||||
|
||||
REG_MAX // all registers should come before this one, this is so we can
|
||||
@@ -41,4 +46,4 @@ extern const OperandType INSTRUCTION_OPERAND_TYPES[][3];
|
||||
|
||||
char* opcodeToCStr(InstructionOpcode opcode);
|
||||
char* instructionToCStr(Instruction inst);
|
||||
char* registerToCStr(Register reg);
|
||||
char* registerToCStr(Register reg);
|
||||
|
||||
5
tests/add.asm
Normal file
5
tests/add.asm
Normal file
@@ -0,0 +1,5 @@
|
||||
mvi a 2
|
||||
mvi b 2
|
||||
|
||||
add a b
|
||||
hlt
|
||||
Reference in New Issue
Block a user