dsforth: moved various word groups to separate includes
[urasm.git] / dsforth / main_hldef.zas
blobc78f00474c62453ddd9c3f399d1dd81b37d756d7
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; high-level definition words
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 $FORTH_WORD : IMM
6 ;; AberSoft
7   ?EXEC !CSP CURRENT @ CONTEXT ! CREATE ]
8   (;CODE)
9 $FORTH_END_WORD :
10 _doforth:
11   ld    hl,(f_curRP)
12   dec   hl
13   ld    (hl),b
14   dec   hl
15   ld    (hl),c
16   ld    (f_curRP),hl
17   inc   de
18   ld    c,e
19   ld    b,d
20 _doforth_dbg:
21   jp    i_next
23 $FORTH_WORD ; IMM
24 ;; AberSoft
25   ?CSP COMPILE ;S
26   SMUDGE [ ;S
27 $FORTH_END_WORD ;
29 $FORTH_WORD CONSTANT
30 ;; AberSoft
31   CREATE SMUDGE ,
32   (;CODE)
33 $FORTH_END_WORD CONSTANT
34 _doconst:
35   inc   de
36   ex    de,hl
37   ld    e,(hl)
38   inc   hl
39   ld    d,(hl)
40 doxvarx:
41   push  de
42   jp    i_next
44 $FORTH_WORD VARIABLE
45 ;; AberSoft
46   CONSTANT (;CODE)
47 $FORTH_END_WORD VARIABLE
48 _dovar:
49   inc   de
50   jr    doxvarx
52 $FORTH_WORD 2CONSTANT
53 ;; AberSoft
54   CREATE SMUDGE HERE 2! 4 ALLOT
55   (;CODE)
56 $FORTH_END_WORD 2CONSTANT
57 _do2const:
58   inc   de
59   ex    de,hl
60   inc   hl
61   inc   hl
62   ld    e,(hl)
63   inc   hl
64   ld    d,(hl)
65   push  de
66   dec   hl
67   dec   hl
68   ld    d,(hl)
69   dec   hl
70   ld    e,(hl)
71   jr    doxvarx
73 $FORTH_WORD 2VARIABLE
74 ;; AberSoft
75   2CONSTANT
76   (;CODE)
77 $FORTH_END_WORD 2VARIABLE
78 _do2var:
79   jr    _dovar
80 ;;  INC  DE
81 ;;  PUSH DE
82 ;;  JP   i_next
84 $FORTH_WORD USER
85 ;; AberSoft
86   CONSTANT (;CODE)
87 $FORTH_END_WORD USER
88 _douser:
89   inc   de
90   ex    de,hl
91   ld    e,(hl)
92   ld    d,0
93   push  ix
94   pop   hl
95   add   hl,de
96   jp    i_pushhl
99 $FORTH_WORD (;CODE)
100 ;; AberSoft
101   R> LATEST PFA CFA ! ;S
102 $FORTH_END_WORD (;CODE)
104 $FORTH_WORD ;CODE IMM
105 ;; AberSoft
106   ?CSP COMPILE (;CODE)
107   [ SMUDGE ;S
108 $FORTH_END_WORD ;CODE
110 $FORTH_WORD <BUILDS
111 ;; AberSoft
112   0 CONSTANT ;S
113 $FORTH_END_WORD <BUILDS
115 $FORTH_WORD DOES>
116 ;; AberSoft
117   R> LATEST PFA !
118   (;CODE)
119 $FORTH_END_WORD DOES>
120 _dodoes:
121   ld   hl,(f_curRP)
122   dec  hl
123   ld   (hl),b
124   dec  hl
125   ld   (hl),c
126   ld   (f_curRP),hl
127   inc  de
128   ex   de,hl
129   ld   c,(hl)
130   inc  hl
131   ld   b,(hl)
132   inc  hl
133   jp   i_pushhl
136 $FORTH_WORD CREATE
137 ;; AberSoft
138   -FIND 0BRANCH create0
139   DROP NFA ID. 4 MESSAGE SPACE
140 create0:
141   HERE DUP C@ WIDTH @ MIN 1+ ALLOT DUP
142   LIT #A0 TOGGLE HERE 1- LIT #80 TOGGLE
143   LATEST , CURRENT @ ! HERE 2+ , ;S
144 $FORTH_END_WORD CREATE