-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCOMPENT.4TH
61 lines (54 loc) · 1.29 KB
/
COMPENT.4TH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
( ----------------------------- )
( "compiled" comments by BartGo )
( for Atari 8-bit APX Forth )
( ----------------------------- )
( // is a modified word (.")
( but instead of printing, keeps
( the string in the dictionary
: // R COUNT DUP 1+ R> + >R
DROP DROP ;
( '( is a modified version of ."
( but using // instead of (.")
( and used to put the string
( into the dictionary
: '( STATE @ 0= IF
ASCII ) WORD ELSE
COMPILE // ASCII ) WORD HERE
C@ 1+ ALLOT
THEN ; IMMEDIATE
( ELIST is VLIST which prints the // comments
: ELIST '( enhanced VLIST: -- )
CR CONTEXT @ @ BEGIN
DUP DUP
PFA @ ' // CFA = IF ( // 1st )
DUP ID. ." // "
PFA 2+ COUNT TYPE CR
ELSE
ID. SPACE SPACE
THEN
PFA LFA @
DUP 0= ?TERMINAL OR
UNTIL DROP ;
SAVE COLD
;S
( test )
: -ROT '( backrot: a b c -- b c a ) ROT ROT ;
ELIST
;S
( side effect fixed below, otherwise )
( DECOMP would not work correctly! )
27 LOAD ( run manually )
25 LIST
EDITOR
8 P ( added // => compents BG '24 )
9 P : CKIT DUP ZBRAN = OVER BRAN = OR
10 P OVER PLOOP = OR OVER PPLOOP = OR
11 P IF BRNCH ELSE DUP .LIT = IF
12 P 1WORD ELSE DUP .CLIT = IF 1BYTE
13 P ELSE DUP PDOTQ = OVER ' // CFA
14 P = OR IF STG ELSE PWORD THEN
15 P THEN THEN THEN ; -->
FLUSH
21 LOAD ( run manually )
DECOMP -ROT
;S