From db2bc37f1d5ebd2d5e4c9c42e5fa785f88c618f3 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sat, 17 Jun 2017 22:51:28 -0400 Subject: [PATCH] Release 0.0.8 --- CHANGELOG.org | 1 + High_level_prototypes/asm.c | 1 + High_level_prototypes/defs | 1 + High_level_prototypes/disasm.c | 5 +++++ ISA_HEX_Map.org | 13 +++++++++++++ vm.h | 1 + vm_decode.c | 11 +++++++++++ vm_instructions.c | 6 ++++++ 8 files changed, 39 insertions(+) diff --git a/CHANGELOG.org b/CHANGELOG.org index 146cbef..feca897 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -23,6 +23,7 @@ Added EXECUTE to stage2 forth Added ABORT to stage2 forth Added string print and address to output of High level prototype disassembler Added initial prototype library for forth developers who want better ANS support +Expanded stage0 VM Halcode to provide a way to lookup total amount of physical memory ** Changed Extended VPATH in makefile to shorten dependency names diff --git a/High_level_prototypes/asm.c b/High_level_prototypes/asm.c index c47118d..c0f5666 100644 --- a/High_level_prototypes/asm.c +++ b/High_level_prototypes/asm.c @@ -419,6 +419,7 @@ void assemble(struct Token* p) setExpression(p, "FSEEK", "42100004", 4); setExpression(p, "FGETC", "42100100", 4); setExpression(p, "FPUTC", "42100200", 4); + setExpression(p, "HAL_MEM", "42110000", 4); /* 0OP Group*/ setExpression(p, "NOP", "00000000", 4); diff --git a/High_level_prototypes/defs b/High_level_prototypes/defs index a7799ee..f3b2966 100644 --- a/High_level_prototypes/defs +++ b/High_level_prototypes/defs @@ -246,6 +246,7 @@ DEFINE REWIND 42100003 DEFINE FSEEK 42100004 DEFINE FGETC 42100100 DEFINE FPUTC 42100200 +DEFINE HAL_MEM 42110000 # 0OP Group DEFINE NOP 00000000 diff --git a/High_level_prototypes/disasm.c b/High_level_prototypes/disasm.c index a9025d1..32e1792 100644 --- a/High_level_prototypes/disasm.c +++ b/High_level_prototypes/disasm.c @@ -1368,6 +1368,11 @@ void decode_HALCODE(struct Instruction* c) strncpy(Name, "FPUTC", 19); break; } + case 0x110000: /* HAL_MEM */ + { + strncpy(Name, "HAL_MEM", 19); + break; + } default: /* Unknown HALCODE*/ { string_values(c); diff --git a/ISA_HEX_Map.org b/ISA_HEX_Map.org index f10b169..113544f 100644 --- a/ISA_HEX_Map.org +++ b/ISA_HEX_Map.org @@ -572,8 +572,21 @@ The following 3 devices must exist with the following exact IDs |-------------+----------| | 42 10 03 00 | Reserved | | ... | Reserved | +| 42 10 FF FF | Reserved | + +**** Device physical specifications +| Hex | Name | Comment | +|-------------+---------+------------------------------------------------------------------------------| +| 42 11 00 00 | HAL_MEM | Loads the total amount of physical Memory that is functional into register 0 | + +**** Reserved Block for Future HALCODE Expansion +| Hex | Name | +|-------------+----------| +| 42 12 00 00 | Reserved | +| ... | Reserved | | 42 FF FF FF | Reserved | + ** Reserved Block 1 At this time these instructions only produce a warning; but could do anything. DO NOT USE. diff --git a/vm.h b/vm.h index d85d657..fa7db5e 100644 --- a/vm.h +++ b/vm.h @@ -59,6 +59,7 @@ void vm_FSEEK(struct lilith* vm); void vm_REWIND(struct lilith* vm); void vm_FGETC(struct lilith* vm); void vm_FPUTC(struct lilith* vm); +void vm_HAL_MEM(struct lilith* vm); void ADD_CI(struct lilith* vm, struct Instruction* c); void ADD_CO(struct lilith* vm, struct Instruction* c); void ADD_CIO(struct lilith* vm, struct Instruction* c); diff --git a/vm_decode.c b/vm_decode.c index 6a93c8a..8e98f9c 100644 --- a/vm_decode.c +++ b/vm_decode.c @@ -283,6 +283,17 @@ bool eval_HALCODE(struct lilith* vm, struct Instruction* c) vm_FPUTC(vm); break; } + case 0x110000: /* HAL_MEM */ + { + #ifdef DEBUG + strncpy(Name, "HAL_MEM", 19); + #elif TRACE + record_trace("HAL_MEM"); + #endif + + vm_HAL_MEM(vm); + break; + } default: return true; } diff --git a/vm_instructions.c b/vm_instructions.c index 9aafae1..67f85fb 100644 --- a/vm_instructions.c +++ b/vm_instructions.c @@ -287,6 +287,12 @@ void vm_FPUTC(struct lilith* vm) } } +void vm_HAL_MEM(struct lilith* vm) +{ + vm->reg[0] = vm->amount_of_Ram; +} + + /* Condition Codes */ enum condition {