mirror of
https://github.com/pnx/m16vm
synced 2026-06-25 10:33:41 +02:00
src/cpu.c: remove the old static variables that exists in struct cpu_state from now on.
This commit is contained in:
parent
0fcfa253c1
commit
6256fa7512
1 changed files with 1 additions and 9 deletions
10
src/cpu.c
10
src/cpu.c
|
|
@ -31,16 +31,8 @@
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "instr_decode.h"
|
#include "instr_decode.h"
|
||||||
|
|
||||||
/* Program */
|
|
||||||
unsigned char *instr_mem = NULL;
|
|
||||||
unsigned long instr_cnt = 0;
|
|
||||||
|
|
||||||
/* Program counter */
|
|
||||||
uint16_t pc = 0;
|
|
||||||
|
|
||||||
/* CPU flags */
|
/* CPU flags */
|
||||||
#define CPU_FLAGS_HALT (1<<0)
|
#define CPU_FLAGS_HALT (1<<0)
|
||||||
unsigned char cpu_flags = CPU_FLAGS_HALT;
|
|
||||||
|
|
||||||
#define debug(...) fprintf(stderr, __VA_ARGS__)
|
#define debug(...) fprintf(stderr, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
@ -126,7 +118,7 @@ void cpu_instr_unload(struct cpu_state *state) {
|
||||||
|
|
||||||
void cpu_set_pc(struct cpu_state *state, uint16_t addr) {
|
void cpu_set_pc(struct cpu_state *state, uint16_t addr) {
|
||||||
|
|
||||||
if (addr > instr_cnt / 2) {
|
if (addr > state->instr_cnt / 2) {
|
||||||
fprintf(stderr, "Runtime error: Invalid instruction address %ui\n", addr);
|
fprintf(stderr, "Runtime error: Invalid instruction address %ui\n", addr);
|
||||||
state->flags |= CPU_FLAGS_HALT;
|
state->flags |= CPU_FLAGS_HALT;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue