Add more CPU outputs for stdout.

This commit is contained in:
lux 2017-08-14 13:29:24 +02:00
parent c9b291ce38
commit 82aba5e133
2 changed files with 12 additions and 4 deletions

View File

@ -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++;

View File

@ -6,6 +6,7 @@
#include <stdbool.h>
#include <stdlib.h>
#define CPU_TYPE "Koopman_TOY_CPU"
#define RAM_SIZE 4096
#define CPU_WORD_SIZE 16