From c8347b515a6428b2660bde99412dce311a162534 Mon Sep 17 00:00:00 2001 From: crc Date: Thu, 22 Nov 2018 02:01:52 +0000 Subject: [PATCH] update the pascal implementation to support new instructions FossilOrigin-Name: 96de198c5eb91ba70cba3e7e9b9bcb99374cefe2b54e3f44e2bef8af1ac96c4a --- interfaces/pascal/nga.inc | 3 ++- interfaces/pascal/nga.pas | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/interfaces/pascal/nga.inc b/interfaces/pascal/nga.inc index 9bd4a1a..d228e7e 100644 --- a/interfaces/pascal/nga.inc +++ b/interfaces/pascal/nga.inc @@ -1,5 +1,6 @@ // ******************************************************** // Copyright (c) 2016 Rob Judd +// Copyright (c) 2018 Charles Childers // Based on C version by Charles Childers et al // ISC License - see included file LICENSE // ******************************************************** @@ -11,7 +12,7 @@ const STACK_DEPTH = 32; ADDRESSES = 128; IMAGE_SIZE = 524288; - NUM_OPS = 27; + NUM_OPS = 30; {$define TOS := data[sp]} {$define NOS := data[sp-1]} diff --git a/interfaces/pascal/nga.pas b/interfaces/pascal/nga.pas index 50c515b..1de23e9 100644 --- a/interfaces/pascal/nga.pas +++ b/interfaces/pascal/nga.pas @@ -1,5 +1,6 @@ // ******************************************************** // Copyright (c) 2016 Rob Judd +// Copyright (c) 2018 Charles Childers // Based on C version by Charles Childers et al // ISC License - see included file LICENSE // ******************************************************** @@ -284,6 +285,27 @@ begin ip := IMAGE_SIZE - 1; end; +procedure inst_in(); +begin + inc(sp); + TOS := 1; +end; + +procedure inst_iq(); +begin + TOS := 0; + inc(sp); + TOS := 0; +end; + +procedure inst_ii(); +begin + inst_drop(); + write(Char(data[sp])); + dec(sp); +end; + + procedure ngaProcessOpcode(opcode : Cell); begin case opcode of @@ -314,6 +336,9 @@ begin 24 : inst_shift(); 25 : inst_zret(); 26 : inst_end(); + 27 : inst_in(); + 28 : inst_iq(); + 29 : inst_ii(); end; end;