From 82aba5e133aa322469dc01ba408bc8076a7e1e79 Mon Sep 17 00:00:00 2001 From: lux Date: Mon, 14 Aug 2017 13:29:24 +0200 Subject: [PATCH] Add more CPU outputs for stdout. --- src/main.c | 15 +++++++++++---- src/toy.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index d284985..8587670 100644 --- a/src/main.c +++ b/src/main.c @@ -18,17 +18,24 @@ int main(int argc, char *argv[]) int quit='n'; bool run = true; + printf("\n+++++++++++++++++++++++++++++++++++++++++++\n+Boot: "CPU_TYPE + " wite %zu x %zu RAM.+\n+++++++++++++++++++++++++++++++++++++++++++\n\n" + ,(sizeof(ram)/sizeof(ram[0])),sizeof(ram[0])*8); + if(initialise_ram(ram,argc,argv)==-1) return 1; + while(run && pc<(RAM_SIZE-1)) { ir = ram[pc]; op_code = get_opcode(ir); data_addr=find_data(ir); - #ifdef DEBUG - printf("OP Code: %"PRIu8"\n",op_code); - printf("Adresse: %d\n",data_addr); - #endif + + printf("Inst: "); + fprintBits(sizeof(*ram), ram+pc,stdout); + printf("OP Code: %"PRIu8" ",op_code); + printf("Adresse: %d\n",data_addr); + if(execute(op_code,data_addr,ram)) pc=find_data(ram[pc]); //jump if ACCU is ZERO else pc++; diff --git a/src/toy.h b/src/toy.h index 469e337..ea79927 100644 --- a/src/toy.h +++ b/src/toy.h @@ -6,6 +6,7 @@ #include #include +#define CPU_TYPE "Koopman_TOY_CPU" #define RAM_SIZE 4096 #define CPU_WORD_SIZE 16