Files
MyLittleCPU/src/memory.h

23 lines
589 B
C
Raw Normal View History

2026-07-15 15:02:54 +10:00
#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);
2026-07-15 15:54:51 +10:00
void freeMemory(Memory* m);
2026-07-15 15:02:54 +10:00
uint16_t memoryLoadWord(Memory* m, uint32_t address);
void memorySaveWord(Memory* m, uint32_t address, uint16_t value);
2026-07-15 15:54:51 +10:00
Instruction decodeInstruction(Memory* m, uint32_t* pc);