forked from source-solutions/sebasic4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.inc
More file actions
1011 lines (874 loc) · 19.9 KB
/
Copy pathbasic.inc
File metadata and controls
1011 lines (874 loc) · 19.9 KB
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; // SE Basic IV 4.2 Cordelia - A classic BASIC interpreter for the Z80 architecture.
; // Copyright (c) 1999-2024 Source Solutions, Inc.
; // SE Basic IV is free software: you can redistribute it and/or modify
; // it under the terms of the GNU General Public License as published by
; // the Free Software Foundation, either version 3 of the License, or
; // (at your option) any later version.
; //
; // SE Basic IV is distributed in the hope that it will be useful,
; // but WITHOUT ANY WARRANTY; without even the implied warranty o;
; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; // GNU General Public License for more details.
; //
; // You should have received a copy of the GNU General Public License
; // along with SE Basic IV. If not, see <http://www.gnu.org/licenses/>.
;;
; // X80 maths co-processor instruction set (requires macro support)
;;
:
; // never called directly:
; //
; // ftop
; // fbor
; // fband
; // fbands
; // fcps (6 opcodes)
; // fvals
; // fread
; // fasc
; // fval
; // flen
; // ftan
; // facos
; // fexp
; // fsgn
; // fpeek
; // fin
; // fusr
; // fstrs
; // fetof
; // parameter definitions
;;
; X80 parameter: less than or equal
;;
le equ 0;
;;
; X80 parameter: greater or equal
;;
ge equ 1;
;;
; X80 parameter: not equal
;;
ne equ 2;
;;
; X80 parameter: greater than
;;
gt equ 3;
;;
; X80 parameter: less than
;;
lt equ 4;
;;
; X80 parameter: equal
;;
eq equ 5;
;;
; X80 parameter: less than zero
;;
lz equ $2d;
;;
; X80 parameter: greater than zero
;;
gz equ $2e;
; // instruction macros
;;
; X80 op-code: CPU wait
;;
MACRO fwait;
rst $28;
ENDM
;;
; X80 op-code: jump if true
;;
MACRO fjpt n;
defb op_fjpt, {n} - $ - 1;
ENDM
;;
; X80 op-code: exchange
;;
MACRO fxch;
defb op_fxch;
ENDM
;;
; X80 op-code: delete
;;
MACRO fdel;
defb op_fdel;
ENDM
;;
; X80 op-code: subtract
;;
MACRO fsub;
defb op_fsub;
ENDM
;;
; X80 op-code: multiply
;;
MACRO fmul;
defb op_fmul;
ENDM
;;
; X80 op-code: divide
;;
MACRO fdiv;
defb op_fdiv;
ENDM
;;
; X80 op-code: to power
;;
MACRO ftop;
defb op_ftop;
ENDM
;;
; X80 op-code: binary OR
;;
MACRO fbor;
defb op_fbor;
ENDM
;;
; X80 op-code: binary AND
;;
MACRO fband;
defb op_fband;
ENDM
;;
; X80 op-code: compare
; @param eq, <code>ge</code>, <code>gt</code>, <code>gz</code>, <code>lt</code>, <code>lz</code>, <code>ne</code>
;;
MACRO fcp n;
defb op_fcp + {n}
ENDM
;;
; X80 op-code: add
;;
MACRO fadd;
defb op_fadd;
ENDM
;;
; X80 op-code: binary and string
;;
MACRO fbands;
defb op_bands;
ENDM
;;
; X80 op-code: compare string
; @param eq, <code>ge</code>, <code>gt</code>, <code>gz</code>, <code>lt</code>, <code>lz</code>, <code>ne</code>
;;
MACRO fcps n;
defb op_fcps + {n};
ENDM
;;
; X80 op-code: concatenate string
;;
MACRO fcat;
defb op_fcat;
ENDM
;;
; X80 op-code: value string
;;
MACRO fvals;
defb op_fvals;
ENDM
;;
; X80 op-code: string by number multiplication
;;
MACRO fmuls;
defb op_fmuls;
ENDM
;;
; X80 op-code: read in
;;
MACRO fread;
defb op_fread;
ENDM
;;
; X80 op-code: negate
;;
MACRO fneg;
defb op_fneg;
ENDM
;;
; X80 op-code: character to ASCII
;;
MACRO fasc;
defb op_fasc;
ENDM
;;
; X80 op-code: value
;;
MACRO fval;
defb op_fval;
ENDM
;;
; X80 op-code: length of string
;;
MACRO flen;
defb op_flen;
ENDM
;;
; X80 op-code: sine
;;
MACRO fsin;
defb op_fsin;
ENDM
;;
; X80 op-code: cosine
;;
MACRO fcos;
defb op_fcos;
ENDM
;;
; X80 op-code: tangent
;;
MACRO ftan;
defb op_ftan;
ENDM
;;
; X80 op-code: arcsine
;;
MACRO fasin;
defb op_fasin;
ENDM
;;
; X80 op-code: arc-cosine
;;
MACRO facos;
defb op_facos;
ENDM
;;
; X80 op-code: arctangent
;;
MACRO fatan;
defb op_fatan;
ENDM
;;
; X80 op-code: natural logarithm
;;
MACRO flogn;
defb op_flogn;
ENDM
;;
; X80 op-code: exponential
;;
MACRO fexp;
defb op_fexp;
ENDM
;;
; X80 op-code: integer (rounded down)
;;
MACRO fint;
defb op_fint;
ENDM
;;
; X80 op-code: square root
;;
MACRO fsqrt;
defb op_fsqrt;
ENDM
;;
; X80 op-code: signum
;;
MACRO fsgn;
defb op_fsgn;
ENDM
;;
; X80 op-code: absolute value
;;
MACRO fabs;
defb op_fabs;
ENDM
;;
; X80 op-code: PEEK
;;
MACRO fpeek;
defb op_fpeek;
ENDM
;;
; X80 op-code: IN
;;
MACRO finp;
defb op_finp;
ENDM
;;
; X80 op-code: user address
;;
MACRO fusr;
defb op_fusr;
ENDM
;;
; X80 op-code: string
;;
MACRO fstrs;
defb op_fstrs;
ENDM
;;
; X80 op-code: character
;;
MACRO fchrs;
defb op_fchrs;
ENDM
;;
; X80 op-code: NOT
;;
MACRO fnot;
defb op_fnot;
ENDM
;;
; X80 op-code: move
;;
MACRO fmove;
defb op_fmove;
ENDM
;;
; X80 op-code: modulus
;;
MACRO fmod;
defb op_fmod;
ENDM
;;
; X80 op-code: jump
; @param address to jump to
;;
MACRO fjp n;
defb op_fjp, {n} - $ - 1;
ENDM
;;
; X80 op-code: stack data
;;
MACRO fstk;
defb op_fstk;
ENDM
;;
; X80 op-code: decrement and jump if not zero
; @param address to jump to
;;
MACRO fdjnz n; // djnz
defb op_fdjnz, {n} - $ - 1;
ENDM
;;
; X80 op-code: less than zero
;;
MACRO fltz;
defb op_fltz;
ENDM
;;
; X80 op-code: greater than zero
;;
MACRO fgtz;
defb op_fgtz;
ENDM
;;
; X80 op-code: CPU enable
;;
MACRO fce;
defb op_fce;
ENDM
;;
; X80 op-code: get
;;
MACRO fget;
defb op_fget;
ENDM
;;
; X80 op-code: truncate
;;
MACRO ftrn;
defb op_ftrn;
ENDM
;;
; X80 op-code: single operation
;;
MACRO fsgl;
defb op_fsgl;
ENDM
;;
; X80 op-code: DEEK
;;
MACRO fdeek;
defb op_fdeek;
ENDM
;;
; X80 op-code: restack
;;
MACRO frstk;
defb op_frstk;
ENDM
;;
; X80 op-code: exclusive or
;;
MACRO fxor;
defb op_fxor;
ENDM
;;
; X80 op-code: integer quotient
;;
MACRO fquot;
defb op_fquot;
ENDM
;;
; X80 op-code: stack 0
;;
MACRO fstk0;
defb $a0;
ENDM
;;
; X80 op-code: stack 1
;;
MACRO fstk1;
defb $a1
ENDM
;;
; X80 op-code: stack half
;;
MACRO fstkhalf;
defb $a2
ENDM
;;
; X80 op-code: stack pi / 2
;;
MACRO fstkhalfpi;
defb $a3
ENDM
;;
; X80 op-code: stack 10
;;
MACRO fstk10;
defb $a4
ENDM
;;
; X80 op-code: store (mem 0 to 5)
;;
MACRO fst n;
defb $c0 + {n};
ENDM
;;
; X80 op-code: get (mem 0 to 5)
;;
MACRO fgt n;
defb $e0 + {n};
ENDM
; // miscellaneous
end_marker equ $80;
; // colors
black equ 0;
blue equ 1;
green equ 2;
cyan equ 3;
red equ 4;
magenta equ 5;
yellow equ 6;
white equ 7;
; // control keys
key_ins equ $00;
key_clr equ $01;
key_home equ $02;
key_end equ $03;
key_pg_up equ $04;
key_pg_dn equ $05;
key_caps equ $06;
key_tab equ $07;
key_left equ $08;
key_right equ $09;
key_down equ $0a;
key_up equ $0b;
key_backspace equ $0c;
key_return equ $0d;
key_koru equ $0e;
key_control equ $0f;
key_help equ $10;
key_delete equ $7f;
; // function keys
key_f1 equ $11
key_f2 equ $12
key_f3 equ $13
key_f4 equ $14
key_f5 equ $15
key_f6 equ $16
key_f7 equ $17
key_f8 equ $18
key_f9 equ $19
key_f10 equ $1a
key_f11 equ $1b
key_f12 equ $1c
key_f13 equ $1d
key_f14 equ $1e
key_f15 equ $1f
; // control characters
ctrl_bel equ $07;
ctrl_bs equ $08;
ctrl_ht equ $09;
ctrl_lf equ $0a;
ctrl_vt equ $0b;
ctrl_ff equ $0c;
ctrl_cr equ $0d;
ctrl_fs equ $1c;
ctrl_gs equ $1d;
ctrl_rs equ $1e;
ctrl_us equ $1f;
; // hidden number marker
number_mark equ $0e;
; // printable characters
pchr_copyright equ $00
pchr_euro equ $ff
; // operators
op_bin equ '%';
op_hex equ '$';
op_oct equ '@';
; // substitutes
sb_and equ '&'
sb_not equ '~'
sb_or equ '|'
sb_print equ '?'
; // i/o ports
stick equ $1f
mmu equ $f4
psg_tmxdat equ $f6
ula equ $fe
scld equ $ff
ulaplus_reg equ $bf3b
ulaplus_dat equ $ff3b
mouse_b equ $fadf
mouse_x equ $fbdf
mouse_y equ $ffdf
psg_anyreg equ $c0f5
paging equ $7ffd
psg_128reg equ $fffd
psg_128dat equ $bffd
; // restarts
start equ $00;
error equ $08;
divmmc equ $08;
print_a equ $10;
get_char equ $18;
next_char equ $20;
;calc equ $28;
bc_spaces equ $30;
mask_int equ $38;
; // command classes
no_f_ops equ $00;
var_rqd equ $01;
expr_num_str equ $02;
num_exp_0 equ $03;
chr_var equ $04;
var_syn equ $05;
num_exp equ $06;
num_exp_no_f_ops equ $07;
two_c_s_num equ $08;
two_c_s_num_no_f_ops equ $09;
str_exp equ $0a;
str_exp_no_f_ops equ $0b;
; // frame buffer
bit_map equ $c000
char_map equ $d800
tstack equ $dfc0
pal_map equ $dfc0
attr_map equ $e000
font equ $f800
; // keyboard buffer
k_buff equ $5b00;
k_buff_sz equ %01111111; // 128 bytes
; // system variables
oldsp equ $5bba; // (iy - $80) old stack pointer
flagp equ open_x - 1; // (iy - $44) flags for PLAY command
open_x equ mstate - 2; // (iy - $43) address of custom OPEN routine
mstate equ jstate - 4; // (iy - $41) mouse state
jstate equ k_head - 1; // (iy - $3d) joystick state
k_head equ k_tail - 1; // (iy - $3c) pointer to head of keyboard buffer
k_tail equ kstate - 1; // (iy - $3b) pointer to tail of keyboard buffer
kstate equ $5c00; // (iy - $3a) key state 0 to 3
kstate_4 equ kstate + 4; // (iy - $36) key state 4 to 7
repdel equ kstate + 8; // (iy - $32) time in seconds (50th PAL / 60th NTSC) before key repeats
repper equ repdel + 1; // (iy - $31) delay in seconds (50th PAL / 60th NTSC) between key repeats
defadd equ repper + 1; // (iy - $30) address of arguments during user defined funciton evaluation
defadd_h equ defadd + 1; // (iy - $2f) high byte of defadd
onerr equ defadd + 2; // (iy - $2e) line to jump to on error
onerr_h equ onerr + 1; // (iy - $2d) high byte of onerr
maskadd equ onerr + 2; // (iy - $2c) address of custom IM1 rotuine
strms equ maskadd + 2; // (iy - $2a) address of channels attached to streams
strms_fe equ strms + 2; // (iy - $28)
strms_ff equ strms + 4; // (iy - $26)
strms_00 equ strms + 6; // (iy - $24)
strms_01 equ strms + 8; // (iy - $22)
strms_02 equ strms + 10; // (iy - $20)
strms_03 equ strms + 12; // (iy - $1e)
strms_04 equ strms + 14; // (iy - $1c)
strms_05 equ strms + 16; // (iy - $1a)
strms_06 equ strms + 18; // (iy - $18)
strms_07 equ strms + 20; // (iy - $16)
strms_08 equ strms + 22; // (iy - $14)
strms_09 equ strms + 24; // (iy - $12)
strms_10 equ strms + 26; // (iy - $10)
strms_11 equ strms + 28; // (iy - $0e)
strms_12 equ strms + 30; // (iy - $0c)
strms_13 equ strms + 32; // (iy - $0a)
strms_14 equ strms + 34; // (iy - $08)
strms_15 equ strms + 36; // (iy - $06)
seg equ strms + 38; // (iy - $04) RESERVED (word)
rasp equ seg + 2; // (iy - $02) RESERVED
pip equ rasp + 1; // (iy - $01) RESERVED
err_nr equ pip + 1; // (iy + $00) error number
flags equ err_nr + 1; // (iy + $01) first flags byte
flg_space equ 0; // set to suppress a leading space
; // 1: RESERVED (set if ZX Printer is in use)
; // 2: RESERVED (1='L' mode, 0='K' mode. temporary value)
; // 3: RESERVED (1='L' mode, 0='K' mode)
; // 4: RESERVED (1=128 BASIC, 0=48 BASIC)
flg_macro equ 5; // set unless macros enabled
flg_num equ 6; // set if scanning result is numeric
flg_syntax equ 7; // set unless checking syntax
vdu_flag equ flags + 1; // (iy + $02) display flags
flg_lower equ 0; // set if lower screen in use
; // 1: RESERVED
; // 2: RESERVED
flg_edit equ 3; // set if editing a line
flg_auto equ 4; // set if automatic listing required
flg_cl_low equ 5; // set if lower screen to be cleared
; // 6: RESERVED
; // 7: RESERVED
err_sp equ vdu_flag + 1; // (iy + $03) SP value to use when an error occurs
list_sp equ err_sp + 2; // (iy + $05) SP value to use when an automatic list fills the screen
mode equ list_sp + 2; // (iy + $07) cursor mode; lower, caps, alternate or control
newppc equ mode + 1; // (iy + $08) new line to jump to
nsppc equ newppc + 2; // (iy + $0a) new statement to jump to, or $ff
ppc equ nsppc + 1; // (iy + $0b) current line number during program execution
subppc equ ppc + 2; // (iy + $0d) current statement number
bordcr equ subppc + 1; // (iy + $0e) border color in screen 1
e_ppc equ bordcr + 1; // (iy + $0f) number of line with > cursor
e_ppc_h equ e_ppc + 1; // (iy + $10)
vars equ e_ppc + 2; // (iy + $11) address of variables
dest equ vars + 2; // (iy + $13) used in variable assignments
chans equ dest + 2; // (iy + $15) start of channels area
curchl equ chans + 2; // (iy + $17) start of current channel
prog equ curchl + 2; // (iy + $19) program start (address of line number of first line)
nxtlin equ prog + 2; // (iy + $1b) address of next line in BASIC program
datadd equ nxtlin + 2; // (iy + $1d) data address used by READ command
e_line equ datadd + 2; // (iy + $1f) edit line start
k_cur equ e_line +2; // (iy + $21) address of cursor in the edit line
ch_add equ k_cur + 2; // (iy + $23) current character address
x_ptr equ ch_add + 2; // (iy + $25) address in the edit line of a syntax error
worksp equ x_ptr + 2; // (iy + $27) workspace start
stkbot equ worksp + 2; // (iy + $29) address of bottom of calculator stack
stkend equ stkbot + 2; // (iy + $2b) end of floating point calculator stack
stkend_h equ stkend + 1; // (iy + $2c)
breg equ stkend + 2; // (iy + $2d) calculator’s B register
mem equ breg + 1; // (iy + $2e) start of calculator’s memory area
flags2 equ mem + 2; // (iy + $30) second flag byte
flg_main equ 0; // set if main screen to be cleared
flg_screen equ 1; // set if screen 1 in use
flg_colon equ 2; // set if a ':' is within quotes
flg_caps equ 3; // set if caps lock on
flg_kchan equ 4; // set if 'K' channel is use
; // 5: RESERVED
; // 6: RESERVED
flg_trace equ 7; // set if trace enabled
df_sz equ flags2 + 1; // (iy + $31) number of lines (including one blank line) in the lower part of the screen
s_top equ df_sz + 1; // (iy + $32) line number of top line in an automatic listing
oldppc equ s_top + 2; // (iy + $34) line number that CONT goes to
osppc equ oldppc + 2; // (iy + $36) tatement number that CONT goes to
flagx equ osppc + 1; // (iy + $37) flags for INPUT command and editor
flg_str equ 0; // set if handling a simple string
flg_var equ 1; // set if handling a new variable
; // 2: RESERVED
; // 3: RESERVED
; // 4: RESERVED
flg_inp equ 5; // set if in input mode
; // 6: RESERVED
flg_line equ 7; // set if handling INPUT LINE
strlen equ flagx + 1; // (iy + $38) length of string type destination in assignment
t_addr equ strlen + 2; // (iy + $3a) address of next item in syntax table
seed equ t_addr + 2; // (iy + $3c) seed for RND (set by RANDOMIZE)
frame equ seed + 2; // (iy + $3e) cuurent frame (0-49 PAL / 0-59 NTSC)
time_t equ frame + 1; // (iy + $3f) POSIX time (unsigned)
coords equ time_t + 4; // (iy + $43) pixel co-ordinates
coord_y equ time_t + 4; // (iy + $43) y pixel co-ordinate (0-255)
coord_x equ coord_y + 1; // (iy + $44) x pixel co-ordinate (0-65535)
nmiadd equ coord_x + 2; // (iy + $46) address to jump to on NMI
echo_e equ nmiadd + 2; // (iy + $48) column number and line number (in lower half) of end of input buffer
df_cc equ echo_e + 2; // (iy + $4a) address in display file of upper window PRINT position
df_ccl equ df_cc + 2; // (iy + $4c) address in display file of lower window PRINT position
s_posn equ df_ccl + 2; // (iy + $4e) upper window position as column/row
s_posn_h equ s_posn + 1; // (iy + $4f)
sposnl equ s_posn + 2; // (iy + $50) lower window position as column/row
sposnl_h equ sposnl + 1; // (iy + $51)
scr_ct equ sposnl + 2; // (iy + $52) counter used to give “Scroll?” prompt
attr_p equ scr_ct + 1; // (iy + $53) attributes (foregorund and background in screen 0 or attribute byte in screen 1)
mask_p equ attr_p + 1; // (iy + $54) RESERVED
attr_t equ mask_p + 1; // (iy + $55) RESERVED
mask_t equ attr_t + 1; // (iy + $56) RESERVED
p_flag equ mask_t + 1; // (iy + $57) print flag
flg_over equ 0; // set if OVER in use
; // 1: RESERVED
flg_inv equ 2; // set if INVERSE in use
; // 3: RESERVED
; // 4: RESERVED
; // 5: RESERVED
; // 6: RESERVED
; // 7: RESERVED
membot equ p_flag + 1; // (iy + $58) calculator’s memory area
mem_0_1 equ membot + 1; // (iy + $59)
mem_0_2 equ membot + 2; // (iy + $5a)
mem_0_3 equ membot + 3; // (iy + $5b)
mem_0_4 equ membot + 4; // (iy + $5c)
mem_1 equ membot + 5; // (iy + $5d)
mem_1_1 equ membot + 6; // (iy + $5e)
mem_1_2 equ membot + 7; // (iy + $5f)
mem_1_3 equ membot + 8; // (iy + $60)
mem_1_4 equ membot + 9; // (iy + $61)
mem_2 equ membot + 10; // (iy + $62)
mem_2_1 equ membot + 11; // (iy + $63)
mem_2_2 equ membot + 12; // (iy + $64)
mem_2_3 equ membot + 13; // (iy + $65)
mem_2_4 equ membot + 14; // (iy + $66)
mem_3 equ membot + 15; // (iy + $67)
mem_3_1 equ membot + 15; // (iy + $68)
mem_3_2 equ membot + 17; // (iy + $69)
mem_3_3 equ membot + 18; // (iy + $6a)
mem_3_4 equ membot + 19; // (iy + $6b)
mem_4 equ membot + 20; // (iy + $6c)
mem_4_1 equ membot + 21; // (iy + $6d)
mem_4_2 equ membot + 22; // (iy + $6e)
mem_4_3 equ membot + 23; // (iy + $6f)
mem_4_4 equ membot + 24; // (iy + $70)
mem_5 equ membot + 25; // (iy + $71)
mem_5_1 equ membot + 26; // (iy + $72)
mem_5_2 equ membot + 27; // (iy + $73)
mem_5_3 equ membot + 28; // (iy + $74)
mem_5_4 equ membot + 29; // (iy + $75)
dosvar equ membot + 30; // (iy + $76) used by the operating system
ramtop equ dosvar + 2; // (iy + $78) address of last byte of BASIC system area
p_ramt equ ramtop + 2; // (iy + $7a) address of last byte of physical RAM
channels equ p_ramt + 2; // (iy + $7c) start of channels data
; // system variable IY offsets
; // negative
_oldsp equ $80;
_flagp equ $44;
_open_x equ $43;
_mstate equ $41;
_jstatew equ $3d;
_k_head equ $3c;
_k_tail equ $3b;
_kstate equ $3a;
_kstate_4 equ $36;
_repdel equ $32;
_repper equ $31;
_defadd equ $30;
_defadd_h equ $2f;
_onerr equ $2e;
_onerr_h equ $2d;
_maskadd equ $2c;
_strms equ $2a;
_strms_fe equ $28;
_strms_ff equ $26;
_strms_00 equ $24;
_strms_01 equ $22;
_strms_02 equ $20;
_strms_03 equ $1e;
_strms_04 equ $1c;
_strms_05 equ $1a;
_strms_06 equ $18;
_strms_07 equ $16;
_strms_08 equ $14;
_strms_09 equ $12;
_strms_10 equ $10;
_strms_11 equ $0e;
_strms_12 equ $0c;
_strms_13 equ $0a;
_strms_14 equ $08;
_strms_15 equ $06;
_seg equ $04;
_rasp equ $02;
_pip equ $01;
; // positive
_err_nr equ $00;
_flags equ $01;
_vdu_flag equ $02;
_err_sp equ $03;
_list_sp equ $05;
_mode equ $07;
_newppc equ $08;
_nsppc equ $0a;
_ppc equ $0b;
_subppc equ $0d;
_bordcr equ $0e;
_e_ppc equ $0f;
_e_ppc_h equ $10;
_vars equ $11;
_dest equ $13;
_chans equ $15;
_curchl equ $17;
_prog equ $19;
_nxtlin equ $1b;
_datadd equ $1d;
_e_line equ $1f;
_k_cur equ $21;
_k_cur_h equ $22;
_ch_add equ $23;
_x_ptr equ $25;
_x_ptr_h equ $26;
_worksp equ $27;
_stkbot equ $29;
_stkend equ $2b;
_stkend_h equ $2c;
_breg equ $2d;
_mem equ $2e;
_flags2 equ $30;
_df_sz equ $31;
_s_top equ $32;
_oldppc equ $34;
_osppc equ $36;
_flagx equ $37;
_strlen equ $38;
_t_addr equ $3a;
_seed equ $3c;
_frame equ $3e;
_time_t equ $3f;
_coord_y equ $43;
_coord_x equ $44;
_nmiadd equ $46;
_echo_e equ $48;
_df_cc equ $4a;
_df_ccl equ $4c;
_s_posn equ $4e;
_s_posn_h equ $4f;
_sposnl equ $50;
_sposnl_h equ $51;
_scr_ct equ $52;
_attr_p equ $53;
_mask_p equ $54;
_attr_t equ $55;
_mask_t equ $56;
_p_flag equ $57;
_membot equ $58;
_mem_0_1 equ $59;
_mem_0_2 equ $5a;
_mem_0_3 equ $5b;
_mem_0_4 equ $5c;
_mem_1 equ $5d;
_mem_1_1 equ $5e;
_mem_1_2 equ $5f;
_mem_1_3 equ $60;
_mem_1_4 equ $61;
_mem_2 equ $62;
_mem_2_1 equ $63;
_mem_2_2 equ $64;
_mem_2_3 equ $65;
_mem_2_4 equ $66;
_mem_3 equ $67;
_mem_3_1 equ $68;
_mem_3_2 equ $69;
_mem_3_3 equ $6a;
_mem_3_4 equ $6b;
_mem_4 equ $6c;
_mem_4_1 equ $6d;
_mem_4_2 equ $6e;