stuff
This commit is contained in:
11
meson.build
11
meson.build
@@ -1,13 +1,18 @@
|
|||||||
project('MyLittleCPU', 'c')
|
project('MyLittleCPU', 'c')
|
||||||
|
|
||||||
sources = [
|
sources = files(
|
||||||
'src/main.c',
|
'src/main.c',
|
||||||
'src/emu.c',
|
'src/emu.c',
|
||||||
'src/memory.c',
|
'src/memory.c',
|
||||||
'src/instruction.c',
|
'src/instruction.c',
|
||||||
'src/util.c'
|
'src/util.c'
|
||||||
]
|
)
|
||||||
|
|
||||||
args = ['-Wall', '-Wextra', '-O3']
|
asmSources = files(
|
||||||
|
'src/assembler/main.c'
|
||||||
|
)
|
||||||
|
|
||||||
|
args = ['-Wall', '-Wextra']
|
||||||
|
|
||||||
executable('emu', sources, c_args: args)
|
executable('emu', sources, c_args: args)
|
||||||
|
execuatble('assembler', asmSources, c_args: args)
|
||||||
|
|||||||
@@ -12,11 +12,16 @@ typedef enum : uint8_t {
|
|||||||
} InstructionOpcode;
|
} InstructionOpcode;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
// General purpose registers
|
||||||
REG_A, REG_B, REG_C,
|
REG_A, REG_B, REG_C,
|
||||||
|
|
||||||
|
// Function arguments
|
||||||
REG_X, REG_Y, REG_Z,
|
REG_X, REG_Y, REG_Z,
|
||||||
|
|
||||||
|
// Return value
|
||||||
REG_R,
|
REG_R,
|
||||||
|
|
||||||
|
// Flags
|
||||||
REG_F,
|
REG_F,
|
||||||
|
|
||||||
REG_MAX // all registers should come before this one, this is so we can
|
REG_MAX // all registers should come before this one, this is so we can
|
||||||
|
|||||||
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