Browse Source

Forth enhancements

pull/251/head
b1ackmai1er 4 years ago
parent
commit
2077852173
  1. 3
      Source/Forth/camel80.azm
  2. 44
      Source/Forth/camel80r.azm
  3. 12
      Source/Forth/glossw.txt

3
Source/Forth/camel80.azm

@ -77,6 +77,9 @@ HB_LOC EQU 0FD80h
; proxy size.
; b1ackmai1er difficultylevelhigh@gmail.com
; 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

44
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

12
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
Loading…
Cancel
Save