forked from microsoft/GW-BASIC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GWDATA.ASM
1566 lines (1451 loc) · 36.8 KB
/
GWDATA.ASM
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
; [ This translation created 10-Feb-83 by Version 4.3 ]
.RADIX 8 ; To be safe
CSEG SEGMENT PUBLIC 'CODESG'
ASSUME CS:CSEG
INCLUDE BINTRP.H
TITLE GWDATA copied from BINTRP.MAC
.RADIX 10
.XLIST
SLASHI=0 ;Runtime Switch to include IBM Compat.-Features
FETOK=0 ;For FE extended tokens
FDTOK=0 ;For FD tokens too. (Must have
;FETOK==1.)
;tokens.
INTDEX=0 ;For Intelledex version.
NMPAGE=1 ;Number of text pages (for GW
;Multi-page)
;KPOS, etc.
LNREAD=0 ;For LINE READ statement
MELCO=0 ;Mitsubishi Electronics Co.
SIRIUS=0
MCI=0
ZENITH=0 ;ZENITH 8086
TETRA=0
CPM86=0
HAL=0
GENFLS=0
PANDBL=0
TSHIBA=0
SGS=0
ALPS=0
ALPCPM=0
GENWID=0
NNECBS=0
CAN8=0
PC8A=0
FN2SW=0 ;IBMTOK versions dispatch from IBMRES.MAC
LABEL=PC8A
HLPEDT=PC8A
OKI=0
BUBL=0
NORNF=0
IEESLV=0
TRSHHC=0
OLVPPC=0
NECPPC=0
USA=0 ;For HHC-USA version
EUROPE=0 ;For HHC-EUROPE version
.LIST
;Local Switches
;
LTRACE=ALPCPM ;trace output selectable
LABEL=PC8A
HLPEDT=PC8A
UCEMSG=NNECBS ;Upper case error messages.
OLD86=MELCO AND CPM86 ;For "old" 8086 error messages (prior
;to alignment for IBM compatibility).
OLDBLD=ALPCPM OR ALPS OR OKI OR HAL OR PC8A OR BUBL OR GW OR TSHIBA
INCLUDE GIO86U
INCLUDE MSDOSU ;MSDOS constants
EXTRN _DVTBL:NEAR,_DVPTR:NEAR,_DVINI:NEAR,_DVTRM:NEAR
EXTRN INIT:NEAR,INTDIV:NEAR,CONCON:NEAR,CONCN2:NEAR
BUFOFS=0
BUFOFS=2 ;MUST CRUNCH INTO ERALIER PLACE FOR
; SINGLE QUOTE
KBFLEN=BUFLEN+(BUF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R
;
; This label must be the first one in the code segment as it is
; where the SYSTEM command will jump to
;
PUBLIC BEGCSG
BEGCSG:
PUBLIC CPMWRM
CPMWRM:
ORG 5O
PUBLIC CPMENT
CPMENT:
ORG 400O ; Leave room in the CS for OS control block
PUBLIC $START
$START:
PUBLIC START
START:
JMPINI: JMP INIT ;INIT IS THE INTIALIZATION ROUTINE
;IT SETS UP CERTAIN
;LOCATIONS DELETES FUNCTIONS IF
;DESIRED AND
;CHANGES THIS TO JMP READY
;IFE <I8086-1>!<LENGTH-2>,<> ;Seems to be a relic, screws up
;conditional nesting. 16-Feb-82/NGT
SUBTTL ROM VERSION INITALIZATION, AND CONSTANTS
;
; The reserved word tables are in another module. Consequently
; many things must be declared external. All of these things
; are in the code segement or are absolutes (like tokens).
; I.e., they are not in the data segment.
;
EXTRN ALPTAB:NEAR,ATNTK:NEAR
EXTRN CLINTK:NEAR
EXTRN EQULTK:NEAR,ERCTK:NEAR,ERLTK:NEAR
EXTRN FNTK:NEAR,FUNDSP:NEAR,STMDSP:NEAR
EXTRN GREATK:NEAR
EXTRN INSRTK:NEAR
EXTRN LESSTK:NEAR,LSTOPK:NEAR
EXTRN MIDTK:NEAR,MINUTK:NEAR
EXTRN NMREL:NEAR,NOTTK:NEAR,NUMCMD:NEAR
EXTRN ONEFUN:NEAR
EXTRN POS:NEAR,PLUSTK:NEAR,PRINT:NEAR
EXTRN RESLST:NEAR
EXTRN SNGQTK:NEAR,SPCTAB:NEAR,SQRTK:NEAR,STEPTK:NEAR
EXTRN THENTK:NEAR
EXTRN USRTK:NEAR
EXTRN $AUTO:NEAR
EXTRN $DATA:NEAR,$DATCO:NEAR,$DELETE:NEAR
EXTRN $EDIT:NEAR,$ELSE:NEAR,$END:NEAR,$ERL:NEAR,$ERROR:NEAR
EXTRN $FN:NEAR,$FOR:NEAR
EXTRN $GOSUB:NEAR,$GOTO:NEAR
EXTRN $IF:NEAR,$INKEY$:NEAR,$INPUT:NEAR
EXTRN $LIST:NEAR,$LLIST:NEAR
EXTRN $NEXT:NEAR
EXTRN $POINT:NEAR,$PRINT:NEAR
EXTRN $REM:NEAR,$REMCO:NEAR,$RENUM:NEAR,$RESTORE:NEAR,$RESUME:NEAR
EXTRN $RETURN:NEAR,$RND:NEAR,$RUN:NEAR
EXTRN $SCREEN:NEAR,$STOP:NEAR,$STRING$:NEAR
EXTRN $THEN:NEAR,$TO:NEAR
EXTRN $USR:NEAR
EXTRN $VARPTR:NEAR
EXTRN $WEND:NEAR,$WHILE:NEAR
ADRP MACRO X
ENDM
PUBLIC OPTAB
OPTAB: DB 121 ;OPERATOR TABLE CONTAINS
;PRECEDENCE FOLLOWED BY
;THE ROUTINE ADDRESS
ADRP FADDT
DB 121
ADRP FSUBT
DB 124
ADRP FMULTT
DB 124
ADRP FDIVT
DB 127
ADRP FPWRT
DB 80
ADRP ANDO
DB 70
ADRP ORO
DB 60 ;PRECEDENCE OF "XOR"
DB 50 ;PRECEDENCE OF "EQV"
DB 40 ;PRECEDENCE OF "IMP"
DB 122 ;PRECEDENCE OF "MOD"
DB 123 ;PRECEDENCE OF "IDIV"
;
; USED BY ASSIGNMENT CODE TO FORCE THE RIGHT HAND VALUE
; TO CORRESPOND TO THE VALUE TYPE OF THE VARIABLE BEING
; ASSIGNED TO.
;
PUBLIC FRCTBL
FRCTBL: ADR FRCDBL
DB 2 DUP(?)
ADR FRCINT
ADR CHKSTR
ADR FRCSNG
;
; THESE TABLES ARE USED AFTER THE DECISION HAS BEEN MADE
; TO APPLY AN OPERATOR AND ALL THE NECESSARY CONVERSION HAS
; BEEN DONE TO MATCH THE TWO ARGUMENT TYPES (APPLOP)
;
PUBLIC DBLDSP
DBLDSP: ADR DADD ;DOUBLE PRECISION ROUTINES
ADR DSUB
ADR DMULT
ADR DDIV
ADR DCOMP
PUBLIC OPCNT
OPCNT=(($-DBLDSP)/2)-1
PUBLIC SNGDSP
SNGDSP: ADR FADD ;SINGLE PRECISION ROUTINES
ADR FSUB
ADR FMULT
ADR FDIV
ADR FCOMP
PUBLIC INTDSP
INTDSP: ADR IADD ;INTEGER ROUTINES
ADR ISUB
ADR IMULT
ADR INTDIV
ADR ICOMP
PAGE
SUBTTL ERROR MESSAGE TABLE
DCUL MACRO X
DC X
ENDM
QQ=QQ-2
PUBLIC ERRTAB
ERRTAB:
DB 0
QQ=0
DCE MACRO X
ENDM
DCL MACRO X
QQ=QQ+1
DCUL X
DB 0
ENDM
DCE "NF"
DCL "NEXT without FOR"
PUBLIC ERRNF
ERRNF=QQ
DCE "SN"
DCL "Syntax error"
PUBLIC ERRSN
ERRSN=QQ
DCE "RG"
DCL "RETURN without GOSUB"
PUBLIC ERRRG
ERRRG=QQ
DCE "OD"
DCL "Out of DATA"
PUBLIC ERROD
ERROD=QQ
DCE "FC"
DCL "Illegal function call"
PUBLIC ERRFC
ERRFC=QQ
PUBLIC $OVMSG
$OVMSG:
PUBLIC OVRMSG
OVRMSG:
DCE "OV"
DCL "Overflow"
PUBLIC ERROV
ERROV=QQ
DCE "OM"
DCL "Out of memory"
PUBLIC ERROM
ERROM=QQ
DCE "UL"
DCL "Undefined line number"
PUBLIC ERRUS
ERRUS=QQ
DCE "BS"
DCL "Subscript out of range"
PUBLIC ERRBS
ERRBS=QQ
DCE "DD"
DCL "Duplicate Definition"
PUBLIC ERRDD
ERRDD=QQ
PUBLIC $DIV0M
$DIV0M:
PUBLIC DIVMSG
DIVMSG:
DCE "/0"
DCL "Division by zero"
PUBLIC ERRDV0
ERRDV0=QQ
DCE "ID"
DCL "Illegal direct"
PUBLIC ERRID
ERRID=QQ
DCE "TM"
DCL "Type mismatch"
PUBLIC ERRTM
ERRTM=QQ
DCE "OS"
DCL "Out of string space"
PUBLIC ERRSO
ERRSO=QQ
DCE "LS"
DCL "String too long"
PUBLIC ERRLS
ERRLS=QQ
DCE "ST"
DCL "String formula too complex"
PUBLIC ERRST
ERRST=QQ
DCE "CN"
DCL "Can't continue"
PUBLIC ERRCN
ERRCN=QQ
DCE "UF"
DCL "Undefined user function"
PUBLIC ERRUF
ERRUF=QQ
DCE "NR"
DCL "No RESUME"
PUBLIC ERRNR
ERRNR=QQ
DCE "RW"
DCL "RESUME without error"
PUBLIC ERRRE
ERRRE=QQ
DCE "UE"
DCL "Unprintable error"
PUBLIC ERRUE
ERRUE=QQ
DCE "MO"
DCL "Missing operand"
PUBLIC ERRMO
ERRMO=QQ
DCE "BO"
DCL "Line buffer overflow"
PUBLIC ERRLBO
ERRLBO=QQ
DCE "DT"
DCL "Device Timeout"
PUBLIC ERRDTO
ERRDTO=QQ
DCE "DF"
DCL "Device Fault"
PUBLIC ERRDVF
ERRDVF=QQ
DCE "FN"
DCL "FOR Without NEXT"
PUBLIC ERRFN
ERRFN=QQ
DCE "OP"
DCL "Out of Paper"
PUBLIC ERROTP
ERROTP=QQ
DCE "??"
DCL "?"
DCE "WH"
DCL "WHILE without WEND"
PUBLIC ERRWH
ERRWH=QQ
DCE "WE"
DCL "WEND without WHILE"
PUBLIC ERRWE
ERRWE=QQ
PUBLIC NONDSK
NONDSK=QQ ;LAST NON DISK ERROR.
;
; Following are DISK errors
;
QQ=49D ;DISK ERRORS START AT 50.
PUBLIC DSKERR
DSKERR=QQ ;FIRST DISK ERROR
PUBLIC ERRUE1
ERRUE1=ERRUE+DSKERR-NONDSK
PUBLIC DSKER1
DSKER1=DSKERR-NONDSK
DCE "FO"
DCL "FIELD overflow"
PUBLIC ERRFOV
ERRFOV=QQ
DCE "IE"
DCL "Internal error"
PUBLIC ERRIER
ERRIER=QQ
DCE "BN"
DCL "Bad file number"
PUBLIC ERRBFN
ERRBFN=QQ
PUBLIC ERRBFN
ERRBFN=QQ
DCE "FF"
DCL "File not found"
PUBLIC ERRFNF
ERRFNF=QQ
DCE "BM"
DCL "Bad file mode"
PUBLIC ERRBFM
ERRBFM=QQ
PUBLIC ERRFNO
ERRFNO=QQ ;Map "File Not Open" to "Bad file mode".
DCE "AO"
DCL "File already open"
PUBLIC ERRFAO
ERRFAO=QQ
DCE "??"
DCL "?"
PUBLIC DSKLOC
DSKLOC=$+6
DCE "IO"
DCL "Device I/O Error"
PUBLIC ERRDIO
ERRDIO=QQ
PUBLIC ERRDPE
ERRDPE=QQ ;Map "Device Parity Error" to
;"Device I/O Error".
PUBLIC ERRIOE
ERRIOE=QQ
DCE "FE"
DCL "File already exists"
PUBLIC ERRFAE
ERRFAE=QQ
DCE "??"
DCL "?"
DCE "??"
DCL "?"
DCE "DF"
DCL "Disk full"
PUBLIC ERRDFL
ERRDFL=QQ
DCE "EF"
DCL "Input past end"
PUBLIC ERRRPE
ERRRPE=QQ
DCE "RN"
DCL "Bad record number"
PUBLIC ERRBRN
ERRBRN=QQ
DCE "NM"
DCL "Bad file name"
PUBLIC ERRIFN
ERRIFN=QQ ;Map "Illegal filename" to "Bad file
;name".
PUBLIC ERRNMF
ERRNMF=QQ
DCE "??"
DCL "?"
PUBLIC ERRMMM
ERRMMM=QQ
DCE "DS"
DCL "Direct statement in file"
PUBLIC ERRFDR
ERRFDR=QQ
DCE "FL"
DCL "Too many files"
PUBLIC ERRTMF
ERRTMF=QQ
DCL "Device Unavailable"
PUBLIC ERRDNA
ERRDNA=QQ
DCL "Communication buffer overflow"
PUBLIC ERRCBO
ERRCBO=QQ
DCL "Disk write protected"
PUBLIC ERRDWP
ERRDWP=QQ
DCL "Disk not Ready"
PUBLIC ERRDNR
ERRDNR=QQ
DCL "Disk media error"
PUBLIC ERRDME
ERRDME=QQ
DCL "Advanced Feature"
PUBLIC ERRADV
ERRADV=QQ
DCL "Rename across disks"
PUBLIC ERRRAD
ERRRAD=QQ
PUBLIC LSTERR
LSTERR=QQ+1 ;LAST ERROR USED FOR RANGE CHECKS IN LEN2
PAGE
SUBTTL CONSTANTS FOR ROM BASIC I/O, RNDX, FDIV, USRGO
;********************************************************************
;
; NOTE!!! THIS RAM CODE IS REPRODUCED LATER IN THIS
; LISTING WITHOUT LABELS AND TARGETED
; FOR ROM. THIS ALLOWS THE CODE TO BE COPIED
; INTO RAM FOR EXECUTION. IF THERE IS A CHANGE
; TO BE MADE TO THE RAM CODE MAKE THE SIMULAR
; CHANGE TO THE ROM AREA CODE WITHOUT LABELS.
; THE ROM CODE IS BRACKETED BY AN IFN CONVRT
; AND A COMMENT INDICATING THE CODE IS FOR
; TARGET MACHINE COMPILATIONS.
;
;******************************************************************
PUBLIC CONSTR,RAMLOW
PUBLIC CNSLEN
CNSLEN=ENDCNS-CONSTR
;FOR ON-MACHINE COMPILATIONS
PUBLIC CONSTR
CONSTR=$
;************************************************************
;****** BEGDSG: is the begining of the data segment. *******
;****** It MUST be the first label in DSEG, as it is *******
;****** used by GWINIT to insert the OS control block *******
;************************************************************
DSEG SEGMENT PUBLIC 'DATASG'
ASSUME DS:DSEG
PUBLIC BEGDSG
BEGDSG LABEL WORD
ORG 2D
PUBLIC CPMMEM
CPMMEM LABEL WORD
DSEG ENDS
; ======== Code Phase ========
RAMLOW=$ ;WHERE CONSTANTS GET DEPOSITED
INS86 352 ;INTER-SEGMENT DIRECT JUMP
DB 4 DUP(?)
;
;THE FOLLOWING IS THE LAST RANDOM NUMBER GENERATED BY RND
;IT MUST NOT BE ZERO, IT MUST BE BETWEEN 0 AND 1.
;
.RADIX 8
DB 0
; RNDCNT:
DB 0
DB 0
RET ;THIS IS A KLUDGE TO MAKE CHRGET WORK
PUBLIC NUMCON
; NUMCON:
DB OFFSET CONCON ;THESE FAKE TOKENS FORCE CHRGET
DB OFFSET CONCN2 ;TO EFFECTIVELY RE-SCAN THE EMBEDED CONSTANT
PUBLIC DSEGZ
; DSEGZ:
DB 0 ;DATA SEGMENT-LOCATED ZERO
PUBLIC RNDCOP
; RNDCOP:
DB 122 ;COPY OF THE RANDOM NUMBER SEED
DB 307 ;BETWEEN 0 AND 1
DB 117
DB 200
PUBLIC $RNDX
; $RNDX:
PUBLIC RNDX
; RNDX:
DB 122 ;LAST RANDOM NUMBER GENERATED
DB 307 ;BETWEEN 0 AND 1
DB 117
DB 200
.RADIX 10
; STAINP:
IN AL,0
INS86 313 ;"LONG" RETURN
PUBLIC ENDPRG
; ENDPRG:
DB ":"
DB 0,0,0,0 ;FAKE END OF PROGRAM FOR RESUME NEXT
PAGE
SUBTTL LOW SEGMENT -- RAM-- IE THIS STUFF IS NOT CONSTANT
;
; THIS IS THE "VOLATILE" STORAGE AREA AND NONE OF IT
; CAN BE KEPT IN ROM. ANY CONSTANTS IN THIS AREA CANNOT
; BE KEPT IN A ROM, BUT MUST BE LOADED IN BY THE
; PROGRAM INSTRUCTIONS IN ROM.
;
PUBLIC USRTAB
; USRTAB:
REPT 10
DW 65535D
ENDM
PUBLIC NULCNT
; NULCNT:
DB 1 ;STORE HERE THE NUMBER OF NULLS
;TO PRINT AFTER CRLF
PUBLIC MSDCCF
; MSDCCF:
DB 0 ;Ctl-C flag set by Ctl-C int handler
PUBLIC CTLCAD
; CTLCAD:
DB 4 DUP(?) ;Store pre-BASIC CTL-C int vector
PUBLIC DINTAD
; DINTAD:
DB 4 DUP(?) ;Store BASIC Disk error int vector
PUBLIC LSTCHR
; LSTCHR:
DB 0 ;used by SCNSOT to remember last chr out
PUBLIC ERRFLG
; ERRFLG:
DB 0 ;USED TO SAVE THE ERROR NUMBER
; SO EDIT CAN BE CALLED ON "SN" ERR.
PUBLIC LPTLST
; LPTLST:
DB 0 ;LAST LINE PRINTER OPERATION. ZERO
;MEANS LINEFEED. NON-ZERO MEANS PRINT
;COMMAND (OKIA ONLY)
PUBLIC LPTPOS
; LPTPOS:
DB 0 ;POSITION OF LPT PRINT HEAD -initially 0
PUBLIC PRTFLG
; PRTFLG:
DB 0 ;WHETHER OUTPUT GOES TO LPT
LNCMPS=(((LPTLEN/CLMWID)-1)*CLMWID) ;LAST COMMA FIELD POSIT
PUBLIC NLPPOS
; NLPPOS:
DB OFFSET LNCMPS ;LAST COL # BEYOND WHICH NO MORE COMMA FIELDS
PUBLIC LPTSIZ
; LPTSIZ:
DB OFFSET LPTLEN ;DEFAULT LINE PRINTER WIDTH
PUBLIC DAYSPM
; DAYSPM:
DB 31D,28D,31D,30D,31D,30D
DB 31D,31D,30D,31D,30D,31D
NCMPOS=(((LINLN/CLMWID)-1)*CLMWID) ;POSITION BEYOND WHICH THERE ARE
;NO MORE COMMA FIELDS
; CLMLST:
DB OFFSET NCMPOS ;POSITION OF LAST COMMA COLUMN
PUBLIC RUBSW
; RUBSW:
DB 0 ;RUBOUT SWITCH =1 INSIDE
;THE PROCESSING OF A RUBOUT (INLIN)
PUBLIC CNTOFL
; CNTOFL:
DB 0 ;SUPRESS OUTPUT FLAG
;NON-ZERO MEANS SUPRESS
;RESET BY "INPUT",READY AND ERRORS
;COMPLEMENTED BY INPUT OF ^O
PUBLIC PTRFIL
; PTRFIL:
DW 0
;POINTER TO DATA BLOCK OF CURRENT FILE
;USED BY DISK AND NCR CASSETTE CODE
PUBLIC TOPMEM
; TOPMEM:
ADR TSTACK+100 ;TOP LOCATION TO USE FOR THE STACK
;INITIALLY SET UP BY INIT
;ACCORDING TO MEMORY SIZE
;TO ALLOW FOR 50 BYTES OF STRING SPACE.
;CHANGED BY A CLEAR COMMAND WITH
;AN ARGUMENT.
PUBLIC CURLIN
; CURLIN:
ADR 0+65534D ;CURRENT LINE #
;SET TO 65534 IN PURE VERSION DURING INIT EXECUTION
;SET TO 65535 WHEN DIRECT STATEMENTS EXECUTE
PUBLIC TXTTAB
; TXTTAB:
ADR TSTACK+1 ;POINTER TO BEGINNING OF TEXT
;DOESN'T CHANGE AFTER BEING
;SETUP BY INIT.
PUBLIC OVERRI
; OVERRI:
ADR OVRMSG ;ADDRESS OF MESSAGE TO PRINT (OVERFLOW)
PUBLIC CSRTYP
; CSRTYP:
DB 0 ;Type of next cursor
PUBLIC CSRFLG
; CSRFLG:
DB 0 ;Type of current cursor
;
;Generalized I/O initialized data definitions
;
; EXTERN .DVTBL, .DVPTR, .DVINI, .DVTRM
; INTERNs and EXTERNs moved out of the PHASE block for ASM86 translator.
; 9/2/82/NGT
PUBLIC DEVTBL
; DEVTBL:
ADR _DVTBL ;points to array of device names
PUBLIC DEVPTR
; DEVPTR:
ADR _DVPTR ;points to array of device dispatch tables
PUBLIC DEVINI
; DEVINI:
ADR _DVINI ;points to array of device initalize routines
PUBLIC DEVTRM
; DEVTRM:
ADR _DVTRM ;points to array of device termination routines
PUBLIC SAVKEY
; SAVKEY:
DB 0 ;for saving 2nd byte of 2-byte seq.
PUBLIC SAVKYF
; SAVKYF:
DB 0 ;Flag nonzero when SAVKEY is active (SAVKEY may be 0)
PUBLIC FREFDB
; FREFDB:
DW 0 ;Used by Device Open Routines to release FDB
;if error occurs after FDB is allocated but
;before File actually becomes OPEN.
;FDB is Freed by routine FINPRT.
DATSTR=$
;
; ======== Data Phase ========
;
DSEG SEGMENT PUBLIC 'DATASG'
ORG 0+400O
RAMLOW=$ ;WHERE CONSTANTS GET DEPOSITED
INS86 352 ;INTER-SEGMENT DIRECT JUMP
DB 4 DUP(?)
;
;THE FOLLOWING IS THE LAST RANDOM NUMBER GENERATED BY RND
;IT MUST NOT BE ZERO, IT MUST BE BETWEEN 0 AND 1.
;
.RADIX 8
DB 1 DUP (?)
RNDCNT LABEL WORD
DB 1 DUP (?)
DB 1 DUP (?)
RET ;THIS IS A KLUDGE TO MAKE CHRGET WORK
PUBLIC NUMCON
NUMCON LABEL WORD
DB 1 DUP (?) ;THESE FAKE TOKENS FORCE CHRGET
DB 1 DUP (?) ;TO EFFECTIVELY RE-SCAN THE EMBEDED CONSTANT
PUBLIC DSEGZ
DSEGZ LABEL WORD
DB 1 DUP (?) ;DATA SEGMENT-LOCATED ZERO
PUBLIC RNDCOP
RNDCOP LABEL WORD
DB 1 DUP (?) ;COPY OF THE RANDOM NUMBER SEED
DB 1 DUP (?) ;BETWEEN 0 AND 1
DB 1 DUP (?)
DB 1 DUP (?)
PUBLIC $RNDX
$RNDX LABEL WORD
PUBLIC RNDX
RNDX LABEL WORD
DB 1 DUP (?) ;LAST RANDOM NUMBER GENERATED
DB 1 DUP (?) ;BETWEEN 0 AND 1
DB 1 DUP (?)
DB 1 DUP (?)
.RADIX 10
STAINP LABEL WORD
IN AL,0
INS86 313 ;"LONG" RETURN
PUBLIC ENDPRG
ENDPRG LABEL WORD
DB 1 DUP (?)
DB 4 DUP (?) ;FAKE END OF PROGRAM FOR RESUME NEXT
PAGE
SUBTTL LOW SEGMENT -- RAM-- IE THIS STUFF IS NOT CONSTANT
;
; THIS IS THE "VOLATILE" STORAGE AREA AND NONE OF IT
; CAN BE KEPT IN ROM. ANY CONSTANTS IN THIS AREA CANNOT
; BE KEPT IN A ROM, BUT MUST BE LOADED IN BY THE
; PROGRAM INSTRUCTIONS IN ROM.
;
PUBLIC USRTAB
USRTAB LABEL WORD
REPT 10
DW 1 DUP (?)
ENDM
PUBLIC NULCNT
NULCNT LABEL WORD
DB 1 DUP (?) ;STORE HERE THE NUMBER OF NULLS
;TO PRINT AFTER CRLF
PUBLIC MSDCCF
MSDCCF LABEL WORD
DB 1 DUP (?) ;Ctl-C flag set by Ctl-C int handler
PUBLIC CTLCAD
CTLCAD LABEL WORD
DB 4 DUP(?) ;Store pre-BASIC CTL-C int vector
PUBLIC DINTAD
DINTAD LABEL WORD
DB 4 DUP(?) ;Store BASIC Disk error int vector
PUBLIC LSTCHR
LSTCHR LABEL WORD
DB 1 DUP (?) ;used by SCNSOT to remember last chr out
PUBLIC ERRFLG
ERRFLG LABEL WORD
DB 1 DUP (?) ;USED TO SAVE THE ERROR NUMBER
; SO EDIT CAN BE CALLED ON "SN" ERR.
PUBLIC LPTLST
LPTLST LABEL WORD
DB 1 DUP (?) ;LAST LINE PRINTER OPERATION. ZERO
;MEANS LINEFEED. NON-ZERO MEANS PRINT
;COMMAND (OKIA ONLY)
PUBLIC LPTPOS
LPTPOS LABEL WORD
DB 1 DUP (?) ;POSITION OF LPT PRINT HEAD -initially 0
PUBLIC PRTFLG
PRTFLG LABEL WORD
DB 1 DUP (?) ;WHETHER OUTPUT GOES TO LPT
LNCMPS=(((LPTLEN/CLMWID)-1)*CLMWID) ;LAST COMMA FIELD POSIT
PUBLIC NLPPOS
NLPPOS LABEL WORD
DB 1 DUP (?) ;LAST COL # BEYOND WHICH NO MORE COMMA FIELDS
PUBLIC LPTSIZ
LPTSIZ LABEL WORD
DB 1 DUP (?) ;DEFAULT LINE PRINTER WIDTH
PUBLIC DAYSPM
DAYSPM LABEL WORD
DB 6 DUP (?)
DB 6 DUP (?)
NCMPOS=(((LINLN/CLMWID)-1)*CLMWID) ;POSITION BEYOND WHICH THERE ARE
;NO MORE COMMA FIELDS
CLMLST LABEL WORD
DB 1 DUP (?) ;POSITION OF LAST COMMA COLUMN
PUBLIC RUBSW
RUBSW LABEL WORD
DB 1 DUP (?) ;RUBOUT SWITCH =1 INSIDE
;THE PROCESSING OF A RUBOUT (INLIN)
PUBLIC CNTOFL
CNTOFL LABEL WORD
DB 1 DUP (?) ;SUPRESS OUTPUT FLAG
;NON-ZERO MEANS SUPRESS
;RESET BY "INPUT",READY AND ERRORS
;COMPLEMENTED BY INPUT OF ^O
PUBLIC PTRFIL
PTRFIL LABEL WORD
DW 1 DUP (?)
;POINTER TO DATA BLOCK OF CURRENT FILE
;USED BY DISK AND NCR CASSETTE CODE
PUBLIC TOPMEM
TOPMEM LABEL WORD
ADR TSTACK+100 ;TOP LOCATION TO USE FOR THE STACK
;INITIALLY SET UP BY INIT
;ACCORDING TO MEMORY SIZE
;TO ALLOW FOR 50 BYTES OF STRING SPACE.
;CHANGED BY A CLEAR COMMAND WITH
;AN ARGUMENT.
PUBLIC CURLIN
CURLIN LABEL WORD
ADR 0+65534D ;CURRENT LINE #
;SET TO 65534 IN PURE VERSION DURING INIT EXECUTION
;SET TO 65535 WHEN DIRECT STATEMENTS EXECUTE
PUBLIC TXTTAB
TXTTAB LABEL WORD
ADR TSTACK+1 ;POINTER TO BEGINNING OF TEXT
;DOESN'T CHANGE AFTER BEING
;SETUP BY INIT.
PUBLIC OVERRI
OVERRI LABEL WORD
ADR OVRMSG ;ADDRESS OF MESSAGE TO PRINT (OVERFLOW)
PUBLIC CSRTYP
CSRTYP LABEL WORD
DB 1 DUP (?) ;Type of next cursor
PUBLIC CSRFLG
CSRFLG LABEL WORD
DB 1 DUP (?) ;Type of current cursor
;
;Generalized I/O initialized data definitions
;
; EXTERN .DVTBL, .DVPTR, .DVINI, .DVTRM
; INTERNs and EXTERNs moved out of the PHASE block for ASM86 translator.
; 9/2/82/NGT
PUBLIC DEVTBL
DEVTBL LABEL WORD
ADR _DVTBL ;points to array of device names
PUBLIC DEVPTR
DEVPTR LABEL WORD
ADR _DVPTR ;points to array of device dispatch tables
PUBLIC DEVINI
DEVINI LABEL WORD
ADR _DVINI ;points to array of device initalize routines
PUBLIC DEVTRM
DEVTRM LABEL WORD
ADR _DVTRM ;points to array of device termination routines
PUBLIC SAVKEY
SAVKEY LABEL WORD
DB 1 DUP (?) ;for saving 2nd byte of 2-byte seq.
PUBLIC SAVKYF
SAVKYF LABEL WORD
DB 1 DUP (?) ;Flag nonzero when SAVKEY is active (SAVKEY may be 0)
PUBLIC FREFDB
FREFDB LABEL WORD
DW 1 DUP (?) ;Used by Device Open Routines to release FDB
;if error occurs after FDB is allocated but
;before File actually becomes OPEN.
;FDB is Freed by routine FINPRT.
DATSTR=$
DSEG ENDS
;
;========== End of Phase ==========
;
ENDCNS=$
DSEG SEGMENT PUBLIC 'DATASG' ;Start the data segment
;
;
;GIO86 uninitialized data definitions: