From 89e61a3551ad1f86f4a3de89bb610a6136ec3da0 Mon Sep 17 00:00:00 2001 From: Erick Date: Thu, 27 Jan 2022 23:49:44 +0100 Subject: [PATCH] initialized memory and registers --- main.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 089f14d..1e2affc 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,28 @@ -#include //for macrps pf integer numbers +/* + TVM is a LC-3 based virtual machine used for educational purposes + Open-source software under MIT License + Written by Erick Ahmed, 2022 +*/ -/* Memory locations */ -uint16_t memory[UINT16_MAX] \ No newline at end of file +#include > + +/* Initializing 128kb of memory */ +uint16_t memory[UINT16_MAX]; + +/* Initializing 10 registers of which: +8 general purpose, 1 program counter, 1 conditional */ +enum { + R_GP0, + R_GP1, + R_GP2, + R_GP3, + R_GP4, + R_GP5, + R_GP6, + R_GP7, + R_PC = 0, + R_COND, + R_COUNT +}; + +uint16_t reg[R_COUNT]; \ No newline at end of file