1
0
Fork 0
mirror of https://github.com/pnx/m16vm synced 2026-06-16 03:44:55 +02:00

src/cpu.c: remove the old static variables that exists in struct cpu_state from now on.

This commit is contained in:
Henrik Hautakoski 2018-11-24 20:05:27 +01:00
parent 0fcfa253c1
commit 6256fa7512
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA

View file

@ -31,16 +31,8 @@
#include "syscall.h"
#include "instr_decode.h"
/* Program */
unsigned char *instr_mem = NULL;
unsigned long instr_cnt = 0;
/* Program counter */
uint16_t pc = 0;
/* CPU flags */
#define CPU_FLAGS_HALT (1<<0)
unsigned char cpu_flags = CPU_FLAGS_HALT;
#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) {
if (addr > instr_cnt / 2) {
if (addr > state->instr_cnt / 2) {
fprintf(stderr, "Runtime error: Invalid instruction address %ui\n", addr);
state->flags |= CPU_FLAGS_HALT;
return;