initial commit

This commit is contained in:
2026-07-15 15:02:54 +10:00
commit 8e26d3e19d
8 changed files with 168 additions and 0 deletions

22
src/memory.h Normal file
View File

@@ -0,0 +1,22 @@
#pragma once
#include <stdint.h>
#include <stdlib.h>
#include "instruction.h"
#define MEM_CALL_STACK_OFFSET 0x00000FFF
#define MEM_PROGRAM_START 0x00001000
#define MEM_PROGRAM_END 0x0000FFFF
#define MEM_GP_START 0x00010000
// -- TYPES -- //
typedef struct {
uint32_t size;
uint8_t* data;
} Memory;
// -- FUNCTIONS -- //
Memory* initMemory(uint32_t size);
uint16_t memoryLoadWord(Memory* m, uint32_t address);
void memorySaveWord(Memory* m, uint32_t address, uint16_t value);
Instruction decodeInstruction(Memory* m, uint32_t pc);