From 2077852173f68630ddecf14b6041105ffdbfe1c6 Mon Sep 17 00:00:00 2001 From: b1ackmai1er Date: Tue, 5 Oct 2021 21:42:42 +0800 Subject: [PATCH] Forth enhancements --- Source/Forth/camel80.azm | 5 ++++- Source/Forth/camel80r.azm | 44 +++++++++++++++++++++++++++++++++++++-- Source/Forth/glossw.txt | 12 +++++++++++ 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 Source/Forth/glossw.txt diff --git a/Source/Forth/camel80.azm b/Source/Forth/camel80.azm index a85639a9..c1a83e6b 100644 --- a/Source/Forth/camel80.azm +++ b/Source/Forth/camel80.azm @@ -76,7 +76,10 @@ HB_LOC EQU 0FD80h ; 22-Jan 21 v1.02 Adjust for revised HBIOS ; proxy size. ; b1ackmai1er difficultylevelhigh@gmail.com -; 07-Sep 21 v1.02 Separate additions. +; 07-Sep 21 v1.02 Separate additions. +; 05-Oct 21 v1.02 Add Douglas Beattie Jr.'s +; API call and port read and +; write words. ; =============================================== ; Macros to define Forth headers ; HEAD label,length,name,action diff --git a/Source/Forth/camel80r.azm b/Source/Forth/camel80r.azm index bd2989b4..edf33d52 100644 --- a/Source/Forth/camel80r.azm +++ b/Source/Forth/camel80r.azm @@ -30,9 +30,9 @@ ; Forth Core word set. Names in lower case are ; "internal" implementation words & extensions. ; =============================================== - +; ; DOUBLE PRECISION WORDS ================== - +; ;C D. d -- display d signed head DDOT,2,D.,docolon DW LESSNUM,DUP,TOR,DABS,NUMS @@ -101,4 +101,44 @@ tdiv1: ;C M*/ d1 n2 u3 -- d=(d1*n2)/u3 double precision mult. div head MSTARSLASH,3,M*/,docolon DW TOR,TSTAR,RFROM,TDIV,EXIT +; +; ROMWBW APPLICATION INTERFACE ================== +; +;C SVC ( hl de bc n -- hl de bc af ) +;execute ROMWBW API Call) + head API,3,API,docode + LD A,C + EXX + POP BC + POP DE + POP HL + RST 08 + PUSH HL + PUSH DE + PUSH BC + EXX + PUSH AF + POP BC + next +; +; BYTE INPUT/OUTPUT ================== +; +;C P! ( n p -- ) write byte n to i/o port p + + head PSTORE,2,P!!,docode +;; LD A,C ;save portnum in reg A +;; POP BC ;get datum +;; LD B,C ; xfer datum to reg B +;; LD C,A ;xfer portnum to reg C +;; OUT (C),B ;write byte to I/O port. + POP HL + OUT (C),L + POP BC ; get new TOS + next + +;C P@ ( p -- n ) read byte n from i/o port p + + head PFETCH,2,P@,docode + IN C,(C) ;simple stuff... + next diff --git a/Source/Forth/glossw.txt b/Source/Forth/glossw.txt new file mode 100644 index 00000000..f5c9e8c3 --- /dev/null +++ b/Source/Forth/glossw.txt @@ -0,0 +1,12 @@ + ROMWBW Extensions + +D. d -- display d signed +D+ d1 d2 -- d1+d2 Add double numbers +2>R d -- 2 to R +2R> d -- fetch 2 from R +M*/ d1 n2 u3 -- d=(d1*n2)/u3 + double precision mult. div +API hl de bc n -- hl de bc af + execute ROMWBW API Call +P! n p -- write byte n to i/o port p +P@ p -- n read byte n from i/o port p