-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathcode9
200 lines (200 loc) · 2.26 KB
/
code9
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
.PAG 'CODE9'
BMI DOCSTR
BCS CHKERR
CHKOK RTS
DOCSTR BCS CHKOK
CHKERR LDX #ERRTM
ERRGO4 JMP ERROR
FRMEVL LDX TXTPTR
BNE FRMEV1
DEC TXTPTR+1
FRMEV1 DEC TXTPTR
LDX #0
.BYT $24
LPOPER PHA
TXA
PHA
LDA #1
JSR GETSTK
JSR EVAL
LDA #0
STA OPMASK
TSTOP JSR CHRGOT
LOPREL SEC
SBC #GREATK
BCC ENDREL
CMP #LESSTK-GREATK+1
BCS ENDREL
CMP #1
ROL A
EOR #1
EOR OPMASK
CMP OPMASK
BCC SNERR5
STA OPMASK
JSR CHRGET
JMP LOPREL
ENDREL LDX OPMASK
BNE FINREL
BCS QOP
ADC #GREATK-PLUSTK
BCC QOP
ADC VALTYP
BNE *+5
JMP CAT
ADC #$FF
STA INDEX1
ASL A
ADC INDEX1
TAY
QPREC PLA
CMP OPTAB,Y
BCS QCHNUM
JSR CHKNUM
DOPREC PHA
NEGPRC JSR DOPRE1
PLA
LDY OPPTR
BPL QPREC1
TAX
BEQ QOPGO
BNE PULSTK
FINREL LSR VALTYP
TXA
ROL A
LDX TXTPTR
BNE FINRE2
DEC TXTPTR+1
FINRE2 DEC TXTPTR
LDY #PTDORL-OPTAB
STA OPMASK
BNE QPREC
QPREC1 CMP OPTAB,Y
BCS PULSTK
BCC DOPREC
DOPRE1 LDA OPTAB+2,Y
PHA
LDA OPTAB+1,Y
PHA
JSR PUSHF1
LDA OPMASK
JMP LPOPER
SNERR5 JMP SNERR
PUSHF1 LDA FACSGN
LDX OPTAB,Y
PUSHF TAY
PLA
STA INDEX1
PLA
STA INDEX1+1
TYA
PHA
INC INDEX1
BNE FORPSH
INC INDEX1+1
FORPSH JSR ROUND
LDA FACLO
PHA
LDA FACMO
PHA
LDA FACMOH
PHA
LDA FACHO
PHA
LDA FACEXP
PHA
JMP (INDEX1)
QOP LDY #255
PLA
QOPGO BEQ QOPRTS
QCHNUM CMP #100
BEQ UNPSTK
JSR CHKNUM
UNPSTK STY OPPTR
PULSTK PLA
LSR A
STA DOMASK
PLA
STA ARGEXP
PLA
STA ARGHO
PLA
STA ARGMOH
PLA
STA ARGMO
PLA
STA ARGLO
PLA
STA ARGSGN
EOR FACSGN
STA ARISGN
QOPRTS LDA FACEXP
UNPRTS RTS
EVAL LDA #0
STA VALTYP
EVAL0 JSR CHRGET
BCS EVAL2
EVAL1 JMP FIN
EVAL2 JSR ISLETC
BCS LBF0D
CMP #PI
BNE QDOT
LDA #<PIVAL
LDY #>PIVAL
JSR MOVFM
JMP CHRGET
PIVAL .BYT @202
.BYT @111
.BYT @017
.BYT @332
.BYT @241
QDOT CMP #'.
BEQ EVAL1
CMP #MINUTK
BEQ DOMIN
CMP #PLUSTK
BEQ EVAL0
CMP #34
BNE EVAL3
STRTXT LDA TXTPTR
LDY TXTPTR+1
ADC #0
BCC STRTX2
INY
STRTX2 JSR STRLIT
JMP ST2TXT
EVAL3 CMP #NOTTK
BNE EVAL4
LDY #24
BNE GONPRC
NOTOP JSR AYINT
LDA FACLO
EOR #255
TAY
LDA FACMO
EOR #255
JMP GIVAYF
EVAL4 CMP #FNTK
BNE *+5
JMP FNDOER
CMP #ONEFUN
BCC PARCHK
JMP ISFUN
PARCHK JSR CHKOPN
JSR FRMEVL
CHKCLS LDA #41
.BYT $2C
CHKOPN LDA #40
.BYT $2C
CHKCOM LDA #44
SYNCHR LDY #0
CMP (TXTPTR)Y
BNE SNERR
JMP CHRGET
SNERR LDX #ERRSN
JMP ERROR
DOMIN LDY #21
GONPRC PLA
PLA
JMP NEGPRC
.FIL PATCH