From bc97f5bd79a54a712c5d4e91001a62e76a1a4d10 Mon Sep 17 00:00:00 2001 From: lux Date: Thu, 17 Aug 2017 20:50:36 +0200 Subject: [PATCH] Follow 12 BIT address bus. --- src/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index c65f215..53e8795 100644 --- a/src/main.c +++ b/src/main.c @@ -42,7 +42,8 @@ int main(int argc, char *argv[]) //CPU control flow if(execute(op_code,data_addr,ram)) //EXECUTE instruction, jump if ALU says pc=find_data(ram[pc]); - else pc++; + else pc++; + if(pc>4095) pc = pc % 4096; //TOY can only address 12 Bit //Handele user output printf("PROGRAM COUNTER: %" PRIu16 "\n",pc);