-
Notifications
You must be signed in to change notification settings - Fork 1
/
LANG.f
130 lines (107 loc) · 1.48 KB
/
LANG.f
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{ LAST
T MOV AX, LAST
NT FPUSH AX }
{ STRCMP
T FPOP CX
NT FPOP BX
NT ADD CX, 2
NT ADD BX, 2
N STARTCMP:
NT MOV SI, CX
NT LODSB
NT MOV CX, SI
NT MOV DL, AL
NT MOV SI, BX
NT LODSB
NT MOV BX, SI
NT CMP AL, DL
NT JNZ NOTCMP
NT OR AL, AL
NT JZ ISCMP
NT JMP STARTCMP
N NOTCMP:
NT FPUSH 0
NT NEXT
N ISCMP:
NT FPUSH 1 }
{ FIND
T FPOP BX
NT SUB BX, 2
NT FPUSH BX
NT MOV AX, [LAST]
N STARTFIND:
NT MOV [NEXTSAVE], AX
NT FPUSH AX
NT FWORD SWAP
NT FWORD DUP
NT FWORD ROT
NT FWORD STRCMP
NT FPOP BX
NT OR BX, BX
NT JZ NEXTFIND
NT JMP FOUND
N NEXTFIND:
NT MOV AX, [NEXTSAVE]
NT MOV BX, AX
NT MOV AX, [BX]
NT OR AX, AX
NT JZ NOTFOUND
NT JMP STARTFIND
N FOUND:
NT FWORD DROP
NT MOV AX, [NEXTSAVE]
NT FPUSH AX
NT NEXT
N NOTFOUND:
NT FWORD DROP
NT MOV AX, 0
NT FPUSH AX
NT NEXT
N NEXTSAVE: dw 0 }
{ >CFA
T FPOP SI
NT LODSW
N CFASTART:
NT LODSB
NT OR AL, AL
NT JNZ CFASTART
NT FPUSH SI }
{ STRLEN
T FPOP SI
NT XOR BX, BX
NT MOV AL, byte [SI]
NT OR AL, AL
NT JZ ENDSTRLEN
N STRLENSTART:
NT LODSB
NT OR AL, AL
NT JZ ENDSTRLEN
NT INC BX
NT JMP STRLENSTART
N ENDSTRLEN:
NT FPUSH BX }
{ EXEC
T FPOP AX
NT MOV [CALLPLACE], AX
NT db 154
N CALLPLACE: dw 0
NT dw 0 }
{ PUSHVAL
T MOV AX, PUSHVAL
NT FPUSH AX }
: 1+! DUP @ 1 + SWAP ! ;
: 2+! DUP @ 2 + SWAP ! ;
: 1-! DUP @ 1 - SWAP ! ;
: 2-! DUP @ 2 - SWAP ! ;
: M> M ! &M 2+! ;
: >M &M 2-! M @ ;
: +! DUP @ SWAP M> + >M ;
: HERE! HERE ! &HERE 2+! ;
: HEREC! HERE C! &HERE 1+! ;
{ STATE
T MOV AX, STATEVAL
NT FPUSH AX
NT NEXT
N STATEVAL: dw 0 }
: [ 1 STATE ! ;
: ] 0 STATE ! ;