stack pointer and memsize
This commit is contained in:
@@ -51,7 +51,7 @@ int main(int argc, char** argv){
|
|||||||
}
|
}
|
||||||
|
|
||||||
trv_cpu cpu;
|
trv_cpu cpu;
|
||||||
cpu.mem = malloc(mem_size);
|
cpu.mem = malloc(cpu.mem_size = mem_size);
|
||||||
|
|
||||||
//file handling
|
//file handling
|
||||||
FILE* file = fopen(file_path, "rb");
|
FILE* file = fopen(file_path, "rb");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ typedef int16_t i16;
|
|||||||
typedef int32_t i32;
|
typedef int32_t i32;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
u32 regs[32], pc;
|
u32 regs[32], pc, mem_size;
|
||||||
u8* mem;
|
u8* mem;
|
||||||
}trv_cpu;
|
}trv_cpu;
|
||||||
|
|
||||||
@@ -174,6 +174,7 @@ void trv_step(trv_cpu* cpu){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void trv_init(trv_cpu* cpu){
|
void trv_init(trv_cpu* cpu){
|
||||||
|
cpu->regs[2] = trv_MEM_OFFSET + cpu->mem_size;
|
||||||
cpu->pc = trv_MEM_OFFSET;
|
cpu->pc = trv_MEM_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user